@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
package/dist/chunk-TOTPVGOG.cjs
DELETED
|
@@ -1,774 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkUJLOZYKT_cjs = require('./chunk-UJLOZYKT.cjs');
|
|
4
|
-
var chunkKGC4LY5T_cjs = require('./chunk-KGC4LY5T.cjs');
|
|
5
|
-
var chunkHTGDWIDE_cjs = require('./chunk-HTGDWIDE.cjs');
|
|
6
|
-
var chunkJJRCLAUN_cjs = require('./chunk-JJRCLAUN.cjs');
|
|
7
|
-
var chunk2JXB3NYJ_cjs = require('./chunk-2JXB3NYJ.cjs');
|
|
8
|
-
var chunkUNNPKQUG_cjs = require('./chunk-UNNPKQUG.cjs');
|
|
9
|
-
var chunkRHZWOJVA_cjs = require('./chunk-RHZWOJVA.cjs');
|
|
10
|
-
var chunkJIEJCTDS_cjs = require('./chunk-JIEJCTDS.cjs');
|
|
11
|
-
var drizzleOrm = require('drizzle-orm');
|
|
12
|
-
var pgCore = require('drizzle-orm/pg-core');
|
|
13
|
-
|
|
14
|
-
// src/backend/drizzle/execution/postgres-execution.ts
|
|
15
|
-
function hasFunctionProperty(value, property) {
|
|
16
|
-
if (value === void 0 || value === null) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
const candidate = value;
|
|
20
|
-
return typeof candidate[property] === "function";
|
|
21
|
-
}
|
|
22
|
-
function isPgNativeClient(candidate) {
|
|
23
|
-
return typeof candidate === "object" && hasFunctionProperty(candidate, "query");
|
|
24
|
-
}
|
|
25
|
-
function isPgliteClient(candidate) {
|
|
26
|
-
return typeof candidate === "object" && hasFunctionProperty(candidate, "query") && hasFunctionProperty(candidate, "dumpDataDir");
|
|
27
|
-
}
|
|
28
|
-
function isPostgresJsClient(candidate) {
|
|
29
|
-
return typeof candidate === "function" && hasFunctionProperty(candidate, "unsafe") && hasFunctionProperty(candidate, "begin");
|
|
30
|
-
}
|
|
31
|
-
function isNeonHttpClient(db) {
|
|
32
|
-
const candidate = db.$client;
|
|
33
|
-
return typeof candidate === "function" && hasFunctionProperty(candidate, "transaction") && !hasFunctionProperty(candidate, "begin");
|
|
34
|
-
}
|
|
35
|
-
var DEFAULT_POSTGRES_STATEMENT_CACHE_MAX = 256;
|
|
36
|
-
var STATEMENT_NAME_CACHE = /* @__PURE__ */ new Map();
|
|
37
|
-
var nextStatementId = 0;
|
|
38
|
-
function statementNameFor(sqlText, cacheMax) {
|
|
39
|
-
return chunkUJLOZYKT_cjs.getOrCreateLru(STATEMENT_NAME_CACHE, sqlText, cacheMax, () => {
|
|
40
|
-
const name = `tg_${nextStatementId}`;
|
|
41
|
-
nextStatementId += 1;
|
|
42
|
-
return name;
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
function normalizeRow(row) {
|
|
46
|
-
if (row === null || typeof row !== "object") return row;
|
|
47
|
-
let mutated;
|
|
48
|
-
for (const key of Object.keys(row)) {
|
|
49
|
-
const value = row[key];
|
|
50
|
-
if (value instanceof Date) {
|
|
51
|
-
mutated ??= { ...row };
|
|
52
|
-
mutated[key] = value.toISOString();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return mutated ?? row;
|
|
56
|
-
}
|
|
57
|
-
function normalizeRows(rows) {
|
|
58
|
-
let mutated;
|
|
59
|
-
for (let index = 0; index < rows.length; index += 1) {
|
|
60
|
-
const original = rows[index];
|
|
61
|
-
const normalized = normalizeRow(original);
|
|
62
|
-
if (normalized !== original) {
|
|
63
|
-
mutated ??= [...rows];
|
|
64
|
-
mutated[index] = normalized;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return mutated ?? rows;
|
|
68
|
-
}
|
|
69
|
-
function wrapNodePgClient(client, cacheMax) {
|
|
70
|
-
return {
|
|
71
|
-
async query(sqlText, params) {
|
|
72
|
-
const result = await client.query({
|
|
73
|
-
name: statementNameFor(sqlText, cacheMax),
|
|
74
|
-
text: sqlText,
|
|
75
|
-
values: params
|
|
76
|
-
});
|
|
77
|
-
return { rows: normalizeRows(result.rows) };
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
function wrapNodePgClientUnnamed(client) {
|
|
82
|
-
return {
|
|
83
|
-
async query(sqlText, params) {
|
|
84
|
-
const result = await client.query(sqlText, params);
|
|
85
|
-
return { rows: normalizeRows(result.rows) };
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
function adaptPostgresJsClient(sql2) {
|
|
90
|
-
return {
|
|
91
|
-
async query(sqlText, params) {
|
|
92
|
-
const rows = await sql2.unsafe(sqlText, params);
|
|
93
|
-
return { rows };
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
function resolvePgClient(db, prepareStatements, cacheMax) {
|
|
98
|
-
if (isNeonHttpClient(db)) {
|
|
99
|
-
return void 0;
|
|
100
|
-
}
|
|
101
|
-
const client = db.$client;
|
|
102
|
-
if (isPgliteClient(client)) {
|
|
103
|
-
return wrapNodePgClientUnnamed(client);
|
|
104
|
-
}
|
|
105
|
-
if (isPgNativeClient(client)) {
|
|
106
|
-
return prepareStatements ? wrapNodePgClient(client, cacheMax) : wrapNodePgClientUnnamed(client);
|
|
107
|
-
}
|
|
108
|
-
if (isPostgresJsClient(client)) {
|
|
109
|
-
return adaptPostgresJsClient(client);
|
|
110
|
-
}
|
|
111
|
-
return void 0;
|
|
112
|
-
}
|
|
113
|
-
async function executeDrizzleQuery(db, query) {
|
|
114
|
-
const result = await db.execute(query);
|
|
115
|
-
if (Array.isArray(result)) {
|
|
116
|
-
return result;
|
|
117
|
-
}
|
|
118
|
-
return result.rows;
|
|
119
|
-
}
|
|
120
|
-
function createPgPreparedStatement(pgClient, sqlText) {
|
|
121
|
-
return {
|
|
122
|
-
async execute(params) {
|
|
123
|
-
const result = await pgClient.query(sqlText, params);
|
|
124
|
-
return result.rows;
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
function createPostgresExecutionAdapter(db, options = {}) {
|
|
129
|
-
const prepareStatements = options.prepareStatements ?? true;
|
|
130
|
-
const cacheMax = options.preparedStatementCacheMax ?? DEFAULT_POSTGRES_STATEMENT_CACHE_MAX;
|
|
131
|
-
const pgClient = resolvePgClient(db, prepareStatements, cacheMax);
|
|
132
|
-
function compile(query) {
|
|
133
|
-
return chunkUJLOZYKT_cjs.compileQueryWithDialect(db, query, "PostgreSQL");
|
|
134
|
-
}
|
|
135
|
-
if (pgClient === void 0) {
|
|
136
|
-
return {
|
|
137
|
-
compile,
|
|
138
|
-
async execute(query) {
|
|
139
|
-
return executeDrizzleQuery(db, query);
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
const pgQueryClient = pgClient;
|
|
144
|
-
async function executeCompiled(compiledQuery) {
|
|
145
|
-
const result = await pgQueryClient.query(
|
|
146
|
-
compiledQuery.sql,
|
|
147
|
-
compiledQuery.params
|
|
148
|
-
);
|
|
149
|
-
return result.rows;
|
|
150
|
-
}
|
|
151
|
-
return {
|
|
152
|
-
compile,
|
|
153
|
-
async execute(query) {
|
|
154
|
-
const compiled = compile(query);
|
|
155
|
-
return executeCompiled(compiled);
|
|
156
|
-
},
|
|
157
|
-
executeCompiled,
|
|
158
|
-
prepare(sqlText) {
|
|
159
|
-
return createPgPreparedStatement(pgQueryClient, sqlText);
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// src/backend/drizzle/postgres.ts
|
|
165
|
-
var NODE_INSERT_PARAM_COUNT = 9;
|
|
166
|
-
var EDGE_INSERT_PARAM_COUNT = 12;
|
|
167
|
-
var POSTGRES_NODE_INSERT_BATCH_SIZE = Math.max(
|
|
168
|
-
1,
|
|
169
|
-
Math.floor(chunkUNNPKQUG_cjs.POSTGRES_MAX_BIND_PARAMETERS / NODE_INSERT_PARAM_COUNT)
|
|
170
|
-
);
|
|
171
|
-
var POSTGRES_EDGE_INSERT_BATCH_SIZE = Math.max(
|
|
172
|
-
1,
|
|
173
|
-
Math.floor(chunkUNNPKQUG_cjs.POSTGRES_MAX_BIND_PARAMETERS / EDGE_INSERT_PARAM_COUNT)
|
|
174
|
-
);
|
|
175
|
-
var POSTGRES_GET_NODES_ID_CHUNK_SIZE = Math.max(
|
|
176
|
-
1,
|
|
177
|
-
chunkUNNPKQUG_cjs.POSTGRES_MAX_BIND_PARAMETERS - 2
|
|
178
|
-
);
|
|
179
|
-
var POSTGRES_GET_EDGES_ID_CHUNK_SIZE = Math.max(
|
|
180
|
-
1,
|
|
181
|
-
chunkUNNPKQUG_cjs.POSTGRES_MAX_BIND_PARAMETERS - 1
|
|
182
|
-
);
|
|
183
|
-
var CHECK_UNIQUE_BATCH_FIXED_PARAM_COUNT = 3;
|
|
184
|
-
var POSTGRES_CHECK_UNIQUE_BATCH_CHUNK_SIZE = Math.max(
|
|
185
|
-
1,
|
|
186
|
-
chunkUNNPKQUG_cjs.POSTGRES_MAX_BIND_PARAMETERS - CHECK_UNIQUE_BATCH_FIXED_PARAM_COUNT
|
|
187
|
-
);
|
|
188
|
-
var toNodeRow = chunkJJRCLAUN_cjs.createNodeRowMapper(chunkJJRCLAUN_cjs.POSTGRES_ROW_MAPPER_CONFIG);
|
|
189
|
-
var toEdgeRow = chunkJJRCLAUN_cjs.createEdgeRowMapper(chunkJJRCLAUN_cjs.POSTGRES_ROW_MAPPER_CONFIG);
|
|
190
|
-
var toUniqueRow = chunkJJRCLAUN_cjs.createUniqueRowMapper(chunkJJRCLAUN_cjs.POSTGRES_ROW_MAPPER_CONFIG);
|
|
191
|
-
var toSchemaVersionRow = chunkJJRCLAUN_cjs.createSchemaVersionRowMapper(
|
|
192
|
-
chunkJJRCLAUN_cjs.POSTGRES_ROW_MAPPER_CONFIG
|
|
193
|
-
);
|
|
194
|
-
function buildPostgresCapabilities(fulltextStrategy, vectorStrategy) {
|
|
195
|
-
return {
|
|
196
|
-
...chunkUNNPKQUG_cjs.POSTGRES_CAPABILITIES,
|
|
197
|
-
...vectorStrategy === void 0 ? {} : { vector: chunk2JXB3NYJ_cjs.buildVectorCapabilities(vectorStrategy) },
|
|
198
|
-
fulltext: chunk2JXB3NYJ_cjs.buildFulltextCapabilities(fulltextStrategy)
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
function createPostgresBackend(db, options = {}) {
|
|
202
|
-
const tables2 = options.tables ?? chunkUJLOZYKT_cjs.tables;
|
|
203
|
-
const fulltextStrategy = options.fulltext ?? chunk2JXB3NYJ_cjs.tsvectorStrategy;
|
|
204
|
-
const vectorStrategy = options.vector === false ? void 0 : options.vector ?? chunkKGC4LY5T_cjs.pgvectorStrategy;
|
|
205
|
-
const vectorSlotLatch = vectorStrategy === void 0 ? void 0 : chunkUJLOZYKT_cjs.createVectorSlotLatch();
|
|
206
|
-
const baseCapabilities = buildPostgresCapabilities(
|
|
207
|
-
fulltextStrategy,
|
|
208
|
-
vectorStrategy
|
|
209
|
-
);
|
|
210
|
-
const httpOnlyOverrides = isNeonHttpClient(db) ? { transactions: false } : {};
|
|
211
|
-
const capabilities = {
|
|
212
|
-
...baseCapabilities,
|
|
213
|
-
...httpOnlyOverrides,
|
|
214
|
-
...options.capabilities
|
|
215
|
-
};
|
|
216
|
-
const adapterOptions = {
|
|
217
|
-
...options.prepareStatements === void 0 ? {} : { prepareStatements: options.prepareStatements },
|
|
218
|
-
...options.preparedStatementCacheMax === void 0 ? {} : { preparedStatementCacheMax: options.preparedStatementCacheMax }
|
|
219
|
-
};
|
|
220
|
-
const executionAdapter = createPostgresExecutionAdapter(db, adapterOptions);
|
|
221
|
-
const tableNames = {
|
|
222
|
-
nodes: drizzleOrm.getTableName(tables2.nodes),
|
|
223
|
-
edges: drizzleOrm.getTableName(tables2.edges),
|
|
224
|
-
recordedNodes: drizzleOrm.getTableName(tables2.recordedNodes),
|
|
225
|
-
recordedEdges: drizzleOrm.getTableName(tables2.recordedEdges),
|
|
226
|
-
recordedClock: drizzleOrm.getTableName(tables2.recordedClock),
|
|
227
|
-
fulltext: tables2.fulltextTableName,
|
|
228
|
-
uniques: drizzleOrm.getTableName(tables2.uniques)
|
|
229
|
-
};
|
|
230
|
-
const coreAnalyzeStatement = drizzleOrm.sql`ANALYZE ${drizzleOrm.sql.join(
|
|
231
|
-
[
|
|
232
|
-
tableNames.nodes,
|
|
233
|
-
tableNames.edges,
|
|
234
|
-
drizzleOrm.getTableName(tables2.uniques),
|
|
235
|
-
tableNames.fulltext
|
|
236
|
-
].map((name) => chunkHTGDWIDE_cjs.quoteIdentifier(name)),
|
|
237
|
-
drizzleOrm.sql`, `
|
|
238
|
-
)}`;
|
|
239
|
-
const recordedAnalyzeTables = [
|
|
240
|
-
tableNames.recordedNodes,
|
|
241
|
-
tableNames.recordedEdges,
|
|
242
|
-
tableNames.recordedClock
|
|
243
|
-
];
|
|
244
|
-
const operationStrategy = chunkUJLOZYKT_cjs.createPostgresOperationStrategy(
|
|
245
|
-
tables2,
|
|
246
|
-
fulltextStrategy
|
|
247
|
-
);
|
|
248
|
-
const operations = createPostgresOperationBackend({
|
|
249
|
-
db,
|
|
250
|
-
executionAdapter,
|
|
251
|
-
adapterOptions,
|
|
252
|
-
operationStrategy,
|
|
253
|
-
tableNames,
|
|
254
|
-
capabilities,
|
|
255
|
-
fulltextStrategy,
|
|
256
|
-
vectorStrategy,
|
|
257
|
-
vectorSlotLatch
|
|
258
|
-
});
|
|
259
|
-
const recordedTableExists = chunkUJLOZYKT_cjs.createCachedTableExistence(
|
|
260
|
-
async (tableName) => {
|
|
261
|
-
const rows = await executionAdapter.execute(
|
|
262
|
-
operationStrategy.buildTableExists(tableName)
|
|
263
|
-
);
|
|
264
|
-
return rows[0];
|
|
265
|
-
},
|
|
266
|
-
{ cacheExisting: false }
|
|
267
|
-
);
|
|
268
|
-
function runSchemaWriteTransaction(graphId, fn) {
|
|
269
|
-
if (!capabilities.transactions) {
|
|
270
|
-
throw new chunkJIEJCTDS_cjs.ConfigurationError(
|
|
271
|
-
"commitSchemaVersion and setActiveVersion require atomic transactions, but this Postgres backend does not provide them. The drizzle-orm/neon-http driver communicates over HTTP and cannot hold a session across statements; use drizzle-orm/neon-serverless (websocket) for transactional writes.",
|
|
272
|
-
{
|
|
273
|
-
backend: "postgres",
|
|
274
|
-
capability: "transactions",
|
|
275
|
-
supportsTransactions: false
|
|
276
|
-
}
|
|
277
|
-
);
|
|
278
|
-
}
|
|
279
|
-
return db.transaction(async (tx) => {
|
|
280
|
-
await tx.execute(drizzleOrm.sql`SELECT pg_advisory_xact_lock(hashtext(${graphId}))`);
|
|
281
|
-
const txBackend = createTransactionBackend({
|
|
282
|
-
db: tx,
|
|
283
|
-
adapterOptions,
|
|
284
|
-
operationStrategy,
|
|
285
|
-
tableNames,
|
|
286
|
-
capabilities,
|
|
287
|
-
fulltextStrategy,
|
|
288
|
-
vectorStrategy});
|
|
289
|
-
return fn(txBackend);
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
const matTable = tables2.contributionMaterializations;
|
|
293
|
-
async function ensureContributionMaterializationsTableImpl() {
|
|
294
|
-
await db.execute(drizzleOrm.sql.raw(chunkUJLOZYKT_cjs.generatePgCreateTableSQL(matTable)));
|
|
295
|
-
}
|
|
296
|
-
async function getContributionMaterializationRow(identity) {
|
|
297
|
-
const rows = await db.select().from(matTable).where(
|
|
298
|
-
drizzleOrm.and(
|
|
299
|
-
drizzleOrm.eq(matTable.graphId, identity.graphId),
|
|
300
|
-
drizzleOrm.eq(matTable.logicalName, identity.logicalName),
|
|
301
|
-
drizzleOrm.eq(matTable.owner, identity.owner),
|
|
302
|
-
drizzleOrm.eq(matTable.tableName, identity.tableName)
|
|
303
|
-
)
|
|
304
|
-
);
|
|
305
|
-
const row = rows[0];
|
|
306
|
-
if (row === void 0) return void 0;
|
|
307
|
-
return chunkUJLOZYKT_cjs.mapContributionMaterializationRow(
|
|
308
|
-
row,
|
|
309
|
-
chunkUJLOZYKT_cjs.POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS.decode
|
|
310
|
-
);
|
|
311
|
-
}
|
|
312
|
-
async function recordContributionMaterializationRow(params) {
|
|
313
|
-
await db.insert(matTable).values(
|
|
314
|
-
chunkUJLOZYKT_cjs.buildContributionInsertValues(
|
|
315
|
-
params,
|
|
316
|
-
chunkUJLOZYKT_cjs.POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS.encode
|
|
317
|
-
)
|
|
318
|
-
).onConflictDoUpdate({
|
|
319
|
-
target: [
|
|
320
|
-
matTable.graphId,
|
|
321
|
-
matTable.logicalName,
|
|
322
|
-
matTable.owner,
|
|
323
|
-
matTable.tableName
|
|
324
|
-
],
|
|
325
|
-
set: chunkUJLOZYKT_cjs.buildContributionOnConflictSet(
|
|
326
|
-
matTable.materializedAt,
|
|
327
|
-
params.materializedAt
|
|
328
|
-
)
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
const contributionMaterializer = chunkUJLOZYKT_cjs.createContributionMaterializer({
|
|
332
|
-
dialect: "postgres",
|
|
333
|
-
fulltextStrategy,
|
|
334
|
-
fulltextTableName: tables2.fulltextTableName,
|
|
335
|
-
execDdl: async (statement) => {
|
|
336
|
-
await db.execute(drizzleOrm.sql.raw(statement));
|
|
337
|
-
},
|
|
338
|
-
ensureMarkerTable: ensureContributionMaterializationsTableImpl,
|
|
339
|
-
getMarker: getContributionMaterializationRow,
|
|
340
|
-
recordMarker: recordContributionMaterializationRow
|
|
341
|
-
});
|
|
342
|
-
function bindTransactionBackend(tx) {
|
|
343
|
-
const txBackend = createTransactionBackend({
|
|
344
|
-
db: tx,
|
|
345
|
-
adapterOptions,
|
|
346
|
-
operationStrategy,
|
|
347
|
-
tableNames,
|
|
348
|
-
capabilities,
|
|
349
|
-
fulltextStrategy,
|
|
350
|
-
vectorStrategy});
|
|
351
|
-
return chunkUJLOZYKT_cjs.gateFulltext(txBackend, contributionMaterializer.assertInitialized);
|
|
352
|
-
}
|
|
353
|
-
const backend = {
|
|
354
|
-
...operations,
|
|
355
|
-
async bootstrapTables() {
|
|
356
|
-
const statements = chunkUJLOZYKT_cjs.generatePostgresDDL(tables2, fulltextStrategy);
|
|
357
|
-
for (const statement of statements) {
|
|
358
|
-
await db.execute(drizzleOrm.sql.raw(statement));
|
|
359
|
-
}
|
|
360
|
-
},
|
|
361
|
-
// Every fulltext-touching method asserts the durable marker instead
|
|
362
|
-
// of lazily emitting DDL. Steady state performs zero ensure; an
|
|
363
|
-
// uninitialized database throws `StoreNotInitializedError` loudly
|
|
364
|
-
// rather than self-healing on a read/write path (#135). Shared
|
|
365
|
-
// verbatim with the tx-scoped gate via `gateFulltextMethods`.
|
|
366
|
-
...chunkUJLOZYKT_cjs.gateFulltextMethods(
|
|
367
|
-
operations,
|
|
368
|
-
contributionMaterializer.assertInitialized
|
|
369
|
-
),
|
|
370
|
-
async executeDdl(ddl) {
|
|
371
|
-
await db.execute(drizzleOrm.sql.raw(ddl));
|
|
372
|
-
},
|
|
373
|
-
async ensureIndexMaterializationsTable() {
|
|
374
|
-
await db.execute(
|
|
375
|
-
drizzleOrm.sql.raw(chunkUJLOZYKT_cjs.generatePgCreateTableSQL(tables2.indexMaterializations))
|
|
376
|
-
);
|
|
377
|
-
},
|
|
378
|
-
async getIndexMaterialization(indexName) {
|
|
379
|
-
const t = tables2.indexMaterializations;
|
|
380
|
-
const rows = await db.select().from(t).where(drizzleOrm.eq(t.indexName, indexName));
|
|
381
|
-
const row = rows[0];
|
|
382
|
-
if (row === void 0) return void 0;
|
|
383
|
-
return chunkUJLOZYKT_cjs.mapMaterializationRow(row, chunkUJLOZYKT_cjs.POSTGRES_INDEX_MAT_TIMESTAMPS.decode);
|
|
384
|
-
},
|
|
385
|
-
async getIndexMaterializations(statusKeys) {
|
|
386
|
-
if (statusKeys.length === 0) return [];
|
|
387
|
-
const t = tables2.indexMaterializations;
|
|
388
|
-
const rows = await db.select().from(t).where(drizzleOrm.inArray(t.indexName, [...statusKeys]));
|
|
389
|
-
return rows.map(
|
|
390
|
-
(row) => chunkUJLOZYKT_cjs.mapMaterializationRow(row, chunkUJLOZYKT_cjs.POSTGRES_INDEX_MAT_TIMESTAMPS.decode)
|
|
391
|
-
);
|
|
392
|
-
},
|
|
393
|
-
async recordIndexMaterialization(params) {
|
|
394
|
-
const t = tables2.indexMaterializations;
|
|
395
|
-
await db.insert(t).values(
|
|
396
|
-
chunkUJLOZYKT_cjs.buildMaterializationInsertValues(
|
|
397
|
-
params,
|
|
398
|
-
chunkUJLOZYKT_cjs.POSTGRES_INDEX_MAT_TIMESTAMPS.encode
|
|
399
|
-
)
|
|
400
|
-
).onConflictDoUpdate({
|
|
401
|
-
target: t.indexName,
|
|
402
|
-
set: chunkUJLOZYKT_cjs.buildMaterializationOnConflictSet(
|
|
403
|
-
t.materializedAt,
|
|
404
|
-
params.materializedAt
|
|
405
|
-
)
|
|
406
|
-
});
|
|
407
|
-
},
|
|
408
|
-
async ensureContributionMaterializationsTable() {
|
|
409
|
-
await ensureContributionMaterializationsTableImpl();
|
|
410
|
-
},
|
|
411
|
-
async getContributionMaterialization(identity) {
|
|
412
|
-
return getContributionMaterializationRow(identity);
|
|
413
|
-
},
|
|
414
|
-
async recordContributionMaterialization(params) {
|
|
415
|
-
await recordContributionMaterializationRow(params);
|
|
416
|
-
},
|
|
417
|
-
async assertRuntimeContributionsInitialized(graphId) {
|
|
418
|
-
await contributionMaterializer.assertInitialized(graphId);
|
|
419
|
-
},
|
|
420
|
-
async ensureKindRemovalsTable() {
|
|
421
|
-
await db.execute(drizzleOrm.sql.raw(chunkUJLOZYKT_cjs.generatePgCreateTableSQL(tables2.kindRemovals)));
|
|
422
|
-
},
|
|
423
|
-
async getPendingKindRemovals(graphId) {
|
|
424
|
-
const t = tables2.kindRemovals;
|
|
425
|
-
const rows = await db.select().from(t).where(drizzleOrm.and(drizzleOrm.eq(t.graphId, graphId), drizzleOrm.isNull(t.removedAt)));
|
|
426
|
-
return rows.map(
|
|
427
|
-
(row) => chunkUJLOZYKT_cjs.mapKindRemovalRow(row, chunkUJLOZYKT_cjs.POSTGRES_KIND_REMOVAL_TIMESTAMPS.decode)
|
|
428
|
-
);
|
|
429
|
-
},
|
|
430
|
-
async getAllKindRemovals(graphId) {
|
|
431
|
-
const t = tables2.kindRemovals;
|
|
432
|
-
const rows = await db.select().from(t).where(drizzleOrm.eq(t.graphId, graphId));
|
|
433
|
-
return rows.map(
|
|
434
|
-
(row) => chunkUJLOZYKT_cjs.mapKindRemovalRow(row, chunkUJLOZYKT_cjs.POSTGRES_KIND_REMOVAL_TIMESTAMPS.decode)
|
|
435
|
-
);
|
|
436
|
-
},
|
|
437
|
-
async recordKindRemoval(params) {
|
|
438
|
-
const t = tables2.kindRemovals;
|
|
439
|
-
await db.insert(t).values(
|
|
440
|
-
chunkUJLOZYKT_cjs.buildKindRemovalInsertValues(
|
|
441
|
-
params,
|
|
442
|
-
chunkUJLOZYKT_cjs.POSTGRES_KIND_REMOVAL_TIMESTAMPS.encode
|
|
443
|
-
)
|
|
444
|
-
).onConflictDoUpdate({
|
|
445
|
-
target: [t.graphId, t.kindName, t.entity, t.schemaVersion],
|
|
446
|
-
set: chunkUJLOZYKT_cjs.buildKindRemovalOnConflictSet(t.removedAt, params.removedAt)
|
|
447
|
-
});
|
|
448
|
-
},
|
|
449
|
-
async ensureReconciliationMarkersTable() {
|
|
450
|
-
await db.execute(
|
|
451
|
-
drizzleOrm.sql.raw(chunkUJLOZYKT_cjs.generatePgCreateTableSQL(tables2.reconciliationMarkers))
|
|
452
|
-
);
|
|
453
|
-
},
|
|
454
|
-
async ensureRuntimeContributions(graphId) {
|
|
455
|
-
await contributionMaterializer.ensureRuntimeContributions(graphId);
|
|
456
|
-
},
|
|
457
|
-
/**
|
|
458
|
-
* Superseded by `ensureRuntimeContributions(graphId)` (#129).
|
|
459
|
-
* Retained as a thin back-compat wrapper for callers predating
|
|
460
|
-
* #129; #135 routed it through the durable-marker writer.
|
|
461
|
-
*/
|
|
462
|
-
async ensureFulltextTable(graphId) {
|
|
463
|
-
await contributionMaterializer.ensureRuntimeContributions(graphId);
|
|
464
|
-
},
|
|
465
|
-
async getReconciliationMarker(graphId) {
|
|
466
|
-
const t = tables2.reconciliationMarkers;
|
|
467
|
-
const rows = await db.select().from(t).where(drizzleOrm.eq(t.graphId, graphId));
|
|
468
|
-
return rows[0]?.reconciledToVersion;
|
|
469
|
-
},
|
|
470
|
-
async setReconciliationMarker(graphId, version) {
|
|
471
|
-
const t = tables2.reconciliationMarkers;
|
|
472
|
-
await db.insert(t).values({ graphId, reconciledToVersion: version }).onConflictDoUpdate({
|
|
473
|
-
target: t.graphId,
|
|
474
|
-
set: { reconciledToVersion: version }
|
|
475
|
-
});
|
|
476
|
-
},
|
|
477
|
-
async refreshStatistics() {
|
|
478
|
-
await db.execute(coreAnalyzeStatement);
|
|
479
|
-
const tablePresence = await Promise.all(
|
|
480
|
-
recordedAnalyzeTables.map(async (tableName) => ({
|
|
481
|
-
tableName,
|
|
482
|
-
exists: await recordedTableExists(tableName)
|
|
483
|
-
}))
|
|
484
|
-
);
|
|
485
|
-
const presentRecordedTables = tablePresence.filter((entry) => entry.exists).map((entry) => entry.tableName);
|
|
486
|
-
if (presentRecordedTables.length > 0) {
|
|
487
|
-
await db.execute(
|
|
488
|
-
drizzleOrm.sql`ANALYZE ${drizzleOrm.sql.join(
|
|
489
|
-
presentRecordedTables.map((name) => chunkHTGDWIDE_cjs.quoteIdentifier(name)),
|
|
490
|
-
drizzleOrm.sql`, `
|
|
491
|
-
)}`
|
|
492
|
-
);
|
|
493
|
-
}
|
|
494
|
-
},
|
|
495
|
-
async commitSchemaVersion(params) {
|
|
496
|
-
return runSchemaWriteTransaction(
|
|
497
|
-
params.graphId,
|
|
498
|
-
(target) => target.commitSchemaVersion(params)
|
|
499
|
-
);
|
|
500
|
-
},
|
|
501
|
-
async setActiveVersion(params) {
|
|
502
|
-
await runSchemaWriteTransaction(
|
|
503
|
-
params.graphId,
|
|
504
|
-
(target) => target.setActiveVersion(params)
|
|
505
|
-
);
|
|
506
|
-
},
|
|
507
|
-
async transaction(fn, options2) {
|
|
508
|
-
const txConfig = options2?.isolationLevel ? {
|
|
509
|
-
isolationLevel: options2.isolationLevel.replace("_", " ")
|
|
510
|
-
} : void 0;
|
|
511
|
-
return db.transaction(
|
|
512
|
-
async (tx) => fn(bindTransactionBackend(tx), tx),
|
|
513
|
-
txConfig
|
|
514
|
-
);
|
|
515
|
-
},
|
|
516
|
-
adoptTransaction(externalTx) {
|
|
517
|
-
if (!capabilities.transactions) {
|
|
518
|
-
throw new chunkJIEJCTDS_cjs.ConfigurationError(
|
|
519
|
-
"Cross-store atomicity is unavailable on this Postgres backend: its driver does not support transactions (drizzle-orm/neon-http, Cloudflare D1). Adopting an external transaction here would let the caller's relational write commit with no way to roll back the graph write. Use a node-postgres or neon-serverless (Pool/WebSocket) connection for cross-store transactions.",
|
|
520
|
-
{
|
|
521
|
-
backend: "postgres",
|
|
522
|
-
capability: "transactions",
|
|
523
|
-
supportsTransactions: false
|
|
524
|
-
}
|
|
525
|
-
);
|
|
526
|
-
}
|
|
527
|
-
chunkUJLOZYKT_cjs.assertAdoptedDialect(externalTx, pgCore.PgDatabase, "postgres");
|
|
528
|
-
return bindTransactionBackend(externalTx);
|
|
529
|
-
},
|
|
530
|
-
async close() {
|
|
531
|
-
}
|
|
532
|
-
};
|
|
533
|
-
return backend;
|
|
534
|
-
}
|
|
535
|
-
function createPostgresOperationBackend(options) {
|
|
536
|
-
const {
|
|
537
|
-
db,
|
|
538
|
-
executionAdapter,
|
|
539
|
-
adapterOptions,
|
|
540
|
-
operationStrategy,
|
|
541
|
-
tableNames,
|
|
542
|
-
capabilities,
|
|
543
|
-
fulltextStrategy,
|
|
544
|
-
vectorStrategy,
|
|
545
|
-
vectorSlotLatch
|
|
546
|
-
} = options;
|
|
547
|
-
async function execAll(query) {
|
|
548
|
-
return executionAdapter.execute(query);
|
|
549
|
-
}
|
|
550
|
-
async function execGet(query) {
|
|
551
|
-
const rows = await executionAdapter.execute(query);
|
|
552
|
-
return rows[0];
|
|
553
|
-
}
|
|
554
|
-
async function execRun(query) {
|
|
555
|
-
await executionAdapter.execute(query);
|
|
556
|
-
}
|
|
557
|
-
let efSearchUnsupportedWarned = false;
|
|
558
|
-
function warnEfSearchUnsupported() {
|
|
559
|
-
if (efSearchUnsupportedWarned) return;
|
|
560
|
-
efSearchUnsupportedWarned = true;
|
|
561
|
-
if (typeof console === "undefined" || typeof console.warn !== "function") {
|
|
562
|
-
return;
|
|
563
|
-
}
|
|
564
|
-
console.warn(
|
|
565
|
-
"[typegraph] efSearch (hnsw.ef_search override) was ignored: this Postgres backend has transactions disabled (e.g. drizzle-orm/neon-http), and SET LOCAL needs a transaction to scope the override. Use a transactional driver (node-postgres / neon-serverless / postgres-js) to apply efSearch."
|
|
566
|
-
);
|
|
567
|
-
}
|
|
568
|
-
async function runVectorSearch(efSearch, query) {
|
|
569
|
-
if (efSearch === void 0) {
|
|
570
|
-
return execAll(query);
|
|
571
|
-
}
|
|
572
|
-
if (!capabilities.transactions) {
|
|
573
|
-
warnEfSearchUnsupported();
|
|
574
|
-
return execAll(query);
|
|
575
|
-
}
|
|
576
|
-
const setEfSearch = drizzleOrm.sql.raw(`SET LOCAL hnsw.ef_search = ${efSearch}`);
|
|
577
|
-
if (db instanceof pgCore.PgTransaction) {
|
|
578
|
-
const [setting] = await execAll(
|
|
579
|
-
drizzleOrm.sql`SELECT current_setting('hnsw.ef_search') AS ef_search`
|
|
580
|
-
);
|
|
581
|
-
await execRun(setEfSearch);
|
|
582
|
-
const rows = await execAll(query);
|
|
583
|
-
if (setting !== void 0) {
|
|
584
|
-
await execRun(
|
|
585
|
-
drizzleOrm.sql`SELECT set_config('hnsw.ef_search', ${setting.ef_search}, true)`
|
|
586
|
-
);
|
|
587
|
-
}
|
|
588
|
-
return rows;
|
|
589
|
-
}
|
|
590
|
-
return db.transaction(async (tx) => {
|
|
591
|
-
const txAdapter = createPostgresExecutionAdapter(tx, adapterOptions);
|
|
592
|
-
await txAdapter.execute(setEfSearch);
|
|
593
|
-
return txAdapter.execute(query);
|
|
594
|
-
});
|
|
595
|
-
}
|
|
596
|
-
async function ensureVectorSlotStorage(slot) {
|
|
597
|
-
if (vectorStrategy === void 0 || vectorSlotLatch === void 0) return;
|
|
598
|
-
await vectorSlotLatch.ensure(vectorStrategy, slot, async (statement) => {
|
|
599
|
-
await execRun(drizzleOrm.sql.raw(statement));
|
|
600
|
-
});
|
|
601
|
-
}
|
|
602
|
-
const commonBackend = chunkUJLOZYKT_cjs.createCommonOperationBackend({
|
|
603
|
-
batchConfig: {
|
|
604
|
-
checkUniqueBatchChunkSize: POSTGRES_CHECK_UNIQUE_BATCH_CHUNK_SIZE,
|
|
605
|
-
edgeInsertBatchSize: POSTGRES_EDGE_INSERT_BATCH_SIZE,
|
|
606
|
-
getEdgesChunkSize: POSTGRES_GET_EDGES_ID_CHUNK_SIZE,
|
|
607
|
-
getNodesChunkSize: POSTGRES_GET_NODES_ID_CHUNK_SIZE,
|
|
608
|
-
nodeInsertBatchSize: POSTGRES_NODE_INSERT_BATCH_SIZE
|
|
609
|
-
},
|
|
610
|
-
execution: {
|
|
611
|
-
execAll,
|
|
612
|
-
execGet,
|
|
613
|
-
execRun
|
|
614
|
-
},
|
|
615
|
-
nowIso: chunkJJRCLAUN_cjs.nowIso,
|
|
616
|
-
operationStrategy,
|
|
617
|
-
rowMappers: {
|
|
618
|
-
toEdgeRow,
|
|
619
|
-
toNodeRow,
|
|
620
|
-
toSchemaVersionRow,
|
|
621
|
-
toUniqueRow
|
|
622
|
-
},
|
|
623
|
-
tableExistenceCache: { cacheExisting: false }
|
|
624
|
-
});
|
|
625
|
-
const executeCompiled = executionAdapter.executeCompiled;
|
|
626
|
-
const executeRawMethod = executeCompiled === void 0 ? {} : {
|
|
627
|
-
async executeRaw(sqlText, params) {
|
|
628
|
-
return executeCompiled({ params, sql: sqlText });
|
|
629
|
-
}
|
|
630
|
-
};
|
|
631
|
-
const vectorEmbeddingMethods = vectorStrategy === void 0 ? {} : {
|
|
632
|
-
async upsertEmbedding(params) {
|
|
633
|
-
const slot = chunkUJLOZYKT_cjs.vectorSlotFromParams(params);
|
|
634
|
-
await ensureVectorSlotStorage(slot);
|
|
635
|
-
const statements = vectorStrategy.buildUpsert(slot, params, chunkJJRCLAUN_cjs.nowIso());
|
|
636
|
-
try {
|
|
637
|
-
for (const statement of statements) {
|
|
638
|
-
await execRun(statement);
|
|
639
|
-
}
|
|
640
|
-
} catch (error) {
|
|
641
|
-
throw chunkUJLOZYKT_cjs.mapVectorWriteError(error, params);
|
|
642
|
-
}
|
|
643
|
-
},
|
|
644
|
-
async deleteEmbedding(params) {
|
|
645
|
-
const slot = chunkUJLOZYKT_cjs.vectorSlotFromParams(params);
|
|
646
|
-
await ensureVectorSlotStorage(slot);
|
|
647
|
-
const statements = vectorStrategy.buildDelete(slot, params);
|
|
648
|
-
for (const statement of statements) {
|
|
649
|
-
await execRun(statement);
|
|
650
|
-
}
|
|
651
|
-
},
|
|
652
|
-
async vectorSearch(params) {
|
|
653
|
-
chunk2JXB3NYJ_cjs.assertVectorSearchLimit(params.limit);
|
|
654
|
-
chunkKGC4LY5T_cjs.assertPgvectorEfSearch(params.efSearch);
|
|
655
|
-
const slot = chunkUJLOZYKT_cjs.vectorSlotFromParams(params);
|
|
656
|
-
await ensureVectorSlotStorage(slot);
|
|
657
|
-
const query = vectorStrategy.buildSearch(slot, params);
|
|
658
|
-
let rows;
|
|
659
|
-
try {
|
|
660
|
-
rows = await runVectorSearch(params.efSearch, query);
|
|
661
|
-
} catch (error) {
|
|
662
|
-
throw chunkUJLOZYKT_cjs.mapVectorWriteError(error, params);
|
|
663
|
-
}
|
|
664
|
-
return rows.map((row) => ({
|
|
665
|
-
nodeId: row.node_id,
|
|
666
|
-
score: row.score
|
|
667
|
-
}));
|
|
668
|
-
}
|
|
669
|
-
};
|
|
670
|
-
const operationBackend = {
|
|
671
|
-
...commonBackend,
|
|
672
|
-
...executeRawMethod,
|
|
673
|
-
...vectorEmbeddingMethods,
|
|
674
|
-
capabilities,
|
|
675
|
-
fulltextStrategy,
|
|
676
|
-
...vectorStrategy === void 0 ? {} : { vectorStrategy },
|
|
677
|
-
dialect: "postgres",
|
|
678
|
-
tableNames,
|
|
679
|
-
// === Vector Index Operations ===
|
|
680
|
-
async createVectorIndex(params) {
|
|
681
|
-
if (vectorStrategy === void 0) return;
|
|
682
|
-
const slot = chunkUJLOZYKT_cjs.vectorSlotFromCreateIndexParams(params);
|
|
683
|
-
await ensureVectorSlotStorage(slot);
|
|
684
|
-
const indexStatement = vectorStrategy.buildCreateIndex?.(slot, {
|
|
685
|
-
concurrent: params.concurrent === true
|
|
686
|
-
});
|
|
687
|
-
if (indexStatement !== void 0) {
|
|
688
|
-
await execRun(indexStatement);
|
|
689
|
-
}
|
|
690
|
-
},
|
|
691
|
-
// === Fulltext Operations ===
|
|
692
|
-
async upsertFulltext(params) {
|
|
693
|
-
const timestamp = chunkJJRCLAUN_cjs.nowIso();
|
|
694
|
-
const statements = operationStrategy.buildUpsertFulltext(
|
|
695
|
-
params,
|
|
696
|
-
timestamp
|
|
697
|
-
);
|
|
698
|
-
for (const stmt of statements) {
|
|
699
|
-
await execRun(stmt);
|
|
700
|
-
}
|
|
701
|
-
},
|
|
702
|
-
async deleteFulltext(params) {
|
|
703
|
-
const statements = operationStrategy.buildDeleteFulltext(params);
|
|
704
|
-
for (const stmt of statements) {
|
|
705
|
-
await execRun(stmt);
|
|
706
|
-
}
|
|
707
|
-
},
|
|
708
|
-
async upsertFulltextBatch(params) {
|
|
709
|
-
if (params.rows.length === 0) return;
|
|
710
|
-
const timestamp = chunkJJRCLAUN_cjs.nowIso();
|
|
711
|
-
const statements = operationStrategy.buildUpsertFulltextBatch(
|
|
712
|
-
params,
|
|
713
|
-
timestamp
|
|
714
|
-
);
|
|
715
|
-
for (const stmt of statements) {
|
|
716
|
-
await execRun(stmt);
|
|
717
|
-
}
|
|
718
|
-
},
|
|
719
|
-
async deleteFulltextBatch(params) {
|
|
720
|
-
if (params.nodeIds.length === 0) return;
|
|
721
|
-
const statements = operationStrategy.buildDeleteFulltextBatch(params);
|
|
722
|
-
for (const stmt of statements) {
|
|
723
|
-
await execRun(stmt);
|
|
724
|
-
}
|
|
725
|
-
},
|
|
726
|
-
async fulltextSearch(params) {
|
|
727
|
-
const query = operationStrategy.buildFulltextSearch(params);
|
|
728
|
-
const rows = await execAll(query);
|
|
729
|
-
return rows.map((row, index) => ({
|
|
730
|
-
nodeId: row.node_id,
|
|
731
|
-
score: chunkJJRCLAUN_cjs.coerceNumericScore(row.score),
|
|
732
|
-
rank: index + 1,
|
|
733
|
-
...row.snippet === null ? {} : { snippet: row.snippet }
|
|
734
|
-
}));
|
|
735
|
-
},
|
|
736
|
-
async dropVectorIndex(params) {
|
|
737
|
-
if (vectorStrategy === void 0) return;
|
|
738
|
-
const slot = chunkUJLOZYKT_cjs.vectorSlotFromDropIndexParams(params);
|
|
739
|
-
const dropStatement = vectorStrategy.buildDropIndex?.(slot);
|
|
740
|
-
if (dropStatement === void 0) return;
|
|
741
|
-
try {
|
|
742
|
-
await execRun(dropStatement);
|
|
743
|
-
} catch (error) {
|
|
744
|
-
if (!chunkRHZWOJVA_cjs.isMissingTableError(error)) throw error;
|
|
745
|
-
}
|
|
746
|
-
},
|
|
747
|
-
// === Query Execution ===
|
|
748
|
-
async execute(query) {
|
|
749
|
-
return executionAdapter.execute(query);
|
|
750
|
-
},
|
|
751
|
-
compileSql(query) {
|
|
752
|
-
return executionAdapter.compile(query);
|
|
753
|
-
}
|
|
754
|
-
};
|
|
755
|
-
return operationBackend;
|
|
756
|
-
}
|
|
757
|
-
function createTransactionBackend(options) {
|
|
758
|
-
const txExecutionAdapter = options.executionAdapter ?? createPostgresExecutionAdapter(options.db, options.adapterOptions);
|
|
759
|
-
return createPostgresOperationBackend({
|
|
760
|
-
db: options.db,
|
|
761
|
-
executionAdapter: txExecutionAdapter,
|
|
762
|
-
adapterOptions: options.adapterOptions,
|
|
763
|
-
operationStrategy: options.operationStrategy,
|
|
764
|
-
tableNames: options.tableNames,
|
|
765
|
-
capabilities: options.capabilities,
|
|
766
|
-
fulltextStrategy: options.fulltextStrategy,
|
|
767
|
-
vectorStrategy: options.vectorStrategy,
|
|
768
|
-
vectorSlotLatch: options.vectorStrategy === void 0 ? void 0 : chunkUJLOZYKT_cjs.createVectorSlotLatch()
|
|
769
|
-
});
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
exports.createPostgresBackend = createPostgresBackend;
|
|
773
|
-
//# sourceMappingURL=chunk-TOTPVGOG.cjs.map
|
|
774
|
-
//# sourceMappingURL=chunk-TOTPVGOG.cjs.map
|