@nicia-ai/typegraph 0.49.0 → 0.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/dist/backend/drizzle/indexes.cjs +11 -9
- package/dist/backend/drizzle/indexes.d.cts +1 -1
- package/dist/backend/drizzle/indexes.d.ts +1 -1
- package/dist/backend/drizzle/indexes.js +7 -5
- package/dist/backend/index.cjs +190 -53
- package/dist/backend/index.d.cts +90 -4
- package/dist/backend/index.d.ts +90 -4
- package/dist/backend/index.js +9 -12
- package/dist/backend/postgres/index.cjs +36 -28
- package/dist/backend/postgres/index.d.cts +7 -7
- package/dist/backend/postgres/index.d.ts +7 -7
- package/dist/backend/postgres/index.js +19 -15
- package/dist/backend/postgres/pglite-store.cjs +7 -62
- package/dist/backend/postgres/pglite-store.cjs.map +1 -1
- package/dist/backend/postgres/pglite-store.d.cts +8 -8
- package/dist/backend/postgres/pglite-store.d.ts +8 -8
- package/dist/backend/postgres/pglite-store.js +7 -62
- package/dist/backend/postgres/pglite-store.js.map +1 -1
- package/dist/backend/postgres/pglite.cjs +21 -17
- package/dist/backend/postgres/pglite.d.cts +3 -3
- package/dist/backend/postgres/pglite.d.ts +3 -3
- package/dist/backend/postgres/pglite.js +20 -16
- package/dist/backend/sqlite/index.cjs +33 -25
- package/dist/backend/sqlite/index.d.cts +7 -7
- package/dist/backend/sqlite/index.d.ts +7 -7
- package/dist/backend/sqlite/index.js +17 -13
- package/dist/backend/sqlite/libsql.cjs +24 -20
- package/dist/backend/sqlite/libsql.cjs.map +1 -1
- package/dist/backend/sqlite/libsql.d.cts +3 -3
- package/dist/backend/sqlite/libsql.d.ts +3 -3
- package/dist/backend/sqlite/libsql.js +19 -15
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local-store.cjs +9 -64
- package/dist/backend/sqlite/local-store.cjs.map +1 -1
- package/dist/backend/sqlite/local-store.d.cts +8 -8
- package/dist/backend/sqlite/local-store.d.ts +8 -8
- package/dist/backend/sqlite/local-store.js +8 -64
- package/dist/backend/sqlite/local-store.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +25 -20
- package/dist/backend/sqlite/local.d.cts +3 -3
- package/dist/backend/sqlite/local.d.ts +3 -3
- package/dist/backend/sqlite/local.js +21 -16
- package/dist/chunk-2CVDZCXH.cjs +1278 -0
- package/dist/chunk-2CVDZCXH.cjs.map +1 -0
- package/dist/{chunk-MYKHJI2J.js → chunk-2DWTBNSH.js} +3 -3
- package/dist/{chunk-MYKHJI2J.js.map → chunk-2DWTBNSH.js.map} +1 -1
- package/dist/{chunk-JB6T4GLL.cjs → chunk-2KCTP3U2.cjs} +870 -528
- package/dist/chunk-2KCTP3U2.cjs.map +1 -0
- package/dist/{chunk-OORXGFL5.cjs → chunk-322TBTOQ.cjs} +48 -48
- package/dist/{chunk-OORXGFL5.cjs.map → chunk-322TBTOQ.cjs.map} +1 -1
- package/dist/{chunk-FA2AFWLP.cjs → chunk-36SX6QXP.cjs} +31 -12
- package/dist/chunk-36SX6QXP.cjs.map +1 -0
- package/dist/{chunk-SDBBMD4N.js → chunk-36VYWVQU.js} +3 -3
- package/dist/{chunk-SDBBMD4N.js.map → chunk-36VYWVQU.js.map} +1 -1
- package/dist/chunk-4DKY6RIU.js +1253 -0
- package/dist/chunk-4DKY6RIU.js.map +1 -0
- package/dist/chunk-4QKOZYMV.js +9 -0
- package/dist/chunk-4QKOZYMV.js.map +1 -0
- package/dist/{chunk-WIC7DRXW.js → chunk-57JM6NW3.js} +9 -19
- package/dist/chunk-57JM6NW3.js.map +1 -0
- package/dist/chunk-5WWEYV4H.cjs +5113 -0
- package/dist/chunk-5WWEYV4H.cjs.map +1 -0
- package/dist/chunk-6KQEICJ6.cjs +12 -0
- package/dist/{chunk-MKJ4KXL5.cjs.map → chunk-6KQEICJ6.cjs.map} +1 -1
- package/dist/{chunk-DZAICA5J.js → chunk-6NKSE5AU.js} +4 -4
- package/dist/{chunk-DZAICA5J.js.map → chunk-6NKSE5AU.js.map} +1 -1
- package/dist/{chunk-KKBDXCLQ.js → chunk-6NLYIMJO.js} +4 -4
- package/dist/{chunk-KKBDXCLQ.js.map → chunk-6NLYIMJO.js.map} +1 -1
- package/dist/{chunk-BFUOME67.cjs → chunk-7B7I7YAW.cjs} +20 -11
- package/dist/chunk-7B7I7YAW.cjs.map +1 -0
- package/dist/{chunk-ZDKTPBGV.js → chunk-7G5IYROL.js} +6 -548
- package/dist/chunk-7G5IYROL.js.map +1 -0
- package/dist/{chunk-3DMMGT6S.js → chunk-7QFRK6PU.js} +4 -8
- package/dist/chunk-7QFRK6PU.js.map +1 -0
- package/dist/chunk-A4C4NJ5U.cjs +12 -0
- package/dist/chunk-A4C4NJ5U.cjs.map +1 -0
- package/dist/{chunk-CHAOFCHV.js → chunk-AH2A74OZ.js} +3 -3
- package/dist/{chunk-CHAOFCHV.js.map → chunk-AH2A74OZ.js.map} +1 -1
- package/dist/{chunk-UGHQV7MP.cjs → chunk-B3MN7EJR.cjs} +228 -162
- package/dist/chunk-B3MN7EJR.cjs.map +1 -0
- package/dist/{chunk-TZEGUG6D.cjs → chunk-BZ5MVITP.cjs} +4 -4
- package/dist/{chunk-TZEGUG6D.cjs.map → chunk-BZ5MVITP.cjs.map} +1 -1
- package/dist/{chunk-YVF2EM7B.js → chunk-CAI6SMP6.js} +3 -3
- package/dist/{chunk-YVF2EM7B.js.map → chunk-CAI6SMP6.js.map} +1 -1
- package/dist/{chunk-JONXFAPO.js → chunk-CBOD7TXH.js} +5 -5
- package/dist/{chunk-JONXFAPO.js.map → chunk-CBOD7TXH.js.map} +1 -1
- package/dist/{chunk-FQPEMEWX.cjs → chunk-CRZ56SZU.cjs} +81 -32
- package/dist/chunk-CRZ56SZU.cjs.map +1 -0
- package/dist/{chunk-DO7SAMEK.cjs → chunk-D3GWARN7.cjs} +47 -47
- package/dist/{chunk-DO7SAMEK.cjs.map → chunk-D3GWARN7.cjs.map} +1 -1
- package/dist/{chunk-QTD6HX4O.js → chunk-D3OUDFU7.js} +5 -5
- package/dist/{chunk-QTD6HX4O.js.map → chunk-D3OUDFU7.js.map} +1 -1
- package/dist/{chunk-2QGYQBS2.cjs → chunk-DWUDZ66O.cjs} +10 -10
- package/dist/{chunk-2QGYQBS2.cjs.map → chunk-DWUDZ66O.cjs.map} +1 -1
- package/dist/chunk-EKG2UXNX.cjs +23 -0
- package/dist/chunk-EKG2UXNX.cjs.map +1 -0
- package/dist/chunk-FMMW3KX7.cjs +148 -0
- package/dist/chunk-FMMW3KX7.cjs.map +1 -0
- package/dist/{chunk-XVWOYKIK.js → chunk-FZHF5UWR.js} +3 -3
- package/dist/{chunk-XVWOYKIK.js.map → chunk-FZHF5UWR.js.map} +1 -1
- package/dist/chunk-H2VWDQWC.cjs +571 -0
- package/dist/chunk-H2VWDQWC.cjs.map +1 -0
- package/dist/chunk-H4FY6OZK.js +13 -0
- package/dist/chunk-H4FY6OZK.js.map +1 -0
- package/dist/{chunk-EDN4Y4ZG.cjs → chunk-H5IJSROF.cjs} +9 -15
- package/dist/chunk-H5IJSROF.cjs.map +1 -0
- package/dist/chunk-HZUB5CON.js +27 -0
- package/dist/chunk-HZUB5CON.js.map +1 -0
- package/dist/{chunk-NACVVDWB.js → chunk-I5IOSA27.js} +103 -105
- package/dist/chunk-I5IOSA27.js.map +1 -0
- package/dist/{chunk-OI2GQ25X.cjs → chunk-I7YAY2VQ.cjs} +7 -7
- package/dist/{chunk-OI2GQ25X.cjs.map → chunk-I7YAY2VQ.cjs.map} +1 -1
- package/dist/chunk-IRCWIA3R.js +20 -0
- package/dist/chunk-IRCWIA3R.js.map +1 -0
- package/dist/chunk-IVQBLXBK.cjs +55 -0
- package/dist/chunk-IVQBLXBK.cjs.map +1 -0
- package/dist/{chunk-7SQSZN2J.js → chunk-IZD4HTCP.js} +5 -5
- package/dist/{chunk-7SQSZN2J.js.map → chunk-IZD4HTCP.js.map} +1 -1
- package/dist/{chunk-3FPR224C.cjs → chunk-JHRUZ73O.cjs} +116 -107
- package/dist/chunk-JHRUZ73O.cjs.map +1 -0
- package/dist/{chunk-EZEEWCFJ.cjs → chunk-JQKMEKKW.cjs} +525 -298
- package/dist/chunk-JQKMEKKW.cjs.map +1 -0
- package/dist/chunk-JVA3KDEA.cjs +691 -0
- package/dist/chunk-JVA3KDEA.cjs.map +1 -0
- package/dist/{chunk-5K2BKEBD.js → chunk-K46SDNQD.js} +10 -4
- package/dist/chunk-K46SDNQD.js.map +1 -0
- package/dist/{chunk-7LZJNLA5.js → chunk-K67P5DLL.js} +108 -42
- package/dist/chunk-K67P5DLL.js.map +1 -0
- package/dist/{chunk-3G5W2U2L.cjs → chunk-KACEYDYV.cjs} +335 -258
- package/dist/chunk-KACEYDYV.cjs.map +1 -0
- package/dist/{chunk-JFRT7S3B.cjs → chunk-L6EVYIID.cjs} +318 -478
- package/dist/chunk-L6EVYIID.cjs.map +1 -0
- package/dist/{chunk-SHFBB23Q.js → chunk-LI4K2KEJ.js} +6 -4
- package/dist/chunk-LI4K2KEJ.js.map +1 -0
- package/dist/chunk-LKZDQ2B4.js +1581 -0
- package/dist/chunk-LKZDQ2B4.js.map +1 -0
- package/dist/{chunk-WODMN3Q2.cjs → chunk-LLFPQOBA.cjs} +27 -27
- package/dist/{chunk-WODMN3Q2.cjs.map → chunk-LLFPQOBA.cjs.map} +1 -1
- package/dist/{chunk-P6YLZTRE.js → chunk-LZMQ3SFK.js} +3 -3
- package/dist/{chunk-P6YLZTRE.js.map → chunk-LZMQ3SFK.js.map} +1 -1
- package/dist/{chunk-HEV35TGT.js → chunk-M3VTS3F6.js} +13 -4
- package/dist/chunk-M3VTS3F6.js.map +1 -0
- package/dist/{chunk-TQHGE7UC.cjs → chunk-M5MSP3BI.cjs} +18 -10
- package/dist/chunk-M5MSP3BI.cjs.map +1 -0
- package/dist/{chunk-D4QLTJSM.js → chunk-NBOS7BY3.js} +63 -23
- package/dist/chunk-NBOS7BY3.js.map +1 -0
- package/dist/chunk-NGQDGL5X.js +140 -0
- package/dist/chunk-NGQDGL5X.js.map +1 -0
- package/dist/{chunk-SIT26LAZ.cjs → chunk-NLX5OWK7.cjs} +33 -5
- package/dist/chunk-NLX5OWK7.cjs.map +1 -0
- package/dist/chunk-NUQ2YFFH.cjs +1637 -0
- package/dist/chunk-NUQ2YFFH.cjs.map +1 -0
- package/dist/{chunk-UMGZDVOA.cjs → chunk-OGL4X4PH.cjs} +206 -208
- package/dist/chunk-OGL4X4PH.cjs.map +1 -0
- package/dist/{chunk-LRQKXRXO.cjs → chunk-OTNTGEXR.cjs} +4 -4
- package/dist/{chunk-LRQKXRXO.cjs.map → chunk-OTNTGEXR.cjs.map} +1 -1
- package/dist/chunk-OTWE63BW.js +53 -0
- package/dist/chunk-OTWE63BW.js.map +1 -0
- package/dist/chunk-PC5NGH5A.js +549 -0
- package/dist/chunk-PC5NGH5A.js.map +1 -0
- package/dist/{chunk-26YKDNUD.cjs → chunk-PS3TUWJM.cjs} +12 -10
- package/dist/chunk-PS3TUWJM.cjs.map +1 -0
- package/dist/{chunk-OMZ37BM2.js → chunk-PVFFH7TL.js} +5 -5
- package/dist/{chunk-OMZ37BM2.js.map → chunk-PVFFH7TL.js.map} +1 -1
- package/dist/chunk-QCD5JKU4.cjs +15 -0
- package/dist/chunk-QCD5JKU4.cjs.map +1 -0
- package/dist/{chunk-UGHG7PGX.js → chunk-QG5VEOKX.js} +30 -4
- package/dist/chunk-QG5VEOKX.js.map +1 -0
- package/dist/{chunk-TUNPBZY3.cjs → chunk-QLLZM5I3.cjs} +4 -4
- package/dist/{chunk-TUNPBZY3.cjs.map → chunk-QLLZM5I3.cjs.map} +1 -1
- package/dist/{chunk-BRRP76WO.js → chunk-RCBG6YMT.js} +781 -375
- package/dist/chunk-RCBG6YMT.js.map +1 -0
- package/dist/{chunk-LTXQOEIC.js → chunk-RI7RJH4G.js} +281 -204
- package/dist/chunk-RI7RJH4G.js.map +1 -0
- package/dist/{chunk-GYEG3ZLZ.cjs → chunk-RJMHU2MG.cjs} +121 -18
- package/dist/chunk-RJMHU2MG.cjs.map +1 -0
- package/dist/{chunk-GLHXM7C4.js → chunk-RVUL2HXY.js} +61 -23
- package/dist/chunk-RVUL2HXY.js.map +1 -0
- package/dist/chunk-RWUWTJQY.cjs +30 -0
- package/dist/chunk-RWUWTJQY.cjs.map +1 -0
- package/dist/{chunk-2O4PCIZ6.cjs → chunk-S5GU4LUN.cjs} +13 -13
- package/dist/{chunk-2O4PCIZ6.cjs.map → chunk-S5GU4LUN.cjs.map} +1 -1
- package/dist/{chunk-JPD2CTC3.js → chunk-SDPWO2Z5.js} +7 -7
- package/dist/{chunk-JPD2CTC3.js.map → chunk-SDPWO2Z5.js.map} +1 -1
- package/dist/{chunk-OVI7IXYX.js → chunk-SLGGT2XD.js} +3 -3
- package/dist/{chunk-OVI7IXYX.js.map → chunk-SLGGT2XD.js.map} +1 -1
- package/dist/{chunk-ROR5ZR6A.cjs → chunk-TIJUA4I6.cjs} +45 -45
- package/dist/{chunk-ROR5ZR6A.cjs.map → chunk-TIJUA4I6.cjs.map} +1 -1
- package/dist/{chunk-AOSSQDVO.cjs → chunk-TM54OBHX.cjs} +13 -13
- package/dist/{chunk-AOSSQDVO.cjs.map → chunk-TM54OBHX.cjs.map} +1 -1
- package/dist/{chunk-KF6K7TGH.js → chunk-TYEYRCXL.js} +766 -433
- package/dist/chunk-TYEYRCXL.js.map +1 -0
- package/dist/{chunk-Z2JCLZFJ.js → chunk-UKOVGCRN.js} +2151 -570
- package/dist/chunk-UKOVGCRN.js.map +1 -0
- package/dist/chunk-UYKDYE5D.cjs +12 -0
- package/dist/{chunk-CICO5GXD.cjs.map → chunk-UYKDYE5D.cjs.map} +1 -1
- package/dist/{chunk-S5TERQVW.js → chunk-VAAC7L57.js} +284 -66
- package/dist/chunk-VAAC7L57.js.map +1 -0
- package/dist/{chunk-7UOLHNWC.cjs → chunk-VKHXYVN7.cjs} +22 -33
- package/dist/chunk-VKHXYVN7.cjs.map +1 -0
- package/dist/{chunk-6NGW27EO.cjs → chunk-VLBTRXA2.cjs} +10 -10
- package/dist/{chunk-6NGW27EO.cjs.map → chunk-VLBTRXA2.cjs.map} +1 -1
- package/dist/{chunk-YIURNGXI.js → chunk-VUQZNUHU.js} +22 -6
- package/dist/chunk-VUQZNUHU.js.map +1 -0
- package/dist/{chunk-YYUHLYM2.cjs → chunk-WDM5WQK4.cjs} +183 -143
- package/dist/chunk-WDM5WQK4.cjs.map +1 -0
- package/dist/{chunk-ZFMCDJGB.js → chunk-WFSYYU4W.js} +70 -220
- package/dist/chunk-WFSYYU4W.js.map +1 -0
- package/dist/{chunk-SR725PWF.cjs → chunk-WRBV2FNH.cjs} +2065 -1659
- package/dist/chunk-WRBV2FNH.cjs.map +1 -0
- package/dist/{chunk-MRDBBHIZ.cjs → chunk-X4GDXBOP.cjs} +2 -2
- package/dist/chunk-X4GDXBOP.cjs.map +1 -0
- package/dist/chunk-XORONCV3.js +202 -0
- package/dist/chunk-XORONCV3.js.map +1 -0
- package/dist/{chunk-D5R42W5D.js → chunk-XZW2CTNO.js} +115 -12
- package/dist/chunk-XZW2CTNO.js.map +1 -0
- package/dist/{chunk-ZLONH2UD.js → chunk-YDEJQWOL.js} +2 -2
- package/dist/chunk-YDEJQWOL.js.map +1 -0
- package/dist/{chunk-2TYSSBU5.js → chunk-YT2IVFAI.js} +30 -21
- package/dist/chunk-YT2IVFAI.js.map +1 -0
- package/dist/chunk-ZGVTNKTX.cjs +217 -0
- package/dist/chunk-ZGVTNKTX.cjs.map +1 -0
- package/dist/core/index.cjs +29 -28
- package/dist/core/index.d.cts +4 -4
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +9 -8
- package/dist/{ddl-D_oW-EVO.d.ts → ddl-BvcbgzHo.d.ts} +3 -3
- package/dist/{ddl-BL1NZLMY.d.cts → ddl-Ufebz5q5.d.cts} +3 -3
- package/dist/graph-extension/index.cjs +21 -20
- package/dist/graph-extension/index.d.cts +2 -4
- package/dist/graph-extension/index.d.ts +2 -4
- package/dist/graph-extension/index.js +5 -4
- package/dist/graph-merge/index.cjs +324 -307
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +8 -9
- package/dist/graph-merge/index.d.ts +8 -9
- package/dist/graph-merge/index.js +51 -34
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/index.cjs +224 -222
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -12
- package/dist/index.d.ts +11 -12
- package/dist/index.js +38 -36
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +15 -13
- package/dist/indexes/index.d.cts +4 -4
- package/dist/indexes/index.d.ts +4 -4
- package/dist/indexes/index.js +8 -6
- package/dist/{ingestion-import-target-dNeL7iAv.d.ts → ingestion-import-target-CAs1OX-l.d.cts} +1 -1
- package/dist/{ingestion-import-target-XPxZYw89.d.cts → ingestion-import-target-DCQSPfNx.d.ts} +1 -1
- package/dist/interchange/index.cjs +57 -54
- package/dist/interchange/index.cjs.map +1 -1
- package/dist/interchange/index.d.cts +19 -8
- package/dist/interchange/index.d.ts +19 -8
- package/dist/interchange/index.js +21 -18
- package/dist/interchange/index.js.map +1 -1
- package/dist/local-store-impl-6DDTFM32.cjs +77 -0
- package/dist/local-store-impl-6DDTFM32.cjs.map +1 -0
- package/dist/local-store-impl-OXTOVU2J.js +75 -0
- package/dist/local-store-impl-OXTOVU2J.js.map +1 -0
- package/dist/{manager-CYaff3n3.d.cts → manager-B68OrPR2.d.ts} +29 -2
- package/dist/{manager-D9eRT_ns.d.ts → manager-D_t7oK69.d.cts} +29 -2
- package/dist/pglite-store-impl-6EMZGL7K.js +73 -0
- package/dist/pglite-store-impl-6EMZGL7K.js.map +1 -0
- package/dist/pglite-store-impl-GJG3Y7RP.cjs +75 -0
- package/dist/pglite-store-impl-GJG3Y7RP.cjs.map +1 -0
- package/dist/{postgres-CcL4bAHS.d.ts → postgres-BPLSVyHM.d.ts} +279 -2
- package/dist/{postgres-DMj39MEu.d.cts → postgres-CqvtFC2y.d.cts} +279 -2
- package/dist/profiler/index.d.cts +9 -9
- package/dist/profiler/index.d.ts +9 -9
- package/dist/provenance/index.cjs +59 -44
- package/dist/provenance/index.cjs.map +1 -1
- package/dist/provenance/index.d.cts +7 -7
- package/dist/provenance/index.d.ts +7 -7
- package/dist/provenance/index.js +28 -13
- package/dist/provenance/index.js.map +1 -1
- package/dist/{repair-validity-windows-BFNZvd_H.d.cts → repair-validity-windows-DEzCKAdy.d.cts} +7 -3
- package/dist/{repair-validity-windows-DlUSqwCg.d.ts → repair-validity-windows-GMdaS2AH.d.ts} +7 -3
- package/dist/resolve-D_H8MHtq.d.ts +1805 -0
- package/dist/resolve-WEW8gWws.d.cts +1805 -0
- package/dist/schema/index.cjs +48 -46
- package/dist/schema/index.d.cts +4 -6
- package/dist/schema/index.d.ts +4 -6
- package/dist/schema/index.js +21 -19
- package/dist/{searchable-bpE1bBfc.d.ts → searchable-C_UREI9K.d.ts} +1 -1
- package/dist/{searchable-DHJMh_nj.d.cts → searchable-ClgET_i7.d.cts} +1 -1
- package/dist/{sqlite-YppHrNFb.d.cts → sqlite-D1mXO9Kp.d.cts} +310 -2
- package/dist/{sqlite-D7Oz0SQh.d.ts → sqlite-MZA3oZNB.d.ts} +310 -2
- package/dist/{store-bphCSo7z.d.cts → store-CuFX7fCx.d.cts} +117 -31
- package/dist/{store-DRrFCx5x.d.ts → store-D-ZjXQpW.d.ts} +117 -31
- package/dist/{temporal-CbnLzTmM.d.ts → temporal-CpyEiRY8.d.cts} +1 -1
- package/dist/{temporal-5GqpYCk2.d.cts → temporal-y0Aep9Su.d.ts} +1 -1
- package/dist/{types-BqFZTQmV.d.cts → types-6yf0Vv-_.d.cts} +2016 -94
- package/dist/{types-BqFZTQmV.d.ts → types-6yf0Vv-_.d.ts} +2016 -94
- package/dist/{types-Bx74kaTt.d.ts → types-DzJ4dlzk.d.cts} +1 -1
- package/dist/{types-CXAhpW-c.d.cts → types-_vVSB9k-.d.ts} +1 -1
- package/dist/{where-O-k2wgYm.d.ts → where-DuG2LCLe.d.ts} +1 -1
- package/dist/{where-DI_Fqz-X.d.cts → where-Mhf_yyKX.d.cts} +1 -1
- package/package.json +7 -2
- package/dist/chunk-26YKDNUD.cjs.map +0 -1
- package/dist/chunk-2TYSSBU5.js.map +0 -1
- package/dist/chunk-3DMMGT6S.js.map +0 -1
- package/dist/chunk-3FPR224C.cjs.map +0 -1
- package/dist/chunk-3G5W2U2L.cjs.map +0 -1
- package/dist/chunk-3KOY4FH3.cjs +0 -934
- package/dist/chunk-3KOY4FH3.cjs.map +0 -1
- package/dist/chunk-3QNZ5SAJ.cjs +0 -3502
- package/dist/chunk-3QNZ5SAJ.cjs.map +0 -1
- package/dist/chunk-3U5ABFDW.cjs +0 -259
- package/dist/chunk-3U5ABFDW.cjs.map +0 -1
- package/dist/chunk-5K2BKEBD.js.map +0 -1
- package/dist/chunk-5PRKMB24.cjs +0 -124
- package/dist/chunk-5PRKMB24.cjs.map +0 -1
- package/dist/chunk-6LN7FIVU.js +0 -107
- package/dist/chunk-6LN7FIVU.js.map +0 -1
- package/dist/chunk-6SWPJEYN.js +0 -1126
- package/dist/chunk-6SWPJEYN.js.map +0 -1
- package/dist/chunk-7LZJNLA5.js.map +0 -1
- package/dist/chunk-7UOLHNWC.cjs.map +0 -1
- package/dist/chunk-BFUOME67.cjs.map +0 -1
- package/dist/chunk-BRRP76WO.js.map +0 -1
- package/dist/chunk-CICO5GXD.cjs +0 -12
- package/dist/chunk-D4QLTJSM.js.map +0 -1
- package/dist/chunk-D5R42W5D.js.map +0 -1
- package/dist/chunk-EDN4Y4ZG.cjs.map +0 -1
- package/dist/chunk-EZEEWCFJ.cjs.map +0 -1
- package/dist/chunk-FA2AFWLP.cjs.map +0 -1
- package/dist/chunk-FQPEMEWX.cjs.map +0 -1
- package/dist/chunk-GLHXM7C4.js.map +0 -1
- package/dist/chunk-GYEG3ZLZ.cjs.map +0 -1
- package/dist/chunk-HDL2ARHX.cjs +0 -1156
- package/dist/chunk-HDL2ARHX.cjs.map +0 -1
- package/dist/chunk-HEV35TGT.js.map +0 -1
- package/dist/chunk-I4GAZH5Z.js +0 -913
- package/dist/chunk-I4GAZH5Z.js.map +0 -1
- package/dist/chunk-JB6T4GLL.cjs.map +0 -1
- package/dist/chunk-JBQQ7THH.js +0 -20
- package/dist/chunk-JBQQ7THH.js.map +0 -1
- package/dist/chunk-JFRT7S3B.cjs.map +0 -1
- package/dist/chunk-KF6K7TGH.js.map +0 -1
- package/dist/chunk-L3LQNR34.cjs +0 -1254
- package/dist/chunk-L3LQNR34.cjs.map +0 -1
- package/dist/chunk-LTXQOEIC.js.map +0 -1
- package/dist/chunk-MKJ4KXL5.cjs +0 -12
- package/dist/chunk-MRDBBHIZ.cjs.map +0 -1
- package/dist/chunk-NACVVDWB.js.map +0 -1
- package/dist/chunk-NVY5CJFP.js +0 -244
- package/dist/chunk-NVY5CJFP.js.map +0 -1
- package/dist/chunk-PWLJ77UV.cjs +0 -23
- package/dist/chunk-PWLJ77UV.cjs.map +0 -1
- package/dist/chunk-S5TERQVW.js.map +0 -1
- package/dist/chunk-SHFBB23Q.js.map +0 -1
- package/dist/chunk-SIT26LAZ.cjs.map +0 -1
- package/dist/chunk-SR725PWF.cjs.map +0 -1
- package/dist/chunk-TQHGE7UC.cjs.map +0 -1
- package/dist/chunk-UGHG7PGX.js.map +0 -1
- package/dist/chunk-UGHQV7MP.cjs.map +0 -1
- package/dist/chunk-UMGZDVOA.cjs.map +0 -1
- package/dist/chunk-WIC7DRXW.js.map +0 -1
- package/dist/chunk-YIURNGXI.js.map +0 -1
- package/dist/chunk-YYUHLYM2.cjs.map +0 -1
- package/dist/chunk-Z2JCLZFJ.js.map +0 -1
- package/dist/chunk-ZDKTPBGV.js.map +0 -1
- package/dist/chunk-ZFMCDJGB.js.map +0 -1
- package/dist/chunk-ZLONH2UD.js.map +0 -1
- package/dist/index-COs_z6nV.d.cts +0 -1132
- package/dist/index-D7d1u2gr.d.ts +0 -1132
- package/dist/materialize-indexes-DJ3ykH59.d.ts +0 -266
- package/dist/materialize-indexes-DTtAnvfY.d.cts +0 -266
|
@@ -1,27 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
// src/backend/table-names.ts
|
|
13
|
-
function definedTableNameOverrides(override) {
|
|
14
|
-
if (override === void 0) return {};
|
|
15
|
-
return Object.fromEntries(
|
|
16
|
-
Object.entries(override).filter(([, tableName]) => tableName !== void 0)
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
function resolvedTableNames(backend, override) {
|
|
20
|
-
return chunk3U5ABFDW_cjs.createSqlSchema({
|
|
21
|
-
...backend.tableNames,
|
|
22
|
-
...definedTableNameOverrides(override)
|
|
23
|
-
}).tables;
|
|
24
|
-
}
|
|
3
|
+
var chunkEKG2UXNX_cjs = require('./chunk-EKG2UXNX.cjs');
|
|
4
|
+
var chunkZGVTNKTX_cjs = require('./chunk-ZGVTNKTX.cjs');
|
|
5
|
+
var chunkNUQ2YFFH_cjs = require('./chunk-NUQ2YFFH.cjs');
|
|
6
|
+
var chunkDWUDZ66O_cjs = require('./chunk-DWUDZ66O.cjs');
|
|
7
|
+
var chunkM5MSP3BI_cjs = require('./chunk-M5MSP3BI.cjs');
|
|
8
|
+
var chunkH2VWDQWC_cjs = require('./chunk-H2VWDQWC.cjs');
|
|
9
|
+
var chunkH5IJSROF_cjs = require('./chunk-H5IJSROF.cjs');
|
|
10
|
+
var chunkX4GDXBOP_cjs = require('./chunk-X4GDXBOP.cjs');
|
|
25
11
|
|
|
26
12
|
// src/backend/migrate-recorded-time.ts
|
|
27
13
|
var LEGACY_RECORDED_MAX = "9999-12-31T23:59:59.999Z";
|
|
@@ -69,20 +55,20 @@ var RECORDED_EDGE_COLUMNS = [
|
|
|
69
55
|
];
|
|
70
56
|
function shortenedIdentifier(value) {
|
|
71
57
|
if (value.length <= 63) return value;
|
|
72
|
-
return `${value.slice(0, 50)}_${
|
|
58
|
+
return `${value.slice(0, 50)}_${chunkH2VWDQWC_cjs.shortHash(value)}`;
|
|
73
59
|
}
|
|
74
60
|
function mappingTableName(tables, override) {
|
|
75
61
|
const candidate = override ?? `${tables.recordedClock}_${MIGRATION_SUFFIX}`;
|
|
76
|
-
return
|
|
62
|
+
return chunkNUQ2YFFH_cjs.createSqlSchema({
|
|
77
63
|
recordedClock: shortenedIdentifier(candidate)
|
|
78
64
|
}).tables.recordedClock;
|
|
79
65
|
}
|
|
80
66
|
function temporaryTableName(tableName, role) {
|
|
81
|
-
return shortenedIdentifier(`__tg_${role}_${
|
|
67
|
+
return shortenedIdentifier(`__tg_${role}_${chunkH2VWDQWC_cjs.shortHash(tableName)}`);
|
|
82
68
|
}
|
|
83
69
|
function requireStatements(target) {
|
|
84
70
|
if (target.executeStatement === void 0) {
|
|
85
|
-
throw new
|
|
71
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
86
72
|
"Recorded-time migration requires executeStatement support.",
|
|
87
73
|
{ dialect: target.dialect },
|
|
88
74
|
{ suggestion: "Use a built-in SQLite or PostgreSQL backend." }
|
|
@@ -91,15 +77,15 @@ function requireStatements(target) {
|
|
|
91
77
|
return target.executeStatement;
|
|
92
78
|
}
|
|
93
79
|
async function executeStatement(target, statement) {
|
|
94
|
-
await requireStatements(target)(
|
|
80
|
+
await requireStatements(target)(chunkH5IJSROF_cjs.asCompiledStatementSql(statement));
|
|
95
81
|
}
|
|
96
82
|
async function executeDdl(target, ddl) {
|
|
97
|
-
await executeStatement(target,
|
|
83
|
+
await executeStatement(target, chunkH5IJSROF_cjs.sql.raw(ddl));
|
|
98
84
|
}
|
|
99
85
|
function canonicalLegacyInstant(value) {
|
|
100
|
-
const canonical =
|
|
86
|
+
const canonical = chunkM5MSP3BI_cjs.canonicalizeDatabaseTimestamp(value);
|
|
101
87
|
if (canonical === void 0) {
|
|
102
|
-
throw new
|
|
88
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
103
89
|
"Legacy recorded-time relation contained an invalid timestamp.",
|
|
104
90
|
{ value }
|
|
105
91
|
);
|
|
@@ -108,8 +94,8 @@ function canonicalLegacyInstant(value) {
|
|
|
108
94
|
}
|
|
109
95
|
function safeRevision(value) {
|
|
110
96
|
const revision = typeof value === "bigint" ? Number(value) : typeof value === "string" && /^\d+$/.test(value) ? Number(value) : value;
|
|
111
|
-
if (typeof revision !== "number" || !Number.isSafeInteger(revision) || revision < 1 || revision >=
|
|
112
|
-
throw new
|
|
97
|
+
if (typeof revision !== "number" || !Number.isSafeInteger(revision) || revision < 1 || revision >= chunkDWUDZ66O_cjs.RECORDED_MAX_REVISION) {
|
|
98
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
113
99
|
"Recorded anchor mapping contained an invalid revision.",
|
|
114
100
|
{ value }
|
|
115
101
|
);
|
|
@@ -118,9 +104,9 @@ function safeRevision(value) {
|
|
|
118
104
|
}
|
|
119
105
|
async function columnNames(target, tableName) {
|
|
120
106
|
const rows = target.dialect === "sqlite" ? await target.execute(
|
|
121
|
-
|
|
107
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`PRAGMA table_info(${chunkH5IJSROF_cjs.sql.identifier(tableName)})`)
|
|
122
108
|
) : await target.execute(
|
|
123
|
-
|
|
109
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
124
110
|
SELECT column_name AS name
|
|
125
111
|
FROM information_schema.columns
|
|
126
112
|
WHERE table_schema = current_schema()
|
|
@@ -133,28 +119,28 @@ async function columnNames(target, tableName) {
|
|
|
133
119
|
}
|
|
134
120
|
async function readLegacyInstants(target, tables) {
|
|
135
121
|
const rows = await target.execute(
|
|
136
|
-
|
|
122
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
137
123
|
SELECT graph_id, recorded_from AS recorded_at
|
|
138
|
-
FROM ${
|
|
124
|
+
FROM ${chunkH5IJSROF_cjs.sql.identifier(tables.recordedNodes)}
|
|
139
125
|
UNION
|
|
140
126
|
SELECT graph_id, recorded_to AS recorded_at
|
|
141
|
-
FROM ${
|
|
127
|
+
FROM ${chunkH5IJSROF_cjs.sql.identifier(tables.recordedNodes)}
|
|
142
128
|
WHERE recorded_to <> ${LEGACY_RECORDED_MAX}
|
|
143
129
|
UNION
|
|
144
130
|
SELECT graph_id, recorded_from AS recorded_at
|
|
145
|
-
FROM ${
|
|
131
|
+
FROM ${chunkH5IJSROF_cjs.sql.identifier(tables.recordedEdges)}
|
|
146
132
|
UNION
|
|
147
133
|
SELECT graph_id, recorded_to AS recorded_at
|
|
148
|
-
FROM ${
|
|
134
|
+
FROM ${chunkH5IJSROF_cjs.sql.identifier(tables.recordedEdges)}
|
|
149
135
|
WHERE recorded_to <> ${LEGACY_RECORDED_MAX}
|
|
150
136
|
UNION
|
|
151
137
|
SELECT graph_id, recorded_at
|
|
152
|
-
FROM ${
|
|
138
|
+
FROM ${chunkH5IJSROF_cjs.sql.identifier(tables.recordedClock)}
|
|
153
139
|
`)
|
|
154
140
|
);
|
|
155
141
|
const instants = rows.map((row) => {
|
|
156
142
|
if (typeof row.graph_id !== "string") {
|
|
157
|
-
throw new
|
|
143
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
158
144
|
"Legacy recorded-time relation contained an invalid graph id.",
|
|
159
145
|
{ graphId: row.graph_id }
|
|
160
146
|
);
|
|
@@ -205,89 +191,91 @@ function migrationMapDdl(dialect, table) {
|
|
|
205
191
|
);`;
|
|
206
192
|
}
|
|
207
193
|
async function writeMappingRows(target, tableName, rows) {
|
|
208
|
-
await executeStatement(target,
|
|
194
|
+
await executeStatement(target, chunkH5IJSROF_cjs.sql`DELETE FROM ${chunkH5IJSROF_cjs.sql.identifier(tableName)}`);
|
|
209
195
|
const rowsPerStatement = Math.max(
|
|
210
196
|
1,
|
|
211
197
|
Math.floor((target.capabilities.maxBindParameters ?? 900) / 4)
|
|
212
198
|
);
|
|
213
199
|
for (let start = 0; start < rows.length; start += rowsPerStatement) {
|
|
214
200
|
const values = rows.slice(start, start + rowsPerStatement).map(
|
|
215
|
-
(row) =>
|
|
201
|
+
(row) => chunkH5IJSROF_cjs.sql`(${row.graphId}, ${row.legacyRecordedAt}, ${row.revision}, ${row.recordedAt})`
|
|
216
202
|
);
|
|
217
203
|
await executeStatement(
|
|
218
204
|
target,
|
|
219
|
-
|
|
220
|
-
INSERT INTO ${
|
|
205
|
+
chunkH5IJSROF_cjs.sql`
|
|
206
|
+
INSERT INTO ${chunkH5IJSROF_cjs.sql.identifier(tableName)}
|
|
221
207
|
(graph_id, legacy_recorded_at, revision, recorded_at)
|
|
222
|
-
VALUES ${
|
|
208
|
+
VALUES ${chunkH5IJSROF_cjs.sql.join(values, chunkH5IJSROF_cjs.sql`, `)}
|
|
223
209
|
`
|
|
224
210
|
);
|
|
225
211
|
}
|
|
226
212
|
}
|
|
227
|
-
function
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
213
|
+
function recordedMigrationDdl(recordedTableDdl, finalNames, temporaryNames) {
|
|
214
|
+
const temporaryDdl = recordedTableDdl(temporaryNames);
|
|
215
|
+
const finalDdl = recordedTableDdl(finalNames);
|
|
216
|
+
function composed(key) {
|
|
217
|
+
return {
|
|
218
|
+
createTable: temporaryDdl[key].createTable,
|
|
219
|
+
indexes: finalDdl[key].indexes
|
|
220
|
+
};
|
|
234
221
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
if (temporaryDdl === void 0 || finalDdl === void 0) {
|
|
251
|
-
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
252
|
-
`Could not generate migration DDL for ${logicalName}.`
|
|
253
|
-
);
|
|
254
|
-
}
|
|
255
|
-
const createTable = temporaryDdl[0];
|
|
256
|
-
if (createTable === void 0) {
|
|
257
|
-
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
258
|
-
`Could not generate migration table DDL for ${logicalName}.`
|
|
222
|
+
function primaryKeyConstraintRename(key) {
|
|
223
|
+
const temporaryConstraintName = temporaryDdl[key].primaryKeyConstraintName;
|
|
224
|
+
const finalConstraintName = finalDdl[key].primaryKeyConstraintName;
|
|
225
|
+
if (temporaryConstraintName === void 0 && finalConstraintName === void 0)
|
|
226
|
+
return { status: "none" };
|
|
227
|
+
if (temporaryConstraintName === void 0 || finalConstraintName === void 0)
|
|
228
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
229
|
+
"Recorded relation DDL must name both primary-key constraints or neither.",
|
|
230
|
+
{
|
|
231
|
+
code: "RECORDED_DDL_CONSTRAINT_NAME_MISMATCH",
|
|
232
|
+
relation: key,
|
|
233
|
+
finalTable: finalNames[key],
|
|
234
|
+
temporaryConstraintName,
|
|
235
|
+
finalConstraintName
|
|
236
|
+
}
|
|
259
237
|
);
|
|
260
|
-
|
|
261
|
-
|
|
238
|
+
return {
|
|
239
|
+
status: "rename",
|
|
240
|
+
from: temporaryConstraintName,
|
|
241
|
+
to: finalConstraintName
|
|
242
|
+
};
|
|
262
243
|
}
|
|
263
244
|
return {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
245
|
+
ddl: {
|
|
246
|
+
recordedClock: composed("recordedClock"),
|
|
247
|
+
recordedEdges: composed("recordedEdges"),
|
|
248
|
+
recordedNodes: composed("recordedNodes")
|
|
249
|
+
},
|
|
250
|
+
primaryKeyConstraintRenames: {
|
|
251
|
+
recordedClock: primaryKeyConstraintRename("recordedClock"),
|
|
252
|
+
recordedEdges: primaryKeyConstraintRename("recordedEdges"),
|
|
253
|
+
recordedNodes: primaryKeyConstraintRename("recordedNodes")
|
|
254
|
+
}
|
|
267
255
|
};
|
|
268
256
|
}
|
|
269
257
|
function migratedColumn(column, legacyAlias) {
|
|
270
|
-
if (column === "recorded_from") return
|
|
258
|
+
if (column === "recorded_from") return chunkH5IJSROF_cjs.sql`from_map.revision`;
|
|
271
259
|
if (column === "recorded_to") {
|
|
272
|
-
return
|
|
260
|
+
return chunkH5IJSROF_cjs.sql`
|
|
273
261
|
CASE
|
|
274
|
-
WHEN ${
|
|
275
|
-
THEN ${
|
|
262
|
+
WHEN ${chunkH5IJSROF_cjs.sql.raw(legacyAlias)}.recorded_to = ${LEGACY_RECORDED_MAX}
|
|
263
|
+
THEN ${chunkDWUDZ66O_cjs.RECORDED_MAX_REVISION}
|
|
276
264
|
ELSE to_map.revision
|
|
277
265
|
END
|
|
278
266
|
`;
|
|
279
267
|
}
|
|
280
|
-
return
|
|
268
|
+
return chunkH5IJSROF_cjs.sql`${chunkH5IJSROF_cjs.sql.raw(legacyAlias)}.${chunkH5IJSROF_cjs.sql.identifier(column)}`;
|
|
281
269
|
}
|
|
282
270
|
function mappingMatch(dialect, mappingAlias, legacyColumn) {
|
|
283
|
-
const mapping =
|
|
284
|
-
const legacy =
|
|
285
|
-
return dialect === "postgres" ?
|
|
271
|
+
const mapping = chunkH5IJSROF_cjs.sql.raw(mappingAlias);
|
|
272
|
+
const legacy = chunkH5IJSROF_cjs.sql.raw(`legacy.${legacyColumn}`);
|
|
273
|
+
return dialect === "postgres" ? chunkH5IJSROF_cjs.sql`${mapping}.recorded_at = ${legacy}` : chunkH5IJSROF_cjs.sql`${mapping}.legacy_recorded_at = ${legacy}`;
|
|
286
274
|
}
|
|
287
275
|
function missingMappingCount(value, legacyTable) {
|
|
288
276
|
const count = Number(value);
|
|
289
277
|
if (!Number.isSafeInteger(count) || count < 0) {
|
|
290
|
-
throw new
|
|
278
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
291
279
|
"Recorded-time migration returned an invalid integrity-check count.",
|
|
292
280
|
{ legacyTable, value }
|
|
293
281
|
);
|
|
@@ -298,12 +286,12 @@ async function assertRecordedRelationMappings(target, options) {
|
|
|
298
286
|
const fromMatch = mappingMatch(target.dialect, "from_map", "recorded_from");
|
|
299
287
|
const toMatch = mappingMatch(target.dialect, "to_map", "recorded_to");
|
|
300
288
|
const rows = await target.execute(
|
|
301
|
-
|
|
289
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
302
290
|
SELECT COUNT(*) AS missing
|
|
303
|
-
FROM ${
|
|
304
|
-
LEFT JOIN ${
|
|
291
|
+
FROM ${chunkH5IJSROF_cjs.sql.identifier(options.legacyTable)} AS legacy
|
|
292
|
+
LEFT JOIN ${chunkH5IJSROF_cjs.sql.identifier(options.mappingTable)} AS from_map
|
|
305
293
|
ON from_map.graph_id = legacy.graph_id AND ${fromMatch}
|
|
306
|
-
LEFT JOIN ${
|
|
294
|
+
LEFT JOIN ${chunkH5IJSROF_cjs.sql.identifier(options.mappingTable)} AS to_map
|
|
307
295
|
ON to_map.graph_id = legacy.graph_id AND ${toMatch}
|
|
308
296
|
WHERE from_map.revision IS NULL
|
|
309
297
|
OR (
|
|
@@ -314,7 +302,7 @@ async function assertRecordedRelationMappings(target, options) {
|
|
|
314
302
|
);
|
|
315
303
|
const missing = missingMappingCount(rows[0]?.missing, options.legacyTable);
|
|
316
304
|
if (missing === 0) return;
|
|
317
|
-
throw new
|
|
305
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
318
306
|
"Legacy recorded-time boundaries could not be mapped exactly.",
|
|
319
307
|
{ legacyTable: options.legacyTable, missingRows: missing },
|
|
320
308
|
{
|
|
@@ -325,17 +313,17 @@ async function assertRecordedRelationMappings(target, options) {
|
|
|
325
313
|
async function assertRecordedClockMappings(target, options) {
|
|
326
314
|
const match = mappingMatch(target.dialect, "anchor_map", "recorded_at");
|
|
327
315
|
const rows = await target.execute(
|
|
328
|
-
|
|
316
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
329
317
|
SELECT COUNT(*) AS missing
|
|
330
|
-
FROM ${
|
|
331
|
-
LEFT JOIN ${
|
|
318
|
+
FROM ${chunkH5IJSROF_cjs.sql.identifier(options.legacyTable)} AS legacy
|
|
319
|
+
LEFT JOIN ${chunkH5IJSROF_cjs.sql.identifier(options.mappingTable)} AS anchor_map
|
|
332
320
|
ON anchor_map.graph_id = legacy.graph_id AND ${match}
|
|
333
321
|
WHERE anchor_map.revision IS NULL
|
|
334
322
|
`)
|
|
335
323
|
);
|
|
336
324
|
const missing = missingMappingCount(rows[0]?.missing, options.legacyTable);
|
|
337
325
|
if (missing === 0) return;
|
|
338
|
-
throw new
|
|
326
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
339
327
|
"Legacy recorded clock values could not be mapped exactly.",
|
|
340
328
|
{ legacyTable: options.legacyTable, missingRows: missing },
|
|
341
329
|
{
|
|
@@ -344,7 +332,7 @@ async function assertRecordedClockMappings(target, options) {
|
|
|
344
332
|
);
|
|
345
333
|
}
|
|
346
334
|
async function copyRecordedRelation(target, options) {
|
|
347
|
-
const columnList = options.columns.map((column) =>
|
|
335
|
+
const columnList = options.columns.map((column) => chunkH5IJSROF_cjs.sql.identifier(column));
|
|
348
336
|
const values = options.columns.map(
|
|
349
337
|
(column) => migratedColumn(column, "legacy")
|
|
350
338
|
);
|
|
@@ -353,16 +341,16 @@ async function copyRecordedRelation(target, options) {
|
|
|
353
341
|
const toMatch = mappingMatch(target.dialect, "to_map", "recorded_to");
|
|
354
342
|
await executeStatement(
|
|
355
343
|
target,
|
|
356
|
-
|
|
357
|
-
INSERT INTO ${
|
|
358
|
-
(${
|
|
359
|
-
SELECT ${
|
|
360
|
-
FROM ${
|
|
344
|
+
chunkH5IJSROF_cjs.sql`
|
|
345
|
+
INSERT INTO ${chunkH5IJSROF_cjs.sql.identifier(options.temporaryTable)}
|
|
346
|
+
(${chunkH5IJSROF_cjs.sql.join(columnList, chunkH5IJSROF_cjs.sql`, `)})
|
|
347
|
+
SELECT ${chunkH5IJSROF_cjs.sql.join(values, chunkH5IJSROF_cjs.sql`, `)}
|
|
348
|
+
FROM ${chunkH5IJSROF_cjs.sql.identifier(options.legacyTable)} AS legacy
|
|
361
349
|
-- LEFT JOIN is deliberate: a missing mapping reaches the NOT NULL
|
|
362
350
|
-- revision columns and fails loud instead of silently dropping history.
|
|
363
|
-
LEFT JOIN ${
|
|
351
|
+
LEFT JOIN ${chunkH5IJSROF_cjs.sql.identifier(options.mappingTable)} AS from_map
|
|
364
352
|
ON from_map.graph_id = legacy.graph_id AND ${fromMatch}
|
|
365
|
-
LEFT JOIN ${
|
|
353
|
+
LEFT JOIN ${chunkH5IJSROF_cjs.sql.identifier(options.mappingTable)} AS to_map
|
|
366
354
|
ON to_map.graph_id = legacy.graph_id AND ${toMatch}
|
|
367
355
|
`
|
|
368
356
|
);
|
|
@@ -372,33 +360,42 @@ async function copyRecordedClock(target, options) {
|
|
|
372
360
|
const match = mappingMatch(target.dialect, "anchor_map", "recorded_at");
|
|
373
361
|
await executeStatement(
|
|
374
362
|
target,
|
|
375
|
-
|
|
376
|
-
INSERT INTO ${
|
|
363
|
+
chunkH5IJSROF_cjs.sql`
|
|
364
|
+
INSERT INTO ${chunkH5IJSROF_cjs.sql.identifier(options.temporaryTable)}
|
|
377
365
|
(graph_id, revision, recorded_at)
|
|
378
366
|
SELECT legacy.graph_id, anchor_map.revision, legacy.recorded_at
|
|
379
|
-
FROM ${
|
|
367
|
+
FROM ${chunkH5IJSROF_cjs.sql.identifier(options.legacyTable)} AS legacy
|
|
380
368
|
-- Preserve fail-loud behavior if the preflight invariant changes later.
|
|
381
|
-
LEFT JOIN ${
|
|
369
|
+
LEFT JOIN ${chunkH5IJSROF_cjs.sql.identifier(options.mappingTable)} AS anchor_map
|
|
382
370
|
ON anchor_map.graph_id = legacy.graph_id AND ${match}
|
|
383
371
|
`
|
|
384
372
|
);
|
|
385
373
|
}
|
|
386
|
-
async function replaceLegacyTables(target, tables, mappingTable) {
|
|
374
|
+
async function replaceLegacyTables(target, tables, mappingTable, recordedTableDdl) {
|
|
387
375
|
const temporary = {
|
|
388
376
|
recordedNodes: temporaryTableName(tables.recordedNodes, "rn"),
|
|
389
377
|
recordedEdges: temporaryTableName(tables.recordedEdges, "re"),
|
|
390
378
|
recordedClock: temporaryTableName(tables.recordedClock, "rc")
|
|
391
379
|
};
|
|
392
|
-
const
|
|
380
|
+
const finalNames = {
|
|
381
|
+
recordedNodes: tables.recordedNodes,
|
|
382
|
+
recordedEdges: tables.recordedEdges,
|
|
383
|
+
recordedClock: tables.recordedClock
|
|
384
|
+
};
|
|
385
|
+
const { ddl, primaryKeyConstraintRenames } = recordedMigrationDdl(
|
|
386
|
+
recordedTableDdl,
|
|
387
|
+
finalNames,
|
|
388
|
+
temporary
|
|
389
|
+
);
|
|
393
390
|
for (const table of Object.values(temporary)) {
|
|
394
391
|
await executeStatement(
|
|
395
392
|
target,
|
|
396
|
-
|
|
393
|
+
chunkH5IJSROF_cjs.sql`DROP TABLE IF EXISTS ${chunkH5IJSROF_cjs.sql.identifier(table)}`
|
|
397
394
|
);
|
|
398
395
|
}
|
|
399
|
-
await executeDdl(target,
|
|
400
|
-
await executeDdl(target,
|
|
401
|
-
await executeDdl(target,
|
|
396
|
+
await executeDdl(target, ddl.recordedNodes.createTable);
|
|
397
|
+
await executeDdl(target, ddl.recordedEdges.createTable);
|
|
398
|
+
await executeDdl(target, ddl.recordedClock.createTable);
|
|
402
399
|
await copyRecordedRelation(target, {
|
|
403
400
|
columns: RECORDED_NODE_COLUMNS,
|
|
404
401
|
legacyTable: tables.recordedNodes,
|
|
@@ -418,68 +415,61 @@ async function replaceLegacyTables(target, tables, mappingTable) {
|
|
|
418
415
|
});
|
|
419
416
|
await executeStatement(
|
|
420
417
|
target,
|
|
421
|
-
|
|
418
|
+
chunkH5IJSROF_cjs.sql`DROP TABLE ${chunkH5IJSROF_cjs.sql.identifier(tables.recordedNodes)}`
|
|
422
419
|
);
|
|
423
420
|
await executeStatement(
|
|
424
421
|
target,
|
|
425
|
-
|
|
422
|
+
chunkH5IJSROF_cjs.sql`DROP TABLE ${chunkH5IJSROF_cjs.sql.identifier(tables.recordedEdges)}`
|
|
426
423
|
);
|
|
427
424
|
await executeStatement(
|
|
428
425
|
target,
|
|
429
|
-
|
|
426
|
+
chunkH5IJSROF_cjs.sql`DROP TABLE ${chunkH5IJSROF_cjs.sql.identifier(tables.recordedClock)}`
|
|
430
427
|
);
|
|
431
428
|
await renameTable(target, temporary.recordedNodes, tables.recordedNodes);
|
|
432
429
|
await renameTable(target, temporary.recordedEdges, tables.recordedEdges);
|
|
433
430
|
await renameTable(target, temporary.recordedClock, tables.recordedClock);
|
|
434
431
|
await renamePrimaryKeyConstraint(
|
|
435
432
|
target,
|
|
436
|
-
|
|
437
|
-
|
|
433
|
+
tables.recordedNodes,
|
|
434
|
+
primaryKeyConstraintRenames.recordedNodes
|
|
438
435
|
);
|
|
439
436
|
await renamePrimaryKeyConstraint(
|
|
440
437
|
target,
|
|
441
|
-
|
|
442
|
-
|
|
438
|
+
tables.recordedEdges,
|
|
439
|
+
primaryKeyConstraintRenames.recordedEdges
|
|
443
440
|
);
|
|
444
441
|
await renamePrimaryKeyConstraint(
|
|
445
442
|
target,
|
|
446
|
-
|
|
447
|
-
|
|
443
|
+
tables.recordedClock,
|
|
444
|
+
primaryKeyConstraintRenames.recordedClock
|
|
448
445
|
);
|
|
449
446
|
for (const statement of [
|
|
450
|
-
...ddl.
|
|
451
|
-
...ddl.
|
|
452
|
-
...ddl.
|
|
447
|
+
...ddl.recordedNodes.indexes,
|
|
448
|
+
...ddl.recordedEdges.indexes,
|
|
449
|
+
...ddl.recordedClock.indexes
|
|
453
450
|
]) {
|
|
454
451
|
await executeDdl(target, statement);
|
|
455
452
|
}
|
|
456
453
|
}
|
|
457
|
-
async function renamePrimaryKeyConstraint(target,
|
|
458
|
-
if (
|
|
454
|
+
async function renamePrimaryKeyConstraint(target, finalTable, rename) {
|
|
455
|
+
if (rename.status === "none") return;
|
|
459
456
|
await executeStatement(
|
|
460
457
|
target,
|
|
461
|
-
|
|
462
|
-
ALTER TABLE ${
|
|
463
|
-
RENAME CONSTRAINT ${
|
|
464
|
-
TO ${
|
|
458
|
+
chunkH5IJSROF_cjs.sql`
|
|
459
|
+
ALTER TABLE ${chunkH5IJSROF_cjs.sql.identifier(finalTable)}
|
|
460
|
+
RENAME CONSTRAINT ${chunkH5IJSROF_cjs.sql.identifier(rename.from)}
|
|
461
|
+
TO ${chunkH5IJSROF_cjs.sql.identifier(shortenedIdentifier(rename.to))}
|
|
465
462
|
`
|
|
466
463
|
);
|
|
467
464
|
}
|
|
468
|
-
function requireCreateTable(statements) {
|
|
469
|
-
const statement = statements[0];
|
|
470
|
-
if (statement === void 0) {
|
|
471
|
-
throw new chunkMRDBBHIZ_cjs.ConfigurationError("Recorded migration table DDL was empty.");
|
|
472
|
-
}
|
|
473
|
-
return statement;
|
|
474
|
-
}
|
|
475
465
|
async function renameTable(target, from, to) {
|
|
476
466
|
try {
|
|
477
467
|
await executeStatement(
|
|
478
468
|
target,
|
|
479
|
-
|
|
469
|
+
chunkH5IJSROF_cjs.sql`ALTER TABLE ${chunkH5IJSROF_cjs.sql.identifier(from)} RENAME TO ${chunkH5IJSROF_cjs.sql.identifier(to)}`
|
|
480
470
|
);
|
|
481
471
|
} catch (error) {
|
|
482
|
-
throw new
|
|
472
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
483
473
|
"Could not rename a migrated recorded-time table.",
|
|
484
474
|
{ from, to },
|
|
485
475
|
{ cause: error }
|
|
@@ -487,8 +477,9 @@ async function renameTable(target, from, to) {
|
|
|
487
477
|
}
|
|
488
478
|
}
|
|
489
479
|
async function migrateLegacyRecordedTime(options) {
|
|
490
|
-
const tables = resolvedTableNames(options.backend, options.tableNames);
|
|
480
|
+
const tables = chunkEKG2UXNX_cjs.resolvedTableNames(options.backend, options.tableNames);
|
|
491
481
|
const mapTable = mappingTableName(tables, options.mappingTableName);
|
|
482
|
+
const recordedTableDdl = options.backend.recordedTableDdl;
|
|
492
483
|
return options.backend.transaction(async (target) => {
|
|
493
484
|
const clockColumns = await columnNames(target, tables.recordedClock);
|
|
494
485
|
if (clockColumns.size === 0) {
|
|
@@ -510,9 +501,9 @@ async function migrateLegacyRecordedTime(options) {
|
|
|
510
501
|
};
|
|
511
502
|
}
|
|
512
503
|
const rows = await target.execute(
|
|
513
|
-
|
|
504
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
514
505
|
SELECT COUNT(*) AS anchors, COUNT(DISTINCT graph_id) AS graphs
|
|
515
|
-
FROM ${
|
|
506
|
+
FROM ${chunkH5IJSROF_cjs.sql.identifier(mapTable)}
|
|
516
507
|
`)
|
|
517
508
|
);
|
|
518
509
|
const anchors = Number(rows[0]?.anchors ?? 0);
|
|
@@ -527,15 +518,23 @@ async function migrateLegacyRecordedTime(options) {
|
|
|
527
518
|
const nodeColumns = await columnNames(target, tables.recordedNodes);
|
|
528
519
|
const edgeColumns = await columnNames(target, tables.recordedEdges);
|
|
529
520
|
if (!nodeColumns.has("recorded_from") || !edgeColumns.has("recorded_from")) {
|
|
530
|
-
throw new
|
|
521
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
531
522
|
"Legacy recorded-time schema is incomplete.",
|
|
532
523
|
{ tables }
|
|
533
524
|
);
|
|
534
525
|
}
|
|
526
|
+
if (recordedTableDdl === void 0) {
|
|
527
|
+
throw new chunkX4GDXBOP_cjs.UnsupportedBackendCapabilityError(
|
|
528
|
+
"migrateLegacyRecordedTime",
|
|
529
|
+
"recordedTableDdl",
|
|
530
|
+
{ dialect: target.dialect, tables },
|
|
531
|
+
"Migrating the timestamp-only preview recorded schema needs the backend to author its own recorded-relation DDL. Only the bundled SQLite and PostgreSQL backends created that schema."
|
|
532
|
+
);
|
|
533
|
+
}
|
|
535
534
|
await executeDdl(target, migrationMapDdl(target.dialect, mapTable));
|
|
536
535
|
const mapping = await readLegacyInstants(target, tables);
|
|
537
536
|
await writeMappingRows(target, mapTable, mapping);
|
|
538
|
-
await replaceLegacyTables(target, tables, mapTable);
|
|
537
|
+
await replaceLegacyTables(target, tables, mapTable, recordedTableDdl);
|
|
539
538
|
return {
|
|
540
539
|
migrated: true,
|
|
541
540
|
graphs: new Set(mapping.map((row) => row.graphId)).size,
|
|
@@ -546,24 +545,24 @@ async function migrateLegacyRecordedTime(options) {
|
|
|
546
545
|
}
|
|
547
546
|
async function migrateRecordedAnchor(options) {
|
|
548
547
|
try {
|
|
549
|
-
return
|
|
548
|
+
return chunkDWUDZ66O_cjs.asRecordedInstant(options.anchor);
|
|
550
549
|
} catch (error) {
|
|
551
|
-
if (!(error instanceof
|
|
550
|
+
if (!(error instanceof chunkX4GDXBOP_cjs.ValidationError)) throw error;
|
|
552
551
|
}
|
|
553
552
|
const legacyRecordedAt = canonicalLegacyInstant(options.anchor);
|
|
554
|
-
const tables = resolvedTableNames(options.backend, options.tableNames);
|
|
553
|
+
const tables = chunkEKG2UXNX_cjs.resolvedTableNames(options.backend, options.tableNames);
|
|
555
554
|
const mapTable = mappingTableName(tables, options.mappingTableName);
|
|
556
555
|
const rows = await options.backend.execute(
|
|
557
|
-
|
|
556
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
558
557
|
SELECT revision, recorded_at
|
|
559
|
-
FROM ${
|
|
558
|
+
FROM ${chunkH5IJSROF_cjs.sql.identifier(mapTable)}
|
|
560
559
|
WHERE graph_id = ${options.graphId}
|
|
561
560
|
AND legacy_recorded_at = ${legacyRecordedAt}
|
|
562
561
|
`)
|
|
563
562
|
);
|
|
564
563
|
const row = rows[0];
|
|
565
564
|
if (row === void 0) {
|
|
566
|
-
throw new
|
|
565
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
567
566
|
"No migrated recorded anchor matches this graph and legacy timestamp.",
|
|
568
567
|
{ anchor: options.anchor, graphId: options.graphId },
|
|
569
568
|
{
|
|
@@ -571,40 +570,35 @@ async function migrateRecordedAnchor(options) {
|
|
|
571
570
|
}
|
|
572
571
|
);
|
|
573
572
|
}
|
|
574
|
-
return
|
|
573
|
+
return chunkDWUDZ66O_cjs.createRecordedInstant(
|
|
575
574
|
safeRevision(row.revision),
|
|
576
575
|
canonicalLegacyInstant(row.recorded_at)
|
|
577
576
|
);
|
|
578
577
|
}
|
|
579
578
|
async function deleteLegacyRecordedAnchorMap(options) {
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
"Deleting a recorded anchor migration map requires executeStatement support.",
|
|
583
|
-
{ dialect: options.backend.dialect }
|
|
584
|
-
);
|
|
585
|
-
}
|
|
586
|
-
const tables = resolvedTableNames(options.backend, options.tableNames);
|
|
579
|
+
requireStatements(options.backend);
|
|
580
|
+
const tables = chunkEKG2UXNX_cjs.resolvedTableNames(options.backend, options.tableNames);
|
|
587
581
|
const mapTable = mappingTableName(tables, options.mappingTableName);
|
|
588
582
|
await options.backend.transaction(async (target) => {
|
|
589
583
|
await executeStatement(
|
|
590
584
|
target,
|
|
591
|
-
|
|
592
|
-
DELETE FROM ${
|
|
585
|
+
chunkH5IJSROF_cjs.sql`
|
|
586
|
+
DELETE FROM ${chunkH5IJSROF_cjs.sql.identifier(mapTable)}
|
|
593
587
|
WHERE graph_id = ${options.graphId}
|
|
594
588
|
`
|
|
595
589
|
);
|
|
596
590
|
if (options.dropWhenEmpty !== true) return;
|
|
597
591
|
const rows = await target.execute(
|
|
598
|
-
|
|
592
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
599
593
|
SELECT COUNT(*) AS anchors, COUNT(DISTINCT graph_id) AS graphs
|
|
600
|
-
FROM ${
|
|
594
|
+
FROM ${chunkH5IJSROF_cjs.sql.identifier(mapTable)}
|
|
601
595
|
`)
|
|
602
596
|
);
|
|
603
597
|
const remaining = missingMappingCount(rows[0]?.anchors, mapTable);
|
|
604
598
|
if (remaining === 0) {
|
|
605
599
|
await executeStatement(
|
|
606
600
|
target,
|
|
607
|
-
|
|
601
|
+
chunkH5IJSROF_cjs.sql`DROP TABLE ${chunkH5IJSROF_cjs.sql.identifier(mapTable)}`
|
|
608
602
|
);
|
|
609
603
|
}
|
|
610
604
|
});
|
|
@@ -640,42 +634,42 @@ function relationTable(tables, relation) {
|
|
|
640
634
|
}
|
|
641
635
|
}
|
|
642
636
|
function graphScopeClauses(graphId) {
|
|
643
|
-
return graphId === void 0 ? [] : [
|
|
637
|
+
return graphId === void 0 ? [] : [chunkH5IJSROF_cjs.sql`graph_id = ${graphId}`];
|
|
644
638
|
}
|
|
645
639
|
function canonicalBoundsClauses(dialect) {
|
|
646
640
|
if (dialect !== "sqlite") return [];
|
|
647
641
|
return [
|
|
648
|
-
|
|
649
|
-
|
|
642
|
+
chunkH5IJSROF_cjs.sql`valid_from GLOB ${CANONICAL_INSTANT_GLOB}`,
|
|
643
|
+
chunkH5IJSROF_cjs.sql`valid_to GLOB ${CANONICAL_INSTANT_GLOB}`
|
|
650
644
|
];
|
|
651
645
|
}
|
|
652
646
|
function invertedValidityWindowPredicate(options) {
|
|
653
|
-
return
|
|
647
|
+
return chunkH5IJSROF_cjs.sql.join(
|
|
654
648
|
[
|
|
655
|
-
|
|
656
|
-
|
|
649
|
+
chunkH5IJSROF_cjs.sql`valid_from IS NOT NULL`,
|
|
650
|
+
chunkH5IJSROF_cjs.sql`valid_to IS NOT NULL`,
|
|
657
651
|
...canonicalBoundsClauses(options.dialect),
|
|
658
|
-
|
|
652
|
+
chunkH5IJSROF_cjs.sql`valid_from > valid_to`,
|
|
659
653
|
...graphScopeClauses(options.graphId)
|
|
660
654
|
],
|
|
661
|
-
|
|
655
|
+
chunkH5IJSROF_cjs.sql` AND `
|
|
662
656
|
);
|
|
663
657
|
}
|
|
664
658
|
function nonCanonicalWindowPredicate(graphId) {
|
|
665
|
-
return
|
|
659
|
+
return chunkH5IJSROF_cjs.sql.join(
|
|
666
660
|
[
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
661
|
+
chunkH5IJSROF_cjs.sql`valid_from IS NOT NULL`,
|
|
662
|
+
chunkH5IJSROF_cjs.sql`valid_to IS NOT NULL`,
|
|
663
|
+
chunkH5IJSROF_cjs.sql`(valid_from NOT GLOB ${CANONICAL_INSTANT_GLOB} OR valid_to NOT GLOB ${CANONICAL_INSTANT_GLOB})`,
|
|
670
664
|
...graphScopeClauses(graphId)
|
|
671
665
|
],
|
|
672
|
-
|
|
666
|
+
chunkH5IJSROF_cjs.sql` AND `
|
|
673
667
|
);
|
|
674
668
|
}
|
|
675
669
|
function safeCount(value, table) {
|
|
676
670
|
const count = Number(value);
|
|
677
671
|
if (!Number.isSafeInteger(count) || count < 0) {
|
|
678
|
-
throw new
|
|
672
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
679
673
|
"Validity-window repair returned an invalid row count.",
|
|
680
674
|
{ table, value }
|
|
681
675
|
);
|
|
@@ -684,31 +678,28 @@ function safeCount(value, table) {
|
|
|
684
678
|
}
|
|
685
679
|
async function countMatching(target, table, predicate) {
|
|
686
680
|
const rows = await target.execute(
|
|
687
|
-
|
|
681
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
688
682
|
SELECT COUNT(*) AS matches
|
|
689
|
-
FROM ${
|
|
683
|
+
FROM ${chunkH5IJSROF_cjs.sql.identifier(table)}
|
|
690
684
|
WHERE ${predicate}
|
|
691
685
|
`)
|
|
692
686
|
);
|
|
693
687
|
return safeCount(rows[0]?.matches, table);
|
|
694
688
|
}
|
|
695
|
-
function
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
);
|
|
704
|
-
}
|
|
705
|
-
return target.executeStatement;
|
|
689
|
+
function statementExecutionRequiredError(dialect) {
|
|
690
|
+
return new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
691
|
+
"Repairing inverted validity windows requires executeStatement support.",
|
|
692
|
+
{ dialect, mode: "apply" },
|
|
693
|
+
{
|
|
694
|
+
suggestion: 'Use a built-in SQLite or PostgreSQL backend to apply the repair. Detection needs no such support: call this with mode: "report" to count the affected rows on any backend.'
|
|
695
|
+
}
|
|
696
|
+
);
|
|
706
697
|
}
|
|
707
698
|
function translatedCaptureRefusal(error) {
|
|
708
|
-
if (!(error instanceof
|
|
699
|
+
if (!(error instanceof chunkX4GDXBOP_cjs.ConfigurationError) || error.details["code"] !== "RECORDED_CAPTURE_RAW_SQL_DISABLED") {
|
|
709
700
|
return error;
|
|
710
701
|
}
|
|
711
|
-
return new
|
|
702
|
+
return new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
712
703
|
"Repairing inverted validity windows cannot run against a history-capturing backend.",
|
|
713
704
|
{ code: "RECORDED_CAPTURE_RAW_SQL_DISABLED", mode: "apply" },
|
|
714
705
|
{
|
|
@@ -717,11 +708,14 @@ function translatedCaptureRefusal(error) {
|
|
|
717
708
|
}
|
|
718
709
|
);
|
|
719
710
|
}
|
|
720
|
-
async function repairRelation(target, table, predicate) {
|
|
711
|
+
async function repairRelation(target, verdict, table, predicate) {
|
|
712
|
+
if (!verdict.supported) {
|
|
713
|
+
throw statementExecutionRequiredError(target.dialect);
|
|
714
|
+
}
|
|
721
715
|
try {
|
|
722
|
-
await
|
|
723
|
-
|
|
724
|
-
UPDATE ${
|
|
716
|
+
await chunkNUQ2YFFH_cjs.statementExecutionMembers(target, verdict).executeStatement(
|
|
717
|
+
chunkH5IJSROF_cjs.asCompiledStatementSql(chunkH5IJSROF_cjs.sql`
|
|
718
|
+
UPDATE ${chunkH5IJSROF_cjs.sql.identifier(table)}
|
|
725
719
|
SET valid_from = NULL
|
|
726
720
|
WHERE ${predicate}
|
|
727
721
|
`)
|
|
@@ -733,7 +727,7 @@ async function repairRelation(target, table, predicate) {
|
|
|
733
727
|
function assertClassifiableBounds(nonCanonical) {
|
|
734
728
|
const unclassified = [...nonCanonical].filter(([, count]) => count > 0);
|
|
735
729
|
if (unclassified.length === 0) return;
|
|
736
|
-
throw new
|
|
730
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
737
731
|
"Refusing to repair validity windows: some scanned rows store non-canonical bounds.",
|
|
738
732
|
{ nonCanonical: Object.fromEntries(unclassified) },
|
|
739
733
|
{
|
|
@@ -753,10 +747,13 @@ function relationRecord(counts) {
|
|
|
753
747
|
};
|
|
754
748
|
}
|
|
755
749
|
async function repairInvertedValidityWindows(options) {
|
|
756
|
-
const tables = resolvedTableNames(options.backend, options.tableNames);
|
|
750
|
+
const tables = chunkEKG2UXNX_cjs.resolvedTableNames(options.backend, options.tableNames);
|
|
757
751
|
const relations = scopedRelations(options.relations);
|
|
758
|
-
|
|
759
|
-
|
|
752
|
+
const verdict = chunkZGVTNKTX_cjs.statementExecutionVerdict(options.backend);
|
|
753
|
+
if (options.mode === "apply" && !verdict.supported) {
|
|
754
|
+
throw statementExecutionRequiredError(options.backend.dialect);
|
|
755
|
+
}
|
|
756
|
+
return chunkNUQ2YFFH_cjs.runOptionallyInTransaction(
|
|
760
757
|
options.backend,
|
|
761
758
|
async (target, execution) => {
|
|
762
759
|
const predicate = invertedValidityWindowPredicate({
|
|
@@ -782,6 +779,7 @@ async function repairInvertedValidityWindows(options) {
|
|
|
782
779
|
for (const relation of relations) {
|
|
783
780
|
await repairRelation(
|
|
784
781
|
target,
|
|
782
|
+
verdict,
|
|
785
783
|
relationTable(tables, relation),
|
|
786
784
|
predicate
|
|
787
785
|
);
|
|
@@ -802,5 +800,5 @@ exports.deleteLegacyRecordedAnchorMap = deleteLegacyRecordedAnchorMap;
|
|
|
802
800
|
exports.migrateLegacyRecordedTime = migrateLegacyRecordedTime;
|
|
803
801
|
exports.migrateRecordedAnchor = migrateRecordedAnchor;
|
|
804
802
|
exports.repairInvertedValidityWindows = repairInvertedValidityWindows;
|
|
805
|
-
//# sourceMappingURL=chunk-
|
|
806
|
-
//# sourceMappingURL=chunk-
|
|
803
|
+
//# sourceMappingURL=chunk-OGL4X4PH.cjs.map
|
|
804
|
+
//# sourceMappingURL=chunk-OGL4X4PH.cjs.map
|