@decaf-ts/decorator-validation 1.5.2 → 1.5.5
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/LICENSE.md +0 -0
- package/README.md +34 -108
- package/dist/decorator-validation.js +2 -0
- package/dist/decorator-validation.js.LICENSE.txt +14 -0
- package/dist/esm/decorator-validation.js +2 -0
- package/dist/esm/decorator-validation.js.LICENSE.txt +14 -0
- package/lib/esm/index.d.ts +42 -0
- package/lib/esm/index.js +44 -0
- package/lib/esm/model/Model.d.ts +138 -0
- package/lib/esm/model/Model.js +298 -0
- package/lib/esm/model/ModelErrorDefinition.d.ts +22 -0
- package/lib/esm/model/ModelErrorDefinition.js +54 -0
- package/lib/esm/model/Registry.d.ts +59 -0
- package/lib/esm/model/Registry.js +75 -0
- package/lib/esm/model/constants.d.ts +56 -0
- package/lib/esm/model/constants.js +71 -0
- package/lib/esm/model/construction.d.ts +29 -0
- package/lib/esm/model/construction.js +65 -0
- package/lib/esm/model/decorators.d.ts +25 -0
- package/lib/esm/model/decorators.js +64 -0
- package/lib/esm/model/index.d.ts +9 -0
- package/lib/esm/model/index.js +11 -0
- package/lib/esm/model/types.d.ts +79 -0
- package/lib/esm/model/types.js +3 -0
- package/lib/esm/model/utils.d.ts +11 -0
- package/lib/esm/model/utils.js +27 -0
- package/lib/esm/model/validation.d.ts +14 -0
- package/lib/esm/model/validation.js +137 -0
- package/lib/esm/utils/constants.d.ts +26 -0
- package/lib/esm/utils/constants.js +29 -0
- package/lib/esm/utils/dates.d.ts +76 -0
- package/lib/esm/utils/dates.js +245 -0
- package/lib/esm/utils/decorators.d.ts +2 -0
- package/lib/esm/utils/decorators.js +20 -0
- package/lib/esm/utils/hashing.d.ts +52 -0
- package/lib/esm/utils/hashing.js +101 -0
- package/lib/esm/utils/index.d.ts +7 -0
- package/lib/esm/utils/index.js +9 -0
- package/lib/esm/utils/registry.d.ts +68 -0
- package/lib/esm/utils/registry.js +3 -0
- package/lib/esm/utils/serialization.d.ts +79 -0
- package/lib/esm/utils/serialization.js +90 -0
- package/lib/esm/utils/strings.d.ts +25 -0
- package/lib/esm/utils/strings.js +33 -0
- package/lib/esm/validation/Validation.d.ts +51 -0
- package/lib/esm/validation/Validation.js +73 -0
- package/lib/esm/validation/Validators/DateValidator.d.ts +28 -0
- package/lib/esm/validation/Validators/DateValidator.js +56 -0
- package/lib/esm/validation/Validators/EmailValidator.d.ts +28 -0
- package/lib/esm/validation/Validators/EmailValidator.js +52 -0
- package/lib/esm/validation/Validators/ListValidator.d.ts +28 -0
- package/lib/esm/validation/Validators/ListValidator.js +69 -0
- package/lib/esm/validation/Validators/MaxLengthValidator.d.ts +29 -0
- package/lib/esm/validation/Validators/MaxLengthValidator.js +54 -0
- package/lib/esm/validation/Validators/MaxValidator.d.ts +28 -0
- package/lib/esm/validation/Validators/MaxValidator.js +59 -0
- package/lib/esm/validation/Validators/MinLengthValidator.d.ts +29 -0
- package/lib/esm/validation/Validators/MinLengthValidator.js +54 -0
- package/lib/esm/validation/Validators/MinValidator.d.ts +28 -0
- package/lib/esm/validation/Validators/MinValidator.js +59 -0
- package/lib/esm/validation/Validators/PasswordValidator.d.ts +28 -0
- package/lib/esm/validation/Validators/PasswordValidator.js +52 -0
- package/lib/esm/validation/Validators/PatternValidator.d.ts +37 -0
- package/lib/esm/validation/Validators/PatternValidator.js +72 -0
- package/lib/esm/validation/Validators/RequiredValidator.d.ts +28 -0
- package/lib/esm/validation/Validators/RequiredValidator.js +59 -0
- package/lib/esm/validation/Validators/StepValidator.d.ts +29 -0
- package/lib/esm/validation/Validators/StepValidator.js +54 -0
- package/lib/esm/validation/Validators/TypeValidator.d.ts +25 -0
- package/lib/esm/validation/Validators/TypeValidator.js +62 -0
- package/lib/esm/validation/Validators/URLValidator.d.ts +27 -0
- package/lib/esm/validation/Validators/URLValidator.js +51 -0
- package/lib/esm/validation/Validators/Validator.d.ts +41 -0
- package/lib/esm/validation/Validators/Validator.js +49 -0
- package/lib/esm/validation/Validators/ValidatorRegistry.d.ts +47 -0
- package/lib/esm/validation/Validators/ValidatorRegistry.js +82 -0
- package/lib/esm/validation/Validators/constants.d.ts +96 -0
- package/lib/esm/validation/Validators/constants.js +136 -0
- package/lib/esm/validation/Validators/decorators.d.ts +12 -0
- package/lib/esm/validation/Validators/decorators.js +27 -0
- package/lib/esm/validation/Validators/index.d.ts +52 -0
- package/lib/esm/validation/Validators/index.js +54 -0
- package/lib/esm/validation/Validators/types.d.ts +88 -0
- package/lib/esm/validation/Validators/types.js +3 -0
- package/lib/esm/validation/decorators.d.ts +178 -0
- package/lib/esm/validation/decorators.js +290 -0
- package/lib/esm/validation/index.d.ts +4 -0
- package/lib/esm/validation/index.js +6 -0
- package/lib/esm/validation/types.d.ts +46 -0
- package/lib/esm/validation/types.js +3 -0
- package/lib/index.cjs +61 -0
- package/lib/index.d.ts +42 -0
- package/lib/model/Model.cjs +302 -0
- package/lib/model/Model.d.ts +138 -0
- package/lib/model/ModelErrorDefinition.cjs +58 -0
- package/lib/model/ModelErrorDefinition.d.ts +22 -0
- package/lib/model/Registry.cjs +80 -0
- package/lib/model/Registry.d.ts +59 -0
- package/lib/model/constants.cjs +74 -0
- package/lib/model/constants.d.ts +56 -0
- package/lib/model/construction.cjs +70 -0
- package/lib/model/construction.d.ts +29 -0
- package/lib/model/decorators.cjs +69 -0
- package/lib/model/decorators.d.ts +25 -0
- package/lib/model/index.cjs +27 -0
- package/lib/model/index.d.ts +9 -0
- package/lib/model/types.cjs +4 -0
- package/lib/model/types.d.ts +79 -0
- package/lib/model/utils.cjs +31 -0
- package/lib/model/utils.d.ts +11 -0
- package/lib/model/validation.cjs +140 -0
- package/lib/model/validation.d.ts +14 -0
- package/lib/utils/constants.cjs +32 -0
- package/lib/utils/constants.d.ts +26 -0
- package/lib/utils/dates.cjs +253 -0
- package/lib/utils/dates.d.ts +76 -0
- package/lib/utils/decorators.cjs +24 -0
- package/lib/utils/decorators.d.ts +2 -0
- package/lib/utils/hashing.cjs +108 -0
- package/lib/utils/hashing.d.ts +52 -0
- package/lib/utils/index.cjs +25 -0
- package/lib/utils/index.d.ts +7 -0
- package/lib/utils/registry.cjs +4 -0
- package/lib/utils/registry.d.ts +68 -0
- package/lib/utils/serialization.cjs +95 -0
- package/lib/utils/serialization.d.ts +79 -0
- package/lib/utils/strings.cjs +37 -0
- package/lib/utils/strings.d.ts +25 -0
- package/lib/validation/Validation.cjs +77 -0
- package/lib/validation/Validation.d.ts +51 -0
- package/lib/validation/Validators/DateValidator.cjs +59 -0
- package/lib/validation/Validators/DateValidator.d.ts +28 -0
- package/lib/validation/Validators/EmailValidator.cjs +55 -0
- package/lib/validation/Validators/EmailValidator.d.ts +28 -0
- package/lib/validation/Validators/ListValidator.cjs +72 -0
- package/lib/validation/Validators/ListValidator.d.ts +28 -0
- package/lib/validation/Validators/MaxLengthValidator.cjs +57 -0
- package/lib/validation/Validators/MaxLengthValidator.d.ts +29 -0
- package/lib/validation/Validators/MaxValidator.cjs +62 -0
- package/lib/validation/Validators/MaxValidator.d.ts +28 -0
- package/lib/validation/Validators/MinLengthValidator.cjs +57 -0
- package/lib/validation/Validators/MinLengthValidator.d.ts +29 -0
- package/lib/validation/Validators/MinValidator.cjs +62 -0
- package/lib/validation/Validators/MinValidator.d.ts +28 -0
- package/lib/validation/Validators/PasswordValidator.cjs +55 -0
- package/lib/validation/Validators/PasswordValidator.d.ts +28 -0
- package/lib/validation/Validators/PatternValidator.cjs +75 -0
- package/lib/validation/Validators/PatternValidator.d.ts +37 -0
- package/lib/validation/Validators/RequiredValidator.cjs +62 -0
- package/lib/validation/Validators/RequiredValidator.d.ts +28 -0
- package/lib/validation/Validators/StepValidator.cjs +57 -0
- package/lib/validation/Validators/StepValidator.d.ts +29 -0
- package/lib/validation/Validators/TypeValidator.cjs +65 -0
- package/lib/validation/Validators/TypeValidator.d.ts +25 -0
- package/lib/validation/Validators/URLValidator.cjs +54 -0
- package/lib/validation/Validators/URLValidator.d.ts +27 -0
- package/lib/validation/Validators/Validator.cjs +53 -0
- package/lib/validation/Validators/Validator.d.ts +41 -0
- package/lib/validation/Validators/ValidatorRegistry.cjs +87 -0
- package/lib/validation/Validators/ValidatorRegistry.d.ts +47 -0
- package/lib/validation/Validators/constants.cjs +139 -0
- package/lib/validation/Validators/constants.d.ts +96 -0
- package/lib/validation/Validators/decorators.cjs +30 -0
- package/lib/validation/Validators/decorators.d.ts +12 -0
- package/lib/validation/Validators/index.cjs +71 -0
- package/lib/validation/Validators/index.d.ts +52 -0
- package/lib/validation/Validators/types.d.ts +88 -0
- package/lib/validation/decorators.cjs +306 -0
- package/lib/validation/decorators.d.ts +178 -0
- package/lib/validation/index.cjs +22 -0
- package/lib/validation/index.d.ts +4 -0
- package/lib/validation/types.cjs +4 -0
- package/lib/validation/types.d.ts +46 -0
- package/package.json +18 -13
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
import { ModelConstructor } from "../model/types";
|
|
3
|
+
/**
|
|
4
|
+
* @summary Marks the property as required.
|
|
5
|
+
* @description Validators to validate a decorated property must use key {@link ValidationKeys#REQUIRED}
|
|
6
|
+
*
|
|
7
|
+
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#REQUIRED}
|
|
8
|
+
*
|
|
9
|
+
* @function required
|
|
10
|
+
*
|
|
11
|
+
* @category Decorators
|
|
12
|
+
*/
|
|
13
|
+
export declare function required(message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
|
|
14
|
+
/**
|
|
15
|
+
* @summary Defines a minimum value for the property
|
|
16
|
+
* @description Validators to validate a decorated property must use key {@link ValidationKeys#MIN}
|
|
17
|
+
*
|
|
18
|
+
* @param {number | Date} value
|
|
19
|
+
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#MIN}
|
|
20
|
+
*
|
|
21
|
+
* @function min
|
|
22
|
+
* @memberOf module:decorator-validation.Decorators.Validation
|
|
23
|
+
* @category Decorators
|
|
24
|
+
*/
|
|
25
|
+
export declare function min(value: number | Date | string, message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
|
|
26
|
+
/**
|
|
27
|
+
* @summary Defines a maximum value for the property
|
|
28
|
+
* @description Validators to validate a decorated property must use key {@link ValidationKeys#MAX}
|
|
29
|
+
*
|
|
30
|
+
* @param {number | Date} value
|
|
31
|
+
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#MAX}
|
|
32
|
+
*
|
|
33
|
+
* @function max
|
|
34
|
+
* @memberOf module:decorator-validation.Decorators.Validation
|
|
35
|
+
* @category Decorators
|
|
36
|
+
*/
|
|
37
|
+
export declare function max(value: number | Date | string, message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
|
|
38
|
+
/**
|
|
39
|
+
* @summary Defines a step value for the property
|
|
40
|
+
* @description Validators to validate a decorated property must use key {@link ValidationKeys#STEP}
|
|
41
|
+
*
|
|
42
|
+
* @param {number} value
|
|
43
|
+
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#STEP}
|
|
44
|
+
*
|
|
45
|
+
* @function step
|
|
46
|
+
* @memberOf module:decorator-validation.Decorators.Validation
|
|
47
|
+
* @category Decorators
|
|
48
|
+
*/
|
|
49
|
+
export declare function step(value: number, message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
|
|
50
|
+
/**
|
|
51
|
+
* @summary Defines a minimum length for the property
|
|
52
|
+
* @description Validators to validate a decorated property must use key {@link ValidationKeys#MIN_LENGTH}
|
|
53
|
+
*
|
|
54
|
+
* @param {string} value
|
|
55
|
+
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#MIN_LENGTH}
|
|
56
|
+
*
|
|
57
|
+
* @function minlength
|
|
58
|
+
* @memberOf module:decorator-validation.Decorators.Validation
|
|
59
|
+
* @category Decorators
|
|
60
|
+
*/
|
|
61
|
+
export declare function minlength(value: number, message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
|
|
62
|
+
/**
|
|
63
|
+
* @summary Defines a maximum length for the property
|
|
64
|
+
* @description Validators to validate a decorated property must use key {@link ValidationKeys#MAX_LENGTH}
|
|
65
|
+
*
|
|
66
|
+
* @param {string} value
|
|
67
|
+
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#MAX_LENGTH}
|
|
68
|
+
*
|
|
69
|
+
* @function maxlength
|
|
70
|
+
* @memberOf module:decorator-validation.Decorators.Validation
|
|
71
|
+
* @category Decorators
|
|
72
|
+
*/
|
|
73
|
+
export declare function maxlength(value: number, message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
|
|
74
|
+
/**
|
|
75
|
+
* @summary Defines a RegExp pattern the property must respect
|
|
76
|
+
* @description Validators to validate a decorated property must use key {@link ValidationKeys#PATTERN}
|
|
77
|
+
*
|
|
78
|
+
* @param {string} value
|
|
79
|
+
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#PATTERN}
|
|
80
|
+
*
|
|
81
|
+
* @function pattern
|
|
82
|
+
* @memberOf module:decorator-validation.Decorators.Validation
|
|
83
|
+
* @category Decorators
|
|
84
|
+
*/
|
|
85
|
+
export declare function pattern(value: RegExp | string, message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
|
|
86
|
+
/**
|
|
87
|
+
* @summary Defines the property as an email
|
|
88
|
+
* @description Validators to validate a decorated property must use key {@link ValidationKeys#EMAIL}
|
|
89
|
+
*
|
|
90
|
+
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#EMAIL}
|
|
91
|
+
*
|
|
92
|
+
* @function email
|
|
93
|
+
* @memberOf module:decorator-validation.Decorators.Validation
|
|
94
|
+
* @category Decorators
|
|
95
|
+
*/
|
|
96
|
+
export declare function email(message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
|
|
97
|
+
/**
|
|
98
|
+
* @summary Defines the property as an URL
|
|
99
|
+
* @description Validators to validate a decorated property must use key {@link ValidationKeys#URL}
|
|
100
|
+
*
|
|
101
|
+
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#URL}
|
|
102
|
+
*
|
|
103
|
+
* @function url
|
|
104
|
+
* @memberOf module:decorator-validation.Decorators.Validation
|
|
105
|
+
* @category Decorators
|
|
106
|
+
*/
|
|
107
|
+
export declare function url(message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
|
|
108
|
+
/**
|
|
109
|
+
* @summary Enforces type verification
|
|
110
|
+
* @description Validators to validate a decorated property must use key {@link ValidationKeys#TYPE}
|
|
111
|
+
*
|
|
112
|
+
* @param {string[] | string} types accepted types
|
|
113
|
+
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#TYPE}
|
|
114
|
+
*
|
|
115
|
+
* @function type
|
|
116
|
+
* @memberOf module:decorator-validation.Decorators.Validation
|
|
117
|
+
* @category Decorators
|
|
118
|
+
*/
|
|
119
|
+
export declare function type(types: string[] | string, message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
|
|
120
|
+
/**
|
|
121
|
+
* @summary Date Handler Decorator
|
|
122
|
+
* @description Validators to validate a decorated property must use key {@link ValidationKeys#DATE}
|
|
123
|
+
*
|
|
124
|
+
* Will enforce serialization according to the selected format
|
|
125
|
+
*
|
|
126
|
+
* @param {string} format accepted format according to {@link formatDate}
|
|
127
|
+
* @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
|
+
*
|
|
130
|
+
* @function date
|
|
131
|
+
*
|
|
132
|
+
* @memberOf module:decorator-validation.Decorators.Validation
|
|
133
|
+
* @category Decorators
|
|
134
|
+
*/
|
|
135
|
+
export declare function date(format?: string, message?: string): (target: Record<string, any>, propertyKey?: any) => any;
|
|
136
|
+
/**
|
|
137
|
+
* @summary Password Handler Decorator
|
|
138
|
+
* @description Validators to validate a decorated property must use key {@link ValidationKeys#PASSWORD}
|
|
139
|
+
*
|
|
140
|
+
* @param {RegExp} [pattern] defaults to {@link PasswordPatterns#CHAR8_ONE_OF_EACH}
|
|
141
|
+
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#PASSWORD}
|
|
142
|
+
* @param {Constructor<Validator>} [validator] Defaults to {@link PasswordValidator}
|
|
143
|
+
*
|
|
144
|
+
* @function password
|
|
145
|
+
*
|
|
146
|
+
* @memberOf module:decorator-validation.Decorators.Validation
|
|
147
|
+
* @category Decorators
|
|
148
|
+
*/
|
|
149
|
+
export declare function password(pattern?: RegExp, message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
|
|
150
|
+
/**
|
|
151
|
+
* @summary List Decorator
|
|
152
|
+
* @description Also sets the {@link type} to the provided collection
|
|
153
|
+
*
|
|
154
|
+
* @param {ModelConstructor} clazz
|
|
155
|
+
* @param {string} [collection] The collection being used. defaults to Array
|
|
156
|
+
* @param {string} [message] defaults to {@link DEFAULT_ERROR_MESSAGES#LIST}
|
|
157
|
+
* @param {Constructor<Validator>} [validator] defaults to {@link ListValidator}
|
|
158
|
+
*
|
|
159
|
+
* @function list
|
|
160
|
+
*
|
|
161
|
+
* @memberOf module:decorator-validation.Decorators.Validation
|
|
162
|
+
* @category Decorators
|
|
163
|
+
*/
|
|
164
|
+
export declare function list(clazz: ModelConstructor<any> | ModelConstructor<any>[], collection?: "Array" | "Set", message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
|
|
165
|
+
/**
|
|
166
|
+
* @summary Set Decorator
|
|
167
|
+
* @description Wrapper for {@link list} with the 'Set' Collection
|
|
168
|
+
*
|
|
169
|
+
* @param {ModelConstructor} clazz
|
|
170
|
+
* @param {string} [message] defaults to {@link DEFAULT_ERROR_MESSAGES#LIST}
|
|
171
|
+
* @param {Constructor<Validator>} [validator]
|
|
172
|
+
*
|
|
173
|
+
* @function set
|
|
174
|
+
*
|
|
175
|
+
* @memberOf module:decorator-validation.Decorators.Validation
|
|
176
|
+
* @category Decorators
|
|
177
|
+
*/
|
|
178
|
+
export declare function set(clazz: ModelConstructor<any>, message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Validators/index.cjs"), exports);
|
|
18
|
+
__exportStar(require("./decorators.cjs"), exports);
|
|
19
|
+
__exportStar(require("./types.cjs"), exports);
|
|
20
|
+
__exportStar(require("./Validation.cjs"), exports);
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy92YWxpZGF0aW9uL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSwrQ0FBNkI7QUFDN0IsK0NBQTZCO0FBQzdCLDBDQUF3QjtBQUN4QiwrQ0FBNkIiLCJmaWxlIjoidmFsaWRhdGlvbi9pbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gXCIuL1ZhbGlkYXRvcnNcIjtcbmV4cG9ydCAqIGZyb20gXCIuL2RlY29yYXRvcnNcIjtcbmV4cG9ydCAqIGZyb20gXCIuL3R5cGVzXCI7XG5leHBvcnQgKiBmcm9tIFwiLi9WYWxpZGF0aW9uXCI7XG4iXX0=
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
|
|
4
|
+
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy92YWxpZGF0aW9uL3R5cGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJmaWxlIjoidmFsaWRhdGlvbi90eXBlcy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IERlY29yYXRvck1ldGFkYXRhIH0gZnJvbSBcIkBkZWNhZi10cy9yZWZsZWN0aW9uXCI7XG5cbi8qKlxuICogQHN1bW1hcnkgVHlwZSBmb3IgdmFsaWRhdGlvbiBkZWNvcmF0b3IgbWV0YWRhdGFcbiAqIEBtZW1iZXJPZiBtb2R1bGU6ZGVjb3JhdG9yLXZhbGlkYXRpb24uUmVmbGVjdGlvblxuICogQGNhdGVnb3J5IFJlZmxlY3Rpb25cbiAqL1xuZXhwb3J0IHR5cGUgVmFsaWRhdGlvbk1ldGFkYXRhID0ge1xuICBbaW5kZXhlcjogc3RyaW5nXTogYW55O1xuICBhcmdzPzogYW55W107XG4gIG1lc3NhZ2U6IHN0cmluZztcbiAgdHlwZXM/OiBzdHJpbmdbXTtcbn07XG5cbi8qKlxuICogQHN1bW1hcnkgVHlwZSBmb3IgYSB2YWxpZGF0b3IgcHJvcGVydHkgZGVjb3JhdG9yIGRlZmluaXRpb25cbiAqIEBtZW1iZXJPZiBtb2R1bGU6ZGVjb3JhdG9yLXZhbGlkYXRpb24uVmFsaWRhdGlvblxuICogQGNhdGVnb3J5IFZhbGlkYXRpb25cbiAqL1xuZXhwb3J0IHR5cGUgVmFsaWRhdGlvblByb3BlcnR5RGVjb3JhdG9yRGVmaW5pdGlvbiA9IHtcbiAgcHJvcDogc3RyaW5nIHwgc3ltYm9sO1xuICBkZWNvcmF0b3JzOiBWYWxpZGF0aW9uRGVjb3JhdG9yRGVmaW5pdGlvbltdO1xufTtcblxuLyoqXG4gKiBAc3VtbWFyeSBUeXBlIGZvciBhIHZhbGlkYXRvciBkZWNvcmF0b3IgZGVmaW5pdGlvblxuICogQG1lbWJlck9mIG1vZHVsZTpkZWNvcmF0b3ItdmFsaWRhdGlvbi5WYWxpZGF0aW9uXG4gKiBAY2F0ZWdvcnkgVmFsaWRhdGlvblxuICovXG5leHBvcnQgdHlwZSBWYWxpZGF0aW9uRGVjb3JhdG9yRGVmaW5pdGlvbiA9IERlY29yYXRvck1ldGFkYXRhICYge1xuICBwcm9wczogVmFsaWRhdGlvbkVsZW1lbnREZWZpbml0aW9uO1xufTtcblxuLyoqXG4gKiBAc3VtbWFyeSBUeXBlIGZvciBhIHZhbGlkYXRvciBlbGVtZW50IG1ldGFkYXRhXG4gKiBAbWVtYmVyT2YgbW9kdWxlOmRlY29yYXRvci12YWxpZGF0aW9uLlZhbGlkYXRpb25cbiAqIEBjYXRlZ29yeSBWYWxpZGF0aW9uXG4gKi9cbmV4cG9ydCB0eXBlIFZhbGlkYXRpb25FbGVtZW50RGVmaW5pdGlvbiA9IHtcbiAgW2luZGV4ZXI6IHN0cmluZ106IGFueTtcblxuICB2YWx1ZT86IHN0cmluZyB8IG51bWJlcjtcbiAgbWVzc2FnZTogc3RyaW5nO1xuICB0eXBlcz86IHN0cmluZ1tdO1xufTtcblxuLyoqXG4gKiBAc3VtbWFyeSBUeXBlIGZvciBhIG1vZGVsIGVycm9yc1xuICogQG1lbWJlck9mIG1vZHVsZTpkZWNvcmF0b3ItdmFsaWRhdGlvbi5WYWxpZGF0aW9uXG4gKiBAY2F0ZWdvcnkgVmFsaWRhdGlvblxuICovXG5leHBvcnQgdHlwZSBNb2RlbEVycm9ycyA9IFJlY29yZDxzdHJpbmcsIFJlY29yZDxzdHJpbmcsIHN0cmluZyB8IHVuZGVmaW5lZD4+O1xuIl19
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { DecoratorMetadata } from "@decaf-ts/reflection";
|
|
2
|
+
/**
|
|
3
|
+
* @summary Type for validation decorator metadata
|
|
4
|
+
* @memberOf module:decorator-validation.Reflection
|
|
5
|
+
* @category Reflection
|
|
6
|
+
*/
|
|
7
|
+
export type ValidationMetadata = {
|
|
8
|
+
[indexer: string]: any;
|
|
9
|
+
args?: any[];
|
|
10
|
+
message: string;
|
|
11
|
+
types?: string[];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* @summary Type for a validator property decorator definition
|
|
15
|
+
* @memberOf module:decorator-validation.Validation
|
|
16
|
+
* @category Validation
|
|
17
|
+
*/
|
|
18
|
+
export type ValidationPropertyDecoratorDefinition = {
|
|
19
|
+
prop: string | symbol;
|
|
20
|
+
decorators: ValidationDecoratorDefinition[];
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* @summary Type for a validator decorator definition
|
|
24
|
+
* @memberOf module:decorator-validation.Validation
|
|
25
|
+
* @category Validation
|
|
26
|
+
*/
|
|
27
|
+
export type ValidationDecoratorDefinition = DecoratorMetadata & {
|
|
28
|
+
props: ValidationElementDefinition;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* @summary Type for a validator element metadata
|
|
32
|
+
* @memberOf module:decorator-validation.Validation
|
|
33
|
+
* @category Validation
|
|
34
|
+
*/
|
|
35
|
+
export type ValidationElementDefinition = {
|
|
36
|
+
[indexer: string]: any;
|
|
37
|
+
value?: string | number;
|
|
38
|
+
message: string;
|
|
39
|
+
types?: string[];
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* @summary Type for a model errors
|
|
43
|
+
* @memberOf module:decorator-validation.Validation
|
|
44
|
+
* @category Validation
|
|
45
|
+
*/
|
|
46
|
+
export type ModelErrors = Record<string, Record<string, string | undefined>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decaf-ts/decorator-validation",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.5",
|
|
4
4
|
"description": "simple decorator based validation engine",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
"update-scripts": "node ./bin/update-scripts.cjs",
|
|
14
14
|
"on-first-run": "node ./bin/update-scripts.cjs --boot",
|
|
15
15
|
"set-git-auth": "git config url.\"https://api:$(cat .token)@github.com/\".insteadOf \"https://github.com/\" && git config url.\"https://ssh:$(cat .token)@github.com/\".insteadOf \"ssh://git@github.com/\" && git config url.\"https://git:$(cat .token)@github.com/\".insteadOf \"git@github.com:\"",
|
|
16
|
-
"postinstall": "[ -z $CI ] && npm run on-first-run || echo 'CI detected, skipping on-first-run'",
|
|
17
16
|
"flash-forward": "npx npm-check-updates -u && npm run do-install",
|
|
18
17
|
"reset": "rm -rf * && git checkout . && git pull && npm run do-install",
|
|
19
18
|
"build": "rimraf ./lib && rimraf ./dist && gulp dev",
|
|
@@ -65,13 +64,16 @@
|
|
|
65
64
|
},
|
|
66
65
|
"homepage": "https://github.com/decaf-ts/decorator-validation#readme",
|
|
67
66
|
"devDependencies": {
|
|
67
|
+
"@eslint/js": "^9.23.0",
|
|
68
|
+
"@stylistic/eslint-plugin": "^4.2.0",
|
|
68
69
|
"@types/jest": "^29.5.14",
|
|
69
|
-
"@
|
|
70
|
+
"@types/prompts": "^2.4.9",
|
|
70
71
|
"clean-publish": "^5.1.0",
|
|
71
72
|
"dpdm": "^3.14.0",
|
|
72
|
-
"eslint": "^9.
|
|
73
|
+
"eslint": "^9.23.0",
|
|
73
74
|
"eslint-config-prettier": "^10.1.1",
|
|
74
75
|
"eslint-plugin-prettier": "^5.2.3",
|
|
76
|
+
"globals": "^16.0.0",
|
|
75
77
|
"gulp": "^5.0.0",
|
|
76
78
|
"gulp-if": "^3.0.0",
|
|
77
79
|
"gulp-rename": "^2.0.0",
|
|
@@ -81,31 +83,34 @@
|
|
|
81
83
|
"gulp-typescript": "^6.0.0-alpha.1",
|
|
82
84
|
"gulp-uglify": "^3.0.2",
|
|
83
85
|
"jest": "^29.7.0",
|
|
84
|
-
"jest-
|
|
86
|
+
"jest-html-reporters": "^3.1.7",
|
|
85
87
|
"jest-junit": "^16.0.0",
|
|
86
88
|
"jsdoc": "^4.0.4",
|
|
87
89
|
"jsdoc-mermaid": "^1.0.0",
|
|
88
90
|
"markdown-include": "^0.4.3",
|
|
89
91
|
"merge-stream": "^2.0.0",
|
|
92
|
+
"minimist": "^1.2.8",
|
|
90
93
|
"nodemon": "^3.1.9",
|
|
91
|
-
"npm-check-updates": "^17.1.
|
|
92
|
-
"prettier": "
|
|
94
|
+
"npm-check-updates": "^17.1.16",
|
|
95
|
+
"prettier": "3.5.3",
|
|
96
|
+
"prompts": "^2.4.2",
|
|
93
97
|
"rimraf": "^6.0.1",
|
|
94
98
|
"ts-jest": "^29.2.6",
|
|
95
99
|
"ts-loader": "^9.5.2",
|
|
96
100
|
"ts-node": "^10.9.2",
|
|
97
101
|
"typescript": "^5.8.2",
|
|
98
|
-
"typescript-eslint": "^8.
|
|
102
|
+
"typescript-eslint": "^8.27.0",
|
|
99
103
|
"vinyl-named": "^1.1.0",
|
|
104
|
+
"webpack-node-externals": "^3.0.0",
|
|
100
105
|
"webpack-stream": "^7.0.0"
|
|
101
106
|
},
|
|
102
|
-
"peerDependencies": {
|
|
103
|
-
"@decaf-ts/reflection": "latest",
|
|
104
|
-
"reflect-metadata": "^0.2.1"
|
|
105
|
-
},
|
|
106
107
|
"overrides": {
|
|
107
108
|
"gulp-run-command": {
|
|
108
109
|
"cross-spawn": "^7.0.6"
|
|
109
110
|
}
|
|
111
|
+
},
|
|
112
|
+
"peerDependencies": {
|
|
113
|
+
"@decaf-ts/reflection": "latest",
|
|
114
|
+
"reflect-metadata": "^0.2.1"
|
|
110
115
|
}
|
|
111
|
-
}
|
|
116
|
+
}
|