import { ConfigSchema, ConfigFieldSchema, ConfigRecord, ValidationResult, ValidationError } from './types'; /** * Custom validator function. */ export type CustomValidator = (value: unknown, path: string, config: ConfigRecord) => string | null; /** * Validator options. */ export interface ValidatorOptions { /** Custom validators */ readonly customValidators?: Record; /** Whether to stop on first error */ readonly stopOnFirstError?: boolean; /** Whether to coerce types */ readonly coerceTypes?: boolean; } /** * Configuration validator with schema support. */ export declare class ConfigValidator { private readonly schema; private readonly customValidators; private options; constructor(schema: ConfigSchema, options?: ValidatorOptions); /** * Validate configuration against schema. */ validate(config: ConfigRecord): ValidationResult; /** * Validate a single value against a field schema. */ validateField(value: unknown, schema: ConfigFieldSchema, path: string): ValidationError[]; /** * Register a custom validator. */ registerValidator(name: string, validator: CustomValidator): void; private validateObject; private validateRule; private createError; } /** * Fluent builder for configuration schemas. */ export declare class SchemaBuilder { private schema; /** * Add a string field. */ string(name: string, options?: { required?: boolean; default?: string; pattern?: string; minLength?: number; maxLength?: number; enum?: string[]; description?: string; secret?: boolean; envVar?: string; }): this; /** * Add a number field. */ number(name: string, options?: { required?: boolean; default?: number; min?: number; max?: number; description?: string; envVar?: string; }): this; /** * Add a boolean field. */ boolean(name: string, options?: { required?: boolean; default?: boolean; description?: string; envVar?: string; }): this; /** * Add an object field. */ object(name: string, properties: ConfigSchema, options?: { required?: boolean; description?: string; }): this; /** * Add an array field. */ array(name: string, items: ConfigFieldSchema, options?: { required?: boolean; minLength?: number; maxLength?: number; description?: string; }): this; /** * Build the schema. */ build(): ConfigSchema; } /** * Create a new schema builder. */ export declare function createSchema(): SchemaBuilder; /** * Validate configuration with a quick schema. */ export declare function validateConfig(config: ConfigRecord, schema: ConfigSchema, options?: ValidatorOptions): ValidationResult; /** * Common validation schemas. */ export declare const CommonSchemas: { /** * URL field schema. */ url: (required?: boolean) => ConfigFieldSchema; /** * Email field schema. */ email: (required?: boolean) => ConfigFieldSchema; /** * Port number schema. */ port: (required?: boolean) => ConfigFieldSchema; /** * Positive number schema. */ positiveNumber: (required?: boolean) => ConfigFieldSchema; /** * Percentage schema (0-100). */ percentage: (required?: boolean) => ConfigFieldSchema; };