@nicia-ai/typegraph 0.33.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -0
- package/dist/backend/postgres/index.cjs +30 -26
- package/dist/backend/postgres/index.d.cts +39 -7
- package/dist/backend/postgres/index.d.ts +39 -7
- package/dist/backend/postgres/index.js +17 -13
- package/dist/backend/postgres/pglite.cjs +22 -18
- package/dist/backend/postgres/pglite.cjs.map +1 -1
- 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 -13
- package/dist/backend/postgres/pglite.js.map +1 -1
- package/dist/backend/sqlite/index.cjs +26 -23
- package/dist/backend/sqlite/index.d.cts +8 -8
- package/dist/backend/sqlite/index.d.ts +8 -8
- package/dist/backend/sqlite/index.js +14 -11
- package/dist/backend/sqlite/libsql.cjs +21 -17
- package/dist/backend/sqlite/libsql.cjs.map +1 -1
- package/dist/backend/sqlite/libsql.d.cts +13 -6
- package/dist/backend/sqlite/libsql.d.ts +13 -6
- package/dist/backend/sqlite/libsql.js +17 -13
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +102 -18
- 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 +96 -13
- package/dist/backend/sqlite/local.js.map +1 -1
- package/dist/{chunk-JHOBXD7O.js → chunk-3TWF3SH4.js} +332 -64
- package/dist/chunk-3TWF3SH4.js.map +1 -0
- package/dist/chunk-4JEZZJ6S.cjs +1271 -0
- package/dist/chunk-4JEZZJ6S.cjs.map +1 -0
- package/dist/{chunk-I4W7MKVG.cjs → chunk-4TOD4LBZ.cjs} +249 -294
- package/dist/chunk-4TOD4LBZ.cjs.map +1 -0
- package/dist/chunk-55MZDDZV.js +239 -0
- package/dist/chunk-55MZDDZV.js.map +1 -0
- package/dist/{chunk-LM2IC4ZJ.cjs → chunk-5A6FNS6N.cjs} +75 -19
- package/dist/chunk-5A6FNS6N.cjs.map +1 -0
- package/dist/{chunk-FDN43KXV.cjs → chunk-5AQIKK56.cjs} +65 -24
- package/dist/chunk-5AQIKK56.cjs.map +1 -0
- package/dist/{chunk-IZ4PCL47.js → chunk-5SEGFTZX.js} +4 -66
- package/dist/chunk-5SEGFTZX.js.map +1 -0
- package/dist/{chunk-CWFPJ3RC.js → chunk-6FR2MMS6.js} +7 -7
- package/dist/chunk-6FR2MMS6.js.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-ACSVZPK7.cjs +21 -0
- package/dist/chunk-ACSVZPK7.cjs.map +1 -0
- package/dist/{chunk-OIE2UPVG.cjs → chunk-BLZDPRXT.cjs} +52 -21
- package/dist/chunk-BLZDPRXT.cjs.map +1 -0
- package/dist/chunk-BYPOGQWK.js +25 -0
- package/dist/chunk-BYPOGQWK.js.map +1 -0
- package/dist/{chunk-NG5N7R45.cjs → chunk-CK5BVQOW.cjs} +325 -213
- package/dist/chunk-CK5BVQOW.cjs.map +1 -0
- package/dist/chunk-CTTSDJLY.cjs +261 -0
- package/dist/chunk-CTTSDJLY.cjs.map +1 -0
- package/dist/chunk-CUHM5CWJ.cjs +12 -0
- package/dist/chunk-CUHM5CWJ.cjs.map +1 -0
- package/dist/chunk-CZQ3FO2Q.js +2320 -0
- package/dist/chunk-CZQ3FO2Q.js.map +1 -0
- package/dist/{chunk-CFNT3ITG.cjs → chunk-D7ZEOS56.cjs} +25 -52
- 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-DI74SMXS.cjs +29 -0
- package/dist/chunk-DI74SMXS.cjs.map +1 -0
- package/dist/{chunk-KY5SDVA7.cjs → chunk-EM3CWPND.cjs} +442 -113
- package/dist/chunk-EM3CWPND.cjs.map +1 -0
- package/dist/chunk-EMF62TZG.cjs +1176 -0
- package/dist/chunk-EMF62TZG.cjs.map +1 -0
- package/dist/chunk-EOLERH7Y.cjs +40 -0
- package/dist/chunk-EOLERH7Y.cjs.map +1 -0
- package/dist/{chunk-3QRBXYT5.cjs → chunk-FACJJWGF.cjs} +24 -6
- package/dist/chunk-FACJJWGF.cjs.map +1 -0
- package/dist/{chunk-KTIEB7VH.cjs → chunk-FL472AMI.cjs} +49 -165
- package/dist/chunk-FL472AMI.cjs.map +1 -0
- package/dist/{chunk-4RBAJVEC.cjs → chunk-FN35DLCN.cjs} +31 -9
- package/dist/chunk-FN35DLCN.cjs.map +1 -0
- package/dist/{chunk-C4C4Q7A6.js → chunk-FPIZFYHE.js} +12 -35
- package/dist/chunk-FPIZFYHE.js.map +1 -0
- package/dist/{chunk-XKNAK27R.js → chunk-FRV5Q5IO.js} +64 -8
- 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-GSQ6NPH6.cjs +100 -0
- package/dist/chunk-GSQ6NPH6.cjs.map +1 -0
- package/dist/chunk-GUR2FNB5.cjs +12 -0
- package/dist/{chunk-6ZR4QC3O.cjs.map → chunk-GUR2FNB5.cjs.map} +1 -1
- package/dist/{chunk-ZFWNO3GE.cjs → chunk-H7YNSMA7.cjs} +107 -2
- package/dist/chunk-H7YNSMA7.cjs.map +1 -0
- package/dist/{chunk-GYVBEZAO.js → chunk-I7ZUZKFD.js} +47 -19
- package/dist/chunk-I7ZUZKFD.js.map +1 -0
- package/dist/chunk-ITE4IXAK.js +25 -0
- package/dist/chunk-ITE4IXAK.js.map +1 -0
- package/dist/{chunk-D3EWZ67S.cjs → chunk-J7WFGBJR.cjs} +3372 -4970
- package/dist/chunk-J7WFGBJR.cjs.map +1 -0
- package/dist/{chunk-PYD3UCDU.js → chunk-JBTOYDMN.js} +202 -251
- package/dist/chunk-JBTOYDMN.js.map +1 -0
- package/dist/{chunk-XVUJY72M.js → chunk-K3PPLHY7.js} +234 -118
- package/dist/chunk-K3PPLHY7.js.map +1 -0
- package/dist/{chunk-454I6GDF.js → chunk-KBGQIPRQ.js} +102 -3
- package/dist/chunk-KBGQIPRQ.js.map +1 -0
- package/dist/chunk-KMI7LYAF.js +1252 -0
- package/dist/chunk-KMI7LYAF.js.map +1 -0
- package/dist/{chunk-JIEJCTDS.cjs → chunk-LGEALRC6.cjs} +21 -4
- package/dist/chunk-LGEALRC6.cjs.map +1 -0
- package/dist/{chunk-TQOYM4LN.js → chunk-MP2JQKSG.js} +21 -5
- package/dist/chunk-MP2JQKSG.js.map +1 -0
- package/dist/{chunk-3642VBVC.cjs → chunk-O7UN7OXA.cjs} +389 -121
- package/dist/chunk-O7UN7OXA.cjs.map +1 -0
- package/dist/chunk-OHMP6N2J.js +47 -0
- package/dist/chunk-OHMP6N2J.js.map +1 -0
- package/dist/{chunk-6NRFUHMS.js → chunk-OR5ZA5WP.js} +135 -24
- package/dist/chunk-OR5ZA5WP.js.map +1 -0
- package/dist/{chunk-PRMKPFN5.js → chunk-Q5TEXCTB.js} +61 -6
- package/dist/chunk-Q5TEXCTB.js.map +1 -0
- package/dist/chunk-QNKSQTKQ.js +1312 -0
- package/dist/chunk-QNKSQTKQ.js.map +1 -0
- package/dist/{chunk-YCV72E6L.js → chunk-QOTI55H7.js} +7 -116
- package/dist/chunk-QOTI55H7.js.map +1 -0
- package/dist/{chunk-QBYTJSAY.js → chunk-QWEUYILR.js} +99 -34
- package/dist/chunk-QWEUYILR.js.map +1 -0
- package/dist/{chunk-OS6KS3HV.js → chunk-RGP33ZJ5.js} +485 -82
- package/dist/chunk-RGP33ZJ5.js.map +1 -0
- package/dist/chunk-RGPG7EOJ.js +94 -0
- package/dist/chunk-RGPG7EOJ.js.map +1 -0
- package/dist/{chunk-WWVV44DY.cjs → chunk-S55OV6PW.cjs} +15 -15
- package/dist/chunk-S55OV6PW.cjs.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-XLUNB2TZ.js → chunk-SNXVDZAJ.js} +3 -3
- package/dist/{chunk-XLUNB2TZ.js.map → chunk-SNXVDZAJ.js.map} +1 -1
- package/dist/{chunk-CEF2QOTO.js → chunk-T2WUSPDA.js} +49 -8
- package/dist/chunk-T2WUSPDA.js.map +1 -0
- package/dist/{chunk-YW7GHMF4.cjs → chunk-TCOCYN2P.cjs} +75 -20
- 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-TEDRJXOG.cjs +32 -0
- package/dist/chunk-TEDRJXOG.cjs.map +1 -0
- package/dist/{chunk-WLP6TKFB.js → chunk-UES55P7G.js} +2809 -4398
- package/dist/chunk-UES55P7G.js.map +1 -0
- package/dist/{chunk-EF3Z645U.cjs → chunk-UMDVATGY.cjs} +6 -72
- package/dist/chunk-UMDVATGY.cjs.map +1 -0
- package/dist/chunk-UR7W5YQK.js +18 -0
- package/dist/chunk-UR7W5YQK.js.map +1 -0
- package/dist/chunk-UT3S4SEN.js +31 -0
- package/dist/chunk-UT3S4SEN.js.map +1 -0
- package/dist/{chunk-3IR2GEMJ.cjs → chunk-UUT7UN2N.cjs} +149 -38
- package/dist/chunk-UUT7UN2N.cjs.map +1 -0
- package/dist/{chunk-PIHXFF73.js → chunk-UZV3AZKF.js} +21 -3
- package/dist/chunk-UZV3AZKF.js.map +1 -0
- package/dist/{chunk-DJYRRDHA.js → chunk-VHMPG6UL.js} +29 -7
- package/dist/chunk-VHMPG6UL.js.map +1 -0
- package/dist/{chunk-MBLXCV2Y.cjs → chunk-VPYHY3LJ.cjs} +111 -43
- package/dist/chunk-VPYHY3LJ.cjs.map +1 -0
- package/dist/{chunk-WYTUF3QO.js → chunk-VSPCZAXF.js} +3 -3
- package/dist/{chunk-WYTUF3QO.js.map → chunk-VSPCZAXF.js.map} +1 -1
- package/dist/chunk-W63OVYY4.js +29 -0
- package/dist/chunk-W63OVYY4.js.map +1 -0
- package/dist/{chunk-UPDMJEW6.js → chunk-WDBCBWC4.js} +356 -30
- package/dist/chunk-WDBCBWC4.js.map +1 -0
- package/dist/chunk-WJT7OU7E.cjs +1334 -0
- package/dist/chunk-WJT7OU7E.cjs.map +1 -0
- package/dist/chunk-XOX22WHL.cjs +2383 -0
- package/dist/chunk-XOX22WHL.cjs.map +1 -0
- package/dist/{ddl-CVnHJcar.d.ts → ddl-C2rZ-Aen.d.ts} +4 -4
- package/dist/{ddl-Dxt_fBHr.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-DGylBhWo.d.ts → fulltext-strategy-B57yvC5Q.d.ts} +2558 -2125
- package/dist/{types-C_UnQOQp.d.cts → fulltext-strategy-CDkSSYhq.d.cts} +2558 -2125
- package/dist/graph-extension/index.cjs +21 -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 +6 -4
- package/dist/graph-merge/index.cjs +408 -169
- 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 +286 -47
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-DGX6D9j1.d.ts → index-6CSUAq-x.d.ts} +234 -93
- package/dist/{index-SEvUHDA6.d.cts → index-Bks_3HHK.d.cts} +234 -93
- package/dist/index.cjs +240 -211
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -11
- package/dist/index.d.ts +11 -11
- package/dist/index.js +35 -27
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +28 -27
- package/dist/indexes/index.d.cts +5 -5
- package/dist/indexes/index.d.ts +5 -5
- package/dist/indexes/index.js +10 -9
- package/dist/interchange/index.cjs +47 -17
- package/dist/interchange/index.d.cts +126 -12
- package/dist/interchange/index.d.ts +126 -12
- package/dist/interchange/index.js +14 -4
- package/dist/{manager-BYl_zyZR.d.cts → manager-DwQi8eV0.d.cts} +9 -2
- package/dist/{manager-C0_r0ALf.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-_9psmVGm.d.cts → postgres-CfEqsRMp.d.cts} +152 -1
- package/dist/{postgres-MzBPkYzq.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 +590 -0
- package/dist/provenance/index.cjs.map +1 -0
- package/dist/provenance/index.d.cts +73 -0
- package/dist/provenance/index.d.ts +73 -0
- package/dist/provenance/index.js +588 -0
- package/dist/provenance/index.js.map +1 -0
- package/dist/schema/index.cjs +55 -38
- 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 +30 -13
- package/dist/schema/index.js.map +1 -1
- package/dist/{sqlite-gm44dShb.d.ts → sqlite-D7zBinNR.d.cts} +92 -1
- package/dist/{sqlite-BfksSb45.d.cts → sqlite-DvQndLky.d.ts} +92 -1
- package/dist/{store-view-FfE5_7eo.d.ts → store-view-BSpqvAxK.d.cts} +445 -46
- package/dist/{store-view-9jQ2rPum.d.cts → store-view-CKbHFRnn.d.ts} +445 -46
- package/dist/{types-B6mhrcLv.d.cts → types-Bv9DcS_E.d.cts} +2 -2
- package/dist/{types-CdWxK-nD.d.ts → types-CoxuV7EJ.d.ts} +2 -2
- package/dist/{where-Bpp2ul_z.d.cts → where-7RKFOsXt.d.ts} +2 -2
- package/dist/{where-BsEXraKW.d.ts → where-DdMIXOtH.d.cts} +2 -2
- package/package.json +21 -14
- package/dist/chunk-2YMGNYXY.js +0 -40
- package/dist/chunk-2YMGNYXY.js.map +0 -1
- package/dist/chunk-3642VBVC.cjs.map +0 -1
- package/dist/chunk-3EUKJEQ3.js +0 -77
- package/dist/chunk-3EUKJEQ3.js.map +0 -1
- package/dist/chunk-3IR2GEMJ.cjs.map +0 -1
- package/dist/chunk-3QRBXYT5.cjs.map +0 -1
- package/dist/chunk-454I6GDF.js.map +0 -1
- package/dist/chunk-4RBAJVEC.cjs.map +0 -1
- package/dist/chunk-6NRFUHMS.js.map +0 -1
- package/dist/chunk-6ZR4QC3O.cjs +0 -12
- package/dist/chunk-73KASJGO.cjs +0 -52
- package/dist/chunk-73KASJGO.cjs.map +0 -1
- package/dist/chunk-BF3ZDEUE.cjs +0 -773
- package/dist/chunk-BF3ZDEUE.cjs.map +0 -1
- package/dist/chunk-C4C4Q7A6.js.map +0 -1
- package/dist/chunk-CEF2QOTO.js.map +0 -1
- package/dist/chunk-CFNT3ITG.cjs.map +0 -1
- package/dist/chunk-CWFPJ3RC.js.map +0 -1
- package/dist/chunk-D3EWZ67S.cjs.map +0 -1
- package/dist/chunk-DJYRRDHA.js.map +0 -1
- package/dist/chunk-EF3Z645U.cjs.map +0 -1
- package/dist/chunk-FDN43KXV.cjs.map +0 -1
- package/dist/chunk-GYVBEZAO.js.map +0 -1
- package/dist/chunk-HTGDWIDE.cjs +0 -89
- package/dist/chunk-HTGDWIDE.cjs.map +0 -1
- package/dist/chunk-I4W7MKVG.cjs.map +0 -1
- package/dist/chunk-IZ4PCL47.js.map +0 -1
- package/dist/chunk-JHOBXD7O.js.map +0 -1
- package/dist/chunk-JIEJCTDS.cjs.map +0 -1
- package/dist/chunk-KTIEB7VH.cjs.map +0 -1
- package/dist/chunk-KY5SDVA7.cjs.map +0 -1
- package/dist/chunk-LM2IC4ZJ.cjs.map +0 -1
- package/dist/chunk-MBLXCV2Y.cjs.map +0 -1
- package/dist/chunk-NG5N7R45.cjs.map +0 -1
- package/dist/chunk-OIE2UPVG.cjs.map +0 -1
- package/dist/chunk-OS6KS3HV.js.map +0 -1
- package/dist/chunk-PIHXFF73.js.map +0 -1
- package/dist/chunk-PRMKPFN5.js.map +0 -1
- package/dist/chunk-PYD3UCDU.js.map +0 -1
- package/dist/chunk-QBYTJSAY.js.map +0 -1
- package/dist/chunk-SPT5JMME.js +0 -610
- package/dist/chunk-SPT5JMME.js.map +0 -1
- package/dist/chunk-SST7XDY6.cjs +0 -624
- package/dist/chunk-SST7XDY6.cjs.map +0 -1
- package/dist/chunk-TQOYM4LN.js.map +0 -1
- package/dist/chunk-UPDMJEW6.js.map +0 -1
- package/dist/chunk-WLP6TKFB.js.map +0 -1
- package/dist/chunk-WWVV44DY.cjs.map +0 -1
- package/dist/chunk-XKNAK27R.js.map +0 -1
- package/dist/chunk-XVUJY72M.js.map +0 -1
- package/dist/chunk-YCV72E6L.js.map +0 -1
- package/dist/chunk-YW7GHMF4.cjs.map +0 -1
- package/dist/chunk-ZFWNO3GE.cjs.map +0 -1
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
3
|
+
var chunkFN35DLCN_cjs = require('./chunk-FN35DLCN.cjs');
|
|
4
|
+
var chunkS55OV6PW_cjs = require('./chunk-S55OV6PW.cjs');
|
|
5
|
+
var chunkCTTSDJLY_cjs = require('./chunk-CTTSDJLY.cjs');
|
|
6
|
+
var chunkACSVZPK7_cjs = require('./chunk-ACSVZPK7.cjs');
|
|
7
|
+
var chunkTEDRJXOG_cjs = require('./chunk-TEDRJXOG.cjs');
|
|
8
|
+
var chunkD7ZEOS56_cjs = require('./chunk-D7ZEOS56.cjs');
|
|
9
|
+
var chunk4TOD4LBZ_cjs = require('./chunk-4TOD4LBZ.cjs');
|
|
10
|
+
var chunkBLZDPRXT_cjs = require('./chunk-BLZDPRXT.cjs');
|
|
11
|
+
var chunk7YSP4V4R_cjs = require('./chunk-7YSP4V4R.cjs');
|
|
12
|
+
var chunkLGEALRC6_cjs = require('./chunk-LGEALRC6.cjs');
|
|
10
13
|
var drizzleOrm = require('drizzle-orm');
|
|
11
14
|
var pgCore = require('drizzle-orm/pg-core');
|
|
12
15
|
var sqliteCore = require('drizzle-orm/sqlite-core');
|
|
@@ -25,6 +28,7 @@ var DEFAULT_TABLE_NAMES = {
|
|
|
25
28
|
recordedNodes: "typegraph_recorded_nodes",
|
|
26
29
|
recordedEdges: "typegraph_recorded_edges",
|
|
27
30
|
recordedClock: "typegraph_recorded_clock",
|
|
31
|
+
revisionOrigins: "typegraph_revision_origins",
|
|
28
32
|
uniques: "typegraph_node_uniques",
|
|
29
33
|
schemaVersions: "typegraph_schema_versions",
|
|
30
34
|
fulltext: "typegraph_node_fulltext",
|
|
@@ -61,7 +65,7 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
61
65
|
),
|
|
62
66
|
pgCore.index(`${n.nodes}_deleted_idx`).on(t.graphId, t.deletedAt),
|
|
63
67
|
pgCore.index(`${n.nodes}_valid_idx`).on(t.graphId, t.validFrom, t.validTo),
|
|
64
|
-
...
|
|
68
|
+
...chunkS55OV6PW_cjs.buildPostgresNodeIndexBuilders(t, indexes)
|
|
65
69
|
]
|
|
66
70
|
);
|
|
67
71
|
const edges2 = pgCore.pgTable(
|
|
@@ -85,7 +89,13 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
85
89
|
pgCore.primaryKey({ columns: [t.graphId, t.id] }),
|
|
86
90
|
pgCore.index(`${n.edges}_kind_idx`).on(t.graphId, t.kind),
|
|
87
91
|
// Directional traversal index (outgoing): supports endpoint lookups
|
|
88
|
-
// 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.
|
|
89
99
|
pgCore.index(`${n.edges}_from_idx`).on(
|
|
90
100
|
t.graphId,
|
|
91
101
|
t.fromKind,
|
|
@@ -93,9 +103,13 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
93
103
|
t.kind,
|
|
94
104
|
t.toKind,
|
|
95
105
|
t.deletedAt,
|
|
96
|
-
t.
|
|
106
|
+
t.validFrom,
|
|
107
|
+
t.validTo,
|
|
108
|
+
t.toId
|
|
97
109
|
),
|
|
98
|
-
// 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).
|
|
99
113
|
pgCore.index(`${n.edges}_to_idx`).on(
|
|
100
114
|
t.graphId,
|
|
101
115
|
t.toKind,
|
|
@@ -103,7 +117,9 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
103
117
|
t.kind,
|
|
104
118
|
t.fromKind,
|
|
105
119
|
t.deletedAt,
|
|
106
|
-
t.
|
|
120
|
+
t.validFrom,
|
|
121
|
+
t.validTo,
|
|
122
|
+
t.fromId
|
|
107
123
|
),
|
|
108
124
|
pgCore.index(`${n.edges}_kind_created_idx`).on(
|
|
109
125
|
t.graphId,
|
|
@@ -120,7 +136,7 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
120
136
|
t.fromId,
|
|
121
137
|
t.validTo
|
|
122
138
|
),
|
|
123
|
-
...
|
|
139
|
+
...chunkS55OV6PW_cjs.buildPostgresEdgeIndexBuilders(t, indexes)
|
|
124
140
|
]
|
|
125
141
|
);
|
|
126
142
|
const recordedNodes2 = pgCore.pgTable(
|
|
@@ -228,6 +244,14 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
228
244
|
},
|
|
229
245
|
(t) => [pgCore.primaryKey({ columns: [t.graphId] })]
|
|
230
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
|
+
);
|
|
231
255
|
const uniques2 = pgCore.pgTable(
|
|
232
256
|
n.uniques,
|
|
233
257
|
{
|
|
@@ -280,7 +304,14 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
280
304
|
lastAttemptedAt: pgCore.timestamp("last_attempted_at", {
|
|
281
305
|
withTimezone: true
|
|
282
306
|
}).notNull(),
|
|
283
|
-
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")
|
|
284
315
|
},
|
|
285
316
|
(t) => [pgCore.primaryKey({ columns: [t.indexName] })]
|
|
286
317
|
);
|
|
@@ -354,6 +385,7 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
354
385
|
recordedNodes: recordedNodes2,
|
|
355
386
|
recordedEdges: recordedEdges2,
|
|
356
387
|
recordedClock: recordedClock2,
|
|
388
|
+
revisionOrigins,
|
|
357
389
|
uniques: uniques2,
|
|
358
390
|
schemaVersions: schemaVersions2,
|
|
359
391
|
indexMaterializations,
|
|
@@ -430,9 +462,9 @@ function renderIndexColumn(col) {
|
|
|
430
462
|
if (col && typeof col === "object" && "name" in col) {
|
|
431
463
|
return `"${col.name}"`;
|
|
432
464
|
}
|
|
433
|
-
const
|
|
434
|
-
if (
|
|
435
|
-
return
|
|
465
|
+
const sql14 = tryInlineSql(col);
|
|
466
|
+
if (sql14 !== void 0) {
|
|
467
|
+
return sql14;
|
|
436
468
|
}
|
|
437
469
|
return "unknown";
|
|
438
470
|
}
|
|
@@ -508,13 +540,13 @@ function isSqliteTable(value) {
|
|
|
508
540
|
function runtimeStrategyContributions(fulltextStrategy, fulltextTableName) {
|
|
509
541
|
return fulltextStrategy.ownedTables(fulltextTableName).filter((contribution) => contribution.runtimeEnsure);
|
|
510
542
|
}
|
|
511
|
-
function sqliteContributions(tables3 =
|
|
543
|
+
function sqliteContributions(tables3 = chunkFN35DLCN_cjs.tables, fulltextStrategy = chunkD7ZEOS56_cjs.fts5Strategy) {
|
|
512
544
|
const contributions = [];
|
|
513
545
|
for (const [key, table] of Object.entries(tables3)) {
|
|
514
546
|
if (!isSqliteTable(table)) continue;
|
|
515
547
|
contributions.push({
|
|
516
548
|
logicalName: key,
|
|
517
|
-
owner:
|
|
549
|
+
owner: chunkD7ZEOS56_cjs.BASE_CONTRIBUTION_OWNER,
|
|
518
550
|
tableName: sqliteCore.getTableConfig(table).name,
|
|
519
551
|
createDdl: [
|
|
520
552
|
generateSqliteCreateTableSQL(table),
|
|
@@ -530,12 +562,12 @@ function sqliteContributions(tables3 = chunk4RBAJVEC_cjs.tables, fulltextStrateg
|
|
|
530
562
|
}
|
|
531
563
|
return contributions;
|
|
532
564
|
}
|
|
533
|
-
function generateSqliteDDL(tables3 =
|
|
565
|
+
function generateSqliteDDL(tables3 = chunkFN35DLCN_cjs.tables, fulltextStrategy = chunkD7ZEOS56_cjs.fts5Strategy) {
|
|
534
566
|
return sqliteContributions(tables3, fulltextStrategy).flatMap(
|
|
535
567
|
(contribution) => [...contribution.createDdl]
|
|
536
568
|
);
|
|
537
569
|
}
|
|
538
|
-
function generateSqliteMigrationSQL(tables3 =
|
|
570
|
+
function generateSqliteMigrationSQL(tables3 = chunkFN35DLCN_cjs.tables, fulltextStrategy = chunkD7ZEOS56_cjs.fts5Strategy) {
|
|
539
571
|
return generateSqliteDDL(tables3, fulltextStrategy).join("\n\n");
|
|
540
572
|
}
|
|
541
573
|
function getPgColumnType(column) {
|
|
@@ -617,14 +649,14 @@ function generatePgCreateIndexSQL(table) {
|
|
|
617
649
|
function isPgTable(value) {
|
|
618
650
|
return drizzleOrm.is(value, pgCore.PgTable);
|
|
619
651
|
}
|
|
620
|
-
function postgresContributions(tables3 = tables2, fulltextStrategy =
|
|
652
|
+
function postgresContributions(tables3 = tables2, fulltextStrategy = chunkD7ZEOS56_cjs.tsvectorStrategy) {
|
|
621
653
|
const contributions = [];
|
|
622
654
|
for (const [key, table] of Object.entries(tables3)) {
|
|
623
655
|
if (!isPgTable(table)) continue;
|
|
624
656
|
if (table === tables3.fulltext) continue;
|
|
625
657
|
contributions.push({
|
|
626
658
|
logicalName: key,
|
|
627
|
-
owner:
|
|
659
|
+
owner: chunkD7ZEOS56_cjs.BASE_CONTRIBUTION_OWNER,
|
|
628
660
|
tableName: pgCore.getTableConfig(table).name,
|
|
629
661
|
createDdl: [
|
|
630
662
|
generatePgCreateTableSQL(table),
|
|
@@ -640,12 +672,12 @@ function postgresContributions(tables3 = tables2, fulltextStrategy = chunkCFNT3I
|
|
|
640
672
|
}
|
|
641
673
|
return contributions;
|
|
642
674
|
}
|
|
643
|
-
function generatePostgresDDL(tables3 = tables2, fulltextStrategy =
|
|
675
|
+
function generatePostgresDDL(tables3 = tables2, fulltextStrategy = chunkD7ZEOS56_cjs.tsvectorStrategy) {
|
|
644
676
|
return postgresContributions(tables3, fulltextStrategy).flatMap(
|
|
645
677
|
(contribution) => [...contribution.createDdl]
|
|
646
678
|
);
|
|
647
679
|
}
|
|
648
|
-
function generatePostgresMigrationSQL(tables3 = tables2, fulltextStrategy =
|
|
680
|
+
function generatePostgresMigrationSQL(tables3 = tables2, fulltextStrategy = chunkD7ZEOS56_cjs.tsvectorStrategy) {
|
|
649
681
|
const extensionSql = "-- Enable pgvector extension for vector similarity search\nCREATE EXTENSION IF NOT EXISTS vector;";
|
|
650
682
|
const ddlSql = generatePostgresDDL(tables3, fulltextStrategy).join("\n\n");
|
|
651
683
|
return `${extensionSql}
|
|
@@ -688,6 +720,7 @@ function createVectorSlotLatch() {
|
|
|
688
720
|
};
|
|
689
721
|
}
|
|
690
722
|
var VECTOR_SLOT_PLACEHOLDER_DIMENSIONS = 1;
|
|
723
|
+
var EMBEDDING_UPSERT_PARAM_COUNT = 5;
|
|
691
724
|
function vectorSlotFromParams(params) {
|
|
692
725
|
return {
|
|
693
726
|
graphId: params.graphId,
|
|
@@ -715,10 +748,10 @@ function vectorSlotFromDropIndexParams(params) {
|
|
|
715
748
|
};
|
|
716
749
|
}
|
|
717
750
|
function mapVectorWriteError(error, params) {
|
|
718
|
-
const mismatch =
|
|
751
|
+
const mismatch = chunkBLZDPRXT_cjs.parseDimensionMismatch(error);
|
|
719
752
|
if (mismatch === void 0) return error;
|
|
720
753
|
const attempted = mismatch.actual ?? "a different number of";
|
|
721
|
-
return new
|
|
754
|
+
return new chunkLGEALRC6_cjs.EmbeddingDimensionChangedError(
|
|
722
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.`,
|
|
723
756
|
{
|
|
724
757
|
kind: params.nodeKind,
|
|
@@ -734,7 +767,7 @@ var SQLITE_CONTRIBUTION_MAT_TIMESTAMPS = {
|
|
|
734
767
|
encode: (value) => value
|
|
735
768
|
};
|
|
736
769
|
var POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS = {
|
|
737
|
-
decode:
|
|
770
|
+
decode: chunkCTTSDJLY_cjs.formatPostgresTimestamp,
|
|
738
771
|
encode: (value) => new Date(value)
|
|
739
772
|
};
|
|
740
773
|
function mapContributionMaterializationRow(row, decode) {
|
|
@@ -784,7 +817,7 @@ async function computeContributionSignature(dialect, identity, createDdl) {
|
|
|
784
817
|
tableName: identity.tableName,
|
|
785
818
|
createDdl
|
|
786
819
|
};
|
|
787
|
-
return
|
|
820
|
+
return chunkTEDRJXOG_cjs.sha256Hex(JSON.stringify(hashable, chunkACSVZPK7_cjs.sortedReplacer), 16);
|
|
788
821
|
}
|
|
789
822
|
function evaluateContributionState(row, signature) {
|
|
790
823
|
if (row === void 0) return "missing";
|
|
@@ -848,7 +881,7 @@ function gateFulltextMethods(source, assert) {
|
|
|
848
881
|
return gated;
|
|
849
882
|
}
|
|
850
883
|
function gateFulltext(tx, assert) {
|
|
851
|
-
return
|
|
884
|
+
return chunk4TOD4LBZ_cjs.createBackendOverlay(
|
|
852
885
|
tx,
|
|
853
886
|
gateFulltextMethods(tx, assert)
|
|
854
887
|
);
|
|
@@ -878,13 +911,13 @@ function createContributionMaterializer(deps) {
|
|
|
878
911
|
await deps.recordMarker({
|
|
879
912
|
...identity,
|
|
880
913
|
signature,
|
|
881
|
-
attemptedAt:
|
|
914
|
+
attemptedAt: chunkCTTSDJLY_cjs.nowIso(),
|
|
882
915
|
materializedAt: void 0,
|
|
883
916
|
error: error.message
|
|
884
917
|
});
|
|
885
918
|
throw error;
|
|
886
919
|
}
|
|
887
|
-
const attemptedAt =
|
|
920
|
+
const attemptedAt = chunkCTTSDJLY_cjs.nowIso();
|
|
888
921
|
try {
|
|
889
922
|
for (const statement of contribution.createDdl) {
|
|
890
923
|
await deps.execDdl(statement);
|
|
@@ -921,7 +954,7 @@ function createContributionMaterializer(deps) {
|
|
|
921
954
|
state: evaluateContributionState(existing, signature)
|
|
922
955
|
};
|
|
923
956
|
} catch (error) {
|
|
924
|
-
if (!
|
|
957
|
+
if (!chunkBLZDPRXT_cjs.isMissingTableError(error)) throw error;
|
|
925
958
|
return { kind: "missing-table", error };
|
|
926
959
|
}
|
|
927
960
|
}
|
|
@@ -950,13 +983,13 @@ function createContributionMaterializer(deps) {
|
|
|
950
983
|
for (const contribution of runtimeContributions()) {
|
|
951
984
|
const read = await readContributionState(graphId, contribution);
|
|
952
985
|
if (read.kind === "missing-table") {
|
|
953
|
-
throw new
|
|
986
|
+
throw new chunkLGEALRC6_cjs.StoreNotInitializedError(graphId, "missing", {
|
|
954
987
|
cause: read.error,
|
|
955
988
|
details: { logicalName: contribution.logicalName }
|
|
956
989
|
});
|
|
957
990
|
}
|
|
958
991
|
if (read.state !== "initialized") {
|
|
959
|
-
throw new
|
|
992
|
+
throw new chunkLGEALRC6_cjs.StoreNotInitializedError(graphId, read.state, {
|
|
960
993
|
details: { logicalName: contribution.logicalName }
|
|
961
994
|
});
|
|
962
995
|
}
|
|
@@ -970,7 +1003,7 @@ var SQLITE_INDEX_MAT_TIMESTAMPS = {
|
|
|
970
1003
|
encode: (value) => value
|
|
971
1004
|
};
|
|
972
1005
|
var POSTGRES_INDEX_MAT_TIMESTAMPS = {
|
|
973
|
-
decode:
|
|
1006
|
+
decode: chunkCTTSDJLY_cjs.formatPostgresTimestamp,
|
|
974
1007
|
encode: (value) => new Date(value)
|
|
975
1008
|
};
|
|
976
1009
|
function mapMaterializationRow(row, decode) {
|
|
@@ -1023,7 +1056,7 @@ var SQLITE_KIND_REMOVAL_TIMESTAMPS = {
|
|
|
1023
1056
|
encode: (value) => value
|
|
1024
1057
|
};
|
|
1025
1058
|
var POSTGRES_KIND_REMOVAL_TIMESTAMPS = {
|
|
1026
|
-
decode:
|
|
1059
|
+
decode: chunkCTTSDJLY_cjs.formatPostgresTimestamp,
|
|
1027
1060
|
encode: (value) => new Date(value)
|
|
1028
1061
|
};
|
|
1029
1062
|
function mapKindRemovalRow(row, decode) {
|
|
@@ -1064,8 +1097,111 @@ function buildKindRemovalOnConflictSet(removedAtColumn, paramsRemovedAt) {
|
|
|
1064
1097
|
lastError: drizzleOrm.sql`excluded.${drizzleOrm.sql.identifier("last_error")}`
|
|
1065
1098
|
};
|
|
1066
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: chunkCTTSDJLY_cjs.coerceNumericScore(row.fused_score),
|
|
1192
|
+
...present(row.vector_rank) ? { vectorRank: Number(row.vector_rank) } : {},
|
|
1193
|
+
...present(row.vector_score) ? { vectorScore: chunkCTTSDJLY_cjs.coerceNumericScore(row.vector_score) } : {},
|
|
1194
|
+
...present(row.fulltext_rank) ? { fulltextRank: Number(row.fulltext_rank) } : {},
|
|
1195
|
+
...present(row.fulltext_score) ? {
|
|
1196
|
+
fulltextScore: chunkCTTSDJLY_cjs.coerceNumericScore(
|
|
1197
|
+
row.fulltext_score
|
|
1198
|
+
)
|
|
1199
|
+
} : {},
|
|
1200
|
+
...present(row.snippet) ? { snippet: String(row.snippet) } : {}
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1067
1203
|
function buildClearGraph(tables3, graphId) {
|
|
1068
|
-
const fulltext2 =
|
|
1204
|
+
const fulltext2 = chunk7YSP4V4R_cjs.quotedTableName(tables3.fulltextTableName);
|
|
1069
1205
|
return [
|
|
1070
1206
|
{ query: drizzleOrm.sql`DELETE FROM ${fulltext2} WHERE "graph_id" = ${graphId}` },
|
|
1071
1207
|
{
|
|
@@ -1247,13 +1383,13 @@ function buildCountEdgesByKind(tables3, params) {
|
|
|
1247
1383
|
function buildInsertEdge(tables3, params, timestamp2) {
|
|
1248
1384
|
const { edges: edges2 } = tables3;
|
|
1249
1385
|
const propsJson = JSON.stringify(params.props);
|
|
1250
|
-
const columns =
|
|
1386
|
+
const columns = chunk7YSP4V4R_cjs.edgeColumnList(edges2);
|
|
1251
1387
|
return drizzleOrm.sql`
|
|
1252
1388
|
INSERT INTO ${edges2} (${columns})
|
|
1253
1389
|
VALUES (
|
|
1254
1390
|
${params.graphId}, ${params.id}, ${params.kind},
|
|
1255
1391
|
${params.fromKind}, ${params.fromId}, ${params.toKind}, ${params.toId},
|
|
1256
|
-
${propsJson}, ${
|
|
1392
|
+
${propsJson}, ${chunk7YSP4V4R_cjs.sqlNull(chunk7YSP4V4R_cjs.resolveValidFrom(params.validFrom, timestamp2))}, ${chunk7YSP4V4R_cjs.sqlNull(params.validTo)},
|
|
1257
1393
|
${timestamp2}, ${timestamp2}
|
|
1258
1394
|
)
|
|
1259
1395
|
RETURNING *
|
|
@@ -1262,23 +1398,23 @@ function buildInsertEdge(tables3, params, timestamp2) {
|
|
|
1262
1398
|
function buildInsertEdgeNoReturn(tables3, params, timestamp2) {
|
|
1263
1399
|
const { edges: edges2 } = tables3;
|
|
1264
1400
|
const propsJson = JSON.stringify(params.props);
|
|
1265
|
-
const columns =
|
|
1401
|
+
const columns = chunk7YSP4V4R_cjs.edgeColumnList(edges2);
|
|
1266
1402
|
return drizzleOrm.sql`
|
|
1267
1403
|
INSERT INTO ${edges2} (${columns})
|
|
1268
1404
|
VALUES (
|
|
1269
1405
|
${params.graphId}, ${params.id}, ${params.kind},
|
|
1270
1406
|
${params.fromKind}, ${params.fromId}, ${params.toKind}, ${params.toId},
|
|
1271
|
-
${propsJson}, ${
|
|
1407
|
+
${propsJson}, ${chunk7YSP4V4R_cjs.sqlNull(chunk7YSP4V4R_cjs.resolveValidFrom(params.validFrom, timestamp2))}, ${chunk7YSP4V4R_cjs.sqlNull(params.validTo)},
|
|
1272
1408
|
${timestamp2}, ${timestamp2}
|
|
1273
1409
|
)
|
|
1274
1410
|
`;
|
|
1275
1411
|
}
|
|
1276
1412
|
function buildInsertEdgesBatch(tables3, params, timestamp2) {
|
|
1277
1413
|
const { edges: edges2 } = tables3;
|
|
1278
|
-
const columns =
|
|
1414
|
+
const columns = chunk7YSP4V4R_cjs.edgeColumnList(edges2);
|
|
1279
1415
|
const values = params.map((edgeParams) => {
|
|
1280
1416
|
const propsJson = JSON.stringify(edgeParams.props);
|
|
1281
|
-
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})`;
|
|
1282
1418
|
});
|
|
1283
1419
|
return drizzleOrm.sql`
|
|
1284
1420
|
INSERT INTO ${edges2} (${columns})
|
|
@@ -1287,10 +1423,10 @@ function buildInsertEdgesBatch(tables3, params, timestamp2) {
|
|
|
1287
1423
|
}
|
|
1288
1424
|
function buildInsertEdgesBatchReturning(tables3, params, timestamp2) {
|
|
1289
1425
|
const { edges: edges2 } = tables3;
|
|
1290
|
-
const columns =
|
|
1426
|
+
const columns = chunk7YSP4V4R_cjs.edgeColumnList(edges2);
|
|
1291
1427
|
const values = params.map((edgeParams) => {
|
|
1292
1428
|
const propsJson = JSON.stringify(edgeParams.props);
|
|
1293
|
-
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})`;
|
|
1294
1430
|
});
|
|
1295
1431
|
return drizzleOrm.sql`
|
|
1296
1432
|
INSERT INTO ${edges2} (${columns})
|
|
@@ -1311,21 +1447,21 @@ function buildGetEdges(tables3, graphId, ids) {
|
|
|
1311
1447
|
return drizzleOrm.sql`
|
|
1312
1448
|
SELECT * FROM ${edges2}
|
|
1313
1449
|
WHERE ${edges2.graphId} = ${graphId}
|
|
1314
|
-
AND ${edges2.id} IN (${
|
|
1450
|
+
AND ${edges2.id} IN (${chunk4TOD4LBZ_cjs.sqlValueList(ids)})
|
|
1315
1451
|
`;
|
|
1316
1452
|
}
|
|
1317
1453
|
function buildUpdateEdge(tables3, params, timestamp2) {
|
|
1318
1454
|
const { edges: edges2 } = tables3;
|
|
1319
1455
|
const propsJson = JSON.stringify(params.props);
|
|
1320
1456
|
const setParts = [
|
|
1321
|
-
drizzleOrm.sql`${
|
|
1322
|
-
drizzleOrm.sql`${
|
|
1457
|
+
drizzleOrm.sql`${chunk7YSP4V4R_cjs.quotedColumn(edges2.props)} = ${propsJson}`,
|
|
1458
|
+
drizzleOrm.sql`${chunk7YSP4V4R_cjs.quotedColumn(edges2.updatedAt)} = ${timestamp2}`
|
|
1323
1459
|
];
|
|
1324
1460
|
if (params.validTo !== void 0) {
|
|
1325
|
-
setParts.push(drizzleOrm.sql`${
|
|
1461
|
+
setParts.push(drizzleOrm.sql`${chunk7YSP4V4R_cjs.quotedColumn(edges2.validTo)} = ${params.validTo}`);
|
|
1326
1462
|
}
|
|
1327
1463
|
if (params.clearDeleted) {
|
|
1328
|
-
setParts.push(drizzleOrm.sql`${
|
|
1464
|
+
setParts.push(drizzleOrm.sql`${chunk7YSP4V4R_cjs.quotedColumn(edges2.deletedAt)} = NULL`);
|
|
1329
1465
|
}
|
|
1330
1466
|
const setClause = drizzleOrm.sql.join(setParts, drizzleOrm.sql`, `);
|
|
1331
1467
|
if (params.clearDeleted) {
|
|
@@ -1350,12 +1486,30 @@ function buildDeleteEdge(tables3, params, timestamp2) {
|
|
|
1350
1486
|
const { edges: edges2 } = tables3;
|
|
1351
1487
|
return drizzleOrm.sql`
|
|
1352
1488
|
UPDATE ${edges2}
|
|
1353
|
-
SET ${
|
|
1489
|
+
SET ${chunk7YSP4V4R_cjs.quotedColumn(edges2.deletedAt)} = ${timestamp2}
|
|
1354
1490
|
WHERE ${edges2.graphId} = ${params.graphId}
|
|
1355
1491
|
AND ${edges2.id} = ${params.id}
|
|
1356
1492
|
AND ${edges2.deletedAt} IS NULL
|
|
1357
1493
|
`;
|
|
1358
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 (${chunk4TOD4LBZ_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 (${chunk4TOD4LBZ_cjs.sqlValueList(params.ids)})
|
|
1511
|
+
`;
|
|
1512
|
+
}
|
|
1359
1513
|
function buildHardDeleteEdge(tables3, params) {
|
|
1360
1514
|
const { edges: edges2 } = tables3;
|
|
1361
1515
|
return drizzleOrm.sql`
|
|
@@ -1434,10 +1588,10 @@ function buildFindEdgesConnectedTo(tables3, params) {
|
|
|
1434
1588
|
function resolveMode(mode) {
|
|
1435
1589
|
return mode ?? "websearch";
|
|
1436
1590
|
}
|
|
1437
|
-
function buildFulltextSearch(tableName, params, strategy) {
|
|
1591
|
+
function buildFulltextSearch(tableName, params, strategy, dialect, candidates) {
|
|
1438
1592
|
assertValidSearchParams(params);
|
|
1439
1593
|
const mode = resolveMode(params.mode);
|
|
1440
|
-
const table =
|
|
1594
|
+
const table = chunk7YSP4V4R_cjs.quotedTableName(tableName);
|
|
1441
1595
|
const matchCondition = strategy.matchCondition(
|
|
1442
1596
|
tableName,
|
|
1443
1597
|
params.query,
|
|
@@ -1458,12 +1612,16 @@ function buildFulltextSearch(tableName, params, strategy) {
|
|
|
1458
1612
|
if (params.minScore !== void 0) {
|
|
1459
1613
|
conditions.push(drizzleOrm.sql`${rankExpression} >= ${params.minScore}`);
|
|
1460
1614
|
}
|
|
1615
|
+
if (candidates !== void 0) {
|
|
1616
|
+
conditions.push(drizzleOrm.sql`"node_id" IN (${candidates})`);
|
|
1617
|
+
}
|
|
1461
1618
|
const snippetExpr = params.includeSnippets === true && strategy.supportsSnippets ? strategy.snippetExpression(
|
|
1462
1619
|
tableName,
|
|
1463
1620
|
params.query,
|
|
1464
1621
|
mode,
|
|
1465
1622
|
params.language
|
|
1466
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}`;
|
|
1467
1625
|
return drizzleOrm.sql`
|
|
1468
1626
|
SELECT
|
|
1469
1627
|
"node_id" AS node_id,
|
|
@@ -1471,8 +1629,8 @@ function buildFulltextSearch(tableName, params, strategy) {
|
|
|
1471
1629
|
${snippetExpr} AS snippet
|
|
1472
1630
|
FROM ${table}
|
|
1473
1631
|
WHERE ${drizzleOrm.sql.join(conditions, drizzleOrm.sql` AND `)}
|
|
1474
|
-
ORDER BY ${rankExpression} DESC, "node_id" ASC
|
|
1475
|
-
|
|
1632
|
+
ORDER BY ${rankExpression} DESC, ${chunk7YSP4V4R_cjs.codePointOrderKey(drizzleOrm.sql.raw('"node_id"'), dialect)} ASC
|
|
1633
|
+
${pageClause}
|
|
1476
1634
|
`;
|
|
1477
1635
|
}
|
|
1478
1636
|
function assertValidSearchParams(params) {
|
|
@@ -1488,12 +1646,12 @@ function assertValidSearchParams(params) {
|
|
|
1488
1646
|
function buildInsertNode(tables3, params, timestamp2) {
|
|
1489
1647
|
const { nodes: nodes2 } = tables3;
|
|
1490
1648
|
const propsJson = JSON.stringify(params.props);
|
|
1491
|
-
const columns =
|
|
1649
|
+
const columns = chunk7YSP4V4R_cjs.nodeColumnList(nodes2);
|
|
1492
1650
|
return drizzleOrm.sql`
|
|
1493
1651
|
INSERT INTO ${nodes2} (${columns})
|
|
1494
1652
|
VALUES (
|
|
1495
1653
|
${params.graphId}, ${params.kind}, ${params.id}, ${propsJson},
|
|
1496
|
-
1, ${
|
|
1654
|
+
1, ${chunk7YSP4V4R_cjs.sqlNull(chunk7YSP4V4R_cjs.resolveValidFrom(params.validFrom, timestamp2))}, ${chunk7YSP4V4R_cjs.sqlNull(params.validTo)},
|
|
1497
1655
|
${timestamp2}, ${timestamp2}
|
|
1498
1656
|
)
|
|
1499
1657
|
RETURNING *
|
|
@@ -1502,22 +1660,22 @@ function buildInsertNode(tables3, params, timestamp2) {
|
|
|
1502
1660
|
function buildInsertNodeNoReturn(tables3, params, timestamp2) {
|
|
1503
1661
|
const { nodes: nodes2 } = tables3;
|
|
1504
1662
|
const propsJson = JSON.stringify(params.props);
|
|
1505
|
-
const columns =
|
|
1663
|
+
const columns = chunk7YSP4V4R_cjs.nodeColumnList(nodes2);
|
|
1506
1664
|
return drizzleOrm.sql`
|
|
1507
1665
|
INSERT INTO ${nodes2} (${columns})
|
|
1508
1666
|
VALUES (
|
|
1509
1667
|
${params.graphId}, ${params.kind}, ${params.id}, ${propsJson},
|
|
1510
|
-
1, ${
|
|
1668
|
+
1, ${chunk7YSP4V4R_cjs.sqlNull(chunk7YSP4V4R_cjs.resolveValidFrom(params.validFrom, timestamp2))}, ${chunk7YSP4V4R_cjs.sqlNull(params.validTo)},
|
|
1511
1669
|
${timestamp2}, ${timestamp2}
|
|
1512
1670
|
)
|
|
1513
1671
|
`;
|
|
1514
1672
|
}
|
|
1515
1673
|
function buildInsertNodesBatch(tables3, params, timestamp2) {
|
|
1516
1674
|
const { nodes: nodes2 } = tables3;
|
|
1517
|
-
const columns =
|
|
1675
|
+
const columns = chunk7YSP4V4R_cjs.nodeColumnList(nodes2);
|
|
1518
1676
|
const values = params.map((nodeParams) => {
|
|
1519
1677
|
const propsJson = JSON.stringify(nodeParams.props);
|
|
1520
|
-
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})`;
|
|
1521
1679
|
});
|
|
1522
1680
|
return drizzleOrm.sql`
|
|
1523
1681
|
INSERT INTO ${nodes2} (${columns})
|
|
@@ -1526,10 +1684,10 @@ function buildInsertNodesBatch(tables3, params, timestamp2) {
|
|
|
1526
1684
|
}
|
|
1527
1685
|
function buildInsertNodesBatchReturning(tables3, params, timestamp2) {
|
|
1528
1686
|
const { nodes: nodes2 } = tables3;
|
|
1529
|
-
const columns =
|
|
1687
|
+
const columns = chunk7YSP4V4R_cjs.nodeColumnList(nodes2);
|
|
1530
1688
|
const values = params.map((nodeParams) => {
|
|
1531
1689
|
const propsJson = JSON.stringify(nodeParams.props);
|
|
1532
|
-
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})`;
|
|
1533
1691
|
});
|
|
1534
1692
|
return drizzleOrm.sql`
|
|
1535
1693
|
INSERT INTO ${nodes2} (${columns})
|
|
@@ -1552,26 +1710,26 @@ function buildGetNodes(tables3, graphId, kind, ids) {
|
|
|
1552
1710
|
SELECT * FROM ${nodes2}
|
|
1553
1711
|
WHERE ${nodes2.graphId} = ${graphId}
|
|
1554
1712
|
AND ${nodes2.kind} = ${kind}
|
|
1555
|
-
AND ${nodes2.id} IN (${
|
|
1713
|
+
AND ${nodes2.id} IN (${chunk4TOD4LBZ_cjs.sqlValueList(ids)})
|
|
1556
1714
|
`;
|
|
1557
1715
|
}
|
|
1558
1716
|
function buildUpdateNode(tables3, params, timestamp2) {
|
|
1559
1717
|
const { nodes: nodes2 } = tables3;
|
|
1560
1718
|
const propsJson = JSON.stringify(params.props);
|
|
1561
1719
|
const setParts = [
|
|
1562
|
-
drizzleOrm.sql`${
|
|
1563
|
-
drizzleOrm.sql`${
|
|
1720
|
+
drizzleOrm.sql`${chunk7YSP4V4R_cjs.quotedColumn(nodes2.props)} = ${propsJson}`,
|
|
1721
|
+
drizzleOrm.sql`${chunk7YSP4V4R_cjs.quotedColumn(nodes2.updatedAt)} = ${timestamp2}`
|
|
1564
1722
|
];
|
|
1565
1723
|
if (params.incrementVersion) {
|
|
1566
1724
|
setParts.push(
|
|
1567
|
-
drizzleOrm.sql`${
|
|
1725
|
+
drizzleOrm.sql`${chunk7YSP4V4R_cjs.quotedColumn(nodes2.version)} = ${chunk7YSP4V4R_cjs.quotedColumn(nodes2.version)} + 1`
|
|
1568
1726
|
);
|
|
1569
1727
|
}
|
|
1570
1728
|
if (params.validTo !== void 0) {
|
|
1571
|
-
setParts.push(drizzleOrm.sql`${
|
|
1729
|
+
setParts.push(drizzleOrm.sql`${chunk7YSP4V4R_cjs.quotedColumn(nodes2.validTo)} = ${params.validTo}`);
|
|
1572
1730
|
}
|
|
1573
1731
|
if (params.clearDeleted) {
|
|
1574
|
-
setParts.push(drizzleOrm.sql`${
|
|
1732
|
+
setParts.push(drizzleOrm.sql`${chunk7YSP4V4R_cjs.quotedColumn(nodes2.deletedAt)} = NULL`);
|
|
1575
1733
|
}
|
|
1576
1734
|
const setClause = drizzleOrm.sql.join(setParts, drizzleOrm.sql`, `);
|
|
1577
1735
|
if (params.clearDeleted) {
|
|
@@ -1598,7 +1756,7 @@ function buildDeleteNode(tables3, params, timestamp2) {
|
|
|
1598
1756
|
const { nodes: nodes2 } = tables3;
|
|
1599
1757
|
return drizzleOrm.sql`
|
|
1600
1758
|
UPDATE ${nodes2}
|
|
1601
|
-
SET ${
|
|
1759
|
+
SET ${chunk7YSP4V4R_cjs.quotedColumn(nodes2.deletedAt)} = ${timestamp2}
|
|
1602
1760
|
WHERE ${nodes2.graphId} = ${params.graphId}
|
|
1603
1761
|
AND ${nodes2.kind} = ${params.kind}
|
|
1604
1762
|
AND ${nodes2.id} = ${params.id}
|
|
@@ -1665,12 +1823,12 @@ function buildSetActiveSchema(tables3, graphId, version, dialect = "sqlite") {
|
|
|
1665
1823
|
const strategy = SCHEMA_DIALECT_STRATEGIES[dialect];
|
|
1666
1824
|
const deactivateAll = drizzleOrm.sql`
|
|
1667
1825
|
UPDATE ${schemaVersions2}
|
|
1668
|
-
SET ${
|
|
1826
|
+
SET ${chunk7YSP4V4R_cjs.quotedColumn(schemaVersions2.isActive)} = ${strategy.booleanLiteral(false)}
|
|
1669
1827
|
WHERE ${schemaVersions2.graphId} = ${graphId}
|
|
1670
1828
|
`;
|
|
1671
1829
|
const activateVersion = drizzleOrm.sql`
|
|
1672
1830
|
UPDATE ${schemaVersions2}
|
|
1673
|
-
SET ${
|
|
1831
|
+
SET ${chunk7YSP4V4R_cjs.quotedColumn(schemaVersions2.isActive)} = ${strategy.booleanLiteral(true)}
|
|
1674
1832
|
WHERE ${schemaVersions2.graphId} = ${graphId}
|
|
1675
1833
|
AND ${schemaVersions2.version} = ${version}
|
|
1676
1834
|
`;
|
|
@@ -1688,22 +1846,22 @@ function buildInsertUniqueSqlite(tables3, params) {
|
|
|
1688
1846
|
)
|
|
1689
1847
|
ON CONFLICT (${conflictColumns})
|
|
1690
1848
|
DO UPDATE SET
|
|
1691
|
-
${
|
|
1692
|
-
WHEN ${
|
|
1693
|
-
WHEN ${
|
|
1694
|
-
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)}
|
|
1695
1853
|
END,
|
|
1696
|
-
${
|
|
1697
|
-
WHEN ${
|
|
1698
|
-
WHEN ${
|
|
1699
|
-
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)}
|
|
1700
1858
|
END,
|
|
1701
|
-
${
|
|
1702
|
-
WHEN ${
|
|
1703
|
-
WHEN ${
|
|
1704
|
-
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)}
|
|
1705
1863
|
END
|
|
1706
|
-
RETURNING ${
|
|
1864
|
+
RETURNING ${chunk7YSP4V4R_cjs.quotedColumn(uniques2.nodeId)} as node_id
|
|
1707
1865
|
`;
|
|
1708
1866
|
}
|
|
1709
1867
|
function buildInsertUniquePostgres(tables3, params) {
|
|
@@ -1720,22 +1878,22 @@ function buildInsertUniquePostgres(tables3, params) {
|
|
|
1720
1878
|
)
|
|
1721
1879
|
ON CONFLICT (${conflictColumns})
|
|
1722
1880
|
DO UPDATE SET
|
|
1723
|
-
${
|
|
1881
|
+
${chunk7YSP4V4R_cjs.quotedColumn(uniques2.nodeId)} = CASE
|
|
1724
1882
|
WHEN ${existingColumn(uniques2.nodeId)} = ${params.nodeId} THEN ${params.nodeId}
|
|
1725
1883
|
WHEN ${existingColumn(uniques2.deletedAt)} IS NOT NULL THEN ${params.nodeId}
|
|
1726
1884
|
ELSE ${existingColumn(uniques2.nodeId)}
|
|
1727
1885
|
END,
|
|
1728
|
-
${
|
|
1886
|
+
${chunk7YSP4V4R_cjs.quotedColumn(uniques2.concreteKind)} = CASE
|
|
1729
1887
|
WHEN ${existingColumn(uniques2.nodeId)} = ${params.nodeId} THEN ${params.concreteKind}
|
|
1730
1888
|
WHEN ${existingColumn(uniques2.deletedAt)} IS NOT NULL THEN ${params.concreteKind}
|
|
1731
1889
|
ELSE ${existingColumn(uniques2.concreteKind)}
|
|
1732
1890
|
END,
|
|
1733
|
-
${
|
|
1891
|
+
${chunk7YSP4V4R_cjs.quotedColumn(uniques2.deletedAt)} = CASE
|
|
1734
1892
|
WHEN ${existingColumn(uniques2.nodeId)} = ${params.nodeId} THEN NULL
|
|
1735
1893
|
WHEN ${existingColumn(uniques2.deletedAt)} IS NOT NULL THEN NULL
|
|
1736
1894
|
ELSE ${existingColumn(uniques2.deletedAt)}
|
|
1737
1895
|
END
|
|
1738
|
-
RETURNING ${
|
|
1896
|
+
RETURNING ${chunk7YSP4V4R_cjs.quotedColumn(uniques2.nodeId)} as node_id
|
|
1739
1897
|
`;
|
|
1740
1898
|
}
|
|
1741
1899
|
var UNIQUE_INSERT_BUILDERS = {
|
|
@@ -1746,11 +1904,55 @@ function buildInsertUnique(tables3, dialect, params) {
|
|
|
1746
1904
|
const builder = UNIQUE_INSERT_BUILDERS[dialect];
|
|
1747
1905
|
return builder(tables3, params);
|
|
1748
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
|
+
}
|
|
1749
1951
|
function buildDeleteUnique(tables3, params, timestamp2) {
|
|
1750
1952
|
const { uniques: uniques2 } = tables3;
|
|
1751
1953
|
return drizzleOrm.sql`
|
|
1752
1954
|
UPDATE ${uniques2}
|
|
1753
|
-
SET ${
|
|
1955
|
+
SET ${chunk7YSP4V4R_cjs.quotedColumn(uniques2.deletedAt)} = ${timestamp2}
|
|
1754
1956
|
WHERE ${uniques2.graphId} = ${params.graphId}
|
|
1755
1957
|
AND ${uniques2.nodeKind} = ${params.nodeKind}
|
|
1756
1958
|
AND ${uniques2.constraintName} = ${params.constraintName}
|
|
@@ -1839,7 +2041,9 @@ var COMMON_TABLE_OPERATION_BUILDERS = {
|
|
|
1839
2041
|
buildGetEdges,
|
|
1840
2042
|
buildUpdateEdge,
|
|
1841
2043
|
buildDeleteEdge,
|
|
2044
|
+
buildDeleteEdgesBatch,
|
|
1842
2045
|
buildHardDeleteEdge,
|
|
2046
|
+
buildHardDeleteEdgesBatch,
|
|
1843
2047
|
buildHardDeleteEdgesByNode,
|
|
1844
2048
|
buildCountEdgesFrom,
|
|
1845
2049
|
buildEdgeExistsBetween,
|
|
@@ -1870,7 +2074,57 @@ function createCommonOperationStrategy(tables3, dialect, fulltextStrategy) {
|
|
|
1870
2074
|
}),
|
|
1871
2075
|
buildUpsertFulltextBatch: (params, timestamp2) => fulltextStrategy.buildBatchUpsert(fulltextTable, params, timestamp2),
|
|
1872
2076
|
buildDeleteFulltextBatch: (params) => fulltextStrategy.buildBatchDelete(fulltextTable, params),
|
|
1873
|
-
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, chunkCTTSDJLY_cjs.nowIso())
|
|
2085
|
+
),
|
|
2086
|
+
buildLiveNodeIds: (graphId, nodeKind) => chunk7YSP4V4R_cjs.liveNodeIdsSubquery(tables3.nodes, graphId, nodeKind, chunkCTTSDJLY_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
|
+
chunkCTTSDJLY_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
|
+
}
|
|
1874
2128
|
};
|
|
1875
2129
|
return {
|
|
1876
2130
|
...tableOperations,
|
|
@@ -1878,6 +2132,9 @@ function createCommonOperationStrategy(tables3, dialect, fulltextStrategy) {
|
|
|
1878
2132
|
buildInsertUnique(params) {
|
|
1879
2133
|
return buildInsertUnique(tables3, dialect, params);
|
|
1880
2134
|
},
|
|
2135
|
+
buildInsertUniqueBatch(entries) {
|
|
2136
|
+
return buildInsertUniqueBatch(tables3, dialect, entries);
|
|
2137
|
+
},
|
|
1881
2138
|
buildGetActiveSchema(graphId) {
|
|
1882
2139
|
return buildGetActiveSchema(tables3, graphId, dialect);
|
|
1883
2140
|
},
|
|
@@ -1907,7 +2164,7 @@ function createCommonOperationStrategy(tables3, dialect, fulltextStrategy) {
|
|
|
1907
2164
|
}
|
|
1908
2165
|
function tableExistsFromRow(row) {
|
|
1909
2166
|
if (row === void 0) return false;
|
|
1910
|
-
return Object.values(row).some((value) =>
|
|
2167
|
+
return Object.values(row).some((value) => chunk4TOD4LBZ_cjs.isPresent(value));
|
|
1911
2168
|
}
|
|
1912
2169
|
function createCachedTableExistence(probe, options) {
|
|
1913
2170
|
const cacheExisting = options?.cacheExisting !== false;
|
|
@@ -1936,7 +2193,7 @@ function createPostgresOperationStrategy(tables3, fulltextStrategy) {
|
|
|
1936
2193
|
function assertAdoptedDialect(externalTx, brand, backend) {
|
|
1937
2194
|
if (drizzleOrm.is(externalTx, brand)) return;
|
|
1938
2195
|
const label = backend === "postgres" ? "Postgres" : "SQLite";
|
|
1939
|
-
throw new
|
|
2196
|
+
throw new chunkLGEALRC6_cjs.ConfigurationError(
|
|
1940
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.`,
|
|
1941
2198
|
{ backend, capability: "adoptTransaction" }
|
|
1942
2199
|
);
|
|
@@ -1944,7 +2201,7 @@ function assertAdoptedDialect(externalTx, brand, backend) {
|
|
|
1944
2201
|
function verifyExpectedActiveVersion(graphId, expected, actualActiveVersion) {
|
|
1945
2202
|
const expectedVersion = expected.kind === "active" ? expected.version : 0;
|
|
1946
2203
|
if (actualActiveVersion !== expectedVersion) {
|
|
1947
|
-
throw new
|
|
2204
|
+
throw new chunkLGEALRC6_cjs.StaleVersionError({
|
|
1948
2205
|
graphId,
|
|
1949
2206
|
expected: expectedVersion,
|
|
1950
2207
|
actual: actualActiveVersion
|
|
@@ -1953,7 +2210,7 @@ function verifyExpectedActiveVersion(graphId, expected, actualActiveVersion) {
|
|
|
1953
2210
|
}
|
|
1954
2211
|
function createCommonOperationBackend(options) {
|
|
1955
2212
|
const { batchConfig, execution, operationStrategy, rowMappers } = options;
|
|
1956
|
-
const nowIso2 = options.nowIso ??
|
|
2213
|
+
const nowIso2 = options.nowIso ?? chunkCTTSDJLY_cjs.nowIso;
|
|
1957
2214
|
const requiredClearTableExists = createCachedTableExistence(
|
|
1958
2215
|
(tableName) => execution.execGet(
|
|
1959
2216
|
operationStrategy.buildTableExists(tableName)
|
|
@@ -1980,7 +2237,7 @@ function createCommonOperationBackend(options) {
|
|
|
1980
2237
|
const timestamp2 = nowIso2();
|
|
1981
2238
|
const query = operationStrategy.buildInsertNode(params, timestamp2);
|
|
1982
2239
|
const row = await execution.execGet(query);
|
|
1983
|
-
if (!row) throw new
|
|
2240
|
+
if (!row) throw new chunkLGEALRC6_cjs.DatabaseOperationError("Insert node failed: no row returned", { operation: "insert", entity: "node" });
|
|
1984
2241
|
return rowMappers.toNodeRow(row);
|
|
1985
2242
|
},
|
|
1986
2243
|
async insertNodeNoReturn(params) {
|
|
@@ -1993,7 +2250,7 @@ function createCommonOperationBackend(options) {
|
|
|
1993
2250
|
return;
|
|
1994
2251
|
}
|
|
1995
2252
|
const timestamp2 = nowIso2();
|
|
1996
|
-
for (const chunk2 of
|
|
2253
|
+
for (const chunk2 of chunk4TOD4LBZ_cjs.chunk(params, batchConfig.nodeInsertBatchSize)) {
|
|
1997
2254
|
const query = operationStrategy.buildInsertNodesBatch(chunk2, timestamp2);
|
|
1998
2255
|
await execution.execRun(query);
|
|
1999
2256
|
}
|
|
@@ -2004,7 +2261,7 @@ function createCommonOperationBackend(options) {
|
|
|
2004
2261
|
}
|
|
2005
2262
|
const timestamp2 = nowIso2();
|
|
2006
2263
|
const allRows = [];
|
|
2007
|
-
for (const chunk2 of
|
|
2264
|
+
for (const chunk2 of chunk4TOD4LBZ_cjs.chunk(params, batchConfig.nodeInsertBatchSize)) {
|
|
2008
2265
|
const query = operationStrategy.buildInsertNodesBatchReturning(chunk2, timestamp2);
|
|
2009
2266
|
const rows = await execution.execAll(query);
|
|
2010
2267
|
allRows.push(...rows.map((row) => rowMappers.toNodeRow(row)));
|
|
@@ -2019,7 +2276,7 @@ function createCommonOperationBackend(options) {
|
|
|
2019
2276
|
async getNodes(graphId, kind, ids) {
|
|
2020
2277
|
if (ids.length === 0) return [];
|
|
2021
2278
|
const allRows = [];
|
|
2022
|
-
for (const chunk2 of
|
|
2279
|
+
for (const chunk2 of chunk4TOD4LBZ_cjs.chunk(ids, batchConfig.getNodesChunkSize)) {
|
|
2023
2280
|
const query = operationStrategy.buildGetNodes(graphId, kind, chunk2);
|
|
2024
2281
|
const rows = await execution.execAll(query);
|
|
2025
2282
|
allRows.push(...rows.map((row) => rowMappers.toNodeRow(row)));
|
|
@@ -2030,7 +2287,7 @@ function createCommonOperationBackend(options) {
|
|
|
2030
2287
|
const timestamp2 = nowIso2();
|
|
2031
2288
|
const query = operationStrategy.buildUpdateNode(params, timestamp2);
|
|
2032
2289
|
const row = await execution.execGet(query);
|
|
2033
|
-
if (!row) throw new
|
|
2290
|
+
if (!row) throw new chunkLGEALRC6_cjs.DatabaseOperationError("Update node failed: no row returned", { operation: "update", entity: "node" });
|
|
2034
2291
|
return rowMappers.toNodeRow(row);
|
|
2035
2292
|
},
|
|
2036
2293
|
async deleteNode(params) {
|
|
@@ -2074,7 +2331,7 @@ function createCommonOperationBackend(options) {
|
|
|
2074
2331
|
const timestamp2 = nowIso2();
|
|
2075
2332
|
const query = operationStrategy.buildInsertEdge(params, timestamp2);
|
|
2076
2333
|
const row = await execution.execGet(query);
|
|
2077
|
-
if (!row) throw new
|
|
2334
|
+
if (!row) throw new chunkLGEALRC6_cjs.DatabaseOperationError("Insert edge failed: no row returned", { operation: "insert", entity: "edge" });
|
|
2078
2335
|
return rowMappers.toEdgeRow(row);
|
|
2079
2336
|
},
|
|
2080
2337
|
async insertEdgeNoReturn(params) {
|
|
@@ -2087,7 +2344,7 @@ function createCommonOperationBackend(options) {
|
|
|
2087
2344
|
return;
|
|
2088
2345
|
}
|
|
2089
2346
|
const timestamp2 = nowIso2();
|
|
2090
|
-
for (const chunk2 of
|
|
2347
|
+
for (const chunk2 of chunk4TOD4LBZ_cjs.chunk(params, batchConfig.edgeInsertBatchSize)) {
|
|
2091
2348
|
const query = operationStrategy.buildInsertEdgesBatch(chunk2, timestamp2);
|
|
2092
2349
|
await execution.execRun(query);
|
|
2093
2350
|
}
|
|
@@ -2098,7 +2355,7 @@ function createCommonOperationBackend(options) {
|
|
|
2098
2355
|
}
|
|
2099
2356
|
const timestamp2 = nowIso2();
|
|
2100
2357
|
const allRows = [];
|
|
2101
|
-
for (const chunk2 of
|
|
2358
|
+
for (const chunk2 of chunk4TOD4LBZ_cjs.chunk(params, batchConfig.edgeInsertBatchSize)) {
|
|
2102
2359
|
const query = operationStrategy.buildInsertEdgesBatchReturning(chunk2, timestamp2);
|
|
2103
2360
|
const rows = await execution.execAll(query);
|
|
2104
2361
|
allRows.push(...rows.map((row) => rowMappers.toEdgeRow(row)));
|
|
@@ -2113,7 +2370,7 @@ function createCommonOperationBackend(options) {
|
|
|
2113
2370
|
async getEdges(graphId, ids) {
|
|
2114
2371
|
if (ids.length === 0) return [];
|
|
2115
2372
|
const allRows = [];
|
|
2116
|
-
for (const chunk2 of
|
|
2373
|
+
for (const chunk2 of chunk4TOD4LBZ_cjs.chunk(ids, batchConfig.getEdgesChunkSize)) {
|
|
2117
2374
|
const query = operationStrategy.buildGetEdges(graphId, chunk2);
|
|
2118
2375
|
const rows = await execution.execAll(query);
|
|
2119
2376
|
allRows.push(...rows.map((row) => rowMappers.toEdgeRow(row)));
|
|
@@ -2124,7 +2381,7 @@ function createCommonOperationBackend(options) {
|
|
|
2124
2381
|
const timestamp2 = nowIso2();
|
|
2125
2382
|
const query = operationStrategy.buildUpdateEdge(params, timestamp2);
|
|
2126
2383
|
const row = await execution.execGet(query);
|
|
2127
|
-
if (!row) throw new
|
|
2384
|
+
if (!row) throw new chunkLGEALRC6_cjs.DatabaseOperationError("Update edge failed: no row returned", { operation: "update", entity: "edge" });
|
|
2128
2385
|
return rowMappers.toEdgeRow(row);
|
|
2129
2386
|
},
|
|
2130
2387
|
async deleteEdge(params) {
|
|
@@ -2136,6 +2393,28 @@ function createCommonOperationBackend(options) {
|
|
|
2136
2393
|
const query = operationStrategy.buildHardDeleteEdge(params);
|
|
2137
2394
|
await execution.execRun(query);
|
|
2138
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 chunk4TOD4LBZ_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 chunk4TOD4LBZ_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
|
+
},
|
|
2139
2418
|
async countEdgesFrom(params) {
|
|
2140
2419
|
const query = operationStrategy.buildCountEdgesFrom(params);
|
|
2141
2420
|
const row = await execution.execGet(query);
|
|
@@ -2175,7 +2454,7 @@ function createCommonOperationBackend(options) {
|
|
|
2175
2454
|
const query = operationStrategy.buildInsertUnique(params);
|
|
2176
2455
|
const result = await execution.execGet(query);
|
|
2177
2456
|
if (result && result.node_id !== params.nodeId) {
|
|
2178
|
-
throw new
|
|
2457
|
+
throw new chunkLGEALRC6_cjs.UniquenessError({
|
|
2179
2458
|
constraintName: params.constraintName,
|
|
2180
2459
|
kind: params.nodeKind,
|
|
2181
2460
|
existingId: result.node_id,
|
|
@@ -2184,6 +2463,53 @@ function createCommonOperationBackend(options) {
|
|
|
2184
2463
|
});
|
|
2185
2464
|
}
|
|
2186
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 chunkLGEALRC6_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 chunk4TOD4LBZ_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 chunkLGEALRC6_cjs.UniquenessError({
|
|
2503
|
+
constraintName: entry.constraintName,
|
|
2504
|
+
kind: entry.nodeKind,
|
|
2505
|
+
existingId: owner,
|
|
2506
|
+
newId: entry.nodeId,
|
|
2507
|
+
fields: []
|
|
2508
|
+
});
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2512
|
+
},
|
|
2187
2513
|
async deleteUnique(params) {
|
|
2188
2514
|
const timestamp2 = nowIso2();
|
|
2189
2515
|
const query = operationStrategy.buildDeleteUnique(params, timestamp2);
|
|
@@ -2197,7 +2523,7 @@ function createCommonOperationBackend(options) {
|
|
|
2197
2523
|
async checkUniqueBatch(params) {
|
|
2198
2524
|
if (params.keys.length === 0) return [];
|
|
2199
2525
|
const allRows = [];
|
|
2200
|
-
for (const chunk2 of
|
|
2526
|
+
for (const chunk2 of chunk4TOD4LBZ_cjs.chunk(params.keys, batchConfig.checkUniqueBatchChunkSize)) {
|
|
2201
2527
|
const query = operationStrategy.buildCheckUniqueBatch({ ...params, keys: chunk2 });
|
|
2202
2528
|
const rows = await execution.execAll(query);
|
|
2203
2529
|
allRows.push(...rows.map((row) => rowMappers.toUniqueRow(row)));
|
|
@@ -2225,7 +2551,7 @@ function createCommonOperationBackend(options) {
|
|
|
2225
2551
|
if (existingRaw !== void 0) {
|
|
2226
2552
|
const existing = rowMappers.toSchemaVersionRow(existingRaw);
|
|
2227
2553
|
if (existing.schema_hash !== params.schemaHash) {
|
|
2228
|
-
throw new
|
|
2554
|
+
throw new chunkLGEALRC6_cjs.SchemaContentConflictError({
|
|
2229
2555
|
graphId: params.graphId,
|
|
2230
2556
|
version: params.version,
|
|
2231
2557
|
existingHash: existing.schema_hash,
|
|
@@ -2273,7 +2599,7 @@ function createCommonOperationBackend(options) {
|
|
|
2273
2599
|
);
|
|
2274
2600
|
const insertedRaw = await execution.execGet(insertQuery);
|
|
2275
2601
|
if (!insertedRaw) {
|
|
2276
|
-
throw new
|
|
2602
|
+
throw new chunkLGEALRC6_cjs.DatabaseOperationError(
|
|
2277
2603
|
"Insert schema failed: no row returned",
|
|
2278
2604
|
{ operation: "insert", entity: "schema" }
|
|
2279
2605
|
);
|
|
@@ -2294,7 +2620,7 @@ function createCommonOperationBackend(options) {
|
|
|
2294
2620
|
)
|
|
2295
2621
|
);
|
|
2296
2622
|
if (!targetRaw) {
|
|
2297
|
-
throw new
|
|
2623
|
+
throw new chunkLGEALRC6_cjs.MigrationError(
|
|
2298
2624
|
`Cannot activate version ${params.version}: version does not exist for graph "${params.graphId}".`,
|
|
2299
2625
|
{
|
|
2300
2626
|
graphId: params.graphId,
|
|
@@ -2346,6 +2672,7 @@ function compileQueryWithDialect(db, query, backendName) {
|
|
|
2346
2672
|
return compiler.sqlToQuery(query);
|
|
2347
2673
|
}
|
|
2348
2674
|
|
|
2675
|
+
exports.EMBEDDING_UPSERT_PARAM_COUNT = EMBEDDING_UPSERT_PARAM_COUNT;
|
|
2349
2676
|
exports.POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS = POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS;
|
|
2350
2677
|
exports.POSTGRES_INDEX_MAT_TIMESTAMPS = POSTGRES_INDEX_MAT_TIMESTAMPS;
|
|
2351
2678
|
exports.POSTGRES_KIND_REMOVAL_TIMESTAMPS = POSTGRES_KIND_REMOVAL_TIMESTAMPS;
|
|
@@ -2378,7 +2705,9 @@ exports.generateSqliteCreateTableSQL = generateSqliteCreateTableSQL;
|
|
|
2378
2705
|
exports.generateSqliteDDL = generateSqliteDDL;
|
|
2379
2706
|
exports.generateSqliteMigrationSQL = generateSqliteMigrationSQL;
|
|
2380
2707
|
exports.getOrCreateLru = getOrCreateLru;
|
|
2708
|
+
exports.hybridCandidatesRef = hybridCandidatesRef;
|
|
2381
2709
|
exports.mapContributionMaterializationRow = mapContributionMaterializationRow;
|
|
2710
|
+
exports.mapHybridSearchRow = mapHybridSearchRow;
|
|
2382
2711
|
exports.mapKindRemovalRow = mapKindRemovalRow;
|
|
2383
2712
|
exports.mapMaterializationRow = mapMaterializationRow;
|
|
2384
2713
|
exports.mapVectorWriteError = mapVectorWriteError;
|
|
@@ -2392,5 +2721,5 @@ exports.uniques = uniques;
|
|
|
2392
2721
|
exports.vectorSlotFromCreateIndexParams = vectorSlotFromCreateIndexParams;
|
|
2393
2722
|
exports.vectorSlotFromDropIndexParams = vectorSlotFromDropIndexParams;
|
|
2394
2723
|
exports.vectorSlotFromParams = vectorSlotFromParams;
|
|
2395
|
-
//# sourceMappingURL=chunk-
|
|
2396
|
-
//# sourceMappingURL=chunk-
|
|
2724
|
+
//# sourceMappingURL=chunk-EM3CWPND.cjs.map
|
|
2725
|
+
//# sourceMappingURL=chunk-EM3CWPND.cjs.map
|