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,20 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AsyncContainerModule = exports.ContainerModule = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const id_1 = require("../utils/id");
|
|
5
|
+
class ContainerModule {
|
|
6
|
+
id;
|
|
7
|
+
registry;
|
|
8
|
+
constructor(registry) {
|
|
7
9
|
this.id = (0, id_1.id)();
|
|
8
10
|
this.registry = registry;
|
|
9
11
|
}
|
|
10
|
-
|
|
11
|
-
}());
|
|
12
|
+
}
|
|
12
13
|
exports.ContainerModule = ContainerModule;
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
class AsyncContainerModule {
|
|
15
|
+
id;
|
|
16
|
+
registry;
|
|
17
|
+
constructor(registry) {
|
|
15
18
|
this.id = (0, id_1.id)();
|
|
16
19
|
this.registry = registry;
|
|
17
20
|
}
|
|
18
|
-
|
|
19
|
-
}());
|
|
21
|
+
}
|
|
20
22
|
exports.AsyncContainerModule = AsyncContainerModule;
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ContainerSnapshot = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
class ContainerSnapshot {
|
|
5
|
+
bindings;
|
|
6
|
+
activations;
|
|
7
|
+
deactivations;
|
|
8
|
+
middleware;
|
|
9
|
+
moduleActivationStore;
|
|
10
|
+
static of(bindings, middleware, activations, deactivations, moduleActivationStore) {
|
|
11
|
+
const snapshot = new ContainerSnapshot();
|
|
9
12
|
snapshot.bindings = bindings;
|
|
10
13
|
snapshot.middleware = middleware;
|
|
11
14
|
snapshot.deactivations = deactivations;
|
|
12
15
|
snapshot.activations = activations;
|
|
13
16
|
snapshot.moduleActivationStore = moduleActivationStore;
|
|
14
17
|
return snapshot;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
}());
|
|
18
|
+
}
|
|
19
|
+
}
|
|
18
20
|
exports.ContainerSnapshot = ContainerSnapshot;
|
package/lib/container/lookup.js
CHANGED
|
@@ -15,75 +15,81 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.Lookup = void 0;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
const ERROR_MSGS = __importStar(require("../constants/error_msgs"));
|
|
38
|
+
const clonable_1 = require("../utils/clonable");
|
|
39
|
+
class Lookup {
|
|
40
|
+
_map;
|
|
41
|
+
constructor() {
|
|
31
42
|
this._map = new Map();
|
|
32
43
|
}
|
|
33
|
-
|
|
44
|
+
getMap() {
|
|
34
45
|
return this._map;
|
|
35
|
-
}
|
|
36
|
-
|
|
46
|
+
}
|
|
47
|
+
add(serviceIdentifier, value) {
|
|
37
48
|
this._checkNonNulish(serviceIdentifier);
|
|
38
49
|
if (value === null || value === undefined) {
|
|
39
50
|
throw new Error(ERROR_MSGS.NULL_ARGUMENT);
|
|
40
51
|
}
|
|
41
|
-
|
|
52
|
+
const entry = this._map.get(serviceIdentifier);
|
|
42
53
|
if (entry !== undefined) {
|
|
43
54
|
entry.push(value);
|
|
44
55
|
}
|
|
45
56
|
else {
|
|
46
57
|
this._map.set(serviceIdentifier, [value]);
|
|
47
58
|
}
|
|
48
|
-
}
|
|
49
|
-
|
|
59
|
+
}
|
|
60
|
+
get(serviceIdentifier) {
|
|
50
61
|
this._checkNonNulish(serviceIdentifier);
|
|
51
|
-
|
|
62
|
+
const entry = this._map.get(serviceIdentifier);
|
|
52
63
|
if (entry !== undefined) {
|
|
53
64
|
return entry;
|
|
54
65
|
}
|
|
55
66
|
else {
|
|
56
67
|
throw new Error(ERROR_MSGS.KEY_NOT_FOUND);
|
|
57
68
|
}
|
|
58
|
-
}
|
|
59
|
-
|
|
69
|
+
}
|
|
70
|
+
remove(serviceIdentifier) {
|
|
60
71
|
this._checkNonNulish(serviceIdentifier);
|
|
61
72
|
if (!this._map.delete(serviceIdentifier)) {
|
|
62
73
|
throw new Error(ERROR_MSGS.KEY_NOT_FOUND);
|
|
63
74
|
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
var lookupActivations = lookup.hasKey(serviceIdentifier)
|
|
75
|
+
}
|
|
76
|
+
removeIntersection(lookup) {
|
|
77
|
+
this.traverse((serviceIdentifier, value) => {
|
|
78
|
+
const lookupActivations = lookup.hasKey(serviceIdentifier)
|
|
69
79
|
? lookup.get(serviceIdentifier)
|
|
70
80
|
: undefined;
|
|
71
81
|
if (lookupActivations !== undefined) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
});
|
|
75
|
-
_this._setValue(serviceIdentifier, filteredValues);
|
|
82
|
+
const filteredValues = value.filter((lookupValue) => !lookupActivations.some((moduleActivation) => lookupValue === moduleActivation));
|
|
83
|
+
this._setValue(serviceIdentifier, filteredValues);
|
|
76
84
|
}
|
|
77
85
|
});
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
var entry = entries_1[_i];
|
|
86
|
-
var remove = condition(entry);
|
|
86
|
+
}
|
|
87
|
+
removeByCondition(condition) {
|
|
88
|
+
const removals = [];
|
|
89
|
+
this._map.forEach((entries, key) => {
|
|
90
|
+
const updatedEntries = [];
|
|
91
|
+
for (const entry of entries) {
|
|
92
|
+
const remove = condition(entry);
|
|
87
93
|
if (remove) {
|
|
88
94
|
removals.push(entry);
|
|
89
95
|
}
|
|
@@ -91,41 +97,40 @@ var Lookup = (function () {
|
|
|
91
97
|
updatedEntries.push(entry);
|
|
92
98
|
}
|
|
93
99
|
}
|
|
94
|
-
|
|
100
|
+
this._setValue(key, updatedEntries);
|
|
95
101
|
});
|
|
96
102
|
return removals;
|
|
97
|
-
}
|
|
98
|
-
|
|
103
|
+
}
|
|
104
|
+
hasKey(serviceIdentifier) {
|
|
99
105
|
this._checkNonNulish(serviceIdentifier);
|
|
100
106
|
return this._map.has(serviceIdentifier);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
this._map.forEach(
|
|
105
|
-
value.forEach(
|
|
107
|
+
}
|
|
108
|
+
clone() {
|
|
109
|
+
const copy = new Lookup();
|
|
110
|
+
this._map.forEach((value, key) => {
|
|
111
|
+
value.forEach((b) => {
|
|
106
112
|
copy.add(key, (0, clonable_1.isClonable)(b) ? b.clone() : b);
|
|
107
113
|
});
|
|
108
114
|
});
|
|
109
115
|
return copy;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
this._map.forEach(
|
|
116
|
+
}
|
|
117
|
+
traverse(func) {
|
|
118
|
+
this._map.forEach((value, key) => {
|
|
113
119
|
func(key, value);
|
|
114
120
|
});
|
|
115
|
-
}
|
|
116
|
-
|
|
121
|
+
}
|
|
122
|
+
_checkNonNulish(value) {
|
|
117
123
|
if (value == null) {
|
|
118
124
|
throw new Error(ERROR_MSGS.NULL_ARGUMENT);
|
|
119
125
|
}
|
|
120
|
-
}
|
|
121
|
-
|
|
126
|
+
}
|
|
127
|
+
_setValue(serviceIdentifier, value) {
|
|
122
128
|
if (value.length > 0) {
|
|
123
129
|
this._map.set(serviceIdentifier, value);
|
|
124
130
|
}
|
|
125
131
|
else {
|
|
126
132
|
this._map.delete(serviceIdentifier);
|
|
127
133
|
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
}());
|
|
134
|
+
}
|
|
135
|
+
}
|
|
131
136
|
exports.Lookup = Lookup;
|
|
@@ -2,8 +2,8 @@ import { interfaces } from '../interfaces/interfaces';
|
|
|
2
2
|
export declare class ModuleActivationStore implements interfaces.ModuleActivationStore {
|
|
3
3
|
private readonly _map;
|
|
4
4
|
remove(moduleId: number): interfaces.ModuleActivationHandlers;
|
|
5
|
-
addDeactivation(moduleId: number, serviceIdentifier: interfaces.ServiceIdentifier<
|
|
6
|
-
addActivation(moduleId: number, serviceIdentifier: interfaces.ServiceIdentifier<
|
|
5
|
+
addDeactivation<T>(moduleId: number, serviceIdentifier: interfaces.ServiceIdentifier<T>, onDeactivation: interfaces.BindingDeactivation<T>): void;
|
|
6
|
+
addActivation<T>(moduleId: number, serviceIdentifier: interfaces.ServiceIdentifier<T>, onActivation: interfaces.BindingActivation<T>): void;
|
|
7
7
|
clone(): interfaces.ModuleActivationStore;
|
|
8
8
|
private _getModuleActivationHandlers;
|
|
9
9
|
private _getEmptyHandlersStore;
|
|
@@ -1,50 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ModuleActivationStore = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
ModuleActivationStore.prototype.remove = function (moduleId) {
|
|
10
|
-
var handlers = this._map.get(moduleId);
|
|
4
|
+
const lookup_1 = require("./lookup");
|
|
5
|
+
class ModuleActivationStore {
|
|
6
|
+
_map = new Map();
|
|
7
|
+
remove(moduleId) {
|
|
8
|
+
const handlers = this._map.get(moduleId);
|
|
11
9
|
if (handlers === undefined) {
|
|
12
10
|
return this._getEmptyHandlersStore();
|
|
13
11
|
}
|
|
14
12
|
this._map.delete(moduleId);
|
|
15
13
|
return handlers;
|
|
16
|
-
}
|
|
17
|
-
|
|
14
|
+
}
|
|
15
|
+
addDeactivation(moduleId, serviceIdentifier, onDeactivation) {
|
|
18
16
|
this._getModuleActivationHandlers(moduleId).onDeactivations.add(serviceIdentifier, onDeactivation);
|
|
19
|
-
}
|
|
20
|
-
|
|
17
|
+
}
|
|
18
|
+
addActivation(moduleId, serviceIdentifier, onActivation) {
|
|
21
19
|
this._getModuleActivationHandlers(moduleId).onActivations.add(serviceIdentifier, onActivation);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
this._map.forEach(
|
|
20
|
+
}
|
|
21
|
+
clone() {
|
|
22
|
+
const clone = new ModuleActivationStore();
|
|
23
|
+
this._map.forEach((handlersStore, moduleId) => {
|
|
26
24
|
clone._map.set(moduleId, {
|
|
27
25
|
onActivations: handlersStore.onActivations.clone(),
|
|
28
26
|
onDeactivations: handlersStore.onDeactivations.clone(),
|
|
29
27
|
});
|
|
30
28
|
});
|
|
31
29
|
return clone;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
}
|
|
31
|
+
_getModuleActivationHandlers(moduleId) {
|
|
32
|
+
let moduleActivationHandlers = this._map.get(moduleId);
|
|
35
33
|
if (moduleActivationHandlers === undefined) {
|
|
36
34
|
moduleActivationHandlers = this._getEmptyHandlersStore();
|
|
37
35
|
this._map.set(moduleId, moduleActivationHandlers);
|
|
38
36
|
}
|
|
39
37
|
return moduleActivationHandlers;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
}
|
|
39
|
+
_getEmptyHandlersStore() {
|
|
40
|
+
const handlersStore = {
|
|
43
41
|
onActivations: new lookup_1.Lookup(),
|
|
44
42
|
onDeactivations: new lookup_1.Lookup(),
|
|
45
43
|
};
|
|
46
44
|
return handlersStore;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
}());
|
|
45
|
+
}
|
|
46
|
+
}
|
|
50
47
|
exports.ModuleActivationStore = ModuleActivationStore;
|
|
@@ -182,8 +182,8 @@ declare namespace interfaces {
|
|
|
182
182
|
onDeactivations: Lookup<BindingDeactivation<unknown>>;
|
|
183
183
|
}
|
|
184
184
|
export interface ModuleActivationStore extends Clonable<ModuleActivationStore> {
|
|
185
|
-
addDeactivation(moduleId: ContainerModuleBase['id'], serviceIdentifier: ServiceIdentifier<
|
|
186
|
-
addActivation(moduleId: ContainerModuleBase['id'], serviceIdentifier: ServiceIdentifier<
|
|
185
|
+
addDeactivation<T>(moduleId: ContainerModuleBase['id'], serviceIdentifier: ServiceIdentifier<T>, onDeactivation: interfaces.BindingDeactivation<T>): void;
|
|
186
|
+
addActivation<T>(moduleId: ContainerModuleBase['id'], serviceIdentifier: ServiceIdentifier<T>, onActivation: interfaces.BindingActivation<T>): void;
|
|
187
187
|
remove(moduleId: ContainerModuleBase['id']): ModuleActivationHandlers;
|
|
188
188
|
}
|
|
189
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;
|
package/lib/inversify.d.ts
CHANGED
package/lib/inversify.js
CHANGED
|
@@ -15,16 +15,27 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
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;
|
|
27
|
-
|
|
37
|
+
require("reflect-metadata");
|
|
38
|
+
const keys = __importStar(require("./constants/metadata_keys"));
|
|
28
39
|
var common_1 = require("@inversifyjs/common");
|
|
29
40
|
Object.defineProperty(exports, "LazyServiceIdentifier", { enumerable: true, get: function () { return common_1.LazyServiceIdentifier; } });
|
|
30
41
|
exports.METADATA_KEY = keys;
|
package/lib/planning/context.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Context = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const id_1 = require("../utils/id");
|
|
5
|
+
class Context {
|
|
6
|
+
id;
|
|
7
|
+
container;
|
|
8
|
+
plan;
|
|
9
|
+
currentRequest;
|
|
10
|
+
constructor(container) {
|
|
7
11
|
this.id = (0, id_1.id)();
|
|
8
12
|
this.container = container;
|
|
9
13
|
}
|
|
10
|
-
|
|
14
|
+
addPlan(plan) {
|
|
11
15
|
this.plan = plan;
|
|
12
|
-
}
|
|
13
|
-
|
|
16
|
+
}
|
|
17
|
+
setCurrentRequest(currentRequest) {
|
|
14
18
|
this.currentRequest = currentRequest;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
}());
|
|
19
|
+
}
|
|
20
|
+
}
|
|
18
21
|
exports.Context = Context;
|
package/lib/planning/metadata.js
CHANGED
|
@@ -15,29 +15,40 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.Metadata = void 0;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
37
|
+
const METADATA_KEY = __importStar(require("../constants/metadata_keys"));
|
|
38
|
+
class Metadata {
|
|
39
|
+
key;
|
|
40
|
+
value;
|
|
41
|
+
constructor(key, value) {
|
|
30
42
|
this.key = key;
|
|
31
43
|
this.value = value;
|
|
32
44
|
}
|
|
33
|
-
|
|
45
|
+
toString() {
|
|
34
46
|
if (this.key === METADATA_KEY.NAMED_TAG) {
|
|
35
|
-
return
|
|
47
|
+
return `named: ${String(this.value).toString()} `;
|
|
36
48
|
}
|
|
37
49
|
else {
|
|
38
|
-
return
|
|
50
|
+
return `tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`;
|
|
39
51
|
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
}());
|
|
52
|
+
}
|
|
53
|
+
}
|
|
43
54
|
exports.Metadata = Metadata;
|
|
@@ -15,33 +15,38 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.MetadataReader = void 0;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var _a;
|
|
33
|
-
var compilerGeneratedMetadata = (_a = Reflect.getMetadata(METADATA_KEY.DESIGN_PARAM_TYPES, constructorFunc)) !== null && _a !== void 0 ? _a : [];
|
|
34
|
-
var userGeneratedMetadata = Reflect.getMetadata(METADATA_KEY.TAGGED, constructorFunc);
|
|
37
|
+
const METADATA_KEY = __importStar(require("../constants/metadata_keys"));
|
|
38
|
+
class MetadataReader {
|
|
39
|
+
getConstructorMetadata(constructorFunc) {
|
|
40
|
+
const compilerGeneratedMetadata = Reflect.getMetadata(METADATA_KEY.DESIGN_PARAM_TYPES, constructorFunc) ?? [];
|
|
41
|
+
const userGeneratedMetadata = Reflect.getMetadata(METADATA_KEY.TAGGED, constructorFunc);
|
|
35
42
|
return {
|
|
36
|
-
compilerGeneratedMetadata
|
|
37
|
-
userGeneratedMetadata: userGeneratedMetadata
|
|
43
|
+
compilerGeneratedMetadata,
|
|
44
|
+
userGeneratedMetadata: userGeneratedMetadata ?? {},
|
|
38
45
|
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
var userGeneratedMetadata = (_a = Reflect.getMetadata(METADATA_KEY.TAGGED_PROP, constructorFunc)) !== null && _a !== void 0 ? _a : {};
|
|
46
|
+
}
|
|
47
|
+
getPropertiesMetadata(constructorFunc) {
|
|
48
|
+
const userGeneratedMetadata = Reflect.getMetadata(METADATA_KEY.TAGGED_PROP, constructorFunc) ?? {};
|
|
43
49
|
return userGeneratedMetadata;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
}());
|
|
50
|
+
}
|
|
51
|
+
}
|
|
47
52
|
exports.MetadataReader = MetadataReader;
|
package/lib/planning/plan.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Plan = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
class Plan {
|
|
5
|
+
parentContext;
|
|
6
|
+
rootRequest;
|
|
7
|
+
constructor(parentContext, rootRequest) {
|
|
6
8
|
this.parentContext = parentContext;
|
|
7
9
|
this.rootRequest = rootRequest;
|
|
8
10
|
}
|
|
9
|
-
|
|
10
|
-
}());
|
|
11
|
+
}
|
|
11
12
|
exports.Plan = Plan;
|