@rocketmakers/ioc 0.3.8 → 0.3.10
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/CHANGELOG.md +18 -0
- package/lib/binder.d.ts +5 -5
- package/lib/binder.d.ts.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4548 -87
- package/lib/index.js.map +1 -1
- package/package.json +19 -7
package/lib/index.js
CHANGED
|
@@ -1,113 +1,4574 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// source/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
containerFactory: () => containerFactory,
|
|
24
|
+
containerRegister: () => containerRegister,
|
|
25
|
+
containerRegisterFunctionResolver: () => containerRegisterFunctionResolver,
|
|
26
|
+
getGlobalContainer: () => getGlobalContainer,
|
|
27
|
+
internalContainer: () => internalContainer4,
|
|
28
|
+
makeInjectable: () => makeInjectable,
|
|
29
|
+
makeInjected: () => makeInjected,
|
|
30
|
+
makeParamInjected: () => makeParamInjected,
|
|
31
|
+
makeParamUnmanaged: () => makeParamUnmanaged,
|
|
32
|
+
makeUnmanaged: () => makeUnmanaged,
|
|
33
|
+
mergeContainers: () => mergeContainers,
|
|
34
|
+
reflectMetadataKeys: () => reflectMetadataKeys,
|
|
35
|
+
register: () => register,
|
|
36
|
+
registerClass: () => registerClass,
|
|
37
|
+
registerWithPrefix: () => registerWithPrefix,
|
|
38
|
+
wasMadeInjectable: () => wasMadeInjectable,
|
|
39
|
+
wasParamMadeInjected: () => wasParamMadeInjected
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(index_exports);
|
|
42
|
+
var import_reflect_metadata = require("reflect-metadata");
|
|
43
|
+
|
|
44
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+common@2.0.1/node_modules/@inversifyjs/common/lib/common/calculations/isPromise.js
|
|
45
|
+
function isPromise(object) {
|
|
46
|
+
const isObjectOrFunction = typeof object === "object" && object !== null || typeof object === "function";
|
|
47
|
+
return isObjectOrFunction && typeof object.then === "function";
|
|
25
48
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
49
|
+
|
|
50
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+common@2.0.1/node_modules/@inversifyjs/common/lib/services/calculations/stringifyServiceIdentifier.js
|
|
51
|
+
function stringifyServiceIdentifier(serviceIdentifier) {
|
|
52
|
+
switch (typeof serviceIdentifier) {
|
|
53
|
+
case "string":
|
|
54
|
+
case "symbol":
|
|
55
|
+
return serviceIdentifier.toString();
|
|
56
|
+
case "function":
|
|
57
|
+
return serviceIdentifier.name;
|
|
58
|
+
default:
|
|
59
|
+
throw new Error(`Unexpected ${typeof serviceIdentifier} service id type`);
|
|
60
|
+
}
|
|
29
61
|
}
|
|
30
|
-
|
|
31
|
-
|
|
62
|
+
|
|
63
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+common@2.0.1/node_modules/@inversifyjs/common/lib/services/models/LazyServiceIdentifier.js
|
|
64
|
+
var islazyServiceIdentifierSymbol = /* @__PURE__ */ Symbol.for("@inversifyjs/common/islazyServiceIdentifier");
|
|
65
|
+
var LazyServiceIdentifier = class {
|
|
66
|
+
[islazyServiceIdentifierSymbol];
|
|
67
|
+
#buildServiceId;
|
|
68
|
+
constructor(buildServiceId) {
|
|
69
|
+
this.#buildServiceId = buildServiceId;
|
|
70
|
+
this[islazyServiceIdentifierSymbol] = true;
|
|
71
|
+
}
|
|
72
|
+
static is(value) {
|
|
73
|
+
return typeof value === "object" && value !== null && value[islazyServiceIdentifierSymbol] === true;
|
|
74
|
+
}
|
|
75
|
+
unwrap() {
|
|
76
|
+
return this.#buildServiceId();
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/index.js
|
|
81
|
+
var import_lite = require("reflect-metadata/lite");
|
|
82
|
+
|
|
83
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+reflect-metadata-utils@1.5.0_reflect-metadata@0.2.2/node_modules/@inversifyjs/reflect-metadata-utils/lib/reflectMetadata/utils/getOwnReflectMetadata.js
|
|
84
|
+
function getOwnReflectMetadata(target, metadataKey, propertyKey) {
|
|
85
|
+
return Reflect.getOwnMetadata(metadataKey, target, propertyKey);
|
|
32
86
|
}
|
|
33
|
-
|
|
87
|
+
|
|
88
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+reflect-metadata-utils@1.5.0_reflect-metadata@0.2.2/node_modules/@inversifyjs/reflect-metadata-utils/lib/reflectMetadata/utils/setReflectMetadata.js
|
|
89
|
+
function setReflectMetadata(target, metadataKey, metadata, propertyKey) {
|
|
90
|
+
Reflect.defineMetadata(metadataKey, metadata, target, propertyKey);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+reflect-metadata-utils@1.5.0_reflect-metadata@0.2.2/node_modules/@inversifyjs/reflect-metadata-utils/lib/reflectMetadata/utils/updateOwnReflectMetadata.js
|
|
94
|
+
function updateOwnReflectMetadata(target, metadataKey, buildDefaultValue, callback, propertyKey) {
|
|
95
|
+
const metadata = getOwnReflectMetadata(target, metadataKey, propertyKey) ?? buildDefaultValue();
|
|
96
|
+
const updatedMetadata = callback(metadata);
|
|
97
|
+
Reflect.defineMetadata(metadataKey, updatedMetadata, target, propertyKey);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/binding/actions/getBindingId.js
|
|
101
|
+
var ID_METADATA = "@inversifyjs/container/bindingId";
|
|
102
|
+
function getBindingId() {
|
|
103
|
+
const bindingId = getOwnReflectMetadata(Object, ID_METADATA) ?? 0;
|
|
104
|
+
if (bindingId === Number.MAX_SAFE_INTEGER) {
|
|
105
|
+
setReflectMetadata(Object, ID_METADATA, Number.MIN_SAFE_INTEGER);
|
|
106
|
+
} else {
|
|
107
|
+
updateOwnReflectMetadata(Object, ID_METADATA, () => bindingId, (id) => id + 1);
|
|
108
|
+
}
|
|
109
|
+
return bindingId;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/binding/models/BindingScope.js
|
|
113
|
+
var bindingScopeValues = {
|
|
114
|
+
Request: "Request",
|
|
115
|
+
Singleton: "Singleton",
|
|
116
|
+
Transient: "Transient"
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/binding/models/BindingType.js
|
|
120
|
+
var bindingTypeValues = {
|
|
121
|
+
ConstantValue: "ConstantValue",
|
|
122
|
+
DynamicValue: "DynamicValue",
|
|
123
|
+
Factory: "Factory",
|
|
124
|
+
Instance: "Instance",
|
|
125
|
+
ResolvedValue: "ResolvedValue",
|
|
126
|
+
ServiceRedirection: "ServiceRedirection"
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/common/calculations/chain.js
|
|
130
|
+
function* chain(...iterables) {
|
|
131
|
+
for (const iterable of iterables) {
|
|
132
|
+
yield* iterable;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/common/models/OneToManyMapStar.js
|
|
137
|
+
var NOT_FOUND_INDEX = -1;
|
|
138
|
+
var OneToManyMapStar = class _OneToManyMapStar {
|
|
139
|
+
#modelToRelationMap;
|
|
140
|
+
#relationToModelsMaps;
|
|
141
|
+
#spec;
|
|
142
|
+
constructor(spec) {
|
|
143
|
+
this.#modelToRelationMap = /* @__PURE__ */ new Map();
|
|
144
|
+
this.#relationToModelsMaps = {};
|
|
145
|
+
for (const specProperty of Reflect.ownKeys(spec)) {
|
|
146
|
+
this.#relationToModelsMaps[specProperty] = /* @__PURE__ */ new Map();
|
|
147
|
+
}
|
|
148
|
+
this.#spec = spec;
|
|
149
|
+
}
|
|
150
|
+
add(model, relation) {
|
|
151
|
+
this.#buildOrGetModelArray(model).push(relation);
|
|
152
|
+
for (const relationKey of Reflect.ownKeys(relation)) {
|
|
153
|
+
this.#buildOrGetRelationModels(relationKey, relation[relationKey]).push(model);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
clone() {
|
|
157
|
+
const modelToCloneModelMap = this.#buildModelToCloneModelMap();
|
|
158
|
+
const relationToCloneRelationMap = this.#buildRelationToRelationModelMap();
|
|
159
|
+
const properties = Reflect.ownKeys(this.#spec);
|
|
160
|
+
const clone = this._buildNewInstance(this.#spec);
|
|
161
|
+
this.#pushRelationEntriesIntoRelationMap(this.#modelToRelationMap, clone.#modelToRelationMap, modelToCloneModelMap, relationToCloneRelationMap);
|
|
162
|
+
for (const property of properties) {
|
|
163
|
+
this.#pushModelEntriesIntoModelMap(this.#relationToModelsMaps[property], clone.#relationToModelsMaps[property], modelToCloneModelMap);
|
|
164
|
+
}
|
|
165
|
+
return clone;
|
|
166
|
+
}
|
|
167
|
+
get(key, value) {
|
|
168
|
+
return this.#relationToModelsMaps[key].get(value);
|
|
169
|
+
}
|
|
170
|
+
getAllKeys(key) {
|
|
171
|
+
return this.#relationToModelsMaps[key].keys();
|
|
172
|
+
}
|
|
173
|
+
removeByRelation(key, value) {
|
|
174
|
+
const models = this.get(key, value);
|
|
175
|
+
if (models === void 0) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const uniqueModelsSet = new Set(models);
|
|
179
|
+
for (const model of uniqueModelsSet) {
|
|
180
|
+
const relations = this.#modelToRelationMap.get(model);
|
|
181
|
+
if (relations === void 0) {
|
|
182
|
+
throw new Error("Expecting model relation, none found");
|
|
183
|
+
}
|
|
184
|
+
for (const relation of relations) {
|
|
185
|
+
if (relation[key] === value) {
|
|
186
|
+
this.#removeModelFromRelationMaps(model, relation);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
this.#modelToRelationMap.delete(model);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
_buildNewInstance(spec) {
|
|
193
|
+
return new _OneToManyMapStar(spec);
|
|
194
|
+
}
|
|
195
|
+
_cloneModel(model) {
|
|
196
|
+
return model;
|
|
197
|
+
}
|
|
198
|
+
_cloneRelation(relation) {
|
|
199
|
+
return relation;
|
|
200
|
+
}
|
|
201
|
+
#buildModelToCloneModelMap() {
|
|
202
|
+
const modelToCloneModelMap = /* @__PURE__ */ new Map();
|
|
203
|
+
for (const model of this.#modelToRelationMap.keys()) {
|
|
204
|
+
const clonedModel = this._cloneModel(model);
|
|
205
|
+
modelToCloneModelMap.set(model, clonedModel);
|
|
206
|
+
}
|
|
207
|
+
return modelToCloneModelMap;
|
|
208
|
+
}
|
|
209
|
+
#buildRelationToRelationModelMap() {
|
|
210
|
+
const relationToCloneRelationMap = /* @__PURE__ */ new Map();
|
|
211
|
+
for (const relations of this.#modelToRelationMap.values()) {
|
|
212
|
+
for (const relation of relations) {
|
|
213
|
+
const clonedRelation = this._cloneRelation(relation);
|
|
214
|
+
relationToCloneRelationMap.set(relation, clonedRelation);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return relationToCloneRelationMap;
|
|
218
|
+
}
|
|
219
|
+
#buildOrGetModelArray(model) {
|
|
220
|
+
let relations = this.#modelToRelationMap.get(model);
|
|
221
|
+
if (relations === void 0) {
|
|
222
|
+
relations = [];
|
|
223
|
+
this.#modelToRelationMap.set(model, relations);
|
|
224
|
+
}
|
|
225
|
+
return relations;
|
|
226
|
+
}
|
|
227
|
+
#buildOrGetRelationModels(relationKey, relationValue) {
|
|
228
|
+
let models = this.#relationToModelsMaps[relationKey].get(relationValue);
|
|
229
|
+
if (models === void 0) {
|
|
230
|
+
models = [];
|
|
231
|
+
this.#relationToModelsMaps[relationKey].set(relationValue, models);
|
|
232
|
+
}
|
|
233
|
+
return models;
|
|
234
|
+
}
|
|
235
|
+
#getCloneModel(model, modelToCloneModelMap) {
|
|
236
|
+
const clonedModel = modelToCloneModelMap.get(model);
|
|
237
|
+
if (clonedModel === void 0) {
|
|
238
|
+
throw new Error("Expecting model to be cloned, none found");
|
|
239
|
+
}
|
|
240
|
+
return clonedModel;
|
|
241
|
+
}
|
|
242
|
+
#getCloneRelation(relation, relationToCloneRelationMap) {
|
|
243
|
+
const clonedRelation = relationToCloneRelationMap.get(relation);
|
|
244
|
+
if (clonedRelation === void 0) {
|
|
245
|
+
throw new Error("Expecting relation to be cloned, none found");
|
|
246
|
+
}
|
|
247
|
+
return clonedRelation;
|
|
248
|
+
}
|
|
249
|
+
#pushModelEntriesIntoModelMap(source, target, modelToCloneModelMap) {
|
|
250
|
+
for (const [relationValue, models] of source) {
|
|
251
|
+
const modelsClone = new Array();
|
|
252
|
+
for (const model of models) {
|
|
253
|
+
modelsClone.push(this.#getCloneModel(model, modelToCloneModelMap));
|
|
254
|
+
}
|
|
255
|
+
target.set(relationValue, modelsClone);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
#pushRelationEntriesIntoRelationMap(source, target, modelToCloneModelMap, relationToCloneRelationMap) {
|
|
259
|
+
for (const [model, relations] of source) {
|
|
260
|
+
const relationsClone = new Array();
|
|
261
|
+
for (const relation of relations) {
|
|
262
|
+
relationsClone.push(this.#getCloneRelation(relation, relationToCloneRelationMap));
|
|
263
|
+
}
|
|
264
|
+
target.set(this.#getCloneModel(model, modelToCloneModelMap), relationsClone);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
#removeModelFromRelationMaps(model, relation) {
|
|
268
|
+
for (const relationKey of Reflect.ownKeys(relation)) {
|
|
269
|
+
this.#removeModelFromRelationMap(model, relationKey, relation[relationKey]);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
#removeModelFromRelationMap(model, relationKey, relationValue) {
|
|
273
|
+
const relationModels = this.#relationToModelsMaps[relationKey].get(relationValue);
|
|
274
|
+
if (relationModels !== void 0) {
|
|
275
|
+
const index = relationModels.indexOf(model);
|
|
276
|
+
if (index !== NOT_FOUND_INDEX) {
|
|
277
|
+
relationModels.splice(index, 1);
|
|
278
|
+
}
|
|
279
|
+
if (relationModels.length === 0) {
|
|
280
|
+
this.#relationToModelsMaps[relationKey].delete(relationValue);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/binding/services/ActivationsService.js
|
|
287
|
+
var ActivationRelationKind;
|
|
288
|
+
(function(ActivationRelationKind2) {
|
|
289
|
+
ActivationRelationKind2["moduleId"] = "moduleId";
|
|
290
|
+
ActivationRelationKind2["serviceId"] = "serviceId";
|
|
291
|
+
})(ActivationRelationKind || (ActivationRelationKind = {}));
|
|
292
|
+
var ActivationsService = class _ActivationsService {
|
|
293
|
+
#activationMaps;
|
|
294
|
+
#getParent;
|
|
295
|
+
constructor(getParent, activationMaps) {
|
|
296
|
+
this.#activationMaps = activationMaps ?? new OneToManyMapStar({
|
|
297
|
+
moduleId: {
|
|
298
|
+
isOptional: true
|
|
299
|
+
},
|
|
300
|
+
serviceId: {
|
|
301
|
+
isOptional: false
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
this.#getParent = getParent;
|
|
305
|
+
}
|
|
306
|
+
static build(getParent) {
|
|
307
|
+
return new _ActivationsService(getParent);
|
|
308
|
+
}
|
|
309
|
+
add(activation, relation) {
|
|
310
|
+
this.#activationMaps.add(activation, relation);
|
|
311
|
+
}
|
|
312
|
+
clone() {
|
|
313
|
+
const clone = new _ActivationsService(this.#getParent, this.#activationMaps.clone());
|
|
314
|
+
return clone;
|
|
315
|
+
}
|
|
316
|
+
get(serviceIdentifier) {
|
|
317
|
+
const activationIterables = [];
|
|
318
|
+
const activations = this.#activationMaps.get(ActivationRelationKind.serviceId, serviceIdentifier);
|
|
319
|
+
if (activations !== void 0) {
|
|
320
|
+
activationIterables.push(activations);
|
|
321
|
+
}
|
|
322
|
+
const parentActivations = this.#getParent()?.get(serviceIdentifier);
|
|
323
|
+
if (parentActivations !== void 0) {
|
|
324
|
+
activationIterables.push(parentActivations);
|
|
325
|
+
}
|
|
326
|
+
if (activationIterables.length === 0) {
|
|
327
|
+
return void 0;
|
|
328
|
+
}
|
|
329
|
+
return chain(...activationIterables);
|
|
330
|
+
}
|
|
331
|
+
removeAllByModuleId(moduleId) {
|
|
332
|
+
this.#activationMaps.removeByRelation(ActivationRelationKind.moduleId, moduleId);
|
|
333
|
+
}
|
|
334
|
+
removeAllByServiceId(serviceId) {
|
|
335
|
+
this.#activationMaps.removeByRelation(ActivationRelationKind.serviceId, serviceId);
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/reflectMetadata/data/classMetadataReflectKey.js
|
|
340
|
+
var classMetadataReflectKey = "@inversifyjs/core/classMetadataReflectKey";
|
|
341
|
+
|
|
342
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/calculations/getDefaultClassMetadata.js
|
|
343
|
+
function getDefaultClassMetadata() {
|
|
344
|
+
return {
|
|
345
|
+
constructorArguments: [],
|
|
346
|
+
lifecycle: {
|
|
347
|
+
postConstructMethodNames: /* @__PURE__ */ new Set(),
|
|
348
|
+
preDestroyMethodNames: /* @__PURE__ */ new Set()
|
|
349
|
+
},
|
|
350
|
+
properties: /* @__PURE__ */ new Map(),
|
|
351
|
+
scope: void 0
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/reflectMetadata/data/pendingClassMetadataCountReflectKey.js
|
|
356
|
+
var pendingClassMetadataCountReflectKey = "@inversifyjs/core/pendingClassMetadataCountReflectKey";
|
|
357
|
+
|
|
358
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/calculations/isPendingClassMetadata.js
|
|
359
|
+
function isPendingClassMetadata(type) {
|
|
360
|
+
const pendingClassMetadataCount = getOwnReflectMetadata(type, pendingClassMetadataCountReflectKey);
|
|
361
|
+
return pendingClassMetadataCount !== void 0 && pendingClassMetadataCount !== 0;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/error/models/InversifyCoreError.js
|
|
365
|
+
var isAppErrorSymbol = /* @__PURE__ */ Symbol.for("@inversifyjs/core/InversifyCoreError");
|
|
366
|
+
var InversifyCoreError = class _InversifyCoreError extends Error {
|
|
367
|
+
[isAppErrorSymbol];
|
|
368
|
+
kind;
|
|
369
|
+
constructor(kind, message, options) {
|
|
370
|
+
super(message, options);
|
|
371
|
+
this[isAppErrorSymbol] = true;
|
|
372
|
+
this.kind = kind;
|
|
373
|
+
}
|
|
374
|
+
static is(value) {
|
|
375
|
+
return typeof value === "object" && value !== null && value[isAppErrorSymbol] === true;
|
|
376
|
+
}
|
|
377
|
+
static isErrorOfKind(value, kind) {
|
|
378
|
+
return _InversifyCoreError.is(value) && value.kind === kind;
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/error/models/InversifyCoreErrorKind.js
|
|
383
|
+
var InversifyCoreErrorKind;
|
|
384
|
+
(function(InversifyCoreErrorKind2) {
|
|
385
|
+
InversifyCoreErrorKind2[InversifyCoreErrorKind2["injectionDecoratorConflict"] = 0] = "injectionDecoratorConflict";
|
|
386
|
+
InversifyCoreErrorKind2[InversifyCoreErrorKind2["missingInjectionDecorator"] = 1] = "missingInjectionDecorator";
|
|
387
|
+
InversifyCoreErrorKind2[InversifyCoreErrorKind2["planning"] = 2] = "planning";
|
|
388
|
+
InversifyCoreErrorKind2[InversifyCoreErrorKind2["planningMaxDepthExceeded"] = 3] = "planningMaxDepthExceeded";
|
|
389
|
+
InversifyCoreErrorKind2[InversifyCoreErrorKind2["resolution"] = 4] = "resolution";
|
|
390
|
+
InversifyCoreErrorKind2[InversifyCoreErrorKind2["unknown"] = 5] = "unknown";
|
|
391
|
+
})(InversifyCoreErrorKind || (InversifyCoreErrorKind = {}));
|
|
392
|
+
|
|
393
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/models/MaybeClassElementMetadataKind.js
|
|
394
|
+
var MaybeClassElementMetadataKind;
|
|
395
|
+
(function(MaybeClassElementMetadataKind2) {
|
|
396
|
+
MaybeClassElementMetadataKind2[MaybeClassElementMetadataKind2["unknown"] = 32] = "unknown";
|
|
397
|
+
})(MaybeClassElementMetadataKind || (MaybeClassElementMetadataKind = {}));
|
|
398
|
+
|
|
399
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/calculations/throwAtInvalidClassMetadata.js
|
|
400
|
+
function throwAtInvalidClassMetadata(type, classMetadata) {
|
|
401
|
+
const errors = [];
|
|
402
|
+
for (let i = 0; i < classMetadata.constructorArguments.length; ++i) {
|
|
403
|
+
const constructorArgument = classMetadata.constructorArguments[i];
|
|
404
|
+
if (constructorArgument === void 0 || constructorArgument.kind === MaybeClassElementMetadataKind.unknown) {
|
|
405
|
+
errors.push(` - Missing or incomplete metadata for type "${type.name}" at constructor argument with index ${i.toString()}.
|
|
406
|
+
Every constructor parameter must be decorated either with @inject, @multiInject or @unmanaged decorator.`);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
for (const [propertyKey, property] of classMetadata.properties) {
|
|
410
|
+
if (property.kind === MaybeClassElementMetadataKind.unknown) {
|
|
411
|
+
errors.push(` - Missing or incomplete metadata for type "${type.name}" at property "${propertyKey.toString()}".
|
|
412
|
+
This property must be decorated either with @inject or @multiInject decorator.`);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
if (errors.length === 0) {
|
|
416
|
+
throw new InversifyCoreError(InversifyCoreErrorKind.unknown, `Unexpected class metadata for type "${type.name}" with uncompletion traces.
|
|
417
|
+
This might be caused by one of the following reasons:
|
|
418
|
+
|
|
419
|
+
1. A third party library is targeting inversify reflection metadata.
|
|
420
|
+
2. A bug is causing the issue. Consider submiting an issue to fix it.`);
|
|
421
|
+
}
|
|
422
|
+
throw new InversifyCoreError(InversifyCoreErrorKind.missingInjectionDecorator, `Invalid class metadata at type ${type.name}:
|
|
423
|
+
|
|
424
|
+
${errors.join("\n\n")}`);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/calculations/validateConstructorMetadataArray.js
|
|
428
|
+
function validateConstructorMetadataArray(type, value) {
|
|
429
|
+
const undefinedIndexes = [];
|
|
430
|
+
if (value.length < type.length) {
|
|
431
|
+
throw new InversifyCoreError(InversifyCoreErrorKind.missingInjectionDecorator, `Found unexpected missing metadata on type "${type.name}". "${type.name}" constructor requires at least ${type.length.toString()} arguments, found ${value.length.toString()} instead.
|
|
432
|
+
Are you using @inject, @multiInject or @unmanaged decorators in every non optional constructor argument?
|
|
433
|
+
|
|
434
|
+
If you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`);
|
|
435
|
+
}
|
|
436
|
+
for (let i = 0; i < value.length; ++i) {
|
|
437
|
+
const element = value[i];
|
|
438
|
+
if (element === void 0) {
|
|
439
|
+
undefinedIndexes.push(i);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
if (undefinedIndexes.length > 0) {
|
|
443
|
+
throw new InversifyCoreError(InversifyCoreErrorKind.missingInjectionDecorator, `Found unexpected missing metadata on type "${type.name}" at constructor indexes "${undefinedIndexes.join('", "')}".
|
|
444
|
+
|
|
445
|
+
Are you using @inject, @multiInject or @unmanaged decorators at those indexes?
|
|
446
|
+
|
|
447
|
+
If you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/calculations/getClassMetadata.js
|
|
452
|
+
function getClassMetadata(type) {
|
|
453
|
+
const classMetadata = getOwnReflectMetadata(type, classMetadataReflectKey) ?? getDefaultClassMetadata();
|
|
454
|
+
if (isPendingClassMetadata(type)) {
|
|
455
|
+
throwAtInvalidClassMetadata(type, classMetadata);
|
|
456
|
+
} else {
|
|
457
|
+
validateConstructorMetadataArray(type, classMetadata.constructorArguments);
|
|
458
|
+
return classMetadata;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/binding/calculations/buildInstanceBinding.js
|
|
463
|
+
function buildInstanceBinding(autobindOptions, serviceIdentifier) {
|
|
464
|
+
const classMetadata = getClassMetadata(serviceIdentifier);
|
|
465
|
+
const scope = classMetadata.scope ?? autobindOptions.scope;
|
|
466
|
+
return {
|
|
467
|
+
cache: {
|
|
468
|
+
isRight: false,
|
|
469
|
+
value: void 0
|
|
470
|
+
},
|
|
471
|
+
id: getBindingId(),
|
|
472
|
+
implementationType: serviceIdentifier,
|
|
473
|
+
isSatisfiedBy: () => true,
|
|
474
|
+
moduleId: void 0,
|
|
475
|
+
onActivation: void 0,
|
|
476
|
+
onDeactivation: void 0,
|
|
477
|
+
scope,
|
|
478
|
+
serviceIdentifier,
|
|
479
|
+
type: bindingTypeValues.Instance
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/binding/calculations/cloneBindingCache.js
|
|
484
|
+
function cloneBindingCache(cache) {
|
|
485
|
+
if (cache.isRight) {
|
|
486
|
+
return {
|
|
487
|
+
isRight: true,
|
|
488
|
+
value: cache.value
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
return cache;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/binding/calculations/cloneConstantValueBinding.js
|
|
495
|
+
function cloneConstantValueBinding(binding) {
|
|
496
|
+
return {
|
|
497
|
+
cache: cloneBindingCache(binding.cache),
|
|
498
|
+
id: binding.id,
|
|
499
|
+
isSatisfiedBy: binding.isSatisfiedBy,
|
|
500
|
+
moduleId: binding.moduleId,
|
|
501
|
+
onActivation: binding.onActivation,
|
|
502
|
+
onDeactivation: binding.onDeactivation,
|
|
503
|
+
scope: binding.scope,
|
|
504
|
+
serviceIdentifier: binding.serviceIdentifier,
|
|
505
|
+
type: binding.type,
|
|
506
|
+
// The value is not cloned as it's a resolved value
|
|
507
|
+
value: binding.value
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/binding/calculations/cloneDynamicValueBinding.js
|
|
512
|
+
function cloneDynamicValueBinding(binding) {
|
|
513
|
+
return {
|
|
514
|
+
cache: cloneBindingCache(binding.cache),
|
|
515
|
+
id: binding.id,
|
|
516
|
+
isSatisfiedBy: binding.isSatisfiedBy,
|
|
517
|
+
moduleId: binding.moduleId,
|
|
518
|
+
onActivation: binding.onActivation,
|
|
519
|
+
onDeactivation: binding.onDeactivation,
|
|
520
|
+
scope: binding.scope,
|
|
521
|
+
serviceIdentifier: binding.serviceIdentifier,
|
|
522
|
+
type: binding.type,
|
|
523
|
+
// The value is not cloned
|
|
524
|
+
value: binding.value
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/binding/calculations/cloneFactoryBinding.js
|
|
529
|
+
function cloneFactoryBinding(binding) {
|
|
530
|
+
return {
|
|
531
|
+
cache: cloneBindingCache(binding.cache),
|
|
532
|
+
factory: binding.factory,
|
|
533
|
+
id: binding.id,
|
|
534
|
+
isSatisfiedBy: binding.isSatisfiedBy,
|
|
535
|
+
moduleId: binding.moduleId,
|
|
536
|
+
onActivation: binding.onActivation,
|
|
537
|
+
onDeactivation: binding.onDeactivation,
|
|
538
|
+
scope: binding.scope,
|
|
539
|
+
serviceIdentifier: binding.serviceIdentifier,
|
|
540
|
+
type: binding.type
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/binding/calculations/cloneInstanceBinding.js
|
|
545
|
+
function cloneInstanceBinding(binding) {
|
|
546
|
+
return {
|
|
547
|
+
cache: cloneBindingCache(binding.cache),
|
|
548
|
+
id: binding.id,
|
|
549
|
+
implementationType: binding.implementationType,
|
|
550
|
+
isSatisfiedBy: binding.isSatisfiedBy,
|
|
551
|
+
moduleId: binding.moduleId,
|
|
552
|
+
onActivation: binding.onActivation,
|
|
553
|
+
onDeactivation: binding.onDeactivation,
|
|
554
|
+
scope: binding.scope,
|
|
555
|
+
serviceIdentifier: binding.serviceIdentifier,
|
|
556
|
+
type: binding.type
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/binding/calculations/cloneResolvedValueBinding.js
|
|
561
|
+
function cloneResolvedValueBinding(binding) {
|
|
562
|
+
return {
|
|
563
|
+
cache: cloneBindingCache(binding.cache),
|
|
564
|
+
factory: binding.factory,
|
|
565
|
+
id: binding.id,
|
|
566
|
+
isSatisfiedBy: binding.isSatisfiedBy,
|
|
567
|
+
metadata: binding.metadata,
|
|
568
|
+
moduleId: binding.moduleId,
|
|
569
|
+
onActivation: binding.onActivation,
|
|
570
|
+
onDeactivation: binding.onDeactivation,
|
|
571
|
+
scope: binding.scope,
|
|
572
|
+
serviceIdentifier: binding.serviceIdentifier,
|
|
573
|
+
type: binding.type
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/binding/calculations/cloneServiceRedirectionBinding.js
|
|
578
|
+
function cloneServiceRedirectionBinding(binding) {
|
|
579
|
+
return {
|
|
580
|
+
id: binding.id,
|
|
581
|
+
isSatisfiedBy: binding.isSatisfiedBy,
|
|
582
|
+
moduleId: binding.moduleId,
|
|
583
|
+
serviceIdentifier: binding.serviceIdentifier,
|
|
584
|
+
targetServiceIdentifier: binding.targetServiceIdentifier,
|
|
585
|
+
type: binding.type
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/binding/calculations/cloneBinding.js
|
|
590
|
+
function cloneBinding(binding) {
|
|
591
|
+
switch (binding.type) {
|
|
592
|
+
case bindingTypeValues.ConstantValue:
|
|
593
|
+
return cloneConstantValueBinding(binding);
|
|
594
|
+
case bindingTypeValues.DynamicValue:
|
|
595
|
+
return cloneDynamicValueBinding(binding);
|
|
596
|
+
case bindingTypeValues.Factory:
|
|
597
|
+
return cloneFactoryBinding(binding);
|
|
598
|
+
case bindingTypeValues.Instance:
|
|
599
|
+
return cloneInstanceBinding(binding);
|
|
600
|
+
case bindingTypeValues.ResolvedValue:
|
|
601
|
+
return cloneResolvedValueBinding(binding);
|
|
602
|
+
case bindingTypeValues.ServiceRedirection:
|
|
603
|
+
return cloneServiceRedirectionBinding(binding);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/binding/services/BindingService.js
|
|
608
|
+
var BindingRelationKind;
|
|
609
|
+
(function(BindingRelationKind2) {
|
|
610
|
+
BindingRelationKind2["id"] = "id";
|
|
611
|
+
BindingRelationKind2["moduleId"] = "moduleId";
|
|
612
|
+
BindingRelationKind2["serviceId"] = "serviceId";
|
|
613
|
+
})(BindingRelationKind || (BindingRelationKind = {}));
|
|
614
|
+
var OneToManyBindingMapStar = class _OneToManyBindingMapStar extends OneToManyMapStar {
|
|
615
|
+
_buildNewInstance(spec) {
|
|
616
|
+
return new _OneToManyBindingMapStar(spec);
|
|
617
|
+
}
|
|
618
|
+
_cloneModel(model) {
|
|
619
|
+
return cloneBinding(model);
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
var BindingService = class _BindingService {
|
|
623
|
+
#autobindOptions;
|
|
624
|
+
#bindingMaps;
|
|
625
|
+
#getParent;
|
|
626
|
+
constructor(getParent, autobindOptions, bindingMaps) {
|
|
627
|
+
this.#bindingMaps = bindingMaps ?? new OneToManyBindingMapStar({
|
|
628
|
+
id: {
|
|
629
|
+
isOptional: false
|
|
630
|
+
},
|
|
631
|
+
moduleId: {
|
|
632
|
+
isOptional: true
|
|
633
|
+
},
|
|
634
|
+
serviceId: {
|
|
635
|
+
isOptional: false
|
|
636
|
+
}
|
|
637
|
+
});
|
|
638
|
+
this.#getParent = getParent;
|
|
639
|
+
this.#autobindOptions = autobindOptions;
|
|
640
|
+
}
|
|
641
|
+
static build(getParent, autobindOptions) {
|
|
642
|
+
return new _BindingService(getParent, autobindOptions);
|
|
643
|
+
}
|
|
644
|
+
clone() {
|
|
645
|
+
const clone = new _BindingService(this.#getParent, this.#autobindOptions, this.#bindingMaps.clone());
|
|
646
|
+
return clone;
|
|
647
|
+
}
|
|
648
|
+
get(serviceIdentifier) {
|
|
649
|
+
const bindings = this.getNonParentBindings(serviceIdentifier) ?? this.#getParent()?.get(serviceIdentifier);
|
|
650
|
+
if (bindings !== void 0) {
|
|
651
|
+
return bindings;
|
|
652
|
+
}
|
|
653
|
+
const autoBoundBinding = this.#tryAutobind(serviceIdentifier);
|
|
654
|
+
return autoBoundBinding === void 0 ? autoBoundBinding : [autoBoundBinding];
|
|
655
|
+
}
|
|
656
|
+
*getChained(serviceIdentifier) {
|
|
657
|
+
const currentBindings = this.getNonParentBindings(serviceIdentifier);
|
|
658
|
+
if (currentBindings !== void 0) {
|
|
659
|
+
yield* currentBindings;
|
|
660
|
+
}
|
|
661
|
+
const parent = this.#getParent();
|
|
662
|
+
if (parent === void 0) {
|
|
663
|
+
if (currentBindings === void 0) {
|
|
664
|
+
const autobindBindings = this.#tryAutobind(serviceIdentifier);
|
|
665
|
+
if (autobindBindings !== void 0) {
|
|
666
|
+
yield autobindBindings;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
} else {
|
|
670
|
+
yield* parent.getChained(serviceIdentifier);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
getBoundServices() {
|
|
674
|
+
const serviceIdentifierSet = new Set(this.#bindingMaps.getAllKeys(BindingRelationKind.serviceId));
|
|
675
|
+
const parent = this.#getParent();
|
|
676
|
+
if (parent !== void 0) {
|
|
677
|
+
for (const serviceIdentifier of parent.getBoundServices()) {
|
|
678
|
+
serviceIdentifierSet.add(serviceIdentifier);
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
return serviceIdentifierSet;
|
|
682
|
+
}
|
|
683
|
+
getById(id) {
|
|
684
|
+
return this.#bindingMaps.get(BindingRelationKind.id, id) ?? this.#getParent()?.getById(id);
|
|
685
|
+
}
|
|
686
|
+
getByModuleId(moduleId) {
|
|
687
|
+
return this.#bindingMaps.get(BindingRelationKind.moduleId, moduleId) ?? this.#getParent()?.getByModuleId(moduleId);
|
|
688
|
+
}
|
|
689
|
+
getNonParentBindings(serviceId) {
|
|
690
|
+
return this.#bindingMaps.get(BindingRelationKind.serviceId, serviceId);
|
|
691
|
+
}
|
|
692
|
+
getNonParentBoundServices() {
|
|
693
|
+
return this.#bindingMaps.getAllKeys(BindingRelationKind.serviceId);
|
|
694
|
+
}
|
|
695
|
+
removeById(id) {
|
|
696
|
+
this.#bindingMaps.removeByRelation(BindingRelationKind.id, id);
|
|
697
|
+
}
|
|
698
|
+
removeAllByModuleId(moduleId) {
|
|
699
|
+
this.#bindingMaps.removeByRelation(BindingRelationKind.moduleId, moduleId);
|
|
700
|
+
}
|
|
701
|
+
removeAllByServiceId(serviceId) {
|
|
702
|
+
this.#bindingMaps.removeByRelation(BindingRelationKind.serviceId, serviceId);
|
|
703
|
+
}
|
|
704
|
+
set(binding) {
|
|
705
|
+
const relation = {
|
|
706
|
+
[BindingRelationKind.id]: binding.id,
|
|
707
|
+
[BindingRelationKind.serviceId]: binding.serviceIdentifier
|
|
708
|
+
};
|
|
709
|
+
if (binding.moduleId !== void 0) {
|
|
710
|
+
relation[BindingRelationKind.moduleId] = binding.moduleId;
|
|
711
|
+
}
|
|
712
|
+
this.#bindingMaps.add(binding, relation);
|
|
713
|
+
}
|
|
714
|
+
#tryAutobind(serviceIdentifier) {
|
|
715
|
+
if (this.#autobindOptions === void 0 || typeof serviceIdentifier !== "function") {
|
|
716
|
+
return void 0;
|
|
717
|
+
}
|
|
718
|
+
const binding = buildInstanceBinding(this.#autobindOptions, serviceIdentifier);
|
|
719
|
+
this.set(binding);
|
|
720
|
+
return binding;
|
|
721
|
+
}
|
|
722
|
+
};
|
|
723
|
+
|
|
724
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/binding/services/DeactivationsService.js
|
|
725
|
+
var DeactivationRelationKind;
|
|
726
|
+
(function(DeactivationRelationKind2) {
|
|
727
|
+
DeactivationRelationKind2["moduleId"] = "moduleId";
|
|
728
|
+
DeactivationRelationKind2["serviceId"] = "serviceId";
|
|
729
|
+
})(DeactivationRelationKind || (DeactivationRelationKind = {}));
|
|
730
|
+
var DeactivationsService = class _DeactivationsService {
|
|
731
|
+
#deactivationMaps;
|
|
732
|
+
#getParent;
|
|
733
|
+
constructor(getParent, deactivationMaps) {
|
|
734
|
+
this.#deactivationMaps = deactivationMaps ?? new OneToManyMapStar({
|
|
735
|
+
moduleId: {
|
|
736
|
+
isOptional: true
|
|
737
|
+
},
|
|
738
|
+
serviceId: {
|
|
739
|
+
isOptional: false
|
|
740
|
+
}
|
|
741
|
+
});
|
|
742
|
+
this.#getParent = getParent;
|
|
743
|
+
}
|
|
744
|
+
static build(getParent) {
|
|
745
|
+
return new _DeactivationsService(getParent);
|
|
746
|
+
}
|
|
747
|
+
add(deactivation, relation) {
|
|
748
|
+
this.#deactivationMaps.add(deactivation, relation);
|
|
749
|
+
}
|
|
750
|
+
clone() {
|
|
751
|
+
const clone = new _DeactivationsService(this.#getParent, this.#deactivationMaps.clone());
|
|
752
|
+
return clone;
|
|
753
|
+
}
|
|
754
|
+
get(serviceIdentifier) {
|
|
755
|
+
const deactivationIterables = [];
|
|
756
|
+
const deactivations = this.#deactivationMaps.get(DeactivationRelationKind.serviceId, serviceIdentifier);
|
|
757
|
+
if (deactivations !== void 0) {
|
|
758
|
+
deactivationIterables.push(deactivations);
|
|
759
|
+
}
|
|
760
|
+
const parentDeactivations = this.#getParent()?.get(serviceIdentifier);
|
|
761
|
+
if (parentDeactivations !== void 0) {
|
|
762
|
+
deactivationIterables.push(parentDeactivations);
|
|
763
|
+
}
|
|
764
|
+
if (deactivationIterables.length === 0) {
|
|
765
|
+
return void 0;
|
|
766
|
+
}
|
|
767
|
+
return chain(...deactivationIterables);
|
|
768
|
+
}
|
|
769
|
+
removeAllByModuleId(moduleId) {
|
|
770
|
+
this.#deactivationMaps.removeByRelation(DeactivationRelationKind.moduleId, moduleId);
|
|
771
|
+
}
|
|
772
|
+
removeAllByServiceId(serviceId) {
|
|
773
|
+
this.#deactivationMaps.removeByRelation(DeactivationRelationKind.serviceId, serviceId);
|
|
774
|
+
}
|
|
775
|
+
};
|
|
776
|
+
|
|
777
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/decorator/actions/decorate.js
|
|
778
|
+
function decorate(decorators, target, parameterIndexOrProperty, parameterIndex) {
|
|
779
|
+
const parsedDecorators = Array.isArray(decorators) ? decorators : [decorators];
|
|
780
|
+
if (parameterIndexOrProperty === void 0) {
|
|
781
|
+
Reflect.decorate(parsedDecorators, target);
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
if (typeof parameterIndexOrProperty === "number") {
|
|
785
|
+
for (const decorator of parsedDecorators) {
|
|
786
|
+
decorator(target, void 0, parameterIndexOrProperty);
|
|
787
|
+
}
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
if (parameterIndex === void 0) {
|
|
791
|
+
Reflect.decorate(parsedDecorators, target.prototype, parameterIndexOrProperty);
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
794
|
+
for (const decorator of parsedDecorators) {
|
|
795
|
+
decorator(target, parameterIndexOrProperty, parameterIndex);
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/calculations/getDefaultPendingClassMetadataCount.js
|
|
800
|
+
function getDefaultPendingClassMetadataCount() {
|
|
801
|
+
return 0;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/actions/decrementPendingClassMetadataCount.js
|
|
805
|
+
function decrementPendingClassMetadataCount(type) {
|
|
806
|
+
return (metadata) => {
|
|
807
|
+
if (metadata !== void 0 && metadata.kind === MaybeClassElementMetadataKind.unknown) {
|
|
808
|
+
updateOwnReflectMetadata(type, pendingClassMetadataCountReflectKey, getDefaultPendingClassMetadataCount, (count) => count - 1);
|
|
809
|
+
}
|
|
810
|
+
};
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/models/ClassElementMetadataKind.js
|
|
814
|
+
var ClassElementMetadataKind;
|
|
815
|
+
(function(ClassElementMetadataKind2) {
|
|
816
|
+
ClassElementMetadataKind2[ClassElementMetadataKind2["multipleInjection"] = 0] = "multipleInjection";
|
|
817
|
+
ClassElementMetadataKind2[ClassElementMetadataKind2["singleInjection"] = 1] = "singleInjection";
|
|
818
|
+
ClassElementMetadataKind2[ClassElementMetadataKind2["unmanaged"] = 2] = "unmanaged";
|
|
819
|
+
})(ClassElementMetadataKind || (ClassElementMetadataKind = {}));
|
|
820
|
+
|
|
821
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/calculations/buildClassElementMetadataFromMaybeClassElementMetadata.js
|
|
822
|
+
function buildClassElementMetadataFromMaybeClassElementMetadata(buildDefaultMetadata, buildMetadataFromMaybeManagedMetadata) {
|
|
823
|
+
return (...params) => (metadata) => {
|
|
824
|
+
if (metadata === void 0) {
|
|
825
|
+
return buildDefaultMetadata(...params);
|
|
826
|
+
}
|
|
827
|
+
if (metadata.kind === ClassElementMetadataKind.unmanaged) {
|
|
828
|
+
throw new InversifyCoreError(InversifyCoreErrorKind.injectionDecoratorConflict, "Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found");
|
|
829
|
+
}
|
|
830
|
+
return buildMetadataFromMaybeManagedMetadata(metadata, ...params);
|
|
831
|
+
};
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/calculations/buildDefaultManagedMetadata.js
|
|
835
|
+
function buildDefaultManagedMetadata(kind, serviceIdentifier, options) {
|
|
836
|
+
if (kind === ClassElementMetadataKind.multipleInjection) {
|
|
837
|
+
return {
|
|
838
|
+
chained: options?.chained ?? false,
|
|
839
|
+
kind,
|
|
840
|
+
name: void 0,
|
|
841
|
+
optional: false,
|
|
842
|
+
tags: /* @__PURE__ */ new Map(),
|
|
843
|
+
value: serviceIdentifier
|
|
844
|
+
};
|
|
845
|
+
} else {
|
|
846
|
+
return {
|
|
847
|
+
kind,
|
|
848
|
+
name: void 0,
|
|
849
|
+
optional: false,
|
|
850
|
+
tags: /* @__PURE__ */ new Map(),
|
|
851
|
+
value: serviceIdentifier
|
|
852
|
+
};
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/calculations/assertMetadataFromTypescriptIfManaged.js
|
|
857
|
+
function assertMetadataFromTypescriptIfManaged(metadata) {
|
|
858
|
+
if (metadata.kind !== MaybeClassElementMetadataKind.unknown && metadata.isFromTypescriptParamType !== true) {
|
|
859
|
+
throw new InversifyCoreError(InversifyCoreErrorKind.injectionDecoratorConflict, "Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found");
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/calculations/buildManagedMetadataFromMaybeManagedMetadata.js
|
|
864
|
+
function buildManagedMetadataFromMaybeManagedMetadata(metadata, kind, serviceIdentifier, options) {
|
|
865
|
+
assertMetadataFromTypescriptIfManaged(metadata);
|
|
866
|
+
if (kind === ClassElementMetadataKind.multipleInjection) {
|
|
867
|
+
return {
|
|
868
|
+
...metadata,
|
|
869
|
+
chained: options?.chained ?? false,
|
|
870
|
+
kind,
|
|
871
|
+
value: serviceIdentifier
|
|
872
|
+
};
|
|
873
|
+
} else {
|
|
34
874
|
return {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
875
|
+
...metadata,
|
|
876
|
+
kind,
|
|
877
|
+
value: serviceIdentifier
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/calculations/buildManagedMetadataFromMaybeClassElementMetadata.js
|
|
883
|
+
var buildManagedMetadataFromMaybeClassElementMetadata = buildClassElementMetadataFromMaybeClassElementMetadata(buildDefaultManagedMetadata, buildManagedMetadataFromMaybeManagedMetadata);
|
|
884
|
+
|
|
885
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/actions/updateMaybeClassMetadataConstructorArgument.js
|
|
886
|
+
function updateMaybeClassMetadataConstructorArgument(updateMetadata, index) {
|
|
887
|
+
return (classMetadata) => {
|
|
888
|
+
const propertyMetadata = classMetadata.constructorArguments[index];
|
|
889
|
+
classMetadata.constructorArguments[index] = updateMetadata(propertyMetadata);
|
|
890
|
+
return classMetadata;
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/actions/updateMaybeClassMetadataProperty.js
|
|
895
|
+
function updateMaybeClassMetadataProperty(updateMetadata, propertyKey) {
|
|
896
|
+
return (classMetadata) => {
|
|
897
|
+
const propertyMetadata = classMetadata.properties.get(propertyKey);
|
|
898
|
+
classMetadata.properties.set(propertyKey, updateMetadata(propertyMetadata));
|
|
899
|
+
return classMetadata;
|
|
900
|
+
};
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/decorator/models/DecoratorInfoKind.js
|
|
904
|
+
var DecoratorInfoKind;
|
|
905
|
+
(function(DecoratorInfoKind2) {
|
|
906
|
+
DecoratorInfoKind2[DecoratorInfoKind2["method"] = 0] = "method";
|
|
907
|
+
DecoratorInfoKind2[DecoratorInfoKind2["parameter"] = 1] = "parameter";
|
|
908
|
+
DecoratorInfoKind2[DecoratorInfoKind2["property"] = 2] = "property";
|
|
909
|
+
})(DecoratorInfoKind || (DecoratorInfoKind = {}));
|
|
910
|
+
|
|
911
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/decorator/calculations/getDecoratorInfo.js
|
|
912
|
+
function getDecoratorInfo(target, propertyKey, parameterIndexOrDescriptor) {
|
|
913
|
+
if (parameterIndexOrDescriptor === void 0) {
|
|
914
|
+
if (propertyKey === void 0) {
|
|
915
|
+
throw new InversifyCoreError(InversifyCoreErrorKind.unknown, "Unexpected undefined property and index values");
|
|
916
|
+
}
|
|
917
|
+
return {
|
|
918
|
+
kind: DecoratorInfoKind.property,
|
|
919
|
+
property: propertyKey,
|
|
920
|
+
targetClass: target.constructor
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
if (typeof parameterIndexOrDescriptor === "number") {
|
|
924
|
+
return {
|
|
925
|
+
index: parameterIndexOrDescriptor,
|
|
926
|
+
kind: DecoratorInfoKind.parameter,
|
|
927
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
928
|
+
targetClass: target
|
|
929
|
+
};
|
|
930
|
+
}
|
|
931
|
+
return {
|
|
932
|
+
kind: DecoratorInfoKind.method,
|
|
933
|
+
method: propertyKey,
|
|
934
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
935
|
+
targetClass: target
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/decorator/calculations/stringifyDecoratorInfo.js
|
|
940
|
+
function stringifyDecoratorInfo(decoratorTargetInfo) {
|
|
941
|
+
switch (decoratorTargetInfo.kind) {
|
|
942
|
+
case DecoratorInfoKind.method:
|
|
943
|
+
return `[class: "${decoratorTargetInfo.targetClass.name}", method: "${decoratorTargetInfo.method.toString()}"]`;
|
|
944
|
+
case DecoratorInfoKind.parameter:
|
|
945
|
+
return `[class: "${decoratorTargetInfo.targetClass.name}", index: "${decoratorTargetInfo.index.toString()}"]`;
|
|
946
|
+
case DecoratorInfoKind.property:
|
|
947
|
+
return `[class: "${decoratorTargetInfo.targetClass.name}", property: "${decoratorTargetInfo.property.toString()}"]`;
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/calculations/handleInjectionError.js
|
|
952
|
+
function handleInjectionError(target, propertyKey, parameterIndex, error) {
|
|
953
|
+
if (InversifyCoreError.isErrorOfKind(error, InversifyCoreErrorKind.injectionDecoratorConflict)) {
|
|
954
|
+
const info = getDecoratorInfo(target, propertyKey, parameterIndex);
|
|
955
|
+
throw new InversifyCoreError(InversifyCoreErrorKind.injectionDecoratorConflict, `Unexpected injection error.
|
|
956
|
+
|
|
957
|
+
Cause:
|
|
958
|
+
|
|
959
|
+
${error.message}
|
|
960
|
+
|
|
961
|
+
Details
|
|
962
|
+
|
|
963
|
+
${stringifyDecoratorInfo(info)}`, { cause: error });
|
|
964
|
+
}
|
|
965
|
+
throw error;
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/decorators/injectBase.js
|
|
969
|
+
function injectBase(updateMetadata, updatePendingClassMetadataCount) {
|
|
970
|
+
const decorator = (target, propertyKey, parameterIndexOrDescriptor) => {
|
|
971
|
+
try {
|
|
972
|
+
if (parameterIndexOrDescriptor === void 0) {
|
|
973
|
+
injectProperty(updateMetadata, updatePendingClassMetadataCount)(target, propertyKey);
|
|
974
|
+
} else {
|
|
975
|
+
if (typeof parameterIndexOrDescriptor === "number") {
|
|
976
|
+
injectParameter(updateMetadata, updatePendingClassMetadataCount)(target, propertyKey, parameterIndexOrDescriptor);
|
|
977
|
+
} else {
|
|
978
|
+
injectMethod(updateMetadata, updatePendingClassMetadataCount)(target, propertyKey, parameterIndexOrDescriptor);
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
} catch (error) {
|
|
982
|
+
handleInjectionError(target, propertyKey, parameterIndexOrDescriptor, error);
|
|
983
|
+
}
|
|
984
|
+
};
|
|
985
|
+
return decorator;
|
|
986
|
+
}
|
|
987
|
+
function buildComposedUpdateMetadata(updateMetadata, updatePendingClassMetadataCount) {
|
|
988
|
+
return (target) => {
|
|
989
|
+
const updateTargetPendingClassMetadataCount = updatePendingClassMetadataCount(target);
|
|
990
|
+
return (metadata) => {
|
|
991
|
+
updateTargetPendingClassMetadataCount(metadata);
|
|
992
|
+
return updateMetadata(metadata);
|
|
993
|
+
};
|
|
994
|
+
};
|
|
995
|
+
}
|
|
996
|
+
function injectMethod(updateMetadata, updatePendingClassMetadataCount) {
|
|
997
|
+
const buildComposedUpdateMetadataFromTarget = buildComposedUpdateMetadata(updateMetadata, updatePendingClassMetadataCount);
|
|
998
|
+
return (target, propertyKey, descriptor) => {
|
|
999
|
+
if (isPropertySetter(descriptor)) {
|
|
1000
|
+
updateOwnReflectMetadata(target.constructor, classMetadataReflectKey, getDefaultClassMetadata, updateMaybeClassMetadataProperty(buildComposedUpdateMetadataFromTarget(target), propertyKey));
|
|
1001
|
+
} else {
|
|
1002
|
+
throw new InversifyCoreError(InversifyCoreErrorKind.injectionDecoratorConflict, `Found an @inject decorator in a non setter property method.
|
|
1003
|
+
Found @inject decorator at method "${propertyKey.toString()}" at class "${target.constructor.name}"`);
|
|
1004
|
+
}
|
|
1005
|
+
};
|
|
1006
|
+
}
|
|
1007
|
+
function injectParameter(updateMetadata, updatePendingClassMetadataCount) {
|
|
1008
|
+
const buildComposedUpdateMetadataFromTarget = buildComposedUpdateMetadata(updateMetadata, updatePendingClassMetadataCount);
|
|
1009
|
+
return (target, propertyKey, parameterIndex) => {
|
|
1010
|
+
if (isConstructorParameter(target, propertyKey)) {
|
|
1011
|
+
updateOwnReflectMetadata(target, classMetadataReflectKey, getDefaultClassMetadata, updateMaybeClassMetadataConstructorArgument(buildComposedUpdateMetadataFromTarget(target), parameterIndex));
|
|
1012
|
+
} else {
|
|
1013
|
+
throw new InversifyCoreError(InversifyCoreErrorKind.injectionDecoratorConflict, `Found an @inject decorator in a non constructor parameter.
|
|
1014
|
+
Found @inject decorator at method "${propertyKey?.toString() ?? ""}" at class "${target.constructor.name}"`);
|
|
1015
|
+
}
|
|
1016
|
+
};
|
|
1017
|
+
}
|
|
1018
|
+
function injectProperty(updateMetadata, updatePendingClassMetadataCount) {
|
|
1019
|
+
const buildComposedUpdateMetadataFromTarget = buildComposedUpdateMetadata(updateMetadata, updatePendingClassMetadataCount);
|
|
1020
|
+
return (target, propertyKey) => {
|
|
1021
|
+
updateOwnReflectMetadata(target.constructor, classMetadataReflectKey, getDefaultClassMetadata, updateMaybeClassMetadataProperty(buildComposedUpdateMetadataFromTarget(target), propertyKey));
|
|
1022
|
+
};
|
|
1023
|
+
}
|
|
1024
|
+
function isConstructorParameter(target, propertyKey) {
|
|
1025
|
+
return typeof target === "function" && propertyKey === void 0;
|
|
1026
|
+
}
|
|
1027
|
+
function isPropertySetter(descriptor) {
|
|
1028
|
+
return descriptor.set !== void 0;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/decorators/inject.js
|
|
1032
|
+
function inject(serviceIdentifier) {
|
|
1033
|
+
const updateMetadata = buildManagedMetadataFromMaybeClassElementMetadata(ClassElementMetadataKind.singleInjection, serviceIdentifier);
|
|
1034
|
+
return injectBase(updateMetadata, decrementPendingClassMetadataCount);
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/reflectMetadata/data/classIsInjectableFlagReflectKey.js
|
|
1038
|
+
var classIsInjectableFlagReflectKey = "@inversifyjs/core/classIsInjectableFlagReflectKey";
|
|
1039
|
+
|
|
1040
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/actions/setIsInjectableFlag.js
|
|
1041
|
+
function setIsInjectableFlag(target) {
|
|
1042
|
+
const isInjectableFlag = getOwnReflectMetadata(target, classIsInjectableFlagReflectKey);
|
|
1043
|
+
if (isInjectableFlag !== void 0) {
|
|
1044
|
+
throw new InversifyCoreError(InversifyCoreErrorKind.injectionDecoratorConflict, `Cannot apply @injectable decorator multiple times at class "${target.name}"`);
|
|
1045
|
+
}
|
|
1046
|
+
setReflectMetadata(target, classIsInjectableFlagReflectKey, true);
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/reflectMetadata/data/typescriptDesignParameterTypesReflectKey.js
|
|
1050
|
+
var typescriptParameterTypesReflectKey = "design:paramtypes";
|
|
1051
|
+
|
|
1052
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/calculations/buildClassElementMetadataFromTypescriptParameterType.js
|
|
1053
|
+
function buildClassElementMetadataFromTypescriptParameterType(type) {
|
|
1054
|
+
return {
|
|
1055
|
+
isFromTypescriptParamType: true,
|
|
1056
|
+
kind: ClassElementMetadataKind.singleInjection,
|
|
1057
|
+
name: void 0,
|
|
1058
|
+
optional: false,
|
|
1059
|
+
tags: /* @__PURE__ */ new Map(),
|
|
1060
|
+
value: type
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/calculations/isUserlandEmittedType.js
|
|
1065
|
+
var NON_USERLAND_TYPES = [
|
|
1066
|
+
Array,
|
|
1067
|
+
BigInt,
|
|
1068
|
+
Boolean,
|
|
1069
|
+
Function,
|
|
1070
|
+
Number,
|
|
1071
|
+
Object,
|
|
1072
|
+
String
|
|
1073
|
+
];
|
|
1074
|
+
function isUserlandEmittedType(type) {
|
|
1075
|
+
return !NON_USERLAND_TYPES.includes(type);
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/actions/updateClassMetadataWithTypescriptParameterTypes.js
|
|
1079
|
+
function updateClassMetadataWithTypescriptParameterTypes(target) {
|
|
1080
|
+
const typescriptConstructorArguments = getOwnReflectMetadata(target, typescriptParameterTypesReflectKey);
|
|
1081
|
+
if (typescriptConstructorArguments !== void 0) {
|
|
1082
|
+
updateOwnReflectMetadata(target, classMetadataReflectKey, getDefaultClassMetadata, updateMaybeClassMetadataWithTypescriptClassMetadata(typescriptConstructorArguments));
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
function updateMaybeClassMetadataWithTypescriptClassMetadata(typescriptConstructorArguments) {
|
|
1086
|
+
return (classMetadata) => {
|
|
1087
|
+
typescriptConstructorArguments.forEach((constructorArgumentType, index) => {
|
|
1088
|
+
if (classMetadata.constructorArguments[index] === void 0 && isUserlandEmittedType(constructorArgumentType)) {
|
|
1089
|
+
classMetadata.constructorArguments[index] = buildClassElementMetadataFromTypescriptParameterType(constructorArgumentType);
|
|
1090
|
+
}
|
|
1091
|
+
});
|
|
1092
|
+
return classMetadata;
|
|
1093
|
+
};
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/decorators/injectable.js
|
|
1097
|
+
function injectable(scope) {
|
|
1098
|
+
return (target) => {
|
|
1099
|
+
setIsInjectableFlag(target);
|
|
1100
|
+
updateClassMetadataWithTypescriptParameterTypes(target);
|
|
1101
|
+
if (scope !== void 0) {
|
|
1102
|
+
updateOwnReflectMetadata(target, classMetadataReflectKey, getDefaultClassMetadata, (metadata) => ({
|
|
1103
|
+
...metadata,
|
|
1104
|
+
scope
|
|
1105
|
+
}));
|
|
1106
|
+
}
|
|
1107
|
+
};
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/calculations/buildDefaultUnmanagedMetadata.js
|
|
1111
|
+
function buildDefaultUnmanagedMetadata() {
|
|
1112
|
+
return {
|
|
1113
|
+
kind: ClassElementMetadataKind.unmanaged
|
|
1114
|
+
};
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/calculations/buildUnmanagedMetadataFromMaybeManagedMetadata.js
|
|
1118
|
+
function buildUnmanagedMetadataFromMaybeManagedMetadata(metadata) {
|
|
1119
|
+
assertMetadataFromTypescriptIfManaged(metadata);
|
|
1120
|
+
if (hasManagedMetadata(metadata)) {
|
|
1121
|
+
throw new InversifyCoreError(InversifyCoreErrorKind.injectionDecoratorConflict, "Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections");
|
|
1122
|
+
}
|
|
1123
|
+
return buildDefaultUnmanagedMetadata();
|
|
1124
|
+
}
|
|
1125
|
+
function hasManagedMetadata(metadata) {
|
|
1126
|
+
return metadata.name !== void 0 || metadata.optional || metadata.tags.size > 0;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/calculations/buildUnmanagedMetadataFromMaybeClassElementMetadata.js
|
|
1130
|
+
var buildUnmanagedMetadataFromMaybeClassElementMetadata = buildClassElementMetadataFromMaybeClassElementMetadata(buildDefaultUnmanagedMetadata, buildUnmanagedMetadataFromMaybeManagedMetadata);
|
|
1131
|
+
|
|
1132
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/decorators/unmanaged.js
|
|
1133
|
+
function unmanaged() {
|
|
1134
|
+
const updateMetadata = buildUnmanagedMetadataFromMaybeClassElementMetadata();
|
|
1135
|
+
return injectBase(updateMetadata, decrementPendingClassMetadataCount);
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/metadata/models/ResolvedValueElementMetadataKind.js
|
|
1139
|
+
var ResolvedValueElementMetadataKind;
|
|
1140
|
+
(function(ResolvedValueElementMetadataKind2) {
|
|
1141
|
+
ResolvedValueElementMetadataKind2[ResolvedValueElementMetadataKind2["multipleInjection"] = 0] = "multipleInjection";
|
|
1142
|
+
ResolvedValueElementMetadataKind2[ResolvedValueElementMetadataKind2["singleInjection"] = 1] = "singleInjection";
|
|
1143
|
+
})(ResolvedValueElementMetadataKind || (ResolvedValueElementMetadataKind = {}));
|
|
1144
|
+
|
|
1145
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/calculations/buildGetPlanOptionsFromPlanParams.js
|
|
1146
|
+
function buildGetPlanOptionsFromPlanParams(params) {
|
|
1147
|
+
if (params.rootConstraints.isMultiple) {
|
|
1148
|
+
return {
|
|
1149
|
+
chained: params.rootConstraints.chained,
|
|
1150
|
+
isMultiple: true,
|
|
1151
|
+
name: params.rootConstraints.name,
|
|
1152
|
+
optional: params.rootConstraints.isOptional ?? false,
|
|
1153
|
+
serviceIdentifier: params.rootConstraints.serviceIdentifier,
|
|
1154
|
+
tag: params.rootConstraints.tag
|
|
1155
|
+
};
|
|
1156
|
+
} else {
|
|
1157
|
+
return {
|
|
1158
|
+
isMultiple: false,
|
|
1159
|
+
name: params.rootConstraints.name,
|
|
1160
|
+
optional: params.rootConstraints.isOptional ?? false,
|
|
1161
|
+
serviceIdentifier: params.rootConstraints.serviceIdentifier,
|
|
1162
|
+
tag: params.rootConstraints.tag
|
|
1163
|
+
};
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/error/calculations/isStackOverflowError.js
|
|
1168
|
+
var STACK_OVERFLOW_PATTERNS = /stack space|call stack|too much recursion/i;
|
|
1169
|
+
var SPIDER_MONKEY_REGEXP = /too much recursion/;
|
|
1170
|
+
function isStackOverflowError(error) {
|
|
1171
|
+
try {
|
|
1172
|
+
if (!(error instanceof Error)) {
|
|
1173
|
+
return false;
|
|
1174
|
+
}
|
|
1175
|
+
return (
|
|
1176
|
+
// V8 and JavaScriptCore typically throw RangeError
|
|
1177
|
+
error instanceof RangeError && STACK_OVERFLOW_PATTERNS.test(error.message) || error.name === "InternalError" && SPIDER_MONKEY_REGEXP.test(error.message)
|
|
1178
|
+
);
|
|
1179
|
+
} catch (innerError) {
|
|
1180
|
+
return innerError instanceof SyntaxError && innerError.message.includes("Stack overflow");
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/calculations/handlePlanError.js
|
|
1185
|
+
function extractLikelyCircularDependency(params) {
|
|
1186
|
+
const serviceIdentifiers = /* @__PURE__ */ new Set();
|
|
1187
|
+
for (const serviceIdentifier of params.servicesBranch) {
|
|
1188
|
+
if (serviceIdentifiers.has(serviceIdentifier)) {
|
|
1189
|
+
return [...serviceIdentifiers, serviceIdentifier];
|
|
1190
|
+
}
|
|
1191
|
+
serviceIdentifiers.add(serviceIdentifier);
|
|
1192
|
+
}
|
|
1193
|
+
return [...serviceIdentifiers];
|
|
1194
|
+
}
|
|
1195
|
+
function handlePlanError(params, error) {
|
|
1196
|
+
if (isStackOverflowError(error) || InversifyCoreError.isErrorOfKind(error, InversifyCoreErrorKind.planningMaxDepthExceeded)) {
|
|
1197
|
+
const stringifiedCircularDependencies = stringifyServiceIdentifierTrace(extractLikelyCircularDependency(params));
|
|
1198
|
+
throw new InversifyCoreError(InversifyCoreErrorKind.planning, `Circular dependency found: ${stringifiedCircularDependencies}`, { cause: error });
|
|
1199
|
+
}
|
|
1200
|
+
throw error;
|
|
1201
|
+
}
|
|
1202
|
+
function stringifyServiceIdentifierTrace(serviceIdentifiers) {
|
|
1203
|
+
const serviceIdentifiersArray = [...serviceIdentifiers];
|
|
1204
|
+
if (serviceIdentifiersArray.length === 0) {
|
|
1205
|
+
return "(No dependency trace)";
|
|
1206
|
+
}
|
|
1207
|
+
return serviceIdentifiersArray.map(stringifyServiceIdentifier).join(" -> ");
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/models/LazyPlanServiceNode.js
|
|
1211
|
+
var isLazyPlanServiceNodeSymbol = /* @__PURE__ */ Symbol.for("@inversifyjs/core/LazyPlanServiceNode");
|
|
1212
|
+
var LazyPlanServiceNode = class {
|
|
1213
|
+
[isLazyPlanServiceNodeSymbol];
|
|
1214
|
+
_serviceIdentifier;
|
|
1215
|
+
_serviceNode;
|
|
1216
|
+
constructor(serviceNode, serviceIdentifier) {
|
|
1217
|
+
this[isLazyPlanServiceNodeSymbol] = true;
|
|
1218
|
+
this._serviceNode = serviceNode;
|
|
1219
|
+
this._serviceIdentifier = serviceIdentifier;
|
|
1220
|
+
}
|
|
1221
|
+
get bindings() {
|
|
1222
|
+
return this._getNode().bindings;
|
|
1223
|
+
}
|
|
1224
|
+
get isContextFree() {
|
|
1225
|
+
return this._getNode().isContextFree;
|
|
1226
|
+
}
|
|
1227
|
+
get serviceIdentifier() {
|
|
1228
|
+
return this._serviceIdentifier;
|
|
1229
|
+
}
|
|
1230
|
+
set bindings(bindings) {
|
|
1231
|
+
this._getNode().bindings = bindings;
|
|
1232
|
+
}
|
|
1233
|
+
set isContextFree(isContextFree) {
|
|
1234
|
+
this._getNode().isContextFree = isContextFree;
|
|
1235
|
+
}
|
|
1236
|
+
static is(value) {
|
|
1237
|
+
return typeof value === "object" && value !== null && value[isLazyPlanServiceNodeSymbol] === true;
|
|
1238
|
+
}
|
|
1239
|
+
invalidate() {
|
|
1240
|
+
this._serviceNode = void 0;
|
|
1241
|
+
}
|
|
1242
|
+
isExpanded() {
|
|
1243
|
+
return this._serviceNode !== void 0;
|
|
1244
|
+
}
|
|
1245
|
+
_getNode() {
|
|
1246
|
+
if (this._serviceNode === void 0) {
|
|
1247
|
+
this._serviceNode = this._buildPlanServiceNode();
|
|
1248
|
+
}
|
|
1249
|
+
return this._serviceNode;
|
|
1250
|
+
}
|
|
1251
|
+
};
|
|
1252
|
+
|
|
1253
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/binding/models/BindingConstraintsImplementation.js
|
|
1254
|
+
var BindingConstraintsImplementation = class _BindingConstraintsImplementation {
|
|
1255
|
+
#node;
|
|
1256
|
+
constructor(node) {
|
|
1257
|
+
this.#node = node;
|
|
1258
|
+
}
|
|
1259
|
+
get name() {
|
|
1260
|
+
return this.#node.elem.name;
|
|
1261
|
+
}
|
|
1262
|
+
get serviceIdentifier() {
|
|
1263
|
+
return this.#node.elem.serviceIdentifier;
|
|
1264
|
+
}
|
|
1265
|
+
get tags() {
|
|
1266
|
+
return this.#node.elem.tags;
|
|
1267
|
+
}
|
|
1268
|
+
getAncestor() {
|
|
1269
|
+
this.#node.elem.getAncestorsCalled = true;
|
|
1270
|
+
if (this.#node.previous === void 0) {
|
|
1271
|
+
return void 0;
|
|
1272
|
+
}
|
|
1273
|
+
return new _BindingConstraintsImplementation(this.#node.previous);
|
|
1274
|
+
}
|
|
1275
|
+
};
|
|
1276
|
+
|
|
1277
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/calculations/buildFilteredServiceBindings.js
|
|
1278
|
+
function buildFilteredServiceBindings(params, bindingConstraints, options) {
|
|
1279
|
+
const serviceIdentifier = options?.customServiceIdentifier ?? bindingConstraints.serviceIdentifier;
|
|
1280
|
+
const serviceBindings = options?.chained === true ? [...params.operations.getBindingsChained(serviceIdentifier)] : [...params.operations.getBindings(serviceIdentifier) ?? []];
|
|
1281
|
+
const filteredBindings = serviceBindings.filter((binding) => binding.isSatisfiedBy(bindingConstraints));
|
|
1282
|
+
if (filteredBindings.length === 0 && params.autobindOptions !== void 0 && typeof serviceIdentifier === "function") {
|
|
1283
|
+
const binding = buildInstanceBinding(params.autobindOptions, serviceIdentifier);
|
|
1284
|
+
params.operations.setBinding(binding);
|
|
1285
|
+
if (binding.isSatisfiedBy(bindingConstraints)) {
|
|
1286
|
+
filteredBindings.push(binding);
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
return filteredBindings;
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/common/models/SingleImmutableLinkedList.js
|
|
1293
|
+
var SingleImmutableLinkedList = class _SingleImmutableLinkedList {
|
|
1294
|
+
last;
|
|
1295
|
+
length;
|
|
1296
|
+
constructor(last, length) {
|
|
1297
|
+
this.last = last;
|
|
1298
|
+
this.length = length;
|
|
1299
|
+
}
|
|
1300
|
+
concat(elem) {
|
|
1301
|
+
return new _SingleImmutableLinkedList({
|
|
1302
|
+
elem,
|
|
1303
|
+
previous: this.last
|
|
1304
|
+
}, this.length + 1);
|
|
1305
|
+
}
|
|
1306
|
+
[Symbol.iterator]() {
|
|
1307
|
+
let node = this.last;
|
|
1308
|
+
return {
|
|
1309
|
+
next: () => {
|
|
1310
|
+
if (node === void 0) {
|
|
1311
|
+
return {
|
|
1312
|
+
done: true,
|
|
1313
|
+
value: void 0
|
|
1314
|
+
};
|
|
1315
|
+
}
|
|
1316
|
+
const elem = node.elem;
|
|
1317
|
+
node = node.previous;
|
|
1318
|
+
return {
|
|
1319
|
+
done: false,
|
|
1320
|
+
value: elem
|
|
1321
|
+
};
|
|
1322
|
+
}
|
|
1323
|
+
};
|
|
1324
|
+
}
|
|
1325
|
+
};
|
|
1326
|
+
|
|
1327
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/calculations/buildPlanBindingConstraintsList.js
|
|
1328
|
+
function buildPlanBindingConstraintsList(params) {
|
|
1329
|
+
const tags = /* @__PURE__ */ new Map();
|
|
1330
|
+
if (params.rootConstraints.tag !== void 0) {
|
|
1331
|
+
tags.set(params.rootConstraints.tag.key, params.rootConstraints.tag.value);
|
|
1332
|
+
}
|
|
1333
|
+
return new SingleImmutableLinkedList({
|
|
1334
|
+
elem: {
|
|
1335
|
+
getAncestorsCalled: false,
|
|
1336
|
+
name: params.rootConstraints.name,
|
|
1337
|
+
serviceIdentifier: params.rootConstraints.serviceIdentifier,
|
|
1338
|
+
tags
|
|
1339
|
+
},
|
|
1340
|
+
previous: void 0
|
|
1341
|
+
}, 1);
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/calculations/isPlanServiceRedirectionBindingNode.js
|
|
1345
|
+
function isPlanServiceRedirectionBindingNode(node) {
|
|
1346
|
+
return node.redirections !== void 0;
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/binding/calculations/stringifyBinding.js
|
|
1350
|
+
function stringifyBinding(binding) {
|
|
1351
|
+
switch (binding.type) {
|
|
1352
|
+
case bindingTypeValues.Instance:
|
|
1353
|
+
return `[ type: "${binding.type}", serviceIdentifier: "${stringifyServiceIdentifier(binding.serviceIdentifier)}", scope: "${binding.scope}", implementationType: "${binding.implementationType.name}" ]`;
|
|
1354
|
+
case bindingTypeValues.ServiceRedirection:
|
|
1355
|
+
return `[ type: "${binding.type}", serviceIdentifier: "${stringifyServiceIdentifier(binding.serviceIdentifier)}", redirection: "${stringifyServiceIdentifier(binding.targetServiceIdentifier)}" ]`;
|
|
1356
|
+
default:
|
|
1357
|
+
return `[ type: "${binding.type}", serviceIdentifier: "${stringifyServiceIdentifier(binding.serviceIdentifier)}", scope: "${binding.scope}" ]`;
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/calculations/throwErrorWhenUnexpectedBindingsAmountFound.js
|
|
1362
|
+
function throwErrorWhenUnexpectedBindingsAmountFound(bindingNodes, isOptional, bindingConstraintNode, serviceRedirections) {
|
|
1363
|
+
const serviceIdentifier = bindingConstraintNode.elem.serviceIdentifier;
|
|
1364
|
+
const parentServiceIdentifier = bindingConstraintNode.previous?.elem.serviceIdentifier;
|
|
1365
|
+
if (Array.isArray(bindingNodes)) {
|
|
1366
|
+
throwErrorWhenMultipleUnexpectedBindingsAmountFound(bindingNodes, isOptional, serviceIdentifier, parentServiceIdentifier, bindingConstraintNode.elem, serviceRedirections);
|
|
1367
|
+
} else {
|
|
1368
|
+
throwErrorWhenSingleUnexpectedBindingFound(bindingNodes, isOptional, serviceIdentifier, parentServiceIdentifier, bindingConstraintNode.elem, serviceRedirections);
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
function throwBindingNotFoundError(serviceIdentifier, parentServiceIdentifier, bindingConstraints, serviceRedirections) {
|
|
1372
|
+
const lastResolvedServiceIdentifier = serviceRedirections[serviceRedirections.length - 1] ?? serviceIdentifier;
|
|
1373
|
+
const errorMessage = `No bindings found for service: "${stringifyServiceIdentifier(lastResolvedServiceIdentifier)}".
|
|
1374
|
+
|
|
1375
|
+
Trying to resolve bindings for "${stringifyParentServiceIdentifier(serviceIdentifier, parentServiceIdentifier)}".${stringifyServiceRedirections(serviceRedirections)}${stringifyBindingConstraints(bindingConstraints)}`;
|
|
1376
|
+
throw new InversifyCoreError(InversifyCoreErrorKind.planning, errorMessage);
|
|
1377
|
+
}
|
|
1378
|
+
function throwErrorWhenMultipleUnexpectedBindingsAmountFound(bindingNodes, isOptional, serviceIdentifier, parentServiceIdentifier, bindingConstraints, serviceRedirections) {
|
|
1379
|
+
if (bindingNodes.length === 0) {
|
|
1380
|
+
if (!isOptional) {
|
|
1381
|
+
throwBindingNotFoundError(serviceIdentifier, parentServiceIdentifier, bindingConstraints, serviceRedirections);
|
|
1382
|
+
}
|
|
1383
|
+
} else {
|
|
1384
|
+
const lastResolvedServiceIdentifier = serviceRedirections[serviceRedirections.length - 1] ?? serviceIdentifier;
|
|
1385
|
+
const errorMessage = `Ambiguous bindings found for service: "${stringifyServiceIdentifier(lastResolvedServiceIdentifier)}".${stringifyServiceRedirections(serviceRedirections)}
|
|
1386
|
+
|
|
1387
|
+
Registered bindings:
|
|
1388
|
+
|
|
1389
|
+
${bindingNodes.map((bindingNode) => stringifyBinding(bindingNode.binding)).join("\n")}
|
|
1390
|
+
|
|
1391
|
+
Trying to resolve bindings for "${stringifyParentServiceIdentifier(serviceIdentifier, parentServiceIdentifier)}".${stringifyBindingConstraints(bindingConstraints)}`;
|
|
1392
|
+
throw new InversifyCoreError(InversifyCoreErrorKind.planning, errorMessage);
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
function throwErrorWhenSingleUnexpectedBindingFound(bindingNode, isOptional, serviceIdentifier, parentServiceIdentifier, bindingConstraints, serviceRedirections) {
|
|
1396
|
+
if (bindingNode === void 0 && !isOptional) {
|
|
1397
|
+
throwBindingNotFoundError(serviceIdentifier, parentServiceIdentifier, bindingConstraints, serviceRedirections);
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
function stringifyParentServiceIdentifier(serviceIdentifier, parentServiceIdentifier) {
|
|
1401
|
+
return parentServiceIdentifier === void 0 ? `${stringifyServiceIdentifier(serviceIdentifier)} (Root service)` : stringifyServiceIdentifier(parentServiceIdentifier);
|
|
1402
|
+
}
|
|
1403
|
+
function stringifyBindingConstraints(bindingConstraints) {
|
|
1404
|
+
const stringifiedTags = bindingConstraints.tags.size === 0 ? "" : `
|
|
1405
|
+
- tags:
|
|
1406
|
+
- ${[...bindingConstraints.tags.keys()].map((key) => key.toString()).join("\n - ")}`;
|
|
1407
|
+
return `
|
|
1408
|
+
|
|
1409
|
+
Binding constraints:
|
|
1410
|
+
- service identifier: ${stringifyServiceIdentifier(bindingConstraints.serviceIdentifier)}
|
|
1411
|
+
- name: ${bindingConstraints.name?.toString() ?? "-"}${stringifiedTags}`;
|
|
1412
|
+
}
|
|
1413
|
+
function stringifyServiceRedirections(serviceRedirections) {
|
|
1414
|
+
return serviceRedirections.length === 0 ? "" : `
|
|
1415
|
+
|
|
1416
|
+
- service redirections:
|
|
1417
|
+
- ${serviceRedirections.map((serviceIdentifier) => stringifyServiceIdentifier(serviceIdentifier)).join("\n - ")}`;
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/calculations/checkPlanServiceRedirectionBindingNodeSingleInjectionBindings.js
|
|
1421
|
+
var SINGLE_INJECTION_BINDINGS = 1;
|
|
1422
|
+
function checkPlanServiceRedirectionBindingNodeSingleInjectionBindings(serviceRedirectionBindingNode, isOptional, bindingConstraintNode, serviceRedirections) {
|
|
1423
|
+
if (serviceRedirectionBindingNode.redirections.length === SINGLE_INJECTION_BINDINGS) {
|
|
1424
|
+
const [planBindingNode] = serviceRedirectionBindingNode.redirections;
|
|
1425
|
+
if (isPlanServiceRedirectionBindingNode(planBindingNode)) {
|
|
1426
|
+
checkPlanServiceRedirectionBindingNodeSingleInjectionBindings(planBindingNode, isOptional, bindingConstraintNode, [
|
|
1427
|
+
...serviceRedirections,
|
|
1428
|
+
planBindingNode.binding.targetServiceIdentifier
|
|
1429
|
+
]);
|
|
1430
|
+
}
|
|
1431
|
+
return;
|
|
1432
|
+
}
|
|
1433
|
+
throwErrorWhenUnexpectedBindingsAmountFound(serviceRedirectionBindingNode.redirections, isOptional, bindingConstraintNode, serviceRedirections);
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/calculations/checkServiceNodeSingleInjectionBindings.js
|
|
1437
|
+
var SINGLE_INJECTION_BINDINGS2 = 1;
|
|
1438
|
+
function checkServiceNodeSingleInjectionBindings(serviceNode, isOptional, bindingConstraintNode) {
|
|
1439
|
+
if (Array.isArray(serviceNode.bindings)) {
|
|
1440
|
+
if (serviceNode.bindings.length === SINGLE_INJECTION_BINDINGS2) {
|
|
1441
|
+
const [planBindingNode] = serviceNode.bindings;
|
|
1442
|
+
if (isPlanServiceRedirectionBindingNode(planBindingNode)) {
|
|
1443
|
+
checkPlanServiceRedirectionBindingNodeSingleInjectionBindings(planBindingNode, isOptional, bindingConstraintNode, [planBindingNode.binding.targetServiceIdentifier]);
|
|
1444
|
+
}
|
|
1445
|
+
return;
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
throwErrorWhenUnexpectedBindingsAmountFound(serviceNode.bindings, isOptional, bindingConstraintNode, []);
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/actions/curryBuildPlanServiceNode.js
|
|
1452
|
+
function curryBuildPlanServiceNode(buildServiceNodeBindings3) {
|
|
1453
|
+
return (params) => {
|
|
1454
|
+
const bindingConstraintsList = buildPlanBindingConstraintsList(params);
|
|
1455
|
+
const bindingConstraints = new BindingConstraintsImplementation(bindingConstraintsList.last);
|
|
1456
|
+
const chained = params.rootConstraints.isMultiple && params.rootConstraints.chained;
|
|
1457
|
+
const filteredServiceBindings = buildFilteredServiceBindings(params, bindingConstraints, {
|
|
1458
|
+
chained
|
|
1459
|
+
});
|
|
1460
|
+
const serviceNodeBindings = [];
|
|
1461
|
+
const serviceNode = {
|
|
1462
|
+
bindings: serviceNodeBindings,
|
|
1463
|
+
isContextFree: true,
|
|
1464
|
+
serviceIdentifier: params.rootConstraints.serviceIdentifier
|
|
1465
|
+
};
|
|
1466
|
+
serviceNodeBindings.push(...buildServiceNodeBindings3(params, bindingConstraintsList, filteredServiceBindings, serviceNode, chained));
|
|
1467
|
+
serviceNode.isContextFree = !bindingConstraintsList.last.elem.getAncestorsCalled;
|
|
1468
|
+
if (!params.rootConstraints.isMultiple) {
|
|
1469
|
+
checkServiceNodeSingleInjectionBindings(serviceNode, params.rootConstraints.isOptional ?? false, bindingConstraintsList.last);
|
|
1470
|
+
const [planBindingNode] = serviceNodeBindings;
|
|
1471
|
+
serviceNode.bindings = planBindingNode;
|
|
1472
|
+
}
|
|
1473
|
+
return serviceNode;
|
|
1474
|
+
};
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/calculations/getServiceFromMaybeLazyServiceIdentifier.js
|
|
1478
|
+
function getServiceFromMaybeLazyServiceIdentifier(serviceIdentifier) {
|
|
1479
|
+
return LazyServiceIdentifier.is(serviceIdentifier) ? serviceIdentifier.unwrap() : serviceIdentifier;
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/actions/curryBuildPlanServiceNodeFromClassElementMetadata.js
|
|
1483
|
+
function curryBuildPlanServiceNodeFromClassElementMetadata(buildServiceNodeBindings3) {
|
|
1484
|
+
return (params, bindingConstraintsList, elementMetadata) => {
|
|
1485
|
+
const serviceIdentifier = getServiceFromMaybeLazyServiceIdentifier(elementMetadata.value);
|
|
1486
|
+
const updatedBindingConstraintsList = bindingConstraintsList.concat({
|
|
1487
|
+
getAncestorsCalled: false,
|
|
1488
|
+
name: elementMetadata.name,
|
|
1489
|
+
serviceIdentifier,
|
|
1490
|
+
tags: elementMetadata.tags
|
|
1491
|
+
});
|
|
1492
|
+
const bindingConstraints = new BindingConstraintsImplementation(updatedBindingConstraintsList.last);
|
|
1493
|
+
const chained = elementMetadata.kind === ClassElementMetadataKind.multipleInjection && elementMetadata.chained;
|
|
1494
|
+
const filteredServiceBindings = buildFilteredServiceBindings(params, bindingConstraints, {
|
|
1495
|
+
chained
|
|
1496
|
+
});
|
|
1497
|
+
const serviceNodeBindings = [];
|
|
1498
|
+
const serviceNode = {
|
|
1499
|
+
bindings: serviceNodeBindings,
|
|
1500
|
+
isContextFree: true,
|
|
1501
|
+
serviceIdentifier
|
|
1502
|
+
};
|
|
1503
|
+
serviceNodeBindings.push(...buildServiceNodeBindings3(params, updatedBindingConstraintsList, filteredServiceBindings, serviceNode, chained));
|
|
1504
|
+
serviceNode.isContextFree = !updatedBindingConstraintsList.last.elem.getAncestorsCalled;
|
|
1505
|
+
if (elementMetadata.kind === ClassElementMetadataKind.singleInjection) {
|
|
1506
|
+
checkServiceNodeSingleInjectionBindings(serviceNode, elementMetadata.optional, updatedBindingConstraintsList.last);
|
|
1507
|
+
const [planBindingNode] = serviceNodeBindings;
|
|
1508
|
+
serviceNode.bindings = planBindingNode;
|
|
1509
|
+
}
|
|
1510
|
+
return serviceNode;
|
|
1511
|
+
};
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/actions/curryBuildPlanServiceNodeFromResolvedValueElementMetadata.js
|
|
1515
|
+
function curryBuildPlanServiceNodeFromResolvedValueElementMetadata(buildServiceNodeBindings3) {
|
|
1516
|
+
return (params, bindingConstraintsList, elementMetadata) => {
|
|
1517
|
+
const serviceIdentifier = getServiceFromMaybeLazyServiceIdentifier(elementMetadata.value);
|
|
1518
|
+
const updatedBindingConstraintsList = bindingConstraintsList.concat({
|
|
1519
|
+
getAncestorsCalled: false,
|
|
1520
|
+
name: elementMetadata.name,
|
|
1521
|
+
serviceIdentifier,
|
|
1522
|
+
tags: elementMetadata.tags
|
|
1523
|
+
});
|
|
1524
|
+
const bindingConstraints = new BindingConstraintsImplementation(updatedBindingConstraintsList.last);
|
|
1525
|
+
const chained = elementMetadata.kind === ResolvedValueElementMetadataKind.multipleInjection && elementMetadata.chained;
|
|
1526
|
+
const filteredServiceBindings = buildFilteredServiceBindings(params, bindingConstraints, {
|
|
1527
|
+
chained
|
|
1528
|
+
});
|
|
1529
|
+
const serviceNodeBindings = [];
|
|
1530
|
+
const serviceNode = {
|
|
1531
|
+
bindings: serviceNodeBindings,
|
|
1532
|
+
isContextFree: true,
|
|
1533
|
+
serviceIdentifier
|
|
1534
|
+
};
|
|
1535
|
+
serviceNodeBindings.push(...buildServiceNodeBindings3(params, updatedBindingConstraintsList, filteredServiceBindings, serviceNode, chained));
|
|
1536
|
+
serviceNode.isContextFree = !updatedBindingConstraintsList.last.elem.getAncestorsCalled;
|
|
1537
|
+
if (elementMetadata.kind === ResolvedValueElementMetadataKind.singleInjection) {
|
|
1538
|
+
checkServiceNodeSingleInjectionBindings(serviceNode, elementMetadata.optional, updatedBindingConstraintsList.last);
|
|
1539
|
+
const [planBindingNode] = serviceNodeBindings;
|
|
1540
|
+
serviceNode.bindings = planBindingNode;
|
|
1541
|
+
}
|
|
1542
|
+
return serviceNode;
|
|
1543
|
+
};
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/actions/curryBuildServiceNodeBindings.js
|
|
1547
|
+
function curryBuildServiceNodeBindings(subplan3) {
|
|
1548
|
+
const buildInstancePlanBindingNode = curryBuildInstancePlanBindingNode(subplan3);
|
|
1549
|
+
const buildResolvedValuePlanBindingNode = curryBuildResolvedValuePlanBindingNode(subplan3);
|
|
1550
|
+
const buildServiceNodeBindings3 = (params, bindingConstraintsList, serviceBindings, parentNode, chainedBindings) => {
|
|
1551
|
+
const serviceIdentifier = isPlanServiceRedirectionBindingNode(parentNode) ? parentNode.binding.targetServiceIdentifier : parentNode.serviceIdentifier;
|
|
1552
|
+
params.servicesBranch.push(serviceIdentifier);
|
|
1553
|
+
const planBindingNodes = [];
|
|
1554
|
+
for (const binding of serviceBindings) {
|
|
1555
|
+
switch (binding.type) {
|
|
1556
|
+
case bindingTypeValues.Instance: {
|
|
1557
|
+
planBindingNodes.push(buildInstancePlanBindingNode(params, binding, bindingConstraintsList));
|
|
1558
|
+
break;
|
|
1559
|
+
}
|
|
1560
|
+
case bindingTypeValues.ResolvedValue: {
|
|
1561
|
+
planBindingNodes.push(buildResolvedValuePlanBindingNode(params, binding, bindingConstraintsList));
|
|
1562
|
+
break;
|
|
1563
|
+
}
|
|
1564
|
+
case bindingTypeValues.ServiceRedirection: {
|
|
1565
|
+
const planBindingNode = buildServiceRedirectionPlanBindingNode(params, bindingConstraintsList, binding, chainedBindings);
|
|
1566
|
+
planBindingNodes.push(planBindingNode);
|
|
1567
|
+
break;
|
|
1568
|
+
}
|
|
1569
|
+
default:
|
|
1570
|
+
planBindingNodes.push({
|
|
1571
|
+
binding
|
|
1572
|
+
});
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
params.servicesBranch.pop();
|
|
1576
|
+
return planBindingNodes;
|
|
1577
|
+
};
|
|
1578
|
+
const buildServiceRedirectionPlanBindingNode = curryBuildServiceRedirectionPlanBindingNode(buildServiceNodeBindings3);
|
|
1579
|
+
return buildServiceNodeBindings3;
|
|
1580
|
+
}
|
|
1581
|
+
function curryBuildInstancePlanBindingNode(subplan3) {
|
|
1582
|
+
return (params, binding, bindingConstraintsList) => {
|
|
1583
|
+
const classMetadata = params.operations.getClassMetadata(binding.implementationType);
|
|
1584
|
+
const childNode = {
|
|
1585
|
+
binding,
|
|
1586
|
+
classMetadata,
|
|
1587
|
+
constructorParams: [],
|
|
1588
|
+
propertyParams: /* @__PURE__ */ new Map()
|
|
1589
|
+
};
|
|
1590
|
+
const subplanParams = {
|
|
1591
|
+
autobindOptions: params.autobindOptions,
|
|
1592
|
+
node: childNode,
|
|
1593
|
+
operations: params.operations,
|
|
1594
|
+
servicesBranch: params.servicesBranch
|
|
1595
|
+
};
|
|
1596
|
+
return subplan3(subplanParams, bindingConstraintsList);
|
|
1597
|
+
};
|
|
1598
|
+
}
|
|
1599
|
+
function curryBuildResolvedValuePlanBindingNode(subplan3) {
|
|
1600
|
+
return (params, binding, bindingConstraintsList) => {
|
|
1601
|
+
const childNode = {
|
|
1602
|
+
binding,
|
|
1603
|
+
params: []
|
|
1604
|
+
};
|
|
1605
|
+
const subplanParams = {
|
|
1606
|
+
autobindOptions: params.autobindOptions,
|
|
1607
|
+
node: childNode,
|
|
1608
|
+
operations: params.operations,
|
|
1609
|
+
servicesBranch: params.servicesBranch
|
|
1610
|
+
};
|
|
1611
|
+
return subplan3(subplanParams, bindingConstraintsList);
|
|
1612
|
+
};
|
|
1613
|
+
}
|
|
1614
|
+
function curryBuildServiceRedirectionPlanBindingNode(buildServiceNodeBindings3) {
|
|
1615
|
+
return (params, bindingConstraintsList, binding, chainedBindings) => {
|
|
1616
|
+
const childNode = {
|
|
1617
|
+
binding,
|
|
1618
|
+
redirections: []
|
|
1619
|
+
};
|
|
1620
|
+
const bindingConstraints = new BindingConstraintsImplementation(bindingConstraintsList.last);
|
|
1621
|
+
const filteredServiceBindings = buildFilteredServiceBindings(params, bindingConstraints, {
|
|
1622
|
+
chained: chainedBindings,
|
|
1623
|
+
customServiceIdentifier: binding.targetServiceIdentifier
|
|
1624
|
+
});
|
|
1625
|
+
childNode.redirections.push(...buildServiceNodeBindings3(params, bindingConstraintsList, filteredServiceBindings, childNode, chainedBindings));
|
|
1626
|
+
return childNode;
|
|
1627
|
+
};
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/calculations/isInstanceBindingNode.js
|
|
1631
|
+
function isInstanceBindingNode(node) {
|
|
1632
|
+
return node.binding.type === bindingTypeValues.Instance;
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/calculations/tryBuildGetPlanOptionsFromManagedClassElementMetadata.js
|
|
1636
|
+
function tryBuildGetPlanOptionsFromManagedClassElementMetadata(elementMetadata) {
|
|
1637
|
+
let tag;
|
|
1638
|
+
if (elementMetadata.tags.size === 0) {
|
|
1639
|
+
tag = void 0;
|
|
1640
|
+
} else if (elementMetadata.tags.size === 1) {
|
|
1641
|
+
const [key, value] = elementMetadata.tags.entries().next().value;
|
|
1642
|
+
tag = { key, value };
|
|
1643
|
+
} else {
|
|
1644
|
+
return void 0;
|
|
1645
|
+
}
|
|
1646
|
+
const serviceIdentifier = LazyServiceIdentifier.is(elementMetadata.value) ? elementMetadata.value.unwrap() : elementMetadata.value;
|
|
1647
|
+
if (elementMetadata.kind === ClassElementMetadataKind.multipleInjection) {
|
|
1648
|
+
return {
|
|
1649
|
+
chained: elementMetadata.chained,
|
|
1650
|
+
isMultiple: true,
|
|
1651
|
+
name: elementMetadata.name,
|
|
1652
|
+
optional: elementMetadata.optional,
|
|
1653
|
+
serviceIdentifier,
|
|
1654
|
+
tag
|
|
1655
|
+
};
|
|
1656
|
+
} else {
|
|
1657
|
+
return {
|
|
1658
|
+
isMultiple: false,
|
|
1659
|
+
name: elementMetadata.name,
|
|
1660
|
+
optional: elementMetadata.optional,
|
|
1661
|
+
serviceIdentifier,
|
|
1662
|
+
tag
|
|
1663
|
+
};
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/calculations/tryBuildGetPlanOptionsFromResolvedValueElementMetadata.js
|
|
1668
|
+
function tryBuildGetPlanOptionsFromResolvedValueElementMetadata(resolvedValueElementMetadata) {
|
|
1669
|
+
let tag;
|
|
1670
|
+
if (resolvedValueElementMetadata.tags.size === 0) {
|
|
1671
|
+
tag = void 0;
|
|
1672
|
+
} else if (resolvedValueElementMetadata.tags.size === 1) {
|
|
1673
|
+
const [key, value] = resolvedValueElementMetadata.tags.entries().next().value;
|
|
1674
|
+
tag = { key, value };
|
|
1675
|
+
} else {
|
|
1676
|
+
return void 0;
|
|
1677
|
+
}
|
|
1678
|
+
const serviceIdentifier = LazyServiceIdentifier.is(resolvedValueElementMetadata.value) ? resolvedValueElementMetadata.value.unwrap() : resolvedValueElementMetadata.value;
|
|
1679
|
+
if (resolvedValueElementMetadata.kind === ResolvedValueElementMetadataKind.multipleInjection) {
|
|
1680
|
+
return {
|
|
1681
|
+
chained: resolvedValueElementMetadata.chained,
|
|
1682
|
+
isMultiple: true,
|
|
1683
|
+
name: resolvedValueElementMetadata.name,
|
|
1684
|
+
optional: resolvedValueElementMetadata.optional,
|
|
1685
|
+
serviceIdentifier,
|
|
1686
|
+
tag
|
|
1687
|
+
};
|
|
1688
|
+
} else {
|
|
1689
|
+
return {
|
|
1690
|
+
isMultiple: false,
|
|
1691
|
+
name: resolvedValueElementMetadata.name,
|
|
1692
|
+
optional: resolvedValueElementMetadata.optional,
|
|
1693
|
+
serviceIdentifier,
|
|
1694
|
+
tag
|
|
1695
|
+
};
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/actions/cacheNonRootPlanServiceNode.js
|
|
1700
|
+
function cacheNonRootPlanServiceNode(getPlanOptions, operations, planServiceNode, context) {
|
|
1701
|
+
if (getPlanOptions !== void 0 && (LazyPlanServiceNode.is(planServiceNode) && !planServiceNode.isExpanded() || planServiceNode.isContextFree)) {
|
|
1702
|
+
const planResult = {
|
|
1703
|
+
tree: {
|
|
1704
|
+
root: planServiceNode
|
|
1705
|
+
}
|
|
1706
|
+
};
|
|
1707
|
+
operations.setPlan(getPlanOptions, planResult);
|
|
1708
|
+
} else {
|
|
1709
|
+
operations.setNonCachedServiceNode(planServiceNode, context);
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/actions/currySubplan.js
|
|
1714
|
+
var MAX_PLAN_DEPTH = 500;
|
|
1715
|
+
var LazyManagedClassMetadataPlanServiceNode = class extends LazyPlanServiceNode {
|
|
1716
|
+
#params;
|
|
1717
|
+
#buildLazyPlanServiceNodeNodeFromClassElementMetadata;
|
|
1718
|
+
#bindingConstraintsList;
|
|
1719
|
+
#elementMetadata;
|
|
1720
|
+
constructor(params, buildLazyPlanServiceNodeNodeFromClassElementMetadata, bindingConstraintsList, elementMetadata, serviceNode) {
|
|
1721
|
+
super(serviceNode, getServiceFromMaybeLazyServiceIdentifier(elementMetadata.value));
|
|
1722
|
+
this.#buildLazyPlanServiceNodeNodeFromClassElementMetadata = buildLazyPlanServiceNodeNodeFromClassElementMetadata;
|
|
1723
|
+
this.#params = params;
|
|
1724
|
+
this.#bindingConstraintsList = bindingConstraintsList;
|
|
1725
|
+
this.#elementMetadata = elementMetadata;
|
|
1726
|
+
}
|
|
1727
|
+
_buildPlanServiceNode() {
|
|
1728
|
+
return this.#buildLazyPlanServiceNodeNodeFromClassElementMetadata(this.#params, this.#bindingConstraintsList, this.#elementMetadata);
|
|
1729
|
+
}
|
|
1730
|
+
};
|
|
1731
|
+
var LazyResolvedValueMetadataPlanServiceNode = class extends LazyPlanServiceNode {
|
|
1732
|
+
#params;
|
|
1733
|
+
#buildLazyPlanServiceNodeNodeFromResolvedValueElementMetadata;
|
|
1734
|
+
#bindingConstraintsList;
|
|
1735
|
+
#resolvedValueElementMetadata;
|
|
1736
|
+
constructor(params, buildLazyPlanServiceNodeNodeFromResolvedValueElementMetadata, bindingConstraintsList, resolvedValueElementMetadata, serviceNode) {
|
|
1737
|
+
super(serviceNode, getServiceFromMaybeLazyServiceIdentifier(resolvedValueElementMetadata.value));
|
|
1738
|
+
this.#params = params;
|
|
1739
|
+
this.#buildLazyPlanServiceNodeNodeFromResolvedValueElementMetadata = buildLazyPlanServiceNodeNodeFromResolvedValueElementMetadata;
|
|
1740
|
+
this.#bindingConstraintsList = bindingConstraintsList;
|
|
1741
|
+
this.#resolvedValueElementMetadata = resolvedValueElementMetadata;
|
|
1742
|
+
}
|
|
1743
|
+
_buildPlanServiceNode() {
|
|
1744
|
+
return this.#buildLazyPlanServiceNodeNodeFromResolvedValueElementMetadata(this.#params, this.#bindingConstraintsList, this.#resolvedValueElementMetadata);
|
|
1745
|
+
}
|
|
1746
|
+
};
|
|
1747
|
+
function currySubplan(buildLazyPlanServiceNodeNodeFromClassElementMetadata, buildLazyPlanServiceNodeNodeFromResolvedValueElementMetadata, buildPlanServiceNodeFromClassElementMetadata2, buildPlanServiceNodeFromResolvedValueElementMetadata2) {
|
|
1748
|
+
const subplanInstanceBindingNode = currySubplanInstanceBindingNode(buildLazyPlanServiceNodeNodeFromClassElementMetadata, buildPlanServiceNodeFromClassElementMetadata2);
|
|
1749
|
+
const subplanResolvedValueBindingNode = currySubplanResolvedValueBindingNode(buildLazyPlanServiceNodeNodeFromResolvedValueElementMetadata, buildPlanServiceNodeFromResolvedValueElementMetadata2);
|
|
1750
|
+
return (params, bindingConstraintsList) => {
|
|
1751
|
+
if (isInstanceBindingNode(params.node)) {
|
|
1752
|
+
return subplanInstanceBindingNode(params, params.node, bindingConstraintsList);
|
|
1753
|
+
} else {
|
|
1754
|
+
return subplanResolvedValueBindingNode(params, params.node, bindingConstraintsList);
|
|
1755
|
+
}
|
|
1756
|
+
};
|
|
1757
|
+
}
|
|
1758
|
+
function currySubplanInstanceBindingNode(buildLazyPlanServiceNodeNodeFromClassElementMetadata, buildPlanServiceNodeFromClassElementMetadata2) {
|
|
1759
|
+
const handlePlanServiceNodeBuildFromClassElementMetadata = curryHandlePlanServiceNodeBuildFromClassElementMetadata(buildLazyPlanServiceNodeNodeFromClassElementMetadata, buildPlanServiceNodeFromClassElementMetadata2);
|
|
1760
|
+
return (params, node, bindingConstraintsList) => {
|
|
1761
|
+
const classMetadata = node.classMetadata;
|
|
1762
|
+
for (const [index, elementMetadata] of classMetadata.constructorArguments.entries()) {
|
|
1763
|
+
node.constructorParams[index] = handlePlanServiceNodeBuildFromClassElementMetadata(params, bindingConstraintsList, elementMetadata);
|
|
1764
|
+
}
|
|
1765
|
+
for (const [propertyKey, elementMetadata] of classMetadata.properties) {
|
|
1766
|
+
const planServiceNode = handlePlanServiceNodeBuildFromClassElementMetadata(params, bindingConstraintsList, elementMetadata);
|
|
1767
|
+
if (planServiceNode !== void 0) {
|
|
1768
|
+
node.propertyParams.set(propertyKey, planServiceNode);
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
return params.node;
|
|
1772
|
+
};
|
|
1773
|
+
}
|
|
1774
|
+
function currySubplanResolvedValueBindingNode(buildLazyPlanServiceNodeNodeFromResolvedValueElementMetadata, buildPlanServiceNodeFromResolvedValueElementMetadata2) {
|
|
1775
|
+
const handlePlanServiceNodeBuildFromResolvedValueElementMetadata = curryHandlePlanServiceNodeBuildFromResolvedValueElementMetadata(buildLazyPlanServiceNodeNodeFromResolvedValueElementMetadata, buildPlanServiceNodeFromResolvedValueElementMetadata2);
|
|
1776
|
+
return (params, node, bindingConstraintsList) => {
|
|
1777
|
+
const resolvedValueMetadata = node.binding.metadata;
|
|
1778
|
+
for (const [index, elementMetadata] of resolvedValueMetadata.arguments.entries()) {
|
|
1779
|
+
node.params[index] = handlePlanServiceNodeBuildFromResolvedValueElementMetadata(params, bindingConstraintsList, elementMetadata);
|
|
1780
|
+
}
|
|
1781
|
+
return params.node;
|
|
1782
|
+
};
|
|
1783
|
+
}
|
|
1784
|
+
function curryHandlePlanServiceNodeBuildFromClassElementMetadata(buildLazyPlanServiceNodeNodeFromClassElementMetadata, buildPlanServiceNodeFromClassElementMetadata2) {
|
|
1785
|
+
return (params, bindingConstraintsList, elementMetadata) => {
|
|
1786
|
+
if (elementMetadata.kind === ClassElementMetadataKind.unmanaged) {
|
|
1787
|
+
return void 0;
|
|
1788
|
+
}
|
|
1789
|
+
if (bindingConstraintsList.length > MAX_PLAN_DEPTH) {
|
|
1790
|
+
throw new InversifyCoreError(InversifyCoreErrorKind.planningMaxDepthExceeded, "Maximum plan depth exceeded. This is likely caused by a circular dependency.");
|
|
1791
|
+
}
|
|
1792
|
+
const getPlanOptions = tryBuildGetPlanOptionsFromManagedClassElementMetadata(elementMetadata);
|
|
1793
|
+
if (getPlanOptions !== void 0) {
|
|
1794
|
+
const planResult = params.operations.getPlan(getPlanOptions);
|
|
1795
|
+
if (planResult !== void 0 && planResult.tree.root.isContextFree) {
|
|
1796
|
+
return planResult.tree.root;
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
const serviceNode = buildPlanServiceNodeFromClassElementMetadata2(params, bindingConstraintsList, elementMetadata);
|
|
1800
|
+
const lazyPlanServiceNode = new LazyManagedClassMetadataPlanServiceNode(params, buildLazyPlanServiceNodeNodeFromClassElementMetadata, bindingConstraintsList, elementMetadata, serviceNode);
|
|
1801
|
+
cacheNonRootPlanServiceNode(getPlanOptions, params.operations, lazyPlanServiceNode, {
|
|
1802
|
+
bindingConstraintsList,
|
|
1803
|
+
chainedBindings: elementMetadata.kind === ClassElementMetadataKind.multipleInjection && elementMetadata.chained,
|
|
1804
|
+
optionalBindings: elementMetadata.optional
|
|
1805
|
+
});
|
|
1806
|
+
return lazyPlanServiceNode;
|
|
1807
|
+
};
|
|
1808
|
+
}
|
|
1809
|
+
function curryHandlePlanServiceNodeBuildFromResolvedValueElementMetadata(buildLazyPlanServiceNodeNodeFromResolvedValueElementMetadata, buildPlanServiceNodeFromResolvedValueElementMetadata2) {
|
|
1810
|
+
return (params, bindingConstraintsList, elementMetadata) => {
|
|
1811
|
+
const getPlanOptions = tryBuildGetPlanOptionsFromResolvedValueElementMetadata(elementMetadata);
|
|
1812
|
+
if (getPlanOptions !== void 0) {
|
|
1813
|
+
const planResult = params.operations.getPlan(getPlanOptions);
|
|
1814
|
+
if (planResult !== void 0 && planResult.tree.root.isContextFree) {
|
|
1815
|
+
return planResult.tree.root;
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
const serviceNode = buildPlanServiceNodeFromResolvedValueElementMetadata2(params, bindingConstraintsList, elementMetadata);
|
|
1819
|
+
const lazyPlanServiceNode = new LazyResolvedValueMetadataPlanServiceNode(params, buildLazyPlanServiceNodeNodeFromResolvedValueElementMetadata, bindingConstraintsList, elementMetadata, serviceNode);
|
|
1820
|
+
cacheNonRootPlanServiceNode(getPlanOptions, params.operations, lazyPlanServiceNode, {
|
|
1821
|
+
bindingConstraintsList,
|
|
1822
|
+
chainedBindings: elementMetadata.kind === ResolvedValueElementMetadataKind.multipleInjection && elementMetadata.chained,
|
|
1823
|
+
optionalBindings: elementMetadata.optional
|
|
1824
|
+
});
|
|
1825
|
+
return lazyPlanServiceNode;
|
|
1826
|
+
};
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1829
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/actions/plan.js
|
|
1830
|
+
var LazyRootPlanServiceNode = class extends LazyPlanServiceNode {
|
|
1831
|
+
#params;
|
|
1832
|
+
constructor(params, serviceNode) {
|
|
1833
|
+
super(serviceNode, serviceNode.serviceIdentifier);
|
|
1834
|
+
this.#params = params;
|
|
1835
|
+
}
|
|
1836
|
+
_buildPlanServiceNode() {
|
|
1837
|
+
return buildPlanServiceNode(this.#params);
|
|
1838
|
+
}
|
|
1839
|
+
};
|
|
1840
|
+
var buildPlanServiceNodeFromClassElementMetadata = curryBuildPlanServiceNodeFromClassElementMetadata(circularBuildServiceNodeBindings);
|
|
1841
|
+
var buildPlanServiceNodeFromResolvedValueElementMetadata = curryBuildPlanServiceNodeFromResolvedValueElementMetadata(circularBuildServiceNodeBindings);
|
|
1842
|
+
var subplan = currySubplan(buildPlanServiceNodeFromClassElementMetadata, buildPlanServiceNodeFromResolvedValueElementMetadata, buildPlanServiceNodeFromClassElementMetadata, buildPlanServiceNodeFromResolvedValueElementMetadata);
|
|
1843
|
+
var buildServiceNodeBindings = curryBuildServiceNodeBindings(subplan);
|
|
1844
|
+
function circularBuildServiceNodeBindings(params, bindingConstraintsList, serviceBindings, parentNode, chainedBindings) {
|
|
1845
|
+
return buildServiceNodeBindings(params, bindingConstraintsList, serviceBindings, parentNode, chainedBindings);
|
|
1846
|
+
}
|
|
1847
|
+
var buildPlanServiceNode = curryBuildPlanServiceNode(buildServiceNodeBindings);
|
|
1848
|
+
function plan(params) {
|
|
1849
|
+
try {
|
|
1850
|
+
const getPlanOptions = buildGetPlanOptionsFromPlanParams(params);
|
|
1851
|
+
const planResultFromCache = params.operations.getPlan(getPlanOptions);
|
|
1852
|
+
if (planResultFromCache !== void 0) {
|
|
1853
|
+
return planResultFromCache;
|
|
1854
|
+
}
|
|
1855
|
+
const serviceNode = buildPlanServiceNode(params);
|
|
1856
|
+
const planResult = {
|
|
1857
|
+
tree: {
|
|
1858
|
+
root: new LazyRootPlanServiceNode(params, serviceNode)
|
|
1859
|
+
}
|
|
1860
|
+
};
|
|
1861
|
+
params.operations.setPlan(getPlanOptions, planResult);
|
|
1862
|
+
return planResult;
|
|
1863
|
+
} catch (error) {
|
|
1864
|
+
handlePlanError(params, error);
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/models/CacheBindingInvalidationKind.js
|
|
1869
|
+
var CacheBindingInvalidationKind;
|
|
1870
|
+
(function(CacheBindingInvalidationKind2) {
|
|
1871
|
+
CacheBindingInvalidationKind2["bindingAdded"] = "bindingAdded";
|
|
1872
|
+
CacheBindingInvalidationKind2["bindingRemoved"] = "bindingRemoved";
|
|
1873
|
+
})(CacheBindingInvalidationKind || (CacheBindingInvalidationKind = {}));
|
|
1874
|
+
|
|
1875
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/common/models/WeakList.js
|
|
1876
|
+
var DEFAULT_MINIMUM_LENGTH_TO_REALLOCATE = 8;
|
|
1877
|
+
var DEFAULT_MODULUS_TO_REALLOCATE_ON_PUSH = 1024;
|
|
1878
|
+
var MIN_DEAD_REFS_FOR_REALLOCATION_PERCENTAGE = 0.5;
|
|
1879
|
+
var WeakList = class {
|
|
1880
|
+
#list;
|
|
1881
|
+
#minimumLengthToReallocate;
|
|
1882
|
+
#modulusToReallocateOnPush;
|
|
1883
|
+
constructor() {
|
|
1884
|
+
this.#list = [];
|
|
1885
|
+
this.#minimumLengthToReallocate = DEFAULT_MINIMUM_LENGTH_TO_REALLOCATE;
|
|
1886
|
+
this.#modulusToReallocateOnPush = DEFAULT_MODULUS_TO_REALLOCATE_ON_PUSH;
|
|
1887
|
+
}
|
|
1888
|
+
*[Symbol.iterator]() {
|
|
1889
|
+
let deadRefCount = 0;
|
|
1890
|
+
for (const weakRef of this.#list) {
|
|
1891
|
+
const value = weakRef.deref();
|
|
1892
|
+
if (value === void 0) {
|
|
1893
|
+
++deadRefCount;
|
|
1894
|
+
} else {
|
|
1895
|
+
yield value;
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
if (this.#list.length >= this.#minimumLengthToReallocate && this.#shouldReallocate(deadRefCount)) {
|
|
1899
|
+
this.#reallocate(deadRefCount);
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
push(value) {
|
|
1903
|
+
const weakRef = new WeakRef(value);
|
|
1904
|
+
this.#list.push(weakRef);
|
|
1905
|
+
if (this.#list.length >= this.#minimumLengthToReallocate && this.#list.length % this.#modulusToReallocateOnPush === 0) {
|
|
1906
|
+
let deadRefCount = 0;
|
|
1907
|
+
for (const ref of this.#list) {
|
|
1908
|
+
if (ref.deref() === void 0) {
|
|
1909
|
+
++deadRefCount;
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
if (this.#shouldReallocate(deadRefCount)) {
|
|
1913
|
+
this.#reallocate(deadRefCount);
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
#reallocate(deadRefCount) {
|
|
1918
|
+
const newList = new Array(this.#list.length - deadRefCount);
|
|
1919
|
+
let i = 0;
|
|
1920
|
+
for (const ref of this.#list) {
|
|
1921
|
+
if (ref.deref()) {
|
|
1922
|
+
newList[i++] = ref;
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
this.#list = newList;
|
|
1926
|
+
}
|
|
1927
|
+
#shouldReallocate(deadRefCount) {
|
|
1928
|
+
return deadRefCount >= this.#list.length * MIN_DEAD_REFS_FOR_REALLOCATION_PERCENTAGE;
|
|
1929
|
+
}
|
|
1930
|
+
};
|
|
1931
|
+
|
|
1932
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/actions/curryLazyBuildPlanServiceNodeFromClassElementMetadata.js
|
|
1933
|
+
function curryLazyBuildPlanServiceNodeFromClassElementMetadata(buildServiceNodeBindings3) {
|
|
1934
|
+
const buildPlanServiceNodeFromClassElementMetadata2 = curryBuildPlanServiceNodeFromClassElementMetadata(buildServiceNodeBindings3);
|
|
1935
|
+
return (params, bindingConstraintsList, elementMetadata) => {
|
|
1936
|
+
try {
|
|
1937
|
+
return buildPlanServiceNodeFromClassElementMetadata2(params, bindingConstraintsList, elementMetadata);
|
|
1938
|
+
} catch (error) {
|
|
1939
|
+
if (InversifyCoreError.isErrorOfKind(error, InversifyCoreErrorKind.planning)) {
|
|
1940
|
+
return void 0;
|
|
1941
|
+
}
|
|
1942
|
+
throw error;
|
|
1943
|
+
}
|
|
1944
|
+
};
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/actions/curryLazyBuildPlanServiceNodeFromResolvedValueElementMetadata.js
|
|
1948
|
+
function curryLazyBuildPlanServiceNodeFromResolvedValueElementMetadata(buildServiceNodeBindings3) {
|
|
1949
|
+
const buildPlanServiceNodeFromResolvedValueElementMetadata2 = curryBuildPlanServiceNodeFromResolvedValueElementMetadata(buildServiceNodeBindings3);
|
|
1950
|
+
return (params, bindingConstraintsList, elementMetadata) => {
|
|
1951
|
+
try {
|
|
1952
|
+
return buildPlanServiceNodeFromResolvedValueElementMetadata2(params, bindingConstraintsList, elementMetadata);
|
|
1953
|
+
} catch (error) {
|
|
1954
|
+
if (InversifyCoreError.isErrorOfKind(error, InversifyCoreErrorKind.planning)) {
|
|
1955
|
+
return void 0;
|
|
1956
|
+
}
|
|
1957
|
+
throw error;
|
|
1958
|
+
}
|
|
1959
|
+
};
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/actions/addServiceNodeBindingIfContextFree.js
|
|
1963
|
+
var subplan2 = currySubplan(buildPlanServiceNodeFromClassElementMetadata, buildPlanServiceNodeFromResolvedValueElementMetadata, circularLazyBuildPlanServiceNodeFromClassElementMetadata, circularLazyBuildPlanServiceNodeFromResolvedValueElementMetadata);
|
|
1964
|
+
var buildServiceNodeBindings2 = curryBuildServiceNodeBindings(subplan2);
|
|
1965
|
+
var lazyBuildPlanServiceNodeFromClassElementMetadata = curryLazyBuildPlanServiceNodeFromClassElementMetadata(buildServiceNodeBindings2);
|
|
1966
|
+
var lazyBuildPlanServiceNodeFromResolvedValueElementMetadata = curryLazyBuildPlanServiceNodeFromResolvedValueElementMetadata(buildServiceNodeBindings2);
|
|
1967
|
+
function circularLazyBuildPlanServiceNodeFromClassElementMetadata(params, bindingConstraintsList, elementMetadata) {
|
|
1968
|
+
return lazyBuildPlanServiceNodeFromClassElementMetadata(params, bindingConstraintsList, elementMetadata);
|
|
1969
|
+
}
|
|
1970
|
+
function circularLazyBuildPlanServiceNodeFromResolvedValueElementMetadata(params, bindingConstraintsList, elementMetadata) {
|
|
1971
|
+
return lazyBuildPlanServiceNodeFromResolvedValueElementMetadata(params, bindingConstraintsList, elementMetadata);
|
|
1972
|
+
}
|
|
1973
|
+
function addServiceNodeBindingIfContextFree(params, serviceNode, binding, bindingConstraintsList, chainedBindings) {
|
|
1974
|
+
if (LazyPlanServiceNode.is(serviceNode) && !serviceNode.isExpanded()) {
|
|
1975
|
+
return {
|
|
1976
|
+
isContextFreeBinding: true,
|
|
1977
|
+
shouldInvalidateServiceNode: false
|
|
1978
|
+
};
|
|
1979
|
+
}
|
|
1980
|
+
const bindingConstraints = new BindingConstraintsImplementation(bindingConstraintsList.last);
|
|
1981
|
+
if (!binding.isSatisfiedBy(bindingConstraints) || bindingConstraintsList.last.elem.getAncestorsCalled) {
|
|
1982
|
+
return {
|
|
1983
|
+
isContextFreeBinding: !bindingConstraintsList.last.elem.getAncestorsCalled,
|
|
1984
|
+
shouldInvalidateServiceNode: false
|
|
1985
|
+
};
|
|
1986
|
+
}
|
|
1987
|
+
return addServiceNodeSatisfiedBindingIfContextFree(params, serviceNode, binding, bindingConstraintsList, chainedBindings);
|
|
1988
|
+
}
|
|
1989
|
+
function addServiceNodeSatisfiedBindingIfContextFree(params, serviceNode, binding, bindingConstraintsList, chainedBindings) {
|
|
1990
|
+
let serviceNodeBinding;
|
|
1991
|
+
try {
|
|
1992
|
+
[serviceNodeBinding] = buildServiceNodeBindings2(params, bindingConstraintsList, [binding], serviceNode, chainedBindings);
|
|
1993
|
+
} catch (error) {
|
|
1994
|
+
if (isStackOverflowError(error) || InversifyCoreError.isErrorOfKind(error, InversifyCoreErrorKind.planningMaxDepthExceeded)) {
|
|
1995
|
+
return {
|
|
1996
|
+
isContextFreeBinding: false,
|
|
1997
|
+
shouldInvalidateServiceNode: true
|
|
1998
|
+
};
|
|
1999
|
+
}
|
|
2000
|
+
throw error;
|
|
2001
|
+
}
|
|
2002
|
+
return addServiceNodeBindingNodeIfContextFree(serviceNode, serviceNodeBinding);
|
|
2003
|
+
}
|
|
2004
|
+
function addServiceNodeBindingNodeIfContextFree(serviceNode, serviceNodeBinding) {
|
|
2005
|
+
if (Array.isArray(serviceNode.bindings)) {
|
|
2006
|
+
serviceNode.bindings.push(serviceNodeBinding);
|
|
2007
|
+
} else {
|
|
2008
|
+
if (serviceNode.bindings === void 0) {
|
|
2009
|
+
serviceNode.bindings = serviceNodeBinding;
|
|
2010
|
+
} else {
|
|
2011
|
+
if (!LazyPlanServiceNode.is(serviceNode)) {
|
|
2012
|
+
throw new InversifyCoreError(InversifyCoreErrorKind.planning, "Unexpected non-lazy plan service node. This is likely a bug in the planning logic. Please, report this issue");
|
|
2013
|
+
}
|
|
2014
|
+
return {
|
|
2015
|
+
isContextFreeBinding: true,
|
|
2016
|
+
shouldInvalidateServiceNode: true
|
|
2017
|
+
};
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
return {
|
|
2021
|
+
isContextFreeBinding: true,
|
|
2022
|
+
shouldInvalidateServiceNode: false
|
|
2023
|
+
};
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2026
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/actions/addRootServiceNodeBindingIfContextFree.js
|
|
2027
|
+
function addRootServiceNodeBindingIfContextFree(params, serviceNode, binding) {
|
|
2028
|
+
if (LazyPlanServiceNode.is(serviceNode) && !serviceNode.isExpanded()) {
|
|
2029
|
+
return {
|
|
2030
|
+
isContextFreeBinding: true,
|
|
2031
|
+
shouldInvalidateServiceNode: false
|
|
2032
|
+
};
|
|
2033
|
+
}
|
|
2034
|
+
const bindingConstraintsList = buildPlanBindingConstraintsList(params);
|
|
2035
|
+
const chained = params.rootConstraints.isMultiple && params.rootConstraints.chained;
|
|
2036
|
+
return addServiceNodeBindingIfContextFree(params, serviceNode, binding, bindingConstraintsList, chained);
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2039
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/actions/removeServiceNodeBindingIfContextFree.js
|
|
2040
|
+
function removeServiceNodeBindingIfContextFree(serviceNode, binding, bindingConstraintsList, optionalBindings) {
|
|
2041
|
+
if (LazyPlanServiceNode.is(serviceNode) && !serviceNode.isExpanded()) {
|
|
2042
|
+
return {
|
|
2043
|
+
bindingNodeRemoved: void 0,
|
|
2044
|
+
isContextFreeBinding: true
|
|
2045
|
+
};
|
|
2046
|
+
}
|
|
2047
|
+
const bindingConstraints = new BindingConstraintsImplementation(bindingConstraintsList.last);
|
|
2048
|
+
if (!binding.isSatisfiedBy(bindingConstraints) || bindingConstraintsList.last.elem.getAncestorsCalled) {
|
|
2049
|
+
return {
|
|
2050
|
+
bindingNodeRemoved: void 0,
|
|
2051
|
+
isContextFreeBinding: !bindingConstraintsList.last.elem.getAncestorsCalled
|
|
2052
|
+
};
|
|
2053
|
+
}
|
|
2054
|
+
let bindingNodeRemoved;
|
|
2055
|
+
if (Array.isArray(serviceNode.bindings)) {
|
|
2056
|
+
serviceNode.bindings = serviceNode.bindings.filter((bindingNode) => {
|
|
2057
|
+
if (bindingNode.binding === binding) {
|
|
2058
|
+
bindingNodeRemoved = bindingNode;
|
|
2059
|
+
return false;
|
|
2060
|
+
}
|
|
2061
|
+
return true;
|
|
2062
|
+
});
|
|
2063
|
+
} else {
|
|
2064
|
+
if (serviceNode.bindings?.binding === binding) {
|
|
2065
|
+
bindingNodeRemoved = serviceNode.bindings;
|
|
2066
|
+
if (optionalBindings) {
|
|
2067
|
+
serviceNode.bindings = void 0;
|
|
2068
|
+
} else {
|
|
2069
|
+
if (!LazyPlanServiceNode.is(serviceNode)) {
|
|
2070
|
+
throw new InversifyCoreError(InversifyCoreErrorKind.planning, "Unexpected non-lazy plan service node. This is likely a bug in the planning logic. Please, report this issue");
|
|
2071
|
+
}
|
|
2072
|
+
serviceNode.invalidate();
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
return {
|
|
2077
|
+
bindingNodeRemoved,
|
|
2078
|
+
isContextFreeBinding: true
|
|
2079
|
+
};
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/actions/removeRootServiceNodeBindingIfContextFree.js
|
|
2083
|
+
function removeRootServiceNodeBindingIfContextFree(params, serviceNode, binding) {
|
|
2084
|
+
if (LazyPlanServiceNode.is(serviceNode) && !serviceNode.isExpanded()) {
|
|
2085
|
+
return {
|
|
2086
|
+
bindingNodeRemoved: void 0,
|
|
2087
|
+
isContextFreeBinding: true
|
|
2088
|
+
};
|
|
2089
|
+
}
|
|
2090
|
+
const bindingConstraintsList = buildPlanBindingConstraintsList(params);
|
|
2091
|
+
return removeServiceNodeBindingIfContextFree(serviceNode, binding, bindingConstraintsList, params.rootConstraints.isOptional ?? false);
|
|
2092
|
+
}
|
|
2093
|
+
|
|
2094
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/services/PlanResultCacheService.js
|
|
2095
|
+
var CHAINED_MASK = 4;
|
|
2096
|
+
var IS_MULTIPLE_MASK = 2;
|
|
2097
|
+
var OPTIONAL_MASK = 1;
|
|
2098
|
+
var MAP_ARRAY_LENGTH = 8;
|
|
2099
|
+
var PlanResultCacheService = class {
|
|
2100
|
+
#serviceIdToNonCachedServiceNodeMapMap;
|
|
2101
|
+
#serviceIdToValuePlanMap;
|
|
2102
|
+
#namedServiceIdToValuePlanMap;
|
|
2103
|
+
#namedTaggedServiceIdToValuePlanMap;
|
|
2104
|
+
#taggedServiceIdToValuePlanMap;
|
|
2105
|
+
#subscribers;
|
|
2106
|
+
constructor() {
|
|
2107
|
+
this.#serviceIdToNonCachedServiceNodeMapMap = /* @__PURE__ */ new Map();
|
|
2108
|
+
this.#serviceIdToValuePlanMap = this.#buildInitializedMapArray();
|
|
2109
|
+
this.#namedServiceIdToValuePlanMap = this.#buildInitializedMapArray();
|
|
2110
|
+
this.#namedTaggedServiceIdToValuePlanMap = this.#buildInitializedMapArray();
|
|
2111
|
+
this.#taggedServiceIdToValuePlanMap = this.#buildInitializedMapArray();
|
|
2112
|
+
this.#subscribers = new WeakList();
|
|
2113
|
+
}
|
|
2114
|
+
clearCache() {
|
|
2115
|
+
for (const map of this.#getMaps()) {
|
|
2116
|
+
map.clear();
|
|
2117
|
+
}
|
|
2118
|
+
for (const subscriber of this.#subscribers) {
|
|
2119
|
+
subscriber.clearCache();
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
get(options) {
|
|
2123
|
+
if (options.name === void 0) {
|
|
2124
|
+
if (options.tag === void 0) {
|
|
2125
|
+
return this.#getMapFromMapArray(this.#serviceIdToValuePlanMap, options).get(options.serviceIdentifier);
|
|
2126
|
+
} else {
|
|
2127
|
+
return this.#getMapFromMapArray(this.#taggedServiceIdToValuePlanMap, options).get(options.serviceIdentifier)?.get(options.tag.key)?.get(options.tag.value);
|
|
2128
|
+
}
|
|
2129
|
+
} else {
|
|
2130
|
+
if (options.tag === void 0) {
|
|
2131
|
+
return this.#getMapFromMapArray(this.#namedServiceIdToValuePlanMap, options).get(options.serviceIdentifier)?.get(options.name);
|
|
2132
|
+
} else {
|
|
2133
|
+
return this.#getMapFromMapArray(this.#namedTaggedServiceIdToValuePlanMap, options).get(options.serviceIdentifier)?.get(options.name)?.get(options.tag.key)?.get(options.tag.value);
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
}
|
|
2137
|
+
invalidateServiceBinding(invalidation) {
|
|
2138
|
+
this.#invalidateServiceMap(invalidation);
|
|
2139
|
+
this.#invalidateNamedServiceMap(invalidation);
|
|
2140
|
+
this.#invalidateNamedTaggedServiceMap(invalidation);
|
|
2141
|
+
this.#invalidateTaggedServiceMap(invalidation);
|
|
2142
|
+
this.#invalidateNonCachedServiceNodeSetMap(invalidation);
|
|
2143
|
+
for (const subscriber of this.#subscribers) {
|
|
2144
|
+
subscriber.invalidateServiceBinding(invalidation);
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
set(options, planResult) {
|
|
2148
|
+
if (options.name === void 0) {
|
|
2149
|
+
if (options.tag === void 0) {
|
|
2150
|
+
this.#getMapFromMapArray(this.#serviceIdToValuePlanMap, options).set(options.serviceIdentifier, planResult);
|
|
2151
|
+
} else {
|
|
2152
|
+
this.#getOrBuildMapValueFromMapMap(this.#getOrBuildMapValueFromMapMap(this.#getMapFromMapArray(this.#taggedServiceIdToValuePlanMap, options), options.serviceIdentifier), options.tag.key).set(options.tag.value, planResult);
|
|
2153
|
+
}
|
|
2154
|
+
} else {
|
|
2155
|
+
if (options.tag === void 0) {
|
|
2156
|
+
this.#getOrBuildMapValueFromMapMap(this.#getMapFromMapArray(this.#namedServiceIdToValuePlanMap, options), options.serviceIdentifier).set(options.name, planResult);
|
|
2157
|
+
} else {
|
|
2158
|
+
this.#getOrBuildMapValueFromMapMap(this.#getOrBuildMapValueFromMapMap(this.#getOrBuildMapValueFromMapMap(this.#getMapFromMapArray(this.#namedTaggedServiceIdToValuePlanMap, options), options.serviceIdentifier), options.name), options.tag.key).set(options.tag.value, planResult);
|
|
2159
|
+
}
|
|
2160
|
+
}
|
|
2161
|
+
}
|
|
2162
|
+
setNonCachedServiceNode(node, context) {
|
|
2163
|
+
let nonCachedMap = this.#serviceIdToNonCachedServiceNodeMapMap.get(node.serviceIdentifier);
|
|
2164
|
+
if (nonCachedMap === void 0) {
|
|
2165
|
+
nonCachedMap = /* @__PURE__ */ new Map();
|
|
2166
|
+
this.#serviceIdToNonCachedServiceNodeMapMap.set(node.serviceIdentifier, nonCachedMap);
|
|
2167
|
+
}
|
|
2168
|
+
nonCachedMap.set(node, context);
|
|
2169
|
+
}
|
|
2170
|
+
subscribe(subscriber) {
|
|
2171
|
+
this.#subscribers.push(subscriber);
|
|
2172
|
+
}
|
|
2173
|
+
#buildInitializedMapArray() {
|
|
2174
|
+
const mapArray = new Array(MAP_ARRAY_LENGTH);
|
|
2175
|
+
for (let i = 0; i < mapArray.length; ++i) {
|
|
2176
|
+
mapArray[i] = /* @__PURE__ */ new Map();
|
|
2177
|
+
}
|
|
2178
|
+
return mapArray;
|
|
2179
|
+
}
|
|
2180
|
+
#buildUpdatePlanParams(invalidation, index, name, tag) {
|
|
2181
|
+
const isMultiple = (index & IS_MULTIPLE_MASK) !== 0;
|
|
2182
|
+
let planParamsConstraint;
|
|
2183
|
+
if (isMultiple) {
|
|
2184
|
+
const isChained = (index & IS_MULTIPLE_MASK & CHAINED_MASK) !== 0;
|
|
2185
|
+
planParamsConstraint = {
|
|
2186
|
+
chained: isChained,
|
|
2187
|
+
isMultiple,
|
|
2188
|
+
serviceIdentifier: invalidation.binding.serviceIdentifier
|
|
2189
|
+
};
|
|
2190
|
+
} else {
|
|
2191
|
+
planParamsConstraint = {
|
|
2192
|
+
isMultiple,
|
|
2193
|
+
serviceIdentifier: invalidation.binding.serviceIdentifier
|
|
2194
|
+
};
|
|
2195
|
+
}
|
|
2196
|
+
const isOptional = (index & OPTIONAL_MASK) !== 0;
|
|
2197
|
+
if (isOptional) {
|
|
2198
|
+
planParamsConstraint.isOptional = true;
|
|
2199
|
+
}
|
|
2200
|
+
if (name !== void 0) {
|
|
2201
|
+
planParamsConstraint.name = name;
|
|
2202
|
+
}
|
|
2203
|
+
if (tag !== void 0) {
|
|
2204
|
+
planParamsConstraint.tag = tag;
|
|
2205
|
+
}
|
|
2206
|
+
return {
|
|
2207
|
+
autobindOptions: void 0,
|
|
2208
|
+
operations: invalidation.operations,
|
|
2209
|
+
rootConstraints: planParamsConstraint,
|
|
2210
|
+
servicesBranch: []
|
|
2211
|
+
};
|
|
2212
|
+
}
|
|
2213
|
+
#getOrBuildMapValueFromMapMap(map, key) {
|
|
2214
|
+
let valueMap = map.get(key);
|
|
2215
|
+
if (valueMap === void 0) {
|
|
2216
|
+
valueMap = /* @__PURE__ */ new Map();
|
|
2217
|
+
map.set(key, valueMap);
|
|
2218
|
+
}
|
|
2219
|
+
return valueMap;
|
|
2220
|
+
}
|
|
2221
|
+
#getMapFromMapArray(mapArray, options) {
|
|
2222
|
+
return mapArray[this.#getMapArrayIndex(options)];
|
|
2223
|
+
}
|
|
2224
|
+
#getMaps() {
|
|
2225
|
+
return [
|
|
2226
|
+
this.#serviceIdToNonCachedServiceNodeMapMap,
|
|
2227
|
+
...this.#serviceIdToValuePlanMap,
|
|
2228
|
+
...this.#namedServiceIdToValuePlanMap,
|
|
2229
|
+
...this.#namedTaggedServiceIdToValuePlanMap,
|
|
2230
|
+
...this.#taggedServiceIdToValuePlanMap
|
|
2231
|
+
];
|
|
2232
|
+
}
|
|
2233
|
+
#getMapArrayIndex(options) {
|
|
2234
|
+
if (options.isMultiple) {
|
|
2235
|
+
return (options.chained ? CHAINED_MASK : 0) | (options.optional ? OPTIONAL_MASK : 0) | IS_MULTIPLE_MASK;
|
|
2236
|
+
} else {
|
|
2237
|
+
return options.optional ? OPTIONAL_MASK : 0;
|
|
2238
|
+
}
|
|
2239
|
+
}
|
|
2240
|
+
#invalidateNamedServiceMap(invalidation) {
|
|
2241
|
+
for (const [index, map] of this.#namedServiceIdToValuePlanMap.entries()) {
|
|
2242
|
+
const servicePlans = map.get(invalidation.binding.serviceIdentifier);
|
|
2243
|
+
if (servicePlans !== void 0) {
|
|
2244
|
+
for (const [name, servicePlan] of servicePlans.entries()) {
|
|
2245
|
+
this.#updatePlan(invalidation, servicePlan, index, name, void 0);
|
|
2246
|
+
}
|
|
2247
|
+
}
|
|
2248
|
+
}
|
|
2249
|
+
}
|
|
2250
|
+
#invalidateNamedTaggedServiceMap(invalidation) {
|
|
2251
|
+
for (const [index, map] of this.#namedTaggedServiceIdToValuePlanMap.entries()) {
|
|
2252
|
+
const servicePlanMapMapMap = map.get(invalidation.binding.serviceIdentifier);
|
|
2253
|
+
if (servicePlanMapMapMap !== void 0) {
|
|
2254
|
+
for (const [name, servicePlanMapMap] of servicePlanMapMapMap.entries()) {
|
|
2255
|
+
for (const [tag, servicePlanMap] of servicePlanMapMap.entries()) {
|
|
2256
|
+
for (const [tagValue, servicePlan] of servicePlanMap.entries()) {
|
|
2257
|
+
this.#updatePlan(invalidation, servicePlan, index, name, {
|
|
2258
|
+
key: tag,
|
|
2259
|
+
value: tagValue
|
|
2260
|
+
});
|
|
39
2261
|
}
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
2262
|
+
}
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2267
|
+
#invalidateNonCachePlanBindingNodeDescendents(planBindingNode) {
|
|
2268
|
+
switch (planBindingNode.binding.type) {
|
|
2269
|
+
case bindingTypeValues.ServiceRedirection:
|
|
2270
|
+
for (const redirection of planBindingNode.redirections) {
|
|
2271
|
+
this.#invalidateNonCachePlanBindingNodeDescendents(redirection);
|
|
2272
|
+
}
|
|
2273
|
+
break;
|
|
2274
|
+
case bindingTypeValues.Instance:
|
|
2275
|
+
for (const constructorParam of planBindingNode.constructorParams) {
|
|
2276
|
+
if (constructorParam !== void 0) {
|
|
2277
|
+
this.#invalidateNonCachePlanServiceNode(constructorParam);
|
|
2278
|
+
}
|
|
2279
|
+
}
|
|
2280
|
+
for (const propertyParam of planBindingNode.propertyParams.values()) {
|
|
2281
|
+
this.#invalidateNonCachePlanServiceNode(propertyParam);
|
|
2282
|
+
}
|
|
2283
|
+
break;
|
|
2284
|
+
case bindingTypeValues.ResolvedValue:
|
|
2285
|
+
for (const resolvedValue of planBindingNode.params) {
|
|
2286
|
+
this.#invalidateNonCachePlanServiceNode(resolvedValue);
|
|
2287
|
+
}
|
|
2288
|
+
break;
|
|
2289
|
+
default:
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
2292
|
+
#invalidateNonCachePlanServiceNode(planServiceNode) {
|
|
2293
|
+
const serviceNonCachedMap = this.#serviceIdToNonCachedServiceNodeMapMap.get(planServiceNode.serviceIdentifier);
|
|
2294
|
+
if (serviceNonCachedMap === void 0 || !serviceNonCachedMap.has(planServiceNode)) {
|
|
2295
|
+
return;
|
|
2296
|
+
}
|
|
2297
|
+
serviceNonCachedMap.delete(planServiceNode);
|
|
2298
|
+
this.#invalidateNonCachePlanServiceNodeDescendents(planServiceNode);
|
|
2299
|
+
}
|
|
2300
|
+
#invalidateNonCachePlanServiceNodeDescendents(planServiceNode) {
|
|
2301
|
+
if (LazyPlanServiceNode.is(planServiceNode) && !planServiceNode.isExpanded()) {
|
|
2302
|
+
return;
|
|
2303
|
+
}
|
|
2304
|
+
if (planServiceNode.bindings === void 0) {
|
|
2305
|
+
return;
|
|
2306
|
+
}
|
|
2307
|
+
if (Array.isArray(planServiceNode.bindings)) {
|
|
2308
|
+
for (const binding of planServiceNode.bindings) {
|
|
2309
|
+
this.#invalidateNonCachePlanBindingNodeDescendents(binding);
|
|
2310
|
+
}
|
|
2311
|
+
} else {
|
|
2312
|
+
this.#invalidateNonCachePlanBindingNodeDescendents(planServiceNode.bindings);
|
|
2313
|
+
}
|
|
2314
|
+
}
|
|
2315
|
+
#invalidateNonCachedServiceNodeSetMap(invalidation) {
|
|
2316
|
+
const serviceNonCachedServiceNodeMap = this.#serviceIdToNonCachedServiceNodeMapMap.get(invalidation.binding.serviceIdentifier);
|
|
2317
|
+
if (serviceNonCachedServiceNodeMap !== void 0) {
|
|
2318
|
+
switch (invalidation.kind) {
|
|
2319
|
+
case CacheBindingInvalidationKind.bindingAdded:
|
|
2320
|
+
for (const [serviceNode, context] of serviceNonCachedServiceNodeMap) {
|
|
2321
|
+
const result = addServiceNodeBindingIfContextFree({
|
|
2322
|
+
autobindOptions: void 0,
|
|
2323
|
+
operations: invalidation.operations,
|
|
2324
|
+
servicesBranch: []
|
|
2325
|
+
}, serviceNode, invalidation.binding, context.bindingConstraintsList, context.chainedBindings);
|
|
2326
|
+
if (result.isContextFreeBinding) {
|
|
2327
|
+
if (result.shouldInvalidateServiceNode && LazyPlanServiceNode.is(serviceNode)) {
|
|
2328
|
+
this.#invalidateNonCachePlanServiceNodeDescendents(serviceNode);
|
|
2329
|
+
serviceNode.invalidate();
|
|
2330
|
+
}
|
|
2331
|
+
} else {
|
|
2332
|
+
this.clearCache();
|
|
2333
|
+
}
|
|
2334
|
+
}
|
|
2335
|
+
break;
|
|
2336
|
+
case CacheBindingInvalidationKind.bindingRemoved:
|
|
2337
|
+
for (const [serviceNode, context] of serviceNonCachedServiceNodeMap) {
|
|
2338
|
+
const result = removeServiceNodeBindingIfContextFree(serviceNode, invalidation.binding, context.bindingConstraintsList, context.optionalBindings);
|
|
2339
|
+
if (result.isContextFreeBinding) {
|
|
2340
|
+
if (result.bindingNodeRemoved !== void 0) {
|
|
2341
|
+
this.#invalidateNonCachePlanBindingNodeDescendents(result.bindingNodeRemoved);
|
|
2342
|
+
}
|
|
2343
|
+
} else {
|
|
2344
|
+
this.clearCache();
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
break;
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
}
|
|
2351
|
+
#invalidateServiceMap(invalidation) {
|
|
2352
|
+
for (const [index, map] of this.#serviceIdToValuePlanMap.entries()) {
|
|
2353
|
+
const servicePlan = map.get(invalidation.binding.serviceIdentifier);
|
|
2354
|
+
this.#updatePlan(invalidation, servicePlan, index, void 0, void 0);
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
#invalidateTaggedServiceMap(invalidation) {
|
|
2358
|
+
for (const [index, map] of this.#taggedServiceIdToValuePlanMap.entries()) {
|
|
2359
|
+
const servicePlanMapMap = map.get(invalidation.binding.serviceIdentifier);
|
|
2360
|
+
if (servicePlanMapMap !== void 0) {
|
|
2361
|
+
for (const [tag, servicePlanMap] of servicePlanMapMap.entries()) {
|
|
2362
|
+
for (const [tagValue, servicePlan] of servicePlanMap.entries()) {
|
|
2363
|
+
this.#updatePlan(invalidation, servicePlan, index, void 0, {
|
|
2364
|
+
key: tag,
|
|
2365
|
+
value: tagValue
|
|
2366
|
+
});
|
|
2367
|
+
}
|
|
2368
|
+
}
|
|
2369
|
+
}
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
#updatePlan(invalidation, servicePlan, index, name, tag) {
|
|
2373
|
+
if (servicePlan !== void 0 && LazyPlanServiceNode.is(servicePlan.tree.root)) {
|
|
2374
|
+
const planParams = this.#buildUpdatePlanParams(invalidation, index, name, tag);
|
|
2375
|
+
switch (invalidation.kind) {
|
|
2376
|
+
case CacheBindingInvalidationKind.bindingAdded:
|
|
2377
|
+
{
|
|
2378
|
+
const result = addRootServiceNodeBindingIfContextFree(planParams, servicePlan.tree.root, invalidation.binding);
|
|
2379
|
+
if (result.isContextFreeBinding) {
|
|
2380
|
+
if (result.shouldInvalidateServiceNode) {
|
|
2381
|
+
this.#invalidateNonCachePlanServiceNodeDescendents(servicePlan.tree.root);
|
|
2382
|
+
servicePlan.tree.root.invalidate();
|
|
2383
|
+
}
|
|
2384
|
+
} else {
|
|
2385
|
+
this.clearCache();
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2388
|
+
break;
|
|
2389
|
+
case CacheBindingInvalidationKind.bindingRemoved:
|
|
2390
|
+
{
|
|
2391
|
+
const result = removeRootServiceNodeBindingIfContextFree(planParams, servicePlan.tree.root, invalidation.binding);
|
|
2392
|
+
if (result.isContextFreeBinding) {
|
|
2393
|
+
if (result.bindingNodeRemoved !== void 0) {
|
|
2394
|
+
this.#invalidateNonCachePlanBindingNodeDescendents(result.bindingNodeRemoved);
|
|
2395
|
+
}
|
|
2396
|
+
} else {
|
|
2397
|
+
this.clearCache();
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
break;
|
|
2401
|
+
}
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
};
|
|
2405
|
+
|
|
2406
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/planning/calculations/handleResolveError.js
|
|
2407
|
+
var INDEX_NOT_FOUND = -1;
|
|
2408
|
+
function handleResolveError(params, error) {
|
|
2409
|
+
if (isStackOverflowError(error) || InversifyCoreError.isErrorOfKind(error, InversifyCoreErrorKind.planningMaxDepthExceeded)) {
|
|
2410
|
+
const stringifiedCircularDependencies = stringifyServiceIdentifierTrace2(extractLikelyCircularDependency2(params));
|
|
2411
|
+
throw new InversifyCoreError(InversifyCoreErrorKind.planning, `Circular dependency found: ${stringifiedCircularDependencies}`, { cause: error });
|
|
2412
|
+
}
|
|
2413
|
+
throw error;
|
|
2414
|
+
}
|
|
2415
|
+
function extractLikelyCircularDependency2(params) {
|
|
2416
|
+
const root = params.planResult.tree.root;
|
|
2417
|
+
const stack = [];
|
|
2418
|
+
function depthFirstSearch(node) {
|
|
2419
|
+
const existingIndex = stack.indexOf(node);
|
|
2420
|
+
if (existingIndex !== INDEX_NOT_FOUND) {
|
|
2421
|
+
const cycleNodes = [
|
|
2422
|
+
...stack.slice(existingIndex),
|
|
2423
|
+
node
|
|
2424
|
+
];
|
|
2425
|
+
return cycleNodes.map((n) => n.serviceIdentifier);
|
|
2426
|
+
}
|
|
2427
|
+
stack.push(node);
|
|
2428
|
+
try {
|
|
2429
|
+
for (const child of getChildServiceNodes(node)) {
|
|
2430
|
+
const result2 = depthFirstSearch(child);
|
|
2431
|
+
if (result2 !== void 0) {
|
|
2432
|
+
return result2;
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
} finally {
|
|
2436
|
+
stack.pop();
|
|
2437
|
+
}
|
|
2438
|
+
return void 0;
|
|
2439
|
+
}
|
|
2440
|
+
const result = depthFirstSearch(root);
|
|
2441
|
+
return result ?? [];
|
|
2442
|
+
}
|
|
2443
|
+
function getChildServiceNodes(serviceNode) {
|
|
2444
|
+
const children = [];
|
|
2445
|
+
const bindings = serviceNode.bindings;
|
|
2446
|
+
if (bindings === void 0) {
|
|
2447
|
+
return children;
|
|
2448
|
+
}
|
|
2449
|
+
const processBindingNode = (bindingNode) => {
|
|
2450
|
+
if (isPlanServiceRedirectionBindingNode(bindingNode)) {
|
|
2451
|
+
for (const redirection of bindingNode.redirections) {
|
|
2452
|
+
processBindingNode(redirection);
|
|
2453
|
+
}
|
|
2454
|
+
return;
|
|
2455
|
+
}
|
|
2456
|
+
switch (bindingNode.binding.type) {
|
|
2457
|
+
case bindingTypeValues.Instance: {
|
|
2458
|
+
const instanceNode = bindingNode;
|
|
2459
|
+
for (const ctorParam of instanceNode.constructorParams) {
|
|
2460
|
+
if (ctorParam !== void 0) {
|
|
2461
|
+
children.push(ctorParam);
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
for (const propParam of instanceNode.propertyParams.values()) {
|
|
2465
|
+
children.push(propParam);
|
|
2466
|
+
}
|
|
2467
|
+
break;
|
|
2468
|
+
}
|
|
2469
|
+
case bindingTypeValues.ResolvedValue: {
|
|
2470
|
+
const resolvedValueNode = bindingNode;
|
|
2471
|
+
for (const param of resolvedValueNode.params) {
|
|
2472
|
+
children.push(param);
|
|
2473
|
+
}
|
|
2474
|
+
break;
|
|
2475
|
+
}
|
|
2476
|
+
default:
|
|
2477
|
+
break;
|
|
2478
|
+
}
|
|
2479
|
+
};
|
|
2480
|
+
if (Array.isArray(bindings)) {
|
|
2481
|
+
for (const bindingNode of bindings) {
|
|
2482
|
+
processBindingNode(bindingNode);
|
|
2483
|
+
}
|
|
2484
|
+
} else {
|
|
2485
|
+
processBindingNode(bindings);
|
|
2486
|
+
}
|
|
2487
|
+
return children;
|
|
2488
|
+
}
|
|
2489
|
+
function stringifyServiceIdentifierTrace2(serviceIdentifiers) {
|
|
2490
|
+
const serviceIdentifiersArray = [...serviceIdentifiers];
|
|
2491
|
+
if (serviceIdentifiersArray.length === 0) {
|
|
2492
|
+
return "(No dependency trace)";
|
|
2493
|
+
}
|
|
2494
|
+
return serviceIdentifiersArray.map(stringifyServiceIdentifier).join(" -> ");
|
|
2495
|
+
}
|
|
2496
|
+
|
|
2497
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/calculations/resolveConstantValueBindingCallback.js
|
|
2498
|
+
function resolveConstantValueBindingCallback(_params, binding) {
|
|
2499
|
+
return binding.value;
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2502
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/cacheResolvedValue.js
|
|
2503
|
+
function cacheResolvedValue(binding, resolvedValue) {
|
|
2504
|
+
if (isPromise(resolvedValue)) {
|
|
2505
|
+
binding.cache = {
|
|
2506
|
+
isRight: true,
|
|
2507
|
+
value: resolvedValue
|
|
50
2508
|
};
|
|
2509
|
+
return resolvedValue.then((syncResolvedValue) => cacheSyncResolvedValue(binding, syncResolvedValue));
|
|
2510
|
+
}
|
|
2511
|
+
return cacheSyncResolvedValue(binding, resolvedValue);
|
|
51
2512
|
}
|
|
52
|
-
function
|
|
2513
|
+
function cacheSyncResolvedValue(binding, resolvedValue) {
|
|
2514
|
+
binding.cache = {
|
|
2515
|
+
isRight: true,
|
|
2516
|
+
value: resolvedValue
|
|
2517
|
+
};
|
|
2518
|
+
return resolvedValue;
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/resolveBindingServiceActivations.js
|
|
2522
|
+
function resolveBindingServiceActivations(params, serviceIdentifier, value) {
|
|
2523
|
+
const activations = params.getActivations(serviceIdentifier);
|
|
2524
|
+
if (activations === void 0) {
|
|
2525
|
+
return value;
|
|
2526
|
+
}
|
|
2527
|
+
if (isPromise(value)) {
|
|
2528
|
+
return resolveBindingActivationsFromIteratorAsync(params, value, activations[Symbol.iterator]());
|
|
2529
|
+
}
|
|
2530
|
+
return resolveBindingActivationsFromIterator(params, value, activations[Symbol.iterator]());
|
|
2531
|
+
}
|
|
2532
|
+
function resolveBindingActivationsFromIterator(params, value, activationsIterator) {
|
|
2533
|
+
let activatedValue = value;
|
|
2534
|
+
let activationIteratorResult = activationsIterator.next();
|
|
2535
|
+
while (activationIteratorResult.done !== true) {
|
|
2536
|
+
const nextActivatedValue = activationIteratorResult.value(params.context, activatedValue);
|
|
2537
|
+
if (isPromise(nextActivatedValue)) {
|
|
2538
|
+
return resolveBindingActivationsFromIteratorAsync(params, nextActivatedValue, activationsIterator);
|
|
2539
|
+
} else {
|
|
2540
|
+
activatedValue = nextActivatedValue;
|
|
2541
|
+
}
|
|
2542
|
+
activationIteratorResult = activationsIterator.next();
|
|
2543
|
+
}
|
|
2544
|
+
return activatedValue;
|
|
2545
|
+
}
|
|
2546
|
+
async function resolveBindingActivationsFromIteratorAsync(params, value, activationsIterator) {
|
|
2547
|
+
let activatedValue = await value;
|
|
2548
|
+
let activationIteratorResult = activationsIterator.next();
|
|
2549
|
+
while (activationIteratorResult.done !== true) {
|
|
2550
|
+
activatedValue = await activationIteratorResult.value(params.context, activatedValue);
|
|
2551
|
+
activationIteratorResult = activationsIterator.next();
|
|
2552
|
+
}
|
|
2553
|
+
return activatedValue;
|
|
2554
|
+
}
|
|
2555
|
+
|
|
2556
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/resolveBindingActivations.js
|
|
2557
|
+
function resolveBindingActivations(params, binding, value) {
|
|
2558
|
+
let activationResult = value;
|
|
2559
|
+
if (binding.onActivation !== void 0) {
|
|
2560
|
+
const onActivation = binding.onActivation;
|
|
2561
|
+
if (isPromise(activationResult)) {
|
|
2562
|
+
activationResult = activationResult.then((resolved) => onActivation(params.context, resolved));
|
|
2563
|
+
} else {
|
|
2564
|
+
activationResult = onActivation(params.context, activationResult);
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
return resolveBindingServiceActivations(params, binding.serviceIdentifier, activationResult);
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/resolveSingletonScopedBinding.js
|
|
2571
|
+
function resolveSingletonScopedBinding(resolve2) {
|
|
2572
|
+
return (params, binding) => {
|
|
2573
|
+
if (binding.cache.isRight) {
|
|
2574
|
+
return binding.cache.value;
|
|
2575
|
+
}
|
|
2576
|
+
const resolvedValue = resolveBindingActivations(params, binding, resolve2(params, binding));
|
|
2577
|
+
return cacheResolvedValue(binding, resolvedValue);
|
|
2578
|
+
};
|
|
2579
|
+
}
|
|
2580
|
+
|
|
2581
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/resolveConstantValueBinding.js
|
|
2582
|
+
var resolveConstantValueBinding = resolveSingletonScopedBinding(resolveConstantValueBindingCallback);
|
|
2583
|
+
|
|
2584
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/calculations/resolveDynamicValueBindingCallback.js
|
|
2585
|
+
function resolveDynamicValueBindingCallback(params, binding) {
|
|
2586
|
+
return binding.value(params.context);
|
|
2587
|
+
}
|
|
2588
|
+
|
|
2589
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/common/calculations/getSelf.js
|
|
2590
|
+
function getSelf(self) {
|
|
2591
|
+
return self;
|
|
2592
|
+
}
|
|
2593
|
+
|
|
2594
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/resolveScoped.js
|
|
2595
|
+
function resolveScoped(getBinding, resolve2) {
|
|
2596
|
+
return (params, arg) => {
|
|
2597
|
+
const binding = getBinding(arg);
|
|
2598
|
+
switch (binding.scope) {
|
|
2599
|
+
case bindingScopeValues.Singleton: {
|
|
2600
|
+
if (binding.cache.isRight) {
|
|
2601
|
+
return binding.cache.value;
|
|
2602
|
+
}
|
|
2603
|
+
const resolvedValue = resolveBindingActivations(params, binding, resolve2(params, arg));
|
|
2604
|
+
return cacheResolvedValue(binding, resolvedValue);
|
|
2605
|
+
}
|
|
2606
|
+
case bindingScopeValues.Request: {
|
|
2607
|
+
if (params.requestScopeCache.has(binding.id)) {
|
|
2608
|
+
return params.requestScopeCache.get(binding.id);
|
|
2609
|
+
}
|
|
2610
|
+
const resolvedValue = resolveBindingActivations(params, binding, resolve2(params, arg));
|
|
2611
|
+
params.requestScopeCache.set(binding.id, resolvedValue);
|
|
2612
|
+
return resolvedValue;
|
|
2613
|
+
}
|
|
2614
|
+
case bindingScopeValues.Transient:
|
|
2615
|
+
return resolveBindingActivations(params, binding, resolve2(params, arg));
|
|
2616
|
+
}
|
|
2617
|
+
};
|
|
2618
|
+
}
|
|
2619
|
+
|
|
2620
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/resolveScopedBinding.js
|
|
2621
|
+
var resolveScopedBinding = (resolve2) => resolveScoped(getSelf, resolve2);
|
|
2622
|
+
|
|
2623
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/resolveDynamicValueBinding.js
|
|
2624
|
+
var resolveDynamicValueBinding = resolveScopedBinding(resolveDynamicValueBindingCallback);
|
|
2625
|
+
|
|
2626
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/calculations/resolveFactoryBindingCallback.js
|
|
2627
|
+
function resolveFactoryBindingCallback(params, binding) {
|
|
2628
|
+
return binding.factory(params.context);
|
|
2629
|
+
}
|
|
2630
|
+
|
|
2631
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/resolveFactoryBinding.js
|
|
2632
|
+
var resolveFactoryBinding = resolveSingletonScopedBinding(resolveFactoryBindingCallback);
|
|
2633
|
+
|
|
2634
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/resolveInstanceBindingConstructorParams.js
|
|
2635
|
+
function resolveInstanceBindingConstructorParams(resolveServiceNode2) {
|
|
2636
|
+
return (params, node) => {
|
|
2637
|
+
const constructorResolvedValues = [];
|
|
2638
|
+
for (const constructorParam of node.constructorParams) {
|
|
2639
|
+
if (constructorParam === void 0) {
|
|
2640
|
+
constructorResolvedValues.push(void 0);
|
|
2641
|
+
} else {
|
|
2642
|
+
constructorResolvedValues.push(resolveServiceNode2(params, constructorParam));
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2645
|
+
return constructorResolvedValues.some(isPromise) ? Promise.all(constructorResolvedValues) : constructorResolvedValues;
|
|
2646
|
+
};
|
|
2647
|
+
}
|
|
2648
|
+
|
|
2649
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/resolveInstanceBindingNode.js
|
|
2650
|
+
function resolveInstanceBindingNode(resolveInstanceBindingConstructorParams2, resolveInstanceBindingNodeAsyncFromConstructorParams2, resolveInstanceBindingNodeFromConstructorParams2) {
|
|
2651
|
+
return (params, node) => {
|
|
2652
|
+
const constructorValues = resolveInstanceBindingConstructorParams2(params, node);
|
|
2653
|
+
if (isPromise(constructorValues)) {
|
|
2654
|
+
return resolveInstanceBindingNodeAsyncFromConstructorParams2(constructorValues, params, node);
|
|
2655
|
+
}
|
|
2656
|
+
return resolveInstanceBindingNodeFromConstructorParams2(constructorValues, params, node);
|
|
2657
|
+
};
|
|
2658
|
+
}
|
|
2659
|
+
|
|
2660
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/resolveInstanceBindingNodeAsyncFromConstructorParams.js
|
|
2661
|
+
function resolveInstanceBindingNodeAsyncFromConstructorParams(resolveInstanceBindingNodeFromConstructorParams2) {
|
|
2662
|
+
return async (constructorValues, params, node) => {
|
|
2663
|
+
const constructorResolvedValues = await constructorValues;
|
|
2664
|
+
return resolveInstanceBindingNodeFromConstructorParams2(constructorResolvedValues, params, node);
|
|
2665
|
+
};
|
|
2666
|
+
}
|
|
2667
|
+
|
|
2668
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/resolvePostConstruct.js
|
|
2669
|
+
function resolvePostConstruct(instance, binding, postConstructMethodName) {
|
|
2670
|
+
const postConstructResult = invokePostConstruct(instance, binding, postConstructMethodName);
|
|
2671
|
+
if (isPromise(postConstructResult)) {
|
|
2672
|
+
return postConstructResult.then(() => instance);
|
|
2673
|
+
}
|
|
2674
|
+
return instance;
|
|
2675
|
+
}
|
|
2676
|
+
function invokePostConstruct(instance, binding, postConstructMethodName) {
|
|
2677
|
+
if (postConstructMethodName in instance) {
|
|
2678
|
+
if (typeof instance[postConstructMethodName] === "function") {
|
|
2679
|
+
let postConstructResult;
|
|
2680
|
+
try {
|
|
2681
|
+
postConstructResult = instance[postConstructMethodName]();
|
|
2682
|
+
} catch (error) {
|
|
2683
|
+
throw new InversifyCoreError(InversifyCoreErrorKind.resolution, `Unexpected error found when calling "${postConstructMethodName.toString()}" @postConstruct decorated method on class "${binding.implementationType.name}"`, {
|
|
2684
|
+
cause: error
|
|
2685
|
+
});
|
|
2686
|
+
}
|
|
2687
|
+
if (isPromise(postConstructResult)) {
|
|
2688
|
+
return invokePostConstructAsync(binding, postConstructMethodName, postConstructResult);
|
|
2689
|
+
}
|
|
2690
|
+
} else {
|
|
2691
|
+
throw new InversifyCoreError(InversifyCoreErrorKind.resolution, `Expecting a "${postConstructMethodName.toString()}" method when resolving "${binding.implementationType.name}" class @postConstruct decorated method, a non function property was found instead.`);
|
|
2692
|
+
}
|
|
2693
|
+
} else {
|
|
2694
|
+
throw new InversifyCoreError(InversifyCoreErrorKind.resolution, `Expecting a "${postConstructMethodName.toString()}" property when resolving "${binding.implementationType.name}" class @postConstruct decorated method, none found.`);
|
|
2695
|
+
}
|
|
2696
|
+
}
|
|
2697
|
+
async function invokePostConstructAsync(binding, postConstructMethodName, postConstructResult) {
|
|
2698
|
+
try {
|
|
2699
|
+
await postConstructResult;
|
|
2700
|
+
} catch (error) {
|
|
2701
|
+
throw new InversifyCoreError(InversifyCoreErrorKind.resolution, `Unexpected error found when calling "${postConstructMethodName.toString()}" @postConstruct decorated method on class "${binding.implementationType.name}"`, {
|
|
2702
|
+
cause: error
|
|
2703
|
+
});
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
|
|
2707
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/resolveInstanceBindingNodeFromConstructorParams.js
|
|
2708
|
+
function resolveAllPostConstructMethods(instance, binding, postConstructMethodNames) {
|
|
2709
|
+
if (postConstructMethodNames.size === 0) {
|
|
2710
|
+
return instance;
|
|
2711
|
+
}
|
|
2712
|
+
let result = instance;
|
|
2713
|
+
for (const methodName of postConstructMethodNames) {
|
|
2714
|
+
if (isPromise(result)) {
|
|
2715
|
+
result = result.then((resolvedInstance) => resolvePostConstruct(resolvedInstance, binding, methodName));
|
|
2716
|
+
} else {
|
|
2717
|
+
result = resolvePostConstruct(result, binding, methodName);
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2720
|
+
return result;
|
|
2721
|
+
}
|
|
2722
|
+
function resolveInstanceBindingNodeFromConstructorParams(setInstanceProperties3) {
|
|
2723
|
+
return (constructorValues, params, node) => {
|
|
2724
|
+
const instance = new node.binding.implementationType(...constructorValues);
|
|
2725
|
+
const propertiesAssignmentResult = setInstanceProperties3(params, instance, node);
|
|
2726
|
+
if (isPromise(propertiesAssignmentResult)) {
|
|
2727
|
+
return propertiesAssignmentResult.then(() => resolveAllPostConstructMethods(instance, node.binding, node.classMetadata.lifecycle.postConstructMethodNames));
|
|
2728
|
+
}
|
|
2729
|
+
return resolveAllPostConstructMethods(instance, node.binding, node.classMetadata.lifecycle.postConstructMethodNames);
|
|
2730
|
+
};
|
|
2731
|
+
}
|
|
2732
|
+
|
|
2733
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/resolveResolvedValueBindingNode.js
|
|
2734
|
+
function resolveResolvedValueBindingNode(resolveResolvedValueBindingParams2) {
|
|
2735
|
+
return (params, node) => {
|
|
2736
|
+
const paramValues = resolveResolvedValueBindingParams2(params, node);
|
|
2737
|
+
if (isPromise(paramValues)) {
|
|
2738
|
+
return paramValues.then((resolvedParamValues) => node.binding.factory(...resolvedParamValues));
|
|
2739
|
+
}
|
|
2740
|
+
return node.binding.factory(...paramValues);
|
|
2741
|
+
};
|
|
2742
|
+
}
|
|
2743
|
+
|
|
2744
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/resolveResolvedValueBindingParams.js
|
|
2745
|
+
function resolveResolvedValueBindingParams(resolveServiceNode2) {
|
|
2746
|
+
return (params, node) => {
|
|
2747
|
+
const paramsResolvedValues = [];
|
|
2748
|
+
for (const param of node.params) {
|
|
2749
|
+
paramsResolvedValues.push(resolveServiceNode2(params, param));
|
|
2750
|
+
}
|
|
2751
|
+
return paramsResolvedValues.some(isPromise) ? Promise.all(paramsResolvedValues) : paramsResolvedValues;
|
|
2752
|
+
};
|
|
2753
|
+
}
|
|
2754
|
+
|
|
2755
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/calculations/getInstanceNodeBinding.js
|
|
2756
|
+
function getInstanceNodeBinding(node) {
|
|
2757
|
+
return node.binding;
|
|
2758
|
+
}
|
|
2759
|
+
|
|
2760
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/resolveScopedInstanceBindingNode.js
|
|
2761
|
+
var resolveScopedInstanceBindingNode = (resolve2) => resolveScoped(getInstanceNodeBinding, resolve2);
|
|
2762
|
+
|
|
2763
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/calculations/getResolvedValueNodeBinding.js
|
|
2764
|
+
function getResolvedValueNodeBinding(node) {
|
|
2765
|
+
return node.binding;
|
|
2766
|
+
}
|
|
2767
|
+
|
|
2768
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/resolveScopedResolvedValueBindingNode.js
|
|
2769
|
+
var resolveScopedResolvedValueBindingNode = (resolve2) => resolveScoped(getResolvedValueNodeBinding, resolve2);
|
|
2770
|
+
|
|
2771
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/resolveServiceRedirectionBindingNode.js
|
|
2772
|
+
function resolveServiceRedirectionBindingNode(resolveBindingNode2) {
|
|
2773
|
+
function innerResolveServiceRedirectionBindingNode(params, node) {
|
|
2774
|
+
const resolvedValues = [];
|
|
2775
|
+
for (const redirection of node.redirections) {
|
|
2776
|
+
if (isPlanServiceRedirectionBindingNode(redirection)) {
|
|
2777
|
+
resolvedValues.push(...innerResolveServiceRedirectionBindingNode(params, redirection));
|
|
2778
|
+
} else {
|
|
2779
|
+
resolvedValues.push(resolveBindingNode2(params, redirection));
|
|
2780
|
+
}
|
|
2781
|
+
}
|
|
2782
|
+
return resolvedValues;
|
|
2783
|
+
}
|
|
2784
|
+
return innerResolveServiceRedirectionBindingNode;
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2787
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/setInstanceProperties.js
|
|
2788
|
+
function setInstanceProperties(resolveServiceNode2) {
|
|
2789
|
+
return (params, instance, node) => {
|
|
2790
|
+
const propertyAssignmentPromises = [];
|
|
2791
|
+
for (const [propertyKey, propertyNode] of node.propertyParams) {
|
|
2792
|
+
const metadata = node.classMetadata.properties.get(propertyKey);
|
|
2793
|
+
if (metadata === void 0) {
|
|
2794
|
+
throw new InversifyCoreError(InversifyCoreErrorKind.resolution, `Expecting metadata at property "${propertyKey.toString()}", none found`);
|
|
2795
|
+
}
|
|
2796
|
+
if (metadata.kind !== ClassElementMetadataKind.unmanaged && propertyNode.bindings !== void 0) {
|
|
2797
|
+
instance[propertyKey] = resolveServiceNode2(params, propertyNode);
|
|
2798
|
+
if (isPromise(instance[propertyKey])) {
|
|
2799
|
+
propertyAssignmentPromises.push((async () => {
|
|
2800
|
+
instance[propertyKey] = await instance[propertyKey];
|
|
2801
|
+
})());
|
|
2802
|
+
}
|
|
2803
|
+
}
|
|
2804
|
+
}
|
|
2805
|
+
if (propertyAssignmentPromises.length > 0) {
|
|
2806
|
+
return Promise.all(propertyAssignmentPromises).then(() => void 0);
|
|
2807
|
+
}
|
|
2808
|
+
};
|
|
2809
|
+
}
|
|
2810
|
+
|
|
2811
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/resolve.js
|
|
2812
|
+
var setInstanceProperties2 = setInstanceProperties(resolveServiceNode);
|
|
2813
|
+
var resolveServiceRedirectionBindingNode2 = resolveServiceRedirectionBindingNode(resolveBindingNode);
|
|
2814
|
+
var resolveInstanceBindingNode2 = resolveInstanceBindingNode(
|
|
2815
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2816
|
+
resolveInstanceBindingConstructorParams(resolveServiceNode),
|
|
2817
|
+
resolveInstanceBindingNodeAsyncFromConstructorParams(resolveInstanceBindingNodeFromConstructorParams(setInstanceProperties2)),
|
|
2818
|
+
resolveInstanceBindingNodeFromConstructorParams(setInstanceProperties2)
|
|
2819
|
+
);
|
|
2820
|
+
var resolveResolvedValueBindingNode2 = resolveResolvedValueBindingNode(
|
|
2821
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2822
|
+
resolveResolvedValueBindingParams(resolveServiceNode)
|
|
2823
|
+
);
|
|
2824
|
+
var resolveScopedInstanceBindingNode2 = resolveScopedInstanceBindingNode(resolveInstanceBindingNode2);
|
|
2825
|
+
var resolveScopedResolvedValueBindingNode2 = resolveScopedResolvedValueBindingNode(resolveResolvedValueBindingNode2);
|
|
2826
|
+
function resolve(params) {
|
|
2827
|
+
try {
|
|
2828
|
+
const serviceNode = params.planResult.tree.root;
|
|
2829
|
+
return resolveServiceNode(params, serviceNode);
|
|
2830
|
+
} catch (error) {
|
|
2831
|
+
handleResolveError(params, error);
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
function resolveBindingNode(params, planBindingNode) {
|
|
2835
|
+
switch (planBindingNode.binding.type) {
|
|
2836
|
+
case bindingTypeValues.ConstantValue:
|
|
2837
|
+
return resolveConstantValueBinding(params, planBindingNode.binding);
|
|
2838
|
+
case bindingTypeValues.DynamicValue:
|
|
2839
|
+
return resolveDynamicValueBinding(params, planBindingNode.binding);
|
|
2840
|
+
case bindingTypeValues.Factory:
|
|
2841
|
+
return resolveFactoryBinding(params, planBindingNode.binding);
|
|
2842
|
+
case bindingTypeValues.Instance:
|
|
2843
|
+
return resolveScopedInstanceBindingNode2(params, planBindingNode);
|
|
2844
|
+
case bindingTypeValues.ResolvedValue:
|
|
2845
|
+
return resolveScopedResolvedValueBindingNode2(params, planBindingNode);
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2848
|
+
function resolveServiceNode(params, serviceNode) {
|
|
2849
|
+
if (serviceNode.bindings === void 0) {
|
|
2850
|
+
return void 0;
|
|
2851
|
+
}
|
|
2852
|
+
if (Array.isArray(serviceNode.bindings)) {
|
|
2853
|
+
return resolveMultipleBindingServiceNode(params, serviceNode.bindings);
|
|
2854
|
+
}
|
|
2855
|
+
return resolveSingleBindingServiceNode(params, serviceNode.bindings);
|
|
2856
|
+
}
|
|
2857
|
+
function resolveMultipleBindingServiceNode(params, bindings) {
|
|
2858
|
+
const resolvedValues = [];
|
|
2859
|
+
for (const binding of bindings) {
|
|
2860
|
+
if (isPlanServiceRedirectionBindingNode(binding)) {
|
|
2861
|
+
resolvedValues.push(...resolveServiceRedirectionBindingNode2(params, binding));
|
|
2862
|
+
} else {
|
|
2863
|
+
resolvedValues.push(resolveBindingNode(params, binding));
|
|
2864
|
+
}
|
|
2865
|
+
}
|
|
2866
|
+
if (resolvedValues.some(isPromise)) {
|
|
2867
|
+
return Promise.all(resolvedValues);
|
|
2868
|
+
}
|
|
2869
|
+
return resolvedValues;
|
|
2870
|
+
}
|
|
2871
|
+
function resolveSingleBindingServiceNode(params, binding) {
|
|
2872
|
+
if (isPlanServiceRedirectionBindingNode(binding)) {
|
|
2873
|
+
const resolvedValues = resolveServiceRedirectionBindingNode2(params, binding);
|
|
2874
|
+
if (resolvedValues.length === 1) {
|
|
2875
|
+
return resolvedValues[0];
|
|
2876
|
+
} else {
|
|
2877
|
+
throw new InversifyCoreError(InversifyCoreErrorKind.resolution, "Unexpected multiple resolved values on single injection");
|
|
2878
|
+
}
|
|
2879
|
+
} else {
|
|
2880
|
+
return resolveBindingNode(params, binding);
|
|
2881
|
+
}
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2884
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/binding/calculations/isScopedBinding.js
|
|
2885
|
+
function isScopedBinding(binding) {
|
|
2886
|
+
return binding.scope !== void 0;
|
|
2887
|
+
}
|
|
2888
|
+
|
|
2889
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/resolveBindingPreDestroy.js
|
|
2890
|
+
function resolveBindingPreDestroy(params, binding) {
|
|
2891
|
+
if (binding.type === bindingTypeValues.Instance) {
|
|
2892
|
+
const classMetadata = params.getClassMetadata(binding.implementationType);
|
|
2893
|
+
const instance = binding.cache.value;
|
|
2894
|
+
if (isPromise(instance)) {
|
|
2895
|
+
return instance.then((instance2) => resolveInstancePreDestroyMethods(classMetadata, instance2));
|
|
2896
|
+
} else {
|
|
2897
|
+
return resolveInstancePreDestroyMethods(classMetadata, instance);
|
|
2898
|
+
}
|
|
2899
|
+
}
|
|
2900
|
+
}
|
|
2901
|
+
function resolveInstancePreDestroyMethod(instance, methodName) {
|
|
2902
|
+
if (typeof instance[methodName] === "function") {
|
|
2903
|
+
const result = instance[methodName]();
|
|
2904
|
+
return result;
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
function resolveInstancePreDestroyMethods(classMetadata, instance) {
|
|
2908
|
+
const preDestroyMethodNames = classMetadata.lifecycle.preDestroyMethodNames;
|
|
2909
|
+
if (preDestroyMethodNames.size === 0) {
|
|
2910
|
+
return;
|
|
2911
|
+
}
|
|
2912
|
+
let result = void 0;
|
|
2913
|
+
for (const methodName of preDestroyMethodNames) {
|
|
2914
|
+
if (result === void 0) {
|
|
2915
|
+
result = resolveInstancePreDestroyMethod(instance, methodName);
|
|
2916
|
+
} else {
|
|
2917
|
+
result = result.then(() => resolveInstancePreDestroyMethod(instance, methodName));
|
|
2918
|
+
}
|
|
2919
|
+
}
|
|
2920
|
+
return result;
|
|
2921
|
+
}
|
|
2922
|
+
|
|
2923
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/resolveBindingServiceDeactivations.js
|
|
2924
|
+
function resolveBindingServiceDeactivations(params, serviceIdentifier, value) {
|
|
2925
|
+
const deactivations = params.getDeactivations(serviceIdentifier);
|
|
2926
|
+
if (deactivations === void 0) {
|
|
2927
|
+
return void 0;
|
|
2928
|
+
}
|
|
2929
|
+
if (isPromise(value)) {
|
|
2930
|
+
return resolveBindingDeactivationsFromIteratorAsync(value, deactivations[Symbol.iterator]());
|
|
2931
|
+
}
|
|
2932
|
+
return resolveBindingDeactivationsFromIterator(value, deactivations[Symbol.iterator]());
|
|
2933
|
+
}
|
|
2934
|
+
function resolveBindingDeactivationsFromIterator(value, deactivationsIterator) {
|
|
2935
|
+
let deactivationIteratorResult = deactivationsIterator.next();
|
|
2936
|
+
while (deactivationIteratorResult.done !== true) {
|
|
2937
|
+
const nextDeactivationValue = deactivationIteratorResult.value(value);
|
|
2938
|
+
if (isPromise(nextDeactivationValue)) {
|
|
2939
|
+
return resolveBindingDeactivationsFromIteratorAsync(value, deactivationsIterator);
|
|
2940
|
+
}
|
|
2941
|
+
deactivationIteratorResult = deactivationsIterator.next();
|
|
2942
|
+
}
|
|
2943
|
+
}
|
|
2944
|
+
async function resolveBindingDeactivationsFromIteratorAsync(value, deactivationsIterator) {
|
|
2945
|
+
const resolvedValue = await value;
|
|
2946
|
+
let deactivationIteratorResult = deactivationsIterator.next();
|
|
2947
|
+
while (deactivationIteratorResult.done !== true) {
|
|
2948
|
+
await deactivationIteratorResult.value(resolvedValue);
|
|
2949
|
+
deactivationIteratorResult = deactivationsIterator.next();
|
|
2950
|
+
}
|
|
2951
|
+
}
|
|
2952
|
+
|
|
2953
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/resolveBindingDeactivations.js
|
|
2954
|
+
function resolveBindingDeactivations(params, binding) {
|
|
2955
|
+
const preDestroyResult = resolveBindingPreDestroy(params, binding);
|
|
2956
|
+
if (preDestroyResult === void 0) {
|
|
2957
|
+
return resolveBindingDeactivationsAfterPreDestroy(params, binding);
|
|
2958
|
+
}
|
|
2959
|
+
return preDestroyResult.then(() => resolveBindingDeactivationsAfterPreDestroy(params, binding));
|
|
2960
|
+
}
|
|
2961
|
+
function resolveBindingDeactivationsAfterPreDestroy(params, binding) {
|
|
2962
|
+
const bindingCache = binding.cache;
|
|
2963
|
+
if (isPromise(bindingCache.value)) {
|
|
2964
|
+
return bindingCache.value.then((resolvedValue) => resolveBindingDeactivationsAfterPreDestroyFromValue(params, binding, resolvedValue));
|
|
2965
|
+
}
|
|
2966
|
+
return resolveBindingDeactivationsAfterPreDestroyFromValue(params, binding, bindingCache.value);
|
|
2967
|
+
}
|
|
2968
|
+
function resolveBindingDeactivationsAfterPreDestroyFromValue(params, binding, resolvedValue) {
|
|
2969
|
+
let deactivationResult = void 0;
|
|
2970
|
+
if (binding.onDeactivation !== void 0) {
|
|
2971
|
+
const bindingDeactivation = binding.onDeactivation;
|
|
2972
|
+
deactivationResult = bindingDeactivation(resolvedValue);
|
|
2973
|
+
}
|
|
2974
|
+
if (deactivationResult === void 0) {
|
|
2975
|
+
return resolveBindingServiceDeactivations(params, binding.serviceIdentifier, resolvedValue);
|
|
2976
|
+
} else {
|
|
2977
|
+
return deactivationResult.then(() => resolveBindingServiceDeactivations(params, binding.serviceIdentifier, resolvedValue));
|
|
2978
|
+
}
|
|
2979
|
+
}
|
|
2980
|
+
|
|
2981
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/resolveBindingsDeactivations.js
|
|
2982
|
+
function resolveBindingsDeactivations(params, bindings) {
|
|
2983
|
+
if (bindings === void 0) {
|
|
2984
|
+
return;
|
|
2985
|
+
}
|
|
2986
|
+
const singletonScopedBindings = filterCachedSinglentonScopedBindings(bindings);
|
|
2987
|
+
const deactivationPromiseResults = [];
|
|
2988
|
+
for (const binding of singletonScopedBindings) {
|
|
2989
|
+
const deactivationResult = resolveBindingDeactivations(params, binding);
|
|
2990
|
+
if (deactivationResult !== void 0) {
|
|
2991
|
+
deactivationPromiseResults.push(deactivationResult);
|
|
2992
|
+
}
|
|
2993
|
+
}
|
|
2994
|
+
if (deactivationPromiseResults.length > 0) {
|
|
2995
|
+
return Promise.all(deactivationPromiseResults).then(() => void 0);
|
|
2996
|
+
}
|
|
2997
|
+
}
|
|
2998
|
+
function filterCachedSinglentonScopedBindings(bindings) {
|
|
2999
|
+
const filteredBindings = [];
|
|
3000
|
+
for (const binding of bindings) {
|
|
3001
|
+
if (isScopedBinding(binding) && binding.scope === bindingScopeValues.Singleton && binding.cache.isRight) {
|
|
3002
|
+
filteredBindings.push(binding);
|
|
3003
|
+
}
|
|
3004
|
+
}
|
|
3005
|
+
return filteredBindings;
|
|
3006
|
+
}
|
|
3007
|
+
|
|
3008
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/resolveModuleDeactivations.js
|
|
3009
|
+
function resolveModuleDeactivations(params, moduleId) {
|
|
3010
|
+
const bindings = params.getBindingsFromModule(moduleId);
|
|
3011
|
+
return resolveBindingsDeactivations(params, bindings);
|
|
3012
|
+
}
|
|
3013
|
+
|
|
3014
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+core@10.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/resolution/actions/resolveServiceDeactivations.js
|
|
3015
|
+
function resolveServiceDeactivations(params, serviceIdentifier) {
|
|
3016
|
+
const bindings = params.getBindings(serviceIdentifier);
|
|
3017
|
+
return resolveBindingsDeactivations(params, bindings);
|
|
3018
|
+
}
|
|
3019
|
+
|
|
3020
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/models/BindingIdentifier.js
|
|
3021
|
+
var bindingIdentifierSymbol = /* @__PURE__ */ Symbol.for("@inversifyjs/container/bindingIdentifier");
|
|
3022
|
+
|
|
3023
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/calculations/isBindingIdentifier.js
|
|
3024
|
+
function isBindingIdentifier(value) {
|
|
3025
|
+
return typeof value === "object" && value !== null && value[bindingIdentifierSymbol] === true;
|
|
3026
|
+
}
|
|
3027
|
+
|
|
3028
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/container/binding/utils/BindingConstraintUtils.js
|
|
3029
|
+
var BindingConstraintUtils = class {
|
|
3030
|
+
static always = (_bindingConstraints) => {
|
|
3031
|
+
return true;
|
|
3032
|
+
};
|
|
3033
|
+
};
|
|
3034
|
+
|
|
3035
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/error/models/InversifyContainerError.js
|
|
3036
|
+
var isAppErrorSymbol2 = /* @__PURE__ */ Symbol.for("@inversifyjs/container/InversifyContainerError");
|
|
3037
|
+
var InversifyContainerError = class _InversifyContainerError extends Error {
|
|
3038
|
+
[isAppErrorSymbol2];
|
|
3039
|
+
kind;
|
|
3040
|
+
constructor(kind, message, options) {
|
|
3041
|
+
super(message, options);
|
|
3042
|
+
this[isAppErrorSymbol2] = true;
|
|
3043
|
+
this.kind = kind;
|
|
3044
|
+
}
|
|
3045
|
+
static is(value) {
|
|
3046
|
+
return typeof value === "object" && value !== null && value[isAppErrorSymbol2] === true;
|
|
3047
|
+
}
|
|
3048
|
+
static isErrorOfKind(value, kind) {
|
|
3049
|
+
return _InversifyContainerError.is(value) && value.kind === kind;
|
|
3050
|
+
}
|
|
3051
|
+
};
|
|
3052
|
+
|
|
3053
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/error/models/InversifyContainerErrorKind.js
|
|
3054
|
+
var InversifyContainerErrorKind;
|
|
3055
|
+
(function(InversifyContainerErrorKind2) {
|
|
3056
|
+
InversifyContainerErrorKind2[InversifyContainerErrorKind2["invalidOperation"] = 0] = "invalidOperation";
|
|
3057
|
+
})(InversifyContainerErrorKind || (InversifyContainerErrorKind = {}));
|
|
3058
|
+
|
|
3059
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/calculations/buildBindingIdentifier.js
|
|
3060
|
+
function buildBindingIdentifier(binding) {
|
|
3061
|
+
return {
|
|
3062
|
+
[bindingIdentifierSymbol]: true,
|
|
3063
|
+
id: binding.id
|
|
3064
|
+
};
|
|
3065
|
+
}
|
|
3066
|
+
|
|
3067
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/calculations/isAnyAncestorBindingConstraints.js
|
|
3068
|
+
function isAnyAncestorBindingConstraints(condition) {
|
|
3069
|
+
return (constraints) => {
|
|
3070
|
+
for (let ancestorMetadata = constraints.getAncestor(); ancestorMetadata !== void 0; ancestorMetadata = ancestorMetadata.getAncestor()) {
|
|
3071
|
+
if (condition(ancestorMetadata)) {
|
|
3072
|
+
return true;
|
|
3073
|
+
}
|
|
3074
|
+
}
|
|
3075
|
+
return false;
|
|
3076
|
+
};
|
|
3077
|
+
}
|
|
3078
|
+
|
|
3079
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/calculations/isBindingConstraintsWithName.js
|
|
3080
|
+
function isBindingConstraintsWithName(name) {
|
|
3081
|
+
return (constraints) => constraints.name === name;
|
|
3082
|
+
}
|
|
3083
|
+
|
|
3084
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/calculations/isAnyAncestorBindingConstraintsWithName.js
|
|
3085
|
+
function isAnyAncestorBindingConstraintsWithName(name) {
|
|
3086
|
+
return isAnyAncestorBindingConstraints(isBindingConstraintsWithName(name));
|
|
3087
|
+
}
|
|
3088
|
+
|
|
3089
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/calculations/isBindingConstraintsWithServiceId.js
|
|
3090
|
+
function isBindingConstraintsWithServiceId(serviceId) {
|
|
3091
|
+
return (constraints) => constraints.serviceIdentifier === serviceId;
|
|
3092
|
+
}
|
|
3093
|
+
|
|
3094
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/calculations/isAnyAncestorBindingConstraintsWithServiceId.js
|
|
3095
|
+
function isAnyAncestorBindingConstraintsWithServiceId(serviceId) {
|
|
3096
|
+
return isAnyAncestorBindingConstraints(isBindingConstraintsWithServiceId(serviceId));
|
|
3097
|
+
}
|
|
3098
|
+
|
|
3099
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/calculations/isBindingConstraintsWithTag.js
|
|
3100
|
+
function isBindingConstraintsWithTag(tag, value) {
|
|
3101
|
+
return (constraints) => constraints.tags.has(tag) && constraints.tags.get(tag) === value;
|
|
3102
|
+
}
|
|
3103
|
+
|
|
3104
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/calculations/isAnyAncestorBindingConstraintsWithTag.js
|
|
3105
|
+
function isAnyAncestorBindingConstraintsWithTag(tag, value) {
|
|
3106
|
+
return isAnyAncestorBindingConstraints(isBindingConstraintsWithTag(tag, value));
|
|
3107
|
+
}
|
|
3108
|
+
|
|
3109
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/calculations/isBindingConstraintsWithNoNameNorTags.js
|
|
3110
|
+
function isBindingConstraintsWithNoNameNorTags(constraints) {
|
|
3111
|
+
return constraints.name === void 0 && constraints.tags.size === 0;
|
|
3112
|
+
}
|
|
3113
|
+
|
|
3114
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/calculations/isMultipleResolvedValueMetadataInjectOptions.js
|
|
3115
|
+
function isMultipleResolvedValueMetadataInjectOptions(options) {
|
|
3116
|
+
return options.isMultiple === true;
|
|
3117
|
+
}
|
|
3118
|
+
|
|
3119
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/calculations/isNoAncestorBindingConstraints.js
|
|
3120
|
+
function isNoAncestorBindingConstraints(condition) {
|
|
3121
|
+
const isAnyAncestorBindingConstraintsConstraint = isAnyAncestorBindingConstraints(condition);
|
|
3122
|
+
return (constraints) => {
|
|
3123
|
+
return !isAnyAncestorBindingConstraintsConstraint(constraints);
|
|
3124
|
+
};
|
|
3125
|
+
}
|
|
3126
|
+
|
|
3127
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/calculations/isNoAncestorBindingConstraintsWithName.js
|
|
3128
|
+
function isNoAncestorBindingConstraintsWithName(name) {
|
|
3129
|
+
return isNoAncestorBindingConstraints(isBindingConstraintsWithName(name));
|
|
3130
|
+
}
|
|
3131
|
+
|
|
3132
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/calculations/isNoAncestorBindingConstraintsWithServiceId.js
|
|
3133
|
+
function isNoAncestorBindingConstraintsWithServiceId(serviceId) {
|
|
3134
|
+
return isNoAncestorBindingConstraints(isBindingConstraintsWithServiceId(serviceId));
|
|
3135
|
+
}
|
|
3136
|
+
|
|
3137
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/calculations/isNoAncestorBindingConstraintsWithTag.js
|
|
3138
|
+
function isNoAncestorBindingConstraintsWithTag(tag, value) {
|
|
3139
|
+
return isNoAncestorBindingConstraints(isBindingConstraintsWithTag(tag, value));
|
|
3140
|
+
}
|
|
3141
|
+
|
|
3142
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/calculations/isNotParentBindingConstraints.js
|
|
3143
|
+
function isNotParentBindingConstraints(condition) {
|
|
3144
|
+
return (constraints) => {
|
|
3145
|
+
const ancestorMetadata = constraints.getAncestor();
|
|
3146
|
+
return ancestorMetadata === void 0 || !condition(ancestorMetadata);
|
|
3147
|
+
};
|
|
3148
|
+
}
|
|
3149
|
+
|
|
3150
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/calculations/isNotParentBindingConstraintsWithName.js
|
|
3151
|
+
function isNotParentBindingConstraintsWithName(name) {
|
|
3152
|
+
return isNotParentBindingConstraints(isBindingConstraintsWithName(name));
|
|
3153
|
+
}
|
|
3154
|
+
|
|
3155
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/calculations/isNotParentBindingConstraintsWithServiceId.js
|
|
3156
|
+
function isNotParentBindingConstraintsWithServiceId(serviceId) {
|
|
3157
|
+
return isNotParentBindingConstraints(isBindingConstraintsWithServiceId(serviceId));
|
|
3158
|
+
}
|
|
3159
|
+
|
|
3160
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/calculations/isNotParentBindingConstraintsWithTag.js
|
|
3161
|
+
function isNotParentBindingConstraintsWithTag(tag, value) {
|
|
3162
|
+
return isNotParentBindingConstraints(isBindingConstraintsWithTag(tag, value));
|
|
3163
|
+
}
|
|
3164
|
+
|
|
3165
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/calculations/isParentBindingConstraints.js
|
|
3166
|
+
function isParentBindingConstraints(condition) {
|
|
3167
|
+
return (constraints) => {
|
|
3168
|
+
const ancestorMetadata = constraints.getAncestor();
|
|
3169
|
+
return ancestorMetadata !== void 0 && condition(ancestorMetadata);
|
|
3170
|
+
};
|
|
3171
|
+
}
|
|
3172
|
+
|
|
3173
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/calculations/isParentBindingConstraintsWithName.js
|
|
3174
|
+
function isParentBindingConstraintsWithName(name) {
|
|
3175
|
+
return isParentBindingConstraints(isBindingConstraintsWithName(name));
|
|
3176
|
+
}
|
|
3177
|
+
|
|
3178
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/calculations/isParentBindingConstraintsWithServiceId.js
|
|
3179
|
+
function isParentBindingConstraintsWithServiceId(serviceId) {
|
|
3180
|
+
return isParentBindingConstraints(isBindingConstraintsWithServiceId(serviceId));
|
|
3181
|
+
}
|
|
3182
|
+
|
|
3183
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/calculations/isParentBindingConstraintsWithTag.js
|
|
3184
|
+
function isParentBindingConstraintsWithTag(tag, value) {
|
|
3185
|
+
return isParentBindingConstraints(isBindingConstraintsWithTag(tag, value));
|
|
3186
|
+
}
|
|
3187
|
+
|
|
3188
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/calculations/isResolvedValueMetadataInjectOptions.js
|
|
3189
|
+
function isResolvedValueMetadataInjectOptions(options) {
|
|
3190
|
+
return typeof options === "object" && !LazyServiceIdentifier.is(options);
|
|
3191
|
+
}
|
|
3192
|
+
|
|
3193
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/binding/models/BindingFluentSyntaxImplementation.js
|
|
3194
|
+
var BindInFluentSyntaxImplementation = class {
|
|
3195
|
+
#binding;
|
|
3196
|
+
constructor(binding) {
|
|
3197
|
+
this.#binding = binding;
|
|
3198
|
+
}
|
|
3199
|
+
getIdentifier() {
|
|
3200
|
+
return buildBindingIdentifier(this.#binding);
|
|
3201
|
+
}
|
|
3202
|
+
inRequestScope() {
|
|
3203
|
+
this.#binding.scope = bindingScopeValues.Request;
|
|
3204
|
+
return new BindWhenOnFluentSyntaxImplementation(this.#binding);
|
|
3205
|
+
}
|
|
3206
|
+
inSingletonScope() {
|
|
3207
|
+
this.#binding.scope = bindingScopeValues.Singleton;
|
|
3208
|
+
return new BindWhenOnFluentSyntaxImplementation(this.#binding);
|
|
3209
|
+
}
|
|
3210
|
+
inTransientScope() {
|
|
3211
|
+
this.#binding.scope = bindingScopeValues.Transient;
|
|
3212
|
+
return new BindWhenOnFluentSyntaxImplementation(this.#binding);
|
|
3213
|
+
}
|
|
3214
|
+
};
|
|
3215
|
+
var BindToFluentSyntaxImplementation = class {
|
|
3216
|
+
#callback;
|
|
3217
|
+
#containerModuleId;
|
|
3218
|
+
#defaultScope;
|
|
3219
|
+
#serviceIdentifier;
|
|
3220
|
+
constructor(callback, containerModuleId, defaultScope, serviceIdentifier) {
|
|
3221
|
+
this.#callback = callback;
|
|
3222
|
+
this.#containerModuleId = containerModuleId;
|
|
3223
|
+
this.#defaultScope = defaultScope;
|
|
3224
|
+
this.#serviceIdentifier = serviceIdentifier;
|
|
3225
|
+
}
|
|
3226
|
+
to(type) {
|
|
3227
|
+
const classMetadata = getClassMetadata(type);
|
|
3228
|
+
const binding = {
|
|
3229
|
+
cache: {
|
|
3230
|
+
isRight: false,
|
|
3231
|
+
value: void 0
|
|
3232
|
+
},
|
|
3233
|
+
id: getBindingId(),
|
|
3234
|
+
implementationType: type,
|
|
3235
|
+
isSatisfiedBy: BindingConstraintUtils.always,
|
|
3236
|
+
moduleId: this.#containerModuleId,
|
|
3237
|
+
onActivation: void 0,
|
|
3238
|
+
onDeactivation: void 0,
|
|
3239
|
+
scope: classMetadata.scope ?? this.#defaultScope,
|
|
3240
|
+
serviceIdentifier: this.#serviceIdentifier,
|
|
3241
|
+
type: bindingTypeValues.Instance
|
|
3242
|
+
};
|
|
3243
|
+
this.#callback(binding);
|
|
3244
|
+
return new BindInWhenOnFluentSyntaxImplementation(binding);
|
|
3245
|
+
}
|
|
3246
|
+
toSelf() {
|
|
3247
|
+
if (typeof this.#serviceIdentifier !== "function") {
|
|
3248
|
+
throw new Error('"toSelf" function can only be applied when a newable function is used as service identifier');
|
|
3249
|
+
}
|
|
3250
|
+
return this.to(this.#serviceIdentifier);
|
|
3251
|
+
}
|
|
3252
|
+
toConstantValue(value) {
|
|
3253
|
+
const binding = {
|
|
3254
|
+
cache: {
|
|
3255
|
+
isRight: false,
|
|
3256
|
+
value: void 0
|
|
3257
|
+
},
|
|
3258
|
+
id: getBindingId(),
|
|
3259
|
+
isSatisfiedBy: BindingConstraintUtils.always,
|
|
3260
|
+
moduleId: this.#containerModuleId,
|
|
3261
|
+
onActivation: void 0,
|
|
3262
|
+
onDeactivation: void 0,
|
|
3263
|
+
scope: bindingScopeValues.Singleton,
|
|
3264
|
+
serviceIdentifier: this.#serviceIdentifier,
|
|
3265
|
+
type: bindingTypeValues.ConstantValue,
|
|
3266
|
+
value
|
|
3267
|
+
};
|
|
3268
|
+
this.#callback(binding);
|
|
3269
|
+
return new BindWhenOnFluentSyntaxImplementation(binding);
|
|
3270
|
+
}
|
|
3271
|
+
toDynamicValue(builder) {
|
|
3272
|
+
const binding = {
|
|
3273
|
+
cache: {
|
|
3274
|
+
isRight: false,
|
|
3275
|
+
value: void 0
|
|
3276
|
+
},
|
|
3277
|
+
id: getBindingId(),
|
|
3278
|
+
isSatisfiedBy: BindingConstraintUtils.always,
|
|
3279
|
+
moduleId: this.#containerModuleId,
|
|
3280
|
+
onActivation: void 0,
|
|
3281
|
+
onDeactivation: void 0,
|
|
3282
|
+
scope: this.#defaultScope,
|
|
3283
|
+
serviceIdentifier: this.#serviceIdentifier,
|
|
3284
|
+
type: bindingTypeValues.DynamicValue,
|
|
3285
|
+
value: builder
|
|
3286
|
+
};
|
|
3287
|
+
this.#callback(binding);
|
|
3288
|
+
return new BindInWhenOnFluentSyntaxImplementation(binding);
|
|
3289
|
+
}
|
|
3290
|
+
toResolvedValue(factory, injectOptions) {
|
|
3291
|
+
const binding = {
|
|
3292
|
+
cache: {
|
|
3293
|
+
isRight: false,
|
|
3294
|
+
value: void 0
|
|
3295
|
+
},
|
|
3296
|
+
factory,
|
|
3297
|
+
id: getBindingId(),
|
|
3298
|
+
isSatisfiedBy: BindingConstraintUtils.always,
|
|
3299
|
+
metadata: this.#buildResolvedValueMetadata(injectOptions),
|
|
3300
|
+
moduleId: this.#containerModuleId,
|
|
3301
|
+
onActivation: void 0,
|
|
3302
|
+
onDeactivation: void 0,
|
|
3303
|
+
scope: this.#defaultScope,
|
|
3304
|
+
serviceIdentifier: this.#serviceIdentifier,
|
|
3305
|
+
type: bindingTypeValues.ResolvedValue
|
|
3306
|
+
};
|
|
3307
|
+
this.#callback(binding);
|
|
3308
|
+
return new BindInWhenOnFluentSyntaxImplementation(binding);
|
|
3309
|
+
}
|
|
3310
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3311
|
+
toFactory(builder) {
|
|
3312
|
+
const binding = {
|
|
3313
|
+
cache: {
|
|
3314
|
+
isRight: false,
|
|
3315
|
+
value: void 0
|
|
3316
|
+
},
|
|
3317
|
+
factory: builder,
|
|
3318
|
+
id: getBindingId(),
|
|
3319
|
+
isSatisfiedBy: BindingConstraintUtils.always,
|
|
3320
|
+
moduleId: this.#containerModuleId,
|
|
3321
|
+
onActivation: void 0,
|
|
3322
|
+
onDeactivation: void 0,
|
|
3323
|
+
scope: bindingScopeValues.Singleton,
|
|
3324
|
+
serviceIdentifier: this.#serviceIdentifier,
|
|
3325
|
+
type: bindingTypeValues.Factory
|
|
3326
|
+
};
|
|
3327
|
+
this.#callback(binding);
|
|
3328
|
+
return new BindWhenOnFluentSyntaxImplementation(binding);
|
|
3329
|
+
}
|
|
3330
|
+
toService(service) {
|
|
3331
|
+
const binding = {
|
|
3332
|
+
id: getBindingId(),
|
|
3333
|
+
isSatisfiedBy: BindingConstraintUtils.always,
|
|
3334
|
+
moduleId: this.#containerModuleId,
|
|
3335
|
+
serviceIdentifier: this.#serviceIdentifier,
|
|
3336
|
+
targetServiceIdentifier: service,
|
|
3337
|
+
type: bindingTypeValues.ServiceRedirection
|
|
3338
|
+
};
|
|
3339
|
+
this.#callback(binding);
|
|
3340
|
+
}
|
|
3341
|
+
#buildResolvedValueMetadata(options) {
|
|
3342
|
+
const resolvedValueMetadata = {
|
|
3343
|
+
arguments: (options ?? []).map((injectOption) => {
|
|
3344
|
+
if (isResolvedValueMetadataInjectOptions(injectOption)) {
|
|
3345
|
+
if (isMultipleResolvedValueMetadataInjectOptions(injectOption)) {
|
|
3346
|
+
return {
|
|
3347
|
+
chained: injectOption.chained ?? false,
|
|
3348
|
+
kind: ResolvedValueElementMetadataKind.multipleInjection,
|
|
3349
|
+
name: injectOption.name,
|
|
3350
|
+
optional: injectOption.optional ?? false,
|
|
3351
|
+
tags: new Map((injectOption.tags ?? []).map((tag) => [
|
|
3352
|
+
tag.key,
|
|
3353
|
+
tag.value
|
|
3354
|
+
])),
|
|
3355
|
+
value: injectOption.serviceIdentifier
|
|
3356
|
+
};
|
|
3357
|
+
} else {
|
|
3358
|
+
return {
|
|
3359
|
+
kind: ResolvedValueElementMetadataKind.singleInjection,
|
|
3360
|
+
name: injectOption.name,
|
|
3361
|
+
optional: injectOption.optional ?? false,
|
|
3362
|
+
tags: new Map((injectOption.tags ?? []).map((tag) => [
|
|
3363
|
+
tag.key,
|
|
3364
|
+
tag.value
|
|
3365
|
+
])),
|
|
3366
|
+
value: injectOption.serviceIdentifier
|
|
3367
|
+
};
|
|
3368
|
+
}
|
|
3369
|
+
} else {
|
|
3370
|
+
return {
|
|
3371
|
+
kind: ResolvedValueElementMetadataKind.singleInjection,
|
|
3372
|
+
name: void 0,
|
|
3373
|
+
optional: false,
|
|
3374
|
+
tags: /* @__PURE__ */ new Map(),
|
|
3375
|
+
value: injectOption
|
|
3376
|
+
};
|
|
3377
|
+
}
|
|
3378
|
+
})
|
|
3379
|
+
};
|
|
3380
|
+
return resolvedValueMetadata;
|
|
3381
|
+
}
|
|
3382
|
+
};
|
|
3383
|
+
var BindOnFluentSyntaxImplementation = class {
|
|
3384
|
+
#binding;
|
|
3385
|
+
constructor(binding) {
|
|
3386
|
+
this.#binding = binding;
|
|
3387
|
+
}
|
|
3388
|
+
getIdentifier() {
|
|
3389
|
+
return buildBindingIdentifier(this.#binding);
|
|
3390
|
+
}
|
|
3391
|
+
onActivation(activation) {
|
|
3392
|
+
this.#binding.onActivation = activation;
|
|
3393
|
+
return new BindWhenFluentSyntaxImplementation(this.#binding);
|
|
3394
|
+
}
|
|
3395
|
+
onDeactivation(deactivation) {
|
|
3396
|
+
this.#binding.onDeactivation = deactivation;
|
|
3397
|
+
if (this.#binding.scope !== bindingScopeValues.Singleton) {
|
|
3398
|
+
throw new InversifyContainerError(InversifyContainerErrorKind.invalidOperation, `Binding for service "${stringifyServiceIdentifier(this.#binding.serviceIdentifier)}" has a deactivation function, but its scope is not singleton. Deactivation functions can only be used with singleton bindings.`);
|
|
3399
|
+
}
|
|
3400
|
+
return new BindWhenFluentSyntaxImplementation(this.#binding);
|
|
3401
|
+
}
|
|
3402
|
+
};
|
|
3403
|
+
var BindWhenFluentSyntaxImplementation = class {
|
|
3404
|
+
#binding;
|
|
3405
|
+
constructor(binding) {
|
|
3406
|
+
this.#binding = binding;
|
|
3407
|
+
}
|
|
3408
|
+
getIdentifier() {
|
|
3409
|
+
return buildBindingIdentifier(this.#binding);
|
|
3410
|
+
}
|
|
3411
|
+
when(constraint) {
|
|
3412
|
+
this.#binding.isSatisfiedBy = constraint;
|
|
3413
|
+
return new BindOnFluentSyntaxImplementation(this.#binding);
|
|
3414
|
+
}
|
|
3415
|
+
whenAnyAncestor(constraint) {
|
|
3416
|
+
return this.when(isAnyAncestorBindingConstraints(constraint));
|
|
3417
|
+
}
|
|
3418
|
+
whenAnyAncestorIs(serviceIdentifier) {
|
|
3419
|
+
return this.when(isAnyAncestorBindingConstraintsWithServiceId(serviceIdentifier));
|
|
3420
|
+
}
|
|
3421
|
+
whenAnyAncestorNamed(name) {
|
|
3422
|
+
return this.when(isAnyAncestorBindingConstraintsWithName(name));
|
|
3423
|
+
}
|
|
3424
|
+
whenAnyAncestorTagged(tag, tagValue) {
|
|
3425
|
+
return this.when(isAnyAncestorBindingConstraintsWithTag(tag, tagValue));
|
|
3426
|
+
}
|
|
3427
|
+
whenDefault() {
|
|
3428
|
+
return this.when(isBindingConstraintsWithNoNameNorTags);
|
|
3429
|
+
}
|
|
3430
|
+
whenNamed(name) {
|
|
3431
|
+
return this.when(isBindingConstraintsWithName(name));
|
|
3432
|
+
}
|
|
3433
|
+
whenNoParent(constraint) {
|
|
3434
|
+
return this.when(isNotParentBindingConstraints(constraint));
|
|
3435
|
+
}
|
|
3436
|
+
whenNoParentIs(serviceIdentifier) {
|
|
3437
|
+
return this.when(isNotParentBindingConstraintsWithServiceId(serviceIdentifier));
|
|
3438
|
+
}
|
|
3439
|
+
whenNoParentNamed(name) {
|
|
3440
|
+
return this.when(isNotParentBindingConstraintsWithName(name));
|
|
3441
|
+
}
|
|
3442
|
+
whenNoParentTagged(tag, tagValue) {
|
|
3443
|
+
return this.when(isNotParentBindingConstraintsWithTag(tag, tagValue));
|
|
3444
|
+
}
|
|
3445
|
+
whenParent(constraint) {
|
|
3446
|
+
return this.when(isParentBindingConstraints(constraint));
|
|
3447
|
+
}
|
|
3448
|
+
whenParentIs(serviceIdentifier) {
|
|
3449
|
+
return this.when(isParentBindingConstraintsWithServiceId(serviceIdentifier));
|
|
3450
|
+
}
|
|
3451
|
+
whenParentNamed(name) {
|
|
3452
|
+
return this.when(isParentBindingConstraintsWithName(name));
|
|
3453
|
+
}
|
|
3454
|
+
whenParentTagged(tag, tagValue) {
|
|
3455
|
+
return this.when(isParentBindingConstraintsWithTag(tag, tagValue));
|
|
3456
|
+
}
|
|
3457
|
+
whenTagged(tag, tagValue) {
|
|
3458
|
+
return this.when(isBindingConstraintsWithTag(tag, tagValue));
|
|
3459
|
+
}
|
|
3460
|
+
whenNoAncestor(constraint) {
|
|
3461
|
+
return this.when(isNoAncestorBindingConstraints(constraint));
|
|
3462
|
+
}
|
|
3463
|
+
whenNoAncestorIs(serviceIdentifier) {
|
|
3464
|
+
return this.when(isNoAncestorBindingConstraintsWithServiceId(serviceIdentifier));
|
|
3465
|
+
}
|
|
3466
|
+
whenNoAncestorNamed(name) {
|
|
3467
|
+
return this.when(isNoAncestorBindingConstraintsWithName(name));
|
|
3468
|
+
}
|
|
3469
|
+
whenNoAncestorTagged(tag, tagValue) {
|
|
3470
|
+
return this.when(isNoAncestorBindingConstraintsWithTag(tag, tagValue));
|
|
3471
|
+
}
|
|
3472
|
+
};
|
|
3473
|
+
var BindWhenOnFluentSyntaxImplementation = class extends BindWhenFluentSyntaxImplementation {
|
|
3474
|
+
#bindOnFluentSyntax;
|
|
3475
|
+
constructor(binding) {
|
|
3476
|
+
super(binding);
|
|
3477
|
+
this.#bindOnFluentSyntax = new BindOnFluentSyntaxImplementation(binding);
|
|
3478
|
+
}
|
|
3479
|
+
onActivation(activation) {
|
|
3480
|
+
return this.#bindOnFluentSyntax.onActivation(activation);
|
|
3481
|
+
}
|
|
3482
|
+
onDeactivation(deactivation) {
|
|
3483
|
+
return this.#bindOnFluentSyntax.onDeactivation(deactivation);
|
|
3484
|
+
}
|
|
3485
|
+
};
|
|
3486
|
+
var BindInWhenOnFluentSyntaxImplementation = class extends BindWhenOnFluentSyntaxImplementation {
|
|
3487
|
+
#bindInFluentSyntax;
|
|
3488
|
+
constructor(binding) {
|
|
3489
|
+
super(binding);
|
|
3490
|
+
this.#bindInFluentSyntax = new BindInFluentSyntaxImplementation(binding);
|
|
3491
|
+
}
|
|
3492
|
+
inRequestScope() {
|
|
3493
|
+
return this.#bindInFluentSyntax.inRequestScope();
|
|
3494
|
+
}
|
|
3495
|
+
inSingletonScope() {
|
|
3496
|
+
return this.#bindInFluentSyntax.inSingletonScope();
|
|
3497
|
+
}
|
|
3498
|
+
inTransientScope() {
|
|
3499
|
+
return this.#bindInFluentSyntax.inTransientScope();
|
|
3500
|
+
}
|
|
3501
|
+
};
|
|
3502
|
+
|
|
3503
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/common/actions/getFirstIteratorResult.js
|
|
3504
|
+
function getFirstIteratorResult(iterator) {
|
|
3505
|
+
if (iterator === void 0) {
|
|
3506
|
+
return void 0;
|
|
3507
|
+
}
|
|
3508
|
+
const firstIteratorResult = iterator.next();
|
|
3509
|
+
if (firstIteratorResult.done === true) {
|
|
3510
|
+
return void 0;
|
|
3511
|
+
}
|
|
3512
|
+
return firstIteratorResult.value;
|
|
3513
|
+
}
|
|
3514
|
+
|
|
3515
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/common/calculations/getFirstIterableResult.js
|
|
3516
|
+
function getFirstIterableResult(iterable) {
|
|
3517
|
+
return getFirstIteratorResult(iterable?.[Symbol.iterator]());
|
|
3518
|
+
}
|
|
3519
|
+
|
|
3520
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/container/services/BindingManager.js
|
|
3521
|
+
var BindingManager = class {
|
|
3522
|
+
#deactivationParams;
|
|
3523
|
+
#defaultScope;
|
|
3524
|
+
#planResultCacheManager;
|
|
3525
|
+
#serviceReferenceManager;
|
|
3526
|
+
constructor(deactivationParams, defaultScope, planResultCacheManager, serviceReferenceManager) {
|
|
3527
|
+
this.#deactivationParams = deactivationParams;
|
|
3528
|
+
this.#defaultScope = defaultScope;
|
|
3529
|
+
this.#planResultCacheManager = planResultCacheManager;
|
|
3530
|
+
this.#serviceReferenceManager = serviceReferenceManager;
|
|
3531
|
+
}
|
|
3532
|
+
bind(serviceIdentifier) {
|
|
3533
|
+
return new BindToFluentSyntaxImplementation((binding) => {
|
|
3534
|
+
this.#setBinding(binding);
|
|
3535
|
+
}, void 0, this.#defaultScope, serviceIdentifier);
|
|
3536
|
+
}
|
|
3537
|
+
isBound(serviceIdentifier, options) {
|
|
3538
|
+
const bindings = this.#serviceReferenceManager.bindingService.get(serviceIdentifier);
|
|
3539
|
+
return this.#isAnyValidBinding(serviceIdentifier, bindings, options);
|
|
3540
|
+
}
|
|
3541
|
+
isCurrentBound(serviceIdentifier, options) {
|
|
3542
|
+
const bindings = this.#serviceReferenceManager.bindingService.getNonParentBindings(serviceIdentifier);
|
|
3543
|
+
return this.#isAnyValidBinding(serviceIdentifier, bindings, options);
|
|
3544
|
+
}
|
|
3545
|
+
async rebindAsync(serviceIdentifier) {
|
|
3546
|
+
await this.unbindAsync(serviceIdentifier);
|
|
3547
|
+
return this.bind(serviceIdentifier);
|
|
3548
|
+
}
|
|
3549
|
+
rebind(serviceIdentifier) {
|
|
3550
|
+
this.unbind(serviceIdentifier);
|
|
3551
|
+
return this.bind(serviceIdentifier);
|
|
3552
|
+
}
|
|
3553
|
+
async unbindAsync(identifier) {
|
|
3554
|
+
await this.#unbindAsync(identifier);
|
|
3555
|
+
}
|
|
3556
|
+
async unbindAllAsync() {
|
|
3557
|
+
await this.#unbindAll();
|
|
3558
|
+
}
|
|
3559
|
+
unbindAll() {
|
|
3560
|
+
const result = this.#unbindAll();
|
|
3561
|
+
if (result !== void 0) {
|
|
3562
|
+
throw new InversifyContainerError(InversifyContainerErrorKind.invalidOperation, "Unexpected asynchronous deactivation when unbinding all services. Consider using Container.unbindAllAsync() instead.");
|
|
3563
|
+
}
|
|
3564
|
+
}
|
|
3565
|
+
unbind(identifier) {
|
|
3566
|
+
const result = this.#unbindAsync(identifier);
|
|
3567
|
+
if (result !== void 0) {
|
|
3568
|
+
this.#throwUnexpectedAsyncUnbindOperation(identifier);
|
|
3569
|
+
}
|
|
3570
|
+
}
|
|
3571
|
+
#setBinding(binding) {
|
|
3572
|
+
this.#serviceReferenceManager.bindingService.set(binding);
|
|
3573
|
+
this.#planResultCacheManager.invalidateService({
|
|
3574
|
+
binding,
|
|
3575
|
+
kind: CacheBindingInvalidationKind.bindingAdded
|
|
3576
|
+
});
|
|
3577
|
+
}
|
|
3578
|
+
#throwUnexpectedAsyncUnbindOperation(identifier) {
|
|
3579
|
+
let errorMessage;
|
|
3580
|
+
if (isBindingIdentifier(identifier)) {
|
|
3581
|
+
const bindingsById = this.#serviceReferenceManager.bindingService.getById(identifier.id);
|
|
3582
|
+
const bindingServiceIdentifier = getFirstIterableResult(bindingsById)?.serviceIdentifier;
|
|
3583
|
+
if (bindingServiceIdentifier === void 0) {
|
|
3584
|
+
errorMessage = "Unexpected asynchronous deactivation when unbinding binding identifier. Consider using Container.unbindAsync() instead.";
|
|
3585
|
+
} else {
|
|
3586
|
+
errorMessage = `Unexpected asynchronous deactivation when unbinding "${stringifyServiceIdentifier(bindingServiceIdentifier)}" binding. Consider using Container.unbindAsync() instead.`;
|
|
3587
|
+
}
|
|
3588
|
+
} else {
|
|
3589
|
+
errorMessage = `Unexpected asynchronous deactivation when unbinding "${stringifyServiceIdentifier(identifier)}" service. Consider using Container.unbindAsync() instead.`;
|
|
3590
|
+
}
|
|
3591
|
+
throw new InversifyContainerError(InversifyContainerErrorKind.invalidOperation, errorMessage);
|
|
3592
|
+
}
|
|
3593
|
+
#unbindAsync(identifier) {
|
|
3594
|
+
if (isBindingIdentifier(identifier)) {
|
|
3595
|
+
return this.#unbindBindingIdentifier(identifier);
|
|
3596
|
+
}
|
|
3597
|
+
return this.#unbindServiceIdentifier(identifier);
|
|
3598
|
+
}
|
|
3599
|
+
#unbindBindingIdentifier(identifier) {
|
|
3600
|
+
const bindingsIterable = this.#serviceReferenceManager.bindingService.getById(identifier.id);
|
|
3601
|
+
const bindings = bindingsIterable === void 0 ? void 0 : [...bindingsIterable];
|
|
3602
|
+
const result = resolveBindingsDeactivations(this.#deactivationParams, bindingsIterable);
|
|
3603
|
+
if (result === void 0) {
|
|
3604
|
+
this.#clearAfterUnbindBindingIdentifier(bindings, identifier);
|
|
3605
|
+
} else {
|
|
3606
|
+
return result.then(() => {
|
|
3607
|
+
this.#clearAfterUnbindBindingIdentifier(bindings, identifier);
|
|
3608
|
+
});
|
|
3609
|
+
}
|
|
3610
|
+
}
|
|
3611
|
+
#clearAfterUnbindBindingIdentifier(bindings, identifier) {
|
|
3612
|
+
this.#serviceReferenceManager.bindingService.removeById(identifier.id);
|
|
3613
|
+
if (bindings !== void 0) {
|
|
3614
|
+
for (const binding of bindings) {
|
|
3615
|
+
this.#planResultCacheManager.invalidateService({
|
|
3616
|
+
binding,
|
|
3617
|
+
kind: CacheBindingInvalidationKind.bindingRemoved
|
|
3618
|
+
});
|
|
3619
|
+
}
|
|
3620
|
+
}
|
|
3621
|
+
}
|
|
3622
|
+
#unbindAll() {
|
|
3623
|
+
const nonParentBoundServiceIds = [
|
|
3624
|
+
...this.#serviceReferenceManager.bindingService.getNonParentBoundServices()
|
|
3625
|
+
];
|
|
3626
|
+
const deactivationResults = nonParentBoundServiceIds.map((serviceId) => resolveServiceDeactivations(this.#deactivationParams, serviceId));
|
|
3627
|
+
const hasAsyncDeactivations = deactivationResults.some((result) => isPromise(result));
|
|
3628
|
+
if (hasAsyncDeactivations) {
|
|
3629
|
+
return Promise.all(deactivationResults).then(() => {
|
|
3630
|
+
this.#clearAfterUnbindAll(nonParentBoundServiceIds);
|
|
3631
|
+
});
|
|
3632
|
+
}
|
|
3633
|
+
this.#clearAfterUnbindAll(nonParentBoundServiceIds);
|
|
3634
|
+
}
|
|
3635
|
+
#clearAfterUnbindAll(serviceIds) {
|
|
3636
|
+
for (const serviceId of serviceIds) {
|
|
3637
|
+
this.#serviceReferenceManager.activationService.removeAllByServiceId(serviceId);
|
|
3638
|
+
this.#serviceReferenceManager.bindingService.removeAllByServiceId(serviceId);
|
|
3639
|
+
this.#serviceReferenceManager.deactivationService.removeAllByServiceId(serviceId);
|
|
3640
|
+
}
|
|
3641
|
+
this.#serviceReferenceManager.planResultCacheService.clearCache();
|
|
3642
|
+
}
|
|
3643
|
+
#unbindServiceIdentifier(identifier) {
|
|
3644
|
+
const bindingsIterable = this.#serviceReferenceManager.bindingService.get(identifier);
|
|
3645
|
+
const bindings = bindingsIterable === void 0 ? void 0 : [...bindingsIterable];
|
|
3646
|
+
const result = resolveBindingsDeactivations(this.#deactivationParams, bindingsIterable);
|
|
3647
|
+
if (result === void 0) {
|
|
3648
|
+
this.#clearAfterUnbindServiceIdentifier(identifier, bindings);
|
|
3649
|
+
} else {
|
|
3650
|
+
return result.then(() => {
|
|
3651
|
+
this.#clearAfterUnbindServiceIdentifier(identifier, bindings);
|
|
3652
|
+
});
|
|
3653
|
+
}
|
|
3654
|
+
}
|
|
3655
|
+
#clearAfterUnbindServiceIdentifier(identifier, bindings) {
|
|
3656
|
+
this.#serviceReferenceManager.activationService.removeAllByServiceId(identifier);
|
|
3657
|
+
this.#serviceReferenceManager.bindingService.removeAllByServiceId(identifier);
|
|
3658
|
+
this.#serviceReferenceManager.deactivationService.removeAllByServiceId(identifier);
|
|
3659
|
+
if (bindings !== void 0) {
|
|
3660
|
+
for (const binding of bindings) {
|
|
3661
|
+
this.#planResultCacheManager.invalidateService({
|
|
3662
|
+
binding,
|
|
3663
|
+
kind: CacheBindingInvalidationKind.bindingRemoved
|
|
3664
|
+
});
|
|
3665
|
+
}
|
|
3666
|
+
}
|
|
3667
|
+
}
|
|
3668
|
+
#isAnyValidBinding(serviceIdentifier, bindings, options) {
|
|
3669
|
+
if (bindings === void 0) {
|
|
3670
|
+
return false;
|
|
3671
|
+
}
|
|
3672
|
+
const bindingConstraints = {
|
|
3673
|
+
getAncestor: () => void 0,
|
|
3674
|
+
name: options?.name,
|
|
3675
|
+
serviceIdentifier,
|
|
3676
|
+
tags: /* @__PURE__ */ new Map()
|
|
3677
|
+
};
|
|
3678
|
+
if (options?.tag !== void 0) {
|
|
3679
|
+
bindingConstraints.tags.set(options.tag.key, options.tag.value);
|
|
3680
|
+
}
|
|
3681
|
+
for (const binding of bindings) {
|
|
3682
|
+
if (binding.isSatisfiedBy(bindingConstraints)) {
|
|
3683
|
+
return true;
|
|
3684
|
+
}
|
|
3685
|
+
}
|
|
3686
|
+
return false;
|
|
3687
|
+
}
|
|
3688
|
+
};
|
|
3689
|
+
|
|
3690
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/container/services/ContainerModuleManager.js
|
|
3691
|
+
var ContainerModuleManager = class {
|
|
3692
|
+
#bindingManager;
|
|
3693
|
+
#deactivationParams;
|
|
3694
|
+
#defaultScope;
|
|
3695
|
+
#planResultCacheManager;
|
|
3696
|
+
#serviceReferenceManager;
|
|
3697
|
+
constructor(bindingManager, deactivationParams, defaultScope, planResultCacheManager, serviceReferenceManager) {
|
|
3698
|
+
this.#bindingManager = bindingManager;
|
|
3699
|
+
this.#deactivationParams = deactivationParams;
|
|
3700
|
+
this.#defaultScope = defaultScope;
|
|
3701
|
+
this.#planResultCacheManager = planResultCacheManager;
|
|
3702
|
+
this.#serviceReferenceManager = serviceReferenceManager;
|
|
3703
|
+
}
|
|
3704
|
+
async loadAsync(...modules) {
|
|
3705
|
+
await Promise.all(this.#load(...modules));
|
|
3706
|
+
}
|
|
3707
|
+
load(...modules) {
|
|
3708
|
+
const results = this.#load(...modules);
|
|
3709
|
+
for (const result of results) {
|
|
3710
|
+
if (result !== void 0) {
|
|
3711
|
+
throw new InversifyContainerError(InversifyContainerErrorKind.invalidOperation, "Unexpected asynchronous module load. Consider using container.loadAsync() instead.");
|
|
3712
|
+
}
|
|
3713
|
+
}
|
|
3714
|
+
}
|
|
3715
|
+
async unloadAsync(...modules) {
|
|
3716
|
+
await Promise.all(this.#unload(...modules));
|
|
3717
|
+
this.#clearAfterUnloadModules(modules);
|
|
3718
|
+
}
|
|
3719
|
+
unload(...modules) {
|
|
3720
|
+
const results = this.#unload(...modules);
|
|
3721
|
+
for (const result of results) {
|
|
3722
|
+
if (result !== void 0) {
|
|
3723
|
+
throw new InversifyContainerError(InversifyContainerErrorKind.invalidOperation, "Unexpected asynchronous module unload. Consider using container.unloadAsync() instead.");
|
|
3724
|
+
}
|
|
3725
|
+
}
|
|
3726
|
+
this.#clearAfterUnloadModules(modules);
|
|
3727
|
+
}
|
|
3728
|
+
#buildContainerModuleLoadOptions(moduleId) {
|
|
53
3729
|
return {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
},
|
|
3730
|
+
bind: (serviceIdentifier) => {
|
|
3731
|
+
return new BindToFluentSyntaxImplementation((binding) => {
|
|
3732
|
+
this.#setBinding(binding);
|
|
3733
|
+
}, moduleId, this.#defaultScope, serviceIdentifier);
|
|
3734
|
+
},
|
|
3735
|
+
isBound: this.#bindingManager.isBound.bind(this.#bindingManager),
|
|
3736
|
+
onActivation: (serviceIdentifier, activation) => {
|
|
3737
|
+
this.#serviceReferenceManager.activationService.add(activation, {
|
|
3738
|
+
moduleId,
|
|
3739
|
+
serviceId: serviceIdentifier
|
|
3740
|
+
});
|
|
3741
|
+
},
|
|
3742
|
+
onDeactivation: (serviceIdentifier, deactivation) => {
|
|
3743
|
+
this.#serviceReferenceManager.deactivationService.add(deactivation, {
|
|
3744
|
+
moduleId,
|
|
3745
|
+
serviceId: serviceIdentifier
|
|
3746
|
+
});
|
|
3747
|
+
},
|
|
3748
|
+
rebind: this.#bindingManager.rebind.bind(this.#bindingManager),
|
|
3749
|
+
rebindAsync: this.#bindingManager.rebindAsync.bind(this.#bindingManager),
|
|
3750
|
+
unbind: this.#bindingManager.unbind.bind(this.#bindingManager),
|
|
3751
|
+
unbindAsync: this.#bindingManager.unbindAsync.bind(this.#bindingManager)
|
|
58
3752
|
};
|
|
3753
|
+
}
|
|
3754
|
+
#clearAfterUnloadModules(modules) {
|
|
3755
|
+
for (const module2 of modules) {
|
|
3756
|
+
this.#serviceReferenceManager.activationService.removeAllByModuleId(module2.id);
|
|
3757
|
+
this.#serviceReferenceManager.bindingService.removeAllByModuleId(module2.id);
|
|
3758
|
+
this.#serviceReferenceManager.deactivationService.removeAllByModuleId(module2.id);
|
|
3759
|
+
}
|
|
3760
|
+
this.#serviceReferenceManager.planResultCacheService.clearCache();
|
|
3761
|
+
}
|
|
3762
|
+
#load(...modules) {
|
|
3763
|
+
return modules.map((module2) => module2.load(this.#buildContainerModuleLoadOptions(module2.id)));
|
|
3764
|
+
}
|
|
3765
|
+
#setBinding(binding) {
|
|
3766
|
+
this.#serviceReferenceManager.bindingService.set(binding);
|
|
3767
|
+
this.#planResultCacheManager.invalidateService({
|
|
3768
|
+
binding,
|
|
3769
|
+
kind: CacheBindingInvalidationKind.bindingAdded
|
|
3770
|
+
});
|
|
3771
|
+
}
|
|
3772
|
+
#unload(...modules) {
|
|
3773
|
+
return modules.map((module2) => resolveModuleDeactivations(this.#deactivationParams, module2.id));
|
|
3774
|
+
}
|
|
3775
|
+
};
|
|
3776
|
+
|
|
3777
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/container/actions/resetDeactivationParams.js
|
|
3778
|
+
function resetDeactivationParams(serviceReferenceManager, deactivationParams) {
|
|
3779
|
+
deactivationParams.getBindings = serviceReferenceManager.bindingService.get.bind(serviceReferenceManager.bindingService);
|
|
3780
|
+
deactivationParams.getBindingsFromModule = serviceReferenceManager.bindingService.getByModuleId.bind(serviceReferenceManager.bindingService);
|
|
3781
|
+
deactivationParams.getDeactivations = serviceReferenceManager.deactivationService.get.bind(serviceReferenceManager.deactivationService);
|
|
3782
|
+
}
|
|
3783
|
+
|
|
3784
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/container/calculations/buildDeactivationParams.js
|
|
3785
|
+
function buildDeactivationParams(serviceReferenceManager) {
|
|
3786
|
+
return {
|
|
3787
|
+
getBindings: serviceReferenceManager.bindingService.get.bind(serviceReferenceManager.bindingService),
|
|
3788
|
+
getBindingsFromModule: serviceReferenceManager.bindingService.getByModuleId.bind(serviceReferenceManager.bindingService),
|
|
3789
|
+
getClassMetadata,
|
|
3790
|
+
getDeactivations: serviceReferenceManager.deactivationService.get.bind(serviceReferenceManager.deactivationService)
|
|
3791
|
+
};
|
|
3792
|
+
}
|
|
3793
|
+
|
|
3794
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/container/services/DeactivationParamsManager.js
|
|
3795
|
+
var DeactivationParamsManager = class {
|
|
3796
|
+
deactivationParams;
|
|
3797
|
+
constructor(serviceReferenceManager) {
|
|
3798
|
+
this.deactivationParams = buildDeactivationParams(serviceReferenceManager);
|
|
3799
|
+
serviceReferenceManager.onReset(() => {
|
|
3800
|
+
resetDeactivationParams(serviceReferenceManager, this.deactivationParams);
|
|
3801
|
+
});
|
|
3802
|
+
}
|
|
3803
|
+
};
|
|
3804
|
+
|
|
3805
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/container/services/PlanParamsOperationsManager.js
|
|
3806
|
+
var PlanParamsOperationsManager = class {
|
|
3807
|
+
planParamsOperations;
|
|
3808
|
+
#serviceReferenceManager;
|
|
3809
|
+
constructor(serviceReferenceManager) {
|
|
3810
|
+
this.#serviceReferenceManager = serviceReferenceManager;
|
|
3811
|
+
this.planParamsOperations = {
|
|
3812
|
+
getBindings: this.#serviceReferenceManager.bindingService.get.bind(this.#serviceReferenceManager.bindingService),
|
|
3813
|
+
getBindingsChained: this.#serviceReferenceManager.bindingService.getChained.bind(this.#serviceReferenceManager.bindingService),
|
|
3814
|
+
getClassMetadata,
|
|
3815
|
+
getPlan: this.#serviceReferenceManager.planResultCacheService.get.bind(this.#serviceReferenceManager.planResultCacheService),
|
|
3816
|
+
setBinding: this.#setBinding.bind(this),
|
|
3817
|
+
setNonCachedServiceNode: this.#serviceReferenceManager.planResultCacheService.setNonCachedServiceNode.bind(this.#serviceReferenceManager.planResultCacheService),
|
|
3818
|
+
setPlan: this.#serviceReferenceManager.planResultCacheService.set.bind(this.#serviceReferenceManager.planResultCacheService)
|
|
3819
|
+
};
|
|
3820
|
+
this.#serviceReferenceManager.onReset(() => {
|
|
3821
|
+
this.#resetComputedProperties();
|
|
3822
|
+
});
|
|
3823
|
+
}
|
|
3824
|
+
#resetComputedProperties() {
|
|
3825
|
+
this.planParamsOperations.getBindings = this.#serviceReferenceManager.bindingService.get.bind(this.#serviceReferenceManager.bindingService);
|
|
3826
|
+
this.planParamsOperations.getBindingsChained = this.#serviceReferenceManager.bindingService.getChained.bind(this.#serviceReferenceManager.bindingService);
|
|
3827
|
+
this.planParamsOperations.setBinding = this.#setBinding.bind(this);
|
|
3828
|
+
}
|
|
3829
|
+
#setBinding(binding) {
|
|
3830
|
+
this.#serviceReferenceManager.bindingService.set(binding);
|
|
3831
|
+
this.#serviceReferenceManager.planResultCacheService.invalidateServiceBinding({
|
|
3832
|
+
binding,
|
|
3833
|
+
kind: CacheBindingInvalidationKind.bindingAdded,
|
|
3834
|
+
operations: this.planParamsOperations
|
|
3835
|
+
});
|
|
3836
|
+
}
|
|
3837
|
+
};
|
|
3838
|
+
|
|
3839
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/container/services/PlanResultCacheManager.js
|
|
3840
|
+
var PlanResultCacheManager = class {
|
|
3841
|
+
#planParamsOperationsManager;
|
|
3842
|
+
#serviceReferenceManager;
|
|
3843
|
+
constructor(planParamsOperationsManager, serviceReferenceManager) {
|
|
3844
|
+
this.#planParamsOperationsManager = planParamsOperationsManager;
|
|
3845
|
+
this.#serviceReferenceManager = serviceReferenceManager;
|
|
3846
|
+
}
|
|
3847
|
+
invalidateService(invalidation) {
|
|
3848
|
+
this.#serviceReferenceManager.planResultCacheService.invalidateServiceBinding({
|
|
3849
|
+
...invalidation,
|
|
3850
|
+
operations: this.#planParamsOperationsManager.planParamsOperations
|
|
3851
|
+
});
|
|
3852
|
+
}
|
|
3853
|
+
};
|
|
3854
|
+
|
|
3855
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+plugin@0.3.1/node_modules/@inversifyjs/plugin/lib/plugin/models/Plugin.js
|
|
3856
|
+
var isPlugin = /* @__PURE__ */ Symbol.for("@inversifyjs/plugin/isPlugin");
|
|
3857
|
+
var Plugin = class {
|
|
3858
|
+
[isPlugin] = true;
|
|
3859
|
+
_container;
|
|
3860
|
+
_context;
|
|
3861
|
+
constructor(container, context) {
|
|
3862
|
+
this._container = container;
|
|
3863
|
+
this._context = context;
|
|
3864
|
+
}
|
|
3865
|
+
};
|
|
3866
|
+
|
|
3867
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/container/services/PluginManager.js
|
|
3868
|
+
var PluginManager = class {
|
|
3869
|
+
#pluginApi;
|
|
3870
|
+
#pluginContext;
|
|
3871
|
+
#serviceResolutionManager;
|
|
3872
|
+
#serviceReferenceManager;
|
|
3873
|
+
constructor(container, serviceReferenceManager, serviceResolutionManager) {
|
|
3874
|
+
this.#serviceReferenceManager = serviceReferenceManager;
|
|
3875
|
+
this.#serviceResolutionManager = serviceResolutionManager;
|
|
3876
|
+
this.#pluginApi = this.#buildPluginApi(container);
|
|
3877
|
+
this.#pluginContext = this.#buildPluginContext();
|
|
3878
|
+
}
|
|
3879
|
+
register(container, pluginConstructor) {
|
|
3880
|
+
const pluginInstance = new pluginConstructor(container, this.#pluginContext);
|
|
3881
|
+
this.#assertIsPlugin(pluginInstance);
|
|
3882
|
+
pluginInstance.load(this.#pluginApi);
|
|
3883
|
+
}
|
|
3884
|
+
#assertIsPlugin(value) {
|
|
3885
|
+
if (value[isPlugin] !== true) {
|
|
3886
|
+
throw new InversifyContainerError(InversifyContainerErrorKind.invalidOperation, "Invalid plugin. The plugin must extend the Plugin class");
|
|
3887
|
+
}
|
|
3888
|
+
}
|
|
3889
|
+
#buildPluginApi(container) {
|
|
3890
|
+
return {
|
|
3891
|
+
define: (name, method) => {
|
|
3892
|
+
if (Object.prototype.hasOwnProperty.call(container, name)) {
|
|
3893
|
+
throw new InversifyContainerError(InversifyContainerErrorKind.invalidOperation, `Container already has a method named "${String(name)}"`);
|
|
3894
|
+
}
|
|
3895
|
+
container[name] = method;
|
|
3896
|
+
},
|
|
3897
|
+
onPlan: this.#serviceResolutionManager.onPlan.bind(this.#serviceResolutionManager)
|
|
3898
|
+
};
|
|
3899
|
+
}
|
|
3900
|
+
#buildPluginContext() {
|
|
3901
|
+
const serviceReferenceManager = this.#serviceReferenceManager;
|
|
3902
|
+
return {
|
|
3903
|
+
get activationService() {
|
|
3904
|
+
return serviceReferenceManager.activationService;
|
|
3905
|
+
},
|
|
3906
|
+
get bindingService() {
|
|
3907
|
+
return serviceReferenceManager.bindingService;
|
|
3908
|
+
},
|
|
3909
|
+
get deactivationService() {
|
|
3910
|
+
return serviceReferenceManager.deactivationService;
|
|
3911
|
+
},
|
|
3912
|
+
get planResultCacheService() {
|
|
3913
|
+
return serviceReferenceManager.planResultCacheService;
|
|
3914
|
+
}
|
|
3915
|
+
};
|
|
3916
|
+
}
|
|
3917
|
+
};
|
|
3918
|
+
|
|
3919
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/container/services/ServiceReferenceManager.js
|
|
3920
|
+
var ServiceReferenceManager = class {
|
|
3921
|
+
activationService;
|
|
3922
|
+
bindingService;
|
|
3923
|
+
deactivationService;
|
|
3924
|
+
planResultCacheService;
|
|
3925
|
+
#onResetComputedPropertiesListeners;
|
|
3926
|
+
constructor(activationService, bindingService, deactivationService, planResultCacheService) {
|
|
3927
|
+
this.activationService = activationService;
|
|
3928
|
+
this.bindingService = bindingService;
|
|
3929
|
+
this.deactivationService = deactivationService;
|
|
3930
|
+
this.planResultCacheService = planResultCacheService;
|
|
3931
|
+
this.#onResetComputedPropertiesListeners = [];
|
|
3932
|
+
}
|
|
3933
|
+
reset(activationService, bindingService, deactivationService) {
|
|
3934
|
+
this.activationService = activationService;
|
|
3935
|
+
this.bindingService = bindingService;
|
|
3936
|
+
this.deactivationService = deactivationService;
|
|
3937
|
+
this.planResultCacheService.clearCache();
|
|
3938
|
+
for (const listener of this.#onResetComputedPropertiesListeners) {
|
|
3939
|
+
listener();
|
|
3940
|
+
}
|
|
3941
|
+
}
|
|
3942
|
+
onReset(listener) {
|
|
3943
|
+
this.#onResetComputedPropertiesListeners.push(listener);
|
|
3944
|
+
}
|
|
3945
|
+
};
|
|
3946
|
+
|
|
3947
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/container/services/ServiceResolutionManager.js
|
|
3948
|
+
var ServiceResolutionManager = class {
|
|
3949
|
+
#autobind;
|
|
3950
|
+
#defaultScope;
|
|
3951
|
+
#getActivationsResolutionParam;
|
|
3952
|
+
#resolutionContext;
|
|
3953
|
+
#onPlanHandlers;
|
|
3954
|
+
#planParamsOperationsManager;
|
|
3955
|
+
#serviceReferenceManager;
|
|
3956
|
+
constructor(planParamsOperationsManager, serviceReferenceManager, autobind, defaultScope) {
|
|
3957
|
+
this.#planParamsOperationsManager = planParamsOperationsManager;
|
|
3958
|
+
this.#serviceReferenceManager = serviceReferenceManager;
|
|
3959
|
+
this.#resolutionContext = this.#buildResolutionContext();
|
|
3960
|
+
this.#autobind = autobind;
|
|
3961
|
+
this.#defaultScope = defaultScope;
|
|
3962
|
+
this.#getActivationsResolutionParam = (serviceIdentifier) => this.#serviceReferenceManager.activationService.get(serviceIdentifier);
|
|
3963
|
+
this.#onPlanHandlers = [];
|
|
3964
|
+
this.#serviceReferenceManager.onReset(() => {
|
|
3965
|
+
this.#resetComputedProperties();
|
|
3966
|
+
});
|
|
3967
|
+
}
|
|
3968
|
+
get(serviceIdentifier, options) {
|
|
3969
|
+
const planResult = this.#buildPlanResult(false, serviceIdentifier, options);
|
|
3970
|
+
const resolvedValue = this.#getFromPlanResult(planResult);
|
|
3971
|
+
if (isPromise(resolvedValue)) {
|
|
3972
|
+
throw new InversifyContainerError(InversifyContainerErrorKind.invalidOperation, `Unexpected asynchronous service when resolving service "${stringifyServiceIdentifier(serviceIdentifier)}"`);
|
|
3973
|
+
}
|
|
3974
|
+
return resolvedValue;
|
|
3975
|
+
}
|
|
3976
|
+
getAll(serviceIdentifier, options) {
|
|
3977
|
+
const planResult = this.#buildPlanResult(true, serviceIdentifier, options);
|
|
3978
|
+
const resolvedValue = this.#getFromPlanResult(planResult);
|
|
3979
|
+
if (isPromise(resolvedValue)) {
|
|
3980
|
+
throw new InversifyContainerError(InversifyContainerErrorKind.invalidOperation, `Unexpected asynchronous service when resolving service "${stringifyServiceIdentifier(serviceIdentifier)}"`);
|
|
3981
|
+
}
|
|
3982
|
+
return resolvedValue;
|
|
3983
|
+
}
|
|
3984
|
+
async getAllAsync(serviceIdentifier, options) {
|
|
3985
|
+
const planResult = this.#buildPlanResult(true, serviceIdentifier, options);
|
|
3986
|
+
return this.#getFromPlanResult(planResult);
|
|
3987
|
+
}
|
|
3988
|
+
async getAsync(serviceIdentifier, options) {
|
|
3989
|
+
const planResult = this.#buildPlanResult(false, serviceIdentifier, options);
|
|
3990
|
+
return this.#getFromPlanResult(planResult);
|
|
3991
|
+
}
|
|
3992
|
+
onPlan(handler) {
|
|
3993
|
+
this.#onPlanHandlers.push(handler);
|
|
3994
|
+
}
|
|
3995
|
+
#resetComputedProperties() {
|
|
3996
|
+
this.#resolutionContext = this.#buildResolutionContext();
|
|
3997
|
+
}
|
|
3998
|
+
#buildGetPlanOptions(isMultiple, serviceIdentifier, options) {
|
|
3999
|
+
const name = options?.name;
|
|
4000
|
+
const optional2 = options?.optional ?? false;
|
|
4001
|
+
const tag = options?.tag;
|
|
4002
|
+
if (isMultiple) {
|
|
4003
|
+
return {
|
|
4004
|
+
chained: options?.chained ?? false,
|
|
4005
|
+
isMultiple,
|
|
4006
|
+
name,
|
|
4007
|
+
optional: optional2,
|
|
4008
|
+
serviceIdentifier,
|
|
4009
|
+
tag
|
|
4010
|
+
};
|
|
4011
|
+
} else {
|
|
4012
|
+
return {
|
|
4013
|
+
isMultiple,
|
|
4014
|
+
name,
|
|
4015
|
+
optional: optional2,
|
|
4016
|
+
serviceIdentifier,
|
|
4017
|
+
tag
|
|
4018
|
+
};
|
|
4019
|
+
}
|
|
4020
|
+
}
|
|
4021
|
+
#buildPlanParams(serviceIdentifier, isMultiple, options) {
|
|
4022
|
+
const planParams = {
|
|
4023
|
+
autobindOptions: options?.autobind ?? this.#autobind ? {
|
|
4024
|
+
scope: this.#defaultScope
|
|
4025
|
+
} : void 0,
|
|
4026
|
+
operations: this.#planParamsOperationsManager.planParamsOperations,
|
|
4027
|
+
rootConstraints: this.#buildPlanParamsConstraints(serviceIdentifier, isMultiple, options),
|
|
4028
|
+
servicesBranch: []
|
|
4029
|
+
};
|
|
4030
|
+
this.#handlePlanParamsRootConstraints(planParams, options);
|
|
4031
|
+
return planParams;
|
|
4032
|
+
}
|
|
4033
|
+
#buildPlanParamsConstraints(serviceIdentifier, isMultiple, options) {
|
|
4034
|
+
if (isMultiple) {
|
|
4035
|
+
return {
|
|
4036
|
+
chained: options?.chained ?? false,
|
|
4037
|
+
isMultiple,
|
|
4038
|
+
serviceIdentifier
|
|
4039
|
+
};
|
|
4040
|
+
} else {
|
|
4041
|
+
return {
|
|
4042
|
+
isMultiple,
|
|
4043
|
+
serviceIdentifier
|
|
4044
|
+
};
|
|
4045
|
+
}
|
|
4046
|
+
}
|
|
4047
|
+
#buildPlanResult(isMultiple, serviceIdentifier, options) {
|
|
4048
|
+
const getPlanOptions = this.#buildGetPlanOptions(isMultiple, serviceIdentifier, options);
|
|
4049
|
+
const planResultFromCache = this.#serviceReferenceManager.planResultCacheService.get(getPlanOptions);
|
|
4050
|
+
if (planResultFromCache !== void 0) {
|
|
4051
|
+
return planResultFromCache;
|
|
4052
|
+
}
|
|
4053
|
+
const planResult = plan(this.#buildPlanParams(serviceIdentifier, isMultiple, options));
|
|
4054
|
+
for (const handler of this.#onPlanHandlers) {
|
|
4055
|
+
handler(getPlanOptions, planResult);
|
|
4056
|
+
}
|
|
4057
|
+
return planResult;
|
|
4058
|
+
}
|
|
4059
|
+
#buildResolutionContext() {
|
|
4060
|
+
return {
|
|
4061
|
+
get: this.get.bind(this),
|
|
4062
|
+
getAll: this.getAll.bind(this),
|
|
4063
|
+
getAllAsync: this.getAllAsync.bind(this),
|
|
4064
|
+
getAsync: this.getAsync.bind(this)
|
|
4065
|
+
};
|
|
4066
|
+
}
|
|
4067
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
4068
|
+
#getFromPlanResult(planResult) {
|
|
4069
|
+
return resolve({
|
|
4070
|
+
context: this.#resolutionContext,
|
|
4071
|
+
getActivations: this.#getActivationsResolutionParam,
|
|
4072
|
+
planResult,
|
|
4073
|
+
requestScopeCache: /* @__PURE__ */ new Map()
|
|
4074
|
+
});
|
|
4075
|
+
}
|
|
4076
|
+
#handlePlanParamsRootConstraints(planParams, options) {
|
|
4077
|
+
if (options === void 0) {
|
|
4078
|
+
return;
|
|
4079
|
+
}
|
|
4080
|
+
if (options.name !== void 0) {
|
|
4081
|
+
planParams.rootConstraints.name = options.name;
|
|
4082
|
+
}
|
|
4083
|
+
if (options.optional === true) {
|
|
4084
|
+
planParams.rootConstraints.isOptional = true;
|
|
4085
|
+
}
|
|
4086
|
+
if (options.tag !== void 0) {
|
|
4087
|
+
planParams.rootConstraints.tag = {
|
|
4088
|
+
key: options.tag.key,
|
|
4089
|
+
value: options.tag.value
|
|
4090
|
+
};
|
|
4091
|
+
}
|
|
4092
|
+
if (planParams.rootConstraints.isMultiple) {
|
|
4093
|
+
planParams.rootConstraints.chained = options?.chained ?? false;
|
|
4094
|
+
}
|
|
4095
|
+
}
|
|
4096
|
+
};
|
|
4097
|
+
|
|
4098
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/container/services/SnapshotManager.js
|
|
4099
|
+
var SnapshotManager = class {
|
|
4100
|
+
#serviceReferenceManager;
|
|
4101
|
+
#snapshots;
|
|
4102
|
+
constructor(serviceReferenceManager) {
|
|
4103
|
+
this.#serviceReferenceManager = serviceReferenceManager;
|
|
4104
|
+
this.#snapshots = [];
|
|
4105
|
+
}
|
|
4106
|
+
restore() {
|
|
4107
|
+
const snapshot = this.#snapshots.pop();
|
|
4108
|
+
if (snapshot === void 0) {
|
|
4109
|
+
throw new InversifyContainerError(InversifyContainerErrorKind.invalidOperation, "No snapshot available to restore");
|
|
4110
|
+
}
|
|
4111
|
+
this.#serviceReferenceManager.reset(snapshot.activationService, snapshot.bindingService, snapshot.deactivationService);
|
|
4112
|
+
}
|
|
4113
|
+
snapshot() {
|
|
4114
|
+
this.#snapshots.push({
|
|
4115
|
+
activationService: this.#serviceReferenceManager.activationService.clone(),
|
|
4116
|
+
bindingService: this.#serviceReferenceManager.bindingService.clone(),
|
|
4117
|
+
deactivationService: this.#serviceReferenceManager.deactivationService.clone()
|
|
4118
|
+
});
|
|
4119
|
+
}
|
|
4120
|
+
};
|
|
4121
|
+
|
|
4122
|
+
// ../../../../node_modules/.pnpm/@inversifyjs+container@2.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/container/lib/container/services/Container.js
|
|
4123
|
+
var DEFAULT_DEFAULT_SCOPE = bindingScopeValues.Transient;
|
|
4124
|
+
var Container = class {
|
|
4125
|
+
#bindingManager;
|
|
4126
|
+
#containerModuleManager;
|
|
4127
|
+
#pluginManager;
|
|
4128
|
+
#serviceReferenceManager;
|
|
4129
|
+
#serviceResolutionManager;
|
|
4130
|
+
#snapshotManager;
|
|
4131
|
+
constructor(options) {
|
|
4132
|
+
const autobind = options?.autobind ?? false;
|
|
4133
|
+
const defaultScope = options?.defaultScope ?? DEFAULT_DEFAULT_SCOPE;
|
|
4134
|
+
this.#serviceReferenceManager = this.#buildServiceReferenceManager(options, autobind, defaultScope);
|
|
4135
|
+
const planParamsOperationsManager = new PlanParamsOperationsManager(this.#serviceReferenceManager);
|
|
4136
|
+
const planResultCacheManager = new PlanResultCacheManager(planParamsOperationsManager, this.#serviceReferenceManager);
|
|
4137
|
+
const deactivationParamsManager = new DeactivationParamsManager(this.#serviceReferenceManager);
|
|
4138
|
+
this.#bindingManager = new BindingManager(deactivationParamsManager.deactivationParams, defaultScope, planResultCacheManager, this.#serviceReferenceManager);
|
|
4139
|
+
this.#containerModuleManager = new ContainerModuleManager(this.#bindingManager, deactivationParamsManager.deactivationParams, defaultScope, planResultCacheManager, this.#serviceReferenceManager);
|
|
4140
|
+
this.#serviceResolutionManager = new ServiceResolutionManager(planParamsOperationsManager, this.#serviceReferenceManager, autobind, defaultScope);
|
|
4141
|
+
this.#pluginManager = new PluginManager(this, this.#serviceReferenceManager, this.#serviceResolutionManager);
|
|
4142
|
+
this.#snapshotManager = new SnapshotManager(this.#serviceReferenceManager);
|
|
4143
|
+
}
|
|
4144
|
+
bind(serviceIdentifier) {
|
|
4145
|
+
return this.#bindingManager.bind(serviceIdentifier);
|
|
4146
|
+
}
|
|
4147
|
+
get(serviceIdentifier, options) {
|
|
4148
|
+
return this.#serviceResolutionManager.get(serviceIdentifier, options);
|
|
4149
|
+
}
|
|
4150
|
+
getAll(serviceIdentifier, options) {
|
|
4151
|
+
return this.#serviceResolutionManager.getAll(serviceIdentifier, options);
|
|
4152
|
+
}
|
|
4153
|
+
async getAllAsync(serviceIdentifier, options) {
|
|
4154
|
+
return this.#serviceResolutionManager.getAllAsync(serviceIdentifier, options);
|
|
4155
|
+
}
|
|
4156
|
+
async getAsync(serviceIdentifier, options) {
|
|
4157
|
+
return this.#serviceResolutionManager.getAsync(serviceIdentifier, options);
|
|
4158
|
+
}
|
|
4159
|
+
isBound(serviceIdentifier, options) {
|
|
4160
|
+
return this.#bindingManager.isBound(serviceIdentifier, options);
|
|
4161
|
+
}
|
|
4162
|
+
isCurrentBound(serviceIdentifier, options) {
|
|
4163
|
+
return this.#bindingManager.isCurrentBound(serviceIdentifier, options);
|
|
4164
|
+
}
|
|
4165
|
+
async loadAsync(...modules) {
|
|
4166
|
+
return this.#containerModuleManager.loadAsync(...modules);
|
|
4167
|
+
}
|
|
4168
|
+
load(...modules) {
|
|
4169
|
+
this.#containerModuleManager.load(...modules);
|
|
4170
|
+
}
|
|
4171
|
+
onActivation(serviceIdentifier, activation) {
|
|
4172
|
+
this.#serviceReferenceManager.activationService.add(activation, {
|
|
4173
|
+
serviceId: serviceIdentifier
|
|
4174
|
+
});
|
|
4175
|
+
}
|
|
4176
|
+
onDeactivation(serviceIdentifier, deactivation) {
|
|
4177
|
+
this.#serviceReferenceManager.deactivationService.add(deactivation, {
|
|
4178
|
+
serviceId: serviceIdentifier
|
|
4179
|
+
});
|
|
4180
|
+
}
|
|
4181
|
+
register(pluginConstructor) {
|
|
4182
|
+
this.#pluginManager.register(this, pluginConstructor);
|
|
4183
|
+
}
|
|
4184
|
+
restore() {
|
|
4185
|
+
this.#snapshotManager.restore();
|
|
4186
|
+
}
|
|
4187
|
+
async rebindAsync(serviceIdentifier) {
|
|
4188
|
+
return this.#bindingManager.rebindAsync(serviceIdentifier);
|
|
4189
|
+
}
|
|
4190
|
+
rebind(serviceIdentifier) {
|
|
4191
|
+
return this.#bindingManager.rebind(serviceIdentifier);
|
|
4192
|
+
}
|
|
4193
|
+
snapshot() {
|
|
4194
|
+
this.#snapshotManager.snapshot();
|
|
4195
|
+
}
|
|
4196
|
+
async unbindAsync(identifier) {
|
|
4197
|
+
await this.#bindingManager.unbindAsync(identifier);
|
|
4198
|
+
}
|
|
4199
|
+
async unbindAllAsync() {
|
|
4200
|
+
await this.#bindingManager.unbindAllAsync();
|
|
4201
|
+
}
|
|
4202
|
+
unbindAll() {
|
|
4203
|
+
this.#bindingManager.unbindAll();
|
|
4204
|
+
}
|
|
4205
|
+
unbind(identifier) {
|
|
4206
|
+
this.#bindingManager.unbind(identifier);
|
|
4207
|
+
}
|
|
4208
|
+
async unloadAsync(...modules) {
|
|
4209
|
+
return this.#containerModuleManager.unloadAsync(...modules);
|
|
4210
|
+
}
|
|
4211
|
+
unload(...modules) {
|
|
4212
|
+
this.#containerModuleManager.unload(...modules);
|
|
4213
|
+
}
|
|
4214
|
+
#buildAutobindOptions(autobind, defaultScope) {
|
|
4215
|
+
if (autobind) {
|
|
4216
|
+
return { scope: defaultScope };
|
|
4217
|
+
}
|
|
4218
|
+
return void 0;
|
|
4219
|
+
}
|
|
4220
|
+
#buildServiceReferenceManager(options, autobind, defaultScope) {
|
|
4221
|
+
const autobindOptions = this.#buildAutobindOptions(autobind, defaultScope);
|
|
4222
|
+
if (options?.parent === void 0) {
|
|
4223
|
+
return new ServiceReferenceManager(ActivationsService.build(() => void 0), BindingService.build(() => void 0, autobindOptions), DeactivationsService.build(() => void 0), new PlanResultCacheService());
|
|
4224
|
+
}
|
|
4225
|
+
const planResultCacheService = new PlanResultCacheService();
|
|
4226
|
+
const parent = options.parent;
|
|
4227
|
+
parent.#serviceReferenceManager.planResultCacheService.subscribe(planResultCacheService);
|
|
4228
|
+
return new ServiceReferenceManager(ActivationsService.build(() => parent.#serviceReferenceManager.activationService), BindingService.build(() => parent.#serviceReferenceManager.bindingService, autobindOptions), DeactivationsService.build(() => parent.#serviceReferenceManager.deactivationService), planResultCacheService);
|
|
4229
|
+
}
|
|
4230
|
+
};
|
|
4231
|
+
|
|
4232
|
+
// source/inversify.ts
|
|
4233
|
+
var reflectMetadataKeys = {
|
|
4234
|
+
injectable: "@inversifyjs/core/classIsInjectableFlagReflectKey",
|
|
4235
|
+
injected: "@inversifyjs/core/classMetadataReflectKey"
|
|
4236
|
+
};
|
|
4237
|
+
function getGlobalContainer() {
|
|
4238
|
+
if (!global._rocketmakers_ioc) {
|
|
4239
|
+
global._rocketmakers_ioc = new Container();
|
|
4240
|
+
}
|
|
4241
|
+
return global._rocketmakers_ioc;
|
|
4242
|
+
}
|
|
4243
|
+
function wasMadeInjectable(classType) {
|
|
4244
|
+
return Reflect.hasMetadata(reflectMetadataKeys.injectable, classType);
|
|
4245
|
+
}
|
|
4246
|
+
function makeInjectable(classType) {
|
|
4247
|
+
if (wasMadeInjectable(classType)) {
|
|
4248
|
+
return;
|
|
4249
|
+
}
|
|
4250
|
+
decorate(injectable(), classType);
|
|
4251
|
+
}
|
|
4252
|
+
function wasParamMadeInjected(classType, index) {
|
|
4253
|
+
const data = Reflect.getMetadata(reflectMetadataKeys.injected, classType);
|
|
4254
|
+
return data && data.constructorArguments && data.constructorArguments[index];
|
|
4255
|
+
}
|
|
4256
|
+
function makeParamInjected(classType, index, serviceIdentifier) {
|
|
4257
|
+
if (wasParamMadeInjected(classType, index)) {
|
|
4258
|
+
return;
|
|
4259
|
+
}
|
|
4260
|
+
decorate(inject(serviceIdentifier), classType, index);
|
|
4261
|
+
}
|
|
4262
|
+
function makeInjected(classType, index, serviceIdentifier) {
|
|
4263
|
+
return makeParamInjected(classType, index, serviceIdentifier);
|
|
4264
|
+
}
|
|
4265
|
+
function makeParamUnmanaged(classType, parameterIndex) {
|
|
4266
|
+
decorate(unmanaged(), classType, parameterIndex);
|
|
4267
|
+
}
|
|
4268
|
+
function makeUnmanaged(classType, parameterIndex) {
|
|
4269
|
+
makeParamUnmanaged(classType, parameterIndex);
|
|
4270
|
+
}
|
|
4271
|
+
var internalContainer = getGlobalContainer();
|
|
4272
|
+
function registerClass(key, classType, ctorParams) {
|
|
4273
|
+
makeInjectable(classType);
|
|
4274
|
+
ctorParams.forEach((c, i) => makeParamInjected(classType, i, c));
|
|
4275
|
+
return internalContainer.bind(key).to(classType);
|
|
4276
|
+
}
|
|
4277
|
+
|
|
4278
|
+
// source/curry.ts
|
|
4279
|
+
var internalContainer2 = getGlobalContainer();
|
|
4280
|
+
function curryInner(fn, ...keys) {
|
|
4281
|
+
let curried;
|
|
4282
|
+
return {
|
|
4283
|
+
resolved: () => {
|
|
4284
|
+
if (!curried) {
|
|
4285
|
+
const values = keys.map((k) => internalContainer2.get(k));
|
|
4286
|
+
curried = (...p) => fn.apply(fn, [...values, ...p]);
|
|
4287
|
+
}
|
|
4288
|
+
return curried;
|
|
4289
|
+
}
|
|
4290
|
+
};
|
|
4291
|
+
}
|
|
4292
|
+
|
|
4293
|
+
// source/binder.ts
|
|
4294
|
+
var internalContainer3 = getGlobalContainer();
|
|
4295
|
+
var Binder = class {
|
|
4296
|
+
constructor(key, keyTransformer) {
|
|
4297
|
+
this.key = key;
|
|
4298
|
+
this.keyTransformer = keyTransformer;
|
|
4299
|
+
}
|
|
4300
|
+
/** Gets the underlying container binding to the specified key */
|
|
4301
|
+
get binding() {
|
|
4302
|
+
return internalContainer3.bind(this.key);
|
|
4303
|
+
}
|
|
4304
|
+
/** Register a function */
|
|
4305
|
+
function(item) {
|
|
4306
|
+
return this.binding.toConstantValue(item);
|
|
4307
|
+
}
|
|
4308
|
+
/** Register a function resolver */
|
|
4309
|
+
functionResolver(item) {
|
|
4310
|
+
return this.binding.toResolvedValue(() => item.resolved());
|
|
4311
|
+
}
|
|
4312
|
+
/** Register a constant */
|
|
4313
|
+
constant(item) {
|
|
4314
|
+
return this.binding.toConstantValue(item);
|
|
4315
|
+
}
|
|
4316
|
+
/** Register a curried function */
|
|
4317
|
+
functionCurry(item, params) {
|
|
4318
|
+
const keys = params;
|
|
4319
|
+
return this.functionResolver(curryInner(item, ...keys.map(this.keyTransformer)));
|
|
4320
|
+
}
|
|
4321
|
+
/** Register a class */
|
|
4322
|
+
class(cls, params) {
|
|
4323
|
+
const keys = params;
|
|
4324
|
+
return registerClass(this.key, cls, keys.map(this.keyTransformer));
|
|
4325
|
+
}
|
|
4326
|
+
};
|
|
4327
|
+
|
|
4328
|
+
// source/binder-legacy.ts
|
|
4329
|
+
var LegacyBinder = class extends Binder {
|
|
4330
|
+
/** Register a class */
|
|
4331
|
+
classOld(cls) {
|
|
4332
|
+
const k = this.key;
|
|
4333
|
+
const t = this.keyTransformer;
|
|
4334
|
+
return {
|
|
4335
|
+
construct(keys) {
|
|
4336
|
+
const keys1 = keys;
|
|
4337
|
+
return registerClass(k, cls, keys1.map(t));
|
|
4338
|
+
}
|
|
4339
|
+
};
|
|
4340
|
+
}
|
|
4341
|
+
};
|
|
4342
|
+
|
|
4343
|
+
// source/error.ts
|
|
4344
|
+
var IocDuplicateKeyError = class extends Error {
|
|
4345
|
+
constructor(duplicateKeys) {
|
|
4346
|
+
super();
|
|
4347
|
+
this.duplicateKeys = duplicateKeys;
|
|
4348
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
4349
|
+
this.message = `Duplicate keys found
|
|
4350
|
+
${duplicateKeys.join(`
|
|
4351
|
+
`)}`;
|
|
4352
|
+
if (Error.captureStackTrace !== void 0) {
|
|
4353
|
+
Error.captureStackTrace(this, this.constructor);
|
|
4354
|
+
}
|
|
4355
|
+
}
|
|
4356
|
+
};
|
|
4357
|
+
|
|
4358
|
+
// source/naming/camel.ts
|
|
4359
|
+
function capitalize(value) {
|
|
4360
|
+
if (!value) {
|
|
4361
|
+
return value;
|
|
4362
|
+
}
|
|
4363
|
+
return value[0].toUpperCase() + value.substring(1);
|
|
4364
|
+
}
|
|
4365
|
+
function camelKeyTransform(prefix) {
|
|
4366
|
+
return (key) => `${prefix}${capitalize(key)}`;
|
|
4367
|
+
}
|
|
4368
|
+
|
|
4369
|
+
// source/naming/none.ts
|
|
4370
|
+
function keyTransform(prefix) {
|
|
4371
|
+
return (key) => `${prefix}${key}`;
|
|
4372
|
+
}
|
|
4373
|
+
|
|
4374
|
+
// source/tail.generated.ts
|
|
4375
|
+
function containerRegisterFunctionResolverInternal(curryInner2) {
|
|
4376
|
+
return {
|
|
4377
|
+
/** Curry out the first parameter from the method */
|
|
4378
|
+
curry1(fn, key1) {
|
|
4379
|
+
return curryInner2(fn, key1);
|
|
4380
|
+
},
|
|
4381
|
+
/** Curry out the first 2 parameters from the method */
|
|
4382
|
+
curry2(fn, key1, key2) {
|
|
4383
|
+
return curryInner2(fn, key1, key2);
|
|
4384
|
+
},
|
|
4385
|
+
/** Curry out the first 3 parameters from the method */
|
|
4386
|
+
curry3(fn, key1, key2, key3) {
|
|
4387
|
+
return curryInner2(fn, key1, key2, key3);
|
|
4388
|
+
},
|
|
4389
|
+
/** Curry out the first 4 parameters from the method */
|
|
4390
|
+
curry4(fn, key1, key2, key3, key4) {
|
|
4391
|
+
return curryInner2(fn, key1, key2, key3, key4);
|
|
4392
|
+
},
|
|
4393
|
+
/** Curry out the first 5 parameters from the method */
|
|
4394
|
+
curry5(fn, key1, key2, key3, key4, key5) {
|
|
4395
|
+
return curryInner2(fn, key1, key2, key3, key4, key5);
|
|
4396
|
+
},
|
|
4397
|
+
/** Curry out the first 6 parameters from the method */
|
|
4398
|
+
curry6(fn, key1, key2, key3, key4, key5, key6) {
|
|
4399
|
+
return curryInner2(fn, key1, key2, key3, key4, key5, key6);
|
|
4400
|
+
},
|
|
4401
|
+
/** Curry out the first 7 parameters from the method */
|
|
4402
|
+
curry7(fn, key1, key2, key3, key4, key5, key6, key7) {
|
|
4403
|
+
return curryInner2(fn, key1, key2, key3, key4, key5, key6, key7);
|
|
4404
|
+
},
|
|
4405
|
+
/** Curry out the first 8 parameters from the method */
|
|
4406
|
+
curry8(fn, key1, key2, key3, key4, key5, key6, key7, key8) {
|
|
4407
|
+
return curryInner2(fn, key1, key2, key3, key4, key5, key6, key7, key8);
|
|
4408
|
+
},
|
|
4409
|
+
/** Curry out the first 9 parameters from the method */
|
|
4410
|
+
curry9(fn, key1, key2, key3, key4, key5, key6, key7, key8, key9) {
|
|
4411
|
+
return curryInner2(fn, key1, key2, key3, key4, key5, key6, key7, key8, key9);
|
|
4412
|
+
},
|
|
4413
|
+
/** Curry out the first 10 parameters from the method */
|
|
4414
|
+
curry10(fn, key1, key2, key3, key4, key5, key6, key7, key8, key9, key10) {
|
|
4415
|
+
return curryInner2(fn, key1, key2, key3, key4, key5, key6, key7, key8, key9, key10);
|
|
4416
|
+
},
|
|
4417
|
+
/** Curry out the first 11 parameters from the method */
|
|
4418
|
+
curry11(fn, key1, key2, key3, key4, key5, key6, key7, key8, key9, key10, key11) {
|
|
4419
|
+
return curryInner2(fn, key1, key2, key3, key4, key5, key6, key7, key8, key9, key10, key11);
|
|
4420
|
+
},
|
|
4421
|
+
/** Curry out the first 12 parameters from the method */
|
|
4422
|
+
curry12(fn, key1, key2, key3, key4, key5, key6, key7, key8, key9, key10, key11, key12) {
|
|
4423
|
+
return curryInner2(fn, key1, key2, key3, key4, key5, key6, key7, key8, key9, key10, key11, key12);
|
|
4424
|
+
},
|
|
4425
|
+
/** Curry out the first 13 parameters from the method */
|
|
4426
|
+
curry13(fn, key1, key2, key3, key4, key5, key6, key7, key8, key9, key10, key11, key12, key13) {
|
|
4427
|
+
return curryInner2(fn, key1, key2, key3, key4, key5, key6, key7, key8, key9, key10, key11, key12, key13);
|
|
4428
|
+
},
|
|
4429
|
+
/** Curry out the first 14 parameters from the method */
|
|
4430
|
+
curry14(fn, key1, key2, key3, key4, key5, key6, key7, key8, key9, key10, key11, key12, key13, key14) {
|
|
4431
|
+
return curryInner2(fn, key1, key2, key3, key4, key5, key6, key7, key8, key9, key10, key11, key12, key13, key14);
|
|
4432
|
+
},
|
|
4433
|
+
/** Curry out the first 15 parameters from the method */
|
|
4434
|
+
curry15(fn, key1, key2, key3, key4, key5, key6, key7, key8, key9, key10, key11, key12, key13, key14, key15) {
|
|
4435
|
+
return curryInner2(fn, key1, key2, key3, key4, key5, key6, key7, key8, key9, key10, key11, key12, key13, key14, key15);
|
|
4436
|
+
},
|
|
4437
|
+
/** Curry out the first 16 parameters from the method */
|
|
4438
|
+
curry16(fn, key1, key2, key3, key4, key5, key6, key7, key8, key9, key10, key11, key12, key13, key14, key15, key16) {
|
|
4439
|
+
return curryInner2(fn, key1, key2, key3, key4, key5, key6, key7, key8, key9, key10, key11, key12, key13, key14, key15, key16);
|
|
4440
|
+
},
|
|
4441
|
+
/** Curry out the first 17 parameters from the method */
|
|
4442
|
+
curry17(fn, key1, key2, key3, key4, key5, key6, key7, key8, key9, key10, key11, key12, key13, key14, key15, key16, key17) {
|
|
4443
|
+
return curryInner2(fn, key1, key2, key3, key4, key5, key6, key7, key8, key9, key10, key11, key12, key13, key14, key15, key16, key17);
|
|
4444
|
+
},
|
|
4445
|
+
/** Curry out the first 18 parameters from the method */
|
|
4446
|
+
curry18(fn, key1, key2, key3, key4, key5, key6, key7, key8, key9, key10, key11, key12, key13, key14, key15, key16, key17, key18) {
|
|
4447
|
+
return curryInner2(fn, key1, key2, key3, key4, key5, key6, key7, key8, key9, key10, key11, key12, key13, key14, key15, key16, key17, key18);
|
|
4448
|
+
},
|
|
4449
|
+
/** Curry out the first 19 parameters from the method */
|
|
4450
|
+
curry19(fn, key1, key2, key3, key4, key5, key6, key7, key8, key9, key10, key11, key12, key13, key14, key15, key16, key17, key18, key19) {
|
|
4451
|
+
return curryInner2(fn, key1, key2, key3, key4, key5, key6, key7, key8, key9, key10, key11, key12, key13, key14, key15, key16, key17, key18, key19);
|
|
4452
|
+
},
|
|
4453
|
+
/** Curry out the first 20 parameters from the method */
|
|
4454
|
+
curry20(fn, key1, key2, key3, key4, key5, key6, key7, key8, key9, key10, key11, key12, key13, key14, key15, key16, key17, key18, key19, key20) {
|
|
4455
|
+
return curryInner2(fn, key1, key2, key3, key4, key5, key6, key7, key8, key9, key10, key11, key12, key13, key14, key15, key16, key17, key18, key19, key20);
|
|
4456
|
+
}
|
|
4457
|
+
};
|
|
4458
|
+
}
|
|
4459
|
+
|
|
4460
|
+
// source/index.ts
|
|
4461
|
+
var internalContainer4 = getGlobalContainer();
|
|
4462
|
+
function containerRegisterFunctionResolver() {
|
|
4463
|
+
return containerRegisterFunctionResolverInternal(curryInner);
|
|
4464
|
+
}
|
|
4465
|
+
function isFunctionResolver(item) {
|
|
4466
|
+
const resolved = item?.resolved;
|
|
4467
|
+
return resolved && typeof resolved === "function";
|
|
4468
|
+
}
|
|
4469
|
+
function mapKeyNoop(k) {
|
|
4470
|
+
return k;
|
|
4471
|
+
}
|
|
4472
|
+
function containerRegister() {
|
|
4473
|
+
return {
|
|
4474
|
+
/** Register a function/function resolver */
|
|
4475
|
+
function(key, item) {
|
|
4476
|
+
const b = new Binder(key, mapKeyNoop);
|
|
4477
|
+
if (isFunctionResolver(item)) {
|
|
4478
|
+
return b.functionResolver(item);
|
|
4479
|
+
}
|
|
4480
|
+
return b.function(item);
|
|
4481
|
+
},
|
|
4482
|
+
/** Register a constant */
|
|
4483
|
+
constant(key, item) {
|
|
4484
|
+
const b = new Binder(key, mapKeyNoop);
|
|
4485
|
+
return b.constant(item);
|
|
4486
|
+
},
|
|
4487
|
+
/** Register a class */
|
|
4488
|
+
class(key, cls) {
|
|
4489
|
+
const b = new LegacyBinder(key, mapKeyNoop);
|
|
4490
|
+
return b.classOld(cls);
|
|
4491
|
+
}
|
|
4492
|
+
};
|
|
4493
|
+
}
|
|
4494
|
+
function createContainerOf(keys) {
|
|
4495
|
+
return {
|
|
4496
|
+
keys,
|
|
4497
|
+
get(key) {
|
|
4498
|
+
return internalContainer4.get(key);
|
|
4499
|
+
}
|
|
4500
|
+
};
|
|
59
4501
|
}
|
|
60
4502
|
function containerFactory() {
|
|
61
|
-
|
|
4503
|
+
return createContainerOf([]);
|
|
62
4504
|
}
|
|
63
4505
|
function getCombinedKeys(keys, dependent, sharedKeys) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
4506
|
+
const duplicates = keys.filter((k) => (!sharedKeys || sharedKeys.indexOf(k) > -1) && dependent.indexOf(k) > -1);
|
|
4507
|
+
if (duplicates.length) {
|
|
4508
|
+
throw new IocDuplicateKeyError(duplicates);
|
|
4509
|
+
}
|
|
4510
|
+
return [...dependent, ...keys];
|
|
69
4511
|
}
|
|
70
4512
|
function registerInternal(binding, transform, dependent) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
4513
|
+
const keys = Object.keys(binding);
|
|
4514
|
+
const newKeys = [];
|
|
4515
|
+
const mappedKeys = keys.reduce((record, key) => {
|
|
4516
|
+
const newKey = transform(key);
|
|
4517
|
+
newKeys.push(newKey);
|
|
4518
|
+
record[key] = newKey;
|
|
4519
|
+
return record;
|
|
4520
|
+
}, {});
|
|
4521
|
+
const combinedKeys = dependent ? getCombinedKeys(newKeys, dependent.keys) : newKeys;
|
|
4522
|
+
function keyMapper(key) {
|
|
4523
|
+
return mappedKeys[key] || key;
|
|
4524
|
+
}
|
|
4525
|
+
keys.forEach((key) => {
|
|
4526
|
+
const newKey = mappedKeys[key];
|
|
4527
|
+
const b = new Binder(newKey, keyMapper);
|
|
4528
|
+
binding[key](b);
|
|
4529
|
+
});
|
|
4530
|
+
return createContainerOf(combinedKeys);
|
|
89
4531
|
}
|
|
90
4532
|
function register(binding, dependent) {
|
|
91
|
-
|
|
4533
|
+
return registerInternal(binding, mapKeyNoop, dependent);
|
|
92
4534
|
}
|
|
93
4535
|
function keyTransformFactory(convention, prefix) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
4536
|
+
switch (convention) {
|
|
4537
|
+
case "none":
|
|
4538
|
+
return keyTransform(prefix);
|
|
4539
|
+
case "camel":
|
|
4540
|
+
return camelKeyTransform(prefix);
|
|
4541
|
+
default: {
|
|
4542
|
+
const n = convention;
|
|
4543
|
+
throw new Error(`Invalid IoC container prefix kind: ${n}`);
|
|
103
4544
|
}
|
|
4545
|
+
}
|
|
104
4546
|
}
|
|
105
4547
|
function registerWithPrefix(convention, prefix, binding, dependent) {
|
|
106
|
-
|
|
107
|
-
|
|
4548
|
+
const transform = keyTransformFactory(convention, prefix);
|
|
4549
|
+
return registerInternal(binding, transform, dependent);
|
|
108
4550
|
}
|
|
109
4551
|
function mergeContainers(container1, container2, sharedKeys) {
|
|
110
|
-
|
|
111
|
-
|
|
4552
|
+
const combinedKeys = getCombinedKeys(container1.keys, container2.keys, sharedKeys);
|
|
4553
|
+
return createContainerOf(combinedKeys);
|
|
112
4554
|
}
|
|
113
|
-
|
|
4555
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
4556
|
+
0 && (module.exports = {
|
|
4557
|
+
containerFactory,
|
|
4558
|
+
containerRegister,
|
|
4559
|
+
containerRegisterFunctionResolver,
|
|
4560
|
+
getGlobalContainer,
|
|
4561
|
+
internalContainer,
|
|
4562
|
+
makeInjectable,
|
|
4563
|
+
makeInjected,
|
|
4564
|
+
makeParamInjected,
|
|
4565
|
+
makeParamUnmanaged,
|
|
4566
|
+
makeUnmanaged,
|
|
4567
|
+
mergeContainers,
|
|
4568
|
+
reflectMetadataKeys,
|
|
4569
|
+
register,
|
|
4570
|
+
registerClass,
|
|
4571
|
+
registerWithPrefix,
|
|
4572
|
+
wasMadeInjectable,
|
|
4573
|
+
wasParamMadeInjected
|
|
4574
|
+
});
|