inversify 6.1.3 → 6.1.4-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/amd/constants/error_msgs.d.ts +1 -1
- package/amd/constants/error_msgs.js +3 -2
- package/amd/container/container.js +11 -7
- package/amd/planning/planner.js +5 -2
- package/amd/utils/serialization.js +1 -1
- package/es/constants/error_msgs.d.ts +1 -1
- package/es/constants/error_msgs.js +1 -1
- package/es/container/container.js +11 -7
- package/es/inversify.js +2 -23
- package/es/planning/planner.js +5 -2
- package/es/utils/serialization.js +1 -1
- package/es6/constants/error_msgs.d.ts +1 -1
- package/es6/constants/error_msgs.js +3 -2
- package/es6/container/container.js +11 -7
- package/es6/planning/planner.js +5 -2
- package/es6/utils/serialization.js +1 -1
- package/lib/constants/error_msgs.d.ts +1 -1
- package/lib/constants/error_msgs.js +3 -2
- package/lib/container/container.js +11 -7
- package/lib/planning/planner.js +5 -2
- package/lib/utils/serialization.js +1 -1
- package/package.json +8 -5
package/es/planning/planner.js
CHANGED
|
@@ -42,7 +42,7 @@ function _getActiveBindings(metadataReader, avoidConstraints, context, parentReq
|
|
|
42
42
|
else {
|
|
43
43
|
activeBindings = bindings;
|
|
44
44
|
}
|
|
45
|
-
_validateActiveBindingCount(target.serviceIdentifier, activeBindings, target, context.container);
|
|
45
|
+
_validateActiveBindingCount(target.serviceIdentifier, activeBindings, parentRequest, target, context.container);
|
|
46
46
|
return activeBindings;
|
|
47
47
|
}
|
|
48
48
|
function _getTargetMetadata(isMultiInject, serviceIdentifier, key, value) {
|
|
@@ -57,7 +57,7 @@ function _getTargetMetadata(isMultiInject, serviceIdentifier, key, value) {
|
|
|
57
57
|
}
|
|
58
58
|
return metadataList;
|
|
59
59
|
}
|
|
60
|
-
function _validateActiveBindingCount(serviceIdentifier, bindings, target, container) {
|
|
60
|
+
function _validateActiveBindingCount(serviceIdentifier, bindings, parentRequest, target, container) {
|
|
61
61
|
switch (bindings.length) {
|
|
62
62
|
case BindingCount.NoBindingsAvailable:
|
|
63
63
|
if (target.isOptional()) {
|
|
@@ -68,6 +68,9 @@ function _validateActiveBindingCount(serviceIdentifier, bindings, target, contai
|
|
|
68
68
|
var msg = ERROR_MSGS.NOT_REGISTERED;
|
|
69
69
|
msg += listMetadataForTarget(serviceIdentifierString, target);
|
|
70
70
|
msg += listRegisteredBindingsForServiceIdentifier(container, serviceIdentifierString, getBindings);
|
|
71
|
+
if (parentRequest !== null) {
|
|
72
|
+
msg += "\n".concat(ERROR_MSGS.TRYING_TO_RESOLVE_BINDINGS(getServiceIdentifierAsString(parentRequest.serviceIdentifier)));
|
|
73
|
+
}
|
|
71
74
|
throw new Error(msg);
|
|
72
75
|
}
|
|
73
76
|
case BindingCount.OnlyOneBindingAvailable:
|
|
@@ -54,7 +54,7 @@ function dependencyChainToString(request) {
|
|
|
54
54
|
}
|
|
55
55
|
function circularDependencyToException(request) {
|
|
56
56
|
request.childRequests.forEach(function (childRequest) {
|
|
57
|
-
if (alreadyDependencyChain(
|
|
57
|
+
if (alreadyDependencyChain(request, childRequest.serviceIdentifier)) {
|
|
58
58
|
var services = dependencyChainToString(childRequest);
|
|
59
59
|
throw new Error("".concat(ERROR_MSGS.CIRCULAR_DEPENDENCY, " ").concat(services));
|
|
60
60
|
}
|
|
@@ -5,7 +5,7 @@ export declare const KEY_NOT_FOUND: string;
|
|
|
5
5
|
export declare const AMBIGUOUS_MATCH: string;
|
|
6
6
|
export declare const CANNOT_UNBIND: string;
|
|
7
7
|
export declare const NOT_REGISTERED: string;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const TRYING_TO_RESOLVE_BINDINGS: (name: string) => string;
|
|
9
9
|
export declare const UNDEFINED_INJECT_ANNOTATION: (name: string) => string;
|
|
10
10
|
export declare const CIRCULAR_DEPENDENCY: string;
|
|
11
11
|
export declare const INVALID_BINDING_TYPE: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.STACK_OVERFLOW = exports.CIRCULAR_DEPENDENCY_IN_FACTORY = exports.ON_DEACTIVATION_ERROR = exports.PRE_DESTROY_ERROR = exports.POST_CONSTRUCT_ERROR = exports.ASYNC_UNBIND_REQUIRED = exports.MULTIPLE_POST_CONSTRUCT_METHODS = exports.MULTIPLE_PRE_DESTROY_METHODS = exports.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK = exports.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE = exports.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE = exports.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT = exports.ARGUMENTS_LENGTH_MISMATCH = exports.INVALID_DECORATOR_OPERATION = exports.INVALID_TO_SELF_VALUE = exports.LAZY_IN_SYNC = exports.INVALID_FUNCTION_BINDING = exports.INVALID_MIDDLEWARE_RETURN = exports.NO_MORE_SNAPSHOTS_AVAILABLE = exports.INVALID_BINDING_TYPE = exports.CIRCULAR_DEPENDENCY = exports.UNDEFINED_INJECT_ANNOTATION = exports.
|
|
3
|
+
exports.STACK_OVERFLOW = exports.CIRCULAR_DEPENDENCY_IN_FACTORY = exports.ON_DEACTIVATION_ERROR = exports.PRE_DESTROY_ERROR = exports.POST_CONSTRUCT_ERROR = exports.ASYNC_UNBIND_REQUIRED = exports.MULTIPLE_POST_CONSTRUCT_METHODS = exports.MULTIPLE_PRE_DESTROY_METHODS = exports.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK = exports.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE = exports.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE = exports.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT = exports.ARGUMENTS_LENGTH_MISMATCH = exports.INVALID_DECORATOR_OPERATION = exports.INVALID_TO_SELF_VALUE = exports.LAZY_IN_SYNC = exports.INVALID_FUNCTION_BINDING = exports.INVALID_MIDDLEWARE_RETURN = exports.NO_MORE_SNAPSHOTS_AVAILABLE = exports.INVALID_BINDING_TYPE = exports.CIRCULAR_DEPENDENCY = exports.UNDEFINED_INJECT_ANNOTATION = exports.TRYING_TO_RESOLVE_BINDINGS = exports.NOT_REGISTERED = exports.CANNOT_UNBIND = exports.AMBIGUOUS_MATCH = exports.KEY_NOT_FOUND = exports.NULL_ARGUMENT = exports.DUPLICATED_METADATA = exports.DUPLICATED_INJECTABLE_DECORATOR = void 0;
|
|
4
4
|
exports.DUPLICATED_INJECTABLE_DECORATOR = 'Cannot apply @injectable decorator multiple times.';
|
|
5
5
|
exports.DUPLICATED_METADATA = 'Metadata key was used more than once in a parameter:';
|
|
6
6
|
exports.NULL_ARGUMENT = 'NULL argument';
|
|
@@ -8,7 +8,8 @@ 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
|
+
exports.TRYING_TO_RESOLVE_BINDINGS = TRYING_TO_RESOLVE_BINDINGS;
|
|
12
13
|
const UNDEFINED_INJECT_ANNOTATION = (name) => `@inject called with undefined this could mean that the class ${name} has ` +
|
|
13
14
|
'a circular dependency problem. You can use a LazyServiceIdentifer to ' +
|
|
14
15
|
'overcome this limitation.';
|
|
@@ -316,7 +316,8 @@ class Container {
|
|
|
316
316
|
}
|
|
317
317
|
_preDestroy(constructor, instance) {
|
|
318
318
|
var _a, _b;
|
|
319
|
-
if (
|
|
319
|
+
if (constructor !== undefined &&
|
|
320
|
+
Reflect.hasMetadata(METADATA_KEY.PRE_DESTROY, constructor)) {
|
|
320
321
|
const data = Reflect.getMetadata(METADATA_KEY.PRE_DESTROY, constructor);
|
|
321
322
|
return (_b = (_a = instance)[data.value]) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
322
323
|
}
|
|
@@ -330,35 +331,38 @@ class Container {
|
|
|
330
331
|
return this._bindingDictionary.removeByCondition((binding) => binding.moduleId === moduleId);
|
|
331
332
|
}
|
|
332
333
|
_deactivate(binding, instance) {
|
|
333
|
-
const constructor =
|
|
334
|
+
const constructor = instance == undefined
|
|
335
|
+
? undefined
|
|
336
|
+
:
|
|
337
|
+
Object.getPrototypeOf(instance).constructor;
|
|
334
338
|
try {
|
|
335
339
|
if (this._deactivations.hasKey(binding.serviceIdentifier)) {
|
|
336
340
|
const result = this._deactivateContainer(instance, this._deactivations.get(binding.serviceIdentifier).values());
|
|
337
341
|
if ((0, async_1.isPromise)(result)) {
|
|
338
342
|
return this._handleDeactivationError(result.then(() => __awaiter(this, void 0, void 0, function* () {
|
|
339
343
|
return this._propagateContainerDeactivationThenBindingAndPreDestroyAsync(binding, instance, constructor);
|
|
340
|
-
})),
|
|
344
|
+
})), binding.serviceIdentifier);
|
|
341
345
|
}
|
|
342
346
|
}
|
|
343
347
|
const propagateDeactivationResult = this._propagateContainerDeactivationThenBindingAndPreDestroy(binding, instance, constructor);
|
|
344
348
|
if ((0, async_1.isPromise)(propagateDeactivationResult)) {
|
|
345
|
-
return this._handleDeactivationError(propagateDeactivationResult,
|
|
349
|
+
return this._handleDeactivationError(propagateDeactivationResult, binding.serviceIdentifier);
|
|
346
350
|
}
|
|
347
351
|
}
|
|
348
352
|
catch (ex) {
|
|
349
353
|
if (ex instanceof Error) {
|
|
350
|
-
throw new Error(ERROR_MSGS.ON_DEACTIVATION_ERROR(
|
|
354
|
+
throw new Error(ERROR_MSGS.ON_DEACTIVATION_ERROR((0, serialization_1.getServiceIdentifierAsString)(binding.serviceIdentifier), ex.message));
|
|
351
355
|
}
|
|
352
356
|
}
|
|
353
357
|
}
|
|
354
|
-
_handleDeactivationError(asyncResult,
|
|
358
|
+
_handleDeactivationError(asyncResult, serviceIdentifier) {
|
|
355
359
|
return __awaiter(this, void 0, void 0, function* () {
|
|
356
360
|
try {
|
|
357
361
|
yield asyncResult;
|
|
358
362
|
}
|
|
359
363
|
catch (ex) {
|
|
360
364
|
if (ex instanceof Error) {
|
|
361
|
-
throw new Error(ERROR_MSGS.ON_DEACTIVATION_ERROR(
|
|
365
|
+
throw new Error(ERROR_MSGS.ON_DEACTIVATION_ERROR((0, serialization_1.getServiceIdentifierAsString)(serviceIdentifier), ex.message));
|
|
362
366
|
}
|
|
363
367
|
}
|
|
364
368
|
});
|
package/es6/planning/planner.js
CHANGED
|
@@ -70,7 +70,7 @@ function _getActiveBindings(metadataReader, avoidConstraints, context, parentReq
|
|
|
70
70
|
else {
|
|
71
71
|
activeBindings = bindings;
|
|
72
72
|
}
|
|
73
|
-
_validateActiveBindingCount(target.serviceIdentifier, activeBindings, target, context.container);
|
|
73
|
+
_validateActiveBindingCount(target.serviceIdentifier, activeBindings, parentRequest, target, context.container);
|
|
74
74
|
return activeBindings;
|
|
75
75
|
}
|
|
76
76
|
function _getTargetMetadata(isMultiInject, serviceIdentifier, key, value) {
|
|
@@ -85,7 +85,7 @@ function _getTargetMetadata(isMultiInject, serviceIdentifier, key, value) {
|
|
|
85
85
|
}
|
|
86
86
|
return metadataList;
|
|
87
87
|
}
|
|
88
|
-
function _validateActiveBindingCount(serviceIdentifier, bindings, target, container) {
|
|
88
|
+
function _validateActiveBindingCount(serviceIdentifier, bindings, parentRequest, target, container) {
|
|
89
89
|
switch (bindings.length) {
|
|
90
90
|
case binding_count_1.BindingCount.NoBindingsAvailable:
|
|
91
91
|
if (target.isOptional()) {
|
|
@@ -96,6 +96,9 @@ function _validateActiveBindingCount(serviceIdentifier, bindings, target, contai
|
|
|
96
96
|
let msg = ERROR_MSGS.NOT_REGISTERED;
|
|
97
97
|
msg += (0, serialization_1.listMetadataForTarget)(serviceIdentifierString, target);
|
|
98
98
|
msg += (0, serialization_1.listRegisteredBindingsForServiceIdentifier)(container, serviceIdentifierString, getBindings);
|
|
99
|
+
if (parentRequest !== null) {
|
|
100
|
+
msg += `\n${ERROR_MSGS.TRYING_TO_RESOLVE_BINDINGS((0, serialization_1.getServiceIdentifierAsString)(parentRequest.serviceIdentifier))}`;
|
|
101
|
+
}
|
|
99
102
|
throw new Error(msg);
|
|
100
103
|
}
|
|
101
104
|
case binding_count_1.BindingCount.OnlyOneBindingAvailable:
|
|
@@ -84,7 +84,7 @@ function dependencyChainToString(request) {
|
|
|
84
84
|
}
|
|
85
85
|
function circularDependencyToException(request) {
|
|
86
86
|
request.childRequests.forEach((childRequest) => {
|
|
87
|
-
if (alreadyDependencyChain(
|
|
87
|
+
if (alreadyDependencyChain(request, childRequest.serviceIdentifier)) {
|
|
88
88
|
const services = dependencyChainToString(childRequest);
|
|
89
89
|
throw new Error(`${ERROR_MSGS.CIRCULAR_DEPENDENCY} ${services}`);
|
|
90
90
|
}
|
|
@@ -5,7 +5,7 @@ export declare const KEY_NOT_FOUND: string;
|
|
|
5
5
|
export declare const AMBIGUOUS_MATCH: string;
|
|
6
6
|
export declare const CANNOT_UNBIND: string;
|
|
7
7
|
export declare const NOT_REGISTERED: string;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const TRYING_TO_RESOLVE_BINDINGS: (name: string) => string;
|
|
9
9
|
export declare const UNDEFINED_INJECT_ANNOTATION: (name: string) => string;
|
|
10
10
|
export declare const CIRCULAR_DEPENDENCY: string;
|
|
11
11
|
export declare const INVALID_BINDING_TYPE: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.STACK_OVERFLOW = exports.CIRCULAR_DEPENDENCY_IN_FACTORY = exports.ON_DEACTIVATION_ERROR = exports.PRE_DESTROY_ERROR = exports.POST_CONSTRUCT_ERROR = exports.ASYNC_UNBIND_REQUIRED = exports.MULTIPLE_POST_CONSTRUCT_METHODS = exports.MULTIPLE_PRE_DESTROY_METHODS = exports.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK = exports.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE = exports.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE = exports.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT = exports.ARGUMENTS_LENGTH_MISMATCH = exports.INVALID_DECORATOR_OPERATION = exports.INVALID_TO_SELF_VALUE = exports.LAZY_IN_SYNC = exports.INVALID_FUNCTION_BINDING = exports.INVALID_MIDDLEWARE_RETURN = exports.NO_MORE_SNAPSHOTS_AVAILABLE = exports.INVALID_BINDING_TYPE = exports.CIRCULAR_DEPENDENCY = exports.UNDEFINED_INJECT_ANNOTATION = exports.
|
|
3
|
+
exports.STACK_OVERFLOW = exports.CIRCULAR_DEPENDENCY_IN_FACTORY = exports.ON_DEACTIVATION_ERROR = exports.PRE_DESTROY_ERROR = exports.POST_CONSTRUCT_ERROR = exports.ASYNC_UNBIND_REQUIRED = exports.MULTIPLE_POST_CONSTRUCT_METHODS = exports.MULTIPLE_PRE_DESTROY_METHODS = exports.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK = exports.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE = exports.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE = exports.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT = exports.ARGUMENTS_LENGTH_MISMATCH = exports.INVALID_DECORATOR_OPERATION = exports.INVALID_TO_SELF_VALUE = exports.LAZY_IN_SYNC = exports.INVALID_FUNCTION_BINDING = exports.INVALID_MIDDLEWARE_RETURN = exports.NO_MORE_SNAPSHOTS_AVAILABLE = exports.INVALID_BINDING_TYPE = exports.CIRCULAR_DEPENDENCY = exports.UNDEFINED_INJECT_ANNOTATION = exports.TRYING_TO_RESOLVE_BINDINGS = exports.NOT_REGISTERED = exports.CANNOT_UNBIND = exports.AMBIGUOUS_MATCH = exports.KEY_NOT_FOUND = exports.NULL_ARGUMENT = exports.DUPLICATED_METADATA = exports.DUPLICATED_INJECTABLE_DECORATOR = void 0;
|
|
4
4
|
exports.DUPLICATED_INJECTABLE_DECORATOR = 'Cannot apply @injectable decorator multiple times.';
|
|
5
5
|
exports.DUPLICATED_METADATA = 'Metadata key was used more than once in a parameter:';
|
|
6
6
|
exports.NULL_ARGUMENT = 'NULL argument';
|
|
@@ -8,7 +8,8 @@ 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
|
+
var TRYING_TO_RESOLVE_BINDINGS = function (name) { return "Trying to resolve bindings for \"".concat(name, "\""); };
|
|
12
|
+
exports.TRYING_TO_RESOLVE_BINDINGS = TRYING_TO_RESOLVE_BINDINGS;
|
|
12
13
|
var UNDEFINED_INJECT_ANNOTATION = function (name) {
|
|
13
14
|
return "@inject called with undefined this could mean that the class ".concat(name, " has ") +
|
|
14
15
|
'a circular dependency problem. You can use a LazyServiceIdentifer to ' +
|
|
@@ -465,7 +465,8 @@ var Container = (function () {
|
|
|
465
465
|
};
|
|
466
466
|
Container.prototype._preDestroy = function (constructor, instance) {
|
|
467
467
|
var _a, _b;
|
|
468
|
-
if (
|
|
468
|
+
if (constructor !== undefined &&
|
|
469
|
+
Reflect.hasMetadata(METADATA_KEY.PRE_DESTROY, constructor)) {
|
|
469
470
|
var data = Reflect.getMetadata(METADATA_KEY.PRE_DESTROY, constructor);
|
|
470
471
|
return (_b = (_a = instance)[data.value]) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
471
472
|
}
|
|
@@ -480,7 +481,10 @@ var Container = (function () {
|
|
|
480
481
|
};
|
|
481
482
|
Container.prototype._deactivate = function (binding, instance) {
|
|
482
483
|
var _this = this;
|
|
483
|
-
var constructor =
|
|
484
|
+
var constructor = instance == undefined
|
|
485
|
+
? undefined
|
|
486
|
+
:
|
|
487
|
+
Object.getPrototypeOf(instance).constructor;
|
|
484
488
|
try {
|
|
485
489
|
if (this._deactivations.hasKey(binding.serviceIdentifier)) {
|
|
486
490
|
var result = this._deactivateContainer(instance, this._deactivations.get(binding.serviceIdentifier).values());
|
|
@@ -489,21 +493,21 @@ var Container = (function () {
|
|
|
489
493
|
return __generator(this, function (_a) {
|
|
490
494
|
return [2, this._propagateContainerDeactivationThenBindingAndPreDestroyAsync(binding, instance, constructor)];
|
|
491
495
|
});
|
|
492
|
-
}); }),
|
|
496
|
+
}); }), binding.serviceIdentifier);
|
|
493
497
|
}
|
|
494
498
|
}
|
|
495
499
|
var propagateDeactivationResult = this._propagateContainerDeactivationThenBindingAndPreDestroy(binding, instance, constructor);
|
|
496
500
|
if ((0, async_1.isPromise)(propagateDeactivationResult)) {
|
|
497
|
-
return this._handleDeactivationError(propagateDeactivationResult,
|
|
501
|
+
return this._handleDeactivationError(propagateDeactivationResult, binding.serviceIdentifier);
|
|
498
502
|
}
|
|
499
503
|
}
|
|
500
504
|
catch (ex) {
|
|
501
505
|
if (ex instanceof Error) {
|
|
502
|
-
throw new Error(ERROR_MSGS.ON_DEACTIVATION_ERROR(
|
|
506
|
+
throw new Error(ERROR_MSGS.ON_DEACTIVATION_ERROR((0, serialization_1.getServiceIdentifierAsString)(binding.serviceIdentifier), ex.message));
|
|
503
507
|
}
|
|
504
508
|
}
|
|
505
509
|
};
|
|
506
|
-
Container.prototype._handleDeactivationError = function (asyncResult,
|
|
510
|
+
Container.prototype._handleDeactivationError = function (asyncResult, serviceIdentifier) {
|
|
507
511
|
return __awaiter(this, void 0, void 0, function () {
|
|
508
512
|
var ex_1;
|
|
509
513
|
return __generator(this, function (_a) {
|
|
@@ -517,7 +521,7 @@ var Container = (function () {
|
|
|
517
521
|
case 2:
|
|
518
522
|
ex_1 = _a.sent();
|
|
519
523
|
if (ex_1 instanceof Error) {
|
|
520
|
-
throw new Error(ERROR_MSGS.ON_DEACTIVATION_ERROR(
|
|
524
|
+
throw new Error(ERROR_MSGS.ON_DEACTIVATION_ERROR((0, serialization_1.getServiceIdentifierAsString)(serviceIdentifier), ex_1.message));
|
|
521
525
|
}
|
|
522
526
|
return [3, 3];
|
|
523
527
|
case 3: return [2];
|
package/lib/planning/planner.js
CHANGED
|
@@ -70,7 +70,7 @@ function _getActiveBindings(metadataReader, avoidConstraints, context, parentReq
|
|
|
70
70
|
else {
|
|
71
71
|
activeBindings = bindings;
|
|
72
72
|
}
|
|
73
|
-
_validateActiveBindingCount(target.serviceIdentifier, activeBindings, target, context.container);
|
|
73
|
+
_validateActiveBindingCount(target.serviceIdentifier, activeBindings, parentRequest, target, context.container);
|
|
74
74
|
return activeBindings;
|
|
75
75
|
}
|
|
76
76
|
function _getTargetMetadata(isMultiInject, serviceIdentifier, key, value) {
|
|
@@ -85,7 +85,7 @@ function _getTargetMetadata(isMultiInject, serviceIdentifier, key, value) {
|
|
|
85
85
|
}
|
|
86
86
|
return metadataList;
|
|
87
87
|
}
|
|
88
|
-
function _validateActiveBindingCount(serviceIdentifier, bindings, target, container) {
|
|
88
|
+
function _validateActiveBindingCount(serviceIdentifier, bindings, parentRequest, target, container) {
|
|
89
89
|
switch (bindings.length) {
|
|
90
90
|
case binding_count_1.BindingCount.NoBindingsAvailable:
|
|
91
91
|
if (target.isOptional()) {
|
|
@@ -96,6 +96,9 @@ function _validateActiveBindingCount(serviceIdentifier, bindings, target, contai
|
|
|
96
96
|
var msg = ERROR_MSGS.NOT_REGISTERED;
|
|
97
97
|
msg += (0, serialization_1.listMetadataForTarget)(serviceIdentifierString, target);
|
|
98
98
|
msg += (0, serialization_1.listRegisteredBindingsForServiceIdentifier)(container, serviceIdentifierString, getBindings);
|
|
99
|
+
if (parentRequest !== null) {
|
|
100
|
+
msg += "\n".concat(ERROR_MSGS.TRYING_TO_RESOLVE_BINDINGS((0, serialization_1.getServiceIdentifierAsString)(parentRequest.serviceIdentifier)));
|
|
101
|
+
}
|
|
99
102
|
throw new Error(msg);
|
|
100
103
|
}
|
|
101
104
|
case binding_count_1.BindingCount.OnlyOneBindingAvailable:
|
|
@@ -85,7 +85,7 @@ function dependencyChainToString(request) {
|
|
|
85
85
|
}
|
|
86
86
|
function circularDependencyToException(request) {
|
|
87
87
|
request.childRequests.forEach(function (childRequest) {
|
|
88
|
-
if (alreadyDependencyChain(
|
|
88
|
+
if (alreadyDependencyChain(request, childRequest.serviceIdentifier)) {
|
|
89
89
|
var services = dependencyChainToString(childRequest);
|
|
90
90
|
throw new Error("".concat(ERROR_MSGS.CIRCULAR_DEPENDENCY, " ").concat(services));
|
|
91
91
|
}
|
package/package.json
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
},
|
|
6
6
|
"description": "A powerful and lightweight inversion of control container for JavaScript and Node.js apps powered by TypeScript.",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@inversifyjs/common": "1.3.
|
|
9
|
-
"@inversifyjs/core": "1.3.
|
|
8
|
+
"@inversifyjs/common": "1.3.3",
|
|
9
|
+
"@inversifyjs/core": "1.3.4"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@eslint/js": "9.14.0",
|
|
@@ -27,10 +27,13 @@
|
|
|
27
27
|
"reflect-metadata": "0.2.2",
|
|
28
28
|
"rimraf": "6.0.1",
|
|
29
29
|
"sinon": "19.0.2",
|
|
30
|
+
"ts-loader": "9.5.1",
|
|
30
31
|
"ts-node": "10.9.2",
|
|
31
32
|
"typescript": "5.6.3",
|
|
32
33
|
"typescript-eslint": "8.14.0",
|
|
33
|
-
"updates": "16.4.0"
|
|
34
|
+
"updates": "16.4.0",
|
|
35
|
+
"webpack": "5.96.1",
|
|
36
|
+
"webpack-cli": "5.1.4"
|
|
34
37
|
},
|
|
35
38
|
"engines": {},
|
|
36
39
|
"homepage": "http://inversify.io",
|
|
@@ -62,7 +65,7 @@
|
|
|
62
65
|
"scripts": {
|
|
63
66
|
"build": "npm run build:lib && npm run build:amd && npm run build:es && npm run build:es6",
|
|
64
67
|
"build:amd": "tsc -p src/tsconfig-amd.json",
|
|
65
|
-
"build:es": "
|
|
68
|
+
"build:es": "webpack && node ./scripts/writeEsmPackageJson.mjs ./es",
|
|
66
69
|
"build:es6": "tsc -p src/tsconfig-es6.json",
|
|
67
70
|
"build:lib": "tsc -p src/tsconfig.json",
|
|
68
71
|
"clean": "rimraf amd es es6 lib",
|
|
@@ -76,5 +79,5 @@
|
|
|
76
79
|
},
|
|
77
80
|
"sideEffects": false,
|
|
78
81
|
"types": "lib/inversify.d.ts",
|
|
79
|
-
"version": "6.1.
|
|
82
|
+
"version": "6.1.4-beta.1"
|
|
80
83
|
}
|