koatty_validation 1.0.6 → 1.1.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/index.js CHANGED
@@ -1,98 +1,1277 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Validated = exports.Valid = exports.PARAM_CHECK_KEY = exports.PARAM_RULE_KEY = exports.PARAM_TYPE_KEY = exports.plainToClass = exports.paramterTypes = exports.convertParamsType = exports.checkParamsType = exports.checkParams = void 0;
4
- const tslib_1 = require("tslib");
5
- /**
6
- * @ author: richen
7
- * @ copyright: Copyright (c) - <richenlin(at)gmail.com>
8
- * @ license: MIT
9
- * @ version: 2020-03-20 11:31:09
10
- */
11
- const helper = (0, tslib_1.__importStar)(require("koatty_lib"));
12
- const lib_1 = require("./lib");
13
- const koatty_container_1 = require("koatty_container");
14
- // export for manual verification
15
- var lib_2 = require("./lib");
16
- Object.defineProperty(exports, "checkParams", { enumerable: true, get: function () { return lib_2.checkParams; } });
17
- Object.defineProperty(exports, "checkParamsType", { enumerable: true, get: function () { return lib_2.checkParamsType; } });
18
- Object.defineProperty(exports, "convertParamsType", { enumerable: true, get: function () { return lib_2.convertParamsType; } });
19
- Object.defineProperty(exports, "paramterTypes", { enumerable: true, get: function () { return lib_2.paramterTypes; } });
20
- Object.defineProperty(exports, "plainToClass", { enumerable: true, get: function () { return lib_2.plainToClass; } });
21
- Object.defineProperty(exports, "PARAM_TYPE_KEY", { enumerable: true, get: function () { return lib_2.PARAM_TYPE_KEY; } });
22
- Object.defineProperty(exports, "PARAM_RULE_KEY", { enumerable: true, get: function () { return lib_2.PARAM_RULE_KEY; } });
23
- Object.defineProperty(exports, "PARAM_CHECK_KEY", { enumerable: true, get: function () { return lib_2.PARAM_CHECK_KEY; } });
24
- (0, tslib_1.__exportStar)(require("./util"), exports);
25
- // export decorators from class-validator
26
- // export { IsHash } from "class-validator";
27
- /**
28
- * Validation parameter's type and values.
29
- *
30
- * @export
31
- * @param {(ValidRules | ValidRules[] | Function)} rule
32
- * @param {string} [message]
33
- * @returns {ParameterDecorator}
34
- */
35
- function Valid(rule, message) {
36
- let rules = [];
37
- if (helper.isString(rule)) {
38
- rules = rule.split(",");
1
+ /*!
2
+ * @Author: richen
3
+ * @Date: 2022-02-16 18:31:49
4
+ * @License: BSD (3-Clause)
5
+ * @Copyright (c) - <richenlin(at)gmail.com>
6
+ * @HomePage: https://koatty.org/
7
+ */
8
+ 'use strict';
9
+
10
+ Object.defineProperty(exports, '__esModule', { value: true });
11
+
12
+ var helper = require('koatty_lib');
13
+ require('reflect-metadata');
14
+ var koatty_container = require('koatty_container');
15
+ var classValidator = require('class-validator');
16
+
17
+ function _interopNamespace(e) {
18
+ if (e && e.__esModule) return e;
19
+ var n = Object.create(null);
20
+ if (e) {
21
+ Object.keys(e).forEach(function (k) {
22
+ if (k !== 'default') {
23
+ var d = Object.getOwnPropertyDescriptor(e, k);
24
+ Object.defineProperty(n, k, d.get ? d : {
25
+ enumerable: true,
26
+ get: function () { return e[k]; }
27
+ });
28
+ }
29
+ });
39
30
  }
40
- else {
41
- rules = rule;
42
- }
43
- return (target, propertyKey, descriptor) => {
44
- // 获取成员参数类型
45
- const paramTypes = Reflect.getMetadata("design:paramtypes", target, propertyKey);
46
- const type = (paramTypes[descriptor] && paramTypes[descriptor].name) ? paramTypes[descriptor].name : "object";
47
- koatty_container_1.IOCContainer.attachPropertyData(lib_1.PARAM_RULE_KEY, {
48
- name: propertyKey,
49
- rule: rules,
50
- message,
51
- index: descriptor,
52
- type
53
- }, target, propertyKey);
54
- };
31
+ n["default"] = e;
32
+ return Object.freeze(n);
55
33
  }
56
- exports.Valid = Valid;
57
- /**
58
- * Validation parameter's type and values from DTO class.
59
- *
60
- * @export
61
- * @returns {MethodDecorator}
62
- */
63
- function Validated() {
64
- return (target, propertyKey, descriptor) => {
65
- //
66
- koatty_container_1.IOCContainer.savePropertyData(lib_1.PARAM_CHECK_KEY, {
67
- dtoCheck: 1
68
- }, target, propertyKey);
69
- // 获取成员参数类型
70
- // const paramTypes = Reflect.getMetadata("design:paramtypes", target, propertyKey) || [];
71
- // const { value, configurable, enumerable } = descriptor;
72
- // descriptor = {
73
- // configurable,
74
- // enumerable,
75
- // writable: true,
76
- // value: async function valid(...props: any[]) {
77
- // const ps: any[] = [];
78
- // // tslint:disable-next-line: no-unused-expression
79
- // (props || []).map((value: any, index: number) => {
80
- // const type = (paramTypes[index] && paramTypes[index].name) ? paramTypes[index].name : "any";
81
- // if (!paramterTypes[type]) {
82
- // ps.push(ClassValidator.valid(paramTypes[index], value, true));
83
- // } else {
84
- // ps.push(Promise.resolve(value));
85
- // }
86
- // });
87
- // if (ps.length > 0) {
88
- // props = await Promise.all(ps);
89
- // }
90
- // // tslint:disable-next-line: no-invalid-this
91
- // return value.apply(this, props);
92
- // }
93
- // };
94
- // return descriptor;
95
- };
34
+
35
+ var helper__namespace = /*#__PURE__*/_interopNamespace(helper);
36
+
37
+ /**
38
+ * @ author: richen
39
+ * @ copyright: Copyright (c) - <richenlin(at)gmail.com>
40
+ * @ license: MIT
41
+ * @ version: 2020-03-20 11:34:38
42
+ */
43
+ /**
44
+ * Set property as included in the process of transformation.
45
+ *
46
+ * @export
47
+ * @param {Object} object
48
+ * @param {(string | symbol)} propertyName
49
+ */
50
+ function setExpose(object, propertyName) {
51
+ const types = Reflect.getMetadata("design:type", object, propertyName);
52
+ if (types) {
53
+ const originMap = koatty_container.getOriginMetadata(PARAM_TYPE_KEY, object);
54
+ originMap.set(propertyName, types.name);
55
+ }
56
+ }
57
+ /**
58
+ *
59
+ *
60
+ * @export
61
+ * @param {*} clazz
62
+ * @param {*} data
63
+ * @param {boolean} [convert=false]
64
+ * @returns
65
+ */
66
+ function plainToClass(clazz, data, convert = false) {
67
+ if (helper__namespace.isClass(clazz)) {
68
+ let cls;
69
+ if (!helper__namespace.isObject(data)) {
70
+ data = {};
71
+ }
72
+ if (data instanceof clazz) {
73
+ cls = data;
74
+ }
75
+ else {
76
+ cls = Reflect.construct(clazz, []);
77
+ }
78
+ if (convert) {
79
+ return convertDtoParamsType(clazz, cls, data);
80
+ }
81
+ return Object.assign(cls, data);
82
+ }
83
+ return data;
84
+ }
85
+ /**
86
+ * convertDtoParamsType
87
+ *
88
+ * @param {*} clazz
89
+ * @param {*} cls
90
+ * @param {*} data
91
+ * @returns {*}
92
+ */
93
+ function convertDtoParamsType(clazz, cls, data) {
94
+ if (Object.prototype.hasOwnProperty.call(cls, "_typeDef")) {
95
+ for (const key in cls) {
96
+ if (Object.prototype.hasOwnProperty.call(data, key)
97
+ && Object.prototype.hasOwnProperty.call(cls._typeDef, key)) {
98
+ data[key] = convertParamsType(data[key], cls._typeDef[key]);
99
+ }
100
+ }
101
+ }
102
+ else {
103
+ const originMap = koatty_container.getOriginMetadata(PARAM_TYPE_KEY, clazz);
104
+ for (const [key, type] of originMap) {
105
+ if (key && Object.prototype.hasOwnProperty.call(data, key)) {
106
+ cls[key] = convertParamsType(data[key], type);
107
+ }
108
+ }
109
+ }
110
+ return cls;
111
+ }
112
+ /**
113
+ * 绑定参数类型转换
114
+ *
115
+ * @param {*} param
116
+ * @param {string} type
117
+ * @returns {*}
118
+ */
119
+ function convertParamsType(param, type) {
120
+ try {
121
+ switch (type) {
122
+ case "Number":
123
+ case "number":
124
+ if (helper__namespace.isNaN(param)) {
125
+ return NaN;
126
+ }
127
+ if (helper__namespace.isNumber(param)) {
128
+ return param;
129
+ }
130
+ if (helper__namespace.isNumberString(param)) {
131
+ return helper__namespace.toNumber(param);
132
+ }
133
+ return NaN;
134
+ case "Boolean":
135
+ case "boolean":
136
+ return !!param;
137
+ case "Array":
138
+ case "array":
139
+ case "Tuple":
140
+ case "tuple":
141
+ if (helper__namespace.isArray(param)) {
142
+ return param;
143
+ }
144
+ return helper__namespace.toArray(param);
145
+ case "String":
146
+ case "string":
147
+ if (helper__namespace.isString(param)) {
148
+ return param;
149
+ }
150
+ return helper__namespace.toString(param);
151
+ case "Null":
152
+ case "null":
153
+ return null;
154
+ case "Undefined":
155
+ case "undefined":
156
+ return undefined;
157
+ case "Bigint":
158
+ case "bigint":
159
+ if (typeof param === 'bigint') {
160
+ return param;
161
+ }
162
+ return BigInt(param);
163
+ // case "object":
164
+ // case "enum":
165
+ default: //any
166
+ return param;
167
+ }
168
+ }
169
+ catch (err) {
170
+ return param;
171
+ }
172
+ }
173
+ /**
174
+ * Check the base types.
175
+ *
176
+ * @param {*} value
177
+ * @param {string} type
178
+ * @returns {*}
179
+ */
180
+ function checkParamsType(value, type) {
181
+ switch (type) {
182
+ case "Number":
183
+ case "number":
184
+ if (!helper__namespace.isNumber(value) || helper__namespace.isNaN(value)) {
185
+ return false;
186
+ }
187
+ return true;
188
+ case "Boolean":
189
+ case "boolean":
190
+ if (!helper__namespace.isBoolean(value)) {
191
+ return false;
192
+ }
193
+ return true;
194
+ case "Array":
195
+ case "array":
196
+ case "Tuple":
197
+ case "tuple":
198
+ if (!helper__namespace.isArray(value)) {
199
+ return false;
200
+ }
201
+ return true;
202
+ case "String":
203
+ case "string":
204
+ if (!helper__namespace.isString(value)) {
205
+ return false;
206
+ }
207
+ return true;
208
+ case "Object":
209
+ case "object":
210
+ case "Enum":
211
+ case "enum":
212
+ if (helper__namespace.isTrueEmpty(value)) {
213
+ return false;
214
+ }
215
+ return true;
216
+ case "Null":
217
+ case "null":
218
+ if (!helper__namespace.isNull(value)) {
219
+ return false;
220
+ }
221
+ return true;
222
+ case "Undefined":
223
+ case "undefined":
224
+ if (!helper__namespace.isUndefined(value)) {
225
+ return false;
226
+ }
227
+ return true;
228
+ case "Bigint":
229
+ case "bigint":
230
+ if (typeof value !== 'bigint') {
231
+ return false;
232
+ }
233
+ return true;
234
+ default: //any
235
+ return true;
236
+ }
237
+ }
238
+ /**
239
+ * Checks if value is a chinese name.
240
+ *
241
+ * @param {string} value
242
+ * @returns {boolean}
243
+ */
244
+ function cnName(value) {
245
+ const reg = /^([a-zA-Z0-9\u4e00-\u9fa5\·]{1,10})$/;
246
+ return reg.test(value);
247
+ }
248
+ /**
249
+ * Checks if value is a idCard number.
250
+ *
251
+ * @param {string} value
252
+ * @returns
253
+ */
254
+ function idNumber(value) {
255
+ if (/^\d{15}$/.test(value)) {
256
+ return true;
257
+ }
258
+ if ((/^\d{17}[0-9X]$/).test(value)) {
259
+ const vs = '1,0,x,9,8,7,6,5,4,3,2'.split(',');
260
+ const ps = '7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2'.split(',');
261
+ const ss = value.toLowerCase().split('');
262
+ let r = 0;
263
+ for (let i = 0; i < 17; i++) {
264
+ r += ps[i] * ss[i];
265
+ }
266
+ const isOk = (vs[r % 11] === ss[17]);
267
+ return isOk;
268
+ }
269
+ return false;
270
+ }
271
+ /**
272
+ * Checks if value is a mobile phone number.
273
+ *
274
+ * @param {string} value
275
+ * @returns {boolean}
276
+ */
277
+ function mobile(value) {
278
+ const reg = /^(13|14|15|16|17|18|19)\d{9}$/;
279
+ return reg.test(value);
280
+ }
281
+ /**
282
+ * Checks if value is a zipCode.
283
+ *
284
+ * @param {string} value
285
+ * @returns {boolean}
286
+ */
287
+ function zipCode(value) {
288
+ const reg = /^\d{6}$/;
289
+ return reg.test(value);
290
+ }
291
+ /**
292
+ * Checks if value is a plateNumber.
293
+ *
294
+ * @param {string} value
295
+ * @returns {boolean}
296
+ */
297
+ function plateNumber(value) {
298
+ // let reg = new RegExp('^(([\u4e00-\u9fa5][a-zA-Z]|[\u4e00-\u9fa5]{2}\d{2}|[\u4e00-\u9fa5]{2}[a-zA-Z])[-]?|([wW][Jj][\u4e00-\u9fa5]{1}[-]?)|([a-zA-Z]{2}))([A-Za-z0-9]{5}|[DdFf][A-HJ-NP-Za-hj-np-z0-9][0-9]{4}|[0-9]{5}[DdFf])$');
299
+ // let xReg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/;
300
+ const xReg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/;
301
+ // let cReg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;
302
+ const cReg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;
303
+ if (value.length === 7) {
304
+ return cReg.test(value);
305
+ }
306
+ else {
307
+ //新能源车牌
308
+ return xReg.test(value);
309
+ }
310
+ }
311
+
312
+ /*
313
+ * @Description:
314
+ * @Usage:
315
+ * @Author: richen
316
+ * @Date: 2021-11-25 10:47:04
317
+ * @LastEditTime: 2021-11-25 11:07:02
318
+ */
319
+ // constant
320
+ const PARAM_TYPE_KEY = 'PARAM_TYPE_KEY';
321
+ const PARAM_RULE_KEY = 'PARAM_RULE_KEY';
322
+ const PARAM_CHECK_KEY = 'PARAM_CHECK_KEY';
323
+ const ENABLE_VALIDATED = "ENABLE_VALIDATED";
324
+ /**
325
+ * paramterTypes
326
+ *
327
+ * @export
328
+ * @enum {number}
329
+ */
330
+ exports.paramterTypes = void 0;
331
+ (function (paramterTypes) {
332
+ paramterTypes[paramterTypes["Number"] = 0] = "Number";
333
+ paramterTypes[paramterTypes["number"] = 1] = "number";
334
+ paramterTypes[paramterTypes["String"] = 2] = "String";
335
+ paramterTypes[paramterTypes["string"] = 3] = "string";
336
+ paramterTypes[paramterTypes["Boolean"] = 4] = "Boolean";
337
+ paramterTypes[paramterTypes["boolean"] = 5] = "boolean";
338
+ paramterTypes[paramterTypes["Array"] = 6] = "Array";
339
+ paramterTypes[paramterTypes["array"] = 7] = "array";
340
+ paramterTypes[paramterTypes["Tuple"] = 8] = "Tuple";
341
+ paramterTypes[paramterTypes["tuple"] = 9] = "tuple";
342
+ paramterTypes[paramterTypes["Object"] = 10] = "Object";
343
+ paramterTypes[paramterTypes["object"] = 11] = "object";
344
+ paramterTypes[paramterTypes["Enum"] = 12] = "Enum";
345
+ paramterTypes[paramterTypes["enum"] = 13] = "enum";
346
+ paramterTypes[paramterTypes["Bigint"] = 14] = "Bigint";
347
+ paramterTypes[paramterTypes["bigint"] = 15] = "bigint";
348
+ paramterTypes[paramterTypes["Null"] = 16] = "Null";
349
+ paramterTypes[paramterTypes["null"] = 17] = "null";
350
+ paramterTypes[paramterTypes["Undefined"] = 18] = "Undefined";
351
+ paramterTypes[paramterTypes["undefined"] = 19] = "undefined";
352
+ })(exports.paramterTypes || (exports.paramterTypes = {}));
353
+ class ValidateClass {
354
+ constructor() {
355
+ }
356
+ /**
357
+ *
358
+ *
359
+ * @static
360
+ * @returns
361
+ * @memberof ValidateUtil
362
+ */
363
+ static getInstance() {
364
+ return this.instance || (this.instance = new ValidateClass());
365
+ }
366
+ /**
367
+ * validated data vs dto class
368
+ *
369
+ * @param {*} Clazz
370
+ * @param {*} data
371
+ * @param {boolean} [convert=false] auto convert parameters type
372
+ * @returns {Promise<any>}
373
+ * @memberof ValidateClass
374
+ */
375
+ async valid(Clazz, data, convert = false) {
376
+ let obj = {};
377
+ if (data instanceof Clazz) {
378
+ obj = data;
379
+ }
380
+ else {
381
+ obj = plainToClass(Clazz, data, convert);
382
+ }
383
+ let errors = [];
384
+ if (convert) {
385
+ errors = await classValidator.validate(obj);
386
+ }
387
+ else {
388
+ errors = await classValidator.validate(obj, { skipMissingProperties: true });
389
+ }
390
+ if (errors.length > 0) {
391
+ const err = new Error(Object.values(errors[0].constraints)[0]);
392
+ err.code = 400;
393
+ err.status = 400;
394
+ throw err;
395
+ }
396
+ return obj;
397
+ }
398
+ }
399
+ /**
400
+ * ClassValidator for manual
401
+ */
402
+ const ClassValidator = ValidateClass.getInstance();
403
+ /**
404
+ * Validator Functions
405
+ */
406
+ const FunctionValidator = {
407
+ /**
408
+ * Checks if value matches ("===") the comparison.
409
+ */
410
+ Equals: (value, comparison) => {
411
+ return classValidator.equals(value, comparison);
412
+ },
413
+ /**
414
+ * Checks if value does not match ("!==") the comparison.
415
+ */
416
+ NotEquals: (value, comparison) => {
417
+ return classValidator.notEquals(value, comparison);
418
+ },
419
+ /**
420
+ * Checks if the string contains the seed. If given value is not a string, then it returns false.
421
+ */
422
+ Contains: (value, seed) => {
423
+ return classValidator.contains(value, seed);
424
+ },
425
+ /**
426
+ * Checks if given value is in a array of allowed values.
427
+ */
428
+ IsIn: (value, possibleValues) => {
429
+ return classValidator.isIn(value, possibleValues);
430
+ },
431
+ /**
432
+ * Checks if given value not in a array of allowed values.
433
+ */
434
+ IsNotIn: (value, possibleValues) => {
435
+ return classValidator.isNotIn(value, possibleValues);
436
+ },
437
+ /**
438
+ * Checks if a given value is a real date.
439
+ */
440
+ IsDate: (value) => {
441
+ return helper__namespace.isDate(value);
442
+ },
443
+ /**
444
+ * Checks if the first number is greater than or equal to the second.
445
+ */
446
+ Min: (num, min) => {
447
+ return helper__namespace.toNumber(num) >= min;
448
+ },
449
+ /**
450
+ * Checks if the first number is less than or equal to the second.
451
+ */
452
+ Max: (num, max) => {
453
+ return helper__namespace.toNumber(num) <= max;
454
+ },
455
+ /**
456
+ * Checks if the string's length falls in a range. Note: this function takes into account surrogate pairs.
457
+ * If given value is not a string, then it returns false.
458
+ */
459
+ Length: (value, min, max) => {
460
+ return classValidator.length(value, min, max);
461
+ },
462
+ /**
463
+ * Checks if the string is an email. If given value is not a string, then it returns false.
464
+ */
465
+ IsEmail: (value, options) => {
466
+ return classValidator.isEmail(value, options);
467
+ },
468
+ /**
469
+ * Checks if the string is an IP (version 4 or 6). If given value is not a string, then it returns false.
470
+ */
471
+ IsIP: (value, version) => {
472
+ return classValidator.isIP(value, version);
473
+ },
474
+ /**
475
+ * Checks if the string is a valid phone number.
476
+ * @param value — the potential phone number string to test
477
+ * @param region 2 characters uppercase country code (e.g. DE, US, CH). If users must enter the intl.
478
+ * prefix (e.g. +41), then you may pass "ZZ" or null as region.
479
+ * See [google-libphonenumber, metadata.js:countryCodeToRegionCodeMap on github]
480
+ * {@link https://github.com/ruimarinho/google-libphonenumber/blob/1e46138878cff479aafe2ce62175c6c49cb58720/src/metadata.js#L33}
481
+ */
482
+ IsPhoneNumber: (value, region) => {
483
+ return classValidator.isPhoneNumber(value, region);
484
+ },
485
+ /**
486
+ * Checks if the string is an url. If given value is not a string, then it returns false.
487
+ */
488
+ IsUrl: (value, options) => {
489
+ return classValidator.isURL(value, options);
490
+ },
491
+ /**
492
+ * check if the string is a hash of type algorithm. Algorithm is one of
493
+ * ['md4', 'md5', 'sha1', 'sha256', 'sha384', 'sha512', 'ripemd128', 'ripemd160', 'tiger128', 'tiger160', 'tiger192', 'crc32', 'crc32b']
494
+ */
495
+ IsHash: (value, algorithm) => {
496
+ return classValidator.isHash(value, algorithm);
497
+ },
498
+ /**
499
+ * Checks if value is a chinese name.
500
+ */
501
+ IsCnName: (value) => {
502
+ if (!helper__namespace.isString(value)) {
503
+ return false;
504
+ }
505
+ return cnName(value);
506
+ },
507
+ /**
508
+ * Checks if value is a idcard number.
509
+ */
510
+ IsIdNumber: (value) => {
511
+ if (!helper__namespace.isString(value)) {
512
+ return false;
513
+ }
514
+ return idNumber(value);
515
+ },
516
+ /**
517
+ * Checks if value is a zipCode.
518
+ */
519
+ IsZipCode: (value) => {
520
+ if (!helper__namespace.isString(value)) {
521
+ return false;
522
+ }
523
+ return zipCode(value);
524
+ },
525
+ /**
526
+ * Checks if value is a mobile phone number.
527
+ */
528
+ IsMobile: (value) => {
529
+ if (!helper__namespace.isString(value)) {
530
+ return false;
531
+ }
532
+ return mobile(value);
533
+ },
534
+ /**
535
+ * Checks if value is a plateNumber.
536
+ */
537
+ IsPlateNumber: (value) => {
538
+ if (!helper__namespace.isString(value)) {
539
+ return false;
540
+ }
541
+ return plateNumber(value);
542
+ },
543
+ /**
544
+ * Checks value is not empty, undefined, null, '', NaN, [], {} and any empty string(including spaces,
545
+ * tabs, formfeeds, etc.), returns false
546
+ */
547
+ IsNotEmpty: (value) => {
548
+ return !helper__namespace.isEmpty(value);
549
+ }
550
+ };
551
+ /**
552
+ * Use functions or built-in rules for validation.
553
+ *
554
+ * @export
555
+ * @param {string} name
556
+ * @param {*} value
557
+ * @param {string} type
558
+ * @param {(ValidRules | ValidRules[] | Function)} rule
559
+ * @param {string} [message]
560
+ * @param {boolean} [checkType=true]
561
+ * @returns
562
+ */
563
+ function ValidatorFuncs(name, value, type, rule, message, checkType = true) {
564
+ // check type
565
+ if (checkType && !checkParamsType(value, type)) {
566
+ const err = new Error(`TypeError: invalid arguments '${name}'.`);
567
+ err.code = 400;
568
+ err.status = 400;
569
+ throw err;
570
+ }
571
+ if (helper__namespace.isFunction(rule)) {
572
+ if (!rule(value)) {
573
+ const err = new Error(message || `ValidatorError: invalid arguments[${name}].`);
574
+ err.code = 400;
575
+ err.status = 400;
576
+ throw err;
577
+ }
578
+ return value;
579
+ }
580
+ else {
581
+ const funcs = rule;
582
+ if (helper__namespace.isString(rule)) {
583
+ funcs.push(rule);
584
+ }
585
+ if (funcs.some((it) => FunctionValidator[it] && !FunctionValidator[it](value))) {
586
+ const err = new Error(message || `ValidatorError: invalid arguments[${name}].`);
587
+ err.code = 400;
588
+ err.status = 400;
589
+ throw err;
590
+ }
591
+ }
592
+ return value;
96
593
  }
594
+
595
+ /*
596
+ * @Description:
597
+ * @Usage:
598
+ * @Author: richen
599
+ * @Date: 2021-11-25 10:46:57
600
+ * @LastEditTime: 2022-02-16 18:17:22
601
+ */
602
+ /**
603
+ * Validation parameter's type and values.
604
+ *
605
+ * @export
606
+ * @param {(ValidRules | ValidRules[] | Function)} rule
607
+ * @param {string} [message]
608
+ * @returns {ParameterDecorator}
609
+ */
610
+ function Valid(rule, message) {
611
+ let rules = [];
612
+ if (helper__namespace.isString(rule)) {
613
+ rules = rule.split(",");
614
+ }
615
+ else {
616
+ rules = rule;
617
+ }
618
+ return (target, propertyKey, descriptor) => {
619
+ // 获取成员参数类型
620
+ const paramTypes = Reflect.getMetadata("design:paramtypes", target, propertyKey);
621
+ const type = (paramTypes[descriptor] && paramTypes[descriptor].name) ? paramTypes[descriptor].name : "object";
622
+ koatty_container.IOCContainer.attachPropertyData(PARAM_RULE_KEY, {
623
+ name: propertyKey,
624
+ rule: rules,
625
+ message,
626
+ index: descriptor,
627
+ type
628
+ }, target, propertyKey);
629
+ };
630
+ }
631
+ /**
632
+ * Validation parameter's type and values from DTO class.
633
+ *
634
+ * @export
635
+ * @returns {MethodDecorator}
636
+ */
637
+ function Validated() {
638
+ return (target, propertyKey, descriptor) => {
639
+ //
640
+ koatty_container.IOCContainer.savePropertyData(PARAM_CHECK_KEY, {
641
+ dtoCheck: 1
642
+ }, target, propertyKey);
643
+ // 获取成员参数类型
644
+ // const paramTypes = Reflect.getMetadata("design:paramtypes", target, propertyKey) || [];
645
+ // const { value, configurable, enumerable } = descriptor;
646
+ // descriptor = {
647
+ // configurable,
648
+ // enumerable,
649
+ // writable: true,
650
+ // value: async function valid(...props: any[]) {
651
+ // const ps: any[] = [];
652
+ // // tslint:disable-next-line: no-unused-expression
653
+ // (props || []).map((value: any, index: number) => {
654
+ // const type = (paramTypes[index] && paramTypes[index].name) ? paramTypes[index].name : "any";
655
+ // if (!paramterTypes[type]) {
656
+ // ps.push(ClassValidator.valid(paramTypes[index], value, true));
657
+ // } else {
658
+ // ps.push(Promise.resolve(value));
659
+ // }
660
+ // });
661
+ // if (ps.length > 0) {
662
+ // props = await Promise.all(ps);
663
+ // }
664
+ // // tslint:disable-next-line: no-invalid-this
665
+ // return value.apply(this, props);
666
+ // }
667
+ // };
668
+ // return descriptor;
669
+ };
670
+ }
671
+ /**
672
+ * Marks property as included in the process of transformation.
673
+ *
674
+ * @export
675
+ * @returns {PropertyDecorator}
676
+ */
677
+ function Expose() {
678
+ return function (object, propertyName) {
679
+ const types = Reflect.getMetadata("design:type", object, propertyName);
680
+ if (types) {
681
+ const originMap = koatty_container.getOriginMetadata(PARAM_TYPE_KEY, object);
682
+ originMap.set(propertyName, types.name);
683
+ }
684
+ };
685
+ }
686
+ /**
687
+ * Identifies that the field needs to be defined
688
+ *
689
+ * @export
690
+ * @returns {PropertyDecorator}
691
+ */
692
+ function IsDefined() {
693
+ return function (object, propertyName) {
694
+ setExpose(object, propertyName);
695
+ };
696
+ }
697
+ /**
698
+ * Checks if value is a chinese name.
699
+ *
700
+ * @export
701
+ * @param {string} property
702
+ * @param {ValidationOptions} [validationOptions]
703
+ * @returns {PropertyDecorator}
704
+ */
705
+ function IsCnName(validationOptions) {
706
+ return function (object, propertyName) {
707
+ setExpose(object, propertyName);
708
+ classValidator.registerDecorator({
709
+ name: "IsCnName",
710
+ target: object.constructor,
711
+ propertyName,
712
+ options: validationOptions,
713
+ validator: {
714
+ validate(value, args) {
715
+ return cnName(value);
716
+ },
717
+ defaultMessage(args) {
718
+ return "invalid parameter ($property).";
719
+ }
720
+ }
721
+ });
722
+ };
723
+ }
724
+ /**
725
+ * Checks if value is a idCard number(chinese).
726
+ *
727
+ * @export
728
+ * @param {string} property
729
+ * @param {ValidationOptions} [validationOptions]
730
+ * @returns {PropertyDecorator}
731
+ */
732
+ function IsIdNumber(validationOptions) {
733
+ return function (object, propertyName) {
734
+ setExpose(object, propertyName);
735
+ classValidator.registerDecorator({
736
+ name: "IsIdNumber",
737
+ target: object.constructor,
738
+ propertyName,
739
+ options: validationOptions,
740
+ validator: {
741
+ validate(value, args) {
742
+ return idNumber(value);
743
+ },
744
+ defaultMessage(args) {
745
+ return "invalid parameter ($property).";
746
+ }
747
+ }
748
+ });
749
+ };
750
+ }
751
+ /**
752
+ * Checks if value is a zipCode(chinese).
753
+ *
754
+ * @export
755
+ * @param {string} property
756
+ * @param {ValidationOptions} [validationOptions]
757
+ * @returns {PropertyDecorator}
758
+ */
759
+ function IsZipCode(validationOptions) {
760
+ return function (object, propertyName) {
761
+ setExpose(object, propertyName);
762
+ classValidator.registerDecorator({
763
+ name: "IsZipCode",
764
+ target: object.constructor,
765
+ propertyName,
766
+ options: validationOptions,
767
+ validator: {
768
+ validate(value, args) {
769
+ return zipCode(value);
770
+ },
771
+ defaultMessage(args) {
772
+ return "invalid parameter ($property).";
773
+ }
774
+ }
775
+ });
776
+ };
777
+ }
778
+ /**
779
+ * Checks if value is a mobile phone number(chinese).
780
+ *
781
+ * @export
782
+ * @param {string} property
783
+ * @param {ValidationOptions} [validationOptions]
784
+ * @returns {PropertyDecorator}
785
+ */
786
+ function IsMobile(validationOptions) {
787
+ return function (object, propertyName) {
788
+ setExpose(object, propertyName);
789
+ classValidator.registerDecorator({
790
+ name: "IsMobile",
791
+ target: object.constructor,
792
+ propertyName,
793
+ options: validationOptions,
794
+ validator: {
795
+ validate(value, args) {
796
+ return mobile(value);
797
+ },
798
+ defaultMessage(args) {
799
+ return "invalid parameter ($property).";
800
+ }
801
+ }
802
+ });
803
+ };
804
+ }
805
+ /**
806
+ * Checks if value is a plate number(chinese).
807
+ *
808
+ * @export
809
+ * @param {string} property
810
+ * @param {ValidationOptions} [validationOptions]
811
+ * @returns {PropertyDecorator}
812
+ */
813
+ function IsPlateNumber(validationOptions) {
814
+ return function (object, propertyName) {
815
+ setExpose(object, propertyName);
816
+ classValidator.registerDecorator({
817
+ name: "IsPlateNumber",
818
+ target: object.constructor,
819
+ propertyName,
820
+ options: validationOptions,
821
+ validator: {
822
+ validate(value, args) {
823
+ return plateNumber(value);
824
+ },
825
+ defaultMessage(args) {
826
+ return "invalid parameter ($property).";
827
+ }
828
+ }
829
+ });
830
+ };
831
+ }
832
+ /**
833
+ * Checks value is not empty, undefined, null, '', NaN, [], {} and any empty string(including spaces, tabs, formfeeds, etc.), returns false.
834
+ *
835
+ * @export
836
+ * @param {ValidationOptions} [validationOptions]
837
+ * @returns {PropertyDecorator}
838
+ */
839
+ function IsNotEmpty(validationOptions) {
840
+ return function (object, propertyName) {
841
+ setExpose(object, propertyName);
842
+ classValidator.registerDecorator({
843
+ name: "IsNotEmpty",
844
+ target: object.constructor,
845
+ propertyName,
846
+ options: validationOptions,
847
+ validator: {
848
+ validate(value, args) {
849
+ return !helper__namespace.isEmpty(value);
850
+ },
851
+ defaultMessage(args) {
852
+ return "invalid parameter ($property).";
853
+ }
854
+ }
855
+ });
856
+ };
857
+ }
858
+ /**
859
+ * Checks if value matches ("===") the comparison.
860
+ *
861
+ * @export
862
+ * @param {*} comparison
863
+ * @param {ValidationOptions} [validationOptions]
864
+ * @returns {PropertyDecorator}
865
+ */
866
+ function Equals(comparison, validationOptions) {
867
+ return function (object, propertyName) {
868
+ setExpose(object, propertyName);
869
+ classValidator.registerDecorator({
870
+ name: "vEquals",
871
+ target: object.constructor,
872
+ propertyName,
873
+ options: validationOptions,
874
+ validator: {
875
+ validate(value, args) {
876
+ return classValidator.equals(value, comparison);
877
+ },
878
+ defaultMessage(args) {
879
+ return `invalid parameter, ($property) must be equals ${comparison}.`;
880
+ }
881
+ }
882
+ });
883
+ };
884
+ }
885
+ /**
886
+ * Checks if value does not match ("!==") the comparison.
887
+ *
888
+ * @export
889
+ * @param {*} comparison
890
+ * @param {ValidationOptions} [validationOptions]
891
+ * @returns {PropertyDecorator}
892
+ */
893
+ function NotEquals(comparison, validationOptions) {
894
+ return function (object, propertyName) {
895
+ setExpose(object, propertyName);
896
+ classValidator.registerDecorator({
897
+ name: "vNotEquals",
898
+ target: object.constructor,
899
+ propertyName,
900
+ options: validationOptions,
901
+ validator: {
902
+ validate(value, args) {
903
+ return classValidator.notEquals(value, comparison);
904
+ },
905
+ defaultMessage(args) {
906
+ return `invalid parameter, ($property) must be not equals ${comparison}.`;
907
+ }
908
+ }
909
+ });
910
+ };
911
+ }
912
+ /**
913
+ * Checks if the string contains the seed.
914
+ *
915
+ * @export
916
+ * @param {string} seed
917
+ * @param {ValidationOptions} [validationOptions]
918
+ * @returns {PropertyDecorator}
919
+ */
920
+ function Contains(seed, validationOptions) {
921
+ return function (object, propertyName) {
922
+ setExpose(object, propertyName);
923
+ classValidator.registerDecorator({
924
+ name: "vContains",
925
+ target: object.constructor,
926
+ propertyName,
927
+ options: validationOptions,
928
+ validator: {
929
+ validate(value, args) {
930
+ return classValidator.contains(value, seed);
931
+ // return typeof value === "string" && (value.indexOf(seed) > -1);
932
+ },
933
+ defaultMessage(args) {
934
+ return `invalid parameter, ($property) must be contains ${seed}.`;
935
+ }
936
+ }
937
+ });
938
+ };
939
+ }
940
+ /**
941
+ * Checks if given value is in a array of allowed values.
942
+ *
943
+ * @export
944
+ * @param {any[]} possibleValues
945
+ * @param {ValidationOptions} [validationOptions]
946
+ * @returns {PropertyDecorator}
947
+ */
948
+ function IsIn(possibleValues, validationOptions) {
949
+ return function (object, propertyName) {
950
+ setExpose(object, propertyName);
951
+ classValidator.registerDecorator({
952
+ name: "vIsIn",
953
+ target: object.constructor,
954
+ propertyName,
955
+ options: validationOptions,
956
+ validator: {
957
+ validate(value, args) {
958
+ return classValidator.isIn(value, possibleValues);
959
+ },
960
+ defaultMessage(args) {
961
+ return `invalid parameter ($property).`;
962
+ }
963
+ }
964
+ });
965
+ };
966
+ }
967
+ /**
968
+ * Checks if given value not in a array of allowed values.
969
+ *
970
+ * @export
971
+ * @param {any[]} possibleValues
972
+ * @param {ValidationOptions} [validationOptions]
973
+ * @returns {PropertyDecorator}
974
+ */
975
+ function IsNotIn(possibleValues, validationOptions) {
976
+ return function (object, propertyName) {
977
+ setExpose(object, propertyName);
978
+ classValidator.registerDecorator({
979
+ name: "vIsNotIn",
980
+ target: object.constructor,
981
+ propertyName,
982
+ options: validationOptions,
983
+ validator: {
984
+ validate(value, args) {
985
+ return classValidator.isNotIn(value, possibleValues);
986
+ },
987
+ defaultMessage(args) {
988
+ return `invalid parameter ($property).`;
989
+ }
990
+ }
991
+ });
992
+ };
993
+ }
994
+ /**
995
+ * Checks if a given value is a real date.
996
+ *
997
+ * @export
998
+ * @param {ValidationOptions} [validationOptions]
999
+ * @returns {PropertyDecorator}
1000
+ */
1001
+ function IsDate(validationOptions) {
1002
+ return function (object, propertyName) {
1003
+ setExpose(object, propertyName);
1004
+ classValidator.registerDecorator({
1005
+ name: "vIsDate",
1006
+ target: object.constructor,
1007
+ propertyName,
1008
+ options: validationOptions,
1009
+ validator: {
1010
+ validate(value, args) {
1011
+ return classValidator.isDate(value);
1012
+ },
1013
+ defaultMessage(args) {
1014
+ return `invalid parameter ($property).`;
1015
+ }
1016
+ }
1017
+ });
1018
+ };
1019
+ }
1020
+ /**
1021
+ * Checks if the first number is greater than or equal to the min value.
1022
+ *
1023
+ * @export
1024
+ * @param {number} min
1025
+ * @param {ValidationOptions} [validationOptions]
1026
+ * @returns {PropertyDecorator}
1027
+ */
1028
+ function Min(min, validationOptions) {
1029
+ return function (object, propertyName) {
1030
+ setExpose(object, propertyName);
1031
+ classValidator.registerDecorator({
1032
+ name: "vMin",
1033
+ target: object.constructor,
1034
+ propertyName,
1035
+ options: validationOptions,
1036
+ validator: {
1037
+ validate(value, args) {
1038
+ return helper__namespace.toNumber(value) >= min;
1039
+ },
1040
+ defaultMessage(args) {
1041
+ return `invalid parameter ($property).`;
1042
+ }
1043
+ }
1044
+ });
1045
+ };
1046
+ }
1047
+ /**
1048
+ * Checks if the first number is less than or equal to the max value.
1049
+ *
1050
+ * @export
1051
+ * @param {number} max
1052
+ * @param {ValidationOptions} [validationOptions]
1053
+ * @returns {PropertyDecorator}
1054
+ */
1055
+ function Max(max, validationOptions) {
1056
+ return function (object, propertyName) {
1057
+ setExpose(object, propertyName);
1058
+ classValidator.registerDecorator({
1059
+ name: "vMax",
1060
+ target: object.constructor,
1061
+ propertyName,
1062
+ options: validationOptions,
1063
+ validator: {
1064
+ validate(value, args) {
1065
+ return helper__namespace.toNumber(value) <= max;
1066
+ },
1067
+ defaultMessage(args) {
1068
+ return `invalid parameter ($property).`;
1069
+ }
1070
+ }
1071
+ });
1072
+ };
1073
+ }
1074
+ /**
1075
+ * Checks if the string's length falls in a range. Note: this function takes into account surrogate pairs.
1076
+ * If given value is not a string, then it returns false.
1077
+ *
1078
+ * @export
1079
+ * @param {number} min
1080
+ * @param {number} [max]
1081
+ * @param {ValidationOptions} [validationOptions]
1082
+ * @returns {PropertyDecorator}
1083
+ */
1084
+ function Length(min, max, validationOptions) {
1085
+ return function (object, propertyName) {
1086
+ setExpose(object, propertyName);
1087
+ classValidator.registerDecorator({
1088
+ name: "vLength",
1089
+ target: object.constructor,
1090
+ propertyName,
1091
+ options: validationOptions,
1092
+ validator: {
1093
+ validate(value, args) {
1094
+ return classValidator.length(value, min, max);
1095
+ },
1096
+ defaultMessage(args) {
1097
+ return `invalid parameter ($property).`;
1098
+ }
1099
+ }
1100
+ });
1101
+ };
1102
+ }
1103
+ /**
1104
+ * Checks if the string is an email. If given value is not a string, then it returns false.
1105
+ *
1106
+ * @export
1107
+ * @param {IsEmailOptions} [options]
1108
+ * @param {ValidationOptions} [validationOptions]
1109
+ * @returns {PropertyDecorator}
1110
+ */
1111
+ function IsEmail(options, validationOptions) {
1112
+ return function (object, propertyName) {
1113
+ setExpose(object, propertyName);
1114
+ classValidator.registerDecorator({
1115
+ name: "vIsEmail",
1116
+ target: object.constructor,
1117
+ propertyName,
1118
+ options: validationOptions,
1119
+ validator: {
1120
+ validate(value, args) {
1121
+ return classValidator.isEmail(value);
1122
+ },
1123
+ defaultMessage(args) {
1124
+ return `invalid parameter ($property).`;
1125
+ }
1126
+ }
1127
+ });
1128
+ };
1129
+ }
1130
+ /**
1131
+ * Checks if the string is an IP (version 4 or 6). If given value is not a string, then it returns false.
1132
+ *
1133
+ * @export
1134
+ * @param {number} [version]
1135
+ * @param {ValidationOptions} [validationOptions]
1136
+ * @returns {PropertyDecorator}
1137
+ */
1138
+ function IsIP(version, validationOptions) {
1139
+ return function (object, propertyName) {
1140
+ setExpose(object, propertyName);
1141
+ classValidator.registerDecorator({
1142
+ name: "vIsIP",
1143
+ target: object.constructor,
1144
+ propertyName,
1145
+ options: validationOptions,
1146
+ validator: {
1147
+ validate(value, args) {
1148
+ return classValidator.isIP(value, version);
1149
+ },
1150
+ defaultMessage(args) {
1151
+ return `invalid parameter ($property).`;
1152
+ }
1153
+ }
1154
+ });
1155
+ };
1156
+ }
1157
+ /**
1158
+ * Checks if the string is a valid phone number.
1159
+ *
1160
+ * @export
1161
+ * @param {string} {string} region 2 characters uppercase country code (e.g. DE, US, CH).
1162
+ * If users must enter the intl. prefix (e.g. +41), then you may pass "ZZ" or null as region.
1163
+ * See [google-libphonenumber, metadata.js:countryCodeToRegionCodeMap on github]
1164
+ * {@link https://github.com/ruimarinho/google-libphonenumber/blob/1e46138878cff479aafe2ce62175c6c49cb58720/src/metadata.js#L33}
1165
+ * @param {ValidationOptions} [validationOptions]
1166
+ * @returns {PropertyDecorator}
1167
+ */
1168
+ function IsPhoneNumber(region, validationOptions) {
1169
+ return function (object, propertyName) {
1170
+ setExpose(object, propertyName);
1171
+ classValidator.registerDecorator({
1172
+ name: "vIsPhoneNumber",
1173
+ target: object.constructor,
1174
+ propertyName,
1175
+ options: validationOptions,
1176
+ validator: {
1177
+ validate(value, args) {
1178
+ return classValidator.isPhoneNumber(value, region);
1179
+ },
1180
+ defaultMessage(args) {
1181
+ return `invalid parameter ($property).`;
1182
+ }
1183
+ }
1184
+ });
1185
+ };
1186
+ }
1187
+ /**
1188
+ * Checks if the string is an url.
1189
+ *
1190
+ * @export
1191
+ * @param {IsURLOptions} [options]
1192
+ * @param {ValidationOptions} [validationOptions]
1193
+ * @returns {PropertyDecorator}
1194
+ */
1195
+ function IsUrl(options, validationOptions) {
1196
+ return function (object, propertyName) {
1197
+ setExpose(object, propertyName);
1198
+ classValidator.registerDecorator({
1199
+ name: "vIsUrl",
1200
+ target: object.constructor,
1201
+ propertyName,
1202
+ options: validationOptions,
1203
+ validator: {
1204
+ validate(value, args) {
1205
+ return classValidator.isURL(value, options);
1206
+ },
1207
+ defaultMessage(args) {
1208
+ return `invalid parameter ($property).`;
1209
+ }
1210
+ }
1211
+ });
1212
+ };
1213
+ }
1214
+ /**
1215
+ * check if the string is a hash of type algorithm. Algorithm is one of ['md4', 'md5', 'sha1', 'sha256',
1216
+ * 'sha384', 'sha512', 'ripemd128', 'ripemd160', 'tiger128', 'tiger160', 'tiger192', 'crc32', 'crc32b']
1217
+ *
1218
+ * @export
1219
+ * @param {HashAlgorithm} algorithm
1220
+ * @param {ValidationOptions} [validationOptions]
1221
+ * @returns {PropertyDecorator}
1222
+ */
1223
+ function IsHash(algorithm, validationOptions) {
1224
+ return function (object, propertyName) {
1225
+ setExpose(object, propertyName);
1226
+ classValidator.registerDecorator({
1227
+ name: "vIsHash",
1228
+ target: object.constructor,
1229
+ propertyName,
1230
+ options: validationOptions,
1231
+ validator: {
1232
+ validate(value, args) {
1233
+ return classValidator.isHash(value, algorithm);
1234
+ },
1235
+ defaultMessage(args) {
1236
+ return `invalid parameter, ($property) must be is an ${algorithm} Hash string.`;
1237
+ }
1238
+ }
1239
+ });
1240
+ };
1241
+ }
1242
+
1243
+ exports.ClassValidator = ClassValidator;
1244
+ exports.Contains = Contains;
1245
+ exports.ENABLE_VALIDATED = ENABLE_VALIDATED;
1246
+ exports.Equals = Equals;
1247
+ exports.Expose = Expose;
1248
+ exports.FunctionValidator = FunctionValidator;
1249
+ exports.IsCnName = IsCnName;
1250
+ exports.IsDate = IsDate;
1251
+ exports.IsDefined = IsDefined;
1252
+ exports.IsEmail = IsEmail;
1253
+ exports.IsHash = IsHash;
1254
+ exports.IsIP = IsIP;
1255
+ exports.IsIdNumber = IsIdNumber;
1256
+ exports.IsIn = IsIn;
1257
+ exports.IsMobile = IsMobile;
1258
+ exports.IsNotEmpty = IsNotEmpty;
1259
+ exports.IsNotIn = IsNotIn;
1260
+ exports.IsPhoneNumber = IsPhoneNumber;
1261
+ exports.IsPlateNumber = IsPlateNumber;
1262
+ exports.IsUrl = IsUrl;
1263
+ exports.IsZipCode = IsZipCode;
1264
+ exports.Length = Length;
1265
+ exports.Max = Max;
1266
+ exports.Min = Min;
1267
+ exports.NotEquals = NotEquals;
1268
+ exports.PARAM_CHECK_KEY = PARAM_CHECK_KEY;
1269
+ exports.PARAM_RULE_KEY = PARAM_RULE_KEY;
1270
+ exports.PARAM_TYPE_KEY = PARAM_TYPE_KEY;
1271
+ exports.Valid = Valid;
97
1272
  exports.Validated = Validated;
98
- //# sourceMappingURL=index.js.map
1273
+ exports.ValidatorFuncs = ValidatorFuncs;
1274
+ exports.checkParamsType = checkParamsType;
1275
+ exports.convertDtoParamsType = convertDtoParamsType;
1276
+ exports.convertParamsType = convertParamsType;
1277
+ exports.plainToClass = plainToClass;