inversify 5.1.0 → 5.1.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/.nyc_output/{9608da81-ca67-4100-9d7e-60d47b391c2b.json → 4df1ad3a-a319-42b9-bb65-746cefa3318e.json} +1 -1
- package/.nyc_output/processinfo/{9608da81-ca67-4100-9d7e-60d47b391c2b.json → 4df1ad3a-a319-42b9-bb65-746cefa3318e.json} +1 -1
- package/.nyc_output/processinfo/index.json +1 -1
- package/CHANGELOG.md +4 -1
- package/amd/annotation/decorator_utils.js +60 -0
- package/amd/annotation/decorator_utils.js.map +1 -0
- package/amd/annotation/inject.js +31 -0
- package/amd/annotation/inject.js.map +1 -0
- package/amd/annotation/injectable.js +17 -0
- package/amd/annotation/injectable.js.map +1 -0
- package/amd/annotation/multi_inject.js +18 -0
- package/amd/annotation/multi_inject.js.map +1 -0
- package/amd/annotation/named.js +18 -0
- package/amd/annotation/named.js.map +1 -0
- package/amd/annotation/optional.js +18 -0
- package/amd/annotation/optional.js.map +1 -0
- package/amd/annotation/post_construct.js +16 -0
- package/amd/annotation/post_construct.js.map +1 -0
- package/amd/annotation/tagged.js +18 -0
- package/amd/annotation/tagged.js.map +1 -0
- package/amd/annotation/target_name.js +13 -0
- package/amd/annotation/target_name.js.map +1 -0
- package/amd/annotation/unmanaged.js +13 -0
- package/amd/annotation/unmanaged.js.map +1 -0
- package/amd/bindings/binding.js +38 -0
- package/amd/bindings/binding.js.map +1 -0
- package/amd/bindings/binding_count.js +12 -0
- package/amd/bindings/binding_count.js.map +1 -0
- package/amd/constants/error_msgs.js +68 -0
- package/amd/constants/error_msgs.js.map +1 -0
- package/amd/constants/literal_types.js +29 -0
- package/amd/constants/literal_types.js.map +1 -0
- package/amd/constants/metadata_keys.js +28 -0
- package/amd/constants/metadata_keys.js.map +1 -0
- package/amd/container/container.js +332 -0
- package/amd/container/container.js.map +1 -0
- package/amd/container/container_module.js +22 -0
- package/amd/container/container_module.js.map +1 -0
- package/amd/container/container_snapshot.js +18 -0
- package/amd/container/container_snapshot.js.map +1 -0
- package/amd/container/lookup.js +82 -0
- package/amd/container/lookup.js.map +1 -0
- package/amd/interfaces/interfaces.js +5 -0
- package/amd/interfaces/interfaces.js.map +1 -0
- package/amd/inversify.js +32 -0
- package/amd/inversify.js.map +1 -0
- package/amd/planning/context.js +20 -0
- package/amd/planning/context.js.map +1 -0
- package/amd/planning/metadata.js +22 -0
- package/amd/planning/metadata.js.map +1 -0
- package/amd/planning/metadata_reader.js +24 -0
- package/amd/planning/metadata_reader.js.map +1 -0
- package/amd/planning/plan.js +14 -0
- package/amd/planning/plan.js.map +1 -0
- package/amd/planning/planner.js +147 -0
- package/amd/planning/planner.js.map +1 -0
- package/amd/planning/queryable_string.js +31 -0
- package/amd/planning/queryable_string.js.map +1 -0
- package/amd/planning/reflection_utils.js +128 -0
- package/amd/planning/reflection_utils.js.map +1 -0
- package/amd/planning/request.js +27 -0
- package/amd/planning/request.js.map +1 -0
- package/amd/planning/target.js +80 -0
- package/amd/planning/target.js.map +1 -0
- package/amd/resolution/instantiation.js +56 -0
- package/amd/resolution/instantiation.js.map +1 -0
- package/amd/resolution/resolver.js +99 -0
- package/amd/resolution/resolver.js.map +1 -0
- package/amd/syntax/binding_in_syntax.js +25 -0
- package/amd/syntax/binding_in_syntax.js.map +1 -0
- package/amd/syntax/binding_in_when_on_syntax.js +73 -0
- package/amd/syntax/binding_in_when_on_syntax.js.map +1 -0
- package/amd/syntax/binding_on_syntax.js +17 -0
- package/amd/syntax/binding_on_syntax.js.map +1 -0
- package/amd/syntax/binding_to_syntax.js +79 -0
- package/amd/syntax/binding_to_syntax.js.map +1 -0
- package/amd/syntax/binding_when_on_syntax.js +63 -0
- package/amd/syntax/binding_when_on_syntax.js.map +1 -0
- package/amd/syntax/binding_when_syntax.js +100 -0
- package/amd/syntax/binding_when_syntax.js.map +1 -0
- package/amd/syntax/constraint_helpers.js +42 -0
- package/amd/syntax/constraint_helpers.js.map +1 -0
- package/amd/utils/binding_utils.js +18 -0
- package/amd/utils/binding_utils.js.map +1 -0
- package/amd/utils/exceptions.js +11 -0
- package/amd/utils/exceptions.js.map +1 -0
- package/amd/utils/id.js +11 -0
- package/amd/utils/id.js.map +1 -0
- package/amd/utils/serialization.js +106 -0
- package/amd/utils/serialization.js.map +1 -0
- package/es/annotation/decorator_utils.js +55 -0
- package/es/annotation/decorator_utils.js.map +1 -0
- package/es/annotation/inject.js +30 -0
- package/es/annotation/inject.js.map +1 -0
- package/es/annotation/injectable.js +14 -0
- package/es/annotation/injectable.js.map +1 -0
- package/es/annotation/multi_inject.js +16 -0
- package/es/annotation/multi_inject.js.map +1 -0
- package/es/annotation/named.js +16 -0
- package/es/annotation/named.js.map +1 -0
- package/es/annotation/optional.js +16 -0
- package/es/annotation/optional.js.map +1 -0
- package/es/annotation/post_construct.js +14 -0
- package/es/annotation/post_construct.js.map +1 -0
- package/es/annotation/tagged.js +15 -0
- package/es/annotation/tagged.js.map +1 -0
- package/es/annotation/target_name.js +11 -0
- package/es/annotation/target_name.js.map +1 -0
- package/es/annotation/unmanaged.js +11 -0
- package/es/annotation/unmanaged.js.map +1 -0
- package/es/bindings/binding.js +35 -0
- package/es/bindings/binding.js.map +1 -0
- package/es/bindings/binding_count.js +7 -0
- package/es/bindings/binding_count.js.map +1 -0
- package/es/constants/error_msgs.js +59 -0
- package/es/constants/error_msgs.js.map +1 -0
- package/es/constants/literal_types.js +22 -0
- package/es/constants/literal_types.js.map +1 -0
- package/es/constants/metadata_keys.js +23 -0
- package/es/constants/metadata_keys.js.map +1 -0
- package/es/container/container.js +339 -0
- package/es/container/container.js.map +1 -0
- package/es/container/container_module.js +18 -0
- package/es/container/container_module.js.map +1 -0
- package/es/container/container_snapshot.js +13 -0
- package/es/container/container_snapshot.js.map +1 -0
- package/es/container/lookup.js +78 -0
- package/es/container/lookup.js.map +1 -0
- package/es/interfaces/interfaces.js +2 -0
- package/es/interfaces/interfaces.js.map +1 -0
- package/es/inversify.js +21 -0
- package/es/inversify.js.map +1 -0
- package/es/planning/context.js +16 -0
- package/es/planning/context.js.map +1 -0
- package/es/planning/metadata.js +18 -0
- package/es/planning/metadata.js.map +1 -0
- package/es/planning/metadata_reader.js +20 -0
- package/es/planning/metadata_reader.js.map +1 -0
- package/es/planning/plan.js +9 -0
- package/es/planning/plan.js.map +1 -0
- package/es/planning/planner.js +152 -0
- package/es/planning/planner.js.map +1 -0
- package/es/planning/queryable_string.js +26 -0
- package/es/planning/queryable_string.js.map +1 -0
- package/es/planning/reflection_utils.js +127 -0
- package/es/planning/reflection_utils.js.map +1 -0
- package/es/planning/request.js +23 -0
- package/es/planning/request.js.map +1 -0
- package/es/planning/target.js +79 -0
- package/es/planning/target.js.map +1 -0
- package/es/resolution/instantiation.js +54 -0
- package/es/resolution/instantiation.js.map +1 -0
- package/es/resolution/resolver.js +99 -0
- package/es/resolution/resolver.js.map +1 -0
- package/es/syntax/binding_in_syntax.js +22 -0
- package/es/syntax/binding_in_syntax.js.map +1 -0
- package/es/syntax/binding_in_when_on_syntax.js +71 -0
- package/es/syntax/binding_in_when_on_syntax.js.map +1 -0
- package/es/syntax/binding_on_syntax.js +13 -0
- package/es/syntax/binding_on_syntax.js.map +1 -0
- package/es/syntax/binding_to_syntax.js +78 -0
- package/es/syntax/binding_to_syntax.js.map +1 -0
- package/es/syntax/binding_when_on_syntax.js +60 -0
- package/es/syntax/binding_when_on_syntax.js.map +1 -0
- package/es/syntax/binding_when_syntax.js +97 -0
- package/es/syntax/binding_when_syntax.js.map +1 -0
- package/es/syntax/constraint_helpers.js +36 -0
- package/es/syntax/constraint_helpers.js.map +1 -0
- package/es/utils/binding_utils.js +12 -0
- package/es/utils/binding_utils.js.map +1 -0
- package/es/utils/exceptions.js +6 -0
- package/es/utils/exceptions.js.map +1 -0
- package/es/utils/id.js +6 -0
- package/es/utils/id.js.map +1 -0
- package/es/utils/serialization.js +98 -0
- package/es/utils/serialization.js.map +1 -0
- package/es6/annotation/decorator_utils.js +59 -0
- package/es6/annotation/decorator_utils.js.map +1 -0
- package/es6/annotation/inject.js +32 -0
- package/es6/annotation/inject.js.map +1 -0
- package/es6/annotation/injectable.js +17 -0
- package/es6/annotation/injectable.js.map +1 -0
- package/es6/annotation/multi_inject.js +19 -0
- package/es6/annotation/multi_inject.js.map +1 -0
- package/es6/annotation/named.js +19 -0
- package/es6/annotation/named.js.map +1 -0
- package/es6/annotation/optional.js +19 -0
- package/es6/annotation/optional.js.map +1 -0
- package/es6/annotation/post_construct.js +17 -0
- package/es6/annotation/post_construct.js.map +1 -0
- package/es6/annotation/tagged.js +18 -0
- package/es6/annotation/tagged.js.map +1 -0
- package/es6/annotation/target_name.js +14 -0
- package/es6/annotation/target_name.js.map +1 -0
- package/es6/annotation/unmanaged.js +14 -0
- package/es6/annotation/unmanaged.js.map +1 -0
- package/es6/bindings/binding.js +37 -0
- package/es6/bindings/binding.js.map +1 -0
- package/es6/bindings/binding_count.js +10 -0
- package/es6/bindings/binding_count.js.map +1 -0
- package/es6/constants/error_msgs.js +46 -0
- package/es6/constants/error_msgs.js.map +1 -0
- package/es6/constants/literal_types.js +27 -0
- package/es6/constants/literal_types.js.map +1 -0
- package/es6/constants/metadata_keys.js +26 -0
- package/es6/constants/metadata_keys.js.map +1 -0
- package/es6/container/container.js +260 -0
- package/es6/container/container.js.map +1 -0
- package/es6/container/container_module.js +19 -0
- package/es6/container/container_module.js.map +1 -0
- package/es6/container/container_snapshot.js +13 -0
- package/es6/container/container_snapshot.js.map +1 -0
- package/es6/container/lookup.js +79 -0
- package/es6/container/lookup.js.map +1 -0
- package/es6/interfaces/interfaces.js +3 -0
- package/es6/interfaces/interfaces.js.map +1 -0
- package/es6/inversify.js +49 -0
- package/es6/inversify.js.map +1 -0
- package/es6/planning/context.js +18 -0
- package/es6/planning/context.js.map +1 -0
- package/es6/planning/metadata.js +20 -0
- package/es6/planning/metadata.js.map +1 -0
- package/es6/planning/metadata_reader.js +20 -0
- package/es6/planning/metadata_reader.js.map +1 -0
- package/es6/planning/plan.js +11 -0
- package/es6/planning/plan.js.map +1 -0
- package/es6/planning/planner.js +156 -0
- package/es6/planning/planner.js.map +1 -0
- package/es6/planning/queryable_string.js +28 -0
- package/es6/planning/queryable_string.js.map +1 -0
- package/es6/planning/reflection_utils.js +128 -0
- package/es6/planning/reflection_utils.js.map +1 -0
- package/es6/planning/request.js +25 -0
- package/es6/planning/request.js.map +1 -0
- package/es6/planning/target.js +78 -0
- package/es6/planning/target.js.map +1 -0
- package/es6/resolution/instantiation.js +48 -0
- package/es6/resolution/instantiation.js.map +1 -0
- package/es6/resolution/resolver.js +100 -0
- package/es6/resolution/resolver.js.map +1 -0
- package/es6/syntax/binding_in_syntax.js +24 -0
- package/es6/syntax/binding_in_syntax.js.map +1 -0
- package/es6/syntax/binding_in_when_on_syntax.js +73 -0
- package/es6/syntax/binding_in_when_on_syntax.js.map +1 -0
- package/es6/syntax/binding_on_syntax.js +15 -0
- package/es6/syntax/binding_on_syntax.js.map +1 -0
- package/es6/syntax/binding_to_syntax.js +80 -0
- package/es6/syntax/binding_to_syntax.js.map +1 -0
- package/es6/syntax/binding_when_on_syntax.js +62 -0
- package/es6/syntax/binding_when_on_syntax.js.map +1 -0
- package/es6/syntax/binding_when_syntax.js +77 -0
- package/es6/syntax/binding_when_syntax.js.map +1 -0
- package/es6/syntax/constraint_helpers.js +40 -0
- package/es6/syntax/constraint_helpers.js.map +1 -0
- package/es6/utils/binding_utils.js +6 -0
- package/es6/utils/binding_utils.js.map +1 -0
- package/es6/utils/exceptions.js +10 -0
- package/es6/utils/exceptions.js.map +1 -0
- package/es6/utils/id.js +9 -0
- package/es6/utils/id.js.map +1 -0
- package/es6/utils/serialization.js +104 -0
- package/es6/utils/serialization.js.map +1 -0
- package/lib/annotation/decorator_utils.d.ts +5 -0
- package/lib/annotation/decorator_utils.js +60 -0
- package/lib/annotation/decorator_utils.js.map +1 -0
- package/lib/annotation/inject.d.ts +9 -0
- package/lib/annotation/inject.js +33 -0
- package/lib/annotation/inject.js.map +1 -0
- package/lib/annotation/injectable.d.ts +2 -0
- package/lib/annotation/injectable.js +17 -0
- package/lib/annotation/injectable.js.map +1 -0
- package/lib/annotation/multi_inject.d.ts +3 -0
- package/lib/annotation/multi_inject.js +19 -0
- package/lib/annotation/multi_inject.js.map +1 -0
- package/lib/annotation/named.d.ts +2 -0
- package/lib/annotation/named.js +19 -0
- package/lib/annotation/named.js.map +1 -0
- package/lib/annotation/optional.d.ts +2 -0
- package/lib/annotation/optional.js +19 -0
- package/lib/annotation/optional.js.map +1 -0
- package/lib/annotation/post_construct.d.ts +2 -0
- package/lib/annotation/post_construct.js +17 -0
- package/lib/annotation/post_construct.js.map +1 -0
- package/lib/annotation/tagged.d.ts +2 -0
- package/lib/annotation/tagged.js +18 -0
- package/lib/annotation/tagged.js.map +1 -0
- package/lib/annotation/target_name.d.ts +2 -0
- package/lib/annotation/target_name.js +14 -0
- package/lib/annotation/target_name.js.map +1 -0
- package/lib/annotation/unmanaged.d.ts +2 -0
- package/lib/annotation/unmanaged.js +14 -0
- package/lib/annotation/unmanaged.js.map +1 -0
- package/lib/bindings/binding.d.ts +19 -0
- package/lib/bindings/binding.js +38 -0
- package/lib/bindings/binding.js.map +1 -0
- package/lib/bindings/binding_count.d.ts +6 -0
- package/lib/bindings/binding_count.js +10 -0
- package/lib/bindings/binding_count.js.map +1 -0
- package/lib/constants/error_msgs.d.ts +27 -0
- package/lib/constants/error_msgs.js +66 -0
- package/lib/constants/error_msgs.js.map +1 -0
- package/lib/constants/literal_types.d.ts +5 -0
- package/lib/constants/literal_types.js +27 -0
- package/lib/constants/literal_types.js.map +1 -0
- package/lib/constants/metadata_keys.d.ts +12 -0
- package/lib/constants/metadata_keys.js +26 -0
- package/lib/constants/metadata_keys.js.map +1 -0
- package/lib/container/container.d.ts +39 -0
- package/lib/container/container.js +342 -0
- package/lib/container/container.js.map +1 -0
- package/lib/container/container_module.d.ts +11 -0
- package/lib/container/container_module.js +21 -0
- package/lib/container/container_module.js.map +1 -0
- package/lib/container/container_snapshot.d.ts +7 -0
- package/lib/container/container_snapshot.js +16 -0
- package/lib/container/container_snapshot.js.map +1 -0
- package/lib/container/lookup.d.ts +14 -0
- package/lib/container/lookup.js +81 -0
- package/lib/container/lookup.js.map +1 -0
- package/lib/interfaces/interfaces.d.ts +237 -0
- package/lib/interfaces/interfaces.js +3 -0
- package/lib/interfaces/interfaces.js.map +1 -0
- package/lib/inversify.d.ts +21 -0
- package/lib/inversify.js +49 -0
- package/lib/inversify.js.map +1 -0
- package/lib/planning/context.d.ts +11 -0
- package/lib/planning/context.js +19 -0
- package/lib/planning/context.js.map +1 -0
- package/lib/planning/metadata.d.ts +8 -0
- package/lib/planning/metadata.js +21 -0
- package/lib/planning/metadata.js.map +1 -0
- package/lib/planning/metadata_reader.d.ts +6 -0
- package/lib/planning/metadata_reader.js +23 -0
- package/lib/planning/metadata_reader.js.map +1 -0
- package/lib/planning/plan.d.ts +7 -0
- package/lib/planning/plan.js +12 -0
- package/lib/planning/plan.js.map +1 -0
- package/lib/planning/planner.d.ts +5 -0
- package/lib/planning/planner.js +157 -0
- package/lib/planning/planner.js.map +1 -0
- package/lib/planning/queryable_string.d.ts +11 -0
- package/lib/planning/queryable_string.js +29 -0
- package/lib/planning/queryable_string.js.map +1 -0
- package/lib/planning/reflection_utils.d.ts +5 -0
- package/lib/planning/reflection_utils.js +132 -0
- package/lib/planning/reflection_utils.js.map +1 -0
- package/lib/planning/request.d.ts +14 -0
- package/lib/planning/request.js +26 -0
- package/lib/planning/request.js.map +1 -0
- package/lib/planning/target.d.ts +21 -0
- package/lib/planning/target.js +82 -0
- package/lib/planning/target.js.map +1 -0
- package/lib/resolution/instantiation.d.ts +3 -0
- package/lib/resolution/instantiation.js +57 -0
- package/lib/resolution/instantiation.js.map +1 -0
- package/lib/resolution/resolver.d.ts +3 -0
- package/lib/resolution/resolver.js +102 -0
- package/lib/resolution/resolver.js.map +1 -0
- package/lib/syntax/binding_in_syntax.d.ts +9 -0
- package/lib/syntax/binding_in_syntax.js +25 -0
- package/lib/syntax/binding_in_syntax.js.map +1 -0
- package/lib/syntax/binding_in_when_on_syntax.d.ts +28 -0
- package/lib/syntax/binding_in_when_on_syntax.js +74 -0
- package/lib/syntax/binding_in_when_on_syntax.js.map +1 -0
- package/lib/syntax/binding_on_syntax.d.ts +7 -0
- package/lib/syntax/binding_on_syntax.js +16 -0
- package/lib/syntax/binding_on_syntax.js.map +1 -0
- package/lib/syntax/binding_to_syntax.d.ts +16 -0
- package/lib/syntax/binding_to_syntax.js +81 -0
- package/lib/syntax/binding_to_syntax.js.map +1 -0
- package/lib/syntax/binding_when_on_syntax.d.ts +24 -0
- package/lib/syntax/binding_when_on_syntax.js +63 -0
- package/lib/syntax/binding_when_on_syntax.js.map +1 -0
- package/lib/syntax/binding_when_syntax.d.ts +21 -0
- package/lib/syntax/binding_when_syntax.js +100 -0
- package/lib/syntax/binding_when_syntax.js.map +1 -0
- package/lib/syntax/constraint_helpers.d.ts +6 -0
- package/lib/syntax/constraint_helpers.js +42 -0
- package/lib/syntax/constraint_helpers.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +719 -0
- package/lib/utils/binding_utils.d.ts +2 -0
- package/lib/utils/binding_utils.js +16 -0
- package/lib/utils/binding_utils.js.map +1 -0
- package/lib/utils/exceptions.d.ts +1 -0
- package/lib/utils/exceptions.js +10 -0
- package/lib/utils/exceptions.js.map +1 -0
- package/lib/utils/id.d.ts +2 -0
- package/lib/utils/id.js +9 -0
- package/lib/utils/id.js.map +1 -0
- package/lib/utils/serialization.d.ts +7 -0
- package/lib/utils/serialization.js +105 -0
- package/lib/utils/serialization.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { interfaces } from "../interfaces/interfaces";
|
|
2
|
+
declare class Binding<T> implements interfaces.Binding<T> {
|
|
3
|
+
id: number;
|
|
4
|
+
moduleId: string;
|
|
5
|
+
activated: boolean;
|
|
6
|
+
serviceIdentifier: interfaces.ServiceIdentifier<T>;
|
|
7
|
+
implementationType: interfaces.Newable<T> | null;
|
|
8
|
+
cache: T | null;
|
|
9
|
+
dynamicValue: ((context: interfaces.Context) => T) | null;
|
|
10
|
+
scope: interfaces.BindingScope;
|
|
11
|
+
type: interfaces.BindingType;
|
|
12
|
+
factory: interfaces.FactoryCreator<T> | null;
|
|
13
|
+
provider: interfaces.ProviderCreator<T> | null;
|
|
14
|
+
constraint: (request: interfaces.Request) => boolean;
|
|
15
|
+
onActivation: ((context: interfaces.Context, injectable: T) => T) | null;
|
|
16
|
+
constructor(serviceIdentifier: interfaces.ServiceIdentifier<T>, scope: interfaces.BindingScope);
|
|
17
|
+
clone(): interfaces.Binding<T>;
|
|
18
|
+
}
|
|
19
|
+
export { Binding };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Binding = void 0;
|
|
4
|
+
var literal_types_1 = require("../constants/literal_types");
|
|
5
|
+
var id_1 = require("../utils/id");
|
|
6
|
+
var Binding = (function () {
|
|
7
|
+
function Binding(serviceIdentifier, scope) {
|
|
8
|
+
this.id = id_1.id();
|
|
9
|
+
this.activated = false;
|
|
10
|
+
this.serviceIdentifier = serviceIdentifier;
|
|
11
|
+
this.scope = scope;
|
|
12
|
+
this.type = literal_types_1.BindingTypeEnum.Invalid;
|
|
13
|
+
this.constraint = function (request) { return true; };
|
|
14
|
+
this.implementationType = null;
|
|
15
|
+
this.cache = null;
|
|
16
|
+
this.factory = null;
|
|
17
|
+
this.provider = null;
|
|
18
|
+
this.onActivation = null;
|
|
19
|
+
this.dynamicValue = null;
|
|
20
|
+
}
|
|
21
|
+
Binding.prototype.clone = function () {
|
|
22
|
+
var clone = new Binding(this.serviceIdentifier, this.scope);
|
|
23
|
+
clone.activated = (clone.scope === literal_types_1.BindingScopeEnum.Singleton) ? this.activated : false;
|
|
24
|
+
clone.implementationType = this.implementationType;
|
|
25
|
+
clone.dynamicValue = this.dynamicValue;
|
|
26
|
+
clone.scope = this.scope;
|
|
27
|
+
clone.type = this.type;
|
|
28
|
+
clone.factory = this.factory;
|
|
29
|
+
clone.provider = this.provider;
|
|
30
|
+
clone.constraint = this.constraint;
|
|
31
|
+
clone.onActivation = this.onActivation;
|
|
32
|
+
clone.cache = this.cache;
|
|
33
|
+
return clone;
|
|
34
|
+
};
|
|
35
|
+
return Binding;
|
|
36
|
+
}());
|
|
37
|
+
exports.Binding = Binding;
|
|
38
|
+
//# sourceMappingURL=binding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binding.js","sourceRoot":"","sources":["../../src/bindings/binding.ts"],"names":[],"mappings":";;;AAAA,4DAA+E;AAE/E,kCAAiC;AAEjC;IAwCI,iBAAmB,iBAAkD,EAAE,KAA8B;QACjG,IAAI,CAAC,EAAE,GAAG,OAAE,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,+BAAe,CAAC,OAAO,CAAC;QACpC,IAAI,CAAC,UAAU,GAAG,UAAC,OAA2B,IAAK,OAAA,IAAI,EAAJ,CAAI,CAAC;QACxD,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;IAC7B,CAAC;IAEM,uBAAK,GAAZ;QACI,IAAM,KAAK,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC9D,KAAK,CAAC,SAAS,GAAG,CAAC,KAAK,CAAC,KAAK,KAAK,gCAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC;QACxF,KAAK,CAAC,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,CAAC;QACnD,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QACvC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACvB,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QACnC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QACvC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,OAAO,KAAK,CAAC;IACjB,CAAC;IAEL,cAAC;AAAD,CAAC,AAtED,IAsEC;AAEQ,0BAAO"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BindingCount = void 0;
|
|
4
|
+
var BindingCount = {
|
|
5
|
+
MultipleBindingsAvailable: 2,
|
|
6
|
+
NoBindingsAvailable: 0,
|
|
7
|
+
OnlyOneBindingAvailable: 1
|
|
8
|
+
};
|
|
9
|
+
exports.BindingCount = BindingCount;
|
|
10
|
+
//# sourceMappingURL=binding_count.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binding_count.js","sourceRoot":"","sources":["../../src/bindings/binding_count.ts"],"names":[],"mappings":";;;AAAA,IAAM,YAAY,GAAG;IACjB,yBAAyB,EAAE,CAAC;IAC5B,mBAAmB,EAAE,CAAC;IACtB,uBAAuB,EAAE,CAAC;CAC7B,CAAC;AAEO,oCAAY"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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 INVALID_TO_SELF_VALUE: string;
|
|
18
|
+
export declare const INVALID_DECORATOR_OPERATION: string;
|
|
19
|
+
export declare const ARGUMENTS_LENGTH_MISMATCH: (...values: any[]) => string;
|
|
20
|
+
export declare const CONTAINER_OPTIONS_MUST_BE_AN_OBJECT: string;
|
|
21
|
+
export declare const CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE: string;
|
|
22
|
+
export declare const CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE: string;
|
|
23
|
+
export declare const CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK: string;
|
|
24
|
+
export declare const MULTIPLE_POST_CONSTRUCT_METHODS = "Cannot apply @postConstruct decorator multiple times in the same class";
|
|
25
|
+
export declare const POST_CONSTRUCT_ERROR: (...values: any[]) => string;
|
|
26
|
+
export declare const CIRCULAR_DEPENDENCY_IN_FACTORY: (...values: any[]) => string;
|
|
27
|
+
export declare const STACK_OVERFLOW = "Maximum call stack size exceeded";
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.STACK_OVERFLOW = exports.CIRCULAR_DEPENDENCY_IN_FACTORY = exports.POST_CONSTRUCT_ERROR = exports.MULTIPLE_POST_CONSTRUCT_METHODS = exports.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK = exports.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE = exports.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE = exports.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT = exports.ARGUMENTS_LENGTH_MISMATCH = exports.INVALID_DECORATOR_OPERATION = exports.INVALID_TO_SELF_VALUE = exports.INVALID_FUNCTION_BINDING = exports.INVALID_MIDDLEWARE_RETURN = exports.NO_MORE_SNAPSHOTS_AVAILABLE = exports.INVALID_BINDING_TYPE = exports.NOT_IMPLEMENTED = exports.CIRCULAR_DEPENDENCY = exports.UNDEFINED_INJECT_ANNOTATION = exports.MISSING_INJECT_ANNOTATION = exports.MISSING_INJECTABLE_ANNOTATION = exports.NOT_REGISTERED = exports.CANNOT_UNBIND = exports.AMBIGUOUS_MATCH = exports.KEY_NOT_FOUND = exports.NULL_ARGUMENT = exports.DUPLICATED_METADATA = exports.DUPLICATED_INJECTABLE_DECORATOR = void 0;
|
|
4
|
+
exports.DUPLICATED_INJECTABLE_DECORATOR = "Cannot apply @injectable decorator multiple times.";
|
|
5
|
+
exports.DUPLICATED_METADATA = "Metadata key was used more than once in a parameter:";
|
|
6
|
+
exports.NULL_ARGUMENT = "NULL argument";
|
|
7
|
+
exports.KEY_NOT_FOUND = "Key Not Found";
|
|
8
|
+
exports.AMBIGUOUS_MATCH = "Ambiguous match found for serviceIdentifier:";
|
|
9
|
+
exports.CANNOT_UNBIND = "Could not unbind serviceIdentifier:";
|
|
10
|
+
exports.NOT_REGISTERED = "No matching bindings found for serviceIdentifier:";
|
|
11
|
+
exports.MISSING_INJECTABLE_ANNOTATION = "Missing required @injectable annotation in:";
|
|
12
|
+
exports.MISSING_INJECT_ANNOTATION = "Missing required @inject or @multiInject annotation in:";
|
|
13
|
+
var UNDEFINED_INJECT_ANNOTATION = function (name) {
|
|
14
|
+
return "@inject called with undefined this could mean that the class " + name + " has " +
|
|
15
|
+
"a circular dependency problem. You can use a LazyServiceIdentifer to " +
|
|
16
|
+
"overcome this limitation.";
|
|
17
|
+
};
|
|
18
|
+
exports.UNDEFINED_INJECT_ANNOTATION = UNDEFINED_INJECT_ANNOTATION;
|
|
19
|
+
exports.CIRCULAR_DEPENDENCY = "Circular dependency found:";
|
|
20
|
+
exports.NOT_IMPLEMENTED = "Sorry, this feature is not fully implemented yet.";
|
|
21
|
+
exports.INVALID_BINDING_TYPE = "Invalid binding type:";
|
|
22
|
+
exports.NO_MORE_SNAPSHOTS_AVAILABLE = "No snapshot available to restore.";
|
|
23
|
+
exports.INVALID_MIDDLEWARE_RETURN = "Invalid return type in middleware. Middleware must return!";
|
|
24
|
+
exports.INVALID_FUNCTION_BINDING = "Value provided to function binding must be a function!";
|
|
25
|
+
exports.INVALID_TO_SELF_VALUE = "The toSelf function can only be applied when a constructor is " +
|
|
26
|
+
"used as service identifier";
|
|
27
|
+
exports.INVALID_DECORATOR_OPERATION = "The @inject @multiInject @tagged and @named decorators " +
|
|
28
|
+
"must be applied to the parameters of a class constructor or a class property.";
|
|
29
|
+
var ARGUMENTS_LENGTH_MISMATCH = function () {
|
|
30
|
+
var values = [];
|
|
31
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
32
|
+
values[_i] = arguments[_i];
|
|
33
|
+
}
|
|
34
|
+
return "The number of constructor arguments in the derived class " +
|
|
35
|
+
(values[0] + " must be >= than the number of constructor arguments of its base class.");
|
|
36
|
+
};
|
|
37
|
+
exports.ARGUMENTS_LENGTH_MISMATCH = ARGUMENTS_LENGTH_MISMATCH;
|
|
38
|
+
exports.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT = "Invalid Container constructor argument. Container options " +
|
|
39
|
+
"must be an object.";
|
|
40
|
+
exports.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE = "Invalid Container option. Default scope must " +
|
|
41
|
+
"be a string ('singleton' or 'transient').";
|
|
42
|
+
exports.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE = "Invalid Container option. Auto bind injectable must " +
|
|
43
|
+
"be a boolean";
|
|
44
|
+
exports.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK = "Invalid Container option. Skip base check must " +
|
|
45
|
+
"be a boolean";
|
|
46
|
+
exports.MULTIPLE_POST_CONSTRUCT_METHODS = "Cannot apply @postConstruct decorator multiple times in the same class";
|
|
47
|
+
var POST_CONSTRUCT_ERROR = function () {
|
|
48
|
+
var values = [];
|
|
49
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
50
|
+
values[_i] = arguments[_i];
|
|
51
|
+
}
|
|
52
|
+
return "@postConstruct error in class " + values[0] + ": " + values[1];
|
|
53
|
+
};
|
|
54
|
+
exports.POST_CONSTRUCT_ERROR = POST_CONSTRUCT_ERROR;
|
|
55
|
+
var CIRCULAR_DEPENDENCY_IN_FACTORY = function () {
|
|
56
|
+
var values = [];
|
|
57
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
58
|
+
values[_i] = arguments[_i];
|
|
59
|
+
}
|
|
60
|
+
return "It looks like there is a circular dependency " +
|
|
61
|
+
("in one of the '" + values[0] + "' bindings. Please investigate bindings with") +
|
|
62
|
+
("service identifier '" + values[1] + "'.");
|
|
63
|
+
};
|
|
64
|
+
exports.CIRCULAR_DEPENDENCY_IN_FACTORY = CIRCULAR_DEPENDENCY_IN_FACTORY;
|
|
65
|
+
exports.STACK_OVERFLOW = "Maximum call stack size exceeded";
|
|
66
|
+
//# sourceMappingURL=error_msgs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error_msgs.js","sourceRoot":"","sources":["../../src/constants/error_msgs.ts"],"names":[],"mappings":";;;AAAa,QAAA,+BAA+B,GAAG,oDAAoD,CAAC;AACvF,QAAA,mBAAmB,GAAG,sDAAsD,CAAC;AAC7E,QAAA,aAAa,GAAG,eAAe,CAAC;AAChC,QAAA,aAAa,GAAG,eAAe,CAAC;AAChC,QAAA,eAAe,GAAG,8CAA8C,CAAC;AACjE,QAAA,aAAa,GAAG,qCAAqC,CAAC;AACtD,QAAA,cAAc,GAAG,mDAAmD,CAAC;AACrE,QAAA,6BAA6B,GAAG,6CAA6C,CAAC;AAC9E,QAAA,yBAAyB,GAAG,yDAAyD,CAAC;AAC5F,IAAM,2BAA2B,GAAG,UAAC,IAAY;IAC5C,OAAA,kEAAgE,IAAI,UAAO;QAC3E,wEAAwE;QACxE,2BAA2B;AAF3B,CAE2B,CAAC;AAH3B,QAAA,2BAA2B,+BAGA;AAC3B,QAAA,mBAAmB,GAAG,4BAA4B,CAAC;AACnD,QAAA,eAAe,GAAG,mDAAmD,CAAC;AACtE,QAAA,oBAAoB,GAAG,uBAAuB,CAAC;AAC/C,QAAA,2BAA2B,GAAG,mCAAmC,CAAC;AAClE,QAAA,yBAAyB,GAAG,4DAA4D,CAAC;AACzF,QAAA,wBAAwB,GAAG,wDAAwD,CAAC;AAEpF,QAAA,qBAAqB,GAAG,gEAAgE;IACjG,4BAA4B,CAAC;AAEpB,QAAA,2BAA2B,GAAG,yDAAyD;IAChG,+EAA+E,CAAC;AAE7E,IAAM,yBAAyB,GAAG;IAAC,gBAAgB;SAAhB,UAAgB,EAAhB,qBAAgB,EAAhB,IAAgB;QAAhB,2BAAgB;;IAAK,OAAA,2DAA2D;SACnH,MAAM,CAAC,CAAC,CAAC,4EAAyE,CAAA;AAD1B,CAC0B,CAAC;AAD7E,QAAA,yBAAyB,6BACoD;AAE7E,QAAA,mCAAmC,GAAG,4DAA4D;IAC3G,oBAAoB,CAAC;AAEZ,QAAA,uCAAuC,GAAG,+CAA+C;IAClG,2CAA2C,CAAC;AAEnC,QAAA,8CAA8C,GAAG,sDAAsD;IAChH,cAAc,CAAC;AAEN,QAAA,yCAAyC,GAAG,iDAAiD;IACtG,cAAc,CAAC;AAEN,QAAA,+BAA+B,GAAG,wEAAwE,CAAC;AACjH,IAAM,oBAAoB,GAAG;IAAC,gBAAgB;SAAhB,UAAgB,EAAhB,qBAAgB,EAAhB,IAAgB;QAAhB,2BAAgB;;IAAK,OAAA,mCAAiC,MAAM,CAAC,CAAC,CAAC,UAAK,MAAM,CAAC,CAAC,CAAG;AAA1D,CAA0D,CAAC;AAAxG,QAAA,oBAAoB,wBAAoF;AAE9G,IAAM,8BAA8B,GAAG;IAAC,gBAAgB;SAAhB,UAAgB,EAAhB,qBAAgB,EAAhB,IAAgB;QAAhB,2BAAgB;;IAAM,OAAA,+CAA+C;SAChH,oBAAkB,MAAM,CAAC,CAAC,CAAC,iDAA8C,CAAA;SACzE,yBAAuB,MAAM,CAAC,CAAC,CAAC,OAAI,CAAA;AAF6B,CAE7B,CAAC;AAF5B,QAAA,8BAA8B,kCAEF;AAE5B,QAAA,cAAc,GAAG,kCAAkC,CAAC"}
|
|
@@ -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,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TargetTypeEnum = exports.BindingTypeEnum = exports.BindingScopeEnum = void 0;
|
|
4
|
+
var BindingScopeEnum = {
|
|
5
|
+
Request: "Request",
|
|
6
|
+
Singleton: "Singleton",
|
|
7
|
+
Transient: "Transient"
|
|
8
|
+
};
|
|
9
|
+
exports.BindingScopeEnum = BindingScopeEnum;
|
|
10
|
+
var BindingTypeEnum = {
|
|
11
|
+
ConstantValue: "ConstantValue",
|
|
12
|
+
Constructor: "Constructor",
|
|
13
|
+
DynamicValue: "DynamicValue",
|
|
14
|
+
Factory: "Factory",
|
|
15
|
+
Function: "Function",
|
|
16
|
+
Instance: "Instance",
|
|
17
|
+
Invalid: "Invalid",
|
|
18
|
+
Provider: "Provider"
|
|
19
|
+
};
|
|
20
|
+
exports.BindingTypeEnum = BindingTypeEnum;
|
|
21
|
+
var TargetTypeEnum = {
|
|
22
|
+
ClassProperty: "ClassProperty",
|
|
23
|
+
ConstructorArgument: "ConstructorArgument",
|
|
24
|
+
Variable: "Variable"
|
|
25
|
+
};
|
|
26
|
+
exports.TargetTypeEnum = TargetTypeEnum;
|
|
27
|
+
//# sourceMappingURL=literal_types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"literal_types.js","sourceRoot":"","sources":["../../src/constants/literal_types.ts"],"names":[],"mappings":";;;AAEA,IAAM,gBAAgB,GAAgC;IAClD,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;CACzB,CAAC;AAmBO,4CAAgB;AAjBzB,IAAM,eAAe,GAA+B;IAChD,aAAa,EAAE,eAAe;IAC9B,WAAW,EAAE,aAAa;IAC1B,YAAY,EAAE,cAAc;IAC5B,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;CACvB,CAAC;AAQyB,0CAAe;AAN1C,IAAM,cAAc,GAA8B;IAC9C,aAAa,EAAE,eAAe;IAC9B,mBAAmB,EAAE,qBAAqB;IAC1C,QAAQ,EAAE,UAAU;CACvB,CAAC;AAE0C,wCAAc"}
|
|
@@ -0,0 +1,12 @@
|
|
|
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 NON_CUSTOM_TAG_KEYS: string[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NON_CUSTOM_TAG_KEYS = exports.POST_CONSTRUCT = exports.DESIGN_PARAM_TYPES = exports.PARAM_TYPES = exports.TAGGED_PROP = exports.TAGGED = exports.MULTI_INJECT_TAG = exports.INJECT_TAG = exports.OPTIONAL_TAG = exports.UNMANAGED_TAG = exports.NAME_TAG = exports.NAMED_TAG = void 0;
|
|
4
|
+
exports.NAMED_TAG = "named";
|
|
5
|
+
exports.NAME_TAG = "name";
|
|
6
|
+
exports.UNMANAGED_TAG = "unmanaged";
|
|
7
|
+
exports.OPTIONAL_TAG = "optional";
|
|
8
|
+
exports.INJECT_TAG = "inject";
|
|
9
|
+
exports.MULTI_INJECT_TAG = "multi_inject";
|
|
10
|
+
exports.TAGGED = "inversify:tagged";
|
|
11
|
+
exports.TAGGED_PROP = "inversify:tagged_props";
|
|
12
|
+
exports.PARAM_TYPES = "inversify:paramtypes";
|
|
13
|
+
exports.DESIGN_PARAM_TYPES = "design:paramtypes";
|
|
14
|
+
exports.POST_CONSTRUCT = "post_construct";
|
|
15
|
+
function getNonCustomTagKeys() {
|
|
16
|
+
return [
|
|
17
|
+
exports.INJECT_TAG,
|
|
18
|
+
exports.MULTI_INJECT_TAG,
|
|
19
|
+
exports.NAME_TAG,
|
|
20
|
+
exports.UNMANAGED_TAG,
|
|
21
|
+
exports.NAMED_TAG,
|
|
22
|
+
exports.OPTIONAL_TAG,
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
exports.NON_CUSTOM_TAG_KEYS = getNonCustomTagKeys();
|
|
26
|
+
//# sourceMappingURL=metadata_keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata_keys.js","sourceRoot":"","sources":["../../src/constants/metadata_keys.ts"],"names":[],"mappings":";;;AACa,QAAA,SAAS,GAAG,OAAO,CAAC;AAGpB,QAAA,QAAQ,GAAG,MAAM,CAAC;AAGlB,QAAA,aAAa,GAAG,WAAW,CAAC;AAG5B,QAAA,YAAY,GAAG,UAAU,CAAC;AAG1B,QAAA,UAAU,GAAG,QAAQ,CAAC;AAGtB,QAAA,gBAAgB,GAAG,cAAc,CAAC;AAGlC,QAAA,MAAM,GAAG,kBAAkB,CAAC;AAG5B,QAAA,WAAW,GAAG,wBAAwB,CAAC;AAGvC,QAAA,WAAW,GAAG,sBAAsB,CAAC;AAGrC,QAAA,kBAAkB,GAAG,mBAAmB,CAAC;AAGzC,QAAA,cAAc,GAAG,gBAAgB,CAAC;AAE/C,SAAS,mBAAmB;IACxB,OAAO;QACH,kBAAU;QACV,wBAAgB;QAChB,gBAAQ;QACR,qBAAa;QACb,iBAAS;QACT,oBAAY;KACf,CAAC;AACN,CAAC;AAEY,QAAA,mBAAmB,GAAa,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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 _snapshots;
|
|
9
|
+
private _metadataReader;
|
|
10
|
+
private _appliedMiddleware;
|
|
11
|
+
static merge(container1: interfaces.Container, container2: interfaces.Container, ...container3: interfaces.Container[]): interfaces.Container;
|
|
12
|
+
constructor(containerOptions?: interfaces.ContainerOptions);
|
|
13
|
+
load(...modules: interfaces.ContainerModule[]): void;
|
|
14
|
+
loadAsync(...modules: interfaces.AsyncContainerModule[]): Promise<void>;
|
|
15
|
+
unload(...modules: interfaces.ContainerModule[]): void;
|
|
16
|
+
bind<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>): interfaces.BindingToSyntax<T>;
|
|
17
|
+
rebind<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>): interfaces.BindingToSyntax<T>;
|
|
18
|
+
unbind(serviceIdentifier: interfaces.ServiceIdentifier<any>): void;
|
|
19
|
+
unbindAll(): void;
|
|
20
|
+
isBound(serviceIdentifier: interfaces.ServiceIdentifier<any>): boolean;
|
|
21
|
+
isBoundNamed(serviceIdentifier: interfaces.ServiceIdentifier<any>, named: string | number | symbol): boolean;
|
|
22
|
+
isBoundTagged(serviceIdentifier: interfaces.ServiceIdentifier<any>, key: string | number | symbol, value: any): boolean;
|
|
23
|
+
snapshot(): void;
|
|
24
|
+
restore(): void;
|
|
25
|
+
createChild(containerOptions?: interfaces.ContainerOptions): Container;
|
|
26
|
+
applyMiddleware(...middlewares: interfaces.Middleware[]): void;
|
|
27
|
+
applyCustomMetadataReader(metadataReader: interfaces.MetadataReader): void;
|
|
28
|
+
get<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>): T;
|
|
29
|
+
getTagged<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>, key: string | number | symbol, value: any): T;
|
|
30
|
+
getNamed<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>, named: string | number | symbol): T;
|
|
31
|
+
getAll<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>): T[];
|
|
32
|
+
getAllTagged<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>, key: string | number | symbol, value: any): T[];
|
|
33
|
+
getAllNamed<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>, named: string | number | symbol): T[];
|
|
34
|
+
resolve<T>(constructorFunction: interfaces.Newable<T>): T;
|
|
35
|
+
private _getContainerModuleHelpersFactory;
|
|
36
|
+
private _get;
|
|
37
|
+
private _planAndResolve;
|
|
38
|
+
}
|
|
39
|
+
export { Container };
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
39
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
40
|
+
to[j] = from[i];
|
|
41
|
+
return to;
|
|
42
|
+
};
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.Container = void 0;
|
|
45
|
+
var binding_1 = require("../bindings/binding");
|
|
46
|
+
var ERROR_MSGS = require("../constants/error_msgs");
|
|
47
|
+
var literal_types_1 = require("../constants/literal_types");
|
|
48
|
+
var METADATA_KEY = require("../constants/metadata_keys");
|
|
49
|
+
var metadata_reader_1 = require("../planning/metadata_reader");
|
|
50
|
+
var planner_1 = require("../planning/planner");
|
|
51
|
+
var resolver_1 = require("../resolution/resolver");
|
|
52
|
+
var binding_to_syntax_1 = require("../syntax/binding_to_syntax");
|
|
53
|
+
var id_1 = require("../utils/id");
|
|
54
|
+
var serialization_1 = require("../utils/serialization");
|
|
55
|
+
var container_snapshot_1 = require("./container_snapshot");
|
|
56
|
+
var lookup_1 = require("./lookup");
|
|
57
|
+
var Container = (function () {
|
|
58
|
+
function Container(containerOptions) {
|
|
59
|
+
this._appliedMiddleware = [];
|
|
60
|
+
var options = containerOptions || {};
|
|
61
|
+
if (typeof options !== "object") {
|
|
62
|
+
throw new Error("" + ERROR_MSGS.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT);
|
|
63
|
+
}
|
|
64
|
+
if (options.defaultScope === undefined) {
|
|
65
|
+
options.defaultScope = literal_types_1.BindingScopeEnum.Transient;
|
|
66
|
+
}
|
|
67
|
+
else if (options.defaultScope !== literal_types_1.BindingScopeEnum.Singleton &&
|
|
68
|
+
options.defaultScope !== literal_types_1.BindingScopeEnum.Transient &&
|
|
69
|
+
options.defaultScope !== literal_types_1.BindingScopeEnum.Request) {
|
|
70
|
+
throw new Error("" + ERROR_MSGS.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE);
|
|
71
|
+
}
|
|
72
|
+
if (options.autoBindInjectable === undefined) {
|
|
73
|
+
options.autoBindInjectable = false;
|
|
74
|
+
}
|
|
75
|
+
else if (typeof options.autoBindInjectable !== "boolean") {
|
|
76
|
+
throw new Error("" + ERROR_MSGS.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE);
|
|
77
|
+
}
|
|
78
|
+
if (options.skipBaseClassChecks === undefined) {
|
|
79
|
+
options.skipBaseClassChecks = false;
|
|
80
|
+
}
|
|
81
|
+
else if (typeof options.skipBaseClassChecks !== "boolean") {
|
|
82
|
+
throw new Error("" + ERROR_MSGS.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK);
|
|
83
|
+
}
|
|
84
|
+
this.options = {
|
|
85
|
+
autoBindInjectable: options.autoBindInjectable,
|
|
86
|
+
defaultScope: options.defaultScope,
|
|
87
|
+
skipBaseClassChecks: options.skipBaseClassChecks
|
|
88
|
+
};
|
|
89
|
+
this.id = id_1.id();
|
|
90
|
+
this._bindingDictionary = new lookup_1.Lookup();
|
|
91
|
+
this._snapshots = [];
|
|
92
|
+
this._middleware = null;
|
|
93
|
+
this.parent = null;
|
|
94
|
+
this._metadataReader = new metadata_reader_1.MetadataReader();
|
|
95
|
+
}
|
|
96
|
+
Container.merge = function (container1, container2) {
|
|
97
|
+
var container3 = [];
|
|
98
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
99
|
+
container3[_i - 2] = arguments[_i];
|
|
100
|
+
}
|
|
101
|
+
var container = new Container();
|
|
102
|
+
var targetContainers = __spreadArray([container1, container2], container3).map(function (targetContainer) { return planner_1.getBindingDictionary(targetContainer); });
|
|
103
|
+
var bindingDictionary = planner_1.getBindingDictionary(container);
|
|
104
|
+
function copyDictionary(origin, destination) {
|
|
105
|
+
origin.traverse(function (key, value) {
|
|
106
|
+
value.forEach(function (binding) {
|
|
107
|
+
destination.add(binding.serviceIdentifier, binding.clone());
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
targetContainers.forEach(function (targetBindingDictionary) {
|
|
112
|
+
copyDictionary(targetBindingDictionary, bindingDictionary);
|
|
113
|
+
});
|
|
114
|
+
return container;
|
|
115
|
+
};
|
|
116
|
+
Container.prototype.load = function () {
|
|
117
|
+
var modules = [];
|
|
118
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
119
|
+
modules[_i] = arguments[_i];
|
|
120
|
+
}
|
|
121
|
+
var getHelpers = this._getContainerModuleHelpersFactory();
|
|
122
|
+
for (var _a = 0, modules_1 = modules; _a < modules_1.length; _a++) {
|
|
123
|
+
var currentModule = modules_1[_a];
|
|
124
|
+
var containerModuleHelpers = getHelpers(currentModule.id);
|
|
125
|
+
currentModule.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
Container.prototype.loadAsync = function () {
|
|
129
|
+
var modules = [];
|
|
130
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
131
|
+
modules[_i] = arguments[_i];
|
|
132
|
+
}
|
|
133
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
134
|
+
var getHelpers, _a, modules_2, currentModule, containerModuleHelpers;
|
|
135
|
+
return __generator(this, function (_b) {
|
|
136
|
+
switch (_b.label) {
|
|
137
|
+
case 0:
|
|
138
|
+
getHelpers = this._getContainerModuleHelpersFactory();
|
|
139
|
+
_a = 0, modules_2 = modules;
|
|
140
|
+
_b.label = 1;
|
|
141
|
+
case 1:
|
|
142
|
+
if (!(_a < modules_2.length)) return [3, 4];
|
|
143
|
+
currentModule = modules_2[_a];
|
|
144
|
+
containerModuleHelpers = getHelpers(currentModule.id);
|
|
145
|
+
return [4, currentModule.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction)];
|
|
146
|
+
case 2:
|
|
147
|
+
_b.sent();
|
|
148
|
+
_b.label = 3;
|
|
149
|
+
case 3:
|
|
150
|
+
_a++;
|
|
151
|
+
return [3, 1];
|
|
152
|
+
case 4: return [2];
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
Container.prototype.unload = function () {
|
|
158
|
+
var _this = this;
|
|
159
|
+
var modules = [];
|
|
160
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
161
|
+
modules[_i] = arguments[_i];
|
|
162
|
+
}
|
|
163
|
+
var conditionFactory = function (expected) { return function (item) {
|
|
164
|
+
return item.moduleId === expected;
|
|
165
|
+
}; };
|
|
166
|
+
modules.forEach(function (module) {
|
|
167
|
+
var condition = conditionFactory(module.id);
|
|
168
|
+
_this._bindingDictionary.removeByCondition(condition);
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
Container.prototype.bind = function (serviceIdentifier) {
|
|
172
|
+
var scope = this.options.defaultScope || literal_types_1.BindingScopeEnum.Transient;
|
|
173
|
+
var binding = new binding_1.Binding(serviceIdentifier, scope);
|
|
174
|
+
this._bindingDictionary.add(serviceIdentifier, binding);
|
|
175
|
+
return new binding_to_syntax_1.BindingToSyntax(binding);
|
|
176
|
+
};
|
|
177
|
+
Container.prototype.rebind = function (serviceIdentifier) {
|
|
178
|
+
this.unbind(serviceIdentifier);
|
|
179
|
+
return this.bind(serviceIdentifier);
|
|
180
|
+
};
|
|
181
|
+
Container.prototype.unbind = function (serviceIdentifier) {
|
|
182
|
+
try {
|
|
183
|
+
this._bindingDictionary.remove(serviceIdentifier);
|
|
184
|
+
}
|
|
185
|
+
catch (e) {
|
|
186
|
+
throw new Error(ERROR_MSGS.CANNOT_UNBIND + " " + serialization_1.getServiceIdentifierAsString(serviceIdentifier));
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
Container.prototype.unbindAll = function () {
|
|
190
|
+
this._bindingDictionary = new lookup_1.Lookup();
|
|
191
|
+
};
|
|
192
|
+
Container.prototype.isBound = function (serviceIdentifier) {
|
|
193
|
+
var bound = this._bindingDictionary.hasKey(serviceIdentifier);
|
|
194
|
+
if (!bound && this.parent) {
|
|
195
|
+
bound = this.parent.isBound(serviceIdentifier);
|
|
196
|
+
}
|
|
197
|
+
return bound;
|
|
198
|
+
};
|
|
199
|
+
Container.prototype.isBoundNamed = function (serviceIdentifier, named) {
|
|
200
|
+
return this.isBoundTagged(serviceIdentifier, METADATA_KEY.NAMED_TAG, named);
|
|
201
|
+
};
|
|
202
|
+
Container.prototype.isBoundTagged = function (serviceIdentifier, key, value) {
|
|
203
|
+
var bound = false;
|
|
204
|
+
if (this._bindingDictionary.hasKey(serviceIdentifier)) {
|
|
205
|
+
var bindings = this._bindingDictionary.get(serviceIdentifier);
|
|
206
|
+
var request_1 = planner_1.createMockRequest(this, serviceIdentifier, key, value);
|
|
207
|
+
bound = bindings.some(function (b) { return b.constraint(request_1); });
|
|
208
|
+
}
|
|
209
|
+
if (!bound && this.parent) {
|
|
210
|
+
bound = this.parent.isBoundTagged(serviceIdentifier, key, value);
|
|
211
|
+
}
|
|
212
|
+
return bound;
|
|
213
|
+
};
|
|
214
|
+
Container.prototype.snapshot = function () {
|
|
215
|
+
this._snapshots.push(container_snapshot_1.ContainerSnapshot.of(this._bindingDictionary.clone(), this._middleware));
|
|
216
|
+
};
|
|
217
|
+
Container.prototype.restore = function () {
|
|
218
|
+
var snapshot = this._snapshots.pop();
|
|
219
|
+
if (snapshot === undefined) {
|
|
220
|
+
throw new Error(ERROR_MSGS.NO_MORE_SNAPSHOTS_AVAILABLE);
|
|
221
|
+
}
|
|
222
|
+
this._bindingDictionary = snapshot.bindings;
|
|
223
|
+
this._middleware = snapshot.middleware;
|
|
224
|
+
};
|
|
225
|
+
Container.prototype.createChild = function (containerOptions) {
|
|
226
|
+
var child = new Container(containerOptions || this.options);
|
|
227
|
+
child.parent = this;
|
|
228
|
+
return child;
|
|
229
|
+
};
|
|
230
|
+
Container.prototype.applyMiddleware = function () {
|
|
231
|
+
var middlewares = [];
|
|
232
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
233
|
+
middlewares[_i] = arguments[_i];
|
|
234
|
+
}
|
|
235
|
+
this._appliedMiddleware = this._appliedMiddleware.concat(middlewares);
|
|
236
|
+
var initial = (this._middleware) ? this._middleware : this._planAndResolve();
|
|
237
|
+
this._middleware = middlewares.reduce(function (prev, curr) { return curr(prev); }, initial);
|
|
238
|
+
};
|
|
239
|
+
Container.prototype.applyCustomMetadataReader = function (metadataReader) {
|
|
240
|
+
this._metadataReader = metadataReader;
|
|
241
|
+
};
|
|
242
|
+
Container.prototype.get = function (serviceIdentifier) {
|
|
243
|
+
return this._get(false, false, literal_types_1.TargetTypeEnum.Variable, serviceIdentifier);
|
|
244
|
+
};
|
|
245
|
+
Container.prototype.getTagged = function (serviceIdentifier, key, value) {
|
|
246
|
+
return this._get(false, false, literal_types_1.TargetTypeEnum.Variable, serviceIdentifier, key, value);
|
|
247
|
+
};
|
|
248
|
+
Container.prototype.getNamed = function (serviceIdentifier, named) {
|
|
249
|
+
return this.getTagged(serviceIdentifier, METADATA_KEY.NAMED_TAG, named);
|
|
250
|
+
};
|
|
251
|
+
Container.prototype.getAll = function (serviceIdentifier) {
|
|
252
|
+
return this._get(true, true, literal_types_1.TargetTypeEnum.Variable, serviceIdentifier);
|
|
253
|
+
};
|
|
254
|
+
Container.prototype.getAllTagged = function (serviceIdentifier, key, value) {
|
|
255
|
+
return this._get(false, true, literal_types_1.TargetTypeEnum.Variable, serviceIdentifier, key, value);
|
|
256
|
+
};
|
|
257
|
+
Container.prototype.getAllNamed = function (serviceIdentifier, named) {
|
|
258
|
+
return this.getAllTagged(serviceIdentifier, METADATA_KEY.NAMED_TAG, named);
|
|
259
|
+
};
|
|
260
|
+
Container.prototype.resolve = function (constructorFunction) {
|
|
261
|
+
var tempContainer = this.createChild();
|
|
262
|
+
tempContainer.bind(constructorFunction).toSelf();
|
|
263
|
+
this._appliedMiddleware.forEach(function (m) {
|
|
264
|
+
tempContainer.applyMiddleware(m);
|
|
265
|
+
});
|
|
266
|
+
return tempContainer.get(constructorFunction);
|
|
267
|
+
};
|
|
268
|
+
Container.prototype._getContainerModuleHelpersFactory = function () {
|
|
269
|
+
var _this = this;
|
|
270
|
+
var setModuleId = function (bindingToSyntax, moduleId) {
|
|
271
|
+
bindingToSyntax._binding.moduleId = moduleId;
|
|
272
|
+
};
|
|
273
|
+
var getBindFunction = function (moduleId) {
|
|
274
|
+
return function (serviceIdentifier) {
|
|
275
|
+
var _bind = _this.bind.bind(_this);
|
|
276
|
+
var bindingToSyntax = _bind(serviceIdentifier);
|
|
277
|
+
setModuleId(bindingToSyntax, moduleId);
|
|
278
|
+
return bindingToSyntax;
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
var getUnbindFunction = function (moduleId) {
|
|
282
|
+
return function (serviceIdentifier) {
|
|
283
|
+
var _unbind = _this.unbind.bind(_this);
|
|
284
|
+
_unbind(serviceIdentifier);
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
var getIsboundFunction = function (moduleId) {
|
|
288
|
+
return function (serviceIdentifier) {
|
|
289
|
+
var _isBound = _this.isBound.bind(_this);
|
|
290
|
+
return _isBound(serviceIdentifier);
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
var getRebindFunction = function (moduleId) {
|
|
294
|
+
return function (serviceIdentifier) {
|
|
295
|
+
var _rebind = _this.rebind.bind(_this);
|
|
296
|
+
var bindingToSyntax = _rebind(serviceIdentifier);
|
|
297
|
+
setModuleId(bindingToSyntax, moduleId);
|
|
298
|
+
return bindingToSyntax;
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
return function (mId) { return ({
|
|
302
|
+
bindFunction: getBindFunction(mId),
|
|
303
|
+
isboundFunction: getIsboundFunction(mId),
|
|
304
|
+
rebindFunction: getRebindFunction(mId),
|
|
305
|
+
unbindFunction: getUnbindFunction(mId)
|
|
306
|
+
}); };
|
|
307
|
+
};
|
|
308
|
+
Container.prototype._get = function (avoidConstraints, isMultiInject, targetType, serviceIdentifier, key, value) {
|
|
309
|
+
var result = null;
|
|
310
|
+
var defaultArgs = {
|
|
311
|
+
avoidConstraints: avoidConstraints,
|
|
312
|
+
contextInterceptor: function (context) { return context; },
|
|
313
|
+
isMultiInject: isMultiInject,
|
|
314
|
+
key: key,
|
|
315
|
+
serviceIdentifier: serviceIdentifier,
|
|
316
|
+
targetType: targetType,
|
|
317
|
+
value: value
|
|
318
|
+
};
|
|
319
|
+
if (this._middleware) {
|
|
320
|
+
result = this._middleware(defaultArgs);
|
|
321
|
+
if (result === undefined || result === null) {
|
|
322
|
+
throw new Error(ERROR_MSGS.INVALID_MIDDLEWARE_RETURN);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
result = this._planAndResolve()(defaultArgs);
|
|
327
|
+
}
|
|
328
|
+
return result;
|
|
329
|
+
};
|
|
330
|
+
Container.prototype._planAndResolve = function () {
|
|
331
|
+
var _this = this;
|
|
332
|
+
return function (args) {
|
|
333
|
+
var context = planner_1.plan(_this._metadataReader, _this, args.isMultiInject, args.targetType, args.serviceIdentifier, args.key, args.value, args.avoidConstraints);
|
|
334
|
+
context = args.contextInterceptor(context);
|
|
335
|
+
var result = resolver_1.resolve(context);
|
|
336
|
+
return result;
|
|
337
|
+
};
|
|
338
|
+
};
|
|
339
|
+
return Container;
|
|
340
|
+
}());
|
|
341
|
+
exports.Container = Container;
|
|
342
|
+
//# sourceMappingURL=container.js.map
|