@decaf-ts/decorator-validation
Version:
simple decorator based validation engine
127 lines (126 loc) • 4.55 kB
TypeScript
/**
* @summary Keys used for comparison-based validations.
*
* @property {string} EQUALS - Validates if two values are equal.
* @property {string} DIFF - Validates if two values are different.
* @property {string} LESS_THAN - Validates if a value is less than another.
* @property {string} LESS_THAN_OR_EQUAL - Validates if a value is less than or equal to another.
* @property {string} GREATER_THAN - Validates if a value is greater than another.
* @property {string} GREATER_THAN_OR_EQUAL - Validates if a value is greater than or equal to another.
*
* @constant ComparisonValidationKeys
* @memberof module:decorator-validation.Validation
* @category Validation
*/
export declare const ComparisonValidationKeys: {
readonly EQUALS: "equals";
readonly DIFF: "different";
readonly LESS_THAN: "lessThan";
readonly LESS_THAN_OR_EQUAL: "lessThanOrEqual";
readonly GREATER_THAN: "greaterThan";
readonly GREATER_THAN_OR_EQUAL: "greaterThanOrEqual";
};
/**
* @summary The keys used for validation
*
* @property {string} REFLECT prefixes others
* @property {string} REQUIRED sets as required
* @property {string} MIN defines min value
* @property {string} MAX defines max value
* @property {string} STEP defines step
* @property {string} MIN_LENGTH defines min length
* @property {string} MAX_LENGTH defines max length
* @property {string} PATTERN defines pattern
* @property {string} EMAIL defines email
* @property {string} URL defines url
* @property {string} DATE defines date
* @property {string} TYPE defines type
* @property {string} PASSWORD defines password
* @property {string} LIST defines list
*
* @constant ValidationKeys
* @memberOf module:decorator-validation.Validation
* @category Validation
*/
export declare const ValidationKeys: {
readonly EQUALS: "equals";
readonly DIFF: "different";
readonly LESS_THAN: "lessThan";
readonly LESS_THAN_OR_EQUAL: "lessThanOrEqual";
readonly GREATER_THAN: "greaterThan";
readonly GREATER_THAN_OR_EQUAL: "greaterThanOrEqual";
readonly REFLECT: "decaf.model.validation.";
readonly DATE: "date";
readonly EMAIL: "email";
readonly FORMAT: "format";
readonly LIST: "list";
readonly MAX: "max";
readonly MAX_LENGTH: "maxlength";
readonly MIN: "min";
readonly MIN_LENGTH: "minlength";
readonly PASSWORD: "password";
readonly PATTERN: "pattern";
readonly REQUIRED: "required";
readonly STEP: "step";
readonly TYPE: "type";
readonly UNIQUE: "unique";
readonly URL: "url";
readonly VALIDATOR: "validator";
};
/**
* @summary list of month names
* @description Stores month names. Can be changed for localization purposes
*
* @constant MONTH_NAMES
* @memberOf module:decorator-validation.Validation
* @category Validation
*/
export declare const MONTH_NAMES: string[];
/**
* @summary list of names of days of the week
* @description Stores names for days of the week. Can be changed for localization purposes
*
* @constant DAYS_OF_WEEK_NAMES
* @memberOf module:decorator-validation.Validation
* @category Validation
*/
export declare const DAYS_OF_WEEK_NAMES: string[];
/**
* @summary Defines the default error messages
*
* @property {string} REQUIRED default error message
* @property {string} MIN default error message
* @property {string} MAX default error message
* @property {string} MIN_LENGTH default error message
* @property {string} MAX_LENGTH default error message
* @property {string} PATTERN default error message
* @property {string} EMAIL default error message
* @property {string} URL default error message
* @property {string} TYPE default error message
* @property {string} STEP default error message
* @property {string} DATE default error message
* @property {string} DEFAULT default error message
* @property {string} PASSWORD default error message
* @property {string} LIST default error message
* @property {string} LIST_INSIDE default error message
* @property {string} MODEL_NOT_FOUND default error message
*
* @constant DEFAULT_ERROR_MESSAGES
* @memberOf module:decorator-validation.Validation
* @category Validation
*/
export declare const DEFAULT_ERROR_MESSAGES: Record<string, string>;
/**
* @summary Defines the various default regexp patterns used
*
* @enum DEFAULT_PATTERNS
* @memberOf module:decorator-validation.Validation
* @category Validation
*/
export declare const DEFAULT_PATTERNS: {
EMAIL: RegExp;
URL: RegExp;
PASSWORD: {
CHAR8_ONE_OF_EACH: RegExp;
};
};