import { type Json, type ModuleFilePath, type SerializedSchema, type SourcePath, type ValidationError, type ValidationFix } from "@valbuild/core"; export type SchemaSourceSnapshot = { schemas: Record; sources: Record; }; export type RouteInfo = { route: string; moduleFilePath: ModuleFilePath; }; export declare function getRoutesWithModulePaths(schemas: Record, sources: Record): RouteInfo[]; export declare function getRoutesOf(schemas: Record, sources: Record): string[]; export declare const levenshtein: (a: string, b: string) => number; export declare function findSimilar(key: string, targets: string[]): { target: string; distance: number; }[]; /** * The record a `keyof:check-keys` error resolves against — the value and the * schema at the error's `sourcePath`. * * Exported for the one consumer that has to know what a resolution DEPENDED * on rather than what it concluded: `ValidationStore` re-reads the keys here * to decide whether a change to the referenced module can have moved the * answer. Keep this and {@link checkKeyIsValid} reading the same record, or the * store will invalidate on one record and the resolution answer from another. */ export declare function getKeyOfRecordAt(sourcePath: SourcePath, snapshot: SchemaSourceSnapshot): { source: unknown; schema: SerializedSchema | undefined; }; /** * The languages the project declares, from its settings module. * * Empty where there is no settings module, no `locales` section, or nothing in * it — all of which mean the same thing: this project has not said it is * translated. */ export declare function declaredLocales(snapshot: SchemaSourceSnapshot): string[]; export type ResolvedFix = { status: "resolved"; } | { status: "remaining"; error: ValidationError; }; /** * The fixes {@link resolveSchemaSourceFixForError} answers for. * * A marker error carrying one of these is NOT a message: it says "ask the whole * project about this" and carries the value to ask with, because the schema * that raised it can only see its own module. Left unresolved, what a user sees * is the marker's own placeholder text — "should typically be processed by Val * internally … version mismatch" — which is alarming and says nothing. * * A list rather than a check per call site: every caller that resolves some of * these has to resolve all of them, and the two that leaked did so by adding a * fix here and not to a condition somewhere else. */ export declare const SCHEMA_SOURCE_FIXES: ValidationFix[]; /** Whether an error is a marker only the whole project can answer. */ export declare function isSchemaSourceFixError(error: ValidationError): boolean; /** * The record a `keyof:check-keys` error resolves against -- or a gallery * marker's (`image:check-gallery` and the rest): its gallery module -- or null * for any other error, including a malformed marker, which * {@link resolveSchemaSourceFixForError} reports and this has nothing to say * about. * * For a consumer that needs to know what the resolution READS, not what it * concludes: `ValidationStore` keeps this per validated module, so that a change * to the referenced record can invalidate the module holding the reference. */ export declare function keyOfRecordPath(error: ValidationError): SourcePath | null; /** * Resolves a single marker error (see {@link SCHEMA_SOURCE_FIXES}) against the * given schema/source snapshot. Returns: * - null if the error is not one of these fixes (caller should pass through) * - { status: "resolved" } if the reference is valid (drop error) * - { status: "remaining"; error } if invalid (rewritten error to surface) */ export declare function resolveSchemaSourceFixForError(error: ValidationError, snapshot: SchemaSourceSnapshot): ResolvedFix | null; /** * Apply schema/source fix resolution across a map of validation errors. * * Errors carrying one of {@link SCHEMA_SOURCE_FIXES} are resolved against the * in-memory schema/source snapshot — valid references drop the error, invalid * ones are rewritten with a "did you mean…" message and have their `fixes` * cleared (so downstream code reports them as plain validation errors). * All other errors pass through untouched. * * Source paths with no remaining errors are removed from the result. */ export declare function resolveSchemaSourceFixes(validationErrors: Record, snapshot: SchemaSourceSnapshot): Record;