@catbee/utils 2.0.0-next.0 → 2.0.0-next.1
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/README.md +52 -16
- package/array/index.cjs +180 -71
- package/array/index.d.ts +293 -1
- package/array/index.mjs +171 -72
- package/async/index.cjs +92 -36
- package/async/index.d.ts +275 -1
- package/async/index.mjs +92 -36
- package/cache/index.cjs +1 -1
- package/cache/index.d.ts +155 -1
- package/cache/index.mjs +2 -2
- package/config/index.cjs +78 -64
- package/config/index.d.ts +64 -2
- package/config/index.mjs +76 -64
- package/context-store/index.d.ts +192 -1
- package/crypto/index.d.ts +163 -1
- package/date/index.cjs +46 -1
- package/date/index.d.ts +190 -1
- package/date/index.mjs +45 -2
- package/decorators/index.cjs +1156 -18
- package/decorators/index.d.ts +684 -1
- package/decorators/index.mjs +1156 -18
- package/dir/index.cjs +4 -3
- package/dir/index.d.ts +195 -1
- package/dir/index.mjs +4 -3
- package/env/index.cjs +10 -26
- package/env/index.d.ts +379 -1
- package/env/index.mjs +10 -26
- package/exception/index.d.ts +232 -1
- package/fs/index.cjs +70 -36
- package/fs/index.d.ts +205 -1
- package/fs/index.mjs +64 -34
- package/http-status-codes/index.d.ts +267 -1
- package/id/index.d.ts +37 -1
- package/index.cjs +3 -3
- package/index.d.ts +1 -1
- package/index.mjs +1 -1
- package/logger/index.cjs +11 -11
- package/logger/index.d.ts +189 -1
- package/logger/index.mjs +12 -12
- package/middleware/index.d.ts +103 -1
- package/obj/index.cjs +150 -162
- package/obj/index.d.ts +136 -1
- package/obj/index.mjs +150 -162
- package/package.json +11 -11
- package/performance/index.cjs +2 -2
- package/performance/index.d.ts +138 -1
- package/performance/index.mjs +2 -2
- package/request/index.cjs +1 -1
- package/request/index.d.ts +241 -2
- package/request/index.mjs +1 -1
- package/response/index.d.ts +318 -2
- package/server/index.cjs +27 -23
- package/server/index.d.ts +785 -4
- package/server/index.mjs +28 -23
- package/stream/index.d.ts +90 -1
- package/string/index.d.ts +102 -1
- package/type/index.cjs +1 -1
- package/type/index.d.ts +107 -1
- package/type/index.mjs +1 -1
- package/types/index.d.ts +774 -4
- package/url/index.cjs +2 -4
- package/url/index.d.ts +142 -1
- package/url/index.mjs +2 -4
- package/{validate → validation}/index.cjs +89 -42
- package/{validate/validate.utils.d.ts → validation/index.d.ts} +32 -23
- package/{validate → validation}/index.mjs +85 -42
- package/array/array.utils.d.ts +0 -191
- package/async/async.utils.d.ts +0 -296
- package/cache/cache.utils.d.ts +0 -176
- package/config/config.d.ts +0 -57
- package/context-store/context-store.utils.d.ts +0 -212
- package/crypto/crypto.utils.d.ts +0 -183
- package/date/date.utils.d.ts +0 -190
- package/decorators/decorators.utils.d.ts +0 -705
- package/dir/dir.utils.d.ts +0 -216
- package/env/env.utils.d.ts +0 -400
- package/exception/exception.utils.d.ts +0 -253
- package/fs/fs.utils.d.ts +0 -196
- package/http-status-codes/http-status-codes.d.ts +0 -289
- package/id/id.utils.d.ts +0 -59
- package/logger/logger.utils.d.ts +0 -210
- package/middleware/middleware.utils.d.ts +0 -123
- package/obj/obj.utils.d.ts +0 -156
- package/performance/performance.utils.d.ts +0 -159
- package/request/request.utils.d.ts +0 -109
- package/response/response.utils.d.ts +0 -186
- package/server/server.builder.d.ts +0 -531
- package/server/server.d.ts +0 -303
- package/stream/stream.utils.d.ts +0 -111
- package/string/string.utils.d.ts +0 -124
- package/type/type.utils.d.ts +0 -129
- package/types/api-response.d.ts +0 -175
- package/types/common.d.ts +0 -148
- package/types/config.d.ts +0 -88
- package/types/server.d.ts +0 -291
- package/url/url.utils.d.ts +0 -164
- package/validate/index.d.ts +0 -25
package/decorators/index.cjs
CHANGED
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
|
|
25
25
|
'use strict';
|
|
26
26
|
|
|
27
|
-
require('reflect-metadata');
|
|
28
27
|
var logger = require('@catbee/utils/logger');
|
|
29
28
|
var response = require('@catbee/utils/response');
|
|
30
29
|
var httpStatusCodes = require('@catbee/utils/http-status-codes');
|
|
@@ -33,8 +32,1128 @@ var exception = require('@catbee/utils/exception');
|
|
|
33
32
|
var async = require('@catbee/utils/async');
|
|
34
33
|
var server = require('@catbee/utils/server');
|
|
35
34
|
|
|
35
|
+
var __create = Object.create;
|
|
36
36
|
var __defProp = Object.defineProperty;
|
|
37
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
38
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
39
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
40
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
37
41
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
42
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
43
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
44
|
+
};
|
|
45
|
+
var __copyProps = (to, from, except, desc) => {
|
|
46
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
47
|
+
for (let key of __getOwnPropNames(from))
|
|
48
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
49
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
50
|
+
}
|
|
51
|
+
return to;
|
|
52
|
+
};
|
|
53
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
54
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
55
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
56
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
57
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
58
|
+
!mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
59
|
+
mod
|
|
60
|
+
));
|
|
61
|
+
|
|
62
|
+
// node_modules/reflect-metadata/Reflect.js
|
|
63
|
+
var require_Reflect = __commonJS({
|
|
64
|
+
"node_modules/reflect-metadata/Reflect.js"() {
|
|
65
|
+
var Reflect2;
|
|
66
|
+
(function(Reflect3) {
|
|
67
|
+
(function(factory) {
|
|
68
|
+
var root = typeof globalThis === "object" ? globalThis : typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : sloppyModeThis();
|
|
69
|
+
var exporter = makeExporter(Reflect3);
|
|
70
|
+
if (typeof root.Reflect !== "undefined") {
|
|
71
|
+
exporter = makeExporter(root.Reflect, exporter);
|
|
72
|
+
}
|
|
73
|
+
factory(exporter, root);
|
|
74
|
+
if (typeof root.Reflect === "undefined") {
|
|
75
|
+
root.Reflect = Reflect3;
|
|
76
|
+
}
|
|
77
|
+
function makeExporter(target, previous) {
|
|
78
|
+
return function(key, value) {
|
|
79
|
+
Object.defineProperty(target, key, {
|
|
80
|
+
configurable: true,
|
|
81
|
+
writable: true,
|
|
82
|
+
value
|
|
83
|
+
});
|
|
84
|
+
if (previous) previous(key, value);
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
__name(makeExporter, "makeExporter");
|
|
88
|
+
function functionThis() {
|
|
89
|
+
try {
|
|
90
|
+
return Function("return this;")();
|
|
91
|
+
} catch (_) {
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
__name(functionThis, "functionThis");
|
|
95
|
+
function indirectEvalThis() {
|
|
96
|
+
try {
|
|
97
|
+
return (0, eval)("(function() { return this; })()");
|
|
98
|
+
} catch (_) {
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
__name(indirectEvalThis, "indirectEvalThis");
|
|
102
|
+
function sloppyModeThis() {
|
|
103
|
+
return functionThis() || indirectEvalThis();
|
|
104
|
+
}
|
|
105
|
+
__name(sloppyModeThis, "sloppyModeThis");
|
|
106
|
+
})(function(exporter, root) {
|
|
107
|
+
var hasOwn = Object.prototype.hasOwnProperty;
|
|
108
|
+
var supportsSymbol = typeof Symbol === "function";
|
|
109
|
+
var toPrimitiveSymbol = supportsSymbol && typeof Symbol.toPrimitive !== "undefined" ? Symbol.toPrimitive : "@@toPrimitive";
|
|
110
|
+
var iteratorSymbol = supportsSymbol && typeof Symbol.iterator !== "undefined" ? Symbol.iterator : "@@iterator";
|
|
111
|
+
var supportsCreate = typeof Object.create === "function";
|
|
112
|
+
var supportsProto = {
|
|
113
|
+
__proto__: []
|
|
114
|
+
} instanceof Array;
|
|
115
|
+
var downLevel = !supportsCreate && !supportsProto;
|
|
116
|
+
var HashMap = {
|
|
117
|
+
// create an object in dictionary mode (a.k.a. "slow" mode in v8)
|
|
118
|
+
create: supportsCreate ? function() {
|
|
119
|
+
return MakeDictionary(/* @__PURE__ */ Object.create(null));
|
|
120
|
+
} : supportsProto ? function() {
|
|
121
|
+
return MakeDictionary({
|
|
122
|
+
__proto__: null
|
|
123
|
+
});
|
|
124
|
+
} : function() {
|
|
125
|
+
return MakeDictionary({});
|
|
126
|
+
},
|
|
127
|
+
has: downLevel ? function(map, key) {
|
|
128
|
+
return hasOwn.call(map, key);
|
|
129
|
+
} : function(map, key) {
|
|
130
|
+
return key in map;
|
|
131
|
+
},
|
|
132
|
+
get: downLevel ? function(map, key) {
|
|
133
|
+
return hasOwn.call(map, key) ? map[key] : void 0;
|
|
134
|
+
} : function(map, key) {
|
|
135
|
+
return map[key];
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
var functionPrototype = Object.getPrototypeOf(Function);
|
|
139
|
+
var _Map = typeof Map === "function" && typeof Map.prototype.entries === "function" ? Map : CreateMapPolyfill();
|
|
140
|
+
var _Set = typeof Set === "function" && typeof Set.prototype.entries === "function" ? Set : CreateSetPolyfill();
|
|
141
|
+
var _WeakMap = typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill();
|
|
142
|
+
var registrySymbol = supportsSymbol ? Symbol.for("@reflect-metadata:registry") : void 0;
|
|
143
|
+
var metadataRegistry = GetOrCreateMetadataRegistry();
|
|
144
|
+
var metadataProvider = CreateMetadataProvider(metadataRegistry);
|
|
145
|
+
function decorate(decorators, target, propertyKey, attributes) {
|
|
146
|
+
if (!IsUndefined(propertyKey)) {
|
|
147
|
+
if (!IsArray(decorators)) throw new TypeError();
|
|
148
|
+
if (!IsObject(target)) throw new TypeError();
|
|
149
|
+
if (!IsObject(attributes) && !IsUndefined(attributes) && !IsNull(attributes)) throw new TypeError();
|
|
150
|
+
if (IsNull(attributes)) attributes = void 0;
|
|
151
|
+
propertyKey = ToPropertyKey(propertyKey);
|
|
152
|
+
return DecorateProperty(decorators, target, propertyKey, attributes);
|
|
153
|
+
} else {
|
|
154
|
+
if (!IsArray(decorators)) throw new TypeError();
|
|
155
|
+
if (!IsConstructor(target)) throw new TypeError();
|
|
156
|
+
return DecorateConstructor(decorators, target);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
__name(decorate, "decorate");
|
|
160
|
+
exporter("decorate", decorate);
|
|
161
|
+
function metadata(metadataKey, metadataValue) {
|
|
162
|
+
function decorator(target, propertyKey) {
|
|
163
|
+
if (!IsObject(target)) throw new TypeError();
|
|
164
|
+
if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey)) throw new TypeError();
|
|
165
|
+
OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
|
|
166
|
+
}
|
|
167
|
+
__name(decorator, "decorator");
|
|
168
|
+
return decorator;
|
|
169
|
+
}
|
|
170
|
+
__name(metadata, "metadata");
|
|
171
|
+
exporter("metadata", metadata);
|
|
172
|
+
function defineMetadata(metadataKey, metadataValue, target, propertyKey) {
|
|
173
|
+
if (!IsObject(target)) throw new TypeError();
|
|
174
|
+
if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
|
|
175
|
+
return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
|
|
176
|
+
}
|
|
177
|
+
__name(defineMetadata, "defineMetadata");
|
|
178
|
+
exporter("defineMetadata", defineMetadata);
|
|
179
|
+
function hasMetadata(metadataKey, target, propertyKey) {
|
|
180
|
+
if (!IsObject(target)) throw new TypeError();
|
|
181
|
+
if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
|
|
182
|
+
return OrdinaryHasMetadata(metadataKey, target, propertyKey);
|
|
183
|
+
}
|
|
184
|
+
__name(hasMetadata, "hasMetadata");
|
|
185
|
+
exporter("hasMetadata", hasMetadata);
|
|
186
|
+
function hasOwnMetadata(metadataKey, target, propertyKey) {
|
|
187
|
+
if (!IsObject(target)) throw new TypeError();
|
|
188
|
+
if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
|
|
189
|
+
return OrdinaryHasOwnMetadata(metadataKey, target, propertyKey);
|
|
190
|
+
}
|
|
191
|
+
__name(hasOwnMetadata, "hasOwnMetadata");
|
|
192
|
+
exporter("hasOwnMetadata", hasOwnMetadata);
|
|
193
|
+
function getMetadata(metadataKey, target, propertyKey) {
|
|
194
|
+
if (!IsObject(target)) throw new TypeError();
|
|
195
|
+
if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
|
|
196
|
+
return OrdinaryGetMetadata(metadataKey, target, propertyKey);
|
|
197
|
+
}
|
|
198
|
+
__name(getMetadata, "getMetadata");
|
|
199
|
+
exporter("getMetadata", getMetadata);
|
|
200
|
+
function getOwnMetadata(metadataKey, target, propertyKey) {
|
|
201
|
+
if (!IsObject(target)) throw new TypeError();
|
|
202
|
+
if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
|
|
203
|
+
return OrdinaryGetOwnMetadata(metadataKey, target, propertyKey);
|
|
204
|
+
}
|
|
205
|
+
__name(getOwnMetadata, "getOwnMetadata");
|
|
206
|
+
exporter("getOwnMetadata", getOwnMetadata);
|
|
207
|
+
function getMetadataKeys(target, propertyKey) {
|
|
208
|
+
if (!IsObject(target)) throw new TypeError();
|
|
209
|
+
if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
|
|
210
|
+
return OrdinaryMetadataKeys(target, propertyKey);
|
|
211
|
+
}
|
|
212
|
+
__name(getMetadataKeys, "getMetadataKeys");
|
|
213
|
+
exporter("getMetadataKeys", getMetadataKeys);
|
|
214
|
+
function getOwnMetadataKeys(target, propertyKey) {
|
|
215
|
+
if (!IsObject(target)) throw new TypeError();
|
|
216
|
+
if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
|
|
217
|
+
return OrdinaryOwnMetadataKeys(target, propertyKey);
|
|
218
|
+
}
|
|
219
|
+
__name(getOwnMetadataKeys, "getOwnMetadataKeys");
|
|
220
|
+
exporter("getOwnMetadataKeys", getOwnMetadataKeys);
|
|
221
|
+
function deleteMetadata(metadataKey, target, propertyKey) {
|
|
222
|
+
if (!IsObject(target)) throw new TypeError();
|
|
223
|
+
if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
|
|
224
|
+
if (!IsObject(target)) throw new TypeError();
|
|
225
|
+
if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
|
|
226
|
+
var provider = GetMetadataProvider(
|
|
227
|
+
target,
|
|
228
|
+
propertyKey,
|
|
229
|
+
/*Create*/
|
|
230
|
+
false
|
|
231
|
+
);
|
|
232
|
+
if (IsUndefined(provider)) return false;
|
|
233
|
+
return provider.OrdinaryDeleteMetadata(metadataKey, target, propertyKey);
|
|
234
|
+
}
|
|
235
|
+
__name(deleteMetadata, "deleteMetadata");
|
|
236
|
+
exporter("deleteMetadata", deleteMetadata);
|
|
237
|
+
function DecorateConstructor(decorators, target) {
|
|
238
|
+
for (var i = decorators.length - 1; i >= 0; --i) {
|
|
239
|
+
var decorator = decorators[i];
|
|
240
|
+
var decorated = decorator(target);
|
|
241
|
+
if (!IsUndefined(decorated) && !IsNull(decorated)) {
|
|
242
|
+
if (!IsConstructor(decorated)) throw new TypeError();
|
|
243
|
+
target = decorated;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return target;
|
|
247
|
+
}
|
|
248
|
+
__name(DecorateConstructor, "DecorateConstructor");
|
|
249
|
+
function DecorateProperty(decorators, target, propertyKey, descriptor) {
|
|
250
|
+
for (var i = decorators.length - 1; i >= 0; --i) {
|
|
251
|
+
var decorator = decorators[i];
|
|
252
|
+
var decorated = decorator(target, propertyKey, descriptor);
|
|
253
|
+
if (!IsUndefined(decorated) && !IsNull(decorated)) {
|
|
254
|
+
if (!IsObject(decorated)) throw new TypeError();
|
|
255
|
+
descriptor = decorated;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return descriptor;
|
|
259
|
+
}
|
|
260
|
+
__name(DecorateProperty, "DecorateProperty");
|
|
261
|
+
function OrdinaryHasMetadata(MetadataKey, O, P) {
|
|
262
|
+
var hasOwn2 = OrdinaryHasOwnMetadata(MetadataKey, O, P);
|
|
263
|
+
if (hasOwn2) return true;
|
|
264
|
+
var parent = OrdinaryGetPrototypeOf(O);
|
|
265
|
+
if (!IsNull(parent)) return OrdinaryHasMetadata(MetadataKey, parent, P);
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
__name(OrdinaryHasMetadata, "OrdinaryHasMetadata");
|
|
269
|
+
function OrdinaryHasOwnMetadata(MetadataKey, O, P) {
|
|
270
|
+
var provider = GetMetadataProvider(
|
|
271
|
+
O,
|
|
272
|
+
P,
|
|
273
|
+
/*Create*/
|
|
274
|
+
false
|
|
275
|
+
);
|
|
276
|
+
if (IsUndefined(provider)) return false;
|
|
277
|
+
return ToBoolean(provider.OrdinaryHasOwnMetadata(MetadataKey, O, P));
|
|
278
|
+
}
|
|
279
|
+
__name(OrdinaryHasOwnMetadata, "OrdinaryHasOwnMetadata");
|
|
280
|
+
function OrdinaryGetMetadata(MetadataKey, O, P) {
|
|
281
|
+
var hasOwn2 = OrdinaryHasOwnMetadata(MetadataKey, O, P);
|
|
282
|
+
if (hasOwn2) return OrdinaryGetOwnMetadata(MetadataKey, O, P);
|
|
283
|
+
var parent = OrdinaryGetPrototypeOf(O);
|
|
284
|
+
if (!IsNull(parent)) return OrdinaryGetMetadata(MetadataKey, parent, P);
|
|
285
|
+
return void 0;
|
|
286
|
+
}
|
|
287
|
+
__name(OrdinaryGetMetadata, "OrdinaryGetMetadata");
|
|
288
|
+
function OrdinaryGetOwnMetadata(MetadataKey, O, P) {
|
|
289
|
+
var provider = GetMetadataProvider(
|
|
290
|
+
O,
|
|
291
|
+
P,
|
|
292
|
+
/*Create*/
|
|
293
|
+
false
|
|
294
|
+
);
|
|
295
|
+
if (IsUndefined(provider)) return;
|
|
296
|
+
return provider.OrdinaryGetOwnMetadata(MetadataKey, O, P);
|
|
297
|
+
}
|
|
298
|
+
__name(OrdinaryGetOwnMetadata, "OrdinaryGetOwnMetadata");
|
|
299
|
+
function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
|
|
300
|
+
var provider = GetMetadataProvider(
|
|
301
|
+
O,
|
|
302
|
+
P,
|
|
303
|
+
/*Create*/
|
|
304
|
+
true
|
|
305
|
+
);
|
|
306
|
+
provider.OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P);
|
|
307
|
+
}
|
|
308
|
+
__name(OrdinaryDefineOwnMetadata, "OrdinaryDefineOwnMetadata");
|
|
309
|
+
function OrdinaryMetadataKeys(O, P) {
|
|
310
|
+
var ownKeys = OrdinaryOwnMetadataKeys(O, P);
|
|
311
|
+
var parent = OrdinaryGetPrototypeOf(O);
|
|
312
|
+
if (parent === null) return ownKeys;
|
|
313
|
+
var parentKeys = OrdinaryMetadataKeys(parent, P);
|
|
314
|
+
if (parentKeys.length <= 0) return ownKeys;
|
|
315
|
+
if (ownKeys.length <= 0) return parentKeys;
|
|
316
|
+
var set = new _Set();
|
|
317
|
+
var keys = [];
|
|
318
|
+
for (var _i = 0, ownKeys_1 = ownKeys; _i < ownKeys_1.length; _i++) {
|
|
319
|
+
var key = ownKeys_1[_i];
|
|
320
|
+
var hasKey = set.has(key);
|
|
321
|
+
if (!hasKey) {
|
|
322
|
+
set.add(key);
|
|
323
|
+
keys.push(key);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) {
|
|
327
|
+
var key = parentKeys_1[_a];
|
|
328
|
+
var hasKey = set.has(key);
|
|
329
|
+
if (!hasKey) {
|
|
330
|
+
set.add(key);
|
|
331
|
+
keys.push(key);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
return keys;
|
|
335
|
+
}
|
|
336
|
+
__name(OrdinaryMetadataKeys, "OrdinaryMetadataKeys");
|
|
337
|
+
function OrdinaryOwnMetadataKeys(O, P) {
|
|
338
|
+
var provider = GetMetadataProvider(
|
|
339
|
+
O,
|
|
340
|
+
P,
|
|
341
|
+
/*create*/
|
|
342
|
+
false
|
|
343
|
+
);
|
|
344
|
+
if (!provider) {
|
|
345
|
+
return [];
|
|
346
|
+
}
|
|
347
|
+
return provider.OrdinaryOwnMetadataKeys(O, P);
|
|
348
|
+
}
|
|
349
|
+
__name(OrdinaryOwnMetadataKeys, "OrdinaryOwnMetadataKeys");
|
|
350
|
+
function Type(x) {
|
|
351
|
+
if (x === null) return 1;
|
|
352
|
+
switch (typeof x) {
|
|
353
|
+
case "undefined":
|
|
354
|
+
return 0;
|
|
355
|
+
case "boolean":
|
|
356
|
+
return 2;
|
|
357
|
+
case "string":
|
|
358
|
+
return 3;
|
|
359
|
+
case "symbol":
|
|
360
|
+
return 4;
|
|
361
|
+
case "number":
|
|
362
|
+
return 5;
|
|
363
|
+
case "object":
|
|
364
|
+
return x === null ? 1 : 6;
|
|
365
|
+
default:
|
|
366
|
+
return 6;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
__name(Type, "Type");
|
|
370
|
+
function IsUndefined(x) {
|
|
371
|
+
return x === void 0;
|
|
372
|
+
}
|
|
373
|
+
__name(IsUndefined, "IsUndefined");
|
|
374
|
+
function IsNull(x) {
|
|
375
|
+
return x === null;
|
|
376
|
+
}
|
|
377
|
+
__name(IsNull, "IsNull");
|
|
378
|
+
function IsSymbol(x) {
|
|
379
|
+
return typeof x === "symbol";
|
|
380
|
+
}
|
|
381
|
+
__name(IsSymbol, "IsSymbol");
|
|
382
|
+
function IsObject(x) {
|
|
383
|
+
return typeof x === "object" ? x !== null : typeof x === "function";
|
|
384
|
+
}
|
|
385
|
+
__name(IsObject, "IsObject");
|
|
386
|
+
function ToPrimitive(input, PreferredType) {
|
|
387
|
+
switch (Type(input)) {
|
|
388
|
+
case 0:
|
|
389
|
+
return input;
|
|
390
|
+
case 1:
|
|
391
|
+
return input;
|
|
392
|
+
case 2:
|
|
393
|
+
return input;
|
|
394
|
+
case 3:
|
|
395
|
+
return input;
|
|
396
|
+
case 4:
|
|
397
|
+
return input;
|
|
398
|
+
case 5:
|
|
399
|
+
return input;
|
|
400
|
+
}
|
|
401
|
+
var hint = PreferredType === 3 ? "string" : PreferredType === 5 ? "number" : "default";
|
|
402
|
+
var exoticToPrim = GetMethod(input, toPrimitiveSymbol);
|
|
403
|
+
if (exoticToPrim !== void 0) {
|
|
404
|
+
var result = exoticToPrim.call(input, hint);
|
|
405
|
+
if (IsObject(result)) throw new TypeError();
|
|
406
|
+
return result;
|
|
407
|
+
}
|
|
408
|
+
return OrdinaryToPrimitive(input, hint === "default" ? "number" : hint);
|
|
409
|
+
}
|
|
410
|
+
__name(ToPrimitive, "ToPrimitive");
|
|
411
|
+
function OrdinaryToPrimitive(O, hint) {
|
|
412
|
+
if (hint === "string") {
|
|
413
|
+
var toString_1 = O.toString;
|
|
414
|
+
if (IsCallable(toString_1)) {
|
|
415
|
+
var result = toString_1.call(O);
|
|
416
|
+
if (!IsObject(result)) return result;
|
|
417
|
+
}
|
|
418
|
+
var valueOf = O.valueOf;
|
|
419
|
+
if (IsCallable(valueOf)) {
|
|
420
|
+
var result = valueOf.call(O);
|
|
421
|
+
if (!IsObject(result)) return result;
|
|
422
|
+
}
|
|
423
|
+
} else {
|
|
424
|
+
var valueOf = O.valueOf;
|
|
425
|
+
if (IsCallable(valueOf)) {
|
|
426
|
+
var result = valueOf.call(O);
|
|
427
|
+
if (!IsObject(result)) return result;
|
|
428
|
+
}
|
|
429
|
+
var toString_2 = O.toString;
|
|
430
|
+
if (IsCallable(toString_2)) {
|
|
431
|
+
var result = toString_2.call(O);
|
|
432
|
+
if (!IsObject(result)) return result;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
throw new TypeError();
|
|
436
|
+
}
|
|
437
|
+
__name(OrdinaryToPrimitive, "OrdinaryToPrimitive");
|
|
438
|
+
function ToBoolean(argument) {
|
|
439
|
+
return !!argument;
|
|
440
|
+
}
|
|
441
|
+
__name(ToBoolean, "ToBoolean");
|
|
442
|
+
function ToString(argument) {
|
|
443
|
+
return "" + argument;
|
|
444
|
+
}
|
|
445
|
+
__name(ToString, "ToString");
|
|
446
|
+
function ToPropertyKey(argument) {
|
|
447
|
+
var key = ToPrimitive(
|
|
448
|
+
argument,
|
|
449
|
+
3
|
|
450
|
+
/* String */
|
|
451
|
+
);
|
|
452
|
+
if (IsSymbol(key)) return key;
|
|
453
|
+
return ToString(key);
|
|
454
|
+
}
|
|
455
|
+
__name(ToPropertyKey, "ToPropertyKey");
|
|
456
|
+
function IsArray(argument) {
|
|
457
|
+
return Array.isArray ? Array.isArray(argument) : argument instanceof Object ? argument instanceof Array : Object.prototype.toString.call(argument) === "[object Array]";
|
|
458
|
+
}
|
|
459
|
+
__name(IsArray, "IsArray");
|
|
460
|
+
function IsCallable(argument) {
|
|
461
|
+
return typeof argument === "function";
|
|
462
|
+
}
|
|
463
|
+
__name(IsCallable, "IsCallable");
|
|
464
|
+
function IsConstructor(argument) {
|
|
465
|
+
return typeof argument === "function";
|
|
466
|
+
}
|
|
467
|
+
__name(IsConstructor, "IsConstructor");
|
|
468
|
+
function IsPropertyKey(argument) {
|
|
469
|
+
switch (Type(argument)) {
|
|
470
|
+
case 3:
|
|
471
|
+
return true;
|
|
472
|
+
case 4:
|
|
473
|
+
return true;
|
|
474
|
+
default:
|
|
475
|
+
return false;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
__name(IsPropertyKey, "IsPropertyKey");
|
|
479
|
+
function SameValueZero(x, y) {
|
|
480
|
+
return x === y || x !== x && y !== y;
|
|
481
|
+
}
|
|
482
|
+
__name(SameValueZero, "SameValueZero");
|
|
483
|
+
function GetMethod(V, P) {
|
|
484
|
+
var func = V[P];
|
|
485
|
+
if (func === void 0 || func === null) return void 0;
|
|
486
|
+
if (!IsCallable(func)) throw new TypeError();
|
|
487
|
+
return func;
|
|
488
|
+
}
|
|
489
|
+
__name(GetMethod, "GetMethod");
|
|
490
|
+
function GetIterator(obj) {
|
|
491
|
+
var method = GetMethod(obj, iteratorSymbol);
|
|
492
|
+
if (!IsCallable(method)) throw new TypeError();
|
|
493
|
+
var iterator = method.call(obj);
|
|
494
|
+
if (!IsObject(iterator)) throw new TypeError();
|
|
495
|
+
return iterator;
|
|
496
|
+
}
|
|
497
|
+
__name(GetIterator, "GetIterator");
|
|
498
|
+
function IteratorValue(iterResult) {
|
|
499
|
+
return iterResult.value;
|
|
500
|
+
}
|
|
501
|
+
__name(IteratorValue, "IteratorValue");
|
|
502
|
+
function IteratorStep(iterator) {
|
|
503
|
+
var result = iterator.next();
|
|
504
|
+
return result.done ? false : result;
|
|
505
|
+
}
|
|
506
|
+
__name(IteratorStep, "IteratorStep");
|
|
507
|
+
function IteratorClose(iterator) {
|
|
508
|
+
var f = iterator["return"];
|
|
509
|
+
if (f) f.call(iterator);
|
|
510
|
+
}
|
|
511
|
+
__name(IteratorClose, "IteratorClose");
|
|
512
|
+
function OrdinaryGetPrototypeOf(O) {
|
|
513
|
+
var proto = Object.getPrototypeOf(O);
|
|
514
|
+
if (typeof O !== "function" || O === functionPrototype) return proto;
|
|
515
|
+
if (proto !== functionPrototype) return proto;
|
|
516
|
+
var prototype = O.prototype;
|
|
517
|
+
var prototypeProto = prototype && Object.getPrototypeOf(prototype);
|
|
518
|
+
if (prototypeProto == null || prototypeProto === Object.prototype) return proto;
|
|
519
|
+
var constructor = prototypeProto.constructor;
|
|
520
|
+
if (typeof constructor !== "function") return proto;
|
|
521
|
+
if (constructor === O) return proto;
|
|
522
|
+
return constructor;
|
|
523
|
+
}
|
|
524
|
+
__name(OrdinaryGetPrototypeOf, "OrdinaryGetPrototypeOf");
|
|
525
|
+
function CreateMetadataRegistry() {
|
|
526
|
+
var fallback;
|
|
527
|
+
if (!IsUndefined(registrySymbol) && typeof root.Reflect !== "undefined" && !(registrySymbol in root.Reflect) && typeof root.Reflect.defineMetadata === "function") {
|
|
528
|
+
fallback = CreateFallbackProvider(root.Reflect);
|
|
529
|
+
}
|
|
530
|
+
var first;
|
|
531
|
+
var second;
|
|
532
|
+
var rest;
|
|
533
|
+
var targetProviderMap = new _WeakMap();
|
|
534
|
+
var registry = {
|
|
535
|
+
registerProvider,
|
|
536
|
+
getProvider,
|
|
537
|
+
setProvider
|
|
538
|
+
};
|
|
539
|
+
return registry;
|
|
540
|
+
function registerProvider(provider) {
|
|
541
|
+
if (!Object.isExtensible(registry)) {
|
|
542
|
+
throw new Error("Cannot add provider to a frozen registry.");
|
|
543
|
+
}
|
|
544
|
+
switch (true) {
|
|
545
|
+
case fallback === provider:
|
|
546
|
+
break;
|
|
547
|
+
case IsUndefined(first):
|
|
548
|
+
first = provider;
|
|
549
|
+
break;
|
|
550
|
+
case first === provider:
|
|
551
|
+
break;
|
|
552
|
+
case IsUndefined(second):
|
|
553
|
+
second = provider;
|
|
554
|
+
break;
|
|
555
|
+
case second === provider:
|
|
556
|
+
break;
|
|
557
|
+
default:
|
|
558
|
+
if (rest === void 0) rest = new _Set();
|
|
559
|
+
rest.add(provider);
|
|
560
|
+
break;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
function getProviderNoCache(O, P) {
|
|
564
|
+
if (!IsUndefined(first)) {
|
|
565
|
+
if (first.isProviderFor(O, P)) return first;
|
|
566
|
+
if (!IsUndefined(second)) {
|
|
567
|
+
if (second.isProviderFor(O, P)) return first;
|
|
568
|
+
if (!IsUndefined(rest)) {
|
|
569
|
+
var iterator = GetIterator(rest);
|
|
570
|
+
while (true) {
|
|
571
|
+
var next = IteratorStep(iterator);
|
|
572
|
+
if (!next) {
|
|
573
|
+
return void 0;
|
|
574
|
+
}
|
|
575
|
+
var provider = IteratorValue(next);
|
|
576
|
+
if (provider.isProviderFor(O, P)) {
|
|
577
|
+
IteratorClose(iterator);
|
|
578
|
+
return provider;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
if (!IsUndefined(fallback) && fallback.isProviderFor(O, P)) {
|
|
585
|
+
return fallback;
|
|
586
|
+
}
|
|
587
|
+
return void 0;
|
|
588
|
+
}
|
|
589
|
+
function getProvider(O, P) {
|
|
590
|
+
var providerMap = targetProviderMap.get(O);
|
|
591
|
+
var provider;
|
|
592
|
+
if (!IsUndefined(providerMap)) {
|
|
593
|
+
provider = providerMap.get(P);
|
|
594
|
+
}
|
|
595
|
+
if (!IsUndefined(provider)) {
|
|
596
|
+
return provider;
|
|
597
|
+
}
|
|
598
|
+
provider = getProviderNoCache(O, P);
|
|
599
|
+
if (!IsUndefined(provider)) {
|
|
600
|
+
if (IsUndefined(providerMap)) {
|
|
601
|
+
providerMap = new _Map();
|
|
602
|
+
targetProviderMap.set(O, providerMap);
|
|
603
|
+
}
|
|
604
|
+
providerMap.set(P, provider);
|
|
605
|
+
}
|
|
606
|
+
return provider;
|
|
607
|
+
}
|
|
608
|
+
function hasProvider(provider) {
|
|
609
|
+
if (IsUndefined(provider)) throw new TypeError();
|
|
610
|
+
return first === provider || second === provider || !IsUndefined(rest) && rest.has(provider);
|
|
611
|
+
}
|
|
612
|
+
function setProvider(O, P, provider) {
|
|
613
|
+
if (!hasProvider(provider)) {
|
|
614
|
+
throw new Error("Metadata provider not registered.");
|
|
615
|
+
}
|
|
616
|
+
var existingProvider = getProvider(O, P);
|
|
617
|
+
if (existingProvider !== provider) {
|
|
618
|
+
if (!IsUndefined(existingProvider)) {
|
|
619
|
+
return false;
|
|
620
|
+
}
|
|
621
|
+
var providerMap = targetProviderMap.get(O);
|
|
622
|
+
if (IsUndefined(providerMap)) {
|
|
623
|
+
providerMap = new _Map();
|
|
624
|
+
targetProviderMap.set(O, providerMap);
|
|
625
|
+
}
|
|
626
|
+
providerMap.set(P, provider);
|
|
627
|
+
}
|
|
628
|
+
return true;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
__name(CreateMetadataRegistry, "CreateMetadataRegistry");
|
|
632
|
+
function GetOrCreateMetadataRegistry() {
|
|
633
|
+
var metadataRegistry2;
|
|
634
|
+
if (!IsUndefined(registrySymbol) && IsObject(root.Reflect) && Object.isExtensible(root.Reflect)) {
|
|
635
|
+
metadataRegistry2 = root.Reflect[registrySymbol];
|
|
636
|
+
}
|
|
637
|
+
if (IsUndefined(metadataRegistry2)) {
|
|
638
|
+
metadataRegistry2 = CreateMetadataRegistry();
|
|
639
|
+
}
|
|
640
|
+
if (!IsUndefined(registrySymbol) && IsObject(root.Reflect) && Object.isExtensible(root.Reflect)) {
|
|
641
|
+
Object.defineProperty(root.Reflect, registrySymbol, {
|
|
642
|
+
enumerable: false,
|
|
643
|
+
configurable: false,
|
|
644
|
+
writable: false,
|
|
645
|
+
value: metadataRegistry2
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
return metadataRegistry2;
|
|
649
|
+
}
|
|
650
|
+
__name(GetOrCreateMetadataRegistry, "GetOrCreateMetadataRegistry");
|
|
651
|
+
function CreateMetadataProvider(registry) {
|
|
652
|
+
var metadata2 = new _WeakMap();
|
|
653
|
+
var provider = {
|
|
654
|
+
isProviderFor: /* @__PURE__ */ __name(function(O, P) {
|
|
655
|
+
var targetMetadata = metadata2.get(O);
|
|
656
|
+
if (IsUndefined(targetMetadata)) return false;
|
|
657
|
+
return targetMetadata.has(P);
|
|
658
|
+
}, "isProviderFor"),
|
|
659
|
+
OrdinaryDefineOwnMetadata: OrdinaryDefineOwnMetadata2,
|
|
660
|
+
OrdinaryHasOwnMetadata: OrdinaryHasOwnMetadata2,
|
|
661
|
+
OrdinaryGetOwnMetadata: OrdinaryGetOwnMetadata2,
|
|
662
|
+
OrdinaryOwnMetadataKeys: OrdinaryOwnMetadataKeys2,
|
|
663
|
+
OrdinaryDeleteMetadata
|
|
664
|
+
};
|
|
665
|
+
metadataRegistry.registerProvider(provider);
|
|
666
|
+
return provider;
|
|
667
|
+
function GetOrCreateMetadataMap(O, P, Create) {
|
|
668
|
+
var targetMetadata = metadata2.get(O);
|
|
669
|
+
var createdTargetMetadata = false;
|
|
670
|
+
if (IsUndefined(targetMetadata)) {
|
|
671
|
+
if (!Create) return void 0;
|
|
672
|
+
targetMetadata = new _Map();
|
|
673
|
+
metadata2.set(O, targetMetadata);
|
|
674
|
+
createdTargetMetadata = true;
|
|
675
|
+
}
|
|
676
|
+
var metadataMap = targetMetadata.get(P);
|
|
677
|
+
if (IsUndefined(metadataMap)) {
|
|
678
|
+
if (!Create) return void 0;
|
|
679
|
+
metadataMap = new _Map();
|
|
680
|
+
targetMetadata.set(P, metadataMap);
|
|
681
|
+
if (!registry.setProvider(O, P, provider)) {
|
|
682
|
+
targetMetadata.delete(P);
|
|
683
|
+
if (createdTargetMetadata) {
|
|
684
|
+
metadata2.delete(O);
|
|
685
|
+
}
|
|
686
|
+
throw new Error("Wrong provider for target.");
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
return metadataMap;
|
|
690
|
+
}
|
|
691
|
+
function OrdinaryHasOwnMetadata2(MetadataKey, O, P) {
|
|
692
|
+
var metadataMap = GetOrCreateMetadataMap(
|
|
693
|
+
O,
|
|
694
|
+
P,
|
|
695
|
+
/*Create*/
|
|
696
|
+
false
|
|
697
|
+
);
|
|
698
|
+
if (IsUndefined(metadataMap)) return false;
|
|
699
|
+
return ToBoolean(metadataMap.has(MetadataKey));
|
|
700
|
+
}
|
|
701
|
+
function OrdinaryGetOwnMetadata2(MetadataKey, O, P) {
|
|
702
|
+
var metadataMap = GetOrCreateMetadataMap(
|
|
703
|
+
O,
|
|
704
|
+
P,
|
|
705
|
+
/*Create*/
|
|
706
|
+
false
|
|
707
|
+
);
|
|
708
|
+
if (IsUndefined(metadataMap)) return void 0;
|
|
709
|
+
return metadataMap.get(MetadataKey);
|
|
710
|
+
}
|
|
711
|
+
function OrdinaryDefineOwnMetadata2(MetadataKey, MetadataValue, O, P) {
|
|
712
|
+
var metadataMap = GetOrCreateMetadataMap(
|
|
713
|
+
O,
|
|
714
|
+
P,
|
|
715
|
+
/*Create*/
|
|
716
|
+
true
|
|
717
|
+
);
|
|
718
|
+
metadataMap.set(MetadataKey, MetadataValue);
|
|
719
|
+
}
|
|
720
|
+
function OrdinaryOwnMetadataKeys2(O, P) {
|
|
721
|
+
var keys = [];
|
|
722
|
+
var metadataMap = GetOrCreateMetadataMap(
|
|
723
|
+
O,
|
|
724
|
+
P,
|
|
725
|
+
/*Create*/
|
|
726
|
+
false
|
|
727
|
+
);
|
|
728
|
+
if (IsUndefined(metadataMap)) return keys;
|
|
729
|
+
var keysObj = metadataMap.keys();
|
|
730
|
+
var iterator = GetIterator(keysObj);
|
|
731
|
+
var k = 0;
|
|
732
|
+
while (true) {
|
|
733
|
+
var next = IteratorStep(iterator);
|
|
734
|
+
if (!next) {
|
|
735
|
+
keys.length = k;
|
|
736
|
+
return keys;
|
|
737
|
+
}
|
|
738
|
+
var nextValue = IteratorValue(next);
|
|
739
|
+
try {
|
|
740
|
+
keys[k] = nextValue;
|
|
741
|
+
} catch (e) {
|
|
742
|
+
try {
|
|
743
|
+
IteratorClose(iterator);
|
|
744
|
+
} finally {
|
|
745
|
+
throw e;
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
k++;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
function OrdinaryDeleteMetadata(MetadataKey, O, P) {
|
|
752
|
+
var metadataMap = GetOrCreateMetadataMap(
|
|
753
|
+
O,
|
|
754
|
+
P,
|
|
755
|
+
/*Create*/
|
|
756
|
+
false
|
|
757
|
+
);
|
|
758
|
+
if (IsUndefined(metadataMap)) return false;
|
|
759
|
+
if (!metadataMap.delete(MetadataKey)) return false;
|
|
760
|
+
if (metadataMap.size === 0) {
|
|
761
|
+
var targetMetadata = metadata2.get(O);
|
|
762
|
+
if (!IsUndefined(targetMetadata)) {
|
|
763
|
+
targetMetadata.delete(P);
|
|
764
|
+
if (targetMetadata.size === 0) {
|
|
765
|
+
metadata2.delete(targetMetadata);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
return true;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
__name(CreateMetadataProvider, "CreateMetadataProvider");
|
|
773
|
+
function CreateFallbackProvider(reflect) {
|
|
774
|
+
var defineMetadata2 = reflect.defineMetadata, hasOwnMetadata2 = reflect.hasOwnMetadata, getOwnMetadata2 = reflect.getOwnMetadata, getOwnMetadataKeys2 = reflect.getOwnMetadataKeys, deleteMetadata2 = reflect.deleteMetadata;
|
|
775
|
+
var metadataOwner = new _WeakMap();
|
|
776
|
+
var provider = {
|
|
777
|
+
isProviderFor: /* @__PURE__ */ __name(function(O, P) {
|
|
778
|
+
var metadataPropertySet = metadataOwner.get(O);
|
|
779
|
+
if (!IsUndefined(metadataPropertySet) && metadataPropertySet.has(P)) {
|
|
780
|
+
return true;
|
|
781
|
+
}
|
|
782
|
+
if (getOwnMetadataKeys2(O, P).length) {
|
|
783
|
+
if (IsUndefined(metadataPropertySet)) {
|
|
784
|
+
metadataPropertySet = new _Set();
|
|
785
|
+
metadataOwner.set(O, metadataPropertySet);
|
|
786
|
+
}
|
|
787
|
+
metadataPropertySet.add(P);
|
|
788
|
+
return true;
|
|
789
|
+
}
|
|
790
|
+
return false;
|
|
791
|
+
}, "isProviderFor"),
|
|
792
|
+
OrdinaryDefineOwnMetadata: defineMetadata2,
|
|
793
|
+
OrdinaryHasOwnMetadata: hasOwnMetadata2,
|
|
794
|
+
OrdinaryGetOwnMetadata: getOwnMetadata2,
|
|
795
|
+
OrdinaryOwnMetadataKeys: getOwnMetadataKeys2,
|
|
796
|
+
OrdinaryDeleteMetadata: deleteMetadata2
|
|
797
|
+
};
|
|
798
|
+
return provider;
|
|
799
|
+
}
|
|
800
|
+
__name(CreateFallbackProvider, "CreateFallbackProvider");
|
|
801
|
+
function GetMetadataProvider(O, P, Create) {
|
|
802
|
+
var registeredProvider = metadataRegistry.getProvider(O, P);
|
|
803
|
+
if (!IsUndefined(registeredProvider)) {
|
|
804
|
+
return registeredProvider;
|
|
805
|
+
}
|
|
806
|
+
if (Create) {
|
|
807
|
+
if (metadataRegistry.setProvider(O, P, metadataProvider)) {
|
|
808
|
+
return metadataProvider;
|
|
809
|
+
}
|
|
810
|
+
throw new Error("Illegal state.");
|
|
811
|
+
}
|
|
812
|
+
return void 0;
|
|
813
|
+
}
|
|
814
|
+
__name(GetMetadataProvider, "GetMetadataProvider");
|
|
815
|
+
function CreateMapPolyfill() {
|
|
816
|
+
var cacheSentinel = {};
|
|
817
|
+
var arraySentinel = [];
|
|
818
|
+
var MapIterator = (
|
|
819
|
+
/** @class */
|
|
820
|
+
(function() {
|
|
821
|
+
function MapIterator2(keys, values, selector) {
|
|
822
|
+
this._index = 0;
|
|
823
|
+
this._keys = keys;
|
|
824
|
+
this._values = values;
|
|
825
|
+
this._selector = selector;
|
|
826
|
+
}
|
|
827
|
+
__name(MapIterator2, "MapIterator");
|
|
828
|
+
MapIterator2.prototype["@@iterator"] = function() {
|
|
829
|
+
return this;
|
|
830
|
+
};
|
|
831
|
+
MapIterator2.prototype[iteratorSymbol] = function() {
|
|
832
|
+
return this;
|
|
833
|
+
};
|
|
834
|
+
MapIterator2.prototype.next = function() {
|
|
835
|
+
var index = this._index;
|
|
836
|
+
if (index >= 0 && index < this._keys.length) {
|
|
837
|
+
var result = this._selector(this._keys[index], this._values[index]);
|
|
838
|
+
if (index + 1 >= this._keys.length) {
|
|
839
|
+
this._index = -1;
|
|
840
|
+
this._keys = arraySentinel;
|
|
841
|
+
this._values = arraySentinel;
|
|
842
|
+
} else {
|
|
843
|
+
this._index++;
|
|
844
|
+
}
|
|
845
|
+
return {
|
|
846
|
+
value: result,
|
|
847
|
+
done: false
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
return {
|
|
851
|
+
value: void 0,
|
|
852
|
+
done: true
|
|
853
|
+
};
|
|
854
|
+
};
|
|
855
|
+
MapIterator2.prototype.throw = function(error) {
|
|
856
|
+
if (this._index >= 0) {
|
|
857
|
+
this._index = -1;
|
|
858
|
+
this._keys = arraySentinel;
|
|
859
|
+
this._values = arraySentinel;
|
|
860
|
+
}
|
|
861
|
+
throw error;
|
|
862
|
+
};
|
|
863
|
+
MapIterator2.prototype.return = function(value) {
|
|
864
|
+
if (this._index >= 0) {
|
|
865
|
+
this._index = -1;
|
|
866
|
+
this._keys = arraySentinel;
|
|
867
|
+
this._values = arraySentinel;
|
|
868
|
+
}
|
|
869
|
+
return {
|
|
870
|
+
value,
|
|
871
|
+
done: true
|
|
872
|
+
};
|
|
873
|
+
};
|
|
874
|
+
return MapIterator2;
|
|
875
|
+
})()
|
|
876
|
+
);
|
|
877
|
+
var Map1 = (
|
|
878
|
+
/** @class */
|
|
879
|
+
(function() {
|
|
880
|
+
function Map12() {
|
|
881
|
+
this._keys = [];
|
|
882
|
+
this._values = [];
|
|
883
|
+
this._cacheKey = cacheSentinel;
|
|
884
|
+
this._cacheIndex = -2;
|
|
885
|
+
}
|
|
886
|
+
__name(Map12, "Map1");
|
|
887
|
+
Object.defineProperty(Map12.prototype, "size", {
|
|
888
|
+
get: /* @__PURE__ */ __name(function() {
|
|
889
|
+
return this._keys.length;
|
|
890
|
+
}, "get"),
|
|
891
|
+
enumerable: true,
|
|
892
|
+
configurable: true
|
|
893
|
+
});
|
|
894
|
+
Map12.prototype.has = function(key) {
|
|
895
|
+
return this._find(
|
|
896
|
+
key,
|
|
897
|
+
/*insert*/
|
|
898
|
+
false
|
|
899
|
+
) >= 0;
|
|
900
|
+
};
|
|
901
|
+
Map12.prototype.get = function(key) {
|
|
902
|
+
var index = this._find(
|
|
903
|
+
key,
|
|
904
|
+
/*insert*/
|
|
905
|
+
false
|
|
906
|
+
);
|
|
907
|
+
return index >= 0 ? this._values[index] : void 0;
|
|
908
|
+
};
|
|
909
|
+
Map12.prototype.set = function(key, value) {
|
|
910
|
+
var index = this._find(
|
|
911
|
+
key,
|
|
912
|
+
/*insert*/
|
|
913
|
+
true
|
|
914
|
+
);
|
|
915
|
+
this._values[index] = value;
|
|
916
|
+
return this;
|
|
917
|
+
};
|
|
918
|
+
Map12.prototype.delete = function(key) {
|
|
919
|
+
var index = this._find(
|
|
920
|
+
key,
|
|
921
|
+
/*insert*/
|
|
922
|
+
false
|
|
923
|
+
);
|
|
924
|
+
if (index >= 0) {
|
|
925
|
+
var size = this._keys.length;
|
|
926
|
+
for (var i = index + 1; i < size; i++) {
|
|
927
|
+
this._keys[i - 1] = this._keys[i];
|
|
928
|
+
this._values[i - 1] = this._values[i];
|
|
929
|
+
}
|
|
930
|
+
this._keys.length--;
|
|
931
|
+
this._values.length--;
|
|
932
|
+
if (SameValueZero(key, this._cacheKey)) {
|
|
933
|
+
this._cacheKey = cacheSentinel;
|
|
934
|
+
this._cacheIndex = -2;
|
|
935
|
+
}
|
|
936
|
+
return true;
|
|
937
|
+
}
|
|
938
|
+
return false;
|
|
939
|
+
};
|
|
940
|
+
Map12.prototype.clear = function() {
|
|
941
|
+
this._keys.length = 0;
|
|
942
|
+
this._values.length = 0;
|
|
943
|
+
this._cacheKey = cacheSentinel;
|
|
944
|
+
this._cacheIndex = -2;
|
|
945
|
+
};
|
|
946
|
+
Map12.prototype.keys = function() {
|
|
947
|
+
return new MapIterator(this._keys, this._values, getKey);
|
|
948
|
+
};
|
|
949
|
+
Map12.prototype.values = function() {
|
|
950
|
+
return new MapIterator(this._keys, this._values, getValue);
|
|
951
|
+
};
|
|
952
|
+
Map12.prototype.entries = function() {
|
|
953
|
+
return new MapIterator(this._keys, this._values, getEntry);
|
|
954
|
+
};
|
|
955
|
+
Map12.prototype["@@iterator"] = function() {
|
|
956
|
+
return this.entries();
|
|
957
|
+
};
|
|
958
|
+
Map12.prototype[iteratorSymbol] = function() {
|
|
959
|
+
return this.entries();
|
|
960
|
+
};
|
|
961
|
+
Map12.prototype._find = function(key, insert) {
|
|
962
|
+
if (!SameValueZero(this._cacheKey, key)) {
|
|
963
|
+
this._cacheIndex = -1;
|
|
964
|
+
for (var i = 0; i < this._keys.length; i++) {
|
|
965
|
+
if (SameValueZero(this._keys[i], key)) {
|
|
966
|
+
this._cacheIndex = i;
|
|
967
|
+
break;
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
if (this._cacheIndex < 0 && insert) {
|
|
972
|
+
this._cacheIndex = this._keys.length;
|
|
973
|
+
this._keys.push(key);
|
|
974
|
+
this._values.push(void 0);
|
|
975
|
+
}
|
|
976
|
+
return this._cacheIndex;
|
|
977
|
+
};
|
|
978
|
+
return Map12;
|
|
979
|
+
})()
|
|
980
|
+
);
|
|
981
|
+
return Map1;
|
|
982
|
+
function getKey(key, _) {
|
|
983
|
+
return key;
|
|
984
|
+
}
|
|
985
|
+
function getValue(_, value) {
|
|
986
|
+
return value;
|
|
987
|
+
}
|
|
988
|
+
function getEntry(key, value) {
|
|
989
|
+
return [
|
|
990
|
+
key,
|
|
991
|
+
value
|
|
992
|
+
];
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
__name(CreateMapPolyfill, "CreateMapPolyfill");
|
|
996
|
+
function CreateSetPolyfill() {
|
|
997
|
+
var Set1 = (
|
|
998
|
+
/** @class */
|
|
999
|
+
(function() {
|
|
1000
|
+
function Set12() {
|
|
1001
|
+
this._map = new _Map();
|
|
1002
|
+
}
|
|
1003
|
+
__name(Set12, "Set1");
|
|
1004
|
+
Object.defineProperty(Set12.prototype, "size", {
|
|
1005
|
+
get: /* @__PURE__ */ __name(function() {
|
|
1006
|
+
return this._map.size;
|
|
1007
|
+
}, "get"),
|
|
1008
|
+
enumerable: true,
|
|
1009
|
+
configurable: true
|
|
1010
|
+
});
|
|
1011
|
+
Set12.prototype.has = function(value) {
|
|
1012
|
+
return this._map.has(value);
|
|
1013
|
+
};
|
|
1014
|
+
Set12.prototype.add = function(value) {
|
|
1015
|
+
return this._map.set(value, value), this;
|
|
1016
|
+
};
|
|
1017
|
+
Set12.prototype.delete = function(value) {
|
|
1018
|
+
return this._map.delete(value);
|
|
1019
|
+
};
|
|
1020
|
+
Set12.prototype.clear = function() {
|
|
1021
|
+
this._map.clear();
|
|
1022
|
+
};
|
|
1023
|
+
Set12.prototype.keys = function() {
|
|
1024
|
+
return this._map.keys();
|
|
1025
|
+
};
|
|
1026
|
+
Set12.prototype.values = function() {
|
|
1027
|
+
return this._map.keys();
|
|
1028
|
+
};
|
|
1029
|
+
Set12.prototype.entries = function() {
|
|
1030
|
+
return this._map.entries();
|
|
1031
|
+
};
|
|
1032
|
+
Set12.prototype["@@iterator"] = function() {
|
|
1033
|
+
return this.keys();
|
|
1034
|
+
};
|
|
1035
|
+
Set12.prototype[iteratorSymbol] = function() {
|
|
1036
|
+
return this.keys();
|
|
1037
|
+
};
|
|
1038
|
+
return Set12;
|
|
1039
|
+
})()
|
|
1040
|
+
);
|
|
1041
|
+
return Set1;
|
|
1042
|
+
}
|
|
1043
|
+
__name(CreateSetPolyfill, "CreateSetPolyfill");
|
|
1044
|
+
function CreateWeakMapPolyfill() {
|
|
1045
|
+
var UUID_SIZE = 16;
|
|
1046
|
+
var keys = HashMap.create();
|
|
1047
|
+
var rootKey = CreateUniqueKey();
|
|
1048
|
+
return (
|
|
1049
|
+
/** @class */
|
|
1050
|
+
(function() {
|
|
1051
|
+
function WeakMap1() {
|
|
1052
|
+
this._key = CreateUniqueKey();
|
|
1053
|
+
}
|
|
1054
|
+
__name(WeakMap1, "WeakMap1");
|
|
1055
|
+
WeakMap1.prototype.has = function(target) {
|
|
1056
|
+
var table = GetOrCreateWeakMapTable(
|
|
1057
|
+
target,
|
|
1058
|
+
/*create*/
|
|
1059
|
+
false
|
|
1060
|
+
);
|
|
1061
|
+
return table !== void 0 ? HashMap.has(table, this._key) : false;
|
|
1062
|
+
};
|
|
1063
|
+
WeakMap1.prototype.get = function(target) {
|
|
1064
|
+
var table = GetOrCreateWeakMapTable(
|
|
1065
|
+
target,
|
|
1066
|
+
/*create*/
|
|
1067
|
+
false
|
|
1068
|
+
);
|
|
1069
|
+
return table !== void 0 ? HashMap.get(table, this._key) : void 0;
|
|
1070
|
+
};
|
|
1071
|
+
WeakMap1.prototype.set = function(target, value) {
|
|
1072
|
+
var table = GetOrCreateWeakMapTable(
|
|
1073
|
+
target,
|
|
1074
|
+
/*create*/
|
|
1075
|
+
true
|
|
1076
|
+
);
|
|
1077
|
+
table[this._key] = value;
|
|
1078
|
+
return this;
|
|
1079
|
+
};
|
|
1080
|
+
WeakMap1.prototype.delete = function(target) {
|
|
1081
|
+
var table = GetOrCreateWeakMapTable(
|
|
1082
|
+
target,
|
|
1083
|
+
/*create*/
|
|
1084
|
+
false
|
|
1085
|
+
);
|
|
1086
|
+
return table !== void 0 ? delete table[this._key] : false;
|
|
1087
|
+
};
|
|
1088
|
+
WeakMap1.prototype.clear = function() {
|
|
1089
|
+
this._key = CreateUniqueKey();
|
|
1090
|
+
};
|
|
1091
|
+
return WeakMap1;
|
|
1092
|
+
})()
|
|
1093
|
+
);
|
|
1094
|
+
function CreateUniqueKey() {
|
|
1095
|
+
var key;
|
|
1096
|
+
do
|
|
1097
|
+
key = "@@WeakMap@@" + CreateUUID();
|
|
1098
|
+
while (HashMap.has(keys, key));
|
|
1099
|
+
keys[key] = true;
|
|
1100
|
+
return key;
|
|
1101
|
+
}
|
|
1102
|
+
function GetOrCreateWeakMapTable(target, create) {
|
|
1103
|
+
if (!hasOwn.call(target, rootKey)) {
|
|
1104
|
+
if (!create) return void 0;
|
|
1105
|
+
Object.defineProperty(target, rootKey, {
|
|
1106
|
+
value: HashMap.create()
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
return target[rootKey];
|
|
1110
|
+
}
|
|
1111
|
+
function FillRandomBytes(buffer, size) {
|
|
1112
|
+
for (var i = 0; i < size; ++i) buffer[i] = Math.random() * 255 | 0;
|
|
1113
|
+
return buffer;
|
|
1114
|
+
}
|
|
1115
|
+
function GenRandomBytes(size) {
|
|
1116
|
+
if (typeof Uint8Array === "function") {
|
|
1117
|
+
var array = new Uint8Array(size);
|
|
1118
|
+
if (typeof crypto !== "undefined") {
|
|
1119
|
+
crypto.getRandomValues(array);
|
|
1120
|
+
} else if (typeof msCrypto !== "undefined") {
|
|
1121
|
+
msCrypto.getRandomValues(array);
|
|
1122
|
+
} else {
|
|
1123
|
+
FillRandomBytes(array, size);
|
|
1124
|
+
}
|
|
1125
|
+
return array;
|
|
1126
|
+
}
|
|
1127
|
+
return FillRandomBytes(new Array(size), size);
|
|
1128
|
+
}
|
|
1129
|
+
function CreateUUID() {
|
|
1130
|
+
var data = GenRandomBytes(UUID_SIZE);
|
|
1131
|
+
data[6] = data[6] & 79 | 64;
|
|
1132
|
+
data[8] = data[8] & 191 | 128;
|
|
1133
|
+
var result = "";
|
|
1134
|
+
for (var offset = 0; offset < UUID_SIZE; ++offset) {
|
|
1135
|
+
var byte = data[offset];
|
|
1136
|
+
if (offset === 4 || offset === 6 || offset === 8) result += "-";
|
|
1137
|
+
if (byte < 16) result += "0";
|
|
1138
|
+
result += byte.toString(16).toLowerCase();
|
|
1139
|
+
}
|
|
1140
|
+
return result;
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
__name(CreateWeakMapPolyfill, "CreateWeakMapPolyfill");
|
|
1144
|
+
function MakeDictionary(obj) {
|
|
1145
|
+
obj.__ = void 0;
|
|
1146
|
+
delete obj.__;
|
|
1147
|
+
return obj;
|
|
1148
|
+
}
|
|
1149
|
+
__name(MakeDictionary, "MakeDictionary");
|
|
1150
|
+
});
|
|
1151
|
+
})(Reflect2 || (Reflect2 = {}));
|
|
1152
|
+
}
|
|
1153
|
+
});
|
|
1154
|
+
|
|
1155
|
+
// src/decorators/decorators.utils.ts
|
|
1156
|
+
__toESM(require_Reflect());
|
|
38
1157
|
var ROUTES_KEY = Symbol("routes");
|
|
39
1158
|
var MIDDLEWARE_KEY = Symbol("middlewares");
|
|
40
1159
|
var PARAMS_KEY = Symbol("params");
|
|
@@ -92,7 +1211,7 @@ var RateLimiterCache = class RateLimiterCache2 {
|
|
|
92
1211
|
clear() {
|
|
93
1212
|
this.cache.clear();
|
|
94
1213
|
}
|
|
95
|
-
size() {
|
|
1214
|
+
get size() {
|
|
96
1215
|
return this.cache.size();
|
|
97
1216
|
}
|
|
98
1217
|
destroy() {
|
|
@@ -234,7 +1353,7 @@ function Controller(basePath) {
|
|
|
234
1353
|
__name(Controller, "Controller");
|
|
235
1354
|
function Use(...middlewares) {
|
|
236
1355
|
return (target, propertyKey, _descriptor) => {
|
|
237
|
-
if (
|
|
1356
|
+
if (propertyKey === void 0) {
|
|
238
1357
|
const existing = Reflect.getMetadata(MIDDLEWARE_KEY, target) || [];
|
|
239
1358
|
Reflect.defineMetadata(MIDDLEWARE_KEY, [
|
|
240
1359
|
...existing,
|
|
@@ -327,7 +1446,7 @@ function Header(name, value) {
|
|
|
327
1446
|
__name(Header, "Header");
|
|
328
1447
|
function Headers(headers, value) {
|
|
329
1448
|
return (target, propertyKey) => {
|
|
330
|
-
if (
|
|
1449
|
+
if (propertyKey === void 0) {
|
|
331
1450
|
const existing = Reflect.getMetadata(HEADER_KEY, target) || {};
|
|
332
1451
|
const newHeaders = typeof headers === "string" ? {
|
|
333
1452
|
[headers]: value
|
|
@@ -351,7 +1470,7 @@ function Headers(headers, value) {
|
|
|
351
1470
|
__name(Headers, "Headers");
|
|
352
1471
|
function Before(fn) {
|
|
353
1472
|
return (target, propertyKey, _descriptor) => {
|
|
354
|
-
if (
|
|
1473
|
+
if (propertyKey === void 0) {
|
|
355
1474
|
const hooks = Reflect.getMetadata(BEFORE_KEY, target) || [];
|
|
356
1475
|
hooks.push(fn);
|
|
357
1476
|
Reflect.defineMetadata(BEFORE_KEY, hooks, target);
|
|
@@ -365,7 +1484,7 @@ function Before(fn) {
|
|
|
365
1484
|
__name(Before, "Before");
|
|
366
1485
|
function After(fn) {
|
|
367
1486
|
return (target, propertyKey, _descriptor) => {
|
|
368
|
-
if (
|
|
1487
|
+
if (propertyKey === void 0) {
|
|
369
1488
|
const hooks = Reflect.getMetadata(AFTER_KEY, target) || [];
|
|
370
1489
|
hooks.push(fn);
|
|
371
1490
|
Reflect.defineMetadata(AFTER_KEY, hooks, target);
|
|
@@ -379,7 +1498,7 @@ function After(fn) {
|
|
|
379
1498
|
__name(After, "After");
|
|
380
1499
|
function Roles(...roles) {
|
|
381
1500
|
return (target, propertyKey, _descriptor) => {
|
|
382
|
-
if (
|
|
1501
|
+
if (propertyKey === void 0) {
|
|
383
1502
|
Reflect.defineMetadata(ROLES_KEY, roles, target);
|
|
384
1503
|
} else {
|
|
385
1504
|
Reflect.defineMetadata(ROLES_KEY, roles, target, propertyKey);
|
|
@@ -399,7 +1518,7 @@ function Redirect(url, statusCode = 302) {
|
|
|
399
1518
|
__name(Redirect, "Redirect");
|
|
400
1519
|
function Cache(ttlSeconds) {
|
|
401
1520
|
return (target, propertyKey, _descriptor) => {
|
|
402
|
-
if (
|
|
1521
|
+
if (propertyKey === void 0) {
|
|
403
1522
|
Reflect.defineMetadata(CACHE_KEY, {
|
|
404
1523
|
ttlSeconds
|
|
405
1524
|
}, target);
|
|
@@ -418,7 +1537,7 @@ function RateLimit(options) {
|
|
|
418
1537
|
...options
|
|
419
1538
|
};
|
|
420
1539
|
return (target, propertyKey, _descriptor) => {
|
|
421
|
-
if (
|
|
1540
|
+
if (propertyKey === void 0) {
|
|
422
1541
|
Reflect.defineMetadata(RATE_LIMIT_KEY, opts, target);
|
|
423
1542
|
} else {
|
|
424
1543
|
Reflect.defineMetadata(RATE_LIMIT_KEY, opts, target, propertyKey);
|
|
@@ -428,7 +1547,7 @@ function RateLimit(options) {
|
|
|
428
1547
|
__name(RateLimit, "RateLimit");
|
|
429
1548
|
function ContentType(type) {
|
|
430
1549
|
return (target, propertyKey, _descriptor) => {
|
|
431
|
-
if (
|
|
1550
|
+
if (propertyKey === void 0) {
|
|
432
1551
|
Reflect.defineMetadata(CONTENT_TYPE_KEY, {
|
|
433
1552
|
type
|
|
434
1553
|
}, target);
|
|
@@ -448,7 +1567,7 @@ function Version(version, options) {
|
|
|
448
1567
|
...options
|
|
449
1568
|
};
|
|
450
1569
|
return (target, propertyKey, _descriptor) => {
|
|
451
|
-
if (
|
|
1570
|
+
if (propertyKey === void 0) {
|
|
452
1571
|
Reflect.defineMetadata(VERSION_KEY, {
|
|
453
1572
|
version,
|
|
454
1573
|
options: opts
|
|
@@ -464,7 +1583,7 @@ function Version(version, options) {
|
|
|
464
1583
|
__name(Version, "Version");
|
|
465
1584
|
function Timeout(ms) {
|
|
466
1585
|
return (target, propertyKey, _descriptor) => {
|
|
467
|
-
if (
|
|
1586
|
+
if (propertyKey === void 0) {
|
|
468
1587
|
Reflect.defineMetadata(TIMEOUT_KEY, {
|
|
469
1588
|
ms
|
|
470
1589
|
}, target);
|
|
@@ -486,7 +1605,7 @@ function Log(options) {
|
|
|
486
1605
|
logResponse: false,
|
|
487
1606
|
...options
|
|
488
1607
|
};
|
|
489
|
-
if (
|
|
1608
|
+
if (propertyKey === void 0) {
|
|
490
1609
|
Reflect.defineMetadata(LOG_KEY, config, target);
|
|
491
1610
|
} else {
|
|
492
1611
|
Reflect.defineMetadata(LOG_KEY, config, target, propertyKey);
|
|
@@ -622,7 +1741,7 @@ function registerControllers(router, controllers) {
|
|
|
622
1741
|
}
|
|
623
1742
|
return;
|
|
624
1743
|
}
|
|
625
|
-
if (redirect
|
|
1744
|
+
if (redirect?.url) {
|
|
626
1745
|
if (timeoutId) {
|
|
627
1746
|
clearTimeout(timeoutId);
|
|
628
1747
|
}
|
|
@@ -748,7 +1867,7 @@ function applyParamOptions(rawValue, options, key) {
|
|
|
748
1867
|
}
|
|
749
1868
|
}
|
|
750
1869
|
if (options.type === "number" && options.throwError !== false) {
|
|
751
|
-
const hasInvalidNumber = value.some((v) => isNaN(Number(v)));
|
|
1870
|
+
const hasInvalidNumber = value.some((v) => Number.isNaN(Number(v)));
|
|
752
1871
|
if (hasInvalidNumber) {
|
|
753
1872
|
throw new exception.BadRequestException(`Type error: expected number array${paramName}`);
|
|
754
1873
|
}
|
|
@@ -797,13 +1916,14 @@ function applyParamOptions(rawValue, options, key) {
|
|
|
797
1916
|
}
|
|
798
1917
|
}
|
|
799
1918
|
}
|
|
1919
|
+
const paramNotMatchMsg = `Parameter '${key}' does not match pattern: ${options.patternName || options.pattern}`;
|
|
800
1920
|
if (options.type === "string" && options.pattern && typeof value === "string" && !options.pattern.test(value)) {
|
|
801
|
-
throw new exception.BadRequestException(
|
|
1921
|
+
throw new exception.BadRequestException(paramNotMatchMsg);
|
|
802
1922
|
} else if (options.type === "number" && options.pattern && typeof value === "number" && !options.pattern.test(String(value))) {
|
|
803
|
-
throw new exception.BadRequestException(
|
|
1923
|
+
throw new exception.BadRequestException(paramNotMatchMsg);
|
|
804
1924
|
}
|
|
805
1925
|
if (options.throwError !== false) {
|
|
806
|
-
if (options.type === "number" && typeof value === "number" && isNaN(value)) {
|
|
1926
|
+
if (options.type === "number" && typeof value === "number" && Number.isNaN(value)) {
|
|
807
1927
|
throw new exception.BadRequestException(`Type error: expected number${paramName}`);
|
|
808
1928
|
}
|
|
809
1929
|
if (options.type === "number" && typeof value === "number") {
|
|
@@ -870,6 +1990,24 @@ function convertType(value, type) {
|
|
|
870
1990
|
}
|
|
871
1991
|
}
|
|
872
1992
|
__name(convertType, "convertType");
|
|
1993
|
+
/*! Bundled license information:
|
|
1994
|
+
|
|
1995
|
+
reflect-metadata/Reflect.js:
|
|
1996
|
+
(*! *****************************************************************************
|
|
1997
|
+
Copyright (C) Microsoft. All rights reserved.
|
|
1998
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
1999
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
2000
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
2001
|
+
|
|
2002
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
2003
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
2004
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
2005
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
2006
|
+
|
|
2007
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
2008
|
+
and limitations under the License.
|
|
2009
|
+
***************************************************************************** *)
|
|
2010
|
+
*/
|
|
873
2011
|
|
|
874
2012
|
exports.After = After;
|
|
875
2013
|
exports.Before = Before;
|