@spinajs/di 2.0.45 → 2.0.48
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/lib/array.d.ts +2 -1
- package/lib/array.d.ts.map +1 -0
- package/lib/array.js +1 -5
- package/lib/array.js.map +1 -1
- package/lib/binder.d.ts +3 -2
- package/lib/binder.d.ts.map +1 -0
- package/lib/binder.js +11 -16
- package/lib/binder.js.map +1 -1
- package/lib/container-cache.d.ts +4 -3
- package/lib/container-cache.d.ts.map +1 -0
- package/lib/container-cache.js +6 -10
- package/lib/container-cache.js.map +1 -1
- package/lib/container.d.ts +7 -6
- package/lib/container.d.ts.map +1 -0
- package/lib/container.js +61 -67
- package/lib/container.js.map +1 -1
- package/lib/decorators.d.ts +5 -4
- package/lib/decorators.d.ts.map +1 -0
- package/lib/decorators.js +34 -66
- package/lib/decorators.js.map +1 -1
- package/lib/enums.d.ts +1 -0
- package/lib/enums.d.ts.map +1 -0
- package/lib/enums.js +2 -5
- package/lib/enums.js.map +1 -1
- package/lib/exceptions.d.ts +1 -0
- package/lib/exceptions.d.ts.map +1 -0
- package/lib/exceptions.js +3 -9
- package/lib/exceptions.js.map +1 -1
- package/lib/helpers.d.ts +4 -3
- package/lib/helpers.d.ts.map +1 -0
- package/lib/helpers.js +13 -26
- package/lib/helpers.js.map +1 -1
- package/lib/index.d.ts +13 -12
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +12 -41
- package/lib/index.js.map +1 -1
- package/lib/interfaces.d.ts +7 -6
- package/lib/interfaces.d.ts.map +1 -0
- package/lib/interfaces.js +4 -11
- package/lib/interfaces.js.map +1 -1
- package/lib/registry.d.ts +4 -3
- package/lib/registry.d.ts.map +1 -0
- package/lib/registry.js +15 -19
- package/lib/registry.js.map +1 -1
- package/lib/root.d.ts +5 -3
- package/lib/root.d.ts.map +1 -0
- package/lib/root.js +62 -90
- package/lib/root.js.map +1 -1
- package/lib/types.d.ts +7 -6
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +1 -2
- package/package.json +54 -50
package/lib/decorators.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IAutoinjectOptions, IInjectDescriptor } from './interfaces';
|
|
2
|
-
import { Class } from './types';
|
|
3
|
-
import { TypedArray } from './array';
|
|
1
|
+
import { IAutoinjectOptions, IInjectDescriptor } from './interfaces.js';
|
|
2
|
+
import { Class } from './types.js';
|
|
3
|
+
import { TypedArray } from './array.js';
|
|
4
4
|
export declare const DI_DESCRIPTION_SYMBOL = "__DI_INJECTION_DESCRIPTOR__";
|
|
5
5
|
export declare function AddDependency(callback?: (descriptor: IInjectDescriptor<unknown>, target: Class<unknown>, propertyKey: string | symbol, indexOrDescriptor: number | PropertyDescriptor) => void): any;
|
|
6
6
|
/**
|
|
@@ -106,7 +106,7 @@ export declare function Autoinject<T>(typeOrOptions?: Class<T> | IAutoinjectOpti
|
|
|
106
106
|
*
|
|
107
107
|
* ```
|
|
108
108
|
*/
|
|
109
|
-
export declare function LazyInject(service
|
|
109
|
+
export declare function LazyInject(service?: Class<any> | string): (target?: any, key?: string) => void;
|
|
110
110
|
/**
|
|
111
111
|
* Per child instance injection decorator - object is resolved once per container - child containers have own instances.
|
|
112
112
|
*/
|
|
@@ -138,3 +138,4 @@ export declare function PerInstanceCheck(): any;
|
|
|
138
138
|
* Singleton injection decorator - every time class is resolved - its created only once globally ( even in child DI containers )
|
|
139
139
|
*/
|
|
140
140
|
export declare function Singleton(): any;
|
|
141
|
+
//# sourceMappingURL=decorators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAI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|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.Singleton = exports.PerInstanceCheck = exports.PerInstance = exports.NewInstance = exports.PerChildInstance = exports.LazyInject = exports.Autoinject = exports.Inject = exports.Injectable = exports.AddDependency = exports.DI_DESCRIPTION_SYMBOL = void 0;
|
|
27
|
-
const enums_1 = require("./enums");
|
|
28
|
-
const DI = __importStar(require("./root"));
|
|
29
|
-
const helpers_1 = require("./helpers");
|
|
30
|
-
exports.DI_DESCRIPTION_SYMBOL = '__DI_INJECTION_DESCRIPTOR__';
|
|
31
|
-
function AddDependency(callback) {
|
|
1
|
+
import { ResolveType } from './enums.js';
|
|
2
|
+
import * as DI from './root.js';
|
|
3
|
+
import { isConstructor, isTypedArray } from './helpers.js';
|
|
4
|
+
export const DI_DESCRIPTION_SYMBOL = '__DI_INJECTION_DESCRIPTOR__';
|
|
5
|
+
export function AddDependency(callback) {
|
|
32
6
|
return (target, propertyKey, indexOrDescriptor) => {
|
|
33
7
|
let descriptor = target.__DI_INJECTION_DESCRIPTOR__;
|
|
34
8
|
if (!descriptor) {
|
|
35
9
|
descriptor = {
|
|
36
10
|
inject: [],
|
|
37
|
-
resolver:
|
|
11
|
+
resolver: ResolveType.Singleton,
|
|
38
12
|
};
|
|
39
|
-
target[`${
|
|
13
|
+
target[`${DI_DESCRIPTION_SYMBOL}`] = descriptor;
|
|
40
14
|
}
|
|
41
15
|
if (callback) {
|
|
42
16
|
callback(descriptor, target, propertyKey, indexOrDescriptor);
|
|
43
17
|
}
|
|
44
18
|
};
|
|
45
19
|
}
|
|
46
|
-
exports.AddDependency = AddDependency;
|
|
47
20
|
/**
|
|
48
21
|
*
|
|
49
22
|
* Class with this decorator is automatically registered in DI container an can be resolved.
|
|
@@ -70,7 +43,7 @@ exports.AddDependency = AddDependency;
|
|
|
70
43
|
* ```
|
|
71
44
|
*
|
|
72
45
|
*/
|
|
73
|
-
function Injectable(as) {
|
|
46
|
+
export function Injectable(as) {
|
|
74
47
|
return (target) => {
|
|
75
48
|
if (as) {
|
|
76
49
|
DI.register(target).as(as);
|
|
@@ -80,7 +53,6 @@ function Injectable(as) {
|
|
|
80
53
|
}
|
|
81
54
|
};
|
|
82
55
|
}
|
|
83
|
-
exports.Injectable = Injectable;
|
|
84
56
|
/**
|
|
85
57
|
* Sets dependency injection guidelines - what to inject for specified class. If multiple instances are registered at specified type,
|
|
86
58
|
* only first one is resolved and injected
|
|
@@ -107,13 +79,13 @@ exports.Injectable = Injectable;
|
|
|
107
79
|
*
|
|
108
80
|
* ```
|
|
109
81
|
*/
|
|
110
|
-
function Inject(...args) {
|
|
82
|
+
export function Inject(...args) {
|
|
111
83
|
return AddDependency((descriptor) => {
|
|
112
84
|
for (const a of args) {
|
|
113
85
|
// avoid injecting duplicates
|
|
114
86
|
if (!descriptor.inject.find((i) => {
|
|
115
|
-
if (
|
|
116
|
-
if (
|
|
87
|
+
if (isTypedArray(i)) {
|
|
88
|
+
if (isTypedArray(a)) {
|
|
117
89
|
return i.Type === a.Type;
|
|
118
90
|
}
|
|
119
91
|
else {
|
|
@@ -134,7 +106,6 @@ function Inject(...args) {
|
|
|
134
106
|
}
|
|
135
107
|
});
|
|
136
108
|
}
|
|
137
|
-
exports.Inject = Inject;
|
|
138
109
|
/**
|
|
139
110
|
* Automatically injects dependency based on reflected property type. Uses experimental typescript reflection api
|
|
140
111
|
* If decorator is applied to array property all registered type instances are injected, otherwise only first / only that exists
|
|
@@ -161,12 +132,12 @@ exports.Inject = Inject;
|
|
|
161
132
|
*
|
|
162
133
|
* ```
|
|
163
134
|
*/
|
|
164
|
-
function Autoinject(typeOrOptions, options) {
|
|
135
|
+
export function Autoinject(typeOrOptions, options) {
|
|
165
136
|
return AddDependency((descriptor, target, propertyKey) => {
|
|
166
137
|
let type = Reflect.getMetadata('design:type', target, propertyKey);
|
|
167
138
|
const isArray = type.name === 'Array' || type.name === 'Map';
|
|
168
139
|
let opt = options;
|
|
169
|
-
if (
|
|
140
|
+
if (isConstructor(typeOrOptions)) {
|
|
170
141
|
if (isArray && !typeOrOptions) {
|
|
171
142
|
throw new Error('you must provide inject type when injecting array');
|
|
172
143
|
}
|
|
@@ -179,12 +150,11 @@ function Autoinject(typeOrOptions, options) {
|
|
|
179
150
|
autoinject: true,
|
|
180
151
|
autoinjectKey: propertyKey,
|
|
181
152
|
inject: isArray ? Array.ofType(typeOrOptions) : type,
|
|
182
|
-
mapFunc: opt
|
|
183
|
-
options: opt
|
|
153
|
+
mapFunc: opt?.mapFunc,
|
|
154
|
+
options: opt?.options,
|
|
184
155
|
});
|
|
185
156
|
});
|
|
186
157
|
}
|
|
187
|
-
exports.Autoinject = Autoinject;
|
|
188
158
|
/**
|
|
189
159
|
* Lazy injects service to object. Use only with class properties
|
|
190
160
|
*
|
|
@@ -207,44 +177,45 @@ exports.Autoinject = Autoinject;
|
|
|
207
177
|
*
|
|
208
178
|
* ```
|
|
209
179
|
*/
|
|
210
|
-
function LazyInject(service) {
|
|
180
|
+
export function LazyInject(service) {
|
|
211
181
|
return (target, key) => {
|
|
182
|
+
const type = Reflect.getMetadata('design:type', target, key);
|
|
212
183
|
// property getter
|
|
213
184
|
const getter = () => {
|
|
214
|
-
if (
|
|
215
|
-
return DI.
|
|
185
|
+
if (!service) {
|
|
186
|
+
return DI.resolve(type);
|
|
216
187
|
}
|
|
217
188
|
else {
|
|
218
|
-
|
|
189
|
+
if (typeof service === 'string') {
|
|
190
|
+
return DI.get(service);
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
return DI.resolve(service);
|
|
194
|
+
}
|
|
219
195
|
}
|
|
220
196
|
};
|
|
221
197
|
// Create new property with getter and setter
|
|
222
198
|
Object.defineProperty(target, key, {
|
|
223
|
-
configurable: true,
|
|
224
|
-
enumerable: false,
|
|
225
199
|
get: getter,
|
|
226
200
|
});
|
|
227
201
|
};
|
|
228
202
|
}
|
|
229
|
-
exports.LazyInject = LazyInject;
|
|
230
203
|
/**
|
|
231
204
|
* Per child instance injection decorator - object is resolved once per container - child containers have own instances.
|
|
232
205
|
*/
|
|
233
|
-
function PerChildInstance() {
|
|
206
|
+
export function PerChildInstance() {
|
|
234
207
|
return AddDependency((descriptor) => {
|
|
235
|
-
descriptor.resolver =
|
|
208
|
+
descriptor.resolver = ResolveType.PerChildContainer;
|
|
236
209
|
});
|
|
237
210
|
}
|
|
238
|
-
exports.PerChildInstance = PerChildInstance;
|
|
239
211
|
/**
|
|
240
212
|
* NewInstance injection decorator - every time class is injected - its created from scratch
|
|
241
213
|
*/
|
|
242
|
-
function NewInstance() {
|
|
214
|
+
export function NewInstance() {
|
|
243
215
|
return AddDependency((descriptor) => {
|
|
244
|
-
descriptor.resolver =
|
|
216
|
+
descriptor.resolver = ResolveType.NewInstance;
|
|
245
217
|
});
|
|
246
218
|
}
|
|
247
|
-
exports.NewInstance = NewInstance;
|
|
248
219
|
/**
|
|
249
220
|
* If we have multiple registered types at one base type
|
|
250
221
|
* we can resolve only one by default. Per instance means, that
|
|
@@ -254,12 +225,11 @@ exports.NewInstance = NewInstance;
|
|
|
254
225
|
* In comparison, Singleton flag means that only one instance can be resolved
|
|
255
226
|
* for base class
|
|
256
227
|
*/
|
|
257
|
-
function PerInstance() {
|
|
228
|
+
export function PerInstance() {
|
|
258
229
|
return AddDependency((descriptor) => {
|
|
259
|
-
descriptor.resolver =
|
|
230
|
+
descriptor.resolver = ResolveType.PerInstance;
|
|
260
231
|
});
|
|
261
232
|
}
|
|
262
|
-
exports.PerInstance = PerInstance;
|
|
263
233
|
/**
|
|
264
234
|
*
|
|
265
235
|
* Before resolve, check function on all resolved instances of given type is called with creation options
|
|
@@ -268,17 +238,15 @@ exports.PerInstance = PerInstance;
|
|
|
268
238
|
*
|
|
269
239
|
* @returns
|
|
270
240
|
*/
|
|
271
|
-
function PerInstanceCheck() {
|
|
241
|
+
export function PerInstanceCheck() {
|
|
272
242
|
return AddDependency((descriptor) => {
|
|
273
|
-
descriptor.resolver =
|
|
243
|
+
descriptor.resolver = ResolveType.PerInstanceCheck;
|
|
274
244
|
});
|
|
275
245
|
}
|
|
276
|
-
exports.PerInstanceCheck = PerInstanceCheck;
|
|
277
246
|
/**
|
|
278
247
|
* Singleton injection decorator - every time class is resolved - its created only once globally ( even in child DI containers )
|
|
279
248
|
*/
|
|
280
|
-
function Singleton() {
|
|
249
|
+
export function Singleton() {
|
|
281
250
|
return AddDependency();
|
|
282
251
|
}
|
|
283
|
-
exports.Singleton = Singleton;
|
|
284
252
|
//# sourceMappingURL=decorators.js.map
|
package/lib/decorators.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAIzC,OAAO,KAAK,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAA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;;GAQG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO,aAAa,CAAC,CAAC,UAAsC,EAAE,EAAE;QAC9D,UAAU,CAAC,QAAQ,GAAG,WAAW,CAAC,WAAW,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,aAAa,CAAC,CAAC,UAAsC,EAAE,EAAE;QAC9D,UAAU,CAAC,QAAQ,GAAG,WAAW,CAAC,gBAAgB,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS;IACvB,OAAO,aAAa,EAAE,CAAC;AACzB,CAAC"}
|
package/lib/enums.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,WAAW;IACrB;;OAEG;IACH,SAAS,IAAA;IAET;;OAEG;IACH,WAAW,IAAA;IAEX;;OAEG;IACH,iBAAiB,IAAA;IAEjB;;;;;;;;OAQG;IACH,WAAW,IAAA;IAEX;;OAEG;IACH,gBAAgB,IAAA;CACjB"}
|
package/lib/enums.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ResolveType = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* How to resolve class
|
|
6
3
|
*/
|
|
7
|
-
var ResolveType;
|
|
4
|
+
export var ResolveType;
|
|
8
5
|
(function (ResolveType) {
|
|
9
6
|
/**
|
|
10
7
|
* Application wise single instance. Default behaviour
|
|
@@ -32,5 +29,5 @@ var ResolveType;
|
|
|
32
29
|
* Only one instance with given name can exists of the same service
|
|
33
30
|
*/
|
|
34
31
|
ResolveType[ResolveType["PerInstanceCheck"] = 4] = "PerInstanceCheck";
|
|
35
|
-
})(ResolveType
|
|
32
|
+
})(ResolveType || (ResolveType = {}));
|
|
36
33
|
//# sourceMappingURL=enums.js.map
|
package/lib/enums.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,WA+BX;AA/BD,WAAY,WAAW;IACrB;;OAEG;IACH,uDAAS,CAAA;IAET;;OAEG;IACH,2DAAW,CAAA;IAEX;;OAEG;IACH,uEAAiB,CAAA;IAEjB;;;;;;;;OAQG;IACH,2DAAW,CAAA;IAEX;;OAEG;IACH,qEAAgB,CAAA;AAClB,CAAC,EA/BW,WAAW,KAAX,WAAW,QA+BtB"}
|
package/lib/exceptions.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exceptions.d.ts","sourceRoot":"","sources":["../src/exceptions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC;;;OAGG;gBACS,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,qBAAa,aAAc,SAAQ,KAAK;CAAG;AAE3C;;GAEG;AACH,qBAAa,eAAgB,SAAQ,KAAK;CAAG"}
|
package/lib/exceptions.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ServiceNotFound = exports.BindException = exports.ResolveException = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Exception thrown when cannot resolve type
|
|
6
3
|
*/
|
|
7
|
-
class ResolveException extends Error {
|
|
4
|
+
export class ResolveException extends Error {
|
|
8
5
|
/**
|
|
9
6
|
* Constructs new exception with message
|
|
10
7
|
* @param message - error message
|
|
@@ -13,14 +10,11 @@ class ResolveException extends Error {
|
|
|
13
10
|
super(message);
|
|
14
11
|
}
|
|
15
12
|
}
|
|
16
|
-
|
|
17
|
-
class BindException extends Error {
|
|
13
|
+
export class BindException extends Error {
|
|
18
14
|
}
|
|
19
|
-
exports.BindException = BindException;
|
|
20
15
|
/**
|
|
21
16
|
* Service is not registered in DI container
|
|
22
17
|
*/
|
|
23
|
-
class ServiceNotFound extends Error {
|
|
18
|
+
export class ServiceNotFound extends Error {
|
|
24
19
|
}
|
|
25
|
-
exports.ServiceNotFound = ServiceNotFound;
|
|
26
20
|
//# sourceMappingURL=exceptions.js.map
|
package/lib/exceptions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exceptions.js","sourceRoot":"","sources":["../src/exceptions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"exceptions.js","sourceRoot":"","sources":["../src/exceptions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACzC;;;OAGG;IACH,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;CACF;AAED,MAAM,OAAO,aAAc,SAAQ,KAAK;CAAG;AAE3C;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;CAAG"}
|
package/lib/helpers.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { TypedArray } from './array';
|
|
2
|
-
import { AsyncService, SyncService } from './interfaces';
|
|
3
|
-
import { Factory, Class } from './types';
|
|
1
|
+
import { TypedArray } from './array.js';
|
|
2
|
+
import { AsyncService, SyncService } from './interfaces.js';
|
|
3
|
+
import { Factory, Class } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Checks if value is constructable type.
|
|
6
6
|
* Checks for [[Construct]] internal function in object.
|
|
@@ -23,3 +23,4 @@ export declare function isTypedArray(value: any): value is TypedArray<any>;
|
|
|
23
23
|
export declare function isMap(value: any): value is Map<string, any>;
|
|
24
24
|
export declare function uniqBy<T>(arr: T[], comparator: (a: T, b: T) => boolean): T[];
|
|
25
25
|
export declare function getTypeName(type: TypedArray<any> | Class<any> | string | object): string;
|
|
26
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAQjE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,CAE3D;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,MAAM,CAEpD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,YAAY,CAEhE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,CAE3D;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,WAAW,CAE9D;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,UAAU,CAAC,GAAG,CAAC,CAEjE;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAE3D;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,OAQtE;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAExF"}
|
package/lib/helpers.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTypeName = exports.uniqBy = exports.isMap = exports.isTypedArray = exports.isSyncService = exports.isPromise = exports.isAsyncService = exports.isObject = exports.isFactory = exports.isConstructor = void 0;
|
|
4
|
-
const interfaces_1 = require("./interfaces");
|
|
1
|
+
import { AsyncService, SyncService } from './interfaces.js';
|
|
5
2
|
/**
|
|
6
3
|
* Checks if value is constructable type.
|
|
7
4
|
* Checks for [[Construct]] internal function in object.
|
|
8
5
|
*
|
|
9
6
|
* @param value - value to test
|
|
10
7
|
*/
|
|
11
|
-
function isConstructor(value) {
|
|
8
|
+
export function isConstructor(value) {
|
|
12
9
|
try {
|
|
13
10
|
Reflect.construct(String, [], value);
|
|
14
11
|
}
|
|
@@ -17,42 +14,34 @@ function isConstructor(value) {
|
|
|
17
14
|
}
|
|
18
15
|
return true;
|
|
19
16
|
}
|
|
20
|
-
|
|
21
|
-
function isFactory(value) {
|
|
17
|
+
export function isFactory(value) {
|
|
22
18
|
return !isConstructor(value) && typeof value === 'function';
|
|
23
19
|
}
|
|
24
|
-
|
|
25
|
-
function isObject(value) {
|
|
20
|
+
export function isObject(value) {
|
|
26
21
|
return typeof value === 'object';
|
|
27
22
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return value instanceof interfaces_1.AsyncService;
|
|
23
|
+
export function isAsyncService(value) {
|
|
24
|
+
return value instanceof AsyncService;
|
|
31
25
|
}
|
|
32
|
-
|
|
33
|
-
function isPromise(value) {
|
|
26
|
+
export function isPromise(value) {
|
|
34
27
|
return value instanceof Promise;
|
|
35
28
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return value instanceof interfaces_1.SyncService;
|
|
29
|
+
export function isSyncService(value) {
|
|
30
|
+
return value instanceof SyncService;
|
|
39
31
|
}
|
|
40
|
-
exports.isSyncService = isSyncService;
|
|
41
32
|
/**
|
|
42
33
|
* For DI purpose we treat Map as array to inject. Difference is, that we fill map by some key
|
|
43
34
|
* provided by mapFunc in \@Autoinject
|
|
44
35
|
* @param value - value to check type
|
|
45
36
|
* @returns
|
|
46
37
|
*/
|
|
47
|
-
function isTypedArray(value) {
|
|
38
|
+
export function isTypedArray(value) {
|
|
48
39
|
return (value instanceof Array && value.constructor.name === 'TypedArray') || isMap(value);
|
|
49
40
|
}
|
|
50
|
-
|
|
51
|
-
function isMap(value) {
|
|
41
|
+
export function isMap(value) {
|
|
52
42
|
return value instanceof Map && value.constructor.name === 'Map';
|
|
53
43
|
}
|
|
54
|
-
|
|
55
|
-
function uniqBy(arr, comparator) {
|
|
44
|
+
export function uniqBy(arr, comparator) {
|
|
56
45
|
const uniques = [];
|
|
57
46
|
for (const a of arr) {
|
|
58
47
|
if (uniques.findIndex((u) => comparator(a, u)) === -1) {
|
|
@@ -61,9 +50,7 @@ function uniqBy(arr, comparator) {
|
|
|
61
50
|
}
|
|
62
51
|
return uniques;
|
|
63
52
|
}
|
|
64
|
-
|
|
65
|
-
function getTypeName(type) {
|
|
53
|
+
export function getTypeName(type) {
|
|
66
54
|
return typeof type === 'string' ? type : isTypedArray(type) ? getTypeName(type.Type) : isConstructor(type) ? type.name : type.constructor.name;
|
|
67
55
|
}
|
|
68
|
-
exports.getTypeName = getTypeName;
|
|
69
56
|
//# sourceMappingURL=helpers.js.map
|
package/lib/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":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,EAAE;QACnB,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE;YACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACjB;KACF;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,IAAoD;IAC9E,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;AACjJ,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
export * from './interfaces';
|
|
2
|
-
export * from './array';
|
|
3
|
-
export * from './decorators';
|
|
4
|
-
export * from './enums';
|
|
5
|
-
export * from './types';
|
|
6
|
-
export * from './helpers';
|
|
7
|
-
export * from './container-cache';
|
|
8
|
-
export * from './binder';
|
|
9
|
-
export * from './registry';
|
|
10
|
-
export * from './container';
|
|
11
|
-
export * as DI from './root';
|
|
12
|
-
export * from './exceptions';
|
|
1
|
+
export * from './interfaces.js';
|
|
2
|
+
export * from './array.js';
|
|
3
|
+
export * from './decorators.js';
|
|
4
|
+
export * from './enums.js';
|
|
5
|
+
export * from './types.js';
|
|
6
|
+
export * from './helpers.js';
|
|
7
|
+
export * from './container-cache.js';
|
|
8
|
+
export * from './binder.js';
|
|
9
|
+
export * from './registry.js';
|
|
10
|
+
export * from './container.js';
|
|
11
|
+
export * as DI from './root.js';
|
|
12
|
+
export * from './exceptions.js';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,OAAO,KAAK,EAAE,MAAM,WAAW,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,42 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
-
};
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
-
if (mod && mod.__esModule) return mod;
|
|
23
|
-
var result = {};
|
|
24
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
-
__setModuleDefault(result, mod);
|
|
26
|
-
return result;
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.DI = void 0;
|
|
30
|
-
__exportStar(require("./interfaces"), exports);
|
|
31
|
-
__exportStar(require("./array"), exports);
|
|
32
|
-
__exportStar(require("./decorators"), exports);
|
|
33
|
-
__exportStar(require("./enums"), exports);
|
|
34
|
-
__exportStar(require("./types"), exports);
|
|
35
|
-
__exportStar(require("./helpers"), exports);
|
|
36
|
-
__exportStar(require("./container-cache"), exports);
|
|
37
|
-
__exportStar(require("./binder"), exports);
|
|
38
|
-
__exportStar(require("./registry"), exports);
|
|
39
|
-
__exportStar(require("./container"), exports);
|
|
40
|
-
exports.DI = __importStar(require("./root"));
|
|
41
|
-
__exportStar(require("./exceptions"), exports);
|
|
1
|
+
export * from './interfaces.js';
|
|
2
|
+
export * from './array.js';
|
|
3
|
+
export * from './decorators.js';
|
|
4
|
+
export * from './enums.js';
|
|
5
|
+
export * from './types.js';
|
|
6
|
+
export * from './helpers.js';
|
|
7
|
+
export * from './container-cache.js';
|
|
8
|
+
export * from './binder.js';
|
|
9
|
+
export * from './registry.js';
|
|
10
|
+
export * from './container.js';
|
|
11
|
+
export * as DI from './root.js';
|
|
12
|
+
export * from './exceptions.js';
|
|
42
13
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,OAAO,KAAK,EAAE,MAAM,WAAW,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
|
package/lib/interfaces.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { ResolveType } from './enums';
|
|
3
|
-
import { Class, Factory } from './types';
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import { ResolveType } from './enums.js';
|
|
3
|
+
import { Class, Factory } from './types.js';
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
|
-
import { TypedArray } from './array';
|
|
6
|
-
import { Registry } from './registry';
|
|
7
|
-
import { ContainerCache } from './container-cache';
|
|
5
|
+
import { TypedArray } from './array.js';
|
|
6
|
+
import { Registry } from './registry.js';
|
|
7
|
+
import { ContainerCache } from './container-cache.js';
|
|
8
8
|
export interface IInstanceCheck {
|
|
9
9
|
__checkInstance__(creationOptions: any): boolean;
|
|
10
10
|
}
|
|
@@ -148,3 +148,4 @@ export interface IAutoinjectOptions {
|
|
|
148
148
|
mapFunc?: (x: IMappableService) => string;
|
|
149
149
|
options?: any;
|
|
150
150
|
}
|
|
151
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,WAAW,cAAc;IAC7B,iBAAiB,CAAC,eAAe,EAAE,GAAG,GAAG,OAAO,CAAC;CAClD;AAED;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB;;;;OAIG;IACH,EAA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,qBAAa,YAAa,SAAQ,OAAO;IAE1B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAGtC;AAED,8BAAsB,YAAY;aAChB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;CAClD;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,gBAAgB,KAAK,MAAM,CAAC;IAC1C,OAAO,CAAC,EAAE,GAAG,CAAC;CACf"}
|
package/lib/interfaces.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Bootstrapper = exports.AsyncService = exports.SyncService = exports.Service = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Interface to describe DI resolve strategies. Strategies are used do
|
|
6
3
|
* do some work at object creation eg. initialize objects that inherits from same class
|
|
@@ -15,7 +12,7 @@ exports.Bootstrapper = exports.AsyncService = exports.SyncService = exports.Serv
|
|
|
15
12
|
// export interface IAsyncStrategy {
|
|
16
13
|
// resolveA: (target: any, container: IContainer) => Promise<void>;
|
|
17
14
|
// }
|
|
18
|
-
class Service {
|
|
15
|
+
export class Service {
|
|
19
16
|
constructor() {
|
|
20
17
|
this.resolved = false;
|
|
21
18
|
}
|
|
@@ -28,21 +25,17 @@ class Service {
|
|
|
28
25
|
*/
|
|
29
26
|
async dispose() { }
|
|
30
27
|
}
|
|
31
|
-
|
|
32
|
-
class SyncService extends Service {
|
|
28
|
+
export class SyncService extends Service {
|
|
33
29
|
resolve() {
|
|
34
30
|
this.resolved = true;
|
|
35
31
|
}
|
|
36
32
|
}
|
|
37
|
-
|
|
38
|
-
class AsyncService extends Service {
|
|
33
|
+
export class AsyncService extends Service {
|
|
39
34
|
/* eslint-disable */
|
|
40
35
|
async resolve() {
|
|
41
36
|
this.resolved = true;
|
|
42
37
|
}
|
|
43
38
|
}
|
|
44
|
-
|
|
45
|
-
class Bootstrapper {
|
|
39
|
+
export class Bootstrapper {
|
|
46
40
|
}
|
|
47
|
-
exports.Bootstrapper = Bootstrapper;
|
|
48
41
|
//# sourceMappingURL=interfaces.js.map
|