inversify 4.13.0 → 4.14.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/.auditignore +2 -0
- package/CODE_OF_CONDUCT.md +46 -46
- package/LICENSE +22 -22
- package/README.md +306 -306
- package/amd/annotation/decorator_utils.js +1 -1
- package/amd/bindings/binding.js +2 -2
- package/amd/container/container.js +7 -8
- package/amd/container/container_module.js +3 -3
- package/amd/inversify.js +2 -2
- package/amd/planning/context.js +2 -2
- package/amd/planning/request.js +2 -2
- package/amd/planning/target.js +2 -2
- package/amd/resolution/resolver.js +4 -4
- package/amd/utils/id.js +9 -0
- package/appveyor.yml +34 -34
- package/dts/bindings/binding.d.ts +1 -1
- package/dts/container/container.d.ts +1 -1
- package/dts/container/container_module.d.ts +2 -2
- package/dts/interfaces/interfaces.d.ts +7 -7
- package/dts/inversify.d.ts +1 -1
- package/dts/planning/context.d.ts +1 -1
- package/dts/planning/request.d.ts +1 -1
- package/dts/planning/target.d.ts +1 -1
- package/dts/utils/id.d.ts +2 -0
- package/dts/utils/template.d.ts +1 -0
- package/es/annotation/decorator_utils.js +1 -1
- package/es/bindings/binding.js +2 -2
- package/es/container/container.js +7 -8
- package/es/container/container_module.js +3 -3
- package/es/inversify.js +1 -1
- package/es/planning/context.js +2 -2
- package/es/planning/request.js +2 -2
- package/es/planning/target.js +2 -2
- package/es/resolution/resolver.js +4 -4
- package/es/utils/id.js +5 -0
- package/lib/annotation/decorator_utils.js +1 -1
- package/lib/bindings/binding.js +2 -2
- package/lib/container/container.js +7 -8
- package/lib/container/container_module.js +3 -3
- package/lib/inversify.js +2 -2
- package/lib/planning/context.js +2 -2
- package/lib/planning/request.js +2 -2
- package/lib/planning/target.js +2 -2
- package/lib/resolution/resolver.js +4 -4
- package/lib/utils/id.js +7 -0
- package/package.json +80 -80
- package/amd/utils/guid.js +0 -14
- package/es/utils/guid.js +0 -10
- package/lib/utils/guid.js +0 -12
|
@@ -29,7 +29,7 @@ define(["require", "exports", "../constants/error_msgs", "../constants/metadata_
|
|
|
29
29
|
for (var _i = 0, paramOrPropertyMetadata_1 = paramOrPropertyMetadata; _i < paramOrPropertyMetadata_1.length; _i++) {
|
|
30
30
|
var m = paramOrPropertyMetadata_1[_i];
|
|
31
31
|
if (m.key === metadata.key) {
|
|
32
|
-
throw new Error(ERROR_MSGS.DUPLICATED_METADATA + " " + m.key);
|
|
32
|
+
throw new Error(ERROR_MSGS.DUPLICATED_METADATA + " " + m.key.toString());
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
package/amd/bindings/binding.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
define(["require", "exports", "../constants/literal_types", "../utils/
|
|
1
|
+
define(["require", "exports", "../constants/literal_types", "../utils/id"], function (require, exports, literal_types_1, id_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
var Binding = (function () {
|
|
5
5
|
function Binding(serviceIdentifier, scope) {
|
|
6
|
-
this.
|
|
6
|
+
this.id = id_1.id();
|
|
7
7
|
this.activated = false;
|
|
8
8
|
this.serviceIdentifier = serviceIdentifier;
|
|
9
9
|
this.scope = scope;
|
|
@@ -33,7 +33,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
33
33
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
define(["require", "exports", "../bindings/binding", "../constants/error_msgs", "../constants/literal_types", "../constants/metadata_keys", "../planning/metadata_reader", "../planning/planner", "../resolution/resolver", "../syntax/binding_to_syntax", "../utils/
|
|
36
|
+
define(["require", "exports", "../bindings/binding", "../constants/error_msgs", "../constants/literal_types", "../constants/metadata_keys", "../planning/metadata_reader", "../planning/planner", "../resolution/resolver", "../syntax/binding_to_syntax", "../utils/id", "../utils/serialization", "./container_snapshot", "./lookup"], function (require, exports, binding_1, ERROR_MSGS, literal_types_1, METADATA_KEY, metadata_reader_1, planner_1, resolver_1, binding_to_syntax_1, id_1, serialization_1, container_snapshot_1, lookup_1) {
|
|
37
37
|
"use strict";
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
var Container = (function () {
|
|
@@ -67,7 +67,7 @@ define(["require", "exports", "../bindings/binding", "../constants/error_msgs",
|
|
|
67
67
|
defaultScope: options.defaultScope,
|
|
68
68
|
skipBaseClassChecks: options.skipBaseClassChecks
|
|
69
69
|
};
|
|
70
|
-
this.
|
|
70
|
+
this.id = id_1.id();
|
|
71
71
|
this._bindingDictionary = new lookup_1.Lookup();
|
|
72
72
|
this._snapshots = [];
|
|
73
73
|
this._middleware = null;
|
|
@@ -98,7 +98,7 @@ define(["require", "exports", "../bindings/binding", "../constants/error_msgs",
|
|
|
98
98
|
var getHelpers = this._getContainerModuleHelpersFactory();
|
|
99
99
|
for (var _a = 0, modules_1 = modules; _a < modules_1.length; _a++) {
|
|
100
100
|
var currentModule = modules_1[_a];
|
|
101
|
-
var containerModuleHelpers = getHelpers(currentModule.
|
|
101
|
+
var containerModuleHelpers = getHelpers(currentModule.id);
|
|
102
102
|
currentModule.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction);
|
|
103
103
|
}
|
|
104
104
|
};
|
|
@@ -118,7 +118,7 @@ define(["require", "exports", "../bindings/binding", "../constants/error_msgs",
|
|
|
118
118
|
case 1:
|
|
119
119
|
if (!(_a < modules_2.length)) return [3, 4];
|
|
120
120
|
currentModule = modules_2[_a];
|
|
121
|
-
containerModuleHelpers = getHelpers(currentModule.
|
|
121
|
+
containerModuleHelpers = getHelpers(currentModule.id);
|
|
122
122
|
return [4, currentModule.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction)];
|
|
123
123
|
case 2:
|
|
124
124
|
_b.sent();
|
|
@@ -141,7 +141,7 @@ define(["require", "exports", "../bindings/binding", "../constants/error_msgs",
|
|
|
141
141
|
return item.moduleId === expected;
|
|
142
142
|
}; };
|
|
143
143
|
modules.forEach(function (module) {
|
|
144
|
-
var condition = conditionFactory(module.
|
|
144
|
+
var condition = conditionFactory(module.id);
|
|
145
145
|
_this._bindingDictionary.removeByCondition(condition);
|
|
146
146
|
});
|
|
147
147
|
};
|
|
@@ -200,7 +200,7 @@ define(["require", "exports", "../bindings/binding", "../constants/error_msgs",
|
|
|
200
200
|
this._middleware = snapshot.middleware;
|
|
201
201
|
};
|
|
202
202
|
Container.prototype.createChild = function (containerOptions) {
|
|
203
|
-
var child = new Container(containerOptions);
|
|
203
|
+
var child = new Container(containerOptions || this.options);
|
|
204
204
|
child.parent = this;
|
|
205
205
|
return child;
|
|
206
206
|
};
|
|
@@ -234,9 +234,8 @@ define(["require", "exports", "../bindings/binding", "../constants/error_msgs",
|
|
|
234
234
|
return this.getAllTagged(serviceIdentifier, METADATA_KEY.NAMED_TAG, named);
|
|
235
235
|
};
|
|
236
236
|
Container.prototype.resolve = function (constructorFunction) {
|
|
237
|
-
var tempContainer =
|
|
237
|
+
var tempContainer = this.createChild();
|
|
238
238
|
tempContainer.bind(constructorFunction).toSelf();
|
|
239
|
-
tempContainer.parent = this;
|
|
240
239
|
return tempContainer.get(constructorFunction);
|
|
241
240
|
};
|
|
242
241
|
Container.prototype._getContainerModuleHelpersFactory = function () {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
define(["require", "exports", "../utils/
|
|
1
|
+
define(["require", "exports", "../utils/id"], function (require, exports, id_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
var ContainerModule = (function () {
|
|
5
5
|
function ContainerModule(registry) {
|
|
6
|
-
this.
|
|
6
|
+
this.id = id_1.id();
|
|
7
7
|
this.registry = registry;
|
|
8
8
|
}
|
|
9
9
|
return ContainerModule;
|
|
@@ -11,7 +11,7 @@ define(["require", "exports", "../utils/guid"], function (require, exports, guid
|
|
|
11
11
|
exports.ContainerModule = ContainerModule;
|
|
12
12
|
var AsyncContainerModule = (function () {
|
|
13
13
|
function AsyncContainerModule(registry) {
|
|
14
|
-
this.
|
|
14
|
+
this.id = id_1.id();
|
|
15
15
|
this.registry = registry;
|
|
16
16
|
}
|
|
17
17
|
return AsyncContainerModule;
|
package/amd/inversify.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
define(["require", "exports", "./constants/metadata_keys", "./container/container", "./constants/literal_types", "./container/container_module", "./annotation/injectable", "./annotation/tagged", "./annotation/named", "./annotation/inject", "./annotation/optional", "./annotation/unmanaged", "./annotation/multi_inject", "./annotation/target_name", "./annotation/post_construct", "./planning/metadata_reader", "./utils/
|
|
1
|
+
define(["require", "exports", "./constants/metadata_keys", "./container/container", "./constants/literal_types", "./container/container_module", "./annotation/injectable", "./annotation/tagged", "./annotation/named", "./annotation/inject", "./annotation/optional", "./annotation/unmanaged", "./annotation/multi_inject", "./annotation/target_name", "./annotation/post_construct", "./planning/metadata_reader", "./utils/id", "./annotation/decorator_utils", "./syntax/constraint_helpers", "./utils/serialization", "./utils/binding_utils"], function (require, exports, keys, container_1, literal_types_1, container_module_1, injectable_1, tagged_1, named_1, inject_1, optional_1, unmanaged_1, multi_inject_1, target_name_1, post_construct_1, metadata_reader_1, id_1, decorator_utils_1, constraint_helpers_1, serialization_1, binding_utils_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.METADATA_KEY = keys;
|
|
@@ -19,7 +19,7 @@ define(["require", "exports", "./constants/metadata_keys", "./container/containe
|
|
|
19
19
|
exports.targetName = target_name_1.targetName;
|
|
20
20
|
exports.postConstruct = post_construct_1.postConstruct;
|
|
21
21
|
exports.MetadataReader = metadata_reader_1.MetadataReader;
|
|
22
|
-
exports.
|
|
22
|
+
exports.id = id_1.id;
|
|
23
23
|
exports.decorate = decorator_utils_1.decorate;
|
|
24
24
|
exports.traverseAncerstors = constraint_helpers_1.traverseAncerstors;
|
|
25
25
|
exports.taggedConstraint = constraint_helpers_1.taggedConstraint;
|
package/amd/planning/context.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
define(["require", "exports", "../utils/
|
|
1
|
+
define(["require", "exports", "../utils/id"], function (require, exports, id_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
var Context = (function () {
|
|
5
5
|
function Context(container) {
|
|
6
|
-
this.
|
|
6
|
+
this.id = id_1.id();
|
|
7
7
|
this.container = container;
|
|
8
8
|
}
|
|
9
9
|
Context.prototype.addPlan = function (plan) {
|
package/amd/planning/request.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
define(["require", "exports", "../utils/
|
|
1
|
+
define(["require", "exports", "../utils/id"], function (require, exports, id_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
var Request = (function () {
|
|
5
5
|
function Request(serviceIdentifier, parentContext, parentRequest, bindings, target) {
|
|
6
|
-
this.
|
|
6
|
+
this.id = id_1.id();
|
|
7
7
|
this.serviceIdentifier = serviceIdentifier;
|
|
8
8
|
this.parentContext = parentContext;
|
|
9
9
|
this.parentRequest = parentRequest;
|
package/amd/planning/target.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
define(["require", "exports", "../constants/metadata_keys", "../utils/
|
|
1
|
+
define(["require", "exports", "../constants/metadata_keys", "../utils/id", "./metadata", "./queryable_string"], function (require, exports, METADATA_KEY, id_1, metadata_1, queryable_string_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
var Target = (function () {
|
|
5
5
|
function Target(type, name, serviceIdentifier, namedOrTagged) {
|
|
6
|
-
this.
|
|
6
|
+
this.id = id_1.id();
|
|
7
7
|
this.type = type;
|
|
8
8
|
this.serviceIdentifier = serviceIdentifier;
|
|
9
9
|
this.name = new queryable_string_1.QueryableString(name || "");
|
|
@@ -43,8 +43,8 @@ define(["require", "exports", "../constants/error_msgs", "../constants/literal_t
|
|
|
43
43
|
}
|
|
44
44
|
if (isRequestSingleton &&
|
|
45
45
|
requestScope !== null &&
|
|
46
|
-
requestScope.has(binding_1.
|
|
47
|
-
return requestScope.get(binding_1.
|
|
46
|
+
requestScope.has(binding_1.id)) {
|
|
47
|
+
return requestScope.get(binding_1.id);
|
|
48
48
|
}
|
|
49
49
|
if (binding_1.type === literal_types_1.BindingTypeEnum.ConstantValue) {
|
|
50
50
|
result = binding_1.cache;
|
|
@@ -80,8 +80,8 @@ define(["require", "exports", "../constants/error_msgs", "../constants/literal_t
|
|
|
80
80
|
}
|
|
81
81
|
if (isRequestSingleton &&
|
|
82
82
|
requestScope !== null &&
|
|
83
|
-
!requestScope.has(binding_1.
|
|
84
|
-
requestScope.set(binding_1.
|
|
83
|
+
!requestScope.has(binding_1.id)) {
|
|
84
|
+
requestScope.set(binding_1.id, result);
|
|
85
85
|
}
|
|
86
86
|
return result;
|
|
87
87
|
}
|
package/amd/utils/id.js
ADDED
package/appveyor.yml
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
# AppVeyor file
|
|
2
|
-
# http://www.appveyor.com/docs/appveyor-yml
|
|
3
|
-
|
|
4
|
-
# Build version format
|
|
5
|
-
version: "{build}"
|
|
6
|
-
|
|
7
|
-
# Test against this version of Node.js
|
|
8
|
-
environment:
|
|
9
|
-
NODE_ENV: test
|
|
10
|
-
|
|
11
|
-
matrix:
|
|
12
|
-
- nodejs_version: "9.3.0"
|
|
13
|
-
|
|
14
|
-
build: off
|
|
15
|
-
|
|
16
|
-
branches:
|
|
17
|
-
only:
|
|
18
|
-
- master
|
|
19
|
-
|
|
20
|
-
install:
|
|
21
|
-
- ps: Install-Product node $env:nodejs_version
|
|
22
|
-
- npm install -g npm
|
|
23
|
-
- npm config set progress=false
|
|
24
|
-
- npm install
|
|
25
|
-
|
|
26
|
-
# Fix line endings on Windows
|
|
27
|
-
init:
|
|
28
|
-
- git config --global core.autocrlf true
|
|
29
|
-
|
|
30
|
-
test_script:
|
|
31
|
-
# Output useful info for debugging.
|
|
32
|
-
- node --version && npm --version
|
|
33
|
-
- ps: "npm --version # PowerShell" # Pass comment to PS for easier debugging
|
|
34
|
-
- cmd: npm run test
|
|
1
|
+
# AppVeyor file
|
|
2
|
+
# http://www.appveyor.com/docs/appveyor-yml
|
|
3
|
+
|
|
4
|
+
# Build version format
|
|
5
|
+
version: "{build}"
|
|
6
|
+
|
|
7
|
+
# Test against this version of Node.js
|
|
8
|
+
environment:
|
|
9
|
+
NODE_ENV: test
|
|
10
|
+
|
|
11
|
+
matrix:
|
|
12
|
+
- nodejs_version: "9.3.0"
|
|
13
|
+
|
|
14
|
+
build: off
|
|
15
|
+
|
|
16
|
+
branches:
|
|
17
|
+
only:
|
|
18
|
+
- master
|
|
19
|
+
|
|
20
|
+
install:
|
|
21
|
+
- ps: Install-Product node $env:nodejs_version
|
|
22
|
+
- npm install -g npm
|
|
23
|
+
- npm config set progress=false
|
|
24
|
+
- npm install
|
|
25
|
+
|
|
26
|
+
# Fix line endings on Windows
|
|
27
|
+
init:
|
|
28
|
+
- git config --global core.autocrlf true
|
|
29
|
+
|
|
30
|
+
test_script:
|
|
31
|
+
# Output useful info for debugging.
|
|
32
|
+
- node --version && npm --version
|
|
33
|
+
- ps: "npm --version # PowerShell" # Pass comment to PS for easier debugging
|
|
34
|
+
- cmd: npm run test
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { interfaces } from "../interfaces/interfaces";
|
|
2
2
|
export declare class ContainerModule implements interfaces.ContainerModule {
|
|
3
|
-
|
|
3
|
+
id: number;
|
|
4
4
|
registry: interfaces.ContainerModuleCallBack;
|
|
5
5
|
constructor(registry: interfaces.ContainerModuleCallBack);
|
|
6
6
|
}
|
|
7
7
|
export declare class AsyncContainerModule implements interfaces.AsyncContainerModule {
|
|
8
|
-
|
|
8
|
+
id: number;
|
|
9
9
|
registry: interfaces.AsyncContainerModuleCallBack;
|
|
10
10
|
constructor(registry: interfaces.AsyncContainerModuleCallBack);
|
|
11
11
|
}
|
|
@@ -33,7 +33,7 @@ declare namespace interfaces {
|
|
|
33
33
|
clone(): T;
|
|
34
34
|
}
|
|
35
35
|
interface Binding<T> extends Clonable<Binding<T>> {
|
|
36
|
-
|
|
36
|
+
id: number;
|
|
37
37
|
moduleId: string;
|
|
38
38
|
activated: boolean;
|
|
39
39
|
serviceIdentifier: ServiceIdentifier<T>;
|
|
@@ -64,7 +64,7 @@ declare namespace interfaces {
|
|
|
64
64
|
type Middleware = (next: Next) => Next;
|
|
65
65
|
type ContextInterceptor = (context: interfaces.Context) => interfaces.Context;
|
|
66
66
|
interface Context {
|
|
67
|
-
|
|
67
|
+
id: number;
|
|
68
68
|
container: Container;
|
|
69
69
|
plan: Plan;
|
|
70
70
|
currentRequest: Request;
|
|
@@ -92,7 +92,7 @@ declare namespace interfaces {
|
|
|
92
92
|
type ResolveRequestHandler = (request: interfaces.Request) => any;
|
|
93
93
|
type RequestScope = Map<any, any> | null;
|
|
94
94
|
interface Request {
|
|
95
|
-
|
|
95
|
+
id: number;
|
|
96
96
|
serviceIdentifier: ServiceIdentifier<any>;
|
|
97
97
|
parentContext: Context;
|
|
98
98
|
parentRequest: Request | null;
|
|
@@ -103,7 +103,7 @@ declare namespace interfaces {
|
|
|
103
103
|
addChildRequest(serviceIdentifier: ServiceIdentifier<any>, bindings: (Binding<any> | Binding<any>[]), target: Target): Request;
|
|
104
104
|
}
|
|
105
105
|
interface Target {
|
|
106
|
-
|
|
106
|
+
id: number;
|
|
107
107
|
serviceIdentifier: ServiceIdentifier<any>;
|
|
108
108
|
type: TargetType;
|
|
109
109
|
name: QueryableString;
|
|
@@ -125,7 +125,7 @@ declare namespace interfaces {
|
|
|
125
125
|
skipBaseClassChecks?: boolean;
|
|
126
126
|
}
|
|
127
127
|
interface Container {
|
|
128
|
-
|
|
128
|
+
id: number;
|
|
129
129
|
parent: Container | null;
|
|
130
130
|
options: ContainerOptions;
|
|
131
131
|
bind<T>(serviceIdentifier: ServiceIdentifier<T>): BindingToSyntax<T>;
|
|
@@ -154,11 +154,11 @@ declare namespace interfaces {
|
|
|
154
154
|
type Unbind = <T>(serviceIdentifier: ServiceIdentifier<T>) => void;
|
|
155
155
|
type IsBound = <T>(serviceIdentifier: ServiceIdentifier<T>) => boolean;
|
|
156
156
|
interface ContainerModule {
|
|
157
|
-
|
|
157
|
+
id: number;
|
|
158
158
|
registry: ContainerModuleCallBack;
|
|
159
159
|
}
|
|
160
160
|
interface AsyncContainerModule {
|
|
161
|
-
|
|
161
|
+
id: number;
|
|
162
162
|
registry: AsyncContainerModuleCallBack;
|
|
163
163
|
}
|
|
164
164
|
type ContainerModuleCallBack = (bind: interfaces.Bind, unbind: interfaces.Unbind, isBound: interfaces.IsBound, rebind: interfaces.Rebind) => void;
|
package/dts/inversify.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export { multiInject } from "./annotation/multi_inject";
|
|
|
13
13
|
export { targetName } from "./annotation/target_name";
|
|
14
14
|
export { postConstruct } from "./annotation/post_construct";
|
|
15
15
|
export { MetadataReader } from "./planning/metadata_reader";
|
|
16
|
-
export {
|
|
16
|
+
export { id } from "./utils/id";
|
|
17
17
|
export { interfaces } from "./interfaces/interfaces";
|
|
18
18
|
export { decorate } from "./annotation/decorator_utils";
|
|
19
19
|
export { traverseAncerstors, taggedConstraint, namedConstraint, typeConstraint } from "./syntax/constraint_helpers";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { interfaces } from "../interfaces/interfaces";
|
|
2
2
|
declare class Request implements interfaces.Request {
|
|
3
|
-
|
|
3
|
+
id: number;
|
|
4
4
|
serviceIdentifier: interfaces.ServiceIdentifier<any>;
|
|
5
5
|
parentContext: interfaces.Context;
|
|
6
6
|
parentRequest: interfaces.Request | null;
|
package/dts/planning/target.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { interfaces } from "../interfaces/interfaces";
|
|
2
2
|
import { Metadata } from "./metadata";
|
|
3
3
|
declare class Target implements interfaces.Target {
|
|
4
|
-
|
|
4
|
+
id: number;
|
|
5
5
|
type: interfaces.TargetType;
|
|
6
6
|
serviceIdentifier: interfaces.ServiceIdentifier<any>;
|
|
7
7
|
name: interfaces.QueryableString;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function template(strings: TemplateStringsArray, ...keys: any[]): (...values: any[]) => string;
|
|
@@ -26,7 +26,7 @@ function _tagParameterOrProperty(metadataKey, annotationTarget, propertyName, me
|
|
|
26
26
|
for (var _i = 0, paramOrPropertyMetadata_1 = paramOrPropertyMetadata; _i < paramOrPropertyMetadata_1.length; _i++) {
|
|
27
27
|
var m = paramOrPropertyMetadata_1[_i];
|
|
28
28
|
if (m.key === metadata.key) {
|
|
29
|
-
throw new Error(ERROR_MSGS.DUPLICATED_METADATA + " " + m.key);
|
|
29
|
+
throw new Error(ERROR_MSGS.DUPLICATED_METADATA + " " + m.key.toString());
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|
package/es/bindings/binding.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BindingTypeEnum } from "../constants/literal_types";
|
|
2
|
-
import {
|
|
2
|
+
import { id } from "../utils/id";
|
|
3
3
|
var Binding = (function () {
|
|
4
4
|
function Binding(serviceIdentifier, scope) {
|
|
5
|
-
this.
|
|
5
|
+
this.id = id();
|
|
6
6
|
this.activated = false;
|
|
7
7
|
this.serviceIdentifier = serviceIdentifier;
|
|
8
8
|
this.scope = scope;
|
|
@@ -41,7 +41,7 @@ import { MetadataReader } from "../planning/metadata_reader";
|
|
|
41
41
|
import { createMockRequest, getBindingDictionary, plan } from "../planning/planner";
|
|
42
42
|
import { resolve } from "../resolution/resolver";
|
|
43
43
|
import { BindingToSyntax } from "../syntax/binding_to_syntax";
|
|
44
|
-
import {
|
|
44
|
+
import { id } from "../utils/id";
|
|
45
45
|
import { getServiceIdentifierAsString } from "../utils/serialization";
|
|
46
46
|
import { ContainerSnapshot } from "./container_snapshot";
|
|
47
47
|
import { Lookup } from "./lookup";
|
|
@@ -76,7 +76,7 @@ var Container = (function () {
|
|
|
76
76
|
defaultScope: options.defaultScope,
|
|
77
77
|
skipBaseClassChecks: options.skipBaseClassChecks
|
|
78
78
|
};
|
|
79
|
-
this.
|
|
79
|
+
this.id = id();
|
|
80
80
|
this._bindingDictionary = new Lookup();
|
|
81
81
|
this._snapshots = [];
|
|
82
82
|
this._middleware = null;
|
|
@@ -107,7 +107,7 @@ var Container = (function () {
|
|
|
107
107
|
var getHelpers = this._getContainerModuleHelpersFactory();
|
|
108
108
|
for (var _a = 0, modules_1 = modules; _a < modules_1.length; _a++) {
|
|
109
109
|
var currentModule = modules_1[_a];
|
|
110
|
-
var containerModuleHelpers = getHelpers(currentModule.
|
|
110
|
+
var containerModuleHelpers = getHelpers(currentModule.id);
|
|
111
111
|
currentModule.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction);
|
|
112
112
|
}
|
|
113
113
|
};
|
|
@@ -127,7 +127,7 @@ var Container = (function () {
|
|
|
127
127
|
case 1:
|
|
128
128
|
if (!(_a < modules_2.length)) return [3, 4];
|
|
129
129
|
currentModule = modules_2[_a];
|
|
130
|
-
containerModuleHelpers = getHelpers(currentModule.
|
|
130
|
+
containerModuleHelpers = getHelpers(currentModule.id);
|
|
131
131
|
return [4, currentModule.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction)];
|
|
132
132
|
case 2:
|
|
133
133
|
_b.sent();
|
|
@@ -150,7 +150,7 @@ var Container = (function () {
|
|
|
150
150
|
return item.moduleId === expected;
|
|
151
151
|
}; };
|
|
152
152
|
modules.forEach(function (module) {
|
|
153
|
-
var condition = conditionFactory(module.
|
|
153
|
+
var condition = conditionFactory(module.id);
|
|
154
154
|
_this._bindingDictionary.removeByCondition(condition);
|
|
155
155
|
});
|
|
156
156
|
};
|
|
@@ -209,7 +209,7 @@ var Container = (function () {
|
|
|
209
209
|
this._middleware = snapshot.middleware;
|
|
210
210
|
};
|
|
211
211
|
Container.prototype.createChild = function (containerOptions) {
|
|
212
|
-
var child = new Container(containerOptions);
|
|
212
|
+
var child = new Container(containerOptions || this.options);
|
|
213
213
|
child.parent = this;
|
|
214
214
|
return child;
|
|
215
215
|
};
|
|
@@ -243,9 +243,8 @@ var Container = (function () {
|
|
|
243
243
|
return this.getAllTagged(serviceIdentifier, METADATA_KEY.NAMED_TAG, named);
|
|
244
244
|
};
|
|
245
245
|
Container.prototype.resolve = function (constructorFunction) {
|
|
246
|
-
var tempContainer =
|
|
246
|
+
var tempContainer = this.createChild();
|
|
247
247
|
tempContainer.bind(constructorFunction).toSelf();
|
|
248
|
-
tempContainer.parent = this;
|
|
249
248
|
return tempContainer.get(constructorFunction);
|
|
250
249
|
};
|
|
251
250
|
Container.prototype._getContainerModuleHelpersFactory = function () {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { id } from "../utils/id";
|
|
2
2
|
var ContainerModule = (function () {
|
|
3
3
|
function ContainerModule(registry) {
|
|
4
|
-
this.
|
|
4
|
+
this.id = id();
|
|
5
5
|
this.registry = registry;
|
|
6
6
|
}
|
|
7
7
|
return ContainerModule;
|
|
@@ -9,7 +9,7 @@ var ContainerModule = (function () {
|
|
|
9
9
|
export { ContainerModule };
|
|
10
10
|
var AsyncContainerModule = (function () {
|
|
11
11
|
function AsyncContainerModule(registry) {
|
|
12
|
-
this.
|
|
12
|
+
this.id = id();
|
|
13
13
|
this.registry = registry;
|
|
14
14
|
}
|
|
15
15
|
return AsyncContainerModule;
|
package/es/inversify.js
CHANGED
|
@@ -13,7 +13,7 @@ export { multiInject } from "./annotation/multi_inject";
|
|
|
13
13
|
export { targetName } from "./annotation/target_name";
|
|
14
14
|
export { postConstruct } from "./annotation/post_construct";
|
|
15
15
|
export { MetadataReader } from "./planning/metadata_reader";
|
|
16
|
-
export {
|
|
16
|
+
export { id } from "./utils/id";
|
|
17
17
|
export { decorate } from "./annotation/decorator_utils";
|
|
18
18
|
export { traverseAncerstors, taggedConstraint, namedConstraint, typeConstraint } from "./syntax/constraint_helpers";
|
|
19
19
|
export { getServiceIdentifierAsString } from "./utils/serialization";
|
package/es/planning/context.js
CHANGED
package/es/planning/request.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { id } from "../utils/id";
|
|
2
2
|
var Request = (function () {
|
|
3
3
|
function Request(serviceIdentifier, parentContext, parentRequest, bindings, target) {
|
|
4
|
-
this.
|
|
4
|
+
this.id = id();
|
|
5
5
|
this.serviceIdentifier = serviceIdentifier;
|
|
6
6
|
this.parentContext = parentContext;
|
|
7
7
|
this.parentRequest = parentRequest;
|
package/es/planning/target.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as METADATA_KEY from "../constants/metadata_keys";
|
|
2
|
-
import {
|
|
2
|
+
import { id } from "../utils/id";
|
|
3
3
|
import { Metadata } from "./metadata";
|
|
4
4
|
import { QueryableString } from "./queryable_string";
|
|
5
5
|
var Target = (function () {
|
|
6
6
|
function Target(type, name, serviceIdentifier, namedOrTagged) {
|
|
7
|
-
this.
|
|
7
|
+
this.id = id();
|
|
8
8
|
this.type = type;
|
|
9
9
|
this.serviceIdentifier = serviceIdentifier;
|
|
10
10
|
this.name = new QueryableString(name || "");
|
|
@@ -45,8 +45,8 @@ var _resolveRequest = function (requestScope) {
|
|
|
45
45
|
}
|
|
46
46
|
if (isRequestSingleton &&
|
|
47
47
|
requestScope !== null &&
|
|
48
|
-
requestScope.has(binding_1.
|
|
49
|
-
return requestScope.get(binding_1.
|
|
48
|
+
requestScope.has(binding_1.id)) {
|
|
49
|
+
return requestScope.get(binding_1.id);
|
|
50
50
|
}
|
|
51
51
|
if (binding_1.type === BindingTypeEnum.ConstantValue) {
|
|
52
52
|
result = binding_1.cache;
|
|
@@ -82,8 +82,8 @@ var _resolveRequest = function (requestScope) {
|
|
|
82
82
|
}
|
|
83
83
|
if (isRequestSingleton &&
|
|
84
84
|
requestScope !== null &&
|
|
85
|
-
!requestScope.has(binding_1.
|
|
86
|
-
requestScope.set(binding_1.
|
|
85
|
+
!requestScope.has(binding_1.id)) {
|
|
86
|
+
requestScope.set(binding_1.id, result);
|
|
87
87
|
}
|
|
88
88
|
return result;
|
|
89
89
|
}
|
package/es/utils/id.js
ADDED
|
@@ -30,7 +30,7 @@ function _tagParameterOrProperty(metadataKey, annotationTarget, propertyName, me
|
|
|
30
30
|
for (var _i = 0, paramOrPropertyMetadata_1 = paramOrPropertyMetadata; _i < paramOrPropertyMetadata_1.length; _i++) {
|
|
31
31
|
var m = paramOrPropertyMetadata_1[_i];
|
|
32
32
|
if (m.key === metadata.key) {
|
|
33
|
-
throw new Error(ERROR_MSGS.DUPLICATED_METADATA + " " + m.key);
|
|
33
|
+
throw new Error(ERROR_MSGS.DUPLICATED_METADATA + " " + m.key.toString());
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
package/lib/bindings/binding.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var literal_types_1 = require("../constants/literal_types");
|
|
4
|
-
var
|
|
4
|
+
var id_1 = require("../utils/id");
|
|
5
5
|
var Binding = (function () {
|
|
6
6
|
function Binding(serviceIdentifier, scope) {
|
|
7
|
-
this.
|
|
7
|
+
this.id = id_1.id();
|
|
8
8
|
this.activated = false;
|
|
9
9
|
this.serviceIdentifier = serviceIdentifier;
|
|
10
10
|
this.scope = scope;
|