@nicia-ai/typegraph 0.28.0 → 0.28.1
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 +55 -55
- package/dist/backend/postgres/index.js +3 -3
- package/dist/backend/sqlite/index.cjs +13 -13
- package/dist/backend/sqlite/index.js +3 -3
- package/dist/backend/sqlite/libsql.cjs +6 -6
- package/dist/backend/sqlite/libsql.js +3 -3
- package/dist/backend/sqlite/local.cjs +6 -6
- package/dist/backend/sqlite/local.js +3 -3
- package/dist/{chunk-X53YKGHR.js → chunk-5MTOKWDA.js} +3 -3
- package/dist/{chunk-X53YKGHR.js.map → chunk-5MTOKWDA.js.map} +1 -1
- package/dist/chunk-FFHW2JEK.cjs +55 -0
- package/dist/chunk-FFHW2JEK.cjs.map +1 -0
- package/dist/{chunk-33K3ZYFG.cjs → chunk-NMOE2ZEU.cjs} +44 -44
- package/dist/{chunk-33K3ZYFG.cjs.map → chunk-NMOE2ZEU.cjs.map} +1 -1
- package/dist/{chunk-2E4VTD2E.cjs → chunk-NYQFPGYP.cjs} +5 -5
- package/dist/{chunk-2E4VTD2E.cjs.map → chunk-NYQFPGYP.cjs.map} +1 -1
- package/dist/chunk-O57GYGYK.js +51 -0
- package/dist/chunk-O57GYGYK.js.map +1 -0
- package/dist/{chunk-UKG7XHZ3.js → chunk-PGU2XKMA.js} +3 -3
- package/dist/{chunk-UKG7XHZ3.js.map → chunk-PGU2XKMA.js.map} +1 -1
- package/dist/{chunk-DFHLG75V.js → chunk-TKM2WDT4.js} +3 -3
- package/dist/{chunk-DFHLG75V.js.map → chunk-TKM2WDT4.js.map} +1 -1
- package/dist/{chunk-ZGEMI7MJ.cjs → chunk-WZH2MKHW.cjs} +15 -15
- package/dist/{chunk-ZGEMI7MJ.cjs.map → chunk-WZH2MKHW.cjs.map} +1 -1
- package/dist/index.cjs +64 -64
- package/dist/index.js +3 -3
- package/dist/schema/index.cjs +26 -26
- package/dist/schema/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-5H3BAMTB.js +0 -32
- package/dist/chunk-5H3BAMTB.js.map +0 -1
- package/dist/chunk-IUIWCFG3.cjs +0 -36
- package/dist/chunk-IUIWCFG3.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkHTGDWIDE_cjs = require('./chunk-HTGDWIDE.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkWZH2MKHW_cjs = require('./chunk-WZH2MKHW.cjs');
|
|
5
5
|
var chunkWFUN6DCM_cjs = require('./chunk-WFUN6DCM.cjs');
|
|
6
6
|
var chunk4FJVSF3K_cjs = require('./chunk-4FJVSF3K.cjs');
|
|
7
7
|
var chunkPYJOBZR3_cjs = require('./chunk-PYJOBZR3.cjs');
|
|
8
8
|
var chunkLYRUNG6E_cjs = require('./chunk-LYRUNG6E.cjs');
|
|
9
|
-
var
|
|
9
|
+
var chunkFFHW2JEK_cjs = require('./chunk-FFHW2JEK.cjs');
|
|
10
10
|
var chunkPN37HVAV_cjs = require('./chunk-PN37HVAV.cjs');
|
|
11
11
|
var chunkCTHNVU6K_cjs = require('./chunk-CTHNVU6K.cjs');
|
|
12
12
|
var chunkEK6RJ373_cjs = require('./chunk-EK6RJ373.cjs');
|
|
@@ -28,7 +28,7 @@ function metaEdge(name, options = {}) {
|
|
|
28
28
|
description: options.description
|
|
29
29
|
};
|
|
30
30
|
return Object.freeze({
|
|
31
|
-
[
|
|
31
|
+
[chunkWZH2MKHW_cjs.META_EDGE_BRAND]: true,
|
|
32
32
|
name,
|
|
33
33
|
properties
|
|
34
34
|
});
|
|
@@ -4281,7 +4281,7 @@ function classifyUnique(kind, existing, next, recorders) {
|
|
|
4281
4281
|
if (newOne === void 0) continue;
|
|
4282
4282
|
const { name: _existingName, ...existingShape } = constraint;
|
|
4283
4283
|
const { name: _nextName, ...nextShape } = newOne;
|
|
4284
|
-
if (!
|
|
4284
|
+
if (!chunkFFHW2JEK_cjs.canonicalEqual(existingShape, nextShape)) {
|
|
4285
4285
|
recorders.recordRequireEmpty({
|
|
4286
4286
|
kind,
|
|
4287
4287
|
type: "ADD_UNIQUE_ON_POPULATED",
|
|
@@ -4298,7 +4298,7 @@ function planRemovals(graph, names) {
|
|
|
4298
4298
|
if (namesSet.size === 0) {
|
|
4299
4299
|
return { document, removedNodeKinds: [], removedEdgeKinds: [] };
|
|
4300
4300
|
}
|
|
4301
|
-
const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } =
|
|
4301
|
+
const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } = chunkWZH2MKHW_cjs.extensionKindNames(document);
|
|
4302
4302
|
const compileTimeNodeNames = new Set(
|
|
4303
4303
|
Object.keys(graph.nodes).filter((name) => !runtimeNodeNames.has(name))
|
|
4304
4304
|
);
|
|
@@ -4398,8 +4398,8 @@ function planRemovals(graph, names) {
|
|
|
4398
4398
|
function stripGraphExtension(graph) {
|
|
4399
4399
|
const document = graph.extension;
|
|
4400
4400
|
if (document === void 0) return graph;
|
|
4401
|
-
const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } =
|
|
4402
|
-
const runtimeOntologyKeys =
|
|
4401
|
+
const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } = chunkWZH2MKHW_cjs.extensionKindNames(document);
|
|
4402
|
+
const runtimeOntologyKeys = chunkWZH2MKHW_cjs.buildGraphExtensionOntologyKeySet(document);
|
|
4403
4403
|
const compileNodes = {};
|
|
4404
4404
|
for (const [name, registration] of Object.entries(graph.nodes)) {
|
|
4405
4405
|
if (runtimeNodeNames.has(name)) continue;
|
|
@@ -4411,7 +4411,7 @@ function stripGraphExtension(graph) {
|
|
|
4411
4411
|
compileEdges[name] = registration;
|
|
4412
4412
|
}
|
|
4413
4413
|
const compileOntology = graph.ontology.filter(
|
|
4414
|
-
(relation) => !runtimeOntologyKeys.has(
|
|
4414
|
+
(relation) => !runtimeOntologyKeys.has(chunkWZH2MKHW_cjs.compileTimeOntologyKey(relation))
|
|
4415
4415
|
);
|
|
4416
4416
|
const compileIndexes = (graph.indexes ?? []).filter(
|
|
4417
4417
|
(index) => index.origin !== "runtime"
|
|
@@ -4451,13 +4451,13 @@ function buildCompileTimeReferentIndex(graph, runtimeEdgeNames) {
|
|
|
4451
4451
|
append(endpoint.kind, referent);
|
|
4452
4452
|
}
|
|
4453
4453
|
}
|
|
4454
|
-
const runtimeOntologyKeys =
|
|
4454
|
+
const runtimeOntologyKeys = chunkWZH2MKHW_cjs.buildGraphExtensionOntologyKeySet(
|
|
4455
4455
|
graph.extension
|
|
4456
4456
|
);
|
|
4457
4457
|
for (const relation of graph.ontology) {
|
|
4458
|
-
if (runtimeOntologyKeys.has(
|
|
4459
|
-
const fromName =
|
|
4460
|
-
const toName =
|
|
4458
|
+
if (runtimeOntologyKeys.has(chunkWZH2MKHW_cjs.compileTimeOntologyKey(relation))) continue;
|
|
4459
|
+
const fromName = chunkWZH2MKHW_cjs.getTypeName(relation.from);
|
|
4460
|
+
const toName = chunkWZH2MKHW_cjs.getTypeName(relation.to);
|
|
4461
4461
|
const referent = {
|
|
4462
4462
|
type: "compile-time-ontology",
|
|
4463
4463
|
name: `${relation.metaEdge.name}(${fromName}, ${toName})`
|
|
@@ -9996,8 +9996,8 @@ function createQueryBuilder(graphId, registry, options) {
|
|
|
9996
9996
|
function buildKindRegistry(graph) {
|
|
9997
9997
|
const nodeTypes = extractNodeTypes(graph);
|
|
9998
9998
|
const edgeTypes = extractEdgeTypes(graph);
|
|
9999
|
-
const closures = graph.ontology.length > 0 ?
|
|
10000
|
-
return new
|
|
9999
|
+
const closures = graph.ontology.length > 0 ? chunkWZH2MKHW_cjs.computeClosuresFromOntology(graph.ontology) : chunkWZH2MKHW_cjs.createEmptyClosures();
|
|
10000
|
+
return new chunkWZH2MKHW_cjs.KindRegistry(nodeTypes, edgeTypes, closures);
|
|
10001
10001
|
}
|
|
10002
10002
|
function extractNodeTypes(graph) {
|
|
10003
10003
|
const result = /* @__PURE__ */ new Map();
|
|
@@ -10992,7 +10992,7 @@ function createEdgeCollectionsProxy(graph, graphId, registry, backend, operation
|
|
|
10992
10992
|
// src/store/introspect.ts
|
|
10993
10993
|
function introspectSchema(graph, context) {
|
|
10994
10994
|
const extension = graph.extension;
|
|
10995
|
-
const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } =
|
|
10995
|
+
const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } = chunkWZH2MKHW_cjs.extensionKindNames(extension);
|
|
10996
10996
|
const deprecated = graph.deprecatedKinds;
|
|
10997
10997
|
const kinds = [];
|
|
10998
10998
|
for (const [name, registration] of Object.entries(graph.nodes)) {
|
|
@@ -11003,7 +11003,7 @@ function introspectSchema(graph, context) {
|
|
|
11003
11003
|
description: reg.type.description,
|
|
11004
11004
|
annotations: reg.type.annotations,
|
|
11005
11005
|
deprecated: deprecated.has(name),
|
|
11006
|
-
properties:
|
|
11006
|
+
properties: chunkWZH2MKHW_cjs.serializeSchemaProperties(reg.type.schema),
|
|
11007
11007
|
unique: (reg.unique ?? []).map((constraint) => ({
|
|
11008
11008
|
name: constraint.name,
|
|
11009
11009
|
fields: [...constraint.fields],
|
|
@@ -11024,17 +11024,17 @@ function introspectSchema(graph, context) {
|
|
|
11024
11024
|
to: reg.to.map((entry2) => entry2.kind),
|
|
11025
11025
|
cardinality: reg.cardinality ?? "many",
|
|
11026
11026
|
endpointExistence: reg.endpointExistence ?? "notDeleted",
|
|
11027
|
-
properties:
|
|
11027
|
+
properties: chunkWZH2MKHW_cjs.serializeSchemaProperties(edgeType.schema),
|
|
11028
11028
|
annotations: edgeType.annotations,
|
|
11029
11029
|
deprecated: deprecated.has(name)
|
|
11030
11030
|
});
|
|
11031
11031
|
}
|
|
11032
|
-
const runtimeOntologyKeys =
|
|
11032
|
+
const runtimeOntologyKeys = chunkWZH2MKHW_cjs.buildGraphExtensionOntologyKeySet(extension);
|
|
11033
11033
|
const ontology = graph.ontology.map((relation) => ({
|
|
11034
11034
|
metaEdge: relation.metaEdge.name,
|
|
11035
|
-
from:
|
|
11036
|
-
to:
|
|
11037
|
-
origin: runtimeOntologyKeys.has(
|
|
11035
|
+
from: chunkWZH2MKHW_cjs.getTypeName(relation.from),
|
|
11036
|
+
to: chunkWZH2MKHW_cjs.getTypeName(relation.to),
|
|
11037
|
+
origin: runtimeOntologyKeys.has(chunkWZH2MKHW_cjs.compileTimeOntologyKey(relation)) ? "runtime" : "compile-time"
|
|
11038
11038
|
}));
|
|
11039
11039
|
return {
|
|
11040
11040
|
graphId: context.graphId,
|
|
@@ -11361,7 +11361,7 @@ function buildAttempt(args) {
|
|
|
11361
11361
|
}
|
|
11362
11362
|
async function computeIndexSignature(dialect, targetTableName, declaration) {
|
|
11363
11363
|
const hashable = { dialect, targetTableName, declaration };
|
|
11364
|
-
const json = JSON.stringify(hashable,
|
|
11364
|
+
const json = JSON.stringify(hashable, chunkFFHW2JEK_cjs.sortedReplacer);
|
|
11365
11365
|
return chunkCTHNVU6K_cjs.sha256Hex(json, 16);
|
|
11366
11366
|
}
|
|
11367
11367
|
|
|
@@ -11429,14 +11429,14 @@ async function reconcilePendingRemovals(context) {
|
|
|
11429
11429
|
const reconciliations = [];
|
|
11430
11430
|
const stopAtVersion = marker ?? 1;
|
|
11431
11431
|
let currentRow = activeRow;
|
|
11432
|
-
let currentSchema =
|
|
11432
|
+
let currentSchema = chunkWZH2MKHW_cjs.parseSerializedSchema(activeRow.schema_doc);
|
|
11433
11433
|
while (currentRow.version > stopAtVersion) {
|
|
11434
11434
|
const priorRow = await backend.getSchemaVersion(
|
|
11435
11435
|
graphId,
|
|
11436
11436
|
currentRow.version - 1
|
|
11437
11437
|
);
|
|
11438
11438
|
if (priorRow === void 0) break;
|
|
11439
|
-
const priorSchema =
|
|
11439
|
+
const priorSchema = chunkWZH2MKHW_cjs.parseSerializedSchema(priorRow.schema_doc);
|
|
11440
11440
|
for (const entity of ENTITY_KINDS) {
|
|
11441
11441
|
const priorEntries = priorSchema[entity === "node" ? "nodes" : "edges"];
|
|
11442
11442
|
const currentEntries = currentSchema[entity === "node" ? "nodes" : "edges"];
|
|
@@ -11952,7 +11952,7 @@ async function validateAndPrepareEdgeCreate(ctx, input, id, backend) {
|
|
|
11952
11952
|
nodeId: input.toId
|
|
11953
11953
|
});
|
|
11954
11954
|
}
|
|
11955
|
-
const validatedProps =
|
|
11955
|
+
const validatedProps = chunkWZH2MKHW_cjs.validateEdgeProps(edgeKind.schema, input.props, {
|
|
11956
11956
|
kind,
|
|
11957
11957
|
operation: "create"
|
|
11958
11958
|
});
|
|
@@ -12102,7 +12102,7 @@ async function executeEdgeUpdate(ctx, input, backend) {
|
|
|
12102
12102
|
const edgeKind = registration.type;
|
|
12103
12103
|
const existingProps = JSON.parse(existing.props);
|
|
12104
12104
|
const mergedProps = { ...existingProps, ...input.props };
|
|
12105
|
-
const validatedProps =
|
|
12105
|
+
const validatedProps = chunkWZH2MKHW_cjs.validateEdgeProps(edgeKind.schema, mergedProps, {
|
|
12106
12106
|
kind: existing.kind,
|
|
12107
12107
|
operation: "update",
|
|
12108
12108
|
id
|
|
@@ -12128,7 +12128,7 @@ async function executeEdgeUpsertUpdate(ctx, input, backend, options) {
|
|
|
12128
12128
|
const edgeKind = registration.type;
|
|
12129
12129
|
const existingProps = JSON.parse(existing.props);
|
|
12130
12130
|
const mergedProps = { ...existingProps, ...input.props };
|
|
12131
|
-
const validatedProps =
|
|
12131
|
+
const validatedProps = chunkWZH2MKHW_cjs.validateEdgeProps(edgeKind.schema, mergedProps, {
|
|
12132
12132
|
kind: existing.kind,
|
|
12133
12133
|
operation: "update",
|
|
12134
12134
|
id
|
|
@@ -12285,7 +12285,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
|
|
|
12285
12285
|
const matchOn = options?.matchOn ?? [];
|
|
12286
12286
|
const registration = getEdgeRegistration(ctx.graph, kind);
|
|
12287
12287
|
const edgeKind = registration.type;
|
|
12288
|
-
const validatedProps =
|
|
12288
|
+
const validatedProps = chunkWZH2MKHW_cjs.validateEdgeProps(edgeKind.schema, props, {
|
|
12289
12289
|
kind,
|
|
12290
12290
|
operation: "create"
|
|
12291
12291
|
});
|
|
@@ -12367,7 +12367,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
12367
12367
|
validateMatchOnFields(edgeKind.schema, matchOn, kind);
|
|
12368
12368
|
const validated = [];
|
|
12369
12369
|
for (const item of items) {
|
|
12370
|
-
const validatedProps =
|
|
12370
|
+
const validatedProps = chunkWZH2MKHW_cjs.validateEdgeProps(edgeKind.schema, item.props, {
|
|
12371
12371
|
kind,
|
|
12372
12372
|
operation: "create"
|
|
12373
12373
|
});
|
|
@@ -13014,7 +13014,7 @@ async function validateAndPrepareNodeCreate(ctx, input, id, backend) {
|
|
|
13014
13014
|
const kind = input.kind;
|
|
13015
13015
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
13016
13016
|
const nodeKind = registration.type;
|
|
13017
|
-
const validatedProps =
|
|
13017
|
+
const validatedProps = chunkWZH2MKHW_cjs.validateNodeProps(nodeKind.schema, input.props, {
|
|
13018
13018
|
kind,
|
|
13019
13019
|
operation: "create"
|
|
13020
13020
|
});
|
|
@@ -13088,7 +13088,7 @@ async function performNodeUpdate(ctx, input, backend, options) {
|
|
|
13088
13088
|
const existingProps = JSON.parse(existing.props);
|
|
13089
13089
|
const mergedProps = { ...existingProps, ...input.props };
|
|
13090
13090
|
const nodeKind = registration.type;
|
|
13091
|
-
const validatedProps =
|
|
13091
|
+
const validatedProps = chunkWZH2MKHW_cjs.validateNodeProps(nodeKind.schema, mergedProps, {
|
|
13092
13092
|
kind,
|
|
13093
13093
|
operation: "update",
|
|
13094
13094
|
id
|
|
@@ -13361,7 +13361,7 @@ async function executeNodeGetOrCreateByConstraint(ctx, kind, constraintName, pro
|
|
|
13361
13361
|
const ifExists = options?.ifExists ?? "return";
|
|
13362
13362
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
13363
13363
|
const nodeKind = registration.type;
|
|
13364
|
-
const validatedProps =
|
|
13364
|
+
const validatedProps = chunkWZH2MKHW_cjs.validateNodeProps(nodeKind.schema, props, {
|
|
13365
13365
|
kind,
|
|
13366
13366
|
operation: "create"
|
|
13367
13367
|
});
|
|
@@ -13433,7 +13433,7 @@ async function executeNodeGetOrCreateByConstraint(ctx, kind, constraintName, pro
|
|
|
13433
13433
|
async function executeNodeFindByConstraint(ctx, kind, constraintName, props, backend) {
|
|
13434
13434
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
13435
13435
|
const nodeKind = registration.type;
|
|
13436
|
-
const validatedProps =
|
|
13436
|
+
const validatedProps = chunkWZH2MKHW_cjs.validateNodeProps(nodeKind.schema, props, {
|
|
13437
13437
|
kind,
|
|
13438
13438
|
operation: "create"
|
|
13439
13439
|
});
|
|
@@ -13470,7 +13470,7 @@ async function executeNodeFindByConstraint(ctx, kind, constraintName, props, bac
|
|
|
13470
13470
|
function validateAndComputeKeys(nodeKind, kind, constraint, items) {
|
|
13471
13471
|
const validated = [];
|
|
13472
13472
|
for (const item of items) {
|
|
13473
|
-
const validatedProps =
|
|
13473
|
+
const validatedProps = chunkWZH2MKHW_cjs.validateNodeProps(nodeKind.schema, item.props, {
|
|
13474
13474
|
kind,
|
|
13475
13475
|
operation: "create"
|
|
13476
13476
|
});
|
|
@@ -14994,7 +14994,7 @@ var Store = class _Store {
|
|
|
14994
14994
|
*/
|
|
14995
14995
|
async evolve(extension, options) {
|
|
14996
14996
|
const { activeRow, baseline } = await this.#loadCaughtUp("evolve");
|
|
14997
|
-
const merged =
|
|
14997
|
+
const merged = chunkWZH2MKHW_cjs.mergeGraphExtension(baseline, extension);
|
|
14998
14998
|
if (merged === baseline) {
|
|
14999
14999
|
if (baseline === this.#graph) {
|
|
15000
15000
|
if (options?.ref !== void 0) options.ref.current = this;
|
|
@@ -15030,7 +15030,7 @@ var Store = class _Store {
|
|
|
15030
15030
|
);
|
|
15031
15031
|
if (error !== void 0) throw error;
|
|
15032
15032
|
}
|
|
15033
|
-
const committed = await
|
|
15033
|
+
const committed = await chunkWZH2MKHW_cjs.commitNewSchemaVersion(
|
|
15034
15034
|
this.#backend,
|
|
15035
15035
|
merged,
|
|
15036
15036
|
activeRow.version
|
|
@@ -15182,9 +15182,9 @@ var Store = class _Store {
|
|
|
15182
15182
|
);
|
|
15183
15183
|
}
|
|
15184
15184
|
const compileTimeGraph = stripGraphExtension(this.#graph);
|
|
15185
|
-
const merged = plan.document === void 0 ? compileTimeGraph :
|
|
15186
|
-
const finalGraph =
|
|
15187
|
-
const committedRow = await
|
|
15185
|
+
const merged = plan.document === void 0 ? compileTimeGraph : chunkWZH2MKHW_cjs.mergeGraphExtension(compileTimeGraph, plan.document);
|
|
15186
|
+
const finalGraph = chunkWZH2MKHW_cjs.applyDeprecatedKinds(merged, baseline.deprecatedKinds);
|
|
15187
|
+
const committedRow = await chunkWZH2MKHW_cjs.commitNewSchemaVersion(
|
|
15188
15188
|
this.#backend,
|
|
15189
15189
|
finalGraph,
|
|
15190
15190
|
activeRow.version
|
|
@@ -15267,8 +15267,8 @@ var Store = class _Store {
|
|
|
15267
15267
|
schemaMetadataFromRow(activeRow)
|
|
15268
15268
|
);
|
|
15269
15269
|
}
|
|
15270
|
-
const merged =
|
|
15271
|
-
const result = await
|
|
15270
|
+
const merged = chunkWZH2MKHW_cjs.applyDeprecatedKinds(baseline, nextSet);
|
|
15271
|
+
const result = await chunkWZH2MKHW_cjs.ensureSchema(this.#backend, merged, {
|
|
15272
15272
|
preloaded: { activeRow, storedSchema },
|
|
15273
15273
|
autoMigrate: true
|
|
15274
15274
|
});
|
|
@@ -15277,8 +15277,8 @@ var Store = class _Store {
|
|
|
15277
15277
|
}
|
|
15278
15278
|
#catchUpToStored(storedSchema) {
|
|
15279
15279
|
const compileTimeGraph = stripGraphExtension(this.#graph);
|
|
15280
|
-
const withGraphExtension = storedSchema.extension === void 0 ? compileTimeGraph :
|
|
15281
|
-
return
|
|
15280
|
+
const withGraphExtension = storedSchema.extension === void 0 ? compileTimeGraph : chunkWZH2MKHW_cjs.mergeGraphExtension(compileTimeGraph, storedSchema.extension);
|
|
15281
|
+
return chunkWZH2MKHW_cjs.applyDeprecatedKinds(
|
|
15282
15282
|
withGraphExtension,
|
|
15283
15283
|
storedSchema.deprecatedKinds
|
|
15284
15284
|
);
|
|
@@ -15296,7 +15296,7 @@ var Store = class _Store {
|
|
|
15296
15296
|
* serializes the actual commit.
|
|
15297
15297
|
*/
|
|
15298
15298
|
async #loadCaughtUp(verb) {
|
|
15299
|
-
const activeRow = await
|
|
15299
|
+
const activeRow = await chunkWZH2MKHW_cjs.loadActiveSchemaWithBootstrap(
|
|
15300
15300
|
this.#backend,
|
|
15301
15301
|
this.graphId
|
|
15302
15302
|
);
|
|
@@ -15307,7 +15307,7 @@ var Store = class _Store {
|
|
|
15307
15307
|
{ code }
|
|
15308
15308
|
);
|
|
15309
15309
|
}
|
|
15310
|
-
const storedSchema =
|
|
15310
|
+
const storedSchema = chunkWZH2MKHW_cjs.parseSerializedSchema(activeRow.schema_doc);
|
|
15311
15311
|
const baseline = this.#catchUpToStored(storedSchema);
|
|
15312
15312
|
return { activeRow, storedSchema, baseline };
|
|
15313
15313
|
}
|
|
@@ -15485,8 +15485,8 @@ async function createStoreWithSchema(graph, backend, options) {
|
|
|
15485
15485
|
graph: merged,
|
|
15486
15486
|
activeRow,
|
|
15487
15487
|
storedSchema
|
|
15488
|
-
} = await
|
|
15489
|
-
const result = await
|
|
15488
|
+
} = await chunkWZH2MKHW_cjs.loadAndMergeGraphExtensionDocument(backend, graph);
|
|
15489
|
+
const result = await chunkWZH2MKHW_cjs.ensureSchema(backend, merged, {
|
|
15490
15490
|
...options,
|
|
15491
15491
|
preloaded: { activeRow, storedSchema }
|
|
15492
15492
|
});
|
|
@@ -15504,7 +15504,7 @@ async function createVerifiedStore(graph, backend, options) {
|
|
|
15504
15504
|
graph: merged,
|
|
15505
15505
|
activeRow,
|
|
15506
15506
|
result
|
|
15507
|
-
} = await
|
|
15507
|
+
} = await chunkWZH2MKHW_cjs.loadAndVerifyGraph(backend, graph);
|
|
15508
15508
|
const store = new Store(
|
|
15509
15509
|
merged,
|
|
15510
15510
|
backend,
|
|
@@ -15516,67 +15516,67 @@ async function createVerifiedStore(graph, backend, options) {
|
|
|
15516
15516
|
|
|
15517
15517
|
Object.defineProperty(exports, "broader", {
|
|
15518
15518
|
enumerable: true,
|
|
15519
|
-
get: function () { return
|
|
15519
|
+
get: function () { return chunkWZH2MKHW_cjs.broader; }
|
|
15520
15520
|
});
|
|
15521
15521
|
Object.defineProperty(exports, "core", {
|
|
15522
15522
|
enumerable: true,
|
|
15523
|
-
get: function () { return
|
|
15523
|
+
get: function () { return chunkWZH2MKHW_cjs.core; }
|
|
15524
15524
|
});
|
|
15525
15525
|
Object.defineProperty(exports, "defineEdge", {
|
|
15526
15526
|
enumerable: true,
|
|
15527
|
-
get: function () { return
|
|
15527
|
+
get: function () { return chunkWZH2MKHW_cjs.defineEdge; }
|
|
15528
15528
|
});
|
|
15529
15529
|
Object.defineProperty(exports, "defineNode", {
|
|
15530
15530
|
enumerable: true,
|
|
15531
|
-
get: function () { return
|
|
15531
|
+
get: function () { return chunkWZH2MKHW_cjs.defineNode; }
|
|
15532
15532
|
});
|
|
15533
15533
|
Object.defineProperty(exports, "differentFrom", {
|
|
15534
15534
|
enumerable: true,
|
|
15535
|
-
get: function () { return
|
|
15535
|
+
get: function () { return chunkWZH2MKHW_cjs.differentFrom; }
|
|
15536
15536
|
});
|
|
15537
15537
|
Object.defineProperty(exports, "disjointWith", {
|
|
15538
15538
|
enumerable: true,
|
|
15539
|
-
get: function () { return
|
|
15539
|
+
get: function () { return chunkWZH2MKHW_cjs.disjointWith; }
|
|
15540
15540
|
});
|
|
15541
15541
|
Object.defineProperty(exports, "equivalentTo", {
|
|
15542
15542
|
enumerable: true,
|
|
15543
|
-
get: function () { return
|
|
15543
|
+
get: function () { return chunkWZH2MKHW_cjs.equivalentTo; }
|
|
15544
15544
|
});
|
|
15545
15545
|
Object.defineProperty(exports, "hasPart", {
|
|
15546
15546
|
enumerable: true,
|
|
15547
|
-
get: function () { return
|
|
15547
|
+
get: function () { return chunkWZH2MKHW_cjs.hasPart; }
|
|
15548
15548
|
});
|
|
15549
15549
|
Object.defineProperty(exports, "implies", {
|
|
15550
15550
|
enumerable: true,
|
|
15551
|
-
get: function () { return
|
|
15551
|
+
get: function () { return chunkWZH2MKHW_cjs.implies; }
|
|
15552
15552
|
});
|
|
15553
15553
|
Object.defineProperty(exports, "inverseOf", {
|
|
15554
15554
|
enumerable: true,
|
|
15555
|
-
get: function () { return
|
|
15555
|
+
get: function () { return chunkWZH2MKHW_cjs.inverseOf; }
|
|
15556
15556
|
});
|
|
15557
15557
|
Object.defineProperty(exports, "isMetaEdge", {
|
|
15558
15558
|
enumerable: true,
|
|
15559
|
-
get: function () { return
|
|
15559
|
+
get: function () { return chunkWZH2MKHW_cjs.isMetaEdge; }
|
|
15560
15560
|
});
|
|
15561
15561
|
Object.defineProperty(exports, "narrower", {
|
|
15562
15562
|
enumerable: true,
|
|
15563
|
-
get: function () { return
|
|
15563
|
+
get: function () { return chunkWZH2MKHW_cjs.narrower; }
|
|
15564
15564
|
});
|
|
15565
15565
|
Object.defineProperty(exports, "partOf", {
|
|
15566
15566
|
enumerable: true,
|
|
15567
|
-
get: function () { return
|
|
15567
|
+
get: function () { return chunkWZH2MKHW_cjs.partOf; }
|
|
15568
15568
|
});
|
|
15569
15569
|
Object.defineProperty(exports, "relatedTo", {
|
|
15570
15570
|
enumerable: true,
|
|
15571
|
-
get: function () { return
|
|
15571
|
+
get: function () { return chunkWZH2MKHW_cjs.relatedTo; }
|
|
15572
15572
|
});
|
|
15573
15573
|
Object.defineProperty(exports, "sameAs", {
|
|
15574
15574
|
enumerable: true,
|
|
15575
|
-
get: function () { return
|
|
15575
|
+
get: function () { return chunkWZH2MKHW_cjs.sameAs; }
|
|
15576
15576
|
});
|
|
15577
15577
|
Object.defineProperty(exports, "subClassOf", {
|
|
15578
15578
|
enumerable: true,
|
|
15579
|
-
get: function () { return
|
|
15579
|
+
get: function () { return chunkWZH2MKHW_cjs.subClassOf; }
|
|
15580
15580
|
});
|
|
15581
15581
|
Object.defineProperty(exports, "defineGraph", {
|
|
15582
15582
|
enumerable: true,
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { quoteIdentifier, EMPTY_REQUIRED_COLUMNS, addRequiredColumn, markSelectiveFieldAsRequired, markFieldRefAsRequired, NODE_COLUMNS, shouldProjectColumn, mapSelectiveSystemFieldToColumn, isIdFieldRef, isAggregateExpr, EDGE_COLUMNS } from './chunk-3EUKJEQ3.js';
|
|
2
|
-
import { META_EDGE_BRAND, loadAndMergeGraphExtensionDocument, ensureSchema, loadAndVerifyGraph, mergeGraphExtension, commitNewSchemaVersion, applyDeprecatedKinds, loadActiveSchemaWithBootstrap, parseSerializedSchema, computeClosuresFromOntology, createEmptyClosures, KindRegistry, extensionKindNames, serializeSchemaProperties, buildGraphExtensionOntologyKeySet, compileTimeOntologyKey, getTypeName, validateNodeProps, validateEdgeProps } from './chunk-
|
|
3
|
-
export { broader, core, defineEdge, defineNode, differentFrom, disjointWith, equivalentTo, hasPart, implies, inverseOf, isMetaEdge, narrower, partOf, relatedTo, sameAs, subClassOf } from './chunk-
|
|
2
|
+
import { META_EDGE_BRAND, loadAndMergeGraphExtensionDocument, ensureSchema, loadAndVerifyGraph, mergeGraphExtension, commitNewSchemaVersion, applyDeprecatedKinds, loadActiveSchemaWithBootstrap, parseSerializedSchema, computeClosuresFromOntology, createEmptyClosures, KindRegistry, extensionKindNames, serializeSchemaProperties, buildGraphExtensionOntologyKeySet, compileTimeOntologyKey, getTypeName, validateNodeProps, validateEdgeProps } from './chunk-5MTOKWDA.js';
|
|
3
|
+
export { broader, core, defineEdge, defineNode, differentFrom, disjointWith, equivalentTo, hasPart, implies, inverseOf, isMetaEdge, narrower, partOf, relatedTo, sameAs, subClassOf } from './chunk-5MTOKWDA.js';
|
|
4
4
|
import { nowIso, isKnownKind, validateOptionalIsoDate, getNodeKinds, getEdgeKinds } from './chunk-OYLF3IC7.js';
|
|
5
5
|
export { defineGraph, getEdgeKinds, getNodeKinds, isEdgeType, isEdgeTypeWithEndpoints, isGraphDef, isNodeType } from './chunk-OYLF3IC7.js';
|
|
6
6
|
export { defineGraphExtension } from './chunk-E5ROA3MN.js';
|
|
7
7
|
import { IncompatibleChangeError, filterReservedKeys, RESERVED_NODE_KEYS, RESERVED_EDGE_KEYS, RemoveCompileTimeKindError, KindHasReferentsError, validateProjectionField } from './chunk-TSGBRPNE.js';
|
|
8
8
|
export { CURRENT_GRAPH_EXTENSION_VERSION, GraphExtensionError, GraphExtensionUnresolvedEndpointError, GraphExtensionValidationError, GraphExtensionVersionUnsupportedError, IncompatibleChangeError, KindCollisionError, KindHasReferentsError, LEGACY_GRAPH_EXTENSION_VERSION, RemoveCompileTimeKindError, validateGraphExtension } from './chunk-TSGBRPNE.js';
|
|
9
9
|
import { runOptionallyInTransaction } from './chunk-PCHTTG42.js';
|
|
10
|
-
import { canonicalEqual, sortedReplacer } from './chunk-
|
|
10
|
+
import { canonicalEqual, sortedReplacer } from './chunk-O57GYGYK.js';
|
|
11
11
|
import { getDialect, generateIndexDDL } from './chunk-ZTREJOGB.js';
|
|
12
12
|
export { andWhere, fts5Strategy, notWhere, orWhere, tsvectorStrategy } from './chunk-ZTREJOGB.js';
|
|
13
13
|
import { MAX_PG_IDENTIFIER_LENGTH, DEFAULT_PAGINATION_LIMIT, DEFAULT_STREAM_BATCH_SIZE, NODE_META_KEYS, EDGE_META_KEYS, SQLITE_PATH_DELIMITER, PG_ARRAY_START, PG_ARRAY_END, PG_PATH_ELEMENT_SEPARATOR, fnv1aBase36, sha256Hex } from './chunk-EJCDOA37.js';
|
package/dist/schema/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkWZH2MKHW_cjs = require('../chunk-WZH2MKHW.cjs');
|
|
4
4
|
require('../chunk-WFUN6DCM.cjs');
|
|
5
5
|
require('../chunk-PYJOBZR3.cjs');
|
|
6
|
-
require('../chunk-
|
|
6
|
+
require('../chunk-FFHW2JEK.cjs');
|
|
7
7
|
require('../chunk-CTHNVU6K.cjs');
|
|
8
8
|
require('../chunk-EK6RJ373.cjs');
|
|
9
9
|
require('../chunk-X3244EKP.cjs');
|
|
@@ -48,7 +48,7 @@ function buildRegistryFromClosures(schema) {
|
|
|
48
48
|
const edgeImplyingClosure = recordToMap(closures.edgeImplyingClosure);
|
|
49
49
|
const nodeKinds = /* @__PURE__ */ new Map();
|
|
50
50
|
const edgeKinds = /* @__PURE__ */ new Map();
|
|
51
|
-
return new
|
|
51
|
+
return new chunkWZH2MKHW_cjs.KindRegistry(nodeKinds, edgeKinds, {
|
|
52
52
|
subClassAncestors,
|
|
53
53
|
subClassDescendants,
|
|
54
54
|
broaderClosure,
|
|
@@ -76,95 +76,95 @@ function simpleRecordToMap(record) {
|
|
|
76
76
|
|
|
77
77
|
Object.defineProperty(exports, "applyDeprecatedKinds", {
|
|
78
78
|
enumerable: true,
|
|
79
|
-
get: function () { return
|
|
79
|
+
get: function () { return chunkWZH2MKHW_cjs.applyDeprecatedKinds; }
|
|
80
80
|
});
|
|
81
81
|
Object.defineProperty(exports, "assertSchemaCurrent", {
|
|
82
82
|
enumerable: true,
|
|
83
|
-
get: function () { return
|
|
83
|
+
get: function () { return chunkWZH2MKHW_cjs.assertSchemaCurrent; }
|
|
84
84
|
});
|
|
85
85
|
Object.defineProperty(exports, "computeSchemaDiff", {
|
|
86
86
|
enumerable: true,
|
|
87
|
-
get: function () { return
|
|
87
|
+
get: function () { return chunkWZH2MKHW_cjs.computeSchemaDiff; }
|
|
88
88
|
});
|
|
89
89
|
Object.defineProperty(exports, "computeSchemaHash", {
|
|
90
90
|
enumerable: true,
|
|
91
|
-
get: function () { return
|
|
91
|
+
get: function () { return chunkWZH2MKHW_cjs.computeSchemaHash; }
|
|
92
92
|
});
|
|
93
93
|
Object.defineProperty(exports, "createValidationError", {
|
|
94
94
|
enumerable: true,
|
|
95
|
-
get: function () { return
|
|
95
|
+
get: function () { return chunkWZH2MKHW_cjs.createValidationError; }
|
|
96
96
|
});
|
|
97
97
|
Object.defineProperty(exports, "deserializeWherePredicate", {
|
|
98
98
|
enumerable: true,
|
|
99
|
-
get: function () { return
|
|
99
|
+
get: function () { return chunkWZH2MKHW_cjs.deserializeWherePredicate; }
|
|
100
100
|
});
|
|
101
101
|
Object.defineProperty(exports, "ensureSchema", {
|
|
102
102
|
enumerable: true,
|
|
103
|
-
get: function () { return
|
|
103
|
+
get: function () { return chunkWZH2MKHW_cjs.ensureSchema; }
|
|
104
104
|
});
|
|
105
105
|
Object.defineProperty(exports, "getActiveSchema", {
|
|
106
106
|
enumerable: true,
|
|
107
|
-
get: function () { return
|
|
107
|
+
get: function () { return chunkWZH2MKHW_cjs.getActiveSchema; }
|
|
108
108
|
});
|
|
109
109
|
Object.defineProperty(exports, "getMigrationActions", {
|
|
110
110
|
enumerable: true,
|
|
111
|
-
get: function () { return
|
|
111
|
+
get: function () { return chunkWZH2MKHW_cjs.getMigrationActions; }
|
|
112
112
|
});
|
|
113
113
|
Object.defineProperty(exports, "getSchemaChanges", {
|
|
114
114
|
enumerable: true,
|
|
115
|
-
get: function () { return
|
|
115
|
+
get: function () { return chunkWZH2MKHW_cjs.getSchemaChanges; }
|
|
116
116
|
});
|
|
117
117
|
Object.defineProperty(exports, "initializeSchema", {
|
|
118
118
|
enumerable: true,
|
|
119
|
-
get: function () { return
|
|
119
|
+
get: function () { return chunkWZH2MKHW_cjs.initializeSchema; }
|
|
120
120
|
});
|
|
121
121
|
Object.defineProperty(exports, "isBackwardsCompatible", {
|
|
122
122
|
enumerable: true,
|
|
123
|
-
get: function () { return
|
|
123
|
+
get: function () { return chunkWZH2MKHW_cjs.isBackwardsCompatible; }
|
|
124
124
|
});
|
|
125
125
|
Object.defineProperty(exports, "isSchemaInitialized", {
|
|
126
126
|
enumerable: true,
|
|
127
|
-
get: function () { return
|
|
127
|
+
get: function () { return chunkWZH2MKHW_cjs.isSchemaInitialized; }
|
|
128
128
|
});
|
|
129
129
|
Object.defineProperty(exports, "loadActiveSchemaWithBootstrap", {
|
|
130
130
|
enumerable: true,
|
|
131
|
-
get: function () { return
|
|
131
|
+
get: function () { return chunkWZH2MKHW_cjs.loadActiveSchemaWithBootstrap; }
|
|
132
132
|
});
|
|
133
133
|
Object.defineProperty(exports, "loadAndMergeGraphExtensionDocument", {
|
|
134
134
|
enumerable: true,
|
|
135
|
-
get: function () { return
|
|
135
|
+
get: function () { return chunkWZH2MKHW_cjs.loadAndMergeGraphExtensionDocument; }
|
|
136
136
|
});
|
|
137
137
|
Object.defineProperty(exports, "migrateSchema", {
|
|
138
138
|
enumerable: true,
|
|
139
|
-
get: function () { return
|
|
139
|
+
get: function () { return chunkWZH2MKHW_cjs.migrateSchema; }
|
|
140
140
|
});
|
|
141
141
|
Object.defineProperty(exports, "parseSerializedSchema", {
|
|
142
142
|
enumerable: true,
|
|
143
|
-
get: function () { return
|
|
143
|
+
get: function () { return chunkWZH2MKHW_cjs.parseSerializedSchema; }
|
|
144
144
|
});
|
|
145
145
|
Object.defineProperty(exports, "rollbackSchema", {
|
|
146
146
|
enumerable: true,
|
|
147
|
-
get: function () { return
|
|
147
|
+
get: function () { return chunkWZH2MKHW_cjs.rollbackSchema; }
|
|
148
148
|
});
|
|
149
149
|
Object.defineProperty(exports, "serializeSchema", {
|
|
150
150
|
enumerable: true,
|
|
151
|
-
get: function () { return
|
|
151
|
+
get: function () { return chunkWZH2MKHW_cjs.serializeSchema; }
|
|
152
152
|
});
|
|
153
153
|
Object.defineProperty(exports, "validateEdgeProps", {
|
|
154
154
|
enumerable: true,
|
|
155
|
-
get: function () { return
|
|
155
|
+
get: function () { return chunkWZH2MKHW_cjs.validateEdgeProps; }
|
|
156
156
|
});
|
|
157
157
|
Object.defineProperty(exports, "validateNodeProps", {
|
|
158
158
|
enumerable: true,
|
|
159
|
-
get: function () { return
|
|
159
|
+
get: function () { return chunkWZH2MKHW_cjs.validateNodeProps; }
|
|
160
160
|
});
|
|
161
161
|
Object.defineProperty(exports, "validateProps", {
|
|
162
162
|
enumerable: true,
|
|
163
|
-
get: function () { return
|
|
163
|
+
get: function () { return chunkWZH2MKHW_cjs.validateProps; }
|
|
164
164
|
});
|
|
165
165
|
Object.defineProperty(exports, "wrapZodError", {
|
|
166
166
|
enumerable: true,
|
|
167
|
-
get: function () { return
|
|
167
|
+
get: function () { return chunkWZH2MKHW_cjs.wrapZodError; }
|
|
168
168
|
});
|
|
169
169
|
exports.deserializeSchema = deserializeSchema;
|
|
170
170
|
//# sourceMappingURL=index.cjs.map
|
package/dist/schema/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { KindRegistry } from '../chunk-
|
|
2
|
-
export { applyDeprecatedKinds, assertSchemaCurrent, computeSchemaDiff, computeSchemaHash, createValidationError, deserializeWherePredicate, ensureSchema, getActiveSchema, getMigrationActions, getSchemaChanges, initializeSchema, isBackwardsCompatible, isSchemaInitialized, loadActiveSchemaWithBootstrap, loadAndMergeGraphExtensionDocument, migrateSchema, parseSerializedSchema, rollbackSchema, serializeSchema, validateEdgeProps, validateNodeProps, validateProps, wrapZodError } from '../chunk-
|
|
1
|
+
import { KindRegistry } from '../chunk-5MTOKWDA.js';
|
|
2
|
+
export { applyDeprecatedKinds, assertSchemaCurrent, computeSchemaDiff, computeSchemaHash, createValidationError, deserializeWherePredicate, ensureSchema, getActiveSchema, getMigrationActions, getSchemaChanges, initializeSchema, isBackwardsCompatible, isSchemaInitialized, loadActiveSchemaWithBootstrap, loadAndMergeGraphExtensionDocument, migrateSchema, parseSerializedSchema, rollbackSchema, serializeSchema, validateEdgeProps, validateNodeProps, validateProps, wrapZodError } from '../chunk-5MTOKWDA.js';
|
|
3
3
|
import '../chunk-OYLF3IC7.js';
|
|
4
4
|
import '../chunk-TSGBRPNE.js';
|
|
5
|
-
import '../chunk-
|
|
5
|
+
import '../chunk-O57GYGYK.js';
|
|
6
6
|
import '../chunk-EJCDOA37.js';
|
|
7
7
|
import '../chunk-OOS2RKRH.js';
|
|
8
8
|
import '../chunk-WVQXAFP3.js';
|
package/package.json
CHANGED
package/dist/chunk-5H3BAMTB.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// src/schema/canonical.ts
|
|
2
|
-
function sortedReplacer(_key, value) {
|
|
3
|
-
if (value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
4
|
-
const sorted = {};
|
|
5
|
-
for (const key of Object.keys(value).toSorted()) {
|
|
6
|
-
sorted[key] = value[key];
|
|
7
|
-
}
|
|
8
|
-
return sorted;
|
|
9
|
-
}
|
|
10
|
-
return value;
|
|
11
|
-
}
|
|
12
|
-
function canonicalEqual(a, b) {
|
|
13
|
-
return JSON.stringify(a, sortedReplacer) === JSON.stringify(b, sortedReplacer);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// src/utils/sql-errors.ts
|
|
17
|
-
var MISSING_TABLE_PATTERNS = [
|
|
18
|
-
"no such table",
|
|
19
|
-
// SQLite
|
|
20
|
-
"does not exist",
|
|
21
|
-
// PostgreSQL ("relation ... does not exist")
|
|
22
|
-
"SQLITE_ERROR"
|
|
23
|
-
// D1 / Durable Objects error code
|
|
24
|
-
];
|
|
25
|
-
function isMissingTableError(error) {
|
|
26
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
27
|
-
return MISSING_TABLE_PATTERNS.some((pattern) => message.includes(pattern));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export { canonicalEqual, isMissingTableError, sortedReplacer };
|
|
31
|
-
//# sourceMappingURL=chunk-5H3BAMTB.js.map
|
|
32
|
-
//# sourceMappingURL=chunk-5H3BAMTB.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schema/canonical.ts","../src/utils/sql-errors.ts"],"names":[],"mappings":";AAiBO,SAAS,cAAA,CAAe,MAAc,KAAA,EAAyB;AACpE,EAAA,IAAI,KAAA,KAAU,QAAQ,OAAO,KAAA,KAAU,YAAY,CAAC,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG;AACxE,IAAA,MAAM,SAAkC,EAAC;AACzC,IAAA,KAAA,MAAW,OAAO,MAAA,CAAO,IAAA,CAAK,KAAK,CAAA,CAAE,UAAS,EAAG;AAC/C,MAAA,MAAA,CAAO,GAAG,CAAA,GAAK,KAAA,CAAkC,GAAG,CAAA;AAAA,IACtD;AACA,IAAA,OAAO,MAAA;AAAA,EACT;AACA,EAAA,OAAO,KAAA;AACT;AAaO,SAAS,cAAA,CAAe,GAAY,CAAA,EAAqB;AAC9D,EAAA,OACE,IAAA,CAAK,UAAU,CAAA,EAAG,cAAc,MAAM,IAAA,CAAK,SAAA,CAAU,GAAG,cAAc,CAAA;AAE1E;;;ACjCA,IAAM,sBAAA,GAAyB;AAAA,EAC7B,eAAA;AAAA;AAAA,EACA,gBAAA;AAAA;AAAA,EACA;AAAA;AACF,CAAA;AAEO,SAAS,oBAAoB,KAAA,EAAyB;AAC3D,EAAA,MAAM,UAAU,KAAA,YAAiB,KAAA,GAAQ,KAAA,CAAM,OAAA,GAAU,OAAO,KAAK,CAAA;AACrE,EAAA,OAAO,uBAAuB,IAAA,CAAK,CAAC,YAAY,OAAA,CAAQ,QAAA,CAAS,OAAO,CAAC,CAAA;AAC3E","file":"chunk-5H3BAMTB.js","sourcesContent":["/**\n * Canonical-form helpers for deterministic schema serialization.\n *\n * Used by both content-hashing (`computeSchemaHash`) and structural diffing\n * (`computeSchemaDiff`) to ensure that semantically-equivalent objects with\n * differently-ordered keys produce identical canonical strings.\n */\n\n/**\n * `JSON.stringify` replacer that sorts object keys recursively.\n *\n * Apply via `JSON.stringify(value, sortedReplacer)` to obtain output in\n * which sibling keys at every depth appear in lexicographic order.\n *\n * Arrays are passed through unchanged — array order is semantically\n * meaningful and must not be normalized.\n */\nexport function sortedReplacer(_key: string, value: unknown): unknown {\n if (value !== null && typeof value === \"object\" && !Array.isArray(value)) {\n const sorted: Record<string, unknown> = {};\n for (const key of Object.keys(value).toSorted()) {\n sorted[key] = (value as Record<string, unknown>)[key];\n }\n return sorted;\n }\n return value;\n}\n\n/**\n * Compare two values for canonical-form equality.\n *\n * Returns `true` when both values produce identical JSON under `sortedReplacer`\n * — i.e., they have the same JSON structure regardless of object key order.\n * Used by diff machinery to detect semantic changes in JSON-shaped fields.\n *\n * Note: callers must handle `undefined` themselves — `JSON.stringify(undefined)`\n * returns `undefined`, so two `undefined` inputs would compare equal here, which\n * may or may not be the desired semantics depending on context.\n */\nexport function canonicalEqual(a: unknown, b: unknown): boolean {\n return (\n JSON.stringify(a, sortedReplacer) === JSON.stringify(b, sortedReplacer)\n );\n}\n","/**\n * Cross-dialect detection of \"this relation does not exist yet\" errors.\n *\n * Shared so the schema bootstrap (`loadActiveSchemaWithBootstrap`) and\n * the durable contribution-materialization gate (#135) agree on what a\n * missing-table failure looks like, and — critically — so neither one\n * swallows a genuine system fault (connection/permission/driver error)\n * as a benign \"not bootstrapped yet\".\n */\n\nconst MISSING_TABLE_PATTERNS = [\n \"no such table\", // SQLite\n \"does not exist\", // PostgreSQL (\"relation ... does not exist\")\n \"SQLITE_ERROR\", // D1 / Durable Objects error code\n] as const;\n\nexport function isMissingTableError(error: unknown): boolean {\n const message = error instanceof Error ? error.message : String(error);\n return MISSING_TABLE_PATTERNS.some((pattern) => message.includes(pattern));\n}\n"]}
|