inversify 6.1.2 → 6.1.3
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/CHANGELOG.md +5 -0
- package/amd/annotation/decorator_utils.d.ts +16 -0
- package/amd/annotation/inject.d.ts +5 -0
- package/amd/annotation/inject_base.d.ts +4 -0
- package/amd/annotation/injectable.d.ts +2 -0
- package/amd/annotation/multi_inject.d.ts +5 -0
- package/amd/annotation/named.d.ts +2 -0
- package/amd/annotation/optional.d.ts +2 -0
- package/amd/annotation/post_construct.d.ts +4 -0
- package/amd/annotation/pre_destroy.d.ts +4 -0
- package/amd/annotation/property_event_decorator.d.ts +4 -0
- package/amd/annotation/tagged.d.ts +2 -0
- package/amd/annotation/target_name.d.ts +3 -0
- package/amd/annotation/unmanaged.d.ts +3 -0
- package/amd/bindings/binding.d.ts +20 -0
- package/amd/bindings/binding_count.d.ts +5 -0
- package/amd/constants/error_msgs.d.ts +30 -0
- package/amd/constants/literal_types.d.ts +5 -0
- package/amd/constants/metadata_keys.d.ts +13 -0
- package/amd/container/container.d.ts +73 -0
- package/amd/container/container_module.d.ts +11 -0
- package/amd/container/container_snapshot.d.ts +10 -0
- package/amd/container/lookup.d.ts +17 -0
- package/amd/container/module_activation_store.d.ts +10 -0
- package/amd/interfaces/interfaces.d.ts +269 -0
- package/amd/inversify.d.ts +24 -0
- package/amd/planning/context.d.ts +11 -0
- package/amd/planning/metadata.d.ts +8 -0
- package/amd/planning/metadata_reader.d.ts +6 -0
- package/amd/planning/plan.d.ts +7 -0
- package/amd/planning/planner.d.ts +5 -0
- package/amd/planning/queryable_string.d.ts +10 -0
- package/amd/planning/reflection_utils.d.ts +5 -0
- package/amd/planning/request.d.ts +14 -0
- package/amd/resolution/instantiation.d.ts +3 -0
- package/amd/resolution/resolver.d.ts +3 -0
- package/amd/scope/scope.d.ts +3 -0
- package/amd/syntax/binding_in_syntax.d.ts +9 -0
- package/amd/syntax/binding_in_when_on_syntax.d.ts +29 -0
- package/amd/syntax/binding_on_syntax.d.ts +8 -0
- package/amd/syntax/binding_to_syntax.d.ts +18 -0
- package/amd/syntax/binding_when_on_syntax.d.ts +25 -0
- package/amd/syntax/binding_when_syntax.d.ts +21 -0
- package/amd/syntax/constraint_helpers.d.ts +6 -0
- package/amd/utils/async.d.ts +3 -0
- package/amd/utils/binding_utils.d.ts +4 -0
- package/amd/utils/clonable.d.ts +3 -0
- package/amd/utils/exceptions.d.ts +2 -0
- package/amd/utils/factory_type.d.ts +5 -0
- package/amd/utils/id.d.ts +2 -0
- package/amd/utils/js.d.ts +1 -0
- package/amd/utils/serialization.d.ts +10 -0
- package/es/annotation/decorator_utils.d.ts +16 -0
- package/es/annotation/inject.d.ts +5 -0
- package/es/annotation/inject_base.d.ts +4 -0
- package/es/annotation/injectable.d.ts +2 -0
- package/es/annotation/multi_inject.d.ts +5 -0
- package/es/annotation/named.d.ts +2 -0
- package/es/annotation/optional.d.ts +2 -0
- package/es/annotation/post_construct.d.ts +4 -0
- package/es/annotation/pre_destroy.d.ts +4 -0
- package/es/annotation/property_event_decorator.d.ts +4 -0
- package/es/annotation/tagged.d.ts +2 -0
- package/es/annotation/target_name.d.ts +3 -0
- package/es/annotation/unmanaged.d.ts +3 -0
- package/es/bindings/binding.d.ts +20 -0
- package/es/bindings/binding_count.d.ts +5 -0
- package/es/constants/error_msgs.d.ts +30 -0
- package/es/constants/literal_types.d.ts +5 -0
- package/es/constants/metadata_keys.d.ts +13 -0
- package/es/container/container.d.ts +73 -0
- package/es/container/container_module.d.ts +11 -0
- package/es/container/container_snapshot.d.ts +10 -0
- package/es/container/lookup.d.ts +17 -0
- package/es/container/module_activation_store.d.ts +10 -0
- package/es/interfaces/interfaces.d.ts +269 -0
- package/es/inversify.d.ts +24 -0
- package/es/package.json +3 -0
- package/es/planning/context.d.ts +11 -0
- package/es/planning/metadata.d.ts +8 -0
- package/es/planning/metadata_reader.d.ts +6 -0
- package/es/planning/plan.d.ts +7 -0
- package/es/planning/planner.d.ts +5 -0
- package/es/planning/queryable_string.d.ts +10 -0
- package/es/planning/reflection_utils.d.ts +5 -0
- package/es/planning/request.d.ts +14 -0
- package/es/resolution/instantiation.d.ts +3 -0
- package/es/resolution/resolver.d.ts +3 -0
- package/es/scope/scope.d.ts +3 -0
- package/es/syntax/binding_in_syntax.d.ts +9 -0
- package/es/syntax/binding_in_when_on_syntax.d.ts +29 -0
- package/es/syntax/binding_on_syntax.d.ts +8 -0
- package/es/syntax/binding_to_syntax.d.ts +18 -0
- package/es/syntax/binding_when_on_syntax.d.ts +25 -0
- package/es/syntax/binding_when_syntax.d.ts +21 -0
- package/es/syntax/constraint_helpers.d.ts +6 -0
- package/es/utils/async.d.ts +3 -0
- package/es/utils/binding_utils.d.ts +4 -0
- package/es/utils/clonable.d.ts +3 -0
- package/es/utils/exceptions.d.ts +2 -0
- package/es/utils/factory_type.d.ts +5 -0
- package/es/utils/id.d.ts +2 -0
- package/es/utils/js.d.ts +1 -0
- package/es/utils/serialization.d.ts +10 -0
- package/es6/annotation/decorator_utils.d.ts +16 -0
- package/es6/annotation/inject.d.ts +5 -0
- package/es6/annotation/inject_base.d.ts +4 -0
- package/es6/annotation/injectable.d.ts +2 -0
- package/es6/annotation/multi_inject.d.ts +5 -0
- package/es6/annotation/named.d.ts +2 -0
- package/es6/annotation/optional.d.ts +2 -0
- package/es6/annotation/post_construct.d.ts +4 -0
- package/es6/annotation/pre_destroy.d.ts +4 -0
- package/es6/annotation/property_event_decorator.d.ts +4 -0
- package/es6/annotation/tagged.d.ts +2 -0
- package/es6/annotation/target_name.d.ts +3 -0
- package/es6/annotation/unmanaged.d.ts +3 -0
- package/es6/bindings/binding.d.ts +20 -0
- package/es6/bindings/binding_count.d.ts +5 -0
- package/es6/constants/error_msgs.d.ts +30 -0
- package/es6/constants/literal_types.d.ts +5 -0
- package/es6/constants/metadata_keys.d.ts +13 -0
- package/es6/container/container.d.ts +73 -0
- package/es6/container/container_module.d.ts +11 -0
- package/es6/container/container_snapshot.d.ts +10 -0
- package/es6/container/lookup.d.ts +17 -0
- package/es6/container/module_activation_store.d.ts +10 -0
- package/es6/interfaces/interfaces.d.ts +269 -0
- package/es6/inversify.d.ts +24 -0
- package/es6/planning/context.d.ts +11 -0
- package/es6/planning/metadata.d.ts +8 -0
- package/es6/planning/metadata_reader.d.ts +6 -0
- package/es6/planning/plan.d.ts +7 -0
- package/es6/planning/planner.d.ts +5 -0
- package/es6/planning/queryable_string.d.ts +10 -0
- package/es6/planning/reflection_utils.d.ts +5 -0
- package/es6/planning/request.d.ts +14 -0
- package/es6/resolution/instantiation.d.ts +3 -0
- package/es6/resolution/resolver.d.ts +3 -0
- package/es6/scope/scope.d.ts +3 -0
- package/es6/syntax/binding_in_syntax.d.ts +9 -0
- package/es6/syntax/binding_in_when_on_syntax.d.ts +29 -0
- package/es6/syntax/binding_on_syntax.d.ts +8 -0
- package/es6/syntax/binding_to_syntax.d.ts +18 -0
- package/es6/syntax/binding_when_on_syntax.d.ts +25 -0
- package/es6/syntax/binding_when_syntax.d.ts +21 -0
- package/es6/syntax/constraint_helpers.d.ts +6 -0
- package/es6/utils/async.d.ts +3 -0
- package/es6/utils/binding_utils.d.ts +4 -0
- package/es6/utils/clonable.d.ts +3 -0
- package/es6/utils/exceptions.d.ts +2 -0
- package/es6/utils/factory_type.d.ts +5 -0
- package/es6/utils/id.d.ts +2 -0
- package/es6/utils/js.d.ts +1 -0
- package/es6/utils/serialization.d.ts +10 -0
- package/package.json +2 -2
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { interfaces } from '../interfaces/interfaces';
|
|
2
|
+
declare class Plan implements interfaces.Plan {
|
|
3
|
+
parentContext: interfaces.Context;
|
|
4
|
+
rootRequest: interfaces.Request;
|
|
5
|
+
constructor(parentContext: interfaces.Context, rootRequest: interfaces.Request);
|
|
6
|
+
}
|
|
7
|
+
export { Plan };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { interfaces } from '../interfaces/interfaces';
|
|
2
|
+
declare function getBindingDictionary(cntnr: interfaces.Container): interfaces.Lookup<interfaces.Binding<unknown>>;
|
|
3
|
+
declare function plan(metadataReader: interfaces.MetadataReader, container: interfaces.Container, isMultiInject: boolean, targetType: interfaces.TargetType, serviceIdentifier: interfaces.ServiceIdentifier, key?: string | number | symbol, value?: unknown, avoidConstraints?: boolean): interfaces.Context;
|
|
4
|
+
declare function createMockRequest(container: interfaces.Container, serviceIdentifier: interfaces.ServiceIdentifier, key: string | number | symbol, value: unknown): interfaces.Request;
|
|
5
|
+
export { plan, createMockRequest, getBindingDictionary };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { interfaces } from '../interfaces/interfaces';
|
|
2
|
+
export declare class QueryableString implements interfaces.QueryableString {
|
|
3
|
+
private readonly str;
|
|
4
|
+
constructor(str: string);
|
|
5
|
+
startsWith(searchString: string): boolean;
|
|
6
|
+
endsWith(searchString: string): boolean;
|
|
7
|
+
contains(searchString: string): boolean;
|
|
8
|
+
equals(compareString: string): boolean;
|
|
9
|
+
value(): string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { interfaces } from '../interfaces/interfaces';
|
|
2
|
+
import { getFunctionName } from '../utils/serialization';
|
|
3
|
+
declare function getDependencies(metadataReader: interfaces.MetadataReader, func: NewableFunction): interfaces.Target[];
|
|
4
|
+
declare function getBaseClassDependencyCount(metadataReader: interfaces.MetadataReader, func: NewableFunction): number;
|
|
5
|
+
export { getDependencies, getBaseClassDependencyCount, getFunctionName };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { interfaces } from '../interfaces/interfaces';
|
|
2
|
+
declare class Request implements interfaces.Request {
|
|
3
|
+
id: number;
|
|
4
|
+
serviceIdentifier: interfaces.ServiceIdentifier;
|
|
5
|
+
parentContext: interfaces.Context;
|
|
6
|
+
parentRequest: interfaces.Request | null;
|
|
7
|
+
bindings: interfaces.Binding<unknown>[];
|
|
8
|
+
childRequests: interfaces.Request[];
|
|
9
|
+
target: interfaces.Target;
|
|
10
|
+
requestScope: interfaces.RequestScope | null;
|
|
11
|
+
constructor(serviceIdentifier: interfaces.ServiceIdentifier, parentContext: interfaces.Context, parentRequest: interfaces.Request | null, bindings: interfaces.Binding<any> | interfaces.Binding<any>[], target: interfaces.Target);
|
|
12
|
+
addChildRequest(serviceIdentifier: interfaces.ServiceIdentifier, bindings: interfaces.Binding<unknown> | interfaces.Binding<unknown>[], target: interfaces.Target): interfaces.Request;
|
|
13
|
+
}
|
|
14
|
+
export { Request };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { interfaces } from '../interfaces/interfaces';
|
|
2
|
+
declare function resolveInstance<T>(binding: interfaces.Binding<T>, constr: interfaces.Newable<T>, childRequests: interfaces.Request[], resolveRequest: interfaces.ResolveRequestHandler): T | Promise<T>;
|
|
3
|
+
export { resolveInstance };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { interfaces } from '../interfaces/interfaces';
|
|
2
|
+
export declare const tryGetFromScope: <T>(requestScope: interfaces.RequestScope, binding: interfaces.Binding<T>) => T | Promise<T> | null;
|
|
3
|
+
export declare const saveToScope: <T>(requestScope: interfaces.RequestScope, binding: interfaces.Binding<T>, result: T | Promise<T>) => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { interfaces } from '../interfaces/interfaces';
|
|
2
|
+
declare class BindingInSyntax<T> implements interfaces.BindingInSyntax<T> {
|
|
3
|
+
private readonly _binding;
|
|
4
|
+
constructor(binding: interfaces.Binding<T>);
|
|
5
|
+
inRequestScope(): interfaces.BindingWhenOnSyntax<T>;
|
|
6
|
+
inSingletonScope(): interfaces.BindingWhenOnSyntax<T>;
|
|
7
|
+
inTransientScope(): interfaces.BindingWhenOnSyntax<T>;
|
|
8
|
+
}
|
|
9
|
+
export { BindingInSyntax };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { interfaces } from '../interfaces/interfaces';
|
|
2
|
+
declare class BindingInWhenOnSyntax<T> implements interfaces.BindingInSyntax<T>, interfaces.BindingWhenSyntax<T>, interfaces.BindingOnSyntax<T> {
|
|
3
|
+
private readonly _bindingInSyntax;
|
|
4
|
+
private readonly _bindingWhenSyntax;
|
|
5
|
+
private readonly _bindingOnSyntax;
|
|
6
|
+
private readonly _binding;
|
|
7
|
+
constructor(binding: interfaces.Binding<T>);
|
|
8
|
+
inRequestScope(): interfaces.BindingWhenOnSyntax<T>;
|
|
9
|
+
inSingletonScope(): interfaces.BindingWhenOnSyntax<T>;
|
|
10
|
+
inTransientScope(): interfaces.BindingWhenOnSyntax<T>;
|
|
11
|
+
when(constraint: (request: interfaces.Request) => boolean): interfaces.BindingOnSyntax<T>;
|
|
12
|
+
whenTargetNamed(name: string): interfaces.BindingOnSyntax<T>;
|
|
13
|
+
whenTargetIsDefault(): interfaces.BindingOnSyntax<T>;
|
|
14
|
+
whenTargetTagged(tag: string, value: unknown): interfaces.BindingOnSyntax<T>;
|
|
15
|
+
whenInjectedInto(parent: NewableFunction | string): interfaces.BindingOnSyntax<T>;
|
|
16
|
+
whenParentNamed(name: string): interfaces.BindingOnSyntax<T>;
|
|
17
|
+
whenParentTagged(tag: string, value: unknown): interfaces.BindingOnSyntax<T>;
|
|
18
|
+
whenAnyAncestorIs(ancestor: NewableFunction | string): interfaces.BindingOnSyntax<T>;
|
|
19
|
+
whenNoAncestorIs(ancestor: NewableFunction | string): interfaces.BindingOnSyntax<T>;
|
|
20
|
+
whenAnyAncestorNamed(name: string): interfaces.BindingOnSyntax<T>;
|
|
21
|
+
whenAnyAncestorTagged(tag: string, value: unknown): interfaces.BindingOnSyntax<T>;
|
|
22
|
+
whenNoAncestorNamed(name: string): interfaces.BindingOnSyntax<T>;
|
|
23
|
+
whenNoAncestorTagged(tag: string, value: unknown): interfaces.BindingOnSyntax<T>;
|
|
24
|
+
whenAnyAncestorMatches(constraint: (request: interfaces.Request) => boolean): interfaces.BindingOnSyntax<T>;
|
|
25
|
+
whenNoAncestorMatches(constraint: (request: interfaces.Request) => boolean): interfaces.BindingOnSyntax<T>;
|
|
26
|
+
onActivation(handler: (context: interfaces.Context, injectable: T) => T | Promise<T>): interfaces.BindingWhenSyntax<T>;
|
|
27
|
+
onDeactivation(handler: (injectable: T) => void | Promise<void>): interfaces.BindingWhenSyntax<T>;
|
|
28
|
+
}
|
|
29
|
+
export { BindingInWhenOnSyntax };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { interfaces } from '../interfaces/interfaces';
|
|
2
|
+
declare class BindingOnSyntax<T> implements interfaces.BindingOnSyntax<T> {
|
|
3
|
+
private readonly _binding;
|
|
4
|
+
constructor(binding: interfaces.Binding<T>);
|
|
5
|
+
onActivation(handler: interfaces.BindingActivation<T>): interfaces.BindingWhenSyntax<T>;
|
|
6
|
+
onDeactivation(handler: interfaces.BindingDeactivation<T>): interfaces.BindingWhenSyntax<T>;
|
|
7
|
+
}
|
|
8
|
+
export { BindingOnSyntax };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { interfaces } from '../interfaces/interfaces';
|
|
2
|
+
import { BindingWhenOnSyntax } from './binding_when_on_syntax';
|
|
3
|
+
declare class BindingToSyntax<T> implements interfaces.BindingToSyntax<T> {
|
|
4
|
+
private readonly _binding;
|
|
5
|
+
constructor(binding: interfaces.Binding<T>);
|
|
6
|
+
to(constructor: interfaces.Newable<T>): interfaces.BindingInWhenOnSyntax<T>;
|
|
7
|
+
toSelf(): interfaces.BindingInWhenOnSyntax<T>;
|
|
8
|
+
toConstantValue(value: T): interfaces.BindingWhenOnSyntax<T>;
|
|
9
|
+
toDynamicValue(func: interfaces.DynamicValue<T>): interfaces.BindingInWhenOnSyntax<T>;
|
|
10
|
+
toConstructor<T2>(constructor: interfaces.Newable<T2>): interfaces.BindingWhenOnSyntax<T>;
|
|
11
|
+
toFactory<T2>(factory: interfaces.FactoryCreator<T2>): interfaces.BindingWhenOnSyntax<T>;
|
|
12
|
+
toFunction(func: T): interfaces.BindingWhenOnSyntax<T>;
|
|
13
|
+
toAutoFactory<T2>(serviceIdentifier: interfaces.ServiceIdentifier<T2>): interfaces.BindingWhenOnSyntax<T>;
|
|
14
|
+
toAutoNamedFactory<T2>(serviceIdentifier: interfaces.ServiceIdentifier<T2>): BindingWhenOnSyntax<T>;
|
|
15
|
+
toProvider<T2>(provider: interfaces.ProviderCreator<T2>): interfaces.BindingWhenOnSyntax<T>;
|
|
16
|
+
toService(service: interfaces.ServiceIdentifier<T>): void;
|
|
17
|
+
}
|
|
18
|
+
export { BindingToSyntax };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { interfaces } from '../interfaces/interfaces';
|
|
2
|
+
declare class BindingWhenOnSyntax<T> implements interfaces.BindingWhenSyntax<T>, interfaces.BindingOnSyntax<T> {
|
|
3
|
+
private readonly _bindingWhenSyntax;
|
|
4
|
+
private readonly _bindingOnSyntax;
|
|
5
|
+
private readonly _binding;
|
|
6
|
+
constructor(binding: interfaces.Binding<T>);
|
|
7
|
+
when(constraint: (request: interfaces.Request) => boolean): interfaces.BindingOnSyntax<T>;
|
|
8
|
+
whenTargetNamed(name: string): interfaces.BindingOnSyntax<T>;
|
|
9
|
+
whenTargetIsDefault(): interfaces.BindingOnSyntax<T>;
|
|
10
|
+
whenTargetTagged(tag: string, value: unknown): interfaces.BindingOnSyntax<T>;
|
|
11
|
+
whenInjectedInto(parent: NewableFunction | string): interfaces.BindingOnSyntax<T>;
|
|
12
|
+
whenParentNamed(name: string): interfaces.BindingOnSyntax<T>;
|
|
13
|
+
whenParentTagged(tag: string, value: unknown): interfaces.BindingOnSyntax<T>;
|
|
14
|
+
whenAnyAncestorIs(ancestor: NewableFunction | string): interfaces.BindingOnSyntax<T>;
|
|
15
|
+
whenNoAncestorIs(ancestor: NewableFunction | string): interfaces.BindingOnSyntax<T>;
|
|
16
|
+
whenAnyAncestorNamed(name: string): interfaces.BindingOnSyntax<T>;
|
|
17
|
+
whenAnyAncestorTagged(tag: string, value: unknown): interfaces.BindingOnSyntax<T>;
|
|
18
|
+
whenNoAncestorNamed(name: string): interfaces.BindingOnSyntax<T>;
|
|
19
|
+
whenNoAncestorTagged(tag: string, value: unknown): interfaces.BindingOnSyntax<T>;
|
|
20
|
+
whenAnyAncestorMatches(constraint: (request: interfaces.Request) => boolean): interfaces.BindingOnSyntax<T>;
|
|
21
|
+
whenNoAncestorMatches(constraint: (request: interfaces.Request) => boolean): interfaces.BindingOnSyntax<T>;
|
|
22
|
+
onActivation(handler: (context: interfaces.Context, injectable: T) => T): interfaces.BindingWhenSyntax<T>;
|
|
23
|
+
onDeactivation(handler: (injectable: T) => Promise<void> | void): interfaces.BindingWhenSyntax<T>;
|
|
24
|
+
}
|
|
25
|
+
export { BindingWhenOnSyntax };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { interfaces } from '../interfaces/interfaces';
|
|
2
|
+
declare class BindingWhenSyntax<T> implements interfaces.BindingWhenSyntax<T> {
|
|
3
|
+
private readonly _binding;
|
|
4
|
+
constructor(binding: interfaces.Binding<T>);
|
|
5
|
+
when(constraint: (request: interfaces.Request) => boolean): interfaces.BindingOnSyntax<T>;
|
|
6
|
+
whenTargetNamed(name: string | number | symbol): interfaces.BindingOnSyntax<T>;
|
|
7
|
+
whenTargetIsDefault(): interfaces.BindingOnSyntax<T>;
|
|
8
|
+
whenTargetTagged(tag: string | number | symbol, value: unknown): interfaces.BindingOnSyntax<T>;
|
|
9
|
+
whenInjectedInto(parent: NewableFunction | string): interfaces.BindingOnSyntax<T>;
|
|
10
|
+
whenParentNamed(name: string | number | symbol): interfaces.BindingOnSyntax<T>;
|
|
11
|
+
whenParentTagged(tag: string | number | symbol, value: unknown): interfaces.BindingOnSyntax<T>;
|
|
12
|
+
whenAnyAncestorIs(ancestor: NewableFunction | string): interfaces.BindingOnSyntax<T>;
|
|
13
|
+
whenNoAncestorIs(ancestor: NewableFunction | string): interfaces.BindingOnSyntax<T>;
|
|
14
|
+
whenAnyAncestorNamed(name: string | number | symbol): interfaces.BindingOnSyntax<T>;
|
|
15
|
+
whenNoAncestorNamed(name: string | number | symbol): interfaces.BindingOnSyntax<T>;
|
|
16
|
+
whenAnyAncestorTagged(tag: string | number | symbol, value: unknown): interfaces.BindingOnSyntax<T>;
|
|
17
|
+
whenNoAncestorTagged(tag: string | number | symbol, value: unknown): interfaces.BindingOnSyntax<T>;
|
|
18
|
+
whenAnyAncestorMatches(constraint: (request: interfaces.Request) => boolean): interfaces.BindingOnSyntax<T>;
|
|
19
|
+
whenNoAncestorMatches(constraint: (request: interfaces.Request) => boolean): interfaces.BindingOnSyntax<T>;
|
|
20
|
+
}
|
|
21
|
+
export { BindingWhenSyntax };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { interfaces } from '../interfaces/interfaces';
|
|
2
|
+
declare const traverseAncerstors: (request: interfaces.Request, constraint: interfaces.ConstraintFunction) => boolean;
|
|
3
|
+
declare const taggedConstraint: (key: string | number | symbol) => (value: unknown) => interfaces.ConstraintFunction;
|
|
4
|
+
declare const namedConstraint: (value: unknown) => interfaces.ConstraintFunction;
|
|
5
|
+
declare const typeConstraint: (type: NewableFunction | string) => (request: interfaces.Request | null) => boolean;
|
|
6
|
+
export { traverseAncerstors, taggedConstraint, namedConstraint, typeConstraint, };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { interfaces } from '../interfaces/interfaces';
|
|
2
|
+
export declare const multiBindToService: (container: interfaces.Container) => (service: interfaces.ServiceIdentifier) => (...types: interfaces.ServiceIdentifier[]) => void;
|
|
3
|
+
export declare const ensureFullyBound: <T = unknown>(binding: interfaces.Binding<T>) => void;
|
|
4
|
+
export declare const getFactoryDetails: <T = unknown>(binding: interfaces.Binding<T>) => interfaces.FactoryDetails;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getFirstArrayDuplicate<T>(array: T[]): T | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { interfaces } from '../interfaces/interfaces';
|
|
2
|
+
declare function getServiceIdentifierAsString(serviceIdentifier: interfaces.ServiceIdentifier): string;
|
|
3
|
+
declare function listRegisteredBindingsForServiceIdentifier(container: interfaces.Container, serviceIdentifier: string, getBindings: <T>(container: interfaces.Container, serviceIdentifier: interfaces.ServiceIdentifier<T>) => interfaces.Binding<T>[]): string;
|
|
4
|
+
declare function circularDependencyToException(request: interfaces.Request): void;
|
|
5
|
+
declare function listMetadataForTarget(serviceIdentifierString: string, target: interfaces.Target): string;
|
|
6
|
+
declare function getFunctionName(func: {
|
|
7
|
+
name: string | null | undefined;
|
|
8
|
+
}): string;
|
|
9
|
+
declare function getSymbolDescription(symbol: symbol): string;
|
|
10
|
+
export { getFunctionName, getServiceIdentifierAsString, listRegisteredBindingsForServiceIdentifier, listMetadataForTarget, circularDependencyToException, getSymbolDescription, };
|
|
@@ -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
|
+
prototype: Prototype<T>;
|
|
9
|
+
new (...args: unknown[]): 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,5 @@
|
|
|
1
|
+
import { LazyServiceIdentifier } from '@inversifyjs/common';
|
|
2
|
+
import { interfaces } from '../interfaces/interfaces';
|
|
3
|
+
import { DecoratorTarget } from './decorator_utils';
|
|
4
|
+
declare const inject: <T = unknown>(serviceIdentifier: interfaces.ServiceIdentifier<T> | LazyServiceIdentifier<T>) => (target: DecoratorTarget, targetKey?: string | symbol, indexOrPropertyDescriptor?: number | TypedPropertyDescriptor<T>) => void;
|
|
5
|
+
export { inject };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { LazyServiceIdentifier } from '@inversifyjs/common';
|
|
2
|
+
import { interfaces } from '../interfaces/interfaces';
|
|
3
|
+
import { DecoratorTarget } from './decorator_utils';
|
|
4
|
+
export declare function injectBase(metadataKey: string): <T = unknown>(serviceIdentifier: interfaces.ServiceIdentifier<T> | LazyServiceIdentifier<T>) => (target: DecoratorTarget, targetKey?: string | symbol, indexOrPropertyDescriptor?: number | TypedPropertyDescriptor<T>) => void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { LazyServiceIdentifier } from '@inversifyjs/common';
|
|
2
|
+
import { interfaces } from '../interfaces/interfaces';
|
|
3
|
+
import { DecoratorTarget } from './decorator_utils';
|
|
4
|
+
declare const multiInject: <T = unknown>(serviceIdentifier: interfaces.ServiceIdentifier<T> | LazyServiceIdentifier<T>) => (target: DecoratorTarget, targetKey?: string | symbol, indexOrPropertyDescriptor?: number | TypedPropertyDescriptor<T>) => void;
|
|
5
|
+
export { multiInject };
|
|
@@ -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,30 @@
|
|
|
1
|
+
export declare const DUPLICATED_INJECTABLE_DECORATOR: string;
|
|
2
|
+
export declare const DUPLICATED_METADATA: string;
|
|
3
|
+
export declare const NULL_ARGUMENT: string;
|
|
4
|
+
export declare const KEY_NOT_FOUND: string;
|
|
5
|
+
export declare const AMBIGUOUS_MATCH: string;
|
|
6
|
+
export declare const CANNOT_UNBIND: string;
|
|
7
|
+
export declare const NOT_REGISTERED: string;
|
|
8
|
+
export declare const MISSING_INJECTABLE_ANNOTATION: string;
|
|
9
|
+
export declare const UNDEFINED_INJECT_ANNOTATION: (name: string) => string;
|
|
10
|
+
export declare const CIRCULAR_DEPENDENCY: string;
|
|
11
|
+
export declare const INVALID_BINDING_TYPE: string;
|
|
12
|
+
export declare const NO_MORE_SNAPSHOTS_AVAILABLE: string;
|
|
13
|
+
export declare const INVALID_MIDDLEWARE_RETURN: string;
|
|
14
|
+
export declare const INVALID_FUNCTION_BINDING: string;
|
|
15
|
+
export declare const LAZY_IN_SYNC: (key: unknown) => string;
|
|
16
|
+
export declare const INVALID_TO_SELF_VALUE: string;
|
|
17
|
+
export declare const INVALID_DECORATOR_OPERATION: string;
|
|
18
|
+
export declare const ARGUMENTS_LENGTH_MISMATCH: (name: string) => string;
|
|
19
|
+
export declare const CONTAINER_OPTIONS_MUST_BE_AN_OBJECT: string;
|
|
20
|
+
export declare const CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE: string;
|
|
21
|
+
export declare const CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE: string;
|
|
22
|
+
export declare const CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK: string;
|
|
23
|
+
export declare const MULTIPLE_PRE_DESTROY_METHODS: string;
|
|
24
|
+
export declare const MULTIPLE_POST_CONSTRUCT_METHODS: string;
|
|
25
|
+
export declare const ASYNC_UNBIND_REQUIRED: string;
|
|
26
|
+
export declare const POST_CONSTRUCT_ERROR: (clazz: string, errorMessage: string) => string;
|
|
27
|
+
export declare const PRE_DESTROY_ERROR: (clazz: string, errorMessage: string) => string;
|
|
28
|
+
export declare const ON_DEACTIVATION_ERROR: (clazz: string, errorMessage: string) => string;
|
|
29
|
+
export declare const CIRCULAR_DEPENDENCY_IN_FACTORY: (factoryType: string, serviceIdentifier: string) => string;
|
|
30
|
+
export declare const STACK_OVERFLOW: string;
|
|
@@ -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: string;
|
|
2
|
+
export declare const NAME_TAG: string;
|
|
3
|
+
export declare const UNMANAGED_TAG: string;
|
|
4
|
+
export declare const OPTIONAL_TAG: string;
|
|
5
|
+
export declare const INJECT_TAG: string;
|
|
6
|
+
export declare const MULTI_INJECT_TAG: string;
|
|
7
|
+
export declare const TAGGED: string;
|
|
8
|
+
export declare const TAGGED_PROP: string;
|
|
9
|
+
export declare const PARAM_TYPES: string;
|
|
10
|
+
export declare const DESIGN_PARAM_TYPES: string;
|
|
11
|
+
export declare const POST_CONSTRUCT: string;
|
|
12
|
+
export declare const PRE_DESTROY: string;
|
|
13
|
+
export declare const NON_CUSTOM_TAG_KEYS: 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 readonly _snapshots;
|
|
11
|
+
private _metadataReader;
|
|
12
|
+
private _moduleActivationStore;
|
|
13
|
+
constructor(containerOptions?: interfaces.ContainerOptions);
|
|
14
|
+
static merge(container1: interfaces.Container, container2: interfaces.Container, ...containers: interfaces.Container[]): interfaces.Container;
|
|
15
|
+
load(...modules: interfaces.ContainerModule[]): void;
|
|
16
|
+
loadAsync(...modules: interfaces.AsyncContainerModule[]): Promise<void>;
|
|
17
|
+
unload(...modules: interfaces.ContainerModuleBase[]): void;
|
|
18
|
+
unloadAsync(...modules: 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: 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>): T[];
|
|
44
|
+
getAllAsync<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>): Promise<T[]>;
|
|
45
|
+
getAllTagged<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>, key: string | number | symbol, value: unknown): T[];
|
|
46
|
+
getAllTaggedAsync<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>, key: string | number | symbol, value: unknown): Promise<T[]>;
|
|
47
|
+
getAllNamed<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>, named: string | number | symbol): T[];
|
|
48
|
+
getAllNamedAsync<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>, named: string | number | symbol): Promise<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,17 @@
|
|
|
1
|
+
import { interfaces } from '../interfaces/interfaces';
|
|
2
|
+
declare class Lookup<T> implements interfaces.Lookup<T> {
|
|
3
|
+
private readonly _map;
|
|
4
|
+
constructor();
|
|
5
|
+
getMap(): Map<interfaces.ServiceIdentifier<unknown>, T[]>;
|
|
6
|
+
add(serviceIdentifier: interfaces.ServiceIdentifier, value: T): void;
|
|
7
|
+
get(serviceIdentifier: interfaces.ServiceIdentifier): T[];
|
|
8
|
+
remove(serviceIdentifier: interfaces.ServiceIdentifier): void;
|
|
9
|
+
removeIntersection(lookup: interfaces.Lookup<T>): void;
|
|
10
|
+
removeByCondition(condition: (item: T) => boolean): T[];
|
|
11
|
+
hasKey(serviceIdentifier: interfaces.ServiceIdentifier): boolean;
|
|
12
|
+
clone(): interfaces.Lookup<T>;
|
|
13
|
+
traverse(func: (key: interfaces.ServiceIdentifier, value: T[]) => void): void;
|
|
14
|
+
private _checkNonNulish;
|
|
15
|
+
private _setValue;
|
|
16
|
+
}
|
|
17
|
+
export { Lookup };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { interfaces } from '../interfaces/interfaces';
|
|
2
|
+
export declare class ModuleActivationStore implements interfaces.ModuleActivationStore {
|
|
3
|
+
private readonly _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
|
+
}
|