ts-ioc-container 69.0.0 → 69.2.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/cjm/index.js +4 -2
- package/cjm/token/ClassToken.js +3 -0
- package/cjm/token/ConstantToken.js +3 -0
- package/cjm/token/FunctionToken.js +4 -0
- package/cjm/token/GroupAliasToken.js +3 -0
- package/cjm/token/GroupInstanceToken.js +3 -0
- package/cjm/token/SingleAliasToken.js +3 -0
- package/cjm/token/SingleToken.js +3 -0
- package/esm/index.js +1 -1
- package/esm/token/ClassToken.js +3 -0
- package/esm/token/ConstantToken.js +3 -0
- package/esm/token/FunctionToken.js +4 -0
- package/esm/token/GroupAliasToken.js +3 -0
- package/esm/token/GroupInstanceToken.js +3 -0
- package/esm/token/SingleAliasToken.js +3 -0
- package/esm/token/SingleToken.js +3 -0
- package/package.json +1 -1
- package/typings/index.d.ts +1 -1
- package/typings/token/ClassToken.d.ts +1 -0
- package/typings/token/ConstantToken.d.ts +3 -1
- package/typings/token/FunctionToken.d.ts +3 -1
- package/typings/token/GroupAliasToken.d.ts +1 -0
- package/typings/token/GroupInstanceToken.d.ts +3 -2
- package/typings/token/InjectionToken.d.ts +3 -1
- package/typings/token/SingleAliasToken.d.ts +1 -0
- package/typings/token/SingleToken.d.ts +1 -0
package/cjm/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.injectProp = exports.createHookExecutionContext = exports.createHookContextFactory = exports.HookContext = exports.toHookFn = exports.hasHooks = exports.hook = exports.getHooks = exports.ArgumentNotFoundError = exports.TypedEventDisposedError = exports.UnsupportedTokenTypeError = exports.CannonSingletonApplyTwiceError = exports.ProviderDisposedError = exports.ContainerDisposedError = exports.MethodNotImplementedError = exports.DependencyMissingKeyError = exports.ContainerNotFoundError = exports.DependencyNotFoundError = exports.ContainerError = exports.Registration = exports.onResolve = exports.appendArgsFn = exports.appendArgs = exports.decorate = exports.singleton = exports.autoResolve = exports.lazy = exports.scopeAccess = exports.scope = exports.bindTo = exports.register = exports.toRegistrationFn = exports.toProviderFn = exports.toBindToken = exports.registerPipe = exports.isProviderPipe = exports.Provider = exports.ProxyInjector = exports.SimpleInjector = exports.resolveArgs = exports.argsFn = exports.args = exports.arg = exports.inject = exports.MetadataInjector = exports.Injector = exports.EmptyContainer = exports.AutoResolveModule = exports.Container = exports.isDependencyKey = void 0;
|
|
4
|
-
exports.
|
|
5
|
-
exports.Is = exports.unwrapProxy = exports.ProxyRegistry = exports.findOrFail = void 0;
|
|
4
|
+
exports.TypedEvent = exports.getConstructorChain = exports.memoize = exports.once = exports.shallowCache = exports.debounce = exports.throttle = exports.runAtOnce = exports.runInOrder = exports.handleAsyncError = exports.handleError = exports.getMethodTags = exports.addMethodTag = exports.getMethodLabels = exports.addMethodLabel = exports.getMethodMeta = exports.addMethodMeta = exports.getParamTags = exports.addParamTag = exports.getParamLabels = exports.addParamLabel = exports.getParamMeta = exports.addParamMeta = exports.getClassTags = exports.addClassTag = exports.getClassLabels = exports.addClassLabel = exports.getClassMeta = exports.addClassMeta = exports.resolveConstructor = exports.GroupInstanceToken = exports.ConstantToken = exports.FunctionToken = exports.SingleToken = exports.ClassToken = exports.toSingleAlias = exports.SingleAliasToken = exports.toGroupAlias = exports.GroupAliasToken = exports.argToToken = exports.toMappedToken = exports.toToken = exports.forwardArgs = exports.isInjectionToken = exports.InjectionToken = exports.toTask = exports.HookCollector = exports.oncePerInstance = exports.parallel = exports.sequential = void 0;
|
|
5
|
+
exports.Is = exports.unwrapProxy = exports.ProxyRegistry = exports.findOrFail = exports.pipe = exports.select = void 0;
|
|
6
6
|
var IContainer_1 = require("./container/IContainer");
|
|
7
7
|
Object.defineProperty(exports, "isDependencyKey", { enumerable: true, get: function () { return IContainer_1.isDependencyKey; } });
|
|
8
8
|
var Container_1 = require("./container/Container");
|
|
@@ -87,6 +87,8 @@ Object.defineProperty(exports, "HookCollector", { enumerable: true, get: functio
|
|
|
87
87
|
Object.defineProperty(exports, "toTask", { enumerable: true, get: function () { return HookCollector_1.toTask; } });
|
|
88
88
|
var InjectionToken_1 = require("./token/InjectionToken");
|
|
89
89
|
Object.defineProperty(exports, "InjectionToken", { enumerable: true, get: function () { return InjectionToken_1.InjectionToken; } });
|
|
90
|
+
Object.defineProperty(exports, "isInjectionToken", { enumerable: true, get: function () { return InjectionToken_1.isInjectionToken; } });
|
|
91
|
+
Object.defineProperty(exports, "forwardArgs", { enumerable: true, get: function () { return InjectionToken_1.forwardArgs; } });
|
|
90
92
|
var toToken_1 = require("./token/toToken");
|
|
91
93
|
Object.defineProperty(exports, "toToken", { enumerable: true, get: function () { return toToken_1.toToken; } });
|
|
92
94
|
Object.defineProperty(exports, "toMappedToken", { enumerable: true, get: function () { return toToken_1.toMappedToken; } });
|
package/cjm/token/ClassToken.js
CHANGED
|
@@ -21,5 +21,8 @@ class ConstantToken extends InjectionToken_1.InjectionToken {
|
|
|
21
21
|
lazy() {
|
|
22
22
|
throw new MethodNotImplementedError_1.MethodNotImplementedError('not implemented');
|
|
23
23
|
}
|
|
24
|
+
getKey() {
|
|
25
|
+
throw new MethodNotImplementedError_1.MethodNotImplementedError('not implemented');
|
|
26
|
+
}
|
|
24
27
|
}
|
|
25
28
|
exports.ConstantToken = ConstantToken;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FunctionToken = void 0;
|
|
4
4
|
const InjectionToken_1 = require("./InjectionToken");
|
|
5
|
+
const MethodNotImplementedError_1 = require("../errors/MethodNotImplementedError");
|
|
5
6
|
class FunctionToken extends InjectionToken_1.InjectionToken {
|
|
6
7
|
fn;
|
|
7
8
|
_getArgsFn;
|
|
@@ -38,5 +39,8 @@ class FunctionToken extends InjectionToken_1.InjectionToken {
|
|
|
38
39
|
isLazy: true,
|
|
39
40
|
});
|
|
40
41
|
}
|
|
42
|
+
getKey() {
|
|
43
|
+
throw new MethodNotImplementedError_1.MethodNotImplementedError('not implemented');
|
|
44
|
+
}
|
|
41
45
|
}
|
|
42
46
|
exports.FunctionToken = FunctionToken;
|
|
@@ -29,5 +29,8 @@ class GroupInstanceToken extends InjectionToken_1.InjectionToken {
|
|
|
29
29
|
resolve(c) {
|
|
30
30
|
return c.getInstances(this.isCascade).filter(this.predicate);
|
|
31
31
|
}
|
|
32
|
+
getKey() {
|
|
33
|
+
throw new MethodNotImplementedError_1.MethodNotImplementedError('not implemented');
|
|
34
|
+
}
|
|
32
35
|
}
|
|
33
36
|
exports.GroupInstanceToken = GroupInstanceToken;
|
package/cjm/token/SingleToken.js
CHANGED
package/esm/index.js
CHANGED
|
@@ -25,7 +25,7 @@ export { HookContext, createHookContextFactory, createHookExecutionContext, } fr
|
|
|
25
25
|
export { injectProp } from './hooks/injectProp.js';
|
|
26
26
|
export { sequential, parallel, oncePerInstance } from './hooks/combinators.js';
|
|
27
27
|
export { HookCollector, toTask, } from './hooks/HookCollector.js';
|
|
28
|
-
export { InjectionToken } from './token/InjectionToken.js';
|
|
28
|
+
export { InjectionToken, isInjectionToken, forwardArgs } from './token/InjectionToken.js';
|
|
29
29
|
export { toToken, toMappedToken, argToToken } from './token/toToken.js';
|
|
30
30
|
export { GroupAliasToken, toGroupAlias } from './token/GroupAliasToken.js';
|
|
31
31
|
export { SingleAliasToken, toSingleAlias } from './token/SingleAliasToken.js';
|
package/esm/token/ClassToken.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { forwardArgs, InjectionToken } from './InjectionToken.js';
|
|
2
|
+
import { MethodNotImplementedError } from '../errors/MethodNotImplementedError.js';
|
|
2
3
|
export class FunctionToken extends InjectionToken {
|
|
3
4
|
fn;
|
|
4
5
|
_getArgsFn;
|
|
@@ -35,4 +36,7 @@ export class FunctionToken extends InjectionToken {
|
|
|
35
36
|
isLazy: true,
|
|
36
37
|
});
|
|
37
38
|
}
|
|
39
|
+
getKey() {
|
|
40
|
+
throw new MethodNotImplementedError('not implemented');
|
|
41
|
+
}
|
|
38
42
|
}
|
package/esm/token/SingleToken.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-ioc-container",
|
|
3
|
-
"version": "69.
|
|
3
|
+
"version": "69.2.0",
|
|
4
4
|
"description": "Fast, lightweight TypeScript dependency injection container with a clean API, scoped lifecycles, decorators, tokens, hooks, lazy injection, customizable providers, and no global container objects.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
package/typings/index.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export { HookContext, createHookContextFactory, createHookExecutionContext, type
|
|
|
26
26
|
export { injectProp } from './hooks/injectProp.js';
|
|
27
27
|
export { sequential, parallel, oncePerInstance, type ResolvedObjectHook } from './hooks/combinators.js';
|
|
28
28
|
export { HookCollector, toTask, type HookAction, type HookCollectionContext, type HookCollectorOptions, type HookCollectorProps, type MapHookExecutionContext, } from './hooks/HookCollector.js';
|
|
29
|
-
export { InjectionToken } from './token/InjectionToken.js';
|
|
29
|
+
export { InjectionToken, isInjectionToken, forwardArgs } from './token/InjectionToken.js';
|
|
30
30
|
export { type Injectable, toToken, toMappedToken, argToToken } from './token/toToken.js';
|
|
31
31
|
export { GroupAliasToken, toGroupAlias } from './token/GroupAliasToken.js';
|
|
32
32
|
export { SingleAliasToken, toSingleAlias } from './token/SingleAliasToken.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { IContainer } from '../container/IContainer.js';
|
|
1
|
+
import type { DependencyKey, IContainer } from '../container/IContainer.js';
|
|
2
2
|
import { InjectionToken } from './InjectionToken.js';
|
|
3
|
+
import { type constructor } from '../utils/basic.js';
|
|
3
4
|
export declare class ConstantToken<T = any> extends InjectionToken<T> {
|
|
4
5
|
private readonly token;
|
|
5
6
|
constructor(token: T);
|
|
@@ -7,4 +8,5 @@ export declare class ConstantToken<T = any> extends InjectionToken<T> {
|
|
|
7
8
|
args(...deps: unknown[]): InjectionToken<T>;
|
|
8
9
|
argsFn(getArgsFn: (s: IContainer) => unknown[]): InjectionToken<T>;
|
|
9
10
|
lazy(): InjectionToken<T>;
|
|
11
|
+
getKey(): DependencyKey | constructor<T>;
|
|
10
12
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { IContainer } from '../container/IContainer.js';
|
|
1
|
+
import type { DependencyKey, IContainer } from '../container/IContainer.js';
|
|
2
2
|
import { InjectionToken } from './InjectionToken.js';
|
|
3
3
|
import { InjectFn } from '../hooks/hook.js';
|
|
4
4
|
import { ArgsFn, ProviderOptions } from '../provider/IProvider.js';
|
|
5
|
+
import { type constructor } from '../utils/basic.js';
|
|
5
6
|
export declare class FunctionToken<T = any> extends InjectionToken<T> {
|
|
6
7
|
private readonly fn;
|
|
7
8
|
private readonly _getArgsFn;
|
|
@@ -14,4 +15,5 @@ export declare class FunctionToken<T = any> extends InjectionToken<T> {
|
|
|
14
15
|
args(...newArgs: unknown[]): InjectionToken<T>;
|
|
15
16
|
argsFn(fn: (s: IContainer) => unknown[]): InjectionToken<T>;
|
|
16
17
|
lazy(): InjectionToken<T>;
|
|
18
|
+
getKey(): DependencyKey | constructor<T>;
|
|
17
19
|
}
|
|
@@ -17,5 +17,6 @@ export declare class GroupAliasToken<T = any> extends InjectionToken<T[]> implem
|
|
|
17
17
|
args(...newArgs: unknown[]): GroupAliasToken<T>;
|
|
18
18
|
argsFn(fn: (s: IContainer) => unknown[]): GroupAliasToken<T>;
|
|
19
19
|
lazy(): GroupAliasToken<T>;
|
|
20
|
+
getKey(): DependencyKey;
|
|
20
21
|
}
|
|
21
22
|
export declare const toGroupAlias: <T>(token: DependencyKey) => GroupAliasToken<T>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InjectionToken } from './InjectionToken.js';
|
|
2
|
-
import type { IContainer } from '../container/IContainer.js';
|
|
3
|
-
import { Instance } from '../utils/basic.js';
|
|
2
|
+
import type { DependencyKey, IContainer } from '../container/IContainer.js';
|
|
3
|
+
import { type constructor, Instance } from '../utils/basic.js';
|
|
4
4
|
export type InstancePredicate = (dep: unknown) => boolean;
|
|
5
5
|
export declare class GroupInstanceToken extends InjectionToken<Instance[]> {
|
|
6
6
|
private predicate;
|
|
@@ -12,4 +12,5 @@ export declare class GroupInstanceToken extends InjectionToken<Instance[]> {
|
|
|
12
12
|
lazy(): InjectionToken<Instance[]>;
|
|
13
13
|
cascade(isTrue: boolean): this;
|
|
14
14
|
resolve(c: IContainer): Instance[];
|
|
15
|
+
getKey(): DependencyKey | constructor<Instance[]>;
|
|
15
16
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { type IContainer } from '../container/IContainer.js';
|
|
1
|
+
import { type DependencyKey, type IContainer } from '../container/IContainer.js';
|
|
2
2
|
import { ArgsFn, ProviderOptions } from '../provider/IProvider.js';
|
|
3
|
+
import { type constructor } from '../utils/basic.js';
|
|
3
4
|
export declare const forwardArgs: ArgsFn;
|
|
4
5
|
export declare abstract class InjectionToken<T = any> {
|
|
5
6
|
abstract resolve(s: IContainer, options?: ProviderOptions): T;
|
|
6
7
|
abstract args(...deps: unknown[]): InjectionToken<T>;
|
|
7
8
|
abstract argsFn(getArgsFn: (s: IContainer) => unknown[]): InjectionToken<T>;
|
|
8
9
|
abstract lazy(): InjectionToken<T>;
|
|
10
|
+
abstract getKey(): DependencyKey | constructor<T>;
|
|
9
11
|
}
|
|
10
12
|
export declare function isInjectionToken(target: unknown): target is InjectionToken;
|
|
@@ -17,5 +17,6 @@ export declare class SingleAliasToken<T = any> extends InjectionToken<T> impleme
|
|
|
17
17
|
args(...newArgs: unknown[]): SingleAliasToken<T>;
|
|
18
18
|
argsFn(fn: (s: IContainer) => unknown[]): SingleAliasToken<T>;
|
|
19
19
|
lazy(): SingleAliasToken<T>;
|
|
20
|
+
getKey(): DependencyKey;
|
|
20
21
|
}
|
|
21
22
|
export declare const toSingleAlias: <T>(token: DependencyKey) => SingleAliasToken<T>;
|