@adaas/a-concept 0.0.64 → 0.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.
Files changed (416) hide show
  1. package/dist/index.d.ts +24 -32
  2. package/dist/index.js +35 -52
  3. package/dist/index.js.map +1 -1
  4. package/dist/src/constants/env.constants.d.ts +15 -8
  5. package/dist/src/constants/env.constants.js +17 -10
  6. package/dist/src/constants/env.constants.js.map +1 -1
  7. package/dist/src/global/A-Abstraction/A-Abstraction-Extend.decorator.d.ts +23 -0
  8. package/dist/src/global/A-Abstraction/A-Abstraction-Extend.decorator.js +69 -0
  9. package/dist/src/global/A-Abstraction/A-Abstraction-Extend.decorator.js.map +1 -0
  10. package/dist/src/global/A-Abstraction/A-Abstraction.class.d.ts +47 -20
  11. package/dist/src/global/A-Abstraction/A-Abstraction.class.js +55 -48
  12. package/dist/src/global/A-Abstraction/A-Abstraction.class.js.map +1 -1
  13. package/dist/src/global/A-Abstraction/A-Abstraction.error.d.ts +7 -0
  14. package/dist/src/global/A-Abstraction/A-Abstraction.error.js +12 -0
  15. package/dist/src/global/A-Abstraction/A-Abstraction.error.js.map +1 -0
  16. package/dist/src/global/A-Abstraction/A-Abstraction.types.d.ts +27 -12
  17. package/dist/src/global/A-Abstraction/A-Abstraction.types.js +0 -8
  18. package/dist/src/global/A-Abstraction/A-Abstraction.types.js.map +1 -1
  19. package/dist/src/global/A-Caller/A_Caller.class.d.ts +33 -0
  20. package/dist/src/global/A-Caller/A_Caller.class.js +44 -0
  21. package/dist/src/global/A-Caller/A_Caller.class.js.map +1 -0
  22. package/dist/src/global/A-Caller/A_Caller.error.d.ts +7 -0
  23. package/dist/src/global/A-Caller/A_Caller.error.js +12 -0
  24. package/dist/src/global/A-Caller/A_Caller.error.js.map +1 -0
  25. package/dist/src/global/A-Caller/A_Caller.types.d.ts +18 -0
  26. package/dist/src/{base/A-Errors/A-Errors.types.js → global/A-Caller/A_Caller.types.js} +1 -1
  27. package/dist/src/global/A-Caller/A_Caller.types.js.map +1 -0
  28. package/dist/src/global/A-Component/A-Component.class.d.ts +20 -3
  29. package/dist/src/global/A-Component/A-Component.class.js +35 -19
  30. package/dist/src/global/A-Component/A-Component.class.js.map +1 -1
  31. package/dist/src/global/A-Component/A-Component.constants.d.ts +6 -0
  32. package/dist/src/global/A-Component/A-Component.constants.js +11 -0
  33. package/dist/src/global/A-Component/A-Component.constants.js.map +1 -0
  34. package/dist/src/global/A-Component/A-Component.meta.d.ts +4 -4
  35. package/dist/src/global/A-Component/A-Component.meta.js +6 -8
  36. package/dist/src/global/A-Component/A-Component.meta.js.map +1 -1
  37. package/dist/src/global/A-Component/A-Component.types.d.ts +40 -22
  38. package/dist/src/global/A-Component/A-Component.types.js +1 -8
  39. package/dist/src/global/A-Component/A-Component.types.js.map +1 -1
  40. package/dist/src/global/A-Concept/A-Concept.class.d.ts +153 -0
  41. package/dist/src/global/A-Concept/A-Concept.class.js +260 -0
  42. package/dist/src/global/A-Concept/A-Concept.class.js.map +1 -0
  43. package/dist/src/global/A-Concept/A-Concept.constants.d.ts +33 -0
  44. package/dist/src/global/A-Concept/A-Concept.constants.js +39 -0
  45. package/dist/src/global/A-Concept/A-Concept.constants.js.map +1 -0
  46. package/dist/src/global/A-Concept/{A_Concept.meta.js → A-Concept.meta.js} +1 -2
  47. package/dist/src/global/A-Concept/A-Concept.meta.js.map +1 -0
  48. package/dist/src/global/A-Concept/A-Concept.types.d.ts +83 -0
  49. package/dist/src/global/{A-Channel/A-Channel.types.js → A-Concept/A-Concept.types.js} +1 -1
  50. package/dist/src/global/A-Concept/A-Concept.types.js.map +1 -0
  51. package/dist/src/global/A-Container/A-Container.class.d.ts +31 -35
  52. package/dist/src/global/A-Container/A-Container.class.js +34 -55
  53. package/dist/src/global/A-Container/A-Container.class.js.map +1 -1
  54. package/dist/src/global/A-Container/A-Container.constants.d.ts +5 -0
  55. package/dist/src/global/A-Container/A-Container.constants.js +10 -0
  56. package/dist/src/global/A-Container/A-Container.constants.js.map +1 -0
  57. package/dist/src/global/A-Container/A-Container.meta.d.ts +6 -6
  58. package/dist/src/global/A-Container/A-Container.meta.js +5 -6
  59. package/dist/src/global/A-Container/A-Container.meta.js.map +1 -1
  60. package/dist/src/global/A-Container/A-Container.types.d.ts +31 -25
  61. package/dist/src/global/A-Container/A-Container.types.js +1 -7
  62. package/dist/src/global/A-Container/A-Container.types.js.map +1 -1
  63. package/dist/src/global/A-Context/A-Context.class.d.ts +302 -76
  64. package/dist/src/global/A-Context/A-Context.class.js +436 -244
  65. package/dist/src/global/A-Context/A-Context.class.js.map +1 -1
  66. package/dist/src/global/A-Context/A-Context.error.d.ts +20 -0
  67. package/dist/src/global/A-Context/A-Context.error.js +25 -0
  68. package/dist/src/global/A-Context/A-Context.error.js.map +1 -0
  69. package/dist/src/global/A-Context/A-Context.types.d.ts +5 -0
  70. package/dist/src/global/A-Context/A-Context.types.js +1 -0
  71. package/dist/src/global/A-Entity/A-Entity.class.d.ts +18 -18
  72. package/dist/src/global/A-Entity/A-Entity.class.js +36 -43
  73. package/dist/src/global/A-Entity/A-Entity.class.js.map +1 -1
  74. package/dist/src/global/A-Entity/A-Entity.constants.d.ts +11 -0
  75. package/dist/src/global/A-Entity/A-Entity.constants.js +17 -0
  76. package/dist/src/global/A-Entity/A-Entity.constants.js.map +1 -0
  77. package/dist/src/global/A-Entity/A-Entity.error.d.ts +7 -0
  78. package/dist/src/global/A-Entity/A-Entity.error.js +12 -0
  79. package/dist/src/global/A-Entity/A-Entity.error.js.map +1 -0
  80. package/dist/src/global/A-Entity/A-Entity.meta.d.ts +2 -2
  81. package/dist/src/global/A-Entity/A-Entity.meta.js +2 -2
  82. package/dist/src/global/A-Entity/A-Entity.meta.js.map +1 -1
  83. package/dist/src/global/A-Entity/A-Entity.types.d.ts +24 -29
  84. package/dist/src/global/A-Entity/A-Entity.types.js +1 -13
  85. package/dist/src/global/A-Entity/A-Entity.types.js.map +1 -1
  86. package/dist/src/global/A-Error/A_Error.class.d.ts +219 -0
  87. package/dist/src/global/A-Error/A_Error.class.js +267 -0
  88. package/dist/src/global/A-Error/A_Error.class.js.map +1 -0
  89. package/dist/src/global/A-Error/A_Error.constants.d.ts +5 -0
  90. package/dist/src/global/A-Error/A_Error.constants.js +9 -0
  91. package/dist/src/global/A-Error/A_Error.constants.js.map +1 -0
  92. package/dist/src/global/A-Error/A_Error.types.d.ts +89 -0
  93. package/dist/src/{decorators/A-Inject/A-Inject.decorator.types.js → global/A-Error/A_Error.types.js} +1 -1
  94. package/dist/src/global/A-Error/A_Error.types.js.map +1 -0
  95. package/dist/src/global/A-Feature/A-Feature-Define.decorator.d.ts +15 -0
  96. package/dist/src/{decorators → global}/A-Feature/A-Feature-Define.decorator.js +21 -27
  97. package/dist/src/global/A-Feature/A-Feature-Define.decorator.js.map +1 -0
  98. package/dist/src/{decorators → global}/A-Feature/A-Feature-Extend.decorator.d.ts +26 -3
  99. package/dist/src/global/A-Feature/A-Feature-Extend.decorator.js +97 -0
  100. package/dist/src/global/A-Feature/A-Feature-Extend.decorator.js.map +1 -0
  101. package/dist/src/global/A-Feature/A-Feature.class.d.ts +120 -30
  102. package/dist/src/global/A-Feature/A-Feature.class.js +205 -73
  103. package/dist/src/global/A-Feature/A-Feature.class.js.map +1 -1
  104. package/dist/src/global/A-Feature/A-Feature.error.d.ts +25 -0
  105. package/dist/src/global/A-Feature/A-Feature.error.js +33 -0
  106. package/dist/src/global/A-Feature/A-Feature.error.js.map +1 -0
  107. package/dist/src/global/A-Feature/A-Feature.types.d.ts +241 -18
  108. package/dist/src/global/A-Feature/A-Feature.types.js +16 -22
  109. package/dist/src/global/A-Feature/A-Feature.types.js.map +1 -1
  110. package/dist/src/global/A-Fragment/A-Fragment.class.d.ts +19 -27
  111. package/dist/src/global/A-Fragment/A-Fragment.class.js +21 -91
  112. package/dist/src/global/A-Fragment/A-Fragment.class.js.map +1 -1
  113. package/dist/src/global/A-Fragment/A-Fragment.types.d.ts +19 -1
  114. package/dist/src/global/A-Fragment/A-Fragment.types.js +3 -0
  115. package/dist/src/global/A-Fragment/A-Fragment.types.js.map +1 -1
  116. package/dist/src/global/A-Inject/A-Inject.decorator.d.ts +80 -0
  117. package/dist/src/global/A-Inject/A-Inject.decorator.js +49 -0
  118. package/dist/src/global/A-Inject/A-Inject.decorator.js.map +1 -0
  119. package/dist/src/global/A-Inject/A-Inject.error.d.ts +5 -0
  120. package/dist/src/global/A-Inject/A-Inject.error.js +10 -0
  121. package/dist/src/global/A-Inject/A-Inject.error.js.map +1 -0
  122. package/dist/src/global/A-Inject/A-Inject.types.d.ts +42 -0
  123. package/dist/src/{decorators/A-Entity/A-Entity.decorator.types.js → global/A-Inject/A-Inject.types.js} +1 -1
  124. package/dist/src/global/A-Inject/A-Inject.types.js.map +1 -0
  125. package/dist/src/global/A-Meta/A-Meta.class.d.ts +1 -1
  126. package/dist/src/global/A-Meta/A-Meta.types.d.ts +14 -0
  127. package/dist/src/global/A-Meta/A-Meta.types.js +1 -0
  128. package/dist/src/global/A-Scope/A-Scope.class.d.ts +124 -142
  129. package/dist/src/global/A-Scope/A-Scope.class.js +163 -209
  130. package/dist/src/global/A-Scope/A-Scope.class.js.map +1 -1
  131. package/dist/src/global/A-Scope/A-Scope.error.d.ts +6 -0
  132. package/dist/src/global/A-Scope/A-Scope.error.js +11 -0
  133. package/dist/src/global/A-Scope/A-Scope.error.js.map +1 -0
  134. package/dist/src/global/A-Scope/A-Scope.types.d.ts +48 -13
  135. package/dist/src/global/A-Stage/A-Stage.class.d.ts +31 -23
  136. package/dist/src/global/A-Stage/A-Stage.class.js +100 -68
  137. package/dist/src/global/A-Stage/A-Stage.class.js.map +1 -1
  138. package/dist/src/global/A-Stage/A-Stage.error.d.ts +2 -1
  139. package/dist/src/global/A-Stage/A-Stage.error.js +5 -2
  140. package/dist/src/global/A-Stage/A-Stage.error.js.map +1 -1
  141. package/dist/src/global/A-Stage/A-Stage.types.d.ts +4 -16
  142. package/dist/src/global/A-Stage/A-Stage.types.js +0 -16
  143. package/dist/src/global/A-Stage/A-Stage.types.js.map +1 -1
  144. package/dist/src/global/ASEID/ASEID.class.d.ts +130 -0
  145. package/dist/src/global/ASEID/ASEID.class.js +167 -0
  146. package/dist/src/global/ASEID/ASEID.class.js.map +1 -0
  147. package/dist/src/global/ASEID/ASEID.constants.js +2 -0
  148. package/dist/src/global/ASEID/ASEID.constants.js.map +1 -0
  149. package/dist/src/global/ASEID/ASEID.error.d.ts +5 -0
  150. package/dist/src/global/ASEID/ASEID.error.js +10 -0
  151. package/dist/src/global/ASEID/ASEID.error.js.map +1 -0
  152. package/dist/src/global/ASEID/ASEID.types.d.ts +65 -0
  153. package/dist/src/global/ASEID/ASEID.types.js +5 -0
  154. package/dist/src/global/ASEID/ASEID.types.js.map +1 -0
  155. package/dist/src/helpers/A_Common.helper.d.ts +28 -0
  156. package/dist/src/helpers/A_Common.helper.js +170 -0
  157. package/dist/src/helpers/A_Common.helper.js.map +1 -0
  158. package/dist/src/helpers/A_Formatter.helper.d.ts +35 -0
  159. package/dist/src/helpers/A_Formatter.helper.js +62 -0
  160. package/dist/src/helpers/A_Formatter.helper.js.map +1 -0
  161. package/dist/src/helpers/A_Identity.helper.d.ts +29 -0
  162. package/dist/src/helpers/A_Identity.helper.js +43 -0
  163. package/dist/src/helpers/A_Identity.helper.js.map +1 -0
  164. package/dist/src/helpers/{StepsManager.class.d.ts → A_StepsManager.class.d.ts} +4 -2
  165. package/dist/src/helpers/{StepsManager.class.js → A_StepsManager.class.js} +10 -5
  166. package/dist/src/helpers/A_StepsManager.class.js.map +1 -0
  167. package/dist/src/helpers/A_TypeGuards.helper.d.ts +205 -0
  168. package/dist/src/helpers/A_TypeGuards.helper.js +288 -0
  169. package/dist/src/helpers/A_TypeGuards.helper.js.map +1 -0
  170. package/dist/src/types/A_Common.types.d.ts +36 -0
  171. package/dist/src/types/A_Common.types.js +3 -0
  172. package/dist/src/types/A_Common.types.js.map +1 -0
  173. package/index.ts +27 -51
  174. package/jest.config.ts +1 -0
  175. package/package.json +1 -2
  176. package/src/constants/env.constants.ts +18 -11
  177. package/src/global/A-Abstraction/A-Abstraction-Extend.decorator.ts +103 -0
  178. package/src/global/A-Abstraction/A-Abstraction.class.ts +71 -65
  179. package/src/global/A-Abstraction/A-Abstraction.error.ts +9 -0
  180. package/src/global/A-Abstraction/A-Abstraction.types.ts +52 -13
  181. package/src/global/A-Caller/A_Caller.class.ts +61 -0
  182. package/src/global/A-Caller/A_Caller.error.ts +10 -0
  183. package/src/global/A-Caller/A_Caller.types.ts +25 -0
  184. package/src/global/A-Component/A-Component.class.ts +26 -15
  185. package/src/global/A-Component/A-Component.constants.ts +9 -0
  186. package/src/global/A-Component/A-Component.meta.ts +6 -16
  187. package/src/global/A-Component/A-Component.types.ts +53 -28
  188. package/src/global/A-Concept/A-Concept.class.ts +316 -0
  189. package/src/global/A-Concept/A-Concept.constants.ts +36 -0
  190. package/src/global/A-Concept/A-Concept.meta.ts +17 -0
  191. package/src/global/A-Concept/A-Concept.types.ts +100 -0
  192. package/src/global/A-Container/A-Container.class.ts +42 -83
  193. package/src/global/A-Container/A-Container.constants.ts +5 -0
  194. package/src/global/A-Container/A-Container.meta.ts +7 -11
  195. package/src/global/A-Container/A-Container.types.ts +38 -34
  196. package/src/global/A-Context/A-Context.class.ts +648 -412
  197. package/src/global/A-Context/A-Context.error.ts +44 -0
  198. package/src/global/A-Context/A-Context.types.ts +14 -0
  199. package/src/global/A-Entity/A-Entity.class.ts +39 -52
  200. package/src/global/A-Entity/A-Entity.constants.ts +12 -0
  201. package/src/global/A-Entity/A-Entity.error.ts +12 -0
  202. package/src/global/A-Entity/A-Entity.meta.ts +4 -4
  203. package/src/global/A-Entity/A-Entity.types.ts +31 -36
  204. package/src/global/A-Error/A_Error.class.ts +408 -0
  205. package/src/global/A-Error/A_Error.constants.ts +11 -0
  206. package/src/global/A-Error/A_Error.types.ts +96 -0
  207. package/src/{decorators → global}/A-Feature/A-Feature-Define.decorator.ts +31 -37
  208. package/src/global/A-Feature/A-Feature-Extend.decorator.ts +187 -0
  209. package/src/global/A-Feature/A-Feature.class.ts +279 -122
  210. package/src/global/A-Feature/A-Feature.error.ts +33 -0
  211. package/src/global/A-Feature/A-Feature.types.ts +278 -40
  212. package/src/global/A-Fragment/A-Fragment.class.ts +29 -100
  213. package/src/global/A-Fragment/A-Fragment.types.ts +25 -3
  214. package/src/global/A-Inject/A-Inject.decorator.ts +167 -0
  215. package/src/global/A-Inject/A-Inject.error.ts +8 -0
  216. package/src/global/A-Inject/A-Inject.types.ts +75 -0
  217. package/src/global/A-Meta/A-Meta.class.ts +1 -1
  218. package/src/global/A-Meta/A-Meta.types.ts +21 -0
  219. package/src/global/A-Scope/A-Scope.class.ts +288 -299
  220. package/src/global/A-Scope/A-Scope.error.ts +13 -0
  221. package/src/global/A-Scope/A-Scope.types.ts +61 -27
  222. package/src/global/A-Stage/A-Stage.class.ts +142 -80
  223. package/src/global/A-Stage/A-Stage.error.ts +4 -2
  224. package/src/global/A-Stage/A-Stage.types.ts +4 -25
  225. package/src/global/ASEID/ASEID.class.ts +275 -0
  226. package/src/global/ASEID/ASEID.error.ts +12 -0
  227. package/src/global/ASEID/ASEID.types.ts +79 -0
  228. package/src/helpers/A_Common.helper.ts +204 -0
  229. package/src/helpers/A_Formatter.helper.ts +58 -0
  230. package/src/helpers/A_Identity.helper.ts +53 -0
  231. package/src/helpers/{StepsManager.class.ts → A_StepsManager.class.ts} +19 -3
  232. package/src/helpers/A_TypeGuards.helper.ts +318 -0
  233. package/src/types/A_Common.types.ts +79 -0
  234. package/tests/A-Common.test.ts +117 -0
  235. package/tests/A-Component.test.ts +11 -6
  236. package/tests/A-Concept.test.ts +19 -22
  237. package/tests/A-Entity.test.ts +24 -24
  238. package/tests/A-Error.test.ts +129 -0
  239. package/tests/A-Feature.test.ts +34 -25
  240. package/tests/A-Scope.test.ts +50 -22
  241. package/tests/ASEID.test.ts +74 -0
  242. package/tsconfig.build.json +2 -1
  243. package/tsconfig.json +3 -2
  244. package/dist/src/base/A-Config/A-Config.container.d.ts +0 -9
  245. package/dist/src/base/A-Config/A-Config.container.js +0 -69
  246. package/dist/src/base/A-Config/A-Config.container.js.map +0 -1
  247. package/dist/src/base/A-Config/A-Config.context.d.ts +0 -30
  248. package/dist/src/base/A-Config/A-Config.context.js +0 -60
  249. package/dist/src/base/A-Config/A-Config.context.js.map +0 -1
  250. package/dist/src/base/A-Config/A-Config.types.d.ts +0 -20
  251. package/dist/src/base/A-Config/A-Config.types.js +0 -7
  252. package/dist/src/base/A-Config/A-Config.types.js.map +0 -1
  253. package/dist/src/base/A-Config/components/ConfigReader.component.d.ts +0 -29
  254. package/dist/src/base/A-Config/components/ConfigReader.component.js +0 -84
  255. package/dist/src/base/A-Config/components/ConfigReader.component.js.map +0 -1
  256. package/dist/src/base/A-Config/components/ENVConfigReader.component.d.ts +0 -10
  257. package/dist/src/base/A-Config/components/ENVConfigReader.component.js +0 -37
  258. package/dist/src/base/A-Config/components/ENVConfigReader.component.js.map +0 -1
  259. package/dist/src/base/A-Config/components/FileConfigReader.component.d.ts +0 -11
  260. package/dist/src/base/A-Config/components/FileConfigReader.component.js +0 -48
  261. package/dist/src/base/A-Config/components/FileConfigReader.component.js.map +0 -1
  262. package/dist/src/base/A-Errors/A-Error.entity.d.ts +0 -3
  263. package/dist/src/base/A-Errors/A-Error.entity.js +0 -8
  264. package/dist/src/base/A-Errors/A-Error.entity.js.map +0 -1
  265. package/dist/src/base/A-Errors/A-Errors.component.d.ts +0 -19
  266. package/dist/src/base/A-Errors/A-Errors.component.js +0 -87
  267. package/dist/src/base/A-Errors/A-Errors.component.js.map +0 -1
  268. package/dist/src/base/A-Errors/A-Errors.context.d.ts +0 -27
  269. package/dist/src/base/A-Errors/A-Errors.context.js +0 -50
  270. package/dist/src/base/A-Errors/A-Errors.context.js.map +0 -1
  271. package/dist/src/base/A-Errors/A-Errors.types.d.ts +0 -5
  272. package/dist/src/base/A-Errors/A-Errors.types.js.map +0 -1
  273. package/dist/src/base/A-Logger/A-Logger.component.d.ts +0 -31
  274. package/dist/src/base/A-Logger/A-Logger.component.js +0 -155
  275. package/dist/src/base/A-Logger/A-Logger.component.js.map +0 -1
  276. package/dist/src/base/A-Logger/A-Logger.types.js +0 -2
  277. package/dist/src/base/A-Logger/A-Logger.types.js.map +0 -1
  278. package/dist/src/base/A-Polyfill/A-Polyfill.component.d.ts +0 -5
  279. package/dist/src/base/A-Polyfill/A-Polyfill.component.js +0 -34
  280. package/dist/src/base/A-Polyfill/A-Polyfill.component.js.map +0 -1
  281. package/dist/src/decorators/A-Abstraction/A-Abstraction-Extend.decorator.d.ts +0 -14
  282. package/dist/src/decorators/A-Abstraction/A-Abstraction-Extend.decorator.js +0 -53
  283. package/dist/src/decorators/A-Abstraction/A-Abstraction-Extend.decorator.js.map +0 -1
  284. package/dist/src/decorators/A-Abstraction/A-Abstraction.decorator.types.d.ts +0 -2
  285. package/dist/src/decorators/A-Abstraction/A-Abstraction.decorator.types.js +0 -3
  286. package/dist/src/decorators/A-Abstraction/A-Abstraction.decorator.types.js.map +0 -1
  287. package/dist/src/decorators/A-Connect/A-Connect.decorator.d.ts +0 -19
  288. package/dist/src/decorators/A-Connect/A-Connect.decorator.js +0 -31
  289. package/dist/src/decorators/A-Connect/A-Connect.decorator.js.map +0 -1
  290. package/dist/src/decorators/A-Connect/A-Connect.decorator.types.d.ts +0 -1
  291. package/dist/src/decorators/A-Connect/A-Connect.decorator.types.js +0 -3
  292. package/dist/src/decorators/A-Connect/A-Connect.decorator.types.js.map +0 -1
  293. package/dist/src/decorators/A-Entity/A-Entity-List.decorator.d.ts +0 -1
  294. package/dist/src/decorators/A-Entity/A-Entity-List.decorator.js +0 -8
  295. package/dist/src/decorators/A-Entity/A-Entity-List.decorator.js.map +0 -1
  296. package/dist/src/decorators/A-Entity/A-Entity.decorator.types.d.ts +0 -14
  297. package/dist/src/decorators/A-Entity/A-Entity.decorator.types.js.map +0 -1
  298. package/dist/src/decorators/A-Feature/A-Feature-Define.decorator.d.ts +0 -19
  299. package/dist/src/decorators/A-Feature/A-Feature-Define.decorator.js.map +0 -1
  300. package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.js +0 -81
  301. package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.js.map +0 -1
  302. package/dist/src/decorators/A-Feature/A-Feature.decorator.types.d.ts +0 -96
  303. package/dist/src/decorators/A-Feature/A-Feature.decorator.types.js +0 -3
  304. package/dist/src/decorators/A-Feature/A-Feature.decorator.types.js.map +0 -1
  305. package/dist/src/decorators/A-Inject/A-Inject.decorator.d.ts +0 -30
  306. package/dist/src/decorators/A-Inject/A-Inject.decorator.js +0 -47
  307. package/dist/src/decorators/A-Inject/A-Inject.decorator.js.map +0 -1
  308. package/dist/src/decorators/A-Inject/A-Inject.decorator.types.d.ts +0 -48
  309. package/dist/src/decorators/A-Inject/A-Inject.decorator.types.js.map +0 -1
  310. package/dist/src/global/A-Channel/A-Channel.class.d.ts +0 -16
  311. package/dist/src/global/A-Channel/A-Channel.class.js +0 -59
  312. package/dist/src/global/A-Channel/A-Channel.class.js.map +0 -1
  313. package/dist/src/global/A-Channel/A-Channel.types.d.ts +0 -68
  314. package/dist/src/global/A-Channel/A-Channel.types.js.map +0 -1
  315. package/dist/src/global/A-Command/A-Command.class.d.ts +0 -187
  316. package/dist/src/global/A-Command/A-Command.class.js +0 -349
  317. package/dist/src/global/A-Command/A-Command.class.js.map +0 -1
  318. package/dist/src/global/A-Command/A-Command.constants.d.ts +0 -17
  319. package/dist/src/global/A-Command/A-Command.constants.js +0 -22
  320. package/dist/src/global/A-Command/A-Command.constants.js.map +0 -1
  321. package/dist/src/global/A-Command/A-Command.meta.d.ts +0 -11
  322. package/dist/src/global/A-Command/A-Command.meta.js +0 -18
  323. package/dist/src/global/A-Command/A-Command.meta.js.map +0 -1
  324. package/dist/src/global/A-Command/A-Command.types.d.ts +0 -43
  325. package/dist/src/global/A-Command/A-Command.types.js +0 -10
  326. package/dist/src/global/A-Command/A-Command.types.js.map +0 -1
  327. package/dist/src/global/A-Command/context/A_Command.context.d.ts +0 -64
  328. package/dist/src/global/A-Command/context/A_Command.context.js +0 -85
  329. package/dist/src/global/A-Command/context/A_Command.context.js.map +0 -1
  330. package/dist/src/global/A-Concept/A_Concept.class.d.ts +0 -104
  331. package/dist/src/global/A-Concept/A_Concept.class.js +0 -217
  332. package/dist/src/global/A-Concept/A_Concept.class.js.map +0 -1
  333. package/dist/src/global/A-Concept/A_Concept.meta.js.map +0 -1
  334. package/dist/src/global/A-Concept/A_Concept.types.d.ts +0 -103
  335. package/dist/src/global/A-Concept/A_Concept.types.js +0 -28
  336. package/dist/src/global/A-Concept/A_Concept.types.js.map +0 -1
  337. package/dist/src/global/A-Feature/A-FeatureCaller.class.d.ts +0 -22
  338. package/dist/src/global/A-Feature/A-FeatureCaller.class.js +0 -26
  339. package/dist/src/global/A-Feature/A-FeatureCaller.class.js.map +0 -1
  340. package/dist/src/global/A-Scope/A-Scope.constants.d.ts +0 -2
  341. package/dist/src/global/A-Scope/A-Scope.constants.js +0 -11
  342. package/dist/src/global/A-Scope/A-Scope.constants.js.map +0 -1
  343. package/dist/src/helpers/StepsManager.class.js.map +0 -1
  344. package/dist/src/types/A_Module.types.d.ts +0 -17
  345. package/dist/src/types/A_Module.types.js +0 -22
  346. package/dist/src/types/A_Module.types.js.map +0 -1
  347. package/examples/entity/concept.ts +0 -68
  348. package/examples/entity/entities/Task.entity.ts +0 -110
  349. package/examples/entity/entities/User.entity.ts +0 -62
  350. package/examples/fe-be/channels/Test.channel.ts +0 -27
  351. package/examples/fe-be/components/BE-Controller.component.ts +0 -20
  352. package/examples/fe-be/components/FE.component.ts +0 -13
  353. package/examples/fe-be/containers/ServerApp.container.ts +0 -8
  354. package/examples/fe-be/containers/WebApp.container.ts +0 -13
  355. package/examples/multi-container/channels/Direct.channel.ts +0 -39
  356. package/examples/multi-container/concept.ts +0 -0
  357. package/examples/multi-container/containers/Command.container.ts +0 -41
  358. package/examples/multi-container/containers/Schedule.container.ts +0 -52
  359. package/examples/simple/components/A.component.ts +0 -71
  360. package/examples/simple/components/B.component.ts +0 -68
  361. package/examples/simple/concept.ts +0 -87
  362. package/examples/simple/containers/Main.container.ts +0 -88
  363. package/examples/simple/containers/Secondary.container.ts +0 -26
  364. package/examples/simple/context/Fragment_A.context.ts +0 -25
  365. package/examples/simple/context/Fragment_B.context.ts +0 -19
  366. package/examples/simple/entities/EntityA.entity.ts +0 -32
  367. package/examples/simple-http-server/components/http-error-handler.component.ts +0 -47
  368. package/examples/simple-http-server/components/http-request-handler.component.ts +0 -13
  369. package/examples/simple-http-server/concept.ts +0 -35
  370. package/examples/simple-http-server/containers/http-server.container.ts +0 -57
  371. package/examples/simple-http-server/contexts/http-request.context.ts +0 -59
  372. package/examples/simple-http-server/contexts/http-server.context.types.ts +0 -0
  373. package/examples/simple-http-server/controllers/orders.controller.ts +0 -20
  374. package/examples/simple-http-server/controllers/users.controller.ts +0 -104
  375. package/examples/simple-http-server/test.ts +0 -290
  376. package/src/base/A-Config/A-Config.container.ts +0 -68
  377. package/src/base/A-Config/A-Config.context.ts +0 -114
  378. package/src/base/A-Config/A-Config.types.ts +0 -28
  379. package/src/base/A-Config/components/ConfigReader.component.ts +0 -68
  380. package/src/base/A-Config/components/ENVConfigReader.component.ts +0 -31
  381. package/src/base/A-Config/components/FileConfigReader.component.ts +0 -41
  382. package/src/base/A-Errors/A-Error.entity.ts +0 -10
  383. package/src/base/A-Errors/A-Errors.component.ts +0 -103
  384. package/src/base/A-Errors/A-Errors.context.ts +0 -90
  385. package/src/base/A-Errors/A-Errors.types.ts +0 -6
  386. package/src/base/A-Logger/A-Logger.component.ts +0 -192
  387. package/src/base/A-Logger/A-Logger.types.ts +0 -0
  388. package/src/base/A-Polyfill/A-Polyfill.component.ts +0 -18
  389. package/src/decorators/A-Abstraction/A-Abstraction-Extend.decorator.ts +0 -81
  390. package/src/decorators/A-Abstraction/A-Abstraction.decorator.types.ts +0 -21
  391. package/src/decorators/A-Connect/A-Connect.decorator.ts +0 -71
  392. package/src/decorators/A-Connect/A-Connect.decorator.types.ts +0 -6
  393. package/src/decorators/A-Entity/A-Entity-List.decorator.ts +0 -12
  394. package/src/decorators/A-Entity/A-Entity.decorator.types.ts +0 -18
  395. package/src/decorators/A-Feature/A-Feature-Extend.decorator.ts +0 -151
  396. package/src/decorators/A-Feature/A-Feature.decorator.types.ts +0 -142
  397. package/src/decorators/A-Inject/A-Inject.decorator.ts +0 -119
  398. package/src/decorators/A-Inject/A-Inject.decorator.types.ts +0 -85
  399. package/src/global/A-Channel/A-Channel.class.ts +0 -111
  400. package/src/global/A-Channel/A-Channel.types.ts +0 -114
  401. package/src/global/A-Command/A-Command.class.ts +0 -419
  402. package/src/global/A-Command/A-Command.constants.ts +0 -27
  403. package/src/global/A-Command/A-Command.meta.ts +0 -22
  404. package/src/global/A-Command/A-Command.types.ts +0 -73
  405. package/src/global/A-Command/context/A_Command.context.ts +0 -114
  406. package/src/global/A-Concept/A_Concept.class.ts +0 -298
  407. package/src/global/A-Concept/A_Concept.meta.ts +0 -32
  408. package/src/global/A-Concept/A_Concept.types.ts +0 -143
  409. package/src/global/A-Feature/A-FeatureCaller.class.ts +0 -38
  410. package/src/global/A-Scope/A-Scope.constants.ts +0 -9
  411. package/src/types/A_Module.types.ts +0 -23
  412. package/tests/A-Command.test.ts +0 -133
  413. package/tests/A-Config.test.ts +0 -172
  414. /package/dist/src/global/A-Concept/{A_Concept.meta.d.ts → A-Concept.meta.d.ts} +0 -0
  415. /package/dist/src/{base/A-Logger/A-Logger.types.d.ts → global/ASEID/ASEID.constants.d.ts} +0 -0
  416. /package/{examples/fe-be/concept.ts → src/global/ASEID/ASEID.constants.ts} +0 -0
