import type { $ZodType as ZodType } from 'zod/v4/core'; import type { FormField, WalkOptions } from './types.js'; import type { WalkResult } from './optimizers/types.js'; /** * Walk a Zod schema and produce a FormField[] tree. * When optimization option is set, returns WalkResult with fields + schemaLite. * * @remarks * Recursively walks a Zod schema tree and produces a FormField[] intermediate * representation. Dispatches by def.type to a processor registry. Each processor * extracts structure and constraints from _zod.def + _zod.bag. * Uses WeakSet per top-level field for cycle detection — reused schema instances * (e.g., z.string() in two fields) don't trigger false positives. * The walker is STATELESS — call it repeatedly with different formRegistry values. * * @useWhen * - You need direct schema-to-fields conversion in runtime contexts * - You're building a custom codegen pipeline on top of FormField[] * * @avoidWhen * - You just want generated components — use the CLI instead * - Your schema is not z.object() at the root level * * @never * - NEVER pass a non-object schema at the root — throws immediately * - NEVER bypass the processor registry for custom types — extend via options.processors * - NEVER skip normalizeFormValues() before schema.safeParse() — empty strings from HTML inputs fail optional field validation * * @param schema - The Zod schema to walk. Must be a `z.object()` (or pipe-wrapped object) at the root. * @param options - Optional walk options including formRegistry, custom processors, maxDepth, and optimization config. * @returns A sorted `FormField[]` array, or a `WalkResult` with `fields` + `schemaLite` when optimization is requested. * * @category Schema Walking */ export declare function walkSchema(schema: ZodType, options: WalkOptions & { optimization: { level: 1 | 2 | 3; }; }): WalkResult; export declare function walkSchema(schema: ZodType, options?: WalkOptions): FormField[]; //# sourceMappingURL=walker.d.ts.map