@nicia-ai/typegraph 0.59.0 → 0.60.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/CHANGELOG.md +20 -0
- package/README.md +3 -0
- package/dist/backend/postgres/pglite-store.cjs +1 -1
- package/dist/backend/postgres/pglite-store.d.cts +2 -2
- package/dist/backend/postgres/pglite-store.d.ts +2 -2
- package/dist/backend/postgres/pglite-store.js +1 -1
- package/dist/backend/sqlite/local-store.cjs +1 -1
- package/dist/backend/sqlite/local-store.d.cts +2 -2
- package/dist/backend/sqlite/local-store.d.ts +2 -2
- package/dist/backend/sqlite/local-store.js +1 -1
- package/dist/{chunk-MKQY4ZLZ.js → chunk-2DKIJP2R.js} +73 -41
- package/dist/chunk-2DKIJP2R.js.map +1 -0
- package/dist/{chunk-6BVZHDAZ.js → chunk-43DOTETB.js} +3 -3
- package/dist/{chunk-6BVZHDAZ.js.map → chunk-43DOTETB.js.map} +1 -1
- package/dist/{chunk-IV5W7LKW.cjs → chunk-A22XPVBQ.cjs} +2 -2
- package/dist/chunk-A22XPVBQ.cjs.map +1 -0
- package/dist/{chunk-W4NT4IMI.js → chunk-B4P4DAW3.js} +3 -3
- package/dist/{chunk-W4NT4IMI.js.map → chunk-B4P4DAW3.js.map} +1 -1
- package/dist/{chunk-CA76FVJB.cjs → chunk-CNFKFE5L.cjs} +399 -367
- package/dist/chunk-CNFKFE5L.cjs.map +1 -0
- package/dist/{chunk-EN67I47R.cjs → chunk-EHDLHPMK.cjs} +9 -9
- package/dist/{chunk-EN67I47R.cjs.map → chunk-EHDLHPMK.cjs.map} +1 -1
- package/dist/{chunk-V3JKR2CN.js → chunk-FTDRMXIJ.js} +5 -5
- package/dist/{chunk-V3JKR2CN.js.map → chunk-FTDRMXIJ.js.map} +1 -1
- package/dist/{chunk-3GX5HTPP.js → chunk-ILVXUOQY.js} +3 -3
- package/dist/{chunk-3GX5HTPP.js.map → chunk-ILVXUOQY.js.map} +1 -1
- package/dist/{chunk-XGYUUUHY.cjs → chunk-KGQVK2II.cjs} +40 -40
- package/dist/{chunk-XGYUUUHY.cjs.map → chunk-KGQVK2II.cjs.map} +1 -1
- package/dist/{chunk-BPYZUJX5.cjs → chunk-MTJAT6UO.cjs} +5 -5
- package/dist/{chunk-BPYZUJX5.cjs.map → chunk-MTJAT6UO.cjs.map} +1 -1
- package/dist/{chunk-2GZL5ED3.cjs → chunk-OKA6H3B3.cjs} +19 -19
- package/dist/{chunk-2GZL5ED3.cjs.map → chunk-OKA6H3B3.cjs.map} +1 -1
- package/dist/{chunk-26CL47SW.cjs → chunk-PTFO3JI5.cjs} +110 -110
- package/dist/{chunk-26CL47SW.cjs.map → chunk-PTFO3JI5.cjs.map} +1 -1
- package/dist/{chunk-UOHFBYYH.cjs → chunk-Q6ZVQWH7.cjs} +36 -36
- package/dist/{chunk-UOHFBYYH.cjs.map → chunk-Q6ZVQWH7.cjs.map} +1 -1
- package/dist/{chunk-HWWPL2YL.js → chunk-QWIR5533.js} +2 -2
- package/dist/chunk-QWIR5533.js.map +1 -0
- package/dist/{chunk-DZ3ETMXF.js → chunk-UVQMUBZ6.js} +6 -6
- package/dist/{chunk-DZ3ETMXF.js.map → chunk-UVQMUBZ6.js.map} +1 -1
- package/dist/{chunk-E6PU35DE.js → chunk-W6K6NSRT.js} +4 -4
- package/dist/{chunk-E6PU35DE.js.map → chunk-W6K6NSRT.js.map} +1 -1
- package/dist/graph-merge/index.cjs +119 -119
- package/dist/graph-merge/index.d.cts +2 -2
- package/dist/graph-merge/index.d.ts +2 -2
- package/dist/graph-merge/index.js +7 -7
- package/dist/{graph-templates-DQnmCPkd.d.ts → graph-templates-ClBhrXiA.d.ts} +1 -1
- package/dist/{graph-templates-Buh-RlmQ.d.cts → graph-templates-DfmKDARd.d.cts} +1 -1
- package/dist/index.cjs +68 -68
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +8 -8
- package/dist/interchange/index.cjs +28 -28
- package/dist/interchange/index.d.cts +2 -2
- package/dist/interchange/index.d.ts +2 -2
- package/dist/interchange/index.js +5 -5
- package/dist/{local-store-impl-GFBZBCTN.cjs → local-store-impl-QGSRYFZF.cjs} +9 -9
- package/dist/{local-store-impl-GFBZBCTN.cjs.map → local-store-impl-QGSRYFZF.cjs.map} +1 -1
- package/dist/{local-store-impl-EPUMDNQJ.js → local-store-impl-VEVK2VGA.js} +8 -8
- package/dist/{local-store-impl-EPUMDNQJ.js.map → local-store-impl-VEVK2VGA.js.map} +1 -1
- package/dist/{pglite-store-impl-DB4RRLB7.cjs → pglite-store-impl-33CI3P3M.cjs} +9 -9
- package/dist/{pglite-store-impl-DB4RRLB7.cjs.map → pglite-store-impl-33CI3P3M.cjs.map} +1 -1
- package/dist/{pglite-store-impl-M5PWKN7Z.js → pglite-store-impl-RDPTOOP3.js} +8 -8
- package/dist/{pglite-store-impl-M5PWKN7Z.js.map → pglite-store-impl-RDPTOOP3.js.map} +1 -1
- package/dist/profiler/index.d.cts +2 -2
- package/dist/profiler/index.d.ts +2 -2
- package/dist/provenance/index.cjs +15 -15
- package/dist/provenance/index.d.cts +2 -2
- package/dist/provenance/index.d.ts +2 -2
- package/dist/provenance/index.js +2 -2
- package/dist/schema/index.cjs +34 -34
- package/dist/schema/index.d.cts +3 -3
- package/dist/schema/index.d.ts +3 -3
- package/dist/schema/index.js +4 -4
- package/dist/{store-sLu0hcRm.d.ts → store-B5WZ8E5m.d.ts} +225 -215
- package/dist/{store-CvtRQ8Nb.d.cts → store-DdhFpX53.d.cts} +225 -215
- package/package.json +1 -1
- package/dist/chunk-CA76FVJB.cjs.map +0 -1
- package/dist/chunk-HWWPL2YL.js.map +0 -1
- package/dist/chunk-IV5W7LKW.cjs.map +0 -1
- package/dist/chunk-MKQY4ZLZ.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { buildValidatedKindRegistry, serializeSchema, computeSchemaHash } from './chunk-
|
|
1
|
+
import { buildValidatedKindRegistry, serializeSchema, computeSchemaHash } from './chunk-W6K6NSRT.js';
|
|
2
2
|
import { resolveGraphVectorSlots } from './chunk-PC2UBAUB.js';
|
|
3
3
|
import { ConfigurationError } from './chunk-Q5QOGVDF.js';
|
|
4
4
|
import { hasOwnKey } from './chunk-QD2JFTSL.js';
|
|
@@ -187,5 +187,5 @@ function graphTemplatesUnsupportedError(backend) {
|
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
export { deserializeSchema, instantiateGraph, instantiateGraphTemplate, registerGraphTemplate };
|
|
190
|
-
//# sourceMappingURL=chunk-
|
|
191
|
-
//# sourceMappingURL=chunk-
|
|
190
|
+
//# sourceMappingURL=chunk-ILVXUOQY.js.map
|
|
191
|
+
//# sourceMappingURL=chunk-ILVXUOQY.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schema/deserializer.ts","../src/schema/graph-templates.ts"],"names":[],"mappings":";;;;;;AAqFO,SAAS,kBACd,MAAA,EACoB;AACpB,EAAA,MAAM,SAAA,GAAY,MAAA,CAAO,IAAA,CAAK,MAAA,CAAO,KAAK,CAAA;AAC1C,EAAA,MAAM,SAAA,GAAY,MAAA,CAAO,IAAA,CAAK,MAAA,CAAO,KAAK,CAAA;AAC1C,EAAA,MAAM,aAAA,GAAgB,MAAA,CAAO,IAAA,CAAK,MAAA,CAAO,SAAS,SAAS,CAAA;AAE3D,EAAA,OAAO;AAAA,IACL,SAAS,MAAA,CAAO,OAAA;AAAA,IAChB,SAAS,MAAA,CAAO,OAAA;AAAA,IAChB,aAAa,MAAA,CAAO,WAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMpB,OAAA,EAAS,CAAC,IAAA,KACR,SAAA,CAAU,MAAA,CAAO,KAAA,EAAO,IAAI,CAAA,GAAI,MAAA,CAAO,KAAA,CAAM,IAAI,CAAA,GAAI,MAAA;AAAA,IACvD,cAAc,MAAM,SAAA;AAAA,IAEpB,OAAA,EAAS,CAAC,IAAA,KACR,SA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Q,OAAA;AAAQ,GAClE;AACF","file":"chunk-3GX5HTPP.js","sourcesContent":["/**\n * Schema deserializer for loading stored schemas.\n *\n * Reconstructs runtime objects from SerializedSchema.\n * Note: Zod schemas cannot be fully reconstructed from JSON Schema,\n * so this provides access to the serialized data for introspection.\n */\nimport { type AnyEdgeType, type NodeType } from \"../core/types\";\nimport { type NamedOntologyRelation } from \"../ontology/validation\";\nimport { buildValidatedKindRegistry } from \"../registry/build-validated\";\nimport type { KindRegistry } from \"../registry/kind-registry\";\nimport { type EdgeEndpointKinds } from \"../registry/validate-implies\";\nimport { hasOwnKey } from \"../utils/object\";\nimport {\n type SerializedClosures,\n type SerializedEdgeDef,\n type SerializedMetaEdge,\n type SerializedNodeDef,\n type SerializedOntologyRelation,\n type SerializedSchema,\n} from \"./types\";\n\n// ============================================================\n// Deserialized Schema\n// ============================================================\n\n/**\n * A deserialized schema provides read-only access to schema metadata.\n *\n * Note: Unlike the original GraphDef, this does not include Zod schemas\n * since those cannot be reconstructed from JSON Schema. Use this for\n * introspection and metadata access only.\n */\nexport type DeserializedSchema = Readonly<{\n graphId: string;\n version: number;\n generatedAt: string;\n\n /** Get node definition by name */\n getNode: (name: string) => SerializedNodeDef | undefined;\n\n /** Get all node names */\n getNodeNames: () => readonly string[];\n\n /** Get edge definition by name */\n getEdge: (name: string) => SerializedEdgeDef | undefined;\n\n /** Get all edge names */\n getEdgeNames: () => readonly string[];\n\n /** Get meta-edge definition by name */\n getMetaEdge: (name: string) => SerializedMetaEdge | undefined;\n\n /** Get all meta-edge names */\n getMetaEdgeNames: () => readonly string[];\n\n /** Get all ontology relations */\n getRelations: () => readonly SerializedOntologyRelation[];\n\n /** Get precomputed closures */\n getClosures: () => SerializedClosures;\n\n /** Get graph defaults */\n getDefaults: () => SerializedSchema[\"defaults\"];\n\n /** Get the durable TypeGraph Identity Profile configuration. */\n getIdentity: () => SerializedSchema[\"identity\"];\n\n /** Get the raw serialized schema */\n getRaw: () => SerializedSchema;\n\n /** Build a validated KindRegistry by recomputing closures from relations */\n buildRegistry: () => KindRegistry;\n}>;\n\n// ============================================================\n// Deserialization\n// ============================================================\n\n/**\n * Deserializes a SerializedSchema into a DeserializedSchema.\n *\n * @param schema - The serialized schema to deserialize\n * @returns A deserialized schema with accessor methods\n */\nexport function deserializeSchema(\n schema: SerializedSchema,\n): DeserializedSchema {\n const nodeNames = Object.keys(schema.nodes);\n const edgeNames = Object.keys(schema.edges);\n const metaEdgeNames = Object.keys(schema.ontology.metaEdges);\n\n return {\n graphId: schema.graphId,\n version: schema.version,\n generatedAt: schema.generatedAt,\n\n // Own-key reads, for the same reason {@link buildEdgeEndpointKinds} below\n // uses a `Map`: `schema` is parsed out of a stored JSON document and the\n // caller supplies the name, so a raw read hands back an `Object.prototype`\n // member typed as a definition for any name no kind is registered under.\n getNode: (name) =>\n hasOwnKey(schema.nodes, name) ? schema.nodes[name] : undefined,\n getNodeNames: () => nodeNames,\n\n getEdge: (name) =>\n hasOwnKey(schema.edges, name) ? schema.edges[name] : undefined,\n getEdgeNames: () => edgeNames,\n\n getMetaEdge: (name) =>\n hasOwnKey(schema.ontology.metaEdges, name) ?\n schema.ontology.metaEdges[name]\n : undefined,\n getMetaEdgeNames: () => metaEdgeNames,\n\n getRelations: () => schema.ontology.relations,\n getClosures: () => schema.ontology.closures,\n\n getDefaults: () => schema.defaults,\n getIdentity: () => schema.identity,\n getRaw: () => schema,\n\n buildRegistry: () => buildRegistryFromRelations(schema),\n };\n}\n\n// ============================================================\n// Registry Building\n// ============================================================\n\n/**\n * Builds a KindRegistry from serialized relations.\n *\n * Persisted closures are a legacy inspection artifact. Relations are validated\n * and closures are recomputed so old schemas gain current hardening rules.\n */\nfunction buildRegistryFromRelations(schema: SerializedSchema): KindRegistry {\n // Build empty node/edge kind maps (we don't have the actual Zod schemas)\n const nodeKinds = new Map<string, NodeType>();\n const edgeKinds = new Map<string, AnyEdgeType>();\n return buildValidatedKindRegistry({\n nodeKinds,\n edgeKinds,\n ontology: schema.ontology.relations.map(\n (relation): NamedOntologyRelation => ({\n metaEdge: relation.metaEdge,\n from: relation.from,\n to: relation.to,\n }),\n ),\n edgeEndpoints: buildEdgeEndpointKinds(schema.edges),\n ...(schema.identity === undefined ? {} : { identity: schema.identity }),\n });\n}\n\n/**\n * Maps each edge kind's serialized definition to its domain/range kind\n * names, for `validateImpliesEndpointCompatibility`. A `Map` (rather than\n * the plain `schema.edges` object) so a lookup for an edge kind literally\n * named \"toString\" or another `Object.prototype` member can't resolve to\n * an inherited member instead of `undefined`.\n */\nfunction buildEdgeEndpointKinds(\n edges: Record<string, SerializedEdgeDef>,\n): ReadonlyMap<string, EdgeEndpointKinds> {\n const result = new Map<string, EdgeEndpointKinds>();\n for (const [kind, def] of Object.entries(edges)) {\n const pairs: { from: string; to: string }[] = [];\n if (def.targetKindsBySource === undefined) {\n for (const fromKind of def.fromKinds) {\n for (const toKind of def.toKinds) {\n pairs.push({ from: fromKind, to: toKind });\n }\n }\n } else {\n for (const [sourceKind, targetKinds] of Object.entries(\n def.targetKindsBySource,\n )) {\n for (const targetKind of targetKinds) {\n pairs.push({ from: sourceKind, to: targetKind });\n }\n }\n }\n result.set(kind, {\n from: def.fromKinds,\n to: def.toKinds,\n pairs,\n });\n }\n return result;\n}\n","import type { GraphBackend, SchemaVersionRow } from \"../backend/types\";\nimport { type GraphDef } from \"../core/define-graph\";\nimport { resolveGraphVectorSlots } from \"../core/embedding\";\nimport { ConfigurationError } from \"../errors\";\nimport { type ReconciledSchema } from \"../store/store\";\nimport { computeSchemaHash, serializeSchema } from \"./serializer\";\n\n/** A locally held handle for a durable server-side graph template. */\nexport type GraphTemplate<G extends GraphDef> = Readonly<{\n id: string;\n reconciled: ReconciledSchema<G>;\n schemaHash: string;\n}>;\n\nexport type InstantiateGraphTemplateResult<G extends GraphDef> = Readonly<{\n status: \"ready\";\n reconciled: ReconciledSchema<G>;\n schema: SchemaVersionRow;\n}>;\n\n/**\n * Registers the fully materialized shape of a verified store as a durable\n * template. The original schema version is retained only as snapshot\n * provenance: every instantiated graph starts at v1 with that final shape.\n */\nexport async function registerGraphTemplate<G extends GraphDef>(\n backend: GraphBackend,\n params: Readonly<{ templateId: string; reconciled: ReconciledSchema<G> }>,\n): Promise<GraphTemplate<G>> {\n const register = backend.registerGraphTemplate;\n if (register === undefined) throw graphTemplatesUnsupportedError(backend);\n await backend.assertBaseSchemaCurrent?.();\n const { reconciled } = params;\n if (reconciled.version === undefined || reconciled.hash === undefined) {\n throw new ConfigurationError(\n \"A graph template requires a reconciled schema from a managed or verified Store.\",\n { code: \"GRAPH_TEMPLATE_REQUIRES_RECONCILED_SCHEMA\" },\n );\n }\n if (\n resolveGraphVectorSlots(reconciled.graph).length > 0 &&\n backend.capabilities.vector?.supported === true\n ) {\n throw new ConfigurationError(\n \"Graph templates do not support embedding fields because vector storage is graph-scoped and cannot be instantiated schema-only.\",\n {\n code: \"GRAPH_TEMPLATE_VECTOR_UNSUPPORTED\",\n graphId: reconciled.graph.id,\n },\n {\n suggestion:\n \"Provision the graph through createStoreWithSchema until template instantiation can atomically materialize vector contributions.\",\n },\n );\n }\n const schemaDocument = serializeSchema(reconciled.graph, reconciled.version);\n const schemaHash = await computeSchemaHash(schemaDocument);\n if (schemaHash !== reconciled.hash) {\n throw new ConfigurationError(\n \"Reconciled schema hash does not match its graph snapshot.\",\n { code: \"GRAPH_TEMPLATE_RECONCILED_HASH_MISMATCH\" },\n );\n }\n await register({\n templateId: params.templateId,\n schemaHash,\n schemaDoc: schemaDocument,\n });\n return Object.freeze({\n id: params.templateId,\n reconciled,\n schemaHash,\n });\n}\n\n/**\n * Instantiates the template's final graph shape as target schema v1. Only the\n * target hash crosses the wire; the durable source document stays in the\n * backend template registry and is rebound to `graphId` by one SQL statement.\n */\nexport async function instantiateGraphTemplate<G extends GraphDef>(\n backend: GraphBackend,\n params: Readonly<{ template: GraphTemplate<G>; graphId: string }>,\n): Promise<InstantiateGraphTemplateResult<G>> {\n const instantiate = backend.instantiateGraphTemplate;\n if (instantiate === undefined) throw graphTemplatesUnsupportedError(backend);\n await backend.assertBaseSchemaCurrent?.();\n const sourceVersion = params.template.reconciled.version;\n const reconciledHash = params.template.reconciled.hash;\n if (sourceVersion === undefined || reconciledHash === undefined) {\n throw graphTemplateHandleMismatchError(params.template.id);\n }\n const sourceHash = await computeSchemaHash(\n serializeSchema(params.template.reconciled.graph, sourceVersion),\n );\n if (\n sourceHash !== params.template.schemaHash ||\n reconciledHash !== params.template.schemaHash\n ) {\n throw graphTemplateHandleMismatchError(params.template.id);\n }\n const targetGraph: G = Object.freeze({\n ...params.template.reconciled.graph,\n id: params.graphId,\n });\n const targetHash = await computeSchemaHash(serializeSchema(targetGraph, 1));\n const result = await instantiate({\n templateId: params.template.id,\n templateSchemaHash: params.template.schemaHash,\n graphId: params.graphId,\n schemaHash: targetHash,\n });\n if (result.status === \"refused\") {\n throw new ConfigurationError(\n `Graph template instantiation was refused for graph \"${params.graphId}\". The template may be absent, or the graph already has a different schema.`,\n {\n code: \"GRAPH_TEMPLATE_INSTANTIATION_REFUSED\",\n graphId: params.graphId,\n templateId: params.template.id,\n },\n );\n }\n if (\n result.row.graph_id !== params.graphId ||\n result.row.version !== 1 ||\n result.row.schema_hash !== targetHash\n ) {\n throw new ConfigurationError(\n \"Graph template backend returned a schema row that does not match the requested target.\",\n { code: \"GRAPH_TEMPLATE_INVALID_RESULT\", graphId: params.graphId },\n );\n }\n return Object.freeze({\n status: \"ready\",\n reconciled: Object.freeze({\n graph: targetGraph,\n version: result.row.version,\n hash: result.row.schema_hash,\n }),\n schema: result.row,\n });\n}\n\nfunction graphTemplateHandleMismatchError(\n templateId: string,\n): ConfigurationError {\n return new ConfigurationError(\n `Graph template handle \"${templateId}\" does not match its reconciled schema snapshot.`,\n { code: \"GRAPH_TEMPLATE_HANDLE_MISMATCH\", templateId },\n );\n}\n\n/** Short public name for {@link instantiateGraphTemplate}. */\nexport function instantiateGraph<G extends GraphDef>(\n backend: GraphBackend,\n params: Readonly<{ template: GraphTemplate<G>; graphId: string }>,\n): Promise<InstantiateGraphTemplateResult<G>> {\n return instantiateGraphTemplate(backend, params);\n}\n\nfunction graphTemplatesUnsupportedError(\n backend: GraphBackend,\n): ConfigurationError {\n return new ConfigurationError(\n `The ${backend.dialect} backend does not support durable graph templates.`,\n { code: \"GRAPH_TEMPLATES_UNSUPPORTED\", dialect: backend.dialect },\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/schema/deserializer.ts","../src/schema/graph-templates.ts"],"names":[],"mappings":";;;;;;AAqFO,SAAS,kBACd,MAAA,EACoB;AACpB,EAAA,MAAM,SAAA,GAAY,MAAA,CAAO,IAAA,CAAK,MAAA,CAAO,KAAK,CAAA;AAC1C,EAAA,MAAM,SAAA,GAAY,MAAA,CAAO,IAAA,CAAK,MAAA,CAAO,KAAK,CAAA;AAC1C,EAAA,MAAM,aAAA,GAAgB,MAAA,CAAO,IAAA,CAAK,MAAA,CAAO,SAAS,SAAS,CAAA;AAE3D,EAAA,OAAO;AAAA,IACL,SAAS,MAAA,CAAO,OAAA;AAAA,IAChB,SAAS,MAAA,CAAO,OAAA;AAAA,IAChB,aAAa,MAAA,CAAO,WAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMpB,OAAA,EAAS,CAAC,IAAA,KACR,SAAA,CAAU,MAAA,CAAO,KAAA,EAAO,IAAI,CAAA,GAAI,MAAA,CAAO,KAAA,CAAM,IAAI,CAAA,GAAI,MAAA;AAAA,IACvD,cAAc,MAAM,SAAA;AAAA,IAEpB,OAAA,EAAS,CAAC,IAAA,KACR,SAAA,CAAU,MAAA,CAAO,KAAA,EAAO,IAAI,CAAA,GAAI,MAAA,CAAO,KAAA,CAAM,IAAI,CAAA,GAAI,MAAA;AAAA,IACvD,cAAc,MAAM,SAAA;AAAA,IAEpB,WAAA,EAAa,CAAC,IAAA,KACZ,SAAA,CAAU,MAAA,CAAO,QAAA,CAAS,SAAA,EAAW,IAAI,CAAA,GACvC,MAAA,CAAO,QA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AAA,CAAI,OAAA,KAAY,CAAA,IACvB,MAAA,CAAO,GAAA,CAAI,WAAA,KAAgB,UAAA,EAC3B;AACA,IAAA,MAAM,IAAI,kBAAA;AAAA,MACR,wFAAA;AAAA,MACA,EAAE,IAAA,EAAM,+BAAA,EAAiC,OAAA,EAAS,OAAO,OAAA;AAAQ,KACnE;AAAA,EACF;AACA,EAAA,OAAO,OAAO,MAAA,CAAO;AAAA,IACnB,MAAA,EAAQ,OAAA;AAAA,IACR,UAAA,EAAY,OAAO,MAAA,CAAO;AAAA,MACxB,KAAA,EAAO,WAAA;AAAA,MACP,OAAA,EAAS,OAAO,GAAA,CAAI,OAAA;AAAA,MACpB,IAAA,EAAM,OAAO,GAAA,CAAI;AAAA,KAClB,CAAA;AAAA,IACD,QAAQ,MAAA,CAAO;AAAA,GAChB,CAAA;AACH;AAEA,SAAS,iCACP,UAAA,EACoB;AACpB,EAAA,OAAO,IAAI,kBAAA;AAAA,IACT,0BAA0B,UAAU,CAAA,gDAAA,CAAA;AAAA,IACpC,EAAE,IAAA,EAAM,gCAAA,EAAkC,UAAA;AAAW,GACvD;AACF;AAGO,SAAS,gBAAA,CACd,SACA,MAAA,EAC4C;AAC5C,EAAA,OAAO,wBAAA,CAAyB,SAAS,MAAM,CAAA;AACjD;AAEA,SAAS,+BACP,OAAA,EACoB;AACpB,EAAA,OAAO,IAAI,kBAAA;AAAA,IACT,CAAA,IAAA,EAAO,QAAQ,OAAO,CAAA,kDAAA,CAAA;AAAA,IACtB,EAAE,IAAA,EAAM,6BAAA,EAA+B,OAAA,EAAS,QAAQ,OAAA;AAAQ,GAClE;AACF","file":"chunk-ILVXUOQY.js","sourcesContent":["/**\n * Schema deserializer for loading stored schemas.\n *\n * Reconstructs runtime objects from SerializedSchema.\n * Note: Zod schemas cannot be fully reconstructed from JSON Schema,\n * so this provides access to the serialized data for introspection.\n */\nimport { type AnyEdgeType, type NodeType } from \"../core/types\";\nimport { type NamedOntologyRelation } from \"../ontology/validation\";\nimport { buildValidatedKindRegistry } from \"../registry/build-validated\";\nimport type { KindRegistry } from \"../registry/kind-registry\";\nimport { type EdgeEndpointKinds } from \"../registry/validate-implies\";\nimport { hasOwnKey } from \"../utils/object\";\nimport {\n type SerializedClosures,\n type SerializedEdgeDef,\n type SerializedMetaEdge,\n type SerializedNodeDef,\n type SerializedOntologyRelation,\n type SerializedSchema,\n} from \"./types\";\n\n// ============================================================\n// Deserialized Schema\n// ============================================================\n\n/**\n * A deserialized schema provides read-only access to schema metadata.\n *\n * Note: Unlike the original GraphDef, this does not include Zod schemas\n * since those cannot be reconstructed from JSON Schema. Use this for\n * introspection and metadata access only.\n */\nexport type DeserializedSchema = Readonly<{\n graphId: string;\n version: number;\n generatedAt: string;\n\n /** Get node definition by name */\n getNode: (name: string) => SerializedNodeDef | undefined;\n\n /** Get all node names */\n getNodeNames: () => readonly string[];\n\n /** Get edge definition by name */\n getEdge: (name: string) => SerializedEdgeDef | undefined;\n\n /** Get all edge names */\n getEdgeNames: () => readonly string[];\n\n /** Get meta-edge definition by name */\n getMetaEdge: (name: string) => SerializedMetaEdge | undefined;\n\n /** Get all meta-edge names */\n getMetaEdgeNames: () => readonly string[];\n\n /** Get all ontology relations */\n getRelations: () => readonly SerializedOntologyRelation[];\n\n /** Get precomputed closures */\n getClosures: () => SerializedClosures;\n\n /** Get graph defaults */\n getDefaults: () => SerializedSchema[\"defaults\"];\n\n /** Get the durable TypeGraph Identity Profile configuration. */\n getIdentity: () => SerializedSchema[\"identity\"];\n\n /** Get the raw serialized schema */\n getRaw: () => SerializedSchema;\n\n /** Build a validated KindRegistry by recomputing closures from relations */\n buildRegistry: () => KindRegistry;\n}>;\n\n// ============================================================\n// Deserialization\n// ============================================================\n\n/**\n * Deserializes a SerializedSchema into a DeserializedSchema.\n *\n * @param schema - The serialized schema to deserialize\n * @returns A deserialized schema with accessor methods\n */\nexport function deserializeSchema(\n schema: SerializedSchema,\n): DeserializedSchema {\n const nodeNames = Object.keys(schema.nodes);\n const edgeNames = Object.keys(schema.edges);\n const metaEdgeNames = Object.keys(schema.ontology.metaEdges);\n\n return {\n graphId: schema.graphId,\n version: schema.version,\n generatedAt: schema.generatedAt,\n\n // Own-key reads, for the same reason {@link buildEdgeEndpointKinds} below\n // uses a `Map`: `schema` is parsed out of a stored JSON document and the\n // caller supplies the name, so a raw read hands back an `Object.prototype`\n // member typed as a definition for any name no kind is registered under.\n getNode: (name) =>\n hasOwnKey(schema.nodes, name) ? schema.nodes[name] : undefined,\n getNodeNames: () => nodeNames,\n\n getEdge: (name) =>\n hasOwnKey(schema.edges, name) ? schema.edges[name] : undefined,\n getEdgeNames: () => edgeNames,\n\n getMetaEdge: (name) =>\n hasOwnKey(schema.ontology.metaEdges, name) ?\n schema.ontology.metaEdges[name]\n : undefined,\n getMetaEdgeNames: () => metaEdgeNames,\n\n getRelations: () => schema.ontology.relations,\n getClosures: () => schema.ontology.closures,\n\n getDefaults: () => schema.defaults,\n getIdentity: () => schema.identity,\n getRaw: () => schema,\n\n buildRegistry: () => buildRegistryFromRelations(schema),\n };\n}\n\n// ============================================================\n// Registry Building\n// ============================================================\n\n/**\n * Builds a KindRegistry from serialized relations.\n *\n * Persisted closures are a legacy inspection artifact. Relations are validated\n * and closures are recomputed so old schemas gain current hardening rules.\n */\nfunction buildRegistryFromRelations(schema: SerializedSchema): KindRegistry {\n // Build empty node/edge kind maps (we don't have the actual Zod schemas)\n const nodeKinds = new Map<string, NodeType>();\n const edgeKinds = new Map<string, AnyEdgeType>();\n return buildValidatedKindRegistry({\n nodeKinds,\n edgeKinds,\n ontology: schema.ontology.relations.map(\n (relation): NamedOntologyRelation => ({\n metaEdge: relation.metaEdge,\n from: relation.from,\n to: relation.to,\n }),\n ),\n edgeEndpoints: buildEdgeEndpointKinds(schema.edges),\n ...(schema.identity === undefined ? {} : { identity: schema.identity }),\n });\n}\n\n/**\n * Maps each edge kind's serialized definition to its domain/range kind\n * names, for `validateImpliesEndpointCompatibility`. A `Map` (rather than\n * the plain `schema.edges` object) so a lookup for an edge kind literally\n * named \"toString\" or another `Object.prototype` member can't resolve to\n * an inherited member instead of `undefined`.\n */\nfunction buildEdgeEndpointKinds(\n edges: Record<string, SerializedEdgeDef>,\n): ReadonlyMap<string, EdgeEndpointKinds> {\n const result = new Map<string, EdgeEndpointKinds>();\n for (const [kind, def] of Object.entries(edges)) {\n const pairs: { from: string; to: string }[] = [];\n if (def.targetKindsBySource === undefined) {\n for (const fromKind of def.fromKinds) {\n for (const toKind of def.toKinds) {\n pairs.push({ from: fromKind, to: toKind });\n }\n }\n } else {\n for (const [sourceKind, targetKinds] of Object.entries(\n def.targetKindsBySource,\n )) {\n for (const targetKind of targetKinds) {\n pairs.push({ from: sourceKind, to: targetKind });\n }\n }\n }\n result.set(kind, {\n from: def.fromKinds,\n to: def.toKinds,\n pairs,\n });\n }\n return result;\n}\n","import type { GraphBackend, SchemaVersionRow } from \"../backend/types\";\nimport { type GraphDef } from \"../core/define-graph\";\nimport { resolveGraphVectorSlots } from \"../core/embedding\";\nimport { ConfigurationError } from \"../errors\";\nimport { type ReconciledSchema } from \"../store/store\";\nimport { computeSchemaHash, serializeSchema } from \"./serializer\";\n\n/** A locally held handle for a durable server-side graph template. */\nexport type GraphTemplate<G extends GraphDef> = Readonly<{\n id: string;\n reconciled: ReconciledSchema<G>;\n schemaHash: string;\n}>;\n\nexport type InstantiateGraphTemplateResult<G extends GraphDef> = Readonly<{\n status: \"ready\";\n reconciled: ReconciledSchema<G>;\n schema: SchemaVersionRow;\n}>;\n\n/**\n * Registers the fully materialized shape of a verified store as a durable\n * template. The original schema version is retained only as snapshot\n * provenance: every instantiated graph starts at v1 with that final shape.\n */\nexport async function registerGraphTemplate<G extends GraphDef>(\n backend: GraphBackend,\n params: Readonly<{ templateId: string; reconciled: ReconciledSchema<G> }>,\n): Promise<GraphTemplate<G>> {\n const register = backend.registerGraphTemplate;\n if (register === undefined) throw graphTemplatesUnsupportedError(backend);\n await backend.assertBaseSchemaCurrent?.();\n const { reconciled } = params;\n if (reconciled.version === undefined || reconciled.hash === undefined) {\n throw new ConfigurationError(\n \"A graph template requires a reconciled schema from a managed or verified Store.\",\n { code: \"GRAPH_TEMPLATE_REQUIRES_RECONCILED_SCHEMA\" },\n );\n }\n if (\n resolveGraphVectorSlots(reconciled.graph).length > 0 &&\n backend.capabilities.vector?.supported === true\n ) {\n throw new ConfigurationError(\n \"Graph templates do not support embedding fields because vector storage is graph-scoped and cannot be instantiated schema-only.\",\n {\n code: \"GRAPH_TEMPLATE_VECTOR_UNSUPPORTED\",\n graphId: reconciled.graph.id,\n },\n {\n suggestion:\n \"Provision the graph through createStoreWithSchema until template instantiation can atomically materialize vector contributions.\",\n },\n );\n }\n const schemaDocument = serializeSchema(reconciled.graph, reconciled.version);\n const schemaHash = await computeSchemaHash(schemaDocument);\n if (schemaHash !== reconciled.hash) {\n throw new ConfigurationError(\n \"Reconciled schema hash does not match its graph snapshot.\",\n { code: \"GRAPH_TEMPLATE_RECONCILED_HASH_MISMATCH\" },\n );\n }\n await register({\n templateId: params.templateId,\n schemaHash,\n schemaDoc: schemaDocument,\n });\n return Object.freeze({\n id: params.templateId,\n reconciled,\n schemaHash,\n });\n}\n\n/**\n * Instantiates the template's final graph shape as target schema v1. Only the\n * target hash crosses the wire; the durable source document stays in the\n * backend template registry and is rebound to `graphId` by one SQL statement.\n */\nexport async function instantiateGraphTemplate<G extends GraphDef>(\n backend: GraphBackend,\n params: Readonly<{ template: GraphTemplate<G>; graphId: string }>,\n): Promise<InstantiateGraphTemplateResult<G>> {\n const instantiate = backend.instantiateGraphTemplate;\n if (instantiate === undefined) throw graphTemplatesUnsupportedError(backend);\n await backend.assertBaseSchemaCurrent?.();\n const sourceVersion = params.template.reconciled.version;\n const reconciledHash = params.template.reconciled.hash;\n if (sourceVersion === undefined || reconciledHash === undefined) {\n throw graphTemplateHandleMismatchError(params.template.id);\n }\n const sourceHash = await computeSchemaHash(\n serializeSchema(params.template.reconciled.graph, sourceVersion),\n );\n if (\n sourceHash !== params.template.schemaHash ||\n reconciledHash !== params.template.schemaHash\n ) {\n throw graphTemplateHandleMismatchError(params.template.id);\n }\n const targetGraph: G = Object.freeze({\n ...params.template.reconciled.graph,\n id: params.graphId,\n });\n const targetHash = await computeSchemaHash(serializeSchema(targetGraph, 1));\n const result = await instantiate({\n templateId: params.template.id,\n templateSchemaHash: params.template.schemaHash,\n graphId: params.graphId,\n schemaHash: targetHash,\n });\n if (result.status === \"refused\") {\n throw new ConfigurationError(\n `Graph template instantiation was refused for graph \"${params.graphId}\". The template may be absent, or the graph already has a different schema.`,\n {\n code: \"GRAPH_TEMPLATE_INSTANTIATION_REFUSED\",\n graphId: params.graphId,\n templateId: params.template.id,\n },\n );\n }\n if (\n result.row.graph_id !== params.graphId ||\n result.row.version !== 1 ||\n result.row.schema_hash !== targetHash\n ) {\n throw new ConfigurationError(\n \"Graph template backend returned a schema row that does not match the requested target.\",\n { code: \"GRAPH_TEMPLATE_INVALID_RESULT\", graphId: params.graphId },\n );\n }\n return Object.freeze({\n status: \"ready\",\n reconciled: Object.freeze({\n graph: targetGraph,\n version: result.row.version,\n hash: result.row.schema_hash,\n }),\n schema: result.row,\n });\n}\n\nfunction graphTemplateHandleMismatchError(\n templateId: string,\n): ConfigurationError {\n return new ConfigurationError(\n `Graph template handle \"${templateId}\" does not match its reconciled schema snapshot.`,\n { code: \"GRAPH_TEMPLATE_HANDLE_MISMATCH\", templateId },\n );\n}\n\n/** Short public name for {@link instantiateGraphTemplate}. */\nexport function instantiateGraph<G extends GraphDef>(\n backend: GraphBackend,\n params: Readonly<{ template: GraphTemplate<G>; graphId: string }>,\n): Promise<InstantiateGraphTemplateResult<G>> {\n return instantiateGraphTemplate(backend, params);\n}\n\nfunction graphTemplatesUnsupportedError(\n backend: GraphBackend,\n): ConfigurationError {\n return new ConfigurationError(\n `The ${backend.dialect} backend does not support durable graph templates.`,\n { code: \"GRAPH_TEMPLATES_UNSUPPORTED\", dialect: backend.dialect },\n );\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkPTFO3JI5_cjs = require('./chunk-PTFO3JI5.cjs');
|
|
4
|
+
var chunkMTJAT6UO_cjs = require('./chunk-MTJAT6UO.cjs');
|
|
5
5
|
var chunkGD7IWK36_cjs = require('./chunk-GD7IWK36.cjs');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
6
|
+
var chunkQ6ZVQWH7_cjs = require('./chunk-Q6ZVQWH7.cjs');
|
|
7
|
+
var chunkA22XPVBQ_cjs = require('./chunk-A22XPVBQ.cjs');
|
|
8
8
|
var chunkOGK7F2J3_cjs = require('./chunk-OGK7F2J3.cjs');
|
|
9
9
|
var chunkEOLNL35G_cjs = require('./chunk-EOLNL35G.cjs');
|
|
10
10
|
var chunk6ODVH5SA_cjs = require('./chunk-6ODVH5SA.cjs');
|
|
@@ -251,7 +251,7 @@ function resolveIngestionImportTarget(target) {
|
|
|
251
251
|
const registeredStore = INGESTION_IMPORT_TARGETS.get(target);
|
|
252
252
|
if (registeredStore !== void 0) return registeredStore;
|
|
253
253
|
try {
|
|
254
|
-
|
|
254
|
+
chunkA22XPVBQ_cjs.storeBackend(target);
|
|
255
255
|
return target;
|
|
256
256
|
} catch (error) {
|
|
257
257
|
throw new chunkG7W67PZO_cjs.ConfigurationError(
|
|
@@ -286,7 +286,7 @@ async function importGraph(target, data, rawOptions) {
|
|
|
286
286
|
}
|
|
287
287
|
async function withImportStreamLease(store, run) {
|
|
288
288
|
const lease = chunkEOLNL35G_cjs.acquireSerializedStreamLease(
|
|
289
|
-
|
|
289
|
+
chunkA22XPVBQ_cjs.storeBackend(store),
|
|
290
290
|
"import-stream"
|
|
291
291
|
);
|
|
292
292
|
if (!lease.acquired) {
|
|
@@ -366,19 +366,19 @@ async function importGraphData(store, data, options) {
|
|
|
366
366
|
validateIdentitySection(data.identity);
|
|
367
367
|
const graph = store.graph;
|
|
368
368
|
const graphId = store.graphId;
|
|
369
|
-
const backend =
|
|
370
|
-
const runtime =
|
|
369
|
+
const backend = chunkA22XPVBQ_cjs.storeBackend(store);
|
|
370
|
+
const runtime = chunkA22XPVBQ_cjs.storeRuntime(store);
|
|
371
371
|
const registry = store.registry;
|
|
372
372
|
const batchPointRead = chunkOGK7F2J3_cjs.batchPointReadVerdict(backend);
|
|
373
373
|
const uniqueSidecarBatch = chunkOGK7F2J3_cjs.uniqueSidecarBatchVerdict(backend);
|
|
374
374
|
const statementExecution = chunkOGK7F2J3_cjs.statementExecutionVerdict(backend);
|
|
375
|
-
const owedClaimReason =
|
|
376
|
-
const claimRefusal = owedClaimReason === void 0 ? void 0 :
|
|
375
|
+
const owedClaimReason = chunkPTFO3JI5_cjs.graphOwesClaims(graph, registry);
|
|
376
|
+
const claimRefusal = owedClaimReason === void 0 ? void 0 : chunkA22XPVBQ_cjs.constraintFenceRefusal({ graphId }, backend, owedClaimReason);
|
|
377
377
|
if (claimRefusal !== void 0) throw claimRefusal;
|
|
378
378
|
const nodeSchemas = buildNodeSchemaMap(graph);
|
|
379
379
|
const edgeSchemas = buildEdgeSchemaMap(graph);
|
|
380
380
|
for (const [kind, entry] of edgeSchemas) {
|
|
381
|
-
|
|
381
|
+
chunkQ6ZVQWH7_cjs.assertEdgeMatchIdentityBackendSupport(
|
|
382
382
|
entry.registration.matchIdentity,
|
|
383
383
|
backend.capabilities,
|
|
384
384
|
kind
|
|
@@ -396,7 +396,7 @@ async function importGraphData(store, data, options) {
|
|
|
396
396
|
uniqueSidecarBatch,
|
|
397
397
|
statementExecution
|
|
398
398
|
};
|
|
399
|
-
const { result, errors } = await
|
|
399
|
+
const { result, errors } = await chunkPTFO3JI5_cjs.runWritePlan(
|
|
400
400
|
{
|
|
401
401
|
graphId,
|
|
402
402
|
registry,
|
|
@@ -413,7 +413,7 @@ async function importGraphData(store, data, options) {
|
|
|
413
413
|
// whether node/edge-operations write to TypeGraph's own recorded
|
|
414
414
|
// relations — engine-native `history: true` never does, even though
|
|
415
415
|
// the public getter now answers `true` for it too.
|
|
416
|
-
historyEnabled:
|
|
416
|
+
historyEnabled: chunkA22XPVBQ_cjs.storeCaptureEnabled(store),
|
|
417
417
|
revisionTrackingEnabled: store.revisionTrackingEnabled,
|
|
418
418
|
revisionSchema: store.revisionSchema,
|
|
419
419
|
// HOW this caller takes position 3. `lockIdentityImportTarget` is
|
|
@@ -424,7 +424,7 @@ async function importGraphData(store, data, options) {
|
|
|
424
424
|
},
|
|
425
425
|
// An import writes node rows AND edge rows in one frame, so it declares the
|
|
426
426
|
// mixed family explicitly instead of receiving either narrower session.
|
|
427
|
-
|
|
427
|
+
chunkPTFO3JI5_cjs.mixedWritePlan(void 0, true),
|
|
428
428
|
backend,
|
|
429
429
|
(session, target, overlaidSession, _lock, transactionMode) => runImportWritePlanAttempt(
|
|
430
430
|
attemptInputs,
|
|
@@ -445,7 +445,7 @@ async function importGraphStream(target, chunks, rawOptions) {
|
|
|
445
445
|
const store = resolveIngestionImportTarget(target);
|
|
446
446
|
const options = ImportOptionsSchema.parse(rawOptions);
|
|
447
447
|
const sourceBackend = exportStreamBackend(chunks);
|
|
448
|
-
const targetBackend =
|
|
448
|
+
const targetBackend = chunkA22XPVBQ_cjs.storeBackend(store);
|
|
449
449
|
const contention = sourceBackend === void 0 ? void 0 : chunkEOLNL35G_cjs.snapshotExportContention(sourceBackend, targetBackend);
|
|
450
450
|
if (contention !== void 0) {
|
|
451
451
|
throw serializedStreamRefusal({
|
|
@@ -702,7 +702,7 @@ function asIdentityImportError(assertions, graphId, error) {
|
|
|
702
702
|
}
|
|
703
703
|
function taggedAssertion(assertions, error) {
|
|
704
704
|
if (typeof error !== "object" || error === null) return void 0;
|
|
705
|
-
const id = error[
|
|
705
|
+
const id = error[chunkQ6ZVQWH7_cjs.IDENTITY_IMPORT_FAILED_ASSERTION];
|
|
706
706
|
if (typeof id !== "string") return void 0;
|
|
707
707
|
return assertions.find((candidate) => candidate.id === id);
|
|
708
708
|
}
|
|
@@ -733,7 +733,7 @@ function identityImportProgress(error) {
|
|
|
733
733
|
if (typeof error !== "object" || error === null) {
|
|
734
734
|
return { created: 0, skipped: 0 };
|
|
735
735
|
}
|
|
736
|
-
const progress = error[
|
|
736
|
+
const progress = error[chunkQ6ZVQWH7_cjs.IDENTITY_IMPORT_PROGRESS];
|
|
737
737
|
if (typeof progress !== "object" || progress === null || !("created" in progress) || typeof progress.created !== "number" || !("skipped" in progress) || typeof progress.skipped !== "number") {
|
|
738
738
|
return { created: 0, skipped: 0 };
|
|
739
739
|
}
|
|
@@ -935,8 +935,8 @@ async function processNodeSlice(frame, graphId, registry, batch, schemas, option
|
|
|
935
935
|
registerAppliedNodeUpdate,
|
|
936
936
|
seedNodeRow,
|
|
937
937
|
seedUniqueRow
|
|
938
|
-
} =
|
|
939
|
-
await
|
|
938
|
+
} = chunkPTFO3JI5_cjs.createNodeBatchValidationSeams(graphId, registry, frame.target);
|
|
939
|
+
await chunkPTFO3JI5_cjs.primeBatchValidationCaches(
|
|
940
940
|
{
|
|
941
941
|
graphId,
|
|
942
942
|
registry,
|
|
@@ -1012,14 +1012,14 @@ async function processNodeSlice(frame, graphId, registry, batch, schemas, option
|
|
|
1012
1012
|
continue;
|
|
1013
1013
|
}
|
|
1014
1014
|
const constraintResult = await catchDeclaredConstraintRefusal(async () => {
|
|
1015
|
-
await
|
|
1015
|
+
await chunkMTJAT6UO_cjs.checkUniquenessConstraints(
|
|
1016
1016
|
{ graphId, registry, backend: validationBackend },
|
|
1017
1017
|
node.kind,
|
|
1018
1018
|
node.id,
|
|
1019
1019
|
props,
|
|
1020
1020
|
uniqueConstraints
|
|
1021
1021
|
);
|
|
1022
|
-
await
|
|
1022
|
+
await chunkPTFO3JI5_cjs.checkDisjointnessConstraint(
|
|
1023
1023
|
{ graphId, registry, backend: validationBackend },
|
|
1024
1024
|
node.kind,
|
|
1025
1025
|
node.id
|
|
@@ -1076,7 +1076,7 @@ function importNodeCreateWork(graphId, registry, node, registration, props) {
|
|
|
1076
1076
|
return {
|
|
1077
1077
|
params: buildImportInsertParams(graphId, node, props),
|
|
1078
1078
|
claim,
|
|
1079
|
-
claimPlan:
|
|
1079
|
+
claimPlan: chunkMTJAT6UO_cjs.planNodeCreateClaims({ graphId, registry }, claim),
|
|
1080
1080
|
sideEffects: {
|
|
1081
1081
|
kind: node.kind,
|
|
1082
1082
|
id: node.id,
|
|
@@ -1140,7 +1140,7 @@ async function catchEdgeCreateRefusalWithSavepoint(frame, fn) {
|
|
|
1140
1140
|
}
|
|
1141
1141
|
}
|
|
1142
1142
|
const statementExecution = frame.statementExecution;
|
|
1143
|
-
const result = await
|
|
1143
|
+
const result = await chunkA22XPVBQ_cjs.runRecordedTransactionSavepoint(target, statementExecution, frame.allocateEdgeSavepoint(), async () => {
|
|
1144
1144
|
const guarded = await catchEdgeCreateRefusal(fn);
|
|
1145
1145
|
return guarded.ok ? { action: "release", value: guarded } : { action: "rollback", value: guarded, cause: guarded.cause };
|
|
1146
1146
|
});
|
|
@@ -1221,7 +1221,7 @@ async function updateImportedEdge(session, edge, props, windowFence) {
|
|
|
1221
1221
|
}
|
|
1222
1222
|
}
|
|
1223
1223
|
function importedEdgeIdentityUpdateError(registration, edge, existing, props) {
|
|
1224
|
-
return
|
|
1224
|
+
return chunkPTFO3JI5_cjs.edgeMatchIdentityUpdateRefusal({
|
|
1225
1225
|
identity: registration.matchIdentity,
|
|
1226
1226
|
kind: edge.kind,
|
|
1227
1227
|
id: edge.id,
|
|
@@ -1339,14 +1339,14 @@ async function processNode(frame, graphId, registry, node, schemas, options) {
|
|
|
1339
1339
|
}
|
|
1340
1340
|
}
|
|
1341
1341
|
const constraintResult = await catchDeclaredConstraintRefusal(async () => {
|
|
1342
|
-
await
|
|
1342
|
+
await chunkMTJAT6UO_cjs.checkUniquenessConstraints(
|
|
1343
1343
|
{ graphId, registry, backend: frame.target },
|
|
1344
1344
|
node.kind,
|
|
1345
1345
|
node.id,
|
|
1346
1346
|
propsResult.data,
|
|
1347
1347
|
uniqueConstraints
|
|
1348
1348
|
);
|
|
1349
|
-
await
|
|
1349
|
+
await chunkPTFO3JI5_cjs.checkDisjointnessConstraint(
|
|
1350
1350
|
{ graphId, registry, backend: frame.target },
|
|
1351
1351
|
node.kind,
|
|
1352
1352
|
node.id
|
|
@@ -1413,7 +1413,7 @@ function recordEdgeOutcome(edge, outcome, result, errors) {
|
|
|
1413
1413
|
}
|
|
1414
1414
|
function prepareEdgeImportCreate(graphId, candidate, registration) {
|
|
1415
1415
|
const { edge, props } = candidate;
|
|
1416
|
-
const matchIdentity =
|
|
1416
|
+
const matchIdentity = chunkPTFO3JI5_cjs.resolveEdgeMatchIdentityStorage(
|
|
1417
1417
|
registration.matchIdentity,
|
|
1418
1418
|
{
|
|
1419
1419
|
fromKind: edge.from.kind,
|
|
@@ -1547,7 +1547,7 @@ async function processEdgeSlice(frame, graphId, registry, batch, edgeSchemas, no
|
|
|
1547
1547
|
const {
|
|
1548
1548
|
backend: cardinalityValidationBackend,
|
|
1549
1549
|
registerPendingEdgeForCardinality
|
|
1550
|
-
} =
|
|
1550
|
+
} = chunkPTFO3JI5_cjs.createEdgeBatchValidationBackend(frame.target);
|
|
1551
1551
|
const candidates = [];
|
|
1552
1552
|
const deferred = [];
|
|
1553
1553
|
const seenIds = /* @__PURE__ */ new Set();
|
|
@@ -1765,7 +1765,7 @@ async function processEdgeSlice(frame, graphId, registry, batch, edgeSchemas, no
|
|
|
1765
1765
|
const { candidate, params, cardinality } = prepared;
|
|
1766
1766
|
const { edge } = candidate;
|
|
1767
1767
|
const cardinalityResult = await catchDeclaredConstraintRefusal(
|
|
1768
|
-
() =>
|
|
1768
|
+
() => chunkPTFO3JI5_cjs.checkCardinalityConstraint(
|
|
1769
1769
|
{ graphId, registry, backend: cardinalityValidationBackend },
|
|
1770
1770
|
edge.kind,
|
|
1771
1771
|
cardinality,
|
|
@@ -1833,7 +1833,7 @@ async function processEdgeSlice(frame, graphId, registry, batch, edgeSchemas, no
|
|
|
1833
1833
|
const rows = await chunkBXHAPCQG_cjs.requireDefined(frame.session.createEdgesDurable)(
|
|
1834
1834
|
acceptedWork
|
|
1835
1835
|
);
|
|
1836
|
-
const outcomes =
|
|
1836
|
+
const outcomes = chunkPTFO3JI5_cjs.classifyDurableEdgeBatchOutcomes(
|
|
1837
1837
|
accepted.map((prepared) => prepared.params),
|
|
1838
1838
|
rows
|
|
1839
1839
|
);
|
|
@@ -2030,7 +2030,7 @@ async function processEdge(frame, graphId, registry, edge, edgeSchemas, nodeSche
|
|
|
2030
2030
|
}
|
|
2031
2031
|
const { cardinality, params } = preparation.value;
|
|
2032
2032
|
const cardinalityResult = await catchDeclaredConstraintRefusal(
|
|
2033
|
-
() =>
|
|
2033
|
+
() => chunkPTFO3JI5_cjs.checkCardinalityConstraint(
|
|
2034
2034
|
{ graphId, registry, backend: frame.target },
|
|
2035
2035
|
edge.kind,
|
|
2036
2036
|
cardinality,
|
|
@@ -2162,7 +2162,7 @@ async function exportGraph(store, options) {
|
|
|
2162
2162
|
};
|
|
2163
2163
|
}
|
|
2164
2164
|
function exportGraphStream(store, options) {
|
|
2165
|
-
const backend =
|
|
2165
|
+
const backend = chunkA22XPVBQ_cjs.storeBackend(store);
|
|
2166
2166
|
return markExportStreamBackend(
|
|
2167
2167
|
exportGraphStreamFromBackend(store, backend, options),
|
|
2168
2168
|
backend
|
|
@@ -2366,7 +2366,7 @@ async function produceExportChunks(store, backend, options, emit) {
|
|
|
2366
2366
|
if (store.graph.identity === void 0) return;
|
|
2367
2367
|
let after;
|
|
2368
2368
|
for (; ; ) {
|
|
2369
|
-
const page = await
|
|
2369
|
+
const page = await chunkA22XPVBQ_cjs.storeRuntime(store).readIdentityAssertionPageAtTarget(
|
|
2370
2370
|
backend,
|
|
2371
2371
|
options.identityMode,
|
|
2372
2372
|
{
|
|
@@ -2593,15 +2593,15 @@ async function* exportEdgeChunks(backend, graphId, kind, options) {
|
|
|
2593
2593
|
|
|
2594
2594
|
// src/interchange/trusted-import.ts
|
|
2595
2595
|
function rejectUnsupportedStoreFeatures(store) {
|
|
2596
|
-
const backend =
|
|
2596
|
+
const backend = chunkA22XPVBQ_cjs.storeBackend(store);
|
|
2597
2597
|
for (const [kind, registration] of Object.entries(store.graph.edges)) {
|
|
2598
|
-
|
|
2598
|
+
chunkQ6ZVQWH7_cjs.assertEdgeMatchIdentityBackendSupport(
|
|
2599
2599
|
registration.matchIdentity,
|
|
2600
2600
|
backend.capabilities,
|
|
2601
2601
|
kind
|
|
2602
2602
|
);
|
|
2603
2603
|
}
|
|
2604
|
-
if (
|
|
2604
|
+
if (chunkA22XPVBQ_cjs.storeCaptureEnabled(store)) {
|
|
2605
2605
|
throw new chunkG7W67PZO_cjs.TrustedImportError(
|
|
2606
2606
|
"Trusted import does not support recorded-time history capture.",
|
|
2607
2607
|
"history_unsupported",
|
|
@@ -2692,7 +2692,7 @@ function nodeParams(graphId, node) {
|
|
|
2692
2692
|
};
|
|
2693
2693
|
}
|
|
2694
2694
|
function edgeParams(graphId, edge, registration) {
|
|
2695
|
-
const matchIdentity =
|
|
2695
|
+
const matchIdentity = chunkPTFO3JI5_cjs.resolveEdgeMatchIdentityStorage(
|
|
2696
2696
|
registration.matchIdentity,
|
|
2697
2697
|
{
|
|
2698
2698
|
fromKind: edge.from.kind,
|
|
@@ -2854,7 +2854,7 @@ async function consumeTrustedChunks(store, session, chunks) {
|
|
|
2854
2854
|
}
|
|
2855
2855
|
async function trustedImportGraphStream(store, chunks) {
|
|
2856
2856
|
rejectUnsupportedStoreFeatures(store);
|
|
2857
|
-
const backend =
|
|
2857
|
+
const backend = chunkA22XPVBQ_cjs.storeBackend(store);
|
|
2858
2858
|
const trustedImport = backend.trustedImport;
|
|
2859
2859
|
if (trustedImport === void 0) {
|
|
2860
2860
|
throw new chunkG7W67PZO_cjs.TrustedImportError(
|
|
@@ -2931,5 +2931,5 @@ exports.importGraphStream = importGraphStream;
|
|
|
2931
2931
|
exports.registerIngestionImportTarget = registerIngestionImportTarget;
|
|
2932
2932
|
exports.trustedImportGraph = trustedImportGraph;
|
|
2933
2933
|
exports.trustedImportGraphStream = trustedImportGraphStream;
|
|
2934
|
-
//# sourceMappingURL=chunk-
|
|
2935
|
-
//# sourceMappingURL=chunk-
|
|
2934
|
+
//# sourceMappingURL=chunk-KGQVK2II.cjs.map
|
|
2935
|
+
//# sourceMappingURL=chunk-KGQVK2II.cjs.map
|