@cryptexlabs/codex-nodejs-common 0.15.2 → 0.15.3
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/lib/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ValidatorConstraintInterface, ValidationArguments, ValidationOptions } from "class-validator";
|
|
2
2
|
export declare class IsValidPhoneTypeConstraint implements ValidatorConstraintInterface {
|
|
3
3
|
private readonly PHONE_TYPES;
|
|
4
|
-
validate(
|
|
4
|
+
validate(value: any, args: ValidationArguments): boolean;
|
|
5
5
|
defaultMessage(args: ValidationArguments): string;
|
|
6
6
|
}
|
|
7
7
|
export declare function IsValidPhoneType(validationOptions?: ValidationOptions): (object: any, propertyName: string) => void;
|
|
@@ -14,11 +14,11 @@ let IsValidPhoneTypeConstraint = class IsValidPhoneTypeConstraint {
|
|
|
14
14
|
constructor() {
|
|
15
15
|
this.PHONE_TYPES = Object.values(authf_data_model_1.PhoneTypeEnum);
|
|
16
16
|
}
|
|
17
|
-
validate(
|
|
18
|
-
return this.PHONE_TYPES.includes(
|
|
17
|
+
validate(value, args) {
|
|
18
|
+
return this.PHONE_TYPES.includes(value);
|
|
19
19
|
}
|
|
20
20
|
defaultMessage(args) {
|
|
21
|
-
return `"${args.value}" is not a valid
|
|
21
|
+
return `"${args.value}" is not a valid phone type. Choose one of the allowed phone types: ${this.PHONE_TYPES.join(",")}`;
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
exports.IsValidPhoneTypeConstraint = IsValidPhoneTypeConstraint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-valid-phone-type.js","sourceRoot":"","sources":["../../../src/decorator/is-valid-phone-type.ts"],"names":[],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"is-valid-phone-type.js","sourceRoot":"","sources":["../../../src/decorator/is-valid-phone-type.ts"],"names":[],"mappings":";;;;;;;;;AA2BA,4CAUC;AArCD,qDAMyB;AACzB,oEAA6E;AAGtE,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAAhC;QAEY,gBAAW,GAAa,MAAM,CAAC,MAAM,CAAC,gCAAa,CAAC,CAAC;IAaxE,CAAC;IAXC,QAAQ,CAAC,KAAU,EAAE,IAAyB;QAC5C,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED,cAAc,CAAC,IAAyB;QACtC,OAAO,IACL,IAAI,CAAC,KACP,uEAAuE,IAAI,CAAC,WAAW,CAAC,IAAI,CAC1F,GAAG,CACJ,EAAE,CAAC;IACN,CAAC;CACF,CAAA;AAfY,gEAA0B;qCAA1B,0BAA0B;IADtC,IAAA,qCAAmB,EAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;GACnD,0BAA0B,CAetC;AAED,SAAgB,gBAAgB,CAAC,iBAAqC;IACpE,OAAO,CAAC,MAAW,EAAE,YAAoB,EAAE,EAAE;QAC3C,IAAA,mCAAiB,EAAC;YAChB,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY;YACZ,OAAO,EAAE,iBAAiB;YAC1B,WAAW,EAAE,EAAE;YACf,SAAS,EAAE,0BAA0B;SACtC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -12,12 +12,16 @@ export class IsValidPhoneTypeConstraint
|
|
|
12
12
|
implements ValidatorConstraintInterface {
|
|
13
13
|
private readonly PHONE_TYPES: string[] = Object.values(PhoneTypeEnum);
|
|
14
14
|
|
|
15
|
-
validate(
|
|
16
|
-
return this.PHONE_TYPES.includes(
|
|
15
|
+
validate(value: any, args: ValidationArguments): boolean {
|
|
16
|
+
return this.PHONE_TYPES.includes(value);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
defaultMessage(args: ValidationArguments): string {
|
|
20
|
-
return `"${
|
|
20
|
+
return `"${
|
|
21
|
+
args.value
|
|
22
|
+
}" is not a valid phone type. Choose one of the allowed phone types: ${this.PHONE_TYPES.join(
|
|
23
|
+
","
|
|
24
|
+
)}`;
|
|
21
25
|
}
|
|
22
26
|
}
|
|
23
27
|
|