@@ -1,42 +1,45 @@
1
1
  import {
2
- A_CommonHelper,
3
- A_Error,
4
- ASEID
5
- } from "@adaas/a-utils";
6
- import {
7
- A_TYPES__AllowedCommandsConstructor,
8
- A_TYPES__AllowedComponentsConstructor,
9
- A_TYPES__AllowedEntitiesConstructor,
10
- A_TYPES__AllowedFragmentsConstructor,
11
- A_TYPES__AllowedScopesConstructor,
12
2
  A_TYPES__ScopeConfig,
13
- A_TYPES__ScopeConstructor
3
+ A_TYPES__Scope_Init,
4
+ A_TYPES__ScopeLinkedComponents,
5
+ A_TYPES__ScopeResolvableComponents,
6
+ A_TYPES__Scope_Constructor
14
7
  } from './A-Scope.types'
15
8
  import {
16
9
  A_TYPES__A_InjectDecorator_EntityInjectionInstructions,
17
10
  A_TYPES__A_InjectDecorator_EntityInjectionQuery,
18
- } from "@adaas/a-concept/decorators/A-Inject/A-Inject.decorator.types";
19
- import { A_TYPES__ComponentMetaKey } from "../A-Component/A-Component.types";
11
+ A_TYPES__InjectableConstructors,
12
+ } from "@adaas/a-concept/global/A-Inject/A-Inject.types";
20
13
  import { A_Fragment } from "../A-Fragment/A-Fragment.class";
