import type { z } from "zod"; import type { FetchResult } from "../../types/index.js"; /** * ValidationService - Singleton para validaciones. * * Aplica el patrón Singleton: una única instancia que centraliza la * validación de datos desconocidos (respuestas de API, configs, input de * usuario) contra esquemas Zod devolviendo Safe Results en vez de lanzar * excepciones. Puro y sin I/O, seguro para SSR. */ export declare class ValidationService { private static instance; /** * Constructor privado - enforce singleton. */ private constructor(); /** * Obtiene la instancia única del ValidationService (Singleton). * * @returns La instancia única de {@link ValidationService}. * * @example * ```ts * const validator = ValidationService.getInstance(); * validator.useValidate(SmartVideoOptionsSchema, raw); * ``` */ static getInstance(): ValidationService; /** * Validates unknown data (API responses, configs, user input) against a * Zod schema and returns a Safe Result instead of throwing. * Framework-agnostic and pure: no I/O, SSR-safe. * * @typeParam T - The validated output type (`z.infer` of the schema). * @param schema - Any Zod schema. * @param data - Unknown input to validate. * @returns `FetchResult` with typed data or a `Validation Error`. * * @example * ```ts * import { SmartVideoOptionsSchema } from "katanakit-js/schemas"; * * const result = useValidate(SmartVideoOptionsSchema, JSON.parse(raw)); * if (result.ok) useBuildVideoEmbed(result.data); * ``` */ useValidate(schema: z.ZodType, data: unknown): FetchResult; } /** * Validates unknown data against a Zod schema and returns a Safe Result. * Wrapper sobre {@link ValidationService} (backward compatibility). * * @typeParam T - The validated output type (`z.infer` of the schema). * @param schema - Any Zod schema. * @param data - Unknown input to validate. * @returns `FetchResult` with typed data or a `Validation Error`. * * @example * ```ts * import { SmartVideoOptionsSchema } from "katanakit-js/schemas"; * * const result = useValidate(SmartVideoOptionsSchema, JSON.parse(raw)); * if (result.ok) useBuildVideoEmbed(result.data); * ``` */ export declare function useValidate(schema: z.ZodType, data: unknown): FetchResult; //# sourceMappingURL=validation.service.d.ts.map