/** * Check 1 of `compiled-program.md` 3.5: every required field is present and of * the declared type. * * This is the half of verification that reads an untrusted object and decides * whether it is a compiled program at all. It runs before anything else, * because every later check indexes into a table this one proves is a table. * * The failures are all one code. OS6018 covers a malformed instruction list, an * unreadable encoding and a field of the wrong type because they are not * separate fixes: each is a defect of the compiler that wrote the program, and * none of them is repairable by hand. What varies is the location, and the * location is a field path, so a compiler author is told `outputs.plots[2]. * channel` rather than "structure". */ import type { Diagnostic } from '../diagnostics/index.js'; type Unknown = Readonly>; /** Collects the first failure and stops: a malformed program has no second opinion. */ export declare class ShapeCheck { private failure; problem(): Diagnostic | undefined; fail(path: string, reason: string): false; object(value: unknown, path: string): value is Unknown; array(value: unknown, path: string): value is readonly unknown[]; number(value: unknown, path: string): value is number; whole(value: unknown, path: string): value is number; string(value: unknown, path: string): value is string; bool(value: unknown, path: string): value is boolean; /** A whole number that indexes a table, with the table's size in the message. */ index(value: unknown, path: string, size: number, table: string): value is number; one(value: unknown, path: string, allowed: readonly T[]): value is T; /** A field that may be a value or null, which is a value the script could write. */ nullable(value: unknown, path: string, check: (v: unknown, p: string) => boolean): boolean; } export declare function checkConstant(shape: ShapeCheck, value: unknown, path: string): boolean; export declare function checkColour(shape: ShapeCheck, value: unknown, path: string): boolean; /** * A declaration field, 2.3: a value, or the `{ "input": key }` reference. * * The key half of check 10 lives here, because this is the one walk that * visits every field that may hold one. The value half runs later, with the * host's settings in hand. */ export declare function checkField(shape: ShapeCheck, value: unknown, path: string, keys: ReadonlySet): boolean; export {}; //# sourceMappingURL=verify-shape.d.ts.map