@inversifyjs/core 3.3.0 → 3.5.0

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.
Files changed (82) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/lib/cjs/binding/models/Binding.d.ts +2 -1
  3. package/lib/cjs/binding/models/Binding.d.ts.map +1 -1
  4. package/lib/cjs/binding/models/BindingType.d.ts +1 -1
  5. package/lib/cjs/binding/models/BindingType.d.ts.map +1 -1
  6. package/lib/cjs/binding/models/BindingType.js +1 -0
  7. package/lib/cjs/binding/models/BindingType.js.map +1 -1
  8. package/lib/cjs/binding/models/ResolvedValueBinding.d.ts +9 -0
  9. package/lib/cjs/binding/models/ResolvedValueBinding.d.ts.map +1 -0
  10. package/lib/cjs/binding/models/ResolvedValueBinding.js +3 -0
  11. package/lib/cjs/binding/models/ResolvedValueBinding.js.map +1 -0
  12. package/lib/cjs/index.d.ts +8 -2
  13. package/lib/cjs/index.d.ts.map +1 -1
  14. package/lib/cjs/index.js +5 -1
  15. package/lib/cjs/index.js.map +1 -1
  16. package/lib/cjs/metadata/models/BaseResolvedValueElementMetadata.d.ts +4 -0
  17. package/lib/cjs/metadata/models/BaseResolvedValueElementMetadata.d.ts.map +1 -0
  18. package/lib/cjs/metadata/models/BaseResolvedValueElementMetadata.js +3 -0
  19. package/lib/cjs/metadata/models/BaseResolvedValueElementMetadata.js.map +1 -0
  20. package/lib/cjs/metadata/models/ResolvedValueElementMetadata.d.ts +12 -0
  21. package/lib/cjs/metadata/models/ResolvedValueElementMetadata.d.ts.map +1 -0
  22. package/lib/cjs/metadata/models/ResolvedValueElementMetadata.js +3 -0
  23. package/lib/cjs/metadata/models/ResolvedValueElementMetadata.js.map +1 -0
  24. package/lib/cjs/metadata/models/ResolvedValueElementMetadataKind.d.ts +5 -0
  25. package/lib/cjs/metadata/models/ResolvedValueElementMetadataKind.d.ts.map +1 -0
  26. package/lib/cjs/metadata/models/ResolvedValueElementMetadataKind.js +9 -0
  27. package/lib/cjs/metadata/models/ResolvedValueElementMetadataKind.js.map +1 -0
  28. package/lib/cjs/metadata/models/ResolvedValueMetadata.d.ts +5 -0
  29. package/lib/cjs/metadata/models/ResolvedValueMetadata.d.ts.map +1 -0
  30. package/lib/cjs/metadata/models/ResolvedValueMetadata.js +3 -0
  31. package/lib/cjs/metadata/models/ResolvedValueMetadata.js.map +1 -0
  32. package/lib/cjs/planning/calculations/isInstanceBindingNode.d.ts +4 -0
  33. package/lib/cjs/planning/calculations/isInstanceBindingNode.d.ts.map +1 -0
  34. package/lib/cjs/planning/calculations/isInstanceBindingNode.js +8 -0
  35. package/lib/cjs/planning/calculations/isInstanceBindingNode.js.map +1 -0
  36. package/lib/cjs/planning/calculations/isInstanceBindingNode.spec.d.ts +2 -0
  37. package/lib/cjs/planning/calculations/isInstanceBindingNode.spec.d.ts.map +1 -0
  38. package/lib/cjs/planning/calculations/plan.d.ts.map +1 -1
  39. package/lib/cjs/planning/calculations/plan.js +65 -3
  40. package/lib/cjs/planning/calculations/plan.js.map +1 -1
  41. package/lib/cjs/planning/models/PlanServiceNodeParent.d.ts +3 -1
  42. package/lib/cjs/planning/models/PlanServiceNodeParent.d.ts.map +1 -1
  43. package/lib/cjs/planning/models/ResolvedValueBindingNode.d.ts +7 -0
  44. package/lib/cjs/planning/models/ResolvedValueBindingNode.d.ts.map +1 -0
  45. package/lib/cjs/planning/models/ResolvedValueBindingNode.js +3 -0
  46. package/lib/cjs/planning/models/ResolvedValueBindingNode.js.map +1 -0
  47. package/lib/cjs/planning/services/PlanResultCacheService.d.ts +35 -0
  48. package/lib/cjs/planning/services/PlanResultCacheService.d.ts.map +1 -0
  49. package/lib/cjs/planning/services/PlanResultCacheService.js +138 -0
  50. package/lib/cjs/planning/services/PlanResultCacheService.js.map +1 -0
  51. package/lib/cjs/planning/services/PlanResultCacheService.spec.d.ts +2 -0
  52. package/lib/cjs/planning/services/PlanResultCacheService.spec.d.ts.map +1 -0
  53. package/lib/cjs/resolution/actions/resolve.d.ts.map +1 -1
  54. package/lib/cjs/resolution/actions/resolve.js +9 -0
  55. package/lib/cjs/resolution/actions/resolve.js.map +1 -1
  56. package/lib/cjs/resolution/actions/resolveResolvedValueBindingNode.d.ts +6 -0
  57. package/lib/cjs/resolution/actions/resolveResolvedValueBindingNode.d.ts.map +1 -0
  58. package/lib/cjs/resolution/actions/resolveResolvedValueBindingNode.js +14 -0
  59. package/lib/cjs/resolution/actions/resolveResolvedValueBindingNode.js.map +1 -0
  60. package/lib/cjs/resolution/actions/resolveResolvedValueBindingNode.spec.d.ts +2 -0
  61. package/lib/cjs/resolution/actions/resolveResolvedValueBindingNode.spec.d.ts.map +1 -0
  62. package/lib/cjs/resolution/actions/resolveResolvedValueBindingParams.d.ts +6 -0
  63. package/lib/cjs/resolution/actions/resolveResolvedValueBindingParams.d.ts.map +1 -0
  64. package/lib/cjs/resolution/actions/resolveResolvedValueBindingParams.js +16 -0
  65. package/lib/cjs/resolution/actions/resolveResolvedValueBindingParams.js.map +1 -0
  66. package/lib/cjs/resolution/actions/resolveResolvedValueBindingParams.spec.d.ts +2 -0
  67. package/lib/cjs/resolution/actions/resolveResolvedValueBindingParams.spec.d.ts.map +1 -0
  68. package/lib/cjs/resolution/actions/resolveScopedResolvedValueBindingNode.d.ts +6 -0
  69. package/lib/cjs/resolution/actions/resolveScopedResolvedValueBindingNode.d.ts.map +1 -0
  70. package/lib/cjs/resolution/actions/resolveScopedResolvedValueBindingNode.js +8 -0
  71. package/lib/cjs/resolution/actions/resolveScopedResolvedValueBindingNode.js.map +1 -0
  72. package/lib/cjs/resolution/calculations/getResolvedValueNodeBinding.d.ts +4 -0
  73. package/lib/cjs/resolution/calculations/getResolvedValueNodeBinding.d.ts.map +1 -0
  74. package/lib/cjs/resolution/calculations/getResolvedValueNodeBinding.js +7 -0
  75. package/lib/cjs/resolution/calculations/getResolvedValueNodeBinding.js.map +1 -0
  76. package/lib/cjs/resolution/calculations/getResolvedValueNodeBinding.spec.d.ts +2 -0
  77. package/lib/cjs/resolution/calculations/getResolvedValueNodeBinding.spec.d.ts.map +1 -0
  78. package/lib/esm/index.d.ts +63 -4
  79. package/lib/esm/index.d.ts.map +1 -1
  80. package/lib/esm/index.js +1 -1
  81. package/lib/esm/index.js.map +1 -1
  82. package/package.json +5 -5
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PlanResultCacheService = void 0;
4
+ var GetPlanBooleanOptionsMask;
5
+ (function (GetPlanBooleanOptionsMask) {
6
+ GetPlanBooleanOptionsMask[GetPlanBooleanOptionsMask["singleMandatory"] = 0] = "singleMandatory";
7
+ GetPlanBooleanOptionsMask[GetPlanBooleanOptionsMask["singleOptional"] = 1] = "singleOptional";
8
+ GetPlanBooleanOptionsMask[GetPlanBooleanOptionsMask["multipleMandatory"] = 2] = "multipleMandatory";
9
+ GetPlanBooleanOptionsMask[GetPlanBooleanOptionsMask["multipleOptional"] = 3] = "multipleOptional";
10
+ // Must be the last one
11
+ GetPlanBooleanOptionsMask[GetPlanBooleanOptionsMask["length"] = 4] = "length";
12
+ })(GetPlanBooleanOptionsMask || (GetPlanBooleanOptionsMask = {}));
13
+ /**
14
+ * Service to cache plans.
15
+ *
16
+ * This class is used to cache plans and to notify PlanService subscribers when the cache is cleared.
17
+ * The cache should be cleared when a new binding is registered or when a binding is unregistered.
18
+ *
19
+ * Subscribers are supposed to be plan services from child containers.
20
+ *
21
+ * Ancestor binding constraints are the reason to avoid reusing plans from plan children nodes.
22
+ */
23
+ class PlanResultCacheService {
24
+ #serviceIdToValuePlanMap;
25
+ #namedServiceIdToValuePlanMap;
26
+ #taggedServiceIdToValuePlanMap;
27
+ #namedTaggedServiceIdToValuePlanMap;
28
+ #subscribers;
29
+ constructor() {
30
+ this.#serviceIdToValuePlanMap = this.#buildInitializedMapArray();
31
+ this.#namedServiceIdToValuePlanMap = this.#buildInitializedMapArray();
32
+ this.#namedTaggedServiceIdToValuePlanMap = this.#buildInitializedMapArray();
33
+ this.#taggedServiceIdToValuePlanMap = this.#buildInitializedMapArray();
34
+ this.#subscribers = [];
35
+ }
36
+ clearCache() {
37
+ for (const map of this.#getMaps()) {
38
+ map.clear();
39
+ }
40
+ for (const subscriber of this.#subscribers) {
41
+ subscriber.clearCache();
42
+ }
43
+ }
44
+ get(options) {
45
+ if (options.name === undefined) {
46
+ if (options.tag === undefined) {
47
+ return this.#getMapFromMapArray(this.#serviceIdToValuePlanMap, options).get(options.serviceIdentifier);
48
+ }
49
+ else {
50
+ return this.#getMapFromMapArray(this.#taggedServiceIdToValuePlanMap, options)
51
+ .get(options.serviceIdentifier)
52
+ ?.get(options.tag.key)
53
+ ?.get(options.tag.value);
54
+ }
55
+ }
56
+ else {
57
+ if (options.tag === undefined) {
58
+ return this.#getMapFromMapArray(this.#namedServiceIdToValuePlanMap, options)
59
+ .get(options.serviceIdentifier)
60
+ ?.get(options.name);
61
+ }
62
+ else {
63
+ return this.#getMapFromMapArray(this.#namedTaggedServiceIdToValuePlanMap, options)
64
+ .get(options.serviceIdentifier)
65
+ ?.get(options.name)
66
+ ?.get(options.tag.key)
67
+ ?.get(options.tag.value);
68
+ }
69
+ }
70
+ }
71
+ set(options, planResult) {
72
+ if (options.name === undefined) {
73
+ if (options.tag === undefined) {
74
+ this.#getMapFromMapArray(this.#serviceIdToValuePlanMap, options).set(options.serviceIdentifier, planResult);
75
+ }
76
+ else {
77
+ this.#getOrBuildMapValueFromMapMap(this.#getOrBuildMapValueFromMapMap(this.#getMapFromMapArray(this.#taggedServiceIdToValuePlanMap, options), options.serviceIdentifier), options.tag.key).set(options.tag.value, planResult);
78
+ }
79
+ }
80
+ else {
81
+ if (options.tag === undefined) {
82
+ this.#getOrBuildMapValueFromMapMap(this.#getMapFromMapArray(this.#namedServiceIdToValuePlanMap, options), options.serviceIdentifier).set(options.name, planResult);
83
+ }
84
+ else {
85
+ this.#getOrBuildMapValueFromMapMap(this.#getOrBuildMapValueFromMapMap(this.#getOrBuildMapValueFromMapMap(this.#getMapFromMapArray(this.#namedTaggedServiceIdToValuePlanMap, options), options.serviceIdentifier), options.name), options.tag.key).set(options.tag.value, planResult);
86
+ }
87
+ }
88
+ }
89
+ subscribe(subscriber) {
90
+ this.#subscribers.push(subscriber);
91
+ }
92
+ #buildInitializedMapArray() {
93
+ const mapArray = new Array(GetPlanBooleanOptionsMask.length);
94
+ for (let i = 0; i < mapArray.length; ++i) {
95
+ mapArray[i] = new Map();
96
+ }
97
+ return mapArray;
98
+ }
99
+ #getOrBuildMapValueFromMapMap(map, key) {
100
+ let valueMap = map.get(key);
101
+ if (valueMap === undefined) {
102
+ valueMap = new Map();
103
+ map.set(key, valueMap);
104
+ }
105
+ return valueMap;
106
+ }
107
+ #getMapFromMapArray(mapArray, options) {
108
+ return mapArray[this.#getMapArrayIndex(options)];
109
+ }
110
+ #getMaps() {
111
+ return [
112
+ ...this.#serviceIdToValuePlanMap,
113
+ ...this.#namedServiceIdToValuePlanMap,
114
+ ...this.#namedTaggedServiceIdToValuePlanMap,
115
+ ...this.#taggedServiceIdToValuePlanMap,
116
+ ];
117
+ }
118
+ #getMapArrayIndex(options) {
119
+ if (options.isMultiple) {
120
+ if (options.optional === true) {
121
+ return GetPlanBooleanOptionsMask.multipleOptional;
122
+ }
123
+ else {
124
+ return GetPlanBooleanOptionsMask.multipleMandatory;
125
+ }
126
+ }
127
+ else {
128
+ if (options.optional === true) {
129
+ return GetPlanBooleanOptionsMask.singleOptional;
130
+ }
131
+ else {
132
+ return GetPlanBooleanOptionsMask.singleMandatory;
133
+ }
134
+ }
135
+ }
136
+ }
137
+ exports.PlanResultCacheService = PlanResultCacheService;
138
+ //# sourceMappingURL=PlanResultCacheService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlanResultCacheService.js","sourceRoot":"","sources":["../../../../src/planning/services/PlanResultCacheService.ts"],"names":[],"mappings":";;;AAMA,IAAK,yBAOJ;AAPD,WAAK,yBAAyB;IAC5B,+FAAmB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AC3B,GAAsB,EACtB,GAAS;QAET,IAAI,QAAQ,GAAuB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAEhD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,QAAQ,GAAG,IAAI,GAAG,EAAY,CAAC;YAC/B,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACzB,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,mBAAmB,CACjB,QAA6B,EAC7B,OAAuB;QAEvB,OAAO,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAsB,CAAC;IACxE,CAAC;IAED,QAAQ;QACN,OAAO;YACL,GAAG,IAAI,CAAC,wBAAwB;YAChC,GAAG,IAAI,CAAC,6BAA6B;YACrC,GAAG,IAAI,CAAC,mCAAmC;YAC3C,GAAG,IAAI,CAAC,8BAA8B;SACvC,CAAC;IACJ,CAAC;IAED,iBAAiB,CAAC,OAAuB;QACvC,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;YACvB,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;gBAC9B,OAAO,yBAAyB,CAAC,gBAAgB,CAAC;YACpD,CAAC;iBAAM,CAAC;gBACN,OAAO,yBAAyB,CAAC,iBAAiB,CAAC;YACrD,CAAC;QACH,CAAC;aAAM,CAAC;YACN,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;gBAC9B,OAAO,yBAAyB,CAAC,cAAc,CAAC;YAClD,CAAC;iBAAM,CAAC;gBACN,OAAO,yBAAyB,CAAC,eAAe,CAAC;YACnD,CAAC;QACH,CAAC;IACH,CAAC;CACF;AApLD,wDAoLC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=PlanResultCacheService.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlanResultCacheService.spec.d.ts","sourceRoot":"","sources":["../../../../src/planning/services/PlanResultCacheService.spec.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../../src/resolution/actions/resolve.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAgD9D,wBAAgB,OAAO,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAIzD"}
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../../src/resolution/actions/resolve.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAuE9D,wBAAgB,OAAO,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAIzD"}
@@ -14,7 +14,10 @@ const resolveInstanceBindingNode_1 = require("./resolveInstanceBindingNode");
14
14
  const resolveInstanceBindingNodeAsyncFromConstructorParams_1 = require("./resolveInstanceBindingNodeAsyncFromConstructorParams");
