@adaas/a-concept 0.1.24 → 0.1.25
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/dist/index.cjs +3 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +3952 -0
- package/dist/index.d.ts +3952 -50
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +5 -6
- package/src/global/A-Abstraction/A-Abstraction-Extend.decorator.ts +2 -1
- package/src/global/A-Context/A-Context.class.ts +81 -7
- package/src/global/A-Context/A-Context.error.ts +4 -0
- package/src/global/A-Dependency/A-Dependency-Default.decorator.ts +75 -0
- package/src/global/A-Dependency/A-Dependency-Load.decorator.ts +80 -0
- package/src/global/A-Dependency/A-Dependency-Require.decorator.ts +68 -0
- package/src/global/A-Dependency/A-Dependency.class.ts +33 -0
- package/src/global/A-Dependency/A-Dependency.error.ts +13 -0
- package/src/global/A-Dependency/A-Dependency.types.ts +28 -0
- package/src/global/A-Feature/A-Feature-Define.decorator.ts +2 -1
- package/src/global/A-Feature/A-Feature-Extend.decorator.ts +2 -1
- package/src/global/A-Feature/A-Feature.class.ts +11 -0
- package/src/global/A-Inject/A-Inject.decorator.ts +4 -2
- package/src/global/A-Inject/A-Inject.types.ts +5 -3
- package/src/global/A-Scope/A-Scope.class.ts +85 -57
- package/src/global/A-Stage/A-Stage.class.ts +22 -2
- package/src/global/A-Stage/A-Stage.error.ts +2 -0
- package/src/helpers/A_Common.helper.ts +101 -0
- package/src/helpers/A_TypeGuards.helper.ts +8 -0
- package/src/index.ts +88 -0
- package/tests/A-Component.test.ts +1 -1
- package/tests/A-Concept.test.ts +5 -6
- package/tests/A-Dependency.test.ts +93 -0
- package/tests/A-Feature.test.ts +7 -7
- package/tests/A-Scope.test.ts +10 -10
- package/tsconfig.json +2 -2
- package/tsup.config.ts +32 -0
- package/dist/index.js +0 -112
- package/dist/index.js.map +0 -1
- package/dist/src/constants/env.constants.d.ts +0 -33
- package/dist/src/constants/env.constants.js +0 -47
- package/dist/src/constants/env.constants.js.map +0 -1
- package/dist/src/global/A-Abstraction/A-Abstraction-Extend.decorator.d.ts +0 -23
- package/dist/src/global/A-Abstraction/A-Abstraction-Extend.decorator.js +0 -96
- package/dist/src/global/A-Abstraction/A-Abstraction-Extend.decorator.js.map +0 -1
- package/dist/src/global/A-Abstraction/A-Abstraction.class.d.ts +0 -74
- package/dist/src/global/A-Abstraction/A-Abstraction.class.js +0 -130
- package/dist/src/global/A-Abstraction/A-Abstraction.class.js.map +0 -1
- package/dist/src/global/A-Abstraction/A-Abstraction.error.d.ts +0 -7
- package/dist/src/global/A-Abstraction/A-Abstraction.error.js +0 -12
- package/dist/src/global/A-Abstraction/A-Abstraction.error.js.map +0 -1
- package/dist/src/global/A-Abstraction/A-Abstraction.types.d.ts +0 -38
- package/dist/src/global/A-Abstraction/A-Abstraction.types.js +0 -3
- package/dist/src/global/A-Abstraction/A-Abstraction.types.js.map +0 -1
- package/dist/src/global/A-Caller/A_Caller.class.d.ts +0 -33
- package/dist/src/global/A-Caller/A_Caller.class.js +0 -44
- package/dist/src/global/A-Caller/A_Caller.class.js.map +0 -1
- package/dist/src/global/A-Caller/A_Caller.error.d.ts +0 -7
- package/dist/src/global/A-Caller/A_Caller.error.js +0 -12
- package/dist/src/global/A-Caller/A_Caller.error.js.map +0 -1
- package/dist/src/global/A-Caller/A_Caller.types.d.ts +0 -18
- package/dist/src/global/A-Caller/A_Caller.types.js +0 -3
- package/dist/src/global/A-Caller/A_Caller.types.js.map +0 -1
- package/dist/src/global/A-Component/A-Component.class.d.ts +0 -34
- package/dist/src/global/A-Component/A-Component.class.js +0 -56
- package/dist/src/global/A-Component/A-Component.class.js.map +0 -1
- package/dist/src/global/A-Component/A-Component.constants.d.ts +0 -6
- package/dist/src/global/A-Component/A-Component.constants.js +0 -11
- package/dist/src/global/A-Component/A-Component.constants.js.map +0 -1
- package/dist/src/global/A-Component/A-Component.meta.d.ts +0 -34
- package/dist/src/global/A-Component/A-Component.meta.js +0 -78
- package/dist/src/global/A-Component/A-Component.meta.js.map +0 -1
- package/dist/src/global/A-Component/A-Component.types.d.ts +0 -76
- package/dist/src/global/A-Component/A-Component.types.js +0 -4
- package/dist/src/global/A-Component/A-Component.types.js.map +0 -1
- package/dist/src/global/A-Concept/A-Concept.class.d.ts +0 -153
- package/dist/src/global/A-Concept/A-Concept.class.js +0 -260
- package/dist/src/global/A-Concept/A-Concept.class.js.map +0 -1
- package/dist/src/global/A-Concept/A-Concept.constants.d.ts +0 -33
- package/dist/src/global/A-Concept/A-Concept.constants.js +0 -39
- package/dist/src/global/A-Concept/A-Concept.constants.js.map +0 -1
- package/dist/src/global/A-Concept/A-Concept.meta.d.ts +0 -6
- package/dist/src/global/A-Concept/A-Concept.meta.js +0 -12
- package/dist/src/global/A-Concept/A-Concept.meta.js.map +0 -1
- package/dist/src/global/A-Concept/A-Concept.types.d.ts +0 -66
- package/dist/src/global/A-Concept/A-Concept.types.js +0 -3
- package/dist/src/global/A-Concept/A-Concept.types.js.map +0 -1
- package/dist/src/global/A-Container/A-Container.class.d.ts +0 -52
- package/dist/src/global/A-Container/A-Container.class.js +0 -78
- package/dist/src/global/A-Container/A-Container.class.js.map +0 -1
- package/dist/src/global/A-Container/A-Container.constants.d.ts +0 -6
- package/dist/src/global/A-Container/A-Container.constants.js +0 -11
- package/dist/src/global/A-Container/A-Container.constants.js.map +0 -1
- package/dist/src/global/A-Container/A-Container.meta.d.ts +0 -35
- package/dist/src/global/A-Container/A-Container.meta.js +0 -76
- package/dist/src/global/A-Container/A-Container.meta.js.map +0 -1
- package/dist/src/global/A-Container/A-Container.types.d.ts +0 -75
- package/dist/src/global/A-Container/A-Container.types.js +0 -4
- package/dist/src/global/A-Container/A-Container.types.js.map +0 -1
- package/dist/src/global/A-Context/A-Context.class.d.ts +0 -361
- package/dist/src/global/A-Context/A-Context.class.js +0 -603
- package/dist/src/global/A-Context/A-Context.class.js.map +0 -1
- package/dist/src/global/A-Context/A-Context.error.d.ts +0 -20
- package/dist/src/global/A-Context/A-Context.error.js +0 -25
- package/dist/src/global/A-Context/A-Context.error.js.map +0 -1
- package/dist/src/global/A-Context/A-Context.types.d.ts +0 -5
- package/dist/src/global/A-Context/A-Context.types.js +0 -3
- package/dist/src/global/A-Context/A-Context.types.js.map +0 -1
- package/dist/src/global/A-Dependency/A-DependencyReference.class.d.ts +0 -0
- package/dist/src/global/A-Dependency/A-DependencyReference.class.js +0 -49
- package/dist/src/global/A-Dependency/A-DependencyReference.class.js.map +0 -1
- package/dist/src/global/A-Dependency/A-DependencyReference.types.d.ts +0 -0
- package/dist/src/global/A-Dependency/A-DependencyReference.types.js +0 -58
- package/dist/src/global/A-Dependency/A-DependencyReference.types.js.map +0 -1
- package/dist/src/global/A-Entity/A-Entity.class.d.ts +0 -214
- package/dist/src/global/A-Entity/A-Entity.class.js +0 -282
- package/dist/src/global/A-Entity/A-Entity.class.js.map +0 -1
- package/dist/src/global/A-Entity/A-Entity.constants.d.ts +0 -11
- package/dist/src/global/A-Entity/A-Entity.constants.js +0 -17
- package/dist/src/global/A-Entity/A-Entity.constants.js.map +0 -1
- package/dist/src/global/A-Entity/A-Entity.error.d.ts +0 -7
- package/dist/src/global/A-Entity/A-Entity.error.js +0 -12
- package/dist/src/global/A-Entity/A-Entity.error.js.map +0 -1
- package/dist/src/global/A-Entity/A-Entity.meta.d.ts +0 -11
- package/dist/src/global/A-Entity/A-Entity.meta.js +0 -18
- package/dist/src/global/A-Entity/A-Entity.meta.js.map +0 -1
- package/dist/src/global/A-Entity/A-Entity.types.d.ts +0 -56
- package/dist/src/global/A-Entity/A-Entity.types.js +0 -5
- package/dist/src/global/A-Entity/A-Entity.types.js.map +0 -1
- package/dist/src/global/A-Error/A_Error.class.d.ts +0 -229
- package/dist/src/global/A-Error/A_Error.class.js +0 -296
- package/dist/src/global/A-Error/A_Error.class.js.map +0 -1
- package/dist/src/global/A-Error/A_Error.constants.d.ts +0 -5
- package/dist/src/global/A-Error/A_Error.constants.js +0 -9
- package/dist/src/global/A-Error/A_Error.constants.js.map +0 -1
- package/dist/src/global/A-Error/A_Error.types.d.ts +0 -93
- package/dist/src/global/A-Error/A_Error.types.js +0 -3
- package/dist/src/global/A-Error/A_Error.types.js.map +0 -1
- package/dist/src/global/A-Feature/A-Feature-Define.decorator.d.ts +0 -15
- package/dist/src/global/A-Feature/A-Feature-Define.decorator.js +0 -76
- package/dist/src/global/A-Feature/A-Feature-Define.decorator.js.map +0 -1
- package/dist/src/global/A-Feature/A-Feature-Extend.decorator.d.ts +0 -56
- package/dist/src/global/A-Feature/A-Feature-Extend.decorator.js +0 -128
- package/dist/src/global/A-Feature/A-Feature-Extend.decorator.js.map +0 -1
- package/dist/src/global/A-Feature/A-Feature.class.d.ts +0 -175
- package/dist/src/global/A-Feature/A-Feature.class.js +0 -318
- package/dist/src/global/A-Feature/A-Feature.class.js.map +0 -1
- package/dist/src/global/A-Feature/A-Feature.error.d.ts +0 -25
- package/dist/src/global/A-Feature/A-Feature.error.js +0 -33
- package/dist/src/global/A-Feature/A-Feature.error.js.map +0 -1
- package/dist/src/global/A-Feature/A-Feature.types.d.ts +0 -334
- package/dist/src/global/A-Feature/A-Feature.types.js +0 -26
- package/dist/src/global/A-Feature/A-Feature.types.js.map +0 -1
- package/dist/src/global/A-Fragment/A-Fragment.class.d.ts +0 -36
- package/dist/src/global/A-Fragment/A-Fragment.class.js +0 -46
- package/dist/src/global/A-Fragment/A-Fragment.class.js.map +0 -1
- package/dist/src/global/A-Fragment/A-Fragment.types.d.ts +0 -21
- package/dist/src/global/A-Fragment/A-Fragment.types.js +0 -6
- package/dist/src/global/A-Fragment/A-Fragment.types.js.map +0 -1
- package/dist/src/global/A-Inject/A-Inject.decorator.d.ts +0 -80
- package/dist/src/global/A-Inject/A-Inject.decorator.js +0 -49
- package/dist/src/global/A-Inject/A-Inject.decorator.js.map +0 -1
- package/dist/src/global/A-Inject/A-Inject.error.d.ts +0 -5
- package/dist/src/global/A-Inject/A-Inject.error.js +0 -10
- package/dist/src/global/A-Inject/A-Inject.error.js.map +0 -1
- package/dist/src/global/A-Inject/A-Inject.types.d.ts +0 -42
- package/dist/src/global/A-Inject/A-Inject.types.js +0 -3
- package/dist/src/global/A-Inject/A-Inject.types.js.map +0 -1
- package/dist/src/global/A-Meta/A-Meta.class.d.ts +0 -97
- package/dist/src/global/A-Meta/A-Meta.class.js +0 -164
- package/dist/src/global/A-Meta/A-Meta.class.js.map +0 -1
- package/dist/src/global/A-Meta/A-Meta.types.d.ts +0 -14
- package/dist/src/global/A-Meta/A-Meta.types.js +0 -3
- package/dist/src/global/A-Meta/A-Meta.types.js.map +0 -1
- package/dist/src/global/A-Scope/A-Scope.class.d.ts +0 -466
- package/dist/src/global/A-Scope/A-Scope.class.js +0 -791
- package/dist/src/global/A-Scope/A-Scope.class.js.map +0 -1
- package/dist/src/global/A-Scope/A-Scope.error.d.ts +0 -8
- package/dist/src/global/A-Scope/A-Scope.error.js +0 -13
- package/dist/src/global/A-Scope/A-Scope.error.js.map +0 -1
- package/dist/src/global/A-Scope/A-Scope.types.d.ts +0 -81
- package/dist/src/global/A-Scope/A-Scope.types.js +0 -3
- package/dist/src/global/A-Scope/A-Scope.types.js.map +0 -1
- package/dist/src/global/A-Stage/A-Stage.class.d.ts +0 -112
- package/dist/src/global/A-Stage/A-Stage.class.js +0 -240
- package/dist/src/global/A-Stage/A-Stage.class.js.map +0 -1
- package/dist/src/global/A-Stage/A-Stage.error.d.ts +0 -4
- package/dist/src/global/A-Stage/A-Stage.error.js +0 -11
- package/dist/src/global/A-Stage/A-Stage.error.js.map +0 -1
- package/dist/src/global/A-Stage/A-Stage.types.d.ts +0 -101
- package/dist/src/global/A-Stage/A-Stage.types.js +0 -43
- package/dist/src/global/A-Stage/A-Stage.types.js.map +0 -1
- package/dist/src/global/A-StepManager/A-StepManager.class.d.ts +0 -20
- package/dist/src/global/A-StepManager/A-StepManager.class.js +0 -112
- package/dist/src/global/A-StepManager/A-StepManager.class.js.map +0 -1
- package/dist/src/global/A-StepManager/A-StepManager.error.d.ts +0 -4
- package/dist/src/global/A-StepManager/A-StepManager.error.js +0 -9
- package/dist/src/global/A-StepManager/A-StepManager.error.js.map +0 -1
- package/dist/src/global/ASEID/ASEID.class.d.ts +0 -130
- package/dist/src/global/ASEID/ASEID.class.js +0 -167
- package/dist/src/global/ASEID/ASEID.class.js.map +0 -1
- package/dist/src/global/ASEID/ASEID.constants.d.ts +0 -0
- package/dist/src/global/ASEID/ASEID.constants.js +0 -2
- package/dist/src/global/ASEID/ASEID.constants.js.map +0 -1
- package/dist/src/global/ASEID/ASEID.error.d.ts +0 -5
- package/dist/src/global/ASEID/ASEID.error.js +0 -10
- package/dist/src/global/ASEID/ASEID.error.js.map +0 -1
- package/dist/src/global/ASEID/ASEID.types.d.ts +0 -65
- package/dist/src/global/ASEID/ASEID.types.js +0 -5
- package/dist/src/global/ASEID/ASEID.types.js.map +0 -1
- package/dist/src/helpers/A_Common.helper.d.ts +0 -28
- package/dist/src/helpers/A_Common.helper.js +0 -170
- package/dist/src/helpers/A_Common.helper.js.map +0 -1
- package/dist/src/helpers/A_Formatter.helper.d.ts +0 -35
- package/dist/src/helpers/A_Formatter.helper.js +0 -62
- package/dist/src/helpers/A_Formatter.helper.js.map +0 -1
- package/dist/src/helpers/A_Identity.helper.d.ts +0 -29
- package/dist/src/helpers/A_Identity.helper.js +0 -43
- package/dist/src/helpers/A_Identity.helper.js.map +0 -1
- package/dist/src/helpers/A_TypeGuards.helper.d.ts +0 -207
- package/dist/src/helpers/A_TypeGuards.helper.js +0 -296
- package/dist/src/helpers/A_TypeGuards.helper.js.map +0 -1
- package/dist/src/types/A_Common.types.d.ts +0 -36
- package/dist/src/types/A_Common.types.js +0 -3
- package/dist/src/types/A_Common.types.js.map +0 -1
- package/index.ts +0 -81
- package/src/global/A-Dependency/A-DependencyReference.class.ts +0 -61
- package/src/global/A-Dependency/A-DependencyReference.types.ts +0 -61
- package/trace-require.js +0 -46
- package/tsconfig.build.json +0 -58
|
@@ -1,466 +0,0 @@
|
|
|
1
|
-
import { A_TYPES__ScopeConfig, A_TYPES__Scope_Init, A_TYPES__ScopeLinkedComponents, A_TYPES__ScopeResolvableComponents, A_TYPES__ScopeLinkedConstructors } from './A-Scope.types';
|
|
2
|
-
import { A_TYPES__A_InjectDecorator_EntityInjectionInstructions, A_TYPES__InjectableConstructors } from "../A-Inject/A-Inject.types";
|
|
3
|
-
import { A_Fragment } from "../A-Fragment/A-Fragment.class";
|
|
4
|
-
import { A_Component } from "../A-Component/A-Component.class";
|
|
5
|
-
import { A_Entity } from "../A-Entity/A-Entity.class";
|
|
6
|
-
import { A_Error } from "../A-Error/A_Error.class";
|
|
7
|
-
import { A_TYPES__Entity_Constructor } from '../A-Entity/A-Entity.types';
|
|
8
|
-
import { A_TYPES__Component_Constructor } from '../A-Component/A-Component.types';
|
|
9
|
-
import { A_TYPES__Fragment_Constructor } from '../A-Fragment/A-Fragment.types';
|
|
10
|
-
import { A_TYPES__Error_Constructor } from '../A-Error/A_Error.types';
|
|
11
|
-
export declare class A_Scope<_ComponentType extends A_TYPES__Component_Constructor[] = A_TYPES__Component_Constructor[], _ErrorType extends A_TYPES__Error_Constructor[] = A_TYPES__Error_Constructor[], _EntityType extends A_TYPES__Entity_Constructor[] = A_TYPES__Entity_Constructor[], _FragmentType extends A_Fragment[] = A_Fragment[]> {
|
|
12
|
-
/**
|
|
13
|
-
* Scope Name uses for identification and logging purposes
|
|
14
|
-
*/
|
|
15
|
-
protected _name: string;
|
|
16
|
-
/**
|
|
17
|
-
* Parent scope reference, used for inheritance of components, fragments, entities and commands
|
|
18
|
-
*/
|
|
19
|
-
protected _parent?: A_Scope;
|
|
20
|
-
/**
|
|
21
|
-
* A set of allowed components, A set of constructors that are allowed in the scope
|
|
22
|
-
*
|
|
23
|
-
*/
|
|
24
|
-
protected _allowedComponents: Set<_ComponentType[number]>;
|
|
25
|
-
/**
|
|
26
|
-
* A set of allowed errors, A set of constructors that are allowed in the scope
|
|
27
|
-
*/
|
|
28
|
-
protected _allowedErrors: Set<_ErrorType[number]>;
|
|
29
|
-
/**
|
|
30
|
-
* A set of allowed entities, A set of constructors that are allowed in the scope
|
|
31
|
-
*/
|
|
32
|
-
protected _allowedEntities: Set<_EntityType[number]>;
|
|
33
|
-
/**
|
|
34
|
-
* A set of allowed fragments, A set of constructors that are allowed in the scope
|
|
35
|
-
*/
|
|
36
|
-
protected _allowedFragments: Set<A_TYPES__Fragment_Constructor<_FragmentType[number]>>;
|
|
37
|
-
/**
|
|
38
|
-
* Storage for the components, should be strong as components are unique per scope
|
|
39
|
-
*/
|
|
40
|
-
protected _components: Map<_ComponentType[number], InstanceType<_ComponentType[number]>>;
|
|
41
|
-
/**
|
|
42
|
-
* Storage for the errors, should be strong as errors are unique per code
|
|
43
|
-
*/
|
|
44
|
-
protected _errors: Map<string, InstanceType<_ErrorType[number]>>;
|
|
45
|
-
/**
|
|
46
|
-
* Storage for the entities, should be strong as entities are unique per aseid
|
|
47
|
-
*/
|
|
48
|
-
protected _entities: Map<string, InstanceType<_EntityType[number]>>;
|
|
49
|
-
/**
|
|
50
|
-
* Storage for the fragments, should be weak as fragments are singletons per scope
|
|
51
|
-
*/
|
|
52
|
-
protected _fragments: Map<A_TYPES__Fragment_Constructor<_FragmentType[number]>, _FragmentType[number]>;
|
|
53
|
-
/**
|
|
54
|
-
* Returns the name of the scope
|
|
55
|
-
*/
|
|
56
|
-
get name(): string;
|
|
57
|
-
/**
|
|
58
|
-
* Returns a list of Constructors for A-Components that are available in the scope
|
|
59
|
-
*/
|
|
60
|
-
get allowedComponents(): Set<_ComponentType[number]>;
|
|
61
|
-
/**
|
|
62
|
-
* Returns a list of Constructors for A-Entities that are available in the scope
|
|
63
|
-
*/
|
|
64
|
-
get allowedEntities(): Set<_EntityType[number]>;
|
|
65
|
-
/**
|
|
66
|
-
* Returns a list of Constructors for A-Fragments that are available in the scope
|
|
67
|
-
*/
|
|
68
|
-
get allowedFragments(): Set<A_TYPES__Fragment_Constructor<_FragmentType[number]>>;
|
|
69
|
-
/**
|
|
70
|
-
* Returns a list of Constructors for A-Errors that are available in the scope
|
|
71
|
-
*/
|
|
72
|
-
get allowedErrors(): Set<_ErrorType[number]>;
|
|
73
|
-
/**
|
|
74
|
-
* Returns an Array of entities registered in the scope
|
|
75
|
-
*
|
|
76
|
-
* [!] One entity per aseid
|
|
77
|
-
*/
|
|
78
|
-
get entities(): Array<InstanceType<_EntityType[number]>>;
|
|
79
|
-
/**
|
|
80
|
-
* Returns an Array of fragments registered in the scope
|
|
81
|
-
*
|
|
82
|
-
* [!] One fragment per scope
|
|
83
|
-
*/
|
|
84
|
-
get fragments(): Array<_FragmentType[number]>;
|
|
85
|
-
/**
|
|
86
|
-
* Returns an Array of components registered in the scope
|
|
87
|
-
*
|
|
88
|
-
* [!] One component instance per scope
|
|
89
|
-
*/
|
|
90
|
-
get components(): Array<InstanceType<_ComponentType[number]>>;
|
|
91
|
-
/**
|
|
92
|
-
* Returns the parent scope of the current scope
|
|
93
|
-
*
|
|
94
|
-
* @param setValue
|
|
95
|
-
* @returns
|
|
96
|
-
*/
|
|
97
|
-
get parent(): A_Scope | undefined;
|
|
98
|
-
/**
|
|
99
|
-
* A_Scope refers to the visibility and accessibility of :
|
|
100
|
-
* - variables,
|
|
101
|
-
* - Components,
|
|
102
|
-
* - Context Fragments
|
|
103
|
-
* - Entities
|
|
104
|
-
* - and objects in different parts of your code.
|
|
105
|
-
* Scope determines where a particular piece of data (like a variable or function)
|
|
106
|
-
* can be accessed, modified, or referenced, and it plays a crucial role in avoiding naming collisions and ensuring data integrity.
|
|
107
|
-
*
|
|
108
|
-
* [!] The scope behavior is similar to tree structure where each scope can have a parent scope and inherit its components, fragments, entities and errors
|
|
109
|
-
*
|
|
110
|
-
* @param params
|
|
111
|
-
* @param config
|
|
112
|
-
*/
|
|
113
|
-
constructor();
|
|
114
|
-
constructor(
|
|
115
|
-
/**
|
|
116
|
-
* A set of constructors that are allowed in the scope
|
|
117
|
-
*/
|
|
118
|
-
params: Partial<A_TYPES__Scope_Init<_ComponentType, _ErrorType, _EntityType, _FragmentType>>,
|
|
119
|
-
/**
|
|
120
|
-
* Configuration options for the scope
|
|
121
|
-
*/
|
|
122
|
-
config?: Partial<A_TYPES__ScopeConfig>);
|
|
123
|
-
/**
|
|
124
|
-
* Determines which initializer method to use based on the type of the first parameter.
|
|
125
|
-
*
|
|
126
|
-
* @param param1
|
|
127
|
-
* @returns
|
|
128
|
-
*/
|
|
129
|
-
protected getInitializer(param1?: Partial<A_TYPES__Scope_Init<_ComponentType, _ErrorType, _EntityType, _FragmentType>>, param2?: Partial<A_TYPES__ScopeConfig>): (param1: any, param2: any) => void | (() => void);
|
|
130
|
-
protected defaultInitialized(params?: Partial<A_TYPES__Scope_Init<_ComponentType, _ErrorType, _EntityType, _FragmentType>>, config?: Partial<A_TYPES__ScopeConfig>): void;
|
|
131
|
-
/**
|
|
132
|
-
* This method is used to initialize the components in the scope
|
|
133
|
-
* To save memory components are initialized only when they are requested
|
|
134
|
-
*
|
|
135
|
-
* This method only registers the component in the scope in case they are not registered yet
|
|
136
|
-
*
|
|
137
|
-
* @param _components
|
|
138
|
-
*/
|
|
139
|
-
protected initComponents(_components?: _ComponentType): void;
|
|
140
|
-
/**
|
|
141
|
-
* This method is used to initialize the errors in the scope
|
|
142
|
-
*
|
|
143
|
-
* This method only registers the errors in the scope in case they are not registered yet
|
|
144
|
-
*
|
|
145
|
-
* @param _errors
|
|
146
|
-
*/
|
|
147
|
-
protected initErrors(_errors?: _ErrorType): void;
|
|
148
|
-
/**
|
|
149
|
-
* This method is used to initialize the entities in the scope
|
|
150
|
-
*
|
|
151
|
-
* This method only registers the entities in the scope in case they are not registered yet
|
|
152
|
-
*
|
|
153
|
-
* @param _entities
|
|
154
|
-
*/
|
|
155
|
-
protected initEntities(_entities?: [
|
|
156
|
-
..._EntityType,
|
|
157
|
-
...InstanceType<_EntityType[number]>[]
|
|
158
|
-
]): void;
|
|
159
|
-
/**
|
|
160
|
-
* This method is used to initialize the fragments in the scope
|
|
161
|
-
*
|
|
162
|
-
* This method only registers the fragments in the scope in case they are not registered yet
|
|
163
|
-
*
|
|
164
|
-
* @param _fragments
|
|
165
|
-
*/
|
|
166
|
-
protected initFragments(_fragments?: _FragmentType): void;
|
|
167
|
-
/**
|
|
168
|
-
* Returns the issuer of the scope, useful for debugging and tracking purposes
|
|
169
|
-
*
|
|
170
|
-
* Issuer can be:
|
|
171
|
-
* - A Container that allocated the scope
|
|
172
|
-
* - A Feature that allocated the scope
|
|
173
|
-
*
|
|
174
|
-
* [!] Note that the issuer is the direct allocator of the scope, so if a Container allocated a Feature that allocated the scope, the issuer will be the Feature
|
|
175
|
-
*
|
|
176
|
-
* @returns
|
|
177
|
-
*/
|
|
178
|
-
issuer<T extends A_TYPES__ScopeLinkedComponents>(): T | undefined;
|
|
179
|
-
/**
|
|
180
|
-
* This method is used to inherit from a parent scope
|
|
181
|
-
*
|
|
182
|
-
* [!] This method checks for circular inheritance and throws an error if detected
|
|
183
|
-
*
|
|
184
|
-
* @param parent
|
|
185
|
-
* @returns
|
|
186
|
-
*/
|
|
187
|
-
inherit(parent: A_Scope): A_Scope;
|
|
188
|
-
/**
|
|
189
|
-
* This method is used to check if the component is available in the scope
|
|
190
|
-
*
|
|
191
|
-
* [!] Note that this method checks for the component in the current scope and all parent scopes
|
|
192
|
-
*
|
|
193
|
-
* @param component
|
|
194
|
-
* @returns
|
|
195
|
-
*/
|
|
196
|
-
has<T extends A_Component>(
|
|
197
|
-
/**
|
|
198
|
-
* Provide a component constructor to check if it's available in the scope
|
|
199
|
-
*/
|
|
200
|
-
component: A_TYPES__Component_Constructor<T>): boolean;
|
|
201
|
-
has<T extends A_Entity>(
|
|
202
|
-
/**
|
|
203
|
-
* Provide an entity constructor to check if it's available in the scope
|
|
204
|
-
*
|
|
205
|
-
* [!] Note that entities are unique per aseid, so this method checks if there's at least one entity of the provided type in the scope
|
|
206
|
-
*/
|
|
207
|
-
entity: A_TYPES__Entity_Constructor<T>): boolean;
|
|
208
|
-
has<T extends A_Fragment>(
|
|
209
|
-
/**
|
|
210
|
-
* Provide a fragment constructor to check if it's available in the scope
|
|
211
|
-
*/
|
|
212
|
-
fragment: A_TYPES__Fragment_Constructor<T>): boolean;
|
|
213
|
-
has(
|
|
214
|
-
/**
|
|
215
|
-
* Provide a string to check if a component, entity or fragment with the provided name is available in the scope
|
|
216
|
-
*/
|
|
217
|
-
constructor: string): boolean;
|
|
218
|
-
/**
|
|
219
|
-
* Merges two scopes into a new one
|
|
220
|
-
*
|
|
221
|
-
* [!] Notes:
|
|
222
|
-
* - this method does NOT modify the existing scopes
|
|
223
|
-
* - parent of the new scope will be the parent of the current scope or the parent of anotherScope (if exists)
|
|
224
|
-
*
|
|
225
|
-
* @param anotherScope
|
|
226
|
-
* @returns
|
|
227
|
-
*/
|
|
228
|
-
merge(anotherScope: A_Scope): A_Scope;
|
|
229
|
-
/**
|
|
230
|
-
* Allows to retrieve the constructor of the component or entity by its name
|
|
231
|
-
*
|
|
232
|
-
* [!] Notes:
|
|
233
|
-
* - In case of search for A-Entity please ensure that provided string corresponds to the static entity property of the class. [!] By default it's the kebab-case of the class name
|
|
234
|
-
* - In case of search for A_Component please ensure that provided string corresponds to the class name in PascalCase
|
|
235
|
-
*
|
|
236
|
-
* @param name
|
|
237
|
-
* @returns
|
|
238
|
-
*/
|
|
239
|
-
resolveConstructor<T extends A_Entity>(
|
|
240
|
-
/**
|
|
241
|
-
* Provide the entity name or static entity property to retrieve its constructor
|
|
242
|
-
*/
|
|
243
|
-
name: string): A_TYPES__Entity_Constructor<T>;
|
|
244
|
-
resolveConstructor<T extends A_Component>(
|
|
245
|
-
/**
|
|
246
|
-
* Provide the component name in PascalCase to retrieve its constructor
|
|
247
|
-
*/
|
|
248
|
-
name: string): A_TYPES__Component_Constructor<T>;
|
|
249
|
-
resolveConstructor<T extends A_Fragment>(
|
|
250
|
-
/**
|
|
251
|
-
* Provide the fragment name in PascalCase to retrieve its constructor
|
|
252
|
-
*/
|
|
253
|
-
name: string): A_TYPES__Fragment_Constructor<T>;
|
|
254
|
-
/**
|
|
255
|
-
* This method allows to resolve/inject a component, fragment or entity from the scope
|
|
256
|
-
* Depending on the provided parameters it can resolve:
|
|
257
|
-
* - A single component/fragment/entity by its constructor or name
|
|
258
|
-
* - An array of components/fragments/entities by providing an array of constructors
|
|
259
|
-
* - An entity or an array of entities by providing the entity constructor and query instructions
|
|
260
|
-
*
|
|
261
|
-
* @param component
|
|
262
|
-
* @returns
|
|
263
|
-
*/
|
|
264
|
-
resolve<T extends A_Component>(
|
|
265
|
-
/**
|
|
266
|
-
* Provide a component constructor to resolve its instance from the scope
|
|
267
|
-
*/
|
|
268
|
-
component: A_TYPES__Component_Constructor<T>): T;
|
|
269
|
-
resolve<T extends A_TYPES__Component_Constructor[]>(
|
|
270
|
-
/**
|
|
271
|
-
* Provide an array of component constructors to resolve their instances from the scope
|
|
272
|
-
*/
|
|
273
|
-
components: [...T]): Array<InstanceType<T[number]>>;
|
|
274
|
-
resolve<T extends A_Fragment>(
|
|
275
|
-
/**
|
|
276
|
-
* Provide a fragment constructor to resolve its instance from the scope
|
|
277
|
-
*/
|
|
278
|
-
fragment: A_TYPES__Fragment_Constructor<T>): T;
|
|
279
|
-
resolve<T extends A_TYPES__Fragment_Constructor[]>(
|
|
280
|
-
/**
|
|
281
|
-
* Provide an array of fragment constructors to resolve their instances from the scope
|
|
282
|
-
*/
|
|
283
|
-
fragments: [...T]): Array<InstanceType<T[number]>>;
|
|
284
|
-
resolve<T extends A_Entity>(
|
|
285
|
-
/**
|
|
286
|
-
* Provide an entity constructor to resolve its instance or an array of instances from the scope
|
|
287
|
-
*/
|
|
288
|
-
entity: A_TYPES__Entity_Constructor<T>): T | undefined;
|
|
289
|
-
resolve<T extends A_Scope>(
|
|
290
|
-
/**
|
|
291
|
-
* Uses only in case of resolving a single entity
|
|
292
|
-
*
|
|
293
|
-
* Provide an entity constructor to resolve its instance from the scope
|
|
294
|
-
*/
|
|
295
|
-
scope: new (...args: any[]) => T): T;
|
|
296
|
-
resolve<T extends A_Entity>(
|
|
297
|
-
/**
|
|
298
|
-
* Provide an entity constructor to resolve its instance or an array of instances from the scope
|
|
299
|
-
*/
|
|
300
|
-
entity: A_TYPES__Entity_Constructor<T>,
|
|
301
|
-
/**
|
|
302
|
-
* Provide optional instructions to find a specific entity or a set of entities
|
|
303
|
-
*/
|
|
304
|
-
instructions: Partial<A_TYPES__A_InjectDecorator_EntityInjectionInstructions<T>>): Array<T>;
|
|
305
|
-
resolve<T extends A_TYPES__ScopeResolvableComponents>(constructorName: string): T;
|
|
306
|
-
resolve<T extends A_TYPES__ScopeResolvableComponents>(
|
|
307
|
-
/**
|
|
308
|
-
* Provide a component, fragment or entity constructor or an array of constructors to resolve its instance(s) from the scope
|
|
309
|
-
*/
|
|
310
|
-
param1: A_TYPES__InjectableConstructors): T | Array<T>;
|
|
311
|
-
resolve<T extends A_TYPES__ScopeLinkedConstructors>(
|
|
312
|
-
/**
|
|
313
|
-
* Provide a component, fragment or entity constructor or an array of constructors to resolve its instance(s) from the scope
|
|
314
|
-
*/
|
|
315
|
-
param1: InstanceType<T>): T | Array<T>;
|
|
316
|
-
/**
|
|
317
|
-
* This method is used internally to resolve a component, fragment or entity by its constructor name
|
|
318
|
-
*
|
|
319
|
-
* [!] Note that this method checks for the component, fragment or entity in the current scope and all parent scopes
|
|
320
|
-
*
|
|
321
|
-
* @param name - name of the component, fragment or entity to resolve (constructor name for components and fragments, static entity property for entities, static code property for commands)
|
|
322
|
-
* @returns
|
|
323
|
-
*/
|
|
324
|
-
private resolveByName;
|
|
325
|
-
/**
|
|
326
|
-
* This method is used internally to resolve a single component, fragment or entity from the scope
|
|
327
|
-
*
|
|
328
|
-
* @param component
|
|
329
|
-
* @param instructions
|
|
330
|
-
* @returns
|
|
331
|
-
*/
|
|
332
|
-
private resolveOnce;
|
|
333
|
-
private resolveIssuer;
|
|
334
|
-
/**
|
|
335
|
-
* This method is used internally to resolve a single entity from the scope based on the provided instructions
|
|
336
|
-
*
|
|
337
|
-
* [!] Note that this method can return either a single entity or an array of entities depending on the instructions provided
|
|
338
|
-
*
|
|
339
|
-
* @param entity
|
|
340
|
-
* @param instructions
|
|
341
|
-
* @returns
|
|
342
|
-
*/
|
|
343
|
-
private resolveEntity;
|
|
344
|
-
/**
|
|
345
|
-
* This method is used internally to resolve a single fragment from the scope
|
|
346
|
-
*
|
|
347
|
-
* @param fragment
|
|
348
|
-
* @returns
|
|
349
|
-
*/
|
|
350
|
-
private resolveFragment;
|
|
351
|
-
/**
|
|
352
|
-
* This method is used internally to resolve a single scope from the current scope
|
|
353
|
-
*
|
|
354
|
-
* @param scope
|
|
355
|
-
* @returns
|
|
356
|
-
*/
|
|
357
|
-
private resolveScope;
|
|
358
|
-
/**
|
|
359
|
-
* This method is used internally to resolve a single component from the scope
|
|
360
|
-
*
|
|
361
|
-
* @param component
|
|
362
|
-
* @returns
|
|
363
|
-
*/
|
|
364
|
-
private resolveComponent;
|
|
365
|
-
/**
|
|
366
|
-
* This method is used to register the component in the scope
|
|
367
|
-
*
|
|
368
|
-
* @param fragment
|
|
369
|
-
*/
|
|
370
|
-
register<T extends A_Component>(
|
|
371
|
-
/**
|
|
372
|
-
* Provide a component constructor to register it in the scope
|
|
373
|
-
*/
|
|
374
|
-
component: A_TYPES__Component_Constructor<T>): void;
|
|
375
|
-
register(
|
|
376
|
-
/**
|
|
377
|
-
* Provide a command instance to register it in the scope
|
|
378
|
-
*/
|
|
379
|
-
component: A_Component): void;
|
|
380
|
-
register<T extends A_Error>(
|
|
381
|
-
/**
|
|
382
|
-
* Provide an error constructor to register it in the scope
|
|
383
|
-
*/
|
|
384
|
-
error: A_TYPES__Error_Constructor<T>): void;
|
|
385
|
-
register(
|
|
386
|
-
/**
|
|
387
|
-
* Provide an error instance to register it in the scope
|
|
388
|
-
*/
|
|
389
|
-
error: A_Error): void;
|
|
390
|
-
register<T extends A_Fragment>(
|
|
391
|
-
/**
|
|
392
|
-
* Provide a command instance to register it in the scope
|
|
393
|
-
*/
|
|
394
|
-
fragment: A_TYPES__Fragment_Constructor<T>): void;
|
|
395
|
-
register(
|
|
396
|
-
/**
|
|
397
|
-
* Provide a fragment instance to register it in the scope
|
|
398
|
-
*/
|
|
399
|
-
fragment: A_Fragment): void;
|
|
400
|
-
register<T extends A_Entity>(
|
|
401
|
-
/**
|
|
402
|
-
* Provide an entity constructor to register it in the scope
|
|
403
|
-
*/
|
|
404
|
-
entity: A_TYPES__Entity_Constructor<T>): void;
|
|
405
|
-
register(
|
|
406
|
-
/**
|
|
407
|
-
* Provide an entity instance to register it in the scope
|
|
408
|
-
*/
|
|
409
|
-
entity: A_Entity): void;
|
|
410
|
-
/**
|
|
411
|
-
* This method is useful when you want to serialize the scope to JSON
|
|
412
|
-
*
|
|
413
|
-
* [!] Note this is not a deep serialization, only the fragments are serialized
|
|
414
|
-
* [!] Fragments are a storage for information which is relevant to the scope
|
|
415
|
-
*
|
|
416
|
-
* @returns
|
|
417
|
-
*/
|
|
418
|
-
toJSON(): Record<string, any>;
|
|
419
|
-
/**
|
|
420
|
-
* Type guard to check if the constructor is of type A_Component and is allowed in the scope
|
|
421
|
-
*
|
|
422
|
-
* @param ctor
|
|
423
|
-
* @returns
|
|
424
|
-
*/
|
|
425
|
-
protected isAllowedComponent(ctor: unknown): ctor is _ComponentType[number];
|
|
426
|
-
/**
|
|
427
|
-
* Type guard to check if the constructor is of type A_Entity and is allowed in the scope
|
|
428
|
-
*
|
|
429
|
-
* @param ctor
|
|
430
|
-
* @returns
|
|
431
|
-
*/
|
|
432
|
-
protected isAllowedEntity(ctor: unknown): ctor is A_TYPES__Entity_Constructor<_EntityType[number]>;
|
|
433
|
-
/**
|
|
434
|
-
* Type guard to check if the constructor is of type A_Fragment and is allowed in the scope
|
|
435
|
-
*
|
|
436
|
-
* @param ctor
|
|
437
|
-
* @returns
|
|
438
|
-
*/
|
|
439
|
-
protected isAllowedFragment(ctor: unknown): ctor is A_TYPES__Fragment_Constructor<_FragmentType[number]>;
|
|
440
|
-
/**
|
|
441
|
-
* Type guard to check if the constructor is of type A_Error and is allowed in the scope
|
|
442
|
-
*
|
|
443
|
-
* @param ctor
|
|
444
|
-
* @returns
|
|
445
|
-
*/
|
|
446
|
-
protected isAllowedError(ctor: unknown): ctor is A_TYPES__Error_Constructor<_ErrorType[number]>;
|
|
447
|
-
/**
|
|
448
|
-
* This method is used to check if the scope is inherited from another scope
|
|
449
|
-
*
|
|
450
|
-
* @param scope
|
|
451
|
-
* @returns
|
|
452
|
-
*/
|
|
453
|
-
isInheritedFrom(scope: A_Scope): boolean;
|
|
454
|
-
/**
|
|
455
|
-
* Helper method to check circular inheritance
|
|
456
|
-
* Should return a full sequence of inheritance for logging purposes
|
|
457
|
-
*
|
|
458
|
-
* @param scope
|
|
459
|
-
* @returns
|
|
460
|
-
*/
|
|
461
|
-
checkCircularInheritance(scope: A_Scope): Array<string> | false;
|
|
462
|
-
/**
|
|
463
|
-
* Helper method to print the inheritance chain of the scope
|
|
464
|
-
*/
|
|
465
|
-
printInheritanceChain(): void;
|
|
466
|
-
}
|