@orion-js/services 4.0.0-next.2 → 4.0.0-next.4

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 CHANGED
@@ -1,8 +1,12 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
6
10
  var __export = (target, all) => {
7
11
  for (var name in all)
8
12
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -15,858 +19,479 @@ var __copyProps = (to, from, except, desc) => {
15
19
  }
16
20
  return to;
17
21
  };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
18
30
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
31
 
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- Container: () => import_typedi2.Container,
24
- Inject: () => import_typedi2.Inject,
25
- Service: () => import_typedi2.Service,
26
- getInstance: () => getInstance
27
- });
28
- module.exports = __toCommonJS(index_exports);
29
-
30
- // node_modules/.pnpm/reflect-metadata@0.1.14/node_modules/reflect-metadata/Reflect.js
31
- var Reflect2;
32
- (function(Reflect3) {
33
- (function(factory) {
34
- var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : Function("return this;")();
35
- var exporter = makeExporter(Reflect3);
36
- if (typeof root.Reflect === "undefined") {
37
- root.Reflect = Reflect3;
38
- } else {
39
- exporter = makeExporter(root.Reflect, exporter);
40
- }
41
- factory(exporter);
42
- function makeExporter(target, previous) {
43
- return function(key, value) {
44
- if (typeof target[key] !== "function") {
45
- Object.defineProperty(target, key, {
46
- configurable: true,
47
- writable: true,
48
- value
49
- });
50
- }
51
- if (previous) previous(key, value);
52
- };
53
- }
54
- __name(makeExporter, "makeExporter");
55
- })(function(exporter) {
56
- var hasOwn = Object.prototype.hasOwnProperty;
57
- var supportsSymbol = typeof Symbol === "function";
58
- var toPrimitiveSymbol = supportsSymbol && typeof Symbol.toPrimitive !== "undefined" ? Symbol.toPrimitive : "@@toPrimitive";
59
- var iteratorSymbol = supportsSymbol && typeof Symbol.iterator !== "undefined" ? Symbol.iterator : "@@iterator";
60
- var supportsCreate = typeof Object.create === "function";
61
- var supportsProto = {
62
- __proto__: []
63
- } instanceof Array;
64
- var downLevel = !supportsCreate && !supportsProto;
65
- var HashMap = {
66
- // create an object in dictionary mode (a.k.a. "slow" mode in v8)
67
- create: supportsCreate ? function() {
68
- return MakeDictionary(/* @__PURE__ */ Object.create(null));
69
- } : supportsProto ? function() {
70
- return MakeDictionary({
71
- __proto__: null
72
- });
73
- } : function() {
74
- return MakeDictionary({});
75
- },
76
- has: downLevel ? function(map, key) {
77
- return hasOwn.call(map, key);
78
- } : function(map, key) {
79
- return key in map;
80
- },
81
- get: downLevel ? function(map, key) {
82
- return hasOwn.call(map, key) ? map[key] : void 0;
83
- } : function(map, key) {
84
- return map[key];
85
- }
32
+ // ../../node_modules/.pnpm/object-hash@2.2.0/node_modules/object-hash/index.js
33
+ var require_object_hash = __commonJS({
34
+ "../../node_modules/.pnpm/object-hash@2.2.0/node_modules/object-hash/index.js"(exports2, module2) {
35
+ "use strict";
36
+ var crypto2 = require("crypto");
37
+ exports2 = module2.exports = objectHash;
38
+ function objectHash(object, options) {
39
+ options = applyDefaults(object, options);
40
+ return hash2(object, options);
41
+ }
42
+ exports2.sha1 = function(object) {
43
+ return objectHash(object);
86
44
  };
87
- var functionPrototype = Object.getPrototypeOf(Function);
88
- var usePolyfill = typeof process === "object" && process["env"] && process["env"]["REFLECT_METADATA_USE_MAP_POLYFILL"] === "true";
89
- var _Map = !usePolyfill && typeof Map === "function" && typeof Map.prototype.entries === "function" ? Map : CreateMapPolyfill();
90
- var _Set = !usePolyfill && typeof Set === "function" && typeof Set.prototype.entries === "function" ? Set : CreateSetPolyfill();
91
- var _WeakMap = !usePolyfill && typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill();
92
- var Metadata = new _WeakMap();
93
- function decorate(decorators, target, propertyKey, attributes) {
94
- if (!IsUndefined(propertyKey)) {
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;
99
- propertyKey = ToPropertyKey(propertyKey);
100
- return DecorateProperty(decorators, target, propertyKey, attributes);
101
- } else {
102
- if (!IsArray(decorators)) throw new TypeError();
103
- if (!IsConstructor(target)) throw new TypeError();
104
- return DecorateConstructor(decorators, target);
105
- }
106
- }
107
- __name(decorate, "decorate");
108
- exporter("decorate", decorate);
109
- function metadata(metadataKey, metadataValue) {
110
- function decorator(target, propertyKey) {
111
- if (!IsObject(target)) throw new TypeError();
112
- if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey)) throw new TypeError();
113
- OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
114
- }
115
- __name(decorator, "decorator");
116
- return decorator;
117
- }
118
- __name(metadata, "metadata");
119
- exporter("metadata", metadata);
120
- function defineMetadata(metadataKey, metadataValue, target, propertyKey) {
121
- if (!IsObject(target)) throw new TypeError();
122
- if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
123
- return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
124
- }
125
- __name(defineMetadata, "defineMetadata");
126
- exporter("defineMetadata", defineMetadata);
127
- function hasMetadata(metadataKey, target, propertyKey) {
128
- if (!IsObject(target)) throw new TypeError();
129
- if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
130
- return OrdinaryHasMetadata(metadataKey, target, propertyKey);
131
- }
132
- __name(hasMetadata, "hasMetadata");
133
- exporter("hasMetadata", hasMetadata);
134
- function hasOwnMetadata(metadataKey, target, propertyKey) {
135
- if (!IsObject(target)) throw new TypeError();
136
- if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
137
- return OrdinaryHasOwnMetadata(metadataKey, target, propertyKey);
138
- }
139
- __name(hasOwnMetadata, "hasOwnMetadata");
140
- exporter("hasOwnMetadata", hasOwnMetadata);
141
- function getMetadata(metadataKey, target, propertyKey) {
142
- if (!IsObject(target)) throw new TypeError();
143
- if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
144
- return OrdinaryGetMetadata(metadataKey, target, propertyKey);
145
- }
146
- __name(getMetadata, "getMetadata");
147
- exporter("getMetadata", getMetadata);
148
- function getOwnMetadata(metadataKey, target, propertyKey) {
149
- if (!IsObject(target)) throw new TypeError();
150
- if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
151
- return OrdinaryGetOwnMetadata(metadataKey, target, propertyKey);
152
- }
153
- __name(getOwnMetadata, "getOwnMetadata");
154
- exporter("getOwnMetadata", getOwnMetadata);
155
- function getMetadataKeys(target, propertyKey) {
156
- if (!IsObject(target)) throw new TypeError();
157
- if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
158
- return OrdinaryMetadataKeys(target, propertyKey);
159
- }
160
- __name(getMetadataKeys, "getMetadataKeys");
161
- exporter("getMetadataKeys", getMetadataKeys);
162
- function getOwnMetadataKeys(target, propertyKey) {
163
- if (!IsObject(target)) throw new TypeError();
164
- if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
165
- return OrdinaryOwnMetadataKeys(target, propertyKey);
166
- }
167
- __name(getOwnMetadataKeys, "getOwnMetadataKeys");
168
- exporter("getOwnMetadataKeys", getOwnMetadataKeys);
169
- function deleteMetadata(metadataKey, target, propertyKey) {
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;
181
- var targetMetadata = Metadata.get(target);
182
- targetMetadata.delete(propertyKey);
183
- if (targetMetadata.size > 0) return true;
184
- Metadata.delete(target);
185
- return true;
186
- }
187
- __name(deleteMetadata, "deleteMetadata");
188
- exporter("deleteMetadata", deleteMetadata);
189
- function DecorateConstructor(decorators, target) {
190
- for (var i = decorators.length - 1; i >= 0; --i) {
191
- var decorator = decorators[i];
192
- var decorated = decorator(target);
193
- if (!IsUndefined(decorated) && !IsNull(decorated)) {
194
- if (!IsConstructor(decorated)) throw new TypeError();
195
- target = decorated;
196
- }
45
+ exports2.keys = function(object) {
46
+ return objectHash(object, { excludeValues: true, algorithm: "sha1", encoding: "hex" });
47
+ };
48
+ exports2.MD5 = function(object) {
49
+ return objectHash(object, { algorithm: "md5", encoding: "hex" });
50
+ };
51
+ exports2.keysMD5 = function(object) {
52
+ return objectHash(object, { algorithm: "md5", encoding: "hex", excludeValues: true });
53
+ };
54
+ var hashes = crypto2.getHashes ? crypto2.getHashes().slice() : ["sha1", "md5"];
55
+ hashes.push("passthrough");
56
+ var encodings = ["buffer", "hex", "binary", "base64"];
57
+ function applyDefaults(object, sourceOptions) {
58
+ sourceOptions = sourceOptions || {};
59
+ var options = {};
60
+ options.algorithm = sourceOptions.algorithm || "sha1";
61
+ options.encoding = sourceOptions.encoding || "hex";
62
+ options.excludeValues = sourceOptions.excludeValues ? true : false;
63
+ options.algorithm = options.algorithm.toLowerCase();
64
+ options.encoding = options.encoding.toLowerCase();
65
+ options.ignoreUnknown = sourceOptions.ignoreUnknown !== true ? false : true;
66
+ options.respectType = sourceOptions.respectType === false ? false : true;
67
+ options.respectFunctionNames = sourceOptions.respectFunctionNames === false ? false : true;
68
+ options.respectFunctionProperties = sourceOptions.respectFunctionProperties === false ? false : true;
69
+ options.unorderedArrays = sourceOptions.unorderedArrays !== true ? false : true;
70
+ options.unorderedSets = sourceOptions.unorderedSets === false ? false : true;
71
+ options.unorderedObjects = sourceOptions.unorderedObjects === false ? false : true;
72
+ options.replacer = sourceOptions.replacer || void 0;
73
+ options.excludeKeys = sourceOptions.excludeKeys || void 0;
74
+ if (typeof object === "undefined") {
75
+ throw new Error("Object argument required.");
197
76
  }
198
- return target;
199
- }
200
- __name(DecorateConstructor, "DecorateConstructor");
201
- function DecorateProperty(decorators, target, propertyKey, descriptor) {
202
- for (var i = decorators.length - 1; i >= 0; --i) {
203
- var decorator = decorators[i];
204
- var decorated = decorator(target, propertyKey, descriptor);
205
- if (!IsUndefined(decorated) && !IsNull(decorated)) {
206
- if (!IsObject(decorated)) throw new TypeError();
207
- descriptor = decorated;
77
+ for (var i = 0; i < hashes.length; ++i) {
78
+ if (hashes[i].toLowerCase() === options.algorithm.toLowerCase()) {
79
+ options.algorithm = hashes[i];
208
80
  }
209
81
  }
210
- return descriptor;
211
- }
212
- __name(DecorateProperty, "DecorateProperty");
213
- function GetOrCreateMetadataMap(O, P, Create) {
214
- var targetMetadata = Metadata.get(O);
215
- if (IsUndefined(targetMetadata)) {
216
- if (!Create) return void 0;
217
- targetMetadata = new _Map();
218
- Metadata.set(O, targetMetadata);
82
+ if (hashes.indexOf(options.algorithm) === -1) {
83
+ throw new Error('Algorithm "' + options.algorithm + '" not supported. supported values: ' + hashes.join(", "));
219
84
  }
220
- var metadataMap = targetMetadata.get(P);
221
- if (IsUndefined(metadataMap)) {
222
- if (!Create) return void 0;
223
- metadataMap = new _Map();
224
- targetMetadata.set(P, metadataMap);
85
+ if (encodings.indexOf(options.encoding) === -1 && options.algorithm !== "passthrough") {
86
+ throw new Error('Encoding "' + options.encoding + '" not supported. supported values: ' + encodings.join(", "));
225
87
  }
226
- return metadataMap;
88
+ return options;
227
89
  }
228
- __name(GetOrCreateMetadataMap, "GetOrCreateMetadataMap");
229
- function OrdinaryHasMetadata(MetadataKey, O, P) {
230
- var hasOwn2 = OrdinaryHasOwnMetadata(MetadataKey, O, P);
231
- if (hasOwn2) return true;
232
- var parent = OrdinaryGetPrototypeOf(O);
233
- if (!IsNull(parent)) return OrdinaryHasMetadata(MetadataKey, parent, P);
234
- return false;
235
- }
236
- __name(OrdinaryHasMetadata, "OrdinaryHasMetadata");
237
- function OrdinaryHasOwnMetadata(MetadataKey, O, P) {
238
- var metadataMap = GetOrCreateMetadataMap(
239
- O,
240
- P,
241
- /*Create*/
242
- false
243
- );
244
- if (IsUndefined(metadataMap)) return false;
245
- return ToBoolean(metadataMap.has(MetadataKey));
246
- }
247
- __name(OrdinaryHasOwnMetadata, "OrdinaryHasOwnMetadata");
248
- function OrdinaryGetMetadata(MetadataKey, O, P) {
249
- var hasOwn2 = OrdinaryHasOwnMetadata(MetadataKey, O, P);
250
- if (hasOwn2) return OrdinaryGetOwnMetadata(MetadataKey, O, P);
251
- var parent = OrdinaryGetPrototypeOf(O);
252
- if (!IsNull(parent)) return OrdinaryGetMetadata(MetadataKey, parent, P);
253
- return void 0;
254
- }
255
- __name(OrdinaryGetMetadata, "OrdinaryGetMetadata");
256
- function OrdinaryGetOwnMetadata(MetadataKey, O, P) {
257
- var metadataMap = GetOrCreateMetadataMap(
258
- O,
259
- P,
260
- /*Create*/
261
- false
262
- );
263
- if (IsUndefined(metadataMap)) return void 0;
264
- return metadataMap.get(MetadataKey);
265
- }
266
- __name(OrdinaryGetOwnMetadata, "OrdinaryGetOwnMetadata");
267
- function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
268
- var metadataMap = GetOrCreateMetadataMap(
269
- O,
270
- P,
271
- /*Create*/
272
- true
273
- );
274
- metadataMap.set(MetadataKey, MetadataValue);
275
- }
276
- __name(OrdinaryDefineOwnMetadata, "OrdinaryDefineOwnMetadata");
277
- function OrdinaryMetadataKeys(O, P) {
278
- var ownKeys = OrdinaryOwnMetadataKeys(O, P);
279
- var parent = OrdinaryGetPrototypeOf(O);
280
- if (parent === null) return ownKeys;
281
- var parentKeys = OrdinaryMetadataKeys(parent, P);
282
- if (parentKeys.length <= 0) return ownKeys;
283
- if (ownKeys.length <= 0) return parentKeys;
284
- var set = new _Set();
285
- var keys = [];
286
- for (var _i = 0, ownKeys_1 = ownKeys; _i < ownKeys_1.length; _i++) {
287
- var key = ownKeys_1[_i];
288
- var hasKey = set.has(key);
289
- if (!hasKey) {
290
- set.add(key);
291
- keys.push(key);
292
- }
293
- }
294
- for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) {
295
- var key = parentKeys_1[_a];
296
- var hasKey = set.has(key);
297
- if (!hasKey) {
298
- set.add(key);
299
- keys.push(key);
300
- }
90
+ function isNativeFunction(f) {
91
+ if (typeof f !== "function") {
92
+ return false;
301
93
  }
302
- return keys;
94
+ var exp = /^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i;
95
+ return exp.exec(Function.prototype.toString.call(f)) != null;
303
96
  }
304
- __name(OrdinaryMetadataKeys, "OrdinaryMetadataKeys");
305
- function OrdinaryOwnMetadataKeys(O, P) {
306
- var keys = [];
307
- var metadataMap = GetOrCreateMetadataMap(
308
- O,
309
- P,
310
- /*Create*/
311
- false
312
- );
313
- if (IsUndefined(metadataMap)) return keys;
314
- var keysObj = metadataMap.keys();
315
- var iterator = GetIterator(keysObj);
316
- var k = 0;
317
- while (true) {
318
- var next = IteratorStep(iterator);
319
- if (!next) {
320
- keys.length = k;
321
- return keys;
322
- }
323
- var nextValue = IteratorValue(next);
324
- try {
325
- keys[k] = nextValue;
326
- } catch (e) {
327
- try {
328
- IteratorClose(iterator);
329
- } finally {
330
- throw e;
331
- }
332
- }
333
- k++;
97
+ function hash2(object, options) {
98
+ var hashingStream;
99
+ if (options.algorithm !== "passthrough") {
100
+ hashingStream = crypto2.createHash(options.algorithm);
101
+ } else {
102
+ hashingStream = new PassThrough();
334
103
  }
335
- }
336
- __name(OrdinaryOwnMetadataKeys, "OrdinaryOwnMetadataKeys");
337
- function Type(x) {
338
- if (x === null) return 1;
339
- switch (typeof x) {
340
- case "undefined":
341
- return 0;
342
- case "boolean":
343
- return 2;
344
- case "string":
345
- return 3;
346
- case "symbol":
347
- return 4;
348
- case "number":
349
- return 5;
350
- case "object":
351
- return x === null ? 1 : 6;
352
- default:
353
- return 6;
104
+ if (typeof hashingStream.write === "undefined") {
105
+ hashingStream.write = hashingStream.update;
106
+ hashingStream.end = hashingStream.update;
354
107
  }
355
- }
356
- __name(Type, "Type");
357
- function IsUndefined(x) {
358
- return x === void 0;
359
- }
360
- __name(IsUndefined, "IsUndefined");
361
- function IsNull(x) {
362
- return x === null;
363
- }
364
- __name(IsNull, "IsNull");
365
- function IsSymbol(x) {
366
- return typeof x === "symbol";
367
- }
368
- __name(IsSymbol, "IsSymbol");
369
- function IsObject(x) {
370
- return typeof x === "object" ? x !== null : typeof x === "function";
371
- }
372
- __name(IsObject, "IsObject");
373
- function ToPrimitive(input, PreferredType) {
374
- switch (Type(input)) {
375
- case 0:
376
- return input;
377
- case 1:
378
- return input;
379
- case 2:
380
- return input;
381
- case 3:
382
- return input;
383
- case 4:
384
- return input;
385
- case 5:
386
- return input;
108
+ var hasher = typeHasher(options, hashingStream);
109
+ hasher.dispatch(object);
110
+ if (!hashingStream.update) {
111
+ hashingStream.end("");
387
112
  }
388
- var hint = PreferredType === 3 ? "string" : PreferredType === 5 ? "number" : "default";
389
- var exoticToPrim = GetMethod(input, toPrimitiveSymbol);
390
- if (exoticToPrim !== void 0) {
391
- var result = exoticToPrim.call(input, hint);
392
- if (IsObject(result)) throw new TypeError();
393
- return result;
113
+ if (hashingStream.digest) {
114
+ return hashingStream.digest(options.encoding === "buffer" ? void 0 : options.encoding);
394
115
  }
395
- return OrdinaryToPrimitive(input, hint === "default" ? "number" : hint);
396
- }
397
- __name(ToPrimitive, "ToPrimitive");
398
- function OrdinaryToPrimitive(O, hint) {
399
- if (hint === "string") {
400
- var toString_1 = O.toString;
401
- if (IsCallable(toString_1)) {
402
- var result = toString_1.call(O);
403
- if (!IsObject(result)) return result;
404
- }
405
- var valueOf = O.valueOf;
406
- if (IsCallable(valueOf)) {
407
- var result = valueOf.call(O);
408
- if (!IsObject(result)) return result;
409
- }
410
- } else {
411
- var valueOf = O.valueOf;
412
- if (IsCallable(valueOf)) {
413
- var result = valueOf.call(O);
414
- if (!IsObject(result)) return result;
415
- }
416
- var toString_2 = O.toString;
417
- if (IsCallable(toString_2)) {
418
- var result = toString_2.call(O);
419
- if (!IsObject(result)) return result;
420
- }
116
+ var buf = hashingStream.read();
117
+ if (options.encoding === "buffer") {
118
+ return buf;
421
119
  }
422
- throw new TypeError();
120
+ return buf.toString(options.encoding);
423
121
  }
424
- __name(OrdinaryToPrimitive, "OrdinaryToPrimitive");
425
- function ToBoolean(argument) {
426
- return !!argument;
427
- }
428
- __name(ToBoolean, "ToBoolean");
429
- function ToString(argument) {
430
- return "" + argument;
431
- }
432
- __name(ToString, "ToString");
433
- function ToPropertyKey(argument) {
434
- var key = ToPrimitive(
435
- argument,
436
- 3
437
- /* String */
438
- );
439
- if (IsSymbol(key)) return key;
440
- return ToString(key);
441
- }
442
- __name(ToPropertyKey, "ToPropertyKey");
443
- function IsArray(argument) {
444
- return Array.isArray ? Array.isArray(argument) : argument instanceof Object ? argument instanceof Array : Object.prototype.toString.call(argument) === "[object Array]";
445
- }
446
- __name(IsArray, "IsArray");
447
- function IsCallable(argument) {
448
- return typeof argument === "function";
449
- }
450
- __name(IsCallable, "IsCallable");
451
- function IsConstructor(argument) {
452
- return typeof argument === "function";
453
- }
454
- __name(IsConstructor, "IsConstructor");
455
- function IsPropertyKey(argument) {
456
- switch (Type(argument)) {
457
- case 3:
458
- return true;
459
- case 4:
460
- return true;
461
- default:
462
- return false;
122
+ exports2.writeToStream = function(object, options, stream) {
123
+ if (typeof stream === "undefined") {
124
+ stream = options;
125
+ options = {};
463
126
  }
464
- }
465
- __name(IsPropertyKey, "IsPropertyKey");
466
- function GetMethod(V, P) {
467
- var func = V[P];
468
- if (func === void 0 || func === null) return void 0;
469
- if (!IsCallable(func)) throw new TypeError();
470
- return func;
471
- }
472
- __name(GetMethod, "GetMethod");
473
- function GetIterator(obj) {
474
- var method = GetMethod(obj, iteratorSymbol);
475
- if (!IsCallable(method)) throw new TypeError();
476
- var iterator = method.call(obj);
477
- if (!IsObject(iterator)) throw new TypeError();
478
- return iterator;
479
- }
480
- __name(GetIterator, "GetIterator");
481
- function IteratorValue(iterResult) {
482
- return iterResult.value;
483
- }
484
- __name(IteratorValue, "IteratorValue");
485
- function IteratorStep(iterator) {
486
- var result = iterator.next();
487
- return result.done ? false : result;
488
- }
489
- __name(IteratorStep, "IteratorStep");
490
- function IteratorClose(iterator) {
491
- var f = iterator["return"];
492
- if (f) f.call(iterator);
493
- }
494
- __name(IteratorClose, "IteratorClose");
495
- function OrdinaryGetPrototypeOf(O) {
496
- var proto = Object.getPrototypeOf(O);
497
- if (typeof O !== "function" || O === functionPrototype) return proto;
498
- if (proto !== functionPrototype) return proto;
499
- var prototype = O.prototype;
500
- var prototypeProto = prototype && Object.getPrototypeOf(prototype);
501
- if (prototypeProto == null || prototypeProto === Object.prototype) return proto;
502
- var constructor = prototypeProto.constructor;
503
- if (typeof constructor !== "function") return proto;
504
- if (constructor === O) return proto;
505
- return constructor;
506
- }
507
- __name(OrdinaryGetPrototypeOf, "OrdinaryGetPrototypeOf");
508
- function CreateMapPolyfill() {
509
- var cacheSentinel = {};
510
- var arraySentinel = [];
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;
127
+ options = applyDefaults(object, options);
128
+ return typeHasher(options, stream).dispatch(object);
129
+ };
130
+ function typeHasher(options, writeTo, context) {
131
+ context = context || [];
132
+ var write = function(str) {
133
+ if (writeTo.update) {
134
+ return writeTo.update(str, "utf8");
135
+ } else {
136
+ return writeTo.write(str, "utf8");
137
+ }
138
+ };
139
+ return {
140
+ dispatch: function(value) {
141
+ if (options.replacer) {
142
+ value = options.replacer(value);
519
143
  }
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) {
550
- this._index = -1;
551
- this._keys = arraySentinel;
552
- this._values = arraySentinel;
553
- }
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;
144
+ var type = typeof value;
145
+ if (value === null) {
146
+ type = "null";
578
147
  }
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;
148
+ return this["_" + type](value);
149
+ },
150
+ _object: function(object) {
151
+ var pattern = /\[object (.*)\]/i;
152
+ var objString = Object.prototype.toString.call(object);
153
+ var objType = pattern.exec(objString);
154
+ if (!objType) {
155
+ objType = "unknown:[" + objString + "]";
156
+ } else {
157
+ objType = objType[1];
158
+ }
159
+ objType = objType.toLowerCase();
160
+ var objectNumber = null;
161
+ if ((objectNumber = context.indexOf(object)) >= 0) {
162
+ return this.dispatch("[CIRCULAR:" + objectNumber + "]");
163
+ } else {
164
+ context.push(object);
165
+ }
166
+ if (typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(object)) {
167
+ write("buffer:");
168
+ return write(object);
169
+ }
170
+ if (objType !== "object" && objType !== "function" && objType !== "asyncfunction") {
171
+ if (this["_" + objType]) {
172
+ this["_" + objType](object);
173
+ } else if (options.ignoreUnknown) {
174
+ return write("[" + objType + "]");
175
+ } else {
176
+ throw new Error('Unknown object type "' + objType + '"');
630
177
  }
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);
178
+ } else {
179
+ var keys = Object.keys(object);
180
+ if (options.unorderedObjects) {
181
+ keys = keys.sort();
657
182
  }
658
- if (this._cacheIndex < 0 && insert) {
659
- this._cacheIndex = this._keys.length;
660
- this._keys.push(key);
661
- this._values.push(void 0);
183
+ if (options.respectType !== false && !isNativeFunction(object)) {
184
+ keys.splice(0, 0, "prototype", "__proto__", "constructor");
662
185
  }
663
- return this._cacheIndex;
664
- };
665
- return Map1;
666
- }()
667
- );
668
- function getKey(key, _) {
669
- return key;
670
- }
671
- __name(getKey, "getKey");
672
- function getValue(_, value) {
673
- return value;
674
- }
675
- __name(getValue, "getValue");
676
- function getEntry(key, value) {
677
- return [
678
- key,
679
- value
680
- ];
681
- }
682
- __name(getEntry, "getEntry");
683
- }
684
- __name(CreateMapPolyfill, "CreateMapPolyfill");
685
- function CreateSetPolyfill() {
686
- return (
687
- /** @class */
688
- function() {
689
- function Set1() {
690
- this._map = new _Map();
186
+ if (options.excludeKeys) {
187
+ keys = keys.filter(function(key) {
188
+ return !options.excludeKeys(key);
189
+ });
190
+ }
191
+ write("object:" + keys.length + ":");
192
+ var self = this;
193
+ return keys.forEach(function(key) {
194
+ self.dispatch(key);
195
+ write(":");
196
+ if (!options.excludeValues) {
197
+ self.dispatch(object[key]);
198
+ }
199
+ write(",");
200
+ });
691
201
  }
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");
732
- function CreateWeakMapPolyfill() {
733
- var UUID_SIZE = 16;
734
- var keys = HashMap.create();
735
- var rootKey = CreateUniqueKey();
736
- return (
737
- /** @class */
738
- function() {
739
- function WeakMap1() {
740
- this._key = CreateUniqueKey();
202
+ },
203
+ _array: function(arr, unordered) {
204
+ unordered = typeof unordered !== "undefined" ? unordered : options.unorderedArrays !== false;
205
+ var self = this;
206
+ write("array:" + arr.length + ":");
207
+ if (!unordered || arr.length <= 1) {
208
+ return arr.forEach(function(entry) {
209
+ return self.dispatch(entry);
210
+ });
741
211
  }
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
- );
782
- function CreateUniqueKey() {
783
- var key;
784
- do
785
- key = "@@WeakMap@@" + CreateUUID();
786
- while (HashMap.has(keys, key));
787
- keys[key] = true;
788
- return key;
789
- }
790
- __name(CreateUniqueKey, "CreateUniqueKey");
791
- function GetOrCreateWeakMapTable(target, create) {
792
- if (!hasOwn.call(target, rootKey)) {
793
- if (!create) return void 0;
794
- Object.defineProperty(target, rootKey, {
795
- value: HashMap.create()
212
+ var contextAdditions = [];
213
+ var entries = arr.map(function(entry) {
214
+ var strm = new PassThrough();
215
+ var localContext = context.slice();
216
+ var hasher = typeHasher(options, strm, localContext);
217
+ hasher.dispatch(entry);
218
+ contextAdditions = contextAdditions.concat(localContext.slice(context.length));
219
+ return strm.read().toString();
796
220
  });
221
+ context = context.concat(contextAdditions);
222
+ entries.sort();
223
+ return this._array(entries, false);
224
+ },
225
+ _date: function(date) {
226
+ return write("date:" + date.toJSON());
227
+ },
228
+ _symbol: function(sym) {
229
+ return write("symbol:" + sym.toString());
230
+ },
231
+ _error: function(err) {
232
+ return write("error:" + err.toString());
233
+ },
234
+ _boolean: function(bool) {
235
+ return write("bool:" + bool.toString());
236
+ },
237
+ _string: function(string) {
238
+ write("string:" + string.length + ":");
239
+ write(string.toString());
240
+ },
241
+ _function: function(fn) {
242
+ write("fn:");
243
+ if (isNativeFunction(fn)) {
244
+ this.dispatch("[native]");
245
+ } else {
246
+ this.dispatch(fn.toString());
247
+ }
248
+ if (options.respectFunctionNames !== false) {
249
+ this.dispatch("function-name:" + String(fn.name));
250
+ }
251
+ if (options.respectFunctionProperties) {
252
+ this._object(fn);
253
+ }
254
+ },
255
+ _number: function(number) {
256
+ return write("number:" + number.toString());
257
+ },
258
+ _xml: function(xml) {
259
+ return write("xml:" + xml.toString());
260
+ },
261
+ _null: function() {
262
+ return write("Null");
263
+ },
264
+ _undefined: function() {
265
+ return write("Undefined");
266
+ },
267
+ _regexp: function(regex) {
268
+ return write("regex:" + regex.toString());
269
+ },
270
+ _uint8array: function(arr) {
271
+ write("uint8array:");
272
+ return this.dispatch(Array.prototype.slice.call(arr));
273
+ },
274
+ _uint8clampedarray: function(arr) {
275
+ write("uint8clampedarray:");
276
+ return this.dispatch(Array.prototype.slice.call(arr));
277
+ },
278
+ _int8array: function(arr) {
279
+ write("uint8array:");
280
+ return this.dispatch(Array.prototype.slice.call(arr));
281
+ },
282
+ _uint16array: function(arr) {
283
+ write("uint16array:");
284
+ return this.dispatch(Array.prototype.slice.call(arr));
285
+ },
286
+ _int16array: function(arr) {
287
+ write("uint16array:");
288
+ return this.dispatch(Array.prototype.slice.call(arr));
289
+ },
290
+ _uint32array: function(arr) {
291
+ write("uint32array:");
292
+ return this.dispatch(Array.prototype.slice.call(arr));
293
+ },
294
+ _int32array: function(arr) {
295
+ write("uint32array:");
296
+ return this.dispatch(Array.prototype.slice.call(arr));
297
+ },
298
+ _float32array: function(arr) {
299
+ write("float32array:");
300
+ return this.dispatch(Array.prototype.slice.call(arr));
301
+ },
302
+ _float64array: function(arr) {
303
+ write("float64array:");
304
+ return this.dispatch(Array.prototype.slice.call(arr));
305
+ },
306
+ _arraybuffer: function(arr) {
307
+ write("arraybuffer:");
308
+ return this.dispatch(new Uint8Array(arr));
309
+ },
310
+ _url: function(url) {
311
+ return write("url:" + url.toString(), "utf8");
312
+ },
313
+ _map: function(map) {
314
+ write("map:");
315
+ var arr = Array.from(map);
316
+ return this._array(arr, options.unorderedSets !== false);
317
+ },
318
+ _set: function(set) {
319
+ write("set:");
320
+ var arr = Array.from(set);
321
+ return this._array(arr, options.unorderedSets !== false);
322
+ },
323
+ _file: function(file) {
324
+ write("file:");
325
+ return this.dispatch([file.name, file.size, file.type, file.lastModfied]);
326
+ },
327
+ _blob: function() {
328
+ if (options.ignoreUnknown) {
329
+ return write("[blob]");
330
+ }
331
+ throw Error('Hashing Blob objects is currently not supported\n(see https://github.com/puleos/object-hash/issues/26)\nUse "options.replacer" or "options.ignoreUnknown"\n');
332
+ },
333
+ _domwindow: function() {
334
+ return write("domwindow");
335
+ },
336
+ _bigint: function(number) {
337
+ return write("bigint:" + number.toString());
338
+ },
339
+ /* Node.js standard native objects */
340
+ _process: function() {
341
+ return write("process");
342
+ },
343
+ _timer: function() {
344
+ return write("timer");
345
+ },
346
+ _pipe: function() {
347
+ return write("pipe");
348
+ },
349
+ _tcp: function() {
350
+ return write("tcp");
351
+ },
352
+ _udp: function() {
353
+ return write("udp");
354
+ },
355
+ _tty: function() {
356
+ return write("tty");
357
+ },
358
+ _statwatcher: function() {
359
+ return write("statwatcher");
360
+ },
361
+ _securecontext: function() {
362
+ return write("securecontext");
363
+ },
364
+ _connection: function() {
365
+ return write("connection");
366
+ },
367
+ _zlib: function() {
368
+ return write("zlib");
369
+ },
370
+ _context: function() {
371
+ return write("context");
372
+ },
373
+ _nodescript: function() {
374
+ return write("nodescript");
375
+ },
376
+ _httpparser: function() {
377
+ return write("httpparser");
378
+ },
379
+ _dataview: function() {
380
+ return write("dataview");
381
+ },
382
+ _signal: function() {
383
+ return write("signal");
384
+ },
385
+ _fsevent: function() {
386
+ return write("fsevent");
387
+ },
388
+ _tlswrap: function() {
389
+ return write("tlswrap");
797
390
  }
798
- return target[rootKey];
799
- }
800
- __name(GetOrCreateWeakMapTable, "GetOrCreateWeakMapTable");
801
- function FillRandomBytes(buffer, size) {
802
- for (var i = 0; i < size; ++i) buffer[i] = Math.random() * 255 | 0;
803
- return buffer;
804
- }
805
- __name(FillRandomBytes, "FillRandomBytes");
806
- function GenRandomBytes(size) {
807
- if (typeof Uint8Array === "function") {
808
- if (typeof crypto !== "undefined") return crypto.getRandomValues(new Uint8Array(size));
809
- if (typeof msCrypto !== "undefined") return msCrypto.getRandomValues(new Uint8Array(size));
810
- return FillRandomBytes(new Uint8Array(size), size);
811
- }
812
- return FillRandomBytes(new Array(size), size);
813
- }
814
- __name(GenRandomBytes, "GenRandomBytes");
815
- function CreateUUID() {
816
- var data = GenRandomBytes(UUID_SIZE);
817
- data[6] = data[6] & 79 | 64;
818
- data[8] = data[8] & 191 | 128;
819
- var result = "";
820
- for (var offset = 0; offset < UUID_SIZE; ++offset) {
821
- var byte = data[offset];
822
- if (offset === 4 || offset === 6 || offset === 8) result += "-";
823
- if (byte < 16) result += "0";
824
- result += byte.toString(16).toLowerCase();
825
- }
826
- return result;
827
- }
828
- __name(CreateUUID, "CreateUUID");
391
+ };
829
392
  }
830
- __name(CreateWeakMapPolyfill, "CreateWeakMapPolyfill");
831
- function MakeDictionary(obj) {
832
- obj.__ = void 0;
833
- delete obj.__;
834
- return obj;
393
+ function PassThrough() {
394
+ return {
395
+ buf: "",
396
+ write: function(b) {
397
+ this.buf += b;
398
+ },
399
+ end: function(b) {
400
+ this.buf += b;
401
+ },
402
+ read: function() {
403
+ return this.buf;
404
+ }
405
+ };
835
406
  }
836
- __name(MakeDictionary, "MakeDictionary");
837
- });
838
- })(Reflect2 || (Reflect2 = {}));
407
+ }
408
+ });
409
+
410
+ // src/index.ts
411
+ var index_exports = {};
412
+ __export(index_exports, {
413
+ Inject: () => Inject,
414
+ Service: () => Service,
415
+ getInstance: () => getInstance
416
+ });
417
+ module.exports = __toCommonJS(index_exports);
418
+
419
+ // ../helpers/dist/index.js
420
+ var import_object_hash = __toESM(require_object_hash(), 1);
421
+ var import_crypto = __toESM(require("crypto"), 1);
422
+ var UNMISTAKABLE_CHARS = "23456789ABCDEFGHJKLMNPQRSTWXYZabcdefghjkmnopqrstuvwxyz";
423
+ var hexString = function(digits) {
424
+ var numBytes = Math.ceil(digits / 2);
425
+ var bytes;
426
+ try {
427
+ bytes = import_crypto.default.randomBytes(numBytes);
428
+ } catch (e) {
429
+ bytes = import_crypto.default.pseudoRandomBytes(numBytes);
430
+ }
431
+ var result = bytes.toString("hex");
432
+ return result.substring(0, digits);
433
+ };
434
+ var fraction = function() {
435
+ var numerator = parseInt(hexString(8), 16);
436
+ return numerator * 23283064365386963e-26;
437
+ };
438
+ var choice = function(arrayOrString) {
439
+ var index = Math.floor(fraction() * arrayOrString.length);
440
+ if (typeof arrayOrString === "string") return arrayOrString.substr(index, 1);
441
+ else return arrayOrString[index];
442
+ };
443
+ var randomString = function(charsCount, alphabet) {
444
+ var digits = [];
445
+ for (var i = 0; i < charsCount; i++) {
446
+ digits[i] = choice(alphabet);
447
+ }
448
+ return digits.join("");
449
+ };
450
+ function generateId(charsCount, chars = UNMISTAKABLE_CHARS) {
451
+ if (!charsCount) {
452
+ charsCount = 17;
453
+ }
454
+ return randomString(charsCount, chars);
455
+ }
839
456
 
840
- // src/typedi.ts
841
- var import_typedi = require("typedi");
842
- var import_typedi2 = require("typedi");
843
- function getInstance(service) {
844
- return import_typedi.Container.get(service);
457
+ // src/di.ts
458
+ var instances = /* @__PURE__ */ new Map();
459
+ var serviceMetadata = /* @__PURE__ */ new WeakMap();
460
+ var injectionMetadata = /* @__PURE__ */ new WeakMap();
461
+ function Service() {
462
+ return (_target, context) => {
463
+ serviceMetadata.set(context, {
464
+ id: generateId(12),
465
+ name: context.name
466
+ });
467
+ };
468
+ }
469
+ function Inject(getDependency) {
470
+ return (_, context) => {
471
+ context.addInitializer(function() {
472
+ const metadata = injectionMetadata.get(this) || {};
473
+ metadata[context.name] = getDependency;
474
+ injectionMetadata.set(this, metadata);
475
+ });
476
+ };
477
+ }
478
+ function getInstance(token) {
479
+ if (!instances.has(token)) {
480
+ const instance = new token();
481
+ instances.set(token, instance);
482
+ const injections = injectionMetadata.get(instance);
483
+ if (injections) {
484
+ for (const [propertyKey, getDependency] of Object.entries(injections)) {
485
+ instance[propertyKey] = getInstance(getDependency());
486
+ }
487
+ }
488
+ }
489
+ return instances.get(token);
845
490
  }
846
- __name(getInstance, "getInstance");
847
491
  // Annotate the CommonJS export names for ESM import in node:
848
492
  0 && (module.exports = {
849
- Container,
850
493
  Inject,
851
494
  Service,
852
495
  getInstance
853
496
  });
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
497
  //# sourceMappingURL=index.cjs.map