import type { z } from 'zod'; import type { ReferencePath } from '#src/references/types.js'; /** * Context passed to the transform callback at each schema node. */ interface SchemaTransformContext { /** The absolute path to the current node in the data. */ readonly path: ReferencePath; /** The Zod schema at this node. */ readonly schema: z.ZodType; } /** * A transform function called at each schema node after children have * already been transformed. Returns the (possibly new) value for this node. * Return the input value unchanged to signal "no change". * * Returning `undefined` signals that the value should be removed (for object * keys) or kept in place (for array elements). */ export type SchemaTransformFn = (value: unknown, ctx: SchemaTransformContext) => unknown; /** * Walks a Zod schema in parallel with data, applying a transform function * bottom-up. Children are transformed first, then the parent transform * sees the already-transformed children. * * Returns a new data tree with transformations applied. Preserves object * references when no changes occur in a subtree (structural sharing). * * Transform semantics for `undefined` returns: * - Object keys: the key is omitted from the result * - Array elements: `undefined` is kept in place (indices must be preserved) */ export declare function transformDataWithSchema(schema: z.ZodType, data: T, transform: SchemaTransformFn): T; export {}; //# sourceMappingURL=transform-data-with-schema.d.ts.map