import { a6 as SerializedNodeDef, a7 as SerializedEdgeDef, a8 as SerializedMetaEdge, a9 as SerializedOntologyRelation, aa as SerializedClosures, ab as SerializedSchema, ac as SchemaHash, ad as NullCheckOp, e as GraphDef, K as KindEntity, ae as ValidationIssue, af as ValidationError } from '../types-BynPp5kU.js'; export { ag as ChangeSeverity, ah as ChangeType, C as ContributionDiagnostic, a as ContributionDiagnosticState, b as ContributionRepairEntry, c as ContributionRepairResult, ai as DeprecatedKindsChange, aj as EdgeChange, ak as ExtensionChange, al as GraphAnnotationsChange, G as GraphIdentityConfig, am as IdentityChange, an as IndexChange, ao as JsonSchema, ap as NodeChange, aq as OntologyChange, ar as SchemaChangeClassification, as as SchemaDiff, at as SchemaIdentity, au as SerializedOntology, av as SerializedUniqueConstraint, aw as classifySchemaChanges, ax as computeSchemaDiff, ay as getMigrationActions, az as isBackwardsCompatible } from '../types-BynPp5kU.js'; import { K as KindRegistry } from '../store-C8ZPl7OW.js'; export { E as EvolutionPlan, o as EvolutionRequirement, p as EvolutionRequirements, M as MigrateSchemaOptions, q as MigrationHookContext, a as SchemaManagerOptions, r as SchemaValidationResult, s as applyDeprecatedKinds, t as assertSchemaCurrent, u as ensureSchema, v as getActiveSchema, w as getCommittedSchemaVersion, x as getSchemaChanges, y as initializeSchema, z as isSchemaInitialized, A as loadActiveSchemaWithBootstrap, D as loadAndMergeGraphExtensionDocument, F as migrateSchema, G as parseSerializedSchema, J as requiresMigration, N as rollbackSchema } from '../store-C8ZPl7OW.js'; export { G as GraphTemplate, I as InstantiateGraphTemplateResult, i as instantiateGraph, a as instantiateGraphTemplate, r as registerGraphTemplate } from '../graph-templates-D9N-Z9kw.js'; import { ZodType, ZodError } from 'zod'; import '../searchable-KKXrPet3.js'; import '../resolve-DV0Iposp.js'; /** * A deserialized schema provides read-only access to schema metadata. * * Note: Unlike the original GraphDef, this does not include Zod schemas * since those cannot be reconstructed from JSON Schema. Use this for * introspection and metadata access only. */ type DeserializedSchema = Readonly<{ graphId: string; version: number; generatedAt: string; /** Get node definition by name */ getNode: (name: string) => SerializedNodeDef | undefined; /** Get all node names */ getNodeNames: () => readonly string[]; /** Get edge definition by name */ getEdge: (name: string) => SerializedEdgeDef | undefined; /** Get all edge names */ getEdgeNames: () => readonly string[]; /** Get meta-edge definition by name */ getMetaEdge: (name: string) => SerializedMetaEdge | undefined; /** Get all meta-edge names */ getMetaEdgeNames: () => readonly string[]; /** Get all ontology relations */ getRelations: () => readonly SerializedOntologyRelation[]; /** Get precomputed closures */ getClosures: () => SerializedClosures; /** Get graph defaults */ getDefaults: () => SerializedSchema["defaults"]; /** Get the durable TypeGraph Identity Profile configuration. */ getIdentity: () => SerializedSchema["identity"]; /** Get the raw serialized schema */ getRaw: () => SerializedSchema; /** Build a validated KindRegistry by recomputing closures from relations */ buildRegistry: () => KindRegistry; }>; /** * Deserializes a SerializedSchema into a DeserializedSchema. * * @param schema - The serialized schema to deserialize * @returns A deserialized schema with accessor methods */ declare function deserializeSchema(schema: SerializedSchema): DeserializedSchema; /** * Schema serializer for homoiconic storage. * * Converts a GraphDef to a SerializedSchema for database storage. * Uses Zod's toJSONSchema() for property schema serialization. */ /** * Serializes a GraphDef to a SerializedSchema. * * @param graph - The graph definition to serialize * @param version - The schema version number * @returns The serialized schema */ declare function serializeSchema(graph: G, version: number): SerializedSchema; /** * A serialized predicate structure (matches UniqueConstraintPredicate from core/types). */ type SerializedPredicate = Readonly<{ __type: "unique_predicate"; field: string; op: NullCheckOp; }>; /** * Field builder returned by the predicate proxy. */ type FieldPredicateBuilder = Readonly<{ isNull: () => SerializedPredicate; isNotNull: () => SerializedPredicate; }>; /** * Predicate builder type for where clause serialization. */ type PredicateBuilder = Readonly>; /** * Deserializes a where predicate JSON back to a predicate function. * * This can be used to reconstruct a UniqueConstraint's where clause * from a serialized schema. * * @param serialized - The JSON string from serialization * @returns A where function that returns the predicate structure */ /** * Unique predicate result type. */ type UniquePredicate = Readonly<{ __type: "unique_predicate"; field: string; op: NullCheckOp; }>; declare function deserializeWherePredicate(serialized: string): (builder: PredicateBuilder) => UniquePredicate; /** * Computes a hash of the schema content for change detection. * * Excludes version and generatedAt since those change on every save. */ declare function computeSchemaHash(schema: SerializedSchema): Promise; /** * Contextual Validation Utilities * * Provides Zod validation wrappers that include full context about * which entity (node/edge) and operation (create/update) failed. * * @example * ```typescript * const props = validateNodeProps(schema, input, { * kind: "Person", * operation: "create", * }); * ``` */ /** * Context for validation operations. */ type ValidationContext = Readonly<{ /** Type of entity being validated */ entityType: KindEntity; /** Kind/type name of the entity */ kind: string; /** Operation being performed */ operation: "create" | "update"; /** Entity ID (for updates) */ id?: string; }>; /** * Validates props with full context for error messages. * * @param schema - Zod schema to validate against * @param props - Properties to validate * @param context - Context about the entity and operation * @returns Validated and transformed props * @throws ValidationError with full context if validation fails * * @example * ```typescript * const validatedProps = validateProps(personSchema, input, { * entityType: "node", * kind: "Person", * operation: "create", * }); * ``` */ declare function validateProps(schema: ZodType, props: unknown, context: ValidationContext): T; /** * Validates node props with full context. * * Convenience wrapper around validateProps for node operations. * * @example * ```typescript * const props = validateNodeProps(schema, input, { * kind: "Person", * operation: "create", * }); * ``` */ declare function validateNodeProps(schema: ZodType, props: unknown, context: Readonly<{ kind: string; operation: "create" | "update"; id?: string; }>): T; /** * Validates edge props with full context. * * Convenience wrapper around validateProps for edge operations. * * @example * ```typescript * const props = validateEdgeProps(schema, input, { * kind: "worksAt", * operation: "create", * }); * ``` */ declare function validateEdgeProps(schema: ZodType, props: unknown, context: Readonly<{ kind: string; operation: "create" | "update"; id?: string; }>): T; /** * Wraps a Zod error with TypeGraph context. * * Use this when you've already caught a ZodError and want to * convert it to a ValidationError with context. * * @example * ```typescript * try { * schema.parse(input); * } catch (error) { * if (error instanceof ZodError) { * throw wrapZodError(error, { * entityType: "node", * kind: "Person", * operation: "create", * }); * } * throw error; * } * ``` */ declare function wrapZodError(error: ZodError, context: ValidationContext): ValidationError; /** * Creates a simple ValidationError without Zod context. * * Use this for custom validation rules that aren't part of a Zod schema. * * @example * ```typescript * if (startDate > endDate) { * throw createValidationError( * "Start date must be before end date", * [{ path: "startDate", message: "Must be before endDate" }], * { entityType: "edge", kind: "employment", operation: "create" } * ); * } * ``` */ declare function createValidationError(message: string, issues: ValidationIssue[], context?: Partial): ValidationError; export { type DeserializedSchema, SchemaHash, SerializedClosures, SerializedEdgeDef, SerializedMetaEdge, SerializedNodeDef, SerializedOntologyRelation, SerializedSchema, type ValidationContext, computeSchemaHash, createValidationError, deserializeSchema, deserializeWherePredicate, serializeSchema, validateEdgeProps, validateNodeProps, validateProps, wrapZodError };