@adaas/a-concept 0.1.24 → 0.1.26

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.
Files changed (227) hide show
  1. package/dist/index.cjs +3 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.mts +3961 -0
  4. package/dist/index.d.ts +3961 -50
  5. package/dist/index.mjs +3 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/package.json +5 -6
  8. package/src/global/A-Abstraction/A-Abstraction-Extend.decorator.ts +2 -1
  9. package/src/global/A-Context/A-Context.class.ts +81 -7
  10. package/src/global/A-Context/A-Context.error.ts +4 -0
  11. package/src/global/A-Dependency/A-Dependency-Default.decorator.ts +75 -0
  12. package/src/global/A-Dependency/A-Dependency-Load.decorator.ts +80 -0
  13. package/src/global/A-Dependency/A-Dependency-Require.decorator.ts +68 -0
  14. package/src/global/A-Dependency/A-Dependency.class.ts +33 -0
  15. package/src/global/A-Dependency/A-Dependency.error.ts +13 -0
  16. package/src/global/A-Dependency/A-Dependency.types.ts +28 -0
  17. package/src/global/A-Feature/A-Feature-Define.decorator.ts +2 -1
  18. package/src/global/A-Feature/A-Feature-Extend.decorator.ts +2 -1
  19. package/src/global/A-Feature/A-Feature.class.ts +11 -0
  20. package/src/global/A-Inject/A-Inject.decorator.ts +4 -2
  21. package/src/global/A-Inject/A-Inject.types.ts +5 -3
  22. package/src/global/A-Scope/A-Scope.class.ts +85 -57
  23. package/src/global/A-Stage/A-Stage.class.ts +22 -2
  24. package/src/global/A-Stage/A-Stage.error.ts +2 -0
  25. package/src/helpers/A_Common.helper.ts +101 -0
  26. package/src/helpers/A_TypeGuards.helper.ts +8 -0
  27. package/src/index.ts +88 -0
  28. package/tests/A-Component.test.ts +1 -1
  29. package/tests/A-Concept.test.ts +5 -6
  30. package/tests/A-Dependency.test.ts +93 -0
  31. package/tests/A-Feature.test.ts +7 -7
  32. package/tests/A-Scope.test.ts +10 -10
  33. package/tsconfig.json +2 -2
  34. package/tsup.config.ts +32 -0
  35. package/dist/index.js +0 -112
  36. package/dist/index.js.map +0 -1
  37. package/dist/src/constants/env.constants.d.ts +0 -33
  38. package/dist/src/constants/env.constants.js +0 -47
  39. package/dist/src/constants/env.constants.js.map +0 -1
  40. package/dist/src/global/A-Abstraction/A-Abstraction-Extend.decorator.d.ts +0 -23
  41. package/dist/src/global/A-Abstraction/A-Abstraction-Extend.decorator.js +0 -96
  42. package/dist/src/global/A-Abstraction/A-Abstraction-Extend.decorator.js.map +0 -1
  43. package/dist/src/global/A-Abstraction/A-Abstraction.class.d.ts +0 -74
  44. package/dist/src/global/A-Abstraction/A-Abstraction.class.js +0 -130
  45. package/dist/src/global/A-Abstraction/A-Abstraction.class.js.map +0 -1
  46. package/dist/src/global/A-Abstraction/A-Abstraction.error.d.ts +0 -7
  47. package/dist/src/global/A-Abstraction/A-Abstraction.error.js +0 -12
  48. package/dist/src/global/A-Abstraction/A-Abstraction.error.js.map +0 -1
  49. package/dist/src/global/A-Abstraction/A-Abstraction.types.d.ts +0 -38
  50. package/dist/src/global/A-Abstraction/A-Abstraction.types.js +0 -3
  51. package/dist/src/global/A-Abstraction/A-Abstraction.types.js.map +0 -1
  52. package/dist/src/global/A-Caller/A_Caller.class.d.ts +0 -33
  53. package/dist/src/global/A-Caller/A_Caller.class.js +0 -44
  54. package/dist/src/global/A-Caller/A_Caller.class.js.map +0 -1
  55. package/dist/src/global/A-Caller/A_Caller.error.d.ts +0 -7
  56. package/dist/src/global/A-Caller/A_Caller.error.js +0 -12
  57. package/dist/src/global/A-Caller/A_Caller.error.js.map +0 -1
  58. package/dist/src/global/A-Caller/A_Caller.types.d.ts +0 -18
  59. package/dist/src/global/A-Caller/A_Caller.types.js +0 -3
  60. package/dist/src/global/A-Caller/A_Caller.types.js.map +0 -1
  61. package/dist/src/global/A-Component/A-Component.class.d.ts +0 -34
  62. package/dist/src/global/A-Component/A-Component.class.js +0 -56
  63. package/dist/src/global/A-Component/A-Component.class.js.map +0 -1
  64. package/dist/src/global/A-Component/A-Component.constants.d.ts +0 -6
  65. package/dist/src/global/A-Component/A-Component.constants.js +0 -11
  66. package/dist/src/global/A-Component/A-Component.constants.js.map +0 -1
  67. package/dist/src/global/A-Component/A-Component.meta.d.ts +0 -34
  68. package/dist/src/global/A-Component/A-Component.meta.js +0 -78
  69. package/dist/src/global/A-Component/A-Component.meta.js.map +0 -1
  70. package/dist/src/global/A-Component/A-Component.types.d.ts +0 -76
  71. package/dist/src/global/A-Component/A-Component.types.js +0 -4
  72. package/dist/src/global/A-Component/A-Component.types.js.map +0 -1
  73. package/dist/src/global/A-Concept/A-Concept.class.d.ts +0 -153
  74. package/dist/src/global/A-Concept/A-Concept.class.js +0 -260
  75. package/dist/src/global/A-Concept/A-Concept.class.js.map +0 -1
  76. package/dist/src/global/A-Concept/A-Concept.constants.d.ts +0 -33
  77. package/dist/src/global/A-Concept/A-Concept.constants.js +0 -39
  78. package/dist/src/global/A-Concept/A-Concept.constants.js.map +0 -1
  79. package/dist/src/global/A-Concept/A-Concept.meta.d.ts +0 -6
  80. package/dist/src/global/A-Concept/A-Concept.meta.js +0 -12
  81. package/dist/src/global/A-Concept/A-Concept.meta.js.map +0 -1
  82. package/dist/src/global/A-Concept/A-Concept.types.d.ts +0 -66
  83. package/dist/src/global/A-Concept/A-Concept.types.js +0 -3
  84. package/dist/src/global/A-Concept/A-Concept.types.js.map +0 -1
  85. package/dist/src/global/A-Container/A-Container.class.d.ts +0 -52
  86. package/dist/src/global/A-Container/A-Container.class.js +0 -78
  87. package/dist/src/global/A-Container/A-Container.class.js.map +0 -1
  88. package/dist/src/global/A-Container/A-Container.constants.d.ts +0 -6
  89. package/dist/src/global/A-Container/A-Container.constants.js +0 -11
  90. package/dist/src/global/A-Container/A-Container.constants.js.map +0 -1
  91. package/dist/src/global/A-Container/A-Container.meta.d.ts +0 -35
  92. package/dist/src/global/A-Container/A-Container.meta.js +0 -76
  93. package/dist/src/global/A-Container/A-Container.meta.js.map +0 -1
  94. package/dist/src/global/A-Container/A-Container.types.d.ts +0 -75
  95. package/dist/src/global/A-Container/A-Container.types.js +0 -4
  96. package/dist/src/global/A-Container/A-Container.types.js.map +0 -1
  97. package/dist/src/global/A-Context/A-Context.class.d.ts +0 -361
  98. package/dist/src/global/A-Context/A-Context.class.js +0 -603
  99. package/dist/src/global/A-Context/A-Context.class.js.map +0 -1
  100. package/dist/src/global/A-Context/A-Context.error.d.ts +0 -20
  101. package/dist/src/global/A-Context/A-Context.error.js +0 -25
  102. package/dist/src/global/A-Context/A-Context.error.js.map +0 -1
  103. package/dist/src/global/A-Context/A-Context.types.d.ts +0 -5
  104. package/dist/src/global/A-Context/A-Context.types.js +0 -3
  105. package/dist/src/global/A-Context/A-Context.types.js.map +0 -1
  106. package/dist/src/global/A-Dependency/A-DependencyReference.class.d.ts +0 -0
  107. package/dist/src/global/A-Dependency/A-DependencyReference.class.js +0 -49
  108. package/dist/src/global/A-Dependency/A-DependencyReference.class.js.map +0 -1
  109. package/dist/src/global/A-Dependency/A-DependencyReference.types.d.ts +0 -0
  110. package/dist/src/global/A-Dependency/A-DependencyReference.types.js +0 -58
  111. package/dist/src/global/A-Dependency/A-DependencyReference.types.js.map +0 -1
  112. package/dist/src/global/A-Entity/A-Entity.class.d.ts +0 -214
  113. package/dist/src/global/A-Entity/A-Entity.class.js +0 -282
  114. package/dist/src/global/A-Entity/A-Entity.class.js.map +0 -1
  115. package/dist/src/global/A-Entity/A-Entity.constants.d.ts +0 -11
  116. package/dist/src/global/A-Entity/A-Entity.constants.js +0 -17
  117. package/dist/src/global/A-Entity/A-Entity.constants.js.map +0 -1
  118. package/dist/src/global/A-Entity/A-Entity.error.d.ts +0 -7
  119. package/dist/src/global/A-Entity/A-Entity.error.js +0 -12
  120. package/dist/src/global/A-Entity/A-Entity.error.js.map +0 -1
  121. package/dist/src/global/A-Entity/A-Entity.meta.d.ts +0 -11
  122. package/dist/src/global/A-Entity/A-Entity.meta.js +0 -18
  123. package/dist/src/global/A-Entity/A-Entity.meta.js.map +0 -1
  124. package/dist/src/global/A-Entity/A-Entity.types.d.ts +0 -56
  125. package/dist/src/global/A-Entity/A-Entity.types.js +0 -5
  126. package/dist/src/global/A-Entity/A-Entity.types.js.map +0 -1
  127. package/dist/src/global/A-Error/A_Error.class.d.ts +0 -229
  128. package/dist/src/global/A-Error/A_Error.class.js +0 -296
  129. package/dist/src/global/A-Error/A_Error.class.js.map +0 -1
  130. package/dist/src/global/A-Error/A_Error.constants.d.ts +0 -5
  131. package/dist/src/global/A-Error/A_Error.constants.js +0 -9
  132. package/dist/src/global/A-Error/A_Error.constants.js.map +0 -1
  133. package/dist/src/global/A-Error/A_Error.types.d.ts +0 -93
  134. package/dist/src/global/A-Error/A_Error.types.js +0 -3
  135. package/dist/src/global/A-Error/A_Error.types.js.map +0 -1
  136. package/dist/src/global/A-Feature/A-Feature-Define.decorator.d.ts +0 -15
  137. package/dist/src/global/A-Feature/A-Feature-Define.decorator.js +0 -76
  138. package/dist/src/global/A-Feature/A-Feature-Define.decorator.js.map +0 -1
  139. package/dist/src/global/A-Feature/A-Feature-Extend.decorator.d.ts +0 -56
  140. package/dist/src/global/A-Feature/A-Feature-Extend.decorator.js +0 -128
  141. package/dist/src/global/A-Feature/A-Feature-Extend.decorator.js.map +0 -1
  142. package/dist/src/global/A-Feature/A-Feature.class.d.ts +0 -175
  143. package/dist/src/global/A-Feature/A-Feature.class.js +0 -318
  144. package/dist/src/global/A-Feature/A-Feature.class.js.map +0 -1
  145. package/dist/src/global/A-Feature/A-Feature.error.d.ts +0 -25
  146. package/dist/src/global/A-Feature/A-Feature.error.js +0 -33
  147. package/dist/src/global/A-Feature/A-Feature.error.js.map +0 -1
  148. package/dist/src/global/A-Feature/A-Feature.types.d.ts +0 -334
  149. package/dist/src/global/A-Feature/A-Feature.types.js +0 -26
  150. package/dist/src/global/A-Feature/A-Feature.types.js.map +0 -1
  151. package/dist/src/global/A-Fragment/A-Fragment.class.d.ts +0 -36
  152. package/dist/src/global/A-Fragment/A-Fragment.class.js +0 -46
  153. package/dist/src/global/A-Fragment/A-Fragment.class.js.map +0 -1
  154. package/dist/src/global/A-Fragment/A-Fragment.types.d.ts +0 -21
  155. package/dist/src/global/A-Fragment/A-Fragment.types.js +0 -6
  156. package/dist/src/global/A-Fragment/A-Fragment.types.js.map +0 -1
  157. package/dist/src/global/A-Inject/A-Inject.decorator.d.ts +0 -80
  158. package/dist/src/global/A-Inject/A-Inject.decorator.js +0 -49
  159. package/dist/src/global/A-Inject/A-Inject.decorator.js.map +0 -1
  160. package/dist/src/global/A-Inject/A-Inject.error.d.ts +0 -5
  161. package/dist/src/global/A-Inject/A-Inject.error.js +0 -10
  162. package/dist/src/global/A-Inject/A-Inject.error.js.map +0 -1
  163. package/dist/src/global/A-Inject/A-Inject.types.d.ts +0 -42
  164. package/dist/src/global/A-Inject/A-Inject.types.js +0 -3
  165. package/dist/src/global/A-Inject/A-Inject.types.js.map +0 -1
  166. package/dist/src/global/A-Meta/A-Meta.class.d.ts +0 -97
  167. package/dist/src/global/A-Meta/A-Meta.class.js +0 -164
  168. package/dist/src/global/A-Meta/A-Meta.class.js.map +0 -1
  169. package/dist/src/global/A-Meta/A-Meta.types.d.ts +0 -14
  170. package/dist/src/global/A-Meta/A-Meta.types.js +0 -3
  171. package/dist/src/global/A-Meta/A-Meta.types.js.map +0 -1
  172. package/dist/src/global/A-Scope/A-Scope.class.d.ts +0 -466
  173. package/dist/src/global/A-Scope/A-Scope.class.js +0 -791
  174. package/dist/src/global/A-Scope/A-Scope.class.js.map +0 -1
  175. package/dist/src/global/A-Scope/A-Scope.error.d.ts +0 -8
  176. package/dist/src/global/A-Scope/A-Scope.error.js +0 -13
  177. package/dist/src/global/A-Scope/A-Scope.error.js.map +0 -1
  178. package/dist/src/global/A-Scope/A-Scope.types.d.ts +0 -81
  179. package/dist/src/global/A-Scope/A-Scope.types.js +0 -3
  180. package/dist/src/global/A-Scope/A-Scope.types.js.map +0 -1
  181. package/dist/src/global/A-Stage/A-Stage.class.d.ts +0 -112
  182. package/dist/src/global/A-Stage/A-Stage.class.js +0 -240
  183. package/dist/src/global/A-Stage/A-Stage.class.js.map +0 -1
  184. package/dist/src/global/A-Stage/A-Stage.error.d.ts +0 -4
  185. package/dist/src/global/A-Stage/A-Stage.error.js +0 -11
  186. package/dist/src/global/A-Stage/A-Stage.error.js.map +0 -1
  187. package/dist/src/global/A-Stage/A-Stage.types.d.ts +0 -101
  188. package/dist/src/global/A-Stage/A-Stage.types.js +0 -43
  189. package/dist/src/global/A-Stage/A-Stage.types.js.map +0 -1
  190. package/dist/src/global/A-StepManager/A-StepManager.class.d.ts +0 -20
  191. package/dist/src/global/A-StepManager/A-StepManager.class.js +0 -112
  192. package/dist/src/global/A-StepManager/A-StepManager.class.js.map +0 -1
  193. package/dist/src/global/A-StepManager/A-StepManager.error.d.ts +0 -4
  194. package/dist/src/global/A-StepManager/A-StepManager.error.js +0 -9
  195. package/dist/src/global/A-StepManager/A-StepManager.error.js.map +0 -1
  196. package/dist/src/global/ASEID/ASEID.class.d.ts +0 -130
  197. package/dist/src/global/ASEID/ASEID.class.js +0 -167
  198. package/dist/src/global/ASEID/ASEID.class.js.map +0 -1
  199. package/dist/src/global/ASEID/ASEID.constants.d.ts +0 -0
  200. package/dist/src/global/ASEID/ASEID.constants.js +0 -2
  201. package/dist/src/global/ASEID/ASEID.constants.js.map +0 -1
  202. package/dist/src/global/ASEID/ASEID.error.d.ts +0 -5
  203. package/dist/src/global/ASEID/ASEID.error.js +0 -10
  204. package/dist/src/global/ASEID/ASEID.error.js.map +0 -1
  205. package/dist/src/global/ASEID/ASEID.types.d.ts +0 -65
  206. package/dist/src/global/ASEID/ASEID.types.js +0 -5
  207. package/dist/src/global/ASEID/ASEID.types.js.map +0 -1
  208. package/dist/src/helpers/A_Common.helper.d.ts +0 -28
  209. package/dist/src/helpers/A_Common.helper.js +0 -170
  210. package/dist/src/helpers/A_Common.helper.js.map +0 -1
  211. package/dist/src/helpers/A_Formatter.helper.d.ts +0 -35
  212. package/dist/src/helpers/A_Formatter.helper.js +0 -62
  213. package/dist/src/helpers/A_Formatter.helper.js.map +0 -1
  214. package/dist/src/helpers/A_Identity.helper.d.ts +0 -29
  215. package/dist/src/helpers/A_Identity.helper.js +0 -43
  216. package/dist/src/helpers/A_Identity.helper.js.map +0 -1
  217. package/dist/src/helpers/A_TypeGuards.helper.d.ts +0 -207
  218. package/dist/src/helpers/A_TypeGuards.helper.js +0 -296
  219. package/dist/src/helpers/A_TypeGuards.helper.js.map +0 -1
  220. package/dist/src/types/A_Common.types.d.ts +0 -36
  221. package/dist/src/types/A_Common.types.js +0 -3
  222. package/dist/src/types/A_Common.types.js.map +0 -1
  223. package/index.ts +0 -81
  224. package/src/global/A-Dependency/A-DependencyReference.class.ts +0 -61
  225. package/src/global/A-Dependency/A-DependencyReference.types.ts +0 -61
  226. package/trace-require.js +0 -46
  227. 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
- }