inversify 6.1.4-beta.1 → 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 +20 -2
- 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
|
@@ -8,32 +8,26 @@ exports.KEY_NOT_FOUND = 'Key Not Found';
|
|
|
8
8
|
exports.AMBIGUOUS_MATCH = 'Ambiguous match found for serviceIdentifier:';
|
|
9
9
|
exports.CANNOT_UNBIND = 'Could not unbind serviceIdentifier:';
|
|
10
10
|
exports.NOT_REGISTERED = 'No matching bindings found for serviceIdentifier:';
|
|
11
|
-
|
|
11
|
+
const TRYING_TO_RESOLVE_BINDINGS = (name) => `Trying to resolve bindings for "${name}"`;
|
|
12
12
|
exports.TRYING_TO_RESOLVE_BINDINGS = TRYING_TO_RESOLVE_BINDINGS;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
'overcome this limitation.';
|
|
17
|
-
};
|
|
13
|
+
const UNDEFINED_INJECT_ANNOTATION = (name) => `@inject called with undefined this could mean that the class ${name} has ` +
|
|
14
|
+
'a circular dependency problem. You can use a LazyServiceIdentifer to ' +
|
|
15
|
+
'overcome this limitation.';
|
|
18
16
|
exports.UNDEFINED_INJECT_ANNOTATION = UNDEFINED_INJECT_ANNOTATION;
|
|
19
17
|
exports.CIRCULAR_DEPENDENCY = 'Circular dependency found:';
|
|
20
18
|
exports.INVALID_BINDING_TYPE = 'Invalid binding type:';
|
|
21
19
|
exports.NO_MORE_SNAPSHOTS_AVAILABLE = 'No snapshot available to restore.';
|
|
22
20
|
exports.INVALID_MIDDLEWARE_RETURN = 'Invalid return type in middleware. Middleware must return!';
|
|
23
21
|
exports.INVALID_FUNCTION_BINDING = 'Value provided to function binding must be a function!';
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
'but it has asynchronous dependencies.';
|
|
27
|
-
};
|
|
22
|
+
const LAZY_IN_SYNC = (key) => `You are attempting to construct ${keyToString(key)} in a synchronous way ` +
|
|
23
|
+
'but it has asynchronous dependencies.';
|
|
28
24
|
exports.LAZY_IN_SYNC = LAZY_IN_SYNC;
|
|
29
25
|
exports.INVALID_TO_SELF_VALUE = 'The toSelf function can only be applied when a constructor is ' +
|
|
30
26
|
'used as service identifier';
|
|
31
27
|
exports.INVALID_DECORATOR_OPERATION = 'The @inject @multiInject @tagged and @named decorators ' +
|
|
32
28
|
'must be applied to the parameters of a class constructor or a class property.';
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"".concat(name, " must be >= than the number of constructor arguments of its base class.");
|
|
36
|
-
};
|
|
29
|
+
const ARGUMENTS_LENGTH_MISMATCH = (name) => 'The number of constructor arguments in the derived class ' +
|
|
30
|
+
`${name} must be >= than the number of constructor arguments of its base class.`;
|
|
37
31
|
exports.ARGUMENTS_LENGTH_MISMATCH = ARGUMENTS_LENGTH_MISMATCH;
|
|
38
32
|
exports.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT = 'Invalid Container constructor argument. Container options ' +
|
|
39
33
|
'must be an object.';
|
|
@@ -44,30 +38,22 @@ exports.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK = 'Invalid Container option. S
|
|
|
44
38
|
exports.MULTIPLE_PRE_DESTROY_METHODS = 'Cannot apply @preDestroy decorator multiple times in the same class';
|
|
45
39
|
exports.MULTIPLE_POST_CONSTRUCT_METHODS = 'Cannot apply @postConstruct decorator multiple times in the same class';
|
|
46
40
|
exports.ASYNC_UNBIND_REQUIRED = 'Attempting to unbind dependency with asynchronous destruction (@preDestroy or onDeactivation)';
|
|
47
|
-
|
|
48
|
-
return "@postConstruct error in class ".concat(clazz, ": ").concat(errorMessage);
|
|
49
|
-
};
|
|
41
|
+
const POST_CONSTRUCT_ERROR = (clazz, errorMessage) => `@postConstruct error in class ${clazz}: ${errorMessage}`;
|
|
50
42
|
exports.POST_CONSTRUCT_ERROR = POST_CONSTRUCT_ERROR;
|
|
51
|
-
|
|
52
|
-
return "@preDestroy error in class ".concat(clazz, ": ").concat(errorMessage);
|
|
53
|
-
};
|
|
43
|
+
const PRE_DESTROY_ERROR = (clazz, errorMessage) => `@preDestroy error in class ${clazz}: ${errorMessage}`;
|
|
54
44
|
exports.PRE_DESTROY_ERROR = PRE_DESTROY_ERROR;
|
|
55
|
-
|
|
56
|
-
return "onDeactivation() error in class ".concat(clazz, ": ").concat(errorMessage);
|
|
57
|
-
};
|
|
45
|
+
const ON_DEACTIVATION_ERROR = (clazz, errorMessage) => `onDeactivation() error in class ${clazz}: ${errorMessage}`;
|
|
58
46
|
exports.ON_DEACTIVATION_ERROR = ON_DEACTIVATION_ERROR;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"service identifier '".concat(serviceIdentifier, "'.");
|
|
62
|
-
};
|
|
47
|
+
const CIRCULAR_DEPENDENCY_IN_FACTORY = (factoryType, serviceIdentifier) => `It looks like there is a circular dependency in one of the '${factoryType}' bindings. Please investigate bindings with ` +
|
|
48
|
+
`service identifier '${serviceIdentifier}'.`;
|
|
63
49
|
exports.CIRCULAR_DEPENDENCY_IN_FACTORY = CIRCULAR_DEPENDENCY_IN_FACTORY;
|
|
64
50
|
exports.STACK_OVERFLOW = 'Maximum call stack size exceeded';
|
|
65
51
|
function keyToString(key) {
|
|
66
52
|
if (typeof key === 'function') {
|
|
67
|
-
return
|
|
53
|
+
return `[function/class ${key.name || '<anonymous>'}]`;
|
|
68
54
|
}
|
|
69
55
|
if (typeof key === 'symbol') {
|
|
70
56
|
return key.toString();
|
|
71
57
|
}
|
|
72
|
-
return
|
|
58
|
+
return `'${key}'`;
|
|
73
59
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TargetTypeEnum = exports.BindingTypeEnum = exports.BindingScopeEnum = void 0;
|
|
4
|
-
|
|
4
|
+
const BindingScopeEnum = {
|
|
5
5
|
Request: 'Request',
|
|
6
6
|
Singleton: 'Singleton',
|
|
7
7
|
Transient: 'Transient',
|
|
8
8
|
};
|
|
9
9
|
exports.BindingScopeEnum = BindingScopeEnum;
|
|
10
|
-
|
|
10
|
+
const BindingTypeEnum = {
|
|
11
11
|
ConstantValue: 'ConstantValue',
|
|
12
12
|
Constructor: 'Constructor',
|
|
13
13
|
DynamicValue: 'DynamicValue',
|
|
@@ -18,7 +18,7 @@ var BindingTypeEnum = {
|
|
|
18
18
|
Provider: 'Provider',
|
|
19
19
|
};
|
|
20
20
|
exports.BindingTypeEnum = BindingTypeEnum;
|
|
21
|
-
|
|
21
|
+
const TargetTypeEnum = {
|
|
22
22
|
ClassProperty: 'ClassProperty',
|
|
23
23
|
ConstructorArgument: 'ConstructorArgument',
|
|
24
24
|
Variable: 'Variable',
|
|
@@ -55,6 +55,8 @@ declare class Container implements interfaces.Container {
|
|
|
55
55
|
private _deactivateContainer;
|
|
56
56
|
private _deactivateContainerAsync;
|
|
57
57
|
private _getContainerModuleHelpersFactory;
|
|
58
|
+
private _bind;
|
|
59
|
+
private _buildBinding;
|
|
58
60
|
private _getAll;
|
|
59
61
|
private _get;
|
|
60
62
|
private _getButThrowIfAsync;
|