koatty_validation 1.3.2 → 1.3.6

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.mjs CHANGED
@@ -1,14 +1,1423 @@
1
1
  /*!
2
2
  * @Author: richen
3
- * @Date: 2024-01-14 21:56:49
3
+ * @Date: 2024-11-06 10:51:17
4
4
  * @License: BSD (3-Clause)
5
5
  * @Copyright (c) - <richenlin(at)gmail.com>
6
6
  * @HomePage: https://koatty.org/
7
7
  */
8
+ import { validate, isEmail, isIP, isPhoneNumber, isURL, isHash, equals, notEquals, contains, isIn, isNotIn, registerDecorator, isDate, length } from 'class-validator';
8
9
  import * as helper from 'koatty_lib';
9
- import 'reflect-metadata';
10
10
  import { getOriginMetadata, IOCContainer } from 'koatty_container';
11
- import { validate, isEmail, isIP, isPhoneNumber, isURL, isHash, equals, notEquals, contains, isIn, isNotIn, registerDecorator, isDate, length } from 'class-validator';
11
+
12
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
13
+
14
+ var _Reflect = {};
15
+
16
+ /*! *****************************************************************************
17
+ Copyright (C) Microsoft. All rights reserved.
18
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
19
+ this file except in compliance with the License. You may obtain a copy of the
20
+ License at http://www.apache.org/licenses/LICENSE-2.0
21
+
22
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
23
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
24
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
25
+ MERCHANTABLITY OR NON-INFRINGEMENT.
26
+
27
+ See the Apache Version 2.0 License for specific language governing permissions
28
+ and limitations under the License.
29
+ ***************************************************************************** */
30
+
31
+ var hasRequired_Reflect;
32
+
33
+ function require_Reflect () {
34
+ if (hasRequired_Reflect) return _Reflect;
35
+ hasRequired_Reflect = 1;
36
+ var Reflect;
37
+ (function (Reflect) {
38
+ // Metadata Proposal
39
+ // https://rbuckton.github.io/reflect-metadata/
40
+ (function (factory) {
41
+ var root = typeof globalThis === "object" ? globalThis :
42
+ typeof commonjsGlobal === "object" ? commonjsGlobal :
43
+ typeof self === "object" ? self :
44
+ typeof this === "object" ? this :
45
+ sloppyModeThis();
46
+ var exporter = makeExporter(Reflect);
47
+ if (typeof root.Reflect !== "undefined") {
48
+ exporter = makeExporter(root.Reflect, exporter);
49
+ }
50
+ factory(exporter, root);
51
+ if (typeof root.Reflect === "undefined") {
52
+ root.Reflect = Reflect;
53
+ }
54
+ function makeExporter(target, previous) {
55
+ return function (key, value) {
56
+ Object.defineProperty(target, key, { configurable: true, writable: true, value: value });
57
+ if (previous)
58
+ previous(key, value);
59
+ };
60
+ }
61
+ function functionThis() {
62
+ try {
63
+ return Function("return this;")();
64
+ }
65
+ catch (_) { }
66
+ }
67
+ function indirectEvalThis() {
68
+ try {
69
+ return (void 0, eval)("(function() { return this; })()");
70
+ }
71
+ catch (_) { }
72
+ }
73
+ function sloppyModeThis() {
74
+ return functionThis() || indirectEvalThis();
75
+ }
76
+ })(function (exporter, root) {
77
+ var hasOwn = Object.prototype.hasOwnProperty;
78
+ // feature test for Symbol support
79
+ var supportsSymbol = typeof Symbol === "function";
80
+ var toPrimitiveSymbol = supportsSymbol && typeof Symbol.toPrimitive !== "undefined" ? Symbol.toPrimitive : "@@toPrimitive";
81
+ var iteratorSymbol = supportsSymbol && typeof Symbol.iterator !== "undefined" ? Symbol.iterator : "@@iterator";
82
+ var supportsCreate = typeof Object.create === "function"; // feature test for Object.create support
83
+ var supportsProto = { __proto__: [] } instanceof Array; // feature test for __proto__ support
84
+ var downLevel = !supportsCreate && !supportsProto;
85
+ var HashMap = {
86
+ // create an object in dictionary mode (a.k.a. "slow" mode in v8)
87
+ create: supportsCreate
88
+ ? function () { return MakeDictionary(Object.create(null)); }
89
+ : supportsProto
90
+ ? function () { return MakeDictionary({ __proto__: null }); }
91
+ : function () { return MakeDictionary({}); },
92
+ has: downLevel
93
+ ? function (map, key) { return hasOwn.call(map, key); }
94
+ : function (map, key) { return key in map; },
95
+ get: downLevel
96
+ ? function (map, key) { return hasOwn.call(map, key) ? map[key] : undefined; }
97
+ : function (map, key) { return map[key]; },
98
+ };
99
+ // Load global or shim versions of Map, Set, and WeakMap
100
+ var functionPrototype = Object.getPrototypeOf(Function);
101
+ var _Map = typeof Map === "function" && typeof Map.prototype.entries === "function" ? Map : CreateMapPolyfill();
102
+ var _Set = typeof Set === "function" && typeof Set.prototype.entries === "function" ? Set : CreateSetPolyfill();
103
+ var _WeakMap = typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill();
104
+ var registrySymbol = supportsSymbol ? Symbol.for("@reflect-metadata:registry") : undefined;
105
+ var metadataRegistry = GetOrCreateMetadataRegistry();
106
+ var metadataProvider = CreateMetadataProvider(metadataRegistry);
107
+ /**
108
+ * Applies a set of decorators to a property of a target object.
109
+ * @param decorators An array of decorators.
110
+ * @param target The target object.
111
+ * @param propertyKey (Optional) The property key to decorate.
112
+ * @param attributes (Optional) The property descriptor for the target key.
113
+ * @remarks Decorators are applied in reverse order.
114
+ * @example
115
+ *
116
+ * class Example {
117
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
118
+ * // static staticProperty;
119
+ * // property;
120
+ *
121
+ * constructor(p) { }
122
+ * static staticMethod(p) { }
123
+ * method(p) { }
124
+ * }
125
+ *
126
+ * // constructor
127
+ * Example = Reflect.decorate(decoratorsArray, Example);
128
+ *
129
+ * // property (on constructor)
130
+ * Reflect.decorate(decoratorsArray, Example, "staticProperty");
131
+ *
132
+ * // property (on prototype)
133
+ * Reflect.decorate(decoratorsArray, Example.prototype, "property");
134
+ *
135
+ * // method (on constructor)
136
+ * Object.defineProperty(Example, "staticMethod",
137
+ * Reflect.decorate(decoratorsArray, Example, "staticMethod",
138
+ * Object.getOwnPropertyDescriptor(Example, "staticMethod")));
139
+ *
140
+ * // method (on prototype)
141
+ * Object.defineProperty(Example.prototype, "method",
142
+ * Reflect.decorate(decoratorsArray, Example.prototype, "method",
143
+ * Object.getOwnPropertyDescriptor(Example.prototype, "method")));
144
+ *
145
+ */
146
+ function decorate(decorators, target, propertyKey, attributes) {
147
+ if (!IsUndefined(propertyKey)) {
148
+ if (!IsArray(decorators))
149
+ throw new TypeError();
150
+ if (!IsObject(target))
151
+ throw new TypeError();
152
+ if (!IsObject(attributes) && !IsUndefined(attributes) && !IsNull(attributes))
153
+ throw new TypeError();
154
+ if (IsNull(attributes))
155
+ attributes = undefined;
156
+ propertyKey = ToPropertyKey(propertyKey);
157
+ return DecorateProperty(decorators, target, propertyKey, attributes);
158
+ }
159
+ else {
160
+ if (!IsArray(decorators))
161
+ throw new TypeError();
162
+ if (!IsConstructor(target))
163
+ throw new TypeError();
164
+ return DecorateConstructor(decorators, target);
165
+ }
166
+ }
167
+ exporter("decorate", decorate);
168
+ // 4.1.2 Reflect.metadata(metadataKey, metadataValue)
169
+ // https://rbuckton.github.io/reflect-metadata/#reflect.metadata
170
+ /**
171
+ * A default metadata decorator factory that can be used on a class, class member, or parameter.
172
+ * @param metadataKey The key for the metadata entry.
173
+ * @param metadataValue The value for the metadata entry.
174
+ * @returns A decorator function.
175
+ * @remarks
176
+ * If `metadataKey` is already defined for the target and target key, the
177
+ * metadataValue for that key will be overwritten.
178
+ * @example
179
+ *
180
+ * // constructor
181
+ * @Reflect.metadata(key, value)
182
+ * class Example {
183
+ * }
184
+ *
185
+ * // property (on constructor, TypeScript only)
186
+ * class Example {
187
+ * @Reflect.metadata(key, value)
188
+ * static staticProperty;
189
+ * }
190
+ *
191
+ * // property (on prototype, TypeScript only)
192
+ * class Example {
193
+ * @Reflect.metadata(key, value)
194
+ * property;
195
+ * }
196
+ *
197
+ * // method (on constructor)
198
+ * class Example {
199
+ * @Reflect.metadata(key, value)
200
+ * static staticMethod() { }
201
+ * }
202
+ *
203
+ * // method (on prototype)
204
+ * class Example {
205
+ * @Reflect.metadata(key, value)
206
+ * method() { }
207
+ * }
208
+ *
209
+ */
210
+ function metadata(metadataKey, metadataValue) {
211
+ function decorator(target, propertyKey) {
212
+ if (!IsObject(target))
213
+ throw new TypeError();
214
+ if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey))
215
+ throw new TypeError();
216
+ OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
217
+ }
218
+ return decorator;
219
+ }
220
+ exporter("metadata", metadata);
221
+ /**
222
+ * Define a unique metadata entry on the target.
223
+ * @param metadataKey A key used to store and retrieve metadata.
224
+ * @param metadataValue A value that contains attached metadata.
225
+ * @param target The target object on which to define metadata.
226
+ * @param propertyKey (Optional) The property key for the target.
227
+ * @example
228
+ *
229
+ * class Example {
230
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
231
+ * // static staticProperty;
232
+ * // property;
233
+ *
234
+ * constructor(p) { }
235
+ * static staticMethod(p) { }
236
+ * method(p) { }
237
+ * }
238
+ *
239
+ * // constructor
240
+ * Reflect.defineMetadata("custom:annotation", options, Example);
241
+ *
242
+ * // property (on constructor)
243
+ * Reflect.defineMetadata("custom:annotation", options, Example, "staticProperty");
244
+ *
245
+ * // property (on prototype)
246
+ * Reflect.defineMetadata("custom:annotation", options, Example.prototype, "property");
247
+ *
248
+ * // method (on constructor)
249
+ * Reflect.defineMetadata("custom:annotation", options, Example, "staticMethod");
250
+ *
251
+ * // method (on prototype)
252
+ * Reflect.defineMetadata("custom:annotation", options, Example.prototype, "method");
253
+ *
254
+ * // decorator factory as metadata-producing annotation.
255
+ * function MyAnnotation(options): Decorator {
256
+ * return (target, key?) => Reflect.defineMetadata("custom:annotation", options, target, key);
257
+ * }
258
+ *
259
+ */
260
+ function defineMetadata(metadataKey, metadataValue, target, propertyKey) {
261
+ if (!IsObject(target))
262
+ throw new TypeError();
263
+ if (!IsUndefined(propertyKey))
264
+ propertyKey = ToPropertyKey(propertyKey);
265
+ return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
266
+ }
267
+ exporter("defineMetadata", defineMetadata);
268
+ /**
269
+ * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.
270
+ * @param metadataKey A key used to store and retrieve metadata.
271
+ * @param target The target object on which the metadata is defined.
272
+ * @param propertyKey (Optional) The property key for the target.
273
+ * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.
274
+ * @example
275
+ *
276
+ * class Example {
277
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
278
+ * // static staticProperty;
279
+ * // property;
280
+ *
281
+ * constructor(p) { }
282
+ * static staticMethod(p) { }
283
+ * method(p) { }
284
+ * }
285
+ *
286
+ * // constructor
287
+ * result = Reflect.hasMetadata("custom:annotation", Example);
288
+ *
289
+ * // property (on constructor)
290
+ * result = Reflect.hasMetadata("custom:annotation", Example, "staticProperty");
291
+ *
292
+ * // property (on prototype)
293
+ * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "property");
294
+ *
295
+ * // method (on constructor)
296
+ * result = Reflect.hasMetadata("custom:annotation", Example, "staticMethod");
297
+ *
298
+ * // method (on prototype)
299
+ * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "method");
300
+ *
301
+ */
302
+ function hasMetadata(metadataKey, target, propertyKey) {
303
+ if (!IsObject(target))
304
+ throw new TypeError();
305
+ if (!IsUndefined(propertyKey))
306
+ propertyKey = ToPropertyKey(propertyKey);
307
+ return OrdinaryHasMetadata(metadataKey, target, propertyKey);
308
+ }
309
+ exporter("hasMetadata", hasMetadata);
310
+ /**
311
+ * Gets a value indicating whether the target object has the provided metadata key defined.
312
+ * @param metadataKey A key used to store and retrieve metadata.
313
+ * @param target The target object on which the metadata is defined.
314
+ * @param propertyKey (Optional) The property key for the target.
315
+ * @returns `true` if the metadata key was defined on the target object; otherwise, `false`.
316
+ * @example
317
+ *
318
+ * class Example {
319
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
320
+ * // static staticProperty;
321
+ * // property;
322
+ *
323
+ * constructor(p) { }
324
+ * static staticMethod(p) { }
325
+ * method(p) { }
326
+ * }
327
+ *
328
+ * // constructor
329
+ * result = Reflect.hasOwnMetadata("custom:annotation", Example);
330
+ *
331
+ * // property (on constructor)
332
+ * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticProperty");
333
+ *
334
+ * // property (on prototype)
335
+ * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "property");
336
+ *
337
+ * // method (on constructor)
338
+ * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticMethod");
339
+ *
340
+ * // method (on prototype)
341
+ * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "method");
342
+ *
343
+ */
344
+ function hasOwnMetadata(metadataKey, target, propertyKey) {
345
+ if (!IsObject(target))
346
+ throw new TypeError();
347
+ if (!IsUndefined(propertyKey))
348
+ propertyKey = ToPropertyKey(propertyKey);
349
+ return OrdinaryHasOwnMetadata(metadataKey, target, propertyKey);
350
+ }
351
+ exporter("hasOwnMetadata", hasOwnMetadata);
352
+ /**
353
+ * Gets the metadata value for the provided metadata key on the target object or its prototype chain.
354
+ * @param metadataKey A key used to store and retrieve metadata.
355
+ * @param target The target object on which the metadata is defined.
356
+ * @param propertyKey (Optional) The property key for the target.
357
+ * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
358
+ * @example
359
+ *
360
+ * class Example {
361
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
362
+ * // static staticProperty;
363
+ * // property;
364
+ *
365
+ * constructor(p) { }
366
+ * static staticMethod(p) { }
367
+ * method(p) { }
368
+ * }
369
+ *
370
+ * // constructor
371
+ * result = Reflect.getMetadata("custom:annotation", Example);
372
+ *
373
+ * // property (on constructor)
374
+ * result = Reflect.getMetadata("custom:annotation", Example, "staticProperty");
375
+ *
376
+ * // property (on prototype)
377
+ * result = Reflect.getMetadata("custom:annotation", Example.prototype, "property");
378
+ *
379
+ * // method (on constructor)
380
+ * result = Reflect.getMetadata("custom:annotation", Example, "staticMethod");
381
+ *
382
+ * // method (on prototype)
383
+ * result = Reflect.getMetadata("custom:annotation", Example.prototype, "method");
384
+ *
385
+ */
386
+ function getMetadata(metadataKey, target, propertyKey) {
387
+ if (!IsObject(target))
388
+ throw new TypeError();
389
+ if (!IsUndefined(propertyKey))
390
+ propertyKey = ToPropertyKey(propertyKey);
391
+ return OrdinaryGetMetadata(metadataKey, target, propertyKey);
392
+ }
393
+ exporter("getMetadata", getMetadata);
394
+ /**
395
+ * Gets the metadata value for the provided metadata key on the target object.
396
+ * @param metadataKey A key used to store and retrieve metadata.
397
+ * @param target The target object on which the metadata is defined.
398
+ * @param propertyKey (Optional) The property key for the target.
399
+ * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
400
+ * @example
401
+ *
402
+ * class Example {
403
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
404
+ * // static staticProperty;
405
+ * // property;
406
+ *
407
+ * constructor(p) { }
408
+ * static staticMethod(p) { }
409
+ * method(p) { }
410
+ * }
411
+ *
412
+ * // constructor
413
+ * result = Reflect.getOwnMetadata("custom:annotation", Example);
414
+ *
415
+ * // property (on constructor)
416
+ * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticProperty");
417
+ *
418
+ * // property (on prototype)
419
+ * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "property");
420
+ *
421
+ * // method (on constructor)
422
+ * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticMethod");
423
+ *
424
+ * // method (on prototype)
425
+ * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "method");
426
+ *
427
+ */
428
+ function getOwnMetadata(metadataKey, target, propertyKey) {
429
+ if (!IsObject(target))
430
+ throw new TypeError();
431
+ if (!IsUndefined(propertyKey))
432
+ propertyKey = ToPropertyKey(propertyKey);
433
+ return OrdinaryGetOwnMetadata(metadataKey, target, propertyKey);
434
+ }
435
+ exporter("getOwnMetadata", getOwnMetadata);
436
+ /**
437
+ * Gets the metadata keys defined on the target object or its prototype chain.
438
+ * @param target The target object on which the metadata is defined.
439
+ * @param propertyKey (Optional) The property key for the target.
440
+ * @returns An array of unique metadata keys.
441
+ * @example
442
+ *
443
+ * class Example {
444
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
445
+ * // static staticProperty;
446
+ * // property;
447
+ *
448
+ * constructor(p) { }
449
+ * static staticMethod(p) { }
450
+ * method(p) { }
451
+ * }
452
+ *
453
+ * // constructor
454
+ * result = Reflect.getMetadataKeys(Example);
455
+ *
456
+ * // property (on constructor)
457
+ * result = Reflect.getMetadataKeys(Example, "staticProperty");
458
+ *
459
+ * // property (on prototype)
460
+ * result = Reflect.getMetadataKeys(Example.prototype, "property");
461
+ *
462
+ * // method (on constructor)
463
+ * result = Reflect.getMetadataKeys(Example, "staticMethod");
464
+ *
465
+ * // method (on prototype)
466
+ * result = Reflect.getMetadataKeys(Example.prototype, "method");
467
+ *
468
+ */
469
+ function getMetadataKeys(target, propertyKey) {
470
+ if (!IsObject(target))
471
+ throw new TypeError();
472
+ if (!IsUndefined(propertyKey))
473
+ propertyKey = ToPropertyKey(propertyKey);
474
+ return OrdinaryMetadataKeys(target, propertyKey);
475
+ }
476
+ exporter("getMetadataKeys", getMetadataKeys);
477
+ /**
478
+ * Gets the unique metadata keys defined on the target object.
479
+ * @param target The target object on which the metadata is defined.
480
+ * @param propertyKey (Optional) The property key for the target.
481
+ * @returns An array of unique metadata keys.
482
+ * @example
483
+ *
484
+ * class Example {
485
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
486
+ * // static staticProperty;
487
+ * // property;
488
+ *
489
+ * constructor(p) { }
490
+ * static staticMethod(p) { }
491
+ * method(p) { }
492
+ * }
493
+ *
494
+ * // constructor
495
+ * result = Reflect.getOwnMetadataKeys(Example);
496
+ *
497
+ * // property (on constructor)
498
+ * result = Reflect.getOwnMetadataKeys(Example, "staticProperty");
499
+ *
500
+ * // property (on prototype)
501
+ * result = Reflect.getOwnMetadataKeys(Example.prototype, "property");
502
+ *
503
+ * // method (on constructor)
504
+ * result = Reflect.getOwnMetadataKeys(Example, "staticMethod");
505
+ *
506
+ * // method (on prototype)
507
+ * result = Reflect.getOwnMetadataKeys(Example.prototype, "method");
508
+ *
509
+ */
510
+ function getOwnMetadataKeys(target, propertyKey) {
511
+ if (!IsObject(target))
512
+ throw new TypeError();
513
+ if (!IsUndefined(propertyKey))
514
+ propertyKey = ToPropertyKey(propertyKey);
515
+ return OrdinaryOwnMetadataKeys(target, propertyKey);
516
+ }
517
+ exporter("getOwnMetadataKeys", getOwnMetadataKeys);
518
+ /**
519
+ * Deletes the metadata entry from the target object with the provided key.
520
+ * @param metadataKey A key used to store and retrieve metadata.
521
+ * @param target The target object on which the metadata is defined.
522
+ * @param propertyKey (Optional) The property key for the target.
523
+ * @returns `true` if the metadata entry was found and deleted; otherwise, false.
524
+ * @example
525
+ *
526
+ * class Example {
527
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
528
+ * // static staticProperty;
529
+ * // property;
530
+ *
531
+ * constructor(p) { }
532
+ * static staticMethod(p) { }
533
+ * method(p) { }
534
+ * }
535
+ *
536
+ * // constructor
537
+ * result = Reflect.deleteMetadata("custom:annotation", Example);
538
+ *
539
+ * // property (on constructor)
540
+ * result = Reflect.deleteMetadata("custom:annotation", Example, "staticProperty");
541
+ *
542
+ * // property (on prototype)
543
+ * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "property");
544
+ *
545
+ * // method (on constructor)
546
+ * result = Reflect.deleteMetadata("custom:annotation", Example, "staticMethod");
547
+ *
548
+ * // method (on prototype)
549
+ * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "method");
550
+ *
551
+ */
552
+ function deleteMetadata(metadataKey, target, propertyKey) {
553
+ if (!IsObject(target))
554
+ throw new TypeError();
555
+ if (!IsUndefined(propertyKey))
556
+ propertyKey = ToPropertyKey(propertyKey);
557
+ if (!IsObject(target))
558
+ throw new TypeError();
559
+ if (!IsUndefined(propertyKey))
560
+ propertyKey = ToPropertyKey(propertyKey);
561
+ var provider = GetMetadataProvider(target, propertyKey, /*Create*/ false);
562
+ if (IsUndefined(provider))
563
+ return false;
564
+ return provider.OrdinaryDeleteMetadata(metadataKey, target, propertyKey);
565
+ }
566
+ exporter("deleteMetadata", deleteMetadata);
567
+ function DecorateConstructor(decorators, target) {
568
+ for (var i = decorators.length - 1; i >= 0; --i) {
569
+ var decorator = decorators[i];
570
+ var decorated = decorator(target);
571
+ if (!IsUndefined(decorated) && !IsNull(decorated)) {
572
+ if (!IsConstructor(decorated))
573
+ throw new TypeError();
574
+ target = decorated;
575
+ }
576
+ }
577
+ return target;
578
+ }
579
+ function DecorateProperty(decorators, target, propertyKey, descriptor) {
580
+ for (var i = decorators.length - 1; i >= 0; --i) {
581
+ var decorator = decorators[i];
582
+ var decorated = decorator(target, propertyKey, descriptor);
583
+ if (!IsUndefined(decorated) && !IsNull(decorated)) {
584
+ if (!IsObject(decorated))
585
+ throw new TypeError();
586
+ descriptor = decorated;
587
+ }
588
+ }
589
+ return descriptor;
590
+ }
591
+ // 3.1.1.1 OrdinaryHasMetadata(MetadataKey, O, P)
592
+ // https://rbuckton.github.io/reflect-metadata/#ordinaryhasmetadata
593
+ function OrdinaryHasMetadata(MetadataKey, O, P) {
594
+ var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P);
595
+ if (hasOwn)
596
+ return true;
597
+ var parent = OrdinaryGetPrototypeOf(O);
598
+ if (!IsNull(parent))
599
+ return OrdinaryHasMetadata(MetadataKey, parent, P);
600
+ return false;
601
+ }
602
+ // 3.1.2.1 OrdinaryHasOwnMetadata(MetadataKey, O, P)
603
+ // https://rbuckton.github.io/reflect-metadata/#ordinaryhasownmetadata
604
+ function OrdinaryHasOwnMetadata(MetadataKey, O, P) {
605
+ var provider = GetMetadataProvider(O, P, /*Create*/ false);
606
+ if (IsUndefined(provider))
607
+ return false;
608
+ return ToBoolean(provider.OrdinaryHasOwnMetadata(MetadataKey, O, P));
609
+ }
610
+ // 3.1.3.1 OrdinaryGetMetadata(MetadataKey, O, P)
611
+ // https://rbuckton.github.io/reflect-metadata/#ordinarygetmetadata
612
+ function OrdinaryGetMetadata(MetadataKey, O, P) {
613
+ var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P);
614
+ if (hasOwn)
615
+ return OrdinaryGetOwnMetadata(MetadataKey, O, P);
616
+ var parent = OrdinaryGetPrototypeOf(O);
617
+ if (!IsNull(parent))
618
+ return OrdinaryGetMetadata(MetadataKey, parent, P);
619
+ return undefined;
620
+ }
621
+ // 3.1.4.1 OrdinaryGetOwnMetadata(MetadataKey, O, P)
622
+ // https://rbuckton.github.io/reflect-metadata/#ordinarygetownmetadata
623
+ function OrdinaryGetOwnMetadata(MetadataKey, O, P) {
624
+ var provider = GetMetadataProvider(O, P, /*Create*/ false);
625
+ if (IsUndefined(provider))
626
+ return;
627
+ return provider.OrdinaryGetOwnMetadata(MetadataKey, O, P);
628
+ }
629
+ // 3.1.5.1 OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P)
630
+ // https://rbuckton.github.io/reflect-metadata/#ordinarydefineownmetadata
631
+ function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
632
+ var provider = GetMetadataProvider(O, P, /*Create*/ true);
633
+ provider.OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P);
634
+ }
635
+ // 3.1.6.1 OrdinaryMetadataKeys(O, P)
636
+ // https://rbuckton.github.io/reflect-metadata/#ordinarymetadatakeys
637
+ function OrdinaryMetadataKeys(O, P) {
638
+ var ownKeys = OrdinaryOwnMetadataKeys(O, P);
639
+ var parent = OrdinaryGetPrototypeOf(O);
640
+ if (parent === null)
641
+ return ownKeys;
642
+ var parentKeys = OrdinaryMetadataKeys(parent, P);
643
+ if (parentKeys.length <= 0)
644
+ return ownKeys;
645
+ if (ownKeys.length <= 0)
646
+ return parentKeys;
647
+ var set = new _Set();
648
+ var keys = [];
649
+ for (var _i = 0, ownKeys_1 = ownKeys; _i < ownKeys_1.length; _i++) {
650
+ var key = ownKeys_1[_i];
651
+ var hasKey = set.has(key);
652
+ if (!hasKey) {
653
+ set.add(key);
654
+ keys.push(key);
655
+ }
656
+ }
657
+ for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) {
658
+ var key = parentKeys_1[_a];
659
+ var hasKey = set.has(key);
660
+ if (!hasKey) {
661
+ set.add(key);
662
+ keys.push(key);
663
+ }
664
+ }
665
+ return keys;
666
+ }
667
+ // 3.1.7.1 OrdinaryOwnMetadataKeys(O, P)
668
+ // https://rbuckton.github.io/reflect-metadata/#ordinaryownmetadatakeys
669
+ function OrdinaryOwnMetadataKeys(O, P) {
670
+ var provider = GetMetadataProvider(O, P, /*create*/ false);
671
+ if (!provider) {
672
+ return [];
673
+ }
674
+ return provider.OrdinaryOwnMetadataKeys(O, P);
675
+ }
676
+ // 6 ECMAScript Data Typ0es and Values
677
+ // https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values
678
+ function Type(x) {
679
+ if (x === null)
680
+ return 1 /* Null */;
681
+ switch (typeof x) {
682
+ case "undefined": return 0 /* Undefined */;
683
+ case "boolean": return 2 /* Boolean */;
684
+ case "string": return 3 /* String */;
685
+ case "symbol": return 4 /* Symbol */;
686
+ case "number": return 5 /* Number */;
687
+ case "object": return x === null ? 1 /* Null */ : 6 /* Object */;
688
+ default: return 6 /* Object */;
689
+ }
690
+ }
691
+ // 6.1.1 The Undefined Type
692
+ // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-undefined-type
693
+ function IsUndefined(x) {
694
+ return x === undefined;
695
+ }
696
+ // 6.1.2 The Null Type
697
+ // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-null-type
698
+ function IsNull(x) {
699
+ return x === null;
700
+ }
701
+ // 6.1.5 The Symbol Type
702
+ // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-symbol-type
703
+ function IsSymbol(x) {
704
+ return typeof x === "symbol";
705
+ }
706
+ // 6.1.7 The Object Type
707
+ // https://tc39.github.io/ecma262/#sec-object-type
708
+ function IsObject(x) {
709
+ return typeof x === "object" ? x !== null : typeof x === "function";
710
+ }
711
+ // 7.1 Type Conversion
712
+ // https://tc39.github.io/ecma262/#sec-type-conversion
713
+ // 7.1.1 ToPrimitive(input [, PreferredType])
714
+ // https://tc39.github.io/ecma262/#sec-toprimitive
715
+ function ToPrimitive(input, PreferredType) {
716
+ switch (Type(input)) {
717
+ case 0 /* Undefined */: return input;
718
+ case 1 /* Null */: return input;
719
+ case 2 /* Boolean */: return input;
720
+ case 3 /* String */: return input;
721
+ case 4 /* Symbol */: return input;
722
+ case 5 /* Number */: return input;
723
+ }
724
+ var hint = "string" ;
725
+ var exoticToPrim = GetMethod(input, toPrimitiveSymbol);
726
+ if (exoticToPrim !== undefined) {
727
+ var result = exoticToPrim.call(input, hint);
728
+ if (IsObject(result))
729
+ throw new TypeError();
730
+ return result;
731
+ }
732
+ return OrdinaryToPrimitive(input);
733
+ }
734
+ // 7.1.1.1 OrdinaryToPrimitive(O, hint)
735
+ // https://tc39.github.io/ecma262/#sec-ordinarytoprimitive
736
+ function OrdinaryToPrimitive(O, hint) {
737
+ var valueOf, result; {
738
+ var toString_1 = O.toString;
739
+ if (IsCallable(toString_1)) {
740
+ var result = toString_1.call(O);
741
+ if (!IsObject(result))
742
+ return result;
743
+ }
744
+ var valueOf = O.valueOf;
745
+ if (IsCallable(valueOf)) {
746
+ var result = valueOf.call(O);
747
+ if (!IsObject(result))
748
+ return result;
749
+ }
750
+ }
751
+ throw new TypeError();
752
+ }
753
+ // 7.1.2 ToBoolean(argument)
754
+ // https://tc39.github.io/ecma262/2016/#sec-toboolean
755
+ function ToBoolean(argument) {
756
+ return !!argument;
757
+ }
758
+ // 7.1.12 ToString(argument)
759
+ // https://tc39.github.io/ecma262/#sec-tostring
760
+ function ToString(argument) {
761
+ return "" + argument;
762
+ }
763
+ // 7.1.14 ToPropertyKey(argument)
764
+ // https://tc39.github.io/ecma262/#sec-topropertykey
765
+ function ToPropertyKey(argument) {
766
+ var key = ToPrimitive(argument);
767
+ if (IsSymbol(key))
768
+ return key;
769
+ return ToString(key);
770
+ }
771
+ // 7.2 Testing and Comparison Operations
772
+ // https://tc39.github.io/ecma262/#sec-testing-and-comparison-operations
773
+ // 7.2.2 IsArray(argument)
774
+ // https://tc39.github.io/ecma262/#sec-isarray
775
+ function IsArray(argument) {
776
+ return Array.isArray
777
+ ? Array.isArray(argument)
778
+ : argument instanceof Object
779
+ ? argument instanceof Array
780
+ : Object.prototype.toString.call(argument) === "[object Array]";
781
+ }
782
+ // 7.2.3 IsCallable(argument)
783
+ // https://tc39.github.io/ecma262/#sec-iscallable
784
+ function IsCallable(argument) {
785
+ // NOTE: This is an approximation as we cannot check for [[Call]] internal method.
786
+ return typeof argument === "function";
787
+ }
788
+ // 7.2.4 IsConstructor(argument)
789
+ // https://tc39.github.io/ecma262/#sec-isconstructor
790
+ function IsConstructor(argument) {
791
+ // NOTE: This is an approximation as we cannot check for [[Construct]] internal method.
792
+ return typeof argument === "function";
793
+ }
794
+ // 7.2.7 IsPropertyKey(argument)
795
+ // https://tc39.github.io/ecma262/#sec-ispropertykey
796
+ function IsPropertyKey(argument) {
797
+ switch (Type(argument)) {
798
+ case 3 /* String */: return true;
799
+ case 4 /* Symbol */: return true;
800
+ default: return false;
801
+ }
802
+ }
803
+ function SameValueZero(x, y) {
804
+ return x === y || x !== x && y !== y;
805
+ }
806
+ // 7.3 Operations on Objects
807
+ // https://tc39.github.io/ecma262/#sec-operations-on-objects
808
+ // 7.3.9 GetMethod(V, P)
809
+ // https://tc39.github.io/ecma262/#sec-getmethod
810
+ function GetMethod(V, P) {
811
+ var func = V[P];
812
+ if (func === undefined || func === null)
813
+ return undefined;
814
+ if (!IsCallable(func))
815
+ throw new TypeError();
816
+ return func;
817
+ }
818
+ // 7.4 Operations on Iterator Objects
819
+ // https://tc39.github.io/ecma262/#sec-operations-on-iterator-objects
820
+ function GetIterator(obj) {
821
+ var method = GetMethod(obj, iteratorSymbol);
822
+ if (!IsCallable(method))
823
+ throw new TypeError(); // from Call
824
+ var iterator = method.call(obj);
825
+ if (!IsObject(iterator))
826
+ throw new TypeError();
827
+ return iterator;
828
+ }
829
+ // 7.4.4 IteratorValue(iterResult)
830
+ // https://tc39.github.io/ecma262/2016/#sec-iteratorvalue
831
+ function IteratorValue(iterResult) {
832
+ return iterResult.value;
833
+ }
834
+ // 7.4.5 IteratorStep(iterator)
835
+ // https://tc39.github.io/ecma262/#sec-iteratorstep
836
+ function IteratorStep(iterator) {
837
+ var result = iterator.next();
838
+ return result.done ? false : result;
839
+ }
840
+ // 7.4.6 IteratorClose(iterator, completion)
841
+ // https://tc39.github.io/ecma262/#sec-iteratorclose
842
+ function IteratorClose(iterator) {
843
+ var f = iterator["return"];
844
+ if (f)
845
+ f.call(iterator);
846
+ }
847
+ // 9.1 Ordinary Object Internal Methods and Internal Slots
848
+ // https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots
849
+ // 9.1.1.1 OrdinaryGetPrototypeOf(O)
850
+ // https://tc39.github.io/ecma262/#sec-ordinarygetprototypeof
851
+ function OrdinaryGetPrototypeOf(O) {
852
+ var proto = Object.getPrototypeOf(O);
853
+ if (typeof O !== "function" || O === functionPrototype)
854
+ return proto;
855
+ // TypeScript doesn't set __proto__ in ES5, as it's non-standard.
856
+ // Try to determine the superclass constructor. Compatible implementations
857
+ // must either set __proto__ on a subclass constructor to the superclass constructor,
858
+ // or ensure each class has a valid `constructor` property on its prototype that
859
+ // points back to the constructor.
860
+ // If this is not the same as Function.[[Prototype]], then this is definately inherited.
861
+ // This is the case when in ES6 or when using __proto__ in a compatible browser.
862
+ if (proto !== functionPrototype)
863
+ return proto;
864
+ // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage.
865
+ var prototype = O.prototype;
866
+ var prototypeProto = prototype && Object.getPrototypeOf(prototype);
867
+ if (prototypeProto == null || prototypeProto === Object.prototype)
868
+ return proto;
869
+ // If the constructor was not a function, then we cannot determine the heritage.
870
+ var constructor = prototypeProto.constructor;
871
+ if (typeof constructor !== "function")
872
+ return proto;
873
+ // If we have some kind of self-reference, then we cannot determine the heritage.
874
+ if (constructor === O)
875
+ return proto;
876
+ // we have a pretty good guess at the heritage.
877
+ return constructor;
878
+ }
879
+ // Global metadata registry
880
+ // - Allows `import "reflect-metadata"` and `import "reflect-metadata/no-conflict"` to interoperate.
881
+ // - Uses isolated metadata if `Reflect` is frozen before the registry can be installed.
882
+ /**
883
+ * Creates a registry used to allow multiple `reflect-metadata` providers.
884
+ */
885
+ function CreateMetadataRegistry() {
886
+ var fallback;
887
+ if (!IsUndefined(registrySymbol) &&
888
+ typeof root.Reflect !== "undefined" &&
889
+ !(registrySymbol in root.Reflect) &&
890
+ typeof root.Reflect.defineMetadata === "function") {
891
+ // interoperate with older version of `reflect-metadata` that did not support a registry.
892
+ fallback = CreateFallbackProvider(root.Reflect);
893
+ }
894
+ var first;
895
+ var second;
896
+ var rest;
897
+ var targetProviderMap = new _WeakMap();
898
+ var registry = {
899
+ registerProvider: registerProvider,
900
+ getProvider: getProvider,
901
+ setProvider: setProvider,
902
+ };
903
+ return registry;
904
+ function registerProvider(provider) {
905
+ if (!Object.isExtensible(registry)) {
906
+ throw new Error("Cannot add provider to a frozen registry.");
907
+ }
908
+ switch (true) {
909
+ case fallback === provider: break;
910
+ case IsUndefined(first):
911
+ first = provider;
912
+ break;
913
+ case first === provider: break;
914
+ case IsUndefined(second):
915
+ second = provider;
916
+ break;
917
+ case second === provider: break;
918
+ default:
919
+ if (rest === undefined)
920
+ rest = new _Set();
921
+ rest.add(provider);
922
+ break;
923
+ }
924
+ }
925
+ function getProviderNoCache(O, P) {
926
+ if (!IsUndefined(first)) {
927
+ if (first.isProviderFor(O, P))
928
+ return first;
929
+ if (!IsUndefined(second)) {
930
+ if (second.isProviderFor(O, P))
931
+ return first;
932
+ if (!IsUndefined(rest)) {
933
+ var iterator = GetIterator(rest);
934
+ while (true) {
935
+ var next = IteratorStep(iterator);
936
+ if (!next) {
937
+ return undefined;
938
+ }
939
+ var provider = IteratorValue(next);
940
+ if (provider.isProviderFor(O, P)) {
941
+ IteratorClose(iterator);
942
+ return provider;
943
+ }
944
+ }
945
+ }
946
+ }
947
+ }
948
+ if (!IsUndefined(fallback) && fallback.isProviderFor(O, P)) {
949
+ return fallback;
950
+ }
951
+ return undefined;
952
+ }
953
+ function getProvider(O, P) {
954
+ var providerMap = targetProviderMap.get(O);
955
+ var provider;
956
+ if (!IsUndefined(providerMap)) {
957
+ provider = providerMap.get(P);
958
+ }
959
+ if (!IsUndefined(provider)) {
960
+ return provider;
961
+ }
962
+ provider = getProviderNoCache(O, P);
963
+ if (!IsUndefined(provider)) {
964
+ if (IsUndefined(providerMap)) {
965
+ providerMap = new _Map();
966
+ targetProviderMap.set(O, providerMap);
967
+ }
968
+ providerMap.set(P, provider);
969
+ }
970
+ return provider;
971
+ }
972
+ function hasProvider(provider) {
973
+ if (IsUndefined(provider))
974
+ throw new TypeError();
975
+ return first === provider || second === provider || !IsUndefined(rest) && rest.has(provider);
976
+ }
977
+ function setProvider(O, P, provider) {
978
+ if (!hasProvider(provider)) {
979
+ throw new Error("Metadata provider not registered.");
980
+ }
981
+ var existingProvider = getProvider(O, P);
982
+ if (existingProvider !== provider) {
983
+ if (!IsUndefined(existingProvider)) {
984
+ return false;
985
+ }
986
+ var providerMap = targetProviderMap.get(O);
987
+ if (IsUndefined(providerMap)) {
988
+ providerMap = new _Map();
989
+ targetProviderMap.set(O, providerMap);
990
+ }
991
+ providerMap.set(P, provider);
992
+ }
993
+ return true;
994
+ }
995
+ }
996
+ /**
997
+ * Gets or creates the shared registry of metadata providers.
998
+ */
999
+ function GetOrCreateMetadataRegistry() {
1000
+ var metadataRegistry;
1001
+ if (!IsUndefined(registrySymbol) && IsObject(root.Reflect) && Object.isExtensible(root.Reflect)) {
1002
+ metadataRegistry = root.Reflect[registrySymbol];
1003
+ }
1004
+ if (IsUndefined(metadataRegistry)) {
1005
+ metadataRegistry = CreateMetadataRegistry();
1006
+ }
1007
+ if (!IsUndefined(registrySymbol) && IsObject(root.Reflect) && Object.isExtensible(root.Reflect)) {
1008
+ Object.defineProperty(root.Reflect, registrySymbol, {
1009
+ enumerable: false,
1010
+ configurable: false,
1011
+ writable: false,
1012
+ value: metadataRegistry
1013
+ });
1014
+ }
1015
+ return metadataRegistry;
1016
+ }
1017
+ function CreateMetadataProvider(registry) {
1018
+ // [[Metadata]] internal slot
1019
+ // https://rbuckton.github.io/reflect-metadata/#ordinary-object-internal-methods-and-internal-slots
1020
+ var metadata = new _WeakMap();
1021
+ var provider = {
1022
+ isProviderFor: function (O, P) {
1023
+ var targetMetadata = metadata.get(O);
1024
+ if (IsUndefined(targetMetadata))
1025
+ return false;
1026
+ return targetMetadata.has(P);
1027
+ },
1028
+ OrdinaryDefineOwnMetadata: OrdinaryDefineOwnMetadata,
1029
+ OrdinaryHasOwnMetadata: OrdinaryHasOwnMetadata,
1030
+ OrdinaryGetOwnMetadata: OrdinaryGetOwnMetadata,
1031
+ OrdinaryOwnMetadataKeys: OrdinaryOwnMetadataKeys,
1032
+ OrdinaryDeleteMetadata: OrdinaryDeleteMetadata,
1033
+ };
1034
+ metadataRegistry.registerProvider(provider);
1035
+ return provider;
1036
+ function GetOrCreateMetadataMap(O, P, Create) {
1037
+ var targetMetadata = metadata.get(O);
1038
+ var createdTargetMetadata = false;
1039
+ if (IsUndefined(targetMetadata)) {
1040
+ if (!Create)
1041
+ return undefined;
1042
+ targetMetadata = new _Map();
1043
+ metadata.set(O, targetMetadata);
1044
+ createdTargetMetadata = true;
1045
+ }
1046
+ var metadataMap = targetMetadata.get(P);
1047
+ if (IsUndefined(metadataMap)) {
1048
+ if (!Create)
1049
+ return undefined;
1050
+ metadataMap = new _Map();
1051
+ targetMetadata.set(P, metadataMap);
1052
+ if (!registry.setProvider(O, P, provider)) {
1053
+ targetMetadata.delete(P);
1054
+ if (createdTargetMetadata) {
1055
+ metadata.delete(O);
1056
+ }
1057
+ throw new Error("Wrong provider for target.");
1058
+ }
1059
+ }
1060
+ return metadataMap;
1061
+ }
1062
+ // 3.1.2.1 OrdinaryHasOwnMetadata(MetadataKey, O, P)
1063
+ // https://rbuckton.github.io/reflect-metadata/#ordinaryhasownmetadata
1064
+ function OrdinaryHasOwnMetadata(MetadataKey, O, P) {
1065
+ var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);
1066
+ if (IsUndefined(metadataMap))
1067
+ return false;
1068
+ return ToBoolean(metadataMap.has(MetadataKey));
1069
+ }
1070
+ // 3.1.4.1 OrdinaryGetOwnMetadata(MetadataKey, O, P)
1071
+ // https://rbuckton.github.io/reflect-metadata/#ordinarygetownmetadata
1072
+ function OrdinaryGetOwnMetadata(MetadataKey, O, P) {
1073
+ var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);
1074
+ if (IsUndefined(metadataMap))
1075
+ return undefined;
1076
+ return metadataMap.get(MetadataKey);
1077
+ }
1078
+ // 3.1.5.1 OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P)
1079
+ // https://rbuckton.github.io/reflect-metadata/#ordinarydefineownmetadata
1080
+ function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
1081
+ var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ true);
1082
+ metadataMap.set(MetadataKey, MetadataValue);
1083
+ }
1084
+ // 3.1.7.1 OrdinaryOwnMetadataKeys(O, P)
1085
+ // https://rbuckton.github.io/reflect-metadata/#ordinaryownmetadatakeys
1086
+ function OrdinaryOwnMetadataKeys(O, P) {
1087
+ var keys = [];
1088
+ var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);
1089
+ if (IsUndefined(metadataMap))
1090
+ return keys;
1091
+ var keysObj = metadataMap.keys();
1092
+ var iterator = GetIterator(keysObj);
1093
+ var k = 0;
1094
+ while (true) {
1095
+ var next = IteratorStep(iterator);
1096
+ if (!next) {
1097
+ keys.length = k;
1098
+ return keys;
1099
+ }
1100
+ var nextValue = IteratorValue(next);
1101
+ try {
1102
+ keys[k] = nextValue;
1103
+ }
1104
+ catch (e) {
1105
+ try {
1106
+ IteratorClose(iterator);
1107
+ }
1108
+ finally {
1109
+ throw e;
1110
+ }
1111
+ }
1112
+ k++;
1113
+ }
1114
+ }
1115
+ function OrdinaryDeleteMetadata(MetadataKey, O, P) {
1116
+ var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);
1117
+ if (IsUndefined(metadataMap))
1118
+ return false;
1119
+ if (!metadataMap.delete(MetadataKey))
1120
+ return false;
1121
+ if (metadataMap.size === 0) {
1122
+ var targetMetadata = metadata.get(O);
1123
+ if (!IsUndefined(targetMetadata)) {
1124
+ targetMetadata.delete(P);
1125
+ if (targetMetadata.size === 0) {
1126
+ metadata.delete(targetMetadata);
1127
+ }
1128
+ }
1129
+ }
1130
+ return true;
1131
+ }
1132
+ }
1133
+ function CreateFallbackProvider(reflect) {
1134
+ var defineMetadata = reflect.defineMetadata, hasOwnMetadata = reflect.hasOwnMetadata, getOwnMetadata = reflect.getOwnMetadata, getOwnMetadataKeys = reflect.getOwnMetadataKeys, deleteMetadata = reflect.deleteMetadata;
1135
+ var metadataOwner = new _WeakMap();
1136
+ var provider = {
1137
+ isProviderFor: function (O, P) {
1138
+ var metadataPropertySet = metadataOwner.get(O);
1139
+ if (!IsUndefined(metadataPropertySet)) {
1140
+ return metadataPropertySet.has(P);
1141
+ }
1142
+ if (getOwnMetadataKeys(O, P).length) {
1143
+ if (IsUndefined(metadataPropertySet)) {
1144
+ metadataPropertySet = new _Set();
1145
+ metadataOwner.set(O, metadataPropertySet);
1146
+ }
1147
+ metadataPropertySet.add(P);
1148
+ return true;
1149
+ }
1150
+ return false;
1151
+ },
1152
+ OrdinaryDefineOwnMetadata: defineMetadata,
1153
+ OrdinaryHasOwnMetadata: hasOwnMetadata,
1154
+ OrdinaryGetOwnMetadata: getOwnMetadata,
1155
+ OrdinaryOwnMetadataKeys: getOwnMetadataKeys,
1156
+ OrdinaryDeleteMetadata: deleteMetadata,
1157
+ };
1158
+ return provider;
1159
+ }
1160
+ /**
1161
+ * Gets the metadata provider for an object. If the object has no metadata provider and this is for a create operation,
1162
+ * then this module's metadata provider is assigned to the object.
1163
+ */
1164
+ function GetMetadataProvider(O, P, Create) {
1165
+ var registeredProvider = metadataRegistry.getProvider(O, P);
1166
+ if (!IsUndefined(registeredProvider)) {
1167
+ return registeredProvider;
1168
+ }
1169
+ if (Create) {
1170
+ if (metadataRegistry.setProvider(O, P, metadataProvider)) {
1171
+ return metadataProvider;
1172
+ }
1173
+ throw new Error("Illegal state.");
1174
+ }
1175
+ return undefined;
1176
+ }
1177
+ // naive Map shim
1178
+ function CreateMapPolyfill() {
1179
+ var cacheSentinel = {};
1180
+ var arraySentinel = [];
1181
+ var MapIterator = /** @class */ (function () {
1182
+ function MapIterator(keys, values, selector) {
1183
+ this._index = 0;
1184
+ this._keys = keys;
1185
+ this._values = values;
1186
+ this._selector = selector;
1187
+ }
1188
+ MapIterator.prototype["@@iterator"] = function () { return this; };
1189
+ MapIterator.prototype[iteratorSymbol] = function () { return this; };
1190
+ MapIterator.prototype.next = function () {
1191
+ var index = this._index;
1192
+ if (index >= 0 && index < this._keys.length) {
1193
+ var result = this._selector(this._keys[index], this._values[index]);
1194
+ if (index + 1 >= this._keys.length) {
1195
+ this._index = -1;
1196
+ this._keys = arraySentinel;
1197
+ this._values = arraySentinel;
1198
+ }
1199
+ else {
1200
+ this._index++;
1201
+ }
1202
+ return { value: result, done: false };
1203
+ }
1204
+ return { value: undefined, done: true };
1205
+ };
1206
+ MapIterator.prototype.throw = function (error) {
1207
+ if (this._index >= 0) {
1208
+ this._index = -1;
1209
+ this._keys = arraySentinel;
1210
+ this._values = arraySentinel;
1211
+ }
1212
+ throw error;
1213
+ };
1214
+ MapIterator.prototype.return = function (value) {
1215
+ if (this._index >= 0) {
1216
+ this._index = -1;
1217
+ this._keys = arraySentinel;
1218
+ this._values = arraySentinel;
1219
+ }
1220
+ return { value: value, done: true };
1221
+ };
1222
+ return MapIterator;
1223
+ }());
1224
+ var Map = /** @class */ (function () {
1225
+ function Map() {
1226
+ this._keys = [];
1227
+ this._values = [];
1228
+ this._cacheKey = cacheSentinel;
1229
+ this._cacheIndex = -2;
1230
+ }
1231
+ Object.defineProperty(Map.prototype, "size", {
1232
+ get: function () { return this._keys.length; },
1233
+ enumerable: true,
1234
+ configurable: true
1235
+ });
1236
+ Map.prototype.has = function (key) { return this._find(key, /*insert*/ false) >= 0; };
1237
+ Map.prototype.get = function (key) {
1238
+ var index = this._find(key, /*insert*/ false);
1239
+ return index >= 0 ? this._values[index] : undefined;
1240
+ };
1241
+ Map.prototype.set = function (key, value) {
1242
+ var index = this._find(key, /*insert*/ true);
1243
+ this._values[index] = value;
1244
+ return this;
1245
+ };
1246
+ Map.prototype.delete = function (key) {
1247
+ var index = this._find(key, /*insert*/ false);
1248
+ if (index >= 0) {
1249
+ var size = this._keys.length;
1250
+ for (var i = index + 1; i < size; i++) {
1251
+ this._keys[i - 1] = this._keys[i];
1252
+ this._values[i - 1] = this._values[i];
1253
+ }
1254
+ this._keys.length--;
1255
+ this._values.length--;
1256
+ if (SameValueZero(key, this._cacheKey)) {
1257
+ this._cacheKey = cacheSentinel;
1258
+ this._cacheIndex = -2;
1259
+ }
1260
+ return true;
1261
+ }
1262
+ return false;
1263
+ };
1264
+ Map.prototype.clear = function () {
1265
+ this._keys.length = 0;
1266
+ this._values.length = 0;
1267
+ this._cacheKey = cacheSentinel;
1268
+ this._cacheIndex = -2;
1269
+ };
1270
+ Map.prototype.keys = function () { return new MapIterator(this._keys, this._values, getKey); };
1271
+ Map.prototype.values = function () { return new MapIterator(this._keys, this._values, getValue); };
1272
+ Map.prototype.entries = function () { return new MapIterator(this._keys, this._values, getEntry); };
1273
+ Map.prototype["@@iterator"] = function () { return this.entries(); };
1274
+ Map.prototype[iteratorSymbol] = function () { return this.entries(); };
1275
+ Map.prototype._find = function (key, insert) {
1276
+ if (!SameValueZero(this._cacheKey, key)) {
1277
+ this._cacheIndex = -1;
1278
+ for (var i = 0; i < this._keys.length; i++) {
1279
+ if (SameValueZero(this._keys[i], key)) {
1280
+ this._cacheIndex = i;
1281
+ break;
1282
+ }
1283
+ }
1284
+ }
1285
+ if (this._cacheIndex < 0 && insert) {
1286
+ this._cacheIndex = this._keys.length;
1287
+ this._keys.push(key);
1288
+ this._values.push(undefined);
1289
+ }
1290
+ return this._cacheIndex;
1291
+ };
1292
+ return Map;
1293
+ }());
1294
+ return Map;
1295
+ function getKey(key, _) {
1296
+ return key;
1297
+ }
1298
+ function getValue(_, value) {
1299
+ return value;
1300
+ }
1301
+ function getEntry(key, value) {
1302
+ return [key, value];
1303
+ }
1304
+ }
1305
+ // naive Set shim
1306
+ function CreateSetPolyfill() {
1307
+ var Set = /** @class */ (function () {
1308
+ function Set() {
1309
+ this._map = new _Map();
1310
+ }
1311
+ Object.defineProperty(Set.prototype, "size", {
1312
+ get: function () { return this._map.size; },
1313
+ enumerable: true,
1314
+ configurable: true
1315
+ });
1316
+ Set.prototype.has = function (value) { return this._map.has(value); };
1317
+ Set.prototype.add = function (value) { return this._map.set(value, value), this; };
1318
+ Set.prototype.delete = function (value) { return this._map.delete(value); };
1319
+ Set.prototype.clear = function () { this._map.clear(); };
1320
+ Set.prototype.keys = function () { return this._map.keys(); };
1321
+ Set.prototype.values = function () { return this._map.keys(); };
1322
+ Set.prototype.entries = function () { return this._map.entries(); };
1323
+ Set.prototype["@@iterator"] = function () { return this.keys(); };
1324
+ Set.prototype[iteratorSymbol] = function () { return this.keys(); };
1325
+ return Set;
1326
+ }());
1327
+ return Set;
1328
+ }
1329
+ // naive WeakMap shim
1330
+ function CreateWeakMapPolyfill() {
1331
+ var UUID_SIZE = 16;
1332
+ var keys = HashMap.create();
1333
+ var rootKey = CreateUniqueKey();
1334
+ return /** @class */ (function () {
1335
+ function WeakMap() {
1336
+ this._key = CreateUniqueKey();
1337
+ }
1338
+ WeakMap.prototype.has = function (target) {
1339
+ var table = GetOrCreateWeakMapTable(target, /*create*/ false);
1340
+ return table !== undefined ? HashMap.has(table, this._key) : false;
1341
+ };
1342
+ WeakMap.prototype.get = function (target) {
1343
+ var table = GetOrCreateWeakMapTable(target, /*create*/ false);
1344
+ return table !== undefined ? HashMap.get(table, this._key) : undefined;
1345
+ };
1346
+ WeakMap.prototype.set = function (target, value) {
1347
+ var table = GetOrCreateWeakMapTable(target, /*create*/ true);
1348
+ table[this._key] = value;
1349
+ return this;
1350
+ };
1351
+ WeakMap.prototype.delete = function (target) {
1352
+ var table = GetOrCreateWeakMapTable(target, /*create*/ false);
1353
+ return table !== undefined ? delete table[this._key] : false;
1354
+ };
1355
+ WeakMap.prototype.clear = function () {
1356
+ // NOTE: not a real clear, just makes the previous data unreachable
1357
+ this._key = CreateUniqueKey();
1358
+ };
1359
+ return WeakMap;
1360
+ }());
1361
+ function CreateUniqueKey() {
1362
+ var key;
1363
+ do
1364
+ key = "@@WeakMap@@" + CreateUUID();
1365
+ while (HashMap.has(keys, key));
1366
+ keys[key] = true;
1367
+ return key;
1368
+ }
1369
+ function GetOrCreateWeakMapTable(target, create) {
1370
+ if (!hasOwn.call(target, rootKey)) {
1371
+ if (!create)
1372
+ return undefined;
1373
+ Object.defineProperty(target, rootKey, { value: HashMap.create() });
1374
+ }
1375
+ return target[rootKey];
1376
+ }
1377
+ function FillRandomBytes(buffer, size) {
1378
+ for (var i = 0; i < size; ++i)
1379
+ buffer[i] = Math.random() * 0xff | 0;
1380
+ return buffer;
1381
+ }
1382
+ function GenRandomBytes(size) {
1383
+ if (typeof Uint8Array === "function") {
1384
+ if (typeof crypto !== "undefined")
1385
+ return crypto.getRandomValues(new Uint8Array(size));
1386
+ if (typeof msCrypto !== "undefined")
1387
+ return msCrypto.getRandomValues(new Uint8Array(size));
1388
+ return FillRandomBytes(new Uint8Array(size), size);
1389
+ }
1390
+ return FillRandomBytes(new Array(size), size);
1391
+ }
1392
+ function CreateUUID() {
1393
+ var data = GenRandomBytes(UUID_SIZE);
1394
+ // mark as random - RFC 4122 § 4.4
1395
+ data[6] = data[6] & 0x4f | 0x40;
1396
+ data[8] = data[8] & 0xbf | 0x80;
1397
+ var result = "";
1398
+ for (var offset = 0; offset < UUID_SIZE; ++offset) {
1399
+ var byte = data[offset];
1400
+ if (offset === 4 || offset === 6 || offset === 8)
1401
+ result += "-";
1402
+ if (byte < 16)
1403
+ result += "0";
1404
+ result += byte.toString(16).toLowerCase();
1405
+ }
1406
+ return result;
1407
+ }
1408
+ }
1409
+ // uses a heuristic used by v8 and chakra to force an object into dictionary mode.
1410
+ function MakeDictionary(obj) {
1411
+ obj.__ = undefined;
1412
+ delete obj.__;
1413
+ return obj;
1414
+ }
1415
+ });
1416
+ })(Reflect || (Reflect = {}));
1417
+ return _Reflect;
1418
+ }
1419
+
1420
+ require_Reflect();
12
1421
 
