import { JsonSchemaKeywordType } from '@ui-schema/json-schema/Definitions'; import { ValidateFn, ValidateParams, ValidateStateNested, ValidateStateOutput, ValidationDetails } from '@ui-schema/ui-schema/Validate'; import { ValidatorOutput } from '@ui-schema/ui-schema/ValidatorOutput'; export type ValidatorStateNested = ValidateStateNested; export type ValidatorStateOutput = ValidateStateOutput; export type ValidatorState = ValidatorStateNested & ValidatorStateOutput; type TypeMap = { string: string; number: number; boolean: boolean; null: null; array: unknown[]; object: object; }; export type MappedType = TTypes[number] extends infer U ? U extends keyof TypeMap ? TypeMap[U] : never : never; type AfterAllValidator = ((partialResult: { context: ValidatorState['context']; output: ValidatorState['output']; }) => void); export type ValidatorHandler = { /** * unique ID of a validator, only the last one will be kept */ id?: string; types?: TTypes; validate: (schema: any, value: any, params: ValidatorParams & ValidatorState) => void | ({ open?: any[]; deferred?: any; afterAll?: AfterAllValidator; } & ValidationDetails); }; export declare function createRegister(validators: ValidatorHandler[]): any; export declare function makeParams(): ValidatorParams; export type ValidatorParams = ValidateParams; export type ValidateFnTypeAssert = { (schema: any, value: unknown, params?: ValidatorParams): value is TData; errors: ValidatorOutput['errors']; annotations: unknown[]; }; export declare function Validator(validators: ValidatorHandler[]): { validate: ValidateFn; validateValue: ValidateFnTypeAssert; }; export {};