@nattyjs/validation-decorators 0.0.1-beta.71 → 0.0.1-beta.72
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/index.cjs +2 -2
- package/dist/index.d.ts +213 -213
- package/dist/index.mjs +2 -0
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
const ValidatorNames = {
|
|
6
4
|
required: "required",
|
|
7
5
|
allOf: "allOf",
|
|
@@ -714,9 +712,11 @@ class ApplicationUtil {
|
|
|
714
712
|
static lowerCaseWithTrim(value) {
|
|
715
713
|
return typeof value === "string" ? value.toLowerCase().trim() : String(value).toLowerCase().trim();
|
|
716
714
|
}
|
|
715
|
+
/** Check if a value is an object */
|
|
717
716
|
static isObject(value) {
|
|
718
717
|
return Object.prototype.toString.call(value) === "[object Object]";
|
|
719
718
|
}
|
|
719
|
+
/** Check if a value is an object */
|
|
720
720
|
static isArray(value) {
|
|
721
721
|
return Array.isArray(value);
|
|
722
722
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
interface BaseValidatorConfig {
|
|
2
|
-
message?: string;
|
|
3
|
-
conditionalExpression?: Function;
|
|
4
|
-
messageKey?: string;
|
|
1
|
+
interface BaseValidatorConfig {
|
|
2
|
+
message?: string;
|
|
3
|
+
conditionalExpression?: Function;
|
|
4
|
+
messageKey?: string;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
interface ArrayConfig extends BaseValidatorConfig {
|
|
8
|
-
matchValues?: any[];
|
|
7
|
+
interface ArrayConfig extends BaseValidatorConfig {
|
|
8
|
+
matchValues?: any[];
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
declare function allOf(config?: ArrayConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
12
12
|
|
|
13
|
-
interface RequiredConfig extends BaseValidatorConfig {
|
|
13
|
+
interface RequiredConfig extends BaseValidatorConfig {
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
declare function required(config?: RequiredConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
17
17
|
|
|
18
|
-
declare enum NumericValueType {
|
|
19
|
-
PositiveNumber = 1,
|
|
20
|
-
NegativeNumber = 2,
|
|
21
|
-
Both = 3
|
|
18
|
+
declare enum NumericValueType {
|
|
19
|
+
PositiveNumber = 1,
|
|
20
|
+
NegativeNumber = 2,
|
|
21
|
+
Both = 3
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
interface NumericConfig extends BaseValidatorConfig {
|
|
25
|
-
allowDecimal?: boolean;
|
|
26
|
-
acceptValue?: NumericValueType;
|
|
27
|
-
isFormat?: boolean;
|
|
28
|
-
digitsInfo?: string;
|
|
29
|
-
persistZero?: boolean;
|
|
24
|
+
interface NumericConfig extends BaseValidatorConfig {
|
|
25
|
+
allowDecimal?: boolean;
|
|
26
|
+
acceptValue?: NumericValueType;
|
|
27
|
+
isFormat?: boolean;
|
|
28
|
+
digitsInfo?: string;
|
|
29
|
+
persistZero?: boolean;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
declare function numeric(config?: NumericConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
33
33
|
|
|
34
|
-
interface AlphaConfig extends BaseValidatorConfig {
|
|
35
|
-
allowWhiteSpace?: boolean;
|
|
36
|
-
locale?: string;
|
|
37
|
-
allowCharacters?: string;
|
|
34
|
+
interface AlphaConfig extends BaseValidatorConfig {
|
|
35
|
+
allowWhiteSpace?: boolean;
|
|
36
|
+
locale?: string;
|
|
37
|
+
allowCharacters?: string;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
declare function alpha(config?: AlphaConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
@@ -43,16 +43,16 @@ declare function alphaNumeric(config?: AlphaConfig): (target: any, propertyKey:
|
|
|
43
43
|
|
|
44
44
|
declare function ascii(config?: BaseValidatorConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
45
45
|
|
|
46
|
-
interface ContainsConfig extends BaseValidatorConfig {
|
|
47
|
-
value?: string;
|
|
48
|
-
values?: any[];
|
|
46
|
+
interface ContainsConfig extends BaseValidatorConfig {
|
|
47
|
+
value?: string;
|
|
48
|
+
values?: any[];
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
declare function contains(config: ContainsConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
52
52
|
|
|
53
|
-
interface CreditCardConfig extends BaseValidatorConfig {
|
|
54
|
-
creditCardTypes?: string[];
|
|
55
|
-
fieldName?: string;
|
|
53
|
+
interface CreditCardConfig extends BaseValidatorConfig {
|
|
54
|
+
creditCardTypes?: string[];
|
|
55
|
+
fieldName?: string;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
declare function creditCard(config: CreditCardConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
@@ -63,75 +63,75 @@ declare function dataUri(config?: BaseValidatorConfig): (target: any, propertyKe
|
|
|
63
63
|
|
|
64
64
|
declare function date(config?: BaseValidatorConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
65
65
|
|
|
66
|
-
interface FieldConfig extends BaseValidatorConfig {
|
|
67
|
-
fieldName?: string;
|
|
66
|
+
interface FieldConfig extends BaseValidatorConfig {
|
|
67
|
+
fieldName?: string;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
interface DifferentConfig extends FieldConfig {
|
|
70
|
+
interface DifferentConfig extends FieldConfig {
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
declare function different(config: DifferentConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
74
74
|
|
|
75
|
-
interface DigitConfig extends BaseValidatorConfig {
|
|
75
|
+
interface DigitConfig extends BaseValidatorConfig {
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
declare function digit(config?: DigitConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
79
79
|
|
|
80
|
-
interface EmailConfig extends BaseValidatorConfig {
|
|
80
|
+
interface EmailConfig extends BaseValidatorConfig {
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
declare function email(config?: EmailConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
84
84
|
|
|
85
|
-
interface DefaultConfig extends BaseValidatorConfig {
|
|
86
|
-
value?: string;
|
|
85
|
+
interface DefaultConfig extends BaseValidatorConfig {
|
|
86
|
+
value?: string;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
interface StringValueConfig extends DefaultConfig {
|
|
90
|
-
values?: any[];
|
|
89
|
+
interface StringValueConfig extends DefaultConfig {
|
|
90
|
+
values?: any[];
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
declare function endsWith(config: StringValueConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
94
94
|
|
|
95
95
|
declare function even(config?: BaseValidatorConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
96
96
|
|
|
97
|
-
interface ExtensionConfig extends BaseValidatorConfig {
|
|
98
|
-
extensions?: string[];
|
|
99
|
-
isExcludeExtensions?: boolean;
|
|
97
|
+
interface ExtensionConfig extends BaseValidatorConfig {
|
|
98
|
+
extensions?: string[];
|
|
99
|
+
isExcludeExtensions?: boolean;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
declare function extension(config: ExtensionConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
103
103
|
|
|
104
|
-
interface FactorConfig extends BaseValidatorConfig {
|
|
105
|
-
dividend?: number;
|
|
106
|
-
fieldName?: string;
|
|
104
|
+
interface FactorConfig extends BaseValidatorConfig {
|
|
105
|
+
dividend?: number;
|
|
106
|
+
fieldName?: string;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
declare function factor(config?: FactorConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
110
110
|
|
|
111
|
-
interface RelationalOperatorConfig extends BaseValidatorConfig {
|
|
112
|
-
fieldName?: string;
|
|
113
|
-
value?: any;
|
|
114
|
-
isArrayControl?: boolean;
|
|
111
|
+
interface RelationalOperatorConfig extends BaseValidatorConfig {
|
|
112
|
+
fieldName?: string;
|
|
113
|
+
value?: any;
|
|
114
|
+
isArrayControl?: boolean;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
declare function greaterThanEqualTo(config: RelationalOperatorConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
118
118
|
|
|
119
119
|
declare function greaterThan(config: RelationalOperatorConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
120
120
|
|
|
121
|
-
interface MessageConfig extends BaseValidatorConfig {
|
|
121
|
+
interface MessageConfig extends BaseValidatorConfig {
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
declare function hexColor(config?: MessageConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
125
125
|
|
|
126
|
-
declare enum IpVersion {
|
|
127
|
-
V4 = 1,
|
|
128
|
-
V6 = 2,
|
|
129
|
-
AnyOne = 3
|
|
126
|
+
declare enum IpVersion {
|
|
127
|
+
V4 = 1,
|
|
128
|
+
V6 = 2,
|
|
129
|
+
AnyOne = 3
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
interface IpConfig extends BaseValidatorConfig {
|
|
133
|
-
version?: IpVersion;
|
|
134
|
-
isCidr?: boolean;
|
|
132
|
+
interface IpConfig extends BaseValidatorConfig {
|
|
133
|
+
version?: IpVersion;
|
|
134
|
+
isCidr?: boolean;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
declare function ip(config?: IpConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
@@ -154,45 +154,45 @@ declare function lowerCase(config?: MessageConfig): (target: any, propertyKey: s
|
|
|
154
154
|
|
|
155
155
|
declare function mac(config?: BaseValidatorConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
156
156
|
|
|
157
|
-
interface DateConfig extends BaseValidatorConfig {
|
|
158
|
-
value?: Date | string;
|
|
159
|
-
fieldName?: string;
|
|
160
|
-
allowISODate?: boolean;
|
|
157
|
+
interface DateConfig extends BaseValidatorConfig {
|
|
158
|
+
value?: Date | string;
|
|
159
|
+
fieldName?: string;
|
|
160
|
+
allowISODate?: boolean;
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
interface MaxDateConfig extends DateConfig {
|
|
164
|
-
operator?: "<" | "<=";
|
|
163
|
+
interface MaxDateConfig extends DateConfig {
|
|
164
|
+
operator?: "<" | "<=";
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
declare function maxDate(config: MaxDateConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
168
168
|
|
|
169
|
-
interface NumberConfig extends BaseValidatorConfig {
|
|
170
|
-
value?: number;
|
|
169
|
+
interface NumberConfig extends BaseValidatorConfig {
|
|
170
|
+
value?: number;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
declare function maxLength(config: NumberConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
174
174
|
|
|
175
175
|
declare function maxNumber(config: NumberConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
176
176
|
|
|
177
|
-
interface TimeConfig extends BaseValidatorConfig {
|
|
178
|
-
allowSeconds?: boolean;
|
|
179
|
-
}
|
|
180
|
-
interface TimeRelationConfig extends BaseValidatorConfig {
|
|
181
|
-
value?: string;
|
|
182
|
-
fieldName?: string;
|
|
183
|
-
allowSeconds?: boolean;
|
|
184
|
-
}
|
|
185
|
-
interface MinTimeConfig extends TimeRelationConfig {
|
|
186
|
-
operator?: ">" | ">=";
|
|
187
|
-
}
|
|
188
|
-
interface MaxTimeConfig extends TimeRelationConfig {
|
|
189
|
-
operator?: "<" | "<=";
|
|
177
|
+
interface TimeConfig extends BaseValidatorConfig {
|
|
178
|
+
allowSeconds?: boolean;
|
|
179
|
+
}
|
|
180
|
+
interface TimeRelationConfig extends BaseValidatorConfig {
|
|
181
|
+
value?: string;
|
|
182
|
+
fieldName?: string;
|
|
183
|
+
allowSeconds?: boolean;
|
|
184
|
+
}
|
|
185
|
+
interface MinTimeConfig extends TimeRelationConfig {
|
|
186
|
+
operator?: ">" | ">=";
|
|
187
|
+
}
|
|
188
|
+
interface MaxTimeConfig extends TimeRelationConfig {
|
|
189
|
+
operator?: "<" | "<=";
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
declare function maxTime(config: MaxTimeConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
193
193
|
|
|
194
|
-
interface MinDateConfig extends DateConfig {
|
|
195
|
-
operator?: ">" | ">=";
|
|
194
|
+
interface MinDateConfig extends DateConfig {
|
|
195
|
+
operator?: ">" | ">=";
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
declare function minDate(config: MinDateConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
@@ -211,40 +211,40 @@ declare function odd(config?: BaseValidatorConfig): (target: any, propertyKey: s
|
|
|
211
211
|
|
|
212
212
|
declare function oneOf(config?: ArrayConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
213
213
|
|
|
214
|
-
interface PasswordValidation {
|
|
215
|
-
digit?: boolean;
|
|
216
|
-
alphabet?: boolean;
|
|
217
|
-
contains?: string;
|
|
218
|
-
lowerCase?: boolean;
|
|
219
|
-
upperCase?: boolean;
|
|
220
|
-
specialCharacter?: boolean;
|
|
221
|
-
minLength?: number;
|
|
222
|
-
maxLength?: number;
|
|
223
|
-
}
|
|
224
|
-
interface PasswordValidationMessage {
|
|
225
|
-
digit?: string;
|
|
226
|
-
alphabet?: string;
|
|
227
|
-
contains?: string;
|
|
228
|
-
lowerCase?: string;
|
|
229
|
-
upperCase?: string;
|
|
230
|
-
specialCharacter?: string;
|
|
231
|
-
minLength?: string;
|
|
232
|
-
maxLength?: string;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
interface PasswordConfig {
|
|
236
|
-
validation?: PasswordValidation;
|
|
237
|
-
conditionalExpression?: string | Function;
|
|
238
|
-
message?: PasswordValidationMessage | string;
|
|
239
|
-
messageKey?: PasswordValidationMessage | string;
|
|
214
|
+
interface PasswordValidation {
|
|
215
|
+
digit?: boolean;
|
|
216
|
+
alphabet?: boolean;
|
|
217
|
+
contains?: string;
|
|
218
|
+
lowerCase?: boolean;
|
|
219
|
+
upperCase?: boolean;
|
|
220
|
+
specialCharacter?: boolean;
|
|
221
|
+
minLength?: number;
|
|
222
|
+
maxLength?: number;
|
|
223
|
+
}
|
|
224
|
+
interface PasswordValidationMessage {
|
|
225
|
+
digit?: string;
|
|
226
|
+
alphabet?: string;
|
|
227
|
+
contains?: string;
|
|
228
|
+
lowerCase?: string;
|
|
229
|
+
upperCase?: string;
|
|
230
|
+
specialCharacter?: string;
|
|
231
|
+
minLength?: string;
|
|
232
|
+
maxLength?: string;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
interface PasswordConfig {
|
|
236
|
+
validation?: PasswordValidation;
|
|
237
|
+
conditionalExpression?: string | Function;
|
|
238
|
+
message?: PasswordValidationMessage | string;
|
|
239
|
+
messageKey?: PasswordValidationMessage | string;
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
declare function password(config: PasswordConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
243
243
|
|
|
244
|
-
interface PatternConfig extends BaseValidatorConfig {
|
|
245
|
-
expression?: {
|
|
246
|
-
[key: string]: RegExp;
|
|
247
|
-
};
|
|
244
|
+
interface PatternConfig extends BaseValidatorConfig {
|
|
245
|
+
expression?: {
|
|
246
|
+
[key: string]: RegExp;
|
|
247
|
+
};
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
declare function pattern(config: PatternConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
@@ -253,32 +253,32 @@ declare function port(config?: BaseValidatorConfig): (target: any, propertyKey:
|
|
|
253
253
|
|
|
254
254
|
declare function primeNumber(config?: BaseValidatorConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
255
255
|
|
|
256
|
-
interface RangeConfig extends BaseValidatorConfig {
|
|
257
|
-
minimumNumber?: number;
|
|
258
|
-
maximumNumber?: number;
|
|
256
|
+
interface RangeConfig extends BaseValidatorConfig {
|
|
257
|
+
minimumNumber?: number;
|
|
258
|
+
maximumNumber?: number;
|
|
259
259
|
}
|
|
260
260
|
|
|
261
261
|
declare function range(config: RangeConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
262
262
|
|
|
263
263
|
declare function requiredTrue(config?: RequiredConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
264
264
|
|
|
265
|
-
interface StringComparisonConfig extends DefaultConfig {
|
|
266
|
-
isRestrict?: boolean;
|
|
267
|
-
values?: any[];
|
|
265
|
+
interface StringComparisonConfig extends DefaultConfig {
|
|
266
|
+
isRestrict?: boolean;
|
|
267
|
+
values?: any[];
|
|
268
268
|
}
|
|
269
269
|
|
|
270
270
|
declare function startsWith(config: StringComparisonConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
271
271
|
|
|
272
272
|
declare function upperCase(config?: MessageConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
273
273
|
|
|
274
|
-
declare enum UrlValidationType {
|
|
275
|
-
FQDN = 1,
|
|
276
|
-
LocalHost = 2,
|
|
277
|
-
IntranetServer = 3
|
|
274
|
+
declare enum UrlValidationType {
|
|
275
|
+
FQDN = 1,
|
|
276
|
+
LocalHost = 2,
|
|
277
|
+
IntranetServer = 3
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
-
interface UrlConfig extends BaseValidatorConfig {
|
|
281
|
-
urlValidationType?: UrlValidationType;
|
|
280
|
+
interface UrlConfig extends BaseValidatorConfig {
|
|
281
|
+
urlValidationType?: UrlValidationType;
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
declare function url(config?: UrlConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
@@ -309,19 +309,19 @@ declare function trim(): (target: any, propertyKey: string, parameterIndex?: any
|
|
|
309
309
|
|
|
310
310
|
declare function whitelist(chars: string): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
311
311
|
|
|
312
|
-
interface SanitizeConfig {
|
|
313
|
-
custom: Function;
|
|
312
|
+
interface SanitizeConfig {
|
|
313
|
+
custom: Function;
|
|
314
314
|
}
|
|
315
315
|
|
|
316
316
|
declare function sanitize(config: SanitizeConfig): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
317
317
|
|
|
318
|
-
interface Type<T> extends Function {
|
|
319
|
-
new (...args: any[]): T;
|
|
318
|
+
interface Type<T> extends Function {
|
|
319
|
+
new (...args: any[]): T;
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
-
interface PropConfig$1 {
|
|
323
|
-
type?: Type<any>;
|
|
324
|
-
isArrayType?: boolean;
|
|
322
|
+
interface PropConfig$1 {
|
|
323
|
+
type?: Type<any>;
|
|
324
|
+
isArrayType?: boolean;
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
declare function prop(config?: PropConfig$1): (target: any, propertyKey: string, parameterIndex?: any) => void;
|
|
@@ -366,18 +366,18 @@ interface PropertyDecoratorConfig {
|
|
|
366
366
|
};
|
|
367
367
|
}
|
|
368
368
|
|
|
369
|
-
declare const decoratorRegistrationCaller: {
|
|
370
|
-
register: (config: PropertyDecoratorConfig) => {};
|
|
369
|
+
declare const decoratorRegistrationCaller: {
|
|
370
|
+
register: (config: PropertyDecoratorConfig) => {};
|
|
371
371
|
};
|
|
372
372
|
|
|
373
|
-
type ValidatorFn = null | {
|
|
374
|
-
[key: string]: any;
|
|
373
|
+
type ValidatorFn = null | {
|
|
374
|
+
[key: string]: any;
|
|
375
375
|
};
|
|
376
376
|
|
|
377
|
-
interface ValidatorParams {
|
|
378
|
-
root: any;
|
|
379
|
-
current: any;
|
|
380
|
-
value: any;
|
|
377
|
+
interface ValidatorParams {
|
|
378
|
+
root: any;
|
|
379
|
+
current: any;
|
|
380
|
+
value: any;
|
|
381
381
|
}
|
|
382
382
|
|
|
383
383
|
declare function alphaValidator(configModel: AlphaConfig, params: ValidatorParams): ValidatorFn;
|
|
@@ -392,8 +392,8 @@ declare function digitValidator(configModel: DigitConfig, control: ValidatorPara
|
|
|
392
392
|
|
|
393
393
|
declare function emailValidator(configModel: EmailConfig, control: ValidatorParams): ValidatorFn;
|
|
394
394
|
|
|
395
|
-
interface HexColorConfig extends BaseValidatorConfig {
|
|
396
|
-
isStrict?: boolean;
|
|
395
|
+
interface HexColorConfig extends BaseValidatorConfig {
|
|
396
|
+
isStrict?: boolean;
|
|
397
397
|
}
|
|
398
398
|
|
|
399
399
|
declare function hexColorValidator(configModel: HexColorConfig, control: ValidatorParams): ValidatorFn;
|
|
@@ -490,93 +490,93 @@ declare function minTimeValidator(configModel: MinTimeConfig, control: Validator
|
|
|
490
490
|
|
|
491
491
|
declare function maxTimeValidator(configModel: MaxTimeConfig, control: ValidatorParams): ValidatorFn;
|
|
492
492
|
|
|
493
|
-
declare const ControlValidators: {
|
|
494
|
-
required: typeof requiredValidator;
|
|
495
|
-
allOf: typeof allOfValidator;
|
|
496
|
-
alpha: typeof alphaValidator;
|
|
497
|
-
alphaNumeric: typeof alphaNumericValidator;
|
|
498
|
-
ascii: typeof asciiValidator;
|
|
499
|
-
contains: typeof containsValidator;
|
|
500
|
-
creditCard: typeof creditCardValidator;
|
|
501
|
-
cusip: typeof cusipValidator;
|
|
502
|
-
dataUri: typeof dataUriValidator;
|
|
503
|
-
date: typeof dateValidator;
|
|
504
|
-
different: typeof differentValidator;
|
|
505
|
-
digit: typeof digitValidator;
|
|
506
|
-
email: typeof emailValidator;
|
|
507
|
-
endsWith: typeof endsWithValidator;
|
|
508
|
-
even: typeof evenValidator;
|
|
509
|
-
extension: typeof extensionValidator;
|
|
510
|
-
factor: typeof factorValidator;
|
|
511
|
-
greaterThan: typeof greaterThanValidator;
|
|
512
|
-
greaterThanEqualTo: typeof greaterThanEqualToValidator;
|
|
513
|
-
grid: typeof gridValidator;
|
|
514
|
-
hexColor: typeof hexColorValidator;
|
|
515
|
-
ip: typeof ipValidator;
|
|
516
|
-
json: typeof jsonValidator;
|
|
517
|
-
latLong: typeof latLongValidator;
|
|
518
|
-
lattitude: typeof latitudeValidator;
|
|
519
|
-
leapYear: typeof leapYearValidator;
|
|
520
|
-
lessThanEqualTo: typeof lessThanEqualToValidator;
|
|
521
|
-
lessThan: typeof lessThanValidator;
|
|
522
|
-
longitude: typeof longitudeValidator;
|
|
523
|
-
lowercase: typeof lowercaseValidator;
|
|
524
|
-
mac: typeof macValidator;
|
|
525
|
-
maxDate: typeof maxDateValidator;
|
|
526
|
-
maxLength: typeof maxLengthValidator;
|
|
527
|
-
maxNumber: typeof maxNumberValidator;
|
|
528
|
-
maxTime: typeof maxTimeValidator;
|
|
529
|
-
minDate: typeof minDateValidator;
|
|
530
|
-
minLength: typeof minLengthValidator;
|
|
531
|
-
minNumber: typeof minNumberValidator;
|
|
532
|
-
minTime: typeof minTimeValidator;
|
|
533
|
-
noneOf: typeof noneOfValidator;
|
|
534
|
-
notEmpty: typeof notEmptyValidator;
|
|
535
|
-
numeric: typeof numericValidator;
|
|
536
|
-
odd: typeof oddValidator;
|
|
537
|
-
oneOf: typeof oneOfValidator;
|
|
538
|
-
password: typeof passwordValidator;
|
|
539
|
-
pattern: typeof patternValidator;
|
|
540
|
-
port: typeof portValidator;
|
|
541
|
-
primeNumber: typeof primeNumberValidator;
|
|
542
|
-
range: typeof rangeValidator;
|
|
543
|
-
startsWith: typeof startsWithValidator;
|
|
544
|
-
time: typeof timeValidator;
|
|
545
|
-
uppercase: typeof uppercaseValidator;
|
|
546
|
-
url: typeof urlValidator;
|
|
493
|
+
declare const ControlValidators: {
|
|
494
|
+
required: typeof requiredValidator;
|
|
495
|
+
allOf: typeof allOfValidator;
|
|
496
|
+
alpha: typeof alphaValidator;
|
|
497
|
+
alphaNumeric: typeof alphaNumericValidator;
|
|
498
|
+
ascii: typeof asciiValidator;
|
|
499
|
+
contains: typeof containsValidator;
|
|
500
|
+
creditCard: typeof creditCardValidator;
|
|
501
|
+
cusip: typeof cusipValidator;
|
|
502
|
+
dataUri: typeof dataUriValidator;
|
|
503
|
+
date: typeof dateValidator;
|
|
504
|
+
different: typeof differentValidator;
|
|
505
|
+
digit: typeof digitValidator;
|
|
506
|
+
email: typeof emailValidator;
|
|
507
|
+
endsWith: typeof endsWithValidator;
|
|
508
|
+
even: typeof evenValidator;
|
|
509
|
+
extension: typeof extensionValidator;
|
|
510
|
+
factor: typeof factorValidator;
|
|
511
|
+
greaterThan: typeof greaterThanValidator;
|
|
512
|
+
greaterThanEqualTo: typeof greaterThanEqualToValidator;
|
|
513
|
+
grid: typeof gridValidator;
|
|
514
|
+
hexColor: typeof hexColorValidator;
|
|
515
|
+
ip: typeof ipValidator;
|
|
516
|
+
json: typeof jsonValidator;
|
|
517
|
+
latLong: typeof latLongValidator;
|
|
518
|
+
lattitude: typeof latitudeValidator;
|
|
519
|
+
leapYear: typeof leapYearValidator;
|
|
520
|
+
lessThanEqualTo: typeof lessThanEqualToValidator;
|
|
521
|
+
lessThan: typeof lessThanValidator;
|
|
522
|
+
longitude: typeof longitudeValidator;
|
|
523
|
+
lowercase: typeof lowercaseValidator;
|
|
524
|
+
mac: typeof macValidator;
|
|
525
|
+
maxDate: typeof maxDateValidator;
|
|
526
|
+
maxLength: typeof maxLengthValidator;
|
|
527
|
+
maxNumber: typeof maxNumberValidator;
|
|
528
|
+
maxTime: typeof maxTimeValidator;
|
|
529
|
+
minDate: typeof minDateValidator;
|
|
530
|
+
minLength: typeof minLengthValidator;
|
|
531
|
+
minNumber: typeof minNumberValidator;
|
|
532
|
+
minTime: typeof minTimeValidator;
|
|
533
|
+
noneOf: typeof noneOfValidator;
|
|
534
|
+
notEmpty: typeof notEmptyValidator;
|
|
535
|
+
numeric: typeof numericValidator;
|
|
536
|
+
odd: typeof oddValidator;
|
|
537
|
+
oneOf: typeof oneOfValidator;
|
|
538
|
+
password: typeof passwordValidator;
|
|
539
|
+
pattern: typeof patternValidator;
|
|
540
|
+
port: typeof portValidator;
|
|
541
|
+
primeNumber: typeof primeNumberValidator;
|
|
542
|
+
range: typeof rangeValidator;
|
|
543
|
+
startsWith: typeof startsWithValidator;
|
|
544
|
+
time: typeof timeValidator;
|
|
545
|
+
uppercase: typeof uppercaseValidator;
|
|
546
|
+
url: typeof urlValidator;
|
|
547
547
|
};
|
|
548
548
|
|
|
549
|
-
interface FileConfig extends BaseValidatorConfig {
|
|
550
|
-
maxFiles?: number;
|
|
551
|
-
minFiles?: number;
|
|
549
|
+
interface FileConfig extends BaseValidatorConfig {
|
|
550
|
+
maxFiles?: number;
|
|
551
|
+
minFiles?: number;
|
|
552
552
|
}
|
|
553
553
|
|
|
554
|
-
interface IBANConfig extends BaseValidatorConfig {
|
|
555
|
-
countryCode?: string;
|
|
554
|
+
interface IBANConfig extends BaseValidatorConfig {
|
|
555
|
+
countryCode?: string;
|
|
556
556
|
}
|
|
557
557
|
|
|
558
|
-
interface MaskConfig extends BaseValidatorConfig {
|
|
559
|
-
mask: string;
|
|
560
|
-
minLength?: number;
|
|
561
|
-
valueWithMask?: boolean;
|
|
558
|
+
interface MaskConfig extends BaseValidatorConfig {
|
|
559
|
+
mask: string;
|
|
560
|
+
minLength?: number;
|
|
561
|
+
valueWithMask?: boolean;
|
|
562
562
|
}
|
|
563
563
|
|
|
564
|
-
interface FormConfig {
|
|
565
|
-
errorMessage?: ErrorMessage;
|
|
566
|
-
dateConfig?: {
|
|
567
|
-
seperator?: string;
|
|
568
|
-
format?: 'mdy' | 'dmy' | 'ymd';
|
|
569
|
-
};
|
|
570
|
-
}
|
|
571
|
-
interface ErrorMessage {
|
|
572
|
-
validator?: {
|
|
573
|
-
[key: string]: string;
|
|
574
|
-
};
|
|
564
|
+
interface FormConfig {
|
|
565
|
+
errorMessage?: ErrorMessage;
|
|
566
|
+
dateConfig?: {
|
|
567
|
+
seperator?: string;
|
|
568
|
+
format?: 'mdy' | 'dmy' | 'ymd';
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
interface ErrorMessage {
|
|
572
|
+
validator?: {
|
|
573
|
+
[key: string]: string;
|
|
574
|
+
};
|
|
575
575
|
}
|
|
576
576
|
|
|
577
|
-
declare const validationForms: {
|
|
578
|
-
formConfig: FormConfig;
|
|
579
|
-
configure(config: FormConfig): void;
|
|
577
|
+
declare const validationForms: {
|
|
578
|
+
formConfig: FormConfig;
|
|
579
|
+
configure(config: FormConfig): void;
|
|
580
580
|
};
|
|
581
581
|
|
|
582
582
|
export { AlphaConfig, ArrayConfig, BaseValidatorConfig, ContainsConfig, ControlValidators, CreditCardConfig, DateConfig, DefaultConfig, DifferentConfig, DigitConfig, EmailConfig, ExtensionConfig, FactorConfig, FieldConfig, FileConfig, FormConfig, HexColorConfig, IBANConfig, IpConfig, MaskConfig, MaxDateConfig, MaxTimeConfig, MessageConfig, MinDateConfig, MinTimeConfig, NumberConfig, NumericConfig, NumericValueType, PasswordConfig, PatternConfig, RangeConfig, RelationalOperatorConfig, RequiredConfig, StringComparisonConfig, StringValueConfig, TimeConfig, TimeRelationConfig, UrlConfig, ValidatorFn, allOf as decoratorAllOfValidation, alphaNumeric as decoratorAlphaNumericValidation, alpha as decoratorAlphaValidation, ascii as decoratorAsciiValidation, blacklist as decoratorBlacklistSanitizer, contains as decoratorContainsValidation, creditCard as decoratorCreditCardValidation, cusip as decoratorCusipValidation, dataUri as decoratorDataUriValidation, date as decoratorDateValidation, different as decoratorDifferentValdiation, digit as decoratorDigitValidation, email as decoratorEmailValidation, endsWith as decoratorEndsWithValidation, escape as decoratorEscapeSanitizer, even as decoratorEvenValidation, extension as decoratorExtensionValidation, factor as decoratorFactorValidation, greaterThanEqualTo as decoratorGreaterThanEqualToValidation, greaterThan as decoratorGreaterThanValidation, hexColor as decoratorHexColorValidation, ip as decoratorIpValidation, json as decoratorJsonValidation, latLong as decoratorLatLongValidation, latitude as decoratorLatitudeValdiation, leapYear as decoratorLeapYearValidation, lessThanEqualTo as decoratorLessThanEqualToValidation, lessThan as decoratorLessThanValidation, longitude as decoratorLongitudeValidation, lowerCase as decoratorLowercaseValidation, ltrim as decoratorLtrimSanitizer, mac as decoratorMacValidation, maxDate as decoratorMaxDateValidation, maxLength as decoratorMaxLengthValidation, maxNumber as decoratorMaxNumberValidation, maxTime as decoratorMaxTimeValidation, minDate as decoratorMinDateValidation, minLength as decoratorMinLengthValidation, minNumber as decoratorMinNumberValidation, minTime as decoratorMinTimeValidation, noneOf as decoratorNoneOfValidation, notEmpty as decoratorNotEmptyValidation, numeric as decoratorNumericValidation, odd as decoratorOddValidation, oneOf as decoratorOneOfValidation, password as decoratorPasswordValdiation, pattern as decoratorPatternValidation, port as decoratorPortValidation, prefix as decoratorPrefixSanitizer, primeNumber as decoratorPrimeNumberValidation, range as decoratorRangeValidation, decoratorRegistrationCaller, requiredTrue as decoratorRequiredTrueValidation, required as decoratorRequiredValidation, rtrim as decoratorRtrimSanitizer, sanitize as decoratorSanitizeSanitizer, startsWith as decoratorStartsWithValidation, stripLow as decoratorStripLowSanitizer, suffix as decoratorSuffixSanitizer, toBoolean as decoratorToBooleanSanitizer, toDate as decoratorToDateSanitizer, toInt as decoratorToIntSanitizer, toString as decoratorToStringSanitizer, trim as decoratorTrimSanitizer, upperCase as decoratorUpperCaseValidation, url as decoratorUrlValidation, whitelist as decoratorWhitelistSanitizer, prop, validationForms };
|
package/dist/index.mjs
CHANGED
|
@@ -710,9 +710,11 @@ class ApplicationUtil {
|
|
|
710
710
|
static lowerCaseWithTrim(value) {
|
|
711
711
|
return typeof value === "string" ? value.toLowerCase().trim() : String(value).toLowerCase().trim();
|
|
712
712
|
}
|
|
713
|
+
/** Check if a value is an object */
|
|
713
714
|
static isObject(value) {
|
|
714
715
|
return Object.prototype.toString.call(value) === "[object Object]";
|
|
715
716
|
}
|
|
717
|
+
/** Check if a value is an object */
|
|
716
718
|
static isArray(value) {
|
|
717
719
|
return Array.isArray(value);
|
|
718
720
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nattyjs/validation-decorators",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.72",
|
|
4
4
|
"description": "",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"scripts": {
|
|
12
|
-
"build": "unbuild"
|
|
12
|
+
"build": "node ../../node_modules/unbuild/dist/cli.mjs"
|
|
13
13
|
},
|
|
14
14
|
"author": "ajayojha",
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"unbuild": "
|
|
17
|
+
"unbuild": "1.2.1",
|
|
18
18
|
"@types/node": "20.3.1",
|
|
19
|
-
"@nattyjs/types": "0.0.1-beta.
|
|
19
|
+
"@nattyjs/types": "0.0.1-beta.72"
|
|
20
20
|
}
|
|
21
21
|
}
|