@nicia-ai/typegraph 0.29.0 → 0.31.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 +39 -0
- package/dist/backend/postgres/index.cjs +21 -20
- package/dist/backend/postgres/index.d.cts +6 -6
- package/dist/backend/postgres/index.d.ts +6 -6
- package/dist/backend/postgres/index.js +11 -10
- package/dist/backend/postgres/pglite.cjs +16 -15
- package/dist/backend/postgres/pglite.cjs.map +1 -1
- package/dist/backend/postgres/pglite.d.cts +3 -3
- package/dist/backend/postgres/pglite.d.ts +3 -3
- package/dist/backend/postgres/pglite.js +11 -10
- package/dist/backend/postgres/pglite.js.map +1 -1
- package/dist/backend/sqlite/index.cjs +18 -18
- package/dist/backend/sqlite/index.d.cts +12 -7
- package/dist/backend/sqlite/index.d.ts +12 -7
- package/dist/backend/sqlite/index.js +9 -9
- package/dist/backend/sqlite/libsql.cjs +14 -14
- package/dist/backend/sqlite/libsql.d.cts +3 -3
- package/dist/backend/sqlite/libsql.d.ts +3 -3
- package/dist/backend/sqlite/libsql.js +10 -10
- package/dist/backend/sqlite/local.cjs +17 -16
- package/dist/backend/sqlite/local.cjs.map +1 -1
- package/dist/backend/sqlite/local.d.cts +9 -3
- package/dist/backend/sqlite/local.d.ts +9 -3
- package/dist/backend/sqlite/local.js +12 -11
- package/dist/backend/sqlite/local.js.map +1 -1
- package/dist/{chunk-7KLVFWXR.js → chunk-2HZGWCB4.js} +121 -497
- package/dist/chunk-2HZGWCB4.js.map +1 -0
- package/dist/chunk-2YMGNYXY.js +40 -0
- package/dist/chunk-2YMGNYXY.js.map +1 -0
- package/dist/chunk-2ZY4K43M.js +90 -0
- package/dist/chunk-2ZY4K43M.js.map +1 -0
- package/dist/chunk-3EUKJEQ3.js +77 -0
- package/dist/chunk-3EUKJEQ3.js.map +1 -0
- package/dist/chunk-3JBJEYWE.cjs +604 -0
- package/dist/chunk-3JBJEYWE.cjs.map +1 -0
- package/dist/{chunk-A4H6QMV4.js → chunk-4A4GUZTQ.js} +15 -11
- package/dist/chunk-4A4GUZTQ.js.map +1 -0
- package/dist/{chunk-F2Q76CQ4.cjs → chunk-54JVNOAQ.cjs} +5 -37
- package/dist/chunk-54JVNOAQ.cjs.map +1 -0
- package/dist/{chunk-KGAJ5HFO.cjs → chunk-5CN7B4CZ.cjs} +17 -98
- package/dist/chunk-5CN7B4CZ.cjs.map +1 -0
- package/dist/{chunk-XTQHSOIC.cjs → chunk-5DTPBFX5.cjs} +88 -87
- package/dist/chunk-5DTPBFX5.cjs.map +1 -0
- package/dist/chunk-6G35I3VW.cjs +40 -0
- package/dist/chunk-6G35I3VW.cjs.map +1 -0
- package/dist/{chunk-UPBXUOW7.cjs → chunk-6RMLO5O4.cjs} +19 -64
- package/dist/chunk-6RMLO5O4.cjs.map +1 -0
- package/dist/chunk-6SA7UIQJ.cjs +94 -0
- package/dist/chunk-6SA7UIQJ.cjs.map +1 -0
- package/dist/chunk-6ZR4QC3O.cjs +12 -0
- package/dist/{chunk-Q3ZZLU3O.cjs.map → chunk-6ZR4QC3O.cjs.map} +1 -1
- package/dist/chunk-73KASJGO.cjs +52 -0
- package/dist/chunk-73KASJGO.cjs.map +1 -0
- package/dist/{chunk-R2LA6MKR.cjs → chunk-7JGLPAFV.cjs} +8 -8
- package/dist/{chunk-R2LA6MKR.cjs.map → chunk-7JGLPAFV.cjs.map} +1 -1
- package/dist/chunk-A3W7QG7K.js +45 -0
- package/dist/chunk-A3W7QG7K.js.map +1 -0
- package/dist/{chunk-Q5ASTPM4.cjs → chunk-ASYQDPPU.cjs} +19 -19
- package/dist/{chunk-Q5ASTPM4.cjs.map → chunk-ASYQDPPU.cjs.map} +1 -1
- package/dist/{chunk-IE2TPFBT.js → chunk-ATTXBMAX.js} +4 -74
- package/dist/chunk-ATTXBMAX.js.map +1 -0
- package/dist/chunk-AW4A3P5A.cjs +51 -0
- package/dist/chunk-AW4A3P5A.cjs.map +1 -0
- package/dist/{chunk-ZYQEXGYC.cjs → chunk-CIINW6PS.cjs} +92 -87
- package/dist/chunk-CIINW6PS.cjs.map +1 -0
- package/dist/{chunk-UP4QAJND.cjs → chunk-FLOI7QOT.cjs} +66 -65
- package/dist/chunk-FLOI7QOT.cjs.map +1 -0
- package/dist/{chunk-7V335GHG.cjs → chunk-FLRCVI2G.cjs} +12 -2
- package/dist/chunk-FLRCVI2G.cjs.map +1 -0
- package/dist/{chunk-HKN622O4.js → chunk-GKFWM3DS.js} +4 -32
- package/dist/chunk-GKFWM3DS.js.map +1 -0
- package/dist/chunk-HTGDWIDE.cjs +89 -0
- package/dist/chunk-HTGDWIDE.cjs.map +1 -0
- package/dist/{chunk-OGUH56BB.js → chunk-IJORSAC3.js} +6 -42
- package/dist/chunk-IJORSAC3.js.map +1 -0
- package/dist/{chunk-G6P3OVDY.cjs → chunk-JIEJCTDS.cjs} +18 -2
- package/dist/chunk-JIEJCTDS.cjs.map +1 -0
- package/dist/{chunk-NZ5PMBTG.js → chunk-K5P5OZXS.js} +12 -3
- package/dist/chunk-K5P5OZXS.js.map +1 -0
- package/dist/{chunk-HM6XMR3E.cjs → chunk-KTIEB7VH.cjs} +42 -32
- package/dist/chunk-KTIEB7VH.cjs.map +1 -0
- package/dist/chunk-LJLMDDCW.js +282 -0
- package/dist/chunk-LJLMDDCW.js.map +1 -0
- package/dist/{chunk-Z36W5WUM.js → chunk-MAQJYNJR.js} +3 -3
- package/dist/{chunk-Z36W5WUM.js.map → chunk-MAQJYNJR.js.map} +1 -1
- package/dist/{chunk-N3VVQDMA.js → chunk-MXE2U3EX.js} +3 -3
- package/dist/{chunk-N3VVQDMA.js.map → chunk-MXE2U3EX.js.map} +1 -1
- package/dist/{chunk-4K6IHUW6.cjs → chunk-N2MBPTAF.cjs} +14 -14
- package/dist/{chunk-4K6IHUW6.cjs.map → chunk-N2MBPTAF.cjs.map} +1 -1
- package/dist/{chunk-CUZGBWFT.js → chunk-O4VUR6SI.js} +3 -3
- package/dist/{chunk-CUZGBWFT.js.map → chunk-O4VUR6SI.js.map} +1 -1
- package/dist/chunk-RZ4DH4E7.cjs +15832 -0
- package/dist/chunk-RZ4DH4E7.cjs.map +1 -0
- package/dist/chunk-SAJSMR2B.js +35 -0
- package/dist/chunk-SAJSMR2B.js.map +1 -0
- package/dist/{chunk-RU5BBUU2.cjs → chunk-SFFJ2IKN.cjs} +71 -67
- package/dist/chunk-SFFJ2IKN.cjs.map +1 -0
- package/dist/{chunk-Y52UNT66.js → chunk-STP7QVUB.js} +8 -7
- package/dist/chunk-STP7QVUB.js.map +1 -0
- package/dist/chunk-THX25XW6.js +590 -0
- package/dist/chunk-THX25XW6.js.map +1 -0
- package/dist/{chunk-MB363HT5.js → chunk-TQOYM4LN.js} +18 -3
- package/dist/chunk-TQOYM4LN.js.map +1 -0
- package/dist/chunk-UIFEEPME.js +15787 -0
- package/dist/chunk-UIFEEPME.js.map +1 -0
- package/dist/{chunk-GPUNAJFH.js → chunk-UJ4V3YUQ.js} +3 -3
- package/dist/{chunk-GPUNAJFH.js.map → chunk-UJ4V3YUQ.js.map} +1 -1
- package/dist/{chunk-C2RWFIYP.cjs → chunk-V4IQYOQ4.cjs} +127 -511
- package/dist/chunk-V4IQYOQ4.cjs.map +1 -0
- package/dist/chunk-VMEWZU2N.cjs +287 -0
- package/dist/chunk-VMEWZU2N.cjs.map +1 -0
- package/dist/{chunk-3DTLDGIM.js → chunk-VZX2KSY3.js} +14 -9
- package/dist/chunk-VZX2KSY3.js.map +1 -0
- package/dist/{chunk-BMDF2S7S.js → chunk-WYTUF3QO.js} +3 -3
- package/dist/{chunk-BMDF2S7S.js.map → chunk-WYTUF3QO.js.map} +1 -1
- package/dist/{chunk-MRMD7S7E.js → chunk-XKJQQQVR.js} +9 -8
- package/dist/chunk-XKJQQQVR.js.map +1 -0
- package/dist/{chunk-SFNUHFON.js → chunk-YCV72E6L.js} +25 -19
- package/dist/chunk-YCV72E6L.js.map +1 -0
- package/dist/{chunk-VGU26WIU.cjs → chunk-YQGLVWB2.cjs} +4 -4
- package/dist/{chunk-VGU26WIU.cjs.map → chunk-YQGLVWB2.cjs.map} +1 -1
- package/dist/{ddl-BwH00BB6.d.ts → ddl-BJcPrB4L.d.ts} +3 -3
- package/dist/{ddl-D3o-RmsV.d.cts → ddl-CPZ7mB7X.d.cts} +3 -3
- package/dist/{extension-types-CwHV-Uk4.d.ts → extension-types-D1k0inWU.d.cts} +1 -1
- package/dist/{extension-types-CwHV-Uk4.d.cts → extension-types-D1k0inWU.d.ts} +1 -1
- package/dist/graph-extension/index.cjs +19 -19
- package/dist/graph-extension/index.d.cts +5 -16
- package/dist/graph-extension/index.d.ts +5 -16
- package/dist/graph-extension/index.js +4 -4
- package/dist/graph-merge/index.cjs +3822 -0
- package/dist/graph-merge/index.cjs.map +1 -0
- package/dist/graph-merge/index.d.cts +1191 -0
- package/dist/graph-merge/index.d.ts +1191 -0
- package/dist/graph-merge/index.js +3791 -0
- package/dist/graph-merge/index.js.map +1 -0
- package/dist/{index-CapHwi1a.d.ts → index-BEK0VtNB.d.ts} +11 -3
- package/dist/{index-jPPexxM5.d.cts → index-C8sSTErx.d.cts} +11 -3
- package/dist/index.cjs +365 -15732
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -11
- package/dist/index.d.ts +12 -11
- package/dist/index.js +27 -15533
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +32 -28
- package/dist/indexes/index.d.cts +5 -5
- package/dist/indexes/index.d.ts +5 -5
- package/dist/indexes/index.js +8 -4
- package/dist/interchange/index.cjs +50 -593
- package/dist/interchange/index.cjs.map +1 -1
- package/dist/interchange/index.d.cts +5 -5
- package/dist/interchange/index.d.ts +5 -5
- package/dist/interchange/index.js +3 -589
- package/dist/interchange/index.js.map +1 -1
- package/dist/{manager-BUugwCYz.d.ts → manager-By-WEd8M.d.ts} +3 -3
- package/dist/{manager-DpIpn1HQ.d.cts → manager-Np7VVSlE.d.cts} +3 -3
- package/dist/{materialize-indexes-lkawaDor.d.ts → materialize-indexes-CAGhqPHQ.d.ts} +1 -1
- package/dist/{materialize-indexes-oanE3RU0.d.cts → materialize-indexes-DEYkU-wr.d.cts} +1 -1
- package/dist/{postgres-CQL9UIn2.d.cts → postgres-4J2tmauh.d.cts} +1 -1
- package/dist/{postgres-CcRLaxz0.d.ts → postgres-BdIb7tS_.d.ts} +1 -1
- package/dist/profiler/index.cjs +9 -9
- package/dist/profiler/index.d.cts +7 -7
- package/dist/profiler/index.d.ts +7 -7
- package/dist/profiler/index.js +2 -2
- package/dist/result-DWo6mUVz.d.cts +37 -0
- package/dist/result-DWo6mUVz.d.ts +37 -0
- package/dist/schema/index.cjs +33 -32
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.cts +7 -7
- package/dist/schema/index.d.ts +7 -7
- package/dist/schema/index.js +10 -9
- package/dist/schema/index.js.map +1 -1
- package/dist/{sqlite-Rj3xu4It.d.cts → sqlite-Gatk_iw_.d.cts} +1 -1
- package/dist/{sqlite-CZDFUfHS.d.ts → sqlite-aM_PAz-O.d.ts} +1 -1
- package/dist/{store-B43FpOVX.d.cts → store-DuCbdqsh.d.cts} +84 -44
- package/dist/{store-De0Y33wP.d.ts → store-MloRPwb9.d.ts} +84 -44
- package/dist/{types-DXCSyxac.d.cts → types-BKQljXom.d.ts} +18 -2
- package/dist/{types-CmAT-Z47.d.ts → types-C1CYxWrL.d.cts} +18 -2
- package/dist/{types-Bwlp_yvu.d.cts → types-DoByHGyU.d.cts} +2 -2
- package/dist/{types-B5GSeE3t.d.ts → types-K3vpaJAL.d.ts} +2 -2
- package/dist/{where-CP4qGIHd.d.ts → where-Dt49bvo6.d.ts} +2 -2
- package/dist/{where-2dsyYt3d.d.cts → where-DydZjGOb.d.cts} +2 -2
- package/package.json +6 -1
- package/dist/chunk-3DTLDGIM.js.map +0 -1
- package/dist/chunk-7KLVFWXR.js.map +0 -1
- package/dist/chunk-7V335GHG.cjs.map +0 -1
- package/dist/chunk-A4H6QMV4.js.map +0 -1
- package/dist/chunk-C2RWFIYP.cjs.map +0 -1
- package/dist/chunk-F2Q76CQ4.cjs.map +0 -1
- package/dist/chunk-G6P3OVDY.cjs.map +0 -1
- package/dist/chunk-HKN622O4.js.map +0 -1
- package/dist/chunk-HM6XMR3E.cjs.map +0 -1
- package/dist/chunk-IE2TPFBT.js.map +0 -1
- package/dist/chunk-KGAJ5HFO.cjs.map +0 -1
- package/dist/chunk-MB363HT5.js.map +0 -1
- package/dist/chunk-MRMD7S7E.js.map +0 -1
- package/dist/chunk-NZ5PMBTG.js.map +0 -1
- package/dist/chunk-OGUH56BB.js.map +0 -1
- package/dist/chunk-Q3ZZLU3O.cjs +0 -12
- package/dist/chunk-RU5BBUU2.cjs.map +0 -1
- package/dist/chunk-SFNUHFON.js.map +0 -1
- package/dist/chunk-UP4QAJND.cjs.map +0 -1
- package/dist/chunk-UPBXUOW7.cjs.map +0 -1
- package/dist/chunk-XTQHSOIC.cjs.map +0 -1
- package/dist/chunk-Y52UNT66.js.map +0 -1
- package/dist/chunk-ZYQEXGYC.cjs.map +0 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk54JVNOAQ_cjs = require('./chunk-54JVNOAQ.cjs');
|
|
4
|
+
var chunkVMEWZU2N_cjs = require('./chunk-VMEWZU2N.cjs');
|
|
4
5
|
var chunkRP7YITHX_cjs = require('./chunk-RP7YITHX.cjs');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
6
|
+
var chunkV4IQYOQ4_cjs = require('./chunk-V4IQYOQ4.cjs');
|
|
7
|
+
var chunk73KASJGO_cjs = require('./chunk-73KASJGO.cjs');
|
|
8
|
+
var chunkJIEJCTDS_cjs = require('./chunk-JIEJCTDS.cjs');
|
|
8
9
|
var drizzleOrm = require('drizzle-orm');
|
|
9
10
|
var pgCore = require('drizzle-orm/pg-core');
|
|
10
11
|
var sqliteCore = require('drizzle-orm/sqlite-core');
|
|
@@ -56,7 +57,7 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
56
57
|
),
|
|
57
58
|
pgCore.index(`${n.nodes}_deleted_idx`).on(t.graphId, t.deletedAt),
|
|
58
59
|
pgCore.index(`${n.nodes}_valid_idx`).on(t.graphId, t.validFrom, t.validTo),
|
|
59
|
-
...
|
|
60
|
+
...chunkVMEWZU2N_cjs.buildPostgresNodeIndexBuilders(t, indexes)
|
|
60
61
|
]
|
|
61
62
|
);
|
|
62
63
|
const edges2 = pgCore.pgTable(
|
|
@@ -115,7 +116,7 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
115
116
|
t.fromId,
|
|
116
117
|
t.validTo
|
|
117
118
|
),
|
|
118
|
-
...
|
|
119
|
+
...chunkVMEWZU2N_cjs.buildPostgresEdgeIndexBuilders(t, indexes)
|
|
119
120
|
]
|
|
120
121
|
);
|
|
121
122
|
const uniques2 = pgCore.pgTable(
|
|
@@ -386,13 +387,13 @@ function isSqliteTable(value) {
|
|
|
386
387
|
function runtimeStrategyContributions(fulltextStrategy, fulltextTableName) {
|
|
387
388
|
return fulltextStrategy.ownedTables(fulltextTableName).filter((contribution) => contribution.runtimeEnsure);
|
|
388
389
|
}
|
|
389
|
-
function sqliteContributions(tables3 =
|
|
390
|
+
function sqliteContributions(tables3 = chunk54JVNOAQ_cjs.tables, fulltextStrategy = chunkV4IQYOQ4_cjs.fts5Strategy) {
|
|
390
391
|
const contributions = [];
|
|
391
392
|
for (const [key, table] of Object.entries(tables3)) {
|
|
392
393
|
if (!isSqliteTable(table)) continue;
|
|
393
394
|
contributions.push({
|
|
394
395
|
logicalName: key,
|
|
395
|
-
owner:
|
|
396
|
+
owner: chunkV4IQYOQ4_cjs.BASE_CONTRIBUTION_OWNER,
|
|
396
397
|
tableName: sqliteCore.getTableConfig(table).name,
|
|
397
398
|
createDdl: [
|
|
398
399
|
generateSqliteCreateTableSQL(table),
|
|
@@ -408,12 +409,12 @@ function sqliteContributions(tables3 = chunkF2Q76CQ4_cjs.tables, fulltextStrateg
|
|
|
408
409
|
}
|
|
409
410
|
return contributions;
|
|
410
411
|
}
|
|
411
|
-
function generateSqliteDDL(tables3 =
|
|
412
|
+
function generateSqliteDDL(tables3 = chunk54JVNOAQ_cjs.tables, fulltextStrategy = chunkV4IQYOQ4_cjs.fts5Strategy) {
|
|
412
413
|
return sqliteContributions(tables3, fulltextStrategy).flatMap(
|
|
413
414
|
(contribution) => [...contribution.createDdl]
|
|
414
415
|
);
|
|
415
416
|
}
|
|
416
|
-
function generateSqliteMigrationSQL(tables3 =
|
|
417
|
+
function generateSqliteMigrationSQL(tables3 = chunk54JVNOAQ_cjs.tables, fulltextStrategy = chunkV4IQYOQ4_cjs.fts5Strategy) {
|
|
417
418
|
return generateSqliteDDL(tables3, fulltextStrategy).join("\n\n");
|
|
418
419
|
}
|
|
419
420
|
function getPgColumnType(column) {
|
|
@@ -495,14 +496,14 @@ function generatePgCreateIndexSQL(table) {
|
|
|
495
496
|
function isPgTable(value) {
|
|
496
497
|
return drizzleOrm.is(value, pgCore.PgTable);
|
|
497
498
|
}
|
|
498
|
-
function postgresContributions(tables3 = tables2, fulltextStrategy =
|
|
499
|
+
function postgresContributions(tables3 = tables2, fulltextStrategy = chunkV4IQYOQ4_cjs.tsvectorStrategy) {
|
|
499
500
|
const contributions = [];
|
|
500
501
|
for (const [key, table] of Object.entries(tables3)) {
|
|
501
502
|
if (!isPgTable(table)) continue;
|
|
502
503
|
if (table === tables3.fulltext) continue;
|
|
503
504
|
contributions.push({
|
|
504
505
|
logicalName: key,
|
|
505
|
-
owner:
|
|
506
|
+
owner: chunkV4IQYOQ4_cjs.BASE_CONTRIBUTION_OWNER,
|
|
506
507
|
tableName: pgCore.getTableConfig(table).name,
|
|
507
508
|
createDdl: [
|
|
508
509
|
generatePgCreateTableSQL(table),
|
|
@@ -518,12 +519,12 @@ function postgresContributions(tables3 = tables2, fulltextStrategy = chunkC2RWFI
|
|
|
518
519
|
}
|
|
519
520
|
return contributions;
|
|
520
521
|
}
|
|
521
|
-
function generatePostgresDDL(tables3 = tables2, fulltextStrategy =
|
|
522
|
+
function generatePostgresDDL(tables3 = tables2, fulltextStrategy = chunkV4IQYOQ4_cjs.tsvectorStrategy) {
|
|
522
523
|
return postgresContributions(tables3, fulltextStrategy).flatMap(
|
|
523
524
|
(contribution) => [...contribution.createDdl]
|
|
524
525
|
);
|
|
525
526
|
}
|
|
526
|
-
function generatePostgresMigrationSQL(tables3 = tables2, fulltextStrategy =
|
|
527
|
+
function generatePostgresMigrationSQL(tables3 = tables2, fulltextStrategy = chunkV4IQYOQ4_cjs.tsvectorStrategy) {
|
|
527
528
|
const extensionSql = "-- Enable pgvector extension for vector similarity search\nCREATE EXTENSION IF NOT EXISTS vector;";
|
|
528
529
|
const ddlSql = generatePostgresDDL(tables3, fulltextStrategy).join("\n\n");
|
|
529
530
|
return `${extensionSql}
|
|
@@ -596,7 +597,7 @@ function mapVectorWriteError(error, params) {
|
|
|
596
597
|
const mismatch = chunkRP7YITHX_cjs.parseDimensionMismatch(error);
|
|
597
598
|
if (mismatch === void 0) return error;
|
|
598
599
|
const attempted = mismatch.actual ?? "a different number of";
|
|
599
|
-
return new
|
|
600
|
+
return new chunkJIEJCTDS_cjs.EmbeddingDimensionChangedError(
|
|
600
601
|
`Embedding "${params.nodeKind}.${params.fieldPath}" was written with ${attempted} dimensions, but its per-field storage expects ${mismatch.expected}. The field's embedding dimension changed; existing vectors must be recreated and re-embedded.`,
|
|
601
602
|
{
|
|
602
603
|
kind: params.nodeKind,
|
|
@@ -611,7 +612,7 @@ function mapVectorWriteError(error, params) {
|
|
|
611
612
|
// src/backend/drizzle/row-mappers.ts
|
|
612
613
|
function requireTimestamp(value, field) {
|
|
613
614
|
if (value === void 0) {
|
|
614
|
-
throw new
|
|
615
|
+
throw new chunkJIEJCTDS_cjs.DatabaseOperationError(
|
|
615
616
|
`Expected non-null ${field} timestamp`,
|
|
616
617
|
{ operation: "select", entity: "row" }
|
|
617
618
|
);
|
|
@@ -620,7 +621,7 @@ function requireTimestamp(value, field) {
|
|
|
620
621
|
}
|
|
621
622
|
function asString(value, field) {
|
|
622
623
|
if (typeof value !== "string") {
|
|
623
|
-
throw new
|
|
624
|
+
throw new chunkJIEJCTDS_cjs.DatabaseOperationError(
|
|
624
625
|
`Expected ${field} to be string, got ${typeof value}`,
|
|
625
626
|
{ operation: "select", entity: "row" }
|
|
626
627
|
);
|
|
@@ -629,7 +630,7 @@ function asString(value, field) {
|
|
|
629
630
|
}
|
|
630
631
|
function asNumber(value, field) {
|
|
631
632
|
if (typeof value !== "number") {
|
|
632
|
-
throw new
|
|
633
|
+
throw new chunkJIEJCTDS_cjs.DatabaseOperationError(
|
|
633
634
|
`Expected ${field} to be number, got ${typeof value}`,
|
|
634
635
|
{ operation: "select", entity: "row" }
|
|
635
636
|
);
|
|
@@ -670,7 +671,7 @@ var SQLITE_ROW_MAPPER_CONFIG = {
|
|
|
670
671
|
formatTimestamp: (value) => {
|
|
671
672
|
if (value === null || value === void 0) return;
|
|
672
673
|
if (typeof value !== "string") {
|
|
673
|
-
throw new
|
|
674
|
+
throw new chunkJIEJCTDS_cjs.DatabaseOperationError(
|
|
674
675
|
`Expected timestamp to be string, got ${typeof value}`,
|
|
675
676
|
{ operation: "select", entity: "row" }
|
|
676
677
|
);
|
|
@@ -679,7 +680,7 @@ var SQLITE_ROW_MAPPER_CONFIG = {
|
|
|
679
680
|
},
|
|
680
681
|
normalizeJson: (value) => {
|
|
681
682
|
if (typeof value !== "string") {
|
|
682
|
-
throw new
|
|
683
|
+
throw new chunkJIEJCTDS_cjs.DatabaseOperationError(
|
|
683
684
|
`Expected JSON column to be string, got ${typeof value}`,
|
|
684
685
|
{ operation: "select", entity: "row" }
|
|
685
686
|
);
|
|
@@ -802,7 +803,7 @@ async function computeContributionSignature(dialect, identity, createDdl) {
|
|
|
802
803
|
tableName: identity.tableName,
|
|
803
804
|
createDdl
|
|
804
805
|
};
|
|
805
|
-
return
|
|
806
|
+
return chunk73KASJGO_cjs.sha256Hex(JSON.stringify(hashable, chunkRP7YITHX_cjs.sortedReplacer), 16);
|
|
806
807
|
}
|
|
807
808
|
function evaluateContributionState(row, signature) {
|
|
808
809
|
if (row === void 0) return "missing";
|
|
@@ -965,13 +966,13 @@ function createContributionMaterializer(deps) {
|
|
|
965
966
|
for (const contribution of runtimeContributions()) {
|
|
966
967
|
const read = await readContributionState(graphId, contribution);
|
|
967
968
|
if (read.kind === "missing-table") {
|
|
968
|
-
throw new
|
|
969
|
+
throw new chunkJIEJCTDS_cjs.StoreNotInitializedError(graphId, "missing", {
|
|
969
970
|
cause: read.error,
|
|
970
971
|
details: { logicalName: contribution.logicalName }
|
|
971
972
|
});
|
|
972
973
|
}
|
|
973
974
|
if (read.state !== "initialized") {
|
|
974
|
-
throw new
|
|
975
|
+
throw new chunkJIEJCTDS_cjs.StoreNotInitializedError(graphId, read.state, {
|
|
975
976
|
details: { logicalName: contribution.logicalName }
|
|
976
977
|
});
|
|
977
978
|
}
|
|
@@ -1082,7 +1083,7 @@ function buildKindRemovalOnConflictSet(removedAtColumn, paramsRemovedAt) {
|
|
|
1082
1083
|
function assertAdoptedDialect(externalTx, brand, backend) {
|
|
1083
1084
|
if (drizzleOrm.is(externalTx, brand)) return;
|
|
1084
1085
|
const label = backend === "postgres" ? "Postgres" : "SQLite";
|
|
1085
|
-
throw new
|
|
1086
|
+
throw new chunkJIEJCTDS_cjs.ConfigurationError(
|
|
1086
1087
|
`adoptTransaction received a handle that is not a ${label} Drizzle transaction. Pass the \`tx\` from a ${label} \`db.transaction(...)\` opened on this backend's connection.`,
|
|
1087
1088
|
{ backend, capability: "adoptTransaction" }
|
|
1088
1089
|
);
|
|
@@ -1100,7 +1101,7 @@ function chunkArray(values, size) {
|
|
|
1100
1101
|
function verifyExpectedActiveVersion(graphId, expected, actualActiveVersion) {
|
|
1101
1102
|
const expectedVersion = expected.kind === "active" ? expected.version : 0;
|
|
1102
1103
|
if (actualActiveVersion !== expectedVersion) {
|
|
1103
|
-
throw new
|
|
1104
|
+
throw new chunkJIEJCTDS_cjs.StaleVersionError({
|
|
1104
1105
|
graphId,
|
|
1105
1106
|
expected: expectedVersion,
|
|
1106
1107
|
actual: actualActiveVersion
|
|
@@ -1121,7 +1122,7 @@ function createCommonOperationBackend(options) {
|
|
|
1121
1122
|
const timestamp2 = nowIso2();
|
|
1122
1123
|
const query = operationStrategy.buildInsertNode(params, timestamp2);
|
|
1123
1124
|
const row = await execution.execGet(query);
|
|
1124
|
-
if (!row) throw new
|
|
1125
|
+
if (!row) throw new chunkJIEJCTDS_cjs.DatabaseOperationError("Insert node failed: no row returned", { operation: "insert", entity: "node" });
|
|
1125
1126
|
return rowMappers.toNodeRow(row);
|
|
1126
1127
|
},
|
|
1127
1128
|
async insertNodeNoReturn(params) {
|
|
@@ -1171,7 +1172,7 @@ function createCommonOperationBackend(options) {
|
|
|
1171
1172
|
const timestamp2 = nowIso2();
|
|
1172
1173
|
const query = operationStrategy.buildUpdateNode(params, timestamp2);
|
|
1173
1174
|
const row = await execution.execGet(query);
|
|
1174
|
-
if (!row) throw new
|
|
1175
|
+
if (!row) throw new chunkJIEJCTDS_cjs.DatabaseOperationError("Update node failed: no row returned", { operation: "update", entity: "node" });
|
|
1175
1176
|
return rowMappers.toNodeRow(row);
|
|
1176
1177
|
},
|
|
1177
1178
|
async deleteNode(params) {
|
|
@@ -1215,7 +1216,7 @@ function createCommonOperationBackend(options) {
|
|
|
1215
1216
|
const timestamp2 = nowIso2();
|
|
1216
1217
|
const query = operationStrategy.buildInsertEdge(params, timestamp2);
|
|
1217
1218
|
const row = await execution.execGet(query);
|
|
1218
|
-
if (!row) throw new
|
|
1219
|
+
if (!row) throw new chunkJIEJCTDS_cjs.DatabaseOperationError("Insert edge failed: no row returned", { operation: "insert", entity: "edge" });
|
|
1219
1220
|
return rowMappers.toEdgeRow(row);
|
|
1220
1221
|
},
|
|
1221
1222
|
async insertEdgeNoReturn(params) {
|
|
@@ -1265,7 +1266,7 @@ function createCommonOperationBackend(options) {
|
|
|
1265
1266
|
const timestamp2 = nowIso2();
|
|
1266
1267
|
const query = operationStrategy.buildUpdateEdge(params, timestamp2);
|
|
1267
1268
|
const row = await execution.execGet(query);
|
|
1268
|
-
if (!row) throw new
|
|
1269
|
+
if (!row) throw new chunkJIEJCTDS_cjs.DatabaseOperationError("Update edge failed: no row returned", { operation: "update", entity: "edge" });
|
|
1269
1270
|
return rowMappers.toEdgeRow(row);
|
|
1270
1271
|
},
|
|
1271
1272
|
async deleteEdge(params) {
|
|
@@ -1316,7 +1317,7 @@ function createCommonOperationBackend(options) {
|
|
|
1316
1317
|
const query = operationStrategy.buildInsertUnique(params);
|
|
1317
1318
|
const result = await execution.execGet(query);
|
|
1318
1319
|
if (result && result.node_id !== params.nodeId) {
|
|
1319
|
-
throw new
|
|
1320
|
+
throw new chunkJIEJCTDS_cjs.UniquenessError({
|
|
1320
1321
|
constraintName: params.constraintName,
|
|
1321
1322
|
kind: params.nodeKind,
|
|
1322
1323
|
existingId: result.node_id,
|
|
@@ -1366,7 +1367,7 @@ function createCommonOperationBackend(options) {
|
|
|
1366
1367
|
if (existingRaw !== void 0) {
|
|
1367
1368
|
const existing = rowMappers.toSchemaVersionRow(existingRaw);
|
|
1368
1369
|
if (existing.schema_hash !== params.schemaHash) {
|
|
1369
|
-
throw new
|
|
1370
|
+
throw new chunkJIEJCTDS_cjs.SchemaContentConflictError({
|
|
1370
1371
|
graphId: params.graphId,
|
|
1371
1372
|
version: params.version,
|
|
1372
1373
|
existingHash: existing.schema_hash,
|
|
@@ -1414,7 +1415,7 @@ function createCommonOperationBackend(options) {
|
|
|
1414
1415
|
);
|
|
1415
1416
|
const insertedRaw = await execution.execGet(insertQuery);
|
|
1416
1417
|
if (!insertedRaw) {
|
|
1417
|
-
throw new
|
|
1418
|
+
throw new chunkJIEJCTDS_cjs.DatabaseOperationError(
|
|
1418
1419
|
"Insert schema failed: no row returned",
|
|
1419
1420
|
{ operation: "insert", entity: "schema" }
|
|
1420
1421
|
);
|
|
@@ -1435,7 +1436,7 @@ function createCommonOperationBackend(options) {
|
|
|
1435
1436
|
)
|
|
1436
1437
|
);
|
|
1437
1438
|
if (!targetRaw) {
|
|
1438
|
-
throw new
|
|
1439
|
+
throw new chunkJIEJCTDS_cjs.MigrationError(
|
|
1439
1440
|
`Cannot activate version ${params.version}: version does not exist for graph "${params.graphId}".`,
|
|
1440
1441
|
{
|
|
1441
1442
|
graphId: params.graphId,
|
|
@@ -1460,7 +1461,7 @@ function createCommonOperationBackend(options) {
|
|
|
1460
1461
|
};
|
|
1461
1462
|
}
|
|
1462
1463
|
function buildClearGraph(tables3, graphId) {
|
|
1463
|
-
const fulltext2 =
|
|
1464
|
+
const fulltext2 = chunkV4IQYOQ4_cjs.quotedTableName(tables3.fulltextTableName);
|
|
1464
1465
|
return [
|
|
1465
1466
|
drizzleOrm.sql`DELETE FROM ${fulltext2} WHERE "graph_id" = ${graphId}`,
|
|
1466
1467
|
drizzleOrm.sql`DELETE FROM ${tables3.uniques} WHERE ${tables3.uniques.graphId} = ${graphId}`,
|
|
@@ -1558,12 +1559,16 @@ function buildFindEdgesByKind(tables3, params) {
|
|
|
1558
1559
|
if (params.toId !== void 0) {
|
|
1559
1560
|
conditions.push(drizzleOrm.sql`${edges2.toId} = ${params.toId}`);
|
|
1560
1561
|
}
|
|
1562
|
+
if (params.orderBy === "id" && params.after !== void 0) {
|
|
1563
|
+
conditions.push(drizzleOrm.sql`${edges2.id} > ${params.after}`);
|
|
1564
|
+
}
|
|
1561
1565
|
const whereClause = drizzleOrm.sql.join(conditions, drizzleOrm.sql` AND `);
|
|
1566
|
+
const orderByClause = params.orderBy === "id" ? drizzleOrm.sql`${edges2.id} ASC` : drizzleOrm.sql`${edges2.createdAt} DESC, ${edges2.id} DESC`;
|
|
1562
1567
|
if (params.limit !== void 0 && params.offset !== void 0) {
|
|
1563
1568
|
return drizzleOrm.sql`
|
|
1564
1569
|
SELECT * FROM ${edges2}
|
|
1565
1570
|
WHERE ${whereClause}
|
|
1566
|
-
ORDER BY ${
|
|
1571
|
+
ORDER BY ${orderByClause}
|
|
1567
1572
|
LIMIT ${params.limit} OFFSET ${params.offset}
|
|
1568
1573
|
`;
|
|
1569
1574
|
}
|
|
@@ -1571,14 +1576,14 @@ function buildFindEdgesByKind(tables3, params) {
|
|
|
1571
1576
|
return drizzleOrm.sql`
|
|
1572
1577
|
SELECT * FROM ${edges2}
|
|
1573
1578
|
WHERE ${whereClause}
|
|
1574
|
-
ORDER BY ${
|
|
1579
|
+
ORDER BY ${orderByClause}
|
|
1575
1580
|
LIMIT ${params.limit}
|
|
1576
1581
|
`;
|
|
1577
1582
|
}
|
|
1578
1583
|
return drizzleOrm.sql`
|
|
1579
1584
|
SELECT * FROM ${edges2}
|
|
1580
1585
|
WHERE ${whereClause}
|
|
1581
|
-
ORDER BY ${
|
|
1586
|
+
ORDER BY ${orderByClause}
|
|
1582
1587
|
`;
|
|
1583
1588
|
}
|
|
1584
1589
|
function buildCountEdgesByKind(tables3, params) {
|
|
@@ -1609,13 +1614,13 @@ function buildCountEdgesByKind(tables3, params) {
|
|
|
1609
1614
|
function buildInsertEdge(tables3, params, timestamp2) {
|
|
1610
1615
|
const { edges: edges2 } = tables3;
|
|
1611
1616
|
const propsJson = JSON.stringify(params.props);
|
|
1612
|
-
const columns =
|
|
1617
|
+
const columns = chunkV4IQYOQ4_cjs.edgeColumnList(edges2);
|
|
1613
1618
|
return drizzleOrm.sql`
|
|
1614
1619
|
INSERT INTO ${edges2} (${columns})
|
|
1615
1620
|
VALUES (
|
|
1616
1621
|
${params.graphId}, ${params.id}, ${params.kind},
|
|
1617
1622
|
${params.fromKind}, ${params.fromId}, ${params.toKind}, ${params.toId},
|
|
1618
|
-
${propsJson}, ${
|
|
1623
|
+
${propsJson}, ${chunkV4IQYOQ4_cjs.sqlNull(params.validFrom)}, ${chunkV4IQYOQ4_cjs.sqlNull(params.validTo)},
|
|
1619
1624
|
${timestamp2}, ${timestamp2}
|
|
1620
1625
|
)
|
|
1621
1626
|
RETURNING *
|
|
@@ -1624,23 +1629,23 @@ function buildInsertEdge(tables3, params, timestamp2) {
|
|
|
1624
1629
|
function buildInsertEdgeNoReturn(tables3, params, timestamp2) {
|
|
1625
1630
|
const { edges: edges2 } = tables3;
|
|
1626
1631
|
const propsJson = JSON.stringify(params.props);
|
|
1627
|
-
const columns =
|
|
1632
|
+
const columns = chunkV4IQYOQ4_cjs.edgeColumnList(edges2);
|
|
1628
1633
|
return drizzleOrm.sql`
|
|
1629
1634
|
INSERT INTO ${edges2} (${columns})
|
|
1630
1635
|
VALUES (
|
|
1631
1636
|
${params.graphId}, ${params.id}, ${params.kind},
|
|
1632
1637
|
${params.fromKind}, ${params.fromId}, ${params.toKind}, ${params.toId},
|
|
1633
|
-
${propsJson}, ${
|
|
1638
|
+
${propsJson}, ${chunkV4IQYOQ4_cjs.sqlNull(params.validFrom)}, ${chunkV4IQYOQ4_cjs.sqlNull(params.validTo)},
|
|
1634
1639
|
${timestamp2}, ${timestamp2}
|
|
1635
1640
|
)
|
|
1636
1641
|
`;
|
|
1637
1642
|
}
|
|
1638
1643
|
function buildInsertEdgesBatch(tables3, params, timestamp2) {
|
|
1639
1644
|
const { edges: edges2 } = tables3;
|
|
1640
|
-
const columns =
|
|
1645
|
+
const columns = chunkV4IQYOQ4_cjs.edgeColumnList(edges2);
|
|
1641
1646
|
const values = params.map((edgeParams) => {
|
|
1642
1647
|
const propsJson = JSON.stringify(edgeParams.props);
|
|
1643
|
-
return drizzleOrm.sql`(${edgeParams.graphId}, ${edgeParams.id}, ${edgeParams.kind}, ${edgeParams.fromKind}, ${edgeParams.fromId}, ${edgeParams.toKind}, ${edgeParams.toId}, ${propsJson}, ${
|
|
1648
|
+
return drizzleOrm.sql`(${edgeParams.graphId}, ${edgeParams.id}, ${edgeParams.kind}, ${edgeParams.fromKind}, ${edgeParams.fromId}, ${edgeParams.toKind}, ${edgeParams.toId}, ${propsJson}, ${chunkV4IQYOQ4_cjs.sqlNull(edgeParams.validFrom)}, ${chunkV4IQYOQ4_cjs.sqlNull(edgeParams.validTo)}, ${timestamp2}, ${timestamp2})`;
|
|
1644
1649
|
});
|
|
1645
1650
|
return drizzleOrm.sql`
|
|
1646
1651
|
INSERT INTO ${edges2} (${columns})
|
|
@@ -1649,10 +1654,10 @@ function buildInsertEdgesBatch(tables3, params, timestamp2) {
|
|
|
1649
1654
|
}
|
|
1650
1655
|
function buildInsertEdgesBatchReturning(tables3, params, timestamp2) {
|
|
1651
1656
|
const { edges: edges2 } = tables3;
|
|
1652
|
-
const columns =
|
|
1657
|
+
const columns = chunkV4IQYOQ4_cjs.edgeColumnList(edges2);
|
|
1653
1658
|
const values = params.map((edgeParams) => {
|
|
1654
1659
|
const propsJson = JSON.stringify(edgeParams.props);
|
|
1655
|
-
return drizzleOrm.sql`(${edgeParams.graphId}, ${edgeParams.id}, ${edgeParams.kind}, ${edgeParams.fromKind}, ${edgeParams.fromId}, ${edgeParams.toKind}, ${edgeParams.toId}, ${propsJson}, ${
|
|
1660
|
+
return drizzleOrm.sql`(${edgeParams.graphId}, ${edgeParams.id}, ${edgeParams.kind}, ${edgeParams.fromKind}, ${edgeParams.fromId}, ${edgeParams.toKind}, ${edgeParams.toId}, ${propsJson}, ${chunkV4IQYOQ4_cjs.sqlNull(edgeParams.validFrom)}, ${chunkV4IQYOQ4_cjs.sqlNull(edgeParams.validTo)}, ${timestamp2}, ${timestamp2})`;
|
|
1656
1661
|
});
|
|
1657
1662
|
return drizzleOrm.sql`
|
|
1658
1663
|
INSERT INTO ${edges2} (${columns})
|
|
@@ -1684,14 +1689,14 @@ function buildUpdateEdge(tables3, params, timestamp2) {
|
|
|
1684
1689
|
const { edges: edges2 } = tables3;
|
|
1685
1690
|
const propsJson = JSON.stringify(params.props);
|
|
1686
1691
|
const setParts = [
|
|
1687
|
-
drizzleOrm.sql`${
|
|
1688
|
-
drizzleOrm.sql`${
|
|
1692
|
+
drizzleOrm.sql`${chunkV4IQYOQ4_cjs.quotedColumn(edges2.props)} = ${propsJson}`,
|
|
1693
|
+
drizzleOrm.sql`${chunkV4IQYOQ4_cjs.quotedColumn(edges2.updatedAt)} = ${timestamp2}`
|
|
1689
1694
|
];
|
|
1690
1695
|
if (params.validTo !== void 0) {
|
|
1691
|
-
setParts.push(drizzleOrm.sql`${
|
|
1696
|
+
setParts.push(drizzleOrm.sql`${chunkV4IQYOQ4_cjs.quotedColumn(edges2.validTo)} = ${params.validTo}`);
|
|
1692
1697
|
}
|
|
1693
1698
|
if (params.clearDeleted) {
|
|
1694
|
-
setParts.push(drizzleOrm.sql`${
|
|
1699
|
+
setParts.push(drizzleOrm.sql`${chunkV4IQYOQ4_cjs.quotedColumn(edges2.deletedAt)} = NULL`);
|
|
1695
1700
|
}
|
|
1696
1701
|
const setClause = drizzleOrm.sql.join(setParts, drizzleOrm.sql`, `);
|
|
1697
1702
|
if (params.clearDeleted) {
|
|
@@ -1716,7 +1721,7 @@ function buildDeleteEdge(tables3, params, timestamp2) {
|
|
|
1716
1721
|
const { edges: edges2 } = tables3;
|
|
1717
1722
|
return drizzleOrm.sql`
|
|
1718
1723
|
UPDATE ${edges2}
|
|
1719
|
-
SET ${
|
|
1724
|
+
SET ${chunkV4IQYOQ4_cjs.quotedColumn(edges2.deletedAt)} = ${timestamp2}
|
|
1720
1725
|
WHERE ${edges2.graphId} = ${params.graphId}
|
|
1721
1726
|
AND ${edges2.id} = ${params.id}
|
|
1722
1727
|
AND ${edges2.deletedAt} IS NULL
|
|
@@ -1803,7 +1808,7 @@ function resolveMode(mode) {
|
|
|
1803
1808
|
function buildFulltextSearch(tableName, params, strategy) {
|
|
1804
1809
|
assertValidSearchParams(params);
|
|
1805
1810
|
const mode = resolveMode(params.mode);
|
|
1806
|
-
const table =
|
|
1811
|
+
const table = chunkV4IQYOQ4_cjs.quotedTableName(tableName);
|
|
1807
1812
|
const matchCondition = strategy.matchCondition(
|
|
1808
1813
|
tableName,
|
|
1809
1814
|
params.query,
|
|
@@ -1854,12 +1859,12 @@ function assertValidSearchParams(params) {
|
|
|
1854
1859
|
function buildInsertNode(tables3, params, timestamp2) {
|
|
1855
1860
|
const { nodes: nodes2 } = tables3;
|
|
1856
1861
|
const propsJson = JSON.stringify(params.props);
|
|
1857
|
-
const columns =
|
|
1862
|
+
const columns = chunkV4IQYOQ4_cjs.nodeColumnList(nodes2);
|
|
1858
1863
|
return drizzleOrm.sql`
|
|
1859
1864
|
INSERT INTO ${nodes2} (${columns})
|
|
1860
1865
|
VALUES (
|
|
1861
1866
|
${params.graphId}, ${params.kind}, ${params.id}, ${propsJson},
|
|
1862
|
-
1, ${
|
|
1867
|
+
1, ${chunkV4IQYOQ4_cjs.sqlNull(params.validFrom)}, ${chunkV4IQYOQ4_cjs.sqlNull(params.validTo)},
|
|
1863
1868
|
${timestamp2}, ${timestamp2}
|
|
1864
1869
|
)
|
|
1865
1870
|
RETURNING *
|
|
@@ -1868,22 +1873,22 @@ function buildInsertNode(tables3, params, timestamp2) {
|
|
|
1868
1873
|
function buildInsertNodeNoReturn(tables3, params, timestamp2) {
|
|
1869
1874
|
const { nodes: nodes2 } = tables3;
|
|
1870
1875
|
const propsJson = JSON.stringify(params.props);
|
|
1871
|
-
const columns =
|
|
1876
|
+
const columns = chunkV4IQYOQ4_cjs.nodeColumnList(nodes2);
|
|
1872
1877
|
return drizzleOrm.sql`
|
|
1873
1878
|
INSERT INTO ${nodes2} (${columns})
|
|
1874
1879
|
VALUES (
|
|
1875
1880
|
${params.graphId}, ${params.kind}, ${params.id}, ${propsJson},
|
|
1876
|
-
1, ${
|
|
1881
|
+
1, ${chunkV4IQYOQ4_cjs.sqlNull(params.validFrom)}, ${chunkV4IQYOQ4_cjs.sqlNull(params.validTo)},
|
|
1877
1882
|
${timestamp2}, ${timestamp2}
|
|
1878
1883
|
)
|
|
1879
1884
|
`;
|
|
1880
1885
|
}
|
|
1881
1886
|
function buildInsertNodesBatch(tables3, params, timestamp2) {
|
|
1882
1887
|
const { nodes: nodes2 } = tables3;
|
|
1883
|
-
const columns =
|
|
1888
|
+
const columns = chunkV4IQYOQ4_cjs.nodeColumnList(nodes2);
|
|
1884
1889
|
const values = params.map((nodeParams) => {
|
|
1885
1890
|
const propsJson = JSON.stringify(nodeParams.props);
|
|
1886
|
-
return drizzleOrm.sql`(${nodeParams.graphId}, ${nodeParams.kind}, ${nodeParams.id}, ${propsJson}, 1, ${
|
|
1891
|
+
return drizzleOrm.sql`(${nodeParams.graphId}, ${nodeParams.kind}, ${nodeParams.id}, ${propsJson}, 1, ${chunkV4IQYOQ4_cjs.sqlNull(nodeParams.validFrom)}, ${chunkV4IQYOQ4_cjs.sqlNull(nodeParams.validTo)}, ${timestamp2}, ${timestamp2})`;
|
|
1887
1892
|
});
|
|
1888
1893
|
return drizzleOrm.sql`
|
|
1889
1894
|
INSERT INTO ${nodes2} (${columns})
|
|
@@ -1892,10 +1897,10 @@ function buildInsertNodesBatch(tables3, params, timestamp2) {
|
|
|
1892
1897
|
}
|
|
1893
1898
|
function buildInsertNodesBatchReturning(tables3, params, timestamp2) {
|
|
1894
1899
|
const { nodes: nodes2 } = tables3;
|
|
1895
|
-
const columns =
|
|
1900
|
+
const columns = chunkV4IQYOQ4_cjs.nodeColumnList(nodes2);
|
|
1896
1901
|
const values = params.map((nodeParams) => {
|
|
1897
1902
|
const propsJson = JSON.stringify(nodeParams.props);
|
|
1898
|
-
return drizzleOrm.sql`(${nodeParams.graphId}, ${nodeParams.kind}, ${nodeParams.id}, ${propsJson}, 1, ${
|
|
1903
|
+
return drizzleOrm.sql`(${nodeParams.graphId}, ${nodeParams.kind}, ${nodeParams.id}, ${propsJson}, 1, ${chunkV4IQYOQ4_cjs.sqlNull(nodeParams.validFrom)}, ${chunkV4IQYOQ4_cjs.sqlNull(nodeParams.validTo)}, ${timestamp2}, ${timestamp2})`;
|
|
1899
1904
|
});
|
|
1900
1905
|
return drizzleOrm.sql`
|
|
1901
1906
|
INSERT INTO ${nodes2} (${columns})
|
|
@@ -1929,19 +1934,19 @@ function buildUpdateNode(tables3, params, timestamp2) {
|
|
|
1929
1934
|
const { nodes: nodes2 } = tables3;
|
|
1930
1935
|
const propsJson = JSON.stringify(params.props);
|
|
1931
1936
|
const setParts = [
|
|
1932
|
-
drizzleOrm.sql`${
|
|
1933
|
-
drizzleOrm.sql`${
|
|
1937
|
+
drizzleOrm.sql`${chunkV4IQYOQ4_cjs.quotedColumn(nodes2.props)} = ${propsJson}`,
|
|
1938
|
+
drizzleOrm.sql`${chunkV4IQYOQ4_cjs.quotedColumn(nodes2.updatedAt)} = ${timestamp2}`
|
|
1934
1939
|
];
|
|
1935
1940
|
if (params.incrementVersion) {
|
|
1936
1941
|
setParts.push(
|
|
1937
|
-
drizzleOrm.sql`${
|
|
1942
|
+
drizzleOrm.sql`${chunkV4IQYOQ4_cjs.quotedColumn(nodes2.version)} = ${chunkV4IQYOQ4_cjs.quotedColumn(nodes2.version)} + 1`
|
|
1938
1943
|
);
|
|
1939
1944
|
}
|
|
1940
1945
|
if (params.validTo !== void 0) {
|
|
1941
|
-
setParts.push(drizzleOrm.sql`${
|
|
1946
|
+
setParts.push(drizzleOrm.sql`${chunkV4IQYOQ4_cjs.quotedColumn(nodes2.validTo)} = ${params.validTo}`);
|
|
1942
1947
|
}
|
|
1943
1948
|
if (params.clearDeleted) {
|
|
1944
|
-
setParts.push(drizzleOrm.sql`${
|
|
1949
|
+
setParts.push(drizzleOrm.sql`${chunkV4IQYOQ4_cjs.quotedColumn(nodes2.deletedAt)} = NULL`);
|
|
1945
1950
|
}
|
|
1946
1951
|
const setClause = drizzleOrm.sql.join(setParts, drizzleOrm.sql`, `);
|
|
1947
1952
|
if (params.clearDeleted) {
|
|
@@ -1968,7 +1973,7 @@ function buildDeleteNode(tables3, params, timestamp2) {
|
|
|
1968
1973
|
const { nodes: nodes2 } = tables3;
|
|
1969
1974
|
return drizzleOrm.sql`
|
|
1970
1975
|
UPDATE ${nodes2}
|
|
1971
|
-
SET ${
|
|
1976
|
+
SET ${chunkV4IQYOQ4_cjs.quotedColumn(nodes2.deletedAt)} = ${timestamp2}
|
|
1972
1977
|
WHERE ${nodes2.graphId} = ${params.graphId}
|
|
1973
1978
|
AND ${nodes2.kind} = ${params.kind}
|
|
1974
1979
|
AND ${nodes2.id} = ${params.id}
|
|
@@ -2035,12 +2040,12 @@ function buildSetActiveSchema(tables3, graphId, version, dialect = "sqlite") {
|
|
|
2035
2040
|
const strategy = SCHEMA_DIALECT_STRATEGIES[dialect];
|
|
2036
2041
|
const deactivateAll = drizzleOrm.sql`
|
|
2037
2042
|
UPDATE ${schemaVersions2}
|
|
2038
|
-
SET ${
|
|
2043
|
+
SET ${chunkV4IQYOQ4_cjs.quotedColumn(schemaVersions2.isActive)} = ${strategy.booleanLiteral(false)}
|
|
2039
2044
|
WHERE ${schemaVersions2.graphId} = ${graphId}
|
|
2040
2045
|
`;
|
|
2041
2046
|
const activateVersion = drizzleOrm.sql`
|
|
2042
2047
|
UPDATE ${schemaVersions2}
|
|
2043
|
-
SET ${
|
|
2048
|
+
SET ${chunkV4IQYOQ4_cjs.quotedColumn(schemaVersions2.isActive)} = ${strategy.booleanLiteral(true)}
|
|
2044
2049
|
WHERE ${schemaVersions2.graphId} = ${graphId}
|
|
2045
2050
|
AND ${schemaVersions2.version} = ${version}
|
|
2046
2051
|
`;
|
|
@@ -2058,22 +2063,22 @@ function buildInsertUniqueSqlite(tables3, params) {
|
|
|
2058
2063
|
)
|
|
2059
2064
|
ON CONFLICT (${conflictColumns})
|
|
2060
2065
|
DO UPDATE SET
|
|
2061
|
-
${
|
|
2062
|
-
WHEN ${
|
|
2063
|
-
WHEN ${
|
|
2064
|
-
ELSE ${
|
|
2066
|
+
${chunkV4IQYOQ4_cjs.quotedColumn(uniques2.nodeId)} = CASE
|
|
2067
|
+
WHEN ${chunkV4IQYOQ4_cjs.quotedColumn(uniques2.nodeId)} = ${params.nodeId} THEN ${params.nodeId}
|
|
2068
|
+
WHEN ${chunkV4IQYOQ4_cjs.quotedColumn(uniques2.deletedAt)} IS NOT NULL THEN ${params.nodeId}
|
|
2069
|
+
ELSE ${chunkV4IQYOQ4_cjs.quotedColumn(uniques2.nodeId)}
|
|
2065
2070
|
END,
|
|
2066
|
-
${
|
|
2067
|
-
WHEN ${
|
|
2068
|
-
WHEN ${
|
|
2069
|
-
ELSE ${
|
|
2071
|
+
${chunkV4IQYOQ4_cjs.quotedColumn(uniques2.concreteKind)} = CASE
|
|
2072
|
+
WHEN ${chunkV4IQYOQ4_cjs.quotedColumn(uniques2.nodeId)} = ${params.nodeId} THEN ${params.concreteKind}
|
|
2073
|
+
WHEN ${chunkV4IQYOQ4_cjs.quotedColumn(uniques2.deletedAt)} IS NOT NULL THEN ${params.concreteKind}
|
|
2074
|
+
ELSE ${chunkV4IQYOQ4_cjs.quotedColumn(uniques2.concreteKind)}
|
|
2070
2075
|
END,
|
|
2071
|
-
${
|
|
2072
|
-
WHEN ${
|
|
2073
|
-
WHEN ${
|
|
2074
|
-
ELSE ${
|
|
2076
|
+
${chunkV4IQYOQ4_cjs.quotedColumn(uniques2.deletedAt)} = CASE
|
|
2077
|
+
WHEN ${chunkV4IQYOQ4_cjs.quotedColumn(uniques2.nodeId)} = ${params.nodeId} THEN NULL
|
|
2078
|
+
WHEN ${chunkV4IQYOQ4_cjs.quotedColumn(uniques2.deletedAt)} IS NOT NULL THEN NULL
|
|
2079
|
+
ELSE ${chunkV4IQYOQ4_cjs.quotedColumn(uniques2.deletedAt)}
|
|
2075
2080
|
END
|
|
2076
|
-
RETURNING ${
|
|
2081
|
+
RETURNING ${chunkV4IQYOQ4_cjs.quotedColumn(uniques2.nodeId)} as node_id
|
|
2077
2082
|
`;
|
|
2078
2083
|
}
|
|
2079
2084
|
function buildInsertUniquePostgres(tables3, params) {
|
|
@@ -2090,22 +2095,22 @@ function buildInsertUniquePostgres(tables3, params) {
|
|
|
2090
2095
|
)
|
|
2091
2096
|
ON CONFLICT (${conflictColumns})
|
|
2092
2097
|
DO UPDATE SET
|
|
2093
|
-
${
|
|
2098
|
+
${chunkV4IQYOQ4_cjs.quotedColumn(uniques2.nodeId)} = CASE
|
|
2094
2099
|
WHEN ${existingColumn(uniques2.nodeId)} = ${params.nodeId} THEN ${params.nodeId}
|
|
2095
2100
|
WHEN ${existingColumn(uniques2.deletedAt)} IS NOT NULL THEN ${params.nodeId}
|
|
2096
2101
|
ELSE ${existingColumn(uniques2.nodeId)}
|
|
2097
2102
|
END,
|
|
2098
|
-
${
|
|
2103
|
+
${chunkV4IQYOQ4_cjs.quotedColumn(uniques2.concreteKind)} = CASE
|
|
2099
2104
|
WHEN ${existingColumn(uniques2.nodeId)} = ${params.nodeId} THEN ${params.concreteKind}
|
|
2100
2105
|
WHEN ${existingColumn(uniques2.deletedAt)} IS NOT NULL THEN ${params.concreteKind}
|
|
2101
2106
|
ELSE ${existingColumn(uniques2.concreteKind)}
|
|
2102
2107
|
END,
|
|
2103
|
-
${
|
|
2108
|
+
${chunkV4IQYOQ4_cjs.quotedColumn(uniques2.deletedAt)} = CASE
|
|
2104
2109
|
WHEN ${existingColumn(uniques2.nodeId)} = ${params.nodeId} THEN NULL
|
|
2105
2110
|
WHEN ${existingColumn(uniques2.deletedAt)} IS NOT NULL THEN NULL
|
|
2106
2111
|
ELSE ${existingColumn(uniques2.deletedAt)}
|
|
2107
2112
|
END
|
|
2108
|
-
RETURNING ${
|
|
2113
|
+
RETURNING ${chunkV4IQYOQ4_cjs.quotedColumn(uniques2.nodeId)} as node_id
|
|
2109
2114
|
`;
|
|
2110
2115
|
}
|
|
2111
2116
|
var UNIQUE_INSERT_BUILDERS = {
|
|
@@ -2120,7 +2125,7 @@ function buildDeleteUnique(tables3, params, timestamp2) {
|
|
|
2120
2125
|
const { uniques: uniques2 } = tables3;
|
|
2121
2126
|
return drizzleOrm.sql`
|
|
2122
2127
|
UPDATE ${uniques2}
|
|
2123
|
-
SET ${
|
|
2128
|
+
SET ${chunkV4IQYOQ4_cjs.quotedColumn(uniques2.deletedAt)} = ${timestamp2}
|
|
2124
2129
|
WHERE ${uniques2.graphId} = ${params.graphId}
|
|
2125
2130
|
AND ${uniques2.nodeKind} = ${params.nodeKind}
|
|
2126
2131
|
AND ${uniques2.constraintName} = ${params.constraintName}
|
|
@@ -2346,5 +2351,5 @@ exports.uniques = uniques;
|
|
|
2346
2351
|
exports.vectorSlotFromCreateIndexParams = vectorSlotFromCreateIndexParams;
|
|
2347
2352
|
exports.vectorSlotFromDropIndexParams = vectorSlotFromDropIndexParams;
|
|
2348
2353
|
exports.vectorSlotFromParams = vectorSlotFromParams;
|
|
2349
|
-
//# sourceMappingURL=chunk-
|
|
2350
|
-
//# sourceMappingURL=chunk-
|
|
2354
|
+
//# sourceMappingURL=chunk-CIINW6PS.cjs.map
|
|
2355
|
+
//# sourceMappingURL=chunk-CIINW6PS.cjs.map
|