@nicia-ai/typegraph 0.34.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/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-ZV5N4DBG.js → chunk-3TWF3SH4.js} +300 -58
- 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-UNNPKQUG.cjs → chunk-4TOD4LBZ.cjs} +246 -155
- package/dist/chunk-4TOD4LBZ.cjs.map +1 -0
- package/dist/{chunk-QV245VMN.js → chunk-55MZDDZV.js} +100 -6
- package/dist/chunk-55MZDDZV.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-BVTWD66D.js → chunk-5SEGFTZX.js} +3 -3
- package/dist/{chunk-BVTWD66D.js.map → chunk-5SEGFTZX.js.map} +1 -1
- package/dist/{chunk-6GNSY7AV.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-RHZWOJVA.cjs → chunk-BLZDPRXT.cjs} +52 -4
- 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-6HVOHZHS.cjs → chunk-CK5BVQOW.cjs} +213 -168
- package/dist/chunk-CK5BVQOW.cjs.map +1 -0
- package/dist/{chunk-JJRCLAUN.cjs → chunk-CTTSDJLY.cjs} +116 -10
- 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-A7SZZFAG.js → chunk-CZQ3FO2Q.js} +409 -99
- package/dist/chunk-CZQ3FO2Q.js.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-UJLOZYKT.cjs → chunk-EM3CWPND.cjs} +441 -115
- 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-TGJE22RM.cjs → chunk-FACJJWGF.cjs} +24 -6
- package/dist/chunk-FACJJWGF.cjs.map +1 -0
- package/dist/{chunk-HK5SATYM.cjs → chunk-FL472AMI.cjs} +16 -109
- package/dist/chunk-FL472AMI.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-GSQ6NPH6.cjs +100 -0
- package/dist/chunk-GSQ6NPH6.cjs.map +1 -0
- package/dist/chunk-GUR2FNB5.cjs +12 -0
- package/dist/{chunk-HMFK4BXR.cjs.map → chunk-GUR2FNB5.cjs.map} +1 -1
- package/dist/{chunk-JQGIPGVL.cjs → chunk-H7YNSMA7.cjs} +43 -2
- package/dist/chunk-H7YNSMA7.cjs.map +1 -0
- package/dist/{chunk-2MRAX3UE.js → chunk-I7ZUZKFD.js} +47 -4
- package/dist/chunk-I7ZUZKFD.js.map +1 -0
- package/dist/{chunk-3BRVBQQD.cjs → chunk-J7WFGBJR.cjs} +2445 -2367
- package/dist/chunk-J7WFGBJR.cjs.map +1 -0
- package/dist/{chunk-V3QNTB7Z.js → chunk-JBTOYDMN.js} +194 -114
- package/dist/chunk-JBTOYDMN.js.map +1 -0
- package/dist/{chunk-K2TGS3EN.js → chunk-K3PPLHY7.js} +138 -89
- package/dist/chunk-K3PPLHY7.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-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-ZP5WHI4C.cjs → chunk-O7UN7OXA.cjs} +358 -116
- 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-4DIBPQNJ.js → chunk-OR5ZA5WP.js} +135 -25
- package/dist/chunk-OR5ZA5WP.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-QNKSQTKQ.js +1312 -0
- package/dist/chunk-QNKSQTKQ.js.map +1 -0
- package/dist/{chunk-ZURTTSCM.js → chunk-QOTI55H7.js} +6 -94
- package/dist/chunk-QOTI55H7.js.map +1 -0
- package/dist/{chunk-CHXTTSC6.js → chunk-QWEUYILR.js} +104 -5
- package/dist/chunk-QWEUYILR.js.map +1 -0
- package/dist/{chunk-LANHCOXB.js → chunk-RGP33ZJ5.js} +485 -83
- 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-G6SOJEDI.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-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-WLRIWYHQ.js → chunk-UES55P7G.js} +1863 -1785
- package/dist/chunk-UES55P7G.js.map +1 -0
- 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-T6SPUYLX.cjs → chunk-VPYHY3LJ.cjs} +116 -10
- package/dist/chunk-VPYHY3LJ.cjs.map +1 -0
- package/dist/{chunk-T46GR2VY.js → chunk-VSPCZAXF.js} +3 -3
- package/dist/{chunk-T46GR2VY.js.map → chunk-VSPCZAXF.js.map} +1 -1
- 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-RY2VIWAM.js → chunk-WDBCBWC4.js} +355 -32
- 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-5IQIX7LU.cjs → chunk-XOX22WHL.cjs} +476 -163
- package/dist/chunk-XOX22WHL.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-6CSUAq-x.d.ts} +234 -93
- package/dist/{index-SEvUHDA6.d.cts → index-Bks_3HHK.d.cts} +234 -93
- package/dist/index.cjs +208 -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 +47 -26
- package/dist/interchange/index.d.cts +126 -12
- package/dist/interchange/index.d.ts +126 -12
- package/dist/interchange/index.js +14 -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-BSpqvAxK.d.cts} +415 -44
- package/dist/{store-view-BlgnhEYf.d.ts → store-view-CKbHFRnn.d.ts} +415 -44
- 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,13 +1,13 @@
|
|
|
1
|
-
import { tables } from './chunk-
|
|
2
|
-
import { buildPostgresNodeIndexBuilders, buildPostgresEdgeIndexBuilders } from './chunk-
|
|
3
|
-
import { formatPostgresTimestamp, nowIso } from './chunk-
|
|
1
|
+
import { tables } from './chunk-VHMPG6UL.js';
|
|
2
|
+
import { buildPostgresNodeIndexBuilders, buildPostgresEdgeIndexBuilders } from './chunk-6FR2MMS6.js';
|
|
3
|
+
import { formatPostgresTimestamp, coerceNumericScore, nowIso } from './chunk-55MZDDZV.js';
|
|
4
4
|
import { sortedReplacer } from './chunk-UR7W5YQK.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { createBackendOverlay, chunk, isPresent, sqlValueList } from './chunk-
|
|
8
|
-
import { parseDimensionMismatch, isMissingTableError } from './chunk-
|
|
9
|
-
import { quotedTableName, quotedColumn, edgeColumnList, sqlNull, nodeColumnList } from './chunk-
|
|
10
|
-
import { EmbeddingDimensionChangedError, ConfigurationError, MigrationError, SchemaContentConflictError, DatabaseOperationError, UniquenessError, StoreNotInitializedError, StaleVersionError } from './chunk-
|
|
5
|
+
import { sha256Hex } from './chunk-W63OVYY4.js';
|
|
6
|
+
import { tsvectorStrategy, fts5Strategy, BASE_CONTRIBUTION_OWNER } from './chunk-FPIZFYHE.js';
|
|
7
|
+
import { createBackendOverlay, chunk, isPresent, sqlValueList } from './chunk-JBTOYDMN.js';
|
|
8
|
+
import { parseDimensionMismatch, isMissingTableError } from './chunk-I7ZUZKFD.js';
|
|
9
|
+
import { liveNodeIdsSubquery, quotedTableName, quotedColumn, codePointOrderKey, edgeColumnList, sqlNull, resolveValidFrom, nodeColumnList } from './chunk-OHMP6N2J.js';
|
|
10
|
+
import { EmbeddingDimensionChangedError, ConfigurationError, MigrationError, SchemaContentConflictError, DatabaseOperationError, UniquenessError, StoreNotInitializedError, StaleVersionError } from './chunk-MP2JQKSG.js';
|
|
11
11
|
import { sql, is, getTableName } from 'drizzle-orm';
|
|
12
12
|
import { customType, pgTable, timestamp, integer, jsonb, text, primaryKey, index, boolean, uniqueIndex, getTableConfig as getTableConfig$1, PgTable } from 'drizzle-orm/pg-core';
|
|
13
13
|
import { getTableConfig, SQLiteTable } from 'drizzle-orm/sqlite-core';
|
|
@@ -26,6 +26,7 @@ var DEFAULT_TABLE_NAMES = {
|
|
|
26
26
|
recordedNodes: "typegraph_recorded_nodes",
|
|
27
27
|
recordedEdges: "typegraph_recorded_edges",
|
|
28
28
|
recordedClock: "typegraph_recorded_clock",
|
|
29
|
+
revisionOrigins: "typegraph_revision_origins",
|
|
29
30
|
uniques: "typegraph_node_uniques",
|
|
30
31
|
schemaVersions: "typegraph_schema_versions",
|
|
31
32
|
fulltext: "typegraph_node_fulltext",
|
|
@@ -86,7 +87,13 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
86
87
|
primaryKey({ columns: [t.graphId, t.id] }),
|
|
87
88
|
index(`${n.edges}_kind_idx`).on(t.graphId, t.kind),
|
|
88
89
|
// Directional traversal index (outgoing): supports endpoint lookups
|
|
89
|
-
// and extra filtering by edge kind / target kind.
|
|
90
|
+
// and extra filtering by edge kind / target kind. Includes every
|
|
91
|
+
// system column the compiled query's soft-delete/temporal-validity
|
|
92
|
+
// predicate touches (deleted_at, valid_from, valid_to), trailed by
|
|
93
|
+
// to_id — the compiled traversal join reads `n.id = e.to_id` for an
|
|
94
|
+
// outgoing traversal (standard-builders.ts), so without to_id here
|
|
95
|
+
// the join still fetches the edge's heap row for that one column
|
|
96
|
+
// even with the seek/predicate columns covered.
|
|
90
97
|
index(`${n.edges}_from_idx`).on(
|
|
91
98
|
t.graphId,
|
|
92
99
|
t.fromKind,
|
|
@@ -94,9 +101,13 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
94
101
|
t.kind,
|
|
95
102
|
t.toKind,
|
|
96
103
|
t.deletedAt,
|
|
97
|
-
t.
|
|
104
|
+
t.validFrom,
|
|
105
|
+
t.validTo,
|
|
106
|
+
t.toId
|
|
98
107
|
),
|
|
99
|
-
// Directional traversal index (incoming): mirrors from_idx for
|
|
108
|
+
// Directional traversal index (incoming): mirrors from_idx for
|
|
109
|
+
// reverse traversals, trailed by from_id for the same reason
|
|
110
|
+
// (`n.id = e.from_id` for an incoming traversal).
|
|
100
111
|
index(`${n.edges}_to_idx`).on(
|
|
101
112
|
t.graphId,
|
|
102
113
|
t.toKind,
|
|
@@ -104,7 +115,9 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
104
115
|
t.kind,
|
|
105
116
|
t.fromKind,
|
|
106
117
|
t.deletedAt,
|
|
107
|
-
t.
|
|
118
|
+
t.validFrom,
|
|
119
|
+
t.validTo,
|
|
120
|
+
t.fromId
|
|
108
121
|
),
|
|
109
122
|
index(`${n.edges}_kind_created_idx`).on(
|
|
110
123
|
t.graphId,
|
|
@@ -229,6 +242,14 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
229
242
|
},
|
|
230
243
|
(t) => [primaryKey({ columns: [t.graphId] })]
|
|
231
244
|
);
|
|
245
|
+
const revisionOrigins = pgTable(
|
|
246
|
+
n.revisionOrigins,
|
|
247
|
+
{
|
|
248
|
+
graphId: text("graph_id").notNull(),
|
|
249
|
+
origin: text("origin").notNull()
|
|
250
|
+
},
|
|
251
|
+
(t) => [primaryKey({ columns: [t.graphId] })]
|
|
252
|
+
);
|
|
232
253
|
const uniques2 = pgTable(
|
|
233
254
|
n.uniques,
|
|
234
255
|
{
|
|
@@ -281,7 +302,14 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
281
302
|
lastAttemptedAt: timestamp("last_attempted_at", {
|
|
282
303
|
withTimezone: true
|
|
283
304
|
}).notNull(),
|
|
284
|
-
lastError: text("last_error")
|
|
305
|
+
lastError: text("last_error"),
|
|
306
|
+
// Cross-caller build claim: while `building_since` is fresh (within
|
|
307
|
+
// the lease), exactly one materializer owns this index's CREATE
|
|
308
|
+
// INDEX CONCURRENTLY. Serializes same-index CIC across processes —
|
|
309
|
+
// two concurrent expression-index CICs deadlock each other (no
|
|
310
|
+
// safe-snapshot exemption). NULL when no build is in flight.
|
|
311
|
+
buildingSince: timestamp("building_since", { withTimezone: true }),
|
|
312
|
+
claimToken: text("claim_token")
|
|
285
313
|
},
|
|
286
314
|
(t) => [primaryKey({ columns: [t.indexName] })]
|
|
287
315
|
);
|
|
@@ -355,6 +383,7 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
355
383
|
recordedNodes: recordedNodes2,
|
|
356
384
|
recordedEdges: recordedEdges2,
|
|
357
385
|
recordedClock: recordedClock2,
|
|
386
|
+
revisionOrigins,
|
|
358
387
|
uniques: uniques2,
|
|
359
388
|
schemaVersions: schemaVersions2,
|
|
360
389
|
indexMaterializations,
|
|
@@ -431,9 +460,9 @@ function renderIndexColumn(col) {
|
|
|
431
460
|
if (col && typeof col === "object" && "name" in col) {
|
|
432
461
|
return `"${col.name}"`;
|
|
433
462
|
}
|
|
434
|
-
const
|
|
435
|
-
if (
|
|
436
|
-
return
|
|
463
|
+
const sql14 = tryInlineSql(col);
|
|
464
|
+
if (sql14 !== void 0) {
|
|
465
|
+
return sql14;
|
|
437
466
|
}
|
|
438
467
|
return "unknown";
|
|
439
468
|
}
|
|
@@ -689,6 +718,7 @@ function createVectorSlotLatch() {
|
|
|
689
718
|
};
|
|
690
719
|
}
|
|
691
720
|
var VECTOR_SLOT_PLACEHOLDER_DIMENSIONS = 1;
|
|
721
|
+
var EMBEDDING_UPSERT_PARAM_COUNT = 5;
|
|
692
722
|
function vectorSlotFromParams(params) {
|
|
693
723
|
return {
|
|
694
724
|
graphId: params.graphId,
|
|
@@ -1065,6 +1095,109 @@ function buildKindRemovalOnConflictSet(removedAtColumn, paramsRemovedAt) {
|
|
|
1065
1095
|
lastError: sql`excluded.${sql.identifier("last_error")}`
|
|
1066
1096
|
};
|
|
1067
1097
|
}
|
|
1098
|
+
function nodeIdOrderKey(dialect) {
|
|
1099
|
+
return codePointOrderKey(sql.raw("node_id"), dialect);
|
|
1100
|
+
}
|
|
1101
|
+
function hybridCandidatesRef() {
|
|
1102
|
+
return sql`SELECT node_id FROM tg_hybrid_cand`;
|
|
1103
|
+
}
|
|
1104
|
+
function buildHybridSearchStatement(input) {
|
|
1105
|
+
const { nodes: nodes2 } = input;
|
|
1106
|
+
const nodeIdOrder = nodeIdOrderKey(input.dialect);
|
|
1107
|
+
const vectorOrder = input.vectorScoreDescending ? sql`score DESC, ${nodeIdOrder} ASC` : sql`score ASC, ${nodeIdOrder} ASC`;
|
|
1108
|
+
const columnPairs = [
|
|
1109
|
+
[nodes2.graphId, "graph_id"],
|
|
1110
|
+
[nodes2.kind, "kind"],
|
|
1111
|
+
[nodes2.id, "id"],
|
|
1112
|
+
[nodes2.props, "props"],
|
|
1113
|
+
[nodes2.version, "version"],
|
|
1114
|
+
[nodes2.validFrom, "valid_from"],
|
|
1115
|
+
[nodes2.validTo, "valid_to"],
|
|
1116
|
+
[nodes2.createdAt, "created_at"],
|
|
1117
|
+
[nodes2.updatedAt, "updated_at"],
|
|
1118
|
+
[nodes2.deletedAt, "deleted_at"]
|
|
1119
|
+
];
|
|
1120
|
+
const nodeColumns = sql.raw(
|
|
1121
|
+
columnPairs.map(
|
|
1122
|
+
([column, alias]) => `tg_hybrid_node."${column.name.replaceAll('"', '""')}" AS ${alias}`
|
|
1123
|
+
).join(", ")
|
|
1124
|
+
);
|
|
1125
|
+
return sql`
|
|
1126
|
+
WITH tg_hybrid_cand AS (
|
|
1127
|
+
SELECT node_id FROM (${input.candidatesSql}) AS tg_hybrid_cand_src
|
|
1128
|
+
),
|
|
1129
|
+
tg_hybrid_vec AS (
|
|
1130
|
+
SELECT node_id, score,
|
|
1131
|
+
ROW_NUMBER() OVER (ORDER BY ${vectorOrder}) AS ord
|
|
1132
|
+
FROM (${input.vectorSql}) AS tg_hybrid_vec_src
|
|
1133
|
+
),
|
|
1134
|
+
tg_hybrid_fts AS (
|
|
1135
|
+
SELECT node_id, score, snippet,
|
|
1136
|
+
ROW_NUMBER() OVER (ORDER BY score DESC, ${nodeIdOrder} ASC) AS ord
|
|
1137
|
+
FROM (${input.fulltextSql}) AS tg_hybrid_fts_src
|
|
1138
|
+
),
|
|
1139
|
+
tg_hybrid_pairs AS (
|
|
1140
|
+
SELECT node_id, ord AS vector_rank, score AS vector_score,
|
|
1141
|
+
NULL AS fulltext_rank, NULL AS fulltext_score, NULL AS snippet
|
|
1142
|
+
FROM tg_hybrid_vec
|
|
1143
|
+
UNION ALL
|
|
1144
|
+
SELECT node_id, NULL, NULL, ord, score, snippet
|
|
1145
|
+
FROM tg_hybrid_fts
|
|
1146
|
+
),
|
|
1147
|
+
tg_hybrid_fused AS MATERIALIZED (
|
|
1148
|
+
SELECT node_id,
|
|
1149
|
+
SUM(
|
|
1150
|
+
COALESCE((${input.vectorWeight} * 1.0) / (${input.fusionK} + vector_rank), 0)
|
|
1151
|
+
+ COALESCE((${input.fulltextWeight} * 1.0) / (${input.fusionK} + fulltext_rank), 0)
|
|
1152
|
+
) AS fused_score,
|
|
1153
|
+
MAX(vector_rank) AS vector_rank,
|
|
1154
|
+
MAX(vector_score) AS vector_score,
|
|
1155
|
+
MAX(fulltext_rank) AS fulltext_rank,
|
|
1156
|
+
MAX(fulltext_score) AS fulltext_score,
|
|
1157
|
+
MAX(snippet) AS snippet
|
|
1158
|
+
FROM tg_hybrid_pairs
|
|
1159
|
+
GROUP BY node_id
|
|
1160
|
+
)
|
|
1161
|
+
SELECT
|
|
1162
|
+
tg_hybrid_fused.node_id AS node_id,
|
|
1163
|
+
tg_hybrid_fused.fused_score AS fused_score,
|
|
1164
|
+
tg_hybrid_fused.vector_rank AS vector_rank,
|
|
1165
|
+
tg_hybrid_fused.vector_score AS vector_score,
|
|
1166
|
+
tg_hybrid_fused.fulltext_rank AS fulltext_rank,
|
|
1167
|
+
tg_hybrid_fused.fulltext_score AS fulltext_score,
|
|
1168
|
+
tg_hybrid_fused.snippet AS snippet,
|
|
1169
|
+
${nodeColumns}
|
|
1170
|
+
FROM tg_hybrid_fused
|
|
1171
|
+
JOIN ${nodes2} AS tg_hybrid_node
|
|
1172
|
+
ON ${qualified(nodes2, "graphId")} = ${input.graphId}
|
|
1173
|
+
AND ${qualified(nodes2, "kind")} = ${input.nodeKind}
|
|
1174
|
+
AND ${qualified(nodes2, "id")} = tg_hybrid_fused.node_id
|
|
1175
|
+
AND ${qualified(nodes2, "deletedAt")} IS NULL
|
|
1176
|
+
ORDER BY fused_score DESC, ${nodeIdOrder} ASC
|
|
1177
|
+
LIMIT ${input.limit} OFFSET ${input.offset}
|
|
1178
|
+
`;
|
|
1179
|
+
}
|
|
1180
|
+
function qualified(nodes2, member) {
|
|
1181
|
+
return sql`tg_hybrid_node.${quotedColumn(nodes2[member])}`;
|
|
1182
|
+
}
|
|
1183
|
+
function present(value) {
|
|
1184
|
+
return value !== null && value !== void 0;
|
|
1185
|
+
}
|
|
1186
|
+
function mapHybridSearchRow(row, toNodeRow) {
|
|
1187
|
+
return {
|
|
1188
|
+
node: toNodeRow(row),
|
|
1189
|
+
fusedScore: coerceNumericScore(row.fused_score),
|
|
1190
|
+
...present(row.vector_rank) ? { vectorRank: Number(row.vector_rank) } : {},
|
|
1191
|
+
...present(row.vector_score) ? { vectorScore: coerceNumericScore(row.vector_score) } : {},
|
|
1192
|
+
...present(row.fulltext_rank) ? { fulltextRank: Number(row.fulltext_rank) } : {},
|
|
1193
|
+
...present(row.fulltext_score) ? {
|
|
1194
|
+
fulltextScore: coerceNumericScore(
|
|
1195
|
+
row.fulltext_score
|
|
1196
|
+
)
|
|
1197
|
+
} : {},
|
|
1198
|
+
...present(row.snippet) ? { snippet: String(row.snippet) } : {}
|
|
1199
|
+
};
|
|
1200
|
+
}
|
|
1068
1201
|
function buildClearGraph(tables3, graphId) {
|
|
1069
1202
|
const fulltext2 = quotedTableName(tables3.fulltextTableName);
|
|
1070
1203
|
return [
|
|
@@ -1254,7 +1387,7 @@ function buildInsertEdge(tables3, params, timestamp2) {
|
|
|
1254
1387
|
VALUES (
|
|
1255
1388
|
${params.graphId}, ${params.id}, ${params.kind},
|
|
1256
1389
|
${params.fromKind}, ${params.fromId}, ${params.toKind}, ${params.toId},
|
|
1257
|
-
${propsJson}, ${sqlNull(params.validFrom)}, ${sqlNull(params.validTo)},
|
|
1390
|
+
${propsJson}, ${sqlNull(resolveValidFrom(params.validFrom, timestamp2))}, ${sqlNull(params.validTo)},
|
|
1258
1391
|
${timestamp2}, ${timestamp2}
|
|
1259
1392
|
)
|
|
1260
1393
|
RETURNING *
|
|
@@ -1269,7 +1402,7 @@ function buildInsertEdgeNoReturn(tables3, params, timestamp2) {
|
|
|
1269
1402
|
VALUES (
|
|
1270
1403
|
${params.graphId}, ${params.id}, ${params.kind},
|
|
1271
1404
|
${params.fromKind}, ${params.fromId}, ${params.toKind}, ${params.toId},
|
|
1272
|
-
${propsJson}, ${sqlNull(params.validFrom)}, ${sqlNull(params.validTo)},
|
|
1405
|
+
${propsJson}, ${sqlNull(resolveValidFrom(params.validFrom, timestamp2))}, ${sqlNull(params.validTo)},
|
|
1273
1406
|
${timestamp2}, ${timestamp2}
|
|
1274
1407
|
)
|
|
1275
1408
|
`;
|
|
@@ -1279,7 +1412,7 @@ function buildInsertEdgesBatch(tables3, params, timestamp2) {
|
|
|
1279
1412
|
const columns = edgeColumnList(edges2);
|
|
1280
1413
|
const values = params.map((edgeParams) => {
|
|
1281
1414
|
const propsJson = JSON.stringify(edgeParams.props);
|
|
1282
|
-
return sql`(${edgeParams.graphId}, ${edgeParams.id}, ${edgeParams.kind}, ${edgeParams.fromKind}, ${edgeParams.fromId}, ${edgeParams.toKind}, ${edgeParams.toId}, ${propsJson}, ${sqlNull(edgeParams.validFrom)}, ${sqlNull(edgeParams.validTo)}, ${timestamp2}, ${timestamp2})`;
|
|
1415
|
+
return sql`(${edgeParams.graphId}, ${edgeParams.id}, ${edgeParams.kind}, ${edgeParams.fromKind}, ${edgeParams.fromId}, ${edgeParams.toKind}, ${edgeParams.toId}, ${propsJson}, ${sqlNull(resolveValidFrom(edgeParams.validFrom, timestamp2))}, ${sqlNull(edgeParams.validTo)}, ${timestamp2}, ${timestamp2})`;
|
|
1283
1416
|
});
|
|
1284
1417
|
return sql`
|
|
1285
1418
|
INSERT INTO ${edges2} (${columns})
|
|
@@ -1291,7 +1424,7 @@ function buildInsertEdgesBatchReturning(tables3, params, timestamp2) {
|
|
|
1291
1424
|
const columns = edgeColumnList(edges2);
|
|
1292
1425
|
const values = params.map((edgeParams) => {
|
|
1293
1426
|
const propsJson = JSON.stringify(edgeParams.props);
|
|
1294
|
-
return sql`(${edgeParams.graphId}, ${edgeParams.id}, ${edgeParams.kind}, ${edgeParams.fromKind}, ${edgeParams.fromId}, ${edgeParams.toKind}, ${edgeParams.toId}, ${propsJson}, ${sqlNull(edgeParams.validFrom)}, ${sqlNull(edgeParams.validTo)}, ${timestamp2}, ${timestamp2})`;
|
|
1427
|
+
return sql`(${edgeParams.graphId}, ${edgeParams.id}, ${edgeParams.kind}, ${edgeParams.fromKind}, ${edgeParams.fromId}, ${edgeParams.toKind}, ${edgeParams.toId}, ${propsJson}, ${sqlNull(resolveValidFrom(edgeParams.validFrom, timestamp2))}, ${sqlNull(edgeParams.validTo)}, ${timestamp2}, ${timestamp2})`;
|
|
1295
1428
|
});
|
|
1296
1429
|
return sql`
|
|
1297
1430
|
INSERT INTO ${edges2} (${columns})
|
|
@@ -1357,6 +1490,24 @@ function buildDeleteEdge(tables3, params, timestamp2) {
|
|
|
1357
1490
|
AND ${edges2.deletedAt} IS NULL
|
|
1358
1491
|
`;
|
|
1359
1492
|
}
|
|
1493
|
+
function buildDeleteEdgesBatch(tables3, params, timestamp2) {
|
|
1494
|
+
const { edges: edges2 } = tables3;
|
|
1495
|
+
return sql`
|
|
1496
|
+
UPDATE ${edges2}
|
|
1497
|
+
SET ${quotedColumn(edges2.deletedAt)} = ${timestamp2}
|
|
1498
|
+
WHERE ${edges2.graphId} = ${params.graphId}
|
|
1499
|
+
AND ${edges2.id} IN (${sqlValueList(params.ids)})
|
|
1500
|
+
AND ${edges2.deletedAt} IS NULL
|
|
1501
|
+
`;
|
|
1502
|
+
}
|
|
1503
|
+
function buildHardDeleteEdgesBatch(tables3, params) {
|
|
1504
|
+
const { edges: edges2 } = tables3;
|
|
1505
|
+
return sql`
|
|
1506
|
+
DELETE FROM ${edges2}
|
|
1507
|
+
WHERE ${edges2.graphId} = ${params.graphId}
|
|
1508
|
+
AND ${edges2.id} IN (${sqlValueList(params.ids)})
|
|
1509
|
+
`;
|
|
1510
|
+
}
|
|
1360
1511
|
function buildHardDeleteEdge(tables3, params) {
|
|
1361
1512
|
const { edges: edges2 } = tables3;
|
|
1362
1513
|
return sql`
|
|
@@ -1435,7 +1586,7 @@ function buildFindEdgesConnectedTo(tables3, params) {
|
|
|
1435
1586
|
function resolveMode(mode) {
|
|
1436
1587
|
return mode ?? "websearch";
|
|
1437
1588
|
}
|
|
1438
|
-
function buildFulltextSearch(tableName, params, strategy) {
|
|
1589
|
+
function buildFulltextSearch(tableName, params, strategy, dialect, candidates) {
|
|
1439
1590
|
assertValidSearchParams(params);
|
|
1440
1591
|
const mode = resolveMode(params.mode);
|
|
1441
1592
|
const table = quotedTableName(tableName);
|
|
@@ -1459,12 +1610,16 @@ function buildFulltextSearch(tableName, params, strategy) {
|
|
|
1459
1610
|
if (params.minScore !== void 0) {
|
|
1460
1611
|
conditions.push(sql`${rankExpression} >= ${params.minScore}`);
|
|
1461
1612
|
}
|
|
1613
|
+
if (candidates !== void 0) {
|
|
1614
|
+
conditions.push(sql`"node_id" IN (${candidates})`);
|
|
1615
|
+
}
|
|
1462
1616
|
const snippetExpr = params.includeSnippets === true && strategy.supportsSnippets ? strategy.snippetExpression(
|
|
1463
1617
|
tableName,
|
|
1464
1618
|
params.query,
|
|
1465
1619
|
mode,
|
|
1466
1620
|
params.language
|
|
1467
1621
|
) : sql`NULL`;
|
|
1622
|
+
const pageClause = params.offset === void 0 || params.offset === 0 ? sql`LIMIT ${params.limit}` : sql`LIMIT ${params.limit} OFFSET ${params.offset}`;
|
|
1468
1623
|
return sql`
|
|
1469
1624
|
SELECT
|
|
1470
1625
|
"node_id" AS node_id,
|
|
@@ -1472,8 +1627,8 @@ function buildFulltextSearch(tableName, params, strategy) {
|
|
|
1472
1627
|
${snippetExpr} AS snippet
|
|
1473
1628
|
FROM ${table}
|
|
1474
1629
|
WHERE ${sql.join(conditions, sql` AND `)}
|
|
1475
|
-
ORDER BY ${rankExpression} DESC, "node_id" ASC
|
|
1476
|
-
|
|
1630
|
+
ORDER BY ${rankExpression} DESC, ${codePointOrderKey(sql.raw('"node_id"'), dialect)} ASC
|
|
1631
|
+
${pageClause}
|
|
1477
1632
|
`;
|
|
1478
1633
|
}
|
|
1479
1634
|
function assertValidSearchParams(params) {
|
|
@@ -1494,7 +1649,7 @@ function buildInsertNode(tables3, params, timestamp2) {
|
|
|
1494
1649
|
INSERT INTO ${nodes2} (${columns})
|
|
1495
1650
|
VALUES (
|
|
1496
1651
|
${params.graphId}, ${params.kind}, ${params.id}, ${propsJson},
|
|
1497
|
-
1, ${sqlNull(params.validFrom)}, ${sqlNull(params.validTo)},
|
|
1652
|
+
1, ${sqlNull(resolveValidFrom(params.validFrom, timestamp2))}, ${sqlNull(params.validTo)},
|
|
1498
1653
|
${timestamp2}, ${timestamp2}
|
|
1499
1654
|
)
|
|
1500
1655
|
RETURNING *
|
|
@@ -1508,7 +1663,7 @@ function buildInsertNodeNoReturn(tables3, params, timestamp2) {
|
|
|
1508
1663
|
INSERT INTO ${nodes2} (${columns})
|
|
1509
1664
|
VALUES (
|
|
1510
1665
|
${params.graphId}, ${params.kind}, ${params.id}, ${propsJson},
|
|
1511
|
-
1, ${sqlNull(params.validFrom)}, ${sqlNull(params.validTo)},
|
|
1666
|
+
1, ${sqlNull(resolveValidFrom(params.validFrom, timestamp2))}, ${sqlNull(params.validTo)},
|
|
1512
1667
|
${timestamp2}, ${timestamp2}
|
|
1513
1668
|
)
|
|
1514
1669
|
`;
|
|
@@ -1518,7 +1673,7 @@ function buildInsertNodesBatch(tables3, params, timestamp2) {
|
|
|
1518
1673
|
const columns = nodeColumnList(nodes2);
|
|
1519
1674
|
const values = params.map((nodeParams) => {
|
|
1520
1675
|
const propsJson = JSON.stringify(nodeParams.props);
|
|
1521
|
-
return sql`(${nodeParams.graphId}, ${nodeParams.kind}, ${nodeParams.id}, ${propsJson}, 1, ${sqlNull(nodeParams.validFrom)}, ${sqlNull(nodeParams.validTo)}, ${timestamp2}, ${timestamp2})`;
|
|
1676
|
+
return sql`(${nodeParams.graphId}, ${nodeParams.kind}, ${nodeParams.id}, ${propsJson}, 1, ${sqlNull(resolveValidFrom(nodeParams.validFrom, timestamp2))}, ${sqlNull(nodeParams.validTo)}, ${timestamp2}, ${timestamp2})`;
|
|
1522
1677
|
});
|
|
1523
1678
|
return sql`
|
|
1524
1679
|
INSERT INTO ${nodes2} (${columns})
|
|
@@ -1530,7 +1685,7 @@ function buildInsertNodesBatchReturning(tables3, params, timestamp2) {
|
|
|
1530
1685
|
const columns = nodeColumnList(nodes2);
|
|
1531
1686
|
const values = params.map((nodeParams) => {
|
|
1532
1687
|
const propsJson = JSON.stringify(nodeParams.props);
|
|
1533
|
-
return sql`(${nodeParams.graphId}, ${nodeParams.kind}, ${nodeParams.id}, ${propsJson}, 1, ${sqlNull(nodeParams.validFrom)}, ${sqlNull(nodeParams.validTo)}, ${timestamp2}, ${timestamp2})`;
|
|
1688
|
+
return sql`(${nodeParams.graphId}, ${nodeParams.kind}, ${nodeParams.id}, ${propsJson}, 1, ${sqlNull(resolveValidFrom(nodeParams.validFrom, timestamp2))}, ${sqlNull(nodeParams.validTo)}, ${timestamp2}, ${timestamp2})`;
|
|
1534
1689
|
});
|
|
1535
1690
|
return sql`
|
|
1536
1691
|
INSERT INTO ${nodes2} (${columns})
|
|
@@ -1747,6 +1902,50 @@ function buildInsertUnique(tables3, dialect, params) {
|
|
|
1747
1902
|
const builder = UNIQUE_INSERT_BUILDERS[dialect];
|
|
1748
1903
|
return builder(tables3, params);
|
|
1749
1904
|
}
|
|
1905
|
+
function buildInsertUniqueBatch(tables3, dialect, entries) {
|
|
1906
|
+
const { uniques: uniques2 } = tables3;
|
|
1907
|
+
const columns = sql.raw(
|
|
1908
|
+
`"${uniques2.graphId.name}", "${uniques2.nodeKind.name}", "${uniques2.constraintName.name}", "${uniques2.key.name}", "${uniques2.nodeId.name}", "${uniques2.concreteKind.name}", "${uniques2.deletedAt.name}"`
|
|
1909
|
+
);
|
|
1910
|
+
const conflictColumns = sql.raw(
|
|
1911
|
+
`"${uniques2.graphId.name}", "${uniques2.nodeKind.name}", "${uniques2.constraintName.name}", "${uniques2.key.name}"`
|
|
1912
|
+
);
|
|
1913
|
+
const tableName = getTableName(uniques2);
|
|
1914
|
+
const existingColumn = (column) => dialect === "postgres" ? sql.raw(`"${tableName}"."${column.name}"`) : sql.raw(`"${column.name}"`);
|
|
1915
|
+
const excludedColumn = (column) => sql.raw(`excluded."${column.name}"`);
|
|
1916
|
+
const valueRows = sql.join(
|
|
1917
|
+
entries.map(
|
|
1918
|
+
(params) => sql`(${params.graphId}, ${params.nodeKind}, ${params.constraintName}, ${params.key}, ${params.nodeId}, ${params.concreteKind}, ${sql.raw("NULL")})`
|
|
1919
|
+
),
|
|
1920
|
+
sql`, `
|
|
1921
|
+
);
|
|
1922
|
+
return sql`
|
|
1923
|
+
INSERT INTO ${uniques2} (${columns})
|
|
1924
|
+
VALUES ${valueRows}
|
|
1925
|
+
ON CONFLICT (${conflictColumns})
|
|
1926
|
+
DO UPDATE SET
|
|
1927
|
+
${quotedColumn(uniques2.nodeId)} = CASE
|
|
1928
|
+
WHEN ${existingColumn(uniques2.nodeId)} = ${excludedColumn(uniques2.nodeId)} THEN ${excludedColumn(uniques2.nodeId)}
|
|
1929
|
+
WHEN ${existingColumn(uniques2.deletedAt)} IS NOT NULL THEN ${excludedColumn(uniques2.nodeId)}
|
|
1930
|
+
ELSE ${existingColumn(uniques2.nodeId)}
|
|
1931
|
+
END,
|
|
1932
|
+
${quotedColumn(uniques2.concreteKind)} = CASE
|
|
1933
|
+
WHEN ${existingColumn(uniques2.nodeId)} = ${excludedColumn(uniques2.nodeId)} THEN ${excludedColumn(uniques2.concreteKind)}
|
|
1934
|
+
WHEN ${existingColumn(uniques2.deletedAt)} IS NOT NULL THEN ${excludedColumn(uniques2.concreteKind)}
|
|
1935
|
+
ELSE ${existingColumn(uniques2.concreteKind)}
|
|
1936
|
+
END,
|
|
1937
|
+
${quotedColumn(uniques2.deletedAt)} = CASE
|
|
1938
|
+
WHEN ${existingColumn(uniques2.nodeId)} = ${excludedColumn(uniques2.nodeId)} THEN NULL
|
|
1939
|
+
WHEN ${existingColumn(uniques2.deletedAt)} IS NOT NULL THEN NULL
|
|
1940
|
+
ELSE ${existingColumn(uniques2.deletedAt)}
|
|
1941
|
+
END
|
|
1942
|
+
RETURNING
|
|
1943
|
+
${quotedColumn(uniques2.nodeKind)} as node_kind,
|
|
1944
|
+
${quotedColumn(uniques2.constraintName)} as constraint_name,
|
|
1945
|
+
${quotedColumn(uniques2.key)} as key,
|
|
1946
|
+
${quotedColumn(uniques2.nodeId)} as node_id
|
|
1947
|
+
`;
|
|
1948
|
+
}
|
|
1750
1949
|
function buildDeleteUnique(tables3, params, timestamp2) {
|
|
1751
1950
|
const { uniques: uniques2 } = tables3;
|
|
1752
1951
|
return sql`
|
|
@@ -1840,7 +2039,9 @@ var COMMON_TABLE_OPERATION_BUILDERS = {
|
|
|
1840
2039
|
buildGetEdges,
|
|
1841
2040
|
buildUpdateEdge,
|
|
1842
2041
|
buildDeleteEdge,
|
|
2042
|
+
buildDeleteEdgesBatch,
|
|
1843
2043
|
buildHardDeleteEdge,
|
|
2044
|
+
buildHardDeleteEdgesBatch,
|
|
1844
2045
|
buildHardDeleteEdgesByNode,
|
|
1845
2046
|
buildCountEdgesFrom,
|
|
1846
2047
|
buildEdgeExistsBetween,
|
|
@@ -1871,7 +2072,57 @@ function createCommonOperationStrategy(tables3, dialect, fulltextStrategy) {
|
|
|
1871
2072
|
}),
|
|
1872
2073
|
buildUpsertFulltextBatch: (params, timestamp2) => fulltextStrategy.buildBatchUpsert(fulltextTable, params, timestamp2),
|
|
1873
2074
|
buildDeleteFulltextBatch: (params) => fulltextStrategy.buildBatchDelete(fulltextTable, params),
|
|
1874
|
-
buildFulltextSearch: (params) => buildFulltextSearch(
|
|
2075
|
+
buildFulltextSearch: (params) => buildFulltextSearch(
|
|
2076
|
+
fulltextTable,
|
|
2077
|
+
params,
|
|
2078
|
+
fulltextStrategy,
|
|
2079
|
+
dialect,
|
|
2080
|
+
// Store-compiled candidates (predicates + subclass + currency)
|
|
2081
|
+
// take precedence; the live-node default covers direct backend use.
|
|
2082
|
+
params.candidates ?? liveNodeIdsSubquery(tables3.nodes, params.graphId, params.nodeKind, nowIso())
|
|
2083
|
+
),
|
|
2084
|
+
buildLiveNodeIds: (graphId, nodeKind) => liveNodeIdsSubquery(tables3.nodes, graphId, nodeKind, nowIso()),
|
|
2085
|
+
buildHybridSearch: (params, vectorSql, vectorScoreDescending) => {
|
|
2086
|
+
const candidates = params.candidates ?? liveNodeIdsSubquery(
|
|
2087
|
+
tables3.nodes,
|
|
2088
|
+
params.graphId,
|
|
2089
|
+
params.nodeKind,
|
|
2090
|
+
nowIso()
|
|
2091
|
+
);
|
|
2092
|
+
const fulltextSql = buildFulltextSearch(
|
|
2093
|
+
fulltextTable,
|
|
2094
|
+
{
|
|
2095
|
+
graphId: params.graphId,
|
|
2096
|
+
nodeKind: params.nodeKind,
|
|
2097
|
+
query: params.fulltext.query,
|
|
2098
|
+
limit: params.fulltext.k,
|
|
2099
|
+
...params.fulltext.mode === void 0 ? {} : { mode: params.fulltext.mode },
|
|
2100
|
+
...params.fulltext.language === void 0 ? {} : { language: params.fulltext.language },
|
|
2101
|
+
...params.fulltext.minScore === void 0 ? {} : { minScore: params.fulltext.minScore },
|
|
2102
|
+
...params.fulltext.includeSnippets === void 0 ? {} : { includeSnippets: params.fulltext.includeSnippets }
|
|
2103
|
+
},
|
|
2104
|
+
fulltextStrategy,
|
|
2105
|
+
dialect,
|
|
2106
|
+
// Reference, not copy: the statement evaluates the shared
|
|
2107
|
+
// tg_hybrid_cand CTE once for both legs.
|
|
2108
|
+
hybridCandidatesRef()
|
|
2109
|
+
);
|
|
2110
|
+
return buildHybridSearchStatement({
|
|
2111
|
+
candidatesSql: candidates,
|
|
2112
|
+
vectorSql,
|
|
2113
|
+
vectorScoreDescending,
|
|
2114
|
+
fulltextSql,
|
|
2115
|
+
nodes: tables3.nodes,
|
|
2116
|
+
dialect,
|
|
2117
|
+
graphId: params.graphId,
|
|
2118
|
+
nodeKind: params.nodeKind,
|
|
2119
|
+
fusionK: params.fusion.k,
|
|
2120
|
+
vectorWeight: params.fusion.vectorWeight,
|
|
2121
|
+
fulltextWeight: params.fusion.fulltextWeight,
|
|
2122
|
+
limit: params.limit,
|
|
2123
|
+
offset: params.offset ?? 0
|
|
2124
|
+
});
|
|
2125
|
+
}
|
|
1875
2126
|
};
|
|
1876
2127
|
return {
|
|
1877
2128
|
...tableOperations,
|
|
@@ -1879,6 +2130,9 @@ function createCommonOperationStrategy(tables3, dialect, fulltextStrategy) {
|
|
|
1879
2130
|
buildInsertUnique(params) {
|
|
1880
2131
|
return buildInsertUnique(tables3, dialect, params);
|
|
1881
2132
|
},
|
|
2133
|
+
buildInsertUniqueBatch(entries) {
|
|
2134
|
+
return buildInsertUniqueBatch(tables3, dialect, entries);
|
|
2135
|
+
},
|
|
1882
2136
|
buildGetActiveSchema(graphId) {
|
|
1883
2137
|
return buildGetActiveSchema(tables3, graphId, dialect);
|
|
1884
2138
|
},
|
|
@@ -2137,6 +2391,28 @@ function createCommonOperationBackend(options) {
|
|
|
2137
2391
|
const query = operationStrategy.buildHardDeleteEdge(params);
|
|
2138
2392
|
await execution.execRun(query);
|
|
2139
2393
|
},
|
|
2394
|
+
async deleteEdgesBatch(params) {
|
|
2395
|
+
if (params.ids.length === 0) return;
|
|
2396
|
+
const timestamp2 = nowIso2();
|
|
2397
|
+
const softDeleteChunkSize = Math.max(1, batchConfig.getEdgesChunkSize - 1);
|
|
2398
|
+
for (const chunk2 of chunk(params.ids, softDeleteChunkSize)) {
|
|
2399
|
+
const query = operationStrategy.buildDeleteEdgesBatch(
|
|
2400
|
+
{ graphId: params.graphId, ids: chunk2 },
|
|
2401
|
+
timestamp2
|
|
2402
|
+
);
|
|
2403
|
+
await execution.execRun(query);
|
|
2404
|
+
}
|
|
2405
|
+
},
|
|
2406
|
+
async hardDeleteEdgesBatch(params) {
|
|
2407
|
+
if (params.ids.length === 0) return;
|
|
2408
|
+
for (const chunk2 of chunk(params.ids, batchConfig.getEdgesChunkSize)) {
|
|
2409
|
+
const query = operationStrategy.buildHardDeleteEdgesBatch({
|
|
2410
|
+
graphId: params.graphId,
|
|
2411
|
+
ids: chunk2
|
|
2412
|
+
});
|
|
2413
|
+
await execution.execRun(query);
|
|
2414
|
+
}
|
|
2415
|
+
},
|
|
2140
2416
|
async countEdgesFrom(params) {
|
|
2141
2417
|
const query = operationStrategy.buildCountEdgesFrom(params);
|
|
2142
2418
|
const row = await execution.execGet(query);
|
|
@@ -2185,6 +2461,53 @@ function createCommonOperationBackend(options) {
|
|
|
2185
2461
|
});
|
|
2186
2462
|
}
|
|
2187
2463
|
},
|
|
2464
|
+
async insertUniqueBatch(entries) {
|
|
2465
|
+
if (entries.length === 0) return;
|
|
2466
|
+
const targetKey = (entry) => `${entry.nodeKind}\0${entry.constraintName}\0${entry.key}`;
|
|
2467
|
+
const byTarget = /* @__PURE__ */ new Map();
|
|
2468
|
+
for (const entry of entries) {
|
|
2469
|
+
const existing = byTarget.get(targetKey(entry));
|
|
2470
|
+
if (existing === void 0) {
|
|
2471
|
+
byTarget.set(targetKey(entry), entry);
|
|
2472
|
+
continue;
|
|
2473
|
+
}
|
|
2474
|
+
if (existing.nodeId !== entry.nodeId) {
|
|
2475
|
+
throw new UniquenessError({
|
|
2476
|
+
constraintName: entry.constraintName,
|
|
2477
|
+
kind: entry.nodeKind,
|
|
2478
|
+
existingId: existing.nodeId,
|
|
2479
|
+
newId: entry.nodeId,
|
|
2480
|
+
fields: []
|
|
2481
|
+
});
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
const deduped = [...byTarget.values()];
|
|
2485
|
+
for (const chunk2 of chunk(
|
|
2486
|
+
deduped,
|
|
2487
|
+
batchConfig.uniqueInsertBatchSize
|
|
2488
|
+
)) {
|
|
2489
|
+
const query = operationStrategy.buildInsertUniqueBatch(chunk2);
|
|
2490
|
+
const rows = await execution.execAll(query);
|
|
2491
|
+
const ownerByTarget = new Map(
|
|
2492
|
+
rows.map((row) => [
|
|
2493
|
+
`${row.node_kind}\0${row.constraint_name}\0${row.key}`,
|
|
2494
|
+
row.node_id
|
|
2495
|
+
])
|
|
2496
|
+
);
|
|
2497
|
+
for (const entry of chunk2) {
|
|
2498
|
+
const owner = ownerByTarget.get(targetKey(entry));
|
|
2499
|
+
if (owner !== void 0 && owner !== entry.nodeId) {
|
|
2500
|
+
throw new UniquenessError({
|
|
2501
|
+
constraintName: entry.constraintName,
|
|
2502
|
+
kind: entry.nodeKind,
|
|
2503
|
+
existingId: owner,
|
|
2504
|
+
newId: entry.nodeId,
|
|
2505
|
+
fields: []
|
|
2506
|
+
});
|
|
2507
|
+
}
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2510
|
+
},
|
|
2188
2511
|
async deleteUnique(params) {
|
|
2189
2512
|
const timestamp2 = nowIso2();
|
|
2190
2513
|
const query = operationStrategy.buildDeleteUnique(params, timestamp2);
|
|
@@ -2347,6 +2670,6 @@ function compileQueryWithDialect(db, query, backendName) {
|
|
|
2347
2670
|
return compiler.sqlToQuery(query);
|
|
2348
2671
|
}
|
|
2349
2672
|
|
|
2350
|
-
export { POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS, POSTGRES_INDEX_MAT_TIMESTAMPS, POSTGRES_KIND_REMOVAL_TIMESTAMPS, SQLITE_CONTRIBUTION_MAT_TIMESTAMPS, SQLITE_INDEX_MAT_TIMESTAMPS, SQLITE_KIND_REMOVAL_TIMESTAMPS, assertAdoptedDialect, buildContributionInsertValues, buildContributionOnConflictSet, buildKindRemovalInsertValues, buildKindRemovalOnConflictSet, buildMaterializationInsertValues, buildMaterializationOnConflictSet, compileQueryWithDialect, createCachedTableExistence, createCommonOperationBackend, createContributionMaterializer, createPostgresOperationStrategy, createPostgresTables, createSqliteOperationStrategy, createVectorSlotLatch, edges, fulltext, gateFulltext, gateFulltextMethods, generatePgCreateTableSQL, generatePostgresDDL, generatePostgresMigrationSQL, generateSqliteCreateTableSQL, generateSqliteDDL, generateSqliteMigrationSQL, getOrCreateLru, mapContributionMaterializationRow, mapKindRemovalRow, mapMaterializationRow, mapVectorWriteError, nodes, recordedClock, recordedEdges, recordedNodes, schemaVersions, tables2 as tables, uniques, vectorSlotFromCreateIndexParams, vectorSlotFromDropIndexParams, vectorSlotFromParams };
|
|
2351
|
-
//# sourceMappingURL=chunk-
|
|
2352
|
-
//# sourceMappingURL=chunk-
|
|
2673
|
+
export { EMBEDDING_UPSERT_PARAM_COUNT, POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS, POSTGRES_INDEX_MAT_TIMESTAMPS, POSTGRES_KIND_REMOVAL_TIMESTAMPS, SQLITE_CONTRIBUTION_MAT_TIMESTAMPS, SQLITE_INDEX_MAT_TIMESTAMPS, SQLITE_KIND_REMOVAL_TIMESTAMPS, assertAdoptedDialect, buildContributionInsertValues, buildContributionOnConflictSet, buildKindRemovalInsertValues, buildKindRemovalOnConflictSet, buildMaterializationInsertValues, buildMaterializationOnConflictSet, compileQueryWithDialect, createCachedTableExistence, createCommonOperationBackend, createContributionMaterializer, createPostgresOperationStrategy, createPostgresTables, createSqliteOperationStrategy, createVectorSlotLatch, edges, fulltext, gateFulltext, gateFulltextMethods, generatePgCreateTableSQL, generatePostgresDDL, generatePostgresMigrationSQL, generateSqliteCreateTableSQL, generateSqliteDDL, generateSqliteMigrationSQL, getOrCreateLru, hybridCandidatesRef, mapContributionMaterializationRow, mapHybridSearchRow, mapKindRemovalRow, mapMaterializationRow, mapVectorWriteError, nodes, recordedClock, recordedEdges, recordedNodes, schemaVersions, tables2 as tables, uniques, vectorSlotFromCreateIndexParams, vectorSlotFromDropIndexParams, vectorSlotFromParams };
|
|
2674
|
+
//# sourceMappingURL=chunk-WDBCBWC4.js.map
|
|
2675
|
+
//# sourceMappingURL=chunk-WDBCBWC4.js.map
|