import { ValidationSource } from './types.js'; export type TStandardSchemaValidatorValue = { value: TData; validationSource: TSource; }; export type TStandardSchemaValidatorIssue = TSource extends 'form' ? { form: Record; fields: Record; } : TSource extends 'field' ? StandardSchemaV1Issue[] : never; export declare const standardSchemaValidators: { validate({ value, validationSource, }: TStandardSchemaValidatorValue, schema: StandardSchemaV1): TStandardSchemaValidatorIssue | undefined; validateAsync({ value, validationSource, }: TStandardSchemaValidatorValue, schema: StandardSchemaV1): Promise | undefined>; }; export declare const isStandardSchemaValidator: (validator: unknown) => validator is StandardSchemaV1; /** * The Standard Schema interface. */ export type StandardSchemaV1 = { /** * The Standard Schema properties. */ readonly '~standard': StandardSchemaV1Props; }; /** * The Standard Schema properties interface. */ interface StandardSchemaV1Props { /** * The version number of the standard. */ readonly version: 1; /** * The vendor name of the schema library. */ readonly vendor: string; /** * Validates unknown input values. */ readonly validate: (value: unknown) => StandardSchemaV1Result | Promise>; /** * Inferred types associated with the schema. */ readonly types?: StandardSchemaV1Types | undefined; } /** * The result interface of the validate function. */ type StandardSchemaV1Result = StandardSchemaV1SuccessResult | StandardSchemaV1FailureResult; /** * The result interface if validation succeeds. */ interface StandardSchemaV1SuccessResult { /** * The typed output value. */ readonly value: Output; /** * The non-existent issues. */ readonly issues?: undefined; } /** * The result interface if validation fails. */ interface StandardSchemaV1FailureResult { /** * The issues of failed validation. */ readonly issues: ReadonlyArray; } /** * The issue interface of the failure output. */ export interface StandardSchemaV1Issue { /** * The error message of the issue. */ readonly message: string; /** * The path of the issue, if any. */ readonly path?: ReadonlyArray | undefined; } /** * The path segment interface of the issue. */ interface StandardSchemaV1PathSegment { /** * The key representing a path segment. */ readonly key: PropertyKey; } /** * The Standard Schema types interface. */ interface StandardSchemaV1Types { /** * The input type of the schema. */ readonly input: Input; /** * The output type of the schema. */ readonly output: Output; } export {};