inversify 6.0.2 → 6.0.3
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/.nyc_output/c29b2307-4e95-47d0-b220-9efcfa7ee49f.json +1 -0
- package/.nyc_output/processinfo/c29b2307-4e95-47d0-b220-9efcfa7ee49f.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -1
- package/CHANGELOG.md +86 -81
- package/LICENSE +22 -22
- package/README.md +311 -309
- package/amd/annotation/decorator_utils.js +117 -114
- package/amd/annotation/inject.js +31 -27
- package/amd/annotation/inject_base.js +16 -17
- package/amd/annotation/injectable.js +40 -37
- package/amd/annotation/lazy_service_identifier.js +15 -15
- package/amd/annotation/multi_inject.js +31 -27
- package/amd/annotation/named.js +32 -29
- package/amd/annotation/optional.js +32 -29
- package/amd/annotation/post_construct.js +32 -28
- package/amd/annotation/pre_destroy.js +32 -28
- package/amd/annotation/property_event_decorator.js +16 -17
- package/amd/annotation/tagged.js +8 -9
- package/amd/annotation/target_name.js +35 -32
- package/amd/annotation/unmanaged.js +35 -32
- package/amd/bindings/binding.js +39 -39
- package/amd/bindings/binding_count.js +10 -10
- package/amd/constants/error_msgs.js +74 -64
- package/amd/constants/literal_types.js +28 -28
- package/amd/constants/metadata_keys.js +28 -28
- package/amd/container/container.js +723 -719
- package/amd/container/container_module.js +21 -21
- package/amd/container/container_snapshot.js +20 -20
- package/amd/container/lookup.js +131 -127
- package/amd/container/module_activation_store.js +53 -53
- package/amd/interfaces/interfaces.js +9 -10
- package/amd/inversify.js +59 -55
- package/amd/planning/context.js +19 -19
- package/amd/planning/metadata.js +45 -41
- package/amd/planning/metadata_reader.js +47 -43
- package/amd/planning/plan.js +13 -13
- package/amd/planning/planner.js +166 -163
- package/amd/planning/queryable_string.js +30 -30
- package/amd/planning/reflection_utils.js +161 -157
- package/amd/planning/request.js +26 -26
- package/amd/planning/target.js +105 -101
- package/amd/resolution/instantiation.js +214 -211
- package/amd/resolution/resolver.js +225 -222
- package/amd/scope/scope.js +93 -93
- package/amd/syntax/binding_in_syntax.js +24 -24
- package/amd/syntax/binding_in_when_on_syntax.js +75 -75
- package/amd/syntax/binding_on_syntax.js +20 -20
- package/amd/syntax/binding_to_syntax.js +109 -105
- package/amd/syntax/binding_when_on_syntax.js +65 -65
- package/amd/syntax/binding_when_syntax.js +102 -102
- package/amd/syntax/constraint_helpers.js +65 -61
- package/amd/utils/async.js +16 -17
- package/amd/utils/binding_utils.js +81 -77
- package/amd/utils/clonable.js +11 -12
- package/amd/utils/exceptions.js +46 -42
- package/amd/utils/factory_type.js +11 -11
- package/amd/utils/id.js +9 -10
- package/amd/utils/js.js +18 -19
- package/amd/utils/serialization.js +132 -129
- package/es/annotation/decorator_utils.js +88 -88
- package/es/annotation/inject.js +4 -4
- package/es/annotation/inject_base.js +14 -14
- package/es/annotation/injectable.js +13 -13
- package/es/annotation/lazy_service_identifier.js +10 -10
- package/es/annotation/multi_inject.js +4 -4
- package/es/annotation/named.js +7 -7
- package/es/annotation/optional.js +7 -7
- package/es/annotation/post_construct.js +5 -5
- package/es/annotation/pre_destroy.js +5 -5
- package/es/annotation/property_event_decorator.js +13 -13
- package/es/annotation/tagged.js +6 -6
- package/es/annotation/target_name.js +10 -10
- package/es/annotation/unmanaged.js +10 -10
- package/es/bindings/binding.js +36 -36
- package/es/bindings/binding_count.js +5 -5
- package/es/constants/error_msgs.js +62 -52
- package/es/constants/literal_types.js +21 -21
- package/es/constants/metadata_keys.js +23 -23
- package/es/container/container.js +707 -707
- package/es/container/container_module.js +17 -17
- package/es/container/container_snapshot.js +15 -15
- package/es/container/lookup.js +104 -104
- package/es/container/module_activation_store.js +49 -49
- package/es/interfaces/interfaces.js +5 -5
- package/es/inversify.js +25 -25
- package/es/planning/context.js +15 -15
- package/es/planning/metadata.js +17 -17
- package/es/planning/metadata_reader.js +19 -19
- package/es/planning/plan.js +8 -8
- package/es/planning/planner.js +147 -147
- package/es/planning/queryable_string.js +25 -25
- package/es/planning/reflection_utils.js +135 -135
- package/es/planning/request.js +22 -22
- package/es/planning/target.js +81 -81
- package/es/resolution/instantiation.js +190 -190
- package/es/resolution/resolver.js +205 -205
- package/es/scope/scope.js +88 -88
- package/es/syntax/binding_in_syntax.js +21 -21
- package/es/syntax/binding_in_when_on_syntax.js +73 -73
- package/es/syntax/binding_on_syntax.js +16 -16
- package/es/syntax/binding_to_syntax.js +84 -84
- package/es/syntax/binding_when_on_syntax.js +62 -62
- package/es/syntax/binding_when_syntax.js +99 -99
- package/es/syntax/constraint_helpers.js +35 -35
- package/es/utils/async.js +11 -11
- package/es/utils/binding_utils.js +53 -53
- package/es/utils/clonable.js +7 -7
- package/es/utils/exceptions.js +16 -16
- package/es/utils/factory_type.js +6 -6
- package/es/utils/id.js +5 -5
- package/es/utils/js.js +13 -13
- package/es/utils/serialization.js +100 -100
- package/es6/annotation/decorator_utils.js +112 -109
- package/es6/annotation/inject.js +30 -26
- package/es6/annotation/inject_base.js +17 -18
- package/es6/annotation/injectable.js +38 -35
- package/es6/annotation/lazy_service_identifier.js +12 -12
- package/es6/annotation/multi_inject.js +30 -26
- package/es6/annotation/named.js +32 -29
- package/es6/annotation/optional.js +32 -29
- package/es6/annotation/post_construct.js +31 -27
- package/es6/annotation/pre_destroy.js +31 -27
- package/es6/annotation/property_event_decorator.js +15 -16
- package/es6/annotation/tagged.js +8 -9
- package/es6/annotation/target_name.js +35 -32
- package/es6/annotation/unmanaged.js +35 -32
- package/es6/bindings/binding.js +38 -38
- package/es6/bindings/binding_count.js +8 -8
- package/es6/constants/error_msgs.js +62 -53
- package/es6/constants/literal_types.js +26 -26
- package/es6/constants/metadata_keys.js +26 -26
- package/es6/container/container.js +524 -520
- package/es6/container/container_module.js +18 -18
- package/es6/container/container_snapshot.js +15 -15
- package/es6/container/lookup.js +124 -120
- package/es6/container/module_activation_store.js +51 -51
- package/es6/interfaces/interfaces.js +7 -8
- package/es6/inversify.js +80 -76
- package/es6/planning/context.js +17 -17
- package/es6/planning/metadata.js +42 -38
- package/es6/planning/metadata_reader.js +42 -38
- package/es6/planning/plan.js +10 -10
- package/es6/planning/planner.js +173 -170
- package/es6/planning/queryable_string.js +27 -27
- package/es6/planning/reflection_utils.js +159 -155
- package/es6/planning/request.js +24 -24
- package/es6/planning/target.js +103 -99
- package/es6/resolution/instantiation.js +154 -151
- package/es6/resolution/resolver.js +190 -187
- package/es6/scope/scope.js +57 -57
- package/es6/syntax/binding_in_syntax.js +23 -23
- package/es6/syntax/binding_in_when_on_syntax.js +75 -75
- package/es6/syntax/binding_on_syntax.js +18 -18
- package/es6/syntax/binding_to_syntax.js +109 -105
- package/es6/syntax/binding_when_on_syntax.js +64 -64
- package/es6/syntax/binding_when_syntax.js +79 -79
- package/es6/syntax/constraint_helpers.js +62 -58
- package/es6/utils/async.js +14 -15
- package/es6/utils/binding_utils.js +72 -68
- package/es6/utils/clonable.js +9 -10
- package/es6/utils/exceptions.js +44 -40
- package/es6/utils/factory_type.js +9 -9
- package/es6/utils/id.js +7 -8
- package/es6/utils/js.js +15 -16
- package/es6/utils/serialization.js +129 -126
- package/lib/annotation/decorator_utils.d.ts +16 -16
- package/lib/annotation/decorator_utils.js +116 -113
- package/lib/annotation/inject.d.ts +2 -2
- package/lib/annotation/inject.js +30 -26
- package/lib/annotation/inject_base.d.ts +3 -3
- package/lib/annotation/inject_base.js +17 -18
- package/lib/annotation/injectable.d.ts +2 -2
- package/lib/annotation/injectable.js +38 -35
- package/lib/annotation/lazy_service_identifier.d.ts +7 -7
- package/lib/annotation/lazy_service_identifier.js +13 -13
- package/lib/annotation/multi_inject.d.ts +2 -2
- package/lib/annotation/multi_inject.js +30 -26
- package/lib/annotation/named.d.ts +2 -2
- package/lib/annotation/named.js +32 -29
- package/lib/annotation/optional.d.ts +2 -2
- package/lib/annotation/optional.js +32 -29
- package/lib/annotation/post_construct.d.ts +4 -4
- package/lib/annotation/post_construct.js +31 -27
- package/lib/annotation/pre_destroy.d.ts +4 -4
- package/lib/annotation/pre_destroy.js +31 -27
- package/lib/annotation/property_event_decorator.d.ts +4 -4
- package/lib/annotation/property_event_decorator.js +15 -16
- package/lib/annotation/tagged.d.ts +2 -2
- package/lib/annotation/tagged.js +8 -9
- package/lib/annotation/target_name.d.ts +3 -3
- package/lib/annotation/target_name.js +35 -32
- package/lib/annotation/unmanaged.d.ts +3 -3
- package/lib/annotation/unmanaged.js +35 -32
- package/lib/bindings/binding.d.ts +20 -20
- package/lib/bindings/binding.js +39 -39
- package/lib/bindings/binding_count.d.ts +5 -5
- package/lib/bindings/binding_count.js +8 -8
- package/lib/constants/error_msgs.d.ts +32 -32
- package/lib/constants/error_msgs.js +72 -62
- package/lib/constants/literal_types.d.ts +5 -5
- package/lib/constants/literal_types.js +26 -26
- package/lib/constants/metadata_keys.d.ts +13 -13
- package/lib/constants/metadata_keys.js +26 -26
- package/lib/container/container.d.ts +73 -73
- package/lib/container/container.js +733 -729
- package/lib/container/container_module.d.ts +11 -11
- package/lib/container/container_module.js +20 -20
- package/lib/container/container_snapshot.d.ts +10 -10
- package/lib/container/container_snapshot.js +18 -18
- package/lib/container/lookup.d.ts +16 -16
- package/lib/container/lookup.js +130 -126
- package/lib/container/module_activation_store.d.ts +10 -10
- package/lib/container/module_activation_store.js +52 -52
- package/lib/interfaces/interfaces.d.ts +284 -284
- package/lib/interfaces/interfaces.js +7 -8
- package/lib/inversify.d.ts +25 -25
- package/lib/inversify.js +80 -76
- package/lib/planning/context.d.ts +11 -11
- package/lib/planning/context.js +18 -18
- package/lib/planning/metadata.d.ts +8 -8
- package/lib/planning/metadata.js +43 -39
- package/lib/planning/metadata_reader.d.ts +6 -6
- package/lib/planning/metadata_reader.js +45 -41
- package/lib/planning/plan.d.ts +7 -7
- package/lib/planning/plan.js +11 -11
- package/lib/planning/planner.d.ts +5 -5
- package/lib/planning/planner.js +174 -171
- package/lib/planning/queryable_string.d.ts +11 -11
- package/lib/planning/queryable_string.js +28 -28
- package/lib/planning/reflection_utils.d.ts +5 -5
- package/lib/planning/reflection_utils.js +163 -159
- package/lib/planning/request.d.ts +14 -14
- package/lib/planning/request.js +25 -25
- package/lib/planning/target.d.ts +23 -23
- package/lib/planning/target.js +107 -103
- package/lib/resolution/instantiation.d.ts +3 -3
- package/lib/resolution/instantiation.js +215 -212
- package/lib/resolution/resolver.d.ts +3 -3
- package/lib/resolution/resolver.js +230 -227
- package/lib/scope/scope.d.ts +3 -3
- package/lib/scope/scope.js +93 -93
- package/lib/syntax/binding_in_syntax.d.ts +9 -9
- package/lib/syntax/binding_in_syntax.js +24 -24
- package/lib/syntax/binding_in_when_on_syntax.d.ts +29 -29
- package/lib/syntax/binding_in_when_on_syntax.js +76 -76
- package/lib/syntax/binding_on_syntax.d.ts +8 -8
- package/lib/syntax/binding_on_syntax.js +19 -19
- package/lib/syntax/binding_to_syntax.d.ts +18 -18
- package/lib/syntax/binding_to_syntax.js +110 -106
- package/lib/syntax/binding_when_on_syntax.d.ts +25 -25
- package/lib/syntax/binding_when_on_syntax.js +65 -65
- package/lib/syntax/binding_when_syntax.d.ts +21 -21
- package/lib/syntax/binding_when_syntax.js +102 -102
- package/lib/syntax/constraint_helpers.d.ts +6 -6
- package/lib/syntax/constraint_helpers.js +64 -60
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/async.d.ts +3 -3
- package/lib/utils/async.js +14 -15
- package/lib/utils/binding_utils.d.ts +4 -4
- package/lib/utils/binding_utils.js +82 -78
- package/lib/utils/clonable.d.ts +3 -3
- package/lib/utils/clonable.js +9 -10
- package/lib/utils/exceptions.d.ts +2 -2
- package/lib/utils/exceptions.js +44 -40
- package/lib/utils/factory_type.d.ts +5 -5
- package/lib/utils/factory_type.js +9 -9
- package/lib/utils/id.d.ts +2 -2
- package/lib/utils/id.js +7 -8
- package/lib/utils/js.d.ts +1 -1
- package/lib/utils/js.js +16 -17
- package/lib/utils/serialization.d.ts +10 -10
- package/lib/utils/serialization.js +130 -127
- package/package.json +60 -61
- package/.nyc_output/16b95af9-19b9-451c-8475-9a8585677128.json +0 -1
- package/.nyc_output/processinfo/16b95af9-19b9-451c-8475-9a8585677128.json +0 -1
package/amd/planning/context.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
define(["require", "exports", "../utils/id"], function (require, exports, id_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Context = void 0;
|
|
5
|
-
var Context = (function () {
|
|
6
|
-
function Context(container) {
|
|
7
|
-
this.id = (0, id_1.id)();
|
|
8
|
-
this.container = container;
|
|
9
|
-
}
|
|
10
|
-
Context.prototype.addPlan = function (plan) {
|
|
11
|
-
this.plan = plan;
|
|
12
|
-
};
|
|
13
|
-
Context.prototype.setCurrentRequest = function (currentRequest) {
|
|
14
|
-
this.currentRequest = currentRequest;
|
|
15
|
-
};
|
|
16
|
-
return Context;
|
|
17
|
-
}());
|
|
18
|
-
exports.Context = Context;
|
|
19
|
-
});
|
|
1
|
+
define(["require", "exports", "../utils/id"], function (require, exports, id_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Context = void 0;
|
|
5
|
+
var Context = (function () {
|
|
6
|
+
function Context(container) {
|
|
7
|
+
this.id = (0, id_1.id)();
|
|
8
|
+
this.container = container;
|
|
9
|
+
}
|
|
10
|
+
Context.prototype.addPlan = function (plan) {
|
|
11
|
+
this.plan = plan;
|
|
12
|
+
};
|
|
13
|
+
Context.prototype.setCurrentRequest = function (currentRequest) {
|
|
14
|
+
this.currentRequest = currentRequest;
|
|
15
|
+
};
|
|
16
|
+
return Context;
|
|
17
|
+
}());
|
|
18
|
+
exports.Context = Context;
|
|
19
|
+
});
|
package/amd/planning/metadata.js
CHANGED
|
@@ -1,41 +1,45 @@
|
|
|
1
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2
|
-
if (k2 === undefined) k2 = k;
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
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"], function (require, exports, METADATA_KEY) {
|
|
25
|
+
"use strict";
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.Metadata = void 0;
|
|
28
|
+
METADATA_KEY = __importStar(METADATA_KEY);
|
|
29
|
+
var Metadata = (function () {
|
|
30
|
+
function Metadata(key, value) {
|
|
31
|
+
this.key = key;
|
|
32
|
+
this.value = value;
|
|
33
|
+
}
|
|
34
|
+
Metadata.prototype.toString = function () {
|
|
35
|
+
if (this.key === METADATA_KEY.NAMED_TAG) {
|
|
36
|
+
return "named: ".concat(String(this.value).toString(), " ");
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return "tagged: { key:".concat(this.key.toString(), ", value: ").concat(String(this.value), " }");
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
return Metadata;
|
|
43
|
+
}());
|
|
44
|
+
exports.Metadata = Metadata;
|
|
45
|
+
});
|
|
@@ -1,43 +1,47 @@
|
|
|
1
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2
|
-
if (k2 === undefined) k2 = k;
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
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"], function (require, exports, METADATA_KEY) {
|
|
25
|
+
"use strict";
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.MetadataReader = void 0;
|
|
28
|
+
METADATA_KEY = __importStar(METADATA_KEY);
|
|
29
|
+
var MetadataReader = (function () {
|
|
30
|
+
function MetadataReader() {
|
|
31
|
+
}
|
|
32
|
+
MetadataReader.prototype.getConstructorMetadata = function (constructorFunc) {
|
|
33
|
+
var compilerGeneratedMetadata = Reflect.getMetadata(METADATA_KEY.PARAM_TYPES, constructorFunc);
|
|
34
|
+
var userGeneratedMetadata = Reflect.getMetadata(METADATA_KEY.TAGGED, constructorFunc);
|
|
35
|
+
return {
|
|
36
|
+
compilerGeneratedMetadata: compilerGeneratedMetadata,
|
|
37
|
+
userGeneratedMetadata: userGeneratedMetadata || {}
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
MetadataReader.prototype.getPropertiesMetadata = function (constructorFunc) {
|
|
41
|
+
var userGeneratedMetadata = Reflect.getMetadata(METADATA_KEY.TAGGED_PROP, constructorFunc) || [];
|
|
42
|
+
return userGeneratedMetadata;
|
|
43
|
+
};
|
|
44
|
+
return MetadataReader;
|
|
45
|
+
}());
|
|
46
|
+
exports.MetadataReader = MetadataReader;
|
|
47
|
+
});
|
package/amd/planning/plan.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
define(["require", "exports"], function (require, exports) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Plan = void 0;
|
|
5
|
-
var Plan = (function () {
|
|
6
|
-
function Plan(parentContext, rootRequest) {
|
|
7
|
-
this.parentContext = parentContext;
|
|
8
|
-
this.rootRequest = rootRequest;
|
|
9
|
-
}
|
|
10
|
-
return Plan;
|
|
11
|
-
}());
|
|
12
|
-
exports.Plan = Plan;
|
|
13
|
-
});
|
|
1
|
+
define(["require", "exports"], function (require, exports) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Plan = void 0;
|
|
5
|
+
var Plan = (function () {
|
|
6
|
+
function Plan(parentContext, rootRequest) {
|
|
7
|
+
this.parentContext = parentContext;
|
|
8
|
+
this.rootRequest = rootRequest;
|
|
9
|
+
}
|
|
10
|
+
return Plan;
|
|
11
|
+
}());
|
|
12
|
+
exports.Plan = Plan;
|
|
13
|
+
});
|
package/amd/planning/planner.js
CHANGED
|
@@ -1,163 +1,166 @@
|
|
|
1
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2
|
-
if (k2 === undefined) k2 = k;
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
exports.getBindingDictionary = getBindingDictionary;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
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", "../bindings/binding_count", "../constants/error_msgs", "../constants/literal_types", "../constants/metadata_keys", "../utils/exceptions", "../utils/serialization", "./context", "./metadata", "./plan", "./reflection_utils", "./request", "./target"], function (require, exports, binding_count_1, ERROR_MSGS, literal_types_1, METADATA_KEY, exceptions_1, serialization_1, context_1, metadata_1, plan_1, reflection_utils_1, request_1, target_1) {
|
|
25
|
+
"use strict";
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.plan = plan;
|
|
28
|
+
exports.createMockRequest = createMockRequest;
|
|
29
|
+
exports.getBindingDictionary = getBindingDictionary;
|
|
30
|
+
ERROR_MSGS = __importStar(ERROR_MSGS);
|
|
31
|
+
METADATA_KEY = __importStar(METADATA_KEY);
|
|
32
|
+
function getBindingDictionary(cntnr) {
|
|
33
|
+
return cntnr._bindingDictionary;
|
|
34
|
+
}
|
|
35
|
+
function _createTarget(isMultiInject, targetType, serviceIdentifier, name, key, value) {
|
|
36
|
+
var metadataKey = isMultiInject ? METADATA_KEY.MULTI_INJECT_TAG : METADATA_KEY.INJECT_TAG;
|
|
37
|
+
var injectMetadata = new metadata_1.Metadata(metadataKey, serviceIdentifier);
|
|
38
|
+
var target = new target_1.Target(targetType, name, serviceIdentifier, injectMetadata);
|
|
39
|
+
if (key !== undefined) {
|
|
40
|
+
var tagMetadata = new metadata_1.Metadata(key, value);
|
|
41
|
+
target.metadata.push(tagMetadata);
|
|
42
|
+
}
|
|
43
|
+
return target;
|
|
44
|
+
}
|
|
45
|
+
function _getActiveBindings(metadataReader, avoidConstraints, context, parentRequest, target) {
|
|
46
|
+
var bindings = getBindings(context.container, target.serviceIdentifier);
|
|
47
|
+
var activeBindings = [];
|
|
48
|
+
if (bindings.length === binding_count_1.BindingCount.NoBindingsAvailable &&
|
|
49
|
+
context.container.options.autoBindInjectable &&
|
|
50
|
+
typeof target.serviceIdentifier === 'function' &&
|
|
51
|
+
metadataReader.getConstructorMetadata(target.serviceIdentifier).compilerGeneratedMetadata) {
|
|
52
|
+
context.container.bind(target.serviceIdentifier).toSelf();
|
|
53
|
+
bindings = getBindings(context.container, target.serviceIdentifier);
|
|
54
|
+
}
|
|
55
|
+
if (!avoidConstraints) {
|
|
56
|
+
activeBindings = bindings.filter(function (binding) {
|
|
57
|
+
var request = new request_1.Request(binding.serviceIdentifier, context, parentRequest, binding, target);
|
|
58
|
+
return binding.constraint(request);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
activeBindings = bindings;
|
|
63
|
+
}
|
|
64
|
+
_validateActiveBindingCount(target.serviceIdentifier, activeBindings, target, context.container);
|
|
65
|
+
return activeBindings;
|
|
66
|
+
}
|
|
67
|
+
function _validateActiveBindingCount(serviceIdentifier, bindings, target, container) {
|
|
68
|
+
switch (bindings.length) {
|
|
69
|
+
case binding_count_1.BindingCount.NoBindingsAvailable:
|
|
70
|
+
if (target.isOptional()) {
|
|
71
|
+
return bindings;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
var serviceIdentifierString = (0, serialization_1.getServiceIdentifierAsString)(serviceIdentifier);
|
|
75
|
+
var msg = ERROR_MSGS.NOT_REGISTERED;
|
|
76
|
+
msg += (0, serialization_1.listMetadataForTarget)(serviceIdentifierString, target);
|
|
77
|
+
msg += (0, serialization_1.listRegisteredBindingsForServiceIdentifier)(container, serviceIdentifierString, getBindings);
|
|
78
|
+
throw new Error(msg);
|
|
79
|
+
}
|
|
80
|
+
case binding_count_1.BindingCount.OnlyOneBindingAvailable:
|
|
81
|
+
return bindings;
|
|
82
|
+
case binding_count_1.BindingCount.MultipleBindingsAvailable:
|
|
83
|
+
default:
|
|
84
|
+
if (!target.isArray()) {
|
|
85
|
+
var serviceIdentifierString = (0, serialization_1.getServiceIdentifierAsString)(serviceIdentifier);
|
|
86
|
+
var msg = "".concat(ERROR_MSGS.AMBIGUOUS_MATCH, " ").concat(serviceIdentifierString);
|
|
87
|
+
msg += (0, serialization_1.listRegisteredBindingsForServiceIdentifier)(container, serviceIdentifierString, getBindings);
|
|
88
|
+
throw new Error(msg);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
return bindings;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function _createSubRequests(metadataReader, avoidConstraints, serviceIdentifier, context, parentRequest, target) {
|
|
96
|
+
var activeBindings;
|
|
97
|
+
var childRequest;
|
|
98
|
+
if (parentRequest === null) {
|
|
99
|
+
activeBindings = _getActiveBindings(metadataReader, avoidConstraints, context, null, target);
|
|
100
|
+
childRequest = new request_1.Request(serviceIdentifier, context, null, activeBindings, target);
|
|
101
|
+
var thePlan = new plan_1.Plan(context, childRequest);
|
|
102
|
+
context.addPlan(thePlan);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
activeBindings = _getActiveBindings(metadataReader, avoidConstraints, context, parentRequest, target);
|
|
106
|
+
childRequest = parentRequest.addChildRequest(target.serviceIdentifier, activeBindings, target);
|
|
107
|
+
}
|
|
108
|
+
activeBindings.forEach(function (binding) {
|
|
109
|
+
var subChildRequest = null;
|
|
110
|
+
if (target.isArray()) {
|
|
111
|
+
subChildRequest = childRequest.addChildRequest(binding.serviceIdentifier, binding, target);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
if (binding.cache) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
subChildRequest = childRequest;
|
|
118
|
+
}
|
|
119
|
+
if (binding.type === literal_types_1.BindingTypeEnum.Instance && binding.implementationType !== null) {
|
|
120
|
+
var dependencies = (0, reflection_utils_1.getDependencies)(metadataReader, binding.implementationType);
|
|
121
|
+
if (!context.container.options.skipBaseClassChecks) {
|
|
122
|
+
var baseClassDependencyCount = (0, reflection_utils_1.getBaseClassDependencyCount)(metadataReader, binding.implementationType);
|
|
123
|
+
if (dependencies.length < baseClassDependencyCount) {
|
|
124
|
+
var error = ERROR_MSGS.ARGUMENTS_LENGTH_MISMATCH((0, reflection_utils_1.getFunctionName)(binding.implementationType));
|
|
125
|
+
throw new Error(error);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
dependencies.forEach(function (dependency) {
|
|
129
|
+
_createSubRequests(metadataReader, false, dependency.serviceIdentifier, context, subChildRequest, dependency);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
function getBindings(container, serviceIdentifier) {
|
|
135
|
+
var bindings = [];
|
|
136
|
+
var bindingDictionary = getBindingDictionary(container);
|
|
137
|
+
if (bindingDictionary.hasKey(serviceIdentifier)) {
|
|
138
|
+
bindings = bindingDictionary.get(serviceIdentifier);
|
|
139
|
+
}
|
|
140
|
+
else if (container.parent !== null) {
|
|
141
|
+
bindings = getBindings(container.parent, serviceIdentifier);
|
|
142
|
+
}
|
|
143
|
+
return bindings;
|
|
144
|
+
}
|
|
145
|
+
function plan(metadataReader, container, isMultiInject, targetType, serviceIdentifier, key, value, avoidConstraints) {
|
|
146
|
+
if (avoidConstraints === void 0) { avoidConstraints = false; }
|
|
147
|
+
var context = new context_1.Context(container);
|
|
148
|
+
var target = _createTarget(isMultiInject, targetType, serviceIdentifier, '', key, value);
|
|
149
|
+
try {
|
|
150
|
+
_createSubRequests(metadataReader, avoidConstraints, serviceIdentifier, context, null, target);
|
|
151
|
+
return context;
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
if ((0, exceptions_1.isStackOverflowException)(error)) {
|
|
155
|
+
(0, serialization_1.circularDependencyToException)(context.plan.rootRequest);
|
|
156
|
+
}
|
|
157
|
+
throw error;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
function createMockRequest(container, serviceIdentifier, key, value) {
|
|
161
|
+
var target = new target_1.Target(literal_types_1.TargetTypeEnum.Variable, '', serviceIdentifier, new metadata_1.Metadata(key, value));
|
|
162
|
+
var context = new context_1.Context(container);
|
|
163
|
+
var request = new request_1.Request(serviceIdentifier, context, null, [], target);
|
|
164
|
+
return request;
|
|
165
|
+
}
|
|
166
|
+
});
|