13
1422
  /**
14
1423
  * @ author: richen
@@ -183,6 +1592,7 @@ function convertParamsType(param, type) {
183
1592
  default: //any
184
1593
  return param;
185
1594
  }
1595
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
186
1596
  }
187
1597
  catch (err) {
188
1598
  return param;
@@ -332,7 +1742,7 @@ function plateNumber(value) {
332
1742
  * @Usage:
333
1743
  * @Author: richen
334
1744
  * @Date: 2021-11-25 10:47:04
335
- * @LastEditTime: 2024-01-03 14:32:49
1745
+ * @LastEditTime: 2024-10-31 16:57:28
336
1746
  */
337
1747
  // constant
338
1748
  const PARAM_TYPE_KEY = 'PARAM_TYPE_KEY';
@@ -369,6 +1779,7 @@ var paramterTypes;
369
1779
  paramterTypes[paramterTypes["undefined"] = 19] = "undefined";
370
1780
  })(paramterTypes || (paramterTypes = {}));
371
1781
  class ValidateClass {
1782
+ static instance;
372
1783
  constructor() {
373
1784
  }
374
1785
  /**
@@ -391,20 +1802,10 @@ class ValidateClass {
391
1802
  * @memberof ValidateClass
392
1803
  */
393
1804
  async valid(Clazz, data, convert = false) {
394
- let obj = {};
395
- if (data instanceof Clazz) {
396
- obj = data;
397
- }
398
- else {
399
- obj = plainToClass(Clazz, data, convert);
400
- }
401
- let errors = [];
402
- if (convert) {
403
- errors = await validate(obj);
404
- }
405
- else {
406
- errors = await validate(obj, { skipMissingProperties: true });
407
- }
1805
+ const obj = data instanceof Clazz ? data : plainToClass(Clazz, data, convert);
1806
+ const errors = convert
1807
+ ? await validate(obj)
1808
+ : await validate(obj, { skipMissingProperties: true });
408
1809
  if (errors.length > 0) {
409
1810
  throw new Error(Object.values(errors[0].constraints)[0]);
410
1811
  }
@@ -577,71 +1978,7 @@ const ValidFuncs = {
577
1978
  * @param {(string | ValidOtpions)} [options]
578
1979
  * @returns {*}
579
1980
  */
580
- const FunctionValidator = {
581
- IsNotEmpty: function (value, options) {
582
- throw new Error("Function not implemented.");
583
- },
584
- IsDate: function (value, options) {
585
- throw new Error("Function not implemented.");
586
- },
587
- IsEmail: function (value, options) {
588
- throw new Error("Function not implemented.");
589
- },
590
- IsIP: function (value, options) {
591
- throw new Error("Function not implemented.");
592
- },
593
- IsPhoneNumber: function (value, options) {
594
- throw new Error("Function not implemented.");
595
- },
596
- IsUrl: function (value, options) {
597
- throw new Error("Function not implemented.");
598
- },
599
- IsHash: function (value, options) {
600
- throw new Error("Function not implemented.");
601
- },
602
- IsCnName: function (value, options) {
603
- throw new Error("Function not implemented.");
604
- },
605
- IsIdNumber: function (value, options) {
606
- throw new Error("Function not implemented.");
607
- },
608
- IsZipCode: function (value, options) {
609
- throw new Error("Function not implemented.");
610
- },
611
- IsMobile: function (value, options) {
612
- throw new Error("Function not implemented.");
613
- },
614
- IsPlateNumber: function (value, options) {
615
- throw new Error("Function not implemented.");
616
- },
617
- Equals: function (value, options) {
618
- throw new Error("Function not implemented.");
619
- },
620
- NotEquals: function (value, options) {
621
- throw new Error("Function not implemented.");
622
- },
623
- Contains: function (value, options) {
624
- throw new Error("Function not implemented.");
625
- },
626
- IsIn: function (value, options) {
627
- throw new Error("Function not implemented.");
628
- },
629
- IsNotIn: function (value, options) {
630
- throw new Error("Function not implemented.");
631
- },
632
- Gt: function (value, options) {
633
- throw new Error("Function not implemented.");
634
- },
635
- Lt: function (value, options) {
636
- throw new Error("Function not implemented.");
637
- },
638
- Gte: function (value, options) {
639
- throw new Error("Function not implemented.");
640
- },
641
- Lte: function (value, options) {
642
- throw new Error("Function not implemented.");
643
- }
644
- };
1981
+ const FunctionValidator = {};
645
1982
  Object.keys(ValidFuncs).forEach((key) => {
646
1983
  FunctionValidator[key] = (value, options) => {
647
1984
  if (helper.isString(options)) {
@@ -658,7 +1995,7 @@ Object.keys(ValidFuncs).forEach((key) => {
658
1995
  * @Usage:
659
1996
  * @Author: richen
660
1997
  * @Date: 2021-11-25 10:46:57
661
- * @LastEditTime: 2024-01-03 11:30:55
1998
+ * @LastEditTime: 2024-10-31 16:49:26
662
1999
  */
663
2000
  /**
664
2001
  * Validation parameter's type and values.
@@ -678,10 +2015,9 @@ function Valid(rule, options) {
678
2015
  rules = rule;
679
2016
  }
680
2017
  return (target, propertyKey, descriptor) => {
681
- var _a;
682
2018
  // 获取成员参数类型
683
2019
  const paramTypes = Reflect.getMetadata("design:paramtypes", target, propertyKey);
684
- const type = ((_a = paramTypes[descriptor]) === null || _a === void 0 ? void 0 : _a.name) ? paramTypes[descriptor].name : 'object';
2020
+ const type = (paramTypes[descriptor]?.name) ? paramTypes[descriptor].name : 'object';
685
2021
  if (helper.isString(options)) {
686
2022
  options = { message: options, value: null };
687
2023
  }
@@ -701,7 +2037,7 @@ function Valid(rule, options) {
701
2037
  * @returns {MethodDecorator}
702
2038
  */
703
2039
  function Validated() {
704
- return (target, propertyKey, descriptor) => {
2040
+ return (target, propertyKey, _descriptor) => {
705
2041
  //
706
2042
  IOCContainer.savePropertyData(PARAM_CHECK_KEY, {
707
2043
  dtoCheck: 1
@@ -773,10 +2109,10 @@ function IsCnName(validationOptions) {
773
2109
  propertyName,
774
2110
  options: validationOptions,
775
2111
  validator: {
776
- validate(value, args) {
2112
+ validate(value, _args) {
777
2113
  return cnName(value);
778
2114
  },
779
- defaultMessage(args) {
2115
+ defaultMessage(_args) {
780
2116
  return "invalid parameter ($property).";
781
2117
  }
782
2118
  }
@@ -800,10 +2136,10 @@ function IsIdNumber(validationOptions) {
800
2136
  propertyName,
801
2137
  options: validationOptions,
802
2138
  validator: {
803
- validate(value, args) {
2139
+ validate(value, _args) {
804
2140
  return idNumber(value);
805
2141
  },
806
- defaultMessage(args) {
2142
+ defaultMessage(_args) {
807
2143
  return "invalid parameter ($property).";
808
2144
  }
809
2145
  }
@@ -827,10 +2163,10 @@ function IsZipCode(validationOptions) {
827
2163
  propertyName,
828
2164
  options: validationOptions,
829
2165
  validator: {
830
- validate(value, args) {
2166
+ validate(value, _args) {
831
2167
  return zipCode(value);
832
2168
  },
833
- defaultMessage(args) {
2169
+ defaultMessage(_args) {
834
2170
  return "invalid parameter ($property).";
835
2171
  }
836
2172
  }
@@ -854,10 +2190,10 @@ function IsMobile(validationOptions) {
854
2190
  propertyName,
855
2191
  options: validationOptions,
856
2192
  validator: {
857
- validate(value, args) {
2193
+ validate(value, _args) {
858
2194
  return mobile(value);
859
2195
  },
860
- defaultMessage(args) {
2196
+ defaultMessage(_args) {
861
2197
  return "invalid parameter ($property).";
862
2198
  }
863
2199
  }
@@ -881,10 +2217,10 @@ function IsPlateNumber(validationOptions) {
881
2217
  propertyName,
882
2218
  options: validationOptions,
883
2219
  validator: {
884
- validate(value, args) {
2220
+ validate(value, _args) {
885
2221
  return plateNumber(value);
886
2222
  },
887
- defaultMessage(args) {
2223
+ defaultMessage(_args) {
888
2224
  return "invalid parameter ($property).";
889
2225
  }
890
2226
  }
@@ -907,10 +2243,10 @@ function IsNotEmpty(validationOptions) {
907
2243
  propertyName,
908
2244
  options: validationOptions,
909
2245
  validator: {
910
- validate(value, args) {
2246
+ validate(value, _args) {
911
2247
  return !helper.isEmpty(value);
912
2248
  },
913
- defaultMessage(args) {
2249
+ defaultMessage(_args) {
914
2250
  return "invalid parameter ($property).";
915
2251
  }
916
2252
  }
@@ -934,10 +2270,10 @@ function Equals(comparison, validationOptions) {
934
2270
  propertyName,
935
2271
  options: validationOptions,
936
2272
  validator: {
937
- validate(value, args) {
2273
+ validate(value, _args) {
938
2274
  return equals(value, comparison);
939
2275
  },
940
- defaultMessage(args) {
2276
+ defaultMessage(_args) {
941
2277
  return `invalid parameter, ($property) must be equals ${comparison}.`;
942
2278
  }
943
2279
  }
@@ -961,10 +2297,10 @@ function NotEquals(comparison, validationOptions) {
961
2297
  propertyName,
962
2298
  options: validationOptions,
963
2299
  validator: {
964
- validate(value, args) {
2300
+ validate(value, _args) {
965
2301
  return notEquals(value, comparison);
966
2302
  },
967
- defaultMessage(args) {
2303
+ defaultMessage(_args) {
968
2304
  return `invalid parameter, ($property) must be not equals ${comparison}.`;
969
2305
  }
970
2306
  }
@@ -988,11 +2324,11 @@ function Contains(seed, validationOptions) {
988
2324
  propertyName,
989
2325
  options: validationOptions,
990
2326
  validator: {
991
- validate(value, args) {
2327
+ validate(value, _args) {
992
2328
  return contains(value, seed);
993
2329
  // return typeof value === "string" && (value.indexOf(seed) > -1);
994
2330
  },
995
- defaultMessage(args) {
2331
+ defaultMessage(_args) {
996
2332
  return `invalid parameter, ($property) must be contains ${seed}.`;
997
2333
  }
998
2334
  }
@@ -1016,10 +2352,10 @@ function IsIn(possibleValues, validationOptions) {
1016
2352
  propertyName,
1017
2353
  options: validationOptions,
1018
2354
  validator: {
1019
- validate(value, args) {
2355
+ validate(value, _args) {
1020
2356
  return isIn(value, possibleValues);
1021
2357
  },
1022
- defaultMessage(args) {
2358
+ defaultMessage(_args) {
1023
2359
  return `invalid parameter ($property).`;
1024
2360
  }
1025
2361
  }
@@ -1043,10 +2379,10 @@ function IsNotIn(possibleValues, validationOptions) {
1043
2379
  propertyName,
1044
2380
  options: validationOptions,
1045
2381
  validator: {
1046
- validate(value, args) {
2382
+ validate(value, _args) {
1047
2383
  return isNotIn(value, possibleValues);
1048
2384
  },
1049
- defaultMessage(args) {
2385
+ defaultMessage(_args) {
1050
2386
  return `invalid parameter ($property).`;
1051
2387
  }
1052
2388
  }
@@ -1069,10 +2405,10 @@ function IsDate(validationOptions) {
1069
2405
  propertyName,
1070
2406
  options: validationOptions,
1071
2407
  validator: {
1072
- validate(value, args) {
2408
+ validate(value, _args) {
1073
2409
  return isDate(value);
1074
2410
  },
1075
- defaultMessage(args) {
2411
+ defaultMessage(_args) {
1076
2412
  return `invalid parameter ($property).`;
1077
2413
  }
1078
2414
  }
@@ -1096,10 +2432,10 @@ function Gt(min, validationOptions) {
1096
2432
  propertyName,
1097
2433
  options: validationOptions,
1098
2434
  validator: {
1099
- validate(value, args) {
2435
+ validate(value, _args) {
1100
2436
  return helper.toNumber(value) > min;
1101
2437
  },
1102
- defaultMessage(args) {
2438
+ defaultMessage(_args) {
1103
2439
  return `invalid parameter ($property).`;
1104
2440
  }
1105
2441
  }
@@ -1123,10 +2459,10 @@ function Lt(max, validationOptions) {
1123
2459
  propertyName,
1124
2460
  options: validationOptions,
1125
2461
  validator: {
1126
- validate(value, args) {
2462
+ validate(value, _args) {
1127
2463
  return helper.toNumber(value) < max;
1128
2464
  },
1129
- defaultMessage(args) {
2465
+ defaultMessage(_args) {
1130
2466
  return `invalid parameter ($property).`;
1131
2467
  }
1132
2468
  }
@@ -1150,10 +2486,10 @@ function Gte(min, validationOptions) {
1150
2486
  propertyName,
1151
2487
  options: validationOptions,
1152
2488
  validator: {
1153
- validate(value, args) {
2489
+ validate(value, _args) {
1154
2490
  return helper.toNumber(value) >= min;
1155
2491
  },
1156
- defaultMessage(args) {
2492
+ defaultMessage(_args) {
1157
2493
  return `invalid parameter ($property).`;
1158
2494
  }
1159
2495
  }
@@ -1177,10 +2513,10 @@ function Lte(max, validationOptions) {
1177
2513
  propertyName,
1178
2514
  options: validationOptions,
1179
2515
  validator: {
1180
- validate(value, args) {
2516
+ validate(value, _args) {
1181
2517
  return helper.toNumber(value) <= max;
1182
2518
  },
1183
- defaultMessage(args) {
2519
+ defaultMessage(_args) {
1184
2520
  return `invalid parameter ($property).`;
1185
2521
  }
1186
2522
  }
@@ -1206,10 +2542,10 @@ function Length(min, max, validationOptions) {
1206
2542
  propertyName,
1207
2543
  options: validationOptions,
1208
2544
  validator: {
1209
- validate(value, args) {
2545
+ validate(value, _args) {
1210
2546
  return length(value, min, max);
1211
2547
  },
1212
- defaultMessage(args) {
2548
+ defaultMessage(_args) {
1213
2549
  return `invalid parameter ($property).`;
1214
2550
  }
1215
2551
  }
@@ -1233,10 +2569,10 @@ function IsEmail(options, validationOptions) {
1233
2569
  propertyName,
1234
2570
  options: validationOptions,
1235
2571
  validator: {
1236
- validate(value, args) {
2572
+ validate(value, _args) {
1237
2573
  return isEmail(value);
1238
2574
  },
1239
- defaultMessage(args) {
2575
+ defaultMessage(_args) {
1240
2576
  return `invalid parameter ($property).`;
1241
2577
  }
1242
2578
  }
@@ -1260,10 +2596,10 @@ function IsIP(version, validationOptions) {
1260
2596
  propertyName,
1261
2597
  options: validationOptions,
1262
2598
  validator: {
1263
- validate(value, args) {
2599
+ validate(value, _args) {
1264
2600
  return isIP(value, version);
1265
2601
  },
1266
- defaultMessage(args) {
2602
+ defaultMessage(_args) {
1267
2603
  return `invalid parameter ($property).`;
1268
2604
  }
1269
2605
  }
@@ -1290,10 +2626,10 @@ function IsPhoneNumber(region, validationOptions) {
1290
2626
  propertyName,
1291
2627
  options: validationOptions,
1292
2628
  validator: {
1293
- validate(value, args) {
2629
+ validate(value, _args) {
1294
2630
  return isPhoneNumber(value, region);
1295
2631
  },
1296
- defaultMessage(args) {
2632
+ defaultMessage(_args) {
1297
2633
  return `invalid parameter ($property).`;
1298
2634
  }
1299
2635
  }
@@ -1317,10 +2653,10 @@ function IsUrl(options, validationOptions) {
1317
2653
  propertyName,
1318
2654
  options: validationOptions,
1319
2655
  validator: {
1320
- validate(value, args) {
2656
+ validate(value, _args) {
1321
2657
  return isURL(value, options);
1322
2658
  },
1323
- defaultMessage(args) {
2659
+ defaultMessage(_args) {
1324
2660
  return `invalid parameter ($property).`;
1325
2661
  }
1326
2662
  }
@@ -1345,10 +2681,10 @@ function IsHash(algorithm, validationOptions) {
1345
2681
  propertyName,
1346
2682
  options: validationOptions,
1347
2683
  validator: {
1348
- validate(value, args) {
2684
+ validate(value, _args) {
1349
2685
  return isHash(value, algorithm);
1350
2686
  },
1351
- defaultMessage(args) {
2687
+ defaultMessage(_args) {
1352
2688
  return `invalid parameter, ($property) must be is an ${algorithm} Hash string.`;
1353
2689
  }
1354
2690
  }
@@ -1370,10 +2706,10 @@ function CheckFunc(func, validationOptions) {
1370
2706
  propertyName,
1371
2707
  options: validationOptions,
1372
2708
  validator: {
1373
- validate(value, args) {
2709
+ validate(value, _args) {
1374
2710
  return func(value);
1375
2711
  },
1376
- defaultMessage(args) {
2712
+ defaultMessage(_args) {
1377
2713
  return `invalid parameter ($property).`;
1378
2714
  }
1379
2715
  }