1 | import { FieldInstance, Location, Meta, ValidationError } from './base';
|
2 | import { ContextItem } from './context-items';
|
3 | export declare type Optional = {
|
4 | nullable: boolean;
|
5 | checkFalsy: boolean;
|
6 | } | false;
|
7 | export declare class Context {
|
8 | readonly fields: string[];
|
9 | readonly locations: Location[];
|
10 | readonly stack: ReadonlyArray<ContextItem>;
|
11 | readonly optional: Optional;
|
12 | readonly message?: any;
|
13 | private readonly _errors;
|
14 | get errors(): ReadonlyArray<ValidationError>;
|
15 | private readonly dataMap;
|
16 | constructor(fields: string[], locations: Location[], stack: ReadonlyArray<ContextItem>, optional: Optional, message?: any);
|
17 | getData(options?: {
|
18 | requiredOnly: boolean;
|
19 | }): FieldInstance[];
|
20 | addFieldInstances(instances: FieldInstance[]): void;
|
21 | setData(path: string, value: any, location: Location): void;
|
22 | addError(message: any, value: any, meta: Meta): void;
|
23 | addError(message: any, nestedErrors: ValidationError[]): void;
|
24 | }
|
25 | export declare type ReadonlyContext = Pick<Context, Exclude<keyof Context, 'setData' | 'addFieldInstances' | 'addError'>>;
|