21
14
  import { A_Context } from "../A-Context/A-Context.class";
22
15
  import { A_Component } from "../A-Component/A-Component.class";
23
16
  import { A_Entity } from "../A-Entity/A-Entity.class";
24
- import { A_Command } from "../A-Command/A-Command.class";
17
+ import { A_TypeGuards } from "@adaas/a-concept/helpers/A_TypeGuards.helper";
18
+ import { A_Error } from "../A-Error/A_Error.class";
19
+ import { A_FormatterHelper } from '@adaas/a-concept/helpers/A_Formatter.helper';
20
+ import { ASEID } from '../ASEID/ASEID.class';
21
+ import { A_CommonHelper } from '@adaas/a-concept/helpers/A_Common.helper';
22
+ import { A_TYPES__Entity_Constructor } from '../A-Entity/A-Entity.types';
23
+ import { A_ScopeError } from './A-Scope.error';
24
+ import { A_TYPES__Component_Constructor } from '../A-Component/A-Component.types';
25
+ import { A_TYPES__Fragment_Constructor } from '../A-Fragment/A-Fragment.types';
26
+ import { A_TYPES__Error_Constructor } from '../A-Error/A_Error.types';
27
+ import { A_TYPES__ComponentMetaKey } from '../A-Component/A-Component.constants';
25
28
 
