import { IZod2xLayerMetadata } from "../lib/zod_ext"; import { ZodType } from "../lib/zod_helpers"; /** * Layered modeling is resolved when models are transpiled, from the types declared by all the * created models. Layer decorators only declare the types of their model: schemas are not * modified and no metadata is stored for them. * * Each model property that declares a type is replaced by a copy of its schema (its handle), so * a schema used through a model property (`price = otherModel.money`) is told apart from the same * schema used directly (`price = Money`). */ /** * A type declared by a model property. */ export interface ILayerDeclaration { model: object; prop: string; /** * Type name derived from the property name. */ name: string; layer: IZod2xLayerMetadata; /** * Schema assigned to the property. */ value: ZodType; /** * Copy of the schema that replaces it as property value. */ handle: ZodType; /** * Declaration order, among all models. */ sequence: number; } export declare function getLayeredModels(): ReadonlySet; export declare function getLayeredGeneration(): number; /** * Declares the type of a model property. Returns the handle that replaces the property value. */ export declare function declareLayerType(model: object, prop: string, name: string, layer: IZod2xLayerMetadata, value: ZodType): ZodType; /** * Registers a model once all its types are declared. */ export declare function registerLayeredModel(model: object): void; /** * Returns the layer files that declare the type of a model property without referencing one * another, if any. */ export declare function getOwnershipTie(handle: ZodType): string[] | undefined;