@nicia-ai/typegraph 0.36.0 → 0.37.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 +24 -24
- package/dist/backend/postgres/index.d.cts +6 -6
- package/dist/backend/postgres/index.d.ts +6 -6
- package/dist/backend/postgres/index.js +11 -11
- package/dist/backend/postgres/pglite.cjs +16 -16
- package/dist/backend/postgres/pglite.d.cts +3 -3
- package/dist/backend/postgres/pglite.d.ts +3 -3
- package/dist/backend/postgres/pglite.js +11 -11
- package/dist/backend/sqlite/index.cjs +22 -21
- package/dist/backend/sqlite/index.d.cts +11 -9
- package/dist/backend/sqlite/index.d.ts +11 -9
- package/dist/backend/sqlite/index.js +10 -9
- package/dist/backend/sqlite/libsql.cjs +15 -14
- package/dist/backend/sqlite/libsql.cjs.map +1 -1
- package/dist/backend/sqlite/libsql.d.cts +3 -3
- package/dist/backend/sqlite/libsql.d.ts +3 -3
- package/dist/backend/sqlite/libsql.js +11 -10
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +30 -23
- package/dist/backend/sqlite/local.cjs.map +1 -1
- package/dist/backend/sqlite/local.d.cts +3 -3
- package/dist/backend/sqlite/local.d.ts +3 -3
- package/dist/backend/sqlite/local.js +18 -11
- package/dist/backend/sqlite/local.js.map +1 -1
- package/dist/{chunk-TCOCYN2P.cjs → chunk-27SSDCEP.cjs} +14 -14
- package/dist/{chunk-TCOCYN2P.cjs.map → chunk-27SSDCEP.cjs.map} +1 -1
- package/dist/{chunk-5AQIKK56.cjs → chunk-2N6EOBTH.cjs} +16 -16
- package/dist/{chunk-5AQIKK56.cjs.map → chunk-2N6EOBTH.cjs.map} +1 -1
- package/dist/{chunk-FN35DLCN.cjs → chunk-3C2RYI6L.cjs} +13 -107
- package/dist/chunk-3C2RYI6L.cjs.map +1 -0
- package/dist/{chunk-HW3LW7DH.cjs → chunk-3DS7Z4T4.cjs} +39 -39
- package/dist/{chunk-HW3LW7DH.cjs.map → chunk-3DS7Z4T4.cjs.map} +1 -1
- package/dist/{chunk-RSSQKPSZ.cjs → chunk-3GH67G4Z.cjs} +5 -5
- package/dist/{chunk-RSSQKPSZ.cjs.map → chunk-3GH67G4Z.cjs.map} +1 -1
- package/dist/{chunk-M75SUBFG.js → chunk-3RWZPJKV.js} +24 -9
- package/dist/chunk-3RWZPJKV.js.map +1 -0
- package/dist/{chunk-SKCOUWAX.js → chunk-3SLPDKHQ.js} +4 -4
- package/dist/chunk-3SLPDKHQ.js.map +1 -0
- package/dist/{chunk-5A6FNS6N.cjs → chunk-3XXGYU62.cjs} +11 -11
- package/dist/{chunk-5A6FNS6N.cjs.map → chunk-3XXGYU62.cjs.map} +1 -1
- package/dist/{chunk-IU46OHVW.js → chunk-44TA22QT.js} +58 -11
- package/dist/chunk-44TA22QT.js.map +1 -0
- package/dist/{chunk-5DIPR3L3.js → chunk-552KNYQJ.js} +2392 -279
- package/dist/chunk-552KNYQJ.js.map +1 -0
- package/dist/{chunk-2THZ3TQI.cjs → chunk-5KEQ74YU.cjs} +14 -14
- package/dist/chunk-5KEQ74YU.cjs.map +1 -0
- package/dist/{chunk-Q5TEXCTB.js → chunk-5KPNWT6X.js} +3 -3
- package/dist/{chunk-Q5TEXCTB.js.map → chunk-5KPNWT6X.js.map} +1 -1
- package/dist/{chunk-WI7ISNQF.js → chunk-5PNMDJ7J.js} +94 -5
- package/dist/chunk-5PNMDJ7J.js.map +1 -0
- package/dist/{chunk-AW4A3P5A.cjs → chunk-5VQM6VWP.cjs} +2 -2
- package/dist/{chunk-AW4A3P5A.cjs.map → chunk-5VQM6VWP.cjs.map} +1 -1
- package/dist/{chunk-A3W7QG7K.js → chunk-5WWVZMVX.js} +2 -2
- package/dist/{chunk-A3W7QG7K.js.map → chunk-5WWVZMVX.js.map} +1 -1
- package/dist/{chunk-FACJJWGF.cjs → chunk-6EEO3OVU.cjs} +7 -7
- package/dist/{chunk-FACJJWGF.cjs.map → chunk-6EEO3OVU.cjs.map} +1 -1
- package/dist/{chunk-DIK74MXX.cjs → chunk-BVRDGYXQ.cjs} +97 -4
- package/dist/chunk-BVRDGYXQ.cjs.map +1 -0
- package/dist/{chunk-4BCU6VFZ.cjs → chunk-DEFQM7JU.cjs} +7 -7
- package/dist/{chunk-4BCU6VFZ.cjs.map → chunk-DEFQM7JU.cjs.map} +1 -1
- package/dist/{chunk-456Z2U7Y.cjs → chunk-DIQ3AV5W.cjs} +574 -268
- package/dist/chunk-DIQ3AV5W.cjs.map +1 -0
- package/dist/{chunk-FPIZFYHE.js → chunk-EXU3RASM.js} +74 -15
- package/dist/chunk-EXU3RASM.js.map +1 -0
- package/dist/{chunk-H7YNSMA7.cjs → chunk-HAHNRASW.cjs} +20 -2
- package/dist/chunk-HAHNRASW.cjs.map +1 -0
- package/dist/{chunk-J3LEGNQB.cjs → chunk-IP3CGGPA.cjs} +8 -8
- package/dist/{chunk-J3LEGNQB.cjs.map → chunk-IP3CGGPA.cjs.map} +1 -1
- package/dist/{chunk-X4JBT642.cjs → chunk-IPSVVTWT.cjs} +94 -35
- package/dist/chunk-IPSVVTWT.cjs.map +1 -0
- package/dist/{chunk-VQEXF5D4.js → chunk-IXGYRP2P.js} +184 -92
- package/dist/chunk-IXGYRP2P.js.map +1 -0
- package/dist/{chunk-BJVEU3ZL.js → chunk-J4IUSYFF.js} +251 -121
- package/dist/chunk-J4IUSYFF.js.map +1 -0
- package/dist/{chunk-JFMEONLG.cjs → chunk-JBNOGRKW.cjs} +318 -188
- package/dist/chunk-JBNOGRKW.cjs.map +1 -0
- package/dist/{chunk-4GX2JJXS.js → chunk-K3Q3LJY3.js} +520 -221
- package/dist/chunk-K3Q3LJY3.js.map +1 -0
- package/dist/{chunk-OR5ZA5WP.js → chunk-K5UBVGJN.js} +4 -4
- package/dist/{chunk-OR5ZA5WP.js.map → chunk-K5UBVGJN.js.map} +1 -1
- package/dist/{chunk-UZV3AZKF.js → chunk-KQJ54OG5.js} +3 -3
- package/dist/{chunk-UZV3AZKF.js.map → chunk-KQJ54OG5.js.map} +1 -1
- package/dist/{chunk-SXGE7ITL.js → chunk-L7HQ2OSI.js} +4 -4
- package/dist/{chunk-SXGE7ITL.js.map → chunk-L7HQ2OSI.js.map} +1 -1
- package/dist/{chunk-RAXU3RMB.js → chunk-M6VES7V6.js} +4 -4
- package/dist/{chunk-RAXU3RMB.js.map → chunk-M6VES7V6.js.map} +1 -1
- package/dist/{chunk-7BQLPXK6.cjs → chunk-NBP2WTJW.cjs} +3011 -898
- package/dist/chunk-NBP2WTJW.cjs.map +1 -0
- package/dist/{chunk-PWGX5DF5.cjs → chunk-NUIG3BCV.cjs} +100 -85
- package/dist/chunk-NUIG3BCV.cjs.map +1 -0
- package/dist/{chunk-ZAMFOJ5P.cjs → chunk-NXQFATMF.cjs} +269 -177
- package/dist/chunk-NXQFATMF.cjs.map +1 -0
- package/dist/{chunk-KBGQIPRQ.js → chunk-PC2UBAUB.js} +20 -3
- package/dist/chunk-PC2UBAUB.js.map +1 -0
- package/dist/chunk-QARBLBXT.cjs +219 -0
- package/dist/chunk-QARBLBXT.cjs.map +1 -0
- package/dist/{chunk-6FR2MMS6.js → chunk-QERAIDRJ.js} +45 -4
- package/dist/chunk-QERAIDRJ.js.map +1 -0
- package/dist/chunk-QSXTWU4U.cjs +12 -0
- package/dist/{chunk-4BMPGT35.cjs.map → chunk-QSXTWU4U.cjs.map} +1 -1
- package/dist/{chunk-DN5VP4JC.js → chunk-RCVLFTCT.js} +9 -10
- package/dist/chunk-RCVLFTCT.js.map +1 -0
- package/dist/{chunk-ZIGXMKQQ.js → chunk-RRSNR3TP.js} +3 -3
- package/dist/{chunk-ZIGXMKQQ.js.map → chunk-RRSNR3TP.js.map} +1 -1
- package/dist/{chunk-4CAXEB2F.cjs → chunk-TGOMW4MB.cjs} +91 -92
- package/dist/chunk-TGOMW4MB.cjs.map +1 -0
- package/dist/{chunk-PZKNKG5M.js → chunk-TKT2XHED.js} +8 -8
- package/dist/{chunk-PZKNKG5M.js.map → chunk-TKT2XHED.js.map} +1 -1
- package/dist/{chunk-S5F7ZLP2.js → chunk-TPF25IG6.js} +3 -3
- package/dist/{chunk-S5F7ZLP2.js.map → chunk-TPF25IG6.js.map} +1 -1
- package/dist/{chunk-5SEGFTZX.js → chunk-UGZUAYAR.js} +3 -3
- package/dist/{chunk-5SEGFTZX.js.map → chunk-UGZUAYAR.js.map} +1 -1
- package/dist/{chunk-VHMPG6UL.js → chunk-UXLSNRYL.js} +11 -105
- package/dist/chunk-UXLSNRYL.js.map +1 -0
- package/dist/{chunk-FRV5Q5IO.js → chunk-UYQMBBWJ.js} +3 -3
- package/dist/{chunk-FRV5Q5IO.js.map → chunk-UYQMBBWJ.js.map} +1 -1
- package/dist/{chunk-UUT7UN2N.cjs → chunk-VGDDG3XJ.cjs} +7 -7
- package/dist/{chunk-UUT7UN2N.cjs.map → chunk-VGDDG3XJ.cjs.map} +1 -1
- package/dist/{chunk-5VTR2F2K.js → chunk-VKGKDOKR.js} +12 -10
- package/dist/chunk-VKGKDOKR.js.map +1 -0
- package/dist/{chunk-5W4L6DLF.cjs → chunk-VL2V6PEN.cjs} +11 -11
- package/dist/{chunk-5W4L6DLF.cjs.map → chunk-VL2V6PEN.cjs.map} +1 -1
- package/dist/{chunk-ZUNQ5BEP.cjs → chunk-WOJMKB3N.cjs} +82 -80
- package/dist/chunk-WOJMKB3N.cjs.map +1 -0
- package/dist/{chunk-UMDVATGY.cjs → chunk-WWFHO375.cjs} +6 -6
- package/dist/{chunk-UMDVATGY.cjs.map → chunk-WWFHO375.cjs.map} +1 -1
- package/dist/{chunk-JFUPDJXD.js → chunk-XGPUQ56G.js} +3 -3
- package/dist/{chunk-JFUPDJXD.js.map → chunk-XGPUQ56G.js.map} +1 -1
- package/dist/{chunk-D7ZEOS56.cjs → chunk-XGU7DZDA.cjs} +74 -14
- package/dist/chunk-XGU7DZDA.cjs.map +1 -0
- package/dist/{chunk-S55OV6PW.cjs → chunk-XPCZADMT.cjs} +54 -11
- package/dist/chunk-XPCZADMT.cjs.map +1 -0
- package/dist/{chunk-T2WUSPDA.js → chunk-XWV4JT34.js} +3 -3
- package/dist/{chunk-T2WUSPDA.js.map → chunk-XWV4JT34.js.map} +1 -1
- package/dist/chunk-YTSN73ND.js +212 -0
- package/dist/chunk-YTSN73ND.js.map +1 -0
- package/dist/{ddl-CZz7a0E8.d.cts → ddl-BD-ZfKeX.d.cts} +3 -3
- package/dist/{ddl-C2rZ-Aen.d.ts → ddl-CS0KUVwB.d.ts} +3 -3
- package/dist/{extension-types-ixRpJVUp.d.ts → extension-types-BM2ACfYO.d.cts} +6 -1
- package/dist/{extension-types-ixRpJVUp.d.cts → extension-types-BM2ACfYO.d.ts} +6 -1
- package/dist/{fulltext-strategy-CDkSSYhq.d.cts → fulltext-strategy-C27vXaeB.d.cts} +127 -8
- package/dist/{fulltext-strategy-B57yvC5Q.d.ts → fulltext-strategy-DebsMrqg.d.ts} +127 -8
- package/dist/graph-extension/index.cjs +19 -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 +4 -4
- package/dist/graph-merge/index.cjs +88 -88
- package/dist/graph-merge/index.d.cts +6 -6
- package/dist/graph-merge/index.d.ts +6 -6
- package/dist/graph-merge/index.js +19 -19
- package/dist/{index-BLtQWKRj.d.cts → index-BPM59vsg.d.cts} +52 -7
- package/dist/{index-BFvdmBPV.d.ts → index-BeacbPoe.d.ts} +52 -7
- package/dist/index.cjs +224 -187
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -11
- package/dist/index.d.ts +11 -11
- package/dist/index.js +53 -40
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +30 -21
- package/dist/indexes/index.d.cts +5 -5
- package/dist/indexes/index.d.ts +5 -5
- package/dist/indexes/index.js +8 -7
- package/dist/interchange/index.cjs +207 -30
- package/dist/interchange/index.cjs.map +1 -1
- package/dist/interchange/index.d.cts +25 -8
- package/dist/interchange/index.d.ts +25 -8
- package/dist/interchange/index.js +190 -11
- package/dist/interchange/index.js.map +1 -1
- package/dist/{manager-DwQi8eV0.d.cts → manager-D00_NXvT.d.ts} +11 -2
- package/dist/{manager-ejUCB52T.d.ts → manager-nU1vTJLy.d.cts} +11 -2
- package/dist/{materialize-indexes-B4e9360H.d.cts → materialize-indexes-CuR3gAZb.d.cts} +8 -2
- package/dist/{materialize-indexes-te9TPMMJ.d.ts → materialize-indexes-zK2J_flP.d.ts} +8 -2
- package/dist/{postgres-CfEqsRMp.d.cts → postgres-IaBA4RgE.d.ts} +1 -1
- package/dist/{postgres-DQ5R6rzV.d.ts → postgres-YrYmPlaU.d.cts} +1 -1
- package/dist/profiler/index.cjs +3 -3
- package/dist/profiler/index.d.cts +7 -7
- package/dist/profiler/index.d.ts +7 -7
- package/dist/profiler/index.js +2 -2
- package/dist/provenance/index.cjs +32 -33
- 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 +5 -6
- package/dist/provenance/index.js.map +1 -1
- package/dist/schema/index.cjs +35 -35
- package/dist/schema/index.d.cts +7 -7
- package/dist/schema/index.d.ts +7 -7
- package/dist/schema/index.js +11 -11
- package/dist/{sqlite-DvQndLky.d.ts → sqlite-BUOHPx7p.d.ts} +1 -1
- package/dist/{sqlite-D7zBinNR.d.cts → sqlite-Pp8O19WE.d.cts} +1 -1
- package/dist/{store-view-DplHC3Nt.d.ts → store-view-ANL6mTph.d.ts} +213 -27
- package/dist/{store-view-9KDOpZzF.d.cts → store-view-X96Rd00T.d.cts} +213 -27
- package/dist/{types-Bv9DcS_E.d.cts → types-r-Zyq2Hz.d.cts} +2 -2
- package/dist/{types-CoxuV7EJ.d.ts → types-wsvuBgPK.d.ts} +2 -2
- package/dist/where-CJOpJj3a.d.ts +36 -0
- package/dist/where-K3uBP33l.d.cts +36 -0
- package/package.json +1 -1
- package/dist/chunk-2THZ3TQI.cjs.map +0 -1
- package/dist/chunk-456Z2U7Y.cjs.map +0 -1
- package/dist/chunk-4BMPGT35.cjs +0 -12
- package/dist/chunk-4CAXEB2F.cjs.map +0 -1
- package/dist/chunk-4GX2JJXS.js.map +0 -1
- package/dist/chunk-5DIPR3L3.js.map +0 -1
- package/dist/chunk-5VTR2F2K.js.map +0 -1
- package/dist/chunk-6FR2MMS6.js.map +0 -1
- package/dist/chunk-7BQLPXK6.cjs.map +0 -1
- package/dist/chunk-BJVEU3ZL.js.map +0 -1
- package/dist/chunk-D7ZEOS56.cjs.map +0 -1
- package/dist/chunk-DIK74MXX.cjs.map +0 -1
- package/dist/chunk-DN5VP4JC.js.map +0 -1
- package/dist/chunk-EOLERH7Y.cjs +0 -40
- package/dist/chunk-EOLERH7Y.cjs.map +0 -1
- package/dist/chunk-FN35DLCN.cjs.map +0 -1
- package/dist/chunk-FPIZFYHE.js.map +0 -1
- package/dist/chunk-H7YNSMA7.cjs.map +0 -1
- package/dist/chunk-IU46OHVW.js.map +0 -1
- package/dist/chunk-JFMEONLG.cjs.map +0 -1
- package/dist/chunk-KBGQIPRQ.js.map +0 -1
- package/dist/chunk-M75SUBFG.js.map +0 -1
- package/dist/chunk-PWGX5DF5.cjs.map +0 -1
- package/dist/chunk-S55OV6PW.cjs.map +0 -1
- package/dist/chunk-SKCOUWAX.js.map +0 -1
- package/dist/chunk-UT3S4SEN.js +0 -31
- package/dist/chunk-UT3S4SEN.js.map +0 -1
- package/dist/chunk-VHMPG6UL.js.map +0 -1
- package/dist/chunk-VQEXF5D4.js.map +0 -1
- package/dist/chunk-WI7ISNQF.js.map +0 -1
- package/dist/chunk-X4JBT642.cjs.map +0 -1
- package/dist/chunk-ZAMFOJ5P.cjs.map +0 -1
- package/dist/chunk-ZUNQ5BEP.cjs.map +0 -1
- package/dist/where-7RKFOsXt.d.ts +0 -11
- package/dist/where-DdMIXOtH.d.cts +0 -11
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var chunkDIK74MXX_cjs = require('./chunk-DIK74MXX.cjs');
|
|
3
|
+
var chunkDIQ3AV5W_cjs = require('./chunk-DIQ3AV5W.cjs');
|
|
4
|
+
var chunk27SSDCEP_cjs = require('./chunk-27SSDCEP.cjs');
|
|
5
|
+
var chunkVL2V6PEN_cjs = require('./chunk-VL2V6PEN.cjs');
|
|
6
|
+
var chunkXGU7DZDA_cjs = require('./chunk-XGU7DZDA.cjs');
|
|
7
|
+
var chunkIPSVVTWT_cjs = require('./chunk-IPSVVTWT.cjs');
|
|
8
|
+
var chunk3GH67G4Z_cjs = require('./chunk-3GH67G4Z.cjs');
|
|
9
|
+
var chunkBVRDGYXQ_cjs = require('./chunk-BVRDGYXQ.cjs');
|
|
11
10
|
var drizzleOrm = require('drizzle-orm');
|
|
12
11
|
var pgCore = require('drizzle-orm/pg-core');
|
|
13
12
|
|
|
@@ -25,8 +24,14 @@ function isPgNativeClient(candidate) {
|
|
|
25
24
|
function isPgliteClient(candidate) {
|
|
26
25
|
return typeof candidate === "object" && hasFunctionProperty(candidate, "query") && hasFunctionProperty(candidate, "dumpDataDir");
|
|
27
26
|
}
|
|
27
|
+
function transactionSession(carrier) {
|
|
28
|
+
return carrier.session ?? carrier._?.session;
|
|
29
|
+
}
|
|
30
|
+
function hasPgliteSession(carrier) {
|
|
31
|
+
return transactionSession(carrier)?.constructor?.name === "PgliteSession";
|
|
32
|
+
}
|
|
28
33
|
function isPostgresJsClient(candidate) {
|
|
29
|
-
return typeof candidate === "function" && hasFunctionProperty(candidate, "unsafe") && hasFunctionProperty(candidate, "begin");
|
|
34
|
+
return typeof candidate === "function" && hasFunctionProperty(candidate, "unsafe") && (hasFunctionProperty(candidate, "begin") || hasFunctionProperty(candidate, "savepoint"));
|
|
30
35
|
}
|
|
31
36
|
function isNeonHttpClient(db) {
|
|
32
37
|
const candidate = db.$client;
|
|
@@ -36,7 +41,7 @@ var DEFAULT_POSTGRES_STATEMENT_CACHE_MAX = 256;
|
|
|
36
41
|
var STATEMENT_NAME_CACHE = /* @__PURE__ */ new Map();
|
|
37
42
|
var nextStatementId = 0;
|
|
38
43
|
function statementNameFor(sqlText, cacheMax) {
|
|
39
|
-
return
|
|
44
|
+
return chunkDIQ3AV5W_cjs.getOrCreateLru(STATEMENT_NAME_CACHE, sqlText, cacheMax, () => {
|
|
40
45
|
const name = `tg_${nextStatementId}`;
|
|
41
46
|
nextStatementId += 1;
|
|
42
47
|
return name;
|
|
@@ -105,12 +110,14 @@ function adaptPostgresJsClient(sql2) {
|
|
|
105
110
|
}
|
|
106
111
|
};
|
|
107
112
|
}
|
|
108
|
-
function resolvePgClient(db, prepareStatements, cacheMax) {
|
|
113
|
+
function resolvePgClient(db, prepareStatements, cacheMax, useTransactionClient) {
|
|
109
114
|
if (isNeonHttpClient(db)) {
|
|
110
115
|
return void 0;
|
|
111
116
|
}
|
|
112
|
-
const
|
|
113
|
-
|
|
117
|
+
const carrier = db;
|
|
118
|
+
const client = carrier.$client ?? (useTransactionClient ? transactionSession(carrier)?.client : void 0);
|
|
119
|
+
if (isPgliteClient(client) || useTransactionClient && hasPgliteSession(carrier)) {
|
|
120
|
+
if (!isPgNativeClient(client)) return void 0;
|
|
114
121
|
return wrapNodePgClientUnnamed(client);
|
|
115
122
|
}
|
|
116
123
|
if (isPgNativeClient(client)) {
|
|
@@ -139,9 +146,14 @@ function createPgPreparedStatement(pgClient, sqlText) {
|
|
|
139
146
|
function createPostgresExecutionAdapter(db, options = {}) {
|
|
140
147
|
const prepareStatements = options.prepareStatements ?? true;
|
|
141
148
|
const cacheMax = options.preparedStatementCacheMax ?? DEFAULT_POSTGRES_STATEMENT_CACHE_MAX;
|
|
142
|
-
const pgClient = resolvePgClient(
|
|
149
|
+
const pgClient = resolvePgClient(
|
|
150
|
+
db,
|
|
151
|
+
prepareStatements,
|
|
152
|
+
cacheMax,
|
|
153
|
+
options.useTransactionClient ?? false
|
|
154
|
+
);
|
|
143
155
|
function compile(query) {
|
|
144
|
-
return
|
|
156
|
+
return chunkDIQ3AV5W_cjs.compileQueryWithDialect(db, query, "PostgreSQL");
|
|
145
157
|
}
|
|
146
158
|
if (pgClient === void 0) {
|
|
147
159
|
return {
|
|
@@ -163,7 +175,7 @@ function createPostgresExecutionAdapter(db, options = {}) {
|
|
|
163
175
|
compile,
|
|
164
176
|
async execute(query) {
|
|
165
177
|
const compiled = compile(query);
|
|
166
|
-
if (
|
|
178
|
+
if (chunkIPSVVTWT_cjs.shouldForceCustomPlan(query)) {
|
|
167
179
|
const result = await pgQueryClient.queryUnnamed(
|
|
168
180
|
compiled.sql,
|
|
169
181
|
compiled.params
|
|
@@ -187,7 +199,7 @@ function createStatementQueue() {
|
|
|
187
199
|
let closed = false;
|
|
188
200
|
return {
|
|
189
201
|
enqueue(task) {
|
|
190
|
-
if (closed) return Promise.reject(new
|
|
202
|
+
if (closed) return Promise.reject(new chunkBVRDGYXQ_cjs.TransactionClosedError());
|
|
191
203
|
const result = tail.then(() => task());
|
|
192
204
|
tail = result.then(ignoreOutcome, ignoreOutcome);
|
|
193
205
|
return result;
|
|
@@ -235,69 +247,74 @@ var NODE_INSERT_PARAM_COUNT = 9;
|
|
|
235
247
|
var EDGE_INSERT_PARAM_COUNT = 12;
|
|
236
248
|
var POSTGRES_NODE_INSERT_BATCH_SIZE = Math.max(
|
|
237
249
|
1,
|
|
238
|
-
Math.floor(
|
|
250
|
+
Math.floor(chunkIPSVVTWT_cjs.POSTGRES_MAX_BIND_PARAMETERS / NODE_INSERT_PARAM_COUNT)
|
|
239
251
|
);
|
|
240
252
|
var POSTGRES_EDGE_INSERT_BATCH_SIZE = Math.max(
|
|
241
253
|
1,
|
|
242
|
-
Math.floor(
|
|
254
|
+
Math.floor(chunkIPSVVTWT_cjs.POSTGRES_MAX_BIND_PARAMETERS / EDGE_INSERT_PARAM_COUNT)
|
|
243
255
|
);
|
|
244
256
|
var POSTGRES_GET_NODES_ID_CHUNK_SIZE = Math.max(
|
|
245
257
|
1,
|
|
246
|
-
|
|
258
|
+
chunkIPSVVTWT_cjs.POSTGRES_MAX_BIND_PARAMETERS - 2
|
|
247
259
|
);
|
|
248
260
|
var POSTGRES_GET_EDGES_ID_CHUNK_SIZE = Math.max(
|
|
249
261
|
1,
|
|
250
|
-
|
|
262
|
+
chunkIPSVVTWT_cjs.POSTGRES_MAX_BIND_PARAMETERS - 1
|
|
251
263
|
);
|
|
252
264
|
var FULLTEXT_UPSERT_PARAM_COUNT = 6;
|
|
253
265
|
var FULLTEXT_DELETE_FIXED_PARAM_COUNT = 2;
|
|
254
266
|
var POSTGRES_FULLTEXT_UPSERT_BATCH_SIZE = Math.max(
|
|
255
267
|
1,
|
|
256
|
-
Math.floor(
|
|
268
|
+
Math.floor(chunkIPSVVTWT_cjs.POSTGRES_MAX_BIND_PARAMETERS / FULLTEXT_UPSERT_PARAM_COUNT)
|
|
257
269
|
);
|
|
258
270
|
var POSTGRES_FULLTEXT_DELETE_CHUNK_SIZE = Math.max(
|
|
259
271
|
1,
|
|
260
|
-
|
|
272
|
+
chunkIPSVVTWT_cjs.POSTGRES_MAX_BIND_PARAMETERS - FULLTEXT_DELETE_FIXED_PARAM_COUNT
|
|
261
273
|
);
|
|
262
274
|
var CHECK_UNIQUE_BATCH_FIXED_PARAM_COUNT = 3;
|
|
263
275
|
var POSTGRES_CHECK_UNIQUE_BATCH_CHUNK_SIZE = Math.max(
|
|
264
276
|
1,
|
|
265
|
-
|
|
277
|
+
chunkIPSVVTWT_cjs.POSTGRES_MAX_BIND_PARAMETERS - CHECK_UNIQUE_BATCH_FIXED_PARAM_COUNT
|
|
266
278
|
);
|
|
267
279
|
var UNIQUE_INSERT_PARAM_COUNT = 6;
|
|
268
280
|
var POSTGRES_UNIQUE_INSERT_BATCH_SIZE = Math.max(
|
|
269
281
|
1,
|
|
270
|
-
Math.floor(
|
|
282
|
+
Math.floor(chunkIPSVVTWT_cjs.POSTGRES_MAX_BIND_PARAMETERS / UNIQUE_INSERT_PARAM_COUNT)
|
|
271
283
|
);
|
|
272
|
-
var toNodeRow =
|
|
273
|
-
var toEdgeRow =
|
|
274
|
-
var toUniqueRow =
|
|
275
|
-
var toSchemaVersionRow =
|
|
276
|
-
|
|
284
|
+
var toNodeRow = chunkVL2V6PEN_cjs.createNodeRowMapper(chunkVL2V6PEN_cjs.POSTGRES_ROW_MAPPER_CONFIG);
|
|
285
|
+
var toEdgeRow = chunkVL2V6PEN_cjs.createEdgeRowMapper(chunkVL2V6PEN_cjs.POSTGRES_ROW_MAPPER_CONFIG);
|
|
286
|
+
var toUniqueRow = chunkVL2V6PEN_cjs.createUniqueRowMapper(chunkVL2V6PEN_cjs.POSTGRES_ROW_MAPPER_CONFIG);
|
|
287
|
+
var toSchemaVersionRow = chunkVL2V6PEN_cjs.createSchemaVersionRowMapper(
|
|
288
|
+
chunkVL2V6PEN_cjs.POSTGRES_ROW_MAPPER_CONFIG
|
|
277
289
|
);
|
|
278
290
|
function buildPostgresCapabilities(fulltextStrategy, vectorStrategy) {
|
|
279
291
|
return {
|
|
280
|
-
...
|
|
281
|
-
...vectorStrategy === void 0 ? {} : { vector:
|
|
282
|
-
fulltext:
|
|
292
|
+
...chunkIPSVVTWT_cjs.POSTGRES_CAPABILITIES,
|
|
293
|
+
...vectorStrategy === void 0 ? {} : { vector: chunkXGU7DZDA_cjs.buildVectorCapabilities(vectorStrategy) },
|
|
294
|
+
fulltext: chunkXGU7DZDA_cjs.buildFulltextCapabilities(fulltextStrategy)
|
|
283
295
|
};
|
|
284
296
|
}
|
|
285
297
|
function createPostgresBackend(db, options = {}) {
|
|
286
|
-
const tables2 = options.tables ??
|
|
287
|
-
const fulltextStrategy = options.fulltext ??
|
|
288
|
-
const vectorStrategy = options.vector === false ? void 0 : options.vector ??
|
|
289
|
-
const vectorSlotLatch = vectorStrategy === void 0 ? void 0 : chunk456Z2U7Y_cjs.createVectorSlotLatch();
|
|
298
|
+
const tables2 = options.tables ?? chunkDIQ3AV5W_cjs.tables;
|
|
299
|
+
const fulltextStrategy = options.fulltext ?? chunkXGU7DZDA_cjs.tsvectorStrategy;
|
|
300
|
+
const vectorStrategy = options.vector === false ? void 0 : options.vector ?? chunk27SSDCEP_cjs.pgvectorStrategy;
|
|
290
301
|
const iterativeScanProbe = createIterativeScanProbe();
|
|
291
302
|
const baseCapabilities = buildPostgresCapabilities(
|
|
292
303
|
fulltextStrategy,
|
|
293
304
|
vectorStrategy
|
|
294
305
|
);
|
|
295
|
-
const httpOnlyOverrides = isNeonHttpClient(db) ? {
|
|
296
|
-
|
|
306
|
+
const httpOnlyOverrides = isNeonHttpClient(db) ? {
|
|
307
|
+
transactions: false,
|
|
308
|
+
graphAnalytics: {
|
|
309
|
+
...baseCapabilities.graphAnalytics ?? { mathFunctions: true },
|
|
310
|
+
supported: false
|
|
311
|
+
}
|
|
312
|
+
} : {};
|
|
313
|
+
const capabilities = chunkIPSVVTWT_cjs.normalizeGraphAnalyticsCapabilities({
|
|
297
314
|
...baseCapabilities,
|
|
298
315
|
...httpOnlyOverrides,
|
|
299
316
|
...options.capabilities
|
|
300
|
-
};
|
|
317
|
+
});
|
|
301
318
|
const adapterOptions = {
|
|
302
319
|
...options.prepareStatements === void 0 ? {} : { prepareStatements: options.prepareStatements },
|
|
303
320
|
...options.preparedStatementCacheMax === void 0 ? {} : { preparedStatementCacheMax: options.preparedStatementCacheMax }
|
|
@@ -318,29 +335,17 @@ function createPostgresBackend(db, options = {}) {
|
|
|
318
335
|
tableNames.edges,
|
|
319
336
|
drizzleOrm.getTableName(tables2.uniques),
|
|
320
337
|
tableNames.fulltext
|
|
321
|
-
].map((name) => drizzleOrm.sql`ANALYZE (SKIP_LOCKED) ${
|
|
338
|
+
].map((name) => drizzleOrm.sql`ANALYZE (SKIP_LOCKED) ${chunkVL2V6PEN_cjs.quoteIdentifier(name)}`);
|
|
322
339
|
const recordedAnalyzeTables = [
|
|
323
340
|
tableNames.recordedNodes,
|
|
324
341
|
tableNames.recordedEdges,
|
|
325
342
|
tableNames.recordedClock
|
|
326
343
|
];
|
|
327
|
-
const operationStrategy =
|
|
344
|
+
const operationStrategy = chunkDIQ3AV5W_cjs.createPostgresOperationStrategy(
|
|
328
345
|
tables2,
|
|
329
346
|
fulltextStrategy
|
|
330
347
|
);
|
|
331
|
-
const
|
|
332
|
-
db,
|
|
333
|
-
executionAdapter,
|
|
334
|
-
adapterOptions,
|
|
335
|
-
operationStrategy,
|
|
336
|
-
tableNames,
|
|
337
|
-
capabilities,
|
|
338
|
-
fulltextStrategy,
|
|
339
|
-
vectorStrategy,
|
|
340
|
-
vectorSlotLatch,
|
|
341
|
-
iterativeScanProbe
|
|
342
|
-
});
|
|
343
|
-
const recordedTableExists = chunk456Z2U7Y_cjs.createCachedTableExistence(
|
|
348
|
+
const recordedTableExists = chunkDIQ3AV5W_cjs.createCachedTableExistence(
|
|
344
349
|
async (tableName) => {
|
|
345
350
|
const rows = await executionAdapter.execute(
|
|
346
351
|
operationStrategy.buildTableExists(tableName)
|
|
@@ -349,39 +354,9 @@ function createPostgresBackend(db, options = {}) {
|
|
|
349
354
|
},
|
|
350
355
|
{ cacheExisting: false }
|
|
351
356
|
);
|
|
352
|
-
function runSchemaWriteTransaction(graphId, fn) {
|
|
353
|
-
if (!capabilities.transactions) {
|
|
354
|
-
throw new chunkDIK74MXX_cjs.ConfigurationError(
|
|
355
|
-
"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.",
|
|
356
|
-
{
|
|
357
|
-
backend: "postgres",
|
|
358
|
-
capability: "transactions",
|
|
359
|
-
supportsTransactions: false
|
|
360
|
-
}
|
|
361
|
-
);
|
|
362
|
-
}
|
|
363
|
-
return db.transaction(async (tx) => {
|
|
364
|
-
await tx.execute(drizzleOrm.sql`SELECT pg_advisory_xact_lock(hashtext(${graphId}))`);
|
|
365
|
-
const { backend: txBackend, drainAndClose } = createTransactionBackend({
|
|
366
|
-
db: tx,
|
|
367
|
-
adapterOptions,
|
|
368
|
-
operationStrategy,
|
|
369
|
-
tableNames,
|
|
370
|
-
capabilities,
|
|
371
|
-
fulltextStrategy,
|
|
372
|
-
vectorStrategy,
|
|
373
|
-
iterativeScanProbe
|
|
374
|
-
});
|
|
375
|
-
try {
|
|
376
|
-
return await fn(txBackend);
|
|
377
|
-
} finally {
|
|
378
|
-
await drainAndClose();
|
|
379
|
-
}
|
|
380
|
-
});
|
|
381
|
-
}
|
|
382
357
|
const matTable = tables2.contributionMaterializations;
|
|
383
358
|
async function ensureContributionMaterializationsTableImpl() {
|
|
384
|
-
await db.execute(drizzleOrm.sql.raw(
|
|
359
|
+
await db.execute(drizzleOrm.sql.raw(chunkDIQ3AV5W_cjs.generatePgCreateTableSQL(matTable)));
|
|
385
360
|
}
|
|
386
361
|
async function getContributionMaterializationRow(identity) {
|
|
387
362
|
const rows = await db.select().from(matTable).where(
|
|
@@ -394,16 +369,25 @@ function createPostgresBackend(db, options = {}) {
|
|
|
394
369
|
);
|
|
395
370
|
const row = rows[0];
|
|
396
371
|
if (row === void 0) return void 0;
|
|
397
|
-
return
|
|
372
|
+
return chunkDIQ3AV5W_cjs.mapContributionMaterializationRow(
|
|
398
373
|
row,
|
|
399
|
-
|
|
374
|
+
chunkDIQ3AV5W_cjs.POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS.decode
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
async function getContributionMaterializationRows(graphId) {
|
|
378
|
+
const rows = await db.select().from(matTable).where(drizzleOrm.eq(matTable.graphId, graphId));
|
|
379
|
+
return rows.map(
|
|
380
|
+
(row) => chunkDIQ3AV5W_cjs.mapContributionMaterializationRow(
|
|
381
|
+
row,
|
|
382
|
+
chunkDIQ3AV5W_cjs.POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS.decode
|
|
383
|
+
)
|
|
400
384
|
);
|
|
401
385
|
}
|
|
402
386
|
async function recordContributionMaterializationRow(params) {
|
|
403
387
|
await db.insert(matTable).values(
|
|
404
|
-
|
|
388
|
+
chunkDIQ3AV5W_cjs.buildContributionInsertValues(
|
|
405
389
|
params,
|
|
406
|
-
|
|
390
|
+
chunkDIQ3AV5W_cjs.POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS.encode
|
|
407
391
|
)
|
|
408
392
|
).onConflictDoUpdate({
|
|
409
393
|
target: [
|
|
@@ -412,23 +396,78 @@ function createPostgresBackend(db, options = {}) {
|
|
|
412
396
|
matTable.owner,
|
|
413
397
|
matTable.tableName
|
|
414
398
|
],
|
|
415
|
-
set:
|
|
399
|
+
set: chunkDIQ3AV5W_cjs.buildContributionOnConflictSet(
|
|
416
400
|
matTable.materializedAt,
|
|
417
401
|
params.materializedAt
|
|
418
402
|
)
|
|
419
403
|
});
|
|
420
404
|
}
|
|
421
|
-
|
|
405
|
+
async function deleteContributionMaterializationRow(identity) {
|
|
406
|
+
await db.delete(matTable).where(
|
|
407
|
+
drizzleOrm.and(
|
|
408
|
+
drizzleOrm.eq(matTable.graphId, identity.graphId),
|
|
409
|
+
drizzleOrm.eq(matTable.logicalName, identity.logicalName),
|
|
410
|
+
drizzleOrm.eq(matTable.owner, identity.owner),
|
|
411
|
+
drizzleOrm.eq(matTable.tableName, identity.tableName)
|
|
412
|
+
)
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
const contributionMaterializer = chunkDIQ3AV5W_cjs.createContributionMaterializer({
|
|
422
416
|
dialect: "postgres",
|
|
423
417
|
fulltextStrategy,
|
|
424
418
|
fulltextTableName: tables2.fulltextTableName,
|
|
419
|
+
vectorStrategy,
|
|
425
420
|
execDdl: async (statement) => {
|
|
426
421
|
await db.execute(drizzleOrm.sql.raw(statement));
|
|
427
422
|
},
|
|
428
423
|
ensureMarkerTable: ensureContributionMaterializationsTableImpl,
|
|
429
|
-
|
|
430
|
-
recordMarker: recordContributionMaterializationRow
|
|
424
|
+
getMarkers: getContributionMaterializationRows,
|
|
425
|
+
recordMarker: recordContributionMaterializationRow,
|
|
426
|
+
deleteMarker: deleteContributionMaterializationRow
|
|
431
427
|
});
|
|
428
|
+
const operations = createPostgresOperationBackend({
|
|
429
|
+
db,
|
|
430
|
+
executionAdapter,
|
|
431
|
+
adapterOptions,
|
|
432
|
+
operationStrategy,
|
|
433
|
+
tableNames,
|
|
434
|
+
capabilities,
|
|
435
|
+
fulltextStrategy,
|
|
436
|
+
vectorStrategy,
|
|
437
|
+
contributionMaterializer,
|
|
438
|
+
iterativeScanProbe
|
|
439
|
+
});
|
|
440
|
+
function runSchemaWriteTransaction(graphId, fn) {
|
|
441
|
+
if (!capabilities.transactions) {
|
|
442
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
443
|
+
"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.",
|
|
444
|
+
{
|
|
445
|
+
backend: "postgres",
|
|
446
|
+
capability: "transactions",
|
|
447
|
+
supportsTransactions: false
|
|
448
|
+
}
|
|
449
|
+
);
|
|
450
|
+
}
|
|
451
|
+
return db.transaction(async (tx) => {
|
|
452
|
+
await tx.execute(drizzleOrm.sql`SELECT pg_advisory_xact_lock(hashtext(${graphId}))`);
|
|
453
|
+
const { backend: txBackend, drainAndClose } = createTransactionBackend({
|
|
454
|
+
db: tx,
|
|
455
|
+
adapterOptions,
|
|
456
|
+
operationStrategy,
|
|
457
|
+
tableNames,
|
|
458
|
+
capabilities,
|
|
459
|
+
fulltextStrategy,
|
|
460
|
+
vectorStrategy,
|
|
461
|
+
contributionMaterializer,
|
|
462
|
+
iterativeScanProbe
|
|
463
|
+
});
|
|
464
|
+
try {
|
|
465
|
+
return await fn(txBackend);
|
|
466
|
+
} finally {
|
|
467
|
+
await drainAndClose();
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
}
|
|
432
471
|
function bindTransactionBackend(tx) {
|
|
433
472
|
const { backend: backend2, drainAndClose } = createTransactionBackend({
|
|
434
473
|
db: tx,
|
|
@@ -438,10 +477,11 @@ function createPostgresBackend(db, options = {}) {
|
|
|
438
477
|
capabilities,
|
|
439
478
|
fulltextStrategy,
|
|
440
479
|
vectorStrategy,
|
|
480
|
+
contributionMaterializer,
|
|
441
481
|
iterativeScanProbe
|
|
442
482
|
});
|
|
443
483
|
return {
|
|
444
|
-
backend:
|
|
484
|
+
backend: chunkDIQ3AV5W_cjs.gateFulltext(
|
|
445
485
|
backend2,
|
|
446
486
|
contributionMaterializer.assertInitialized
|
|
447
487
|
),
|
|
@@ -450,15 +490,49 @@ function createPostgresBackend(db, options = {}) {
|
|
|
450
490
|
}
|
|
451
491
|
const backend = {
|
|
452
492
|
...operations,
|
|
493
|
+
...capabilities.transactions && executionAdapter.executeCompiled !== void 0 ? {
|
|
494
|
+
async trustedImport(fn) {
|
|
495
|
+
return backend.transaction(async (tx, rawSql) => {
|
|
496
|
+
const trustedExecutionAdapter = createPostgresExecutionAdapter(
|
|
497
|
+
rawSql,
|
|
498
|
+
{ ...adapterOptions, useTransactionClient: true }
|
|
499
|
+
);
|
|
500
|
+
const executeCompiled = trustedExecutionAdapter.executeCompiled;
|
|
501
|
+
if (executeCompiled === void 0) {
|
|
502
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
503
|
+
"Trusted import could not bind raw execution to the PostgreSQL transaction.",
|
|
504
|
+
{ capability: "trustedImport", dialect: "postgres" }
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
const trustedTx = chunkIPSVVTWT_cjs.createBackendOverlay(tx, {
|
|
508
|
+
executeRaw(sqlText, params) {
|
|
509
|
+
return executeCompiled({ params, sql: sqlText });
|
|
510
|
+
}
|
|
511
|
+
});
|
|
512
|
+
await chunkDIQ3AV5W_cjs.lockPostgresTrustedImportTables(trustedTx, tableNames);
|
|
513
|
+
await chunkDIQ3AV5W_cjs.assertTrustedImportDatabaseEmpty(trustedTx, tableNames);
|
|
514
|
+
const indexDefinitions = await chunkDIQ3AV5W_cjs.suspendPostgresSecondaryIndexes(
|
|
515
|
+
trustedTx,
|
|
516
|
+
tableNames
|
|
517
|
+
);
|
|
518
|
+
const result = await fn(
|
|
519
|
+
chunkDIQ3AV5W_cjs.createPostgresTrustedImportSession(trustedTx, tableNames)
|
|
520
|
+
);
|
|
521
|
+
await chunkDIQ3AV5W_cjs.restoreSecondaryIndexes(trustedTx, indexDefinitions);
|
|
522
|
+
await chunkDIQ3AV5W_cjs.analyzeImportedTables(trustedTx, tableNames);
|
|
523
|
+
return result;
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
} : {},
|
|
453
527
|
async bootstrapTables() {
|
|
454
|
-
const statements =
|
|
528
|
+
const statements = chunkDIQ3AV5W_cjs.generatePostgresDDL(tables2, fulltextStrategy);
|
|
455
529
|
for (const statement of statements) {
|
|
456
530
|
await db.execute(drizzleOrm.sql.raw(statement));
|
|
457
531
|
}
|
|
458
532
|
},
|
|
459
533
|
async ensureRevisionOriginsTable() {
|
|
460
534
|
await db.execute(
|
|
461
|
-
drizzleOrm.sql.raw(
|
|
535
|
+
drizzleOrm.sql.raw(chunkDIQ3AV5W_cjs.generatePgCreateTableSQL(tables2.revisionOrigins))
|
|
462
536
|
);
|
|
463
537
|
},
|
|
464
538
|
// Every fulltext-touching method asserts the durable marker instead
|
|
@@ -466,7 +540,7 @@ function createPostgresBackend(db, options = {}) {
|
|
|
466
540
|
// uninitialized database throws `StoreNotInitializedError` loudly
|
|
467
541
|
// rather than self-healing on a read/write path (#135). Shared
|
|
468
542
|
// verbatim with the tx-scoped gate via `gateFulltextMethods`.
|
|
469
|
-
...
|
|
543
|
+
...chunkDIQ3AV5W_cjs.gateFulltextMethods(
|
|
470
544
|
operations,
|
|
471
545
|
contributionMaterializer.assertInitialized
|
|
472
546
|
),
|
|
@@ -475,7 +549,7 @@ function createPostgresBackend(db, options = {}) {
|
|
|
475
549
|
},
|
|
476
550
|
async ensureIndexMaterializationsTable() {
|
|
477
551
|
await db.execute(
|
|
478
|
-
drizzleOrm.sql.raw(
|
|
552
|
+
drizzleOrm.sql.raw(chunkDIQ3AV5W_cjs.generatePgCreateTableSQL(tables2.indexMaterializations))
|
|
479
553
|
);
|
|
480
554
|
const tableName = drizzleOrm.getTableName(tables2.indexMaterializations);
|
|
481
555
|
await db.execute(
|
|
@@ -527,29 +601,26 @@ function createPostgresBackend(db, options = {}) {
|
|
|
527
601
|
const rows = await db.select().from(t).where(drizzleOrm.eq(t.indexName, indexName));
|
|
528
602
|
const row = rows[0];
|
|
529
603
|
if (row === void 0) return void 0;
|
|
530
|
-
return
|
|
604
|
+
return chunkDIQ3AV5W_cjs.mapMaterializationRow(row, chunkDIQ3AV5W_cjs.POSTGRES_INDEX_MAT_TIMESTAMPS.decode);
|
|
531
605
|
},
|
|
532
606
|
async getIndexMaterializations(statusKeys) {
|
|
533
607
|
if (statusKeys.length === 0) return [];
|
|
534
608
|
const t = tables2.indexMaterializations;
|
|
535
609
|
const rows = await db.select().from(t).where(drizzleOrm.inArray(t.indexName, [...statusKeys]));
|
|
536
610
|
return rows.map(
|
|
537
|
-
(row) =>
|
|
611
|
+
(row) => chunkDIQ3AV5W_cjs.mapMaterializationRow(row, chunkDIQ3AV5W_cjs.POSTGRES_INDEX_MAT_TIMESTAMPS.decode)
|
|
538
612
|
);
|
|
539
613
|
},
|
|
540
614
|
async recordIndexMaterialization(params) {
|
|
541
615
|
const t = tables2.indexMaterializations;
|
|
542
616
|
await db.insert(t).values(
|
|
543
|
-
|
|
617
|
+
chunkDIQ3AV5W_cjs.buildMaterializationInsertValues(
|
|
544
618
|
params,
|
|
545
|
-
|
|
619
|
+
chunkDIQ3AV5W_cjs.POSTGRES_INDEX_MAT_TIMESTAMPS.encode
|
|
546
620
|
)
|
|
547
621
|
).onConflictDoUpdate({
|
|
548
622
|
target: t.indexName,
|
|
549
|
-
set:
|
|
550
|
-
t.materializedAt,
|
|
551
|
-
params.materializedAt
|
|
552
|
-
)
|
|
623
|
+
set: chunkDIQ3AV5W_cjs.buildMaterializationOnConflictSet(params.materializedAt)
|
|
553
624
|
});
|
|
554
625
|
},
|
|
555
626
|
async ensureContributionMaterializationsTable() {
|
|
@@ -565,37 +636,37 @@ function createPostgresBackend(db, options = {}) {
|
|
|
565
636
|
await contributionMaterializer.assertInitialized(graphId);
|
|
566
637
|
},
|
|
567
638
|
async ensureKindRemovalsTable() {
|
|
568
|
-
await db.execute(drizzleOrm.sql.raw(
|
|
639
|
+
await db.execute(drizzleOrm.sql.raw(chunkDIQ3AV5W_cjs.generatePgCreateTableSQL(tables2.kindRemovals)));
|
|
569
640
|
},
|
|
570
641
|
async getPendingKindRemovals(graphId) {
|
|
571
642
|
const t = tables2.kindRemovals;
|
|
572
643
|
const rows = await db.select().from(t).where(drizzleOrm.and(drizzleOrm.eq(t.graphId, graphId), drizzleOrm.isNull(t.removedAt)));
|
|
573
644
|
return rows.map(
|
|
574
|
-
(row) =>
|
|
645
|
+
(row) => chunkDIQ3AV5W_cjs.mapKindRemovalRow(row, chunkDIQ3AV5W_cjs.POSTGRES_KIND_REMOVAL_TIMESTAMPS.decode)
|
|
575
646
|
);
|
|
576
647
|
},
|
|
577
648
|
async getAllKindRemovals(graphId) {
|
|
578
649
|
const t = tables2.kindRemovals;
|
|
579
650
|
const rows = await db.select().from(t).where(drizzleOrm.eq(t.graphId, graphId));
|
|
580
651
|
return rows.map(
|
|
581
|
-
(row) =>
|
|
652
|
+
(row) => chunkDIQ3AV5W_cjs.mapKindRemovalRow(row, chunkDIQ3AV5W_cjs.POSTGRES_KIND_REMOVAL_TIMESTAMPS.decode)
|
|
582
653
|
);
|
|
583
654
|
},
|
|
584
655
|
async recordKindRemoval(params) {
|
|
585
656
|
const t = tables2.kindRemovals;
|
|
586
657
|
await db.insert(t).values(
|
|
587
|
-
|
|
658
|
+
chunkDIQ3AV5W_cjs.buildKindRemovalInsertValues(
|
|
588
659
|
params,
|
|
589
|
-
|
|
660
|
+
chunkDIQ3AV5W_cjs.POSTGRES_KIND_REMOVAL_TIMESTAMPS.encode
|
|
590
661
|
)
|
|
591
662
|
).onConflictDoUpdate({
|
|
592
663
|
target: [t.graphId, t.kindName, t.entity, t.schemaVersion],
|
|
593
|
-
set:
|
|
664
|
+
set: chunkDIQ3AV5W_cjs.buildKindRemovalOnConflictSet(t.removedAt, params.removedAt)
|
|
594
665
|
});
|
|
595
666
|
},
|
|
596
667
|
async ensureReconciliationMarkersTable() {
|
|
597
668
|
await db.execute(
|
|
598
|
-
drizzleOrm.sql.raw(
|
|
669
|
+
drizzleOrm.sql.raw(chunkDIQ3AV5W_cjs.generatePgCreateTableSQL(tables2.reconciliationMarkers))
|
|
599
670
|
);
|
|
600
671
|
},
|
|
601
672
|
async ensureRuntimeContributions(graphId) {
|
|
@@ -609,6 +680,27 @@ function createPostgresBackend(db, options = {}) {
|
|
|
609
680
|
async ensureFulltextTable(graphId) {
|
|
610
681
|
await contributionMaterializer.ensureRuntimeContributions(graphId);
|
|
611
682
|
},
|
|
683
|
+
// Vector counterparts of the runtime-contribution methods. Present
|
|
684
|
+
// only when a vector strategy is wired (omitted under `vector: false`,
|
|
685
|
+
// mirroring the embedding/search methods), so a no-vector backend
|
|
686
|
+
// doesn't advertise vector materialization it can't perform.
|
|
687
|
+
...vectorStrategy === void 0 ? {} : {
|
|
688
|
+
async ensureVectorSlotContribution(slot, options_) {
|
|
689
|
+
await contributionMaterializer.ensureVectorSlot(slot, options_);
|
|
690
|
+
},
|
|
691
|
+
async ensureVectorSlotContributions(slots, options_) {
|
|
692
|
+
await contributionMaterializer.ensureVectorSlots(slots, options_);
|
|
693
|
+
},
|
|
694
|
+
async assertVectorSlotInitialized(slot) {
|
|
695
|
+
await contributionMaterializer.assertVectorSlot(slot);
|
|
696
|
+
},
|
|
697
|
+
async assertVectorSlotsInitialized(slots) {
|
|
698
|
+
await contributionMaterializer.assertVectorSlots(slots);
|
|
699
|
+
},
|
|
700
|
+
async deleteVectorSlotContribution(slot) {
|
|
701
|
+
await contributionMaterializer.dropVectorSlot(slot);
|
|
702
|
+
}
|
|
703
|
+
},
|
|
612
704
|
async getReconciliationMarker(graphId) {
|
|
613
705
|
const t = tables2.reconciliationMarkers;
|
|
614
706
|
const rows = await db.select().from(t).where(drizzleOrm.eq(t.graphId, graphId));
|
|
@@ -634,7 +726,7 @@ function createPostgresBackend(db, options = {}) {
|
|
|
634
726
|
const presentRecordedTables = tablePresence.filter((entry) => entry.exists).map((entry) => entry.tableName);
|
|
635
727
|
for (const tableName of presentRecordedTables) {
|
|
636
728
|
await db.execute(
|
|
637
|
-
drizzleOrm.sql`ANALYZE (SKIP_LOCKED) ${
|
|
729
|
+
drizzleOrm.sql`ANALYZE (SKIP_LOCKED) ${chunkVL2V6PEN_cjs.quoteIdentifier(tableName)}`
|
|
638
730
|
);
|
|
639
731
|
}
|
|
640
732
|
},
|
|
@@ -651,8 +743,20 @@ function createPostgresBackend(db, options = {}) {
|
|
|
651
743
|
);
|
|
652
744
|
},
|
|
653
745
|
async transaction(fn, options2) {
|
|
654
|
-
const
|
|
655
|
-
|
|
746
|
+
const temporaryWrites = options2?.temporaryWrites === chunkIPSVVTWT_cjs.INTERNAL_TEMPORARY_WRITES;
|
|
747
|
+
if (temporaryWrites && options2.accessMode !== "read_only") {
|
|
748
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
749
|
+
"Temporary-write transactions must be semantically read-only.",
|
|
750
|
+
{ dialect: "postgres" }
|
|
751
|
+
);
|
|
752
|
+
}
|
|
753
|
+
const txConfig = options2?.isolationLevel !== void 0 || options2?.accessMode !== void 0 || temporaryWrites ? {
|
|
754
|
+
...options2.isolationLevel === void 0 ? {} : {
|
|
755
|
+
isolationLevel: options2.isolationLevel.replace("_", " ")
|
|
756
|
+
},
|
|
757
|
+
...options2.accessMode === void 0 && !temporaryWrites ? {} : {
|
|
758
|
+
accessMode: temporaryWrites ? "read write" : options2.accessMode.replace("_", " ")
|
|
759
|
+
}
|
|
656
760
|
} : void 0;
|
|
657
761
|
return db.transaction(async (tx) => {
|
|
658
762
|
const { backend: txBackend, drainAndClose } = bindTransactionBackend(tx);
|
|
@@ -665,7 +769,7 @@ function createPostgresBackend(db, options = {}) {
|
|
|
665
769
|
},
|
|
666
770
|
adoptTransaction(externalTx) {
|
|
667
771
|
if (!capabilities.transactions) {
|
|
668
|
-
throw new
|
|
772
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
669
773
|
"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.",
|
|
670
774
|
{
|
|
671
775
|
backend: "postgres",
|
|
@@ -674,7 +778,7 @@ function createPostgresBackend(db, options = {}) {
|
|
|
674
778
|
}
|
|
675
779
|
);
|
|
676
780
|
}
|
|
677
|
-
|
|
781
|
+
chunkDIQ3AV5W_cjs.assertAdoptedDialect(externalTx, pgCore.PgDatabase, "postgres");
|
|
678
782
|
return bindTransactionBackend(externalTx).backend;
|
|
679
783
|
},
|
|
680
784
|
async close() {
|
|
@@ -725,7 +829,7 @@ function createPostgresOperationBackend(options) {
|
|
|
725
829
|
capabilities,
|
|
726
830
|
fulltextStrategy,
|
|
727
831
|
vectorStrategy,
|
|
728
|
-
|
|
832
|
+
contributionMaterializer,
|
|
729
833
|
iterativeScanProbe
|
|
730
834
|
} = options;
|
|
731
835
|
async function execAll(query) {
|
|
@@ -778,7 +882,7 @@ function createPostgresOperationBackend(options) {
|
|
|
778
882
|
async function runVectorSearchGucGroup(overrides, query) {
|
|
779
883
|
const runExclusive = executionAdapter.runExclusive;
|
|
780
884
|
if (runExclusive === void 0) {
|
|
781
|
-
throw new
|
|
885
|
+
throw new chunkBVRDGYXQ_cjs.CompilerInvariantError(
|
|
782
886
|
"A transaction-scoped Postgres backend must expose runExclusive; its execution adapter was not wrapped by createSerialExecutionAdapter."
|
|
783
887
|
);
|
|
784
888
|
}
|
|
@@ -821,12 +925,6 @@ function createPostgresOperationBackend(options) {
|
|
|
821
925
|
return txAdapter.execute(query);
|
|
822
926
|
});
|
|
823
927
|
}
|
|
824
|
-
async function ensureVectorSlotStorage(slot) {
|
|
825
|
-
if (vectorStrategy === void 0 || vectorSlotLatch === void 0) return;
|
|
826
|
-
await vectorSlotLatch.ensure(vectorStrategy, slot, async (statement) => {
|
|
827
|
-
await execRun(drizzleOrm.sql.raw(statement));
|
|
828
|
-
});
|
|
829
|
-
}
|
|
830
928
|
const batchConfig = {
|
|
831
929
|
checkUniqueBatchChunkSize: POSTGRES_CHECK_UNIQUE_BATCH_CHUNK_SIZE,
|
|
832
930
|
edgeInsertBatchSize: POSTGRES_EDGE_INSERT_BATCH_SIZE,
|
|
@@ -836,7 +934,7 @@ function createPostgresOperationBackend(options) {
|
|
|
836
934
|
embeddingUpsertBatchSize: Math.max(
|
|
837
935
|
1,
|
|
838
936
|
Math.floor(
|
|
839
|
-
(capabilities.maxBindParameters ??
|
|
937
|
+
(capabilities.maxBindParameters ?? chunkIPSVVTWT_cjs.POSTGRES_MAX_BIND_PARAMETERS) / chunkDIQ3AV5W_cjs.EMBEDDING_UPSERT_PARAM_COUNT
|
|
840
938
|
)
|
|
841
939
|
),
|
|
842
940
|
getEdgesChunkSize: POSTGRES_GET_EDGES_ID_CHUNK_SIZE,
|
|
@@ -844,14 +942,14 @@ function createPostgresOperationBackend(options) {
|
|
|
844
942
|
nodeInsertBatchSize: POSTGRES_NODE_INSERT_BATCH_SIZE,
|
|
845
943
|
uniqueInsertBatchSize: POSTGRES_UNIQUE_INSERT_BATCH_SIZE
|
|
846
944
|
};
|
|
847
|
-
const commonBackend =
|
|
945
|
+
const commonBackend = chunkDIQ3AV5W_cjs.createCommonOperationBackend({
|
|
848
946
|
batchConfig,
|
|
849
947
|
execution: {
|
|
850
948
|
execAll,
|
|
851
949
|
execGet,
|
|
852
950
|
execRun
|
|
853
951
|
},
|
|
854
|
-
nowIso:
|
|
952
|
+
nowIso: chunkVL2V6PEN_cjs.nowIso,
|
|
855
953
|
operationStrategy,
|
|
856
954
|
rowMappers: {
|
|
857
955
|
toEdgeRow,
|
|
@@ -869,28 +967,28 @@ function createPostgresOperationBackend(options) {
|
|
|
869
967
|
};
|
|
870
968
|
const vectorEmbeddingMethods = vectorStrategy === void 0 ? {} : {
|
|
871
969
|
async upsertEmbedding(params) {
|
|
872
|
-
const slot =
|
|
873
|
-
await
|
|
874
|
-
const statements = vectorStrategy.buildUpsert(slot, params,
|
|
970
|
+
const slot = chunkDIQ3AV5W_cjs.vectorSlotFromParams(params);
|
|
971
|
+
await contributionMaterializer.assertVectorSlot(slot);
|
|
972
|
+
const statements = vectorStrategy.buildUpsert(slot, params, chunkVL2V6PEN_cjs.nowIso());
|
|
875
973
|
try {
|
|
876
974
|
for (const statement of statements) {
|
|
877
975
|
await execRun(statement);
|
|
878
976
|
}
|
|
879
977
|
} catch (error) {
|
|
880
|
-
throw
|
|
978
|
+
throw chunkDIQ3AV5W_cjs.mapVectorWriteError(error, params);
|
|
881
979
|
}
|
|
882
980
|
},
|
|
883
981
|
async upsertEmbeddingBatch(params) {
|
|
884
982
|
if (params.rows.length === 0) return;
|
|
885
|
-
const slot =
|
|
886
|
-
await
|
|
983
|
+
const slot = chunkDIQ3AV5W_cjs.vectorSlotFromParams(params);
|
|
984
|
+
await contributionMaterializer.assertVectorSlot(slot);
|
|
887
985
|
const rowsById = new Map(
|
|
888
986
|
params.rows.map((row) => [row.nodeId, row])
|
|
889
987
|
);
|
|
890
988
|
const rows = [...rowsById.values()];
|
|
891
|
-
const timestamp =
|
|
989
|
+
const timestamp = chunkVL2V6PEN_cjs.nowIso();
|
|
892
990
|
try {
|
|
893
|
-
for (const chunk2 of
|
|
991
|
+
for (const chunk2 of chunkIPSVVTWT_cjs.chunk(
|
|
894
992
|
rows,
|
|
895
993
|
batchConfig.embeddingUpsertBatchSize
|
|
896
994
|
)) {
|
|
@@ -919,22 +1017,21 @@ function createPostgresOperationBackend(options) {
|
|
|
919
1017
|
}
|
|
920
1018
|
}
|
|
921
1019
|
} catch (error) {
|
|
922
|
-
throw
|
|
1020
|
+
throw chunkDIQ3AV5W_cjs.mapVectorWriteError(error, params);
|
|
923
1021
|
}
|
|
924
1022
|
},
|
|
925
1023
|
async deleteEmbedding(params) {
|
|
926
|
-
const slot =
|
|
927
|
-
await
|
|
1024
|
+
const slot = chunkDIQ3AV5W_cjs.vectorSlotFromParams(params);
|
|
1025
|
+
await contributionMaterializer.assertVectorSlot(slot);
|
|
928
1026
|
const statements = vectorStrategy.buildDelete(slot, params);
|
|
929
1027
|
for (const statement of statements) {
|
|
930
1028
|
await execRun(statement);
|
|
931
1029
|
}
|
|
932
1030
|
},
|
|
933
1031
|
async vectorSearch(params) {
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
const slot =
|
|
937
|
-
await ensureVectorSlotStorage(slot);
|
|
1032
|
+
chunkXGU7DZDA_cjs.assertVectorSearchLimit(params.limit);
|
|
1033
|
+
chunk27SSDCEP_cjs.assertPgvectorEfSearch(params.efSearch);
|
|
1034
|
+
const slot = chunkDIQ3AV5W_cjs.vectorSlotFromParams(params);
|
|
938
1035
|
const query = vectorStrategy.buildSearch(
|
|
939
1036
|
slot,
|
|
940
1037
|
params,
|
|
@@ -950,7 +1047,7 @@ function createPostgresOperationBackend(options) {
|
|
|
950
1047
|
try {
|
|
951
1048
|
rows = await runVectorSearch(gucOverrides, query);
|
|
952
1049
|
} catch (error) {
|
|
953
|
-
throw
|
|
1050
|
+
throw chunkDIQ3AV5W_cjs.mapVectorWriteError(error, params);
|
|
954
1051
|
}
|
|
955
1052
|
return rows.map((row) => ({
|
|
956
1053
|
nodeId: row.node_id,
|
|
@@ -962,10 +1059,10 @@ function createPostgresOperationBackend(options) {
|
|
|
962
1059
|
// multi-statement fallback by simply not exposing the member.
|
|
963
1060
|
...capabilities.windowFunctions ? {
|
|
964
1061
|
async hybridSearch(params) {
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
const slot =
|
|
1062
|
+
chunkXGU7DZDA_cjs.assertVectorSearchLimit(params.limit);
|
|
1063
|
+
chunkXGU7DZDA_cjs.assertVectorSearchLimit(params.vector.k);
|
|
1064
|
+
chunk27SSDCEP_cjs.assertPgvectorEfSearch(params.vector.efSearch);
|
|
1065
|
+
const slot = chunkDIQ3AV5W_cjs.vectorSlotFromParams({
|
|
969
1066
|
graphId: params.graphId,
|
|
970
1067
|
nodeKind: params.nodeKind,
|
|
971
1068
|
fieldPath: params.vector.fieldPath,
|
|
@@ -973,7 +1070,6 @@ function createPostgresOperationBackend(options) {
|
|
|
973
1070
|
metric: params.vector.metric,
|
|
974
1071
|
indexType: params.vector.indexType
|
|
975
1072
|
});
|
|
976
|
-
await ensureVectorSlotStorage(slot);
|
|
977
1073
|
const candidates = params.candidates ?? operationStrategy.buildLiveNodeIds(
|
|
978
1074
|
params.graphId,
|
|
979
1075
|
params.nodeKind
|
|
@@ -992,7 +1088,7 @@ function createPostgresOperationBackend(options) {
|
|
|
992
1088
|
const vectorSql = vectorStrategy.buildSearch(
|
|
993
1089
|
slot,
|
|
994
1090
|
vectorParams,
|
|
995
|
-
|
|
1091
|
+
chunkDIQ3AV5W_cjs.hybridCandidatesRef()
|
|
996
1092
|
);
|
|
997
1093
|
const statement = operationStrategy.buildHybridSearch(
|
|
998
1094
|
{ ...params, candidates },
|
|
@@ -1010,9 +1106,9 @@ function createPostgresOperationBackend(options) {
|
|
|
1010
1106
|
statement
|
|
1011
1107
|
);
|
|
1012
1108
|
} catch (error) {
|
|
1013
|
-
throw
|
|
1109
|
+
throw chunkDIQ3AV5W_cjs.mapVectorWriteError(error, vectorParams);
|
|
1014
1110
|
}
|
|
1015
|
-
return raw.map((row) =>
|
|
1111
|
+
return raw.map((row) => chunkDIQ3AV5W_cjs.mapHybridSearchRow(row, toNodeRow));
|
|
1016
1112
|
}
|
|
1017
1113
|
} : {}
|
|
1018
1114
|
};
|
|
@@ -1028,8 +1124,8 @@ function createPostgresOperationBackend(options) {
|
|
|
1028
1124
|
// === Vector Index Operations ===
|
|
1029
1125
|
async createVectorIndex(params) {
|
|
1030
1126
|
if (vectorStrategy === void 0) return;
|
|
1031
|
-
const slot =
|
|
1032
|
-
await
|
|
1127
|
+
const slot = chunkDIQ3AV5W_cjs.vectorSlotFromCreateIndexParams(params);
|
|
1128
|
+
await contributionMaterializer.ensureVectorSlot(slot);
|
|
1033
1129
|
const indexStatement = vectorStrategy.buildCreateIndex?.(slot, {
|
|
1034
1130
|
concurrent: params.concurrent === true
|
|
1035
1131
|
});
|
|
@@ -1037,21 +1133,19 @@ function createPostgresOperationBackend(options) {
|
|
|
1037
1133
|
try {
|
|
1038
1134
|
await execRun(indexStatement);
|
|
1039
1135
|
} catch (error) {
|
|
1040
|
-
if (!
|
|
1136
|
+
if (!chunk3GH67G4Z_cjs.isInsufficientResourcesError(error)) throw error;
|
|
1041
1137
|
const dropStatement = vectorStrategy.buildDropIndex?.(slot);
|
|
1042
1138
|
if (dropStatement !== void 0) {
|
|
1043
1139
|
await execRun(dropStatement);
|
|
1044
1140
|
}
|
|
1045
|
-
const table =
|
|
1141
|
+
const table = chunkVL2V6PEN_cjs.quoteIdentifier(
|
|
1046
1142
|
vectorStrategy.tableName(
|
|
1047
1143
|
slot.graphId,
|
|
1048
1144
|
slot.nodeKind,
|
|
1049
1145
|
slot.fieldPath
|
|
1050
1146
|
)
|
|
1051
1147
|
);
|
|
1052
|
-
await execRun(
|
|
1053
|
-
drizzleOrm.sql`ALTER TABLE ${table} SET (parallel_workers = 0)`
|
|
1054
|
-
);
|
|
1148
|
+
await execRun(drizzleOrm.sql`ALTER TABLE ${table} SET (parallel_workers = 0)`);
|
|
1055
1149
|
try {
|
|
1056
1150
|
await execRun(indexStatement);
|
|
1057
1151
|
} finally {
|
|
@@ -1062,7 +1156,7 @@ function createPostgresOperationBackend(options) {
|
|
|
1062
1156
|
},
|
|
1063
1157
|
// === Fulltext Operations ===
|
|
1064
1158
|
async upsertFulltext(params) {
|
|
1065
|
-
const timestamp =
|
|
1159
|
+
const timestamp = chunkVL2V6PEN_cjs.nowIso();
|
|
1066
1160
|
const statements = operationStrategy.buildUpsertFulltext(
|
|
1067
1161
|
params,
|
|
1068
1162
|
timestamp
|
|
@@ -1079,8 +1173,8 @@ function createPostgresOperationBackend(options) {
|
|
|
1079
1173
|
},
|
|
1080
1174
|
async upsertFulltextBatch(params) {
|
|
1081
1175
|
if (params.rows.length === 0) return;
|
|
1082
|
-
const timestamp =
|
|
1083
|
-
for (const rows of
|
|
1176
|
+
const timestamp = chunkVL2V6PEN_cjs.nowIso();
|
|
1177
|
+
for (const rows of chunkIPSVVTWT_cjs.chunk(
|
|
1084
1178
|
params.rows,
|
|
1085
1179
|
POSTGRES_FULLTEXT_UPSERT_BATCH_SIZE
|
|
1086
1180
|
)) {
|
|
@@ -1095,7 +1189,7 @@ function createPostgresOperationBackend(options) {
|
|
|
1095
1189
|
},
|
|
1096
1190
|
async deleteFulltextBatch(params) {
|
|
1097
1191
|
if (params.nodeIds.length === 0) return;
|
|
1098
|
-
for (const nodeIds of
|
|
1192
|
+
for (const nodeIds of chunkIPSVVTWT_cjs.chunk(
|
|
1099
1193
|
params.nodeIds,
|
|
1100
1194
|
POSTGRES_FULLTEXT_DELETE_CHUNK_SIZE
|
|
1101
1195
|
)) {
|
|
@@ -1113,32 +1207,30 @@ function createPostgresOperationBackend(options) {
|
|
|
1113
1207
|
const rows = await execAll(query);
|
|
1114
1208
|
return rows.map((row, index) => ({
|
|
1115
1209
|
nodeId: row.node_id,
|
|
1116
|
-
score:
|
|
1210
|
+
score: chunkVL2V6PEN_cjs.coerceNumericScore(row.score),
|
|
1117
1211
|
rank: index + 1,
|
|
1118
1212
|
...row.snippet === null ? {} : { snippet: row.snippet }
|
|
1119
1213
|
}));
|
|
1120
1214
|
},
|
|
1121
1215
|
async dropVectorIndex(params) {
|
|
1122
1216
|
if (vectorStrategy === void 0) return;
|
|
1123
|
-
const slot =
|
|
1217
|
+
const slot = chunkDIQ3AV5W_cjs.vectorSlotFromDropIndexParams(params);
|
|
1124
1218
|
const dropStatement = vectorStrategy.buildDropIndex?.(slot);
|
|
1125
1219
|
if (dropStatement === void 0) return;
|
|
1126
1220
|
try {
|
|
1127
1221
|
await execRun(dropStatement);
|
|
1128
1222
|
} catch (error) {
|
|
1129
|
-
if (!
|
|
1223
|
+
if (!chunk3GH67G4Z_cjs.isMissingTableError(error)) throw error;
|
|
1130
1224
|
}
|
|
1131
1225
|
},
|
|
1132
1226
|
// === Query Execution ===
|
|
1133
1227
|
async execute(query) {
|
|
1134
|
-
const annTypes =
|
|
1228
|
+
const annTypes = chunkIPSVVTWT_cjs.annIndexScanTypes(query);
|
|
1135
1229
|
if (annTypes !== void 0 && vectorStrategy !== void 0) {
|
|
1136
1230
|
const overrides = [];
|
|
1137
1231
|
for (const indexType of annTypes) {
|
|
1138
1232
|
if (indexType !== "hnsw" && indexType !== "ivfflat") continue;
|
|
1139
|
-
overrides.push(
|
|
1140
|
-
...await vectorSearchGucOverrides({ indexType })
|
|
1141
|
-
);
|
|
1233
|
+
overrides.push(...await vectorSearchGucOverrides({ indexType }));
|
|
1142
1234
|
}
|
|
1143
1235
|
return runVectorSearch(overrides, query);
|
|
1144
1236
|
}
|
|
@@ -1163,14 +1255,14 @@ function createTransactionBackend(options) {
|
|
|
1163
1255
|
capabilities: options.capabilities,
|
|
1164
1256
|
fulltextStrategy: options.fulltextStrategy,
|
|
1165
1257
|
vectorStrategy: options.vectorStrategy,
|
|
1166
|
-
|
|
1167
|
-
// The probe is process-wide truth, so
|
|
1168
|
-
//
|
|
1258
|
+
contributionMaterializer: options.contributionMaterializer,
|
|
1259
|
+
// The probe is process-wide truth, so the outer instance's is reused
|
|
1260
|
+
// rather than a fresh one per transaction.
|
|
1169
1261
|
iterativeScanProbe: options.iterativeScanProbe
|
|
1170
1262
|
});
|
|
1171
1263
|
return { backend, drainAndClose: txExecutionAdapter.drainAndClose };
|
|
1172
1264
|
}
|
|
1173
1265
|
|
|
1174
1266
|
exports.createPostgresBackend = createPostgresBackend;
|
|
1175
|
-
//# sourceMappingURL=chunk-
|
|
1176
|
-
//# sourceMappingURL=chunk-
|
|
1267
|
+
//# sourceMappingURL=chunk-NXQFATMF.cjs.map
|
|
1268
|
+
//# sourceMappingURL=chunk-NXQFATMF.cjs.map
|