@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,9 +1,10 @@
|
|
|
1
|
-
import { createVectorSlotLatch, createSqliteOperationStrategy, createContributionMaterializer, gateFulltextMethods, generateSqliteCreateTableSQL, mapContributionMaterializationRow, SQLITE_CONTRIBUTION_MAT_TIMESTAMPS, buildContributionInsertValues, buildContributionOnConflictSet, assertAdoptedDialect, buildKindRemovalInsertValues, SQLITE_KIND_REMOVAL_TIMESTAMPS, buildKindRemovalOnConflictSet, mapKindRemovalRow, buildMaterializationInsertValues, SQLITE_INDEX_MAT_TIMESTAMPS, buildMaterializationOnConflictSet, mapMaterializationRow, generateSqliteDDL, createCommonOperationBackend, gateFulltext, compileQueryWithDialect, vectorSlotFromDropIndexParams, vectorSlotFromCreateIndexParams,
|
|
2
|
-
import { tables } from './chunk-
|
|
3
|
-
import { createNodeRowMapper, SQLITE_ROW_MAPPER_CONFIG, createEdgeRowMapper, createUniqueRowMapper, createSchemaVersionRowMapper,
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { createVectorSlotLatch, createSqliteOperationStrategy, createContributionMaterializer, gateFulltextMethods, generateSqliteCreateTableSQL, mapContributionMaterializationRow, SQLITE_CONTRIBUTION_MAT_TIMESTAMPS, buildContributionInsertValues, buildContributionOnConflictSet, assertAdoptedDialect, buildKindRemovalInsertValues, SQLITE_KIND_REMOVAL_TIMESTAMPS, buildKindRemovalOnConflictSet, mapKindRemovalRow, buildMaterializationInsertValues, SQLITE_INDEX_MAT_TIMESTAMPS, buildMaterializationOnConflictSet, mapMaterializationRow, generateSqliteDDL, createCommonOperationBackend, vectorSlotFromParams, hybridCandidatesRef, mapVectorWriteError, mapHybridSearchRow, gateFulltext, compileQueryWithDialect, EMBEDDING_UPSERT_PARAM_COUNT, vectorSlotFromDropIndexParams, vectorSlotFromCreateIndexParams, getOrCreateLru } from './chunk-WDBCBWC4.js';
|
|
2
|
+
import { tables } from './chunk-VHMPG6UL.js';
|
|
3
|
+
import { createNodeRowMapper, SQLITE_ROW_MAPPER_CONFIG, createEdgeRowMapper, createUniqueRowMapper, createSchemaVersionRowMapper, quoteIdentifier, nowIso, coerceNumericScore } from './chunk-55MZDDZV.js';
|
|
4
|
+
import { fts5Strategy, buildVectorCapabilities, buildFulltextCapabilities, assertVectorSearchLimit } from './chunk-FPIZFYHE.js';
|
|
5
|
+
import { SQLITE_CAPABILITIES, SQLITE_MAX_BIND_PARAMETERS, D1_MAX_BIND_PARAMETERS, MODERN_SQLITE_MAX_BIND_PARAMETERS, chunk } from './chunk-JBTOYDMN.js';
|
|
6
|
+
import { isMissingTableError } from './chunk-I7ZUZKFD.js';
|
|
7
|
+
import { ConfigurationError, BackendDisposedError } from './chunk-MP2JQKSG.js';
|
|
7
8
|
import { getTableName, sql, and, eq, isNull, inArray } from 'drizzle-orm';
|
|
8
9
|
import { BaseSQLiteDatabase } from 'drizzle-orm/sqlite-core';
|
|
9
10
|
|
|
@@ -61,6 +62,44 @@ function detectTransactionMode(db, profileHints, isSync) {
|
|
|
61
62
|
if (isSync) return "sql";
|
|
62
63
|
return "drizzle";
|
|
63
64
|
}
|
|
65
|
+
var MAX_VARIABLE_NUMBER_COMPILE_OPTION = /^MAX_VARIABLE_NUMBER=(\d+)$/;
|
|
66
|
+
var FIRST_MODERN_BIND_LIMIT_MAJOR = 3;
|
|
67
|
+
var FIRST_MODERN_BIND_LIMIT_MINOR = 32;
|
|
68
|
+
function parseCompiledMaxVariableNumber(rows) {
|
|
69
|
+
for (const row of rows) {
|
|
70
|
+
if (typeof row !== "object" || row === null) continue;
|
|
71
|
+
const option = row.compile_options;
|
|
72
|
+
if (typeof option !== "string") continue;
|
|
73
|
+
const match = MAX_VARIABLE_NUMBER_COMPILE_OPTION.exec(option);
|
|
74
|
+
if (match !== null) return Number(match[1]);
|
|
75
|
+
}
|
|
76
|
+
return void 0;
|
|
77
|
+
}
|
|
78
|
+
function hasModernBindLimitByVersion(rows) {
|
|
79
|
+
const first = rows[0];
|
|
80
|
+
if (typeof first !== "object" || first === null) return false;
|
|
81
|
+
const version = first.version;
|
|
82
|
+
if (typeof version !== "string") return false;
|
|
83
|
+
const [major = 0, minor = 0] = version.split(".").map(Number);
|
|
84
|
+
if (!Number.isFinite(major) || !Number.isFinite(minor)) return false;
|
|
85
|
+
return major > FIRST_MODERN_BIND_LIMIT_MAJOR || major === FIRST_MODERN_BIND_LIMIT_MAJOR && minor >= FIRST_MODERN_BIND_LIMIT_MINOR;
|
|
86
|
+
}
|
|
87
|
+
function detectMaxBindParameters(db, sqliteClient) {
|
|
88
|
+
if (isD1DatabaseBySessionName(db)) return D1_MAX_BIND_PARAMETERS;
|
|
89
|
+
if (sqliteClient === void 0) return SQLITE_MAX_BIND_PARAMETERS;
|
|
90
|
+
try {
|
|
91
|
+
const compiled = parseCompiledMaxVariableNumber(
|
|
92
|
+
sqliteClient.prepare("PRAGMA compile_options").all()
|
|
93
|
+
);
|
|
94
|
+
if (compiled !== void 0) return compiled;
|
|
95
|
+
const isModern = hasModernBindLimitByVersion(
|
|
96
|
+
sqliteClient.prepare("SELECT sqlite_version() AS version").all()
|
|
97
|
+
);
|
|
98
|
+
return isModern ? MODERN_SQLITE_MAX_BIND_PARAMETERS : SQLITE_MAX_BIND_PARAMETERS;
|
|
99
|
+
} catch {
|
|
100
|
+
return SQLITE_MAX_BIND_PARAMETERS;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
64
103
|
function resolveSqliteClient(db) {
|
|
65
104
|
const databaseWithClient = db;
|
|
66
105
|
const sqliteClient = databaseWithClient.$client;
|
|
@@ -103,6 +142,7 @@ function createSqliteExecutionAdapter(db, statementCacheMaxOrOptions = {}) {
|
|
|
103
142
|
const transactionMode = detectTransactionMode(db, profileHints, isSync);
|
|
104
143
|
const profile = {
|
|
105
144
|
isSync,
|
|
145
|
+
maxBindParameters: detectMaxBindParameters(db, sqliteClient),
|
|
106
146
|
supportsCompiledExecution: sqliteClient !== void 0,
|
|
107
147
|
transactionMode
|
|
108
148
|
};
|
|
@@ -117,6 +157,19 @@ function createSqliteExecutionAdapter(db, statementCacheMaxOrOptions = {}) {
|
|
|
117
157
|
);
|
|
118
158
|
const rows = preparedStatement.all(...compiledQuery.params);
|
|
119
159
|
return Promise.resolve(rows);
|
|
160
|
+
}, executeCompiledRun2 = function(compiledQuery) {
|
|
161
|
+
const preparedStatement = getOrCreatePreparedStatement(
|
|
162
|
+
statementCache,
|
|
163
|
+
client,
|
|
164
|
+
compiledQuery.sql,
|
|
165
|
+
statementCacheMax
|
|
166
|
+
);
|
|
167
|
+
if (preparedStatement.run === void 0 || preparedStatement.reader === true) {
|
|
168
|
+
preparedStatement.all(...compiledQuery.params);
|
|
169
|
+
} else {
|
|
170
|
+
preparedStatement.run(...compiledQuery.params);
|
|
171
|
+
}
|
|
172
|
+
return Promise.resolve();
|
|
120
173
|
};
|
|
121
174
|
const client = sqliteClient;
|
|
122
175
|
const statementCache = /* @__PURE__ */ new Map();
|
|
@@ -130,6 +183,7 @@ function createSqliteExecutionAdapter(db, statementCacheMaxOrOptions = {}) {
|
|
|
130
183
|
return executeCompiled2(compiledQuery);
|
|
131
184
|
},
|
|
132
185
|
executeCompiled: executeCompiled2,
|
|
186
|
+
executeCompiledRun: executeCompiledRun2,
|
|
133
187
|
prepare(sqlText) {
|
|
134
188
|
return createPreparedStatementExecutor(
|
|
135
189
|
client,
|
|
@@ -155,27 +209,53 @@ function createSqliteExecutionAdapter(db, statementCacheMaxOrOptions = {}) {
|
|
|
155
209
|
// src/backend/drizzle/sqlite.ts
|
|
156
210
|
var NODE_INSERT_PARAM_COUNT = 9;
|
|
157
211
|
var EDGE_INSERT_PARAM_COUNT = 12;
|
|
158
|
-
var
|
|
159
|
-
|
|
160
|
-
Math.floor(SQLITE_MAX_BIND_PARAMETERS / NODE_INSERT_PARAM_COUNT)
|
|
161
|
-
);
|
|
162
|
-
var SQLITE_EDGE_INSERT_BATCH_SIZE = Math.max(
|
|
163
|
-
1,
|
|
164
|
-
Math.floor(SQLITE_MAX_BIND_PARAMETERS / EDGE_INSERT_PARAM_COUNT)
|
|
165
|
-
);
|
|
166
|
-
var SQLITE_GET_NODES_ID_CHUNK_SIZE = Math.max(
|
|
167
|
-
1,
|
|
168
|
-
SQLITE_MAX_BIND_PARAMETERS - 2
|
|
169
|
-
);
|
|
170
|
-
var SQLITE_GET_EDGES_ID_CHUNK_SIZE = Math.max(
|
|
171
|
-
1,
|
|
172
|
-
SQLITE_MAX_BIND_PARAMETERS - 1
|
|
173
|
-
);
|
|
212
|
+
var GET_NODES_FIXED_PARAM_COUNT = 2;
|
|
213
|
+
var GET_EDGES_FIXED_PARAM_COUNT = 1;
|
|
174
214
|
var CHECK_UNIQUE_BATCH_FIXED_PARAM_COUNT = 3;
|
|
175
|
-
var
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
215
|
+
var FULLTEXT_UPSERT_PARAM_COUNT = 6;
|
|
216
|
+
var FULLTEXT_DELETE_FIXED_PARAM_COUNT = 2;
|
|
217
|
+
var UNIQUE_INSERT_PARAM_COUNT = 6;
|
|
218
|
+
var SQLITE_ANALYZE_ROW_LIMIT = 1e3;
|
|
219
|
+
function computeSqliteBatchChunkSizes(maxBindParameters) {
|
|
220
|
+
return {
|
|
221
|
+
checkUniqueBatchChunkSize: Math.max(
|
|
222
|
+
1,
|
|
223
|
+
maxBindParameters - CHECK_UNIQUE_BATCH_FIXED_PARAM_COUNT
|
|
224
|
+
),
|
|
225
|
+
embeddingUpsertBatchSize: Math.max(
|
|
226
|
+
1,
|
|
227
|
+
Math.floor(maxBindParameters / EMBEDDING_UPSERT_PARAM_COUNT)
|
|
228
|
+
),
|
|
229
|
+
fulltextUpsertBatchSize: Math.max(
|
|
230
|
+
1,
|
|
231
|
+
Math.floor(maxBindParameters / FULLTEXT_UPSERT_PARAM_COUNT)
|
|
232
|
+
),
|
|
233
|
+
fulltextDeleteChunkSize: Math.max(
|
|
234
|
+
1,
|
|
235
|
+
maxBindParameters - FULLTEXT_DELETE_FIXED_PARAM_COUNT
|
|
236
|
+
),
|
|
237
|
+
edgeInsertBatchSize: Math.max(
|
|
238
|
+
1,
|
|
239
|
+
Math.floor(maxBindParameters / EDGE_INSERT_PARAM_COUNT)
|
|
240
|
+
),
|
|
241
|
+
getEdgesChunkSize: Math.max(
|
|
242
|
+
1,
|
|
243
|
+
maxBindParameters - GET_EDGES_FIXED_PARAM_COUNT
|
|
244
|
+
),
|
|
245
|
+
getNodesChunkSize: Math.max(
|
|
246
|
+
1,
|
|
247
|
+
maxBindParameters - GET_NODES_FIXED_PARAM_COUNT
|
|
248
|
+
),
|
|
249
|
+
nodeInsertBatchSize: Math.max(
|
|
250
|
+
1,
|
|
251
|
+
Math.floor(maxBindParameters / NODE_INSERT_PARAM_COUNT)
|
|
252
|
+
),
|
|
253
|
+
uniqueInsertBatchSize: Math.max(
|
|
254
|
+
1,
|
|
255
|
+
Math.floor(maxBindParameters / UNIQUE_INSERT_PARAM_COUNT)
|
|
256
|
+
)
|
|
257
|
+
};
|
|
258
|
+
}
|
|
179
259
|
var toNodeRow = createNodeRowMapper(SQLITE_ROW_MAPPER_CONFIG);
|
|
180
260
|
var toEdgeRow = createEdgeRowMapper(SQLITE_ROW_MAPPER_CONFIG);
|
|
181
261
|
var toUniqueRow = createUniqueRowMapper(SQLITE_ROW_MAPPER_CONFIG);
|
|
@@ -188,9 +268,30 @@ function pendingForever() {
|
|
|
188
268
|
}
|
|
189
269
|
function noop() {
|
|
190
270
|
}
|
|
271
|
+
var queueTaskContext;
|
|
272
|
+
async function loadQueueTaskContext() {
|
|
273
|
+
try {
|
|
274
|
+
const asyncHooks = await import('async_hooks');
|
|
275
|
+
queueTaskContext = new asyncHooks.AsyncLocalStorage();
|
|
276
|
+
} catch {
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
void loadQueueTaskContext();
|
|
280
|
+
function rejectReentrantQueueSubmission() {
|
|
281
|
+
return Promise.reject(
|
|
282
|
+
new ConfigurationError(
|
|
283
|
+
"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.",
|
|
284
|
+
{ backend: "sqlite", capability: "concurrentRootAccess" },
|
|
285
|
+
{
|
|
286
|
+
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."
|
|
287
|
+
}
|
|
288
|
+
)
|
|
289
|
+
);
|
|
290
|
+
}
|
|
191
291
|
function createSerializedExecutionQueue() {
|
|
192
292
|
let tail = Promise.resolve();
|
|
193
293
|
let disposed = false;
|
|
294
|
+
const taskMarker = {};
|
|
194
295
|
function isDisposed() {
|
|
195
296
|
return disposed;
|
|
196
297
|
}
|
|
@@ -200,10 +301,14 @@ function createSerializedExecutionQueue() {
|
|
|
200
301
|
},
|
|
201
302
|
runExclusive(task) {
|
|
202
303
|
if (isDisposed()) return Promise.reject(new BackendDisposedError());
|
|
304
|
+
if (queueTaskContext?.getStore() === taskMarker) {
|
|
305
|
+
return rejectReentrantQueueSubmission();
|
|
306
|
+
}
|
|
203
307
|
const runTask = async () => {
|
|
204
308
|
if (isDisposed()) return pendingForever();
|
|
205
309
|
try {
|
|
206
|
-
|
|
310
|
+
const context = queueTaskContext;
|
|
311
|
+
return context === void 0 ? await task() : await context.run(taskMarker, () => task());
|
|
207
312
|
} catch (error) {
|
|
208
313
|
if (isDisposed()) return pendingForever();
|
|
209
314
|
throw error;
|
|
@@ -233,6 +338,7 @@ function buildSqliteCapabilities(options) {
|
|
|
233
338
|
const base = options.transactionMode === "none" ? { ...SQLITE_CAPABILITIES, transactions: false } : SQLITE_CAPABILITIES;
|
|
234
339
|
return {
|
|
235
340
|
...base,
|
|
341
|
+
maxBindParameters: options.maxBindParameters,
|
|
236
342
|
fulltext: buildFulltextCapabilities(options.fulltextStrategy),
|
|
237
343
|
...options.vectorStrategy === void 0 ? {} : { vector: buildVectorCapabilities(options.vectorStrategy) }
|
|
238
344
|
};
|
|
@@ -249,30 +355,40 @@ function createSqliteOperationBackend(options) {
|
|
|
249
355
|
vectorStrategy,
|
|
250
356
|
vectorSlotLatch
|
|
251
357
|
} = options;
|
|
358
|
+
const compiledExecute = executionAdapter.executeCompiled;
|
|
359
|
+
const compiledRun = executionAdapter.executeCompiledRun;
|
|
252
360
|
function execGet(query) {
|
|
253
361
|
return runWithSerializedQueue(serializedQueue, async () => {
|
|
254
|
-
|
|
362
|
+
if (compiledExecute === void 0) {
|
|
363
|
+
const rows2 = await db.all(query);
|
|
364
|
+
return rows2[0];
|
|
365
|
+
}
|
|
366
|
+
const rows = await compiledExecute(executionAdapter.compile(query));
|
|
255
367
|
return rows[0];
|
|
256
368
|
});
|
|
257
369
|
}
|
|
258
370
|
function execAll(query) {
|
|
259
371
|
return runWithSerializedQueue(serializedQueue, async () => {
|
|
260
|
-
|
|
372
|
+
if (compiledExecute === void 0) {
|
|
373
|
+
return await db.all(query);
|
|
374
|
+
}
|
|
375
|
+
return [...await compiledExecute(executionAdapter.compile(query))];
|
|
261
376
|
});
|
|
262
377
|
}
|
|
263
378
|
function execRun(query) {
|
|
264
379
|
return runWithSerializedQueue(serializedQueue, async () => {
|
|
265
|
-
|
|
380
|
+
if (compiledRun === void 0) {
|
|
381
|
+
await db.run(query);
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
await compiledRun(executionAdapter.compile(query));
|
|
266
385
|
});
|
|
267
386
|
}
|
|
387
|
+
const batchConfig = computeSqliteBatchChunkSizes(
|
|
388
|
+
capabilities.maxBindParameters ?? SQLITE_MAX_BIND_PARAMETERS
|
|
389
|
+
);
|
|
268
390
|
const commonBackend = createCommonOperationBackend({
|
|
269
|
-
batchConfig
|
|
270
|
-
checkUniqueBatchChunkSize: SQLITE_CHECK_UNIQUE_BATCH_CHUNK_SIZE,
|
|
271
|
-
edgeInsertBatchSize: SQLITE_EDGE_INSERT_BATCH_SIZE,
|
|
272
|
-
getEdgesChunkSize: SQLITE_GET_EDGES_ID_CHUNK_SIZE,
|
|
273
|
-
getNodesChunkSize: SQLITE_GET_NODES_ID_CHUNK_SIZE,
|
|
274
|
-
nodeInsertBatchSize: SQLITE_NODE_INSERT_BATCH_SIZE
|
|
275
|
-
},
|
|
391
|
+
batchConfig,
|
|
276
392
|
execution: {
|
|
277
393
|
execAll,
|
|
278
394
|
execGet,
|
|
@@ -315,6 +431,48 @@ function createSqliteOperationBackend(options) {
|
|
|
315
431
|
throw mapVectorWriteError(error, params);
|
|
316
432
|
}
|
|
317
433
|
},
|
|
434
|
+
async upsertEmbeddingBatch(params) {
|
|
435
|
+
if (params.rows.length === 0) return;
|
|
436
|
+
const slot = vectorSlotFromParams(params);
|
|
437
|
+
await ensureVectorSlotStorage(slot);
|
|
438
|
+
const rowsById = new Map(
|
|
439
|
+
params.rows.map((row) => [row.nodeId, row])
|
|
440
|
+
);
|
|
441
|
+
const rows = [...rowsById.values()];
|
|
442
|
+
const timestamp = nowIso();
|
|
443
|
+
try {
|
|
444
|
+
for (const chunk2 of chunk(
|
|
445
|
+
rows,
|
|
446
|
+
batchConfig.embeddingUpsertBatchSize
|
|
447
|
+
)) {
|
|
448
|
+
const statements = vectorStrategy.buildUpsertBatch === void 0 ? chunk2.flatMap(
|
|
449
|
+
(row) => vectorStrategy.buildUpsert(
|
|
450
|
+
slot,
|
|
451
|
+
{
|
|
452
|
+
graphId: params.graphId,
|
|
453
|
+
nodeKind: params.nodeKind,
|
|
454
|
+
nodeId: row.nodeId,
|
|
455
|
+
fieldPath: params.fieldPath,
|
|
456
|
+
embedding: row.embedding,
|
|
457
|
+
dimensions: params.dimensions,
|
|
458
|
+
metric: params.metric,
|
|
459
|
+
indexType: params.indexType
|
|
460
|
+
},
|
|
461
|
+
timestamp
|
|
462
|
+
)
|
|
463
|
+
) : vectorStrategy.buildUpsertBatch(
|
|
464
|
+
slot,
|
|
465
|
+
{ ...params, rows: chunk2 },
|
|
466
|
+
timestamp
|
|
467
|
+
);
|
|
468
|
+
for (const statement of statements) {
|
|
469
|
+
await execRun(statement);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
} catch (error) {
|
|
473
|
+
throw mapVectorWriteError(error, params);
|
|
474
|
+
}
|
|
475
|
+
},
|
|
318
476
|
async deleteEmbedding(params) {
|
|
319
477
|
const slot = vectorSlotFromParams(params);
|
|
320
478
|
await ensureVectorSlotStorage(slot);
|
|
@@ -327,7 +485,16 @@ function createSqliteOperationBackend(options) {
|
|
|
327
485
|
assertVectorSearchLimit(params.limit);
|
|
328
486
|
const slot = vectorSlotFromParams(params);
|
|
329
487
|
await ensureVectorSlotStorage(slot);
|
|
330
|
-
const query = vectorStrategy.buildSearch(
|
|
488
|
+
const query = vectorStrategy.buildSearch(
|
|
489
|
+
slot,
|
|
490
|
+
params,
|
|
491
|
+
// Store-compiled candidates (predicates + subclass + currency)
|
|
492
|
+
// take precedence; the live-node default covers direct backend use.
|
|
493
|
+
params.candidates ?? operationStrategy.buildLiveNodeIds(
|
|
494
|
+
params.graphId,
|
|
495
|
+
params.nodeKind
|
|
496
|
+
)
|
|
497
|
+
);
|
|
331
498
|
let rows;
|
|
332
499
|
try {
|
|
333
500
|
rows = await execAll(query);
|
|
@@ -338,7 +505,57 @@ function createSqliteOperationBackend(options) {
|
|
|
338
505
|
nodeId: row.node_id,
|
|
339
506
|
score: row.score
|
|
340
507
|
}));
|
|
341
|
-
}
|
|
508
|
+
},
|
|
509
|
+
// Single-statement hybrid needs ROW_NUMBER(); a capability profile
|
|
510
|
+
// that disables window functions keeps the store's multi-statement
|
|
511
|
+
// fallback by simply not exposing the member.
|
|
512
|
+
...capabilities.windowFunctions ? {
|
|
513
|
+
async hybridSearch(params) {
|
|
514
|
+
assertVectorSearchLimit(params.limit);
|
|
515
|
+
assertVectorSearchLimit(params.vector.k);
|
|
516
|
+
const slot = vectorSlotFromParams({
|
|
517
|
+
graphId: params.graphId,
|
|
518
|
+
nodeKind: params.nodeKind,
|
|
519
|
+
fieldPath: params.vector.fieldPath,
|
|
520
|
+
dimensions: params.vector.dimensions,
|
|
521
|
+
metric: params.vector.metric,
|
|
522
|
+
indexType: params.vector.indexType
|
|
523
|
+
});
|
|
524
|
+
await ensureVectorSlotStorage(slot);
|
|
525
|
+
const candidates = params.candidates ?? operationStrategy.buildLiveNodeIds(
|
|
526
|
+
params.graphId,
|
|
527
|
+
params.nodeKind
|
|
528
|
+
);
|
|
529
|
+
const vectorParams = {
|
|
530
|
+
graphId: params.graphId,
|
|
531
|
+
nodeKind: params.nodeKind,
|
|
532
|
+
fieldPath: params.vector.fieldPath,
|
|
533
|
+
queryEmbedding: params.vector.queryEmbedding,
|
|
534
|
+
metric: params.vector.metric,
|
|
535
|
+
dimensions: params.vector.dimensions,
|
|
536
|
+
indexType: params.vector.indexType,
|
|
537
|
+
limit: params.vector.k,
|
|
538
|
+
...params.vector.minScore === void 0 ? {} : { minScore: params.vector.minScore }
|
|
539
|
+
};
|
|
540
|
+
const vectorSql = vectorStrategy.buildSearch(
|
|
541
|
+
slot,
|
|
542
|
+
vectorParams,
|
|
543
|
+
hybridCandidatesRef()
|
|
544
|
+
);
|
|
545
|
+
const statement = operationStrategy.buildHybridSearch(
|
|
546
|
+
{ ...params, candidates },
|
|
547
|
+
vectorSql,
|
|
548
|
+
params.vector.metric === "cosine"
|
|
549
|
+
);
|
|
550
|
+
let raw;
|
|
551
|
+
try {
|
|
552
|
+
raw = await execAll(statement);
|
|
553
|
+
} catch (error) {
|
|
554
|
+
throw mapVectorWriteError(error, vectorParams);
|
|
555
|
+
}
|
|
556
|
+
return raw.map((row) => mapHybridSearchRow(row, toNodeRow));
|
|
557
|
+
}
|
|
558
|
+
} : {}
|
|
342
559
|
};
|
|
343
560
|
const operationBackend = {
|
|
344
561
|
...commonBackend,
|
|
@@ -389,19 +606,32 @@ function createSqliteOperationBackend(options) {
|
|
|
389
606
|
async upsertFulltextBatch(params) {
|
|
390
607
|
if (params.rows.length === 0) return;
|
|
391
608
|
const timestamp = nowIso();
|
|
392
|
-
const
|
|
393
|
-
params,
|
|
394
|
-
|
|
395
|
-
)
|
|
396
|
-
|
|
397
|
-
|
|
609
|
+
for (const rows of chunk(
|
|
610
|
+
params.rows,
|
|
611
|
+
batchConfig.fulltextUpsertBatchSize
|
|
612
|
+
)) {
|
|
613
|
+
const statements = operationStrategy.buildUpsertFulltextBatch(
|
|
614
|
+
{ ...params, rows },
|
|
615
|
+
timestamp
|
|
616
|
+
);
|
|
617
|
+
for (const stmt of statements) {
|
|
618
|
+
await execRun(stmt);
|
|
619
|
+
}
|
|
398
620
|
}
|
|
399
621
|
},
|
|
400
622
|
async deleteFulltextBatch(params) {
|
|
401
623
|
if (params.nodeIds.length === 0) return;
|
|
402
|
-
const
|
|
403
|
-
|
|
404
|
-
|
|
624
|
+
for (const nodeIds of chunk(
|
|
625
|
+
params.nodeIds,
|
|
626
|
+
batchConfig.fulltextDeleteChunkSize
|
|
627
|
+
)) {
|
|
628
|
+
const statements = operationStrategy.buildDeleteFulltextBatch({
|
|
629
|
+
...params,
|
|
630
|
+
nodeIds
|
|
631
|
+
});
|
|
632
|
+
for (const stmt of statements) {
|
|
633
|
+
await execRun(stmt);
|
|
634
|
+
}
|
|
405
635
|
}
|
|
406
636
|
},
|
|
407
637
|
async fulltextSearch(params) {
|
|
@@ -439,7 +669,8 @@ function createSqliteBackend(db, options = {}) {
|
|
|
439
669
|
...buildSqliteCapabilities({
|
|
440
670
|
fulltextStrategy,
|
|
441
671
|
vectorStrategy,
|
|
442
|
-
transactionMode
|
|
672
|
+
transactionMode,
|
|
673
|
+
maxBindParameters: executionAdapter.profile.maxBindParameters
|
|
443
674
|
}),
|
|
444
675
|
...options.capabilities
|
|
445
676
|
};
|
|
@@ -449,14 +680,26 @@ function createSqliteBackend(db, options = {}) {
|
|
|
449
680
|
recordedNodes: getTableName(tables2.recordedNodes),
|
|
450
681
|
recordedEdges: getTableName(tables2.recordedEdges),
|
|
451
682
|
recordedClock: getTableName(tables2.recordedClock),
|
|
683
|
+
revisionOrigins: getTableName(tables2.revisionOrigins),
|
|
452
684
|
fulltext: tables2.fulltextTableName,
|
|
453
685
|
uniques: getTableName(tables2.uniques)
|
|
454
686
|
};
|
|
687
|
+
const coreAnalyzeTables = [
|
|
688
|
+
tableNames.nodes,
|
|
689
|
+
tableNames.edges,
|
|
690
|
+
tableNames.uniques,
|
|
691
|
+
tableNames.fulltext
|
|
692
|
+
];
|
|
693
|
+
const recordedAnalyzeTables = [
|
|
694
|
+
tableNames.recordedNodes,
|
|
695
|
+
tableNames.recordedEdges,
|
|
696
|
+
tableNames.recordedClock
|
|
697
|
+
];
|
|
455
698
|
const operationStrategy = createSqliteOperationStrategy(
|
|
456
699
|
tables2,
|
|
457
700
|
fulltextStrategy
|
|
458
701
|
);
|
|
459
|
-
const serializedQueue =
|
|
702
|
+
const serializedQueue = transactionMode === "none" ? void 0 : createSerializedExecutionQueue();
|
|
460
703
|
const operations = createSqliteOperationBackend({
|
|
461
704
|
capabilities,
|
|
462
705
|
db,
|
|
@@ -481,6 +724,14 @@ function createSqliteBackend(db, options = {}) {
|
|
|
481
724
|
async () => storageTransaction.call(storage, run)
|
|
482
725
|
);
|
|
483
726
|
}
|
|
727
|
+
async function runFrameStatement(query) {
|
|
728
|
+
const compiledRun = executionAdapter.executeCompiledRun;
|
|
729
|
+
if (compiledRun === void 0) {
|
|
730
|
+
await db.run(query);
|
|
731
|
+
return;
|
|
732
|
+
}
|
|
733
|
+
await compiledRun(executionAdapter.compile(query));
|
|
734
|
+
}
|
|
484
735
|
function runSchemaWriteTransaction(fn) {
|
|
485
736
|
if (transactionMode === "none") {
|
|
486
737
|
throwSqliteTransactionsDisabled(
|
|
@@ -494,17 +745,17 @@ function createSqliteBackend(db, options = {}) {
|
|
|
494
745
|
db,
|
|
495
746
|
executionAdapter,
|
|
496
747
|
operationStrategy,
|
|
497
|
-
profileHints: { isSync
|
|
748
|
+
profileHints: { isSync },
|
|
498
749
|
tableNames,
|
|
499
750
|
fulltextStrategy,
|
|
500
751
|
vectorStrategy});
|
|
501
|
-
|
|
752
|
+
await runFrameStatement(sql`BEGIN IMMEDIATE`);
|
|
502
753
|
try {
|
|
503
754
|
const result = await fn(txBackend);
|
|
504
|
-
|
|
755
|
+
await runFrameStatement(sql`COMMIT`);
|
|
505
756
|
return result;
|
|
506
757
|
} catch (error) {
|
|
507
|
-
|
|
758
|
+
await runFrameStatement(sql`ROLLBACK`);
|
|
508
759
|
throw error;
|
|
509
760
|
}
|
|
510
761
|
});
|
|
@@ -609,6 +860,11 @@ function createSqliteBackend(db, options = {}) {
|
|
|
609
860
|
await db.run(sql.raw(statement));
|
|
610
861
|
}
|
|
611
862
|
},
|
|
863
|
+
async ensureRevisionOriginsTable() {
|
|
864
|
+
await db.run(
|
|
865
|
+
sql.raw(generateSqliteCreateTableSQL(tables2.revisionOrigins))
|
|
866
|
+
);
|
|
867
|
+
},
|
|
612
868
|
// Every fulltext-touching method asserts the durable marker instead
|
|
613
869
|
// of lazily emitting DDL. Steady state performs zero ensure; an
|
|
614
870
|
// uninitialized database throws `StoreNotInitializedError` rather
|
|
@@ -726,7 +982,19 @@ function createSqliteBackend(db, options = {}) {
|
|
|
726
982
|
});
|
|
727
983
|
},
|
|
728
984
|
async refreshStatistics() {
|
|
729
|
-
await db.run(
|
|
985
|
+
await db.run(
|
|
986
|
+
sql`PRAGMA analysis_limit = ${sql.raw(String(SQLITE_ANALYZE_ROW_LIMIT))}`
|
|
987
|
+
);
|
|
988
|
+
for (const tableName of coreAnalyzeTables) {
|
|
989
|
+
await db.run(sql`ANALYZE ${quoteIdentifier(tableName)}`);
|
|
990
|
+
}
|
|
991
|
+
for (const tableName of recordedAnalyzeTables) {
|
|
992
|
+
try {
|
|
993
|
+
await db.run(sql`ANALYZE ${quoteIdentifier(tableName)}`);
|
|
994
|
+
} catch (error) {
|
|
995
|
+
if (!isMissingTableError(error)) throw error;
|
|
996
|
+
}
|
|
997
|
+
}
|
|
730
998
|
},
|
|
731
999
|
async commitSchemaVersion(params) {
|
|
732
1000
|
return runSchemaWriteTransaction(
|
|
@@ -751,11 +1019,11 @@ function createSqliteBackend(db, options = {}) {
|
|
|
751
1019
|
db,
|
|
752
1020
|
executionAdapter,
|
|
753
1021
|
operationStrategy,
|
|
754
|
-
profileHints: { isSync
|
|
1022
|
+
profileHints: { isSync },
|
|
755
1023
|
tableNames,
|
|
756
1024
|
fulltextStrategy,
|
|
757
1025
|
vectorStrategy});
|
|
758
|
-
|
|
1026
|
+
await runFrameStatement(sql`BEGIN IMMEDIATE`);
|
|
759
1027
|
try {
|
|
760
1028
|
const result = await fn(
|
|
761
1029
|
gateFulltext(
|
|
@@ -764,10 +1032,10 @@ function createSqliteBackend(db, options = {}) {
|
|
|
764
1032
|
),
|
|
765
1033
|
db
|
|
766
1034
|
);
|
|
767
|
-
|
|
1035
|
+
await runFrameStatement(sql`COMMIT`);
|
|
768
1036
|
return result;
|
|
769
1037
|
} catch (error) {
|
|
770
|
-
|
|
1038
|
+
await runFrameStatement(sql`ROLLBACK`);
|
|
771
1039
|
throw error;
|
|
772
1040
|
}
|
|
773
1041
|
});
|
|
@@ -779,9 +1047,9 @@ function createSqliteBackend(db, options = {}) {
|
|
|
779
1047
|
}
|
|
780
1048
|
return runWithSerializedQueue(
|
|
781
1049
|
serializedQueue,
|
|
782
|
-
async () => db.transaction(
|
|
783
|
-
|
|
784
|
-
)
|
|
1050
|
+
async () => db.transaction(async (tx) => fn(bindTransactionBackend(tx), tx), {
|
|
1051
|
+
behavior: "immediate"
|
|
1052
|
+
})
|
|
785
1053
|
);
|
|
786
1054
|
},
|
|
787
1055
|
adoptTransaction(externalTx) {
|
|
@@ -821,5 +1089,5 @@ function createTransactionBackend(options) {
|
|
|
821
1089
|
}
|
|
822
1090
|
|
|
823
1091
|
export { createSqliteBackend };
|
|
824
|
-
//# sourceMappingURL=chunk-
|
|
825
|
-
//# sourceMappingURL=chunk-
|
|
1092
|
+
//# sourceMappingURL=chunk-3TWF3SH4.js.map
|
|
1093
|
+
//# sourceMappingURL=chunk-3TWF3SH4.js.map
|