import { Schema } from './schemas/schema.js'; export interface SchemaLike { readonly config: Record; parse(data: any, ctx?: any): any; safeParse(data: any, ctx?: any): Promise>; } export interface ValidationContext { /** The original, top-level data passed to `parse()`. */ rootData: any; /** The path from the root to the current value being validated. */ path: (string | number)[]; /** The value at the current path. */ value: any; /** The user-provided context object. */ ctx?: any; } export interface MessageProducerContext { label: string; value: any; path: (string | number)[]; args: any[]; dataType: string; ctx?: any; schema: Schema; } export type MessageProducer = (context: MessageProducerContext) => string; export type PreparationFunction = (value: T, args: Args, context: ValidationContext, schema: Schema) => any | Promise; export type TransformationFunction = (value: T, args: Args, context: ValidationContext, schema: Schema) => any | Promise; export type ValidatorFunction = (value: T, args: Args, context: ValidationContext, schema: Schema) => boolean | Promise; export type ValidatorDefinition = { validator: ValidatorFunction; message: MessageProducer; }; export type PreparationCollection = { [preparationName: string]: PreparationFunction; }; export type TransformationCollection = { [transformationName: string]: TransformationFunction; }; export type ValidatorCollection = { [validatorName: string]: ValidatorDefinition; }; export type Validator = { dataType: string; prepare?: PreparationCollection; transform?: TransformationCollection; validate?: ValidatorCollection & { identity: { validator: (value: unknown, args: any[], context: ValidationContext, schema: Schema) => boolean | Promise; message: MessageProducer; }; }; }; export declare function definePlugin(plugin: Validator): Validator; export type SchemaValidatorMap = { [dataType: string]: { identity: ValidatorFunction; [validatorName: string]: ValidatorFunction; }; }; export type ValidationIssue = { path: readonly (string | number)[]; message: string; }; export declare class ValidationError extends Error { issues: ValidationIssue[]; constructor(issues: ValidationIssue[]); } export type SafeParseSuccess = { status: "success"; data: T; }; export type SafeParseError = { status: "error"; error: ValidationError; }; export type SafeParseResult = SafeParseSuccess | SafeParseError; export type Prettify = { [K in keyof T]: T[K]; } & {}; export type UndefinedKeys = { [K in keyof T]: undefined extends T[K] ? K : never; }[keyof T]; export type UndefinedToOptional = Prettify<{ [K in Exclude>]: T[K]; } & { [K in UndefinedKeys]?: T[K]; }>; export type CustomValidator = ((value: TOutput, args: any[], context: ValidationContext, schema: any) => any) | { validator: (value: TOutput, args: any[], context: ValidationContext, schema: any) => any; message?: string | MessageProducer; name?: string; }; export type ValidatorConfig = { optional?: boolean; nullable?: boolean; label?: string; messages?: Prettify<{ [K in keyof Omit]?: string; } & { identity?: string; }>; prepare?: Record & { custom?: ((value: any) => any)[]; }; validate?: Record & { custom?: CustomValidator | CustomValidator[]; }; transform?: Record & { custom?: ((value: any) => any)[]; }; }; export type InferSchemaType> = T extends Schema ? U : never; export type SObjectProperties = Record>; export type InferSObjectType

= Prettify; }>>;