datatypes-validation
Version:
     
26 lines • 1.4 kB
TypeScript
import { Field } from "../data/Field";
import { Rules } from "../data/Rules/Rules";
import { IFieldsObject } from "./FieldInterface";
export declare type IRuleFunction = (field: Field, fields?: IFieldsObject) => Promise<IFieldsObject | void>;
export interface IRulesSchema {
[key: string]: Rules | IRulesSchema;
}
export declare type IRuleConditionalFunction = (field: Field, fields: IFieldsObject) => Promise<IFieldsObject>;
export declare type IRuleConditionalCallbackArgSync = (fields: IFieldsObject) => Rules;
export declare type IRuleConditionalCallbackArgAsync = (fields: IFieldsObject) => Promise<Rules>;
export declare type IRuleConditionalCallbackArg = IRuleConditionalCallbackArgSync | IRuleConditionalCallbackArgAsync;
export interface IRulesObject {
[key: string]: IRuleFunction | IRuleConditionalFunction;
}
export interface IRuleOptions {
longMessage?: string;
shortMessage?: string;
}
export interface IDateRuleOptions extends IRuleOptions {
mask?: "BR" | "EN";
format?: string;
withTime?: boolean;
}
export declare type IRulesTypesString = "required" | "objectOf" | "string" | "email" | "equalTo" | "conditional" | "arrayOf" | "date" | "number" | "safeNumber" | "custom" | "alternatives" | "minLength" | "maxLength";
export declare type IRulesErrorTypes = IRulesTypesString | "invalidValue" | "dateFormat";
//# sourceMappingURL=RulesInterface.d.ts.map