@inversifyjs/core 3.0.2 → 3.2.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 +27 -0
- package/lib/cjs/common/models/OneToManyMapStar.d.ts.map +1 -1
- package/lib/cjs/common/models/OneToManyMapStar.js +15 -14
- package/lib/cjs/common/models/OneToManyMapStar.js.map +1 -1
- package/lib/cjs/decorator/calculations/getDecoratorInfo.d.ts +1 -0
- package/lib/cjs/decorator/calculations/getDecoratorInfo.d.ts.map +1 -1
- package/lib/cjs/decorator/calculations/getDecoratorInfo.js +12 -4
- package/lib/cjs/decorator/calculations/getDecoratorInfo.js.map +1 -1
- package/lib/cjs/decorator/calculations/stringifyDecoratorInfo.d.ts.map +1 -1
- package/lib/cjs/decorator/calculations/stringifyDecoratorInfo.js +2 -0
- package/lib/cjs/decorator/calculations/stringifyDecoratorInfo.js.map +1 -1
- package/lib/cjs/decorator/models/DecoratorInfo.d.ts +2 -1
- package/lib/cjs/decorator/models/DecoratorInfo.d.ts.map +1 -1
- package/lib/cjs/decorator/models/DecoratorInfoKind.d.ts +3 -2
- package/lib/cjs/decorator/models/DecoratorInfoKind.d.ts.map +1 -1
- package/lib/cjs/decorator/models/DecoratorInfoKind.js +3 -2
- package/lib/cjs/decorator/models/DecoratorInfoKind.js.map +1 -1
- package/lib/cjs/decorator/models/MethodDecoratorInfo.d.ts +6 -0
- package/lib/cjs/decorator/models/MethodDecoratorInfo.d.ts.map +1 -0
- package/lib/cjs/decorator/models/MethodDecoratorInfo.js +3 -0
- package/lib/cjs/decorator/models/MethodDecoratorInfo.js.map +1 -0
- package/lib/cjs/metadata/calculations/getExtendedConstructorArguments.js +1 -1
- package/lib/cjs/metadata/calculations/getExtendedConstructorArguments.js.map +1 -1
- package/lib/cjs/metadata/calculations/getExtendedProperties.js +1 -1
- package/lib/cjs/metadata/calculations/getExtendedProperties.js.map +1 -1
- package/lib/cjs/metadata/calculations/handleInjectionError.d.ts +1 -1
- package/lib/cjs/metadata/calculations/handleInjectionError.d.ts.map +1 -1
- package/lib/cjs/metadata/calculations/handleInjectionError.js.map +1 -1
- package/lib/cjs/metadata/decorators/inject.d.ts +1 -1
- package/lib/cjs/metadata/decorators/inject.d.ts.map +1 -1
- package/lib/cjs/metadata/decorators/inject.js +1 -14
- package/lib/cjs/metadata/decorators/inject.js.map +1 -1
- package/lib/cjs/metadata/decorators/injectBase.d.ts +2 -1
- package/lib/cjs/metadata/decorators/injectBase.d.ts.map +1 -1
- package/lib/cjs/metadata/decorators/injectBase.js +34 -6
- package/lib/cjs/metadata/decorators/injectBase.js.map +1 -1
- package/lib/cjs/metadata/decorators/multiInject.d.ts +1 -1
- package/lib/cjs/metadata/decorators/multiInject.d.ts.map +1 -1
- package/lib/cjs/metadata/decorators/multiInject.js +1 -14
- package/lib/cjs/metadata/decorators/multiInject.js.map +1 -1
- package/lib/cjs/metadata/decorators/named.d.ts +1 -1
- package/lib/cjs/metadata/decorators/named.d.ts.map +1 -1
- package/lib/cjs/metadata/decorators/named.js +1 -14
- package/lib/cjs/metadata/decorators/named.js.map +1 -1
- package/lib/cjs/metadata/decorators/optional.d.ts +1 -1
- package/lib/cjs/metadata/decorators/optional.d.ts.map +1 -1
- package/lib/cjs/metadata/decorators/optional.js +1 -14
- package/lib/cjs/metadata/decorators/optional.js.map +1 -1
- package/lib/cjs/metadata/decorators/tagged.d.ts +1 -1
- package/lib/cjs/metadata/decorators/tagged.d.ts.map +1 -1
- package/lib/cjs/metadata/decorators/tagged.js +1 -14
- package/lib/cjs/metadata/decorators/tagged.js.map +1 -1
- package/lib/cjs/metadata/decorators/unmanaged.d.ts +1 -1
- package/lib/cjs/metadata/decorators/unmanaged.d.ts.map +1 -1
- package/lib/cjs/metadata/decorators/unmanaged.js +1 -14
- package/lib/cjs/metadata/decorators/unmanaged.js.map +1 -1
- package/lib/cjs/planning/calculations/buildFilteredServiceBindings.d.ts +2 -3
- package/lib/cjs/planning/calculations/buildFilteredServiceBindings.d.ts.map +1 -1
- package/lib/cjs/planning/calculations/buildFilteredServiceBindings.js +1 -3
- package/lib/cjs/planning/calculations/buildFilteredServiceBindings.js.map +1 -1
- package/lib/cjs/planning/calculations/checkPlanServiceRedirectionBindingNodeSingleInjectionBindings.d.ts +2 -1
- 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 -1
- 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 +9 -5
- package/lib/cjs/planning/calculations/plan.js.map +1 -1
- package/lib/cjs/planning/calculations/throwErrorWhenUnexpectedBindingsAmountFound.d.ts +2 -1
- package/lib/cjs/planning/calculations/throwErrorWhenUnexpectedBindingsAmountFound.d.ts.map +1 -1
- package/lib/cjs/planning/calculations/throwErrorWhenUnexpectedBindingsAmountFound.js +24 -10
- package/lib/cjs/planning/calculations/throwErrorWhenUnexpectedBindingsAmountFound.js.map +1 -1
- package/lib/esm/index.d.ts +6 -6
- package/lib/esm/index.js +1 -1
- package/lib/esm/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optional.js","sourceRoot":"","sources":["../../../../src/metadata/decorators/optional.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"optional.js","sourceRoot":"","sources":["../../../../src/metadata/decorators/optional.ts"],"names":[],"mappings":";;AAQA,4BAWC;AAnBD,sGAAmG;AACnG,8EAA2E;AAC3E,6JAA0J;AAI1J,6CAA0C;AAE1C,SAAgB,QAAQ;IAGtB,MAAM,cAAc,GAGlB,IAAA,yHAA2D,EACzD,+CAAsB,CACvB,CAAC;IAEJ,OAAO,IAAA,uBAAU,EAAC,cAAc,EAAE,uEAAkC,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { MetadataTag } from '../models/MetadataTag';
|
|
2
|
-
export declare function tagged(key: MetadataTag, value: unknown): ParameterDecorator & PropertyDecorator;
|
|
2
|
+
export declare function tagged(key: MetadataTag, value: unknown): MethodDecorator & ParameterDecorator & PropertyDecorator;
|
|
3
3
|
//# sourceMappingURL=tagged.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tagged.d.ts","sourceRoot":"","sources":["../../../../src/metadata/decorators/tagged.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tagged.d.ts","sourceRoot":"","sources":["../../../../src/metadata/decorators/tagged.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,wBAAgB,MAAM,CACpB,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,OAAO,GACb,eAAe,GAAG,kBAAkB,GAAG,iBAAiB,CAS1D"}
|
|
@@ -4,22 +4,9 @@ exports.tagged = tagged;
|
|
|
4
4
|
const incrementPendingClassMetadataCount_1 = require("../actions/incrementPendingClassMetadataCount");
|
|
5
5
|
const updateMetadataTag_1 = require("../actions/updateMetadataTag");
|
|
6
6
|
const buildMaybeClassElementMetadataFromMaybeClassElementMetadata_1 = require("../calculations/buildMaybeClassElementMetadataFromMaybeClassElementMetadata");
|
|
7
|
-
const handleInjectionError_1 = require("../calculations/handleInjectionError");
|
|
8
7
|
const injectBase_1 = require("./injectBase");
|
|
9
8
|
function tagged(key, value) {
|
|
10
9
|
const updateMetadata = (0, buildMaybeClassElementMetadataFromMaybeClassElementMetadata_1.buildMaybeClassElementMetadataFromMaybeClassElementMetadata)((0, updateMetadataTag_1.updateMetadataTag)(key, value));
|
|
11
|
-
return (
|
|
12
|
-
try {
|
|
13
|
-
if (parameterIndex === undefined) {
|
|
14
|
-
(0, injectBase_1.injectBase)(updateMetadata, incrementPendingClassMetadataCount_1.incrementPendingClassMetadataCount)(target, propertyKey);
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
(0, injectBase_1.injectBase)(updateMetadata, incrementPendingClassMetadataCount_1.incrementPendingClassMetadataCount)(target, propertyKey, parameterIndex);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
(0, handleInjectionError_1.handleInjectionError)(target, propertyKey, parameterIndex, error);
|
|
22
|
-
}
|
|
23
|
-
};
|
|
10
|
+
return (0, injectBase_1.injectBase)(updateMetadata, incrementPendingClassMetadataCount_1.incrementPendingClassMetadataCount);
|
|
24
11
|
}
|
|
25
12
|
//# sourceMappingURL=tagged.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tagged.js","sourceRoot":"","sources":["../../../../src/metadata/decorators/tagged.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"tagged.js","sourceRoot":"","sources":["../../../../src/metadata/decorators/tagged.ts"],"names":[],"mappings":";;AASA,wBAYC;AArBD,sGAAmG;AACnG,oEAAiE;AACjE,6JAA0J;AAK1J,6CAA0C;AAE1C,SAAgB,MAAM,CACpB,GAAgB,EAChB,KAAc;IAEd,MAAM,cAAc,GAGlB,IAAA,yHAA2D,EACzD,IAAA,qCAAiB,EAAC,GAAG,EAAE,KAAK,CAAC,CAC9B,CAAC;IAEJ,OAAO,IAAA,uBAAU,EAAC,cAAc,EAAE,uEAAkC,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function unmanaged(): ParameterDecorator & PropertyDecorator;
|
|
1
|
+
export declare function unmanaged(): MethodDecorator & ParameterDecorator & PropertyDecorator;
|
|
2
2
|
//# sourceMappingURL=unmanaged.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unmanaged.d.ts","sourceRoot":"","sources":["../../../../src/metadata/decorators/unmanaged.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"unmanaged.d.ts","sourceRoot":"","sources":["../../../../src/metadata/decorators/unmanaged.ts"],"names":[],"mappings":"AAMA,wBAAgB,SAAS,IAAI,eAAe,GAC1C,kBAAkB,GAClB,iBAAiB,CAOlB"}
|
|
@@ -3,22 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.unmanaged = unmanaged;
|
|
4
4
|
const decrementPendingClassMetadataCount_1 = require("../actions/decrementPendingClassMetadataCount");
|
|
5
5
|
const buildUnmanagedMetadataFromMaybeClassElementMetadata_1 = require("../calculations/buildUnmanagedMetadataFromMaybeClassElementMetadata");
|
|
6
|
-
const handleInjectionError_1 = require("../calculations/handleInjectionError");
|
|
7
6
|
const injectBase_1 = require("./injectBase");
|
|
8
7
|
function unmanaged() {
|
|
9
8
|
const updateMetadata = (0, buildUnmanagedMetadataFromMaybeClassElementMetadata_1.buildUnmanagedMetadataFromMaybeClassElementMetadata)();
|
|
10
|
-
return (
|
|
11
|
-
try {
|
|
12
|
-
if (parameterIndex === undefined) {
|
|
13
|
-
(0, injectBase_1.injectBase)(updateMetadata, decrementPendingClassMetadataCount_1.decrementPendingClassMetadataCount)(target, propertyKey);
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
(0, injectBase_1.injectBase)(updateMetadata, decrementPendingClassMetadataCount_1.decrementPendingClassMetadataCount)(target, propertyKey, parameterIndex);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
(0, handleInjectionError_1.handleInjectionError)(target, propertyKey, parameterIndex, error);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
9
|
+
return (0, injectBase_1.injectBase)(updateMetadata, decrementPendingClassMetadataCount_1.decrementPendingClassMetadataCount);
|
|
23
10
|
}
|
|
24
11
|
//# sourceMappingURL=unmanaged.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unmanaged.js","sourceRoot":"","sources":["../../../../src/metadata/decorators/unmanaged.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"unmanaged.js","sourceRoot":"","sources":["../../../../src/metadata/decorators/unmanaged.ts"],"names":[],"mappings":";;AAMA,8BASC;AAfD,sGAAmG;AACnG,6IAA0I;AAG1I,6CAA0C;AAE1C,SAAgB,SAAS;IAGvB,MAAM,cAAc,GAGlB,IAAA,yGAAmD,GAAE,CAAC;IAExD,OAAO,IAAA,uBAAU,EAAC,cAAc,EAAE,uEAAkC,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { ServiceIdentifier } from '@inversifyjs/common';
|
|
2
2
|
import { Binding } from '../../binding/models/Binding';
|
|
3
|
-
import {
|
|
4
|
-
import { SingleInmutableLinkedList } from '../../common/models/SingleInmutableLinkedList';
|
|
3
|
+
import { BindingMetadata } from '../../binding/models/BindingMetadata';
|
|
5
4
|
import { BasePlanParams } from '../models/BasePlanParams';
|
|
6
5
|
export interface BuildFilteredServiceBindingsOptions {
|
|
7
6
|
customServiceIdentifier?: ServiceIdentifier;
|
|
8
7
|
}
|
|
9
|
-
export declare function buildFilteredServiceBindings(params: BasePlanParams,
|
|
8
|
+
export declare function buildFilteredServiceBindings(params: BasePlanParams, bindingMetadata: BindingMetadata, options?: BuildFilteredServiceBindingsOptions): Binding<unknown>[];
|
|
10
9
|
//# sourceMappingURL=buildFilteredServiceBindings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildFilteredServiceBindings.d.ts","sourceRoot":"","sources":["../../../../src/planning/calculations/buildFilteredServiceBindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,
|
|
1
|
+
{"version":3,"file":"buildFilteredServiceBindings.d.ts","sourceRoot":"","sources":["../../../../src/planning/calculations/buildFilteredServiceBindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,MAAM,WAAW,mCAAmC;IAClD,uBAAuB,CAAC,EAAE,iBAAiB,CAAC;CAC7C;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,cAAc,EACtB,eAAe,EAAE,eAAe,EAChC,OAAO,CAAC,EAAE,mCAAmC,GAC5C,OAAO,CAAC,OAAO,CAAC,EAAE,CAWpB"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildFilteredServiceBindings = buildFilteredServiceBindings;
|
|
4
|
-
|
|
5
|
-
function buildFilteredServiceBindings(params, bindingMetadataList, options) {
|
|
6
|
-
const bindingMetadata = new BindingMetadataImplementation_1.BindingMetadataImplementation(bindingMetadataList.last);
|
|
4
|
+
function buildFilteredServiceBindings(params, bindingMetadata, options) {
|
|
7
5
|
const serviceIdentifier = options?.customServiceIdentifier ?? bindingMetadata.serviceIdentifier;
|
|
8
6
|
const serviceBindings = [
|
|
9
7
|
...(params.getBindings(serviceIdentifier) ?? []),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildFilteredServiceBindings.js","sourceRoot":"","sources":["../../../../src/planning/calculations/buildFilteredServiceBindings.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"buildFilteredServiceBindings.js","sourceRoot":"","sources":["../../../../src/planning/calculations/buildFilteredServiceBindings.ts"],"names":[],"mappings":";;AAUA,oEAeC;AAfD,SAAgB,4BAA4B,CAC1C,MAAsB,EACtB,eAAgC,EAChC,OAA6C;IAE7C,MAAM,iBAAiB,GACrB,OAAO,EAAE,uBAAuB,IAAI,eAAe,CAAC,iBAAiB,CAAC;IAExE,MAAM,eAAe,GAAuB;QAC1C,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;KACjD,CAAC;IAEF,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC,OAAyB,EAAW,EAAE,CACnE,OAAO,CAAC,aAAa,CAAC,eAAe,CAAC,CACvC,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BindingMetadata } from '../../binding/models/BindingMetadata';
|
|
1
2
|
import { PlanServiceRedirectionBindingNode } from '../models/PlanServiceRedirectionBindingNode';
|
|
2
|
-
export declare function checkPlanServiceRedirectionBindingNodeSingleInjectionBindings(serviceRedirectionBindingNode: PlanServiceRedirectionBindingNode, isOptional: boolean): void;
|
|
3
|
+
export declare function checkPlanServiceRedirectionBindingNodeSingleInjectionBindings(serviceRedirectionBindingNode: PlanServiceRedirectionBindingNode, isOptional: boolean, bindingMetadata: BindingMetadata): void;
|
|
3
4
|
//# sourceMappingURL=checkPlanServiceRedirectionBindingNodeSingleInjectionBindings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkPlanServiceRedirectionBindingNodeSingleInjectionBindings.d.ts","sourceRoot":"","sources":["../../../../src/planning/calculations/checkPlanServiceRedirectionBindingNodeSingleInjectionBindings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"checkPlanServiceRedirectionBindingNodeSingleInjectionBindings.d.ts","sourceRoot":"","sources":["../../../../src/planning/calculations/checkPlanServiceRedirectionBindingNodeSingleInjectionBindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAEvE,OAAO,EAAE,iCAAiC,EAAE,MAAM,6CAA6C,CAAC;AAMhG,wBAAgB,6DAA6D,CAC3E,6BAA6B,EAAE,iCAAiC,EAChE,UAAU,EAAE,OAAO,EACnB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAyBN"}
|
|
@@ -4,15 +4,15 @@ exports.checkPlanServiceRedirectionBindingNodeSingleInjectionBindings = checkPla
|
|
|
4
4
|
const isPlanServiceRedirectionBindingNode_1 = require("./isPlanServiceRedirectionBindingNode");
|
|
5
5
|
const throwErrorWhenUnexpectedBindingsAmountFound_1 = require("./throwErrorWhenUnexpectedBindingsAmountFound");
|
|
6
6
|
const SINGLE_INJECTION_BINDINGS = 1;
|
|
7
|
-
function checkPlanServiceRedirectionBindingNodeSingleInjectionBindings(serviceRedirectionBindingNode, isOptional) {
|
|
7
|
+
function checkPlanServiceRedirectionBindingNodeSingleInjectionBindings(serviceRedirectionBindingNode, isOptional, bindingMetadata) {
|
|
8
8
|
if (serviceRedirectionBindingNode.redirections.length ===
|
|
9
9
|
SINGLE_INJECTION_BINDINGS) {
|
|
10
10
|
const [planBindingNode] = serviceRedirectionBindingNode.redirections;
|
|
11
11
|
if ((0, isPlanServiceRedirectionBindingNode_1.isPlanServiceRedirectionBindingNode)(planBindingNode)) {
|
|
12
|
-
checkPlanServiceRedirectionBindingNodeSingleInjectionBindings(planBindingNode, isOptional);
|
|
12
|
+
checkPlanServiceRedirectionBindingNodeSingleInjectionBindings(planBindingNode, isOptional, bindingMetadata);
|
|
13
13
|
}
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
|
-
(0, throwErrorWhenUnexpectedBindingsAmountFound_1.throwErrorWhenUnexpectedBindingsAmountFound)(serviceRedirectionBindingNode.redirections, isOptional, serviceRedirectionBindingNode);
|
|
16
|
+
(0, throwErrorWhenUnexpectedBindingsAmountFound_1.throwErrorWhenUnexpectedBindingsAmountFound)(serviceRedirectionBindingNode.redirections, isOptional, serviceRedirectionBindingNode, bindingMetadata);
|
|
17
17
|
}
|
|
18
18
|
//# sourceMappingURL=checkPlanServiceRedirectionBindingNodeSingleInjectionBindings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkPlanServiceRedirectionBindingNodeSingleInjectionBindings.js","sourceRoot":"","sources":["../../../../src/planning/calculations/checkPlanServiceRedirectionBindingNodeSingleInjectionBindings.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"checkPlanServiceRedirectionBindingNodeSingleInjectionBindings.js","sourceRoot":"","sources":["../../../../src/planning/calculations/checkPlanServiceRedirectionBindingNodeSingleInjectionBindings.ts"],"names":[],"mappings":";;AAQA,sIA6BC;AAlCD,+FAA4F;AAC5F,+GAA4G;AAE5G,MAAM,yBAAyB,GAAW,CAAC,CAAC;AAE5C,SAAgB,6DAA6D,CAC3E,6BAAgE,EAChE,UAAmB,EACnB,eAAgC;IAEhC,IACE,6BAA6B,CAAC,YAAY,CAAC,MAAM;QACjD,yBAAyB,EACzB,CAAC;QACD,MAAM,CAAC,eAAe,CAAC,GACrB,6BAA6B,CAAC,YAAiC,CAAC;QAElE,IAAI,IAAA,yEAAmC,EAAC,eAAe,CAAC,EAAE,CAAC;YACzD,6DAA6D,CAC3D,eAAe,EACf,UAAU,EACV,eAAe,CAChB,CAAC;QACJ,CAAC;QAED,OAAO;IACT,CAAC;IAED,IAAA,yFAA2C,EACzC,6BAA6B,CAAC,YAAY,EAC1C,UAAU,EACV,6BAA6B,EAC7B,eAAe,CAChB,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BindingMetadata } from '../../binding/models/BindingMetadata';
|
|
1
2
|
import { PlanServiceNode } from '../models/PlanServiceNode';
|
|
2
|
-
export declare function checkServiceNodeSingleInjectionBindings(serviceNode: PlanServiceNode, isOptional: boolean): void;
|
|
3
|
+
export declare function checkServiceNodeSingleInjectionBindings(serviceNode: PlanServiceNode, isOptional: boolean, bindingMetadata: BindingMetadata): void;
|
|
3
4
|
//# sourceMappingURL=checkServiceNodeSingleInjectionBindings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkServiceNodeSingleInjectionBindings.d.ts","sourceRoot":"","sources":["../../../../src/planning/calculations/checkServiceNodeSingleInjectionBindings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"checkServiceNodeSingleInjectionBindings.d.ts","sourceRoot":"","sources":["../../../../src/planning/calculations/checkServiceNodeSingleInjectionBindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAEvE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAO5D,wBAAgB,uCAAuC,CACrD,WAAW,EAAE,eAAe,EAC5B,UAAU,EAAE,OAAO,EACnB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAyBN"}
|
|
@@ -5,16 +5,16 @@ const checkPlanServiceRedirectionBindingNodeSingleInjectionBindings_1 = require(
|
|
|
5
5
|
const isPlanServiceRedirectionBindingNode_1 = require("./isPlanServiceRedirectionBindingNode");
|
|
6
6
|
const throwErrorWhenUnexpectedBindingsAmountFound_1 = require("./throwErrorWhenUnexpectedBindingsAmountFound");
|
|
7
7
|
const SINGLE_INJECTION_BINDINGS = 1;
|
|
8
|
-
function checkServiceNodeSingleInjectionBindings(serviceNode, isOptional) {
|
|
8
|
+
function checkServiceNodeSingleInjectionBindings(serviceNode, isOptional, bindingMetadata) {
|
|
9
9
|
if (Array.isArray(serviceNode.bindings)) {
|
|
10
10
|
if (serviceNode.bindings.length === SINGLE_INJECTION_BINDINGS) {
|
|
11
11
|
const [planBindingNode] = serviceNode.bindings;
|
|
12
12
|
if ((0, isPlanServiceRedirectionBindingNode_1.isPlanServiceRedirectionBindingNode)(planBindingNode)) {
|
|
13
|
-
(0, checkPlanServiceRedirectionBindingNodeSingleInjectionBindings_1.checkPlanServiceRedirectionBindingNodeSingleInjectionBindings)(planBindingNode, isOptional);
|
|
13
|
+
(0, checkPlanServiceRedirectionBindingNodeSingleInjectionBindings_1.checkPlanServiceRedirectionBindingNodeSingleInjectionBindings)(planBindingNode, isOptional, bindingMetadata);
|
|
14
14
|
}
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
(0, throwErrorWhenUnexpectedBindingsAmountFound_1.throwErrorWhenUnexpectedBindingsAmountFound)(serviceNode.bindings, isOptional, serviceNode);
|
|
18
|
+
(0, throwErrorWhenUnexpectedBindingsAmountFound_1.throwErrorWhenUnexpectedBindingsAmountFound)(serviceNode.bindings, isOptional, serviceNode, bindingMetadata);
|
|
19
19
|
}
|
|
20
20
|
//# sourceMappingURL=checkServiceNodeSingleInjectionBindings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkServiceNodeSingleInjectionBindings.js","sourceRoot":"","sources":["../../../../src/planning/calculations/checkServiceNodeSingleInjectionBindings.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"checkServiceNodeSingleInjectionBindings.js","sourceRoot":"","sources":["../../../../src/planning/calculations/checkServiceNodeSingleInjectionBindings.ts"],"names":[],"mappings":";;AASA,0FA6BC;AAnCD,mJAAgJ;AAChJ,+FAA4F;AAC5F,+GAA4G;AAE5G,MAAM,yBAAyB,GAAW,CAAC,CAAC;AAE5C,SAAgB,uCAAuC,CACrD,WAA4B,EAC5B,UAAmB,EACnB,eAAgC;IAEhC,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxC,IAAI,WAAW,CAAC,QAAQ,CAAC,MAAM,KAAK,yBAAyB,EAAE,CAAC;YAC9D,MAAM,CAAC,eAAe,CAAC,GAAsB,WAAW,CAAC,QAExD,CAAC;YAEF,IAAI,IAAA,yEAAmC,EAAC,eAAe,CAAC,EAAE,CAAC;gBACzD,IAAA,6HAA6D,EAC3D,eAAe,EACf,UAAU,EACV,eAAe,CAChB,CAAC;YACJ,CAAC;YAED,OAAO;QACT,CAAC;IACH,CAAC;IAED,IAAA,yFAA2C,EACzC,WAAW,CAAC,QAAQ,EACpB,UAAU,EACV,WAAW,EACX,eAAe,CAChB,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../../src/planning/calculations/plan.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../../src/planning/calculations/plan.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAQlD,wBAAgB,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CA0DnD"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.plan = plan;
|
|
4
4
|
const common_1 = require("@inversifyjs/common");
|
|
5
|
+
const BindingMetadataImplementation_1 = require("../../binding/models/BindingMetadataImplementation");
|
|
5
6
|
const BindingType_1 = require("../../binding/models/BindingType");
|
|
6
7
|
const SingleInmutableLinkedList_1 = require("../../common/models/SingleInmutableLinkedList");
|
|
7
8
|
const ClassElementMetadataKind_1 = require("../../metadata/models/ClassElementMetadataKind");
|
|
@@ -22,7 +23,8 @@ function plan(params) {
|
|
|
22
23
|
},
|
|
23
24
|
previous: undefined,
|
|
24
25
|
});
|
|
25
|
-
const
|
|
26
|
+
const bindingMetadata = new BindingMetadataImplementation_1.BindingMetadataImplementation(bindingMetadataList.last);
|
|
27
|
+
const filteredServiceBindings = (0, buildFilteredServiceBindings_1.buildFilteredServiceBindings)(params, bindingMetadata);
|
|
26
28
|
const serviceNodeBindings = [];
|
|
27
29
|
const serviceNode = {
|
|
28
30
|
bindings: serviceNodeBindings,
|
|
@@ -31,7 +33,7 @@ function plan(params) {
|
|
|
31
33
|
};
|
|
32
34
|
serviceNodeBindings.push(...buildServiceNodeBindings(params, bindingMetadataList, filteredServiceBindings, serviceNode));
|
|
33
35
|
if (!params.rootConstraints.isMultiple) {
|
|
34
|
-
(0, checkServiceNodeSingleInjectionBindings_1.checkServiceNodeSingleInjectionBindings)(serviceNode, params.rootConstraints.isOptional ?? false);
|
|
36
|
+
(0, checkServiceNodeSingleInjectionBindings_1.checkServiceNodeSingleInjectionBindings)(serviceNode, params.rootConstraints.isOptional ?? false, bindingMetadata);
|
|
35
37
|
const [planBindingNode] = serviceNodeBindings;
|
|
36
38
|
serviceNode.bindings = planBindingNode;
|
|
37
39
|
}
|
|
@@ -70,7 +72,8 @@ function buildPlanServiceNodeFromClassElementMetadata(params, bindingMetadataLis
|
|
|
70
72
|
serviceIdentifier,
|
|
71
73
|
tags: elementMetadata.tags,
|
|
72
74
|
});
|
|
73
|
-
const
|
|
75
|
+
const bindingMetadata = new BindingMetadataImplementation_1.BindingMetadataImplementation(updatedBindingMetadataList.last);
|
|
76
|
+
const filteredServiceBindings = (0, buildFilteredServiceBindings_1.buildFilteredServiceBindings)(params, bindingMetadata);
|
|
74
77
|
const serviceNodeBindings = [];
|
|
75
78
|
const serviceNode = {
|
|
76
79
|
bindings: serviceNodeBindings,
|
|
@@ -79,7 +82,7 @@ function buildPlanServiceNodeFromClassElementMetadata(params, bindingMetadataLis
|
|
|
79
82
|
};
|
|
80
83
|
serviceNodeBindings.push(...buildServiceNodeBindings(params, updatedBindingMetadataList, filteredServiceBindings, serviceNode));
|
|
81
84
|
if (elementMetadata.kind === ClassElementMetadataKind_1.ClassElementMetadataKind.singleInjection) {
|
|
82
|
-
(0, checkServiceNodeSingleInjectionBindings_1.checkServiceNodeSingleInjectionBindings)(serviceNode, elementMetadata.optional);
|
|
85
|
+
(0, checkServiceNodeSingleInjectionBindings_1.checkServiceNodeSingleInjectionBindings)(serviceNode, elementMetadata.optional, bindingMetadata);
|
|
83
86
|
const [planBindingNode] = serviceNodeBindings;
|
|
84
87
|
serviceNode.bindings = planBindingNode;
|
|
85
88
|
}
|
|
@@ -118,7 +121,8 @@ function buildServiceRedirectionPlanBindingNode(params, bindingMetadataList, bin
|
|
|
118
121
|
parent: parentNode,
|
|
119
122
|
redirections: [],
|
|
120
123
|
};
|
|
121
|
-
const
|
|
124
|
+
const bindingMetadata = new BindingMetadataImplementation_1.BindingMetadataImplementation(bindingMetadataList.last);
|
|
125
|
+
const filteredServiceBindings = (0, buildFilteredServiceBindings_1.buildFilteredServiceBindings)(params, bindingMetadata, {
|
|
122
126
|
customServiceIdentifier: binding.targetServiceIdentifier,
|
|
123
127
|
});
|
|
124
128
|
childNode.redirections.push(...buildServiceNodeBindings(params, bindingMetadataList, filteredServiceBindings, childNode));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../../../src/planning/calculations/plan.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../../../src/planning/calculations/plan.ts"],"names":[],"mappings":";;AA+BA,oBA0DC;AAzFD,gDAA+E;AAI/E,sGAG4D;AAC5D,kEAAqE;AAGrE,6FAA0F;AAG1F,6FAA0F;AAG1F,kEAA+D;AAU/D,iFAA8E;AAC9E,uGAAoG;AACpG,+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,mBAAmB,GACvB,IAAI,qDAAyB,CA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AE,CAAC;YAClC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { BindingMetadata } from '../../binding/models/BindingMetadata';
|
|
1
2
|
import { BindingNodeParent } from '../models/BindingNodeParent';
|
|
2
3
|
import { PlanBindingNode } from '../models/PlanBindingNode';
|
|
3
|
-
export declare function throwErrorWhenUnexpectedBindingsAmountFound(bindings: PlanBindingNode[] | PlanBindingNode | undefined, isOptional: boolean, node: BindingNodeParent): void;
|
|
4
|
+
export declare function throwErrorWhenUnexpectedBindingsAmountFound(bindings: PlanBindingNode[] | PlanBindingNode | undefined, isOptional: boolean, node: BindingNodeParent, bindingMetadata: BindingMetadata): void;
|
|
4
5
|
//# sourceMappingURL=throwErrorWhenUnexpectedBindingsAmountFound.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"throwErrorWhenUnexpectedBindingsAmountFound.d.ts","sourceRoot":"","sources":["../../../../src/planning/calculations/throwErrorWhenUnexpectedBindingsAmountFound.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"throwErrorWhenUnexpectedBindingsAmountFound.d.ts","sourceRoot":"","sources":["../../../../src/planning/calculations/throwErrorWhenUnexpectedBindingsAmountFound.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAIvE,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,eAAe,EAAE,eAAe,GAC/B,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, bindingMetadata) {
|
|
10
10
|
let serviceIdentifier;
|
|
11
11
|
let parentServiceIdentifier;
|
|
12
12
|
if ((0, isPlanServiceRedirectionBindingNode_1.isPlanServiceRedirectionBindingNode)(node)) {
|
|
@@ -18,22 +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, bindingMetadata);
|
|
22
22
|
}
|
|
23
23
|
else {
|
|
24
|
-
throwErrorWhenSingleUnexpectedBindingFound(bindings, isOptional, serviceIdentifier, parentServiceIdentifier);
|
|
24
|
+
throwErrorWhenSingleUnexpectedBindingFound(bindings, isOptional, serviceIdentifier, parentServiceIdentifier, bindingMetadata);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
function throwBindingNotFoundError(serviceIdentifier, parentServiceIdentifier) {
|
|
27
|
+
function throwBindingNotFoundError(serviceIdentifier, parentServiceIdentifier, bindingMetadata) {
|
|
28
28
|
const errorMessage = `No bindings found for service: "${(0, common_1.stringifyServiceIdentifier)(serviceIdentifier)}".
|
|
29
29
|
|
|
30
|
-
Trying to resolve bindings for "${stringifyParentServiceIdentifier(serviceIdentifier, parentServiceIdentifier)}"
|
|
30
|
+
Trying to resolve bindings for "${stringifyParentServiceIdentifier(serviceIdentifier, parentServiceIdentifier)}".
|
|
31
|
+
|
|
32
|
+
${stringifyBindingMetadata(bindingMetadata)}`;
|
|
31
33
|
throw new InversifyCoreError_1.InversifyCoreError(InversifyCoreErrorKind_1.InversifyCoreErrorKind.planning, errorMessage);
|
|
32
34
|
}
|
|
33
|
-
function throwErrorWhenMultipleUnexpectedBindingsAmountFound(bindings, isOptional, serviceIdentifier, parentServiceIdentifier) {
|
|
35
|
+
function throwErrorWhenMultipleUnexpectedBindingsAmountFound(bindings, isOptional, serviceIdentifier, parentServiceIdentifier, bindingMetadata) {
|
|
34
36
|
if (bindings.length === 0) {
|
|
35
37
|
if (!isOptional) {
|
|
36
|
-
throwBindingNotFoundError(serviceIdentifier, parentServiceIdentifier);
|
|
38
|
+
throwBindingNotFoundError(serviceIdentifier, parentServiceIdentifier, bindingMetadata);
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
41
|
else {
|
|
@@ -43,13 +45,15 @@ Registered bindings:
|
|
|
43
45
|
|
|
44
46
|
${bindings.map((binding) => (0, stringifyBinding_1.stringifyBinding)(binding.binding)).join('\n')}
|
|
45
47
|
|
|
46
|
-
Trying to resolve bindings for "${stringifyParentServiceIdentifier(serviceIdentifier, parentServiceIdentifier)}"
|
|
48
|
+
Trying to resolve bindings for "${stringifyParentServiceIdentifier(serviceIdentifier, parentServiceIdentifier)}".
|
|
49
|
+
|
|
50
|
+
${stringifyBindingMetadata(bindingMetadata)}`;
|
|
47
51
|
throw new InversifyCoreError_1.InversifyCoreError(InversifyCoreErrorKind_1.InversifyCoreErrorKind.planning, errorMessage);
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
|
-
function throwErrorWhenSingleUnexpectedBindingFound(bindings, isOptional, serviceIdentifier, parentServiceIdentifier) {
|
|
54
|
+
function throwErrorWhenSingleUnexpectedBindingFound(bindings, isOptional, serviceIdentifier, parentServiceIdentifier, bindingMetadata) {
|
|
51
55
|
if (bindings === undefined && !isOptional) {
|
|
52
|
-
throwBindingNotFoundError(serviceIdentifier, parentServiceIdentifier);
|
|
56
|
+
throwBindingNotFoundError(serviceIdentifier, parentServiceIdentifier, bindingMetadata);
|
|
53
57
|
}
|
|
54
58
|
else {
|
|
55
59
|
return;
|
|
@@ -60,4 +64,14 @@ function stringifyParentServiceIdentifier(serviceIdentifier, parentServiceIdenti
|
|
|
60
64
|
? `${(0, common_1.stringifyServiceIdentifier)(serviceIdentifier)} (Root service)`
|
|
61
65
|
: (0, common_1.stringifyServiceIdentifier)(parentServiceIdentifier);
|
|
62
66
|
}
|
|
67
|
+
function stringifyBindingMetadata(bindingMetadata) {
|
|
68
|
+
const stringifiedTags = bindingMetadata.tags.size === 0
|
|
69
|
+
? ''
|
|
70
|
+
: `
|
|
71
|
+
- tags:
|
|
72
|
+
- ${[...bindingMetadata.tags.keys()].map((key) => key.toString()).join('\n - ')}`;
|
|
73
|
+
return `Binding metadata:
|
|
74
|
+
- service identifier: ${(0, common_1.stringifyServiceIdentifier)(bindingMetadata.serviceIdentifier)}
|
|
75
|
+
- name: ${bindingMetadata.name?.toString() ?? '-'}${stringifiedTags}`;
|
|
76
|
+
}
|
|
63
77
|
//# sourceMappingURL=throwErrorWhenUnexpectedBindingsAmountFound.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"throwErrorWhenUnexpectedBindingsAmountFound.js","sourceRoot":"","sources":["../../../../src/planning/calculations/throwErrorWhenUnexpectedBindingsAmountFound.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"throwErrorWhenUnexpectedBindingsAmountFound.js","sourceRoot":"","sources":["../../../../src/planning/calculations/throwErrorWhenUnexpectedBindingsAmountFound.ts"],"names":[],"mappings":";;AAcA,kGAkCC;AAhDD,gDAG6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,CAAC,CAAC;;MAEF,CAAC,GAAG,eAAe,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;IAEhG,OAAO;wBACe,IAAA,mCAA0B,EAAC,eAAe,CAAC,iBAAiB,CAAC;UAC3E,eAAe,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,GAAG,GAAG,eAAe,EAAE,CAAC;AACtE,CAAC"}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -195,7 +195,7 @@ interface ClassMetadata {
|
|
|
195
195
|
|
|
196
196
|
declare function getClassMetadata(type: Newable): ClassMetadata;
|
|
197
197
|
|
|
198
|
-
declare function inject(serviceIdentifier: ServiceIdentifier | LazyServiceIdentifier): ParameterDecorator & PropertyDecorator;
|
|
198
|
+
declare function inject(serviceIdentifier: ServiceIdentifier | LazyServiceIdentifier): MethodDecorator & ParameterDecorator & PropertyDecorator;
|
|
199
199
|
|
|
200
200
|
declare function injectable(scope?: BindingScope): ClassDecorator;
|
|
201
201
|
|
|
@@ -206,19 +206,19 @@ interface InjectFromBaseOptions {
|
|
|
206
206
|
|
|
207
207
|
declare function injectFromBase(options?: InjectFromBaseOptions): ClassDecorator;
|
|
208
208
|
|
|
209
|
-
declare function multiInject(serviceIdentifier: ServiceIdentifier | LazyServiceIdentifier): ParameterDecorator & PropertyDecorator;
|
|
209
|
+
declare function multiInject(serviceIdentifier: ServiceIdentifier | LazyServiceIdentifier): MethodDecorator & ParameterDecorator & PropertyDecorator;
|
|
210
210
|
|
|
211
|
-
declare function named(name: MetadataName): ParameterDecorator & PropertyDecorator;
|
|
211
|
+
declare function named(name: MetadataName): MethodDecorator & ParameterDecorator & PropertyDecorator;
|
|
212
212
|
|
|
213
|
-
declare function optional(): ParameterDecorator & PropertyDecorator;
|
|
213
|
+
declare function optional(): MethodDecorator & ParameterDecorator & PropertyDecorator;
|
|
214
214
|
|
|
215
215
|
declare function postConstruct(): MethodDecorator;
|
|
216
216
|
|
|
217
217
|
declare function preDestroy(): MethodDecorator;
|
|
218
218
|
|
|
219
|
-
declare function tagged(key: MetadataTag, value: unknown): ParameterDecorator & PropertyDecorator;
|
|
219
|
+
declare function tagged(key: MetadataTag, value: unknown): MethodDecorator & ParameterDecorator & PropertyDecorator;
|
|
220
220
|
|
|
221
|
-
declare function unmanaged(): ParameterDecorator & PropertyDecorator;
|
|
221
|
+
declare function unmanaged(): MethodDecorator & ParameterDecorator & PropertyDecorator;
|
|
222
222
|
|
|
223
223
|
interface BasePlanParams {
|
|
224
224
|
getBindings: <TInstance>(serviceIdentifier: ServiceIdentifier<TInstance>) => Iterable<Binding<TInstance>> | undefined;
|
package/lib/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{getOwnReflectMetadata as e,updateOwnReflectMetadata as n,setReflectMetadata as t}from"@inversifyjs/reflect-metadata-utils";import{getBaseType as o}from"@inversifyjs/prototype-utils";import{stringifyServiceIdentifier as i,LazyServiceIdentifier as r,isPromise as s}from"@inversifyjs/common";const c={Request:"Request",Singleton:"Singleton",Transient:"Transient"},a={ConstantValue:"ConstantValue",DynamicValue:"DynamicValue",Factory:"Factory",Instance:"Instance",Provider:"Provider",ServiceRedirection:"ServiceRedirection"};function*u(...e){for(const n of e)yield*n}class d{#e;#n;#t;constructor(e){this.#e=new Map,this.#n={};for(const n of Reflect.ownKeys(e))this.#n[n]=new Map;this.#t=e}add(e,n){this.#o(e).push(n);for(const t of Reflect.ownKeys(n))this.#i(t,n[t]).push(e)}clone(){const e=Reflect.ownKeys(this.#t),n=new d(this.#t);this.#r(this.#e,n.#e);for(const t of e)this.#r(this.#n[t],n.#n[t]);return n}get(e,n){return this.#n[e].get(n)}getAllKeys(e){return this.#n[e].keys()}removeByRelation(e,n){const t=this.get(e,n);if(void 0!==t)for(const o of t){const t=this.#e.get(o);if(void 0===t)throw new Error("Expecting model relation, none found");for(const i of t)i[e]===n&&this.#s(o,i);this.#e.delete(o)}}#o(e){let n=this.#e.get(e);return void 0===n&&(n=[],this.#e.set(e,n)),n}#i(e,n){let t=this.#n[e].get(n);return void 0===t&&(t=[],this.#n[e].set(n,t)),t}#r(e,n){for(const[t,o]of e)n.set(t,o)}#s(e,n){for(const t of Reflect.ownKeys(n))this.#c(e,t,n[t])}#c(e,n,t){const o=this.#n[n].get(t);if(void 0!==o){const i=o.indexOf(e);-1!==i&&o.splice(i,1),0===o.length&&this.#n[n].delete(t)}}}var l,f,p;!function(e){e.moduleId="moduleId",e.serviceId="serviceId"}(l||(l={}));class g{#a;#u;constructor(e,n){this.#a=n??new d({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#u=e}static build(e){return new g(e)}add(e,n){this.#a.add(e,n)}clone(){return new g(this.#u,this.#a.clone())}get(e){const n=[],t=this.#a.get(l.serviceId,e);void 0!==t&&n.push(t);const o=this.#u?.get(e);if(void 0!==o&&n.push(o),0!==n.length)return u(...n)}removeAllByModuleId(e){this.#a.removeByRelation(l.moduleId,e)}removeAllByServiceId(e){this.#a.removeByRelation(l.serviceId,e)}}!function(e){e.moduleId="moduleId",e.serviceId="serviceId"}(f||(f={}));class m{#d;#u;constructor(e,n){this.#d=n??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(f.serviceId,e)}getNonParentBoundServices(){return this.#d.getAllKeys(f.serviceId)}getByModuleId(e){return this.#d.get(f.moduleId,e)??this.#u?.getByModuleId(e)}removeAllByModuleId(e){this.#d.removeByRelation(f.moduleId,e)}removeAllByServiceId(e){this.#d.removeByRelation(f.serviceId,e)}set(e){const n={[f.serviceId]:e.serviceIdentifier};void 0!==e.moduleId&&(n[f.moduleId]=e.moduleId),this.#d.add(e,n)}}!function(e){e.moduleId="moduleId",e.serviceId="serviceId"}(p||(p={}));class v{#l;#u;constructor(e,n){this.#l=n??new d({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#u=e}static build(e){return new v(e)}add(e,n){this.#l.add(e,n)}clone(){return new v(this.#u,this.#l.clone())}get(e){const n=[],t=this.#l.get(p.serviceId,e);void 0!==t&&n.push(t);const o=this.#u?.get(e);if(void 0!==o&&n.push(o),0!==n.length)return u(...n)}removeAllByModuleId(e){this.#l.removeByRelation(p.moduleId,e)}removeAllByServiceId(e){this.#l.removeByRelation(p.serviceId,e)}}function h(e,n,t){const o=Array.isArray(e)?e:[e];if(void 0!==t)if("number"!=typeof t)Reflect.decorate(o,n.prototype,t);else for(const e of o)e(n,void 0,t);else Reflect.decorate(o,n)}const y="@inversifyjs/core/classMetadataReflectKey";function w(){return{constructorArguments:[],lifecycle:{postConstructMethodName:void 0,preDestroyMethodName:void 0},properties:new Map,scope:void 0}}const M="@inversifyjs/core/pendingClassMetadataCountReflectKey";const I=Symbol.for("@inversifyjs/core/InversifyCoreError");class b extends Error{[I];kind;constructor(e,n,t){super(n,t),this[I]=!0,this.kind=e}static is(e){return"object"==typeof e&&null!==e&&!0===e[I]}static isErrorOfKind(e,n){return b.is(e)&&e.kind===n}}var j,C,x;function $(n){const t=e(n,y)??w();if(!function(n){const t=e(n,M);return void 0!==t&&0!==t}(n))return function(e,n){const t=[];if(n.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 ${n.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<n.length;++e)void 0===n[e]&&t.push(e);if(t.length>0)throw new b(j.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}" at constructor indexes "${t.join('", "')}".\n\nAre you using @inject, @multiInject or @unmanaged decorators at those indexes?\n\nIf you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`)}(n,t.constructorArguments),t;!function(e,n){const t=[];for(let o=0;o<n.constructorArguments.length;++o){const i=n.constructorArguments[o];void 0!==i&&i.kind!==C.unknown||t.push(` - Missing or incomplete metadata for type "${e.name}" at constructor argument with index ${o.toString()}.\nEvery constructor parameter must be decorated either with @inject, @multiInject or @unmanaged decorator.`)}for(const[o,i]of n.properties)i.kind===C.unknown&&t.push(` - Missing or incomplete metadata for type "${e.name}" at property "${o.toString()}".\nThis property must be decorated either with @inject or @multiInject decorator.`);if(0===t.length)throw new b(j.unknown,`Unexpected class metadata for type "${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${t.join("\n\n")}`)}(n,t)}function R(){return 0}function S(e){return t=>{void 0!==t&&t.kind===C.unknown&&n(e,M,R,(e=>e-1))}}function A(e,n){return(...t)=>o=>{if(void 0===o)return e(...t);if(o.kind===x.unmanaged)throw new b(j.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found");return n(o,...t)}}function T(e){if(e.kind!==C.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"}(C||(C={})),function(e){e[e.multipleInjection=0]="multipleInjection",e[e.singleInjection=1]="singleInjection",e[e.unmanaged=2]="unmanaged"}(x||(x={}));const D=A((function(e,n){return{kind:e,name:void 0,optional:!1,tags:new Map,value:n}}),(function(e,n,t){return T(e),{...e,kind:n,value:t}}));var k;function B(e,n,t,o){if(b.isErrorOfKind(o,j.injectionDecoratorConflict)){const i=function(e,n,t){if(void 0===t){if(void 0===n)throw new b(j.unknown,"Unexpected undefined property and index values");return{kind:k.property,property:n,targetClass:e.constructor}}return{index:t,kind:k.parameter,targetClass:e}}(e,n,t);throw new b(j.injectionDecoratorConflict,`Unexpected injection error.\n\nCause:\n\n${o.message}\n\nDetails\n\n${function(e){switch(e.kind){case k.parameter:return`[class: "${e.targetClass.name}", index: "${e.index.toString()}"]`;case k.property:return`[class: "${e.targetClass.name}", property: "${e.property.toString()}"]`}}(i)}`,{cause:o})}throw o}function P(e,t){return(o,i,r)=>{void 0===r?function(e,t){const o=F(e,t);return(e,t)=>{n(e.constructor,y,w,function(e,n){return t=>{const o=t.properties.get(n);return t.properties.set(n,e(o)),t}}(o(e),t))}}(e,t)(o,i):function(e,t){const o=F(e,t);return(e,t,i)=>{if(!function(e,n){return"function"==typeof e&&void 0===n}(e,t))throw new Error(`Found an @inject decorator in a non constructor parameter.\nFound @inject decorator at method "${t?.toString()??""}" at class "${e.constructor.name}"`);n(e,y,w,function(e,n){return t=>{const o=t.constructorArguments[n];return t.constructorArguments[n]=e(o),t}}(o(e),i))}}(e,t)(o,i,r)}}function F(e,n){return t=>{const o=n(t);return n=>(o(n),e(n))}}function N(e){const n=D(x.singleInjection,e);return(e,t,o)=>{try{void 0===o?P(n,S)(e,t):P(n,S)(e,t,o)}catch(n){B(e,t,o,n)}}}!function(e){e[e.parameter=0]="parameter",e[e.property=1]="property"}(k||(k={}));const E="@inversifyjs/core/classIsInjectableFlagReflectKey";const O=[Array,BigInt,Boolean,Function,Number,Object,String];function U(t){const o=e(t,"design:paramtypes");void 0!==o&&n(t,y,w,function(e){return n=>(e.forEach(((e,t)=>{var o;void 0!==n.constructorArguments[t]||(o=e,O.includes(o))||(n.constructorArguments[t]=function(e){return{isFromTypescriptParamType:!0,kind:x.singleInjection,name:void 0,optional:!1,tags:new Map,value:e}}(e))})),n)}(o))}function K(o){return i=>{!function(n){if(void 0!==e(n,E))throw new b(j.injectionDecoratorConflict,`Cannot apply @injectable decorator multiple times at class "${n.name}"`);t(n,E,!0)}(i),U(i),void 0!==o&&n(i,y,w,(e=>({...e,scope:o})))}}function q(e,n,t){let o;return e.extendConstructorArguments??!1?(o=[...n.constructorArguments],t.constructorArguments.map(((e,n)=>{o[n]=e}))):o=t.constructorArguments,o}function V(e,n,t){let o;return o=e.extendProperties??!1?new Map(u(n.properties,t.properties)):t.properties,o}function G(e){return t=>{const o=$(e.type);n(t,y,w,function(e,n){const t=t=>({constructorArguments:q(e,n,t),lifecycle:t.lifecycle,properties:V(e,n,t),scope:t.scope});return t}(e,o))}}function z(e){return n=>{const t=o(n);if(void 0===t)throw new b(j.injectionDecoratorConflict,`Expected base type for type "${n.name}", none found.`);G({...e,type:t})(n)}}function H(e){const n=D(x.multipleInjection,e);return(e,t,o)=>{try{void 0===o?P(n,S)(e,t):P(n,S)(e,t,o)}catch(n){B(e,t,o,n)}}}function J(e){return t=>{void 0===t&&n(e,M,R,(e=>e+1))}}function L(e){return n=>{const t=n??{kind:C.unknown,name:void 0,optional:!1,tags:new Map};if(t.kind===x.unmanaged)throw new b(j.injectionDecoratorConflict,"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections");return e(t)}}function Q(e){const n=L(function(e){return n=>{if(void 0!==n.name)throw new b(j.injectionDecoratorConflict,"Unexpected duplicated named decorator");return n.name=e,n}}(e));return(e,t,o)=>{try{void 0===o?P(n,J)(e,t):P(n,J)(e,t,o)}catch(n){B(e,t,o,n)}}}function W(e){if(e.optional)throw new b(j.injectionDecoratorConflict,"Unexpected duplicated optional decorator");return e.optional=!0,e}function X(){const e=L(W);return(n,t,o)=>{try{void 0===o?P(e,J)(n,t):P(e,J)(n,t,o)}catch(e){B(n,t,o,e)}}}function Y(){return(e,t,o)=>{try{n(e.constructor,y,w,(i=t,e=>{if(void 0!==e.lifecycle.postConstructMethodName)throw new b(j.injectionDecoratorConflict,"Unexpected duplicated postConstruct decorator");return e.lifecycle.postConstructMethodName=i,e}))}catch(n){B(e,t,void 0,n)}var i}}function Z(){return(e,t,o)=>{try{n(e.constructor,y,w,(i=t,e=>{if(void 0!==e.lifecycle.preDestroyMethodName)throw new b(j.injectionDecoratorConflict,"Unexpected duplicated preDestroy decorator");return e.lifecycle.preDestroyMethodName=i,e}))}catch(n){B(e,t,void 0,n)}var i}}function _(e,n){const t=L(function(e,n){return t=>{if(t.tags.has(e))throw new b(j.injectionDecoratorConflict,"Unexpected duplicated tag decorator with existing tag");return t.tags.set(e,n),t}}(e,n));return(e,n,o)=>{try{void 0===o?P(t,J)(e,n):P(t,J)(e,n,o)}catch(t){B(e,n,o,t)}}}function ee(){return{kind:x.unmanaged}}const ne=A(ee,(function(e){if(T(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 ee()}));function te(){const e=ne();return(n,t,o)=>{try{void 0===o?P(e,S)(n,t):P(e,S)(n,t,o)}catch(e){B(n,t,o,e)}}}class oe{last;constructor(e){this.last=e}concat(e){return new oe({elem:e,previous:this.last})}[Symbol.iterator](){let e=this.last;return{next:()=>{if(void 0===e)return{done:!0,value:void 0};const n=e.elem;return e=e.previous,{done:!1,value:n}}}}}function ie(e,n){e.servicesBranch.has(n)&&function(e,n){const t=(o=[...e.servicesBranch,n],[...o].map(i).join(" -> "));var o;throw new b(j.planning,`Circular dependency found: ${t}`)}(e,n),e.servicesBranch.add(n)}class re{#f;constructor(e){this.#f=e}get name(){return this.#f.elem.name}get tags(){return this.#f.elem.tags}get serviceIdentifier(){return this.#f.elem.serviceIdentifier}getAncestor(){if(void 0!==this.#f.previous)return new re(this.#f.previous)}}function se(e,n,t){const o=new re(n.last),i=t?.customServiceIdentifier??o.serviceIdentifier;return[...e.getBindings(i)??[]].filter((e=>e.isSatisfiedBy(o)))}function ce(e){return void 0!==e.redirections}function ae(e,n,t){let o,r;ce(t)?(o=t.binding.targetServiceIdentifier,r=t.binding.serviceIdentifier):(o=t.serviceIdentifier,r=t.parent?.binding.serviceIdentifier),Array.isArray(e)?function(e,n,t,o){if(0!==e.length){const n=`Ambiguous bindings found for service: "${i(t)}".\n\nRegistered bindings:\n\n${e.map((e=>function(e){switch(e.type){case a.Instance:return`[ type: "${e.type}", serviceIdentifier: "${i(e.serviceIdentifier)}", scope: "${e.scope}", implementationType: "${e.implementationType.name}" ]`;case a.ServiceRedirection:return`[ type: "${e.type}", serviceIdentifier: "${i(e.serviceIdentifier)}", redirection: "${i(e.targetServiceIdentifier)}" ]`;default:return`[ type: "${e.type}", serviceIdentifier: "${i(e.serviceIdentifier)}", scope: "${e.scope}" ]`}}(e.binding))).join("\n")}\n\nTrying to resolve bindings for "${de(t,o)}".`;throw new b(j.planning,n)}n||ue(t,o)}(e,n,o,r):function(e,n,t,o){if(void 0!==e||n)return;ue(t,o)}(e,n,o,r)}function ue(e,n){const t=`No bindings found for service: "${i(e)}".\n\nTrying to resolve bindings for "${de(e,n)}".`;throw new b(j.planning,t)}function de(e,n){return void 0===n?`${i(e)} (Root service)`:i(n)}function le(e,n){if(1!==e.redirections.length)ae(e.redirections,n,e);else{const[t]=e.redirections;ce(t)&&le(t,n)}}function fe(e,n){if(Array.isArray(e.bindings)&&1===e.bindings.length){const[t]=e.bindings;ce(t)&&le(t,n)}else ae(e.bindings,n,e)}function pe(e){const n=new Map;void 0!==e.rootConstraints.tag&&n.set(e.rootConstraints.tag.key,e.rootConstraints.tag.value);const t=new oe({elem:{name:e.rootConstraints.name,serviceIdentifier:e.rootConstraints.serviceIdentifier,tags:n},previous:void 0}),o=se(e,t),i=[],r={bindings:i,parent:void 0,serviceIdentifier:e.rootConstraints.serviceIdentifier};if(i.push(...ve(e,t,o,r)),!e.rootConstraints.isMultiple){fe(r,e.rootConstraints.isOptional??!1);const[n]=i;r.bindings=n}return{tree:{root:r}}}function ge(e,n,t,o){const i={binding:n,classMetadata:e.getClassMetadata(n.implementationType),constructorParams:[],parent:o,propertyParams:new Map};return function(e,n){const t=e.node.classMetadata;for(const[o,i]of t.constructorArguments.entries())e.node.constructorParams[o]=me(e,n,i);for(const[o,i]of t.properties){const t=me(e,n,i);void 0!==t&&e.node.propertyParams.set(o,t)}return e.node}({getBindings:e.getBindings,getClassMetadata:e.getClassMetadata,node:i,servicesBranch:e.servicesBranch},t)}function me(e,n,t){if(t.kind===x.unmanaged)return;const o=r.is(t.value)?t.value.unwrap():t.value,i=n.concat({name:t.name,serviceIdentifier:o,tags:t.tags}),s=se(e,i),c=[],a={bindings:c,parent:e.node,serviceIdentifier:o};if(c.push(...ve(e,i,s,a)),t.kind===x.singleInjection){fe(a,t.optional);const[e]=c;a.bindings=e}return a}function ve(e,n,t,o){const i=ce(o)?o.binding.targetServiceIdentifier:o.serviceIdentifier;ie(e,i);const r=[];for(const i of t)switch(i.type){case a.Instance:r.push(ge(e,i,n,o));break;case a.ServiceRedirection:{const t=he(e,n,i,o);r.push(t);break}default:r.push({binding:i,parent:o})}return e.servicesBranch.delete(i),r}function he(e,n,t,o){const i={binding:t,parent:o,redirections:[]},r=se(e,n,{customServiceIdentifier:t.targetServiceIdentifier});return i.redirections.push(...ve(e,n,r,i)),i}function ye(e,n,t){const o=e.getActivations(n);return void 0===o?t:s(t)?we(e,t,o[Symbol.iterator]()):function(e,n,t){let o=n,i=t.next();for(;!0!==i.done;){const n=i.value(e.context,o);if(s(n))return we(e,n,t);o=n,i=t.next()}return o}(e,t,o[Symbol.iterator]())}async function we(e,n,t){let o=await n,i=t.next();for(;!0!==i.done;)o=await i.value(e.context,o),i=t.next();return o}function Me(e,n,t){let o=t;if(void 0!==n.onActivation){const t=n.onActivation;o=s(o)?o.then((n=>t(e.context,n))):t(e.context,o)}return ye(e,n.serviceIdentifier,o)}function Ie(e){return(n,t)=>{if(t.cache.isRight)return t.cache.value;const o=Me(n,t,e(n,t));return t.cache={isRight:!0,value:o},o}}const be=Ie((function(e,n){return n.value}));function je(e){return e}function Ce(e,n){return(t,o)=>{const i=e(o);switch(i.scope){case c.Singleton:{if(i.cache.isRight)return i.cache.value;const e=xe(t,o,i,n);return i.cache={isRight:!0,value:e},e}case c.Request:{if(t.requestScopeCache.has(i.id))return t.requestScopeCache.get(i.id);const e=xe(t,o,i,n);return t.requestScopeCache.set(i.id,e),e}case c.Transient:return xe(t,o,i,n)}}}function xe(e,n,t,o){return Me(e,t,o(e,n))}const $e=(e=>Ce(je,e))((function(e,n){return n.value(e.context)}));const Re=Ie((function(e,n){return n.factory(e.context)}));function Se(e,n,t){const o=function(e,n,t){if(void 0===t)return;if(!(t in e))throw new b(j.resolution,`Expecting a "${t.toString()}" property when resolving "${n.implementationType.name}" class @postConstruct decorated method, none found.`);if("function"!=typeof e[t])throw new b(j.resolution,`Expecting a "${t.toString()}" method when resolving "${n.implementationType.name}" class @postConstruct decorated method, a non function property was found instead.`);{let o;try{o=e[t]()}catch(e){throw new b(j.resolution,`Unexpected error found when calling "${t.toString()}" @postConstruct decorated method on class "${n.implementationType.name}"`,{cause:e})}if(s(o))return async function(e,n,t){try{await t}catch(t){throw new b(j.resolution,`Unexpected error found when calling "${n.toString()}" @postConstruct decorated method on class "${e.implementationType.name}"`,{cause:t})}}(n,t,o)}}(e,n,t);return s(o)?o.then((()=>e)):e}function Ae(e){return(n,t,o)=>{const i=new o.binding.implementationType(...n),r=e(t,i,o);return s(r)?r.then((()=>Se(i,o.binding,o.classMetadata.lifecycle.postConstructMethodName))):Se(i,o.binding,o.classMetadata.lifecycle.postConstructMethodName)}}const Te=Ie((function(e,n){return n.provider(e.context)}));function De(e){return e.binding}const ke=function(e){return(n,t,o)=>{const i=[];for(const[r,c]of o.propertyParams){const a=o.classMetadata.properties.get(r);if(void 0===a)throw new b(j.resolution,`Expecting metadata at property "${r.toString()}", none found`);a.kind!==x.unmanaged&&void 0!==c.bindings&&(t[r]=e(n,c),s(t[r])&&i.push((async()=>{t[r]=await t[r]})()))}if(i.length>0)return Promise.all(i).then((()=>{}))}}(Oe),Be=function(e){return function n(t,o){const i=[];for(const r of o.redirections)ce(r)?i.push(...n(t,r)):i.push(e(t,r));return i}}(Ee),Pe=function(e,n,t){return(o,i)=>{const r=e(o,i);return s(r)?n(r,o,i):t(r,o,i)}}(function(e){return(n,t)=>{const o=[];for(const i of t.constructorParams)void 0===i?o.push(void 0):o.push(e(n,i));return o.some(s)?Promise.all(o):o}}(Oe),function(e){return async(n,t,o)=>{const i=await n;return e(i,t,o)}}(Ae(ke)),Ae(ke)),Fe=(e=>Ce(De,e))(Pe);function Ne(e){return Oe(e,e.planResult.tree.root)}function Ee(e,n){switch(n.binding.type){case a.ConstantValue:return be(e,n.binding);case a.DynamicValue:return $e(e,n.binding);case a.Factory:return Re(e,n.binding);case a.Instance:return Fe(e,n);case a.Provider:return Te(e,n.binding)}}function Oe(e,n){if(void 0!==n.bindings)return Array.isArray(n.bindings)?function(e,n){const t=[];for(const o of n)ce(o)?t.push(...Be(e,o)):t.push(Ee(e,o));if(t.some(s))return Promise.all(t);return t}(e,n.bindings):function(e,n){if(ce(n)){const t=Be(e,n);if(1===t.length)return t[0];throw new b(j.resolution,"Unexpected multiple resolved values on single injection")}return Ee(e,n)}(e,n.bindings)}function Ue(e){return void 0!==e.scope}function Ke(e,n){if(void 0!==e.lifecycle.preDestroyMethodName&&"function"==typeof n[e.lifecycle.preDestroyMethodName])return n[e.lifecycle.preDestroyMethodName]()}function qe(e,n,t){const o=e.getDeactivations(n);if(void 0!==o)return s(t)?Ve(t,o[Symbol.iterator]()):function(e,n){let t=n.next();for(;!0!==t.done;){const o=t.value(e);if(s(o))return Ve(e,n);t=n.next()}}(t,o[Symbol.iterator]())}async function Ve(e,n){const t=await e;let o=n.next();for(;!0!==o.done;)await o.value(t),o=n.next()}function Ge(e,n){const t=function(e,n){if(n.type===a.Instance){const t=e.getClassMetadata(n.implementationType),o=n.cache.value;return s(o)?o.then((e=>Ke(t,e))):Ke(t,o)}}(e,n);return void 0===t?ze(e,n):t.then((()=>ze(e,n)))}function ze(e,n){const t=n.cache;return s(t.value)?t.value.then((t=>He(e,n,t))):He(e,n,t.value)}function He(e,n,t){let o;if(void 0!==n.onDeactivation){o=(0,n.onDeactivation)(t)}return void 0===o?qe(e,n.serviceIdentifier,t):o.then((()=>qe(e,n.serviceIdentifier,t)))}function Je(e,n){if(void 0===n)return;const t=function(e){const n=[];for(const t of e)Ue(t)&&t.scope===c.Singleton&&t.cache.isRight&&n.push(t);return n}(n),o=[];for(const n of t){const t=Ge(e,n);void 0!==t&&o.push(t)}return o.length>0?Promise.all(o).then((()=>{})):void 0}function Le(e,n){const t=e.getBindingsFromModule(n);return Je(e,t)}function Qe(e,n){const t=e.getBindings(n);return Je(e,t)}export{g as ActivationsService,m as BindingService,x as ClassElementMetadataKind,v as DeactivationsService,c as bindingScopeValues,a as bindingTypeValues,h as decorate,$ as getClassMetadata,N as inject,z as injectFromBase,K as injectable,H as multiInject,Q as named,X as optional,pe as plan,Y as postConstruct,Z as preDestroy,Ne as resolve,Le as resolveModuleDeactivations,Qe as resolveServiceDeactivations,_ as tagged,te as unmanaged};
|
|
1
|
+
import{getOwnReflectMetadata as e,updateOwnReflectMetadata as n,setReflectMetadata as t}from"@inversifyjs/reflect-metadata-utils";import{getBaseType as o}from"@inversifyjs/prototype-utils";import{stringifyServiceIdentifier as i,LazyServiceIdentifier as r,isPromise as s}from"@inversifyjs/common";const c={Request:"Request",Singleton:"Singleton",Transient:"Transient"},a={ConstantValue:"ConstantValue",DynamicValue:"DynamicValue",Factory:"Factory",Instance:"Instance",Provider:"Provider",ServiceRedirection:"ServiceRedirection"};function*u(...e){for(const n of e)yield*n}class d{#e;#n;#t;constructor(e){this.#e=new Map,this.#n={};for(const n of Reflect.ownKeys(e))this.#n[n]=new Map;this.#t=e}add(e,n){this.#o(e).push(n);for(const t of Reflect.ownKeys(n))this.#i(t,n[t]).push(e)}clone(){const e=Reflect.ownKeys(this.#t),n=new d(this.#t);this.#r(this.#e,n.#e);for(const t of e)this.#r(this.#n[t],n.#n[t]);return n}get(e,n){return this.#n[e].get(n)}getAllKeys(e){return this.#n[e].keys()}removeByRelation(e,n){const t=this.get(e,n);if(void 0===t)return;const o=new Set(t);for(const t of o){const o=this.#e.get(t);if(void 0===o)throw new Error("Expecting model relation, none found");for(const i of o)i[e]===n&&this.#s(t,i);this.#e.delete(t)}}#o(e){let n=this.#e.get(e);return void 0===n&&(n=[],this.#e.set(e,n)),n}#i(e,n){let t=this.#n[e].get(n);return void 0===t&&(t=[],this.#n[e].set(n,t)),t}#r(e,n){for(const[t,o]of e)n.set(t,[...o])}#s(e,n){for(const t of Reflect.ownKeys(n))this.#c(e,t,n[t])}#c(e,n,t){const o=this.#n[n].get(t);if(void 0!==o){const i=o.indexOf(e);-1!==i&&o.splice(i,1),0===o.length&&this.#n[n].delete(t)}}}var l,f,p;!function(e){e.moduleId="moduleId",e.serviceId="serviceId"}(l||(l={}));class m{#a;#u;constructor(e,n){this.#a=n??new d({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#u=e}static build(e){return new m(e)}add(e,n){this.#a.add(e,n)}clone(){return new m(this.#u,this.#a.clone())}get(e){const n=[],t=this.#a.get(l.serviceId,e);void 0!==t&&n.push(t);const o=this.#u?.get(e);if(void 0!==o&&n.push(o),0!==n.length)return u(...n)}removeAllByModuleId(e){this.#a.removeByRelation(l.moduleId,e)}removeAllByServiceId(e){this.#a.removeByRelation(l.serviceId,e)}}!function(e){e.moduleId="moduleId",e.serviceId="serviceId"}(f||(f={}));class g{#d;#u;constructor(e,n){this.#d=n??new d({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#u=e}static build(e){return new g(e)}clone(){return new g(this.#u,this.#d.clone())}get(e){return this.getNonParentBindings(e)??this.#u?.get(e)}getNonParentBindings(e){return this.#d.get(f.serviceId,e)}getNonParentBoundServices(){return this.#d.getAllKeys(f.serviceId)}getByModuleId(e){return this.#d.get(f.moduleId,e)??this.#u?.getByModuleId(e)}removeAllByModuleId(e){this.#d.removeByRelation(f.moduleId,e)}removeAllByServiceId(e){this.#d.removeByRelation(f.serviceId,e)}set(e){const n={[f.serviceId]:e.serviceIdentifier};void 0!==e.moduleId&&(n[f.moduleId]=e.moduleId),this.#d.add(e,n)}}!function(e){e.moduleId="moduleId",e.serviceId="serviceId"}(p||(p={}));class h{#l;#u;constructor(e,n){this.#l=n??new d({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#u=e}static build(e){return new h(e)}add(e,n){this.#l.add(e,n)}clone(){return new h(this.#u,this.#l.clone())}get(e){const n=[],t=this.#l.get(p.serviceId,e);void 0!==t&&n.push(t);const o=this.#u?.get(e);if(void 0!==o&&n.push(o),0!==n.length)return u(...n)}removeAllByModuleId(e){this.#l.removeByRelation(p.moduleId,e)}removeAllByServiceId(e){this.#l.removeByRelation(p.serviceId,e)}}function v(e,n,t){const o=Array.isArray(e)?e:[e];if(void 0!==t)if("number"!=typeof t)Reflect.decorate(o,n.prototype,t);else for(const e of o)e(n,void 0,t);else Reflect.decorate(o,n)}const y="@inversifyjs/core/classMetadataReflectKey";function w(){return{constructorArguments:[],lifecycle:{postConstructMethodName:void 0,preDestroyMethodName:void 0},properties:new Map,scope:void 0}}const M="@inversifyjs/core/pendingClassMetadataCountReflectKey";const I=Symbol.for("@inversifyjs/core/InversifyCoreError");class b extends Error{[I];kind;constructor(e,n,t){super(n,t),this[I]=!0,this.kind=e}static is(e){return"object"==typeof e&&null!==e&&!0===e[I]}static isErrorOfKind(e,n){return b.is(e)&&e.kind===n}}var j,C,$;function x(n){const t=e(n,y)??w();if(!function(n){const t=e(n,M);return void 0!==t&&0!==t}(n))return function(e,n){const t=[];if(n.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 ${n.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<n.length;++e)void 0===n[e]&&t.push(e);if(t.length>0)throw new b(j.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}" at constructor indexes "${t.join('", "')}".\n\nAre you using @inject, @multiInject or @unmanaged decorators at those indexes?\n\nIf you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`)}(n,t.constructorArguments),t;!function(e,n){const t=[];for(let o=0;o<n.constructorArguments.length;++o){const i=n.constructorArguments[o];void 0!==i&&i.kind!==C.unknown||t.push(` - Missing or incomplete metadata for type "${e.name}" at constructor argument with index ${o.toString()}.\nEvery constructor parameter must be decorated either with @inject, @multiInject or @unmanaged decorator.`)}for(const[o,i]of n.properties)i.kind===C.unknown&&t.push(` - Missing or incomplete metadata for type "${e.name}" at property "${o.toString()}".\nThis property must be decorated either with @inject or @multiInject decorator.`);if(0===t.length)throw new b(j.unknown,`Unexpected class metadata for type "${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${t.join("\n\n")}`)}(n,t)}function S(){return 0}function R(e){return t=>{void 0!==t&&t.kind===C.unknown&&n(e,M,S,(e=>e-1))}}function A(e,n){return(...t)=>o=>{if(void 0===o)return e(...t);if(o.kind===$.unmanaged)throw new b(j.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found");return n(o,...t)}}function T(e){if(e.kind!==C.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"}(C||(C={})),function(e){e[e.multipleInjection=0]="multipleInjection",e[e.singleInjection=1]="singleInjection",e[e.unmanaged=2]="unmanaged"}($||($={}));const D=A((function(e,n){return{kind:e,name:void 0,optional:!1,tags:new Map,value:n}}),(function(e,n,t){return T(e),{...e,kind:n,value:t}}));function k(e,n){return t=>{const o=t.properties.get(n);return t.properties.set(n,e(o)),t}}var B;function F(e,n,t,o){if(b.isErrorOfKind(o,j.injectionDecoratorConflict)){const i=function(e,n,t){if(void 0===t){if(void 0===n)throw new b(j.unknown,"Unexpected undefined property and index values");return{kind:B.property,property:n,targetClass:e.constructor}}return"number"==typeof t?{index:t,kind:B.parameter,targetClass:e}:{kind:B.method,method:n,targetClass:e}}(e,n,t);throw new b(j.injectionDecoratorConflict,`Unexpected injection error.\n\nCause:\n\n${o.message}\n\nDetails\n\n${function(e){switch(e.kind){case B.method:return`[class: "${e.targetClass.name}", method: "${e.method.toString()}"]`;case B.parameter:return`[class: "${e.targetClass.name}", index: "${e.index.toString()}"]`;case B.property:return`[class: "${e.targetClass.name}", property: "${e.property.toString()}"]`}}(i)}`,{cause:o})}throw o}function P(e,t){return(o,i,r)=>{try{void 0===r?function(e,t){const o=N(e,t);return(e,t)=>{n(e.constructor,y,w,k(o(e),t))}}(e,t)(o,i):"number"==typeof r?function(e,t){const o=N(e,t);return(e,t,i)=>{if(!function(e,n){return"function"==typeof e&&void 0===n}(e,t))throw new b(j.injectionDecoratorConflict,`Found an @inject decorator in a non constructor parameter.\nFound @inject decorator at method "${t?.toString()??""}" at class "${e.constructor.name}"`);n(e,y,w,function(e,n){return t=>{const o=t.constructorArguments[n];return t.constructorArguments[n]=e(o),t}}(o(e),i))}}(e,t)(o,i,r):function(e,t){const o=N(e,t);return(e,t,i)=>{if(!function(e){return void 0!==e.set}(i))throw new b(j.injectionDecoratorConflict,`Found an @inject decorator in a non setter property method.\nFound @inject decorator at method "${t.toString()}" at class "${e.constructor.name}"`);n(e.constructor,y,w,k(o(e),t))}}(e,t)(o,i,r)}catch(e){F(o,i,r,e)}}}function N(e,n){return t=>{const o=n(t);return n=>(o(n),e(n))}}function E(e){return P(D($.singleInjection,e),R)}!function(e){e[e.method=0]="method",e[e.parameter=1]="parameter",e[e.property=2]="property"}(B||(B={}));const O="@inversifyjs/core/classIsInjectableFlagReflectKey";const U=[Array,BigInt,Boolean,Function,Number,Object,String];function K(t){const o=e(t,"design:paramtypes");void 0!==o&&n(t,y,w,function(e){return n=>(e.forEach(((e,t)=>{var o;void 0!==n.constructorArguments[t]||(o=e,U.includes(o))||(n.constructorArguments[t]=function(e){return{isFromTypescriptParamType:!0,kind:$.singleInjection,name:void 0,optional:!1,tags:new Map,value:e}}(e))})),n)}(o))}function q(o){return i=>{!function(n){if(void 0!==e(n,O))throw new b(j.injectionDecoratorConflict,`Cannot apply @injectable decorator multiple times at class "${n.name}"`);t(n,O,!0)}(i),K(i),void 0!==o&&n(i,y,w,(e=>({...e,scope:o})))}}function V(e,n,t){let o;return e.extendConstructorArguments??!0?(o=[...n.constructorArguments],t.constructorArguments.map(((e,n)=>{o[n]=e}))):o=t.constructorArguments,o}function G(e,n,t){let o;return o=e.extendProperties??!0?new Map(u(n.properties,t.properties)):t.properties,o}function z(e){return t=>{const o=x(e.type);n(t,y,w,function(e,n){const t=t=>({constructorArguments:V(e,n,t),lifecycle:t.lifecycle,properties:G(e,n,t),scope:t.scope});return t}(e,o))}}function H(e){return n=>{const t=o(n);if(void 0===t)throw new b(j.injectionDecoratorConflict,`Expected base type for type "${n.name}", none found.`);z({...e,type:t})(n)}}function J(e){return P(D($.multipleInjection,e),R)}function L(e){return t=>{void 0===t&&n(e,M,S,(e=>e+1))}}function Q(e){return n=>{const t=n??{kind:C.unknown,name:void 0,optional:!1,tags:new Map};if(t.kind===$.unmanaged)throw new b(j.injectionDecoratorConflict,"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections");return e(t)}}function W(e){const n=Q(function(e){return n=>{if(void 0!==n.name)throw new b(j.injectionDecoratorConflict,"Unexpected duplicated named decorator");return n.name=e,n}}(e));return P(n,L)}function X(e){if(e.optional)throw new b(j.injectionDecoratorConflict,"Unexpected duplicated optional decorator");return e.optional=!0,e}function Y(){return P(Q(X),L)}function Z(){return(e,t,o)=>{try{n(e.constructor,y,w,(i=t,e=>{if(void 0!==e.lifecycle.postConstructMethodName)throw new b(j.injectionDecoratorConflict,"Unexpected duplicated postConstruct decorator");return e.lifecycle.postConstructMethodName=i,e}))}catch(n){F(e,t,void 0,n)}var i}}function _(){return(e,t,o)=>{try{n(e.constructor,y,w,(i=t,e=>{if(void 0!==e.lifecycle.preDestroyMethodName)throw new b(j.injectionDecoratorConflict,"Unexpected duplicated preDestroy decorator");return e.lifecycle.preDestroyMethodName=i,e}))}catch(n){F(e,t,void 0,n)}var i}}function ee(e,n){const t=Q(function(e,n){return t=>{if(t.tags.has(e))throw new b(j.injectionDecoratorConflict,"Unexpected duplicated tag decorator with existing tag");return t.tags.set(e,n),t}}(e,n));return P(t,L)}function ne(){return{kind:$.unmanaged}}const te=A(ne,(function(e){if(T(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 ne()}));function oe(){return P(te(),R)}class ie{#f;constructor(e){this.#f=e}get name(){return this.#f.elem.name}get tags(){return this.#f.elem.tags}get serviceIdentifier(){return this.#f.elem.serviceIdentifier}getAncestor(){if(void 0!==this.#f.previous)return new ie(this.#f.previous)}}class re{last;constructor(e){this.last=e}concat(e){return new re({elem:e,previous:this.last})}[Symbol.iterator](){let e=this.last;return{next:()=>{if(void 0===e)return{done:!0,value:void 0};const n=e.elem;return e=e.previous,{done:!1,value:n}}}}}function se(e,n){e.servicesBranch.has(n)&&function(e,n){const t=(o=[...e.servicesBranch,n],[...o].map(i).join(" -> "));var o;throw new b(j.planning,`Circular dependency found: ${t}`)}(e,n),e.servicesBranch.add(n)}function ce(e,n,t){const o=t?.customServiceIdentifier??n.serviceIdentifier;return[...e.getBindings(o)??[]].filter((e=>e.isSatisfiedBy(n)))}function ae(e){return void 0!==e.redirections}function ue(e,n,t,o){let r,s;ae(t)?(r=t.binding.targetServiceIdentifier,s=t.binding.serviceIdentifier):(r=t.serviceIdentifier,s=t.parent?.binding.serviceIdentifier),Array.isArray(e)?function(e,n,t,o,r){if(0!==e.length){const n=`Ambiguous bindings found for service: "${i(t)}".\n\nRegistered bindings:\n\n${e.map((e=>function(e){switch(e.type){case a.Instance:return`[ type: "${e.type}", serviceIdentifier: "${i(e.serviceIdentifier)}", scope: "${e.scope}", implementationType: "${e.implementationType.name}" ]`;case a.ServiceRedirection:return`[ type: "${e.type}", serviceIdentifier: "${i(e.serviceIdentifier)}", redirection: "${i(e.targetServiceIdentifier)}" ]`;default:return`[ type: "${e.type}", serviceIdentifier: "${i(e.serviceIdentifier)}", scope: "${e.scope}" ]`}}(e.binding))).join("\n")}\n\nTrying to resolve bindings for "${le(t,o)}".\n\n${fe(r)}`;throw new b(j.planning,n)}n||de(t,o,r)}(e,n,r,s,o):function(e,n,t,o,i){if(void 0!==e||n)return;de(t,o,i)}(e,n,r,s,o)}function de(e,n,t){const o=`No bindings found for service: "${i(e)}".\n\nTrying to resolve bindings for "${le(e,n)}".\n\n${fe(t)}`;throw new b(j.planning,o)}function le(e,n){return void 0===n?`${i(e)} (Root service)`:i(n)}function fe(e){const n=0===e.tags.size?"":`\n- tags:\n - ${[...e.tags.keys()].map((e=>e.toString())).join("\n - ")}`;return`Binding metadata:\n- service identifier: ${i(e.serviceIdentifier)}\n- name: ${e.name?.toString()??"-"}${n}`}function pe(e,n,t){if(1!==e.redirections.length)ue(e.redirections,n,e,t);else{const[o]=e.redirections;ae(o)&&pe(o,n,t)}}function me(e,n,t){if(Array.isArray(e.bindings)&&1===e.bindings.length){const[o]=e.bindings;ae(o)&&pe(o,n,t)}else ue(e.bindings,n,e,t)}function ge(e){const n=new Map;void 0!==e.rootConstraints.tag&&n.set(e.rootConstraints.tag.key,e.rootConstraints.tag.value);const t=new re({elem:{name:e.rootConstraints.name,serviceIdentifier:e.rootConstraints.serviceIdentifier,tags:n},previous:void 0}),o=new ie(t.last),i=ce(e,o),r=[],s={bindings:r,parent:void 0,serviceIdentifier:e.rootConstraints.serviceIdentifier};if(r.push(...ye(e,t,i,s)),!e.rootConstraints.isMultiple){me(s,e.rootConstraints.isOptional??!1,o);const[n]=r;s.bindings=n}return{tree:{root:s}}}function he(e,n,t,o){const i={binding:n,classMetadata:e.getClassMetadata(n.implementationType),constructorParams:[],parent:o,propertyParams:new Map};return function(e,n){const t=e.node.classMetadata;for(const[o,i]of t.constructorArguments.entries())e.node.constructorParams[o]=ve(e,n,i);for(const[o,i]of t.properties){const t=ve(e,n,i);void 0!==t&&e.node.propertyParams.set(o,t)}return e.node}({getBindings:e.getBindings,getClassMetadata:e.getClassMetadata,node:i,servicesBranch:e.servicesBranch},t)}function ve(e,n,t){if(t.kind===$.unmanaged)return;const o=r.is(t.value)?t.value.unwrap():t.value,i=n.concat({name:t.name,serviceIdentifier:o,tags:t.tags}),s=new ie(i.last),c=ce(e,s),a=[],u={bindings:a,parent:e.node,serviceIdentifier:o};if(a.push(...ye(e,i,c,u)),t.kind===$.singleInjection){me(u,t.optional,s);const[e]=a;u.bindings=e}return u}function ye(e,n,t,o){const i=ae(o)?o.binding.targetServiceIdentifier:o.serviceIdentifier;se(e,i);const r=[];for(const i of t)switch(i.type){case a.Instance:r.push(he(e,i,n,o));break;case a.ServiceRedirection:{const t=we(e,n,i,o);r.push(t);break}default:r.push({binding:i,parent:o})}return e.servicesBranch.delete(i),r}function we(e,n,t,o){const i={binding:t,parent:o,redirections:[]},r=ce(e,new ie(n.last),{customServiceIdentifier:t.targetServiceIdentifier});return i.redirections.push(...ye(e,n,r,i)),i}function Me(e,n,t){const o=e.getActivations(n);return void 0===o?t:s(t)?Ie(e,t,o[Symbol.iterator]()):function(e,n,t){let o=n,i=t.next();for(;!0!==i.done;){const n=i.value(e.context,o);if(s(n))return Ie(e,n,t);o=n,i=t.next()}return o}(e,t,o[Symbol.iterator]())}async function Ie(e,n,t){let o=await n,i=t.next();for(;!0!==i.done;)o=await i.value(e.context,o),i=t.next();return o}function be(e,n,t){let o=t;if(void 0!==n.onActivation){const t=n.onActivation;o=s(o)?o.then((n=>t(e.context,n))):t(e.context,o)}return Me(e,n.serviceIdentifier,o)}function je(e){return(n,t)=>{if(t.cache.isRight)return t.cache.value;const o=be(n,t,e(n,t));return t.cache={isRight:!0,value:o},o}}const Ce=je((function(e,n){return n.value}));function $e(e){return e}function xe(e,n){return(t,o)=>{const i=e(o);switch(i.scope){case c.Singleton:{if(i.cache.isRight)return i.cache.value;const e=Se(t,o,i,n);return i.cache={isRight:!0,value:e},e}case c.Request:{if(t.requestScopeCache.has(i.id))return t.requestScopeCache.get(i.id);const e=Se(t,o,i,n);return t.requestScopeCache.set(i.id,e),e}case c.Transient:return Se(t,o,i,n)}}}function Se(e,n,t,o){return be(e,t,o(e,n))}const Re=(e=>xe($e,e))((function(e,n){return n.value(e.context)}));const Ae=je((function(e,n){return n.factory(e.context)}));function Te(e,n,t){const o=function(e,n,t){if(void 0===t)return;if(!(t in e))throw new b(j.resolution,`Expecting a "${t.toString()}" property when resolving "${n.implementationType.name}" class @postConstruct decorated method, none found.`);if("function"!=typeof e[t])throw new b(j.resolution,`Expecting a "${t.toString()}" method when resolving "${n.implementationType.name}" class @postConstruct decorated method, a non function property was found instead.`);{let o;try{o=e[t]()}catch(e){throw new b(j.resolution,`Unexpected error found when calling "${t.toString()}" @postConstruct decorated method on class "${n.implementationType.name}"`,{cause:e})}if(s(o))return async function(e,n,t){try{await t}catch(t){throw new b(j.resolution,`Unexpected error found when calling "${n.toString()}" @postConstruct decorated method on class "${e.implementationType.name}"`,{cause:t})}}(n,t,o)}}(e,n,t);return s(o)?o.then((()=>e)):e}function De(e){return(n,t,o)=>{const i=new o.binding.implementationType(...n),r=e(t,i,o);return s(r)?r.then((()=>Te(i,o.binding,o.classMetadata.lifecycle.postConstructMethodName))):Te(i,o.binding,o.classMetadata.lifecycle.postConstructMethodName)}}const ke=je((function(e,n){return n.provider(e.context)}));function Be(e){return e.binding}const Fe=function(e){return(n,t,o)=>{const i=[];for(const[r,c]of o.propertyParams){const a=o.classMetadata.properties.get(r);if(void 0===a)throw new b(j.resolution,`Expecting metadata at property "${r.toString()}", none found`);a.kind!==$.unmanaged&&void 0!==c.bindings&&(t[r]=e(n,c),s(t[r])&&i.push((async()=>{t[r]=await t[r]})()))}if(i.length>0)return Promise.all(i).then((()=>{}))}}(Ke),Pe=function(e){return function n(t,o){const i=[];for(const r of o.redirections)ae(r)?i.push(...n(t,r)):i.push(e(t,r));return i}}(Ue),Ne=function(e,n,t){return(o,i)=>{const r=e(o,i);return s(r)?n(r,o,i):t(r,o,i)}}(function(e){return(n,t)=>{const o=[];for(const i of t.constructorParams)void 0===i?o.push(void 0):o.push(e(n,i));return o.some(s)?Promise.all(o):o}}(Ke),function(e){return async(n,t,o)=>{const i=await n;return e(i,t,o)}}(De(Fe)),De(Fe)),Ee=(e=>xe(Be,e))(Ne);function Oe(e){return Ke(e,e.planResult.tree.root)}function Ue(e,n){switch(n.binding.type){case a.ConstantValue:return Ce(e,n.binding);case a.DynamicValue:return Re(e,n.binding);case a.Factory:return Ae(e,n.binding);case a.Instance:return Ee(e,n);case a.Provider:return ke(e,n.binding)}}function Ke(e,n){if(void 0!==n.bindings)return Array.isArray(n.bindings)?function(e,n){const t=[];for(const o of n)ae(o)?t.push(...Pe(e,o)):t.push(Ue(e,o));if(t.some(s))return Promise.all(t);return t}(e,n.bindings):function(e,n){if(ae(n)){const t=Pe(e,n);if(1===t.length)return t[0];throw new b(j.resolution,"Unexpected multiple resolved values on single injection")}return Ue(e,n)}(e,n.bindings)}function qe(e){return void 0!==e.scope}function Ve(e,n){if(void 0!==e.lifecycle.preDestroyMethodName&&"function"==typeof n[e.lifecycle.preDestroyMethodName])return n[e.lifecycle.preDestroyMethodName]()}function Ge(e,n,t){const o=e.getDeactivations(n);if(void 0!==o)return s(t)?ze(t,o[Symbol.iterator]()):function(e,n){let t=n.next();for(;!0!==t.done;){const o=t.value(e);if(s(o))return ze(e,n);t=n.next()}}(t,o[Symbol.iterator]())}async function ze(e,n){const t=await e;let o=n.next();for(;!0!==o.done;)await o.value(t),o=n.next()}function He(e,n){const t=function(e,n){if(n.type===a.Instance){const t=e.getClassMetadata(n.implementationType),o=n.cache.value;return s(o)?o.then((e=>Ve(t,e))):Ve(t,o)}}(e,n);return void 0===t?Je(e,n):t.then((()=>Je(e,n)))}function Je(e,n){const t=n.cache;return s(t.value)?t.value.then((t=>Le(e,n,t))):Le(e,n,t.value)}function Le(e,n,t){let o;if(void 0!==n.onDeactivation){o=(0,n.onDeactivation)(t)}return void 0===o?Ge(e,n.serviceIdentifier,t):o.then((()=>Ge(e,n.serviceIdentifier,t)))}function Qe(e,n){if(void 0===n)return;const t=function(e){const n=[];for(const t of e)qe(t)&&t.scope===c.Singleton&&t.cache.isRight&&n.push(t);return n}(n),o=[];for(const n of t){const t=He(e,n);void 0!==t&&o.push(t)}return o.length>0?Promise.all(o).then((()=>{})):void 0}function We(e,n){const t=e.getBindingsFromModule(n);return Qe(e,t)}function Xe(e,n){const t=e.getBindings(n);return Qe(e,t)}export{m as ActivationsService,g as BindingService,$ as ClassElementMetadataKind,h as DeactivationsService,c as bindingScopeValues,a as bindingTypeValues,v as decorate,x as getClassMetadata,E as inject,H as injectFromBase,q as injectable,J as multiInject,W as named,Y as optional,ge as plan,Z as postConstruct,_ as preDestroy,Oe as resolve,We as resolveModuleDeactivations,Xe as resolveServiceDeactivations,ee as tagged,oe as unmanaged};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|