@expressots/core 2.16.2 → 3.0.0-beta.1
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 +2 -2
- package/lib/CHANGELOG.md +312 -322
- package/lib/README.md +2 -2
- package/lib/cjs/application/application-container.js +18 -21
- package/lib/cjs/application/application-factory.js +4 -5
- package/lib/cjs/{common/server-env.types.js → application/application.types.js} +1 -0
- package/lib/cjs/application/index.js +3 -1
- package/lib/cjs/console/console.js +8 -20
- package/lib/cjs/container-module/container-module.js +10 -18
- package/lib/cjs/decorator/scope-binding.js +12 -11
- package/lib/cjs/di/annotation/decorator_utils.js +121 -0
- package/lib/cjs/di/annotation/inject.js +44 -0
- package/lib/cjs/di/annotation/inject_base.js +17 -0
- package/lib/cjs/di/annotation/injectable.js +43 -0
- package/lib/cjs/di/annotation/lazy_service_identifier.js +12 -0
- package/lib/cjs/di/annotation/multi_inject.js +30 -0
- package/lib/cjs/di/annotation/named.js +34 -0
- package/lib/cjs/di/annotation/optional.js +32 -0
- package/lib/cjs/di/annotation/post_construct.js +31 -0
- package/lib/cjs/di/annotation/pre_destroy.js +31 -0
- package/lib/cjs/di/annotation/property_event_decorator.js +15 -0
- package/lib/cjs/di/annotation/tagged.js +9 -0
- package/lib/cjs/di/annotation/target_name.js +35 -0
- package/lib/cjs/di/annotation/unmanaged.js +35 -0
- package/lib/cjs/di/binding-decorator/constants.js +7 -0
- package/lib/cjs/di/binding-decorator/decorator/fluent_provide.js +20 -0
- package/lib/cjs/di/binding-decorator/decorator/provide.js +37 -0
- package/lib/cjs/di/binding-decorator/factory/module_factory.js +17 -0
- package/lib/cjs/di/binding-decorator/index.js +14 -0
- package/lib/cjs/di/binding-decorator/syntax/provide_done_syntax.js +42 -0
- package/lib/cjs/di/binding-decorator/syntax/provide_in_syntax.js +33 -0
- package/lib/cjs/di/binding-decorator/syntax/provide_in_when_on_syntax.js +64 -0
- package/lib/cjs/di/binding-decorator/syntax/provide_on_syntax.js +22 -0
- package/lib/cjs/di/binding-decorator/syntax/provide_when_on_syntax.js +57 -0
- package/lib/cjs/di/binding-decorator/syntax/provide_when_syntax.js +89 -0
- package/lib/cjs/di/binding-decorator/utils/auto_wire.js +18 -0
- package/lib/cjs/di/bindings/binding.js +40 -0
- package/lib/cjs/di/bindings/binding_count.js +8 -0
- package/lib/cjs/di/constants/error_msgs.js +60 -0
- package/lib/cjs/di/constants/literal_types.js +26 -0
- package/lib/cjs/di/constants/metadata_keys.js +38 -0
- package/lib/cjs/di/container/container.js +521 -0
- package/lib/cjs/di/container/container_module.js +18 -0
- package/lib/cjs/di/container/container_snapshot.js +15 -0
- package/lib/cjs/di/container/lookup.js +132 -0
- package/lib/cjs/di/container/module_activation_store.js +49 -0
- package/lib/cjs/di/interfaces/interfaces.js +2 -0
- package/lib/cjs/di/inversify.js +78 -0
- package/lib/cjs/di/planning/context.js +17 -0
- package/lib/cjs/di/planning/metadata.js +42 -0
- package/lib/cjs/di/planning/metadata_reader.js +45 -0
- package/lib/cjs/di/planning/plan.js +10 -0
- package/lib/cjs/di/planning/planner.js +186 -0
- package/lib/cjs/di/planning/queryable_string.js +27 -0
- package/lib/cjs/di/planning/reflection_utils.js +178 -0
- package/lib/cjs/di/planning/request.js +23 -0
- package/lib/cjs/di/planning/target.js +108 -0
- package/lib/cjs/di/resolution/instantiation.js +150 -0
- package/lib/cjs/di/resolution/resolver.js +188 -0
- package/lib/cjs/di/scope/scope.js +50 -0
- package/lib/cjs/di/syntax/binding_in_syntax.js +23 -0
- package/lib/cjs/di/syntax/binding_in_when_on_syntax.js +75 -0
- package/lib/cjs/di/syntax/binding_on_syntax.js +18 -0
- package/lib/cjs/di/syntax/binding_to_syntax.js +111 -0
- package/lib/cjs/di/syntax/binding_when_on_syntax.js +64 -0
- package/lib/cjs/di/syntax/binding_when_syntax.js +84 -0
- package/lib/cjs/di/syntax/constraint_helpers.js +68 -0
- package/lib/cjs/di/utils/async.js +15 -0
- package/lib/cjs/di/utils/binding_utils.js +77 -0
- package/lib/cjs/di/utils/clonable.js +9 -0
- package/lib/cjs/di/utils/exceptions.js +46 -0
- package/lib/cjs/di/utils/factory_type.js +9 -0
- package/lib/cjs/di/utils/id.js +7 -0
- package/lib/cjs/di/utils/js.js +15 -0
- package/lib/cjs/di/utils/serialization.js +132 -0
- package/lib/cjs/error/app-error.js +5 -2
- package/lib/cjs/error/report.js +24 -15
- package/lib/cjs/index.js +1 -2
- package/lib/cjs/middleware/middleware-interface.js +2 -0
- package/lib/cjs/middleware/middleware-service.js +9 -24
- package/lib/cjs/provider/db-in-memory/base-repo.repository.js +3 -8
- package/lib/cjs/provider/db-in-memory/db-in-memory.provider.js +8 -5
- package/lib/cjs/provider/dto-validator/dto-validator.provider.js +4 -4
- package/lib/cjs/provider/dto-validator/package-resolver.js +56 -0
- package/lib/cjs/provider/environment/env-validator.provider.js +14 -12
- package/lib/cjs/provider/logger/logger.provider.js +10 -5
- package/lib/cjs/provider/provider-manager.js +21 -17
- package/lib/cjs/types/application/application-container.d.ts +12 -25
- package/lib/cjs/types/application/application-factory.d.ts +10 -7
- package/lib/cjs/types/{common/server-env.types.d.ts → application/application.types.d.ts} +1 -0
- package/lib/cjs/types/application/index.d.ts +1 -0
- package/lib/cjs/types/console/console.d.ts +3 -10
- package/lib/cjs/types/console/index.d.ts +2 -1
- package/lib/cjs/types/container-module/container-module.d.ts +3 -1
- package/lib/cjs/types/decorator/scope-binding.d.ts +9 -9
- package/lib/cjs/types/di/annotation/decorator_utils.d.ts +16 -0
- package/lib/cjs/types/di/annotation/inject.d.ts +16 -0
- package/lib/cjs/types/di/annotation/inject_base.d.ts +3 -0
- package/lib/cjs/types/di/annotation/injectable.d.ts +7 -0
- package/lib/cjs/types/di/annotation/lazy_service_identifier.d.ts +7 -0
- package/lib/cjs/types/di/annotation/multi_inject.d.ts +2 -0
- package/lib/cjs/types/di/annotation/named.d.ts +2 -0
- package/lib/cjs/types/di/annotation/optional.d.ts +2 -0
- package/lib/cjs/types/di/annotation/post_construct.d.ts +4 -0
- package/lib/cjs/types/di/annotation/pre_destroy.d.ts +4 -0
- package/lib/cjs/types/di/annotation/property_event_decorator.d.ts +4 -0
- package/lib/cjs/types/di/annotation/tagged.d.ts +2 -0
- package/lib/cjs/types/di/annotation/target_name.d.ts +3 -0
- package/lib/cjs/types/di/annotation/unmanaged.d.ts +3 -0
- package/lib/cjs/types/di/binding-decorator/constants.d.ts +4 -0
- package/lib/cjs/types/di/binding-decorator/decorator/fluent_provide.d.ts +4 -0
- package/lib/cjs/types/di/binding-decorator/decorator/provide.d.ts +4 -0
- package/lib/cjs/types/di/binding-decorator/factory/module_factory.d.ts +4 -0
- package/lib/cjs/types/di/binding-decorator/index.d.ts +8 -0
- package/lib/cjs/types/di/binding-decorator/interfaces/interfaces.d.ts +39 -0
- package/lib/cjs/types/di/binding-decorator/syntax/provide_done_syntax.d.ts +7 -0
- package/lib/cjs/types/di/binding-decorator/syntax/provide_in_syntax.d.ts +11 -0
- package/lib/cjs/types/di/binding-decorator/syntax/provide_in_when_on_syntax.d.ts +27 -0
- package/lib/cjs/types/di/binding-decorator/syntax/provide_on_syntax.d.ts +10 -0
- package/lib/cjs/types/di/binding-decorator/syntax/provide_when_on_syntax.d.ts +24 -0
- package/lib/cjs/types/di/binding-decorator/syntax/provide_when_syntax.d.ts +23 -0
- package/lib/cjs/types/di/binding-decorator/utils/auto_wire.d.ts +3 -0
- package/lib/cjs/types/di/bindings/binding.d.ts +20 -0
- package/lib/cjs/types/di/bindings/binding_count.d.ts +5 -0
- package/lib/cjs/types/di/constants/error_msgs.d.ts +32 -0
- package/lib/cjs/types/di/constants/literal_types.d.ts +5 -0
- package/lib/cjs/types/di/constants/metadata_keys.d.ts +13 -0
- package/lib/cjs/types/di/container/container.d.ts +73 -0
- package/lib/cjs/types/di/container/container_module.d.ts +11 -0
- package/lib/cjs/types/di/container/container_snapshot.d.ts +10 -0
- package/lib/cjs/types/di/container/lookup.d.ts +16 -0
- package/lib/cjs/types/di/container/module_activation_store.d.ts +10 -0
- package/lib/cjs/types/di/interfaces/interfaces.d.ts +299 -0
- package/lib/cjs/types/di/inversify.d.ts +25 -0
- package/lib/cjs/types/di/planning/context.d.ts +11 -0
- package/lib/cjs/types/di/planning/metadata.d.ts +8 -0
- package/lib/cjs/types/di/planning/metadata_reader.d.ts +6 -0
- package/lib/cjs/types/di/planning/plan.d.ts +7 -0
- package/lib/cjs/types/di/planning/planner.d.ts +5 -0
- package/lib/cjs/types/di/planning/queryable_string.d.ts +11 -0
- package/lib/cjs/types/di/planning/reflection_utils.d.ts +5 -0
- package/lib/cjs/types/di/planning/request.d.ts +14 -0
- package/lib/cjs/types/di/planning/target.d.ts +23 -0
- package/lib/cjs/types/di/resolution/instantiation.d.ts +3 -0
- package/lib/cjs/types/di/resolution/resolver.d.ts +3 -0
- package/lib/cjs/types/di/scope/scope.d.ts +3 -0
- package/lib/cjs/types/di/syntax/binding_in_syntax.d.ts +9 -0
- package/lib/cjs/types/di/syntax/binding_in_when_on_syntax.d.ts +29 -0
- package/lib/cjs/types/di/syntax/binding_on_syntax.d.ts +8 -0
- package/lib/cjs/types/di/syntax/binding_to_syntax.d.ts +18 -0
- package/lib/cjs/types/di/syntax/binding_when_on_syntax.d.ts +25 -0
- package/lib/cjs/types/di/syntax/binding_when_syntax.d.ts +21 -0
- package/lib/cjs/types/di/syntax/constraint_helpers.d.ts +6 -0
- package/lib/cjs/types/di/utils/async.d.ts +3 -0
- package/lib/cjs/types/di/utils/binding_utils.d.ts +4 -0
- package/lib/cjs/types/di/utils/clonable.d.ts +3 -0
- package/lib/cjs/types/di/utils/exceptions.d.ts +2 -0
- package/lib/cjs/types/di/utils/factory_type.d.ts +5 -0
- package/lib/cjs/types/di/utils/id.d.ts +2 -0
- package/lib/cjs/types/di/utils/js.d.ts +1 -0
- package/lib/cjs/types/di/utils/serialization.d.ts +10 -0
- package/lib/cjs/types/error/report.d.ts +7 -5
- package/lib/cjs/types/index.d.ts +1 -2
- package/lib/cjs/types/middleware/index.d.ts +2 -1
- package/lib/cjs/types/middleware/middleware-interface.d.ts +185 -0
- package/lib/cjs/types/middleware/middleware-service.d.ts +11 -163
- package/lib/cjs/types/provider/db-in-memory/db-in-memory.provider.d.ts +4 -0
- package/lib/cjs/types/provider/dto-validator/dto-validator.provider.d.ts +2 -3
- package/lib/cjs/types/{common → provider/dto-validator}/package-resolver.d.ts +1 -2
- package/lib/cjs/types/provider/environment/env-validator.provider.d.ts +7 -3
- package/lib/cjs/types/provider/logger/logger.provider.d.ts +5 -0
- package/lib/cjs/types/provider/provider-manager.d.ts +22 -2
- package/lib/package.json +9 -15
- package/package.json +9 -15
- package/lib/cjs/common/index.js +0 -5
- package/lib/cjs/common/package-resolver.js +0 -34
- package/lib/cjs/controller/base-controller.js +0 -63
- package/lib/cjs/controller/index.js +0 -5
- package/lib/cjs/types/common/index.d.ts +0 -2
- package/lib/cjs/types/common/project-config.d.ts +0 -56
- package/lib/cjs/types/controller/base-controller.d.ts +0 -32
- package/lib/cjs/types/controller/index.d.ts +0 -1
- /package/lib/cjs/{common → console}/color-codes.js +0 -0
- /package/lib/cjs/{common/project-config.js → di/binding-decorator/interfaces/interfaces.js} +0 -0
- /package/lib/cjs/types/{common → console}/color-codes.d.ts +0 -0
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
* Interface representing application message details for console output.
|
|
3
|
-
*/
|
|
4
|
-
interface IApplicationMessageToConsole {
|
|
5
|
-
appName: string;
|
|
6
|
-
appVersion: string;
|
|
7
|
-
}
|
|
1
|
+
import { IConsoleMessage } from "@expressots/shared";
|
|
8
2
|
/**
|
|
9
3
|
* The Console class provides methods for displaying styled messages in the console.
|
|
10
4
|
* @provide Console
|
|
11
5
|
*/
|
|
12
|
-
declare class Console {
|
|
6
|
+
export declare class Console {
|
|
13
7
|
/**
|
|
14
8
|
* Print a message to the console with the specified color style.
|
|
15
9
|
* @param message - The message to be printed.
|
|
@@ -22,6 +16,5 @@ declare class Console {
|
|
|
22
16
|
* @param environment - The server environment.
|
|
23
17
|
* @param consoleMessage - Optional application message details for console output.
|
|
24
18
|
*/
|
|
25
|
-
messageServer(port: number, environment: string, consoleMessage?:
|
|
19
|
+
messageServer(port: number, environment: string, consoleMessage?: IConsoleMessage): Promise<void>;
|
|
26
20
|
}
|
|
27
|
-
export { Console, IApplicationMessageToConsole };
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { IConsoleMessage } from "@expressots/shared";
|
|
2
|
+
export { Console } from "./console";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContainerModule, interfaces } from "inversify";
|
|
1
|
+
import { ContainerModule, interfaces } from "../di/inversify";
|
|
2
2
|
/**
|
|
3
3
|
* Key to be used for storing and retrieving binding type metadata.
|
|
4
4
|
*/
|
|
@@ -7,6 +7,7 @@ export declare const BINDING_TYPE_METADATA_KEY = "binding-type";
|
|
|
7
7
|
* The scope decorator is a higher order function that can be used to decorate a class with a binding type.
|
|
8
8
|
* @param binding An instance of interfaces.BindingScope which represents the binding type.
|
|
9
9
|
* @returns A decorator function that can be used to decorate a class with a binding type.
|
|
10
|
+
* @public API
|
|
10
11
|
*/
|
|
11
12
|
declare const scope: (binding: interfaces.BindingScope) => (target: any) => void;
|
|
12
13
|
/**
|
|
@@ -26,6 +27,7 @@ export declare class BaseModule {
|
|
|
26
27
|
* @param controllers - An array of controller classes.
|
|
27
28
|
* @param scope - An optional binding scope to be used for all controllers.
|
|
28
29
|
* @returns A ContainerModule with the controller bindings.
|
|
30
|
+
* @public API
|
|
29
31
|
*/
|
|
30
32
|
static createContainerModule(controllers: Array<any>, scope?: interfaces.BindingScope): ContainerModule;
|
|
31
33
|
}
|
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```typescript
|
|
9
|
-
*
|
|
9
|
+
* provide(ServiceIdentifier)
|
|
10
10
|
* class MyService {}
|
|
11
11
|
* ```
|
|
12
|
+
* @public API
|
|
12
13
|
*/
|
|
13
|
-
declare const provide: (identifier: any) => (target: any) => any;
|
|
14
|
+
export declare const provide: (identifier: any) => (target: any) => any;
|
|
14
15
|
/**
|
|
15
16
|
* Provides a singleton binding for the given identifier.
|
|
16
17
|
*
|
|
17
|
-
* @remarks
|
|
18
18
|
* Singleton binding ensures that the same instance of a dependency is reused within the entire container.
|
|
19
19
|
*
|
|
20
20
|
* @param identifier - The identifier (e.g., symbol, string, class) for the dependency being registered.
|
|
@@ -22,15 +22,15 @@ declare const provide: (identifier: any) => (target: any) => any;
|
|
|
22
22
|
*
|
|
23
23
|
* @example
|
|
24
24
|
* ```typescript
|
|
25
|
-
*
|
|
25
|
+
* provideSingleton(ServiceIdentifier)
|
|
26
26
|
* class MyService {}
|
|
27
27
|
* ```
|
|
28
|
+
* @public API
|
|
28
29
|
*/
|
|
29
|
-
declare const provideSingleton: (identifier: any) => (target: any) => any;
|
|
30
|
+
export declare const provideSingleton: (identifier: any) => (target: any) => any;
|
|
30
31
|
/**
|
|
31
32
|
* Provides a transient binding for the given identifier.
|
|
32
33
|
*
|
|
33
|
-
* @remarks
|
|
34
34
|
* Transient binding ensures that a new instance of a dependency is created every time it is resolved.
|
|
35
35
|
*
|
|
36
36
|
* @param identifier - The identifier (e.g., symbol, string, class) for the dependency being registered.
|
|
@@ -38,9 +38,9 @@ declare const provideSingleton: (identifier: any) => (target: any) => any;
|
|
|
38
38
|
*
|
|
39
39
|
* @example
|
|
40
40
|
* ```typescript
|
|
41
|
-
*
|
|
41
|
+
* provideTransient(ServiceIdentifier)
|
|
42
42
|
* class MyService {}
|
|
43
43
|
* ```
|
|
44
|
+
* @public API
|
|
44
45
|
*/
|
|
45
|
-
declare const provideTransient: (identifier: any) => (target: any) => any;
|
|
46
|
-
export { provide, provideSingleton, provideTransient };
|
|
46
|
+
export declare const provideTransient: (identifier: any) => (target: any) => any;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { interfaces } from "../interfaces/interfaces";
|
|
2
|
+
type Prototype<T> = {
|
|
3
|
+
[Property in keyof T]: T[Property] extends NewableFunction ? T[Property] : T[Property] | undefined;
|
|
4
|
+
} & {
|
|
5
|
+
constructor: NewableFunction;
|
|
6
|
+
};
|
|
7
|
+
interface ConstructorFunction<T = Record<string, unknown>> {
|
|
8
|
+
new (...args: Array<unknown>): T;
|
|
9
|
+
prototype: Prototype<T>;
|
|
10
|
+
}
|
|
11
|
+
export type DecoratorTarget<T = unknown> = ConstructorFunction<T> | Prototype<T>;
|
|
12
|
+
declare function tagParameter(annotationTarget: DecoratorTarget, parameterName: string | symbol | undefined, parameterIndex: number, metadata: interfaces.MetadataOrMetadataArray): void;
|
|
13
|
+
declare function tagProperty(annotationTarget: DecoratorTarget, propertyName: string | symbol, metadata: interfaces.MetadataOrMetadataArray): void;
|
|
14
|
+
declare function createTaggedDecorator(metadata: interfaces.MetadataOrMetadataArray): <T>(target: DecoratorTarget, targetKey?: string | symbol, indexOrPropertyDescriptor?: number | TypedPropertyDescriptor<T>) => void;
|
|
15
|
+
declare function decorate(decorator: DecoratorTarget | ParameterDecorator | MethodDecorator, target: object, parameterIndexOrProperty?: number | string): void;
|
|
16
|
+
export { decorate, tagParameter, tagProperty, createTaggedDecorator };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marks a constructor parameter for injection.
|
|
3
|
+
* @param serviceIdentifier The service identifier
|
|
4
|
+
* @return The decorator function
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* class Engine {}
|
|
8
|
+
*
|
|
9
|
+
* class Car {
|
|
10
|
+
* constructor(@inject(Engine) engine: Engine) {}
|
|
11
|
+
* }
|
|
12
|
+
* ```
|
|
13
|
+
* @public API
|
|
14
|
+
*/
|
|
15
|
+
declare const inject: <T = unknown>(serviceIdentifier: import("./lazy_service_identifier").ServiceIdentifierOrFunc<T>) => (target: import("./decorator_utils").DecoratorTarget, targetKey?: string | symbol, indexOrPropertyDescriptor?: number | TypedPropertyDescriptor<T>) => void;
|
|
16
|
+
export { inject };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DecoratorTarget } from "./decorator_utils";
|
|
2
|
+
import { ServiceIdentifierOrFunc } from "./lazy_service_identifier";
|
|
3
|
+
export declare function injectBase(metadataKey: string): <T = unknown>(serviceIdentifier: ServiceIdentifierOrFunc<T>) => (target: DecoratorTarget, targetKey?: string | symbol, indexOrPropertyDescriptor?: number | TypedPropertyDescriptor<T>) => void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { interfaces } from "../interfaces/interfaces";
|
|
2
|
+
export type ServiceIdentifierOrFunc<T> = interfaces.ServiceIdentifier<T> | LazyServiceIdentifier<T>;
|
|
3
|
+
export declare class LazyServiceIdentifier<T = unknown> {
|
|
4
|
+
private _cb;
|
|
5
|
+
constructor(cb: () => interfaces.ServiceIdentifier<T>);
|
|
6
|
+
unwrap(): interfaces.ServiceIdentifier<T>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const multiInject: <T = unknown>(serviceIdentifier: import("./lazy_service_identifier").ServiceIdentifierOrFunc<T>) => (target: import("./decorator_utils").DecoratorTarget, targetKey?: string | symbol, indexOrPropertyDescriptor?: number | TypedPropertyDescriptor<T>) => void;
|
|
2
|
+
export { multiInject };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import interfaces from "../interfaces/interfaces";
|
|
2
|
+
import { interfaces as inversifyInterfaces } from "../../../di/inversify";
|
|
3
|
+
declare function fluentProvide(serviceIdentifier: inversifyInterfaces.ServiceIdentifier<any>): interfaces.ProvideInWhenOnSyntax<any>;
|
|
4
|
+
export default fluentProvide;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import autoProvide from "./utils/auto_wire";
|
|
2
|
+
import provide from "./decorator/provide";
|
|
3
|
+
import fluentProvide from "./decorator/fluent_provide";
|
|
4
|
+
import buildProviderModule from "./factory/module_factory";
|
|
5
|
+
export { fluentProvide };
|
|
6
|
+
export { provide };
|
|
7
|
+
export { autoProvide };
|
|
8
|
+
export { buildProviderModule };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { interfaces as inversifyInterfaces } from "../../inversify";
|
|
2
|
+
declare namespace interfaces {
|
|
3
|
+
type BindConstraint = (bind: inversifyInterfaces.Bind, target: any) => any;
|
|
4
|
+
interface ProvideSyntax {
|
|
5
|
+
constraint: BindConstraint;
|
|
6
|
+
implementationType: any;
|
|
7
|
+
}
|
|
8
|
+
interface ProvideDoneSyntax {
|
|
9
|
+
done(force?: boolean): (target: any) => any;
|
|
10
|
+
}
|
|
11
|
+
interface ProvideInSyntax<T> extends ProvideDoneSyntax {
|
|
12
|
+
inSingletonScope(): ProvideWhenOnSyntax<T>;
|
|
13
|
+
inTransientScope(): ProvideWhenOnSyntax<T>;
|
|
14
|
+
}
|
|
15
|
+
interface ProvideInWhenOnSyntax<T> extends ProvideInSyntax<T>, ProvideWhenSyntax<T>, ProvideOnSyntax<T> {
|
|
16
|
+
}
|
|
17
|
+
interface ProvideOnSyntax<T> extends ProvideDoneSyntax {
|
|
18
|
+
onActivation(fn: (context: inversifyInterfaces.Context, injectable: T) => T): ProvideWhenSyntax<T>;
|
|
19
|
+
}
|
|
20
|
+
interface ProvideWhenSyntax<T> extends ProvideDoneSyntax {
|
|
21
|
+
when(constraint: (request: inversifyInterfaces.Request) => boolean): ProvideOnSyntax<T>;
|
|
22
|
+
whenTargetNamed(name: string): ProvideOnSyntax<T>;
|
|
23
|
+
whenTargetTagged(tag: string, value: any): ProvideOnSyntax<T>;
|
|
24
|
+
whenInjectedInto(parent: Function | string): ProvideOnSyntax<T>;
|
|
25
|
+
whenParentNamed(name: string): ProvideOnSyntax<T>;
|
|
26
|
+
whenParentTagged(tag: string, value: any): ProvideOnSyntax<T>;
|
|
27
|
+
whenAnyAncestorIs(ancestor: Function | string): ProvideOnSyntax<T>;
|
|
28
|
+
whenNoAncestorIs(ancestor: Function | string): ProvideOnSyntax<T>;
|
|
29
|
+
whenAnyAncestorNamed(name: string): ProvideOnSyntax<T>;
|
|
30
|
+
whenAnyAncestorTagged(tag: string, value: any): ProvideOnSyntax<T>;
|
|
31
|
+
whenNoAncestorNamed(name: string): ProvideOnSyntax<T>;
|
|
32
|
+
whenNoAncestorTagged(tag: string, value: any): ProvideOnSyntax<T>;
|
|
33
|
+
whenAnyAncestorMatches(constraint: (request: inversifyInterfaces.Request) => boolean): ProvideOnSyntax<T>;
|
|
34
|
+
whenNoAncestorMatches(constraint: (request: inversifyInterfaces.Request) => boolean): ProvideOnSyntax<T>;
|
|
35
|
+
}
|
|
36
|
+
interface ProvideWhenOnSyntax<T> extends ProvideWhenSyntax<T>, ProvideOnSyntax<T> {
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export default interfaces;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import interfaces from "../interfaces/interfaces";
|
|
2
|
+
declare class ProvideDoneSyntax implements interfaces.ProvideDoneSyntax {
|
|
3
|
+
private _binding;
|
|
4
|
+
constructor(binding: interfaces.BindConstraint);
|
|
5
|
+
done(force?: boolean): (target: any) => any;
|
|
6
|
+
}
|
|
7
|
+
export default ProvideDoneSyntax;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import interfaces from "../interfaces/interfaces";
|
|
2
|
+
import { interfaces as inversifyInterfaces } from "../../inversify";
|
|
3
|
+
declare class ProvideInSyntax<T> implements interfaces.ProvideInSyntax<T> {
|
|
4
|
+
private _bindingInSyntax;
|
|
5
|
+
private _provideDoneSyntax;
|
|
6
|
+
constructor(bindingInSyntax: (bind: inversifyInterfaces.Bind, target: any) => inversifyInterfaces.BindingInSyntax<T>, provideDoneSyntax: interfaces.ProvideDoneSyntax);
|
|
7
|
+
inSingletonScope(): interfaces.ProvideWhenOnSyntax<T>;
|
|
8
|
+
inTransientScope(): interfaces.ProvideWhenOnSyntax<T>;
|
|
9
|
+
done(force?: boolean): any;
|
|
10
|
+
}
|
|
11
|
+
export default ProvideInSyntax;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import interfaces from "../interfaces/interfaces";
|
|
2
|
+
import { interfaces as inversifyInterfaces } from "../../inversify";
|
|
3
|
+
declare class ProvideInWhenOnSyntax<T> implements interfaces.ProvideInWhenOnSyntax<T> {
|
|
4
|
+
private _provideInSyntax;
|
|
5
|
+
private _provideWhenSyntax;
|
|
6
|
+
private _provideOnSyntax;
|
|
7
|
+
constructor(provideInSyntax: interfaces.ProvideInSyntax<T>, provideWhenSyntax: interfaces.ProvideWhenSyntax<T>, provideOnSyntax: interfaces.ProvideOnSyntax<T>);
|
|
8
|
+
when(constraint: (request: inversifyInterfaces.Request) => boolean): interfaces.ProvideOnSyntax<T>;
|
|
9
|
+
whenTargetNamed(name: string): interfaces.ProvideOnSyntax<T>;
|
|
10
|
+
whenTargetTagged(tag: string, value: any): interfaces.ProvideOnSyntax<T>;
|
|
11
|
+
whenInjectedInto(parent: Function | string): interfaces.ProvideOnSyntax<T>;
|
|
12
|
+
whenParentNamed(name: string): interfaces.ProvideOnSyntax<T>;
|
|
13
|
+
whenParentTagged(tag: string, value: any): interfaces.ProvideOnSyntax<T>;
|
|
14
|
+
whenAnyAncestorIs(ancestor: Function | string): interfaces.ProvideOnSyntax<T>;
|
|
15
|
+
whenNoAncestorIs(ancestor: Function | string): interfaces.ProvideOnSyntax<T>;
|
|
16
|
+
whenAnyAncestorNamed(name: string): interfaces.ProvideOnSyntax<T>;
|
|
17
|
+
whenAnyAncestorTagged(tag: string, value: any): interfaces.ProvideOnSyntax<T>;
|
|
18
|
+
whenNoAncestorNamed(name: string): interfaces.ProvideOnSyntax<T>;
|
|
19
|
+
whenNoAncestorTagged(tag: string, value: any): interfaces.ProvideOnSyntax<T>;
|
|
20
|
+
whenAnyAncestorMatches(constraint: (request: inversifyInterfaces.Request) => boolean): interfaces.ProvideOnSyntax<T>;
|
|
21
|
+
whenNoAncestorMatches(constraint: (request: inversifyInterfaces.Request) => boolean): interfaces.ProvideOnSyntax<T>;
|
|
22
|
+
onActivation(fn: (context: inversifyInterfaces.Context, injectable: T) => T): interfaces.ProvideWhenSyntax<T>;
|
|
23
|
+
inSingletonScope(): interfaces.ProvideWhenOnSyntax<T>;
|
|
24
|
+
inTransientScope(): interfaces.ProvideWhenOnSyntax<T>;
|
|
25
|
+
done(force?: boolean): any;
|
|
26
|
+
}
|
|
27
|
+
export default ProvideInWhenOnSyntax;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import interfaces from "../interfaces/interfaces";
|
|
2
|
+
import { interfaces as inversifyInterfaces } from "../../inversify";
|
|
3
|
+
declare class ProvideOnSyntax<T> implements interfaces.ProvideOnSyntax<T> {
|
|
4
|
+
private _bindingOnSyntax;
|
|
5
|
+
private _provideDoneSyntax;
|
|
6
|
+
constructor(bindingOnSyntax: (bind: inversifyInterfaces.Bind, target: any) => inversifyInterfaces.BindingOnSyntax<T>, provideDoneSyntax: interfaces.ProvideDoneSyntax);
|
|
7
|
+
onActivation(fn: (context: inversifyInterfaces.Context, injectable: T) => T): interfaces.ProvideWhenSyntax<T>;
|
|
8
|
+
done(force?: boolean): any;
|
|
9
|
+
}
|
|
10
|
+
export default ProvideOnSyntax;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import interfaces from "../interfaces/interfaces";
|
|
2
|
+
import { interfaces as inversifyInterfaces } from "../../inversify";
|
|
3
|
+
declare class ProvideWhenOnSyntax<T> implements interfaces.ProvideWhenOnSyntax<T> {
|
|
4
|
+
private _provideWhenSyntax;
|
|
5
|
+
private _provideOnSyntax;
|
|
6
|
+
constructor(provideWhenSyntax: interfaces.ProvideWhenSyntax<T>, provideOnSyntax: interfaces.ProvideOnSyntax<T>);
|
|
7
|
+
when(constraint: (request: inversifyInterfaces.Request) => boolean): interfaces.ProvideOnSyntax<T>;
|
|
8
|
+
whenTargetNamed(name: string): interfaces.ProvideOnSyntax<T>;
|
|
9
|
+
whenTargetTagged(tag: string, value: any): interfaces.ProvideOnSyntax<T>;
|
|
10
|
+
whenInjectedInto(parent: Function | string): interfaces.ProvideOnSyntax<T>;
|
|
11
|
+
whenParentNamed(name: string): interfaces.ProvideOnSyntax<T>;
|
|
12
|
+
whenParentTagged(tag: string, value: any): interfaces.ProvideOnSyntax<T>;
|
|
13
|
+
whenAnyAncestorIs(ancestor: Function | string): interfaces.ProvideOnSyntax<T>;
|
|
14
|
+
whenNoAncestorIs(ancestor: Function | string): interfaces.ProvideOnSyntax<T>;
|
|
15
|
+
whenAnyAncestorNamed(name: string): interfaces.ProvideOnSyntax<T>;
|
|
16
|
+
whenAnyAncestorTagged(tag: string, value: any): interfaces.ProvideOnSyntax<T>;
|
|
17
|
+
whenNoAncestorNamed(name: string): interfaces.ProvideOnSyntax<T>;
|
|
18
|
+
whenNoAncestorTagged(tag: string, value: any): interfaces.ProvideOnSyntax<T>;
|
|
19
|
+
whenAnyAncestorMatches(constraint: (request: inversifyInterfaces.Request) => boolean): interfaces.ProvideOnSyntax<T>;
|
|
20
|
+
whenNoAncestorMatches(constraint: (request: inversifyInterfaces.Request) => boolean): interfaces.ProvideOnSyntax<T>;
|
|
21
|
+
onActivation(fn: (context: inversifyInterfaces.Context, injectable: T) => T): interfaces.ProvideWhenSyntax<T>;
|
|
22
|
+
done(force?: boolean): any;
|
|
23
|
+
}
|
|
24
|
+
export default ProvideWhenOnSyntax;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import interfaces from "../interfaces/interfaces";
|
|
2
|
+
import { interfaces as inversifyInterfaces } from "../../inversify";
|
|
3
|
+
declare class ProvideWhenSyntax<T> implements interfaces.ProvideWhenSyntax<T> {
|
|
4
|
+
private _bindingWhenSyntax;
|
|
5
|
+
private _provideDoneSyntax;
|
|
6
|
+
constructor(bindingWhenSyntax: (bind: inversifyInterfaces.Bind, target: any) => inversifyInterfaces.BindingWhenSyntax<T>, provideDoneSyntax: interfaces.ProvideDoneSyntax);
|
|
7
|
+
when(constraint: (request: inversifyInterfaces.Request) => boolean): interfaces.ProvideOnSyntax<T>;
|
|
8
|
+
whenTargetNamed(name: string): interfaces.ProvideOnSyntax<T>;
|
|
9
|
+
whenTargetTagged(tag: string, value: any): interfaces.ProvideOnSyntax<T>;
|
|
10
|
+
whenInjectedInto(parent: Function | string): interfaces.ProvideOnSyntax<T>;
|
|
11
|
+
whenParentNamed(name: string): interfaces.ProvideOnSyntax<T>;
|
|
12
|
+
whenParentTagged(tag: string, value: any): interfaces.ProvideOnSyntax<T>;
|
|
13
|
+
whenAnyAncestorIs(ancestor: Function | string): interfaces.ProvideOnSyntax<T>;
|
|
14
|
+
whenNoAncestorIs(ancestor: Function | string): interfaces.ProvideOnSyntax<T>;
|
|
15
|
+
whenAnyAncestorNamed(name: string): interfaces.ProvideOnSyntax<T>;
|
|
16
|
+
whenAnyAncestorTagged(tag: string, value: any): interfaces.ProvideOnSyntax<T>;
|
|
17
|
+
whenNoAncestorNamed(name: string): interfaces.ProvideOnSyntax<T>;
|
|
18
|
+
whenNoAncestorTagged(tag: string, value: any): interfaces.ProvideOnSyntax<T>;
|
|
19
|
+
whenAnyAncestorMatches(constraint: (request: inversifyInterfaces.Request) => boolean): interfaces.ProvideOnSyntax<T>;
|
|
20
|
+
whenNoAncestorMatches(constraint: (request: inversifyInterfaces.Request) => boolean): interfaces.ProvideOnSyntax<T>;
|
|
21
|
+
done(force?: boolean): (target: any) => any;
|
|
22
|
+
}
|
|
23
|
+
export default ProvideWhenSyntax;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { interfaces } from "../interfaces/interfaces";
|
|
2
|
+
declare class Binding<TActivated> implements interfaces.Binding<TActivated> {
|
|
3
|
+
id: number;
|
|
4
|
+
moduleId: interfaces.ContainerModuleBase["id"];
|
|
5
|
+
activated: boolean;
|
|
6
|
+
serviceIdentifier: interfaces.ServiceIdentifier<TActivated>;
|
|
7
|
+
implementationType: interfaces.Newable<TActivated> | TActivated | null;
|
|
8
|
+
cache: TActivated | Promise<TActivated> | null;
|
|
9
|
+
dynamicValue: interfaces.DynamicValue<TActivated> | null;
|
|
10
|
+
scope: interfaces.BindingScope;
|
|
11
|
+
type: interfaces.BindingType;
|
|
12
|
+
factory: interfaces.FactoryCreator<unknown> | null;
|
|
13
|
+
provider: interfaces.ProviderCreator<unknown> | null;
|
|
14
|
+
constraint: interfaces.ConstraintFunction;
|
|
15
|
+
onActivation: interfaces.BindingActivation<TActivated> | null;
|
|
16
|
+
onDeactivation: interfaces.BindingDeactivation<TActivated> | null;
|
|
17
|
+
constructor(serviceIdentifier: interfaces.ServiceIdentifier<TActivated>, scope: interfaces.BindingScope);
|
|
18
|
+
clone(): interfaces.Binding<TActivated>;
|
|
19
|
+
}
|
|
20
|
+
export { Binding };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const DUPLICATED_INJECTABLE_DECORATOR = "Cannot apply @injectable decorator multiple times.";
|
|
2
|
+
export declare const DUPLICATED_METADATA = "Metadata key was used more than once in a parameter:";
|
|
3
|
+
export declare const NULL_ARGUMENT = "NULL argument";
|
|
4
|
+
export declare const KEY_NOT_FOUND = "Key Not Found";
|
|
5
|
+
export declare const AMBIGUOUS_MATCH = "Ambiguous match found for serviceIdentifier:";
|
|
6
|
+
export declare const CANNOT_UNBIND = "Could not unbind serviceIdentifier:";
|
|
7
|
+
export declare const NOT_REGISTERED = "No matching bindings found for serviceIdentifier:";
|
|
8
|
+
export declare const MISSING_INJECTABLE_ANNOTATION = "Missing required @injectable annotation in:";
|
|
9
|
+
export declare const MISSING_INJECT_ANNOTATION = "Missing required @inject or @multiInject annotation in:";
|
|
10
|
+
export declare const UNDEFINED_INJECT_ANNOTATION: (name: string) => string;
|
|
11
|
+
export declare const CIRCULAR_DEPENDENCY = "Circular dependency found:";
|
|
12
|
+
export declare const NOT_IMPLEMENTED = "Sorry, this feature is not fully implemented yet.";
|
|
13
|
+
export declare const INVALID_BINDING_TYPE = "Invalid binding type:";
|
|
14
|
+
export declare const NO_MORE_SNAPSHOTS_AVAILABLE = "No snapshot available to restore.";
|
|
15
|
+
export declare const INVALID_MIDDLEWARE_RETURN = "Invalid return type in middleware. Middleware must return!";
|
|
16
|
+
export declare const INVALID_FUNCTION_BINDING = "Value provided to function binding must be a function!";
|
|
17
|
+
export declare const LAZY_IN_SYNC: (key: unknown) => string;
|
|
18
|
+
export declare const INVALID_TO_SELF_VALUE: string;
|
|
19
|
+
export declare const INVALID_DECORATOR_OPERATION: string;
|
|
20
|
+
export declare const ARGUMENTS_LENGTH_MISMATCH: (...values: Array<unknown>) => string;
|
|
21
|
+
export declare const CONTAINER_OPTIONS_MUST_BE_AN_OBJECT: string;
|
|
22
|
+
export declare const CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE: string;
|
|
23
|
+
export declare const CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE: string;
|
|
24
|
+
export declare const CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK: string;
|
|
25
|
+
export declare const MULTIPLE_PRE_DESTROY_METHODS = "Cannot apply @preDestroy decorator multiple times in the same class";
|
|
26
|
+
export declare const MULTIPLE_POST_CONSTRUCT_METHODS = "Cannot apply @postConstruct decorator multiple times in the same class";
|
|
27
|
+
export declare const ASYNC_UNBIND_REQUIRED = "Attempting to unbind dependency with asynchronous destruction (@preDestroy or onDeactivation)";
|
|
28
|
+
export declare const POST_CONSTRUCT_ERROR: (clazz: string, errorMessage: string) => string;
|
|
29
|
+
export declare const PRE_DESTROY_ERROR: (clazz: string, errorMessage: string) => string;
|
|
30
|
+
export declare const ON_DEACTIVATION_ERROR: (clazz: string, errorMessage: string) => string;
|
|
31
|
+
export declare const CIRCULAR_DEPENDENCY_IN_FACTORY: (factoryType: string, serviceIdentifier: string) => string;
|
|
32
|
+
export declare const STACK_OVERFLOW = "Maximum call stack size exceeded";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { interfaces } from "../interfaces/interfaces";
|
|
2
|
+
declare const BindingScopeEnum: interfaces.BindingScopeEnum;
|
|
3
|
+
declare const BindingTypeEnum: interfaces.BindingTypeEnum;
|
|
4
|
+
declare const TargetTypeEnum: interfaces.TargetTypeEnum;
|
|
5
|
+
export { BindingScopeEnum, BindingTypeEnum, TargetTypeEnum };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const NAMED_TAG = "named";
|
|
2
|
+
export declare const NAME_TAG = "name";
|
|
3
|
+
export declare const UNMANAGED_TAG = "unmanaged";
|
|
4
|
+
export declare const OPTIONAL_TAG = "optional";
|
|
5
|
+
export declare const INJECT_TAG = "inject";
|
|
6
|
+
export declare const MULTI_INJECT_TAG = "multi_inject";
|
|
7
|
+
export declare const TAGGED = "inversify:tagged";
|
|
8
|
+
export declare const TAGGED_PROP = "inversify:tagged_props";
|
|
9
|
+
export declare const PARAM_TYPES = "inversify:paramtypes";
|
|
10
|
+
export declare const DESIGN_PARAM_TYPES = "design:paramtypes";
|
|
11
|
+
export declare const POST_CONSTRUCT = "post_construct";
|
|
12
|
+
export declare const PRE_DESTROY = "pre_destroy";
|
|
13
|
+
export declare const NON_CUSTOM_TAG_KEYS: Array<string>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { interfaces } from "../interfaces/interfaces";
|
|
2
|
+
declare class Container implements interfaces.Container {
|
|
3
|
+
id: number;
|
|
4
|
+
parent: interfaces.Container | null;
|
|
5
|
+
readonly options: interfaces.ContainerOptions;
|
|
6
|
+
private _middleware;
|
|
7
|
+
private _bindingDictionary;
|
|
8
|
+
private _activations;
|
|
9
|
+
private _deactivations;
|
|
10
|
+
private _snapshots;
|
|
11
|
+
private _metadataReader;
|
|
12
|
+
private _moduleActivationStore;
|
|
13
|
+
static merge(container1: interfaces.Container, container2: interfaces.Container, ...containers: Array<interfaces.Container>): interfaces.Container;
|
|
14
|
+
constructor(containerOptions?: interfaces.ContainerOptions);
|
|
15
|
+
load(...modules: Array<interfaces.ContainerModule>): void;
|
|
16
|
+
loadAsync(...modules: Array<interfaces.AsyncContainerModule>): Promise<void>;
|
|
17
|
+
unload(...modules: Array<interfaces.ContainerModuleBase>): void;
|
|
18
|
+
unloadAsync(...modules: Array<interfaces.ContainerModuleBase>): Promise<void>;
|
|
19
|
+
bind<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>): interfaces.BindingToSyntax<T>;
|
|
20
|
+
rebind<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>): interfaces.BindingToSyntax<T>;
|
|
21
|
+
rebindAsync<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>): Promise<interfaces.BindingToSyntax<T>>;
|
|
22
|
+
unbind(serviceIdentifier: interfaces.ServiceIdentifier): void;
|
|
23
|
+
unbindAsync(serviceIdentifier: interfaces.ServiceIdentifier): Promise<void>;
|
|
24
|
+
unbindAll(): void;
|
|
25
|
+
unbindAllAsync(): Promise<void>;
|
|
26
|
+
onActivation<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>, onActivation: interfaces.BindingActivation<T>): void;
|
|
27
|
+
onDeactivation<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>, onDeactivation: interfaces.BindingDeactivation<T>): void;
|
|
28
|
+
isBound(serviceIdentifier: interfaces.ServiceIdentifier<unknown>): boolean;
|
|
29
|
+
isCurrentBound<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>): boolean;
|
|
30
|
+
isBoundNamed(serviceIdentifier: interfaces.ServiceIdentifier, named: string | number | symbol): boolean;
|
|
31
|
+
isBoundTagged(serviceIdentifier: interfaces.ServiceIdentifier, key: string | number | symbol, value: unknown): boolean;
|
|
32
|
+
snapshot(): void;
|
|
33
|
+
restore(): void;
|
|
34
|
+
createChild(containerOptions?: interfaces.ContainerOptions): Container;
|
|
35
|
+
applyMiddleware(...middlewares: Array<interfaces.Middleware>): void;
|
|
36
|
+
applyCustomMetadataReader(metadataReader: interfaces.MetadataReader): void;
|
|
37
|
+
get<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>): T;
|
|
38
|
+
getAsync<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>): Promise<T>;
|
|
39
|
+
getTagged<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>, key: string | number | symbol, value: unknown): T;
|
|
40
|
+
getTaggedAsync<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>, key: string | number | symbol, value: unknown): Promise<T>;
|
|
41
|
+
getNamed<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>, named: string | number | symbol): T;
|
|
42
|
+
getNamedAsync<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>, named: string | number | symbol): Promise<T>;
|
|
43
|
+
getAll<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>): Array<T>;
|
|
44
|
+
getAllAsync<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>): Promise<Array<T>>;
|
|
45
|
+
getAllTagged<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>, key: string | number | symbol, value: unknown): Array<T>;
|
|
46
|
+
getAllTaggedAsync<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>, key: string | number | symbol, value: unknown): Promise<Array<T>>;
|
|
47
|
+
getAllNamed<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>, named: string | number | symbol): Array<T>;
|
|
48
|
+
getAllNamedAsync<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>, named: string | number | symbol): Promise<Array<T>>;
|
|
49
|
+
resolve<T>(constructorFunction: interfaces.Newable<T>): T;
|
|
50
|
+
private _preDestroy;
|
|
51
|
+
private _removeModuleHandlers;
|
|
52
|
+
private _removeModuleBindings;
|
|
53
|
+
private _deactivate;
|
|
54
|
+
private _handleDeactivationError;
|
|
55
|
+
private _deactivateContainer;
|
|
56
|
+
private _deactivateContainerAsync;
|
|
57
|
+
private _getContainerModuleHelpersFactory;
|
|
58
|
+
private _getAll;
|
|
59
|
+
private _get;
|
|
60
|
+
private _getButThrowIfAsync;
|
|
61
|
+
private _getAllArgs;
|
|
62
|
+
private _getNotAllArgs;
|
|
63
|
+
private _planAndResolve;
|
|
64
|
+
private _deactivateIfSingleton;
|
|
65
|
+
private _deactivateSingletons;
|
|
66
|
+
private _deactivateSingletonsAsync;
|
|
67
|
+
private _propagateContainerDeactivationThenBindingAndPreDestroy;
|
|
68
|
+
private _propagateContainerDeactivationThenBindingAndPreDestroyAsync;
|
|
69
|
+
private _removeServiceFromDictionary;
|
|
70
|
+
private _bindingDeactivationAndPreDestroy;
|
|
71
|
+
private _bindingDeactivationAndPreDestroyAsync;
|
|
72
|
+
}
|
|
73
|
+
export { Container };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { interfaces } from "../interfaces/interfaces";
|
|
2
|
+
export declare class ContainerModule implements interfaces.ContainerModule {
|
|
3
|
+
id: number;
|
|
4
|
+
registry: interfaces.ContainerModuleCallBack;
|
|
5
|
+
constructor(registry: interfaces.ContainerModuleCallBack);
|
|
6
|
+
}
|
|
7
|
+
export declare class AsyncContainerModule implements interfaces.AsyncContainerModule {
|
|
8
|
+
id: number;
|
|
9
|
+
registry: interfaces.AsyncContainerModuleCallBack;
|
|
10
|
+
constructor(registry: interfaces.AsyncContainerModuleCallBack);
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { interfaces } from "../interfaces/interfaces";
|
|
2
|
+
declare class ContainerSnapshot implements interfaces.ContainerSnapshot {
|
|
3
|
+
bindings: interfaces.Lookup<interfaces.Binding<unknown>>;
|
|
4
|
+
activations: interfaces.Lookup<interfaces.BindingActivation<unknown>>;
|
|
5
|
+
deactivations: interfaces.Lookup<interfaces.BindingDeactivation<unknown>>;
|
|
6
|
+
middleware: interfaces.Next | null;
|
|
7
|
+
moduleActivationStore: interfaces.ModuleActivationStore;
|
|
8
|
+
static of(bindings: interfaces.Lookup<interfaces.Binding<unknown>>, middleware: interfaces.Next | null, activations: interfaces.Lookup<interfaces.BindingActivation<unknown>>, deactivations: interfaces.Lookup<interfaces.BindingDeactivation<unknown>>, moduleActivationStore: interfaces.ModuleActivationStore): ContainerSnapshot;
|
|
9
|
+
}
|
|
10
|
+
export { ContainerSnapshot };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { interfaces } from "../interfaces/interfaces";
|
|
2
|
+
declare class Lookup<T> implements interfaces.Lookup<T> {
|
|
3
|
+
private _map;
|
|
4
|
+
constructor();
|
|
5
|
+
getMap(): Map<interfaces.ServiceIdentifier, Array<T>>;
|
|
6
|
+
add(serviceIdentifier: interfaces.ServiceIdentifier, value: T): void;
|
|
7
|
+
get(serviceIdentifier: interfaces.ServiceIdentifier): Array<T>;
|
|
8
|
+
remove(serviceIdentifier: interfaces.ServiceIdentifier): void;
|
|
9
|
+
removeIntersection(lookup: interfaces.Lookup<T>): void;
|
|
10
|
+
removeByCondition(condition: (item: T) => boolean): Array<T>;
|
|
11
|
+
hasKey(serviceIdentifier: interfaces.ServiceIdentifier): boolean;
|
|
12
|
+
clone(): interfaces.Lookup<T>;
|
|
13
|
+
traverse(func: (key: interfaces.ServiceIdentifier, value: Array<T>) => void): void;
|
|
14
|
+
private _setValue;
|
|
15
|
+
}
|
|
16
|
+
export { Lookup };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { interfaces } from "../interfaces/interfaces";
|
|
2
|
+
export declare class ModuleActivationStore implements interfaces.ModuleActivationStore {
|
|
3
|
+
private _map;
|
|
4
|
+
remove(moduleId: number): interfaces.ModuleActivationHandlers;
|
|
5
|
+
addDeactivation(moduleId: number, serviceIdentifier: interfaces.ServiceIdentifier<unknown>, onDeactivation: interfaces.BindingDeactivation<unknown>): void;
|
|
6
|
+
addActivation(moduleId: number, serviceIdentifier: interfaces.ServiceIdentifier<unknown>, onActivation: interfaces.BindingActivation<unknown>): void;
|
|
7
|
+
clone(): interfaces.ModuleActivationStore;
|
|
8
|
+
private _getModuleActivationHandlers;
|
|
9
|
+
private _getEmptyHandlersStore;
|
|
10
|
+
}
|