import { CheckOrEffectIR } from "../types.js"; import { ExtractorContext, ZodCheckDef, ZodCheckSchema } from "./types.js"; //#region src/core/extract/checks.d.ts /** * Build the `refineRef` registrar for {@link extractChecks} from an extractor's * context: it appends a {@link RefEntry} pointing at the check's own predicate * (`._zod.def.checks[i]._zod.def.fn`) so generated code can call the * user's function object directly. Returns undefined — meaning "fall back as * before" — when the extraction is not collecting refs. */ declare function refineRefRegistrar(ctx: ExtractorContext, checks: ZodCheckSchema[]): ((index: number) => number | undefined) | undefined; /** * Build the `customParamsRef` registrar for {@link extractChecks}: it appends a * {@link RefEntry} pointing at the check's own `params` object * (`._zod.def.checks[i]._zod.def.params`), which $ZodCustom copies onto * the issue by reference. * * A reference rather than a baked literal because `params` is opaque user data: * it may hold functions, symbols or a cycle (none of which survive a literal), * and zod hands out the SAME object on every issue, so a per-failure copy would * break the identity comparison that is the point of passing params. * * Returns undefined — meaning "fall back to zod" — when refs are unavailable. */ declare function customParamsRefRegistrar(ctx: ExtractorContext, checks: ZodCheckSchema[]): ((index: number) => number | undefined) | undefined; /** * Register the payload-taking callback of check `index` (`superRefine`) as an * `__rf[N]` reference, pointing at zod's own wrapper * (`._zod.def.checks[i]._zod.check`). * * Only the LAST check on a node qualifies: an issue carrying * `fatal`/`continue:false` aborts zod's remaining chain, and compiled output * runs every check unconditionally — with nothing following, there is nothing * left to abort, so the two agree. */ declare function payloadCheckRef(ctx: ExtractorContext, checks: ZodCheckSchema[], index: number): number | undefined; /** * True when a check can't be compiled because of runtime modifiers: * a user-supplied `when` predicate, or `abort: true` (which stops later * checks and marks the option as aborted in union pruning — compiled * output always runs every check). */ declare function hasUncompilableModifiers(def: ZodCheckDef): boolean; declare function extractChecks(checks: ZodCheckSchema[], /** * Registers the predicate of the check at `index` as an `__rf[N]` reference * and returns N, or undefined when references are unavailable (no refs array) * or the callback's shape cannot be called directly. Supplied by extractors * that know their schema's access path; omitted by callers that do not, which * simply keeps the old fall-back-to-zod behavior. */ refineRef?: (index: number) => number | undefined, /** Registers a payload-taking callback (superRefine); see payloadCheckRef. */ payloadRefFor?: (index: number) => number | undefined, /** Registers a `.refine(fn, { params })` payload; see customParamsRefRegistrar. */ customParamsRef?: (index: number) => number | undefined): { checkIRs: CheckOrEffectIR[]; hasFallback: boolean; }; type ResolvedMessage = { kind: "none"; } | { kind: "static"; message: string; } | { kind: "dynamic"; }; /** * Classify a check/schema-level `error` param. * * Zod normalizes `.min(3, "msg")` / `{ error: "msg" }` / `{ message: "msg" }` * into an error-map function that ignores its issue argument and returns the * string. We call the function with an access-tracking Proxy: if it never * inspects the issue, its return value is a constant we can bake into the * generated issue. If it reads any issue property (input-dependent message), * it is dynamic and the schema must fall back to Zod for exact messages. */ declare function resolveCheckMessage(error: unknown): ResolvedMessage; //#endregion export { ResolvedMessage, customParamsRefRegistrar, extractChecks, hasUncompilableModifiers, payloadCheckRef, refineRefRegistrar, resolveCheckMessage }; //# sourceMappingURL=checks.d.ts.map