@nicia-ai/typegraph 0.71.0 → 0.71.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/CHANGELOG.md +6 -0
- package/dist/backend/postgres/pglite-store.cjs +1 -1
- package/dist/backend/postgres/pglite-store.js +1 -1
- package/dist/backend/sqlite/local-store.cjs +1 -1
- package/dist/backend/sqlite/local-store.js +1 -1
- package/dist/{chunk-5YUJYIW3.cjs → chunk-D6J4Z423.cjs} +4 -4
- package/dist/{chunk-5YUJYIW3.cjs.map → chunk-D6J4Z423.cjs.map} +1 -1
- package/dist/{chunk-TKYOWV5U.js → chunk-EPXW4ONY.js} +5 -5
- package/dist/{chunk-TKYOWV5U.js.map → chunk-EPXW4ONY.js.map} +1 -1
- package/dist/{chunk-B33AHPS7.cjs → chunk-H3ULZVTX.cjs} +3 -3
- package/dist/{chunk-B33AHPS7.cjs.map → chunk-H3ULZVTX.cjs.map} +1 -1
- package/dist/{chunk-Z3MH5QUR.js → chunk-NMDDGDMQ.js} +3 -3
- package/dist/{chunk-Z3MH5QUR.js.map → chunk-NMDDGDMQ.js.map} +1 -1
- package/dist/{chunk-2PUJGVJ6.cjs → chunk-Q4MXRK6A.cjs} +9 -9
- package/dist/{chunk-2PUJGVJ6.cjs.map → chunk-Q4MXRK6A.cjs.map} +1 -1
- package/dist/{chunk-GW2DPIPL.js → chunk-U5RVSIFG.js} +3 -3
- package/dist/{chunk-GW2DPIPL.js.map → chunk-U5RVSIFG.js.map} +1 -1
- package/dist/{chunk-O64KMVIO.cjs → chunk-VUUIS5C7.cjs} +22 -22
- package/dist/{chunk-O64KMVIO.cjs.map → chunk-VUUIS5C7.cjs.map} +1 -1
- package/dist/{chunk-O7C44O4P.js → chunk-W2L5N4ES.js} +3 -3
- package/dist/{chunk-O7C44O4P.js.map → chunk-W2L5N4ES.js.map} +1 -1
- package/dist/{chunk-5E2PKOPM.js → chunk-XTHWIDRM.js} +4 -4
- package/dist/{chunk-5E2PKOPM.js.map → chunk-XTHWIDRM.js.map} +1 -1
- package/dist/{chunk-TVOQ2DGB.cjs → chunk-XZJDI4OR.cjs} +255 -255
- package/dist/{chunk-TVOQ2DGB.cjs.map → chunk-XZJDI4OR.cjs.map} +1 -1
- package/dist/{chunk-A7YKBSKQ.cjs → chunk-ZO72TBQE.cjs} +13 -13
- package/dist/{chunk-A7YKBSKQ.cjs.map → chunk-ZO72TBQE.cjs.map} +1 -1
- package/dist/{chunk-FFGW5GXR.js → chunk-ZX72XWSA.js} +3 -3
- package/dist/{chunk-FFGW5GXR.js.map → chunk-ZX72XWSA.js.map} +1 -1
- package/dist/graph-merge/index.cjs +31 -31
- package/dist/graph-merge/index.js +5 -5
- package/dist/index.cjs +52 -52
- package/dist/index.js +5 -5
- package/dist/interchange/index.cjs +26 -26
- package/dist/interchange/index.js +3 -3
- package/dist/{local-store-impl-MJR2DXZT.cjs → local-store-impl-VR7YQUMB.cjs} +7 -7
- package/dist/{local-store-impl-MJR2DXZT.cjs.map → local-store-impl-VR7YQUMB.cjs.map} +1 -1
- package/dist/{local-store-impl-U4MDR2N4.js → local-store-impl-Y3Q5HWSR.js} +6 -6
- package/dist/{local-store-impl-U4MDR2N4.js.map → local-store-impl-Y3Q5HWSR.js.map} +1 -1
- package/dist/{pglite-store-impl-RTAPLRQO.cjs → pglite-store-impl-NMSOMDPC.cjs} +7 -7
- package/dist/{pglite-store-impl-RTAPLRQO.cjs.map → pglite-store-impl-NMSOMDPC.cjs.map} +1 -1
- package/dist/{pglite-store-impl-QLLFPNO6.js → pglite-store-impl-QNGEP62P.js} +6 -6
- package/dist/{pglite-store-impl-QLLFPNO6.js.map → pglite-store-impl-QNGEP62P.js.map} +1 -1
- package/dist/schema/index.cjs +25 -25
- package/dist/schema/index.js +3 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { buildValidatedKindRegistry } from './chunk-
|
|
1
|
+
import { buildValidatedKindRegistry } from './chunk-U5RVSIFG.js';
|
|
2
2
|
import { serializeSchema, computeSchemaHash } from './chunk-XGU5I2MH.js';
|
|
3
3
|
import { resolveGraphVectorSlots } from './chunk-PC2UBAUB.js';
|
|
4
4
|
import { hasOwnKey } from './chunk-QD2JFTSL.js';
|
|
@@ -188,5 +188,5 @@ function graphTemplatesUnsupportedError(backend) {
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
export { deserializeSchema, instantiateGraph, instantiateGraphTemplate, registerGraphTemplate };
|
|
191
|
-
//# sourceMappingURL=chunk-
|
|
192
|
-
//# sourceMappingURL=chunk-
|
|
191
|
+
//# sourceMappingURL=chunk-ZX72XWSA.js.map
|
|
192
|
+
//# sourceMappingURL=chunk-ZX72XWSA.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,SAAA,CAAU,MAAA,CAAO,KAAA,E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":"chunk-FFGW5GXR.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,QAAA,CAAS,SAAA,CAAU,IAAI,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,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-ZX72XWSA.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,19 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkXZJDI4OR_cjs = require('../chunk-XZJDI4OR.cjs');
|
|
4
4
|
var chunkRQXQ2RK5_cjs = require('../chunk-RQXQ2RK5.cjs');
|
|
5
5
|
require('../chunk-B5C2V2LN.cjs');
|
|
6
|
-
var
|
|
7
|
-
require('../chunk-
|
|
6
|
+
var chunkVUUIS5C7_cjs = require('../chunk-VUUIS5C7.cjs');
|
|
7
|
+
require('../chunk-Q4MXRK6A.cjs');
|
|
8
8
|
require('../chunk-RFRKNBIO.cjs');
|
|
9
9
|
require('../chunk-4DI7FJG6.cjs');
|
|
10
10
|
require('../chunk-RJHEBE5W.cjs');
|
|
11
11
|
require('../chunk-R255UE5U.cjs');
|
|
12
12
|
require('../chunk-AY2X2567.cjs');
|
|
13
|
-
require('../chunk-
|
|
13
|
+
require('../chunk-ZO72TBQE.cjs');
|
|
14
14
|
require('../chunk-6YKISECL.cjs');
|
|
15
15
|
require('../chunk-HGIG6XJW.cjs');
|
|
16
|
-
var
|
|
16
|
+
var chunkH3ULZVTX_cjs = require('../chunk-H3ULZVTX.cjs');
|
|
17
17
|
var chunkQEXVOTI2_cjs = require('../chunk-QEXVOTI2.cjs');
|
|
18
18
|
var chunkXFX3Z5R7_cjs = require('../chunk-XFX3Z5R7.cjs');
|
|
19
19
|
var chunkMYE7SL75_cjs = require('../chunk-MYE7SL75.cjs');
|
|
@@ -810,7 +810,7 @@ function identityEndpointKey(assertion) {
|
|
|
810
810
|
return chunkDUN24DFZ_cjs.encodeTupleKey(endpointTuple(assertion));
|
|
811
811
|
}
|
|
812
812
|
function identitySemanticKey(assertion) {
|
|
813
|
-
return
|
|
813
|
+
return chunkH3ULZVTX_cjs.identityAssertionSemanticKey(
|
|
814
814
|
assertion.relation,
|
|
815
815
|
assertion.a,
|
|
816
816
|
assertion.b
|
|
@@ -874,7 +874,7 @@ function assertNoOpposingIdentityRelations(assertions) {
|
|
|
874
874
|
);
|
|
875
875
|
for (const sameAssertion of same) {
|
|
876
876
|
for (const differentAssertion of different) {
|
|
877
|
-
if (!
|
|
877
|
+
if (!chunkH3ULZVTX_cjs.identityValidityWindowsOverlap(sameAssertion, differentAssertion)) {
|
|
878
878
|
continue;
|
|
879
879
|
}
|
|
880
880
|
throw new IdentityMergeConflictError(
|
|
@@ -1034,7 +1034,7 @@ function remapIdentityAssertionEndpoints(assertions, canonicalOf, retypeMap, sto
|
|
|
1034
1034
|
);
|
|
1035
1035
|
continue;
|
|
1036
1036
|
}
|
|
1037
|
-
const [a, b] =
|
|
1037
|
+
const [a, b] = chunkH3ULZVTX_cjs.normalizeIdentityPair(remappedA, remappedB);
|
|
1038
1038
|
const endpointWindowA = endpointWindows.get(mergeKeyOf(a));
|
|
1039
1039
|
const endpointWindowB = endpointWindows.get(mergeKeyOf(b));
|
|
1040
1040
|
const validFrom = [
|
|
@@ -1218,7 +1218,7 @@ async function snapshotIdentityClasses(target, seeds, liveKeys, plannedDeletions
|
|
|
1218
1218
|
const groups = [];
|
|
1219
1219
|
for (const seed of seeds) {
|
|
1220
1220
|
const key = mergeKey(seed.kind, seed.id);
|
|
1221
|
-
const members = (classes.get(
|
|
1221
|
+
const members = (classes.get(chunkH3ULZVTX_cjs.identityReferenceKey(seed)) ?? [seed]).filter(
|
|
1222
1222
|
(member) => !plannedDeletions.has(mergeKey(member.kind, member.id))
|
|
1223
1223
|
);
|
|
1224
1224
|
groups.push(members);
|
|
@@ -2159,7 +2159,7 @@ function cloneWorkingCopyWithGraphStrategy(makeBackend, graphForClone, options =
|
|
|
2159
2159
|
create: async (baseStore) => {
|
|
2160
2160
|
const backend = await makeBackend();
|
|
2161
2161
|
try {
|
|
2162
|
-
const [freshStore] = await
|
|
2162
|
+
const [freshStore] = await chunkXZJDI4OR_cjs.createStoreWithSchema(
|
|
2163
2163
|
graphForClone(baseStore),
|
|
2164
2164
|
backend,
|
|
2165
2165
|
{
|
|
@@ -2198,18 +2198,18 @@ function cloneWorkingCopyWithGraphStrategy(makeBackend, graphForClone, options =
|
|
|
2198
2198
|
const result = chunkAZ2Q6RRS_cjs.snapshotExportContention(
|
|
2199
2199
|
chunkQEXVOTI2_cjs.storeBackend(baseStore),
|
|
2200
2200
|
chunkQEXVOTI2_cjs.storeBackend(freshStore)
|
|
2201
|
-
) === void 0 ? await
|
|
2201
|
+
) === void 0 ? await chunkVUUIS5C7_cjs.importGraphStream(
|
|
2202
2202
|
freshStore,
|
|
2203
|
-
|
|
2203
|
+
chunkVUUIS5C7_cjs.exportGraphStream(baseStore, exportOptions),
|
|
2204
2204
|
importOptions
|
|
2205
|
-
) : await
|
|
2205
|
+
) : await chunkVUUIS5C7_cjs.importGraph(
|
|
2206
2206
|
freshStore,
|
|
2207
|
-
await
|
|
2207
|
+
await chunkVUUIS5C7_cjs.exportGraph(baseStore, exportOptions),
|
|
2208
2208
|
importOptions
|
|
2209
2209
|
);
|
|
2210
2210
|
if (!result.success) {
|
|
2211
2211
|
throw new BranchError(
|
|
2212
|
-
`Clone import failed: the working copy could not be seeded from the base store. ${
|
|
2212
|
+
`Clone import failed: the working copy could not be seeded from the base store. ${chunkVUUIS5C7_cjs.summarizeImportErrors(result.errors)}`,
|
|
2213
2213
|
{ details: { errors: result.errors } }
|
|
2214
2214
|
);
|
|
2215
2215
|
}
|
|
@@ -2294,7 +2294,7 @@ function forkedWorkingCopyStrategy(options) {
|
|
|
2294
2294
|
{ details: { inheritedTables, connectedTables } }
|
|
2295
2295
|
);
|
|
2296
2296
|
}
|
|
2297
|
-
const forkStore =
|
|
2297
|
+
const forkStore = chunkXZJDI4OR_cjs.createStore(baseStore.graph, backend, forkOptions);
|
|
2298
2298
|
await assertWorkingCopyMatchesBase(forkStore, base);
|
|
2299
2299
|
return forkStore;
|
|
2300
2300
|
} catch (error) {
|
|
@@ -2436,7 +2436,7 @@ async function ingestionBranch(baseStore, makeBackend, options) {
|
|
|
2436
2436
|
close: coalescedWorkingCopyClose(store)
|
|
2437
2437
|
});
|
|
2438
2438
|
PRIVATE_BRANCHES.set(handle, privateBranch);
|
|
2439
|
-
|
|
2439
|
+
chunkVUUIS5C7_cjs.registerIngestionImportTarget(handle, store);
|
|
2440
2440
|
return chunkNMV6P6EU_cjs.ok(handle);
|
|
2441
2441
|
} catch (error) {
|
|
2442
2442
|
return chunkNMV6P6EU_cjs.err(
|
|
@@ -2482,8 +2482,8 @@ async function assertMergeTransactionPristine(target, txBackend) {
|
|
|
2482
2482
|
|
|
2483
2483
|
// src/graph-merge/apply-callbacks.ts
|
|
2484
2484
|
var NODE_READ_NAMES = [
|
|
2485
|
-
...
|
|
2486
|
-
...
|
|
2485
|
+
...chunkXZJDI4OR_cjs.NODE_TEMPORAL_READ_NAMES,
|
|
2486
|
+
...chunkXZJDI4OR_cjs.CURRENT_ONLY_READ_NAMES
|
|
2487
2487
|
];
|
|
2488
2488
|
function pickReadMethods(source, names) {
|
|
2489
2489
|
return Object.fromEntries(names.map((name) => [name, source[name]]));
|
|
@@ -2501,12 +2501,12 @@ function mergePlanReadContext(tx, graph) {
|
|
|
2501
2501
|
kind,
|
|
2502
2502
|
pickReadMethods(
|
|
2503
2503
|
chunkBXHAPCQG_cjs.requireDefined(tx.edges[kind]),
|
|
2504
|
-
|
|
2504
|
+
chunkXZJDI4OR_cjs.EDGE_TEMPORAL_READ_NAMES
|
|
2505
2505
|
)
|
|
2506
2506
|
])
|
|
2507
2507
|
),
|
|
2508
2508
|
..."identity" in tx ? {
|
|
2509
|
-
identity: pickReadMethods(tx.identity,
|
|
2509
|
+
identity: pickReadMethods(tx.identity, chunkXZJDI4OR_cjs.IDENTITY_READ_NAMES)
|
|
2510
2510
|
} : {}
|
|
2511
2511
|
};
|
|
2512
2512
|
}
|
|
@@ -4653,7 +4653,7 @@ function createRecordedBaseReader(target, recorded) {
|
|
|
4653
4653
|
);
|
|
4654
4654
|
});
|
|
4655
4655
|
return uniqueRowsById(rows, "identity assertion").map(
|
|
4656
|
-
(row) =>
|
|
4656
|
+
(row) => chunkH3ULZVTX_cjs.toTransferAssertion(chunkH3ULZVTX_cjs.normalizeIdentityAssertionRow(row))
|
|
4657
4657
|
);
|
|
4658
4658
|
}
|
|
4659
4659
|
function readIdentity(mode) {
|
|
@@ -5471,7 +5471,7 @@ async function openProvenanceStore(...args) {
|
|
|
5471
5471
|
throw provenanceGraphIdCollision(graph.id, targetGraphId, claim.reason);
|
|
5472
5472
|
}
|
|
5473
5473
|
}
|
|
5474
|
-
const [store] = await
|
|
5474
|
+
const [store] = await chunkXZJDI4OR_cjs.createStoreWithSchema(graph, backend);
|
|
5475
5475
|
return store;
|
|
5476
5476
|
}
|
|
5477
5477
|
async function claimSidecarOwnership(backend, graph, targetGraphId) {
|
|
@@ -9959,7 +9959,7 @@ var CandidateWriteSetSchema = zod.z.object({
|
|
|
9959
9959
|
target: CandidateWriteSetTargetSchema,
|
|
9960
9960
|
nodes: zod.z.array(candidateNodeSchema),
|
|
9961
9961
|
edges: zod.z.array(candidateEdgeSchema),
|
|
9962
|
-
identity:
|
|
9962
|
+
identity: chunkVUUIS5C7_cjs.InterchangeIdentitySchema.optional()
|
|
9963
9963
|
});
|
|
9964
9964
|
async function captureCandidateWriteSetTarget(target) {
|
|
9965
9965
|
const activeSchema = await chunkQEXVOTI2_cjs.storeBackend(target).getActiveSchema(
|
|
@@ -10052,7 +10052,7 @@ async function planCandidateWriteSet(args) {
|
|
|
10052
10052
|
}
|
|
10053
10053
|
const candidate = created.data;
|
|
10054
10054
|
try {
|
|
10055
|
-
const imported = await
|
|
10055
|
+
const imported = await chunkVUUIS5C7_cjs.importGraph(
|
|
10056
10056
|
candidate,
|
|
10057
10057
|
interchangeDocument(writeSet),
|
|
10058
10058
|
{
|
|
@@ -10152,7 +10152,7 @@ async function planCandidateWriteSetForEvolution(args) {
|
|
|
10152
10152
|
}
|
|
10153
10153
|
const candidate = created.data;
|
|
10154
10154
|
try {
|
|
10155
|
-
const imported = await
|
|
10155
|
+
const imported = await chunkVUUIS5C7_cjs.importGraph(
|
|
10156
10156
|
candidate,
|
|
10157
10157
|
interchangeDocument(writeSet),
|
|
10158
10158
|
{
|
|
@@ -11701,7 +11701,7 @@ async function digestGraph(session, graph) {
|
|
|
11701
11701
|
return chunkZY4GXIVN_cjs.sha256Hex(JSON.stringify(digests), 32);
|
|
11702
11702
|
}
|
|
11703
11703
|
function vectorIndexSlot(declaration, graphId) {
|
|
11704
|
-
const { concurrent: _concurrent, ...slot } =
|
|
11704
|
+
const { concurrent: _concurrent, ...slot } = chunkXZJDI4OR_cjs.vectorIndexParams(
|
|
11705
11705
|
declaration,
|
|
11706
11706
|
graphId,
|
|
11707
11707
|
false
|
|
@@ -11711,7 +11711,7 @@ function vectorIndexSlot(declaration, graphId) {
|
|
|
11711
11711
|
function declarationsByStatusKey(graph) {
|
|
11712
11712
|
return new Map(
|
|
11713
11713
|
(graph.indexes ?? []).map((declaration) => [
|
|
11714
|
-
|
|
11714
|
+
chunkXZJDI4OR_cjs.indexMaterializationStatusKey(declaration, graph.id),
|
|
11715
11715
|
declaration
|
|
11716
11716
|
])
|
|
11717
11717
|
);
|
|
@@ -11958,12 +11958,12 @@ async function prepareNamespaceForkTarget(source, targetBackend) {
|
|
|
11958
11958
|
continue;
|
|
11959
11959
|
}
|
|
11960
11960
|
if (declaration.method === "trigram")
|
|
11961
|
-
await
|
|
11961
|
+
await chunkXZJDI4OR_cjs.ensureTrigramExtension(targetBackend);
|
|
11962
11962
|
await executeDdl(
|
|
11963
11963
|
chunkZ4RMBXIM_cjs.generateIndexDDL(
|
|
11964
11964
|
declaration,
|
|
11965
11965
|
targetBackend.dialect,
|
|
11966
|
-
|
|
11966
|
+
chunkXZJDI4OR_cjs.relationalIndexDdlOptions(targetBackend, false)
|
|
11967
11967
|
)
|
|
11968
11968
|
);
|
|
11969
11969
|
}
|
|
@@ -11993,7 +11993,7 @@ async function forkGraphNamespace(source, targetBackend, operationKey) {
|
|
|
11993
11993
|
assertDefaultTables(targetBackend);
|
|
11994
11994
|
assertMatchingVectorStorage(source.graph, sourceBackend, targetBackend);
|
|
11995
11995
|
assertDefaultNameMap(source.revisionSchema.tables);
|
|
11996
|
-
const targetStore =
|
|
11996
|
+
const targetStore = chunkXZJDI4OR_cjs.createStore(
|
|
11997
11997
|
source.graph,
|
|
11998
11998
|
targetBackend,
|
|
11999
11999
|
targetStoreOptions(source)
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { NODE_TEMPORAL_READ_NAMES, CURRENT_ONLY_READ_NAMES, createStoreWithSchema, createStore, ensureTrigramExtension, relationalIndexDdlOptions, vectorIndexParams, indexMaterializationStatusKey, IDENTITY_READ_NAMES, EDGE_TEMPORAL_READ_NAMES } from '../chunk-
|
|
1
|
+
import { NODE_TEMPORAL_READ_NAMES, CURRENT_ONLY_READ_NAMES, createStoreWithSchema, createStore, ensureTrigramExtension, relationalIndexDdlOptions, vectorIndexParams, indexMaterializationStatusKey, IDENTITY_READ_NAMES, EDGE_TEMPORAL_READ_NAMES } from '../chunk-EPXW4ONY.js';
|
|
2
2
|
import { pgvectorStrategy, pgvectorIndexName } from '../chunk-LWBG4KMV.js';
|
|
3
3
|
import '../chunk-TR2KKEE2.js';
|
|
4
|
-
import { InterchangeIdentitySchema, importGraphStream, exportGraphStream, importGraph, exportGraph, summarizeImportErrors, registerIngestionImportTarget } from '../chunk-
|
|
5
|
-
import '../chunk-
|
|
4
|
+
import { InterchangeIdentitySchema, importGraphStream, exportGraphStream, importGraph, exportGraph, summarizeImportErrors, registerIngestionImportTarget } from '../chunk-XTHWIDRM.js';
|
|
5
|
+
import '../chunk-NMDDGDMQ.js';
|
|
6
6
|
import '../chunk-QF3JP7JL.js';
|
|
7
7
|
import '../chunk-6HEZFGA2.js';
|
|
8
8
|
import '../chunk-ERBQL3RT.js';
|
|
9
9
|
import '../chunk-N535PWMA.js';
|
|
10
10
|
import '../chunk-MOBZHLQB.js';
|
|
11
|
-
import '../chunk-
|
|
11
|
+
import '../chunk-U5RVSIFG.js';
|
|
12
12
|
import '../chunk-RFMSZ7CF.js';
|
|
13
13
|
import '../chunk-UJLNQ5A5.js';
|
|
14
|
-
import { normalizeIdentityPair, identityReferenceKey, toTransferAssertion, normalizeIdentityAssertionRow, identityValidityWindowsOverlap, identityAssertionSemanticKey } from '../chunk-
|
|
14
|
+
import { normalizeIdentityPair, identityReferenceKey, toTransferAssertion, normalizeIdentityAssertionRow, identityValidityWindowsOverlap, identityAssertionSemanticKey } from '../chunk-W2L5N4ES.js';
|
|
15
15
|
import { storeBackend, resolveLineage, ensureRevisionOrigin, storeRuntime, generateId, resolveEvolvedTransactionStore, transactionBackend, storeCaptureEnabled, hasPendingRecordedGraphWrites, hasPendingWriteTransactionRevision, ensureEngineSerializedWriterSlot, readRevisionOrigin, readRecordedClock, forceRecordedGraphRevision, forceWriteTransactionRevision, advanceRevisionClock, getNodeRowsByIds, getEdgeRowsByIds, lockSchemaVersionForStoreWrite, lockRecordedGraphWrite, refuseEngineNativeRecordedIdentityRead, recordedRelationsLineage, encodeRecordedLineageRevision } from '../chunk-2HE3UZEM.js';
|
|
16
16
|
import { runRetriedUnit } from '../chunk-6TFLRXRV.js';
|
|
17
17
|
import { recordedRevisionOriginsVerdict, statementExecutionVerdict, batchPointReadVerdict } from '../chunk-3C4X6DTM.js';
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkXZJDI4OR_cjs = require('./chunk-XZJDI4OR.cjs');
|
|
4
4
|
var chunk6DPKYRAO_cjs = require('./chunk-6DPKYRAO.cjs');
|
|
5
5
|
var chunk5754SL4T_cjs = require('./chunk-5754SL4T.cjs');
|
|
6
6
|
var chunkRQXQ2RK5_cjs = require('./chunk-RQXQ2RK5.cjs');
|
|
@@ -8,17 +8,17 @@ var chunk46NOWHKA_cjs = require('./chunk-46NOWHKA.cjs');
|
|
|
8
8
|
require('./chunk-B5C2V2LN.cjs');
|
|
9
9
|
var chunkWIV73HDP_cjs = require('./chunk-WIV73HDP.cjs');
|
|
10
10
|
var chunk5SQV666T_cjs = require('./chunk-5SQV666T.cjs');
|
|
11
|
-
require('./chunk-
|
|
11
|
+
require('./chunk-Q4MXRK6A.cjs');
|
|
12
12
|
require('./chunk-RFRKNBIO.cjs');
|
|
13
13
|
require('./chunk-4DI7FJG6.cjs');
|
|
14
14
|
require('./chunk-RJHEBE5W.cjs');
|
|
15
15
|
require('./chunk-R255UE5U.cjs');
|
|
16
16
|
require('./chunk-AY2X2567.cjs');
|
|
17
|
-
var
|
|
18
|
-
var
|
|
17
|
+
var chunkD6J4Z423_cjs = require('./chunk-D6J4Z423.cjs');
|
|
18
|
+
var chunkZO72TBQE_cjs = require('./chunk-ZO72TBQE.cjs');
|
|
19
19
|
require('./chunk-6YKISECL.cjs');
|
|
20
20
|
var chunkHGIG6XJW_cjs = require('./chunk-HGIG6XJW.cjs');
|
|
21
|
-
require('./chunk-
|
|
21
|
+
require('./chunk-H3ULZVTX.cjs');
|
|
22
22
|
var chunkQEXVOTI2_cjs = require('./chunk-QEXVOTI2.cjs');
|
|
23
23
|
var chunkXFX3Z5R7_cjs = require('./chunk-XFX3Z5R7.cjs');
|
|
24
24
|
require('./chunk-MYE7SL75.cjs');
|
|
@@ -274,167 +274,167 @@ function decodeEmbeddingJson(row) {
|
|
|
274
274
|
|
|
275
275
|
Object.defineProperty(exports, "ExecutableAggregateQuery", {
|
|
276
276
|
enumerable: true,
|
|
277
|
-
get: function () { return
|
|
277
|
+
get: function () { return chunkXZJDI4OR_cjs.ExecutableAggregateQuery; }
|
|
278
278
|
});
|
|
279
279
|
Object.defineProperty(exports, "ExecutableProjectionQuery", {
|
|
280
280
|
enumerable: true,
|
|
281
|
-
get: function () { return
|
|
281
|
+
get: function () { return chunkXZJDI4OR_cjs.ExecutableProjectionQuery; }
|
|
282
282
|
});
|
|
283
283
|
Object.defineProperty(exports, "ExecutableQuery", {
|
|
284
284
|
enumerable: true,
|
|
285
|
-
get: function () { return
|
|
285
|
+
get: function () { return chunkXZJDI4OR_cjs.ExecutableQuery; }
|
|
286
286
|
});
|
|
287
287
|
Object.defineProperty(exports, "ExecutableRelationQuery", {
|
|
288
288
|
enumerable: true,
|
|
289
|
-
get: function () { return
|
|
289
|
+
get: function () { return chunkXZJDI4OR_cjs.ExecutableRelationQuery; }
|
|
290
290
|
});
|
|
291
291
|
Object.defineProperty(exports, "MAX_EXPLICIT_RECURSIVE_DEPTH", {
|
|
292
292
|
enumerable: true,
|
|
293
|
-
get: function () { return
|
|
293
|
+
get: function () { return chunkXZJDI4OR_cjs.MAX_EXPLICIT_RECURSIVE_DEPTH; }
|
|
294
294
|
});
|
|
295
295
|
Object.defineProperty(exports, "MAX_RECURSIVE_DEPTH", {
|
|
296
296
|
enumerable: true,
|
|
297
|
-
get: function () { return
|
|
297
|
+
get: function () { return chunkXZJDI4OR_cjs.MAX_RECURSIVE_DEPTH; }
|
|
298
298
|
});
|
|
299
299
|
Object.defineProperty(exports, "PreparedQuery", {
|
|
300
300
|
enumerable: true,
|
|
301
|
-
get: function () { return
|
|
301
|
+
get: function () { return chunkXZJDI4OR_cjs.PreparedQuery; }
|
|
302
302
|
});
|
|
303
303
|
Object.defineProperty(exports, "QueryBuilder", {
|
|
304
304
|
enumerable: true,
|
|
305
|
-
get: function () { return
|
|
305
|
+
get: function () { return chunkXZJDI4OR_cjs.QueryBuilder; }
|
|
306
306
|
});
|
|
307
307
|
Object.defineProperty(exports, "RecordedStoreView", {
|
|
308
308
|
enumerable: true,
|
|
309
|
-
get: function () { return
|
|
309
|
+
get: function () { return chunkXZJDI4OR_cjs.RecordedStoreView; }
|
|
310
310
|
});
|
|
311
311
|
Object.defineProperty(exports, "StoreAnalysisCursorStaleError", {
|
|
312
312
|
enumerable: true,
|
|
313
|
-
get: function () { return
|
|
313
|
+
get: function () { return chunkXZJDI4OR_cjs.StoreAnalysisCursorStaleError; }
|
|
314
314
|
});
|
|
315
315
|
Object.defineProperty(exports, "StoreSearch", {
|
|
316
316
|
enumerable: true,
|
|
317
|
-
get: function () { return
|
|
317
|
+
get: function () { return chunkXZJDI4OR_cjs.StoreSearch; }
|
|
318
318
|
});
|
|
319
319
|
Object.defineProperty(exports, "StoreView", {
|
|
320
320
|
enumerable: true,
|
|
321
|
-
get: function () { return
|
|
321
|
+
get: function () { return chunkXZJDI4OR_cjs.StoreView; }
|
|
322
322
|
});
|
|
323
323
|
Object.defineProperty(exports, "UnionableQuery", {
|
|
324
324
|
enumerable: true,
|
|
325
|
-
get: function () { return
|
|
325
|
+
get: function () { return chunkXZJDI4OR_cjs.UnionableQuery; }
|
|
326
326
|
});
|
|
327
327
|
Object.defineProperty(exports, "avg", {
|
|
328
328
|
enumerable: true,
|
|
329
|
-
get: function () { return
|
|
329
|
+
get: function () { return chunkXZJDI4OR_cjs.avg; }
|
|
330
330
|
});
|
|
331
331
|
Object.defineProperty(exports, "composeFragments", {
|
|
332
332
|
enumerable: true,
|
|
333
|
-
get: function () { return
|
|
333
|
+
get: function () { return chunkXZJDI4OR_cjs.composeFragments; }
|
|
334
334
|
});
|
|
335
335
|
Object.defineProperty(exports, "count", {
|
|
336
336
|
enumerable: true,
|
|
337
|
-
get: function () { return
|
|
337
|
+
get: function () { return chunkXZJDI4OR_cjs.count; }
|
|
338
338
|
});
|
|
339
339
|
Object.defineProperty(exports, "countDistinct", {
|
|
340
340
|
enumerable: true,
|
|
341
|
-
get: function () { return
|
|
341
|
+
get: function () { return chunkXZJDI4OR_cjs.countDistinct; }
|
|
342
342
|
});
|
|
343
343
|
Object.defineProperty(exports, "countDistinctEdges", {
|
|
344
344
|
enumerable: true,
|
|
345
|
-
get: function () { return
|
|
345
|
+
get: function () { return chunkXZJDI4OR_cjs.countDistinctEdges; }
|
|
346
346
|
});
|
|
347
347
|
Object.defineProperty(exports, "countEdges", {
|
|
348
348
|
enumerable: true,
|
|
349
|
-
get: function () { return
|
|
349
|
+
get: function () { return chunkXZJDI4OR_cjs.countEdges; }
|
|
350
350
|
});
|
|
351
351
|
Object.defineProperty(exports, "createAdapterStore", {
|
|
352
352
|
enumerable: true,
|
|
353
|
-
get: function () { return
|
|
353
|
+
get: function () { return chunkXZJDI4OR_cjs.createAdapterStore; }
|
|
354
354
|
});
|
|
355
355
|
Object.defineProperty(exports, "createAdapterStoreWithSchema", {
|
|
356
356
|
enumerable: true,
|
|
357
|
-
get: function () { return
|
|
357
|
+
get: function () { return chunkXZJDI4OR_cjs.createAdapterStoreWithSchema; }
|
|
358
358
|
});
|
|
359
359
|
Object.defineProperty(exports, "createFragment", {
|
|
360
360
|
enumerable: true,
|
|
361
|
-
get: function () { return
|
|
361
|
+
get: function () { return chunkXZJDI4OR_cjs.createFragment; }
|
|
362
362
|
});
|
|
363
363
|
Object.defineProperty(exports, "createQueryBuilder", {
|
|
364
364
|
enumerable: true,
|
|
365
|
-
get: function () { return
|
|
365
|
+
get: function () { return chunkXZJDI4OR_cjs.createQueryBuilder; }
|
|
366
366
|
});
|
|
367
367
|
Object.defineProperty(exports, "createStore", {
|
|
368
368
|
enumerable: true,
|
|
369
|
-
get: function () { return
|
|
369
|
+
get: function () { return chunkXZJDI4OR_cjs.createStore; }
|
|
370
370
|
});
|
|
371
371
|
Object.defineProperty(exports, "createStoreWithSchema", {
|
|
372
372
|
enumerable: true,
|
|
373
|
-
get: function () { return
|
|
373
|
+
get: function () { return chunkXZJDI4OR_cjs.createStoreWithSchema; }
|
|
374
374
|
});
|
|
375
375
|
Object.defineProperty(exports, "createVerifiedAdapterStore", {
|
|
376
376
|
enumerable: true,
|
|
377
|
-
get: function () { return
|
|
377
|
+
get: function () { return chunkXZJDI4OR_cjs.createVerifiedAdapterStore; }
|
|
378
378
|
});
|
|
379
379
|
Object.defineProperty(exports, "createVerifiedStore", {
|
|
380
380
|
enumerable: true,
|
|
381
|
-
get: function () { return
|
|
381
|
+
get: function () { return chunkXZJDI4OR_cjs.createVerifiedStore; }
|
|
382
382
|
});
|
|
383
383
|
Object.defineProperty(exports, "defineSubgraphProject", {
|
|
384
384
|
enumerable: true,
|
|
385
|
-
get: function () { return
|
|
385
|
+
get: function () { return chunkXZJDI4OR_cjs.defineSubgraphProject; }
|
|
386
386
|
});
|
|
387
387
|
Object.defineProperty(exports, "field", {
|
|
388
388
|
enumerable: true,
|
|
389
|
-
get: function () { return
|
|
389
|
+
get: function () { return chunkXZJDI4OR_cjs.field; }
|
|
390
390
|
});
|
|
391
391
|
Object.defineProperty(exports, "having", {
|
|
392
392
|
enumerable: true,
|
|
393
|
-
get: function () { return
|
|
393
|
+
get: function () { return chunkXZJDI4OR_cjs.having; }
|
|
394
394
|
});
|
|
395
395
|
Object.defineProperty(exports, "havingEq", {
|
|
396
396
|
enumerable: true,
|
|
397
|
-
get: function () { return
|
|
397
|
+
get: function () { return chunkXZJDI4OR_cjs.havingEq; }
|
|
398
398
|
});
|
|
399
399
|
Object.defineProperty(exports, "havingGt", {
|
|
400
400
|
enumerable: true,
|
|
401
|
-
get: function () { return
|
|
401
|
+
get: function () { return chunkXZJDI4OR_cjs.havingGt; }
|
|
402
402
|
});
|
|
403
403
|
Object.defineProperty(exports, "havingGte", {
|
|
404
404
|
enumerable: true,
|
|
405
|
-
get: function () { return
|
|
405
|
+
get: function () { return chunkXZJDI4OR_cjs.havingGte; }
|
|
406
406
|
});
|
|
407
407
|
Object.defineProperty(exports, "havingLt", {
|
|
408
408
|
enumerable: true,
|
|
409
|
-
get: function () { return
|
|
409
|
+
get: function () { return chunkXZJDI4OR_cjs.havingLt; }
|
|
410
410
|
});
|
|
411
411
|
Object.defineProperty(exports, "havingLte", {
|
|
412
412
|
enumerable: true,
|
|
413
|
-
get: function () { return
|
|
413
|
+
get: function () { return chunkXZJDI4OR_cjs.havingLte; }
|
|
414
414
|
});
|
|
415
415
|
Object.defineProperty(exports, "limitFragment", {
|
|
416
416
|
enumerable: true,
|
|
417
|
-
get: function () { return
|
|
417
|
+
get: function () { return chunkXZJDI4OR_cjs.limitFragment; }
|
|
418
418
|
});
|
|
419
419
|
Object.defineProperty(exports, "max", {
|
|
420
420
|
enumerable: true,
|
|
421
|
-
get: function () { return
|
|
421
|
+
get: function () { return chunkXZJDI4OR_cjs.max; }
|
|
422
422
|
});
|
|
423
423
|
Object.defineProperty(exports, "min", {
|
|
424
424
|
enumerable: true,
|
|
425
|
-
get: function () { return
|
|
425
|
+
get: function () { return chunkXZJDI4OR_cjs.min; }
|
|
426
426
|
});
|
|
427
427
|
Object.defineProperty(exports, "offsetFragment", {
|
|
428
428
|
enumerable: true,
|
|
429
|
-
get: function () { return
|
|
429
|
+
get: function () { return chunkXZJDI4OR_cjs.offsetFragment; }
|
|
430
430
|
});
|
|
431
431
|
Object.defineProperty(exports, "orderByFragment", {
|
|
432
432
|
enumerable: true,
|
|
433
|
-
get: function () { return
|
|
433
|
+
get: function () { return chunkXZJDI4OR_cjs.orderByFragment; }
|
|
434
434
|
});
|
|
435
435
|
Object.defineProperty(exports, "sum", {
|
|
436
436
|
enumerable: true,
|
|
437
|
-
get: function () { return
|
|
437
|
+
get: function () { return chunkXZJDI4OR_cjs.sum; }
|
|
438
438
|
});
|
|
439
439
|
Object.defineProperty(exports, "sqliteVecStrategy", {
|
|
440
440
|
enumerable: true,
|
|
@@ -486,27 +486,27 @@ Object.defineProperty(exports, "metaEdge", {
|
|
|
486
486
|
});
|
|
487
487
|
Object.defineProperty(exports, "instantiateGraph", {
|
|
488
488
|
enumerable: true,
|
|
489
|
-
get: function () { return
|
|
489
|
+
get: function () { return chunkD6J4Z423_cjs.instantiateGraph; }
|
|
490
490
|
});
|
|
491
491
|
Object.defineProperty(exports, "instantiateGraphTemplate", {
|
|
492
492
|
enumerable: true,
|
|
493
|
-
get: function () { return
|
|
493
|
+
get: function () { return chunkD6J4Z423_cjs.instantiateGraphTemplate; }
|
|
494
494
|
});
|
|
495
495
|
Object.defineProperty(exports, "registerGraphTemplate", {
|
|
496
496
|
enumerable: true,
|
|
497
|
-
get: function () { return
|
|
497
|
+
get: function () { return chunkD6J4Z423_cjs.registerGraphTemplate; }
|
|
498
498
|
});
|
|
499
499
|
Object.defineProperty(exports, "getActiveSchema", {
|
|
500
500
|
enumerable: true,
|
|
501
|
-
get: function () { return
|
|
501
|
+
get: function () { return chunkZO72TBQE_cjs.getActiveSchema; }
|
|
502
502
|
});
|
|
503
503
|
Object.defineProperty(exports, "getCommittedSchemaVersion", {
|
|
504
504
|
enumerable: true,
|
|
505
|
-
get: function () { return
|
|
505
|
+
get: function () { return chunkZO72TBQE_cjs.getCommittedSchemaVersion; }
|
|
506
506
|
});
|
|
507
507
|
Object.defineProperty(exports, "isSchemaInitialized", {
|
|
508
508
|
enumerable: true,
|
|
509
|
-
get: function () { return
|
|
509
|
+
get: function () { return chunkZO72TBQE_cjs.isSchemaInitialized; }
|
|
510
510
|
});
|
|
511
511
|
Object.defineProperty(exports, "defineEdge", {
|
|
512
512
|
enumerable: true,
|