backend v4 half
This commit is contained in:
+51
@@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getFromContainer = exports.useContainer = void 0;
|
||||
/**
|
||||
* Container to be used by this library for inversion control. If container was not implicitly set then by default
|
||||
* container simply creates a new instance of the given class.
|
||||
*/
|
||||
const defaultContainer = new (class {
|
||||
constructor() {
|
||||
this.instances = [];
|
||||
}
|
||||
get(someClass) {
|
||||
let instance = this.instances.find(instance => instance.type === someClass);
|
||||
if (!instance) {
|
||||
instance = { type: someClass, object: new someClass() };
|
||||
this.instances.push(instance);
|
||||
}
|
||||
return instance.object;
|
||||
}
|
||||
})();
|
||||
let userContainer;
|
||||
let userContainerOptions;
|
||||
/**
|
||||
* Sets container to be used by this library.
|
||||
*/
|
||||
function useContainer(iocContainer, options) {
|
||||
userContainer = iocContainer;
|
||||
userContainerOptions = options;
|
||||
}
|
||||
exports.useContainer = useContainer;
|
||||
/**
|
||||
* Gets the IOC container used by this library.
|
||||
*/
|
||||
function getFromContainer(someClass) {
|
||||
if (userContainer) {
|
||||
try {
|
||||
const instance = userContainer.get(someClass);
|
||||
if (instance)
|
||||
return instance;
|
||||
if (!userContainerOptions || !userContainerOptions.fallback)
|
||||
return instance;
|
||||
}
|
||||
catch (error) {
|
||||
if (!userContainerOptions || !userContainerOptions.fallbackOnErrors)
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return defaultContainer.get(someClass);
|
||||
}
|
||||
exports.getFromContainer = getFromContainer;
|
||||
//# sourceMappingURL=container.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"container.js","sourceRoot":"","sources":["../../src/container.ts"],"names":[],"mappings":";;;AAeA;;;GAGG;AACH,MAAM,gBAAgB,GAAqE,IAAI,CAAC;IAAA;QACtF,cAAS,GAAsC,EAAE,CAAC;IAU5D,CAAC;IATC,GAAG,CAAI,SAAsC;QAC3C,IAAI,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;QAC5E,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,QAAQ,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,SAAS,EAAE,EAAE,CAAC;YACxD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChC,CAAC;QAED,OAAO,QAAQ,CAAC,MAAM,CAAC;IACzB,CAAC;CACF,CAAC,EAAE,CAAC;AAEL,IAAI,aAA+E,CAAC;AACpF,IAAI,oBAAyC,CAAC;AAE9C;;GAEG;AACH,SAAgB,YAAY,CAAC,YAA0C,EAAE,OAA6B;IACpG,aAAa,GAAG,YAAY,CAAC;IAC7B,oBAAoB,GAAG,OAAO,CAAC;AACjC,CAAC;AAHD,oCAGC;AAED;;GAEG;AACH,SAAgB,gBAAgB,CAAI,SAAiD;IACnF,IAAI,aAAa,EAAE,CAAC;QAClB,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YAC9C,IAAI,QAAQ;gBAAE,OAAO,QAAQ,CAAC;YAE9B,IAAI,CAAC,oBAAoB,IAAI,CAAC,oBAAoB,CAAC,QAAQ;gBAAE,OAAO,QAAQ,CAAC;QAC/E,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,oBAAoB,IAAI,CAAC,oBAAoB,CAAC,gBAAgB;gBAAE,MAAM,KAAK,CAAC;QACnF,CAAC;IACH,CAAC;IACD,OAAO,gBAAgB,CAAC,GAAG,CAAI,SAAS,CAAC,CAAC;AAC5C,CAAC;AAZD,4CAYC","sourcesContent":["/**\n * Container options.\n */\nexport interface UseContainerOptions {\n /**\n * If set to true, then default container will be used in the case if given container haven't returned anything.\n */\n fallback?: boolean;\n\n /**\n * If set to true, then default container will be used in the case if given container thrown an exception.\n */\n fallbackOnErrors?: boolean;\n}\n\n/**\n * Container to be used by this library for inversion control. If container was not implicitly set then by default\n * container simply creates a new instance of the given class.\n */\nconst defaultContainer: { get<T>(someClass: { new (...args: any[]): T } | Function): T } = new (class {\n private instances: { type: Function; object: any }[] = [];\n get<T>(someClass: { new (...args: any[]): T }): T {\n let instance = this.instances.find(instance => instance.type === someClass);\n if (!instance) {\n instance = { type: someClass, object: new someClass() };\n this.instances.push(instance);\n }\n\n return instance.object;\n }\n})();\n\nlet userContainer: { get<T>(someClass: { new (...args: any[]): T } | Function): T };\nlet userContainerOptions: UseContainerOptions;\n\n/**\n * Sets container to be used by this library.\n */\nexport function useContainer(iocContainer: { get(someClass: any): any }, options?: UseContainerOptions): void {\n userContainer = iocContainer;\n userContainerOptions = options;\n}\n\n/**\n * Gets the IOC container used by this library.\n */\nexport function getFromContainer<T>(someClass: { new (...args: any[]): T } | Function): T {\n if (userContainer) {\n try {\n const instance = userContainer.get(someClass);\n if (instance) return instance;\n\n if (!userContainerOptions || !userContainerOptions.fallback) return instance;\n } catch (error) {\n if (!userContainerOptions || !userContainerOptions.fallbackOnErrors) throw error;\n }\n }\n return defaultContainer.get<T>(someClass);\n}\n"]}
|
||||
Generated
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isValidationOptions = void 0;
|
||||
function isValidationOptions(val) {
|
||||
if (!val) {
|
||||
return false;
|
||||
}
|
||||
return 'each' in val || 'message' in val || 'groups' in val || 'always' in val || 'context' in val;
|
||||
}
|
||||
exports.isValidationOptions = isValidationOptions;
|
||||
//# sourceMappingURL=ValidationOptions.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ValidationOptions.js","sourceRoot":"","sources":["../../../src/decorator/ValidationOptions.ts"],"names":[],"mappings":";;;AAiCA,SAAgB,mBAAmB,CAAC,GAAQ;IAC1C,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,MAAM,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,IAAI,QAAQ,IAAI,GAAG,IAAI,QAAQ,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,CAAC;AACrG,CAAC;AALD,kDAKC","sourcesContent":["import { ValidationArguments } from '../validation/ValidationArguments';\n\n/**\n * Options used to pass to validation decorators.\n */\nexport interface ValidationOptions {\n /**\n * Specifies if validated value is an array and each of its items must be validated.\n */\n each?: boolean;\n\n /**\n * Error message to be used on validation fail.\n * Message can be either string or a function that returns a string.\n */\n message?: string | ((validationArguments: ValidationArguments) => string);\n\n /**\n * Validation groups used for this validation.\n */\n groups?: string[];\n\n /**\n * Indicates if validation must be performed always, no matter of validation groups used.\n */\n always?: boolean;\n\n /*\n * A transient set of data passed through to the validation result for response mapping\n */\n context?: any;\n}\n\nexport function isValidationOptions(val: any): val is ValidationOptions {\n if (!val) {\n return false;\n }\n return 'each' in val || 'message' in val || 'groups' in val || 'always' in val || 'context' in val;\n}\n"]}
|
||||
Generated
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ArrayContains = exports.arrayContains = exports.ARRAY_CONTAINS = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
exports.ARRAY_CONTAINS = 'arrayContains';
|
||||
/**
|
||||
* Checks if array contains all values from the given array of values.
|
||||
* If null or undefined is given then this function returns false.
|
||||
*/
|
||||
function arrayContains(array, values) {
|
||||
if (!Array.isArray(array))
|
||||
return false;
|
||||
return values.every(value => array.indexOf(value) !== -1);
|
||||
}
|
||||
exports.arrayContains = arrayContains;
|
||||
/**
|
||||
* Checks if array contains all values from the given array of values.
|
||||
* If null or undefined is given then this function returns false.
|
||||
*/
|
||||
function ArrayContains(values, validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.ARRAY_CONTAINS,
|
||||
constraints: [values],
|
||||
validator: {
|
||||
validate: (value, args) => arrayContains(value, args === null || args === void 0 ? void 0 : args.constraints[0]),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must contain $constraint1 values', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.ArrayContains = ArrayContains;
|
||||
//# sourceMappingURL=ArrayContains.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ArrayContains.js","sourceRoot":"","sources":["../../../../src/decorator/array/ArrayContains.ts"],"names":[],"mappings":";;;AACA,qDAAgE;AAEnD,QAAA,cAAc,GAAG,eAAe,CAAC;AAE9C;;;GAGG;AACH,SAAgB,aAAa,CAAC,KAAc,EAAE,MAAa;IACzD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAExC,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC5D,CAAC;AAJD,sCAIC;AAED;;;GAGG;AACH,SAAgB,aAAa,CAAC,MAAa,EAAE,iBAAqC;IAChF,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,sBAAc;QACpB,WAAW,EAAE,CAAC,MAAM,CAAC;QACrB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAC,CAAC,CAAC,CAAC;YAC9E,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,4CAA4C,EACvE,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAfD,sCAeC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\n\nexport const ARRAY_CONTAINS = 'arrayContains';\n\n/**\n * Checks if array contains all values from the given array of values.\n * If null or undefined is given then this function returns false.\n */\nexport function arrayContains(array: unknown, values: any[]): boolean {\n if (!Array.isArray(array)) return false;\n\n return values.every(value => array.indexOf(value) !== -1);\n}\n\n/**\n * Checks if array contains all values from the given array of values.\n * If null or undefined is given then this function returns false.\n */\nexport function ArrayContains(values: any[], validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: ARRAY_CONTAINS,\n constraints: [values],\n validator: {\n validate: (value, args): boolean => arrayContains(value, args?.constraints[0]),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property must contain $constraint1 values',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ArrayMaxSize = exports.arrayMaxSize = exports.ARRAY_MAX_SIZE = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
exports.ARRAY_MAX_SIZE = 'arrayMaxSize';
|
||||
/**
|
||||
* Checks if the array's length is less or equal to the specified number.
|
||||
* If null or undefined is given then this function returns false.
|
||||
*/
|
||||
function arrayMaxSize(array, max) {
|
||||
return Array.isArray(array) && array.length <= max;
|
||||
}
|
||||
exports.arrayMaxSize = arrayMaxSize;
|
||||
/**
|
||||
* Checks if the array's length is less or equal to the specified number.
|
||||
* If null or undefined is given then this function returns false.
|
||||
*/
|
||||
function ArrayMaxSize(max, validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.ARRAY_MAX_SIZE,
|
||||
constraints: [max],
|
||||
validator: {
|
||||
validate: (value, args) => arrayMaxSize(value, args === null || args === void 0 ? void 0 : args.constraints[0]),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must contain no more than $constraint1 elements', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.ArrayMaxSize = ArrayMaxSize;
|
||||
//# sourceMappingURL=ArrayMaxSize.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ArrayMaxSize.js","sourceRoot":"","sources":["../../../../src/decorator/array/ArrayMaxSize.ts"],"names":[],"mappings":";;;AACA,qDAAgE;AAEnD,QAAA,cAAc,GAAG,cAAc,CAAC;AAE7C;;;GAGG;AACH,SAAgB,YAAY,CAAC,KAAc,EAAE,GAAW;IACtD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG,CAAC;AACrD,CAAC;AAFD,oCAEC;AAED;;;GAGG;AACH,SAAgB,YAAY,CAAC,GAAW,EAAE,iBAAqC;IAC7E,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,sBAAc;QACpB,WAAW,EAAE,CAAC,GAAG,CAAC;QAClB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAC,CAAC,CAAC,CAAC;YAC7E,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,2DAA2D,EACtF,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAfD,oCAeC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\n\nexport const ARRAY_MAX_SIZE = 'arrayMaxSize';\n\n/**\n * Checks if the array's length is less or equal to the specified number.\n * If null or undefined is given then this function returns false.\n */\nexport function arrayMaxSize(array: unknown, max: number): boolean {\n return Array.isArray(array) && array.length <= max;\n}\n\n/**\n * Checks if the array's length is less or equal to the specified number.\n * If null or undefined is given then this function returns false.\n */\nexport function ArrayMaxSize(max: number, validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: ARRAY_MAX_SIZE,\n constraints: [max],\n validator: {\n validate: (value, args): boolean => arrayMaxSize(value, args?.constraints[0]),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property must contain no more than $constraint1 elements',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ArrayMinSize = exports.arrayMinSize = exports.ARRAY_MIN_SIZE = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
exports.ARRAY_MIN_SIZE = 'arrayMinSize';
|
||||
/**
|
||||
* Checks if the array's length is greater than or equal to the specified number.
|
||||
* If null or undefined is given then this function returns false.
|
||||
*/
|
||||
function arrayMinSize(array, min) {
|
||||
return Array.isArray(array) && array.length >= min;
|
||||
}
|
||||
exports.arrayMinSize = arrayMinSize;
|
||||
/**
|
||||
* Checks if the array's length is greater than or equal to the specified number.
|
||||
* If null or undefined is given then this function returns false.
|
||||
*/
|
||||
function ArrayMinSize(min, validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.ARRAY_MIN_SIZE,
|
||||
constraints: [min],
|
||||
validator: {
|
||||
validate: (value, args) => arrayMinSize(value, args === null || args === void 0 ? void 0 : args.constraints[0]),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must contain at least $constraint1 elements', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.ArrayMinSize = ArrayMinSize;
|
||||
//# sourceMappingURL=ArrayMinSize.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ArrayMinSize.js","sourceRoot":"","sources":["../../../../src/decorator/array/ArrayMinSize.ts"],"names":[],"mappings":";;;AACA,qDAAgE;AAEnD,QAAA,cAAc,GAAG,cAAc,CAAC;AAE7C;;;GAGG;AACH,SAAgB,YAAY,CAAC,KAAc,EAAE,GAAW;IACtD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG,CAAC;AACrD,CAAC;AAFD,oCAEC;AAED;;;GAGG;AACH,SAAgB,YAAY,CAAC,GAAW,EAAE,iBAAqC;IAC7E,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,sBAAc;QACpB,WAAW,EAAE,CAAC,GAAG,CAAC;QAClB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAC,CAAC,CAAC,CAAC;YAC7E,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,uDAAuD,EAClF,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAfD,oCAeC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\n\nexport const ARRAY_MIN_SIZE = 'arrayMinSize';\n\n/**\n * Checks if the array's length is greater than or equal to the specified number.\n * If null or undefined is given then this function returns false.\n */\nexport function arrayMinSize(array: unknown, min: number): boolean {\n return Array.isArray(array) && array.length >= min;\n}\n\n/**\n * Checks if the array's length is greater than or equal to the specified number.\n * If null or undefined is given then this function returns false.\n */\nexport function ArrayMinSize(min: number, validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: ARRAY_MIN_SIZE,\n constraints: [min],\n validator: {\n validate: (value, args): boolean => arrayMinSize(value, args?.constraints[0]),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property must contain at least $constraint1 elements',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ArrayNotContains = exports.arrayNotContains = exports.ARRAY_NOT_CONTAINS = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
exports.ARRAY_NOT_CONTAINS = 'arrayNotContains';
|
||||
/**
|
||||
* Checks if array does not contain any of the given values.
|
||||
* If null or undefined is given then this function returns false.
|
||||
*/
|
||||
function arrayNotContains(array, values) {
|
||||
if (!Array.isArray(array))
|
||||
return false;
|
||||
return values.every(value => array.indexOf(value) === -1);
|
||||
}
|
||||
exports.arrayNotContains = arrayNotContains;
|
||||
/**
|
||||
* Checks if array does not contain any of the given values.
|
||||
* If null or undefined is given then this function returns false.
|
||||
*/
|
||||
function ArrayNotContains(values, validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.ARRAY_NOT_CONTAINS,
|
||||
constraints: [values],
|
||||
validator: {
|
||||
validate: (value, args) => arrayNotContains(value, args === null || args === void 0 ? void 0 : args.constraints[0]),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property should not contain $constraint1 values', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.ArrayNotContains = ArrayNotContains;
|
||||
//# sourceMappingURL=ArrayNotContains.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ArrayNotContains.js","sourceRoot":"","sources":["../../../../src/decorator/array/ArrayNotContains.ts"],"names":[],"mappings":";;;AACA,qDAAgE;AAEnD,QAAA,kBAAkB,GAAG,kBAAkB,CAAC;AAErD;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,KAAc,EAAE,MAAa;IAC5D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAExC,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC5D,CAAC;AAJD,4CAIC;AAED;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,MAAa,EAAE,iBAAqC;IACnF,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,0BAAkB;QACxB,WAAW,EAAE,CAAC,MAAM,CAAC;QACrB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,gBAAgB,CAAC,KAAK,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAC,CAAC,CAAC,CAAC;YACjF,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,kDAAkD,EAC7E,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAfD,4CAeC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\n\nexport const ARRAY_NOT_CONTAINS = 'arrayNotContains';\n\n/**\n * Checks if array does not contain any of the given values.\n * If null or undefined is given then this function returns false.\n */\nexport function arrayNotContains(array: unknown, values: any[]): boolean {\n if (!Array.isArray(array)) return false;\n\n return values.every(value => array.indexOf(value) === -1);\n}\n\n/**\n * Checks if array does not contain any of the given values.\n * If null or undefined is given then this function returns false.\n */\nexport function ArrayNotContains(values: any[], validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: ARRAY_NOT_CONTAINS,\n constraints: [values],\n validator: {\n validate: (value, args): boolean => arrayNotContains(value, args?.constraints[0]),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property should not contain $constraint1 values',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ArrayNotEmpty = exports.arrayNotEmpty = exports.ARRAY_NOT_EMPTY = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
exports.ARRAY_NOT_EMPTY = 'arrayNotEmpty';
|
||||
/**
|
||||
* Checks if given array is not empty.
|
||||
* If null or undefined is given then this function returns false.
|
||||
*/
|
||||
function arrayNotEmpty(array) {
|
||||
return Array.isArray(array) && array.length > 0;
|
||||
}
|
||||
exports.arrayNotEmpty = arrayNotEmpty;
|
||||
/**
|
||||
* Checks if given array is not empty.
|
||||
* If null or undefined is given then this function returns false.
|
||||
*/
|
||||
function ArrayNotEmpty(validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.ARRAY_NOT_EMPTY,
|
||||
validator: {
|
||||
validate: (value, args) => arrayNotEmpty(value),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property should not be empty', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.ArrayNotEmpty = ArrayNotEmpty;
|
||||
//# sourceMappingURL=ArrayNotEmpty.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ArrayNotEmpty.js","sourceRoot":"","sources":["../../../../src/decorator/array/ArrayNotEmpty.ts"],"names":[],"mappings":";;;AACA,qDAAgE;AAEnD,QAAA,eAAe,GAAG,eAAe,CAAC;AAE/C;;;GAGG;AACH,SAAgB,aAAa,CAAC,KAAc;IAC1C,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AAClD,CAAC;AAFD,sCAEC;AAED;;;GAGG;AACH,SAAgB,aAAa,CAAC,iBAAqC;IACjE,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,uBAAe;QACrB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC;YACxD,cAAc,EAAE,IAAA,yBAAY,EAAC,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,+BAA+B,EAAE,iBAAiB,CAAC;SAC5G;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAXD,sCAWC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\n\nexport const ARRAY_NOT_EMPTY = 'arrayNotEmpty';\n\n/**\n * Checks if given array is not empty.\n * If null or undefined is given then this function returns false.\n */\nexport function arrayNotEmpty(array: unknown): boolean {\n return Array.isArray(array) && array.length > 0;\n}\n\n/**\n * Checks if given array is not empty.\n * If null or undefined is given then this function returns false.\n */\nexport function ArrayNotEmpty(validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: ARRAY_NOT_EMPTY,\n validator: {\n validate: (value, args): boolean => arrayNotEmpty(value),\n defaultMessage: buildMessage(eachPrefix => eachPrefix + '$property should not be empty', validationOptions),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ArrayUnique = exports.arrayUnique = exports.ARRAY_UNIQUE = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
exports.ARRAY_UNIQUE = 'arrayUnique';
|
||||
/**
|
||||
* Checks if all array's values are unique. Comparison for objects is reference-based.
|
||||
* If null or undefined is given then this function returns false.
|
||||
*/
|
||||
function arrayUnique(array, identifier) {
|
||||
if (!Array.isArray(array))
|
||||
return false;
|
||||
if (identifier) {
|
||||
array = array.map(o => (o != null ? identifier(o) : o));
|
||||
}
|
||||
const uniqueItems = array.filter((a, b, c) => c.indexOf(a) === b);
|
||||
return array.length === uniqueItems.length;
|
||||
}
|
||||
exports.arrayUnique = arrayUnique;
|
||||
/**
|
||||
* Checks if all array's values are unique. Comparison for objects is reference-based.
|
||||
* If null or undefined is given then this function returns false.
|
||||
*/
|
||||
function ArrayUnique(identifierOrOptions, validationOptions) {
|
||||
const identifier = typeof identifierOrOptions === 'function' ? identifierOrOptions : undefined;
|
||||
const options = typeof identifierOrOptions !== 'function' ? identifierOrOptions : validationOptions;
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.ARRAY_UNIQUE,
|
||||
validator: {
|
||||
validate: (value, args) => arrayUnique(value, identifier),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + "All $property's elements must be unique", options),
|
||||
},
|
||||
}, options);
|
||||
}
|
||||
exports.ArrayUnique = ArrayUnique;
|
||||
//# sourceMappingURL=ArrayUnique.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ArrayUnique.js","sourceRoot":"","sources":["../../../../src/decorator/array/ArrayUnique.ts"],"names":[],"mappings":";;;AACA,qDAAgE;AAEnD,QAAA,YAAY,GAAG,aAAa,CAAC;AAG1C;;;GAGG;AACH,SAAgB,WAAW,CAAC,KAAgB,EAAE,UAAkC;IAC9E,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAExC,IAAI,UAAU,EAAE,CAAC;QACf,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAClE,OAAO,KAAK,CAAC,MAAM,KAAK,WAAW,CAAC,MAAM,CAAC;AAC7C,CAAC;AATD,kCASC;AAED;;;GAGG;AACH,SAAgB,WAAW,CACzB,mBAAkE,EAClE,iBAAqC;IAErC,MAAM,UAAU,GAAG,OAAO,mBAAmB,KAAK,UAAU,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/F,MAAM,OAAO,GAAG,OAAO,mBAAmB,KAAK,UAAU,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,iBAAiB,CAAC;IAEpG,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,oBAAY;QAClB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,UAAU,CAAC;YAClE,cAAc,EAAE,IAAA,yBAAY,EAAC,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,yCAAyC,EAAE,OAAO,CAAC;SAC5G;KACF,EACD,OAAO,CACR,CAAC;AACJ,CAAC;AAjBD,kCAiBC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\n\nexport const ARRAY_UNIQUE = 'arrayUnique';\nexport type ArrayUniqueIdentifier<T = any> = (o: T) => any;\n\n/**\n * Checks if all array's values are unique. Comparison for objects is reference-based.\n * If null or undefined is given then this function returns false.\n */\nexport function arrayUnique(array: unknown[], identifier?: ArrayUniqueIdentifier): boolean {\n if (!Array.isArray(array)) return false;\n\n if (identifier) {\n array = array.map(o => (o != null ? identifier(o) : o));\n }\n\n const uniqueItems = array.filter((a, b, c) => c.indexOf(a) === b);\n return array.length === uniqueItems.length;\n}\n\n/**\n * Checks if all array's values are unique. Comparison for objects is reference-based.\n * If null or undefined is given then this function returns false.\n */\nexport function ArrayUnique<T = any>(\n identifierOrOptions?: ArrayUniqueIdentifier<T> | ValidationOptions,\n validationOptions?: ValidationOptions\n): PropertyDecorator {\n const identifier = typeof identifierOrOptions === 'function' ? identifierOrOptions : undefined;\n const options = typeof identifierOrOptions !== 'function' ? identifierOrOptions : validationOptions;\n\n return ValidateBy(\n {\n name: ARRAY_UNIQUE,\n validator: {\n validate: (value, args): boolean => arrayUnique(value, identifier),\n defaultMessage: buildMessage(eachPrefix => eachPrefix + \"All $property's elements must be unique\", options),\n },\n },\n options\n );\n}\n"]}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Allow = void 0;
|
||||
const ValidationTypes_1 = require("../../validation/ValidationTypes");
|
||||
const ValidationMetadata_1 = require("../../metadata/ValidationMetadata");
|
||||
const MetadataStorage_1 = require("../../metadata/MetadataStorage");
|
||||
/**
|
||||
* If object has both allowed and not allowed properties a validation error will be thrown.
|
||||
*/
|
||||
function Allow(validationOptions) {
|
||||
return function (object, propertyName) {
|
||||
const args = {
|
||||
type: ValidationTypes_1.ValidationTypes.WHITELIST,
|
||||
target: object.constructor,
|
||||
propertyName: propertyName,
|
||||
validationOptions: validationOptions,
|
||||
};
|
||||
(0, MetadataStorage_1.getMetadataStorage)().addValidationMetadata(new ValidationMetadata_1.ValidationMetadata(args));
|
||||
};
|
||||
}
|
||||
exports.Allow = Allow;
|
||||
//# sourceMappingURL=Allow.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Allow.js","sourceRoot":"","sources":["../../../../src/decorator/common/Allow.ts"],"names":[],"mappings":";;;AAEA,sEAAmE;AACnE,0EAAuE;AACvE,oEAAoE;AAEpE;;GAEG;AACH,SAAgB,KAAK,CAAC,iBAAqC;IACzD,OAAO,UAAU,MAAc,EAAE,YAAoB;QACnD,MAAM,IAAI,GAA2B;YACnC,IAAI,EAAE,iCAAe,CAAC,SAAS;YAC/B,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,iBAAiB,EAAE,iBAAiB;SACrC,CAAC;QACF,IAAA,oCAAkB,GAAE,CAAC,qBAAqB,CAAC,IAAI,uCAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3E,CAAC,CAAC;AACJ,CAAC;AAVD,sBAUC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { ValidationMetadataArgs } from '../../metadata/ValidationMetadataArgs';\nimport { ValidationTypes } from '../../validation/ValidationTypes';\nimport { ValidationMetadata } from '../../metadata/ValidationMetadata';\nimport { getMetadataStorage } from '../../metadata/MetadataStorage';\n\n/**\n * If object has both allowed and not allowed properties a validation error will be thrown.\n */\nexport function Allow(validationOptions?: ValidationOptions): PropertyDecorator {\n return function (object: object, propertyName: string): void {\n const args: ValidationMetadataArgs = {\n type: ValidationTypes.WHITELIST,\n target: object.constructor,\n propertyName: propertyName,\n validationOptions: validationOptions,\n };\n getMetadataStorage().addValidationMetadata(new ValidationMetadata(args));\n };\n}\n"]}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Equals = exports.equals = exports.EQUALS = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
exports.EQUALS = 'equals';
|
||||
/**
|
||||
* Checks if value matches ("===") the comparison.
|
||||
*/
|
||||
function equals(value, comparison) {
|
||||
return value === comparison;
|
||||
}
|
||||
exports.equals = equals;
|
||||
/**
|
||||
* Checks if value matches ("===") the comparison.
|
||||
*/
|
||||
function Equals(comparison, validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.EQUALS,
|
||||
constraints: [comparison],
|
||||
validator: {
|
||||
validate: (value, args) => equals(value, args === null || args === void 0 ? void 0 : args.constraints[0]),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be equal to $constraint1', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.Equals = Equals;
|
||||
//# sourceMappingURL=Equals.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Equals.js","sourceRoot":"","sources":["../../../../src/decorator/common/Equals.ts"],"names":[],"mappings":";;;AACA,qDAAgE;AAEnD,QAAA,MAAM,GAAG,QAAQ,CAAC;AAE/B;;GAEG;AACH,SAAgB,MAAM,CAAC,KAAc,EAAE,UAAmB;IACxD,OAAO,KAAK,KAAK,UAAU,CAAC;AAC9B,CAAC;AAFD,wBAEC;AAED;;GAEG;AACH,SAAgB,MAAM,CAAC,UAAe,EAAE,iBAAqC;IAC3E,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,cAAM;QACZ,WAAW,EAAE,CAAC,UAAU,CAAC;QACzB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAC,CAAC,CAAC,CAAC;YACvE,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,yCAAyC,EACpE,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAfD,wBAeC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\n\nexport const EQUALS = 'equals';\n\n/**\n * Checks if value matches (\"===\") the comparison.\n */\nexport function equals(value: unknown, comparison: unknown): boolean {\n return value === comparison;\n}\n\n/**\n * Checks if value matches (\"===\") the comparison.\n */\nexport function Equals(comparison: any, validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: EQUALS,\n constraints: [comparison],\n validator: {\n validate: (value, args): boolean => equals(value, args?.constraints[0]),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property must be equal to $constraint1',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsDefined = exports.isDefined = exports.IS_DEFINED = void 0;
|
||||
const ValidateBy_1 = require("./ValidateBy");
|
||||
const ValidationTypes_1 = require("../../validation/ValidationTypes");
|
||||
// isDefined is (yet) a special case
|
||||
exports.IS_DEFINED = ValidationTypes_1.ValidationTypes.IS_DEFINED;
|
||||
/**
|
||||
* Checks if value is defined (!== undefined, !== null).
|
||||
*/
|
||||
function isDefined(value) {
|
||||
return value !== undefined && value !== null;
|
||||
}
|
||||
exports.isDefined = isDefined;
|
||||
/**
|
||||
* Checks if value is defined (!== undefined, !== null).
|
||||
*/
|
||||
function IsDefined(validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_DEFINED,
|
||||
validator: {
|
||||
validate: (value) => isDefined(value),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property should not be null or undefined', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsDefined = IsDefined;
|
||||
//# sourceMappingURL=IsDefined.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsDefined.js","sourceRoot":"","sources":["../../../../src/decorator/common/IsDefined.ts"],"names":[],"mappings":";;;AACA,6CAAwD;AACxD,sEAAmE;AAEnE,oCAAoC;AACvB,QAAA,UAAU,GAAG,iCAAe,CAAC,UAAU,CAAC;AAErD;;GAEG;AACH,SAAgB,SAAS,CAAI,KAA2B;IACtD,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC;AAC/C,CAAC;AAFD,8BAEC;AAED;;GAEG;AACH,SAAgB,SAAS,CAAC,iBAAqC;IAC7D,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,kBAAU;QAChB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAW,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC;YAC9C,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,2CAA2C,EACtE,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAdD,8BAcC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from './ValidateBy';\nimport { ValidationTypes } from '../../validation/ValidationTypes';\n\n// isDefined is (yet) a special case\nexport const IS_DEFINED = ValidationTypes.IS_DEFINED;\n\n/**\n * Checks if value is defined (!== undefined, !== null).\n */\nexport function isDefined<T>(value: T | undefined | null): value is T {\n return value !== undefined && value !== null;\n}\n\n/**\n * Checks if value is defined (!== undefined, !== null).\n */\nexport function IsDefined(validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_DEFINED,\n validator: {\n validate: (value): boolean => isDefined(value),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property should not be null or undefined',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsEmpty = exports.isEmpty = exports.IS_EMPTY = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
exports.IS_EMPTY = 'isEmpty';
|
||||
/**
|
||||
* Checks if given value is empty (=== '', === null, === undefined).
|
||||
*/
|
||||
function isEmpty(value) {
|
||||
return value === '' || value === null || value === undefined;
|
||||
}
|
||||
exports.isEmpty = isEmpty;
|
||||
/**
|
||||
* Checks if given value is empty (=== '', === null, === undefined).
|
||||
*/
|
||||
function IsEmpty(validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_EMPTY,
|
||||
validator: {
|
||||
validate: (value, args) => isEmpty(value),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be empty', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsEmpty = IsEmpty;
|
||||
//# sourceMappingURL=IsEmpty.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsEmpty.js","sourceRoot":"","sources":["../../../../src/decorator/common/IsEmpty.ts"],"names":[],"mappings":";;;AACA,qDAAgE;AAEnD,QAAA,QAAQ,GAAG,SAAS,CAAC;AAElC;;GAEG;AACH,SAAgB,OAAO,CAAC,KAAc;IACpC,OAAO,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AAC/D,CAAC;AAFD,0BAEC;AAED;;GAEG;AACH,SAAgB,OAAO,CAAC,iBAAqC;IAC3D,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,gBAAQ;QACd,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;YAClD,cAAc,EAAE,IAAA,yBAAY,EAAC,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,yBAAyB,EAAE,iBAAiB,CAAC;SACtG;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAXD,0BAWC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\n\nexport const IS_EMPTY = 'isEmpty';\n\n/**\n * Checks if given value is empty (=== '', === null, === undefined).\n */\nexport function isEmpty(value: unknown): boolean {\n return value === '' || value === null || value === undefined;\n}\n\n/**\n * Checks if given value is empty (=== '', === null, === undefined).\n */\nexport function IsEmpty(validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_EMPTY,\n validator: {\n validate: (value, args): boolean => isEmpty(value),\n defaultMessage: buildMessage(eachPrefix => eachPrefix + '$property must be empty', validationOptions),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsIn = exports.isIn = exports.IS_IN = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
exports.IS_IN = 'isIn';
|
||||
/**
|
||||
* Checks if given value is in a array of allowed values.
|
||||
*/
|
||||
function isIn(value, possibleValues) {
|
||||
return Array.isArray(possibleValues) && possibleValues.some(possibleValue => possibleValue === value);
|
||||
}
|
||||
exports.isIn = isIn;
|
||||
/**
|
||||
* Checks if given value is in a array of allowed values.
|
||||
*/
|
||||
function IsIn(values, validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_IN,
|
||||
constraints: [values],
|
||||
validator: {
|
||||
validate: (value, args) => isIn(value, args === null || args === void 0 ? void 0 : args.constraints[0]),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be one of the following values: $constraint1', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsIn = IsIn;
|
||||
//# sourceMappingURL=IsIn.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsIn.js","sourceRoot":"","sources":["../../../../src/decorator/common/IsIn.ts"],"names":[],"mappings":";;;AACA,qDAAgE;AAEnD,QAAA,KAAK,GAAG,MAAM,CAAC;AAE5B;;GAEG;AACH,SAAgB,IAAI,CAAC,KAAc,EAAE,cAAkC;IACrE,OAAO,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,aAAa,KAAK,KAAK,CAAC,CAAC;AACxG,CAAC;AAFD,oBAEC;AAED;;GAEG;AACH,SAAgB,IAAI,CAAC,MAAsB,EAAE,iBAAqC;IAChF,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,aAAK;QACX,WAAW,EAAE,CAAC,MAAM,CAAC;QACrB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAC,CAAC,CAAC,CAAC;YACrE,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,6DAA6D,EACxF,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAfD,oBAeC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\n\nexport const IS_IN = 'isIn';\n\n/**\n * Checks if given value is in a array of allowed values.\n */\nexport function isIn(value: unknown, possibleValues: readonly unknown[]): boolean {\n return Array.isArray(possibleValues) && possibleValues.some(possibleValue => possibleValue === value);\n}\n\n/**\n * Checks if given value is in a array of allowed values.\n */\nexport function IsIn(values: readonly any[], validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_IN,\n constraints: [values],\n validator: {\n validate: (value, args): boolean => isIn(value, args?.constraints[0]),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property must be one of the following values: $constraint1',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsLatLong = exports.isLatLong = exports.IS_LATLONG = void 0;
|
||||
const ValidateBy_1 = require("./ValidateBy");
|
||||
const isLatLong_1 = __importDefault(require("validator/lib/isLatLong"));
|
||||
exports.IS_LATLONG = 'isLatLong';
|
||||
/**
|
||||
* Checks if a value is string in format a "latitude,longitude".
|
||||
*/
|
||||
function isLatLong(value) {
|
||||
return typeof value === 'string' && (0, isLatLong_1.default)(value);
|
||||
}
|
||||
exports.isLatLong = isLatLong;
|
||||
/**
|
||||
* Checks if a value is string in format a "latitude,longitude".
|
||||
*/
|
||||
function IsLatLong(validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_LATLONG,
|
||||
validator: {
|
||||
validate: (value, args) => isLatLong(value),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be a latitude,longitude string', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsLatLong = IsLatLong;
|
||||
//# sourceMappingURL=IsLatLong.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsLatLong.js","sourceRoot":"","sources":["../../../../src/decorator/common/IsLatLong.ts"],"names":[],"mappings":";;;;;;AACA,6CAAwD;AACxD,wEAAyD;AAE5C,QAAA,UAAU,GAAG,WAAW,CAAC;AAEtC;;GAEG;AACH,SAAgB,SAAS,CAAC,KAAa;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAA,mBAAkB,EAAC,KAAK,CAAC,CAAC;AAChE,CAAC;AAFD,8BAEC;AAED;;GAEG;AACH,SAAgB,SAAS,CAAC,iBAAqC;IAC7D,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,kBAAU;QAChB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC;YACpD,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,+CAA+C,EAC1E,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAdD,8BAcC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from './ValidateBy';\nimport isLatLongValidator from 'validator/lib/isLatLong';\n\nexport const IS_LATLONG = 'isLatLong';\n\n/**\n * Checks if a value is string in format a \"latitude,longitude\".\n */\nexport function isLatLong(value: string): boolean {\n return typeof value === 'string' && isLatLongValidator(value);\n}\n\n/**\n * Checks if a value is string in format a \"latitude,longitude\".\n */\nexport function IsLatLong(validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_LATLONG,\n validator: {\n validate: (value, args): boolean => isLatLong(value),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property must be a latitude,longitude string',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsLatitude = exports.isLatitude = exports.IS_LATITUDE = void 0;
|
||||
const ValidateBy_1 = require("./ValidateBy");
|
||||
const IsLatLong_1 = require("./IsLatLong");
|
||||
exports.IS_LATITUDE = 'isLatitude';
|
||||
/**
|
||||
* Checks if a given value is a latitude.
|
||||
*/
|
||||
function isLatitude(value) {
|
||||
return (typeof value === 'number' || typeof value === 'string') && (0, IsLatLong_1.isLatLong)(`${value},0`);
|
||||
}
|
||||
exports.isLatitude = isLatitude;
|
||||
/**
|
||||
* Checks if a given value is a latitude.
|
||||
*/
|
||||
function IsLatitude(validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_LATITUDE,
|
||||
validator: {
|
||||
validate: (value, args) => isLatitude(value),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be a latitude string or number', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsLatitude = IsLatitude;
|
||||
//# sourceMappingURL=IsLatitude.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsLatitude.js","sourceRoot":"","sources":["../../../../src/decorator/common/IsLatitude.ts"],"names":[],"mappings":";;;AACA,6CAAwD;AACxD,2CAAwC;AAE3B,QAAA,WAAW,GAAG,YAAY,CAAC;AAExC;;GAEG;AACH,SAAgB,UAAU,CAAC,KAAa;IACtC,OAAO,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,IAAI,IAAA,qBAAS,EAAC,GAAG,KAAK,IAAI,CAAC,CAAC;AAC7F,CAAC;AAFD,gCAEC;AAED;;GAEG;AACH,SAAgB,UAAU,CAAC,iBAAqC;IAC9D,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,mBAAW;QACjB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC;YACrD,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,+CAA+C,EAC1E,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAdD,gCAcC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from './ValidateBy';\nimport { isLatLong } from './IsLatLong';\n\nexport const IS_LATITUDE = 'isLatitude';\n\n/**\n * Checks if a given value is a latitude.\n */\nexport function isLatitude(value: string): boolean {\n return (typeof value === 'number' || typeof value === 'string') && isLatLong(`${value},0`);\n}\n\n/**\n * Checks if a given value is a latitude.\n */\nexport function IsLatitude(validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_LATITUDE,\n validator: {\n validate: (value, args): boolean => isLatitude(value),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property must be a latitude string or number',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsLongitude = exports.isLongitude = exports.IS_LONGITUDE = void 0;
|
||||
const ValidateBy_1 = require("./ValidateBy");
|
||||
const IsLatLong_1 = require("./IsLatLong");
|
||||
exports.IS_LONGITUDE = 'isLongitude';
|
||||
/**
|
||||
* Checks if a given value is a longitude.
|
||||
*/
|
||||
function isLongitude(value) {
|
||||
return (typeof value === 'number' || typeof value === 'string') && (0, IsLatLong_1.isLatLong)(`0,${value}`);
|
||||
}
|
||||
exports.isLongitude = isLongitude;
|
||||
/**
|
||||
* Checks if a given value is a longitude.
|
||||
*/
|
||||
function IsLongitude(validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_LONGITUDE,
|
||||
validator: {
|
||||
validate: (value, args) => isLongitude(value),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be a longitude string or number', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsLongitude = IsLongitude;
|
||||
//# sourceMappingURL=IsLongitude.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsLongitude.js","sourceRoot":"","sources":["../../../../src/decorator/common/IsLongitude.ts"],"names":[],"mappings":";;;AACA,6CAAwD;AACxD,2CAAwC;AAE3B,QAAA,YAAY,GAAG,aAAa,CAAC;AAE1C;;GAEG;AACH,SAAgB,WAAW,CAAC,KAAa;IACvC,OAAO,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,IAAI,IAAA,qBAAS,EAAC,KAAK,KAAK,EAAE,CAAC,CAAC;AAC7F,CAAC;AAFD,kCAEC;AAED;;GAEG;AACH,SAAgB,WAAW,CAAC,iBAAqC;IAC/D,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,oBAAY;QAClB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC;YACtD,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,gDAAgD,EAC3E,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAdD,kCAcC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from './ValidateBy';\nimport { isLatLong } from './IsLatLong';\n\nexport const IS_LONGITUDE = 'isLongitude';\n\n/**\n * Checks if a given value is a longitude.\n */\nexport function isLongitude(value: string): boolean {\n return (typeof value === 'number' || typeof value === 'string') && isLatLong(`0,${value}`);\n}\n\n/**\n * Checks if a given value is a longitude.\n */\nexport function IsLongitude(validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_LONGITUDE,\n validator: {\n validate: (value, args): boolean => isLongitude(value),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property must be a longitude string or number',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsNotEmpty = exports.isNotEmpty = exports.IS_NOT_EMPTY = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
exports.IS_NOT_EMPTY = 'isNotEmpty';
|
||||
/**
|
||||
* Checks if given value is not empty (!== '', !== null, !== undefined).
|
||||
*/
|
||||
function isNotEmpty(value) {
|
||||
return value !== '' && value !== null && value !== undefined;
|
||||
}
|
||||
exports.isNotEmpty = isNotEmpty;
|
||||
/**
|
||||
* Checks if given value is not empty (!== '', !== null, !== undefined).
|
||||
*/
|
||||
function IsNotEmpty(validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_NOT_EMPTY,
|
||||
validator: {
|
||||
validate: (value, args) => isNotEmpty(value),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property should not be empty', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsNotEmpty = IsNotEmpty;
|
||||
//# sourceMappingURL=IsNotEmpty.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsNotEmpty.js","sourceRoot":"","sources":["../../../../src/decorator/common/IsNotEmpty.ts"],"names":[],"mappings":";;;AACA,qDAAgE;AAEnD,QAAA,YAAY,GAAG,YAAY,CAAC;AAEzC;;GAEG;AACH,SAAgB,UAAU,CAAC,KAAc;IACvC,OAAO,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AAC/D,CAAC;AAFD,gCAEC;AAED;;GAEG;AACH,SAAgB,UAAU,CAAC,iBAAqC;IAC9D,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,oBAAY;QAClB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC;YACrD,cAAc,EAAE,IAAA,yBAAY,EAAC,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,+BAA+B,EAAE,iBAAiB,CAAC;SAC5G;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAXD,gCAWC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\n\nexport const IS_NOT_EMPTY = 'isNotEmpty';\n\n/**\n * Checks if given value is not empty (!== '', !== null, !== undefined).\n */\nexport function isNotEmpty(value: unknown): boolean {\n return value !== '' && value !== null && value !== undefined;\n}\n\n/**\n * Checks if given value is not empty (!== '', !== null, !== undefined).\n */\nexport function IsNotEmpty(validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_NOT_EMPTY,\n validator: {\n validate: (value, args): boolean => isNotEmpty(value),\n defaultMessage: buildMessage(eachPrefix => eachPrefix + '$property should not be empty', validationOptions),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsNotIn = exports.isNotIn = exports.IS_NOT_IN = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
exports.IS_NOT_IN = 'isNotIn';
|
||||
/**
|
||||
* Checks if given value not in a array of allowed values.
|
||||
*/
|
||||
function isNotIn(value, possibleValues) {
|
||||
return !Array.isArray(possibleValues) || !possibleValues.some(possibleValue => possibleValue === value);
|
||||
}
|
||||
exports.isNotIn = isNotIn;
|
||||
/**
|
||||
* Checks if given value not in a array of allowed values.
|
||||
*/
|
||||
function IsNotIn(values, validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_NOT_IN,
|
||||
constraints: [values],
|
||||
validator: {
|
||||
validate: (value, args) => isNotIn(value, args === null || args === void 0 ? void 0 : args.constraints[0]),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property should not be one of the following values: $constraint1', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsNotIn = IsNotIn;
|
||||
//# sourceMappingURL=IsNotIn.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsNotIn.js","sourceRoot":"","sources":["../../../../src/decorator/common/IsNotIn.ts"],"names":[],"mappings":";;;AACA,qDAAgE;AAEnD,QAAA,SAAS,GAAG,SAAS,CAAC;AAEnC;;GAEG;AACH,SAAgB,OAAO,CAAC,KAAc,EAAE,cAAkC;IACxE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,aAAa,KAAK,KAAK,CAAC,CAAC;AAC1G,CAAC;AAFD,0BAEC;AAED;;GAEG;AACH,SAAgB,OAAO,CAAC,MAAsB,EAAE,iBAAqC;IACnF,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,iBAAS;QACf,WAAW,EAAE,CAAC,MAAM,CAAC;QACrB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAC,CAAC,CAAC,CAAC;YACxE,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,mEAAmE,EAC9F,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAfD,0BAeC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\n\nexport const IS_NOT_IN = 'isNotIn';\n\n/**\n * Checks if given value not in a array of allowed values.\n */\nexport function isNotIn(value: unknown, possibleValues: readonly unknown[]): boolean {\n return !Array.isArray(possibleValues) || !possibleValues.some(possibleValue => possibleValue === value);\n}\n\n/**\n * Checks if given value not in a array of allowed values.\n */\nexport function IsNotIn(values: readonly any[], validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_NOT_IN,\n constraints: [values],\n validator: {\n validate: (value, args): boolean => isNotIn(value, args?.constraints[0]),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property should not be one of the following values: $constraint1',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsOptional = exports.IS_OPTIONAL = void 0;
|
||||
const ValidationTypes_1 = require("../../validation/ValidationTypes");
|
||||
const ValidationMetadata_1 = require("../../metadata/ValidationMetadata");
|
||||
const MetadataStorage_1 = require("../../metadata/MetadataStorage");
|
||||
exports.IS_OPTIONAL = 'isOptional';
|
||||
/**
|
||||
* Checks if value is missing and if so, ignores all validators.
|
||||
*/
|
||||
function IsOptional(validationOptions) {
|
||||
return function (object, propertyName) {
|
||||
const args = {
|
||||
type: ValidationTypes_1.ValidationTypes.CONDITIONAL_VALIDATION,
|
||||
name: exports.IS_OPTIONAL,
|
||||
target: object.constructor,
|
||||
propertyName: propertyName,
|
||||
constraints: [
|
||||
(object, value) => {
|
||||
return object[propertyName] !== null && object[propertyName] !== undefined;
|
||||
},
|
||||
],
|
||||
validationOptions: validationOptions,
|
||||
};
|
||||
(0, MetadataStorage_1.getMetadataStorage)().addValidationMetadata(new ValidationMetadata_1.ValidationMetadata(args));
|
||||
};
|
||||
}
|
||||
exports.IsOptional = IsOptional;
|
||||
//# sourceMappingURL=IsOptional.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsOptional.js","sourceRoot":"","sources":["../../../../src/decorator/common/IsOptional.ts"],"names":[],"mappings":";;;AAEA,sEAAmE;AACnE,0EAAuE;AACvE,oEAAoE;AAEvD,QAAA,WAAW,GAAG,YAAY,CAAC;AAExC;;GAEG;AACH,SAAgB,UAAU,CAAC,iBAAqC;IAC9D,OAAO,UAAU,MAAc,EAAE,YAAoB;QACnD,MAAM,IAAI,GAA2B;YACnC,IAAI,EAAE,iCAAe,CAAC,sBAAsB;YAC5C,IAAI,EAAE,mBAAW;YACjB,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,WAAW,EAAE;gBACX,CAAC,MAAW,EAAE,KAAU,EAAW,EAAE;oBACnC,OAAO,MAAM,CAAC,YAAY,CAAC,KAAK,IAAI,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,SAAS,CAAC;gBAC7E,CAAC;aACF;YACD,iBAAiB,EAAE,iBAAiB;SACrC,CAAC;QACF,IAAA,oCAAkB,GAAE,CAAC,qBAAqB,CAAC,IAAI,uCAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3E,CAAC,CAAC;AACJ,CAAC;AAhBD,gCAgBC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { ValidationMetadataArgs } from '../../metadata/ValidationMetadataArgs';\nimport { ValidationTypes } from '../../validation/ValidationTypes';\nimport { ValidationMetadata } from '../../metadata/ValidationMetadata';\nimport { getMetadataStorage } from '../../metadata/MetadataStorage';\n\nexport const IS_OPTIONAL = 'isOptional';\n\n/**\n * Checks if value is missing and if so, ignores all validators.\n */\nexport function IsOptional(validationOptions?: ValidationOptions): PropertyDecorator {\n return function (object: object, propertyName: string): void {\n const args: ValidationMetadataArgs = {\n type: ValidationTypes.CONDITIONAL_VALIDATION,\n name: IS_OPTIONAL,\n target: object.constructor,\n propertyName: propertyName,\n constraints: [\n (object: any, value: any): boolean => {\n return object[propertyName] !== null && object[propertyName] !== undefined;\n },\n ],\n validationOptions: validationOptions,\n };\n getMetadataStorage().addValidationMetadata(new ValidationMetadata(args));\n };\n}\n"]}
|
||||
Generated
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NotEquals = exports.notEquals = exports.NOT_EQUALS = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
exports.NOT_EQUALS = 'notEquals';
|
||||
/**
|
||||
* Checks if value does not match ("!==") the comparison.
|
||||
*/
|
||||
function notEquals(value, comparison) {
|
||||
return value !== comparison;
|
||||
}
|
||||
exports.notEquals = notEquals;
|
||||
/**
|
||||
* Checks if value does not match ("!==") the comparison.
|
||||
*/
|
||||
function NotEquals(comparison, validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.NOT_EQUALS,
|
||||
constraints: [comparison],
|
||||
validator: {
|
||||
validate: (value, args) => notEquals(value, args === null || args === void 0 ? void 0 : args.constraints[0]),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property should not be equal to $constraint1', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.NotEquals = NotEquals;
|
||||
//# sourceMappingURL=NotEquals.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"NotEquals.js","sourceRoot":"","sources":["../../../../src/decorator/common/NotEquals.ts"],"names":[],"mappings":";;;AACA,qDAAgE;AAEnD,QAAA,UAAU,GAAG,WAAW,CAAC;AAEtC;;GAEG;AACH,SAAgB,SAAS,CAAC,KAAc,EAAE,UAAmB;IAC3D,OAAO,KAAK,KAAK,UAAU,CAAC;AAC9B,CAAC;AAFD,8BAEC;AAED;;GAEG;AACH,SAAgB,SAAS,CAAC,UAAe,EAAE,iBAAqC;IAC9E,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,kBAAU;QAChB,WAAW,EAAE,CAAC,UAAU,CAAC;QACzB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAC,CAAC,CAAC,CAAC;YAC1E,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,+CAA+C,EAC1E,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAfD,8BAeC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\n\nexport const NOT_EQUALS = 'notEquals';\n\n/**\n * Checks if value does not match (\"!==\") the comparison.\n */\nexport function notEquals(value: unknown, comparison: unknown): boolean {\n return value !== comparison;\n}\n\n/**\n * Checks if value does not match (\"!==\") the comparison.\n */\nexport function NotEquals(comparison: any, validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: NOT_EQUALS,\n constraints: [comparison],\n validator: {\n validate: (value, args): boolean => notEquals(value, args?.constraints[0]),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property should not be equal to $constraint1',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Validate = exports.ValidatorConstraint = void 0;
|
||||
const ValidationMetadata_1 = require("../../metadata/ValidationMetadata");
|
||||
const MetadataStorage_1 = require("../../metadata/MetadataStorage");
|
||||
const ValidationTypes_1 = require("../../validation/ValidationTypes");
|
||||
const ConstraintMetadata_1 = require("../../metadata/ConstraintMetadata");
|
||||
/**
|
||||
* Registers custom validator class.
|
||||
*/
|
||||
function ValidatorConstraint(options) {
|
||||
return function (target) {
|
||||
const isAsync = options && options.async;
|
||||
let name = options && options.name ? options.name : '';
|
||||
if (!name) {
|
||||
name = target.name;
|
||||
if (!name)
|
||||
// generate name if it was not given
|
||||
name = name.replace(/\.?([A-Z]+)/g, (x, y) => '_' + y.toLowerCase()).replace(/^_/, '');
|
||||
}
|
||||
const metadata = new ConstraintMetadata_1.ConstraintMetadata(target, name, isAsync);
|
||||
(0, MetadataStorage_1.getMetadataStorage)().addConstraintMetadata(metadata);
|
||||
};
|
||||
}
|
||||
exports.ValidatorConstraint = ValidatorConstraint;
|
||||
function Validate(constraintClass, constraintsOrValidationOptions, maybeValidationOptions) {
|
||||
return function (object, propertyName) {
|
||||
const args = {
|
||||
type: ValidationTypes_1.ValidationTypes.CUSTOM_VALIDATION,
|
||||
target: object.constructor,
|
||||
propertyName: propertyName,
|
||||
constraintCls: constraintClass,
|
||||
constraints: Array.isArray(constraintsOrValidationOptions) ? constraintsOrValidationOptions : undefined,
|
||||
validationOptions: !Array.isArray(constraintsOrValidationOptions)
|
||||
? constraintsOrValidationOptions
|
||||
: maybeValidationOptions,
|
||||
};
|
||||
(0, MetadataStorage_1.getMetadataStorage)().addValidationMetadata(new ValidationMetadata_1.ValidationMetadata(args));
|
||||
};
|
||||
}
|
||||
exports.Validate = Validate;
|
||||
//# sourceMappingURL=Validate.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Validate.js","sourceRoot":"","sources":["../../../../src/decorator/common/Validate.ts"],"names":[],"mappings":";;;AAEA,0EAAuE;AACvE,oEAAoE;AACpE,sEAAmE;AACnE,0EAAuE;AAEvE;;GAEG;AACH,SAAgB,mBAAmB,CAAC,OAA4C;IAC9E,OAAO,UAAU,MAAgB;QAC/B,MAAM,OAAO,GAAG,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC;QACzC,IAAI,IAAI,GAAG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QACvD,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,IAAI,GAAI,MAAc,CAAC,IAAI,CAAC;YAC5B,IAAI,CAAC,IAAI;gBACP,oCAAoC;gBACpC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAI,CAAY,CAAC,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACvG,CAAC;QACD,MAAM,QAAQ,GAAG,IAAI,uCAAkB,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAC/D,IAAA,oCAAkB,GAAE,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IACvD,CAAC,CAAC;AACJ,CAAC;AAbD,kDAaC;AAYD,SAAgB,QAAQ,CACtB,eAAyB,EACzB,8BAA0D,EAC1D,sBAA0C;IAE1C,OAAO,UAAU,MAAc,EAAE,YAAoB;QACnD,MAAM,IAAI,GAA2B;YACnC,IAAI,EAAE,iCAAe,CAAC,iBAAiB;YACvC,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,aAAa,EAAE,eAAe;YAC9B,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,8BAA8B,CAAC,CAAC,CAAC,CAAC,8BAA8B,CAAC,CAAC,CAAC,SAAS;YACvG,iBAAiB,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,8BAA8B,CAAC;gBAC/D,CAAC,CAAC,8BAA8B;gBAChC,CAAC,CAAC,sBAAsB;SAC3B,CAAC;QACF,IAAA,oCAAkB,GAAE,CAAC,qBAAqB,CAAC,IAAI,uCAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3E,CAAC,CAAC;AACJ,CAAC;AAlBD,4BAkBC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { ValidationMetadataArgs } from '../../metadata/ValidationMetadataArgs';\nimport { ValidationMetadata } from '../../metadata/ValidationMetadata';\nimport { getMetadataStorage } from '../../metadata/MetadataStorage';\nimport { ValidationTypes } from '../../validation/ValidationTypes';\nimport { ConstraintMetadata } from '../../metadata/ConstraintMetadata';\n\n/**\n * Registers custom validator class.\n */\nexport function ValidatorConstraint(options?: { name?: string; async?: boolean }) {\n return function (target: Function): void {\n const isAsync = options && options.async;\n let name = options && options.name ? options.name : '';\n if (!name) {\n name = (target as any).name;\n if (!name)\n // generate name if it was not given\n name = name.replace(/\\.?([A-Z]+)/g, (x, y) => '_' + (y as string).toLowerCase()).replace(/^_/, '');\n }\n const metadata = new ConstraintMetadata(target, name, isAsync);\n getMetadataStorage().addConstraintMetadata(metadata);\n };\n}\n\n/**\n * Performs validation based on the given custom validation class.\n * Validation class must be decorated with ValidatorConstraint decorator.\n */\nexport function Validate(constraintClass: Function, validationOptions?: ValidationOptions): PropertyDecorator;\nexport function Validate(\n constraintClass: Function,\n constraints?: any[],\n validationOptions?: ValidationOptions\n): PropertyDecorator;\nexport function Validate(\n constraintClass: Function,\n constraintsOrValidationOptions?: any[] | ValidationOptions,\n maybeValidationOptions?: ValidationOptions\n): PropertyDecorator {\n return function (object: object, propertyName: string): void {\n const args: ValidationMetadataArgs = {\n type: ValidationTypes.CUSTOM_VALIDATION,\n target: object.constructor,\n propertyName: propertyName,\n constraintCls: constraintClass,\n constraints: Array.isArray(constraintsOrValidationOptions) ? constraintsOrValidationOptions : undefined,\n validationOptions: !Array.isArray(constraintsOrValidationOptions)\n ? constraintsOrValidationOptions\n : maybeValidationOptions,\n };\n getMetadataStorage().addValidationMetadata(new ValidationMetadata(args));\n };\n}\n"]}
|
||||
Generated
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ValidateBy = exports.buildMessage = void 0;
|
||||
const register_decorator_1 = require("../../register-decorator");
|
||||
function buildMessage(impl, validationOptions) {
|
||||
return (validationArguments) => {
|
||||
const eachPrefix = validationOptions && validationOptions.each ? 'each value in ' : '';
|
||||
return impl(eachPrefix, validationArguments);
|
||||
};
|
||||
}
|
||||
exports.buildMessage = buildMessage;
|
||||
function ValidateBy(options, validationOptions) {
|
||||
return function (object, propertyName) {
|
||||
(0, register_decorator_1.registerDecorator)({
|
||||
name: options.name,
|
||||
target: object.constructor,
|
||||
propertyName: propertyName,
|
||||
options: validationOptions,
|
||||
constraints: options.constraints,
|
||||
validator: options.validator,
|
||||
});
|
||||
};
|
||||
}
|
||||
exports.ValidateBy = ValidateBy;
|
||||
//# sourceMappingURL=ValidateBy.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ValidateBy.js","sourceRoot":"","sources":["../../../../src/decorator/common/ValidateBy.ts"],"names":[],"mappings":";;;AACA,iEAA6D;AAW7D,SAAgB,YAAY,CAC1B,IAAgE,EAChE,iBAAqC;IAErC,OAAO,CAAC,mBAAyC,EAAU,EAAE;QAC3D,MAAM,UAAU,GAAG,iBAAiB,IAAI,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;QACvF,OAAO,IAAI,CAAC,UAAU,EAAE,mBAAmB,CAAC,CAAC;IAC/C,CAAC,CAAC;AACJ,CAAC;AARD,oCAQC;AAED,SAAgB,UAAU,CAAC,OAA0B,EAAE,iBAAqC;IAC1F,OAAO,UAAU,MAAc,EAAE,YAAoB;QACnD,IAAA,sCAAiB,EAAC;YAChB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,OAAO,EAAE,iBAAiB;YAC1B,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,SAAS,EAAE,OAAO,CAAC,SAAS;SAC7B,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAXD,gCAWC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { registerDecorator } from '../../register-decorator';\nimport { ValidationArguments } from '../../validation/ValidationArguments';\nimport { ValidatorConstraintInterface } from '../../validation/ValidatorConstraintInterface';\n\nexport interface ValidateByOptions {\n name: string;\n constraints?: any[];\n validator: ValidatorConstraintInterface | Function;\n async?: boolean;\n}\n\nexport function buildMessage(\n impl: (eachPrefix: string, args?: ValidationArguments) => string,\n validationOptions?: ValidationOptions\n): (validationArguments?: ValidationArguments) => string {\n return (validationArguments?: ValidationArguments): string => {\n const eachPrefix = validationOptions && validationOptions.each ? 'each value in ' : '';\n return impl(eachPrefix, validationArguments);\n };\n}\n\nexport function ValidateBy(options: ValidateByOptions, validationOptions?: ValidationOptions): PropertyDecorator {\n return function (object: object, propertyName: string): void {\n registerDecorator({\n name: options.name,\n target: object.constructor,\n propertyName: propertyName,\n options: validationOptions,\n constraints: options.constraints,\n validator: options.validator,\n });\n };\n}\n"]}
|
||||
Generated
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ValidateIf = void 0;
|
||||
const ValidationTypes_1 = require("../../validation/ValidationTypes");
|
||||
const ValidationMetadata_1 = require("../../metadata/ValidationMetadata");
|
||||
const MetadataStorage_1 = require("../../metadata/MetadataStorage");
|
||||
/**
|
||||
* Ignores the other validators on a property when the provided condition function returns false.
|
||||
*/
|
||||
function ValidateIf(condition, validationOptions) {
|
||||
return function (object, propertyName) {
|
||||
const args = {
|
||||
type: ValidationTypes_1.ValidationTypes.CONDITIONAL_VALIDATION,
|
||||
target: object.constructor,
|
||||
propertyName: propertyName,
|
||||
constraints: [condition],
|
||||
validationOptions: validationOptions,
|
||||
};
|
||||
(0, MetadataStorage_1.getMetadataStorage)().addValidationMetadata(new ValidationMetadata_1.ValidationMetadata(args));
|
||||
};
|
||||
}
|
||||
exports.ValidateIf = ValidateIf;
|
||||
//# sourceMappingURL=ValidateIf.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ValidateIf.js","sourceRoot":"","sources":["../../../../src/decorator/common/ValidateIf.ts"],"names":[],"mappings":";;;AAEA,sEAAmE;AACnE,0EAAuE;AACvE,oEAAoE;AAEpE;;GAEG;AACH,SAAgB,UAAU,CACxB,SAA+C,EAC/C,iBAAqC;IAErC,OAAO,UAAU,MAAc,EAAE,YAAoB;QACnD,MAAM,IAAI,GAA2B;YACnC,IAAI,EAAE,iCAAe,CAAC,sBAAsB;YAC5C,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,WAAW,EAAE,CAAC,SAAS,CAAC;YACxB,iBAAiB,EAAE,iBAAiB;SACrC,CAAC;QACF,IAAA,oCAAkB,GAAE,CAAC,qBAAqB,CAAC,IAAI,uCAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3E,CAAC,CAAC;AACJ,CAAC;AAdD,gCAcC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { ValidationMetadataArgs } from '../../metadata/ValidationMetadataArgs';\nimport { ValidationTypes } from '../../validation/ValidationTypes';\nimport { ValidationMetadata } from '../../metadata/ValidationMetadata';\nimport { getMetadataStorage } from '../../metadata/MetadataStorage';\n\n/**\n * Ignores the other validators on a property when the provided condition function returns false.\n */\nexport function ValidateIf(\n condition: (object: any, value: any) => boolean,\n validationOptions?: ValidationOptions\n): PropertyDecorator {\n return function (object: object, propertyName: string): void {\n const args: ValidationMetadataArgs = {\n type: ValidationTypes.CONDITIONAL_VALIDATION,\n target: object.constructor,\n propertyName: propertyName,\n constraints: [condition],\n validationOptions: validationOptions,\n };\n getMetadataStorage().addValidationMetadata(new ValidationMetadata(args));\n };\n}\n"]}
|
||||
Generated
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ValidateNested = void 0;
|
||||
const ValidationTypes_1 = require("../../validation/ValidationTypes");
|
||||
const ValidationMetadata_1 = require("../../metadata/ValidationMetadata");
|
||||
const MetadataStorage_1 = require("../../metadata/MetadataStorage");
|
||||
/**
|
||||
* Objects / object arrays marked with this decorator will also be validated.
|
||||
*/
|
||||
function ValidateNested(validationOptions) {
|
||||
const opts = { ...validationOptions };
|
||||
const eachPrefix = opts.each ? 'each value in ' : '';
|
||||
opts.message = opts.message || eachPrefix + 'nested property $property must be either object or array';
|
||||
return function (object, propertyName) {
|
||||
const args = {
|
||||
type: ValidationTypes_1.ValidationTypes.NESTED_VALIDATION,
|
||||
target: object.constructor,
|
||||
propertyName: propertyName,
|
||||
validationOptions: opts,
|
||||
};
|
||||
(0, MetadataStorage_1.getMetadataStorage)().addValidationMetadata(new ValidationMetadata_1.ValidationMetadata(args));
|
||||
};
|
||||
}
|
||||
exports.ValidateNested = ValidateNested;
|
||||
//# sourceMappingURL=ValidateNested.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ValidateNested.js","sourceRoot":"","sources":["../../../../src/decorator/common/ValidateNested.ts"],"names":[],"mappings":";;;AAEA,sEAAmE;AACnE,0EAAuE;AACvE,oEAAoE;AAEpE;;GAEG;AACH,SAAgB,cAAc,CAAC,iBAAqC;IAClE,MAAM,IAAI,GAAsB,EAAE,GAAG,iBAAiB,EAAE,CAAC;IACzD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;IACrD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,UAAU,GAAG,0DAA0D,CAAC;IAEvG,OAAO,UAAU,MAAc,EAAE,YAAoB;QACnD,MAAM,IAAI,GAA2B;YACnC,IAAI,EAAE,iCAAe,CAAC,iBAAiB;YACvC,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,iBAAiB,EAAE,IAAI;SACxB,CAAC;QACF,IAAA,oCAAkB,GAAE,CAAC,qBAAqB,CAAC,IAAI,uCAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3E,CAAC,CAAC;AACJ,CAAC;AAdD,wCAcC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { ValidationMetadataArgs } from '../../metadata/ValidationMetadataArgs';\nimport { ValidationTypes } from '../../validation/ValidationTypes';\nimport { ValidationMetadata } from '../../metadata/ValidationMetadata';\nimport { getMetadataStorage } from '../../metadata/MetadataStorage';\n\n/**\n * Objects / object arrays marked with this decorator will also be validated.\n */\nexport function ValidateNested(validationOptions?: ValidationOptions): PropertyDecorator {\n const opts: ValidationOptions = { ...validationOptions };\n const eachPrefix = opts.each ? 'each value in ' : '';\n opts.message = opts.message || eachPrefix + 'nested property $property must be either object or array';\n\n return function (object: object, propertyName: string): void {\n const args: ValidationMetadataArgs = {\n type: ValidationTypes.NESTED_VALIDATION,\n target: object.constructor,\n propertyName: propertyName,\n validationOptions: opts,\n };\n getMetadataStorage().addValidationMetadata(new ValidationMetadata(args));\n };\n}\n"]}
|
||||
Generated
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ValidatePromise = void 0;
|
||||
const ValidationTypes_1 = require("../../validation/ValidationTypes");
|
||||
const ValidationMetadata_1 = require("../../metadata/ValidationMetadata");
|
||||
const MetadataStorage_1 = require("../../metadata/MetadataStorage");
|
||||
/**
|
||||
* Resolve promise before validation
|
||||
*/
|
||||
function ValidatePromise(validationOptions) {
|
||||
return function (object, propertyName) {
|
||||
const args = {
|
||||
type: ValidationTypes_1.ValidationTypes.PROMISE_VALIDATION,
|
||||
target: object.constructor,
|
||||
propertyName: propertyName,
|
||||
validationOptions: validationOptions,
|
||||
};
|
||||
(0, MetadataStorage_1.getMetadataStorage)().addValidationMetadata(new ValidationMetadata_1.ValidationMetadata(args));
|
||||
};
|
||||
}
|
||||
exports.ValidatePromise = ValidatePromise;
|
||||
//# sourceMappingURL=ValidatePromise.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ValidatePromise.js","sourceRoot":"","sources":["../../../../src/decorator/common/ValidatePromise.ts"],"names":[],"mappings":";;;AAEA,sEAAmE;AACnE,0EAAuE;AACvE,oEAAoE;AAEpE;;GAEG;AACH,SAAgB,eAAe,CAAC,iBAAqC;IACnE,OAAO,UAAU,MAAc,EAAE,YAAoB;QACnD,MAAM,IAAI,GAA2B;YACnC,IAAI,EAAE,iCAAe,CAAC,kBAAkB;YACxC,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,iBAAiB,EAAE,iBAAiB;SACrC,CAAC;QACF,IAAA,oCAAkB,GAAE,CAAC,qBAAqB,CAAC,IAAI,uCAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3E,CAAC,CAAC;AACJ,CAAC;AAVD,0CAUC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { ValidationMetadataArgs } from '../../metadata/ValidationMetadataArgs';\nimport { ValidationTypes } from '../../validation/ValidationTypes';\nimport { ValidationMetadata } from '../../metadata/ValidationMetadata';\nimport { getMetadataStorage } from '../../metadata/MetadataStorage';\n\n/**\n * Resolve promise before validation\n */\nexport function ValidatePromise(validationOptions?: ValidationOptions): PropertyDecorator {\n return function (object: object, propertyName: string): void {\n const args: ValidationMetadataArgs = {\n type: ValidationTypes.PROMISE_VALIDATION,\n target: object.constructor,\n propertyName: propertyName,\n validationOptions: validationOptions,\n };\n getMetadataStorage().addValidationMetadata(new ValidationMetadata(args));\n };\n}\n"]}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.MaxDate = exports.maxDate = exports.MAX_DATE = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
exports.MAX_DATE = 'maxDate';
|
||||
/**
|
||||
* Checks if the value is a date that's before the specified date.
|
||||
*/
|
||||
function maxDate(date, maxDate) {
|
||||
return date instanceof Date && date.getTime() <= (maxDate instanceof Date ? maxDate : maxDate()).getTime();
|
||||
}
|
||||
exports.maxDate = maxDate;
|
||||
/**
|
||||
* Checks if the value is a date that's before the specified date.
|
||||
*/
|
||||
function MaxDate(date, validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.MAX_DATE,
|
||||
constraints: [date],
|
||||
validator: {
|
||||
validate: (value, args) => maxDate(value, args === null || args === void 0 ? void 0 : args.constraints[0]),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => 'maximal allowed date for ' + eachPrefix + '$property is $constraint1', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.MaxDate = MaxDate;
|
||||
//# sourceMappingURL=MaxDate.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"MaxDate.js","sourceRoot":"","sources":["../../../../src/decorator/date/MaxDate.ts"],"names":[],"mappings":";;;AACA,qDAAgE;AAEnD,QAAA,QAAQ,GAAG,SAAS,CAAC;AAElC;;GAEG;AACH,SAAgB,OAAO,CAAC,IAAa,EAAE,OAA4B;IACjE,OAAO,IAAI,YAAY,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,YAAY,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;AAC7G,CAAC;AAFD,0BAEC;AAED;;GAEG;AACH,SAAgB,OAAO,CAAC,IAAyB,EAAE,iBAAqC;IACtF,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,gBAAQ;QACd,WAAW,EAAE,CAAC,IAAI,CAAC;QACnB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAC,CAAC,CAAC,CAAC;YACxE,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,2BAA2B,GAAG,UAAU,GAAG,2BAA2B,EACpF,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAfD,0BAeC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\n\nexport const MAX_DATE = 'maxDate';\n\n/**\n * Checks if the value is a date that's before the specified date.\n */\nexport function maxDate(date: unknown, maxDate: Date | (() => Date)): boolean {\n return date instanceof Date && date.getTime() <= (maxDate instanceof Date ? maxDate : maxDate()).getTime();\n}\n\n/**\n * Checks if the value is a date that's before the specified date.\n */\nexport function MaxDate(date: Date | (() => Date), validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: MAX_DATE,\n constraints: [date],\n validator: {\n validate: (value, args): boolean => maxDate(value, args?.constraints[0]),\n defaultMessage: buildMessage(\n eachPrefix => 'maximal allowed date for ' + eachPrefix + '$property is $constraint1',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.MinDate = exports.minDate = exports.MIN_DATE = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
exports.MIN_DATE = 'minDate';
|
||||
/**
|
||||
* Checks if the value is a date that's after the specified date.
|
||||
*/
|
||||
function minDate(date, minDate) {
|
||||
return date instanceof Date && date.getTime() >= (minDate instanceof Date ? minDate : minDate()).getTime();
|
||||
}
|
||||
exports.minDate = minDate;
|
||||
/**
|
||||
* Checks if the value is a date that's after the specified date.
|
||||
*/
|
||||
function MinDate(date, validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.MIN_DATE,
|
||||
constraints: [date],
|
||||
validator: {
|
||||
validate: (value, args) => minDate(value, args === null || args === void 0 ? void 0 : args.constraints[0]),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => 'minimal allowed date for ' + eachPrefix + '$property is $constraint1', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.MinDate = MinDate;
|
||||
//# sourceMappingURL=MinDate.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"MinDate.js","sourceRoot":"","sources":["../../../../src/decorator/date/MinDate.ts"],"names":[],"mappings":";;;AACA,qDAAgE;AAEnD,QAAA,QAAQ,GAAG,SAAS,CAAC;AAElC;;GAEG;AACH,SAAgB,OAAO,CAAC,IAAa,EAAE,OAA4B;IACjE,OAAO,IAAI,YAAY,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,YAAY,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;AAC7G,CAAC;AAFD,0BAEC;AAED;;GAEG;AACH,SAAgB,OAAO,CAAC,IAAyB,EAAE,iBAAqC;IACtF,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,gBAAQ;QACd,WAAW,EAAE,CAAC,IAAI,CAAC;QACnB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAC,CAAC,CAAC,CAAC;YACxE,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,2BAA2B,GAAG,UAAU,GAAG,2BAA2B,EACpF,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAfD,0BAeC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\n\nexport const MIN_DATE = 'minDate';\n\n/**\n * Checks if the value is a date that's after the specified date.\n */\nexport function minDate(date: unknown, minDate: Date | (() => Date)): boolean {\n return date instanceof Date && date.getTime() >= (minDate instanceof Date ? minDate : minDate()).getTime();\n}\n\n/**\n * Checks if the value is a date that's after the specified date.\n */\nexport function MinDate(date: Date | (() => Date), validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: MIN_DATE,\n constraints: [date],\n validator: {\n validate: (value, args): boolean => minDate(value, args?.constraints[0]),\n defaultMessage: buildMessage(\n eachPrefix => 'minimal allowed date for ' + eachPrefix + '$property is $constraint1',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
"use strict";
|
||||
// -------------------------------------------------------------------------
|
||||
// System
|
||||
// -------------------------------------------------------------------------
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
// -------------------------------------------------------------------------
|
||||
// Common checkers
|
||||
// -------------------------------------------------------------------------
|
||||
__exportStar(require("./common/Allow"), exports);
|
||||
__exportStar(require("./common/IsDefined"), exports);
|
||||
__exportStar(require("./common/IsOptional"), exports);
|
||||
__exportStar(require("./common/Validate"), exports);
|
||||
__exportStar(require("./common/ValidateBy"), exports);
|
||||
__exportStar(require("./common/ValidateIf"), exports);
|
||||
__exportStar(require("./common/ValidateNested"), exports);
|
||||
__exportStar(require("./common/ValidatePromise"), exports);
|
||||
__exportStar(require("./common/IsLatLong"), exports);
|
||||
__exportStar(require("./common/IsLatitude"), exports);
|
||||
__exportStar(require("./common/IsLongitude"), exports);
|
||||
__exportStar(require("./common/Equals"), exports);
|
||||
__exportStar(require("./common/NotEquals"), exports);
|
||||
__exportStar(require("./common/IsEmpty"), exports);
|
||||
__exportStar(require("./common/IsNotEmpty"), exports);
|
||||
__exportStar(require("./common/IsIn"), exports);
|
||||
__exportStar(require("./common/IsNotIn"), exports);
|
||||
// -------------------------------------------------------------------------
|
||||
// Number checkers
|
||||
// -------------------------------------------------------------------------
|
||||
__exportStar(require("./number/IsDivisibleBy"), exports);
|
||||
__exportStar(require("./number/IsPositive"), exports);
|
||||
__exportStar(require("./number/IsNegative"), exports);
|
||||
__exportStar(require("./number/Max"), exports);
|
||||
__exportStar(require("./number/Min"), exports);
|
||||
// -------------------------------------------------------------------------
|
||||
// Date checkers
|
||||
// -------------------------------------------------------------------------
|
||||
__exportStar(require("./date/MinDate"), exports);
|
||||
__exportStar(require("./date/MaxDate"), exports);
|
||||
// -------------------------------------------------------------------------
|
||||
// String checkers
|
||||
// -------------------------------------------------------------------------
|
||||
__exportStar(require("./string/Contains"), exports);
|
||||
__exportStar(require("./string/NotContains"), exports);
|
||||
__exportStar(require("./string/IsAlpha"), exports);
|
||||
__exportStar(require("./string/IsAlphanumeric"), exports);
|
||||
__exportStar(require("./string/IsDecimal"), exports);
|
||||
__exportStar(require("./string/IsAscii"), exports);
|
||||
__exportStar(require("./string/IsBase64"), exports);
|
||||
__exportStar(require("./string/IsByteLength"), exports);
|
||||
__exportStar(require("./string/IsCreditCard"), exports);
|
||||
__exportStar(require("./string/IsCurrency"), exports);
|
||||
__exportStar(require("./string/IsEmail"), exports);
|
||||
__exportStar(require("./string/IsFQDN"), exports);
|
||||
__exportStar(require("./string/IsFullWidth"), exports);
|
||||
__exportStar(require("./string/IsHalfWidth"), exports);
|
||||
__exportStar(require("./string/IsVariableWidth"), exports);
|
||||
__exportStar(require("./string/IsHexColor"), exports);
|
||||
__exportStar(require("./string/IsHexadecimal"), exports);
|
||||
__exportStar(require("./string/IsMacAddress"), exports);
|
||||
__exportStar(require("./string/IsIP"), exports);
|
||||
__exportStar(require("./string/IsPort"), exports);
|
||||
__exportStar(require("./string/IsISBN"), exports);
|
||||
__exportStar(require("./string/IsISIN"), exports);
|
||||
__exportStar(require("./string/IsISO8601"), exports);
|
||||
__exportStar(require("./string/IsJSON"), exports);
|
||||
__exportStar(require("./string/IsJWT"), exports);
|
||||
__exportStar(require("./string/IsLowercase"), exports);
|
||||
__exportStar(require("./string/IsMobilePhone"), exports);
|
||||
__exportStar(require("./string/IsISO31661Alpha2"), exports);
|
||||
__exportStar(require("./string/IsISO31661Alpha3"), exports);
|
||||
__exportStar(require("./string/IsMongoId"), exports);
|
||||
__exportStar(require("./string/IsMultibyte"), exports);
|
||||
__exportStar(require("./string/IsSurrogatePair"), exports);
|
||||
__exportStar(require("./string/IsUrl"), exports);
|
||||
__exportStar(require("./string/IsUUID"), exports);
|
||||
__exportStar(require("./string/IsFirebasePushId"), exports);
|
||||
__exportStar(require("./string/IsUppercase"), exports);
|
||||
__exportStar(require("./string/Length"), exports);
|
||||
__exportStar(require("./string/MaxLength"), exports);
|
||||
__exportStar(require("./string/MinLength"), exports);
|
||||
__exportStar(require("./string/Matches"), exports);
|
||||
__exportStar(require("./string/IsPhoneNumber"), exports);
|
||||
__exportStar(require("./string/IsMilitaryTime"), exports);
|
||||
__exportStar(require("./string/IsHash"), exports);
|
||||
__exportStar(require("./string/IsISSN"), exports);
|
||||
__exportStar(require("./string/IsDateString"), exports);
|
||||
__exportStar(require("./string/IsBooleanString"), exports);
|
||||
__exportStar(require("./string/IsNumberString"), exports);
|
||||
__exportStar(require("./string/IsBase32"), exports);
|
||||
__exportStar(require("./string/IsBIC"), exports);
|
||||
__exportStar(require("./string/IsBtcAddress"), exports);
|
||||
__exportStar(require("./string/IsDataURI"), exports);
|
||||
__exportStar(require("./string/IsEAN"), exports);
|
||||
__exportStar(require("./string/IsEthereumAddress"), exports);
|
||||
__exportStar(require("./string/IsHSL"), exports);
|
||||
__exportStar(require("./string/IsIBAN"), exports);
|
||||
__exportStar(require("./string/IsIdentityCard"), exports);
|
||||
__exportStar(require("./string/IsISRC"), exports);
|
||||
__exportStar(require("./string/IsLocale"), exports);
|
||||
__exportStar(require("./string/IsMagnetURI"), exports);
|
||||
__exportStar(require("./string/IsMimeType"), exports);
|
||||
__exportStar(require("./string/IsOctal"), exports);
|
||||
__exportStar(require("./string/IsPassportNumber"), exports);
|
||||
__exportStar(require("./string/IsPostalCode"), exports);
|
||||
__exportStar(require("./string/IsRFC3339"), exports);
|
||||
__exportStar(require("./string/IsRgbColor"), exports);
|
||||
__exportStar(require("./string/IsSemVer"), exports);
|
||||
__exportStar(require("./string/IsStrongPassword"), exports);
|
||||
__exportStar(require("./string/IsTimeZone"), exports);
|
||||
__exportStar(require("./string/IsBase58"), exports);
|
||||
__exportStar(require("./string/is-tax-id"), exports);
|
||||
__exportStar(require("./string/is-iso4217-currency-code"), exports);
|
||||
// -------------------------------------------------------------------------
|
||||
// Type checkers
|
||||
// -------------------------------------------------------------------------
|
||||
__exportStar(require("./typechecker/IsBoolean"), exports);
|
||||
__exportStar(require("./typechecker/IsDate"), exports);
|
||||
__exportStar(require("./typechecker/IsNumber"), exports);
|
||||
__exportStar(require("./typechecker/IsEnum"), exports);
|
||||
__exportStar(require("./typechecker/IsInt"), exports);
|
||||
__exportStar(require("./typechecker/IsString"), exports);
|
||||
__exportStar(require("./typechecker/IsArray"), exports);
|
||||
__exportStar(require("./typechecker/IsObject"), exports);
|
||||
// -------------------------------------------------------------------------
|
||||
// Array checkers
|
||||
// -------------------------------------------------------------------------
|
||||
__exportStar(require("./array/ArrayContains"), exports);
|
||||
__exportStar(require("./array/ArrayNotContains"), exports);
|
||||
__exportStar(require("./array/ArrayNotEmpty"), exports);
|
||||
__exportStar(require("./array/ArrayMinSize"), exports);
|
||||
__exportStar(require("./array/ArrayMaxSize"), exports);
|
||||
__exportStar(require("./array/ArrayUnique"), exports);
|
||||
// -------------------------------------------------------------------------
|
||||
// Object checkers
|
||||
// -------------------------------------------------------------------------
|
||||
__exportStar(require("./object/IsNotEmptyObject"), exports);
|
||||
__exportStar(require("./object/IsInstance"), exports);
|
||||
//# sourceMappingURL=decorators.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsDivisibleBy = exports.isDivisibleBy = exports.IS_DIVISIBLE_BY = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
const isDivisibleBy_1 = __importDefault(require("validator/lib/isDivisibleBy"));
|
||||
exports.IS_DIVISIBLE_BY = 'isDivisibleBy';
|
||||
/**
|
||||
* Checks if value is a number that's divisible by another.
|
||||
*/
|
||||
function isDivisibleBy(value, num) {
|
||||
return typeof value === 'number' && typeof num === 'number' && (0, isDivisibleBy_1.default)(String(value), num);
|
||||
}
|
||||
exports.isDivisibleBy = isDivisibleBy;
|
||||
/**
|
||||
* Checks if value is a number that's divisible by another.
|
||||
*/
|
||||
function IsDivisibleBy(num, validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_DIVISIBLE_BY,
|
||||
constraints: [num],
|
||||
validator: {
|
||||
validate: (value, args) => isDivisibleBy(value, args === null || args === void 0 ? void 0 : args.constraints[0]),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be divisible by $constraint1', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsDivisibleBy = IsDivisibleBy;
|
||||
//# sourceMappingURL=IsDivisibleBy.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsDivisibleBy.js","sourceRoot":"","sources":["../../../../src/decorator/number/IsDivisibleBy.ts"],"names":[],"mappings":";;;;;;AACA,qDAAgE;AAChE,gFAAiE;AAEpD,QAAA,eAAe,GAAG,eAAe,CAAC;AAE/C;;GAEG;AACH,SAAgB,aAAa,CAAC,KAAc,EAAE,GAAW;IACvD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,IAAA,uBAAsB,EAAC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC;AAC5G,CAAC;AAFD,sCAEC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,GAAW,EAAE,iBAAqC;IAC9E,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,uBAAe;QACrB,WAAW,EAAE,CAAC,GAAG,CAAC;QAClB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAC,CAAC,CAAC,CAAC;YAC9E,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,6CAA6C,EACxE,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAfD,sCAeC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\nimport isDivisibleByValidator from 'validator/lib/isDivisibleBy';\n\nexport const IS_DIVISIBLE_BY = 'isDivisibleBy';\n\n/**\n * Checks if value is a number that's divisible by another.\n */\nexport function isDivisibleBy(value: unknown, num: number): boolean {\n return typeof value === 'number' && typeof num === 'number' && isDivisibleByValidator(String(value), num);\n}\n\n/**\n * Checks if value is a number that's divisible by another.\n */\nexport function IsDivisibleBy(num: number, validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_DIVISIBLE_BY,\n constraints: [num],\n validator: {\n validate: (value, args): boolean => isDivisibleBy(value, args?.constraints[0]),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property must be divisible by $constraint1',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsNegative = exports.isNegative = exports.IS_NEGATIVE = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
exports.IS_NEGATIVE = 'isNegative';
|
||||
/**
|
||||
* Checks if the value is a negative number smaller than zero.
|
||||
*/
|
||||
function isNegative(value) {
|
||||
return typeof value === 'number' && value < 0;
|
||||
}
|
||||
exports.isNegative = isNegative;
|
||||
/**
|
||||
* Checks if the value is a negative number smaller than zero.
|
||||
*/
|
||||
function IsNegative(validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_NEGATIVE,
|
||||
validator: {
|
||||
validate: (value, args) => isNegative(value),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be a negative number', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsNegative = IsNegative;
|
||||
//# sourceMappingURL=IsNegative.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsNegative.js","sourceRoot":"","sources":["../../../../src/decorator/number/IsNegative.ts"],"names":[],"mappings":";;;AACA,qDAAgE;AAEnD,QAAA,WAAW,GAAG,YAAY,CAAC;AAExC;;GAEG;AACH,SAAgB,UAAU,CAAC,KAAc;IACvC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,GAAG,CAAC,CAAC;AAChD,CAAC;AAFD,gCAEC;AAED;;GAEG;AACH,SAAgB,UAAU,CAAC,iBAAqC;IAC9D,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,mBAAW;QACjB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC;YACrD,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,qCAAqC,EAChE,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAdD,gCAcC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\n\nexport const IS_NEGATIVE = 'isNegative';\n\n/**\n * Checks if the value is a negative number smaller than zero.\n */\nexport function isNegative(value: unknown): boolean {\n return typeof value === 'number' && value < 0;\n}\n\n/**\n * Checks if the value is a negative number smaller than zero.\n */\nexport function IsNegative(validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_NEGATIVE,\n validator: {\n validate: (value, args): boolean => isNegative(value),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property must be a negative number',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsPositive = exports.isPositive = exports.IS_POSITIVE = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
exports.IS_POSITIVE = 'isPositive';
|
||||
/**
|
||||
* Checks if the value is a positive number greater than zero.
|
||||
*/
|
||||
function isPositive(value) {
|
||||
return typeof value === 'number' && value > 0;
|
||||
}
|
||||
exports.isPositive = isPositive;
|
||||
/**
|
||||
* Checks if the value is a positive number greater than zero.
|
||||
*/
|
||||
function IsPositive(validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_POSITIVE,
|
||||
validator: {
|
||||
validate: (value, args) => isPositive(value),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be a positive number', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsPositive = IsPositive;
|
||||
//# sourceMappingURL=IsPositive.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsPositive.js","sourceRoot":"","sources":["../../../../src/decorator/number/IsPositive.ts"],"names":[],"mappings":";;;AACA,qDAAgE;AAEnD,QAAA,WAAW,GAAG,YAAY,CAAC;AAExC;;GAEG;AACH,SAAgB,UAAU,CAAC,KAAc;IACvC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,GAAG,CAAC,CAAC;AAChD,CAAC;AAFD,gCAEC;AAED;;GAEG;AACH,SAAgB,UAAU,CAAC,iBAAqC;IAC9D,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,mBAAW;QACjB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC;YACrD,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,qCAAqC,EAChE,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAdD,gCAcC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\n\nexport const IS_POSITIVE = 'isPositive';\n\n/**\n * Checks if the value is a positive number greater than zero.\n */\nexport function isPositive(value: unknown): boolean {\n return typeof value === 'number' && value > 0;\n}\n\n/**\n * Checks if the value is a positive number greater than zero.\n */\nexport function IsPositive(validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_POSITIVE,\n validator: {\n validate: (value, args): boolean => isPositive(value),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property must be a positive number',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Max = exports.max = exports.MAX = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
exports.MAX = 'max';
|
||||
/**
|
||||
* Checks if the first number is less than or equal to the second.
|
||||
*/
|
||||
function max(num, max) {
|
||||
return typeof num === 'number' && typeof max === 'number' && num <= max;
|
||||
}
|
||||
exports.max = max;
|
||||
/**
|
||||
* Checks if the value is less than or equal to the allowed maximum value.
|
||||
*/
|
||||
function Max(maxValue, validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.MAX,
|
||||
constraints: [maxValue],
|
||||
validator: {
|
||||
validate: (value, args) => max(value, args === null || args === void 0 ? void 0 : args.constraints[0]),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must not be greater than $constraint1', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.Max = Max;
|
||||
//# sourceMappingURL=Max.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Max.js","sourceRoot":"","sources":["../../../../src/decorator/number/Max.ts"],"names":[],"mappings":";;;AACA,qDAAgE;AAEnD,QAAA,GAAG,GAAG,KAAK,CAAC;AAEzB;;GAEG;AACH,SAAgB,GAAG,CAAC,GAAY,EAAE,GAAW;IAC3C,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,IAAI,GAAG,CAAC;AAC1E,CAAC;AAFD,kBAEC;AAED;;GAEG;AACH,SAAgB,GAAG,CAAC,QAAgB,EAAE,iBAAqC;IACzE,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,WAAG;QACT,WAAW,EAAE,CAAC,QAAQ,CAAC;QACvB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAC,CAAC,CAAC,CAAC;YACpE,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,iDAAiD,EAC5E,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAfD,kBAeC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\n\nexport const MAX = 'max';\n\n/**\n * Checks if the first number is less than or equal to the second.\n */\nexport function max(num: unknown, max: number): boolean {\n return typeof num === 'number' && typeof max === 'number' && num <= max;\n}\n\n/**\n * Checks if the value is less than or equal to the allowed maximum value.\n */\nexport function Max(maxValue: number, validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: MAX,\n constraints: [maxValue],\n validator: {\n validate: (value, args): boolean => max(value, args?.constraints[0]),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property must not be greater than $constraint1',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Min = exports.min = exports.MIN = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
exports.MIN = 'min';
|
||||
/**
|
||||
* Checks if the first number is greater than or equal to the second.
|
||||
*/
|
||||
function min(num, min) {
|
||||
return typeof num === 'number' && typeof min === 'number' && num >= min;
|
||||
}
|
||||
exports.min = min;
|
||||
/**
|
||||
* Checks if the value is greater than or equal to the allowed minimum value.
|
||||
*/
|
||||
function Min(minValue, validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.MIN,
|
||||
constraints: [minValue],
|
||||
validator: {
|
||||
validate: (value, args) => min(value, args === null || args === void 0 ? void 0 : args.constraints[0]),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must not be less than $constraint1', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.Min = Min;
|
||||
//# sourceMappingURL=Min.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Min.js","sourceRoot":"","sources":["../../../../src/decorator/number/Min.ts"],"names":[],"mappings":";;;AACA,qDAAgE;AAEnD,QAAA,GAAG,GAAG,KAAK,CAAC;AAEzB;;GAEG;AACH,SAAgB,GAAG,CAAC,GAAY,EAAE,GAAW;IAC3C,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,IAAI,GAAG,CAAC;AAC1E,CAAC;AAFD,kBAEC;AAED;;GAEG;AACH,SAAgB,GAAG,CAAC,QAAgB,EAAE,iBAAqC;IACzE,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,WAAG;QACT,WAAW,EAAE,CAAC,QAAQ,CAAC;QACvB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAC,CAAC,CAAC,CAAC;YACpE,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,8CAA8C,EACzE,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAfD,kBAeC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\n\nexport const MIN = 'min';\n\n/**\n * Checks if the first number is greater than or equal to the second.\n */\nexport function min(num: unknown, min: number): boolean {\n return typeof num === 'number' && typeof min === 'number' && num >= min;\n}\n\n/**\n * Checks if the value is greater than or equal to the allowed minimum value.\n */\nexport function Min(minValue: number, validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: MIN,\n constraints: [minValue],\n validator: {\n validate: (value, args): boolean => min(value, args?.constraints[0]),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property must not be less than $constraint1',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsInstance = exports.isInstance = exports.IS_INSTANCE = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
exports.IS_INSTANCE = 'isInstance';
|
||||
/**
|
||||
* Checks if the value is an instance of the specified object.
|
||||
*/
|
||||
function isInstance(object, targetTypeConstructor) {
|
||||
return (targetTypeConstructor && typeof targetTypeConstructor === 'function' && object instanceof targetTypeConstructor);
|
||||
}
|
||||
exports.isInstance = isInstance;
|
||||
/**
|
||||
* Checks if the value is an instance of the specified object.
|
||||
*/
|
||||
function IsInstance(targetType, validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_INSTANCE,
|
||||
constraints: [targetType],
|
||||
validator: {
|
||||
validate: (value, args) => isInstance(value, args === null || args === void 0 ? void 0 : args.constraints[0]),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)((eachPrefix, args) => {
|
||||
if (args === null || args === void 0 ? void 0 : args.constraints[0]) {
|
||||
return eachPrefix + `$property must be an instance of ${args === null || args === void 0 ? void 0 : args.constraints[0].name}`;
|
||||
}
|
||||
else {
|
||||
return eachPrefix + `${exports.IS_INSTANCE} decorator expects and object as value, but got falsy value.`;
|
||||
}
|
||||
}, validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsInstance = IsInstance;
|
||||
//# sourceMappingURL=IsInstance.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsInstance.js","sourceRoot":"","sources":["../../../../src/decorator/object/IsInstance.ts"],"names":[],"mappings":";;;AACA,qDAAgE;AAEnD,QAAA,WAAW,GAAG,YAAY,CAAC;AAExC;;GAEG;AACH,SAAgB,UAAU,CAAC,MAAe,EAAE,qBAAkD;IAC5F,OAAO,CACL,qBAAqB,IAAI,OAAO,qBAAqB,KAAK,UAAU,IAAI,MAAM,YAAY,qBAAqB,CAChH,CAAC;AACJ,CAAC;AAJD,gCAIC;AAED;;GAEG;AACH,SAAgB,UAAU,CACxB,UAAuC,EACvC,iBAAqC;IAErC,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,mBAAW;QACjB,WAAW,EAAE,CAAC,UAAU,CAAC;QACzB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAC,CAAC,CAAC,CAAC;YAC3E,cAAc,EAAE,IAAA,yBAAY,EAAC,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE;gBAChD,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;oBACzB,OAAO,UAAU,GAAG,oCAAoC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAC,CAAC,EAAE,IAAc,EAAE,CAAC;gBAChG,CAAC;qBAAM,CAAC;oBACN,OAAO,UAAU,GAAG,GAAG,mBAAW,8DAA8D,CAAC;gBACnG,CAAC;YACH,CAAC,EAAE,iBAAiB,CAAC;SACtB;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AArBD,gCAqBC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\n\nexport const IS_INSTANCE = 'isInstance';\n\n/**\n * Checks if the value is an instance of the specified object.\n */\nexport function isInstance(object: unknown, targetTypeConstructor: new (...args: any[]) => any): boolean {\n return (\n targetTypeConstructor && typeof targetTypeConstructor === 'function' && object instanceof targetTypeConstructor\n );\n}\n\n/**\n * Checks if the value is an instance of the specified object.\n */\nexport function IsInstance(\n targetType: new (...args: any[]) => any,\n validationOptions?: ValidationOptions\n): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_INSTANCE,\n constraints: [targetType],\n validator: {\n validate: (value, args): boolean => isInstance(value, args?.constraints[0]),\n defaultMessage: buildMessage((eachPrefix, args) => {\n if (args?.constraints[0]) {\n return eachPrefix + `$property must be an instance of ${args?.constraints[0].name as string}`;\n } else {\n return eachPrefix + `${IS_INSTANCE} decorator expects and object as value, but got falsy value.`;\n }\n }, validationOptions),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+41
@@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsNotEmptyObject = exports.isNotEmptyObject = exports.IS_NOT_EMPTY_OBJECT = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
const IsObject_1 = require("../typechecker/IsObject");
|
||||
exports.IS_NOT_EMPTY_OBJECT = 'isNotEmptyObject';
|
||||
/**
|
||||
* Checks if the value is valid Object & not empty.
|
||||
* Returns false if the value is not an object or an empty valid object.
|
||||
*/
|
||||
function isNotEmptyObject(value, options) {
|
||||
if (!(0, IsObject_1.isObject)(value)) {
|
||||
return false;
|
||||
}
|
||||
if ((options === null || options === void 0 ? void 0 : options.nullable) === false) {
|
||||
return !Object.values(value).every(propertyValue => propertyValue === null || propertyValue === undefined);
|
||||
}
|
||||
for (const key in value) {
|
||||
if (value.hasOwnProperty(key)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
exports.isNotEmptyObject = isNotEmptyObject;
|
||||
/**
|
||||
* Checks if the value is valid Object & not empty.
|
||||
* Returns false if the value is not an object or an empty valid object.
|
||||
*/
|
||||
function IsNotEmptyObject(options, validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_NOT_EMPTY_OBJECT,
|
||||
constraints: [options],
|
||||
validator: {
|
||||
validate: (value, args) => isNotEmptyObject(value, args === null || args === void 0 ? void 0 : args.constraints[0]),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be a non-empty object', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsNotEmptyObject = IsNotEmptyObject;
|
||||
//# sourceMappingURL=IsNotEmptyObject.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsNotEmptyObject.js","sourceRoot":"","sources":["../../../../src/decorator/object/IsNotEmptyObject.ts"],"names":[],"mappings":";;;AACA,qDAAgE;AAChE,sDAAmD;AAEtC,QAAA,mBAAmB,GAAG,kBAAkB,CAAC;AAEtD;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,KAAc,EAAE,OAAgC;IAC/E,IAAI,CAAC,IAAA,mBAAQ,EAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,MAAK,KAAK,EAAE,CAAC;QAChC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC,aAAa,KAAK,IAAI,IAAI,aAAa,KAAK,SAAS,CAAC,CAAC;IAC7G,CAAC;IAED,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;QACxB,IAAI,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAhBD,4CAgBC;AAED;;;GAGG;AACH,SAAgB,gBAAgB,CAC9B,OAAgC,EAChC,iBAAqC;IAErC,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,2BAAmB;QACzB,WAAW,EAAE,CAAC,OAAO,CAAC;QACtB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,gBAAgB,CAAC,KAAK,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAC,CAAC,CAAC,CAAC;YACjF,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,sCAAsC,EACjE,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAlBD,4CAkBC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\nimport { isObject } from '../typechecker/IsObject';\n\nexport const IS_NOT_EMPTY_OBJECT = 'isNotEmptyObject';\n\n/**\n * Checks if the value is valid Object & not empty.\n * Returns false if the value is not an object or an empty valid object.\n */\nexport function isNotEmptyObject(value: unknown, options?: { nullable?: boolean }): boolean {\n if (!isObject(value)) {\n return false;\n }\n\n if (options?.nullable === false) {\n return !Object.values(value).every(propertyValue => propertyValue === null || propertyValue === undefined);\n }\n\n for (const key in value) {\n if (value.hasOwnProperty(key)) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Checks if the value is valid Object & not empty.\n * Returns false if the value is not an object or an empty valid object.\n */\nexport function IsNotEmptyObject(\n options?: { nullable?: boolean },\n validationOptions?: ValidationOptions\n): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_NOT_EMPTY_OBJECT,\n constraints: [options],\n validator: {\n validate: (value, args): boolean => isNotEmptyObject(value, args?.constraints[0]),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property must be a non-empty object',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Contains = exports.contains = exports.CONTAINS = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
const contains_1 = __importDefault(require("validator/lib/contains"));
|
||||
exports.CONTAINS = 'contains';
|
||||
/**
|
||||
* Checks if the string contains the seed.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function contains(value, seed) {
|
||||
return typeof value === 'string' && (0, contains_1.default)(value, seed);
|
||||
}
|
||||
exports.contains = contains;
|
||||
/**
|
||||
* Checks if the string contains the seed.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function Contains(seed, validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.CONTAINS,
|
||||
constraints: [seed],
|
||||
validator: {
|
||||
validate: (value, args) => contains(value, args === null || args === void 0 ? void 0 : args.constraints[0]),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must contain a $constraint1 string', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.Contains = Contains;
|
||||
//# sourceMappingURL=Contains.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Contains.js","sourceRoot":"","sources":["../../../../src/decorator/string/Contains.ts"],"names":[],"mappings":";;;;;;AACA,qDAAgE;AAChE,sEAAuD;AAE1C,QAAA,QAAQ,GAAG,UAAU,CAAC;AAEnC;;;GAGG;AACH,SAAgB,QAAQ,CAAC,KAAc,EAAE,IAAY;IACnD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAA,kBAAiB,EAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACrE,CAAC;AAFD,4BAEC;AAED;;;GAGG;AACH,SAAgB,QAAQ,CAAC,IAAY,EAAE,iBAAqC;IAC1E,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,gBAAQ;QACd,WAAW,EAAE,CAAC,IAAI,CAAC;QACnB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAC,CAAC,CAAC,CAAC;YACzE,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,8CAA8C,EACzE,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAfD,4BAeC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\nimport containsValidator from 'validator/lib/contains';\n\nexport const CONTAINS = 'contains';\n\n/**\n * Checks if the string contains the seed.\n * If given value is not a string, then it returns false.\n */\nexport function contains(value: unknown, seed: string): boolean {\n return typeof value === 'string' && containsValidator(value, seed);\n}\n\n/**\n * Checks if the string contains the seed.\n * If given value is not a string, then it returns false.\n */\nexport function Contains(seed: string, validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: CONTAINS,\n constraints: [seed],\n validator: {\n validate: (value, args): boolean => contains(value, args?.constraints[0]),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property must contain a $constraint1 string',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsAlpha = exports.isAlpha = exports.IS_ALPHA = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
const isAlpha_1 = __importDefault(require("validator/lib/isAlpha"));
|
||||
exports.IS_ALPHA = 'isAlpha';
|
||||
/**
|
||||
* Checks if the string contains only letters (a-zA-Z).
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function isAlpha(value, locale) {
|
||||
return typeof value === 'string' && (0, isAlpha_1.default)(value, locale);
|
||||
}
|
||||
exports.isAlpha = isAlpha;
|
||||
/**
|
||||
* Checks if the string contains only letters (a-zA-Z).
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function IsAlpha(locale, validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_ALPHA,
|
||||
constraints: [locale],
|
||||
validator: {
|
||||
validate: (value, args) => isAlpha(value, args === null || args === void 0 ? void 0 : args.constraints[0]),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must contain only letters (a-zA-Z)', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsAlpha = IsAlpha;
|
||||
//# sourceMappingURL=IsAlpha.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsAlpha.js","sourceRoot":"","sources":["../../../../src/decorator/string/IsAlpha.ts"],"names":[],"mappings":";;;;;;AACA,qDAAgE;AAChE,oEAAqD;AAGxC,QAAA,QAAQ,GAAG,SAAS,CAAC;AAElC;;;GAGG;AACH,SAAgB,OAAO,CAAC,KAAc,EAAE,MAAgC;IACtE,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAA,iBAAgB,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AACtE,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,MAAgC,EAAE,iBAAqC;IAC7F,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,gBAAQ;QACd,WAAW,EAAE,CAAC,MAAM,CAAC;QACrB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAC,CAAC,CAAC,CAAC;YACxE,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,8CAA8C,EACzE,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAfD,0BAeC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\nimport isAlphaValidator from 'validator/lib/isAlpha';\nimport * as ValidatorJS from 'validator';\n\nexport const IS_ALPHA = 'isAlpha';\n\n/**\n * Checks if the string contains only letters (a-zA-Z).\n * If given value is not a string, then it returns false.\n */\nexport function isAlpha(value: unknown, locale?: ValidatorJS.AlphaLocale): boolean {\n return typeof value === 'string' && isAlphaValidator(value, locale);\n}\n\n/**\n * Checks if the string contains only letters (a-zA-Z).\n * If given value is not a string, then it returns false.\n */\nexport function IsAlpha(locale?: ValidatorJS.AlphaLocale, validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_ALPHA,\n constraints: [locale],\n validator: {\n validate: (value, args): boolean => isAlpha(value, args?.constraints[0]),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property must contain only letters (a-zA-Z)',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsAlphanumeric = exports.isAlphanumeric = exports.IS_ALPHANUMERIC = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
const isAlphanumeric_1 = __importDefault(require("validator/lib/isAlphanumeric"));
|
||||
exports.IS_ALPHANUMERIC = 'isAlphanumeric';
|
||||
/**
|
||||
* Checks if the string contains only letters and numbers.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function isAlphanumeric(value, locale) {
|
||||
return typeof value === 'string' && (0, isAlphanumeric_1.default)(value, locale);
|
||||
}
|
||||
exports.isAlphanumeric = isAlphanumeric;
|
||||
/**
|
||||
* Checks if the string contains only letters and numbers.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function IsAlphanumeric(locale, validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_ALPHANUMERIC,
|
||||
constraints: [locale],
|
||||
validator: {
|
||||
validate: (value, args) => isAlphanumeric(value, args === null || args === void 0 ? void 0 : args.constraints[0]),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must contain only letters and numbers', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsAlphanumeric = IsAlphanumeric;
|
||||
//# sourceMappingURL=IsAlphanumeric.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsAlphanumeric.js","sourceRoot":"","sources":["../../../../src/decorator/string/IsAlphanumeric.ts"],"names":[],"mappings":";;;;;;AACA,qDAAgE;AAChE,kFAAmE;AAGtD,QAAA,eAAe,GAAG,gBAAgB,CAAC;AAEhD;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAAc,EAAE,MAAuC;IACpF,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAA,wBAAuB,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC7E,CAAC;AAFD,wCAEC;AAED;;;GAGG;AACH,SAAgB,cAAc,CAC5B,MAAuC,EACvC,iBAAqC;IAErC,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,uBAAe;QACrB,WAAW,EAAE,CAAC,MAAM,CAAC;QACrB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,cAAc,CAAC,KAAK,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAC,CAAC,CAAC,CAAC;YAC/E,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,iDAAiD,EAC5E,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAlBD,wCAkBC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\nimport isAlphanumericValidator from 'validator/lib/isAlphanumeric';\nimport * as ValidatorJS from 'validator';\n\nexport const IS_ALPHANUMERIC = 'isAlphanumeric';\n\n/**\n * Checks if the string contains only letters and numbers.\n * If given value is not a string, then it returns false.\n */\nexport function isAlphanumeric(value: unknown, locale?: ValidatorJS.AlphanumericLocale): boolean {\n return typeof value === 'string' && isAlphanumericValidator(value, locale);\n}\n\n/**\n * Checks if the string contains only letters and numbers.\n * If given value is not a string, then it returns false.\n */\nexport function IsAlphanumeric(\n locale?: ValidatorJS.AlphanumericLocale,\n validationOptions?: ValidationOptions\n): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_ALPHANUMERIC,\n constraints: [locale],\n validator: {\n validate: (value, args): boolean => isAlphanumeric(value, args?.constraints[0]),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property must contain only letters and numbers',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsAscii = exports.isAscii = exports.IS_ASCII = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
const isAscii_1 = __importDefault(require("validator/lib/isAscii"));
|
||||
exports.IS_ASCII = 'isAscii';
|
||||
/**
|
||||
* Checks if the string contains ASCII chars only.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function isAscii(value) {
|
||||
return typeof value === 'string' && (0, isAscii_1.default)(value);
|
||||
}
|
||||
exports.isAscii = isAscii;
|
||||
/**
|
||||
* Checks if the string contains ASCII chars only.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function IsAscii(validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_ASCII,
|
||||
validator: {
|
||||
validate: (value, args) => isAscii(value),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must contain only ASCII characters', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsAscii = IsAscii;
|
||||
//# sourceMappingURL=IsAscii.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsAscii.js","sourceRoot":"","sources":["../../../../src/decorator/string/IsAscii.ts"],"names":[],"mappings":";;;;;;AACA,qDAAgE;AAChE,oEAAqD;AAExC,QAAA,QAAQ,GAAG,SAAS,CAAC;AAElC;;;GAGG;AACH,SAAgB,OAAO,CAAC,KAAc;IACpC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAA,iBAAgB,EAAC,KAAK,CAAC,CAAC;AAC9D,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,iBAAqC;IAC3D,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,gBAAQ;QACd,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;YAClD,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,8CAA8C,EACzE,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAdD,0BAcC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\nimport isAsciiValidator from 'validator/lib/isAscii';\n\nexport const IS_ASCII = 'isAscii';\n\n/**\n * Checks if the string contains ASCII chars only.\n * If given value is not a string, then it returns false.\n */\nexport function isAscii(value: unknown): boolean {\n return typeof value === 'string' && isAsciiValidator(value);\n}\n\n/**\n * Checks if the string contains ASCII chars only.\n * If given value is not a string, then it returns false.\n */\nexport function IsAscii(validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_ASCII,\n validator: {\n validate: (value, args): boolean => isAscii(value),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property must contain only ASCII characters',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsBIC = exports.isBIC = exports.IS_BIC = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
const isBIC_1 = __importDefault(require("validator/lib/isBIC"));
|
||||
exports.IS_BIC = 'isBIC';
|
||||
/**
|
||||
* Check if a string is a BIC (Bank Identification Code) or SWIFT code.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function isBIC(value) {
|
||||
return typeof value === 'string' && (0, isBIC_1.default)(value);
|
||||
}
|
||||
exports.isBIC = isBIC;
|
||||
/**
|
||||
* Check if a string is a BIC (Bank Identification Code) or SWIFT code.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function IsBIC(validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_BIC,
|
||||
validator: {
|
||||
validate: (value, args) => isBIC(value),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be a BIC or SWIFT code', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsBIC = IsBIC;
|
||||
//# sourceMappingURL=IsBIC.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsBIC.js","sourceRoot":"","sources":["../../../../src/decorator/string/IsBIC.ts"],"names":[],"mappings":";;;;;;AACA,qDAAgE;AAChE,gEAAiD;AAEpC,QAAA,MAAM,GAAG,OAAO,CAAC;AAE9B;;;GAGG;AACH,SAAgB,KAAK,CAAC,KAAc;IAClC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAA,eAAc,EAAC,KAAK,CAAC,CAAC;AAC5D,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,iBAAqC;IACzD,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,cAAM;QACZ,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC;YAChD,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,uCAAuC,EAClE,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAdD,sBAcC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\nimport isBICValidator from 'validator/lib/isBIC';\n\nexport const IS_BIC = 'isBIC';\n\n/**\n * Check if a string is a BIC (Bank Identification Code) or SWIFT code.\n * If given value is not a string, then it returns false.\n */\nexport function isBIC(value: unknown): boolean {\n return typeof value === 'string' && isBICValidator(value);\n}\n\n/**\n * Check if a string is a BIC (Bank Identification Code) or SWIFT code.\n * If given value is not a string, then it returns false.\n */\nexport function IsBIC(validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_BIC,\n validator: {\n validate: (value, args): boolean => isBIC(value),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property must be a BIC or SWIFT code',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsBase32 = exports.isBase32 = exports.IS_BASE32 = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
const isBase32_1 = __importDefault(require("validator/lib/isBase32"));
|
||||
exports.IS_BASE32 = 'isBase32';
|
||||
/**
|
||||
* Checks if a string is base32 encoded.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function isBase32(value) {
|
||||
return typeof value === 'string' && (0, isBase32_1.default)(value);
|
||||
}
|
||||
exports.isBase32 = isBase32;
|
||||
/**
|
||||
* Check if a string is base32 encoded.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function IsBase32(validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_BASE32,
|
||||
validator: {
|
||||
validate: (value, args) => isBase32(value),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be base32 encoded', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsBase32 = IsBase32;
|
||||
//# sourceMappingURL=IsBase32.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsBase32.js","sourceRoot":"","sources":["../../../../src/decorator/string/IsBase32.ts"],"names":[],"mappings":";;;;;;AACA,qDAAgE;AAChE,sEAAuD;AAE1C,QAAA,SAAS,GAAG,UAAU,CAAC;AAEpC;;;GAGG;AACH,SAAgB,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAA,kBAAiB,EAAC,KAAK,CAAC,CAAC;AAC/D,CAAC;AAFD,4BAEC;AAED;;;GAGG;AACH,SAAgB,QAAQ,CAAC,iBAAqC;IAC5D,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,iBAAS;QACf,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC;YACnD,cAAc,EAAE,IAAA,yBAAY,EAAC,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,kCAAkC,EAAE,iBAAiB,CAAC;SAC/G;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAXD,4BAWC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\nimport isBase32Validator from 'validator/lib/isBase32';\n\nexport const IS_BASE32 = 'isBase32';\n\n/**\n * Checks if a string is base32 encoded.\n * If given value is not a string, then it returns false.\n */\nexport function isBase32(value: unknown): boolean {\n return typeof value === 'string' && isBase32Validator(value);\n}\n\n/**\n * Check if a string is base32 encoded.\n * If given value is not a string, then it returns false.\n */\nexport function IsBase32(validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_BASE32,\n validator: {\n validate: (value, args): boolean => isBase32(value),\n defaultMessage: buildMessage(eachPrefix => eachPrefix + '$property must be base32 encoded', validationOptions),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsBase58 = exports.isBase58 = exports.IS_BASE58 = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
const isBase58_1 = __importDefault(require("validator/lib/isBase58"));
|
||||
exports.IS_BASE58 = 'isBase58';
|
||||
/**
|
||||
* Checks if a string is base58 encoded.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function isBase58(value) {
|
||||
return typeof value === 'string' && (0, isBase58_1.default)(value);
|
||||
}
|
||||
exports.isBase58 = isBase58;
|
||||
/**
|
||||
* Checks if a string is base58 encoded.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function IsBase58(validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_BASE58,
|
||||
validator: {
|
||||
validate: (value, args) => isBase58(value),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be base58 encoded', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsBase58 = IsBase58;
|
||||
//# sourceMappingURL=IsBase58.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsBase58.js","sourceRoot":"","sources":["../../../../src/decorator/string/IsBase58.ts"],"names":[],"mappings":";;;;;;AACA,qDAAgE;AAChE,sEAAuD;AAE1C,QAAA,SAAS,GAAG,UAAU,CAAC;AAEpC;;;GAGG;AACH,SAAgB,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAA,kBAAiB,EAAC,KAAK,CAAC,CAAC;AAC/D,CAAC;AAFD,4BAEC;AAED;;;GAGG;AACH,SAAgB,QAAQ,CAAC,iBAAqC;IAC5D,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,iBAAS;QACf,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC;YACnD,cAAc,EAAE,IAAA,yBAAY,EAAC,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,kCAAkC,EAAE,iBAAiB,CAAC;SAC/G;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAXD,4BAWC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\nimport isBase58Validator from 'validator/lib/isBase58';\n\nexport const IS_BASE58 = 'isBase58';\n\n/**\n * Checks if a string is base58 encoded.\n * If given value is not a string, then it returns false.\n */\nexport function isBase58(value: unknown): boolean {\n return typeof value === 'string' && isBase58Validator(value);\n}\n\n/**\n * Checks if a string is base58 encoded.\n * If given value is not a string, then it returns false.\n */\nexport function IsBase58(validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_BASE58,\n validator: {\n validate: (value, args): boolean => isBase58(value),\n defaultMessage: buildMessage(eachPrefix => eachPrefix + '$property must be base58 encoded', validationOptions),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsBase64 = exports.isBase64 = exports.IS_BASE64 = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
const isBase64_1 = __importDefault(require("validator/lib/isBase64"));
|
||||
exports.IS_BASE64 = 'isBase64';
|
||||
/**
|
||||
* Checks if a string is base64 encoded.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function isBase64(value, options) {
|
||||
return typeof value === 'string' && (0, isBase64_1.default)(value, options);
|
||||
}
|
||||
exports.isBase64 = isBase64;
|
||||
/**
|
||||
* Checks if a string is base64 encoded.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function IsBase64(options, validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_BASE64,
|
||||
constraints: [options],
|
||||
validator: {
|
||||
validate: (value, args) => isBase64(value, args === null || args === void 0 ? void 0 : args.constraints[0]),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be base64 encoded', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsBase64 = IsBase64;
|
||||
//# sourceMappingURL=IsBase64.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsBase64.js","sourceRoot":"","sources":["../../../../src/decorator/string/IsBase64.ts"],"names":[],"mappings":";;;;;;AACA,qDAAgE;AAChE,sEAAuD;AAG1C,QAAA,SAAS,GAAG,UAAU,CAAC;AAEpC;;;GAGG;AACH,SAAgB,QAAQ,CAAC,KAAc,EAAE,OAAqC;IAC5E,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAA,kBAAiB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACxE,CAAC;AAFD,4BAEC;AAED;;;GAGG;AACH,SAAgB,QAAQ,CACtB,OAAqC,EACrC,iBAAqC;IAErC,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,iBAAS;QACf,WAAW,EAAE,CAAC,OAAO,CAAC;QACtB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAC,CAAC,CAAC,CAAC;YACzE,cAAc,EAAE,IAAA,yBAAY,EAAC,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,kCAAkC,EAAE,iBAAiB,CAAC;SAC/G;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAfD,4BAeC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\nimport isBase64Validator from 'validator/lib/isBase64';\nimport * as ValidatorJS from 'validator';\n\nexport const IS_BASE64 = 'isBase64';\n\n/**\n * Checks if a string is base64 encoded.\n * If given value is not a string, then it returns false.\n */\nexport function isBase64(value: unknown, options?: ValidatorJS.IsBase64Options): boolean {\n return typeof value === 'string' && isBase64Validator(value, options);\n}\n\n/**\n * Checks if a string is base64 encoded.\n * If given value is not a string, then it returns false.\n */\nexport function IsBase64(\n options?: ValidatorJS.IsBase64Options,\n validationOptions?: ValidationOptions\n): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_BASE64,\n constraints: [options],\n validator: {\n validate: (value, args): boolean => isBase64(value, args?.constraints[0]),\n defaultMessage: buildMessage(eachPrefix => eachPrefix + '$property must be base64 encoded', validationOptions),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsBooleanString = exports.isBooleanString = exports.IS_BOOLEAN_STRING = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
const isBoolean_1 = __importDefault(require("validator/lib/isBoolean"));
|
||||
exports.IS_BOOLEAN_STRING = 'isBooleanString';
|
||||
/**
|
||||
* Checks if a string is a boolean.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function isBooleanString(value) {
|
||||
return typeof value === 'string' && (0, isBoolean_1.default)(value);
|
||||
}
|
||||
exports.isBooleanString = isBooleanString;
|
||||
/**
|
||||
* Checks if a string is a boolean.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function IsBooleanString(validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_BOOLEAN_STRING,
|
||||
validator: {
|
||||
validate: (value, args) => isBooleanString(value),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be a boolean string', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsBooleanString = IsBooleanString;
|
||||
//# sourceMappingURL=IsBooleanString.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsBooleanString.js","sourceRoot":"","sources":["../../../../src/decorator/string/IsBooleanString.ts"],"names":[],"mappings":";;;;;;AACA,qDAAgE;AAChE,wEAAyD;AAE5C,QAAA,iBAAiB,GAAG,iBAAiB,CAAC;AAEnD;;;GAGG;AACH,SAAgB,eAAe,CAAC,KAAc;IAC5C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAA,mBAAkB,EAAC,KAAK,CAAC,CAAC;AAChE,CAAC;AAFD,0CAEC;AAED;;;GAGG;AACH,SAAgB,eAAe,CAAC,iBAAqC;IACnE,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,yBAAiB;QACvB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC;YAC1D,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,oCAAoC,EAC/D,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAdD,0CAcC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\nimport isBooleanValidator from 'validator/lib/isBoolean';\n\nexport const IS_BOOLEAN_STRING = 'isBooleanString';\n\n/**\n * Checks if a string is a boolean.\n * If given value is not a string, then it returns false.\n */\nexport function isBooleanString(value: unknown): boolean {\n return typeof value === 'string' && isBooleanValidator(value);\n}\n\n/**\n * Checks if a string is a boolean.\n * If given value is not a string, then it returns false.\n */\nexport function IsBooleanString(validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_BOOLEAN_STRING,\n validator: {\n validate: (value, args): boolean => isBooleanString(value),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property must be a boolean string',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsBtcAddress = exports.isBtcAddress = exports.IS_BTC_ADDRESS = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
const isBtcAddress_1 = __importDefault(require("validator/lib/isBtcAddress"));
|
||||
exports.IS_BTC_ADDRESS = 'isBtcAddress';
|
||||
/**
|
||||
* Check if the string is a valid BTC address.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function isBtcAddress(value) {
|
||||
return typeof value === 'string' && (0, isBtcAddress_1.default)(value);
|
||||
}
|
||||
exports.isBtcAddress = isBtcAddress;
|
||||
/**
|
||||
* Check if the string is a valid BTC address.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function IsBtcAddress(validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_BTC_ADDRESS,
|
||||
validator: {
|
||||
validate: (value, args) => isBtcAddress(value),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be a BTC address', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsBtcAddress = IsBtcAddress;
|
||||
//# sourceMappingURL=IsBtcAddress.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsBtcAddress.js","sourceRoot":"","sources":["../../../../src/decorator/string/IsBtcAddress.ts"],"names":[],"mappings":";;;;;;AACA,qDAAgE;AAChE,8EAA+D;AAElD,QAAA,cAAc,GAAG,cAAc,CAAC;AAE7C;;;GAGG;AACH,SAAgB,YAAY,CAAC,KAAc;IACzC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAA,sBAAqB,EAAC,KAAK,CAAC,CAAC;AACnE,CAAC;AAFD,oCAEC;AAED;;;GAGG;AACH,SAAgB,YAAY,CAAC,iBAAqC;IAChE,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,sBAAc;QACpB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC;YACvD,cAAc,EAAE,IAAA,yBAAY,EAAC,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,iCAAiC,EAAE,iBAAiB,CAAC;SAC9G;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAXD,oCAWC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\nimport isBtcAddressValidator from 'validator/lib/isBtcAddress';\n\nexport const IS_BTC_ADDRESS = 'isBtcAddress';\n\n/**\n * Check if the string is a valid BTC address.\n * If given value is not a string, then it returns false.\n */\nexport function isBtcAddress(value: unknown): boolean {\n return typeof value === 'string' && isBtcAddressValidator(value);\n}\n\n/**\n * Check if the string is a valid BTC address.\n * If given value is not a string, then it returns false.\n */\nexport function IsBtcAddress(validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_BTC_ADDRESS,\n validator: {\n validate: (value, args): boolean => isBtcAddress(value),\n defaultMessage: buildMessage(eachPrefix => eachPrefix + '$property must be a BTC address', validationOptions),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsByteLength = exports.isByteLength = exports.IS_BYTE_LENGTH = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
const isByteLength_1 = __importDefault(require("validator/lib/isByteLength"));
|
||||
exports.IS_BYTE_LENGTH = 'isByteLength';
|
||||
/**
|
||||
* Checks if the string's length (in bytes) falls in a range.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function isByteLength(value, min, max) {
|
||||
return typeof value === 'string' && (0, isByteLength_1.default)(value, { min, max });
|
||||
}
|
||||
exports.isByteLength = isByteLength;
|
||||
/**
|
||||
* Checks if the string's length (in bytes) falls in a range.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function IsByteLength(min, max, validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_BYTE_LENGTH,
|
||||
constraints: [min, max],
|
||||
validator: {
|
||||
validate: (value, args) => isByteLength(value, args === null || args === void 0 ? void 0 : args.constraints[0], args === null || args === void 0 ? void 0 : args.constraints[1]),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + "$property's byte length must fall into ($constraint1, $constraint2) range", validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsByteLength = IsByteLength;
|
||||
//# sourceMappingURL=IsByteLength.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsByteLength.js","sourceRoot":"","sources":["../../../../src/decorator/string/IsByteLength.ts"],"names":[],"mappings":";;;;;;AACA,qDAAgE;AAChE,8EAA+D;AAElD,QAAA,cAAc,GAAG,cAAc,CAAC;AAE7C;;;GAGG;AACH,SAAgB,YAAY,CAAC,KAAc,EAAE,GAAW,EAAE,GAAY;IACpE,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAA,sBAAqB,EAAC,KAAK,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;AACjF,CAAC;AAFD,oCAEC;AAED;;;GAGG;AACH,SAAgB,YAAY,CAAC,GAAW,EAAE,GAAY,EAAE,iBAAqC;IAC3F,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,sBAAc;QACpB,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;QACvB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAC,CAAC,CAAC,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAC,CAAC,CAAC,CAAC;YACnG,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,2EAA2E,EACtG,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAfD,oCAeC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\nimport isByteLengthValidator from 'validator/lib/isByteLength';\n\nexport const IS_BYTE_LENGTH = 'isByteLength';\n\n/**\n * Checks if the string's length (in bytes) falls in a range.\n * If given value is not a string, then it returns false.\n */\nexport function isByteLength(value: unknown, min: number, max?: number): boolean {\n return typeof value === 'string' && isByteLengthValidator(value, { min, max });\n}\n\n/**\n * Checks if the string's length (in bytes) falls in a range.\n * If given value is not a string, then it returns false.\n */\nexport function IsByteLength(min: number, max?: number, validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_BYTE_LENGTH,\n constraints: [min, max],\n validator: {\n validate: (value, args): boolean => isByteLength(value, args?.constraints[0], args?.constraints[1]),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + \"$property's byte length must fall into ($constraint1, $constraint2) range\",\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsCreditCard = exports.isCreditCard = exports.IS_CREDIT_CARD = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
const isCreditCard_1 = __importDefault(require("validator/lib/isCreditCard"));
|
||||
exports.IS_CREDIT_CARD = 'isCreditCard';
|
||||
/**
|
||||
* Checks if the string is a credit card.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function isCreditCard(value) {
|
||||
return typeof value === 'string' && (0, isCreditCard_1.default)(value);
|
||||
}
|
||||
exports.isCreditCard = isCreditCard;
|
||||
/**
|
||||
* Checks if the string is a credit card.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function IsCreditCard(validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_CREDIT_CARD,
|
||||
validator: {
|
||||
validate: (value, args) => isCreditCard(value),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be a credit card', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsCreditCard = IsCreditCard;
|
||||
//# sourceMappingURL=IsCreditCard.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsCreditCard.js","sourceRoot":"","sources":["../../../../src/decorator/string/IsCreditCard.ts"],"names":[],"mappings":";;;;;;AACA,qDAAgE;AAChE,8EAA+D;AAElD,QAAA,cAAc,GAAG,cAAc,CAAC;AAE7C;;;GAGG;AACH,SAAgB,YAAY,CAAC,KAAc;IACzC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAA,sBAAqB,EAAC,KAAK,CAAC,CAAC;AACnE,CAAC;AAFD,oCAEC;AAED;;;GAGG;AACH,SAAgB,YAAY,CAAC,iBAAqC;IAChE,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,sBAAc;QACpB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC;YACvD,cAAc,EAAE,IAAA,yBAAY,EAAC,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,iCAAiC,EAAE,iBAAiB,CAAC;SAC9G;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAXD,oCAWC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\nimport isCreditCardValidator from 'validator/lib/isCreditCard';\n\nexport const IS_CREDIT_CARD = 'isCreditCard';\n\n/**\n * Checks if the string is a credit card.\n * If given value is not a string, then it returns false.\n */\nexport function isCreditCard(value: unknown): boolean {\n return typeof value === 'string' && isCreditCardValidator(value);\n}\n\n/**\n * Checks if the string is a credit card.\n * If given value is not a string, then it returns false.\n */\nexport function IsCreditCard(validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_CREDIT_CARD,\n validator: {\n validate: (value, args): boolean => isCreditCard(value),\n defaultMessage: buildMessage(eachPrefix => eachPrefix + '$property must be a credit card', validationOptions),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsCurrency = exports.isCurrency = exports.IS_CURRENCY = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
const isCurrency_1 = __importDefault(require("validator/lib/isCurrency"));
|
||||
exports.IS_CURRENCY = 'isCurrency';
|
||||
/**
|
||||
* Checks if the string is a valid currency amount.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function isCurrency(value, options) {
|
||||
return typeof value === 'string' && (0, isCurrency_1.default)(value, options);
|
||||
}
|
||||
exports.isCurrency = isCurrency;
|
||||
/**
|
||||
* Checks if the string is a valid currency amount.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function IsCurrency(options, validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_CURRENCY,
|
||||
constraints: [options],
|
||||
validator: {
|
||||
validate: (value, args) => isCurrency(value, args === null || args === void 0 ? void 0 : args.constraints[0]),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be a currency', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsCurrency = IsCurrency;
|
||||
//# sourceMappingURL=IsCurrency.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsCurrency.js","sourceRoot":"","sources":["../../../../src/decorator/string/IsCurrency.ts"],"names":[],"mappings":";;;;;;AACA,qDAAgE;AAChE,0EAA2D;AAG9C,QAAA,WAAW,GAAG,YAAY,CAAC;AAExC;;;GAGG;AACH,SAAgB,UAAU,CAAC,KAAc,EAAE,OAAuC;IAChF,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAA,oBAAmB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAC1E,CAAC;AAFD,gCAEC;AAED;;;GAGG;AACH,SAAgB,UAAU,CACxB,OAAuC,EACvC,iBAAqC;IAErC,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,mBAAW;QACjB,WAAW,EAAE,CAAC,OAAO,CAAC;QACtB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAC,CAAC,CAAC,CAAC;YAC3E,cAAc,EAAE,IAAA,yBAAY,EAAC,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,8BAA8B,EAAE,iBAAiB,CAAC;SAC3G;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAfD,gCAeC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\nimport isCurrencyValidator from 'validator/lib/isCurrency';\nimport * as ValidatorJS from 'validator';\n\nexport const IS_CURRENCY = 'isCurrency';\n\n/**\n * Checks if the string is a valid currency amount.\n * If given value is not a string, then it returns false.\n */\nexport function isCurrency(value: unknown, options?: ValidatorJS.IsCurrencyOptions): boolean {\n return typeof value === 'string' && isCurrencyValidator(value, options);\n}\n\n/**\n * Checks if the string is a valid currency amount.\n * If given value is not a string, then it returns false.\n */\nexport function IsCurrency(\n options?: ValidatorJS.IsCurrencyOptions,\n validationOptions?: ValidationOptions\n): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_CURRENCY,\n constraints: [options],\n validator: {\n validate: (value, args): boolean => isCurrency(value, args?.constraints[0]),\n defaultMessage: buildMessage(eachPrefix => eachPrefix + '$property must be a currency', validationOptions),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsDataURI = exports.isDataURI = exports.IS_DATA_URI = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
const isDataURI_1 = __importDefault(require("validator/lib/isDataURI"));
|
||||
exports.IS_DATA_URI = 'isDataURI';
|
||||
/**
|
||||
* Check if the string is a data uri format.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function isDataURI(value) {
|
||||
return typeof value === 'string' && (0, isDataURI_1.default)(value);
|
||||
}
|
||||
exports.isDataURI = isDataURI;
|
||||
/**
|
||||
* Check if the string is a data uri format.
|
||||
* If given value is not a string, then it returns false.
|
||||
*/
|
||||
function IsDataURI(validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_DATA_URI,
|
||||
validator: {
|
||||
validate: (value, args) => isDataURI(value),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be a data uri format', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsDataURI = IsDataURI;
|
||||
//# sourceMappingURL=IsDataURI.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsDataURI.js","sourceRoot":"","sources":["../../../../src/decorator/string/IsDataURI.ts"],"names":[],"mappings":";;;;;;AACA,qDAAgE;AAChE,wEAAyD;AAE5C,QAAA,WAAW,GAAG,WAAW,CAAC;AAEvC;;;GAGG;AACH,SAAgB,SAAS,CAAC,KAAc;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAA,mBAAkB,EAAC,KAAK,CAAC,CAAC;AAChE,CAAC;AAFD,8BAEC;AAED;;;GAGG;AACH,SAAgB,SAAS,CAAC,iBAAqC;IAC7D,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,mBAAW;QACjB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC;YACpD,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,qCAAqC,EAChE,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAdD,8BAcC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\nimport isDataURIValidator from 'validator/lib/isDataURI';\n\nexport const IS_DATA_URI = 'isDataURI';\n\n/**\n * Check if the string is a data uri format.\n * If given value is not a string, then it returns false.\n */\nexport function isDataURI(value: unknown): boolean {\n return typeof value === 'string' && isDataURIValidator(value);\n}\n\n/**\n * Check if the string is a data uri format.\n * If given value is not a string, then it returns false.\n */\nexport function IsDataURI(validationOptions?: ValidationOptions): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_DATA_URI,\n validator: {\n validate: (value, args): boolean => isDataURI(value),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property must be a data uri format',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Generated
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IsDateString = exports.isDateString = exports.IS_DATE_STRING = void 0;
|
||||
const ValidateBy_1 = require("../common/ValidateBy");
|
||||
const IsISO8601_1 = require("./IsISO8601");
|
||||
exports.IS_DATE_STRING = 'isDateString';
|
||||
/**
|
||||
* Alias for IsISO8601 validator
|
||||
*/
|
||||
function isDateString(value, options) {
|
||||
return (0, IsISO8601_1.isISO8601)(value, options);
|
||||
}
|
||||
exports.isDateString = isDateString;
|
||||
/**
|
||||
* Alias for IsISO8601 validator
|
||||
*/
|
||||
function IsDateString(options, validationOptions) {
|
||||
return (0, ValidateBy_1.ValidateBy)({
|
||||
name: exports.IS_DATE_STRING,
|
||||
constraints: [options],
|
||||
validator: {
|
||||
validate: (value) => isDateString(value, options),
|
||||
defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be a valid ISO 8601 date string', validationOptions),
|
||||
},
|
||||
}, validationOptions);
|
||||
}
|
||||
exports.IsDateString = IsDateString;
|
||||
//# sourceMappingURL=IsDateString.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IsDateString.js","sourceRoot":"","sources":["../../../../src/decorator/string/IsDateString.ts"],"names":[],"mappings":";;;AACA,qDAAgE;AAEhE,2CAAwC;AAE3B,QAAA,cAAc,GAAG,cAAc,CAAC;AAE7C;;GAEG;AACH,SAAgB,YAAY,CAAC,KAAc,EAAE,OAAsC;IACjF,OAAO,IAAA,qBAAS,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACnC,CAAC;AAFD,oCAEC;AAED;;GAEG;AACH,SAAgB,YAAY,CAC1B,OAAsC,EACtC,iBAAqC;IAErC,OAAO,IAAA,uBAAU,EACf;QACE,IAAI,EAAE,sBAAc;QACpB,WAAW,EAAE,CAAC,OAAO,CAAC;QACtB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAW,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC;YAC1D,cAAc,EAAE,IAAA,yBAAY,EAC1B,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,gDAAgD,EAC3E,iBAAiB,CAClB;SACF;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAlBD,oCAkBC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\nimport * as ValidatorJS from 'validator';\nimport { isISO8601 } from './IsISO8601';\n\nexport const IS_DATE_STRING = 'isDateString';\n\n/**\n * Alias for IsISO8601 validator\n */\nexport function isDateString(value: unknown, options?: ValidatorJS.IsISO8601Options): boolean {\n return isISO8601(value, options);\n}\n\n/**\n * Alias for IsISO8601 validator\n */\nexport function IsDateString(\n options?: ValidatorJS.IsISO8601Options,\n validationOptions?: ValidationOptions\n): PropertyDecorator {\n return ValidateBy(\n {\n name: IS_DATE_STRING,\n constraints: [options],\n validator: {\n validate: (value): boolean => isDateString(value, options),\n defaultMessage: buildMessage(\n eachPrefix => eachPrefix + '$property must be a valid ISO 8601 date string',\n validationOptions\n ),\n },\n },\n validationOptions\n );\n}\n"]}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user