@decaf-ts/decorator-validation 1.6.4 → 1.7.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/dist/decorator-validation.cjs +1217 -404
- package/dist/decorator-validation.esm.cjs +1173 -359
- package/lib/constants/index.cjs +1 -1
- package/lib/esm/index.d.ts +5 -37
- package/lib/esm/index.js +6 -38
- package/lib/esm/model/Model.d.ts +107 -35
- package/lib/esm/model/Model.js +110 -45
- package/lib/esm/model/constants.d.ts +3 -3
- package/lib/esm/model/constants.js +4 -4
- package/lib/esm/model/construction.d.ts +3 -3
- package/lib/esm/model/construction.js +4 -4
- package/lib/esm/model/decorators.d.ts +3 -3
- package/lib/esm/model/decorators.js +2 -3
- package/lib/esm/model/index.d.ts +1 -0
- package/lib/esm/model/index.js +2 -1
- package/lib/esm/model/types.d.ts +30 -11
- package/lib/esm/model/types.js +1 -1
- package/lib/esm/model/utils.d.ts +3 -0
- package/lib/esm/model/utils.js +11 -0
- package/lib/esm/model/validation.d.ts +5 -5
- package/lib/esm/model/validation.js +8 -9
- package/lib/esm/utils/Decoration.d.ts +123 -0
- package/lib/esm/utils/Decoration.js +192 -0
- package/lib/esm/utils/constants.d.ts +27 -9
- package/lib/esm/utils/constants.js +28 -10
- package/lib/esm/utils/dates.d.ts +26 -16
- package/lib/esm/utils/dates.js +27 -17
- package/lib/esm/utils/decorators.d.ts +41 -0
- package/lib/esm/utils/decorators.js +42 -1
- package/lib/esm/utils/hashing.d.ts +50 -6
- package/lib/esm/utils/hashing.js +49 -5
- package/lib/esm/utils/index.d.ts +1 -0
- package/lib/esm/utils/index.js +2 -1
- package/lib/esm/utils/registry.d.ts +3 -3
- package/lib/esm/utils/registry.js +1 -1
- package/lib/esm/utils/serialization.d.ts +1 -1
- package/lib/esm/utils/serialization.js +4 -3
- package/lib/esm/utils/strings.d.ts +4 -4
- package/lib/esm/utils/strings.js +5 -5
- package/lib/esm/utils/types.d.ts +123 -16
- package/lib/esm/utils/types.js +1 -1
- package/lib/esm/validation/Validators/DateValidator.d.ts +40 -8
- package/lib/esm/validation/Validators/DateValidator.js +41 -9
- package/lib/esm/validation/Validators/DiffValidator.d.ts +3 -3
- package/lib/esm/validation/Validators/DiffValidator.js +3 -3
- package/lib/esm/validation/Validators/EmailValidator.d.ts +39 -7
- package/lib/esm/validation/Validators/EmailValidator.js +40 -8
- package/lib/esm/validation/Validators/EqualsValidator.d.ts +3 -3
- package/lib/esm/validation/Validators/EqualsValidator.js +3 -3
- package/lib/esm/validation/Validators/GreaterThanOrEqualValidator.d.ts +3 -3
- package/lib/esm/validation/Validators/GreaterThanOrEqualValidator.js +3 -3
- package/lib/esm/validation/Validators/GreaterThanValidator.d.ts +3 -3
- package/lib/esm/validation/Validators/GreaterThanValidator.js +3 -3
- package/lib/esm/validation/Validators/LessThanOrEqualValidator.d.ts +3 -3
- package/lib/esm/validation/Validators/LessThanOrEqualValidator.js +3 -3
- package/lib/esm/validation/Validators/LessThanValidator.d.ts +3 -3
- package/lib/esm/validation/Validators/LessThanValidator.js +3 -3
- package/lib/esm/validation/Validators/ListValidator.d.ts +44 -6
- package/lib/esm/validation/Validators/ListValidator.js +45 -7
- package/lib/esm/validation/Validators/MaxValidator.d.ts +52 -6
- package/lib/esm/validation/Validators/MaxValidator.js +53 -7
- package/lib/esm/validation/Validators/MinValidator.d.ts +52 -6
- package/lib/esm/validation/Validators/MinValidator.js +53 -7
- package/lib/esm/validation/Validators/PatternValidator.d.ts +75 -9
- package/lib/esm/validation/Validators/PatternValidator.js +76 -10
- package/lib/esm/validation/Validators/RequiredValidator.d.ts +52 -6
- package/lib/esm/validation/Validators/RequiredValidator.js +53 -7
- package/lib/esm/validation/Validators/TypeValidator.d.ts +60 -6
- package/lib/esm/validation/Validators/TypeValidator.js +69 -7
- package/lib/esm/validation/Validators/URLValidator.d.ts +41 -7
- package/lib/esm/validation/Validators/URLValidator.js +42 -8
- package/lib/esm/validation/Validators/Validator.d.ts +76 -16
- package/lib/esm/validation/Validators/Validator.js +68 -11
- package/lib/esm/validation/Validators/ValidatorRegistry.d.ts +1 -7
- package/lib/esm/validation/Validators/ValidatorRegistry.js +4 -11
- package/lib/esm/validation/decorators.d.ts +50 -40
- package/lib/esm/validation/decorators.js +108 -59
- package/lib/esm/validation/types.d.ts +163 -30
- package/lib/esm/validation/types.js +1 -1
- package/lib/index.cjs +7 -39
- package/lib/index.d.ts +5 -37
- package/lib/model/Model.cjs +114 -51
- package/lib/model/Model.d.ts +107 -35
- package/lib/model/constants.cjs +4 -4
- package/lib/model/constants.d.ts +3 -3
- package/lib/model/construction.cjs +4 -4
- package/lib/model/construction.d.ts +3 -3
- package/lib/model/decorators.cjs +3 -4
- package/lib/model/decorators.d.ts +3 -3
- package/lib/model/index.cjs +2 -1
- package/lib/model/index.d.ts +1 -0
- package/lib/model/types.cjs +1 -1
- package/lib/model/types.d.ts +30 -11
- package/lib/model/utils.cjs +15 -0
- package/lib/model/utils.d.ts +3 -0
- package/lib/model/validation.cjs +11 -12
- package/lib/model/validation.d.ts +5 -5
- package/lib/utils/Decoration.cjs +196 -0
- package/lib/utils/Decoration.d.ts +123 -0
- package/lib/utils/constants.cjs +29 -11
- package/lib/utils/constants.d.ts +27 -9
- package/lib/utils/dates.cjs +28 -18
- package/lib/utils/dates.d.ts +26 -16
- package/lib/utils/decorators.cjs +42 -1
- package/lib/utils/decorators.d.ts +41 -0
- package/lib/utils/hashing.cjs +49 -5
- package/lib/utils/hashing.d.ts +50 -6
- package/lib/utils/index.cjs +2 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/registry.cjs +1 -1
- package/lib/utils/registry.d.ts +3 -3
- package/lib/utils/serialization.cjs +5 -4
- package/lib/utils/serialization.d.ts +1 -1
- package/lib/utils/strings.cjs +5 -5
- package/lib/utils/strings.d.ts +4 -4
- package/lib/utils/types.cjs +1 -1
- package/lib/utils/types.d.ts +123 -16
- package/lib/validation/Validation.cjs +1 -1
- package/lib/validation/Validators/DateValidator.cjs +41 -9
- package/lib/validation/Validators/DateValidator.d.ts +40 -8
- package/lib/validation/Validators/DiffValidator.cjs +3 -3
- package/lib/validation/Validators/DiffValidator.d.ts +3 -3
- package/lib/validation/Validators/EmailValidator.cjs +40 -8
- package/lib/validation/Validators/EmailValidator.d.ts +39 -7
- package/lib/validation/Validators/EqualsValidator.cjs +3 -3
- package/lib/validation/Validators/EqualsValidator.d.ts +3 -3
- package/lib/validation/Validators/GreaterThanOrEqualValidator.cjs +3 -3
- package/lib/validation/Validators/GreaterThanOrEqualValidator.d.ts +3 -3
- package/lib/validation/Validators/GreaterThanValidator.cjs +3 -3
- package/lib/validation/Validators/GreaterThanValidator.d.ts +3 -3
- package/lib/validation/Validators/LessThanOrEqualValidator.cjs +3 -3
- package/lib/validation/Validators/LessThanOrEqualValidator.d.ts +3 -3
- package/lib/validation/Validators/LessThanValidator.cjs +3 -3
- package/lib/validation/Validators/LessThanValidator.d.ts +3 -3
- package/lib/validation/Validators/ListValidator.cjs +45 -7
- package/lib/validation/Validators/ListValidator.d.ts +44 -6
- package/lib/validation/Validators/MaxLengthValidator.cjs +1 -1
- package/lib/validation/Validators/MaxValidator.cjs +53 -7
- package/lib/validation/Validators/MaxValidator.d.ts +52 -6
- package/lib/validation/Validators/MinLengthValidator.cjs +1 -1
- package/lib/validation/Validators/MinValidator.cjs +53 -7
- package/lib/validation/Validators/MinValidator.d.ts +52 -6
- package/lib/validation/Validators/PasswordValidator.cjs +1 -1
- package/lib/validation/Validators/PatternValidator.cjs +76 -10
- package/lib/validation/Validators/PatternValidator.d.ts +75 -9
- package/lib/validation/Validators/RequiredValidator.cjs +53 -7
- package/lib/validation/Validators/RequiredValidator.d.ts +52 -6
- package/lib/validation/Validators/StepValidator.cjs +1 -1
- package/lib/validation/Validators/TypeValidator.cjs +71 -9
- package/lib/validation/Validators/TypeValidator.d.ts +60 -6
- package/lib/validation/Validators/URLValidator.cjs +42 -8
- package/lib/validation/Validators/URLValidator.d.ts +41 -7
- package/lib/validation/Validators/Validator.cjs +69 -12
- package/lib/validation/Validators/Validator.d.ts +76 -16
- package/lib/validation/Validators/ValidatorRegistry.cjs +4 -12
- package/lib/validation/Validators/ValidatorRegistry.d.ts +1 -7
- package/lib/validation/Validators/constants.cjs +2 -2
- package/lib/validation/Validators/decorators.cjs +2 -2
- package/lib/validation/Validators/index.cjs +1 -1
- package/lib/validation/Validators/utils.cjs +3 -3
- package/lib/validation/decorators.cjs +111 -62
- package/lib/validation/decorators.d.ts +50 -40
- package/lib/validation/index.cjs +1 -1
- package/lib/validation/types.cjs +1 -1
- package/lib/validation/types.d.ts +163 -30
- package/package.json +2 -1
|
@@ -1,28 +1,54 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
2
|
import { ModelConstructor } from "../model/types";
|
|
3
3
|
/**
|
|
4
|
-
* @
|
|
5
|
-
* @
|
|
4
|
+
* @description Property decorator that marks a field as required
|
|
5
|
+
* @summary Marks the property as required, causing validation to fail if the property is undefined, null, or empty.
|
|
6
|
+
* Validators to validate a decorated property must use key {@link ValidationKeys#REQUIRED}.
|
|
7
|
+
* This decorator is commonly used as the first validation step for important fields.
|
|
6
8
|
*
|
|
7
|
-
* @param {string} [message]
|
|
9
|
+
* @param {string} [message] - The error message to display when validation fails. Defaults to {@link DEFAULT_ERROR_MESSAGES#REQUIRED}
|
|
10
|
+
* @return {PropertyDecorator} A decorator function that can be applied to class properties
|
|
8
11
|
*
|
|
9
12
|
* @function required
|
|
10
|
-
*
|
|
11
13
|
* @category Decorators
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* class User {
|
|
18
|
+
* @required()
|
|
19
|
+
* username: string;
|
|
20
|
+
*
|
|
21
|
+
* @required("Email address is mandatory")
|
|
22
|
+
* email: string;
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
12
25
|
*/
|
|
13
|
-
export declare function required(message?: string): (target:
|
|
26
|
+
export declare function required(message?: string): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
|
|
14
27
|
/**
|
|
15
|
-
* @
|
|
16
|
-
* @
|
|
28
|
+
* @description Property decorator that enforces a minimum value constraint
|
|
29
|
+
* @summary Defines a minimum value for the property, causing validation to fail if the property value is less than the specified minimum.
|
|
30
|
+
* Validators to validate a decorated property must use key {@link ValidationKeys#MIN}.
|
|
31
|
+
* This decorator works with numeric values and dates.
|
|
17
32
|
*
|
|
18
|
-
* @param {number | Date} value
|
|
19
|
-
* @param {string} [message]
|
|
33
|
+
* @param {number | Date | string} value - The minimum value allowed. For dates, can be a Date object or a string that can be converted to a date
|
|
34
|
+
* @param {string} [message] - The error message to display when validation fails. Defaults to {@link DEFAULT_ERROR_MESSAGES#MIN}
|
|
35
|
+
* @return {PropertyDecorator} A decorator function that can be applied to class properties
|
|
20
36
|
*
|
|
21
37
|
* @function min
|
|
22
|
-
* @memberOf module:decorator-validation.Decorators.Validation
|
|
23
38
|
* @category Decorators
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* class Product {
|
|
43
|
+
* @min(0)
|
|
44
|
+
* price: number;
|
|
45
|
+
*
|
|
46
|
+
* @min(new Date(2023, 0, 1), "Date must be after January 1, 2023")
|
|
47
|
+
* releaseDate: Date;
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
24
50
|
*/
|
|
25
|
-
export declare function min(value: number | Date | string, message?: string): (target:
|
|
51
|
+
export declare function min(value: number | Date | string, message?: string): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
|
|
26
52
|
/**
|
|
27
53
|
* @summary Defines a maximum value for the property
|
|
28
54
|
* @description Validators to validate a decorated property must use key {@link ValidationKeys#MAX}
|
|
@@ -31,10 +57,9 @@ export declare function min(value: number | Date | string, message?: string): (t
|
|
|
31
57
|
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#MAX}
|
|
32
58
|
*
|
|
33
59
|
* @function max
|
|
34
|
-
* @memberOf module:decorator-validation.Decorators.Validation
|
|
35
60
|
* @category Decorators
|
|
36
61
|
*/
|
|
37
|
-
export declare function max(value: number | Date | string, message?: string): (target:
|
|
62
|
+
export declare function max(value: number | Date | string, message?: string): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
|
|
38
63
|
/**
|
|
39
64
|
* @summary Defines a step value for the property
|
|
40
65
|
* @description Validators to validate a decorated property must use key {@link ValidationKeys#STEP}
|
|
@@ -43,10 +68,9 @@ export declare function max(value: number | Date | string, message?: string): (t
|
|
|
43
68
|
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#STEP}
|
|
44
69
|
*
|
|
45
70
|
* @function step
|
|
46
|
-
* @memberOf module:decorator-validation.Decorators.Validation
|
|
47
71
|
* @category Decorators
|
|
48
72
|
*/
|
|
49
|
-
export declare function step(value: number, message?: string): (target:
|
|
73
|
+
export declare function step(value: number, message?: string): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
|
|
50
74
|
/**
|
|
51
75
|
* @summary Defines a minimum length for the property
|
|
52
76
|
* @description Validators to validate a decorated property must use key {@link ValidationKeys#MIN_LENGTH}
|
|
@@ -55,10 +79,9 @@ export declare function step(value: number, message?: string): (target: object,
|
|
|
55
79
|
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#MIN_LENGTH}
|
|
56
80
|
*
|
|
57
81
|
* @function minlength
|
|
58
|
-
* @memberOf module:decorator-validation.Decorators.Validation
|
|
59
82
|
* @category Decorators
|
|
60
83
|
*/
|
|
61
|
-
export declare function minlength(value: number, message?: string): (target:
|
|
84
|
+
export declare function minlength(value: number, message?: string): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
|
|
62
85
|
/**
|
|
63
86
|
* @summary Defines a maximum length for the property
|
|
64
87
|
* @description Validators to validate a decorated property must use key {@link ValidationKeys#MAX_LENGTH}
|
|
@@ -67,10 +90,9 @@ export declare function minlength(value: number, message?: string): (target: obj
|
|
|
67
90
|
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#MAX_LENGTH}
|
|
68
91
|
*
|
|
69
92
|
* @function maxlength
|
|
70
|
-
* @memberOf module:decorator-validation.Decorators.Validation
|
|
71
93
|
* @category Decorators
|
|
72
94
|
*/
|
|
73
|
-
export declare function maxlength(value: number, message?: string): (target:
|
|
95
|
+
export declare function maxlength(value: number, message?: string): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
|
|
74
96
|
/**
|
|
75
97
|
* @summary Defines a RegExp pattern the property must respect
|
|
76
98
|
* @description Validators to validate a decorated property must use key {@link ValidationKeys#PATTERN}
|
|
@@ -79,10 +101,9 @@ export declare function maxlength(value: number, message?: string): (target: obj
|
|
|
79
101
|
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#PATTERN}
|
|
80
102
|
*
|
|
81
103
|
* @function pattern
|
|
82
|
-
* @memberOf module:decorator-validation.Decorators.Validation
|
|
83
104
|
* @category Decorators
|
|
84
105
|
*/
|
|
85
|
-
export declare function pattern(value: RegExp | string, message?: string): (target:
|
|
106
|
+
export declare function pattern(value: RegExp | string, message?: string): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
|
|
86
107
|
/**
|
|
87
108
|
* @summary Defines the property as an email
|
|
88
109
|
* @description Validators to validate a decorated property must use key {@link ValidationKeys#EMAIL}
|
|
@@ -90,10 +111,9 @@ export declare function pattern(value: RegExp | string, message?: string): (targ
|
|
|
90
111
|
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#EMAIL}
|
|
91
112
|
*
|
|
92
113
|
* @function email
|
|
93
|
-
* @memberOf module:decorator-validation.Decorators.Validation
|
|
94
114
|
* @category Decorators
|
|
95
115
|
*/
|
|
96
|
-
export declare function email(message?: string): (target:
|
|
116
|
+
export declare function email(message?: string): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
|
|
97
117
|
/**
|
|
98
118
|
* @summary Defines the property as an URL
|
|
99
119
|
* @description Validators to validate a decorated property must use key {@link ValidationKeys#URL}
|
|
@@ -101,10 +121,9 @@ export declare function email(message?: string): (target: object, propertyKey?:
|
|
|
101
121
|
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#URL}
|
|
102
122
|
*
|
|
103
123
|
* @function url
|
|
104
|
-
* @memberOf module:decorator-validation.Decorators.Validation
|
|
105
124
|
* @category Decorators
|
|
106
125
|
*/
|
|
107
|
-
export declare function url(message?: string): (target:
|
|
126
|
+
export declare function url(message?: string): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
|
|
108
127
|
/**
|
|
109
128
|
* @summary Enforces type verification
|
|
110
129
|
* @description Validators to validate a decorated property must use key {@link ValidationKeys#TYPE}
|
|
@@ -113,10 +132,9 @@ export declare function url(message?: string): (target: object, propertyKey?: st
|
|
|
113
132
|
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#TYPE}
|
|
114
133
|
*
|
|
115
134
|
* @function type
|
|
116
|
-
* @memberOf module:decorator-validation.Decorators.Validation
|
|
117
135
|
* @category Decorators
|
|
118
136
|
*/
|
|
119
|
-
export declare function type(types: string[] | string, message?: string): (target:
|
|
137
|
+
export declare function type(types: string[] | string, message?: string): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
|
|
120
138
|
/**
|
|
121
139
|
* @summary Date Handler Decorator
|
|
122
140
|
* @description Validators to validate a decorated property must use key {@link ValidationKeys#DATE}
|
|
@@ -125,28 +143,24 @@ export declare function type(types: string[] | string, message?: string): (targe
|
|
|
125
143
|
*
|
|
126
144
|
* @param {string} format accepted format according to {@link formatDate}
|
|
127
145
|
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#DATE}
|
|
128
|
-
* @param {Constructor<Validator>} [validator] the Validator to be used. Defaults to {@link DateValidator}
|
|
129
146
|
*
|
|
130
147
|
* @function date
|
|
131
148
|
*
|
|
132
|
-
* @memberOf module:decorator-validation.Decorators.Validation
|
|
133
149
|
* @category Decorators
|
|
134
150
|
*/
|
|
135
|
-
export declare function date(format?: string, message?: string): (target:
|
|
151
|
+
export declare function date(format?: string, message?: string): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
|
|
136
152
|
/**
|
|
137
153
|
* @summary Password Handler Decorator
|
|
138
154
|
* @description Validators to validate a decorated property must use key {@link ValidationKeys#PASSWORD}
|
|
139
155
|
*
|
|
140
|
-
* @param {RegExp} [pattern] defaults to {@link
|
|
156
|
+
* @param {RegExp} [pattern] defaults to {@link DEFAULT_PATTERNS#CHAR8_ONE_OF_EACH}
|
|
141
157
|
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#PASSWORD}
|
|
142
|
-
* @param {Constructor<Validator>} [validator] Defaults to {@link PasswordValidator}
|
|
143
158
|
*
|
|
144
159
|
* @function password
|
|
145
160
|
*
|
|
146
|
-
* @memberOf module:decorator-validation.Decorators.Validation
|
|
147
161
|
* @category Decorators
|
|
148
162
|
*/
|
|
149
|
-
export declare function password(pattern?: RegExp, message?: string): (target:
|
|
163
|
+
export declare function password(pattern?: RegExp, message?: string): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
|
|
150
164
|
/**
|
|
151
165
|
* @summary List Decorator
|
|
152
166
|
* @description Also sets the {@link type} to the provided collection
|
|
@@ -154,28 +168,24 @@ export declare function password(pattern?: RegExp, message?: string): (target: o
|
|
|
154
168
|
* @param {ModelConstructor} clazz
|
|
155
169
|
* @param {string} [collection] The collection being used. defaults to Array
|
|
156
170
|
* @param {string} [message] defaults to {@link DEFAULT_ERROR_MESSAGES#LIST}
|
|
157
|
-
* @param {Constructor<Validator>} [validator] defaults to {@link ListValidator}
|
|
158
171
|
*
|
|
159
172
|
* @function list
|
|
160
173
|
*
|
|
161
|
-
* @memberOf module:decorator-validation.Decorators.Validation
|
|
162
174
|
* @category Decorators
|
|
163
175
|
*/
|
|
164
|
-
export declare function list(clazz: ModelConstructor<any> | ModelConstructor<any>[], collection?: "Array" | "Set", message?: string): (target:
|
|
176
|
+
export declare function list(clazz: ModelConstructor<any> | ModelConstructor<any>[], collection?: "Array" | "Set", message?: string): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
|
|
165
177
|
/**
|
|
166
178
|
* @summary Set Decorator
|
|
167
179
|
* @description Wrapper for {@link list} with the 'Set' Collection
|
|
168
180
|
*
|
|
169
181
|
* @param {ModelConstructor} clazz
|
|
170
182
|
* @param {string} [message] defaults to {@link DEFAULT_ERROR_MESSAGES#LIST}
|
|
171
|
-
* @param {Constructor<Validator>} [validator]
|
|
172
183
|
*
|
|
173
184
|
* @function set
|
|
174
185
|
*
|
|
175
|
-
* @memberOf module:decorator-validation.Decorators.Validation
|
|
176
186
|
* @category Decorators
|
|
177
187
|
*/
|
|
178
|
-
export declare function set(clazz: ModelConstructor<any>, message?: string): (target:
|
|
188
|
+
export declare function set(clazz: ModelConstructor<any>, message?: string): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
|
|
179
189
|
/**
|
|
180
190
|
* @summary Declares that the decorated property must be equal to another specified property.
|
|
181
191
|
* @description Applies the {@link ValidationKeys.EQUALS} validator to ensure the decorated value matches the value of the given property.
|