@nicia-ai/typegraph 0.34.0 → 0.36.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/postgres/index.cjs +29 -29
- package/dist/backend/postgres/index.d.cts +39 -7
- package/dist/backend/postgres/index.d.ts +39 -7
- package/dist/backend/postgres/index.js +16 -16
- package/dist/backend/postgres/pglite.cjs +21 -21
- package/dist/backend/postgres/pglite.d.cts +4 -4
- package/dist/backend/postgres/pglite.d.ts +4 -4
- package/dist/backend/postgres/pglite.js +16 -16
- package/dist/backend/sqlite/index.cjs +25 -26
- package/dist/backend/sqlite/index.d.cts +8 -8
- package/dist/backend/sqlite/index.d.ts +8 -8
- package/dist/backend/sqlite/index.js +13 -14
- package/dist/backend/sqlite/libsql.cjs +19 -19
- package/dist/backend/sqlite/libsql.d.cts +4 -4
- package/dist/backend/sqlite/libsql.d.ts +4 -4
- package/dist/backend/sqlite/libsql.js +15 -15
- package/dist/backend/sqlite/local.cjs +101 -21
- package/dist/backend/sqlite/local.cjs.map +1 -1
- package/dist/backend/sqlite/local.d.cts +95 -5
- package/dist/backend/sqlite/local.d.ts +95 -5
- package/dist/backend/sqlite/local.js +95 -16
- package/dist/backend/sqlite/local.js.map +1 -1
- package/dist/{chunk-T6SPUYLX.cjs → chunk-2THZ3TQI.cjs} +116 -10
- package/dist/chunk-2THZ3TQI.cjs.map +1 -0
- package/dist/{chunk-UJLOZYKT.cjs → chunk-456Z2U7Y.cjs} +441 -115
- package/dist/chunk-456Z2U7Y.cjs.map +1 -0
- package/dist/chunk-4BCU6VFZ.cjs +100 -0
- package/dist/chunk-4BCU6VFZ.cjs.map +1 -0
- package/dist/chunk-4BMPGT35.cjs +12 -0
- package/dist/{chunk-HMFK4BXR.cjs.map → chunk-4BMPGT35.cjs.map} +1 -1
- package/dist/chunk-4CAXEB2F.cjs +1366 -0
- package/dist/chunk-4CAXEB2F.cjs.map +1 -0
- package/dist/{chunk-RY2VIWAM.js → chunk-4GX2JJXS.js} +355 -32
- package/dist/chunk-4GX2JJXS.js.map +1 -0
- package/dist/{chunk-GQANNXXT.cjs → chunk-5A6FNS6N.cjs} +75 -20
- package/dist/chunk-5A6FNS6N.cjs.map +1 -0
- package/dist/{chunk-3Z6TW3CT.cjs → chunk-5AQIKK56.cjs} +65 -25
- package/dist/chunk-5AQIKK56.cjs.map +1 -0
- package/dist/{chunk-WLRIWYHQ.js → chunk-5DIPR3L3.js} +2145 -1937
- package/dist/chunk-5DIPR3L3.js.map +1 -0
- package/dist/{chunk-BVTWD66D.js → chunk-5SEGFTZX.js} +3 -3
- package/dist/{chunk-BVTWD66D.js.map → chunk-5SEGFTZX.js.map} +1 -1
- package/dist/{chunk-A7SZZFAG.js → chunk-5VTR2F2K.js} +452 -109
- package/dist/chunk-5VTR2F2K.js.map +1 -0
- package/dist/{chunk-JJRCLAUN.cjs → chunk-5W4L6DLF.cjs} +116 -10
- package/dist/chunk-5W4L6DLF.cjs.map +1 -0
- package/dist/{chunk-6GNSY7AV.js → chunk-6FR2MMS6.js} +7 -7
- package/dist/chunk-6FR2MMS6.js.map +1 -0
- package/dist/{chunk-3BRVBQQD.cjs → chunk-7BQLPXK6.cjs} +2648 -2440
- package/dist/chunk-7BQLPXK6.cjs.map +1 -0
- package/dist/chunk-7YSP4V4R.cjs +69 -0
- package/dist/chunk-7YSP4V4R.cjs.map +1 -0
- package/dist/chunk-A42GCBGX.cjs +28 -0
- package/dist/chunk-A42GCBGX.cjs.map +1 -0
- package/dist/{chunk-ZV5N4DBG.js → chunk-BJVEU3ZL.js} +300 -58
- package/dist/chunk-BJVEU3ZL.js.map +1 -0
- package/dist/chunk-BYPOGQWK.js +25 -0
- package/dist/chunk-BYPOGQWK.js.map +1 -0
- package/dist/chunk-CUHM5CWJ.cjs +12 -0
- package/dist/chunk-CUHM5CWJ.cjs.map +1 -0
- package/dist/{chunk-2JXB3NYJ.cjs → chunk-D7ZEOS56.cjs} +25 -32
- package/dist/chunk-D7ZEOS56.cjs.map +1 -0
- package/dist/chunk-DFVLCOP6.js +10 -0
- package/dist/chunk-DFVLCOP6.js.map +1 -0
- package/dist/{chunk-JIEJCTDS.cjs → chunk-DIK74MXX.cjs} +37 -4
- package/dist/chunk-DIK74MXX.cjs.map +1 -0
- package/dist/chunk-DN5VP4JC.js +1343 -0
- package/dist/chunk-DN5VP4JC.js.map +1 -0
- package/dist/chunk-EOLERH7Y.cjs +40 -0
- package/dist/chunk-EOLERH7Y.cjs.map +1 -0
- package/dist/{chunk-TGJE22RM.cjs → chunk-FACJJWGF.cjs} +24 -6
- package/dist/chunk-FACJJWGF.cjs.map +1 -0
- package/dist/{chunk-WVC2Q2FD.cjs → chunk-FN35DLCN.cjs} +31 -9
- package/dist/chunk-FN35DLCN.cjs.map +1 -0
- package/dist/{chunk-KUTNI6SI.js → chunk-FPIZFYHE.js} +10 -18
- package/dist/chunk-FPIZFYHE.js.map +1 -0
- package/dist/{chunk-VCGO4V26.js → chunk-FRV5Q5IO.js} +64 -9
- package/dist/chunk-FRV5Q5IO.js.map +1 -0
- package/dist/{chunk-K5P5OZXS.js → chunk-G6Q5UM7U.js} +2 -2
- package/dist/{chunk-K5P5OZXS.js.map → chunk-G6Q5UM7U.js.map} +1 -1
- package/dist/{chunk-JQGIPGVL.cjs → chunk-H7YNSMA7.cjs} +43 -2
- package/dist/chunk-H7YNSMA7.cjs.map +1 -0
- package/dist/chunk-HW3LW7DH.cjs +1271 -0
- package/dist/chunk-HW3LW7DH.cjs.map +1 -0
- package/dist/{chunk-V3QNTB7Z.js → chunk-IU46OHVW.js} +194 -114
- package/dist/chunk-IU46OHVW.js.map +1 -0
- package/dist/{chunk-HK5SATYM.cjs → chunk-J3LEGNQB.cjs} +16 -109
- package/dist/chunk-J3LEGNQB.cjs.map +1 -0
- package/dist/{chunk-ZP5WHI4C.cjs → chunk-JFMEONLG.cjs} +358 -116
- package/dist/chunk-JFMEONLG.cjs.map +1 -0
- package/dist/{chunk-2MRAX3UE.js → chunk-JFUPDJXD.js} +47 -4
- package/dist/chunk-JFUPDJXD.js.map +1 -0
- package/dist/{chunk-Z5XBMDXU.js → chunk-KBGQIPRQ.js} +42 -3
- package/dist/chunk-KBGQIPRQ.js.map +1 -0
- package/dist/{chunk-K2TGS3EN.js → chunk-M75SUBFG.js} +138 -89
- package/dist/chunk-M75SUBFG.js.map +1 -0
- package/dist/chunk-OHMP6N2J.js +47 -0
- package/dist/chunk-OHMP6N2J.js.map +1 -0
- package/dist/{chunk-4DIBPQNJ.js → chunk-OR5ZA5WP.js} +135 -25
- package/dist/chunk-OR5ZA5WP.js.map +1 -0
- package/dist/{chunk-6HVOHZHS.cjs → chunk-PWGX5DF5.cjs} +213 -168
- package/dist/chunk-PWGX5DF5.cjs.map +1 -0
- package/dist/chunk-PZKNKG5M.js +1252 -0
- package/dist/chunk-PZKNKG5M.js.map +1 -0
- package/dist/{chunk-DEQFL35G.js → chunk-Q5TEXCTB.js} +61 -7
- package/dist/chunk-Q5TEXCTB.js.map +1 -0
- package/dist/{chunk-QV245VMN.js → chunk-RAXU3RMB.js} +100 -6
- package/dist/chunk-RAXU3RMB.js.map +1 -0
- package/dist/{chunk-RHZWOJVA.cjs → chunk-RSSQKPSZ.cjs} +52 -4
- package/dist/chunk-RSSQKPSZ.cjs.map +1 -0
- package/dist/{chunk-G6SOJEDI.cjs → chunk-S55OV6PW.cjs} +15 -15
- package/dist/chunk-S55OV6PW.cjs.map +1 -0
- package/dist/chunk-S5F7ZLP2.js +94 -0
- package/dist/chunk-S5F7ZLP2.js.map +1 -0
- package/dist/{chunk-3E7SNSIA.cjs → chunk-SJDMVITW.cjs} +4 -4
- package/dist/{chunk-3E7SNSIA.cjs.map → chunk-SJDMVITW.cjs.map} +1 -1
- package/dist/{chunk-CHXTTSC6.js → chunk-SKCOUWAX.js} +104 -5
- package/dist/chunk-SKCOUWAX.js.map +1 -0
- package/dist/{chunk-XLUNB2TZ.js → chunk-SNXVDZAJ.js} +3 -3
- package/dist/{chunk-XLUNB2TZ.js.map → chunk-SNXVDZAJ.js.map} +1 -1
- package/dist/{chunk-ZURTTSCM.js → chunk-SXGE7ITL.js} +6 -94
- package/dist/chunk-SXGE7ITL.js.map +1 -0
- package/dist/{chunk-RBV7YCQD.js → chunk-T2WUSPDA.js} +49 -9
- package/dist/chunk-T2WUSPDA.js.map +1 -0
- package/dist/{chunk-KGC4LY5T.cjs → chunk-TCOCYN2P.cjs} +75 -21
- package/dist/chunk-TCOCYN2P.cjs.map +1 -0
- package/dist/{chunk-FLRCVI2G.cjs → chunk-TDXIBCGY.cjs} +2 -2
- package/dist/{chunk-FLRCVI2G.cjs.map → chunk-TDXIBCGY.cjs.map} +1 -1
- package/dist/{chunk-ZY4GXIVN.cjs → chunk-TEDRJXOG.cjs} +5 -5
- package/dist/{chunk-ZY4GXIVN.cjs.map → chunk-TEDRJXOG.cjs.map} +1 -1
- package/dist/{chunk-WL2SG7ZV.cjs → chunk-UMDVATGY.cjs} +6 -6
- package/dist/{chunk-WL2SG7ZV.cjs.map → chunk-UMDVATGY.cjs.map} +1 -1
- package/dist/chunk-UT3S4SEN.js +31 -0
- package/dist/chunk-UT3S4SEN.js.map +1 -0
- package/dist/{chunk-RRKQAKD6.cjs → chunk-UUT7UN2N.cjs} +149 -39
- package/dist/chunk-UUT7UN2N.cjs.map +1 -0
- package/dist/{chunk-SHLY4MCM.js → chunk-UZV3AZKF.js} +21 -3
- package/dist/chunk-UZV3AZKF.js.map +1 -0
- package/dist/{chunk-CYX2JTDG.js → chunk-VHMPG6UL.js} +29 -7
- package/dist/chunk-VHMPG6UL.js.map +1 -0
- package/dist/{chunk-LANHCOXB.js → chunk-VQEXF5D4.js} +485 -83
- package/dist/chunk-VQEXF5D4.js.map +1 -0
- package/dist/{chunk-K34OPSJK.js → chunk-W63OVYY4.js} +3 -3
- package/dist/{chunk-K34OPSJK.js.map → chunk-W63OVYY4.js.map} +1 -1
- package/dist/{chunk-TQOYM4LN.js → chunk-WI7ISNQF.js} +35 -5
- package/dist/chunk-WI7ISNQF.js.map +1 -0
- package/dist/{chunk-UNNPKQUG.cjs → chunk-X4JBT642.cjs} +246 -155
- package/dist/chunk-X4JBT642.cjs.map +1 -0
- package/dist/chunk-ZAMFOJ5P.cjs +1176 -0
- package/dist/chunk-ZAMFOJ5P.cjs.map +1 -0
- package/dist/{chunk-T46GR2VY.js → chunk-ZIGXMKQQ.js} +3 -3
- package/dist/{chunk-T46GR2VY.js.map → chunk-ZIGXMKQQ.js.map} +1 -1
- package/dist/{chunk-5IQIX7LU.cjs → chunk-ZUNQ5BEP.cjs} +518 -172
- package/dist/chunk-ZUNQ5BEP.cjs.map +1 -0
- package/dist/{ddl-BrmPg61z.d.ts → ddl-C2rZ-Aen.d.ts} +4 -4
- package/dist/{ddl-j1-sH6lE.d.cts → ddl-CZz7a0E8.d.cts} +4 -4
- package/dist/{extension-types-YGFJPrzK.d.cts → extension-types-ixRpJVUp.d.cts} +24 -1
- package/dist/{extension-types-YGFJPrzK.d.ts → extension-types-ixRpJVUp.d.ts} +24 -1
- package/dist/{types-DkNnF-7K.d.cts → fulltext-strategy-B57yvC5Q.d.ts} +2562 -2133
- package/dist/{types-D1Sqeyxy.d.ts → fulltext-strategy-CDkSSYhq.d.cts} +2562 -2133
- package/dist/graph-extension/index.cjs +20 -19
- package/dist/graph-extension/index.d.cts +4 -4
- package/dist/graph-extension/index.d.ts +4 -4
- package/dist/graph-extension/index.js +5 -4
- package/dist/graph-merge/index.cjs +255 -164
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +63 -33
- package/dist/graph-merge/index.d.ts +63 -33
- package/dist/graph-merge/index.js +135 -44
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-DGX6D9j1.d.ts → index-BFvdmBPV.d.ts} +301 -93
- package/dist/{index-SEvUHDA6.d.cts → index-BLtQWKRj.d.cts} +301 -93
- package/dist/index.cjs +216 -188
- package/dist/index.d.cts +11 -11
- package/dist/index.d.ts +11 -11
- package/dist/index.js +33 -33
- package/dist/indexes/index.cjs +19 -20
- package/dist/indexes/index.d.cts +5 -5
- package/dist/indexes/index.d.ts +5 -5
- package/dist/indexes/index.js +10 -11
- package/dist/interchange/index.cjs +48 -26
- package/dist/interchange/index.d.cts +126 -12
- package/dist/interchange/index.d.ts +126 -12
- package/dist/interchange/index.js +15 -13
- package/dist/{manager-ms9cKdc6.d.cts → manager-DwQi8eV0.d.cts} +9 -2
- package/dist/{manager-BZUeN_BU.d.ts → manager-ejUCB52T.d.ts} +9 -2
- package/dist/{materialize-indexes-D20xNluI.d.cts → materialize-indexes-B4e9360H.d.cts} +20 -4
- package/dist/{materialize-indexes-CAkIYFV-.d.ts → materialize-indexes-te9TPMMJ.d.ts} +20 -4
- package/dist/{postgres-BhpxGMC5.d.cts → postgres-CfEqsRMp.d.cts} +152 -1
- package/dist/{postgres-CWHLwNl1.d.ts → postgres-DQ5R6rzV.d.ts} +152 -1
- package/dist/profiler/index.cjs +11 -11
- package/dist/profiler/index.d.cts +7 -7
- package/dist/profiler/index.d.ts +7 -7
- package/dist/profiler/index.js +4 -4
- package/dist/provenance/index.cjs +40 -41
- package/dist/provenance/index.cjs.map +1 -1
- package/dist/provenance/index.d.cts +5 -5
- package/dist/provenance/index.d.ts +5 -5
- package/dist/provenance/index.js +11 -12
- package/dist/provenance/index.js.map +1 -1
- package/dist/schema/index.cjs +53 -40
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.cts +57 -57
- package/dist/schema/index.d.ts +57 -57
- package/dist/schema/index.js +28 -15
- package/dist/schema/index.js.map +1 -1
- package/dist/{sqlite-XrDxNaa7.d.cts → sqlite-D7zBinNR.d.cts} +92 -1
- package/dist/{sqlite-CGu5SLsw.d.ts → sqlite-DvQndLky.d.ts} +92 -1
- package/dist/{store-view-D09po4H6.d.cts → store-view-9KDOpZzF.d.cts} +643 -58
- package/dist/{store-view-BlgnhEYf.d.ts → store-view-DplHC3Nt.d.ts} +643 -58
- package/dist/{types-DiE1AO7p.d.cts → types-Bv9DcS_E.d.cts} +2 -2
- package/dist/{types-B1TbZJYS.d.ts → types-CoxuV7EJ.d.ts} +2 -2
- package/dist/{where-DKjuofPr.d.cts → where-7RKFOsXt.d.ts} +2 -2
- package/dist/{where-DrUIIWHb.d.ts → where-DdMIXOtH.d.cts} +2 -2
- package/package.json +14 -13
- package/dist/chunk-2EBMPJBO.js +0 -16
- package/dist/chunk-2EBMPJBO.js.map +0 -1
- package/dist/chunk-2JXB3NYJ.cjs.map +0 -1
- package/dist/chunk-2MRAX3UE.js.map +0 -1
- package/dist/chunk-3BRVBQQD.cjs.map +0 -1
- package/dist/chunk-3EUKJEQ3.js +0 -77
- package/dist/chunk-3EUKJEQ3.js.map +0 -1
- package/dist/chunk-3Z6TW3CT.cjs.map +0 -1
- package/dist/chunk-4DIBPQNJ.js.map +0 -1
- package/dist/chunk-4S2FXGBJ.js +0 -9
- package/dist/chunk-4S2FXGBJ.js.map +0 -1
- package/dist/chunk-5IQIX7LU.cjs.map +0 -1
- package/dist/chunk-6GNSY7AV.js.map +0 -1
- package/dist/chunk-6HVOHZHS.cjs.map +0 -1
- package/dist/chunk-6SCVW4AS.js +0 -20
- package/dist/chunk-6SCVW4AS.js.map +0 -1
- package/dist/chunk-A7SZZFAG.js.map +0 -1
- package/dist/chunk-CHXTTSC6.js.map +0 -1
- package/dist/chunk-CYX2JTDG.js.map +0 -1
- package/dist/chunk-DEQFL35G.js.map +0 -1
- package/dist/chunk-G6SOJEDI.cjs.map +0 -1
- package/dist/chunk-GQANNXXT.cjs.map +0 -1
- package/dist/chunk-GZCNZ7QW.js +0 -24
- package/dist/chunk-GZCNZ7QW.js.map +0 -1
- package/dist/chunk-HK5SATYM.cjs.map +0 -1
- package/dist/chunk-HMFK4BXR.cjs +0 -12
- package/dist/chunk-HTGDWIDE.cjs +0 -89
- package/dist/chunk-HTGDWIDE.cjs.map +0 -1
- package/dist/chunk-JIEJCTDS.cjs.map +0 -1
- package/dist/chunk-JJRCLAUN.cjs.map +0 -1
- package/dist/chunk-JQGIPGVL.cjs.map +0 -1
- package/dist/chunk-K2TGS3EN.js.map +0 -1
- package/dist/chunk-KGC4LY5T.cjs.map +0 -1
- package/dist/chunk-KNHYNQQ3.cjs +0 -663
- package/dist/chunk-KNHYNQQ3.cjs.map +0 -1
- package/dist/chunk-KUTNI6SI.js.map +0 -1
- package/dist/chunk-LANHCOXB.js.map +0 -1
- package/dist/chunk-N6WTUSBV.cjs +0 -23
- package/dist/chunk-N6WTUSBV.cjs.map +0 -1
- package/dist/chunk-NAUA4PW5.cjs +0 -28
- package/dist/chunk-NAUA4PW5.cjs.map +0 -1
- package/dist/chunk-QV245VMN.js.map +0 -1
- package/dist/chunk-RBV7YCQD.js.map +0 -1
- package/dist/chunk-RHZWOJVA.cjs.map +0 -1
- package/dist/chunk-RRKQAKD6.cjs.map +0 -1
- package/dist/chunk-RY2VIWAM.js.map +0 -1
- package/dist/chunk-SHLY4MCM.js.map +0 -1
- package/dist/chunk-T2DWPQNE.js +0 -649
- package/dist/chunk-T2DWPQNE.js.map +0 -1
- package/dist/chunk-T6SPUYLX.cjs.map +0 -1
- package/dist/chunk-TGJE22RM.cjs.map +0 -1
- package/dist/chunk-TOTPVGOG.cjs +0 -774
- package/dist/chunk-TOTPVGOG.cjs.map +0 -1
- package/dist/chunk-TQOYM4LN.js.map +0 -1
- package/dist/chunk-UJLOZYKT.cjs.map +0 -1
- package/dist/chunk-UNNPKQUG.cjs.map +0 -1
- package/dist/chunk-V3QNTB7Z.js.map +0 -1
- package/dist/chunk-VCGO4V26.js.map +0 -1
- package/dist/chunk-WLRIWYHQ.js.map +0 -1
- package/dist/chunk-WVC2Q2FD.cjs.map +0 -1
- package/dist/chunk-XXVEULWX.js +0 -39
- package/dist/chunk-XXVEULWX.js.map +0 -1
- package/dist/chunk-YAZE7QZR.cjs +0 -32
- package/dist/chunk-YAZE7QZR.cjs.map +0 -1
- package/dist/chunk-YC6PWTHY.cjs +0 -44
- package/dist/chunk-YC6PWTHY.cjs.map +0 -1
- package/dist/chunk-Z5HBYM7U.cjs +0 -11
- package/dist/chunk-Z5HBYM7U.cjs.map +0 -1
- package/dist/chunk-Z5XBMDXU.js.map +0 -1
- package/dist/chunk-ZP5WHI4C.cjs.map +0 -1
- package/dist/chunk-ZURTTSCM.js.map +0 -1
- package/dist/chunk-ZV5N4DBG.js.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkFN35DLCN_cjs = require('./chunk-FN35DLCN.cjs');
|
|
4
|
+
var chunkS55OV6PW_cjs = require('./chunk-S55OV6PW.cjs');
|
|
5
|
+
var chunk5W4L6DLF_cjs = require('./chunk-5W4L6DLF.cjs');
|
|
6
6
|
var chunkACSVZPK7_cjs = require('./chunk-ACSVZPK7.cjs');
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
7
|
+
var chunkTEDRJXOG_cjs = require('./chunk-TEDRJXOG.cjs');
|
|
8
|
+
var chunkD7ZEOS56_cjs = require('./chunk-D7ZEOS56.cjs');
|
|
9
|
+
var chunkX4JBT642_cjs = require('./chunk-X4JBT642.cjs');
|
|
10
|
+
var chunkRSSQKPSZ_cjs = require('./chunk-RSSQKPSZ.cjs');
|
|
11
|
+
var chunk7YSP4V4R_cjs = require('./chunk-7YSP4V4R.cjs');
|
|
12
|
+
var chunkDIK74MXX_cjs = require('./chunk-DIK74MXX.cjs');
|
|
13
13
|
var drizzleOrm = require('drizzle-orm');
|
|
14
14
|
var pgCore = require('drizzle-orm/pg-core');
|
|
15
15
|
var sqliteCore = require('drizzle-orm/sqlite-core');
|
|
@@ -28,6 +28,7 @@ var DEFAULT_TABLE_NAMES = {
|
|
|
28
28
|
recordedNodes: "typegraph_recorded_nodes",
|
|
29
29
|
recordedEdges: "typegraph_recorded_edges",
|
|
30
30
|
recordedClock: "typegraph_recorded_clock",
|
|
31
|
+
revisionOrigins: "typegraph_revision_origins",
|
|
31
32
|
uniques: "typegraph_node_uniques",
|
|
32
33
|
schemaVersions: "typegraph_schema_versions",
|
|
33
34
|
fulltext: "typegraph_node_fulltext",
|
|
@@ -64,7 +65,7 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
64
65
|
),
|
|
65
66
|
pgCore.index(`${n.nodes}_deleted_idx`).on(t.graphId, t.deletedAt),
|
|
66
67
|
pgCore.index(`${n.nodes}_valid_idx`).on(t.graphId, t.validFrom, t.validTo),
|
|
67
|
-
...
|
|
68
|
+
...chunkS55OV6PW_cjs.buildPostgresNodeIndexBuilders(t, indexes)
|
|
68
69
|
]
|
|
69
70
|
);
|
|
70
71
|
const edges2 = pgCore.pgTable(
|
|
@@ -88,7 +89,13 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
88
89
|
pgCore.primaryKey({ columns: [t.graphId, t.id] }),
|
|
89
90
|
pgCore.index(`${n.edges}_kind_idx`).on(t.graphId, t.kind),
|
|
90
91
|
// Directional traversal index (outgoing): supports endpoint lookups
|
|
91
|
-
// and extra filtering by edge kind / target kind.
|
|
92
|
+
// and extra filtering by edge kind / target kind. Includes every
|
|
93
|
+
// system column the compiled query's soft-delete/temporal-validity
|
|
94
|
+
// predicate touches (deleted_at, valid_from, valid_to), trailed by
|
|
95
|
+
// to_id — the compiled traversal join reads `n.id = e.to_id` for an
|
|
96
|
+
// outgoing traversal (standard-builders.ts), so without to_id here
|
|
97
|
+
// the join still fetches the edge's heap row for that one column
|
|
98
|
+
// even with the seek/predicate columns covered.
|
|
92
99
|
pgCore.index(`${n.edges}_from_idx`).on(
|
|
93
100
|
t.graphId,
|
|
94
101
|
t.fromKind,
|
|
@@ -96,9 +103,13 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
96
103
|
t.kind,
|
|
97
104
|
t.toKind,
|
|
98
105
|
t.deletedAt,
|
|
99
|
-
t.
|
|
106
|
+
t.validFrom,
|
|
107
|
+
t.validTo,
|
|
108
|
+
t.toId
|
|
100
109
|
),
|
|
101
|
-
// Directional traversal index (incoming): mirrors from_idx for
|
|
110
|
+
// Directional traversal index (incoming): mirrors from_idx for
|
|
111
|
+
// reverse traversals, trailed by from_id for the same reason
|
|
112
|
+
// (`n.id = e.from_id` for an incoming traversal).
|
|
102
113
|
pgCore.index(`${n.edges}_to_idx`).on(
|
|
103
114
|
t.graphId,
|
|
104
115
|
t.toKind,
|
|
@@ -106,7 +117,9 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
106
117
|
t.kind,
|
|
107
118
|
t.fromKind,
|
|
108
119
|
t.deletedAt,
|
|
109
|
-
t.
|
|
120
|
+
t.validFrom,
|
|
121
|
+
t.validTo,
|
|
122
|
+
t.fromId
|
|
110
123
|
),
|
|
111
124
|
pgCore.index(`${n.edges}_kind_created_idx`).on(
|
|
112
125
|
t.graphId,
|
|
@@ -123,7 +136,7 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
123
136
|
t.fromId,
|
|
124
137
|
t.validTo
|
|
125
138
|
),
|
|
126
|
-
...
|
|
139
|
+
...chunkS55OV6PW_cjs.buildPostgresEdgeIndexBuilders(t, indexes)
|
|
127
140
|
]
|
|
128
141
|
);
|
|
129
142
|
const recordedNodes2 = pgCore.pgTable(
|
|
@@ -231,6 +244,14 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
231
244
|
},
|
|
232
245
|
(t) => [pgCore.primaryKey({ columns: [t.graphId] })]
|
|
233
246
|
);
|
|
247
|
+
const revisionOrigins = pgCore.pgTable(
|
|
248
|
+
n.revisionOrigins,
|
|
249
|
+
{
|
|
250
|
+
graphId: pgCore.text("graph_id").notNull(),
|
|
251
|
+
origin: pgCore.text("origin").notNull()
|
|
252
|
+
},
|
|
253
|
+
(t) => [pgCore.primaryKey({ columns: [t.graphId] })]
|
|
254
|
+
);
|
|
234
255
|
const uniques2 = pgCore.pgTable(
|
|
235
256
|
n.uniques,
|
|
236
257
|
{
|
|
@@ -283,7 +304,14 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
283
304
|
lastAttemptedAt: pgCore.timestamp("last_attempted_at", {
|
|
284
305
|
withTimezone: true
|
|
285
306
|
}).notNull(),
|
|
286
|
-
lastError: pgCore.text("last_error")
|
|
307
|
+
lastError: pgCore.text("last_error"),
|
|
308
|
+
// Cross-caller build claim: while `building_since` is fresh (within
|
|
309
|
+
// the lease), exactly one materializer owns this index's CREATE
|
|
310
|
+
// INDEX CONCURRENTLY. Serializes same-index CIC across processes —
|
|
311
|
+
// two concurrent expression-index CICs deadlock each other (no
|
|
312
|
+
// safe-snapshot exemption). NULL when no build is in flight.
|
|
313
|
+
buildingSince: pgCore.timestamp("building_since", { withTimezone: true }),
|
|
314
|
+
claimToken: pgCore.text("claim_token")
|
|
287
315
|
},
|
|
288
316
|
(t) => [pgCore.primaryKey({ columns: [t.indexName] })]
|
|
289
317
|
);
|
|
@@ -357,6 +385,7 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
357
385
|
recordedNodes: recordedNodes2,
|
|
358
386
|
recordedEdges: recordedEdges2,
|
|
359
387
|
recordedClock: recordedClock2,
|
|
388
|
+
revisionOrigins,
|
|
360
389
|
uniques: uniques2,
|
|
361
390
|
schemaVersions: schemaVersions2,
|
|
362
391
|
indexMaterializations,
|
|
@@ -433,9 +462,9 @@ function renderIndexColumn(col) {
|
|
|
433
462
|
if (col && typeof col === "object" && "name" in col) {
|
|
434
463
|
return `"${col.name}"`;
|
|
435
464
|
}
|
|
436
|
-
const
|
|
437
|
-
if (
|
|
438
|
-
return
|
|
465
|
+
const sql14 = tryInlineSql(col);
|
|
466
|
+
if (sql14 !== void 0) {
|
|
467
|
+
return sql14;
|
|
439
468
|
}
|
|
440
469
|
return "unknown";
|
|
441
470
|
}
|
|
@@ -511,13 +540,13 @@ function isSqliteTable(value) {
|
|
|
511
540
|
function runtimeStrategyContributions(fulltextStrategy, fulltextTableName) {
|
|
512
541
|
return fulltextStrategy.ownedTables(fulltextTableName).filter((contribution) => contribution.runtimeEnsure);
|
|
513
542
|
}
|
|
514
|
-
function sqliteContributions(tables3 =
|
|
543
|
+
function sqliteContributions(tables3 = chunkFN35DLCN_cjs.tables, fulltextStrategy = chunkD7ZEOS56_cjs.fts5Strategy) {
|
|
515
544
|
const contributions = [];
|
|
516
545
|
for (const [key, table] of Object.entries(tables3)) {
|
|
517
546
|
if (!isSqliteTable(table)) continue;
|
|
518
547
|
contributions.push({
|
|
519
548
|
logicalName: key,
|
|
520
|
-
owner:
|
|
549
|
+
owner: chunkD7ZEOS56_cjs.BASE_CONTRIBUTION_OWNER,
|
|
521
550
|
tableName: sqliteCore.getTableConfig(table).name,
|
|
522
551
|
createDdl: [
|
|
523
552
|
generateSqliteCreateTableSQL(table),
|
|
@@ -533,12 +562,12 @@ function sqliteContributions(tables3 = chunkWVC2Q2FD_cjs.tables, fulltextStrateg
|
|
|
533
562
|
}
|
|
534
563
|
return contributions;
|
|
535
564
|
}
|
|
536
|
-
function generateSqliteDDL(tables3 =
|
|
565
|
+
function generateSqliteDDL(tables3 = chunkFN35DLCN_cjs.tables, fulltextStrategy = chunkD7ZEOS56_cjs.fts5Strategy) {
|
|
537
566
|
return sqliteContributions(tables3, fulltextStrategy).flatMap(
|
|
538
567
|
(contribution) => [...contribution.createDdl]
|
|
539
568
|
);
|
|
540
569
|
}
|
|
541
|
-
function generateSqliteMigrationSQL(tables3 =
|
|
570
|
+
function generateSqliteMigrationSQL(tables3 = chunkFN35DLCN_cjs.tables, fulltextStrategy = chunkD7ZEOS56_cjs.fts5Strategy) {
|
|
542
571
|
return generateSqliteDDL(tables3, fulltextStrategy).join("\n\n");
|
|
543
572
|
}
|
|
544
573
|
function getPgColumnType(column) {
|
|
@@ -620,14 +649,14 @@ function generatePgCreateIndexSQL(table) {
|
|
|
620
649
|
function isPgTable(value) {
|
|
621
650
|
return drizzleOrm.is(value, pgCore.PgTable);
|
|
622
651
|
}
|
|
623
|
-
function postgresContributions(tables3 = tables2, fulltextStrategy =
|
|
652
|
+
function postgresContributions(tables3 = tables2, fulltextStrategy = chunkD7ZEOS56_cjs.tsvectorStrategy) {
|
|
624
653
|
const contributions = [];
|
|
625
654
|
for (const [key, table] of Object.entries(tables3)) {
|
|
626
655
|
if (!isPgTable(table)) continue;
|
|
627
656
|
if (table === tables3.fulltext) continue;
|
|
628
657
|
contributions.push({
|
|
629
658
|
logicalName: key,
|
|
630
|
-
owner:
|
|
659
|
+
owner: chunkD7ZEOS56_cjs.BASE_CONTRIBUTION_OWNER,
|
|
631
660
|
tableName: pgCore.getTableConfig(table).name,
|
|
632
661
|
createDdl: [
|
|
633
662
|
generatePgCreateTableSQL(table),
|
|
@@ -643,12 +672,12 @@ function postgresContributions(tables3 = tables2, fulltextStrategy = chunk2JXB3N
|
|
|
643
672
|
}
|
|
644
673
|
return contributions;
|
|
645
674
|
}
|
|
646
|
-
function generatePostgresDDL(tables3 = tables2, fulltextStrategy =
|
|
675
|
+
function generatePostgresDDL(tables3 = tables2, fulltextStrategy = chunkD7ZEOS56_cjs.tsvectorStrategy) {
|
|
647
676
|
return postgresContributions(tables3, fulltextStrategy).flatMap(
|
|
648
677
|
(contribution) => [...contribution.createDdl]
|
|
649
678
|
);
|
|
650
679
|
}
|
|
651
|
-
function generatePostgresMigrationSQL(tables3 = tables2, fulltextStrategy =
|
|
680
|
+
function generatePostgresMigrationSQL(tables3 = tables2, fulltextStrategy = chunkD7ZEOS56_cjs.tsvectorStrategy) {
|
|
652
681
|
const extensionSql = "-- Enable pgvector extension for vector similarity search\nCREATE EXTENSION IF NOT EXISTS vector;";
|
|
653
682
|
const ddlSql = generatePostgresDDL(tables3, fulltextStrategy).join("\n\n");
|
|
654
683
|
return `${extensionSql}
|
|
@@ -691,6 +720,7 @@ function createVectorSlotLatch() {
|
|
|
691
720
|
};
|
|
692
721
|
}
|
|
693
722
|
var VECTOR_SLOT_PLACEHOLDER_DIMENSIONS = 1;
|
|
723
|
+
var EMBEDDING_UPSERT_PARAM_COUNT = 5;
|
|
694
724
|
function vectorSlotFromParams(params) {
|
|
695
725
|
return {
|
|
696
726
|
graphId: params.graphId,
|
|
@@ -718,10 +748,10 @@ function vectorSlotFromDropIndexParams(params) {
|
|
|
718
748
|
};
|
|
719
749
|
}
|
|
720
750
|
function mapVectorWriteError(error, params) {
|
|
721
|
-
const mismatch =
|
|
751
|
+
const mismatch = chunkRSSQKPSZ_cjs.parseDimensionMismatch(error);
|
|
722
752
|
if (mismatch === void 0) return error;
|
|
723
753
|
const attempted = mismatch.actual ?? "a different number of";
|
|
724
|
-
return new
|
|
754
|
+
return new chunkDIK74MXX_cjs.EmbeddingDimensionChangedError(
|
|
725
755
|
`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.`,
|
|
726
756
|
{
|
|
727
757
|
kind: params.nodeKind,
|
|
@@ -737,7 +767,7 @@ var SQLITE_CONTRIBUTION_MAT_TIMESTAMPS = {
|
|
|
737
767
|
encode: (value) => value
|
|
738
768
|
};
|
|
739
769
|
var POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS = {
|
|
740
|
-
decode:
|
|
770
|
+
decode: chunk5W4L6DLF_cjs.formatPostgresTimestamp,
|
|
741
771
|
encode: (value) => new Date(value)
|
|
742
772
|
};
|
|
743
773
|
function mapContributionMaterializationRow(row, decode) {
|
|
@@ -787,7 +817,7 @@ async function computeContributionSignature(dialect, identity, createDdl) {
|
|
|
787
817
|
tableName: identity.tableName,
|
|
788
818
|
createDdl
|
|
789
819
|
};
|
|
790
|
-
return
|
|
820
|
+
return chunkTEDRJXOG_cjs.sha256Hex(JSON.stringify(hashable, chunkACSVZPK7_cjs.sortedReplacer), 16);
|
|
791
821
|
}
|
|
792
822
|
function evaluateContributionState(row, signature) {
|
|
793
823
|
if (row === void 0) return "missing";
|
|
@@ -851,7 +881,7 @@ function gateFulltextMethods(source, assert) {
|
|
|
851
881
|
return gated;
|
|
852
882
|
}
|
|
853
883
|
function gateFulltext(tx, assert) {
|
|
854
|
-
return
|
|
884
|
+
return chunkX4JBT642_cjs.createBackendOverlay(
|
|
855
885
|
tx,
|
|
856
886
|
gateFulltextMethods(tx, assert)
|
|
857
887
|
);
|
|
@@ -881,13 +911,13 @@ function createContributionMaterializer(deps) {
|
|
|
881
911
|
await deps.recordMarker({
|
|
882
912
|
...identity,
|
|
883
913
|
signature,
|
|
884
|
-
attemptedAt:
|
|
914
|
+
attemptedAt: chunk5W4L6DLF_cjs.nowIso(),
|
|
885
915
|
materializedAt: void 0,
|
|
886
916
|
error: error.message
|
|
887
917
|
});
|
|
888
918
|
throw error;
|
|
889
919
|
}
|
|
890
|
-
const attemptedAt =
|
|
920
|
+
const attemptedAt = chunk5W4L6DLF_cjs.nowIso();
|
|
891
921
|
try {
|
|
892
922
|
for (const statement of contribution.createDdl) {
|
|
893
923
|
await deps.execDdl(statement);
|
|
@@ -924,7 +954,7 @@ function createContributionMaterializer(deps) {
|
|
|
924
954
|
state: evaluateContributionState(existing, signature)
|
|
925
955
|
};
|
|
926
956
|
} catch (error) {
|
|
927
|
-
if (!
|
|
957
|
+
if (!chunkRSSQKPSZ_cjs.isMissingTableError(error)) throw error;
|
|
928
958
|
return { kind: "missing-table", error };
|
|
929
959
|
}
|
|
930
960
|
}
|
|
@@ -953,13 +983,13 @@ function createContributionMaterializer(deps) {
|
|
|
953
983
|
for (const contribution of runtimeContributions()) {
|
|
954
984
|
const read = await readContributionState(graphId, contribution);
|
|
955
985
|
if (read.kind === "missing-table") {
|
|
956
|
-
throw new
|
|
986
|
+
throw new chunkDIK74MXX_cjs.StoreNotInitializedError(graphId, "missing", {
|
|
957
987
|
cause: read.error,
|
|
958
988
|
details: { logicalName: contribution.logicalName }
|
|
959
989
|
});
|
|
960
990
|
}
|
|
961
991
|
if (read.state !== "initialized") {
|
|
962
|
-
throw new
|
|
992
|
+
throw new chunkDIK74MXX_cjs.StoreNotInitializedError(graphId, read.state, {
|
|
963
993
|
details: { logicalName: contribution.logicalName }
|
|
964
994
|
});
|
|
965
995
|
}
|
|
@@ -973,7 +1003,7 @@ var SQLITE_INDEX_MAT_TIMESTAMPS = {
|
|
|
973
1003
|
encode: (value) => value
|
|
974
1004
|
};
|
|
975
1005
|
var POSTGRES_INDEX_MAT_TIMESTAMPS = {
|
|
976
|
-
decode:
|
|
1006
|
+
decode: chunk5W4L6DLF_cjs.formatPostgresTimestamp,
|
|
977
1007
|
encode: (value) => new Date(value)
|
|
978
1008
|
};
|
|
979
1009
|
function mapMaterializationRow(row, decode) {
|
|
@@ -1026,7 +1056,7 @@ var SQLITE_KIND_REMOVAL_TIMESTAMPS = {
|
|
|
1026
1056
|
encode: (value) => value
|
|
1027
1057
|
};
|
|
1028
1058
|
var POSTGRES_KIND_REMOVAL_TIMESTAMPS = {
|
|
1029
|
-
decode:
|
|
1059
|
+
decode: chunk5W4L6DLF_cjs.formatPostgresTimestamp,
|
|
1030
1060
|
encode: (value) => new Date(value)
|
|
1031
1061
|
};
|
|
1032
1062
|
function mapKindRemovalRow(row, decode) {
|
|
@@ -1067,8 +1097,111 @@ function buildKindRemovalOnConflictSet(removedAtColumn, paramsRemovedAt) {
|
|
|
1067
1097
|
lastError: drizzleOrm.sql`excluded.${drizzleOrm.sql.identifier("last_error")}`
|
|
1068
1098
|
};
|
|
1069
1099
|
}
|
|
1100
|
+
function nodeIdOrderKey(dialect) {
|
|
1101
|
+
return chunk7YSP4V4R_cjs.codePointOrderKey(drizzleOrm.sql.raw("node_id"), dialect);
|
|
1102
|
+
}
|
|
1103
|
+
function hybridCandidatesRef() {
|
|
1104
|
+
return drizzleOrm.sql`SELECT node_id FROM tg_hybrid_cand`;
|
|
1105
|
+
}
|
|
1106
|
+
function buildHybridSearchStatement(input) {
|
|
1107
|
+
const { nodes: nodes2 } = input;
|
|
1108
|
+
const nodeIdOrder = nodeIdOrderKey(input.dialect);
|
|
1109
|
+
const vectorOrder = input.vectorScoreDescending ? drizzleOrm.sql`score DESC, ${nodeIdOrder} ASC` : drizzleOrm.sql`score ASC, ${nodeIdOrder} ASC`;
|
|
1110
|
+
const columnPairs = [
|
|
1111
|
+
[nodes2.graphId, "graph_id"],
|
|
1112
|
+
[nodes2.kind, "kind"],
|
|
1113
|
+
[nodes2.id, "id"],
|
|
1114
|
+
[nodes2.props, "props"],
|
|
1115
|
+
[nodes2.version, "version"],
|
|
1116
|
+
[nodes2.validFrom, "valid_from"],
|
|
1117
|
+
[nodes2.validTo, "valid_to"],
|
|
1118
|
+
[nodes2.createdAt, "created_at"],
|
|
1119
|
+
[nodes2.updatedAt, "updated_at"],
|
|
1120
|
+
[nodes2.deletedAt, "deleted_at"]
|
|
1121
|
+
];
|
|
1122
|
+
const nodeColumns = drizzleOrm.sql.raw(
|
|
1123
|
+
columnPairs.map(
|
|
1124
|
+
([column, alias]) => `tg_hybrid_node."${column.name.replaceAll('"', '""')}" AS ${alias}`
|
|
1125
|
+
).join(", ")
|
|
1126
|
+
);
|
|
1127
|
+
return drizzleOrm.sql`
|
|
1128
|
+
WITH tg_hybrid_cand AS (
|
|
1129
|
+
SELECT node_id FROM (${input.candidatesSql}) AS tg_hybrid_cand_src
|
|
1130
|
+
),
|
|
1131
|
+
tg_hybrid_vec AS (
|
|
1132
|
+
SELECT node_id, score,
|
|
1133
|
+
ROW_NUMBER() OVER (ORDER BY ${vectorOrder}) AS ord
|
|
1134
|
+
FROM (${input.vectorSql}) AS tg_hybrid_vec_src
|
|
1135
|
+
),
|
|
1136
|
+
tg_hybrid_fts AS (
|
|
1137
|
+
SELECT node_id, score, snippet,
|
|
1138
|
+
ROW_NUMBER() OVER (ORDER BY score DESC, ${nodeIdOrder} ASC) AS ord
|
|
1139
|
+
FROM (${input.fulltextSql}) AS tg_hybrid_fts_src
|
|
1140
|
+
),
|
|
1141
|
+
tg_hybrid_pairs AS (
|
|
1142
|
+
SELECT node_id, ord AS vector_rank, score AS vector_score,
|
|
1143
|
+
NULL AS fulltext_rank, NULL AS fulltext_score, NULL AS snippet
|
|
1144
|
+
FROM tg_hybrid_vec
|
|
1145
|
+
UNION ALL
|
|
1146
|
+
SELECT node_id, NULL, NULL, ord, score, snippet
|
|
1147
|
+
FROM tg_hybrid_fts
|
|
1148
|
+
),
|
|
1149
|
+
tg_hybrid_fused AS MATERIALIZED (
|
|
1150
|
+
SELECT node_id,
|
|
1151
|
+
SUM(
|
|
1152
|
+
COALESCE((${input.vectorWeight} * 1.0) / (${input.fusionK} + vector_rank), 0)
|
|
1153
|
+
+ COALESCE((${input.fulltextWeight} * 1.0) / (${input.fusionK} + fulltext_rank), 0)
|
|
1154
|
+
) AS fused_score,
|
|
1155
|
+
MAX(vector_rank) AS vector_rank,
|
|
1156
|
+
MAX(vector_score) AS vector_score,
|
|
1157
|
+
MAX(fulltext_rank) AS fulltext_rank,
|
|
1158
|
+
MAX(fulltext_score) AS fulltext_score,
|
|
1159
|
+
MAX(snippet) AS snippet
|
|
1160
|
+
FROM tg_hybrid_pairs
|
|
1161
|
+
GROUP BY node_id
|
|
1162
|
+
)
|
|
1163
|
+
SELECT
|
|
1164
|
+
tg_hybrid_fused.node_id AS node_id,
|
|
1165
|
+
tg_hybrid_fused.fused_score AS fused_score,
|
|
1166
|
+
tg_hybrid_fused.vector_rank AS vector_rank,
|
|
1167
|
+
tg_hybrid_fused.vector_score AS vector_score,
|
|
1168
|
+
tg_hybrid_fused.fulltext_rank AS fulltext_rank,
|
|
1169
|
+
tg_hybrid_fused.fulltext_score AS fulltext_score,
|
|
1170
|
+
tg_hybrid_fused.snippet AS snippet,
|
|
1171
|
+
${nodeColumns}
|
|
1172
|
+
FROM tg_hybrid_fused
|
|
1173
|
+
JOIN ${nodes2} AS tg_hybrid_node
|
|
1174
|
+
ON ${qualified(nodes2, "graphId")} = ${input.graphId}
|
|
1175
|
+
AND ${qualified(nodes2, "kind")} = ${input.nodeKind}
|
|
1176
|
+
AND ${qualified(nodes2, "id")} = tg_hybrid_fused.node_id
|
|
1177
|
+
AND ${qualified(nodes2, "deletedAt")} IS NULL
|
|
1178
|
+
ORDER BY fused_score DESC, ${nodeIdOrder} ASC
|
|
1179
|
+
LIMIT ${input.limit} OFFSET ${input.offset}
|
|
1180
|
+
`;
|
|
1181
|
+
}
|
|
1182
|
+
function qualified(nodes2, member) {
|
|
1183
|
+
return drizzleOrm.sql`tg_hybrid_node.${chunk7YSP4V4R_cjs.quotedColumn(nodes2[member])}`;
|
|
1184
|
+
}
|
|
1185
|
+
function present(value) {
|
|
1186
|
+
return value !== null && value !== void 0;
|
|
1187
|
+
}
|
|
1188
|
+
function mapHybridSearchRow(row, toNodeRow) {
|
|
1189
|
+
return {
|
|
1190
|
+
node: toNodeRow(row),
|
|
1191
|
+
fusedScore: chunk5W4L6DLF_cjs.coerceNumericScore(row.fused_score),
|
|
1192
|
+
...present(row.vector_rank) ? { vectorRank: Number(row.vector_rank) } : {},
|
|
1193
|
+
...present(row.vector_score) ? { vectorScore: chunk5W4L6DLF_cjs.coerceNumericScore(row.vector_score) } : {},
|
|
1194
|
+
...present(row.fulltext_rank) ? { fulltextRank: Number(row.fulltext_rank) } : {},
|
|
1195
|
+
...present(row.fulltext_score) ? {
|
|
1196
|
+
fulltextScore: chunk5W4L6DLF_cjs.coerceNumericScore(
|
|
1197
|
+
row.fulltext_score
|
|
1198
|
+
)
|
|
1199
|
+
} : {},
|
|
1200
|
+
...present(row.snippet) ? { snippet: String(row.snippet) } : {}
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1070
1203
|
function buildClearGraph(tables3, graphId) {
|
|
1071
|
-
const fulltext2 =
|
|
1204
|
+
const fulltext2 = chunk7YSP4V4R_cjs.quotedTableName(tables3.fulltextTableName);
|
|
1072
1205
|
return [
|
|
1073
1206
|
{ query: drizzleOrm.sql`DELETE FROM ${fulltext2} WHERE "graph_id" = ${graphId}` },
|
|
1074
1207
|
{
|
|
@@ -1250,13 +1383,13 @@ function buildCountEdgesByKind(tables3, params) {
|
|
|
1250
1383
|
function buildInsertEdge(tables3, params, timestamp2) {
|
|
1251
1384
|
const { edges: edges2 } = tables3;
|
|
1252
1385
|
const propsJson = JSON.stringify(params.props);
|
|
1253
|
-
const columns =
|
|
1386
|
+
const columns = chunk7YSP4V4R_cjs.edgeColumnList(edges2);
|
|
1254
1387
|
return drizzleOrm.sql`
|
|
1255
1388
|
INSERT INTO ${edges2} (${columns})
|
|
1256
1389
|
VALUES (
|
|
1257
1390
|
${params.graphId}, ${params.id}, ${params.kind},
|
|
1258
1391
|
${params.fromKind}, ${params.fromId}, ${params.toKind}, ${params.toId},
|
|
1259
|
-
${propsJson}, ${
|
|
1392
|
+
${propsJson}, ${chunk7YSP4V4R_cjs.sqlNull(chunk7YSP4V4R_cjs.resolveValidFrom(params.validFrom, timestamp2))}, ${chunk7YSP4V4R_cjs.sqlNull(params.validTo)},
|
|
1260
1393
|
${timestamp2}, ${timestamp2}
|
|
1261
1394
|
)
|
|
1262
1395
|
RETURNING *
|
|
@@ -1265,23 +1398,23 @@ function buildInsertEdge(tables3, params, timestamp2) {
|
|
|
1265
1398
|
function buildInsertEdgeNoReturn(tables3, params, timestamp2) {
|
|
1266
1399
|
const { edges: edges2 } = tables3;
|
|
1267
1400
|
const propsJson = JSON.stringify(params.props);
|
|
1268
|
-
const columns =
|
|
1401
|
+
const columns = chunk7YSP4V4R_cjs.edgeColumnList(edges2);
|
|
1269
1402
|
return drizzleOrm.sql`
|
|
1270
1403
|
INSERT INTO ${edges2} (${columns})
|
|
1271
1404
|
VALUES (
|
|
1272
1405
|
${params.graphId}, ${params.id}, ${params.kind},
|
|
1273
1406
|
${params.fromKind}, ${params.fromId}, ${params.toKind}, ${params.toId},
|
|
1274
|
-
${propsJson}, ${
|
|
1407
|
+
${propsJson}, ${chunk7YSP4V4R_cjs.sqlNull(chunk7YSP4V4R_cjs.resolveValidFrom(params.validFrom, timestamp2))}, ${chunk7YSP4V4R_cjs.sqlNull(params.validTo)},
|
|
1275
1408
|
${timestamp2}, ${timestamp2}
|
|
1276
1409
|
)
|
|
1277
1410
|
`;
|
|
1278
1411
|
}
|
|
1279
1412
|
function buildInsertEdgesBatch(tables3, params, timestamp2) {
|
|
1280
1413
|
const { edges: edges2 } = tables3;
|
|
1281
|
-
const columns =
|
|
1414
|
+
const columns = chunk7YSP4V4R_cjs.edgeColumnList(edges2);
|
|
1282
1415
|
const values = params.map((edgeParams) => {
|
|
1283
1416
|
const propsJson = JSON.stringify(edgeParams.props);
|
|
1284
|
-
return drizzleOrm.sql`(${edgeParams.graphId}, ${edgeParams.id}, ${edgeParams.kind}, ${edgeParams.fromKind}, ${edgeParams.fromId}, ${edgeParams.toKind}, ${edgeParams.toId}, ${propsJson}, ${
|
|
1417
|
+
return drizzleOrm.sql`(${edgeParams.graphId}, ${edgeParams.id}, ${edgeParams.kind}, ${edgeParams.fromKind}, ${edgeParams.fromId}, ${edgeParams.toKind}, ${edgeParams.toId}, ${propsJson}, ${chunk7YSP4V4R_cjs.sqlNull(chunk7YSP4V4R_cjs.resolveValidFrom(edgeParams.validFrom, timestamp2))}, ${chunk7YSP4V4R_cjs.sqlNull(edgeParams.validTo)}, ${timestamp2}, ${timestamp2})`;
|
|
1285
1418
|
});
|
|
1286
1419
|
return drizzleOrm.sql`
|
|
1287
1420
|
INSERT INTO ${edges2} (${columns})
|
|
@@ -1290,10 +1423,10 @@ function buildInsertEdgesBatch(tables3, params, timestamp2) {
|
|
|
1290
1423
|
}
|
|
1291
1424
|
function buildInsertEdgesBatchReturning(tables3, params, timestamp2) {
|
|
1292
1425
|
const { edges: edges2 } = tables3;
|
|
1293
|
-
const columns =
|
|
1426
|
+
const columns = chunk7YSP4V4R_cjs.edgeColumnList(edges2);
|
|
1294
1427
|
const values = params.map((edgeParams) => {
|
|
1295
1428
|
const propsJson = JSON.stringify(edgeParams.props);
|
|
1296
|
-
return drizzleOrm.sql`(${edgeParams.graphId}, ${edgeParams.id}, ${edgeParams.kind}, ${edgeParams.fromKind}, ${edgeParams.fromId}, ${edgeParams.toKind}, ${edgeParams.toId}, ${propsJson}, ${
|
|
1429
|
+
return drizzleOrm.sql`(${edgeParams.graphId}, ${edgeParams.id}, ${edgeParams.kind}, ${edgeParams.fromKind}, ${edgeParams.fromId}, ${edgeParams.toKind}, ${edgeParams.toId}, ${propsJson}, ${chunk7YSP4V4R_cjs.sqlNull(chunk7YSP4V4R_cjs.resolveValidFrom(edgeParams.validFrom, timestamp2))}, ${chunk7YSP4V4R_cjs.sqlNull(edgeParams.validTo)}, ${timestamp2}, ${timestamp2})`;
|
|
1297
1430
|
});
|
|
1298
1431
|
return drizzleOrm.sql`
|
|
1299
1432
|
INSERT INTO ${edges2} (${columns})
|
|
@@ -1314,21 +1447,21 @@ function buildGetEdges(tables3, graphId, ids) {
|
|
|
1314
1447
|
return drizzleOrm.sql`
|
|
1315
1448
|
SELECT * FROM ${edges2}
|
|
1316
1449
|
WHERE ${edges2.graphId} = ${graphId}
|
|
1317
|
-
AND ${edges2.id} IN (${
|
|
1450
|
+
AND ${edges2.id} IN (${chunkX4JBT642_cjs.sqlValueList(ids)})
|
|
1318
1451
|
`;
|
|
1319
1452
|
}
|
|
1320
1453
|
function buildUpdateEdge(tables3, params, timestamp2) {
|
|
1321
1454
|
const { edges: edges2 } = tables3;
|
|
1322
1455
|
const propsJson = JSON.stringify(params.props);
|
|
1323
1456
|
const setParts = [
|
|
1324
|
-
drizzleOrm.sql`${
|
|
1325
|
-
drizzleOrm.sql`${
|
|
1457
|
+
drizzleOrm.sql`${chunk7YSP4V4R_cjs.quotedColumn(edges2.props)} = ${propsJson}`,
|
|
1458
|
+
drizzleOrm.sql`${chunk7YSP4V4R_cjs.quotedColumn(edges2.updatedAt)} = ${timestamp2}`
|
|
1326
1459
|
];
|
|
1327
1460
|
if (params.validTo !== void 0) {
|
|
1328
|
-
setParts.push(drizzleOrm.sql`${
|
|
1461
|
+
setParts.push(drizzleOrm.sql`${chunk7YSP4V4R_cjs.quotedColumn(edges2.validTo)} = ${params.validTo}`);
|
|
1329
1462
|
}
|
|
1330
1463
|
if (params.clearDeleted) {
|
|
1331
|
-
setParts.push(drizzleOrm.sql`${
|
|
1464
|
+
setParts.push(drizzleOrm.sql`${chunk7YSP4V4R_cjs.quotedColumn(edges2.deletedAt)} = NULL`);
|
|
1332
1465
|
}
|
|
1333
1466
|
const setClause = drizzleOrm.sql.join(setParts, drizzleOrm.sql`, `);
|
|
1334
1467
|
if (params.clearDeleted) {
|
|
@@ -1353,12 +1486,30 @@ function buildDeleteEdge(tables3, params, timestamp2) {
|
|
|
1353
1486
|
const { edges: edges2 } = tables3;
|
|
1354
1487
|
return drizzleOrm.sql`
|
|
1355
1488
|
UPDATE ${edges2}
|
|
1356
|
-
SET ${
|
|
1489
|
+
SET ${chunk7YSP4V4R_cjs.quotedColumn(edges2.deletedAt)} = ${timestamp2}
|
|
1357
1490
|
WHERE ${edges2.graphId} = ${params.graphId}
|
|
1358
1491
|
AND ${edges2.id} = ${params.id}
|
|
1359
1492
|
AND ${edges2.deletedAt} IS NULL
|
|
1360
1493
|
`;
|
|
1361
1494
|
}
|
|
1495
|
+
function buildDeleteEdgesBatch(tables3, params, timestamp2) {
|
|
1496
|
+
const { edges: edges2 } = tables3;
|
|
1497
|
+
return drizzleOrm.sql`
|
|
1498
|
+
UPDATE ${edges2}
|
|
1499
|
+
SET ${chunk7YSP4V4R_cjs.quotedColumn(edges2.deletedAt)} = ${timestamp2}
|
|
1500
|
+
WHERE ${edges2.graphId} = ${params.graphId}
|
|
1501
|
+
AND ${edges2.id} IN (${chunkX4JBT642_cjs.sqlValueList(params.ids)})
|
|
1502
|
+
AND ${edges2.deletedAt} IS NULL
|
|
1503
|
+
`;
|
|
1504
|
+
}
|
|
1505
|
+
function buildHardDeleteEdgesBatch(tables3, params) {
|
|
1506
|
+
const { edges: edges2 } = tables3;
|
|
1507
|
+
return drizzleOrm.sql`
|
|
1508
|
+
DELETE FROM ${edges2}
|
|
1509
|
+
WHERE ${edges2.graphId} = ${params.graphId}
|
|
1510
|
+
AND ${edges2.id} IN (${chunkX4JBT642_cjs.sqlValueList(params.ids)})
|
|
1511
|
+
`;
|
|
1512
|
+
}
|
|
1362
1513
|
function buildHardDeleteEdge(tables3, params) {
|
|
1363
1514
|
const { edges: edges2 } = tables3;
|
|
1364
1515
|
return drizzleOrm.sql`
|
|
@@ -1437,10 +1588,10 @@ function buildFindEdgesConnectedTo(tables3, params) {
|
|
|
1437
1588
|
function resolveMode(mode) {
|
|
1438
1589
|
return mode ?? "websearch";
|
|
1439
1590
|
}
|
|
1440
|
-
function buildFulltextSearch(tableName, params, strategy) {
|
|
1591
|
+
function buildFulltextSearch(tableName, params, strategy, dialect, candidates) {
|
|
1441
1592
|
assertValidSearchParams(params);
|
|
1442
1593
|
const mode = resolveMode(params.mode);
|
|
1443
|
-
const table =
|
|
1594
|
+
const table = chunk7YSP4V4R_cjs.quotedTableName(tableName);
|
|
1444
1595
|
const matchCondition = strategy.matchCondition(
|
|
1445
1596
|
tableName,
|
|
1446
1597
|
params.query,
|
|
@@ -1461,12 +1612,16 @@ function buildFulltextSearch(tableName, params, strategy) {
|
|
|
1461
1612
|
if (params.minScore !== void 0) {
|
|
1462
1613
|
conditions.push(drizzleOrm.sql`${rankExpression} >= ${params.minScore}`);
|
|
1463
1614
|
}
|
|
1615
|
+
if (candidates !== void 0) {
|
|
1616
|
+
conditions.push(drizzleOrm.sql`"node_id" IN (${candidates})`);
|
|
1617
|
+
}
|
|
1464
1618
|
const snippetExpr = params.includeSnippets === true && strategy.supportsSnippets ? strategy.snippetExpression(
|
|
1465
1619
|
tableName,
|
|
1466
1620
|
params.query,
|
|
1467
1621
|
mode,
|
|
1468
1622
|
params.language
|
|
1469
1623
|
) : drizzleOrm.sql`NULL`;
|
|
1624
|
+
const pageClause = params.offset === void 0 || params.offset === 0 ? drizzleOrm.sql`LIMIT ${params.limit}` : drizzleOrm.sql`LIMIT ${params.limit} OFFSET ${params.offset}`;
|
|
1470
1625
|
return drizzleOrm.sql`
|
|
1471
1626
|
SELECT
|
|
1472
1627
|
"node_id" AS node_id,
|
|
@@ -1474,8 +1629,8 @@ function buildFulltextSearch(tableName, params, strategy) {
|
|
|
1474
1629
|
${snippetExpr} AS snippet
|
|
1475
1630
|
FROM ${table}
|
|
1476
1631
|
WHERE ${drizzleOrm.sql.join(conditions, drizzleOrm.sql` AND `)}
|
|
1477
|
-
ORDER BY ${rankExpression} DESC, "node_id" ASC
|
|
1478
|
-
|
|
1632
|
+
ORDER BY ${rankExpression} DESC, ${chunk7YSP4V4R_cjs.codePointOrderKey(drizzleOrm.sql.raw('"node_id"'), dialect)} ASC
|
|
1633
|
+
${pageClause}
|
|
1479
1634
|
`;
|
|
1480
1635
|
}
|
|
1481
1636
|
function assertValidSearchParams(params) {
|
|
@@ -1491,12 +1646,12 @@ function assertValidSearchParams(params) {
|
|
|
1491
1646
|
function buildInsertNode(tables3, params, timestamp2) {
|
|
1492
1647
|
const { nodes: nodes2 } = tables3;
|
|
1493
1648
|
const propsJson = JSON.stringify(params.props);
|
|
1494
|
-
const columns =
|
|
1649
|
+
const columns = chunk7YSP4V4R_cjs.nodeColumnList(nodes2);
|
|
1495
1650
|
return drizzleOrm.sql`
|
|
1496
1651
|
INSERT INTO ${nodes2} (${columns})
|
|
1497
1652
|
VALUES (
|
|
1498
1653
|
${params.graphId}, ${params.kind}, ${params.id}, ${propsJson},
|
|
1499
|
-
1, ${
|
|
1654
|
+
1, ${chunk7YSP4V4R_cjs.sqlNull(chunk7YSP4V4R_cjs.resolveValidFrom(params.validFrom, timestamp2))}, ${chunk7YSP4V4R_cjs.sqlNull(params.validTo)},
|
|
1500
1655
|
${timestamp2}, ${timestamp2}
|
|
1501
1656
|
)
|
|
1502
1657
|
RETURNING *
|
|
@@ -1505,22 +1660,22 @@ function buildInsertNode(tables3, params, timestamp2) {
|
|
|
1505
1660
|
function buildInsertNodeNoReturn(tables3, params, timestamp2) {
|
|
1506
1661
|
const { nodes: nodes2 } = tables3;
|
|
1507
1662
|
const propsJson = JSON.stringify(params.props);
|
|
1508
|
-
const columns =
|
|
1663
|
+
const columns = chunk7YSP4V4R_cjs.nodeColumnList(nodes2);
|
|
1509
1664
|
return drizzleOrm.sql`
|
|
1510
1665
|
INSERT INTO ${nodes2} (${columns})
|
|
1511
1666
|
VALUES (
|
|
1512
1667
|
${params.graphId}, ${params.kind}, ${params.id}, ${propsJson},
|
|
1513
|
-
1, ${
|
|
1668
|
+
1, ${chunk7YSP4V4R_cjs.sqlNull(chunk7YSP4V4R_cjs.resolveValidFrom(params.validFrom, timestamp2))}, ${chunk7YSP4V4R_cjs.sqlNull(params.validTo)},
|
|
1514
1669
|
${timestamp2}, ${timestamp2}
|
|
1515
1670
|
)
|
|
1516
1671
|
`;
|
|
1517
1672
|
}
|
|
1518
1673
|
function buildInsertNodesBatch(tables3, params, timestamp2) {
|
|
1519
1674
|
const { nodes: nodes2 } = tables3;
|
|
1520
|
-
const columns =
|
|
1675
|
+
const columns = chunk7YSP4V4R_cjs.nodeColumnList(nodes2);
|
|
1521
1676
|
const values = params.map((nodeParams) => {
|
|
1522
1677
|
const propsJson = JSON.stringify(nodeParams.props);
|
|
1523
|
-
return drizzleOrm.sql`(${nodeParams.graphId}, ${nodeParams.kind}, ${nodeParams.id}, ${propsJson}, 1, ${
|
|
1678
|
+
return drizzleOrm.sql`(${nodeParams.graphId}, ${nodeParams.kind}, ${nodeParams.id}, ${propsJson}, 1, ${chunk7YSP4V4R_cjs.sqlNull(chunk7YSP4V4R_cjs.resolveValidFrom(nodeParams.validFrom, timestamp2))}, ${chunk7YSP4V4R_cjs.sqlNull(nodeParams.validTo)}, ${timestamp2}, ${timestamp2})`;
|
|
1524
1679
|
});
|
|
1525
1680
|
return drizzleOrm.sql`
|
|
1526
1681
|
INSERT INTO ${nodes2} (${columns})
|
|
@@ -1529,10 +1684,10 @@ function buildInsertNodesBatch(tables3, params, timestamp2) {
|
|
|
1529
1684
|
}
|
|
1530
1685
|
function buildInsertNodesBatchReturning(tables3, params, timestamp2) {
|
|
1531
1686
|
const { nodes: nodes2 } = tables3;
|
|
1532
|
-
const columns =
|
|
1687
|
+
const columns = chunk7YSP4V4R_cjs.nodeColumnList(nodes2);
|
|
1533
1688
|
const values = params.map((nodeParams) => {
|
|
1534
1689
|
const propsJson = JSON.stringify(nodeParams.props);
|
|
1535
|
-
return drizzleOrm.sql`(${nodeParams.graphId}, ${nodeParams.kind}, ${nodeParams.id}, ${propsJson}, 1, ${
|
|
1690
|
+
return drizzleOrm.sql`(${nodeParams.graphId}, ${nodeParams.kind}, ${nodeParams.id}, ${propsJson}, 1, ${chunk7YSP4V4R_cjs.sqlNull(chunk7YSP4V4R_cjs.resolveValidFrom(nodeParams.validFrom, timestamp2))}, ${chunk7YSP4V4R_cjs.sqlNull(nodeParams.validTo)}, ${timestamp2}, ${timestamp2})`;
|
|
1536
1691
|
});
|
|
1537
1692
|
return drizzleOrm.sql`
|
|
1538
1693
|
INSERT INTO ${nodes2} (${columns})
|
|
@@ -1555,26 +1710,26 @@ function buildGetNodes(tables3, graphId, kind, ids) {
|
|
|
1555
1710
|
SELECT * FROM ${nodes2}
|
|
1556
1711
|
WHERE ${nodes2.graphId} = ${graphId}
|
|
1557
1712
|
AND ${nodes2.kind} = ${kind}
|
|
1558
|
-
AND ${nodes2.id} IN (${
|
|
1713
|
+
AND ${nodes2.id} IN (${chunkX4JBT642_cjs.sqlValueList(ids)})
|
|
1559
1714
|
`;
|
|
1560
1715
|
}
|
|
1561
1716
|
function buildUpdateNode(tables3, params, timestamp2) {
|
|
1562
1717
|
const { nodes: nodes2 } = tables3;
|
|
1563
1718
|
const propsJson = JSON.stringify(params.props);
|
|
1564
1719
|
const setParts = [
|
|
1565
|
-
drizzleOrm.sql`${
|
|
1566
|
-
drizzleOrm.sql`${
|
|
1720
|
+
drizzleOrm.sql`${chunk7YSP4V4R_cjs.quotedColumn(nodes2.props)} = ${propsJson}`,
|
|
1721
|
+
drizzleOrm.sql`${chunk7YSP4V4R_cjs.quotedColumn(nodes2.updatedAt)} = ${timestamp2}`
|
|
1567
1722
|
];
|
|
1568
1723
|
if (params.incrementVersion) {
|
|
1569
1724
|
setParts.push(
|
|
1570
|
-
drizzleOrm.sql`${
|
|
1725
|
+
drizzleOrm.sql`${chunk7YSP4V4R_cjs.quotedColumn(nodes2.version)} = ${chunk7YSP4V4R_cjs.quotedColumn(nodes2.version)} + 1`
|
|
1571
1726
|
);
|
|
1572
1727
|
}
|
|
1573
1728
|
if (params.validTo !== void 0) {
|
|
1574
|
-
setParts.push(drizzleOrm.sql`${
|
|
1729
|
+
setParts.push(drizzleOrm.sql`${chunk7YSP4V4R_cjs.quotedColumn(nodes2.validTo)} = ${params.validTo}`);
|
|
1575
1730
|
}
|
|
1576
1731
|
if (params.clearDeleted) {
|
|
1577
|
-
setParts.push(drizzleOrm.sql`${
|
|
1732
|
+
setParts.push(drizzleOrm.sql`${chunk7YSP4V4R_cjs.quotedColumn(nodes2.deletedAt)} = NULL`);
|
|
1578
1733
|
}
|
|
1579
1734
|
const setClause = drizzleOrm.sql.join(setParts, drizzleOrm.sql`, `);
|
|
1580
1735
|
if (params.clearDeleted) {
|
|
@@ -1601,7 +1756,7 @@ function buildDeleteNode(tables3, params, timestamp2) {
|
|
|
1601
1756
|
const { nodes: nodes2 } = tables3;
|
|
1602
1757
|
return drizzleOrm.sql`
|
|
1603
1758
|
UPDATE ${nodes2}
|
|
1604
|
-
SET ${
|
|
1759
|
+
SET ${chunk7YSP4V4R_cjs.quotedColumn(nodes2.deletedAt)} = ${timestamp2}
|
|
1605
1760
|
WHERE ${nodes2.graphId} = ${params.graphId}
|
|
1606
1761
|
AND ${nodes2.kind} = ${params.kind}
|
|
1607
1762
|
AND ${nodes2.id} = ${params.id}
|
|
@@ -1668,12 +1823,12 @@ function buildSetActiveSchema(tables3, graphId, version, dialect = "sqlite") {
|
|
|
1668
1823
|
const strategy = SCHEMA_DIALECT_STRATEGIES[dialect];
|
|
1669
1824
|
const deactivateAll = drizzleOrm.sql`
|
|
1670
1825
|
UPDATE ${schemaVersions2}
|
|
1671
|
-
SET ${
|
|
1826
|
+
SET ${chunk7YSP4V4R_cjs.quotedColumn(schemaVersions2.isActive)} = ${strategy.booleanLiteral(false)}
|
|
1672
1827
|
WHERE ${schemaVersions2.graphId} = ${graphId}
|
|
1673
1828
|
`;
|
|
1674
1829
|
const activateVersion = drizzleOrm.sql`
|
|
1675
1830
|
UPDATE ${schemaVersions2}
|
|
1676
|
-
SET ${
|
|
1831
|
+
SET ${chunk7YSP4V4R_cjs.quotedColumn(schemaVersions2.isActive)} = ${strategy.booleanLiteral(true)}
|
|
1677
1832
|
WHERE ${schemaVersions2.graphId} = ${graphId}
|
|
1678
1833
|
AND ${schemaVersions2.version} = ${version}
|
|
1679
1834
|
`;
|
|
@@ -1691,22 +1846,22 @@ function buildInsertUniqueSqlite(tables3, params) {
|
|
|
1691
1846
|
)
|
|
1692
1847
|
ON CONFLICT (${conflictColumns})
|
|
1693
1848
|
DO UPDATE SET
|
|
1694
|
-
${
|
|
1695
|
-
WHEN ${
|
|
1696
|
-
WHEN ${
|
|
1697
|
-
ELSE ${
|
|
1849
|
+
${chunk7YSP4V4R_cjs.quotedColumn(uniques2.nodeId)} = CASE
|
|
1850
|
+
WHEN ${chunk7YSP4V4R_cjs.quotedColumn(uniques2.nodeId)} = ${params.nodeId} THEN ${params.nodeId}
|
|
1851
|
+
WHEN ${chunk7YSP4V4R_cjs.quotedColumn(uniques2.deletedAt)} IS NOT NULL THEN ${params.nodeId}
|
|
1852
|
+
ELSE ${chunk7YSP4V4R_cjs.quotedColumn(uniques2.nodeId)}
|
|
1698
1853
|
END,
|
|
1699
|
-
${
|
|
1700
|
-
WHEN ${
|
|
1701
|
-
WHEN ${
|
|
1702
|
-
ELSE ${
|
|
1854
|
+
${chunk7YSP4V4R_cjs.quotedColumn(uniques2.concreteKind)} = CASE
|
|
1855
|
+
WHEN ${chunk7YSP4V4R_cjs.quotedColumn(uniques2.nodeId)} = ${params.nodeId} THEN ${params.concreteKind}
|
|
1856
|
+
WHEN ${chunk7YSP4V4R_cjs.quotedColumn(uniques2.deletedAt)} IS NOT NULL THEN ${params.concreteKind}
|
|
1857
|
+
ELSE ${chunk7YSP4V4R_cjs.quotedColumn(uniques2.concreteKind)}
|
|
1703
1858
|
END,
|
|
1704
|
-
${
|
|
1705
|
-
WHEN ${
|
|
1706
|
-
WHEN ${
|
|
1707
|
-
ELSE ${
|
|
1859
|
+
${chunk7YSP4V4R_cjs.quotedColumn(uniques2.deletedAt)} = CASE
|
|
1860
|
+
WHEN ${chunk7YSP4V4R_cjs.quotedColumn(uniques2.nodeId)} = ${params.nodeId} THEN NULL
|
|
1861
|
+
WHEN ${chunk7YSP4V4R_cjs.quotedColumn(uniques2.deletedAt)} IS NOT NULL THEN NULL
|
|
1862
|
+
ELSE ${chunk7YSP4V4R_cjs.quotedColumn(uniques2.deletedAt)}
|
|
1708
1863
|
END
|
|
1709
|
-
RETURNING ${
|
|
1864
|
+
RETURNING ${chunk7YSP4V4R_cjs.quotedColumn(uniques2.nodeId)} as node_id
|
|
1710
1865
|
`;
|
|
1711
1866
|
}
|
|
1712
1867
|
function buildInsertUniquePostgres(tables3, params) {
|
|
@@ -1723,22 +1878,22 @@ function buildInsertUniquePostgres(tables3, params) {
|
|
|
1723
1878
|
)
|
|
1724
1879
|
ON CONFLICT (${conflictColumns})
|
|
1725
1880
|
DO UPDATE SET
|
|
1726
|
-
${
|
|
1881
|
+
${chunk7YSP4V4R_cjs.quotedColumn(uniques2.nodeId)} = CASE
|
|
1727
1882
|
WHEN ${existingColumn(uniques2.nodeId)} = ${params.nodeId} THEN ${params.nodeId}
|
|
1728
1883
|
WHEN ${existingColumn(uniques2.deletedAt)} IS NOT NULL THEN ${params.nodeId}
|
|
1729
1884
|
ELSE ${existingColumn(uniques2.nodeId)}
|
|
1730
1885
|
END,
|
|
1731
|
-
${
|
|
1886
|
+
${chunk7YSP4V4R_cjs.quotedColumn(uniques2.concreteKind)} = CASE
|
|
1732
1887
|
WHEN ${existingColumn(uniques2.nodeId)} = ${params.nodeId} THEN ${params.concreteKind}
|
|
1733
1888
|
WHEN ${existingColumn(uniques2.deletedAt)} IS NOT NULL THEN ${params.concreteKind}
|
|
1734
1889
|
ELSE ${existingColumn(uniques2.concreteKind)}
|
|
1735
1890
|
END,
|
|
1736
|
-
${
|
|
1891
|
+
${chunk7YSP4V4R_cjs.quotedColumn(uniques2.deletedAt)} = CASE
|
|
1737
1892
|
WHEN ${existingColumn(uniques2.nodeId)} = ${params.nodeId} THEN NULL
|
|
1738
1893
|
WHEN ${existingColumn(uniques2.deletedAt)} IS NOT NULL THEN NULL
|
|
1739
1894
|
ELSE ${existingColumn(uniques2.deletedAt)}
|
|
1740
1895
|
END
|
|
1741
|
-
RETURNING ${
|
|
1896
|
+
RETURNING ${chunk7YSP4V4R_cjs.quotedColumn(uniques2.nodeId)} as node_id
|
|
1742
1897
|
`;
|
|
1743
1898
|
}
|
|
1744
1899
|
var UNIQUE_INSERT_BUILDERS = {
|
|
@@ -1749,11 +1904,55 @@ function buildInsertUnique(tables3, dialect, params) {
|
|
|
1749
1904
|
const builder = UNIQUE_INSERT_BUILDERS[dialect];
|
|
1750
1905
|
return builder(tables3, params);
|
|
1751
1906
|
}
|
|
1907
|
+
function buildInsertUniqueBatch(tables3, dialect, entries) {
|
|
1908
|
+
const { uniques: uniques2 } = tables3;
|
|
1909
|
+
const columns = drizzleOrm.sql.raw(
|
|
1910
|
+
`"${uniques2.graphId.name}", "${uniques2.nodeKind.name}", "${uniques2.constraintName.name}", "${uniques2.key.name}", "${uniques2.nodeId.name}", "${uniques2.concreteKind.name}", "${uniques2.deletedAt.name}"`
|
|
1911
|
+
);
|
|
1912
|
+
const conflictColumns = drizzleOrm.sql.raw(
|
|
1913
|
+
`"${uniques2.graphId.name}", "${uniques2.nodeKind.name}", "${uniques2.constraintName.name}", "${uniques2.key.name}"`
|
|
1914
|
+
);
|
|
1915
|
+
const tableName = drizzleOrm.getTableName(uniques2);
|
|
1916
|
+
const existingColumn = (column) => dialect === "postgres" ? drizzleOrm.sql.raw(`"${tableName}"."${column.name}"`) : drizzleOrm.sql.raw(`"${column.name}"`);
|
|
1917
|
+
const excludedColumn = (column) => drizzleOrm.sql.raw(`excluded."${column.name}"`);
|
|
1918
|
+
const valueRows = drizzleOrm.sql.join(
|
|
1919
|
+
entries.map(
|
|
1920
|
+
(params) => drizzleOrm.sql`(${params.graphId}, ${params.nodeKind}, ${params.constraintName}, ${params.key}, ${params.nodeId}, ${params.concreteKind}, ${drizzleOrm.sql.raw("NULL")})`
|
|
1921
|
+
),
|
|
1922
|
+
drizzleOrm.sql`, `
|
|
1923
|
+
);
|
|
1924
|
+
return drizzleOrm.sql`
|
|
1925
|
+
INSERT INTO ${uniques2} (${columns})
|
|
1926
|
+
VALUES ${valueRows}
|
|
1927
|
+
ON CONFLICT (${conflictColumns})
|
|
1928
|
+
DO UPDATE SET
|
|
1929
|
+
${chunk7YSP4V4R_cjs.quotedColumn(uniques2.nodeId)} = CASE
|
|
1930
|
+
WHEN ${existingColumn(uniques2.nodeId)} = ${excludedColumn(uniques2.nodeId)} THEN ${excludedColumn(uniques2.nodeId)}
|
|
1931
|
+
WHEN ${existingColumn(uniques2.deletedAt)} IS NOT NULL THEN ${excludedColumn(uniques2.nodeId)}
|
|
1932
|
+
ELSE ${existingColumn(uniques2.nodeId)}
|
|
1933
|
+
END,
|
|
1934
|
+
${chunk7YSP4V4R_cjs.quotedColumn(uniques2.concreteKind)} = CASE
|
|
1935
|
+
WHEN ${existingColumn(uniques2.nodeId)} = ${excludedColumn(uniques2.nodeId)} THEN ${excludedColumn(uniques2.concreteKind)}
|
|
1936
|
+
WHEN ${existingColumn(uniques2.deletedAt)} IS NOT NULL THEN ${excludedColumn(uniques2.concreteKind)}
|
|
1937
|
+
ELSE ${existingColumn(uniques2.concreteKind)}
|
|
1938
|
+
END,
|
|
1939
|
+
${chunk7YSP4V4R_cjs.quotedColumn(uniques2.deletedAt)} = CASE
|
|
1940
|
+
WHEN ${existingColumn(uniques2.nodeId)} = ${excludedColumn(uniques2.nodeId)} THEN NULL
|
|
1941
|
+
WHEN ${existingColumn(uniques2.deletedAt)} IS NOT NULL THEN NULL
|
|
1942
|
+
ELSE ${existingColumn(uniques2.deletedAt)}
|
|
1943
|
+
END
|
|
1944
|
+
RETURNING
|
|
1945
|
+
${chunk7YSP4V4R_cjs.quotedColumn(uniques2.nodeKind)} as node_kind,
|
|
1946
|
+
${chunk7YSP4V4R_cjs.quotedColumn(uniques2.constraintName)} as constraint_name,
|
|
1947
|
+
${chunk7YSP4V4R_cjs.quotedColumn(uniques2.key)} as key,
|
|
1948
|
+
${chunk7YSP4V4R_cjs.quotedColumn(uniques2.nodeId)} as node_id
|
|
1949
|
+
`;
|
|
1950
|
+
}
|
|
1752
1951
|
function buildDeleteUnique(tables3, params, timestamp2) {
|
|
1753
1952
|
const { uniques: uniques2 } = tables3;
|
|
1754
1953
|
return drizzleOrm.sql`
|
|
1755
1954
|
UPDATE ${uniques2}
|
|
1756
|
-
SET ${
|
|
1955
|
+
SET ${chunk7YSP4V4R_cjs.quotedColumn(uniques2.deletedAt)} = ${timestamp2}
|
|
1757
1956
|
WHERE ${uniques2.graphId} = ${params.graphId}
|
|
1758
1957
|
AND ${uniques2.nodeKind} = ${params.nodeKind}
|
|
1759
1958
|
AND ${uniques2.constraintName} = ${params.constraintName}
|
|
@@ -1842,7 +2041,9 @@ var COMMON_TABLE_OPERATION_BUILDERS = {
|
|
|
1842
2041
|
buildGetEdges,
|
|
1843
2042
|
buildUpdateEdge,
|
|
1844
2043
|
buildDeleteEdge,
|
|
2044
|
+
buildDeleteEdgesBatch,
|
|
1845
2045
|
buildHardDeleteEdge,
|
|
2046
|
+
buildHardDeleteEdgesBatch,
|
|
1846
2047
|
buildHardDeleteEdgesByNode,
|
|
1847
2048
|
buildCountEdgesFrom,
|
|
1848
2049
|
buildEdgeExistsBetween,
|
|
@@ -1873,7 +2074,57 @@ function createCommonOperationStrategy(tables3, dialect, fulltextStrategy) {
|
|
|
1873
2074
|
}),
|
|
1874
2075
|
buildUpsertFulltextBatch: (params, timestamp2) => fulltextStrategy.buildBatchUpsert(fulltextTable, params, timestamp2),
|
|
1875
2076
|
buildDeleteFulltextBatch: (params) => fulltextStrategy.buildBatchDelete(fulltextTable, params),
|
|
1876
|
-
buildFulltextSearch: (params) => buildFulltextSearch(
|
|
2077
|
+
buildFulltextSearch: (params) => buildFulltextSearch(
|
|
2078
|
+
fulltextTable,
|
|
2079
|
+
params,
|
|
2080
|
+
fulltextStrategy,
|
|
2081
|
+
dialect,
|
|
2082
|
+
// Store-compiled candidates (predicates + subclass + currency)
|
|
2083
|
+
// take precedence; the live-node default covers direct backend use.
|
|
2084
|
+
params.candidates ?? chunk7YSP4V4R_cjs.liveNodeIdsSubquery(tables3.nodes, params.graphId, params.nodeKind, chunk5W4L6DLF_cjs.nowIso())
|
|
2085
|
+
),
|
|
2086
|
+
buildLiveNodeIds: (graphId, nodeKind) => chunk7YSP4V4R_cjs.liveNodeIdsSubquery(tables3.nodes, graphId, nodeKind, chunk5W4L6DLF_cjs.nowIso()),
|
|
2087
|
+
buildHybridSearch: (params, vectorSql, vectorScoreDescending) => {
|
|
2088
|
+
const candidates = params.candidates ?? chunk7YSP4V4R_cjs.liveNodeIdsSubquery(
|
|
2089
|
+
tables3.nodes,
|
|
2090
|
+
params.graphId,
|
|
2091
|
+
params.nodeKind,
|
|
2092
|
+
chunk5W4L6DLF_cjs.nowIso()
|
|
2093
|
+
);
|
|
2094
|
+
const fulltextSql = buildFulltextSearch(
|
|
2095
|
+
fulltextTable,
|
|
2096
|
+
{
|
|
2097
|
+
graphId: params.graphId,
|
|
2098
|
+
nodeKind: params.nodeKind,
|
|
2099
|
+
query: params.fulltext.query,
|
|
2100
|
+
limit: params.fulltext.k,
|
|
2101
|
+
...params.fulltext.mode === void 0 ? {} : { mode: params.fulltext.mode },
|
|
2102
|
+
...params.fulltext.language === void 0 ? {} : { language: params.fulltext.language },
|
|
2103
|
+
...params.fulltext.minScore === void 0 ? {} : { minScore: params.fulltext.minScore },
|
|
2104
|
+
...params.fulltext.includeSnippets === void 0 ? {} : { includeSnippets: params.fulltext.includeSnippets }
|
|
2105
|
+
},
|
|
2106
|
+
fulltextStrategy,
|
|
2107
|
+
dialect,
|
|
2108
|
+
// Reference, not copy: the statement evaluates the shared
|
|
2109
|
+
// tg_hybrid_cand CTE once for both legs.
|
|
2110
|
+
hybridCandidatesRef()
|
|
2111
|
+
);
|
|
2112
|
+
return buildHybridSearchStatement({
|
|
2113
|
+
candidatesSql: candidates,
|
|
2114
|
+
vectorSql,
|
|
2115
|
+
vectorScoreDescending,
|
|
2116
|
+
fulltextSql,
|
|
2117
|
+
nodes: tables3.nodes,
|
|
2118
|
+
dialect,
|
|
2119
|
+
graphId: params.graphId,
|
|
2120
|
+
nodeKind: params.nodeKind,
|
|
2121
|
+
fusionK: params.fusion.k,
|
|
2122
|
+
vectorWeight: params.fusion.vectorWeight,
|
|
2123
|
+
fulltextWeight: params.fusion.fulltextWeight,
|
|
2124
|
+
limit: params.limit,
|
|
2125
|
+
offset: params.offset ?? 0
|
|
2126
|
+
});
|
|
2127
|
+
}
|
|
1877
2128
|
};
|
|
1878
2129
|
return {
|
|
1879
2130
|
...tableOperations,
|
|
@@ -1881,6 +2132,9 @@ function createCommonOperationStrategy(tables3, dialect, fulltextStrategy) {
|
|
|
1881
2132
|
buildInsertUnique(params) {
|
|
1882
2133
|
return buildInsertUnique(tables3, dialect, params);
|
|
1883
2134
|
},
|
|
2135
|
+
buildInsertUniqueBatch(entries) {
|
|
2136
|
+
return buildInsertUniqueBatch(tables3, dialect, entries);
|
|
2137
|
+
},
|
|
1884
2138
|
buildGetActiveSchema(graphId) {
|
|
1885
2139
|
return buildGetActiveSchema(tables3, graphId, dialect);
|
|
1886
2140
|
},
|
|
@@ -1910,7 +2164,7 @@ function createCommonOperationStrategy(tables3, dialect, fulltextStrategy) {
|
|
|
1910
2164
|
}
|
|
1911
2165
|
function tableExistsFromRow(row) {
|
|
1912
2166
|
if (row === void 0) return false;
|
|
1913
|
-
return Object.values(row).some((value) =>
|
|
2167
|
+
return Object.values(row).some((value) => chunkX4JBT642_cjs.isPresent(value));
|
|
1914
2168
|
}
|
|
1915
2169
|
function createCachedTableExistence(probe, options) {
|
|
1916
2170
|
const cacheExisting = options?.cacheExisting !== false;
|
|
@@ -1939,7 +2193,7 @@ function createPostgresOperationStrategy(tables3, fulltextStrategy) {
|
|
|
1939
2193
|
function assertAdoptedDialect(externalTx, brand, backend) {
|
|
1940
2194
|
if (drizzleOrm.is(externalTx, brand)) return;
|
|
1941
2195
|
const label = backend === "postgres" ? "Postgres" : "SQLite";
|
|
1942
|
-
throw new
|
|
2196
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(
|
|
1943
2197
|
`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.`,
|
|
1944
2198
|
{ backend, capability: "adoptTransaction" }
|
|
1945
2199
|
);
|
|
@@ -1947,7 +2201,7 @@ function assertAdoptedDialect(externalTx, brand, backend) {
|
|
|
1947
2201
|
function verifyExpectedActiveVersion(graphId, expected, actualActiveVersion) {
|
|
1948
2202
|
const expectedVersion = expected.kind === "active" ? expected.version : 0;
|
|
1949
2203
|
if (actualActiveVersion !== expectedVersion) {
|
|
1950
|
-
throw new
|
|
2204
|
+
throw new chunkDIK74MXX_cjs.StaleVersionError({
|
|
1951
2205
|
graphId,
|
|
1952
2206
|
expected: expectedVersion,
|
|
1953
2207
|
actual: actualActiveVersion
|
|
@@ -1956,7 +2210,7 @@ function verifyExpectedActiveVersion(graphId, expected, actualActiveVersion) {
|
|
|
1956
2210
|
}
|
|
1957
2211
|
function createCommonOperationBackend(options) {
|
|
1958
2212
|
const { batchConfig, execution, operationStrategy, rowMappers } = options;
|
|
1959
|
-
const nowIso2 = options.nowIso ??
|
|
2213
|
+
const nowIso2 = options.nowIso ?? chunk5W4L6DLF_cjs.nowIso;
|
|
1960
2214
|
const requiredClearTableExists = createCachedTableExistence(
|
|
1961
2215
|
(tableName) => execution.execGet(
|
|
1962
2216
|
operationStrategy.buildTableExists(tableName)
|
|
@@ -1983,7 +2237,7 @@ function createCommonOperationBackend(options) {
|
|
|
1983
2237
|
const timestamp2 = nowIso2();
|
|
1984
2238
|
const query = operationStrategy.buildInsertNode(params, timestamp2);
|
|
1985
2239
|
const row = await execution.execGet(query);
|
|
1986
|
-
if (!row) throw new
|
|
2240
|
+
if (!row) throw new chunkDIK74MXX_cjs.DatabaseOperationError("Insert node failed: no row returned", { operation: "insert", entity: "node" });
|
|
1987
2241
|
return rowMappers.toNodeRow(row);
|
|
1988
2242
|
},
|
|
1989
2243
|
async insertNodeNoReturn(params) {
|
|
@@ -1996,7 +2250,7 @@ function createCommonOperationBackend(options) {
|
|
|
1996
2250
|
return;
|
|
1997
2251
|
}
|
|
1998
2252
|
const timestamp2 = nowIso2();
|
|
1999
|
-
for (const chunk2 of
|
|
2253
|
+
for (const chunk2 of chunkX4JBT642_cjs.chunk(params, batchConfig.nodeInsertBatchSize)) {
|
|
2000
2254
|
const query = operationStrategy.buildInsertNodesBatch(chunk2, timestamp2);
|
|
2001
2255
|
await execution.execRun(query);
|
|
2002
2256
|
}
|
|
@@ -2007,7 +2261,7 @@ function createCommonOperationBackend(options) {
|
|
|
2007
2261
|
}
|
|
2008
2262
|
const timestamp2 = nowIso2();
|
|
2009
2263
|
const allRows = [];
|
|
2010
|
-
for (const chunk2 of
|
|
2264
|
+
for (const chunk2 of chunkX4JBT642_cjs.chunk(params, batchConfig.nodeInsertBatchSize)) {
|
|
2011
2265
|
const query = operationStrategy.buildInsertNodesBatchReturning(chunk2, timestamp2);
|
|
2012
2266
|
const rows = await execution.execAll(query);
|
|
2013
2267
|
allRows.push(...rows.map((row) => rowMappers.toNodeRow(row)));
|
|
@@ -2022,7 +2276,7 @@ function createCommonOperationBackend(options) {
|
|
|
2022
2276
|
async getNodes(graphId, kind, ids) {
|
|
2023
2277
|
if (ids.length === 0) return [];
|
|
2024
2278
|
const allRows = [];
|
|
2025
|
-
for (const chunk2 of
|
|
2279
|
+
for (const chunk2 of chunkX4JBT642_cjs.chunk(ids, batchConfig.getNodesChunkSize)) {
|
|
2026
2280
|
const query = operationStrategy.buildGetNodes(graphId, kind, chunk2);
|
|
2027
2281
|
const rows = await execution.execAll(query);
|
|
2028
2282
|
allRows.push(...rows.map((row) => rowMappers.toNodeRow(row)));
|
|
@@ -2033,7 +2287,7 @@ function createCommonOperationBackend(options) {
|
|
|
2033
2287
|
const timestamp2 = nowIso2();
|
|
2034
2288
|
const query = operationStrategy.buildUpdateNode(params, timestamp2);
|
|
2035
2289
|
const row = await execution.execGet(query);
|
|
2036
|
-
if (!row) throw new
|
|
2290
|
+
if (!row) throw new chunkDIK74MXX_cjs.DatabaseOperationError("Update node failed: no row returned", { operation: "update", entity: "node" });
|
|
2037
2291
|
return rowMappers.toNodeRow(row);
|
|
2038
2292
|
},
|
|
2039
2293
|
async deleteNode(params) {
|
|
@@ -2077,7 +2331,7 @@ function createCommonOperationBackend(options) {
|
|
|
2077
2331
|
const timestamp2 = nowIso2();
|
|
2078
2332
|
const query = operationStrategy.buildInsertEdge(params, timestamp2);
|
|
2079
2333
|
const row = await execution.execGet(query);
|
|
2080
|
-
if (!row) throw new
|
|
2334
|
+
if (!row) throw new chunkDIK74MXX_cjs.DatabaseOperationError("Insert edge failed: no row returned", { operation: "insert", entity: "edge" });
|
|
2081
2335
|
return rowMappers.toEdgeRow(row);
|
|
2082
2336
|
},
|
|
2083
2337
|
async insertEdgeNoReturn(params) {
|
|
@@ -2090,7 +2344,7 @@ function createCommonOperationBackend(options) {
|
|
|
2090
2344
|
return;
|
|
2091
2345
|
}
|
|
2092
2346
|
const timestamp2 = nowIso2();
|
|
2093
|
-
for (const chunk2 of
|
|
2347
|
+
for (const chunk2 of chunkX4JBT642_cjs.chunk(params, batchConfig.edgeInsertBatchSize)) {
|
|
2094
2348
|
const query = operationStrategy.buildInsertEdgesBatch(chunk2, timestamp2);
|
|
2095
2349
|
await execution.execRun(query);
|
|
2096
2350
|
}
|
|
@@ -2101,7 +2355,7 @@ function createCommonOperationBackend(options) {
|
|
|
2101
2355
|
}
|
|
2102
2356
|
const timestamp2 = nowIso2();
|
|
2103
2357
|
const allRows = [];
|
|
2104
|
-
for (const chunk2 of
|
|
2358
|
+
for (const chunk2 of chunkX4JBT642_cjs.chunk(params, batchConfig.edgeInsertBatchSize)) {
|
|
2105
2359
|
const query = operationStrategy.buildInsertEdgesBatchReturning(chunk2, timestamp2);
|
|
2106
2360
|
const rows = await execution.execAll(query);
|
|
2107
2361
|
allRows.push(...rows.map((row) => rowMappers.toEdgeRow(row)));
|
|
@@ -2116,7 +2370,7 @@ function createCommonOperationBackend(options) {
|
|
|
2116
2370
|
async getEdges(graphId, ids) {
|
|
2117
2371
|
if (ids.length === 0) return [];
|
|
2118
2372
|
const allRows = [];
|
|
2119
|
-
for (const chunk2 of
|
|
2373
|
+
for (const chunk2 of chunkX4JBT642_cjs.chunk(ids, batchConfig.getEdgesChunkSize)) {
|
|
2120
2374
|
const query = operationStrategy.buildGetEdges(graphId, chunk2);
|
|
2121
2375
|
const rows = await execution.execAll(query);
|
|
2122
2376
|
allRows.push(...rows.map((row) => rowMappers.toEdgeRow(row)));
|
|
@@ -2127,7 +2381,7 @@ function createCommonOperationBackend(options) {
|
|
|
2127
2381
|
const timestamp2 = nowIso2();
|
|
2128
2382
|
const query = operationStrategy.buildUpdateEdge(params, timestamp2);
|
|
2129
2383
|
const row = await execution.execGet(query);
|
|
2130
|
-
if (!row) throw new
|
|
2384
|
+
if (!row) throw new chunkDIK74MXX_cjs.DatabaseOperationError("Update edge failed: no row returned", { operation: "update", entity: "edge" });
|
|
2131
2385
|
return rowMappers.toEdgeRow(row);
|
|
2132
2386
|
},
|
|
2133
2387
|
async deleteEdge(params) {
|
|
@@ -2139,6 +2393,28 @@ function createCommonOperationBackend(options) {
|
|
|
2139
2393
|
const query = operationStrategy.buildHardDeleteEdge(params);
|
|
2140
2394
|
await execution.execRun(query);
|
|
2141
2395
|
},
|
|
2396
|
+
async deleteEdgesBatch(params) {
|
|
2397
|
+
if (params.ids.length === 0) return;
|
|
2398
|
+
const timestamp2 = nowIso2();
|
|
2399
|
+
const softDeleteChunkSize = Math.max(1, batchConfig.getEdgesChunkSize - 1);
|
|
2400
|
+
for (const chunk2 of chunkX4JBT642_cjs.chunk(params.ids, softDeleteChunkSize)) {
|
|
2401
|
+
const query = operationStrategy.buildDeleteEdgesBatch(
|
|
2402
|
+
{ graphId: params.graphId, ids: chunk2 },
|
|
2403
|
+
timestamp2
|
|
2404
|
+
);
|
|
2405
|
+
await execution.execRun(query);
|
|
2406
|
+
}
|
|
2407
|
+
},
|
|
2408
|
+
async hardDeleteEdgesBatch(params) {
|
|
2409
|
+
if (params.ids.length === 0) return;
|
|
2410
|
+
for (const chunk2 of chunkX4JBT642_cjs.chunk(params.ids, batchConfig.getEdgesChunkSize)) {
|
|
2411
|
+
const query = operationStrategy.buildHardDeleteEdgesBatch({
|
|
2412
|
+
graphId: params.graphId,
|
|
2413
|
+
ids: chunk2
|
|
2414
|
+
});
|
|
2415
|
+
await execution.execRun(query);
|
|
2416
|
+
}
|
|
2417
|
+
},
|
|
2142
2418
|
async countEdgesFrom(params) {
|
|
2143
2419
|
const query = operationStrategy.buildCountEdgesFrom(params);
|
|
2144
2420
|
const row = await execution.execGet(query);
|
|
@@ -2178,7 +2454,7 @@ function createCommonOperationBackend(options) {
|
|
|
2178
2454
|
const query = operationStrategy.buildInsertUnique(params);
|
|
2179
2455
|
const result = await execution.execGet(query);
|
|
2180
2456
|
if (result && result.node_id !== params.nodeId) {
|
|
2181
|
-
throw new
|
|
2457
|
+
throw new chunkDIK74MXX_cjs.UniquenessError({
|
|
2182
2458
|
constraintName: params.constraintName,
|
|
2183
2459
|
kind: params.nodeKind,
|
|
2184
2460
|
existingId: result.node_id,
|
|
@@ -2187,6 +2463,53 @@ function createCommonOperationBackend(options) {
|
|
|
2187
2463
|
});
|
|
2188
2464
|
}
|
|
2189
2465
|
},
|
|
2466
|
+
async insertUniqueBatch(entries) {
|
|
2467
|
+
if (entries.length === 0) return;
|
|
2468
|
+
const targetKey = (entry) => `${entry.nodeKind}\0${entry.constraintName}\0${entry.key}`;
|
|
2469
|
+
const byTarget = /* @__PURE__ */ new Map();
|
|
2470
|
+
for (const entry of entries) {
|
|
2471
|
+
const existing = byTarget.get(targetKey(entry));
|
|
2472
|
+
if (existing === void 0) {
|
|
2473
|
+
byTarget.set(targetKey(entry), entry);
|
|
2474
|
+
continue;
|
|
2475
|
+
}
|
|
2476
|
+
if (existing.nodeId !== entry.nodeId) {
|
|
2477
|
+
throw new chunkDIK74MXX_cjs.UniquenessError({
|
|
2478
|
+
constraintName: entry.constraintName,
|
|
2479
|
+
kind: entry.nodeKind,
|
|
2480
|
+
existingId: existing.nodeId,
|
|
2481
|
+
newId: entry.nodeId,
|
|
2482
|
+
fields: []
|
|
2483
|
+
});
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2486
|
+
const deduped = [...byTarget.values()];
|
|
2487
|
+
for (const chunk2 of chunkX4JBT642_cjs.chunk(
|
|
2488
|
+
deduped,
|
|
2489
|
+
batchConfig.uniqueInsertBatchSize
|
|
2490
|
+
)) {
|
|
2491
|
+
const query = operationStrategy.buildInsertUniqueBatch(chunk2);
|
|
2492
|
+
const rows = await execution.execAll(query);
|
|
2493
|
+
const ownerByTarget = new Map(
|
|
2494
|
+
rows.map((row) => [
|
|
2495
|
+
`${row.node_kind}\0${row.constraint_name}\0${row.key}`,
|
|
2496
|
+
row.node_id
|
|
2497
|
+
])
|
|
2498
|
+
);
|
|
2499
|
+
for (const entry of chunk2) {
|
|
2500
|
+
const owner = ownerByTarget.get(targetKey(entry));
|
|
2501
|
+
if (owner !== void 0 && owner !== entry.nodeId) {
|
|
2502
|
+
throw new chunkDIK74MXX_cjs.UniquenessError({
|
|
2503
|
+
constraintName: entry.constraintName,
|
|
2504
|
+
kind: entry.nodeKind,
|
|
2505
|
+
existingId: owner,
|
|
2506
|
+
newId: entry.nodeId,
|
|
2507
|
+
fields: []
|
|
2508
|
+
});
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2512
|
+
},
|
|
2190
2513
|
async deleteUnique(params) {
|
|
2191
2514
|
const timestamp2 = nowIso2();
|
|
2192
2515
|
const query = operationStrategy.buildDeleteUnique(params, timestamp2);
|
|
@@ -2200,7 +2523,7 @@ function createCommonOperationBackend(options) {
|
|
|
2200
2523
|
async checkUniqueBatch(params) {
|
|
2201
2524
|
if (params.keys.length === 0) return [];
|
|
2202
2525
|
const allRows = [];
|
|
2203
|
-
for (const chunk2 of
|
|
2526
|
+
for (const chunk2 of chunkX4JBT642_cjs.chunk(params.keys, batchConfig.checkUniqueBatchChunkSize)) {
|
|
2204
2527
|
const query = operationStrategy.buildCheckUniqueBatch({ ...params, keys: chunk2 });
|
|
2205
2528
|
const rows = await execution.execAll(query);
|
|
2206
2529
|
allRows.push(...rows.map((row) => rowMappers.toUniqueRow(row)));
|
|
@@ -2228,7 +2551,7 @@ function createCommonOperationBackend(options) {
|
|
|
2228
2551
|
if (existingRaw !== void 0) {
|
|
2229
2552
|
const existing = rowMappers.toSchemaVersionRow(existingRaw);
|
|
2230
2553
|
if (existing.schema_hash !== params.schemaHash) {
|
|
2231
|
-
throw new
|
|
2554
|
+
throw new chunkDIK74MXX_cjs.SchemaContentConflictError({
|
|
2232
2555
|
graphId: params.graphId,
|
|
2233
2556
|
version: params.version,
|
|
2234
2557
|
existingHash: existing.schema_hash,
|
|
@@ -2276,7 +2599,7 @@ function createCommonOperationBackend(options) {
|
|
|
2276
2599
|
);
|
|
2277
2600
|
const insertedRaw = await execution.execGet(insertQuery);
|
|
2278
2601
|
if (!insertedRaw) {
|
|
2279
|
-
throw new
|
|
2602
|
+
throw new chunkDIK74MXX_cjs.DatabaseOperationError(
|
|
2280
2603
|
"Insert schema failed: no row returned",
|
|
2281
2604
|
{ operation: "insert", entity: "schema" }
|
|
2282
2605
|
);
|
|
@@ -2297,7 +2620,7 @@ function createCommonOperationBackend(options) {
|
|
|
2297
2620
|
)
|
|
2298
2621
|
);
|
|
2299
2622
|
if (!targetRaw) {
|
|
2300
|
-
throw new
|
|
2623
|
+
throw new chunkDIK74MXX_cjs.MigrationError(
|
|
2301
2624
|
`Cannot activate version ${params.version}: version does not exist for graph "${params.graphId}".`,
|
|
2302
2625
|
{
|
|
2303
2626
|
graphId: params.graphId,
|
|
@@ -2349,6 +2672,7 @@ function compileQueryWithDialect(db, query, backendName) {
|
|
|
2349
2672
|
return compiler.sqlToQuery(query);
|
|
2350
2673
|
}
|
|
2351
2674
|
|
|
2675
|
+
exports.EMBEDDING_UPSERT_PARAM_COUNT = EMBEDDING_UPSERT_PARAM_COUNT;
|
|
2352
2676
|
exports.POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS = POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS;
|
|
2353
2677
|
exports.POSTGRES_INDEX_MAT_TIMESTAMPS = POSTGRES_INDEX_MAT_TIMESTAMPS;
|
|
2354
2678
|
exports.POSTGRES_KIND_REMOVAL_TIMESTAMPS = POSTGRES_KIND_REMOVAL_TIMESTAMPS;
|
|
@@ -2381,7 +2705,9 @@ exports.generateSqliteCreateTableSQL = generateSqliteCreateTableSQL;
|
|
|
2381
2705
|
exports.generateSqliteDDL = generateSqliteDDL;
|
|
2382
2706
|
exports.generateSqliteMigrationSQL = generateSqliteMigrationSQL;
|
|
2383
2707
|
exports.getOrCreateLru = getOrCreateLru;
|
|
2708
|
+
exports.hybridCandidatesRef = hybridCandidatesRef;
|
|
2384
2709
|
exports.mapContributionMaterializationRow = mapContributionMaterializationRow;
|
|
2710
|
+
exports.mapHybridSearchRow = mapHybridSearchRow;
|
|
2385
2711
|
exports.mapKindRemovalRow = mapKindRemovalRow;
|
|
2386
2712
|
exports.mapMaterializationRow = mapMaterializationRow;
|
|
2387
2713
|
exports.mapVectorWriteError = mapVectorWriteError;
|
|
@@ -2395,5 +2721,5 @@ exports.uniques = uniques;
|
|
|
2395
2721
|
exports.vectorSlotFromCreateIndexParams = vectorSlotFromCreateIndexParams;
|
|
2396
2722
|
exports.vectorSlotFromDropIndexParams = vectorSlotFromDropIndexParams;
|
|
2397
2723
|
exports.vectorSlotFromParams = vectorSlotFromParams;
|
|
2398
|
-
//# sourceMappingURL=chunk-
|
|
2399
|
-
//# sourceMappingURL=chunk-
|
|
2724
|
+
//# sourceMappingURL=chunk-456Z2U7Y.cjs.map
|
|
2725
|
+
//# sourceMappingURL=chunk-456Z2U7Y.cjs.map
|