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