26
29
 
27
30
 
28
31
 
29
32
  export class A_Scope<
30
- _ComponentType extends A_TYPES__AllowedComponentsConstructor[] = A_TYPES__AllowedComponentsConstructor[],
31
- _CommandType extends A_TYPES__AllowedCommandsConstructor[] = A_TYPES__AllowedCommandsConstructor[],
32
- _EntityType extends A_Entity[] = A_Entity[],
33
+ _ComponentType extends A_TYPES__Component_Constructor[] = A_TYPES__Component_Constructor[],
34
+ _ErrorType extends A_TYPES__Error_Constructor[] = A_TYPES__Error_Constructor[],
35
+ _EntityType extends A_TYPES__Entity_Constructor[] = A_TYPES__Entity_Constructor[],
33
36
  _FragmentType extends A_Fragment[] = A_Fragment[],
34
37
  > {
35
38
 
36
39
  /**
37
40
  * Scope Name uses for identification and logging purposes
38
41
  */
39
- readonly name: string = '';
42
+ protected _name!: string;
40
43
  /**
41
44
  * Parent scope reference, used for inheritance of components, fragments, entities and commands
42
45
  */
@@ -51,67 +54,76 @@ export class A_Scope<
51
54
  */
52
55
  protected _allowedComponents = new Set<_ComponentType[number]>();
53
56
  /**
54
- * A set of allowed entities, A set of constructors that are allowed in the scope
57
+ * A set of allowed errors, A set of constructors that are allowed in the scope
55
58
  */
56
- protected _allowedEntities = new Set<A_TYPES__AllowedEntitiesConstructor<_EntityType[number]>>();
59
+ protected _allowedErrors = new Set<_ErrorType[number]>();
57
60
  /**
58
- * A set of allowed fragments, A set of constructors that are allowed in the scope
61
+ * A set of allowed entities, A set of constructors that are allowed in the scope
59
62
  */
60
- protected _allowedFragments = new Set<A_TYPES__AllowedFragmentsConstructor<_FragmentType[number]>>();
63
+ protected _allowedEntities = new Set<_EntityType[number]>();
61
64
  /**
62
- * A set of allowed commands, A set of constructors that are allowed in the scope
65
+ * A set of allowed fragments, A set of constructors that are allowed in the scope
63
66
  */
64
- protected _allowedCommands = new Set<_CommandType[number]>();
67
+ protected _allowedFragments = new Set<A_TYPES__Fragment_Constructor<_FragmentType[number]>>();
68
+
65
69
 
66
70
 
67
71
  // ===========================================================================
68
72
  // --------------------Internal Storage--------------------------------
69
73
  // ===========================================================================
70
74
  /**
71
- * Internal storage for the components, fragments, entities and commands
75
+ * Storage for the components, should be strong as components are unique per scope
72
76
  */
73
77
  protected _components: Map<_ComponentType[number], InstanceType<_ComponentType[number]>> = new Map();
74
78
  /**
75
- * Storage for the fragments, should be weak as fragments are singletons per scope
79
+ * Storage for the errors, should be strong as errors are unique per code
76
80
  */
77
- protected _fragments: Map<A_TYPES__AllowedFragmentsConstructor<_FragmentType[number]>, _FragmentType[number]> = new Map();
81
+ protected _errors: Map<string, InstanceType<_ErrorType[number]>> = new Map();
78
82
  /**
79
83
  * Storage for the entities, should be strong as entities are unique per aseid
80
84
  */
81
- protected _entities: Map<string, _EntityType[number]> = new Map();
85
+ protected _entities: Map<string, InstanceType<_EntityType[number]>> = new Map();
82
86
  /**
83
- * Storage for the commands, should be strong as commands are unique per code
87
+ * Storage for the fragments, should be weak as fragments are singletons per scope
84
88
  */
85
- protected _commands: Map<string, InstanceType<_CommandType[number]>> = new Map();
89
+ protected _fragments: Map<A_TYPES__Fragment_Constructor<_FragmentType[number]>, _FragmentType[number]> = new Map();
90
+
86
91
 
87
92
 
88
93
 
89
94
  // ===========================================================================
90
95
  // --------------------Readonly Allowed Properties----------------------------
91
96
  // ===========================================================================
97
+ /**
98
+ * Returns the name of the scope
99
+ */
100
+ get name() { return this._name }
101
+
92
102
  /**
93
103
  * Returns a list of Constructors for A-Components that are available in the scope
94
104
  */
95
105
  get allowedComponents() { return this._allowedComponents }
96
106
  /**
97
- * Returns a list of Constructors for A-Commands that are available in the scope
107
+ * Returns a list of Constructors for A-Entities that are available in the scope
98
108
  */
99
- get allowedCommands() { return this._allowedCommands }
109
+ get allowedEntities() { return this._allowedEntities }
100
110
  /**
101
111
  * Returns a list of Constructors for A-Fragments that are available in the scope
102
112
  */
103
113
  get allowedFragments() { return this._allowedFragments }
104
114
  /**
105
- * Returns a list of Constructors for A-Entities that are available in the scope
115
+ * Returns a list of Constructors for A-Errors that are available in the scope
106
116
  */
107
- get allowedEntities() { return this._allowedEntities }
108
-
117
+ get allowedErrors() { return this._allowedErrors }
118
+ // ===========================================================================
119
+ // --------------------Readonly Registered Properties--------------------------
120
+ // ===========================================================================
109
121
  /**
110
122
  * Returns an Array of entities registered in the scope
111
123
  *
112
124
  * [!] One entity per aseid
113
125
  */
114
- get entities(): Array<_EntityType[number]> { return Array.from(this._entities.values()) }
126
+ get entities(): Array<InstanceType<_EntityType[number]>> { return Array.from(this._entities.values()) }
115
127
  /**
116
128
  * Returns an Array of fragments registered in the scope
117
129
  *
@@ -124,39 +136,85 @@ export class A_Scope<
124
136
  * [!] One component instance per scope
125
137
  */
126
138
  get components(): Array<InstanceType<_ComponentType[number]>> { return Array.from(this._components.values()) }
139
+
127
140
  /**
128
- * Returns an Array of commands registered in the scope
141
+ * Returns the parent scope of the current scope
129
142
  *
130
- * [!] One command per command aseid
131
- * [!!] There may be any number of instances of the same command code, but with different aseids.
143
+ * @param setValue
144
+ * @returns
132
145
  */
133
- get commands(): Array<InstanceType<_CommandType[number]>> { return Array.from(this._commands.values()) }
134
-
135
-
146
+ get parent(): A_Scope | undefined {
147
+ return this._parent;
148
+ }
136
149
  /**
137
150
  * A_Scope refers to the visibility and accessibility of :
138
151
  * - variables,
139
152
  * - Components,
140
153
  * - Context Fragments
141
- * - Commands
142
154
  * - Entities
143
155
  * - and objects in different parts of your code.
144
156
  * Scope determines where a particular piece of data (like a variable or function)
145
157
  * can be accessed, modified, or referenced, and it plays a crucial role in avoiding naming collisions and ensuring data integrity.
146
158
  *
147
- * [!] The scope behavior is similar to tree structure where each scope can have a parent scope and inherit its components, fragments, entities and commands
159
+ * [!] The scope behavior is similar to tree structure where each scope can have a parent scope and inherit its components, fragments, entities and errors
148
160
  *
149
161
  * @param params
150
162
  * @param config
151
163
  */
164
+ constructor()
165
+ constructor(
166
+ /**
167
+ * A set of constructors that are allowed in the scope
168
+ */
169
+ params: Partial<A_TYPES__Scope_Init<_ComponentType, _ErrorType, _EntityType, _FragmentType>>,
170
+ /**
171
+ * Configuration options for the scope
172
+ */
173
+ config?: Partial<A_TYPES__ScopeConfig>
174
+ )
152
175
  constructor(
153
- params: Partial<A_TYPES__ScopeConstructor<_ComponentType, _CommandType, _EntityType, _FragmentType>>,
176
+ param1?: Partial<A_TYPES__Scope_Init<_ComponentType, _ErrorType, _EntityType, _FragmentType>>,
177
+ param2?: Partial<A_TYPES__ScopeConfig>
178
+ ) {
179
+ const initializer = this.getInitializer(param1);
180
+ // the returned initializer is already bound to `this` (we used .bind(this)),
181
+ // so calling it will run the appropriate logic on this instance:
182
+ initializer.call(this, param1, param2);
183
+ }
184
+
185
+
186
+
187
+ /**
188
+ * Determines which initializer method to use based on the type of the first parameter.
189
+ *
190
+ * @param param1
191
+ * @returns
192
+ */
193
+ protected getInitializer(
194
+ param1?: Partial<A_TYPES__Scope_Init<_ComponentType, _ErrorType, _EntityType, _FragmentType>>,
195
+ param2?: Partial<A_TYPES__ScopeConfig>
196
+ ): (param1: any, param2: any) => void | (() => void) {
197
+ switch (true) {
198
+ case !param1 && !param2: ;
199
+ return this.defaultInitialized;
200
+
201
+ case !!param1:
202
+ return this.defaultInitialized;
203
+ default:
204
+ throw new A_ScopeError(A_ScopeError.ConstructorError, 'Invalid parameters provided to A_Scope constructor');
205
+ }
206
+ }
207
+
208
+
209
+
210
+ protected defaultInitialized(
211
+ params: Partial<A_TYPES__Scope_Init<_ComponentType, _ErrorType, _EntityType, _FragmentType>> = {},
154
212
  config: Partial<A_TYPES__ScopeConfig> = {}
155
213
  ) {
156
- this.name = params.name || this.constructor.name
214
+ this._name = params.name || this.constructor.name
157
215
 
158
216
  this.initComponents(params.components);
159
- this.initCommands(params.commands);
217
+ this.initErrors(params.errors);
160
218
  this.initFragments(params.fragments);
161
219
  this.initEntities(params.entities);
162
220
 
@@ -165,6 +223,7 @@ export class A_Scope<
165
223
  }
166
224
  }