15
15
  const resolveInstanceBindingNodeFromConstructorParams_1 = require("./resolveInstanceBindingNodeFromConstructorParams");
16
16
  const resolveProviderBinding_1 = require("./resolveProviderBinding");
17
+ const resolveResolvedValueBindingNode_1 = require("./resolveResolvedValueBindingNode");
18
+ const resolveResolvedValueBindingParams_1 = require("./resolveResolvedValueBindingParams");
17
19
  const resolveScopedInstanceBindingNode_1 = require("./resolveScopedInstanceBindingNode");
20
+ const resolveScopedResolvedValueBindingNode_1 = require("./resolveScopedResolvedValueBindingNode");
18
21
  const resolveServiceRedirectionBindingNode_1 = require("./resolveServiceRedirectionBindingNode");
19
22
  const setInstanceProperties_1 = require("./setInstanceProperties");
20
23
  const setInstanceProperties = (0, setInstanceProperties_1.setInstanceProperties)(resolveServiceNode);
@@ -22,7 +25,11 @@ const resolveServiceRedirectionBindingNode = (0, resolveServiceRedirectionBindin
22
25
  const resolveInstanceBindingNode = (0, resolveInstanceBindingNode_1.resolveInstanceBindingNode)(
23
26
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
27
  (0, resolveInstanceBindingConstructorParams_1.resolveInstanceBindingConstructorParams)(resolveServiceNode), (0, resolveInstanceBindingNodeAsyncFromConstructorParams_1.resolveInstanceBindingNodeAsyncFromConstructorParams)((0, resolveInstanceBindingNodeFromConstructorParams_1.resolveInstanceBindingNodeFromConstructorParams)(setInstanceProperties)), (0, resolveInstanceBindingNodeFromConstructorParams_1.resolveInstanceBindingNodeFromConstructorParams)(setInstanceProperties));
28
+ const resolveResolvedValueBindingNode = (0, resolveResolvedValueBindingNode_1.resolveResolvedValueBindingNode)(
29
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
+ (0, resolveResolvedValueBindingParams_1.resolveResolvedValueBindingParams)(resolveServiceNode));
25
31
  const resolveScopedInstanceBindingNode = (0, resolveScopedInstanceBindingNode_1.resolveScopedInstanceBindingNode)(resolveInstanceBindingNode);
32
+ const resolveScopedResolvedValueBindingNode = (0, resolveScopedResolvedValueBindingNode_1.resolveScopedResolvedValueBindingNode)(resolveResolvedValueBindingNode);
26
33
  function resolve(params) {
27
34
  const serviceNode = params.planResult.tree.root;
28
35
  return resolveServiceNode(params, serviceNode);
@@ -39,6 +46,8 @@ function resolveBindingNode(params, planBindingNode) {
39
46
  return resolveScopedInstanceBindingNode(params, planBindingNode);
40
47
  case BindingType_1.bindingTypeValues.Provider:
41
48
  return (0, resolveProviderBinding_1.resolveProviderBinding)(params, planBindingNode.binding);
49
+ case BindingType_1.bindingTypeValues.ResolvedValue:
50
+ return resolveScopedResolvedValueBindingNode(params, planBindingNode);
42
51
  }
43
52
  }
44
53
  function resolveServiceNode(params, serviceNode) {
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../../../src/resolution/actions/resolve.ts"],"names":[],"mappings":";;AA6DA,0BAIC;AAjED,gDAAgD;AAEhD,kEAAqE;AAErE,8EAA2E;AAC3E,sFAAmF;AACnF,yHAAsH;AAStH,+EAA4E;AAC5E,6EAA0E;AAC1E,mE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import { ResolvedValueBinding } from '../../binding/models/ResolvedValueBinding';
2
+ import { ResolvedValueBindingNode } from '../../planning/models/ResolvedValueBindingNode';
3
+ import { ResolutionParams } from '../models/ResolutionParams';
4
+ import { Resolved } from '../models/Resolved';
5
+ export declare function resolveResolvedValueBindingNode<TActivated, TBinding extends ResolvedValueBinding<TActivated> = ResolvedValueBinding<TActivated>>(resolveResolvedValueBindingParams: (params: ResolutionParams, node: ResolvedValueBindingNode<TBinding>) => unknown[] | Promise<unknown[]>): (params: ResolutionParams, node: ResolvedValueBindingNode<TBinding>) => Resolved<TActivated>;
6
+ //# sourceMappingURL=resolveResolvedValueBindingNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveResolvedValueBindingNode.d.ts","sourceRoot":"","sources":["../../../../src/resolution/actions/resolveResolvedValueBindingNode.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAC1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,wBAAgB,+BAA+B,CAC7C,UAAU,EACV,QAAQ,SACN,oBAAoB,CAAC,UAAU,CAAC,GAAG,oBAAoB,CAAC,UAAU,CAAC,EAErE,iCAAiC,EAAE,CACjC,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,wBAAwB,CAAC,QAAQ,CAAC,KACrC,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,GAClC,CACD,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,wBAAwB,CAAC,QAAQ,CAAC,KACrC,QAAQ,CAAC,UAAU,CAAC,CAiBxB"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveResolvedValueBindingNode = resolveResolvedValueBindingNode;
4
+ const common_1 = require("@inversifyjs/common");
5
+ function resolveResolvedValueBindingNode(resolveResolvedValueBindingParams) {
6
+ return (params, node) => {
7
+ const paramValues = resolveResolvedValueBindingParams(params, node);
8
+ if ((0, common_1.isPromise)(paramValues)) {
9
+ return paramValues.then((resolvedParamValues) => node.binding.factory(...resolvedParamValues));
10
+ }
11
+ return node.binding.factory(...paramValues);
12
+ };
13
+ }
14
+ //# sourceMappingURL=resolveResolvedValueBindingNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveResolvedValueBindingNode.js","sourceRoot":"","sources":["../../../../src/resolution/actions/resolveResolvedValueBindingNode.ts"],"names":[],"mappings":";;AAOA,0EA6BC;AApCD,gDAAgD;AAOhD,SAAgB,+BAA+B,CAK7C,iCAGmC;IAKnC,OAAO,CACL,MAAwB,EACxB,IAAwC,EAClB,EAAE;QACxB,MAAM,WAAW,GACf,iCAAiC,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAElD,IAAI,IAAA,kBAAS,EAAC,WAAW,CAAC,EAAE,CAAC;YAC3B,OAAO,WAAW,CAAC,IAAI,CACrB,CAAC,mBAA8B,EAAoC,EAAE,CACnE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,mBAAmB,CAAC,CAC/C,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,WAAW,CAAC,CAAC;IAC9C,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=resolveResolvedValueBindingNode.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveResolvedValueBindingNode.spec.d.ts","sourceRoot":"","sources":["../../../../src/resolution/actions/resolveResolvedValueBindingNode.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { ResolvedValueBinding } from '../../binding/models/ResolvedValueBinding';
2
+ import { PlanServiceNode } from '../../planning/models/PlanServiceNode';
3
+ import { ResolvedValueBindingNode } from '../../planning/models/ResolvedValueBindingNode';
4
+ import { ResolutionParams } from '../models/ResolutionParams';
5
+ export declare function resolveResolvedValueBindingParams<TActivated, TBinding extends ResolvedValueBinding<TActivated> = ResolvedValueBinding<TActivated>>(resolveServiceNode: (params: ResolutionParams, serviceNode: PlanServiceNode) => unknown): (params: ResolutionParams, node: ResolvedValueBindingNode<TBinding>) => unknown[] | Promise<unknown[]>;
6
+ //# sourceMappingURL=resolveResolvedValueBindingParams.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveResolvedValueBindingParams.d.ts","sourceRoot":"","sources":["../../../../src/resolution/actions/resolveResolvedValueBindingParams.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAC1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,wBAAgB,iCAAiC,CAC/C,UAAU,EACV,QAAQ,SACN,oBAAoB,CAAC,UAAU,CAAC,GAAG,oBAAoB,CAAC,UAAU,CAAC,EAErE,kBAAkB,EAAE,CAClB,MAAM,EAAE,gBAAgB,EACxB,WAAW,EAAE,eAAe,KACzB,OAAO,GACX,CACD,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,wBAAwB,CAAC,QAAQ,CAAC,KACrC,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAelC"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveResolvedValueBindingParams = resolveResolvedValueBindingParams;
4
+ const common_1 = require("@inversifyjs/common");
5
+ function resolveResolvedValueBindingParams(resolveServiceNode) {
6
+ return (params, node) => {
7
+ const paramsResolvedValues = [];
8
+ for (const param of node.params) {
9
+ paramsResolvedValues.push(resolveServiceNode(params, param));
10
+ }
11
+ return paramsResolvedValues.some(common_1.isPromise)
12
+ ? Promise.all(paramsResolvedValues)
13
+ : paramsResolvedValues;
14
+ };
15
+ }
16
+ //# sourceMappingURL=resolveResolvedValueBindingParams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveResolvedValueBindingParams.js","sourceRoot":"","sources":["../../../../src/resolution/actions/resolveResolvedValueBindingParams.ts"],"names":[],"mappings":";;AAOA,8EA2BC;AAlCD,gDAAgD;AAOhD,SAAgB,iCAAiC,CAK/C,kBAGY;IAKZ,OAAO,CACL,MAAwB,EACxB,IAAwC,EACR,EAAE;QAClC,MAAM,oBAAoB,GAAc,EAAE,CAAC;QAE3C,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChC,oBAAoB,CAAC,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;QAC/D,CAAC;QAED,OAAO,oBAAoB,CAAC,IAAI,CAAC,kBAAS,CAAC;YACzC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;YACnC,CAAC,CAAC,oBAAoB,CAAC;IAC3B,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=resolveResolvedValueBindingParams.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveResolvedValueBindingParams.spec.d.ts","sourceRoot":"","sources":["../../../../src/resolution/actions/resolveResolvedValueBindingParams.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { ResolvedValueBinding } from '../../binding/models/ResolvedValueBinding';
2
+ import { ResolvedValueBindingNode } from '../../planning/models/ResolvedValueBindingNode';
3
+ import { ResolutionParams } from '../models/ResolutionParams';
4
+ import { Resolved } from '../models/Resolved';
5
+ export declare const resolveScopedResolvedValueBindingNode: <TActivated>(resolve: (params: ResolutionParams, node: ResolvedValueBindingNode<ResolvedValueBinding<TActivated>>) => Resolved<TActivated>) => (params: ResolutionParams, node: ResolvedValueBindingNode<ResolvedValueBinding<TActivated>>) => Resolved<TActivated>;
6
+ //# sourceMappingURL=resolveScopedResolvedValueBindingNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveScopedResolvedValueBindingNode.d.ts","sourceRoot":"","sources":["../../../../src/resolution/actions/resolveScopedResolvedValueBindingNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAE1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9C,eAAO,MAAM,qCAAqC,EAAE,CAAC,UAAU,EAC7D,OAAO,EAAE,CACP,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,wBAAwB,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC,KAC7D,QAAQ,CAAC,UAAU,CAAC,KACtB,CACH,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,wBAAwB,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC,KAC7D,QAAQ,CAAC,UAAU,CAKgC,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveScopedResolvedValueBindingNode = void 0;
4
+ const getResolvedValueNodeBinding_1 = require("../calculations/getResolvedValueNodeBinding");
5
+ const resolveScoped_1 = require("./resolveScoped");
6
+ const resolveScopedResolvedValueBindingNode = (resolve) => (0, resolveScoped_1.resolveScoped)(getResolvedValueNodeBinding_1.getResolvedValueNodeBinding, resolve);
7
+ exports.resolveScopedResolvedValueBindingNode = resolveScopedResolvedValueBindingNode;
8
+ //# sourceMappingURL=resolveScopedResolvedValueBindingNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveScopedResolvedValueBindingNode.js","sourceRoot":"","sources":["../../../../src/resolution/actions/resolveScopedResolvedValueBindingNode.ts"],"names":[],"mappings":";;;AAEA,6FAA0F;AAG1F,mDAAgD;AAEzC,MAAM,qCAAqC,GAQtB,CAC1B,OAGyB,EACzB,EAAE,CAAC,IAAA,6BAAa,EAAC,yDAA2B,EAAE,OAAO,CAAC,CAAC;AAb5C,QAAA,qCAAqC,yCAaO"}
@@ -0,0 +1,4 @@
1
+ import { ResolvedValueBinding } from '../../binding/models/ResolvedValueBinding';
2
+ import { ResolvedValueBindingNode } from '../../planning/models/ResolvedValueBindingNode';
3
+ export declare function getResolvedValueNodeBinding<TActivated>(node: ResolvedValueBindingNode<ResolvedValueBinding<TActivated>>): ResolvedValueBinding<TActivated>;
4
+ //# sourceMappingURL=getResolvedValueNodeBinding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getResolvedValueNodeBinding.d.ts","sourceRoot":"","sources":["../../../../src/resolution/calculations/getResolvedValueNodeBinding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAE1F,wBAAgB,2BAA2B,CAAC,UAAU,EACpD,IAAI,EAAE,wBAAwB,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC,GAC/D,oBAAoB,CAAC,UAAU,CAAC,CAElC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getResolvedValueNodeBinding = getResolvedValueNodeBinding;
4
+ function getResolvedValueNodeBinding(node) {
5
+ return node.binding;
6
+ }
7
+ //# sourceMappingURL=getResolvedValueNodeBinding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getResolvedValueNodeBinding.js","sourceRoot":"","sources":["../../../../src/resolution/calculations/getResolvedValueNodeBinding.ts"],"names":[],"mappings":";;AAGA,kEAIC;AAJD,SAAgB,2BAA2B,CACzC,IAAgE;IAEhE,OAAO,IAAI,CAAC,OAAO,CAAC;AACtB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=getResolvedValueNodeBinding.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getResolvedValueNodeBinding.spec.d.ts","sourceRoot":"","sources":["../../../../src/resolution/calculations/getResolvedValueNodeBinding.spec.ts"],"names":[],"mappings":""}
@@ -11,7 +11,7 @@ interface BindingMetadata {
11
11
  getAncestor(): BindingMetadata | undefined;
12
12
  }
13
13
 
14
- type BindingType = 'ConstantValue' | 'DynamicValue' | 'Factory' | 'Instance' | 'Provider' | 'ServiceRedirection';
14
+ type BindingType = 'ConstantValue' | 'DynamicValue' | 'Factory' | 'Instance' | 'Provider' | 'ResolvedValue' | 'ServiceRedirection';
15
15
  declare const bindingTypeValues: {
16
16
  [TKey in BindingType]: TKey;
17
17
  };
@@ -94,11 +94,36 @@ interface ProviderBinding<TActivated extends Provider<unknown>> extends ScopedBi
94
94
  readonly provider: (context: ResolutionContext) => TActivated;
95
95
  }
96
96
 
97
+ interface BaseResolvedValueElementMetadata<TKind> {
98
+ kind: TKind;
99
+ }
100
+
101
+ declare enum ResolvedValueElementMetadataKind {
102
+ multipleInjection = 0,
103
+ singleInjection = 1
104
+ }
105
+
106
+ interface ResolvedValueElementMetadata extends BaseResolvedValueElementMetadata<ResolvedValueElementMetadataKind> {
107
+ name: MetadataName | undefined;
108
+ optional: boolean;
109
+ tags: Map<MetadataTag, unknown>;
110
+ value: ServiceIdentifier | LazyServiceIdentifier;
111
+ }
112
+
113
+ interface ResolvedValueMetadata {
114
+ arguments: ResolvedValueElementMetadata[];
115
+ }
116
+
117
+ interface ResolvedValueBinding<TActivated> extends ScopedBinding<typeof bindingTypeValues.ResolvedValue, BindingScope, TActivated> {
118
+ readonly factory: (...args: any[]) => TActivated | Promise<TActivated>;
119
+ readonly metadata: ResolvedValueMetadata;
120
+ }
121
+
97
122
  interface ServiceRedirectionBinding<TActivated> extends BaseBinding<typeof bindingTypeValues.ServiceRedirection, TActivated> {
98
123
  targetServiceIdentifier: ServiceIdentifier;
99
124
  }
100
125
 
101
- type Binding<TActivated = any> = ConstantValueBinding<TActivated> | DynamicValueBinding<TActivated> | (TActivated extends Factory<unknown> ? FactoryBinding<TActivated> : never) | InstanceBinding<TActivated> | (TActivated extends Provider<unknown> ? ProviderBinding<TActivated> : never) | ServiceRedirectionBinding<TActivated>;
126
+ type Binding<TActivated = any> = ConstantValueBinding<TActivated> | DynamicValueBinding<TActivated> | (TActivated extends Factory<unknown> ? FactoryBinding<TActivated> : never) | InstanceBinding<TActivated> | (TActivated extends Provider<unknown> ? ProviderBinding<TActivated> : never) | ResolvedValueBinding<TActivated> | ServiceRedirectionBinding<TActivated>;
102
127
 
103
128
  interface Cloneable<T> {
104
129
  clone(): T;
@@ -269,7 +294,11 @@ interface InstanceBindingNode<TBinding extends InstanceBinding<any> = InstanceBi
269
294
  readonly propertyParams: Map<string | symbol, PlanServiceNode>;
270
295
  }
271
296
 
272
- type PlanServiceNodeParent<TActivated = any> = InstanceBindingNode<InstanceBinding<TActivated>>;
297
+ interface ResolvedValueBindingNode<TBinding extends ResolvedValueBinding<any> = ResolvedValueBinding<any>> extends BaseBindingNode<TBinding> {
298
+ readonly params: PlanServiceNode[];
299
+ }
300
+
301
+ type PlanServiceNodeParent<TActivated = any> = InstanceBindingNode<InstanceBinding<TActivated>> | ResolvedValueBindingNode<ResolvedValueBinding<TActivated>>;
273
302
 
274
303
  type PlanBindingNode = PlanServiceNodeParent | PlanServiceRedirectionBindingNode | LeafBindingNode;
275
304
 
@@ -289,6 +318,36 @@ interface PlanResult {
289
318
 
290
319
  declare function plan(params: PlanParams): PlanResult;
291
320
 
321
+ interface GetPlanOptionsTagConstraint {
322
+ key: MetadataTag;
323
+ value: unknown;
324
+ }
325
+ interface GetPlanOptions {
326
+ serviceIdentifier: ServiceIdentifier;
327
+ isMultiple: boolean;
328
+ name: MetadataName | undefined;
329
+ optional: boolean | undefined;
330
+ tag: GetPlanOptionsTagConstraint | undefined;
331
+ }
332
+ /**
333
+ * Service to cache plans.
334
+ *
335
+ * This class is used to cache plans and to notify PlanService subscribers when the cache is cleared.
336
+ * The cache should be cleared when a new binding is registered or when a binding is unregistered.
337
+ *
338
+ * Subscribers are supposed to be plan services from child containers.
339
+ *
340
+ * Ancestor binding constraints are the reason to avoid reusing plans from plan children nodes.
341
+ */
342
+ declare class PlanResultCacheService {
343
+ #private;
344
+ constructor();
345
+ clearCache(): void;
346
+ get(options: GetPlanOptions): PlanResult | undefined;
347
+ set(options: GetPlanOptions, planResult: PlanResult): void;
348
+ subscribe(subscriber: PlanResultCacheService): void;
349
+ }
350
+
292
351
  interface ResolutionParams {
293
352
  context: ResolutionContext;
294
353
  getActivations: <TActivated>(serviceIdentifier: ServiceIdentifier<TActivated>) => Iterable<BindingActivation<TActivated>> | undefined;
@@ -309,4 +368,4 @@ declare function resolveModuleDeactivations(params: DeactivationParams, moduleId
309
368
 
310
369
  declare function resolveServiceDeactivations(params: DeactivationParams, serviceIdentifier: ServiceIdentifier): void | Promise<void>;
311
370
 
312
- export { ActivationsService, type BaseBinding, type BaseBindingNode, type BasePlanParams, type Binding, type BindingActivation, type BindingActivationRelation, type BindingDeactivation, type BindingDeactivationRelation, type BindingMetadata, type BindingScope, BindingService, type BindingType, type ClassElementMetadata, ClassElementMetadataKind, type ClassMetadata, type ClassMetadataLifecycle, type ConstantValueBinding, type DeactivationParams, DeactivationsService, type DynamicValueBinding, type DynamicValueBuilder, type Factory, type FactoryBinding, type GetOptions, type GetOptionsTagConstraint, type InstanceBinding, type LeafBindingNode, type ManagedClassElementMetadata, type MetadataName, type MetadataTag, type OptionalGetOptions, type PlanBindingNode, type PlanParams, type PlanParamsConstraint, type PlanParamsTagConstraint, type PlanResult, type PlanServiceNode, type PlanServiceNodeParent, type PlanServiceRedirectionBindingNode, type PlanTree, type Provider, type ProviderBinding, type ResolutionContext, type ResolutionParams, type Resolved, type ScopedBinding, type ServiceRedirectionBinding, type UnmanagedClassElementMetadata, bindingScopeValues, bindingTypeValues, decorate, getClassMetadata, inject, injectFromBase, injectable, multiInject, named, optional, plan, postConstruct, preDestroy, resolve, resolveModuleDeactivations, resolveServiceDeactivations, tagged, unmanaged };
371
+ export { ActivationsService, type BaseBinding, type BaseBindingNode, type BasePlanParams, type Binding, type BindingActivation, type BindingActivationRelation, type BindingDeactivation, type BindingDeactivationRelation, type BindingMetadata, type BindingScope, BindingService, type BindingType, type ClassElementMetadata, ClassElementMetadataKind, type ClassMetadata, type ClassMetadataLifecycle, type ConstantValueBinding, type DeactivationParams, DeactivationsService, type DynamicValueBinding, type DynamicValueBuilder, type Factory, type FactoryBinding, type GetOptions, type GetOptionsTagConstraint, type GetPlanOptions, type InstanceBinding, type LeafBindingNode, type ManagedClassElementMetadata, type MetadataName, type MetadataTag, type OptionalGetOptions, type PlanBindingNode, type PlanParams, type PlanParamsConstraint, type PlanParamsTagConstraint, type PlanResult, PlanResultCacheService, type PlanServiceNode, type PlanServiceNodeParent, type PlanServiceRedirectionBindingNode, type PlanTree, type Provider, type ProviderBinding, type ResolutionContext, type ResolutionParams, type Resolved, type ResolvedValueBinding, type ResolvedValueBindingNode, type ResolvedValueElementMetadata, ResolvedValueElementMetadataKind, type ResolvedValueMetadata, type ScopedBinding, type ServiceRedirectionBinding, type UnmanagedClassElementMetadata, bindingScopeValues, bindingTypeValues, decorate, getClassMetadata, inject, injectFromBase, injectable, multiInject, named, optional, plan, postConstruct, preDestroy, resolve, resolveModuleDeactivations, resolveServiceDeactivations, tagged, unmanaged };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAC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,QAAQ,EACR,gBAAgB,EAChB,MAAM,EACN,UAAU,EACV,cAAc,EACd,WAAW,EACX,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,sBAAsB,EACtB,aAAa,EACb,UAAU,EACV,OAAO,EACP,gCAAgC,EAChC,0BAA0B,EAC1B,2BAA2B,EAC3B,MAAM,EACN,SAAS,GACV,CAAC"}
package/lib/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{getOwnReflectMetadata as n,updateOwnReflectMetadata as e,setReflectMetadata as t}from"@inversifyjs/reflect-metadata-utils";import{getBaseType as o}from"@inversifyjs/prototype-utils";import{stringifyServiceIdentifier as i,LazyServiceIdentifier as r,isPromise as s}from"@inversifyjs/common";const c={Request:"Request",Singleton:"Singleton",Transient:"Transient"},a={ConstantValue:"ConstantValue",DynamicValue:"DynamicValue",Factory:"Factory",Instance:"Instance",Provider:"Provider",ServiceRedirection:"ServiceRedirection"};function*u(...n){for(const e of n)yield*e}class d{#n;#e;#t;constructor(n){this.#n=new Map,this.#e={};for(const e of Reflect.ownKeys(n))this.#e[e]=new Map;this.#t=n}add(n,e){this.#o(n).push(e);for(const t of Reflect.ownKeys(e))this.#i(t,e[t]).push(n)}clone(){const n=Reflect.ownKeys(this.#t),e=new d(this.#t);this.#r(this.#n,e.#n);for(const t of n)this.#r(this.#e[t],e.#e[t]);return e}get(n,e){return this.#e[n].get(e)}getAllKeys(n){return this.#e[n].keys()}removeByRelation(n,e){const t=this.get(n,e);if(void 0===t)return;const o=new Set(t);for(const t of o){const o=this.#n.get(t);if(void 0===o)throw new Error("Expecting model relation, none found");for(const i of o)i[n]===e&&this.#s(t,i);this.#n.delete(t)}}#o(n){let e=this.#n.get(n);return void 0===e&&(e=[],this.#n.set(n,e)),e}#i(n,e){let t=this.#e[n].get(e);return void 0===t&&(t=[],this.#e[n].set(e,t)),t}#r(n,e){for(const[t,o]of n)e.set(t,[...o])}#s(n,e){for(const t of Reflect.ownKeys(e))this.#c(n,t,e[t])}#c(n,e,t){const o=this.#e[e].get(t);if(void 0!==o){const i=o.indexOf(n);-1!==i&&o.splice(i,1),0===o.length&&this.#e[e].delete(t)}}}var l,f,p;!function(n){n.moduleId="moduleId",n.serviceId="serviceId"}(l||(l={}));class m{#a;#u;constructor(n,e){this.#a=e??new d({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#u=n}static build(n){return new m(n)}add(n,e){this.#a.add(n,e)}clone(){return new m(this.#u,this.#a.clone())}get(n){const e=[],t=this.#a.get(l.serviceId,n);void 0!==t&&e.push(t);const o=this.#u?.get(n);if(void 0!==o&&e.push(o),0!==e.length)return u(...e)}removeAllByModuleId(n){this.#a.removeByRelation(l.moduleId,n)}removeAllByServiceId(n){this.#a.removeByRelation(l.serviceId,n)}}!function(n){n.moduleId="moduleId",n.serviceId="serviceId"}(f||(f={}));class g{#d;#u;constructor(n,e){this.#d=e??new d({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#u=n}static build(n){return new g(n)}clone(){return new g(this.#u,this.#d.clone())}get(n){return this.getNonParentBindings(n)??this.#u?.get(n)}getNonParentBindings(n){return this.#d.get(f.serviceId,n)}getNonParentBoundServices(){return this.#d.getAllKeys(f.serviceId)}getByModuleId(n){return this.#d.get(f.moduleId,n)??this.#u?.getByModuleId(n)}removeAllByModuleId(n){this.#d.removeByRelation(f.moduleId,n)}removeAllByServiceId(n){this.#d.removeByRelation(f.serviceId,n)}set(n){const e={[f.serviceId]:n.serviceIdentifier};void 0!==n.moduleId&&(e[f.moduleId]=n.moduleId),this.#d.add(n,e)}}!function(n){n.moduleId="moduleId",n.serviceId="serviceId"}(p||(p={}));class h{#l;#u;constructor(n,e){this.#l=e??new d({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#u=n}static build(n){return new h(n)}add(n,e){this.#l.add(n,e)}clone(){return new h(this.#u,this.#l.clone())}get(n){const e=[],t=this.#l.get(p.serviceId,n);void 0!==t&&e.push(t);const o=this.#u?.get(n);if(void 0!==o&&e.push(o),0!==e.length)return u(...e)}removeAllByModuleId(n){this.#l.removeByRelation(p.moduleId,n)}removeAllByServiceId(n){this.#l.removeByRelation(p.serviceId,n)}}function v(n,e,t){const o=Array.isArray(n)?n:[n];if(void 0!==t)if("number"!=typeof t)Reflect.decorate(o,e.prototype,t);else for(const n of o)n(e,void 0,t);else Reflect.decorate(o,e)}const y="@inversifyjs/core/classMetadataReflectKey";function w(){return{constructorArguments:[],lifecycle:{postConstructMethodName:void 0,preDestroyMethodName:void 0},properties:new Map,scope:void 0}}const M="@inversifyjs/core/pendingClassMetadataCountReflectKey";const I=Symbol.for("@inversifyjs/core/InversifyCoreError");class b extends Error{[I];kind;constructor(n,e,t){super(e,t),this[I]=!0,this.kind=n}static is(n){return"object"==typeof n&&null!==n&&!0===n[I]}static isErrorOfKind(n,e){return b.is(n)&&n.kind===e}}var j,C,$;function x(e){const t=n(e,y)??w();if(!function(e){const t=n(e,M);return void 0!==t&&0!==t}(e))return function(n,e){const t=[];if(e.length<n.length)throw new b(j.missingInjectionDecorator,`Found unexpected missing metadata on type "${n.name}". "${n.name}" constructor requires at least ${n.length.toString()} arguments, found ${e.length.toString()} instead.\nAre you using @inject, @multiInject or @unmanaged decorators in every non optional constructor argument?\n\nIf you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`);for(let n=0;n<e.length;++n)void 0===e[n]&&t.push(n);if(t.length>0)throw new b(j.missingInjectionDecorator,`Found unexpected missing metadata on type "${n.name}" at constructor indexes "${t.join('", "')}".\n\nAre you using @inject, @multiInject or @unmanaged decorators at those indexes?\n\nIf you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`)}(e,t.constructorArguments),t;!function(n,e){const t=[];for(let o=0;o<e.constructorArguments.length;++o){const i=e.constructorArguments[o];void 0!==i&&i.kind!==C.unknown||t.push(` - Missing or incomplete metadata for type "${n.name}" at constructor argument with index ${o.toString()}.\nEvery constructor parameter must be decorated either with @inject, @multiInject or @unmanaged decorator.`)}for(const[o,i]of e.properties)i.kind===C.unknown&&t.push(` - Missing or incomplete metadata for type "${n.name}" at property "${o.toString()}".\nThis property must be decorated either with @inject or @multiInject decorator.`);if(0===t.length)throw new b(j.unknown,`Unexpected class metadata for type "${n.name}" with uncompletion traces.\nThis might be caused by one of the following reasons:\n\n1. A third party library is targeting inversify reflection metadata.\n2. A bug is causing the issue. Consider submiting an issue to fix it.`);throw new b(j.missingInjectionDecorator,`Invalid class metadata at type ${n.name}:\n\n${t.join("\n\n")}`)}(e,t)}function S(){return 0}function R(n){return t=>{void 0!==t&&t.kind===C.unknown&&e(n,M,S,(n=>n-1))}}function A(n,e){return(...t)=>o=>{if(void 0===o)return n(...t);if(o.kind===$.unmanaged)throw new b(j.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found");return e(o,...t)}}function T(n){if(n.kind!==C.unknown&&!0!==n.isFromTypescriptParamType)throw new b(j.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found")}!function(n){n[n.injectionDecoratorConflict=0]="injectionDecoratorConflict",n[n.missingInjectionDecorator=1]="missingInjectionDecorator",n[n.planning=2]="planning",n[n.resolution=3]="resolution",n[n.unknown=4]="unknown"}(j||(j={})),function(n){n[n.unknown=32]="unknown"}(C||(C={})),function(n){n[n.multipleInjection=0]="multipleInjection",n[n.singleInjection=1]="singleInjection",n[n.unmanaged=2]="unmanaged"}($||($={}));const D=A((function(n,e){return{kind:n,name:void 0,optional:!1,tags:new Map,value:e}}),(function(n,e,t){return T(n),{...n,kind:e,value:t}}));function k(n,e){return t=>{const o=t.properties.get(e);return t.properties.set(e,n(o)),t}}var B;function F(n,e,t,o){if(b.isErrorOfKind(o,j.injectionDecoratorConflict)){const i=function(n,e,t){if(void 0===t){if(void 0===e)throw new b(j.unknown,"Unexpected undefined property and index values");return{kind:B.property,property:e,targetClass:n.constructor}}return"number"==typeof t?{index:t,kind:B.parameter,targetClass:n}:{kind:B.method,method:e,targetClass:n}}(n,e,t);throw new b(j.injectionDecoratorConflict,`Unexpected injection error.\n\nCause:\n\n${o.message}\n\nDetails\n\n${function(n){switch(n.kind){case B.method:return`[class: "${n.targetClass.name}", method: "${n.method.toString()}"]`;case B.parameter:return`[class: "${n.targetClass.name}", index: "${n.index.toString()}"]`;case B.property:return`[class: "${n.targetClass.name}", property: "${n.property.toString()}"]`}}(i)}`,{cause:o})}throw o}function O(n,t){return(o,i,r)=>{try{void 0===r?function(n,t){const o=P(n,t);return(n,t)=>{e(n.constructor,y,w,k(o(n),t))}}(n,t)(o,i):"number"==typeof r?function(n,t){const o=P(n,t);return(n,t,i)=>{if(!function(n,e){return"function"==typeof n&&void 0===e}(n,t))throw new b(j.injectionDecoratorConflict,`Found an @inject decorator in a non constructor parameter.\nFound @inject decorator at method "${t?.toString()??""}" at class "${n.constructor.name}"`);e(n,y,w,function(n,e){return t=>{const o=t.constructorArguments[e];return t.constructorArguments[e]=n(o),t}}(o(n),i))}}(n,t)(o,i,r):function(n,t){const o=P(n,t);return(n,t,i)=>{if(!function(n){return void 0!==n.set}(i))throw new b(j.injectionDecoratorConflict,`Found an @inject decorator in a non setter property method.\nFound @inject decorator at method "${t.toString()}" at class "${n.constructor.name}"`);e(n.constructor,y,w,k(o(n),t))}}(n,t)(o,i,r)}catch(n){F(o,i,r,n)}}}function P(n,e){return t=>{const o=e(t);return e=>(o(e),n(e))}}function N(n){return O(D($.singleInjection,n),R)}!function(n){n[n.method=0]="method",n[n.parameter=1]="parameter",n[n.property=2]="property"}(B||(B={}));const E="@inversifyjs/core/classIsInjectableFlagReflectKey";const U=[Array,BigInt,Boolean,Function,Number,Object,String];function K(t){const o=n(t,"design:paramtypes");void 0!==o&&e(t,y,w,function(n){return e=>(n.forEach(((n,t)=>{var o;void 0!==e.constructorArguments[t]||(o=n,U.includes(o))||(e.constructorArguments[t]=function(n){return{isFromTypescriptParamType:!0,kind:$.singleInjection,name:void 0,optional:!1,tags:new Map,value:n}}(n))})),e)}(o))}function q(o){return i=>{!function(e){if(void 0!==n(e,E))throw new b(j.injectionDecoratorConflict,`Cannot apply @injectable decorator multiple times at class "${e.name}"`);t(e,E,!0)}(i),K(i),void 0!==o&&e(i,y,w,(n=>({...n,scope:o})))}}function V(n,e,t){let o;return n.extendConstructorArguments??!0?(o=[...e.constructorArguments],t.constructorArguments.map(((n,e)=>{o[e]=n}))):o=t.constructorArguments,o}function G(n,e,t){let o;return o=n.extendProperties??!0?new Map(u(e.properties,t.properties)):t.properties,o}function z(n){return t=>{const o=x(n.type);e(t,y,w,function(n,e){const t=t=>({constructorArguments:V(n,e,t),lifecycle:t.lifecycle,properties:G(n,e,t),scope:t.scope});return t}(n,o))}}function H(n){return e=>{const t=o(e);if(void 0===t)throw new b(j.injectionDecoratorConflict,`Expected base type for type "${e.name}", none found.`);z({...n,type:t})(e)}}function J(n){return O(D($.multipleInjection,n),R)}function L(n){return t=>{void 0===t&&e(n,M,S,(n=>n+1))}}function Q(n){return e=>{const t=e??{kind:C.unknown,name:void 0,optional:!1,tags:new Map};if(t.kind===$.unmanaged)throw new b(j.injectionDecoratorConflict,"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections");return n(t)}}function W(n){const e=Q(function(n){return e=>{if(void 0!==e.name)throw new b(j.injectionDecoratorConflict,"Unexpected duplicated named decorator");return e.name=n,e}}(n));return O(e,L)}function X(n){if(n.optional)throw new b(j.injectionDecoratorConflict,"Unexpected duplicated optional decorator");return n.optional=!0,n}function Y(){return O(Q(X),L)}function Z(){return(n,t,o)=>{try{e(n.constructor,y,w,(i=t,n=>{if(void 0!==n.lifecycle.postConstructMethodName)throw new b(j.injectionDecoratorConflict,"Unexpected duplicated postConstruct decorator");return n.lifecycle.postConstructMethodName=i,n}))}catch(e){F(n,t,void 0,e)}var i}}function _(){return(n,t,o)=>{try{e(n.constructor,y,w,(i=t,n=>{if(void 0!==n.lifecycle.preDestroyMethodName)throw new b(j.injectionDecoratorConflict,"Unexpected duplicated preDestroy decorator");return n.lifecycle.preDestroyMethodName=i,n}))}catch(e){F(n,t,void 0,e)}var i}}function nn(n,e){const t=Q(function(n,e){return t=>{if(t.tags.has(n))throw new b(j.injectionDecoratorConflict,"Unexpected duplicated tag decorator with existing tag");return t.tags.set(n,e),t}}(n,e));return O(t,L)}function en(){return{kind:$.unmanaged}}const tn=A(en,(function(n){if(T(n),function(n){return void 0!==n.name||n.optional||n.tags.size>0}(n))throw new b(j.injectionDecoratorConflict,"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections");return en()}));function on(){return O(tn(),R)}class rn{#f;constructor(n){this.#f=n}get name(){return this.#f.elem.name}get tags(){return this.#f.elem.tags}get serviceIdentifier(){return this.#f.elem.serviceIdentifier}getAncestor(){if(void 0!==this.#f.previous)return new rn(this.#f.previous)}}class sn{last;constructor(n){this.last=n}concat(n){return new sn({elem:n,previous:this.last})}[Symbol.iterator](){let n=this.last;return{next:()=>{if(void 0===n)return{done:!0,value:void 0};const e=n.elem;return n=n.previous,{done:!1,value:e}}}}}function cn(n,e){n.servicesBranch.has(e)&&function(n,e){const t=(o=[...n.servicesBranch,e],[...o].map(i).join(" -> "));var o;throw new b(j.planning,`Circular dependency found: ${t}`)}(n,e),n.servicesBranch.add(e)}function an(n,e,t){const o=t?.customServiceIdentifier??e.serviceIdentifier,i=[...n.getBindings(o)??[]].filter((n=>n.isSatisfiedBy(e)));if(0===i.length&&void 0!==n.autobindOptions&&"function"==typeof o){const e=function(n,e){return{cache:{isRight:!1,value:void 0},id:0,implementationType:e,isSatisfiedBy:()=>!0,moduleId:void 0,onActivation:void 0,onDeactivation:void 0,scope:n.scope,serviceIdentifier:e,type:a.Instance}}(n.autobindOptions,o);n.setBinding(e),i.push(e)}return i}function un(n){return void 0!==n.redirections}function dn(n,e,t,o){let r,s;un(t)?(r=t.binding.targetServiceIdentifier,s=t.binding.serviceIdentifier):(r=t.serviceIdentifier,s=t.parent?.binding.serviceIdentifier),Array.isArray(n)?function(n,e,t,o,r){if(0!==n.length){const e=`Ambiguous bindings found for service: "${i(t)}".\n\nRegistered bindings:\n\n${n.map((n=>function(n){switch(n.type){case a.Instance:return`[ type: "${n.type}", serviceIdentifier: "${i(n.serviceIdentifier)}", scope: "${n.scope}", implementationType: "${n.implementationType.name}" ]`;case a.ServiceRedirection:return`[ type: "${n.type}", serviceIdentifier: "${i(n.serviceIdentifier)}", redirection: "${i(n.targetServiceIdentifier)}" ]`;default:return`[ type: "${n.type}", serviceIdentifier: "${i(n.serviceIdentifier)}", scope: "${n.scope}" ]`}}(n.binding))).join("\n")}\n\nTrying to resolve bindings for "${fn(t,o)}".\n\n${pn(r)}`;throw new b(j.planning,e)}e||ln(t,o,r)}(n,e,r,s,o):function(n,e,t,o,i){if(void 0!==n||e)return;ln(t,o,i)}(n,e,r,s,o)}function ln(n,e,t){const o=`No bindings found for service: "${i(n)}".\n\nTrying to resolve bindings for "${fn(n,e)}".\n\n${pn(t)}`;throw new b(j.planning,o)}function fn(n,e){return void 0===e?`${i(n)} (Root service)`:i(e)}function pn(n){const e=0===n.tags.size?"":`\n- tags:\n - ${[...n.tags.keys()].map((n=>n.toString())).join("\n - ")}`;return`Binding metadata:\n- service identifier: ${i(n.serviceIdentifier)}\n- name: ${n.name?.toString()??"-"}${e}`}function mn(n,e,t){if(1!==n.redirections.length)dn(n.redirections,e,n,t);else{const[o]=n.redirections;un(o)&&mn(o,e,t)}}function gn(n,e,t){if(Array.isArray(n.bindings)&&1===n.bindings.length){const[o]=n.bindings;un(o)&&mn(o,e,t)}else dn(n.bindings,e,n,t)}function hn(n){const e=new Map;void 0!==n.rootConstraints.tag&&e.set(n.rootConstraints.tag.key,n.rootConstraints.tag.value);const t=new sn({elem:{name:n.rootConstraints.name,serviceIdentifier:n.rootConstraints.serviceIdentifier,tags:e},previous:void 0}),o=new rn(t.last),i=an(n,o),r=[],s={bindings:r,parent:void 0,serviceIdentifier:n.rootConstraints.serviceIdentifier};if(r.push(...wn(n,t,i,s)),!n.rootConstraints.isMultiple){gn(s,n.rootConstraints.isOptional??!1,o);const[e]=r;s.bindings=e}return{tree:{root:s}}}function vn(n,e,t,o){const i={binding:e,classMetadata:n.getClassMetadata(e.implementationType),constructorParams:[],parent:o,propertyParams:new Map};return function(n,e){const t=n.node.classMetadata;for(const[o,i]of t.constructorArguments.entries())n.node.constructorParams[o]=yn(n,e,i);for(const[o,i]of t.properties){const t=yn(n,e,i);void 0!==t&&n.node.propertyParams.set(o,t)}return n.node}({autobindOptions:n.autobindOptions,getBindings:n.getBindings,getClassMetadata:n.getClassMetadata,node:i,servicesBranch:n.servicesBranch,setBinding:n.setBinding},t)}function yn(n,e,t){if(t.kind===$.unmanaged)return;const o=r.is(t.value)?t.value.unwrap():t.value,i=e.concat({name:t.name,serviceIdentifier:o,tags:t.tags}),s=new rn(i.last),c=an(n,s),a=[],u={bindings:a,parent:n.node,serviceIdentifier:o};if(a.push(...wn(n,i,c,u)),t.kind===$.singleInjection){gn(u,t.optional,s);const[n]=a;u.bindings=n}return u}function wn(n,e,t,o){const i=un(o)?o.binding.targetServiceIdentifier:o.serviceIdentifier;cn(n,i);const r=[];for(const i of t)switch(i.type){case a.Instance:r.push(vn(n,i,e,o));break;case a.ServiceRedirection:{const t=Mn(n,e,i,o);r.push(t);break}default:r.push({binding:i,parent:o})}return n.servicesBranch.delete(i),r}function Mn(n,e,t,o){const i={binding:t,parent:o,redirections:[]},r=an(n,new rn(e.last),{customServiceIdentifier:t.targetServiceIdentifier});return i.redirections.push(...wn(n,e,r,i)),i}function In(n,e,t){const o=n.getActivations(e);return void 0===o?t:s(t)?bn(n,t,o[Symbol.iterator]()):function(n,e,t){let o=e,i=t.next();for(;!0!==i.done;){const e=i.value(n.context,o);if(s(e))return bn(n,e,t);o=e,i=t.next()}return o}(n,t,o[Symbol.iterator]())}async function bn(n,e,t){let o=await e,i=t.next();for(;!0!==i.done;)o=await i.value(n.context,o),i=t.next();return o}function jn(n,e,t){let o=t;if(void 0!==e.onActivation){const t=e.onActivation;o=s(o)?o.then((e=>t(n.context,e))):t(n.context,o)}return In(n,e.serviceIdentifier,o)}function Cn(n){return(e,t)=>{if(t.cache.isRight)return t.cache.value;const o=jn(e,t,n(e,t));return t.cache={isRight:!0,value:o},o}}const $n=Cn((function(n,e){return e.value}));function xn(n){return n}function Sn(n,e){return(t,o)=>{const i=n(o);switch(i.scope){case c.Singleton:{if(i.cache.isRight)return i.cache.value;const n=Rn(t,o,i,e);return i.cache={isRight:!0,value:n},n}case c.Request:{if(t.requestScopeCache.has(i.id))return t.requestScopeCache.get(i.id);const n=Rn(t,o,i,e);return t.requestScopeCache.set(i.id,n),n}case c.Transient:return Rn(t,o,i,e)}}}function Rn(n,e,t,o){return jn(n,t,o(n,e))}const An=(n=>Sn(xn,n))((function(n,e){return e.value(n.context)}));const Tn=Cn((function(n,e){return e.factory(n.context)}));function Dn(n,e,t){const o=function(n,e,t){if(void 0===t)return;if(!(t in n))throw new b(j.resolution,`Expecting a "${t.toString()}" property when resolving "${e.implementationType.name}" class @postConstruct decorated method, none found.`);if("function"!=typeof n[t])throw new b(j.resolution,`Expecting a "${t.toString()}" method when resolving "${e.implementationType.name}" class @postConstruct decorated method, a non function property was found instead.`);{let o;try{o=n[t]()}catch(n){throw new b(j.resolution,`Unexpected error found when calling "${t.toString()}" @postConstruct decorated method on class "${e.implementationType.name}"`,{cause:n})}if(s(o))return async function(n,e,t){try{await t}catch(t){throw new b(j.resolution,`Unexpected error found when calling "${e.toString()}" @postConstruct decorated method on class "${n.implementationType.name}"`,{cause:t})}}(e,t,o)}}(n,e,t);return s(o)?o.then((()=>n)):n}function kn(n){return(e,t,o)=>{const i=new o.binding.implementationType(...e),r=n(t,i,o);return s(r)?r.then((()=>Dn(i,o.binding,o.classMetadata.lifecycle.postConstructMethodName))):Dn(i,o.binding,o.classMetadata.lifecycle.postConstructMethodName)}}const Bn=Cn((function(n,e){return e.provider(n.context)}));function Fn(n){return n.binding}const On=function(n){return(e,t,o)=>{const i=[];for(const[r,c]of o.propertyParams){const a=o.classMetadata.properties.get(r);if(void 0===a)throw new b(j.resolution,`Expecting metadata at property "${r.toString()}", none found`);a.kind!==$.unmanaged&&void 0!==c.bindings&&(t[r]=n(e,c),s(t[r])&&i.push((async()=>{t[r]=await t[r]})()))}if(i.length>0)return Promise.all(i).then((()=>{}))}}(qn),Pn=function(n){return function e(t,o){const i=[];for(const r of o.redirections)un(r)?i.push(...e(t,r)):i.push(n(t,r));return i}}(Kn),Nn=function(n,e,t){return(o,i)=>{const r=n(o,i);return s(r)?e(r,o,i):t(r,o,i)}}(function(n){return(e,t)=>{const o=[];for(const i of t.constructorParams)void 0===i?o.push(void 0):o.push(n(e,i));return o.some(s)?Promise.all(o):o}}(qn),function(n){return async(e,t,o)=>{const i=await e;return n(i,t,o)}}(kn(On)),kn(On)),En=(n=>Sn(Fn,n))(Nn);function Un(n){return qn(n,n.planResult.tree.root)}function Kn(n,e){switch(e.binding.type){case a.ConstantValue:return $n(n,e.binding);case a.DynamicValue:return An(n,e.binding);case a.Factory:return Tn(n,e.binding);case a.Instance:return En(n,e);case a.Provider:return Bn(n,e.binding)}}function qn(n,e){if(void 0!==e.bindings)return Array.isArray(e.bindings)?function(n,e){const t=[];for(const o of e)un(o)?t.push(...Pn(n,o)):t.push(Kn(n,o));if(t.some(s))return Promise.all(t);return t}(n,e.bindings):function(n,e){if(un(e)){const t=Pn(n,e);if(1===t.length)return t[0];throw new b(j.resolution,"Unexpected multiple resolved values on single injection")}return Kn(n,e)}(n,e.bindings)}function Vn(n){return void 0!==n.scope}function Gn(n,e){if(void 0!==n.lifecycle.preDestroyMethodName&&"function"==typeof e[n.lifecycle.preDestroyMethodName])return e[n.lifecycle.preDestroyMethodName]()}function zn(n,e,t){const o=n.getDeactivations(e);if(void 0!==o)return s(t)?Hn(t,o[Symbol.iterator]()):function(n,e){let t=e.next();for(;!0!==t.done;){const o=t.value(n);if(s(o))return Hn(n,e);t=e.next()}}(t,o[Symbol.iterator]())}async function Hn(n,e){const t=await n;let o=e.next();for(;!0!==o.done;)await o.value(t),o=e.next()}function Jn(n,e){const t=function(n,e){if(e.type===a.Instance){const t=n.getClassMetadata(e.implementationType),o=e.cache.value;return s(o)?o.then((n=>Gn(t,n))):Gn(t,o)}}(n,e);return void 0===t?Ln(n,e):t.then((()=>Ln(n,e)))}function Ln(n,e){const t=e.cache;return s(t.value)?t.value.then((t=>Qn(n,e,t))):Qn(n,e,t.value)}function Qn(n,e,t){let o;if(void 0!==e.onDeactivation){o=(0,e.onDeactivation)(t)}return void 0===o?zn(n,e.serviceIdentifier,t):o.then((()=>zn(n,e.serviceIdentifier,t)))}function Wn(n,e){if(void 0===e)return;const t=function(n){const e=[];for(const t of n)Vn(t)&&t.scope===c.Singleton&&t.cache.isRight&&e.push(t);return e}(e),o=[];for(const e of t){const t=Jn(n,e);void 0!==t&&o.push(t)}return o.length>0?Promise.all(o).then((()=>{})):void 0}function Xn(n,e){const t=n.getBindingsFromModule(e);return Wn(n,t)}function Yn(n,e){const t=n.getBindings(e);return Wn(n,t)}export{m as ActivationsService,g as BindingService,$ as ClassElementMetadataKind,h as DeactivationsService,c as bindingScopeValues,a as bindingTypeValues,v as decorate,x as getClassMetadata,N as inject,H as injectFromBase,q as injectable,J as multiInject,W as named,Y as optional,hn as plan,Z as postConstruct,_ as preDestroy,Un as resolve,Xn as resolveModuleDeactivations,Yn as resolveServiceDeactivations,nn as tagged,on as unmanaged};
1
+ import{getOwnReflectMetadata as e,updateOwnReflectMetadata as t,setReflectMetadata as n}from"@inversifyjs/reflect-metadata-utils";import{getBaseType as i}from"@inversifyjs/prototype-utils";import{stringifyServiceIdentifier as o,LazyServiceIdentifier as r,isPromise as a}from"@inversifyjs/common";const s={Request:"Request",Singleton:"Singleton",Transient:"Transient"},c={ConstantValue:"ConstantValue",DynamicValue:"DynamicValue",Factory:"Factory",Instance:"Instance",Provider:"Provider",ResolvedValue:"ResolvedValue",ServiceRedirection:"ServiceRedirection"};function*u(...e){for(const t of e)yield*t}class d{#e;#t;#n;constructor(e){this.#e=new Map,this.#t={};for(const t of Reflect.ownKeys(e))this.#t[t]=new Map;this.#n=e}add(e,t){this.#i(e).push(t);for(const n of Reflect.ownKeys(t))this.#o(n,t[n]).push(e)}clone(){const e=Reflect.ownKeys(this.#n),t=new d(this.#n);this.#r(this.#e,t.#e);for(const n of e)this.#r(this.#t[n],t.#t[n]);return t}get(e,t){return this.#t[e].get(t)}getAllKeys(e){return this.#t[e].keys()}removeByRelation(e,t){const n=this.get(e,t);if(void 0===n)return;const i=new Set(n);for(const n of i){const i=this.#e.get(n);if(void 0===i)throw new Error("Expecting model relation, none found");for(const o of i)o[e]===t&&this.#a(n,o);this.#e.delete(n)}}#i(e){let t=this.#e.get(e);return void 0===t&&(t=[],this.#e.set(e,t)),t}#o(e,t){let n=this.#t[e].get(t);return void 0===n&&(n=[],this.#t[e].set(t,n)),n}#r(e,t){for(const[n,i]of e)t.set(n,[...i])}#a(e,t){for(const n of Reflect.ownKeys(t))this.#s(e,n,t[n])}#s(e,t,n){const i=this.#t[t].get(n);if(void 0!==i){const o=i.indexOf(e);-1!==o&&i.splice(o,1),0===i.length&&this.#t[t].delete(n)}}}var l,p,f;!function(e){e.moduleId="moduleId",e.serviceId="serviceId"}(l||(l={}));class g{#c;#u;constructor(e,t){this.#c=t??new d({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#u=e}static build(e){return new g(e)}add(e,t){this.#c.add(e,t)}clone(){return new g(this.#u,this.#c.clone())}get(e){const t=[],n=this.#c.get(l.serviceId,e);void 0!==n&&t.push(n);const i=this.#u?.get(e);if(void 0!==i&&t.push(i),0!==t.length)return u(...t)}removeAllByModuleId(e){this.#c.removeByRelation(l.moduleId,e)}removeAllByServiceId(e){this.#c.removeByRelation(l.serviceId,e)}}!function(e){e.moduleId="moduleId",e.serviceId="serviceId"}(p||(p={}));class m{#d;#u;constructor(e,t){this.#d=t??new d({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#u=e}static build(e){return new m(e)}clone(){return new m(this.#u,this.#d.clone())}get(e){return this.getNonParentBindings(e)??this.#u?.get(e)}getNonParentBindings(e){return this.#d.get(p.serviceId,e)}getNonParentBoundServices(){return this.#d.getAllKeys(p.serviceId)}getByModuleId(e){return this.#d.get(p.moduleId,e)??this.#u?.getByModuleId(e)}removeAllByModuleId(e){this.#d.removeByRelation(p.moduleId,e)}removeAllByServiceId(e){this.#d.removeByRelation(p.serviceId,e)}set(e){const t={[p.serviceId]:e.serviceIdentifier};void 0!==e.moduleId&&(t[p.moduleId]=e.moduleId),this.#d.add(e,t)}}!function(e){e.moduleId="moduleId",e.serviceId="serviceId"}(f||(f={}));class h{#l;#u;constructor(e,t){this.#l=t??new d({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#u=e}static build(e){return new h(e)}add(e,t){this.#l.add(e,t)}clone(){return new h(this.#u,this.#l.clone())}get(e){const t=[],n=this.#l.get(f.serviceId,e);void 0!==n&&t.push(n);const i=this.#u?.get(e);if(void 0!==i&&t.push(i),0!==t.length)return u(...t)}removeAllByModuleId(e){this.#l.removeByRelation(f.moduleId,e)}removeAllByServiceId(e){this.#l.removeByRelation(f.serviceId,e)}}function v(e,t,n){const i=Array.isArray(e)?e:[e];if(void 0!==n)if("number"!=typeof n)Reflect.decorate(i,t.prototype,n);else for(const e of i)e(t,void 0,n);else Reflect.decorate(i,t)}const y="@inversifyjs/core/classMetadataReflectKey";function M(){return{constructorArguments:[],lifecycle:{postConstructMethodName:void 0,preDestroyMethodName:void 0},properties:new Map,scope:void 0}}const I="@inversifyjs/core/pendingClassMetadataCountReflectKey";const w=Symbol.for("@inversifyjs/core/InversifyCoreError");class b extends Error{[w];kind;constructor(e,t,n){super(t,n),this[w]=!0,this.kind=e}static is(e){return"object"==typeof e&&null!==e&&!0===e[w]}static isErrorOfKind(e,t){return b.is(e)&&e.kind===t}}var j,T,C;function S(t){const n=e(t,y)??M();if(!function(t){const n=e(t,I);return void 0!==n&&0!==n}(t))return function(e,t){const n=[];if(t.length<e.length)throw new b(j.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}". "${e.name}" constructor requires at least ${e.length.toString()} arguments, found ${t.length.toString()} instead.\nAre you using @inject, @multiInject or @unmanaged decorators in every non optional constructor argument?\n\nIf you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`);for(let e=0;e<t.length;++e)void 0===t[e]&&n.push(e);if(n.length>0)throw new b(j.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}" at constructor indexes "${n.join('", "')}".\n\nAre you using @inject, @multiInject or @unmanaged decorators at those indexes?\n\nIf you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`)}(t,n.constructorArguments),n;!function(e,t){const n=[];for(let i=0;i<t.constructorArguments.length;++i){const o=t.constructorArguments[i];void 0!==o&&o.kind!==T.unknown||n.push(` - Missing or incomplete metadata for type "${e.name}" at constructor argument with index ${i.toString()}.\nEvery constructor parameter must be decorated either with @inject, @multiInject or @unmanaged decorator.`)}for(const[i,o]of t.properties)o.kind===T.unknown&&n.push(` - Missing or incomplete metadata for type "${e.name}" at property "${i.toString()}".\nThis property must be decorated either with @inject or @multiInject decorator.`);if(0===n.length)throw new b(j.unknown,`Unexpected class metadata for type "${e.name}" with uncompletion traces.\nThis might be caused by one of the following reasons:\n\n1. A third party library is targeting inversify reflection metadata.\n2. A bug is causing the issue. Consider submiting an issue to fix it.`);throw new b(j.missingInjectionDecorator,`Invalid class metadata at type ${e.name}:\n\n${n.join("\n\n")}`)}(t,n)}function A(){return 0}function $(e){return n=>{void 0!==n&&n.kind===T.unknown&&t(e,I,A,(e=>e-1))}}function x(e,t){return(...n)=>i=>{if(void 0===i)return e(...n);if(i.kind===C.unmanaged)throw new b(j.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found");return t(i,...n)}}function B(e){if(e.kind!==T.unknown&&!0!==e.isFromTypescriptParamType)throw new b(j.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found")}!function(e){e[e.injectionDecoratorConflict=0]="injectionDecoratorConflict",e[e.missingInjectionDecorator=1]="missingInjectionDecorator",e[e.planning=2]="planning",e[e.resolution=3]="resolution",e[e.unknown=4]="unknown"}(j||(j={})),function(e){e[e.unknown=32]="unknown"}(T||(T={})),function(e){e[e.multipleInjection=0]="multipleInjection",e[e.singleInjection=1]="singleInjection",e[e.unmanaged=2]="unmanaged"}(C||(C={}));const R=x((function(e,t){return{kind:e,name:void 0,optional:!1,tags:new Map,value:t}}),(function(e,t,n){return B(e),{...e,kind:t,value:n}}));function k(e,t){return n=>{const i=n.properties.get(t);return n.properties.set(t,e(i)),n}}var P;function D(e,t,n,i){if(b.isErrorOfKind(i,j.injectionDecoratorConflict)){const o=function(e,t,n){if(void 0===n){if(void 0===t)throw new b(j.unknown,"Unexpected undefined property and index values");return{kind:P.property,property:t,targetClass:e.constructor}}return"number"==typeof n?{index:n,kind:P.parameter,targetClass:e}:{kind:P.method,method:t,targetClass:e}}(e,t,n);throw new b(j.injectionDecoratorConflict,`Unexpected injection error.\n\nCause:\n\n${i.message}\n\nDetails\n\n${function(e){switch(e.kind){case P.method:return`[class: "${e.targetClass.name}", method: "${e.method.toString()}"]`;case P.parameter:return`[class: "${e.targetClass.name}", index: "${e.index.toString()}"]`;case P.property:return`[class: "${e.targetClass.name}", property: "${e.property.toString()}"]`}}(o)}`,{cause:i})}throw i}function V(e,n){return(i,o,r)=>{try{void 0===r?function(e,n){const i=F(e,n);return(e,n)=>{t(e.constructor,y,M,k(i(e),n))}}(e,n)(i,o):"number"==typeof r?function(e,n){const i=F(e,n);return(e,n,o)=>{if(!function(e,t){return"function"==typeof e&&void 0===t}(e,n))throw new b(j.injectionDecoratorConflict,`Found an @inject decorator in a non constructor parameter.\nFound @inject decorator at method "${n?.toString()??""}" at class "${e.constructor.name}"`);t(e,y,M,function(e,t){return n=>{const i=n.constructorArguments[t];return n.constructorArguments[t]=e(i),n}}(i(e),o))}}(e,n)(i,o,r):function(e,n){const i=F(e,n);return(e,n,o)=>{if(!function(e){return void 0!==e.set}(o))throw new b(j.injectionDecoratorConflict,`Found an @inject decorator in a non setter property method.\nFound @inject decorator at method "${n.toString()}" at class "${e.constructor.name}"`);t(e.constructor,y,M,k(i(e),n))}}(e,n)(i,o,r)}catch(e){D(i,o,r,e)}}}function F(e,t){return n=>{const i=t(n);return t=>(i(t),e(t))}}function O(e){return V(R(C.singleInjection,e),$)}!function(e){e[e.method=0]="method",e[e.parameter=1]="parameter",e[e.property=2]="property"}(P||(P={}));const N="@inversifyjs/core/classIsInjectableFlagReflectKey";const E=[Array,BigInt,Boolean,Function,Number,Object,String];function U(n){const i=e(n,"design:paramtypes");void 0!==i&&t(n,y,M,function(e){return t=>(e.forEach(((e,n)=>{var i;void 0!==t.constructorArguments[n]||(i=e,E.includes(i))||(t.constructorArguments[n]=function(e){return{isFromTypescriptParamType:!0,kind:C.singleInjection,name:void 0,optional:!1,tags:new Map,value:e}}(e))})),t)}(i))}function K(i){return o=>{!function(t){if(void 0!==e(t,N))throw new b(j.injectionDecoratorConflict,`Cannot apply @injectable decorator multiple times at class "${t.name}"`);n(t,N,!0)}(o),U(o),void 0!==i&&t(o,y,M,(e=>({...e,scope:i})))}}function q(e,t,n){let i;return e.extendConstructorArguments??!0?(i=[...t.constructorArguments],n.constructorArguments.map(((e,t)=>{i[t]=e}))):i=n.constructorArguments,i}function z(e,t,n){let i;return i=e.extendProperties??!0?new Map(u(t.properties,n.properties)):n.properties,i}function G(e){return n=>{const i=S(e.type);t(n,y,M,function(e,t){const n=n=>({constructorArguments:q(e,t,n),lifecycle:n.lifecycle,properties:z(e,t,n),scope:n.scope});return n}(e,i))}}function H(e){return t=>{const n=i(t);if(void 0===n)throw new b(j.injectionDecoratorConflict,`Expected base type for type "${t.name}", none found.`);G({...e,type:n})(t)}}function J(e){return V(R(C.multipleInjection,e),$)}function L(e){return n=>{void 0===n&&t(e,I,A,(e=>e+1))}}function Q(e){return t=>{const n=t??{kind:T.unknown,name:void 0,optional:!1,tags:new Map};if(n.kind===C.unmanaged)throw new b(j.injectionDecoratorConflict,"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections");return e(n)}}function W(e){const t=Q(function(e){return t=>{if(void 0!==t.name)throw new b(j.injectionDecoratorConflict,"Unexpected duplicated named decorator");return t.name=e,t}}(e));return V(t,L)}function X(e){if(e.optional)throw new b(j.injectionDecoratorConflict,"Unexpected duplicated optional decorator");return e.optional=!0,e}function Y(){return V(Q(X),L)}function Z(){return(e,n,i)=>{try{t(e.constructor,y,M,(o=n,e=>{if(void 0!==e.lifecycle.postConstructMethodName)throw new b(j.injectionDecoratorConflict,"Unexpected duplicated postConstruct decorator");return e.lifecycle.postConstructMethodName=o,e}))}catch(t){D(e,n,void 0,t)}var o}}function _(){return(e,n,i)=>{try{t(e.constructor,y,M,(o=n,e=>{if(void 0!==e.lifecycle.preDestroyMethodName)throw new b(j.injectionDecoratorConflict,"Unexpected duplicated preDestroy decorator");return e.lifecycle.preDestroyMethodName=o,e}))}catch(t){D(e,n,void 0,t)}var o}}function ee(e,t){const n=Q(function(e,t){return n=>{if(n.tags.has(e))throw new b(j.injectionDecoratorConflict,"Unexpected duplicated tag decorator with existing tag");return n.tags.set(e,t),n}}(e,t));return V(n,L)}function te(){return{kind:C.unmanaged}}const ne=x(te,(function(e){if(B(e),function(e){return void 0!==e.name||e.optional||e.tags.size>0}(e))throw new b(j.injectionDecoratorConflict,"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections");return te()}));function ie(){return V(ne(),$)}var oe;!function(e){e[e.multipleInjection=0]="multipleInjection",e[e.singleInjection=1]="singleInjection"}(oe||(oe={}));class re{#p;constructor(e){this.#p=e}get name(){return this.#p.elem.name}get tags(){return this.#p.elem.tags}get serviceIdentifier(){return this.#p.elem.serviceIdentifier}getAncestor(){if(void 0!==this.#p.previous)return new re(this.#p.previous)}}class ae{last;constructor(e){this.last=e}concat(e){return new ae({elem:e,previous:this.last})}[Symbol.iterator](){let e=this.last;return{next:()=>{if(void 0===e)return{done:!0,value:void 0};const t=e.elem;return e=e.previous,{done:!1,value:t}}}}}function se(e,t){e.servicesBranch.has(t)&&function(e,t){const n=(i=[...e.servicesBranch,t],[...i].map(o).join(" -> "));var i;throw new b(j.planning,`Circular dependency found: ${n}`)}(e,t),e.servicesBranch.add(t)}function ce(e,t,n){const i=n?.customServiceIdentifier??t.serviceIdentifier,o=[...e.getBindings(i)??[]].filter((e=>e.isSatisfiedBy(t)));if(0===o.length&&void 0!==e.autobindOptions&&"function"==typeof i){const t=function(e,t){return{cache:{isRight:!1,value:void 0},id:0,implementationType:t,isSatisfiedBy:()=>!0,moduleId:void 0,onActivation:void 0,onDeactivation:void 0,scope:e.scope,serviceIdentifier:t,type:c.Instance}}(e.autobindOptions,i);e.setBinding(t),o.push(t)}return o}function ue(e){return void 0!==e.redirections}function de(e,t,n,i){let r,a;ue(n)?(r=n.binding.targetServiceIdentifier,a=n.binding.serviceIdentifier):(r=n.serviceIdentifier,a=n.parent?.binding.serviceIdentifier),Array.isArray(e)?function(e,t,n,i,r){if(0!==e.length){const t=`Ambiguous bindings found for service: "${o(n)}".\n\nRegistered bindings:\n\n${e.map((e=>function(e){switch(e.type){case c.Instance:return`[ type: "${e.type}", serviceIdentifier: "${o(e.serviceIdentifier)}", scope: "${e.scope}", implementationType: "${e.implementationType.name}" ]`;case c.ServiceRedirection:return`[ type: "${e.type}", serviceIdentifier: "${o(e.serviceIdentifier)}", redirection: "${o(e.targetServiceIdentifier)}" ]`;default:return`[ type: "${e.type}", serviceIdentifier: "${o(e.serviceIdentifier)}", scope: "${e.scope}" ]`}}(e.binding))).join("\n")}\n\nTrying to resolve bindings for "${pe(n,i)}".\n\n${fe(r)}`;throw new b(j.planning,t)}t||le(n,i,r)}(e,t,r,a,i):function(e,t,n,i,o){if(void 0!==e||t)return;le(n,i,o)}(e,t,r,a,i)}function le(e,t,n){const i=`No bindings found for service: "${o(e)}".\n\nTrying to resolve bindings for "${pe(e,t)}".\n\n${fe(n)}`;throw new b(j.planning,i)}function pe(e,t){return void 0===t?`${o(e)} (Root service)`:o(t)}function fe(e){const t=0===e.tags.size?"":`\n- tags:\n - ${[...e.tags.keys()].map((e=>e.toString())).join("\n - ")}`;return`Binding metadata:\n- service identifier: ${o(e.serviceIdentifier)}\n- name: ${e.name?.toString()??"-"}${t}`}function ge(e,t,n){if(1!==e.redirections.length)de(e.redirections,t,e,n);else{const[i]=e.redirections;ue(i)&&ge(i,t,n)}}function me(e,t,n){if(Array.isArray(e.bindings)&&1===e.bindings.length){const[i]=e.bindings;ue(i)&&ge(i,t,n)}else de(e.bindings,t,e,n)}function he(e){const t=new Map;void 0!==e.rootConstraints.tag&&t.set(e.rootConstraints.tag.key,e.rootConstraints.tag.value);const n=new ae({elem:{name:e.rootConstraints.name,serviceIdentifier:e.rootConstraints.serviceIdentifier,tags:t},previous:void 0}),i=new re(n.last),o=ce(e,i),r=[],a={bindings:r,parent:void 0,serviceIdentifier:e.rootConstraints.serviceIdentifier};if(r.push(...we(e,n,o,a)),!e.rootConstraints.isMultiple){me(a,e.rootConstraints.isOptional??!1,i);const[t]=r;a.bindings=t}return{tree:{root:a}}}function ve(e,t,n,i){const o={binding:t,classMetadata:e.getClassMetadata(t.implementationType),constructorParams:[],parent:i,propertyParams:new Map};return je({autobindOptions:e.autobindOptions,getBindings:e.getBindings,getClassMetadata:e.getClassMetadata,node:o,servicesBranch:e.servicesBranch,setBinding:e.setBinding},n)}function ye(e,t,n){if(n.kind===C.unmanaged)return;const i=r.is(n.value)?n.value.unwrap():n.value,o=t.concat({name:n.name,serviceIdentifier:i,tags:n.tags}),a=new re(o.last),s=ce(e,a),c=[],u={bindings:c,parent:e.node,serviceIdentifier:i};if(c.push(...we(e,o,s,u)),n.kind===C.singleInjection){me(u,n.optional,a);const[e]=c;u.bindings=e}return u}function Me(e,t,n){const i=r.is(n.value)?n.value.unwrap():n.value,o=t.concat({name:n.name,serviceIdentifier:i,tags:n.tags}),a=new re(o.last),s=ce(e,a),c=[],u={bindings:c,parent:e.node,serviceIdentifier:i};if(c.push(...we(e,o,s,u)),n.kind===oe.singleInjection){me(u,n.optional,a);const[e]=c;u.bindings=e}return u}function Ie(e,t,n,i){const o={binding:t,params:[],parent:i};return je({autobindOptions:e.autobindOptions,getBindings:e.getBindings,getClassMetadata:e.getClassMetadata,node:o,servicesBranch:e.servicesBranch,setBinding:e.setBinding},n)}function we(e,t,n,i){const o=ue(i)?i.binding.targetServiceIdentifier:i.serviceIdentifier;se(e,o);const r=[];for(const o of n)switch(o.type){case c.Instance:r.push(ve(e,o,t,i));break;case c.ResolvedValue:r.push(Ie(e,o,t,i));break;case c.ServiceRedirection:{const n=be(e,t,o,i);r.push(n);break}default:r.push({binding:o,parent:i})}return e.servicesBranch.delete(o),r}function be(e,t,n,i){const o={binding:n,parent:i,redirections:[]},r=ce(e,new re(t.last),{customServiceIdentifier:n.targetServiceIdentifier});return o.redirections.push(...we(e,t,r,o)),o}function je(e,t){return e.node.binding.type===c.Instance?function(e,t,n){const i=t.classMetadata;for(const[o,r]of i.constructorArguments.entries())t.constructorParams[o]=ye(e,n,r);for(const[o,r]of i.properties){const i=ye(e,n,r);void 0!==i&&t.propertyParams.set(o,i)}return e.node}(e,e.node,t):function(e,t,n){const i=t.binding.metadata;for(const[o,r]of i.arguments.entries())t.params[o]=Me(e,n,r);return e.node}(e,e.node,t)}var Te;!function(e){e[e.singleMandatory=0]="singleMandatory",e[e.singleOptional=1]="singleOptional",e[e.multipleMandatory=2]="multipleMandatory",e[e.multipleOptional=3]="multipleOptional",e[e.length=4]="length"}(Te||(Te={}));class Ce{#f;#g;#m;#h;#v;constructor(){this.#f=this.#y(),this.#g=this.#y(),this.#h=this.#y(),this.#m=this.#y(),this.#v=[]}clearCache(){for(const e of this.#M())e.clear();for(const e of this.#v)e.clearCache()}get(e){return void 0===e.name?void 0===e.tag?this.#I(this.#f,e).get(e.serviceIdentifier):this.#I(this.#m,e).get(e.serviceIdentifier)?.get(e.tag.key)?.get(e.tag.value):void 0===e.tag?this.#I(this.#g,e).get(e.serviceIdentifier)?.get(e.name):this.#I(this.#h,e).get(e.serviceIdentifier)?.get(e.name)?.get(e.tag.key)?.get(e.tag.value)}set(e,t){void 0===e.name?void 0===e.tag?this.#I(this.#f,e).set(e.serviceIdentifier,t):this.#w(this.#w(this.#I(this.#m,e),e.serviceIdentifier),e.tag.key).set(e.tag.value,t):void 0===e.tag?this.#w(this.#I(this.#g,e),e.serviceIdentifier).set(e.name,t):this.#w(this.#w(this.#w(this.#I(this.#h,e),e.serviceIdentifier),e.name),e.tag.key).set(e.tag.value,t)}subscribe(e){this.#v.push(e)}#y(){const e=new Array(Te.length);for(let t=0;t<e.length;++t)e[t]=new Map;return e}#w(e,t){let n=e.get(t);return void 0===n&&(n=new Map,e.set(t,n)),n}#I(e,t){return e[this.#b(t)]}#M(){return[...this.#f,...this.#g,...this.#h,...this.#m]}#b(e){return e.isMultiple?!0===e.optional?Te.multipleOptional:Te.multipleMandatory:!0===e.optional?Te.singleOptional:Te.singleMandatory}}function Se(e,t,n){const i=e.getActivations(t);return void 0===i?n:a(n)?Ae(e,n,i[Symbol.iterator]()):function(e,t,n){let i=t,o=n.next();for(;!0!==o.done;){const t=o.value(e.context,i);if(a(t))return Ae(e,t,n);i=t,o=n.next()}return i}(e,n,i[Symbol.iterator]())}async function Ae(e,t,n){let i=await t,o=n.next();for(;!0!==o.done;)i=await o.value(e.context,i),o=n.next();return i}function $e(e,t,n){let i=n;if(void 0!==t.onActivation){const n=t.onActivation;i=a(i)?i.then((t=>n(e.context,t))):n(e.context,i)}return Se(e,t.serviceIdentifier,i)}function xe(e){return(t,n)=>{if(n.cache.isRight)return n.cache.value;const i=$e(t,n,e(t,n));return n.cache={isRight:!0,value:i},i}}const Be=xe((function(e,t){return t.value}));function Re(e){return e}function ke(e,t){return(n,i)=>{const o=e(i);switch(o.scope){case s.Singleton:{if(o.cache.isRight)return o.cache.value;const e=Pe(n,i,o,t);return o.cache={isRight:!0,value:e},e}case s.Request:{if(n.requestScopeCache.has(o.id))return n.requestScopeCache.get(o.id);const e=Pe(n,i,o,t);return n.requestScopeCache.set(o.id,e),e}case s.Transient:return Pe(n,i,o,t)}}}function Pe(e,t,n,i){return $e(e,n,i(e,t))}const De=(e=>ke(Re,e))((function(e,t){return t.value(e.context)}));const Ve=xe((function(e,t){return t.factory(e.context)}));function Fe(e,t,n){const i=function(e,t,n){if(void 0===n)return;if(!(n in e))throw new b(j.resolution,`Expecting a "${n.toString()}" property when resolving "${t.implementationType.name}" class @postConstruct decorated method, none found.`);if("function"!=typeof e[n])throw new b(j.resolution,`Expecting a "${n.toString()}" method when resolving "${t.implementationType.name}" class @postConstruct decorated method, a non function property was found instead.`);{let i;try{i=e[n]()}catch(e){throw new b(j.resolution,`Unexpected error found when calling "${n.toString()}" @postConstruct decorated method on class "${t.implementationType.name}"`,{cause:e})}if(a(i))return async function(e,t,n){try{await n}catch(n){throw new b(j.resolution,`Unexpected error found when calling "${t.toString()}" @postConstruct decorated method on class "${e.implementationType.name}"`,{cause:n})}}(t,n,i)}}(e,t,n);return a(i)?i.then((()=>e)):e}function Oe(e){return(t,n,i)=>{const o=new i.binding.implementationType(...t),r=e(n,o,i);return a(r)?r.then((()=>Fe(o,i.binding,i.classMetadata.lifecycle.postConstructMethodName))):Fe(o,i.binding,i.classMetadata.lifecycle.postConstructMethodName)}}const Ne=xe((function(e,t){return t.provider(e.context)}));function Ee(e){return e.binding}function Ue(e){return e.binding}const Ke=function(e){return(t,n,i)=>{const o=[];for(const[r,s]of i.propertyParams){const c=i.classMetadata.properties.get(r);if(void 0===c)throw new b(j.resolution,`Expecting metadata at property "${r.toString()}", none found`);c.kind!==C.unmanaged&&void 0!==s.bindings&&(n[r]=e(t,s),a(n[r])&&o.push((async()=>{n[r]=await n[r]})()))}if(o.length>0)return Promise.all(o).then((()=>{}))}}(We),qe=function(e){return function t(n,i){const o=[];for(const r of i.redirections)ue(r)?o.push(...t(n,r)):o.push(e(n,r));return o}}(Qe),ze=function(e,t,n){return(i,o)=>{const r=e(i,o);return a(r)?t(r,i,o):n(r,i,o)}}(function(e){return(t,n)=>{const i=[];for(const o of n.constructorParams)void 0===o?i.push(void 0):i.push(e(t,o));return i.some(a)?Promise.all(i):i}}(We),function(e){return async(t,n,i)=>{const o=await t;return e(o,n,i)}}(Oe(Ke)),Oe(Ke)),Ge=function(e){return(t,n)=>{const i=e(t,n);return a(i)?i.then((e=>n.binding.factory(...e))):n.binding.factory(...i)}}(function(e){return(t,n)=>{const i=[];for(const o of n.params)i.push(e(t,o));return i.some(a)?Promise.all(i):i}}(We)),He=(e=>ke(Ee,e))(ze),Je=(e=>ke(Ue,e))(Ge);function Le(e){return We(e,e.planResult.tree.root)}function Qe(e,t){switch(t.binding.type){case c.ConstantValue:return Be(e,t.binding);case c.DynamicValue:return De(e,t.binding);case c.Factory:return Ve(e,t.binding);case c.Instance:return He(e,t);case c.Provider:return Ne(e,t.binding);case c.ResolvedValue:return Je(e,t)}}function We(e,t){if(void 0!==t.bindings)return Array.isArray(t.bindings)?function(e,t){const n=[];for(const i of t)ue(i)?n.push(...qe(e,i)):n.push(Qe(e,i));if(n.some(a))return Promise.all(n);return n}(e,t.bindings):function(e,t){if(ue(t)){const n=qe(e,t);if(1===n.length)return n[0];throw new b(j.resolution,"Unexpected multiple resolved values on single injection")}return Qe(e,t)}(e,t.bindings)}function Xe(e){return void 0!==e.scope}function Ye(e,t){if(void 0!==e.lifecycle.preDestroyMethodName&&"function"==typeof t[e.lifecycle.preDestroyMethodName])return t[e.lifecycle.preDestroyMethodName]()}function Ze(e,t,n){const i=e.getDeactivations(t);if(void 0!==i)return a(n)?_e(n,i[Symbol.iterator]()):function(e,t){let n=t.next();for(;!0!==n.done;){const i=n.value(e);if(a(i))return _e(e,t);n=t.next()}}(n,i[Symbol.iterator]())}async function _e(e,t){const n=await e;let i=t.next();for(;!0!==i.done;)await i.value(n),i=t.next()}function et(e,t){const n=function(e,t){if(t.type===c.Instance){const n=e.getClassMetadata(t.implementationType),i=t.cache.value;return a(i)?i.then((e=>Ye(n,e))):Ye(n,i)}}(e,t);return void 0===n?tt(e,t):n.then((()=>tt(e,t)))}function tt(e,t){const n=t.cache;return a(n.value)?n.value.then((n=>nt(e,t,n))):nt(e,t,n.value)}function nt(e,t,n){let i;if(void 0!==t.onDeactivation){i=(0,t.onDeactivation)(n)}return void 0===i?Ze(e,t.serviceIdentifier,n):i.then((()=>Ze(e,t.serviceIdentifier,n)))}function it(e,t){if(void 0===t)return;const n=function(e){const t=[];for(const n of e)Xe(n)&&n.scope===s.Singleton&&n.cache.isRight&&t.push(n);return t}(t),i=[];for(const t of n){const n=et(e,t);void 0!==n&&i.push(n)}return i.length>0?Promise.all(i).then((()=>{})):void 0}function ot(e,t){const n=e.getBindingsFromModule(t);return it(e,n)}function rt(e,t){const n=e.getBindings(t);return it(e,n)}export{g as ActivationsService,m as BindingService,C as ClassElementMetadataKind,h as DeactivationsService,Ce as PlanResultCacheService,oe as ResolvedValueElementMetadataKind,s as bindingScopeValues,c as bindingTypeValues,v as decorate,S as getClassMetadata,O as inject,H as injectFromBase,K as injectable,J as multiInject,W as named,Y as optional,he as plan,Z as postConstruct,_ as preDestroy,Le as resolve,ot as resolveModuleDeactivations,rt as resolveServiceDeactivations,ee as tagged,ie as unmanaged};
2
2
  //# sourceMappingURL=index.js.map