@nicia-ai/typegraph 0.44.0 → 0.46.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 +11 -11
- package/dist/backend/drizzle/indexes.d.cts +1 -1
- package/dist/backend/drizzle/indexes.d.ts +1 -1
- package/dist/backend/drizzle/indexes.js +7 -7
- package/dist/backend/index.cjs +53 -54
- package/dist/backend/index.d.cts +3 -3
- package/dist/backend/index.d.ts +3 -3
- package/dist/backend/index.js +13 -14
- package/dist/backend/postgres/index.cjs +29 -30
- package/dist/backend/postgres/index.d.cts +7 -7
- package/dist/backend/postgres/index.d.ts +7 -7
- package/dist/backend/postgres/index.js +16 -17
- package/dist/backend/postgres/pglite-store.cjs +48 -43
- package/dist/backend/postgres/pglite-store.cjs.map +1 -1
- package/dist/backend/postgres/pglite-store.d.cts +15 -9
- package/dist/backend/postgres/pglite-store.d.ts +15 -9
- package/dist/backend/postgres/pglite-store.js +44 -39
- package/dist/backend/postgres/pglite-store.js.map +1 -1
- package/dist/backend/postgres/pglite.cjs +18 -19
- package/dist/backend/postgres/pglite.d.cts +4 -4
- package/dist/backend/postgres/pglite.d.ts +4 -4
- package/dist/backend/postgres/pglite.js +17 -18
- package/dist/backend/sqlite/index.cjs +26 -27
- package/dist/backend/sqlite/index.d.cts +6 -6
- package/dist/backend/sqlite/index.d.ts +6 -6
- package/dist/backend/sqlite/index.js +14 -15
- package/dist/backend/sqlite/libsql.cjs +21 -22
- package/dist/backend/sqlite/libsql.cjs.map +1 -1
- package/dist/backend/sqlite/libsql.d.cts +15 -8
- package/dist/backend/sqlite/libsql.d.ts +15 -8
- package/dist/backend/sqlite/libsql.js +17 -18
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local-store.cjs +49 -44
- package/dist/backend/sqlite/local-store.cjs.map +1 -1
- package/dist/backend/sqlite/local-store.d.cts +15 -10
- package/dist/backend/sqlite/local-store.d.ts +15 -10
- package/dist/backend/sqlite/local-store.js +45 -40
- package/dist/backend/sqlite/local-store.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +19 -20
- package/dist/backend/sqlite/local.d.cts +3 -3
- package/dist/backend/sqlite/local.d.ts +3 -3
- package/dist/backend/sqlite/local.js +17 -18
- package/dist/{chunk-XMYJY7NI.js → chunk-2LG2XB2M.js} +3 -3
- package/dist/{chunk-XMYJY7NI.js.map → chunk-2LG2XB2M.js.map} +1 -1
- package/dist/{chunk-QGKILWGZ.cjs → chunk-2NA5DYLO.cjs} +4 -4
- package/dist/{chunk-QGKILWGZ.cjs.map → chunk-2NA5DYLO.cjs.map} +1 -1
- package/dist/{chunk-5MUSU4ZP.cjs → chunk-3DHZCOT7.cjs} +20 -20
- package/dist/chunk-3DHZCOT7.cjs.map +1 -0
- package/dist/{chunk-OVUUTCPJ.cjs → chunk-4UGOKMI5.cjs} +268 -150
- package/dist/chunk-4UGOKMI5.cjs.map +1 -0
- package/dist/{chunk-FRHHDHKH.js → chunk-5262ZMTR.js} +26 -5
- package/dist/chunk-5262ZMTR.js.map +1 -0
- package/dist/{chunk-HOIFFY4M.js → chunk-5763DULU.js} +248 -76
- package/dist/chunk-5763DULU.js.map +1 -0
- package/dist/{chunk-7G32LIQM.js → chunk-5UVRGXD3.js} +277 -7
- package/dist/chunk-5UVRGXD3.js.map +1 -0
- package/dist/{chunk-IIT5K7SK.cjs → chunk-62ZP23AW.cjs} +15 -15
- package/dist/{chunk-IIT5K7SK.cjs.map → chunk-62ZP23AW.cjs.map} +1 -1
- package/dist/{chunk-S4KQ5LV4.js → chunk-775A4ZMN.js} +40 -6
- package/dist/chunk-775A4ZMN.js.map +1 -0
- package/dist/{chunk-QYWINYEA.cjs → chunk-7BQXPCGN.cjs} +830 -170
- package/dist/chunk-7BQXPCGN.cjs.map +1 -0
- package/dist/{chunk-FJMPR3OH.cjs → chunk-7EO3TCQB.cjs} +33 -7
- package/dist/chunk-7EO3TCQB.cjs.map +1 -0
- package/dist/chunk-7GT72YHH.cjs +1979 -0
- package/dist/chunk-7GT72YHH.cjs.map +1 -0
- package/dist/{chunk-SQRD2CYF.js → chunk-7VQXLT5O.js} +717 -76
- package/dist/chunk-7VQXLT5O.js.map +1 -0
- package/dist/{chunk-BCP7LLOY.js → chunk-7Z5OR7KO.js} +2706 -625
- package/dist/chunk-7Z5OR7KO.js.map +1 -0
- package/dist/chunk-A4OC4DVN.cjs +12 -0
- package/dist/{chunk-4SZ6XPTG.cjs.map → chunk-A4OC4DVN.cjs.map} +1 -1
- package/dist/{chunk-TDXIBCGY.cjs → chunk-A7J2YDDI.cjs} +5 -3
- package/dist/chunk-A7J2YDDI.cjs.map +1 -0
- package/dist/{chunk-FMMIX6N4.js → chunk-AKLS3BYZ.js} +56 -5
- package/dist/chunk-AKLS3BYZ.js.map +1 -0
- package/dist/{chunk-D7PG5D5K.js → chunk-AMKPPFUO.js} +32 -6
- package/dist/chunk-AMKPPFUO.js.map +1 -0
- package/dist/{chunk-PAW2XUZN.js → chunk-ASTI57H3.js} +3 -3
- package/dist/{chunk-PAW2XUZN.js.map → chunk-ASTI57H3.js.map} +1 -1
- package/dist/{chunk-FMGEZBAQ.js → chunk-BKCUOV7A.js} +27 -5
- package/dist/chunk-BKCUOV7A.js.map +1 -0
- package/dist/chunk-BSFJMMV3.cjs +268 -0
- package/dist/chunk-BSFJMMV3.cjs.map +1 -0
- package/dist/{chunk-63KCKSSH.js → chunk-C23WSN5E.js} +209 -24
- package/dist/chunk-C23WSN5E.js.map +1 -0
- package/dist/{chunk-JRP3VGHS.js → chunk-CBTIUB76.js} +3 -3
- package/dist/{chunk-JRP3VGHS.js.map → chunk-CBTIUB76.js.map} +1 -1
- package/dist/chunk-CNV4TXJG.js +58 -0
- package/dist/chunk-CNV4TXJG.js.map +1 -0
- package/dist/{chunk-QB6VMOJ2.cjs → chunk-CXBHOOIQ.cjs} +45 -10
- package/dist/chunk-CXBHOOIQ.cjs.map +1 -0
- package/dist/{chunk-46GDII45.js → chunk-DCQVHAYQ.js} +5 -5
- package/dist/{chunk-46GDII45.js.map → chunk-DCQVHAYQ.js.map} +1 -1
- package/dist/chunk-DLNROMQ7.js +306 -0
- package/dist/chunk-DLNROMQ7.js.map +1 -0
- package/dist/chunk-DYATYRY4.js +47 -0
- package/dist/chunk-DYATYRY4.js.map +1 -0
- package/dist/chunk-E4WNQBEF.cjs +217 -0
- package/dist/chunk-E4WNQBEF.cjs.map +1 -0
- package/dist/{chunk-G6Q5UM7U.js → chunk-FWJKWH6U.js} +5 -3
- package/dist/chunk-FWJKWH6U.js.map +1 -0
- package/dist/{chunk-BNUFUFAU.js → chunk-HFHTMECK.js} +7 -7
- package/dist/chunk-HFHTMECK.js.map +1 -0
- package/dist/{chunk-TFMVL4QH.js → chunk-I5MOXA4H.js} +20 -14
- package/dist/chunk-I5MOXA4H.js.map +1 -0
- package/dist/{chunk-4MB3AQAQ.js → chunk-J3WZ3FA2.js} +77 -3
- package/dist/chunk-J3WZ3FA2.js.map +1 -0
- package/dist/{chunk-UR7W5YQK.js → chunk-JBQQ7THH.js} +5 -3
- package/dist/chunk-JBQQ7THH.js.map +1 -0
- package/dist/chunk-JIVMTW7W.js +3393 -0
- package/dist/chunk-JIVMTW7W.js.map +1 -0
- package/dist/{chunk-2Y4IFKW7.js → chunk-JXA2ZP2Q.js} +6 -17
- package/dist/chunk-JXA2ZP2Q.js.map +1 -0
- package/dist/{chunk-GYA4JRP5.js → chunk-JXXDZTMN.js} +2 -2
- package/dist/chunk-JXXDZTMN.js.map +1 -0
- package/dist/chunk-JZUR7ZWE.js +254 -0
- package/dist/chunk-JZUR7ZWE.js.map +1 -0
- package/dist/chunk-K5ELX2GT.js +248 -0
- package/dist/chunk-K5ELX2GT.js.map +1 -0
- package/dist/chunk-LBJKZXDE.cjs +257 -0
- package/dist/chunk-LBJKZXDE.cjs.map +1 -0
- package/dist/{chunk-FGO5JFVJ.cjs → chunk-M4BDU5RX.cjs} +12 -12
- package/dist/{chunk-FGO5JFVJ.cjs.map → chunk-M4BDU5RX.cjs.map} +1 -1
- package/dist/{chunk-MIJKEVV7.js → chunk-MSY7FSX4.js} +37 -4
- package/dist/chunk-MSY7FSX4.js.map +1 -0
- package/dist/{chunk-ST3LPB2V.cjs → chunk-MUK4BU7K.cjs} +788 -146
- package/dist/chunk-MUK4BU7K.cjs.map +1 -0
- package/dist/{chunk-MCHP7RHZ.cjs → chunk-MXJDTH5B.cjs} +64 -41
- package/dist/chunk-MXJDTH5B.cjs.map +1 -0
- package/dist/{chunk-2VLBGQBY.cjs → chunk-N3257XE6.cjs} +724 -577
- package/dist/chunk-N3257XE6.cjs.map +1 -0
- package/dist/chunk-N66HCGCY.cjs +57 -0
- package/dist/chunk-N66HCGCY.cjs.map +1 -0
- package/dist/{chunk-CPEL3YIR.cjs → chunk-NFCVHQ5P.cjs} +55 -22
- package/dist/chunk-NFCVHQ5P.cjs.map +1 -0
- package/dist/{chunk-C4F7VJ5D.cjs → chunk-NI72YOJB.cjs} +84 -2
- package/dist/chunk-NI72YOJB.cjs.map +1 -0
- package/dist/{chunk-EE7N5XXQ.cjs → chunk-NK5Q7UNE.cjs} +10 -21
- package/dist/chunk-NK5Q7UNE.cjs.map +1 -0
- package/dist/{chunk-PHXITZE4.js → chunk-NMWDXFPH.js} +4 -4
- package/dist/{chunk-PHXITZE4.js.map → chunk-NMWDXFPH.js.map} +1 -1
- package/dist/{chunk-FSXTPBRN.js → chunk-NQ6BRJBE.js} +416 -850
- package/dist/chunk-NQ6BRJBE.js.map +1 -0
- package/dist/chunk-OH5E5KIO.js +2057 -0
- package/dist/chunk-OH5E5KIO.js.map +1 -0
- package/dist/chunk-ONU3HIED.cjs +2082 -0
- package/dist/chunk-ONU3HIED.cjs.map +1 -0
- package/dist/{chunk-STQ3BSED.cjs → chunk-PNN7RHVR.cjs} +66 -44
- package/dist/chunk-PNN7RHVR.cjs.map +1 -0
- package/dist/{chunk-6DCB664D.js → chunk-PQBQG7IM.js} +3 -3
- package/dist/{chunk-6DCB664D.js.map → chunk-PQBQG7IM.js.map} +1 -1
- package/dist/{chunk-ACSVZPK7.cjs → chunk-PWLJ77UV.cjs} +5 -3
- package/dist/chunk-PWLJ77UV.cjs.map +1 -0
- package/dist/chunk-Q7Q4WSLJ.cjs +328 -0
- package/dist/chunk-Q7Q4WSLJ.cjs.map +1 -0
- package/dist/{chunk-BEFM74L2.js → chunk-QLRESYPU.js} +637 -493
- package/dist/chunk-QLRESYPU.js.map +1 -0
- package/dist/{chunk-SBPC5IP3.js → chunk-QWX5YA3K.js} +784 -202
- package/dist/chunk-QWX5YA3K.js.map +1 -0
- package/dist/{chunk-TCRIQMBU.js → chunk-RJS7DECT.js} +8 -9
- package/dist/chunk-RJS7DECT.js.map +1 -0
- package/dist/{chunk-6JZUSDY2.cjs → chunk-RMQLSPA2.cjs} +297 -27
- package/dist/chunk-RMQLSPA2.cjs.map +1 -0
- package/dist/{chunk-SJDMVITW.cjs → chunk-RT5ZY4XA.cjs} +6 -5
- package/dist/chunk-RT5ZY4XA.cjs.map +1 -0
- package/dist/{chunk-IJTLXNGJ.js → chunk-T4XNKYXB.js} +780 -127
- package/dist/chunk-T4XNKYXB.js.map +1 -0
- package/dist/{chunk-PDGEXGS6.cjs → chunk-TQR4KBY2.cjs} +354 -182
- package/dist/chunk-TQR4KBY2.cjs.map +1 -0
- package/dist/chunk-TTAITEPJ.cjs +755 -0
- package/dist/chunk-TTAITEPJ.cjs.map +1 -0
- package/dist/{chunk-NN3QSOVS.cjs → chunk-U5SON7R2.cjs} +27 -27
- package/dist/{chunk-NN3QSOVS.cjs.map → chunk-U5SON7R2.cjs.map} +1 -1
- package/dist/{chunk-A2I2XO52.cjs → chunk-U63GDNRC.cjs} +32 -26
- package/dist/chunk-U63GDNRC.cjs.map +1 -0
- package/dist/{chunk-YNULOIR5.cjs → chunk-UDISNXDL.cjs} +64 -43
- package/dist/chunk-UDISNXDL.cjs.map +1 -0
- package/dist/{chunk-GWEDD3DH.js → chunk-UV3SN74I.js} +5 -5
- package/dist/{chunk-GWEDD3DH.js.map → chunk-UV3SN74I.js.map} +1 -1
- package/dist/{chunk-U5W4LKZV.cjs → chunk-VCRRKBLN.cjs} +9 -9
- package/dist/{chunk-U5W4LKZV.cjs.map → chunk-VCRRKBLN.cjs.map} +1 -1
- package/dist/{chunk-EFELJVLA.js → chunk-VGTJPTIC.js} +28 -5
- package/dist/chunk-VGTJPTIC.js.map +1 -0
- package/dist/chunk-VQH4VAWD.cjs +12 -0
- package/dist/{chunk-EPTSMFH7.cjs.map → chunk-VQH4VAWD.cjs.map} +1 -1
- package/dist/{chunk-SNXVDZAJ.js → chunk-W6OG3HDG.js} +5 -4
- package/dist/chunk-W6OG3HDG.js.map +1 -0
- package/dist/chunk-WDGA7IYB.js +207 -0
- package/dist/chunk-WDGA7IYB.js.map +1 -0
- package/dist/chunk-WEVQJ5LH.js +736 -0
- package/dist/chunk-WEVQJ5LH.js.map +1 -0
- package/dist/{chunk-3PRKZW6D.cjs → chunk-XBYVV3MP.cjs} +60 -5
- package/dist/chunk-XBYVV3MP.cjs.map +1 -0
- package/dist/{chunk-GFRGG2US.cjs → chunk-XCAGZAKP.cjs} +7 -7
- package/dist/{chunk-GFRGG2US.cjs.map → chunk-XCAGZAKP.cjs.map} +1 -1
- package/dist/{chunk-XR4YZFKW.cjs → chunk-XDF2UPEQ.cjs} +3864 -1783
- package/dist/chunk-XDF2UPEQ.cjs.map +1 -0
- package/dist/{chunk-7V2FGGI2.cjs → chunk-XMQSEJCF.cjs} +632 -1080
- package/dist/chunk-XMQSEJCF.cjs.map +1 -0
- package/dist/chunk-XNLIZYRZ.cjs +3432 -0
- package/dist/chunk-XNLIZYRZ.cjs.map +1 -0
- package/dist/{chunk-66UVLHQA.cjs → chunk-XNSI2FJO.cjs} +99 -100
- package/dist/chunk-XNSI2FJO.cjs.map +1 -0
- package/dist/chunk-XQSCL77R.cjs +60 -0
- package/dist/chunk-XQSCL77R.cjs.map +1 -0
- package/dist/{chunk-SVJ5GEXW.cjs → chunk-XUO3KQFO.cjs} +2 -2
- package/dist/chunk-XUO3KQFO.cjs.map +1 -0
- package/dist/{chunk-HJH3RMXG.cjs → chunk-YAAM3M2S.cjs} +10 -10
- package/dist/{chunk-HJH3RMXG.cjs.map → chunk-YAAM3M2S.cjs.map} +1 -1
- package/dist/{chunk-ATLN63JA.js → chunk-YBFHZUXX.js} +6 -6
- package/dist/{chunk-ATLN63JA.js.map → chunk-YBFHZUXX.js.map} +1 -1
- package/dist/{chunk-K3BUWSFR.js → chunk-YDFDBE6D.js} +119 -6
- package/dist/chunk-YDFDBE6D.js.map +1 -0
- package/dist/{chunk-OSZPLZIV.cjs → chunk-YVWGEQJE.cjs} +318 -132
- package/dist/chunk-YVWGEQJE.cjs.map +1 -0
- package/dist/{chunk-QT6V3YRH.js → chunk-YWGVVALJ.js} +3 -3
- package/dist/{chunk-QT6V3YRH.js.map → chunk-YWGVVALJ.js.map} +1 -1
- package/dist/core/index.cjs +40 -41
- package/dist/core/index.d.cts +4 -5
- package/dist/core/index.d.ts +4 -5
- package/dist/core/index.js +8 -9
- package/dist/{ddl-eWg7hx6R.d.cts → ddl-BJcOp4WZ.d.cts} +3 -3
- package/dist/{ddl-D5369kOY.d.ts → ddl-BXfGHbPN.d.ts} +3 -3
- package/dist/graph-extension/index.cjs +26 -23
- package/dist/graph-extension/index.d.cts +16 -6
- package/dist/graph-extension/index.d.ts +16 -6
- package/dist/graph-extension/index.js +7 -8
- package/dist/graph-merge/index.cjs +2459 -655
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +170 -33
- package/dist/graph-merge/index.d.ts +170 -33
- package/dist/graph-merge/index.js +2269 -468
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-By89Sezh.d.ts → index-BSHvKfok.d.ts} +221 -10
- package/dist/{index-DcQ3Sxs-.d.cts → index-DxaYCv8Y.d.cts} +221 -10
- package/dist/index.cjs +330 -269
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +590 -576
- package/dist/index.d.ts +590 -576
- package/dist/index.js +73 -50
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +17 -17
- package/dist/indexes/index.d.cts +4 -4
- package/dist/indexes/index.d.ts +4 -4
- package/dist/indexes/index.js +10 -10
- package/dist/interchange/index.cjs +165 -50
- package/dist/interchange/index.cjs.map +1 -1
- package/dist/interchange/index.d.cts +261 -16
- package/dist/interchange/index.d.ts +261 -16
- package/dist/interchange/index.js +128 -24
- package/dist/interchange/index.js.map +1 -1
- package/dist/{manager-B0KjKE93.d.ts → manager-CfZAimti.d.ts} +36 -5
- package/dist/{manager-Cn0NFIhN.d.cts → manager-HGk6E_HW.d.cts} +36 -5
- package/dist/{materialize-indexes-BD4V3svD.d.ts → materialize-indexes-6A7dWGtb.d.cts} +10 -2
- package/dist/{materialize-indexes-DVRhd5h4.d.cts → materialize-indexes-BMJP6Tms.d.ts} +10 -2
- package/dist/{postgres-DaEWvN4x.d.cts → postgres-DFYWENdR.d.cts} +1961 -439
- package/dist/{postgres-u0a0HN2D.d.ts → postgres-e7a9TdvR.d.ts} +1961 -439
- package/dist/profiler/index.cjs +15 -15
- package/dist/profiler/index.d.cts +9 -10
- package/dist/profiler/index.d.ts +9 -10
- package/dist/profiler/index.js +4 -4
- package/dist/provenance/index.cjs +46 -48
- 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 -14
- package/dist/provenance/index.js.map +1 -1
- package/dist/schema/index.cjs +50 -49
- package/dist/schema/index.d.cts +9 -16
- package/dist/schema/index.d.ts +9 -16
- package/dist/schema/index.js +23 -22
- package/dist/{searchable-CnYEancP.d.ts → searchable-9OQoPuRs.d.ts} +1 -2
- package/dist/{searchable-BT7j9_IK.d.cts → searchable-CIje5XYD.d.cts} +1 -2
- package/dist/{sqlite-BrMoSsI7.d.cts → sqlite-DerU5tc7.d.ts} +2029 -347
- package/dist/{sqlite-CHhZUyO5.d.ts → sqlite-DitnISa9.d.cts} +2029 -347
- package/dist/{store-view-Bvdku0Ht.d.ts → store-DawaWWjJ.d.ts} +3145 -2556
- package/dist/{store-view-w-md0nQ4.d.cts → store-RwTJx8LX.d.cts} +3145 -2556
- package/dist/{temporal-BCORwUau.d.cts → temporal-Bn-Fi8FJ.d.cts} +1 -1
- package/dist/{temporal--x9T8K4S.d.ts → temporal-BtM4UALv.d.ts} +1 -1
- package/dist/{types-6-WJmSD4.d.cts → types-CoIx8HX5.d.cts} +1 -1
- package/dist/{types-Cjvkj0jA.d.ts → types-HkveCCx0.d.cts} +866 -21
- package/dist/{types-Cjvkj0jA.d.cts → types-HkveCCx0.d.ts} +866 -21
- package/dist/{types-COODtTJU.d.ts → types-KFfk-8Ah.d.ts} +1 -1
- package/dist/{where-CUQmCR6d.d.cts → where--fk7_0kv.d.cts} +1 -1
- package/dist/{where-5xVawAwL.d.ts → where-ws5hf-Ov.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-2BIG7U6E.cjs +0 -83
- package/dist/chunk-2BIG7U6E.cjs.map +0 -1
- package/dist/chunk-2L54C2C2.js +0 -144
- package/dist/chunk-2L54C2C2.js.map +0 -1
- package/dist/chunk-2VLBGQBY.cjs.map +0 -1
- package/dist/chunk-2WDD2NO3.js +0 -59
- package/dist/chunk-2WDD2NO3.js.map +0 -1
- package/dist/chunk-2Y4IFKW7.js.map +0 -1
- package/dist/chunk-35S6P5ZU.js +0 -27
- package/dist/chunk-35S6P5ZU.js.map +0 -1
- package/dist/chunk-3PRKZW6D.cjs.map +0 -1
- package/dist/chunk-4MB3AQAQ.js.map +0 -1
- package/dist/chunk-4SZ6XPTG.cjs +0 -12
- package/dist/chunk-5MUSU4ZP.cjs.map +0 -1
- package/dist/chunk-63KCKSSH.js.map +0 -1
- package/dist/chunk-66UVLHQA.cjs.map +0 -1
- package/dist/chunk-6JZUSDY2.cjs.map +0 -1
- package/dist/chunk-764JHTLT.cjs +0 -15
- package/dist/chunk-764JHTLT.cjs.map +0 -1
- package/dist/chunk-7G32LIQM.js.map +0 -1
- package/dist/chunk-7V2FGGI2.cjs.map +0 -1
- package/dist/chunk-A2I2XO52.cjs.map +0 -1
- package/dist/chunk-A4PBRX4C.cjs +0 -100
- package/dist/chunk-A4PBRX4C.cjs.map +0 -1
- package/dist/chunk-ACSVZPK7.cjs.map +0 -1
- package/dist/chunk-ALFUGRYB.cjs +0 -1282
- package/dist/chunk-ALFUGRYB.cjs.map +0 -1
- package/dist/chunk-B75XRV3O.js +0 -125
- package/dist/chunk-B75XRV3O.js.map +0 -1
- package/dist/chunk-BCP7LLOY.js.map +0 -1
- package/dist/chunk-BEFM74L2.js.map +0 -1
- package/dist/chunk-BNUFUFAU.js.map +0 -1
- package/dist/chunk-C4F7VJ5D.cjs.map +0 -1
- package/dist/chunk-CPEL3YIR.cjs.map +0 -1
- package/dist/chunk-D7PG5D5K.js.map +0 -1
- package/dist/chunk-DI74SMXS.cjs +0 -29
- package/dist/chunk-DI74SMXS.cjs.map +0 -1
- package/dist/chunk-DK2S42XB.js +0 -77
- package/dist/chunk-DK2S42XB.js.map +0 -1
- package/dist/chunk-DRACN6XG.js +0 -27
- package/dist/chunk-DRACN6XG.js.map +0 -1
- package/dist/chunk-EE7N5XXQ.cjs.map +0 -1
- package/dist/chunk-EFELJVLA.js.map +0 -1
- package/dist/chunk-EPTSMFH7.cjs +0 -12
- package/dist/chunk-EQ7JKLZO.cjs +0 -157
- package/dist/chunk-EQ7JKLZO.cjs.map +0 -1
- package/dist/chunk-FJMPR3OH.cjs.map +0 -1
- package/dist/chunk-FMGEZBAQ.js.map +0 -1
- package/dist/chunk-FMMIX6N4.js.map +0 -1
- package/dist/chunk-FRHHDHKH.js.map +0 -1
- package/dist/chunk-FSXTPBRN.js.map +0 -1
- package/dist/chunk-G6Q5UM7U.js.map +0 -1
- package/dist/chunk-GYA4JRP5.js.map +0 -1
- package/dist/chunk-HOHAJ2NR.cjs +0 -61
- package/dist/chunk-HOHAJ2NR.cjs.map +0 -1
- package/dist/chunk-HOIFFY4M.js.map +0 -1
- package/dist/chunk-IIMQJYAM.js +0 -81
- package/dist/chunk-IIMQJYAM.js.map +0 -1
- package/dist/chunk-IJTLXNGJ.js.map +0 -1
- package/dist/chunk-ITE4IXAK.js +0 -25
- package/dist/chunk-ITE4IXAK.js.map +0 -1
- package/dist/chunk-K3BUWSFR.js.map +0 -1
- package/dist/chunk-KCO5EFJU.js +0 -79
- package/dist/chunk-KCO5EFJU.js.map +0 -1
- package/dist/chunk-KKYELPZ2.cjs +0 -83
- package/dist/chunk-KKYELPZ2.cjs.map +0 -1
- package/dist/chunk-MCHP7RHZ.cjs.map +0 -1
- package/dist/chunk-MIJKEVV7.js.map +0 -1
- package/dist/chunk-NCX65HBY.cjs +0 -1396
- package/dist/chunk-NCX65HBY.cjs.map +0 -1
- package/dist/chunk-OSZPLZIV.cjs.map +0 -1
- package/dist/chunk-OVUUTCPJ.cjs.map +0 -1
- package/dist/chunk-PDGEXGS6.cjs.map +0 -1
- package/dist/chunk-QB6VMOJ2.cjs.map +0 -1
- package/dist/chunk-QMQLUA66.js +0 -12
- package/dist/chunk-QMQLUA66.js.map +0 -1
- package/dist/chunk-QYWINYEA.cjs.map +0 -1
- package/dist/chunk-S4KQ5LV4.js.map +0 -1
- package/dist/chunk-SBPC5IP3.js.map +0 -1
- package/dist/chunk-SJDMVITW.cjs.map +0 -1
- package/dist/chunk-SNXVDZAJ.js.map +0 -1
- package/dist/chunk-SQRD2CYF.js.map +0 -1
- package/dist/chunk-ST3LPB2V.cjs.map +0 -1
- package/dist/chunk-STQ3BSED.cjs.map +0 -1
- package/dist/chunk-SVJ5GEXW.cjs.map +0 -1
- package/dist/chunk-TCRIQMBU.js.map +0 -1
- package/dist/chunk-TDXIBCGY.cjs.map +0 -1
- package/dist/chunk-TFMVL4QH.js.map +0 -1
- package/dist/chunk-TRF4EBJT.cjs +0 -30
- package/dist/chunk-TRF4EBJT.cjs.map +0 -1
- package/dist/chunk-TVLKA4AY.js +0 -94
- package/dist/chunk-TVLKA4AY.js.map +0 -1
- package/dist/chunk-UR7W5YQK.js.map +0 -1
- package/dist/chunk-VITTKBWF.js +0 -1263
- package/dist/chunk-VITTKBWF.js.map +0 -1
- package/dist/chunk-WBUFJ7BS.cjs +0 -131
- package/dist/chunk-WBUFJ7BS.cjs.map +0 -1
- package/dist/chunk-XR4YZFKW.cjs.map +0 -1
- package/dist/chunk-YNULOIR5.cjs.map +0 -1
- package/dist/chunk-ZDH3DX3C.cjs +0 -30
- package/dist/chunk-ZDH3DX3C.cjs.map +0 -1
- package/dist/chunk-ZTAJL4DT.cjs +0 -85
- package/dist/chunk-ZTAJL4DT.cjs.map +0 -1
- package/dist/define-graph-DVF-oN1i.d.cts +0 -173
- package/dist/define-graph-SvYXOl78.d.ts +0 -173
|
@@ -1,42 +1,87 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var chunkWBUFJ7BS_cjs = require('./chunk-WBUFJ7BS.cjs');
|
|
3
|
+
var chunkYAAM3M2S_cjs = require('./chunk-YAAM3M2S.cjs');
|
|
4
|
+
var chunkRMQLSPA2_cjs = require('./chunk-RMQLSPA2.cjs');
|
|
5
|
+
var chunkU5SON7R2_cjs = require('./chunk-U5SON7R2.cjs');
|
|
6
|
+
var chunkPWLJ77UV_cjs = require('./chunk-PWLJ77UV.cjs');
|
|
7
|
+
var chunkBSFJMMV3_cjs = require('./chunk-BSFJMMV3.cjs');
|
|
8
|
+
var chunkXBYVV3MP_cjs = require('./chunk-XBYVV3MP.cjs');
|
|
10
9
|
var chunkZY4GXIVN_cjs = require('./chunk-ZY4GXIVN.cjs');
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
10
|
+
var chunk4UGOKMI5_cjs = require('./chunk-4UGOKMI5.cjs');
|
|
11
|
+
var chunkVCRRKBLN_cjs = require('./chunk-VCRRKBLN.cjs');
|
|
12
|
+
var chunkNI72YOJB_cjs = require('./chunk-NI72YOJB.cjs');
|
|
13
|
+
var chunkN66HCGCY_cjs = require('./chunk-N66HCGCY.cjs');
|
|
14
14
|
var drizzleOrm = require('drizzle-orm');
|
|
15
15
|
|
|
16
16
|
// src/backend/edge-endpoint-sets.ts
|
|
17
17
|
var FIND_EDGES_ENDPOINT_FIXED_PARAM_COUNT = 6;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (limitPerEndpoint
|
|
21
|
-
|
|
22
|
-
`findEdgesByEndpointSet \`limitPerEndpoint\` must be a positive integer, received ${String(limitPerEndpoint)}.`,
|
|
23
|
-
{
|
|
24
|
-
code: "EDGE_ENDPOINT_SET_INVALID",
|
|
25
|
-
graphId: params.graphId,
|
|
26
|
-
kind: params.kind
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
suggestion: "Pass a positive integer to cap each endpoint's rows, or omit it for an unbounded read."
|
|
30
|
-
}
|
|
31
|
-
);
|
|
18
|
+
var FIND_EDGES_HETEROGENEOUS_FIXED_PARAM_COUNT = 4;
|
|
19
|
+
function assertLimitPerEndpoint(operation, graphId, limitPerEndpoint, kind) {
|
|
20
|
+
if (limitPerEndpoint === void 0 || Number.isInteger(limitPerEndpoint) && limitPerEndpoint > 0) {
|
|
21
|
+
return;
|
|
32
22
|
}
|
|
23
|
+
throw new chunkNI72YOJB_cjs.ConfigurationError(
|
|
24
|
+
`${operation} \`limitPerEndpoint\` must be a positive integer, received ${String(limitPerEndpoint)}.`,
|
|
25
|
+
{
|
|
26
|
+
code: "EDGE_ENDPOINT_SET_INVALID",
|
|
27
|
+
graphId,
|
|
28
|
+
...kind === void 0 ? {} : { kind }
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
suggestion: "Pass a positive integer to cap each endpoint's rows, or omit it for an unbounded read."
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
function resolveEdgeEndpointIds(params) {
|
|
36
|
+
assertLimitPerEndpoint(
|
|
37
|
+
"findEdgesByEndpointSet",
|
|
38
|
+
params.graphId,
|
|
39
|
+
params.limitPerEndpoint,
|
|
40
|
+
params.kind
|
|
41
|
+
);
|
|
33
42
|
return [...new Set(params.endpointIds)];
|
|
34
43
|
}
|
|
44
|
+
function endpointKey(endpoint) {
|
|
45
|
+
return `${endpoint.kind}\0${endpoint.id}`;
|
|
46
|
+
}
|
|
47
|
+
function resolveHeterogeneousEdgeRead(params, maxBindParameters) {
|
|
48
|
+
assertLimitPerEndpoint(
|
|
49
|
+
"findEdgesByHeterogeneousEndpointSet",
|
|
50
|
+
params.graphId,
|
|
51
|
+
params.limitPerEndpoint
|
|
52
|
+
);
|
|
53
|
+
const edgeKinds = [...new Set(params.edgeKinds)];
|
|
54
|
+
const endpoints = [
|
|
55
|
+
...new Map(
|
|
56
|
+
params.endpoints.map((endpoint) => [endpointKey(endpoint), endpoint])
|
|
57
|
+
).values()
|
|
58
|
+
];
|
|
59
|
+
if (edgeKinds.length === 0 || endpoints.length === 0) {
|
|
60
|
+
return { edgeKinds, endpoints, endpointChunkSize: 1 };
|
|
61
|
+
}
|
|
62
|
+
const endpointBindBudget = maxBindParameters - FIND_EDGES_HETEROGENEOUS_FIXED_PARAM_COUNT - edgeKinds.length;
|
|
63
|
+
const endpointChunkSize = Math.floor(endpointBindBudget / 2);
|
|
64
|
+
if (endpointChunkSize >= 1) {
|
|
65
|
+
return { edgeKinds, endpoints, endpointChunkSize };
|
|
66
|
+
}
|
|
67
|
+
throw new chunkNI72YOJB_cjs.ConfigurationError(
|
|
68
|
+
"findEdgesByHeterogeneousEndpointSet cannot fit one endpoint and the selected edge kinds within the backend bind-parameter budget.",
|
|
69
|
+
{
|
|
70
|
+
code: "EDGE_HETEROGENEOUS_READ_BIND_BUDGET_EXCEEDED",
|
|
71
|
+
graphId: params.graphId,
|
|
72
|
+
edgeKindCount: edgeKinds.length,
|
|
73
|
+
maxBindParameters
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
suggestion: "Select fewer edge kinds in one call or use a backend with a larger bind-parameter budget."
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
35
80
|
|
|
36
81
|
// src/backend/live-node-candidates.ts
|
|
37
82
|
function buildLiveNodeCandidates(nodesTableName, graphId, nodeKind, now) {
|
|
38
|
-
const nodes =
|
|
39
|
-
return
|
|
83
|
+
const nodes = chunkVCRRKBLN_cjs.sql.identifier(nodesTableName);
|
|
84
|
+
return chunkVCRRKBLN_cjs.sql`
|
|
40
85
|
SELECT "id" AS node_id
|
|
41
86
|
FROM ${nodes}
|
|
42
87
|
WHERE "graph_id" = ${graphId}
|
|
@@ -77,10 +122,10 @@ function vectorSlotFromDropIndexParams(params) {
|
|
|
77
122
|
};
|
|
78
123
|
}
|
|
79
124
|
function mapVectorWriteError(error, params) {
|
|
80
|
-
const mismatch =
|
|
125
|
+
const mismatch = chunkBSFJMMV3_cjs.parseDimensionMismatch(error);
|
|
81
126
|
if (mismatch === void 0) return error;
|
|
82
127
|
const attempted = mismatch.actual ?? "a different number of";
|
|
83
|
-
return new
|
|
128
|
+
return new chunkNI72YOJB_cjs.EmbeddingDimensionChangedError(
|
|
84
129
|
`Embedding "${params.nodeKind}.${params.fieldPath}" was written with ${attempted} dimensions, but its per-field storage expects ${mismatch.expected}. The field's embedding dimension changed; existing vectors must be recreated and re-embedded.`,
|
|
85
130
|
{
|
|
86
131
|
kind: params.nodeKind,
|
|
@@ -96,7 +141,7 @@ var SQLITE_CONTRIBUTION_MAT_TIMESTAMPS = {
|
|
|
96
141
|
encode: (value) => value
|
|
97
142
|
};
|
|
98
143
|
var POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS = {
|
|
99
|
-
decode:
|
|
144
|
+
decode: chunkYAAM3M2S_cjs.formatPostgresTimestamp,
|
|
100
145
|
encode: (value) => new Date(value)
|
|
101
146
|
};
|
|
102
147
|
function mapContributionMaterializationRow(row, decode) {
|
|
@@ -146,7 +191,7 @@ function contributionSignatureInput(dialect, identity, createDdl) {
|
|
|
146
191
|
tableName: identity.tableName,
|
|
147
192
|
createDdl
|
|
148
193
|
};
|
|
149
|
-
return JSON.stringify(hashable,
|
|
194
|
+
return JSON.stringify(hashable, chunkPWLJ77UV_cjs.sortedReplacer);
|
|
150
195
|
}
|
|
151
196
|
function evaluateContributionState(row, signature) {
|
|
152
197
|
if (row === void 0) return "missing";
|
|
@@ -161,6 +206,9 @@ function diagnoseContribution(row, signature, tableExists) {
|
|
|
161
206
|
if (row.materializedAt !== void 0) return "orphaned-marker";
|
|
162
207
|
return row.lastError === void 0 ? void 0 : "failed-materialization";
|
|
163
208
|
}
|
|
209
|
+
if (row?.materializedAt !== void 0 && row.signature !== signature) {
|
|
210
|
+
return "stale";
|
|
211
|
+
}
|
|
164
212
|
const state = evaluateContributionState(row, signature);
|
|
165
213
|
switch (state) {
|
|
166
214
|
case "initialized": {
|
|
@@ -178,6 +226,20 @@ function diagnoseContribution(row, signature, tableExists) {
|
|
|
178
226
|
}
|
|
179
227
|
}
|
|
180
228
|
}
|
|
229
|
+
var PROBE_PROJECTION_ORDER = [
|
|
230
|
+
"fulltext",
|
|
231
|
+
"vector"
|
|
232
|
+
];
|
|
233
|
+
var PROBE_DETAIL_PHRASE = {
|
|
234
|
+
"orphaned-marker": "storage is missing",
|
|
235
|
+
"missing-marker": "storage is not attested by a durable marker",
|
|
236
|
+
"failed-materialization": "provisioning failed and produced no storage",
|
|
237
|
+
stale: "storage exists at a different shape than the current declaration"
|
|
238
|
+
};
|
|
239
|
+
function describeProbeDiagnostic(diagnostic) {
|
|
240
|
+
const subject = diagnostic.kind === void 0 || diagnostic.fieldPath === void 0 ? `table "${diagnostic.physicalName}"` : `${diagnostic.kind}.${diagnostic.fieldPath}`;
|
|
241
|
+
return `${subject}: ${PROBE_DETAIL_PHRASE[diagnostic.state]} (${diagnostic.state})`;
|
|
242
|
+
}
|
|
181
243
|
function identityOf(graphId, contribution) {
|
|
182
244
|
return {
|
|
183
245
|
graphId,
|
|
@@ -233,11 +295,18 @@ function gateFulltextMethods(source, assert) {
|
|
|
233
295
|
return gated;
|
|
234
296
|
}
|
|
235
297
|
function gateFulltext(tx, assert) {
|
|
236
|
-
return
|
|
298
|
+
return chunkXBYVV3MP_cjs.createBackendOverlay(
|
|
237
299
|
tx,
|
|
238
300
|
gateFulltextMethods(tx, assert)
|
|
239
301
|
);
|
|
240
302
|
}
|
|
303
|
+
function contributionRebuildSupported(fulltextStrategy, fulltextTableName, transactional) {
|
|
304
|
+
return transactional && chunkRMQLSPA2_cjs.runtimeStrategyContributions(fulltextStrategy, fulltextTableName).every(
|
|
305
|
+
(contribution) => contribution.dropDdl !== void 0
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
var CONTRIBUTION_DDL_LOCK_KEY = "typegraph:contribution-ddl";
|
|
309
|
+
var FOREIGN_GRAPH_REPORT_LIMIT = 5;
|
|
241
310
|
var CONTRIBUTION_KEY_SEPARATOR = String.fromCodePoint(0);
|
|
242
311
|
function contributionKey(graphId, contribution) {
|
|
243
312
|
return [
|
|
@@ -281,7 +350,7 @@ function createContributionMaterializer(deps) {
|
|
|
281
350
|
}
|
|
282
351
|
}
|
|
283
352
|
function runtimeContributions() {
|
|
284
|
-
return
|
|
353
|
+
return chunkRMQLSPA2_cjs.runtimeStrategyContributions(fulltextStrategy, fulltextTableName);
|
|
285
354
|
}
|
|
286
355
|
function cacheInitializedSignature(key, signature) {
|
|
287
356
|
if (!uncacheableKeys.has(key)) {
|
|
@@ -307,14 +376,14 @@ function createContributionMaterializer(deps) {
|
|
|
307
376
|
);
|
|
308
377
|
await deps.recordMarker({
|
|
309
378
|
...identity,
|
|
310
|
-
signature,
|
|
311
|
-
attemptedAt:
|
|
379
|
+
signature: existing.signature,
|
|
380
|
+
attemptedAt: chunkYAAM3M2S_cjs.nowIso(),
|
|
312
381
|
materializedAt: void 0,
|
|
313
382
|
error: error.message
|
|
314
383
|
});
|
|
315
384
|
throw error;
|
|
316
385
|
}
|
|
317
|
-
const attemptedAt =
|
|
386
|
+
const attemptedAt = chunkYAAM3M2S_cjs.nowIso();
|
|
318
387
|
try {
|
|
319
388
|
for (const statement of contribution.createDdl) {
|
|
320
389
|
await deps.execDdl(statement);
|
|
@@ -350,12 +419,13 @@ function createContributionMaterializer(deps) {
|
|
|
350
419
|
rows: indexMarkerRows(graphId, await deps.getMarkers(graphId))
|
|
351
420
|
};
|
|
352
421
|
} catch (error) {
|
|
353
|
-
if (!
|
|
422
|
+
if (!chunkBSFJMMV3_cjs.isMissingTableError(error)) throw error;
|
|
354
423
|
return { kind: "missing-table", error };
|
|
355
424
|
}
|
|
356
425
|
}
|
|
357
426
|
async function ensureContributions(graphId, contributions, options) {
|
|
358
427
|
const force = options?.force === true;
|
|
428
|
+
const bypassCache = options?.bypassCache === true;
|
|
359
429
|
const entries = await Promise.all(
|
|
360
430
|
contributions.map(async (contribution) => {
|
|
361
431
|
const key = contributionKey(graphId, contribution);
|
|
@@ -366,7 +436,13 @@ function createContributionMaterializer(deps) {
|
|
|
366
436
|
};
|
|
367
437
|
})
|
|
368
438
|
);
|
|
369
|
-
|
|
439
|
+
if (bypassCache) {
|
|
440
|
+
for (const entry of entries) {
|
|
441
|
+
uncacheableKeys.add(entry.key);
|
|
442
|
+
initializedSignatures.delete(entry.key);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
const pending = force || bypassCache ? entries : entries.filter(
|
|
370
446
|
(entry) => uncacheableKeys.has(entry.key) || initializedSignatures.get(entry.key) !== entry.signature
|
|
371
447
|
);
|
|
372
448
|
if (pending.length === 0) return;
|
|
@@ -422,7 +498,7 @@ function createContributionMaterializer(deps) {
|
|
|
422
498
|
if (read.kind === "missing-table") {
|
|
423
499
|
const first = pending[0];
|
|
424
500
|
if (first === void 0) return;
|
|
425
|
-
throw new
|
|
501
|
+
throw new chunkNI72YOJB_cjs.StoreNotInitializedError(graphId, "missing", {
|
|
426
502
|
cause: read.error,
|
|
427
503
|
details: { logicalName: first.contribution.logicalName }
|
|
428
504
|
});
|
|
@@ -431,7 +507,7 @@ function createContributionMaterializer(deps) {
|
|
|
431
507
|
const { contribution, key, signature } = entry;
|
|
432
508
|
const state = evaluateContributionState(read.rows.get(key), signature);
|
|
433
509
|
if (state !== "initialized") {
|
|
434
|
-
throw new
|
|
510
|
+
throw new chunkNI72YOJB_cjs.StoreNotInitializedError(graphId, state, {
|
|
435
511
|
details: { logicalName: contribution.logicalName }
|
|
436
512
|
});
|
|
437
513
|
}
|
|
@@ -471,15 +547,15 @@ function createContributionMaterializer(deps) {
|
|
|
471
547
|
await assertContributions(graphId, contributions);
|
|
472
548
|
}
|
|
473
549
|
}
|
|
474
|
-
|
|
475
|
-
const
|
|
550
|
+
function verificationTargetsByGraph(graphId, vectorSlots) {
|
|
551
|
+
const targets = /* @__PURE__ */ new Map();
|
|
476
552
|
function addTarget(id, target) {
|
|
477
|
-
const existing =
|
|
478
|
-
if (existing === void 0)
|
|
553
|
+
const existing = targets.get(id);
|
|
554
|
+
if (existing === void 0) targets.set(id, [target]);
|
|
479
555
|
else existing.push(target);
|
|
480
556
|
}
|
|
481
557
|
for (const contribution of runtimeContributions()) {
|
|
482
|
-
addTarget(graphId, { contribution });
|
|
558
|
+
addTarget(graphId, { contribution, projection: "fulltext" });
|
|
483
559
|
}
|
|
484
560
|
const { vectorStrategy } = deps;
|
|
485
561
|
if (vectorStrategy !== void 0) {
|
|
@@ -487,12 +563,16 @@ function createContributionMaterializer(deps) {
|
|
|
487
563
|
for (const contribution of vectorStrategy.ownedTables(slot)) {
|
|
488
564
|
addTarget(slot.graphId, {
|
|
489
565
|
contribution,
|
|
566
|
+
projection: "vector",
|
|
490
567
|
kind: slot.nodeKind,
|
|
491
568
|
fieldPath: slot.fieldPath
|
|
492
569
|
});
|
|
493
570
|
}
|
|
494
571
|
}
|
|
495
572
|
}
|
|
573
|
+
return targets;
|
|
574
|
+
}
|
|
575
|
+
async function diagnoseTargets(targetsByGraph) {
|
|
496
576
|
const probes = /* @__PURE__ */ new Map();
|
|
497
577
|
function tableExists(tableName) {
|
|
498
578
|
const pending = probes.get(tableName);
|
|
@@ -501,11 +581,11 @@ function createContributionMaterializer(deps) {
|
|
|
501
581
|
probes.set(tableName, probe);
|
|
502
582
|
return probe;
|
|
503
583
|
}
|
|
504
|
-
const
|
|
584
|
+
const diagnosed = [];
|
|
505
585
|
for (const [id, targets] of targetsByGraph) {
|
|
506
586
|
const read = await readMarkerRows(id);
|
|
507
587
|
const rows = read.kind === "rows" ? read.rows : /* @__PURE__ */ new Map();
|
|
508
|
-
for (const { contribution, kind, fieldPath } of targets) {
|
|
588
|
+
for (const { contribution, projection, kind, fieldPath } of targets) {
|
|
509
589
|
const key = contributionKey(id, contribution);
|
|
510
590
|
const row = rows.get(key);
|
|
511
591
|
const state = diagnoseContribution(
|
|
@@ -514,22 +594,239 @@ function createContributionMaterializer(deps) {
|
|
|
514
594
|
await tableExists(contribution.tableName)
|
|
515
595
|
);
|
|
516
596
|
if (state === void 0) continue;
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
597
|
+
diagnosed.push({
|
|
598
|
+
graphId: id,
|
|
599
|
+
contribution,
|
|
600
|
+
projection,
|
|
601
|
+
diagnostic: {
|
|
602
|
+
owner: contribution.owner,
|
|
603
|
+
logicalName: contribution.logicalName,
|
|
604
|
+
physicalName: contribution.tableName,
|
|
605
|
+
...kind === void 0 ? {} : { kind },
|
|
606
|
+
...fieldPath === void 0 ? {} : { fieldPath },
|
|
607
|
+
state,
|
|
608
|
+
// The recorded reason, carried through verbatim. `state` folds
|
|
609
|
+
// several marker verdicts together because they share a repair;
|
|
610
|
+
// this is what keeps the fold from also discarding the one thing
|
|
611
|
+
// the catalog can never tell the operator.
|
|
612
|
+
...row?.lastError === void 0 ? {} : { lastError: row.lastError }
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
return diagnosed;
|
|
618
|
+
}
|
|
619
|
+
async function diagnoseContributions(graphId, vectorSlots) {
|
|
620
|
+
return diagnoseTargets(verificationTargetsByGraph(graphId, vectorSlots));
|
|
621
|
+
}
|
|
622
|
+
async function verifyContributions(graphId, vectorSlots) {
|
|
623
|
+
const diagnosed = await diagnoseContributions(graphId, vectorSlots);
|
|
624
|
+
return diagnosed.map((entry) => entry.diagnostic);
|
|
625
|
+
}
|
|
626
|
+
async function probeContributions(graphId, vectorSlots) {
|
|
627
|
+
const targetsByGraph = verificationTargetsByGraph(graphId, vectorSlots);
|
|
628
|
+
const declared = /* @__PURE__ */ new Set();
|
|
629
|
+
for (const targets of targetsByGraph.values()) {
|
|
630
|
+
for (const target of targets) declared.add(target.projection);
|
|
631
|
+
}
|
|
632
|
+
const diagnosed = await diagnoseTargets(targetsByGraph);
|
|
633
|
+
const entries = [];
|
|
634
|
+
for (const projection of PROBE_PROJECTION_ORDER) {
|
|
635
|
+
if (!declared.has(projection)) continue;
|
|
636
|
+
const problems = diagnosed.filter(
|
|
637
|
+
(entry) => entry.projection === projection
|
|
638
|
+
);
|
|
639
|
+
if (problems.length === 0) {
|
|
640
|
+
entries.push({ contribution: projection, state: "ready" });
|
|
641
|
+
continue;
|
|
642
|
+
}
|
|
643
|
+
entries.push({
|
|
644
|
+
contribution: projection,
|
|
645
|
+
state: "degraded",
|
|
646
|
+
detail: problems.map((entry) => describeProbeDiagnostic(entry.diagnostic)).join("; ")
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
return entries;
|
|
650
|
+
}
|
|
651
|
+
async function repairContributions(graphId, vectorSlots) {
|
|
652
|
+
const diagnosed = await diagnoseContributions(graphId, vectorSlots);
|
|
653
|
+
const results = [];
|
|
654
|
+
for (const {
|
|
655
|
+
graphId: targetGraphId,
|
|
656
|
+
contribution,
|
|
657
|
+
diagnostic
|
|
658
|
+
} of diagnosed) {
|
|
659
|
+
if (diagnostic.state === "stale" || diagnostic.state === "orphaned-marker") {
|
|
660
|
+
results.push({ diagnostic, status: "requires-rebuild" });
|
|
661
|
+
continue;
|
|
662
|
+
}
|
|
663
|
+
try {
|
|
664
|
+
await ensureContributions(targetGraphId, [contribution], {
|
|
665
|
+
bypassCache: true
|
|
666
|
+
});
|
|
667
|
+
results.push({ diagnostic, status: "repaired" });
|
|
668
|
+
} catch (error) {
|
|
669
|
+
results.push({
|
|
670
|
+
diagnostic,
|
|
671
|
+
status: "failed",
|
|
672
|
+
error: error instanceof Error ? error.message : String(error)
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
return {
|
|
677
|
+
results,
|
|
678
|
+
remaining: await verifyContributions(graphId, vectorSlots)
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
async function lockContributionDdl(tx) {
|
|
682
|
+
if (dialect !== "postgres") return;
|
|
683
|
+
await tx.execute(
|
|
684
|
+
chunkVCRRKBLN_cjs.asCompiledRowsSql(
|
|
685
|
+
chunkVCRRKBLN_cjs.sql`SELECT pg_advisory_xact_lock(hashtext(${CONTRIBUTION_DDL_LOCK_KEY}), 0)`
|
|
686
|
+
)
|
|
687
|
+
);
|
|
688
|
+
}
|
|
689
|
+
async function lockSharedFulltextTable(tx, tableName) {
|
|
690
|
+
if (dialect !== "postgres") return;
|
|
691
|
+
await tx.executeStatement(
|
|
692
|
+
chunkVCRRKBLN_cjs.asCompiledStatementSql(
|
|
693
|
+
chunkVCRRKBLN_cjs.sql`LOCK TABLE ${chunkVCRRKBLN_cjs.sql.identifier(tableName)} IN ACCESS EXCLUSIVE MODE`
|
|
694
|
+
)
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
async function readForeignGraphIds(tx, tableName, graphId) {
|
|
698
|
+
const rows = await tx.execute(
|
|
699
|
+
chunkVCRRKBLN_cjs.asCompiledRowsSql(
|
|
700
|
+
chunk4UGOKMI5_cjs.buildForeignFulltextGraphProbe(
|
|
701
|
+
tableName,
|
|
702
|
+
graphId,
|
|
703
|
+
FOREIGN_GRAPH_REPORT_LIMIT
|
|
704
|
+
)
|
|
705
|
+
)
|
|
706
|
+
);
|
|
707
|
+
return rows.map((row) => String(row.graph_id));
|
|
708
|
+
}
|
|
709
|
+
async function rebuildContribution(graphId, scope, repopulate) {
|
|
710
|
+
if (scope === "vector") {
|
|
711
|
+
throw new chunkNI72YOJB_cjs.ContributionRebuildUnsupportedError(
|
|
712
|
+
"vector-source-unavailable",
|
|
713
|
+
{ graphId, contribution: scope }
|
|
714
|
+
);
|
|
715
|
+
}
|
|
716
|
+
const contributions = runtimeContributions();
|
|
717
|
+
const withoutTeardown = contributions.find(
|
|
718
|
+
(contribution) => contribution.dropDdl === void 0
|
|
719
|
+
);
|
|
720
|
+
if (withoutTeardown !== void 0) {
|
|
721
|
+
throw new chunkNI72YOJB_cjs.ContributionRebuildUnsupportedError("no-drop-ddl", {
|
|
722
|
+
graphId,
|
|
723
|
+
contribution: scope,
|
|
724
|
+
owner: withoutTeardown.owner,
|
|
725
|
+
logicalName: withoutTeardown.logicalName,
|
|
726
|
+
physicalName: withoutTeardown.tableName
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
const fence = deps.schemaWriteTransaction;
|
|
730
|
+
if (fence === void 0) {
|
|
731
|
+
throw new chunkNI72YOJB_cjs.ContributionRebuildUnsupportedError("no-schema-fence", {
|
|
732
|
+
graphId,
|
|
733
|
+
contribution: scope,
|
|
734
|
+
backend: dialect
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
const stamps = await Promise.all(
|
|
738
|
+
contributions.map(async (contribution) => {
|
|
739
|
+
const key = contributionKey(graphId, contribution);
|
|
740
|
+
return {
|
|
741
|
+
contribution,
|
|
742
|
+
key,
|
|
743
|
+
signature: await resolveContributionSignature(key, contribution)
|
|
744
|
+
};
|
|
745
|
+
})
|
|
746
|
+
);
|
|
747
|
+
await deps.ensureMarkerTable();
|
|
748
|
+
const markers = indexMarkerRows(graphId, await deps.getMarkers(graphId));
|
|
749
|
+
const sharedTable = deps.fulltextTableName;
|
|
750
|
+
const sharedTableExisted = await deps.tableExists(sharedTable);
|
|
751
|
+
const rebuilt = await fence(graphId, async (tx) => {
|
|
752
|
+
const record = tx.recordContributionMaterialization;
|
|
753
|
+
if (record === void 0) {
|
|
754
|
+
throw new chunkNI72YOJB_cjs.ConfigurationError(
|
|
755
|
+
"rebuildContribution requires a transaction-scoped backend that can write contribution markers; without it the drop, recreate, and stamp could not commit together.",
|
|
756
|
+
{
|
|
757
|
+
backend: dialect,
|
|
758
|
+
capability: "contributions",
|
|
759
|
+
operation: "rebuild"
|
|
760
|
+
}
|
|
761
|
+
);
|
|
762
|
+
}
|
|
763
|
+
await lockContributionDdl(tx);
|
|
764
|
+
const unlockedForeignGraphIds = sharedTableExisted ? await readForeignGraphIds(tx, sharedTable, graphId) : [];
|
|
765
|
+
const mayRecreate = sharedTableExisted && unlockedForeignGraphIds.length === 0;
|
|
766
|
+
if (mayRecreate) await lockSharedFulltextTable(tx, sharedTable);
|
|
767
|
+
const foreignGraphIds = mayRecreate ? await readForeignGraphIds(tx, sharedTable, graphId) : unlockedForeignGraphIds;
|
|
768
|
+
const recreateStorage = mayRecreate && foreignGraphIds.length === 0;
|
|
769
|
+
if (!recreateStorage) {
|
|
770
|
+
const staleStamp = stamps.find(
|
|
771
|
+
({ key, signature }) => diagnoseContribution(
|
|
772
|
+
markers.get(key),
|
|
773
|
+
signature,
|
|
774
|
+
sharedTableExisted
|
|
775
|
+
) === "stale"
|
|
776
|
+
);
|
|
777
|
+
if (staleStamp !== void 0) {
|
|
778
|
+
throw new chunkNI72YOJB_cjs.ContributionRebuildUnsupportedError(
|
|
779
|
+
"shared-storage-in-use",
|
|
780
|
+
{
|
|
781
|
+
graphId,
|
|
782
|
+
contribution: scope,
|
|
783
|
+
owner: staleStamp.contribution.owner,
|
|
784
|
+
logicalName: staleStamp.contribution.logicalName,
|
|
785
|
+
physicalName: staleStamp.contribution.tableName,
|
|
786
|
+
otherGraphIds: foreignGraphIds
|
|
787
|
+
}
|
|
788
|
+
);
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
for (const { contribution } of stamps) {
|
|
792
|
+
if (recreateStorage) {
|
|
793
|
+
for (const statement of contribution.dropDdl ?? []) {
|
|
794
|
+
await tx.executeSchemaDdl(statement);
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
for (const statement of contribution.createDdl) {
|
|
798
|
+
await tx.executeSchemaDdl(statement);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
if (!recreateStorage) {
|
|
802
|
+
await tx.executeStatement(
|
|
803
|
+
chunkVCRRKBLN_cjs.asCompiledStatementSql(
|
|
804
|
+
chunk4UGOKMI5_cjs.buildFulltextGraphDelete(sharedTable, graphId)
|
|
805
|
+
)
|
|
806
|
+
);
|
|
807
|
+
}
|
|
808
|
+
const stats = await repopulate(tx);
|
|
809
|
+
const now = chunkYAAM3M2S_cjs.nowIso();
|
|
810
|
+
for (const { contribution, signature } of stamps) {
|
|
811
|
+
await record({
|
|
812
|
+
...identityOf(graphId, contribution),
|
|
813
|
+
signature,
|
|
814
|
+
attemptedAt: now,
|
|
815
|
+
materializedAt: now,
|
|
816
|
+
error: void 0
|
|
529
817
|
});
|
|
530
818
|
}
|
|
819
|
+
return {
|
|
820
|
+
rebuilt: stamps.map(({ contribution }) => contribution.tableName),
|
|
821
|
+
processed: stats.processed,
|
|
822
|
+
repopulated: stats.repopulated,
|
|
823
|
+
skipped: stats.skipped
|
|
824
|
+
};
|
|
825
|
+
});
|
|
826
|
+
for (const { key, signature } of stamps) {
|
|
827
|
+
cacheInitializedSignature(key, signature);
|
|
531
828
|
}
|
|
532
|
-
return
|
|
829
|
+
return rebuilt;
|
|
533
830
|
}
|
|
534
831
|
function evictVectorSlot(slot) {
|
|
535
832
|
if (deps.vectorStrategy === void 0) return;
|
|
@@ -559,7 +856,10 @@ function createContributionMaterializer(deps) {
|
|
|
559
856
|
assertVectorSlots,
|
|
560
857
|
dropVectorSlot,
|
|
561
858
|
evictVectorSlot,
|
|
562
|
-
verifyContributions
|
|
859
|
+
verifyContributions,
|
|
860
|
+
repairContributions,
|
|
861
|
+
probeContributions,
|
|
862
|
+
rebuildContribution
|
|
563
863
|
};
|
|
564
864
|
}
|
|
565
865
|
var SQLITE_INDEX_MAT_TIMESTAMPS = {
|
|
@@ -567,7 +867,7 @@ var SQLITE_INDEX_MAT_TIMESTAMPS = {
|
|
|
567
867
|
encode: (value) => value
|
|
568
868
|
};
|
|
569
869
|
var POSTGRES_INDEX_MAT_TIMESTAMPS = {
|
|
570
|
-
decode:
|
|
870
|
+
decode: chunkYAAM3M2S_cjs.formatPostgresTimestamp,
|
|
571
871
|
encode: (value) => new Date(value)
|
|
572
872
|
};
|
|
573
873
|
function mapMaterializationRow(row, decode) {
|
|
@@ -625,7 +925,7 @@ var SQLITE_KIND_REMOVAL_TIMESTAMPS = {
|
|
|
625
925
|
encode: (value) => value
|
|
626
926
|
};
|
|
627
927
|
var POSTGRES_KIND_REMOVAL_TIMESTAMPS = {
|
|
628
|
-
decode:
|
|
928
|
+
decode: chunkYAAM3M2S_cjs.formatPostgresTimestamp,
|
|
629
929
|
encode: (value) => new Date(value)
|
|
630
930
|
};
|
|
631
931
|
function mapKindRemovalRow(row, decode) {
|
|
@@ -666,6 +966,30 @@ function buildKindRemovalOnConflictSet(removedAtColumn, paramsRemovedAt) {
|
|
|
666
966
|
lastError: drizzleOrm.sql`excluded.${drizzleOrm.sql.identifier("last_error")}`
|
|
667
967
|
};
|
|
668
968
|
}
|
|
969
|
+
function primaryKeyConstraintNames(relation, keyColumns) {
|
|
970
|
+
return [`${relation}_pkey`, `${relation}_${keyColumns.join("_")}_pk`];
|
|
971
|
+
}
|
|
972
|
+
function nodePrimaryKeyConstraint(nodes) {
|
|
973
|
+
const relation = drizzleOrm.getTableName(nodes);
|
|
974
|
+
return {
|
|
975
|
+
table: relation,
|
|
976
|
+
constraintNames: primaryKeyConstraintNames(relation, [
|
|
977
|
+
nodes.graphId.name,
|
|
978
|
+
nodes.kind.name,
|
|
979
|
+
nodes.id.name
|
|
980
|
+
])
|
|
981
|
+
};
|
|
982
|
+
}
|
|
983
|
+
function edgePrimaryKeyConstraint(edges) {
|
|
984
|
+
const relation = drizzleOrm.getTableName(edges);
|
|
985
|
+
return {
|
|
986
|
+
table: relation,
|
|
987
|
+
constraintNames: primaryKeyConstraintNames(relation, [
|
|
988
|
+
edges.graphId.name,
|
|
989
|
+
edges.id.name
|
|
990
|
+
])
|
|
991
|
+
};
|
|
992
|
+
}
|
|
669
993
|
function sqlNull(value) {
|
|
670
994
|
return value ?? drizzleOrm.sql.raw("NULL");
|
|
671
995
|
}
|
|
@@ -673,6 +997,11 @@ function resolveValidFrom(validFrom, timestamp) {
|
|
|
673
997
|
if (validFrom === null) return void 0;
|
|
674
998
|
return validFrom ?? timestamp;
|
|
675
999
|
}
|
|
1000
|
+
function expectedValidFromPredicate(column, expected) {
|
|
1001
|
+
if (expected === void 0) return drizzleOrm.sql.empty();
|
|
1002
|
+
if (expected === null) return drizzleOrm.sql` AND ${column} IS NULL`;
|
|
1003
|
+
return drizzleOrm.sql` AND ${column} = ${expected}`;
|
|
1004
|
+
}
|
|
676
1005
|
function quotedColumn(column) {
|
|
677
1006
|
return drizzleOrm.sql.raw(`"${column.name.replaceAll('"', '""')}"`);
|
|
678
1007
|
}
|
|
@@ -792,12 +1121,12 @@ function present(value) {
|
|
|
792
1121
|
function mapHybridSearchRow(row, toNodeRow) {
|
|
793
1122
|
return {
|
|
794
1123
|
node: toNodeRow(row),
|
|
795
|
-
fusedScore:
|
|
1124
|
+
fusedScore: chunkYAAM3M2S_cjs.coerceNumericScore(row["fused_score"]),
|
|
796
1125
|
...present(row["vector_rank"]) ? { vectorRank: Number(row["vector_rank"]) } : {},
|
|
797
|
-
...present(row["vector_score"]) ? { vectorScore:
|
|
1126
|
+
...present(row["vector_score"]) ? { vectorScore: chunkYAAM3M2S_cjs.coerceNumericScore(row["vector_score"]) } : {},
|
|
798
1127
|
...present(row["fulltext_rank"]) ? { fulltextRank: Number(row["fulltext_rank"]) } : {},
|
|
799
1128
|
...present(row["fulltext_score"]) ? {
|
|
800
|
-
fulltextScore:
|
|
1129
|
+
fulltextScore: chunkYAAM3M2S_cjs.coerceNumericScore(
|
|
801
1130
|
row["fulltext_score"]
|
|
802
1131
|
)
|
|
803
1132
|
} : {},
|
|
@@ -805,9 +1134,16 @@ function mapHybridSearchRow(row, toNodeRow) {
|
|
|
805
1134
|
};
|
|
806
1135
|
}
|
|
807
1136
|
function buildClearGraph(tables, graphId) {
|
|
808
|
-
const fulltext = quotedTableName(tables.fulltextTableName);
|
|
809
1137
|
return [
|
|
810
|
-
|
|
1138
|
+
// The fulltext table is shared by every graph in the database, so its
|
|
1139
|
+
// graph-scoped delete is owned by one builder the destructive
|
|
1140
|
+
// contribution rebuild calls too — see `buildFulltextGraphDelete`.
|
|
1141
|
+
{ query: chunk4UGOKMI5_cjs.buildFulltextGraphDelete(tables.fulltextTableName, graphId) },
|
|
1142
|
+
{
|
|
1143
|
+
query: drizzleOrm.sql`DELETE FROM ${tables.recordedIdentityAssertions} WHERE ${tables.recordedIdentityAssertions.graphId} = ${graphId}`,
|
|
1144
|
+
ignoreMissingTable: true,
|
|
1145
|
+
requiredTableName: drizzleOrm.getTableName(tables.recordedIdentityAssertions)
|
|
1146
|
+
},
|
|
811
1147
|
{
|
|
812
1148
|
query: drizzleOrm.sql`DELETE FROM ${tables.recordedEdges} WHERE ${tables.recordedEdges.graphId} = ${graphId}`,
|
|
813
1149
|
ignoreMissingTable: true,
|
|
@@ -823,6 +1159,21 @@ function buildClearGraph(tables, graphId) {
|
|
|
823
1159
|
ignoreMissingTable: true,
|
|
824
1160
|
requiredTableName: drizzleOrm.getTableName(tables.recordedClock)
|
|
825
1161
|
},
|
|
1162
|
+
{
|
|
1163
|
+
query: drizzleOrm.sql`DELETE FROM ${tables.identitySeparation} WHERE ${tables.identitySeparation.graphId} = ${graphId}`,
|
|
1164
|
+
ignoreMissingTable: true,
|
|
1165
|
+
requiredTableName: drizzleOrm.getTableName(tables.identitySeparation)
|
|
1166
|
+
},
|
|
1167
|
+
{
|
|
1168
|
+
query: drizzleOrm.sql`DELETE FROM ${tables.identityClosure} WHERE ${tables.identityClosure.graphId} = ${graphId}`,
|
|
1169
|
+
ignoreMissingTable: true,
|
|
1170
|
+
requiredTableName: drizzleOrm.getTableName(tables.identityClosure)
|
|
1171
|
+
},
|
|
1172
|
+
{
|
|
1173
|
+
query: drizzleOrm.sql`DELETE FROM ${tables.identityAssertions} WHERE ${tables.identityAssertions.graphId} = ${graphId}`,
|
|
1174
|
+
ignoreMissingTable: true,
|
|
1175
|
+
requiredTableName: drizzleOrm.getTableName(tables.identityAssertions)
|
|
1176
|
+
},
|
|
826
1177
|
{
|
|
827
1178
|
query: drizzleOrm.sql`DELETE FROM ${tables.uniques} WHERE ${tables.uniques.graphId} = ${graphId}`
|
|
828
1179
|
},
|
|
@@ -1009,6 +1360,58 @@ function buildFindEdgesByEndpointSet(tables, params, endpointIds) {
|
|
|
1009
1360
|
ORDER BY ${derivedOrderByClause}
|
|
1010
1361
|
`;
|
|
1011
1362
|
}
|
|
1363
|
+
function buildFindEdgesByHeterogeneousEndpointSet(tables, params, endpoints, edgeKinds) {
|
|
1364
|
+
const { edges } = tables;
|
|
1365
|
+
const fromSide = params.side === "from";
|
|
1366
|
+
const kindColumn = fromSide ? edges.fromKind : edges.toKind;
|
|
1367
|
+
const idColumn = fromSide ? edges.fromId : edges.toId;
|
|
1368
|
+
const requestedKind = drizzleOrm.sql.raw(`requested_endpoints."endpoint_kind"`);
|
|
1369
|
+
const requestedId = drizzleOrm.sql.raw(`requested_endpoints."endpoint_id"`);
|
|
1370
|
+
const requestedRows = drizzleOrm.sql.join(
|
|
1371
|
+
endpoints.map((endpoint) => drizzleOrm.sql`(${endpoint.kind}, ${endpoint.id})`),
|
|
1372
|
+
drizzleOrm.sql`, `
|
|
1373
|
+
);
|
|
1374
|
+
const whereClause = drizzleOrm.sql.join(
|
|
1375
|
+
[
|
|
1376
|
+
drizzleOrm.sql`${edges.graphId} = ${params.graphId}`,
|
|
1377
|
+
buildIdSetCondition(edges.kind, edgeKinds),
|
|
1378
|
+
...buildTemporalConditions(edges, params)
|
|
1379
|
+
],
|
|
1380
|
+
drizzleOrm.sql` AND `
|
|
1381
|
+
);
|
|
1382
|
+
const joinClause = drizzleOrm.sql`
|
|
1383
|
+
FROM ${edges}
|
|
1384
|
+
INNER JOIN requested_endpoints
|
|
1385
|
+
ON ${kindColumn} = ${requestedKind}
|
|
1386
|
+
AND ${idColumn} = ${requestedId}
|
|
1387
|
+
WHERE ${whereClause}
|
|
1388
|
+
`;
|
|
1389
|
+
const { qualified: orderByClause, bare: derivedOrderByClause } = buildEdgeOrdering(tables, void 0);
|
|
1390
|
+
if (params.limitPerEndpoint === void 0) {
|
|
1391
|
+
return drizzleOrm.sql`
|
|
1392
|
+
WITH requested_endpoints(endpoint_kind, endpoint_id) AS (
|
|
1393
|
+
VALUES ${requestedRows}
|
|
1394
|
+
)
|
|
1395
|
+
SELECT ${edges}.*
|
|
1396
|
+
${joinClause}
|
|
1397
|
+
ORDER BY ${orderByClause}
|
|
1398
|
+
`;
|
|
1399
|
+
}
|
|
1400
|
+
const ranked = drizzleOrm.sql`
|
|
1401
|
+
SELECT ${edges}.*, ROW_NUMBER() OVER (
|
|
1402
|
+
PARTITION BY ${kindColumn}, ${idColumn} ORDER BY ${orderByClause}
|
|
1403
|
+
) AS endpoint_rank
|
|
1404
|
+
${joinClause}
|
|
1405
|
+
`;
|
|
1406
|
+
return drizzleOrm.sql`
|
|
1407
|
+
WITH requested_endpoints(endpoint_kind, endpoint_id) AS (
|
|
1408
|
+
VALUES ${requestedRows}
|
|
1409
|
+
)
|
|
1410
|
+
SELECT * FROM (${ranked}) AS ranked_edges
|
|
1411
|
+
WHERE endpoint_rank <= ${params.limitPerEndpoint}
|
|
1412
|
+
ORDER BY ${derivedOrderByClause}
|
|
1413
|
+
`;
|
|
1414
|
+
}
|
|
1012
1415
|
function buildCountEdgesByKind(tables, params) {
|
|
1013
1416
|
const { edges } = tables;
|
|
1014
1417
|
const conditions = [
|
|
@@ -1107,6 +1510,17 @@ function buildGetEdges(tables, graphId, ids) {
|
|
|
1107
1510
|
)})
|
|
1108
1511
|
`;
|
|
1109
1512
|
}
|
|
1513
|
+
function expectedIdentityPredicate(tables, expected) {
|
|
1514
|
+
const { edges } = tables;
|
|
1515
|
+
const parts = [
|
|
1516
|
+
expected.kind === void 0 ? void 0 : drizzleOrm.sql` AND ${edges.kind} = ${expected.kind}`,
|
|
1517
|
+
expected.fromKind === void 0 ? void 0 : drizzleOrm.sql` AND ${edges.fromKind} = ${expected.fromKind}`,
|
|
1518
|
+
expected.fromId === void 0 ? void 0 : drizzleOrm.sql` AND ${edges.fromId} = ${expected.fromId}`,
|
|
1519
|
+
expected.toKind === void 0 ? void 0 : drizzleOrm.sql` AND ${edges.toKind} = ${expected.toKind}`,
|
|
1520
|
+
expected.toId === void 0 ? void 0 : drizzleOrm.sql` AND ${edges.toId} = ${expected.toId}`
|
|
1521
|
+
].filter((part) => part !== void 0);
|
|
1522
|
+
return parts.length === 0 ? drizzleOrm.sql.empty() : drizzleOrm.sql.join(parts, drizzleOrm.sql``);
|
|
1523
|
+
}
|
|
1110
1524
|
function buildUpdateEdge(tables, params, timestamp) {
|
|
1111
1525
|
const { edges } = tables;
|
|
1112
1526
|
const propsJson = JSON.stringify(params.props);
|
|
@@ -1114,19 +1528,29 @@ function buildUpdateEdge(tables, params, timestamp) {
|
|
|
1114
1528
|
drizzleOrm.sql`${quotedColumn(edges.props)} = ${propsJson}`,
|
|
1115
1529
|
drizzleOrm.sql`${quotedColumn(edges.updatedAt)} = ${timestamp}`
|
|
1116
1530
|
];
|
|
1117
|
-
if (params.
|
|
1531
|
+
if (params.clearDeleted && params.validFrom !== void 0) {
|
|
1532
|
+
setParts.push(
|
|
1533
|
+
drizzleOrm.sql`${quotedColumn(edges.validFrom)} = ${sqlNull(resolveValidFrom(params.validFrom, timestamp))}`,
|
|
1534
|
+
drizzleOrm.sql`${quotedColumn(edges.validTo)} = ${sqlNull(params.validTo)}`
|
|
1535
|
+
);
|
|
1536
|
+
} else if (params.validTo !== void 0) {
|
|
1118
1537
|
setParts.push(drizzleOrm.sql`${quotedColumn(edges.validTo)} = ${params.validTo}`);
|
|
1119
1538
|
}
|
|
1120
1539
|
if (params.clearDeleted) {
|
|
1121
1540
|
setParts.push(drizzleOrm.sql`${quotedColumn(edges.deletedAt)} = NULL`);
|
|
1122
1541
|
}
|
|
1123
1542
|
const setClause = drizzleOrm.sql.join(setParts, drizzleOrm.sql`, `);
|
|
1543
|
+
const expectedIdentity = expectedIdentityPredicate(tables, params);
|
|
1544
|
+
const expectedValidFrom = expectedValidFromPredicate(
|
|
1545
|
+
edges.validFrom,
|
|
1546
|
+
params.expectedValidFrom
|
|
1547
|
+
);
|
|
1124
1548
|
if (params.clearDeleted) {
|
|
1125
1549
|
return drizzleOrm.sql`
|
|
1126
1550
|
UPDATE ${edges}
|
|
1127
1551
|
SET ${setClause}
|
|
1128
1552
|
WHERE ${edges.graphId} = ${params.graphId}
|
|
1129
|
-
AND ${edges.id} = ${params.id}
|
|
1553
|
+
AND ${edges.id} = ${params.id}${expectedIdentity}${expectedValidFrom}
|
|
1130
1554
|
RETURNING *
|
|
1131
1555
|
`;
|
|
1132
1556
|
}
|
|
@@ -1134,7 +1558,7 @@ function buildUpdateEdge(tables, params, timestamp) {
|
|
|
1134
1558
|
UPDATE ${edges}
|
|
1135
1559
|
SET ${setClause}
|
|
1136
1560
|
WHERE ${edges.graphId} = ${params.graphId}
|
|
1137
|
-
AND ${edges.id} = ${params.id}
|
|
1561
|
+
AND ${edges.id} = ${params.id}${expectedIdentity}${expectedValidFrom}
|
|
1138
1562
|
AND ${edges.deletedAt} IS NULL
|
|
1139
1563
|
RETURNING *
|
|
1140
1564
|
`;
|
|
@@ -1145,7 +1569,7 @@ function buildDeleteEdge(tables, params, timestamp) {
|
|
|
1145
1569
|
UPDATE ${edges}
|
|
1146
1570
|
SET ${quotedColumn(edges.deletedAt)} = ${timestamp}
|
|
1147
1571
|
WHERE ${edges.graphId} = ${params.graphId}
|
|
1148
|
-
AND ${edges.id} = ${params.id}
|
|
1572
|
+
AND ${edges.id} = ${params.id}${expectedIdentityPredicate(tables, params.kind === void 0 ? {} : { kind: params.kind })}
|
|
1149
1573
|
AND ${edges.deletedAt} IS NULL
|
|
1150
1574
|
`;
|
|
1151
1575
|
}
|
|
@@ -1178,7 +1602,7 @@ function buildHardDeleteEdge(tables, params) {
|
|
|
1178
1602
|
return drizzleOrm.sql`
|
|
1179
1603
|
DELETE FROM ${edges}
|
|
1180
1604
|
WHERE ${edges.graphId} = ${params.graphId}
|
|
1181
|
-
AND ${edges.id} = ${params.id}
|
|
1605
|
+
AND ${edges.id} = ${params.id}${expectedIdentityPredicate(tables, params.kind === void 0 ? {} : { kind: params.kind })}
|
|
1182
1606
|
`;
|
|
1183
1607
|
}
|
|
1184
1608
|
function buildHardDeleteEdgesByNode(tables, graphId, nodeKind, nodeId) {
|
|
@@ -1255,11 +1679,11 @@ function buildFulltextSearch(tableName, params, strategy, dialect, candidates) {
|
|
|
1255
1679
|
assertValidSearchParams(params);
|
|
1256
1680
|
const mode = resolveMode(params.mode);
|
|
1257
1681
|
const table = quotedTableName(tableName);
|
|
1258
|
-
const matchCondition =
|
|
1682
|
+
const matchCondition = chunkU5SON7R2_cjs.toDrizzleSql(
|
|
1259
1683
|
strategy.matchCondition(tableName, params.query, mode, params.language),
|
|
1260
1684
|
dialect
|
|
1261
1685
|
);
|
|
1262
|
-
const rankExpression =
|
|
1686
|
+
const rankExpression = chunkU5SON7R2_cjs.toDrizzleSql(
|
|
1263
1687
|
strategy.rankExpression(tableName, params.query, mode, params.language),
|
|
1264
1688
|
dialect
|
|
1265
1689
|
);
|
|
@@ -1272,10 +1696,10 @@ function buildFulltextSearch(tableName, params, strategy, dialect, candidates) {
|
|
|
1272
1696
|
conditions.push(drizzleOrm.sql`${rankExpression} >= ${params.minScore}`);
|
|
1273
1697
|
}
|
|
1274
1698
|
if (candidates !== void 0) {
|
|
1275
|
-
const candidateSql =
|
|
1699
|
+
const candidateSql = chunkVCRRKBLN_cjs.isSqlFragment(candidates) ? chunkU5SON7R2_cjs.toDrizzleSql(candidates, dialect) : candidates;
|
|
1276
1700
|
conditions.push(drizzleOrm.sql`"node_id" IN (${candidateSql})`);
|
|
1277
1701
|
}
|
|
1278
|
-
const snippetExpr = params.includeSnippets === true && strategy.supportsSnippets ?
|
|
1702
|
+
const snippetExpr = params.includeSnippets === true && strategy.supportsSnippets ? chunkU5SON7R2_cjs.toDrizzleSql(
|
|
1279
1703
|
strategy.snippetExpression(
|
|
1280
1704
|
tableName,
|
|
1281
1705
|
params.query,
|
|
@@ -1391,20 +1815,30 @@ function buildUpdateNode(tables, params, timestamp) {
|
|
|
1391
1815
|
drizzleOrm.sql`${quotedColumn(nodes.version)} = ${quotedColumn(nodes.version)} + 1`
|
|
1392
1816
|
);
|
|
1393
1817
|
}
|
|
1394
|
-
if (params.
|
|
1818
|
+
if (params.clearDeleted) {
|
|
1819
|
+
setParts.push(
|
|
1820
|
+
drizzleOrm.sql`${quotedColumn(nodes.validFrom)} = ${sqlNull(resolveValidFrom(params.validFrom, timestamp))}`,
|
|
1821
|
+
drizzleOrm.sql`${quotedColumn(nodes.validTo)} = ${sqlNull(params.validTo)}`
|
|
1822
|
+
);
|
|
1823
|
+
} else if (params.validTo !== void 0) {
|
|
1395
1824
|
setParts.push(drizzleOrm.sql`${quotedColumn(nodes.validTo)} = ${params.validTo}`);
|
|
1396
1825
|
}
|
|
1397
1826
|
if (params.clearDeleted) {
|
|
1398
1827
|
setParts.push(drizzleOrm.sql`${quotedColumn(nodes.deletedAt)} = NULL`);
|
|
1399
1828
|
}
|
|
1400
1829
|
const setClause = drizzleOrm.sql.join(setParts, drizzleOrm.sql`, `);
|
|
1830
|
+
const expectedValidFrom = expectedValidFromPredicate(
|
|
1831
|
+
nodes.validFrom,
|
|
1832
|
+
params.expectedValidFrom
|
|
1833
|
+
);
|
|
1401
1834
|
if (params.clearDeleted) {
|
|
1402
1835
|
return drizzleOrm.sql`
|
|
1403
1836
|
UPDATE ${nodes}
|
|
1404
1837
|
SET ${setClause}
|
|
1405
1838
|
WHERE ${nodes.graphId} = ${params.graphId}
|
|
1406
1839
|
AND ${nodes.kind} = ${params.kind}
|
|
1407
|
-
AND ${nodes.id} = ${params.id}
|
|
1840
|
+
AND ${nodes.id} = ${params.id}${expectedValidFrom}
|
|
1841
|
+
AND ${nodes.deletedAt} IS NOT NULL
|
|
1408
1842
|
RETURNING *
|
|
1409
1843
|
`;
|
|
1410
1844
|
}
|
|
@@ -1413,8 +1847,39 @@ function buildUpdateNode(tables, params, timestamp) {
|
|
|
1413
1847
|
SET ${setClause}
|
|
1414
1848
|
WHERE ${nodes.graphId} = ${params.graphId}
|
|
1415
1849
|
AND ${nodes.kind} = ${params.kind}
|
|
1416
|
-
AND ${nodes.id} = ${params.id}
|
|
1850
|
+
AND ${nodes.id} = ${params.id}${expectedValidFrom}
|
|
1851
|
+
AND ${nodes.deletedAt} IS NULL
|
|
1852
|
+
RETURNING *
|
|
1853
|
+
`;
|
|
1854
|
+
}
|
|
1855
|
+
function buildUpdateNodeSet(tables, dialect, params, timestamp) {
|
|
1856
|
+
const { nodes } = tables;
|
|
1857
|
+
const adapter = chunk4UGOKMI5_cjs.getDialect(dialect);
|
|
1858
|
+
const patchedProps = chunkU5SON7R2_cjs.toDrizzleSql(
|
|
1859
|
+
adapter.jsonSetProperties(
|
|
1860
|
+
chunkVCRRKBLN_cjs.sql.identifier(nodes.props.name),
|
|
1861
|
+
params.patch,
|
|
1862
|
+
params.unsetProperties ?? []
|
|
1863
|
+
),
|
|
1864
|
+
dialect
|
|
1865
|
+
);
|
|
1866
|
+
const candidateIds = chunkU5SON7R2_cjs.toDrizzleSql(params.candidateIds, dialect);
|
|
1867
|
+
const candidateIdColumn = chunkU5SON7R2_cjs.toDrizzleSql(
|
|
1868
|
+
chunkVCRRKBLN_cjs.sql.identifier(params.candidateIdColumn),
|
|
1869
|
+
dialect
|
|
1870
|
+
);
|
|
1871
|
+
return drizzleOrm.sql`
|
|
1872
|
+
UPDATE ${nodes}
|
|
1873
|
+
SET ${quotedColumn(nodes.props)} = ${patchedProps},
|
|
1874
|
+
${quotedColumn(nodes.updatedAt)} = ${timestamp},
|
|
1875
|
+
${quotedColumn(nodes.version)} = ${quotedColumn(nodes.version)} + 1
|
|
1876
|
+
WHERE ${nodes.graphId} = ${params.graphId}
|
|
1877
|
+
AND ${nodes.kind} = ${params.kind}
|
|
1417
1878
|
AND ${nodes.deletedAt} IS NULL
|
|
1879
|
+
AND ${nodes.id} IN (
|
|
1880
|
+
SELECT ${candidateIdColumn}
|
|
1881
|
+
FROM (${candidateIds}) AS tg_set_candidates
|
|
1882
|
+
)
|
|
1418
1883
|
RETURNING *
|
|
1419
1884
|
`;
|
|
1420
1885
|
}
|
|
@@ -1653,12 +2118,23 @@ function buildDeleteUnique(tables, params, timestamp) {
|
|
|
1653
2118
|
AND ${uniques.deletedAt} IS NULL
|
|
1654
2119
|
`;
|
|
1655
2120
|
}
|
|
1656
|
-
function buildHardDeleteUniquesByNode(tables, graphId, nodeId) {
|
|
2121
|
+
function buildHardDeleteUniquesByNode(tables, graphId, concreteKind, nodeId) {
|
|
2122
|
+
return buildHardDeleteUniquesByNodeIds(tables, {
|
|
2123
|
+
graphId,
|
|
2124
|
+
concreteKind,
|
|
2125
|
+
nodeIds: [nodeId]
|
|
2126
|
+
});
|
|
2127
|
+
}
|
|
2128
|
+
function buildHardDeleteUniquesByNodeIds(tables, params) {
|
|
1657
2129
|
const { uniques } = tables;
|
|
1658
2130
|
return drizzleOrm.sql`
|
|
1659
2131
|
DELETE FROM ${uniques}
|
|
1660
|
-
WHERE ${uniques.graphId} = ${graphId}
|
|
1661
|
-
AND ${uniques.
|
|
2132
|
+
WHERE ${uniques.graphId} = ${params.graphId}
|
|
2133
|
+
AND ${uniques.concreteKind} = ${params.concreteKind}
|
|
2134
|
+
AND ${uniques.nodeId} IN (${drizzleOrm.sql.join(
|
|
2135
|
+
params.nodeIds.map((nodeId) => drizzleOrm.sql`${nodeId}`),
|
|
2136
|
+
drizzleOrm.sql`, `
|
|
2137
|
+
)})
|
|
1662
2138
|
`;
|
|
1663
2139
|
}
|
|
1664
2140
|
function buildCheckUnique(tables, params) {
|
|
@@ -1707,6 +2183,9 @@ function buildCheckUniqueBatch(tables, params) {
|
|
|
1707
2183
|
}
|
|
1708
2184
|
|
|
1709
2185
|
// src/backend/drizzle/operations/strategy.ts
|
|
2186
|
+
function nullableText(value) {
|
|
2187
|
+
return value === void 0 ? drizzleOrm.sql`NULL` : drizzleOrm.sql`${value}`;
|
|
2188
|
+
}
|
|
1710
2189
|
function bindTableOperationBuilders(tables, builders) {
|
|
1711
2190
|
const boundEntries = Object.entries(builders).map(([name, builder]) => {
|
|
1712
2191
|
function boundBuilder(...args) {
|
|
@@ -1747,9 +2226,11 @@ var COMMON_TABLE_OPERATION_BUILDERS = {
|
|
|
1747
2226
|
buildCountNodesByKind,
|
|
1748
2227
|
buildFindEdgesByKind,
|
|
1749
2228
|
buildFindEdgesByEndpointSet,
|
|
2229
|
+
buildFindEdgesByHeterogeneousEndpointSet,
|
|
1750
2230
|
buildCountEdgesByKind,
|
|
1751
2231
|
buildDeleteUnique,
|
|
1752
2232
|
buildHardDeleteUniquesByNode,
|
|
2233
|
+
buildHardDeleteUniquesByNodeIds,
|
|
1753
2234
|
buildCheckUnique,
|
|
1754
2235
|
buildCheckUniqueBatch,
|
|
1755
2236
|
buildGetSchemaVersion
|
|
@@ -1762,15 +2243,15 @@ function createCommonOperationStrategy(tables, dialect, fulltextStrategy) {
|
|
|
1762
2243
|
const fulltextTable = tables.fulltextTableName;
|
|
1763
2244
|
const contributionMaterializations = tables.contributionMaterializations;
|
|
1764
2245
|
const fulltextBuilders = {
|
|
1765
|
-
buildUpsertFulltext: (params, timestamp) => fulltextStrategy.buildUpsert(fulltextTable, params, timestamp).map((statement) =>
|
|
1766
|
-
buildDeleteFulltext: (params) => fulltextStrategy.buildDelete(fulltextTable, params).map((statement) =>
|
|
2246
|
+
buildUpsertFulltext: (params, timestamp) => fulltextStrategy.buildUpsert(fulltextTable, params, timestamp).map((statement) => chunkU5SON7R2_cjs.toDrizzleSql(statement, dialect)),
|
|
2247
|
+
buildDeleteFulltext: (params) => fulltextStrategy.buildDelete(fulltextTable, params).map((statement) => chunkU5SON7R2_cjs.toDrizzleSql(statement, dialect)),
|
|
1767
2248
|
buildDeleteFulltextByNode: (graphId, nodeKind, nodeId) => fulltextStrategy.buildDelete(fulltextTable, {
|
|
1768
2249
|
graphId,
|
|
1769
2250
|
nodeKind,
|
|
1770
2251
|
nodeId
|
|
1771
|
-
}).map((statement) =>
|
|
1772
|
-
buildUpsertFulltextBatch: (params, timestamp) => fulltextStrategy.buildBatchUpsert(fulltextTable, params, timestamp).map((statement) =>
|
|
1773
|
-
buildDeleteFulltextBatch: (params) => fulltextStrategy.buildBatchDelete(fulltextTable, params).map((statement) =>
|
|
2252
|
+
}).map((statement) => chunkU5SON7R2_cjs.toDrizzleSql(statement, dialect)),
|
|
2253
|
+
buildUpsertFulltextBatch: (params, timestamp) => fulltextStrategy.buildBatchUpsert(fulltextTable, params, timestamp).map((statement) => chunkU5SON7R2_cjs.toDrizzleSql(statement, dialect)),
|
|
2254
|
+
buildDeleteFulltextBatch: (params) => fulltextStrategy.buildBatchDelete(fulltextTable, params).map((statement) => chunkU5SON7R2_cjs.toDrizzleSql(statement, dialect)),
|
|
1774
2255
|
buildFulltextSearch: (params) => buildFulltextSearch(
|
|
1775
2256
|
fulltextTable,
|
|
1776
2257
|
params,
|
|
@@ -1782,7 +2263,7 @@ function createCommonOperationStrategy(tables, dialect, fulltextStrategy) {
|
|
|
1782
2263
|
tables.nodes,
|
|
1783
2264
|
params.graphId,
|
|
1784
2265
|
params.nodeKind,
|
|
1785
|
-
|
|
2266
|
+
chunkYAAM3M2S_cjs.nowIso()
|
|
1786
2267
|
)
|
|
1787
2268
|
),
|
|
1788
2269
|
buildHybridSearch: (params, vectorSql, vectorScoreDescending) => {
|
|
@@ -1790,7 +2271,7 @@ function createCommonOperationStrategy(tables, dialect, fulltextStrategy) {
|
|
|
1790
2271
|
tables.nodes,
|
|
1791
2272
|
params.graphId,
|
|
1792
2273
|
params.nodeKind,
|
|
1793
|
-
|
|
2274
|
+
chunkYAAM3M2S_cjs.nowIso()
|
|
1794
2275
|
);
|
|
1795
2276
|
const fulltextSql = buildFulltextSearch(
|
|
1796
2277
|
fulltextTable,
|
|
@@ -1811,7 +2292,7 @@ function createCommonOperationStrategy(tables, dialect, fulltextStrategy) {
|
|
|
1811
2292
|
hybridCandidatesRef()
|
|
1812
2293
|
);
|
|
1813
2294
|
return buildHybridSearchStatement({
|
|
1814
|
-
candidatesSql:
|
|
2295
|
+
candidatesSql: chunkVCRRKBLN_cjs.isSqlFragment(candidates) ? chunkU5SON7R2_cjs.toDrizzleSql(candidates, dialect) : candidates,
|
|
1815
2296
|
vectorSql,
|
|
1816
2297
|
vectorScoreDescending,
|
|
1817
2298
|
fulltextSql,
|
|
@@ -1827,6 +2308,24 @@ function createCommonOperationStrategy(tables, dialect, fulltextStrategy) {
|
|
|
1827
2308
|
});
|
|
1828
2309
|
}
|
|
1829
2310
|
};
|
|
2311
|
+
function buildInsertContributionMaterialization(params) {
|
|
2312
|
+
return drizzleOrm.sql`
|
|
2313
|
+
INSERT INTO ${contributionMaterializations}
|
|
2314
|
+
(graph_id, logical_name, owner, table_name, signature,
|
|
2315
|
+
materialized_at, last_attempted_at, last_error)
|
|
2316
|
+
VALUES (
|
|
2317
|
+
${params.graphId}, ${params.logicalName}, ${params.owner},
|
|
2318
|
+
${params.tableName}, ${params.signature},
|
|
2319
|
+
${nullableText(params.materializedAt)}, ${params.attemptedAt},
|
|
2320
|
+
${nullableText(params.error)}
|
|
2321
|
+
)
|
|
2322
|
+
ON CONFLICT (graph_id, logical_name, owner, table_name) DO UPDATE SET
|
|
2323
|
+
signature = excluded.signature,
|
|
2324
|
+
materialized_at = excluded.materialized_at,
|
|
2325
|
+
last_attempted_at = excluded.last_attempted_at,
|
|
2326
|
+
last_error = excluded.last_error
|
|
2327
|
+
`;
|
|
2328
|
+
}
|
|
1830
2329
|
function buildDeleteContributionMaterialization(identity) {
|
|
1831
2330
|
return drizzleOrm.sql`
|
|
1832
2331
|
DELETE FROM ${contributionMaterializations}
|
|
@@ -1839,7 +2338,15 @@ function createCommonOperationStrategy(tables, dialect, fulltextStrategy) {
|
|
|
1839
2338
|
return {
|
|
1840
2339
|
...tableOperations,
|
|
1841
2340
|
...fulltextBuilders,
|
|
2341
|
+
primaryKeyConstraints: {
|
|
2342
|
+
nodes: nodePrimaryKeyConstraint(tables.nodes),
|
|
2343
|
+
edges: edgePrimaryKeyConstraint(tables.edges)
|
|
2344
|
+
},
|
|
2345
|
+
buildUpdateNodeSet(params, timestamp) {
|
|
2346
|
+
return buildUpdateNodeSet(tables, dialect, params, timestamp);
|
|
2347
|
+
},
|
|
1842
2348
|
buildDeleteContributionMaterialization,
|
|
2349
|
+
buildInsertContributionMaterialization,
|
|
1843
2350
|
buildInsertUnique(params) {
|
|
1844
2351
|
return buildInsertUnique(tables, dialect, params);
|
|
1845
2352
|
},
|
|
@@ -1882,7 +2389,7 @@ function createCommonOperationStrategy(tables, dialect, fulltextStrategy) {
|
|
|
1882
2389
|
}
|
|
1883
2390
|
function tableExistsFromRow(row) {
|
|
1884
2391
|
if (row === void 0) return false;
|
|
1885
|
-
return Object.values(row).some((value) =>
|
|
2392
|
+
return Object.values(row).some((value) => chunkN66HCGCY_cjs.isPresent(value));
|
|
1886
2393
|
}
|
|
1887
2394
|
function createCachedTableExistence(probe, options) {
|
|
1888
2395
|
const cacheExisting = options?.cacheExisting !== false;
|
|
@@ -1915,18 +2422,38 @@ var DRIZZLE_DIALECT_LABELS = {
|
|
|
1915
2422
|
function assertAdoptedDialect(externalTx, brand, backend) {
|
|
1916
2423
|
if (drizzleOrm.is(externalTx, brand)) return;
|
|
1917
2424
|
const label = DRIZZLE_DIALECT_LABELS[backend];
|
|
1918
|
-
throw new
|
|
2425
|
+
throw new chunkNI72YOJB_cjs.ConfigurationError(
|
|
1919
2426
|
`adoptTransaction received a handle that is not a ${label} Drizzle transaction. Pass the \`tx\` from a ${label} \`db.transaction(...)\` opened on this backend's connection.`,
|
|
1920
2427
|
{ backend, capability: "adoptTransaction" }
|
|
1921
2428
|
);
|
|
1922
2429
|
}
|
|
2430
|
+
async function withDuplicateKeyClassification(run, context) {
|
|
2431
|
+
try {
|
|
2432
|
+
return await run();
|
|
2433
|
+
} catch (error) {
|
|
2434
|
+
if (!chunkBSFJMMV3_cjs.isDuplicatePrimaryKeyError(error, context.relation)) throw error;
|
|
2435
|
+
throw new chunkNI72YOJB_cjs.DatabaseOperationError(
|
|
2436
|
+
`Insert ${context.entity} failed: a row with this identity already exists`,
|
|
2437
|
+
{
|
|
2438
|
+
operation: "insert",
|
|
2439
|
+
entity: context.entity,
|
|
2440
|
+
reason: "duplicate_key",
|
|
2441
|
+
attempted: context.attempted
|
|
2442
|
+
},
|
|
2443
|
+
{ cause: error }
|
|
2444
|
+
);
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
function attemptedInserts(params) {
|
|
2448
|
+
return params.map((item) => ({ kind: item.kind, id: item.id }));
|
|
2449
|
+
}
|
|
1923
2450
|
function verifyExpectedActiveVersion(graphId, expected, actualActiveVersion) {
|
|
1924
2451
|
const expectedVersion = expected.kind === "active" ? expected.version : 0;
|
|
1925
2452
|
assertActiveSchemaVersion(graphId, expectedVersion, actualActiveVersion);
|
|
1926
2453
|
}
|
|
1927
2454
|
function assertActiveSchemaVersion(graphId, expectedVersion, actualActiveVersion) {
|
|
1928
2455
|
if (actualActiveVersion !== expectedVersion) {
|
|
1929
|
-
throw new
|
|
2456
|
+
throw new chunkNI72YOJB_cjs.StaleVersionError({
|
|
1930
2457
|
graphId,
|
|
1931
2458
|
expected: expectedVersion,
|
|
1932
2459
|
actual: actualActiveVersion
|
|
@@ -1969,8 +2496,14 @@ async function commitSchemaVersionIfKindsEmpty(backend, params, probes) {
|
|
|
1969
2496
|
};
|
|
1970
2497
|
}
|
|
1971
2498
|
function createCommonOperationBackend(options) {
|
|
1972
|
-
const {
|
|
1973
|
-
|
|
2499
|
+
const {
|
|
2500
|
+
batchConfig,
|
|
2501
|
+
execution,
|
|
2502
|
+
maxBindParameters,
|
|
2503
|
+
operationStrategy,
|
|
2504
|
+
rowMappers
|
|
2505
|
+
} = options;
|
|
2506
|
+
const nowIso2 = options.nowIso ?? chunkYAAM3M2S_cjs.nowIso;
|
|
1974
2507
|
const tableExists = createCachedTableExistence(
|
|
1975
2508
|
(tableName) => execution.execGet(
|
|
1976
2509
|
operationStrategy.buildTableExists(tableName)
|
|
@@ -1992,7 +2525,7 @@ function createCommonOperationBackend(options) {
|
|
|
1992
2525
|
return {
|
|
1993
2526
|
tableExists,
|
|
1994
2527
|
async executeSchemaDdl(ddl) {
|
|
1995
|
-
await execution.execRun(
|
|
2528
|
+
await execution.execRun(chunkVCRRKBLN_cjs.asCompiledStatementSql(chunkVCRRKBLN_cjs.sql.raw(ddl)));
|
|
1996
2529
|
},
|
|
1997
2530
|
async executeStatement(query) {
|
|
1998
2531
|
await execution.execRun(query);
|
|
@@ -2003,11 +2536,22 @@ function createCommonOperationBackend(options) {
|
|
|
2003
2536
|
async insertNode(params) {
|
|
2004
2537
|
const timestamp = nowIso2();
|
|
2005
2538
|
const query = operationStrategy.buildInsertNode(params, timestamp);
|
|
2006
|
-
const row = await
|
|
2539
|
+
const row = await withDuplicateKeyClassification(
|
|
2540
|
+
() => execution.execGet(query),
|
|
2541
|
+
{
|
|
2542
|
+
entity: "node",
|
|
2543
|
+
relation: operationStrategy.primaryKeyConstraints.nodes,
|
|
2544
|
+
attempted: attemptedInserts([params])
|
|
2545
|
+
}
|
|
2546
|
+
);
|
|
2007
2547
|
if (!row)
|
|
2008
|
-
throw new
|
|
2548
|
+
throw new chunkNI72YOJB_cjs.DatabaseOperationError(
|
|
2009
2549
|
"Insert node failed: no row returned",
|
|
2010
|
-
{
|
|
2550
|
+
{
|
|
2551
|
+
operation: "insert",
|
|
2552
|
+
entity: "node",
|
|
2553
|
+
reason: "no_row_returned"
|
|
2554
|
+
}
|
|
2011
2555
|
);
|
|
2012
2556
|
return rowMappers.toNodeRow(row);
|
|
2013
2557
|
},
|
|
@@ -2017,16 +2561,24 @@ function createCommonOperationBackend(options) {
|
|
|
2017
2561
|
params,
|
|
2018
2562
|
timestamp
|
|
2019
2563
|
);
|
|
2020
|
-
await execution.execRun(query)
|
|
2564
|
+
await withDuplicateKeyClassification(() => execution.execRun(query), {
|
|
2565
|
+
entity: "node",
|
|
2566
|
+
relation: operationStrategy.primaryKeyConstraints.nodes,
|
|
2567
|
+
attempted: attemptedInserts([params])
|
|
2568
|
+
});
|
|
2021
2569
|
},
|
|
2022
2570
|
async insertNodesBatch(params) {
|
|
2023
2571
|
if (params.length === 0) {
|
|
2024
2572
|
return;
|
|
2025
2573
|
}
|
|
2026
2574
|
const timestamp = nowIso2();
|
|
2027
|
-
for (const chunk2 of
|
|
2575
|
+
for (const chunk2 of chunkBSFJMMV3_cjs.chunk(params, batchConfig.nodeInsertBatchSize)) {
|
|
2028
2576
|
const query = operationStrategy.buildInsertNodesBatch(chunk2, timestamp);
|
|
2029
|
-
await execution.execRun(query)
|
|
2577
|
+
await withDuplicateKeyClassification(() => execution.execRun(query), {
|
|
2578
|
+
entity: "node",
|
|
2579
|
+
relation: operationStrategy.primaryKeyConstraints.nodes,
|
|
2580
|
+
attempted: attemptedInserts(chunk2)
|
|
2581
|
+
});
|
|
2030
2582
|
}
|
|
2031
2583
|
},
|
|
2032
2584
|
async insertNodesBatchReturning(params) {
|
|
@@ -2035,12 +2587,19 @@ function createCommonOperationBackend(options) {
|
|
|
2035
2587
|
}
|
|
2036
2588
|
const timestamp = nowIso2();
|
|
2037
2589
|
const allRows = [];
|
|
2038
|
-
for (const chunk2 of
|
|
2590
|
+
for (const chunk2 of chunkBSFJMMV3_cjs.chunk(params, batchConfig.nodeInsertBatchSize)) {
|
|
2039
2591
|
const query = operationStrategy.buildInsertNodesBatchReturning(
|
|
2040
2592
|
chunk2,
|
|
2041
2593
|
timestamp
|
|
2042
2594
|
);
|
|
2043
|
-
const rows = await
|
|
2595
|
+
const rows = await withDuplicateKeyClassification(
|
|
2596
|
+
() => execution.execAll(query),
|
|
2597
|
+
{
|
|
2598
|
+
entity: "node",
|
|
2599
|
+
relation: operationStrategy.primaryKeyConstraints.nodes,
|
|
2600
|
+
attempted: attemptedInserts(chunk2)
|
|
2601
|
+
}
|
|
2602
|
+
);
|
|
2044
2603
|
allRows.push(...rows.map((row) => rowMappers.toNodeRow(row)));
|
|
2045
2604
|
}
|
|
2046
2605
|
return allRows;
|
|
@@ -2053,7 +2612,7 @@ function createCommonOperationBackend(options) {
|
|
|
2053
2612
|
async getNodes(graphId, kind, ids) {
|
|
2054
2613
|
if (ids.length === 0) return [];
|
|
2055
2614
|
const allRows = [];
|
|
2056
|
-
for (const chunk2 of
|
|
2615
|
+
for (const chunk2 of chunkBSFJMMV3_cjs.chunk(ids, batchConfig.getNodesChunkSize)) {
|
|
2057
2616
|
const query = operationStrategy.buildGetNodes(graphId, kind, chunk2);
|
|
2058
2617
|
const rows = await execution.execAll(query);
|
|
2059
2618
|
allRows.push(...rows.map((row) => rowMappers.toNodeRow(row)));
|
|
@@ -2065,12 +2624,35 @@ function createCommonOperationBackend(options) {
|
|
|
2065
2624
|
const query = operationStrategy.buildUpdateNode(params, timestamp);
|
|
2066
2625
|
const row = await execution.execGet(query);
|
|
2067
2626
|
if (!row)
|
|
2068
|
-
throw new
|
|
2627
|
+
throw new chunkNI72YOJB_cjs.DatabaseOperationError(
|
|
2069
2628
|
"Update node failed: no row returned",
|
|
2070
|
-
{
|
|
2629
|
+
{
|
|
2630
|
+
operation: "update",
|
|
2631
|
+
entity: "node",
|
|
2632
|
+
reason: "no_row_returned"
|
|
2633
|
+
}
|
|
2071
2634
|
);
|
|
2072
2635
|
return rowMappers.toNodeRow(row);
|
|
2073
2636
|
},
|
|
2637
|
+
async updateNodeSet(params) {
|
|
2638
|
+
if (Object.keys(params.patch).length === 0 && (params.unsetProperties?.length ?? 0) === 0) {
|
|
2639
|
+
throw new chunkNI72YOJB_cjs.ConfigurationError(
|
|
2640
|
+
"Set-based node update requires at least one property",
|
|
2641
|
+
{ operation: "updateNodeSet", kind: params.kind }
|
|
2642
|
+
);
|
|
2643
|
+
}
|
|
2644
|
+
if (params.candidateIdColumn.length === 0) {
|
|
2645
|
+
throw new chunkNI72YOJB_cjs.ConfigurationError(
|
|
2646
|
+
"Set-based node update requires a candidate id column",
|
|
2647
|
+
{ operation: "updateNodeSet", kind: params.kind }
|
|
2648
|
+
);
|
|
2649
|
+
}
|
|
2650
|
+
const timestamp = nowIso2();
|
|
2651
|
+
const query = operationStrategy.buildUpdateNodeSet(params, timestamp);
|
|
2652
|
+
const rows = await execution.execAll(query);
|
|
2653
|
+
const updatedRows = rows.map((row) => rowMappers.toNodeRow(row));
|
|
2654
|
+
return { affectedCount: updatedRows.length, rows: updatedRows };
|
|
2655
|
+
},
|
|
2074
2656
|
async deleteNode(params) {
|
|
2075
2657
|
const timestamp = nowIso2();
|
|
2076
2658
|
const query = operationStrategy.buildDeleteNode(params, timestamp);
|
|
@@ -2088,6 +2670,7 @@ function createCommonOperationBackend(options) {
|
|
|
2088
2670
|
async hardDeleteNode(params) {
|
|
2089
2671
|
const deleteUniquesQuery = operationStrategy.buildHardDeleteUniquesByNode(
|
|
2090
2672
|
params.graphId,
|
|
2673
|
+
params.kind,
|
|
2091
2674
|
params.id
|
|
2092
2675
|
);
|
|
2093
2676
|
await execution.execRun(deleteUniquesQuery);
|
|
@@ -2111,11 +2694,22 @@ function createCommonOperationBackend(options) {
|
|
|
2111
2694
|
async insertEdge(params) {
|
|
2112
2695
|
const timestamp = nowIso2();
|
|
2113
2696
|
const query = operationStrategy.buildInsertEdge(params, timestamp);
|
|
2114
|
-
const row = await
|
|
2697
|
+
const row = await withDuplicateKeyClassification(
|
|
2698
|
+
() => execution.execGet(query),
|
|
2699
|
+
{
|
|
2700
|
+
entity: "edge",
|
|
2701
|
+
relation: operationStrategy.primaryKeyConstraints.edges,
|
|
2702
|
+
attempted: attemptedInserts([params])
|
|
2703
|
+
}
|
|
2704
|
+
);
|
|
2115
2705
|
if (!row)
|
|
2116
|
-
throw new
|
|
2706
|
+
throw new chunkNI72YOJB_cjs.DatabaseOperationError(
|
|
2117
2707
|
"Insert edge failed: no row returned",
|
|
2118
|
-
{
|
|
2708
|
+
{
|
|
2709
|
+
operation: "insert",
|
|
2710
|
+
entity: "edge",
|
|
2711
|
+
reason: "no_row_returned"
|
|
2712
|
+
}
|
|
2119
2713
|
);
|
|
2120
2714
|
return rowMappers.toEdgeRow(row);
|
|
2121
2715
|
},
|
|
@@ -2125,16 +2719,24 @@ function createCommonOperationBackend(options) {
|
|
|
2125
2719
|
params,
|
|
2126
2720
|
timestamp
|
|
2127
2721
|
);
|
|
2128
|
-
await execution.execRun(query)
|
|
2722
|
+
await withDuplicateKeyClassification(() => execution.execRun(query), {
|
|
2723
|
+
entity: "edge",
|
|
2724
|
+
relation: operationStrategy.primaryKeyConstraints.edges,
|
|
2725
|
+
attempted: attemptedInserts([params])
|
|
2726
|
+
});
|
|
2129
2727
|
},
|
|
2130
2728
|
async insertEdgesBatch(params) {
|
|
2131
2729
|
if (params.length === 0) {
|
|
2132
2730
|
return;
|
|
2133
2731
|
}
|
|
2134
2732
|
const timestamp = nowIso2();
|
|
2135
|
-
for (const chunk2 of
|
|
2733
|
+
for (const chunk2 of chunkBSFJMMV3_cjs.chunk(params, batchConfig.edgeInsertBatchSize)) {
|
|
2136
2734
|
const query = operationStrategy.buildInsertEdgesBatch(chunk2, timestamp);
|
|
2137
|
-
await execution.execRun(query)
|
|
2735
|
+
await withDuplicateKeyClassification(() => execution.execRun(query), {
|
|
2736
|
+
entity: "edge",
|
|
2737
|
+
relation: operationStrategy.primaryKeyConstraints.edges,
|
|
2738
|
+
attempted: attemptedInserts(chunk2)
|
|
2739
|
+
});
|
|
2138
2740
|
}
|
|
2139
2741
|
},
|
|
2140
2742
|
async insertEdgesBatchReturning(params) {
|
|
@@ -2143,12 +2745,19 @@ function createCommonOperationBackend(options) {
|
|
|
2143
2745
|
}
|
|
2144
2746
|
const timestamp = nowIso2();
|
|
2145
2747
|
const allRows = [];
|
|
2146
|
-
for (const chunk2 of
|
|
2748
|
+
for (const chunk2 of chunkBSFJMMV3_cjs.chunk(params, batchConfig.edgeInsertBatchSize)) {
|
|
2147
2749
|
const query = operationStrategy.buildInsertEdgesBatchReturning(
|
|
2148
2750
|
chunk2,
|
|
2149
2751
|
timestamp
|
|
2150
2752
|
);
|
|
2151
|
-
const rows = await
|
|
2753
|
+
const rows = await withDuplicateKeyClassification(
|
|
2754
|
+
() => execution.execAll(query),
|
|
2755
|
+
{
|
|
2756
|
+
entity: "edge",
|
|
2757
|
+
relation: operationStrategy.primaryKeyConstraints.edges,
|
|
2758
|
+
attempted: attemptedInserts(chunk2)
|
|
2759
|
+
}
|
|
2760
|
+
);
|
|
2152
2761
|
allRows.push(...rows.map((row) => rowMappers.toEdgeRow(row)));
|
|
2153
2762
|
}
|
|
2154
2763
|
return allRows;
|
|
@@ -2161,7 +2770,7 @@ function createCommonOperationBackend(options) {
|
|
|
2161
2770
|
async getEdges(graphId, ids) {
|
|
2162
2771
|
if (ids.length === 0) return [];
|
|
2163
2772
|
const allRows = [];
|
|
2164
|
-
for (const chunk2 of
|
|
2773
|
+
for (const chunk2 of chunkBSFJMMV3_cjs.chunk(ids, batchConfig.getEdgesChunkSize)) {
|
|
2165
2774
|
const query = operationStrategy.buildGetEdges(graphId, chunk2);
|
|
2166
2775
|
const rows = await execution.execAll(query);
|
|
2167
2776
|
allRows.push(...rows.map((row) => rowMappers.toEdgeRow(row)));
|
|
@@ -2173,9 +2782,13 @@ function createCommonOperationBackend(options) {
|
|
|
2173
2782
|
const query = operationStrategy.buildUpdateEdge(params, timestamp);
|
|
2174
2783
|
const row = await execution.execGet(query);
|
|
2175
2784
|
if (!row)
|
|
2176
|
-
throw new
|
|
2785
|
+
throw new chunkNI72YOJB_cjs.DatabaseOperationError(
|
|
2177
2786
|
"Update edge failed: no row returned",
|
|
2178
|
-
{
|
|
2787
|
+
{
|
|
2788
|
+
operation: "update",
|
|
2789
|
+
entity: "edge",
|
|
2790
|
+
reason: "no_row_returned"
|
|
2791
|
+
}
|
|
2179
2792
|
);
|
|
2180
2793
|
return rowMappers.toEdgeRow(row);
|
|
2181
2794
|
},
|
|
@@ -2195,7 +2808,7 @@ function createCommonOperationBackend(options) {
|
|
|
2195
2808
|
1,
|
|
2196
2809
|
batchConfig.getEdgesChunkSize - 1
|
|
2197
2810
|
);
|
|
2198
|
-
for (const chunk2 of
|
|
2811
|
+
for (const chunk2 of chunkBSFJMMV3_cjs.chunk(params.ids, softDeleteChunkSize)) {
|
|
2199
2812
|
const query = operationStrategy.buildDeleteEdgesBatch(
|
|
2200
2813
|
{ graphId: params.graphId, ids: chunk2 },
|
|
2201
2814
|
timestamp
|
|
@@ -2205,7 +2818,7 @@ function createCommonOperationBackend(options) {
|
|
|
2205
2818
|
},
|
|
2206
2819
|
async hardDeleteEdgesBatch(params) {
|
|
2207
2820
|
if (params.ids.length === 0) return;
|
|
2208
|
-
for (const chunk2 of
|
|
2821
|
+
for (const chunk2 of chunkBSFJMMV3_cjs.chunk(
|
|
2209
2822
|
params.ids,
|
|
2210
2823
|
batchConfig.getEdgesChunkSize
|
|
2211
2824
|
)) {
|
|
@@ -2249,7 +2862,7 @@ function createCommonOperationBackend(options) {
|
|
|
2249
2862
|
async findEdgesByEndpointSet(params) {
|
|
2250
2863
|
const ids = resolveEdgeEndpointIds(params);
|
|
2251
2864
|
const edgeRows = [];
|
|
2252
|
-
for (const idChunk of
|
|
2865
|
+
for (const idChunk of chunkBSFJMMV3_cjs.chunk(
|
|
2253
2866
|
ids,
|
|
2254
2867
|
batchConfig.findEdgesEndpointChunkSize
|
|
2255
2868
|
)) {
|
|
@@ -2262,6 +2875,21 @@ function createCommonOperationBackend(options) {
|
|
|
2262
2875
|
}
|
|
2263
2876
|
return edgeRows;
|
|
2264
2877
|
},
|
|
2878
|
+
async findEdgesByHeterogeneousEndpointSet(params) {
|
|
2879
|
+
const { edgeKinds, endpoints, endpointChunkSize } = resolveHeterogeneousEdgeRead(params, maxBindParameters);
|
|
2880
|
+
if (edgeKinds.length === 0 || endpoints.length === 0) return [];
|
|
2881
|
+
const edgeRows = [];
|
|
2882
|
+
for (const endpointChunk of chunkBSFJMMV3_cjs.chunk(endpoints, endpointChunkSize)) {
|
|
2883
|
+
const query = operationStrategy.buildFindEdgesByHeterogeneousEndpointSet(
|
|
2884
|
+
params,
|
|
2885
|
+
endpointChunk,
|
|
2886
|
+
edgeKinds
|
|
2887
|
+
);
|
|
2888
|
+
const rows = await execution.execAll(query);
|
|
2889
|
+
for (const row of rows) edgeRows.push(rowMappers.toEdgeRow(row));
|
|
2890
|
+
}
|
|
2891
|
+
return edgeRows;
|
|
2892
|
+
},
|
|
2265
2893
|
async countEdgesByKind(params) {
|
|
2266
2894
|
const query = operationStrategy.buildCountEdgesByKind(params);
|
|
2267
2895
|
const row = await execution.execGet(query);
|
|
@@ -2271,7 +2899,7 @@ function createCommonOperationBackend(options) {
|
|
|
2271
2899
|
const query = operationStrategy.buildInsertUnique(params);
|
|
2272
2900
|
const result = await execution.execGet(query);
|
|
2273
2901
|
if (result && result.node_id !== params.nodeId) {
|
|
2274
|
-
throw new
|
|
2902
|
+
throw new chunkNI72YOJB_cjs.UniquenessError({
|
|
2275
2903
|
constraintName: params.constraintName,
|
|
2276
2904
|
kind: params.nodeKind,
|
|
2277
2905
|
existingId: result.node_id,
|
|
@@ -2291,7 +2919,7 @@ function createCommonOperationBackend(options) {
|
|
|
2291
2919
|
continue;
|
|
2292
2920
|
}
|
|
2293
2921
|
if (existing.nodeId !== entry.nodeId) {
|
|
2294
|
-
throw new
|
|
2922
|
+
throw new chunkNI72YOJB_cjs.UniquenessError({
|
|
2295
2923
|
constraintName: entry.constraintName,
|
|
2296
2924
|
kind: entry.nodeKind,
|
|
2297
2925
|
existingId: existing.nodeId,
|
|
@@ -2301,7 +2929,7 @@ function createCommonOperationBackend(options) {
|
|
|
2301
2929
|
}
|
|
2302
2930
|
}
|
|
2303
2931
|
const deduped = [...byTarget.values()];
|
|
2304
|
-
for (const chunk2 of
|
|
2932
|
+
for (const chunk2 of chunkBSFJMMV3_cjs.chunk(
|
|
2305
2933
|
deduped,
|
|
2306
2934
|
batchConfig.uniqueInsertBatchSize
|
|
2307
2935
|
)) {
|
|
@@ -2316,7 +2944,7 @@ function createCommonOperationBackend(options) {
|
|
|
2316
2944
|
for (const entry of chunk2) {
|
|
2317
2945
|
const owner = ownerByTarget.get(targetKey(entry));
|
|
2318
2946
|
if (owner !== void 0 && owner !== entry.nodeId) {
|
|
2319
|
-
throw new
|
|
2947
|
+
throw new chunkNI72YOJB_cjs.UniquenessError({
|
|
2320
2948
|
constraintName: entry.constraintName,
|
|
2321
2949
|
kind: entry.nodeKind,
|
|
2322
2950
|
existingId: owner,
|
|
@@ -2332,6 +2960,19 @@ function createCommonOperationBackend(options) {
|
|
|
2332
2960
|
const query = operationStrategy.buildDeleteUnique(params, timestamp);
|
|
2333
2961
|
await execution.execRun(query);
|
|
2334
2962
|
},
|
|
2963
|
+
async hardDeleteUniquesByNodeIds(params) {
|
|
2964
|
+
const nodeIds = [...new Set(params.nodeIds)];
|
|
2965
|
+
for (const chunk2 of chunkBSFJMMV3_cjs.chunk(
|
|
2966
|
+
nodeIds,
|
|
2967
|
+
batchConfig.uniqueDeleteChunkSize
|
|
2968
|
+
)) {
|
|
2969
|
+
const query = operationStrategy.buildHardDeleteUniquesByNodeIds({
|
|
2970
|
+
...params,
|
|
2971
|
+
nodeIds: chunk2
|
|
2972
|
+
});
|
|
2973
|
+
await execution.execRun(query);
|
|
2974
|
+
}
|
|
2975
|
+
},
|
|
2335
2976
|
async checkUnique(params) {
|
|
2336
2977
|
const query = operationStrategy.buildCheckUnique(params);
|
|
2337
2978
|
const row = await execution.execGet(query);
|
|
@@ -2340,7 +2981,7 @@ function createCommonOperationBackend(options) {
|
|
|
2340
2981
|
async checkUniqueBatch(params) {
|
|
2341
2982
|
if (params.keys.length === 0) return [];
|
|
2342
2983
|
const allRows = [];
|
|
2343
|
-
for (const chunk2 of
|
|
2984
|
+
for (const chunk2 of chunkBSFJMMV3_cjs.chunk(
|
|
2344
2985
|
params.keys,
|
|
2345
2986
|
batchConfig.checkUniqueBatchChunkSize
|
|
2346
2987
|
)) {
|
|
@@ -2371,7 +3012,7 @@ function createCommonOperationBackend(options) {
|
|
|
2371
3012
|
if (existingRaw !== void 0) {
|
|
2372
3013
|
const existing = rowMappers.toSchemaVersionRow(existingRaw);
|
|
2373
3014
|
if (existing.schema_hash !== params.schemaHash) {
|
|
2374
|
-
throw new
|
|
3015
|
+
throw new chunkNI72YOJB_cjs.SchemaContentConflictError({
|
|
2375
3016
|
graphId: params.graphId,
|
|
2376
3017
|
version: params.version,
|
|
2377
3018
|
existingHash: existing.schema_hash,
|
|
@@ -2419,7 +3060,7 @@ function createCommonOperationBackend(options) {
|
|
|
2419
3060
|
);
|
|
2420
3061
|
const insertedRaw = await execution.execGet(insertQuery);
|
|
2421
3062
|
if (!insertedRaw) {
|
|
2422
|
-
throw new
|
|
3063
|
+
throw new chunkNI72YOJB_cjs.DatabaseOperationError(
|
|
2423
3064
|
"Insert schema failed: no row returned",
|
|
2424
3065
|
{ operation: "insert", entity: "schema" }
|
|
2425
3066
|
);
|
|
@@ -2437,7 +3078,7 @@ function createCommonOperationBackend(options) {
|
|
|
2437
3078
|
operationStrategy.buildGetSchemaVersion(params.graphId, params.version)
|
|
2438
3079
|
);
|
|
2439
3080
|
if (!targetRaw) {
|
|
2440
|
-
throw new
|
|
3081
|
+
throw new chunkNI72YOJB_cjs.MigrationError(
|
|
2441
3082
|
`Cannot activate version ${params.version}: version does not exist for graph "${params.graphId}".`,
|
|
2442
3083
|
{
|
|
2443
3084
|
graphId: params.graphId,
|
|
@@ -2470,7 +3111,7 @@ function quoteSqlIdentifier(identifier) {
|
|
|
2470
3111
|
}
|
|
2471
3112
|
function requireRawExecution(backend) {
|
|
2472
3113
|
if (backend.executeRaw === void 0) {
|
|
2473
|
-
throw new
|
|
3114
|
+
throw new chunkNI72YOJB_cjs.TrustedImportError(
|
|
2474
3115
|
"This backend cannot execute the raw statements required by trusted import.",
|
|
2475
3116
|
"backend_unsupported"
|
|
2476
3117
|
);
|
|
@@ -2479,7 +3120,7 @@ function requireRawExecution(backend) {
|
|
|
2479
3120
|
}
|
|
2480
3121
|
function requireStatementExecution(backend) {
|
|
2481
3122
|
if (backend.executeStatement === void 0) {
|
|
2482
|
-
throw new
|
|
3123
|
+
throw new chunkNI72YOJB_cjs.TrustedImportError(
|
|
2483
3124
|
"This backend cannot execute the index lifecycle required by trusted import.",
|
|
2484
3125
|
"backend_unsupported"
|
|
2485
3126
|
);
|
|
@@ -2501,7 +3142,7 @@ async function assertTrustedImportDatabaseEmpty(backend, tableNames) {
|
|
|
2501
3142
|
[]
|
|
2502
3143
|
);
|
|
2503
3144
|
if (!rowIndicatesExistingData(rows[0])) return;
|
|
2504
|
-
throw new
|
|
3145
|
+
throw new chunkNI72YOJB_cjs.TrustedImportError(
|
|
2505
3146
|
"Trusted import requires globally empty TypeGraph node and edge tables.",
|
|
2506
3147
|
"database_not_empty",
|
|
2507
3148
|
{ tables: [tableNames.nodes, tableNames.edges] },
|
|
@@ -2513,8 +3154,8 @@ async function assertTrustedImportDatabaseEmpty(backend, tableNames) {
|
|
|
2513
3154
|
async function lockPostgresTrustedImportTables(backend, tableNames) {
|
|
2514
3155
|
const executeStatement = requireStatementExecution(backend);
|
|
2515
3156
|
await executeStatement(
|
|
2516
|
-
|
|
2517
|
-
|
|
3157
|
+
chunkVCRRKBLN_cjs.asCompiledStatementSql(
|
|
3158
|
+
chunkVCRRKBLN_cjs.sql.raw(
|
|
2518
3159
|
`LOCK TABLE ${quoteSqlIdentifier(tableNames.nodes)}, ${quoteSqlIdentifier(tableNames.edges)} IN ACCESS EXCLUSIVE MODE`
|
|
2519
3160
|
)
|
|
2520
3161
|
)
|
|
@@ -2534,8 +3175,8 @@ async function suspendSqliteSecondaryIndexes(backend, tableNames) {
|
|
|
2534
3175
|
);
|
|
2535
3176
|
for (const definition of definitions) {
|
|
2536
3177
|
await executeStatement(
|
|
2537
|
-
|
|
2538
|
-
|
|
3178
|
+
chunkVCRRKBLN_cjs.asCompiledStatementSql(
|
|
3179
|
+
chunkVCRRKBLN_cjs.sql.raw(`DROP INDEX ${quoteSqlIdentifier(definition.index_name)}`)
|
|
2539
3180
|
)
|
|
2540
3181
|
);
|
|
2541
3182
|
}
|
|
@@ -2565,8 +3206,8 @@ async function suspendPostgresSecondaryIndexes(backend, tableNames) {
|
|
|
2565
3206
|
);
|
|
2566
3207
|
for (const definition of definitions) {
|
|
2567
3208
|
await executeStatement(
|
|
2568
|
-
|
|
2569
|
-
|
|
3209
|
+
chunkVCRRKBLN_cjs.asCompiledStatementSql(
|
|
3210
|
+
chunkVCRRKBLN_cjs.sql.raw(`DROP INDEX ${quoteSqlIdentifier(definition.index_name)}`)
|
|
2570
3211
|
)
|
|
2571
3212
|
);
|
|
2572
3213
|
}
|
|
@@ -2576,20 +3217,20 @@ async function restoreSecondaryIndexes(backend, definitions) {
|
|
|
2576
3217
|
const executeStatement = requireStatementExecution(backend);
|
|
2577
3218
|
for (const definition of definitions) {
|
|
2578
3219
|
await executeStatement(
|
|
2579
|
-
|
|
3220
|
+
chunkVCRRKBLN_cjs.asCompiledStatementSql(chunkVCRRKBLN_cjs.sql.raw(definition.index_definition))
|
|
2580
3221
|
);
|
|
2581
3222
|
}
|
|
2582
3223
|
}
|
|
2583
3224
|
async function analyzeImportedTables(backend, tableNames) {
|
|
2584
3225
|
const executeStatement = requireStatementExecution(backend);
|
|
2585
3226
|
await executeStatement(
|
|
2586
|
-
|
|
2587
|
-
|
|
3227
|
+
chunkVCRRKBLN_cjs.asCompiledStatementSql(
|
|
3228
|
+
chunkVCRRKBLN_cjs.sql.raw(`ANALYZE ${quoteSqlIdentifier(tableNames.nodes)}`)
|
|
2588
3229
|
)
|
|
2589
3230
|
);
|
|
2590
3231
|
await executeStatement(
|
|
2591
|
-
|
|
2592
|
-
|
|
3232
|
+
chunkVCRRKBLN_cjs.asCompiledStatementSql(
|
|
3233
|
+
chunkVCRRKBLN_cjs.sql.raw(`ANALYZE ${quoteSqlIdentifier(tableNames.edges)}`)
|
|
2593
3234
|
)
|
|
2594
3235
|
);
|
|
2595
3236
|
}
|
|
@@ -2604,7 +3245,7 @@ function postgresArray(values) {
|
|
|
2604
3245
|
function createSqliteTrustedImportSession(executionAdapter, tableNames) {
|
|
2605
3246
|
const executePreparedRunBatch = executionAdapter.executePreparedRunBatch;
|
|
2606
3247
|
if (executePreparedRunBatch === void 0) {
|
|
2607
|
-
throw new
|
|
3248
|
+
throw new chunkNI72YOJB_cjs.TrustedImportError(
|
|
2608
3249
|
"Trusted import requires a synchronous SQLite driver with prepared statement support.",
|
|
2609
3250
|
"backend_unsupported"
|
|
2610
3251
|
);
|
|
@@ -2752,6 +3393,7 @@ exports.buildLiveNodeCandidates = buildLiveNodeCandidates;
|
|
|
2752
3393
|
exports.buildMaterializationInsertValues = buildMaterializationInsertValues;
|
|
2753
3394
|
exports.buildMaterializationOnConflictSet = buildMaterializationOnConflictSet;
|
|
2754
3395
|
exports.commitSchemaVersionIfKindsEmpty = commitSchemaVersionIfKindsEmpty;
|
|
3396
|
+
exports.contributionRebuildSupported = contributionRebuildSupported;
|
|
2755
3397
|
exports.createCachedTableExistence = createCachedTableExistence;
|
|
2756
3398
|
exports.createCommonOperationBackend = createCommonOperationBackend;
|
|
2757
3399
|
exports.createContributionMaterializer = createContributionMaterializer;
|
|
@@ -2775,5 +3417,5 @@ exports.tableExistsFromRow = tableExistsFromRow;
|
|
|
2775
3417
|
exports.vectorSlotFromCreateIndexParams = vectorSlotFromCreateIndexParams;
|
|
2776
3418
|
exports.vectorSlotFromDropIndexParams = vectorSlotFromDropIndexParams;
|
|
2777
3419
|
exports.vectorSlotFromParams = vectorSlotFromParams;
|
|
2778
|
-
//# sourceMappingURL=chunk-
|
|
2779
|
-
//# sourceMappingURL=chunk-
|
|
3420
|
+
//# sourceMappingURL=chunk-MUK4BU7K.cjs.map
|
|
3421
|
+
//# sourceMappingURL=chunk-MUK4BU7K.cjs.map
|