import { type Json, type ModuleFilePath, type ValModules } from "@valbuild/core"; /** * A Val checking a site with ITS OWN rules: the platform's upgrade page * (valbuild/home `docs/plans/upgrades-v2.md`, piece E) calls this on the * version an upgrade moves to, because only that version knows what it * requires of the site's content. * * The page is home's and runs no Val code of its own. It finds this as * `Internal.selfCheck` on the framework package in the site's own vendor * layer -- the copy that made the site's schemas, since `val.config.ts` * imports `initVal` from it -- and hands it the default export of the * site's `val.modules.ts`, bundled. A Val from before this has no * `selfCheck`, and the page says validation was not available. * * The answer is data the page shows and nothing else, so its shape is the * contract: {@link SELF_CHECK_VERSION} names it, and an answer the page * cannot read counts as a failed check there. Change the shape and the * version goes up. */ export declare const SELF_CHECK_VERSION = 1; /** Content the site's schemas do not allow, or a module that would not load. */ export type SelfCheckError = { /** The module, or `null` for an entry of `val.modules.ts` that did not load. */ moduleFilePath: string | null; /** Where in the module, as keys and indices; `[]` for the module itself. */ path: string[]; message: string; }; export type SelfCheckResult = { version: typeof SELF_CHECK_VERSION; /** The `@valbuild/core` that checked. */ valVersion: string; /** How many modules `val.modules.ts` names. */ modules: number; /** What holds a publish back: the errors the Studio would show. */ errors: SelfCheckError[]; /** * Errors Val repairs itself when the content is saved (an image's * metadata, say), which hold nothing back. Counted, so the page can say so. */ repairedOnSave: number; }; export type SelfCheckOptions = { /** * The site's content for a module: what it holds now, with every published * edit, rather than what its file's text held when the build was made. * `null` or `undefined` checks the file's own content. */ sourceOf?: (moduleFilePath: ModuleFilePath) => Json | null | undefined; }; export declare function selfCheck(valModules: ValModules, options?: SelfCheckOptions): Promise;