@nicia-ai/typegraph 0.48.0 → 0.50.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/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 +56 -52
- package/dist/backend/index.d.cts +3 -3
- package/dist/backend/index.d.ts +3 -3
- package/dist/backend/index.js +11 -11
- package/dist/backend/postgres/index.cjs +34 -28
- package/dist/backend/postgres/index.d.cts +7 -7
- package/dist/backend/postgres/index.d.ts +7 -7
- package/dist/backend/postgres/index.js +17 -15
- package/dist/backend/postgres/pglite-store.cjs +36 -35
- 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 +32 -31
- package/dist/backend/postgres/pglite-store.js.map +1 -1
- package/dist/backend/postgres/pglite.cjs +19 -17
- package/dist/backend/postgres/pglite.d.cts +3 -3
- package/dist/backend/postgres/pglite.d.ts +3 -3
- package/dist/backend/postgres/pglite.js +18 -16
- package/dist/backend/sqlite/index.cjs +31 -25
- package/dist/backend/sqlite/index.d.cts +7 -7
- package/dist/backend/sqlite/index.d.ts +7 -7
- package/dist/backend/sqlite/index.js +15 -13
- package/dist/backend/sqlite/libsql.cjs +22 -20
- package/dist/backend/sqlite/libsql.cjs.map +1 -1
- package/dist/backend/sqlite/libsql.d.cts +3 -3
- package/dist/backend/sqlite/libsql.d.ts +3 -3
- package/dist/backend/sqlite/libsql.js +17 -15
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local-store.cjs +37 -36
- 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 +33 -32
- package/dist/backend/sqlite/local-store.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +20 -18
- package/dist/backend/sqlite/local.d.cts +3 -3
- package/dist/backend/sqlite/local.d.ts +3 -3
- package/dist/backend/sqlite/local.js +18 -16
- package/dist/{chunk-AX6JGVTZ.js → chunk-2CYI5HRH.js} +276 -206
- package/dist/chunk-2CYI5HRH.js.map +1 -0
- package/dist/{chunk-KF6K7TGH.js → chunk-2GIV5X4P.js} +702 -422
- package/dist/chunk-2GIV5X4P.js.map +1 -0
- package/dist/{chunk-2TYSSBU5.js → chunk-2Q45FAIE.js} +15 -15
- package/dist/{chunk-2TYSSBU5.js.map → chunk-2Q45FAIE.js.map} +1 -1
- package/dist/{chunk-WODMN3Q2.cjs → chunk-45YZXI6X.cjs} +27 -27
- package/dist/{chunk-WODMN3Q2.cjs.map → chunk-45YZXI6X.cjs.map} +1 -1
- package/dist/{chunk-3DMMGT6S.js → chunk-46UGOVRW.js} +3 -3
- package/dist/{chunk-3DMMGT6S.js.map → chunk-46UGOVRW.js.map} +1 -1
- package/dist/{chunk-GLHXM7C4.js → chunk-5LKOVCPP.js} +60 -23
- package/dist/chunk-5LKOVCPP.js.map +1 -0
- package/dist/{chunk-JFRT7S3B.cjs → chunk-5OWHU7Z7.cjs} +261 -459
- package/dist/chunk-5OWHU7Z7.cjs.map +1 -0
- package/dist/{chunk-7SQSZN2J.js → chunk-5PP4KRPV.js} +5 -5
- package/dist/{chunk-7SQSZN2J.js.map → chunk-5PP4KRPV.js.map} +1 -1
- package/dist/chunk-6KQEICJ6.cjs +12 -0
- package/dist/{chunk-MKJ4KXL5.cjs.map → chunk-6KQEICJ6.cjs.map} +1 -1
- package/dist/{chunk-6SWPJEYN.js → chunk-6LEOAIIB.js} +40 -6
- package/dist/chunk-6LEOAIIB.js.map +1 -0
- package/dist/{chunk-DZAICA5J.js → chunk-6NKSE5AU.js} +4 -4
- package/dist/{chunk-DZAICA5J.js.map → chunk-6NKSE5AU.js.map} +1 -1
- package/dist/{chunk-OVI7IXYX.js → chunk-6S3PTHL4.js} +3 -3
- package/dist/{chunk-OVI7IXYX.js.map → chunk-6S3PTHL4.js.map} +1 -1
- package/dist/{chunk-3FPR224C.cjs → chunk-7CCMCMJO.cjs} +102 -102
- package/dist/{chunk-3FPR224C.cjs.map → chunk-7CCMCMJO.cjs.map} +1 -1
- package/dist/{chunk-SHFBB23Q.js → chunk-7OWE7WD6.js} +6 -4
- package/dist/chunk-7OWE7WD6.js.map +1 -0
- package/dist/chunk-7PRMDZIA.cjs +182 -0
- package/dist/chunk-7PRMDZIA.cjs.map +1 -0
- package/dist/{chunk-CHAOFCHV.js → chunk-AH2A74OZ.js} +3 -3
- package/dist/{chunk-CHAOFCHV.js.map → chunk-AH2A74OZ.js.map} +1 -1
- package/dist/{chunk-OORXGFL5.cjs → chunk-BYBDM423.cjs} +48 -48
- package/dist/{chunk-OORXGFL5.cjs.map → chunk-BYBDM423.cjs.map} +1 -1
- package/dist/{chunk-JB6T4GLL.cjs → chunk-C76WFIVZ.cjs} +808 -519
- package/dist/chunk-C76WFIVZ.cjs.map +1 -0
- package/dist/{chunk-OTUPEF2W.cjs → chunk-CS6JTQQ2.cjs} +328 -257
- package/dist/chunk-CS6JTQQ2.cjs.map +1 -0
- package/dist/{chunk-AOSSQDVO.cjs → chunk-CSNOYIB4.cjs} +13 -13
- package/dist/{chunk-AOSSQDVO.cjs.map → chunk-CSNOYIB4.cjs.map} +1 -1
- package/dist/{chunk-HEV35TGT.js → chunk-DI6VC62F.js} +13 -4
- package/dist/chunk-DI6VC62F.js.map +1 -0
- package/dist/{chunk-2QGYQBS2.cjs → chunk-DWUDZ66O.cjs} +10 -10
- package/dist/{chunk-2QGYQBS2.cjs.map → chunk-DWUDZ66O.cjs.map} +1 -1
- package/dist/{chunk-ZDKTPBGV.js → chunk-EDLKIQRI.js} +4 -4
- package/dist/{chunk-ZDKTPBGV.js.map → chunk-EDLKIQRI.js.map} +1 -1
- package/dist/chunk-EH3JZJUM.cjs +567 -0
- package/dist/chunk-EH3JZJUM.cjs.map +1 -0
- package/dist/{chunk-S5TERQVW.js → chunk-FX5ZW6PN.js} +196 -33
- package/dist/chunk-FX5ZW6PN.js.map +1 -0
- package/dist/{chunk-XVWOYKIK.js → chunk-FZHF5UWR.js} +3 -3
- package/dist/{chunk-XVWOYKIK.js.map → chunk-FZHF5UWR.js.map} +1 -1
- package/dist/{chunk-BFUOME67.cjs → chunk-G2TLHH6T.cjs} +20 -11
- package/dist/chunk-G2TLHH6T.cjs.map +1 -0
- package/dist/{chunk-5PRKMB24.cjs → chunk-GHZPZNFC.cjs} +12 -4
- package/dist/chunk-GHZPZNFC.cjs.map +1 -0
- package/dist/{chunk-ZFMCDJGB.js → chunk-GVYVGGPJ.js} +11 -199
- package/dist/chunk-GVYVGGPJ.js.map +1 -0
- package/dist/{chunk-SDBBMD4N.js → chunk-H3XP6BAV.js} +3 -3
- package/dist/{chunk-SDBBMD4N.js.map → chunk-H3XP6BAV.js.map} +1 -1
- package/dist/{chunk-ROR5ZR6A.cjs → chunk-HSEZ7X6Y.cjs} +45 -45
- package/dist/{chunk-ROR5ZR6A.cjs.map → chunk-HSEZ7X6Y.cjs.map} +1 -1
- package/dist/{chunk-LRQKXRXO.cjs → chunk-HY5BNOUN.cjs} +4 -4
- package/dist/{chunk-LRQKXRXO.cjs.map → chunk-HY5BNOUN.cjs.map} +1 -1
- package/dist/chunk-HZUB5CON.js +27 -0
- package/dist/chunk-HZUB5CON.js.map +1 -0
- package/dist/{chunk-MYKHJI2J.js → chunk-I5C6OTKR.js} +3 -3
- package/dist/{chunk-MYKHJI2J.js.map → chunk-I5C6OTKR.js.map} +1 -1
- package/dist/{chunk-3U5ABFDW.cjs → chunk-IHK5KA2Q.cjs} +31 -28
- package/dist/chunk-IHK5KA2Q.cjs.map +1 -0
- package/dist/{chunk-26YKDNUD.cjs → chunk-IPRP6TDL.cjs} +12 -10
- package/dist/chunk-IPRP6TDL.cjs.map +1 -0
- package/dist/{chunk-UGHG7PGX.js → chunk-IRPYOHRC.js} +26 -4
- package/dist/chunk-IRPYOHRC.js.map +1 -0
- package/dist/{chunk-7XUYFFR4.cjs → chunk-ISKCIQF2.cjs} +20 -20
- package/dist/{chunk-7XUYFFR4.cjs.map → chunk-ISKCIQF2.cjs.map} +1 -1
- package/dist/{chunk-OD4SSY2U.js → chunk-JG5XIJDY.js} +57 -31
- package/dist/chunk-JG5XIJDY.js.map +1 -0
- package/dist/{chunk-2HIYYMWY.cjs → chunk-K2XYLVVB.cjs} +134 -133
- package/dist/chunk-K2XYLVVB.cjs.map +1 -0
- package/dist/{chunk-5K2BKEBD.js → chunk-K46SDNQD.js} +10 -4
- package/dist/chunk-K46SDNQD.js.map +1 -0
- package/dist/{chunk-TZEGUG6D.cjs → chunk-K6VKTBST.cjs} +4 -4
- package/dist/{chunk-TZEGUG6D.cjs.map → chunk-K6VKTBST.cjs.map} +1 -1
- package/dist/chunk-KWNWG4RC.cjs +12 -0
- package/dist/{chunk-CICO5GXD.cjs.map → chunk-KWNWG4RC.cjs.map} +1 -1
- package/dist/{chunk-FQPEMEWX.cjs → chunk-LLVOQOWE.cjs} +80 -32
- package/dist/chunk-LLVOQOWE.cjs.map +1 -0
- package/dist/{chunk-TQHGE7UC.cjs → chunk-M5MSP3BI.cjs} +18 -10
- package/dist/chunk-M5MSP3BI.cjs.map +1 -0
- package/dist/{chunk-ACGSAMD3.js → chunk-MJPZNEJZ.js} +274 -292
- package/dist/chunk-MJPZNEJZ.js.map +1 -0
- package/dist/{chunk-TUNPBZY3.cjs → chunk-MM3JHVKZ.cjs} +4 -4
- package/dist/{chunk-TUNPBZY3.cjs.map → chunk-MM3JHVKZ.cjs.map} +1 -1
- package/dist/{chunk-BRRP76WO.js → chunk-MX7EKQPM.js} +457 -299
- package/dist/chunk-MX7EKQPM.js.map +1 -0
- package/dist/{chunk-2SYZXD54.js → chunk-MZ34E2GN.js} +13 -12
- package/dist/chunk-MZ34E2GN.js.map +1 -0
- package/dist/{chunk-EDN4Y4ZG.cjs → chunk-OJHD3LXJ.cjs} +9 -9
- package/dist/{chunk-EDN4Y4ZG.cjs.map → chunk-OJHD3LXJ.cjs.map} +1 -1
- package/dist/{chunk-DO7SAMEK.cjs → chunk-ON47CBE4.cjs} +47 -47
- package/dist/{chunk-DO7SAMEK.cjs.map → chunk-ON47CBE4.cjs.map} +1 -1
- package/dist/{chunk-6LN7FIVU.js → chunk-PALYTHGM.js} +11 -4
- package/dist/chunk-PALYTHGM.js.map +1 -0
- package/dist/{chunk-YVF2EM7B.js → chunk-R7MRFE5P.js} +3 -3
- package/dist/{chunk-YVF2EM7B.js.map → chunk-R7MRFE5P.js.map} +1 -1
- package/dist/{chunk-EZEEWCFJ.cjs → chunk-RDP6ZRSM.cjs} +435 -265
- package/dist/chunk-RDP6ZRSM.cjs.map +1 -0
- package/dist/{chunk-GYEG3ZLZ.cjs → chunk-RJMHU2MG.cjs} +121 -18
- package/dist/chunk-RJMHU2MG.cjs.map +1 -0
- package/dist/chunk-RWUWTJQY.cjs +30 -0
- package/dist/chunk-RWUWTJQY.cjs.map +1 -0
- package/dist/{chunk-CT3ZKTOF.js → chunk-S33YQEL7.js} +7 -7
- package/dist/{chunk-CT3ZKTOF.js.map → chunk-S33YQEL7.js.map} +1 -1
- package/dist/chunk-S3SDEQMC.js +532 -0
- package/dist/chunk-S3SDEQMC.js.map +1 -0
- package/dist/{chunk-OI2GQ25X.cjs → chunk-SHC7BCG5.cjs} +7 -7
- package/dist/{chunk-OI2GQ25X.cjs.map → chunk-SHC7BCG5.cjs.map} +1 -1
- package/dist/{chunk-L3LQNR34.cjs → chunk-TEC24ZDA.cjs} +161 -161
- package/dist/{chunk-L3LQNR34.cjs.map → chunk-TEC24ZDA.cjs.map} +1 -1
- package/dist/{chunk-HDL2ARHX.cjs → chunk-TP4NJTI3.cjs} +63 -27
- package/dist/chunk-TP4NJTI3.cjs.map +1 -0
- package/dist/{chunk-UMGZDVOA.cjs → chunk-TTCOPKUL.cjs} +124 -124
- package/dist/{chunk-UMGZDVOA.cjs.map → chunk-TTCOPKUL.cjs.map} +1 -1
- package/dist/chunk-TUVD4DFR.cjs +1207 -0
- package/dist/chunk-TUVD4DFR.cjs.map +1 -0
- package/dist/{chunk-PFBRJBUL.cjs → chunk-TYGGUWMS.cjs} +178 -152
- package/dist/chunk-TYGGUWMS.cjs.map +1 -0
- package/dist/{chunk-4WMMBDS5.js → chunk-U3Z7XKAG.js} +7 -7
- package/dist/{chunk-4WMMBDS5.js.map → chunk-U3Z7XKAG.js.map} +1 -1
- package/dist/{chunk-NACVVDWB.js → chunk-U5EL6JUV.js} +10 -10
- package/dist/{chunk-NACVVDWB.js.map → chunk-U5EL6JUV.js.map} +1 -1
- package/dist/{chunk-OMZ37BM2.js → chunk-V76FGHY3.js} +5 -5
- package/dist/{chunk-OMZ37BM2.js.map → chunk-V76FGHY3.js.map} +1 -1
- package/dist/{chunk-6NGW27EO.cjs → chunk-VLBTRXA2.cjs} +10 -10
- package/dist/{chunk-6NGW27EO.cjs.map → chunk-VLBTRXA2.cjs.map} +1 -1
- package/dist/chunk-VTJVMP4I.js +1182 -0
- package/dist/chunk-VTJVMP4I.js.map +1 -0
- package/dist/{chunk-QTD6HX4O.js → chunk-W5SOCUBL.js} +5 -5
- package/dist/{chunk-QTD6HX4O.js.map → chunk-W5SOCUBL.js.map} +1 -1
- package/dist/{chunk-SR725PWF.cjs → chunk-WCLMKNQE.cjs} +1750 -1592
- package/dist/chunk-WCLMKNQE.cjs.map +1 -0
- package/dist/{chunk-TKZXMWQF.cjs → chunk-WK23PGTP.cjs} +13 -13
- package/dist/{chunk-TKZXMWQF.cjs.map → chunk-WK23PGTP.cjs.map} +1 -1
- package/dist/{chunk-KKBDXCLQ.js → chunk-WQBAQZHR.js} +4 -4
- package/dist/{chunk-KKBDXCLQ.js.map → chunk-WQBAQZHR.js.map} +1 -1
- package/dist/{chunk-MRDBBHIZ.cjs → chunk-X4GDXBOP.cjs} +2 -2
- package/dist/chunk-X4GDXBOP.cjs.map +1 -0
- package/dist/{chunk-WCCATHMB.cjs → chunk-XMY2SXOH.cjs} +438 -456
- package/dist/chunk-XMY2SXOH.cjs.map +1 -0
- package/dist/{chunk-D5R42W5D.js → chunk-XZW2CTNO.js} +115 -12
- package/dist/chunk-XZW2CTNO.js.map +1 -0
- package/dist/{chunk-NVY5CJFP.js → chunk-Y55DLLEG.js} +9 -6
- package/dist/chunk-Y55DLLEG.js.map +1 -0
- package/dist/chunk-YA36ABIL.js +174 -0
- package/dist/chunk-YA36ABIL.js.map +1 -0
- package/dist/{chunk-ZLONH2UD.js → chunk-YDEJQWOL.js} +2 -2
- package/dist/chunk-YDEJQWOL.js.map +1 -0
- package/dist/{chunk-JONXFAPO.js → chunk-ZAQUKCUC.js} +5 -5
- package/dist/{chunk-JONXFAPO.js.map → chunk-ZAQUKCUC.js.map} +1 -1
- package/dist/{chunk-SIT26LAZ.cjs → chunk-ZBFZGLZE.cjs} +29 -5
- package/dist/chunk-ZBFZGLZE.cjs.map +1 -0
- package/dist/{chunk-P6YLZTRE.js → chunk-ZRJTM7MT.js} +3 -3
- package/dist/{chunk-P6YLZTRE.js.map → chunk-ZRJTM7MT.js.map} +1 -1
- package/dist/core/index.cjs +29 -28
- package/dist/core/index.d.cts +4 -4
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +9 -8
- package/dist/{ddl-D_oW-EVO.d.ts → ddl-B49O7dB_.d.ts} +3 -3
- package/dist/{ddl-BL1NZLMY.d.cts → ddl-DcZG660s.d.cts} +3 -3
- package/dist/graph-extension/index.cjs +21 -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 +5 -4
- package/dist/graph-merge/index.cjs +327 -302
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +14 -11
- package/dist/graph-merge/index.d.ts +14 -11
- package/dist/graph-merge/index.js +52 -27
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-D7d1u2gr.d.ts → index-B0PrmE3K.d.cts} +16 -2
- package/dist/{index-COs_z6nV.d.cts → index-CwcXsL5R.d.ts} +16 -2
- package/dist/index.cjs +223 -222
- 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 +37 -36
- 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/ingestion-import-target-CI8OWIkM.d.ts +17 -0
- package/dist/ingestion-import-target-DCpfM1PX.d.cts +17 -0
- package/dist/interchange/index.cjs +55 -54
- package/dist/interchange/index.cjs.map +1 -1
- package/dist/interchange/index.d.cts +26 -12
- package/dist/interchange/index.d.ts +26 -12
- package/dist/interchange/index.js +19 -18
- package/dist/interchange/index.js.map +1 -1
- package/dist/{manager-D9eRT_ns.d.ts → manager-Cfg1ENj1.d.ts} +30 -2
- package/dist/{manager-CYaff3n3.d.cts → manager-D348fa6W.d.cts} +30 -2
- package/dist/{materialize-indexes-DJ3ykH59.d.ts → materialize-indexes-C9GG3O3C.d.ts} +1 -1
- package/dist/{materialize-indexes-DTtAnvfY.d.cts → materialize-indexes-CrSiW_lT.d.cts} +1 -1
- package/dist/{postgres-DMj39MEu.d.cts → postgres-CH1kkM5J.d.cts} +279 -2
- package/dist/{postgres-CcL4bAHS.d.ts → postgres-UStOycLI.d.ts} +279 -2
- package/dist/profiler/index.d.cts +9 -9
- package/dist/profiler/index.d.ts +9 -9
- package/dist/provenance/index.cjs +46 -44
- package/dist/provenance/index.cjs.map +1 -1
- package/dist/provenance/index.d.cts +7 -7
- package/dist/provenance/index.d.ts +7 -7
- package/dist/provenance/index.js +12 -10
- package/dist/provenance/index.js.map +1 -1
- package/dist/{repair-validity-windows-DlUSqwCg.d.ts → repair-validity-windows-BtOEe2pS.d.ts} +2 -2
- package/dist/{repair-validity-windows-BFNZvd_H.d.cts → repair-validity-windows-aWX7VNvv.d.cts} +2 -2
- package/dist/schema/index.cjs +46 -46
- package/dist/schema/index.d.cts +6 -6
- package/dist/schema/index.d.ts +6 -6
- package/dist/schema/index.js +19 -19
- package/dist/{searchable-DHJMh_nj.d.cts → searchable-C8-RrL3l.d.cts} +1 -1
- package/dist/{searchable-bpE1bBfc.d.ts → searchable-z4BiFfHI.d.ts} +1 -1
- package/dist/{sqlite-D7Oz0SQh.d.ts → sqlite-Cyx9j9o6.d.cts} +309 -2
- package/dist/{sqlite-YppHrNFb.d.cts → sqlite-axLw5Lo5.d.ts} +309 -2
- package/dist/{store-JUVvtmR4.d.cts → store-CTfQ9taw.d.ts} +110 -13
- package/dist/{store-UzrGvZOo.d.ts → store-DR9J7JVB.d.cts} +110 -13
- package/dist/{temporal-5GqpYCk2.d.cts → temporal-B4Ky4wzh.d.cts} +1 -1
- package/dist/{temporal-CbnLzTmM.d.ts → temporal-CBOrERz5.d.ts} +1 -1
- package/dist/{types-CXAhpW-c.d.cts → types-BE921wRl.d.cts} +1 -1
- package/dist/{types-Bx74kaTt.d.ts → types-BScHXVM7.d.ts} +1 -1
- package/dist/{types-BqFZTQmV.d.cts → types-CWg4dTjj.d.cts} +257 -6
- package/dist/{types-BqFZTQmV.d.ts → types-CWg4dTjj.d.ts} +257 -6
- package/dist/{where-O-k2wgYm.d.ts → where-BWXUPV3C.d.ts} +1 -1
- package/dist/{where-DI_Fqz-X.d.cts → where-CNtx1aLc.d.cts} +1 -1
- package/package.json +4 -4
- package/dist/chunk-26YKDNUD.cjs.map +0 -1
- package/dist/chunk-2HIYYMWY.cjs.map +0 -1
- package/dist/chunk-2SYZXD54.js.map +0 -1
- package/dist/chunk-3KOY4FH3.cjs +0 -934
- package/dist/chunk-3KOY4FH3.cjs.map +0 -1
- package/dist/chunk-3U5ABFDW.cjs.map +0 -1
- package/dist/chunk-5K2BKEBD.js.map +0 -1
- package/dist/chunk-5PRKMB24.cjs.map +0 -1
- package/dist/chunk-6LN7FIVU.js.map +0 -1
- package/dist/chunk-6SWPJEYN.js.map +0 -1
- package/dist/chunk-ACGSAMD3.js.map +0 -1
- package/dist/chunk-AX6JGVTZ.js.map +0 -1
- package/dist/chunk-BFUOME67.cjs.map +0 -1
- package/dist/chunk-BRRP76WO.js.map +0 -1
- package/dist/chunk-CICO5GXD.cjs +0 -12
- package/dist/chunk-D5R42W5D.js.map +0 -1
- package/dist/chunk-EZEEWCFJ.cjs.map +0 -1
- package/dist/chunk-FA2AFWLP.cjs +0 -167
- package/dist/chunk-FA2AFWLP.cjs.map +0 -1
- package/dist/chunk-FQPEMEWX.cjs.map +0 -1
- package/dist/chunk-GLHXM7C4.js.map +0 -1
- package/dist/chunk-GYEG3ZLZ.cjs.map +0 -1
- package/dist/chunk-HDL2ARHX.cjs.map +0 -1
- package/dist/chunk-HEV35TGT.js.map +0 -1
- package/dist/chunk-I4GAZH5Z.js +0 -913
- package/dist/chunk-I4GAZH5Z.js.map +0 -1
- package/dist/chunk-JB6T4GLL.cjs.map +0 -1
- package/dist/chunk-JBQQ7THH.js +0 -20
- package/dist/chunk-JBQQ7THH.js.map +0 -1
- package/dist/chunk-JFRT7S3B.cjs.map +0 -1
- package/dist/chunk-KF6K7TGH.js.map +0 -1
- package/dist/chunk-MKJ4KXL5.cjs +0 -12
- package/dist/chunk-MRDBBHIZ.cjs.map +0 -1
- package/dist/chunk-NVY5CJFP.js.map +0 -1
- package/dist/chunk-OD4SSY2U.js.map +0 -1
- package/dist/chunk-OTUPEF2W.cjs.map +0 -1
- package/dist/chunk-PFBRJBUL.cjs.map +0 -1
- package/dist/chunk-PWLJ77UV.cjs +0 -23
- package/dist/chunk-PWLJ77UV.cjs.map +0 -1
- package/dist/chunk-S5TERQVW.js.map +0 -1
- package/dist/chunk-SHFBB23Q.js.map +0 -1
- package/dist/chunk-SIT26LAZ.cjs.map +0 -1
- package/dist/chunk-SR725PWF.cjs.map +0 -1
- package/dist/chunk-TQHGE7UC.cjs.map +0 -1
- package/dist/chunk-UGHG7PGX.js.map +0 -1
- package/dist/chunk-WCCATHMB.cjs.map +0 -1
- package/dist/chunk-YIURNGXI.js +0 -155
- package/dist/chunk-YIURNGXI.js.map +0 -1
- package/dist/chunk-ZFMCDJGB.js.map +0 -1
- package/dist/chunk-ZLONH2UD.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
3
|
+
var chunkZBFZGLZE_cjs = require('./chunk-ZBFZGLZE.cjs');
|
|
4
|
+
var chunkIHK5KA2Q_cjs = require('./chunk-IHK5KA2Q.cjs');
|
|
5
|
+
var chunkGHZPZNFC_cjs = require('./chunk-GHZPZNFC.cjs');
|
|
6
|
+
var chunkDWUDZ66O_cjs = require('./chunk-DWUDZ66O.cjs');
|
|
7
|
+
var chunkM5MSP3BI_cjs = require('./chunk-M5MSP3BI.cjs');
|
|
8
|
+
var chunkOJHD3LXJ_cjs = require('./chunk-OJHD3LXJ.cjs');
|
|
9
9
|
var chunkRT5ZY4XA_cjs = require('./chunk-RT5ZY4XA.cjs');
|
|
10
|
-
var
|
|
10
|
+
var chunkX4GDXBOP_cjs = require('./chunk-X4GDXBOP.cjs');
|
|
11
11
|
var chunkA7J2YDDI_cjs = require('./chunk-A7J2YDDI.cjs');
|
|
12
12
|
var chunkN66HCGCY_cjs = require('./chunk-N66HCGCY.cjs');
|
|
13
13
|
var nanoid = require('nanoid');
|
|
@@ -16,7 +16,7 @@ var nanoid = require('nanoid');
|
|
|
16
16
|
var pinnedReadInstant;
|
|
17
17
|
function withPinnedReadInstant(emit) {
|
|
18
18
|
if (pinnedReadInstant !== void 0) return emit();
|
|
19
|
-
pinnedReadInstant =
|
|
19
|
+
pinnedReadInstant = chunkM5MSP3BI_cjs.nowIso();
|
|
20
20
|
try {
|
|
21
21
|
return emit();
|
|
22
22
|
} finally {
|
|
@@ -24,27 +24,27 @@ function withPinnedReadInstant(emit) {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
function currentReadInstant() {
|
|
27
|
-
return
|
|
27
|
+
return chunkOJHD3LXJ_cjs.sql`${pinnedReadInstant ?? chunkM5MSP3BI_cjs.nowIso()}`;
|
|
28
28
|
}
|
|
29
29
|
var CURRENT_READ_INSTANT_PLACEHOLDER = "__typegraph_current_read_instant__";
|
|
30
30
|
function currentReadInstantPlaceholder() {
|
|
31
|
-
return
|
|
31
|
+
return chunkOJHD3LXJ_cjs.sql`${chunkOJHD3LXJ_cjs.sql.placeholder(CURRENT_READ_INSTANT_PLACEHOLDER)}`;
|
|
32
32
|
}
|
|
33
33
|
function currentReadInstantFor(mode) {
|
|
34
34
|
return mode === "placeholder" ? currentReadInstantPlaceholder() : currentReadInstant();
|
|
35
35
|
}
|
|
36
36
|
function compileTemporalFilter(options) {
|
|
37
37
|
const { mode, asOf, tableAlias, currentTimestamp, recordedAsOf } = options;
|
|
38
|
-
const recorded =
|
|
39
|
-
const prefix = tableAlias ?
|
|
40
|
-
const deletedAt =
|
|
41
|
-
const validFrom =
|
|
42
|
-
const validTo =
|
|
38
|
+
const recorded = chunkDWUDZ66O_cjs.optionalRecordedInstantParts(recordedAsOf, "recordedAsOf");
|
|
39
|
+
const prefix = tableAlias ? chunkOJHD3LXJ_cjs.sql.raw(`${tableAlias}.`) : chunkOJHD3LXJ_cjs.sql.raw("");
|
|
40
|
+
const deletedAt = chunkOJHD3LXJ_cjs.sql`${prefix}deleted_at`;
|
|
41
|
+
const validFrom = chunkOJHD3LXJ_cjs.sql`${prefix}valid_from`;
|
|
42
|
+
const validTo = chunkOJHD3LXJ_cjs.sql`${prefix}valid_to`;
|
|
43
43
|
const validFilter = (() => {
|
|
44
44
|
switch (mode) {
|
|
45
45
|
case "current": {
|
|
46
|
-
const now = recorded === void 0 ? currentTimestamp ?? currentReadInstant() :
|
|
47
|
-
return
|
|
46
|
+
const now = recorded === void 0 ? currentTimestamp ?? currentReadInstant() : chunkOJHD3LXJ_cjs.sql`${recorded.recordedAt}`;
|
|
47
|
+
return chunkOJHD3LXJ_cjs.sql`${deletedAt} IS NULL AND (${validFrom} IS NULL OR ${validFrom} <= ${now}) AND (${validTo} IS NULL OR ${validTo} > ${now})`;
|
|
48
48
|
}
|
|
49
49
|
case "asOf": {
|
|
50
50
|
if (asOf === void 0) {
|
|
@@ -53,21 +53,21 @@ function compileTemporalFilter(options) {
|
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
55
|
const timestamp = asOf;
|
|
56
|
-
return
|
|
56
|
+
return chunkOJHD3LXJ_cjs.sql`${deletedAt} IS NULL AND (${validFrom} IS NULL OR ${validFrom} <= ${timestamp}) AND (${validTo} IS NULL OR ${validTo} > ${timestamp})`;
|
|
57
57
|
}
|
|
58
58
|
case "includeEnded": {
|
|
59
|
-
return
|
|
59
|
+
return chunkOJHD3LXJ_cjs.sql`${deletedAt} IS NULL`;
|
|
60
60
|
}
|
|
61
61
|
case "includeTombstones": {
|
|
62
|
-
return
|
|
62
|
+
return chunkOJHD3LXJ_cjs.sql.raw("1=1");
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
})();
|
|
66
66
|
if (recorded === void 0) return validFilter;
|
|
67
|
-
const recordedFrom =
|
|
68
|
-
const recordedTo =
|
|
67
|
+
const recordedFrom = chunkOJHD3LXJ_cjs.sql`${prefix}recorded_from`;
|
|
68
|
+
const recordedTo = chunkOJHD3LXJ_cjs.sql`${prefix}recorded_to`;
|
|
69
69
|
const { revision } = recorded;
|
|
70
|
-
return
|
|
70
|
+
return chunkOJHD3LXJ_cjs.sql`(${validFilter}) AND ${recordedFrom} <= ${revision} AND ${revision} < ${recordedTo}`;
|
|
71
71
|
}
|
|
72
72
|
function extractTemporalOptions(ast, tableAlias) {
|
|
73
73
|
return {
|
|
@@ -155,7 +155,7 @@ function predicate(expr) {
|
|
|
155
155
|
}
|
|
156
156
|
function param(name) {
|
|
157
157
|
if (name === CURRENT_READ_INSTANT_PLACEHOLDER) {
|
|
158
|
-
throw new
|
|
158
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
159
159
|
`Parameter name "${name}" is reserved for internal use`,
|
|
160
160
|
{ parameterName: name }
|
|
161
161
|
);
|
|
@@ -239,7 +239,7 @@ function inComparison(op, field, values) {
|
|
|
239
239
|
}
|
|
240
240
|
const literals = values.map((value) => {
|
|
241
241
|
if (isParameterRef(value)) {
|
|
242
|
-
throw new
|
|
242
|
+
throw new chunkX4GDXBOP_cjs.UnsupportedPredicateError(
|
|
243
243
|
`param("${value.name}") is not supported as an element of the ${op}() list`,
|
|
244
244
|
{ parameterName: value.name },
|
|
245
245
|
{
|
|
@@ -321,7 +321,7 @@ function createFulltextAccessor(alias, hasSearchableField) {
|
|
|
321
321
|
return {
|
|
322
322
|
matches: (query, k, options) => {
|
|
323
323
|
if (!hasSearchableField()) {
|
|
324
|
-
throw new
|
|
324
|
+
throw new chunkX4GDXBOP_cjs.UnsupportedPredicateError(
|
|
325
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" })\`.`
|
|
326
326
|
);
|
|
327
327
|
}
|
|
@@ -336,7 +336,7 @@ function createFulltextAccessor(alias, hasSearchableField) {
|
|
|
336
336
|
}
|
|
337
337
|
function fulltextMatch(field, query, limit, options) {
|
|
338
338
|
if (!Number.isFinite(limit) || limit <= 0) {
|
|
339
|
-
throw new
|
|
339
|
+
throw new chunkX4GDXBOP_cjs.UnsupportedPredicateError(
|
|
340
340
|
`matches() limit must be a positive finite number, got ${String(limit)}`
|
|
341
341
|
);
|
|
342
342
|
}
|
|
@@ -609,7 +609,7 @@ function notInSubquery(field, subquery) {
|
|
|
609
609
|
function assertSingleColumnSubquery(subquery) {
|
|
610
610
|
const columnCount = getSubqueryColumnCount(subquery);
|
|
611
611
|
if (columnCount === 1) return;
|
|
612
|
-
throw new
|
|
612
|
+
throw new chunkX4GDXBOP_cjs.UnsupportedPredicateError(
|
|
613
613
|
`IN/NOT IN subquery must project exactly 1 column, but got ${columnCount}`,
|
|
614
614
|
{ subqueryColumnCount: columnCount },
|
|
615
615
|
{
|
|
@@ -622,7 +622,7 @@ function assertCompatibleSubqueryValueTypes(field, subquery) {
|
|
|
622
622
|
const subqueryValueType = getSingleSubqueryColumnValueType(subquery);
|
|
623
623
|
const resolvedValueType = fieldValueType ?? subqueryValueType;
|
|
624
624
|
if (isUnsupportedInSubqueryValueType(resolvedValueType)) {
|
|
625
|
-
throw new
|
|
625
|
+
throw new chunkX4GDXBOP_cjs.UnsupportedPredicateError(
|
|
626
626
|
`IN/NOT IN subquery does not support ${String(resolvedValueType)} values`,
|
|
627
627
|
{ valueType: resolvedValueType },
|
|
628
628
|
{
|
|
@@ -633,7 +633,7 @@ function assertCompatibleSubqueryValueTypes(field, subquery) {
|
|
|
633
633
|
if (isInSubqueryTypeCompatible(fieldValueType, subqueryValueType)) {
|
|
634
634
|
return;
|
|
635
635
|
}
|
|
636
|
-
throw new
|
|
636
|
+
throw new chunkX4GDXBOP_cjs.UnsupportedPredicateError(
|
|
637
637
|
`IN/NOT IN type mismatch: field type "${String(fieldValueType)}" does not match subquery column type "${String(subqueryValueType)}"`,
|
|
638
638
|
{
|
|
639
639
|
fieldValueType,
|
|
@@ -652,7 +652,7 @@ var RECORDED_ISOLATION_REQUIRES_POSTGRES_CHECK = {
|
|
|
652
652
|
};
|
|
653
653
|
function requireRecordedSchema(target) {
|
|
654
654
|
if (target.tableNames === void 0) {
|
|
655
|
-
throw new
|
|
655
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
656
656
|
"Recorded-time capture requires the backend to expose tableNames.",
|
|
657
657
|
{ dialect: target.dialect },
|
|
658
658
|
{
|
|
@@ -660,11 +660,11 @@ function requireRecordedSchema(target) {
|
|
|
660
660
|
}
|
|
661
661
|
);
|
|
662
662
|
}
|
|
663
|
-
return
|
|
663
|
+
return chunkIHK5KA2Q_cjs.createSqlSchema(target.tableNames);
|
|
664
664
|
}
|
|
665
665
|
function requireCaptureStatements(target) {
|
|
666
666
|
if (target.executeStatement === void 0) {
|
|
667
|
-
throw new
|
|
667
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
668
668
|
"Recorded-time capture requires backend.executeStatement support on the transaction backend.",
|
|
669
669
|
{ dialect: target.dialect },
|
|
670
670
|
{
|
|
@@ -675,10 +675,10 @@ function requireCaptureStatements(target) {
|
|
|
675
675
|
}
|
|
676
676
|
async function executeStatement(target, query) {
|
|
677
677
|
requireCaptureStatements(target);
|
|
678
|
-
await target.executeStatement(
|
|
678
|
+
await target.executeStatement(chunkOJHD3LXJ_cjs.asCompiledStatementSql(query));
|
|
679
679
|
}
|
|
680
680
|
function unsupportedPostgresIsolationError(isolationLevel) {
|
|
681
|
-
return new
|
|
681
|
+
return new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
682
682
|
"Recorded-time capture on PostgreSQL requires read_committed isolation.",
|
|
683
683
|
{ isolationLevel: isolationLevel ?? "unknown" },
|
|
684
684
|
{
|
|
@@ -704,7 +704,7 @@ async function assertRecordedCaptureTransactionIsolation(target, options) {
|
|
|
704
704
|
if (!RECORDED_ISOLATION_REQUIRES_POSTGRES_CHECK[target.dialect]) return;
|
|
705
705
|
if (options?.accessMode === "read_only") return;
|
|
706
706
|
const rows = await target.execute(
|
|
707
|
-
|
|
707
|
+
chunkOJHD3LXJ_cjs.asCompiledRowsSql(chunkOJHD3LXJ_cjs.sql`
|
|
708
708
|
SELECT current_setting('transaction_isolation') AS transaction_isolation
|
|
709
709
|
`)
|
|
710
710
|
);
|
|
@@ -715,7 +715,7 @@ async function assertRecordedCaptureTransactionIsolation(target, options) {
|
|
|
715
715
|
throw unsupportedPostgresIsolationError(isolationLevel);
|
|
716
716
|
}
|
|
717
717
|
function recordedCaptureRequiresCallbackTransactionError(details = {}) {
|
|
718
|
-
return new
|
|
718
|
+
return new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
719
719
|
"withTransaction() has no recorded-time capture flush point when history is enabled.",
|
|
720
720
|
{
|
|
721
721
|
...details,
|
|
@@ -727,7 +727,7 @@ function recordedCaptureRequiresCallbackTransactionError(details = {}) {
|
|
|
727
727
|
);
|
|
728
728
|
}
|
|
729
729
|
function historyUnsafeRawWriteError(surface) {
|
|
730
|
-
return new
|
|
730
|
+
return new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
731
731
|
`${surface} is not available when history capture is enabled because raw SQL writes bypass recorded-time capture.`,
|
|
732
732
|
{
|
|
733
733
|
code: "RECORDED_CAPTURE_RAW_SQL_DISABLED"
|
|
@@ -738,7 +738,7 @@ function historyUnsafeRawWriteError(surface) {
|
|
|
738
738
|
);
|
|
739
739
|
}
|
|
740
740
|
function revisionTrackingUnsafeRawWriteError(surface) {
|
|
741
|
-
return new
|
|
741
|
+
return new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
742
742
|
`${surface} is not available when revision tracking is enabled because raw SQL writes bypass the revision anchor.`,
|
|
743
743
|
{
|
|
744
744
|
code: "REVISION_TRACKING_RAW_SQL_DISABLED"
|
|
@@ -774,7 +774,7 @@ function rawWriteGuards(target, prefix) {
|
|
|
774
774
|
}
|
|
775
775
|
function assertCapturableBackend(backend) {
|
|
776
776
|
if (!backend.capabilities.transactions) {
|
|
777
|
-
throw new
|
|
777
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
778
778
|
"history: true requires a backend with transaction support.",
|
|
779
779
|
{ dialect: backend.dialect },
|
|
780
780
|
{
|
|
@@ -783,7 +783,7 @@ function assertCapturableBackend(backend) {
|
|
|
783
783
|
);
|
|
784
784
|
}
|
|
785
785
|
if (backend.executeStatement === void 0) {
|
|
786
|
-
throw new
|
|
786
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
787
787
|
"history: true requires a backend that supports executeStatement.",
|
|
788
788
|
{ dialect: backend.dialect },
|
|
789
789
|
{
|
|
@@ -792,7 +792,7 @@ function assertCapturableBackend(backend) {
|
|
|
792
792
|
);
|
|
793
793
|
}
|
|
794
794
|
if (backend.capabilities.returning === false) {
|
|
795
|
-
throw new
|
|
795
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
796
796
|
"history: true requires a backend that supports UPDATE \u2026 RETURNING.",
|
|
797
797
|
{ dialect: backend.dialect },
|
|
798
798
|
{
|
|
@@ -801,7 +801,7 @@ function assertCapturableBackend(backend) {
|
|
|
801
801
|
);
|
|
802
802
|
}
|
|
803
803
|
if (backend.tableNames === void 0) {
|
|
804
|
-
throw new
|
|
804
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
805
805
|
"history: true requires a backend that exposes tableNames.",
|
|
806
806
|
{ dialect: backend.dialect },
|
|
807
807
|
{
|
|
@@ -812,7 +812,7 @@ function assertCapturableBackend(backend) {
|
|
|
812
812
|
}
|
|
813
813
|
function assertRevisionTrackableBackend(backend) {
|
|
814
814
|
if (!backend.capabilities.transactions) {
|
|
815
|
-
throw new
|
|
815
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
816
816
|
"revisionTracking: true requires a backend with transaction support.",
|
|
817
817
|
{ dialect: backend.dialect },
|
|
818
818
|
{
|
|
@@ -821,7 +821,7 @@ function assertRevisionTrackableBackend(backend) {
|
|
|
821
821
|
);
|
|
822
822
|
}
|
|
823
823
|
if (backend.executeStatement === void 0) {
|
|
824
|
-
throw new
|
|
824
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
825
825
|
"revisionTracking: true requires a backend that supports executeStatement.",
|
|
826
826
|
{ dialect: backend.dialect },
|
|
827
827
|
{
|
|
@@ -830,7 +830,7 @@ function assertRevisionTrackableBackend(backend) {
|
|
|
830
830
|
);
|
|
831
831
|
}
|
|
832
832
|
if (backend.tableNames === void 0) {
|
|
833
|
-
throw new
|
|
833
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
834
834
|
"revisionTracking: true requires a backend that exposes tableNames.",
|
|
835
835
|
{ dialect: backend.dialect },
|
|
836
836
|
{
|
|
@@ -839,7 +839,7 @@ function assertRevisionTrackableBackend(backend) {
|
|
|
839
839
|
);
|
|
840
840
|
}
|
|
841
841
|
if (backend.ensureRevisionOriginsTable === void 0) {
|
|
842
|
-
throw new
|
|
842
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
843
843
|
"revisionTracking: true requires a backend that can bootstrap revision origins.",
|
|
844
844
|
{ dialect: backend.dialect },
|
|
845
845
|
{
|
|
@@ -859,7 +859,7 @@ var USES_RECORDED_GRAPH_ADVISORY_LOCK = {
|
|
|
859
859
|
sqlite: false
|
|
860
860
|
};
|
|
861
861
|
function graphAdvisoryLockSql(namespace, graphId) {
|
|
862
|
-
return
|
|
862
|
+
return chunkOJHD3LXJ_cjs.sql`
|
|
863
863
|
SELECT pg_advisory_xact_lock(
|
|
864
864
|
hashtext(${namespace}),
|
|
865
865
|
hashtext(${graphId})
|
|
@@ -891,7 +891,7 @@ function registerRecordedGraphLockMemo(backend, memo) {
|
|
|
891
891
|
}
|
|
892
892
|
async function acquireRecordedGraphWriteLock(target, graphId) {
|
|
893
893
|
await target.execute(
|
|
894
|
-
|
|
894
|
+
chunkOJHD3LXJ_cjs.asCompiledRowsSql(recordedGraphWriteAdvisoryLockSql(graphId))
|
|
895
895
|
);
|
|
896
896
|
}
|
|
897
897
|
async function lockRecordedGraphWrite(target, graphId, memo) {
|
|
@@ -917,7 +917,7 @@ async function lockRecordedGraphWrite(target, graphId, memo) {
|
|
|
917
917
|
return graphWriteLockEvidence();
|
|
918
918
|
}
|
|
919
919
|
function failInvalidClock(value, cause) {
|
|
920
|
-
throw new
|
|
920
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
921
921
|
"Recorded clock row contained an invalid revision or wall time",
|
|
922
922
|
{ value },
|
|
923
923
|
{
|
|
@@ -928,13 +928,13 @@ function failInvalidClock(value, cause) {
|
|
|
928
928
|
}
|
|
929
929
|
function recordedClockRevision(value) {
|
|
930
930
|
const revision = typeof value === "bigint" ? Number(value) : typeof value === "string" && /^\d+$/.test(value) ? Number(value) : value;
|
|
931
|
-
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 >= chunkDWUDZ66O_cjs.RECORDED_MAX_REVISION) {
|
|
932
932
|
return failInvalidClock(value);
|
|
933
933
|
}
|
|
934
934
|
return revision;
|
|
935
935
|
}
|
|
936
936
|
function recordedClockWallTime(value) {
|
|
937
|
-
return
|
|
937
|
+
return chunkM5MSP3BI_cjs.canonicalizeDatabaseTimestamp(value) ?? failInvalidClock(value);
|
|
938
938
|
}
|
|
939
939
|
function recordedClockParts(row) {
|
|
940
940
|
const revision = recordedClockRevision(row.revision);
|
|
@@ -942,7 +942,7 @@ function recordedClockParts(row) {
|
|
|
942
942
|
return { revision, recordedAt: recordedClockWallTime(row.recorded_at) };
|
|
943
943
|
}
|
|
944
944
|
function nextRecordedCommitParts(previous) {
|
|
945
|
-
const wallTime =
|
|
945
|
+
const wallTime = chunkM5MSP3BI_cjs.nowIso();
|
|
946
946
|
if (previous === void 0) {
|
|
947
947
|
return { revision: 1, recordedAt: wallTime };
|
|
948
948
|
}
|
|
@@ -960,11 +960,11 @@ function nonDecreasingWallTime(current, previous) {
|
|
|
960
960
|
}
|
|
961
961
|
async function readRecordedClock(target, schema, graphId) {
|
|
962
962
|
const parts = await readRecordedClockParts(target, schema, graphId);
|
|
963
|
-
return parts === void 0 ? void 0 :
|
|
963
|
+
return parts === void 0 ? void 0 : chunkDWUDZ66O_cjs.createRecordedInstant(parts.revision, parts.recordedAt);
|
|
964
964
|
}
|
|
965
965
|
async function readRecordedClockParts(target, schema, graphId) {
|
|
966
966
|
const rows = await target.execute(
|
|
967
|
-
|
|
967
|
+
chunkOJHD3LXJ_cjs.asCompiledRowsSql(chunkOJHD3LXJ_cjs.sql`
|
|
968
968
|
SELECT revision, recorded_at
|
|
969
969
|
FROM ${schema.recordedClockTable}
|
|
970
970
|
WHERE graph_id = ${graphId}
|
|
@@ -975,7 +975,7 @@ async function readRecordedClockParts(target, schema, graphId) {
|
|
|
975
975
|
}
|
|
976
976
|
async function readRevisionOrigin(target, schema, graphId) {
|
|
977
977
|
const rows = await target.execute(
|
|
978
|
-
|
|
978
|
+
chunkOJHD3LXJ_cjs.asCompiledRowsSql(chunkOJHD3LXJ_cjs.sql`
|
|
979
979
|
SELECT origin
|
|
980
980
|
FROM ${schema.revisionOriginsTable}
|
|
981
981
|
WHERE graph_id = ${graphId}
|
|
@@ -984,7 +984,7 @@ async function readRevisionOrigin(target, schema, graphId) {
|
|
|
984
984
|
const first = rows[0];
|
|
985
985
|
if (first === void 0) return void 0;
|
|
986
986
|
if (typeof first.origin !== "string" || first.origin.length === 0) {
|
|
987
|
-
throw new
|
|
987
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
988
988
|
"Revision origin row contained an invalid origin",
|
|
989
989
|
{ graphId, origin: first.origin }
|
|
990
990
|
);
|
|
@@ -994,7 +994,7 @@ async function readRevisionOrigin(target, schema, graphId) {
|
|
|
994
994
|
async function ensureRevisionOrigin(target, schema, graphId) {
|
|
995
995
|
const ensureTable = target.ensureRevisionOriginsTable;
|
|
996
996
|
if (ensureTable === void 0) {
|
|
997
|
-
throw new
|
|
997
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
998
998
|
"Revision tracking requires a backend that can bootstrap revision origins.",
|
|
999
999
|
{ dialect: target.dialect },
|
|
1000
1000
|
{
|
|
@@ -1007,7 +1007,7 @@ async function ensureRevisionOrigin(target, schema, graphId) {
|
|
|
1007
1007
|
if (existing !== void 0) return existing;
|
|
1008
1008
|
await executeStatement(
|
|
1009
1009
|
target,
|
|
1010
|
-
|
|
1010
|
+
chunkOJHD3LXJ_cjs.sql`
|
|
1011
1011
|
INSERT INTO ${schema.revisionOriginsTable} (graph_id, origin)
|
|
1012
1012
|
VALUES (${graphId}, ${generateId()})
|
|
1013
1013
|
ON CONFLICT (graph_id) DO NOTHING
|
|
@@ -1015,7 +1015,7 @@ async function ensureRevisionOrigin(target, schema, graphId) {
|
|
|
1015
1015
|
);
|
|
1016
1016
|
const origin = await readRevisionOrigin(target, schema, graphId);
|
|
1017
1017
|
if (origin !== void 0) return origin;
|
|
1018
|
-
throw new
|
|
1018
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
1019
1019
|
"Revision origin was not persisted after initialization.",
|
|
1020
1020
|
{ graphId, dialect: target.dialect }
|
|
1021
1021
|
);
|
|
@@ -1023,7 +1023,7 @@ async function ensureRevisionOrigin(target, schema, graphId) {
|
|
|
1023
1023
|
async function writeRecordedClock(target, schema, graphId, parts) {
|
|
1024
1024
|
await executeStatement(
|
|
1025
1025
|
target,
|
|
1026
|
-
|
|
1026
|
+
chunkOJHD3LXJ_cjs.sql`
|
|
1027
1027
|
INSERT INTO ${schema.recordedClockTable} (graph_id, revision, recorded_at)
|
|
1028
1028
|
VALUES (${graphId}, ${parts.revision}, ${parts.recordedAt})
|
|
1029
1029
|
ON CONFLICT (graph_id) DO UPDATE
|
|
@@ -1035,7 +1035,7 @@ async function writeRecordedClock(target, schema, graphId, parts) {
|
|
|
1035
1035
|
async function assertRecordedClockAdvanced(target, schema, graphId, revision) {
|
|
1036
1036
|
const stored = await readRecordedClockParts(target, schema, graphId);
|
|
1037
1037
|
if (stored?.revision === revision) return;
|
|
1038
|
-
throw new
|
|
1038
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
1039
1039
|
"Recorded commit allocation was refused: the supplied previous revision was stale, so the write would have moved the graph's revision clock backward.",
|
|
1040
1040
|
{ graphId, allocatedRevision: revision, storedRevision: stored?.revision },
|
|
1041
1041
|
{
|
|
@@ -1047,7 +1047,7 @@ async function lockRecordedClock(target, schema, graphId, ownsWriteLock) {
|
|
|
1047
1047
|
switch (target.dialect) {
|
|
1048
1048
|
case "postgres": {
|
|
1049
1049
|
await target.execute(
|
|
1050
|
-
|
|
1050
|
+
chunkOJHD3LXJ_cjs.asCompiledRowsSql(recordedClockAdvisoryLockSql(graphId))
|
|
1051
1051
|
);
|
|
1052
1052
|
return;
|
|
1053
1053
|
}
|
|
@@ -1055,7 +1055,7 @@ async function lockRecordedClock(target, schema, graphId, ownsWriteLock) {
|
|
|
1055
1055
|
if (ownsWriteLock) return;
|
|
1056
1056
|
await executeStatement(
|
|
1057
1057
|
target,
|
|
1058
|
-
|
|
1058
|
+
chunkOJHD3LXJ_cjs.sql`
|
|
1059
1059
|
INSERT INTO ${schema.recordedClockTable} (graph_id, revision, recorded_at)
|
|
1060
1060
|
VALUES (${graphId}, ${RECORDED_MIN_REVISION}, ${RECORDED_MIN_TIME})
|
|
1061
1061
|
ON CONFLICT (graph_id) DO UPDATE SET revision = revision
|
|
@@ -1070,18 +1070,18 @@ async function lockRecordedClock(target, schema, graphId, ownsWriteLock) {
|
|
|
1070
1070
|
}
|
|
1071
1071
|
async function allocateRecordedCommit(target, schema, graphId, ownsWriteLock, previousRevision) {
|
|
1072
1072
|
await lockRecordedClock(target, schema, graphId, ownsWriteLock);
|
|
1073
|
-
const previous = previousRevision === void 0 ? await readRecordedClockParts(target, schema, graphId) :
|
|
1073
|
+
const previous = previousRevision === void 0 ? await readRecordedClockParts(target, schema, graphId) : chunkDWUDZ66O_cjs.parseRecordedInstant(previousRevision, "previous recorded revision");
|
|
1074
1074
|
const { revision, recordedAt } = nextRecordedCommitParts(previous);
|
|
1075
|
-
if (revision >=
|
|
1076
|
-
throw new
|
|
1077
|
-
`Recorded commit clock reached the open revision sentinel ${
|
|
1075
|
+
if (revision >= chunkDWUDZ66O_cjs.RECORDED_MAX_REVISION) {
|
|
1076
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
1077
|
+
`Recorded commit clock reached the open revision sentinel ${chunkDWUDZ66O_cjs.RECORDED_MAX_REVISION}`,
|
|
1078
1078
|
{ graphId, revision },
|
|
1079
1079
|
{
|
|
1080
1080
|
suggestion: "Start a new graph before exhausting the per-graph recorded revision space."
|
|
1081
1081
|
}
|
|
1082
1082
|
);
|
|
1083
1083
|
}
|
|
1084
|
-
const instant =
|
|
1084
|
+
const instant = chunkDWUDZ66O_cjs.createRecordedInstant(revision, recordedAt);
|
|
1085
1085
|
await writeRecordedClock(target, schema, graphId, { revision, recordedAt });
|
|
1086
1086
|
if (previousRevision !== void 0) {
|
|
1087
1087
|
await assertRecordedClockAdvanced(target, schema, graphId, revision);
|
|
@@ -1146,7 +1146,7 @@ async function runInsertBatchReturning(dispatch, params) {
|
|
|
1146
1146
|
}
|
|
1147
1147
|
|
|
1148
1148
|
// src/identity/historical-sql.ts
|
|
1149
|
-
var IDENTITY_ASSERTION_COLUMNS =
|
|
1149
|
+
var IDENTITY_ASSERTION_COLUMNS = chunkOJHD3LXJ_cjs.sql.raw(
|
|
1150
1150
|
[
|
|
1151
1151
|
"graph_id",
|
|
1152
1152
|
"id",
|
|
@@ -1168,35 +1168,35 @@ function identitySqlCoordinate(coordinate, currentInstant) {
|
|
|
1168
1168
|
return {
|
|
1169
1169
|
validMode: coordinate?.valid.mode ?? "current",
|
|
1170
1170
|
validAsOf: coordinate?.valid.asOf,
|
|
1171
|
-
recorded:
|
|
1171
|
+
recorded: chunkDWUDZ66O_cjs.optionalRecordedInstantParts(
|
|
1172
1172
|
coordinate?.recorded?.asOf,
|
|
1173
1173
|
"recorded.asOf"
|
|
1174
1174
|
),
|
|
1175
|
-
currentInstant: typeof currentInstant === "string" ?
|
|
1175
|
+
currentInstant: typeof currentInstant === "string" ? chunkOJHD3LXJ_cjs.sql`${currentInstant}` : currentInstant
|
|
1176
1176
|
};
|
|
1177
1177
|
}
|
|
1178
1178
|
function validityInstant(coordinate) {
|
|
1179
1179
|
if (coordinate.validMode === "asOf" && coordinate.validAsOf !== void 0) {
|
|
1180
|
-
return
|
|
1180
|
+
return chunkOJHD3LXJ_cjs.sql`${coordinate.validAsOf}`;
|
|
1181
1181
|
}
|
|
1182
1182
|
if (coordinate.recorded !== void 0) {
|
|
1183
|
-
return
|
|
1183
|
+
return chunkOJHD3LXJ_cjs.sql`${coordinate.recorded.recordedAt}`;
|
|
1184
1184
|
}
|
|
1185
1185
|
return coordinate.currentInstant;
|
|
1186
1186
|
}
|
|
1187
1187
|
function qualifiedColumn(alias, column) {
|
|
1188
|
-
return
|
|
1188
|
+
return chunkOJHD3LXJ_cjs.sql`${chunkOJHD3LXJ_cjs.sql.identifier(alias)}.${chunkOJHD3LXJ_cjs.sql.identifier(column)}`;
|
|
1189
1189
|
}
|
|
1190
1190
|
function identityNodeVisibilitySql(coordinate, alias) {
|
|
1191
1191
|
const deletedAt = qualifiedColumn(alias, "deleted_at");
|
|
1192
|
-
if (coordinate.validMode === "includeTombstones") return
|
|
1192
|
+
if (coordinate.validMode === "includeTombstones") return chunkOJHD3LXJ_cjs.sql`1 = 1`;
|
|
1193
1193
|
if (coordinate.validMode === "includeEnded") {
|
|
1194
|
-
return
|
|
1194
|
+
return chunkOJHD3LXJ_cjs.sql`${deletedAt} IS NULL`;
|
|
1195
1195
|
}
|
|
1196
1196
|
const validFrom = qualifiedColumn(alias, "valid_from");
|
|
1197
1197
|
const validTo = qualifiedColumn(alias, "valid_to");
|
|
1198
1198
|
const instant = validityInstant(coordinate);
|
|
1199
|
-
return
|
|
1199
|
+
return chunkOJHD3LXJ_cjs.sql`
|
|
1200
1200
|
${deletedAt} IS NULL
|
|
1201
1201
|
AND (${validFrom} IS NULL OR ${validFrom} <= ${instant})
|
|
1202
1202
|
AND (${validTo} IS NULL OR ${validTo} > ${instant})
|
|
@@ -1204,19 +1204,19 @@ function identityNodeVisibilitySql(coordinate, alias) {
|
|
|
1204
1204
|
}
|
|
1205
1205
|
function structuralFoldVisibilitySql(coordinate, alias) {
|
|
1206
1206
|
const deletedAt = qualifiedColumn(alias, "deleted_at");
|
|
1207
|
-
if (coordinate.recorded !== void 0) return
|
|
1208
|
-
if (coordinate.validMode !== "asOf") return
|
|
1207
|
+
if (coordinate.recorded !== void 0) return chunkOJHD3LXJ_cjs.sql`${deletedAt} IS NULL`;
|
|
1208
|
+
if (coordinate.validMode !== "asOf") return chunkOJHD3LXJ_cjs.sql`${deletedAt} IS NULL`;
|
|
1209
1209
|
const createdAt = qualifiedColumn(alias, "created_at");
|
|
1210
1210
|
const instant = validityInstant(coordinate);
|
|
1211
|
-
return
|
|
1211
|
+
return chunkOJHD3LXJ_cjs.sql`${createdAt} <= ${instant} AND (${deletedAt} IS NULL OR ${deletedAt} > ${instant})`;
|
|
1212
1212
|
}
|
|
1213
1213
|
function identityNodeSnapshotSource(schema, graphId, coordinate) {
|
|
1214
1214
|
const table = coordinate.recorded === void 0 ? schema.nodesTable : schema.recordedNodesTable;
|
|
1215
|
-
const recordedFilter = coordinate.recorded === void 0 ?
|
|
1215
|
+
const recordedFilter = coordinate.recorded === void 0 ? chunkOJHD3LXJ_cjs.sql`` : chunkOJHD3LXJ_cjs.sql`
|
|
1216
1216
|
AND recorded_from <= ${coordinate.recorded.revision}
|
|
1217
1217
|
AND recorded_to > ${coordinate.recorded.revision}
|
|
1218
1218
|
`;
|
|
1219
|
-
return
|
|
1219
|
+
return chunkOJHD3LXJ_cjs.sql`
|
|
1220
1220
|
SELECT kind, id, valid_from, valid_to, created_at, deleted_at
|
|
1221
1221
|
FROM ${table}
|
|
1222
1222
|
WHERE graph_id = ${graphId}
|
|
@@ -1225,13 +1225,13 @@ function identityNodeSnapshotSource(schema, graphId, coordinate) {
|
|
|
1225
1225
|
}
|
|
1226
1226
|
function identityAssertionSnapshotSource(schema, graphId, coordinate, relation) {
|
|
1227
1227
|
const table = coordinate.recorded === void 0 ? schema.identityAssertionsTable : schema.recordedIdentityAssertionsTable;
|
|
1228
|
-
const recordedFilter = coordinate.recorded === void 0 ?
|
|
1228
|
+
const recordedFilter = coordinate.recorded === void 0 ? chunkOJHD3LXJ_cjs.sql`` : chunkOJHD3LXJ_cjs.sql`
|
|
1229
1229
|
AND recorded_from <= ${coordinate.recorded.revision}
|
|
1230
1230
|
AND recorded_to > ${coordinate.recorded.revision}
|
|
1231
1231
|
`;
|
|
1232
|
-
const relationFilter = relation === void 0 ?
|
|
1232
|
+
const relationFilter = relation === void 0 ? chunkOJHD3LXJ_cjs.sql`` : chunkOJHD3LXJ_cjs.sql`AND rel = ${relation}`;
|
|
1233
1233
|
const instant = validityInstant(coordinate);
|
|
1234
|
-
return
|
|
1234
|
+
return chunkOJHD3LXJ_cjs.sql`
|
|
1235
1235
|
SELECT ${IDENTITY_ASSERTION_COLUMNS}
|
|
1236
1236
|
FROM ${table}
|
|
1237
1237
|
WHERE graph_id = ${graphId}
|
|
@@ -1254,7 +1254,7 @@ function historicalIdentityReconstructionCtes(input) {
|
|
|
1254
1254
|
input.coordinate,
|
|
1255
1255
|
"same"
|
|
1256
1256
|
);
|
|
1257
|
-
const sameIdEdges = input.sameIdAcrossKinds === "fold" ?
|
|
1257
|
+
const sameIdEdges = input.sameIdAcrossKinds === "fold" ? chunkOJHD3LXJ_cjs.sql`
|
|
1258
1258
|
UNION ALL
|
|
1259
1259
|
SELECT left_node.kind, left_node.id, right_node.kind, right_node.id
|
|
1260
1260
|
FROM node_snapshot left_node
|
|
@@ -1263,8 +1263,8 @@ function historicalIdentityReconstructionCtes(input) {
|
|
|
1263
1263
|
AND right_node.kind <> left_node.kind
|
|
1264
1264
|
WHERE ${structuralFoldVisibilitySql(input.coordinate, "left_node")}
|
|
1265
1265
|
AND ${structuralFoldVisibilitySql(input.coordinate, "right_node")}
|
|
1266
|
-
` :
|
|
1267
|
-
return
|
|
1266
|
+
` : chunkOJHD3LXJ_cjs.sql``;
|
|
1267
|
+
return chunkOJHD3LXJ_cjs.sql`
|
|
1268
1268
|
node_snapshot(kind, id, valid_from, valid_to, created_at, deleted_at) AS (
|
|
1269
1269
|
${nodes}
|
|
1270
1270
|
),
|
|
@@ -1295,15 +1295,15 @@ function historicalIdentityReconstructionCtes(input) {
|
|
|
1295
1295
|
)
|
|
1296
1296
|
`;
|
|
1297
1297
|
}
|
|
1298
|
-
var IDENTITY_PEER_CLASS_COLUMNS =
|
|
1298
|
+
var IDENTITY_PEER_CLASS_COLUMNS = chunkOJHD3LXJ_cjs.sql.raw(
|
|
1299
1299
|
["seed_kind", "seed_id", "kind", "id"].join(", ")
|
|
1300
1300
|
);
|
|
1301
1301
|
function historicalIdentityPeerClassQuery(input) {
|
|
1302
1302
|
const reconstruction = historicalIdentityReconstructionCtes({
|
|
1303
1303
|
...input,
|
|
1304
|
-
seedSource:
|
|
1304
|
+
seedSource: chunkOJHD3LXJ_cjs.sql`SELECT DISTINCT a_kind, a_id FROM identity_edges`
|
|
1305
1305
|
});
|
|
1306
|
-
return
|
|
1306
|
+
return chunkOJHD3LXJ_cjs.sql`
|
|
1307
1307
|
WITH RECURSIVE
|
|
1308
1308
|
${reconstruction}
|
|
1309
1309
|
SELECT member.seed_kind, member.seed_id, member.kind, member.id
|
|
@@ -1326,28 +1326,28 @@ function compileFieldColumn(field, cteAlias, cteColumnPrefix) {
|
|
|
1326
1326
|
if (cteColumnPrefix !== void 0) {
|
|
1327
1327
|
const qualifier2 = cteColumnPrefix === "" ? "" : `${cteColumnPrefix}.`;
|
|
1328
1328
|
if (field.path.length === 1 && field.path[0] === "id") {
|
|
1329
|
-
return
|
|
1329
|
+
return chunkOJHD3LXJ_cjs.sql.raw(`${qualifier2}id`);
|
|
1330
1330
|
}
|
|
1331
1331
|
if (field.path.length === 1 && field.path[0] === "kind") {
|
|
1332
|
-
return
|
|
1332
|
+
return chunkOJHD3LXJ_cjs.sql.raw(`${qualifier2}kind`);
|
|
1333
1333
|
}
|
|
1334
1334
|
if (field.path.length > 0 && field.path[0] === "props") {
|
|
1335
|
-
return
|
|
1335
|
+
return chunkOJHD3LXJ_cjs.sql.raw(`${qualifier2}props`);
|
|
1336
1336
|
}
|
|
1337
|
-
return
|
|
1337
|
+
return chunkOJHD3LXJ_cjs.sql.raw(`${qualifier2}${field.path.join("_")}`);
|
|
1338
1338
|
}
|
|
1339
1339
|
const prefix = field.alias;
|
|
1340
1340
|
const qualifier = cteAlias ? `${cteAlias}.` : "";
|
|
1341
1341
|
if (field.path.length === 1 && field.path[0] === "id") {
|
|
1342
|
-
return
|
|
1342
|
+
return chunkOJHD3LXJ_cjs.sql.raw(`${qualifier}${prefix}_id`);
|
|
1343
1343
|
}
|
|
1344
1344
|
if (field.path.length === 1 && field.path[0] === "kind") {
|
|
1345
|
-
return
|
|
1345
|
+
return chunkOJHD3LXJ_cjs.sql.raw(`${qualifier}${prefix}_kind`);
|
|
1346
1346
|
}
|
|
1347
1347
|
if (field.path.length > 0 && field.path[0] === "props") {
|
|
1348
|
-
return
|
|
1348
|
+
return chunkOJHD3LXJ_cjs.sql.raw(`${qualifier}${prefix}_props`);
|
|
1349
1349
|
}
|
|
1350
|
-
return
|
|
1350
|
+
return chunkOJHD3LXJ_cjs.sql.raw(`${qualifier}${prefix}_${field.path.join("_")}`);
|
|
1351
1351
|
}
|
|
1352
1352
|
function getFieldPointer(field) {
|
|
1353
1353
|
if (field.jsonPointer !== void 0) {
|
|
@@ -1433,7 +1433,7 @@ function resolveLiteralValueTypes(literals) {
|
|
|
1433
1433
|
}
|
|
1434
1434
|
}
|
|
1435
1435
|
if (resolved.size > 1) {
|
|
1436
|
-
throw new
|
|
1436
|
+
throw new chunkX4GDXBOP_cjs.UnsupportedPredicateError(
|
|
1437
1437
|
"Mixed literal value types are not supported in predicates",
|
|
1438
1438
|
{ valueTypes: [...resolved] }
|
|
1439
1439
|
);
|
|
@@ -1467,9 +1467,9 @@ function convertValueForSql(value, dialect) {
|
|
|
1467
1467
|
}
|
|
1468
1468
|
function compileStringPattern(op, pattern) {
|
|
1469
1469
|
const escaped = pattern.replaceAll(
|
|
1470
|
-
|
|
1471
|
-
`${
|
|
1472
|
-
).replaceAll("%", `${
|
|
1470
|
+
chunkOJHD3LXJ_cjs.LIKE_ESCAPE_CHARACTER,
|
|
1471
|
+
`${chunkOJHD3LXJ_cjs.LIKE_ESCAPE_CHARACTER}${chunkOJHD3LXJ_cjs.LIKE_ESCAPE_CHARACTER}`
|
|
1472
|
+
).replaceAll("%", `${chunkOJHD3LXJ_cjs.LIKE_ESCAPE_CHARACTER}%`).replaceAll("_", `${chunkOJHD3LXJ_cjs.LIKE_ESCAPE_CHARACTER}_`);
|
|
1473
1473
|
switch (op) {
|
|
1474
1474
|
case "contains": {
|
|
1475
1475
|
return `%${escaped}%`;
|
|
@@ -1490,22 +1490,22 @@ function compileStringPattern(op, pattern) {
|
|
|
1490
1490
|
}
|
|
1491
1491
|
}
|
|
1492
1492
|
function escapeLikePatternParameter(parameter) {
|
|
1493
|
-
const doubledEscape = `${
|
|
1494
|
-
return
|
|
1493
|
+
const doubledEscape = `${chunkOJHD3LXJ_cjs.LIKE_ESCAPE_CHARACTER}${chunkOJHD3LXJ_cjs.LIKE_ESCAPE_CHARACTER}`;
|
|
1494
|
+
return chunkOJHD3LXJ_cjs.sql`REPLACE(REPLACE(REPLACE(${parameter}, ${chunkOJHD3LXJ_cjs.LIKE_ESCAPE_CHARACTER}, ${doubledEscape}), '%', ${`${chunkOJHD3LXJ_cjs.LIKE_ESCAPE_CHARACTER}%`}), '_', ${`${chunkOJHD3LXJ_cjs.LIKE_ESCAPE_CHARACTER}_`})`;
|
|
1495
1495
|
}
|
|
1496
1496
|
function compileParameterizedStringPattern(op, parameter) {
|
|
1497
1497
|
switch (op) {
|
|
1498
1498
|
case "contains": {
|
|
1499
1499
|
const escaped = escapeLikePatternParameter(parameter);
|
|
1500
|
-
return
|
|
1500
|
+
return chunkOJHD3LXJ_cjs.sql`'%' || ${escaped} || '%'`;
|
|
1501
1501
|
}
|
|
1502
1502
|
case "startsWith": {
|
|
1503
1503
|
const escaped = escapeLikePatternParameter(parameter);
|
|
1504
|
-
return
|
|
1504
|
+
return chunkOJHD3LXJ_cjs.sql`${escaped} || '%'`;
|
|
1505
1505
|
}
|
|
1506
1506
|
case "endsWith": {
|
|
1507
1507
|
const escaped = escapeLikePatternParameter(parameter);
|
|
1508
|
-
return
|
|
1508
|
+
return chunkOJHD3LXJ_cjs.sql`'%' || ${escaped}`;
|
|
1509
1509
|
}
|
|
1510
1510
|
case "like":
|
|
1511
1511
|
case "ilike": {
|
|
@@ -1532,18 +1532,18 @@ function compilePredicateExpression(expr, ctx) {
|
|
|
1532
1532
|
cteColumnPrefix
|
|
1533
1533
|
);
|
|
1534
1534
|
if (isParameterRef(expr.pattern)) {
|
|
1535
|
-
const placeholder =
|
|
1535
|
+
const placeholder = chunkOJHD3LXJ_cjs.sql`${chunkOJHD3LXJ_cjs.sql.placeholder(expr.pattern.name)}`;
|
|
1536
1536
|
const pattern2 = compileParameterizedStringPattern(expr.op, placeholder);
|
|
1537
1537
|
if (expr.op === "ilike" || expr.op === "contains" || expr.op === "startsWith" || expr.op === "endsWith") {
|
|
1538
1538
|
return dialect.ilike(field, pattern2);
|
|
1539
1539
|
}
|
|
1540
|
-
return
|
|
1540
|
+
return chunkOJHD3LXJ_cjs.sql`${field} LIKE ${pattern2} ${chunkOJHD3LXJ_cjs.likeEscapeClause}`;
|
|
1541
1541
|
}
|
|
1542
1542
|
const pattern = compileStringPattern(expr.op, expr.pattern);
|
|
1543
1543
|
if (expr.op === "ilike" || expr.op === "contains" || expr.op === "startsWith" || expr.op === "endsWith") {
|
|
1544
1544
|
return dialect.ilike(field, pattern);
|
|
1545
1545
|
}
|
|
1546
|
-
return
|
|
1546
|
+
return chunkOJHD3LXJ_cjs.sql`${field} LIKE ${pattern} ${chunkOJHD3LXJ_cjs.likeEscapeClause}`;
|
|
1547
1547
|
}
|
|
1548
1548
|
case "null_check": {
|
|
1549
1549
|
const field = compileFieldTextValue(
|
|
@@ -1553,7 +1553,7 @@ function compilePredicateExpression(expr, ctx) {
|
|
|
1553
1553
|
void 0,
|
|
1554
1554
|
cteColumnPrefix
|
|
1555
1555
|
);
|
|
1556
|
-
return expr.op === "isNull" ?
|
|
1556
|
+
return expr.op === "isNull" ? chunkOJHD3LXJ_cjs.sql`${field} IS NULL` : chunkOJHD3LXJ_cjs.sql`${field} IS NOT NULL`;
|
|
1557
1557
|
}
|
|
1558
1558
|
case "between": {
|
|
1559
1559
|
const lowerIsParam = isParameterRef(expr.lower);
|
|
@@ -1563,7 +1563,7 @@ function compilePredicateExpression(expr, ctx) {
|
|
|
1563
1563
|
if (!upperIsParam) boundsForType.push(expr.upper);
|
|
1564
1564
|
const valueType = boundsForType.length > 0 ? resolveComparisonValueType(expr.field, boundsForType) : normalizeValueType2(expr.field.valueType);
|
|
1565
1565
|
if (valueType === "array" || valueType === "object") {
|
|
1566
|
-
throw new
|
|
1566
|
+
throw new chunkX4GDXBOP_cjs.UnsupportedPredicateError(
|
|
1567
1567
|
"Between comparisons are not supported for JSON arrays or objects"
|
|
1568
1568
|
);
|
|
1569
1569
|
}
|
|
@@ -1575,25 +1575,25 @@ function compilePredicateExpression(expr, ctx) {
|
|
|
1575
1575
|
void 0,
|
|
1576
1576
|
cteColumnPrefix
|
|
1577
1577
|
);
|
|
1578
|
-
const lower = lowerIsParam ?
|
|
1579
|
-
const upper = upperIsParam ?
|
|
1580
|
-
return
|
|
1578
|
+
const lower = lowerIsParam ? chunkOJHD3LXJ_cjs.sql.placeholder(expr.lower.name) : convertValueForSql(expr.lower.value, dialect);
|
|
1579
|
+
const upper = upperIsParam ? chunkOJHD3LXJ_cjs.sql.placeholder(expr.upper.name) : convertValueForSql(expr.upper.value, dialect);
|
|
1580
|
+
return chunkOJHD3LXJ_cjs.sql`${field} BETWEEN ${lower} AND ${upper}`;
|
|
1581
1581
|
}
|
|
1582
1582
|
case "and": {
|
|
1583
1583
|
const parts = expr.predicates.map(
|
|
1584
1584
|
(p) => compilePredicateExpression(p, ctx)
|
|
1585
1585
|
);
|
|
1586
|
-
return
|
|
1586
|
+
return chunkOJHD3LXJ_cjs.sql`(${chunkOJHD3LXJ_cjs.sql.join(parts, chunkOJHD3LXJ_cjs.sql` AND `)})`;
|
|
1587
1587
|
}
|
|
1588
1588
|
case "or": {
|
|
1589
1589
|
const parts = expr.predicates.map(
|
|
1590
1590
|
(p) => compilePredicateExpression(p, ctx)
|
|
1591
1591
|
);
|
|
1592
|
-
return
|
|
1592
|
+
return chunkOJHD3LXJ_cjs.sql`(${chunkOJHD3LXJ_cjs.sql.join(parts, chunkOJHD3LXJ_cjs.sql` OR `)})`;
|
|
1593
1593
|
}
|
|
1594
1594
|
case "not": {
|
|
1595
1595
|
const inner = compilePredicateExpression(expr.predicate, ctx);
|
|
1596
|
-
return
|
|
1596
|
+
return chunkOJHD3LXJ_cjs.sql`NOT (${inner})`;
|
|
1597
1597
|
}
|
|
1598
1598
|
case "array_op": {
|
|
1599
1599
|
return compileArrayPredicate(expr, dialect, cteColumnPrefix);
|
|
@@ -1616,7 +1616,7 @@ function compilePredicateExpression(expr, ctx) {
|
|
|
1616
1616
|
}
|
|
1617
1617
|
}
|
|
1618
1618
|
}
|
|
1619
|
-
var STRUCTURAL_PREDICATE_NOOP =
|
|
1619
|
+
var STRUCTURAL_PREDICATE_NOOP = chunkOJHD3LXJ_cjs.sql.raw("1=1");
|
|
1620
1620
|
function compileComparisonPredicate(expr, dialect, cteColumnPrefix) {
|
|
1621
1621
|
if (isParameterRef(expr.right)) {
|
|
1622
1622
|
const parameterValueType = resolveParameterValueType(expr.left, expr.right);
|
|
@@ -1639,15 +1639,15 @@ function compileComparisonPredicate(expr, dialect, cteColumnPrefix) {
|
|
|
1639
1639
|
}
|
|
1640
1640
|
const opSql2 = COMPARISON_OP_SQL[expr.op];
|
|
1641
1641
|
if (!opSql2) {
|
|
1642
|
-
throw new
|
|
1642
|
+
throw new chunkX4GDXBOP_cjs.UnsupportedPredicateError(
|
|
1643
1643
|
`Comparison operation "${expr.op}" is not supported for parameterized predicates`
|
|
1644
1644
|
);
|
|
1645
1645
|
}
|
|
1646
|
-
return
|
|
1646
|
+
return chunkOJHD3LXJ_cjs.sql`${left2} ${chunkOJHD3LXJ_cjs.sql.raw(opSql2)} ${chunkOJHD3LXJ_cjs.sql.placeholder(expr.right.name)}`;
|
|
1647
1647
|
}
|
|
1648
1648
|
const valueType = resolveComparisonValueType(expr.left, expr.right);
|
|
1649
1649
|
if (valueType === "array" || valueType === "object") {
|
|
1650
|
-
throw new
|
|
1650
|
+
throw new chunkX4GDXBOP_cjs.UnsupportedPredicateError(
|
|
1651
1651
|
`Comparison operation "${expr.op}" is not supported for ${valueType} values`
|
|
1652
1652
|
);
|
|
1653
1653
|
}
|
|
@@ -1662,7 +1662,7 @@ function compileComparisonPredicate(expr, dialect, cteColumnPrefix) {
|
|
|
1662
1662
|
if (expr.op === "in" || expr.op === "notIn") {
|
|
1663
1663
|
const values = Array.isArray(expr.right) ? expr.right : [expr.right];
|
|
1664
1664
|
if (values.length === 0) {
|
|
1665
|
-
return expr.op === "in" ?
|
|
1665
|
+
return expr.op === "in" ? chunkOJHD3LXJ_cjs.sql.raw("1=0") : chunkOJHD3LXJ_cjs.sql.raw("1=1");
|
|
1666
1666
|
}
|
|
1667
1667
|
const convertedValues = values.map(
|
|
1668
1668
|
(value) => convertValueForSql(value.value, dialect)
|
|
@@ -1674,15 +1674,15 @@ function compileComparisonPredicate(expr, dialect, cteColumnPrefix) {
|
|
|
1674
1674
|
const convertedRight = convertValueForSql(rightValue.value, dialect);
|
|
1675
1675
|
const opSql = COMPARISON_OP_SQL[expr.op];
|
|
1676
1676
|
if (!opSql) {
|
|
1677
|
-
throw new
|
|
1677
|
+
throw new chunkX4GDXBOP_cjs.UnsupportedPredicateError(
|
|
1678
1678
|
`Comparison operation "${expr.op}" is not supported`
|
|
1679
1679
|
);
|
|
1680
1680
|
}
|
|
1681
|
-
return
|
|
1681
|
+
return chunkOJHD3LXJ_cjs.sql`${left} ${chunkOJHD3LXJ_cjs.sql.raw(opSql)} ${convertedRight}`;
|
|
1682
1682
|
}
|
|
1683
1683
|
function compileListParameterPredicate(left, parameterName, elementType, negated, dialect) {
|
|
1684
1684
|
if (elementType === "array" || elementType === "object" || elementType === "embedding") {
|
|
1685
|
-
throw new
|
|
1685
|
+
throw new chunkX4GDXBOP_cjs.UnsupportedPredicateError(
|
|
1686
1686
|
`IN/NOT IN is not supported for ${elementType} values`,
|
|
1687
1687
|
{ valueType: elementType },
|
|
1688
1688
|
{
|
|
@@ -1690,7 +1690,7 @@ function compileListParameterPredicate(left, parameterName, elementType, negated
|
|
|
1690
1690
|
}
|
|
1691
1691
|
);
|
|
1692
1692
|
}
|
|
1693
|
-
return dialect.inListParameter(left,
|
|
1693
|
+
return dialect.inListParameter(left, chunkOJHD3LXJ_cjs.sql.placeholder(parameterName), {
|
|
1694
1694
|
negated,
|
|
1695
1695
|
elementType
|
|
1696
1696
|
});
|
|
@@ -1706,30 +1706,30 @@ function compileArrayPredicate(expr, dialect, cteColumnPrefix) {
|
|
|
1706
1706
|
const values = expr.values?.map((v) => convertValueForSql(v.value, dialect)) ?? [];
|
|
1707
1707
|
switch (expr.op) {
|
|
1708
1708
|
case "isEmpty": {
|
|
1709
|
-
return
|
|
1709
|
+
return chunkOJHD3LXJ_cjs.sql`(${field} IS NULL OR ${dialect.jsonArrayLength(field)} = 0)`;
|
|
1710
1710
|
}
|
|
1711
1711
|
case "isNotEmpty": {
|
|
1712
|
-
return
|
|
1712
|
+
return chunkOJHD3LXJ_cjs.sql`(${field} IS NOT NULL AND ${dialect.jsonArrayLength(field)} > 0)`;
|
|
1713
1713
|
}
|
|
1714
1714
|
case "lengthEq": {
|
|
1715
|
-
return
|
|
1715
|
+
return chunkOJHD3LXJ_cjs.sql`${dialect.jsonArrayLength(field)} = ${expr.length}`;
|
|
1716
1716
|
}
|
|
1717
1717
|
case "lengthGt": {
|
|
1718
|
-
return
|
|
1718
|
+
return chunkOJHD3LXJ_cjs.sql`${dialect.jsonArrayLength(field)} > ${expr.length}`;
|
|
1719
1719
|
}
|
|
1720
1720
|
case "lengthGte": {
|
|
1721
|
-
return
|
|
1721
|
+
return chunkOJHD3LXJ_cjs.sql`${dialect.jsonArrayLength(field)} >= ${expr.length}`;
|
|
1722
1722
|
}
|
|
1723
1723
|
case "lengthLt": {
|
|
1724
|
-
return
|
|
1724
|
+
return chunkOJHD3LXJ_cjs.sql`${dialect.jsonArrayLength(field)} < ${expr.length}`;
|
|
1725
1725
|
}
|
|
1726
1726
|
case "lengthLte": {
|
|
1727
|
-
return
|
|
1727
|
+
return chunkOJHD3LXJ_cjs.sql`${dialect.jsonArrayLength(field)} <= ${expr.length}`;
|
|
1728
1728
|
}
|
|
1729
1729
|
case "contains": {
|
|
1730
1730
|
const value = values[0];
|
|
1731
1731
|
if (value === void 0) {
|
|
1732
|
-
return
|
|
1732
|
+
return chunkOJHD3LXJ_cjs.sql.raw("1=0");
|
|
1733
1733
|
}
|
|
1734
1734
|
return dialect.jsonArrayContains(field, value);
|
|
1735
1735
|
}
|
|
@@ -1752,13 +1752,13 @@ function compileObjectPredicate(expr, dialect, cteColumnPrefix) {
|
|
|
1752
1752
|
}
|
|
1753
1753
|
case "pathEquals": {
|
|
1754
1754
|
if (!expr.value) {
|
|
1755
|
-
throw new
|
|
1755
|
+
throw new chunkX4GDXBOP_cjs.UnsupportedPredicateError(
|
|
1756
1756
|
"pathEquals requires a comparison value"
|
|
1757
1757
|
);
|
|
1758
1758
|
}
|
|
1759
1759
|
const valueType = resolvePredicateValueType(expr.valueType, expr.value);
|
|
1760
1760
|
if (valueType === "array" || valueType === "object") {
|
|
1761
|
-
throw new
|
|
1761
|
+
throw new chunkX4GDXBOP_cjs.UnsupportedPredicateError(
|
|
1762
1762
|
"pathEquals is not supported for JSON arrays or objects"
|
|
1763
1763
|
);
|
|
1764
1764
|
}
|
|
@@ -1770,11 +1770,11 @@ function compileObjectPredicate(expr, dialect, cteColumnPrefix) {
|
|
|
1770
1770
|
pointer,
|
|
1771
1771
|
cteColumnPrefix
|
|
1772
1772
|
);
|
|
1773
|
-
return
|
|
1773
|
+
return chunkOJHD3LXJ_cjs.sql`${left} = ${convertValueForSql(expr.value.value, dialect)}`;
|
|
1774
1774
|
}
|
|
1775
1775
|
case "pathContains": {
|
|
1776
1776
|
if (!expr.value) {
|
|
1777
|
-
throw new
|
|
1777
|
+
throw new chunkX4GDXBOP_cjs.UnsupportedPredicateError(
|
|
1778
1778
|
"pathContains requires a comparison value"
|
|
1779
1779
|
);
|
|
1780
1780
|
}
|
|
@@ -1802,12 +1802,12 @@ function compileAggregatePredicate(expr, dialect) {
|
|
|
1802
1802
|
const aggregate = compileAggregateExpr(expr.aggregate, dialect);
|
|
1803
1803
|
const op = COMPARISON_OP_SQL[expr.op];
|
|
1804
1804
|
if (!op) {
|
|
1805
|
-
throw new
|
|
1805
|
+
throw new chunkX4GDXBOP_cjs.UnsupportedPredicateError(
|
|
1806
1806
|
`Comparison operation "${expr.op}" is not supported for aggregate predicates`
|
|
1807
1807
|
);
|
|
1808
1808
|
}
|
|
1809
1809
|
const convertedValue = convertValueForSql(expr.value.value, dialect);
|
|
1810
|
-
return
|
|
1810
|
+
return chunkOJHD3LXJ_cjs.sql`${aggregate} ${chunkOJHD3LXJ_cjs.sql.raw(op)} ${convertedValue}`;
|
|
1811
1811
|
}
|
|
1812
1812
|
function compileAggregateExpr(expr, dialect) {
|
|
1813
1813
|
const cteAlias = `cte_${expr.field.alias}`;
|
|
@@ -1819,25 +1819,25 @@ function compileAggregateExpr(expr, dialect) {
|
|
|
1819
1819
|
);
|
|
1820
1820
|
switch (expr.function) {
|
|
1821
1821
|
case "count": {
|
|
1822
|
-
return
|
|
1822
|
+
return chunkOJHD3LXJ_cjs.sql`COUNT(${field})`;
|
|
1823
1823
|
}
|
|
1824
1824
|
case "countDistinct": {
|
|
1825
|
-
return
|
|
1825
|
+
return chunkOJHD3LXJ_cjs.sql`COUNT(DISTINCT ${field})`;
|
|
1826
1826
|
}
|
|
1827
1827
|
case "sum": {
|
|
1828
|
-
return
|
|
1828
|
+
return chunkOJHD3LXJ_cjs.sql`SUM(${field})`;
|
|
1829
1829
|
}
|
|
1830
1830
|
case "avg": {
|
|
1831
|
-
return
|
|
1831
|
+
return chunkOJHD3LXJ_cjs.sql`AVG(${field})`;
|
|
1832
1832
|
}
|
|
1833
1833
|
case "min": {
|
|
1834
|
-
return
|
|
1834
|
+
return chunkOJHD3LXJ_cjs.sql`MIN(${field})`;
|
|
1835
1835
|
}
|
|
1836
1836
|
case "max": {
|
|
1837
|
-
return
|
|
1837
|
+
return chunkOJHD3LXJ_cjs.sql`MAX(${field})`;
|
|
1838
1838
|
}
|
|
1839
1839
|
default: {
|
|
1840
|
-
throw new
|
|
1840
|
+
throw new chunkX4GDXBOP_cjs.UnsupportedPredicateError(
|
|
1841
1841
|
`Unknown aggregate function: ${expr.function}`
|
|
1842
1842
|
);
|
|
1843
1843
|
}
|
|
@@ -1845,15 +1845,15 @@ function compileAggregateExpr(expr, dialect) {
|
|
|
1845
1845
|
}
|
|
1846
1846
|
function compileExistsSubquery(expr, ctx) {
|
|
1847
1847
|
if (expr.subquery.graphId === void 0) {
|
|
1848
|
-
throw new
|
|
1848
|
+
throw new chunkX4GDXBOP_cjs.UnsupportedPredicateError("EXISTS subquery must have a graphId");
|
|
1849
1849
|
}
|
|
1850
1850
|
const subSql = ctx.compileQuery(expr.subquery, expr.subquery.graphId);
|
|
1851
|
-
return expr.negated ?
|
|
1851
|
+
return expr.negated ? chunkOJHD3LXJ_cjs.sql`NOT EXISTS (${subSql})` : chunkOJHD3LXJ_cjs.sql`EXISTS (${subSql})`;
|
|
1852
1852
|
}
|
|
1853
1853
|
function compileInSubquery(expr, ctx) {
|
|
1854
1854
|
const subqueryColumnCount = getSubqueryColumnCount(expr.subquery);
|
|
1855
1855
|
if (subqueryColumnCount !== 1) {
|
|
1856
|
-
throw new
|
|
1856
|
+
throw new chunkX4GDXBOP_cjs.UnsupportedPredicateError(
|
|
1857
1857
|
`IN/NOT IN subquery must project exactly 1 column, but got ${subqueryColumnCount}`,
|
|
1858
1858
|
{ subqueryColumnCount }
|
|
1859
1859
|
);
|
|
@@ -1862,13 +1862,13 @@ function compileInSubquery(expr, ctx) {
|
|
|
1862
1862
|
const subqueryValueType = getSingleSubqueryColumnValueType(expr.subquery);
|
|
1863
1863
|
const resolvedValueType = fieldValueType ?? subqueryValueType;
|
|
1864
1864
|
if (isUnsupportedInSubqueryValueType(resolvedValueType)) {
|
|
1865
|
-
throw new
|
|
1865
|
+
throw new chunkX4GDXBOP_cjs.UnsupportedPredicateError(
|
|
1866
1866
|
`IN/NOT IN subquery does not support ${String(resolvedValueType)} values`,
|
|
1867
1867
|
{ valueType: resolvedValueType }
|
|
1868
1868
|
);
|
|
1869
1869
|
}
|
|
1870
1870
|
if (!isInSubqueryTypeCompatible(fieldValueType, subqueryValueType)) {
|
|
1871
|
-
throw new
|
|
1871
|
+
throw new chunkX4GDXBOP_cjs.UnsupportedPredicateError(
|
|
1872
1872
|
`IN/NOT IN type mismatch: field type "${String(fieldValueType)}" does not match subquery column type "${String(subqueryValueType)}"`,
|
|
1873
1873
|
{
|
|
1874
1874
|
fieldValueType,
|
|
@@ -1878,7 +1878,7 @@ function compileInSubquery(expr, ctx) {
|
|
|
1878
1878
|
}
|
|
1879
1879
|
const valueType = fieldValueType ?? subqueryValueType;
|
|
1880
1880
|
if (expr.subquery.graphId === void 0) {
|
|
1881
|
-
throw new
|
|
1881
|
+
throw new chunkX4GDXBOP_cjs.UnsupportedPredicateError(
|
|
1882
1882
|
"IN/NOT IN subquery must have a graphId"
|
|
1883
1883
|
);
|
|
1884
1884
|
}
|
|
@@ -1891,14 +1891,14 @@ function compileInSubquery(expr, ctx) {
|
|
|
1891
1891
|
ctx.cteColumnPrefix
|
|
1892
1892
|
);
|
|
1893
1893
|
const subSql = ctx.compileQuery(expr.subquery, expr.subquery.graphId);
|
|
1894
|
-
return expr.negated ?
|
|
1894
|
+
return expr.negated ? chunkOJHD3LXJ_cjs.sql`${fieldSql} NOT IN (${subSql})` : chunkOJHD3LXJ_cjs.sql`${fieldSql} IN (${subSql})`;
|
|
1895
1895
|
}
|
|
1896
1896
|
function extractStructuralPredicates(predicates, isMatch, rejectionMessage) {
|
|
1897
1897
|
const results = [];
|
|
1898
1898
|
function visit(expr, inDisallowedBranch) {
|
|
1899
1899
|
if (isMatch(expr)) {
|
|
1900
1900
|
if (inDisallowedBranch) {
|
|
1901
|
-
throw new
|
|
1901
|
+
throw new chunkX4GDXBOP_cjs.UnsupportedPredicateError(rejectionMessage);
|
|
1902
1902
|
}
|
|
1903
1903
|
results.push(expr);
|
|
1904
1904
|
return;
|
|
@@ -1952,9 +1952,9 @@ function extractFulltextMatchPredicates(predicates) {
|
|
|
1952
1952
|
// src/query/compiler/predicate-utils.ts
|
|
1953
1953
|
var EMPTY_PREDICATES = [];
|
|
1954
1954
|
function sqlValueList(values) {
|
|
1955
|
-
return
|
|
1956
|
-
values.map((value) =>
|
|
1957
|
-
|
|
1955
|
+
return chunkOJHD3LXJ_cjs.sql.join(
|
|
1956
|
+
values.map((value) => chunkOJHD3LXJ_cjs.sql`${value}`),
|
|
1957
|
+
chunkOJHD3LXJ_cjs.sql`, `
|
|
1958
1958
|
);
|
|
1959
1959
|
}
|
|
1960
1960
|
function buildPredicateIndexKey(alias, targetType) {
|
|
@@ -1991,12 +1991,12 @@ function compilePredicateClauses(predicates, predicateContext) {
|
|
|
1991
1991
|
}
|
|
1992
1992
|
function compileKindFilter(column, kinds) {
|
|
1993
1993
|
if (kinds.length === 0) {
|
|
1994
|
-
return
|
|
1994
|
+
return chunkOJHD3LXJ_cjs.sql`1 = 0`;
|
|
1995
1995
|
}
|
|
1996
1996
|
if (kinds.length === 1) {
|
|
1997
|
-
return
|
|
1997
|
+
return chunkOJHD3LXJ_cjs.sql`${column} = ${kinds[0]}`;
|
|
1998
1998
|
}
|
|
1999
|
-
return
|
|
1999
|
+
return chunkOJHD3LXJ_cjs.sql`${column} IN (${sqlValueList(kinds)})`;
|
|
2000
2000
|
}
|
|
2001
2001
|
function getNodeKindsForAlias(ast, alias) {
|
|
2002
2002
|
if (alias === ast.start.alias) {
|
|
@@ -2007,7 +2007,7 @@ function getNodeKindsForAlias(ast, alias) {
|
|
|
2007
2007
|
return traversal.nodeKinds;
|
|
2008
2008
|
}
|
|
2009
2009
|
}
|
|
2010
|
-
throw new
|
|
2010
|
+
throw new chunkX4GDXBOP_cjs.CompilerInvariantError(`Unknown traversal source alias: ${alias}`);
|
|
2011
2011
|
}
|
|
2012
2012
|
function getHybridTargetAlias(vectorPredicate, fulltextPredicate) {
|
|
2013
2013
|
if (!vectorPredicate || !fulltextPredicate) return void 0;
|
|
@@ -2112,16 +2112,16 @@ var RECORDED_IDENTITY_ASSERTION_COLUMNS = [
|
|
|
2112
2112
|
"recorded_to",
|
|
2113
2113
|
"op"
|
|
2114
2114
|
];
|
|
2115
|
-
var RECORDED_NODE_COLUMN_LIST =
|
|
2116
|
-
var RECORDED_EDGE_COLUMN_LIST =
|
|
2117
|
-
var RECORDED_IDENTITY_ASSERTION_COLUMN_LIST =
|
|
2115
|
+
var RECORDED_NODE_COLUMN_LIST = chunkOJHD3LXJ_cjs.sql.raw(RECORDED_NODE_COLUMNS.join(", "));
|
|
2116
|
+
var RECORDED_EDGE_COLUMN_LIST = chunkOJHD3LXJ_cjs.sql.raw(RECORDED_EDGE_COLUMNS.join(", "));
|
|
2117
|
+
var RECORDED_IDENTITY_ASSERTION_COLUMN_LIST = chunkOJHD3LXJ_cjs.sql.raw(
|
|
2118
2118
|
RECORDED_IDENTITY_ASSERTION_COLUMNS.join(", ")
|
|
2119
2119
|
);
|
|
2120
2120
|
var RECORDED_BIND_PARAM_BUDGET = 900;
|
|
2121
2121
|
function recordedBindParamBudget(target) {
|
|
2122
2122
|
const budget = target.capabilities.maxBindParameters ?? RECORDED_BIND_PARAM_BUDGET;
|
|
2123
2123
|
if (!Number.isSafeInteger(budget) || budget < 1) {
|
|
2124
|
-
throw new
|
|
2124
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
2125
2125
|
`backend capabilities.maxBindParameters must be a positive integer, got: ${String(budget)}`,
|
|
2126
2126
|
{
|
|
2127
2127
|
code: "INVALID_BACKEND_CAPABILITY",
|
|
@@ -2137,64 +2137,64 @@ function recordedChunkSize(target, columnCount) {
|
|
|
2137
2137
|
return Math.max(1, Math.floor(budget / columnCount));
|
|
2138
2138
|
}
|
|
2139
2139
|
function sqlNull(value) {
|
|
2140
|
-
return value === void 0 ?
|
|
2140
|
+
return value === void 0 ? chunkOJHD3LXJ_cjs.sql.raw("NULL") : chunkOJHD3LXJ_cjs.sql`${value}`;
|
|
2141
2141
|
}
|
|
2142
2142
|
function recordedCommonCells() {
|
|
2143
2143
|
return {
|
|
2144
|
-
history_id: () =>
|
|
2145
|
-
graph_id: (row) =>
|
|
2146
|
-
id: (row) =>
|
|
2147
|
-
kind: (row) =>
|
|
2148
|
-
props: (row) =>
|
|
2149
|
-
valid_from: (row) =>
|
|
2150
|
-
valid_to: (row) =>
|
|
2151
|
-
created_at: (row) =>
|
|
2152
|
-
updated_at: (row) =>
|
|
2153
|
-
deleted_at: (row) =>
|
|
2154
|
-
recorded_from: (_row, recordedRevision) =>
|
|
2155
|
-
recorded_to: () =>
|
|
2156
|
-
op: (_row, _recordedCommit, operation) =>
|
|
2157
|
-
schema_version: () =>
|
|
2158
|
-
tx_id: () =>
|
|
2159
|
-
meta: () =>
|
|
2144
|
+
history_id: () => chunkOJHD3LXJ_cjs.sql`${generateId()}`,
|
|
2145
|
+
graph_id: (row) => chunkOJHD3LXJ_cjs.sql`${row.graph_id}`,
|
|
2146
|
+
id: (row) => chunkOJHD3LXJ_cjs.sql`${row.id}`,
|
|
2147
|
+
kind: (row) => chunkOJHD3LXJ_cjs.sql`${row.kind}`,
|
|
2148
|
+
props: (row) => chunkOJHD3LXJ_cjs.sql`${chunkGHZPZNFC_cjs.rowPropsToJsonText(row.props)}`,
|
|
2149
|
+
valid_from: (row) => chunkOJHD3LXJ_cjs.sql`${sqlNull(row.valid_from)}`,
|
|
2150
|
+
valid_to: (row) => chunkOJHD3LXJ_cjs.sql`${sqlNull(row.valid_to)}`,
|
|
2151
|
+
created_at: (row) => chunkOJHD3LXJ_cjs.sql`${row.created_at}`,
|
|
2152
|
+
updated_at: (row) => chunkOJHD3LXJ_cjs.sql`${row.updated_at}`,
|
|
2153
|
+
deleted_at: (row) => chunkOJHD3LXJ_cjs.sql`${sqlNull(row.deleted_at)}`,
|
|
2154
|
+
recorded_from: (_row, recordedRevision) => chunkOJHD3LXJ_cjs.sql`${recordedRevision}`,
|
|
2155
|
+
recorded_to: () => chunkOJHD3LXJ_cjs.sql`${chunkDWUDZ66O_cjs.RECORDED_MAX_REVISION}`,
|
|
2156
|
+
op: (_row, _recordedCommit, operation) => chunkOJHD3LXJ_cjs.sql`${operation}`,
|
|
2157
|
+
schema_version: () => chunkOJHD3LXJ_cjs.sql`NULL`,
|
|
2158
|
+
tx_id: () => chunkOJHD3LXJ_cjs.sql`NULL`,
|
|
2159
|
+
meta: () => chunkOJHD3LXJ_cjs.sql`${RECORDED_HISTORY_META}`
|
|
2160
2160
|
};
|
|
2161
2161
|
}
|
|
2162
2162
|
var recordedNodeCells = {
|
|
2163
2163
|
...recordedCommonCells(),
|
|
2164
|
-
version: (row) =>
|
|
2164
|
+
version: (row) => chunkOJHD3LXJ_cjs.sql`${row.version}`
|
|
2165
2165
|
};
|
|
2166
2166
|
var recordedEdgeCells = {
|
|
2167
2167
|
...recordedCommonCells(),
|
|
2168
|
-
from_kind: (row) =>
|
|
2169
|
-
from_id: (row) =>
|
|
2170
|
-
to_kind: (row) =>
|
|
2171
|
-
to_id: (row) =>
|
|
2168
|
+
from_kind: (row) => chunkOJHD3LXJ_cjs.sql`${row.from_kind}`,
|
|
2169
|
+
from_id: (row) => chunkOJHD3LXJ_cjs.sql`${row.from_id}`,
|
|
2170
|
+
to_kind: (row) => chunkOJHD3LXJ_cjs.sql`${row.to_kind}`,
|
|
2171
|
+
to_id: (row) => chunkOJHD3LXJ_cjs.sql`${row.to_id}`
|
|
2172
2172
|
};
|
|
2173
2173
|
var recordedIdentityAssertionCells = {
|
|
2174
|
-
history_id: () =>
|
|
2175
|
-
graph_id: (row) =>
|
|
2176
|
-
id: (row) =>
|
|
2177
|
-
rel: (row) =>
|
|
2178
|
-
a_kind: (row) =>
|
|
2179
|
-
a_id: (row) =>
|
|
2180
|
-
b_kind: (row) =>
|
|
2181
|
-
b_id: (row) =>
|
|
2182
|
-
valid_from: (row) =>
|
|
2183
|
-
valid_to: (row) =>
|
|
2184
|
-
created_at: (row) =>
|
|
2185
|
-
updated_at: (row) =>
|
|
2186
|
-
deleted_at: (row) =>
|
|
2187
|
-
ended_by_kind: (row) =>
|
|
2188
|
-
ended_by_id: (row) =>
|
|
2189
|
-
recorded_from: (_row, recordedRevision) =>
|
|
2190
|
-
recorded_to: () =>
|
|
2191
|
-
op: (_row, _recordedRevision, operation) =>
|
|
2174
|
+
history_id: () => chunkOJHD3LXJ_cjs.sql`${generateId()}`,
|
|
2175
|
+
graph_id: (row) => chunkOJHD3LXJ_cjs.sql`${row.graph_id}`,
|
|
2176
|
+
id: (row) => chunkOJHD3LXJ_cjs.sql`${row.id}`,
|
|
2177
|
+
rel: (row) => chunkOJHD3LXJ_cjs.sql`${row.rel}`,
|
|
2178
|
+
a_kind: (row) => chunkOJHD3LXJ_cjs.sql`${row.a_kind}`,
|
|
2179
|
+
a_id: (row) => chunkOJHD3LXJ_cjs.sql`${row.a_id}`,
|
|
2180
|
+
b_kind: (row) => chunkOJHD3LXJ_cjs.sql`${row.b_kind}`,
|
|
2181
|
+
b_id: (row) => chunkOJHD3LXJ_cjs.sql`${row.b_id}`,
|
|
2182
|
+
valid_from: (row) => chunkOJHD3LXJ_cjs.sql`${row.valid_from}`,
|
|
2183
|
+
valid_to: (row) => chunkOJHD3LXJ_cjs.sql`${row.valid_to ?? chunkOJHD3LXJ_cjs.sql.raw("NULL")}`,
|
|
2184
|
+
created_at: (row) => chunkOJHD3LXJ_cjs.sql`${row.created_at}`,
|
|
2185
|
+
updated_at: (row) => chunkOJHD3LXJ_cjs.sql`${row.updated_at}`,
|
|
2186
|
+
deleted_at: (row) => chunkOJHD3LXJ_cjs.sql`${row.deleted_at ?? chunkOJHD3LXJ_cjs.sql.raw("NULL")}`,
|
|
2187
|
+
ended_by_kind: (row) => chunkOJHD3LXJ_cjs.sql`${row.ended_by_kind ?? chunkOJHD3LXJ_cjs.sql.raw("NULL")}`,
|
|
2188
|
+
ended_by_id: (row) => chunkOJHD3LXJ_cjs.sql`${row.ended_by_id ?? chunkOJHD3LXJ_cjs.sql.raw("NULL")}`,
|
|
2189
|
+
recorded_from: (_row, recordedRevision) => chunkOJHD3LXJ_cjs.sql`${recordedRevision}`,
|
|
2190
|
+
recorded_to: () => chunkOJHD3LXJ_cjs.sql`${chunkDWUDZ66O_cjs.RECORDED_MAX_REVISION}`,
|
|
2191
|
+
op: (_row, _recordedRevision, operation) => chunkOJHD3LXJ_cjs.sql`${operation}`
|
|
2192
2192
|
};
|
|
2193
2193
|
function recordedValuesTuple(columns, cells, row, recordedRevision, operation) {
|
|
2194
2194
|
const tuple = columns.map(
|
|
2195
2195
|
(column) => cells[column](row, recordedRevision, operation)
|
|
2196
2196
|
);
|
|
2197
|
-
return
|
|
2197
|
+
return chunkOJHD3LXJ_cjs.sql`(${chunkOJHD3LXJ_cjs.sql.join(tuple, chunkOJHD3LXJ_cjs.sql`, `)})`;
|
|
2198
2198
|
}
|
|
2199
2199
|
async function insertRecordedRows(target, table, columnList, columns, cells, inserts, recordedRevision) {
|
|
2200
2200
|
if (inserts.length === 0) return;
|
|
@@ -2209,9 +2209,9 @@ async function insertRecordedRows(target, table, columnList, columns, cells, ins
|
|
|
2209
2209
|
);
|
|
2210
2210
|
await executeStatement(
|
|
2211
2211
|
target,
|
|
2212
|
-
|
|
2212
|
+
chunkOJHD3LXJ_cjs.sql`
|
|
2213
2213
|
INSERT INTO ${table} (${columnList})
|
|
2214
|
-
VALUES ${
|
|
2214
|
+
VALUES ${chunkOJHD3LXJ_cjs.sql.join(values, chunkOJHD3LXJ_cjs.sql`, `)}
|
|
2215
2215
|
`
|
|
2216
2216
|
);
|
|
2217
2217
|
}
|
|
@@ -2273,14 +2273,14 @@ function entityKey(entity) {
|
|
|
2273
2273
|
}
|
|
2274
2274
|
}
|
|
2275
2275
|
async function closeOpenReturning(target, table, graphId, ids, recordedRevision, kind) {
|
|
2276
|
-
const kindFilter = kind === void 0 ?
|
|
2276
|
+
const kindFilter = kind === void 0 ? chunkOJHD3LXJ_cjs.sql`` : chunkOJHD3LXJ_cjs.sql`AND kind = ${kind}`;
|
|
2277
2277
|
const rows = await target.execute(
|
|
2278
|
-
|
|
2278
|
+
chunkOJHD3LXJ_cjs.asCompiledRowsSql(chunkOJHD3LXJ_cjs.sql`
|
|
2279
2279
|
UPDATE ${table}
|
|
2280
2280
|
SET recorded_to = ${recordedRevision}
|
|
2281
2281
|
WHERE graph_id = ${graphId}
|
|
2282
2282
|
${kindFilter}
|
|
2283
|
-
AND recorded_to = ${
|
|
2283
|
+
AND recorded_to = ${chunkDWUDZ66O_cjs.RECORDED_MAX_REVISION}
|
|
2284
2284
|
AND id IN (${sqlValueList(ids)})
|
|
2285
2285
|
RETURNING id, deleted_at
|
|
2286
2286
|
`)
|
|
@@ -2325,7 +2325,7 @@ function recordedInsertsFor(afterById, closed) {
|
|
|
2325
2325
|
async function flushNodes(target, schema, graphId, entities, recordedRevision) {
|
|
2326
2326
|
const chunkSize = recordedNodeChunkSize(target);
|
|
2327
2327
|
for (const [kind, group] of groupNodesByKind(entities)) {
|
|
2328
|
-
for (const entityChunk of
|
|
2328
|
+
for (const entityChunk of chunkZBFZGLZE_cjs.chunk(group, chunkSize)) {
|
|
2329
2329
|
const ids = entityChunk.map((entity) => entity.id);
|
|
2330
2330
|
const closed = await closeOpenReturning(
|
|
2331
2331
|
target,
|
|
@@ -2350,7 +2350,7 @@ async function flushNodes(target, schema, graphId, entities, recordedRevision) {
|
|
|
2350
2350
|
}
|
|
2351
2351
|
async function flushEdges(target, schema, graphId, entities, recordedRevision) {
|
|
2352
2352
|
const chunkSize = recordedEdgeChunkSize(target);
|
|
2353
|
-
for (const entityChunk of
|
|
2353
|
+
for (const entityChunk of chunkZBFZGLZE_cjs.chunk(entities, chunkSize)) {
|
|
2354
2354
|
const ids = entityChunk.map((entity) => entity.id);
|
|
2355
2355
|
const closed = await closeOpenReturning(
|
|
2356
2356
|
target,
|
|
@@ -2374,7 +2374,7 @@ async function flushEdges(target, schema, graphId, entities, recordedRevision) {
|
|
|
2374
2374
|
async function getIdentityAssertionRowsByIds(target, schema, graphId, ids) {
|
|
2375
2375
|
if (ids.length === 0) return /* @__PURE__ */ new Map();
|
|
2376
2376
|
const rows = await target.execute(
|
|
2377
|
-
|
|
2377
|
+
chunkOJHD3LXJ_cjs.asCompiledRowsSql(chunkOJHD3LXJ_cjs.sql`
|
|
2378
2378
|
SELECT ${IDENTITY_ASSERTION_COLUMNS}
|
|
2379
2379
|
FROM ${schema.identityAssertionsTable}
|
|
2380
2380
|
WHERE graph_id = ${graphId}
|
|
@@ -2386,7 +2386,7 @@ async function getIdentityAssertionRowsByIds(target, schema, graphId, ids) {
|
|
|
2386
2386
|
async function flushIdentityAssertions(target, schema, graphId, entities, recordedRevision) {
|
|
2387
2387
|
if (entities.length === 0) return;
|
|
2388
2388
|
const chunkSize = recordedIdentityAssertionChunkSize(target);
|
|
2389
|
-
for (const entityChunk of
|
|
2389
|
+
for (const entityChunk of chunkZBFZGLZE_cjs.chunk(entities, chunkSize)) {
|
|
2390
2390
|
const ids = entityChunk.map((entity) => entity.id);
|
|
2391
2391
|
const closed = await closeOpenReturning(
|
|
2392
2392
|
target,
|
|
@@ -2410,24 +2410,24 @@ async function flushIdentityAssertions(target, schema, graphId, entities, record
|
|
|
2410
2410
|
async function closeOpenByKind(target, table, graphId, kind, recordedRevision) {
|
|
2411
2411
|
await executeStatement(
|
|
2412
2412
|
target,
|
|
2413
|
-
|
|
2413
|
+
chunkOJHD3LXJ_cjs.sql`
|
|
2414
2414
|
UPDATE ${table}
|
|
2415
2415
|
SET recorded_to = ${recordedRevision}
|
|
2416
2416
|
WHERE graph_id = ${graphId}
|
|
2417
2417
|
AND kind = ${kind}
|
|
2418
|
-
AND recorded_to = ${
|
|
2418
|
+
AND recorded_to = ${chunkDWUDZ66O_cjs.RECORDED_MAX_REVISION}
|
|
2419
2419
|
`
|
|
2420
2420
|
);
|
|
2421
2421
|
}
|
|
2422
2422
|
async function closeOpenEdgesByNodeKind(target, schema, graphId, nodeKind, recordedRevision) {
|
|
2423
2423
|
await executeStatement(
|
|
2424
2424
|
target,
|
|
2425
|
-
|
|
2425
|
+
chunkOJHD3LXJ_cjs.sql`
|
|
2426
2426
|
UPDATE ${schema.recordedEdgesTable}
|
|
2427
2427
|
SET recorded_to = ${recordedRevision}
|
|
2428
2428
|
WHERE graph_id = ${graphId}
|
|
2429
2429
|
AND (from_kind = ${nodeKind} OR to_kind = ${nodeKind})
|
|
2430
|
-
AND recorded_to = ${
|
|
2430
|
+
AND recorded_to = ${chunkDWUDZ66O_cjs.RECORDED_MAX_REVISION}
|
|
2431
2431
|
`
|
|
2432
2432
|
);
|
|
2433
2433
|
}
|
|
@@ -2465,7 +2465,7 @@ async function closeRecordedHardDeletedKind(target, schema, graphId, removal, ow
|
|
|
2465
2465
|
}
|
|
2466
2466
|
async function queryConnectedEdgeIds(target, schema, params) {
|
|
2467
2467
|
const rows = await target.execute(
|
|
2468
|
-
|
|
2468
|
+
chunkOJHD3LXJ_cjs.asCompiledRowsSql(chunkOJHD3LXJ_cjs.sql`
|
|
2469
2469
|
SELECT id
|
|
2470
2470
|
FROM ${schema.edgesTable}
|
|
2471
2471
|
WHERE graph_id = ${params.graphId}
|
|
@@ -2486,9 +2486,9 @@ function normalizedColumnType(value) {
|
|
|
2486
2486
|
}
|
|
2487
2487
|
async function readColumnTypes(backend, table) {
|
|
2488
2488
|
const rows = backend.dialect === "sqlite" ? await backend.execute(
|
|
2489
|
-
|
|
2489
|
+
chunkOJHD3LXJ_cjs.asCompiledRowsSql(chunkOJHD3LXJ_cjs.sql`PRAGMA table_info(${chunkOJHD3LXJ_cjs.sql.identifier(table)})`)
|
|
2490
2490
|
) : await backend.execute(
|
|
2491
|
-
|
|
2491
|
+
chunkOJHD3LXJ_cjs.asCompiledRowsSql(chunkOJHD3LXJ_cjs.sql`
|
|
2492
2492
|
SELECT column_name AS name, data_type AS type
|
|
2493
2493
|
FROM information_schema.columns
|
|
2494
2494
|
WHERE table_schema = current_schema()
|
|
@@ -2570,7 +2570,7 @@ async function assertCurrentRecordedSchema(backend, schema, includeIdentity = fa
|
|
|
2570
2570
|
);
|
|
2571
2571
|
const recordedIdentityTable = schema.tables.recordedIdentityAssertions;
|
|
2572
2572
|
if (includeIdentity && (columnTypes.get(recordedIdentityTable)?.size ?? 0) === 0) {
|
|
2573
|
-
throw new
|
|
2573
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
2574
2574
|
"Recorded identity history is not provisioned for this database.",
|
|
2575
2575
|
{
|
|
2576
2576
|
code: "RECORDED_IDENTITY_SCHEMA_MISSING",
|
|
@@ -2590,7 +2590,7 @@ async function assertCurrentRecordedSchema(backend, schema, includeIdentity = fa
|
|
|
2590
2590
|
return [{ ...requirement, actual: actual ?? "missing" }];
|
|
2591
2591
|
});
|
|
2592
2592
|
if (incompatible.length === 0) return;
|
|
2593
|
-
throw new
|
|
2593
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
2594
2594
|
"Recorded-time schema is incompatible with history capture.",
|
|
2595
2595
|
{
|
|
2596
2596
|
code: "RECORDED_SCHEMA_INCOMPATIBLE",
|
|
@@ -2638,7 +2638,7 @@ function edgeRowIdentityKey(row) {
|
|
|
2638
2638
|
return edgeIdentityKey(row.graph_id, row.id);
|
|
2639
2639
|
}
|
|
2640
2640
|
function recordedCaptureSealedError(details) {
|
|
2641
|
-
return new
|
|
2641
|
+
return new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
2642
2642
|
"Recorded-time capture session is sealed: a graph write happened after the transaction's capture was flushed.",
|
|
2643
2643
|
details,
|
|
2644
2644
|
{
|
|
@@ -2679,7 +2679,7 @@ function createRecordedCaptureSession() {
|
|
|
2679
2679
|
},
|
|
2680
2680
|
async flush(target, schema, ownsWriteLock) {
|
|
2681
2681
|
if (sealed) {
|
|
2682
|
-
throw new
|
|
2682
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
2683
2683
|
"Recorded-time capture session was already flushed.",
|
|
2684
2684
|
{},
|
|
2685
2685
|
{
|
|
@@ -2691,7 +2691,7 @@ function createRecordedCaptureSession() {
|
|
|
2691
2691
|
if (touched.size === 0 && forcedGraphRevisions.size === 0)
|
|
2692
2692
|
return /* @__PURE__ */ new Map();
|
|
2693
2693
|
const recordedByGraph = /* @__PURE__ */ new Map();
|
|
2694
|
-
const byGraph =
|
|
2694
|
+
const byGraph = chunkZBFZGLZE_cjs.groupBy(touched.values(), (entity) => entity.graphId);
|
|
2695
2695
|
for (const graphId of forcedGraphRevisions) {
|
|
2696
2696
|
if (!byGraph.has(graphId)) byGraph.set(graphId, []);
|
|
2697
2697
|
}
|
|
@@ -2776,7 +2776,7 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
2776
2776
|
await lockRecordedGraphWrite(target, graphId, graphLocks);
|
|
2777
2777
|
}
|
|
2778
2778
|
}
|
|
2779
|
-
const overlay =
|
|
2779
|
+
const overlay = chunkZBFZGLZE_cjs.deriveBackend(target, {
|
|
2780
2780
|
...rawWriteGuards(target, "tx.backend"),
|
|
2781
2781
|
async insertNode(params) {
|
|
2782
2782
|
session.assertOpen();
|
|
@@ -2956,7 +2956,7 @@ function createRecordedTransactionScope(target, schema, ownsWriteLock = false) {
|
|
|
2956
2956
|
return {
|
|
2957
2957
|
backend: createRecordedTransactionBackend(target, session, resolvedSchema),
|
|
2958
2958
|
async flush() {
|
|
2959
|
-
return
|
|
2959
|
+
return chunkZBFZGLZE_cjs.withRecordedRelationsPrecondition(
|
|
2960
2960
|
session.flush(target, resolvedSchema, ownsWriteLock),
|
|
2961
2961
|
{ dialect: target.dialect, surface: "capture-flush" }
|
|
2962
2962
|
);
|
|
@@ -2976,8 +2976,8 @@ async function runCapturedAutocommit(backend, schema, fn, options) {
|
|
|
2976
2976
|
function createRecordedBackend(backend, schema) {
|
|
2977
2977
|
assertCapturableBackend(backend);
|
|
2978
2978
|
const capture = (fn) => runCapturedAutocommit(backend, schema, fn);
|
|
2979
|
-
const projectedBackend =
|
|
2980
|
-
return
|
|
2979
|
+
const projectedBackend = chunkZBFZGLZE_cjs.projectGraphBackend(backend);
|
|
2980
|
+
return chunkZBFZGLZE_cjs.deriveBackend(projectedBackend, {
|
|
2981
2981
|
...rawWriteGuards(backend, "backend"),
|
|
2982
2982
|
async insertNode(params) {
|
|
2983
2983
|
return capture((target) => target.insertNode(params));
|
|
@@ -3011,7 +3011,7 @@ function createRecordedBackend(backend, schema) {
|
|
|
3011
3011
|
return capture((target) => {
|
|
3012
3012
|
const updateNodeSet = target.updateNodeSet;
|
|
3013
3013
|
if (updateNodeSet === void 0) {
|
|
3014
|
-
throw new
|
|
3014
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
3015
3015
|
"Recorded updateNodeSet capability disappeared inside a transaction",
|
|
3016
3016
|
{ operation: "updateNodeSet" }
|
|
3017
3017
|
);
|
|
@@ -3090,31 +3090,194 @@ function createRecordedBackend(backend, schema) {
|
|
|
3090
3090
|
});
|
|
3091
3091
|
}
|
|
3092
3092
|
|
|
3093
|
-
// src/
|
|
3094
|
-
function
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3093
|
+
// src/errors/validation.ts
|
|
3094
|
+
function zodIssuesToValidationIssues(error) {
|
|
3095
|
+
return error.issues.map((issue) => ({
|
|
3096
|
+
path: issue.path.join("."),
|
|
3097
|
+
message: issue.message,
|
|
3098
|
+
code: issue.code
|
|
3099
|
+
}));
|
|
3100
|
+
}
|
|
3101
|
+
function buildLocationString(context) {
|
|
3102
|
+
if (context.id) {
|
|
3103
|
+
return `${context.kind}/${context.id}`;
|
|
3104
|
+
}
|
|
3105
|
+
return `new ${context.kind}`;
|
|
3106
|
+
}
|
|
3107
|
+
function validateProps(schema, props, context) {
|
|
3108
|
+
const result = schema.safeParse(props);
|
|
3109
|
+
if (result.success) {
|
|
3110
|
+
return result.data;
|
|
3111
|
+
}
|
|
3112
|
+
const issues = zodIssuesToValidationIssues(result.error);
|
|
3113
|
+
const location = buildLocationString(context);
|
|
3114
|
+
throw new chunkX4GDXBOP_cjs.ValidationError(
|
|
3115
|
+
`Invalid ${context.entityType} props for ${location}: ${result.error.message}`,
|
|
3116
|
+
{
|
|
3117
|
+
entityType: context.entityType,
|
|
3118
|
+
kind: context.kind,
|
|
3119
|
+
operation: context.operation,
|
|
3120
|
+
...context.id !== void 0 && { id: context.id },
|
|
3121
|
+
issues
|
|
3122
|
+
},
|
|
3123
|
+
{ cause: result.error }
|
|
3124
|
+
);
|
|
3125
|
+
}
|
|
3126
|
+
function validateNodeProps(schema, props, context) {
|
|
3127
|
+
return validateProps(schema, props, {
|
|
3128
|
+
entityType: "node",
|
|
3129
|
+
...context
|
|
3130
|
+
});
|
|
3131
|
+
}
|
|
3132
|
+
function validateEdgeProps(schema, props, context) {
|
|
3133
|
+
return validateProps(schema, props, {
|
|
3134
|
+
entityType: "edge",
|
|
3135
|
+
...context
|
|
3136
|
+
});
|
|
3137
|
+
}
|
|
3138
|
+
function wrapZodError(error, context) {
|
|
3139
|
+
const issues = zodIssuesToValidationIssues(error);
|
|
3140
|
+
const location = buildLocationString(context);
|
|
3141
|
+
return new chunkX4GDXBOP_cjs.ValidationError(
|
|
3142
|
+
`Validation failed for ${context.entityType} ${location}: ${error.message}`,
|
|
3143
|
+
{
|
|
3144
|
+
entityType: context.entityType,
|
|
3145
|
+
kind: context.kind,
|
|
3146
|
+
operation: context.operation,
|
|
3147
|
+
...context.id !== void 0 && { id: context.id },
|
|
3148
|
+
issues
|
|
3149
|
+
},
|
|
3150
|
+
{ cause: error }
|
|
3151
|
+
);
|
|
3152
|
+
}
|
|
3153
|
+
function createValidationError(message, issues, context) {
|
|
3154
|
+
return new chunkX4GDXBOP_cjs.ValidationError(message, {
|
|
3155
|
+
...context?.entityType !== void 0 && {
|
|
3156
|
+
entityType: context.entityType
|
|
3157
|
+
},
|
|
3158
|
+
...context?.kind !== void 0 && { kind: context.kind },
|
|
3159
|
+
...context?.operation !== void 0 && { operation: context.operation },
|
|
3160
|
+
...context?.id !== void 0 && { id: context.id },
|
|
3161
|
+
issues
|
|
3162
|
+
});
|
|
3113
3163
|
}
|
|
3114
3164
|
|
|
3115
|
-
// src/
|
|
3116
|
-
|
|
3117
|
-
|
|
3165
|
+
// src/store/operations/write-transaction.ts
|
|
3166
|
+
var writeTransactionSessions = /* @__PURE__ */ new WeakMap();
|
|
3167
|
+
function forceWriteTransactionRevision(target) {
|
|
3168
|
+
const session = writeTransactionSessions.get(target);
|
|
3169
|
+
if (session === void 0) return false;
|
|
3170
|
+
session.wrote = true;
|
|
3171
|
+
return true;
|
|
3172
|
+
}
|
|
3173
|
+
var heldGraphWriteLocks = /* @__PURE__ */ new WeakMap();
|
|
3174
|
+
async function withWriteTransactionSession(target, ctx, fn) {
|
|
3175
|
+
const session = {
|
|
3176
|
+
lock: void 0,
|
|
3177
|
+
wrote: false
|
|
3178
|
+
};
|
|
3179
|
+
writeTransactionSessions.set(target, session);
|
|
3180
|
+
try {
|
|
3181
|
+
const result = await fn();
|
|
3182
|
+
if (session.wrote && ctx.revisionTrackingEnabled && !ctx.historyEnabled) {
|
|
3183
|
+
await advanceRevisionClock(target, ctx.revisionSchema, ctx.graphId, true);
|
|
3184
|
+
}
|
|
3185
|
+
return result;
|
|
3186
|
+
} finally {
|
|
3187
|
+
writeTransactionSessions.delete(target);
|
|
3188
|
+
}
|
|
3189
|
+
}
|
|
3190
|
+
async function lockSchemaVersionForStoreWrite(ctx, backend) {
|
|
3191
|
+
const expectedVersion = ctx.schemaVersion;
|
|
3192
|
+
if (expectedVersion === void 0) return;
|
|
3193
|
+
if ("transaction" in backend && !backend.capabilities.transactions) {
|
|
3194
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
3195
|
+
"Schema-managed Store writes require a transactional backend so schema changes and entity writes can share one fence.",
|
|
3196
|
+
{
|
|
3197
|
+
code: "SCHEMA_WRITE_FENCE_UNSUPPORTED",
|
|
3198
|
+
graphId: ctx.graphId
|
|
3199
|
+
}
|
|
3200
|
+
);
|
|
3201
|
+
}
|
|
3202
|
+
const lockSchemaVersionForWrite = backend.lockSchemaVersionForWrite;
|
|
3203
|
+
if (lockSchemaVersionForWrite === void 0) {
|
|
3204
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
3205
|
+
"This backend cannot fence schema-managed Store writes against a concurrent schema change.",
|
|
3206
|
+
{
|
|
3207
|
+
code: "SCHEMA_WRITE_FENCE_UNSUPPORTED",
|
|
3208
|
+
graphId: ctx.graphId
|
|
3209
|
+
}
|
|
3210
|
+
);
|
|
3211
|
+
}
|
|
3212
|
+
await lockSchemaVersionForWrite({
|
|
3213
|
+
graphId: ctx.graphId,
|
|
3214
|
+
expectedVersion
|
|
3215
|
+
});
|
|
3216
|
+
}
|
|
3217
|
+
var CONSTRAINT_FENCE_ADVICE = {
|
|
3218
|
+
edgeCardinality: 'declare the edge `cardinality: "many"` and enforce the limit in application code',
|
|
3219
|
+
edgeMatchKeyConvergence: "use `create` with a caller-chosen id, whose uniqueness the edges primary key enforces, instead of `getOrCreateByEndpoints`",
|
|
3220
|
+
nodeDisjointness: "drop the `disjointWith` axiom and keep ids distinct across those kinds yourself",
|
|
3221
|
+
nodeUniquenessClaim: "drop the unique constraint \u2014 its reservation row and the node row must commit or roll back together",
|
|
3222
|
+
nodeUniquenessScope: 'scope the unique constraint to `"kind"`, which the uniques primary key enforces on its own'
|
|
3223
|
+
};
|
|
3224
|
+
function constraintFenceRefusal(ctx, backend, reason) {
|
|
3225
|
+
if (!("transaction" in backend) || backend.capabilities.transactions) {
|
|
3226
|
+
return void 0;
|
|
3227
|
+
}
|
|
3228
|
+
return new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
3229
|
+
"This backend cannot fence a constrained write: enforcing a declared constraint requires a transaction \u2014 to scope the per-graph write lock to, and to commit a reservation row together with the row it gates \u2014 and this backend has no transactions.",
|
|
3230
|
+
{
|
|
3231
|
+
code: "CONSTRAINT_WRITE_FENCE_UNSUPPORTED",
|
|
3232
|
+
graphId: ctx.graphId,
|
|
3233
|
+
constraint: reason
|
|
3234
|
+
},
|
|
3235
|
+
{
|
|
3236
|
+
suggestion: `Use a transactional backend, or ${CONSTRAINT_FENCE_ADVICE[reason]}. Unconstrained writes need no fence and keep working on this backend.`
|
|
3237
|
+
}
|
|
3238
|
+
);
|
|
3239
|
+
}
|
|
3240
|
+
function runInWriteTransaction(ctx, backend, fn, options) {
|
|
3241
|
+
const ownsWriteLock = "transaction" in backend && backend.capabilities.transactions;
|
|
3242
|
+
const fenceReason = options?.fencesConstraintProbe;
|
|
3243
|
+
const refusal = fenceReason === void 0 ? void 0 : constraintFenceRefusal(ctx, backend, fenceReason);
|
|
3244
|
+
if (refusal !== void 0) return Promise.reject(refusal);
|
|
3245
|
+
const needsGraphWriteLock = ctx.historyEnabled || ctx.revisionTrackingEnabled || fenceReason !== void 0;
|
|
3246
|
+
return chunkGHZPZNFC_cjs.runOptionallyInTransaction(backend, async (target) => {
|
|
3247
|
+
await lockSchemaVersionForStoreWrite(ctx, target);
|
|
3248
|
+
const session = needsGraphWriteLock ? writeTransactionSessions.get(target) : void 0;
|
|
3249
|
+
const held = heldGraphWriteLocks.get(target) ?? /* @__PURE__ */ new Set();
|
|
3250
|
+
heldGraphWriteLocks.set(target, held);
|
|
3251
|
+
const acquiresLock = needsGraphWriteLock && session?.lock === void 0 && !held.has(ctx.graphId);
|
|
3252
|
+
if (acquiresLock) held.add(ctx.graphId);
|
|
3253
|
+
const lock = acquiresLock ? await lockRecordedGraphWrite(target, ctx.graphId).catch(
|
|
3254
|
+
(error) => {
|
|
3255
|
+
held.delete(ctx.graphId);
|
|
3256
|
+
throw error;
|
|
3257
|
+
}
|
|
3258
|
+
) : session?.lock ?? uncapturedGraphWriteLock();
|
|
3259
|
+
if (session !== void 0) session.lock = lock;
|
|
3260
|
+
const result = await (acquiresLock ? fn(target, lock).finally(() => held.delete(ctx.graphId)) : fn(target, lock));
|
|
3261
|
+
if (session !== void 0) {
|
|
3262
|
+
session.wrote ||= options?.didWrite?.(result) ?? true;
|
|
3263
|
+
return result;
|
|
3264
|
+
}
|
|
3265
|
+
if (ctx.revisionTrackingEnabled && !ctx.historyEnabled && (options?.didWrite?.(result) ?? true)) {
|
|
3266
|
+
await advanceRevisionClock(
|
|
3267
|
+
target,
|
|
3268
|
+
ctx.revisionSchema,
|
|
3269
|
+
ctx.graphId,
|
|
3270
|
+
ownsWriteLock
|
|
3271
|
+
);
|
|
3272
|
+
}
|
|
3273
|
+
return result;
|
|
3274
|
+
});
|
|
3275
|
+
}
|
|
3276
|
+
function runHookedWriteOperation(ctx, opContext, backend, body, options) {
|
|
3277
|
+
return ctx.withOperationHooks(
|
|
3278
|
+
opContext,
|
|
3279
|
+
() => runInWriteTransaction(ctx, backend, body, options)
|
|
3280
|
+
);
|
|
3118
3281
|
}
|
|
3119
3282
|
|
|
3120
3283
|
exports.CURRENT_READ_INSTANT_PLACEHOLDER = CURRENT_READ_INSTANT_PLACEHOLDER;
|
|
@@ -3129,21 +3292,20 @@ exports.baseField = baseField;
|
|
|
3129
3292
|
exports.buildFieldBuilderForTypeInfo = buildFieldBuilderForTypeInfo;
|
|
3130
3293
|
exports.buildPredicateIndex = buildPredicateIndex;
|
|
3131
3294
|
exports.closeRecordedHardDeletedKind = closeRecordedHardDeletedKind;
|
|
3132
|
-
exports.compareCodePoints = compareCodePoints;
|
|
3133
|
-
exports.compareStrings = compareStrings;
|
|
3134
3295
|
exports.compileFieldValue = compileFieldValue;
|
|
3135
3296
|
exports.compileKindFilter = compileKindFilter;
|
|
3136
3297
|
exports.compilePredicateClauses = compilePredicateClauses;
|
|
3137
3298
|
exports.compilePredicateExpression = compilePredicateExpression;
|
|
3138
3299
|
exports.compileTemporalFilter = compileTemporalFilter;
|
|
3300
|
+
exports.constraintFenceRefusal = constraintFenceRefusal;
|
|
3139
3301
|
exports.createFulltextAccessor = createFulltextAccessor;
|
|
3140
3302
|
exports.createRecordedBackend = createRecordedBackend;
|
|
3141
3303
|
exports.createRecordedTransactionScope = createRecordedTransactionScope;
|
|
3304
|
+
exports.createValidationError = createValidationError;
|
|
3142
3305
|
exports.currentReadInstant = currentReadInstant;
|
|
3143
3306
|
exports.currentReadInstantFor = currentReadInstantFor;
|
|
3144
3307
|
exports.dateField = dateField;
|
|
3145
3308
|
exports.edgeInsertDispatch = edgeInsertDispatch;
|
|
3146
|
-
exports.encodeTupleKey = encodeTupleKey;
|
|
3147
3309
|
exports.ensureRevisionOrigin = ensureRevisionOrigin;
|
|
3148
3310
|
exports.exists = exists;
|
|
3149
3311
|
exports.extractFulltextMatchPredicates = extractFulltextMatchPredicates;
|
|
@@ -3151,6 +3313,7 @@ exports.extractTemporalOptions = extractTemporalOptions;
|
|
|
3151
3313
|
exports.extractVectorSimilarityPredicates = extractVectorSimilarityPredicates;
|
|
3152
3314
|
exports.fieldRef = fieldRef;
|
|
3153
3315
|
exports.forceRecordedGraphRevision = forceRecordedGraphRevision;
|
|
3316
|
+
exports.forceWriteTransactionRevision = forceWriteTransactionRevision;
|
|
3154
3317
|
exports.generateId = generateId;
|
|
3155
3318
|
exports.getEdgeRowsByIds = getEdgeRowsByIds;
|
|
3156
3319
|
exports.getFieldPointer = getFieldPointer;
|
|
@@ -3167,6 +3330,7 @@ exports.identitySqlCoordinate = identitySqlCoordinate;
|
|
|
3167
3330
|
exports.inSubquery = inSubquery;
|
|
3168
3331
|
exports.isParameterRef = isParameterRef;
|
|
3169
3332
|
exports.lockRecordedGraphWrite = lockRecordedGraphWrite;
|
|
3333
|
+
exports.lockSchemaVersionForStoreWrite = lockSchemaVersionForStoreWrite;
|
|
3170
3334
|
exports.nodeInsertDispatch = nodeInsertDispatch;
|
|
3171
3335
|
exports.notExists = notExists;
|
|
3172
3336
|
exports.notInSubquery = notInSubquery;
|
|
@@ -3178,6 +3342,8 @@ exports.readRevisionOrigin = readRevisionOrigin;
|
|
|
3178
3342
|
exports.recordedBindParamBudget = recordedBindParamBudget;
|
|
3179
3343
|
exports.recordedCaptureRequiresCallbackTransactionError = recordedCaptureRequiresCallbackTransactionError;
|
|
3180
3344
|
exports.resolveParameterValueType = resolveParameterValueType;
|
|
3345
|
+
exports.runHookedWriteOperation = runHookedWriteOperation;
|
|
3346
|
+
exports.runInWriteTransaction = runInWriteTransaction;
|
|
3181
3347
|
exports.runInsertBatch = runInsertBatch;
|
|
3182
3348
|
exports.runInsertBatchReturning = runInsertBatchReturning;
|
|
3183
3349
|
exports.runInsertNoReturn = runInsertNoReturn;
|
|
@@ -3185,9 +3351,13 @@ exports.sqlValueList = sqlValueList;
|
|
|
3185
3351
|
exports.stringField = stringField;
|
|
3186
3352
|
exports.throwHistoryUnsafeSqlAccess = throwHistoryUnsafeSqlAccess;
|
|
3187
3353
|
exports.throwRevisionTrackingUnsafeSqlAccess = throwRevisionTrackingUnsafeSqlAccess;
|
|
3188
|
-
exports.
|
|
3354
|
+
exports.validateEdgeProps = validateEdgeProps;
|
|
3355
|
+
exports.validateNodeProps = validateNodeProps;
|
|
3356
|
+
exports.validateProps = validateProps;
|
|
3189
3357
|
exports.withPinnedReadInstant = withPinnedReadInstant;
|
|
3190
3358
|
exports.withRecordedFlushObserver = withRecordedFlushObserver;
|
|
3191
3359
|
exports.withRecordedIdentityMutationTarget = withRecordedIdentityMutationTarget;
|
|
3192
|
-
|
|
3193
|
-
|
|
3360
|
+
exports.withWriteTransactionSession = withWriteTransactionSession;
|
|
3361
|
+
exports.wrapZodError = wrapZodError;
|
|
3362
|
+
//# sourceMappingURL=chunk-RDP6ZRSM.cjs.map
|
|
3363
|
+
//# sourceMappingURL=chunk-RDP6ZRSM.cjs.map
|