167
225
 
226
+
168
227
  //==========================================================================
169
228
  // --------------------Scope Initialization Methods---------------------------
170
229
  //==========================================================================
@@ -178,6 +237,14 @@ export class A_Scope<
178
237
  * @param _components
179
238
  */
180
239
  protected initComponents(_components?: _ComponentType) { _components?.forEach(this.register.bind(this)); }
240
+ /**
241
+ * This method is used to initialize the errors in the scope
242
+ *
243
+ * This method only registers the errors in the scope in case they are not registered yet
244
+ *
245
+ * @param _errors
246
+ */
247
+ protected initErrors(_errors?: _ErrorType) { _errors?.forEach(this.register.bind(this)); }
181
248
  /**
182
249
  * This method is used to initialize the entities in the scope
183
250
  *
@@ -185,7 +252,10 @@ export class A_Scope<
185
252
  *
186
253
  * @param _entities
187
254
  */
188
- protected initEntities(_entities?: _EntityType) { _entities?.forEach(this.register.bind(this)); }
255
+ protected initEntities(_entities?: [
256
+ ..._EntityType,
257
+ ...InstanceType<_EntityType[number]>[]
258
+ ]) { _entities?.forEach(ent => this.register(ent as any)); }
189
259
  /**
190
260
  * This method is used to initialize the fragments in the scope
191
261
  *
@@ -194,30 +264,21 @@ export class A_Scope<
194
264
  * @param _fragments
195
265
  */
196
266
  protected initFragments(_fragments?: _FragmentType) { _fragments?.forEach(this.register.bind(this)); }
197
- /**
198
- * This method is used to initialize the commands in the scope
199
- *
200
- * This method only registers the commands in the scope in case they are not registered yet
201
- *
202
- * @param _commands
203
- */
204
- protected initCommands(_commands?: _CommandType) { _commands?.forEach(this.register.bind(this)); }
205
267
 
206
268
 
207
269
  /**
208
- * This method is used to get or set the parent scope
270
+ * Returns the issuer of the scope, useful for debugging and tracking purposes
209
271
  *
210
- * [!] Note that setting the parent scope will override the existing parent scope
272
+ * Issuer can be:
273
+ * - A Container that allocated the scope
274
+ * - A Feature that allocated the scope
275
+ *
276
+ * [!] 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
211
277
  *
212
- * @param setValue
213
278
  * @returns
214
279
  */
