@webilix/nestjs-helper
Version:
Helper library for NestJS
44 lines • 1.42 kB
TypeScript
import { Formats } from '../formats';
interface ICondition {
readonly title: string;
readonly nullable?: boolean;
readonly array?: boolean | {
readonly minCount?: number;
readonly maxCount?: number;
readonly unique?: true | ((value: any) => any);
};
}
export interface IBooleanCondition extends ICondition {
readonly type: 'BOOLEAN';
}
export interface IDateCondition extends ICondition {
readonly type: 'DATE';
readonly minDate?: Date;
readonly maxDate?: Date;
readonly omitConvert?: boolean;
}
export interface INumberCondition extends ICondition {
readonly type: 'NUMBER';
readonly enum?: number[];
readonly minimum?: number;
readonly maximum?: number;
}
export interface IStringCondition extends ICondition {
readonly type: 'STRING';
readonly format?: Formats;
readonly pattern?: RegExp;
readonly enum?: string[];
readonly length?: number;
readonly minLength?: number;
readonly maxLength?: number;
readonly omitTrim?: boolean;
readonly changeNumbers?: 'EN' | 'FA';
}
export interface IObjectCondition extends ICondition {
readonly type: 'OBJECT';
readonly properties: {
[key: string]: Omit<IStringCondition, 'array'> | Omit<IBooleanCondition, 'array'> | Omit<IDateCondition, 'array'> | Omit<INumberCondition, 'array'>;
};
}
export {};
//# sourceMappingURL=validator.interface.d.ts.map