@nicia-ai/typegraph 0.46.2 → 0.48.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 +20 -1
- package/dist/backend/drizzle/indexes.cjs +9 -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 +5 -5
- package/dist/backend/index.cjs +58 -49
- package/dist/backend/index.d.cts +37 -55
- package/dist/backend/index.d.ts +37 -55
- package/dist/backend/index.js +11 -10
- package/dist/backend/postgres/index.cjs +27 -26
- package/dist/backend/postgres/index.d.cts +21 -7
- package/dist/backend/postgres/index.d.ts +21 -7
- package/dist/backend/postgres/index.js +14 -13
- package/dist/backend/postgres/pglite-store.cjs +34 -33
- 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 +30 -29
- package/dist/backend/postgres/pglite-store.js.map +1 -1
- package/dist/backend/postgres/pglite.cjs +16 -15
- package/dist/backend/postgres/pglite.d.cts +3 -3
- package/dist/backend/postgres/pglite.d.ts +3 -3
- package/dist/backend/postgres/pglite.js +15 -14
- package/dist/backend/sqlite/index.cjs +24 -23
- package/dist/backend/sqlite/index.d.cts +20 -7
- package/dist/backend/sqlite/index.d.ts +20 -7
- package/dist/backend/sqlite/index.js +12 -11
- package/dist/backend/sqlite/libsql.cjs +19 -18
- 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 +14 -13
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local-store.cjs +35 -34
- 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 +31 -30
- package/dist/backend/sqlite/local-store.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +17 -16
- package/dist/backend/sqlite/local.d.cts +3 -3
- package/dist/backend/sqlite/local.d.ts +3 -3
- package/dist/backend/sqlite/local.js +15 -14
- package/dist/{chunk-TCT66A7N.cjs → chunk-26YKDNUD.cjs} +10 -10
- package/dist/{chunk-TCT66A7N.cjs.map → chunk-26YKDNUD.cjs.map} +1 -1
- package/dist/{chunk-E4OSGBCM.cjs → chunk-2HIYYMWY.cjs} +139 -136
- package/dist/chunk-2HIYYMWY.cjs.map +1 -0
- package/dist/chunk-2QGYQBS2.cjs +161 -0
- package/dist/chunk-2QGYQBS2.cjs.map +1 -0
- package/dist/{chunk-GWXXHOLU.js → chunk-2SYZXD54.js} +21 -18
- package/dist/chunk-2SYZXD54.js.map +1 -0
- package/dist/{chunk-KA4L2NZ3.js → chunk-2TYSSBU5.js} +14 -14
- package/dist/{chunk-KA4L2NZ3.js.map → chunk-2TYSSBU5.js.map} +1 -1
- package/dist/{chunk-QOJ2L2AD.js → chunk-3DMMGT6S.js} +3 -3
- package/dist/{chunk-QOJ2L2AD.js.map → chunk-3DMMGT6S.js.map} +1 -1
- package/dist/{chunk-F36KZDFX.cjs → chunk-3FPR224C.cjs} +91 -91
- package/dist/{chunk-F36KZDFX.cjs.map → chunk-3FPR224C.cjs.map} +1 -1
- package/dist/{chunk-32UETY6S.cjs → chunk-3KOY4FH3.cjs} +207 -28
- package/dist/chunk-3KOY4FH3.cjs.map +1 -0
- package/dist/{chunk-QU7QLJA4.cjs → chunk-3U5ABFDW.cjs} +26 -26
- package/dist/{chunk-QU7QLJA4.cjs.map → chunk-3U5ABFDW.cjs.map} +1 -1
- package/dist/{chunk-RFDEYLIK.js → chunk-4WMMBDS5.js} +7 -7
- package/dist/chunk-4WMMBDS5.js.map +1 -0
- package/dist/{chunk-R7EWHKID.js → chunk-5K2BKEBD.js} +19 -145
- package/dist/chunk-5K2BKEBD.js.map +1 -0
- package/dist/chunk-5PRKMB24.cjs +124 -0
- package/dist/chunk-5PRKMB24.cjs.map +1 -0
- package/dist/chunk-6LN7FIVU.js +107 -0
- package/dist/chunk-6LN7FIVU.js.map +1 -0
- package/dist/{chunk-D6GCNNMK.cjs → chunk-6NGW27EO.cjs} +10 -10
- package/dist/{chunk-D6GCNNMK.cjs.map → chunk-6NGW27EO.cjs.map} +1 -1
- package/dist/{chunk-WHS2Y43J.js → chunk-6SWPJEYN.js} +5 -5
- package/dist/{chunk-WHS2Y43J.js.map → chunk-6SWPJEYN.js.map} +1 -1
- package/dist/{chunk-7TKNK32B.js → chunk-7SQSZN2J.js} +5 -5
- package/dist/{chunk-7TKNK32B.js.map → chunk-7SQSZN2J.js.map} +1 -1
- package/dist/{chunk-UTVQPZPN.cjs → chunk-7XUYFFR4.cjs} +20 -20
- package/dist/chunk-7XUYFFR4.cjs.map +1 -0
- package/dist/{chunk-KXSMF6PL.js → chunk-ACGSAMD3.js} +39 -34
- package/dist/chunk-ACGSAMD3.js.map +1 -0
- package/dist/{chunk-PYKF7UIL.cjs → chunk-AOSSQDVO.cjs} +13 -13
- package/dist/{chunk-PYKF7UIL.cjs.map → chunk-AOSSQDVO.cjs.map} +1 -1
- package/dist/{chunk-AT3MLMJV.js → chunk-AX6JGVTZ.js} +91 -20
- package/dist/chunk-AX6JGVTZ.js.map +1 -0
- package/dist/{chunk-WA64ZSCA.cjs → chunk-BFUOME67.cjs} +11 -11
- package/dist/{chunk-WA64ZSCA.cjs.map → chunk-BFUOME67.cjs.map} +1 -1
- package/dist/{chunk-YQ4JONWE.js → chunk-BRRP76WO.js} +401 -131
- package/dist/chunk-BRRP76WO.js.map +1 -0
- package/dist/{chunk-FCIZNUW5.js → chunk-CHAOFCHV.js} +3 -3
- package/dist/{chunk-FCIZNUW5.js.map → chunk-CHAOFCHV.js.map} +1 -1
- package/dist/chunk-CICO5GXD.cjs +12 -0
- package/dist/{chunk-73MWKDFK.cjs.map → chunk-CICO5GXD.cjs.map} +1 -1
- package/dist/{chunk-S3G5VLSW.js → chunk-CT3ZKTOF.js} +7 -6
- package/dist/chunk-CT3ZKTOF.js.map +1 -0
- package/dist/{chunk-SXWLLQ3D.js → chunk-D5R42W5D.js} +4 -4
- package/dist/{chunk-SXWLLQ3D.js.map → chunk-D5R42W5D.js.map} +1 -1
- package/dist/{chunk-BZZI7B43.cjs → chunk-DO7SAMEK.cjs} +47 -47
- package/dist/{chunk-BZZI7B43.cjs.map → chunk-DO7SAMEK.cjs.map} +1 -1
- package/dist/chunk-DZAICA5J.js +147 -0
- package/dist/chunk-DZAICA5J.js.map +1 -0
- package/dist/{chunk-2ZWM2RFH.cjs → chunk-EDN4Y4ZG.cjs} +9 -9
- package/dist/{chunk-2ZWM2RFH.cjs.map → chunk-EDN4Y4ZG.cjs.map} +1 -1
- package/dist/{chunk-A4R3H7RU.cjs → chunk-EZEEWCFJ.cjs} +264 -361
- package/dist/chunk-EZEEWCFJ.cjs.map +1 -0
- package/dist/{chunk-BEB4OFZF.cjs → chunk-FA2AFWLP.cjs} +51 -59
- package/dist/chunk-FA2AFWLP.cjs.map +1 -0
- package/dist/{chunk-ZBVZ7HXD.cjs → chunk-FQPEMEWX.cjs} +12 -12
- package/dist/{chunk-ZBVZ7HXD.cjs.map → chunk-FQPEMEWX.cjs.map} +1 -1
- package/dist/{chunk-LNIWCQR4.js → chunk-GLHXM7C4.js} +3 -3
- package/dist/{chunk-LNIWCQR4.js.map → chunk-GLHXM7C4.js.map} +1 -1
- package/dist/{chunk-6BD6ZBKT.cjs → chunk-GYEG3ZLZ.cjs} +10 -10
- package/dist/{chunk-6BD6ZBKT.cjs.map → chunk-GYEG3ZLZ.cjs.map} +1 -1
- package/dist/{chunk-A7NMUYEL.cjs → chunk-HDL2ARHX.cjs} +27 -27
- package/dist/{chunk-A7NMUYEL.cjs.map → chunk-HDL2ARHX.cjs.map} +1 -1
- package/dist/{chunk-5ZJOB5YS.js → chunk-HEV35TGT.js} +4 -4
- package/dist/{chunk-5ZJOB5YS.js.map → chunk-HEV35TGT.js.map} +1 -1
- package/dist/{chunk-LHYSY6SE.js → chunk-I4GAZH5Z.js} +186 -9
- package/dist/chunk-I4GAZH5Z.js.map +1 -0
- package/dist/{chunk-BQM5P2NO.cjs → chunk-JB6T4GLL.cjs} +260 -223
- package/dist/chunk-JB6T4GLL.cjs.map +1 -0
- package/dist/{chunk-QPOQX2DI.cjs → chunk-JFRT7S3B.cjs} +1026 -369
- package/dist/chunk-JFRT7S3B.cjs.map +1 -0
- package/dist/{chunk-JCNTKRAK.js → chunk-JONXFAPO.js} +5 -5
- package/dist/{chunk-JCNTKRAK.js.map → chunk-JONXFAPO.js.map} +1 -1
- package/dist/{chunk-WEJHA7AD.js → chunk-KF6K7TGH.js} +109 -75
- package/dist/chunk-KF6K7TGH.js.map +1 -0
- package/dist/{chunk-EDJDDY6H.js → chunk-KKBDXCLQ.js} +4 -4
- package/dist/{chunk-EDJDDY6H.js.map → chunk-KKBDXCLQ.js.map} +1 -1
- package/dist/{chunk-ZHOAZD7Q.cjs → chunk-L3LQNR34.cjs} +161 -161
- package/dist/{chunk-ZHOAZD7Q.cjs.map → chunk-L3LQNR34.cjs.map} +1 -1
- package/dist/{chunk-AF3TWL5C.cjs → chunk-LRQKXRXO.cjs} +4 -4
- package/dist/{chunk-AF3TWL5C.cjs.map → chunk-LRQKXRXO.cjs.map} +1 -1
- package/dist/chunk-MKJ4KXL5.cjs +12 -0
- package/dist/{chunk-6LAXM4J2.cjs.map → chunk-MKJ4KXL5.cjs.map} +1 -1
- package/dist/{chunk-KCH7WQA5.cjs → chunk-MRDBBHIZ.cjs} +48 -2
- package/dist/chunk-MRDBBHIZ.cjs.map +1 -0
- package/dist/{chunk-FXNHZFZV.js → chunk-MYKHJI2J.js} +3 -3
- package/dist/{chunk-FXNHZFZV.js.map → chunk-MYKHJI2J.js.map} +1 -1
- package/dist/{chunk-Z43KWLZF.js → chunk-NACVVDWB.js} +213 -12
- package/dist/chunk-NACVVDWB.js.map +1 -0
- package/dist/{chunk-72WUT4GG.js → chunk-NVY5CJFP.js} +4 -4
- package/dist/{chunk-72WUT4GG.js.map → chunk-NVY5CJFP.js.map} +1 -1
- package/dist/{chunk-WYFB7BN3.js → chunk-OD4SSY2U.js} +166 -48
- package/dist/chunk-OD4SSY2U.js.map +1 -0
- package/dist/{chunk-ZIH42CRX.cjs → chunk-OI2GQ25X.cjs} +7 -7
- package/dist/{chunk-ZIH42CRX.cjs.map → chunk-OI2GQ25X.cjs.map} +1 -1
- package/dist/{chunk-AU3IJNNP.js → chunk-OMZ37BM2.js} +5 -5
- package/dist/{chunk-AU3IJNNP.js.map → chunk-OMZ37BM2.js.map} +1 -1
- package/dist/{chunk-C4DYN2SD.cjs → chunk-OORXGFL5.cjs} +48 -48
- package/dist/{chunk-C4DYN2SD.cjs.map → chunk-OORXGFL5.cjs.map} +1 -1
- package/dist/{chunk-HNYLMPQQ.cjs → chunk-OTUPEF2W.cjs} +149 -78
- package/dist/chunk-OTUPEF2W.cjs.map +1 -0
- package/dist/{chunk-BRN3RGD2.js → chunk-OVI7IXYX.js} +3 -3
- package/dist/{chunk-BRN3RGD2.js.map → chunk-OVI7IXYX.js.map} +1 -1
- package/dist/{chunk-WMKEGJG4.js → chunk-P6YLZTRE.js} +3 -3
- package/dist/{chunk-WMKEGJG4.js.map → chunk-P6YLZTRE.js.map} +1 -1
- package/dist/{chunk-C2ZP5YS6.cjs → chunk-PFBRJBUL.cjs} +278 -160
- package/dist/chunk-PFBRJBUL.cjs.map +1 -0
- package/dist/{chunk-EJSYWAEV.js → chunk-QTD6HX4O.js} +5 -5
- package/dist/{chunk-EJSYWAEV.js.map → chunk-QTD6HX4O.js.map} +1 -1
- package/dist/{chunk-JL5UEBWT.cjs → chunk-ROR5ZR6A.cjs} +45 -45
- package/dist/{chunk-JL5UEBWT.cjs.map → chunk-ROR5ZR6A.cjs.map} +1 -1
- package/dist/{chunk-EDHV4CBU.js → chunk-S5TERQVW.js} +37 -134
- package/dist/chunk-S5TERQVW.js.map +1 -0
- package/dist/{chunk-FSLTU57P.js → chunk-SDBBMD4N.js} +3 -3
- package/dist/{chunk-FSLTU57P.js.map → chunk-SDBBMD4N.js.map} +1 -1
- package/dist/{chunk-36LIJXWC.js → chunk-SHFBB23Q.js} +4 -4
- package/dist/{chunk-36LIJXWC.js.map → chunk-SHFBB23Q.js.map} +1 -1
- package/dist/chunk-SIT26LAZ.cjs +614 -0
- package/dist/chunk-SIT26LAZ.cjs.map +1 -0
- package/dist/{chunk-C6KE2HSQ.cjs → chunk-SR725PWF.cjs} +1662 -1392
- package/dist/chunk-SR725PWF.cjs.map +1 -0
- package/dist/{chunk-S7WIRFNS.cjs → chunk-TKZXMWQF.cjs} +13 -12
- package/dist/chunk-TKZXMWQF.cjs.map +1 -0
- package/dist/{chunk-5PDSCELM.cjs → chunk-TQHGE7UC.cjs} +29 -164
- package/dist/chunk-TQHGE7UC.cjs.map +1 -0
- package/dist/{chunk-XBHRKLZU.cjs → chunk-TUNPBZY3.cjs} +4 -4
- package/dist/{chunk-XBHRKLZU.cjs.map → chunk-TUNPBZY3.cjs.map} +1 -1
- package/dist/{chunk-KOAI3KIV.cjs → chunk-TZEGUG6D.cjs} +4 -4
- package/dist/{chunk-KOAI3KIV.cjs.map → chunk-TZEGUG6D.cjs.map} +1 -1
- package/dist/chunk-UGHG7PGX.js +592 -0
- package/dist/chunk-UGHG7PGX.js.map +1 -0
- package/dist/{chunk-N3QTGPC7.cjs → chunk-UMGZDVOA.cjs} +303 -101
- package/dist/chunk-UMGZDVOA.cjs.map +1 -0
- package/dist/{chunk-RHDOAQCT.cjs → chunk-WCCATHMB.cjs} +140 -135
- package/dist/chunk-WCCATHMB.cjs.map +1 -0
- package/dist/{chunk-DYPRZ53S.cjs → chunk-WODMN3Q2.cjs} +27 -27
- package/dist/{chunk-DYPRZ53S.cjs.map → chunk-WODMN3Q2.cjs.map} +1 -1
- package/dist/{chunk-OZJCH7ZS.js → chunk-XVWOYKIK.js} +3 -3
- package/dist/{chunk-OZJCH7ZS.js.map → chunk-XVWOYKIK.js.map} +1 -1
- package/dist/{chunk-IHRDX7K6.js → chunk-YIURNGXI.js} +46 -56
- package/dist/chunk-YIURNGXI.js.map +1 -0
- package/dist/{chunk-GWUWRZXW.js → chunk-YVF2EM7B.js} +3 -3
- package/dist/{chunk-GWUWRZXW.js.map → chunk-YVF2EM7B.js.map} +1 -1
- package/dist/{chunk-EAMVXR5B.js → chunk-ZDKTPBGV.js} +4 -4
- package/dist/{chunk-EAMVXR5B.js.map → chunk-ZDKTPBGV.js.map} +1 -1
- package/dist/{chunk-A2LJG5GM.js → chunk-ZFMCDJGB.js} +803 -148
- package/dist/chunk-ZFMCDJGB.js.map +1 -0
- package/dist/{chunk-62ZXBMSD.js → chunk-ZLONH2UD.js} +46 -3
- package/dist/chunk-ZLONH2UD.js.map +1 -0
- package/dist/core/index.cjs +28 -27
- package/dist/core/index.d.cts +4 -4
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +8 -7
- package/dist/ddl-BL1NZLMY.d.cts +78 -0
- package/dist/ddl-D_oW-EVO.d.ts +78 -0
- package/dist/graph-extension/index.cjs +20 -20
- package/dist/graph-extension/index.d.cts +4 -4
- package/dist/graph-extension/index.d.ts +4 -4
- package/dist/graph-extension/index.js +4 -4
- package/dist/graph-merge/index.cjs +3418 -706
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +550 -58
- package/dist/graph-merge/index.d.ts +550 -58
- package/dist/graph-merge/index.js +3191 -497
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-Deyu8IXL.d.ts → index-COs_z6nV.d.cts} +47 -3
- package/dist/{index-DrRS51Ld.d.cts → index-D7d1u2gr.d.ts} +47 -3
- package/dist/index.cjs +233 -216
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.js +35 -34
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +13 -13
- package/dist/indexes/index.d.cts +4 -4
- package/dist/indexes/index.d.ts +4 -4
- package/dist/indexes/index.js +6 -6
- package/dist/interchange/index.cjs +53 -52
- package/dist/interchange/index.cjs.map +1 -1
- package/dist/interchange/index.d.cts +17 -13
- package/dist/interchange/index.d.ts +17 -13
- package/dist/interchange/index.js +17 -16
- package/dist/interchange/index.js.map +1 -1
- package/dist/{manager-ptr3JLRP.d.cts → manager-CYaff3n3.d.cts} +2 -2
- package/dist/{manager-DX983gJ0.d.ts → manager-D9eRT_ns.d.ts} +2 -2
- package/dist/{materialize-indexes-CpXoggWU.d.ts → materialize-indexes-DJ3ykH59.d.ts} +1 -1
- package/dist/{materialize-indexes-BXz77YqO.d.cts → materialize-indexes-DTtAnvfY.d.cts} +1 -1
- package/dist/{postgres-DwgEXSPI.d.cts → postgres-CcL4bAHS.d.ts} +1 -1
- package/dist/{postgres-QdOMHTBz.d.ts → postgres-DMj39MEu.d.cts} +1 -1
- package/dist/profiler/index.d.cts +9 -9
- package/dist/profiler/index.d.ts +9 -9
- package/dist/provenance/index.cjs +46 -46
- 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 +13 -13
- package/dist/provenance/index.js.map +1 -1
- package/dist/repair-validity-windows-BFNZvd_H.d.cts +166 -0
- package/dist/repair-validity-windows-DlUSqwCg.d.ts +166 -0
- package/dist/schema/index.cjs +45 -44
- package/dist/schema/index.d.cts +6 -6
- package/dist/schema/index.d.ts +6 -6
- package/dist/schema/index.js +18 -17
- package/dist/{searchable-BOUuA83f.d.ts → searchable-DHJMh_nj.d.cts} +1 -1
- package/dist/{searchable-BrUh0pdc.d.cts → searchable-bpE1bBfc.d.ts} +1 -1
- package/dist/{sqlite-BfYcV61E.d.cts → sqlite-D7Oz0SQh.d.ts} +1 -1
- package/dist/{sqlite-DK40XVR1.d.ts → sqlite-YppHrNFb.d.cts} +1 -1
- package/dist/{store-FTqBpuJD.d.cts → store-JUVvtmR4.d.cts} +228 -92
- package/dist/{store-Bo1psfVZ.d.ts → store-UzrGvZOo.d.ts} +228 -92
- package/dist/{temporal-DPtn0HOu.d.ts → temporal-5GqpYCk2.d.cts} +1 -1
- package/dist/{temporal-CXewwLTB.d.cts → temporal-CbnLzTmM.d.ts} +1 -1
- package/dist/{types-Du78EvpN.d.ts → types-BqFZTQmV.d.cts} +60 -9
- package/dist/{types-Du78EvpN.d.cts → types-BqFZTQmV.d.ts} +60 -9
- package/dist/{types-CeT7xM4M.d.ts → types-Bx74kaTt.d.ts} +1 -1
- package/dist/{types-XR1nHERK.d.cts → types-CXAhpW-c.d.cts} +1 -1
- package/dist/{where-CJsp-YUf.d.cts → where-DI_Fqz-X.d.cts} +1 -1
- package/dist/{where-CMbFiWwp.d.ts → where-O-k2wgYm.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-32UETY6S.cjs.map +0 -1
- package/dist/chunk-5PDSCELM.cjs.map +0 -1
- package/dist/chunk-62ZXBMSD.js.map +0 -1
- package/dist/chunk-6LAXM4J2.cjs +0 -12
- package/dist/chunk-73MWKDFK.cjs +0 -12
- package/dist/chunk-A2LJG5GM.js.map +0 -1
- package/dist/chunk-A4R3H7RU.cjs.map +0 -1
- package/dist/chunk-ANKOXPCC.cjs +0 -267
- package/dist/chunk-ANKOXPCC.cjs.map +0 -1
- package/dist/chunk-AT3MLMJV.js.map +0 -1
- package/dist/chunk-BEB4OFZF.cjs.map +0 -1
- package/dist/chunk-BQM5P2NO.cjs.map +0 -1
- package/dist/chunk-C2ZP5YS6.cjs.map +0 -1
- package/dist/chunk-C6KE2HSQ.cjs.map +0 -1
- package/dist/chunk-DSAWGCMP.js +0 -254
- package/dist/chunk-DSAWGCMP.js.map +0 -1
- package/dist/chunk-E4OSGBCM.cjs.map +0 -1
- package/dist/chunk-EDHV4CBU.js.map +0 -1
- package/dist/chunk-FA6Z7B5L.js +0 -244
- package/dist/chunk-FA6Z7B5L.js.map +0 -1
- package/dist/chunk-GVAMRRZR.cjs +0 -268
- package/dist/chunk-GVAMRRZR.cjs.map +0 -1
- package/dist/chunk-GWXXHOLU.js.map +0 -1
- package/dist/chunk-HNYLMPQQ.cjs.map +0 -1
- package/dist/chunk-IHRDX7K6.js.map +0 -1
- package/dist/chunk-KCH7WQA5.cjs.map +0 -1
- package/dist/chunk-KXSMF6PL.js.map +0 -1
- package/dist/chunk-LHYSY6SE.js.map +0 -1
- package/dist/chunk-N3QTGPC7.cjs.map +0 -1
- package/dist/chunk-QPOQX2DI.cjs.map +0 -1
- package/dist/chunk-R7EWHKID.js.map +0 -1
- package/dist/chunk-RFDEYLIK.js.map +0 -1
- package/dist/chunk-RHDOAQCT.cjs.map +0 -1
- package/dist/chunk-S3G5VLSW.js.map +0 -1
- package/dist/chunk-S7WIRFNS.cjs.map +0 -1
- package/dist/chunk-UTVQPZPN.cjs.map +0 -1
- package/dist/chunk-WEJHA7AD.js.map +0 -1
- package/dist/chunk-WYFB7BN3.js.map +0 -1
- package/dist/chunk-YQ4JONWE.js.map +0 -1
- package/dist/chunk-Z43KWLZF.js.map +0 -1
- package/dist/ddl-mE07h_EM.d.cts +0 -38
- package/dist/ddl-opIn8DfX.d.ts +0 -38
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
3
|
+
var chunkSIT26LAZ_cjs = require('./chunk-SIT26LAZ.cjs');
|
|
4
|
+
var chunk3U5ABFDW_cjs = require('./chunk-3U5ABFDW.cjs');
|
|
5
|
+
var chunk5PRKMB24_cjs = require('./chunk-5PRKMB24.cjs');
|
|
6
|
+
var chunk2QGYQBS2_cjs = require('./chunk-2QGYQBS2.cjs');
|
|
7
|
+
var chunkTQHGE7UC_cjs = require('./chunk-TQHGE7UC.cjs');
|
|
8
|
+
var chunkEDN4Y4ZG_cjs = require('./chunk-EDN4Y4ZG.cjs');
|
|
8
9
|
var chunkRT5ZY4XA_cjs = require('./chunk-RT5ZY4XA.cjs');
|
|
9
|
-
var
|
|
10
|
+
var chunkMRDBBHIZ_cjs = require('./chunk-MRDBBHIZ.cjs');
|
|
10
11
|
var chunkA7J2YDDI_cjs = require('./chunk-A7J2YDDI.cjs');
|
|
11
12
|
var chunkN66HCGCY_cjs = require('./chunk-N66HCGCY.cjs');
|
|
12
13
|
var nanoid = require('nanoid');
|
|
@@ -15,7 +16,7 @@ var nanoid = require('nanoid');
|
|
|
15
16
|
var pinnedReadInstant;
|
|
16
17
|
function withPinnedReadInstant(emit) {
|
|
17
18
|
if (pinnedReadInstant !== void 0) return emit();
|
|
18
|
-
pinnedReadInstant =
|
|
19
|
+
pinnedReadInstant = chunkTQHGE7UC_cjs.nowIso();
|
|
19
20
|
try {
|
|
20
21
|
return emit();
|
|
21
22
|
} finally {
|
|
@@ -23,27 +24,27 @@ function withPinnedReadInstant(emit) {
|
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
function currentReadInstant() {
|
|
26
|
-
return
|
|
27
|
+
return chunkEDN4Y4ZG_cjs.sql`${pinnedReadInstant ?? chunkTQHGE7UC_cjs.nowIso()}`;
|
|
27
28
|
}
|
|
28
29
|
var CURRENT_READ_INSTANT_PLACEHOLDER = "__typegraph_current_read_instant__";
|
|
29
30
|
function currentReadInstantPlaceholder() {
|
|
30
|
-
return
|
|
31
|
+
return chunkEDN4Y4ZG_cjs.sql`${chunkEDN4Y4ZG_cjs.sql.placeholder(CURRENT_READ_INSTANT_PLACEHOLDER)}`;
|
|
31
32
|
}
|
|
32
33
|
function currentReadInstantFor(mode) {
|
|
33
34
|
return mode === "placeholder" ? currentReadInstantPlaceholder() : currentReadInstant();
|
|
34
35
|
}
|
|
35
36
|
function compileTemporalFilter(options) {
|
|
36
37
|
const { mode, asOf, tableAlias, currentTimestamp, recordedAsOf } = options;
|
|
37
|
-
const recorded =
|
|
38
|
-
const prefix = tableAlias ?
|
|
39
|
-
const deletedAt =
|
|
40
|
-
const validFrom =
|
|
41
|
-
const validTo =
|
|
38
|
+
const recorded = chunk2QGYQBS2_cjs.optionalRecordedInstantParts(recordedAsOf, "recordedAsOf");
|
|
39
|
+
const prefix = tableAlias ? chunkEDN4Y4ZG_cjs.sql.raw(`${tableAlias}.`) : chunkEDN4Y4ZG_cjs.sql.raw("");
|
|
40
|
+
const deletedAt = chunkEDN4Y4ZG_cjs.sql`${prefix}deleted_at`;
|
|
41
|
+
const validFrom = chunkEDN4Y4ZG_cjs.sql`${prefix}valid_from`;
|
|
42
|
+
const validTo = chunkEDN4Y4ZG_cjs.sql`${prefix}valid_to`;
|
|
42
43
|
const validFilter = (() => {
|
|
43
44
|
switch (mode) {
|
|
44
45
|
case "current": {
|
|
45
|
-
const now = recorded === void 0 ? currentTimestamp ?? currentReadInstant() :
|
|
46
|
-
return
|
|
46
|
+
const now = recorded === void 0 ? currentTimestamp ?? currentReadInstant() : chunkEDN4Y4ZG_cjs.sql`${recorded.recordedAt}`;
|
|
47
|
+
return chunkEDN4Y4ZG_cjs.sql`${deletedAt} IS NULL AND (${validFrom} IS NULL OR ${validFrom} <= ${now}) AND (${validTo} IS NULL OR ${validTo} > ${now})`;
|
|
47
48
|
}
|
|
48
49
|
case "asOf": {
|
|
49
50
|
if (asOf === void 0) {
|
|
@@ -52,21 +53,21 @@ function compileTemporalFilter(options) {
|
|
|
52
53
|
);
|
|
53
54
|
}
|
|
54
55
|
const timestamp = asOf;
|
|
55
|
-
return
|
|
56
|
+
return chunkEDN4Y4ZG_cjs.sql`${deletedAt} IS NULL AND (${validFrom} IS NULL OR ${validFrom} <= ${timestamp}) AND (${validTo} IS NULL OR ${validTo} > ${timestamp})`;
|
|
56
57
|
}
|
|
57
58
|
case "includeEnded": {
|
|
58
|
-
return
|
|
59
|
+
return chunkEDN4Y4ZG_cjs.sql`${deletedAt} IS NULL`;
|
|
59
60
|
}
|
|
60
61
|
case "includeTombstones": {
|
|
61
|
-
return
|
|
62
|
+
return chunkEDN4Y4ZG_cjs.sql.raw("1=1");
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
})();
|
|
65
66
|
if (recorded === void 0) return validFilter;
|
|
66
|
-
const recordedFrom =
|
|
67
|
-
const recordedTo =
|
|
67
|
+
const recordedFrom = chunkEDN4Y4ZG_cjs.sql`${prefix}recorded_from`;
|
|
68
|
+
const recordedTo = chunkEDN4Y4ZG_cjs.sql`${prefix}recorded_to`;
|
|
68
69
|
const { revision } = recorded;
|
|
69
|
-
return
|
|
70
|
+
return chunkEDN4Y4ZG_cjs.sql`(${validFilter}) AND ${recordedFrom} <= ${revision} AND ${revision} < ${recordedTo}`;
|
|
70
71
|
}
|
|
71
72
|
function extractTemporalOptions(ast, tableAlias) {
|
|
72
73
|
return {
|
|
@@ -154,7 +155,7 @@ function predicate(expr) {
|
|
|
154
155
|
}
|
|
155
156
|
function param(name) {
|
|
156
157
|
if (name === CURRENT_READ_INSTANT_PLACEHOLDER) {
|
|
157
|
-
throw new
|
|
158
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
158
159
|
`Parameter name "${name}" is reserved for internal use`,
|
|
159
160
|
{ parameterName: name }
|
|
160
161
|
);
|
|
@@ -238,7 +239,7 @@ function inComparison(op, field, values) {
|
|
|
238
239
|
}
|
|
239
240
|
const literals = values.map((value) => {
|
|
240
241
|
if (isParameterRef(value)) {
|
|
241
|
-
throw new
|
|
242
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
242
243
|
`param("${value.name}") is not supported as an element of the ${op}() list`,
|
|
243
244
|
{ parameterName: value.name },
|
|
244
245
|
{
|
|
@@ -320,7 +321,7 @@ function createFulltextAccessor(alias, hasSearchableField) {
|
|
|
320
321
|
return {
|
|
321
322
|
matches: (query, k, options) => {
|
|
322
323
|
if (!hasSearchableField()) {
|
|
323
|
-
throw new
|
|
324
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
324
325
|
`Cannot call .$fulltext.matches() on alias "${alias}" \u2014 its node kind has no fields declared with searchable(). Add at least one: \`title: searchable({ language: "english" })\`.`
|
|
325
326
|
);
|
|
326
327
|
}
|
|
@@ -335,7 +336,7 @@ function createFulltextAccessor(alias, hasSearchableField) {
|
|
|
335
336
|
}
|
|
336
337
|
function fulltextMatch(field, query, limit, options) {
|
|
337
338
|
if (!Number.isFinite(limit) || limit <= 0) {
|
|
338
|
-
throw new
|
|
339
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
339
340
|
`matches() limit must be a positive finite number, got ${String(limit)}`
|
|
340
341
|
);
|
|
341
342
|
}
|
|
@@ -608,7 +609,7 @@ function notInSubquery(field, subquery) {
|
|
|
608
609
|
function assertSingleColumnSubquery(subquery) {
|
|
609
610
|
const columnCount = getSubqueryColumnCount(subquery);
|
|
610
611
|
if (columnCount === 1) return;
|
|
611
|
-
throw new
|
|
612
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
612
613
|
`IN/NOT IN subquery must project exactly 1 column, but got ${columnCount}`,
|
|
613
614
|
{ subqueryColumnCount: columnCount },
|
|
614
615
|
{
|
|
@@ -621,7 +622,7 @@ function assertCompatibleSubqueryValueTypes(field, subquery) {
|
|
|
621
622
|
const subqueryValueType = getSingleSubqueryColumnValueType(subquery);
|
|
622
623
|
const resolvedValueType = fieldValueType ?? subqueryValueType;
|
|
623
624
|
if (isUnsupportedInSubqueryValueType(resolvedValueType)) {
|
|
624
|
-
throw new
|
|
625
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
625
626
|
`IN/NOT IN subquery does not support ${String(resolvedValueType)} values`,
|
|
626
627
|
{ valueType: resolvedValueType },
|
|
627
628
|
{
|
|
@@ -632,7 +633,7 @@ function assertCompatibleSubqueryValueTypes(field, subquery) {
|
|
|
632
633
|
if (isInSubqueryTypeCompatible(fieldValueType, subqueryValueType)) {
|
|
633
634
|
return;
|
|
634
635
|
}
|
|
635
|
-
throw new
|
|
636
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
636
637
|
`IN/NOT IN type mismatch: field type "${String(fieldValueType)}" does not match subquery column type "${String(subqueryValueType)}"`,
|
|
637
638
|
{
|
|
638
639
|
fieldValueType,
|
|
@@ -651,7 +652,7 @@ var RECORDED_ISOLATION_REQUIRES_POSTGRES_CHECK = {
|
|
|
651
652
|
};
|
|
652
653
|
function requireRecordedSchema(target) {
|
|
653
654
|
if (target.tableNames === void 0) {
|
|
654
|
-
throw new
|
|
655
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
655
656
|
"Recorded-time capture requires the backend to expose tableNames.",
|
|
656
657
|
{ dialect: target.dialect },
|
|
657
658
|
{
|
|
@@ -659,11 +660,11 @@ function requireRecordedSchema(target) {
|
|
|
659
660
|
}
|
|
660
661
|
);
|
|
661
662
|
}
|
|
662
|
-
return
|
|
663
|
+
return chunk3U5ABFDW_cjs.createSqlSchema(target.tableNames);
|
|
663
664
|
}
|
|
664
665
|
function requireCaptureStatements(target) {
|
|
665
666
|
if (target.executeStatement === void 0) {
|
|
666
|
-
throw new
|
|
667
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
667
668
|
"Recorded-time capture requires backend.executeStatement support on the transaction backend.",
|
|
668
669
|
{ dialect: target.dialect },
|
|
669
670
|
{
|
|
@@ -674,10 +675,10 @@ function requireCaptureStatements(target) {
|
|
|
674
675
|
}
|
|
675
676
|
async function executeStatement(target, query) {
|
|
676
677
|
requireCaptureStatements(target);
|
|
677
|
-
await target.executeStatement(
|
|
678
|
+
await target.executeStatement(chunkEDN4Y4ZG_cjs.asCompiledStatementSql(query));
|
|
678
679
|
}
|
|
679
680
|
function unsupportedPostgresIsolationError(isolationLevel) {
|
|
680
|
-
return new
|
|
681
|
+
return new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
681
682
|
"Recorded-time capture on PostgreSQL requires read_committed isolation.",
|
|
682
683
|
{ isolationLevel: isolationLevel ?? "unknown" },
|
|
683
684
|
{
|
|
@@ -703,7 +704,7 @@ async function assertRecordedCaptureTransactionIsolation(target, options) {
|
|
|
703
704
|
if (!RECORDED_ISOLATION_REQUIRES_POSTGRES_CHECK[target.dialect]) return;
|
|
704
705
|
if (options?.accessMode === "read_only") return;
|
|
705
706
|
const rows = await target.execute(
|
|
706
|
-
|
|
707
|
+
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
707
708
|
SELECT current_setting('transaction_isolation') AS transaction_isolation
|
|
708
709
|
`)
|
|
709
710
|
);
|
|
@@ -714,7 +715,7 @@ async function assertRecordedCaptureTransactionIsolation(target, options) {
|
|
|
714
715
|
throw unsupportedPostgresIsolationError(isolationLevel);
|
|
715
716
|
}
|
|
716
717
|
function recordedCaptureRequiresCallbackTransactionError(details = {}) {
|
|
717
|
-
return new
|
|
718
|
+
return new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
718
719
|
"withTransaction() has no recorded-time capture flush point when history is enabled.",
|
|
719
720
|
{
|
|
720
721
|
...details,
|
|
@@ -726,7 +727,7 @@ function recordedCaptureRequiresCallbackTransactionError(details = {}) {
|
|
|
726
727
|
);
|
|
727
728
|
}
|
|
728
729
|
function historyUnsafeRawWriteError(surface) {
|
|
729
|
-
return new
|
|
730
|
+
return new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
730
731
|
`${surface} is not available when history capture is enabled because raw SQL writes bypass recorded-time capture.`,
|
|
731
732
|
{
|
|
732
733
|
code: "RECORDED_CAPTURE_RAW_SQL_DISABLED"
|
|
@@ -737,7 +738,7 @@ function historyUnsafeRawWriteError(surface) {
|
|
|
737
738
|
);
|
|
738
739
|
}
|
|
739
740
|
function revisionTrackingUnsafeRawWriteError(surface) {
|
|
740
|
-
return new
|
|
741
|
+
return new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
741
742
|
`${surface} is not available when revision tracking is enabled because raw SQL writes bypass the revision anchor.`,
|
|
742
743
|
{
|
|
743
744
|
code: "REVISION_TRACKING_RAW_SQL_DISABLED"
|
|
@@ -773,7 +774,7 @@ function rawWriteGuards(target, prefix) {
|
|
|
773
774
|
}
|
|
774
775
|
function assertCapturableBackend(backend) {
|
|
775
776
|
if (!backend.capabilities.transactions) {
|
|
776
|
-
throw new
|
|
777
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
777
778
|
"history: true requires a backend with transaction support.",
|
|
778
779
|
{ dialect: backend.dialect },
|
|
779
780
|
{
|
|
@@ -782,7 +783,7 @@ function assertCapturableBackend(backend) {
|
|
|
782
783
|
);
|
|
783
784
|
}
|
|
784
785
|
if (backend.executeStatement === void 0) {
|
|
785
|
-
throw new
|
|
786
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
786
787
|
"history: true requires a backend that supports executeStatement.",
|
|
787
788
|
{ dialect: backend.dialect },
|
|
788
789
|
{
|
|
@@ -791,7 +792,7 @@ function assertCapturableBackend(backend) {
|
|
|
791
792
|
);
|
|
792
793
|
}
|
|
793
794
|
if (backend.capabilities.returning === false) {
|
|
794
|
-
throw new
|
|
795
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
795
796
|
"history: true requires a backend that supports UPDATE \u2026 RETURNING.",
|
|
796
797
|
{ dialect: backend.dialect },
|
|
797
798
|
{
|
|
@@ -800,7 +801,7 @@ function assertCapturableBackend(backend) {
|
|
|
800
801
|
);
|
|
801
802
|
}
|
|
802
803
|
if (backend.tableNames === void 0) {
|
|
803
|
-
throw new
|
|
804
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
804
805
|
"history: true requires a backend that exposes tableNames.",
|
|
805
806
|
{ dialect: backend.dialect },
|
|
806
807
|
{
|
|
@@ -811,7 +812,7 @@ function assertCapturableBackend(backend) {
|
|
|
811
812
|
}
|
|
812
813
|
function assertRevisionTrackableBackend(backend) {
|
|
813
814
|
if (!backend.capabilities.transactions) {
|
|
814
|
-
throw new
|
|
815
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
815
816
|
"revisionTracking: true requires a backend with transaction support.",
|
|
816
817
|
{ dialect: backend.dialect },
|
|
817
818
|
{
|
|
@@ -820,7 +821,7 @@ function assertRevisionTrackableBackend(backend) {
|
|
|
820
821
|
);
|
|
821
822
|
}
|
|
822
823
|
if (backend.executeStatement === void 0) {
|
|
823
|
-
throw new
|
|
824
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
824
825
|
"revisionTracking: true requires a backend that supports executeStatement.",
|
|
825
826
|
{ dialect: backend.dialect },
|
|
826
827
|
{
|
|
@@ -829,7 +830,7 @@ function assertRevisionTrackableBackend(backend) {
|
|
|
829
830
|
);
|
|
830
831
|
}
|
|
831
832
|
if (backend.tableNames === void 0) {
|
|
832
|
-
throw new
|
|
833
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
833
834
|
"revisionTracking: true requires a backend that exposes tableNames.",
|
|
834
835
|
{ dialect: backend.dialect },
|
|
835
836
|
{
|
|
@@ -838,7 +839,7 @@ function assertRevisionTrackableBackend(backend) {
|
|
|
838
839
|
);
|
|
839
840
|
}
|
|
840
841
|
if (backend.ensureRevisionOriginsTable === void 0) {
|
|
841
|
-
throw new
|
|
842
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
842
843
|
"revisionTracking: true requires a backend that can bootstrap revision origins.",
|
|
843
844
|
{ dialect: backend.dialect },
|
|
844
845
|
{
|
|
@@ -858,7 +859,7 @@ var USES_RECORDED_GRAPH_ADVISORY_LOCK = {
|
|
|
858
859
|
sqlite: false
|
|
859
860
|
};
|
|
860
861
|
function graphAdvisoryLockSql(namespace, graphId) {
|
|
861
|
-
return
|
|
862
|
+
return chunkEDN4Y4ZG_cjs.sql`
|
|
862
863
|
SELECT pg_advisory_xact_lock(
|
|
863
864
|
hashtext(${namespace}),
|
|
864
865
|
hashtext(${graphId})
|
|
@@ -890,7 +891,7 @@ function registerRecordedGraphLockMemo(backend, memo) {
|
|
|
890
891
|
}
|
|
891
892
|
async function acquireRecordedGraphWriteLock(target, graphId) {
|
|
892
893
|
await target.execute(
|
|
893
|
-
|
|
894
|
+
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(recordedGraphWriteAdvisoryLockSql(graphId))
|
|
894
895
|
);
|
|
895
896
|
}
|
|
896
897
|
async function lockRecordedGraphWrite(target, graphId, memo) {
|
|
@@ -916,7 +917,7 @@ async function lockRecordedGraphWrite(target, graphId, memo) {
|
|
|
916
917
|
return graphWriteLockEvidence();
|
|
917
918
|
}
|
|
918
919
|
function failInvalidClock(value, cause) {
|
|
919
|
-
throw new
|
|
920
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
920
921
|
"Recorded clock row contained an invalid revision or wall time",
|
|
921
922
|
{ value },
|
|
922
923
|
{
|
|
@@ -927,13 +928,13 @@ function failInvalidClock(value, cause) {
|
|
|
927
928
|
}
|
|
928
929
|
function recordedClockRevision(value) {
|
|
929
930
|
const revision = typeof value === "bigint" ? Number(value) : typeof value === "string" && /^\d+$/.test(value) ? Number(value) : value;
|
|
930
|
-
if (typeof revision !== "number" || !Number.isSafeInteger(revision) || revision < RECORDED_MIN_REVISION || revision >=
|
|
931
|
+
if (typeof revision !== "number" || !Number.isSafeInteger(revision) || revision < RECORDED_MIN_REVISION || revision >= chunk2QGYQBS2_cjs.RECORDED_MAX_REVISION) {
|
|
931
932
|
return failInvalidClock(value);
|
|
932
933
|
}
|
|
933
934
|
return revision;
|
|
934
935
|
}
|
|
935
936
|
function recordedClockWallTime(value) {
|
|
936
|
-
return
|
|
937
|
+
return chunkTQHGE7UC_cjs.canonicalizeDatabaseTimestamp(value) ?? failInvalidClock(value);
|
|
937
938
|
}
|
|
938
939
|
function recordedClockParts(row) {
|
|
939
940
|
const revision = recordedClockRevision(row.revision);
|
|
@@ -941,7 +942,7 @@ function recordedClockParts(row) {
|
|
|
941
942
|
return { revision, recordedAt: recordedClockWallTime(row.recorded_at) };
|
|
942
943
|
}
|
|
943
944
|
function nextRecordedCommitParts(previous) {
|
|
944
|
-
const wallTime =
|
|
945
|
+
const wallTime = chunkTQHGE7UC_cjs.nowIso();
|
|
945
946
|
if (previous === void 0) {
|
|
946
947
|
return { revision: 1, recordedAt: wallTime };
|
|
947
948
|
}
|
|
@@ -959,11 +960,11 @@ function nonDecreasingWallTime(current, previous) {
|
|
|
959
960
|
}
|
|
960
961
|
async function readRecordedClock(target, schema, graphId) {
|
|
961
962
|
const parts = await readRecordedClockParts(target, schema, graphId);
|
|
962
|
-
return parts === void 0 ? void 0 :
|
|
963
|
+
return parts === void 0 ? void 0 : chunk2QGYQBS2_cjs.createRecordedInstant(parts.revision, parts.recordedAt);
|
|
963
964
|
}
|
|
964
965
|
async function readRecordedClockParts(target, schema, graphId) {
|
|
965
966
|
const rows = await target.execute(
|
|
966
|
-
|
|
967
|
+
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
967
968
|
SELECT revision, recorded_at
|
|
968
969
|
FROM ${schema.recordedClockTable}
|
|
969
970
|
WHERE graph_id = ${graphId}
|
|
@@ -974,7 +975,7 @@ async function readRecordedClockParts(target, schema, graphId) {
|
|
|
974
975
|
}
|
|
975
976
|
async function readRevisionOrigin(target, schema, graphId) {
|
|
976
977
|
const rows = await target.execute(
|
|
977
|
-
|
|
978
|
+
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
978
979
|
SELECT origin
|
|
979
980
|
FROM ${schema.revisionOriginsTable}
|
|
980
981
|
WHERE graph_id = ${graphId}
|
|
@@ -983,7 +984,7 @@ async function readRevisionOrigin(target, schema, graphId) {
|
|
|
983
984
|
const first = rows[0];
|
|
984
985
|
if (first === void 0) return void 0;
|
|
985
986
|
if (typeof first.origin !== "string" || first.origin.length === 0) {
|
|
986
|
-
throw new
|
|
987
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
987
988
|
"Revision origin row contained an invalid origin",
|
|
988
989
|
{ graphId, origin: first.origin }
|
|
989
990
|
);
|
|
@@ -993,7 +994,7 @@ async function readRevisionOrigin(target, schema, graphId) {
|
|
|
993
994
|
async function ensureRevisionOrigin(target, schema, graphId) {
|
|
994
995
|
const ensureTable = target.ensureRevisionOriginsTable;
|
|
995
996
|
if (ensureTable === void 0) {
|
|
996
|
-
throw new
|
|
997
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
997
998
|
"Revision tracking requires a backend that can bootstrap revision origins.",
|
|
998
999
|
{ dialect: target.dialect },
|
|
999
1000
|
{
|
|
@@ -1006,7 +1007,7 @@ async function ensureRevisionOrigin(target, schema, graphId) {
|
|
|
1006
1007
|
if (existing !== void 0) return existing;
|
|
1007
1008
|
await executeStatement(
|
|
1008
1009
|
target,
|
|
1009
|
-
|
|
1010
|
+
chunkEDN4Y4ZG_cjs.sql`
|
|
1010
1011
|
INSERT INTO ${schema.revisionOriginsTable} (graph_id, origin)
|
|
1011
1012
|
VALUES (${graphId}, ${generateId()})
|
|
1012
1013
|
ON CONFLICT (graph_id) DO NOTHING
|
|
@@ -1014,7 +1015,7 @@ async function ensureRevisionOrigin(target, schema, graphId) {
|
|
|
1014
1015
|
);
|
|
1015
1016
|
const origin = await readRevisionOrigin(target, schema, graphId);
|
|
1016
1017
|
if (origin !== void 0) return origin;
|
|
1017
|
-
throw new
|
|
1018
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
1018
1019
|
"Revision origin was not persisted after initialization.",
|
|
1019
1020
|
{ graphId, dialect: target.dialect }
|
|
1020
1021
|
);
|
|
@@ -1022,7 +1023,7 @@ async function ensureRevisionOrigin(target, schema, graphId) {
|
|
|
1022
1023
|
async function writeRecordedClock(target, schema, graphId, parts) {
|
|
1023
1024
|
await executeStatement(
|
|
1024
1025
|
target,
|
|
1025
|
-
|
|
1026
|
+
chunkEDN4Y4ZG_cjs.sql`
|
|
1026
1027
|
INSERT INTO ${schema.recordedClockTable} (graph_id, revision, recorded_at)
|
|
1027
1028
|
VALUES (${graphId}, ${parts.revision}, ${parts.recordedAt})
|
|
1028
1029
|
ON CONFLICT (graph_id) DO UPDATE
|
|
@@ -1034,7 +1035,7 @@ async function writeRecordedClock(target, schema, graphId, parts) {
|
|
|
1034
1035
|
async function assertRecordedClockAdvanced(target, schema, graphId, revision) {
|
|
1035
1036
|
const stored = await readRecordedClockParts(target, schema, graphId);
|
|
1036
1037
|
if (stored?.revision === revision) return;
|
|
1037
|
-
throw new
|
|
1038
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
1038
1039
|
"Recorded commit allocation was refused: the supplied previous revision was stale, so the write would have moved the graph's revision clock backward.",
|
|
1039
1040
|
{ graphId, allocatedRevision: revision, storedRevision: stored?.revision },
|
|
1040
1041
|
{
|
|
@@ -1046,7 +1047,7 @@ async function lockRecordedClock(target, schema, graphId, ownsWriteLock) {
|
|
|
1046
1047
|
switch (target.dialect) {
|
|
1047
1048
|
case "postgres": {
|
|
1048
1049
|
await target.execute(
|
|
1049
|
-
|
|
1050
|
+
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(recordedClockAdvisoryLockSql(graphId))
|
|
1050
1051
|
);
|
|
1051
1052
|
return;
|
|
1052
1053
|
}
|
|
@@ -1054,7 +1055,7 @@ async function lockRecordedClock(target, schema, graphId, ownsWriteLock) {
|
|
|
1054
1055
|
if (ownsWriteLock) return;
|
|
1055
1056
|
await executeStatement(
|
|
1056
1057
|
target,
|
|
1057
|
-
|
|
1058
|
+
chunkEDN4Y4ZG_cjs.sql`
|
|
1058
1059
|
INSERT INTO ${schema.recordedClockTable} (graph_id, revision, recorded_at)
|
|
1059
1060
|
VALUES (${graphId}, ${RECORDED_MIN_REVISION}, ${RECORDED_MIN_TIME})
|
|
1060
1061
|
ON CONFLICT (graph_id) DO UPDATE SET revision = revision
|
|
@@ -1069,18 +1070,18 @@ async function lockRecordedClock(target, schema, graphId, ownsWriteLock) {
|
|
|
1069
1070
|
}
|
|
1070
1071
|
async function allocateRecordedCommit(target, schema, graphId, ownsWriteLock, previousRevision) {
|
|
1071
1072
|
await lockRecordedClock(target, schema, graphId, ownsWriteLock);
|
|
1072
|
-
const previous = previousRevision === void 0 ? await readRecordedClockParts(target, schema, graphId) :
|
|
1073
|
+
const previous = previousRevision === void 0 ? await readRecordedClockParts(target, schema, graphId) : chunk2QGYQBS2_cjs.parseRecordedInstant(previousRevision, "previous recorded revision");
|
|
1073
1074
|
const { revision, recordedAt } = nextRecordedCommitParts(previous);
|
|
1074
|
-
if (revision >=
|
|
1075
|
-
throw new
|
|
1076
|
-
`Recorded commit clock reached the open revision sentinel ${
|
|
1075
|
+
if (revision >= chunk2QGYQBS2_cjs.RECORDED_MAX_REVISION) {
|
|
1076
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
1077
|
+
`Recorded commit clock reached the open revision sentinel ${chunk2QGYQBS2_cjs.RECORDED_MAX_REVISION}`,
|
|
1077
1078
|
{ graphId, revision },
|
|
1078
1079
|
{
|
|
1079
1080
|
suggestion: "Start a new graph before exhausting the per-graph recorded revision space."
|
|
1080
1081
|
}
|
|
1081
1082
|
);
|
|
1082
1083
|
}
|
|
1083
|
-
const instant =
|
|
1084
|
+
const instant = chunk2QGYQBS2_cjs.createRecordedInstant(revision, recordedAt);
|
|
1084
1085
|
await writeRecordedClock(target, schema, graphId, { revision, recordedAt });
|
|
1085
1086
|
if (previousRevision !== void 0) {
|
|
1086
1087
|
await assertRecordedClockAdvanced(target, schema, graphId, revision);
|
|
@@ -1098,127 +1099,6 @@ async function advanceRevisionClock(target, schema, graphId, ownsWriteLock, prev
|
|
|
1098
1099
|
return commit.instant;
|
|
1099
1100
|
}
|
|
1100
1101
|
|
|
1101
|
-
// src/backend/graph-backend-projection.ts
|
|
1102
|
-
var GRAPH_BACKEND_PROJECTION_KEYS = [
|
|
1103
|
-
"dialect",
|
|
1104
|
-
"capabilities",
|
|
1105
|
-
"tableNames",
|
|
1106
|
-
"fulltextStrategy",
|
|
1107
|
-
"vectorStrategy",
|
|
1108
|
-
"insertNode",
|
|
1109
|
-
"insertNodeNoReturn",
|
|
1110
|
-
"insertNodesBatch",
|
|
1111
|
-
"insertNodesBatchReturning",
|
|
1112
|
-
"updateNode",
|
|
1113
|
-
"updateNodeSet",
|
|
1114
|
-
"deleteNode",
|
|
1115
|
-
"hardDeleteNode",
|
|
1116
|
-
"getNode",
|
|
1117
|
-
"getNodes",
|
|
1118
|
-
"insertEdge",
|
|
1119
|
-
"insertEdgeNoReturn",
|
|
1120
|
-
"insertEdgesBatch",
|
|
1121
|
-
"insertEdgesBatchReturning",
|
|
1122
|
-
"updateEdge",
|
|
1123
|
-
"deleteEdge",
|
|
1124
|
-
"hardDeleteEdge",
|
|
1125
|
-
"deleteEdgesBatch",
|
|
1126
|
-
"hardDeleteEdgesBatch",
|
|
1127
|
-
"getEdge",
|
|
1128
|
-
"getEdges",
|
|
1129
|
-
"countEdgesFrom",
|
|
1130
|
-
"edgeExistsBetween",
|
|
1131
|
-
"findEdgesConnectedTo",
|
|
1132
|
-
"findNodesByKind",
|
|
1133
|
-
"countNodesByKind",
|
|
1134
|
-
"findEdgesByKind",
|
|
1135
|
-
"findEdgesByEndpointSet",
|
|
1136
|
-
"findEdgesByHeterogeneousEndpointSet",
|
|
1137
|
-
"countEdgesByKind",
|
|
1138
|
-
"insertUnique",
|
|
1139
|
-
"insertUniqueBatch",
|
|
1140
|
-
"deleteUnique",
|
|
1141
|
-
"hardDeleteUniquesByNodeIds",
|
|
1142
|
-
"checkUnique",
|
|
1143
|
-
"checkUniqueBatch",
|
|
1144
|
-
"getActiveSchema",
|
|
1145
|
-
"getSchemaVersion",
|
|
1146
|
-
"commitSchemaVersion",
|
|
1147
|
-
"commitSchemaVersionIfKindsEmpty",
|
|
1148
|
-
"lockSchemaVersionForWrite",
|
|
1149
|
-
"commitSchemaVersionWithPreflight",
|
|
1150
|
-
"setActiveVersion",
|
|
1151
|
-
"schemaWriteTransaction",
|
|
1152
|
-
"upsertEmbedding",
|
|
1153
|
-
"upsertEmbeddingBatch",
|
|
1154
|
-
"deleteEmbedding",
|
|
1155
|
-
"deleteEmbeddingBatch",
|
|
1156
|
-
"vectorSearch",
|
|
1157
|
-
"createVectorIndex",
|
|
1158
|
-
"dropVectorIndex",
|
|
1159
|
-
"hybridSearch",
|
|
1160
|
-
"upsertFulltext",
|
|
1161
|
-
"deleteFulltext",
|
|
1162
|
-
"upsertFulltextBatch",
|
|
1163
|
-
"deleteFulltextBatch",
|
|
1164
|
-
"fulltextSearch",
|
|
1165
|
-
"ensureIndexMaterializationsTable",
|
|
1166
|
-
"ensureRevisionOriginsTable",
|
|
1167
|
-
"getIndexMaterialization",
|
|
1168
|
-
"getIndexMaterializations",
|
|
1169
|
-
"recordIndexMaterialization",
|
|
1170
|
-
"claimIndexMaterialization",
|
|
1171
|
-
"releaseIndexMaterializationClaim",
|
|
1172
|
-
"ensureContributionMaterializationsTable",
|
|
1173
|
-
"getContributionMaterialization",
|
|
1174
|
-
"recordContributionMaterialization",
|
|
1175
|
-
"assertRuntimeContributionsInitialized",
|
|
1176
|
-
"ensureKindRemovalsTable",
|
|
1177
|
-
"getPendingKindRemovals",
|
|
1178
|
-
"getAllKindRemovals",
|
|
1179
|
-
"recordKindRemoval",
|
|
1180
|
-
"ensureReconciliationMarkersTable",
|
|
1181
|
-
"ensureRuntimeContributions",
|
|
1182
|
-
"ensureVectorSlotContribution",
|
|
1183
|
-
"ensureVectorSlotContributions",
|
|
1184
|
-
"assertVectorSlotInitialized",
|
|
1185
|
-
"assertVectorSlotsInitialized",
|
|
1186
|
-
"deleteVectorSlotContribution",
|
|
1187
|
-
"verifyContributions",
|
|
1188
|
-
"repairContributions",
|
|
1189
|
-
"probeContributions",
|
|
1190
|
-
"rebuildContribution",
|
|
1191
|
-
"ensureFulltextTable",
|
|
1192
|
-
"ensureIdentityTables",
|
|
1193
|
-
"identityTableDdl",
|
|
1194
|
-
"getReconciliationMarker",
|
|
1195
|
-
"setReconciliationMarker",
|
|
1196
|
-
"clearGraph",
|
|
1197
|
-
"bootstrapTables",
|
|
1198
|
-
"refreshStatistics",
|
|
1199
|
-
"trustedImport",
|
|
1200
|
-
"execute",
|
|
1201
|
-
"executeStatement",
|
|
1202
|
-
"executeTemporaryStatement",
|
|
1203
|
-
"executeRaw",
|
|
1204
|
-
"compileSql",
|
|
1205
|
-
"executeDdl",
|
|
1206
|
-
"transaction",
|
|
1207
|
-
"close"
|
|
1208
|
-
];
|
|
1209
|
-
function projectBackendMembers(backend, keys) {
|
|
1210
|
-
const entries = keys.flatMap((key) => {
|
|
1211
|
-
if (!Reflect.has(backend, key)) return [];
|
|
1212
|
-
return [[key, Reflect.get(backend, key)]];
|
|
1213
|
-
});
|
|
1214
|
-
const projection = Object.fromEntries(entries);
|
|
1215
|
-
chunkANKOXPCC_cjs.inheritSerializedTransactionResource(projection, backend);
|
|
1216
|
-
return projection;
|
|
1217
|
-
}
|
|
1218
|
-
function createGraphBackendProjection(backend) {
|
|
1219
|
-
return projectBackendMembers(backend, GRAPH_BACKEND_PROJECTION_KEYS);
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
1102
|
// src/store/insert-dispatch.ts
|
|
1223
1103
|
function nodeInsertDispatch(backend) {
|
|
1224
1104
|
return {
|
|
@@ -1266,7 +1146,7 @@ async function runInsertBatchReturning(dispatch, params) {
|
|
|
1266
1146
|
}
|
|
1267
1147
|
|
|
1268
1148
|
// src/identity/historical-sql.ts
|
|
1269
|
-
var IDENTITY_ASSERTION_COLUMNS =
|
|
1149
|
+
var IDENTITY_ASSERTION_COLUMNS = chunkEDN4Y4ZG_cjs.sql.raw(
|
|
1270
1150
|
[
|
|
1271
1151
|
"graph_id",
|
|
1272
1152
|
"id",
|
|
@@ -1288,35 +1168,35 @@ function identitySqlCoordinate(coordinate, currentInstant) {
|
|
|
1288
1168
|
return {
|
|
1289
1169
|
validMode: coordinate?.valid.mode ?? "current",
|
|
1290
1170
|
validAsOf: coordinate?.valid.asOf,
|
|
1291
|
-
recorded:
|
|
1171
|
+
recorded: chunk2QGYQBS2_cjs.optionalRecordedInstantParts(
|
|
1292
1172
|
coordinate?.recorded?.asOf,
|
|
1293
1173
|
"recorded.asOf"
|
|
1294
1174
|
),
|
|
1295
|
-
currentInstant: typeof currentInstant === "string" ?
|
|
1175
|
+
currentInstant: typeof currentInstant === "string" ? chunkEDN4Y4ZG_cjs.sql`${currentInstant}` : currentInstant
|
|
1296
1176
|
};
|
|
1297
1177
|
}
|
|
1298
1178
|
function validityInstant(coordinate) {
|
|
1299
1179
|
if (coordinate.validMode === "asOf" && coordinate.validAsOf !== void 0) {
|
|
1300
|
-
return
|
|
1180
|
+
return chunkEDN4Y4ZG_cjs.sql`${coordinate.validAsOf}`;
|
|
1301
1181
|
}
|
|
1302
1182
|
if (coordinate.recorded !== void 0) {
|
|
1303
|
-
return
|
|
1183
|
+
return chunkEDN4Y4ZG_cjs.sql`${coordinate.recorded.recordedAt}`;
|
|
1304
1184
|
}
|
|
1305
1185
|
return coordinate.currentInstant;
|
|
1306
1186
|
}
|
|
1307
1187
|
function qualifiedColumn(alias, column) {
|
|
1308
|
-
return
|
|
1188
|
+
return chunkEDN4Y4ZG_cjs.sql`${chunkEDN4Y4ZG_cjs.sql.identifier(alias)}.${chunkEDN4Y4ZG_cjs.sql.identifier(column)}`;
|
|
1309
1189
|
}
|
|
1310
1190
|
function identityNodeVisibilitySql(coordinate, alias) {
|
|
1311
1191
|
const deletedAt = qualifiedColumn(alias, "deleted_at");
|
|
1312
|
-
if (coordinate.validMode === "includeTombstones") return
|
|
1192
|
+
if (coordinate.validMode === "includeTombstones") return chunkEDN4Y4ZG_cjs.sql`1 = 1`;
|
|
1313
1193
|
if (coordinate.validMode === "includeEnded") {
|
|
1314
|
-
return
|
|
1194
|
+
return chunkEDN4Y4ZG_cjs.sql`${deletedAt} IS NULL`;
|
|
1315
1195
|
}
|
|
1316
1196
|
const validFrom = qualifiedColumn(alias, "valid_from");
|
|
1317
1197
|
const validTo = qualifiedColumn(alias, "valid_to");
|
|
1318
1198
|
const instant = validityInstant(coordinate);
|
|
1319
|
-
return
|
|
1199
|
+
return chunkEDN4Y4ZG_cjs.sql`
|
|
1320
1200
|
${deletedAt} IS NULL
|
|
1321
1201
|
AND (${validFrom} IS NULL OR ${validFrom} <= ${instant})
|
|
1322
1202
|
AND (${validTo} IS NULL OR ${validTo} > ${instant})
|
|
@@ -1324,19 +1204,19 @@ function identityNodeVisibilitySql(coordinate, alias) {
|
|
|
1324
1204
|
}
|
|
1325
1205
|
function structuralFoldVisibilitySql(coordinate, alias) {
|
|
1326
1206
|
const deletedAt = qualifiedColumn(alias, "deleted_at");
|
|
1327
|
-
if (coordinate.recorded !== void 0) return
|
|
1328
|
-
if (coordinate.validMode !== "asOf") return
|
|
1207
|
+
if (coordinate.recorded !== void 0) return chunkEDN4Y4ZG_cjs.sql`${deletedAt} IS NULL`;
|
|
1208
|
+
if (coordinate.validMode !== "asOf") return chunkEDN4Y4ZG_cjs.sql`${deletedAt} IS NULL`;
|
|
1329
1209
|
const createdAt = qualifiedColumn(alias, "created_at");
|
|
1330
1210
|
const instant = validityInstant(coordinate);
|
|
1331
|
-
return
|
|
1211
|
+
return chunkEDN4Y4ZG_cjs.sql`${createdAt} <= ${instant} AND (${deletedAt} IS NULL OR ${deletedAt} > ${instant})`;
|
|
1332
1212
|
}
|
|
1333
1213
|
function identityNodeSnapshotSource(schema, graphId, coordinate) {
|
|
1334
1214
|
const table = coordinate.recorded === void 0 ? schema.nodesTable : schema.recordedNodesTable;
|
|
1335
|
-
const recordedFilter = coordinate.recorded === void 0 ?
|
|
1215
|
+
const recordedFilter = coordinate.recorded === void 0 ? chunkEDN4Y4ZG_cjs.sql`` : chunkEDN4Y4ZG_cjs.sql`
|
|
1336
1216
|
AND recorded_from <= ${coordinate.recorded.revision}
|
|
1337
1217
|
AND recorded_to > ${coordinate.recorded.revision}
|
|
1338
1218
|
`;
|
|
1339
|
-
return
|
|
1219
|
+
return chunkEDN4Y4ZG_cjs.sql`
|
|
1340
1220
|
SELECT kind, id, valid_from, valid_to, created_at, deleted_at
|
|
1341
1221
|
FROM ${table}
|
|
1342
1222
|
WHERE graph_id = ${graphId}
|
|
@@ -1345,13 +1225,13 @@ function identityNodeSnapshotSource(schema, graphId, coordinate) {
|
|
|
1345
1225
|
}
|
|
1346
1226
|
function identityAssertionSnapshotSource(schema, graphId, coordinate, relation) {
|
|
1347
1227
|
const table = coordinate.recorded === void 0 ? schema.identityAssertionsTable : schema.recordedIdentityAssertionsTable;
|
|
1348
|
-
const recordedFilter = coordinate.recorded === void 0 ?
|
|
1228
|
+
const recordedFilter = coordinate.recorded === void 0 ? chunkEDN4Y4ZG_cjs.sql`` : chunkEDN4Y4ZG_cjs.sql`
|
|
1349
1229
|
AND recorded_from <= ${coordinate.recorded.revision}
|
|
1350
1230
|
AND recorded_to > ${coordinate.recorded.revision}
|
|
1351
1231
|
`;
|
|
1352
|
-
const relationFilter = relation === void 0 ?
|
|
1232
|
+
const relationFilter = relation === void 0 ? chunkEDN4Y4ZG_cjs.sql`` : chunkEDN4Y4ZG_cjs.sql`AND rel = ${relation}`;
|
|
1353
1233
|
const instant = validityInstant(coordinate);
|
|
1354
|
-
return
|
|
1234
|
+
return chunkEDN4Y4ZG_cjs.sql`
|
|
1355
1235
|
SELECT ${IDENTITY_ASSERTION_COLUMNS}
|
|
1356
1236
|
FROM ${table}
|
|
1357
1237
|
WHERE graph_id = ${graphId}
|
|
@@ -1374,7 +1254,7 @@ function historicalIdentityReconstructionCtes(input) {
|
|
|
1374
1254
|
input.coordinate,
|
|
1375
1255
|
"same"
|
|
1376
1256
|
);
|
|
1377
|
-
const sameIdEdges = input.sameIdAcrossKinds === "fold" ?
|
|
1257
|
+
const sameIdEdges = input.sameIdAcrossKinds === "fold" ? chunkEDN4Y4ZG_cjs.sql`
|
|
1378
1258
|
UNION ALL
|
|
1379
1259
|
SELECT left_node.kind, left_node.id, right_node.kind, right_node.id
|
|
1380
1260
|
FROM node_snapshot left_node
|
|
@@ -1383,8 +1263,8 @@ function historicalIdentityReconstructionCtes(input) {
|
|
|
1383
1263
|
AND right_node.kind <> left_node.kind
|
|
1384
1264
|
WHERE ${structuralFoldVisibilitySql(input.coordinate, "left_node")}
|
|
1385
1265
|
AND ${structuralFoldVisibilitySql(input.coordinate, "right_node")}
|
|
1386
|
-
` :
|
|
1387
|
-
return
|
|
1266
|
+
` : chunkEDN4Y4ZG_cjs.sql``;
|
|
1267
|
+
return chunkEDN4Y4ZG_cjs.sql`
|
|
1388
1268
|
node_snapshot(kind, id, valid_from, valid_to, created_at, deleted_at) AS (
|
|
1389
1269
|
${nodes}
|
|
1390
1270
|
),
|
|
@@ -1415,15 +1295,15 @@ function historicalIdentityReconstructionCtes(input) {
|
|
|
1415
1295
|
)
|
|
1416
1296
|
`;
|
|
1417
1297
|
}
|
|
1418
|
-
var IDENTITY_PEER_CLASS_COLUMNS =
|
|
1298
|
+
var IDENTITY_PEER_CLASS_COLUMNS = chunkEDN4Y4ZG_cjs.sql.raw(
|
|
1419
1299
|
["seed_kind", "seed_id", "kind", "id"].join(", ")
|
|
1420
1300
|
);
|
|
1421
1301
|
function historicalIdentityPeerClassQuery(input) {
|
|
1422
1302
|
const reconstruction = historicalIdentityReconstructionCtes({
|
|
1423
1303
|
...input,
|
|
1424
|
-
seedSource:
|
|
1304
|
+
seedSource: chunkEDN4Y4ZG_cjs.sql`SELECT DISTINCT a_kind, a_id FROM identity_edges`
|
|
1425
1305
|
});
|
|
1426
|
-
return
|
|
1306
|
+
return chunkEDN4Y4ZG_cjs.sql`
|
|
1427
1307
|
WITH RECURSIVE
|
|
1428
1308
|
${reconstruction}
|
|
1429
1309
|
SELECT member.seed_kind, member.seed_id, member.kind, member.id
|
|
@@ -1446,28 +1326,28 @@ function compileFieldColumn(field, cteAlias, cteColumnPrefix) {
|
|
|
1446
1326
|
if (cteColumnPrefix !== void 0) {
|
|
1447
1327
|
const qualifier2 = cteColumnPrefix === "" ? "" : `${cteColumnPrefix}.`;
|
|
1448
1328
|
if (field.path.length === 1 && field.path[0] === "id") {
|
|
1449
|
-
return
|
|
1329
|
+
return chunkEDN4Y4ZG_cjs.sql.raw(`${qualifier2}id`);
|
|
1450
1330
|
}
|
|
1451
1331
|
if (field.path.length === 1 && field.path[0] === "kind") {
|
|
1452
|
-
return
|
|
1332
|
+
return chunkEDN4Y4ZG_cjs.sql.raw(`${qualifier2}kind`);
|
|
1453
1333
|
}
|
|
1454
1334
|
if (field.path.length > 0 && field.path[0] === "props") {
|
|
1455
|
-
return
|
|
1335
|
+
return chunkEDN4Y4ZG_cjs.sql.raw(`${qualifier2}props`);
|
|
1456
1336
|
}
|
|
1457
|
-
return
|
|
1337
|
+
return chunkEDN4Y4ZG_cjs.sql.raw(`${qualifier2}${field.path.join("_")}`);
|
|
1458
1338
|
}
|
|
1459
1339
|
const prefix = field.alias;
|
|
1460
1340
|
const qualifier = cteAlias ? `${cteAlias}.` : "";
|
|
1461
1341
|
if (field.path.length === 1 && field.path[0] === "id") {
|
|
1462
|
-
return
|
|
1342
|
+
return chunkEDN4Y4ZG_cjs.sql.raw(`${qualifier}${prefix}_id`);
|
|
1463
1343
|
}
|
|
1464
1344
|
if (field.path.length === 1 && field.path[0] === "kind") {
|
|
1465
|
-
return
|
|
1345
|
+
return chunkEDN4Y4ZG_cjs.sql.raw(`${qualifier}${prefix}_kind`);
|
|
1466
1346
|
}
|
|
1467
1347
|
if (field.path.length > 0 && field.path[0] === "props") {
|
|
1468
|
-
return
|
|
1348
|
+
return chunkEDN4Y4ZG_cjs.sql.raw(`${qualifier}${prefix}_props`);
|
|
1469
1349
|
}
|
|
1470
|
-
return
|
|
1350
|
+
return chunkEDN4Y4ZG_cjs.sql.raw(`${qualifier}${prefix}_${field.path.join("_")}`);
|
|
1471
1351
|
}
|
|
1472
1352
|
function getFieldPointer(field) {
|
|
1473
1353
|
if (field.jsonPointer !== void 0) {
|
|
@@ -1553,7 +1433,7 @@ function resolveLiteralValueTypes(literals) {
|
|
|
1553
1433
|
}
|
|
1554
1434
|
}
|
|
1555
1435
|
if (resolved.size > 1) {
|
|
1556
|
-
throw new
|
|
1436
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1557
1437
|
"Mixed literal value types are not supported in predicates",
|
|
1558
1438
|
{ valueTypes: [...resolved] }
|
|
1559
1439
|
);
|
|
@@ -1587,9 +1467,9 @@ function convertValueForSql(value, dialect) {
|
|
|
1587
1467
|
}
|
|
1588
1468
|
function compileStringPattern(op, pattern) {
|
|
1589
1469
|
const escaped = pattern.replaceAll(
|
|
1590
|
-
|
|
1591
|
-
`${
|
|
1592
|
-
).replaceAll("%", `${
|
|
1470
|
+
chunkEDN4Y4ZG_cjs.LIKE_ESCAPE_CHARACTER,
|
|
1471
|
+
`${chunkEDN4Y4ZG_cjs.LIKE_ESCAPE_CHARACTER}${chunkEDN4Y4ZG_cjs.LIKE_ESCAPE_CHARACTER}`
|
|
1472
|
+
).replaceAll("%", `${chunkEDN4Y4ZG_cjs.LIKE_ESCAPE_CHARACTER}%`).replaceAll("_", `${chunkEDN4Y4ZG_cjs.LIKE_ESCAPE_CHARACTER}_`);
|
|
1593
1473
|
switch (op) {
|
|
1594
1474
|
case "contains": {
|
|
1595
1475
|
return `%${escaped}%`;
|
|
@@ -1610,22 +1490,22 @@ function compileStringPattern(op, pattern) {
|
|
|
1610
1490
|
}
|
|
1611
1491
|
}
|
|
1612
1492
|
function escapeLikePatternParameter(parameter) {
|
|
1613
|
-
const doubledEscape = `${
|
|
1614
|
-
return
|
|
1493
|
+
const doubledEscape = `${chunkEDN4Y4ZG_cjs.LIKE_ESCAPE_CHARACTER}${chunkEDN4Y4ZG_cjs.LIKE_ESCAPE_CHARACTER}`;
|
|
1494
|
+
return chunkEDN4Y4ZG_cjs.sql`REPLACE(REPLACE(REPLACE(${parameter}, ${chunkEDN4Y4ZG_cjs.LIKE_ESCAPE_CHARACTER}, ${doubledEscape}), '%', ${`${chunkEDN4Y4ZG_cjs.LIKE_ESCAPE_CHARACTER}%`}), '_', ${`${chunkEDN4Y4ZG_cjs.LIKE_ESCAPE_CHARACTER}_`})`;
|
|
1615
1495
|
}
|
|
1616
1496
|
function compileParameterizedStringPattern(op, parameter) {
|
|
1617
1497
|
switch (op) {
|
|
1618
1498
|
case "contains": {
|
|
1619
1499
|
const escaped = escapeLikePatternParameter(parameter);
|
|
1620
|
-
return
|
|
1500
|
+
return chunkEDN4Y4ZG_cjs.sql`'%' || ${escaped} || '%'`;
|
|
1621
1501
|
}
|
|
1622
1502
|
case "startsWith": {
|
|
1623
1503
|
const escaped = escapeLikePatternParameter(parameter);
|
|
1624
|
-
return
|
|
1504
|
+
return chunkEDN4Y4ZG_cjs.sql`${escaped} || '%'`;
|
|
1625
1505
|
}
|
|
1626
1506
|
case "endsWith": {
|
|
1627
1507
|
const escaped = escapeLikePatternParameter(parameter);
|
|
1628
|
-
return
|
|
1508
|
+
return chunkEDN4Y4ZG_cjs.sql`'%' || ${escaped}`;
|
|
1629
1509
|
}
|
|
1630
1510
|
case "like":
|
|
1631
1511
|
case "ilike": {
|
|
@@ -1652,18 +1532,18 @@ function compilePredicateExpression(expr, ctx) {
|
|
|
1652
1532
|
cteColumnPrefix
|
|
1653
1533
|
);
|
|
1654
1534
|
if (isParameterRef(expr.pattern)) {
|
|
1655
|
-
const placeholder =
|
|
1535
|
+
const placeholder = chunkEDN4Y4ZG_cjs.sql`${chunkEDN4Y4ZG_cjs.sql.placeholder(expr.pattern.name)}`;
|
|
1656
1536
|
const pattern2 = compileParameterizedStringPattern(expr.op, placeholder);
|
|
1657
1537
|
if (expr.op === "ilike" || expr.op === "contains" || expr.op === "startsWith" || expr.op === "endsWith") {
|
|
1658
1538
|
return dialect.ilike(field, pattern2);
|
|
1659
1539
|
}
|
|
1660
|
-
return
|
|
1540
|
+
return chunkEDN4Y4ZG_cjs.sql`${field} LIKE ${pattern2} ${chunkEDN4Y4ZG_cjs.likeEscapeClause}`;
|
|
1661
1541
|
}
|
|
1662
1542
|
const pattern = compileStringPattern(expr.op, expr.pattern);
|
|
1663
1543
|
if (expr.op === "ilike" || expr.op === "contains" || expr.op === "startsWith" || expr.op === "endsWith") {
|
|
1664
1544
|
return dialect.ilike(field, pattern);
|
|
1665
1545
|
}
|
|
1666
|
-
return
|
|
1546
|
+
return chunkEDN4Y4ZG_cjs.sql`${field} LIKE ${pattern} ${chunkEDN4Y4ZG_cjs.likeEscapeClause}`;
|
|
1667
1547
|
}
|
|
1668
1548
|
case "null_check": {
|
|
1669
1549
|
const field = compileFieldTextValue(
|
|
@@ -1673,7 +1553,7 @@ function compilePredicateExpression(expr, ctx) {
|
|
|
1673
1553
|
void 0,
|
|
1674
1554
|
cteColumnPrefix
|
|
1675
1555
|
);
|
|
1676
|
-
return expr.op === "isNull" ?
|
|
1556
|
+
return expr.op === "isNull" ? chunkEDN4Y4ZG_cjs.sql`${field} IS NULL` : chunkEDN4Y4ZG_cjs.sql`${field} IS NOT NULL`;
|
|
1677
1557
|
}
|
|
1678
1558
|
case "between": {
|
|
1679
1559
|
const lowerIsParam = isParameterRef(expr.lower);
|
|
@@ -1683,7 +1563,7 @@ function compilePredicateExpression(expr, ctx) {
|
|
|
1683
1563
|
if (!upperIsParam) boundsForType.push(expr.upper);
|
|
1684
1564
|
const valueType = boundsForType.length > 0 ? resolveComparisonValueType(expr.field, boundsForType) : normalizeValueType2(expr.field.valueType);
|
|
1685
1565
|
if (valueType === "array" || valueType === "object") {
|
|
1686
|
-
throw new
|
|
1566
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1687
1567
|
"Between comparisons are not supported for JSON arrays or objects"
|
|
1688
1568
|
);
|
|
1689
1569
|
}
|
|
@@ -1695,25 +1575,25 @@ function compilePredicateExpression(expr, ctx) {
|
|
|
1695
1575
|
void 0,
|
|
1696
1576
|
cteColumnPrefix
|
|
1697
1577
|
);
|
|
1698
|
-
const lower = lowerIsParam ?
|
|
1699
|
-
const upper = upperIsParam ?
|
|
1700
|
-
return
|
|
1578
|
+
const lower = lowerIsParam ? chunkEDN4Y4ZG_cjs.sql.placeholder(expr.lower.name) : convertValueForSql(expr.lower.value, dialect);
|
|
1579
|
+
const upper = upperIsParam ? chunkEDN4Y4ZG_cjs.sql.placeholder(expr.upper.name) : convertValueForSql(expr.upper.value, dialect);
|
|
1580
|
+
return chunkEDN4Y4ZG_cjs.sql`${field} BETWEEN ${lower} AND ${upper}`;
|
|
1701
1581
|
}
|
|
1702
1582
|
case "and": {
|
|
1703
1583
|
const parts = expr.predicates.map(
|
|
1704
1584
|
(p) => compilePredicateExpression(p, ctx)
|
|
1705
1585
|
);
|
|
1706
|
-
return
|
|
1586
|
+
return chunkEDN4Y4ZG_cjs.sql`(${chunkEDN4Y4ZG_cjs.sql.join(parts, chunkEDN4Y4ZG_cjs.sql` AND `)})`;
|
|
1707
1587
|
}
|
|
1708
1588
|
case "or": {
|
|
1709
1589
|
const parts = expr.predicates.map(
|
|
1710
1590
|
(p) => compilePredicateExpression(p, ctx)
|
|
1711
1591
|
);
|
|
1712
|
-
return
|
|
1592
|
+
return chunkEDN4Y4ZG_cjs.sql`(${chunkEDN4Y4ZG_cjs.sql.join(parts, chunkEDN4Y4ZG_cjs.sql` OR `)})`;
|
|
1713
1593
|
}
|
|
1714
1594
|
case "not": {
|
|
1715
1595
|
const inner = compilePredicateExpression(expr.predicate, ctx);
|
|
1716
|
-
return
|
|
1596
|
+
return chunkEDN4Y4ZG_cjs.sql`NOT (${inner})`;
|
|
1717
1597
|
}
|
|
1718
1598
|
case "array_op": {
|
|
1719
1599
|
return compileArrayPredicate(expr, dialect, cteColumnPrefix);
|
|
@@ -1736,7 +1616,7 @@ function compilePredicateExpression(expr, ctx) {
|
|
|
1736
1616
|
}
|
|
1737
1617
|
}
|
|
1738
1618
|
}
|
|
1739
|
-
var STRUCTURAL_PREDICATE_NOOP =
|
|
1619
|
+
var STRUCTURAL_PREDICATE_NOOP = chunkEDN4Y4ZG_cjs.sql.raw("1=1");
|
|
1740
1620
|
function compileComparisonPredicate(expr, dialect, cteColumnPrefix) {
|
|
1741
1621
|
if (isParameterRef(expr.right)) {
|
|
1742
1622
|
const parameterValueType = resolveParameterValueType(expr.left, expr.right);
|
|
@@ -1759,15 +1639,15 @@ function compileComparisonPredicate(expr, dialect, cteColumnPrefix) {
|
|
|
1759
1639
|
}
|
|
1760
1640
|
const opSql2 = COMPARISON_OP_SQL[expr.op];
|
|
1761
1641
|
if (!opSql2) {
|
|
1762
|
-
throw new
|
|
1642
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1763
1643
|
`Comparison operation "${expr.op}" is not supported for parameterized predicates`
|
|
1764
1644
|
);
|
|
1765
1645
|
}
|
|
1766
|
-
return
|
|
1646
|
+
return chunkEDN4Y4ZG_cjs.sql`${left2} ${chunkEDN4Y4ZG_cjs.sql.raw(opSql2)} ${chunkEDN4Y4ZG_cjs.sql.placeholder(expr.right.name)}`;
|
|
1767
1647
|
}
|
|
1768
1648
|
const valueType = resolveComparisonValueType(expr.left, expr.right);
|
|
1769
1649
|
if (valueType === "array" || valueType === "object") {
|
|
1770
|
-
throw new
|
|
1650
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1771
1651
|
`Comparison operation "${expr.op}" is not supported for ${valueType} values`
|
|
1772
1652
|
);
|
|
1773
1653
|
}
|
|
@@ -1782,7 +1662,7 @@ function compileComparisonPredicate(expr, dialect, cteColumnPrefix) {
|
|
|
1782
1662
|
if (expr.op === "in" || expr.op === "notIn") {
|
|
1783
1663
|
const values = Array.isArray(expr.right) ? expr.right : [expr.right];
|
|
1784
1664
|
if (values.length === 0) {
|
|
1785
|
-
return expr.op === "in" ?
|
|
1665
|
+
return expr.op === "in" ? chunkEDN4Y4ZG_cjs.sql.raw("1=0") : chunkEDN4Y4ZG_cjs.sql.raw("1=1");
|
|
1786
1666
|
}
|
|
1787
1667
|
const convertedValues = values.map(
|
|
1788
1668
|
(value) => convertValueForSql(value.value, dialect)
|
|
@@ -1794,15 +1674,15 @@ function compileComparisonPredicate(expr, dialect, cteColumnPrefix) {
|
|
|
1794
1674
|
const convertedRight = convertValueForSql(rightValue.value, dialect);
|
|
1795
1675
|
const opSql = COMPARISON_OP_SQL[expr.op];
|
|
1796
1676
|
if (!opSql) {
|
|
1797
|
-
throw new
|
|
1677
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1798
1678
|
`Comparison operation "${expr.op}" is not supported`
|
|
1799
1679
|
);
|
|
1800
1680
|
}
|
|
1801
|
-
return
|
|
1681
|
+
return chunkEDN4Y4ZG_cjs.sql`${left} ${chunkEDN4Y4ZG_cjs.sql.raw(opSql)} ${convertedRight}`;
|
|
1802
1682
|
}
|
|
1803
1683
|
function compileListParameterPredicate(left, parameterName, elementType, negated, dialect) {
|
|
1804
1684
|
if (elementType === "array" || elementType === "object" || elementType === "embedding") {
|
|
1805
|
-
throw new
|
|
1685
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1806
1686
|
`IN/NOT IN is not supported for ${elementType} values`,
|
|
1807
1687
|
{ valueType: elementType },
|
|
1808
1688
|
{
|
|
@@ -1810,7 +1690,7 @@ function compileListParameterPredicate(left, parameterName, elementType, negated
|
|
|
1810
1690
|
}
|
|
1811
1691
|
);
|
|
1812
1692
|
}
|
|
1813
|
-
return dialect.inListParameter(left,
|
|
1693
|
+
return dialect.inListParameter(left, chunkEDN4Y4ZG_cjs.sql.placeholder(parameterName), {
|
|
1814
1694
|
negated,
|
|
1815
1695
|
elementType
|
|
1816
1696
|
});
|
|
@@ -1826,30 +1706,30 @@ function compileArrayPredicate(expr, dialect, cteColumnPrefix) {
|
|
|
1826
1706
|
const values = expr.values?.map((v) => convertValueForSql(v.value, dialect)) ?? [];
|
|
1827
1707
|
switch (expr.op) {
|
|
1828
1708
|
case "isEmpty": {
|
|
1829
|
-
return
|
|
1709
|
+
return chunkEDN4Y4ZG_cjs.sql`(${field} IS NULL OR ${dialect.jsonArrayLength(field)} = 0)`;
|
|
1830
1710
|
}
|
|
1831
1711
|
case "isNotEmpty": {
|
|
1832
|
-
return
|
|
1712
|
+
return chunkEDN4Y4ZG_cjs.sql`(${field} IS NOT NULL AND ${dialect.jsonArrayLength(field)} > 0)`;
|
|
1833
1713
|
}
|
|
1834
1714
|
case "lengthEq": {
|
|
1835
|
-
return
|
|
1715
|
+
return chunkEDN4Y4ZG_cjs.sql`${dialect.jsonArrayLength(field)} = ${expr.length}`;
|
|
1836
1716
|
}
|
|
1837
1717
|
case "lengthGt": {
|
|
1838
|
-
return
|
|
1718
|
+
return chunkEDN4Y4ZG_cjs.sql`${dialect.jsonArrayLength(field)} > ${expr.length}`;
|
|
1839
1719
|
}
|
|
1840
1720
|
case "lengthGte": {
|
|
1841
|
-
return
|
|
1721
|
+
return chunkEDN4Y4ZG_cjs.sql`${dialect.jsonArrayLength(field)} >= ${expr.length}`;
|
|
1842
1722
|
}
|
|
1843
1723
|
case "lengthLt": {
|
|
1844
|
-
return
|
|
1724
|
+
return chunkEDN4Y4ZG_cjs.sql`${dialect.jsonArrayLength(field)} < ${expr.length}`;
|
|
1845
1725
|
}
|
|
1846
1726
|
case "lengthLte": {
|
|
1847
|
-
return
|
|
1727
|
+
return chunkEDN4Y4ZG_cjs.sql`${dialect.jsonArrayLength(field)} <= ${expr.length}`;
|
|
1848
1728
|
}
|
|
1849
1729
|
case "contains": {
|
|
1850
1730
|
const value = values[0];
|
|
1851
1731
|
if (value === void 0) {
|
|
1852
|
-
return
|
|
1732
|
+
return chunkEDN4Y4ZG_cjs.sql.raw("1=0");
|
|
1853
1733
|
}
|
|
1854
1734
|
return dialect.jsonArrayContains(field, value);
|
|
1855
1735
|
}
|
|
@@ -1872,13 +1752,13 @@ function compileObjectPredicate(expr, dialect, cteColumnPrefix) {
|
|
|
1872
1752
|
}
|
|
1873
1753
|
case "pathEquals": {
|
|
1874
1754
|
if (!expr.value) {
|
|
1875
|
-
throw new
|
|
1755
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1876
1756
|
"pathEquals requires a comparison value"
|
|
1877
1757
|
);
|
|
1878
1758
|
}
|
|
1879
1759
|
const valueType = resolvePredicateValueType(expr.valueType, expr.value);
|
|
1880
1760
|
if (valueType === "array" || valueType === "object") {
|
|
1881
|
-
throw new
|
|
1761
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1882
1762
|
"pathEquals is not supported for JSON arrays or objects"
|
|
1883
1763
|
);
|
|
1884
1764
|
}
|
|
@@ -1890,11 +1770,11 @@ function compileObjectPredicate(expr, dialect, cteColumnPrefix) {
|
|
|
1890
1770
|
pointer,
|
|
1891
1771
|
cteColumnPrefix
|
|
1892
1772
|
);
|
|
1893
|
-
return
|
|
1773
|
+
return chunkEDN4Y4ZG_cjs.sql`${left} = ${convertValueForSql(expr.value.value, dialect)}`;
|
|
1894
1774
|
}
|
|
1895
1775
|
case "pathContains": {
|
|
1896
1776
|
if (!expr.value) {
|
|
1897
|
-
throw new
|
|
1777
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1898
1778
|
"pathContains requires a comparison value"
|
|
1899
1779
|
);
|
|
1900
1780
|
}
|
|
@@ -1922,12 +1802,12 @@ function compileAggregatePredicate(expr, dialect) {
|
|
|
1922
1802
|
const aggregate = compileAggregateExpr(expr.aggregate, dialect);
|
|
1923
1803
|
const op = COMPARISON_OP_SQL[expr.op];
|
|
1924
1804
|
if (!op) {
|
|
1925
|
-
throw new
|
|
1805
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1926
1806
|
`Comparison operation "${expr.op}" is not supported for aggregate predicates`
|
|
1927
1807
|
);
|
|
1928
1808
|
}
|
|
1929
1809
|
const convertedValue = convertValueForSql(expr.value.value, dialect);
|
|
1930
|
-
return
|
|
1810
|
+
return chunkEDN4Y4ZG_cjs.sql`${aggregate} ${chunkEDN4Y4ZG_cjs.sql.raw(op)} ${convertedValue}`;
|
|
1931
1811
|
}
|
|
1932
1812
|
function compileAggregateExpr(expr, dialect) {
|
|
1933
1813
|
const cteAlias = `cte_${expr.field.alias}`;
|
|
@@ -1939,25 +1819,25 @@ function compileAggregateExpr(expr, dialect) {
|
|
|
1939
1819
|
);
|
|
1940
1820
|
switch (expr.function) {
|
|
1941
1821
|
case "count": {
|
|
1942
|
-
return
|
|
1822
|
+
return chunkEDN4Y4ZG_cjs.sql`COUNT(${field})`;
|
|
1943
1823
|
}
|
|
1944
1824
|
case "countDistinct": {
|
|
1945
|
-
return
|
|
1825
|
+
return chunkEDN4Y4ZG_cjs.sql`COUNT(DISTINCT ${field})`;
|
|
1946
1826
|
}
|
|
1947
1827
|
case "sum": {
|
|
1948
|
-
return
|
|
1828
|
+
return chunkEDN4Y4ZG_cjs.sql`SUM(${field})`;
|
|
1949
1829
|
}
|
|
1950
1830
|
case "avg": {
|
|
1951
|
-
return
|
|
1831
|
+
return chunkEDN4Y4ZG_cjs.sql`AVG(${field})`;
|
|
1952
1832
|
}
|
|
1953
1833
|
case "min": {
|
|
1954
|
-
return
|
|
1834
|
+
return chunkEDN4Y4ZG_cjs.sql`MIN(${field})`;
|
|
1955
1835
|
}
|
|
1956
1836
|
case "max": {
|
|
1957
|
-
return
|
|
1837
|
+
return chunkEDN4Y4ZG_cjs.sql`MAX(${field})`;
|
|
1958
1838
|
}
|
|
1959
1839
|
default: {
|
|
1960
|
-
throw new
|
|
1840
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1961
1841
|
`Unknown aggregate function: ${expr.function}`
|
|
1962
1842
|
);
|
|
1963
1843
|
}
|
|
@@ -1965,15 +1845,15 @@ function compileAggregateExpr(expr, dialect) {
|
|
|
1965
1845
|
}
|
|
1966
1846
|
function compileExistsSubquery(expr, ctx) {
|
|
1967
1847
|
if (expr.subquery.graphId === void 0) {
|
|
1968
|
-
throw new
|
|
1848
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError("EXISTS subquery must have a graphId");
|
|
1969
1849
|
}
|
|
1970
1850
|
const subSql = ctx.compileQuery(expr.subquery, expr.subquery.graphId);
|
|
1971
|
-
return expr.negated ?
|
|
1851
|
+
return expr.negated ? chunkEDN4Y4ZG_cjs.sql`NOT EXISTS (${subSql})` : chunkEDN4Y4ZG_cjs.sql`EXISTS (${subSql})`;
|
|
1972
1852
|
}
|
|
1973
1853
|
function compileInSubquery(expr, ctx) {
|
|
1974
1854
|
const subqueryColumnCount = getSubqueryColumnCount(expr.subquery);
|
|
1975
1855
|
if (subqueryColumnCount !== 1) {
|
|
1976
|
-
throw new
|
|
1856
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1977
1857
|
`IN/NOT IN subquery must project exactly 1 column, but got ${subqueryColumnCount}`,
|
|
1978
1858
|
{ subqueryColumnCount }
|
|
1979
1859
|
);
|
|
@@ -1982,13 +1862,13 @@ function compileInSubquery(expr, ctx) {
|
|
|
1982
1862
|
const subqueryValueType = getSingleSubqueryColumnValueType(expr.subquery);
|
|
1983
1863
|
const resolvedValueType = fieldValueType ?? subqueryValueType;
|
|
1984
1864
|
if (isUnsupportedInSubqueryValueType(resolvedValueType)) {
|
|
1985
|
-
throw new
|
|
1865
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1986
1866
|
`IN/NOT IN subquery does not support ${String(resolvedValueType)} values`,
|
|
1987
1867
|
{ valueType: resolvedValueType }
|
|
1988
1868
|
);
|
|
1989
1869
|
}
|
|
1990
1870
|
if (!isInSubqueryTypeCompatible(fieldValueType, subqueryValueType)) {
|
|
1991
|
-
throw new
|
|
1871
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1992
1872
|
`IN/NOT IN type mismatch: field type "${String(fieldValueType)}" does not match subquery column type "${String(subqueryValueType)}"`,
|
|
1993
1873
|
{
|
|
1994
1874
|
fieldValueType,
|
|
@@ -1998,7 +1878,7 @@ function compileInSubquery(expr, ctx) {
|
|
|
1998
1878
|
}
|
|
1999
1879
|
const valueType = fieldValueType ?? subqueryValueType;
|
|
2000
1880
|
if (expr.subquery.graphId === void 0) {
|
|
2001
|
-
throw new
|
|
1881
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
2002
1882
|
"IN/NOT IN subquery must have a graphId"
|
|
2003
1883
|
);
|
|
2004
1884
|
}
|
|
@@ -2011,14 +1891,14 @@ function compileInSubquery(expr, ctx) {
|
|
|
2011
1891
|
ctx.cteColumnPrefix
|
|
2012
1892
|
);
|
|
2013
1893
|
const subSql = ctx.compileQuery(expr.subquery, expr.subquery.graphId);
|
|
2014
|
-
return expr.negated ?
|
|
1894
|
+
return expr.negated ? chunkEDN4Y4ZG_cjs.sql`${fieldSql} NOT IN (${subSql})` : chunkEDN4Y4ZG_cjs.sql`${fieldSql} IN (${subSql})`;
|
|
2015
1895
|
}
|
|
2016
1896
|
function extractStructuralPredicates(predicates, isMatch, rejectionMessage) {
|
|
2017
1897
|
const results = [];
|
|
2018
1898
|
function visit(expr, inDisallowedBranch) {
|
|
2019
1899
|
if (isMatch(expr)) {
|
|
2020
1900
|
if (inDisallowedBranch) {
|
|
2021
|
-
throw new
|
|
1901
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(rejectionMessage);
|
|
2022
1902
|
}
|
|
2023
1903
|
results.push(expr);
|
|
2024
1904
|
return;
|
|
@@ -2072,9 +1952,9 @@ function extractFulltextMatchPredicates(predicates) {
|
|
|
2072
1952
|
// src/query/compiler/predicate-utils.ts
|
|
2073
1953
|
var EMPTY_PREDICATES = [];
|
|
2074
1954
|
function sqlValueList(values) {
|
|
2075
|
-
return
|
|
2076
|
-
values.map((value) =>
|
|
2077
|
-
|
|
1955
|
+
return chunkEDN4Y4ZG_cjs.sql.join(
|
|
1956
|
+
values.map((value) => chunkEDN4Y4ZG_cjs.sql`${value}`),
|
|
1957
|
+
chunkEDN4Y4ZG_cjs.sql`, `
|
|
2078
1958
|
);
|
|
2079
1959
|
}
|
|
2080
1960
|
function buildPredicateIndexKey(alias, targetType) {
|
|
@@ -2111,12 +1991,12 @@ function compilePredicateClauses(predicates, predicateContext) {
|
|
|
2111
1991
|
}
|
|
2112
1992
|
function compileKindFilter(column, kinds) {
|
|
2113
1993
|
if (kinds.length === 0) {
|
|
2114
|
-
return
|
|
1994
|
+
return chunkEDN4Y4ZG_cjs.sql`1 = 0`;
|
|
2115
1995
|
}
|
|
2116
1996
|
if (kinds.length === 1) {
|
|
2117
|
-
return
|
|
1997
|
+
return chunkEDN4Y4ZG_cjs.sql`${column} = ${kinds[0]}`;
|
|
2118
1998
|
}
|
|
2119
|
-
return
|
|
1999
|
+
return chunkEDN4Y4ZG_cjs.sql`${column} IN (${sqlValueList(kinds)})`;
|
|
2120
2000
|
}
|
|
2121
2001
|
function getNodeKindsForAlias(ast, alias) {
|
|
2122
2002
|
if (alias === ast.start.alias) {
|
|
@@ -2127,7 +2007,7 @@ function getNodeKindsForAlias(ast, alias) {
|
|
|
2127
2007
|
return traversal.nodeKinds;
|
|
2128
2008
|
}
|
|
2129
2009
|
}
|
|
2130
|
-
throw new
|
|
2010
|
+
throw new chunkMRDBBHIZ_cjs.CompilerInvariantError(`Unknown traversal source alias: ${alias}`);
|
|
2131
2011
|
}
|
|
2132
2012
|
function getHybridTargetAlias(vectorPredicate, fulltextPredicate) {
|
|
2133
2013
|
if (!vectorPredicate || !fulltextPredicate) return void 0;
|
|
@@ -2232,16 +2112,16 @@ var RECORDED_IDENTITY_ASSERTION_COLUMNS = [
|
|
|
2232
2112
|
"recorded_to",
|
|
2233
2113
|
"op"
|
|
2234
2114
|
];
|
|
2235
|
-
var RECORDED_NODE_COLUMN_LIST =
|
|
2236
|
-
var RECORDED_EDGE_COLUMN_LIST =
|
|
2237
|
-
var RECORDED_IDENTITY_ASSERTION_COLUMN_LIST =
|
|
2115
|
+
var RECORDED_NODE_COLUMN_LIST = chunkEDN4Y4ZG_cjs.sql.raw(RECORDED_NODE_COLUMNS.join(", "));
|
|
2116
|
+
var RECORDED_EDGE_COLUMN_LIST = chunkEDN4Y4ZG_cjs.sql.raw(RECORDED_EDGE_COLUMNS.join(", "));
|
|
2117
|
+
var RECORDED_IDENTITY_ASSERTION_COLUMN_LIST = chunkEDN4Y4ZG_cjs.sql.raw(
|
|
2238
2118
|
RECORDED_IDENTITY_ASSERTION_COLUMNS.join(", ")
|
|
2239
2119
|
);
|
|
2240
2120
|
var RECORDED_BIND_PARAM_BUDGET = 900;
|
|
2241
2121
|
function recordedBindParamBudget(target) {
|
|
2242
2122
|
const budget = target.capabilities.maxBindParameters ?? RECORDED_BIND_PARAM_BUDGET;
|
|
2243
2123
|
if (!Number.isSafeInteger(budget) || budget < 1) {
|
|
2244
|
-
throw new
|
|
2124
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
2245
2125
|
`backend capabilities.maxBindParameters must be a positive integer, got: ${String(budget)}`,
|
|
2246
2126
|
{
|
|
2247
2127
|
code: "INVALID_BACKEND_CAPABILITY",
|
|
@@ -2257,64 +2137,64 @@ function recordedChunkSize(target, columnCount) {
|
|
|
2257
2137
|
return Math.max(1, Math.floor(budget / columnCount));
|
|
2258
2138
|
}
|
|
2259
2139
|
function sqlNull(value) {
|
|
2260
|
-
return value === void 0 ?
|
|
2140
|
+
return value === void 0 ? chunkEDN4Y4ZG_cjs.sql.raw("NULL") : chunkEDN4Y4ZG_cjs.sql`${value}`;
|
|
2261
2141
|
}
|
|
2262
2142
|
function recordedCommonCells() {
|
|
2263
2143
|
return {
|
|
2264
|
-
history_id: () =>
|
|
2265
|
-
graph_id: (row) =>
|
|
2266
|
-
id: (row) =>
|
|
2267
|
-
kind: (row) =>
|
|
2268
|
-
props: (row) =>
|
|
2269
|
-
valid_from: (row) =>
|
|
2270
|
-
valid_to: (row) =>
|
|
2271
|
-
created_at: (row) =>
|
|
2272
|
-
updated_at: (row) =>
|
|
2273
|
-
deleted_at: (row) =>
|
|
2274
|
-
recorded_from: (_row, recordedRevision) =>
|
|
2275
|
-
recorded_to: () =>
|
|
2276
|
-
op: (_row, _recordedCommit, operation) =>
|
|
2277
|
-
schema_version: () =>
|
|
2278
|
-
tx_id: () =>
|
|
2279
|
-
meta: () =>
|
|
2144
|
+
history_id: () => chunkEDN4Y4ZG_cjs.sql`${generateId()}`,
|
|
2145
|
+
graph_id: (row) => chunkEDN4Y4ZG_cjs.sql`${row.graph_id}`,
|
|
2146
|
+
id: (row) => chunkEDN4Y4ZG_cjs.sql`${row.id}`,
|
|
2147
|
+
kind: (row) => chunkEDN4Y4ZG_cjs.sql`${row.kind}`,
|
|
2148
|
+
props: (row) => chunkEDN4Y4ZG_cjs.sql`${chunk5PRKMB24_cjs.rowPropsToJsonText(row.props)}`,
|
|
2149
|
+
valid_from: (row) => chunkEDN4Y4ZG_cjs.sql`${sqlNull(row.valid_from)}`,
|
|
2150
|
+
valid_to: (row) => chunkEDN4Y4ZG_cjs.sql`${sqlNull(row.valid_to)}`,
|
|
2151
|
+
created_at: (row) => chunkEDN4Y4ZG_cjs.sql`${row.created_at}`,
|
|
2152
|
+
updated_at: (row) => chunkEDN4Y4ZG_cjs.sql`${row.updated_at}`,
|
|
2153
|
+
deleted_at: (row) => chunkEDN4Y4ZG_cjs.sql`${sqlNull(row.deleted_at)}`,
|
|
2154
|
+
recorded_from: (_row, recordedRevision) => chunkEDN4Y4ZG_cjs.sql`${recordedRevision}`,
|
|
2155
|
+
recorded_to: () => chunkEDN4Y4ZG_cjs.sql`${chunk2QGYQBS2_cjs.RECORDED_MAX_REVISION}`,
|
|
2156
|
+
op: (_row, _recordedCommit, operation) => chunkEDN4Y4ZG_cjs.sql`${operation}`,
|
|
2157
|
+
schema_version: () => chunkEDN4Y4ZG_cjs.sql`NULL`,
|
|
2158
|
+
tx_id: () => chunkEDN4Y4ZG_cjs.sql`NULL`,
|
|
2159
|
+
meta: () => chunkEDN4Y4ZG_cjs.sql`${RECORDED_HISTORY_META}`
|
|
2280
2160
|
};
|
|
2281
2161
|
}
|
|
2282
2162
|
var recordedNodeCells = {
|
|
2283
2163
|
...recordedCommonCells(),
|
|
2284
|
-
version: (row) =>
|
|
2164
|
+
version: (row) => chunkEDN4Y4ZG_cjs.sql`${row.version}`
|
|
2285
2165
|
};
|
|
2286
2166
|
var recordedEdgeCells = {
|
|
2287
2167
|
...recordedCommonCells(),
|
|
2288
|
-
from_kind: (row) =>
|
|
2289
|
-
from_id: (row) =>
|
|
2290
|
-
to_kind: (row) =>
|
|
2291
|
-
to_id: (row) =>
|
|
2168
|
+
from_kind: (row) => chunkEDN4Y4ZG_cjs.sql`${row.from_kind}`,
|
|
2169
|
+
from_id: (row) => chunkEDN4Y4ZG_cjs.sql`${row.from_id}`,
|
|
2170
|
+
to_kind: (row) => chunkEDN4Y4ZG_cjs.sql`${row.to_kind}`,
|
|
2171
|
+
to_id: (row) => chunkEDN4Y4ZG_cjs.sql`${row.to_id}`
|
|
2292
2172
|
};
|
|
2293
2173
|
var recordedIdentityAssertionCells = {
|
|
2294
|
-
history_id: () =>
|
|
2295
|
-
graph_id: (row) =>
|
|
2296
|
-
id: (row) =>
|
|
2297
|
-
rel: (row) =>
|
|
2298
|
-
a_kind: (row) =>
|
|
2299
|
-
a_id: (row) =>
|
|
2300
|
-
b_kind: (row) =>
|
|
2301
|
-
b_id: (row) =>
|
|
2302
|
-
valid_from: (row) =>
|
|
2303
|
-
valid_to: (row) =>
|
|
2304
|
-
created_at: (row) =>
|
|
2305
|
-
updated_at: (row) =>
|
|
2306
|
-
deleted_at: (row) =>
|
|
2307
|
-
ended_by_kind: (row) =>
|
|
2308
|
-
ended_by_id: (row) =>
|
|
2309
|
-
recorded_from: (_row, recordedRevision) =>
|
|
2310
|
-
recorded_to: () =>
|
|
2311
|
-
op: (_row, _recordedRevision, operation) =>
|
|
2174
|
+
history_id: () => chunkEDN4Y4ZG_cjs.sql`${generateId()}`,
|
|
2175
|
+
graph_id: (row) => chunkEDN4Y4ZG_cjs.sql`${row.graph_id}`,
|
|
2176
|
+
id: (row) => chunkEDN4Y4ZG_cjs.sql`${row.id}`,
|
|
2177
|
+
rel: (row) => chunkEDN4Y4ZG_cjs.sql`${row.rel}`,
|
|
2178
|
+
a_kind: (row) => chunkEDN4Y4ZG_cjs.sql`${row.a_kind}`,
|
|
2179
|
+
a_id: (row) => chunkEDN4Y4ZG_cjs.sql`${row.a_id}`,
|
|
2180
|
+
b_kind: (row) => chunkEDN4Y4ZG_cjs.sql`${row.b_kind}`,
|
|
2181
|
+
b_id: (row) => chunkEDN4Y4ZG_cjs.sql`${row.b_id}`,
|
|
2182
|
+
valid_from: (row) => chunkEDN4Y4ZG_cjs.sql`${row.valid_from}`,
|
|
2183
|
+
valid_to: (row) => chunkEDN4Y4ZG_cjs.sql`${row.valid_to ?? chunkEDN4Y4ZG_cjs.sql.raw("NULL")}`,
|
|
2184
|
+
created_at: (row) => chunkEDN4Y4ZG_cjs.sql`${row.created_at}`,
|
|
2185
|
+
updated_at: (row) => chunkEDN4Y4ZG_cjs.sql`${row.updated_at}`,
|
|
2186
|
+
deleted_at: (row) => chunkEDN4Y4ZG_cjs.sql`${row.deleted_at ?? chunkEDN4Y4ZG_cjs.sql.raw("NULL")}`,
|
|
2187
|
+
ended_by_kind: (row) => chunkEDN4Y4ZG_cjs.sql`${row.ended_by_kind ?? chunkEDN4Y4ZG_cjs.sql.raw("NULL")}`,
|
|
2188
|
+
ended_by_id: (row) => chunkEDN4Y4ZG_cjs.sql`${row.ended_by_id ?? chunkEDN4Y4ZG_cjs.sql.raw("NULL")}`,
|
|
2189
|
+
recorded_from: (_row, recordedRevision) => chunkEDN4Y4ZG_cjs.sql`${recordedRevision}`,
|
|
2190
|
+
recorded_to: () => chunkEDN4Y4ZG_cjs.sql`${chunk2QGYQBS2_cjs.RECORDED_MAX_REVISION}`,
|
|
2191
|
+
op: (_row, _recordedRevision, operation) => chunkEDN4Y4ZG_cjs.sql`${operation}`
|
|
2312
2192
|
};
|
|
2313
2193
|
function recordedValuesTuple(columns, cells, row, recordedRevision, operation) {
|
|
2314
2194
|
const tuple = columns.map(
|
|
2315
2195
|
(column) => cells[column](row, recordedRevision, operation)
|
|
2316
2196
|
);
|
|
2317
|
-
return
|
|
2197
|
+
return chunkEDN4Y4ZG_cjs.sql`(${chunkEDN4Y4ZG_cjs.sql.join(tuple, chunkEDN4Y4ZG_cjs.sql`, `)})`;
|
|
2318
2198
|
}
|
|
2319
2199
|
async function insertRecordedRows(target, table, columnList, columns, cells, inserts, recordedRevision) {
|
|
2320
2200
|
if (inserts.length === 0) return;
|
|
@@ -2329,9 +2209,9 @@ async function insertRecordedRows(target, table, columnList, columns, cells, ins
|
|
|
2329
2209
|
);
|
|
2330
2210
|
await executeStatement(
|
|
2331
2211
|
target,
|
|
2332
|
-
|
|
2212
|
+
chunkEDN4Y4ZG_cjs.sql`
|
|
2333
2213
|
INSERT INTO ${table} (${columnList})
|
|
2334
|
-
VALUES ${
|
|
2214
|
+
VALUES ${chunkEDN4Y4ZG_cjs.sql.join(values, chunkEDN4Y4ZG_cjs.sql`, `)}
|
|
2335
2215
|
`
|
|
2336
2216
|
);
|
|
2337
2217
|
}
|
|
@@ -2393,14 +2273,14 @@ function entityKey(entity) {
|
|
|
2393
2273
|
}
|
|
2394
2274
|
}
|
|
2395
2275
|
async function closeOpenReturning(target, table, graphId, ids, recordedRevision, kind) {
|
|
2396
|
-
const kindFilter = kind === void 0 ?
|
|
2276
|
+
const kindFilter = kind === void 0 ? chunkEDN4Y4ZG_cjs.sql`` : chunkEDN4Y4ZG_cjs.sql`AND kind = ${kind}`;
|
|
2397
2277
|
const rows = await target.execute(
|
|
2398
|
-
|
|
2278
|
+
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
2399
2279
|
UPDATE ${table}
|
|
2400
2280
|
SET recorded_to = ${recordedRevision}
|
|
2401
2281
|
WHERE graph_id = ${graphId}
|
|
2402
2282
|
${kindFilter}
|
|
2403
|
-
AND recorded_to = ${
|
|
2283
|
+
AND recorded_to = ${chunk2QGYQBS2_cjs.RECORDED_MAX_REVISION}
|
|
2404
2284
|
AND id IN (${sqlValueList(ids)})
|
|
2405
2285
|
RETURNING id, deleted_at
|
|
2406
2286
|
`)
|
|
@@ -2445,7 +2325,7 @@ function recordedInsertsFor(afterById, closed) {
|
|
|
2445
2325
|
async function flushNodes(target, schema, graphId, entities, recordedRevision) {
|
|
2446
2326
|
const chunkSize = recordedNodeChunkSize(target);
|
|
2447
2327
|
for (const [kind, group] of groupNodesByKind(entities)) {
|
|
2448
|
-
for (const entityChunk of
|
|
2328
|
+
for (const entityChunk of chunkSIT26LAZ_cjs.chunk(group, chunkSize)) {
|
|
2449
2329
|
const ids = entityChunk.map((entity) => entity.id);
|
|
2450
2330
|
const closed = await closeOpenReturning(
|
|
2451
2331
|
target,
|
|
@@ -2470,7 +2350,7 @@ async function flushNodes(target, schema, graphId, entities, recordedRevision) {
|
|
|
2470
2350
|
}
|
|
2471
2351
|
async function flushEdges(target, schema, graphId, entities, recordedRevision) {
|
|
2472
2352
|
const chunkSize = recordedEdgeChunkSize(target);
|
|
2473
|
-
for (const entityChunk of
|
|
2353
|
+
for (const entityChunk of chunkSIT26LAZ_cjs.chunk(entities, chunkSize)) {
|
|
2474
2354
|
const ids = entityChunk.map((entity) => entity.id);
|
|
2475
2355
|
const closed = await closeOpenReturning(
|
|
2476
2356
|
target,
|
|
@@ -2494,7 +2374,7 @@ async function flushEdges(target, schema, graphId, entities, recordedRevision) {
|
|
|
2494
2374
|
async function getIdentityAssertionRowsByIds(target, schema, graphId, ids) {
|
|
2495
2375
|
if (ids.length === 0) return /* @__PURE__ */ new Map();
|
|
2496
2376
|
const rows = await target.execute(
|
|
2497
|
-
|
|
2377
|
+
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
2498
2378
|
SELECT ${IDENTITY_ASSERTION_COLUMNS}
|
|
2499
2379
|
FROM ${schema.identityAssertionsTable}
|
|
2500
2380
|
WHERE graph_id = ${graphId}
|
|
@@ -2506,7 +2386,7 @@ async function getIdentityAssertionRowsByIds(target, schema, graphId, ids) {
|
|
|
2506
2386
|
async function flushIdentityAssertions(target, schema, graphId, entities, recordedRevision) {
|
|
2507
2387
|
if (entities.length === 0) return;
|
|
2508
2388
|
const chunkSize = recordedIdentityAssertionChunkSize(target);
|
|
2509
|
-
for (const entityChunk of
|
|
2389
|
+
for (const entityChunk of chunkSIT26LAZ_cjs.chunk(entities, chunkSize)) {
|
|
2510
2390
|
const ids = entityChunk.map((entity) => entity.id);
|
|
2511
2391
|
const closed = await closeOpenReturning(
|
|
2512
2392
|
target,
|
|
@@ -2530,24 +2410,24 @@ async function flushIdentityAssertions(target, schema, graphId, entities, record
|
|
|
2530
2410
|
async function closeOpenByKind(target, table, graphId, kind, recordedRevision) {
|
|
2531
2411
|
await executeStatement(
|
|
2532
2412
|
target,
|
|
2533
|
-
|
|
2413
|
+
chunkEDN4Y4ZG_cjs.sql`
|
|
2534
2414
|
UPDATE ${table}
|
|
2535
2415
|
SET recorded_to = ${recordedRevision}
|
|
2536
2416
|
WHERE graph_id = ${graphId}
|
|
2537
2417
|
AND kind = ${kind}
|
|
2538
|
-
AND recorded_to = ${
|
|
2418
|
+
AND recorded_to = ${chunk2QGYQBS2_cjs.RECORDED_MAX_REVISION}
|
|
2539
2419
|
`
|
|
2540
2420
|
);
|
|
2541
2421
|
}
|
|
2542
2422
|
async function closeOpenEdgesByNodeKind(target, schema, graphId, nodeKind, recordedRevision) {
|
|
2543
2423
|
await executeStatement(
|
|
2544
2424
|
target,
|
|
2545
|
-
|
|
2425
|
+
chunkEDN4Y4ZG_cjs.sql`
|
|
2546
2426
|
UPDATE ${schema.recordedEdgesTable}
|
|
2547
2427
|
SET recorded_to = ${recordedRevision}
|
|
2548
2428
|
WHERE graph_id = ${graphId}
|
|
2549
2429
|
AND (from_kind = ${nodeKind} OR to_kind = ${nodeKind})
|
|
2550
|
-
AND recorded_to = ${
|
|
2430
|
+
AND recorded_to = ${chunk2QGYQBS2_cjs.RECORDED_MAX_REVISION}
|
|
2551
2431
|
`
|
|
2552
2432
|
);
|
|
2553
2433
|
}
|
|
@@ -2585,7 +2465,7 @@ async function closeRecordedHardDeletedKind(target, schema, graphId, removal, ow
|
|
|
2585
2465
|
}
|
|
2586
2466
|
async function queryConnectedEdgeIds(target, schema, params) {
|
|
2587
2467
|
const rows = await target.execute(
|
|
2588
|
-
|
|
2468
|
+
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
2589
2469
|
SELECT id
|
|
2590
2470
|
FROM ${schema.edgesTable}
|
|
2591
2471
|
WHERE graph_id = ${params.graphId}
|
|
@@ -2606,9 +2486,9 @@ function normalizedColumnType(value) {
|
|
|
2606
2486
|
}
|
|
2607
2487
|
async function readColumnTypes(backend, table) {
|
|
2608
2488
|
const rows = backend.dialect === "sqlite" ? await backend.execute(
|
|
2609
|
-
|
|
2489
|
+
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`PRAGMA table_info(${chunkEDN4Y4ZG_cjs.sql.identifier(table)})`)
|
|
2610
2490
|
) : await backend.execute(
|
|
2611
|
-
|
|
2491
|
+
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
2612
2492
|
SELECT column_name AS name, data_type AS type
|
|
2613
2493
|
FROM information_schema.columns
|
|
2614
2494
|
WHERE table_schema = current_schema()
|
|
@@ -2690,7 +2570,7 @@ async function assertCurrentRecordedSchema(backend, schema, includeIdentity = fa
|
|
|
2690
2570
|
);
|
|
2691
2571
|
const recordedIdentityTable = schema.tables.recordedIdentityAssertions;
|
|
2692
2572
|
if (includeIdentity && (columnTypes.get(recordedIdentityTable)?.size ?? 0) === 0) {
|
|
2693
|
-
throw new
|
|
2573
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
2694
2574
|
"Recorded identity history is not provisioned for this database.",
|
|
2695
2575
|
{
|
|
2696
2576
|
code: "RECORDED_IDENTITY_SCHEMA_MISSING",
|
|
@@ -2710,7 +2590,7 @@ async function assertCurrentRecordedSchema(backend, schema, includeIdentity = fa
|
|
|
2710
2590
|
return [{ ...requirement, actual: actual ?? "missing" }];
|
|
2711
2591
|
});
|
|
2712
2592
|
if (incompatible.length === 0) return;
|
|
2713
|
-
throw new
|
|
2593
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
2714
2594
|
"Recorded-time schema is incompatible with history capture.",
|
|
2715
2595
|
{
|
|
2716
2596
|
code: "RECORDED_SCHEMA_INCOMPATIBLE",
|
|
@@ -2758,7 +2638,7 @@ function edgeRowIdentityKey(row) {
|
|
|
2758
2638
|
return edgeIdentityKey(row.graph_id, row.id);
|
|
2759
2639
|
}
|
|
2760
2640
|
function recordedCaptureSealedError(details) {
|
|
2761
|
-
return new
|
|
2641
|
+
return new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
2762
2642
|
"Recorded-time capture session is sealed: a graph write happened after the transaction's capture was flushed.",
|
|
2763
2643
|
details,
|
|
2764
2644
|
{
|
|
@@ -2768,6 +2648,7 @@ function recordedCaptureSealedError(details) {
|
|
|
2768
2648
|
}
|
|
2769
2649
|
function createRecordedCaptureSession() {
|
|
2770
2650
|
const touched = /* @__PURE__ */ new Map();
|
|
2651
|
+
const forcedGraphRevisions = /* @__PURE__ */ new Set();
|
|
2771
2652
|
let sealed = false;
|
|
2772
2653
|
function touch(entity) {
|
|
2773
2654
|
if (sealed) {
|
|
@@ -2792,9 +2673,13 @@ function createRecordedCaptureSession() {
|
|
|
2792
2673
|
touchIdentityAssertion(graphId, id, afterImage) {
|
|
2793
2674
|
touch({ entity: "identity", graphId, id, afterImage });
|
|
2794
2675
|
},
|
|
2676
|
+
forceGraphRevision(graphId) {
|
|
2677
|
+
if (sealed) throw recordedCaptureSealedError({ graphId });
|
|
2678
|
+
forcedGraphRevisions.add(graphId);
|
|
2679
|
+
},
|
|
2795
2680
|
async flush(target, schema, ownsWriteLock) {
|
|
2796
2681
|
if (sealed) {
|
|
2797
|
-
throw new
|
|
2682
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
2798
2683
|
"Recorded-time capture session was already flushed.",
|
|
2799
2684
|
{},
|
|
2800
2685
|
{
|
|
@@ -2803,9 +2688,13 @@ function createRecordedCaptureSession() {
|
|
|
2803
2688
|
);
|
|
2804
2689
|
}
|
|
2805
2690
|
sealed = true;
|
|
2806
|
-
if (touched.size === 0
|
|
2691
|
+
if (touched.size === 0 && forcedGraphRevisions.size === 0)
|
|
2692
|
+
return /* @__PURE__ */ new Map();
|
|
2807
2693
|
const recordedByGraph = /* @__PURE__ */ new Map();
|
|
2808
|
-
const byGraph =
|
|
2694
|
+
const byGraph = chunkSIT26LAZ_cjs.groupBy(touched.values(), (entity) => entity.graphId);
|
|
2695
|
+
for (const graphId of forcedGraphRevisions) {
|
|
2696
|
+
if (!byGraph.has(graphId)) byGraph.set(graphId, []);
|
|
2697
|
+
}
|
|
2809
2698
|
for (const [graphId, entities] of byGraph) {
|
|
2810
2699
|
const recordedCommit = await allocateRecordedCommit(
|
|
2811
2700
|
target,
|
|
@@ -2846,11 +2735,19 @@ function createRecordedCaptureSession() {
|
|
|
2846
2735
|
);
|
|
2847
2736
|
}
|
|
2848
2737
|
touched.clear();
|
|
2738
|
+
forcedGraphRevisions.clear();
|
|
2849
2739
|
return recordedByGraph;
|
|
2850
2740
|
}
|
|
2851
2741
|
};
|
|
2852
2742
|
}
|
|
2853
2743
|
var recordedIdentityBindings = /* @__PURE__ */ new WeakMap();
|
|
2744
|
+
var recordedRevisionBindings = /* @__PURE__ */ new WeakMap();
|
|
2745
|
+
function forceRecordedGraphRevision(backend, graphId) {
|
|
2746
|
+
const session = recordedRevisionBindings.get(backend);
|
|
2747
|
+
if (session === void 0) return false;
|
|
2748
|
+
session.forceGraphRevision(graphId);
|
|
2749
|
+
return true;
|
|
2750
|
+
}
|
|
2854
2751
|
function ignoreIdentityTouch() {
|
|
2855
2752
|
return;
|
|
2856
2753
|
}
|
|
@@ -2879,7 +2776,7 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
2879
2776
|
await lockRecordedGraphWrite(target, graphId, graphLocks);
|
|
2880
2777
|
}
|
|
2881
2778
|
}
|
|
2882
|
-
const overlay =
|
|
2779
|
+
const overlay = chunkSIT26LAZ_cjs.deriveBackend(target, {
|
|
2883
2780
|
...rawWriteGuards(target, "tx.backend"),
|
|
2884
2781
|
async insertNode(params) {
|
|
2885
2782
|
session.assertOpen();
|
|
@@ -3049,6 +2946,7 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
3049
2946
|
registerRecordedGraphLockMemo(overlay, graphLocks);
|
|
3050
2947
|
recordedIdentityBindings.set(overlay, { target, session });
|
|
3051
2948
|
recordedIdentityBindings.set(target, { target, session });
|
|
2949
|
+
recordedRevisionBindings.set(overlay, session);
|
|
3052
2950
|
return overlay;
|
|
3053
2951
|
}
|
|
3054
2952
|
function createRecordedTransactionScope(target, schema, ownsWriteLock = false) {
|
|
@@ -3058,7 +2956,7 @@ function createRecordedTransactionScope(target, schema, ownsWriteLock = false) {
|
|
|
3058
2956
|
return {
|
|
3059
2957
|
backend: createRecordedTransactionBackend(target, session, resolvedSchema),
|
|
3060
2958
|
async flush() {
|
|
3061
|
-
return
|
|
2959
|
+
return chunkSIT26LAZ_cjs.withRecordedRelationsPrecondition(
|
|
3062
2960
|
session.flush(target, resolvedSchema, ownsWriteLock),
|
|
3063
2961
|
{ dialect: target.dialect, surface: "capture-flush" }
|
|
3064
2962
|
);
|
|
@@ -3078,8 +2976,8 @@ async function runCapturedAutocommit(backend, schema, fn, options) {
|
|
|
3078
2976
|
function createRecordedBackend(backend, schema) {
|
|
3079
2977
|
assertCapturableBackend(backend);
|
|
3080
2978
|
const capture = (fn) => runCapturedAutocommit(backend, schema, fn);
|
|
3081
|
-
const projectedBackend =
|
|
3082
|
-
return
|
|
2979
|
+
const projectedBackend = chunkSIT26LAZ_cjs.projectGraphBackend(backend);
|
|
2980
|
+
return chunkSIT26LAZ_cjs.deriveBackend(projectedBackend, {
|
|
3083
2981
|
...rawWriteGuards(backend, "backend"),
|
|
3084
2982
|
async insertNode(params) {
|
|
3085
2983
|
return capture((target) => target.insertNode(params));
|
|
@@ -3113,7 +3011,7 @@ function createRecordedBackend(backend, schema) {
|
|
|
3113
3011
|
return capture((target) => {
|
|
3114
3012
|
const updateNodeSet = target.updateNodeSet;
|
|
3115
3013
|
if (updateNodeSet === void 0) {
|
|
3116
|
-
throw new
|
|
3014
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
3117
3015
|
"Recorded updateNodeSet capability disappeared inside a transaction",
|
|
3118
3016
|
{ operation: "updateNodeSet" }
|
|
3119
3017
|
);
|
|
@@ -3214,6 +3112,11 @@ function compareCodePoints(left, right) {
|
|
|
3214
3112
|
return leftExhausted ? -1 : 1;
|
|
3215
3113
|
}
|
|
3216
3114
|
|
|
3115
|
+
// src/utils/tuple-key.ts
|
|
3116
|
+
function encodeTupleKey(values) {
|
|
3117
|
+
return JSON.stringify(values);
|
|
3118
|
+
}
|
|
3119
|
+
|
|
3217
3120
|
exports.CURRENT_READ_INSTANT_PLACEHOLDER = CURRENT_READ_INSTANT_PLACEHOLDER;
|
|
3218
3121
|
exports.IDENTITY_ASSERTION_COLUMNS = IDENTITY_ASSERTION_COLUMNS;
|
|
3219
3122
|
exports.IDENTITY_PEER_CLASS_COLUMNS = IDENTITY_PEER_CLASS_COLUMNS;
|
|
@@ -3234,19 +3137,20 @@ exports.compilePredicateClauses = compilePredicateClauses;
|
|
|
3234
3137
|
exports.compilePredicateExpression = compilePredicateExpression;
|
|
3235
3138
|
exports.compileTemporalFilter = compileTemporalFilter;
|
|
3236
3139
|
exports.createFulltextAccessor = createFulltextAccessor;
|
|
3237
|
-
exports.createGraphBackendProjection = createGraphBackendProjection;
|
|
3238
3140
|
exports.createRecordedBackend = createRecordedBackend;
|
|
3239
3141
|
exports.createRecordedTransactionScope = createRecordedTransactionScope;
|
|
3240
3142
|
exports.currentReadInstant = currentReadInstant;
|
|
3241
3143
|
exports.currentReadInstantFor = currentReadInstantFor;
|
|
3242
3144
|
exports.dateField = dateField;
|
|
3243
3145
|
exports.edgeInsertDispatch = edgeInsertDispatch;
|
|
3146
|
+
exports.encodeTupleKey = encodeTupleKey;
|
|
3244
3147
|
exports.ensureRevisionOrigin = ensureRevisionOrigin;
|
|
3245
3148
|
exports.exists = exists;
|
|
3246
3149
|
exports.extractFulltextMatchPredicates = extractFulltextMatchPredicates;
|
|
3247
3150
|
exports.extractTemporalOptions = extractTemporalOptions;
|
|
3248
3151
|
exports.extractVectorSimilarityPredicates = extractVectorSimilarityPredicates;
|
|
3249
3152
|
exports.fieldRef = fieldRef;
|
|
3153
|
+
exports.forceRecordedGraphRevision = forceRecordedGraphRevision;
|
|
3250
3154
|
exports.generateId = generateId;
|
|
3251
3155
|
exports.getEdgeRowsByIds = getEdgeRowsByIds;
|
|
3252
3156
|
exports.getFieldPointer = getFieldPointer;
|
|
@@ -3269,7 +3173,6 @@ exports.notInSubquery = notInSubquery;
|
|
|
3269
3173
|
exports.numberField = numberField;
|
|
3270
3174
|
exports.objectField = objectField;
|
|
3271
3175
|
exports.param = param;
|
|
3272
|
-
exports.projectBackendMembers = projectBackendMembers;
|
|
3273
3176
|
exports.readRecordedClock = readRecordedClock;
|
|
3274
3177
|
exports.readRevisionOrigin = readRevisionOrigin;
|
|
3275
3178
|
exports.recordedBindParamBudget = recordedBindParamBudget;
|
|
@@ -3286,5 +3189,5 @@ exports.uncapturedGraphWriteLock = uncapturedGraphWriteLock;
|
|
|
3286
3189
|
exports.withPinnedReadInstant = withPinnedReadInstant;
|
|
3287
3190
|
exports.withRecordedFlushObserver = withRecordedFlushObserver;
|
|
3288
3191
|
exports.withRecordedIdentityMutationTarget = withRecordedIdentityMutationTarget;
|
|
3289
|
-
//# sourceMappingURL=chunk-
|
|
3290
|
-
//# sourceMappingURL=chunk-
|
|
3192
|
+
//# sourceMappingURL=chunk-EZEEWCFJ.cjs.map
|
|
3193
|
+
//# sourceMappingURL=chunk-EZEEWCFJ.cjs.map
|