@spinajs/di 2.0.180 → 2.0.182
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/cjs/array.d.ts +10 -10
- package/lib/cjs/array.js +13 -13
- package/lib/cjs/binder.d.ts +39 -39
- package/lib/cjs/binder.js +96 -96
- package/lib/cjs/container-cache.d.ts +17 -17
- package/lib/cjs/container-cache.js +63 -63
- package/lib/cjs/container.d.ts +133 -133
- package/lib/cjs/container.js +466 -466
- package/lib/cjs/container.js.map +1 -1
- package/lib/cjs/decorators.d.ts +141 -141
- package/lib/cjs/decorators.js +303 -303
- package/lib/cjs/enums.d.ts +31 -31
- package/lib/cjs/enums.js +35 -35
- package/lib/cjs/enums.js.map +1 -1
- package/lib/cjs/exceptions.d.ts +17 -17
- package/lib/cjs/exceptions.js +25 -25
- package/lib/cjs/helpers.d.ts +35 -35
- package/lib/cjs/helpers.js +86 -86
- package/lib/cjs/index.d.ts +12 -12
- package/lib/cjs/index.js +41 -41
- package/lib/cjs/interfaces.d.ts +172 -172
- package/lib/cjs/interfaces.js +53 -53
- package/lib/cjs/registry.d.ts +14 -14
- package/lib/cjs/registry.js +80 -80
- package/lib/cjs/root.d.ts +108 -108
- package/lib/cjs/root.js +216 -217
- package/lib/cjs/root.js.map +1 -1
- package/lib/cjs/types.d.ts +13 -13
- package/lib/cjs/types.js +2 -2
- package/lib/mjs/array.d.ts +10 -10
- package/lib/mjs/array.js +9 -9
- package/lib/mjs/binder.d.ts +39 -39
- package/lib/mjs/binder.js +92 -92
- package/lib/mjs/container-cache.d.ts +17 -17
- package/lib/mjs/container-cache.js +59 -59
- package/lib/mjs/container.d.ts +133 -133
- package/lib/mjs/container.js +459 -459
- package/lib/mjs/container.js.map +1 -1
- package/lib/mjs/decorators.d.ts +141 -141
- package/lib/mjs/decorators.js +266 -266
- package/lib/mjs/enums.d.ts +31 -31
- package/lib/mjs/enums.js +32 -32
- package/lib/mjs/enums.js.map +1 -1
- package/lib/mjs/exceptions.d.ts +17 -17
- package/lib/mjs/exceptions.js +19 -19
- package/lib/mjs/helpers.d.ts +35 -35
- package/lib/mjs/helpers.js +72 -72
- package/lib/mjs/index.d.ts +12 -12
- package/lib/mjs/index.js +12 -12
- package/lib/mjs/interfaces.d.ts +172 -172
- package/lib/mjs/interfaces.js +45 -45
- package/lib/mjs/registry.d.ts +14 -14
- package/lib/mjs/registry.js +76 -76
- package/lib/mjs/root.d.ts +108 -108
- package/lib/mjs/root.js +159 -159
- package/lib/mjs/types.d.ts +13 -13
- package/lib/mjs/types.js +1 -1
- package/lib/tsconfig.cjs.tsbuildinfo +1 -1
- package/lib/tsconfig.mjs.tsbuildinfo +1 -1
- package/package.json +2 -2
package/lib/cjs/root.d.ts
CHANGED
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
import { IBind, IContainer, AsyncService, ResolvableObject } from './interfaces.js';
|
|
2
|
-
import { Class, Factory } from './types.js';
|
|
3
|
-
import { TypedArray } from './array.js';
|
|
4
|
-
/**
|
|
5
|
-
* App main DI container
|
|
6
|
-
*/
|
|
7
|
-
export declare const RootContainer: IContainer;
|
|
8
|
-
/***
|
|
9
|
-
* EVENT LISTENER STUFF
|
|
10
|
-
*
|
|
11
|
-
* Allows to use event listener stuff on root container
|
|
12
|
-
*/
|
|
13
|
-
export declare function setESMModuleSupport(): void;
|
|
14
|
-
export declare function on(event: string, listener: (...args: unknown[]) => void): IContainer;
|
|
15
|
-
export declare function addListener(event: string | symbol, listener: (...args: unknown[]) => void): IContainer;
|
|
16
|
-
export declare function once(event: string | symbol, listener: (...args: unknown[]) => void): IContainer;
|
|
17
|
-
export declare function removeListener(event: string | symbol, listener: (...args: unknown[]) => void): IContainer;
|
|
18
|
-
export declare function off(event: string | symbol, listener: (...args: unknown[]) => void): IContainer;
|
|
19
|
-
export declare function removeAllListeners(event?: string | symbol): IContainer;
|
|
20
|
-
export declare function setMaxListeners(n: number): IContainer;
|
|
21
|
-
export declare function getMaxListeners(): number;
|
|
22
|
-
export declare function listeners(event: string | symbol): Function[];
|
|
23
|
-
export declare function rawListeners(event: string | symbol): Function[];
|
|
24
|
-
export declare function emit(event: string | symbol, ...args: unknown[]): boolean;
|
|
25
|
-
export declare function listenerCount(type: string | symbol): number;
|
|
26
|
-
export declare function prependListener(event: string | symbol, listener: (...args: unknown[]) => void): IContainer;
|
|
27
|
-
export declare function prependOnceListener(event: string | symbol, listener: (...args: unknown[]) => void): IContainer;
|
|
28
|
-
export declare function eventNames(): (string | symbol)[];
|
|
29
|
-
/**
|
|
30
|
-
* ===========================================================================
|
|
31
|
-
*/
|
|
32
|
-
/**
|
|
33
|
-
* Clears root container registry and cache.
|
|
34
|
-
*/
|
|
35
|
-
export declare function clear(): void;
|
|
36
|
-
/**
|
|
37
|
-
* Clears out root registry ( registered types in root container )
|
|
38
|
-
*/
|
|
39
|
-
export declare function clearRegistry(): void;
|
|
40
|
-
/**
|
|
41
|
-
* Cleart ous root cache ( all resolved types )
|
|
42
|
-
*/
|
|
43
|
-
export declare function clearCache(): void;
|
|
44
|
-
export declare function dispose(): Promise<void>;
|
|
45
|
-
/**
|
|
46
|
-
* Register class/interface to DI root container. If
|
|
47
|
-
* @param type - interface object to register
|
|
48
|
-
* @throws {@link InvalidArgument} if type is null or undefined
|
|
49
|
-
*/
|
|
50
|
-
export declare function register<T>(type: Class<T> | Factory<T> | ResolvableObject): IBind;
|
|
51
|
-
export declare function unregister<T>(type: string | Class<T> | Factory<T> | ResolvableObject): void;
|
|
52
|
-
export declare function uncache<T>(type: string | Class<T> | TypedArray<T>, parent?: boolean): void;
|
|
53
|
-
/**
|
|
54
|
-
* Resolves specified type from root container.
|
|
55
|
-
*
|
|
56
|
-
* @param type - class to resolve
|
|
57
|
-
* @param options - optional parameters passed to class constructor
|
|
58
|
-
* @param check - use parent container to check when resolving
|
|
59
|
-
* @throws {@link InvalidArgument} if type is null or undefined
|
|
60
|
-
*/
|
|
61
|
-
export declare function resolve<T>(type: string, options?: unknown[], check?: boolean): T;
|
|
62
|
-
export declare function resolve<T>(type: string, check?: boolean): T;
|
|
63
|
-
export declare function resolve<T>(type: Class<T>, check?: boolean): T extends AsyncService ? Promise<T> : T;
|
|
64
|
-
export declare function resolve<T>(type: TypedArray<T>, check?: boolean): T extends AsyncService ? Promise<T[]> : T[];
|
|
65
|
-
export declare function resolve<T>(type: Class<T>, options?: unknown[] | boolean, check?: boolean): T extends AsyncService ? Promise<T> : T;
|
|
66
|
-
export declare function resolve<T>(type: TypedArray<T>, options?: unknown[] | boolean, check?: boolean): T extends AsyncService ? Promise<T[]> : T[];
|
|
67
|
-
/**
|
|
68
|
-
* Gets already resolved service from root container.
|
|
69
|
-
*
|
|
70
|
-
* @param serviceName - name of service to get
|
|
71
|
-
*/
|
|
72
|
-
export declare function get<T>(serviceName: TypedArray<T>): T[] | null;
|
|
73
|
-
export declare function get<T>(serviceName: string | Class<T>): T | null;
|
|
74
|
-
/**
|
|
75
|
-
*
|
|
76
|
-
* Returns list of types registered at given type, eg. all types/services registered under BaseService
|
|
77
|
-
*
|
|
78
|
-
* @param type - base type to check
|
|
79
|
-
*/
|
|
80
|
-
export declare function getRegisteredTypes<T>(type: string | Class<T>): Class<T>[];
|
|
81
|
-
/**
|
|
82
|
-
* Checks if service is already resolved and exists in container cache.
|
|
83
|
-
* NOTE: check is only valid for classes that are singletons.
|
|
84
|
-
*
|
|
85
|
-
* @param service - service name or class to check
|
|
86
|
-
*/
|
|
87
|
-
export declare function has<T>(service: string | Class<T>): boolean;
|
|
88
|
-
/**
|
|
89
|
-
* Checks if service is registered in container.
|
|
90
|
-
*
|
|
91
|
-
* @param service - service class object to check
|
|
92
|
-
*/
|
|
93
|
-
export declare function check<T>(service: Class<T> | string): boolean;
|
|
94
|
-
/**
|
|
95
|
-
* Checks if specific service is registered in container.
|
|
96
|
-
* Eg. we can have multiple drivers registered for queue connections with different protocol implementations
|
|
97
|
-
* and we want to check if specific driver is registered
|
|
98
|
-
*
|
|
99
|
-
* @param source - source class to check ( eg. base class )
|
|
100
|
-
* @param type - specific type to check eg. base class implementation
|
|
101
|
-
*/
|
|
102
|
-
export declare function checkType<T>(source: Class<any> | string | TypedArray<any>, type: Class<T> | string | TypedArray<T> | object): boolean;
|
|
103
|
-
/**
|
|
104
|
-
* Creates child DI container.
|
|
105
|
-
*
|
|
106
|
-
*/
|
|
107
|
-
export declare function child(): IContainer;
|
|
108
|
-
export declare function __spinajs_require__(module: string): Promise<unknown>;
|
|
1
|
+
import { IBind, IContainer, AsyncService, ResolvableObject } from './interfaces.js';
|
|
2
|
+
import { Class, Factory } from './types.js';
|
|
3
|
+
import { TypedArray } from './array.js';
|
|
4
|
+
/**
|
|
5
|
+
* App main DI container
|
|
6
|
+
*/
|
|
7
|
+
export declare const RootContainer: IContainer;
|
|
8
|
+
/***
|
|
9
|
+
* EVENT LISTENER STUFF
|
|
10
|
+
*
|
|
11
|
+
* Allows to use event listener stuff on root container
|
|
12
|
+
*/
|
|
13
|
+
export declare function setESMModuleSupport(): void;
|
|
14
|
+
export declare function on(event: string, listener: (...args: unknown[]) => void): IContainer;
|
|
15
|
+
export declare function addListener(event: string | symbol, listener: (...args: unknown[]) => void): IContainer;
|
|
16
|
+
export declare function once(event: string | symbol, listener: (...args: unknown[]) => void): IContainer;
|
|
17
|
+
export declare function removeListener(event: string | symbol, listener: (...args: unknown[]) => void): IContainer;
|
|
18
|
+
export declare function off(event: string | symbol, listener: (...args: unknown[]) => void): IContainer;
|
|
19
|
+
export declare function removeAllListeners(event?: string | symbol): IContainer;
|
|
20
|
+
export declare function setMaxListeners(n: number): IContainer;
|
|
21
|
+
export declare function getMaxListeners(): number;
|
|
22
|
+
export declare function listeners(event: string | symbol): Function[];
|
|
23
|
+
export declare function rawListeners(event: string | symbol): Function[];
|
|
24
|
+
export declare function emit(event: string | symbol, ...args: unknown[]): boolean;
|
|
25
|
+
export declare function listenerCount(type: string | symbol): number;
|
|
26
|
+
export declare function prependListener(event: string | symbol, listener: (...args: unknown[]) => void): IContainer;
|
|
27
|
+
export declare function prependOnceListener(event: string | symbol, listener: (...args: unknown[]) => void): IContainer;
|
|
28
|
+
export declare function eventNames(): (string | symbol)[];
|
|
29
|
+
/**
|
|
30
|
+
* ===========================================================================
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* Clears root container registry and cache.
|
|
34
|
+
*/
|
|
35
|
+
export declare function clear(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Clears out root registry ( registered types in root container )
|
|
38
|
+
*/
|
|
39
|
+
export declare function clearRegistry(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Cleart ous root cache ( all resolved types )
|
|
42
|
+
*/
|
|
43
|
+
export declare function clearCache(): void;
|
|
44
|
+
export declare function dispose(): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Register class/interface to DI root container. If
|
|
47
|
+
* @param type - interface object to register
|
|
48
|
+
* @throws {@link InvalidArgument} if type is null or undefined
|
|
49
|
+
*/
|
|
50
|
+
export declare function register<T>(type: Class<T> | Factory<T> | ResolvableObject): IBind;
|
|
51
|
+
export declare function unregister<T>(type: string | Class<T> | Factory<T> | ResolvableObject): void;
|
|
52
|
+
export declare function uncache<T>(type: string | Class<T> | TypedArray<T>, parent?: boolean): void;
|
|
53
|
+
/**
|
|
54
|
+
* Resolves specified type from root container.
|
|
55
|
+
*
|
|
56
|
+
* @param type - class to resolve
|
|
57
|
+
* @param options - optional parameters passed to class constructor
|
|
58
|
+
* @param check - use parent container to check when resolving
|
|
59
|
+
* @throws {@link InvalidArgument} if type is null or undefined
|
|
60
|
+
*/
|
|
61
|
+
export declare function resolve<T>(type: string, options?: unknown[], check?: boolean): T;
|
|
62
|
+
export declare function resolve<T>(type: string, check?: boolean): T;
|
|
63
|
+
export declare function resolve<T>(type: Class<T>, check?: boolean): T extends AsyncService ? Promise<T> : T;
|
|
64
|
+
export declare function resolve<T>(type: TypedArray<T>, check?: boolean): T extends AsyncService ? Promise<T[]> : T[];
|
|
65
|
+
export declare function resolve<T>(type: Class<T>, options?: unknown[] | boolean, check?: boolean): T extends AsyncService ? Promise<T> : T;
|
|
66
|
+
export declare function resolve<T>(type: TypedArray<T>, options?: unknown[] | boolean, check?: boolean): T extends AsyncService ? Promise<T[]> : T[];
|
|
67
|
+
/**
|
|
68
|
+
* Gets already resolved service from root container.
|
|
69
|
+
*
|
|
70
|
+
* @param serviceName - name of service to get
|
|
71
|
+
*/
|
|
72
|
+
export declare function get<T>(serviceName: TypedArray<T>): T[] | null;
|
|
73
|
+
export declare function get<T>(serviceName: string | Class<T>): T | null;
|
|
74
|
+
/**
|
|
75
|
+
*
|
|
76
|
+
* Returns list of types registered at given type, eg. all types/services registered under BaseService
|
|
77
|
+
*
|
|
78
|
+
* @param type - base type to check
|
|
79
|
+
*/
|
|
80
|
+
export declare function getRegisteredTypes<T>(type: string | Class<T>): Class<T>[];
|
|
81
|
+
/**
|
|
82
|
+
* Checks if service is already resolved and exists in container cache.
|
|
83
|
+
* NOTE: check is only valid for classes that are singletons.
|
|
84
|
+
*
|
|
85
|
+
* @param service - service name or class to check
|
|
86
|
+
*/
|
|
87
|
+
export declare function has<T>(service: string | Class<T>): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Checks if service is registered in container.
|
|
90
|
+
*
|
|
91
|
+
* @param service - service class object to check
|
|
92
|
+
*/
|
|
93
|
+
export declare function check<T>(service: Class<T> | string): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Checks if specific service is registered in container.
|
|
96
|
+
* Eg. we can have multiple drivers registered for queue connections with different protocol implementations
|
|
97
|
+
* and we want to check if specific driver is registered
|
|
98
|
+
*
|
|
99
|
+
* @param source - source class to check ( eg. base class )
|
|
100
|
+
* @param type - specific type to check eg. base class implementation
|
|
101
|
+
*/
|
|
102
|
+
export declare function checkType<T>(source: Class<any> | string | TypedArray<any>, type: Class<T> | string | TypedArray<T> | object): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Creates child DI container.
|
|
105
|
+
*
|
|
106
|
+
*/
|
|
107
|
+
export declare function child(): IContainer;
|
|
108
|
+
export declare function __spinajs_require__(module: string): Promise<unknown>;
|
|
109
109
|
//# sourceMappingURL=root.d.ts.map
|