custom-class-validator-tools 1.1.4 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/package.json +2 -2
- package/dist/decorator/transform/any-to-bigint.decorator.d.ts +0 -2
- package/dist/decorator/transform/any-to-bigint.decorator.js +0 -40
- package/dist/decorator/transform/any-to-number-array.decorator.d.ts +0 -2
- package/dist/decorator/transform/any-to-number-array.decorator.js +0 -48
- package/dist/decorator/transform/any-to-number.decorator.d.ts +0 -2
- package/dist/decorator/transform/any-to-number.decorator.js +0 -43
- package/dist/decorator/transform/any-to-string.decorator.d.ts +0 -2
- package/dist/decorator/transform/any-to-string.decorator.js +0 -15
- package/dist/decorator/transform/number-to-boolean.decorator.d.ts +0 -2
- package/dist/decorator/transform/number-to-boolean.decorator.js +0 -22
- package/dist/decorator/transform/string-to-boolean.decorator.d.ts +0 -2
- package/dist/decorator/transform/string-to-boolean.decorator.js +0 -24
- package/dist/decorator/validate/function/string-validator.function.d.ts +0 -1
- package/dist/decorator/validate/function/string-validator.function.js +0 -13
- package/dist/decorator/validate/is-not-empty-bigint-string.decorator.d.ts +0 -2
- package/dist/decorator/validate/is-not-empty-bigint-string.decorator.js +0 -46
- package/dist/decorator/validate/is-not-empty-bigint.decorator.d.ts +0 -2
- package/dist/decorator/validate/is-not-empty-bigint.decorator.js +0 -18
- package/dist/decorator/validate/is-not-empty-boolean-number.decorator.d.ts +0 -4
- package/dist/decorator/validate/is-not-empty-boolean-number.decorator.js +0 -51
- package/dist/decorator/validate/is-not-empty-boolean-string.decorator.d.ts +0 -2
- package/dist/decorator/validate/is-not-empty-boolean-string.decorator.js +0 -20
- package/dist/decorator/validate/is-not-empty-boolean.decorator.d.ts +0 -2
- package/dist/decorator/validate/is-not-empty-boolean.decorator.js +0 -18
- package/dist/decorator/validate/is-not-empty-number-string.decorator.d.ts +0 -4
- package/dist/decorator/validate/is-not-empty-number-string.decorator.js +0 -50
- package/dist/decorator/validate/is-not-empty-number.decorator.d.ts +0 -4
- package/dist/decorator/validate/is-not-empty-number.decorator.js +0 -47
- package/dist/decorator/validate/is-not-empty-sql-date-string.decorator.d.ts +0 -2
- package/dist/decorator/validate/is-not-empty-sql-date-string.decorator.js +0 -24
- package/dist/decorator/validate/is-not-empty-sql-date-time-string.decorator.d.ts +0 -2
- package/dist/decorator/validate/is-not-empty-sql-date-time-string.decorator.js +0 -24
- package/dist/decorator/validate/is-not-empty-sql-time-string.decorator.d.ts +0 -4
- package/dist/decorator/validate/is-not-empty-sql-time-string.decorator.js +0 -48
- package/dist/decorator/validate/is-not-empty-string.decorator.d.ts +0 -4
- package/dist/decorator/validate/is-not-empty-string.decorator.js +0 -19
- package/dist/decorator/validate/is-nullable-bigint.decorator.d.ts +0 -2
- package/dist/decorator/validate/is-nullable-bigint.decorator.js +0 -19
- package/dist/decorator/validate/is-nullable-boolean-number.decorator.d.ts +0 -4
- package/dist/decorator/validate/is-nullable-boolean-number.decorator.js +0 -52
- package/dist/decorator/validate/is-nullable-boolean-string.decorator.d.ts +0 -2
- package/dist/decorator/validate/is-nullable-boolean-string.decorator.js +0 -21
- package/dist/decorator/validate/is-nullable-boolean.decorator.d.ts +0 -2
- package/dist/decorator/validate/is-nullable-boolean.decorator.js +0 -19
- package/dist/decorator/validate/is-nullable-number-string.decorator.d.ts +0 -4
- package/dist/decorator/validate/is-nullable-number-string.decorator.js +0 -51
- package/dist/decorator/validate/is-nullable-number.decorator.d.ts +0 -4
- package/dist/decorator/validate/is-nullable-number.decorator.js +0 -50
- package/dist/decorator/validate/is-nullable-sql-date-string.decorator.d.ts +0 -2
- package/dist/decorator/validate/is-nullable-sql-date-string.decorator.js +0 -27
- package/dist/decorator/validate/is-nullable-sql-date-time-string.decorator.d.ts +0 -2
- package/dist/decorator/validate/is-nullable-sql-date-time-string.decorator.js +0 -27
- package/dist/decorator/validate/is-nullable-sql-time-string.decorator.d.ts +0 -4
- package/dist/decorator/validate/is-nullable-sql-time-string.decorator.js +0 -50
- package/dist/decorator/validate/is-nullable-string.decorator.d.ts +0 -4
- package/dist/decorator/validate/is-nullable-string.decorator.js +0 -21
- package/dist/decorator/validate/is-nullable.decorator.d.ts +0 -1
- package/dist/decorator/validate/is-nullable.decorator.js +0 -11
- package/dist/decorator/validate/is-optional-bigint.decorator.d.ts +0 -2
- package/dist/decorator/validate/is-optional-bigint.decorator.js +0 -19
- package/dist/decorator/validate/is-optional-boolean-string.decorator.d.ts +0 -2
- package/dist/decorator/validate/is-optional-boolean-string.decorator.js +0 -21
- package/dist/decorator/validate/is-optional-boolean.decorator.d.ts +0 -2
- package/dist/decorator/validate/is-optional-boolean.decorator.js +0 -19
- package/dist/decorator/validate/is-optional-number-boolean.decorator.d.ts +0 -4
- package/dist/decorator/validate/is-optional-number-boolean.decorator.js +0 -52
- package/dist/decorator/validate/is-optional-number-string.decorator.d.ts +0 -4
- package/dist/decorator/validate/is-optional-number-string.decorator.js +0 -50
- package/dist/decorator/validate/is-optional-number.decorator.d.ts +0 -4
- package/dist/decorator/validate/is-optional-number.decorator.js +0 -49
- package/dist/decorator/validate/is-optional-sql-date-string.decorator.d.ts +0 -2
- package/dist/decorator/validate/is-optional-sql-date-string.decorator.js +0 -27
- package/dist/decorator/validate/is-optional-sql-date-time-string.decorator.d.ts +0 -2
- package/dist/decorator/validate/is-optional-sql-date-time-string.decorator.js +0 -27
- package/dist/decorator/validate/is-optional-sql-time-string.decorator.d.ts +0 -4
- package/dist/decorator/validate/is-optional-sql-time-string.decorator.js +0 -53
- package/dist/decorator/validate/is-optional-string.decorator.d.ts +0 -4
- package/dist/decorator/validate/is-optional-string.decorator.js +0 -21
- package/dist/decorator/validate/is-type.decorator.d.ts +0 -7
- package/dist/decorator/validate/is-type.decorator.js +0 -21
- package/dist/decorator/validate/is-undefinable-bigint.decorator.d.ts +0 -2
- package/dist/decorator/validate/is-undefinable-bigint.decorator.js +0 -19
- package/dist/decorator/validate/is-undefinable-boolean-number.decorator.d.ts +0 -4
- package/dist/decorator/validate/is-undefinable-boolean-number.decorator.js +0 -52
- package/dist/decorator/validate/is-undefinable-boolean-string.decorator.d.ts +0 -2
- package/dist/decorator/validate/is-undefinable-boolean-string.decorator.js +0 -19
- package/dist/decorator/validate/is-undefinable-boolean.decorator.d.ts +0 -2
- package/dist/decorator/validate/is-undefinable-boolean.decorator.js +0 -19
- package/dist/decorator/validate/is-undefinable-number-string.decorator.d.ts +0 -4
- package/dist/decorator/validate/is-undefinable-number-string.decorator.js +0 -52
- package/dist/decorator/validate/is-undefinable-number.decorator.d.ts +0 -4
- package/dist/decorator/validate/is-undefinable-number.decorator.js +0 -50
- package/dist/decorator/validate/is-undefinable-sql-date-string.decorator.d.ts +0 -2
- package/dist/decorator/validate/is-undefinable-sql-date-string.decorator.js +0 -25
- package/dist/decorator/validate/is-undefinable-sql-date-time-string.decorator.d.ts +0 -2
- package/dist/decorator/validate/is-undefinable-sql-date-time-string.decorator.js +0 -25
- package/dist/decorator/validate/is-undefinable-sql-time.decorator.d.ts +0 -4
- package/dist/decorator/validate/is-undefinable-sql-time.decorator.js +0 -54
- package/dist/decorator/validate/is-undefinable-string.decorator.d.ts +0 -4
- package/dist/decorator/validate/is-undefinable-string.decorator.js +0 -21
- package/dist/decorator/validate/is-undefinable.decorator.d.ts +0 -1
- package/dist/decorator/validate/is-undefinable.decorator.js +0 -11
- package/dist/function/validate-with-header.decorators.d.ts +0 -2
- package/dist/function/validate-with-header.decorators.js +0 -33
- package/dist/index.d.ts +0 -54
- package/dist/util/is-boolean.d.ts +0 -2
- package/dist/util/is-boolean.js +0 -11
- package/dist/util/is-empty.d.ts +0 -12
- package/dist/util/is-empty.js +0 -80
package/dist/index.js
CHANGED
|
@@ -14,6 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./function/validate-with-header.decorators"), exports);
|
|
18
|
+
__exportStar(require("./util/is-boolean"), exports);
|
|
19
|
+
__exportStar(require("./util/is-empty"), exports);
|
|
17
20
|
__exportStar(require("./decorator/transform/any-to-bigint.decorator"), exports);
|
|
18
21
|
__exportStar(require("./decorator/transform/any-to-number-array.decorator"), exports);
|
|
19
22
|
__exportStar(require("./decorator/transform/any-to-number.decorator"), exports);
|
|
@@ -65,6 +68,3 @@ __exportStar(require("./decorator/validate/is-undefinable-sql-time.decorator"),
|
|
|
65
68
|
__exportStar(require("./decorator/validate/is-undefinable-string.decorator"), exports);
|
|
66
69
|
__exportStar(require("./decorator/validate/is-undefinable.decorator"), exports);
|
|
67
70
|
__exportStar(require("./decorator/validate/function/string-validator.function"), exports);
|
|
68
|
-
__exportStar(require("./function/validate-with-header.decorators"), exports);
|
|
69
|
-
__exportStar(require("./util/is-boolean"), exports);
|
|
70
|
-
__exportStar(require("./util/is-empty"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "custom-class-validator-tools",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"jest": "^29.6.0",
|
|
34
34
|
"just-scripts": "^2.2.0",
|
|
35
35
|
"prettier": "^3.0.0",
|
|
36
|
-
"reflect-metadata": "^0.
|
|
36
|
+
"reflect-metadata": "^0.2.0",
|
|
37
37
|
"ts-jest": "^29.1.0",
|
|
38
38
|
"ts-node": "^10.7.0",
|
|
39
39
|
"tsc-alias": "^1.6.7",
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.AnyToBigInt = void 0;
|
|
27
|
-
const class_transformer_1 = require("class-transformer");
|
|
28
|
-
const FE = __importStar(require("fp-ts/Either"));
|
|
29
|
-
const FF = __importStar(require("fp-ts/function"));
|
|
30
|
-
const AnyToBigInt = () => {
|
|
31
|
-
const toPlain = (0, class_transformer_1.Transform)(({ value }) => value, { toPlainOnly: true });
|
|
32
|
-
const toClass = (target, key) => (0, class_transformer_1.Transform)(({ obj }) => {
|
|
33
|
-
return FF.pipe(FE.tryCatch(() => BigInt(obj[key]), () => obj[key]), FE.fold(left => left, right => right));
|
|
34
|
-
})(target, key);
|
|
35
|
-
return function (target, key) {
|
|
36
|
-
toPlain(target, key);
|
|
37
|
-
toClass(target, key);
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
exports.AnyToBigInt = AnyToBigInt;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.ToNumberArray = void 0;
|
|
27
|
-
const is_boolean_1 = require("../../util/is-boolean");
|
|
28
|
-
const class_transformer_1 = require("class-transformer");
|
|
29
|
-
const FF = __importStar(require("fp-ts/function"));
|
|
30
|
-
const FO = __importStar(require("fp-ts/Option"));
|
|
31
|
-
const ToNumberArray = () => {
|
|
32
|
-
const toPlain = (0, class_transformer_1.Transform)(({ value }) => value, { toPlainOnly: true });
|
|
33
|
-
const toClass = (target, key) => (0, class_transformer_1.Transform)(({ obj }) => {
|
|
34
|
-
return FF.pipe(obj[key], FO.fromPredicate(predicate => Array.isArray(predicate)), FO.fold(() => {
|
|
35
|
-
return FF.pipe(Number(obj[key]), FO.fromPredicate(value => (0, is_boolean_1.isFalse)(Number.isNaN(value))), FO.fold(() => {
|
|
36
|
-
return obj[key];
|
|
37
|
-
}, right => [right]));
|
|
38
|
-
}, items => {
|
|
39
|
-
const result = items.map(item => +item);
|
|
40
|
-
return FF.pipe(result, FO.fromPredicate(values => values.some(item => (0, is_boolean_1.isTrue)(Number.isNaN(item)))), FO.fold(() => result, () => obj[key]));
|
|
41
|
-
}));
|
|
42
|
-
})(target, key);
|
|
43
|
-
return function (target, key) {
|
|
44
|
-
toPlain(target, key);
|
|
45
|
-
toClass(target, key);
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
exports.ToNumberArray = ToNumberArray;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.ToNumber = void 0;
|
|
27
|
-
const is_boolean_1 = require("../../util/is-boolean");
|
|
28
|
-
const class_transformer_1 = require("class-transformer");
|
|
29
|
-
const FF = __importStar(require("fp-ts/function"));
|
|
30
|
-
const FO = __importStar(require("fp-ts/Option"));
|
|
31
|
-
const ToNumber = () => {
|
|
32
|
-
const toPlain = (0, class_transformer_1.Transform)(({ value }) => value, { toPlainOnly: true });
|
|
33
|
-
const toClass = (target, key) => (0, class_transformer_1.Transform)(({ obj }) => {
|
|
34
|
-
return FF.pipe(Number(obj[key]), FO.fromPredicate(value => (0, is_boolean_1.isFalse)(Number.isNaN(value))), FO.fold(() => {
|
|
35
|
-
return obj[key];
|
|
36
|
-
}, right => right));
|
|
37
|
-
})(target, key);
|
|
38
|
-
return function (target, key) {
|
|
39
|
-
toPlain(target, key);
|
|
40
|
-
toClass(target, key);
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
exports.ToNumber = ToNumber;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AnyToString = void 0;
|
|
4
|
-
const class_transformer_1 = require("class-transformer");
|
|
5
|
-
const AnyToString = () => {
|
|
6
|
-
const toPlain = (0, class_transformer_1.Transform)(({ value }) => value, { toPlainOnly: true });
|
|
7
|
-
const toClass = (target, key) => (0, class_transformer_1.Transform)(({ obj }) => {
|
|
8
|
-
return `${obj[key]}`;
|
|
9
|
-
})(target, key);
|
|
10
|
-
return function (target, key) {
|
|
11
|
-
toPlain(target, key);
|
|
12
|
-
toClass(target, key);
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
exports.AnyToString = AnyToString;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NumberToBoolean = void 0;
|
|
4
|
-
const class_transformer_1 = require("class-transformer");
|
|
5
|
-
const NumberToBoolean = () => {
|
|
6
|
-
const toPlain = (0, class_transformer_1.Transform)(({ value }) => value, { toPlainOnly: true });
|
|
7
|
-
const toClass = (target, key) => (0, class_transformer_1.Transform)(({ obj }) => {
|
|
8
|
-
switch (obj[key]) {
|
|
9
|
-
case 1:
|
|
10
|
-
return true;
|
|
11
|
-
case 0:
|
|
12
|
-
return false;
|
|
13
|
-
default:
|
|
14
|
-
return obj[key];
|
|
15
|
-
}
|
|
16
|
-
})(target, key);
|
|
17
|
-
return function (target, key) {
|
|
18
|
-
toPlain(target, key);
|
|
19
|
-
toClass(target, key);
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
exports.NumberToBoolean = NumberToBoolean;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StringToBoolean = void 0;
|
|
4
|
-
const class_transformer_1 = require("class-transformer");
|
|
5
|
-
const StringToBoolean = () => {
|
|
6
|
-
const toPlain = (0, class_transformer_1.Transform)(({ value }) => value, { toPlainOnly: true });
|
|
7
|
-
const toClass = (target, key) => (0, class_transformer_1.Transform)(({ obj }) => {
|
|
8
|
-
switch (obj[key]) {
|
|
9
|
-
case true:
|
|
10
|
-
case 'true':
|
|
11
|
-
return true;
|
|
12
|
-
case false:
|
|
13
|
-
case 'false':
|
|
14
|
-
return false;
|
|
15
|
-
default:
|
|
16
|
-
return obj[key];
|
|
17
|
-
}
|
|
18
|
-
})(target, key);
|
|
19
|
-
return function (target, key) {
|
|
20
|
-
toPlain(target, key);
|
|
21
|
-
toClass(target, key);
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
exports.StringToBoolean = StringToBoolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function stringValidator(value: any, blank?: boolean): boolean;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stringValidator = void 0;
|
|
4
|
-
function stringValidator(value, blank) {
|
|
5
|
-
switch (blank ?? false) {
|
|
6
|
-
case true:
|
|
7
|
-
return typeof value === 'string';
|
|
8
|
-
case false:
|
|
9
|
-
default:
|
|
10
|
-
return typeof value === 'string' && value.length > 0;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.stringValidator = stringValidator;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.IsNotEmptyBigIntString = void 0;
|
|
27
|
-
const class_validator_1 = require("class-validator");
|
|
28
|
-
const FE = __importStar(require("fp-ts/Either"));
|
|
29
|
-
const FF = __importStar(require("fp-ts/function"));
|
|
30
|
-
const FO = __importStar(require("fp-ts/Option"));
|
|
31
|
-
const isNotEmptyBigIntString = (value) => {
|
|
32
|
-
return FF.pipe(value, FO.fromPredicate(refinement => typeof refinement === 'string' && refinement.length > 0), FO.map(notNullString => FF.pipe(FE.tryCatch(() => BigInt(notNullString), () => false), FE.fold(left => left, () => true))), FO.fold(() => false, right => right));
|
|
33
|
-
};
|
|
34
|
-
const IsNotEmptyBigIntString = (validationOptions) => {
|
|
35
|
-
return (0, class_validator_1.ValidateBy)({
|
|
36
|
-
name: 'IsNotEmptyBitIntString',
|
|
37
|
-
constraints: [validationOptions],
|
|
38
|
-
validator: {
|
|
39
|
-
validate: (value) => isNotEmptyBigIntString(value),
|
|
40
|
-
defaultMessage(validationArguments) {
|
|
41
|
-
return `${validationArguments?.property} should be bigint string`;
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
}, validationOptions);
|
|
45
|
-
};
|
|
46
|
-
exports.IsNotEmptyBigIntString = IsNotEmptyBigIntString;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IsNotEmptyBigInt = void 0;
|
|
4
|
-
const class_validator_1 = require("class-validator");
|
|
5
|
-
const isNotEmptyBigInt = (value) => typeof value === 'bigint';
|
|
6
|
-
const IsNotEmptyBigInt = (validationOptions) => {
|
|
7
|
-
return (0, class_validator_1.ValidateBy)({
|
|
8
|
-
name: 'IsNotEmptyBigInt',
|
|
9
|
-
constraints: [validationOptions],
|
|
10
|
-
validator: {
|
|
11
|
-
validate: (value) => isNotEmptyBigInt(value),
|
|
12
|
-
defaultMessage(validationArguments) {
|
|
13
|
-
return `${validationArguments?.property} should be bigint`;
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
}, validationOptions);
|
|
17
|
-
};
|
|
18
|
-
exports.IsNotEmptyBigInt = IsNotEmptyBigInt;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.IsNotEmptyBooleanNumber = void 0;
|
|
27
|
-
const class_validator_1 = require("class-validator");
|
|
28
|
-
const FF = __importStar(require("fp-ts/function"));
|
|
29
|
-
const FO = __importStar(require("fp-ts/Option"));
|
|
30
|
-
const is_boolean_1 = require("../../util/is-boolean");
|
|
31
|
-
const strictValues = [1, 0];
|
|
32
|
-
const isNotEmptyBooleanNumber = (value, validationOptions) => {
|
|
33
|
-
return FF.pipe(value, FO.fromNullable, FO.map(notEmptyValue => {
|
|
34
|
-
return FF.pipe(notEmptyValue, FO.fromPredicate(predicate => typeof predicate === 'number' && (0, is_boolean_1.isFalse)(isNaN(predicate))), FO.map(numberValue => {
|
|
35
|
-
return FF.pipe(validationOptions?.strict ?? true, FO.fromPredicate(predicate => (0, is_boolean_1.isTrue)(predicate)), FO.fold(() => true, () => strictValues.includes(numberValue)));
|
|
36
|
-
}), FO.fold(() => false, right => right));
|
|
37
|
-
}), FO.fold(() => false, right => right));
|
|
38
|
-
};
|
|
39
|
-
const IsNotEmptyBooleanNumber = (validationOptions) => {
|
|
40
|
-
return (0, class_validator_1.ValidateBy)({
|
|
41
|
-
name: 'IsNotEmptyBooleanNumber',
|
|
42
|
-
constraints: [validationOptions],
|
|
43
|
-
validator: {
|
|
44
|
-
validate: (value) => isNotEmptyBooleanNumber(value, validationOptions),
|
|
45
|
-
defaultMessage(validationArguments) {
|
|
46
|
-
return `${validationArguments?.property} should be boolean number`;
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
}, validationOptions);
|
|
50
|
-
};
|
|
51
|
-
exports.IsNotEmptyBooleanNumber = IsNotEmptyBooleanNumber;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IsNotEmptyBooleanString = void 0;
|
|
4
|
-
const class_validator_1 = require("class-validator");
|
|
5
|
-
const isNotEmptyBooleanString = (value) => {
|
|
6
|
-
return typeof value === 'string' && value.length > 0 && ['true', 'false'].includes(value);
|
|
7
|
-
};
|
|
8
|
-
const IsNotEmptyBooleanString = (validationOptions) => {
|
|
9
|
-
return (0, class_validator_1.ValidateBy)({
|
|
10
|
-
name: 'IsNotEmptyBooleanString',
|
|
11
|
-
constraints: [validationOptions],
|
|
12
|
-
validator: {
|
|
13
|
-
validate: (value) => isNotEmptyBooleanString(value),
|
|
14
|
-
defaultMessage(validationArguments) {
|
|
15
|
-
return `${validationArguments?.property} should be boolean string`;
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
}, validationOptions);
|
|
19
|
-
};
|
|
20
|
-
exports.IsNotEmptyBooleanString = IsNotEmptyBooleanString;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IsNotEmptyBoolean = void 0;
|
|
4
|
-
const class_validator_1 = require("class-validator");
|
|
5
|
-
const isNotEmptyBoolean = (value) => typeof value === 'boolean';
|
|
6
|
-
const IsNotEmptyBoolean = (validationOptions) => {
|
|
7
|
-
return (0, class_validator_1.ValidateBy)({
|
|
8
|
-
name: 'IsNotEmptyBoolean',
|
|
9
|
-
constraints: [validationOptions],
|
|
10
|
-
validator: {
|
|
11
|
-
validate: (value) => isNotEmptyBoolean(value),
|
|
12
|
-
defaultMessage(validationArguments) {
|
|
13
|
-
return `${validationArguments?.property} should be boolean`;
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
}, validationOptions);
|
|
17
|
-
};
|
|
18
|
-
exports.IsNotEmptyBoolean = IsNotEmptyBoolean;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.IsNotEmptyNumberString = void 0;
|
|
27
|
-
const class_validator_1 = require("class-validator");
|
|
28
|
-
const FF = __importStar(require("fp-ts/function"));
|
|
29
|
-
const FO = __importStar(require("fp-ts/Option"));
|
|
30
|
-
const is_boolean_1 = require("../../util/is-boolean");
|
|
31
|
-
const isNotEmptyNumberString = (value, validationOptions) => {
|
|
32
|
-
const numberValue = Number(value);
|
|
33
|
-
const isNumber = typeof value === 'string' && value.length > 0 && (0, is_boolean_1.isFalse)(isNaN(numberValue));
|
|
34
|
-
return FF.pipe(validationOptions?.isFloat ?? false, FO.fromPredicate(predicate => (0, is_boolean_1.isTrue)(predicate)), FO.fold(() => (0, is_boolean_1.isTrue)(isNumber) && numberValue % 1 === 0, () => {
|
|
35
|
-
return (0, is_boolean_1.isTrue)(isNumber);
|
|
36
|
-
}));
|
|
37
|
-
};
|
|
38
|
-
const IsNotEmptyNumberString = (validationOptions) => {
|
|
39
|
-
return (0, class_validator_1.ValidateBy)({
|
|
40
|
-
name: 'IsNotEmptyNumberString',
|
|
41
|
-
constraints: [validationOptions],
|
|
42
|
-
validator: {
|
|
43
|
-
validate: (value) => isNotEmptyNumberString(value, validationOptions),
|
|
44
|
-
defaultMessage(validationArguments) {
|
|
45
|
-
return `${validationArguments?.property} should be number string`;
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
}, validationOptions);
|
|
49
|
-
};
|
|
50
|
-
exports.IsNotEmptyNumberString = IsNotEmptyNumberString;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.IsNotEmptyNumber = void 0;
|
|
27
|
-
const class_validator_1 = require("class-validator");
|
|
28
|
-
const FF = __importStar(require("fp-ts/function"));
|
|
29
|
-
const FO = __importStar(require("fp-ts/Option"));
|
|
30
|
-
const is_boolean_1 = require("../../util/is-boolean");
|
|
31
|
-
const isNotEmptyNumber = (value, validationOptions) => {
|
|
32
|
-
const isNumber = typeof value === 'number' && (0, is_boolean_1.isFalse)(isNaN(value));
|
|
33
|
-
return FF.pipe(validationOptions?.isFloat ?? false, FO.fromPredicate(predicate => (0, is_boolean_1.isTrue)(predicate)), FO.fold(() => (0, is_boolean_1.isTrue)(isNumber) && value % 1 === 0, () => (0, is_boolean_1.isTrue)(isNumber)));
|
|
34
|
-
};
|
|
35
|
-
const IsNotEmptyNumber = (validationOptions) => {
|
|
36
|
-
return (0, class_validator_1.ValidateBy)({
|
|
37
|
-
name: 'IsNotEmptyNumber',
|
|
38
|
-
constraints: [validationOptions],
|
|
39
|
-
validator: {
|
|
40
|
-
validate: (value) => isNotEmptyNumber(value, validationOptions),
|
|
41
|
-
defaultMessage(validationArguments) {
|
|
42
|
-
return `${validationArguments?.property} should be number`;
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
}, validationOptions);
|
|
46
|
-
};
|
|
47
|
-
exports.IsNotEmptyNumber = IsNotEmptyNumber;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.IsNotEmptySqlDateString = void 0;
|
|
7
|
-
const class_validator_1 = require("class-validator");
|
|
8
|
-
const dayjs_1 = __importDefault(require("dayjs"));
|
|
9
|
-
const customParseFormat_1 = __importDefault(require("dayjs/plugin/customParseFormat"));
|
|
10
|
-
dayjs_1.default.extend(customParseFormat_1.default);
|
|
11
|
-
const isNotEmptySqlDateString = (value) => typeof value === 'string' && (0, dayjs_1.default)(value, 'YYYY-MM-DD', true).isValid();
|
|
12
|
-
const IsNotEmptySqlDateString = (validationOptions) => {
|
|
13
|
-
return (0, class_validator_1.ValidateBy)({
|
|
14
|
-
name: 'IsNotEmptySqlDateString',
|
|
15
|
-
constraints: [validationOptions],
|
|
16
|
-
validator: {
|
|
17
|
-
validate: (value) => isNotEmptySqlDateString(value),
|
|
18
|
-
defaultMessage(validationArguments) {
|
|
19
|
-
return `${validationArguments?.property} should be YYYY-MM-DD`;
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
}, validationOptions);
|
|
23
|
-
};
|
|
24
|
-
exports.IsNotEmptySqlDateString = IsNotEmptySqlDateString;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.IsNotEmptySqlDateTimeString = void 0;
|
|
7
|
-
const class_validator_1 = require("class-validator");
|
|
8
|
-
const dayjs_1 = __importDefault(require("dayjs"));
|
|
9
|
-
const customParseFormat_1 = __importDefault(require("dayjs/plugin/customParseFormat"));
|
|
10
|
-
dayjs_1.default.extend(customParseFormat_1.default);
|
|
11
|
-
const isNotEmptySqlDateTimeString = (value) => typeof value === 'string' && (0, dayjs_1.default)(value, 'YYYY-MM-DD HH:mm:ss', true).isValid();
|
|
12
|
-
const IsNotEmptySqlDateTimeString = (validationOptions) => {
|
|
13
|
-
return (0, class_validator_1.ValidateBy)({
|
|
14
|
-
name: 'IsNotEmptySqlDateTimeString',
|
|
15
|
-
constraints: [validationOptions],
|
|
16
|
-
validator: {
|
|
17
|
-
validate: (value) => isNotEmptySqlDateTimeString(value),
|
|
18
|
-
defaultMessage(validationArguments) {
|
|
19
|
-
return `${validationArguments?.property} should be YYYY-MM-DD hh:mm:ss`;
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
}, validationOptions);
|
|
23
|
-
};
|
|
24
|
-
exports.IsNotEmptySqlDateTimeString = IsNotEmptySqlDateTimeString;
|