inversify 6.0.3 → 6.1.1
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 +14 -0
- package/README.md +14 -14
- package/amd/annotation/decorator_utils.js +3 -1
- package/amd/annotation/inject_base.js +1 -1
- package/amd/annotation/lazy_service_identifier.js +0 -11
- package/amd/bindings/binding.js +3 -2
- package/amd/bindings/binding_count.js +6 -5
- package/amd/constants/error_msgs.js +18 -18
- package/amd/constants/literal_types.js +3 -3
- package/amd/container/container.js +73 -34
- package/amd/container/lookup.js +15 -14
- package/amd/container/module_activation_store.js +8 -10
- package/amd/interfaces/interfaces.js +0 -5
- package/amd/inversify.js +3 -5
- package/amd/planning/metadata_reader.js +5 -3
- package/amd/planning/planner.js +31 -13
- package/amd/planning/queryable_string.js +5 -2
- package/amd/planning/reflection_utils.js +6 -112
- package/amd/planning/request.js +2 -4
- package/amd/planning/target.js +9 -3
- package/amd/resolution/instantiation.js +10 -5
- package/amd/resolution/resolver.js +19 -10
- package/amd/scope/scope.js +1 -1
- package/amd/syntax/binding_to_syntax.js +14 -7
- package/amd/syntax/binding_when_syntax.js +13 -8
- package/amd/syntax/constraint_helpers.js +4 -3
- package/amd/utils/async.js +3 -2
- package/amd/utils/binding_utils.js +8 -3
- package/amd/utils/clonable.js +4 -4
- package/amd/utils/exceptions.js +1 -1
- package/amd/utils/serialization.js +11 -8
- package/es/annotation/decorator_utils.js +3 -1
- package/es/annotation/inject_base.js +1 -1
- package/es/annotation/lazy_service_identifier.js +1 -10
- package/es/annotation/target_name.js +3 -3
- package/es/bindings/binding.js +3 -2
- package/es/bindings/binding_count.js +6 -5
- package/es/constants/error_msgs.js +17 -17
- package/es/constants/literal_types.js +3 -3
- package/es/container/container.js +74 -35
- package/es/container/lookup.js +15 -14
- package/es/container/module_activation_store.js +8 -10
- package/es/interfaces/interfaces.js +1 -5
- package/es/inversify.js +4 -6
- package/es/planning/metadata_reader.js +5 -3
- package/es/planning/planner.js +34 -16
- package/es/planning/queryable_string.js +5 -2
- package/es/planning/reflection_utils.js +6 -114
- package/es/planning/request.js +2 -4
- package/es/planning/target.js +9 -3
- package/es/resolution/instantiation.js +11 -6
- package/es/resolution/resolver.js +20 -11
- package/es/scope/scope.js +1 -1
- package/es/syntax/binding_to_syntax.js +18 -11
- package/es/syntax/binding_when_syntax.js +14 -9
- package/es/syntax/constraint_helpers.js +5 -4
- package/es/utils/async.js +3 -2
- package/es/utils/binding_utils.js +8 -3
- package/es/utils/clonable.js +4 -4
- package/es/utils/exceptions.js +1 -1
- package/es/utils/serialization.js +12 -9
- package/es6/annotation/decorator_utils.js +5 -3
- package/es6/annotation/inject_base.js +1 -1
- package/es6/annotation/lazy_service_identifier.js +0 -10
- package/es6/bindings/binding.js +3 -2
- package/es6/bindings/binding_count.js +6 -5
- package/es6/constants/error_msgs.js +5 -9
- package/es6/constants/literal_types.js +3 -3
- package/es6/container/container.js +59 -42
- package/es6/container/lookup.js +15 -14
- package/es6/container/module_activation_store.js +8 -10
- package/es6/interfaces/interfaces.js +0 -5
- package/es6/inversify.js +3 -7
- package/es6/planning/metadata_reader.js +5 -3
- package/es6/planning/planner.js +31 -13
- package/es6/planning/queryable_string.js +5 -2
- package/es6/planning/reflection_utils.js +4 -110
- package/es6/planning/request.js +2 -4
- package/es6/planning/target.js +3 -1
- package/es6/resolution/instantiation.js +9 -5
- package/es6/resolution/resolver.js +11 -8
- package/es6/scope/scope.js +1 -1
- package/es6/syntax/binding_to_syntax.js +5 -4
- package/es6/syntax/binding_when_syntax.js +13 -8
- package/es6/syntax/constraint_helpers.js +4 -3
- package/es6/utils/async.js +3 -2
- package/es6/utils/binding_utils.js +10 -3
- package/es6/utils/clonable.js +4 -4
- package/es6/utils/exceptions.js +1 -1
- package/es6/utils/serialization.js +11 -8
- package/lib/annotation/decorator_utils.d.ts +2 -2
- package/lib/annotation/decorator_utils.js +3 -1
- package/lib/annotation/inject.d.ts +4 -1
- package/lib/annotation/inject_base.d.ts +3 -2
- package/lib/annotation/inject_base.js +1 -1
- package/lib/annotation/lazy_service_identifier.d.ts +1 -5
- package/lib/annotation/lazy_service_identifier.js +0 -11
- package/lib/annotation/multi_inject.d.ts +4 -1
- package/lib/annotation/tagged.d.ts +1 -1
- package/lib/annotation/target_name.d.ts +1 -1
- package/lib/bindings/binding.js +3 -2
- package/lib/bindings/binding_count.d.ts +5 -5
- package/lib/bindings/binding_count.js +6 -5
- package/lib/constants/error_msgs.d.ts +18 -20
- package/lib/constants/error_msgs.js +18 -18
- package/lib/constants/literal_types.js +3 -3
- package/lib/constants/metadata_keys.d.ts +12 -12
- package/lib/container/container.d.ts +2 -2
- package/lib/container/container.js +73 -34
- package/lib/container/lookup.d.ts +2 -1
- package/lib/container/lookup.js +15 -14
- package/lib/container/module_activation_store.d.ts +1 -1
- package/lib/container/module_activation_store.js +8 -10
- package/lib/interfaces/interfaces.d.ts +14 -29
- package/lib/interfaces/interfaces.js +0 -5
- package/lib/inversify.d.ts +5 -6
- package/lib/inversify.js +3 -7
- package/lib/planning/metadata_reader.js +5 -3
- package/lib/planning/planner.js +31 -13
- package/lib/planning/queryable_string.d.ts +2 -3
- package/lib/planning/queryable_string.js +5 -2
- package/lib/planning/reflection_utils.js +6 -114
- package/lib/planning/request.d.ts +2 -2
- package/lib/planning/request.js +2 -4
- package/lib/planning/target.d.ts +1 -1
- package/lib/planning/target.js +9 -3
- package/lib/resolution/instantiation.js +10 -5
- package/lib/resolution/resolver.js +19 -10
- package/lib/scope/scope.js +1 -1
- package/lib/syntax/binding_in_syntax.d.ts +1 -1
- package/lib/syntax/binding_in_when_on_syntax.d.ts +7 -7
- package/lib/syntax/binding_on_syntax.d.ts +1 -1
- package/lib/syntax/binding_to_syntax.d.ts +4 -4
- package/lib/syntax/binding_to_syntax.js +14 -7
- package/lib/syntax/binding_when_on_syntax.d.ts +6 -6
- package/lib/syntax/binding_when_syntax.d.ts +4 -4
- package/lib/syntax/binding_when_syntax.js +13 -8
- package/lib/syntax/constraint_helpers.d.ts +2 -2
- package/lib/syntax/constraint_helpers.js +4 -3
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/async.js +3 -2
- package/lib/utils/binding_utils.js +8 -3
- package/lib/utils/clonable.js +4 -4
- package/lib/utils/exceptions.js +1 -1
- package/lib/utils/serialization.d.ts +3 -3
- package/lib/utils/serialization.js +11 -8
- package/package.json +19 -5
- package/.nyc_output/c29b2307-4e95-47d0-b220-9efcfa7ee49f.json +0 -1
- package/.nyc_output/processinfo/c29b2307-4e95-47d0-b220-9efcfa7ee49f.json +0 -1
- package/.nyc_output/processinfo/index.json +0 -1
package/es6/utils/async.js
CHANGED
|
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.isPromise = isPromise;
|
|
4
4
|
exports.isPromiseOrContainsPromise = isPromiseOrContainsPromise;
|
|
5
5
|
function isPromise(object) {
|
|
6
|
-
const isObjectOrFunction = (typeof object === 'object' && object !== null) ||
|
|
7
|
-
|
|
6
|
+
const isObjectOrFunction = (typeof object === 'object' && object !== null) ||
|
|
7
|
+
typeof object === 'function';
|
|
8
|
+
return (isObjectOrFunction && typeof object.then === 'function');
|
|
8
9
|
}
|
|
9
10
|
function isPromiseOrContainsPromise(object) {
|
|
10
11
|
if (isPromise(object)) {
|
|
@@ -24,11 +24,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.getFactoryDetails = exports.ensureFullyBound = exports.multiBindToService = void 0;
|
|
27
|
-
const serialization_1 = require("../utils/serialization");
|
|
28
27
|
const ERROR_MSGS = __importStar(require("../constants/error_msgs"));
|
|
29
28
|
const literal_types_1 = require("../constants/literal_types");
|
|
29
|
+
const serialization_1 = require("../utils/serialization");
|
|
30
30
|
const factory_type_1 = require("./factory_type");
|
|
31
|
-
const multiBindToService = (container) => (service) => (...types) =>
|
|
31
|
+
const multiBindToService = (container) => (service) => (...types) => {
|
|
32
|
+
types.forEach((t) => {
|
|
33
|
+
container.bind(t).toService(service);
|
|
34
|
+
});
|
|
35
|
+
};
|
|
32
36
|
exports.multiBindToService = multiBindToService;
|
|
33
37
|
const ensureFullyBound = (binding) => {
|
|
34
38
|
let boundValue = null;
|
|
@@ -64,7 +68,10 @@ const getFactoryDetails = (binding) => {
|
|
|
64
68
|
case literal_types_1.BindingTypeEnum.Provider:
|
|
65
69
|
return { factory: binding.provider, factoryType: factory_type_1.FactoryType.Provider };
|
|
66
70
|
case literal_types_1.BindingTypeEnum.DynamicValue:
|
|
67
|
-
return {
|
|
71
|
+
return {
|
|
72
|
+
factory: binding.dynamicValue,
|
|
73
|
+
factoryType: factory_type_1.FactoryType.DynamicValue,
|
|
74
|
+
};
|
|
68
75
|
default:
|
|
69
76
|
throw new Error(`Unexpected factory type ${binding.type}`);
|
|
70
77
|
}
|
package/es6/utils/clonable.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isClonable = isClonable;
|
|
4
4
|
function isClonable(obj) {
|
|
5
|
-
return (typeof obj === 'object'
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
return (typeof obj === 'object' &&
|
|
6
|
+
obj !== null &&
|
|
7
|
+
'clone' in obj &&
|
|
8
|
+
typeof obj.clone === 'function');
|
|
9
9
|
}
|
package/es6/utils/exceptions.js
CHANGED
|
@@ -32,15 +32,13 @@ exports.getSymbolDescription = getSymbolDescription;
|
|
|
32
32
|
const ERROR_MSGS = __importStar(require("../constants/error_msgs"));
|
|
33
33
|
function getServiceIdentifierAsString(serviceIdentifier) {
|
|
34
34
|
if (typeof serviceIdentifier === 'function') {
|
|
35
|
-
|
|
36
|
-
return _serviceIdentifier.name;
|
|
35
|
+
return serviceIdentifier.name;
|
|
37
36
|
}
|
|
38
37
|
else if (typeof serviceIdentifier === 'symbol') {
|
|
39
38
|
return serviceIdentifier.toString();
|
|
40
39
|
}
|
|
41
40
|
else {
|
|
42
|
-
|
|
43
|
-
return _serviceIdentifier;
|
|
41
|
+
return serviceIdentifier;
|
|
44
42
|
}
|
|
45
43
|
}
|
|
46
44
|
function listRegisteredBindingsForServiceIdentifier(container, serviceIdentifier, getBindings) {
|
|
@@ -101,11 +99,11 @@ function listMetadataForTarget(serviceIdentifierString, target) {
|
|
|
101
99
|
const namedTag = target.getNamedTag();
|
|
102
100
|
const otherTags = target.getCustomTags();
|
|
103
101
|
if (namedTag !== null) {
|
|
104
|
-
m += namedTag
|
|
102
|
+
m += stringifyMetadata(namedTag) + '\n';
|
|
105
103
|
}
|
|
106
104
|
if (otherTags !== null) {
|
|
107
105
|
otherTags.forEach((tag) => {
|
|
108
|
-
m += tag
|
|
106
|
+
m += stringifyMetadata(tag) + '\n';
|
|
109
107
|
});
|
|
110
108
|
}
|
|
111
109
|
return ` ${serviceIdentifierString}\n ${serviceIdentifierString} - ${m}`;
|
|
@@ -115,15 +113,20 @@ function listMetadataForTarget(serviceIdentifierString, target) {
|
|
|
115
113
|
}
|
|
116
114
|
}
|
|
117
115
|
function getFunctionName(func) {
|
|
118
|
-
if (func.name) {
|
|
116
|
+
if (func.name != null && func.name !== '') {
|
|
119
117
|
return func.name;
|
|
120
118
|
}
|
|
121
119
|
else {
|
|
122
120
|
const name = func.toString();
|
|
123
121
|
const match = name.match(/^function\s*([^\s(]+)/);
|
|
124
|
-
return match
|
|
122
|
+
return match === null
|
|
123
|
+
? `Anonymous function: ${name}`
|
|
124
|
+
: match[1];
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
function getSymbolDescription(symbol) {
|
|
128
128
|
return symbol.toString().slice(7, -1);
|
|
129
129
|
}
|
|
130
|
+
function stringifyMetadata(metadata) {
|
|
131
|
+
return `{"key":"${metadata.key.toString()}","value":"${metadata.value.toString()}"}`;
|
|
132
|
+
}
|
|
@@ -5,12 +5,12 @@ type Prototype<T> = {
|
|
|
5
5
|
constructor: NewableFunction;
|
|
6
6
|
};
|
|
7
7
|
interface ConstructorFunction<T = Record<string, unknown>> {
|
|
8
|
-
new (...args: unknown[]): T;
|
|
9
8
|
prototype: Prototype<T>;
|
|
9
|
+
new (...args: unknown[]): T;
|
|
10
10
|
}
|
|
11
11
|
export type DecoratorTarget<T = unknown> = ConstructorFunction<T> | Prototype<T>;
|
|
12
12
|
declare function tagParameter(annotationTarget: DecoratorTarget, parameterName: string | symbol | undefined, parameterIndex: number, metadata: interfaces.MetadataOrMetadataArray): void;
|
|
13
13
|
declare function tagProperty(annotationTarget: DecoratorTarget, propertyName: string | symbol, metadata: interfaces.MetadataOrMetadataArray): void;
|
|
14
14
|
declare function createTaggedDecorator(metadata: interfaces.MetadataOrMetadataArray): <T>(target: DecoratorTarget, targetKey?: string | symbol, indexOrPropertyDescriptor?: number | TypedPropertyDescriptor<T>) => void;
|
|
15
|
-
declare function decorate(decorator:
|
|
15
|
+
declare function decorate(decorator: DecoratorTarget | ParameterDecorator | MethodDecorator, target: object, parameterIndexOrProperty?: number | string): void;
|
|
16
16
|
export { decorate, tagParameter, tagProperty, createTaggedDecorator };
|
|
@@ -101,7 +101,9 @@ function _decorate(decorators, target) {
|
|
|
101
101
|
Reflect.decorate(decorators, target);
|
|
102
102
|
}
|
|
103
103
|
function _param(paramIndex, decorator) {
|
|
104
|
-
return function (target, key) {
|
|
104
|
+
return function (target, key) {
|
|
105
|
+
decorator(target, key, paramIndex);
|
|
106
|
+
};
|
|
105
107
|
}
|
|
106
108
|
function decorate(decorator, target, parameterIndexOrProperty) {
|
|
107
109
|
if (typeof parameterIndexOrProperty === 'number') {
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { LazyServiceIdentifier } from '@inversifyjs/common';
|
|
2
|
+
import { interfaces } from '../interfaces/interfaces';
|
|
3
|
+
import { DecoratorTarget } from './decorator_utils';
|
|
4
|
+
declare const inject: <T = unknown>(serviceIdentifier: interfaces.ServiceIdentifier<T> | LazyServiceIdentifier<T>) => (target: DecoratorTarget, targetKey?: string | symbol, indexOrPropertyDescriptor?: number | TypedPropertyDescriptor<T>) => void;
|
|
2
5
|
export { inject };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LazyServiceIdentifier } from '@inversifyjs/common';
|
|
2
|
+
import { interfaces } from '../interfaces/interfaces';
|
|
1
3
|
import { DecoratorTarget } from './decorator_utils';
|
|
2
|
-
|
|
3
|
-
export declare function injectBase(metadataKey: string): <T = unknown>(serviceIdentifier: ServiceIdentifierOrFunc<T>) => (target: DecoratorTarget, targetKey?: string | symbol, indexOrPropertyDescriptor?: number | TypedPropertyDescriptor<T>) => void;
|
|
4
|
+
export declare function injectBase(metadataKey: string): <T = unknown>(serviceIdentifier: interfaces.ServiceIdentifier<T> | LazyServiceIdentifier<T>) => (target: DecoratorTarget, targetKey?: string | symbol, indexOrPropertyDescriptor?: number | TypedPropertyDescriptor<T>) => void;
|
|
@@ -11,7 +11,7 @@ function injectBase(metadataKey) {
|
|
|
11
11
|
var className = typeof target === 'function' ? target.name : target.constructor.name;
|
|
12
12
|
throw new Error((0, error_msgs_1.UNDEFINED_INJECT_ANNOTATION)(className));
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
(0, decorator_utils_1.createTaggedDecorator)(new metadata_1.Metadata(metadataKey, serviceIdentifier))(target, targetKey, indexOrPropertyDescriptor);
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
17
|
}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
+
import { LazyServiceIdentifier } from '@inversifyjs/common';
|
|
1
2
|
import { interfaces } from '../interfaces/interfaces';
|
|
2
3
|
export type ServiceIdentifierOrFunc<T> = interfaces.ServiceIdentifier<T> | LazyServiceIdentifier<T>;
|
|
3
|
-
export declare class LazyServiceIdentifier<T = unknown> {
|
|
4
|
-
private _cb;
|
|
5
|
-
constructor(cb: () => interfaces.ServiceIdentifier<T>);
|
|
6
|
-
unwrap(): interfaces.ServiceIdentifier<T>;
|
|
7
|
-
}
|
|
@@ -1,13 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LazyServiceIdentifier = void 0;
|
|
4
|
-
var LazyServiceIdentifier = (function () {
|
|
5
|
-
function LazyServiceIdentifier(cb) {
|
|
6
|
-
this._cb = cb;
|
|
7
|
-
}
|
|
8
|
-
LazyServiceIdentifier.prototype.unwrap = function () {
|
|
9
|
-
return this._cb();
|
|
10
|
-
};
|
|
11
|
-
return LazyServiceIdentifier;
|
|
12
|
-
}());
|
|
13
|
-
exports.LazyServiceIdentifier = LazyServiceIdentifier;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { LazyServiceIdentifier } from '@inversifyjs/common';
|
|
2
|
+
import { interfaces } from '../interfaces/interfaces';
|
|
3
|
+
import { DecoratorTarget } from './decorator_utils';
|
|
4
|
+
declare const multiInject: <T = unknown>(serviceIdentifier: interfaces.ServiceIdentifier<T> | LazyServiceIdentifier<T>) => (target: DecoratorTarget, targetKey?: string | symbol, indexOrPropertyDescriptor?: number | TypedPropertyDescriptor<T>) => void;
|
|
2
5
|
export { multiInject };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function tagged
|
|
1
|
+
declare function tagged(metadataKey: string | number | symbol, metadataValue: unknown): <T>(target: import("./decorator_utils").DecoratorTarget, targetKey?: string | symbol, indexOrPropertyDescriptor?: number | TypedPropertyDescriptor<T>) => void;
|
|
2
2
|
export { tagged };
|
package/lib/bindings/binding.js
CHANGED
|
@@ -10,7 +10,7 @@ var Binding = (function () {
|
|
|
10
10
|
this.serviceIdentifier = serviceIdentifier;
|
|
11
11
|
this.scope = scope;
|
|
12
12
|
this.type = literal_types_1.BindingTypeEnum.Invalid;
|
|
13
|
-
this.constraint = function (
|
|
13
|
+
this.constraint = function (_request) { return true; };
|
|
14
14
|
this.implementationType = null;
|
|
15
15
|
this.cache = null;
|
|
16
16
|
this.factory = null;
|
|
@@ -21,7 +21,8 @@ var Binding = (function () {
|
|
|
21
21
|
}
|
|
22
22
|
Binding.prototype.clone = function () {
|
|
23
23
|
var clone = new Binding(this.serviceIdentifier, this.scope);
|
|
24
|
-
clone.activated =
|
|
24
|
+
clone.activated =
|
|
25
|
+
clone.scope === literal_types_1.BindingScopeEnum.Singleton ? this.activated : false;
|
|
25
26
|
clone.implementationType = this.implementationType;
|
|
26
27
|
clone.dynamicValue = this.dynamicValue;
|
|
27
28
|
clone.scope = this.scope;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
MultipleBindingsAvailable
|
|
3
|
-
NoBindingsAvailable
|
|
4
|
-
OnlyOneBindingAvailable
|
|
5
|
-
}
|
|
1
|
+
export declare enum BindingCount {
|
|
2
|
+
MultipleBindingsAvailable = 2,
|
|
3
|
+
NoBindingsAvailable = 0,
|
|
4
|
+
OnlyOneBindingAvailable = 1
|
|
5
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BindingCount = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
var BindingCount;
|
|
5
|
+
(function (BindingCount) {
|
|
6
|
+
BindingCount[BindingCount["MultipleBindingsAvailable"] = 2] = "MultipleBindingsAvailable";
|
|
7
|
+
BindingCount[BindingCount["NoBindingsAvailable"] = 0] = "NoBindingsAvailable";
|
|
8
|
+
BindingCount[BindingCount["OnlyOneBindingAvailable"] = 1] = "OnlyOneBindingAvailable";
|
|
9
|
+
})(BindingCount || (exports.BindingCount = BindingCount = {}));
|
|
@@ -1,32 +1,30 @@
|
|
|
1
|
-
export declare const DUPLICATED_INJECTABLE_DECORATOR
|
|
2
|
-
export declare const DUPLICATED_METADATA
|
|
3
|
-
export declare const NULL_ARGUMENT
|
|
4
|
-
export declare const KEY_NOT_FOUND
|
|
5
|
-
export declare const AMBIGUOUS_MATCH
|
|
6
|
-
export declare const CANNOT_UNBIND
|
|
7
|
-
export declare const NOT_REGISTERED
|
|
8
|
-
export declare const MISSING_INJECTABLE_ANNOTATION
|
|
9
|
-
export declare const MISSING_INJECT_ANNOTATION = "Missing required @inject or @multiInject annotation in:";
|
|
1
|
+
export declare const DUPLICATED_INJECTABLE_DECORATOR: string;
|
|
2
|
+
export declare const DUPLICATED_METADATA: string;
|
|
3
|
+
export declare const NULL_ARGUMENT: string;
|
|
4
|
+
export declare const KEY_NOT_FOUND: string;
|
|
5
|
+
export declare const AMBIGUOUS_MATCH: string;
|
|
6
|
+
export declare const CANNOT_UNBIND: string;
|
|
7
|
+
export declare const NOT_REGISTERED: string;
|
|
8
|
+
export declare const MISSING_INJECTABLE_ANNOTATION: string;
|
|
10
9
|
export declare const UNDEFINED_INJECT_ANNOTATION: (name: string) => string;
|
|
11
|
-
export declare const CIRCULAR_DEPENDENCY
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const INVALID_FUNCTION_BINDING = "Value provided to function binding must be a function!";
|
|
10
|
+
export declare const CIRCULAR_DEPENDENCY: string;
|
|
11
|
+
export declare const INVALID_BINDING_TYPE: string;
|
|
12
|
+
export declare const NO_MORE_SNAPSHOTS_AVAILABLE: string;
|
|
13
|
+
export declare const INVALID_MIDDLEWARE_RETURN: string;
|
|
14
|
+
export declare const INVALID_FUNCTION_BINDING: string;
|
|
17
15
|
export declare const LAZY_IN_SYNC: (key: unknown) => string;
|
|
18
16
|
export declare const INVALID_TO_SELF_VALUE: string;
|
|
19
17
|
export declare const INVALID_DECORATOR_OPERATION: string;
|
|
20
|
-
export declare const ARGUMENTS_LENGTH_MISMATCH: (
|
|
18
|
+
export declare const ARGUMENTS_LENGTH_MISMATCH: (name: string) => string;
|
|
21
19
|
export declare const CONTAINER_OPTIONS_MUST_BE_AN_OBJECT: string;
|
|
22
20
|
export declare const CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE: string;
|
|
23
21
|
export declare const CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE: string;
|
|
24
22
|
export declare const CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK: string;
|
|
25
|
-
export declare const MULTIPLE_PRE_DESTROY_METHODS
|
|
26
|
-
export declare const MULTIPLE_POST_CONSTRUCT_METHODS
|
|
27
|
-
export declare const ASYNC_UNBIND_REQUIRED
|
|
23
|
+
export declare const MULTIPLE_PRE_DESTROY_METHODS: string;
|
|
24
|
+
export declare const MULTIPLE_POST_CONSTRUCT_METHODS: string;
|
|
25
|
+
export declare const ASYNC_UNBIND_REQUIRED: string;
|
|
28
26
|
export declare const POST_CONSTRUCT_ERROR: (clazz: string, errorMessage: string) => string;
|
|
29
27
|
export declare const PRE_DESTROY_ERROR: (clazz: string, errorMessage: string) => string;
|
|
30
28
|
export declare const ON_DEACTIVATION_ERROR: (clazz: string, errorMessage: string) => string;
|
|
31
29
|
export declare const CIRCULAR_DEPENDENCY_IN_FACTORY: (factoryType: string, serviceIdentifier: string) => string;
|
|
32
|
-
export declare const STACK_OVERFLOW
|
|
30
|
+
export declare const STACK_OVERFLOW: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.STACK_OVERFLOW = exports.CIRCULAR_DEPENDENCY_IN_FACTORY = exports.ON_DEACTIVATION_ERROR = exports.PRE_DESTROY_ERROR = exports.POST_CONSTRUCT_ERROR = exports.ASYNC_UNBIND_REQUIRED = exports.MULTIPLE_POST_CONSTRUCT_METHODS = exports.MULTIPLE_PRE_DESTROY_METHODS = exports.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK = exports.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE = exports.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE = exports.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT = exports.ARGUMENTS_LENGTH_MISMATCH = exports.INVALID_DECORATOR_OPERATION = exports.INVALID_TO_SELF_VALUE = exports.LAZY_IN_SYNC = exports.INVALID_FUNCTION_BINDING = exports.INVALID_MIDDLEWARE_RETURN = exports.NO_MORE_SNAPSHOTS_AVAILABLE = exports.INVALID_BINDING_TYPE = exports.
|
|
3
|
+
exports.STACK_OVERFLOW = exports.CIRCULAR_DEPENDENCY_IN_FACTORY = exports.ON_DEACTIVATION_ERROR = exports.PRE_DESTROY_ERROR = exports.POST_CONSTRUCT_ERROR = exports.ASYNC_UNBIND_REQUIRED = exports.MULTIPLE_POST_CONSTRUCT_METHODS = exports.MULTIPLE_PRE_DESTROY_METHODS = exports.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK = exports.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE = exports.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE = exports.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT = exports.ARGUMENTS_LENGTH_MISMATCH = exports.INVALID_DECORATOR_OPERATION = exports.INVALID_TO_SELF_VALUE = exports.LAZY_IN_SYNC = exports.INVALID_FUNCTION_BINDING = exports.INVALID_MIDDLEWARE_RETURN = exports.NO_MORE_SNAPSHOTS_AVAILABLE = exports.INVALID_BINDING_TYPE = exports.CIRCULAR_DEPENDENCY = exports.UNDEFINED_INJECT_ANNOTATION = exports.MISSING_INJECTABLE_ANNOTATION = exports.NOT_REGISTERED = exports.CANNOT_UNBIND = exports.AMBIGUOUS_MATCH = exports.KEY_NOT_FOUND = exports.NULL_ARGUMENT = exports.DUPLICATED_METADATA = exports.DUPLICATED_INJECTABLE_DECORATOR = void 0;
|
|
4
4
|
exports.DUPLICATED_INJECTABLE_DECORATOR = 'Cannot apply @injectable decorator multiple times.';
|
|
5
5
|
exports.DUPLICATED_METADATA = 'Metadata key was used more than once in a parameter:';
|
|
6
6
|
exports.NULL_ARGUMENT = 'NULL argument';
|
|
@@ -9,7 +9,6 @@ exports.AMBIGUOUS_MATCH = 'Ambiguous match found for serviceIdentifier:';
|
|
|
9
9
|
exports.CANNOT_UNBIND = 'Could not unbind serviceIdentifier:';
|
|
10
10
|
exports.NOT_REGISTERED = 'No matching bindings found for serviceIdentifier:';
|
|
11
11
|
exports.MISSING_INJECTABLE_ANNOTATION = 'Missing required @injectable annotation in:';
|
|
12
|
-
exports.MISSING_INJECT_ANNOTATION = 'Missing required @inject or @multiInject annotation in:';
|
|
13
12
|
var UNDEFINED_INJECT_ANNOTATION = function (name) {
|
|
14
13
|
return "@inject called with undefined this could mean that the class ".concat(name, " has ") +
|
|
15
14
|
'a circular dependency problem. You can use a LazyServiceIdentifer to ' +
|
|
@@ -17,43 +16,44 @@ var UNDEFINED_INJECT_ANNOTATION = function (name) {
|
|
|
17
16
|
};
|
|
18
17
|
exports.UNDEFINED_INJECT_ANNOTATION = UNDEFINED_INJECT_ANNOTATION;
|
|
19
18
|
exports.CIRCULAR_DEPENDENCY = 'Circular dependency found:';
|
|
20
|
-
exports.NOT_IMPLEMENTED = 'Sorry, this feature is not fully implemented yet.';
|
|
21
19
|
exports.INVALID_BINDING_TYPE = 'Invalid binding type:';
|
|
22
20
|
exports.NO_MORE_SNAPSHOTS_AVAILABLE = 'No snapshot available to restore.';
|
|
23
21
|
exports.INVALID_MIDDLEWARE_RETURN = 'Invalid return type in middleware. Middleware must return!';
|
|
24
22
|
exports.INVALID_FUNCTION_BINDING = 'Value provided to function binding must be a function!';
|
|
25
|
-
var LAZY_IN_SYNC = function (key) {
|
|
26
|
-
|
|
23
|
+
var LAZY_IN_SYNC = function (key) {
|
|
24
|
+
return "You are attempting to construct ".concat(keyToString(key), " in a synchronous way ") +
|
|
25
|
+
'but it has asynchronous dependencies.';
|
|
26
|
+
};
|
|
27
27
|
exports.LAZY_IN_SYNC = LAZY_IN_SYNC;
|
|
28
28
|
exports.INVALID_TO_SELF_VALUE = 'The toSelf function can only be applied when a constructor is ' +
|
|
29
29
|
'used as service identifier';
|
|
30
30
|
exports.INVALID_DECORATOR_OPERATION = 'The @inject @multiInject @tagged and @named decorators ' +
|
|
31
31
|
'must be applied to the parameters of a class constructor or a class property.';
|
|
32
|
-
var ARGUMENTS_LENGTH_MISMATCH = function () {
|
|
33
|
-
var values = [];
|
|
34
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
35
|
-
values[_i] = arguments[_i];
|
|
36
|
-
}
|
|
32
|
+
var ARGUMENTS_LENGTH_MISMATCH = function (name) {
|
|
37
33
|
return 'The number of constructor arguments in the derived class ' +
|
|
38
|
-
"".concat(
|
|
34
|
+
"".concat(name, " must be >= than the number of constructor arguments of its base class.");
|
|
39
35
|
};
|
|
40
36
|
exports.ARGUMENTS_LENGTH_MISMATCH = ARGUMENTS_LENGTH_MISMATCH;
|
|
41
37
|
exports.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT = 'Invalid Container constructor argument. Container options ' +
|
|
42
38
|
'must be an object.';
|
|
43
39
|
exports.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE = 'Invalid Container option. Default scope must ' +
|
|
44
40
|
'be a string ("singleton" or "transient").';
|
|
45
|
-
exports.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE = 'Invalid Container option. Auto bind injectable must ' +
|
|
46
|
-
|
|
47
|
-
exports.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK = 'Invalid Container option. Skip base check must ' +
|
|
48
|
-
'be a boolean';
|
|
41
|
+
exports.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE = 'Invalid Container option. Auto bind injectable must ' + 'be a boolean';
|
|
42
|
+
exports.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK = 'Invalid Container option. Skip base check must ' + 'be a boolean';
|
|
49
43
|
exports.MULTIPLE_PRE_DESTROY_METHODS = 'Cannot apply @preDestroy decorator multiple times in the same class';
|
|
50
44
|
exports.MULTIPLE_POST_CONSTRUCT_METHODS = 'Cannot apply @postConstruct decorator multiple times in the same class';
|
|
51
45
|
exports.ASYNC_UNBIND_REQUIRED = 'Attempting to unbind dependency with asynchronous destruction (@preDestroy or onDeactivation)';
|
|
52
|
-
var POST_CONSTRUCT_ERROR = function (clazz, errorMessage) {
|
|
46
|
+
var POST_CONSTRUCT_ERROR = function (clazz, errorMessage) {
|
|
47
|
+
return "@postConstruct error in class ".concat(clazz, ": ").concat(errorMessage);
|
|
48
|
+
};
|
|
53
49
|
exports.POST_CONSTRUCT_ERROR = POST_CONSTRUCT_ERROR;
|
|
54
|
-
var PRE_DESTROY_ERROR = function (clazz, errorMessage) {
|
|
50
|
+
var PRE_DESTROY_ERROR = function (clazz, errorMessage) {
|
|
51
|
+
return "@preDestroy error in class ".concat(clazz, ": ").concat(errorMessage);
|
|
52
|
+
};
|
|
55
53
|
exports.PRE_DESTROY_ERROR = PRE_DESTROY_ERROR;
|
|
56
|
-
var ON_DEACTIVATION_ERROR = function (clazz, errorMessage) {
|
|
54
|
+
var ON_DEACTIVATION_ERROR = function (clazz, errorMessage) {
|
|
55
|
+
return "onDeactivation() error in class ".concat(clazz, ": ").concat(errorMessage);
|
|
56
|
+
};
|
|
57
57
|
exports.ON_DEACTIVATION_ERROR = ON_DEACTIVATION_ERROR;
|
|
58
58
|
var CIRCULAR_DEPENDENCY_IN_FACTORY = function (factoryType, serviceIdentifier) {
|
|
59
59
|
return "It looks like there is a circular dependency in one of the '".concat(factoryType, "' bindings. Please investigate bindings with ") +
|
|
@@ -4,7 +4,7 @@ exports.TargetTypeEnum = exports.BindingTypeEnum = exports.BindingScopeEnum = vo
|
|
|
4
4
|
var BindingScopeEnum = {
|
|
5
5
|
Request: 'Request',
|
|
6
6
|
Singleton: 'Singleton',
|
|
7
|
-
Transient: 'Transient'
|
|
7
|
+
Transient: 'Transient',
|
|
8
8
|
};
|
|
9
9
|
exports.BindingScopeEnum = BindingScopeEnum;
|
|
10
10
|
var BindingTypeEnum = {
|
|
@@ -15,12 +15,12 @@ var BindingTypeEnum = {
|
|
|
15
15
|
Function: 'Function',
|
|
16
16
|
Instance: 'Instance',
|
|
17
17
|
Invalid: 'Invalid',
|
|
18
|
-
Provider: 'Provider'
|
|
18
|
+
Provider: 'Provider',
|
|
19
19
|
};
|
|
20
20
|
exports.BindingTypeEnum = BindingTypeEnum;
|
|
21
21
|
var TargetTypeEnum = {
|
|
22
22
|
ClassProperty: 'ClassProperty',
|
|
23
23
|
ConstructorArgument: 'ConstructorArgument',
|
|
24
|
-
Variable: 'Variable'
|
|
24
|
+
Variable: 'Variable',
|
|
25
25
|
};
|
|
26
26
|
exports.TargetTypeEnum = TargetTypeEnum;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export declare const NAMED_TAG
|
|
2
|
-
export declare const NAME_TAG
|
|
3
|
-
export declare const UNMANAGED_TAG
|
|
4
|
-
export declare const OPTIONAL_TAG
|
|
5
|
-
export declare const INJECT_TAG
|
|
6
|
-
export declare const MULTI_INJECT_TAG
|
|
7
|
-
export declare const TAGGED
|
|
8
|
-
export declare const TAGGED_PROP
|
|
9
|
-
export declare const PARAM_TYPES
|
|
10
|
-
export declare const DESIGN_PARAM_TYPES
|
|
11
|
-
export declare const POST_CONSTRUCT
|
|
12
|
-
export declare const PRE_DESTROY
|
|
1
|
+
export declare const NAMED_TAG: string;
|
|
2
|
+
export declare const NAME_TAG: string;
|
|
3
|
+
export declare const UNMANAGED_TAG: string;
|
|
4
|
+
export declare const OPTIONAL_TAG: string;
|
|
5
|
+
export declare const INJECT_TAG: string;
|
|
6
|
+
export declare const MULTI_INJECT_TAG: string;
|
|
7
|
+
export declare const TAGGED: string;
|
|
8
|
+
export declare const TAGGED_PROP: string;
|
|
9
|
+
export declare const PARAM_TYPES: string;
|
|
10
|
+
export declare const DESIGN_PARAM_TYPES: string;
|
|
11
|
+
export declare const POST_CONSTRUCT: string;
|
|
12
|
+
export declare const PRE_DESTROY: string;
|
|
13
13
|
export declare const NON_CUSTOM_TAG_KEYS: string[];
|
|
@@ -7,11 +7,11 @@ declare class Container implements interfaces.Container {
|
|
|
7
7
|
private _bindingDictionary;
|
|
8
8
|
private _activations;
|
|
9
9
|
private _deactivations;
|
|
10
|
-
private _snapshots;
|
|
10
|
+
private readonly _snapshots;
|
|
11
11
|
private _metadataReader;
|
|
12
12
|
private _moduleActivationStore;
|
|
13
|
-
static merge(container1: interfaces.Container, container2: interfaces.Container, ...containers: interfaces.Container[]): interfaces.Container;
|
|
14
13
|
constructor(containerOptions?: interfaces.ContainerOptions);
|
|
14
|
+
static merge(container1: interfaces.Container, container2: interfaces.Container, ...containers: interfaces.Container[]): interfaces.Container;
|
|
15
15
|
load(...modules: interfaces.ContainerModule[]): void;
|
|
16
16
|
loadAsync(...modules: interfaces.AsyncContainerModule[]): Promise<void>;
|
|
17
17
|
unload(...modules: interfaces.ContainerModuleBase[]): void;
|