@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,35 +1,80 @@
|
|
|
1
|
-
import { formatPostgresTimestamp, coerceNumericScore, nowIso } from './chunk-
|
|
2
|
-
import { runtimeStrategyContributions } from './chunk-
|
|
3
|
-
import { toDrizzleSql } from './chunk-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { parseDimensionMismatch, isMissingTableError } from './chunk-B75XRV3O.js';
|
|
1
|
+
import { formatPostgresTimestamp, coerceNumericScore, nowIso } from './chunk-NMWDXFPH.js';
|
|
2
|
+
import { runtimeStrategyContributions } from './chunk-5UVRGXD3.js';
|
|
3
|
+
import { toDrizzleSql } from './chunk-UV3SN74I.js';
|
|
4
|
+
import { sortedReplacer } from './chunk-JBQQ7THH.js';
|
|
5
|
+
import { parseDimensionMismatch, chunk, isDuplicatePrimaryKeyError, isMissingTableError } from './chunk-JZUR7ZWE.js';
|
|
6
|
+
import { createBackendOverlay } from './chunk-AKLS3BYZ.js';
|
|
8
7
|
import { sha256Hex } from './chunk-K34OPSJK.js';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { EmbeddingDimensionChangedError, ConfigurationError, StaleVersionError, MigrationError, SchemaContentConflictError, DatabaseOperationError, UniquenessError, TrustedImportError, StoreNotInitializedError } from './chunk-
|
|
8
|
+
import { buildFulltextGraphDelete, buildForeignFulltextGraphProbe, getDialect } from './chunk-YDFDBE6D.js';
|
|
9
|
+
import { sql as sql$1, asCompiledStatementSql, asCompiledRowsSql, isSqlFragment } from './chunk-PQBQG7IM.js';
|
|
10
|
+
import { EmbeddingDimensionChangedError, ConfigurationError, StaleVersionError, MigrationError, SchemaContentConflictError, DatabaseOperationError, UniquenessError, TrustedImportError, ContributionRebuildUnsupportedError, StoreNotInitializedError } from './chunk-J3WZ3FA2.js';
|
|
11
|
+
import { isPresent } from './chunk-DYATYRY4.js';
|
|
12
12
|
import { sql, is, getTableName } from 'drizzle-orm';
|
|
13
13
|
|
|
14
14
|
// src/backend/edge-endpoint-sets.ts
|
|
15
15
|
var FIND_EDGES_ENDPOINT_FIXED_PARAM_COUNT = 6;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (limitPerEndpoint
|
|
19
|
-
|
|
20
|
-
`findEdgesByEndpointSet \`limitPerEndpoint\` must be a positive integer, received ${String(limitPerEndpoint)}.`,
|
|
21
|
-
{
|
|
22
|
-
code: "EDGE_ENDPOINT_SET_INVALID",
|
|
23
|
-
graphId: params.graphId,
|
|
24
|
-
kind: params.kind
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
suggestion: "Pass a positive integer to cap each endpoint's rows, or omit it for an unbounded read."
|
|
28
|
-
}
|
|
29
|
-
);
|
|
16
|
+
var FIND_EDGES_HETEROGENEOUS_FIXED_PARAM_COUNT = 4;
|
|
17
|
+
function assertLimitPerEndpoint(operation, graphId, limitPerEndpoint, kind) {
|
|
18
|
+
if (limitPerEndpoint === void 0 || Number.isInteger(limitPerEndpoint) && limitPerEndpoint > 0) {
|
|
19
|
+
return;
|
|
30
20
|
}
|
|
21
|
+
throw new ConfigurationError(
|
|
22
|
+
`${operation} \`limitPerEndpoint\` must be a positive integer, received ${String(limitPerEndpoint)}.`,
|
|
23
|
+
{
|
|
24
|
+
code: "EDGE_ENDPOINT_SET_INVALID",
|
|
25
|
+
graphId,
|
|
26
|
+
...kind === void 0 ? {} : { kind }
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
suggestion: "Pass a positive integer to cap each endpoint's rows, or omit it for an unbounded read."
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
function resolveEdgeEndpointIds(params) {
|
|
34
|
+
assertLimitPerEndpoint(
|
|
35
|
+
"findEdgesByEndpointSet",
|
|
36
|
+
params.graphId,
|
|
37
|
+
params.limitPerEndpoint,
|
|
38
|
+
params.kind
|
|
39
|
+
);
|
|
31
40
|
return [...new Set(params.endpointIds)];
|
|
32
41
|
}
|
|
42
|
+
function endpointKey(endpoint) {
|
|
43
|
+
return `${endpoint.kind}\0${endpoint.id}`;
|
|
44
|
+
}
|
|
45
|
+
function resolveHeterogeneousEdgeRead(params, maxBindParameters) {
|
|
46
|
+
assertLimitPerEndpoint(
|
|
47
|
+
"findEdgesByHeterogeneousEndpointSet",
|
|
48
|
+
params.graphId,
|
|
49
|
+
params.limitPerEndpoint
|
|
50
|
+
);
|
|
51
|
+
const edgeKinds = [...new Set(params.edgeKinds)];
|
|
52
|
+
const endpoints = [
|
|
53
|
+
...new Map(
|
|
54
|
+
params.endpoints.map((endpoint) => [endpointKey(endpoint), endpoint])
|
|
55
|
+
).values()
|
|
56
|
+
];
|
|
57
|
+
if (edgeKinds.length === 0 || endpoints.length === 0) {
|
|
58
|
+
return { edgeKinds, endpoints, endpointChunkSize: 1 };
|
|
59
|
+
}
|
|
60
|
+
const endpointBindBudget = maxBindParameters - FIND_EDGES_HETEROGENEOUS_FIXED_PARAM_COUNT - edgeKinds.length;
|
|
61
|
+
const endpointChunkSize = Math.floor(endpointBindBudget / 2);
|
|
62
|
+
if (endpointChunkSize >= 1) {
|
|
63
|
+
return { edgeKinds, endpoints, endpointChunkSize };
|
|
64
|
+
}
|
|
65
|
+
throw new ConfigurationError(
|
|
66
|
+
"findEdgesByHeterogeneousEndpointSet cannot fit one endpoint and the selected edge kinds within the backend bind-parameter budget.",
|
|
67
|
+
{
|
|
68
|
+
code: "EDGE_HETEROGENEOUS_READ_BIND_BUDGET_EXCEEDED",
|
|
69
|
+
graphId: params.graphId,
|
|
70
|
+
edgeKindCount: edgeKinds.length,
|
|
71
|
+
maxBindParameters
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
suggestion: "Select fewer edge kinds in one call or use a backend with a larger bind-parameter budget."
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
33
78
|
|
|
34
79
|
// src/backend/live-node-candidates.ts
|
|
35
80
|
function buildLiveNodeCandidates(nodesTableName, graphId, nodeKind, now) {
|
|
@@ -159,6 +204,9 @@ function diagnoseContribution(row, signature, tableExists) {
|
|
|
159
204
|
if (row.materializedAt !== void 0) return "orphaned-marker";
|
|
160
205
|
return row.lastError === void 0 ? void 0 : "failed-materialization";
|
|
161
206
|
}
|
|
207
|
+
if (row?.materializedAt !== void 0 && row.signature !== signature) {
|
|
208
|
+
return "stale";
|
|
209
|
+
}
|
|
162
210
|
const state = evaluateContributionState(row, signature);
|
|
163
211
|
switch (state) {
|
|
164
212
|
case "initialized": {
|
|
@@ -176,6 +224,20 @@ function diagnoseContribution(row, signature, tableExists) {
|
|
|
176
224
|
}
|
|
177
225
|
}
|
|
178
226
|
}
|
|
227
|
+
var PROBE_PROJECTION_ORDER = [
|
|
228
|
+
"fulltext",
|
|
229
|
+
"vector"
|
|
230
|
+
];
|
|
231
|
+
var PROBE_DETAIL_PHRASE = {
|
|
232
|
+
"orphaned-marker": "storage is missing",
|
|
233
|
+
"missing-marker": "storage is not attested by a durable marker",
|
|
234
|
+
"failed-materialization": "provisioning failed and produced no storage",
|
|
235
|
+
stale: "storage exists at a different shape than the current declaration"
|
|
236
|
+
};
|
|
237
|
+
function describeProbeDiagnostic(diagnostic) {
|
|
238
|
+
const subject = diagnostic.kind === void 0 || diagnostic.fieldPath === void 0 ? `table "${diagnostic.physicalName}"` : `${diagnostic.kind}.${diagnostic.fieldPath}`;
|
|
239
|
+
return `${subject}: ${PROBE_DETAIL_PHRASE[diagnostic.state]} (${diagnostic.state})`;
|
|
240
|
+
}
|
|
179
241
|
function identityOf(graphId, contribution) {
|
|
180
242
|
return {
|
|
181
243
|
graphId,
|
|
@@ -236,6 +298,13 @@ function gateFulltext(tx, assert) {
|
|
|
236
298
|
gateFulltextMethods(tx, assert)
|
|
237
299
|
);
|
|
238
300
|
}
|
|
301
|
+
function contributionRebuildSupported(fulltextStrategy, fulltextTableName, transactional) {
|
|
302
|
+
return transactional && runtimeStrategyContributions(fulltextStrategy, fulltextTableName).every(
|
|
303
|
+
(contribution) => contribution.dropDdl !== void 0
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
var CONTRIBUTION_DDL_LOCK_KEY = "typegraph:contribution-ddl";
|
|
307
|
+
var FOREIGN_GRAPH_REPORT_LIMIT = 5;
|
|
239
308
|
var CONTRIBUTION_KEY_SEPARATOR = String.fromCodePoint(0);
|
|
240
309
|
function contributionKey(graphId, contribution) {
|
|
241
310
|
return [
|
|
@@ -305,7 +374,7 @@ function createContributionMaterializer(deps) {
|
|
|
305
374
|
);
|
|
306
375
|
await deps.recordMarker({
|
|
307
376
|
...identity,
|
|
308
|
-
signature,
|
|
377
|
+
signature: existing.signature,
|
|
309
378
|
attemptedAt: nowIso(),
|
|
310
379
|
materializedAt: void 0,
|
|
311
380
|
error: error.message
|
|
@@ -354,6 +423,7 @@ function createContributionMaterializer(deps) {
|
|
|
354
423
|
}
|
|
355
424
|
async function ensureContributions(graphId, contributions, options) {
|
|
356
425
|
const force = options?.force === true;
|
|
426
|
+
const bypassCache = options?.bypassCache === true;
|
|
357
427
|
const entries = await Promise.all(
|
|
358
428
|
contributions.map(async (contribution) => {
|
|
359
429
|
const key = contributionKey(graphId, contribution);
|
|
@@ -364,7 +434,13 @@ function createContributionMaterializer(deps) {
|
|
|
364
434
|
};
|
|
365
435
|
})
|
|
366
436
|
);
|
|
367
|
-
|
|
437
|
+
if (bypassCache) {
|
|
438
|
+
for (const entry of entries) {
|
|
439
|
+
uncacheableKeys.add(entry.key);
|
|
440
|
+
initializedSignatures.delete(entry.key);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
const pending = force || bypassCache ? entries : entries.filter(
|
|
368
444
|
(entry) => uncacheableKeys.has(entry.key) || initializedSignatures.get(entry.key) !== entry.signature
|
|
369
445
|
);
|
|
370
446
|
if (pending.length === 0) return;
|
|
@@ -469,15 +545,15 @@ function createContributionMaterializer(deps) {
|
|
|
469
545
|
await assertContributions(graphId, contributions);
|
|
470
546
|
}
|
|
471
547
|
}
|
|
472
|
-
|
|
473
|
-
const
|
|
548
|
+
function verificationTargetsByGraph(graphId, vectorSlots) {
|
|
549
|
+
const targets = /* @__PURE__ */ new Map();
|
|
474
550
|
function addTarget(id, target) {
|
|
475
|
-
const existing =
|
|
476
|
-
if (existing === void 0)
|
|
551
|
+
const existing = targets.get(id);
|
|
552
|
+
if (existing === void 0) targets.set(id, [target]);
|
|
477
553
|
else existing.push(target);
|
|
478
554
|
}
|
|
479
555
|
for (const contribution of runtimeContributions()) {
|
|
480
|
-
addTarget(graphId, { contribution });
|
|
556
|
+
addTarget(graphId, { contribution, projection: "fulltext" });
|
|
481
557
|
}
|
|
482
558
|
const { vectorStrategy } = deps;
|
|
483
559
|
if (vectorStrategy !== void 0) {
|
|
@@ -485,12 +561,16 @@ function createContributionMaterializer(deps) {
|
|
|
485
561
|
for (const contribution of vectorStrategy.ownedTables(slot)) {
|
|
486
562
|
addTarget(slot.graphId, {
|
|
487
563
|
contribution,
|
|
564
|
+
projection: "vector",
|
|
488
565
|
kind: slot.nodeKind,
|
|
489
566
|
fieldPath: slot.fieldPath
|
|
490
567
|
});
|
|
491
568
|
}
|
|
492
569
|
}
|
|
493
570
|
}
|
|
571
|
+
return targets;
|
|
572
|
+
}
|
|
573
|
+
async function diagnoseTargets(targetsByGraph) {
|
|
494
574
|
const probes = /* @__PURE__ */ new Map();
|
|
495
575
|
function tableExists(tableName) {
|
|
496
576
|
const pending = probes.get(tableName);
|
|
@@ -499,11 +579,11 @@ function createContributionMaterializer(deps) {
|
|
|
499
579
|
probes.set(tableName, probe);
|
|
500
580
|
return probe;
|
|
501
581
|
}
|
|
502
|
-
const
|
|
582
|
+
const diagnosed = [];
|
|
503
583
|
for (const [id, targets] of targetsByGraph) {
|
|
504
584
|
const read = await readMarkerRows(id);
|
|
505
585
|
const rows = read.kind === "rows" ? read.rows : /* @__PURE__ */ new Map();
|
|
506
|
-
for (const { contribution, kind, fieldPath } of targets) {
|
|
586
|
+
for (const { contribution, projection, kind, fieldPath } of targets) {
|
|
507
587
|
const key = contributionKey(id, contribution);
|
|
508
588
|
const row = rows.get(key);
|
|
509
589
|
const state = diagnoseContribution(
|
|
@@ -512,22 +592,239 @@ function createContributionMaterializer(deps) {
|
|
|
512
592
|
await tableExists(contribution.tableName)
|
|
513
593
|
);
|
|
514
594
|
if (state === void 0) continue;
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
595
|
+
diagnosed.push({
|
|
596
|
+
graphId: id,
|
|
597
|
+
contribution,
|
|
598
|
+
projection,
|
|
599
|
+
diagnostic: {
|
|
600
|
+
owner: contribution.owner,
|
|
601
|
+
logicalName: contribution.logicalName,
|
|
602
|
+
physicalName: contribution.tableName,
|
|
603
|
+
...kind === void 0 ? {} : { kind },
|
|
604
|
+
...fieldPath === void 0 ? {} : { fieldPath },
|
|
605
|
+
state,
|
|
606
|
+
// The recorded reason, carried through verbatim. `state` folds
|
|
607
|
+
// several marker verdicts together because they share a repair;
|
|
608
|
+
// this is what keeps the fold from also discarding the one thing
|
|
609
|
+
// the catalog can never tell the operator.
|
|
610
|
+
...row?.lastError === void 0 ? {} : { lastError: row.lastError }
|
|
611
|
+
}
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
return diagnosed;
|
|
616
|
+
}
|
|
617
|
+
async function diagnoseContributions(graphId, vectorSlots) {
|
|
618
|
+
return diagnoseTargets(verificationTargetsByGraph(graphId, vectorSlots));
|
|
619
|
+
}
|
|
620
|
+
async function verifyContributions(graphId, vectorSlots) {
|
|
621
|
+
const diagnosed = await diagnoseContributions(graphId, vectorSlots);
|
|
622
|
+
return diagnosed.map((entry) => entry.diagnostic);
|
|
623
|
+
}
|
|
624
|
+
async function probeContributions(graphId, vectorSlots) {
|
|
625
|
+
const targetsByGraph = verificationTargetsByGraph(graphId, vectorSlots);
|
|
626
|
+
const declared = /* @__PURE__ */ new Set();
|
|
627
|
+
for (const targets of targetsByGraph.values()) {
|
|
628
|
+
for (const target of targets) declared.add(target.projection);
|
|
629
|
+
}
|
|
630
|
+
const diagnosed = await diagnoseTargets(targetsByGraph);
|
|
631
|
+
const entries = [];
|
|
632
|
+
for (const projection of PROBE_PROJECTION_ORDER) {
|
|
633
|
+
if (!declared.has(projection)) continue;
|
|
634
|
+
const problems = diagnosed.filter(
|
|
635
|
+
(entry) => entry.projection === projection
|
|
636
|
+
);
|
|
637
|
+
if (problems.length === 0) {
|
|
638
|
+
entries.push({ contribution: projection, state: "ready" });
|
|
639
|
+
continue;
|
|
640
|
+
}
|
|
641
|
+
entries.push({
|
|
642
|
+
contribution: projection,
|
|
643
|
+
state: "degraded",
|
|
644
|
+
detail: problems.map((entry) => describeProbeDiagnostic(entry.diagnostic)).join("; ")
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
return entries;
|
|
648
|
+
}
|
|
649
|
+
async function repairContributions(graphId, vectorSlots) {
|
|
650
|
+
const diagnosed = await diagnoseContributions(graphId, vectorSlots);
|
|
651
|
+
const results = [];
|
|
652
|
+
for (const {
|
|
653
|
+
graphId: targetGraphId,
|
|
654
|
+
contribution,
|
|
655
|
+
diagnostic
|
|
656
|
+
} of diagnosed) {
|
|
657
|
+
if (diagnostic.state === "stale" || diagnostic.state === "orphaned-marker") {
|
|
658
|
+
results.push({ diagnostic, status: "requires-rebuild" });
|
|
659
|
+
continue;
|
|
660
|
+
}
|
|
661
|
+
try {
|
|
662
|
+
await ensureContributions(targetGraphId, [contribution], {
|
|
663
|
+
bypassCache: true
|
|
664
|
+
});
|
|
665
|
+
results.push({ diagnostic, status: "repaired" });
|
|
666
|
+
} catch (error) {
|
|
667
|
+
results.push({
|
|
668
|
+
diagnostic,
|
|
669
|
+
status: "failed",
|
|
670
|
+
error: error instanceof Error ? error.message : String(error)
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
return {
|
|
675
|
+
results,
|
|
676
|
+
remaining: await verifyContributions(graphId, vectorSlots)
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
async function lockContributionDdl(tx) {
|
|
680
|
+
if (dialect !== "postgres") return;
|
|
681
|
+
await tx.execute(
|
|
682
|
+
asCompiledRowsSql(
|
|
683
|
+
sql$1`SELECT pg_advisory_xact_lock(hashtext(${CONTRIBUTION_DDL_LOCK_KEY}), 0)`
|
|
684
|
+
)
|
|
685
|
+
);
|
|
686
|
+
}
|
|
687
|
+
async function lockSharedFulltextTable(tx, tableName) {
|
|
688
|
+
if (dialect !== "postgres") return;
|
|
689
|
+
await tx.executeStatement(
|
|
690
|
+
asCompiledStatementSql(
|
|
691
|
+
sql$1`LOCK TABLE ${sql$1.identifier(tableName)} IN ACCESS EXCLUSIVE MODE`
|
|
692
|
+
)
|
|
693
|
+
);
|
|
694
|
+
}
|
|
695
|
+
async function readForeignGraphIds(tx, tableName, graphId) {
|
|
696
|
+
const rows = await tx.execute(
|
|
697
|
+
asCompiledRowsSql(
|
|
698
|
+
buildForeignFulltextGraphProbe(
|
|
699
|
+
tableName,
|
|
700
|
+
graphId,
|
|
701
|
+
FOREIGN_GRAPH_REPORT_LIMIT
|
|
702
|
+
)
|
|
703
|
+
)
|
|
704
|
+
);
|
|
705
|
+
return rows.map((row) => String(row.graph_id));
|
|
706
|
+
}
|
|
707
|
+
async function rebuildContribution(graphId, scope, repopulate) {
|
|
708
|
+
if (scope === "vector") {
|
|
709
|
+
throw new ContributionRebuildUnsupportedError(
|
|
710
|
+
"vector-source-unavailable",
|
|
711
|
+
{ graphId, contribution: scope }
|
|
712
|
+
);
|
|
713
|
+
}
|
|
714
|
+
const contributions = runtimeContributions();
|
|
715
|
+
const withoutTeardown = contributions.find(
|
|
716
|
+
(contribution) => contribution.dropDdl === void 0
|
|
717
|
+
);
|
|
718
|
+
if (withoutTeardown !== void 0) {
|
|
719
|
+
throw new ContributionRebuildUnsupportedError("no-drop-ddl", {
|
|
720
|
+
graphId,
|
|
721
|
+
contribution: scope,
|
|
722
|
+
owner: withoutTeardown.owner,
|
|
723
|
+
logicalName: withoutTeardown.logicalName,
|
|
724
|
+
physicalName: withoutTeardown.tableName
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
const fence = deps.schemaWriteTransaction;
|
|
728
|
+
if (fence === void 0) {
|
|
729
|
+
throw new ContributionRebuildUnsupportedError("no-schema-fence", {
|
|
730
|
+
graphId,
|
|
731
|
+
contribution: scope,
|
|
732
|
+
backend: dialect
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
const stamps = await Promise.all(
|
|
736
|
+
contributions.map(async (contribution) => {
|
|
737
|
+
const key = contributionKey(graphId, contribution);
|
|
738
|
+
return {
|
|
739
|
+
contribution,
|
|
740
|
+
key,
|
|
741
|
+
signature: await resolveContributionSignature(key, contribution)
|
|
742
|
+
};
|
|
743
|
+
})
|
|
744
|
+
);
|
|
745
|
+
await deps.ensureMarkerTable();
|
|
746
|
+
const markers = indexMarkerRows(graphId, await deps.getMarkers(graphId));
|
|
747
|
+
const sharedTable = deps.fulltextTableName;
|
|
748
|
+
const sharedTableExisted = await deps.tableExists(sharedTable);
|
|
749
|
+
const rebuilt = await fence(graphId, async (tx) => {
|
|
750
|
+
const record = tx.recordContributionMaterialization;
|
|
751
|
+
if (record === void 0) {
|
|
752
|
+
throw new ConfigurationError(
|
|
753
|
+
"rebuildContribution requires a transaction-scoped backend that can write contribution markers; without it the drop, recreate, and stamp could not commit together.",
|
|
754
|
+
{
|
|
755
|
+
backend: dialect,
|
|
756
|
+
capability: "contributions",
|
|
757
|
+
operation: "rebuild"
|
|
758
|
+
}
|
|
759
|
+
);
|
|
760
|
+
}
|
|
761
|
+
await lockContributionDdl(tx);
|
|
762
|
+
const unlockedForeignGraphIds = sharedTableExisted ? await readForeignGraphIds(tx, sharedTable, graphId) : [];
|
|
763
|
+
const mayRecreate = sharedTableExisted && unlockedForeignGraphIds.length === 0;
|
|
764
|
+
if (mayRecreate) await lockSharedFulltextTable(tx, sharedTable);
|
|
765
|
+
const foreignGraphIds = mayRecreate ? await readForeignGraphIds(tx, sharedTable, graphId) : unlockedForeignGraphIds;
|
|
766
|
+
const recreateStorage = mayRecreate && foreignGraphIds.length === 0;
|
|
767
|
+
if (!recreateStorage) {
|
|
768
|
+
const staleStamp = stamps.find(
|
|
769
|
+
({ key, signature }) => diagnoseContribution(
|
|
770
|
+
markers.get(key),
|
|
771
|
+
signature,
|
|
772
|
+
sharedTableExisted
|
|
773
|
+
) === "stale"
|
|
774
|
+
);
|
|
775
|
+
if (staleStamp !== void 0) {
|
|
776
|
+
throw new ContributionRebuildUnsupportedError(
|
|
777
|
+
"shared-storage-in-use",
|
|
778
|
+
{
|
|
779
|
+
graphId,
|
|
780
|
+
contribution: scope,
|
|
781
|
+
owner: staleStamp.contribution.owner,
|
|
782
|
+
logicalName: staleStamp.contribution.logicalName,
|
|
783
|
+
physicalName: staleStamp.contribution.tableName,
|
|
784
|
+
otherGraphIds: foreignGraphIds
|
|
785
|
+
}
|
|
786
|
+
);
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
for (const { contribution } of stamps) {
|
|
790
|
+
if (recreateStorage) {
|
|
791
|
+
for (const statement of contribution.dropDdl ?? []) {
|
|
792
|
+
await tx.executeSchemaDdl(statement);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
for (const statement of contribution.createDdl) {
|
|
796
|
+
await tx.executeSchemaDdl(statement);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
if (!recreateStorage) {
|
|
800
|
+
await tx.executeStatement(
|
|
801
|
+
asCompiledStatementSql(
|
|
802
|
+
buildFulltextGraphDelete(sharedTable, graphId)
|
|
803
|
+
)
|
|
804
|
+
);
|
|
805
|
+
}
|
|
806
|
+
const stats = await repopulate(tx);
|
|
807
|
+
const now = nowIso();
|
|
808
|
+
for (const { contribution, signature } of stamps) {
|
|
809
|
+
await record({
|
|
810
|
+
...identityOf(graphId, contribution),
|
|
811
|
+
signature,
|
|
812
|
+
attemptedAt: now,
|
|
813
|
+
materializedAt: now,
|
|
814
|
+
error: void 0
|
|
527
815
|
});
|
|
528
816
|
}
|
|
817
|
+
return {
|
|
818
|
+
rebuilt: stamps.map(({ contribution }) => contribution.tableName),
|
|
819
|
+
processed: stats.processed,
|
|
820
|
+
repopulated: stats.repopulated,
|
|
821
|
+
skipped: stats.skipped
|
|
822
|
+
};
|
|
823
|
+
});
|
|
824
|
+
for (const { key, signature } of stamps) {
|
|
825
|
+
cacheInitializedSignature(key, signature);
|
|
529
826
|
}
|
|
530
|
-
return
|
|
827
|
+
return rebuilt;
|
|
531
828
|
}
|
|
532
829
|
function evictVectorSlot(slot) {
|
|
533
830
|
if (deps.vectorStrategy === void 0) return;
|
|
@@ -557,7 +854,10 @@ function createContributionMaterializer(deps) {
|
|
|
557
854
|
assertVectorSlots,
|
|
558
855
|
dropVectorSlot,
|
|
559
856
|
evictVectorSlot,
|
|
560
|
-
verifyContributions
|
|
857
|
+
verifyContributions,
|
|
858
|
+
repairContributions,
|
|
859
|
+
probeContributions,
|
|
860
|
+
rebuildContribution
|
|
561
861
|
};
|
|
562
862
|
}
|
|
563
863
|
var SQLITE_INDEX_MAT_TIMESTAMPS = {
|
|
@@ -664,6 +964,30 @@ function buildKindRemovalOnConflictSet(removedAtColumn, paramsRemovedAt) {
|
|
|
664
964
|
lastError: sql`excluded.${sql.identifier("last_error")}`
|
|
665
965
|
};
|
|
666
966
|
}
|
|
967
|
+
function primaryKeyConstraintNames(relation, keyColumns) {
|
|
968
|
+
return [`${relation}_pkey`, `${relation}_${keyColumns.join("_")}_pk`];
|
|
969
|
+
}
|
|
970
|
+
function nodePrimaryKeyConstraint(nodes) {
|
|
971
|
+
const relation = getTableName(nodes);
|
|
972
|
+
return {
|
|
973
|
+
table: relation,
|
|
974
|
+
constraintNames: primaryKeyConstraintNames(relation, [
|
|
975
|
+
nodes.graphId.name,
|
|
976
|
+
nodes.kind.name,
|
|
977
|
+
nodes.id.name
|
|
978
|
+
])
|
|
979
|
+
};
|
|
980
|
+
}
|
|
981
|
+
function edgePrimaryKeyConstraint(edges) {
|
|
982
|
+
const relation = getTableName(edges);
|
|
983
|
+
return {
|
|
984
|
+
table: relation,
|
|
985
|
+
constraintNames: primaryKeyConstraintNames(relation, [
|
|
986
|
+
edges.graphId.name,
|
|
987
|
+
edges.id.name
|
|
988
|
+
])
|
|
989
|
+
};
|
|
990
|
+
}
|
|
667
991
|
function sqlNull(value) {
|
|
668
992
|
return value ?? sql.raw("NULL");
|
|
669
993
|
}
|
|
@@ -671,6 +995,11 @@ function resolveValidFrom(validFrom, timestamp) {
|
|
|
671
995
|
if (validFrom === null) return void 0;
|
|
672
996
|
return validFrom ?? timestamp;
|
|
673
997
|
}
|
|
998
|
+
function expectedValidFromPredicate(column, expected) {
|
|
999
|
+
if (expected === void 0) return sql.empty();
|
|
1000
|
+
if (expected === null) return sql` AND ${column} IS NULL`;
|
|
1001
|
+
return sql` AND ${column} = ${expected}`;
|
|
1002
|
+
}
|
|
674
1003
|
function quotedColumn(column) {
|
|
675
1004
|
return sql.raw(`"${column.name.replaceAll('"', '""')}"`);
|
|
676
1005
|
}
|
|
@@ -803,9 +1132,16 @@ function mapHybridSearchRow(row, toNodeRow) {
|
|
|
803
1132
|
};
|
|
804
1133
|
}
|
|
805
1134
|
function buildClearGraph(tables, graphId) {
|
|
806
|
-
const fulltext = quotedTableName(tables.fulltextTableName);
|
|
807
1135
|
return [
|
|
808
|
-
|
|
1136
|
+
// The fulltext table is shared by every graph in the database, so its
|
|
1137
|
+
// graph-scoped delete is owned by one builder the destructive
|
|
1138
|
+
// contribution rebuild calls too — see `buildFulltextGraphDelete`.
|
|
1139
|
+
{ query: buildFulltextGraphDelete(tables.fulltextTableName, graphId) },
|
|
1140
|
+
{
|
|
1141
|
+
query: sql`DELETE FROM ${tables.recordedIdentityAssertions} WHERE ${tables.recordedIdentityAssertions.graphId} = ${graphId}`,
|
|
1142
|
+
ignoreMissingTable: true,
|
|
1143
|
+
requiredTableName: getTableName(tables.recordedIdentityAssertions)
|
|
1144
|
+
},
|
|
809
1145
|
{
|
|
810
1146
|
query: sql`DELETE FROM ${tables.recordedEdges} WHERE ${tables.recordedEdges.graphId} = ${graphId}`,
|
|
811
1147
|
ignoreMissingTable: true,
|
|
@@ -821,6 +1157,21 @@ function buildClearGraph(tables, graphId) {
|
|
|
821
1157
|
ignoreMissingTable: true,
|
|
822
1158
|
requiredTableName: getTableName(tables.recordedClock)
|
|
823
1159
|
},
|
|
1160
|
+
{
|
|
1161
|
+
query: sql`DELETE FROM ${tables.identitySeparation} WHERE ${tables.identitySeparation.graphId} = ${graphId}`,
|
|
1162
|
+
ignoreMissingTable: true,
|
|
1163
|
+
requiredTableName: getTableName(tables.identitySeparation)
|
|
1164
|
+
},
|
|
1165
|
+
{
|
|
1166
|
+
query: sql`DELETE FROM ${tables.identityClosure} WHERE ${tables.identityClosure.graphId} = ${graphId}`,
|
|
1167
|
+
ignoreMissingTable: true,
|
|
1168
|
+
requiredTableName: getTableName(tables.identityClosure)
|
|
1169
|
+
},
|
|
1170
|
+
{
|
|
1171
|
+
query: sql`DELETE FROM ${tables.identityAssertions} WHERE ${tables.identityAssertions.graphId} = ${graphId}`,
|
|
1172
|
+
ignoreMissingTable: true,
|
|
1173
|
+
requiredTableName: getTableName(tables.identityAssertions)
|
|
1174
|
+
},
|
|
824
1175
|
{
|
|
825
1176
|
query: sql`DELETE FROM ${tables.uniques} WHERE ${tables.uniques.graphId} = ${graphId}`
|
|
826
1177
|
},
|
|
@@ -1007,6 +1358,58 @@ function buildFindEdgesByEndpointSet(tables, params, endpointIds) {
|
|
|
1007
1358
|
ORDER BY ${derivedOrderByClause}
|
|
1008
1359
|
`;
|
|
1009
1360
|
}
|
|
1361
|
+
function buildFindEdgesByHeterogeneousEndpointSet(tables, params, endpoints, edgeKinds) {
|
|
1362
|
+
const { edges } = tables;
|
|
1363
|
+
const fromSide = params.side === "from";
|
|
1364
|
+
const kindColumn = fromSide ? edges.fromKind : edges.toKind;
|
|
1365
|
+
const idColumn = fromSide ? edges.fromId : edges.toId;
|
|
1366
|
+
const requestedKind = sql.raw(`requested_endpoints."endpoint_kind"`);
|
|
1367
|
+
const requestedId = sql.raw(`requested_endpoints."endpoint_id"`);
|
|
1368
|
+
const requestedRows = sql.join(
|
|
1369
|
+
endpoints.map((endpoint) => sql`(${endpoint.kind}, ${endpoint.id})`),
|
|
1370
|
+
sql`, `
|
|
1371
|
+
);
|
|
1372
|
+
const whereClause = sql.join(
|
|
1373
|
+
[
|
|
1374
|
+
sql`${edges.graphId} = ${params.graphId}`,
|
|
1375
|
+
buildIdSetCondition(edges.kind, edgeKinds),
|
|
1376
|
+
...buildTemporalConditions(edges, params)
|
|
1377
|
+
],
|
|
1378
|
+
sql` AND `
|
|
1379
|
+
);
|
|
1380
|
+
const joinClause = sql`
|
|
1381
|
+
FROM ${edges}
|
|
1382
|
+
INNER JOIN requested_endpoints
|
|
1383
|
+
ON ${kindColumn} = ${requestedKind}
|
|
1384
|
+
AND ${idColumn} = ${requestedId}
|
|
1385
|
+
WHERE ${whereClause}
|
|
1386
|
+
`;
|
|
1387
|
+
const { qualified: orderByClause, bare: derivedOrderByClause } = buildEdgeOrdering(tables, void 0);
|
|
1388
|
+
if (params.limitPerEndpoint === void 0) {
|
|
1389
|
+
return sql`
|
|
1390
|
+
WITH requested_endpoints(endpoint_kind, endpoint_id) AS (
|
|
1391
|
+
VALUES ${requestedRows}
|
|
1392
|
+
)
|
|
1393
|
+
SELECT ${edges}.*
|
|
1394
|
+
${joinClause}
|
|
1395
|
+
ORDER BY ${orderByClause}
|
|
1396
|
+
`;
|
|
1397
|
+
}
|
|
1398
|
+
const ranked = sql`
|
|
1399
|
+
SELECT ${edges}.*, ROW_NUMBER() OVER (
|
|
1400
|
+
PARTITION BY ${kindColumn}, ${idColumn} ORDER BY ${orderByClause}
|
|
1401
|
+
) AS endpoint_rank
|
|
1402
|
+
${joinClause}
|
|
1403
|
+
`;
|
|
1404
|
+
return sql`
|
|
1405
|
+
WITH requested_endpoints(endpoint_kind, endpoint_id) AS (
|
|
1406
|
+
VALUES ${requestedRows}
|
|
1407
|
+
)
|
|
1408
|
+
SELECT * FROM (${ranked}) AS ranked_edges
|
|
1409
|
+
WHERE endpoint_rank <= ${params.limitPerEndpoint}
|
|
1410
|
+
ORDER BY ${derivedOrderByClause}
|
|
1411
|
+
`;
|
|
1412
|
+
}
|
|
1010
1413
|
function buildCountEdgesByKind(tables, params) {
|
|
1011
1414
|
const { edges } = tables;
|
|
1012
1415
|
const conditions = [
|
|
@@ -1105,6 +1508,17 @@ function buildGetEdges(tables, graphId, ids) {
|
|
|
1105
1508
|
)})
|
|
1106
1509
|
`;
|
|
1107
1510
|
}
|
|
1511
|
+
function expectedIdentityPredicate(tables, expected) {
|
|
1512
|
+
const { edges } = tables;
|
|
1513
|
+
const parts = [
|
|
1514
|
+
expected.kind === void 0 ? void 0 : sql` AND ${edges.kind} = ${expected.kind}`,
|
|
1515
|
+
expected.fromKind === void 0 ? void 0 : sql` AND ${edges.fromKind} = ${expected.fromKind}`,
|
|
1516
|
+
expected.fromId === void 0 ? void 0 : sql` AND ${edges.fromId} = ${expected.fromId}`,
|
|
1517
|
+
expected.toKind === void 0 ? void 0 : sql` AND ${edges.toKind} = ${expected.toKind}`,
|
|
1518
|
+
expected.toId === void 0 ? void 0 : sql` AND ${edges.toId} = ${expected.toId}`
|
|
1519
|
+
].filter((part) => part !== void 0);
|
|
1520
|
+
return parts.length === 0 ? sql.empty() : sql.join(parts, sql``);
|
|
1521
|
+
}
|
|
1108
1522
|
function buildUpdateEdge(tables, params, timestamp) {
|
|
1109
1523
|
const { edges } = tables;
|
|
1110
1524
|
const propsJson = JSON.stringify(params.props);
|
|
@@ -1112,19 +1526,29 @@ function buildUpdateEdge(tables, params, timestamp) {
|
|
|
1112
1526
|
sql`${quotedColumn(edges.props)} = ${propsJson}`,
|
|
1113
1527
|
sql`${quotedColumn(edges.updatedAt)} = ${timestamp}`
|
|
1114
1528
|
];
|
|
1115
|
-
if (params.
|
|
1529
|
+
if (params.clearDeleted && params.validFrom !== void 0) {
|
|
1530
|
+
setParts.push(
|
|
1531
|
+
sql`${quotedColumn(edges.validFrom)} = ${sqlNull(resolveValidFrom(params.validFrom, timestamp))}`,
|
|
1532
|
+
sql`${quotedColumn(edges.validTo)} = ${sqlNull(params.validTo)}`
|
|
1533
|
+
);
|
|
1534
|
+
} else if (params.validTo !== void 0) {
|
|
1116
1535
|
setParts.push(sql`${quotedColumn(edges.validTo)} = ${params.validTo}`);
|
|
1117
1536
|
}
|
|
1118
1537
|
if (params.clearDeleted) {
|
|
1119
1538
|
setParts.push(sql`${quotedColumn(edges.deletedAt)} = NULL`);
|
|
1120
1539
|
}
|
|
1121
1540
|
const setClause = sql.join(setParts, sql`, `);
|
|
1541
|
+
const expectedIdentity = expectedIdentityPredicate(tables, params);
|
|
1542
|
+
const expectedValidFrom = expectedValidFromPredicate(
|
|
1543
|
+
edges.validFrom,
|
|
1544
|
+
params.expectedValidFrom
|
|
1545
|
+
);
|
|
1122
1546
|
if (params.clearDeleted) {
|
|
1123
1547
|
return sql`
|
|
1124
1548
|
UPDATE ${edges}
|
|
1125
1549
|
SET ${setClause}
|
|
1126
1550
|
WHERE ${edges.graphId} = ${params.graphId}
|
|
1127
|
-
AND ${edges.id} = ${params.id}
|
|
1551
|
+
AND ${edges.id} = ${params.id}${expectedIdentity}${expectedValidFrom}
|
|
1128
1552
|
RETURNING *
|
|
1129
1553
|
`;
|
|
1130
1554
|
}
|
|
@@ -1132,7 +1556,7 @@ function buildUpdateEdge(tables, params, timestamp) {
|
|
|
1132
1556
|
UPDATE ${edges}
|
|
1133
1557
|
SET ${setClause}
|
|
1134
1558
|
WHERE ${edges.graphId} = ${params.graphId}
|
|
1135
|
-
AND ${edges.id} = ${params.id}
|
|
1559
|
+
AND ${edges.id} = ${params.id}${expectedIdentity}${expectedValidFrom}
|
|
1136
1560
|
AND ${edges.deletedAt} IS NULL
|
|
1137
1561
|
RETURNING *
|
|
1138
1562
|
`;
|
|
@@ -1143,7 +1567,7 @@ function buildDeleteEdge(tables, params, timestamp) {
|
|
|
1143
1567
|
UPDATE ${edges}
|
|
1144
1568
|
SET ${quotedColumn(edges.deletedAt)} = ${timestamp}
|
|
1145
1569
|
WHERE ${edges.graphId} = ${params.graphId}
|
|
1146
|
-
AND ${edges.id} = ${params.id}
|
|
1570
|
+
AND ${edges.id} = ${params.id}${expectedIdentityPredicate(tables, params.kind === void 0 ? {} : { kind: params.kind })}
|
|
1147
1571
|
AND ${edges.deletedAt} IS NULL
|
|
1148
1572
|
`;
|
|
1149
1573
|
}
|
|
@@ -1176,7 +1600,7 @@ function buildHardDeleteEdge(tables, params) {
|
|
|
1176
1600
|
return sql`
|
|
1177
1601
|
DELETE FROM ${edges}
|
|
1178
1602
|
WHERE ${edges.graphId} = ${params.graphId}
|
|
1179
|
-
AND ${edges.id} = ${params.id}
|
|
1603
|
+
AND ${edges.id} = ${params.id}${expectedIdentityPredicate(tables, params.kind === void 0 ? {} : { kind: params.kind })}
|
|
1180
1604
|
`;
|
|
1181
1605
|
}
|
|
1182
1606
|
function buildHardDeleteEdgesByNode(tables, graphId, nodeKind, nodeId) {
|
|
@@ -1389,20 +1813,30 @@ function buildUpdateNode(tables, params, timestamp) {
|
|
|
1389
1813
|
sql`${quotedColumn(nodes.version)} = ${quotedColumn(nodes.version)} + 1`
|
|
1390
1814
|
);
|
|
1391
1815
|
}
|
|
1392
|
-
if (params.
|
|
1816
|
+
if (params.clearDeleted) {
|
|
1817
|
+
setParts.push(
|
|
1818
|
+
sql`${quotedColumn(nodes.validFrom)} = ${sqlNull(resolveValidFrom(params.validFrom, timestamp))}`,
|
|
1819
|
+
sql`${quotedColumn(nodes.validTo)} = ${sqlNull(params.validTo)}`
|
|
1820
|
+
);
|
|
1821
|
+
} else if (params.validTo !== void 0) {
|
|
1393
1822
|
setParts.push(sql`${quotedColumn(nodes.validTo)} = ${params.validTo}`);
|
|
1394
1823
|
}
|
|
1395
1824
|
if (params.clearDeleted) {
|
|
1396
1825
|
setParts.push(sql`${quotedColumn(nodes.deletedAt)} = NULL`);
|
|
1397
1826
|
}
|
|
1398
1827
|
const setClause = sql.join(setParts, sql`, `);
|
|
1828
|
+
const expectedValidFrom = expectedValidFromPredicate(
|
|
1829
|
+
nodes.validFrom,
|
|
1830
|
+
params.expectedValidFrom
|
|
1831
|
+
);
|
|
1399
1832
|
if (params.clearDeleted) {
|
|
1400
1833
|
return sql`
|
|
1401
1834
|
UPDATE ${nodes}
|
|
1402
1835
|
SET ${setClause}
|
|
1403
1836
|
WHERE ${nodes.graphId} = ${params.graphId}
|
|
1404
1837
|
AND ${nodes.kind} = ${params.kind}
|
|
1405
|
-
AND ${nodes.id} = ${params.id}
|
|
1838
|
+
AND ${nodes.id} = ${params.id}${expectedValidFrom}
|
|
1839
|
+
AND ${nodes.deletedAt} IS NOT NULL
|
|
1406
1840
|
RETURNING *
|
|
1407
1841
|
`;
|
|
1408
1842
|
}
|
|
@@ -1411,11 +1845,42 @@ function buildUpdateNode(tables, params, timestamp) {
|
|
|
1411
1845
|
SET ${setClause}
|
|
1412
1846
|
WHERE ${nodes.graphId} = ${params.graphId}
|
|
1413
1847
|
AND ${nodes.kind} = ${params.kind}
|
|
1414
|
-
AND ${nodes.id} = ${params.id}
|
|
1848
|
+
AND ${nodes.id} = ${params.id}${expectedValidFrom}
|
|
1415
1849
|
AND ${nodes.deletedAt} IS NULL
|
|
1416
1850
|
RETURNING *
|
|
1417
1851
|
`;
|
|
1418
1852
|
}
|
|
1853
|
+
function buildUpdateNodeSet(tables, dialect, params, timestamp) {
|
|
1854
|
+
const { nodes } = tables;
|
|
1855
|
+
const adapter = getDialect(dialect);
|
|
1856
|
+
const patchedProps = toDrizzleSql(
|
|
1857
|
+
adapter.jsonSetProperties(
|
|
1858
|
+
sql$1.identifier(nodes.props.name),
|
|
1859
|
+
params.patch,
|
|
1860
|
+
params.unsetProperties ?? []
|
|
1861
|
+
),
|
|
1862
|
+
dialect
|
|
1863
|
+
);
|
|
1864
|
+
const candidateIds = toDrizzleSql(params.candidateIds, dialect);
|
|
1865
|
+
const candidateIdColumn = toDrizzleSql(
|
|
1866
|
+
sql$1.identifier(params.candidateIdColumn),
|
|
1867
|
+
dialect
|
|
1868
|
+
);
|
|
1869
|
+
return sql`
|
|
1870
|
+
UPDATE ${nodes}
|
|
1871
|
+
SET ${quotedColumn(nodes.props)} = ${patchedProps},
|
|
1872
|
+
${quotedColumn(nodes.updatedAt)} = ${timestamp},
|
|
1873
|
+
${quotedColumn(nodes.version)} = ${quotedColumn(nodes.version)} + 1
|
|
1874
|
+
WHERE ${nodes.graphId} = ${params.graphId}
|
|
1875
|
+
AND ${nodes.kind} = ${params.kind}
|
|
1876
|
+
AND ${nodes.deletedAt} IS NULL
|
|
1877
|
+
AND ${nodes.id} IN (
|
|
1878
|
+
SELECT ${candidateIdColumn}
|
|
1879
|
+
FROM (${candidateIds}) AS tg_set_candidates
|
|
1880
|
+
)
|
|
1881
|
+
RETURNING *
|
|
1882
|
+
`;
|
|
1883
|
+
}
|
|
1419
1884
|
function buildDeleteNode(tables, params, timestamp) {
|
|
1420
1885
|
const { nodes } = tables;
|
|
1421
1886
|
return sql`
|
|
@@ -1651,12 +2116,23 @@ function buildDeleteUnique(tables, params, timestamp) {
|
|
|
1651
2116
|
AND ${uniques.deletedAt} IS NULL
|
|
1652
2117
|
`;
|
|
1653
2118
|
}
|
|
1654
|
-
function buildHardDeleteUniquesByNode(tables, graphId, nodeId) {
|
|
2119
|
+
function buildHardDeleteUniquesByNode(tables, graphId, concreteKind, nodeId) {
|
|
2120
|
+
return buildHardDeleteUniquesByNodeIds(tables, {
|
|
2121
|
+
graphId,
|
|
2122
|
+
concreteKind,
|
|
2123
|
+
nodeIds: [nodeId]
|
|
2124
|
+
});
|
|
2125
|
+
}
|
|
2126
|
+
function buildHardDeleteUniquesByNodeIds(tables, params) {
|
|
1655
2127
|
const { uniques } = tables;
|
|
1656
2128
|
return sql`
|
|
1657
2129
|
DELETE FROM ${uniques}
|
|
1658
|
-
WHERE ${uniques.graphId} = ${graphId}
|
|
1659
|
-
AND ${uniques.
|
|
2130
|
+
WHERE ${uniques.graphId} = ${params.graphId}
|
|
2131
|
+
AND ${uniques.concreteKind} = ${params.concreteKind}
|
|
2132
|
+
AND ${uniques.nodeId} IN (${sql.join(
|
|
2133
|
+
params.nodeIds.map((nodeId) => sql`${nodeId}`),
|
|
2134
|
+
sql`, `
|
|
2135
|
+
)})
|
|
1660
2136
|
`;
|
|
1661
2137
|
}
|
|
1662
2138
|
function buildCheckUnique(tables, params) {
|
|
@@ -1705,6 +2181,9 @@ function buildCheckUniqueBatch(tables, params) {
|
|
|
1705
2181
|
}
|
|
1706
2182
|
|
|
1707
2183
|
// src/backend/drizzle/operations/strategy.ts
|
|
2184
|
+
function nullableText(value) {
|
|
2185
|
+
return value === void 0 ? sql`NULL` : sql`${value}`;
|
|
2186
|
+
}
|
|
1708
2187
|
function bindTableOperationBuilders(tables, builders) {
|
|
1709
2188
|
const boundEntries = Object.entries(builders).map(([name, builder]) => {
|
|
1710
2189
|
function boundBuilder(...args) {
|
|
@@ -1745,9 +2224,11 @@ var COMMON_TABLE_OPERATION_BUILDERS = {
|
|
|
1745
2224
|
buildCountNodesByKind,
|
|
1746
2225
|
buildFindEdgesByKind,
|
|
1747
2226
|
buildFindEdgesByEndpointSet,
|
|
2227
|
+
buildFindEdgesByHeterogeneousEndpointSet,
|
|
1748
2228
|
buildCountEdgesByKind,
|
|
1749
2229
|
buildDeleteUnique,
|
|
1750
2230
|
buildHardDeleteUniquesByNode,
|
|
2231
|
+
buildHardDeleteUniquesByNodeIds,
|
|
1751
2232
|
buildCheckUnique,
|
|
1752
2233
|
buildCheckUniqueBatch,
|
|
1753
2234
|
buildGetSchemaVersion
|
|
@@ -1825,6 +2306,24 @@ function createCommonOperationStrategy(tables, dialect, fulltextStrategy) {
|
|
|
1825
2306
|
});
|
|
1826
2307
|
}
|
|
1827
2308
|
};
|
|
2309
|
+
function buildInsertContributionMaterialization(params) {
|
|
2310
|
+
return sql`
|
|
2311
|
+
INSERT INTO ${contributionMaterializations}
|
|
2312
|
+
(graph_id, logical_name, owner, table_name, signature,
|
|
2313
|
+
materialized_at, last_attempted_at, last_error)
|
|
2314
|
+
VALUES (
|
|
2315
|
+
${params.graphId}, ${params.logicalName}, ${params.owner},
|
|
2316
|
+
${params.tableName}, ${params.signature},
|
|
2317
|
+
${nullableText(params.materializedAt)}, ${params.attemptedAt},
|
|
2318
|
+
${nullableText(params.error)}
|
|
2319
|
+
)
|
|
2320
|
+
ON CONFLICT (graph_id, logical_name, owner, table_name) DO UPDATE SET
|
|
2321
|
+
signature = excluded.signature,
|
|
2322
|
+
materialized_at = excluded.materialized_at,
|
|
2323
|
+
last_attempted_at = excluded.last_attempted_at,
|
|
2324
|
+
last_error = excluded.last_error
|
|
2325
|
+
`;
|
|
2326
|
+
}
|
|
1828
2327
|
function buildDeleteContributionMaterialization(identity) {
|
|
1829
2328
|
return sql`
|
|
1830
2329
|
DELETE FROM ${contributionMaterializations}
|
|
@@ -1837,7 +2336,15 @@ function createCommonOperationStrategy(tables, dialect, fulltextStrategy) {
|
|
|
1837
2336
|
return {
|
|
1838
2337
|
...tableOperations,
|
|
1839
2338
|
...fulltextBuilders,
|
|
2339
|
+
primaryKeyConstraints: {
|
|
2340
|
+
nodes: nodePrimaryKeyConstraint(tables.nodes),
|
|
2341
|
+
edges: edgePrimaryKeyConstraint(tables.edges)
|
|
2342
|
+
},
|
|
2343
|
+
buildUpdateNodeSet(params, timestamp) {
|
|
2344
|
+
return buildUpdateNodeSet(tables, dialect, params, timestamp);
|
|
2345
|
+
},
|
|
1840
2346
|
buildDeleteContributionMaterialization,
|
|
2347
|
+
buildInsertContributionMaterialization,
|
|
1841
2348
|
buildInsertUnique(params) {
|
|
1842
2349
|
return buildInsertUnique(tables, dialect, params);
|
|
1843
2350
|
},
|
|
@@ -1918,6 +2425,26 @@ function assertAdoptedDialect(externalTx, brand, backend) {
|
|
|
1918
2425
|
{ backend, capability: "adoptTransaction" }
|
|
1919
2426
|
);
|
|
1920
2427
|
}
|
|
2428
|
+
async function withDuplicateKeyClassification(run, context) {
|
|
2429
|
+
try {
|
|
2430
|
+
return await run();
|
|
2431
|
+
} catch (error) {
|
|
2432
|
+
if (!isDuplicatePrimaryKeyError(error, context.relation)) throw error;
|
|
2433
|
+
throw new DatabaseOperationError(
|
|
2434
|
+
`Insert ${context.entity} failed: a row with this identity already exists`,
|
|
2435
|
+
{
|
|
2436
|
+
operation: "insert",
|
|
2437
|
+
entity: context.entity,
|
|
2438
|
+
reason: "duplicate_key",
|
|
2439
|
+
attempted: context.attempted
|
|
2440
|
+
},
|
|
2441
|
+
{ cause: error }
|
|
2442
|
+
);
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
function attemptedInserts(params) {
|
|
2446
|
+
return params.map((item) => ({ kind: item.kind, id: item.id }));
|
|
2447
|
+
}
|
|
1921
2448
|
function verifyExpectedActiveVersion(graphId, expected, actualActiveVersion) {
|
|
1922
2449
|
const expectedVersion = expected.kind === "active" ? expected.version : 0;
|
|
1923
2450
|
assertActiveSchemaVersion(graphId, expectedVersion, actualActiveVersion);
|
|
@@ -1967,7 +2494,13 @@ async function commitSchemaVersionIfKindsEmpty(backend, params, probes) {
|
|
|
1967
2494
|
};
|
|
1968
2495
|
}
|
|
1969
2496
|
function createCommonOperationBackend(options) {
|
|
1970
|
-
const {
|
|
2497
|
+
const {
|
|
2498
|
+
batchConfig,
|
|
2499
|
+
execution,
|
|
2500
|
+
maxBindParameters,
|
|
2501
|
+
operationStrategy,
|
|
2502
|
+
rowMappers
|
|
2503
|
+
} = options;
|
|
1971
2504
|
const nowIso2 = options.nowIso ?? nowIso;
|
|
1972
2505
|
const tableExists = createCachedTableExistence(
|
|
1973
2506
|
(tableName) => execution.execGet(
|
|
@@ -2001,11 +2534,22 @@ function createCommonOperationBackend(options) {
|
|
|
2001
2534
|
async insertNode(params) {
|
|
2002
2535
|
const timestamp = nowIso2();
|
|
2003
2536
|
const query = operationStrategy.buildInsertNode(params, timestamp);
|
|
2004
|
-
const row = await
|
|
2537
|
+
const row = await withDuplicateKeyClassification(
|
|
2538
|
+
() => execution.execGet(query),
|
|
2539
|
+
{
|
|
2540
|
+
entity: "node",
|
|
2541
|
+
relation: operationStrategy.primaryKeyConstraints.nodes,
|
|
2542
|
+
attempted: attemptedInserts([params])
|
|
2543
|
+
}
|
|
2544
|
+
);
|
|
2005
2545
|
if (!row)
|
|
2006
2546
|
throw new DatabaseOperationError(
|
|
2007
2547
|
"Insert node failed: no row returned",
|
|
2008
|
-
{
|
|
2548
|
+
{
|
|
2549
|
+
operation: "insert",
|
|
2550
|
+
entity: "node",
|
|
2551
|
+
reason: "no_row_returned"
|
|
2552
|
+
}
|
|
2009
2553
|
);
|
|
2010
2554
|
return rowMappers.toNodeRow(row);
|
|
2011
2555
|
},
|
|
@@ -2015,7 +2559,11 @@ function createCommonOperationBackend(options) {
|
|
|
2015
2559
|
params,
|
|
2016
2560
|
timestamp
|
|
2017
2561
|
);
|
|
2018
|
-
await execution.execRun(query)
|
|
2562
|
+
await withDuplicateKeyClassification(() => execution.execRun(query), {
|
|
2563
|
+
entity: "node",
|
|
2564
|
+
relation: operationStrategy.primaryKeyConstraints.nodes,
|
|
2565
|
+
attempted: attemptedInserts([params])
|
|
2566
|
+
});
|
|
2019
2567
|
},
|
|
2020
2568
|
async insertNodesBatch(params) {
|
|
2021
2569
|
if (params.length === 0) {
|
|
@@ -2024,7 +2572,11 @@ function createCommonOperationBackend(options) {
|
|
|
2024
2572
|
const timestamp = nowIso2();
|
|
2025
2573
|
for (const chunk2 of chunk(params, batchConfig.nodeInsertBatchSize)) {
|
|
2026
2574
|
const query = operationStrategy.buildInsertNodesBatch(chunk2, timestamp);
|
|
2027
|
-
await execution.execRun(query)
|
|
2575
|
+
await withDuplicateKeyClassification(() => execution.execRun(query), {
|
|
2576
|
+
entity: "node",
|
|
2577
|
+
relation: operationStrategy.primaryKeyConstraints.nodes,
|
|
2578
|
+
attempted: attemptedInserts(chunk2)
|
|
2579
|
+
});
|
|
2028
2580
|
}
|
|
2029
2581
|
},
|
|
2030
2582
|
async insertNodesBatchReturning(params) {
|
|
@@ -2038,7 +2590,14 @@ function createCommonOperationBackend(options) {
|
|
|
2038
2590
|
chunk2,
|
|
2039
2591
|
timestamp
|
|
2040
2592
|
);
|
|
2041
|
-
const rows = await
|
|
2593
|
+
const rows = await withDuplicateKeyClassification(
|
|
2594
|
+
() => execution.execAll(query),
|
|
2595
|
+
{
|
|
2596
|
+
entity: "node",
|
|
2597
|
+
relation: operationStrategy.primaryKeyConstraints.nodes,
|
|
2598
|
+
attempted: attemptedInserts(chunk2)
|
|
2599
|
+
}
|
|
2600
|
+
);
|
|
2042
2601
|
allRows.push(...rows.map((row) => rowMappers.toNodeRow(row)));
|
|
2043
2602
|
}
|
|
2044
2603
|
return allRows;
|
|
@@ -2065,10 +2624,33 @@ function createCommonOperationBackend(options) {
|
|
|
2065
2624
|
if (!row)
|
|
2066
2625
|
throw new DatabaseOperationError(
|
|
2067
2626
|
"Update node failed: no row returned",
|
|
2068
|
-
{
|
|
2627
|
+
{
|
|
2628
|
+
operation: "update",
|
|
2629
|
+
entity: "node",
|
|
2630
|
+
reason: "no_row_returned"
|
|
2631
|
+
}
|
|
2069
2632
|
);
|
|
2070
2633
|
return rowMappers.toNodeRow(row);
|
|
2071
2634
|
},
|
|
2635
|
+
async updateNodeSet(params) {
|
|
2636
|
+
if (Object.keys(params.patch).length === 0 && (params.unsetProperties?.length ?? 0) === 0) {
|
|
2637
|
+
throw new ConfigurationError(
|
|
2638
|
+
"Set-based node update requires at least one property",
|
|
2639
|
+
{ operation: "updateNodeSet", kind: params.kind }
|
|
2640
|
+
);
|
|
2641
|
+
}
|
|
2642
|
+
if (params.candidateIdColumn.length === 0) {
|
|
2643
|
+
throw new ConfigurationError(
|
|
2644
|
+
"Set-based node update requires a candidate id column",
|
|
2645
|
+
{ operation: "updateNodeSet", kind: params.kind }
|
|
2646
|
+
);
|
|
2647
|
+
}
|
|
2648
|
+
const timestamp = nowIso2();
|
|
2649
|
+
const query = operationStrategy.buildUpdateNodeSet(params, timestamp);
|
|
2650
|
+
const rows = await execution.execAll(query);
|
|
2651
|
+
const updatedRows = rows.map((row) => rowMappers.toNodeRow(row));
|
|
2652
|
+
return { affectedCount: updatedRows.length, rows: updatedRows };
|
|
2653
|
+
},
|
|
2072
2654
|
async deleteNode(params) {
|
|
2073
2655
|
const timestamp = nowIso2();
|
|
2074
2656
|
const query = operationStrategy.buildDeleteNode(params, timestamp);
|
|
@@ -2086,6 +2668,7 @@ function createCommonOperationBackend(options) {
|
|
|
2086
2668
|
async hardDeleteNode(params) {
|
|
2087
2669
|
const deleteUniquesQuery = operationStrategy.buildHardDeleteUniquesByNode(
|
|
2088
2670
|
params.graphId,
|
|
2671
|
+
params.kind,
|
|
2089
2672
|
params.id
|
|
2090
2673
|
);
|
|
2091
2674
|
await execution.execRun(deleteUniquesQuery);
|
|
@@ -2109,11 +2692,22 @@ function createCommonOperationBackend(options) {
|
|
|
2109
2692
|
async insertEdge(params) {
|
|
2110
2693
|
const timestamp = nowIso2();
|
|
2111
2694
|
const query = operationStrategy.buildInsertEdge(params, timestamp);
|
|
2112
|
-
const row = await
|
|
2695
|
+
const row = await withDuplicateKeyClassification(
|
|
2696
|
+
() => execution.execGet(query),
|
|
2697
|
+
{
|
|
2698
|
+
entity: "edge",
|
|
2699
|
+
relation: operationStrategy.primaryKeyConstraints.edges,
|
|
2700
|
+
attempted: attemptedInserts([params])
|
|
2701
|
+
}
|
|
2702
|
+
);
|
|
2113
2703
|
if (!row)
|
|
2114
2704
|
throw new DatabaseOperationError(
|
|
2115
2705
|
"Insert edge failed: no row returned",
|
|
2116
|
-
{
|
|
2706
|
+
{
|
|
2707
|
+
operation: "insert",
|
|
2708
|
+
entity: "edge",
|
|
2709
|
+
reason: "no_row_returned"
|
|
2710
|
+
}
|
|
2117
2711
|
);
|
|
2118
2712
|
return rowMappers.toEdgeRow(row);
|
|
2119
2713
|
},
|
|
@@ -2123,7 +2717,11 @@ function createCommonOperationBackend(options) {
|
|
|
2123
2717
|
params,
|
|
2124
2718
|
timestamp
|
|
2125
2719
|
);
|
|
2126
|
-
await execution.execRun(query)
|
|
2720
|
+
await withDuplicateKeyClassification(() => execution.execRun(query), {
|
|
2721
|
+
entity: "edge",
|
|
2722
|
+
relation: operationStrategy.primaryKeyConstraints.edges,
|
|
2723
|
+
attempted: attemptedInserts([params])
|
|
2724
|
+
});
|
|
2127
2725
|
},
|
|
2128
2726
|
async insertEdgesBatch(params) {
|
|
2129
2727
|
if (params.length === 0) {
|
|
@@ -2132,7 +2730,11 @@ function createCommonOperationBackend(options) {
|
|
|
2132
2730
|
const timestamp = nowIso2();
|
|
2133
2731
|
for (const chunk2 of chunk(params, batchConfig.edgeInsertBatchSize)) {
|
|
2134
2732
|
const query = operationStrategy.buildInsertEdgesBatch(chunk2, timestamp);
|
|
2135
|
-
await execution.execRun(query)
|
|
2733
|
+
await withDuplicateKeyClassification(() => execution.execRun(query), {
|
|
2734
|
+
entity: "edge",
|
|
2735
|
+
relation: operationStrategy.primaryKeyConstraints.edges,
|
|
2736
|
+
attempted: attemptedInserts(chunk2)
|
|
2737
|
+
});
|
|
2136
2738
|
}
|
|
2137
2739
|
},
|
|
2138
2740
|
async insertEdgesBatchReturning(params) {
|
|
@@ -2146,7 +2748,14 @@ function createCommonOperationBackend(options) {
|
|
|
2146
2748
|
chunk2,
|
|
2147
2749
|
timestamp
|
|
2148
2750
|
);
|
|
2149
|
-
const rows = await
|
|
2751
|
+
const rows = await withDuplicateKeyClassification(
|
|
2752
|
+
() => execution.execAll(query),
|
|
2753
|
+
{
|
|
2754
|
+
entity: "edge",
|
|
2755
|
+
relation: operationStrategy.primaryKeyConstraints.edges,
|
|
2756
|
+
attempted: attemptedInserts(chunk2)
|
|
2757
|
+
}
|
|
2758
|
+
);
|
|
2150
2759
|
allRows.push(...rows.map((row) => rowMappers.toEdgeRow(row)));
|
|
2151
2760
|
}
|
|
2152
2761
|
return allRows;
|
|
@@ -2173,7 +2782,11 @@ function createCommonOperationBackend(options) {
|
|
|
2173
2782
|
if (!row)
|
|
2174
2783
|
throw new DatabaseOperationError(
|
|
2175
2784
|
"Update edge failed: no row returned",
|
|
2176
|
-
{
|
|
2785
|
+
{
|
|
2786
|
+
operation: "update",
|
|
2787
|
+
entity: "edge",
|
|
2788
|
+
reason: "no_row_returned"
|
|
2789
|
+
}
|
|
2177
2790
|
);
|
|
2178
2791
|
return rowMappers.toEdgeRow(row);
|
|
2179
2792
|
},
|
|
@@ -2260,6 +2873,21 @@ function createCommonOperationBackend(options) {
|
|
|
2260
2873
|
}
|
|
2261
2874
|
return edgeRows;
|
|
2262
2875
|
},
|
|
2876
|
+
async findEdgesByHeterogeneousEndpointSet(params) {
|
|
2877
|
+
const { edgeKinds, endpoints, endpointChunkSize } = resolveHeterogeneousEdgeRead(params, maxBindParameters);
|
|
2878
|
+
if (edgeKinds.length === 0 || endpoints.length === 0) return [];
|
|
2879
|
+
const edgeRows = [];
|
|
2880
|
+
for (const endpointChunk of chunk(endpoints, endpointChunkSize)) {
|
|
2881
|
+
const query = operationStrategy.buildFindEdgesByHeterogeneousEndpointSet(
|
|
2882
|
+
params,
|
|
2883
|
+
endpointChunk,
|
|
2884
|
+
edgeKinds
|
|
2885
|
+
);
|
|
2886
|
+
const rows = await execution.execAll(query);
|
|
2887
|
+
for (const row of rows) edgeRows.push(rowMappers.toEdgeRow(row));
|
|
2888
|
+
}
|
|
2889
|
+
return edgeRows;
|
|
2890
|
+
},
|
|
2263
2891
|
async countEdgesByKind(params) {
|
|
2264
2892
|
const query = operationStrategy.buildCountEdgesByKind(params);
|
|
2265
2893
|
const row = await execution.execGet(query);
|
|
@@ -2330,6 +2958,19 @@ function createCommonOperationBackend(options) {
|
|
|
2330
2958
|
const query = operationStrategy.buildDeleteUnique(params, timestamp);
|
|
2331
2959
|
await execution.execRun(query);
|
|
2332
2960
|
},
|
|
2961
|
+
async hardDeleteUniquesByNodeIds(params) {
|
|
2962
|
+
const nodeIds = [...new Set(params.nodeIds)];
|
|
2963
|
+
for (const chunk2 of chunk(
|
|
2964
|
+
nodeIds,
|
|
2965
|
+
batchConfig.uniqueDeleteChunkSize
|
|
2966
|
+
)) {
|
|
2967
|
+
const query = operationStrategy.buildHardDeleteUniquesByNodeIds({
|
|
2968
|
+
...params,
|
|
2969
|
+
nodeIds: chunk2
|
|
2970
|
+
});
|
|
2971
|
+
await execution.execRun(query);
|
|
2972
|
+
}
|
|
2973
|
+
},
|
|
2333
2974
|
async checkUnique(params) {
|
|
2334
2975
|
const query = operationStrategy.buildCheckUnique(params);
|
|
2335
2976
|
const row = await execution.execGet(query);
|
|
@@ -2730,6 +3371,6 @@ function getOrCreateLru(cache, key, cacheMax, create) {
|
|
|
2730
3371
|
return value;
|
|
2731
3372
|
}
|
|
2732
3373
|
|
|
2733
|
-
export { EMBEDDING_UPSERT_PARAM_COUNT, FIND_EDGES_ENDPOINT_FIXED_PARAM_COUNT, POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS, POSTGRES_INDEX_MAT_TIMESTAMPS, POSTGRES_KIND_REMOVAL_TIMESTAMPS, SQLITE_CONTRIBUTION_MAT_TIMESTAMPS, SQLITE_INDEX_MAT_TIMESTAMPS, SQLITE_KIND_REMOVAL_TIMESTAMPS, analyzeImportedTables, assertActiveSchemaVersion, assertAdoptedDialect, assertTrustedImportDatabaseEmpty, buildContributionInsertValues, buildContributionOnConflictSet, buildKindRemovalInsertValues, buildKindRemovalOnConflictSet, buildLiveNodeCandidates, buildMaterializationInsertValues, buildMaterializationOnConflictSet, commitSchemaVersionIfKindsEmpty, createCachedTableExistence, createCommonOperationBackend, createContributionMaterializer, createPostgresOperationStrategy, createPostgresTrustedImportSession, createSqliteOperationStrategy, createSqliteTrustedImportSession, gateFulltext, gateFulltextMethods, getOrCreateLru, lockPostgresTrustedImportTables, mapContributionMaterializationRow, mapHybridSearchRow, mapKindRemovalRow, mapMaterializationRow, mapVectorWriteError, restoreSecondaryIndexes, suspendPostgresSecondaryIndexes, suspendSqliteSecondaryIndexes, tableExistsFromRow, vectorSlotFromCreateIndexParams, vectorSlotFromDropIndexParams, vectorSlotFromParams };
|
|
2734
|
-
//# sourceMappingURL=chunk-
|
|
2735
|
-
//# sourceMappingURL=chunk-
|
|
3374
|
+
export { EMBEDDING_UPSERT_PARAM_COUNT, FIND_EDGES_ENDPOINT_FIXED_PARAM_COUNT, POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS, POSTGRES_INDEX_MAT_TIMESTAMPS, POSTGRES_KIND_REMOVAL_TIMESTAMPS, SQLITE_CONTRIBUTION_MAT_TIMESTAMPS, SQLITE_INDEX_MAT_TIMESTAMPS, SQLITE_KIND_REMOVAL_TIMESTAMPS, analyzeImportedTables, assertActiveSchemaVersion, assertAdoptedDialect, assertTrustedImportDatabaseEmpty, buildContributionInsertValues, buildContributionOnConflictSet, buildKindRemovalInsertValues, buildKindRemovalOnConflictSet, buildLiveNodeCandidates, buildMaterializationInsertValues, buildMaterializationOnConflictSet, commitSchemaVersionIfKindsEmpty, contributionRebuildSupported, createCachedTableExistence, createCommonOperationBackend, createContributionMaterializer, createPostgresOperationStrategy, createPostgresTrustedImportSession, createSqliteOperationStrategy, createSqliteTrustedImportSession, gateFulltext, gateFulltextMethods, getOrCreateLru, lockPostgresTrustedImportTables, mapContributionMaterializationRow, mapHybridSearchRow, mapKindRemovalRow, mapMaterializationRow, mapVectorWriteError, restoreSecondaryIndexes, suspendPostgresSecondaryIndexes, suspendSqliteSecondaryIndexes, tableExistsFromRow, vectorSlotFromCreateIndexParams, vectorSlotFromDropIndexParams, vectorSlotFromParams };
|
|
3375
|
+
//# sourceMappingURL=chunk-7VQXLT5O.js.map
|
|
3376
|
+
//# sourceMappingURL=chunk-7VQXLT5O.js.map
|