@nicia-ai/typegraph 0.25.0 → 0.26.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 +167 -71
- package/dist/backend/postgres/index.cjs.map +1 -1
- package/dist/backend/postgres/index.d.cts +6 -8
- package/dist/backend/postgres/index.d.ts +6 -8
- package/dist/backend/postgres/index.js +119 -27
- package/dist/backend/postgres/index.js.map +1 -1
- package/dist/backend/sqlite/index.cjs +16 -15
- package/dist/backend/sqlite/index.d.cts +11 -26
- package/dist/backend/sqlite/index.d.ts +11 -26
- package/dist/backend/sqlite/index.js +6 -5
- package/dist/backend/sqlite/libsql.cjs +9 -8
- package/dist/backend/sqlite/libsql.cjs.map +1 -1
- package/dist/backend/sqlite/libsql.d.cts +4 -3
- package/dist/backend/sqlite/libsql.d.ts +4 -3
- package/dist/backend/sqlite/libsql.js +6 -5
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +11 -10
- package/dist/backend/sqlite/local.cjs.map +1 -1
- package/dist/backend/sqlite/local.d.cts +4 -3
- package/dist/backend/sqlite/local.d.ts +4 -3
- package/dist/backend/sqlite/local.js +6 -5
- package/dist/backend/sqlite/local.js.map +1 -1
- package/dist/{chunk-LVCSL6A3.js → chunk-3W6AIFT2.js} +11 -34
- package/dist/chunk-3W6AIFT2.js.map +1 -0
- package/dist/chunk-4FJVSF3K.cjs +12 -0
- package/dist/{chunk-D2GO3RBL.cjs.map → chunk-4FJVSF3K.cjs.map} +1 -1
- package/dist/{chunk-7W3KAMVQ.cjs → chunk-4TJI44WP.cjs} +94 -119
- package/dist/chunk-4TJI44WP.cjs.map +1 -0
- package/dist/chunk-5H3BAMTB.js +32 -0
- package/dist/chunk-5H3BAMTB.js.map +1 -0
- package/dist/{chunk-OJ6IQVZG.js → chunk-DDVA4QBA.js} +177 -37
- package/dist/chunk-DDVA4QBA.js.map +1 -0
- package/dist/{chunk-7CDXX3QZ.cjs → chunk-DN4RUDF3.cjs} +2 -2
- package/dist/chunk-DN4RUDF3.cjs.map +1 -0
- package/dist/{chunk-NHQWXSTS.js → chunk-E5ROA3MN.js} +3 -3
- package/dist/{chunk-NHQWXSTS.js.map → chunk-E5ROA3MN.js.map} +1 -1
- package/dist/{chunk-FPCOUJSL.js → chunk-ENXJLDRK.js} +2 -2
- package/dist/chunk-ENXJLDRK.js.map +1 -0
- package/dist/chunk-IUIWCFG3.cjs +36 -0
- package/dist/chunk-IUIWCFG3.cjs.map +1 -0
- package/dist/{chunk-EG6TJ3I5.js → chunk-OYLF3IC7.js} +3 -3
- package/dist/{chunk-EG6TJ3I5.js.map → chunk-OYLF3IC7.js.map} +1 -1
- package/dist/{chunk-JTI5WT4P.cjs → chunk-PN37HVAV.cjs} +32 -10
- package/dist/chunk-PN37HVAV.cjs.map +1 -0
- package/dist/{chunk-RCAJZG67.cjs → chunk-PYJOBZR3.cjs} +10 -10
- package/dist/{chunk-RCAJZG67.cjs.map → chunk-PYJOBZR3.cjs.map} +1 -1
- package/dist/{chunk-WI5VRP3X.js → chunk-RF5EUQWS.js} +371 -47
- package/dist/chunk-RF5EUQWS.js.map +1 -0
- package/dist/{chunk-ZEMNF3QK.cjs → chunk-RVT2N4RF.cjs} +209 -69
- package/dist/chunk-RVT2N4RF.cjs.map +1 -0
- package/dist/{chunk-4BOWVUGQ.js → chunk-TSGBRPNE.js} +3 -3
- package/dist/{chunk-4BOWVUGQ.js.map → chunk-TSGBRPNE.js.map} +1 -1
- package/dist/{chunk-O2P3KAUT.cjs → chunk-TVUARC7S.cjs} +445 -110
- package/dist/chunk-TVUARC7S.cjs.map +1 -0
- package/dist/{chunk-DOTEN2FG.js → chunk-U5ROKVRF.js} +26 -3
- package/dist/chunk-U5ROKVRF.js.map +1 -0
- package/dist/{chunk-E5JZSEGJ.cjs → chunk-WFUN6DCM.cjs} +8 -8
- package/dist/{chunk-E5JZSEGJ.cjs.map → chunk-WFUN6DCM.cjs.map} +1 -1
- package/dist/{chunk-W5MTHMTE.cjs → chunk-YEDQLNVE.cjs} +26 -2
- package/dist/chunk-YEDQLNVE.cjs.map +1 -0
- package/dist/{chunk-YZZBDCLV.js → chunk-ZTREJOGB.js} +32 -11
- package/dist/chunk-ZTREJOGB.js.map +1 -0
- package/dist/{ddl-B2jjLjpR.d.cts → ddl-9kw8UADK.d.ts} +697 -29
- package/dist/{ddl-DpaeAKPp.d.ts → ddl-Cw82BPM4.d.cts} +697 -29
- package/dist/{extension-types-D07e_NTw.d.cts → extension-types-B78CZfA5.d.cts} +1 -1
- package/dist/{extension-types-D07e_NTw.d.ts → extension-types-B78CZfA5.d.ts} +1 -1
- package/dist/graph-extension/index.cjs +18 -18
- package/dist/graph-extension/index.d.cts +4 -4
- package/dist/graph-extension/index.d.ts +4 -4
- package/dist/graph-extension/index.js +3 -3
- package/dist/{index-CT6nvtxL.d.cts → index-Bilw0pYm.d.cts} +34 -3
- package/dist/{index-DQheiVQV.d.ts → index-CWdBFWbI.d.ts} +34 -3
- package/dist/index.cjs +460 -361
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -11
- package/dist/index.d.ts +13 -11
- package/dist/index.js +131 -36
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +13 -13
- package/dist/indexes/index.d.cts +5 -5
- package/dist/indexes/index.d.ts +5 -5
- package/dist/indexes/index.js +1 -1
- package/dist/interchange/index.cjs +7 -7
- package/dist/interchange/index.d.cts +7 -5
- package/dist/interchange/index.d.ts +7 -5
- package/dist/interchange/index.js +2 -2
- package/dist/{manager-BpjBW1JK.d.cts → manager-Aqzmztkb.d.cts} +11 -3
- package/dist/{manager-BKaPQbns.d.ts → manager-C3LxzPcX.d.ts} +11 -3
- package/dist/{materialize-indexes-BB9N5uQl.d.cts → materialize-indexes-BQfaAZKA.d.cts} +1 -1
- package/dist/{materialize-indexes-BYpU2RKh.d.ts → materialize-indexes-DFavFQah.d.ts} +1 -1
- package/dist/profiler/index.d.cts +9 -7
- package/dist/profiler/index.d.ts +9 -7
- package/dist/schema/index.cjs +28 -27
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.cts +9 -7
- package/dist/schema/index.d.ts +9 -7
- package/dist/schema/index.js +6 -5
- package/dist/schema/index.js.map +1 -1
- package/dist/{sqlite-Myo8e3Lr.d.cts → sqlite-BvSEbybu.d.cts} +320 -1
- package/dist/{sqlite-CU3j6rc7.d.ts → sqlite-GKvcDPVn.d.ts} +320 -1
- package/dist/{store-BAGuOHDh.d.cts → store-CiS_AGNH.d.ts} +112 -4
- package/dist/{store-De98Lod4.d.ts → store-DbQLsSor.d.cts} +112 -4
- package/dist/{types-CYga3lZp.d.cts → types-CF7nDH3q.d.cts} +2 -2
- package/dist/{types-BLmJq4wI.d.ts → types-Cars4JZ1.d.ts} +2 -2
- package/dist/{types--0EslBx5.d.cts → types-DZPBXZOK.d.cts} +275 -8
- package/dist/{types-BNWYZ-0-.d.ts → types-Dzkr0Eqi.d.ts} +275 -8
- package/dist/{where-m1uWsdua.d.cts → where-BmtjfWuS.d.cts} +2 -2
- package/dist/{where-CluR73rs.d.ts → where-kk1Zz2En.d.ts} +2 -2
- package/package.json +3 -1
- package/dist/chunk-7CDXX3QZ.cjs.map +0 -1
- package/dist/chunk-7W3KAMVQ.cjs.map +0 -1
- package/dist/chunk-D2GO3RBL.cjs +0 -12
- package/dist/chunk-DOTEN2FG.js.map +0 -1
- package/dist/chunk-FPCOUJSL.js.map +0 -1
- package/dist/chunk-JTI5WT4P.cjs.map +0 -1
- package/dist/chunk-LVCSL6A3.js.map +0 -1
- package/dist/chunk-O2P3KAUT.cjs.map +0 -1
- package/dist/chunk-OJ6IQVZG.js.map +0 -1
- package/dist/chunk-W5MTHMTE.cjs.map +0 -1
- package/dist/chunk-WI5VRP3X.js.map +0 -1
- package/dist/chunk-YZZBDCLV.js.map +0 -1
- package/dist/chunk-ZEMNF3QK.cjs.map +0 -1
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkIUIWCFG3_cjs = require('./chunk-IUIWCFG3.cjs');
|
|
4
|
+
var chunkPN37HVAV_cjs = require('./chunk-PN37HVAV.cjs');
|
|
4
5
|
var chunkCTHNVU6K_cjs = require('./chunk-CTHNVU6K.cjs');
|
|
5
|
-
var
|
|
6
|
+
var chunkYEDQLNVE_cjs = require('./chunk-YEDQLNVE.cjs');
|
|
6
7
|
var drizzleOrm = require('drizzle-orm');
|
|
7
8
|
var pgCore = require('drizzle-orm/pg-core');
|
|
8
9
|
var sqliteCore = require('drizzle-orm/sqlite-core');
|
|
9
10
|
|
|
11
|
+
var regconfig = pgCore.customType({
|
|
12
|
+
dataType: () => "regconfig"
|
|
13
|
+
});
|
|
14
|
+
var tsvector = pgCore.customType({
|
|
15
|
+
dataType: () => "tsvector"
|
|
16
|
+
});
|
|
10
17
|
var vector = pgCore.customType({
|
|
11
18
|
dataType(config) {
|
|
12
19
|
return config?.dimensions ? `vector(${config.dimensions})` : "vector";
|
|
@@ -35,6 +42,7 @@ var DEFAULT_TABLE_NAMES = {
|
|
|
35
42
|
embeddings: "typegraph_node_embeddings",
|
|
36
43
|
fulltext: "typegraph_node_fulltext",
|
|
37
44
|
indexMaterializations: "typegraph_index_materializations",
|
|
45
|
+
contributionMaterializations: "typegraph_contribution_materializations",
|
|
38
46
|
kindRemovals: "typegraph_kind_removals",
|
|
39
47
|
reconciliationMarkers: "typegraph_reconciliation_markers"
|
|
40
48
|
};
|
|
@@ -66,7 +74,7 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
66
74
|
),
|
|
67
75
|
pgCore.index(`${n.nodes}_deleted_idx`).on(t.graphId, t.deletedAt),
|
|
68
76
|
pgCore.index(`${n.nodes}_valid_idx`).on(t.graphId, t.validFrom, t.validTo),
|
|
69
|
-
...
|
|
77
|
+
...chunkPN37HVAV_cjs.buildPostgresNodeIndexBuilders(t, indexes)
|
|
70
78
|
]
|
|
71
79
|
);
|
|
72
80
|
const edges3 = pgCore.pgTable(
|
|
@@ -125,7 +133,7 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
125
133
|
t.fromId,
|
|
126
134
|
t.validTo
|
|
127
135
|
),
|
|
128
|
-
...
|
|
136
|
+
...chunkPN37HVAV_cjs.buildPostgresEdgeIndexBuilders(t, indexes)
|
|
129
137
|
]
|
|
130
138
|
);
|
|
131
139
|
const uniques3 = pgCore.pgTable(
|
|
@@ -243,6 +251,43 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
243
251
|
},
|
|
244
252
|
(t) => [pgCore.primaryKey({ columns: [t.graphId] })]
|
|
245
253
|
);
|
|
254
|
+
const contributionMaterializations = pgCore.pgTable(
|
|
255
|
+
n.contributionMaterializations,
|
|
256
|
+
{
|
|
257
|
+
graphId: pgCore.text("graph_id").notNull(),
|
|
258
|
+
logicalName: pgCore.text("logical_name").notNull(),
|
|
259
|
+
owner: pgCore.text("owner").notNull(),
|
|
260
|
+
tableName: pgCore.text("table_name").notNull(),
|
|
261
|
+
signature: pgCore.text("signature").notNull(),
|
|
262
|
+
materializedAt: pgCore.timestamp("materialized_at", { withTimezone: true }),
|
|
263
|
+
lastAttemptedAt: pgCore.timestamp("last_attempted_at", {
|
|
264
|
+
withTimezone: true
|
|
265
|
+
}).notNull(),
|
|
266
|
+
lastError: pgCore.text("last_error")
|
|
267
|
+
},
|
|
268
|
+
(t) => [
|
|
269
|
+
pgCore.primaryKey({
|
|
270
|
+
columns: [t.graphId, t.logicalName, t.owner, t.tableName]
|
|
271
|
+
})
|
|
272
|
+
]
|
|
273
|
+
);
|
|
274
|
+
const fulltext2 = pgCore.pgTable(
|
|
275
|
+
n.fulltext,
|
|
276
|
+
{
|
|
277
|
+
graphId: pgCore.text("graph_id").notNull(),
|
|
278
|
+
nodeKind: pgCore.text("node_kind").notNull(),
|
|
279
|
+
nodeId: pgCore.text("node_id").notNull(),
|
|
280
|
+
content: pgCore.text("content").notNull(),
|
|
281
|
+
language: regconfig("language").notNull(),
|
|
282
|
+
tsv: tsvector("tsv").generatedAlwaysAs(drizzleOrm.sql`to_tsvector("language", "content")`).notNull(),
|
|
283
|
+
updatedAt: pgCore.timestamp("updated_at", { withTimezone: true }).notNull()
|
|
284
|
+
},
|
|
285
|
+
(t) => [
|
|
286
|
+
pgCore.primaryKey({ columns: [t.graphId, t.nodeKind, t.nodeId] }),
|
|
287
|
+
pgCore.index(`${n.fulltext}_tsv_idx`).using("gin", t.tsv),
|
|
288
|
+
pgCore.index(`${n.fulltext}_kind_idx`).on(t.graphId, t.nodeKind)
|
|
289
|
+
]
|
|
290
|
+
);
|
|
246
291
|
return {
|
|
247
292
|
nodes: nodes3,
|
|
248
293
|
edges: edges3,
|
|
@@ -250,22 +295,22 @@ function createPostgresTables(names = {}, options = {}) {
|
|
|
250
295
|
schemaVersions: schemaVersions3,
|
|
251
296
|
embeddings: embeddings3,
|
|
252
297
|
indexMaterializations,
|
|
298
|
+
contributionMaterializations,
|
|
253
299
|
kindRemovals,
|
|
254
300
|
reconciliationMarkers,
|
|
255
|
-
|
|
256
|
-
* The fulltext storage table is owned by the active `FulltextStrategy`,
|
|
257
|
-
* not Drizzle. Shapes vary across strategies — the default `tsvectorStrategy`
|
|
258
|
-
* uses a `regconfig` language column, a GENERATED STORED `tsv` column,
|
|
259
|
-
* and a GIN index; alternate strategies (ParadeDB, pg_trgm, pgroonga)
|
|
260
|
-
* pick their own column types and index methods. DDL is emitted as
|
|
261
|
-
* raw SQL via `strategy.generateDdl()`; reads and writes are composed
|
|
262
|
-
* from the strategy's fragment helpers.
|
|
263
|
-
*/
|
|
301
|
+
fulltext: fulltext2,
|
|
264
302
|
fulltextTableName: n.fulltext
|
|
265
303
|
};
|
|
266
304
|
}
|
|
267
305
|
var tables = createPostgresTables();
|
|
268
|
-
var {
|
|
306
|
+
var {
|
|
307
|
+
nodes,
|
|
308
|
+
edges,
|
|
309
|
+
uniques,
|
|
310
|
+
schemaVersions,
|
|
311
|
+
embeddings,
|
|
312
|
+
fulltext
|
|
313
|
+
} = tables;
|
|
269
314
|
var DEFAULT_TABLE_NAMES2 = {
|
|
270
315
|
nodes: "typegraph_nodes",
|
|
271
316
|
edges: "typegraph_edges",
|
|
@@ -274,6 +319,7 @@ var DEFAULT_TABLE_NAMES2 = {
|
|
|
274
319
|
embeddings: "typegraph_node_embeddings",
|
|
275
320
|
fulltext: "typegraph_node_fulltext",
|
|
276
321
|
indexMaterializations: "typegraph_index_materializations",
|
|
322
|
+
contributionMaterializations: "typegraph_contribution_materializations",
|
|
277
323
|
kindRemovals: "typegraph_kind_removals",
|
|
278
324
|
reconciliationMarkers: "typegraph_reconciliation_markers"
|
|
279
325
|
};
|
|
@@ -305,7 +351,7 @@ function createSqliteTables(names = {}, options = {}) {
|
|
|
305
351
|
),
|
|
306
352
|
sqliteCore.index(`${n.nodes}_deleted_idx`).on(t.graphId, t.deletedAt),
|
|
307
353
|
sqliteCore.index(`${n.nodes}_valid_idx`).on(t.graphId, t.validFrom, t.validTo),
|
|
308
|
-
...
|
|
354
|
+
...chunkPN37HVAV_cjs.buildSqliteNodeIndexBuilders(t, indexes)
|
|
309
355
|
]
|
|
310
356
|
);
|
|
311
357
|
const edges3 = sqliteCore.sqliteTable(
|
|
@@ -364,7 +410,7 @@ function createSqliteTables(names = {}, options = {}) {
|
|
|
364
410
|
t.fromId,
|
|
365
411
|
t.validTo
|
|
366
412
|
),
|
|
367
|
-
...
|
|
413
|
+
...chunkPN37HVAV_cjs.buildSqliteEdgeIndexBuilders(t, indexes)
|
|
368
414
|
]
|
|
369
415
|
);
|
|
370
416
|
const uniques3 = sqliteCore.sqliteTable(
|
|
@@ -482,6 +528,24 @@ function createSqliteTables(names = {}, options = {}) {
|
|
|
482
528
|
},
|
|
483
529
|
(t) => [sqliteCore.primaryKey({ columns: [t.graphId] })]
|
|
484
530
|
);
|
|
531
|
+
const contributionMaterializations = sqliteCore.sqliteTable(
|
|
532
|
+
n.contributionMaterializations,
|
|
533
|
+
{
|
|
534
|
+
graphId: sqliteCore.text("graph_id").notNull(),
|
|
535
|
+
logicalName: sqliteCore.text("logical_name").notNull(),
|
|
536
|
+
owner: sqliteCore.text("owner").notNull(),
|
|
537
|
+
tableName: sqliteCore.text("table_name").notNull(),
|
|
538
|
+
signature: sqliteCore.text("signature").notNull(),
|
|
539
|
+
materializedAt: sqliteCore.text("materialized_at"),
|
|
540
|
+
lastAttemptedAt: sqliteCore.text("last_attempted_at").notNull(),
|
|
541
|
+
lastError: sqliteCore.text("last_error")
|
|
542
|
+
},
|
|
543
|
+
(t) => [
|
|
544
|
+
sqliteCore.primaryKey({
|
|
545
|
+
columns: [t.graphId, t.logicalName, t.owner, t.tableName]
|
|
546
|
+
})
|
|
547
|
+
]
|
|
548
|
+
);
|
|
485
549
|
return {
|
|
486
550
|
nodes: nodes3,
|
|
487
551
|
edges: edges3,
|
|
@@ -489,6 +553,7 @@ function createSqliteTables(names = {}, options = {}) {
|
|
|
489
553
|
schemaVersions: schemaVersions3,
|
|
490
554
|
embeddings: embeddings3,
|
|
491
555
|
indexMaterializations,
|
|
556
|
+
contributionMaterializations,
|
|
492
557
|
kindRemovals,
|
|
493
558
|
reconciliationMarkers,
|
|
494
559
|
/**
|
|
@@ -556,9 +621,9 @@ function renderIndexColumn(col) {
|
|
|
556
621
|
if (col && typeof col === "object" && "name" in col) {
|
|
557
622
|
return `"${col.name}"`;
|
|
558
623
|
}
|
|
559
|
-
const
|
|
560
|
-
if (
|
|
561
|
-
return
|
|
624
|
+
const sql15 = tryInlineSql(col);
|
|
625
|
+
if (sql15 !== void 0) {
|
|
626
|
+
return sql15;
|
|
562
627
|
}
|
|
563
628
|
return "unknown";
|
|
564
629
|
}
|
|
@@ -629,23 +694,37 @@ function generateSqliteCreateIndexSQL(table) {
|
|
|
629
694
|
return statements;
|
|
630
695
|
}
|
|
631
696
|
function isSqliteTable(value) {
|
|
632
|
-
return
|
|
633
|
-
typeof value !== "string";
|
|
697
|
+
return drizzleOrm.is(value, sqliteCore.SQLiteTable);
|
|
634
698
|
}
|
|
635
|
-
function
|
|
636
|
-
|
|
637
|
-
|
|
699
|
+
function runtimeStrategyContributions(fulltextStrategy, fulltextTableName) {
|
|
700
|
+
return fulltextStrategy.ownedTables(fulltextTableName).filter((contribution) => contribution.runtimeEnsure);
|
|
701
|
+
}
|
|
702
|
+
function sqliteContributions(tables3 = tables2, fulltextStrategy = chunkPN37HVAV_cjs.fts5Strategy) {
|
|
703
|
+
const contributions = [];
|
|
704
|
+
for (const [key, table] of Object.entries(tables3)) {
|
|
638
705
|
if (!isSqliteTable(table)) continue;
|
|
639
|
-
|
|
706
|
+
contributions.push({
|
|
707
|
+
logicalName: key,
|
|
708
|
+
owner: chunkPN37HVAV_cjs.BASE_CONTRIBUTION_OWNER,
|
|
709
|
+
tableName: sqliteCore.getTableConfig(table).name,
|
|
710
|
+
createDdl: [
|
|
711
|
+
generateSqliteCreateTableSQL(table),
|
|
712
|
+
...generateSqliteCreateIndexSQL(table)
|
|
713
|
+
],
|
|
714
|
+
runtimeEnsure: false
|
|
715
|
+
});
|
|
640
716
|
}
|
|
641
|
-
for (const
|
|
642
|
-
|
|
643
|
-
|
|
717
|
+
for (const declared of fulltextStrategy.ownedTables(
|
|
718
|
+
tables3.fulltextTableName
|
|
719
|
+
)) {
|
|
720
|
+
contributions.push(declared);
|
|
644
721
|
}
|
|
645
|
-
|
|
646
|
-
return statements;
|
|
722
|
+
return contributions;
|
|
647
723
|
}
|
|
648
|
-
function
|
|
724
|
+
function generateSqliteDDL(tables3 = tables2, fulltextStrategy = chunkPN37HVAV_cjs.fts5Strategy) {
|
|
725
|
+
return sqliteContributions(tables3, fulltextStrategy).flatMap((contribution) => [...contribution.createDdl]);
|
|
726
|
+
}
|
|
727
|
+
function generateSqliteMigrationSQL(tables3 = tables2, fulltextStrategy = chunkPN37HVAV_cjs.fts5Strategy) {
|
|
649
728
|
return generateSqliteDDL(tables3, fulltextStrategy).join("\n\n");
|
|
650
729
|
}
|
|
651
730
|
function getPgColumnType(column) {
|
|
@@ -728,22 +807,35 @@ function generatePgCreateIndexSQL(table) {
|
|
|
728
807
|
return statements;
|
|
729
808
|
}
|
|
730
809
|
function isPgTable(value) {
|
|
731
|
-
return
|
|
810
|
+
return drizzleOrm.is(value, pgCore.PgTable);
|
|
732
811
|
}
|
|
733
|
-
function
|
|
734
|
-
const
|
|
735
|
-
for (const table of Object.
|
|
812
|
+
function postgresContributions(tables3 = tables, fulltextStrategy = chunkPN37HVAV_cjs.tsvectorStrategy) {
|
|
813
|
+
const contributions = [];
|
|
814
|
+
for (const [key, table] of Object.entries(tables3)) {
|
|
736
815
|
if (!isPgTable(table)) continue;
|
|
737
|
-
|
|
816
|
+
if (table === tables3.fulltext) continue;
|
|
817
|
+
contributions.push({
|
|
818
|
+
logicalName: key,
|
|
819
|
+
owner: chunkPN37HVAV_cjs.BASE_CONTRIBUTION_OWNER,
|
|
820
|
+
tableName: pgCore.getTableConfig(table).name,
|
|
821
|
+
createDdl: [
|
|
822
|
+
generatePgCreateTableSQL(table),
|
|
823
|
+
...generatePgCreateIndexSQL(table)
|
|
824
|
+
],
|
|
825
|
+
runtimeEnsure: false
|
|
826
|
+
});
|
|
738
827
|
}
|
|
739
|
-
for (const
|
|
740
|
-
|
|
741
|
-
|
|
828
|
+
for (const declared of fulltextStrategy.ownedTables(
|
|
829
|
+
tables3.fulltextTableName
|
|
830
|
+
)) {
|
|
831
|
+
contributions.push(declared);
|
|
742
832
|
}
|
|
743
|
-
|
|
744
|
-
|
|
833
|
+
return contributions;
|
|
834
|
+
}
|
|
835
|
+
function generatePostgresDDL(tables3 = tables, fulltextStrategy = chunkPN37HVAV_cjs.tsvectorStrategy) {
|
|
836
|
+
return postgresContributions(tables3, fulltextStrategy).flatMap((contribution) => [...contribution.createDdl]);
|
|
745
837
|
}
|
|
746
|
-
function generatePostgresMigrationSQL(tables3 = tables, fulltextStrategy =
|
|
838
|
+
function generatePostgresMigrationSQL(tables3 = tables, fulltextStrategy = chunkPN37HVAV_cjs.tsvectorStrategy) {
|
|
747
839
|
const extensionSql = "-- Enable pgvector extension for vector similarity search\nCREATE EXTENSION IF NOT EXISTS vector;";
|
|
748
840
|
const ddlSql = generatePostgresDDL(tables3, fulltextStrategy).join("\n\n");
|
|
749
841
|
return `${extensionSql}
|
|
@@ -754,7 +846,7 @@ ${ddlSql}`;
|
|
|
754
846
|
// src/backend/drizzle/row-mappers.ts
|
|
755
847
|
function requireTimestamp(value, field) {
|
|
756
848
|
if (value === void 0) {
|
|
757
|
-
throw new
|
|
849
|
+
throw new chunkYEDQLNVE_cjs.DatabaseOperationError(
|
|
758
850
|
`Expected non-null ${field} timestamp`,
|
|
759
851
|
{ operation: "select", entity: "row" }
|
|
760
852
|
);
|
|
@@ -763,7 +855,7 @@ function requireTimestamp(value, field) {
|
|
|
763
855
|
}
|
|
764
856
|
function asString(value, field) {
|
|
765
857
|
if (typeof value !== "string") {
|
|
766
|
-
throw new
|
|
858
|
+
throw new chunkYEDQLNVE_cjs.DatabaseOperationError(
|
|
767
859
|
`Expected ${field} to be string, got ${typeof value}`,
|
|
768
860
|
{ operation: "select", entity: "row" }
|
|
769
861
|
);
|
|
@@ -772,7 +864,7 @@ function asString(value, field) {
|
|
|
772
864
|
}
|
|
773
865
|
function asNumber(value, field) {
|
|
774
866
|
if (typeof value !== "number") {
|
|
775
|
-
throw new
|
|
867
|
+
throw new chunkYEDQLNVE_cjs.DatabaseOperationError(
|
|
776
868
|
`Expected ${field} to be number, got ${typeof value}`,
|
|
777
869
|
{ operation: "select", entity: "row" }
|
|
778
870
|
);
|
|
@@ -796,6 +888,16 @@ function formatPostgresTimestamp(value) {
|
|
|
796
888
|
}
|
|
797
889
|
return void 0;
|
|
798
890
|
}
|
|
891
|
+
function coerceNumericScore(value) {
|
|
892
|
+
if (typeof value === "number") return value;
|
|
893
|
+
const parsed = Number.parseFloat(value);
|
|
894
|
+
if (Number.isNaN(parsed)) {
|
|
895
|
+
throw new TypeError(
|
|
896
|
+
`Backend returned non-numeric fulltext score: ${JSON.stringify(value)}`
|
|
897
|
+
);
|
|
898
|
+
}
|
|
899
|
+
return parsed;
|
|
900
|
+
}
|
|
799
901
|
function normalizeJsonColumn(value) {
|
|
800
902
|
return typeof value === "string" ? value : JSON.stringify(value ?? {});
|
|
801
903
|
}
|
|
@@ -803,7 +905,7 @@ var SQLITE_ROW_MAPPER_CONFIG = {
|
|
|
803
905
|
formatTimestamp: (value) => {
|
|
804
906
|
if (value === null || value === void 0) return;
|
|
805
907
|
if (typeof value !== "string") {
|
|
806
|
-
throw new
|
|
908
|
+
throw new chunkYEDQLNVE_cjs.DatabaseOperationError(
|
|
807
909
|
`Expected timestamp to be string, got ${typeof value}`,
|
|
808
910
|
{ operation: "select", entity: "row" }
|
|
809
911
|
);
|
|
@@ -812,7 +914,7 @@ var SQLITE_ROW_MAPPER_CONFIG = {
|
|
|
812
914
|
},
|
|
813
915
|
normalizeJson: (value) => {
|
|
814
916
|
if (typeof value !== "string") {
|
|
815
|
-
throw new
|
|
917
|
+
throw new chunkYEDQLNVE_cjs.DatabaseOperationError(
|
|
816
918
|
`Expected JSON column to be string, got ${typeof value}`,
|
|
817
919
|
{ operation: "select", entity: "row" }
|
|
818
920
|
);
|
|
@@ -880,6 +982,222 @@ function createSchemaVersionRowMapper(config) {
|
|
|
880
982
|
};
|
|
881
983
|
};
|
|
882
984
|
}
|
|
985
|
+
var SQLITE_CONTRIBUTION_MAT_TIMESTAMPS = {
|
|
986
|
+
decode: (value) => typeof value === "string" ? value : void 0,
|
|
987
|
+
encode: (value) => value
|
|
988
|
+
};
|
|
989
|
+
var POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS = {
|
|
990
|
+
decode: formatPostgresTimestamp,
|
|
991
|
+
encode: (value) => new Date(value)
|
|
992
|
+
};
|
|
993
|
+
function mapContributionMaterializationRow(row, decode) {
|
|
994
|
+
const lastAttemptedAt = decode(row.lastAttemptedAt);
|
|
995
|
+
if (lastAttemptedAt === void 0) {
|
|
996
|
+
throw new Error(
|
|
997
|
+
`contribution materialization row missing required last_attempted_at: ${row.graphId}/${row.logicalName}`
|
|
998
|
+
);
|
|
999
|
+
}
|
|
1000
|
+
return {
|
|
1001
|
+
graphId: row.graphId,
|
|
1002
|
+
logicalName: row.logicalName,
|
|
1003
|
+
owner: row.owner,
|
|
1004
|
+
tableName: row.tableName,
|
|
1005
|
+
signature: row.signature,
|
|
1006
|
+
materializedAt: decode(row.materializedAt),
|
|
1007
|
+
lastAttemptedAt,
|
|
1008
|
+
lastError: row.lastError ?? void 0
|
|
1009
|
+
};
|
|
1010
|
+
}
|
|
1011
|
+
function buildContributionInsertValues(params, encode) {
|
|
1012
|
+
return {
|
|
1013
|
+
graphId: params.graphId,
|
|
1014
|
+
logicalName: params.logicalName,
|
|
1015
|
+
owner: params.owner,
|
|
1016
|
+
tableName: params.tableName,
|
|
1017
|
+
signature: params.signature,
|
|
1018
|
+
materializedAt: params.materializedAt === void 0 ? void 0 : encode(params.materializedAt),
|
|
1019
|
+
lastAttemptedAt: encode(params.attemptedAt),
|
|
1020
|
+
lastError: params.error
|
|
1021
|
+
};
|
|
1022
|
+
}
|
|
1023
|
+
function buildContributionOnConflictSet(materializedAtColumn, paramsMaterializedAt) {
|
|
1024
|
+
const materializedAtSet = paramsMaterializedAt === void 0 ? drizzleOrm.sql`COALESCE(excluded.${drizzleOrm.sql.identifier("materialized_at")}, ${materializedAtColumn})` : drizzleOrm.sql`excluded.${drizzleOrm.sql.identifier("materialized_at")}`;
|
|
1025
|
+
return {
|
|
1026
|
+
signature: drizzleOrm.sql`excluded.${drizzleOrm.sql.identifier("signature")}`,
|
|
1027
|
+
materializedAt: materializedAtSet,
|
|
1028
|
+
lastAttemptedAt: drizzleOrm.sql`excluded.${drizzleOrm.sql.identifier("last_attempted_at")}`,
|
|
1029
|
+
lastError: drizzleOrm.sql`excluded.${drizzleOrm.sql.identifier("last_error")}`
|
|
1030
|
+
};
|
|
1031
|
+
}
|
|
1032
|
+
async function computeContributionSignature(dialect, identity, createDdl) {
|
|
1033
|
+
const hashable = {
|
|
1034
|
+
dialect,
|
|
1035
|
+
owner: identity.owner,
|
|
1036
|
+
logicalName: identity.logicalName,
|
|
1037
|
+
tableName: identity.tableName,
|
|
1038
|
+
createDdl
|
|
1039
|
+
};
|
|
1040
|
+
return chunkCTHNVU6K_cjs.sha256Hex(JSON.stringify(hashable, chunkIUIWCFG3_cjs.sortedReplacer), 16);
|
|
1041
|
+
}
|
|
1042
|
+
function evaluateContributionState(row, signature) {
|
|
1043
|
+
if (row === void 0) return "missing";
|
|
1044
|
+
if (row.lastError !== void 0) return "failed";
|
|
1045
|
+
if (row.signature !== signature) return "stale";
|
|
1046
|
+
if (row.materializedAt === void 0) return "missing";
|
|
1047
|
+
return "initialized";
|
|
1048
|
+
}
|
|
1049
|
+
function identityOf(graphId, contribution) {
|
|
1050
|
+
return {
|
|
1051
|
+
graphId,
|
|
1052
|
+
logicalName: contribution.logicalName,
|
|
1053
|
+
owner: contribution.owner,
|
|
1054
|
+
tableName: contribution.tableName
|
|
1055
|
+
};
|
|
1056
|
+
}
|
|
1057
|
+
function gateFulltextMethods(source, assert) {
|
|
1058
|
+
const gated = {};
|
|
1059
|
+
if (source.upsertFulltext) {
|
|
1060
|
+
const raw = source.upsertFulltext;
|
|
1061
|
+
gated.upsertFulltext = async (params) => {
|
|
1062
|
+
await assert(params.graphId);
|
|
1063
|
+
await raw(params);
|
|
1064
|
+
};
|
|
1065
|
+
}
|
|
1066
|
+
if (source.deleteFulltext) {
|
|
1067
|
+
const raw = source.deleteFulltext;
|
|
1068
|
+
gated.deleteFulltext = async (params) => {
|
|
1069
|
+
await assert(params.graphId);
|
|
1070
|
+
await raw(params);
|
|
1071
|
+
};
|
|
1072
|
+
}
|
|
1073
|
+
if (source.upsertFulltextBatch) {
|
|
1074
|
+
const raw = source.upsertFulltextBatch;
|
|
1075
|
+
gated.upsertFulltextBatch = async (params) => {
|
|
1076
|
+
if (params.rows.length === 0) return;
|
|
1077
|
+
await assert(params.graphId);
|
|
1078
|
+
await raw(params);
|
|
1079
|
+
};
|
|
1080
|
+
}
|
|
1081
|
+
if (source.deleteFulltextBatch) {
|
|
1082
|
+
const raw = source.deleteFulltextBatch;
|
|
1083
|
+
gated.deleteFulltextBatch = async (params) => {
|
|
1084
|
+
if (params.nodeIds.length === 0) return;
|
|
1085
|
+
await assert(params.graphId);
|
|
1086
|
+
await raw(params);
|
|
1087
|
+
};
|
|
1088
|
+
}
|
|
1089
|
+
if (source.fulltextSearch) {
|
|
1090
|
+
const raw = source.fulltextSearch;
|
|
1091
|
+
gated.fulltextSearch = async (params) => {
|
|
1092
|
+
await assert(params.graphId);
|
|
1093
|
+
return raw(params);
|
|
1094
|
+
};
|
|
1095
|
+
}
|
|
1096
|
+
const rawHardDelete = source.hardDeleteNode;
|
|
1097
|
+
gated.hardDeleteNode = async (params) => {
|
|
1098
|
+
await assert(params.graphId);
|
|
1099
|
+
await rawHardDelete(params);
|
|
1100
|
+
};
|
|
1101
|
+
return gated;
|
|
1102
|
+
}
|
|
1103
|
+
function gateFulltext(tx, assert) {
|
|
1104
|
+
return { ...tx, ...gateFulltextMethods(tx, assert) };
|
|
1105
|
+
}
|
|
1106
|
+
function createContributionMaterializer(deps) {
|
|
1107
|
+
const { dialect, fulltextStrategy, fulltextTableName } = deps;
|
|
1108
|
+
const initializedGraphIds = /* @__PURE__ */ new Set();
|
|
1109
|
+
function runtimeContributions() {
|
|
1110
|
+
return runtimeStrategyContributions(fulltextStrategy, fulltextTableName);
|
|
1111
|
+
}
|
|
1112
|
+
async function materializeOne(graphId, contribution) {
|
|
1113
|
+
const signature = await computeContributionSignature(
|
|
1114
|
+
dialect,
|
|
1115
|
+
contribution,
|
|
1116
|
+
contribution.createDdl
|
|
1117
|
+
);
|
|
1118
|
+
const identity = identityOf(graphId, contribution);
|
|
1119
|
+
const existing = await deps.getMarker(identity);
|
|
1120
|
+
if (evaluateContributionState(existing, signature) === "initialized") {
|
|
1121
|
+
return;
|
|
1122
|
+
}
|
|
1123
|
+
const priorSuccess = existing?.materializedAt !== void 0;
|
|
1124
|
+
if (priorSuccess && existing.signature !== signature) {
|
|
1125
|
+
const error = new Error(
|
|
1126
|
+
`Contribution "${contribution.logicalName}" (owner "${contribution.owner}", table "${contribution.tableName}") was already materialized with a different signature. The recorded physical shape is stale relative to the current strategy/DDL \u2014 migrate or drop the table and retry, or restore the original strategy.`
|
|
1127
|
+
);
|
|
1128
|
+
await deps.recordMarker({
|
|
1129
|
+
...identity,
|
|
1130
|
+
signature,
|
|
1131
|
+
attemptedAt: nowIso(),
|
|
1132
|
+
materializedAt: void 0,
|
|
1133
|
+
error: error.message
|
|
1134
|
+
});
|
|
1135
|
+
throw error;
|
|
1136
|
+
}
|
|
1137
|
+
const attemptedAt = nowIso();
|
|
1138
|
+
try {
|
|
1139
|
+
for (const statement of contribution.createDdl) {
|
|
1140
|
+
await deps.execDdl(statement);
|
|
1141
|
+
}
|
|
1142
|
+
} catch (error) {
|
|
1143
|
+
await deps.recordMarker({
|
|
1144
|
+
...identity,
|
|
1145
|
+
signature,
|
|
1146
|
+
attemptedAt,
|
|
1147
|
+
materializedAt: void 0,
|
|
1148
|
+
error: error instanceof Error ? error.message : String(error)
|
|
1149
|
+
});
|
|
1150
|
+
throw error;
|
|
1151
|
+
}
|
|
1152
|
+
await deps.recordMarker({
|
|
1153
|
+
...identity,
|
|
1154
|
+
signature,
|
|
1155
|
+
attemptedAt,
|
|
1156
|
+
materializedAt: attemptedAt,
|
|
1157
|
+
error: void 0
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1160
|
+
async function ensureRuntimeContributions(graphId) {
|
|
1161
|
+
if (initializedGraphIds.has(graphId)) return;
|
|
1162
|
+
const contributions = runtimeContributions();
|
|
1163
|
+
if (contributions.length > 0) {
|
|
1164
|
+
await deps.ensureMarkerTable();
|
|
1165
|
+
for (const contribution of contributions) {
|
|
1166
|
+
await materializeOne(graphId, contribution);
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
initializedGraphIds.add(graphId);
|
|
1170
|
+
}
|
|
1171
|
+
async function assertInitialized(graphId) {
|
|
1172
|
+
if (initializedGraphIds.has(graphId)) return;
|
|
1173
|
+
for (const contribution of runtimeContributions()) {
|
|
1174
|
+
const signature = await computeContributionSignature(
|
|
1175
|
+
dialect,
|
|
1176
|
+
contribution,
|
|
1177
|
+
contribution.createDdl
|
|
1178
|
+
);
|
|
1179
|
+
const identity = identityOf(graphId, contribution);
|
|
1180
|
+
let existing;
|
|
1181
|
+
try {
|
|
1182
|
+
existing = await deps.getMarker(identity);
|
|
1183
|
+
} catch (error) {
|
|
1184
|
+
if (!chunkIUIWCFG3_cjs.isMissingTableError(error)) throw error;
|
|
1185
|
+
throw new chunkYEDQLNVE_cjs.StoreNotInitializedError(graphId, "missing", {
|
|
1186
|
+
cause: error,
|
|
1187
|
+
details: { logicalName: contribution.logicalName }
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
const state = evaluateContributionState(existing, signature);
|
|
1191
|
+
if (state !== "initialized") {
|
|
1192
|
+
throw new chunkYEDQLNVE_cjs.StoreNotInitializedError(graphId, state, {
|
|
1193
|
+
details: { logicalName: contribution.logicalName }
|
|
1194
|
+
});
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
initializedGraphIds.add(graphId);
|
|
1198
|
+
}
|
|
1199
|
+
return { ensureRuntimeContributions, assertInitialized };
|
|
1200
|
+
}
|
|
883
1201
|
var SQLITE_INDEX_MAT_TIMESTAMPS = {
|
|
884
1202
|
decode: (value) => typeof value === "string" ? value : void 0,
|
|
885
1203
|
encode: (value) => value
|
|
@@ -979,8 +1297,14 @@ function buildKindRemovalOnConflictSet(removedAtColumn, paramsRemovedAt) {
|
|
|
979
1297
|
lastError: drizzleOrm.sql`excluded.${drizzleOrm.sql.identifier("last_error")}`
|
|
980
1298
|
};
|
|
981
1299
|
}
|
|
982
|
-
|
|
983
|
-
|
|
1300
|
+
function assertAdoptedDialect(externalTx, brand, backend) {
|
|
1301
|
+
if (drizzleOrm.is(externalTx, brand)) return;
|
|
1302
|
+
const label = backend === "postgres" ? "Postgres" : "SQLite";
|
|
1303
|
+
throw new chunkYEDQLNVE_cjs.ConfigurationError(
|
|
1304
|
+
`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.`,
|
|
1305
|
+
{ backend, capability: "adoptTransaction" }
|
|
1306
|
+
);
|
|
1307
|
+
}
|
|
984
1308
|
function chunkArray(values, size) {
|
|
985
1309
|
if (values.length <= size) {
|
|
986
1310
|
return [values];
|
|
@@ -994,7 +1318,7 @@ function chunkArray(values, size) {
|
|
|
994
1318
|
function verifyExpectedActiveVersion(graphId, expected, actualActiveVersion) {
|
|
995
1319
|
const expectedVersion = expected.kind === "active" ? expected.version : 0;
|
|
996
1320
|
if (actualActiveVersion !== expectedVersion) {
|
|
997
|
-
throw new
|
|
1321
|
+
throw new chunkYEDQLNVE_cjs.StaleVersionError({
|
|
998
1322
|
graphId,
|
|
999
1323
|
expected: expectedVersion,
|
|
1000
1324
|
actual: actualActiveVersion
|
|
@@ -1015,7 +1339,7 @@ function createCommonOperationBackend(options) {
|
|
|
1015
1339
|
const timestamp2 = nowIso2();
|
|
1016
1340
|
const query = operationStrategy.buildInsertNode(params, timestamp2);
|
|
1017
1341
|
const row = await execution.execGet(query);
|
|
1018
|
-
if (!row) throw new
|
|
1342
|
+
if (!row) throw new chunkYEDQLNVE_cjs.DatabaseOperationError("Insert node failed: no row returned", { operation: "insert", entity: "node" });
|
|
1019
1343
|
return rowMappers.toNodeRow(row);
|
|
1020
1344
|
},
|
|
1021
1345
|
async insertNodeNoReturn(params) {
|
|
@@ -1065,7 +1389,7 @@ function createCommonOperationBackend(options) {
|
|
|
1065
1389
|
const timestamp2 = nowIso2();
|
|
1066
1390
|
const query = operationStrategy.buildUpdateNode(params, timestamp2);
|
|
1067
1391
|
const row = await execution.execGet(query);
|
|
1068
|
-
if (!row) throw new
|
|
1392
|
+
if (!row) throw new chunkYEDQLNVE_cjs.DatabaseOperationError("Update node failed: no row returned", { operation: "update", entity: "node" });
|
|
1069
1393
|
return rowMappers.toNodeRow(row);
|
|
1070
1394
|
},
|
|
1071
1395
|
async deleteNode(params) {
|
|
@@ -1108,7 +1432,7 @@ function createCommonOperationBackend(options) {
|
|
|
1108
1432
|
const timestamp2 = nowIso2();
|
|
1109
1433
|
const query = operationStrategy.buildInsertEdge(params, timestamp2);
|
|
1110
1434
|
const row = await execution.execGet(query);
|
|
1111
|
-
if (!row) throw new
|
|
1435
|
+
if (!row) throw new chunkYEDQLNVE_cjs.DatabaseOperationError("Insert edge failed: no row returned", { operation: "insert", entity: "edge" });
|
|
1112
1436
|
return rowMappers.toEdgeRow(row);
|
|
1113
1437
|
},
|
|
1114
1438
|
async insertEdgeNoReturn(params) {
|
|
@@ -1158,7 +1482,7 @@ function createCommonOperationBackend(options) {
|
|
|
1158
1482
|
const timestamp2 = nowIso2();
|
|
1159
1483
|
const query = operationStrategy.buildUpdateEdge(params, timestamp2);
|
|
1160
1484
|
const row = await execution.execGet(query);
|
|
1161
|
-
if (!row) throw new
|
|
1485
|
+
if (!row) throw new chunkYEDQLNVE_cjs.DatabaseOperationError("Update edge failed: no row returned", { operation: "update", entity: "edge" });
|
|
1162
1486
|
return rowMappers.toEdgeRow(row);
|
|
1163
1487
|
},
|
|
1164
1488
|
async deleteEdge(params) {
|
|
@@ -1209,7 +1533,7 @@ function createCommonOperationBackend(options) {
|
|
|
1209
1533
|
const query = operationStrategy.buildInsertUnique(params);
|
|
1210
1534
|
const result = await execution.execGet(query);
|
|
1211
1535
|
if (result && result.node_id !== params.nodeId) {
|
|
1212
|
-
throw new
|
|
1536
|
+
throw new chunkYEDQLNVE_cjs.UniquenessError({
|
|
1213
1537
|
constraintName: params.constraintName,
|
|
1214
1538
|
kind: params.nodeKind,
|
|
1215
1539
|
existingId: result.node_id,
|
|
@@ -1259,7 +1583,7 @@ function createCommonOperationBackend(options) {
|
|
|
1259
1583
|
if (existingRaw !== void 0) {
|
|
1260
1584
|
const existing = rowMappers.toSchemaVersionRow(existingRaw);
|
|
1261
1585
|
if (existing.schema_hash !== params.schemaHash) {
|
|
1262
|
-
throw new
|
|
1586
|
+
throw new chunkYEDQLNVE_cjs.SchemaContentConflictError({
|
|
1263
1587
|
graphId: params.graphId,
|
|
1264
1588
|
version: params.version,
|
|
1265
1589
|
existingHash: existing.schema_hash,
|
|
@@ -1307,7 +1631,7 @@ function createCommonOperationBackend(options) {
|
|
|
1307
1631
|
);
|
|
1308
1632
|
const insertedRaw = await execution.execGet(insertQuery);
|
|
1309
1633
|
if (!insertedRaw) {
|
|
1310
|
-
throw new
|
|
1634
|
+
throw new chunkYEDQLNVE_cjs.DatabaseOperationError(
|
|
1311
1635
|
"Insert schema failed: no row returned",
|
|
1312
1636
|
{ operation: "insert", entity: "schema" }
|
|
1313
1637
|
);
|
|
@@ -1328,7 +1652,7 @@ function createCommonOperationBackend(options) {
|
|
|
1328
1652
|
)
|
|
1329
1653
|
);
|
|
1330
1654
|
if (!targetRaw) {
|
|
1331
|
-
throw new
|
|
1655
|
+
throw new chunkYEDQLNVE_cjs.MigrationError(
|
|
1332
1656
|
`Cannot activate version ${params.version}: version does not exist for graph "${params.graphId}".`,
|
|
1333
1657
|
{
|
|
1334
1658
|
graphId: params.graphId,
|
|
@@ -1353,9 +1677,9 @@ function createCommonOperationBackend(options) {
|
|
|
1353
1677
|
};
|
|
1354
1678
|
}
|
|
1355
1679
|
function buildClearGraph(tables3, graphId) {
|
|
1356
|
-
const
|
|
1680
|
+
const fulltext2 = chunkPN37HVAV_cjs.quotedTableName(tables3.fulltextTableName);
|
|
1357
1681
|
return [
|
|
1358
|
-
drizzleOrm.sql`DELETE FROM ${
|
|
1682
|
+
drizzleOrm.sql`DELETE FROM ${fulltext2} WHERE "graph_id" = ${graphId}`,
|
|
1359
1683
|
drizzleOrm.sql`DELETE FROM ${tables3.embeddings} WHERE ${tables3.embeddings.graphId} = ${graphId}`,
|
|
1360
1684
|
drizzleOrm.sql`DELETE FROM ${tables3.uniques} WHERE ${tables3.uniques.graphId} = ${graphId}`,
|
|
1361
1685
|
drizzleOrm.sql`DELETE FROM ${tables3.edges} WHERE ${tables3.edges.graphId} = ${graphId}`,
|
|
@@ -1503,13 +1827,13 @@ function buildCountEdgesByKind(tables3, params) {
|
|
|
1503
1827
|
function buildInsertEdge(tables3, params, timestamp2) {
|
|
1504
1828
|
const { edges: edges3 } = tables3;
|
|
1505
1829
|
const propsJson = JSON.stringify(params.props);
|
|
1506
|
-
const columns =
|
|
1830
|
+
const columns = chunkPN37HVAV_cjs.edgeColumnList(edges3);
|
|
1507
1831
|
return drizzleOrm.sql`
|
|
1508
1832
|
INSERT INTO ${edges3} (${columns})
|
|
1509
1833
|
VALUES (
|
|
1510
1834
|
${params.graphId}, ${params.id}, ${params.kind},
|
|
1511
1835
|
${params.fromKind}, ${params.fromId}, ${params.toKind}, ${params.toId},
|
|
1512
|
-
${propsJson}, ${
|
|
1836
|
+
${propsJson}, ${chunkPN37HVAV_cjs.sqlNull(params.validFrom)}, ${chunkPN37HVAV_cjs.sqlNull(params.validTo)},
|
|
1513
1837
|
${timestamp2}, ${timestamp2}
|
|
1514
1838
|
)
|
|
1515
1839
|
RETURNING *
|
|
@@ -1518,23 +1842,23 @@ function buildInsertEdge(tables3, params, timestamp2) {
|
|
|
1518
1842
|
function buildInsertEdgeNoReturn(tables3, params, timestamp2) {
|
|
1519
1843
|
const { edges: edges3 } = tables3;
|
|
1520
1844
|
const propsJson = JSON.stringify(params.props);
|
|
1521
|
-
const columns =
|
|
1845
|
+
const columns = chunkPN37HVAV_cjs.edgeColumnList(edges3);
|
|
1522
1846
|
return drizzleOrm.sql`
|
|
1523
1847
|
INSERT INTO ${edges3} (${columns})
|
|
1524
1848
|
VALUES (
|
|
1525
1849
|
${params.graphId}, ${params.id}, ${params.kind},
|
|
1526
1850
|
${params.fromKind}, ${params.fromId}, ${params.toKind}, ${params.toId},
|
|
1527
|
-
${propsJson}, ${
|
|
1851
|
+
${propsJson}, ${chunkPN37HVAV_cjs.sqlNull(params.validFrom)}, ${chunkPN37HVAV_cjs.sqlNull(params.validTo)},
|
|
1528
1852
|
${timestamp2}, ${timestamp2}
|
|
1529
1853
|
)
|
|
1530
1854
|
`;
|
|
1531
1855
|
}
|
|
1532
1856
|
function buildInsertEdgesBatch(tables3, params, timestamp2) {
|
|
1533
1857
|
const { edges: edges3 } = tables3;
|
|
1534
|
-
const columns =
|
|
1858
|
+
const columns = chunkPN37HVAV_cjs.edgeColumnList(edges3);
|
|
1535
1859
|
const values = params.map((edgeParams) => {
|
|
1536
1860
|
const propsJson = JSON.stringify(edgeParams.props);
|
|
1537
|
-
return drizzleOrm.sql`(${edgeParams.graphId}, ${edgeParams.id}, ${edgeParams.kind}, ${edgeParams.fromKind}, ${edgeParams.fromId}, ${edgeParams.toKind}, ${edgeParams.toId}, ${propsJson}, ${
|
|
1861
|
+
return drizzleOrm.sql`(${edgeParams.graphId}, ${edgeParams.id}, ${edgeParams.kind}, ${edgeParams.fromKind}, ${edgeParams.fromId}, ${edgeParams.toKind}, ${edgeParams.toId}, ${propsJson}, ${chunkPN37HVAV_cjs.sqlNull(edgeParams.validFrom)}, ${chunkPN37HVAV_cjs.sqlNull(edgeParams.validTo)}, ${timestamp2}, ${timestamp2})`;
|
|
1538
1862
|
});
|
|
1539
1863
|
return drizzleOrm.sql`
|
|
1540
1864
|
INSERT INTO ${edges3} (${columns})
|
|
@@ -1543,10 +1867,10 @@ function buildInsertEdgesBatch(tables3, params, timestamp2) {
|
|
|
1543
1867
|
}
|
|
1544
1868
|
function buildInsertEdgesBatchReturning(tables3, params, timestamp2) {
|
|
1545
1869
|
const { edges: edges3 } = tables3;
|
|
1546
|
-
const columns =
|
|
1870
|
+
const columns = chunkPN37HVAV_cjs.edgeColumnList(edges3);
|
|
1547
1871
|
const values = params.map((edgeParams) => {
|
|
1548
1872
|
const propsJson = JSON.stringify(edgeParams.props);
|
|
1549
|
-
return drizzleOrm.sql`(${edgeParams.graphId}, ${edgeParams.id}, ${edgeParams.kind}, ${edgeParams.fromKind}, ${edgeParams.fromId}, ${edgeParams.toKind}, ${edgeParams.toId}, ${propsJson}, ${
|
|
1873
|
+
return drizzleOrm.sql`(${edgeParams.graphId}, ${edgeParams.id}, ${edgeParams.kind}, ${edgeParams.fromKind}, ${edgeParams.fromId}, ${edgeParams.toKind}, ${edgeParams.toId}, ${propsJson}, ${chunkPN37HVAV_cjs.sqlNull(edgeParams.validFrom)}, ${chunkPN37HVAV_cjs.sqlNull(edgeParams.validTo)}, ${timestamp2}, ${timestamp2})`;
|
|
1550
1874
|
});
|
|
1551
1875
|
return drizzleOrm.sql`
|
|
1552
1876
|
INSERT INTO ${edges3} (${columns})
|
|
@@ -1578,14 +1902,14 @@ function buildUpdateEdge(tables3, params, timestamp2) {
|
|
|
1578
1902
|
const { edges: edges3 } = tables3;
|
|
1579
1903
|
const propsJson = JSON.stringify(params.props);
|
|
1580
1904
|
const setParts = [
|
|
1581
|
-
drizzleOrm.sql`${
|
|
1582
|
-
drizzleOrm.sql`${
|
|
1905
|
+
drizzleOrm.sql`${chunkPN37HVAV_cjs.quotedColumn(edges3.props)} = ${propsJson}`,
|
|
1906
|
+
drizzleOrm.sql`${chunkPN37HVAV_cjs.quotedColumn(edges3.updatedAt)} = ${timestamp2}`
|
|
1583
1907
|
];
|
|
1584
1908
|
if (params.validTo !== void 0) {
|
|
1585
|
-
setParts.push(drizzleOrm.sql`${
|
|
1909
|
+
setParts.push(drizzleOrm.sql`${chunkPN37HVAV_cjs.quotedColumn(edges3.validTo)} = ${params.validTo}`);
|
|
1586
1910
|
}
|
|
1587
1911
|
if (params.clearDeleted) {
|
|
1588
|
-
setParts.push(drizzleOrm.sql`${
|
|
1912
|
+
setParts.push(drizzleOrm.sql`${chunkPN37HVAV_cjs.quotedColumn(edges3.deletedAt)} = NULL`);
|
|
1589
1913
|
}
|
|
1590
1914
|
const setClause = drizzleOrm.sql.join(setParts, drizzleOrm.sql`, `);
|
|
1591
1915
|
if (params.clearDeleted) {
|
|
@@ -1610,7 +1934,7 @@ function buildDeleteEdge(tables3, params, timestamp2) {
|
|
|
1610
1934
|
const { edges: edges3 } = tables3;
|
|
1611
1935
|
return drizzleOrm.sql`
|
|
1612
1936
|
UPDATE ${edges3}
|
|
1613
|
-
SET ${
|
|
1937
|
+
SET ${chunkPN37HVAV_cjs.quotedColumn(edges3.deletedAt)} = ${timestamp2}
|
|
1614
1938
|
WHERE ${edges3.graphId} = ${params.graphId}
|
|
1615
1939
|
AND ${edges3.id} = ${params.id}
|
|
1616
1940
|
AND ${edges3.deletedAt} IS NULL
|
|
@@ -1697,7 +2021,7 @@ function resolveMode(mode) {
|
|
|
1697
2021
|
function buildFulltextSearch(tableName, params, strategy) {
|
|
1698
2022
|
assertValidSearchParams(params);
|
|
1699
2023
|
const mode = resolveMode(params.mode);
|
|
1700
|
-
const table =
|
|
2024
|
+
const table = chunkPN37HVAV_cjs.quotedTableName(tableName);
|
|
1701
2025
|
const matchCondition = strategy.matchCondition(
|
|
1702
2026
|
tableName,
|
|
1703
2027
|
params.query,
|
|
@@ -1748,12 +2072,12 @@ function assertValidSearchParams(params) {
|
|
|
1748
2072
|
function buildInsertNode(tables3, params, timestamp2) {
|
|
1749
2073
|
const { nodes: nodes3 } = tables3;
|
|
1750
2074
|
const propsJson = JSON.stringify(params.props);
|
|
1751
|
-
const columns =
|
|
2075
|
+
const columns = chunkPN37HVAV_cjs.nodeColumnList(nodes3);
|
|
1752
2076
|
return drizzleOrm.sql`
|
|
1753
2077
|
INSERT INTO ${nodes3} (${columns})
|
|
1754
2078
|
VALUES (
|
|
1755
2079
|
${params.graphId}, ${params.kind}, ${params.id}, ${propsJson},
|
|
1756
|
-
1, ${
|
|
2080
|
+
1, ${chunkPN37HVAV_cjs.sqlNull(params.validFrom)}, ${chunkPN37HVAV_cjs.sqlNull(params.validTo)},
|
|
1757
2081
|
${timestamp2}, ${timestamp2}
|
|
1758
2082
|
)
|
|
1759
2083
|
RETURNING *
|
|
@@ -1762,22 +2086,22 @@ function buildInsertNode(tables3, params, timestamp2) {
|
|
|
1762
2086
|
function buildInsertNodeNoReturn(tables3, params, timestamp2) {
|
|
1763
2087
|
const { nodes: nodes3 } = tables3;
|
|
1764
2088
|
const propsJson = JSON.stringify(params.props);
|
|
1765
|
-
const columns =
|
|
2089
|
+
const columns = chunkPN37HVAV_cjs.nodeColumnList(nodes3);
|
|
1766
2090
|
return drizzleOrm.sql`
|
|
1767
2091
|
INSERT INTO ${nodes3} (${columns})
|
|
1768
2092
|
VALUES (
|
|
1769
2093
|
${params.graphId}, ${params.kind}, ${params.id}, ${propsJson},
|
|
1770
|
-
1, ${
|
|
2094
|
+
1, ${chunkPN37HVAV_cjs.sqlNull(params.validFrom)}, ${chunkPN37HVAV_cjs.sqlNull(params.validTo)},
|
|
1771
2095
|
${timestamp2}, ${timestamp2}
|
|
1772
2096
|
)
|
|
1773
2097
|
`;
|
|
1774
2098
|
}
|
|
1775
2099
|
function buildInsertNodesBatch(tables3, params, timestamp2) {
|
|
1776
2100
|
const { nodes: nodes3 } = tables3;
|
|
1777
|
-
const columns =
|
|
2101
|
+
const columns = chunkPN37HVAV_cjs.nodeColumnList(nodes3);
|
|
1778
2102
|
const values = params.map((nodeParams) => {
|
|
1779
2103
|
const propsJson = JSON.stringify(nodeParams.props);
|
|
1780
|
-
return drizzleOrm.sql`(${nodeParams.graphId}, ${nodeParams.kind}, ${nodeParams.id}, ${propsJson}, 1, ${
|
|
2104
|
+
return drizzleOrm.sql`(${nodeParams.graphId}, ${nodeParams.kind}, ${nodeParams.id}, ${propsJson}, 1, ${chunkPN37HVAV_cjs.sqlNull(nodeParams.validFrom)}, ${chunkPN37HVAV_cjs.sqlNull(nodeParams.validTo)}, ${timestamp2}, ${timestamp2})`;
|
|
1781
2105
|
});
|
|
1782
2106
|
return drizzleOrm.sql`
|
|
1783
2107
|
INSERT INTO ${nodes3} (${columns})
|
|
@@ -1786,10 +2110,10 @@ function buildInsertNodesBatch(tables3, params, timestamp2) {
|
|
|
1786
2110
|
}
|
|
1787
2111
|
function buildInsertNodesBatchReturning(tables3, params, timestamp2) {
|
|
1788
2112
|
const { nodes: nodes3 } = tables3;
|
|
1789
|
-
const columns =
|
|
2113
|
+
const columns = chunkPN37HVAV_cjs.nodeColumnList(nodes3);
|
|
1790
2114
|
const values = params.map((nodeParams) => {
|
|
1791
2115
|
const propsJson = JSON.stringify(nodeParams.props);
|
|
1792
|
-
return drizzleOrm.sql`(${nodeParams.graphId}, ${nodeParams.kind}, ${nodeParams.id}, ${propsJson}, 1, ${
|
|
2116
|
+
return drizzleOrm.sql`(${nodeParams.graphId}, ${nodeParams.kind}, ${nodeParams.id}, ${propsJson}, 1, ${chunkPN37HVAV_cjs.sqlNull(nodeParams.validFrom)}, ${chunkPN37HVAV_cjs.sqlNull(nodeParams.validTo)}, ${timestamp2}, ${timestamp2})`;
|
|
1793
2117
|
});
|
|
1794
2118
|
return drizzleOrm.sql`
|
|
1795
2119
|
INSERT INTO ${nodes3} (${columns})
|
|
@@ -1823,19 +2147,19 @@ function buildUpdateNode(tables3, params, timestamp2) {
|
|
|
1823
2147
|
const { nodes: nodes3 } = tables3;
|
|
1824
2148
|
const propsJson = JSON.stringify(params.props);
|
|
1825
2149
|
const setParts = [
|
|
1826
|
-
drizzleOrm.sql`${
|
|
1827
|
-
drizzleOrm.sql`${
|
|
2150
|
+
drizzleOrm.sql`${chunkPN37HVAV_cjs.quotedColumn(nodes3.props)} = ${propsJson}`,
|
|
2151
|
+
drizzleOrm.sql`${chunkPN37HVAV_cjs.quotedColumn(nodes3.updatedAt)} = ${timestamp2}`
|
|
1828
2152
|
];
|
|
1829
2153
|
if (params.incrementVersion) {
|
|
1830
2154
|
setParts.push(
|
|
1831
|
-
drizzleOrm.sql`${
|
|
2155
|
+
drizzleOrm.sql`${chunkPN37HVAV_cjs.quotedColumn(nodes3.version)} = ${chunkPN37HVAV_cjs.quotedColumn(nodes3.version)} + 1`
|
|
1832
2156
|
);
|
|
1833
2157
|
}
|
|
1834
2158
|
if (params.validTo !== void 0) {
|
|
1835
|
-
setParts.push(drizzleOrm.sql`${
|
|
2159
|
+
setParts.push(drizzleOrm.sql`${chunkPN37HVAV_cjs.quotedColumn(nodes3.validTo)} = ${params.validTo}`);
|
|
1836
2160
|
}
|
|
1837
2161
|
if (params.clearDeleted) {
|
|
1838
|
-
setParts.push(drizzleOrm.sql`${
|
|
2162
|
+
setParts.push(drizzleOrm.sql`${chunkPN37HVAV_cjs.quotedColumn(nodes3.deletedAt)} = NULL`);
|
|
1839
2163
|
}
|
|
1840
2164
|
const setClause = drizzleOrm.sql.join(setParts, drizzleOrm.sql`, `);
|
|
1841
2165
|
if (params.clearDeleted) {
|
|
@@ -1862,7 +2186,7 @@ function buildDeleteNode(tables3, params, timestamp2) {
|
|
|
1862
2186
|
const { nodes: nodes3 } = tables3;
|
|
1863
2187
|
return drizzleOrm.sql`
|
|
1864
2188
|
UPDATE ${nodes3}
|
|
1865
|
-
SET ${
|
|
2189
|
+
SET ${chunkPN37HVAV_cjs.quotedColumn(nodes3.deletedAt)} = ${timestamp2}
|
|
1866
2190
|
WHERE ${nodes3.graphId} = ${params.graphId}
|
|
1867
2191
|
AND ${nodes3.kind} = ${params.kind}
|
|
1868
2192
|
AND ${nodes3.id} = ${params.id}
|
|
@@ -1929,12 +2253,12 @@ function buildSetActiveSchema(tables3, graphId, version, dialect = "sqlite") {
|
|
|
1929
2253
|
const strategy = SCHEMA_DIALECT_STRATEGIES[dialect];
|
|
1930
2254
|
const deactivateAll = drizzleOrm.sql`
|
|
1931
2255
|
UPDATE ${schemaVersions3}
|
|
1932
|
-
SET ${
|
|
2256
|
+
SET ${chunkPN37HVAV_cjs.quotedColumn(schemaVersions3.isActive)} = ${strategy.booleanLiteral(false)}
|
|
1933
2257
|
WHERE ${schemaVersions3.graphId} = ${graphId}
|
|
1934
2258
|
`;
|
|
1935
2259
|
const activateVersion = drizzleOrm.sql`
|
|
1936
2260
|
UPDATE ${schemaVersions3}
|
|
1937
|
-
SET ${
|
|
2261
|
+
SET ${chunkPN37HVAV_cjs.quotedColumn(schemaVersions3.isActive)} = ${strategy.booleanLiteral(true)}
|
|
1938
2262
|
WHERE ${schemaVersions3.graphId} = ${graphId}
|
|
1939
2263
|
AND ${schemaVersions3.version} = ${version}
|
|
1940
2264
|
`;
|
|
@@ -1952,22 +2276,22 @@ function buildInsertUniqueSqlite(tables3, params) {
|
|
|
1952
2276
|
)
|
|
1953
2277
|
ON CONFLICT (${conflictColumns})
|
|
1954
2278
|
DO UPDATE SET
|
|
1955
|
-
${
|
|
1956
|
-
WHEN ${
|
|
1957
|
-
WHEN ${
|
|
1958
|
-
ELSE ${
|
|
2279
|
+
${chunkPN37HVAV_cjs.quotedColumn(uniques3.nodeId)} = CASE
|
|
2280
|
+
WHEN ${chunkPN37HVAV_cjs.quotedColumn(uniques3.nodeId)} = ${params.nodeId} THEN ${params.nodeId}
|
|
2281
|
+
WHEN ${chunkPN37HVAV_cjs.quotedColumn(uniques3.deletedAt)} IS NOT NULL THEN ${params.nodeId}
|
|
2282
|
+
ELSE ${chunkPN37HVAV_cjs.quotedColumn(uniques3.nodeId)}
|
|
1959
2283
|
END,
|
|
1960
|
-
${
|
|
1961
|
-
WHEN ${
|
|
1962
|
-
WHEN ${
|
|
1963
|
-
ELSE ${
|
|
2284
|
+
${chunkPN37HVAV_cjs.quotedColumn(uniques3.concreteKind)} = CASE
|
|
2285
|
+
WHEN ${chunkPN37HVAV_cjs.quotedColumn(uniques3.nodeId)} = ${params.nodeId} THEN ${params.concreteKind}
|
|
2286
|
+
WHEN ${chunkPN37HVAV_cjs.quotedColumn(uniques3.deletedAt)} IS NOT NULL THEN ${params.concreteKind}
|
|
2287
|
+
ELSE ${chunkPN37HVAV_cjs.quotedColumn(uniques3.concreteKind)}
|
|
1964
2288
|
END,
|
|
1965
|
-
${
|
|
1966
|
-
WHEN ${
|
|
1967
|
-
WHEN ${
|
|
1968
|
-
ELSE ${
|
|
2289
|
+
${chunkPN37HVAV_cjs.quotedColumn(uniques3.deletedAt)} = CASE
|
|
2290
|
+
WHEN ${chunkPN37HVAV_cjs.quotedColumn(uniques3.nodeId)} = ${params.nodeId} THEN NULL
|
|
2291
|
+
WHEN ${chunkPN37HVAV_cjs.quotedColumn(uniques3.deletedAt)} IS NOT NULL THEN NULL
|
|
2292
|
+
ELSE ${chunkPN37HVAV_cjs.quotedColumn(uniques3.deletedAt)}
|
|
1969
2293
|
END
|
|
1970
|
-
RETURNING ${
|
|
2294
|
+
RETURNING ${chunkPN37HVAV_cjs.quotedColumn(uniques3.nodeId)} as node_id
|
|
1971
2295
|
`;
|
|
1972
2296
|
}
|
|
1973
2297
|
function buildInsertUniquePostgres(tables3, params) {
|
|
@@ -1984,22 +2308,22 @@ function buildInsertUniquePostgres(tables3, params) {
|
|
|
1984
2308
|
)
|
|
1985
2309
|
ON CONFLICT (${conflictColumns})
|
|
1986
2310
|
DO UPDATE SET
|
|
1987
|
-
${
|
|
2311
|
+
${chunkPN37HVAV_cjs.quotedColumn(uniques3.nodeId)} = CASE
|
|
1988
2312
|
WHEN ${existingColumn(uniques3.nodeId)} = ${params.nodeId} THEN ${params.nodeId}
|
|
1989
2313
|
WHEN ${existingColumn(uniques3.deletedAt)} IS NOT NULL THEN ${params.nodeId}
|
|
1990
2314
|
ELSE ${existingColumn(uniques3.nodeId)}
|
|
1991
2315
|
END,
|
|
1992
|
-
${
|
|
2316
|
+
${chunkPN37HVAV_cjs.quotedColumn(uniques3.concreteKind)} = CASE
|
|
1993
2317
|
WHEN ${existingColumn(uniques3.nodeId)} = ${params.nodeId} THEN ${params.concreteKind}
|
|
1994
2318
|
WHEN ${existingColumn(uniques3.deletedAt)} IS NOT NULL THEN ${params.concreteKind}
|
|
1995
2319
|
ELSE ${existingColumn(uniques3.concreteKind)}
|
|
1996
2320
|
END,
|
|
1997
|
-
${
|
|
2321
|
+
${chunkPN37HVAV_cjs.quotedColumn(uniques3.deletedAt)} = CASE
|
|
1998
2322
|
WHEN ${existingColumn(uniques3.nodeId)} = ${params.nodeId} THEN NULL
|
|
1999
2323
|
WHEN ${existingColumn(uniques3.deletedAt)} IS NOT NULL THEN NULL
|
|
2000
2324
|
ELSE ${existingColumn(uniques3.deletedAt)}
|
|
2001
2325
|
END
|
|
2002
|
-
RETURNING ${
|
|
2326
|
+
RETURNING ${chunkPN37HVAV_cjs.quotedColumn(uniques3.nodeId)} as node_id
|
|
2003
2327
|
`;
|
|
2004
2328
|
}
|
|
2005
2329
|
var UNIQUE_INSERT_BUILDERS = {
|
|
@@ -2014,7 +2338,7 @@ function buildDeleteUnique(tables3, params, timestamp2) {
|
|
|
2014
2338
|
const { uniques: uniques3 } = tables3;
|
|
2015
2339
|
return drizzleOrm.sql`
|
|
2016
2340
|
UPDATE ${uniques3}
|
|
2017
|
-
SET ${
|
|
2341
|
+
SET ${chunkPN37HVAV_cjs.quotedColumn(uniques3.deletedAt)} = ${timestamp2}
|
|
2018
2342
|
WHERE ${uniques3.graphId} = ${params.graphId}
|
|
2019
2343
|
AND ${uniques3.nodeKind} = ${params.nodeKind}
|
|
2020
2344
|
AND ${uniques3.constraintName} = ${params.constraintName}
|
|
@@ -2651,18 +2975,25 @@ function compileQueryWithDialect(db, query, backendName) {
|
|
|
2651
2975
|
return compiler.sqlToQuery(query);
|
|
2652
2976
|
}
|
|
2653
2977
|
|
|
2978
|
+
exports.POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS = POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS;
|
|
2654
2979
|
exports.POSTGRES_INDEX_MAT_TIMESTAMPS = POSTGRES_INDEX_MAT_TIMESTAMPS;
|
|
2655
2980
|
exports.POSTGRES_KIND_REMOVAL_TIMESTAMPS = POSTGRES_KIND_REMOVAL_TIMESTAMPS;
|
|
2656
2981
|
exports.POSTGRES_ROW_MAPPER_CONFIG = POSTGRES_ROW_MAPPER_CONFIG;
|
|
2982
|
+
exports.SQLITE_CONTRIBUTION_MAT_TIMESTAMPS = SQLITE_CONTRIBUTION_MAT_TIMESTAMPS;
|
|
2657
2983
|
exports.SQLITE_INDEX_MAT_TIMESTAMPS = SQLITE_INDEX_MAT_TIMESTAMPS;
|
|
2658
2984
|
exports.SQLITE_KIND_REMOVAL_TIMESTAMPS = SQLITE_KIND_REMOVAL_TIMESTAMPS;
|
|
2659
2985
|
exports.SQLITE_ROW_MAPPER_CONFIG = SQLITE_ROW_MAPPER_CONFIG;
|
|
2986
|
+
exports.assertAdoptedDialect = assertAdoptedDialect;
|
|
2987
|
+
exports.buildContributionInsertValues = buildContributionInsertValues;
|
|
2988
|
+
exports.buildContributionOnConflictSet = buildContributionOnConflictSet;
|
|
2660
2989
|
exports.buildKindRemovalInsertValues = buildKindRemovalInsertValues;
|
|
2661
2990
|
exports.buildKindRemovalOnConflictSet = buildKindRemovalOnConflictSet;
|
|
2662
2991
|
exports.buildMaterializationInsertValues = buildMaterializationInsertValues;
|
|
2663
2992
|
exports.buildMaterializationOnConflictSet = buildMaterializationOnConflictSet;
|
|
2993
|
+
exports.coerceNumericScore = coerceNumericScore;
|
|
2664
2994
|
exports.compileQueryWithDialect = compileQueryWithDialect;
|
|
2665
2995
|
exports.createCommonOperationBackend = createCommonOperationBackend;
|
|
2996
|
+
exports.createContributionMaterializer = createContributionMaterializer;
|
|
2666
2997
|
exports.createEdgeRowMapper = createEdgeRowMapper;
|
|
2667
2998
|
exports.createNodeRowMapper = createNodeRowMapper;
|
|
2668
2999
|
exports.createPostgresOperationStrategy = createPostgresOperationStrategy;
|
|
@@ -2680,6 +3011,9 @@ exports.edges2 = edges2;
|
|
|
2680
3011
|
exports.embeddings = embeddings;
|
|
2681
3012
|
exports.embeddings2 = embeddings2;
|
|
2682
3013
|
exports.formatPostgresTimestamp = formatPostgresTimestamp;
|
|
3014
|
+
exports.fulltext = fulltext;
|
|
3015
|
+
exports.gateFulltext = gateFulltext;
|
|
3016
|
+
exports.gateFulltextMethods = gateFulltextMethods;
|
|
2683
3017
|
exports.generatePgCreateTableSQL = generatePgCreateTableSQL;
|
|
2684
3018
|
exports.generatePostgresDDL = generatePostgresDDL;
|
|
2685
3019
|
exports.generatePostgresMigrationSQL = generatePostgresMigrationSQL;
|
|
@@ -2688,6 +3022,7 @@ exports.generateSqliteDDL = generateSqliteDDL;
|
|
|
2688
3022
|
exports.generateSqliteMigrationSQL = generateSqliteMigrationSQL;
|
|
2689
3023
|
exports.generateVectorIndexName = generateVectorIndexName;
|
|
2690
3024
|
exports.getOrCreateLru = getOrCreateLru;
|
|
3025
|
+
exports.mapContributionMaterializationRow = mapContributionMaterializationRow;
|
|
2691
3026
|
exports.mapKindRemovalRow = mapKindRemovalRow;
|
|
2692
3027
|
exports.mapMaterializationRow = mapMaterializationRow;
|
|
2693
3028
|
exports.nodes = nodes;
|
|
@@ -2699,5 +3034,5 @@ exports.tables = tables;
|
|
|
2699
3034
|
exports.tables2 = tables2;
|
|
2700
3035
|
exports.uniques = uniques;
|
|
2701
3036
|
exports.uniques2 = uniques2;
|
|
2702
|
-
//# sourceMappingURL=chunk-
|
|
2703
|
-
//# sourceMappingURL=chunk-
|
|
3037
|
+
//# sourceMappingURL=chunk-TVUARC7S.cjs.map
|
|
3038
|
+
//# sourceMappingURL=chunk-TVUARC7S.cjs.map
|