export type ZonIssue = { path: (string | number)[]; message: string; code: 'invalid_type' | 'missing_field' | 'invalid_enum' | 'custom'; }; export type ZonResult = { success: true; data: T; } | { success: false; error: string; issues: ZonIssue[]; }; /** * Abstract base class for ZON schemas. * Defines the contract for parsing validation and prompt generation. */ export declare abstract class ZonSchema { protected description?: string; protected exampleValue?: T; /** * Parses and validates the input data against the schema. * * @param data - The data to validate * @param path - Current path in the data structure (for error reporting) * @returns Validation result (success or failure with issues) */ abstract parse(data: any, path?: (string | number)[]): ZonResult; /** * Generates a human-readable description of the schema for LLM prompts. * * @param indent - Indentation level for nested structures * @returns Schema description string */ abstract toPrompt(indent?: number): string; describe(description: string): this; example(value: T): this; optional(): ZonSchema; nullable(): ZonSchema; default(value: T): ZonSchema; refine(validator: (val: T) => boolean, message: string): ZonSchema; } declare class ZonString extends ZonSchema { private minLength?; private maxLength?; private emailValidation; private urlValidation; private regexPattern?; private regexMessage?; private uuidValidation; private datetimeValidation; private dateValidation; private timeValidation; min(length: number): this; max(length: number): this; email(): this; url(): this; regex(pattern: RegExp, message?: string): this; uuid(version?: 'v4' | 'any'): this; datetime(): this; date(): this; time(): this; parse(data: any, path?: (string | number)[]): ZonResult; toPrompt(indent?: number): string; } declare class ZonNumber extends ZonSchema { private minValue?; private maxValue?; private isPositive; private isNegative; private isInteger; min(value: number): this; max(value: number): this; positive(): this; negative(): this; int(): this; parse(data: any, path?: (string | number)[]): ZonResult; toPrompt(indent?: number): string; } declare class ZonBoolean extends ZonSchema { parse(data: any, path?: (string | number)[]): ZonResult; toPrompt(indent?: number): string; } declare class ZonEnum extends ZonSchema { private values; constructor(values: T[]); parse(data: any, path?: (string | number)[]): ZonResult; toPrompt(indent?: number): string; } declare class ZonArray extends ZonSchema { private elementSchema; private minLength?; private maxLength?; constructor(elementSchema: ZonSchema); min(length: number): this; max(length: number): this; parse(data: any, path?: (string | number)[]): ZonResult; toPrompt(indent?: number): string; } declare class ZonObject> extends ZonSchema { private shape; constructor(shape: { [K in keyof T]: ZonSchema; }); parse(data: any, path?: (string | number)[]): ZonResult; toPrompt(indent?: number): string; } declare class ZonLiteral extends ZonSchema { private value; constructor(value: T); parse(data: any, path?: (string | number)[]): ZonResult; toPrompt(indent?: number): string; } declare class ZonUnion extends ZonSchema { private schemas; constructor(schemas: ZonSchema[]); parse(data: any, path?: (string | number)[]): ZonResult; toPrompt(indent?: number): string; } export declare const zon: { string: () => ZonString; number: () => ZonNumber; boolean: () => ZonBoolean; enum: (values: T[]) => ZonEnum; array: (schema: ZonSchema) => ZonArray; object: >(shape: { [K in keyof T]: ZonSchema; }) => ZonObject; literal: (value: T) => ZonLiteral; union: []>(...schemas: T) => ZonUnion; }; /** * Validates a ZON string or decoded object against a schema. * @param input ZON string or decoded object * @param schema ZON Schema */ export declare function validate(input: string | any, schema: ZonSchema): ZonResult; export {};