@nicia-ai/typegraph 0.35.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backend/postgres/index.cjs +19 -19
- package/dist/backend/postgres/index.js +6 -6
- package/dist/backend/postgres/pglite.cjs +11 -11
- package/dist/backend/postgres/pglite.js +6 -6
- package/dist/backend/sqlite/index.cjs +9 -9
- package/dist/backend/sqlite/index.js +6 -6
- package/dist/backend/sqlite/libsql.cjs +8 -8
- package/dist/backend/sqlite/libsql.js +6 -6
- package/dist/backend/sqlite/local.cjs +16 -16
- package/dist/backend/sqlite/local.js +6 -6
- package/dist/{chunk-VPYHY3LJ.cjs → chunk-2THZ3TQI.cjs} +11 -11
- package/dist/{chunk-VPYHY3LJ.cjs.map → chunk-2THZ3TQI.cjs.map} +1 -1
- package/dist/{chunk-EM3CWPND.cjs → chunk-456Z2U7Y.cjs} +51 -51
- package/dist/{chunk-EM3CWPND.cjs.map → chunk-456Z2U7Y.cjs.map} +1 -1
- package/dist/{chunk-GSQ6NPH6.cjs → chunk-4BCU6VFZ.cjs} +7 -7
- package/dist/{chunk-GSQ6NPH6.cjs.map → chunk-4BCU6VFZ.cjs.map} +1 -1
- package/dist/chunk-4BMPGT35.cjs +12 -0
- package/dist/{chunk-GUR2FNB5.cjs.map → chunk-4BMPGT35.cjs.map} +1 -1
- package/dist/{chunk-WJT7OU7E.cjs → chunk-4CAXEB2F.cjs} +124 -92
- package/dist/chunk-4CAXEB2F.cjs.map +1 -0
- package/dist/{chunk-WDBCBWC4.js → chunk-4GX2JJXS.js} +6 -6
- package/dist/{chunk-WDBCBWC4.js.map → chunk-4GX2JJXS.js.map} +1 -1
- package/dist/{chunk-UES55P7G.js → chunk-5DIPR3L3.js} +284 -154
- package/dist/chunk-5DIPR3L3.js.map +1 -0
- package/dist/{chunk-CZQ3FO2Q.js → chunk-5VTR2F2K.js} +49 -16
- package/dist/chunk-5VTR2F2K.js.map +1 -0
- package/dist/{chunk-CTTSDJLY.cjs → chunk-5W4L6DLF.cjs} +11 -11
- package/dist/{chunk-CTTSDJLY.cjs.map → chunk-5W4L6DLF.cjs.map} +1 -1
- package/dist/{chunk-J7WFGBJR.cjs → chunk-7BQLPXK6.cjs} +865 -735
- package/dist/chunk-7BQLPXK6.cjs.map +1 -0
- package/dist/{chunk-3TWF3SH4.js → chunk-BJVEU3ZL.js} +7 -7
- package/dist/{chunk-3TWF3SH4.js.map → chunk-BJVEU3ZL.js.map} +1 -1
- package/dist/{chunk-LGEALRC6.cjs → chunk-DIK74MXX.cjs} +18 -2
- package/dist/chunk-DIK74MXX.cjs.map +1 -0
- package/dist/{chunk-QNKSQTKQ.js → chunk-DN5VP4JC.js} +48 -17
- package/dist/chunk-DN5VP4JC.js.map +1 -0
- package/dist/{chunk-4JEZZJ6S.cjs → chunk-HW3LW7DH.cjs} +39 -39
- package/dist/{chunk-4JEZZJ6S.cjs.map → chunk-HW3LW7DH.cjs.map} +1 -1
- package/dist/{chunk-JBTOYDMN.js → chunk-IU46OHVW.js} +4 -4
- package/dist/{chunk-JBTOYDMN.js.map → chunk-IU46OHVW.js.map} +1 -1
- package/dist/{chunk-FL472AMI.cjs → chunk-J3LEGNQB.cjs} +8 -8
- package/dist/{chunk-FL472AMI.cjs.map → chunk-J3LEGNQB.cjs.map} +1 -1
- package/dist/{chunk-O7UN7OXA.cjs → chunk-JFMEONLG.cjs} +80 -80
- package/dist/{chunk-O7UN7OXA.cjs.map → chunk-JFMEONLG.cjs.map} +1 -1
- package/dist/{chunk-I7ZUZKFD.js → chunk-JFUPDJXD.js} +3 -3
- package/dist/{chunk-I7ZUZKFD.js.map → chunk-JFUPDJXD.js.map} +1 -1
- package/dist/{chunk-K3PPLHY7.js → chunk-M75SUBFG.js} +7 -7
- package/dist/{chunk-K3PPLHY7.js.map → chunk-M75SUBFG.js.map} +1 -1
- package/dist/{chunk-CK5BVQOW.cjs → chunk-PWGX5DF5.cjs} +79 -79
- package/dist/{chunk-CK5BVQOW.cjs.map → chunk-PWGX5DF5.cjs.map} +1 -1
- package/dist/{chunk-KMI7LYAF.js → chunk-PZKNKG5M.js} +8 -8
- package/dist/{chunk-KMI7LYAF.js.map → chunk-PZKNKG5M.js.map} +1 -1
- package/dist/{chunk-55MZDDZV.js → chunk-RAXU3RMB.js} +4 -4
- package/dist/{chunk-55MZDDZV.js.map → chunk-RAXU3RMB.js.map} +1 -1
- package/dist/{chunk-BLZDPRXT.cjs → chunk-RSSQKPSZ.cjs} +5 -5
- package/dist/{chunk-BLZDPRXT.cjs.map → chunk-RSSQKPSZ.cjs.map} +1 -1
- package/dist/{chunk-RGPG7EOJ.js → chunk-S5F7ZLP2.js} +3 -3
- package/dist/{chunk-RGPG7EOJ.js.map → chunk-S5F7ZLP2.js.map} +1 -1
- package/dist/{chunk-QWEUYILR.js → chunk-SKCOUWAX.js} +3 -3
- package/dist/{chunk-QWEUYILR.js.map → chunk-SKCOUWAX.js.map} +1 -1
- package/dist/{chunk-QOTI55H7.js → chunk-SXGE7ITL.js} +4 -4
- package/dist/{chunk-QOTI55H7.js.map → chunk-SXGE7ITL.js.map} +1 -1
- package/dist/{chunk-RGP33ZJ5.js → chunk-VQEXF5D4.js} +7 -7
- package/dist/{chunk-RGP33ZJ5.js.map → chunk-VQEXF5D4.js.map} +1 -1
- package/dist/{chunk-MP2JQKSG.js → chunk-WI7ISNQF.js} +17 -3
- package/dist/chunk-WI7ISNQF.js.map +1 -0
- package/dist/{chunk-4TOD4LBZ.cjs → chunk-X4JBT642.cjs} +29 -29
- package/dist/{chunk-4TOD4LBZ.cjs.map → chunk-X4JBT642.cjs.map} +1 -1
- package/dist/{chunk-EMF62TZG.cjs → chunk-ZAMFOJ5P.cjs} +86 -86
- package/dist/{chunk-EMF62TZG.cjs.map → chunk-ZAMFOJ5P.cjs.map} +1 -1
- package/dist/{chunk-VSPCZAXF.js → chunk-ZIGXMKQQ.js} +3 -3
- package/dist/{chunk-VSPCZAXF.js.map → chunk-ZIGXMKQQ.js.map} +1 -1
- package/dist/{chunk-XOX22WHL.cjs → chunk-ZUNQ5BEP.cjs} +104 -71
- package/dist/chunk-ZUNQ5BEP.cjs.map +1 -0
- package/dist/graph-extension/index.cjs +19 -19
- package/dist/graph-extension/index.d.cts +1 -1
- package/dist/graph-extension/index.d.ts +1 -1
- package/dist/graph-extension/index.js +4 -4
- package/dist/graph-merge/index.cjs +82 -82
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +2 -2
- package/dist/graph-merge/index.d.ts +2 -2
- package/dist/graph-merge/index.js +13 -13
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-6CSUAq-x.d.ts → index-BFvdmBPV.d.ts} +68 -1
- package/dist/{index-Bks_3HHK.d.cts → index-BLtQWKRj.d.cts} +68 -1
- package/dist/index.cjs +144 -136
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +14 -14
- package/dist/interchange/index.cjs +27 -26
- package/dist/interchange/index.d.cts +1 -1
- package/dist/interchange/index.d.ts +1 -1
- package/dist/interchange/index.js +9 -8
- package/dist/profiler/index.d.cts +1 -1
- package/dist/profiler/index.d.ts +1 -1
- package/dist/provenance/index.cjs +31 -31
- package/dist/provenance/index.d.cts +1 -1
- package/dist/provenance/index.d.ts +1 -1
- package/dist/provenance/index.js +4 -4
- package/dist/schema/index.cjs +31 -31
- package/dist/schema/index.d.cts +1 -1
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/index.js +7 -7
- package/dist/{store-view-BSpqvAxK.d.cts → store-view-9KDOpZzF.d.cts} +250 -36
- package/dist/{store-view-CKbHFRnn.d.ts → store-view-DplHC3Nt.d.ts} +250 -36
- package/package.json +1 -1
- package/dist/chunk-CZQ3FO2Q.js.map +0 -1
- package/dist/chunk-GUR2FNB5.cjs +0 -12
- package/dist/chunk-J7WFGBJR.cjs.map +0 -1
- package/dist/chunk-LGEALRC6.cjs.map +0 -1
- package/dist/chunk-MP2JQKSG.js.map +0 -1
- package/dist/chunk-QNKSQTKQ.js.map +0 -1
- package/dist/chunk-UES55P7G.js.map +0 -1
- package/dist/chunk-WJT7OU7E.cjs.map +0 -1
- package/dist/chunk-XOX22WHL.cjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unwrap, validateGraphExtension } from './chunk-
|
|
1
|
+
import { unwrap, validateGraphExtension } from './chunk-SXGE7ITL.js';
|
|
2
2
|
|
|
3
3
|
// src/graph-extension/define-graph-extension.ts
|
|
4
4
|
function defineGraphExtension(input) {
|
|
@@ -6,5 +6,5 @@ function defineGraphExtension(input) {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export { defineGraphExtension };
|
|
9
|
-
//# sourceMappingURL=chunk-
|
|
10
|
-
//# sourceMappingURL=chunk-
|
|
9
|
+
//# sourceMappingURL=chunk-ZIGXMKQQ.js.map
|
|
10
|
+
//# sourceMappingURL=chunk-ZIGXMKQQ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph-extension/define-graph-extension.ts"],"names":[],"mappings":";;;AAyDO,SAAS,qBAAqB,KAAA,EAAuC;AAC1E,EAAA,OAAO,OAAO,sBAAA,CAAuB,KAAA,EAAO,EAAE,MAAA,EAAQ,IAAA,EAAM,CAAC,CAAA;AAC/D","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/graph-extension/define-graph-extension.ts"],"names":[],"mappings":";;;AAyDO,SAAS,qBAAqB,KAAA,EAAuC;AAC1E,EAAA,OAAO,OAAO,sBAAA,CAAuB,KAAA,EAAO,EAAE,MAAA,EAAQ,IAAA,EAAM,CAAC,CAAA;AAC/D","file":"chunk-ZIGXMKQQ.js","sourcesContent":["/**\n * Public entry for declaring a graph extension.\n *\n * Pure value: validates the input, deeply freezes the result, and returns\n * a `GraphExtension`. Invalid documents throw\n * `GraphExtensionValidationError` carrying every issue with a\n * JSON-pointer `path` to the offending field.\n */\nimport { unwrap } from \"../utils/result\";\nimport { type GraphExtension } from \"./extension-types\";\nimport { validateGraphExtension } from \"./validation\";\n\n/**\n * Validates and freezes a graph-extension document.\n *\n * Authoring entry point — runs validation in **strict** mode: unknown\n * top-level keys (e.g. `node` instead of `nodes`) and unsupported\n * string formats (e.g. `\"date-time\"` with a hyphen instead of\n * `\"datetime\"`) fail loudly with `UNKNOWN_DOCUMENT_KEY` /\n * `UNSUPPORTED_STRING_FORMAT`. The persistence-load path leaves both\n * checks off so a document committed by a future v1.x writer with\n * additive fields still parses on an older v1 reader. Callers\n * accepting raw JSON from an untyped source (e.g. an LLM proposal)\n * should validate first via `validateGraphExtension` and surface\n * the structured issues, then pass the validated document here.\n *\n * @param input - Document describing additional node kinds, edge\n * kinds, and ontology relations. Must satisfy the v1 property-type\n * subset documented in `ExtensionPropertyType`.\n *\n * @returns The same document, deeply frozen and shape-checked.\n *\n * @throws {GraphExtensionValidationError} when the document violates\n * the v1 property-type subset, references undeclared kinds, contains\n * ontology cycles, etc. The thrown error's `details.issues` array\n * carries every failure with a JSON-pointer path.\n * @throws {GraphExtensionVersionUnsupportedError} when the document\n * declares a future major version this library cannot safely decode.\n *\n * @example\n * ```typescript\n * const extension = defineGraphExtension({\n * nodes: {\n * Paper: {\n * properties: {\n * doi: { type: \"string\" },\n * title: { type: \"string\", searchable: { language: \"english\" } },\n * },\n * unique: [{ name: \"paper_doi\", fields: [\"doi\"] }],\n * },\n * },\n * });\n *\n * const evolved = await store.evolve(extension);\n * const papers = evolved.getNodeCollectionOrThrow(\"Paper\");\n * ```\n */\nexport function defineGraphExtension(input: GraphExtension): GraphExtension {\n return unwrap(validateGraphExtension(input, { strict: true }));\n}\n"]}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkEOLERH7Y_cjs = require('./chunk-EOLERH7Y.cjs');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunkX4JBT642_cjs = require('./chunk-X4JBT642.cjs');
|
|
5
|
+
var chunkRSSQKPSZ_cjs = require('./chunk-RSSQKPSZ.cjs');
|
|
6
6
|
var chunk7YSP4V4R_cjs = require('./chunk-7YSP4V4R.cjs');
|
|
7
7
|
var chunkH7YNSMA7_cjs = require('./chunk-H7YNSMA7.cjs');
|
|
8
|
-
var
|
|
8
|
+
var chunkDIK74MXX_cjs = require('./chunk-DIK74MXX.cjs');
|
|
9
9
|
var drizzleOrm = require('drizzle-orm');
|
|
10
10
|
var nanoid = require('nanoid');
|
|
11
11
|
|
|
12
12
|
// src/core/temporal.ts
|
|
13
13
|
var RECORDED_MAX = "9999-12-31T23:59:59.999Z";
|
|
14
14
|
function assertValidRecordedInstant(value, path) {
|
|
15
|
-
|
|
15
|
+
chunkRSSQKPSZ_cjs.validateCanonicalIsoDate(value, path);
|
|
16
16
|
if (value >= RECORDED_MAX) {
|
|
17
|
-
throw new
|
|
17
|
+
throw new chunkDIK74MXX_cjs.ValidationError(
|
|
18
18
|
`${path} must be before the recorded-time open sentinel ${RECORDED_MAX}.`,
|
|
19
19
|
{
|
|
20
20
|
issues: [
|
|
@@ -36,7 +36,7 @@ function asRecordedInstant(value) {
|
|
|
36
36
|
}
|
|
37
37
|
function resolveReadCoordinate(mode, asOf, suggestion) {
|
|
38
38
|
if (mode !== "asOf" && asOf !== void 0) {
|
|
39
|
-
throw new
|
|
39
|
+
throw new chunkDIK74MXX_cjs.ValidationError(
|
|
40
40
|
`Temporal mode "${mode}" does not take an asOf timestamp.`,
|
|
41
41
|
{
|
|
42
42
|
issues: [
|
|
@@ -67,7 +67,7 @@ function withRecordedCoordinate(coordinate, recordedAsOf) {
|
|
|
67
67
|
}
|
|
68
68
|
function assertValidAsOf(mode, asOf, options) {
|
|
69
69
|
if (mode === "asOf" && asOf === void 0) {
|
|
70
|
-
throw new
|
|
70
|
+
throw new chunkDIK74MXX_cjs.ValidationError(
|
|
71
71
|
'Temporal mode "asOf" requires a timestamp',
|
|
72
72
|
{
|
|
73
73
|
issues: [
|
|
@@ -80,7 +80,7 @@ function assertValidAsOf(mode, asOf, options) {
|
|
|
80
80
|
);
|
|
81
81
|
}
|
|
82
82
|
if (asOf !== void 0) {
|
|
83
|
-
|
|
83
|
+
chunkRSSQKPSZ_cjs.validateCanonicalIsoDate(asOf, "asOf");
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
function describeCoordinate(coordinate) {
|
|
@@ -145,15 +145,15 @@ function resolveTableNames(names) {
|
|
|
145
145
|
var VALID_IDENTIFIER_PATTERN = /^[a-z_][a-z0-9_$]*$/i;
|
|
146
146
|
function validateTableName(name, label) {
|
|
147
147
|
if (!name || name.length === 0) {
|
|
148
|
-
throw new
|
|
148
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(`${label} table name cannot be empty`);
|
|
149
149
|
}
|
|
150
150
|
if (name.length > chunk7YSP4V4R_cjs.MAX_PG_IDENTIFIER_LENGTH) {
|
|
151
|
-
throw new
|
|
151
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(
|
|
152
152
|
`${label} table name exceeds maximum length of ${chunk7YSP4V4R_cjs.MAX_PG_IDENTIFIER_LENGTH} characters`
|
|
153
153
|
);
|
|
154
154
|
}
|
|
155
155
|
if (!VALID_IDENTIFIER_PATTERN.test(name)) {
|
|
156
|
-
throw new
|
|
156
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(
|
|
157
157
|
`${label} table name "${name}" is not a valid SQL identifier. Table names must start with a letter or underscore and contain only letters, digits, underscores, or dollar signs.`
|
|
158
158
|
);
|
|
159
159
|
}
|
|
@@ -169,7 +169,7 @@ function isSqlSchema(schema) {
|
|
|
169
169
|
}
|
|
170
170
|
function requireSqlSchema(schema, surface = "SqlSchema") {
|
|
171
171
|
if (isSqlSchema(schema)) return schema;
|
|
172
|
-
throw new
|
|
172
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(
|
|
173
173
|
`${surface} must be created with createSqlSchema(...).`,
|
|
174
174
|
{ code: "INVALID_SQL_SCHEMA", surface },
|
|
175
175
|
{
|
|
@@ -215,7 +215,7 @@ function recordedRelation(options) {
|
|
|
215
215
|
function requireExternalRecordedReadSource(source) {
|
|
216
216
|
if (source === void 0) return void 0;
|
|
217
217
|
if (isExternalRecordedReadSource(source)) return source;
|
|
218
|
-
throw new
|
|
218
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(
|
|
219
219
|
"recordedRead must be created with recordedRelation({ schema }).",
|
|
220
220
|
{ code: "INVALID_RECORDED_READ_SOURCE" },
|
|
221
221
|
{
|
|
@@ -239,7 +239,7 @@ function createRecordedReadBinding(schema) {
|
|
|
239
239
|
function requireRecordedReadBinding(binding, surface) {
|
|
240
240
|
if (isRecordedReadBinding(binding)) return binding;
|
|
241
241
|
if (binding !== void 0) {
|
|
242
|
-
throw new
|
|
242
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(
|
|
243
243
|
"Recorded-time reads require a recorded read relation created by TypeGraph.",
|
|
244
244
|
{ code: "INVALID_RECORDED_READ_BINDING", surface },
|
|
245
245
|
{
|
|
@@ -247,7 +247,7 @@ function requireRecordedReadBinding(binding, surface) {
|
|
|
247
247
|
}
|
|
248
248
|
);
|
|
249
249
|
}
|
|
250
|
-
throw new
|
|
250
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(
|
|
251
251
|
"Recorded-time reads require a recorded read relation.",
|
|
252
252
|
{ code: "RECORDED_READ_REQUIRES_BINDING", surface },
|
|
253
253
|
{
|
|
@@ -297,7 +297,7 @@ function generateId() {
|
|
|
297
297
|
}
|
|
298
298
|
function requireRecordedSchema(target) {
|
|
299
299
|
if (target.tableNames === void 0) {
|
|
300
|
-
throw new
|
|
300
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(
|
|
301
301
|
"Recorded-time capture requires the backend to expose tableNames.",
|
|
302
302
|
{ dialect: target.dialect },
|
|
303
303
|
{
|
|
@@ -309,7 +309,7 @@ function requireRecordedSchema(target) {
|
|
|
309
309
|
}
|
|
310
310
|
function requireCaptureStatements(target) {
|
|
311
311
|
if (target.executeStatement === void 0) {
|
|
312
|
-
throw new
|
|
312
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(
|
|
313
313
|
"Recorded-time capture requires backend.executeStatement support on the transaction backend.",
|
|
314
314
|
{ dialect: target.dialect },
|
|
315
315
|
{
|
|
@@ -323,7 +323,7 @@ async function executeStatement(target, query) {
|
|
|
323
323
|
await target.executeStatement(chunkEOLERH7Y_cjs.asCompiledStatementSql(query));
|
|
324
324
|
}
|
|
325
325
|
function unsupportedPostgresIsolationError(isolationLevel) {
|
|
326
|
-
return new
|
|
326
|
+
return new chunkDIK74MXX_cjs.ConfigurationError(
|
|
327
327
|
"Recorded-time capture on PostgreSQL requires read_committed isolation.",
|
|
328
328
|
{ isolationLevel: isolationLevel ?? "unknown" },
|
|
329
329
|
{
|
|
@@ -357,28 +357,35 @@ async function assertRecordedCaptureTransactionIsolation(target) {
|
|
|
357
357
|
if (isSupportedRecordedIsolationLevel(isolationLevel)) return;
|
|
358
358
|
throw unsupportedPostgresIsolationError(isolationLevel);
|
|
359
359
|
}
|
|
360
|
-
function recordedCaptureRequiresCallbackTransactionError(details) {
|
|
361
|
-
return new
|
|
360
|
+
function recordedCaptureRequiresCallbackTransactionError(details = {}) {
|
|
361
|
+
return new chunkDIK74MXX_cjs.ConfigurationError(
|
|
362
362
|
"withTransaction() has no recorded-time capture flush point when history is enabled.",
|
|
363
|
-
|
|
363
|
+
{
|
|
364
|
+
...details,
|
|
365
|
+
code: "RECORDED_CAPTURE_REQUIRES_CALLBACK_TRANSACTION"
|
|
366
|
+
},
|
|
364
367
|
{
|
|
365
368
|
suggestion: "Use store.withRecordedTransaction(externalTx, async (tx) => ...) so TypeGraph can flush capture before the caller commits."
|
|
366
369
|
}
|
|
367
370
|
);
|
|
368
371
|
}
|
|
369
372
|
function historyUnsafeRawWriteError(surface) {
|
|
370
|
-
return new
|
|
373
|
+
return new chunkDIK74MXX_cjs.ConfigurationError(
|
|
371
374
|
`${surface} is not available when history capture is enabled because raw SQL writes bypass recorded-time capture.`,
|
|
372
|
-
{
|
|
375
|
+
{
|
|
376
|
+
code: "RECORDED_CAPTURE_RAW_SQL_DISABLED"
|
|
377
|
+
},
|
|
373
378
|
{
|
|
374
379
|
suggestion: "Run graph writes through store.nodes/store.edges (or tx.nodes/tx.edges inside a transaction), or perform raw relational writes outside a history-enabled TypeGraph store."
|
|
375
380
|
}
|
|
376
381
|
);
|
|
377
382
|
}
|
|
378
383
|
function revisionTrackingUnsafeRawWriteError(surface) {
|
|
379
|
-
return new
|
|
384
|
+
return new chunkDIK74MXX_cjs.ConfigurationError(
|
|
380
385
|
`${surface} is not available when revision tracking is enabled because raw SQL writes bypass the revision anchor.`,
|
|
381
|
-
{
|
|
386
|
+
{
|
|
387
|
+
code: "REVISION_TRACKING_RAW_SQL_DISABLED"
|
|
388
|
+
},
|
|
382
389
|
{
|
|
383
390
|
suggestion: "Run graph writes through store.nodes/store.edges (or tx.nodes/tx.edges inside a transaction), so TypeGraph can advance the revision anchor."
|
|
384
391
|
}
|
|
@@ -455,7 +462,7 @@ function rawWriteGuards(target, prefix) {
|
|
|
455
462
|
}
|
|
456
463
|
function assertCapturableBackend(backend) {
|
|
457
464
|
if (!backend.capabilities.transactions) {
|
|
458
|
-
throw new
|
|
465
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(
|
|
459
466
|
"history: true requires a backend with transaction support.",
|
|
460
467
|
{ dialect: backend.dialect },
|
|
461
468
|
{
|
|
@@ -464,7 +471,7 @@ function assertCapturableBackend(backend) {
|
|
|
464
471
|
);
|
|
465
472
|
}
|
|
466
473
|
if (backend.executeStatement === void 0) {
|
|
467
|
-
throw new
|
|
474
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(
|
|
468
475
|
"history: true requires a backend that supports executeStatement.",
|
|
469
476
|
{ dialect: backend.dialect },
|
|
470
477
|
{
|
|
@@ -473,7 +480,7 @@ function assertCapturableBackend(backend) {
|
|
|
473
480
|
);
|
|
474
481
|
}
|
|
475
482
|
if (backend.capabilities.returning === false) {
|
|
476
|
-
throw new
|
|
483
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(
|
|
477
484
|
"history: true requires a backend that supports UPDATE \u2026 RETURNING.",
|
|
478
485
|
{ dialect: backend.dialect },
|
|
479
486
|
{
|
|
@@ -482,7 +489,7 @@ function assertCapturableBackend(backend) {
|
|
|
482
489
|
);
|
|
483
490
|
}
|
|
484
491
|
if (backend.tableNames === void 0) {
|
|
485
|
-
throw new
|
|
492
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(
|
|
486
493
|
"history: true requires a backend that exposes tableNames.",
|
|
487
494
|
{ dialect: backend.dialect },
|
|
488
495
|
{
|
|
@@ -493,7 +500,7 @@ function assertCapturableBackend(backend) {
|
|
|
493
500
|
}
|
|
494
501
|
function assertRevisionTrackableBackend(backend) {
|
|
495
502
|
if (!backend.capabilities.transactions) {
|
|
496
|
-
throw new
|
|
503
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(
|
|
497
504
|
"revisionTracking: true requires a backend with transaction support.",
|
|
498
505
|
{ dialect: backend.dialect },
|
|
499
506
|
{
|
|
@@ -502,7 +509,7 @@ function assertRevisionTrackableBackend(backend) {
|
|
|
502
509
|
);
|
|
503
510
|
}
|
|
504
511
|
if (backend.executeStatement === void 0) {
|
|
505
|
-
throw new
|
|
512
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(
|
|
506
513
|
"revisionTracking: true requires a backend that supports executeStatement.",
|
|
507
514
|
{ dialect: backend.dialect },
|
|
508
515
|
{
|
|
@@ -511,7 +518,7 @@ function assertRevisionTrackableBackend(backend) {
|
|
|
511
518
|
);
|
|
512
519
|
}
|
|
513
520
|
if (backend.tableNames === void 0) {
|
|
514
|
-
throw new
|
|
521
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(
|
|
515
522
|
"revisionTracking: true requires a backend that exposes tableNames.",
|
|
516
523
|
{ dialect: backend.dialect },
|
|
517
524
|
{
|
|
@@ -520,7 +527,7 @@ function assertRevisionTrackableBackend(backend) {
|
|
|
520
527
|
);
|
|
521
528
|
}
|
|
522
529
|
if (backend.ensureRevisionOriginsTable === void 0) {
|
|
523
|
-
throw new
|
|
530
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(
|
|
524
531
|
"revisionTracking: true requires a backend that can bootstrap revision origins.",
|
|
525
532
|
{ dialect: backend.dialect },
|
|
526
533
|
{
|
|
@@ -592,7 +599,7 @@ async function lockRecordedGraphWrite(target, graphId, memo) {
|
|
|
592
599
|
return graphWriteLockEvidence();
|
|
593
600
|
}
|
|
594
601
|
function failInvalidClockTimestamp(value) {
|
|
595
|
-
throw new
|
|
602
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(
|
|
596
603
|
"Recorded clock row contained an invalid timestamp",
|
|
597
604
|
{ value }
|
|
598
605
|
);
|
|
@@ -631,7 +638,7 @@ function toCanonicalIso(value) {
|
|
|
631
638
|
return failInvalidClockTimestamp(value);
|
|
632
639
|
}
|
|
633
640
|
function nextRecordedCommitTime(previous) {
|
|
634
|
-
const wallTime = Date.parse(
|
|
641
|
+
const wallTime = Date.parse(chunkRSSQKPSZ_cjs.nowIso());
|
|
635
642
|
return previous === void 0 ? wallTime : Math.max(wallTime, Date.parse(previous) + 1);
|
|
636
643
|
}
|
|
637
644
|
async function readRecordedClock(target, schema, graphId) {
|
|
@@ -656,7 +663,7 @@ async function readRevisionOrigin(target, schema, graphId) {
|
|
|
656
663
|
const first = rows[0];
|
|
657
664
|
if (first === void 0) return void 0;
|
|
658
665
|
if (typeof first.origin !== "string" || first.origin.length === 0) {
|
|
659
|
-
throw new
|
|
666
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(
|
|
660
667
|
"Revision origin row contained an invalid origin",
|
|
661
668
|
{ graphId, origin: first.origin }
|
|
662
669
|
);
|
|
@@ -666,7 +673,7 @@ async function readRevisionOrigin(target, schema, graphId) {
|
|
|
666
673
|
async function ensureRevisionOrigin(target, schema, graphId) {
|
|
667
674
|
const ensureTable = target.ensureRevisionOriginsTable;
|
|
668
675
|
if (ensureTable === void 0) {
|
|
669
|
-
throw new
|
|
676
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(
|
|
670
677
|
"Revision tracking requires a backend that can bootstrap revision origins.",
|
|
671
678
|
{ dialect: target.dialect },
|
|
672
679
|
{
|
|
@@ -687,7 +694,7 @@ async function ensureRevisionOrigin(target, schema, graphId) {
|
|
|
687
694
|
);
|
|
688
695
|
const origin = await readRevisionOrigin(target, schema, graphId);
|
|
689
696
|
if (origin !== void 0) return origin;
|
|
690
|
-
throw new
|
|
697
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(
|
|
691
698
|
"Revision origin was not persisted after initialization.",
|
|
692
699
|
{ graphId, dialect: target.dialect }
|
|
693
700
|
);
|
|
@@ -724,7 +731,7 @@ async function allocateRecordedCommit(target, schema, graphId, ownsWriteLock, pr
|
|
|
724
731
|
const previous = previousRevision ?? await readRecordedClock(target, schema, graphId);
|
|
725
732
|
const recordedCommitTime = nextRecordedCommitTime(previous);
|
|
726
733
|
if (!Number.isFinite(recordedCommitTime) || recordedCommitTime >= RECORDED_MAX_TIME) {
|
|
727
|
-
throw new
|
|
734
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(
|
|
728
735
|
`Recorded commit clock reached the open sentinel ${RECORDED_MAX}`,
|
|
729
736
|
{ graphId, recordedCommitTime },
|
|
730
737
|
{
|
|
@@ -873,7 +880,7 @@ var RECORDED_BIND_PARAM_BUDGET = 900;
|
|
|
873
880
|
function recordedBindParamBudget(target) {
|
|
874
881
|
const budget = target.capabilities.maxBindParameters ?? RECORDED_BIND_PARAM_BUDGET;
|
|
875
882
|
if (!Number.isSafeInteger(budget) || budget < 1) {
|
|
876
|
-
throw new
|
|
883
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(
|
|
877
884
|
`backend capabilities.maxBindParameters must be a positive integer, got: ${String(budget)}`,
|
|
878
885
|
{
|
|
879
886
|
code: "INVALID_BACKEND_CAPABILITY",
|
|
@@ -894,7 +901,7 @@ function recordedCommonCells() {
|
|
|
894
901
|
graph_id: (row) => drizzleOrm.sql`${row.graph_id}`,
|
|
895
902
|
id: (row) => drizzleOrm.sql`${row.id}`,
|
|
896
903
|
kind: (row) => drizzleOrm.sql`${row.kind}`,
|
|
897
|
-
props: (row) => drizzleOrm.sql`${
|
|
904
|
+
props: (row) => drizzleOrm.sql`${chunkX4JBT642_cjs.rowPropsToJsonText(row.props)}`,
|
|
898
905
|
valid_from: (row) => drizzleOrm.sql`${chunk7YSP4V4R_cjs.sqlNull(row.valid_from)}`,
|
|
899
906
|
valid_to: (row) => drizzleOrm.sql`${chunk7YSP4V4R_cjs.sqlNull(row.valid_to)}`,
|
|
900
907
|
created_at: (row) => drizzleOrm.sql`${row.created_at}`,
|
|
@@ -993,14 +1000,14 @@ async function closeOpenReturning(target, table, graphId, ids, recordedCommit, k
|
|
|
993
1000
|
WHERE graph_id = ${graphId}
|
|
994
1001
|
${kindFilter}
|
|
995
1002
|
AND recorded_to = ${RECORDED_MAX}
|
|
996
|
-
AND id IN (${
|
|
1003
|
+
AND id IN (${chunkX4JBT642_cjs.sqlValueList(ids)})
|
|
997
1004
|
RETURNING id, deleted_at
|
|
998
1005
|
`)
|
|
999
1006
|
);
|
|
1000
|
-
return new Map(rows.map((row) => [row.id,
|
|
1007
|
+
return new Map(rows.map((row) => [row.id, chunkX4JBT642_cjs.isPresent(row.deleted_at)]));
|
|
1001
1008
|
}
|
|
1002
1009
|
function recordedOp(hadOpenRow, priorRowWasTombstone, after) {
|
|
1003
|
-
if (
|
|
1010
|
+
if (chunkX4JBT642_cjs.isPresent(after.deleted_at)) return "delete";
|
|
1004
1011
|
if (!hadOpenRow || priorRowWasTombstone) return "create";
|
|
1005
1012
|
return "update";
|
|
1006
1013
|
}
|
|
@@ -1037,7 +1044,7 @@ function recordedInsertsFor(afterById, closed) {
|
|
|
1037
1044
|
async function flushNodes(target, schema, graphId, entities, recordedCommit) {
|
|
1038
1045
|
const chunkSize = recordedNodeChunkSize(target);
|
|
1039
1046
|
for (const [kind, group] of groupNodesByKind(entities)) {
|
|
1040
|
-
for (const entityChunk of
|
|
1047
|
+
for (const entityChunk of chunkX4JBT642_cjs.chunk(group, chunkSize)) {
|
|
1041
1048
|
const ids = entityChunk.map((entity) => entity.id);
|
|
1042
1049
|
const closed = await closeOpenReturning(
|
|
1043
1050
|
target,
|
|
@@ -1062,7 +1069,7 @@ async function flushNodes(target, schema, graphId, entities, recordedCommit) {
|
|
|
1062
1069
|
}
|
|
1063
1070
|
async function flushEdges(target, schema, graphId, entities, recordedCommit) {
|
|
1064
1071
|
const chunkSize = recordedEdgeChunkSize(target);
|
|
1065
|
-
for (const entityChunk of
|
|
1072
|
+
for (const entityChunk of chunkX4JBT642_cjs.chunk(entities, chunkSize)) {
|
|
1066
1073
|
const ids = entityChunk.map((entity) => entity.id);
|
|
1067
1074
|
const closed = await closeOpenReturning(
|
|
1068
1075
|
target,
|
|
@@ -1188,22 +1195,32 @@ function edgeParamsIdentityKey(params) {
|
|
|
1188
1195
|
function edgeRowIdentityKey(row) {
|
|
1189
1196
|
return edgeIdentityKey(row.graph_id, row.id);
|
|
1190
1197
|
}
|
|
1198
|
+
function recordedCaptureSealedError(details) {
|
|
1199
|
+
return new chunkDIK74MXX_cjs.ConfigurationError(
|
|
1200
|
+
"Recorded-time capture session is sealed: a graph write happened after the transaction's capture was flushed.",
|
|
1201
|
+
details,
|
|
1202
|
+
{
|
|
1203
|
+
suggestion: "Perform all writes inside the withRecordedTransaction callback; do not reuse the transaction context after it returns."
|
|
1204
|
+
}
|
|
1205
|
+
);
|
|
1206
|
+
}
|
|
1191
1207
|
function createRecordedCaptureSession() {
|
|
1192
1208
|
const touched = /* @__PURE__ */ new Map();
|
|
1193
1209
|
let sealed = false;
|
|
1194
1210
|
function touch(entity) {
|
|
1195
1211
|
if (sealed) {
|
|
1196
|
-
throw
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
}
|
|
1202
|
-
);
|
|
1212
|
+
throw recordedCaptureSealedError({
|
|
1213
|
+
entity: entity.entity,
|
|
1214
|
+
graphId: entity.graphId,
|
|
1215
|
+
id: entity.id
|
|
1216
|
+
});
|
|
1203
1217
|
}
|
|
1204
1218
|
touched.set(entityKey(entity), entity);
|
|
1205
1219
|
}
|
|
1206
1220
|
return {
|
|
1221
|
+
assertOpen() {
|
|
1222
|
+
if (sealed) throw recordedCaptureSealedError({});
|
|
1223
|
+
},
|
|
1207
1224
|
touchNode(graphId, kind, id, afterImage) {
|
|
1208
1225
|
touch({ entity: "node", graphId, kind, id, afterImage });
|
|
1209
1226
|
},
|
|
@@ -1212,7 +1229,7 @@ function createRecordedCaptureSession() {
|
|
|
1212
1229
|
},
|
|
1213
1230
|
async flush(target, schema, ownsWriteLock) {
|
|
1214
1231
|
if (sealed) {
|
|
1215
|
-
throw new
|
|
1232
|
+
throw new chunkDIK74MXX_cjs.ConfigurationError(
|
|
1216
1233
|
"Recorded-time capture session was already flushed.",
|
|
1217
1234
|
{},
|
|
1218
1235
|
{
|
|
@@ -1223,7 +1240,7 @@ function createRecordedCaptureSession() {
|
|
|
1223
1240
|
sealed = true;
|
|
1224
1241
|
if (touched.size === 0) return /* @__PURE__ */ new Map();
|
|
1225
1242
|
const recordedByGraph = /* @__PURE__ */ new Map();
|
|
1226
|
-
const byGraph =
|
|
1243
|
+
const byGraph = chunkX4JBT642_cjs.groupBy(touched.values(), (entity) => entity.graphId);
|
|
1227
1244
|
for (const [graphId, entities] of byGraph) {
|
|
1228
1245
|
const recordedCommit = await allocateRecordedCommit(
|
|
1229
1246
|
target,
|
|
@@ -1261,9 +1278,10 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
1261
1278
|
await lockRecordedGraphWrite(target, graphId, graphLocks);
|
|
1262
1279
|
}
|
|
1263
1280
|
}
|
|
1264
|
-
const overlay =
|
|
1281
|
+
const overlay = chunkX4JBT642_cjs.createBackendOverlay(target, {
|
|
1265
1282
|
...rawWriteGuards(target, "tx.backend"),
|
|
1266
1283
|
async insertNode(params) {
|
|
1284
|
+
session.assertOpen();
|
|
1267
1285
|
await lockGraph(params.graphId);
|
|
1268
1286
|
const row = await target.insertNode(params);
|
|
1269
1287
|
session.touchNode(params.graphId, params.kind, params.id, row);
|
|
@@ -1271,6 +1289,7 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
1271
1289
|
},
|
|
1272
1290
|
...target.insertNodeNoReturn === void 0 ? {} : {
|
|
1273
1291
|
async insertNodeNoReturn(params) {
|
|
1292
|
+
session.assertOpen();
|
|
1274
1293
|
await lockGraph(params.graphId);
|
|
1275
1294
|
await runInsertNoReturn(nodeDispatch, params);
|
|
1276
1295
|
session.touchNode(params.graphId, params.kind, params.id);
|
|
@@ -1278,6 +1297,7 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
1278
1297
|
},
|
|
1279
1298
|
...target.insertNodesBatch === void 0 ? {} : {
|
|
1280
1299
|
async insertNodesBatch(params) {
|
|
1300
|
+
session.assertOpen();
|
|
1281
1301
|
await lockGraphs(params);
|
|
1282
1302
|
await runInsertBatch(nodeDispatch, params);
|
|
1283
1303
|
for (const node of params) {
|
|
@@ -1287,6 +1307,7 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
1287
1307
|
},
|
|
1288
1308
|
...target.insertNodesBatchReturning === void 0 ? {} : {
|
|
1289
1309
|
async insertNodesBatchReturning(params) {
|
|
1310
|
+
session.assertOpen();
|
|
1290
1311
|
await lockGraphs(params);
|
|
1291
1312
|
const rows = await runInsertBatchReturning(nodeDispatch, params);
|
|
1292
1313
|
const rowsByIdentity = new Map(
|
|
@@ -1304,17 +1325,20 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
1304
1325
|
}
|
|
1305
1326
|
},
|
|
1306
1327
|
async updateNode(params) {
|
|
1328
|
+
session.assertOpen();
|
|
1307
1329
|
await lockGraph(params.graphId);
|
|
1308
1330
|
const row = await target.updateNode(params);
|
|
1309
1331
|
session.touchNode(params.graphId, params.kind, params.id, row);
|
|
1310
1332
|
return row;
|
|
1311
1333
|
},
|
|
1312
1334
|
async deleteNode(params) {
|
|
1335
|
+
session.assertOpen();
|
|
1313
1336
|
await lockGraph(params.graphId);
|
|
1314
1337
|
await target.deleteNode(params);
|
|
1315
1338
|
session.touchNode(params.graphId, params.kind, params.id);
|
|
1316
1339
|
},
|
|
1317
1340
|
async hardDeleteNode(params) {
|
|
1341
|
+
session.assertOpen();
|
|
1318
1342
|
await lockGraph(params.graphId);
|
|
1319
1343
|
const connectedEdgeIds = await queryConnectedEdgeIds(
|
|
1320
1344
|
target,
|
|
@@ -1328,6 +1352,7 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
1328
1352
|
}
|
|
1329
1353
|
},
|
|
1330
1354
|
async insertEdge(params) {
|
|
1355
|
+
session.assertOpen();
|
|
1331
1356
|
await lockGraph(params.graphId);
|
|
1332
1357
|
const row = await target.insertEdge(params);
|
|
1333
1358
|
session.touchEdge(params.graphId, params.id, row);
|
|
@@ -1335,6 +1360,7 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
1335
1360
|
},
|
|
1336
1361
|
...target.insertEdgeNoReturn === void 0 ? {} : {
|
|
1337
1362
|
async insertEdgeNoReturn(params) {
|
|
1363
|
+
session.assertOpen();
|
|
1338
1364
|
await lockGraph(params.graphId);
|
|
1339
1365
|
await runInsertNoReturn(edgeDispatch, params);
|
|
1340
1366
|
session.touchEdge(params.graphId, params.id);
|
|
@@ -1342,6 +1368,7 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
1342
1368
|
},
|
|
1343
1369
|
...target.insertEdgesBatch === void 0 ? {} : {
|
|
1344
1370
|
async insertEdgesBatch(params) {
|
|
1371
|
+
session.assertOpen();
|
|
1345
1372
|
await lockGraphs(params);
|
|
1346
1373
|
await runInsertBatch(edgeDispatch, params);
|
|
1347
1374
|
for (const edge of params) {
|
|
@@ -1351,6 +1378,7 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
1351
1378
|
},
|
|
1352
1379
|
...target.insertEdgesBatchReturning === void 0 ? {} : {
|
|
1353
1380
|
async insertEdgesBatchReturning(params) {
|
|
1381
|
+
session.assertOpen();
|
|
1354
1382
|
await lockGraphs(params);
|
|
1355
1383
|
const rows = await runInsertBatchReturning(edgeDispatch, params);
|
|
1356
1384
|
const rowsByIdentity = new Map(
|
|
@@ -1367,23 +1395,27 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
1367
1395
|
}
|
|
1368
1396
|
},
|
|
1369
1397
|
async updateEdge(params) {
|
|
1398
|
+
session.assertOpen();
|
|
1370
1399
|
await lockGraph(params.graphId);
|
|
1371
1400
|
const row = await target.updateEdge(params);
|
|
1372
1401
|
session.touchEdge(params.graphId, params.id, row);
|
|
1373
1402
|
return row;
|
|
1374
1403
|
},
|
|
1375
1404
|
async deleteEdge(params) {
|
|
1405
|
+
session.assertOpen();
|
|
1376
1406
|
await lockGraph(params.graphId);
|
|
1377
1407
|
await target.deleteEdge(params);
|
|
1378
1408
|
session.touchEdge(params.graphId, params.id);
|
|
1379
1409
|
},
|
|
1380
1410
|
async hardDeleteEdge(params) {
|
|
1411
|
+
session.assertOpen();
|
|
1381
1412
|
await lockGraph(params.graphId);
|
|
1382
1413
|
await target.hardDeleteEdge(params);
|
|
1383
1414
|
session.touchEdge(params.graphId, params.id);
|
|
1384
1415
|
},
|
|
1385
1416
|
...target.deleteEdgesBatch === void 0 ? {} : {
|
|
1386
1417
|
async deleteEdgesBatch(params) {
|
|
1418
|
+
session.assertOpen();
|
|
1387
1419
|
await lockGraph(params.graphId);
|
|
1388
1420
|
await target.deleteEdgesBatch(params);
|
|
1389
1421
|
for (const id of params.ids) {
|
|
@@ -1393,6 +1425,7 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
1393
1425
|
},
|
|
1394
1426
|
...target.hardDeleteEdgesBatch === void 0 ? {} : {
|
|
1395
1427
|
async hardDeleteEdgesBatch(params) {
|
|
1428
|
+
session.assertOpen();
|
|
1396
1429
|
await lockGraph(params.graphId);
|
|
1397
1430
|
await target.hardDeleteEdgesBatch(params);
|
|
1398
1431
|
for (const id of params.ids) {
|
|
@@ -1411,7 +1444,7 @@ function createRecordedTransactionScope(target, schema, ownsWriteLock = false) {
|
|
|
1411
1444
|
return {
|
|
1412
1445
|
backend: createRecordedTransactionBackend(target, session, resolvedSchema),
|
|
1413
1446
|
async flush() {
|
|
1414
|
-
return
|
|
1447
|
+
return chunkRSSQKPSZ_cjs.withRecordedRelationsPrecondition(
|
|
1415
1448
|
session.flush(target, resolvedSchema, ownsWriteLock),
|
|
1416
1449
|
{ dialect: target.dialect, surface: "capture-flush" }
|
|
1417
1450
|
);
|
|
@@ -1431,7 +1464,7 @@ async function runCapturedAutocommit(backend, schema, fn, options) {
|
|
|
1431
1464
|
function createRecordedBackend(backend, schema) {
|
|
1432
1465
|
assertCapturableBackend(backend);
|
|
1433
1466
|
const capture = (fn) => runCapturedAutocommit(backend, schema, fn);
|
|
1434
|
-
return
|
|
1467
|
+
return chunkX4JBT642_cjs.createBackendOverlay(backend, {
|
|
1435
1468
|
...rawWriteGuards(backend, "backend"),
|
|
1436
1469
|
async insertNode(params) {
|
|
1437
1470
|
return capture((target) => target.insertNode(params));
|
|
@@ -1823,7 +1856,7 @@ function evaluatePredicate(predicate, props) {
|
|
|
1823
1856
|
if (pred.op === "isNull") {
|
|
1824
1857
|
return value === null || value === void 0;
|
|
1825
1858
|
}
|
|
1826
|
-
return
|
|
1859
|
+
return chunkX4JBT642_cjs.isPresent(value);
|
|
1827
1860
|
}
|
|
1828
1861
|
function getKindsForUniquenessCheck(baseKind, scope, registry) {
|
|
1829
1862
|
if (scope === "kind") {
|
|
@@ -1852,7 +1885,7 @@ function checkCardinality(edgeKind, fromKind, fromId, cardinality, existingEdgeC
|
|
|
1852
1885
|
}
|
|
1853
1886
|
case "one": {
|
|
1854
1887
|
if (existingEdgeCount > 0) {
|
|
1855
|
-
return new
|
|
1888
|
+
return new chunkDIK74MXX_cjs.CardinalityError({
|
|
1856
1889
|
edgeKind,
|
|
1857
1890
|
fromKind,
|
|
1858
1891
|
fromId,
|
|
@@ -1867,7 +1900,7 @@ function checkCardinality(edgeKind, fromKind, fromId, cardinality, existingEdgeC
|
|
|
1867
1900
|
}
|
|
1868
1901
|
case "oneActive": {
|
|
1869
1902
|
if (hasActiveEdge) {
|
|
1870
|
-
return new
|
|
1903
|
+
return new chunkDIK74MXX_cjs.CardinalityError({
|
|
1871
1904
|
edgeKind,
|
|
1872
1905
|
fromKind,
|
|
1873
1906
|
fromId,
|
|
@@ -1881,7 +1914,7 @@ function checkCardinality(edgeKind, fromKind, fromId, cardinality, existingEdgeC
|
|
|
1881
1914
|
}
|
|
1882
1915
|
function checkUniqueEdge(edgeKind, fromKind, fromId, _toKind, _toId, existingCount) {
|
|
1883
1916
|
if (existingCount > 0) {
|
|
1884
|
-
return new
|
|
1917
|
+
return new chunkDIK74MXX_cjs.CardinalityError({
|
|
1885
1918
|
edgeKind,
|
|
1886
1919
|
fromKind,
|
|
1887
1920
|
fromId,
|
|
@@ -1894,7 +1927,7 @@ function checkUniqueEdge(edgeKind, fromKind, fromId, _toKind, _toId, existingCou
|
|
|
1894
1927
|
function validateEdgeEndpoints(edgeKind, fromKind, toKind, registration, registry) {
|
|
1895
1928
|
const validFromKinds = registration.from.map((node) => node.kind);
|
|
1896
1929
|
if (!registry.isAssignableToAny(fromKind, validFromKinds)) {
|
|
1897
|
-
return new
|
|
1930
|
+
return new chunkDIK74MXX_cjs.EndpointError({
|
|
1898
1931
|
edgeKind,
|
|
1899
1932
|
endpoint: "from",
|
|
1900
1933
|
actualKind: fromKind,
|
|
@@ -1903,7 +1936,7 @@ function validateEdgeEndpoints(edgeKind, fromKind, toKind, registration, registr
|
|
|
1903
1936
|
}
|
|
1904
1937
|
const validToKinds = registration.to.map((node) => node.kind);
|
|
1905
1938
|
if (!registry.isAssignableToAny(toKind, validToKinds)) {
|
|
1906
|
-
return new
|
|
1939
|
+
return new chunkDIK74MXX_cjs.EndpointError({
|
|
1907
1940
|
edgeKind,
|
|
1908
1941
|
endpoint: "to",
|
|
1909
1942
|
actualKind: toKind,
|
|
@@ -1915,7 +1948,7 @@ function validateEdgeEndpoints(edgeKind, fromKind, toKind, registration, registr
|
|
|
1915
1948
|
function checkDisjointness(nodeId, nodeKind, existingKinds, registry) {
|
|
1916
1949
|
for (const existingKind of existingKinds) {
|
|
1917
1950
|
if (registry.areDisjoint(nodeKind, existingKind)) {
|
|
1918
|
-
return new
|
|
1951
|
+
return new chunkDIK74MXX_cjs.DisjointError({
|
|
1919
1952
|
nodeId,
|
|
1920
1953
|
attemptedKind: nodeKind,
|
|
1921
1954
|
conflictingKind: existingKind
|
|
@@ -1952,7 +1985,7 @@ async function checkUniquenessConstraints(ctx, kind, id, props, constraints) {
|
|
|
1952
1985
|
key
|
|
1953
1986
|
});
|
|
1954
1987
|
if (existing && existing.node_id !== id) {
|
|
1955
|
-
throw new
|
|
1988
|
+
throw new chunkDIK74MXX_cjs.UniquenessError({
|
|
1956
1989
|
constraintName: constraint.name,
|
|
1957
1990
|
kind: kindToCheck,
|
|
1958
1991
|
existingId: existing.node_id,
|
|
@@ -2058,7 +2091,7 @@ async function updateUniquenessEntries(ctx, kind, id, oldProps, newProps, constr
|
|
|
2058
2091
|
key: newKey
|
|
2059
2092
|
});
|
|
2060
2093
|
if (existing && existing.node_id !== id) {
|
|
2061
|
-
throw new
|
|
2094
|
+
throw new chunkDIK74MXX_cjs.UniquenessError({
|
|
2062
2095
|
constraintName: constraint.name,
|
|
2063
2096
|
kind: kindToCheck,
|
|
2064
2097
|
existingId: existing.node_id,
|
|
@@ -2115,7 +2148,7 @@ async function enforceNodeDeleteBehavior(ctx, args, backend, policy) {
|
|
|
2115
2148
|
if (connectedEdges.length === 0) return;
|
|
2116
2149
|
switch (behavior) {
|
|
2117
2150
|
case "restrict": {
|
|
2118
|
-
throw new
|
|
2151
|
+
throw new chunkDIK74MXX_cjs.RestrictedDeleteError({
|
|
2119
2152
|
nodeKind: args.kind,
|
|
2120
2153
|
nodeId: args.id,
|
|
2121
2154
|
edgeCount: connectedEdges.length,
|
|
@@ -2188,7 +2221,7 @@ async function applyNodeInsertSideEffectsBatch(ctx, items, backend) {
|
|
|
2188
2221
|
);
|
|
2189
2222
|
}
|
|
2190
2223
|
function parseRowProps(row) {
|
|
2191
|
-
return
|
|
2224
|
+
return chunkX4JBT642_cjs.rowPropsToObject(row.props);
|
|
2192
2225
|
}
|
|
2193
2226
|
async function applyNodeUpdate(ctx, args, backend) {
|
|
2194
2227
|
const { kind, id } = args.existing;
|
|
@@ -2379,5 +2412,5 @@ exports.validateEdgeEndpoints = validateEdgeEndpoints;
|
|
|
2379
2412
|
exports.vectorSlotKey = vectorSlotKey;
|
|
2380
2413
|
exports.withRecordedCoordinate = withRecordedCoordinate;
|
|
2381
2414
|
exports.withRecordedFlushObserver = withRecordedFlushObserver;
|
|
2382
|
-
//# sourceMappingURL=chunk-
|
|
2383
|
-
//# sourceMappingURL=chunk-
|
|
2415
|
+
//# sourceMappingURL=chunk-ZUNQ5BEP.cjs.map
|
|
2416
|
+
//# sourceMappingURL=chunk-ZUNQ5BEP.cjs.map
|