@nicia-ai/typegraph 0.46.1 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -1
- package/dist/backend/drizzle/indexes.cjs +9 -9
- package/dist/backend/drizzle/indexes.d.cts +1 -1
- package/dist/backend/drizzle/indexes.d.ts +1 -1
- package/dist/backend/drizzle/indexes.js +5 -5
- package/dist/backend/index.cjs +50 -49
- package/dist/backend/index.d.cts +3 -3
- package/dist/backend/index.d.ts +3 -3
- package/dist/backend/index.js +11 -10
- package/dist/backend/postgres/index.cjs +27 -26
- package/dist/backend/postgres/index.d.cts +6 -6
- package/dist/backend/postgres/index.d.ts +6 -6
- package/dist/backend/postgres/index.js +14 -13
- package/dist/backend/postgres/pglite-store.cjs +34 -33
- package/dist/backend/postgres/pglite-store.cjs.map +1 -1
- package/dist/backend/postgres/pglite-store.d.cts +8 -8
- package/dist/backend/postgres/pglite-store.d.ts +8 -8
- package/dist/backend/postgres/pglite-store.js +30 -29
- package/dist/backend/postgres/pglite-store.js.map +1 -1
- package/dist/backend/postgres/pglite.cjs +16 -15
- package/dist/backend/postgres/pglite.d.cts +3 -3
- package/dist/backend/postgres/pglite.d.ts +3 -3
- package/dist/backend/postgres/pglite.js +15 -14
- package/dist/backend/sqlite/index.cjs +24 -23
- package/dist/backend/sqlite/index.d.cts +6 -6
- package/dist/backend/sqlite/index.d.ts +6 -6
- package/dist/backend/sqlite/index.js +12 -11
- package/dist/backend/sqlite/libsql.cjs +19 -18
- package/dist/backend/sqlite/libsql.cjs.map +1 -1
- package/dist/backend/sqlite/libsql.d.cts +3 -3
- package/dist/backend/sqlite/libsql.d.ts +3 -3
- package/dist/backend/sqlite/libsql.js +14 -13
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local-store.cjs +35 -34
- package/dist/backend/sqlite/local-store.cjs.map +1 -1
- package/dist/backend/sqlite/local-store.d.cts +8 -8
- package/dist/backend/sqlite/local-store.d.ts +8 -8
- package/dist/backend/sqlite/local-store.js +31 -30
- package/dist/backend/sqlite/local-store.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +17 -16
- package/dist/backend/sqlite/local.d.cts +3 -3
- package/dist/backend/sqlite/local.d.ts +3 -3
- package/dist/backend/sqlite/local.js +15 -14
- package/dist/{chunk-NK5Q7UNE.cjs → chunk-26YKDNUD.cjs} +10 -10
- package/dist/{chunk-NK5Q7UNE.cjs.map → chunk-26YKDNUD.cjs.map} +1 -1
- package/dist/{chunk-PQBQG7IM.js → chunk-3DMMGT6S.js} +3 -3
- package/dist/{chunk-PQBQG7IM.js.map → chunk-3DMMGT6S.js.map} +1 -1
- package/dist/{chunk-XBYVV3MP.cjs → chunk-3HGRTCDU.cjs} +6 -4
- package/dist/chunk-3HGRTCDU.cjs.map +1 -0
- package/dist/{chunk-NFCVHQ5P.cjs → chunk-3U5ABFDW.cjs} +26 -26
- package/dist/{chunk-NFCVHQ5P.cjs.map → chunk-3U5ABFDW.cjs.map} +1 -1
- package/dist/{chunk-MCLYU6BN.cjs → chunk-425IZOQ5.cjs} +11 -164
- package/dist/chunk-425IZOQ5.cjs.map +1 -0
- package/dist/{chunk-M4BDU5RX.cjs → chunk-5FBRVORR.cjs} +12 -12
- package/dist/{chunk-M4BDU5RX.cjs.map → chunk-5FBRVORR.cjs.map} +1 -1
- package/dist/{chunk-C23WSN5E.js → chunk-5FT3TLPK.js} +20 -14
- package/dist/chunk-5FT3TLPK.js.map +1 -0
- package/dist/{chunk-YBFHZUXX.js → chunk-5UMTUOM5.js} +6 -6
- package/dist/{chunk-YBFHZUXX.js.map → chunk-5UMTUOM5.js.map} +1 -1
- package/dist/{chunk-HFHTMECK.js → chunk-6FWSNSRE.js} +7 -7
- package/dist/{chunk-HFHTMECK.js.map → chunk-6FWSNSRE.js.map} +1 -1
- package/dist/{chunk-65E3XWGF.cjs → chunk-6JVZSOHQ.cjs} +91 -91
- package/dist/{chunk-65E3XWGF.cjs.map → chunk-6JVZSOHQ.cjs.map} +1 -1
- package/dist/chunk-6KFLYYOC.cjs +161 -0
- package/dist/chunk-6KFLYYOC.cjs.map +1 -0
- package/dist/{chunk-LBJKZXDE.cjs → chunk-6NGW27EO.cjs} +10 -10
- package/dist/{chunk-LBJKZXDE.cjs.map → chunk-6NGW27EO.cjs.map} +1 -1
- package/dist/{chunk-5UVRGXD3.js → chunk-6SWPJEYN.js} +5 -5
- package/dist/{chunk-5UVRGXD3.js.map → chunk-6SWPJEYN.js.map} +1 -1
- package/dist/{chunk-BKCUOV7A.js → chunk-7SQSZN2J.js} +5 -5
- package/dist/{chunk-BKCUOV7A.js.map → chunk-7SQSZN2J.js.map} +1 -1
- package/dist/{chunk-YAAM3M2S.cjs → chunk-AMMWA76F.cjs} +51 -59
- package/dist/chunk-AMMWA76F.cjs.map +1 -0
- package/dist/{chunk-62ZP23AW.cjs → chunk-AOSSQDVO.cjs} +13 -13
- package/dist/{chunk-62ZP23AW.cjs.map → chunk-AOSSQDVO.cjs.map} +1 -1
- package/dist/{chunk-NLI2AVEF.js → chunk-AVGUJWVX.js} +30 -10
- package/dist/chunk-AVGUJWVX.js.map +1 -0
- package/dist/{chunk-TQR4KBY2.cjs → chunk-BCQ76AXA.cjs} +262 -155
- package/dist/chunk-BCQ76AXA.cjs.map +1 -0
- package/dist/{chunk-CXBHOOIQ.cjs → chunk-BFUOME67.cjs} +11 -11
- package/dist/{chunk-CXBHOOIQ.cjs.map → chunk-BFUOME67.cjs.map} +1 -1
- package/dist/{chunk-PNTCATDE.cjs → chunk-BR7SHKGM.cjs} +1672 -1400
- package/dist/chunk-BR7SHKGM.cjs.map +1 -0
- package/dist/{chunk-ASTI57H3.js → chunk-CHAOFCHV.js} +3 -3
- package/dist/{chunk-ASTI57H3.js.map → chunk-CHAOFCHV.js.map} +1 -1
- package/dist/chunk-CICO5GXD.cjs +12 -0
- package/dist/{chunk-A4OC4DVN.cjs.map → chunk-CICO5GXD.cjs.map} +1 -1
- package/dist/{chunk-T4XNKYXB.js → chunk-D5R42W5D.js} +4 -4
- package/dist/{chunk-T4XNKYXB.js.map → chunk-D5R42W5D.js.map} +1 -1
- package/dist/{chunk-S6PW7VV5.js → chunk-DJZTXBWY.js} +410 -138
- package/dist/chunk-DJZTXBWY.js.map +1 -0
- package/dist/{chunk-UDISNXDL.cjs → chunk-DO7SAMEK.cjs} +47 -47
- package/dist/{chunk-UDISNXDL.cjs.map → chunk-DO7SAMEK.cjs.map} +1 -1
- package/dist/{chunk-VCRRKBLN.cjs → chunk-EDN4Y4ZG.cjs} +9 -9
- package/dist/{chunk-VCRRKBLN.cjs.map → chunk-EDN4Y4ZG.cjs.map} +1 -1
- package/dist/{chunk-YVWGEQJE.cjs → chunk-EMIB2RXD.cjs} +139 -133
- package/dist/chunk-EMIB2RXD.cjs.map +1 -0
- package/dist/{chunk-2Z2Z3ZD6.js → chunk-EP4RUYD6.js} +3 -3
- package/dist/{chunk-2Z2Z3ZD6.js.map → chunk-EP4RUYD6.js.map} +1 -1
- package/dist/{chunk-M3WP7RQZ.js → chunk-FNOMT74T.js} +10 -8
- package/dist/chunk-FNOMT74T.js.map +1 -0
- package/dist/{chunk-E4WNQBEF.cjs → chunk-FQPEMEWX.cjs} +12 -12
- package/dist/{chunk-E4WNQBEF.cjs.map → chunk-FQPEMEWX.cjs.map} +1 -1
- package/dist/{chunk-WDGA7IYB.js → chunk-GLHXM7C4.js} +3 -3
- package/dist/{chunk-WDGA7IYB.js.map → chunk-GLHXM7C4.js.map} +1 -1
- package/dist/{chunk-7BQXPCGN.cjs → chunk-GYEG3ZLZ.cjs} +10 -10
- package/dist/{chunk-7BQXPCGN.cjs.map → chunk-GYEG3ZLZ.cjs.map} +1 -1
- package/dist/{chunk-VLT6PEWR.cjs → chunk-GYUJZARH.cjs} +4 -4
- package/dist/{chunk-VLT6PEWR.cjs.map → chunk-GYUJZARH.cjs.map} +1 -1
- package/dist/{chunk-RMQLSPA2.cjs → chunk-HDL2ARHX.cjs} +27 -27
- package/dist/{chunk-RMQLSPA2.cjs.map → chunk-HDL2ARHX.cjs.map} +1 -1
- package/dist/{chunk-775A4ZMN.js → chunk-HEV35TGT.js} +4 -4
- package/dist/{chunk-775A4ZMN.js.map → chunk-HEV35TGT.js.map} +1 -1
- package/dist/{chunk-3DHZCOT7.cjs → chunk-I4G3SQPF.cjs} +20 -20
- package/dist/{chunk-3DHZCOT7.cjs.map → chunk-I4G3SQPF.cjs.map} +1 -1
- package/dist/{chunk-VGTJPTIC.js → chunk-JONXFAPO.js} +5 -5
- package/dist/{chunk-VGTJPTIC.js.map → chunk-JONXFAPO.js.map} +1 -1
- package/dist/{chunk-BSFJMMV3.cjs → chunk-JR6SX5RH.cjs} +4 -4
- package/dist/{chunk-BSFJMMV3.cjs.map → chunk-JR6SX5RH.cjs.map} +1 -1
- package/dist/{chunk-YBQOHKHN.cjs → chunk-KABFHAL7.cjs} +100 -99
- package/dist/chunk-KABFHAL7.cjs.map +1 -0
- package/dist/{chunk-7VQXLT5O.js → chunk-KH7XW7VV.js} +111 -27
- package/dist/chunk-KH7XW7VV.js.map +1 -0
- package/dist/{chunk-DCQVHAYQ.js → chunk-KKBDXCLQ.js} +4 -4
- package/dist/{chunk-DCQVHAYQ.js.map → chunk-KKBDXCLQ.js.map} +1 -1
- package/dist/{chunk-4UGOKMI5.cjs → chunk-L3LQNR34.cjs} +161 -161
- package/dist/{chunk-4UGOKMI5.cjs.map → chunk-L3LQNR34.cjs.map} +1 -1
- package/dist/{chunk-NMWDXFPH.js → chunk-LEWHMOUY.js} +46 -56
- package/dist/chunk-LEWHMOUY.js.map +1 -0
- package/dist/{chunk-U63GDNRC.cjs → chunk-LRQKXRXO.cjs} +4 -4
- package/dist/{chunk-U63GDNRC.cjs.map → chunk-LRQKXRXO.cjs.map} +1 -1
- package/dist/{chunk-5763DULU.js → chunk-M35DF33T.js} +147 -40
- package/dist/chunk-M35DF33T.js.map +1 -0
- package/dist/{chunk-Q3G6A4I3.cjs → chunk-MFZR4QKM.cjs} +30 -28
- package/dist/chunk-MFZR4QKM.cjs.map +1 -0
- package/dist/chunk-MKJ4KXL5.cjs +12 -0
- package/dist/{chunk-VQH4VAWD.cjs.map → chunk-MKJ4KXL5.cjs.map} +1 -1
- package/dist/{chunk-NI72YOJB.cjs → chunk-MRDBBHIZ.cjs} +70 -2
- package/dist/chunk-MRDBBHIZ.cjs.map +1 -0
- package/dist/{chunk-DTVWX77L.cjs → chunk-MX4DHSQP.cjs} +1023 -360
- package/dist/chunk-MX4DHSQP.cjs.map +1 -0
- package/dist/{chunk-2LG2XB2M.js → chunk-MYKHJI2J.js} +3 -3
- package/dist/{chunk-2LG2XB2M.js.map → chunk-MYKHJI2J.js.map} +1 -1
- package/dist/{chunk-JZUR7ZWE.js → chunk-NAZ2RA4L.js} +3 -3
- package/dist/{chunk-JZUR7ZWE.js.map → chunk-NAZ2RA4L.js.map} +1 -1
- package/dist/{chunk-XL7SLCXS.js → chunk-NG2RB5WL.js} +4 -145
- package/dist/chunk-NG2RB5WL.js.map +1 -0
- package/dist/{chunk-GF3KXUTW.js → chunk-NNQ6A3RM.js} +803 -143
- package/dist/chunk-NNQ6A3RM.js.map +1 -0
- package/dist/{chunk-MSY7FSX4.js → chunk-NVY5CJFP.js} +4 -4
- package/dist/{chunk-MSY7FSX4.js.map → chunk-NVY5CJFP.js.map} +1 -1
- package/dist/{chunk-XCAGZAKP.cjs → chunk-OI2GQ25X.cjs} +7 -7
- package/dist/{chunk-XCAGZAKP.cjs.map → chunk-OI2GQ25X.cjs.map} +1 -1
- package/dist/{chunk-PF6F5NLJ.cjs → chunk-OIFSOPSR.cjs} +259 -238
- package/dist/chunk-OIFSOPSR.cjs.map +1 -0
- package/dist/{chunk-UV3SN74I.js → chunk-OMZ37BM2.js} +5 -5
- package/dist/{chunk-UV3SN74I.js.map → chunk-OMZ37BM2.js.map} +1 -1
- package/dist/{chunk-PNN7RHVR.cjs → chunk-OORXGFL5.cjs} +48 -48
- package/dist/{chunk-PNN7RHVR.cjs.map → chunk-OORXGFL5.cjs.map} +1 -1
- package/dist/{chunk-YWGVVALJ.js → chunk-OVI7IXYX.js} +3 -3
- package/dist/{chunk-YWGVVALJ.js.map → chunk-OVI7IXYX.js.map} +1 -1
- package/dist/{chunk-I5MOXA4H.js → chunk-P6YLZTRE.js} +3 -3
- package/dist/{chunk-I5MOXA4H.js.map → chunk-P6YLZTRE.js.map} +1 -1
- package/dist/{chunk-WQZLUGVR.js → chunk-QS3NQZVC.js} +82 -16
- package/dist/chunk-QS3NQZVC.js.map +1 -0
- package/dist/{chunk-5262ZMTR.js → chunk-QTD6HX4O.js} +5 -5
- package/dist/{chunk-5262ZMTR.js.map → chunk-QTD6HX4O.js.map} +1 -1
- package/dist/{chunk-MXJDTH5B.cjs → chunk-ROR5ZR6A.cjs} +45 -45
- package/dist/{chunk-MXJDTH5B.cjs.map → chunk-ROR5ZR6A.cjs.map} +1 -1
- package/dist/{chunk-CBTIUB76.js → chunk-SDBBMD4N.js} +3 -3
- package/dist/{chunk-CBTIUB76.js.map → chunk-SDBBMD4N.js.map} +1 -1
- package/dist/{chunk-L65OU2U3.js → chunk-SE6EGQSD.js} +78 -16
- package/dist/chunk-SE6EGQSD.js.map +1 -0
- package/dist/{chunk-JXA2ZP2Q.js → chunk-SHFBB23Q.js} +4 -4
- package/dist/{chunk-JXA2ZP2Q.js.map → chunk-SHFBB23Q.js.map} +1 -1
- package/dist/{chunk-AKLS3BYZ.js → chunk-SHSSRCFR.js} +5 -3
- package/dist/chunk-SHSSRCFR.js.map +1 -0
- package/dist/{chunk-2NA5DYLO.cjs → chunk-TZEGUG6D.cjs} +4 -4
- package/dist/{chunk-2NA5DYLO.cjs.map → chunk-TZEGUG6D.cjs.map} +1 -1
- package/dist/{chunk-CMWHLBVN.cjs → chunk-U5EDAVOJ.cjs} +140 -74
- package/dist/chunk-U5EDAVOJ.cjs.map +1 -0
- package/dist/{chunk-MUK4BU7K.cjs → chunk-UPAJHMW3.cjs} +210 -126
- package/dist/chunk-UPAJHMW3.cjs.map +1 -0
- package/dist/{chunk-PT7RIRIZ.cjs → chunk-WGX7JH7E.cjs} +235 -170
- package/dist/chunk-WGX7JH7E.cjs.map +1 -0
- package/dist/{chunk-U5SON7R2.cjs → chunk-WODMN3Q2.cjs} +27 -27
- package/dist/{chunk-U5SON7R2.cjs.map → chunk-WODMN3Q2.cjs.map} +1 -1
- package/dist/{chunk-K5ELX2GT.js → chunk-XVWOYKIK.js} +3 -3
- package/dist/{chunk-K5ELX2GT.js.map → chunk-XVWOYKIK.js.map} +1 -1
- package/dist/chunk-XY5OMOJD.js +147 -0
- package/dist/chunk-XY5OMOJD.js.map +1 -0
- package/dist/{chunk-LGHCOKTT.js → chunk-XYBQI6LE.js} +14 -14
- package/dist/{chunk-LGHCOKTT.js.map → chunk-XYBQI6LE.js.map} +1 -1
- package/dist/{chunk-YDFDBE6D.js → chunk-ZDKTPBGV.js} +4 -4
- package/dist/{chunk-YDFDBE6D.js.map → chunk-ZDKTPBGV.js.map} +1 -1
- package/dist/{chunk-MZLPX2R7.js → chunk-ZHNXLS3C.js} +9 -8
- package/dist/chunk-ZHNXLS3C.js.map +1 -0
- package/dist/{chunk-J3WZ3FA2.js → chunk-ZLONH2UD.js} +67 -3
- package/dist/chunk-ZLONH2UD.js.map +1 -0
- package/dist/core/index.cjs +28 -27
- package/dist/core/index.d.cts +4 -4
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +8 -7
- package/dist/{ddl-BXfGHbPN.d.ts → ddl-CprnMXJ-.d.ts} +3 -3
- package/dist/{ddl-BJcOp4WZ.d.cts → ddl-DJA7Lci5.d.cts} +3 -3
- package/dist/graph-extension/index.cjs +20 -20
- package/dist/graph-extension/index.d.cts +4 -4
- package/dist/graph-extension/index.d.ts +4 -4
- package/dist/graph-extension/index.js +4 -4
- package/dist/graph-merge/index.cjs +3204 -635
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +502 -60
- package/dist/graph-merge/index.d.ts +502 -60
- package/dist/graph-merge/index.js +2979 -427
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-BSHvKfok.d.ts → index-CHTv4XMZ.d.cts} +64 -3
- package/dist/{index-DxaYCv8Y.d.cts → index-CzoJ3MUw.d.ts} +64 -3
- package/dist/index.cjs +232 -215
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -11
- package/dist/index.d.ts +11 -11
- package/dist/index.js +35 -34
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +13 -13
- package/dist/indexes/index.d.cts +4 -4
- package/dist/indexes/index.d.ts +4 -4
- package/dist/indexes/index.js +6 -6
- package/dist/interchange/index.cjs +53 -52
- package/dist/interchange/index.cjs.map +1 -1
- package/dist/interchange/index.d.cts +17 -13
- package/dist/interchange/index.d.ts +17 -13
- package/dist/interchange/index.js +17 -16
- package/dist/interchange/index.js.map +1 -1
- package/dist/{manager-CfZAimti.d.ts → manager-B6sOQzcQ.d.ts} +2 -2
- package/dist/{manager-HGk6E_HW.d.cts → manager-DlY1vlla.d.cts} +2 -2
- package/dist/{materialize-indexes-BMJP6Tms.d.ts → materialize-indexes-DQL4xcpf.d.ts} +1 -1
- package/dist/{materialize-indexes-6A7dWGtb.d.cts → materialize-indexes-sskhp-c_.d.cts} +1 -1
- package/dist/{postgres-DFYWENdR.d.cts → postgres-B6YOUcaK.d.ts} +1 -1
- package/dist/{postgres-e7a9TdvR.d.ts → postgres-BXy_nyMs.d.cts} +1 -1
- package/dist/profiler/index.d.cts +9 -9
- package/dist/profiler/index.d.ts +9 -9
- package/dist/provenance/index.cjs +43 -42
- 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 +10 -9
- package/dist/provenance/index.js.map +1 -1
- package/dist/schema/index.cjs +45 -44
- package/dist/schema/index.d.cts +6 -6
- package/dist/schema/index.d.ts +6 -6
- package/dist/schema/index.js +18 -17
- package/dist/{searchable-CIje5XYD.d.cts → searchable-0Cn_lY8U.d.cts} +1 -1
- package/dist/{searchable-9OQoPuRs.d.ts → searchable-D9gMiwcS.d.ts} +1 -1
- package/dist/{sqlite-DerU5tc7.d.ts → sqlite-ClXuBYAj.d.ts} +1 -1
- package/dist/{sqlite-DitnISa9.d.cts → sqlite-DioSxaPe.d.cts} +1 -1
- package/dist/{store-ClQ-MZQS.d.ts → store-5j-w5onJ.d.ts} +128 -69
- package/dist/{store-B0h6x7wo.d.cts → store-CFedKGU5.d.cts} +128 -69
- package/dist/{temporal-Bn-Fi8FJ.d.cts → temporal-Ce1pG0S1.d.cts} +1 -1
- package/dist/{temporal-BtM4UALv.d.ts → temporal-CjO9FH1l.d.ts} +1 -1
- package/dist/{types-KFfk-8Ah.d.ts → types-BrdOFu48.d.ts} +1 -1
- package/dist/{types-HkveCCx0.d.ts → types-DKkMJZjR.d.cts} +39 -12
- package/dist/{types-HkveCCx0.d.cts → types-DKkMJZjR.d.ts} +39 -12
- package/dist/{types-CoIx8HX5.d.cts → types-oj_OGAaZ.d.cts} +1 -1
- package/dist/{where-ws5hf-Ov.d.ts → where-C8w2627G.d.ts} +1 -1
- package/dist/{where--fk7_0kv.d.cts → where-D1wKCJ4Q.d.cts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-5763DULU.js.map +0 -1
- package/dist/chunk-7VQXLT5O.js.map +0 -1
- package/dist/chunk-A4OC4DVN.cjs +0 -12
- package/dist/chunk-AKLS3BYZ.js.map +0 -1
- package/dist/chunk-C23WSN5E.js.map +0 -1
- package/dist/chunk-CMWHLBVN.cjs.map +0 -1
- package/dist/chunk-DTVWX77L.cjs.map +0 -1
- package/dist/chunk-GF3KXUTW.js.map +0 -1
- package/dist/chunk-J3WZ3FA2.js.map +0 -1
- package/dist/chunk-L65OU2U3.js.map +0 -1
- package/dist/chunk-M3WP7RQZ.js.map +0 -1
- package/dist/chunk-MCLYU6BN.cjs.map +0 -1
- package/dist/chunk-MUK4BU7K.cjs.map +0 -1
- package/dist/chunk-MZLPX2R7.js.map +0 -1
- package/dist/chunk-NI72YOJB.cjs.map +0 -1
- package/dist/chunk-NLI2AVEF.js.map +0 -1
- package/dist/chunk-NMWDXFPH.js.map +0 -1
- package/dist/chunk-PF6F5NLJ.cjs.map +0 -1
- package/dist/chunk-PNTCATDE.cjs.map +0 -1
- package/dist/chunk-PT7RIRIZ.cjs.map +0 -1
- package/dist/chunk-Q3G6A4I3.cjs.map +0 -1
- package/dist/chunk-S6PW7VV5.js.map +0 -1
- package/dist/chunk-TQR4KBY2.cjs.map +0 -1
- package/dist/chunk-VQH4VAWD.cjs +0 -12
- package/dist/chunk-WQZLUGVR.js.map +0 -1
- package/dist/chunk-XBYVV3MP.cjs.map +0 -1
- package/dist/chunk-XL7SLCXS.js.map +0 -1
- package/dist/chunk-YAAM3M2S.cjs.map +0 -1
- package/dist/chunk-YBQOHKHN.cjs.map +0 -1
- package/dist/chunk-YVWGEQJE.cjs.map +0 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
3
|
+
var chunkJR6SX5RH_cjs = require('./chunk-JR6SX5RH.cjs');
|
|
4
|
+
var chunk3U5ABFDW_cjs = require('./chunk-3U5ABFDW.cjs');
|
|
5
|
+
var chunk3HGRTCDU_cjs = require('./chunk-3HGRTCDU.cjs');
|
|
6
|
+
var chunk6KFLYYOC_cjs = require('./chunk-6KFLYYOC.cjs');
|
|
7
|
+
var chunk425IZOQ5_cjs = require('./chunk-425IZOQ5.cjs');
|
|
8
|
+
var chunkEDN4Y4ZG_cjs = require('./chunk-EDN4Y4ZG.cjs');
|
|
8
9
|
var chunkRT5ZY4XA_cjs = require('./chunk-RT5ZY4XA.cjs');
|
|
9
|
-
var
|
|
10
|
+
var chunkMRDBBHIZ_cjs = require('./chunk-MRDBBHIZ.cjs');
|
|
10
11
|
var chunkA7J2YDDI_cjs = require('./chunk-A7J2YDDI.cjs');
|
|
11
12
|
var chunkN66HCGCY_cjs = require('./chunk-N66HCGCY.cjs');
|
|
12
13
|
var nanoid = require('nanoid');
|
|
@@ -15,7 +16,7 @@ var nanoid = require('nanoid');
|
|
|
15
16
|
var pinnedReadInstant;
|
|
16
17
|
function withPinnedReadInstant(emit) {
|
|
17
18
|
if (pinnedReadInstant !== void 0) return emit();
|
|
18
|
-
pinnedReadInstant =
|
|
19
|
+
pinnedReadInstant = chunk425IZOQ5_cjs.nowIso();
|
|
19
20
|
try {
|
|
20
21
|
return emit();
|
|
21
22
|
} finally {
|
|
@@ -23,27 +24,27 @@ function withPinnedReadInstant(emit) {
|
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
function currentReadInstant() {
|
|
26
|
-
return
|
|
27
|
+
return chunkEDN4Y4ZG_cjs.sql`${pinnedReadInstant ?? chunk425IZOQ5_cjs.nowIso()}`;
|
|
27
28
|
}
|
|
28
29
|
var CURRENT_READ_INSTANT_PLACEHOLDER = "__typegraph_current_read_instant__";
|
|
29
30
|
function currentReadInstantPlaceholder() {
|
|
30
|
-
return
|
|
31
|
+
return chunkEDN4Y4ZG_cjs.sql`${chunkEDN4Y4ZG_cjs.sql.placeholder(CURRENT_READ_INSTANT_PLACEHOLDER)}`;
|
|
31
32
|
}
|
|
32
33
|
function currentReadInstantFor(mode) {
|
|
33
34
|
return mode === "placeholder" ? currentReadInstantPlaceholder() : currentReadInstant();
|
|
34
35
|
}
|
|
35
36
|
function compileTemporalFilter(options) {
|
|
36
37
|
const { mode, asOf, tableAlias, currentTimestamp, recordedAsOf } = options;
|
|
37
|
-
const recorded =
|
|
38
|
-
const prefix = tableAlias ?
|
|
39
|
-
const deletedAt =
|
|
40
|
-
const validFrom =
|
|
41
|
-
const validTo =
|
|
38
|
+
const recorded = chunk6KFLYYOC_cjs.optionalRecordedInstantParts(recordedAsOf, "recordedAsOf");
|
|
39
|
+
const prefix = tableAlias ? chunkEDN4Y4ZG_cjs.sql.raw(`${tableAlias}.`) : chunkEDN4Y4ZG_cjs.sql.raw("");
|
|
40
|
+
const deletedAt = chunkEDN4Y4ZG_cjs.sql`${prefix}deleted_at`;
|
|
41
|
+
const validFrom = chunkEDN4Y4ZG_cjs.sql`${prefix}valid_from`;
|
|
42
|
+
const validTo = chunkEDN4Y4ZG_cjs.sql`${prefix}valid_to`;
|
|
42
43
|
const validFilter = (() => {
|
|
43
44
|
switch (mode) {
|
|
44
45
|
case "current": {
|
|
45
|
-
const now = recorded === void 0 ? currentTimestamp ?? currentReadInstant() :
|
|
46
|
-
return
|
|
46
|
+
const now = recorded === void 0 ? currentTimestamp ?? currentReadInstant() : chunkEDN4Y4ZG_cjs.sql`${recorded.recordedAt}`;
|
|
47
|
+
return chunkEDN4Y4ZG_cjs.sql`${deletedAt} IS NULL AND (${validFrom} IS NULL OR ${validFrom} <= ${now}) AND (${validTo} IS NULL OR ${validTo} > ${now})`;
|
|
47
48
|
}
|
|
48
49
|
case "asOf": {
|
|
49
50
|
if (asOf === void 0) {
|
|
@@ -52,21 +53,21 @@ function compileTemporalFilter(options) {
|
|
|
52
53
|
);
|
|
53
54
|
}
|
|
54
55
|
const timestamp = asOf;
|
|
55
|
-
return
|
|
56
|
+
return chunkEDN4Y4ZG_cjs.sql`${deletedAt} IS NULL AND (${validFrom} IS NULL OR ${validFrom} <= ${timestamp}) AND (${validTo} IS NULL OR ${validTo} > ${timestamp})`;
|
|
56
57
|
}
|
|
57
58
|
case "includeEnded": {
|
|
58
|
-
return
|
|
59
|
+
return chunkEDN4Y4ZG_cjs.sql`${deletedAt} IS NULL`;
|
|
59
60
|
}
|
|
60
61
|
case "includeTombstones": {
|
|
61
|
-
return
|
|
62
|
+
return chunkEDN4Y4ZG_cjs.sql.raw("1=1");
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
})();
|
|
65
66
|
if (recorded === void 0) return validFilter;
|
|
66
|
-
const recordedFrom =
|
|
67
|
-
const recordedTo =
|
|
67
|
+
const recordedFrom = chunkEDN4Y4ZG_cjs.sql`${prefix}recorded_from`;
|
|
68
|
+
const recordedTo = chunkEDN4Y4ZG_cjs.sql`${prefix}recorded_to`;
|
|
68
69
|
const { revision } = recorded;
|
|
69
|
-
return
|
|
70
|
+
return chunkEDN4Y4ZG_cjs.sql`(${validFilter}) AND ${recordedFrom} <= ${revision} AND ${revision} < ${recordedTo}`;
|
|
70
71
|
}
|
|
71
72
|
function extractTemporalOptions(ast, tableAlias) {
|
|
72
73
|
return {
|
|
@@ -154,7 +155,7 @@ function predicate(expr) {
|
|
|
154
155
|
}
|
|
155
156
|
function param(name) {
|
|
156
157
|
if (name === CURRENT_READ_INSTANT_PLACEHOLDER) {
|
|
157
|
-
throw new
|
|
158
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
158
159
|
`Parameter name "${name}" is reserved for internal use`,
|
|
159
160
|
{ parameterName: name }
|
|
160
161
|
);
|
|
@@ -238,7 +239,7 @@ function inComparison(op, field, values) {
|
|
|
238
239
|
}
|
|
239
240
|
const literals = values.map((value) => {
|
|
240
241
|
if (isParameterRef(value)) {
|
|
241
|
-
throw new
|
|
242
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
242
243
|
`param("${value.name}") is not supported as an element of the ${op}() list`,
|
|
243
244
|
{ parameterName: value.name },
|
|
244
245
|
{
|
|
@@ -320,7 +321,7 @@ function createFulltextAccessor(alias, hasSearchableField) {
|
|
|
320
321
|
return {
|
|
321
322
|
matches: (query, k, options) => {
|
|
322
323
|
if (!hasSearchableField()) {
|
|
323
|
-
throw new
|
|
324
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
324
325
|
`Cannot call .$fulltext.matches() on alias "${alias}" \u2014 its node kind has no fields declared with searchable(). Add at least one: \`title: searchable({ language: "english" })\`.`
|
|
325
326
|
);
|
|
326
327
|
}
|
|
@@ -335,7 +336,7 @@ function createFulltextAccessor(alias, hasSearchableField) {
|
|
|
335
336
|
}
|
|
336
337
|
function fulltextMatch(field, query, limit, options) {
|
|
337
338
|
if (!Number.isFinite(limit) || limit <= 0) {
|
|
338
|
-
throw new
|
|
339
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
339
340
|
`matches() limit must be a positive finite number, got ${String(limit)}`
|
|
340
341
|
);
|
|
341
342
|
}
|
|
@@ -608,7 +609,7 @@ function notInSubquery(field, subquery) {
|
|
|
608
609
|
function assertSingleColumnSubquery(subquery) {
|
|
609
610
|
const columnCount = getSubqueryColumnCount(subquery);
|
|
610
611
|
if (columnCount === 1) return;
|
|
611
|
-
throw new
|
|
612
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
612
613
|
`IN/NOT IN subquery must project exactly 1 column, but got ${columnCount}`,
|
|
613
614
|
{ subqueryColumnCount: columnCount },
|
|
614
615
|
{
|
|
@@ -621,7 +622,7 @@ function assertCompatibleSubqueryValueTypes(field, subquery) {
|
|
|
621
622
|
const subqueryValueType = getSingleSubqueryColumnValueType(subquery);
|
|
622
623
|
const resolvedValueType = fieldValueType ?? subqueryValueType;
|
|
623
624
|
if (isUnsupportedInSubqueryValueType(resolvedValueType)) {
|
|
624
|
-
throw new
|
|
625
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
625
626
|
`IN/NOT IN subquery does not support ${String(resolvedValueType)} values`,
|
|
626
627
|
{ valueType: resolvedValueType },
|
|
627
628
|
{
|
|
@@ -632,7 +633,7 @@ function assertCompatibleSubqueryValueTypes(field, subquery) {
|
|
|
632
633
|
if (isInSubqueryTypeCompatible(fieldValueType, subqueryValueType)) {
|
|
633
634
|
return;
|
|
634
635
|
}
|
|
635
|
-
throw new
|
|
636
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
636
637
|
`IN/NOT IN type mismatch: field type "${String(fieldValueType)}" does not match subquery column type "${String(subqueryValueType)}"`,
|
|
637
638
|
{
|
|
638
639
|
fieldValueType,
|
|
@@ -651,7 +652,7 @@ var RECORDED_ISOLATION_REQUIRES_POSTGRES_CHECK = {
|
|
|
651
652
|
};
|
|
652
653
|
function requireRecordedSchema(target) {
|
|
653
654
|
if (target.tableNames === void 0) {
|
|
654
|
-
throw new
|
|
655
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
655
656
|
"Recorded-time capture requires the backend to expose tableNames.",
|
|
656
657
|
{ dialect: target.dialect },
|
|
657
658
|
{
|
|
@@ -659,11 +660,11 @@ function requireRecordedSchema(target) {
|
|
|
659
660
|
}
|
|
660
661
|
);
|
|
661
662
|
}
|
|
662
|
-
return
|
|
663
|
+
return chunk3U5ABFDW_cjs.createSqlSchema(target.tableNames);
|
|
663
664
|
}
|
|
664
665
|
function requireCaptureStatements(target) {
|
|
665
666
|
if (target.executeStatement === void 0) {
|
|
666
|
-
throw new
|
|
667
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
667
668
|
"Recorded-time capture requires backend.executeStatement support on the transaction backend.",
|
|
668
669
|
{ dialect: target.dialect },
|
|
669
670
|
{
|
|
@@ -674,10 +675,10 @@ function requireCaptureStatements(target) {
|
|
|
674
675
|
}
|
|
675
676
|
async function executeStatement(target, query) {
|
|
676
677
|
requireCaptureStatements(target);
|
|
677
|
-
await target.executeStatement(
|
|
678
|
+
await target.executeStatement(chunkEDN4Y4ZG_cjs.asCompiledStatementSql(query));
|
|
678
679
|
}
|
|
679
680
|
function unsupportedPostgresIsolationError(isolationLevel) {
|
|
680
|
-
return new
|
|
681
|
+
return new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
681
682
|
"Recorded-time capture on PostgreSQL requires read_committed isolation.",
|
|
682
683
|
{ isolationLevel: isolationLevel ?? "unknown" },
|
|
683
684
|
{
|
|
@@ -703,7 +704,7 @@ async function assertRecordedCaptureTransactionIsolation(target, options) {
|
|
|
703
704
|
if (!RECORDED_ISOLATION_REQUIRES_POSTGRES_CHECK[target.dialect]) return;
|
|
704
705
|
if (options?.accessMode === "read_only") return;
|
|
705
706
|
const rows = await target.execute(
|
|
706
|
-
|
|
707
|
+
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
707
708
|
SELECT current_setting('transaction_isolation') AS transaction_isolation
|
|
708
709
|
`)
|
|
709
710
|
);
|
|
@@ -714,7 +715,7 @@ async function assertRecordedCaptureTransactionIsolation(target, options) {
|
|
|
714
715
|
throw unsupportedPostgresIsolationError(isolationLevel);
|
|
715
716
|
}
|
|
716
717
|
function recordedCaptureRequiresCallbackTransactionError(details = {}) {
|
|
717
|
-
return new
|
|
718
|
+
return new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
718
719
|
"withTransaction() has no recorded-time capture flush point when history is enabled.",
|
|
719
720
|
{
|
|
720
721
|
...details,
|
|
@@ -726,7 +727,7 @@ function recordedCaptureRequiresCallbackTransactionError(details = {}) {
|
|
|
726
727
|
);
|
|
727
728
|
}
|
|
728
729
|
function historyUnsafeRawWriteError(surface) {
|
|
729
|
-
return new
|
|
730
|
+
return new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
730
731
|
`${surface} is not available when history capture is enabled because raw SQL writes bypass recorded-time capture.`,
|
|
731
732
|
{
|
|
732
733
|
code: "RECORDED_CAPTURE_RAW_SQL_DISABLED"
|
|
@@ -737,7 +738,7 @@ function historyUnsafeRawWriteError(surface) {
|
|
|
737
738
|
);
|
|
738
739
|
}
|
|
739
740
|
function revisionTrackingUnsafeRawWriteError(surface) {
|
|
740
|
-
return new
|
|
741
|
+
return new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
741
742
|
`${surface} is not available when revision tracking is enabled because raw SQL writes bypass the revision anchor.`,
|
|
742
743
|
{
|
|
743
744
|
code: "REVISION_TRACKING_RAW_SQL_DISABLED"
|
|
@@ -773,7 +774,7 @@ function rawWriteGuards(target, prefix) {
|
|
|
773
774
|
}
|
|
774
775
|
function assertCapturableBackend(backend) {
|
|
775
776
|
if (!backend.capabilities.transactions) {
|
|
776
|
-
throw new
|
|
777
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
777
778
|
"history: true requires a backend with transaction support.",
|
|
778
779
|
{ dialect: backend.dialect },
|
|
779
780
|
{
|
|
@@ -782,7 +783,7 @@ function assertCapturableBackend(backend) {
|
|
|
782
783
|
);
|
|
783
784
|
}
|
|
784
785
|
if (backend.executeStatement === void 0) {
|
|
785
|
-
throw new
|
|
786
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
786
787
|
"history: true requires a backend that supports executeStatement.",
|
|
787
788
|
{ dialect: backend.dialect },
|
|
788
789
|
{
|
|
@@ -791,7 +792,7 @@ function assertCapturableBackend(backend) {
|
|
|
791
792
|
);
|
|
792
793
|
}
|
|
793
794
|
if (backend.capabilities.returning === false) {
|
|
794
|
-
throw new
|
|
795
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
795
796
|
"history: true requires a backend that supports UPDATE \u2026 RETURNING.",
|
|
796
797
|
{ dialect: backend.dialect },
|
|
797
798
|
{
|
|
@@ -800,7 +801,7 @@ function assertCapturableBackend(backend) {
|
|
|
800
801
|
);
|
|
801
802
|
}
|
|
802
803
|
if (backend.tableNames === void 0) {
|
|
803
|
-
throw new
|
|
804
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
804
805
|
"history: true requires a backend that exposes tableNames.",
|
|
805
806
|
{ dialect: backend.dialect },
|
|
806
807
|
{
|
|
@@ -811,7 +812,7 @@ function assertCapturableBackend(backend) {
|
|
|
811
812
|
}
|
|
812
813
|
function assertRevisionTrackableBackend(backend) {
|
|
813
814
|
if (!backend.capabilities.transactions) {
|
|
814
|
-
throw new
|
|
815
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
815
816
|
"revisionTracking: true requires a backend with transaction support.",
|
|
816
817
|
{ dialect: backend.dialect },
|
|
817
818
|
{
|
|
@@ -820,7 +821,7 @@ function assertRevisionTrackableBackend(backend) {
|
|
|
820
821
|
);
|
|
821
822
|
}
|
|
822
823
|
if (backend.executeStatement === void 0) {
|
|
823
|
-
throw new
|
|
824
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
824
825
|
"revisionTracking: true requires a backend that supports executeStatement.",
|
|
825
826
|
{ dialect: backend.dialect },
|
|
826
827
|
{
|
|
@@ -829,7 +830,7 @@ function assertRevisionTrackableBackend(backend) {
|
|
|
829
830
|
);
|
|
830
831
|
}
|
|
831
832
|
if (backend.tableNames === void 0) {
|
|
832
|
-
throw new
|
|
833
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
833
834
|
"revisionTracking: true requires a backend that exposes tableNames.",
|
|
834
835
|
{ dialect: backend.dialect },
|
|
835
836
|
{
|
|
@@ -838,7 +839,7 @@ function assertRevisionTrackableBackend(backend) {
|
|
|
838
839
|
);
|
|
839
840
|
}
|
|
840
841
|
if (backend.ensureRevisionOriginsTable === void 0) {
|
|
841
|
-
throw new
|
|
842
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
842
843
|
"revisionTracking: true requires a backend that can bootstrap revision origins.",
|
|
843
844
|
{ dialect: backend.dialect },
|
|
844
845
|
{
|
|
@@ -858,7 +859,7 @@ var USES_RECORDED_GRAPH_ADVISORY_LOCK = {
|
|
|
858
859
|
sqlite: false
|
|
859
860
|
};
|
|
860
861
|
function graphAdvisoryLockSql(namespace, graphId) {
|
|
861
|
-
return
|
|
862
|
+
return chunkEDN4Y4ZG_cjs.sql`
|
|
862
863
|
SELECT pg_advisory_xact_lock(
|
|
863
864
|
hashtext(${namespace}),
|
|
864
865
|
hashtext(${graphId})
|
|
@@ -890,7 +891,7 @@ function registerRecordedGraphLockMemo(backend, memo) {
|
|
|
890
891
|
}
|
|
891
892
|
async function acquireRecordedGraphWriteLock(target, graphId) {
|
|
892
893
|
await target.execute(
|
|
893
|
-
|
|
894
|
+
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(recordedGraphWriteAdvisoryLockSql(graphId))
|
|
894
895
|
);
|
|
895
896
|
}
|
|
896
897
|
async function lockRecordedGraphWrite(target, graphId, memo) {
|
|
@@ -916,7 +917,7 @@ async function lockRecordedGraphWrite(target, graphId, memo) {
|
|
|
916
917
|
return graphWriteLockEvidence();
|
|
917
918
|
}
|
|
918
919
|
function failInvalidClock(value, cause) {
|
|
919
|
-
throw new
|
|
920
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
920
921
|
"Recorded clock row contained an invalid revision or wall time",
|
|
921
922
|
{ value },
|
|
922
923
|
{
|
|
@@ -927,13 +928,13 @@ function failInvalidClock(value, cause) {
|
|
|
927
928
|
}
|
|
928
929
|
function recordedClockRevision(value) {
|
|
929
930
|
const revision = typeof value === "bigint" ? Number(value) : typeof value === "string" && /^\d+$/.test(value) ? Number(value) : value;
|
|
930
|
-
if (typeof revision !== "number" || !Number.isSafeInteger(revision) || revision < RECORDED_MIN_REVISION || revision >=
|
|
931
|
+
if (typeof revision !== "number" || !Number.isSafeInteger(revision) || revision < RECORDED_MIN_REVISION || revision >= chunk6KFLYYOC_cjs.RECORDED_MAX_REVISION) {
|
|
931
932
|
return failInvalidClock(value);
|
|
932
933
|
}
|
|
933
934
|
return revision;
|
|
934
935
|
}
|
|
935
936
|
function recordedClockWallTime(value) {
|
|
936
|
-
return
|
|
937
|
+
return chunk425IZOQ5_cjs.canonicalizeDatabaseTimestamp(value) ?? failInvalidClock(value);
|
|
937
938
|
}
|
|
938
939
|
function recordedClockParts(row) {
|
|
939
940
|
const revision = recordedClockRevision(row.revision);
|
|
@@ -941,7 +942,7 @@ function recordedClockParts(row) {
|
|
|
941
942
|
return { revision, recordedAt: recordedClockWallTime(row.recorded_at) };
|
|
942
943
|
}
|
|
943
944
|
function nextRecordedCommitParts(previous) {
|
|
944
|
-
const wallTime =
|
|
945
|
+
const wallTime = chunk425IZOQ5_cjs.nowIso();
|
|
945
946
|
if (previous === void 0) {
|
|
946
947
|
return { revision: 1, recordedAt: wallTime };
|
|
947
948
|
}
|
|
@@ -959,11 +960,11 @@ function nonDecreasingWallTime(current, previous) {
|
|
|
959
960
|
}
|
|
960
961
|
async function readRecordedClock(target, schema, graphId) {
|
|
961
962
|
const parts = await readRecordedClockParts(target, schema, graphId);
|
|
962
|
-
return parts === void 0 ? void 0 :
|
|
963
|
+
return parts === void 0 ? void 0 : chunk6KFLYYOC_cjs.createRecordedInstant(parts.revision, parts.recordedAt);
|
|
963
964
|
}
|
|
964
965
|
async function readRecordedClockParts(target, schema, graphId) {
|
|
965
966
|
const rows = await target.execute(
|
|
966
|
-
|
|
967
|
+
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
967
968
|
SELECT revision, recorded_at
|
|
968
969
|
FROM ${schema.recordedClockTable}
|
|
969
970
|
WHERE graph_id = ${graphId}
|
|
@@ -974,7 +975,7 @@ async function readRecordedClockParts(target, schema, graphId) {
|
|
|
974
975
|
}
|
|
975
976
|
async function readRevisionOrigin(target, schema, graphId) {
|
|
976
977
|
const rows = await target.execute(
|
|
977
|
-
|
|
978
|
+
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
978
979
|
SELECT origin
|
|
979
980
|
FROM ${schema.revisionOriginsTable}
|
|
980
981
|
WHERE graph_id = ${graphId}
|
|
@@ -983,7 +984,7 @@ async function readRevisionOrigin(target, schema, graphId) {
|
|
|
983
984
|
const first = rows[0];
|
|
984
985
|
if (first === void 0) return void 0;
|
|
985
986
|
if (typeof first.origin !== "string" || first.origin.length === 0) {
|
|
986
|
-
throw new
|
|
987
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
987
988
|
"Revision origin row contained an invalid origin",
|
|
988
989
|
{ graphId, origin: first.origin }
|
|
989
990
|
);
|
|
@@ -993,7 +994,7 @@ async function readRevisionOrigin(target, schema, graphId) {
|
|
|
993
994
|
async function ensureRevisionOrigin(target, schema, graphId) {
|
|
994
995
|
const ensureTable = target.ensureRevisionOriginsTable;
|
|
995
996
|
if (ensureTable === void 0) {
|
|
996
|
-
throw new
|
|
997
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
997
998
|
"Revision tracking requires a backend that can bootstrap revision origins.",
|
|
998
999
|
{ dialect: target.dialect },
|
|
999
1000
|
{
|
|
@@ -1006,7 +1007,7 @@ async function ensureRevisionOrigin(target, schema, graphId) {
|
|
|
1006
1007
|
if (existing !== void 0) return existing;
|
|
1007
1008
|
await executeStatement(
|
|
1008
1009
|
target,
|
|
1009
|
-
|
|
1010
|
+
chunkEDN4Y4ZG_cjs.sql`
|
|
1010
1011
|
INSERT INTO ${schema.revisionOriginsTable} (graph_id, origin)
|
|
1011
1012
|
VALUES (${graphId}, ${generateId()})
|
|
1012
1013
|
ON CONFLICT (graph_id) DO NOTHING
|
|
@@ -1014,7 +1015,7 @@ async function ensureRevisionOrigin(target, schema, graphId) {
|
|
|
1014
1015
|
);
|
|
1015
1016
|
const origin = await readRevisionOrigin(target, schema, graphId);
|
|
1016
1017
|
if (origin !== void 0) return origin;
|
|
1017
|
-
throw new
|
|
1018
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
1018
1019
|
"Revision origin was not persisted after initialization.",
|
|
1019
1020
|
{ graphId, dialect: target.dialect }
|
|
1020
1021
|
);
|
|
@@ -1022,7 +1023,7 @@ async function ensureRevisionOrigin(target, schema, graphId) {
|
|
|
1022
1023
|
async function writeRecordedClock(target, schema, graphId, parts) {
|
|
1023
1024
|
await executeStatement(
|
|
1024
1025
|
target,
|
|
1025
|
-
|
|
1026
|
+
chunkEDN4Y4ZG_cjs.sql`
|
|
1026
1027
|
INSERT INTO ${schema.recordedClockTable} (graph_id, revision, recorded_at)
|
|
1027
1028
|
VALUES (${graphId}, ${parts.revision}, ${parts.recordedAt})
|
|
1028
1029
|
ON CONFLICT (graph_id) DO UPDATE
|
|
@@ -1034,7 +1035,7 @@ async function writeRecordedClock(target, schema, graphId, parts) {
|
|
|
1034
1035
|
async function assertRecordedClockAdvanced(target, schema, graphId, revision) {
|
|
1035
1036
|
const stored = await readRecordedClockParts(target, schema, graphId);
|
|
1036
1037
|
if (stored?.revision === revision) return;
|
|
1037
|
-
throw new
|
|
1038
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
1038
1039
|
"Recorded commit allocation was refused: the supplied previous revision was stale, so the write would have moved the graph's revision clock backward.",
|
|
1039
1040
|
{ graphId, allocatedRevision: revision, storedRevision: stored?.revision },
|
|
1040
1041
|
{
|
|
@@ -1046,7 +1047,7 @@ async function lockRecordedClock(target, schema, graphId, ownsWriteLock) {
|
|
|
1046
1047
|
switch (target.dialect) {
|
|
1047
1048
|
case "postgres": {
|
|
1048
1049
|
await target.execute(
|
|
1049
|
-
|
|
1050
|
+
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(recordedClockAdvisoryLockSql(graphId))
|
|
1050
1051
|
);
|
|
1051
1052
|
return;
|
|
1052
1053
|
}
|
|
@@ -1054,7 +1055,7 @@ async function lockRecordedClock(target, schema, graphId, ownsWriteLock) {
|
|
|
1054
1055
|
if (ownsWriteLock) return;
|
|
1055
1056
|
await executeStatement(
|
|
1056
1057
|
target,
|
|
1057
|
-
|
|
1058
|
+
chunkEDN4Y4ZG_cjs.sql`
|
|
1058
1059
|
INSERT INTO ${schema.recordedClockTable} (graph_id, revision, recorded_at)
|
|
1059
1060
|
VALUES (${graphId}, ${RECORDED_MIN_REVISION}, ${RECORDED_MIN_TIME})
|
|
1060
1061
|
ON CONFLICT (graph_id) DO UPDATE SET revision = revision
|
|
@@ -1069,18 +1070,18 @@ async function lockRecordedClock(target, schema, graphId, ownsWriteLock) {
|
|
|
1069
1070
|
}
|
|
1070
1071
|
async function allocateRecordedCommit(target, schema, graphId, ownsWriteLock, previousRevision) {
|
|
1071
1072
|
await lockRecordedClock(target, schema, graphId, ownsWriteLock);
|
|
1072
|
-
const previous = previousRevision === void 0 ? await readRecordedClockParts(target, schema, graphId) :
|
|
1073
|
+
const previous = previousRevision === void 0 ? await readRecordedClockParts(target, schema, graphId) : chunk6KFLYYOC_cjs.parseRecordedInstant(previousRevision, "previous recorded revision");
|
|
1073
1074
|
const { revision, recordedAt } = nextRecordedCommitParts(previous);
|
|
1074
|
-
if (revision >=
|
|
1075
|
-
throw new
|
|
1076
|
-
`Recorded commit clock reached the open revision sentinel ${
|
|
1075
|
+
if (revision >= chunk6KFLYYOC_cjs.RECORDED_MAX_REVISION) {
|
|
1076
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
1077
|
+
`Recorded commit clock reached the open revision sentinel ${chunk6KFLYYOC_cjs.RECORDED_MAX_REVISION}`,
|
|
1077
1078
|
{ graphId, revision },
|
|
1078
1079
|
{
|
|
1079
1080
|
suggestion: "Start a new graph before exhausting the per-graph recorded revision space."
|
|
1080
1081
|
}
|
|
1081
1082
|
);
|
|
1082
1083
|
}
|
|
1083
|
-
const instant =
|
|
1084
|
+
const instant = chunk6KFLYYOC_cjs.createRecordedInstant(revision, recordedAt);
|
|
1084
1085
|
await writeRecordedClock(target, schema, graphId, { revision, recordedAt });
|
|
1085
1086
|
if (previousRevision !== void 0) {
|
|
1086
1087
|
await assertRecordedClockAdvanced(target, schema, graphId, revision);
|
|
@@ -1163,6 +1164,7 @@ var GRAPH_BACKEND_PROJECTION_KEYS = [
|
|
|
1163
1164
|
"deleteFulltextBatch",
|
|
1164
1165
|
"fulltextSearch",
|
|
1165
1166
|
"ensureIndexMaterializationsTable",
|
|
1167
|
+
"ensureTrigramExtension",
|
|
1166
1168
|
"ensureRevisionOriginsTable",
|
|
1167
1169
|
"getIndexMaterialization",
|
|
1168
1170
|
"getIndexMaterializations",
|
|
@@ -1212,7 +1214,7 @@ function projectBackendMembers(backend, keys) {
|
|
|
1212
1214
|
return [[key, Reflect.get(backend, key)]];
|
|
1213
1215
|
});
|
|
1214
1216
|
const projection = Object.fromEntries(entries);
|
|
1215
|
-
|
|
1217
|
+
chunk3HGRTCDU_cjs.inheritSerializedTransactionResource(projection, backend);
|
|
1216
1218
|
return projection;
|
|
1217
1219
|
}
|
|
1218
1220
|
function createGraphBackendProjection(backend) {
|
|
@@ -1266,7 +1268,7 @@ async function runInsertBatchReturning(dispatch, params) {
|
|
|
1266
1268
|
}
|
|
1267
1269
|
|
|
1268
1270
|
// src/identity/historical-sql.ts
|
|
1269
|
-
var IDENTITY_ASSERTION_COLUMNS =
|
|
1271
|
+
var IDENTITY_ASSERTION_COLUMNS = chunkEDN4Y4ZG_cjs.sql.raw(
|
|
1270
1272
|
[
|
|
1271
1273
|
"graph_id",
|
|
1272
1274
|
"id",
|
|
@@ -1288,35 +1290,35 @@ function identitySqlCoordinate(coordinate, currentInstant) {
|
|
|
1288
1290
|
return {
|
|
1289
1291
|
validMode: coordinate?.valid.mode ?? "current",
|
|
1290
1292
|
validAsOf: coordinate?.valid.asOf,
|
|
1291
|
-
recorded:
|
|
1293
|
+
recorded: chunk6KFLYYOC_cjs.optionalRecordedInstantParts(
|
|
1292
1294
|
coordinate?.recorded?.asOf,
|
|
1293
1295
|
"recorded.asOf"
|
|
1294
1296
|
),
|
|
1295
|
-
currentInstant: typeof currentInstant === "string" ?
|
|
1297
|
+
currentInstant: typeof currentInstant === "string" ? chunkEDN4Y4ZG_cjs.sql`${currentInstant}` : currentInstant
|
|
1296
1298
|
};
|
|
1297
1299
|
}
|
|
1298
1300
|
function validityInstant(coordinate) {
|
|
1299
1301
|
if (coordinate.validMode === "asOf" && coordinate.validAsOf !== void 0) {
|
|
1300
|
-
return
|
|
1302
|
+
return chunkEDN4Y4ZG_cjs.sql`${coordinate.validAsOf}`;
|
|
1301
1303
|
}
|
|
1302
1304
|
if (coordinate.recorded !== void 0) {
|
|
1303
|
-
return
|
|
1305
|
+
return chunkEDN4Y4ZG_cjs.sql`${coordinate.recorded.recordedAt}`;
|
|
1304
1306
|
}
|
|
1305
1307
|
return coordinate.currentInstant;
|
|
1306
1308
|
}
|
|
1307
1309
|
function qualifiedColumn(alias, column) {
|
|
1308
|
-
return
|
|
1310
|
+
return chunkEDN4Y4ZG_cjs.sql`${chunkEDN4Y4ZG_cjs.sql.identifier(alias)}.${chunkEDN4Y4ZG_cjs.sql.identifier(column)}`;
|
|
1309
1311
|
}
|
|
1310
1312
|
function identityNodeVisibilitySql(coordinate, alias) {
|
|
1311
1313
|
const deletedAt = qualifiedColumn(alias, "deleted_at");
|
|
1312
|
-
if (coordinate.validMode === "includeTombstones") return
|
|
1314
|
+
if (coordinate.validMode === "includeTombstones") return chunkEDN4Y4ZG_cjs.sql`1 = 1`;
|
|
1313
1315
|
if (coordinate.validMode === "includeEnded") {
|
|
1314
|
-
return
|
|
1316
|
+
return chunkEDN4Y4ZG_cjs.sql`${deletedAt} IS NULL`;
|
|
1315
1317
|
}
|
|
1316
1318
|
const validFrom = qualifiedColumn(alias, "valid_from");
|
|
1317
1319
|
const validTo = qualifiedColumn(alias, "valid_to");
|
|
1318
1320
|
const instant = validityInstant(coordinate);
|
|
1319
|
-
return
|
|
1321
|
+
return chunkEDN4Y4ZG_cjs.sql`
|
|
1320
1322
|
${deletedAt} IS NULL
|
|
1321
1323
|
AND (${validFrom} IS NULL OR ${validFrom} <= ${instant})
|
|
1322
1324
|
AND (${validTo} IS NULL OR ${validTo} > ${instant})
|
|
@@ -1324,19 +1326,19 @@ function identityNodeVisibilitySql(coordinate, alias) {
|
|
|
1324
1326
|
}
|
|
1325
1327
|
function structuralFoldVisibilitySql(coordinate, alias) {
|
|
1326
1328
|
const deletedAt = qualifiedColumn(alias, "deleted_at");
|
|
1327
|
-
if (coordinate.recorded !== void 0) return
|
|
1328
|
-
if (coordinate.validMode !== "asOf") return
|
|
1329
|
+
if (coordinate.recorded !== void 0) return chunkEDN4Y4ZG_cjs.sql`${deletedAt} IS NULL`;
|
|
1330
|
+
if (coordinate.validMode !== "asOf") return chunkEDN4Y4ZG_cjs.sql`${deletedAt} IS NULL`;
|
|
1329
1331
|
const createdAt = qualifiedColumn(alias, "created_at");
|
|
1330
1332
|
const instant = validityInstant(coordinate);
|
|
1331
|
-
return
|
|
1333
|
+
return chunkEDN4Y4ZG_cjs.sql`${createdAt} <= ${instant} AND (${deletedAt} IS NULL OR ${deletedAt} > ${instant})`;
|
|
1332
1334
|
}
|
|
1333
1335
|
function identityNodeSnapshotSource(schema, graphId, coordinate) {
|
|
1334
1336
|
const table = coordinate.recorded === void 0 ? schema.nodesTable : schema.recordedNodesTable;
|
|
1335
|
-
const recordedFilter = coordinate.recorded === void 0 ?
|
|
1337
|
+
const recordedFilter = coordinate.recorded === void 0 ? chunkEDN4Y4ZG_cjs.sql`` : chunkEDN4Y4ZG_cjs.sql`
|
|
1336
1338
|
AND recorded_from <= ${coordinate.recorded.revision}
|
|
1337
1339
|
AND recorded_to > ${coordinate.recorded.revision}
|
|
1338
1340
|
`;
|
|
1339
|
-
return
|
|
1341
|
+
return chunkEDN4Y4ZG_cjs.sql`
|
|
1340
1342
|
SELECT kind, id, valid_from, valid_to, created_at, deleted_at
|
|
1341
1343
|
FROM ${table}
|
|
1342
1344
|
WHERE graph_id = ${graphId}
|
|
@@ -1345,13 +1347,13 @@ function identityNodeSnapshotSource(schema, graphId, coordinate) {
|
|
|
1345
1347
|
}
|
|
1346
1348
|
function identityAssertionSnapshotSource(schema, graphId, coordinate, relation) {
|
|
1347
1349
|
const table = coordinate.recorded === void 0 ? schema.identityAssertionsTable : schema.recordedIdentityAssertionsTable;
|
|
1348
|
-
const recordedFilter = coordinate.recorded === void 0 ?
|
|
1350
|
+
const recordedFilter = coordinate.recorded === void 0 ? chunkEDN4Y4ZG_cjs.sql`` : chunkEDN4Y4ZG_cjs.sql`
|
|
1349
1351
|
AND recorded_from <= ${coordinate.recorded.revision}
|
|
1350
1352
|
AND recorded_to > ${coordinate.recorded.revision}
|
|
1351
1353
|
`;
|
|
1352
|
-
const relationFilter = relation === void 0 ?
|
|
1354
|
+
const relationFilter = relation === void 0 ? chunkEDN4Y4ZG_cjs.sql`` : chunkEDN4Y4ZG_cjs.sql`AND rel = ${relation}`;
|
|
1353
1355
|
const instant = validityInstant(coordinate);
|
|
1354
|
-
return
|
|
1356
|
+
return chunkEDN4Y4ZG_cjs.sql`
|
|
1355
1357
|
SELECT ${IDENTITY_ASSERTION_COLUMNS}
|
|
1356
1358
|
FROM ${table}
|
|
1357
1359
|
WHERE graph_id = ${graphId}
|
|
@@ -1374,7 +1376,7 @@ function historicalIdentityReconstructionCtes(input) {
|
|
|
1374
1376
|
input.coordinate,
|
|
1375
1377
|
"same"
|
|
1376
1378
|
);
|
|
1377
|
-
const sameIdEdges = input.sameIdAcrossKinds === "fold" ?
|
|
1379
|
+
const sameIdEdges = input.sameIdAcrossKinds === "fold" ? chunkEDN4Y4ZG_cjs.sql`
|
|
1378
1380
|
UNION ALL
|
|
1379
1381
|
SELECT left_node.kind, left_node.id, right_node.kind, right_node.id
|
|
1380
1382
|
FROM node_snapshot left_node
|
|
@@ -1383,8 +1385,8 @@ function historicalIdentityReconstructionCtes(input) {
|
|
|
1383
1385
|
AND right_node.kind <> left_node.kind
|
|
1384
1386
|
WHERE ${structuralFoldVisibilitySql(input.coordinate, "left_node")}
|
|
1385
1387
|
AND ${structuralFoldVisibilitySql(input.coordinate, "right_node")}
|
|
1386
|
-
` :
|
|
1387
|
-
return
|
|
1388
|
+
` : chunkEDN4Y4ZG_cjs.sql``;
|
|
1389
|
+
return chunkEDN4Y4ZG_cjs.sql`
|
|
1388
1390
|
node_snapshot(kind, id, valid_from, valid_to, created_at, deleted_at) AS (
|
|
1389
1391
|
${nodes}
|
|
1390
1392
|
),
|
|
@@ -1415,15 +1417,15 @@ function historicalIdentityReconstructionCtes(input) {
|
|
|
1415
1417
|
)
|
|
1416
1418
|
`;
|
|
1417
1419
|
}
|
|
1418
|
-
var IDENTITY_PEER_CLASS_COLUMNS =
|
|
1420
|
+
var IDENTITY_PEER_CLASS_COLUMNS = chunkEDN4Y4ZG_cjs.sql.raw(
|
|
1419
1421
|
["seed_kind", "seed_id", "kind", "id"].join(", ")
|
|
1420
1422
|
);
|
|
1421
1423
|
function historicalIdentityPeerClassQuery(input) {
|
|
1422
1424
|
const reconstruction = historicalIdentityReconstructionCtes({
|
|
1423
1425
|
...input,
|
|
1424
|
-
seedSource:
|
|
1426
|
+
seedSource: chunkEDN4Y4ZG_cjs.sql`SELECT DISTINCT a_kind, a_id FROM identity_edges`
|
|
1425
1427
|
});
|
|
1426
|
-
return
|
|
1428
|
+
return chunkEDN4Y4ZG_cjs.sql`
|
|
1427
1429
|
WITH RECURSIVE
|
|
1428
1430
|
${reconstruction}
|
|
1429
1431
|
SELECT member.seed_kind, member.seed_id, member.kind, member.id
|
|
@@ -1446,28 +1448,28 @@ function compileFieldColumn(field, cteAlias, cteColumnPrefix) {
|
|
|
1446
1448
|
if (cteColumnPrefix !== void 0) {
|
|
1447
1449
|
const qualifier2 = cteColumnPrefix === "" ? "" : `${cteColumnPrefix}.`;
|
|
1448
1450
|
if (field.path.length === 1 && field.path[0] === "id") {
|
|
1449
|
-
return
|
|
1451
|
+
return chunkEDN4Y4ZG_cjs.sql.raw(`${qualifier2}id`);
|
|
1450
1452
|
}
|
|
1451
1453
|
if (field.path.length === 1 && field.path[0] === "kind") {
|
|
1452
|
-
return
|
|
1454
|
+
return chunkEDN4Y4ZG_cjs.sql.raw(`${qualifier2}kind`);
|
|
1453
1455
|
}
|
|
1454
1456
|
if (field.path.length > 0 && field.path[0] === "props") {
|
|
1455
|
-
return
|
|
1457
|
+
return chunkEDN4Y4ZG_cjs.sql.raw(`${qualifier2}props`);
|
|
1456
1458
|
}
|
|
1457
|
-
return
|
|
1459
|
+
return chunkEDN4Y4ZG_cjs.sql.raw(`${qualifier2}${field.path.join("_")}`);
|
|
1458
1460
|
}
|
|
1459
1461
|
const prefix = field.alias;
|
|
1460
1462
|
const qualifier = cteAlias ? `${cteAlias}.` : "";
|
|
1461
1463
|
if (field.path.length === 1 && field.path[0] === "id") {
|
|
1462
|
-
return
|
|
1464
|
+
return chunkEDN4Y4ZG_cjs.sql.raw(`${qualifier}${prefix}_id`);
|
|
1463
1465
|
}
|
|
1464
1466
|
if (field.path.length === 1 && field.path[0] === "kind") {
|
|
1465
|
-
return
|
|
1467
|
+
return chunkEDN4Y4ZG_cjs.sql.raw(`${qualifier}${prefix}_kind`);
|
|
1466
1468
|
}
|
|
1467
1469
|
if (field.path.length > 0 && field.path[0] === "props") {
|
|
1468
|
-
return
|
|
1470
|
+
return chunkEDN4Y4ZG_cjs.sql.raw(`${qualifier}${prefix}_props`);
|
|
1469
1471
|
}
|
|
1470
|
-
return
|
|
1472
|
+
return chunkEDN4Y4ZG_cjs.sql.raw(`${qualifier}${prefix}_${field.path.join("_")}`);
|
|
1471
1473
|
}
|
|
1472
1474
|
function getFieldPointer(field) {
|
|
1473
1475
|
if (field.jsonPointer !== void 0) {
|
|
@@ -1553,7 +1555,7 @@ function resolveLiteralValueTypes(literals) {
|
|
|
1553
1555
|
}
|
|
1554
1556
|
}
|
|
1555
1557
|
if (resolved.size > 1) {
|
|
1556
|
-
throw new
|
|
1558
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1557
1559
|
"Mixed literal value types are not supported in predicates",
|
|
1558
1560
|
{ valueTypes: [...resolved] }
|
|
1559
1561
|
);
|
|
@@ -1587,9 +1589,9 @@ function convertValueForSql(value, dialect) {
|
|
|
1587
1589
|
}
|
|
1588
1590
|
function compileStringPattern(op, pattern) {
|
|
1589
1591
|
const escaped = pattern.replaceAll(
|
|
1590
|
-
|
|
1591
|
-
`${
|
|
1592
|
-
).replaceAll("%", `${
|
|
1592
|
+
chunkEDN4Y4ZG_cjs.LIKE_ESCAPE_CHARACTER,
|
|
1593
|
+
`${chunkEDN4Y4ZG_cjs.LIKE_ESCAPE_CHARACTER}${chunkEDN4Y4ZG_cjs.LIKE_ESCAPE_CHARACTER}`
|
|
1594
|
+
).replaceAll("%", `${chunkEDN4Y4ZG_cjs.LIKE_ESCAPE_CHARACTER}%`).replaceAll("_", `${chunkEDN4Y4ZG_cjs.LIKE_ESCAPE_CHARACTER}_`);
|
|
1593
1595
|
switch (op) {
|
|
1594
1596
|
case "contains": {
|
|
1595
1597
|
return `%${escaped}%`;
|
|
@@ -1610,22 +1612,22 @@ function compileStringPattern(op, pattern) {
|
|
|
1610
1612
|
}
|
|
1611
1613
|
}
|
|
1612
1614
|
function escapeLikePatternParameter(parameter) {
|
|
1613
|
-
const doubledEscape = `${
|
|
1614
|
-
return
|
|
1615
|
+
const doubledEscape = `${chunkEDN4Y4ZG_cjs.LIKE_ESCAPE_CHARACTER}${chunkEDN4Y4ZG_cjs.LIKE_ESCAPE_CHARACTER}`;
|
|
1616
|
+
return chunkEDN4Y4ZG_cjs.sql`REPLACE(REPLACE(REPLACE(${parameter}, ${chunkEDN4Y4ZG_cjs.LIKE_ESCAPE_CHARACTER}, ${doubledEscape}), '%', ${`${chunkEDN4Y4ZG_cjs.LIKE_ESCAPE_CHARACTER}%`}), '_', ${`${chunkEDN4Y4ZG_cjs.LIKE_ESCAPE_CHARACTER}_`})`;
|
|
1615
1617
|
}
|
|
1616
1618
|
function compileParameterizedStringPattern(op, parameter) {
|
|
1617
1619
|
switch (op) {
|
|
1618
1620
|
case "contains": {
|
|
1619
1621
|
const escaped = escapeLikePatternParameter(parameter);
|
|
1620
|
-
return
|
|
1622
|
+
return chunkEDN4Y4ZG_cjs.sql`'%' || ${escaped} || '%'`;
|
|
1621
1623
|
}
|
|
1622
1624
|
case "startsWith": {
|
|
1623
1625
|
const escaped = escapeLikePatternParameter(parameter);
|
|
1624
|
-
return
|
|
1626
|
+
return chunkEDN4Y4ZG_cjs.sql`${escaped} || '%'`;
|
|
1625
1627
|
}
|
|
1626
1628
|
case "endsWith": {
|
|
1627
1629
|
const escaped = escapeLikePatternParameter(parameter);
|
|
1628
|
-
return
|
|
1630
|
+
return chunkEDN4Y4ZG_cjs.sql`'%' || ${escaped}`;
|
|
1629
1631
|
}
|
|
1630
1632
|
case "like":
|
|
1631
1633
|
case "ilike": {
|
|
@@ -1652,18 +1654,18 @@ function compilePredicateExpression(expr, ctx) {
|
|
|
1652
1654
|
cteColumnPrefix
|
|
1653
1655
|
);
|
|
1654
1656
|
if (isParameterRef(expr.pattern)) {
|
|
1655
|
-
const placeholder =
|
|
1657
|
+
const placeholder = chunkEDN4Y4ZG_cjs.sql`${chunkEDN4Y4ZG_cjs.sql.placeholder(expr.pattern.name)}`;
|
|
1656
1658
|
const pattern2 = compileParameterizedStringPattern(expr.op, placeholder);
|
|
1657
1659
|
if (expr.op === "ilike" || expr.op === "contains" || expr.op === "startsWith" || expr.op === "endsWith") {
|
|
1658
1660
|
return dialect.ilike(field, pattern2);
|
|
1659
1661
|
}
|
|
1660
|
-
return
|
|
1662
|
+
return chunkEDN4Y4ZG_cjs.sql`${field} LIKE ${pattern2} ${chunkEDN4Y4ZG_cjs.likeEscapeClause}`;
|
|
1661
1663
|
}
|
|
1662
1664
|
const pattern = compileStringPattern(expr.op, expr.pattern);
|
|
1663
1665
|
if (expr.op === "ilike" || expr.op === "contains" || expr.op === "startsWith" || expr.op === "endsWith") {
|
|
1664
1666
|
return dialect.ilike(field, pattern);
|
|
1665
1667
|
}
|
|
1666
|
-
return
|
|
1668
|
+
return chunkEDN4Y4ZG_cjs.sql`${field} LIKE ${pattern} ${chunkEDN4Y4ZG_cjs.likeEscapeClause}`;
|
|
1667
1669
|
}
|
|
1668
1670
|
case "null_check": {
|
|
1669
1671
|
const field = compileFieldTextValue(
|
|
@@ -1673,7 +1675,7 @@ function compilePredicateExpression(expr, ctx) {
|
|
|
1673
1675
|
void 0,
|
|
1674
1676
|
cteColumnPrefix
|
|
1675
1677
|
);
|
|
1676
|
-
return expr.op === "isNull" ?
|
|
1678
|
+
return expr.op === "isNull" ? chunkEDN4Y4ZG_cjs.sql`${field} IS NULL` : chunkEDN4Y4ZG_cjs.sql`${field} IS NOT NULL`;
|
|
1677
1679
|
}
|
|
1678
1680
|
case "between": {
|
|
1679
1681
|
const lowerIsParam = isParameterRef(expr.lower);
|
|
@@ -1683,7 +1685,7 @@ function compilePredicateExpression(expr, ctx) {
|
|
|
1683
1685
|
if (!upperIsParam) boundsForType.push(expr.upper);
|
|
1684
1686
|
const valueType = boundsForType.length > 0 ? resolveComparisonValueType(expr.field, boundsForType) : normalizeValueType2(expr.field.valueType);
|
|
1685
1687
|
if (valueType === "array" || valueType === "object") {
|
|
1686
|
-
throw new
|
|
1688
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1687
1689
|
"Between comparisons are not supported for JSON arrays or objects"
|
|
1688
1690
|
);
|
|
1689
1691
|
}
|
|
@@ -1695,25 +1697,25 @@ function compilePredicateExpression(expr, ctx) {
|
|
|
1695
1697
|
void 0,
|
|
1696
1698
|
cteColumnPrefix
|
|
1697
1699
|
);
|
|
1698
|
-
const lower = lowerIsParam ?
|
|
1699
|
-
const upper = upperIsParam ?
|
|
1700
|
-
return
|
|
1700
|
+
const lower = lowerIsParam ? chunkEDN4Y4ZG_cjs.sql.placeholder(expr.lower.name) : convertValueForSql(expr.lower.value, dialect);
|
|
1701
|
+
const upper = upperIsParam ? chunkEDN4Y4ZG_cjs.sql.placeholder(expr.upper.name) : convertValueForSql(expr.upper.value, dialect);
|
|
1702
|
+
return chunkEDN4Y4ZG_cjs.sql`${field} BETWEEN ${lower} AND ${upper}`;
|
|
1701
1703
|
}
|
|
1702
1704
|
case "and": {
|
|
1703
1705
|
const parts = expr.predicates.map(
|
|
1704
1706
|
(p) => compilePredicateExpression(p, ctx)
|
|
1705
1707
|
);
|
|
1706
|
-
return
|
|
1708
|
+
return chunkEDN4Y4ZG_cjs.sql`(${chunkEDN4Y4ZG_cjs.sql.join(parts, chunkEDN4Y4ZG_cjs.sql` AND `)})`;
|
|
1707
1709
|
}
|
|
1708
1710
|
case "or": {
|
|
1709
1711
|
const parts = expr.predicates.map(
|
|
1710
1712
|
(p) => compilePredicateExpression(p, ctx)
|
|
1711
1713
|
);
|
|
1712
|
-
return
|
|
1714
|
+
return chunkEDN4Y4ZG_cjs.sql`(${chunkEDN4Y4ZG_cjs.sql.join(parts, chunkEDN4Y4ZG_cjs.sql` OR `)})`;
|
|
1713
1715
|
}
|
|
1714
1716
|
case "not": {
|
|
1715
1717
|
const inner = compilePredicateExpression(expr.predicate, ctx);
|
|
1716
|
-
return
|
|
1718
|
+
return chunkEDN4Y4ZG_cjs.sql`NOT (${inner})`;
|
|
1717
1719
|
}
|
|
1718
1720
|
case "array_op": {
|
|
1719
1721
|
return compileArrayPredicate(expr, dialect, cteColumnPrefix);
|
|
@@ -1736,7 +1738,7 @@ function compilePredicateExpression(expr, ctx) {
|
|
|
1736
1738
|
}
|
|
1737
1739
|
}
|
|
1738
1740
|
}
|
|
1739
|
-
var STRUCTURAL_PREDICATE_NOOP =
|
|
1741
|
+
var STRUCTURAL_PREDICATE_NOOP = chunkEDN4Y4ZG_cjs.sql.raw("1=1");
|
|
1740
1742
|
function compileComparisonPredicate(expr, dialect, cteColumnPrefix) {
|
|
1741
1743
|
if (isParameterRef(expr.right)) {
|
|
1742
1744
|
const parameterValueType = resolveParameterValueType(expr.left, expr.right);
|
|
@@ -1759,15 +1761,15 @@ function compileComparisonPredicate(expr, dialect, cteColumnPrefix) {
|
|
|
1759
1761
|
}
|
|
1760
1762
|
const opSql2 = COMPARISON_OP_SQL[expr.op];
|
|
1761
1763
|
if (!opSql2) {
|
|
1762
|
-
throw new
|
|
1764
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1763
1765
|
`Comparison operation "${expr.op}" is not supported for parameterized predicates`
|
|
1764
1766
|
);
|
|
1765
1767
|
}
|
|
1766
|
-
return
|
|
1768
|
+
return chunkEDN4Y4ZG_cjs.sql`${left2} ${chunkEDN4Y4ZG_cjs.sql.raw(opSql2)} ${chunkEDN4Y4ZG_cjs.sql.placeholder(expr.right.name)}`;
|
|
1767
1769
|
}
|
|
1768
1770
|
const valueType = resolveComparisonValueType(expr.left, expr.right);
|
|
1769
1771
|
if (valueType === "array" || valueType === "object") {
|
|
1770
|
-
throw new
|
|
1772
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1771
1773
|
`Comparison operation "${expr.op}" is not supported for ${valueType} values`
|
|
1772
1774
|
);
|
|
1773
1775
|
}
|
|
@@ -1782,7 +1784,7 @@ function compileComparisonPredicate(expr, dialect, cteColumnPrefix) {
|
|
|
1782
1784
|
if (expr.op === "in" || expr.op === "notIn") {
|
|
1783
1785
|
const values = Array.isArray(expr.right) ? expr.right : [expr.right];
|
|
1784
1786
|
if (values.length === 0) {
|
|
1785
|
-
return expr.op === "in" ?
|
|
1787
|
+
return expr.op === "in" ? chunkEDN4Y4ZG_cjs.sql.raw("1=0") : chunkEDN4Y4ZG_cjs.sql.raw("1=1");
|
|
1786
1788
|
}
|
|
1787
1789
|
const convertedValues = values.map(
|
|
1788
1790
|
(value) => convertValueForSql(value.value, dialect)
|
|
@@ -1794,15 +1796,15 @@ function compileComparisonPredicate(expr, dialect, cteColumnPrefix) {
|
|
|
1794
1796
|
const convertedRight = convertValueForSql(rightValue.value, dialect);
|
|
1795
1797
|
const opSql = COMPARISON_OP_SQL[expr.op];
|
|
1796
1798
|
if (!opSql) {
|
|
1797
|
-
throw new
|
|
1799
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1798
1800
|
`Comparison operation "${expr.op}" is not supported`
|
|
1799
1801
|
);
|
|
1800
1802
|
}
|
|
1801
|
-
return
|
|
1803
|
+
return chunkEDN4Y4ZG_cjs.sql`${left} ${chunkEDN4Y4ZG_cjs.sql.raw(opSql)} ${convertedRight}`;
|
|
1802
1804
|
}
|
|
1803
1805
|
function compileListParameterPredicate(left, parameterName, elementType, negated, dialect) {
|
|
1804
1806
|
if (elementType === "array" || elementType === "object" || elementType === "embedding") {
|
|
1805
|
-
throw new
|
|
1807
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1806
1808
|
`IN/NOT IN is not supported for ${elementType} values`,
|
|
1807
1809
|
{ valueType: elementType },
|
|
1808
1810
|
{
|
|
@@ -1810,7 +1812,7 @@ function compileListParameterPredicate(left, parameterName, elementType, negated
|
|
|
1810
1812
|
}
|
|
1811
1813
|
);
|
|
1812
1814
|
}
|
|
1813
|
-
return dialect.inListParameter(left,
|
|
1815
|
+
return dialect.inListParameter(left, chunkEDN4Y4ZG_cjs.sql.placeholder(parameterName), {
|
|
1814
1816
|
negated,
|
|
1815
1817
|
elementType
|
|
1816
1818
|
});
|
|
@@ -1826,30 +1828,30 @@ function compileArrayPredicate(expr, dialect, cteColumnPrefix) {
|
|
|
1826
1828
|
const values = expr.values?.map((v) => convertValueForSql(v.value, dialect)) ?? [];
|
|
1827
1829
|
switch (expr.op) {
|
|
1828
1830
|
case "isEmpty": {
|
|
1829
|
-
return
|
|
1831
|
+
return chunkEDN4Y4ZG_cjs.sql`(${field} IS NULL OR ${dialect.jsonArrayLength(field)} = 0)`;
|
|
1830
1832
|
}
|
|
1831
1833
|
case "isNotEmpty": {
|
|
1832
|
-
return
|
|
1834
|
+
return chunkEDN4Y4ZG_cjs.sql`(${field} IS NOT NULL AND ${dialect.jsonArrayLength(field)} > 0)`;
|
|
1833
1835
|
}
|
|
1834
1836
|
case "lengthEq": {
|
|
1835
|
-
return
|
|
1837
|
+
return chunkEDN4Y4ZG_cjs.sql`${dialect.jsonArrayLength(field)} = ${expr.length}`;
|
|
1836
1838
|
}
|
|
1837
1839
|
case "lengthGt": {
|
|
1838
|
-
return
|
|
1840
|
+
return chunkEDN4Y4ZG_cjs.sql`${dialect.jsonArrayLength(field)} > ${expr.length}`;
|
|
1839
1841
|
}
|
|
1840
1842
|
case "lengthGte": {
|
|
1841
|
-
return
|
|
1843
|
+
return chunkEDN4Y4ZG_cjs.sql`${dialect.jsonArrayLength(field)} >= ${expr.length}`;
|
|
1842
1844
|
}
|
|
1843
1845
|
case "lengthLt": {
|
|
1844
|
-
return
|
|
1846
|
+
return chunkEDN4Y4ZG_cjs.sql`${dialect.jsonArrayLength(field)} < ${expr.length}`;
|
|
1845
1847
|
}
|
|
1846
1848
|
case "lengthLte": {
|
|
1847
|
-
return
|
|
1849
|
+
return chunkEDN4Y4ZG_cjs.sql`${dialect.jsonArrayLength(field)} <= ${expr.length}`;
|
|
1848
1850
|
}
|
|
1849
1851
|
case "contains": {
|
|
1850
1852
|
const value = values[0];
|
|
1851
1853
|
if (value === void 0) {
|
|
1852
|
-
return
|
|
1854
|
+
return chunkEDN4Y4ZG_cjs.sql.raw("1=0");
|
|
1853
1855
|
}
|
|
1854
1856
|
return dialect.jsonArrayContains(field, value);
|
|
1855
1857
|
}
|
|
@@ -1872,13 +1874,13 @@ function compileObjectPredicate(expr, dialect, cteColumnPrefix) {
|
|
|
1872
1874
|
}
|
|
1873
1875
|
case "pathEquals": {
|
|
1874
1876
|
if (!expr.value) {
|
|
1875
|
-
throw new
|
|
1877
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1876
1878
|
"pathEquals requires a comparison value"
|
|
1877
1879
|
);
|
|
1878
1880
|
}
|
|
1879
1881
|
const valueType = resolvePredicateValueType(expr.valueType, expr.value);
|
|
1880
1882
|
if (valueType === "array" || valueType === "object") {
|
|
1881
|
-
throw new
|
|
1883
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1882
1884
|
"pathEquals is not supported for JSON arrays or objects"
|
|
1883
1885
|
);
|
|
1884
1886
|
}
|
|
@@ -1890,11 +1892,11 @@ function compileObjectPredicate(expr, dialect, cteColumnPrefix) {
|
|
|
1890
1892
|
pointer,
|
|
1891
1893
|
cteColumnPrefix
|
|
1892
1894
|
);
|
|
1893
|
-
return
|
|
1895
|
+
return chunkEDN4Y4ZG_cjs.sql`${left} = ${convertValueForSql(expr.value.value, dialect)}`;
|
|
1894
1896
|
}
|
|
1895
1897
|
case "pathContains": {
|
|
1896
1898
|
if (!expr.value) {
|
|
1897
|
-
throw new
|
|
1899
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1898
1900
|
"pathContains requires a comparison value"
|
|
1899
1901
|
);
|
|
1900
1902
|
}
|
|
@@ -1922,12 +1924,12 @@ function compileAggregatePredicate(expr, dialect) {
|
|
|
1922
1924
|
const aggregate = compileAggregateExpr(expr.aggregate, dialect);
|
|
1923
1925
|
const op = COMPARISON_OP_SQL[expr.op];
|
|
1924
1926
|
if (!op) {
|
|
1925
|
-
throw new
|
|
1927
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1926
1928
|
`Comparison operation "${expr.op}" is not supported for aggregate predicates`
|
|
1927
1929
|
);
|
|
1928
1930
|
}
|
|
1929
1931
|
const convertedValue = convertValueForSql(expr.value.value, dialect);
|
|
1930
|
-
return
|
|
1932
|
+
return chunkEDN4Y4ZG_cjs.sql`${aggregate} ${chunkEDN4Y4ZG_cjs.sql.raw(op)} ${convertedValue}`;
|
|
1931
1933
|
}
|
|
1932
1934
|
function compileAggregateExpr(expr, dialect) {
|
|
1933
1935
|
const cteAlias = `cte_${expr.field.alias}`;
|
|
@@ -1939,25 +1941,25 @@ function compileAggregateExpr(expr, dialect) {
|
|
|
1939
1941
|
);
|
|
1940
1942
|
switch (expr.function) {
|
|
1941
1943
|
case "count": {
|
|
1942
|
-
return
|
|
1944
|
+
return chunkEDN4Y4ZG_cjs.sql`COUNT(${field})`;
|
|
1943
1945
|
}
|
|
1944
1946
|
case "countDistinct": {
|
|
1945
|
-
return
|
|
1947
|
+
return chunkEDN4Y4ZG_cjs.sql`COUNT(DISTINCT ${field})`;
|
|
1946
1948
|
}
|
|
1947
1949
|
case "sum": {
|
|
1948
|
-
return
|
|
1950
|
+
return chunkEDN4Y4ZG_cjs.sql`SUM(${field})`;
|
|
1949
1951
|
}
|
|
1950
1952
|
case "avg": {
|
|
1951
|
-
return
|
|
1953
|
+
return chunkEDN4Y4ZG_cjs.sql`AVG(${field})`;
|
|
1952
1954
|
}
|
|
1953
1955
|
case "min": {
|
|
1954
|
-
return
|
|
1956
|
+
return chunkEDN4Y4ZG_cjs.sql`MIN(${field})`;
|
|
1955
1957
|
}
|
|
1956
1958
|
case "max": {
|
|
1957
|
-
return
|
|
1959
|
+
return chunkEDN4Y4ZG_cjs.sql`MAX(${field})`;
|
|
1958
1960
|
}
|
|
1959
1961
|
default: {
|
|
1960
|
-
throw new
|
|
1962
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1961
1963
|
`Unknown aggregate function: ${expr.function}`
|
|
1962
1964
|
);
|
|
1963
1965
|
}
|
|
@@ -1965,15 +1967,15 @@ function compileAggregateExpr(expr, dialect) {
|
|
|
1965
1967
|
}
|
|
1966
1968
|
function compileExistsSubquery(expr, ctx) {
|
|
1967
1969
|
if (expr.subquery.graphId === void 0) {
|
|
1968
|
-
throw new
|
|
1970
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError("EXISTS subquery must have a graphId");
|
|
1969
1971
|
}
|
|
1970
1972
|
const subSql = ctx.compileQuery(expr.subquery, expr.subquery.graphId);
|
|
1971
|
-
return expr.negated ?
|
|
1973
|
+
return expr.negated ? chunkEDN4Y4ZG_cjs.sql`NOT EXISTS (${subSql})` : chunkEDN4Y4ZG_cjs.sql`EXISTS (${subSql})`;
|
|
1972
1974
|
}
|
|
1973
1975
|
function compileInSubquery(expr, ctx) {
|
|
1974
1976
|
const subqueryColumnCount = getSubqueryColumnCount(expr.subquery);
|
|
1975
1977
|
if (subqueryColumnCount !== 1) {
|
|
1976
|
-
throw new
|
|
1978
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1977
1979
|
`IN/NOT IN subquery must project exactly 1 column, but got ${subqueryColumnCount}`,
|
|
1978
1980
|
{ subqueryColumnCount }
|
|
1979
1981
|
);
|
|
@@ -1982,13 +1984,13 @@ function compileInSubquery(expr, ctx) {
|
|
|
1982
1984
|
const subqueryValueType = getSingleSubqueryColumnValueType(expr.subquery);
|
|
1983
1985
|
const resolvedValueType = fieldValueType ?? subqueryValueType;
|
|
1984
1986
|
if (isUnsupportedInSubqueryValueType(resolvedValueType)) {
|
|
1985
|
-
throw new
|
|
1987
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1986
1988
|
`IN/NOT IN subquery does not support ${String(resolvedValueType)} values`,
|
|
1987
1989
|
{ valueType: resolvedValueType }
|
|
1988
1990
|
);
|
|
1989
1991
|
}
|
|
1990
1992
|
if (!isInSubqueryTypeCompatible(fieldValueType, subqueryValueType)) {
|
|
1991
|
-
throw new
|
|
1993
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
1992
1994
|
`IN/NOT IN type mismatch: field type "${String(fieldValueType)}" does not match subquery column type "${String(subqueryValueType)}"`,
|
|
1993
1995
|
{
|
|
1994
1996
|
fieldValueType,
|
|
@@ -1998,7 +2000,7 @@ function compileInSubquery(expr, ctx) {
|
|
|
1998
2000
|
}
|
|
1999
2001
|
const valueType = fieldValueType ?? subqueryValueType;
|
|
2000
2002
|
if (expr.subquery.graphId === void 0) {
|
|
2001
|
-
throw new
|
|
2003
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
2002
2004
|
"IN/NOT IN subquery must have a graphId"
|
|
2003
2005
|
);
|
|
2004
2006
|
}
|
|
@@ -2011,14 +2013,14 @@ function compileInSubquery(expr, ctx) {
|
|
|
2011
2013
|
ctx.cteColumnPrefix
|
|
2012
2014
|
);
|
|
2013
2015
|
const subSql = ctx.compileQuery(expr.subquery, expr.subquery.graphId);
|
|
2014
|
-
return expr.negated ?
|
|
2016
|
+
return expr.negated ? chunkEDN4Y4ZG_cjs.sql`${fieldSql} NOT IN (${subSql})` : chunkEDN4Y4ZG_cjs.sql`${fieldSql} IN (${subSql})`;
|
|
2015
2017
|
}
|
|
2016
2018
|
function extractStructuralPredicates(predicates, isMatch, rejectionMessage) {
|
|
2017
2019
|
const results = [];
|
|
2018
2020
|
function visit(expr, inDisallowedBranch) {
|
|
2019
2021
|
if (isMatch(expr)) {
|
|
2020
2022
|
if (inDisallowedBranch) {
|
|
2021
|
-
throw new
|
|
2023
|
+
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(rejectionMessage);
|
|
2022
2024
|
}
|
|
2023
2025
|
results.push(expr);
|
|
2024
2026
|
return;
|
|
@@ -2072,9 +2074,9 @@ function extractFulltextMatchPredicates(predicates) {
|
|
|
2072
2074
|
// src/query/compiler/predicate-utils.ts
|
|
2073
2075
|
var EMPTY_PREDICATES = [];
|
|
2074
2076
|
function sqlValueList(values) {
|
|
2075
|
-
return
|
|
2076
|
-
values.map((value) =>
|
|
2077
|
-
|
|
2077
|
+
return chunkEDN4Y4ZG_cjs.sql.join(
|
|
2078
|
+
values.map((value) => chunkEDN4Y4ZG_cjs.sql`${value}`),
|
|
2079
|
+
chunkEDN4Y4ZG_cjs.sql`, `
|
|
2078
2080
|
);
|
|
2079
2081
|
}
|
|
2080
2082
|
function buildPredicateIndexKey(alias, targetType) {
|
|
@@ -2111,12 +2113,12 @@ function compilePredicateClauses(predicates, predicateContext) {
|
|
|
2111
2113
|
}
|
|
2112
2114
|
function compileKindFilter(column, kinds) {
|
|
2113
2115
|
if (kinds.length === 0) {
|
|
2114
|
-
return
|
|
2116
|
+
return chunkEDN4Y4ZG_cjs.sql`1 = 0`;
|
|
2115
2117
|
}
|
|
2116
2118
|
if (kinds.length === 1) {
|
|
2117
|
-
return
|
|
2119
|
+
return chunkEDN4Y4ZG_cjs.sql`${column} = ${kinds[0]}`;
|
|
2118
2120
|
}
|
|
2119
|
-
return
|
|
2121
|
+
return chunkEDN4Y4ZG_cjs.sql`${column} IN (${sqlValueList(kinds)})`;
|
|
2120
2122
|
}
|
|
2121
2123
|
function getNodeKindsForAlias(ast, alias) {
|
|
2122
2124
|
if (alias === ast.start.alias) {
|
|
@@ -2127,7 +2129,7 @@ function getNodeKindsForAlias(ast, alias) {
|
|
|
2127
2129
|
return traversal.nodeKinds;
|
|
2128
2130
|
}
|
|
2129
2131
|
}
|
|
2130
|
-
throw new
|
|
2132
|
+
throw new chunkMRDBBHIZ_cjs.CompilerInvariantError(`Unknown traversal source alias: ${alias}`);
|
|
2131
2133
|
}
|
|
2132
2134
|
function getHybridTargetAlias(vectorPredicate, fulltextPredicate) {
|
|
2133
2135
|
if (!vectorPredicate || !fulltextPredicate) return void 0;
|
|
@@ -2232,16 +2234,16 @@ var RECORDED_IDENTITY_ASSERTION_COLUMNS = [
|
|
|
2232
2234
|
"recorded_to",
|
|
2233
2235
|
"op"
|
|
2234
2236
|
];
|
|
2235
|
-
var RECORDED_NODE_COLUMN_LIST =
|
|
2236
|
-
var RECORDED_EDGE_COLUMN_LIST =
|
|
2237
|
-
var RECORDED_IDENTITY_ASSERTION_COLUMN_LIST =
|
|
2237
|
+
var RECORDED_NODE_COLUMN_LIST = chunkEDN4Y4ZG_cjs.sql.raw(RECORDED_NODE_COLUMNS.join(", "));
|
|
2238
|
+
var RECORDED_EDGE_COLUMN_LIST = chunkEDN4Y4ZG_cjs.sql.raw(RECORDED_EDGE_COLUMNS.join(", "));
|
|
2239
|
+
var RECORDED_IDENTITY_ASSERTION_COLUMN_LIST = chunkEDN4Y4ZG_cjs.sql.raw(
|
|
2238
2240
|
RECORDED_IDENTITY_ASSERTION_COLUMNS.join(", ")
|
|
2239
2241
|
);
|
|
2240
2242
|
var RECORDED_BIND_PARAM_BUDGET = 900;
|
|
2241
2243
|
function recordedBindParamBudget(target) {
|
|
2242
2244
|
const budget = target.capabilities.maxBindParameters ?? RECORDED_BIND_PARAM_BUDGET;
|
|
2243
2245
|
if (!Number.isSafeInteger(budget) || budget < 1) {
|
|
2244
|
-
throw new
|
|
2246
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
2245
2247
|
`backend capabilities.maxBindParameters must be a positive integer, got: ${String(budget)}`,
|
|
2246
2248
|
{
|
|
2247
2249
|
code: "INVALID_BACKEND_CAPABILITY",
|
|
@@ -2257,64 +2259,64 @@ function recordedChunkSize(target, columnCount) {
|
|
|
2257
2259
|
return Math.max(1, Math.floor(budget / columnCount));
|
|
2258
2260
|
}
|
|
2259
2261
|
function sqlNull(value) {
|
|
2260
|
-
return value === void 0 ?
|
|
2262
|
+
return value === void 0 ? chunkEDN4Y4ZG_cjs.sql.raw("NULL") : chunkEDN4Y4ZG_cjs.sql`${value}`;
|
|
2261
2263
|
}
|
|
2262
2264
|
function recordedCommonCells() {
|
|
2263
2265
|
return {
|
|
2264
|
-
history_id: () =>
|
|
2265
|
-
graph_id: (row) =>
|
|
2266
|
-
id: (row) =>
|
|
2267
|
-
kind: (row) =>
|
|
2268
|
-
props: (row) =>
|
|
2269
|
-
valid_from: (row) =>
|
|
2270
|
-
valid_to: (row) =>
|
|
2271
|
-
created_at: (row) =>
|
|
2272
|
-
updated_at: (row) =>
|
|
2273
|
-
deleted_at: (row) =>
|
|
2274
|
-
recorded_from: (_row, recordedRevision) =>
|
|
2275
|
-
recorded_to: () =>
|
|
2276
|
-
op: (_row, _recordedCommit, operation) =>
|
|
2277
|
-
schema_version: () =>
|
|
2278
|
-
tx_id: () =>
|
|
2279
|
-
meta: () =>
|
|
2266
|
+
history_id: () => chunkEDN4Y4ZG_cjs.sql`${generateId()}`,
|
|
2267
|
+
graph_id: (row) => chunkEDN4Y4ZG_cjs.sql`${row.graph_id}`,
|
|
2268
|
+
id: (row) => chunkEDN4Y4ZG_cjs.sql`${row.id}`,
|
|
2269
|
+
kind: (row) => chunkEDN4Y4ZG_cjs.sql`${row.kind}`,
|
|
2270
|
+
props: (row) => chunkEDN4Y4ZG_cjs.sql`${chunk3HGRTCDU_cjs.rowPropsToJsonText(row.props)}`,
|
|
2271
|
+
valid_from: (row) => chunkEDN4Y4ZG_cjs.sql`${sqlNull(row.valid_from)}`,
|
|
2272
|
+
valid_to: (row) => chunkEDN4Y4ZG_cjs.sql`${sqlNull(row.valid_to)}`,
|
|
2273
|
+
created_at: (row) => chunkEDN4Y4ZG_cjs.sql`${row.created_at}`,
|
|
2274
|
+
updated_at: (row) => chunkEDN4Y4ZG_cjs.sql`${row.updated_at}`,
|
|
2275
|
+
deleted_at: (row) => chunkEDN4Y4ZG_cjs.sql`${sqlNull(row.deleted_at)}`,
|
|
2276
|
+
recorded_from: (_row, recordedRevision) => chunkEDN4Y4ZG_cjs.sql`${recordedRevision}`,
|
|
2277
|
+
recorded_to: () => chunkEDN4Y4ZG_cjs.sql`${chunk6KFLYYOC_cjs.RECORDED_MAX_REVISION}`,
|
|
2278
|
+
op: (_row, _recordedCommit, operation) => chunkEDN4Y4ZG_cjs.sql`${operation}`,
|
|
2279
|
+
schema_version: () => chunkEDN4Y4ZG_cjs.sql`NULL`,
|
|
2280
|
+
tx_id: () => chunkEDN4Y4ZG_cjs.sql`NULL`,
|
|
2281
|
+
meta: () => chunkEDN4Y4ZG_cjs.sql`${RECORDED_HISTORY_META}`
|
|
2280
2282
|
};
|
|
2281
2283
|
}
|
|
2282
2284
|
var recordedNodeCells = {
|
|
2283
2285
|
...recordedCommonCells(),
|
|
2284
|
-
version: (row) =>
|
|
2286
|
+
version: (row) => chunkEDN4Y4ZG_cjs.sql`${row.version}`
|
|
2285
2287
|
};
|
|
2286
2288
|
var recordedEdgeCells = {
|
|
2287
2289
|
...recordedCommonCells(),
|
|
2288
|
-
from_kind: (row) =>
|
|
2289
|
-
from_id: (row) =>
|
|
2290
|
-
to_kind: (row) =>
|
|
2291
|
-
to_id: (row) =>
|
|
2290
|
+
from_kind: (row) => chunkEDN4Y4ZG_cjs.sql`${row.from_kind}`,
|
|
2291
|
+
from_id: (row) => chunkEDN4Y4ZG_cjs.sql`${row.from_id}`,
|
|
2292
|
+
to_kind: (row) => chunkEDN4Y4ZG_cjs.sql`${row.to_kind}`,
|
|
2293
|
+
to_id: (row) => chunkEDN4Y4ZG_cjs.sql`${row.to_id}`
|
|
2292
2294
|
};
|
|
2293
2295
|
var recordedIdentityAssertionCells = {
|
|
2294
|
-
history_id: () =>
|
|
2295
|
-
graph_id: (row) =>
|
|
2296
|
-
id: (row) =>
|
|
2297
|
-
rel: (row) =>
|
|
2298
|
-
a_kind: (row) =>
|
|
2299
|
-
a_id: (row) =>
|
|
2300
|
-
b_kind: (row) =>
|
|
2301
|
-
b_id: (row) =>
|
|
2302
|
-
valid_from: (row) =>
|
|
2303
|
-
valid_to: (row) =>
|
|
2304
|
-
created_at: (row) =>
|
|
2305
|
-
updated_at: (row) =>
|
|
2306
|
-
deleted_at: (row) =>
|
|
2307
|
-
ended_by_kind: (row) =>
|
|
2308
|
-
ended_by_id: (row) =>
|
|
2309
|
-
recorded_from: (_row, recordedRevision) =>
|
|
2310
|
-
recorded_to: () =>
|
|
2311
|
-
op: (_row, _recordedRevision, operation) =>
|
|
2296
|
+
history_id: () => chunkEDN4Y4ZG_cjs.sql`${generateId()}`,
|
|
2297
|
+
graph_id: (row) => chunkEDN4Y4ZG_cjs.sql`${row.graph_id}`,
|
|
2298
|
+
id: (row) => chunkEDN4Y4ZG_cjs.sql`${row.id}`,
|
|
2299
|
+
rel: (row) => chunkEDN4Y4ZG_cjs.sql`${row.rel}`,
|
|
2300
|
+
a_kind: (row) => chunkEDN4Y4ZG_cjs.sql`${row.a_kind}`,
|
|
2301
|
+
a_id: (row) => chunkEDN4Y4ZG_cjs.sql`${row.a_id}`,
|
|
2302
|
+
b_kind: (row) => chunkEDN4Y4ZG_cjs.sql`${row.b_kind}`,
|
|
2303
|
+
b_id: (row) => chunkEDN4Y4ZG_cjs.sql`${row.b_id}`,
|
|
2304
|
+
valid_from: (row) => chunkEDN4Y4ZG_cjs.sql`${row.valid_from}`,
|
|
2305
|
+
valid_to: (row) => chunkEDN4Y4ZG_cjs.sql`${row.valid_to ?? chunkEDN4Y4ZG_cjs.sql.raw("NULL")}`,
|
|
2306
|
+
created_at: (row) => chunkEDN4Y4ZG_cjs.sql`${row.created_at}`,
|
|
2307
|
+
updated_at: (row) => chunkEDN4Y4ZG_cjs.sql`${row.updated_at}`,
|
|
2308
|
+
deleted_at: (row) => chunkEDN4Y4ZG_cjs.sql`${row.deleted_at ?? chunkEDN4Y4ZG_cjs.sql.raw("NULL")}`,
|
|
2309
|
+
ended_by_kind: (row) => chunkEDN4Y4ZG_cjs.sql`${row.ended_by_kind ?? chunkEDN4Y4ZG_cjs.sql.raw("NULL")}`,
|
|
2310
|
+
ended_by_id: (row) => chunkEDN4Y4ZG_cjs.sql`${row.ended_by_id ?? chunkEDN4Y4ZG_cjs.sql.raw("NULL")}`,
|
|
2311
|
+
recorded_from: (_row, recordedRevision) => chunkEDN4Y4ZG_cjs.sql`${recordedRevision}`,
|
|
2312
|
+
recorded_to: () => chunkEDN4Y4ZG_cjs.sql`${chunk6KFLYYOC_cjs.RECORDED_MAX_REVISION}`,
|
|
2313
|
+
op: (_row, _recordedRevision, operation) => chunkEDN4Y4ZG_cjs.sql`${operation}`
|
|
2312
2314
|
};
|
|
2313
2315
|
function recordedValuesTuple(columns, cells, row, recordedRevision, operation) {
|
|
2314
2316
|
const tuple = columns.map(
|
|
2315
2317
|
(column) => cells[column](row, recordedRevision, operation)
|
|
2316
2318
|
);
|
|
2317
|
-
return
|
|
2319
|
+
return chunkEDN4Y4ZG_cjs.sql`(${chunkEDN4Y4ZG_cjs.sql.join(tuple, chunkEDN4Y4ZG_cjs.sql`, `)})`;
|
|
2318
2320
|
}
|
|
2319
2321
|
async function insertRecordedRows(target, table, columnList, columns, cells, inserts, recordedRevision) {
|
|
2320
2322
|
if (inserts.length === 0) return;
|
|
@@ -2329,9 +2331,9 @@ async function insertRecordedRows(target, table, columnList, columns, cells, ins
|
|
|
2329
2331
|
);
|
|
2330
2332
|
await executeStatement(
|
|
2331
2333
|
target,
|
|
2332
|
-
|
|
2334
|
+
chunkEDN4Y4ZG_cjs.sql`
|
|
2333
2335
|
INSERT INTO ${table} (${columnList})
|
|
2334
|
-
VALUES ${
|
|
2336
|
+
VALUES ${chunkEDN4Y4ZG_cjs.sql.join(values, chunkEDN4Y4ZG_cjs.sql`, `)}
|
|
2335
2337
|
`
|
|
2336
2338
|
);
|
|
2337
2339
|
}
|
|
@@ -2393,14 +2395,14 @@ function entityKey(entity) {
|
|
|
2393
2395
|
}
|
|
2394
2396
|
}
|
|
2395
2397
|
async function closeOpenReturning(target, table, graphId, ids, recordedRevision, kind) {
|
|
2396
|
-
const kindFilter = kind === void 0 ?
|
|
2398
|
+
const kindFilter = kind === void 0 ? chunkEDN4Y4ZG_cjs.sql`` : chunkEDN4Y4ZG_cjs.sql`AND kind = ${kind}`;
|
|
2397
2399
|
const rows = await target.execute(
|
|
2398
|
-
|
|
2400
|
+
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
2399
2401
|
UPDATE ${table}
|
|
2400
2402
|
SET recorded_to = ${recordedRevision}
|
|
2401
2403
|
WHERE graph_id = ${graphId}
|
|
2402
2404
|
${kindFilter}
|
|
2403
|
-
AND recorded_to = ${
|
|
2405
|
+
AND recorded_to = ${chunk6KFLYYOC_cjs.RECORDED_MAX_REVISION}
|
|
2404
2406
|
AND id IN (${sqlValueList(ids)})
|
|
2405
2407
|
RETURNING id, deleted_at
|
|
2406
2408
|
`)
|
|
@@ -2445,7 +2447,7 @@ function recordedInsertsFor(afterById, closed) {
|
|
|
2445
2447
|
async function flushNodes(target, schema, graphId, entities, recordedRevision) {
|
|
2446
2448
|
const chunkSize = recordedNodeChunkSize(target);
|
|
2447
2449
|
for (const [kind, group] of groupNodesByKind(entities)) {
|
|
2448
|
-
for (const entityChunk of
|
|
2450
|
+
for (const entityChunk of chunkJR6SX5RH_cjs.chunk(group, chunkSize)) {
|
|
2449
2451
|
const ids = entityChunk.map((entity) => entity.id);
|
|
2450
2452
|
const closed = await closeOpenReturning(
|
|
2451
2453
|
target,
|
|
@@ -2470,7 +2472,7 @@ async function flushNodes(target, schema, graphId, entities, recordedRevision) {
|
|
|
2470
2472
|
}
|
|
2471
2473
|
async function flushEdges(target, schema, graphId, entities, recordedRevision) {
|
|
2472
2474
|
const chunkSize = recordedEdgeChunkSize(target);
|
|
2473
|
-
for (const entityChunk of
|
|
2475
|
+
for (const entityChunk of chunkJR6SX5RH_cjs.chunk(entities, chunkSize)) {
|
|
2474
2476
|
const ids = entityChunk.map((entity) => entity.id);
|
|
2475
2477
|
const closed = await closeOpenReturning(
|
|
2476
2478
|
target,
|
|
@@ -2494,7 +2496,7 @@ async function flushEdges(target, schema, graphId, entities, recordedRevision) {
|
|
|
2494
2496
|
async function getIdentityAssertionRowsByIds(target, schema, graphId, ids) {
|
|
2495
2497
|
if (ids.length === 0) return /* @__PURE__ */ new Map();
|
|
2496
2498
|
const rows = await target.execute(
|
|
2497
|
-
|
|
2499
|
+
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
2498
2500
|
SELECT ${IDENTITY_ASSERTION_COLUMNS}
|
|
2499
2501
|
FROM ${schema.identityAssertionsTable}
|
|
2500
2502
|
WHERE graph_id = ${graphId}
|
|
@@ -2506,7 +2508,7 @@ async function getIdentityAssertionRowsByIds(target, schema, graphId, ids) {
|
|
|
2506
2508
|
async function flushIdentityAssertions(target, schema, graphId, entities, recordedRevision) {
|
|
2507
2509
|
if (entities.length === 0) return;
|
|
2508
2510
|
const chunkSize = recordedIdentityAssertionChunkSize(target);
|
|
2509
|
-
for (const entityChunk of
|
|
2511
|
+
for (const entityChunk of chunkJR6SX5RH_cjs.chunk(entities, chunkSize)) {
|
|
2510
2512
|
const ids = entityChunk.map((entity) => entity.id);
|
|
2511
2513
|
const closed = await closeOpenReturning(
|
|
2512
2514
|
target,
|
|
@@ -2530,24 +2532,24 @@ async function flushIdentityAssertions(target, schema, graphId, entities, record
|
|
|
2530
2532
|
async function closeOpenByKind(target, table, graphId, kind, recordedRevision) {
|
|
2531
2533
|
await executeStatement(
|
|
2532
2534
|
target,
|
|
2533
|
-
|
|
2535
|
+
chunkEDN4Y4ZG_cjs.sql`
|
|
2534
2536
|
UPDATE ${table}
|
|
2535
2537
|
SET recorded_to = ${recordedRevision}
|
|
2536
2538
|
WHERE graph_id = ${graphId}
|
|
2537
2539
|
AND kind = ${kind}
|
|
2538
|
-
AND recorded_to = ${
|
|
2540
|
+
AND recorded_to = ${chunk6KFLYYOC_cjs.RECORDED_MAX_REVISION}
|
|
2539
2541
|
`
|
|
2540
2542
|
);
|
|
2541
2543
|
}
|
|
2542
2544
|
async function closeOpenEdgesByNodeKind(target, schema, graphId, nodeKind, recordedRevision) {
|
|
2543
2545
|
await executeStatement(
|
|
2544
2546
|
target,
|
|
2545
|
-
|
|
2547
|
+
chunkEDN4Y4ZG_cjs.sql`
|
|
2546
2548
|
UPDATE ${schema.recordedEdgesTable}
|
|
2547
2549
|
SET recorded_to = ${recordedRevision}
|
|
2548
2550
|
WHERE graph_id = ${graphId}
|
|
2549
2551
|
AND (from_kind = ${nodeKind} OR to_kind = ${nodeKind})
|
|
2550
|
-
AND recorded_to = ${
|
|
2552
|
+
AND recorded_to = ${chunk6KFLYYOC_cjs.RECORDED_MAX_REVISION}
|
|
2551
2553
|
`
|
|
2552
2554
|
);
|
|
2553
2555
|
}
|
|
@@ -2585,7 +2587,7 @@ async function closeRecordedHardDeletedKind(target, schema, graphId, removal, ow
|
|
|
2585
2587
|
}
|
|
2586
2588
|
async function queryConnectedEdgeIds(target, schema, params) {
|
|
2587
2589
|
const rows = await target.execute(
|
|
2588
|
-
|
|
2590
|
+
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
2589
2591
|
SELECT id
|
|
2590
2592
|
FROM ${schema.edgesTable}
|
|
2591
2593
|
WHERE graph_id = ${params.graphId}
|
|
@@ -2606,9 +2608,9 @@ function normalizedColumnType(value) {
|
|
|
2606
2608
|
}
|
|
2607
2609
|
async function readColumnTypes(backend, table) {
|
|
2608
2610
|
const rows = backend.dialect === "sqlite" ? await backend.execute(
|
|
2609
|
-
|
|
2611
|
+
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`PRAGMA table_info(${chunkEDN4Y4ZG_cjs.sql.identifier(table)})`)
|
|
2610
2612
|
) : await backend.execute(
|
|
2611
|
-
|
|
2613
|
+
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
2612
2614
|
SELECT column_name AS name, data_type AS type
|
|
2613
2615
|
FROM information_schema.columns
|
|
2614
2616
|
WHERE table_schema = current_schema()
|
|
@@ -2690,7 +2692,7 @@ async function assertCurrentRecordedSchema(backend, schema, includeIdentity = fa
|
|
|
2690
2692
|
);
|
|
2691
2693
|
const recordedIdentityTable = schema.tables.recordedIdentityAssertions;
|
|
2692
2694
|
if (includeIdentity && (columnTypes.get(recordedIdentityTable)?.size ?? 0) === 0) {
|
|
2693
|
-
throw new
|
|
2695
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
2694
2696
|
"Recorded identity history is not provisioned for this database.",
|
|
2695
2697
|
{
|
|
2696
2698
|
code: "RECORDED_IDENTITY_SCHEMA_MISSING",
|
|
@@ -2710,7 +2712,7 @@ async function assertCurrentRecordedSchema(backend, schema, includeIdentity = fa
|
|
|
2710
2712
|
return [{ ...requirement, actual: actual ?? "missing" }];
|
|
2711
2713
|
});
|
|
2712
2714
|
if (incompatible.length === 0) return;
|
|
2713
|
-
throw new
|
|
2715
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
2714
2716
|
"Recorded-time schema is incompatible with history capture.",
|
|
2715
2717
|
{
|
|
2716
2718
|
code: "RECORDED_SCHEMA_INCOMPATIBLE",
|
|
@@ -2758,7 +2760,7 @@ function edgeRowIdentityKey(row) {
|
|
|
2758
2760
|
return edgeIdentityKey(row.graph_id, row.id);
|
|
2759
2761
|
}
|
|
2760
2762
|
function recordedCaptureSealedError(details) {
|
|
2761
|
-
return new
|
|
2763
|
+
return new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
2762
2764
|
"Recorded-time capture session is sealed: a graph write happened after the transaction's capture was flushed.",
|
|
2763
2765
|
details,
|
|
2764
2766
|
{
|
|
@@ -2768,6 +2770,7 @@ function recordedCaptureSealedError(details) {
|
|
|
2768
2770
|
}
|
|
2769
2771
|
function createRecordedCaptureSession() {
|
|
2770
2772
|
const touched = /* @__PURE__ */ new Map();
|
|
2773
|
+
const forcedGraphRevisions = /* @__PURE__ */ new Set();
|
|
2771
2774
|
let sealed = false;
|
|
2772
2775
|
function touch(entity) {
|
|
2773
2776
|
if (sealed) {
|
|
@@ -2792,9 +2795,13 @@ function createRecordedCaptureSession() {
|
|
|
2792
2795
|
touchIdentityAssertion(graphId, id, afterImage) {
|
|
2793
2796
|
touch({ entity: "identity", graphId, id, afterImage });
|
|
2794
2797
|
},
|
|
2798
|
+
forceGraphRevision(graphId) {
|
|
2799
|
+
if (sealed) throw recordedCaptureSealedError({ graphId });
|
|
2800
|
+
forcedGraphRevisions.add(graphId);
|
|
2801
|
+
},
|
|
2795
2802
|
async flush(target, schema, ownsWriteLock) {
|
|
2796
2803
|
if (sealed) {
|
|
2797
|
-
throw new
|
|
2804
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
2798
2805
|
"Recorded-time capture session was already flushed.",
|
|
2799
2806
|
{},
|
|
2800
2807
|
{
|
|
@@ -2803,9 +2810,13 @@ function createRecordedCaptureSession() {
|
|
|
2803
2810
|
);
|
|
2804
2811
|
}
|
|
2805
2812
|
sealed = true;
|
|
2806
|
-
if (touched.size === 0
|
|
2813
|
+
if (touched.size === 0 && forcedGraphRevisions.size === 0)
|
|
2814
|
+
return /* @__PURE__ */ new Map();
|
|
2807
2815
|
const recordedByGraph = /* @__PURE__ */ new Map();
|
|
2808
|
-
const byGraph =
|
|
2816
|
+
const byGraph = chunkJR6SX5RH_cjs.groupBy(touched.values(), (entity) => entity.graphId);
|
|
2817
|
+
for (const graphId of forcedGraphRevisions) {
|
|
2818
|
+
if (!byGraph.has(graphId)) byGraph.set(graphId, []);
|
|
2819
|
+
}
|
|
2809
2820
|
for (const [graphId, entities] of byGraph) {
|
|
2810
2821
|
const recordedCommit = await allocateRecordedCommit(
|
|
2811
2822
|
target,
|
|
@@ -2846,11 +2857,19 @@ function createRecordedCaptureSession() {
|
|
|
2846
2857
|
);
|
|
2847
2858
|
}
|
|
2848
2859
|
touched.clear();
|
|
2860
|
+
forcedGraphRevisions.clear();
|
|
2849
2861
|
return recordedByGraph;
|
|
2850
2862
|
}
|
|
2851
2863
|
};
|
|
2852
2864
|
}
|
|
2853
2865
|
var recordedIdentityBindings = /* @__PURE__ */ new WeakMap();
|
|
2866
|
+
var recordedRevisionBindings = /* @__PURE__ */ new WeakMap();
|
|
2867
|
+
function forceRecordedGraphRevision(backend, graphId) {
|
|
2868
|
+
const session = recordedRevisionBindings.get(backend);
|
|
2869
|
+
if (session === void 0) return false;
|
|
2870
|
+
session.forceGraphRevision(graphId);
|
|
2871
|
+
return true;
|
|
2872
|
+
}
|
|
2854
2873
|
function ignoreIdentityTouch() {
|
|
2855
2874
|
return;
|
|
2856
2875
|
}
|
|
@@ -2879,7 +2898,7 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
2879
2898
|
await lockRecordedGraphWrite(target, graphId, graphLocks);
|
|
2880
2899
|
}
|
|
2881
2900
|
}
|
|
2882
|
-
const overlay =
|
|
2901
|
+
const overlay = chunk3HGRTCDU_cjs.createBackendOverlay(target, {
|
|
2883
2902
|
...rawWriteGuards(target, "tx.backend"),
|
|
2884
2903
|
async insertNode(params) {
|
|
2885
2904
|
session.assertOpen();
|
|
@@ -3049,6 +3068,7 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
3049
3068
|
registerRecordedGraphLockMemo(overlay, graphLocks);
|
|
3050
3069
|
recordedIdentityBindings.set(overlay, { target, session });
|
|
3051
3070
|
recordedIdentityBindings.set(target, { target, session });
|
|
3071
|
+
recordedRevisionBindings.set(overlay, session);
|
|
3052
3072
|
return overlay;
|
|
3053
3073
|
}
|
|
3054
3074
|
function createRecordedTransactionScope(target, schema, ownsWriteLock = false) {
|
|
@@ -3058,7 +3078,7 @@ function createRecordedTransactionScope(target, schema, ownsWriteLock = false) {
|
|
|
3058
3078
|
return {
|
|
3059
3079
|
backend: createRecordedTransactionBackend(target, session, resolvedSchema),
|
|
3060
3080
|
async flush() {
|
|
3061
|
-
return
|
|
3081
|
+
return chunkJR6SX5RH_cjs.withRecordedRelationsPrecondition(
|
|
3062
3082
|
session.flush(target, resolvedSchema, ownsWriteLock),
|
|
3063
3083
|
{ dialect: target.dialect, surface: "capture-flush" }
|
|
3064
3084
|
);
|
|
@@ -3079,7 +3099,7 @@ function createRecordedBackend(backend, schema) {
|
|
|
3079
3099
|
assertCapturableBackend(backend);
|
|
3080
3100
|
const capture = (fn) => runCapturedAutocommit(backend, schema, fn);
|
|
3081
3101
|
const projectedBackend = createGraphBackendProjection(backend);
|
|
3082
|
-
return
|
|
3102
|
+
return chunk3HGRTCDU_cjs.createBackendOverlay(projectedBackend, {
|
|
3083
3103
|
...rawWriteGuards(backend, "backend"),
|
|
3084
3104
|
async insertNode(params) {
|
|
3085
3105
|
return capture((target) => target.insertNode(params));
|
|
@@ -3113,7 +3133,7 @@ function createRecordedBackend(backend, schema) {
|
|
|
3113
3133
|
return capture((target) => {
|
|
3114
3134
|
const updateNodeSet = target.updateNodeSet;
|
|
3115
3135
|
if (updateNodeSet === void 0) {
|
|
3116
|
-
throw new
|
|
3136
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
3117
3137
|
"Recorded updateNodeSet capability disappeared inside a transaction",
|
|
3118
3138
|
{ operation: "updateNodeSet" }
|
|
3119
3139
|
);
|
|
@@ -3247,6 +3267,7 @@ exports.extractFulltextMatchPredicates = extractFulltextMatchPredicates;
|
|
|
3247
3267
|
exports.extractTemporalOptions = extractTemporalOptions;
|
|
3248
3268
|
exports.extractVectorSimilarityPredicates = extractVectorSimilarityPredicates;
|
|
3249
3269
|
exports.fieldRef = fieldRef;
|
|
3270
|
+
exports.forceRecordedGraphRevision = forceRecordedGraphRevision;
|
|
3250
3271
|
exports.generateId = generateId;
|
|
3251
3272
|
exports.getEdgeRowsByIds = getEdgeRowsByIds;
|
|
3252
3273
|
exports.getFieldPointer = getFieldPointer;
|
|
@@ -3286,5 +3307,5 @@ exports.uncapturedGraphWriteLock = uncapturedGraphWriteLock;
|
|
|
3286
3307
|
exports.withPinnedReadInstant = withPinnedReadInstant;
|
|
3287
3308
|
exports.withRecordedFlushObserver = withRecordedFlushObserver;
|
|
3288
3309
|
exports.withRecordedIdentityMutationTarget = withRecordedIdentityMutationTarget;
|
|
3289
|
-
//# sourceMappingURL=chunk-
|
|
3290
|
-
//# sourceMappingURL=chunk-
|
|
3310
|
+
//# sourceMappingURL=chunk-OIFSOPSR.cjs.map
|
|
3311
|
+
//# sourceMappingURL=chunk-OIFSOPSR.cjs.map
|