@decaf-ts/decorator-validation 1.14.0 → 1.16.0
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/cjs/constants/errors.cjs +1 -0
- package/lib/cjs/constants/errors.cjs.map +1 -0
- package/lib/cjs/constants/index.cjs +1 -0
- package/lib/cjs/constants/index.cjs.map +1 -0
- package/lib/cjs/constants/validation.cjs +1 -0
- package/lib/cjs/constants/validation.cjs.map +1 -0
- package/lib/cjs/index.cjs +2 -1
- package/lib/cjs/index.cjs.map +1 -0
- package/lib/cjs/model/Builder.cjs +49 -48
- package/lib/cjs/model/Builder.cjs.map +1 -0
- package/lib/cjs/model/Model.cjs +31 -30
- package/lib/cjs/model/Model.cjs.map +1 -0
- package/lib/cjs/model/ModelErrorDefinition.cjs +1 -0
- package/lib/cjs/model/ModelErrorDefinition.cjs.map +1 -0
- package/lib/cjs/model/ModelRegistry.cjs +7 -6
- package/lib/cjs/model/ModelRegistry.cjs.map +1 -0
- package/lib/cjs/model/constants.cjs +2 -13
- package/lib/cjs/model/constants.cjs.map +1 -0
- package/lib/cjs/model/construction.cjs +5 -4
- package/lib/cjs/model/construction.cjs.map +1 -0
- package/lib/cjs/model/decorators.cjs +12 -11
- package/lib/cjs/model/decorators.cjs.map +1 -0
- package/lib/cjs/model/index.cjs +1 -0
- package/lib/cjs/model/index.cjs.map +1 -0
- package/lib/cjs/model/types.cjs +1 -0
- package/lib/cjs/model/types.cjs.map +1 -0
- package/lib/cjs/model/utils.cjs +1 -0
- package/lib/cjs/model/utils.cjs.map +1 -0
- package/lib/cjs/model/validation.cjs +33 -32
- package/lib/cjs/model/validation.cjs.map +1 -0
- package/lib/cjs/overrides/Metadata.cjs +1 -0
- package/lib/cjs/overrides/Metadata.cjs.map +1 -0
- package/lib/cjs/overrides/index.cjs +1 -0
- package/lib/cjs/overrides/index.cjs.map +1 -0
- package/lib/cjs/overrides/overrides.cjs +20 -19
- package/lib/cjs/overrides/overrides.cjs.map +1 -0
- package/lib/cjs/overrides/types.cjs +1 -0
- package/lib/cjs/overrides/types.cjs.map +1 -0
- package/lib/cjs/types/index.cjs +1 -0
- package/lib/cjs/types/index.cjs.map +1 -0
- package/lib/cjs/types/validation.cjs +1 -0
- package/lib/cjs/types/{validation.js.map → validation.cjs.map} +1 -1
- package/lib/cjs/utils/DateBuilder.cjs +1 -0
- package/lib/cjs/utils/DateBuilder.cjs.map +1 -0
- package/lib/cjs/utils/PathProxy.cjs +9 -8
- package/lib/cjs/utils/PathProxy.cjs.map +1 -0
- package/lib/cjs/utils/constants.cjs +2 -21
- package/lib/cjs/utils/constants.cjs.map +1 -0
- package/lib/cjs/utils/dates.cjs +9 -8
- package/lib/cjs/utils/dates.cjs.map +1 -0
- package/lib/cjs/utils/equality.cjs +1 -0
- package/lib/cjs/utils/equality.cjs.map +1 -0
- package/lib/cjs/utils/hashing.cjs +6 -3
- package/lib/cjs/utils/hashing.cjs.map +1 -0
- package/lib/cjs/utils/index.cjs +1 -0
- package/lib/cjs/utils/index.cjs.map +1 -0
- package/lib/cjs/utils/registry.cjs +1 -0
- package/lib/cjs/utils/registry.cjs.map +1 -0
- package/lib/cjs/utils/serialization.cjs +3 -2
- package/lib/cjs/utils/serialization.cjs.map +1 -0
- package/lib/cjs/utils/serializers.cjs +8 -7
- package/lib/cjs/utils/serializers.cjs.map +1 -0
- package/lib/cjs/utils/strings.cjs +1 -0
- package/lib/cjs/utils/strings.cjs.map +1 -0
- package/lib/cjs/utils/types.cjs +1 -0
- package/lib/cjs/utils/types.cjs.map +1 -0
- package/lib/cjs/validation/Validation.cjs +9 -8
- package/lib/cjs/validation/Validation.cjs.map +1 -0
- package/lib/cjs/validation/Validators/AsyncValidator.cjs +5 -4
- package/lib/cjs/validation/Validators/AsyncValidator.cjs.map +1 -0
- package/lib/cjs/validation/Validators/BaseValidator.cjs +8 -7
- package/lib/cjs/validation/Validators/BaseValidator.cjs.map +1 -0
- package/lib/cjs/validation/Validators/DateValidator.cjs +17 -11
- package/lib/cjs/validation/Validators/DateValidator.cjs.map +1 -0
- package/lib/cjs/validation/Validators/DiffValidator.cjs +21 -15
- package/lib/cjs/validation/Validators/DiffValidator.cjs.map +1 -0
- package/lib/cjs/validation/Validators/EmailValidator.cjs +18 -12
- package/lib/cjs/validation/Validators/EmailValidator.cjs.map +1 -0
- package/lib/cjs/validation/Validators/EqualsValidator.cjs +21 -15
- package/lib/cjs/validation/Validators/EqualsValidator.cjs.map +1 -0
- package/lib/cjs/validation/Validators/GreaterThanOrEqualValidator.cjs +24 -18
- package/lib/cjs/validation/Validators/GreaterThanOrEqualValidator.cjs.map +1 -0
- package/lib/cjs/validation/Validators/GreaterThanValidator.cjs +21 -15
- package/lib/cjs/validation/Validators/GreaterThanValidator.cjs.map +1 -0
- package/lib/cjs/validation/Validators/LessThanOrEqualValidator.cjs +24 -18
- package/lib/cjs/validation/Validators/LessThanOrEqualValidator.cjs.map +1 -0
- package/lib/cjs/validation/Validators/LessThanValidator.cjs +21 -15
- package/lib/cjs/validation/Validators/LessThanValidator.cjs.map +1 -0
- package/lib/cjs/validation/Validators/ListValidator.cjs +17 -11
- package/lib/cjs/validation/Validators/ListValidator.cjs.map +1 -0
- package/lib/cjs/validation/Validators/MaxLengthValidator.cjs +19 -13
- package/lib/cjs/validation/Validators/MaxLengthValidator.cjs.map +1 -0
- package/lib/cjs/validation/Validators/MaxValidator.cjs +17 -11
- package/lib/cjs/validation/Validators/MaxValidator.cjs.map +1 -0
- package/lib/cjs/validation/Validators/MinLengthValidator.cjs +19 -13
- package/lib/cjs/validation/Validators/MinLengthValidator.cjs.map +1 -0
- package/lib/cjs/validation/Validators/MinValidator.cjs +17 -11
- package/lib/cjs/validation/Validators/MinValidator.cjs.map +1 -0
- package/lib/cjs/validation/Validators/OptionValidator.cjs +17 -11
- package/lib/cjs/validation/Validators/OptionValidator.cjs.map +1 -0
- package/lib/cjs/validation/Validators/PasswordValidator.cjs +18 -12
- package/lib/cjs/validation/Validators/PasswordValidator.cjs.map +1 -0
- package/lib/cjs/validation/Validators/PatternValidator.cjs +17 -11
- package/lib/cjs/validation/Validators/PatternValidator.cjs.map +1 -0
- package/lib/cjs/validation/Validators/RequiredValidator.cjs +17 -11
- package/lib/cjs/validation/Validators/RequiredValidator.cjs.map +1 -0
- package/lib/cjs/validation/Validators/StepValidator.cjs +17 -11
- package/lib/cjs/validation/Validators/StepValidator.cjs.map +1 -0
- package/lib/cjs/validation/Validators/TypeValidator.cjs +23 -17
- package/lib/cjs/validation/Validators/TypeValidator.cjs.map +1 -0
- package/lib/cjs/validation/Validators/URLValidator.cjs +18 -12
- package/lib/cjs/validation/Validators/URLValidator.cjs.map +1 -0
- package/lib/cjs/validation/Validators/Validator.cjs +5 -4
- package/lib/cjs/validation/Validators/Validator.cjs.map +1 -0
- package/lib/cjs/validation/Validators/ValidatorRegistry.cjs +4 -3
- package/lib/cjs/validation/Validators/ValidatorRegistry.cjs.map +1 -0
- package/lib/cjs/validation/Validators/constants.cjs +3 -2
- package/lib/cjs/validation/Validators/constants.cjs.map +1 -0
- package/lib/cjs/validation/Validators/decorators.cjs +5 -4
- package/lib/cjs/validation/Validators/decorators.cjs.map +1 -0
- package/lib/cjs/validation/Validators/index.cjs +1 -0
- package/lib/cjs/validation/Validators/index.cjs.map +1 -0
- package/lib/cjs/validation/Validators/utils.cjs +14 -13
- package/lib/cjs/validation/Validators/utils.cjs.map +1 -0
- package/lib/cjs/validation/decorators.cjs +70 -69
- package/lib/cjs/validation/decorators.cjs.map +1 -0
- package/lib/cjs/validation/index.cjs +1 -0
- package/lib/cjs/validation/index.cjs.map +1 -0
- package/lib/cjs/validation/types.cjs +2 -1
- package/lib/cjs/validation/types.cjs.map +1 -0
- package/lib/esm/index.js +1 -1
- package/lib/types/constants/errors.d.cts +17 -0
- package/lib/types/constants/errors.d.mts +17 -0
- package/lib/types/constants/index.d.cts +2 -0
- package/lib/types/constants/index.d.mts +2 -0
- package/lib/types/constants/validation.d.cts +16 -0
- package/lib/types/constants/validation.d.mts +16 -0
- package/lib/types/index.d.cts +20 -0
- package/lib/types/index.d.mts +20 -0
- package/lib/types/index.d.ts +1 -1
- package/lib/types/model/Builder.d.cts +86 -0
- package/lib/types/model/Builder.d.mts +86 -0
- package/lib/types/model/Model.d.cts +286 -0
- package/lib/types/model/Model.d.mts +286 -0
- package/lib/types/model/ModelErrorDefinition.d.cts +22 -0
- package/lib/types/model/ModelErrorDefinition.d.mts +22 -0
- package/lib/types/model/ModelRegistry.d.cts +181 -0
- package/lib/types/model/ModelRegistry.d.mts +181 -0
- package/lib/types/model/constants.d.cts +65 -0
- package/lib/types/model/constants.d.mts +65 -0
- package/lib/types/model/construction.d.cts +46 -0
- package/lib/types/model/construction.d.mts +46 -0
- package/lib/types/model/decorators.d.cts +47 -0
- package/lib/types/model/decorators.d.mts +47 -0
- package/lib/types/model/index.d.cts +10 -0
- package/lib/types/model/index.d.mts +10 -0
- package/lib/types/model/types.d.cts +145 -0
- package/lib/types/model/types.d.mts +145 -0
- package/lib/types/model/utils.d.cts +13 -0
- package/lib/types/model/utils.d.mts +13 -0
- package/lib/types/model/validation.d.cts +92 -0
- package/lib/types/model/validation.d.mts +92 -0
- package/lib/types/overrides/Metadata.d.cts +132 -0
- package/lib/types/overrides/Metadata.d.mts +132 -0
- package/lib/types/overrides/index.d.cts +4 -0
- package/lib/types/overrides/index.d.mts +4 -0
- package/lib/types/overrides/overrides.d.cts +1 -0
- package/lib/types/overrides/overrides.d.mts +1 -0
- package/lib/types/overrides/types.d.cts +17 -0
- package/lib/types/overrides/types.d.mts +17 -0
- package/lib/types/types/index.d.cts +1 -0
- package/lib/types/types/index.d.mts +1 -0
- package/lib/types/types/validation.d.cts +28 -0
- package/lib/types/types/validation.d.mts +28 -0
- package/lib/types/utils/DateBuilder.d.cts +121 -0
- package/lib/types/utils/DateBuilder.d.mts +121 -0
- package/lib/types/utils/PathProxy.d.cts +43 -0
- package/lib/types/utils/PathProxy.d.mts +43 -0
- package/lib/types/utils/constants.d.cts +32 -0
- package/lib/types/utils/constants.d.mts +32 -0
- package/lib/types/utils/dates.d.cts +86 -0
- package/lib/types/utils/dates.d.mts +86 -0
- package/lib/types/utils/equality.d.cts +56 -0
- package/lib/types/utils/equality.d.mts +56 -0
- package/lib/types/utils/hashing.d.cts +82 -0
- package/lib/types/utils/hashing.d.mts +82 -0
- package/lib/types/utils/index.d.cts +11 -0
- package/lib/types/utils/index.d.mts +11 -0
- package/lib/types/utils/registry.d.cts +68 -0
- package/lib/types/utils/registry.d.mts +68 -0
- package/lib/types/utils/serialization.d.cts +12 -0
- package/lib/types/utils/serialization.d.mts +12 -0
- package/lib/types/utils/serializers.d.cts +41 -0
- package/lib/types/utils/serializers.d.mts +41 -0
- package/lib/types/utils/strings.d.cts +25 -0
- package/lib/types/utils/strings.d.mts +25 -0
- package/lib/types/utils/types.d.cts +35 -0
- package/lib/types/utils/types.d.mts +35 -0
- package/lib/types/validation/Validation.d.cts +53 -0
- package/lib/types/validation/Validation.d.mts +53 -0
- package/lib/types/validation/Validators/AsyncValidator.d.cts +72 -0
- package/lib/types/validation/Validators/AsyncValidator.d.mts +72 -0
- package/lib/types/validation/Validators/BaseValidator.d.cts +118 -0
- package/lib/types/validation/Validators/BaseValidator.d.mts +118 -0
- package/lib/types/validation/Validators/DateValidator.d.cts +60 -0
- package/lib/types/validation/Validators/DateValidator.d.mts +60 -0
- package/lib/types/validation/Validators/DiffValidator.d.cts +29 -0
- package/lib/types/validation/Validators/DiffValidator.d.mts +29 -0
- package/lib/types/validation/Validators/EmailValidator.d.cts +60 -0
- package/lib/types/validation/Validators/EmailValidator.d.mts +60 -0
- package/lib/types/validation/Validators/EqualsValidator.d.cts +29 -0
- package/lib/types/validation/Validators/EqualsValidator.d.mts +29 -0
- package/lib/types/validation/Validators/GreaterThanOrEqualValidator.d.cts +29 -0
- package/lib/types/validation/Validators/GreaterThanOrEqualValidator.d.mts +29 -0
- package/lib/types/validation/Validators/GreaterThanValidator.d.cts +29 -0
- package/lib/types/validation/Validators/GreaterThanValidator.d.mts +29 -0
- package/lib/types/validation/Validators/LessThanOrEqualValidator.d.cts +29 -0
- package/lib/types/validation/Validators/LessThanOrEqualValidator.d.mts +29 -0
- package/lib/types/validation/Validators/LessThanValidator.d.cts +29 -0
- package/lib/types/validation/Validators/LessThanValidator.d.mts +29 -0
- package/lib/types/validation/Validators/ListValidator.d.cts +66 -0
- package/lib/types/validation/Validators/ListValidator.d.mts +66 -0
- package/lib/types/validation/Validators/MaxLengthValidator.d.cts +29 -0
- package/lib/types/validation/Validators/MaxLengthValidator.d.mts +29 -0
- package/lib/types/validation/Validators/MaxValidator.d.cts +74 -0
- package/lib/types/validation/Validators/MaxValidator.d.mts +74 -0
- package/lib/types/validation/Validators/MinLengthValidator.d.cts +29 -0
- package/lib/types/validation/Validators/MinLengthValidator.d.mts +29 -0
- package/lib/types/validation/Validators/MinValidator.d.cts +74 -0
- package/lib/types/validation/Validators/MinValidator.d.mts +74 -0
- package/lib/types/validation/Validators/OptionValidator.d.cts +29 -0
- package/lib/types/validation/Validators/OptionValidator.d.mts +29 -0
- package/lib/types/validation/Validators/PasswordValidator.d.cts +28 -0
- package/lib/types/validation/Validators/PasswordValidator.d.mts +28 -0
- package/lib/types/validation/Validators/PatternValidator.d.cts +103 -0
- package/lib/types/validation/Validators/PatternValidator.d.mts +103 -0
- package/lib/types/validation/Validators/RequiredValidator.d.cts +74 -0
- package/lib/types/validation/Validators/RequiredValidator.d.mts +74 -0
- package/lib/types/validation/Validators/StepValidator.d.cts +29 -0
- package/lib/types/validation/Validators/StepValidator.d.mts +29 -0
- package/lib/types/validation/Validators/TypeValidator.d.cts +79 -0
- package/lib/types/validation/Validators/TypeValidator.d.mts +79 -0
- package/lib/types/validation/Validators/URLValidator.d.cts +61 -0
- package/lib/types/validation/Validators/URLValidator.d.mts +61 -0
- package/lib/types/validation/Validators/Validator.d.cts +65 -0
- package/lib/types/validation/Validators/Validator.d.mts +65 -0
- package/lib/types/validation/Validators/ValidatorRegistry.d.cts +41 -0
- package/lib/types/validation/Validators/ValidatorRegistry.d.mts +41 -0
- package/lib/types/validation/Validators/constants.d.cts +157 -0
- package/lib/types/validation/Validators/constants.d.mts +157 -0
- package/lib/types/validation/Validators/decorators.d.cts +12 -0
- package/lib/types/validation/Validators/decorators.d.mts +12 -0
- package/lib/types/validation/Validators/index.d.cts +26 -0
- package/lib/types/validation/Validators/index.d.mts +26 -0
- package/lib/types/validation/Validators/utils.d.cts +75 -0
- package/lib/types/validation/Validators/utils.d.mts +75 -0
- package/lib/types/validation/decorators.d.cts +313 -0
- package/lib/types/validation/decorators.d.mts +313 -0
- package/lib/types/validation/index.d.cts +9 -0
- package/lib/types/validation/index.d.mts +9 -0
- package/lib/types/validation/types.d.cts +309 -0
- package/lib/types/validation/types.d.mts +309 -0
- package/package.json +1 -1
- package/lib/cjs/constants/errors.js.map +0 -1
- package/lib/cjs/constants/index.js.map +0 -1
- package/lib/cjs/constants/validation.js.map +0 -1
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/model/Builder.js.map +0 -1
- package/lib/cjs/model/Model.js.map +0 -1
- package/lib/cjs/model/ModelErrorDefinition.js.map +0 -1
- package/lib/cjs/model/ModelRegistry.js.map +0 -1
- package/lib/cjs/model/constants.js.map +0 -1
- package/lib/cjs/model/construction.js.map +0 -1
- package/lib/cjs/model/decorators.js.map +0 -1
- package/lib/cjs/model/index.js.map +0 -1
- package/lib/cjs/model/types.js.map +0 -1
- package/lib/cjs/model/utils.js.map +0 -1
- package/lib/cjs/model/validation.js.map +0 -1
- package/lib/cjs/overrides/Metadata.js.map +0 -1
- package/lib/cjs/overrides/index.js.map +0 -1
- package/lib/cjs/overrides/overrides.js.map +0 -1
- package/lib/cjs/overrides/types.js.map +0 -1
- package/lib/cjs/types/index.js.map +0 -1
- package/lib/cjs/utils/DateBuilder.js.map +0 -1
- package/lib/cjs/utils/PathProxy.js.map +0 -1
- package/lib/cjs/utils/constants.js.map +0 -1
- package/lib/cjs/utils/dates.js.map +0 -1
- package/lib/cjs/utils/equality.js.map +0 -1
- package/lib/cjs/utils/hashing.js.map +0 -1
- package/lib/cjs/utils/index.js.map +0 -1
- package/lib/cjs/utils/registry.js.map +0 -1
- package/lib/cjs/utils/serialization.js.map +0 -1
- package/lib/cjs/utils/serializers.js.map +0 -1
- package/lib/cjs/utils/strings.js.map +0 -1
- package/lib/cjs/utils/types.js.map +0 -1
- package/lib/cjs/validation/Validation.js.map +0 -1
- package/lib/cjs/validation/Validators/AsyncValidator.js.map +0 -1
- package/lib/cjs/validation/Validators/BaseValidator.js.map +0 -1
- package/lib/cjs/validation/Validators/DateValidator.js.map +0 -1
- package/lib/cjs/validation/Validators/DiffValidator.js.map +0 -1
- package/lib/cjs/validation/Validators/EmailValidator.js.map +0 -1
- package/lib/cjs/validation/Validators/EqualsValidator.js.map +0 -1
- package/lib/cjs/validation/Validators/GreaterThanOrEqualValidator.js.map +0 -1
- package/lib/cjs/validation/Validators/GreaterThanValidator.js.map +0 -1
- package/lib/cjs/validation/Validators/LessThanOrEqualValidator.js.map +0 -1
- package/lib/cjs/validation/Validators/LessThanValidator.js.map +0 -1
- package/lib/cjs/validation/Validators/ListValidator.js.map +0 -1
- package/lib/cjs/validation/Validators/MaxLengthValidator.js.map +0 -1
- package/lib/cjs/validation/Validators/MaxValidator.js.map +0 -1
- package/lib/cjs/validation/Validators/MinLengthValidator.js.map +0 -1
- package/lib/cjs/validation/Validators/MinValidator.js.map +0 -1
- package/lib/cjs/validation/Validators/OptionValidator.js.map +0 -1
- package/lib/cjs/validation/Validators/PasswordValidator.js.map +0 -1
- package/lib/cjs/validation/Validators/PatternValidator.js.map +0 -1
- package/lib/cjs/validation/Validators/RequiredValidator.js.map +0 -1
- package/lib/cjs/validation/Validators/StepValidator.js.map +0 -1
- package/lib/cjs/validation/Validators/TypeValidator.js.map +0 -1
- package/lib/cjs/validation/Validators/URLValidator.js.map +0 -1
- package/lib/cjs/validation/Validators/Validator.js.map +0 -1
- package/lib/cjs/validation/Validators/ValidatorRegistry.js.map +0 -1
- package/lib/cjs/validation/Validators/constants.js.map +0 -1
- package/lib/cjs/validation/Validators/decorators.js.map +0 -1
- package/lib/cjs/validation/Validators/index.js.map +0 -1
- package/lib/cjs/validation/Validators/utils.js.map +0 -1
- package/lib/cjs/validation/decorators.js.map +0 -1
- package/lib/cjs/validation/index.js.map +0 -1
- package/lib/cjs/validation/types.js.map +0 -1
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Object-like set of keys used for comparison-based validations.
|
|
3
|
+
* @summary Provides canonical names for validators that compare two values (equality and ordering checks).
|
|
4
|
+
* @typedef {Object} ComparisonValidationKeysDef
|
|
5
|
+
* @property {"equals"} EQUALS Validates if two values are equal.
|
|
6
|
+
* @property {"different"} DIFF Validates if two values are different.
|
|
7
|
+
* @property {"lessThan"} LESS_THAN Validates if a value is less than another.
|
|
8
|
+
* @property {"lessThanOrEqual"} LESS_THAN_OR_EQUAL Validates if a value is less than or equal to another.
|
|
9
|
+
* @property {"greaterThan"} GREATER_THAN Validates if a value is greater than another.
|
|
10
|
+
* @property {"greaterThanOrEqual"} GREATER_THAN_OR_EQUAL Validates if a value is greater than or equal to another.
|
|
11
|
+
* @memberOf module:decorator-validation.Validation
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* @description Keys used for comparison-based validations.
|
|
15
|
+
* @summary Canonical key names for comparison validators.
|
|
16
|
+
* @const ComparisonValidationKeys
|
|
17
|
+
* @memberOf module:decorator-validation.Validation
|
|
18
|
+
* @category Validation
|
|
19
|
+
* @type {ComparisonValidationKeysDef}
|
|
20
|
+
*/
|
|
21
|
+
export declare const ComparisonValidationKeys: {
|
|
22
|
+
readonly EQUALS: "equals";
|
|
23
|
+
readonly DIFF: "different";
|
|
24
|
+
readonly LESS_THAN: "lessThan";
|
|
25
|
+
readonly LESS_THAN_OR_EQUAL: "lessThanOrEqual";
|
|
26
|
+
readonly GREATER_THAN: "greaterThan";
|
|
27
|
+
readonly GREATER_THAN_OR_EQUAL: "greaterThanOrEqual";
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* @description Object-like set of keys used across all validators in the system.
|
|
31
|
+
* @summary Defines the canonical namespaced key prefix and the individual validation flags for rules such as required, min/max, length, patterns, types, lists and more.
|
|
32
|
+
* @typedef {Object} ValidationKeysDef
|
|
33
|
+
* @property {string} REFLECT prefixes others (namespace prefix)
|
|
34
|
+
* @property {"required"} REQUIRED sets as required
|
|
35
|
+
* @property {"min"} MIN defines min value
|
|
36
|
+
* @property {"max"} MAX defines max value
|
|
37
|
+
* @property {"step"} STEP defines step
|
|
38
|
+
* @property {"minlength"} MIN_LENGTH defines min length
|
|
39
|
+
* @property {"maxlength"} MAX_LENGTH defines max length
|
|
40
|
+
* @property {"pattern"} PATTERN defines pattern
|
|
41
|
+
* @property {"email"} EMAIL defines email
|
|
42
|
+
* @property {"url"} URL defines url
|
|
43
|
+
* @property {"date"} DATE defines date
|
|
44
|
+
* @property {"type"} TYPE defines type
|
|
45
|
+
* @property {"password"} PASSWORD defines password
|
|
46
|
+
* @property {"list"} LIST defines list
|
|
47
|
+
* @property {"unique"} UNIQUE flags uniqueness
|
|
48
|
+
* @property {"validator"} VALIDATOR custom validator id
|
|
49
|
+
* @memberOf module:decorator-validation.Validation
|
|
50
|
+
*/
|
|
51
|
+
/**
|
|
52
|
+
* @description The keys used for validation.
|
|
53
|
+
* @summary A namespaced collection of validation key strings used throughout the library.
|
|
54
|
+
* @const ValidationKeys
|
|
55
|
+
* @memberOf module:decorator-validation.Validation
|
|
56
|
+
* @category Validation
|
|
57
|
+
* @type {ValidationKeysDef}
|
|
58
|
+
*/
|
|
59
|
+
export declare const ValidationKeys: {
|
|
60
|
+
readonly EQUALS: "equals";
|
|
61
|
+
readonly DIFF: "different";
|
|
62
|
+
readonly LESS_THAN: "lessThan";
|
|
63
|
+
readonly LESS_THAN_OR_EQUAL: "lessThanOrEqual";
|
|
64
|
+
readonly GREATER_THAN: "greaterThan";
|
|
65
|
+
readonly GREATER_THAN_OR_EQUAL: "greaterThanOrEqual";
|
|
66
|
+
readonly REFLECT: "validation";
|
|
67
|
+
readonly DATE: "date";
|
|
68
|
+
readonly EMAIL: "email";
|
|
69
|
+
readonly FORMAT: "format";
|
|
70
|
+
readonly LIST: "list";
|
|
71
|
+
readonly MAX: "max";
|
|
72
|
+
readonly MAX_LENGTH: "maxlength";
|
|
73
|
+
readonly MIN: "min";
|
|
74
|
+
readonly MIN_LENGTH: "minlength";
|
|
75
|
+
readonly PASSWORD: "password";
|
|
76
|
+
readonly PATTERN: "pattern";
|
|
77
|
+
readonly REQUIRED: "required";
|
|
78
|
+
readonly STEP: "step";
|
|
79
|
+
readonly TYPE: "type";
|
|
80
|
+
readonly UNIQUE: "unique";
|
|
81
|
+
readonly URL: "url";
|
|
82
|
+
readonly VALIDATOR: "validator";
|
|
83
|
+
readonly ENUM: "enum";
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* @description list of month names
|
|
87
|
+
* @summary Stores month names. Can be changed for localization purposes
|
|
88
|
+
* @const MONTH_NAMES
|
|
89
|
+
* @memberOf module:decorator-validation.Validation
|
|
90
|
+
* @category Validation
|
|
91
|
+
*/
|
|
92
|
+
export declare const MONTH_NAMES: string[];
|
|
93
|
+
/**
|
|
94
|
+
* @description list of names of days of the week
|
|
95
|
+
* @summary Stores names for days of the week. Can be changed for localization purposes
|
|
96
|
+
* @const DAYS_OF_WEEK_NAMES
|
|
97
|
+
* @memberOf module:decorator-validation.Validation
|
|
98
|
+
* @category Validation
|
|
99
|
+
*/
|
|
100
|
+
export declare const DAYS_OF_WEEK_NAMES: string[];
|
|
101
|
+
/**
|
|
102
|
+
* @description Type definition for default error message strings keyed by validation type.
|
|
103
|
+
* @summary Enumerates the supported error message keys with their intended meaning; used to localize or override default messages.
|
|
104
|
+
* @typedef {Object} DefaultErrorMessages
|
|
105
|
+
* @property {string} REQUIRED default error message
|
|
106
|
+
* @property {string} MIN default error message
|
|
107
|
+
* @property {string} MAX default error message
|
|
108
|
+
* @property {string} MIN_LENGTH default error message
|
|
109
|
+
* @property {string} MAX_LENGTH default error message
|
|
110
|
+
* @property {string} PATTERN default error message
|
|
111
|
+
* @property {string} EMAIL default error message
|
|
112
|
+
* @property {string} URL default error message
|
|
113
|
+
* @property {string} TYPE default error message
|
|
114
|
+
* @property {string} STEP default error message
|
|
115
|
+
* @property {string} DATE default error message
|
|
116
|
+
* @property {string} DEFAULT default error message
|
|
117
|
+
* @property {string} PASSWORD default error message
|
|
118
|
+
* @property {string} LIST default error message
|
|
119
|
+
* @property {string} LIST_INSIDE default error message
|
|
120
|
+
* @property {string} MODEL_NOT_FOUND default error message
|
|
121
|
+
* @memberOf module:decorator-validation.Validation
|
|
122
|
+
*/
|
|
123
|
+
/**
|
|
124
|
+
* @description Defines the default error messages
|
|
125
|
+
* @summary Mapping between validation keys and their default human-readable error messages.
|
|
126
|
+
* @const DEFAULT_ERROR_MESSAGES
|
|
127
|
+
* @memberOf module:decorator-validation.Validation
|
|
128
|
+
* @category Validation
|
|
129
|
+
* @type {DefaultErrorMessages}
|
|
130
|
+
*/
|
|
131
|
+
export declare const DEFAULT_ERROR_MESSAGES: Record<string, string>;
|
|
132
|
+
/**
|
|
133
|
+
* @description Type definition for default regular expression patterns used in validation.
|
|
134
|
+
* @summary Captures common regex patterns for email, URL, and password policies, including nested grouping for password-related rules.
|
|
135
|
+
* @typedef {Object} DefaultPatterns
|
|
136
|
+
* @property {RegExp} EMAIL Email address validation pattern
|
|
137
|
+
* @property {RegExp} URL URL validation pattern
|
|
138
|
+
* @property {Object} PASSWORD Password-related regex patterns
|
|
139
|
+
* @property {RegExp} PASSWORD.CHAR8_ONE_OF_EACH At least 8 chars with lower, upper, number, and special char
|
|
140
|
+
* @memberOf module:decorator-validation.Validation
|
|
141
|
+
*/
|
|
142
|
+
/**
|
|
143
|
+
* @description Defines the various default regexp patterns used
|
|
144
|
+
* @summary Collection of frequently used validation patterns grouped under semantic keys.
|
|
145
|
+
* @const DEFAULT_PATTERNS
|
|
146
|
+
* @memberOf module:decorator-validation.Validation
|
|
147
|
+
* @category Validation
|
|
148
|
+
* @type {DefaultPatterns}
|
|
149
|
+
*/
|
|
150
|
+
export declare const DEFAULT_PATTERNS: {
|
|
151
|
+
EMAIL: RegExp;
|
|
152
|
+
URL: RegExp;
|
|
153
|
+
PASSWORD: {
|
|
154
|
+
CHAR8_ONE_OF_EACH: RegExp;
|
|
155
|
+
};
|
|
156
|
+
asd: string;
|
|
157
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Validator } from "./Validator.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* @summary Marks the class as a validator for a certain key.
|
|
4
|
+
* @description Registers the class in the {@link Validation} with the provided key
|
|
5
|
+
*
|
|
6
|
+
* @param {string} keys the validation key
|
|
7
|
+
*
|
|
8
|
+
* @function validator
|
|
9
|
+
*
|
|
10
|
+
* @category Class Decorators
|
|
11
|
+
*/
|
|
12
|
+
export declare function validator<T extends Validator>(...keys: string[]): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor | number) => void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Validator } from "./Validator.js";
|
|
2
|
+
/**
|
|
3
|
+
* @summary Marks the class as a validator for a certain key.
|
|
4
|
+
* @description Registers the class in the {@link Validation} with the provided key
|
|
5
|
+
*
|
|
6
|
+
* @param {string} keys the validation key
|
|
7
|
+
*
|
|
8
|
+
* @function validator
|
|
9
|
+
*
|
|
10
|
+
* @category Class Decorators
|
|
11
|
+
*/
|
|
12
|
+
export declare function validator<T extends Validator>(...keys: string[]): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor | number) => void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export * from "./constants.cjs";
|
|
2
|
+
export * from "./AsyncValidator.cjs";
|
|
3
|
+
export * from "./DateValidator.cjs";
|
|
4
|
+
export * from "./decorators.cjs";
|
|
5
|
+
export * from "./DiffValidator.cjs";
|
|
6
|
+
export * from "./EmailValidator.cjs";
|
|
7
|
+
export * from "./EqualsValidator.cjs";
|
|
8
|
+
export * from "./GreaterThanValidator.cjs";
|
|
9
|
+
export * from "./GreaterThanOrEqualValidator.cjs";
|
|
10
|
+
export * from "./LessThanValidator.cjs";
|
|
11
|
+
export * from "./LessThanOrEqualValidator.cjs";
|
|
12
|
+
export * from "./ListValidator.cjs";
|
|
13
|
+
export * from "./MaxLengthValidator.cjs";
|
|
14
|
+
export * from "./MaxValidator.cjs";
|
|
15
|
+
export * from "./MinLengthValidator.cjs";
|
|
16
|
+
export * from "./MinValidator.cjs";
|
|
17
|
+
export * from "./OptionValidator.cjs";
|
|
18
|
+
export * from "./PasswordValidator.cjs";
|
|
19
|
+
export * from "./PatternValidator.cjs";
|
|
20
|
+
export * from "./RequiredValidator.cjs";
|
|
21
|
+
export * from "./StepValidator.cjs";
|
|
22
|
+
export * from "./TypeValidator.cjs";
|
|
23
|
+
export * from "./URLValidator.cjs";
|
|
24
|
+
export * from "./Validator.cjs";
|
|
25
|
+
export * from "./ValidatorRegistry.cjs";
|
|
26
|
+
export * from "./utils.cjs";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export * from "./constants.js";
|
|
2
|
+
export * from "./AsyncValidator.js";
|
|
3
|
+
export * from "./DateValidator.js";
|
|
4
|
+
export * from "./decorators.js";
|
|
5
|
+
export * from "./DiffValidator.js";
|
|
6
|
+
export * from "./EmailValidator.js";
|
|
7
|
+
export * from "./EqualsValidator.js";
|
|
8
|
+
export * from "./GreaterThanValidator.js";
|
|
9
|
+
export * from "./GreaterThanOrEqualValidator.js";
|
|
10
|
+
export * from "./LessThanValidator.js";
|
|
11
|
+
export * from "./LessThanOrEqualValidator.js";
|
|
12
|
+
export * from "./ListValidator.js";
|
|
13
|
+
export * from "./MaxLengthValidator.js";
|
|
14
|
+
export * from "./MaxValidator.js";
|
|
15
|
+
export * from "./MinLengthValidator.js";
|
|
16
|
+
export * from "./MinValidator.js";
|
|
17
|
+
export * from "./OptionValidator.js";
|
|
18
|
+
export * from "./PasswordValidator.js";
|
|
19
|
+
export * from "./PatternValidator.js";
|
|
20
|
+
export * from "./RequiredValidator.js";
|
|
21
|
+
export * from "./StepValidator.js";
|
|
22
|
+
export * from "./TypeValidator.js";
|
|
23
|
+
export * from "./URLValidator.js";
|
|
24
|
+
export * from "./Validator.js";
|
|
25
|
+
export * from "./ValidatorRegistry.js";
|
|
26
|
+
export * from "./utils.js";
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates whether two values are eligible for comparison using >= or <= operators.
|
|
3
|
+
*
|
|
4
|
+
* Supported types: `undefined`, `number`, `bigint`, and `Date`.
|
|
5
|
+
*
|
|
6
|
+
* @param a - The first value to compare.
|
|
7
|
+
* @param b - The second value to compare.
|
|
8
|
+
*
|
|
9
|
+
* @returns {boolean} True if both values are of supported types.
|
|
10
|
+
*
|
|
11
|
+
* @throws {TypeError} If either value is of an unsupported type.
|
|
12
|
+
* @memberOf module:decorator-validation
|
|
13
|
+
*/
|
|
14
|
+
export declare function isValidForGteOrLteComparison(a: any, b: any): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* @summary Compares two values to determine if the first is less than the second.
|
|
17
|
+
* @description Supports numbers and dates. Throws an error for unsupported types.
|
|
18
|
+
*
|
|
19
|
+
* @param {any} a - The first value to compare.
|
|
20
|
+
* @param {any} b - The second value to compare against.
|
|
21
|
+
*
|
|
22
|
+
* @returns {boolean} True if `a` is less than `b`, false otherwise.
|
|
23
|
+
*
|
|
24
|
+
* @throws {Error} If either `a` or `b` is `null` or `undefined`.
|
|
25
|
+
* @throws {TypeError} If values are of mismatched or unsupported types.
|
|
26
|
+
* @memberOf module:decorator-validation
|
|
27
|
+
*/
|
|
28
|
+
export declare function isLessThan(a: any, b: any): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Checks if `a` is greater than `b`.
|
|
31
|
+
* Supports comparison for numbers and Date objects.
|
|
32
|
+
*
|
|
33
|
+
* @param {any} a - The value to validate.
|
|
34
|
+
* @param {any} b - The value to compare against.
|
|
35
|
+
*
|
|
36
|
+
* @returns {boolean} True if `a` is greater than `b`, otherwise false.
|
|
37
|
+
*
|
|
38
|
+
* @throws {Error} If either `a` or `b` is `null` or `undefined`.
|
|
39
|
+
* @throws {TypeError} If values are of mismatched or unsupported types.
|
|
40
|
+
* @memberOf module:decorator-validation
|
|
41
|
+
*/
|
|
42
|
+
export declare function isGreaterThan(a: any, b: any): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* @description Checks if a value matches a specified type name
|
|
45
|
+
* @summary Utility function to verify if a value's type matches the provided type name
|
|
46
|
+
* @param {unknown} value - The value to check the type of
|
|
47
|
+
* @param {string} acceptedType - The type name to check against
|
|
48
|
+
* @return {boolean} Returns true if the value matches the accepted type, false otherwise
|
|
49
|
+
*/
|
|
50
|
+
export declare function checkType(value: unknown, acceptedType: string): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* @description Checks if a value matches any of the specified type names
|
|
53
|
+
* @summary Utility function to verify if a value's type matches any of the provided type names
|
|
54
|
+
* @param {unknown} value - The value to check the type of
|
|
55
|
+
* @param {string[]} acceptedTypes - Array of type names to check against
|
|
56
|
+
* @return {boolean} Returns true if the value matches any of the accepted types, false otherwise
|
|
57
|
+
*/
|
|
58
|
+
export declare function checkTypes(value: unknown, acceptedTypes: string[]): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* @description Evaluates if a value matches the specified type metadata
|
|
61
|
+
* @summary Compares a value against type metadata to determine if they match
|
|
62
|
+
* @param {unknown} value - The value to evaluate
|
|
63
|
+
* @param {string | string[] | {name: string}} types - Type metadata to check against, can be a string, array of strings, or an object with a name property
|
|
64
|
+
* @return {boolean} Returns true if the value matches the type metadata, false otherwise
|
|
65
|
+
*/
|
|
66
|
+
export declare function evaluateDesignTypes(value: unknown, types: string | string[] | {
|
|
67
|
+
name: string;
|
|
68
|
+
}): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* @description Returns the length of a value
|
|
71
|
+
* @summary Returns the length of a value
|
|
72
|
+
* @param {string | Set<any> | any[] | Map<any, any>} value - The value to evaluate
|
|
73
|
+
* @return {number} Returns the length of a value
|
|
74
|
+
*/
|
|
75
|
+
export declare function valueLength(value: string | Set<any> | any[] | Map<any, any>): number;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates whether two values are eligible for comparison using >= or <= operators.
|
|
3
|
+
*
|
|
4
|
+
* Supported types: `undefined`, `number`, `bigint`, and `Date`.
|
|
5
|
+
*
|
|
6
|
+
* @param a - The first value to compare.
|
|
7
|
+
* @param b - The second value to compare.
|
|
8
|
+
*
|
|
9
|
+
* @returns {boolean} True if both values are of supported types.
|
|
10
|
+
*
|
|
11
|
+
* @throws {TypeError} If either value is of an unsupported type.
|
|
12
|
+
* @memberOf module:decorator-validation
|
|
13
|
+
*/
|
|
14
|
+
export declare function isValidForGteOrLteComparison(a: any, b: any): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* @summary Compares two values to determine if the first is less than the second.
|
|
17
|
+
* @description Supports numbers and dates. Throws an error for unsupported types.
|
|
18
|
+
*
|
|
19
|
+
* @param {any} a - The first value to compare.
|
|
20
|
+
* @param {any} b - The second value to compare against.
|
|
21
|
+
*
|
|
22
|
+
* @returns {boolean} True if `a` is less than `b`, false otherwise.
|
|
23
|
+
*
|
|
24
|
+
* @throws {Error} If either `a` or `b` is `null` or `undefined`.
|
|
25
|
+
* @throws {TypeError} If values are of mismatched or unsupported types.
|
|
26
|
+
* @memberOf module:decorator-validation
|
|
27
|
+
*/
|
|
28
|
+
export declare function isLessThan(a: any, b: any): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Checks if `a` is greater than `b`.
|
|
31
|
+
* Supports comparison for numbers and Date objects.
|
|
32
|
+
*
|
|
33
|
+
* @param {any} a - The value to validate.
|
|
34
|
+
* @param {any} b - The value to compare against.
|
|
35
|
+
*
|
|
36
|
+
* @returns {boolean} True if `a` is greater than `b`, otherwise false.
|
|
37
|
+
*
|
|
38
|
+
* @throws {Error} If either `a` or `b` is `null` or `undefined`.
|
|
39
|
+
* @throws {TypeError} If values are of mismatched or unsupported types.
|
|
40
|
+
* @memberOf module:decorator-validation
|
|
41
|
+
*/
|
|
42
|
+
export declare function isGreaterThan(a: any, b: any): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* @description Checks if a value matches a specified type name
|
|
45
|
+
* @summary Utility function to verify if a value's type matches the provided type name
|
|
46
|
+
* @param {unknown} value - The value to check the type of
|
|
47
|
+
* @param {string} acceptedType - The type name to check against
|
|
48
|
+
* @return {boolean} Returns true if the value matches the accepted type, false otherwise
|
|
49
|
+
*/
|
|
50
|
+
export declare function checkType(value: unknown, acceptedType: string): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* @description Checks if a value matches any of the specified type names
|
|
53
|
+
* @summary Utility function to verify if a value's type matches any of the provided type names
|
|
54
|
+
* @param {unknown} value - The value to check the type of
|
|
55
|
+
* @param {string[]} acceptedTypes - Array of type names to check against
|
|
56
|
+
* @return {boolean} Returns true if the value matches any of the accepted types, false otherwise
|
|
57
|
+
*/
|
|
58
|
+
export declare function checkTypes(value: unknown, acceptedTypes: string[]): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* @description Evaluates if a value matches the specified type metadata
|
|
61
|
+
* @summary Compares a value against type metadata to determine if they match
|
|
62
|
+
* @param {unknown} value - The value to evaluate
|
|
63
|
+
* @param {string | string[] | {name: string}} types - Type metadata to check against, can be a string, array of strings, or an object with a name property
|
|
64
|
+
* @return {boolean} Returns true if the value matches the type metadata, false otherwise
|
|
65
|
+
*/
|
|
66
|
+
export declare function evaluateDesignTypes(value: unknown, types: string | string[] | {
|
|
67
|
+
name: string;
|
|
68
|
+
}): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* @description Returns the length of a value
|
|
71
|
+
* @summary Returns the length of a value
|
|
72
|
+
* @param {string | Set<any> | any[] | Map<any, any>} value - The value to evaluate
|
|
73
|
+
* @return {number} Returns the length of a value
|
|
74
|
+
*/
|
|
75
|
+
export declare function valueLength(value: string | Set<any> | any[] | Map<any, any>): number;
|