import type { ZodEnum, ZodType } from "zod/v4"; import type { IZod2xLayerMetadata, IZod2xMetadata } from "./zod_ext"; /** * Registers an object schema with metadata or declared by a layered model, so its copies are * found by structure. Schemas are compared in registration order. */ export declare function registerCopySource(schema: object): void; /** * Links the copies of a schema created by zod-to-x (the handles of layered model properties) to * it, as copies of different handles of the same type cannot be told apart by their structure. * Every Zod method that copies a schema clones it through its `clone` method, which is wrapped on * the schema instance (Zod's prototypes are not modified). Copies are linked to their own copies * too. Schemas created by the user are never wrapped. */ export declare function linkCopies(schema: object): void; /** * Returns the schema another schema was copied from by Zod without changing the type it * represents (e.g. `.describe()`, `.strict()`), if any. */ export declare function getCopySource(schema: unknown): object | undefined; /** * Returns the metadata set on a schema itself, without the one inherited from the schema it was * copied from. */ export declare function getOwnZod2xMetadata(schema: unknown): IZod2xMetadata | undefined; /** * Returns the metadata of a schema: its own metadata or, if it has none, the metadata of the * schema it was copied from by Zod without changing the type it represents. */ export declare function getZod2xMetadata(schema: unknown): IZod2xMetadata | undefined; export declare function setZod2xMetadata(schema: T, metadata: IZod2xMetadata): T; /** * Template of a generic type instance, with the type used for it. */ export interface IZod2xGenericTemplate { schema: ZodType; typeName?: string; layer?: IZod2xLayerMetadata; } /** * Metadata of a schema with all the information derived from the referenced schemas. */ export interface IZod2xResolvedMetadata { typeName?: string; parentEnum?: ZodEnum; layer?: IZod2xLayerMetadata; /** * For Layered Modeling. Layer and type name of the type extended by a layer alias. */ parentLayer?: IZod2xLayerMetadata; aliasOf?: string; /** * Description of the type that an alias extends, if the alias does not document itself. */ aliasedDescription?: string; /** * For Layered Modeling defining generics. Types used for each template of a generic type * instance, and name of the generic type. */ genericTypes?: IZod2xGenericTemplate[]; genericOf?: string; /** * For Layered Modeling defining generics. * Indicates if the type is a layer alias (true) or an instance of a generic type created with * `useGenericType` (false). */ isGenericChild?: boolean; } /** * Returns the metadata of a schema to resolve. */ export type Zod2xMetadataLookup = (schema: unknown) => IZod2xMetadata | undefined; /** * Sets the lookup used by default to resolve the metadata of schemas. Used by layered modeling. */ export declare function setLayeredMetadataLookup(lookup: Zod2xMetadataLookup): void; /** * Returns the metadata of a schema, resolving the information derived from the schemas it * references (original type of layer aliases, generic type and templates of generic instances). * * @param lookup - Returns the metadata of each schema. Defaults to the layered modeling lookup, * which falls back to the metadata set on the schemas. */ export declare function resolveZod2xMetadata(schema: unknown, lookup?: Zod2xMetadataLookup): IZod2xResolvedMetadata | undefined;