@nicia-ai/typegraph 0.35.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backend/postgres/index.cjs +19 -19
- package/dist/backend/postgres/index.js +6 -6
- package/dist/backend/postgres/pglite.cjs +11 -11
- package/dist/backend/postgres/pglite.js +6 -6
- package/dist/backend/sqlite/index.cjs +9 -9
- package/dist/backend/sqlite/index.js +6 -6
- package/dist/backend/sqlite/libsql.cjs +8 -8
- package/dist/backend/sqlite/libsql.js +6 -6
- package/dist/backend/sqlite/local.cjs +16 -16
- package/dist/backend/sqlite/local.js +6 -6
- package/dist/{chunk-VPYHY3LJ.cjs → chunk-2THZ3TQI.cjs} +11 -11
- package/dist/{chunk-VPYHY3LJ.cjs.map → chunk-2THZ3TQI.cjs.map} +1 -1
- package/dist/{chunk-EM3CWPND.cjs → chunk-456Z2U7Y.cjs} +51 -51
- package/dist/{chunk-EM3CWPND.cjs.map → chunk-456Z2U7Y.cjs.map} +1 -1
- package/dist/{chunk-GSQ6NPH6.cjs → chunk-4BCU6VFZ.cjs} +7 -7
- package/dist/{chunk-GSQ6NPH6.cjs.map → chunk-4BCU6VFZ.cjs.map} +1 -1
- package/dist/chunk-4BMPGT35.cjs +12 -0
- package/dist/{chunk-GUR2FNB5.cjs.map → chunk-4BMPGT35.cjs.map} +1 -1
- package/dist/{chunk-WJT7OU7E.cjs → chunk-4CAXEB2F.cjs} +124 -92
- package/dist/chunk-4CAXEB2F.cjs.map +1 -0
- package/dist/{chunk-WDBCBWC4.js → chunk-4GX2JJXS.js} +6 -6
- package/dist/{chunk-WDBCBWC4.js.map → chunk-4GX2JJXS.js.map} +1 -1
- package/dist/{chunk-UES55P7G.js → chunk-5DIPR3L3.js} +284 -154
- package/dist/chunk-5DIPR3L3.js.map +1 -0
- package/dist/{chunk-CZQ3FO2Q.js → chunk-5VTR2F2K.js} +49 -16
- package/dist/chunk-5VTR2F2K.js.map +1 -0
- package/dist/{chunk-CTTSDJLY.cjs → chunk-5W4L6DLF.cjs} +11 -11
- package/dist/{chunk-CTTSDJLY.cjs.map → chunk-5W4L6DLF.cjs.map} +1 -1
- package/dist/{chunk-J7WFGBJR.cjs → chunk-7BQLPXK6.cjs} +865 -735
- package/dist/chunk-7BQLPXK6.cjs.map +1 -0
- package/dist/{chunk-3TWF3SH4.js → chunk-BJVEU3ZL.js} +7 -7
- package/dist/{chunk-3TWF3SH4.js.map → chunk-BJVEU3ZL.js.map} +1 -1
- package/dist/{chunk-LGEALRC6.cjs → chunk-DIK74MXX.cjs} +18 -2
- package/dist/chunk-DIK74MXX.cjs.map +1 -0
- package/dist/{chunk-QNKSQTKQ.js → chunk-DN5VP4JC.js} +48 -17
- package/dist/chunk-DN5VP4JC.js.map +1 -0
- package/dist/{chunk-4JEZZJ6S.cjs → chunk-HW3LW7DH.cjs} +39 -39
- package/dist/{chunk-4JEZZJ6S.cjs.map → chunk-HW3LW7DH.cjs.map} +1 -1
- package/dist/{chunk-JBTOYDMN.js → chunk-IU46OHVW.js} +4 -4
- package/dist/{chunk-JBTOYDMN.js.map → chunk-IU46OHVW.js.map} +1 -1
- package/dist/{chunk-FL472AMI.cjs → chunk-J3LEGNQB.cjs} +8 -8
- package/dist/{chunk-FL472AMI.cjs.map → chunk-J3LEGNQB.cjs.map} +1 -1
- package/dist/{chunk-O7UN7OXA.cjs → chunk-JFMEONLG.cjs} +80 -80
- package/dist/{chunk-O7UN7OXA.cjs.map → chunk-JFMEONLG.cjs.map} +1 -1
- package/dist/{chunk-I7ZUZKFD.js → chunk-JFUPDJXD.js} +3 -3
- package/dist/{chunk-I7ZUZKFD.js.map → chunk-JFUPDJXD.js.map} +1 -1
- package/dist/{chunk-K3PPLHY7.js → chunk-M75SUBFG.js} +7 -7
- package/dist/{chunk-K3PPLHY7.js.map → chunk-M75SUBFG.js.map} +1 -1
- package/dist/{chunk-CK5BVQOW.cjs → chunk-PWGX5DF5.cjs} +79 -79
- package/dist/{chunk-CK5BVQOW.cjs.map → chunk-PWGX5DF5.cjs.map} +1 -1
- package/dist/{chunk-KMI7LYAF.js → chunk-PZKNKG5M.js} +8 -8
- package/dist/{chunk-KMI7LYAF.js.map → chunk-PZKNKG5M.js.map} +1 -1
- package/dist/{chunk-55MZDDZV.js → chunk-RAXU3RMB.js} +4 -4
- package/dist/{chunk-55MZDDZV.js.map → chunk-RAXU3RMB.js.map} +1 -1
- package/dist/{chunk-BLZDPRXT.cjs → chunk-RSSQKPSZ.cjs} +5 -5
- package/dist/{chunk-BLZDPRXT.cjs.map → chunk-RSSQKPSZ.cjs.map} +1 -1
- package/dist/{chunk-RGPG7EOJ.js → chunk-S5F7ZLP2.js} +3 -3
- package/dist/{chunk-RGPG7EOJ.js.map → chunk-S5F7ZLP2.js.map} +1 -1
- package/dist/{chunk-QWEUYILR.js → chunk-SKCOUWAX.js} +3 -3
- package/dist/{chunk-QWEUYILR.js.map → chunk-SKCOUWAX.js.map} +1 -1
- package/dist/{chunk-QOTI55H7.js → chunk-SXGE7ITL.js} +4 -4
- package/dist/{chunk-QOTI55H7.js.map → chunk-SXGE7ITL.js.map} +1 -1
- package/dist/{chunk-RGP33ZJ5.js → chunk-VQEXF5D4.js} +7 -7
- package/dist/{chunk-RGP33ZJ5.js.map → chunk-VQEXF5D4.js.map} +1 -1
- package/dist/{chunk-MP2JQKSG.js → chunk-WI7ISNQF.js} +17 -3
- package/dist/chunk-WI7ISNQF.js.map +1 -0
- package/dist/{chunk-4TOD4LBZ.cjs → chunk-X4JBT642.cjs} +29 -29
- package/dist/{chunk-4TOD4LBZ.cjs.map → chunk-X4JBT642.cjs.map} +1 -1
- package/dist/{chunk-EMF62TZG.cjs → chunk-ZAMFOJ5P.cjs} +86 -86
- package/dist/{chunk-EMF62TZG.cjs.map → chunk-ZAMFOJ5P.cjs.map} +1 -1
- package/dist/{chunk-VSPCZAXF.js → chunk-ZIGXMKQQ.js} +3 -3
- package/dist/{chunk-VSPCZAXF.js.map → chunk-ZIGXMKQQ.js.map} +1 -1
- package/dist/{chunk-XOX22WHL.cjs → chunk-ZUNQ5BEP.cjs} +104 -71
- package/dist/chunk-ZUNQ5BEP.cjs.map +1 -0
- package/dist/graph-extension/index.cjs +19 -19
- package/dist/graph-extension/index.d.cts +1 -1
- package/dist/graph-extension/index.d.ts +1 -1
- package/dist/graph-extension/index.js +4 -4
- package/dist/graph-merge/index.cjs +82 -82
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +2 -2
- package/dist/graph-merge/index.d.ts +2 -2
- package/dist/graph-merge/index.js +13 -13
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-6CSUAq-x.d.ts → index-BFvdmBPV.d.ts} +68 -1
- package/dist/{index-Bks_3HHK.d.cts → index-BLtQWKRj.d.cts} +68 -1
- package/dist/index.cjs +144 -136
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +14 -14
- package/dist/interchange/index.cjs +27 -26
- package/dist/interchange/index.d.cts +1 -1
- package/dist/interchange/index.d.ts +1 -1
- package/dist/interchange/index.js +9 -8
- package/dist/profiler/index.d.cts +1 -1
- package/dist/profiler/index.d.ts +1 -1
- package/dist/provenance/index.cjs +31 -31
- package/dist/provenance/index.d.cts +1 -1
- package/dist/provenance/index.d.ts +1 -1
- package/dist/provenance/index.js +4 -4
- package/dist/schema/index.cjs +31 -31
- package/dist/schema/index.d.cts +1 -1
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/index.js +7 -7
- package/dist/{store-view-BSpqvAxK.d.cts → store-view-9KDOpZzF.d.cts} +250 -36
- package/dist/{store-view-CKbHFRnn.d.ts → store-view-DplHC3Nt.d.ts} +250 -36
- package/package.json +1 -1
- package/dist/chunk-CZQ3FO2Q.js.map +0 -1
- package/dist/chunk-GUR2FNB5.cjs +0 -12
- package/dist/chunk-J7WFGBJR.cjs.map +0 -1
- package/dist/chunk-LGEALRC6.cjs.map +0 -1
- package/dist/chunk-MP2JQKSG.js.map +0 -1
- package/dist/chunk-QNKSQTKQ.js.map +0 -1
- package/dist/chunk-UES55P7G.js.map +0 -1
- package/dist/chunk-WJT7OU7E.cjs.map +0 -1
- package/dist/chunk-XOX22WHL.cjs.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk456Z2U7Y_cjs = require('./chunk-456Z2U7Y.cjs');
|
|
4
4
|
var chunkFN35DLCN_cjs = require('./chunk-FN35DLCN.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunk5W4L6DLF_cjs = require('./chunk-5W4L6DLF.cjs');
|
|
6
6
|
var chunkD7ZEOS56_cjs = require('./chunk-D7ZEOS56.cjs');
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
7
|
+
var chunkX4JBT642_cjs = require('./chunk-X4JBT642.cjs');
|
|
8
|
+
var chunkRSSQKPSZ_cjs = require('./chunk-RSSQKPSZ.cjs');
|
|
9
|
+
var chunkDIK74MXX_cjs = require('./chunk-DIK74MXX.cjs');
|
|
10
10
|
var drizzleOrm = require('drizzle-orm');
|
|
11
11
|
var sqliteCore = require('drizzle-orm/sqlite-core');
|
|
12
12
|
|
|
@@ -87,8 +87,8 @@ function hasModernBindLimitByVersion(rows) {
|
|
|
87
87
|
return major > FIRST_MODERN_BIND_LIMIT_MAJOR || major === FIRST_MODERN_BIND_LIMIT_MAJOR && minor >= FIRST_MODERN_BIND_LIMIT_MINOR;
|
|
88
88
|
}
|
|
89
89
|
function detectMaxBindParameters(db, sqliteClient) {
|
|
90
|
-
if (isD1DatabaseBySessionName(db)) return
|
|
91
|
-
if (sqliteClient === void 0) return
|
|
90
|
+
if (isD1DatabaseBySessionName(db)) return chunkX4JBT642_cjs.D1_MAX_BIND_PARAMETERS;
|
|
91
|
+
if (sqliteClient === void 0) return chunkX4JBT642_cjs.SQLITE_MAX_BIND_PARAMETERS;
|
|
92
92
|
try {
|
|
93
93
|
const compiled = parseCompiledMaxVariableNumber(
|
|
94
94
|
sqliteClient.prepare("PRAGMA compile_options").all()
|
|
@@ -97,9 +97,9 @@ function detectMaxBindParameters(db, sqliteClient) {
|
|
|
97
97
|
const isModern = hasModernBindLimitByVersion(
|
|
98
98
|
sqliteClient.prepare("SELECT sqlite_version() AS version").all()
|
|
99
99
|
);
|
|
100
|
-
return isModern ?
|
|
100
|
+
return isModern ? chunkX4JBT642_cjs.MODERN_SQLITE_MAX_BIND_PARAMETERS : chunkX4JBT642_cjs.SQLITE_MAX_BIND_PARAMETERS;
|
|
101
101
|
} catch {
|
|
102
|
-
return
|
|
102
|
+
return chunkX4JBT642_cjs.SQLITE_MAX_BIND_PARAMETERS;
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
function resolveSqliteClient(db) {
|
|
@@ -111,7 +111,7 @@ function resolveSqliteClient(db) {
|
|
|
111
111
|
return sqliteClient;
|
|
112
112
|
}
|
|
113
113
|
function getOrCreatePreparedStatement(cache, sqliteClient, sqlText, cacheMax) {
|
|
114
|
-
return
|
|
114
|
+
return chunk456Z2U7Y_cjs.getOrCreateLru(
|
|
115
115
|
cache,
|
|
116
116
|
sqlText,
|
|
117
117
|
cacheMax,
|
|
@@ -148,7 +148,7 @@ function createSqliteExecutionAdapter(db, statementCacheMaxOrOptions = {}) {
|
|
|
148
148
|
supportsCompiledExecution: sqliteClient !== void 0,
|
|
149
149
|
transactionMode
|
|
150
150
|
};
|
|
151
|
-
const compile = (query) =>
|
|
151
|
+
const compile = (query) => chunk456Z2U7Y_cjs.compileQueryWithDialect(db, query, "SQLite");
|
|
152
152
|
if (sqliteClient !== void 0) {
|
|
153
153
|
let executeCompiled2 = function(compiledQuery) {
|
|
154
154
|
const preparedStatement = getOrCreatePreparedStatement(
|
|
@@ -226,7 +226,7 @@ function computeSqliteBatchChunkSizes(maxBindParameters) {
|
|
|
226
226
|
),
|
|
227
227
|
embeddingUpsertBatchSize: Math.max(
|
|
228
228
|
1,
|
|
229
|
-
Math.floor(maxBindParameters /
|
|
229
|
+
Math.floor(maxBindParameters / chunk456Z2U7Y_cjs.EMBEDDING_UPSERT_PARAM_COUNT)
|
|
230
230
|
),
|
|
231
231
|
fulltextUpsertBatchSize: Math.max(
|
|
232
232
|
1,
|
|
@@ -258,11 +258,11 @@ function computeSqliteBatchChunkSizes(maxBindParameters) {
|
|
|
258
258
|
)
|
|
259
259
|
};
|
|
260
260
|
}
|
|
261
|
-
var toNodeRow =
|
|
262
|
-
var toEdgeRow =
|
|
263
|
-
var toUniqueRow =
|
|
264
|
-
var toSchemaVersionRow =
|
|
265
|
-
|
|
261
|
+
var toNodeRow = chunk5W4L6DLF_cjs.createNodeRowMapper(chunk5W4L6DLF_cjs.SQLITE_ROW_MAPPER_CONFIG);
|
|
262
|
+
var toEdgeRow = chunk5W4L6DLF_cjs.createEdgeRowMapper(chunk5W4L6DLF_cjs.SQLITE_ROW_MAPPER_CONFIG);
|
|
263
|
+
var toUniqueRow = chunk5W4L6DLF_cjs.createUniqueRowMapper(chunk5W4L6DLF_cjs.SQLITE_ROW_MAPPER_CONFIG);
|
|
264
|
+
var toSchemaVersionRow = chunk5W4L6DLF_cjs.createSchemaVersionRowMapper(
|
|
265
|
+
chunk5W4L6DLF_cjs.SQLITE_ROW_MAPPER_CONFIG
|
|
266
266
|
);
|
|
267
267
|
var PENDING_FOREVER = new Promise(noop);
|
|
268
268
|
function pendingForever() {
|
|
@@ -281,7 +281,7 @@ async function loadQueueTaskContext() {
|
|
|
281
281
|
void loadQueueTaskContext();
|
|
282
282
|
function rejectReentrantQueueSubmission() {
|
|
283
283
|
return Promise.reject(
|
|
284
|
-
new
|
|
284
|
+
new chunkDIK74MXX_cjs.ConfigurationError(
|
|
285
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
286
|
{ backend: "sqlite", capability: "concurrentRootAccess" },
|
|
287
287
|
{
|
|
@@ -302,7 +302,7 @@ function createSerializedExecutionQueue() {
|
|
|
302
302
|
disposed = true;
|
|
303
303
|
},
|
|
304
304
|
runExclusive(task) {
|
|
305
|
-
if (isDisposed()) return Promise.reject(new
|
|
305
|
+
if (isDisposed()) return Promise.reject(new chunkDIK74MXX_cjs.BackendDisposedError());
|
|
306
306
|
if (queueTaskContext?.getStore() === taskMarker) {
|
|
307
307
|
return rejectReentrantQueueSubmission();
|
|
308
308
|
}
|
|
@@ -330,14 +330,14 @@ function runWithSerializedQueue(queue, task) {
|
|
|
330
330
|
return queue.runExclusive(task);
|
|
331
331
|
}
|
|
332
332
|
function throwSqliteTransactionsDisabled(message) {
|
|
333
|
-
throw new
|
|
333
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(message, {
|
|
334
334
|
backend: "sqlite",
|
|
335
335
|
capability: "transactions",
|
|
336
336
|
supportsTransactions: false
|
|
337
337
|
});
|
|
338
338
|
}
|
|
339
339
|
function buildSqliteCapabilities(options) {
|
|
340
|
-
const base = options.transactionMode === "none" ? { ...
|
|
340
|
+
const base = options.transactionMode === "none" ? { ...chunkX4JBT642_cjs.SQLITE_CAPABILITIES, transactions: false } : chunkX4JBT642_cjs.SQLITE_CAPABILITIES;
|
|
341
341
|
return {
|
|
342
342
|
...base,
|
|
343
343
|
maxBindParameters: options.maxBindParameters,
|
|
@@ -387,16 +387,16 @@ function createSqliteOperationBackend(options) {
|
|
|
387
387
|
});
|
|
388
388
|
}
|
|
389
389
|
const batchConfig = computeSqliteBatchChunkSizes(
|
|
390
|
-
capabilities.maxBindParameters ??
|
|
390
|
+
capabilities.maxBindParameters ?? chunkX4JBT642_cjs.SQLITE_MAX_BIND_PARAMETERS
|
|
391
391
|
);
|
|
392
|
-
const commonBackend =
|
|
392
|
+
const commonBackend = chunk456Z2U7Y_cjs.createCommonOperationBackend({
|
|
393
393
|
batchConfig,
|
|
394
394
|
execution: {
|
|
395
395
|
execAll,
|
|
396
396
|
execGet,
|
|
397
397
|
execRun
|
|
398
398
|
},
|
|
399
|
-
nowIso:
|
|
399
|
+
nowIso: chunk5W4L6DLF_cjs.nowIso,
|
|
400
400
|
operationStrategy,
|
|
401
401
|
rowMappers: {
|
|
402
402
|
toEdgeRow,
|
|
@@ -422,28 +422,28 @@ function createSqliteOperationBackend(options) {
|
|
|
422
422
|
}
|
|
423
423
|
const vectorEmbeddingMethods = vectorStrategy === void 0 ? {} : {
|
|
424
424
|
async upsertEmbedding(params) {
|
|
425
|
-
const slot =
|
|
425
|
+
const slot = chunk456Z2U7Y_cjs.vectorSlotFromParams(params);
|
|
426
426
|
await ensureVectorSlotStorage(slot);
|
|
427
|
-
const statements = vectorStrategy.buildUpsert(slot, params,
|
|
427
|
+
const statements = vectorStrategy.buildUpsert(slot, params, chunk5W4L6DLF_cjs.nowIso());
|
|
428
428
|
try {
|
|
429
429
|
for (const statement of statements) {
|
|
430
430
|
await execRun(statement);
|
|
431
431
|
}
|
|
432
432
|
} catch (error) {
|
|
433
|
-
throw
|
|
433
|
+
throw chunk456Z2U7Y_cjs.mapVectorWriteError(error, params);
|
|
434
434
|
}
|
|
435
435
|
},
|
|
436
436
|
async upsertEmbeddingBatch(params) {
|
|
437
437
|
if (params.rows.length === 0) return;
|
|
438
|
-
const slot =
|
|
438
|
+
const slot = chunk456Z2U7Y_cjs.vectorSlotFromParams(params);
|
|
439
439
|
await ensureVectorSlotStorage(slot);
|
|
440
440
|
const rowsById = new Map(
|
|
441
441
|
params.rows.map((row) => [row.nodeId, row])
|
|
442
442
|
);
|
|
443
443
|
const rows = [...rowsById.values()];
|
|
444
|
-
const timestamp =
|
|
444
|
+
const timestamp = chunk5W4L6DLF_cjs.nowIso();
|
|
445
445
|
try {
|
|
446
|
-
for (const chunk2 of
|
|
446
|
+
for (const chunk2 of chunkX4JBT642_cjs.chunk(
|
|
447
447
|
rows,
|
|
448
448
|
batchConfig.embeddingUpsertBatchSize
|
|
449
449
|
)) {
|
|
@@ -472,11 +472,11 @@ function createSqliteOperationBackend(options) {
|
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
474
|
} catch (error) {
|
|
475
|
-
throw
|
|
475
|
+
throw chunk456Z2U7Y_cjs.mapVectorWriteError(error, params);
|
|
476
476
|
}
|
|
477
477
|
},
|
|
478
478
|
async deleteEmbedding(params) {
|
|
479
|
-
const slot =
|
|
479
|
+
const slot = chunk456Z2U7Y_cjs.vectorSlotFromParams(params);
|
|
480
480
|
await ensureVectorSlotStorage(slot);
|
|
481
481
|
const statements = vectorStrategy.buildDelete(slot, params);
|
|
482
482
|
for (const statement of statements) {
|
|
@@ -485,7 +485,7 @@ function createSqliteOperationBackend(options) {
|
|
|
485
485
|
},
|
|
486
486
|
async vectorSearch(params) {
|
|
487
487
|
chunkD7ZEOS56_cjs.assertVectorSearchLimit(params.limit);
|
|
488
|
-
const slot =
|
|
488
|
+
const slot = chunk456Z2U7Y_cjs.vectorSlotFromParams(params);
|
|
489
489
|
await ensureVectorSlotStorage(slot);
|
|
490
490
|
const query = vectorStrategy.buildSearch(
|
|
491
491
|
slot,
|
|
@@ -501,7 +501,7 @@ function createSqliteOperationBackend(options) {
|
|
|
501
501
|
try {
|
|
502
502
|
rows = await execAll(query);
|
|
503
503
|
} catch (error) {
|
|
504
|
-
throw
|
|
504
|
+
throw chunk456Z2U7Y_cjs.mapVectorWriteError(error, params);
|
|
505
505
|
}
|
|
506
506
|
return rows.map((row) => ({
|
|
507
507
|
nodeId: row.node_id,
|
|
@@ -515,7 +515,7 @@ function createSqliteOperationBackend(options) {
|
|
|
515
515
|
async hybridSearch(params) {
|
|
516
516
|
chunkD7ZEOS56_cjs.assertVectorSearchLimit(params.limit);
|
|
517
517
|
chunkD7ZEOS56_cjs.assertVectorSearchLimit(params.vector.k);
|
|
518
|
-
const slot =
|
|
518
|
+
const slot = chunk456Z2U7Y_cjs.vectorSlotFromParams({
|
|
519
519
|
graphId: params.graphId,
|
|
520
520
|
nodeKind: params.nodeKind,
|
|
521
521
|
fieldPath: params.vector.fieldPath,
|
|
@@ -542,7 +542,7 @@ function createSqliteOperationBackend(options) {
|
|
|
542
542
|
const vectorSql = vectorStrategy.buildSearch(
|
|
543
543
|
slot,
|
|
544
544
|
vectorParams,
|
|
545
|
-
|
|
545
|
+
chunk456Z2U7Y_cjs.hybridCandidatesRef()
|
|
546
546
|
);
|
|
547
547
|
const statement = operationStrategy.buildHybridSearch(
|
|
548
548
|
{ ...params, candidates },
|
|
@@ -553,9 +553,9 @@ function createSqliteOperationBackend(options) {
|
|
|
553
553
|
try {
|
|
554
554
|
raw = await execAll(statement);
|
|
555
555
|
} catch (error) {
|
|
556
|
-
throw
|
|
556
|
+
throw chunk456Z2U7Y_cjs.mapVectorWriteError(error, vectorParams);
|
|
557
557
|
}
|
|
558
|
-
return raw.map((row) =>
|
|
558
|
+
return raw.map((row) => chunk456Z2U7Y_cjs.mapHybridSearchRow(row, toNodeRow));
|
|
559
559
|
}
|
|
560
560
|
} : {}
|
|
561
561
|
};
|
|
@@ -570,7 +570,7 @@ function createSqliteOperationBackend(options) {
|
|
|
570
570
|
...vectorStrategy === void 0 ? {} : { vectorStrategy },
|
|
571
571
|
async createVectorIndex(params) {
|
|
572
572
|
if (vectorStrategy === void 0) return;
|
|
573
|
-
const slot =
|
|
573
|
+
const slot = chunk456Z2U7Y_cjs.vectorSlotFromCreateIndexParams(params);
|
|
574
574
|
await ensureVectorSlotStorage(slot);
|
|
575
575
|
const indexStatement = vectorStrategy.buildCreateIndex?.(slot);
|
|
576
576
|
if (indexStatement !== void 0) {
|
|
@@ -579,18 +579,18 @@ function createSqliteOperationBackend(options) {
|
|
|
579
579
|
},
|
|
580
580
|
async dropVectorIndex(params) {
|
|
581
581
|
if (vectorStrategy === void 0) return;
|
|
582
|
-
const slot =
|
|
582
|
+
const slot = chunk456Z2U7Y_cjs.vectorSlotFromDropIndexParams(params);
|
|
583
583
|
const dropStatement = vectorStrategy.buildDropIndex?.(slot);
|
|
584
584
|
if (dropStatement === void 0) return;
|
|
585
585
|
try {
|
|
586
586
|
await execRun(dropStatement);
|
|
587
587
|
} catch (error) {
|
|
588
|
-
if (!
|
|
588
|
+
if (!chunkRSSQKPSZ_cjs.isMissingTableError(error)) throw error;
|
|
589
589
|
}
|
|
590
590
|
},
|
|
591
591
|
// === Fulltext Operations ===
|
|
592
592
|
async upsertFulltext(params) {
|
|
593
|
-
const timestamp =
|
|
593
|
+
const timestamp = chunk5W4L6DLF_cjs.nowIso();
|
|
594
594
|
const statements = operationStrategy.buildUpsertFulltext(
|
|
595
595
|
params,
|
|
596
596
|
timestamp
|
|
@@ -607,8 +607,8 @@ function createSqliteOperationBackend(options) {
|
|
|
607
607
|
},
|
|
608
608
|
async upsertFulltextBatch(params) {
|
|
609
609
|
if (params.rows.length === 0) return;
|
|
610
|
-
const timestamp =
|
|
611
|
-
for (const rows of
|
|
610
|
+
const timestamp = chunk5W4L6DLF_cjs.nowIso();
|
|
611
|
+
for (const rows of chunkX4JBT642_cjs.chunk(
|
|
612
612
|
params.rows,
|
|
613
613
|
batchConfig.fulltextUpsertBatchSize
|
|
614
614
|
)) {
|
|
@@ -623,7 +623,7 @@ function createSqliteOperationBackend(options) {
|
|
|
623
623
|
},
|
|
624
624
|
async deleteFulltextBatch(params) {
|
|
625
625
|
if (params.nodeIds.length === 0) return;
|
|
626
|
-
for (const nodeIds of
|
|
626
|
+
for (const nodeIds of chunkX4JBT642_cjs.chunk(
|
|
627
627
|
params.nodeIds,
|
|
628
628
|
batchConfig.fulltextDeleteChunkSize
|
|
629
629
|
)) {
|
|
@@ -641,7 +641,7 @@ function createSqliteOperationBackend(options) {
|
|
|
641
641
|
const rows = await execAll(query);
|
|
642
642
|
return rows.map((row, index) => ({
|
|
643
643
|
nodeId: row.node_id,
|
|
644
|
-
score:
|
|
644
|
+
score: chunk5W4L6DLF_cjs.coerceNumericScore(row.score),
|
|
645
645
|
rank: index + 1,
|
|
646
646
|
...row.snippet === null ? {} : { snippet: row.snippet }
|
|
647
647
|
}));
|
|
@@ -666,7 +666,7 @@ function createSqliteBackend(db, options = {}) {
|
|
|
666
666
|
const executionAdapter = createSqliteExecutionAdapter(db, { profileHints });
|
|
667
667
|
const { isSync, transactionMode } = executionAdapter.profile;
|
|
668
668
|
const vectorStrategy = options.vector;
|
|
669
|
-
const vectorSlotLatch = vectorStrategy === void 0 ? void 0 :
|
|
669
|
+
const vectorSlotLatch = vectorStrategy === void 0 ? void 0 : chunk456Z2U7Y_cjs.createVectorSlotLatch();
|
|
670
670
|
const capabilities = {
|
|
671
671
|
...buildSqliteCapabilities({
|
|
672
672
|
fulltextStrategy,
|
|
@@ -697,7 +697,7 @@ function createSqliteBackend(db, options = {}) {
|
|
|
697
697
|
tableNames.recordedEdges,
|
|
698
698
|
tableNames.recordedClock
|
|
699
699
|
];
|
|
700
|
-
const operationStrategy =
|
|
700
|
+
const operationStrategy = chunk456Z2U7Y_cjs.createSqliteOperationStrategy(
|
|
701
701
|
tables2,
|
|
702
702
|
fulltextStrategy
|
|
703
703
|
);
|
|
@@ -795,7 +795,7 @@ function createSqliteBackend(db, options = {}) {
|
|
|
795
795
|
}
|
|
796
796
|
const matTable = tables2.contributionMaterializations;
|
|
797
797
|
async function ensureContributionMaterializationsTableImpl() {
|
|
798
|
-
await db.run(drizzleOrm.sql.raw(
|
|
798
|
+
await db.run(drizzleOrm.sql.raw(chunk456Z2U7Y_cjs.generateSqliteCreateTableSQL(matTable)));
|
|
799
799
|
}
|
|
800
800
|
async function getContributionMaterializationRow(identity) {
|
|
801
801
|
const rows = await db.select().from(matTable).where(
|
|
@@ -808,16 +808,16 @@ function createSqliteBackend(db, options = {}) {
|
|
|
808
808
|
);
|
|
809
809
|
const row = rows[0];
|
|
810
810
|
if (row === void 0) return void 0;
|
|
811
|
-
return
|
|
811
|
+
return chunk456Z2U7Y_cjs.mapContributionMaterializationRow(
|
|
812
812
|
row,
|
|
813
|
-
|
|
813
|
+
chunk456Z2U7Y_cjs.SQLITE_CONTRIBUTION_MAT_TIMESTAMPS.decode
|
|
814
814
|
);
|
|
815
815
|
}
|
|
816
816
|
async function recordContributionMaterializationRow(params) {
|
|
817
817
|
await db.insert(matTable).values(
|
|
818
|
-
|
|
818
|
+
chunk456Z2U7Y_cjs.buildContributionInsertValues(
|
|
819
819
|
params,
|
|
820
|
-
|
|
820
|
+
chunk456Z2U7Y_cjs.SQLITE_CONTRIBUTION_MAT_TIMESTAMPS.encode
|
|
821
821
|
)
|
|
822
822
|
).onConflictDoUpdate({
|
|
823
823
|
target: [
|
|
@@ -826,13 +826,13 @@ function createSqliteBackend(db, options = {}) {
|
|
|
826
826
|
matTable.owner,
|
|
827
827
|
matTable.tableName
|
|
828
828
|
],
|
|
829
|
-
set:
|
|
829
|
+
set: chunk456Z2U7Y_cjs.buildContributionOnConflictSet(
|
|
830
830
|
matTable.materializedAt,
|
|
831
831
|
params.materializedAt
|
|
832
832
|
)
|
|
833
833
|
});
|
|
834
834
|
}
|
|
835
|
-
const contributionMaterializer =
|
|
835
|
+
const contributionMaterializer = chunk456Z2U7Y_cjs.createContributionMaterializer({
|
|
836
836
|
dialect: "sqlite",
|
|
837
837
|
fulltextStrategy,
|
|
838
838
|
fulltextTableName: tables2.fulltextTableName,
|
|
@@ -852,19 +852,19 @@ function createSqliteBackend(db, options = {}) {
|
|
|
852
852
|
tableNames,
|
|
853
853
|
fulltextStrategy,
|
|
854
854
|
vectorStrategy});
|
|
855
|
-
return
|
|
855
|
+
return chunk456Z2U7Y_cjs.gateFulltext(txBackend, contributionMaterializer.assertInitialized);
|
|
856
856
|
}
|
|
857
857
|
const backend = {
|
|
858
858
|
...operations,
|
|
859
859
|
async bootstrapTables() {
|
|
860
|
-
const statements =
|
|
860
|
+
const statements = chunk456Z2U7Y_cjs.generateSqliteDDL(tables2, fulltextStrategy);
|
|
861
861
|
for (const statement of statements) {
|
|
862
862
|
await db.run(drizzleOrm.sql.raw(statement));
|
|
863
863
|
}
|
|
864
864
|
},
|
|
865
865
|
async ensureRevisionOriginsTable() {
|
|
866
866
|
await db.run(
|
|
867
|
-
drizzleOrm.sql.raw(
|
|
867
|
+
drizzleOrm.sql.raw(chunk456Z2U7Y_cjs.generateSqliteCreateTableSQL(tables2.revisionOrigins))
|
|
868
868
|
);
|
|
869
869
|
},
|
|
870
870
|
// Every fulltext-touching method asserts the durable marker instead
|
|
@@ -872,7 +872,7 @@ function createSqliteBackend(db, options = {}) {
|
|
|
872
872
|
// uninitialized database throws `StoreNotInitializedError` rather
|
|
873
873
|
// than self-healing (#135). Shared verbatim with the tx-scoped gate
|
|
874
874
|
// via `gateFulltextMethods`.
|
|
875
|
-
...
|
|
875
|
+
...chunk456Z2U7Y_cjs.gateFulltextMethods(
|
|
876
876
|
operations,
|
|
877
877
|
contributionMaterializer.assertInitialized
|
|
878
878
|
),
|
|
@@ -881,7 +881,7 @@ function createSqliteBackend(db, options = {}) {
|
|
|
881
881
|
},
|
|
882
882
|
async ensureIndexMaterializationsTable() {
|
|
883
883
|
await db.run(
|
|
884
|
-
drizzleOrm.sql.raw(
|
|
884
|
+
drizzleOrm.sql.raw(chunk456Z2U7Y_cjs.generateSqliteCreateTableSQL(tables2.indexMaterializations))
|
|
885
885
|
);
|
|
886
886
|
},
|
|
887
887
|
async getIndexMaterialization(indexName) {
|
|
@@ -889,26 +889,26 @@ function createSqliteBackend(db, options = {}) {
|
|
|
889
889
|
const rows = await db.select().from(t).where(drizzleOrm.eq(t.indexName, indexName));
|
|
890
890
|
const row = rows[0];
|
|
891
891
|
if (row === void 0) return void 0;
|
|
892
|
-
return
|
|
892
|
+
return chunk456Z2U7Y_cjs.mapMaterializationRow(row, chunk456Z2U7Y_cjs.SQLITE_INDEX_MAT_TIMESTAMPS.decode);
|
|
893
893
|
},
|
|
894
894
|
async getIndexMaterializations(statusKeys) {
|
|
895
895
|
if (statusKeys.length === 0) return [];
|
|
896
896
|
const t = tables2.indexMaterializations;
|
|
897
897
|
const rows = await db.select().from(t).where(drizzleOrm.inArray(t.indexName, [...statusKeys]));
|
|
898
898
|
return rows.map(
|
|
899
|
-
(row) =>
|
|
899
|
+
(row) => chunk456Z2U7Y_cjs.mapMaterializationRow(row, chunk456Z2U7Y_cjs.SQLITE_INDEX_MAT_TIMESTAMPS.decode)
|
|
900
900
|
);
|
|
901
901
|
},
|
|
902
902
|
async recordIndexMaterialization(params) {
|
|
903
903
|
const t = tables2.indexMaterializations;
|
|
904
904
|
await db.insert(t).values(
|
|
905
|
-
|
|
905
|
+
chunk456Z2U7Y_cjs.buildMaterializationInsertValues(
|
|
906
906
|
params,
|
|
907
|
-
|
|
907
|
+
chunk456Z2U7Y_cjs.SQLITE_INDEX_MAT_TIMESTAMPS.encode
|
|
908
908
|
)
|
|
909
909
|
).onConflictDoUpdate({
|
|
910
910
|
target: t.indexName,
|
|
911
|
-
set:
|
|
911
|
+
set: chunk456Z2U7Y_cjs.buildMaterializationOnConflictSet(
|
|
912
912
|
t.materializedAt,
|
|
913
913
|
params.materializedAt
|
|
914
914
|
)
|
|
@@ -927,37 +927,37 @@ function createSqliteBackend(db, options = {}) {
|
|
|
927
927
|
await contributionMaterializer.assertInitialized(graphId);
|
|
928
928
|
},
|
|
929
929
|
async ensureKindRemovalsTable() {
|
|
930
|
-
await db.run(drizzleOrm.sql.raw(
|
|
930
|
+
await db.run(drizzleOrm.sql.raw(chunk456Z2U7Y_cjs.generateSqliteCreateTableSQL(tables2.kindRemovals)));
|
|
931
931
|
},
|
|
932
932
|
async getPendingKindRemovals(graphId) {
|
|
933
933
|
const t = tables2.kindRemovals;
|
|
934
934
|
const rows = await db.select().from(t).where(drizzleOrm.and(drizzleOrm.eq(t.graphId, graphId), drizzleOrm.isNull(t.removedAt)));
|
|
935
935
|
return rows.map(
|
|
936
|
-
(row) =>
|
|
936
|
+
(row) => chunk456Z2U7Y_cjs.mapKindRemovalRow(row, chunk456Z2U7Y_cjs.SQLITE_KIND_REMOVAL_TIMESTAMPS.decode)
|
|
937
937
|
);
|
|
938
938
|
},
|
|
939
939
|
async getAllKindRemovals(graphId) {
|
|
940
940
|
const t = tables2.kindRemovals;
|
|
941
941
|
const rows = await db.select().from(t).where(drizzleOrm.eq(t.graphId, graphId));
|
|
942
942
|
return rows.map(
|
|
943
|
-
(row) =>
|
|
943
|
+
(row) => chunk456Z2U7Y_cjs.mapKindRemovalRow(row, chunk456Z2U7Y_cjs.SQLITE_KIND_REMOVAL_TIMESTAMPS.decode)
|
|
944
944
|
);
|
|
945
945
|
},
|
|
946
946
|
async recordKindRemoval(params) {
|
|
947
947
|
const t = tables2.kindRemovals;
|
|
948
948
|
await db.insert(t).values(
|
|
949
|
-
|
|
949
|
+
chunk456Z2U7Y_cjs.buildKindRemovalInsertValues(
|
|
950
950
|
params,
|
|
951
|
-
|
|
951
|
+
chunk456Z2U7Y_cjs.SQLITE_KIND_REMOVAL_TIMESTAMPS.encode
|
|
952
952
|
)
|
|
953
953
|
).onConflictDoUpdate({
|
|
954
954
|
target: [t.graphId, t.kindName, t.entity, t.schemaVersion],
|
|
955
|
-
set:
|
|
955
|
+
set: chunk456Z2U7Y_cjs.buildKindRemovalOnConflictSet(t.removedAt, params.removedAt)
|
|
956
956
|
});
|
|
957
957
|
},
|
|
958
958
|
async ensureReconciliationMarkersTable() {
|
|
959
959
|
await db.run(
|
|
960
|
-
drizzleOrm.sql.raw(
|
|
960
|
+
drizzleOrm.sql.raw(chunk456Z2U7Y_cjs.generateSqliteCreateTableSQL(tables2.reconciliationMarkers))
|
|
961
961
|
);
|
|
962
962
|
},
|
|
963
963
|
async ensureRuntimeContributions(graphId) {
|
|
@@ -988,13 +988,13 @@ function createSqliteBackend(db, options = {}) {
|
|
|
988
988
|
drizzleOrm.sql`PRAGMA analysis_limit = ${drizzleOrm.sql.raw(String(SQLITE_ANALYZE_ROW_LIMIT))}`
|
|
989
989
|
);
|
|
990
990
|
for (const tableName of coreAnalyzeTables) {
|
|
991
|
-
await db.run(drizzleOrm.sql`ANALYZE ${
|
|
991
|
+
await db.run(drizzleOrm.sql`ANALYZE ${chunk5W4L6DLF_cjs.quoteIdentifier(tableName)}`);
|
|
992
992
|
}
|
|
993
993
|
for (const tableName of recordedAnalyzeTables) {
|
|
994
994
|
try {
|
|
995
|
-
await db.run(drizzleOrm.sql`ANALYZE ${
|
|
995
|
+
await db.run(drizzleOrm.sql`ANALYZE ${chunk5W4L6DLF_cjs.quoteIdentifier(tableName)}`);
|
|
996
996
|
} catch (error) {
|
|
997
|
-
if (!
|
|
997
|
+
if (!chunkRSSQKPSZ_cjs.isMissingTableError(error)) throw error;
|
|
998
998
|
}
|
|
999
999
|
}
|
|
1000
1000
|
},
|
|
@@ -1028,7 +1028,7 @@ function createSqliteBackend(db, options = {}) {
|
|
|
1028
1028
|
await runFrameStatement(drizzleOrm.sql`BEGIN IMMEDIATE`);
|
|
1029
1029
|
try {
|
|
1030
1030
|
const result = await fn(
|
|
1031
|
-
|
|
1031
|
+
chunk456Z2U7Y_cjs.gateFulltext(
|
|
1032
1032
|
txBackend,
|
|
1033
1033
|
contributionMaterializer.assertInitialized
|
|
1034
1034
|
),
|
|
@@ -1060,7 +1060,7 @@ function createSqliteBackend(db, options = {}) {
|
|
|
1060
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)."
|
|
1061
1061
|
);
|
|
1062
1062
|
}
|
|
1063
|
-
|
|
1063
|
+
chunk456Z2U7Y_cjs.assertAdoptedDialect(
|
|
1064
1064
|
externalTx,
|
|
1065
1065
|
sqliteCore.BaseSQLiteDatabase,
|
|
1066
1066
|
"sqlite"
|
|
@@ -1086,10 +1086,10 @@ function createTransactionBackend(options) {
|
|
|
1086
1086
|
tableNames: options.tableNames,
|
|
1087
1087
|
fulltextStrategy: options.fulltextStrategy,
|
|
1088
1088
|
vectorStrategy: options.vectorStrategy,
|
|
1089
|
-
...options.vectorStrategy === void 0 ? {} : { vectorSlotLatch:
|
|
1089
|
+
...options.vectorStrategy === void 0 ? {} : { vectorSlotLatch: chunk456Z2U7Y_cjs.createVectorSlotLatch() }
|
|
1090
1090
|
});
|
|
1091
1091
|
}
|
|
1092
1092
|
|
|
1093
1093
|
exports.createSqliteBackend = createSqliteBackend;
|
|
1094
|
-
//# sourceMappingURL=chunk-
|
|
1095
|
-
//# sourceMappingURL=chunk-
|
|
1094
|
+
//# sourceMappingURL=chunk-JFMEONLG.cjs.map
|
|
1095
|
+
//# sourceMappingURL=chunk-JFMEONLG.cjs.map
|