ts-ioc-container 32.0.3 → 32.0.4
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/README.md +9 -8
- package/cjm/by.js +33 -58
- package/cjm/index.js +3 -1
- package/esm/by.js +30 -57
- package/esm/index.js +1 -1
- package/package.json +2 -2
- package/typings/by.d.ts +9 -35
- package/typings/index.d.ts +1 -1
- package/typings/injector/MetadataInjector.d.ts +1 -2
package/README.md
CHANGED
|
@@ -766,7 +766,8 @@ Alias is needed to group keys
|
|
|
766
766
|
import 'reflect-metadata';
|
|
767
767
|
import {
|
|
768
768
|
alias,
|
|
769
|
-
|
|
769
|
+
byAlias,
|
|
770
|
+
byAliases,
|
|
770
771
|
Container,
|
|
771
772
|
DependencyNotFoundError,
|
|
772
773
|
IMemo,
|
|
@@ -811,7 +812,7 @@ describe('alias', () => {
|
|
|
811
812
|
it('should resolve by some alias', () => {
|
|
812
813
|
class App implements IApplication {
|
|
813
814
|
private appliedMiddleware: Set<string> = new Set();
|
|
814
|
-
constructor(@inject(
|
|
815
|
+
constructor(@inject(byAliases((it) => it.has(IMiddlewareKey))) public middleware: IMiddleware[]) {}
|
|
815
816
|
|
|
816
817
|
markMiddlewareAsApplied(name: string): void {
|
|
817
818
|
this.appliedMiddleware.add(name);
|
|
@@ -849,8 +850,8 @@ describe('alias', () => {
|
|
|
849
850
|
|
|
850
851
|
const container = new Container(new MetadataInjector()).add(R.fromClass(FileLogger));
|
|
851
852
|
|
|
852
|
-
expect(
|
|
853
|
-
expect(() =>
|
|
853
|
+
expect(byAlias((aliases) => aliases.has('ILogger'))(container)).toBeInstanceOf(FileLogger);
|
|
854
|
+
expect(() => byAlias((aliases) => aliases.has('logger'))(container)).toThrowError(DependencyNotFoundError);
|
|
854
855
|
});
|
|
855
856
|
|
|
856
857
|
it('should resolve by memoized alias', () => {
|
|
@@ -867,10 +868,10 @@ describe('alias', () => {
|
|
|
867
868
|
.add(R.fromClass(FileLogger))
|
|
868
869
|
.add(R.fromClass(DbLogger));
|
|
869
870
|
|
|
870
|
-
const result1 =
|
|
871
|
+
const result1 = byAlias((aliases) => aliases.has('ILogger'), { memoize: constant('ILogger') })(container);
|
|
871
872
|
const child = container.createScope('child');
|
|
872
|
-
const result2 =
|
|
873
|
-
const result3 =
|
|
873
|
+
const result2 = byAlias((aliases) => aliases.has('ILogger'), { memoize: constant('ILogger') })(child);
|
|
874
|
+
const result3 = byAlias((aliases) => aliases.has('ILogger'))(child);
|
|
874
875
|
|
|
875
876
|
expect(result1).toBeInstanceOf(FileLogger);
|
|
876
877
|
expect(result2).toBeInstanceOf(FileLogger);
|
|
@@ -889,7 +890,7 @@ describe('alias', () => {
|
|
|
889
890
|
|
|
890
891
|
class App {
|
|
891
892
|
constructor(
|
|
892
|
-
@inject(
|
|
893
|
+
@inject(byAliases((it) => it.has('ILogger'), { memoize: constant('ILogger') })) public loggers: ILogger[],
|
|
893
894
|
) {}
|
|
894
895
|
}
|
|
895
896
|
|
package/cjm/by.js
CHANGED
|
@@ -1,72 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.by = exports.IMemoKey = exports.all = void 0;
|
|
3
|
+
exports.by = exports.byAlias = exports.byAliases = exports.IMemoKey = exports.all = void 0;
|
|
4
4
|
const all = () => true;
|
|
5
5
|
exports.all = all;
|
|
6
6
|
exports.IMemoKey = Symbol('IMemo');
|
|
7
|
+
const byAliases = (predicate, { memoize, lazy } = {}) => (c) => {
|
|
8
|
+
const predicateFn = (aliases) => predicate(aliases, c);
|
|
9
|
+
const memoKey = memoize?.(c);
|
|
10
|
+
if (memoKey === undefined) {
|
|
11
|
+
return Array.from(c.resolveManyByAlias(predicateFn, { lazy }).values());
|
|
12
|
+
}
|
|
13
|
+
const memo = c.resolve(exports.IMemoKey);
|
|
14
|
+
const memoized = memo.get(memoKey);
|
|
15
|
+
if (memoized) {
|
|
16
|
+
return memoized.map((key) => c.resolve(key, { lazy }));
|
|
17
|
+
}
|
|
18
|
+
const result = c.resolveManyByAlias(predicateFn, { lazy });
|
|
19
|
+
memo.set(memoKey, Array.from(result.keys()));
|
|
20
|
+
return Array.from(result.values());
|
|
21
|
+
};
|
|
22
|
+
exports.byAliases = byAliases;
|
|
23
|
+
const byAlias = (predicate, { memoize, lazy } = {}) => (c) => {
|
|
24
|
+
const predicateFn = (aliases) => predicate(aliases, c);
|
|
25
|
+
const memoKey = memoize?.(c);
|
|
26
|
+
if (memoKey === undefined) {
|
|
27
|
+
return c.resolveOneByAlias(predicateFn, { lazy })[1];
|
|
28
|
+
}
|
|
29
|
+
const memo = c.resolve(exports.IMemoKey);
|
|
30
|
+
const memoized = memo.get(memoKey);
|
|
31
|
+
if (memoized) {
|
|
32
|
+
return c.resolve(memoized[0], { lazy });
|
|
33
|
+
}
|
|
34
|
+
const [key, result] = c.resolveOneByAlias(predicateFn, { lazy });
|
|
35
|
+
memo.set(memoKey, [key]);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
exports.byAlias = byAlias;
|
|
7
39
|
exports.by = {
|
|
8
|
-
aliases: (predicate, { memoize, lazy } = {}) => (c, ...args) => {
|
|
9
|
-
const predicateFn = (aliases) => predicate(aliases, c);
|
|
10
|
-
const memoKey = memoize?.(c);
|
|
11
|
-
if (memoKey === undefined) {
|
|
12
|
-
return Array.from(c.resolveManyByAlias(predicateFn, { args, lazy }).values());
|
|
13
|
-
}
|
|
14
|
-
const memo = c.resolve(exports.IMemoKey);
|
|
15
|
-
const memoized = memo.get(memoKey);
|
|
16
|
-
if (memoized) {
|
|
17
|
-
return memoized.map((key) => c.resolve(key, { args, lazy }));
|
|
18
|
-
}
|
|
19
|
-
const result = c.resolveManyByAlias(predicateFn, { args, lazy });
|
|
20
|
-
memo.set(memoKey, Array.from(result.keys()));
|
|
21
|
-
return Array.from(result.values());
|
|
22
|
-
},
|
|
23
|
-
/**
|
|
24
|
-
* Get the instance that matches the given alias or fail
|
|
25
|
-
* @param predicate
|
|
26
|
-
* @param memoize
|
|
27
|
-
*/
|
|
28
|
-
alias: (predicate, { memoize, lazy } = {}) => (c, ...args) => {
|
|
29
|
-
const predicateFn = (aliases) => predicate(aliases, c);
|
|
30
|
-
const memoKey = memoize?.(c);
|
|
31
|
-
if (memoKey === undefined) {
|
|
32
|
-
return c.resolveOneByAlias(predicateFn, { args, lazy })[1];
|
|
33
|
-
}
|
|
34
|
-
const memo = c.resolve(exports.IMemoKey);
|
|
35
|
-
const memoized = memo.get(memoKey);
|
|
36
|
-
if (memoized) {
|
|
37
|
-
return c.resolve(memoized[0], { args, lazy });
|
|
38
|
-
}
|
|
39
|
-
const [key, result] = c.resolveOneByAlias(predicateFn, { args, lazy });
|
|
40
|
-
memo.set(memoKey, [key]);
|
|
41
|
-
return result;
|
|
42
|
-
},
|
|
43
|
-
/**
|
|
44
|
-
* Get all instances that match the given keys
|
|
45
|
-
* @param keys
|
|
46
|
-
* @param lazy
|
|
47
|
-
*/
|
|
48
40
|
keys: (keys, { lazy } = {}) => (с, ...args) => keys.map((t) => с.resolve(t, { args, lazy })),
|
|
49
|
-
/**
|
|
50
|
-
* Get the instance that matches the given key
|
|
51
|
-
* @param key
|
|
52
|
-
* @param deps
|
|
53
|
-
* @param lazy
|
|
54
|
-
*/
|
|
55
41
|
key: (key, { args: deps = [], lazy } = {}) => (c, ...args) => c.resolve(key, { args: [...deps, ...args], lazy }),
|
|
56
|
-
/**
|
|
57
|
-
* Get all instances that match the given predicate
|
|
58
|
-
* @param predicate
|
|
59
|
-
*/
|
|
60
42
|
instances: (predicate = exports.all) => (l) => l.getInstances().filter(predicate),
|
|
61
43
|
scope: {
|
|
62
|
-
/**
|
|
63
|
-
* Get the current scope
|
|
64
|
-
*/
|
|
65
44
|
current: (container) => container,
|
|
66
|
-
/**
|
|
67
|
-
* Create a new scope with the given tags
|
|
68
|
-
* @param tags
|
|
69
|
-
*/
|
|
70
45
|
create: (...tags) => (l) => l.createScope(...tags),
|
|
71
46
|
},
|
|
72
47
|
};
|
package/cjm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getParameterMetadata = exports.getMethodMetadata = exports.setMethodMetadata = exports.setParameterMetadata = exports.getMetadata = exports.setMetadata = exports.IMemoKey = exports.by = exports.hasHooks = exports.hook = exports.getHooks = exports.ContainerDisposedError = exports.MethodNotImplementedError = exports.DependencyNotFoundError = exports.Registration = exports.register = exports.scope = exports.key = exports.decorate = exports.multiCache = exports.MultiCache = exports.SingletonProvider = exports.singleton = exports.Provider = exports.ProviderDecorator = exports.args = exports.argsFn = exports.alias = exports.visible = exports.provider = exports.ProxyInjector = exports.SimpleInjector = exports.inject = exports.MetadataInjector = exports.AutoMockedContainer = exports.EmptyContainer = exports.Container = exports.isDependencyKey = void 0;
|
|
3
|
+
exports.getParameterMetadata = exports.getMethodMetadata = exports.setMethodMetadata = exports.setParameterMetadata = exports.getMetadata = exports.setMetadata = exports.byAliases = exports.byAlias = exports.IMemoKey = exports.by = exports.hasHooks = exports.hook = exports.getHooks = exports.ContainerDisposedError = exports.MethodNotImplementedError = exports.DependencyNotFoundError = exports.Registration = exports.register = exports.scope = exports.key = exports.decorate = exports.multiCache = exports.MultiCache = exports.SingletonProvider = exports.singleton = exports.Provider = exports.ProviderDecorator = exports.args = exports.argsFn = exports.alias = exports.visible = exports.provider = exports.ProxyInjector = exports.SimpleInjector = exports.inject = exports.MetadataInjector = exports.AutoMockedContainer = exports.EmptyContainer = exports.Container = exports.isDependencyKey = void 0;
|
|
4
4
|
// Containers
|
|
5
5
|
var IContainer_1 = require("./container/IContainer");
|
|
6
6
|
Object.defineProperty(exports, "isDependencyKey", { enumerable: true, get: function () { return IContainer_1.isDependencyKey; } });
|
|
@@ -57,6 +57,8 @@ Object.defineProperty(exports, "hasHooks", { enumerable: true, get: function ()
|
|
|
57
57
|
var by_1 = require("./by");
|
|
58
58
|
Object.defineProperty(exports, "by", { enumerable: true, get: function () { return by_1.by; } });
|
|
59
59
|
Object.defineProperty(exports, "IMemoKey", { enumerable: true, get: function () { return by_1.IMemoKey; } });
|
|
60
|
+
Object.defineProperty(exports, "byAlias", { enumerable: true, get: function () { return by_1.byAlias; } });
|
|
61
|
+
Object.defineProperty(exports, "byAliases", { enumerable: true, get: function () { return by_1.byAliases; } });
|
|
60
62
|
var metadata_1 = require("./metadata");
|
|
61
63
|
Object.defineProperty(exports, "setMetadata", { enumerable: true, get: function () { return metadata_1.setMetadata; } });
|
|
62
64
|
Object.defineProperty(exports, "getMetadata", { enumerable: true, get: function () { return metadata_1.getMetadata; } });
|
package/esm/by.js
CHANGED
|
@@ -1,68 +1,41 @@
|
|
|
1
1
|
export const all = () => true;
|
|
2
2
|
export const IMemoKey = Symbol('IMemo');
|
|
3
|
+
export const byAliases = (predicate, { memoize, lazy } = {}) => (c) => {
|
|
4
|
+
const predicateFn = (aliases) => predicate(aliases, c);
|
|
5
|
+
const memoKey = memoize?.(c);
|
|
6
|
+
if (memoKey === undefined) {
|
|
7
|
+
return Array.from(c.resolveManyByAlias(predicateFn, { lazy }).values());
|
|
8
|
+
}
|
|
9
|
+
const memo = c.resolve(IMemoKey);
|
|
10
|
+
const memoized = memo.get(memoKey);
|
|
11
|
+
if (memoized) {
|
|
12
|
+
return memoized.map((key) => c.resolve(key, { lazy }));
|
|
13
|
+
}
|
|
14
|
+
const result = c.resolveManyByAlias(predicateFn, { lazy });
|
|
15
|
+
memo.set(memoKey, Array.from(result.keys()));
|
|
16
|
+
return Array.from(result.values());
|
|
17
|
+
};
|
|
18
|
+
export const byAlias = (predicate, { memoize, lazy } = {}) => (c) => {
|
|
19
|
+
const predicateFn = (aliases) => predicate(aliases, c);
|
|
20
|
+
const memoKey = memoize?.(c);
|
|
21
|
+
if (memoKey === undefined) {
|
|
22
|
+
return c.resolveOneByAlias(predicateFn, { lazy })[1];
|
|
23
|
+
}
|
|
24
|
+
const memo = c.resolve(IMemoKey);
|
|
25
|
+
const memoized = memo.get(memoKey);
|
|
26
|
+
if (memoized) {
|
|
27
|
+
return c.resolve(memoized[0], { lazy });
|
|
28
|
+
}
|
|
29
|
+
const [key, result] = c.resolveOneByAlias(predicateFn, { lazy });
|
|
30
|
+
memo.set(memoKey, [key]);
|
|
31
|
+
return result;
|
|
32
|
+
};
|
|
3
33
|
export const by = {
|
|
4
|
-
aliases: (predicate, { memoize, lazy } = {}) => (c, ...args) => {
|
|
5
|
-
const predicateFn = (aliases) => predicate(aliases, c);
|
|
6
|
-
const memoKey = memoize?.(c);
|
|
7
|
-
if (memoKey === undefined) {
|
|
8
|
-
return Array.from(c.resolveManyByAlias(predicateFn, { args, lazy }).values());
|
|
9
|
-
}
|
|
10
|
-
const memo = c.resolve(IMemoKey);
|
|
11
|
-
const memoized = memo.get(memoKey);
|
|
12
|
-
if (memoized) {
|
|
13
|
-
return memoized.map((key) => c.resolve(key, { args, lazy }));
|
|
14
|
-
}
|
|
15
|
-
const result = c.resolveManyByAlias(predicateFn, { args, lazy });
|
|
16
|
-
memo.set(memoKey, Array.from(result.keys()));
|
|
17
|
-
return Array.from(result.values());
|
|
18
|
-
},
|
|
19
|
-
/**
|
|
20
|
-
* Get the instance that matches the given alias or fail
|
|
21
|
-
* @param predicate
|
|
22
|
-
* @param memoize
|
|
23
|
-
*/
|
|
24
|
-
alias: (predicate, { memoize, lazy } = {}) => (c, ...args) => {
|
|
25
|
-
const predicateFn = (aliases) => predicate(aliases, c);
|
|
26
|
-
const memoKey = memoize?.(c);
|
|
27
|
-
if (memoKey === undefined) {
|
|
28
|
-
return c.resolveOneByAlias(predicateFn, { args, lazy })[1];
|
|
29
|
-
}
|
|
30
|
-
const memo = c.resolve(IMemoKey);
|
|
31
|
-
const memoized = memo.get(memoKey);
|
|
32
|
-
if (memoized) {
|
|
33
|
-
return c.resolve(memoized[0], { args, lazy });
|
|
34
|
-
}
|
|
35
|
-
const [key, result] = c.resolveOneByAlias(predicateFn, { args, lazy });
|
|
36
|
-
memo.set(memoKey, [key]);
|
|
37
|
-
return result;
|
|
38
|
-
},
|
|
39
|
-
/**
|
|
40
|
-
* Get all instances that match the given keys
|
|
41
|
-
* @param keys
|
|
42
|
-
* @param lazy
|
|
43
|
-
*/
|
|
44
34
|
keys: (keys, { lazy } = {}) => (с, ...args) => keys.map((t) => с.resolve(t, { args, lazy })),
|
|
45
|
-
/**
|
|
46
|
-
* Get the instance that matches the given key
|
|
47
|
-
* @param key
|
|
48
|
-
* @param deps
|
|
49
|
-
* @param lazy
|
|
50
|
-
*/
|
|
51
35
|
key: (key, { args: deps = [], lazy } = {}) => (c, ...args) => c.resolve(key, { args: [...deps, ...args], lazy }),
|
|
52
|
-
/**
|
|
53
|
-
* Get all instances that match the given predicate
|
|
54
|
-
* @param predicate
|
|
55
|
-
*/
|
|
56
36
|
instances: (predicate = all) => (l) => l.getInstances().filter(predicate),
|
|
57
37
|
scope: {
|
|
58
|
-
/**
|
|
59
|
-
* Get the current scope
|
|
60
|
-
*/
|
|
61
38
|
current: (container) => container,
|
|
62
|
-
/**
|
|
63
|
-
* Create a new scope with the given tags
|
|
64
|
-
* @param tags
|
|
65
|
-
*/
|
|
66
39
|
create: (...tags) => (l) => l.createScope(...tags),
|
|
67
40
|
},
|
|
68
41
|
};
|
package/esm/index.js
CHANGED
|
@@ -21,5 +21,5 @@ export { MethodNotImplementedError } from './errors/MethodNotImplementedError';
|
|
|
21
21
|
export { ContainerDisposedError } from './errors/ContainerDisposedError';
|
|
22
22
|
// Others
|
|
23
23
|
export { getHooks, hook, hasHooks } from './hook';
|
|
24
|
-
export { by, IMemoKey } from './by';
|
|
24
|
+
export { by, IMemoKey, byAlias, byAliases } from './by';
|
|
25
25
|
export { setMetadata, getMetadata, setParameterMetadata, setMethodMetadata, getMethodMetadata, getParameterMetadata, } from './metadata';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-ioc-container",
|
|
3
|
-
"version": "32.0.
|
|
3
|
+
"version": "32.0.4",
|
|
4
4
|
"description": "Typescript IoC container",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"ts-node": "^10.9.1",
|
|
60
60
|
"typescript": "5.4.3"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "7ce3cbc445034c3408afa7b467bdd64810e5bb92"
|
|
63
63
|
}
|
package/typings/by.d.ts
CHANGED
|
@@ -1,53 +1,27 @@
|
|
|
1
1
|
import { DependencyKey, IContainer, InjectionToken } from './container/IContainer';
|
|
2
2
|
import { ProviderResolveOptions } from './provider/IProvider';
|
|
3
|
+
import { InjectFn } from './injector/MetadataInjector';
|
|
3
4
|
export type InstancePredicate = (dep: unknown) => boolean;
|
|
4
5
|
export declare const all: InstancePredicate;
|
|
5
6
|
export type IMemo = Map<string, DependencyKey[]>;
|
|
6
7
|
export declare const IMemoKey: unique symbol;
|
|
8
|
+
type AliasOptions = {
|
|
9
|
+
memoize?: (c: IContainer) => string;
|
|
10
|
+
lazy?: boolean;
|
|
11
|
+
};
|
|
12
|
+
type AliasPredicate = (aliases: Set<string>, container: IContainer) => boolean;
|
|
13
|
+
export declare const byAliases: (predicate: AliasPredicate, { memoize, lazy }?: AliasOptions) => InjectFn<unknown[]>;
|
|
14
|
+
export declare const byAlias: (predicate: AliasPredicate, { memoize, lazy }?: AliasOptions) => InjectFn;
|
|
7
15
|
export declare const by: {
|
|
8
|
-
aliases: (predicate: (it: Set<string>, s: IContainer) => boolean, { memoize, lazy }?: {
|
|
9
|
-
memoize?: ((c: IContainer) => string) | undefined;
|
|
10
|
-
lazy?: boolean | undefined;
|
|
11
|
-
}) => (c: IContainer, ...args: unknown[]) => unknown[];
|
|
12
|
-
/**
|
|
13
|
-
* Get the instance that matches the given alias or fail
|
|
14
|
-
* @param predicate
|
|
15
|
-
* @param memoize
|
|
16
|
-
*/
|
|
17
|
-
alias: (predicate: (it: Set<string>, s: IContainer) => boolean, { memoize, lazy }?: {
|
|
18
|
-
memoize?: ((c: IContainer) => string) | undefined;
|
|
19
|
-
lazy?: boolean | undefined;
|
|
20
|
-
}) => (c: IContainer, ...args: unknown[]) => unknown;
|
|
21
|
-
/**
|
|
22
|
-
* Get all instances that match the given keys
|
|
23
|
-
* @param keys
|
|
24
|
-
* @param lazy
|
|
25
|
-
*/
|
|
26
16
|
keys: (keys: InjectionToken[], { lazy }?: Pick<ProviderResolveOptions, 'lazy'>) => (с: IContainer, ...args: unknown[]) => unknown[];
|
|
27
|
-
/**
|
|
28
|
-
* Get the instance that matches the given key
|
|
29
|
-
* @param key
|
|
30
|
-
* @param deps
|
|
31
|
-
* @param lazy
|
|
32
|
-
*/
|
|
33
17
|
key: <T>(key: InjectionToken<T>, { args: deps, lazy }?: {
|
|
34
18
|
args?: unknown[] | undefined;
|
|
35
19
|
lazy?: boolean | undefined;
|
|
36
20
|
}) => (c: IContainer, ...args: unknown[]) => T;
|
|
37
|
-
/**
|
|
38
|
-
* Get all instances that match the given predicate
|
|
39
|
-
* @param predicate
|
|
40
|
-
*/
|
|
41
21
|
instances: (predicate?: InstancePredicate) => (l: IContainer) => unknown[];
|
|
42
22
|
scope: {
|
|
43
|
-
/**
|
|
44
|
-
* Get the current scope
|
|
45
|
-
*/
|
|
46
23
|
current: (container: IContainer) => IContainer;
|
|
47
|
-
/**
|
|
48
|
-
* Create a new scope with the given tags
|
|
49
|
-
* @param tags
|
|
50
|
-
*/
|
|
51
24
|
create: (...tags: string[]) => (l: IContainer) => IContainer;
|
|
52
25
|
};
|
|
53
26
|
};
|
|
27
|
+
export {};
|
package/typings/index.d.ts
CHANGED
|
@@ -18,6 +18,6 @@ export { DependencyNotFoundError } from './errors/DependencyNotFoundError';
|
|
|
18
18
|
export { MethodNotImplementedError } from './errors/MethodNotImplementedError';
|
|
19
19
|
export { ContainerDisposedError } from './errors/ContainerDisposedError';
|
|
20
20
|
export { getHooks, hook, hasHooks } from './hook';
|
|
21
|
-
export { by, InstancePredicate, IMemo, IMemoKey } from './by';
|
|
21
|
+
export { by, InstancePredicate, IMemo, IMemoKey, byAlias, byAliases } from './by';
|
|
22
22
|
export { constructor } from './utils';
|
|
23
23
|
export { setMetadata, getMetadata, setParameterMetadata, setMethodMetadata, getMethodMetadata, getParameterMetadata, } from './metadata';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { IInjector, InjectOptions } from './IInjector';
|
|
2
2
|
import { IContainer } from '../container/IContainer';
|
|
3
3
|
import { constructor } from '../utils';
|
|
4
|
-
type InjectFn<T = unknown> = (l: IContainer
|
|
4
|
+
export type InjectFn<T = unknown> = (l: IContainer) => T;
|
|
5
5
|
export declare const inject: (fn: InjectFn) => ParameterDecorator;
|
|
6
6
|
export declare class MetadataInjector implements IInjector {
|
|
7
7
|
resolve<T>(container: IContainer, Target: constructor<T>, { args: deps }: InjectOptions): T;
|
|
8
8
|
}
|
|
9
|
-
export {};
|