UNPKG

flowjv

Version:

Flow based approach to JSON validation!

29 lines (28 loc) 841 B
import { IExpression, IJSONExpressionData } from "../../../jsonexpression"; import { IFlowReturnType, IFlowOptions } from "../../index"; export interface IValidation { logic: IExpression; err: string; } export declare type IAtom = ({ type: "string" | "number" | "boolean"; uiType?: "number" | "text" | "password"; label?: string; } | { type: "enum"; uiType?: "select" | "radio"; label?: string; items: { label?: string; value: any; }[]; } | { type: "custom"; }) & { isRequired?: boolean; readOnly?: IExpression; validations?: IValidation[]; errTypeMsg?: string; errRequiredMsg?: string; }; export declare const execPrimitiveFlow: <IData, IContext>(flow: IAtom, data: IJSONExpressionData<IData, IContext>, options?: IFlowOptions | undefined) => IFlowReturnType;