@inversifyjs/core 3.5.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/lib/cjs/binding/models/BaseBinding.d.ts +2 -2
- package/lib/cjs/binding/models/BaseBinding.d.ts.map +1 -1
- package/lib/cjs/binding/models/{BindingMetadata.d.ts → BindingConstraints.d.ts} +3 -3
- package/lib/cjs/binding/models/BindingConstraints.d.ts.map +1 -0
- package/lib/cjs/binding/models/{BindingMetadata.js → BindingConstraints.js} +1 -1
- package/lib/cjs/binding/models/BindingConstraints.js.map +1 -0
- package/lib/cjs/binding/models/{BindingMetadataImplementation.d.ts → BindingConstraintsImplementation.d.ts} +7 -7
- package/lib/cjs/binding/models/BindingConstraintsImplementation.d.ts.map +1 -0
- package/lib/cjs/binding/models/{BindingMetadataImplementation.js → BindingConstraintsImplementation.js} +8 -8
- package/lib/cjs/binding/models/BindingConstraintsImplementation.js.map +1 -0
- package/lib/cjs/binding/models/BindingConstraintsImplementation.spec.d.ts +2 -0
- package/lib/cjs/binding/models/BindingConstraintsImplementation.spec.d.ts.map +1 -0
- package/lib/cjs/binding/models/ScopedBinding.d.ts +2 -2
- package/lib/cjs/binding/models/ScopedBinding.d.ts.map +1 -1
- package/lib/cjs/index.d.ts +2 -2
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/planning/calculations/buildFilteredServiceBindings.d.ts +2 -2
- package/lib/cjs/planning/calculations/buildFilteredServiceBindings.d.ts.map +1 -1
- package/lib/cjs/planning/calculations/buildFilteredServiceBindings.js +3 -3
- package/lib/cjs/planning/calculations/buildFilteredServiceBindings.js.map +1 -1
- package/lib/cjs/planning/calculations/checkPlanServiceRedirectionBindingNodeSingleInjectionBindings.d.ts +2 -2
- package/lib/cjs/planning/calculations/checkPlanServiceRedirectionBindingNodeSingleInjectionBindings.d.ts.map +1 -1
- package/lib/cjs/planning/calculations/checkPlanServiceRedirectionBindingNodeSingleInjectionBindings.js +3 -3
- package/lib/cjs/planning/calculations/checkPlanServiceRedirectionBindingNodeSingleInjectionBindings.js.map +1 -1
- package/lib/cjs/planning/calculations/checkServiceNodeSingleInjectionBindings.d.ts +2 -2
- package/lib/cjs/planning/calculations/checkServiceNodeSingleInjectionBindings.d.ts.map +1 -1
- package/lib/cjs/planning/calculations/checkServiceNodeSingleInjectionBindings.js +3 -3
- package/lib/cjs/planning/calculations/checkServiceNodeSingleInjectionBindings.js.map +1 -1
- package/lib/cjs/planning/calculations/plan.d.ts.map +1 -1
- package/lib/cjs/planning/calculations/plan.js +38 -38
- package/lib/cjs/planning/calculations/plan.js.map +1 -1
- package/lib/cjs/planning/calculations/throwErrorWhenUnexpectedBindingsAmountFound.d.ts +2 -2
- package/lib/cjs/planning/calculations/throwErrorWhenUnexpectedBindingsAmountFound.d.ts.map +1 -1
- package/lib/cjs/planning/calculations/throwErrorWhenUnexpectedBindingsAmountFound.js +16 -16
- package/lib/cjs/planning/calculations/throwErrorWhenUnexpectedBindingsAmountFound.js.map +1 -1
- package/lib/cjs/resolution/actions/cacheResolvedValue.d.ts +6 -0
- package/lib/cjs/resolution/actions/cacheResolvedValue.d.ts.map +1 -0
- package/lib/cjs/resolution/actions/cacheResolvedValue.js +18 -0
- package/lib/cjs/resolution/actions/cacheResolvedValue.js.map +1 -0
- package/lib/cjs/resolution/actions/cacheResolvedValue.spec.d.ts +2 -0
- package/lib/cjs/resolution/actions/cacheResolvedValue.spec.d.ts.map +1 -0
- package/lib/cjs/resolution/actions/resolveScoped.d.ts.map +1 -1
- package/lib/cjs/resolution/actions/resolveScoped.js +5 -11
- package/lib/cjs/resolution/actions/resolveScoped.js.map +1 -1
- package/lib/cjs/resolution/actions/resolveSingletonScopedBinding.d.ts.map +1 -1
- package/lib/cjs/resolution/actions/resolveSingletonScopedBinding.js +2 -5
- package/lib/cjs/resolution/actions/resolveSingletonScopedBinding.js.map +1 -1
- package/lib/esm/index.d.ts +5 -5
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/index.js.map +1 -1
- package/package.json +4 -4
- package/lib/cjs/binding/models/BindingMetadata.d.ts.map +0 -1
- package/lib/cjs/binding/models/BindingMetadata.js.map +0 -1
- package/lib/cjs/binding/models/BindingMetadataImplementation.d.ts.map +0 -1
- package/lib/cjs/binding/models/BindingMetadataImplementation.js.map +0 -1
- package/lib/cjs/binding/models/BindingMetadataImplementation.spec.d.ts +0 -2
- package/lib/cjs/binding/models/BindingMetadataImplementation.spec.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../../../src/planning/calculations/plan.ts"],"names":[],"mappings":";;AAqCA,
|
|
1
|
+
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../../../src/planning/calculations/plan.ts"],"names":[],"mappings":";;AAqCA,oBAyDC;AA9FD,gDAA+E;AAI/E,4GAG+D;AAC/D,kEAAqE;AAIrE,6FAA0F;AAG1F,6FAA0F;AAI1F,6GAA0G;AAE1G,kEAA+D;AAW/D,iFAA8E;AAC9E,uGAAoG;AACpG,mEAAgE;AAChE,+FAA4F;AAE5F,SAAgB,IAAI,CAAC,MAAkB;IACrC,MAAM,IAAI,GAA8B,IAAI,GAAG,EAAE,CAAC;IAElD,IAAI,MAAM,CAAC,eAAe,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;QAC7C,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC7E,CAAC;IAED,MAAM,sBAAsB,GAC1B,IAAI,qDAAyB,CAAC;QAC5B,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM,CAAC,eAAe,CAAC,IAAI;YACjC,iBAAiB,EAAE,MAAM,CAAC,eAAe,CAAC,iBAAiB;YAC3D,IAAI;SACL;QACD,QAAQ,EAAE,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,MAAM,CAAC,KAAK,CAAC,GAAG,oDAAoD,CACvE,MAAM,EACN,sBAAsB,EACtB,eAAe,CAChB,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BindingConstraints } from '../../binding/models/BindingConstraints';
|
|
2
2
|
import { BindingNodeParent } from '../models/BindingNodeParent';
|
|
3
3
|
import { PlanBindingNode } from '../models/PlanBindingNode';
|
|
4
|
-
export declare function throwErrorWhenUnexpectedBindingsAmountFound(bindings: PlanBindingNode[] | PlanBindingNode | undefined, isOptional: boolean, node: BindingNodeParent,
|
|
4
|
+
export declare function throwErrorWhenUnexpectedBindingsAmountFound(bindings: PlanBindingNode[] | PlanBindingNode | undefined, isOptional: boolean, node: BindingNodeParent, bindingConstraints: BindingConstraints): void;
|
|
5
5
|
//# sourceMappingURL=throwErrorWhenUnexpectedBindingsAmountFound.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"throwErrorWhenUnexpectedBindingsAmountFound.d.ts","sourceRoot":"","sources":["../../../../src/planning/calculations/throwErrorWhenUnexpectedBindingsAmountFound.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"throwErrorWhenUnexpectedBindingsAmountFound.d.ts","sourceRoot":"","sources":["../../../../src/planning/calculations/throwErrorWhenUnexpectedBindingsAmountFound.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAI7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAG5D,wBAAgB,2CAA2C,CACzD,QAAQ,EAAE,eAAe,EAAE,GAAG,eAAe,GAAG,SAAS,EACzD,UAAU,EAAE,OAAO,EACnB,IAAI,EAAE,iBAAiB,EACvB,kBAAkB,EAAE,kBAAkB,GACrC,IAAI,CA6BN"}
|
|
@@ -6,7 +6,7 @@ const stringifyBinding_1 = require("../../binding/calculations/stringifyBinding"
|
|
|
6
6
|
const InversifyCoreError_1 = require("../../error/models/InversifyCoreError");
|
|
7
7
|
const InversifyCoreErrorKind_1 = require("../../error/models/InversifyCoreErrorKind");
|
|
8
8
|
const isPlanServiceRedirectionBindingNode_1 = require("./isPlanServiceRedirectionBindingNode");
|
|
9
|
-
function throwErrorWhenUnexpectedBindingsAmountFound(bindings, isOptional, node,
|
|
9
|
+
function throwErrorWhenUnexpectedBindingsAmountFound(bindings, isOptional, node, bindingConstraints) {
|
|
10
10
|
let serviceIdentifier;
|
|
11
11
|
let parentServiceIdentifier;
|
|
12
12
|
if ((0, isPlanServiceRedirectionBindingNode_1.isPlanServiceRedirectionBindingNode)(node)) {
|
|
@@ -18,24 +18,24 @@ function throwErrorWhenUnexpectedBindingsAmountFound(bindings, isOptional, node,
|
|
|
18
18
|
parentServiceIdentifier = node.parent?.binding.serviceIdentifier;
|
|
19
19
|
}
|
|
20
20
|
if (Array.isArray(bindings)) {
|
|
21
|
-
throwErrorWhenMultipleUnexpectedBindingsAmountFound(bindings, isOptional, serviceIdentifier, parentServiceIdentifier,
|
|
21
|
+
throwErrorWhenMultipleUnexpectedBindingsAmountFound(bindings, isOptional, serviceIdentifier, parentServiceIdentifier, bindingConstraints);
|
|
22
22
|
}
|
|
23
23
|
else {
|
|
24
|
-
throwErrorWhenSingleUnexpectedBindingFound(bindings, isOptional, serviceIdentifier, parentServiceIdentifier,
|
|
24
|
+
throwErrorWhenSingleUnexpectedBindingFound(bindings, isOptional, serviceIdentifier, parentServiceIdentifier, bindingConstraints);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
function throwBindingNotFoundError(serviceIdentifier, parentServiceIdentifier,
|
|
27
|
+
function throwBindingNotFoundError(serviceIdentifier, parentServiceIdentifier, bindingConstraints) {
|
|
28
28
|
const errorMessage = `No bindings found for service: "${(0, common_1.stringifyServiceIdentifier)(serviceIdentifier)}".
|
|
29
29
|
|
|
30
30
|
Trying to resolve bindings for "${stringifyParentServiceIdentifier(serviceIdentifier, parentServiceIdentifier)}".
|
|
31
31
|
|
|
32
|
-
${
|
|
32
|
+
${stringifyBindingConstraints(bindingConstraints)}`;
|
|
33
33
|
throw new InversifyCoreError_1.InversifyCoreError(InversifyCoreErrorKind_1.InversifyCoreErrorKind.planning, errorMessage);
|
|
34
34
|
}
|
|
35
|
-
function throwErrorWhenMultipleUnexpectedBindingsAmountFound(bindings, isOptional, serviceIdentifier, parentServiceIdentifier,
|
|
35
|
+
function throwErrorWhenMultipleUnexpectedBindingsAmountFound(bindings, isOptional, serviceIdentifier, parentServiceIdentifier, bindingConstraints) {
|
|
36
36
|
if (bindings.length === 0) {
|
|
37
37
|
if (!isOptional) {
|
|
38
|
-
throwBindingNotFoundError(serviceIdentifier, parentServiceIdentifier,
|
|
38
|
+
throwBindingNotFoundError(serviceIdentifier, parentServiceIdentifier, bindingConstraints);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
@@ -47,13 +47,13 @@ ${bindings.map((binding) => (0, stringifyBinding_1.stringifyBinding)(binding.bin
|
|
|
47
47
|
|
|
48
48
|
Trying to resolve bindings for "${stringifyParentServiceIdentifier(serviceIdentifier, parentServiceIdentifier)}".
|
|
49
49
|
|
|
50
|
-
${
|
|
50
|
+
${stringifyBindingConstraints(bindingConstraints)}`;
|
|
51
51
|
throw new InversifyCoreError_1.InversifyCoreError(InversifyCoreErrorKind_1.InversifyCoreErrorKind.planning, errorMessage);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
function throwErrorWhenSingleUnexpectedBindingFound(bindings, isOptional, serviceIdentifier, parentServiceIdentifier,
|
|
54
|
+
function throwErrorWhenSingleUnexpectedBindingFound(bindings, isOptional, serviceIdentifier, parentServiceIdentifier, bindingConstraints) {
|
|
55
55
|
if (bindings === undefined && !isOptional) {
|
|
56
|
-
throwBindingNotFoundError(serviceIdentifier, parentServiceIdentifier,
|
|
56
|
+
throwBindingNotFoundError(serviceIdentifier, parentServiceIdentifier, bindingConstraints);
|
|
57
57
|
}
|
|
58
58
|
else {
|
|
59
59
|
return;
|
|
@@ -64,14 +64,14 @@ function stringifyParentServiceIdentifier(serviceIdentifier, parentServiceIdenti
|
|
|
64
64
|
? `${(0, common_1.stringifyServiceIdentifier)(serviceIdentifier)} (Root service)`
|
|
65
65
|
: (0, common_1.stringifyServiceIdentifier)(parentServiceIdentifier);
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
const stringifiedTags =
|
|
67
|
+
function stringifyBindingConstraints(bindingConstraints) {
|
|
68
|
+
const stringifiedTags = bindingConstraints.tags.size === 0
|
|
69
69
|
? ''
|
|
70
70
|
: `
|
|
71
71
|
- tags:
|
|
72
|
-
- ${[...
|
|
73
|
-
return `Binding
|
|
74
|
-
- service identifier: ${(0, common_1.stringifyServiceIdentifier)(
|
|
75
|
-
- name: ${
|
|
72
|
+
- ${[...bindingConstraints.tags.keys()].map((key) => key.toString()).join('\n - ')}`;
|
|
73
|
+
return `Binding constraints:
|
|
74
|
+
- service identifier: ${(0, common_1.stringifyServiceIdentifier)(bindingConstraints.serviceIdentifier)}
|
|
75
|
+
- name: ${bindingConstraints.name?.toString() ?? '-'}${stringifiedTags}`;
|
|
76
76
|
}
|
|
77
77
|
//# sourceMappingURL=throwErrorWhenUnexpectedBindingsAmountFound.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"throwErrorWhenUnexpectedBindingsAmountFound.js","sourceRoot":"","sources":["../../../../src/planning/calculations/throwErrorWhenUnexpectedBindingsAmountFound.ts"],"names":[],"mappings":";;AAcA,kGAkCC;AAhDD,gDAG6B;AAE7B,kFAA+E;AAE/E,8EAA2E;AAC3E,sFAAmF;AAInF,+FAA4F;AAE5F,SAAgB,2CAA2C,CACzD,QAAyD,EACzD,UAAmB,EACnB,IAAuB,EACvB,
|
|
1
|
+
{"version":3,"file":"throwErrorWhenUnexpectedBindingsAmountFound.js","sourceRoot":"","sources":["../../../../src/planning/calculations/throwErrorWhenUnexpectedBindingsAmountFound.ts"],"names":[],"mappings":";;AAcA,kGAkCC;AAhDD,gDAG6B;AAE7B,kFAA+E;AAE/E,8EAA2E;AAC3E,sFAAmF;AAInF,+FAA4F;AAE5F,SAAgB,2CAA2C,CACzD,QAAyD,EACzD,UAAmB,EACnB,IAAuB,EACvB,kBAAsC;IAEtC,IAAI,iBAAoC,CAAC;IACzC,IAAI,uBAAsD,CAAC;IAE3D,IAAI,IAAA,yEAAmC,EAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,uBAAuB,CAAC;QACzD,uBAAuB,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC;IAC3D,CAAC;SAAM,CAAC;QACN,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAC;QAC3C,uBAAuB,GAAG,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,iBAAiB,CAAC;IACnE,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,mDAAmD,CACjD,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,CACnB,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,0CAA0C,CACxC,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,CACnB,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,yBAAyB,CAChC,iBAAoC,EACpC,uBAAsD,EACtD,kBAAsC;IAEtC,MAAM,YAAY,GAAW,mCAAmC,IAAA,mCAA0B,EAAC,iBAAiB,CAAC;;kCAE7E,gCAAgC,CAAC,iBAAiB,EAAE,uBAAuB,CAAC;;EAE5G,2BAA2B,CAAC,kBAAkB,CAAC,EAAE,CAAC;IAElD,MAAM,IAAI,u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A,mCAA0B,EAAC,uBAAuB,CAAC,CAAC;AAC1D,CAAC;AAED,SAAS,2BAA2B,CAClC,kBAAsC;IAEtC,MAAM,eAAe,GACnB,kBAAkB,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC;QAChC,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC;;MAEF,CAAC,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAgB,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;IAEnG,OAAO;wBACe,IAAA,mCAA0B,EAAC,kBAAkB,CAAC,iBAAiB,CAAC;UAC9E,kBAAkB,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,GAAG,GAAG,eAAe,EAAE,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BindingScope } from '../../binding/models/BindingScope';
|
|
2
|
+
import { BindingType } from '../../binding/models/BindingType';
|
|
3
|
+
import { ScopedBinding } from '../../binding/models/ScopedBinding';
|
|
4
|
+
import { Resolved } from '../models/Resolved';
|
|
5
|
+
export declare function cacheResolvedValue<TActivated, TType extends BindingType, TBinding extends ScopedBinding<TType, BindingScope, TActivated>>(binding: TBinding, resolvedValue: Resolved<TActivated>): Resolved<TActivated>;
|
|
6
|
+
//# sourceMappingURL=cacheResolvedValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cacheResolvedValue.d.ts","sourceRoot":"","sources":["../../../../src/resolution/actions/cacheResolvedValue.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAgB,MAAM,oBAAoB,CAAC;AAE5D,wBAAgB,kBAAkB,CAChC,UAAU,EACV,KAAK,SAAS,WAAW,EAEzB,QAAQ,SAAS,aAAa,CAAC,KAAK,EAAE,YAAY,EAAE,UAAU,CAAC,EAE/D,OAAO,EAAE,QAAQ,EACjB,aAAa,EAAE,QAAQ,CAAC,UAAU,CAAC,GAClC,QAAQ,CAAC,UAAU,CAAC,CAQtB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cacheResolvedValue = cacheResolvedValue;
|
|
4
|
+
const common_1 = require("@inversifyjs/common");
|
|
5
|
+
function cacheResolvedValue(binding, resolvedValue) {
|
|
6
|
+
if ((0, common_1.isPromise)(resolvedValue)) {
|
|
7
|
+
return resolvedValue.then((syncResolvedValue) => cacheSyncResolvedValue(binding, syncResolvedValue));
|
|
8
|
+
}
|
|
9
|
+
return cacheSyncResolvedValue(binding, resolvedValue);
|
|
10
|
+
}
|
|
11
|
+
function cacheSyncResolvedValue(binding, resolvedValue) {
|
|
12
|
+
binding.cache = {
|
|
13
|
+
isRight: true,
|
|
14
|
+
value: resolvedValue,
|
|
15
|
+
};
|
|
16
|
+
return resolvedValue;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=cacheResolvedValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cacheResolvedValue.js","sourceRoot":"","sources":["../../../../src/resolution/actions/cacheResolvedValue.ts"],"names":[],"mappings":";;AAOA,gDAgBC;AAvBD,gDAAgD;AAOhD,SAAgB,kBAAkB,CAMhC,OAAiB,EACjB,aAAmC;IAEnC,IAAI,IAAA,kBAAS,EAAC,aAAa,CAAC,EAAE,CAAC;QAC7B,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,iBAA2C,EAAE,EAAE,CACxE,sBAAsB,CAAC,OAAO,EAAE,iBAAiB,CAAC,CACnD,CAAC;IACJ,CAAC;IAED,OAAO,sBAAsB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;AACxD,CAAC;AAED,SAAS,sBAAsB,CAM7B,OAAiB,EACjB,aAAuC;IAEvC,OAAO,CAAC,KAAK,GAAG;QACd,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,aAAa;KACrB,CAAC;IAEF,OAAO,aAAa,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cacheResolvedValue.spec.d.ts","sourceRoot":"","sources":["../../../../src/resolution/actions/cacheResolvedValue.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveScoped.d.ts","sourceRoot":"","sources":["../../../../src/resolution/actions/resolveScoped.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEb,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"resolveScoped.d.ts","sourceRoot":"","sources":["../../../../src/resolution/actions/resolveScoped.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEb,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAI9C,wBAAgB,aAAa,CAC3B,UAAU,EACV,IAAI,EACJ,KAAK,SAAS,WAAW,EAEzB,QAAQ,SAAS,aAAa,CAAC,KAAK,EAAE,YAAY,EAAE,UAAU,CAAC,EAE/D,UAAU,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,QAAQ,EACnC,OAAO,EAAE,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,IAAI,KAAK,QAAQ,CAAC,UAAU,CAAC,GACrE,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,IAAI,KAAK,QAAQ,CAAC,UAAU,CAAC,CA6C/D"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveScoped = resolveScoped;
|
|
4
4
|
const BindingScope_1 = require("../../binding/models/BindingScope");
|
|
5
|
+
const cacheResolvedValue_1 = require("./cacheResolvedValue");
|
|
5
6
|
const resolveBindingActivations_1 = require("./resolveBindingActivations");
|
|
6
7
|
function resolveScoped(getBinding, resolve) {
|
|
7
8
|
return (params, arg) => {
|
|
@@ -11,27 +12,20 @@ function resolveScoped(getBinding, resolve) {
|
|
|
11
12
|
if (binding.cache.isRight) {
|
|
12
13
|
return binding.cache.value;
|
|
13
14
|
}
|
|
14
|
-
const resolvedValue =
|
|
15
|
-
binding
|
|
16
|
-
isRight: true,
|
|
17
|
-
value: resolvedValue,
|
|
18
|
-
};
|
|
19
|
-
return resolvedValue;
|
|
15
|
+
const resolvedValue = (0, resolveBindingActivations_1.resolveBindingActivations)(params, binding, resolve(params, arg));
|
|
16
|
+
return (0, cacheResolvedValue_1.cacheResolvedValue)(binding, resolvedValue);
|
|
20
17
|
}
|
|
21
18
|
case BindingScope_1.bindingScopeValues.Request: {
|
|
22
19
|
if (params.requestScopeCache.has(binding.id)) {
|
|
23
20
|
return params.requestScopeCache.get(binding.id);
|
|
24
21
|
}
|
|
25
|
-
const resolvedValue =
|
|
22
|
+
const resolvedValue = (0, resolveBindingActivations_1.resolveBindingActivations)(params, binding, resolve(params, arg));
|
|
26
23
|
params.requestScopeCache.set(binding.id, resolvedValue);
|
|
27
24
|
return resolvedValue;
|
|
28
25
|
}
|
|
29
26
|
case BindingScope_1.bindingScopeValues.Transient:
|
|
30
|
-
return
|
|
27
|
+
return (0, resolveBindingActivations_1.resolveBindingActivations)(params, binding, resolve(params, arg));
|
|
31
28
|
}
|
|
32
29
|
};
|
|
33
30
|
}
|
|
34
|
-
function resolveAndActivate(params, arg, binding, resolve) {
|
|
35
|
-
return (0, resolveBindingActivations_1.resolveBindingActivations)(params, binding, resolve(params, arg));
|
|
36
|
-
}
|
|
37
31
|
//# sourceMappingURL=resolveScoped.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveScoped.js","sourceRoot":"","sources":["../../../../src/resolution/actions/resolveScoped.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"resolveScoped.js","sourceRoot":"","sources":["../../../../src/resolution/actions/resolveScoped.ts"],"names":[],"mappings":";;AAWA,sCAsDC;AAjED,oEAG2C;AAK3C,6DAA0D;AAC1D,2EAAwE;AAExE,SAAgB,aAAa,CAO3B,UAAmC,EACnC,OAAsE;IAEtE,OAAO,CAAC,MAAwB,EAAE,GAAS,EAAwB,EAAE;QACnE,MAAM,OAAO,GAAa,UAAU,CAAC,GAAG,CAAC,CAAC;QAE1C,QAAQ,OAAO,CAAC,KAAK,EAAE,CAAC;YACtB,KAAK,iCAAkB,CAAC,SAAS,CAAC,CAAC,CAAC;gBAClC,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;oBAC1B,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;gBAC7B,CAAC;gBAED,MAAM,aAAa,GACjB,IAAA,qDAAyB,EACvB,MAAM,EACN,OAAO,EACP,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CACrB,CAAC;gBAEJ,OAAO,IAAA,uCAAkB,EAAC,OAAO,EAAE,aAAa,CAAC,CAAC;YACpD,CAAC;YACD,KAAK,iCAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;gBAChC,IAAI,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;oBAC7C,OAAO,MAAM,CAAC,iBAAiB,CAAC,GAAG,CACjC,OAAO,CAAC,EAAE,CACa,CAAC;gBAC5B,CAAC;gBAED,MAAM,aAAa,GACjB,IAAA,qDAAyB,EACvB,MAAM,EACN,OAAO,EACP,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CACrB,CAAC;gBAEJ,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;gBAExD,OAAO,aAAa,CAAC;YACvB,CAAC;YACD,KAAK,iCAAkB,CAAC,SAAS;gBAC/B,OAAO,IAAA,qDAAyB,EAC9B,MAAM,EACN,OAAO,EACP,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CACrB,CAAC;QACN,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveSingletonScopedBinding.d.ts","sourceRoot":"","sources":["../../../../src/resolution/actions/resolveSingletonScopedBinding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"resolveSingletonScopedBinding.d.ts","sourceRoot":"","sources":["../../../../src/resolution/actions/resolveSingletonScopedBinding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAI9C,wBAAgB,6BAA6B,CAC3C,UAAU,EACV,KAAK,SAAS,WAAW,EACzB,QAAQ,SAAS,aAAa,CAC5B,KAAK,EACL,OAAO,kBAAkB,CAAC,SAAS,EACnC,UAAU,CACX,EAED,OAAO,EAAE,CACP,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,QAAQ,KACd,QAAQ,CAAC,UAAU,CAAC,GACxB,CAAC,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,QAAQ,KAAK,QAAQ,CAAC,UAAU,CAAC,CAiBvE"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveSingletonScopedBinding = resolveSingletonScopedBinding;
|
|
4
|
+
const cacheResolvedValue_1 = require("./cacheResolvedValue");
|
|
4
5
|
const resolveBindingActivations_1 = require("./resolveBindingActivations");
|
|
5
6
|
function resolveSingletonScopedBinding(resolve) {
|
|
6
7
|
return (params, binding) => {
|
|
@@ -8,11 +9,7 @@ function resolveSingletonScopedBinding(resolve) {
|
|
|
8
9
|
return binding.cache.value;
|
|
9
10
|
}
|
|
10
11
|
const resolvedValue = (0, resolveBindingActivations_1.resolveBindingActivations)(params, binding, resolve(params, binding));
|
|
11
|
-
binding
|
|
12
|
-
isRight: true,
|
|
13
|
-
value: resolvedValue,
|
|
14
|
-
};
|
|
15
|
-
return resolvedValue;
|
|
12
|
+
return (0, cacheResolvedValue_1.cacheResolvedValue)(binding, resolvedValue);
|
|
16
13
|
};
|
|
17
14
|
}
|
|
18
15
|
//# sourceMappingURL=resolveSingletonScopedBinding.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveSingletonScopedBinding.js","sourceRoot":"","sources":["../../../../src/resolution/actions/resolveSingletonScopedBinding.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"resolveSingletonScopedBinding.js","sourceRoot":"","sources":["../../../../src/resolution/actions/resolveSingletonScopedBinding.ts"],"names":[],"mappings":";;AAQA,sEA8BC;AAjCD,6DAA0D;AAC1D,2EAAwE;AAExE,SAAgB,6BAA6B,CAS3C,OAGyB;IAEzB,OAAO,CACL,MAAwB,EACxB,OAAiB,EACK,EAAE;QACxB,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YAC1B,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;QAC7B,CAAC;QAED,MAAM,aAAa,GAAyB,IAAA,qDAAyB,EACnE,MAAM,EACN,OAAO,EACP,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CACzB,CAAC;QAEF,OAAO,IAAA,uCAAkB,EAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IACpD,CAAC,CAAC;AACJ,CAAC"}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -4,11 +4,11 @@ type MetadataName = number | string | symbol;
|
|
|
4
4
|
|
|
5
5
|
type MetadataTag = number | string | symbol;
|
|
6
6
|
|
|
7
|
-
interface
|
|
7
|
+
interface BindingConstraints {
|
|
8
8
|
readonly name: MetadataName | undefined;
|
|
9
9
|
readonly tags: Map<MetadataTag, unknown>;
|
|
10
10
|
readonly serviceIdentifier: ServiceIdentifier;
|
|
11
|
-
getAncestor():
|
|
11
|
+
getAncestor(): BindingConstraints | undefined;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
type BindingType = 'ConstantValue' | 'DynamicValue' | 'Factory' | 'Instance' | 'Provider' | 'ResolvedValue' | 'ServiceRedirection';
|
|
@@ -21,7 +21,7 @@ interface BaseBinding<TType extends BindingType, TActivated> {
|
|
|
21
21
|
readonly moduleId: number | undefined;
|
|
22
22
|
readonly serviceIdentifier: ServiceIdentifier<TActivated>;
|
|
23
23
|
readonly type: TType;
|
|
24
|
-
isSatisfiedBy(
|
|
24
|
+
isSatisfiedBy(constraints: BindingConstraints): boolean;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
type Resolved<TActivated> = SyncResolved<TActivated> | Promise<SyncResolved<TActivated>>;
|
|
@@ -62,7 +62,7 @@ type BindingActivation<T = unknown> = (context: ResolutionContext, injectable: T
|
|
|
62
62
|
type BindingDeactivation<T = unknown> = (injectable: T) => void | Promise<void>;
|
|
63
63
|
|
|
64
64
|
interface ScopedBinding<TType extends BindingType, TScope extends BindingScope, TActivated> extends BaseBinding<TType, TActivated> {
|
|
65
|
-
cache: Either<undefined,
|
|
65
|
+
cache: Either<undefined, SyncResolved<TActivated>>;
|
|
66
66
|
readonly onActivation: BindingActivation<TActivated> | undefined;
|
|
67
67
|
readonly onDeactivation: BindingDeactivation<TActivated> | undefined;
|
|
68
68
|
readonly scope: TScope;
|
|
@@ -368,4 +368,4 @@ declare function resolveModuleDeactivations(params: DeactivationParams, moduleId
|
|
|
368
368
|
|
|
369
369
|
declare function resolveServiceDeactivations(params: DeactivationParams, serviceIdentifier: ServiceIdentifier): void | Promise<void>;
|
|
370
370
|
|
|
371
|
-
export { ActivationsService, type BaseBinding, type BaseBindingNode, type BasePlanParams, type Binding, type BindingActivation, type BindingActivationRelation, type
|
|
371
|
+
export { ActivationsService, type BaseBinding, type BaseBindingNode, type BasePlanParams, type Binding, type BindingActivation, type BindingActivationRelation, type BindingConstraints, type BindingDeactivation, type BindingDeactivationRelation, type BindingScope, BindingService, type BindingType, type ClassElementMetadata, ClassElementMetadataKind, type ClassMetadata, type ClassMetadataLifecycle, type ConstantValueBinding, type DeactivationParams, DeactivationsService, type DynamicValueBinding, type DynamicValueBuilder, type Factory, type FactoryBinding, type GetOptions, type GetOptionsTagConstraint, type GetPlanOptions, type InstanceBinding, type LeafBindingNode, type ManagedClassElementMetadata, type MetadataName, type MetadataTag, type OptionalGetOptions, type PlanBindingNode, type PlanParams, type PlanParamsConstraint, type PlanParamsTagConstraint, type PlanResult, PlanResultCacheService, type PlanServiceNode, type PlanServiceNodeParent, type PlanServiceRedirectionBindingNode, type PlanTree, type Provider, type ProviderBinding, type ResolutionContext, type ResolutionParams, type Resolved, type ResolvedValueBinding, type ResolvedValueBindingNode, type ResolvedValueElementMetadata, ResolvedValueElementMetadataKind, type ResolvedValueMetadata, type ScopedBinding, type ServiceRedirectionBinding, type UnmanagedClassElementMetadata, bindingScopeValues, bindingTypeValues, decorate, getClassMetadata, inject, injectFromBase, injectable, multiInject, named, optional, plan, postConstruct, preDestroy, resolve, resolveModuleDeactivations, resolveServiceDeactivations, tagged, unmanaged };
|
package/lib/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EACL,YAAY,EACZ,kBAAkB,EACnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,mB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,EACR,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,QAAQ,EACR,oBAAoB,EACpB,wBAAwB,EACxB,4BAA4B,EAC5B,qBAAqB,EACrB,aAAa,EACb,yBAAyB,EACzB,6BAA6B,GAC9B,CAAC;AAEF,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,wBAAwB,EACxB,oBAAoB,EACpB,QAAQ,EACR,gBAAgB,EAChB,MAAM,EACN,UAAU,EACV,cAAc,EACd,WAAW,EACX,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,sBAAsB,EACtB,aAAa,EACb,UAAU,EACV,OAAO,EACP,gCAAgC,EAChC,0BAA0B,EAC1B,2BAA2B,EAC3B,MAAM,EACN,SAAS,GACV,CAAC"}
|
package/lib/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{getOwnReflectMetadata as e,updateOwnReflectMetadata as t,setReflectMetadata as n}from"@inversifyjs/reflect-metadata-utils";import{getBaseType as i}from"@inversifyjs/prototype-utils";import{stringifyServiceIdentifier as o,LazyServiceIdentifier as r,isPromise as a}from"@inversifyjs/common";const s={Request:"Request",Singleton:"Singleton",Transient:"Transient"},c={ConstantValue:"ConstantValue",DynamicValue:"DynamicValue",Factory:"Factory",Instance:"Instance",Provider:"Provider",ResolvedValue:"ResolvedValue",ServiceRedirection:"ServiceRedirection"};function*u(...e){for(const t of e)yield*t}class d{#e;#t;#n;constructor(e){this.#e=new Map,this.#t={};for(const t of Reflect.ownKeys(e))this.#t[t]=new Map;this.#n=e}add(e,t){this.#i(e).push(t);for(const n of Reflect.ownKeys(t))this.#o(n,t[n]).push(e)}clone(){const e=Reflect.ownKeys(this.#n),t=new d(this.#n);this.#r(this.#e,t.#e);for(const n of e)this.#r(this.#t[n],t.#t[n]);return t}get(e,t){return this.#t[e].get(t)}getAllKeys(e){return this.#t[e].keys()}removeByRelation(e,t){const n=this.get(e,t);if(void 0===n)return;const i=new Set(n);for(const n of i){const i=this.#e.get(n);if(void 0===i)throw new Error("Expecting model relation, none found");for(const o of i)o[e]===t&&this.#a(n,o);this.#e.delete(n)}}#i(e){let t=this.#e.get(e);return void 0===t&&(t=[],this.#e.set(e,t)),t}#o(e,t){let n=this.#t[e].get(t);return void 0===n&&(n=[],this.#t[e].set(t,n)),n}#r(e,t){for(const[n,i]of e)t.set(n,[...i])}#a(e,t){for(const n of Reflect.ownKeys(t))this.#s(e,n,t[n])}#s(e,t,n){const i=this.#t[t].get(n);if(void 0!==i){const o=i.indexOf(e);-1!==o&&i.splice(o,1),0===i.length&&this.#t[t].delete(n)}}}var l,p,f;!function(e){e.moduleId="moduleId",e.serviceId="serviceId"}(l||(l={}));class g{#c;#u;constructor(e,t){this.#c=t??new d({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#u=e}static build(e){return new g(e)}add(e,t){this.#c.add(e,t)}clone(){return new g(this.#u,this.#c.clone())}get(e){const t=[],n=this.#c.get(l.serviceId,e);void 0!==n&&t.push(n);const i=this.#u?.get(e);if(void 0!==i&&t.push(i),0!==t.length)return u(...t)}removeAllByModuleId(e){this.#c.removeByRelation(l.moduleId,e)}removeAllByServiceId(e){this.#c.removeByRelation(l.serviceId,e)}}!function(e){e.moduleId="moduleId",e.serviceId="serviceId"}(p||(p={}));class m{#d;#u;constructor(e,t){this.#d=t??new d({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#u=e}static build(e){return new m(e)}clone(){return new m(this.#u,this.#d.clone())}get(e){return this.getNonParentBindings(e)??this.#u?.get(e)}getNonParentBindings(e){return this.#d.get(p.serviceId,e)}getNonParentBoundServices(){return this.#d.getAllKeys(p.serviceId)}getByModuleId(e){return this.#d.get(p.moduleId,e)??this.#u?.getByModuleId(e)}removeAllByModuleId(e){this.#d.removeByRelation(p.moduleId,e)}removeAllByServiceId(e){this.#d.removeByRelation(p.serviceId,e)}set(e){const t={[p.serviceId]:e.serviceIdentifier};void 0!==e.moduleId&&(t[p.moduleId]=e.moduleId),this.#d.add(e,t)}}!function(e){e.moduleId="moduleId",e.serviceId="serviceId"}(f||(f={}));class h{#l;#u;constructor(e,t){this.#l=t??new d({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#u=e}static build(e){return new h(e)}add(e,t){this.#l.add(e,t)}clone(){return new h(this.#u,this.#l.clone())}get(e){const t=[],n=this.#l.get(f.serviceId,e);void 0!==n&&t.push(n);const i=this.#u?.get(e);if(void 0!==i&&t.push(i),0!==t.length)return u(...t)}removeAllByModuleId(e){this.#l.removeByRelation(f.moduleId,e)}removeAllByServiceId(e){this.#l.removeByRelation(f.serviceId,e)}}function v(e,t,n){const i=Array.isArray(e)?e:[e];if(void 0!==n)if("number"!=typeof n)Reflect.decorate(i,t.prototype,n);else for(const e of i)e(t,void 0,n);else Reflect.decorate(i,t)}const y="@inversifyjs/core/classMetadataReflectKey";function M(){return{constructorArguments:[],lifecycle:{postConstructMethodName:void 0,preDestroyMethodName:void 0},properties:new Map,scope:void 0}}const I="@inversifyjs/core/pendingClassMetadataCountReflectKey";const w=Symbol.for("@inversifyjs/core/InversifyCoreError");class b extends Error{[w];kind;constructor(e,t,n){super(t,n),this[w]=!0,this.kind=e}static is(e){return"object"==typeof e&&null!==e&&!0===e[w]}static isErrorOfKind(e,t){return b.is(e)&&e.kind===t}}var j,T,C;function S(t){const n=e(t,y)??M();if(!function(t){const n=e(t,I);return void 0!==n&&0!==n}(t))return function(e,t){const n=[];if(t.length<e.length)throw new b(j.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}". "${e.name}" constructor requires at least ${e.length.toString()} arguments, found ${t.length.toString()} instead.\nAre you using @inject, @multiInject or @unmanaged decorators in every non optional constructor argument?\n\nIf you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`);for(let e=0;e<t.length;++e)void 0===t[e]&&n.push(e);if(n.length>0)throw new b(j.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}" at constructor indexes "${n.join('", "')}".\n\nAre you using @inject, @multiInject or @unmanaged decorators at those indexes?\n\nIf you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`)}(t,n.constructorArguments),n;!function(e,t){const n=[];for(let i=0;i<t.constructorArguments.length;++i){const o=t.constructorArguments[i];void 0!==o&&o.kind!==T.unknown||n.push(` - Missing or incomplete metadata for type "${e.name}" at constructor argument with index ${i.toString()}.\nEvery constructor parameter must be decorated either with @inject, @multiInject or @unmanaged decorator.`)}for(const[i,o]of t.properties)o.kind===T.unknown&&n.push(` - Missing or incomplete metadata for type "${e.name}" at property "${i.toString()}".\nThis property must be decorated either with @inject or @multiInject decorator.`);if(0===n.length)throw new b(j.unknown,`Unexpected class metadata for type "${e.name}" with uncompletion traces.\nThis might be caused by one of the following reasons:\n\n1. A third party library is targeting inversify reflection metadata.\n2. A bug is causing the issue. Consider submiting an issue to fix it.`);throw new b(j.missingInjectionDecorator,`Invalid class metadata at type ${e.name}:\n\n${n.join("\n\n")}`)}(t,n)}function A(){return 0}function $(e){return n=>{void 0!==n&&n.kind===T.unknown&&t(e,I,A,(e=>e-1))}}function x(e,t){return(...n)=>i=>{if(void 0===i)return e(...n);if(i.kind===C.unmanaged)throw new b(j.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found");return t(i,...n)}}function B(e){if(e.kind!==T.unknown&&!0!==e.isFromTypescriptParamType)throw new b(j.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found")}!function(e){e[e.injectionDecoratorConflict=0]="injectionDecoratorConflict",e[e.missingInjectionDecorator=1]="missingInjectionDecorator",e[e.planning=2]="planning",e[e.resolution=3]="resolution",e[e.unknown=4]="unknown"}(j||(j={})),function(e){e[e.unknown=32]="unknown"}(T||(T={})),function(e){e[e.multipleInjection=0]="multipleInjection",e[e.singleInjection=1]="singleInjection",e[e.unmanaged=2]="unmanaged"}(C||(C={}));const R=x((function(e,t){return{kind:e,name:void 0,optional:!1,tags:new Map,value:t}}),(function(e,t,n){return B(e),{...e,kind:t,value:n}}));function k(e,t){return n=>{const i=n.properties.get(t);return n.properties.set(t,e(i)),n}}var P;function D(e,t,n,i){if(b.isErrorOfKind(i,j.injectionDecoratorConflict)){const o=function(e,t,n){if(void 0===n){if(void 0===t)throw new b(j.unknown,"Unexpected undefined property and index values");return{kind:P.property,property:t,targetClass:e.constructor}}return"number"==typeof n?{index:n,kind:P.parameter,targetClass:e}:{kind:P.method,method:t,targetClass:e}}(e,t,n);throw new b(j.injectionDecoratorConflict,`Unexpected injection error.\n\nCause:\n\n${i.message}\n\nDetails\n\n${function(e){switch(e.kind){case P.method:return`[class: "${e.targetClass.name}", method: "${e.method.toString()}"]`;case P.parameter:return`[class: "${e.targetClass.name}", index: "${e.index.toString()}"]`;case P.property:return`[class: "${e.targetClass.name}", property: "${e.property.toString()}"]`}}(o)}`,{cause:i})}throw i}function V(e,n){return(i,o,r)=>{try{void 0===r?function(e,n){const i=F(e,n);return(e,n)=>{t(e.constructor,y,M,k(i(e),n))}}(e,n)(i,o):"number"==typeof r?function(e,n){const i=F(e,n);return(e,n,o)=>{if(!function(e,t){return"function"==typeof e&&void 0===t}(e,n))throw new b(j.injectionDecoratorConflict,`Found an @inject decorator in a non constructor parameter.\nFound @inject decorator at method "${n?.toString()??""}" at class "${e.constructor.name}"`);t(e,y,M,function(e,t){return n=>{const i=n.constructorArguments[t];return n.constructorArguments[t]=e(i),n}}(i(e),o))}}(e,n)(i,o,r):function(e,n){const i=F(e,n);return(e,n,o)=>{if(!function(e){return void 0!==e.set}(o))throw new b(j.injectionDecoratorConflict,`Found an @inject decorator in a non setter property method.\nFound @inject decorator at method "${n.toString()}" at class "${e.constructor.name}"`);t(e.constructor,y,M,k(i(e),n))}}(e,n)(i,o,r)}catch(e){D(i,o,r,e)}}}function F(e,t){return n=>{const i=t(n);return t=>(i(t),e(t))}}function O(e){return V(R(C.singleInjection,e),$)}!function(e){e[e.method=0]="method",e[e.parameter=1]="parameter",e[e.property=2]="property"}(P||(P={}));const N="@inversifyjs/core/classIsInjectableFlagReflectKey";const E=[Array,BigInt,Boolean,Function,Number,Object,String];function U(n){const i=e(n,"design:paramtypes");void 0!==i&&t(n,y,M,function(e){return t=>(e.forEach(((e,n)=>{var i;void 0!==t.constructorArguments[n]||(i=e,E.includes(i))||(t.constructorArguments[n]=function(e){return{isFromTypescriptParamType:!0,kind:C.singleInjection,name:void 0,optional:!1,tags:new Map,value:e}}(e))})),t)}(i))}function K(i){return o=>{!function(t){if(void 0!==e(t,N))throw new b(j.injectionDecoratorConflict,`Cannot apply @injectable decorator multiple times at class "${t.name}"`);n(t,N,!0)}(o),U(o),void 0!==i&&t(o,y,M,(e=>({...e,scope:i})))}}function q(e,t,n){let i;return e.extendConstructorArguments??!0?(i=[...t.constructorArguments],n.constructorArguments.map(((e,t)=>{i[t]=e}))):i=n.constructorArguments,i}function z(e,t,n){let i;return i=e.extendProperties??!0?new Map(u(t.properties,n.properties)):n.properties,i}function G(e){return n=>{const i=S(e.type);t(n,y,M,function(e,t){const n=n=>({constructorArguments:q(e,t,n),lifecycle:n.lifecycle,properties:z(e,t,n),scope:n.scope});return n}(e,i))}}function H(e){return t=>{const n=i(t);if(void 0===n)throw new b(j.injectionDecoratorConflict,`Expected base type for type "${t.name}", none found.`);G({...e,type:n})(t)}}function J(e){return V(R(C.multipleInjection,e),$)}function L(e){return n=>{void 0===n&&t(e,I,A,(e=>e+1))}}function Q(e){return t=>{const n=t??{kind:T.unknown,name:void 0,optional:!1,tags:new Map};if(n.kind===C.unmanaged)throw new b(j.injectionDecoratorConflict,"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections");return e(n)}}function W(e){const t=Q(function(e){return t=>{if(void 0!==t.name)throw new b(j.injectionDecoratorConflict,"Unexpected duplicated named decorator");return t.name=e,t}}(e));return V(t,L)}function X(e){if(e.optional)throw new b(j.injectionDecoratorConflict,"Unexpected duplicated optional decorator");return e.optional=!0,e}function Y(){return V(Q(X),L)}function Z(){return(e,n,i)=>{try{t(e.constructor,y,M,(o=n,e=>{if(void 0!==e.lifecycle.postConstructMethodName)throw new b(j.injectionDecoratorConflict,"Unexpected duplicated postConstruct decorator");return e.lifecycle.postConstructMethodName=o,e}))}catch(t){D(e,n,void 0,t)}var o}}function _(){return(e,n,i)=>{try{t(e.constructor,y,M,(o=n,e=>{if(void 0!==e.lifecycle.preDestroyMethodName)throw new b(j.injectionDecoratorConflict,"Unexpected duplicated preDestroy decorator");return e.lifecycle.preDestroyMethodName=o,e}))}catch(t){D(e,n,void 0,t)}var o}}function ee(e,t){const n=Q(function(e,t){return n=>{if(n.tags.has(e))throw new b(j.injectionDecoratorConflict,"Unexpected duplicated tag decorator with existing tag");return n.tags.set(e,t),n}}(e,t));return V(n,L)}function te(){return{kind:C.unmanaged}}const ne=x(te,(function(e){if(B(e),function(e){return void 0!==e.name||e.optional||e.tags.size>0}(e))throw new b(j.injectionDecoratorConflict,"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections");return te()}));function ie(){return V(ne(),$)}var oe;!function(e){e[e.multipleInjection=0]="multipleInjection",e[e.singleInjection=1]="singleInjection"}(oe||(oe={}));class re{#p;constructor(e){this.#p=e}get name(){return this.#p.elem.name}get tags(){return this.#p.elem.tags}get serviceIdentifier(){return this.#p.elem.serviceIdentifier}getAncestor(){if(void 0!==this.#p.previous)return new re(this.#p.previous)}}class ae{last;constructor(e){this.last=e}concat(e){return new ae({elem:e,previous:this.last})}[Symbol.iterator](){let e=this.last;return{next:()=>{if(void 0===e)return{done:!0,value:void 0};const t=e.elem;return e=e.previous,{done:!1,value:t}}}}}function se(e,t){e.servicesBranch.has(t)&&function(e,t){const n=(i=[...e.servicesBranch,t],[...i].map(o).join(" -> "));var i;throw new b(j.planning,`Circular dependency found: ${n}`)}(e,t),e.servicesBranch.add(t)}function ce(e,t,n){const i=n?.customServiceIdentifier??t.serviceIdentifier,o=[...e.getBindings(i)??[]].filter((e=>e.isSatisfiedBy(t)));if(0===o.length&&void 0!==e.autobindOptions&&"function"==typeof i){const t=function(e,t){return{cache:{isRight:!1,value:void 0},id:0,implementationType:t,isSatisfiedBy:()=>!0,moduleId:void 0,onActivation:void 0,onDeactivation:void 0,scope:e.scope,serviceIdentifier:t,type:c.Instance}}(e.autobindOptions,i);e.setBinding(t),o.push(t)}return o}function ue(e){return void 0!==e.redirections}function de(e,t,n,i){let r,a;ue(n)?(r=n.binding.targetServiceIdentifier,a=n.binding.serviceIdentifier):(r=n.serviceIdentifier,a=n.parent?.binding.serviceIdentifier),Array.isArray(e)?function(e,t,n,i,r){if(0!==e.length){const t=`Ambiguous bindings found for service: "${o(n)}".\n\nRegistered bindings:\n\n${e.map((e=>function(e){switch(e.type){case c.Instance:return`[ type: "${e.type}", serviceIdentifier: "${o(e.serviceIdentifier)}", scope: "${e.scope}", implementationType: "${e.implementationType.name}" ]`;case c.ServiceRedirection:return`[ type: "${e.type}", serviceIdentifier: "${o(e.serviceIdentifier)}", redirection: "${o(e.targetServiceIdentifier)}" ]`;default:return`[ type: "${e.type}", serviceIdentifier: "${o(e.serviceIdentifier)}", scope: "${e.scope}" ]`}}(e.binding))).join("\n")}\n\nTrying to resolve bindings for "${pe(n,i)}".\n\n${fe(r)}`;throw new b(j.planning,t)}t||le(n,i,r)}(e,t,r,a,i):function(e,t,n,i,o){if(void 0!==e||t)return;le(n,i,o)}(e,t,r,a,i)}function le(e,t,n){const i=`No bindings found for service: "${o(e)}".\n\nTrying to resolve bindings for "${pe(e,t)}".\n\n${fe(n)}`;throw new b(j.planning,i)}function pe(e,t){return void 0===t?`${o(e)} (Root service)`:o(t)}function fe(e){const t=0===e.tags.size?"":`\n- tags:\n - ${[...e.tags.keys()].map((e=>e.toString())).join("\n - ")}`;return`Binding metadata:\n- service identifier: ${o(e.serviceIdentifier)}\n- name: ${e.name?.toString()??"-"}${t}`}function ge(e,t,n){if(1!==e.redirections.length)de(e.redirections,t,e,n);else{const[i]=e.redirections;ue(i)&&ge(i,t,n)}}function me(e,t,n){if(Array.isArray(e.bindings)&&1===e.bindings.length){const[i]=e.bindings;ue(i)&&ge(i,t,n)}else de(e.bindings,t,e,n)}function he(e){const t=new Map;void 0!==e.rootConstraints.tag&&t.set(e.rootConstraints.tag.key,e.rootConstraints.tag.value);const n=new ae({elem:{name:e.rootConstraints.name,serviceIdentifier:e.rootConstraints.serviceIdentifier,tags:t},previous:void 0}),i=new re(n.last),o=ce(e,i),r=[],a={bindings:r,parent:void 0,serviceIdentifier:e.rootConstraints.serviceIdentifier};if(r.push(...we(e,n,o,a)),!e.rootConstraints.isMultiple){me(a,e.rootConstraints.isOptional??!1,i);const[t]=r;a.bindings=t}return{tree:{root:a}}}function ve(e,t,n,i){const o={binding:t,classMetadata:e.getClassMetadata(t.implementationType),constructorParams:[],parent:i,propertyParams:new Map};return je({autobindOptions:e.autobindOptions,getBindings:e.getBindings,getClassMetadata:e.getClassMetadata,node:o,servicesBranch:e.servicesBranch,setBinding:e.setBinding},n)}function ye(e,t,n){if(n.kind===C.unmanaged)return;const i=r.is(n.value)?n.value.unwrap():n.value,o=t.concat({name:n.name,serviceIdentifier:i,tags:n.tags}),a=new re(o.last),s=ce(e,a),c=[],u={bindings:c,parent:e.node,serviceIdentifier:i};if(c.push(...we(e,o,s,u)),n.kind===C.singleInjection){me(u,n.optional,a);const[e]=c;u.bindings=e}return u}function Me(e,t,n){const i=r.is(n.value)?n.value.unwrap():n.value,o=t.concat({name:n.name,serviceIdentifier:i,tags:n.tags}),a=new re(o.last),s=ce(e,a),c=[],u={bindings:c,parent:e.node,serviceIdentifier:i};if(c.push(...we(e,o,s,u)),n.kind===oe.singleInjection){me(u,n.optional,a);const[e]=c;u.bindings=e}return u}function Ie(e,t,n,i){const o={binding:t,params:[],parent:i};return je({autobindOptions:e.autobindOptions,getBindings:e.getBindings,getClassMetadata:e.getClassMetadata,node:o,servicesBranch:e.servicesBranch,setBinding:e.setBinding},n)}function we(e,t,n,i){const o=ue(i)?i.binding.targetServiceIdentifier:i.serviceIdentifier;se(e,o);const r=[];for(const o of n)switch(o.type){case c.Instance:r.push(ve(e,o,t,i));break;case c.ResolvedValue:r.push(Ie(e,o,t,i));break;case c.ServiceRedirection:{const n=be(e,t,o,i);r.push(n);break}default:r.push({binding:o,parent:i})}return e.servicesBranch.delete(o),r}function be(e,t,n,i){const o={binding:n,parent:i,redirections:[]},r=ce(e,new re(t.last),{customServiceIdentifier:n.targetServiceIdentifier});return o.redirections.push(...we(e,t,r,o)),o}function je(e,t){return e.node.binding.type===c.Instance?function(e,t,n){const i=t.classMetadata;for(const[o,r]of i.constructorArguments.entries())t.constructorParams[o]=ye(e,n,r);for(const[o,r]of i.properties){const i=ye(e,n,r);void 0!==i&&t.propertyParams.set(o,i)}return e.node}(e,e.node,t):function(e,t,n){const i=t.binding.metadata;for(const[o,r]of i.arguments.entries())t.params[o]=Me(e,n,r);return e.node}(e,e.node,t)}var Te;!function(e){e[e.singleMandatory=0]="singleMandatory",e[e.singleOptional=1]="singleOptional",e[e.multipleMandatory=2]="multipleMandatory",e[e.multipleOptional=3]="multipleOptional",e[e.length=4]="length"}(Te||(Te={}));class Ce{#f;#g;#m;#h;#v;constructor(){this.#f=this.#y(),this.#g=this.#y(),this.#h=this.#y(),this.#m=this.#y(),this.#v=[]}clearCache(){for(const e of this.#M())e.clear();for(const e of this.#v)e.clearCache()}get(e){return void 0===e.name?void 0===e.tag?this.#I(this.#f,e).get(e.serviceIdentifier):this.#I(this.#m,e).get(e.serviceIdentifier)?.get(e.tag.key)?.get(e.tag.value):void 0===e.tag?this.#I(this.#g,e).get(e.serviceIdentifier)?.get(e.name):this.#I(this.#h,e).get(e.serviceIdentifier)?.get(e.name)?.get(e.tag.key)?.get(e.tag.value)}set(e,t){void 0===e.name?void 0===e.tag?this.#I(this.#f,e).set(e.serviceIdentifier,t):this.#w(this.#w(this.#I(this.#m,e),e.serviceIdentifier),e.tag.key).set(e.tag.value,t):void 0===e.tag?this.#w(this.#I(this.#g,e),e.serviceIdentifier).set(e.name,t):this.#w(this.#w(this.#w(this.#I(this.#h,e),e.serviceIdentifier),e.name),e.tag.key).set(e.tag.value,t)}subscribe(e){this.#v.push(e)}#y(){const e=new Array(Te.length);for(let t=0;t<e.length;++t)e[t]=new Map;return e}#w(e,t){let n=e.get(t);return void 0===n&&(n=new Map,e.set(t,n)),n}#I(e,t){return e[this.#b(t)]}#M(){return[...this.#f,...this.#g,...this.#h,...this.#m]}#b(e){return e.isMultiple?!0===e.optional?Te.multipleOptional:Te.multipleMandatory:!0===e.optional?Te.singleOptional:Te.singleMandatory}}function Se(e,t,n){const i=e.getActivations(t);return void 0===i?n:a(n)?Ae(e,n,i[Symbol.iterator]()):function(e,t,n){let i=t,o=n.next();for(;!0!==o.done;){const t=o.value(e.context,i);if(a(t))return Ae(e,t,n);i=t,o=n.next()}return i}(e,n,i[Symbol.iterator]())}async function Ae(e,t,n){let i=await t,o=n.next();for(;!0!==o.done;)i=await o.value(e.context,i),o=n.next();return i}function $e(e,t,n){let i=n;if(void 0!==t.onActivation){const n=t.onActivation;i=a(i)?i.then((t=>n(e.context,t))):n(e.context,i)}return Se(e,t.serviceIdentifier,i)}function xe(e){return(t,n)=>{if(n.cache.isRight)return n.cache.value;const i=$e(t,n,e(t,n));return n.cache={isRight:!0,value:i},i}}const Be=xe((function(e,t){return t.value}));function Re(e){return e}function ke(e,t){return(n,i)=>{const o=e(i);switch(o.scope){case s.Singleton:{if(o.cache.isRight)return o.cache.value;const e=Pe(n,i,o,t);return o.cache={isRight:!0,value:e},e}case s.Request:{if(n.requestScopeCache.has(o.id))return n.requestScopeCache.get(o.id);const e=Pe(n,i,o,t);return n.requestScopeCache.set(o.id,e),e}case s.Transient:return Pe(n,i,o,t)}}}function Pe(e,t,n,i){return $e(e,n,i(e,t))}const De=(e=>ke(Re,e))((function(e,t){return t.value(e.context)}));const Ve=xe((function(e,t){return t.factory(e.context)}));function Fe(e,t,n){const i=function(e,t,n){if(void 0===n)return;if(!(n in e))throw new b(j.resolution,`Expecting a "${n.toString()}" property when resolving "${t.implementationType.name}" class @postConstruct decorated method, none found.`);if("function"!=typeof e[n])throw new b(j.resolution,`Expecting a "${n.toString()}" method when resolving "${t.implementationType.name}" class @postConstruct decorated method, a non function property was found instead.`);{let i;try{i=e[n]()}catch(e){throw new b(j.resolution,`Unexpected error found when calling "${n.toString()}" @postConstruct decorated method on class "${t.implementationType.name}"`,{cause:e})}if(a(i))return async function(e,t,n){try{await n}catch(n){throw new b(j.resolution,`Unexpected error found when calling "${t.toString()}" @postConstruct decorated method on class "${e.implementationType.name}"`,{cause:n})}}(t,n,i)}}(e,t,n);return a(i)?i.then((()=>e)):e}function Oe(e){return(t,n,i)=>{const o=new i.binding.implementationType(...t),r=e(n,o,i);return a(r)?r.then((()=>Fe(o,i.binding,i.classMetadata.lifecycle.postConstructMethodName))):Fe(o,i.binding,i.classMetadata.lifecycle.postConstructMethodName)}}const Ne=xe((function(e,t){return t.provider(e.context)}));function Ee(e){return e.binding}function Ue(e){return e.binding}const Ke=function(e){return(t,n,i)=>{const o=[];for(const[r,s]of i.propertyParams){const c=i.classMetadata.properties.get(r);if(void 0===c)throw new b(j.resolution,`Expecting metadata at property "${r.toString()}", none found`);c.kind!==C.unmanaged&&void 0!==s.bindings&&(n[r]=e(t,s),a(n[r])&&o.push((async()=>{n[r]=await n[r]})()))}if(o.length>0)return Promise.all(o).then((()=>{}))}}(We),qe=function(e){return function t(n,i){const o=[];for(const r of i.redirections)ue(r)?o.push(...t(n,r)):o.push(e(n,r));return o}}(Qe),ze=function(e,t,n){return(i,o)=>{const r=e(i,o);return a(r)?t(r,i,o):n(r,i,o)}}(function(e){return(t,n)=>{const i=[];for(const o of n.constructorParams)void 0===o?i.push(void 0):i.push(e(t,o));return i.some(a)?Promise.all(i):i}}(We),function(e){return async(t,n,i)=>{const o=await t;return e(o,n,i)}}(Oe(Ke)),Oe(Ke)),Ge=function(e){return(t,n)=>{const i=e(t,n);return a(i)?i.then((e=>n.binding.factory(...e))):n.binding.factory(...i)}}(function(e){return(t,n)=>{const i=[];for(const o of n.params)i.push(e(t,o));return i.some(a)?Promise.all(i):i}}(We)),He=(e=>ke(Ee,e))(ze),Je=(e=>ke(Ue,e))(Ge);function Le(e){return We(e,e.planResult.tree.root)}function Qe(e,t){switch(t.binding.type){case c.ConstantValue:return Be(e,t.binding);case c.DynamicValue:return De(e,t.binding);case c.Factory:return Ve(e,t.binding);case c.Instance:return He(e,t);case c.Provider:return Ne(e,t.binding);case c.ResolvedValue:return Je(e,t)}}function We(e,t){if(void 0!==t.bindings)return Array.isArray(t.bindings)?function(e,t){const n=[];for(const i of t)ue(i)?n.push(...qe(e,i)):n.push(Qe(e,i));if(n.some(a))return Promise.all(n);return n}(e,t.bindings):function(e,t){if(ue(t)){const n=qe(e,t);if(1===n.length)return n[0];throw new b(j.resolution,"Unexpected multiple resolved values on single injection")}return Qe(e,t)}(e,t.bindings)}function Xe(e){return void 0!==e.scope}function Ye(e,t){if(void 0!==e.lifecycle.preDestroyMethodName&&"function"==typeof t[e.lifecycle.preDestroyMethodName])return t[e.lifecycle.preDestroyMethodName]()}function Ze(e,t,n){const i=e.getDeactivations(t);if(void 0!==i)return a(n)?_e(n,i[Symbol.iterator]()):function(e,t){let n=t.next();for(;!0!==n.done;){const i=n.value(e);if(a(i))return _e(e,t);n=t.next()}}(n,i[Symbol.iterator]())}async function _e(e,t){const n=await e;let i=t.next();for(;!0!==i.done;)await i.value(n),i=t.next()}function et(e,t){const n=function(e,t){if(t.type===c.Instance){const n=e.getClassMetadata(t.implementationType),i=t.cache.value;return a(i)?i.then((e=>Ye(n,e))):Ye(n,i)}}(e,t);return void 0===n?tt(e,t):n.then((()=>tt(e,t)))}function tt(e,t){const n=t.cache;return a(n.value)?n.value.then((n=>nt(e,t,n))):nt(e,t,n.value)}function nt(e,t,n){let i;if(void 0!==t.onDeactivation){i=(0,t.onDeactivation)(n)}return void 0===i?Ze(e,t.serviceIdentifier,n):i.then((()=>Ze(e,t.serviceIdentifier,n)))}function it(e,t){if(void 0===t)return;const n=function(e){const t=[];for(const n of e)Xe(n)&&n.scope===s.Singleton&&n.cache.isRight&&t.push(n);return t}(t),i=[];for(const t of n){const n=et(e,t);void 0!==n&&i.push(n)}return i.length>0?Promise.all(i).then((()=>{})):void 0}function ot(e,t){const n=e.getBindingsFromModule(t);return it(e,n)}function rt(e,t){const n=e.getBindings(t);return it(e,n)}export{g as ActivationsService,m as BindingService,C as ClassElementMetadataKind,h as DeactivationsService,Ce as PlanResultCacheService,oe as ResolvedValueElementMetadataKind,s as bindingScopeValues,c as bindingTypeValues,v as decorate,S as getClassMetadata,O as inject,H as injectFromBase,K as injectable,J as multiInject,W as named,Y as optional,he as plan,Z as postConstruct,_ as preDestroy,Le as resolve,ot as resolveModuleDeactivations,rt as resolveServiceDeactivations,ee as tagged,ie as unmanaged};
|
|
1
|
+
import{getOwnReflectMetadata as e,updateOwnReflectMetadata as t,setReflectMetadata as n}from"@inversifyjs/reflect-metadata-utils";import{getBaseType as i}from"@inversifyjs/prototype-utils";import{stringifyServiceIdentifier as o,LazyServiceIdentifier as r,isPromise as a}from"@inversifyjs/common";const s={Request:"Request",Singleton:"Singleton",Transient:"Transient"},c={ConstantValue:"ConstantValue",DynamicValue:"DynamicValue",Factory:"Factory",Instance:"Instance",Provider:"Provider",ResolvedValue:"ResolvedValue",ServiceRedirection:"ServiceRedirection"};function*u(...e){for(const t of e)yield*t}class d{#e;#t;#n;constructor(e){this.#e=new Map,this.#t={};for(const t of Reflect.ownKeys(e))this.#t[t]=new Map;this.#n=e}add(e,t){this.#i(e).push(t);for(const n of Reflect.ownKeys(t))this.#o(n,t[n]).push(e)}clone(){const e=Reflect.ownKeys(this.#n),t=new d(this.#n);this.#r(this.#e,t.#e);for(const n of e)this.#r(this.#t[n],t.#t[n]);return t}get(e,t){return this.#t[e].get(t)}getAllKeys(e){return this.#t[e].keys()}removeByRelation(e,t){const n=this.get(e,t);if(void 0===n)return;const i=new Set(n);for(const n of i){const i=this.#e.get(n);if(void 0===i)throw new Error("Expecting model relation, none found");for(const o of i)o[e]===t&&this.#a(n,o);this.#e.delete(n)}}#i(e){let t=this.#e.get(e);return void 0===t&&(t=[],this.#e.set(e,t)),t}#o(e,t){let n=this.#t[e].get(t);return void 0===n&&(n=[],this.#t[e].set(t,n)),n}#r(e,t){for(const[n,i]of e)t.set(n,[...i])}#a(e,t){for(const n of Reflect.ownKeys(t))this.#s(e,n,t[n])}#s(e,t,n){const i=this.#t[t].get(n);if(void 0!==i){const o=i.indexOf(e);-1!==o&&i.splice(o,1),0===i.length&&this.#t[t].delete(n)}}}var l,p,f;!function(e){e.moduleId="moduleId",e.serviceId="serviceId"}(l||(l={}));class g{#c;#u;constructor(e,t){this.#c=t??new d({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#u=e}static build(e){return new g(e)}add(e,t){this.#c.add(e,t)}clone(){return new g(this.#u,this.#c.clone())}get(e){const t=[],n=this.#c.get(l.serviceId,e);void 0!==n&&t.push(n);const i=this.#u?.get(e);if(void 0!==i&&t.push(i),0!==t.length)return u(...t)}removeAllByModuleId(e){this.#c.removeByRelation(l.moduleId,e)}removeAllByServiceId(e){this.#c.removeByRelation(l.serviceId,e)}}!function(e){e.moduleId="moduleId",e.serviceId="serviceId"}(p||(p={}));class m{#d;#u;constructor(e,t){this.#d=t??new d({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#u=e}static build(e){return new m(e)}clone(){return new m(this.#u,this.#d.clone())}get(e){return this.getNonParentBindings(e)??this.#u?.get(e)}getNonParentBindings(e){return this.#d.get(p.serviceId,e)}getNonParentBoundServices(){return this.#d.getAllKeys(p.serviceId)}getByModuleId(e){return this.#d.get(p.moduleId,e)??this.#u?.getByModuleId(e)}removeAllByModuleId(e){this.#d.removeByRelation(p.moduleId,e)}removeAllByServiceId(e){this.#d.removeByRelation(p.serviceId,e)}set(e){const t={[p.serviceId]:e.serviceIdentifier};void 0!==e.moduleId&&(t[p.moduleId]=e.moduleId),this.#d.add(e,t)}}!function(e){e.moduleId="moduleId",e.serviceId="serviceId"}(f||(f={}));class h{#l;#u;constructor(e,t){this.#l=t??new d({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#u=e}static build(e){return new h(e)}add(e,t){this.#l.add(e,t)}clone(){return new h(this.#u,this.#l.clone())}get(e){const t=[],n=this.#l.get(f.serviceId,e);void 0!==n&&t.push(n);const i=this.#u?.get(e);if(void 0!==i&&t.push(i),0!==t.length)return u(...t)}removeAllByModuleId(e){this.#l.removeByRelation(f.moduleId,e)}removeAllByServiceId(e){this.#l.removeByRelation(f.serviceId,e)}}function v(e,t,n){const i=Array.isArray(e)?e:[e];if(void 0!==n)if("number"!=typeof n)Reflect.decorate(i,t.prototype,n);else for(const e of i)e(t,void 0,n);else Reflect.decorate(i,t)}const y="@inversifyjs/core/classMetadataReflectKey";function M(){return{constructorArguments:[],lifecycle:{postConstructMethodName:void 0,preDestroyMethodName:void 0},properties:new Map,scope:void 0}}const I="@inversifyjs/core/pendingClassMetadataCountReflectKey";const w=Symbol.for("@inversifyjs/core/InversifyCoreError");class b extends Error{[w];kind;constructor(e,t,n){super(t,n),this[w]=!0,this.kind=e}static is(e){return"object"==typeof e&&null!==e&&!0===e[w]}static isErrorOfKind(e,t){return b.is(e)&&e.kind===t}}var j,T,C;function S(t){const n=e(t,y)??M();if(!function(t){const n=e(t,I);return void 0!==n&&0!==n}(t))return function(e,t){const n=[];if(t.length<e.length)throw new b(j.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}". "${e.name}" constructor requires at least ${e.length.toString()} arguments, found ${t.length.toString()} instead.\nAre you using @inject, @multiInject or @unmanaged decorators in every non optional constructor argument?\n\nIf you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`);for(let e=0;e<t.length;++e)void 0===t[e]&&n.push(e);if(n.length>0)throw new b(j.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}" at constructor indexes "${n.join('", "')}".\n\nAre you using @inject, @multiInject or @unmanaged decorators at those indexes?\n\nIf you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`)}(t,n.constructorArguments),n;!function(e,t){const n=[];for(let i=0;i<t.constructorArguments.length;++i){const o=t.constructorArguments[i];void 0!==o&&o.kind!==T.unknown||n.push(` - Missing or incomplete metadata for type "${e.name}" at constructor argument with index ${i.toString()}.\nEvery constructor parameter must be decorated either with @inject, @multiInject or @unmanaged decorator.`)}for(const[i,o]of t.properties)o.kind===T.unknown&&n.push(` - Missing or incomplete metadata for type "${e.name}" at property "${i.toString()}".\nThis property must be decorated either with @inject or @multiInject decorator.`);if(0===n.length)throw new b(j.unknown,`Unexpected class metadata for type "${e.name}" with uncompletion traces.\nThis might be caused by one of the following reasons:\n\n1. A third party library is targeting inversify reflection metadata.\n2. A bug is causing the issue. Consider submiting an issue to fix it.`);throw new b(j.missingInjectionDecorator,`Invalid class metadata at type ${e.name}:\n\n${n.join("\n\n")}`)}(t,n)}function A(){return 0}function $(e){return n=>{void 0!==n&&n.kind===T.unknown&&t(e,I,A,(e=>e-1))}}function x(e,t){return(...n)=>i=>{if(void 0===i)return e(...n);if(i.kind===C.unmanaged)throw new b(j.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found");return t(i,...n)}}function B(e){if(e.kind!==T.unknown&&!0!==e.isFromTypescriptParamType)throw new b(j.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found")}!function(e){e[e.injectionDecoratorConflict=0]="injectionDecoratorConflict",e[e.missingInjectionDecorator=1]="missingInjectionDecorator",e[e.planning=2]="planning",e[e.resolution=3]="resolution",e[e.unknown=4]="unknown"}(j||(j={})),function(e){e[e.unknown=32]="unknown"}(T||(T={})),function(e){e[e.multipleInjection=0]="multipleInjection",e[e.singleInjection=1]="singleInjection",e[e.unmanaged=2]="unmanaged"}(C||(C={}));const R=x((function(e,t){return{kind:e,name:void 0,optional:!1,tags:new Map,value:t}}),(function(e,t,n){return B(e),{...e,kind:t,value:n}}));function k(e,t){return n=>{const i=n.properties.get(t);return n.properties.set(t,e(i)),n}}var P;function D(e,t,n,i){if(b.isErrorOfKind(i,j.injectionDecoratorConflict)){const o=function(e,t,n){if(void 0===n){if(void 0===t)throw new b(j.unknown,"Unexpected undefined property and index values");return{kind:P.property,property:t,targetClass:e.constructor}}return"number"==typeof n?{index:n,kind:P.parameter,targetClass:e}:{kind:P.method,method:t,targetClass:e}}(e,t,n);throw new b(j.injectionDecoratorConflict,`Unexpected injection error.\n\nCause:\n\n${i.message}\n\nDetails\n\n${function(e){switch(e.kind){case P.method:return`[class: "${e.targetClass.name}", method: "${e.method.toString()}"]`;case P.parameter:return`[class: "${e.targetClass.name}", index: "${e.index.toString()}"]`;case P.property:return`[class: "${e.targetClass.name}", property: "${e.property.toString()}"]`}}(o)}`,{cause:i})}throw i}function V(e,n){return(i,o,r)=>{try{void 0===r?function(e,n){const i=F(e,n);return(e,n)=>{t(e.constructor,y,M,k(i(e),n))}}(e,n)(i,o):"number"==typeof r?function(e,n){const i=F(e,n);return(e,n,o)=>{if(!function(e,t){return"function"==typeof e&&void 0===t}(e,n))throw new b(j.injectionDecoratorConflict,`Found an @inject decorator in a non constructor parameter.\nFound @inject decorator at method "${n?.toString()??""}" at class "${e.constructor.name}"`);t(e,y,M,function(e,t){return n=>{const i=n.constructorArguments[t];return n.constructorArguments[t]=e(i),n}}(i(e),o))}}(e,n)(i,o,r):function(e,n){const i=F(e,n);return(e,n,o)=>{if(!function(e){return void 0!==e.set}(o))throw new b(j.injectionDecoratorConflict,`Found an @inject decorator in a non setter property method.\nFound @inject decorator at method "${n.toString()}" at class "${e.constructor.name}"`);t(e.constructor,y,M,k(i(e),n))}}(e,n)(i,o,r)}catch(e){D(i,o,r,e)}}}function F(e,t){return n=>{const i=t(n);return t=>(i(t),e(t))}}function O(e){return V(R(C.singleInjection,e),$)}!function(e){e[e.method=0]="method",e[e.parameter=1]="parameter",e[e.property=2]="property"}(P||(P={}));const N="@inversifyjs/core/classIsInjectableFlagReflectKey";const E=[Array,BigInt,Boolean,Function,Number,Object,String];function U(n){const i=e(n,"design:paramtypes");void 0!==i&&t(n,y,M,function(e){return t=>(e.forEach(((e,n)=>{var i;void 0!==t.constructorArguments[n]||(i=e,E.includes(i))||(t.constructorArguments[n]=function(e){return{isFromTypescriptParamType:!0,kind:C.singleInjection,name:void 0,optional:!1,tags:new Map,value:e}}(e))})),t)}(i))}function K(i){return o=>{!function(t){if(void 0!==e(t,N))throw new b(j.injectionDecoratorConflict,`Cannot apply @injectable decorator multiple times at class "${t.name}"`);n(t,N,!0)}(o),U(o),void 0!==i&&t(o,y,M,(e=>({...e,scope:i})))}}function q(e,t,n){let i;return e.extendConstructorArguments??!0?(i=[...t.constructorArguments],n.constructorArguments.map(((e,t)=>{i[t]=e}))):i=n.constructorArguments,i}function z(e,t,n){let i;return i=e.extendProperties??!0?new Map(u(t.properties,n.properties)):n.properties,i}function G(e){return n=>{const i=S(e.type);t(n,y,M,function(e,t){const n=n=>({constructorArguments:q(e,t,n),lifecycle:n.lifecycle,properties:z(e,t,n),scope:n.scope});return n}(e,i))}}function H(e){return t=>{const n=i(t);if(void 0===n)throw new b(j.injectionDecoratorConflict,`Expected base type for type "${t.name}", none found.`);G({...e,type:n})(t)}}function J(e){return V(R(C.multipleInjection,e),$)}function L(e){return n=>{void 0===n&&t(e,I,A,(e=>e+1))}}function Q(e){return t=>{const n=t??{kind:T.unknown,name:void 0,optional:!1,tags:new Map};if(n.kind===C.unmanaged)throw new b(j.injectionDecoratorConflict,"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections");return e(n)}}function W(e){const t=Q(function(e){return t=>{if(void 0!==t.name)throw new b(j.injectionDecoratorConflict,"Unexpected duplicated named decorator");return t.name=e,t}}(e));return V(t,L)}function X(e){if(e.optional)throw new b(j.injectionDecoratorConflict,"Unexpected duplicated optional decorator");return e.optional=!0,e}function Y(){return V(Q(X),L)}function Z(){return(e,n,i)=>{try{t(e.constructor,y,M,(o=n,e=>{if(void 0!==e.lifecycle.postConstructMethodName)throw new b(j.injectionDecoratorConflict,"Unexpected duplicated postConstruct decorator");return e.lifecycle.postConstructMethodName=o,e}))}catch(t){D(e,n,void 0,t)}var o}}function _(){return(e,n,i)=>{try{t(e.constructor,y,M,(o=n,e=>{if(void 0!==e.lifecycle.preDestroyMethodName)throw new b(j.injectionDecoratorConflict,"Unexpected duplicated preDestroy decorator");return e.lifecycle.preDestroyMethodName=o,e}))}catch(t){D(e,n,void 0,t)}var o}}function ee(e,t){const n=Q(function(e,t){return n=>{if(n.tags.has(e))throw new b(j.injectionDecoratorConflict,"Unexpected duplicated tag decorator with existing tag");return n.tags.set(e,t),n}}(e,t));return V(n,L)}function te(){return{kind:C.unmanaged}}const ne=x(te,(function(e){if(B(e),function(e){return void 0!==e.name||e.optional||e.tags.size>0}(e))throw new b(j.injectionDecoratorConflict,"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections");return te()}));function ie(){return V(ne(),$)}var oe;!function(e){e[e.multipleInjection=0]="multipleInjection",e[e.singleInjection=1]="singleInjection"}(oe||(oe={}));class re{#p;constructor(e){this.#p=e}get name(){return this.#p.elem.name}get serviceIdentifier(){return this.#p.elem.serviceIdentifier}get tags(){return this.#p.elem.tags}getAncestor(){if(void 0!==this.#p.previous)return new re(this.#p.previous)}}class ae{last;constructor(e){this.last=e}concat(e){return new ae({elem:e,previous:this.last})}[Symbol.iterator](){let e=this.last;return{next:()=>{if(void 0===e)return{done:!0,value:void 0};const t=e.elem;return e=e.previous,{done:!1,value:t}}}}}function se(e,t){e.servicesBranch.has(t)&&function(e,t){const n=(i=[...e.servicesBranch,t],[...i].map(o).join(" -> "));var i;throw new b(j.planning,`Circular dependency found: ${n}`)}(e,t),e.servicesBranch.add(t)}function ce(e,t,n){const i=n?.customServiceIdentifier??t.serviceIdentifier,o=[...e.getBindings(i)??[]].filter((e=>e.isSatisfiedBy(t)));if(0===o.length&&void 0!==e.autobindOptions&&"function"==typeof i){const t=function(e,t){return{cache:{isRight:!1,value:void 0},id:0,implementationType:t,isSatisfiedBy:()=>!0,moduleId:void 0,onActivation:void 0,onDeactivation:void 0,scope:e.scope,serviceIdentifier:t,type:c.Instance}}(e.autobindOptions,i);e.setBinding(t),o.push(t)}return o}function ue(e){return void 0!==e.redirections}function de(e,t,n,i){let r,a;ue(n)?(r=n.binding.targetServiceIdentifier,a=n.binding.serviceIdentifier):(r=n.serviceIdentifier,a=n.parent?.binding.serviceIdentifier),Array.isArray(e)?function(e,t,n,i,r){if(0!==e.length){const t=`Ambiguous bindings found for service: "${o(n)}".\n\nRegistered bindings:\n\n${e.map((e=>function(e){switch(e.type){case c.Instance:return`[ type: "${e.type}", serviceIdentifier: "${o(e.serviceIdentifier)}", scope: "${e.scope}", implementationType: "${e.implementationType.name}" ]`;case c.ServiceRedirection:return`[ type: "${e.type}", serviceIdentifier: "${o(e.serviceIdentifier)}", redirection: "${o(e.targetServiceIdentifier)}" ]`;default:return`[ type: "${e.type}", serviceIdentifier: "${o(e.serviceIdentifier)}", scope: "${e.scope}" ]`}}(e.binding))).join("\n")}\n\nTrying to resolve bindings for "${pe(n,i)}".\n\n${fe(r)}`;throw new b(j.planning,t)}t||le(n,i,r)}(e,t,r,a,i):function(e,t,n,i,o){if(void 0!==e||t)return;le(n,i,o)}(e,t,r,a,i)}function le(e,t,n){const i=`No bindings found for service: "${o(e)}".\n\nTrying to resolve bindings for "${pe(e,t)}".\n\n${fe(n)}`;throw new b(j.planning,i)}function pe(e,t){return void 0===t?`${o(e)} (Root service)`:o(t)}function fe(e){const t=0===e.tags.size?"":`\n- tags:\n - ${[...e.tags.keys()].map((e=>e.toString())).join("\n - ")}`;return`Binding constraints:\n- service identifier: ${o(e.serviceIdentifier)}\n- name: ${e.name?.toString()??"-"}${t}`}function ge(e,t,n){if(1!==e.redirections.length)de(e.redirections,t,e,n);else{const[i]=e.redirections;ue(i)&&ge(i,t,n)}}function me(e,t,n){if(Array.isArray(e.bindings)&&1===e.bindings.length){const[i]=e.bindings;ue(i)&&ge(i,t,n)}else de(e.bindings,t,e,n)}function he(e){const t=new Map;void 0!==e.rootConstraints.tag&&t.set(e.rootConstraints.tag.key,e.rootConstraints.tag.value);const n=new ae({elem:{name:e.rootConstraints.name,serviceIdentifier:e.rootConstraints.serviceIdentifier,tags:t},previous:void 0}),i=new re(n.last),o=ce(e,i),r=[],a={bindings:r,parent:void 0,serviceIdentifier:e.rootConstraints.serviceIdentifier};if(r.push(...we(e,n,o,a)),!e.rootConstraints.isMultiple){me(a,e.rootConstraints.isOptional??!1,i);const[t]=r;a.bindings=t}return{tree:{root:a}}}function ve(e,t,n,i){const o={binding:t,classMetadata:e.getClassMetadata(t.implementationType),constructorParams:[],parent:i,propertyParams:new Map};return je({autobindOptions:e.autobindOptions,getBindings:e.getBindings,getClassMetadata:e.getClassMetadata,node:o,servicesBranch:e.servicesBranch,setBinding:e.setBinding},n)}function ye(e,t,n){if(n.kind===C.unmanaged)return;const i=r.is(n.value)?n.value.unwrap():n.value,o=t.concat({name:n.name,serviceIdentifier:i,tags:n.tags}),a=new re(o.last),s=ce(e,a),c=[],u={bindings:c,parent:e.node,serviceIdentifier:i};if(c.push(...we(e,o,s,u)),n.kind===C.singleInjection){me(u,n.optional,a);const[e]=c;u.bindings=e}return u}function Me(e,t,n){const i=r.is(n.value)?n.value.unwrap():n.value,o=t.concat({name:n.name,serviceIdentifier:i,tags:n.tags}),a=new re(o.last),s=ce(e,a),c=[],u={bindings:c,parent:e.node,serviceIdentifier:i};if(c.push(...we(e,o,s,u)),n.kind===oe.singleInjection){me(u,n.optional,a);const[e]=c;u.bindings=e}return u}function Ie(e,t,n,i){const o={binding:t,params:[],parent:i};return je({autobindOptions:e.autobindOptions,getBindings:e.getBindings,getClassMetadata:e.getClassMetadata,node:o,servicesBranch:e.servicesBranch,setBinding:e.setBinding},n)}function we(e,t,n,i){const o=ue(i)?i.binding.targetServiceIdentifier:i.serviceIdentifier;se(e,o);const r=[];for(const o of n)switch(o.type){case c.Instance:r.push(ve(e,o,t,i));break;case c.ResolvedValue:r.push(Ie(e,o,t,i));break;case c.ServiceRedirection:{const n=be(e,t,o,i);r.push(n);break}default:r.push({binding:o,parent:i})}return e.servicesBranch.delete(o),r}function be(e,t,n,i){const o={binding:n,parent:i,redirections:[]},r=ce(e,new re(t.last),{customServiceIdentifier:n.targetServiceIdentifier});return o.redirections.push(...we(e,t,r,o)),o}function je(e,t){return e.node.binding.type===c.Instance?function(e,t,n){const i=t.classMetadata;for(const[o,r]of i.constructorArguments.entries())t.constructorParams[o]=ye(e,n,r);for(const[o,r]of i.properties){const i=ye(e,n,r);void 0!==i&&t.propertyParams.set(o,i)}return e.node}(e,e.node,t):function(e,t,n){const i=t.binding.metadata;for(const[o,r]of i.arguments.entries())t.params[o]=Me(e,n,r);return e.node}(e,e.node,t)}var Te;!function(e){e[e.singleMandatory=0]="singleMandatory",e[e.singleOptional=1]="singleOptional",e[e.multipleMandatory=2]="multipleMandatory",e[e.multipleOptional=3]="multipleOptional",e[e.length=4]="length"}(Te||(Te={}));class Ce{#f;#g;#m;#h;#v;constructor(){this.#f=this.#y(),this.#g=this.#y(),this.#h=this.#y(),this.#m=this.#y(),this.#v=[]}clearCache(){for(const e of this.#M())e.clear();for(const e of this.#v)e.clearCache()}get(e){return void 0===e.name?void 0===e.tag?this.#I(this.#f,e).get(e.serviceIdentifier):this.#I(this.#m,e).get(e.serviceIdentifier)?.get(e.tag.key)?.get(e.tag.value):void 0===e.tag?this.#I(this.#g,e).get(e.serviceIdentifier)?.get(e.name):this.#I(this.#h,e).get(e.serviceIdentifier)?.get(e.name)?.get(e.tag.key)?.get(e.tag.value)}set(e,t){void 0===e.name?void 0===e.tag?this.#I(this.#f,e).set(e.serviceIdentifier,t):this.#w(this.#w(this.#I(this.#m,e),e.serviceIdentifier),e.tag.key).set(e.tag.value,t):void 0===e.tag?this.#w(this.#I(this.#g,e),e.serviceIdentifier).set(e.name,t):this.#w(this.#w(this.#w(this.#I(this.#h,e),e.serviceIdentifier),e.name),e.tag.key).set(e.tag.value,t)}subscribe(e){this.#v.push(e)}#y(){const e=new Array(Te.length);for(let t=0;t<e.length;++t)e[t]=new Map;return e}#w(e,t){let n=e.get(t);return void 0===n&&(n=new Map,e.set(t,n)),n}#I(e,t){return e[this.#b(t)]}#M(){return[...this.#f,...this.#g,...this.#h,...this.#m]}#b(e){return e.isMultiple?!0===e.optional?Te.multipleOptional:Te.multipleMandatory:!0===e.optional?Te.singleOptional:Te.singleMandatory}}function Se(e,t){return a(t)?t.then((t=>Ae(e,t))):Ae(e,t)}function Ae(e,t){return e.cache={isRight:!0,value:t},t}function $e(e,t,n){const i=e.getActivations(t);return void 0===i?n:a(n)?xe(e,n,i[Symbol.iterator]()):function(e,t,n){let i=t,o=n.next();for(;!0!==o.done;){const t=o.value(e.context,i);if(a(t))return xe(e,t,n);i=t,o=n.next()}return i}(e,n,i[Symbol.iterator]())}async function xe(e,t,n){let i=await t,o=n.next();for(;!0!==o.done;)i=await o.value(e.context,i),o=n.next();return i}function Be(e,t,n){let i=n;if(void 0!==t.onActivation){const n=t.onActivation;i=a(i)?i.then((t=>n(e.context,t))):n(e.context,i)}return $e(e,t.serviceIdentifier,i)}function Re(e){return(t,n)=>{if(n.cache.isRight)return n.cache.value;return Se(n,Be(t,n,e(t,n)))}}const ke=Re((function(e,t){return t.value}));function Pe(e){return e}function De(e,t){return(n,i)=>{const o=e(i);switch(o.scope){case s.Singleton:if(o.cache.isRight)return o.cache.value;return Se(o,Be(n,o,t(n,i)));case s.Request:{if(n.requestScopeCache.has(o.id))return n.requestScopeCache.get(o.id);const e=Be(n,o,t(n,i));return n.requestScopeCache.set(o.id,e),e}case s.Transient:return Be(n,o,t(n,i))}}}const Ve=(e=>De(Pe,e))((function(e,t){return t.value(e.context)}));const Fe=Re((function(e,t){return t.factory(e.context)}));function Oe(e,t,n){const i=function(e,t,n){if(void 0===n)return;if(!(n in e))throw new b(j.resolution,`Expecting a "${n.toString()}" property when resolving "${t.implementationType.name}" class @postConstruct decorated method, none found.`);if("function"!=typeof e[n])throw new b(j.resolution,`Expecting a "${n.toString()}" method when resolving "${t.implementationType.name}" class @postConstruct decorated method, a non function property was found instead.`);{let i;try{i=e[n]()}catch(e){throw new b(j.resolution,`Unexpected error found when calling "${n.toString()}" @postConstruct decorated method on class "${t.implementationType.name}"`,{cause:e})}if(a(i))return async function(e,t,n){try{await n}catch(n){throw new b(j.resolution,`Unexpected error found when calling "${t.toString()}" @postConstruct decorated method on class "${e.implementationType.name}"`,{cause:n})}}(t,n,i)}}(e,t,n);return a(i)?i.then((()=>e)):e}function Ne(e){return(t,n,i)=>{const o=new i.binding.implementationType(...t),r=e(n,o,i);return a(r)?r.then((()=>Oe(o,i.binding,i.classMetadata.lifecycle.postConstructMethodName))):Oe(o,i.binding,i.classMetadata.lifecycle.postConstructMethodName)}}const Ee=Re((function(e,t){return t.provider(e.context)}));function Ue(e){return e.binding}function Ke(e){return e.binding}const qe=function(e){return(t,n,i)=>{const o=[];for(const[r,s]of i.propertyParams){const c=i.classMetadata.properties.get(r);if(void 0===c)throw new b(j.resolution,`Expecting metadata at property "${r.toString()}", none found`);c.kind!==C.unmanaged&&void 0!==s.bindings&&(n[r]=e(t,s),a(n[r])&&o.push((async()=>{n[r]=await n[r]})()))}if(o.length>0)return Promise.all(o).then((()=>{}))}}(Xe),ze=function(e){return function t(n,i){const o=[];for(const r of i.redirections)ue(r)?o.push(...t(n,r)):o.push(e(n,r));return o}}(We),Ge=function(e,t,n){return(i,o)=>{const r=e(i,o);return a(r)?t(r,i,o):n(r,i,o)}}(function(e){return(t,n)=>{const i=[];for(const o of n.constructorParams)void 0===o?i.push(void 0):i.push(e(t,o));return i.some(a)?Promise.all(i):i}}(Xe),function(e){return async(t,n,i)=>{const o=await t;return e(o,n,i)}}(Ne(qe)),Ne(qe)),He=function(e){return(t,n)=>{const i=e(t,n);return a(i)?i.then((e=>n.binding.factory(...e))):n.binding.factory(...i)}}(function(e){return(t,n)=>{const i=[];for(const o of n.params)i.push(e(t,o));return i.some(a)?Promise.all(i):i}}(Xe)),Je=(e=>De(Ue,e))(Ge),Le=(e=>De(Ke,e))(He);function Qe(e){return Xe(e,e.planResult.tree.root)}function We(e,t){switch(t.binding.type){case c.ConstantValue:return ke(e,t.binding);case c.DynamicValue:return Ve(e,t.binding);case c.Factory:return Fe(e,t.binding);case c.Instance:return Je(e,t);case c.Provider:return Ee(e,t.binding);case c.ResolvedValue:return Le(e,t)}}function Xe(e,t){if(void 0!==t.bindings)return Array.isArray(t.bindings)?function(e,t){const n=[];for(const i of t)ue(i)?n.push(...ze(e,i)):n.push(We(e,i));if(n.some(a))return Promise.all(n);return n}(e,t.bindings):function(e,t){if(ue(t)){const n=ze(e,t);if(1===n.length)return n[0];throw new b(j.resolution,"Unexpected multiple resolved values on single injection")}return We(e,t)}(e,t.bindings)}function Ye(e){return void 0!==e.scope}function Ze(e,t){if(void 0!==e.lifecycle.preDestroyMethodName&&"function"==typeof t[e.lifecycle.preDestroyMethodName])return t[e.lifecycle.preDestroyMethodName]()}function _e(e,t,n){const i=e.getDeactivations(t);if(void 0!==i)return a(n)?et(n,i[Symbol.iterator]()):function(e,t){let n=t.next();for(;!0!==n.done;){const i=n.value(e);if(a(i))return et(e,t);n=t.next()}}(n,i[Symbol.iterator]())}async function et(e,t){const n=await e;let i=t.next();for(;!0!==i.done;)await i.value(n),i=t.next()}function tt(e,t){const n=function(e,t){if(t.type===c.Instance){const n=e.getClassMetadata(t.implementationType),i=t.cache.value;return a(i)?i.then((e=>Ze(n,e))):Ze(n,i)}}(e,t);return void 0===n?nt(e,t):n.then((()=>nt(e,t)))}function nt(e,t){const n=t.cache;return a(n.value)?n.value.then((n=>it(e,t,n))):it(e,t,n.value)}function it(e,t,n){let i;if(void 0!==t.onDeactivation){i=(0,t.onDeactivation)(n)}return void 0===i?_e(e,t.serviceIdentifier,n):i.then((()=>_e(e,t.serviceIdentifier,n)))}function ot(e,t){if(void 0===t)return;const n=function(e){const t=[];for(const n of e)Ye(n)&&n.scope===s.Singleton&&n.cache.isRight&&t.push(n);return t}(t),i=[];for(const t of n){const n=tt(e,t);void 0!==n&&i.push(n)}return i.length>0?Promise.all(i).then((()=>{})):void 0}function rt(e,t){const n=e.getBindingsFromModule(t);return ot(e,n)}function at(e,t){const n=e.getBindings(t);return ot(e,n)}export{g as ActivationsService,m as BindingService,C as ClassElementMetadataKind,h as DeactivationsService,Ce as PlanResultCacheService,oe as ResolvedValueElementMetadataKind,s as bindingScopeValues,c as bindingTypeValues,v as decorate,S as getClassMetadata,O as inject,H as injectFromBase,K as injectable,J as multiInject,W as named,Y as optional,he as plan,Z as postConstruct,_ as preDestroy,Qe as resolve,rt as resolveModuleDeactivations,at as resolveServiceDeactivations,ee as tagged,ie as unmanaged};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|