@decaf-ts/decorator-validation 1.11.23 → 1.12.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.js.map +1 -0
- package/lib/cjs/constants/index.js.map +1 -0
- package/lib/cjs/constants/validation.js.map +1 -0
- package/lib/{index.cjs → cjs/index.cjs} +1 -1
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/model/Builder.js.map +1 -0
- package/lib/cjs/model/Model.js.map +1 -0
- package/lib/cjs/model/ModelErrorDefinition.js.map +1 -0
- package/lib/cjs/model/ModelRegistry.js.map +1 -0
- package/lib/cjs/model/constants.js.map +1 -0
- package/lib/cjs/model/construction.js.map +1 -0
- package/lib/cjs/model/decorators.js.map +1 -0
- package/lib/cjs/model/index.js.map +1 -0
- package/lib/{model → cjs/model}/types.js.map +1 -1
- package/lib/cjs/model/utils.js.map +1 -0
- package/lib/cjs/model/validation.js.map +1 -0
- package/lib/cjs/overrides/Metadata.js.map +1 -0
- package/lib/cjs/overrides/index.js.map +1 -0
- package/lib/cjs/overrides/overrides.js.map +1 -0
- package/lib/{overrides → cjs/overrides}/types.js.map +1 -1
- package/lib/cjs/types/index.js.map +1 -0
- package/lib/{types → cjs/types}/validation.js.map +1 -1
- package/lib/cjs/utils/DateBuilder.js.map +1 -0
- package/lib/cjs/utils/PathProxy.js.map +1 -0
- package/lib/cjs/utils/constants.js.map +1 -0
- package/lib/cjs/utils/dates.js.map +1 -0
- package/lib/cjs/utils/equality.js.map +1 -0
- package/lib/cjs/utils/hashing.js.map +1 -0
- package/lib/cjs/utils/index.js.map +1 -0
- package/lib/{utils → cjs/utils}/registry.js.map +1 -1
- package/lib/cjs/utils/serialization.js.map +1 -0
- package/lib/cjs/utils/serializers.js.map +1 -0
- package/lib/cjs/utils/strings.js.map +1 -0
- package/lib/{utils → cjs/utils}/types.js.map +1 -1
- package/lib/cjs/validation/Validation.js.map +1 -0
- package/lib/cjs/validation/Validators/AsyncValidator.js.map +1 -0
- package/lib/cjs/validation/Validators/BaseValidator.js.map +1 -0
- package/lib/cjs/validation/Validators/DateValidator.js.map +1 -0
- package/lib/cjs/validation/Validators/DiffValidator.js.map +1 -0
- package/lib/cjs/validation/Validators/EmailValidator.js.map +1 -0
- package/lib/cjs/validation/Validators/EqualsValidator.js.map +1 -0
- package/lib/cjs/validation/Validators/GreaterThanOrEqualValidator.js.map +1 -0
- package/lib/cjs/validation/Validators/GreaterThanValidator.js.map +1 -0
- package/lib/cjs/validation/Validators/LessThanOrEqualValidator.js.map +1 -0
- package/lib/cjs/validation/Validators/LessThanValidator.js.map +1 -0
- package/lib/cjs/validation/Validators/ListValidator.js.map +1 -0
- package/lib/cjs/validation/Validators/MaxLengthValidator.js.map +1 -0
- package/lib/cjs/validation/Validators/MaxValidator.js.map +1 -0
- package/lib/cjs/validation/Validators/MinLengthValidator.js.map +1 -0
- package/lib/cjs/validation/Validators/MinValidator.js.map +1 -0
- package/lib/cjs/validation/Validators/OptionValidator.js.map +1 -0
- package/lib/cjs/validation/Validators/PasswordValidator.js.map +1 -0
- package/lib/cjs/validation/Validators/PatternValidator.js.map +1 -0
- package/lib/cjs/validation/Validators/RequiredValidator.js.map +1 -0
- package/lib/cjs/validation/Validators/StepValidator.js.map +1 -0
- package/lib/cjs/validation/Validators/TypeValidator.js.map +1 -0
- package/lib/cjs/validation/Validators/URLValidator.js.map +1 -0
- package/lib/cjs/validation/Validators/Validator.js.map +1 -0
- package/lib/cjs/validation/Validators/ValidatorRegistry.js.map +1 -0
- package/lib/cjs/validation/Validators/constants.js.map +1 -0
- package/lib/cjs/validation/Validators/decorators.js.map +1 -0
- package/lib/cjs/validation/Validators/index.js.map +1 -0
- package/lib/cjs/validation/Validators/utils.js.map +1 -0
- package/lib/cjs/validation/decorators.js.map +1 -0
- package/lib/cjs/validation/index.js.map +1 -0
- package/lib/cjs/validation/types.js.map +1 -0
- package/lib/esm/index.js +1 -1
- package/lib/types/index.d.ts +19 -0
- package/package.json +12 -5
- package/lib/constants/errors.js.map +0 -1
- package/lib/constants/index.js.map +0 -1
- package/lib/constants/validation.js.map +0 -1
- package/lib/esm/constants/errors.d.ts +0 -17
- package/lib/esm/constants/index.d.ts +0 -2
- package/lib/esm/constants/validation.d.ts +0 -16
- package/lib/esm/index.d.ts +0 -20
- package/lib/index.d.ts +0 -20
- package/lib/index.js.map +0 -1
- package/lib/model/Builder.d.ts +0 -86
- package/lib/model/Builder.js.map +0 -1
- package/lib/model/Model.d.ts +0 -286
- package/lib/model/Model.js.map +0 -1
- package/lib/model/ModelErrorDefinition.d.ts +0 -22
- package/lib/model/ModelErrorDefinition.js.map +0 -1
- package/lib/model/ModelRegistry.d.ts +0 -181
- package/lib/model/ModelRegistry.js.map +0 -1
- package/lib/model/constants.d.ts +0 -65
- package/lib/model/constants.js.map +0 -1
- package/lib/model/construction.d.ts +0 -46
- package/lib/model/construction.js.map +0 -1
- package/lib/model/decorators.d.ts +0 -47
- package/lib/model/decorators.js.map +0 -1
- package/lib/model/index.d.ts +0 -10
- package/lib/model/index.js.map +0 -1
- package/lib/model/types.d.ts +0 -145
- package/lib/model/utils.d.ts +0 -13
- package/lib/model/utils.js.map +0 -1
- package/lib/model/validation.d.ts +0 -92
- package/lib/model/validation.js.map +0 -1
- package/lib/overrides/Metadata.d.ts +0 -132
- package/lib/overrides/Metadata.js.map +0 -1
- package/lib/overrides/index.d.ts +0 -3
- package/lib/overrides/index.js.map +0 -1
- package/lib/overrides/overrides.d.ts +0 -1
- package/lib/overrides/overrides.js.map +0 -1
- package/lib/overrides/types.d.ts +0 -17
- package/lib/types/index.js.map +0 -1
- package/lib/types/validation.d.ts +0 -28
- package/lib/utils/DateBuilder.d.ts +0 -121
- package/lib/utils/DateBuilder.js.map +0 -1
- package/lib/utils/PathProxy.d.ts +0 -43
- package/lib/utils/PathProxy.js.map +0 -1
- package/lib/utils/constants.d.ts +0 -32
- package/lib/utils/constants.js.map +0 -1
- package/lib/utils/dates.d.ts +0 -86
- package/lib/utils/dates.js.map +0 -1
- package/lib/utils/equality.d.ts +0 -56
- package/lib/utils/equality.js.map +0 -1
- package/lib/utils/hashing.d.ts +0 -82
- package/lib/utils/hashing.js.map +0 -1
- package/lib/utils/index.d.ts +0 -11
- package/lib/utils/index.js.map +0 -1
- package/lib/utils/registry.d.ts +0 -68
- package/lib/utils/serialization.d.ts +0 -12
- package/lib/utils/serialization.js.map +0 -1
- package/lib/utils/serializers.d.ts +0 -41
- package/lib/utils/serializers.js.map +0 -1
- package/lib/utils/strings.d.ts +0 -25
- package/lib/utils/strings.js.map +0 -1
- package/lib/utils/types.d.ts +0 -35
- package/lib/validation/Validation.d.ts +0 -53
- package/lib/validation/Validation.js.map +0 -1
- package/lib/validation/Validators/AsyncValidator.d.ts +0 -72
- package/lib/validation/Validators/AsyncValidator.js.map +0 -1
- package/lib/validation/Validators/BaseValidator.d.ts +0 -118
- package/lib/validation/Validators/BaseValidator.js.map +0 -1
- package/lib/validation/Validators/DateValidator.d.ts +0 -60
- package/lib/validation/Validators/DateValidator.js.map +0 -1
- package/lib/validation/Validators/DiffValidator.d.ts +0 -29
- package/lib/validation/Validators/DiffValidator.js.map +0 -1
- package/lib/validation/Validators/EmailValidator.d.ts +0 -60
- package/lib/validation/Validators/EmailValidator.js.map +0 -1
- package/lib/validation/Validators/EqualsValidator.d.ts +0 -29
- package/lib/validation/Validators/EqualsValidator.js.map +0 -1
- package/lib/validation/Validators/GreaterThanOrEqualValidator.d.ts +0 -29
- package/lib/validation/Validators/GreaterThanOrEqualValidator.js.map +0 -1
- package/lib/validation/Validators/GreaterThanValidator.d.ts +0 -29
- package/lib/validation/Validators/GreaterThanValidator.js.map +0 -1
- package/lib/validation/Validators/LessThanOrEqualValidator.d.ts +0 -29
- package/lib/validation/Validators/LessThanOrEqualValidator.js.map +0 -1
- package/lib/validation/Validators/LessThanValidator.d.ts +0 -29
- package/lib/validation/Validators/LessThanValidator.js.map +0 -1
- package/lib/validation/Validators/ListValidator.d.ts +0 -66
- package/lib/validation/Validators/ListValidator.js.map +0 -1
- package/lib/validation/Validators/MaxLengthValidator.d.ts +0 -29
- package/lib/validation/Validators/MaxLengthValidator.js.map +0 -1
- package/lib/validation/Validators/MaxValidator.d.ts +0 -74
- package/lib/validation/Validators/MaxValidator.js.map +0 -1
- package/lib/validation/Validators/MinLengthValidator.d.ts +0 -29
- package/lib/validation/Validators/MinLengthValidator.js.map +0 -1
- package/lib/validation/Validators/MinValidator.d.ts +0 -74
- package/lib/validation/Validators/MinValidator.js.map +0 -1
- package/lib/validation/Validators/OptionValidator.d.ts +0 -29
- package/lib/validation/Validators/OptionValidator.js.map +0 -1
- package/lib/validation/Validators/PasswordValidator.d.ts +0 -28
- package/lib/validation/Validators/PasswordValidator.js.map +0 -1
- package/lib/validation/Validators/PatternValidator.d.ts +0 -103
- package/lib/validation/Validators/PatternValidator.js.map +0 -1
- package/lib/validation/Validators/RequiredValidator.d.ts +0 -74
- package/lib/validation/Validators/RequiredValidator.js.map +0 -1
- package/lib/validation/Validators/StepValidator.d.ts +0 -29
- package/lib/validation/Validators/StepValidator.js.map +0 -1
- package/lib/validation/Validators/TypeValidator.d.ts +0 -79
- package/lib/validation/Validators/TypeValidator.js.map +0 -1
- package/lib/validation/Validators/URLValidator.d.ts +0 -61
- package/lib/validation/Validators/URLValidator.js.map +0 -1
- package/lib/validation/Validators/Validator.d.ts +0 -65
- package/lib/validation/Validators/Validator.js.map +0 -1
- package/lib/validation/Validators/ValidatorRegistry.d.ts +0 -41
- package/lib/validation/Validators/ValidatorRegistry.js.map +0 -1
- package/lib/validation/Validators/constants.d.ts +0 -157
- package/lib/validation/Validators/constants.js.map +0 -1
- package/lib/validation/Validators/decorators.d.ts +0 -12
- package/lib/validation/Validators/decorators.js.map +0 -1
- package/lib/validation/Validators/index.d.ts +0 -26
- package/lib/validation/Validators/index.js.map +0 -1
- package/lib/validation/Validators/utils.d.ts +0 -75
- package/lib/validation/Validators/utils.js.map +0 -1
- package/lib/validation/decorators.d.ts +0 -313
- package/lib/validation/decorators.js.map +0 -1
- package/lib/validation/index.d.ts +0 -9
- package/lib/validation/index.js.map +0 -1
- package/lib/validation/types.d.ts +0 -309
- package/lib/validation/types.js.map +0 -1
- /package/lib/{constants → cjs/constants}/errors.cjs +0 -0
- /package/lib/{constants → cjs/constants}/index.cjs +0 -0
- /package/lib/{constants → cjs/constants}/validation.cjs +0 -0
- /package/lib/{model → cjs/model}/Builder.cjs +0 -0
- /package/lib/{model → cjs/model}/Model.cjs +0 -0
- /package/lib/{model → cjs/model}/ModelErrorDefinition.cjs +0 -0
- /package/lib/{model → cjs/model}/ModelRegistry.cjs +0 -0
- /package/lib/{model → cjs/model}/constants.cjs +0 -0
- /package/lib/{model → cjs/model}/construction.cjs +0 -0
- /package/lib/{model → cjs/model}/decorators.cjs +0 -0
- /package/lib/{model → cjs/model}/index.cjs +0 -0
- /package/lib/{model → cjs/model}/types.cjs +0 -0
- /package/lib/{model → cjs/model}/utils.cjs +0 -0
- /package/lib/{model → cjs/model}/validation.cjs +0 -0
- /package/lib/{overrides → cjs/overrides}/Metadata.cjs +0 -0
- /package/lib/{overrides → cjs/overrides}/index.cjs +0 -0
- /package/lib/{overrides → cjs/overrides}/overrides.cjs +0 -0
- /package/lib/{overrides → cjs/overrides}/types.cjs +0 -0
- /package/lib/{types → cjs/types}/index.cjs +0 -0
- /package/lib/{types → cjs/types}/validation.cjs +0 -0
- /package/lib/{utils → cjs/utils}/DateBuilder.cjs +0 -0
- /package/lib/{utils → cjs/utils}/PathProxy.cjs +0 -0
- /package/lib/{utils → cjs/utils}/constants.cjs +0 -0
- /package/lib/{utils → cjs/utils}/dates.cjs +0 -0
- /package/lib/{utils → cjs/utils}/equality.cjs +0 -0
- /package/lib/{utils → cjs/utils}/hashing.cjs +0 -0
- /package/lib/{utils → cjs/utils}/index.cjs +0 -0
- /package/lib/{utils → cjs/utils}/registry.cjs +0 -0
- /package/lib/{utils → cjs/utils}/serialization.cjs +0 -0
- /package/lib/{utils → cjs/utils}/serializers.cjs +0 -0
- /package/lib/{utils → cjs/utils}/strings.cjs +0 -0
- /package/lib/{utils → cjs/utils}/types.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validation.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/AsyncValidator.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/BaseValidator.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/DateValidator.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/DiffValidator.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/EmailValidator.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/EqualsValidator.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/GreaterThanOrEqualValidator.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/GreaterThanValidator.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/LessThanOrEqualValidator.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/LessThanValidator.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/ListValidator.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/MaxLengthValidator.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/MaxValidator.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/MinLengthValidator.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/MinValidator.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/OptionValidator.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/PasswordValidator.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/PatternValidator.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/RequiredValidator.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/StepValidator.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/TypeValidator.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/URLValidator.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/Validator.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/ValidatorRegistry.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/constants.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/decorators.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/index.cjs +0 -0
- /package/lib/{validation → cjs/validation}/Validators/utils.cjs +0 -0
- /package/lib/{validation → cjs/validation}/decorators.cjs +0 -0
- /package/lib/{validation → cjs/validation}/index.cjs +0 -0
- /package/lib/{validation → cjs/validation}/types.cjs +0 -0
- /package/lib/{constants → types/constants}/errors.d.ts +0 -0
- /package/lib/{constants → types/constants}/index.d.ts +0 -0
- /package/lib/{constants → types/constants}/validation.d.ts +0 -0
- /package/lib/{esm → types}/model/Builder.d.ts +0 -0
- /package/lib/{esm → types}/model/Model.d.ts +0 -0
- /package/lib/{esm → types}/model/ModelErrorDefinition.d.ts +0 -0
- /package/lib/{esm → types}/model/ModelRegistry.d.ts +0 -0
- /package/lib/{esm → types}/model/constants.d.ts +0 -0
- /package/lib/{esm → types}/model/construction.d.ts +0 -0
- /package/lib/{esm → types}/model/decorators.d.ts +0 -0
- /package/lib/{esm → types}/model/index.d.ts +0 -0
- /package/lib/{esm → types}/model/types.d.ts +0 -0
- /package/lib/{esm → types}/model/utils.d.ts +0 -0
- /package/lib/{esm → types}/model/validation.d.ts +0 -0
- /package/lib/{esm → types}/overrides/Metadata.d.ts +0 -0
- /package/lib/{esm → types}/overrides/index.d.ts +0 -0
- /package/lib/{esm → types}/overrides/overrides.d.ts +0 -0
- /package/lib/{esm → types}/overrides/types.d.ts +0 -0
- /package/lib/{esm → types}/types/index.d.ts +0 -0
- /package/lib/{esm → types}/types/validation.d.ts +0 -0
- /package/lib/{esm → types}/utils/DateBuilder.d.ts +0 -0
- /package/lib/{esm → types}/utils/PathProxy.d.ts +0 -0
- /package/lib/{esm → types}/utils/constants.d.ts +0 -0
- /package/lib/{esm → types}/utils/dates.d.ts +0 -0
- /package/lib/{esm → types}/utils/equality.d.ts +0 -0
- /package/lib/{esm → types}/utils/hashing.d.ts +0 -0
- /package/lib/{esm → types}/utils/index.d.ts +0 -0
- /package/lib/{esm → types}/utils/registry.d.ts +0 -0
- /package/lib/{esm → types}/utils/serialization.d.ts +0 -0
- /package/lib/{esm → types}/utils/serializers.d.ts +0 -0
- /package/lib/{esm → types}/utils/strings.d.ts +0 -0
- /package/lib/{esm → types}/utils/types.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validation.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/AsyncValidator.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/BaseValidator.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/DateValidator.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/DiffValidator.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/EmailValidator.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/EqualsValidator.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/GreaterThanOrEqualValidator.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/GreaterThanValidator.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/LessThanOrEqualValidator.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/LessThanValidator.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/ListValidator.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/MaxLengthValidator.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/MaxValidator.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/MinLengthValidator.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/MinValidator.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/OptionValidator.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/PasswordValidator.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/PatternValidator.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/RequiredValidator.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/StepValidator.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/TypeValidator.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/URLValidator.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/Validator.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/ValidatorRegistry.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/constants.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/decorators.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/index.d.ts +0 -0
- /package/lib/{esm → types}/validation/Validators/utils.d.ts +0 -0
- /package/lib/{esm → types}/validation/decorators.d.ts +0 -0
- /package/lib/{esm → types}/validation/index.d.ts +0 -0
- /package/lib/{esm → types}/validation/types.d.ts +0 -0
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { Validator } from "./Validator";
|
|
2
|
-
import { PatternValidatorOptions } from "../types";
|
|
3
|
-
/**
|
|
4
|
-
* @description Regular expression for parsing string patterns with flags
|
|
5
|
-
* @summary This regular expression is used to parse string patterns in the format "/pattern/flags".
|
|
6
|
-
* It captures the pattern and flags separately, allowing the creation of a RegExp object
|
|
7
|
-
* with the appropriate flags.
|
|
8
|
-
*
|
|
9
|
-
* @const {RegExp}
|
|
10
|
-
* @memberOf module:decorator-validation
|
|
11
|
-
* @category Validation
|
|
12
|
-
*/
|
|
13
|
-
export declare const regexpParser: RegExp;
|
|
14
|
-
/**
|
|
15
|
-
* @description Validator for checking if a string matches a regular expression pattern
|
|
16
|
-
* @summary The PatternValidator checks if a string value matches a specified regular expression pattern.
|
|
17
|
-
* It supports both RegExp objects and string representations of patterns, including those with flags.
|
|
18
|
-
* This validator is the foundation for specialized validators like EmailValidator and URLValidator,
|
|
19
|
-
* and is typically used with the @pattern decorator.
|
|
20
|
-
*
|
|
21
|
-
* @param {string} [message] - Custom error message to display when validation fails, defaults to {@link DEFAULT_ERROR_MESSAGES#PATTERN}
|
|
22
|
-
*
|
|
23
|
-
* @class PatternValidator
|
|
24
|
-
* @extends Validator
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```typescript
|
|
28
|
-
* // Create a pattern validator with default error message
|
|
29
|
-
* const patternValidator = new PatternValidator();
|
|
30
|
-
*
|
|
31
|
-
* // Create a pattern validator with custom error message
|
|
32
|
-
* const customPatternValidator = new PatternValidator("Value must match the required format");
|
|
33
|
-
*
|
|
34
|
-
* // Validate using a RegExp object
|
|
35
|
-
* const regexOptions = { pattern: /^[A-Z][a-z]+$/ };
|
|
36
|
-
* patternValidator.hasErrors("Hello", regexOptions); // undefined (valid)
|
|
37
|
-
* patternValidator.hasErrors("hello", regexOptions); // Returns error message (invalid)
|
|
38
|
-
*
|
|
39
|
-
* // Validate using a string pattern
|
|
40
|
-
* const stringOptions = { pattern: "^\\d{3}-\\d{2}-\\d{4}$" };
|
|
41
|
-
* patternValidator.hasErrors("123-45-6789", stringOptions); // undefined (valid)
|
|
42
|
-
*
|
|
43
|
-
* // Validate using a string pattern with flags
|
|
44
|
-
* const flagOptions = { pattern: "/^hello$/i" };
|
|
45
|
-
* patternValidator.hasErrors("Hello", flagOptions); // undefined (valid)
|
|
46
|
-
* ```
|
|
47
|
-
*
|
|
48
|
-
* @mermaid
|
|
49
|
-
* sequenceDiagram
|
|
50
|
-
* participant C as Client
|
|
51
|
-
* participant V as PatternValidator
|
|
52
|
-
*
|
|
53
|
-
* C->>V: new PatternValidator(message)
|
|
54
|
-
* C->>V: hasErrors(value, options)
|
|
55
|
-
* alt value is empty
|
|
56
|
-
* V-->>C: undefined (valid)
|
|
57
|
-
* else pattern is missing
|
|
58
|
-
* V-->>C: Error: Missing Pattern
|
|
59
|
-
* else pattern is string
|
|
60
|
-
* V->>V: getPattern(pattern)
|
|
61
|
-
* end
|
|
62
|
-
* V->>V: Reset pattern.lastIndex
|
|
63
|
-
* V->>V: Test value against pattern
|
|
64
|
-
* alt pattern test passes
|
|
65
|
-
* V-->>C: undefined (valid)
|
|
66
|
-
* else pattern test fails
|
|
67
|
-
* V-->>C: Error message
|
|
68
|
-
* end
|
|
69
|
-
*
|
|
70
|
-
* @category Validators
|
|
71
|
-
*/
|
|
72
|
-
export declare class PatternValidator extends Validator<PatternValidatorOptions> {
|
|
73
|
-
constructor(message?: string);
|
|
74
|
-
/**
|
|
75
|
-
* @description Converts a string pattern to a RegExp object
|
|
76
|
-
* @summary Parses a string representation of a regular expression and converts it to a RegExp object.
|
|
77
|
-
* It handles both simple string patterns and patterns with flags in the format "/pattern/flags".
|
|
78
|
-
*
|
|
79
|
-
* @param {string} pattern - The string pattern to convert
|
|
80
|
-
* @return {RegExp} A RegExp object created from the string pattern
|
|
81
|
-
* @private
|
|
82
|
-
*/
|
|
83
|
-
private getPattern;
|
|
84
|
-
/**
|
|
85
|
-
* @description Checks if a string matches a regular expression pattern
|
|
86
|
-
* @summary Validates that the provided string matches the pattern specified in the options.
|
|
87
|
-
* If the pattern is provided as a string, it's converted to a RegExp object using the getPattern method.
|
|
88
|
-
* The method resets the pattern's lastIndex property to ensure consistent validation results
|
|
89
|
-
* for patterns with the global flag.
|
|
90
|
-
*
|
|
91
|
-
* @param {string} value - The string to validate against the pattern
|
|
92
|
-
* @param {PatternValidatorOptions} options - Configuration options containing the pattern
|
|
93
|
-
*
|
|
94
|
-
* @return {string | undefined} Error message if validation fails, undefined if validation passes
|
|
95
|
-
*
|
|
96
|
-
* @throws {Error} If no pattern is provided in the options
|
|
97
|
-
*
|
|
98
|
-
* @override
|
|
99
|
-
*
|
|
100
|
-
* @see Validator#hasErrors
|
|
101
|
-
*/
|
|
102
|
-
hasErrors(value: string, options: PatternValidatorOptions): string | undefined;
|
|
103
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PatternValidator.js","sourceRoot":"","sources":["../../../src/validation/Validators/PatternValidator.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAwC;AACxC,+CAAqE;AACrE,iDAAyC;AAGzC;;;;;;;;;GASG;A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AAA;AApDY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,sBAAS,EAAC,0BAAc,CAAC,OAAO,CAAC;;GACrB,gBAAgB,CAoD5B"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { Validator } from "./Validator";
|
|
2
|
-
import { ValidatorOptions } from "../types";
|
|
3
|
-
/**
|
|
4
|
-
* @description Validator for checking if a value is present and not empty
|
|
5
|
-
* @summary The RequiredValidator ensures that a value is provided and not empty.
|
|
6
|
-
* It handles different types of values appropriately: for booleans and numbers,
|
|
7
|
-
* it checks if they're undefined; for other types (strings, arrays, objects),
|
|
8
|
-
* it checks if they're falsy. This validator is typically used with the @required decorator
|
|
9
|
-
* and is often the first validation applied to important fields.
|
|
10
|
-
*
|
|
11
|
-
* @param {string} [message] - Custom error message to display when validation fails, defaults to {@link DEFAULT_ERROR_MESSAGES#REQUIRED}
|
|
12
|
-
*
|
|
13
|
-
* @class RequiredValidator
|
|
14
|
-
* @extends Validator
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* // Create a required validator with default error message
|
|
19
|
-
* const requiredValidator = new RequiredValidator();
|
|
20
|
-
*
|
|
21
|
-
* // Create a required validator with custom error message
|
|
22
|
-
* const customRequiredValidator = new RequiredValidator("This field is mandatory");
|
|
23
|
-
*
|
|
24
|
-
* // Validate different types of values
|
|
25
|
-
* requiredValidator.hasErrors("Hello"); // undefined (valid)
|
|
26
|
-
* requiredValidator.hasErrors(""); // Returns error message (invalid)
|
|
27
|
-
* requiredValidator.hasErrors(0); // undefined (valid - 0 is a valid number)
|
|
28
|
-
* requiredValidator.hasErrors(null); // Returns error message (invalid)
|
|
29
|
-
* requiredValidator.hasErrors([]); // undefined (valid - empty array is still an array)
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* @mermaid
|
|
33
|
-
* sequenceDiagram
|
|
34
|
-
* participant C as Client
|
|
35
|
-
* participant V as RequiredValidator
|
|
36
|
-
*
|
|
37
|
-
* C->>V: new RequiredValidator(message)
|
|
38
|
-
* C->>V: hasErrors(value, options)
|
|
39
|
-
* alt typeof value is boolean or number
|
|
40
|
-
* alt value is undefined
|
|
41
|
-
* V-->>C: Error message
|
|
42
|
-
* else value is defined
|
|
43
|
-
* V-->>C: undefined (valid)
|
|
44
|
-
* end
|
|
45
|
-
* else other types
|
|
46
|
-
* alt value is falsy (null, undefined, empty string)
|
|
47
|
-
* V-->>C: Error message
|
|
48
|
-
* else value is truthy
|
|
49
|
-
* V-->>C: undefined (valid)
|
|
50
|
-
* end
|
|
51
|
-
* end
|
|
52
|
-
*
|
|
53
|
-
* @category Validators
|
|
54
|
-
*/
|
|
55
|
-
export declare class RequiredValidator extends Validator {
|
|
56
|
-
constructor(message?: string);
|
|
57
|
-
/**
|
|
58
|
-
* @description Checks if a value is present and not empty
|
|
59
|
-
* @summary Validates that the provided value exists and is not empty.
|
|
60
|
-
* The validation logic varies by type:
|
|
61
|
-
* - For booleans and numbers: checks if the value is undefined
|
|
62
|
-
* - For other types (strings, arrays, objects): checks if the value is falsy
|
|
63
|
-
*
|
|
64
|
-
* @param {any} value - The value to validate
|
|
65
|
-
* @param {ValidatorOptions} [options={}] - Optional configuration options
|
|
66
|
-
*
|
|
67
|
-
* @return {string | undefined} Error message if validation fails, undefined if validation passes
|
|
68
|
-
*
|
|
69
|
-
* @override
|
|
70
|
-
*
|
|
71
|
-
* @see Validator#hasErrors
|
|
72
|
-
*/
|
|
73
|
-
hasErrors(value: any, options?: ValidatorOptions): string | undefined;
|
|
74
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RequiredValidator.js","sourceRoot":"","sources":["../../../src/validation/Validators/RequiredValidator.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAwC;AACxC,+CAAqE;AACrE,iDAAyC;AAGzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,qBAAS;IAC9C,YAAY,UAAkB,kCAAsB,CAAC,QAAQ;QAC3D,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACI,SAAS,CACd,KAAU,EACV,UAA4B,EAAE;QAE9B,QAAQ,OAAO,KAAK,EAAE,CAAC;YACrB,KAAK,SAAS,CAAC;YACf,KAAK,QAAQ;gBACX,OAAO,OAAO,KAAK,KAAK,WAAW;oBACjC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC;oBAClD,CAAC,CAAC,SAAS,CAAC;YAChB;gBACE,OAAO,CAAC,KAAK;oBACX,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC;oBAClD,CAAC,CAAC,SAAS,CAAC;QAClB,CAAC;IACH,CAAC;CACF,CAAA;AArCY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,sBAAS,EAAC,0BAAc,CAAC,QAAQ,CAAC;;GACtB,iBAAiB,CAqC7B"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Validator } from "./Validator";
|
|
2
|
-
import { StepValidatorOptions } from "../types";
|
|
3
|
-
/**
|
|
4
|
-
* @summary Step Validator
|
|
5
|
-
*
|
|
6
|
-
* @param {string} [message] defaults to {@link DEFAULT_ERROR_MESSAGES#STEP}
|
|
7
|
-
*
|
|
8
|
-
* @class StepValidator
|
|
9
|
-
* @extends Validator
|
|
10
|
-
*
|
|
11
|
-
* @category Validators
|
|
12
|
-
*/
|
|
13
|
-
export declare class StepValidator extends Validator<StepValidatorOptions> {
|
|
14
|
-
constructor(message?: string);
|
|
15
|
-
/**
|
|
16
|
-
* @summary Validates a model
|
|
17
|
-
*
|
|
18
|
-
* @param {string} value
|
|
19
|
-
* @param {number} step
|
|
20
|
-
* @param {StepValidatorOptions} options
|
|
21
|
-
*
|
|
22
|
-
* @return {string | undefined}
|
|
23
|
-
*
|
|
24
|
-
* @override
|
|
25
|
-
*
|
|
26
|
-
* @see Validator#hasErrors
|
|
27
|
-
*/
|
|
28
|
-
hasErrors(value: number | string, options: StepValidatorOptions): string | undefined;
|
|
29
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StepValidator.js","sourceRoot":"","sources":["../../../src/validation/Validators/StepValidator.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAwC;AACxC,+CAAqE;AACrE,iDAAyC;AAGzC;;;;;;;;;GASG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,qBAA+B;IAChE,YAAY,UAAkB,kCAAsB,CAAC,IAAI;QACvD,KAAK,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACrC,CAAC;IAED;;;;;;;;;;;;OAYG;IACI,SAAS,CACd,KAAsB,EACtB,OAA6B;QAE7B,IAAI,OAAO,KAAK,KAAK,WAAW;YAAE,OAAO;QACzC,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;YAC/C,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC;YAChE,CAAC,CAAC,SAAS,CAAC;IAChB,CAAC;CACF,CAAA;AA3BY,sCAAa;wBAAb,aAAa;IADzB,IAAA,sBAAS,EAAC,0BAAc,CAAC,IAAI,CAAC;;GAClB,aAAa,CA2BzB"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { Validator } from "./Validator";
|
|
2
|
-
import { TypeValidatorOptions } from "../types";
|
|
3
|
-
/**
|
|
4
|
-
* @description Validator for checking if a value is of the expected type(s)
|
|
5
|
-
* @summary The TypeValidator ensures that a value matches one of the specified types.
|
|
6
|
-
* It can validate against a single type, multiple types, or a type with a specific name.
|
|
7
|
-
* This validator is typically used with the @type decorator and is fundamental for
|
|
8
|
-
* ensuring type safety in validated models.
|
|
9
|
-
*
|
|
10
|
-
* @param {string} [message] - Custom error message to display when validation fails, defaults to {@link DEFAULT_ERROR_MESSAGES#TYPE}
|
|
11
|
-
*
|
|
12
|
-
* @class TypeValidator
|
|
13
|
-
* @extends Validator
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```typescript
|
|
17
|
-
* // Create a type validator with default error message
|
|
18
|
-
* const typeValidator = new TypeValidator();
|
|
19
|
-
*
|
|
20
|
-
* // Create a type validator with custom error message
|
|
21
|
-
* const customTypeValidator = new TypeValidator("Value must be of type {0}, but got {1}");
|
|
22
|
-
*
|
|
23
|
-
* // Validate against a single type
|
|
24
|
-
* const stringOptions = { types: "string" };
|
|
25
|
-
* typeValidator.hasErrors("hello", stringOptions); // undefined (valid)
|
|
26
|
-
* typeValidator.hasErrors(123, stringOptions); // Returns error message (invalid)
|
|
27
|
-
*
|
|
28
|
-
* // Validate against multiple types
|
|
29
|
-
* const multiOptions = { types: ["string", "number"] };
|
|
30
|
-
* typeValidator.hasErrors("hello", multiOptions); // undefined (valid)
|
|
31
|
-
* typeValidator.hasErrors(123, multiOptions); // undefined (valid)
|
|
32
|
-
* typeValidator.hasErrors(true, multiOptions); // Returns error message (invalid)
|
|
33
|
-
*
|
|
34
|
-
* // Validate against a class type
|
|
35
|
-
* const classOptions = { types: { name: "Date" } };
|
|
36
|
-
* typeValidator.hasErrors(new Date(), classOptions); // undefined (valid)
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* @mermaid
|
|
40
|
-
* sequenceDiagram
|
|
41
|
-
* participant C as Client
|
|
42
|
-
* participant V as TypeValidator
|
|
43
|
-
* participant R as Reflection
|
|
44
|
-
*
|
|
45
|
-
* C->>V: new TypeValidator(message)
|
|
46
|
-
* C->>V: hasErrors(value, options)
|
|
47
|
-
* alt value is undefined
|
|
48
|
-
* V-->>C: undefined (valid)
|
|
49
|
-
* else value is defined
|
|
50
|
-
* V->>R: evaluateDesignTypes(value, types)
|
|
51
|
-
* alt type evaluation passes
|
|
52
|
-
* V-->>C: undefined (valid)
|
|
53
|
-
* else type evaluation fails
|
|
54
|
-
* V->>V: Format error message with type info
|
|
55
|
-
* V-->>C: Error message
|
|
56
|
-
* end
|
|
57
|
-
* end
|
|
58
|
-
*
|
|
59
|
-
* @category Validators
|
|
60
|
-
*/
|
|
61
|
-
export declare class TypeValidator extends Validator<TypeValidatorOptions> {
|
|
62
|
-
constructor(message?: string);
|
|
63
|
-
/**
|
|
64
|
-
* @description Checks if a value is of the expected type(s)
|
|
65
|
-
* @summary Validates that the provided value matches one of the specified types.
|
|
66
|
-
* It uses the Reflection utility to evaluate if the value's type matches the expected types.
|
|
67
|
-
* The method skips validation for undefined values to avoid conflicts with the RequiredValidator.
|
|
68
|
-
*
|
|
69
|
-
* @param {any} value - The value to validate
|
|
70
|
-
* @param {TypeValidatorOptions} options - Configuration options containing the expected types
|
|
71
|
-
*
|
|
72
|
-
* @return {string | undefined} Error message if validation fails, undefined if validation passes
|
|
73
|
-
*
|
|
74
|
-
* @override
|
|
75
|
-
*
|
|
76
|
-
* @see Validator#hasErrors
|
|
77
|
-
*/
|
|
78
|
-
hasErrors(value: any, options: TypeValidatorOptions): string | undefined;
|
|
79
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TypeValidator.js","sourceRoot":"","sources":["../../../src/validation/Validators/TypeValidator.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAwC;AACxC,+CAAqE;AACrE,iDAAyC;AACzC,oDAA2C;AAM3C,2DAAkD;AAClD,uCAA8C;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,qBAA+B;IAChE,Y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AAC,QAAQ,CAAC;IAClB,SAAS,EAAE,aAAiC;IAC5C,aAAa,EAAE,qBAAS,CAAC,IAAI;IAC7B,IAAI,EAAE,KAAK;CACW,CAAC,CAAC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { PatternValidator } from "./PatternValidator";
|
|
2
|
-
import { PatternValidatorOptions } from "../types";
|
|
3
|
-
/**
|
|
4
|
-
* @description Validator for checking if a string is a valid URL
|
|
5
|
-
* @summary The URLValidator checks if a string matches a standard URL pattern.
|
|
6
|
-
* It extends the PatternValidator and uses a robust URL regex pattern to validate web addresses.
|
|
7
|
-
* The pattern is sourced from {@link https://gist.github.com/dperini/729294} and is widely
|
|
8
|
-
* recognized for its accuracy in validating URLs. This validator is typically used with the @url decorator.
|
|
9
|
-
*
|
|
10
|
-
* @param {string} [message] - Custom error message to display when validation fails, defaults to {@link DEFAULT_ERROR_MESSAGES#URL}
|
|
11
|
-
*
|
|
12
|
-
* @class URLValidator
|
|
13
|
-
* @extends PatternValidator
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```typescript
|
|
17
|
-
* // Create a URL validator with default error message
|
|
18
|
-
* const urlValidator = new URLValidator();
|
|
19
|
-
*
|
|
20
|
-
* // Create a URL validator with custom error message
|
|
21
|
-
* const customUrlValidator = new URLValidator("Please enter a valid web address");
|
|
22
|
-
*
|
|
23
|
-
* // Validate a URL
|
|
24
|
-
* const result = urlValidator.hasErrors("https://example.com"); // undefined (valid)
|
|
25
|
-
* const invalidResult = urlValidator.hasErrors("not-a-url"); // Returns error message (invalid)
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* @mermaid
|
|
29
|
-
* sequenceDiagram
|
|
30
|
-
* participant C as Client
|
|
31
|
-
* participant U as URLValidator
|
|
32
|
-
* participant P as PatternValidator
|
|
33
|
-
*
|
|
34
|
-
* C->>U: new URLValidator(message)
|
|
35
|
-
* U->>P: super(message)
|
|
36
|
-
* C->>U: hasErrors(value, options)
|
|
37
|
-
* U->>P: super.hasErrors(value, options with URL pattern)
|
|
38
|
-
* P-->>U: validation result
|
|
39
|
-
* U-->>C: validation result
|
|
40
|
-
*
|
|
41
|
-
* @category Validators
|
|
42
|
-
*/
|
|
43
|
-
export declare class URLValidator extends PatternValidator {
|
|
44
|
-
constructor(message?: string);
|
|
45
|
-
/**
|
|
46
|
-
* @description Checks if a string is a valid URL
|
|
47
|
-
* @summary Validates that the provided string matches the URL pattern.
|
|
48
|
-
* This method extends the PatternValidator's hasErrors method by ensuring
|
|
49
|
-
* the URL pattern is used, even if not explicitly provided in the options.
|
|
50
|
-
*
|
|
51
|
-
* @param {string} value - The string to validate as a URL
|
|
52
|
-
* @param {PatternValidatorOptions} [options={}] - Optional configuration options
|
|
53
|
-
*
|
|
54
|
-
* @return {string | undefined} Error message if validation fails, undefined if validation passes
|
|
55
|
-
*
|
|
56
|
-
* @override
|
|
57
|
-
*
|
|
58
|
-
* @see PatternValidator#hasErrors
|
|
59
|
-
*/
|
|
60
|
-
hasErrors(value: string, options?: PatternValidatorOptions): string | undefined;
|
|
61
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"URLValidator.js","sourceRoot":"","sources":["../../../src/validation/Validators/URLValidator.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAIqB;AACrB,6DAAsD;AACtD,iDAAyC;AAGzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEI,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,mCAAgB;IAChD,YAAY,UAAkB,kCAAsB,CAAC,GAAG;QACtD,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACa,SAAS,CACvB,KAAa,EACb,UAAmC,EAAE;QAErC,OAAO,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE;YAC5B,GAAG,OAAO;YACV,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO;YACxC,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,4BAAgB,CAAC,GAAG;SACjD,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA9BY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,sBAAS,EAAC,0BAAc,CAAC,GAAG,CAAC;;GACjB,YAAY,CA8BxB"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { ValidatorOptions } from "../types";
|
|
2
|
-
import type { PathProxy } from "../../utils";
|
|
3
|
-
import { BaseValidator } from "./BaseValidator";
|
|
4
|
-
/**
|
|
5
|
-
* @description
|
|
6
|
-
* Abstract class for defining synchronous validators.
|
|
7
|
-
*
|
|
8
|
-
* This class extends the base {@link BaseValidator} and enforces that any implementation of `hasErrors` must be synchronous.
|
|
9
|
-
*
|
|
10
|
-
* Use this when the validation process is immediate and does not require asynchronous operations.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* // Example of a synchronous validator that checks if a number is greater than
|
|
15
|
-
* class GreaterThanValidator extends Validator<{ gt?: number }> {
|
|
16
|
-
* constructor(message: string = "Value must be greater than {0}") {
|
|
17
|
-
* super(message);
|
|
18
|
-
* }
|
|
19
|
-
*
|
|
20
|
-
* hasErrors(value: number, options?: { gt?: number }) {
|
|
21
|
-
* const minValue = options?.gt ?? 0;
|
|
22
|
-
* if (value <= minValue) {
|
|
23
|
-
* return this.getMessage();
|
|
24
|
-
* }
|
|
25
|
-
* return undefined;
|
|
26
|
-
* }
|
|
27
|
-
* }
|
|
28
|
-
*
|
|
29
|
-
* // Example usage:
|
|
30
|
-
* const validator = new GreaterThanValidator();
|
|
31
|
-
* const error = validator.hasErrors(10, { gt: 15 });
|
|
32
|
-
* if (error) {
|
|
33
|
-
* console.log('Value must be greater than 15')
|
|
34
|
-
* } else {
|
|
35
|
-
* console.log('Value is valid');
|
|
36
|
-
* }
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* - If `value` is less than or equal to `gt`, returns the error message.
|
|
40
|
-
* - Otherwise, returns `undefined` indicating validation success.
|
|
41
|
-
*
|
|
42
|
-
* @see {@link BaseValidator} For the base validator.
|
|
43
|
-
* @see {@link ValidatorOptions} For the base validator options.
|
|
44
|
-
*/
|
|
45
|
-
export declare abstract class Validator<V extends ValidatorOptions = ValidatorOptions> extends BaseValidator<V, false> {
|
|
46
|
-
protected constructor(message?: string, ...acceptedTypes: string[]);
|
|
47
|
-
/**
|
|
48
|
-
* @description Validates a value against specific validation rules
|
|
49
|
-
* @summary Abstract method that must be implemented by all validator subclasses.
|
|
50
|
-
* This method contains the core validation logic that determines whether a value
|
|
51
|
-
* is valid according to the specific rules of the validator. If the value is valid,
|
|
52
|
-
* the method returns undefined; otherwise, it returns an error message.
|
|
53
|
-
*
|
|
54
|
-
* @template V - Type of the options object that can be passed to the validator
|
|
55
|
-
* @param {any} value - The value to validate
|
|
56
|
-
* @param {V} [options] - Optional configuration options for customizing validation behavior
|
|
57
|
-
* @param {PathProxy<any>} proxy -
|
|
58
|
-
* @return {string | undefined} Error message if validation fails, undefined if validation passes
|
|
59
|
-
*
|
|
60
|
-
* @abstract
|
|
61
|
-
*
|
|
62
|
-
* @see Model#validate
|
|
63
|
-
*/
|
|
64
|
-
abstract hasErrors(value: any, options?: V, proxy?: PathProxy<any>): string | undefined;
|
|
65
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Validator.js","sourceRoot":"","sources":["../../../src/validation/Validators/Validator.ts"],"names":[],"mappings":";;;AAAA,+CAAqD;AAGrD,uDAAgD;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAsB,SAEpB,SAAQ,6BAAuB;IAC/B,YACE,UAAkB,kCAAsB,CAAC,OAAO,EAChD,GAAG,aAAuB;QAE1B,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,aAAa,CAAC,CAAC;IAC1C,CAAC;CAwBF;AAhCD,8BAgCC"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { ValidatorDefinition } from "../types";
|
|
2
|
-
import { IValidatorRegistry } from "../types";
|
|
3
|
-
import { Validator } from "./Validator";
|
|
4
|
-
/**
|
|
5
|
-
* @summary Base Implementation of a Validator Registry
|
|
6
|
-
*
|
|
7
|
-
* @prop {Validator[]} [validators] the initial validators to register
|
|
8
|
-
*
|
|
9
|
-
* @class ValidatorRegistry
|
|
10
|
-
* @implements IValidatorRegistry<T>
|
|
11
|
-
*
|
|
12
|
-
* @category Validation
|
|
13
|
-
*/
|
|
14
|
-
export declare class ValidatorRegistry<T extends Validator> implements IValidatorRegistry<T> {
|
|
15
|
-
private cache;
|
|
16
|
-
private customKeyCache;
|
|
17
|
-
constructor(...validators: (ValidatorDefinition | Validator)[]);
|
|
18
|
-
/**
|
|
19
|
-
* @summary retrieves the custom keys
|
|
20
|
-
*/
|
|
21
|
-
getCustomKeys(): {
|
|
22
|
-
[indexer: string]: string;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* @summary retrieves the registered validators keys
|
|
26
|
-
*/
|
|
27
|
-
getKeys(): string[];
|
|
28
|
-
/**
|
|
29
|
-
* @summary Retrieves a validator
|
|
30
|
-
*
|
|
31
|
-
* @param {string} validatorKey one of the {@link ValidationKeys}
|
|
32
|
-
* @return {Validator | undefined} the registered Validator or undefined if there is nono matching the provided key
|
|
33
|
-
*/
|
|
34
|
-
get<T extends Validator>(validatorKey: string): T | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* @summary Registers the provided validators onto the registry
|
|
37
|
-
*
|
|
38
|
-
* @param {T[] | ValidatorDefinition[]} validator
|
|
39
|
-
*/
|
|
40
|
-
register<T extends Validator>(...validator: (ValidatorDefinition | T)[]): void;
|
|
41
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ValidatorRegistry.js","sourceRoot":"","sources":["../../../src/validation/Validators/ValidatorRegistry.ts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C,GAAG,CAAC,CAAC;YAC3D,CAAC;iBAAM,CAAC;gBACN,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,CAAwB,CAAC;gBACpE,IAAI,aAAa,IAAI,IAAI,CAAC,KAAK;oBAAE,OAAO;gBACxC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC;gBACtC,IAAI,CAAC,IAAI;oBAAE,OAAO;gBAClB,MAAM,GAAG,GAA2B,EAAE,CAAC;gBACvC,GAAG,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC,GAAG,aAAa,CAAC;gBAEjD,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;YACpE,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AApED,8CAoEC"}
|
|
@@ -1,157 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/validation/Validators/constants.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEH;;;;;;;GAOG;AACU,QAAA,wBAAwB,GAAG;IACtC,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,WAAW;IACjB,SAAS,EAAE,UAAU;IACrB,kBAAkB,EAAE,iBAAiB;IACrC,YAAY,EAAE,aAAa;IAC3B,qBAAqB,EAAE,oBAAoB;CACnC,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;;GAOG;AACU,QAAA,cAAc,GAAG;IAC5B,OAAO,EAAE,YAAY;IACrB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,UAAU,EAAE,WA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EAAE,2CAA2C;IACzD,qBAAqB,EACnB,uDAAuD;IACzD,MAAM,EAAE,6CAA6C;IACrD,IAAI,EAAE,0CAA0C;CACjD,CAAC;AAEF;;;;;;;;;GASG;AAEH;;;;;;;GAOG;AACU,QAAA,gBAAgB,GAAG;IAC9B,KAAK,EACH,4JAA4J;IAC9J,GAAG,EAAE,yaAAya;IAC9a,QAAQ,EAAE;QACR,iBAAiB,EACf,iFAAiF;KACpF;IACD,GAAG,EAAE,scAAsc;CAC5c,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Validator } from "./Validator";
|
|
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;
|