inversify 6.1.4 → 6.1.5-beta.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 +11 -1
- package/README.md +6 -15
- package/es/container/container.d.ts +2 -0
- package/es/container/module_activation_store.d.ts +2 -2
- package/es/interfaces/interfaces.d.ts +2 -2
- package/es/inversify.d.ts +1 -0
- package/es/inversify.js +3 -2
- package/es/inversify.js.LICENSE.txt +14 -0
- package/lib/annotation/decorator_utils.js +31 -25
- package/lib/annotation/inject.js +20 -10
- package/lib/annotation/inject_base.js +6 -6
- package/lib/annotation/injectable.js +20 -10
- package/lib/annotation/multi_inject.js +20 -10
- package/lib/annotation/named.js +20 -10
- package/lib/annotation/optional.js +20 -10
- package/lib/annotation/post_construct.js +21 -11
- package/lib/annotation/pre_destroy.js +21 -11
- package/lib/annotation/property_event_decorator.js +4 -4
- package/lib/annotation/tagged.js +2 -2
- package/lib/annotation/target_name.js +21 -11
- package/lib/annotation/unmanaged.js +21 -11
- package/lib/bindings/binding.js +23 -10
- package/lib/constants/error_msgs.js +15 -29
- package/lib/constants/literal_types.js +3 -3
- package/lib/container/container.d.ts +2 -0
- package/lib/container/container.js +317 -566
- package/lib/container/container_module.js +11 -9
- package/lib/container/container_snapshot.js +10 -8
- package/lib/container/lookup.js +61 -56
- package/lib/container/module_activation_store.d.ts +2 -2
- package/lib/container/module_activation_store.js +21 -24
- package/lib/interfaces/interfaces.d.ts +2 -2
- package/lib/inversify.d.ts +1 -0
- package/lib/inversify.js +19 -8
- package/lib/planning/context.js +12 -9
- package/lib/planning/metadata.js +27 -16
- package/lib/planning/metadata_reader.js +29 -24
- package/lib/planning/plan.js +5 -4
- package/lib/planning/planner.js +62 -53
- package/lib/planning/queryable_string.js +16 -16
- package/lib/planning/reflection_utils.js +25 -17
- package/lib/planning/request.js +15 -8
- package/lib/resolution/instantiation.js +59 -119
- package/lib/resolution/resolver.js +89 -134
- package/lib/scope/scope.js +17 -62
- package/lib/syntax/binding_in_syntax.js +12 -12
- package/lib/syntax/binding_in_when_on_syntax.js +50 -47
- package/lib/syntax/binding_on_syntax.js +9 -9
- package/lib/syntax/binding_to_syntax.js +70 -49
- package/lib/syntax/binding_when_on_syntax.js +42 -40
- package/lib/syntax/binding_when_syntax.js +54 -76
- package/lib/syntax/constraint_helpers.js +31 -23
- package/lib/utils/async.js +1 -1
- package/lib/utils/binding_utils.js +31 -29
- package/lib/utils/exceptions.js +19 -9
- package/lib/utils/id.js +1 -1
- package/lib/utils/js.js +2 -3
- package/lib/utils/serialization.js +42 -33
- package/package.json +14 -15
- package/amd/annotation/decorator_utils.d.ts +0 -16
- package/amd/annotation/decorator_utils.js +0 -119
- package/amd/annotation/inject.d.ts +0 -5
- package/amd/annotation/inject.js +0 -31
- package/amd/annotation/inject_base.d.ts +0 -4
- package/amd/annotation/inject_base.js +0 -16
- package/amd/annotation/injectable.d.ts +0 -2
- package/amd/annotation/injectable.js +0 -40
- package/amd/annotation/lazy_service_identifier.js +0 -4
- package/amd/annotation/multi_inject.d.ts +0 -5
- package/amd/annotation/multi_inject.js +0 -31
- package/amd/annotation/named.d.ts +0 -2
- package/amd/annotation/named.js +0 -32
- package/amd/annotation/optional.d.ts +0 -2
- package/amd/annotation/optional.js +0 -32
- package/amd/annotation/post_construct.d.ts +0 -4
- package/amd/annotation/post_construct.js +0 -32
- package/amd/annotation/pre_destroy.d.ts +0 -4
- package/amd/annotation/pre_destroy.js +0 -32
- package/amd/annotation/property_event_decorator.d.ts +0 -4
- package/amd/annotation/property_event_decorator.js +0 -16
- package/amd/annotation/tagged.d.ts +0 -2
- package/amd/annotation/tagged.js +0 -8
- package/amd/annotation/target_name.d.ts +0 -3
- package/amd/annotation/target_name.js +0 -35
- package/amd/annotation/unmanaged.d.ts +0 -3
- package/amd/annotation/unmanaged.js +0 -35
- package/amd/bindings/binding.d.ts +0 -20
- package/amd/bindings/binding.js +0 -40
- package/amd/bindings/binding_count.d.ts +0 -5
- package/amd/bindings/binding_count.js +0 -11
- package/amd/constants/error_msgs.d.ts +0 -30
- package/amd/constants/error_msgs.js +0 -75
- package/amd/constants/literal_types.d.ts +0 -5
- package/amd/constants/literal_types.js +0 -28
- package/amd/constants/metadata_keys.d.ts +0 -13
- package/amd/constants/metadata_keys.js +0 -28
- package/amd/container/container.d.ts +0 -73
- package/amd/container/container.js +0 -766
- package/amd/container/container_module.d.ts +0 -11
- package/amd/container/container_module.js +0 -21
- package/amd/container/container_snapshot.d.ts +0 -10
- package/amd/container/container_snapshot.js +0 -20
- package/amd/container/lookup.d.ts +0 -17
- package/amd/container/lookup.js +0 -132
- package/amd/container/module_activation_store.d.ts +0 -10
- package/amd/container/module_activation_store.js +0 -51
- package/amd/interfaces/interfaces.d.ts +0 -269
- package/amd/interfaces/interfaces.js +0 -4
- package/amd/inversify.d.ts +0 -24
- package/amd/inversify.js +0 -57
- package/amd/planning/context.d.ts +0 -11
- package/amd/planning/context.js +0 -19
- package/amd/planning/metadata.d.ts +0 -8
- package/amd/planning/metadata.js +0 -45
- package/amd/planning/metadata_reader.d.ts +0 -6
- package/amd/planning/metadata_reader.js +0 -49
- package/amd/planning/plan.d.ts +0 -7
- package/amd/planning/plan.js +0 -13
- package/amd/planning/planner.d.ts +0 -5
- package/amd/planning/planner.js +0 -187
- package/amd/planning/queryable_string.d.ts +0 -10
- package/amd/planning/queryable_string.js +0 -33
- package/amd/planning/reflection_utils.d.ts +0 -5
- package/amd/planning/reflection_utils.js +0 -55
- package/amd/planning/request.d.ts +0 -14
- package/amd/planning/request.js +0 -24
- package/amd/planning/target.js +0 -111
- package/amd/resolution/instantiation.d.ts +0 -3
- package/amd/resolution/instantiation.js +0 -219
- package/amd/resolution/resolver.d.ts +0 -3
- package/amd/resolution/resolver.js +0 -234
- package/amd/scope/scope.d.ts +0 -3
- package/amd/scope/scope.js +0 -93
- package/amd/syntax/binding_in_syntax.d.ts +0 -9
- package/amd/syntax/binding_in_syntax.js +0 -24
- package/amd/syntax/binding_in_when_on_syntax.d.ts +0 -29
- package/amd/syntax/binding_in_when_on_syntax.js +0 -75
- package/amd/syntax/binding_on_syntax.d.ts +0 -8
- package/amd/syntax/binding_on_syntax.js +0 -20
- package/amd/syntax/binding_to_syntax.d.ts +0 -18
- package/amd/syntax/binding_to_syntax.js +0 -116
- package/amd/syntax/binding_when_on_syntax.d.ts +0 -25
- package/amd/syntax/binding_when_on_syntax.js +0 -65
- package/amd/syntax/binding_when_syntax.d.ts +0 -21
- package/amd/syntax/binding_when_syntax.js +0 -107
- package/amd/syntax/constraint_helpers.d.ts +0 -6
- package/amd/syntax/constraint_helpers.js +0 -66
- package/amd/utils/async.d.ts +0 -3
- package/amd/utils/async.js +0 -17
- package/amd/utils/binding_utils.d.ts +0 -4
- package/amd/utils/binding_utils.js +0 -86
- package/amd/utils/clonable.d.ts +0 -3
- package/amd/utils/clonable.js +0 -11
- package/amd/utils/exceptions.d.ts +0 -2
- package/amd/utils/exceptions.js +0 -46
- package/amd/utils/factory_type.d.ts +0 -5
- package/amd/utils/factory_type.js +0 -11
- package/amd/utils/id.d.ts +0 -2
- package/amd/utils/id.js +0 -9
- package/amd/utils/js.d.ts +0 -1
- package/amd/utils/js.js +0 -18
- package/amd/utils/serialization.d.ts +0 -10
- package/amd/utils/serialization.js +0 -135
- package/es6/annotation/decorator_utils.d.ts +0 -16
- package/es6/annotation/decorator_utils.js +0 -114
- package/es6/annotation/inject.d.ts +0 -5
- package/es6/annotation/inject.js +0 -30
- package/es6/annotation/inject_base.d.ts +0 -4
- package/es6/annotation/inject_base.js +0 -17
- package/es6/annotation/injectable.d.ts +0 -2
- package/es6/annotation/injectable.js +0 -38
- package/es6/annotation/lazy_service_identifier.js +0 -2
- package/es6/annotation/multi_inject.d.ts +0 -5
- package/es6/annotation/multi_inject.js +0 -30
- package/es6/annotation/named.d.ts +0 -2
- package/es6/annotation/named.js +0 -32
- package/es6/annotation/optional.d.ts +0 -2
- package/es6/annotation/optional.js +0 -32
- package/es6/annotation/post_construct.d.ts +0 -4
- package/es6/annotation/post_construct.js +0 -31
- package/es6/annotation/pre_destroy.d.ts +0 -4
- package/es6/annotation/pre_destroy.js +0 -31
- package/es6/annotation/property_event_decorator.d.ts +0 -4
- package/es6/annotation/property_event_decorator.js +0 -15
- package/es6/annotation/tagged.d.ts +0 -2
- package/es6/annotation/tagged.js +0 -8
- package/es6/annotation/target_name.d.ts +0 -3
- package/es6/annotation/target_name.js +0 -35
- package/es6/annotation/unmanaged.d.ts +0 -3
- package/es6/annotation/unmanaged.js +0 -35
- package/es6/bindings/binding.d.ts +0 -20
- package/es6/bindings/binding.js +0 -39
- package/es6/bindings/binding_count.d.ts +0 -5
- package/es6/bindings/binding_count.js +0 -9
- package/es6/constants/error_msgs.d.ts +0 -30
- package/es6/constants/error_msgs.js +0 -59
- package/es6/constants/literal_types.d.ts +0 -5
- package/es6/constants/literal_types.js +0 -26
- package/es6/constants/metadata_keys.d.ts +0 -13
- package/es6/constants/metadata_keys.js +0 -26
- package/es6/container/container.d.ts +0 -73
- package/es6/container/container.js +0 -545
- package/es6/container/container_module.d.ts +0 -11
- package/es6/container/container_module.js +0 -18
- package/es6/container/container_snapshot.d.ts +0 -10
- package/es6/container/container_snapshot.js +0 -15
- package/es6/container/lookup.d.ts +0 -17
- package/es6/container/lookup.js +0 -125
- package/es6/container/module_activation_store.d.ts +0 -10
- package/es6/container/module_activation_store.js +0 -49
- package/es6/interfaces/interfaces.d.ts +0 -269
- package/es6/interfaces/interfaces.js +0 -2
- package/es6/inversify.d.ts +0 -24
- package/es6/inversify.js +0 -76
- package/es6/planning/context.d.ts +0 -11
- package/es6/planning/context.js +0 -17
- package/es6/planning/metadata.d.ts +0 -8
- package/es6/planning/metadata.js +0 -42
- package/es6/planning/metadata_reader.d.ts +0 -6
- package/es6/planning/metadata_reader.js +0 -44
- package/es6/planning/plan.d.ts +0 -7
- package/es6/planning/plan.js +0 -10
- package/es6/planning/planner.d.ts +0 -5
- package/es6/planning/planner.js +0 -194
- package/es6/planning/queryable_string.d.ts +0 -10
- package/es6/planning/queryable_string.js +0 -30
- package/es6/planning/reflection_utils.d.ts +0 -5
- package/es6/planning/reflection_utils.js +0 -53
- package/es6/planning/request.d.ts +0 -14
- package/es6/planning/request.js +0 -22
- package/es6/planning/target.js +0 -105
- package/es6/resolution/instantiation.d.ts +0 -3
- package/es6/resolution/instantiation.js +0 -158
- package/es6/resolution/resolver.d.ts +0 -3
- package/es6/resolution/resolver.js +0 -193
- package/es6/scope/scope.d.ts +0 -3
- package/es6/scope/scope.js +0 -57
- package/es6/syntax/binding_in_syntax.d.ts +0 -9
- package/es6/syntax/binding_in_syntax.js +0 -23
- package/es6/syntax/binding_in_when_on_syntax.d.ts +0 -29
- package/es6/syntax/binding_in_when_on_syntax.js +0 -75
- package/es6/syntax/binding_on_syntax.d.ts +0 -8
- package/es6/syntax/binding_on_syntax.js +0 -18
- package/es6/syntax/binding_to_syntax.d.ts +0 -18
- package/es6/syntax/binding_to_syntax.js +0 -110
- package/es6/syntax/binding_when_on_syntax.d.ts +0 -25
- package/es6/syntax/binding_when_on_syntax.js +0 -64
- package/es6/syntax/binding_when_syntax.d.ts +0 -21
- package/es6/syntax/binding_when_syntax.js +0 -84
- package/es6/syntax/constraint_helpers.d.ts +0 -6
- package/es6/syntax/constraint_helpers.js +0 -63
- package/es6/utils/async.d.ts +0 -3
- package/es6/utils/async.js +0 -15
- package/es6/utils/binding_utils.d.ts +0 -4
- package/es6/utils/binding_utils.js +0 -79
- package/es6/utils/clonable.d.ts +0 -3
- package/es6/utils/clonable.js +0 -9
- package/es6/utils/exceptions.d.ts +0 -2
- package/es6/utils/exceptions.js +0 -44
- package/es6/utils/factory_type.d.ts +0 -5
- package/es6/utils/factory_type.js +0 -9
- package/es6/utils/id.d.ts +0 -2
- package/es6/utils/id.js +0 -7
- package/es6/utils/js.d.ts +0 -1
- package/es6/utils/js.js +0 -15
- package/es6/utils/serialization.d.ts +0 -10
- package/es6/utils/serialization.js +0 -132
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { interfaces } from '../interfaces/interfaces';
|
|
2
|
-
export declare class ContainerModule implements interfaces.ContainerModule {
|
|
3
|
-
id: number;
|
|
4
|
-
registry: interfaces.ContainerModuleCallBack;
|
|
5
|
-
constructor(registry: interfaces.ContainerModuleCallBack);
|
|
6
|
-
}
|
|
7
|
-
export declare class AsyncContainerModule implements interfaces.AsyncContainerModule {
|
|
8
|
-
id: number;
|
|
9
|
-
registry: interfaces.AsyncContainerModuleCallBack;
|
|
10
|
-
constructor(registry: interfaces.AsyncContainerModuleCallBack);
|
|
11
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
define(["require", "exports", "../utils/id"], function (require, exports, id_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.AsyncContainerModule = exports.ContainerModule = void 0;
|
|
5
|
-
var ContainerModule = (function () {
|
|
6
|
-
function ContainerModule(registry) {
|
|
7
|
-
this.id = (0, id_1.id)();
|
|
8
|
-
this.registry = registry;
|
|
9
|
-
}
|
|
10
|
-
return ContainerModule;
|
|
11
|
-
}());
|
|
12
|
-
exports.ContainerModule = ContainerModule;
|
|
13
|
-
var AsyncContainerModule = (function () {
|
|
14
|
-
function AsyncContainerModule(registry) {
|
|
15
|
-
this.id = (0, id_1.id)();
|
|
16
|
-
this.registry = registry;
|
|
17
|
-
}
|
|
18
|
-
return AsyncContainerModule;
|
|
19
|
-
}());
|
|
20
|
-
exports.AsyncContainerModule = AsyncContainerModule;
|
|
21
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { interfaces } from '../interfaces/interfaces';
|
|
2
|
-
declare class ContainerSnapshot implements interfaces.ContainerSnapshot {
|
|
3
|
-
bindings: interfaces.Lookup<interfaces.Binding<unknown>>;
|
|
4
|
-
activations: interfaces.Lookup<interfaces.BindingActivation<unknown>>;
|
|
5
|
-
deactivations: interfaces.Lookup<interfaces.BindingDeactivation<unknown>>;
|
|
6
|
-
middleware: interfaces.Next | null;
|
|
7
|
-
moduleActivationStore: interfaces.ModuleActivationStore;
|
|
8
|
-
static of(bindings: interfaces.Lookup<interfaces.Binding<unknown>>, middleware: interfaces.Next | null, activations: interfaces.Lookup<interfaces.BindingActivation<unknown>>, deactivations: interfaces.Lookup<interfaces.BindingDeactivation<unknown>>, moduleActivationStore: interfaces.ModuleActivationStore): ContainerSnapshot;
|
|
9
|
-
}
|
|
10
|
-
export { ContainerSnapshot };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
define(["require", "exports"], function (require, exports) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.ContainerSnapshot = void 0;
|
|
5
|
-
var ContainerSnapshot = (function () {
|
|
6
|
-
function ContainerSnapshot() {
|
|
7
|
-
}
|
|
8
|
-
ContainerSnapshot.of = function (bindings, middleware, activations, deactivations, moduleActivationStore) {
|
|
9
|
-
var snapshot = new ContainerSnapshot();
|
|
10
|
-
snapshot.bindings = bindings;
|
|
11
|
-
snapshot.middleware = middleware;
|
|
12
|
-
snapshot.deactivations = deactivations;
|
|
13
|
-
snapshot.activations = activations;
|
|
14
|
-
snapshot.moduleActivationStore = moduleActivationStore;
|
|
15
|
-
return snapshot;
|
|
16
|
-
};
|
|
17
|
-
return ContainerSnapshot;
|
|
18
|
-
}());
|
|
19
|
-
exports.ContainerSnapshot = ContainerSnapshot;
|
|
20
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { interfaces } from '../interfaces/interfaces';
|
|
2
|
-
declare class Lookup<T> implements interfaces.Lookup<T> {
|
|
3
|
-
private readonly _map;
|
|
4
|
-
constructor();
|
|
5
|
-
getMap(): Map<interfaces.ServiceIdentifier<unknown>, T[]>;
|
|
6
|
-
add(serviceIdentifier: interfaces.ServiceIdentifier, value: T): void;
|
|
7
|
-
get(serviceIdentifier: interfaces.ServiceIdentifier): T[];
|
|
8
|
-
remove(serviceIdentifier: interfaces.ServiceIdentifier): void;
|
|
9
|
-
removeIntersection(lookup: interfaces.Lookup<T>): void;
|
|
10
|
-
removeByCondition(condition: (item: T) => boolean): T[];
|
|
11
|
-
hasKey(serviceIdentifier: interfaces.ServiceIdentifier): boolean;
|
|
12
|
-
clone(): interfaces.Lookup<T>;
|
|
13
|
-
traverse(func: (key: interfaces.ServiceIdentifier, value: T[]) => void): void;
|
|
14
|
-
private _checkNonNulish;
|
|
15
|
-
private _setValue;
|
|
16
|
-
}
|
|
17
|
-
export { Lookup };
|
package/amd/container/lookup.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2
|
-
if (k2 === undefined) k2 = k;
|
|
3
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
4
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
5
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
6
|
-
}
|
|
7
|
-
Object.defineProperty(o, k2, desc);
|
|
8
|
-
}) : (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
o[k2] = m[k];
|
|
11
|
-
}));
|
|
12
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
13
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
14
|
-
}) : function(o, v) {
|
|
15
|
-
o["default"] = v;
|
|
16
|
-
});
|
|
17
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
18
|
-
if (mod && mod.__esModule) return mod;
|
|
19
|
-
var result = {};
|
|
20
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
21
|
-
__setModuleDefault(result, mod);
|
|
22
|
-
return result;
|
|
23
|
-
};
|
|
24
|
-
define(["require", "exports", "../constants/error_msgs", "../utils/clonable"], function (require, exports, ERROR_MSGS, clonable_1) {
|
|
25
|
-
"use strict";
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.Lookup = void 0;
|
|
28
|
-
ERROR_MSGS = __importStar(ERROR_MSGS);
|
|
29
|
-
var Lookup = (function () {
|
|
30
|
-
function Lookup() {
|
|
31
|
-
this._map = new Map();
|
|
32
|
-
}
|
|
33
|
-
Lookup.prototype.getMap = function () {
|
|
34
|
-
return this._map;
|
|
35
|
-
};
|
|
36
|
-
Lookup.prototype.add = function (serviceIdentifier, value) {
|
|
37
|
-
this._checkNonNulish(serviceIdentifier);
|
|
38
|
-
if (value === null || value === undefined) {
|
|
39
|
-
throw new Error(ERROR_MSGS.NULL_ARGUMENT);
|
|
40
|
-
}
|
|
41
|
-
var entry = this._map.get(serviceIdentifier);
|
|
42
|
-
if (entry !== undefined) {
|
|
43
|
-
entry.push(value);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
this._map.set(serviceIdentifier, [value]);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
Lookup.prototype.get = function (serviceIdentifier) {
|
|
50
|
-
this._checkNonNulish(serviceIdentifier);
|
|
51
|
-
var entry = this._map.get(serviceIdentifier);
|
|
52
|
-
if (entry !== undefined) {
|
|
53
|
-
return entry;
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
throw new Error(ERROR_MSGS.KEY_NOT_FOUND);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
Lookup.prototype.remove = function (serviceIdentifier) {
|
|
60
|
-
this._checkNonNulish(serviceIdentifier);
|
|
61
|
-
if (!this._map.delete(serviceIdentifier)) {
|
|
62
|
-
throw new Error(ERROR_MSGS.KEY_NOT_FOUND);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
Lookup.prototype.removeIntersection = function (lookup) {
|
|
66
|
-
var _this = this;
|
|
67
|
-
this.traverse(function (serviceIdentifier, value) {
|
|
68
|
-
var lookupActivations = lookup.hasKey(serviceIdentifier)
|
|
69
|
-
? lookup.get(serviceIdentifier)
|
|
70
|
-
: undefined;
|
|
71
|
-
if (lookupActivations !== undefined) {
|
|
72
|
-
var filteredValues = value.filter(function (lookupValue) {
|
|
73
|
-
return !lookupActivations.some(function (moduleActivation) { return lookupValue === moduleActivation; });
|
|
74
|
-
});
|
|
75
|
-
_this._setValue(serviceIdentifier, filteredValues);
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
Lookup.prototype.removeByCondition = function (condition) {
|
|
80
|
-
var _this = this;
|
|
81
|
-
var removals = [];
|
|
82
|
-
this._map.forEach(function (entries, key) {
|
|
83
|
-
var updatedEntries = [];
|
|
84
|
-
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
85
|
-
var entry = entries_1[_i];
|
|
86
|
-
var remove = condition(entry);
|
|
87
|
-
if (remove) {
|
|
88
|
-
removals.push(entry);
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
updatedEntries.push(entry);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
_this._setValue(key, updatedEntries);
|
|
95
|
-
});
|
|
96
|
-
return removals;
|
|
97
|
-
};
|
|
98
|
-
Lookup.prototype.hasKey = function (serviceIdentifier) {
|
|
99
|
-
this._checkNonNulish(serviceIdentifier);
|
|
100
|
-
return this._map.has(serviceIdentifier);
|
|
101
|
-
};
|
|
102
|
-
Lookup.prototype.clone = function () {
|
|
103
|
-
var copy = new Lookup();
|
|
104
|
-
this._map.forEach(function (value, key) {
|
|
105
|
-
value.forEach(function (b) {
|
|
106
|
-
copy.add(key, (0, clonable_1.isClonable)(b) ? b.clone() : b);
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
return copy;
|
|
110
|
-
};
|
|
111
|
-
Lookup.prototype.traverse = function (func) {
|
|
112
|
-
this._map.forEach(function (value, key) {
|
|
113
|
-
func(key, value);
|
|
114
|
-
});
|
|
115
|
-
};
|
|
116
|
-
Lookup.prototype._checkNonNulish = function (value) {
|
|
117
|
-
if (value == null) {
|
|
118
|
-
throw new Error(ERROR_MSGS.NULL_ARGUMENT);
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
Lookup.prototype._setValue = function (serviceIdentifier, value) {
|
|
122
|
-
if (value.length > 0) {
|
|
123
|
-
this._map.set(serviceIdentifier, value);
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
this._map.delete(serviceIdentifier);
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
return Lookup;
|
|
130
|
-
}());
|
|
131
|
-
exports.Lookup = Lookup;
|
|
132
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { interfaces } from '../interfaces/interfaces';
|
|
2
|
-
export declare class ModuleActivationStore implements interfaces.ModuleActivationStore {
|
|
3
|
-
private readonly _map;
|
|
4
|
-
remove(moduleId: number): interfaces.ModuleActivationHandlers;
|
|
5
|
-
addDeactivation(moduleId: number, serviceIdentifier: interfaces.ServiceIdentifier<unknown>, onDeactivation: interfaces.BindingDeactivation<unknown>): void;
|
|
6
|
-
addActivation(moduleId: number, serviceIdentifier: interfaces.ServiceIdentifier<unknown>, onActivation: interfaces.BindingActivation<unknown>): void;
|
|
7
|
-
clone(): interfaces.ModuleActivationStore;
|
|
8
|
-
private _getModuleActivationHandlers;
|
|
9
|
-
private _getEmptyHandlersStore;
|
|
10
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
define(["require", "exports", "./lookup"], function (require, exports, lookup_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.ModuleActivationStore = void 0;
|
|
5
|
-
var ModuleActivationStore = (function () {
|
|
6
|
-
function ModuleActivationStore() {
|
|
7
|
-
this._map = new Map();
|
|
8
|
-
}
|
|
9
|
-
ModuleActivationStore.prototype.remove = function (moduleId) {
|
|
10
|
-
var handlers = this._map.get(moduleId);
|
|
11
|
-
if (handlers === undefined) {
|
|
12
|
-
return this._getEmptyHandlersStore();
|
|
13
|
-
}
|
|
14
|
-
this._map.delete(moduleId);
|
|
15
|
-
return handlers;
|
|
16
|
-
};
|
|
17
|
-
ModuleActivationStore.prototype.addDeactivation = function (moduleId, serviceIdentifier, onDeactivation) {
|
|
18
|
-
this._getModuleActivationHandlers(moduleId).onDeactivations.add(serviceIdentifier, onDeactivation);
|
|
19
|
-
};
|
|
20
|
-
ModuleActivationStore.prototype.addActivation = function (moduleId, serviceIdentifier, onActivation) {
|
|
21
|
-
this._getModuleActivationHandlers(moduleId).onActivations.add(serviceIdentifier, onActivation);
|
|
22
|
-
};
|
|
23
|
-
ModuleActivationStore.prototype.clone = function () {
|
|
24
|
-
var clone = new ModuleActivationStore();
|
|
25
|
-
this._map.forEach(function (handlersStore, moduleId) {
|
|
26
|
-
clone._map.set(moduleId, {
|
|
27
|
-
onActivations: handlersStore.onActivations.clone(),
|
|
28
|
-
onDeactivations: handlersStore.onDeactivations.clone(),
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
return clone;
|
|
32
|
-
};
|
|
33
|
-
ModuleActivationStore.prototype._getModuleActivationHandlers = function (moduleId) {
|
|
34
|
-
var moduleActivationHandlers = this._map.get(moduleId);
|
|
35
|
-
if (moduleActivationHandlers === undefined) {
|
|
36
|
-
moduleActivationHandlers = this._getEmptyHandlersStore();
|
|
37
|
-
this._map.set(moduleId, moduleActivationHandlers);
|
|
38
|
-
}
|
|
39
|
-
return moduleActivationHandlers;
|
|
40
|
-
};
|
|
41
|
-
ModuleActivationStore.prototype._getEmptyHandlersStore = function () {
|
|
42
|
-
var handlersStore = {
|
|
43
|
-
onActivations: new lookup_1.Lookup(),
|
|
44
|
-
onDeactivations: new lookup_1.Lookup(),
|
|
45
|
-
};
|
|
46
|
-
return handlersStore;
|
|
47
|
-
};
|
|
48
|
-
return ModuleActivationStore;
|
|
49
|
-
}());
|
|
50
|
-
exports.ModuleActivationStore = ModuleActivationStore;
|
|
51
|
-
});
|
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
import { Newable as CommonNewable, ServiceIdentifier as CommonServiceIdentifier } from '@inversifyjs/common';
|
|
2
|
-
import { LegacyTarget } from '@inversifyjs/core';
|
|
3
|
-
import { FactoryType } from '../utils/factory_type';
|
|
4
|
-
declare namespace interfaces {
|
|
5
|
-
export type DynamicValue<T> = (context: interfaces.Context) => T | Promise<T>;
|
|
6
|
-
export type ContainerResolution<T> = T | Promise<T> | (T | Promise<T>)[];
|
|
7
|
-
type AsyncCallback<TCallback> = TCallback extends (...args: infer TArgs) => infer TResult ? (...args: TArgs) => Promise<TResult> : never;
|
|
8
|
-
export type BindingScope = 'Singleton' | 'Transient' | 'Request';
|
|
9
|
-
export type BindingType = 'ConstantValue' | 'Constructor' | 'DynamicValue' | 'Factory' | 'Function' | 'Instance' | 'Invalid' | 'Provider';
|
|
10
|
-
export type TargetType = 'ConstructorArgument' | 'ClassProperty' | 'Variable';
|
|
11
|
-
export interface BindingScopeEnum {
|
|
12
|
-
Request: interfaces.BindingScope;
|
|
13
|
-
Singleton: interfaces.BindingScope;
|
|
14
|
-
Transient: interfaces.BindingScope;
|
|
15
|
-
}
|
|
16
|
-
export interface BindingTypeEnum {
|
|
17
|
-
ConstantValue: interfaces.BindingType;
|
|
18
|
-
Constructor: interfaces.BindingType;
|
|
19
|
-
DynamicValue: interfaces.BindingType;
|
|
20
|
-
Factory: interfaces.BindingType;
|
|
21
|
-
Function: interfaces.BindingType;
|
|
22
|
-
Instance: interfaces.BindingType;
|
|
23
|
-
Invalid: interfaces.BindingType;
|
|
24
|
-
Provider: interfaces.BindingType;
|
|
25
|
-
}
|
|
26
|
-
export interface TargetTypeEnum {
|
|
27
|
-
ConstructorArgument: interfaces.TargetType;
|
|
28
|
-
ClassProperty: interfaces.TargetType;
|
|
29
|
-
Variable: interfaces.TargetType;
|
|
30
|
-
}
|
|
31
|
-
export type Newable<TInstance = unknown> = CommonNewable<TInstance>;
|
|
32
|
-
export type Instance<T> = T & Record<string, () => void>;
|
|
33
|
-
export interface Abstract<T> {
|
|
34
|
-
prototype: T;
|
|
35
|
-
}
|
|
36
|
-
export type ServiceIdentifier<T = unknown> = CommonServiceIdentifier<T>;
|
|
37
|
-
export interface Clonable<T> {
|
|
38
|
-
clone(): T;
|
|
39
|
-
}
|
|
40
|
-
export type BindingActivation<T = unknown> = (context: interfaces.Context, injectable: T) => T | Promise<T>;
|
|
41
|
-
export type BindingDeactivation<T = unknown> = (injectable: T) => void | Promise<void>;
|
|
42
|
-
export interface Binding<TActivated = unknown> extends Clonable<Binding<TActivated>> {
|
|
43
|
-
id: number;
|
|
44
|
-
moduleId: ContainerModuleBase['id'];
|
|
45
|
-
activated: boolean;
|
|
46
|
-
serviceIdentifier: ServiceIdentifier<TActivated>;
|
|
47
|
-
constraint: ConstraintFunction;
|
|
48
|
-
dynamicValue: DynamicValue<TActivated> | null;
|
|
49
|
-
scope: BindingScope;
|
|
50
|
-
type: BindingType;
|
|
51
|
-
implementationType: Newable<TActivated> | TActivated | null;
|
|
52
|
-
factory: FactoryCreator<unknown> | null;
|
|
53
|
-
provider: ProviderCreator<unknown> | null;
|
|
54
|
-
onActivation: BindingActivation<TActivated> | null;
|
|
55
|
-
onDeactivation: BindingDeactivation<TActivated> | null;
|
|
56
|
-
cache: null | TActivated | Promise<TActivated>;
|
|
57
|
-
}
|
|
58
|
-
export type SimpleFactory<T, U extends unknown[] = unknown[]> = (...args: U) => T;
|
|
59
|
-
export type MultiFactory<T, U extends unknown[] = unknown[], V extends unknown[] = unknown[]> = (...args: U) => SimpleFactory<T, V>;
|
|
60
|
-
export type Factory<T, U extends unknown[] = unknown[], V extends unknown[] = unknown[]> = SimpleFactory<T, U> | MultiFactory<T, U, V>;
|
|
61
|
-
export type FactoryCreator<T, U extends unknown[] = unknown[], V extends unknown[] = unknown[]> = (context: Context) => Factory<T, U, V>;
|
|
62
|
-
export type AutoNamedFactory<T> = SimpleFactory<T, [string]>;
|
|
63
|
-
export type AutoFactory<T> = SimpleFactory<T, []>;
|
|
64
|
-
export type FactoryTypeFunction<T = unknown> = (context: interfaces.Context) => T | Promise<T>;
|
|
65
|
-
export interface FactoryDetails {
|
|
66
|
-
factoryType: FactoryType;
|
|
67
|
-
factory: FactoryTypeFunction | null;
|
|
68
|
-
}
|
|
69
|
-
export type Provider<T> = (...args: any[]) => ((...args: any[]) => Promise<T>) | Promise<T>;
|
|
70
|
-
export type ProviderCreator<T> = (context: Context) => Provider<T>;
|
|
71
|
-
export interface NextArgs<T = unknown> {
|
|
72
|
-
avoidConstraints: boolean;
|
|
73
|
-
contextInterceptor: (contexts: Context) => Context;
|
|
74
|
-
isMultiInject: boolean;
|
|
75
|
-
targetType: TargetType;
|
|
76
|
-
serviceIdentifier: interfaces.ServiceIdentifier<T>;
|
|
77
|
-
key?: string | number | symbol | undefined;
|
|
78
|
-
value?: unknown;
|
|
79
|
-
}
|
|
80
|
-
export type Next = (args: NextArgs) => unknown | unknown[];
|
|
81
|
-
export type Middleware = (next: Next) => Next;
|
|
82
|
-
export type ContextInterceptor = (context: interfaces.Context) => interfaces.Context;
|
|
83
|
-
export interface Context {
|
|
84
|
-
id: number;
|
|
85
|
-
container: Container;
|
|
86
|
-
plan: Plan;
|
|
87
|
-
currentRequest: Request;
|
|
88
|
-
addPlan(plan: Plan): void;
|
|
89
|
-
setCurrentRequest(request: Request): void;
|
|
90
|
-
}
|
|
91
|
-
export type MetadataOrMetadataArray = Metadata | Metadata[];
|
|
92
|
-
export interface Metadata<TValue = unknown> {
|
|
93
|
-
key: string | number | symbol;
|
|
94
|
-
value: TValue;
|
|
95
|
-
}
|
|
96
|
-
export interface Plan {
|
|
97
|
-
parentContext: Context;
|
|
98
|
-
rootRequest: Request;
|
|
99
|
-
}
|
|
100
|
-
export interface QueryableString {
|
|
101
|
-
startsWith(searchString: string): boolean;
|
|
102
|
-
endsWith(searchString: string): boolean;
|
|
103
|
-
contains(searchString: string): boolean;
|
|
104
|
-
equals(compareString: string): boolean;
|
|
105
|
-
value(): string;
|
|
106
|
-
}
|
|
107
|
-
export type ResolveRequestHandler = (request: interfaces.Request) => unknown;
|
|
108
|
-
export type RequestScope = Map<unknown, unknown>;
|
|
109
|
-
export interface Request {
|
|
110
|
-
id: number;
|
|
111
|
-
serviceIdentifier: ServiceIdentifier;
|
|
112
|
-
parentContext: Context;
|
|
113
|
-
parentRequest: Request | null;
|
|
114
|
-
childRequests: Request[];
|
|
115
|
-
target: Target;
|
|
116
|
-
bindings: Binding<unknown>[];
|
|
117
|
-
requestScope: RequestScope | null;
|
|
118
|
-
addChildRequest(serviceIdentifier: ServiceIdentifier, bindings: Binding<unknown> | Binding<unknown>[], target: Target): Request;
|
|
119
|
-
}
|
|
120
|
-
export type Target = LegacyTarget;
|
|
121
|
-
export interface ContainerOptions {
|
|
122
|
-
autoBindInjectable?: boolean;
|
|
123
|
-
defaultScope?: BindingScope | undefined;
|
|
124
|
-
skipBaseClassChecks?: boolean;
|
|
125
|
-
}
|
|
126
|
-
export interface Container {
|
|
127
|
-
id: number;
|
|
128
|
-
parent: Container | null;
|
|
129
|
-
options: ContainerOptions;
|
|
130
|
-
bind<T>(serviceIdentifier: ServiceIdentifier<T>): BindingToSyntax<T>;
|
|
131
|
-
rebind<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>): interfaces.BindingToSyntax<T>;
|
|
132
|
-
rebindAsync<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>): Promise<interfaces.BindingToSyntax<T>>;
|
|
133
|
-
unbind(serviceIdentifier: ServiceIdentifier): void;
|
|
134
|
-
unbindAsync(serviceIdentifier: interfaces.ServiceIdentifier): Promise<void>;
|
|
135
|
-
unbindAll(): void;
|
|
136
|
-
unbindAllAsync(): Promise<void>;
|
|
137
|
-
isBound(serviceIdentifier: ServiceIdentifier): boolean;
|
|
138
|
-
isCurrentBound<T>(serviceIdentifier: ServiceIdentifier<T>): boolean;
|
|
139
|
-
isBoundNamed(serviceIdentifier: ServiceIdentifier, named: string | number | symbol): boolean;
|
|
140
|
-
isBoundTagged(serviceIdentifier: ServiceIdentifier, key: string | number | symbol, value: unknown): boolean;
|
|
141
|
-
get<T>(serviceIdentifier: ServiceIdentifier<T>): T;
|
|
142
|
-
getNamed<T>(serviceIdentifier: ServiceIdentifier<T>, named: string | number | symbol): T;
|
|
143
|
-
getTagged<T>(serviceIdentifier: ServiceIdentifier<T>, key: string | number | symbol, value: unknown): T;
|
|
144
|
-
getAll<T>(serviceIdentifier: ServiceIdentifier<T>): T[];
|
|
145
|
-
getAllTagged<T>(serviceIdentifier: ServiceIdentifier<T>, key: string | number | symbol, value: unknown): T[];
|
|
146
|
-
getAllNamed<T>(serviceIdentifier: ServiceIdentifier<T>, named: string | number | symbol): T[];
|
|
147
|
-
getAsync<T>(serviceIdentifier: ServiceIdentifier<T>): Promise<T>;
|
|
148
|
-
getNamedAsync<T>(serviceIdentifier: ServiceIdentifier<T>, named: string | number | symbol): Promise<T>;
|
|
149
|
-
getTaggedAsync<T>(serviceIdentifier: ServiceIdentifier<T>, key: string | number | symbol, value: unknown): Promise<T>;
|
|
150
|
-
getAllAsync<T>(serviceIdentifier: ServiceIdentifier<T>): Promise<T[]>;
|
|
151
|
-
getAllTaggedAsync<T>(serviceIdentifier: ServiceIdentifier<T>, key: string | number | symbol, value: unknown): Promise<T[]>;
|
|
152
|
-
getAllNamedAsync<T>(serviceIdentifier: ServiceIdentifier<T>, named: string | number | symbol): Promise<T[]>;
|
|
153
|
-
onActivation<T>(serviceIdentifier: ServiceIdentifier<T>, onActivation: BindingActivation<T>): void;
|
|
154
|
-
onDeactivation<T>(serviceIdentifier: ServiceIdentifier<T>, onDeactivation: BindingDeactivation<T>): void;
|
|
155
|
-
resolve<T>(constructorFunction: interfaces.Newable<T>): T;
|
|
156
|
-
load(...modules: ContainerModule[]): void;
|
|
157
|
-
loadAsync(...modules: AsyncContainerModule[]): Promise<void>;
|
|
158
|
-
unload(...modules: ContainerModuleBase[]): void;
|
|
159
|
-
unloadAsync(...modules: ContainerModuleBase[]): Promise<void>;
|
|
160
|
-
applyCustomMetadataReader(metadataReader: MetadataReader): void;
|
|
161
|
-
applyMiddleware(...middleware: Middleware[]): void;
|
|
162
|
-
snapshot(): void;
|
|
163
|
-
restore(): void;
|
|
164
|
-
createChild(): Container;
|
|
165
|
-
}
|
|
166
|
-
export type Bind = <T = unknown>(serviceIdentifier: ServiceIdentifier<T>) => BindingToSyntax<T>;
|
|
167
|
-
export type Rebind = <T = unknown>(serviceIdentifier: ServiceIdentifier<T>) => BindingToSyntax<T>;
|
|
168
|
-
export type Unbind = <T = unknown>(serviceIdentifier: ServiceIdentifier<T>) => void;
|
|
169
|
-
export type UnbindAsync = <T = unknown>(serviceIdentifier: ServiceIdentifier<T>) => Promise<void>;
|
|
170
|
-
export type IsBound = <T = unknown>(serviceIdentifier: ServiceIdentifier<T>) => boolean;
|
|
171
|
-
export interface ContainerModuleBase {
|
|
172
|
-
id: number;
|
|
173
|
-
}
|
|
174
|
-
export interface ContainerModule extends ContainerModuleBase {
|
|
175
|
-
registry: ContainerModuleCallBack;
|
|
176
|
-
}
|
|
177
|
-
export interface AsyncContainerModule extends ContainerModuleBase {
|
|
178
|
-
registry: AsyncContainerModuleCallBack;
|
|
179
|
-
}
|
|
180
|
-
export interface ModuleActivationHandlers {
|
|
181
|
-
onActivations: Lookup<BindingActivation<unknown>>;
|
|
182
|
-
onDeactivations: Lookup<BindingDeactivation<unknown>>;
|
|
183
|
-
}
|
|
184
|
-
export interface ModuleActivationStore extends Clonable<ModuleActivationStore> {
|
|
185
|
-
addDeactivation(moduleId: ContainerModuleBase['id'], serviceIdentifier: ServiceIdentifier<unknown>, onDeactivation: interfaces.BindingDeactivation<unknown>): void;
|
|
186
|
-
addActivation(moduleId: ContainerModuleBase['id'], serviceIdentifier: ServiceIdentifier<unknown>, onActivation: interfaces.BindingActivation<unknown>): void;
|
|
187
|
-
remove(moduleId: ContainerModuleBase['id']): ModuleActivationHandlers;
|
|
188
|
-
}
|
|
189
|
-
export type ContainerModuleCallBack = (bind: interfaces.Bind, unbind: interfaces.Unbind, isBound: interfaces.IsBound, rebind: interfaces.Rebind, unbindAsync: interfaces.UnbindAsync, onActivation: interfaces.Container['onActivation'], onDeactivation: interfaces.Container['onDeactivation']) => void;
|
|
190
|
-
export type AsyncContainerModuleCallBack = AsyncCallback<ContainerModuleCallBack>;
|
|
191
|
-
export interface ContainerSnapshot {
|
|
192
|
-
bindings: Lookup<Binding<unknown>>;
|
|
193
|
-
activations: Lookup<BindingActivation<unknown>>;
|
|
194
|
-
deactivations: Lookup<BindingDeactivation<unknown>>;
|
|
195
|
-
middleware: Next | null;
|
|
196
|
-
moduleActivationStore: interfaces.ModuleActivationStore;
|
|
197
|
-
}
|
|
198
|
-
export interface Lookup<T> extends Clonable<Lookup<T>> {
|
|
199
|
-
add(serviceIdentifier: ServiceIdentifier, value: T): void;
|
|
200
|
-
getMap(): Map<interfaces.ServiceIdentifier, T[]>;
|
|
201
|
-
get(serviceIdentifier: ServiceIdentifier): T[];
|
|
202
|
-
remove(serviceIdentifier: interfaces.ServiceIdentifier): void;
|
|
203
|
-
removeByCondition(condition: (item: T) => boolean): T[];
|
|
204
|
-
removeIntersection(lookup: interfaces.Lookup<T>): void;
|
|
205
|
-
hasKey(serviceIdentifier: ServiceIdentifier): boolean;
|
|
206
|
-
clone(): Lookup<T>;
|
|
207
|
-
traverse(func: (key: interfaces.ServiceIdentifier, value: T[]) => void): void;
|
|
208
|
-
}
|
|
209
|
-
export interface BindingOnSyntax<T> {
|
|
210
|
-
onActivation(fn: (context: Context, injectable: T) => T | Promise<T>): BindingWhenSyntax<T>;
|
|
211
|
-
onDeactivation(fn: (injectable: T) => void | Promise<void>): BindingWhenSyntax<T>;
|
|
212
|
-
}
|
|
213
|
-
export interface BindingWhenSyntax<T> {
|
|
214
|
-
when(constraint: (request: Request) => boolean): BindingOnSyntax<T>;
|
|
215
|
-
whenTargetNamed(name: string | number | symbol): BindingOnSyntax<T>;
|
|
216
|
-
whenTargetIsDefault(): BindingOnSyntax<T>;
|
|
217
|
-
whenTargetTagged(tag: string | number | symbol, value: unknown): BindingOnSyntax<T>;
|
|
218
|
-
whenInjectedInto(parent: NewableFunction | string): BindingOnSyntax<T>;
|
|
219
|
-
whenParentNamed(name: string | number | symbol): BindingOnSyntax<T>;
|
|
220
|
-
whenParentTagged(tag: string | number | symbol, value: unknown): BindingOnSyntax<T>;
|
|
221
|
-
whenAnyAncestorIs(ancestor: NewableFunction | string): BindingOnSyntax<T>;
|
|
222
|
-
whenNoAncestorIs(ancestor: NewableFunction | string): BindingOnSyntax<T>;
|
|
223
|
-
whenAnyAncestorNamed(name: string | number | symbol): BindingOnSyntax<T>;
|
|
224
|
-
whenAnyAncestorTagged(tag: string | number | symbol, value: unknown): BindingOnSyntax<T>;
|
|
225
|
-
whenNoAncestorNamed(name: string | number | symbol): BindingOnSyntax<T>;
|
|
226
|
-
whenNoAncestorTagged(tag: string | number | symbol, value: unknown): BindingOnSyntax<T>;
|
|
227
|
-
whenAnyAncestorMatches(constraint: (request: Request) => boolean): BindingOnSyntax<T>;
|
|
228
|
-
whenNoAncestorMatches(constraint: (request: Request) => boolean): BindingOnSyntax<T>;
|
|
229
|
-
}
|
|
230
|
-
export interface BindingWhenOnSyntax<T> extends BindingWhenSyntax<T>, BindingOnSyntax<T> {
|
|
231
|
-
}
|
|
232
|
-
export interface BindingInSyntax<T> {
|
|
233
|
-
inSingletonScope(): BindingWhenOnSyntax<T>;
|
|
234
|
-
inTransientScope(): BindingWhenOnSyntax<T>;
|
|
235
|
-
inRequestScope(): BindingWhenOnSyntax<T>;
|
|
236
|
-
}
|
|
237
|
-
export interface BindingInWhenOnSyntax<T> extends BindingInSyntax<T>, BindingWhenOnSyntax<T> {
|
|
238
|
-
}
|
|
239
|
-
export interface BindingToSyntax<T> {
|
|
240
|
-
to(constructor: Newable<T>): BindingInWhenOnSyntax<T>;
|
|
241
|
-
toSelf(): BindingInWhenOnSyntax<T>;
|
|
242
|
-
toConstantValue(value: T): BindingWhenOnSyntax<T>;
|
|
243
|
-
toDynamicValue(func: DynamicValue<T>): BindingInWhenOnSyntax<T>;
|
|
244
|
-
toConstructor<T2>(constructor: Newable<T2>): BindingWhenOnSyntax<T>;
|
|
245
|
-
toFactory<T2, T3 extends unknown[] = unknown[], T4 extends unknown[] = unknown[]>(factory: FactoryCreator<T2, T3, T4>): BindingWhenOnSyntax<T>;
|
|
246
|
-
toFunction(func: T): BindingWhenOnSyntax<T>;
|
|
247
|
-
toAutoFactory<T2>(serviceIdentifier: ServiceIdentifier<T2>): BindingWhenOnSyntax<T>;
|
|
248
|
-
toAutoNamedFactory<T2>(serviceIdentifier: ServiceIdentifier<T2>): BindingWhenOnSyntax<T>;
|
|
249
|
-
toProvider<T2>(provider: ProviderCreator<T2>): BindingWhenOnSyntax<T>;
|
|
250
|
-
toService(service: ServiceIdentifier<T>): void;
|
|
251
|
-
}
|
|
252
|
-
export interface ConstraintFunction {
|
|
253
|
-
(request: Request | null): boolean;
|
|
254
|
-
metaData?: Metadata;
|
|
255
|
-
}
|
|
256
|
-
export interface MetadataReader {
|
|
257
|
-
getConstructorMetadata(constructorFunc: NewableFunction): ConstructorMetadata;
|
|
258
|
-
getPropertiesMetadata(constructorFunc: NewableFunction): MetadataMap;
|
|
259
|
-
}
|
|
260
|
-
export interface MetadataMap {
|
|
261
|
-
[propertyNameOrArgumentIndex: string | symbol]: Metadata[];
|
|
262
|
-
}
|
|
263
|
-
export interface ConstructorMetadata {
|
|
264
|
-
compilerGeneratedMetadata: NewableFunction[] | undefined;
|
|
265
|
-
userGeneratedMetadata: MetadataMap;
|
|
266
|
-
}
|
|
267
|
-
export {};
|
|
268
|
-
}
|
|
269
|
-
export type { interfaces };
|
package/amd/inversify.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as keys from './constants/metadata_keys';
|
|
2
|
-
export { LazyServiceIdentifier } from '@inversifyjs/common';
|
|
3
|
-
export declare const METADATA_KEY: typeof keys;
|
|
4
|
-
export { Container } from './container/container';
|
|
5
|
-
export { BindingScopeEnum, BindingTypeEnum, TargetTypeEnum, } from './constants/literal_types';
|
|
6
|
-
export { AsyncContainerModule, ContainerModule, } from './container/container_module';
|
|
7
|
-
export { createTaggedDecorator } from './annotation/decorator_utils';
|
|
8
|
-
export { injectable } from './annotation/injectable';
|
|
9
|
-
export { tagged } from './annotation/tagged';
|
|
10
|
-
export { named } from './annotation/named';
|
|
11
|
-
export { inject } from './annotation/inject';
|
|
12
|
-
export { optional } from './annotation/optional';
|
|
13
|
-
export { unmanaged } from './annotation/unmanaged';
|
|
14
|
-
export { multiInject } from './annotation/multi_inject';
|
|
15
|
-
export { targetName } from './annotation/target_name';
|
|
16
|
-
export { postConstruct } from './annotation/post_construct';
|
|
17
|
-
export { preDestroy } from './annotation/pre_destroy';
|
|
18
|
-
export { MetadataReader } from './planning/metadata_reader';
|
|
19
|
-
export { id } from './utils/id';
|
|
20
|
-
export type { interfaces } from './interfaces/interfaces';
|
|
21
|
-
export { decorate } from './annotation/decorator_utils';
|
|
22
|
-
export { traverseAncerstors, taggedConstraint, namedConstraint, typeConstraint, } from './syntax/constraint_helpers';
|
|
23
|
-
export { getServiceIdentifierAsString } from './utils/serialization';
|
|
24
|
-
export { multiBindToService } from './utils/binding_utils';
|
package/amd/inversify.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2
|
-
if (k2 === undefined) k2 = k;
|
|
3
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
4
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
5
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
6
|
-
}
|
|
7
|
-
Object.defineProperty(o, k2, desc);
|
|
8
|
-
}) : (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
o[k2] = m[k];
|
|
11
|
-
}));
|
|
12
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
13
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
14
|
-
}) : function(o, v) {
|
|
15
|
-
o["default"] = v;
|
|
16
|
-
});
|
|
17
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
18
|
-
if (mod && mod.__esModule) return mod;
|
|
19
|
-
var result = {};
|
|
20
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
21
|
-
__setModuleDefault(result, mod);
|
|
22
|
-
return result;
|
|
23
|
-
};
|
|
24
|
-
define(["require", "exports", "./constants/metadata_keys", "@inversifyjs/common", "./container/container", "./constants/literal_types", "./container/container_module", "./annotation/decorator_utils", "./annotation/injectable", "./annotation/tagged", "./annotation/named", "./annotation/inject", "./annotation/optional", "./annotation/unmanaged", "./annotation/multi_inject", "./annotation/target_name", "./annotation/post_construct", "./annotation/pre_destroy", "./planning/metadata_reader", "./utils/id", "./annotation/decorator_utils", "./syntax/constraint_helpers", "./utils/serialization", "./utils/binding_utils"], function (require, exports, keys, common_1, container_1, literal_types_1, container_module_1, decorator_utils_1, injectable_1, tagged_1, named_1, inject_1, optional_1, unmanaged_1, multi_inject_1, target_name_1, post_construct_1, pre_destroy_1, metadata_reader_1, id_1, decorator_utils_2, constraint_helpers_1, serialization_1, binding_utils_1) {
|
|
25
|
-
"use strict";
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.multiBindToService = exports.getServiceIdentifierAsString = exports.typeConstraint = exports.namedConstraint = exports.taggedConstraint = exports.traverseAncerstors = exports.decorate = exports.id = exports.MetadataReader = exports.preDestroy = exports.postConstruct = exports.targetName = exports.multiInject = exports.unmanaged = exports.optional = exports.inject = exports.named = exports.tagged = exports.injectable = exports.createTaggedDecorator = exports.ContainerModule = exports.AsyncContainerModule = exports.TargetTypeEnum = exports.BindingTypeEnum = exports.BindingScopeEnum = exports.Container = exports.METADATA_KEY = exports.LazyServiceIdentifier = void 0;
|
|
28
|
-
keys = __importStar(keys);
|
|
29
|
-
Object.defineProperty(exports, "LazyServiceIdentifier", { enumerable: true, get: function () { return common_1.LazyServiceIdentifier; } });
|
|
30
|
-
exports.METADATA_KEY = keys;
|
|
31
|
-
Object.defineProperty(exports, "Container", { enumerable: true, get: function () { return container_1.Container; } });
|
|
32
|
-
Object.defineProperty(exports, "BindingScopeEnum", { enumerable: true, get: function () { return literal_types_1.BindingScopeEnum; } });
|
|
33
|
-
Object.defineProperty(exports, "BindingTypeEnum", { enumerable: true, get: function () { return literal_types_1.BindingTypeEnum; } });
|
|
34
|
-
Object.defineProperty(exports, "TargetTypeEnum", { enumerable: true, get: function () { return literal_types_1.TargetTypeEnum; } });
|
|
35
|
-
Object.defineProperty(exports, "AsyncContainerModule", { enumerable: true, get: function () { return container_module_1.AsyncContainerModule; } });
|
|
36
|
-
Object.defineProperty(exports, "ContainerModule", { enumerable: true, get: function () { return container_module_1.ContainerModule; } });
|
|
37
|
-
Object.defineProperty(exports, "createTaggedDecorator", { enumerable: true, get: function () { return decorator_utils_1.createTaggedDecorator; } });
|
|
38
|
-
Object.defineProperty(exports, "injectable", { enumerable: true, get: function () { return injectable_1.injectable; } });
|
|
39
|
-
Object.defineProperty(exports, "tagged", { enumerable: true, get: function () { return tagged_1.tagged; } });
|
|
40
|
-
Object.defineProperty(exports, "named", { enumerable: true, get: function () { return named_1.named; } });
|
|
41
|
-
Object.defineProperty(exports, "inject", { enumerable: true, get: function () { return inject_1.inject; } });
|
|
42
|
-
Object.defineProperty(exports, "optional", { enumerable: true, get: function () { return optional_1.optional; } });
|
|
43
|
-
Object.defineProperty(exports, "unmanaged", { enumerable: true, get: function () { return unmanaged_1.unmanaged; } });
|
|
44
|
-
Object.defineProperty(exports, "multiInject", { enumerable: true, get: function () { return multi_inject_1.multiInject; } });
|
|
45
|
-
Object.defineProperty(exports, "targetName", { enumerable: true, get: function () { return target_name_1.targetName; } });
|
|
46
|
-
Object.defineProperty(exports, "postConstruct", { enumerable: true, get: function () { return post_construct_1.postConstruct; } });
|
|
47
|
-
Object.defineProperty(exports, "preDestroy", { enumerable: true, get: function () { return pre_destroy_1.preDestroy; } });
|
|
48
|
-
Object.defineProperty(exports, "MetadataReader", { enumerable: true, get: function () { return metadata_reader_1.MetadataReader; } });
|
|
49
|
-
Object.defineProperty(exports, "id", { enumerable: true, get: function () { return id_1.id; } });
|
|
50
|
-
Object.defineProperty(exports, "decorate", { enumerable: true, get: function () { return decorator_utils_2.decorate; } });
|
|
51
|
-
Object.defineProperty(exports, "traverseAncerstors", { enumerable: true, get: function () { return constraint_helpers_1.traverseAncerstors; } });
|
|
52
|
-
Object.defineProperty(exports, "taggedConstraint", { enumerable: true, get: function () { return constraint_helpers_1.taggedConstraint; } });
|
|
53
|
-
Object.defineProperty(exports, "namedConstraint", { enumerable: true, get: function () { return constraint_helpers_1.namedConstraint; } });
|
|
54
|
-
Object.defineProperty(exports, "typeConstraint", { enumerable: true, get: function () { return constraint_helpers_1.typeConstraint; } });
|
|
55
|
-
Object.defineProperty(exports, "getServiceIdentifierAsString", { enumerable: true, get: function () { return serialization_1.getServiceIdentifierAsString; } });
|
|
56
|
-
Object.defineProperty(exports, "multiBindToService", { enumerable: true, get: function () { return binding_utils_1.multiBindToService; } });
|
|
57
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { interfaces } from '../interfaces/interfaces';
|
|
2
|
-
declare class Context implements interfaces.Context {
|
|
3
|
-
id: number;
|
|
4
|
-
container: interfaces.Container;
|
|
5
|
-
plan: interfaces.Plan;
|
|
6
|
-
currentRequest: interfaces.Request;
|
|
7
|
-
constructor(container: interfaces.Container);
|
|
8
|
-
addPlan(plan: interfaces.Plan): void;
|
|
9
|
-
setCurrentRequest(currentRequest: interfaces.Request): void;
|
|
10
|
-
}
|
|
11
|
-
export { Context };
|