@dereekb/model 9.24.17 → 9.24.19
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/CHANGELOG.md +8 -0
- package/package.json +2 -2
- package/src/lib/validator/index.d.ts +1 -0
- package/src/lib/validator/index.js +1 -0
- package/src/lib/validator/index.js.map +1 -1
- package/src/lib/validator/phone.d.ts +20 -0
- package/src/lib/validator/phone.js +72 -0
- package/src/lib/validator/phone.js.map +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [9.24.19](https://github.com/dereekb/dbx-components/compare/v9.24.18-dev...v9.24.19) (2023-07-30)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## [9.24.18](https://github.com/dereekb/dbx-components/compare/v9.24.17-dev...v9.24.18) (2023-07-30)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
5
13
|
## [9.24.17](https://github.com/dereekb/dbx-components/compare/v9.24.16-dev...v9.24.17) (2023-07-24)
|
|
6
14
|
|
|
7
15
|
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/model",
|
|
3
|
-
"version": "9.24.
|
|
3
|
+
"version": "9.24.19",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
7
7
|
"dependencies": {},
|
|
8
8
|
"peerDependencies": {
|
|
9
9
|
"class-validator": "^0.13.2",
|
|
10
|
-
"@dereekb/util": "9.24.
|
|
10
|
+
"@dereekb/util": "9.24.19",
|
|
11
11
|
"lodash.isequal": "^4.5.0",
|
|
12
12
|
"make-error": "^1.3.0",
|
|
13
13
|
"ts-essentials": "^9.1.2",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/model/src/lib/validator/index.ts"],"names":[],"mappings":";;;AAAA,iDAAuB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/model/src/lib/validator/index.ts"],"names":[],"mappings":";;;AAAA,iDAAuB;AACvB,kDAAwB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ObjectWithConstructor } from '@dereekb/util';
|
|
2
|
+
import { ValidationOptions } from 'class-validator';
|
|
3
|
+
/**
|
|
4
|
+
* isE164PhoneNumber validator that does not allowed extensions.
|
|
5
|
+
*/
|
|
6
|
+
export declare function IsE164PhoneNumber(validationOptions?: ValidationOptions): (object: ObjectWithConstructor, propertyName: string) => void;
|
|
7
|
+
/**
|
|
8
|
+
* isE164PhoneNumber validator that allows extensions.
|
|
9
|
+
*
|
|
10
|
+
* @param validationOptions
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
export declare function IsE164PhoneNumberWithOptionalExtension(validationOptions?: ValidationOptions): (object: ObjectWithConstructor, propertyName: string) => void;
|
|
14
|
+
/**
|
|
15
|
+
* isE164PhoneNumberWithExtension validator
|
|
16
|
+
*
|
|
17
|
+
* @param validationOptions
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
export declare function IsE164PhoneNumberWithExtension(validationOptions?: ValidationOptions): (object: ObjectWithConstructor, propertyName: string) => void;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IsE164PhoneNumberWithExtension = exports.IsE164PhoneNumberWithOptionalExtension = exports.IsE164PhoneNumber = void 0;
|
|
4
|
+
const util_1 = require("@dereekb/util");
|
|
5
|
+
const class_validator_1 = require("class-validator");
|
|
6
|
+
/**
|
|
7
|
+
* isE164PhoneNumber validator that does not allowed extensions.
|
|
8
|
+
*/
|
|
9
|
+
function IsE164PhoneNumber(validationOptions) {
|
|
10
|
+
return function (object, propertyName) {
|
|
11
|
+
(0, class_validator_1.registerDecorator)({
|
|
12
|
+
name: 'isE164PhoneNumber',
|
|
13
|
+
target: object.constructor,
|
|
14
|
+
propertyName: propertyName,
|
|
15
|
+
options: validationOptions,
|
|
16
|
+
validator: {
|
|
17
|
+
validate: (x) => (0, util_1.isE164PhoneNumber)(x, false),
|
|
18
|
+
defaultMessage(args) {
|
|
19
|
+
return `"${args.value}" is not a E164PhoneNumber with no extension.`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
exports.IsE164PhoneNumber = IsE164PhoneNumber;
|
|
26
|
+
/**
|
|
27
|
+
* isE164PhoneNumber validator that allows extensions.
|
|
28
|
+
*
|
|
29
|
+
* @param validationOptions
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
function IsE164PhoneNumberWithOptionalExtension(validationOptions) {
|
|
33
|
+
return function (object, propertyName) {
|
|
34
|
+
(0, class_validator_1.registerDecorator)({
|
|
35
|
+
name: 'isE164PhoneNumber',
|
|
36
|
+
target: object.constructor,
|
|
37
|
+
propertyName: propertyName,
|
|
38
|
+
options: validationOptions,
|
|
39
|
+
validator: {
|
|
40
|
+
validate: (x) => (0, util_1.isE164PhoneNumber)(x, true),
|
|
41
|
+
defaultMessage(args) {
|
|
42
|
+
return `"${args.value}" is not an E164PhoneNumber or has an invalid extension.`;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
exports.IsE164PhoneNumberWithOptionalExtension = IsE164PhoneNumberWithOptionalExtension;
|
|
49
|
+
/**
|
|
50
|
+
* isE164PhoneNumberWithExtension validator
|
|
51
|
+
*
|
|
52
|
+
* @param validationOptions
|
|
53
|
+
* @returns
|
|
54
|
+
*/
|
|
55
|
+
function IsE164PhoneNumberWithExtension(validationOptions) {
|
|
56
|
+
return function (object, propertyName) {
|
|
57
|
+
(0, class_validator_1.registerDecorator)({
|
|
58
|
+
name: 'isE164PhoneNumberWithExtension',
|
|
59
|
+
target: object.constructor,
|
|
60
|
+
propertyName: propertyName,
|
|
61
|
+
options: validationOptions,
|
|
62
|
+
validator: {
|
|
63
|
+
validate: util_1.isE164PhoneNumberWithExtension,
|
|
64
|
+
defaultMessage(args) {
|
|
65
|
+
return `"${args.value}" is not a E164PhoneNumberWithExtension.`;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
exports.IsE164PhoneNumberWithExtension = IsE164PhoneNumberWithExtension;
|
|
72
|
+
//# sourceMappingURL=phone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phone.js","sourceRoot":"","sources":["../../../../../../packages/model/src/lib/validator/phone.ts"],"names":[],"mappings":";;;AAAA,wCAA6H;AAC7H,qDAA4F;AAE5F;;GAEG;AACH,SAAgB,iBAAiB,CAAC,iBAAqC;IACrE,OAAO,UAAU,MAA6B,EAAE,YAAoB;QAClE,IAAA,mCAAiB,EAAC;YAChB,IAAI,EAAE,mBAAmB;YACzB,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,OAAO,EAAE,iBAAiB;YAC1B,SAAS,EAAE;gBACT,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,wBAAiB,EAAC,CAAC,EAAE,KAAK,CAAC;gBAC5C,cAAc,CAAC,IAAyB;oBACtC,OAAO,IAAI,IAAI,CAAC,KAAK,+CAA+C,CAAC;gBACvE,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAfD,8CAeC;AAED;;;;;GAKG;AACH,SAAgB,sCAAsC,CAAC,iBAAqC;IAC1F,OAAO,UAAU,MAA6B,EAAE,YAAoB;QAClE,IAAA,mCAAiB,EAAC;YAChB,IAAI,EAAE,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