@nicia-ai/typegraph 0.33.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -0
- package/dist/backend/postgres/index.cjs +30 -26
- package/dist/backend/postgres/index.d.cts +39 -7
- package/dist/backend/postgres/index.d.ts +39 -7
- package/dist/backend/postgres/index.js +17 -13
- package/dist/backend/postgres/pglite.cjs +22 -18
- package/dist/backend/postgres/pglite.cjs.map +1 -1
- package/dist/backend/postgres/pglite.d.cts +4 -4
- package/dist/backend/postgres/pglite.d.ts +4 -4
- package/dist/backend/postgres/pglite.js +17 -13
- package/dist/backend/postgres/pglite.js.map +1 -1
- package/dist/backend/sqlite/index.cjs +26 -23
- package/dist/backend/sqlite/index.d.cts +8 -8
- package/dist/backend/sqlite/index.d.ts +8 -8
- package/dist/backend/sqlite/index.js +14 -11
- package/dist/backend/sqlite/libsql.cjs +21 -17
- package/dist/backend/sqlite/libsql.cjs.map +1 -1
- package/dist/backend/sqlite/libsql.d.cts +13 -6
- package/dist/backend/sqlite/libsql.d.ts +13 -6
- package/dist/backend/sqlite/libsql.js +17 -13
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +102 -18
- package/dist/backend/sqlite/local.cjs.map +1 -1
- package/dist/backend/sqlite/local.d.cts +95 -5
- package/dist/backend/sqlite/local.d.ts +95 -5
- package/dist/backend/sqlite/local.js +96 -13
- package/dist/backend/sqlite/local.js.map +1 -1
- package/dist/{chunk-JHOBXD7O.js → chunk-3TWF3SH4.js} +332 -64
- package/dist/chunk-3TWF3SH4.js.map +1 -0
- package/dist/chunk-4JEZZJ6S.cjs +1271 -0
- package/dist/chunk-4JEZZJ6S.cjs.map +1 -0
- package/dist/{chunk-I4W7MKVG.cjs → chunk-4TOD4LBZ.cjs} +249 -294
- package/dist/chunk-4TOD4LBZ.cjs.map +1 -0
- package/dist/chunk-55MZDDZV.js +239 -0
- package/dist/chunk-55MZDDZV.js.map +1 -0
- package/dist/{chunk-LM2IC4ZJ.cjs → chunk-5A6FNS6N.cjs} +75 -19
- package/dist/chunk-5A6FNS6N.cjs.map +1 -0
- package/dist/{chunk-FDN43KXV.cjs → chunk-5AQIKK56.cjs} +65 -24
- package/dist/chunk-5AQIKK56.cjs.map +1 -0
- package/dist/{chunk-IZ4PCL47.js → chunk-5SEGFTZX.js} +4 -66
- package/dist/chunk-5SEGFTZX.js.map +1 -0
- package/dist/{chunk-CWFPJ3RC.js → chunk-6FR2MMS6.js} +7 -7
- package/dist/chunk-6FR2MMS6.js.map +1 -0
- package/dist/chunk-7YSP4V4R.cjs +69 -0
- package/dist/chunk-7YSP4V4R.cjs.map +1 -0
- package/dist/chunk-A42GCBGX.cjs +28 -0
- package/dist/chunk-A42GCBGX.cjs.map +1 -0
- package/dist/chunk-ACSVZPK7.cjs +21 -0
- package/dist/chunk-ACSVZPK7.cjs.map +1 -0
- package/dist/{chunk-OIE2UPVG.cjs → chunk-BLZDPRXT.cjs} +52 -21
- package/dist/chunk-BLZDPRXT.cjs.map +1 -0
- package/dist/chunk-BYPOGQWK.js +25 -0
- package/dist/chunk-BYPOGQWK.js.map +1 -0
- package/dist/{chunk-NG5N7R45.cjs → chunk-CK5BVQOW.cjs} +325 -213
- package/dist/chunk-CK5BVQOW.cjs.map +1 -0
- package/dist/chunk-CTTSDJLY.cjs +261 -0
- package/dist/chunk-CTTSDJLY.cjs.map +1 -0
- package/dist/chunk-CUHM5CWJ.cjs +12 -0
- package/dist/chunk-CUHM5CWJ.cjs.map +1 -0
- package/dist/chunk-CZQ3FO2Q.js +2320 -0
- package/dist/chunk-CZQ3FO2Q.js.map +1 -0
- package/dist/{chunk-CFNT3ITG.cjs → chunk-D7ZEOS56.cjs} +25 -52
- package/dist/chunk-D7ZEOS56.cjs.map +1 -0
- package/dist/chunk-DFVLCOP6.js +10 -0
- package/dist/chunk-DFVLCOP6.js.map +1 -0
- package/dist/chunk-DI74SMXS.cjs +29 -0
- package/dist/chunk-DI74SMXS.cjs.map +1 -0
- package/dist/{chunk-KY5SDVA7.cjs → chunk-EM3CWPND.cjs} +442 -113
- package/dist/chunk-EM3CWPND.cjs.map +1 -0
- package/dist/chunk-EMF62TZG.cjs +1176 -0
- package/dist/chunk-EMF62TZG.cjs.map +1 -0
- package/dist/chunk-EOLERH7Y.cjs +40 -0
- package/dist/chunk-EOLERH7Y.cjs.map +1 -0
- package/dist/{chunk-3QRBXYT5.cjs → chunk-FACJJWGF.cjs} +24 -6
- package/dist/chunk-FACJJWGF.cjs.map +1 -0
- package/dist/{chunk-KTIEB7VH.cjs → chunk-FL472AMI.cjs} +49 -165
- package/dist/chunk-FL472AMI.cjs.map +1 -0
- package/dist/{chunk-4RBAJVEC.cjs → chunk-FN35DLCN.cjs} +31 -9
- package/dist/chunk-FN35DLCN.cjs.map +1 -0
- package/dist/{chunk-C4C4Q7A6.js → chunk-FPIZFYHE.js} +12 -35
- package/dist/chunk-FPIZFYHE.js.map +1 -0
- package/dist/{chunk-XKNAK27R.js → chunk-FRV5Q5IO.js} +64 -8
- package/dist/chunk-FRV5Q5IO.js.map +1 -0
- package/dist/{chunk-K5P5OZXS.js → chunk-G6Q5UM7U.js} +2 -2
- package/dist/{chunk-K5P5OZXS.js.map → chunk-G6Q5UM7U.js.map} +1 -1
- package/dist/chunk-GSQ6NPH6.cjs +100 -0
- package/dist/chunk-GSQ6NPH6.cjs.map +1 -0
- package/dist/chunk-GUR2FNB5.cjs +12 -0
- package/dist/{chunk-6ZR4QC3O.cjs.map → chunk-GUR2FNB5.cjs.map} +1 -1
- package/dist/{chunk-ZFWNO3GE.cjs → chunk-H7YNSMA7.cjs} +107 -2
- package/dist/chunk-H7YNSMA7.cjs.map +1 -0
- package/dist/{chunk-GYVBEZAO.js → chunk-I7ZUZKFD.js} +47 -19
- package/dist/chunk-I7ZUZKFD.js.map +1 -0
- package/dist/chunk-ITE4IXAK.js +25 -0
- package/dist/chunk-ITE4IXAK.js.map +1 -0
- package/dist/{chunk-D3EWZ67S.cjs → chunk-J7WFGBJR.cjs} +3372 -4970
- package/dist/chunk-J7WFGBJR.cjs.map +1 -0
- package/dist/{chunk-PYD3UCDU.js → chunk-JBTOYDMN.js} +202 -251
- package/dist/chunk-JBTOYDMN.js.map +1 -0
- package/dist/{chunk-XVUJY72M.js → chunk-K3PPLHY7.js} +234 -118
- package/dist/chunk-K3PPLHY7.js.map +1 -0
- package/dist/{chunk-454I6GDF.js → chunk-KBGQIPRQ.js} +102 -3
- package/dist/chunk-KBGQIPRQ.js.map +1 -0
- package/dist/chunk-KMI7LYAF.js +1252 -0
- package/dist/chunk-KMI7LYAF.js.map +1 -0
- package/dist/{chunk-JIEJCTDS.cjs → chunk-LGEALRC6.cjs} +21 -4
- package/dist/chunk-LGEALRC6.cjs.map +1 -0
- package/dist/{chunk-TQOYM4LN.js → chunk-MP2JQKSG.js} +21 -5
- package/dist/chunk-MP2JQKSG.js.map +1 -0
- package/dist/{chunk-3642VBVC.cjs → chunk-O7UN7OXA.cjs} +389 -121
- package/dist/chunk-O7UN7OXA.cjs.map +1 -0
- package/dist/chunk-OHMP6N2J.js +47 -0
- package/dist/chunk-OHMP6N2J.js.map +1 -0
- package/dist/{chunk-6NRFUHMS.js → chunk-OR5ZA5WP.js} +135 -24
- package/dist/chunk-OR5ZA5WP.js.map +1 -0
- package/dist/{chunk-PRMKPFN5.js → chunk-Q5TEXCTB.js} +61 -6
- package/dist/chunk-Q5TEXCTB.js.map +1 -0
- package/dist/chunk-QNKSQTKQ.js +1312 -0
- package/dist/chunk-QNKSQTKQ.js.map +1 -0
- package/dist/{chunk-YCV72E6L.js → chunk-QOTI55H7.js} +7 -116
- package/dist/chunk-QOTI55H7.js.map +1 -0
- package/dist/{chunk-QBYTJSAY.js → chunk-QWEUYILR.js} +99 -34
- package/dist/chunk-QWEUYILR.js.map +1 -0
- package/dist/{chunk-OS6KS3HV.js → chunk-RGP33ZJ5.js} +485 -82
- package/dist/chunk-RGP33ZJ5.js.map +1 -0
- package/dist/chunk-RGPG7EOJ.js +94 -0
- package/dist/chunk-RGPG7EOJ.js.map +1 -0
- package/dist/{chunk-WWVV44DY.cjs → chunk-S55OV6PW.cjs} +15 -15
- package/dist/chunk-S55OV6PW.cjs.map +1 -0
- package/dist/{chunk-3E7SNSIA.cjs → chunk-SJDMVITW.cjs} +4 -4
- package/dist/{chunk-3E7SNSIA.cjs.map → chunk-SJDMVITW.cjs.map} +1 -1
- package/dist/{chunk-XLUNB2TZ.js → chunk-SNXVDZAJ.js} +3 -3
- package/dist/{chunk-XLUNB2TZ.js.map → chunk-SNXVDZAJ.js.map} +1 -1
- package/dist/{chunk-CEF2QOTO.js → chunk-T2WUSPDA.js} +49 -8
- package/dist/chunk-T2WUSPDA.js.map +1 -0
- package/dist/{chunk-YW7GHMF4.cjs → chunk-TCOCYN2P.cjs} +75 -20
- package/dist/chunk-TCOCYN2P.cjs.map +1 -0
- package/dist/{chunk-FLRCVI2G.cjs → chunk-TDXIBCGY.cjs} +2 -2
- package/dist/{chunk-FLRCVI2G.cjs.map → chunk-TDXIBCGY.cjs.map} +1 -1
- package/dist/chunk-TEDRJXOG.cjs +32 -0
- package/dist/chunk-TEDRJXOG.cjs.map +1 -0
- package/dist/{chunk-WLP6TKFB.js → chunk-UES55P7G.js} +2809 -4398
- package/dist/chunk-UES55P7G.js.map +1 -0
- package/dist/{chunk-EF3Z645U.cjs → chunk-UMDVATGY.cjs} +6 -72
- package/dist/chunk-UMDVATGY.cjs.map +1 -0
- package/dist/chunk-UR7W5YQK.js +18 -0
- package/dist/chunk-UR7W5YQK.js.map +1 -0
- package/dist/chunk-UT3S4SEN.js +31 -0
- package/dist/chunk-UT3S4SEN.js.map +1 -0
- package/dist/{chunk-3IR2GEMJ.cjs → chunk-UUT7UN2N.cjs} +149 -38
- package/dist/chunk-UUT7UN2N.cjs.map +1 -0
- package/dist/{chunk-PIHXFF73.js → chunk-UZV3AZKF.js} +21 -3
- package/dist/chunk-UZV3AZKF.js.map +1 -0
- package/dist/{chunk-DJYRRDHA.js → chunk-VHMPG6UL.js} +29 -7
- package/dist/chunk-VHMPG6UL.js.map +1 -0
- package/dist/{chunk-MBLXCV2Y.cjs → chunk-VPYHY3LJ.cjs} +111 -43
- package/dist/chunk-VPYHY3LJ.cjs.map +1 -0
- package/dist/{chunk-WYTUF3QO.js → chunk-VSPCZAXF.js} +3 -3
- package/dist/{chunk-WYTUF3QO.js.map → chunk-VSPCZAXF.js.map} +1 -1
- package/dist/chunk-W63OVYY4.js +29 -0
- package/dist/chunk-W63OVYY4.js.map +1 -0
- package/dist/{chunk-UPDMJEW6.js → chunk-WDBCBWC4.js} +356 -30
- package/dist/chunk-WDBCBWC4.js.map +1 -0
- package/dist/chunk-WJT7OU7E.cjs +1334 -0
- package/dist/chunk-WJT7OU7E.cjs.map +1 -0
- package/dist/chunk-XOX22WHL.cjs +2383 -0
- package/dist/chunk-XOX22WHL.cjs.map +1 -0
- package/dist/{ddl-CVnHJcar.d.ts → ddl-C2rZ-Aen.d.ts} +4 -4
- package/dist/{ddl-Dxt_fBHr.d.cts → ddl-CZz7a0E8.d.cts} +4 -4
- package/dist/{extension-types-YGFJPrzK.d.cts → extension-types-ixRpJVUp.d.cts} +24 -1
- package/dist/{extension-types-YGFJPrzK.d.ts → extension-types-ixRpJVUp.d.ts} +24 -1
- package/dist/{types-DGylBhWo.d.ts → fulltext-strategy-B57yvC5Q.d.ts} +2558 -2125
- package/dist/{types-C_UnQOQp.d.cts → fulltext-strategy-CDkSSYhq.d.cts} +2558 -2125
- package/dist/graph-extension/index.cjs +21 -19
- package/dist/graph-extension/index.d.cts +4 -4
- package/dist/graph-extension/index.d.ts +4 -4
- package/dist/graph-extension/index.js +6 -4
- package/dist/graph-merge/index.cjs +408 -169
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +63 -33
- package/dist/graph-merge/index.d.ts +63 -33
- package/dist/graph-merge/index.js +286 -47
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-DGX6D9j1.d.ts → index-6CSUAq-x.d.ts} +234 -93
- package/dist/{index-SEvUHDA6.d.cts → index-Bks_3HHK.d.cts} +234 -93
- package/dist/index.cjs +240 -211
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -11
- package/dist/index.d.ts +11 -11
- package/dist/index.js +35 -27
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +28 -27
- package/dist/indexes/index.d.cts +5 -5
- package/dist/indexes/index.d.ts +5 -5
- package/dist/indexes/index.js +10 -9
- package/dist/interchange/index.cjs +47 -17
- package/dist/interchange/index.d.cts +126 -12
- package/dist/interchange/index.d.ts +126 -12
- package/dist/interchange/index.js +14 -4
- package/dist/{manager-BYl_zyZR.d.cts → manager-DwQi8eV0.d.cts} +9 -2
- package/dist/{manager-C0_r0ALf.d.ts → manager-ejUCB52T.d.ts} +9 -2
- package/dist/{materialize-indexes-D20xNluI.d.cts → materialize-indexes-B4e9360H.d.cts} +20 -4
- package/dist/{materialize-indexes-CAkIYFV-.d.ts → materialize-indexes-te9TPMMJ.d.ts} +20 -4
- package/dist/{postgres-_9psmVGm.d.cts → postgres-CfEqsRMp.d.cts} +152 -1
- package/dist/{postgres-MzBPkYzq.d.ts → postgres-DQ5R6rzV.d.ts} +152 -1
- package/dist/profiler/index.cjs +11 -11
- package/dist/profiler/index.d.cts +7 -7
- package/dist/profiler/index.d.ts +7 -7
- package/dist/profiler/index.js +4 -4
- package/dist/provenance/index.cjs +590 -0
- package/dist/provenance/index.cjs.map +1 -0
- package/dist/provenance/index.d.cts +73 -0
- package/dist/provenance/index.d.ts +73 -0
- package/dist/provenance/index.js +588 -0
- package/dist/provenance/index.js.map +1 -0
- package/dist/schema/index.cjs +55 -38
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.cts +57 -57
- package/dist/schema/index.d.ts +57 -57
- package/dist/schema/index.js +30 -13
- package/dist/schema/index.js.map +1 -1
- package/dist/{sqlite-gm44dShb.d.ts → sqlite-D7zBinNR.d.cts} +92 -1
- package/dist/{sqlite-BfksSb45.d.cts → sqlite-DvQndLky.d.ts} +92 -1
- package/dist/{store-view-FfE5_7eo.d.ts → store-view-BSpqvAxK.d.cts} +445 -46
- package/dist/{store-view-9jQ2rPum.d.cts → store-view-CKbHFRnn.d.ts} +445 -46
- package/dist/{types-B6mhrcLv.d.cts → types-Bv9DcS_E.d.cts} +2 -2
- package/dist/{types-CdWxK-nD.d.ts → types-CoxuV7EJ.d.ts} +2 -2
- package/dist/{where-Bpp2ul_z.d.cts → where-7RKFOsXt.d.ts} +2 -2
- package/dist/{where-BsEXraKW.d.ts → where-DdMIXOtH.d.cts} +2 -2
- package/package.json +21 -14
- package/dist/chunk-2YMGNYXY.js +0 -40
- package/dist/chunk-2YMGNYXY.js.map +0 -1
- package/dist/chunk-3642VBVC.cjs.map +0 -1
- package/dist/chunk-3EUKJEQ3.js +0 -77
- package/dist/chunk-3EUKJEQ3.js.map +0 -1
- package/dist/chunk-3IR2GEMJ.cjs.map +0 -1
- package/dist/chunk-3QRBXYT5.cjs.map +0 -1
- package/dist/chunk-454I6GDF.js.map +0 -1
- package/dist/chunk-4RBAJVEC.cjs.map +0 -1
- package/dist/chunk-6NRFUHMS.js.map +0 -1
- package/dist/chunk-6ZR4QC3O.cjs +0 -12
- package/dist/chunk-73KASJGO.cjs +0 -52
- package/dist/chunk-73KASJGO.cjs.map +0 -1
- package/dist/chunk-BF3ZDEUE.cjs +0 -773
- package/dist/chunk-BF3ZDEUE.cjs.map +0 -1
- package/dist/chunk-C4C4Q7A6.js.map +0 -1
- package/dist/chunk-CEF2QOTO.js.map +0 -1
- package/dist/chunk-CFNT3ITG.cjs.map +0 -1
- package/dist/chunk-CWFPJ3RC.js.map +0 -1
- package/dist/chunk-D3EWZ67S.cjs.map +0 -1
- package/dist/chunk-DJYRRDHA.js.map +0 -1
- package/dist/chunk-EF3Z645U.cjs.map +0 -1
- package/dist/chunk-FDN43KXV.cjs.map +0 -1
- package/dist/chunk-GYVBEZAO.js.map +0 -1
- package/dist/chunk-HTGDWIDE.cjs +0 -89
- package/dist/chunk-HTGDWIDE.cjs.map +0 -1
- package/dist/chunk-I4W7MKVG.cjs.map +0 -1
- package/dist/chunk-IZ4PCL47.js.map +0 -1
- package/dist/chunk-JHOBXD7O.js.map +0 -1
- package/dist/chunk-JIEJCTDS.cjs.map +0 -1
- package/dist/chunk-KTIEB7VH.cjs.map +0 -1
- package/dist/chunk-KY5SDVA7.cjs.map +0 -1
- package/dist/chunk-LM2IC4ZJ.cjs.map +0 -1
- package/dist/chunk-MBLXCV2Y.cjs.map +0 -1
- package/dist/chunk-NG5N7R45.cjs.map +0 -1
- package/dist/chunk-OIE2UPVG.cjs.map +0 -1
- package/dist/chunk-OS6KS3HV.js.map +0 -1
- package/dist/chunk-PIHXFF73.js.map +0 -1
- package/dist/chunk-PRMKPFN5.js.map +0 -1
- package/dist/chunk-PYD3UCDU.js.map +0 -1
- package/dist/chunk-QBYTJSAY.js.map +0 -1
- package/dist/chunk-SPT5JMME.js +0 -610
- package/dist/chunk-SPT5JMME.js.map +0 -1
- package/dist/chunk-SST7XDY6.cjs +0 -624
- package/dist/chunk-SST7XDY6.cjs.map +0 -1
- package/dist/chunk-TQOYM4LN.js.map +0 -1
- package/dist/chunk-UPDMJEW6.js.map +0 -1
- package/dist/chunk-WLP6TKFB.js.map +0 -1
- package/dist/chunk-WWVV44DY.cjs.map +0 -1
- package/dist/chunk-XKNAK27R.js.map +0 -1
- package/dist/chunk-XVUJY72M.js.map +0 -1
- package/dist/chunk-YCV72E6L.js.map +0 -1
- package/dist/chunk-YW7GHMF4.cjs.map +0 -1
- package/dist/chunk-ZFWNO3GE.cjs.map +0 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
3
|
+
var chunkEM3CWPND_cjs = require('./chunk-EM3CWPND.cjs');
|
|
4
|
+
var chunkFN35DLCN_cjs = require('./chunk-FN35DLCN.cjs');
|
|
5
|
+
var chunkCTTSDJLY_cjs = require('./chunk-CTTSDJLY.cjs');
|
|
6
|
+
var chunkD7ZEOS56_cjs = require('./chunk-D7ZEOS56.cjs');
|
|
7
|
+
var chunk4TOD4LBZ_cjs = require('./chunk-4TOD4LBZ.cjs');
|
|
8
|
+
var chunkBLZDPRXT_cjs = require('./chunk-BLZDPRXT.cjs');
|
|
9
|
+
var chunkLGEALRC6_cjs = require('./chunk-LGEALRC6.cjs');
|
|
9
10
|
var drizzleOrm = require('drizzle-orm');
|
|
10
11
|
var sqliteCore = require('drizzle-orm/sqlite-core');
|
|
11
12
|
|
|
@@ -63,6 +64,44 @@ function detectTransactionMode(db, profileHints, isSync) {
|
|
|
63
64
|
if (isSync) return "sql";
|
|
64
65
|
return "drizzle";
|
|
65
66
|
}
|
|
67
|
+
var MAX_VARIABLE_NUMBER_COMPILE_OPTION = /^MAX_VARIABLE_NUMBER=(\d+)$/;
|
|
68
|
+
var FIRST_MODERN_BIND_LIMIT_MAJOR = 3;
|
|
69
|
+
var FIRST_MODERN_BIND_LIMIT_MINOR = 32;
|
|
70
|
+
function parseCompiledMaxVariableNumber(rows) {
|
|
71
|
+
for (const row of rows) {
|
|
72
|
+
if (typeof row !== "object" || row === null) continue;
|
|
73
|
+
const option = row.compile_options;
|
|
74
|
+
if (typeof option !== "string") continue;
|
|
75
|
+
const match = MAX_VARIABLE_NUMBER_COMPILE_OPTION.exec(option);
|
|
76
|
+
if (match !== null) return Number(match[1]);
|
|
77
|
+
}
|
|
78
|
+
return void 0;
|
|
79
|
+
}
|
|
80
|
+
function hasModernBindLimitByVersion(rows) {
|
|
81
|
+
const first = rows[0];
|
|
82
|
+
if (typeof first !== "object" || first === null) return false;
|
|
83
|
+
const version = first.version;
|
|
84
|
+
if (typeof version !== "string") return false;
|
|
85
|
+
const [major = 0, minor = 0] = version.split(".").map(Number);
|
|
86
|
+
if (!Number.isFinite(major) || !Number.isFinite(minor)) return false;
|
|
87
|
+
return major > FIRST_MODERN_BIND_LIMIT_MAJOR || major === FIRST_MODERN_BIND_LIMIT_MAJOR && minor >= FIRST_MODERN_BIND_LIMIT_MINOR;
|
|
88
|
+
}
|
|
89
|
+
function detectMaxBindParameters(db, sqliteClient) {
|
|
90
|
+
if (isD1DatabaseBySessionName(db)) return chunk4TOD4LBZ_cjs.D1_MAX_BIND_PARAMETERS;
|
|
91
|
+
if (sqliteClient === void 0) return chunk4TOD4LBZ_cjs.SQLITE_MAX_BIND_PARAMETERS;
|
|
92
|
+
try {
|
|
93
|
+
const compiled = parseCompiledMaxVariableNumber(
|
|
94
|
+
sqliteClient.prepare("PRAGMA compile_options").all()
|
|
95
|
+
);
|
|
96
|
+
if (compiled !== void 0) return compiled;
|
|
97
|
+
const isModern = hasModernBindLimitByVersion(
|
|
98
|
+
sqliteClient.prepare("SELECT sqlite_version() AS version").all()
|
|
99
|
+
);
|
|
100
|
+
return isModern ? chunk4TOD4LBZ_cjs.MODERN_SQLITE_MAX_BIND_PARAMETERS : chunk4TOD4LBZ_cjs.SQLITE_MAX_BIND_PARAMETERS;
|
|
101
|
+
} catch {
|
|
102
|
+
return chunk4TOD4LBZ_cjs.SQLITE_MAX_BIND_PARAMETERS;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
66
105
|
function resolveSqliteClient(db) {
|
|
67
106
|
const databaseWithClient = db;
|
|
68
107
|
const sqliteClient = databaseWithClient.$client;
|
|
@@ -72,7 +111,7 @@ function resolveSqliteClient(db) {
|
|
|
72
111
|
return sqliteClient;
|
|
73
112
|
}
|
|
74
113
|
function getOrCreatePreparedStatement(cache, sqliteClient, sqlText, cacheMax) {
|
|
75
|
-
return
|
|
114
|
+
return chunkEM3CWPND_cjs.getOrCreateLru(
|
|
76
115
|
cache,
|
|
77
116
|
sqlText,
|
|
78
117
|
cacheMax,
|
|
@@ -105,10 +144,11 @@ function createSqliteExecutionAdapter(db, statementCacheMaxOrOptions = {}) {
|
|
|
105
144
|
const transactionMode = detectTransactionMode(db, profileHints, isSync);
|
|
106
145
|
const profile = {
|
|
107
146
|
isSync,
|
|
147
|
+
maxBindParameters: detectMaxBindParameters(db, sqliteClient),
|
|
108
148
|
supportsCompiledExecution: sqliteClient !== void 0,
|
|
109
149
|
transactionMode
|
|
110
150
|
};
|
|
111
|
-
const compile = (query) =>
|
|
151
|
+
const compile = (query) => chunkEM3CWPND_cjs.compileQueryWithDialect(db, query, "SQLite");
|
|
112
152
|
if (sqliteClient !== void 0) {
|
|
113
153
|
let executeCompiled2 = function(compiledQuery) {
|
|
114
154
|
const preparedStatement = getOrCreatePreparedStatement(
|
|
@@ -119,6 +159,19 @@ function createSqliteExecutionAdapter(db, statementCacheMaxOrOptions = {}) {
|
|
|
119
159
|
);
|
|
120
160
|
const rows = preparedStatement.all(...compiledQuery.params);
|
|
121
161
|
return Promise.resolve(rows);
|
|
162
|
+
}, executeCompiledRun2 = function(compiledQuery) {
|
|
163
|
+
const preparedStatement = getOrCreatePreparedStatement(
|
|
164
|
+
statementCache,
|
|
165
|
+
client,
|
|
166
|
+
compiledQuery.sql,
|
|
167
|
+
statementCacheMax
|
|
168
|
+
);
|
|
169
|
+
if (preparedStatement.run === void 0 || preparedStatement.reader === true) {
|
|
170
|
+
preparedStatement.all(...compiledQuery.params);
|
|
171
|
+
} else {
|
|
172
|
+
preparedStatement.run(...compiledQuery.params);
|
|
173
|
+
}
|
|
174
|
+
return Promise.resolve();
|
|
122
175
|
};
|
|
123
176
|
const client = sqliteClient;
|
|
124
177
|
const statementCache = /* @__PURE__ */ new Map();
|
|
@@ -132,6 +185,7 @@ function createSqliteExecutionAdapter(db, statementCacheMaxOrOptions = {}) {
|
|
|
132
185
|
return executeCompiled2(compiledQuery);
|
|
133
186
|
},
|
|
134
187
|
executeCompiled: executeCompiled2,
|
|
188
|
+
executeCompiledRun: executeCompiledRun2,
|
|
135
189
|
prepare(sqlText) {
|
|
136
190
|
return createPreparedStatementExecutor(
|
|
137
191
|
client,
|
|
@@ -157,32 +211,58 @@ function createSqliteExecutionAdapter(db, statementCacheMaxOrOptions = {}) {
|
|
|
157
211
|
// src/backend/drizzle/sqlite.ts
|
|
158
212
|
var NODE_INSERT_PARAM_COUNT = 9;
|
|
159
213
|
var EDGE_INSERT_PARAM_COUNT = 12;
|
|
160
|
-
var
|
|
161
|
-
|
|
162
|
-
Math.floor(chunkI4W7MKVG_cjs.SQLITE_MAX_BIND_PARAMETERS / NODE_INSERT_PARAM_COUNT)
|
|
163
|
-
);
|
|
164
|
-
var SQLITE_EDGE_INSERT_BATCH_SIZE = Math.max(
|
|
165
|
-
1,
|
|
166
|
-
Math.floor(chunkI4W7MKVG_cjs.SQLITE_MAX_BIND_PARAMETERS / EDGE_INSERT_PARAM_COUNT)
|
|
167
|
-
);
|
|
168
|
-
var SQLITE_GET_NODES_ID_CHUNK_SIZE = Math.max(
|
|
169
|
-
1,
|
|
170
|
-
chunkI4W7MKVG_cjs.SQLITE_MAX_BIND_PARAMETERS - 2
|
|
171
|
-
);
|
|
172
|
-
var SQLITE_GET_EDGES_ID_CHUNK_SIZE = Math.max(
|
|
173
|
-
1,
|
|
174
|
-
chunkI4W7MKVG_cjs.SQLITE_MAX_BIND_PARAMETERS - 1
|
|
175
|
-
);
|
|
214
|
+
var GET_NODES_FIXED_PARAM_COUNT = 2;
|
|
215
|
+
var GET_EDGES_FIXED_PARAM_COUNT = 1;
|
|
176
216
|
var CHECK_UNIQUE_BATCH_FIXED_PARAM_COUNT = 3;
|
|
177
|
-
var
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
217
|
+
var FULLTEXT_UPSERT_PARAM_COUNT = 6;
|
|
218
|
+
var FULLTEXT_DELETE_FIXED_PARAM_COUNT = 2;
|
|
219
|
+
var UNIQUE_INSERT_PARAM_COUNT = 6;
|
|
220
|
+
var SQLITE_ANALYZE_ROW_LIMIT = 1e3;
|
|
221
|
+
function computeSqliteBatchChunkSizes(maxBindParameters) {
|
|
222
|
+
return {
|
|
223
|
+
checkUniqueBatchChunkSize: Math.max(
|
|
224
|
+
1,
|
|
225
|
+
maxBindParameters - CHECK_UNIQUE_BATCH_FIXED_PARAM_COUNT
|
|
226
|
+
),
|
|
227
|
+
embeddingUpsertBatchSize: Math.max(
|
|
228
|
+
1,
|
|
229
|
+
Math.floor(maxBindParameters / chunkEM3CWPND_cjs.EMBEDDING_UPSERT_PARAM_COUNT)
|
|
230
|
+
),
|
|
231
|
+
fulltextUpsertBatchSize: Math.max(
|
|
232
|
+
1,
|
|
233
|
+
Math.floor(maxBindParameters / FULLTEXT_UPSERT_PARAM_COUNT)
|
|
234
|
+
),
|
|
235
|
+
fulltextDeleteChunkSize: Math.max(
|
|
236
|
+
1,
|
|
237
|
+
maxBindParameters - FULLTEXT_DELETE_FIXED_PARAM_COUNT
|
|
238
|
+
),
|
|
239
|
+
edgeInsertBatchSize: Math.max(
|
|
240
|
+
1,
|
|
241
|
+
Math.floor(maxBindParameters / EDGE_INSERT_PARAM_COUNT)
|
|
242
|
+
),
|
|
243
|
+
getEdgesChunkSize: Math.max(
|
|
244
|
+
1,
|
|
245
|
+
maxBindParameters - GET_EDGES_FIXED_PARAM_COUNT
|
|
246
|
+
),
|
|
247
|
+
getNodesChunkSize: Math.max(
|
|
248
|
+
1,
|
|
249
|
+
maxBindParameters - GET_NODES_FIXED_PARAM_COUNT
|
|
250
|
+
),
|
|
251
|
+
nodeInsertBatchSize: Math.max(
|
|
252
|
+
1,
|
|
253
|
+
Math.floor(maxBindParameters / NODE_INSERT_PARAM_COUNT)
|
|
254
|
+
),
|
|
255
|
+
uniqueInsertBatchSize: Math.max(
|
|
256
|
+
1,
|
|
257
|
+
Math.floor(maxBindParameters / UNIQUE_INSERT_PARAM_COUNT)
|
|
258
|
+
)
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
var toNodeRow = chunkCTTSDJLY_cjs.createNodeRowMapper(chunkCTTSDJLY_cjs.SQLITE_ROW_MAPPER_CONFIG);
|
|
262
|
+
var toEdgeRow = chunkCTTSDJLY_cjs.createEdgeRowMapper(chunkCTTSDJLY_cjs.SQLITE_ROW_MAPPER_CONFIG);
|
|
263
|
+
var toUniqueRow = chunkCTTSDJLY_cjs.createUniqueRowMapper(chunkCTTSDJLY_cjs.SQLITE_ROW_MAPPER_CONFIG);
|
|
264
|
+
var toSchemaVersionRow = chunkCTTSDJLY_cjs.createSchemaVersionRowMapper(
|
|
265
|
+
chunkCTTSDJLY_cjs.SQLITE_ROW_MAPPER_CONFIG
|
|
186
266
|
);
|
|
187
267
|
var PENDING_FOREVER = new Promise(noop);
|
|
188
268
|
function pendingForever() {
|
|
@@ -190,9 +270,30 @@ function pendingForever() {
|
|
|
190
270
|
}
|
|
191
271
|
function noop() {
|
|
192
272
|
}
|
|
273
|
+
var queueTaskContext;
|
|
274
|
+
async function loadQueueTaskContext() {
|
|
275
|
+
try {
|
|
276
|
+
const asyncHooks = await import('async_hooks');
|
|
277
|
+
queueTaskContext = new asyncHooks.AsyncLocalStorage();
|
|
278
|
+
} catch {
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
void loadQueueTaskContext();
|
|
282
|
+
function rejectReentrantQueueSubmission() {
|
|
283
|
+
return Promise.reject(
|
|
284
|
+
new chunkLGEALRC6_cjs.ConfigurationError(
|
|
285
|
+
"This operation was awaited from inside a transaction running on the same SQLite backend and would deadlock: the transaction holds the backend's serialized execution slot until it completes, so the operation could never run.",
|
|
286
|
+
{ backend: "sqlite", capability: "concurrentRootAccess" },
|
|
287
|
+
{
|
|
288
|
+
suggestion: "Inside a store.transaction callback, use the transaction-scoped context (tx.nodes / tx.edges / tx.backend) instead of the root store or backend, or move the operation outside the transaction."
|
|
289
|
+
}
|
|
290
|
+
)
|
|
291
|
+
);
|
|
292
|
+
}
|
|
193
293
|
function createSerializedExecutionQueue() {
|
|
194
294
|
let tail = Promise.resolve();
|
|
195
295
|
let disposed = false;
|
|
296
|
+
const taskMarker = {};
|
|
196
297
|
function isDisposed() {
|
|
197
298
|
return disposed;
|
|
198
299
|
}
|
|
@@ -201,11 +302,15 @@ function createSerializedExecutionQueue() {
|
|
|
201
302
|
disposed = true;
|
|
202
303
|
},
|
|
203
304
|
runExclusive(task) {
|
|
204
|
-
if (isDisposed()) return Promise.reject(new
|
|
305
|
+
if (isDisposed()) return Promise.reject(new chunkLGEALRC6_cjs.BackendDisposedError());
|
|
306
|
+
if (queueTaskContext?.getStore() === taskMarker) {
|
|
307
|
+
return rejectReentrantQueueSubmission();
|
|
308
|
+
}
|
|
205
309
|
const runTask = async () => {
|
|
206
310
|
if (isDisposed()) return pendingForever();
|
|
207
311
|
try {
|
|
208
|
-
|
|
312
|
+
const context = queueTaskContext;
|
|
313
|
+
return context === void 0 ? await task() : await context.run(taskMarker, () => task());
|
|
209
314
|
} catch (error) {
|
|
210
315
|
if (isDisposed()) return pendingForever();
|
|
211
316
|
throw error;
|
|
@@ -225,18 +330,19 @@ function runWithSerializedQueue(queue, task) {
|
|
|
225
330
|
return queue.runExclusive(task);
|
|
226
331
|
}
|
|
227
332
|
function throwSqliteTransactionsDisabled(message) {
|
|
228
|
-
throw new
|
|
333
|
+
throw new chunkLGEALRC6_cjs.ConfigurationError(message, {
|
|
229
334
|
backend: "sqlite",
|
|
230
335
|
capability: "transactions",
|
|
231
336
|
supportsTransactions: false
|
|
232
337
|
});
|
|
233
338
|
}
|
|
234
339
|
function buildSqliteCapabilities(options) {
|
|
235
|
-
const base = options.transactionMode === "none" ? { ...
|
|
340
|
+
const base = options.transactionMode === "none" ? { ...chunk4TOD4LBZ_cjs.SQLITE_CAPABILITIES, transactions: false } : chunk4TOD4LBZ_cjs.SQLITE_CAPABILITIES;
|
|
236
341
|
return {
|
|
237
342
|
...base,
|
|
238
|
-
|
|
239
|
-
|
|
343
|
+
maxBindParameters: options.maxBindParameters,
|
|
344
|
+
fulltext: chunkD7ZEOS56_cjs.buildFulltextCapabilities(options.fulltextStrategy),
|
|
345
|
+
...options.vectorStrategy === void 0 ? {} : { vector: chunkD7ZEOS56_cjs.buildVectorCapabilities(options.vectorStrategy) }
|
|
240
346
|
};
|
|
241
347
|
}
|
|
242
348
|
function createSqliteOperationBackend(options) {
|
|
@@ -251,36 +357,46 @@ function createSqliteOperationBackend(options) {
|
|
|
251
357
|
vectorStrategy,
|
|
252
358
|
vectorSlotLatch
|
|
253
359
|
} = options;
|
|
360
|
+
const compiledExecute = executionAdapter.executeCompiled;
|
|
361
|
+
const compiledRun = executionAdapter.executeCompiledRun;
|
|
254
362
|
function execGet(query) {
|
|
255
363
|
return runWithSerializedQueue(serializedQueue, async () => {
|
|
256
|
-
|
|
364
|
+
if (compiledExecute === void 0) {
|
|
365
|
+
const rows2 = await db.all(query);
|
|
366
|
+
return rows2[0];
|
|
367
|
+
}
|
|
368
|
+
const rows = await compiledExecute(executionAdapter.compile(query));
|
|
257
369
|
return rows[0];
|
|
258
370
|
});
|
|
259
371
|
}
|
|
260
372
|
function execAll(query) {
|
|
261
373
|
return runWithSerializedQueue(serializedQueue, async () => {
|
|
262
|
-
|
|
374
|
+
if (compiledExecute === void 0) {
|
|
375
|
+
return await db.all(query);
|
|
376
|
+
}
|
|
377
|
+
return [...await compiledExecute(executionAdapter.compile(query))];
|
|
263
378
|
});
|
|
264
379
|
}
|
|
265
380
|
function execRun(query) {
|
|
266
381
|
return runWithSerializedQueue(serializedQueue, async () => {
|
|
267
|
-
|
|
382
|
+
if (compiledRun === void 0) {
|
|
383
|
+
await db.run(query);
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
await compiledRun(executionAdapter.compile(query));
|
|
268
387
|
});
|
|
269
388
|
}
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
getNodesChunkSize: SQLITE_GET_NODES_ID_CHUNK_SIZE,
|
|
276
|
-
nodeInsertBatchSize: SQLITE_NODE_INSERT_BATCH_SIZE
|
|
277
|
-
},
|
|
389
|
+
const batchConfig = computeSqliteBatchChunkSizes(
|
|
390
|
+
capabilities.maxBindParameters ?? chunk4TOD4LBZ_cjs.SQLITE_MAX_BIND_PARAMETERS
|
|
391
|
+
);
|
|
392
|
+
const commonBackend = chunkEM3CWPND_cjs.createCommonOperationBackend({
|
|
393
|
+
batchConfig,
|
|
278
394
|
execution: {
|
|
279
395
|
execAll,
|
|
280
396
|
execGet,
|
|
281
397
|
execRun
|
|
282
398
|
},
|
|
283
|
-
nowIso:
|
|
399
|
+
nowIso: chunkCTTSDJLY_cjs.nowIso,
|
|
284
400
|
operationStrategy,
|
|
285
401
|
rowMappers: {
|
|
286
402
|
toEdgeRow,
|
|
@@ -306,19 +422,61 @@ function createSqliteOperationBackend(options) {
|
|
|
306
422
|
}
|
|
307
423
|
const vectorEmbeddingMethods = vectorStrategy === void 0 ? {} : {
|
|
308
424
|
async upsertEmbedding(params) {
|
|
309
|
-
const slot =
|
|
425
|
+
const slot = chunkEM3CWPND_cjs.vectorSlotFromParams(params);
|
|
310
426
|
await ensureVectorSlotStorage(slot);
|
|
311
|
-
const statements = vectorStrategy.buildUpsert(slot, params,
|
|
427
|
+
const statements = vectorStrategy.buildUpsert(slot, params, chunkCTTSDJLY_cjs.nowIso());
|
|
312
428
|
try {
|
|
313
429
|
for (const statement of statements) {
|
|
314
430
|
await execRun(statement);
|
|
315
431
|
}
|
|
316
432
|
} catch (error) {
|
|
317
|
-
throw
|
|
433
|
+
throw chunkEM3CWPND_cjs.mapVectorWriteError(error, params);
|
|
434
|
+
}
|
|
435
|
+
},
|
|
436
|
+
async upsertEmbeddingBatch(params) {
|
|
437
|
+
if (params.rows.length === 0) return;
|
|
438
|
+
const slot = chunkEM3CWPND_cjs.vectorSlotFromParams(params);
|
|
439
|
+
await ensureVectorSlotStorage(slot);
|
|
440
|
+
const rowsById = new Map(
|
|
441
|
+
params.rows.map((row) => [row.nodeId, row])
|
|
442
|
+
);
|
|
443
|
+
const rows = [...rowsById.values()];
|
|
444
|
+
const timestamp = chunkCTTSDJLY_cjs.nowIso();
|
|
445
|
+
try {
|
|
446
|
+
for (const chunk2 of chunk4TOD4LBZ_cjs.chunk(
|
|
447
|
+
rows,
|
|
448
|
+
batchConfig.embeddingUpsertBatchSize
|
|
449
|
+
)) {
|
|
450
|
+
const statements = vectorStrategy.buildUpsertBatch === void 0 ? chunk2.flatMap(
|
|
451
|
+
(row) => vectorStrategy.buildUpsert(
|
|
452
|
+
slot,
|
|
453
|
+
{
|
|
454
|
+
graphId: params.graphId,
|
|
455
|
+
nodeKind: params.nodeKind,
|
|
456
|
+
nodeId: row.nodeId,
|
|
457
|
+
fieldPath: params.fieldPath,
|
|
458
|
+
embedding: row.embedding,
|
|
459
|
+
dimensions: params.dimensions,
|
|
460
|
+
metric: params.metric,
|
|
461
|
+
indexType: params.indexType
|
|
462
|
+
},
|
|
463
|
+
timestamp
|
|
464
|
+
)
|
|
465
|
+
) : vectorStrategy.buildUpsertBatch(
|
|
466
|
+
slot,
|
|
467
|
+
{ ...params, rows: chunk2 },
|
|
468
|
+
timestamp
|
|
469
|
+
);
|
|
470
|
+
for (const statement of statements) {
|
|
471
|
+
await execRun(statement);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
} catch (error) {
|
|
475
|
+
throw chunkEM3CWPND_cjs.mapVectorWriteError(error, params);
|
|
318
476
|
}
|
|
319
477
|
},
|
|
320
478
|
async deleteEmbedding(params) {
|
|
321
|
-
const slot =
|
|
479
|
+
const slot = chunkEM3CWPND_cjs.vectorSlotFromParams(params);
|
|
322
480
|
await ensureVectorSlotStorage(slot);
|
|
323
481
|
const statements = vectorStrategy.buildDelete(slot, params);
|
|
324
482
|
for (const statement of statements) {
|
|
@@ -326,21 +484,80 @@ function createSqliteOperationBackend(options) {
|
|
|
326
484
|
}
|
|
327
485
|
},
|
|
328
486
|
async vectorSearch(params) {
|
|
329
|
-
|
|
330
|
-
const slot =
|
|
487
|
+
chunkD7ZEOS56_cjs.assertVectorSearchLimit(params.limit);
|
|
488
|
+
const slot = chunkEM3CWPND_cjs.vectorSlotFromParams(params);
|
|
331
489
|
await ensureVectorSlotStorage(slot);
|
|
332
|
-
const query = vectorStrategy.buildSearch(
|
|
490
|
+
const query = vectorStrategy.buildSearch(
|
|
491
|
+
slot,
|
|
492
|
+
params,
|
|
493
|
+
// Store-compiled candidates (predicates + subclass + currency)
|
|
494
|
+
// take precedence; the live-node default covers direct backend use.
|
|
495
|
+
params.candidates ?? operationStrategy.buildLiveNodeIds(
|
|
496
|
+
params.graphId,
|
|
497
|
+
params.nodeKind
|
|
498
|
+
)
|
|
499
|
+
);
|
|
333
500
|
let rows;
|
|
334
501
|
try {
|
|
335
502
|
rows = await execAll(query);
|
|
336
503
|
} catch (error) {
|
|
337
|
-
throw
|
|
504
|
+
throw chunkEM3CWPND_cjs.mapVectorWriteError(error, params);
|
|
338
505
|
}
|
|
339
506
|
return rows.map((row) => ({
|
|
340
507
|
nodeId: row.node_id,
|
|
341
508
|
score: row.score
|
|
342
509
|
}));
|
|
343
|
-
}
|
|
510
|
+
},
|
|
511
|
+
// Single-statement hybrid needs ROW_NUMBER(); a capability profile
|
|
512
|
+
// that disables window functions keeps the store's multi-statement
|
|
513
|
+
// fallback by simply not exposing the member.
|
|
514
|
+
...capabilities.windowFunctions ? {
|
|
515
|
+
async hybridSearch(params) {
|
|
516
|
+
chunkD7ZEOS56_cjs.assertVectorSearchLimit(params.limit);
|
|
517
|
+
chunkD7ZEOS56_cjs.assertVectorSearchLimit(params.vector.k);
|
|
518
|
+
const slot = chunkEM3CWPND_cjs.vectorSlotFromParams({
|
|
519
|
+
graphId: params.graphId,
|
|
520
|
+
nodeKind: params.nodeKind,
|
|
521
|
+
fieldPath: params.vector.fieldPath,
|
|
522
|
+
dimensions: params.vector.dimensions,
|
|
523
|
+
metric: params.vector.metric,
|
|
524
|
+
indexType: params.vector.indexType
|
|
525
|
+
});
|
|
526
|
+
await ensureVectorSlotStorage(slot);
|
|
527
|
+
const candidates = params.candidates ?? operationStrategy.buildLiveNodeIds(
|
|
528
|
+
params.graphId,
|
|
529
|
+
params.nodeKind
|
|
530
|
+
);
|
|
531
|
+
const vectorParams = {
|
|
532
|
+
graphId: params.graphId,
|
|
533
|
+
nodeKind: params.nodeKind,
|
|
534
|
+
fieldPath: params.vector.fieldPath,
|
|
535
|
+
queryEmbedding: params.vector.queryEmbedding,
|
|
536
|
+
metric: params.vector.metric,
|
|
537
|
+
dimensions: params.vector.dimensions,
|
|
538
|
+
indexType: params.vector.indexType,
|
|
539
|
+
limit: params.vector.k,
|
|
540
|
+
...params.vector.minScore === void 0 ? {} : { minScore: params.vector.minScore }
|
|
541
|
+
};
|
|
542
|
+
const vectorSql = vectorStrategy.buildSearch(
|
|
543
|
+
slot,
|
|
544
|
+
vectorParams,
|
|
545
|
+
chunkEM3CWPND_cjs.hybridCandidatesRef()
|
|
546
|
+
);
|
|
547
|
+
const statement = operationStrategy.buildHybridSearch(
|
|
548
|
+
{ ...params, candidates },
|
|
549
|
+
vectorSql,
|
|
550
|
+
params.vector.metric === "cosine"
|
|
551
|
+
);
|
|
552
|
+
let raw;
|
|
553
|
+
try {
|
|
554
|
+
raw = await execAll(statement);
|
|
555
|
+
} catch (error) {
|
|
556
|
+
throw chunkEM3CWPND_cjs.mapVectorWriteError(error, vectorParams);
|
|
557
|
+
}
|
|
558
|
+
return raw.map((row) => chunkEM3CWPND_cjs.mapHybridSearchRow(row, toNodeRow));
|
|
559
|
+
}
|
|
560
|
+
} : {}
|
|
344
561
|
};
|
|
345
562
|
const operationBackend = {
|
|
346
563
|
...commonBackend,
|
|
@@ -353,7 +570,7 @@ function createSqliteOperationBackend(options) {
|
|
|
353
570
|
...vectorStrategy === void 0 ? {} : { vectorStrategy },
|
|
354
571
|
async createVectorIndex(params) {
|
|
355
572
|
if (vectorStrategy === void 0) return;
|
|
356
|
-
const slot =
|
|
573
|
+
const slot = chunkEM3CWPND_cjs.vectorSlotFromCreateIndexParams(params);
|
|
357
574
|
await ensureVectorSlotStorage(slot);
|
|
358
575
|
const indexStatement = vectorStrategy.buildCreateIndex?.(slot);
|
|
359
576
|
if (indexStatement !== void 0) {
|
|
@@ -362,18 +579,18 @@ function createSqliteOperationBackend(options) {
|
|
|
362
579
|
},
|
|
363
580
|
async dropVectorIndex(params) {
|
|
364
581
|
if (vectorStrategy === void 0) return;
|
|
365
|
-
const slot =
|
|
582
|
+
const slot = chunkEM3CWPND_cjs.vectorSlotFromDropIndexParams(params);
|
|
366
583
|
const dropStatement = vectorStrategy.buildDropIndex?.(slot);
|
|
367
584
|
if (dropStatement === void 0) return;
|
|
368
585
|
try {
|
|
369
586
|
await execRun(dropStatement);
|
|
370
587
|
} catch (error) {
|
|
371
|
-
if (!
|
|
588
|
+
if (!chunkBLZDPRXT_cjs.isMissingTableError(error)) throw error;
|
|
372
589
|
}
|
|
373
590
|
},
|
|
374
591
|
// === Fulltext Operations ===
|
|
375
592
|
async upsertFulltext(params) {
|
|
376
|
-
const timestamp =
|
|
593
|
+
const timestamp = chunkCTTSDJLY_cjs.nowIso();
|
|
377
594
|
const statements = operationStrategy.buildUpsertFulltext(
|
|
378
595
|
params,
|
|
379
596
|
timestamp
|
|
@@ -390,20 +607,33 @@ function createSqliteOperationBackend(options) {
|
|
|
390
607
|
},
|
|
391
608
|
async upsertFulltextBatch(params) {
|
|
392
609
|
if (params.rows.length === 0) return;
|
|
393
|
-
const timestamp =
|
|
394
|
-
const
|
|
395
|
-
params,
|
|
396
|
-
|
|
397
|
-
)
|
|
398
|
-
|
|
399
|
-
|
|
610
|
+
const timestamp = chunkCTTSDJLY_cjs.nowIso();
|
|
611
|
+
for (const rows of chunk4TOD4LBZ_cjs.chunk(
|
|
612
|
+
params.rows,
|
|
613
|
+
batchConfig.fulltextUpsertBatchSize
|
|
614
|
+
)) {
|
|
615
|
+
const statements = operationStrategy.buildUpsertFulltextBatch(
|
|
616
|
+
{ ...params, rows },
|
|
617
|
+
timestamp
|
|
618
|
+
);
|
|
619
|
+
for (const stmt of statements) {
|
|
620
|
+
await execRun(stmt);
|
|
621
|
+
}
|
|
400
622
|
}
|
|
401
623
|
},
|
|
402
624
|
async deleteFulltextBatch(params) {
|
|
403
625
|
if (params.nodeIds.length === 0) return;
|
|
404
|
-
const
|
|
405
|
-
|
|
406
|
-
|
|
626
|
+
for (const nodeIds of chunk4TOD4LBZ_cjs.chunk(
|
|
627
|
+
params.nodeIds,
|
|
628
|
+
batchConfig.fulltextDeleteChunkSize
|
|
629
|
+
)) {
|
|
630
|
+
const statements = operationStrategy.buildDeleteFulltextBatch({
|
|
631
|
+
...params,
|
|
632
|
+
nodeIds
|
|
633
|
+
});
|
|
634
|
+
for (const stmt of statements) {
|
|
635
|
+
await execRun(stmt);
|
|
636
|
+
}
|
|
407
637
|
}
|
|
408
638
|
},
|
|
409
639
|
async fulltextSearch(params) {
|
|
@@ -411,7 +641,7 @@ function createSqliteOperationBackend(options) {
|
|
|
411
641
|
const rows = await execAll(query);
|
|
412
642
|
return rows.map((row, index) => ({
|
|
413
643
|
nodeId: row.node_id,
|
|
414
|
-
score:
|
|
644
|
+
score: chunkCTTSDJLY_cjs.coerceNumericScore(row.score),
|
|
415
645
|
rank: index + 1,
|
|
416
646
|
...row.snippet === null ? {} : { snippet: row.snippet }
|
|
417
647
|
}));
|
|
@@ -430,18 +660,19 @@ function createSqliteOperationBackend(options) {
|
|
|
430
660
|
return operationBackend;
|
|
431
661
|
}
|
|
432
662
|
function createSqliteBackend(db, options = {}) {
|
|
433
|
-
const tables2 = options.tables ??
|
|
434
|
-
const fulltextStrategy = options.fulltext ??
|
|
663
|
+
const tables2 = options.tables ?? chunkFN35DLCN_cjs.tables;
|
|
664
|
+
const fulltextStrategy = options.fulltext ?? chunkD7ZEOS56_cjs.fts5Strategy;
|
|
435
665
|
const profileHints = options.executionProfile ?? {};
|
|
436
666
|
const executionAdapter = createSqliteExecutionAdapter(db, { profileHints });
|
|
437
667
|
const { isSync, transactionMode } = executionAdapter.profile;
|
|
438
668
|
const vectorStrategy = options.vector;
|
|
439
|
-
const vectorSlotLatch = vectorStrategy === void 0 ? void 0 :
|
|
669
|
+
const vectorSlotLatch = vectorStrategy === void 0 ? void 0 : chunkEM3CWPND_cjs.createVectorSlotLatch();
|
|
440
670
|
const capabilities = {
|
|
441
671
|
...buildSqliteCapabilities({
|
|
442
672
|
fulltextStrategy,
|
|
443
673
|
vectorStrategy,
|
|
444
|
-
transactionMode
|
|
674
|
+
transactionMode,
|
|
675
|
+
maxBindParameters: executionAdapter.profile.maxBindParameters
|
|
445
676
|
}),
|
|
446
677
|
...options.capabilities
|
|
447
678
|
};
|
|
@@ -451,14 +682,26 @@ function createSqliteBackend(db, options = {}) {
|
|
|
451
682
|
recordedNodes: drizzleOrm.getTableName(tables2.recordedNodes),
|
|
452
683
|
recordedEdges: drizzleOrm.getTableName(tables2.recordedEdges),
|
|
453
684
|
recordedClock: drizzleOrm.getTableName(tables2.recordedClock),
|
|
685
|
+
revisionOrigins: drizzleOrm.getTableName(tables2.revisionOrigins),
|
|
454
686
|
fulltext: tables2.fulltextTableName,
|
|
455
687
|
uniques: drizzleOrm.getTableName(tables2.uniques)
|
|
456
688
|
};
|
|
457
|
-
const
|
|
689
|
+
const coreAnalyzeTables = [
|
|
690
|
+
tableNames.nodes,
|
|
691
|
+
tableNames.edges,
|
|
692
|
+
tableNames.uniques,
|
|
693
|
+
tableNames.fulltext
|
|
694
|
+
];
|
|
695
|
+
const recordedAnalyzeTables = [
|
|
696
|
+
tableNames.recordedNodes,
|
|
697
|
+
tableNames.recordedEdges,
|
|
698
|
+
tableNames.recordedClock
|
|
699
|
+
];
|
|
700
|
+
const operationStrategy = chunkEM3CWPND_cjs.createSqliteOperationStrategy(
|
|
458
701
|
tables2,
|
|
459
702
|
fulltextStrategy
|
|
460
703
|
);
|
|
461
|
-
const serializedQueue =
|
|
704
|
+
const serializedQueue = transactionMode === "none" ? void 0 : createSerializedExecutionQueue();
|
|
462
705
|
const operations = createSqliteOperationBackend({
|
|
463
706
|
capabilities,
|
|
464
707
|
db,
|
|
@@ -483,6 +726,14 @@ function createSqliteBackend(db, options = {}) {
|
|
|
483
726
|
async () => storageTransaction.call(storage, run)
|
|
484
727
|
);
|
|
485
728
|
}
|
|
729
|
+
async function runFrameStatement(query) {
|
|
730
|
+
const compiledRun = executionAdapter.executeCompiledRun;
|
|
731
|
+
if (compiledRun === void 0) {
|
|
732
|
+
await db.run(query);
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
735
|
+
await compiledRun(executionAdapter.compile(query));
|
|
736
|
+
}
|
|
486
737
|
function runSchemaWriteTransaction(fn) {
|
|
487
738
|
if (transactionMode === "none") {
|
|
488
739
|
throwSqliteTransactionsDisabled(
|
|
@@ -496,17 +747,17 @@ function createSqliteBackend(db, options = {}) {
|
|
|
496
747
|
db,
|
|
497
748
|
executionAdapter,
|
|
498
749
|
operationStrategy,
|
|
499
|
-
profileHints: { isSync
|
|
750
|
+
profileHints: { isSync },
|
|
500
751
|
tableNames,
|
|
501
752
|
fulltextStrategy,
|
|
502
753
|
vectorStrategy});
|
|
503
|
-
|
|
754
|
+
await runFrameStatement(drizzleOrm.sql`BEGIN IMMEDIATE`);
|
|
504
755
|
try {
|
|
505
756
|
const result = await fn(txBackend);
|
|
506
|
-
|
|
757
|
+
await runFrameStatement(drizzleOrm.sql`COMMIT`);
|
|
507
758
|
return result;
|
|
508
759
|
} catch (error) {
|
|
509
|
-
|
|
760
|
+
await runFrameStatement(drizzleOrm.sql`ROLLBACK`);
|
|
510
761
|
throw error;
|
|
511
762
|
}
|
|
512
763
|
});
|
|
@@ -544,7 +795,7 @@ function createSqliteBackend(db, options = {}) {
|
|
|
544
795
|
}
|
|
545
796
|
const matTable = tables2.contributionMaterializations;
|
|
546
797
|
async function ensureContributionMaterializationsTableImpl() {
|
|
547
|
-
await db.run(drizzleOrm.sql.raw(
|
|
798
|
+
await db.run(drizzleOrm.sql.raw(chunkEM3CWPND_cjs.generateSqliteCreateTableSQL(matTable)));
|
|
548
799
|
}
|
|
549
800
|
async function getContributionMaterializationRow(identity) {
|
|
550
801
|
const rows = await db.select().from(matTable).where(
|
|
@@ -557,16 +808,16 @@ function createSqliteBackend(db, options = {}) {
|
|
|
557
808
|
);
|
|
558
809
|
const row = rows[0];
|
|
559
810
|
if (row === void 0) return void 0;
|
|
560
|
-
return
|
|
811
|
+
return chunkEM3CWPND_cjs.mapContributionMaterializationRow(
|
|
561
812
|
row,
|
|
562
|
-
|
|
813
|
+
chunkEM3CWPND_cjs.SQLITE_CONTRIBUTION_MAT_TIMESTAMPS.decode
|
|
563
814
|
);
|
|
564
815
|
}
|
|
565
816
|
async function recordContributionMaterializationRow(params) {
|
|
566
817
|
await db.insert(matTable).values(
|
|
567
|
-
|
|
818
|
+
chunkEM3CWPND_cjs.buildContributionInsertValues(
|
|
568
819
|
params,
|
|
569
|
-
|
|
820
|
+
chunkEM3CWPND_cjs.SQLITE_CONTRIBUTION_MAT_TIMESTAMPS.encode
|
|
570
821
|
)
|
|
571
822
|
).onConflictDoUpdate({
|
|
572
823
|
target: [
|
|
@@ -575,13 +826,13 @@ function createSqliteBackend(db, options = {}) {
|
|
|
575
826
|
matTable.owner,
|
|
576
827
|
matTable.tableName
|
|
577
828
|
],
|
|
578
|
-
set:
|
|
829
|
+
set: chunkEM3CWPND_cjs.buildContributionOnConflictSet(
|
|
579
830
|
matTable.materializedAt,
|
|
580
831
|
params.materializedAt
|
|
581
832
|
)
|
|
582
833
|
});
|
|
583
834
|
}
|
|
584
|
-
const contributionMaterializer =
|
|
835
|
+
const contributionMaterializer = chunkEM3CWPND_cjs.createContributionMaterializer({
|
|
585
836
|
dialect: "sqlite",
|
|
586
837
|
fulltextStrategy,
|
|
587
838
|
fulltextTableName: tables2.fulltextTableName,
|
|
@@ -601,22 +852,27 @@ function createSqliteBackend(db, options = {}) {
|
|
|
601
852
|
tableNames,
|
|
602
853
|
fulltextStrategy,
|
|
603
854
|
vectorStrategy});
|
|
604
|
-
return
|
|
855
|
+
return chunkEM3CWPND_cjs.gateFulltext(txBackend, contributionMaterializer.assertInitialized);
|
|
605
856
|
}
|
|
606
857
|
const backend = {
|
|
607
858
|
...operations,
|
|
608
859
|
async bootstrapTables() {
|
|
609
|
-
const statements =
|
|
860
|
+
const statements = chunkEM3CWPND_cjs.generateSqliteDDL(tables2, fulltextStrategy);
|
|
610
861
|
for (const statement of statements) {
|
|
611
862
|
await db.run(drizzleOrm.sql.raw(statement));
|
|
612
863
|
}
|
|
613
864
|
},
|
|
865
|
+
async ensureRevisionOriginsTable() {
|
|
866
|
+
await db.run(
|
|
867
|
+
drizzleOrm.sql.raw(chunkEM3CWPND_cjs.generateSqliteCreateTableSQL(tables2.revisionOrigins))
|
|
868
|
+
);
|
|
869
|
+
},
|
|
614
870
|
// Every fulltext-touching method asserts the durable marker instead
|
|
615
871
|
// of lazily emitting DDL. Steady state performs zero ensure; an
|
|
616
872
|
// uninitialized database throws `StoreNotInitializedError` rather
|
|
617
873
|
// than self-healing (#135). Shared verbatim with the tx-scoped gate
|
|
618
874
|
// via `gateFulltextMethods`.
|
|
619
|
-
...
|
|
875
|
+
...chunkEM3CWPND_cjs.gateFulltextMethods(
|
|
620
876
|
operations,
|
|
621
877
|
contributionMaterializer.assertInitialized
|
|
622
878
|
),
|
|
@@ -625,7 +881,7 @@ function createSqliteBackend(db, options = {}) {
|
|
|
625
881
|
},
|
|
626
882
|
async ensureIndexMaterializationsTable() {
|
|
627
883
|
await db.run(
|
|
628
|
-
drizzleOrm.sql.raw(
|
|
884
|
+
drizzleOrm.sql.raw(chunkEM3CWPND_cjs.generateSqliteCreateTableSQL(tables2.indexMaterializations))
|
|
629
885
|
);
|
|
630
886
|
},
|
|
631
887
|
async getIndexMaterialization(indexName) {
|
|
@@ -633,26 +889,26 @@ function createSqliteBackend(db, options = {}) {
|
|
|
633
889
|
const rows = await db.select().from(t).where(drizzleOrm.eq(t.indexName, indexName));
|
|
634
890
|
const row = rows[0];
|
|
635
891
|
if (row === void 0) return void 0;
|
|
636
|
-
return
|
|
892
|
+
return chunkEM3CWPND_cjs.mapMaterializationRow(row, chunkEM3CWPND_cjs.SQLITE_INDEX_MAT_TIMESTAMPS.decode);
|
|
637
893
|
},
|
|
638
894
|
async getIndexMaterializations(statusKeys) {
|
|
639
895
|
if (statusKeys.length === 0) return [];
|
|
640
896
|
const t = tables2.indexMaterializations;
|
|
641
897
|
const rows = await db.select().from(t).where(drizzleOrm.inArray(t.indexName, [...statusKeys]));
|
|
642
898
|
return rows.map(
|
|
643
|
-
(row) =>
|
|
899
|
+
(row) => chunkEM3CWPND_cjs.mapMaterializationRow(row, chunkEM3CWPND_cjs.SQLITE_INDEX_MAT_TIMESTAMPS.decode)
|
|
644
900
|
);
|
|
645
901
|
},
|
|
646
902
|
async recordIndexMaterialization(params) {
|
|
647
903
|
const t = tables2.indexMaterializations;
|
|
648
904
|
await db.insert(t).values(
|
|
649
|
-
|
|
905
|
+
chunkEM3CWPND_cjs.buildMaterializationInsertValues(
|
|
650
906
|
params,
|
|
651
|
-
|
|
907
|
+
chunkEM3CWPND_cjs.SQLITE_INDEX_MAT_TIMESTAMPS.encode
|
|
652
908
|
)
|
|
653
909
|
).onConflictDoUpdate({
|
|
654
910
|
target: t.indexName,
|
|
655
|
-
set:
|
|
911
|
+
set: chunkEM3CWPND_cjs.buildMaterializationOnConflictSet(
|
|
656
912
|
t.materializedAt,
|
|
657
913
|
params.materializedAt
|
|
658
914
|
)
|
|
@@ -671,37 +927,37 @@ function createSqliteBackend(db, options = {}) {
|
|
|
671
927
|
await contributionMaterializer.assertInitialized(graphId);
|
|
672
928
|
},
|
|
673
929
|
async ensureKindRemovalsTable() {
|
|
674
|
-
await db.run(drizzleOrm.sql.raw(
|
|
930
|
+
await db.run(drizzleOrm.sql.raw(chunkEM3CWPND_cjs.generateSqliteCreateTableSQL(tables2.kindRemovals)));
|
|
675
931
|
},
|
|
676
932
|
async getPendingKindRemovals(graphId) {
|
|
677
933
|
const t = tables2.kindRemovals;
|
|
678
934
|
const rows = await db.select().from(t).where(drizzleOrm.and(drizzleOrm.eq(t.graphId, graphId), drizzleOrm.isNull(t.removedAt)));
|
|
679
935
|
return rows.map(
|
|
680
|
-
(row) =>
|
|
936
|
+
(row) => chunkEM3CWPND_cjs.mapKindRemovalRow(row, chunkEM3CWPND_cjs.SQLITE_KIND_REMOVAL_TIMESTAMPS.decode)
|
|
681
937
|
);
|
|
682
938
|
},
|
|
683
939
|
async getAllKindRemovals(graphId) {
|
|
684
940
|
const t = tables2.kindRemovals;
|
|
685
941
|
const rows = await db.select().from(t).where(drizzleOrm.eq(t.graphId, graphId));
|
|
686
942
|
return rows.map(
|
|
687
|
-
(row) =>
|
|
943
|
+
(row) => chunkEM3CWPND_cjs.mapKindRemovalRow(row, chunkEM3CWPND_cjs.SQLITE_KIND_REMOVAL_TIMESTAMPS.decode)
|
|
688
944
|
);
|
|
689
945
|
},
|
|
690
946
|
async recordKindRemoval(params) {
|
|
691
947
|
const t = tables2.kindRemovals;
|
|
692
948
|
await db.insert(t).values(
|
|
693
|
-
|
|
949
|
+
chunkEM3CWPND_cjs.buildKindRemovalInsertValues(
|
|
694
950
|
params,
|
|
695
|
-
|
|
951
|
+
chunkEM3CWPND_cjs.SQLITE_KIND_REMOVAL_TIMESTAMPS.encode
|
|
696
952
|
)
|
|
697
953
|
).onConflictDoUpdate({
|
|
698
954
|
target: [t.graphId, t.kindName, t.entity, t.schemaVersion],
|
|
699
|
-
set:
|
|
955
|
+
set: chunkEM3CWPND_cjs.buildKindRemovalOnConflictSet(t.removedAt, params.removedAt)
|
|
700
956
|
});
|
|
701
957
|
},
|
|
702
958
|
async ensureReconciliationMarkersTable() {
|
|
703
959
|
await db.run(
|
|
704
|
-
drizzleOrm.sql.raw(
|
|
960
|
+
drizzleOrm.sql.raw(chunkEM3CWPND_cjs.generateSqliteCreateTableSQL(tables2.reconciliationMarkers))
|
|
705
961
|
);
|
|
706
962
|
},
|
|
707
963
|
async ensureRuntimeContributions(graphId) {
|
|
@@ -728,7 +984,19 @@ function createSqliteBackend(db, options = {}) {
|
|
|
728
984
|
});
|
|
729
985
|
},
|
|
730
986
|
async refreshStatistics() {
|
|
731
|
-
await db.run(
|
|
987
|
+
await db.run(
|
|
988
|
+
drizzleOrm.sql`PRAGMA analysis_limit = ${drizzleOrm.sql.raw(String(SQLITE_ANALYZE_ROW_LIMIT))}`
|
|
989
|
+
);
|
|
990
|
+
for (const tableName of coreAnalyzeTables) {
|
|
991
|
+
await db.run(drizzleOrm.sql`ANALYZE ${chunkCTTSDJLY_cjs.quoteIdentifier(tableName)}`);
|
|
992
|
+
}
|
|
993
|
+
for (const tableName of recordedAnalyzeTables) {
|
|
994
|
+
try {
|
|
995
|
+
await db.run(drizzleOrm.sql`ANALYZE ${chunkCTTSDJLY_cjs.quoteIdentifier(tableName)}`);
|
|
996
|
+
} catch (error) {
|
|
997
|
+
if (!chunkBLZDPRXT_cjs.isMissingTableError(error)) throw error;
|
|
998
|
+
}
|
|
999
|
+
}
|
|
732
1000
|
},
|
|
733
1001
|
async commitSchemaVersion(params) {
|
|
734
1002
|
return runSchemaWriteTransaction(
|
|
@@ -753,23 +1021,23 @@ function createSqliteBackend(db, options = {}) {
|
|
|
753
1021
|
db,
|
|
754
1022
|
executionAdapter,
|
|
755
1023
|
operationStrategy,
|
|
756
|
-
profileHints: { isSync
|
|
1024
|
+
profileHints: { isSync },
|
|
757
1025
|
tableNames,
|
|
758
1026
|
fulltextStrategy,
|
|
759
1027
|
vectorStrategy});
|
|
760
|
-
|
|
1028
|
+
await runFrameStatement(drizzleOrm.sql`BEGIN IMMEDIATE`);
|
|
761
1029
|
try {
|
|
762
1030
|
const result = await fn(
|
|
763
|
-
|
|
1031
|
+
chunkEM3CWPND_cjs.gateFulltext(
|
|
764
1032
|
txBackend,
|
|
765
1033
|
contributionMaterializer.assertInitialized
|
|
766
1034
|
),
|
|
767
1035
|
db
|
|
768
1036
|
);
|
|
769
|
-
|
|
1037
|
+
await runFrameStatement(drizzleOrm.sql`COMMIT`);
|
|
770
1038
|
return result;
|
|
771
1039
|
} catch (error) {
|
|
772
|
-
|
|
1040
|
+
await runFrameStatement(drizzleOrm.sql`ROLLBACK`);
|
|
773
1041
|
throw error;
|
|
774
1042
|
}
|
|
775
1043
|
});
|
|
@@ -781,9 +1049,9 @@ function createSqliteBackend(db, options = {}) {
|
|
|
781
1049
|
}
|
|
782
1050
|
return runWithSerializedQueue(
|
|
783
1051
|
serializedQueue,
|
|
784
|
-
async () => db.transaction(
|
|
785
|
-
|
|
786
|
-
)
|
|
1052
|
+
async () => db.transaction(async (tx) => fn(bindTransactionBackend(tx), tx), {
|
|
1053
|
+
behavior: "immediate"
|
|
1054
|
+
})
|
|
787
1055
|
);
|
|
788
1056
|
},
|
|
789
1057
|
adoptTransaction(externalTx) {
|
|
@@ -792,7 +1060,7 @@ function createSqliteBackend(db, options = {}) {
|
|
|
792
1060
|
"Cross-store atomicity is unavailable on this SQLite backend: transactions are disabled (transactionMode: 'none'). Adopting an external transaction here would let the caller's relational write commit with no way to roll back the graph write. Configure a driver that supports transactions (better-sqlite3, libsql, bun:sqlite)."
|
|
793
1061
|
);
|
|
794
1062
|
}
|
|
795
|
-
|
|
1063
|
+
chunkEM3CWPND_cjs.assertAdoptedDialect(
|
|
796
1064
|
externalTx,
|
|
797
1065
|
sqliteCore.BaseSQLiteDatabase,
|
|
798
1066
|
"sqlite"
|
|
@@ -818,10 +1086,10 @@ function createTransactionBackend(options) {
|
|
|
818
1086
|
tableNames: options.tableNames,
|
|
819
1087
|
fulltextStrategy: options.fulltextStrategy,
|
|
820
1088
|
vectorStrategy: options.vectorStrategy,
|
|
821
|
-
...options.vectorStrategy === void 0 ? {} : { vectorSlotLatch:
|
|
1089
|
+
...options.vectorStrategy === void 0 ? {} : { vectorSlotLatch: chunkEM3CWPND_cjs.createVectorSlotLatch() }
|
|
822
1090
|
});
|
|
823
1091
|
}
|
|
824
1092
|
|
|
825
1093
|
exports.createSqliteBackend = createSqliteBackend;
|
|
826
|
-
//# sourceMappingURL=chunk-
|
|
827
|
-
//# sourceMappingURL=chunk-
|
|
1094
|
+
//# sourceMappingURL=chunk-O7UN7OXA.cjs.map
|
|
1095
|
+
//# sourceMappingURL=chunk-O7UN7OXA.cjs.map
|