215
- parent(setValue?: A_Scope): A_Scope | undefined {
216
- if (setValue) {
217
- return this.inherit(setValue);
218
- }
219
-
220
- return this._parent;
280
+ issuer<T extends A_TYPES__ScopeLinkedComponents>(): T {
281
+ return A_Context.issuer(this) as T;
221
282
  }
222
283
 
223
284
 
@@ -231,11 +292,29 @@ export class A_Scope<
231
292
  * @returns
232
293
  */
233
294
  inherit(parent: A_Scope): A_Scope {
295
+ if (!parent)
296
+ throw new A_ScopeError(
297
+ A_ScopeError.InitializationError,
298
+ `Invalid parent scope provided`
299
+ );
300
+
301
+ if (parent === this)
302
+ throw new A_ScopeError(
303
+ A_ScopeError.CircularInheritanceError,
304
+ `Unable to inherit scope ${this.name} from itself`
305
+ );
306
+
307
+ if (parent === this._parent)
308
+ return this;
309
+
234
310
  // Prevent circular inheritance
235
311
  const circularCheck = this.checkCircularInheritance(parent);
236
312
 
237
313
  if (circularCheck)
238
- throw new A_Error(`Circular inheritance detected: ${[...circularCheck, parent.name].join(' -> ')}`);
314
+ throw new A_ScopeError(
315
+ A_ScopeError.CircularInheritanceError,
316
+ `Circular inheritance detected: ${[...circularCheck, parent.name].join(' -> ')}`
317
+ );
239
318
 
240
319
 
241
320
  this._parent = parent;
@@ -255,7 +334,7 @@ export class A_Scope<
255
334
  /**
256
335
  * Provide a component constructor to check if it's available in the scope
257
336
  */
258
- component: A_TYPES__AllowedComponentsConstructor<T>
337
+ component: A_TYPES__Component_Constructor<T>
259
338
  ): boolean
260
339
  has<T extends A_Entity>(
261
340
  /**
@@ -263,19 +342,13 @@ export class A_Scope<
263
342
  *
264
343
  * [!] 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
265
344
  */
266
- entity: A_TYPES__AllowedEntitiesConstructor<T>
345
+ entity: A_TYPES__Entity_Constructor<T>
267
346
  ): boolean
268
347
  has<T extends A_Fragment>(
269
348
  /**
270
349
  * Provide a fragment constructor to check if it's available in the scope
271
350
  */
272
- fragment: A_TYPES__AllowedFragmentsConstructor<T>
273
- ): boolean
274
- has<T extends A_Fragment>(
275
- /**
276
- * Provide a command constructor to check if it's available in the scope
277
- */
278
- command: A_TYPES__AllowedCommandsConstructor<T>
351
+ fragment: A_TYPES__Fragment_Constructor<T>
279
352
  ): boolean
280
353
  has(
281
354
  /**
@@ -300,10 +373,6 @@ export class A_Scope<
300
373
  const possibleFragment = Array.from(this.allowedFragments).find(f => f.name === ctor);
301
374
  if (possibleFragment) found = true;
302
375
 
303
- // 1.3 Check if it's a command code or name
304
- const possibleCommand = Array.from(this.allowedCommands).find(c => c.name === ctor);
305
- if (possibleCommand) found = true;
306
-
307
376
  // 1.4 Check if it's an entity name or entity static entity property
308
377
  const possibleEntity = Array.from(this.allowedEntities).find(e => e.name === ctor);
309
378
  if (possibleEntity) found = true;
@@ -315,27 +384,21 @@ export class A_Scope<
315
384
  return false;
316
385
  }
317
386
  // 2) Check if it's a Component
318
- case this.isComponentConstructor(ctor): {
387
+ case A_TypeGuards.isComponentConstructor(ctor): {
319
388
  found = this.isAllowedComponent(ctor);
320
389
 
321
390
  break;
322
391
  }
323
392
  // 3) Check if it's an Entity
324
- case this.isEntityConstructor(ctor): {
393
+ case A_TypeGuards.isEntityConstructor(ctor): {
325
394
  found = this.isAllowedEntity(ctor);
326
395
 
327
396
  break;
328
397
  }
329
398
  // 4) Check if it's a Fragment
330
- case this.isFragmentConstructor(ctor): {
399
+ case A_TypeGuards.isFragmentConstructor(ctor): {
331
400
  found = this.isAllowedFragment(ctor);
332
401
 
333
- break;
334
- }
335
- // 5) Check if it's a Command
336
- case this.isCommandConstructor(ctor): {
337
- found = this.isAllowedCommand(ctor);
338
-
339
402
  break;
340
403
  }
341
404
  }
@@ -364,10 +427,11 @@ export class A_Scope<
364
427
  name: `${this.name} + ${anotherScope.name}`,
365
428
 
366
429
  components: [...this.allowedComponents, ...anotherScope.allowedComponents],
367
- commands: [...this.allowedCommands, ...anotherScope.allowedCommands],
368
-
369
430
  fragments: [...this.fragments, ...anotherScope.fragments],
370
- entities: [...this.entities, ...anotherScope.entities],
431
+ entities: [
432
+ ...this.entities, ...anotherScope.entities,
433
+ ...this.allowedEntities, ...anotherScope.allowedEntities
434
+ ],
371
435
  },
372
436
  {
373
437
  parent: this._parent || anotherScope._parent
@@ -383,65 +447,51 @@ export class A_Scope<
383
447
  *
384
448
  * [!] Notes:
385
449
  * - 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
386
- * - In case of search for A_Command please ensure that provided string corresponds to the static code property of the class. [!] By default it's the kebab-case of the class name
387
450
  * - In case of search for A_Component please ensure that provided string corresponds to the class name in PascalCase
388
451
  *
389
452
  * @param name
390
453
  * @returns
391
454
  */
392
- resolveConstructor<T extends A_Command>(
393
- /**
394
- * Provide the command name or code to retrieve its constructor
395
- */
396
- name: string
397
- ): A_TYPES__AllowedCommandsConstructor<T>
398
455
  resolveConstructor<T extends A_Entity>(
399
456
  /**
400
457
  * Provide the entity name or static entity property to retrieve its constructor
401
458
  */
402
459
  name: string
403
- ): A_TYPES__AllowedEntitiesConstructor<T>
460
+ ): A_TYPES__Entity_Constructor<T>
404
461
  resolveConstructor<T extends A_Component>(
405
462
  /**
406
463
  * Provide the component name in PascalCase to retrieve its constructor
407
464
  */
408
465
  name: string
409
- ): A_TYPES__AllowedComponentsConstructor<T>
466
+ ): A_TYPES__Component_Constructor<T>
410
467
  resolveConstructor<T extends A_Fragment>(
411
468
  /**
412
469
  * Provide the fragment name in PascalCase to retrieve its constructor
413
470
  */
414
471
  name: string
415
- ): A_TYPES__AllowedFragmentsConstructor<T>
416
- resolveConstructor<T extends A_Command | A_Entity | A_Component | A_Fragment>(name: string): A_TYPES__AllowedCommandsConstructor<T> | A_TYPES__AllowedEntitiesConstructor<T> | A_TYPES__AllowedComponentsConstructor<T> | A_TYPES__AllowedFragmentsConstructor<T> {
472
+ ): A_TYPES__Fragment_Constructor<T>
473
+ resolveConstructor<T extends A_TYPES__ScopeResolvableComponents>(name: string): A_TYPES__Entity_Constructor<T> | A_TYPES__Component_Constructor<T> | A_TYPES__Fragment_Constructor<T> {
417
474
  // 1) Check components
418
475
  const component = Array.from(this.allowedComponents).find(
419
476
  c => c.name === name
420
- || c.name === A_CommonHelper.toPascalCase(name)
477
+ || c.name === A_FormatterHelper.toPascalCase(name)
421
478
  );
422
- if (component) return component as A_TYPES__AllowedComponentsConstructor<T>;
479
+ if (component) return component as A_TYPES__Component_Constructor<T>;
423
480
 
424
481
  // 2) Check entities
425
482
  const entity = Array.from(this.allowedEntities).find(
426
483
  e => e.name === name
427
- || e.name === A_CommonHelper.toPascalCase(name)
484
+ || e.name === A_FormatterHelper.toPascalCase(name)
428
485
  || (e as any).entity === name
429
- || (e as any).entity === A_CommonHelper.toKebabCase(name)
430
- );
431
- if (entity) return entity as A_TYPES__AllowedEntitiesConstructor<T>;
432
-
433
- // 3) Check commands
434
- const command = Array.from(this.allowedCommands).find(c => (c as any).code === name
435
- || (c as any).name === A_CommonHelper.toPascalCase(name)
436
- || (c as any).code === A_CommonHelper.toKebabCase(name)
486
+ || (e as any).entity === A_FormatterHelper.toKebabCase(name)
437
487
  );
438
- if (command) return command as A_TYPES__AllowedCommandsConstructor<T>;
488
+ if (entity) return entity as A_TYPES__Entity_Constructor<T>;
439
489
 
440
- // 4) Check fragments
490
+ // 3) Check fragments
441
491
  const fragment = Array.from(this.allowedFragments).find(f => f.name === name
442
- || f.name === A_CommonHelper.toPascalCase(name)
492
+ || f.name === A_FormatterHelper.toPascalCase(name)
443
493
  );
444
- if (fragment) return fragment as A_TYPES__AllowedFragmentsConstructor<T>;
494
+ if (fragment) return fragment as A_TYPES__Fragment_Constructor<T>;
445
495
 
446
496
  // If not found in current scope, check parent scope
447
497
  if (!!this._parent) {
@@ -467,9 +517,9 @@ export class A_Scope<
467
517
  /**
468
518
  * Provide a component constructor to resolve its instance from the scope
469
519
  */
470
- component: A_TYPES__AllowedComponentsConstructor<T>
520
+ component: A_TYPES__Component_Constructor<T>
471
521
  ): T
472
- resolve<T extends A_TYPES__AllowedComponentsConstructor[]>(
522
+ resolve<T extends A_TYPES__Component_Constructor[]>(
473
523
  /**
474
524
  * Provide an array of component constructors to resolve their instances from the scope
475
525
  */
@@ -479,31 +529,19 @@ export class A_Scope<
479
529
  /**
480
530
  * Provide a fragment constructor to resolve its instance from the scope
481
531
  */
482
- fragment: A_TYPES__AllowedFragmentsConstructor<T>
532
+ fragment: A_TYPES__Fragment_Constructor<T>
483
533
  ): T
484
- resolve<T extends A_TYPES__AllowedFragmentsConstructor[]>(
534
+ resolve<T extends A_TYPES__Fragment_Constructor[]>(
485
535
  /**
486
536
  * Provide an array of fragment constructors to resolve their instances from the scope
487
537
  */
488
538
  fragments: [...T]
489
539
  ): Array<InstanceType<T[number]>>
490
- resolve<T extends A_Command>(
491
- /**
492
- * Provide a command constructor to resolve its instance from the scope
493
- */
494
- command: A_TYPES__AllowedCommandsConstructor<T>
495
- ): T
496
- resolve<T extends A_TYPES__AllowedCommandsConstructor[]>(
497
- /**
498
- * Provide an array of command constructors to resolve their instances from the scope
499
- */
500
- commands: [...T]
501
- ): Array<InstanceType<T[number]>>
502
540
  resolve<T extends A_Entity>(
503
541
  /**
504
542
  * Provide an entity constructor to resolve its instance or an array of instances from the scope
505
543
  */
506
- entity: A_TYPES__AllowedEntitiesConstructor<T>
544
+ entity: A_TYPES__Entity_Constructor<T>
507
545
  ): T | undefined
508
546
  resolve<T extends A_Scope>(
509
547
  /**
@@ -517,31 +555,45 @@ export class A_Scope<
517
555
  /**
518
556
  * Provide an entity constructor to resolve its instance or an array of instances from the scope
519
557
  */
520
- entity: A_TYPES__AllowedEntitiesConstructor<T>,
558
+ entity: A_TYPES__Entity_Constructor<T>,
521
559
  /**
522
560
  * Provide optional instructions to find a specific entity or a set of entities
523
561
  */
524
562
  instructions: Partial<A_TYPES__A_InjectDecorator_EntityInjectionInstructions<T>>
525
563
  ): Array<T>
564
+ resolve(
565
+ constructorName: string
566
+ ): A_TYPES__ScopeResolvableComponents
526
567
  // base definition
527
- resolve<T extends A_Component | A_Fragment | A_Entity | A_Command>(
568
+ resolve<T extends A_TYPES__ScopeResolvableComponents>(
528
569
  /**
529
570
  * Provide a component, fragment or entity constructor or an array of constructors to resolve its instance(s) from the scope
530
571
  */
531
- param1: unknown,
572
+ param1: A_TYPES__InjectableConstructors,
573
+
574
+ ): T | Array<T>
575
+ resolve<T extends A_TYPES__ScopeResolvableComponents>(
576
+ /**
577
+ * Provide a component, fragment or entity constructor or an array of constructors to resolve its instance(s) from the scope
578
+ */
579
+ param1: A_TYPES__InjectableConstructors | Array<A_TYPES__InjectableConstructors>,
532
580
  param2?: Partial<A_TYPES__A_InjectDecorator_EntityInjectionInstructions>
533
581
  ): T | Array<T> {
534
582
  switch (true) {
535
- case Array.isArray(param1): {
536
- return param1.map(c => this.resolveOnce(c, param2)).filter(Boolean) as Array<T>;
583
+ case A_TypeGuards.isArray(param1): {
584
+ return param1.map(c => {
585
+ if (A_TypeGuards.isString(c))
586
+ return this.resolveByName(c);
587
+ else
588
+ return this.resolveOnce(c, param2);
589
+ }).filter(Boolean) as Array<T>;
537
590
  }
538
591
 
539
- case typeof param1 === 'function': {
592
+ case A_TypeGuards.isFunction(param1): {
540
593
  return this.resolveOnce(param1, param2);
541
594
  }
542
595
 
543
-
544
- case typeof param1 === 'string': {
596
+ case A_TypeGuards.isString(param1): {
545
597
  return this.resolveByName(param1) as T;
546
598
  }
547
599
 
@@ -559,33 +611,39 @@ export class A_Scope<
559
611
  // -------------------------------------INTERNAL RESOLVERS-------------------------------------------
560
612
  // --------------------------------------------------------------------------------------------------
561
613
  // ==================================================================================================
562
- private resolveByName(name: string): _EntityType[number] | InstanceType<_ComponentType[number]> | _FragmentType[number] | InstanceType<_CommandType[number]> {
614
+ /**
615
+ * This method is used internally to resolve a component, fragment or entity by its constructor name
616
+ *
617
+ * [!] Note that this method checks for the component, fragment or entity in the current scope and all parent scopes
618
+ *
619
+ * @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)
620
+ * @returns
621
+ */
622
+ private resolveByName(
623
+ /**
624
+ * Provide the name of the component, fragment or entity to resolve
625
+ */
626
+ name: string
627
+ ): _EntityType[number] | InstanceType<_ComponentType[number]> | _FragmentType[number] {
563
628
  // 1) Check components
564
629
  const component = Array.from(this.allowedComponents).find(
565
630
  c => c.name === name
566
- || c.name === A_CommonHelper.toPascalCase(name)
631
+ || c.name === A_FormatterHelper.toPascalCase(name)
567
632
  );
568
633
  if (component) return this.resolveOnce(component) as InstanceType<_ComponentType[number]>;
569
634
 
570
635
  // 2) Check entities
571
636
  const entity = Array.from(this.allowedEntities).find(
572
637
  e => e.name === name
573
- || e.name === A_CommonHelper.toPascalCase(name)
638
+ || e.name === A_FormatterHelper.toPascalCase(name)
574
639
  || (e as any).entity === name
575
- || (e as any).entity === A_CommonHelper.toKebabCase(name)
576
- );
577
- if (entity) return this.resolveOnce(entity) as _EntityType[number];
578
-
579
- // 3) Check commands
580
- const command = Array.from(this.allowedCommands).find(c => (c as any).code === name
581
- || (c as any).name === A_CommonHelper.toPascalCase(name)
582
- || (c as any).code === A_CommonHelper.toKebabCase(name)
640
+ || (e as any).entity === A_FormatterHelper.toKebabCase(name)
583
641
  );
584
- if (command) return this.resolveOnce(command) as InstanceType<_CommandType[number]>;
642
+ if (entity) return this.resolveOnce(entity) as InstanceType<_EntityType[number]>;
585
643
 
586
- // 4) Check fragments
644
+ // 3) Check fragments
587
645
  const fragment = Array.from(this.allowedFragments).find(f => f.name === name
588
- || f.name === A_CommonHelper.toPascalCase(name)
646
+ || f.name === A_FormatterHelper.toPascalCase(name)
589
647
  );
590
648
  if (fragment) return this.resolveOnce(fragment) as _FragmentType[number];
591
649
 
@@ -604,31 +662,28 @@ export class A_Scope<
604
662
  * @param instructions
605
663
  * @returns
606
664
  */
607
- private resolveOnce<T extends A_Component | A_Fragment | A_Entity | A_Command | A_Scope>(
665
+ private resolveOnce<T extends A_Component | A_Fragment | A_Entity | A_Scope>(
608
666
  component: unknown,
609
667
  instructions?: Partial<A_TYPES__A_InjectDecorator_EntityInjectionInstructions>
610
668
  ): T | Array<T> {
611
669
 
612
- if (this.isScopeConstructor(component))
670
+ if (A_TypeGuards.isScopeConstructor(component))
613
671
  component
614
672
 
615
673
  if (typeof component == 'function' && (component as any).name === 'A_Scope')
616
674
  component
617
675
 
618
676
  switch (true) {
619
- case this.isEntityConstructor(component): {
677
+ case A_TypeGuards.isEntityConstructor(component): {
620
678
  return this.resolveEntity(component, instructions) as T | Array<T>;
621
679
  }
622
- case this.isFragmentConstructor(component): {
680
+ case A_TypeGuards.isFragmentConstructor(component): {
623
681
  return this.resolveFragment(component) as T;
624
682
  }
625
- case this.isCommandConstructor(component): {
626
- return this.resolveCommand(component) as T;
627
- }
628
- case this.isScopeConstructor(component): {
683
+ case A_TypeGuards.isScopeConstructor(component): {
629
684
  return this.resolveScope(component) as T;
630
685
  }
631
- case this.isComponentConstructor(component): {
686
+ case A_TypeGuards.isComponentConstructor(component): {
632
687
  return this.resolveComponent(component) as T;
633
688
  }
634
689
  default:
@@ -646,7 +701,7 @@ export class A_Scope<
646
701
  * @returns
647
702
  */
648
703
  private resolveEntity<T extends A_Entity>(
649
- entity: A_TYPES__AllowedEntitiesConstructor<T>,
704
+ entity: A_TYPES__Entity_Constructor<T>,
650
705
  instructions?: Partial<A_TYPES__A_InjectDecorator_EntityInjectionInstructions<T>>
651
706
  ): T | Array<T> | undefined {
652
707
 
@@ -746,7 +801,7 @@ export class A_Scope<
746
801
  * @param fragment
747
802
  * @returns
748
803
  */
749
- private resolveFragment<T extends A_Fragment>(fragment: A_TYPES__AllowedFragmentsConstructor<T>): _FragmentType[number] {
804
+ private resolveFragment<T extends A_Fragment>(fragment: A_TYPES__Fragment_Constructor<T>): _FragmentType[number] {
750
805
  const fragmentInstancePresented = this._fragments.get(fragment);
751
806
 
752
807
  switch (true) {
@@ -766,7 +821,7 @@ export class A_Scope<
766
821
  * @param scope
767
822
  * @returns
768
823
  */
769
- private resolveScope(scope: A_TYPES__AllowedScopesConstructor): A_Scope {
824
+ private resolveScope(scope: A_TYPES__Scope_Constructor): A_Scope {
770
825
  return this;
771
826
  }
772
827
  /**
@@ -775,7 +830,7 @@ export class A_Scope<
775
830
  * @param component
776
831
  * @returns
777
832
  */
778
- private resolveComponent<T extends A_Component>(component: A_TYPES__AllowedComponentsConstructor<T>): InstanceType<_ComponentType[number]> {
833
+ private resolveComponent<T extends A_Component>(component: A_TYPES__Component_Constructor<T>): InstanceType<_ComponentType[number]> {
779
834
 
780
835
  // The idea here that in case when Scope has no exact component we have to resolve it from the _parent
781
836
  // BUT: if it's not presented in _parent we have to check for inheritance
@@ -828,27 +883,6 @@ export class A_Scope<
828
883
  throw new Error(`Component ${component.name} not found in the scope ${this.name}`);
829
884
  }
830
885
  }
831
- /**
832
- * Should be similar to resolveEntity but for commands
833
- *
834
- * @param command
835
- */
836
- private resolveCommand(command: _CommandType[number]): InstanceType<_CommandType[number]> {
837
-
838
- const found = this.commands.find(e => e instanceof command);
839
-
840
- switch (true) {
841
- case !!found:
842
- return found
843
-
844
- case !found && !!this._parent:
845
- return this._parent.resolveCommand(command) as InstanceType<_CommandType[number]>;
846
-
847
- default:
848
- throw new Error(`Command ${command.name} not found in the scope ${this.name}`);
849
- }
850
- }
851
-
852
886
 
853
887
 
854
888
  /**
@@ -860,50 +894,51 @@ export class A_Scope<
860
894
  /**
861
895
  * Provide a component constructor to register it in the scope
862
896
  */
863
- component: A_TYPES__AllowedComponentsConstructor<T>
897
+ component: A_TYPES__Component_Constructor<T>
864
898
  ): void
865
- register<T extends A_Entity>(
899
+ register(
866
900
  /**
867
- * Provide an entity constructor to register it in the scope
901
+ * Provide a command instance to register it in the scope
868
902
  */
869
- entity: A_TYPES__AllowedEntitiesConstructor<T>
903
+ component: A_Component
870
904
  ): void
871
- register<T extends A_Command>(
905
+ register<T extends A_Error>(
872
906
  /**
873
- * Provide a command constructor to register it in the scope
907
+ * Provide an error constructor to register it in the scope
874
908
  */
875
- command: A_TYPES__AllowedCommandsConstructor<T>
909
+ error: A_TYPES__Error_Constructor<T>
876
910
  ): void
877
- register<T extends A_Fragment>(
911
+ register(
878
912
  /**
879
- * Provide a command instance to register it in the scope
913
+ * Provide an error instance to register it in the scope
880
914
  */
881
- fragment: A_TYPES__AllowedFragmentsConstructor<T>
915
+ error: A_Error
882
916
  ): void
883
- register(
917
+ register<T extends A_Fragment>(
884
918
  /**
885
- * Provide an entity instance to register it in the scope
919
+ * Provide a command instance to register it in the scope
886
920
  */
887
- entity: A_Entity
921
+ fragment: A_TYPES__Fragment_Constructor<T>
888
922
  ): void
889
923
  register(
890
924
  /**
891
- * Provide a command instance to register it in the scope
925
+ * Provide a fragment instance to register it in the scope
892
926
  */
893
- component: A_Component
927
+ fragment: A_Fragment
894
928
  ): void
895
- register(
929
+ register<T extends A_Entity>(
896
930
  /**
897
- * Provide a command instance to register it in the scope
931
+ * Provide an entity constructor to register it in the scope
898
932
  */
899
- command: A_Command
933
+ entity: A_TYPES__Entity_Constructor<T>
900
934
  ): void
901
935
  register(
902
936
  /**
903
- * Provide a fragment instance to register it in the scope
937
+ * Provide an entity instance to register it in the scope
904
938
  */
905
- fragment: A_Fragment
939
+ entity: A_Entity
906
940
  ): void
941
+
907
942
  register(
908
943
  param1: unknown
909
944
  ): void {
@@ -926,35 +961,24 @@ export class A_Scope<
926
961
 
927
962
  break;
928
963
  }
929
- // 2) In case when it's a A-Command instance
930
- case param1 instanceof A_Command: {
931
-
932
- if (!this.allowedCommands.has(param1.constructor as _CommandType[number]))
933
- this.allowedCommands.add(param1.constructor as _CommandType[number]);
934
-
935
- this._commands.set((param1 as any).constructor.code, param1 as InstanceType<_CommandType[number]>);
936
-
937
- A_Context.register(this, param1);
938
- break;
939
- }
940
964
  // 3) In case when it's a A-Entity instance
941
965
  case param1 instanceof A_Entity && !this._entities.has(param1.aseid.toString()): {
942
966
 
943
- if (!this.allowedEntities.has(param1.constructor as A_TYPES__AllowedEntitiesConstructor<_EntityType[number]>))
944
- this.allowedEntities.add(param1.constructor as A_TYPES__AllowedEntitiesConstructor<_EntityType[number]>);
967
+ if (!this.allowedEntities.has(param1.constructor as _EntityType[number]))
968
+ this.allowedEntities.add(param1.constructor as _EntityType[number]);
945
969
 
946
- this._entities.set(param1.aseid.toString(), param1);
970
+ this._entities.set(param1.aseid.toString(), param1 as InstanceType<_EntityType[number]>);
947
971
  A_Context.register(this, param1);
948
972
  break;
949
973
  }
950
974
  // 4) In case when it's a A-Fragment instance
951
975
  case param1 instanceof A_Fragment: {
952
976
 
953
- if (!this.allowedFragments.has(param1.constructor as A_TYPES__AllowedFragmentsConstructor<_FragmentType[number]>))
954
- this.allowedFragments.add(param1.constructor as A_TYPES__AllowedFragmentsConstructor<_FragmentType[number]>);
977
+ if (!this.allowedFragments.has(param1.constructor as A_TYPES__Fragment_Constructor<_FragmentType[number]>))
978
+ this.allowedFragments.add(param1.constructor as A_TYPES__Fragment_Constructor<_FragmentType[number]>);
955
979
 
956
980
  this._fragments.set(
957
- param1.constructor as A_TYPES__AllowedFragmentsConstructor<_FragmentType[number]>,
981
+ param1.constructor as A_TYPES__Fragment_Constructor<_FragmentType[number]>,
958
982
  param1 as _FragmentType[number]
959
983
  );
960
984
 
@@ -962,34 +986,47 @@ export class A_Scope<
962
986
 
963
987
  break;
964
988
  }
989
+ // 5) In case when it's a A-Error instance
990
+ case param1 instanceof A_Error: {
991
+ if (!this.allowedErrors.has(param1.constructor as _ErrorType[number]))
992
+ this.allowedErrors.add(param1.constructor as _ErrorType[number]);
993
+
994
+ // A_Context.register(this, param1);
995
+ break;
996
+ }
997
+
965
998
  // ------------------------------------------
966
999
  // ------------ Constructors ----------------
967
1000
  // ------------------------------------------
968
- // 5) In case when it's a A-Component constructor
969
- case this.isComponentConstructor(param1): {
1001
+ // 6) In case when it's a A-Component constructor
1002
+ case A_TypeGuards.isComponentConstructor(param1): {
970
1003
  if (!this.allowedComponents.has(param1))
971
1004
  this.allowedComponents.add(param1 as _ComponentType[number]);
972
1005
  break;
973
1006
  }
974
- // 6) In case when it's a A-Command constructor
975
- case this.isCommandConstructor(param1): {
976
- if (!this.allowedCommands.has(param1))
977
- this.allowedCommands.add(param1 as _CommandType[number]);
978
- break;
979
- }
980
- // 7) In case when it's a A-Fragment constructor
981
- case this.isFragmentConstructor(param1): {
1007
+ // 8) In case when it's a A-Fragment constructor
1008
+ case A_TypeGuards.isFragmentConstructor(param1): {
982
1009
  if (!this.allowedFragments.has(param1))
983
- this.allowedFragments.add(param1 as A_TYPES__AllowedFragmentsConstructor<_FragmentType[number]>);
1010
+ this.allowedFragments.add(param1 as A_TYPES__Fragment_Constructor<_FragmentType[number]>);
984
1011
  break;
985
1012
  }
986
- // 8) In case when it's a A-Entity constructor
987
- case this.isEntityConstructor(param1): {
1013
+ // 9) In case when it's a A-Entity constructor
1014
+ case A_TypeGuards.isEntityConstructor(param1): {
988
1015
  if (!this.allowedEntities.has(param1))
989
- this.allowedEntities.add(param1 as A_TYPES__AllowedEntitiesConstructor<_EntityType[number]>);
1016
+ this.allowedEntities.add(param1 as _EntityType[number]);
1017
+ break;
1018
+ }
1019
+ // 10) In case when it's a A-Error constructor
1020
+ case A_TypeGuards.isErrorConstructor(param1): {
1021
+ if (!this.allowedErrors.has(param1))
1022
+ this.allowedErrors.add(param1 as _ErrorType[number]);
990
1023
  break;
991
1024
  }
992
1025
 
1026
+ // ------------------------------------------
1027
+ // ------------ Invalid Cases ----------------
1028
+ // ------------------------------------------
1029
+
993
1030
  default:
994
1031
  if (param1 instanceof A_Entity)
995
1032
  throw new Error(`Entity with ASEID ${param1.aseid.toString()} is already registered in the scope ${this.name}`);
@@ -1029,54 +1066,6 @@ export class A_Scope<
1029
1066
  //==========================================================================
1030
1067
  // --------------------Scope Type Check Helpers---------------------------
1031
1068
  //==========================================================================
1032
- /**
1033
- * Type guard to check if the constructor is of type A_Component
1034
- *
1035
- * @param ctor
1036
- * @returns
1037
- */
1038
- protected isComponentConstructor(ctor: unknown): ctor is A_TYPES__AllowedComponentsConstructor {
1039
- return typeof ctor === 'function' && A_CommonHelper.isInheritedFrom(ctor, A_Component);
1040
- }
1041
- /**
1042
- * Type guard to check if the constructor is of type A_Command
1043
- *
1044
- * @param ctor
1045
- * @returns
1046
- */
1047
- protected isCommandConstructor(ctor: unknown): ctor is A_TYPES__AllowedCommandsConstructor {
1048
- return typeof ctor === 'function' && A_CommonHelper.isInheritedFrom(ctor, A_Command);
1049
- }
1050
- /**
1051
- * Type guard to check if the constructor is of type A_Fragment
1052
- *
1053
- * @param ctor
1054
- * @returns
1055
- */
1056
- protected isFragmentConstructor(ctor: any): ctor is A_TYPES__AllowedFragmentsConstructor {
1057
- return typeof ctor === 'function' && A_CommonHelper.isInheritedFrom(ctor, A_Fragment);
1058
- }
1059
- /**
1060
- * Type guard to check if the constructor is of type A_Entity
1061
- *
1062
- * @param ctor
1063
- * @returns
1064
- */
1065
- protected isEntityConstructor(ctor: unknown): ctor is A_TYPES__AllowedEntitiesConstructor {
1066
- return typeof ctor === 'function' && A_CommonHelper.isInheritedFrom(ctor, A_Entity);
1067
- }
1068
- /**
1069
- * Type guard to check if the constructor is of type A_Scope
1070
- *
1071
- * @param ctor
1072
- * @returns
1073
- */
1074
- protected isScopeConstructor(ctor: unknown): ctor is A_TYPES__AllowedScopesConstructor {
1075
- return typeof ctor === 'function' && A_CommonHelper.isInheritedFrom(ctor, A_Scope);
1076
- }
1077
- // -------------------------------------------------------------------------------
1078
- // --------------------Scope Allowed Type Check Helpers---------------------------
1079
- // -------------------------------------------------------------------------------
1080
1069
  /**
1081
1070
  * Type guard to check if the constructor is of type A_Component and is allowed in the scope
1082
1071
  *
@@ -1084,34 +1073,34 @@ export class A_Scope<
1084
1073
  * @returns
1085
1074
  */
1086
1075
  protected isAllowedComponent(ctor: unknown): ctor is _ComponentType[number] {
1087
- return this.isComponentConstructor(ctor) && this.allowedComponents.has(ctor);
1076
+ return A_TypeGuards.isComponentConstructor(ctor) && this.allowedComponents.has(ctor);
1088
1077
  }
1089
1078
  /**
1090
- * Type guard to check if the constructor is of type A_Command and is allowed in the scope
1079
+ * Type guard to check if the constructor is of type A_Entity and is allowed in the scope
1091
1080
  *
1092
1081
  * @param ctor
1093
1082
  * @returns
1094
1083
  */
1095
- protected isAllowedCommand(ctor: unknown): ctor is _CommandType[number] {
1096
- return this.isCommandConstructor(ctor) && this.allowedCommands.has(ctor);
1084
+ protected isAllowedEntity(ctor: unknown): ctor is A_TYPES__Entity_Constructor<_EntityType[number]> {
1085
+ return A_TypeGuards.isEntityConstructor(ctor) && this.allowedEntities.has(ctor);
1097
1086
  }
1098
1087
  /**
1099
- * Type guard to check if the constructor is of type A_Entity and is allowed in the scope
1088
+ * Type guard to check if the constructor is of type A_Fragment and is allowed in the scope
1100
1089
  *
1101
1090
  * @param ctor
1102
1091
  * @returns
1103
1092
  */
1104
- protected isAllowedEntity(ctor: unknown): ctor is A_TYPES__AllowedEntitiesConstructor<_EntityType[number]> {
1105
- return this.isEntityConstructor(ctor) && this.allowedEntities.has(ctor);
1093
+ protected isAllowedFragment(ctor: unknown): ctor is A_TYPES__Fragment_Constructor<_FragmentType[number]> {
1094
+ return A_TypeGuards.isFragmentConstructor(ctor) && this.allowedFragments.has(ctor);
1106
1095
  }
1107
1096
  /**
1108
- * Type guard to check if the constructor is of type A_Fragment and is allowed in the scope
1097
+ * Type guard to check if the constructor is of type A_Error and is allowed in the scope
1109
1098
  *
1110
1099
  * @param ctor
1111
1100
  * @returns
1112
1101
  */
1113
- protected isAllowedFragment(ctor: unknown): ctor is A_TYPES__AllowedFragmentsConstructor<_FragmentType[number]> {
1114
- return this.isFragmentConstructor(ctor) && this.allowedFragments.has(ctor);
1102
+ protected isAllowedError(ctor: unknown): ctor is A_TYPES__Error_Constructor<_ErrorType[number]> {
1103
+ return A_TypeGuards.isErrorConstructor(ctor) && this.allowedErrors.has(ctor);
1115
1104
  }
1116
1105
 
1117
1106