@orion-js/services 4.0.0-alpha.3 → 4.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +479 -932
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +4 -11
- package/dist/index.js +461 -917
- package/dist/index.js.map +1 -0
- package/package.json +13 -13
package/dist/index.cjs
CHANGED
|
@@ -1,601 +1,33 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
3
1
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var
|
|
8
|
-
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
-
for (let key of __getOwnPropNames(mod))
|
|
11
|
-
if (!__hasOwnProp.call(to, key))
|
|
12
|
-
__defProp(to, key, {
|
|
13
|
-
get: () => mod[key],
|
|
14
|
-
enumerable: true
|
|
15
|
-
});
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __moduleCache = /* @__PURE__ */ new WeakMap;
|
|
19
|
-
var __toCommonJS = (from) => {
|
|
20
|
-
var entry = __moduleCache.get(from), desc;
|
|
21
|
-
if (entry)
|
|
22
|
-
return entry;
|
|
23
|
-
entry = __defProp({}, "__esModule", { value: true });
|
|
24
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
25
|
-
__getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
|
|
26
|
-
get: () => from[key],
|
|
27
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
28
|
-
}));
|
|
29
|
-
__moduleCache.set(from, entry);
|
|
30
|
-
return entry;
|
|
31
|
-
};
|
|
32
|
-
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
33
6
|
var __export = (target, all) => {
|
|
34
7
|
for (var name in all)
|
|
35
|
-
__defProp(target, name, {
|
|
36
|
-
get: all[name],
|
|
37
|
-
enumerable: true,
|
|
38
|
-
configurable: true,
|
|
39
|
-
set: (newValue) => all[name] = () => newValue
|
|
40
|
-
});
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
41
9
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
class Token {
|
|
49
|
-
constructor(name) {
|
|
50
|
-
this.name = name;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
exports2.Token = Token;
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// ../../node_modules/typedi/cjs/error/service-not-found.error.js
|
|
57
|
-
var require_service_not_found_error = __commonJS((exports2) => {
|
|
58
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
59
|
-
exports2.ServiceNotFoundError = undefined;
|
|
60
|
-
var token_class_1 = require_token_class();
|
|
61
|
-
|
|
62
|
-
class ServiceNotFoundError extends Error {
|
|
63
|
-
constructor(identifier) {
|
|
64
|
-
var _a, _b;
|
|
65
|
-
super();
|
|
66
|
-
this.name = "ServiceNotFoundError";
|
|
67
|
-
this.normalizedIdentifier = "<UNKNOWN_IDENTIFIER>";
|
|
68
|
-
if (typeof identifier === "string") {
|
|
69
|
-
this.normalizedIdentifier = identifier;
|
|
70
|
-
} else if (identifier instanceof token_class_1.Token) {
|
|
71
|
-
this.normalizedIdentifier = `Token<${identifier.name || "UNSET_NAME"}>`;
|
|
72
|
-
} else if (identifier && (identifier.name || ((_a = identifier.prototype) === null || _a === undefined ? undefined : _a.name))) {
|
|
73
|
-
this.normalizedIdentifier = `MaybeConstructable<${identifier.name}>` || `MaybeConstructable<${(_b = identifier.prototype) === null || _b === undefined ? undefined : _b.name}>`;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
get message() {
|
|
77
|
-
return `Service with "${this.normalizedIdentifier}" identifier was not found in the container. ` + `Register it before usage via explicitly calling the "Container.set" function or using the "@Service()" decorator.`;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
exports2.ServiceNotFoundError = ServiceNotFoundError;
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
// ../../node_modules/typedi/cjs/error/cannot-instantiate-value.error.js
|
|
84
|
-
var require_cannot_instantiate_value_error = __commonJS((exports2) => {
|
|
85
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
86
|
-
exports2.CannotInstantiateValueError = undefined;
|
|
87
|
-
var token_class_1 = require_token_class();
|
|
88
|
-
|
|
89
|
-
class CannotInstantiateValueError extends Error {
|
|
90
|
-
constructor(identifier) {
|
|
91
|
-
var _a, _b;
|
|
92
|
-
super();
|
|
93
|
-
this.name = "CannotInstantiateValueError";
|
|
94
|
-
this.normalizedIdentifier = "<UNKNOWN_IDENTIFIER>";
|
|
95
|
-
if (typeof identifier === "string") {
|
|
96
|
-
this.normalizedIdentifier = identifier;
|
|
97
|
-
} else if (identifier instanceof token_class_1.Token) {
|
|
98
|
-
this.normalizedIdentifier = `Token<${identifier.name || "UNSET_NAME"}>`;
|
|
99
|
-
} else if (identifier && (identifier.name || ((_a = identifier.prototype) === null || _a === undefined ? undefined : _a.name))) {
|
|
100
|
-
this.normalizedIdentifier = `MaybeConstructable<${identifier.name}>` || `MaybeConstructable<${(_b = identifier.prototype) === null || _b === undefined ? undefined : _b.name}>`;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
get message() {
|
|
104
|
-
return `Cannot instantiate the requested value for the "${this.normalizedIdentifier}" identifier. ` + `The related metadata doesn't contain a factory or a type to instantiate.`;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
exports2.CannotInstantiateValueError = CannotInstantiateValueError;
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
// ../../node_modules/typedi/cjs/empty.const.js
|
|
111
|
-
var require_empty_const = __commonJS((exports2) => {
|
|
112
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
113
|
-
exports2.EMPTY_VALUE = undefined;
|
|
114
|
-
exports2.EMPTY_VALUE = Symbol("EMPTY_VALUE");
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
// ../../node_modules/typedi/cjs/container-instance.class.js
|
|
118
|
-
var require_container_instance_class = __commonJS((exports2) => {
|
|
119
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
120
|
-
exports2.ContainerInstance = undefined;
|
|
121
|
-
var container_class_1 = require_container_class();
|
|
122
|
-
var service_not_found_error_1 = require_service_not_found_error();
|
|
123
|
-
var cannot_instantiate_value_error_1 = require_cannot_instantiate_value_error();
|
|
124
|
-
var token_class_1 = require_token_class();
|
|
125
|
-
var empty_const_1 = require_empty_const();
|
|
126
|
-
|
|
127
|
-
class ContainerInstance {
|
|
128
|
-
constructor(id) {
|
|
129
|
-
this.services = [];
|
|
130
|
-
this.id = id;
|
|
131
|
-
}
|
|
132
|
-
has(identifier) {
|
|
133
|
-
return !!this.findService(identifier);
|
|
134
|
-
}
|
|
135
|
-
get(identifier) {
|
|
136
|
-
const globalContainer = container_class_1.Container.of(undefined);
|
|
137
|
-
const globalService = globalContainer.findService(identifier);
|
|
138
|
-
const scopedService = this.findService(identifier);
|
|
139
|
-
if (globalService && globalService.global === true)
|
|
140
|
-
return this.getServiceValue(globalService);
|
|
141
|
-
if (scopedService)
|
|
142
|
-
return this.getServiceValue(scopedService);
|
|
143
|
-
if (globalService && this !== globalContainer) {
|
|
144
|
-
const clonedService = { ...globalService };
|
|
145
|
-
clonedService.value = empty_const_1.EMPTY_VALUE;
|
|
146
|
-
this.set(clonedService);
|
|
147
|
-
const value = this.getServiceValue(clonedService);
|
|
148
|
-
this.set({ ...clonedService, value });
|
|
149
|
-
return value;
|
|
150
|
-
}
|
|
151
|
-
if (globalService)
|
|
152
|
-
return this.getServiceValue(globalService);
|
|
153
|
-
throw new service_not_found_error_1.ServiceNotFoundError(identifier);
|
|
154
|
-
}
|
|
155
|
-
getMany(identifier) {
|
|
156
|
-
return this.findAllServices(identifier).map((service) => this.getServiceValue(service));
|
|
157
|
-
}
|
|
158
|
-
set(identifierOrServiceMetadata, value) {
|
|
159
|
-
if (identifierOrServiceMetadata instanceof Array) {
|
|
160
|
-
identifierOrServiceMetadata.forEach((data) => this.set(data));
|
|
161
|
-
return this;
|
|
162
|
-
}
|
|
163
|
-
if (typeof identifierOrServiceMetadata === "string" || identifierOrServiceMetadata instanceof token_class_1.Token) {
|
|
164
|
-
return this.set({
|
|
165
|
-
id: identifierOrServiceMetadata,
|
|
166
|
-
type: null,
|
|
167
|
-
value,
|
|
168
|
-
factory: undefined,
|
|
169
|
-
global: false,
|
|
170
|
-
multiple: false,
|
|
171
|
-
eager: false,
|
|
172
|
-
transient: false
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
if (typeof identifierOrServiceMetadata === "function") {
|
|
176
|
-
return this.set({
|
|
177
|
-
id: identifierOrServiceMetadata,
|
|
178
|
-
type: identifierOrServiceMetadata,
|
|
179
|
-
value,
|
|
180
|
-
factory: undefined,
|
|
181
|
-
global: false,
|
|
182
|
-
multiple: false,
|
|
183
|
-
eager: false,
|
|
184
|
-
transient: false
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
const newService = {
|
|
188
|
-
id: new token_class_1.Token("UNREACHABLE"),
|
|
189
|
-
type: null,
|
|
190
|
-
factory: undefined,
|
|
191
|
-
value: empty_const_1.EMPTY_VALUE,
|
|
192
|
-
global: false,
|
|
193
|
-
multiple: false,
|
|
194
|
-
eager: false,
|
|
195
|
-
transient: false,
|
|
196
|
-
...identifierOrServiceMetadata
|
|
197
|
-
};
|
|
198
|
-
const service = this.findService(newService.id);
|
|
199
|
-
if (service && service.multiple !== true) {
|
|
200
|
-
Object.assign(service, newService);
|
|
201
|
-
} else {
|
|
202
|
-
this.services.push(newService);
|
|
203
|
-
}
|
|
204
|
-
if (newService.eager) {
|
|
205
|
-
this.get(newService.id);
|
|
206
|
-
}
|
|
207
|
-
return this;
|
|
208
|
-
}
|
|
209
|
-
remove(identifierOrIdentifierArray) {
|
|
210
|
-
if (Array.isArray(identifierOrIdentifierArray)) {
|
|
211
|
-
identifierOrIdentifierArray.forEach((id) => this.remove(id));
|
|
212
|
-
} else {
|
|
213
|
-
this.services = this.services.filter((service) => {
|
|
214
|
-
if (service.id === identifierOrIdentifierArray) {
|
|
215
|
-
this.destroyServiceInstance(service);
|
|
216
|
-
return false;
|
|
217
|
-
}
|
|
218
|
-
return true;
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
return this;
|
|
222
|
-
}
|
|
223
|
-
reset(options = { strategy: "resetValue" }) {
|
|
224
|
-
switch (options.strategy) {
|
|
225
|
-
case "resetValue":
|
|
226
|
-
this.services.forEach((service) => this.destroyServiceInstance(service));
|
|
227
|
-
break;
|
|
228
|
-
case "resetServices":
|
|
229
|
-
this.services.forEach((service) => this.destroyServiceInstance(service));
|
|
230
|
-
this.services = [];
|
|
231
|
-
break;
|
|
232
|
-
default:
|
|
233
|
-
throw new Error("Received invalid reset strategy.");
|
|
234
|
-
}
|
|
235
|
-
return this;
|
|
236
|
-
}
|
|
237
|
-
findAllServices(identifier) {
|
|
238
|
-
return this.services.filter((service) => service.id === identifier);
|
|
239
|
-
}
|
|
240
|
-
findService(identifier) {
|
|
241
|
-
return this.services.find((service) => service.id === identifier);
|
|
242
|
-
}
|
|
243
|
-
getServiceValue(serviceMetadata) {
|
|
244
|
-
var _a;
|
|
245
|
-
let value = empty_const_1.EMPTY_VALUE;
|
|
246
|
-
if (serviceMetadata.value !== empty_const_1.EMPTY_VALUE) {
|
|
247
|
-
return serviceMetadata.value;
|
|
248
|
-
}
|
|
249
|
-
if (!serviceMetadata.factory && !serviceMetadata.type) {
|
|
250
|
-
throw new cannot_instantiate_value_error_1.CannotInstantiateValueError(serviceMetadata.id);
|
|
251
|
-
}
|
|
252
|
-
if (serviceMetadata.factory) {
|
|
253
|
-
if (serviceMetadata.factory instanceof Array) {
|
|
254
|
-
let factoryInstance;
|
|
255
|
-
try {
|
|
256
|
-
factoryInstance = this.get(serviceMetadata.factory[0]);
|
|
257
|
-
} catch (error) {
|
|
258
|
-
if (error instanceof service_not_found_error_1.ServiceNotFoundError) {
|
|
259
|
-
factoryInstance = new serviceMetadata.factory[0];
|
|
260
|
-
} else {
|
|
261
|
-
throw error;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
value = factoryInstance[serviceMetadata.factory[1]](this, serviceMetadata.id);
|
|
265
|
-
} else {
|
|
266
|
-
value = serviceMetadata.factory(this, serviceMetadata.id);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
if (!serviceMetadata.factory && serviceMetadata.type) {
|
|
270
|
-
const constructableTargetType = serviceMetadata.type;
|
|
271
|
-
const paramTypes = ((_a = Reflect) === null || _a === undefined ? undefined : _a.getMetadata("design:paramtypes", constructableTargetType)) || [];
|
|
272
|
-
const params = this.initializeParams(constructableTargetType, paramTypes);
|
|
273
|
-
params.push(this);
|
|
274
|
-
value = new constructableTargetType(...params);
|
|
275
|
-
}
|
|
276
|
-
if (!serviceMetadata.transient && value !== empty_const_1.EMPTY_VALUE) {
|
|
277
|
-
serviceMetadata.value = value;
|
|
278
|
-
}
|
|
279
|
-
if (value === empty_const_1.EMPTY_VALUE) {
|
|
280
|
-
throw new cannot_instantiate_value_error_1.CannotInstantiateValueError(serviceMetadata.id);
|
|
281
|
-
}
|
|
282
|
-
if (serviceMetadata.type) {
|
|
283
|
-
this.applyPropertyHandlers(serviceMetadata.type, value);
|
|
284
|
-
}
|
|
285
|
-
return value;
|
|
286
|
-
}
|
|
287
|
-
initializeParams(target, paramTypes) {
|
|
288
|
-
return paramTypes.map((paramType, index) => {
|
|
289
|
-
const paramHandler = container_class_1.Container.handlers.find((handler) => {
|
|
290
|
-
return (handler.object === target || handler.object === Object.getPrototypeOf(target)) && handler.index === index;
|
|
291
|
-
});
|
|
292
|
-
if (paramHandler)
|
|
293
|
-
return paramHandler.value(this);
|
|
294
|
-
if (paramType && paramType.name && !this.isPrimitiveParamType(paramType.name)) {
|
|
295
|
-
return this.get(paramType);
|
|
296
|
-
}
|
|
297
|
-
return;
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
isPrimitiveParamType(paramTypeName) {
|
|
301
|
-
return ["string", "boolean", "number", "object"].includes(paramTypeName.toLowerCase());
|
|
302
|
-
}
|
|
303
|
-
applyPropertyHandlers(target, instance) {
|
|
304
|
-
container_class_1.Container.handlers.forEach((handler) => {
|
|
305
|
-
if (typeof handler.index === "number")
|
|
306
|
-
return;
|
|
307
|
-
if (handler.object.constructor !== target && !(target.prototype instanceof handler.object.constructor))
|
|
308
|
-
return;
|
|
309
|
-
if (handler.propertyName) {
|
|
310
|
-
instance[handler.propertyName] = handler.value(this);
|
|
311
|
-
}
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
destroyServiceInstance(serviceMetadata, force = false) {
|
|
315
|
-
const shouldResetValue = force || !!serviceMetadata.type || !!serviceMetadata.factory;
|
|
316
|
-
if (shouldResetValue) {
|
|
317
|
-
if (typeof (serviceMetadata === null || serviceMetadata === undefined ? undefined : serviceMetadata.value)["destroy"] === "function") {
|
|
318
|
-
try {
|
|
319
|
-
serviceMetadata.value.destroy();
|
|
320
|
-
} catch (error) {
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
serviceMetadata.value = empty_const_1.EMPTY_VALUE;
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
exports2.ContainerInstance = ContainerInstance;
|
|
328
|
-
});
|
|
329
|
-
|
|
330
|
-
// ../../node_modules/typedi/cjs/container.class.js
|
|
331
|
-
var require_container_class = __commonJS((exports2) => {
|
|
332
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
333
|
-
exports2.Container = undefined;
|
|
334
|
-
var container_instance_class_1 = require_container_instance_class();
|
|
335
|
-
|
|
336
|
-
class Container {
|
|
337
|
-
static of(containerId = "default") {
|
|
338
|
-
if (containerId === "default")
|
|
339
|
-
return this.globalInstance;
|
|
340
|
-
let container = this.instances.find((instance) => instance.id === containerId);
|
|
341
|
-
if (!container) {
|
|
342
|
-
container = new container_instance_class_1.ContainerInstance(containerId);
|
|
343
|
-
this.instances.push(container);
|
|
344
|
-
}
|
|
345
|
-
return container;
|
|
346
|
-
}
|
|
347
|
-
static has(identifier) {
|
|
348
|
-
return this.globalInstance.has(identifier);
|
|
349
|
-
}
|
|
350
|
-
static get(identifier) {
|
|
351
|
-
return this.globalInstance.get(identifier);
|
|
352
|
-
}
|
|
353
|
-
static getMany(id) {
|
|
354
|
-
return this.globalInstance.getMany(id);
|
|
355
|
-
}
|
|
356
|
-
static set(identifierOrServiceMetadata, value) {
|
|
357
|
-
this.globalInstance.set(identifierOrServiceMetadata, value);
|
|
358
|
-
return this;
|
|
359
|
-
}
|
|
360
|
-
static remove(identifierOrIdentifierArray) {
|
|
361
|
-
this.globalInstance.remove(identifierOrIdentifierArray);
|
|
362
|
-
return this;
|
|
363
|
-
}
|
|
364
|
-
static reset(containerId = "default") {
|
|
365
|
-
if (containerId == "default") {
|
|
366
|
-
this.globalInstance.reset();
|
|
367
|
-
this.instances.forEach((instance) => instance.reset());
|
|
368
|
-
} else {
|
|
369
|
-
const instance = this.instances.find((instance2) => instance2.id === containerId);
|
|
370
|
-
if (instance) {
|
|
371
|
-
instance.reset();
|
|
372
|
-
this.instances.splice(this.instances.indexOf(instance), 1);
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
return this;
|
|
376
|
-
}
|
|
377
|
-
static registerHandler(handler) {
|
|
378
|
-
this.handlers.push(handler);
|
|
379
|
-
return this;
|
|
380
|
-
}
|
|
381
|
-
static import(services) {
|
|
382
|
-
return this;
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
exports2.Container = Container;
|
|
386
|
-
Container.handlers = [];
|
|
387
|
-
Container.globalInstance = new container_instance_class_1.ContainerInstance("default");
|
|
388
|
-
Container.instances = [];
|
|
389
|
-
});
|
|
390
|
-
|
|
391
|
-
// ../../node_modules/typedi/cjs/error/cannot-inject-value.error.js
|
|
392
|
-
var require_cannot_inject_value_error = __commonJS((exports2) => {
|
|
393
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
394
|
-
exports2.CannotInjectValueError = undefined;
|
|
395
|
-
|
|
396
|
-
class CannotInjectValueError extends Error {
|
|
397
|
-
constructor(target, propertyName) {
|
|
398
|
-
super();
|
|
399
|
-
this.target = target;
|
|
400
|
-
this.propertyName = propertyName;
|
|
401
|
-
this.name = "CannotInjectValueError";
|
|
402
|
-
}
|
|
403
|
-
get message() {
|
|
404
|
-
return `Cannot inject value into "${this.target.constructor.name}.${this.propertyName}". ` + `Please make sure you setup reflect-metadata properly and you don't use interfaces without service tokens as injection value.`;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
exports2.CannotInjectValueError = CannotInjectValueError;
|
|
408
|
-
});
|
|
409
|
-
|
|
410
|
-
// ../../node_modules/typedi/cjs/utils/resolve-to-type-wrapper.util.js
|
|
411
|
-
var require_resolve_to_type_wrapper_util = __commonJS((exports2) => {
|
|
412
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
413
|
-
exports2.resolveToTypeWrapper = undefined;
|
|
414
|
-
var token_class_1 = require_token_class();
|
|
415
|
-
function resolveToTypeWrapper(typeOrIdentifier, target, propertyName, index) {
|
|
416
|
-
let typeWrapper;
|
|
417
|
-
if (typeOrIdentifier && typeof typeOrIdentifier === "string" || typeOrIdentifier instanceof token_class_1.Token) {
|
|
418
|
-
typeWrapper = { eagerType: typeOrIdentifier, lazyType: () => typeOrIdentifier };
|
|
419
|
-
}
|
|
420
|
-
if (typeOrIdentifier && typeof typeOrIdentifier === "function") {
|
|
421
|
-
typeWrapper = { eagerType: null, lazyType: () => typeOrIdentifier() };
|
|
422
|
-
}
|
|
423
|
-
if (!typeOrIdentifier && propertyName) {
|
|
424
|
-
const identifier = Reflect.getMetadata("design:type", target, propertyName);
|
|
425
|
-
typeWrapper = { eagerType: identifier, lazyType: () => identifier };
|
|
426
|
-
}
|
|
427
|
-
if (!typeOrIdentifier && typeof index == "number" && Number.isInteger(index)) {
|
|
428
|
-
const paramTypes = Reflect.getMetadata("design:paramtypes", target, propertyName);
|
|
429
|
-
const identifier = paramTypes === null || paramTypes === undefined ? undefined : paramTypes[index];
|
|
430
|
-
typeWrapper = { eagerType: identifier, lazyType: () => identifier };
|
|
431
|
-
}
|
|
432
|
-
return typeWrapper;
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
433
15
|
}
|
|
434
|
-
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
// ../../node_modules/typedi/cjs/decorators/inject-many.decorator.js
|
|
438
|
-
var require_inject_many_decorator = __commonJS((exports2) => {
|
|
439
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
440
|
-
exports2.InjectMany = undefined;
|
|
441
|
-
var container_class_1 = require_container_class();
|
|
442
|
-
var cannot_inject_value_error_1 = require_cannot_inject_value_error();
|
|
443
|
-
var resolve_to_type_wrapper_util_1 = require_resolve_to_type_wrapper_util();
|
|
444
|
-
function InjectMany(typeOrIdentifier) {
|
|
445
|
-
return function(target, propertyName, index) {
|
|
446
|
-
const typeWrapper = resolve_to_type_wrapper_util_1.resolveToTypeWrapper(typeOrIdentifier, target, propertyName, index);
|
|
447
|
-
if (typeWrapper === undefined || typeWrapper.eagerType === undefined || typeWrapper.eagerType === Object) {
|
|
448
|
-
throw new cannot_inject_value_error_1.CannotInjectValueError(target, propertyName);
|
|
449
|
-
}
|
|
450
|
-
container_class_1.Container.registerHandler({
|
|
451
|
-
object: target,
|
|
452
|
-
propertyName,
|
|
453
|
-
index,
|
|
454
|
-
value: (containerInstance) => {
|
|
455
|
-
const evaluatedLazyType = typeWrapper.lazyType();
|
|
456
|
-
if (evaluatedLazyType === undefined || evaluatedLazyType === Object) {
|
|
457
|
-
throw new cannot_inject_value_error_1.CannotInjectValueError(target, propertyName);
|
|
458
|
-
}
|
|
459
|
-
return containerInstance.getMany(evaluatedLazyType);
|
|
460
|
-
}
|
|
461
|
-
});
|
|
462
|
-
};
|
|
463
|
-
}
|
|
464
|
-
exports2.InjectMany = InjectMany;
|
|
465
|
-
});
|
|
466
|
-
|
|
467
|
-
// ../../node_modules/typedi/cjs/decorators/inject.decorator.js
|
|
468
|
-
var require_inject_decorator = __commonJS((exports2) => {
|
|
469
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
470
|
-
exports2.Inject = undefined;
|
|
471
|
-
var container_class_1 = require_container_class();
|
|
472
|
-
var cannot_inject_value_error_1 = require_cannot_inject_value_error();
|
|
473
|
-
var resolve_to_type_wrapper_util_1 = require_resolve_to_type_wrapper_util();
|
|
474
|
-
function Inject(typeOrIdentifier) {
|
|
475
|
-
return function(target, propertyName, index) {
|
|
476
|
-
const typeWrapper = resolve_to_type_wrapper_util_1.resolveToTypeWrapper(typeOrIdentifier, target, propertyName, index);
|
|
477
|
-
if (typeWrapper === undefined || typeWrapper.eagerType === undefined || typeWrapper.eagerType === Object) {
|
|
478
|
-
throw new cannot_inject_value_error_1.CannotInjectValueError(target, propertyName);
|
|
479
|
-
}
|
|
480
|
-
container_class_1.Container.registerHandler({
|
|
481
|
-
object: target,
|
|
482
|
-
propertyName,
|
|
483
|
-
index,
|
|
484
|
-
value: (containerInstance) => {
|
|
485
|
-
const evaluatedLazyType = typeWrapper.lazyType();
|
|
486
|
-
if (evaluatedLazyType === undefined || evaluatedLazyType === Object) {
|
|
487
|
-
throw new cannot_inject_value_error_1.CannotInjectValueError(target, propertyName);
|
|
488
|
-
}
|
|
489
|
-
return containerInstance.get(evaluatedLazyType);
|
|
490
|
-
}
|
|
491
|
-
});
|
|
492
|
-
};
|
|
493
|
-
}
|
|
494
|
-
exports2.Inject = Inject;
|
|
495
|
-
});
|
|
496
|
-
|
|
497
|
-
// ../../node_modules/typedi/cjs/decorators/service.decorator.js
|
|
498
|
-
var require_service_decorator = __commonJS((exports2) => {
|
|
499
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
500
|
-
exports2.Service = undefined;
|
|
501
|
-
var container_class_1 = require_container_class();
|
|
502
|
-
var token_class_1 = require_token_class();
|
|
503
|
-
var empty_const_1 = require_empty_const();
|
|
504
|
-
function Service(optionsOrServiceIdentifier) {
|
|
505
|
-
return (targetConstructor) => {
|
|
506
|
-
const serviceMetadata = {
|
|
507
|
-
id: targetConstructor,
|
|
508
|
-
type: targetConstructor,
|
|
509
|
-
factory: undefined,
|
|
510
|
-
multiple: false,
|
|
511
|
-
global: false,
|
|
512
|
-
eager: false,
|
|
513
|
-
transient: false,
|
|
514
|
-
value: empty_const_1.EMPTY_VALUE
|
|
515
|
-
};
|
|
516
|
-
if (optionsOrServiceIdentifier instanceof token_class_1.Token || typeof optionsOrServiceIdentifier === "string") {
|
|
517
|
-
serviceMetadata.id = optionsOrServiceIdentifier;
|
|
518
|
-
} else if (optionsOrServiceIdentifier) {
|
|
519
|
-
serviceMetadata.id = optionsOrServiceIdentifier.id || targetConstructor;
|
|
520
|
-
serviceMetadata.factory = optionsOrServiceIdentifier.factory || undefined;
|
|
521
|
-
serviceMetadata.multiple = optionsOrServiceIdentifier.multiple || false;
|
|
522
|
-
serviceMetadata.global = optionsOrServiceIdentifier.global || false;
|
|
523
|
-
serviceMetadata.eager = optionsOrServiceIdentifier.eager || false;
|
|
524
|
-
serviceMetadata.transient = optionsOrServiceIdentifier.transient || false;
|
|
525
|
-
}
|
|
526
|
-
container_class_1.Container.set(serviceMetadata);
|
|
527
|
-
};
|
|
528
|
-
}
|
|
529
|
-
exports2.Service = Service;
|
|
530
|
-
});
|
|
531
|
-
|
|
532
|
-
// ../../node_modules/typedi/cjs/index.js
|
|
533
|
-
var require_cjs = __commonJS((exports2) => {
|
|
534
|
-
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
535
|
-
if (k2 === undefined)
|
|
536
|
-
k2 = k;
|
|
537
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() {
|
|
538
|
-
return m[k];
|
|
539
|
-
} });
|
|
540
|
-
} : function(o, m, k, k2) {
|
|
541
|
-
if (k2 === undefined)
|
|
542
|
-
k2 = k;
|
|
543
|
-
o[k2] = m[k];
|
|
544
|
-
});
|
|
545
|
-
var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
|
|
546
|
-
for (var p in m)
|
|
547
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
|
|
548
|
-
__createBinding(exports3, m, p);
|
|
549
|
-
};
|
|
550
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
551
|
-
exports2.Token = exports2.Container = exports2.ContainerInstance = undefined;
|
|
552
|
-
var container_class_1 = require_container_class();
|
|
553
|
-
__exportStar(require_inject_many_decorator(), exports2);
|
|
554
|
-
__exportStar(require_inject_decorator(), exports2);
|
|
555
|
-
__exportStar(require_service_decorator(), exports2);
|
|
556
|
-
__exportStar(require_cannot_inject_value_error(), exports2);
|
|
557
|
-
__exportStar(require_cannot_instantiate_value_error(), exports2);
|
|
558
|
-
__exportStar(require_service_not_found_error(), exports2);
|
|
559
|
-
var container_instance_class_1 = require_container_instance_class();
|
|
560
|
-
Object.defineProperty(exports2, "ContainerInstance", { enumerable: true, get: function() {
|
|
561
|
-
return container_instance_class_1.ContainerInstance;
|
|
562
|
-
} });
|
|
563
|
-
var container_class_2 = require_container_class();
|
|
564
|
-
Object.defineProperty(exports2, "Container", { enumerable: true, get: function() {
|
|
565
|
-
return container_class_2.Container;
|
|
566
|
-
} });
|
|
567
|
-
var token_class_1 = require_token_class();
|
|
568
|
-
Object.defineProperty(exports2, "Token", { enumerable: true, get: function() {
|
|
569
|
-
return token_class_1.Token;
|
|
570
|
-
} });
|
|
571
|
-
exports2.default = container_class_1.Container;
|
|
572
|
-
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
573
19
|
|
|
574
20
|
// src/index.ts
|
|
575
|
-
var
|
|
576
|
-
__export(
|
|
577
|
-
|
|
578
|
-
Service: () => import_typedi2.Service,
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
Container: () => import_typedi2.Container,
|
|
579
24
|
Inject: () => import_typedi2.Inject,
|
|
580
|
-
|
|
25
|
+
Service: () => import_typedi2.Service,
|
|
26
|
+
getInstance: () => getInstance
|
|
581
27
|
});
|
|
582
|
-
module.exports = __toCommonJS(
|
|
28
|
+
module.exports = __toCommonJS(index_exports);
|
|
583
29
|
|
|
584
|
-
//
|
|
585
|
-
/*! *****************************************************************************
|
|
586
|
-
Copyright (C) Microsoft. All rights reserved.
|
|
587
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
588
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
589
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
590
|
-
|
|
591
|
-
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
592
|
-
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
593
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
594
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
595
|
-
|
|
596
|
-
See the Apache Version 2.0 License for specific language governing permissions
|
|
597
|
-
and limitations under the License.
|
|
598
|
-
***************************************************************************** */
|
|
30
|
+
// node_modules/.pnpm/reflect-metadata@0.1.14/node_modules/reflect-metadata/Reflect.js
|
|
599
31
|
var Reflect2;
|
|
600
32
|
(function(Reflect3) {
|
|
601
33
|
(function(factory) {
|
|
@@ -610,25 +42,34 @@ var Reflect2;
|
|
|
610
42
|
function makeExporter(target, previous) {
|
|
611
43
|
return function(key, value) {
|
|
612
44
|
if (typeof target[key] !== "function") {
|
|
613
|
-
Object.defineProperty(target, key, {
|
|
45
|
+
Object.defineProperty(target, key, {
|
|
46
|
+
configurable: true,
|
|
47
|
+
writable: true,
|
|
48
|
+
value
|
|
49
|
+
});
|
|
614
50
|
}
|
|
615
|
-
if (previous)
|
|
616
|
-
previous(key, value);
|
|
51
|
+
if (previous) previous(key, value);
|
|
617
52
|
};
|
|
618
53
|
}
|
|
54
|
+
__name(makeExporter, "makeExporter");
|
|
619
55
|
})(function(exporter) {
|
|
620
56
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
621
57
|
var supportsSymbol = typeof Symbol === "function";
|
|
622
58
|
var toPrimitiveSymbol = supportsSymbol && typeof Symbol.toPrimitive !== "undefined" ? Symbol.toPrimitive : "@@toPrimitive";
|
|
623
59
|
var iteratorSymbol = supportsSymbol && typeof Symbol.iterator !== "undefined" ? Symbol.iterator : "@@iterator";
|
|
624
60
|
var supportsCreate = typeof Object.create === "function";
|
|
625
|
-
var supportsProto = {
|
|
61
|
+
var supportsProto = {
|
|
62
|
+
__proto__: []
|
|
63
|
+
} instanceof Array;
|
|
626
64
|
var downLevel = !supportsCreate && !supportsProto;
|
|
627
65
|
var HashMap = {
|
|
66
|
+
// create an object in dictionary mode (a.k.a. "slow" mode in v8)
|
|
628
67
|
create: supportsCreate ? function() {
|
|
629
|
-
return MakeDictionary(Object.create(null));
|
|
68
|
+
return MakeDictionary(/* @__PURE__ */ Object.create(null));
|
|
630
69
|
} : supportsProto ? function() {
|
|
631
|
-
return MakeDictionary({
|
|
70
|
+
return MakeDictionary({
|
|
71
|
+
__proto__: null
|
|
72
|
+
});
|
|
632
73
|
} : function() {
|
|
633
74
|
return MakeDictionary({});
|
|
634
75
|
},
|
|
@@ -638,213 +79,211 @@ var Reflect2;
|
|
|
638
79
|
return key in map;
|
|
639
80
|
},
|
|
640
81
|
get: downLevel ? function(map, key) {
|
|
641
|
-
return hasOwn.call(map, key) ? map[key] :
|
|
82
|
+
return hasOwn.call(map, key) ? map[key] : void 0;
|
|
642
83
|
} : function(map, key) {
|
|
643
84
|
return map[key];
|
|
644
85
|
}
|
|
645
86
|
};
|
|
646
87
|
var functionPrototype = Object.getPrototypeOf(Function);
|
|
647
|
-
var usePolyfill = typeof process === "object" && process
|
|
88
|
+
var usePolyfill = typeof process === "object" && process["env"] && process["env"]["REFLECT_METADATA_USE_MAP_POLYFILL"] === "true";
|
|
648
89
|
var _Map = !usePolyfill && typeof Map === "function" && typeof Map.prototype.entries === "function" ? Map : CreateMapPolyfill();
|
|
649
90
|
var _Set = !usePolyfill && typeof Set === "function" && typeof Set.prototype.entries === "function" ? Set : CreateSetPolyfill();
|
|
650
91
|
var _WeakMap = !usePolyfill && typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill();
|
|
651
|
-
var Metadata = new _WeakMap;
|
|
92
|
+
var Metadata = new _WeakMap();
|
|
652
93
|
function decorate(decorators, target, propertyKey, attributes) {
|
|
653
94
|
if (!IsUndefined(propertyKey)) {
|
|
654
|
-
if (!IsArray(decorators))
|
|
655
|
-
|
|
656
|
-
if (!IsObject(
|
|
657
|
-
|
|
658
|
-
if (!IsObject(attributes) && !IsUndefined(attributes) && !IsNull(attributes))
|
|
659
|
-
throw new TypeError;
|
|
660
|
-
if (IsNull(attributes))
|
|
661
|
-
attributes = undefined;
|
|
95
|
+
if (!IsArray(decorators)) throw new TypeError();
|
|
96
|
+
if (!IsObject(target)) throw new TypeError();
|
|
97
|
+
if (!IsObject(attributes) && !IsUndefined(attributes) && !IsNull(attributes)) throw new TypeError();
|
|
98
|
+
if (IsNull(attributes)) attributes = void 0;
|
|
662
99
|
propertyKey = ToPropertyKey(propertyKey);
|
|
663
100
|
return DecorateProperty(decorators, target, propertyKey, attributes);
|
|
664
101
|
} else {
|
|
665
|
-
if (!IsArray(decorators))
|
|
666
|
-
|
|
667
|
-
if (!IsConstructor(target))
|
|
668
|
-
throw new TypeError;
|
|
102
|
+
if (!IsArray(decorators)) throw new TypeError();
|
|
103
|
+
if (!IsConstructor(target)) throw new TypeError();
|
|
669
104
|
return DecorateConstructor(decorators, target);
|
|
670
105
|
}
|
|
671
106
|
}
|
|
107
|
+
__name(decorate, "decorate");
|
|
672
108
|
exporter("decorate", decorate);
|
|
673
109
|
function metadata(metadataKey, metadataValue) {
|
|
674
110
|
function decorator(target, propertyKey) {
|
|
675
|
-
if (!IsObject(target))
|
|
676
|
-
|
|
677
|
-
if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey))
|
|
678
|
-
throw new TypeError;
|
|
111
|
+
if (!IsObject(target)) throw new TypeError();
|
|
112
|
+
if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey)) throw new TypeError();
|
|
679
113
|
OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
|
|
680
114
|
}
|
|
115
|
+
__name(decorator, "decorator");
|
|
681
116
|
return decorator;
|
|
682
117
|
}
|
|
118
|
+
__name(metadata, "metadata");
|
|
683
119
|
exporter("metadata", metadata);
|
|
684
120
|
function defineMetadata(metadataKey, metadataValue, target, propertyKey) {
|
|
685
|
-
if (!IsObject(target))
|
|
686
|
-
|
|
687
|
-
if (!IsUndefined(propertyKey))
|
|
688
|
-
propertyKey = ToPropertyKey(propertyKey);
|
|
121
|
+
if (!IsObject(target)) throw new TypeError();
|
|
122
|
+
if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
|
|
689
123
|
return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
|
|
690
124
|
}
|
|
125
|
+
__name(defineMetadata, "defineMetadata");
|
|
691
126
|
exporter("defineMetadata", defineMetadata);
|
|
692
127
|
function hasMetadata(metadataKey, target, propertyKey) {
|
|
693
|
-
if (!IsObject(target))
|
|
694
|
-
|
|
695
|
-
if (!IsUndefined(propertyKey))
|
|
696
|
-
propertyKey = ToPropertyKey(propertyKey);
|
|
128
|
+
if (!IsObject(target)) throw new TypeError();
|
|
129
|
+
if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
|
|
697
130
|
return OrdinaryHasMetadata(metadataKey, target, propertyKey);
|
|
698
131
|
}
|
|
132
|
+
__name(hasMetadata, "hasMetadata");
|
|
699
133
|
exporter("hasMetadata", hasMetadata);
|
|
700
134
|
function hasOwnMetadata(metadataKey, target, propertyKey) {
|
|
701
|
-
if (!IsObject(target))
|
|
702
|
-
|
|
703
|
-
if (!IsUndefined(propertyKey))
|
|
704
|
-
propertyKey = ToPropertyKey(propertyKey);
|
|
135
|
+
if (!IsObject(target)) throw new TypeError();
|
|
136
|
+
if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
|
|
705
137
|
return OrdinaryHasOwnMetadata(metadataKey, target, propertyKey);
|
|
706
138
|
}
|
|
139
|
+
__name(hasOwnMetadata, "hasOwnMetadata");
|
|
707
140
|
exporter("hasOwnMetadata", hasOwnMetadata);
|
|
708
141
|
function getMetadata(metadataKey, target, propertyKey) {
|
|
709
|
-
if (!IsObject(target))
|
|
710
|
-
|
|
711
|
-
if (!IsUndefined(propertyKey))
|
|
712
|
-
propertyKey = ToPropertyKey(propertyKey);
|
|
142
|
+
if (!IsObject(target)) throw new TypeError();
|
|
143
|
+
if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
|
|
713
144
|
return OrdinaryGetMetadata(metadataKey, target, propertyKey);
|
|
714
145
|
}
|
|
146
|
+
__name(getMetadata, "getMetadata");
|
|
715
147
|
exporter("getMetadata", getMetadata);
|
|
716
148
|
function getOwnMetadata(metadataKey, target, propertyKey) {
|
|
717
|
-
if (!IsObject(target))
|
|
718
|
-
|
|
719
|
-
if (!IsUndefined(propertyKey))
|
|
720
|
-
propertyKey = ToPropertyKey(propertyKey);
|
|
149
|
+
if (!IsObject(target)) throw new TypeError();
|
|
150
|
+
if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
|
|
721
151
|
return OrdinaryGetOwnMetadata(metadataKey, target, propertyKey);
|
|
722
152
|
}
|
|
153
|
+
__name(getOwnMetadata, "getOwnMetadata");
|
|
723
154
|
exporter("getOwnMetadata", getOwnMetadata);
|
|
724
155
|
function getMetadataKeys(target, propertyKey) {
|
|
725
|
-
if (!IsObject(target))
|
|
726
|
-
|
|
727
|
-
if (!IsUndefined(propertyKey))
|
|
728
|
-
propertyKey = ToPropertyKey(propertyKey);
|
|
156
|
+
if (!IsObject(target)) throw new TypeError();
|
|
157
|
+
if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
|
|
729
158
|
return OrdinaryMetadataKeys(target, propertyKey);
|
|
730
159
|
}
|
|
160
|
+
__name(getMetadataKeys, "getMetadataKeys");
|
|
731
161
|
exporter("getMetadataKeys", getMetadataKeys);
|
|
732
162
|
function getOwnMetadataKeys(target, propertyKey) {
|
|
733
|
-
if (!IsObject(target))
|
|
734
|
-
|
|
735
|
-
if (!IsUndefined(propertyKey))
|
|
736
|
-
propertyKey = ToPropertyKey(propertyKey);
|
|
163
|
+
if (!IsObject(target)) throw new TypeError();
|
|
164
|
+
if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
|
|
737
165
|
return OrdinaryOwnMetadataKeys(target, propertyKey);
|
|
738
166
|
}
|
|
167
|
+
__name(getOwnMetadataKeys, "getOwnMetadataKeys");
|
|
739
168
|
exporter("getOwnMetadataKeys", getOwnMetadataKeys);
|
|
740
169
|
function deleteMetadata(metadataKey, target, propertyKey) {
|
|
741
|
-
if (!IsObject(target))
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
if (metadataMap.
|
|
751
|
-
|
|
170
|
+
if (!IsObject(target)) throw new TypeError();
|
|
171
|
+
if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
|
|
172
|
+
var metadataMap = GetOrCreateMetadataMap(
|
|
173
|
+
target,
|
|
174
|
+
propertyKey,
|
|
175
|
+
/*Create*/
|
|
176
|
+
false
|
|
177
|
+
);
|
|
178
|
+
if (IsUndefined(metadataMap)) return false;
|
|
179
|
+
if (!metadataMap.delete(metadataKey)) return false;
|
|
180
|
+
if (metadataMap.size > 0) return true;
|
|
752
181
|
var targetMetadata = Metadata.get(target);
|
|
753
182
|
targetMetadata.delete(propertyKey);
|
|
754
|
-
if (targetMetadata.size > 0)
|
|
755
|
-
return true;
|
|
183
|
+
if (targetMetadata.size > 0) return true;
|
|
756
184
|
Metadata.delete(target);
|
|
757
185
|
return true;
|
|
758
186
|
}
|
|
187
|
+
__name(deleteMetadata, "deleteMetadata");
|
|
759
188
|
exporter("deleteMetadata", deleteMetadata);
|
|
760
189
|
function DecorateConstructor(decorators, target) {
|
|
761
|
-
for (var i = decorators.length - 1;i >= 0; --i) {
|
|
190
|
+
for (var i = decorators.length - 1; i >= 0; --i) {
|
|
762
191
|
var decorator = decorators[i];
|
|
763
192
|
var decorated = decorator(target);
|
|
764
193
|
if (!IsUndefined(decorated) && !IsNull(decorated)) {
|
|
765
|
-
if (!IsConstructor(decorated))
|
|
766
|
-
throw new TypeError;
|
|
194
|
+
if (!IsConstructor(decorated)) throw new TypeError();
|
|
767
195
|
target = decorated;
|
|
768
196
|
}
|
|
769
197
|
}
|
|
770
198
|
return target;
|
|
771
199
|
}
|
|
200
|
+
__name(DecorateConstructor, "DecorateConstructor");
|
|
772
201
|
function DecorateProperty(decorators, target, propertyKey, descriptor) {
|
|
773
|
-
for (var i = decorators.length - 1;i >= 0; --i) {
|
|
202
|
+
for (var i = decorators.length - 1; i >= 0; --i) {
|
|
774
203
|
var decorator = decorators[i];
|
|
775
204
|
var decorated = decorator(target, propertyKey, descriptor);
|
|
776
205
|
if (!IsUndefined(decorated) && !IsNull(decorated)) {
|
|
777
|
-
if (!IsObject(decorated))
|
|
778
|
-
throw new TypeError;
|
|
206
|
+
if (!IsObject(decorated)) throw new TypeError();
|
|
779
207
|
descriptor = decorated;
|
|
780
208
|
}
|
|
781
209
|
}
|
|
782
210
|
return descriptor;
|
|
783
211
|
}
|
|
212
|
+
__name(DecorateProperty, "DecorateProperty");
|
|
784
213
|
function GetOrCreateMetadataMap(O, P, Create) {
|
|
785
214
|
var targetMetadata = Metadata.get(O);
|
|
786
215
|
if (IsUndefined(targetMetadata)) {
|
|
787
|
-
if (!Create)
|
|
788
|
-
|
|
789
|
-
targetMetadata = new _Map;
|
|
216
|
+
if (!Create) return void 0;
|
|
217
|
+
targetMetadata = new _Map();
|
|
790
218
|
Metadata.set(O, targetMetadata);
|
|
791
219
|
}
|
|
792
220
|
var metadataMap = targetMetadata.get(P);
|
|
793
221
|
if (IsUndefined(metadataMap)) {
|
|
794
|
-
if (!Create)
|
|
795
|
-
|
|
796
|
-
metadataMap = new _Map;
|
|
222
|
+
if (!Create) return void 0;
|
|
223
|
+
metadataMap = new _Map();
|
|
797
224
|
targetMetadata.set(P, metadataMap);
|
|
798
225
|
}
|
|
799
226
|
return metadataMap;
|
|
800
227
|
}
|
|
228
|
+
__name(GetOrCreateMetadataMap, "GetOrCreateMetadataMap");
|
|
801
229
|
function OrdinaryHasMetadata(MetadataKey, O, P) {
|
|
802
230
|
var hasOwn2 = OrdinaryHasOwnMetadata(MetadataKey, O, P);
|
|
803
|
-
if (hasOwn2)
|
|
804
|
-
return true;
|
|
231
|
+
if (hasOwn2) return true;
|
|
805
232
|
var parent = OrdinaryGetPrototypeOf(O);
|
|
806
|
-
if (!IsNull(parent))
|
|
807
|
-
return OrdinaryHasMetadata(MetadataKey, parent, P);
|
|
233
|
+
if (!IsNull(parent)) return OrdinaryHasMetadata(MetadataKey, parent, P);
|
|
808
234
|
return false;
|
|
809
235
|
}
|
|
236
|
+
__name(OrdinaryHasMetadata, "OrdinaryHasMetadata");
|
|
810
237
|
function OrdinaryHasOwnMetadata(MetadataKey, O, P) {
|
|
811
|
-
var metadataMap = GetOrCreateMetadataMap(
|
|
812
|
-
|
|
813
|
-
|
|
238
|
+
var metadataMap = GetOrCreateMetadataMap(
|
|
239
|
+
O,
|
|
240
|
+
P,
|
|
241
|
+
/*Create*/
|
|
242
|
+
false
|
|
243
|
+
);
|
|
244
|
+
if (IsUndefined(metadataMap)) return false;
|
|
814
245
|
return ToBoolean(metadataMap.has(MetadataKey));
|
|
815
246
|
}
|
|
247
|
+
__name(OrdinaryHasOwnMetadata, "OrdinaryHasOwnMetadata");
|
|
816
248
|
function OrdinaryGetMetadata(MetadataKey, O, P) {
|
|
817
249
|
var hasOwn2 = OrdinaryHasOwnMetadata(MetadataKey, O, P);
|
|
818
|
-
if (hasOwn2)
|
|
819
|
-
return OrdinaryGetOwnMetadata(MetadataKey, O, P);
|
|
250
|
+
if (hasOwn2) return OrdinaryGetOwnMetadata(MetadataKey, O, P);
|
|
820
251
|
var parent = OrdinaryGetPrototypeOf(O);
|
|
821
|
-
if (!IsNull(parent))
|
|
822
|
-
|
|
823
|
-
return;
|
|
252
|
+
if (!IsNull(parent)) return OrdinaryGetMetadata(MetadataKey, parent, P);
|
|
253
|
+
return void 0;
|
|
824
254
|
}
|
|
255
|
+
__name(OrdinaryGetMetadata, "OrdinaryGetMetadata");
|
|
825
256
|
function OrdinaryGetOwnMetadata(MetadataKey, O, P) {
|
|
826
|
-
var metadataMap = GetOrCreateMetadataMap(
|
|
827
|
-
|
|
828
|
-
|
|
257
|
+
var metadataMap = GetOrCreateMetadataMap(
|
|
258
|
+
O,
|
|
259
|
+
P,
|
|
260
|
+
/*Create*/
|
|
261
|
+
false
|
|
262
|
+
);
|
|
263
|
+
if (IsUndefined(metadataMap)) return void 0;
|
|
829
264
|
return metadataMap.get(MetadataKey);
|
|
830
265
|
}
|
|
266
|
+
__name(OrdinaryGetOwnMetadata, "OrdinaryGetOwnMetadata");
|
|
831
267
|
function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
|
|
832
|
-
var metadataMap = GetOrCreateMetadataMap(
|
|
268
|
+
var metadataMap = GetOrCreateMetadataMap(
|
|
269
|
+
O,
|
|
270
|
+
P,
|
|
271
|
+
/*Create*/
|
|
272
|
+
true
|
|
273
|
+
);
|
|
833
274
|
metadataMap.set(MetadataKey, MetadataValue);
|
|
834
275
|
}
|
|
276
|
+
__name(OrdinaryDefineOwnMetadata, "OrdinaryDefineOwnMetadata");
|
|
835
277
|
function OrdinaryMetadataKeys(O, P) {
|
|
836
278
|
var ownKeys = OrdinaryOwnMetadataKeys(O, P);
|
|
837
279
|
var parent = OrdinaryGetPrototypeOf(O);
|
|
838
|
-
if (parent === null)
|
|
839
|
-
return ownKeys;
|
|
280
|
+
if (parent === null) return ownKeys;
|
|
840
281
|
var parentKeys = OrdinaryMetadataKeys(parent, P);
|
|
841
|
-
if (parentKeys.length <= 0)
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
return parentKeys;
|
|
845
|
-
var set = new _Set;
|
|
282
|
+
if (parentKeys.length <= 0) return ownKeys;
|
|
283
|
+
if (ownKeys.length <= 0) return parentKeys;
|
|
284
|
+
var set = new _Set();
|
|
846
285
|
var keys = [];
|
|
847
|
-
for (var _i = 0, ownKeys_1 = ownKeys;_i < ownKeys_1.length; _i++) {
|
|
286
|
+
for (var _i = 0, ownKeys_1 = ownKeys; _i < ownKeys_1.length; _i++) {
|
|
848
287
|
var key = ownKeys_1[_i];
|
|
849
288
|
var hasKey = set.has(key);
|
|
850
289
|
if (!hasKey) {
|
|
@@ -852,7 +291,7 @@ var Reflect2;
|
|
|
852
291
|
keys.push(key);
|
|
853
292
|
}
|
|
854
293
|
}
|
|
855
|
-
for (var _a = 0, parentKeys_1 = parentKeys;_a < parentKeys_1.length; _a++) {
|
|
294
|
+
for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) {
|
|
856
295
|
var key = parentKeys_1[_a];
|
|
857
296
|
var hasKey = set.has(key);
|
|
858
297
|
if (!hasKey) {
|
|
@@ -862,11 +301,16 @@ var Reflect2;
|
|
|
862
301
|
}
|
|
863
302
|
return keys;
|
|
864
303
|
}
|
|
304
|
+
__name(OrdinaryMetadataKeys, "OrdinaryMetadataKeys");
|
|
865
305
|
function OrdinaryOwnMetadataKeys(O, P) {
|
|
866
306
|
var keys = [];
|
|
867
|
-
var metadataMap = GetOrCreateMetadataMap(
|
|
868
|
-
|
|
869
|
-
|
|
307
|
+
var metadataMap = GetOrCreateMetadataMap(
|
|
308
|
+
O,
|
|
309
|
+
P,
|
|
310
|
+
/*Create*/
|
|
311
|
+
false
|
|
312
|
+
);
|
|
313
|
+
if (IsUndefined(metadataMap)) return keys;
|
|
870
314
|
var keysObj = metadataMap.keys();
|
|
871
315
|
var iterator = GetIterator(keysObj);
|
|
872
316
|
var k = 0;
|
|
@@ -889,9 +333,9 @@ var Reflect2;
|
|
|
889
333
|
k++;
|
|
890
334
|
}
|
|
891
335
|
}
|
|
336
|
+
__name(OrdinaryOwnMetadataKeys, "OrdinaryOwnMetadataKeys");
|
|
892
337
|
function Type(x) {
|
|
893
|
-
if (x === null)
|
|
894
|
-
return 1;
|
|
338
|
+
if (x === null) return 1;
|
|
895
339
|
switch (typeof x) {
|
|
896
340
|
case "undefined":
|
|
897
341
|
return 0;
|
|
@@ -909,18 +353,23 @@ var Reflect2;
|
|
|
909
353
|
return 6;
|
|
910
354
|
}
|
|
911
355
|
}
|
|
356
|
+
__name(Type, "Type");
|
|
912
357
|
function IsUndefined(x) {
|
|
913
|
-
return x ===
|
|
358
|
+
return x === void 0;
|
|
914
359
|
}
|
|
360
|
+
__name(IsUndefined, "IsUndefined");
|
|
915
361
|
function IsNull(x) {
|
|
916
362
|
return x === null;
|
|
917
363
|
}
|
|
364
|
+
__name(IsNull, "IsNull");
|
|
918
365
|
function IsSymbol(x) {
|
|
919
366
|
return typeof x === "symbol";
|
|
920
367
|
}
|
|
368
|
+
__name(IsSymbol, "IsSymbol");
|
|
921
369
|
function IsObject(x) {
|
|
922
370
|
return typeof x === "object" ? x !== null : typeof x === "function";
|
|
923
371
|
}
|
|
372
|
+
__name(IsObject, "IsObject");
|
|
924
373
|
function ToPrimitive(input, PreferredType) {
|
|
925
374
|
switch (Type(input)) {
|
|
926
375
|
case 0:
|
|
@@ -938,65 +387,71 @@ var Reflect2;
|
|
|
938
387
|
}
|
|
939
388
|
var hint = PreferredType === 3 ? "string" : PreferredType === 5 ? "number" : "default";
|
|
940
389
|
var exoticToPrim = GetMethod(input, toPrimitiveSymbol);
|
|
941
|
-
if (exoticToPrim !==
|
|
390
|
+
if (exoticToPrim !== void 0) {
|
|
942
391
|
var result = exoticToPrim.call(input, hint);
|
|
943
|
-
if (IsObject(result))
|
|
944
|
-
throw new TypeError;
|
|
392
|
+
if (IsObject(result)) throw new TypeError();
|
|
945
393
|
return result;
|
|
946
394
|
}
|
|
947
395
|
return OrdinaryToPrimitive(input, hint === "default" ? "number" : hint);
|
|
948
396
|
}
|
|
397
|
+
__name(ToPrimitive, "ToPrimitive");
|
|
949
398
|
function OrdinaryToPrimitive(O, hint) {
|
|
950
399
|
if (hint === "string") {
|
|
951
400
|
var toString_1 = O.toString;
|
|
952
401
|
if (IsCallable(toString_1)) {
|
|
953
402
|
var result = toString_1.call(O);
|
|
954
|
-
if (!IsObject(result))
|
|
955
|
-
return result;
|
|
403
|
+
if (!IsObject(result)) return result;
|
|
956
404
|
}
|
|
957
405
|
var valueOf = O.valueOf;
|
|
958
406
|
if (IsCallable(valueOf)) {
|
|
959
407
|
var result = valueOf.call(O);
|
|
960
|
-
if (!IsObject(result))
|
|
961
|
-
return result;
|
|
408
|
+
if (!IsObject(result)) return result;
|
|
962
409
|
}
|
|
963
410
|
} else {
|
|
964
411
|
var valueOf = O.valueOf;
|
|
965
412
|
if (IsCallable(valueOf)) {
|
|
966
413
|
var result = valueOf.call(O);
|
|
967
|
-
if (!IsObject(result))
|
|
968
|
-
return result;
|
|
414
|
+
if (!IsObject(result)) return result;
|
|
969
415
|
}
|
|
970
416
|
var toString_2 = O.toString;
|
|
971
417
|
if (IsCallable(toString_2)) {
|
|
972
418
|
var result = toString_2.call(O);
|
|
973
|
-
if (!IsObject(result))
|
|
974
|
-
return result;
|
|
419
|
+
if (!IsObject(result)) return result;
|
|
975
420
|
}
|
|
976
421
|
}
|
|
977
|
-
throw new TypeError;
|
|
422
|
+
throw new TypeError();
|
|
978
423
|
}
|
|
424
|
+
__name(OrdinaryToPrimitive, "OrdinaryToPrimitive");
|
|
979
425
|
function ToBoolean(argument) {
|
|
980
426
|
return !!argument;
|
|
981
427
|
}
|
|
428
|
+
__name(ToBoolean, "ToBoolean");
|
|
982
429
|
function ToString(argument) {
|
|
983
430
|
return "" + argument;
|
|
984
431
|
}
|
|
432
|
+
__name(ToString, "ToString");
|
|
985
433
|
function ToPropertyKey(argument) {
|
|
986
|
-
var key = ToPrimitive(
|
|
987
|
-
|
|
988
|
-
|
|
434
|
+
var key = ToPrimitive(
|
|
435
|
+
argument,
|
|
436
|
+
3
|
|
437
|
+
/* String */
|
|
438
|
+
);
|
|
439
|
+
if (IsSymbol(key)) return key;
|
|
989
440
|
return ToString(key);
|
|
990
441
|
}
|
|
442
|
+
__name(ToPropertyKey, "ToPropertyKey");
|
|
991
443
|
function IsArray(argument) {
|
|
992
444
|
return Array.isArray ? Array.isArray(argument) : argument instanceof Object ? argument instanceof Array : Object.prototype.toString.call(argument) === "[object Array]";
|
|
993
445
|
}
|
|
446
|
+
__name(IsArray, "IsArray");
|
|
994
447
|
function IsCallable(argument) {
|
|
995
448
|
return typeof argument === "function";
|
|
996
449
|
}
|
|
450
|
+
__name(IsCallable, "IsCallable");
|
|
997
451
|
function IsConstructor(argument) {
|
|
998
452
|
return typeof argument === "function";
|
|
999
453
|
}
|
|
454
|
+
__name(IsConstructor, "IsConstructor");
|
|
1000
455
|
function IsPropertyKey(argument) {
|
|
1001
456
|
switch (Type(argument)) {
|
|
1002
457
|
case 3:
|
|
@@ -1007,261 +462,323 @@ var Reflect2;
|
|
|
1007
462
|
return false;
|
|
1008
463
|
}
|
|
1009
464
|
}
|
|
465
|
+
__name(IsPropertyKey, "IsPropertyKey");
|
|
1010
466
|
function GetMethod(V, P) {
|
|
1011
467
|
var func = V[P];
|
|
1012
|
-
if (func ===
|
|
1013
|
-
|
|
1014
|
-
if (!IsCallable(func))
|
|
1015
|
-
throw new TypeError;
|
|
468
|
+
if (func === void 0 || func === null) return void 0;
|
|
469
|
+
if (!IsCallable(func)) throw new TypeError();
|
|
1016
470
|
return func;
|
|
1017
471
|
}
|
|
472
|
+
__name(GetMethod, "GetMethod");
|
|
1018
473
|
function GetIterator(obj) {
|
|
1019
474
|
var method = GetMethod(obj, iteratorSymbol);
|
|
1020
|
-
if (!IsCallable(method))
|
|
1021
|
-
throw new TypeError;
|
|
475
|
+
if (!IsCallable(method)) throw new TypeError();
|
|
1022
476
|
var iterator = method.call(obj);
|
|
1023
|
-
if (!IsObject(iterator))
|
|
1024
|
-
throw new TypeError;
|
|
477
|
+
if (!IsObject(iterator)) throw new TypeError();
|
|
1025
478
|
return iterator;
|
|
1026
479
|
}
|
|
480
|
+
__name(GetIterator, "GetIterator");
|
|
1027
481
|
function IteratorValue(iterResult) {
|
|
1028
482
|
return iterResult.value;
|
|
1029
483
|
}
|
|
484
|
+
__name(IteratorValue, "IteratorValue");
|
|
1030
485
|
function IteratorStep(iterator) {
|
|
1031
486
|
var result = iterator.next();
|
|
1032
487
|
return result.done ? false : result;
|
|
1033
488
|
}
|
|
489
|
+
__name(IteratorStep, "IteratorStep");
|
|
1034
490
|
function IteratorClose(iterator) {
|
|
1035
491
|
var f = iterator["return"];
|
|
1036
|
-
if (f)
|
|
1037
|
-
f.call(iterator);
|
|
492
|
+
if (f) f.call(iterator);
|
|
1038
493
|
}
|
|
494
|
+
__name(IteratorClose, "IteratorClose");
|
|
1039
495
|
function OrdinaryGetPrototypeOf(O) {
|
|
1040
496
|
var proto = Object.getPrototypeOf(O);
|
|
1041
|
-
if (typeof O !== "function" || O === functionPrototype)
|
|
1042
|
-
|
|
1043
|
-
if (proto !== functionPrototype)
|
|
1044
|
-
return proto;
|
|
497
|
+
if (typeof O !== "function" || O === functionPrototype) return proto;
|
|
498
|
+
if (proto !== functionPrototype) return proto;
|
|
1045
499
|
var prototype = O.prototype;
|
|
1046
500
|
var prototypeProto = prototype && Object.getPrototypeOf(prototype);
|
|
1047
|
-
if (prototypeProto == null || prototypeProto === Object.prototype)
|
|
1048
|
-
return proto;
|
|
501
|
+
if (prototypeProto == null || prototypeProto === Object.prototype) return proto;
|
|
1049
502
|
var constructor = prototypeProto.constructor;
|
|
1050
|
-
if (typeof constructor !== "function")
|
|
1051
|
-
|
|
1052
|
-
if (constructor === O)
|
|
1053
|
-
return proto;
|
|
503
|
+
if (typeof constructor !== "function") return proto;
|
|
504
|
+
if (constructor === O) return proto;
|
|
1054
505
|
return constructor;
|
|
1055
506
|
}
|
|
507
|
+
__name(OrdinaryGetPrototypeOf, "OrdinaryGetPrototypeOf");
|
|
1056
508
|
function CreateMapPolyfill() {
|
|
1057
509
|
var cacheSentinel = {};
|
|
1058
510
|
var arraySentinel = [];
|
|
1059
|
-
var MapIterator =
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
511
|
+
var MapIterator = (
|
|
512
|
+
/** @class */
|
|
513
|
+
function() {
|
|
514
|
+
function MapIterator2(keys, values, selector) {
|
|
515
|
+
this._index = 0;
|
|
516
|
+
this._keys = keys;
|
|
517
|
+
this._values = values;
|
|
518
|
+
this._selector = selector;
|
|
519
|
+
}
|
|
520
|
+
__name(MapIterator2, "MapIterator");
|
|
521
|
+
MapIterator2.prototype["@@iterator"] = function() {
|
|
522
|
+
return this;
|
|
523
|
+
};
|
|
524
|
+
MapIterator2.prototype[iteratorSymbol] = function() {
|
|
525
|
+
return this;
|
|
526
|
+
};
|
|
527
|
+
MapIterator2.prototype.next = function() {
|
|
528
|
+
var index = this._index;
|
|
529
|
+
if (index >= 0 && index < this._keys.length) {
|
|
530
|
+
var result = this._selector(this._keys[index], this._values[index]);
|
|
531
|
+
if (index + 1 >= this._keys.length) {
|
|
532
|
+
this._index = -1;
|
|
533
|
+
this._keys = arraySentinel;
|
|
534
|
+
this._values = arraySentinel;
|
|
535
|
+
} else {
|
|
536
|
+
this._index++;
|
|
537
|
+
}
|
|
538
|
+
return {
|
|
539
|
+
value: result,
|
|
540
|
+
done: false
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
return {
|
|
544
|
+
value: void 0,
|
|
545
|
+
done: true
|
|
546
|
+
};
|
|
547
|
+
};
|
|
548
|
+
MapIterator2.prototype.throw = function(error) {
|
|
549
|
+
if (this._index >= 0) {
|
|
1077
550
|
this._index = -1;
|
|
1078
551
|
this._keys = arraySentinel;
|
|
1079
552
|
this._values = arraySentinel;
|
|
1080
|
-
} else {
|
|
1081
|
-
this._index++;
|
|
1082
553
|
}
|
|
1083
|
-
|
|
1084
|
-
}
|
|
1085
|
-
return
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
554
|
+
throw error;
|
|
555
|
+
};
|
|
556
|
+
MapIterator2.prototype.return = function(value) {
|
|
557
|
+
if (this._index >= 0) {
|
|
558
|
+
this._index = -1;
|
|
559
|
+
this._keys = arraySentinel;
|
|
560
|
+
this._values = arraySentinel;
|
|
561
|
+
}
|
|
562
|
+
return {
|
|
563
|
+
value,
|
|
564
|
+
done: true
|
|
565
|
+
};
|
|
566
|
+
};
|
|
567
|
+
return MapIterator2;
|
|
568
|
+
}()
|
|
569
|
+
);
|
|
570
|
+
return (
|
|
571
|
+
/** @class */
|
|
572
|
+
function() {
|
|
573
|
+
function Map1() {
|
|
574
|
+
this._keys = [];
|
|
575
|
+
this._values = [];
|
|
576
|
+
this._cacheKey = cacheSentinel;
|
|
577
|
+
this._cacheIndex = -2;
|
|
1100
578
|
}
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
var
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
579
|
+
__name(Map1, "Map1");
|
|
580
|
+
Object.defineProperty(Map1.prototype, "size", {
|
|
581
|
+
get: /* @__PURE__ */ __name(function() {
|
|
582
|
+
return this._keys.length;
|
|
583
|
+
}, "get"),
|
|
584
|
+
enumerable: true,
|
|
585
|
+
configurable: true
|
|
586
|
+
});
|
|
587
|
+
Map1.prototype.has = function(key) {
|
|
588
|
+
return this._find(
|
|
589
|
+
key,
|
|
590
|
+
/*insert*/
|
|
591
|
+
false
|
|
592
|
+
) >= 0;
|
|
593
|
+
};
|
|
594
|
+
Map1.prototype.get = function(key) {
|
|
595
|
+
var index = this._find(
|
|
596
|
+
key,
|
|
597
|
+
/*insert*/
|
|
598
|
+
false
|
|
599
|
+
);
|
|
600
|
+
return index >= 0 ? this._values[index] : void 0;
|
|
601
|
+
};
|
|
602
|
+
Map1.prototype.set = function(key, value) {
|
|
603
|
+
var index = this._find(
|
|
604
|
+
key,
|
|
605
|
+
/*insert*/
|
|
606
|
+
true
|
|
607
|
+
);
|
|
608
|
+
this._values[index] = value;
|
|
609
|
+
return this;
|
|
610
|
+
};
|
|
611
|
+
Map1.prototype.delete = function(key) {
|
|
612
|
+
var index = this._find(
|
|
613
|
+
key,
|
|
614
|
+
/*insert*/
|
|
615
|
+
false
|
|
616
|
+
);
|
|
617
|
+
if (index >= 0) {
|
|
618
|
+
var size = this._keys.length;
|
|
619
|
+
for (var i = index + 1; i < size; i++) {
|
|
620
|
+
this._keys[i - 1] = this._keys[i];
|
|
621
|
+
this._values[i - 1] = this._values[i];
|
|
622
|
+
}
|
|
623
|
+
this._keys.length--;
|
|
624
|
+
this._values.length--;
|
|
625
|
+
if (key === this._cacheKey) {
|
|
626
|
+
this._cacheKey = cacheSentinel;
|
|
627
|
+
this._cacheIndex = -2;
|
|
628
|
+
}
|
|
629
|
+
return true;
|
|
1138
630
|
}
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
631
|
+
return false;
|
|
632
|
+
};
|
|
633
|
+
Map1.prototype.clear = function() {
|
|
634
|
+
this._keys.length = 0;
|
|
635
|
+
this._values.length = 0;
|
|
636
|
+
this._cacheKey = cacheSentinel;
|
|
637
|
+
this._cacheIndex = -2;
|
|
638
|
+
};
|
|
639
|
+
Map1.prototype.keys = function() {
|
|
640
|
+
return new MapIterator(this._keys, this._values, getKey);
|
|
641
|
+
};
|
|
642
|
+
Map1.prototype.values = function() {
|
|
643
|
+
return new MapIterator(this._keys, this._values, getValue);
|
|
644
|
+
};
|
|
645
|
+
Map1.prototype.entries = function() {
|
|
646
|
+
return new MapIterator(this._keys, this._values, getEntry);
|
|
647
|
+
};
|
|
648
|
+
Map1.prototype["@@iterator"] = function() {
|
|
649
|
+
return this.entries();
|
|
650
|
+
};
|
|
651
|
+
Map1.prototype[iteratorSymbol] = function() {
|
|
652
|
+
return this.entries();
|
|
653
|
+
};
|
|
654
|
+
Map1.prototype._find = function(key, insert) {
|
|
655
|
+
if (this._cacheKey !== key) {
|
|
656
|
+
this._cacheIndex = this._keys.indexOf(this._cacheKey = key);
|
|
1144
657
|
}
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
Map2.prototype.keys = function() {
|
|
1156
|
-
return new MapIterator(this._keys, this._values, getKey);
|
|
1157
|
-
};
|
|
1158
|
-
Map2.prototype.values = function() {
|
|
1159
|
-
return new MapIterator(this._keys, this._values, getValue);
|
|
1160
|
-
};
|
|
1161
|
-
Map2.prototype.entries = function() {
|
|
1162
|
-
return new MapIterator(this._keys, this._values, getEntry);
|
|
1163
|
-
};
|
|
1164
|
-
Map2.prototype["@@iterator"] = function() {
|
|
1165
|
-
return this.entries();
|
|
1166
|
-
};
|
|
1167
|
-
Map2.prototype[iteratorSymbol] = function() {
|
|
1168
|
-
return this.entries();
|
|
1169
|
-
};
|
|
1170
|
-
Map2.prototype._find = function(key, insert) {
|
|
1171
|
-
if (this._cacheKey !== key) {
|
|
1172
|
-
this._cacheIndex = this._keys.indexOf(this._cacheKey = key);
|
|
1173
|
-
}
|
|
1174
|
-
if (this._cacheIndex < 0 && insert) {
|
|
1175
|
-
this._cacheIndex = this._keys.length;
|
|
1176
|
-
this._keys.push(key);
|
|
1177
|
-
this._values.push(undefined);
|
|
1178
|
-
}
|
|
1179
|
-
return this._cacheIndex;
|
|
1180
|
-
};
|
|
1181
|
-
return Map2;
|
|
1182
|
-
}();
|
|
658
|
+
if (this._cacheIndex < 0 && insert) {
|
|
659
|
+
this._cacheIndex = this._keys.length;
|
|
660
|
+
this._keys.push(key);
|
|
661
|
+
this._values.push(void 0);
|
|
662
|
+
}
|
|
663
|
+
return this._cacheIndex;
|
|
664
|
+
};
|
|
665
|
+
return Map1;
|
|
666
|
+
}()
|
|
667
|
+
);
|
|
1183
668
|
function getKey(key, _) {
|
|
1184
669
|
return key;
|
|
1185
670
|
}
|
|
671
|
+
__name(getKey, "getKey");
|
|
1186
672
|
function getValue(_, value) {
|
|
1187
673
|
return value;
|
|
1188
674
|
}
|
|
675
|
+
__name(getValue, "getValue");
|
|
1189
676
|
function getEntry(key, value) {
|
|
1190
|
-
return [
|
|
677
|
+
return [
|
|
678
|
+
key,
|
|
679
|
+
value
|
|
680
|
+
];
|
|
1191
681
|
}
|
|
682
|
+
__name(getEntry, "getEntry");
|
|
1192
683
|
}
|
|
684
|
+
__name(CreateMapPolyfill, "CreateMapPolyfill");
|
|
1193
685
|
function CreateSetPolyfill() {
|
|
1194
|
-
return
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
686
|
+
return (
|
|
687
|
+
/** @class */
|
|
688
|
+
function() {
|
|
689
|
+
function Set1() {
|
|
690
|
+
this._map = new _Map();
|
|
691
|
+
}
|
|
692
|
+
__name(Set1, "Set1");
|
|
693
|
+
Object.defineProperty(Set1.prototype, "size", {
|
|
694
|
+
get: /* @__PURE__ */ __name(function() {
|
|
695
|
+
return this._map.size;
|
|
696
|
+
}, "get"),
|
|
697
|
+
enumerable: true,
|
|
698
|
+
configurable: true
|
|
699
|
+
});
|
|
700
|
+
Set1.prototype.has = function(value) {
|
|
701
|
+
return this._map.has(value);
|
|
702
|
+
};
|
|
703
|
+
Set1.prototype.add = function(value) {
|
|
704
|
+
return this._map.set(value, value), this;
|
|
705
|
+
};
|
|
706
|
+
Set1.prototype.delete = function(value) {
|
|
707
|
+
return this._map.delete(value);
|
|
708
|
+
};
|
|
709
|
+
Set1.prototype.clear = function() {
|
|
710
|
+
this._map.clear();
|
|
711
|
+
};
|
|
712
|
+
Set1.prototype.keys = function() {
|
|
713
|
+
return this._map.keys();
|
|
714
|
+
};
|
|
715
|
+
Set1.prototype.values = function() {
|
|
716
|
+
return this._map.values();
|
|
717
|
+
};
|
|
718
|
+
Set1.prototype.entries = function() {
|
|
719
|
+
return this._map.entries();
|
|
720
|
+
};
|
|
721
|
+
Set1.prototype["@@iterator"] = function() {
|
|
722
|
+
return this.keys();
|
|
723
|
+
};
|
|
724
|
+
Set1.prototype[iteratorSymbol] = function() {
|
|
725
|
+
return this.keys();
|
|
726
|
+
};
|
|
727
|
+
return Set1;
|
|
728
|
+
}()
|
|
729
|
+
);
|
|
730
|
+
}
|
|
731
|
+
__name(CreateSetPolyfill, "CreateSetPolyfill");
|
|
1235
732
|
function CreateWeakMapPolyfill() {
|
|
1236
733
|
var UUID_SIZE = 16;
|
|
1237
734
|
var keys = HashMap.create();
|
|
1238
735
|
var rootKey = CreateUniqueKey();
|
|
1239
|
-
return
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
736
|
+
return (
|
|
737
|
+
/** @class */
|
|
738
|
+
function() {
|
|
739
|
+
function WeakMap1() {
|
|
740
|
+
this._key = CreateUniqueKey();
|
|
741
|
+
}
|
|
742
|
+
__name(WeakMap1, "WeakMap1");
|
|
743
|
+
WeakMap1.prototype.has = function(target) {
|
|
744
|
+
var table = GetOrCreateWeakMapTable(
|
|
745
|
+
target,
|
|
746
|
+
/*create*/
|
|
747
|
+
false
|
|
748
|
+
);
|
|
749
|
+
return table !== void 0 ? HashMap.has(table, this._key) : false;
|
|
750
|
+
};
|
|
751
|
+
WeakMap1.prototype.get = function(target) {
|
|
752
|
+
var table = GetOrCreateWeakMapTable(
|
|
753
|
+
target,
|
|
754
|
+
/*create*/
|
|
755
|
+
false
|
|
756
|
+
);
|
|
757
|
+
return table !== void 0 ? HashMap.get(table, this._key) : void 0;
|
|
758
|
+
};
|
|
759
|
+
WeakMap1.prototype.set = function(target, value) {
|
|
760
|
+
var table = GetOrCreateWeakMapTable(
|
|
761
|
+
target,
|
|
762
|
+
/*create*/
|
|
763
|
+
true
|
|
764
|
+
);
|
|
765
|
+
table[this._key] = value;
|
|
766
|
+
return this;
|
|
767
|
+
};
|
|
768
|
+
WeakMap1.prototype.delete = function(target) {
|
|
769
|
+
var table = GetOrCreateWeakMapTable(
|
|
770
|
+
target,
|
|
771
|
+
/*create*/
|
|
772
|
+
false
|
|
773
|
+
);
|
|
774
|
+
return table !== void 0 ? delete table[this._key] : false;
|
|
775
|
+
};
|
|
776
|
+
WeakMap1.prototype.clear = function() {
|
|
777
|
+
this._key = CreateUniqueKey();
|
|
778
|
+
};
|
|
779
|
+
return WeakMap1;
|
|
780
|
+
}()
|
|
781
|
+
);
|
|
1265
782
|
function CreateUniqueKey() {
|
|
1266
783
|
var key;
|
|
1267
784
|
do
|
|
@@ -1270,56 +787,86 @@ var Reflect2;
|
|
|
1270
787
|
keys[key] = true;
|
|
1271
788
|
return key;
|
|
1272
789
|
}
|
|
790
|
+
__name(CreateUniqueKey, "CreateUniqueKey");
|
|
1273
791
|
function GetOrCreateWeakMapTable(target, create) {
|
|
1274
792
|
if (!hasOwn.call(target, rootKey)) {
|
|
1275
|
-
if (!create)
|
|
1276
|
-
|
|
1277
|
-
|
|
793
|
+
if (!create) return void 0;
|
|
794
|
+
Object.defineProperty(target, rootKey, {
|
|
795
|
+
value: HashMap.create()
|
|
796
|
+
});
|
|
1278
797
|
}
|
|
1279
798
|
return target[rootKey];
|
|
1280
799
|
}
|
|
800
|
+
__name(GetOrCreateWeakMapTable, "GetOrCreateWeakMapTable");
|
|
1281
801
|
function FillRandomBytes(buffer, size) {
|
|
1282
|
-
for (var i = 0;i < size; ++i)
|
|
1283
|
-
buffer[i] = Math.random() * 255 | 0;
|
|
802
|
+
for (var i = 0; i < size; ++i) buffer[i] = Math.random() * 255 | 0;
|
|
1284
803
|
return buffer;
|
|
1285
804
|
}
|
|
805
|
+
__name(FillRandomBytes, "FillRandomBytes");
|
|
1286
806
|
function GenRandomBytes(size) {
|
|
1287
807
|
if (typeof Uint8Array === "function") {
|
|
1288
|
-
if (typeof crypto !== "undefined")
|
|
1289
|
-
|
|
1290
|
-
if (typeof msCrypto !== "undefined")
|
|
1291
|
-
return msCrypto.getRandomValues(new Uint8Array(size));
|
|
808
|
+
if (typeof crypto !== "undefined") return crypto.getRandomValues(new Uint8Array(size));
|
|
809
|
+
if (typeof msCrypto !== "undefined") return msCrypto.getRandomValues(new Uint8Array(size));
|
|
1292
810
|
return FillRandomBytes(new Uint8Array(size), size);
|
|
1293
811
|
}
|
|
1294
812
|
return FillRandomBytes(new Array(size), size);
|
|
1295
813
|
}
|
|
814
|
+
__name(GenRandomBytes, "GenRandomBytes");
|
|
1296
815
|
function CreateUUID() {
|
|
1297
816
|
var data = GenRandomBytes(UUID_SIZE);
|
|
1298
817
|
data[6] = data[6] & 79 | 64;
|
|
1299
818
|
data[8] = data[8] & 191 | 128;
|
|
1300
819
|
var result = "";
|
|
1301
|
-
for (var offset = 0;offset < UUID_SIZE; ++offset) {
|
|
820
|
+
for (var offset = 0; offset < UUID_SIZE; ++offset) {
|
|
1302
821
|
var byte = data[offset];
|
|
1303
|
-
if (offset === 4 || offset === 6 || offset === 8)
|
|
1304
|
-
|
|
1305
|
-
if (byte < 16)
|
|
1306
|
-
result += "0";
|
|
822
|
+
if (offset === 4 || offset === 6 || offset === 8) result += "-";
|
|
823
|
+
if (byte < 16) result += "0";
|
|
1307
824
|
result += byte.toString(16).toLowerCase();
|
|
1308
825
|
}
|
|
1309
826
|
return result;
|
|
1310
827
|
}
|
|
828
|
+
__name(CreateUUID, "CreateUUID");
|
|
1311
829
|
}
|
|
830
|
+
__name(CreateWeakMapPolyfill, "CreateWeakMapPolyfill");
|
|
1312
831
|
function MakeDictionary(obj) {
|
|
1313
|
-
obj.__ =
|
|
832
|
+
obj.__ = void 0;
|
|
1314
833
|
delete obj.__;
|
|
1315
834
|
return obj;
|
|
1316
835
|
}
|
|
836
|
+
__name(MakeDictionary, "MakeDictionary");
|
|
1317
837
|
});
|
|
1318
838
|
})(Reflect2 || (Reflect2 = {}));
|
|
1319
839
|
|
|
1320
840
|
// src/typedi.ts
|
|
1321
|
-
var import_typedi =
|
|
1322
|
-
var import_typedi2 =
|
|
841
|
+
var import_typedi = require("typedi");
|
|
842
|
+
var import_typedi2 = require("typedi");
|
|
1323
843
|
function getInstance(service) {
|
|
1324
844
|
return import_typedi.Container.get(service);
|
|
1325
845
|
}
|
|
846
|
+
__name(getInstance, "getInstance");
|
|
847
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
848
|
+
0 && (module.exports = {
|
|
849
|
+
Container,
|
|
850
|
+
Inject,
|
|
851
|
+
Service,
|
|
852
|
+
getInstance
|
|
853
|
+
});
|
|
854
|
+
/*! Bundled license information:
|
|
855
|
+
|
|
856
|
+
reflect-metadata/Reflect.js:
|
|
857
|
+
(*! *****************************************************************************
|
|
858
|
+
Copyright (C) Microsoft. All rights reserved.
|
|
859
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
860
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
861
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
862
|
+
|
|
863
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
864
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
865
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
866
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
867
|
+
|
|
868
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
869
|
+
and limitations under the License.
|
|
870
|
+
***************************************************************************** *)
|
|
871
|
+
*/
|
|
872
|
+
//# sourceMappingURL=index.cjs.map
|