/** * Thrown when a persisted artifact's `schema_version` is present but not the * supported one. A DISTINCT type (not each loader's generic parse error) so a * caller can tell "incompatible version" from "corrupt/malformed" and choose to * recover: a rebuildable cache (profile/queries) treats it as absent and * rebuilds, while a historical snapshot or an explicit file lets it surface. */ export declare class SchemaVersionError extends Error { readonly found: unknown; constructor(found: unknown); } /** A record of parsed-but-unvalidated fields. */ export type Unvalidated = Record; /** Field-level assertions bound to a caller-supplied failure sink. */ export interface StructValidator { /** Assert `value` is a non-null, non-array object; return it as a record. */ object(value: unknown, label?: string): Unvalidated; /** Assert `schema_version` is present AND equals the supported version (rule #2). */ schemaVersion(obj: Unvalidated): void; /** Assert `obj[key]` is a string. */ string(obj: Unvalidated, key: string): void; /** Assert `obj[key]` is a number. */ number(obj: Unvalidated, key: string): void; /** Assert `obj[key]` is a number or `null` (an intentionally nullable field). */ numberOrNull(obj: Unvalidated, key: string): void; /** Assert `obj[key]` is an array. */ array(obj: Unvalidated, key: string): void; /** Assert `obj[key]` is a non-null, non-array object. */ objectField(obj: Unvalidated, key: string): void; } /** * Build a {@link StructValidator} that reports every failure through `fail`. * `fail` must not return (it throws the caller's domain-specific error), which * lets the assertions narrow types for the code that follows them. */ export declare function createValidator(fail: (why: string) => never): StructValidator;