@adaas/a-concept 0.0.63 → 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 (412) 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 +406 -63
  129. package/dist/src/global/A-Scope/A-Scope.class.js +533 -287
  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 +50 -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 +841 -443
  220. package/src/global/A-Scope/A-Scope.error.ts +13 -0
  221. package/src/global/A-Scope/A-Scope.types.ts +65 -26
  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/helpers/StepsManager.class.js.map +0 -1
  341. package/dist/src/types/A_Module.types.d.ts +0 -17
  342. package/dist/src/types/A_Module.types.js +0 -22
  343. package/dist/src/types/A_Module.types.js.map +0 -1
  344. package/examples/entity/concept.ts +0 -68
  345. package/examples/entity/entities/Task.entity.ts +0 -110
  346. package/examples/entity/entities/User.entity.ts +0 -62
  347. package/examples/fe-be/channels/Test.channel.ts +0 -27
  348. package/examples/fe-be/components/BE-Controller.component.ts +0 -20
  349. package/examples/fe-be/components/FE.component.ts +0 -13
  350. package/examples/fe-be/containers/ServerApp.container.ts +0 -8
  351. package/examples/fe-be/containers/WebApp.container.ts +0 -13
  352. package/examples/multi-container/channels/Direct.channel.ts +0 -39
  353. package/examples/multi-container/concept.ts +0 -0
  354. package/examples/multi-container/containers/Command.container.ts +0 -41
  355. package/examples/multi-container/containers/Schedule.container.ts +0 -52
  356. package/examples/simple/components/A.component.ts +0 -71
  357. package/examples/simple/components/B.component.ts +0 -68
  358. package/examples/simple/concept.ts +0 -87
  359. package/examples/simple/containers/Main.container.ts +0 -88
  360. package/examples/simple/containers/Secondary.container.ts +0 -26
  361. package/examples/simple/context/Fragment_A.context.ts +0 -25
  362. package/examples/simple/context/Fragment_B.context.ts +0 -19
  363. package/examples/simple/entities/EntityA.entity.ts +0 -32
  364. package/examples/simple-http-server/components/http-error-handler.component.ts +0 -47
  365. package/examples/simple-http-server/components/http-request-handler.component.ts +0 -13
  366. package/examples/simple-http-server/concept.ts +0 -35
  367. package/examples/simple-http-server/containers/http-server.container.ts +0 -57
  368. package/examples/simple-http-server/contexts/http-request.context.ts +0 -59
  369. package/examples/simple-http-server/contexts/http-server.context.types.ts +0 -0
  370. package/examples/simple-http-server/controllers/orders.controller.ts +0 -20
  371. package/examples/simple-http-server/controllers/users.controller.ts +0 -104
  372. package/examples/simple-http-server/test.ts +0 -290
  373. package/src/base/A-Config/A-Config.container.ts +0 -68
  374. package/src/base/A-Config/A-Config.context.ts +0 -114
  375. package/src/base/A-Config/A-Config.types.ts +0 -28
  376. package/src/base/A-Config/components/ConfigReader.component.ts +0 -68
  377. package/src/base/A-Config/components/ENVConfigReader.component.ts +0 -31
  378. package/src/base/A-Config/components/FileConfigReader.component.ts +0 -41
  379. package/src/base/A-Errors/A-Error.entity.ts +0 -10
  380. package/src/base/A-Errors/A-Errors.component.ts +0 -103
  381. package/src/base/A-Errors/A-Errors.context.ts +0 -90
  382. package/src/base/A-Errors/A-Errors.types.ts +0 -6
  383. package/src/base/A-Logger/A-Logger.component.ts +0 -192
  384. package/src/base/A-Logger/A-Logger.types.ts +0 -0
  385. package/src/base/A-Polyfill/A-Polyfill.component.ts +0 -18
  386. package/src/decorators/A-Abstraction/A-Abstraction-Extend.decorator.ts +0 -81
  387. package/src/decorators/A-Abstraction/A-Abstraction.decorator.types.ts +0 -21
  388. package/src/decorators/A-Connect/A-Connect.decorator.ts +0 -71
  389. package/src/decorators/A-Connect/A-Connect.decorator.types.ts +0 -6
  390. package/src/decorators/A-Entity/A-Entity-List.decorator.ts +0 -12
  391. package/src/decorators/A-Entity/A-Entity.decorator.types.ts +0 -18
  392. package/src/decorators/A-Feature/A-Feature-Extend.decorator.ts +0 -151
  393. package/src/decorators/A-Feature/A-Feature.decorator.types.ts +0 -142
  394. package/src/decorators/A-Inject/A-Inject.decorator.ts +0 -119
  395. package/src/decorators/A-Inject/A-Inject.decorator.types.ts +0 -85
  396. package/src/global/A-Channel/A-Channel.class.ts +0 -111
  397. package/src/global/A-Channel/A-Channel.types.ts +0 -114
  398. package/src/global/A-Command/A-Command.class.ts +0 -419
  399. package/src/global/A-Command/A-Command.constants.ts +0 -27
  400. package/src/global/A-Command/A-Command.meta.ts +0 -22
  401. package/src/global/A-Command/A-Command.types.ts +0 -73
  402. package/src/global/A-Command/context/A_Command.context.ts +0 -114
  403. package/src/global/A-Concept/A_Concept.class.ts +0 -298
  404. package/src/global/A-Concept/A_Concept.meta.ts +0 -32
  405. package/src/global/A-Concept/A_Concept.types.ts +0 -143
  406. package/src/global/A-Feature/A-FeatureCaller.class.ts +0 -38
  407. package/src/types/A_Module.types.ts +0 -23
  408. package/tests/A-Command.test.ts +0 -133
  409. package/tests/A-Config.test.ts +0 -172
  410. /package/dist/src/global/A-Concept/{A_Concept.meta.d.ts → A-Concept.meta.d.ts} +0 -0
  411. /package/dist/src/{base/A-Logger/A-Logger.types.d.ts → global/ASEID/ASEID.constants.d.ts} +0 -0
  412. /package/{examples/fe-be/concept.ts → src/global/ASEID/ASEID.constants.ts} +0 -0
@@ -1,177 +1,256 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.A_Scope = void 0;
4
- const a_utils_1 = require("@adaas/a-utils");
5
4
  const A_Fragment_class_1 = require("../A-Fragment/A-Fragment.class");
6
5
  const A_Context_class_1 = require("../A-Context/A-Context.class");
7
- const A_Component_types_1 = require("../A-Component/A-Component.types");
8
6
  const A_Component_class_1 = require("../A-Component/A-Component.class");
9
7
  const A_Entity_class_1 = require("../A-Entity/A-Entity.class");
10
- const A_Command_class_1 = require("../A-Command/A-Command.class");
11
- /**
12
- *
13
- *
14
- * A_Scope refers to the visibility and accessibility of :
15
- * - variables,
16
- * - Components,
17
- * - Context Fragments
18
- * - and objects in different parts of your code.
19
- * Scope determines where a particular piece of data (like a variable or function)
20
- * can be accessed, modified, or referenced, and it plays a crucial role in avoiding naming collisions and ensuring data integrity.
21
- *
22
- *
23
- */
8
+ const A_TypeGuards_helper_1 = require("../../helpers/A_TypeGuards.helper");
9
+ const A_Error_class_1 = require("../A-Error/A_Error.class");
10
+ const A_Formatter_helper_1 = require("../../helpers/A_Formatter.helper");
11
+ const ASEID_class_1 = require("../ASEID/ASEID.class");
12
+ const A_Common_helper_1 = require("../../helpers/A_Common.helper");
13
+ const A_Scope_error_1 = require("./A-Scope.error");
14
+ const A_Component_constants_1 = require("../A-Component/A-Component.constants");
24
15
  class A_Scope {
25
- constructor(params, config = {}) {
26
- this.name = '';
27
- this._components = new WeakMap();
28
- this._fragments = new WeakMap();
29
- this._commands = new Map();
30
- this._entities = new Map();
31
- this.name = params.name || this.constructor.name;
32
- // TODO: move to defaults
33
- const defaultParams = {
34
- name: '',
35
- components: [],
36
- fragments: [],
37
- entities: [],
38
- commands: [],
39
- };
40
- this.params = Object.assign(Object.assign({}, defaultParams), params);
41
- this.initComponents(params.components || []);
42
- this.initFragments(params.fragments || []);
43
- this.initEntities(params.entities || []);
44
- if (config.parent) {
45
- this._parent = config.parent;
46
- }
47
- }
48
- initComponents(_components) {
49
- // _components.forEach(component => {
50
- // this._components.set(component, new component());
51
- // })
52
- }
53
- initEntities(_entities) {
54
- _entities.forEach(this.register.bind(this));
55
- }
56
- initFragments(_fragments) {
57
- _fragments.forEach(this.register.bind(this));
58
- }
59
- get components() {
60
- return this.params.components || [];
61
- }
62
- get commands() {
63
- return this.params.commands || [];
64
- }
65
- get fragments() {
66
- return this.params.fragments || [];
67
- }
68
- parent(setValue) {
69
- if (setValue) {
70
- return this.inherit(setValue);
71
- }
16
+ // ===========================================================================
17
+ // --------------------Readonly Allowed Properties----------------------------
18
+ // ===========================================================================
19
+ /**
20
+ * Returns the name of the scope
21
+ */
22
+ get name() { return this._name; }
23
+ /**
24
+ * Returns a list of Constructors for A-Components that are available in the scope
25
+ */
26
+ get allowedComponents() { return this._allowedComponents; }
27
+ /**
28
+ * Returns a list of Constructors for A-Entities that are available in the scope
29
+ */
30
+ get allowedEntities() { return this._allowedEntities; }
31
+ /**
32
+ * Returns a list of Constructors for A-Fragments that are available in the scope
33
+ */
34
+ get allowedFragments() { return this._allowedFragments; }
35
+ /**
36
+ * Returns a list of Constructors for A-Errors that are available in the scope
37
+ */
38
+ get allowedErrors() { return this._allowedErrors; }
39
+ // ===========================================================================
40
+ // --------------------Readonly Registered Properties--------------------------
41
+ // ===========================================================================
42
+ /**
43
+ * Returns an Array of entities registered in the scope
44
+ *
45
+ * [!] One entity per aseid
46
+ */
47
+ get entities() { return Array.from(this._entities.values()); }
48
+ /**
49
+ * Returns an Array of fragments registered in the scope
50
+ *
51
+ * [!] One fragment per scope
52
+ */
53
+ get fragments() { return Array.from(this._fragments.values()); }
54
+ /**
55
+ * Returns an Array of components registered in the scope
56
+ *
57
+ * [!] One component instance per scope
58
+ */
59
+ get components() { return Array.from(this._components.values()); }
60
+ /**
61
+ * Returns the parent scope of the current scope
62
+ *
63
+ * @param setValue
64
+ * @returns
65
+ */
66
+ get parent() {
72
67
  return this._parent;
73
68
  }
74
- isInheritedFrom(scope) {
75
- let current = this;
76
- while (current) {
77
- if (current === scope) {
78
- return true;
79
- }
80
- current = current._parent;
69
+ constructor(param1, param2) {
70
+ // ===========================================================================
71
+ // --------------------ALLowed Constructors--------------------------------
72
+ // ===========================================================================
73
+ /**
74
+ * A set of allowed components, A set of constructors that are allowed in the scope
75
+ *
76
+ */
77
+ this._allowedComponents = new Set();
78
+ /**
79
+ * A set of allowed errors, A set of constructors that are allowed in the scope
80
+ */
81
+ this._allowedErrors = new Set();
82
+ /**
83
+ * A set of allowed entities, A set of constructors that are allowed in the scope
84
+ */
85
+ this._allowedEntities = new Set();
86
+ /**
87
+ * A set of allowed fragments, A set of constructors that are allowed in the scope
88
+ */
89
+ this._allowedFragments = new Set();
90
+ // ===========================================================================
91
+ // --------------------Internal Storage--------------------------------
92
+ // ===========================================================================
93
+ /**
94
+ * Storage for the components, should be strong as components are unique per scope
95
+ */
96
+ this._components = new Map();
97
+ /**
98
+ * Storage for the errors, should be strong as errors are unique per code
99
+ */
100
+ this._errors = new Map();
101
+ /**
102
+ * Storage for the entities, should be strong as entities are unique per aseid
103
+ */
104
+ this._entities = new Map();
105
+ /**
106
+ * Storage for the fragments, should be weak as fragments are singletons per scope
107
+ */
108
+ this._fragments = new Map();
109
+ const initializer = this.getInitializer(param1);
110
+ // the returned initializer is already bound to `this` (we used .bind(this)),
111
+ // so calling it will run the appropriate logic on this instance:
112
+ initializer.call(this, param1, param2);
113
+ }
114
+ /**
115
+ * Determines which initializer method to use based on the type of the first parameter.
116
+ *
117
+ * @param param1
118
+ * @returns
119
+ */
120
+ getInitializer(param1, param2) {
121
+ switch (true) {
122
+ case !param1 && !param2:
123
+ ;
124
+ return this.defaultInitialized;
125
+ case !!param1:
126
+ return this.defaultInitialized;
127
+ default:
128
+ throw new A_Scope_error_1.A_ScopeError(A_Scope_error_1.A_ScopeError.ConstructorError, 'Invalid parameters provided to A_Scope constructor');
81
129
  }
82
- return false;
83
130
  }
84
- inherit(parent) {
85
- // Prevent circular inheritance
86
- const circularCheck = this.checkCircularInheritance(parent);
87
- if (circularCheck) {
88
- throw new Error(`Circular inheritance detected: ${[...circularCheck, parent.name].join(' -> ')}`);
131
+ defaultInitialized(params = {}, config = {}) {
132
+ this._name = params.name || this.constructor.name;
133
+ this.initComponents(params.components);
134
+ this.initErrors(params.errors);
135
+ this.initFragments(params.fragments);
136
+ this.initEntities(params.entities);
137
+ if (config.parent) {
138
+ this._parent = config.parent;
89
139
  }
90
- this._parent = parent;
91
- return this;
92
140
  }
141
+ //==========================================================================
142
+ // --------------------Scope Initialization Methods---------------------------
143
+ //==========================================================================
93
144
  /**
94
- * Helper method to check circular inheritance
95
- * Should return a full sequence of inheritance for logging purposes
145
+ * This method is used to initialize the components in the scope
146
+ * To save memory components are initialized only when they are requested
147
+ *
148
+ * This method only registers the component in the scope in case they are not registered yet
149
+ *
150
+ * @param _components
151
+ */
152
+ initComponents(_components) { _components === null || _components === void 0 ? void 0 : _components.forEach(this.register.bind(this)); }
153
+ /**
154
+ * This method is used to initialize the errors in the scope
155
+ *
156
+ * This method only registers the errors in the scope in case they are not registered yet
157
+ *
158
+ * @param _errors
159
+ */
160
+ initErrors(_errors) { _errors === null || _errors === void 0 ? void 0 : _errors.forEach(this.register.bind(this)); }
161
+ /**
162
+ * This method is used to initialize the entities in the scope
163
+ *
164
+ * This method only registers the entities in the scope in case they are not registered yet
165
+ *
166
+ * @param _entities
167
+ */
168
+ initEntities(_entities) { _entities === null || _entities === void 0 ? void 0 : _entities.forEach(ent => this.register(ent)); }
169
+ /**
170
+ * This method is used to initialize the fragments in the scope
171
+ *
172
+ * This method only registers the fragments in the scope in case they are not registered yet
173
+ *
174
+ * @param _fragments
175
+ */
176
+ initFragments(_fragments) { _fragments === null || _fragments === void 0 ? void 0 : _fragments.forEach(this.register.bind(this)); }
177
+ /**
178
+ * Returns the issuer of the scope, useful for debugging and tracking purposes
179
+ *
180
+ * Issuer can be:
181
+ * - A Container that allocated the scope
182
+ * - A Feature that allocated the scope
183
+ *
184
+ * [!] 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
96
185
  *
97
- * @param scope
98
186
  * @returns
99
187
  */
100
- checkCircularInheritance(scope) {
101
- const inheritanceChain = [];
102
- let current = this._parent;
103
- while (current) {
104
- inheritanceChain.push(current.name);
105
- if (current === scope) {
106
- return inheritanceChain;
107
- }
108
- current = current._parent;
109
- }
110
- return false;
188
+ issuer() {
189
+ return A_Context_class_1.A_Context.issuer(this);
111
190
  }
112
- printInheritanceChain() {
113
- const chain = [];
114
- let current = this;
115
- while (current) {
116
- chain.push(current.name);
117
- current = current._parent;
118
- }
119
- console.log(chain.join(' -> '));
191
+ /**
192
+ * This method is used to inherit from a parent scope
193
+ *
194
+ * [!] This method checks for circular inheritance and throws an error if detected
195
+ *
196
+ * @param parent
197
+ * @returns
198
+ */
199
+ inherit(parent) {
200
+ if (!parent)
201
+ throw new A_Scope_error_1.A_ScopeError(A_Scope_error_1.A_ScopeError.InitializationError, `Invalid parent scope provided`);
202
+ if (parent === this)
203
+ throw new A_Scope_error_1.A_ScopeError(A_Scope_error_1.A_ScopeError.CircularInheritanceError, `Unable to inherit scope ${this.name} from itself`);
204
+ if (parent === this._parent)
205
+ return this;
206
+ // Prevent circular inheritance
207
+ const circularCheck = this.checkCircularInheritance(parent);
208
+ if (circularCheck)
209
+ throw new A_Scope_error_1.A_ScopeError(A_Scope_error_1.A_ScopeError.CircularInheritanceError, `Circular inheritance detected: ${[...circularCheck, parent.name].join(' -> ')}`);
210
+ this._parent = parent;
211
+ return this;
120
212
  }
121
- has(entity) {
213
+ has(ctor) {
214
+ let found = false;
122
215
  switch (true) {
123
- case typeof entity === 'string': {
124
- const possibleComponent = this.params.components.find(c => c.name === entity);
125
- if (possibleComponent) {
126
- return true;
127
- }
128
- const possibleFragment = this.params.fragments.find(f => f.name === entity);
129
- if (possibleFragment) {
130
- return true;
131
- }
132
- if (this.params.entities.some(e => e.constructor.name === entity)) {
133
- return true;
134
- }
216
+ // 1) Check by string name.
217
+ case typeof ctor === 'string': {
218
+ // 1.1 Check if it's a component name
219
+ const possibleComponent = Array.from(this.allowedComponents).find(c => c.name === ctor);
220
+ if (possibleComponent)
221
+ found = true;
222
+ // 1.2 Check if it's a fragment name
223
+ const possibleFragment = Array.from(this.allowedFragments).find(f => f.name === ctor);
224
+ if (possibleFragment)
225
+ found = true;
226
+ // 1.4 Check if it's an entity name or entity static entity property
227
+ const possibleEntity = Array.from(this.allowedEntities).find(e => e.name === ctor);
228
+ if (possibleEntity)
229
+ found = true;
230
+ // 1.5 If not found in current scope, check parent scope
135
231
  if (!!this._parent)
136
- return this._parent.has(entity);
232
+ return this._parent.has(ctor);
137
233
  return false;
138
234
  }
139
- case typeof entity === 'function'
140
- && a_utils_1.A_CommonHelper.isInheritedFrom(entity, A_Component_class_1.A_Component):
141
- {
142
- const found = this.components.includes(entity);
143
- if (!found && !!this._parent) {
144
- return this._parent.has(entity);
145
- }
146
- return found;
147
- }
148
- case typeof entity === 'function'
149
- && a_utils_1.A_CommonHelper.isInheritedFrom(entity, A_Entity_class_1.A_Entity):
150
- {
151
- const entities = Array.from(this._entities.values());
152
- const found = entities.find(e => e instanceof entity);
153
- return !!found;
154
- }
155
- case typeof entity === 'function'
156
- && a_utils_1.A_CommonHelper.isInheritedFrom(entity, A_Fragment_class_1.A_Fragment):
157
- {
158
- const found = this._fragments.has(entity);
159
- if (!found && !!this._parent)
160
- return this._parent.has(entity);
161
- return found;
162
- }
163
- case typeof entity === 'function'
164
- && a_utils_1.A_CommonHelper.isInheritedFrom(entity, A_Command_class_1.A_Command):
165
- {
166
- const found = this.commands.includes(entity);
167
- if (!found && !!this._parent)
168
- return this._parent.has(entity);
169
- return found;
170
- }
171
- default: {
172
- return false;
235
+ // 2) Check if it's a Component
236
+ case A_TypeGuards_helper_1.A_TypeGuards.isComponentConstructor(ctor): {
237
+ found = this.isAllowedComponent(ctor);
238
+ break;
239
+ }
240
+ // 3) Check if it's an Entity
241
+ case A_TypeGuards_helper_1.A_TypeGuards.isEntityConstructor(ctor): {
242
+ found = this.isAllowedEntity(ctor);
243
+ break;
244
+ }
245
+ // 4) Check if it's a Fragment
246
+ case A_TypeGuards_helper_1.A_TypeGuards.isFragmentConstructor(ctor): {
247
+ found = this.isAllowedFragment(ctor);
248
+ break;
173
249
  }
174
250
  }
251
+ if (!found && !!this._parent)
252
+ return this._parent.has(ctor);
253
+ return found;
175
254
  }
176
255
  /**
177
256
  * Merges two scopes into a new one
@@ -185,124 +264,159 @@ class A_Scope {
185
264
  */
186
265
  merge(anotherScope) {
187
266
  const merged = new A_Scope({
188
- name: `${this.name}&${anotherScope.name}`,
189
- components: Array.from(new Set([
190
- ...this.params.components,
191
- ...anotherScope.params.components
192
- ])),
193
- fragments: Array.from(new Set([
194
- ...this.params.fragments,
195
- ...anotherScope.params.fragments
196
- ])),
197
- entities: Array.from(new Set([
198
- ...this.params.entities,
199
- ...anotherScope.params.entities
200
- ])),
267
+ name: `${this.name} + ${anotherScope.name}`,
268
+ components: [...this.allowedComponents, ...anotherScope.allowedComponents],
269
+ fragments: [...this.fragments, ...anotherScope.fragments],
270
+ entities: [
271
+ ...this.entities, ...anotherScope.entities,
272
+ ...this.allowedEntities, ...anotherScope.allowedEntities
273
+ ],
201
274
  }, {
202
275
  parent: this._parent || anotherScope._parent
203
276
  });
204
277
  return merged;
205
278
  }
206
- /**
207
- * Allows to retrieve the constructor of the component or entity by its name
208
- *
209
- * [!] Notes:
210
- * - 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
211
- * - 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
212
- * - In case of search for A_Component please ensure that provided string corresponds to the class name in PascalCase
213
- *
214
- * @param name
215
- * @returns
216
- */
217
279
  resolveConstructor(name) {
218
- // Check components
219
- const component = this.params.components.find(c => c.name === a_utils_1.A_CommonHelper.toPascalCase(name));
280
+ // 1) Check components
281
+ const component = Array.from(this.allowedComponents).find(c => c.name === name
282
+ || c.name === A_Formatter_helper_1.A_FormatterHelper.toPascalCase(name));
220
283
  if (component)
221
284
  return component;
222
- // Check entities
223
- const entity = this.params.entities.find(e => e.constructor.entity === name
224
- || e.constructor.name === a_utils_1.A_CommonHelper.toPascalCase(name)
225
- || e.constructor.entity === a_utils_1.A_CommonHelper.toKebabCase(name));
285
+ // 2) Check entities
286
+ const entity = Array.from(this.allowedEntities).find(e => e.name === name
287
+ || e.name === A_Formatter_helper_1.A_FormatterHelper.toPascalCase(name)
288
+ || e.entity === name
289
+ || e.entity === A_Formatter_helper_1.A_FormatterHelper.toKebabCase(name));
226
290
  if (entity)
227
- return entity.constructor;
228
- // Check commands
229
- const command = this.params.commands.find(c => c.code === name
230
- || c.name === a_utils_1.A_CommonHelper.toPascalCase(name)
231
- || c.code === a_utils_1.A_CommonHelper.toKebabCase(name));
232
- if (command)
233
- return command;
291
+ return entity;
292
+ // 3) Check fragments
293
+ const fragment = Array.from(this.allowedFragments).find(f => f.name === name
294
+ || f.name === A_Formatter_helper_1.A_FormatterHelper.toPascalCase(name));
295
+ if (fragment)
296
+ return fragment;
234
297
  // If not found in current scope, check parent scope
235
298
  if (!!this._parent) {
236
299
  return this._parent.resolveConstructor(name);
237
300
  }
238
301
  throw new Error(`Component or Entity with name ${name} not found in the scope ${this.name}`);
239
302
  }
240
- // base definition
241
- resolve(param1, param2) {
303
+ resolve(
304
+ /**
305
+ * Provide a component, fragment or entity constructor or an array of constructors to resolve its instance(s) from the scope
306
+ */
307
+ param1, param2) {
242
308
  switch (true) {
243
- case Array.isArray(param1): {
244
- return param1.map(c => this.resolveOnce(param1, param2));
309
+ case A_TypeGuards_helper_1.A_TypeGuards.isArray(param1): {
310
+ return param1.map(c => {
311
+ if (A_TypeGuards_helper_1.A_TypeGuards.isString(c))
312
+ return this.resolveByName(c);
313
+ else
314
+ return this.resolveOnce(c, param2);
315
+ }).filter(Boolean);
245
316
  }
246
- case typeof param1 === 'function': {
317
+ case A_TypeGuards_helper_1.A_TypeGuards.isFunction(param1): {
247
318
  return this.resolveOnce(param1, param2);
248
319
  }
249
- case typeof param1 === 'string': {
320
+ case A_TypeGuards_helper_1.A_TypeGuards.isString(param1): {
250
321
  return this.resolveByName(param1);
251
322
  }
252
323
  default: {
253
- throw new Error('Invalid arguments provided');
324
+ throw new A_Error_class_1.A_Error(`Invalid parameter provided to resolve method: ${param1} in scope ${this.name}`);
254
325
  }
255
326
  }
256
327
  }
257
- resolveByName(name) {
258
- // Check components
259
- const component = this.params.components.find(c => c.name === name);
328
+ // ==================================================================================================
329
+ // --------------------------------------------------------------------------------------------------
330
+ // -------------------------------------INTERNAL RESOLVERS-------------------------------------------
331
+ // --------------------------------------------------------------------------------------------------
332
+ // ==================================================================================================
333
+ /**
334
+ * This method is used internally to resolve a component, fragment or entity by its constructor name
335
+ *
336
+ * [!] Note that this method checks for the component, fragment or entity in the current scope and all parent scopes
337
+ *
338
+ * @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)
339
+ * @returns
340
+ */
341
+ resolveByName(
342
+ /**
343
+ * Provide the name of the component, fragment or entity to resolve
344
+ */
345
+ name) {
346
+ // 1) Check components
347
+ const component = Array.from(this.allowedComponents).find(c => c.name === name
348
+ || c.name === A_Formatter_helper_1.A_FormatterHelper.toPascalCase(name));
260
349
  if (component)
261
- return this.resolveComponent(component);
262
- // Check commands
263
- const command = this.params.commands.find(c => c.name === name);
264
- if (command)
265
- return this.resolveComponent(command);
266
- // Check fragments
267
- const fragment = this.params.fragments.find(f => f.constructor.name === name);
268
- if (fragment)
269
- return this.resolveFragment(fragment.constructor);
270
- // Check entities
271
- const entity = this.params.entities.find(e => e.constructor.name === name);
350
+ return this.resolveOnce(component);
351
+ // 2) Check entities
352
+ const entity = Array.from(this.allowedEntities).find(e => e.name === name
353
+ || e.name === A_Formatter_helper_1.A_FormatterHelper.toPascalCase(name)
354
+ || e.entity === name
355
+ || e.entity === A_Formatter_helper_1.A_FormatterHelper.toKebabCase(name));
272
356
  if (entity)
273
- return this.resolveEntity(entity.constructor);
357
+ return this.resolveOnce(entity);
358
+ // 3) Check fragments
359
+ const fragment = Array.from(this.allowedFragments).find(f => f.name === name
360
+ || f.name === A_Formatter_helper_1.A_FormatterHelper.toPascalCase(name));
361
+ if (fragment)
362
+ return this.resolveOnce(fragment);
274
363
  // If not found in current scope, check parent scope
275
- if (this._parent) {
364
+ if (!!this._parent) {
276
365
  return this._parent.resolveByName(name);
277
366
  }
278
- throw new Error(`Component, Fragment, or Entity with name ${name} not found in the scope ${this.name}`);
367
+ throw new Error(`Component or Entity with name ${name} not found in the scope ${this.name}`);
279
368
  }
369
+ /**
370
+ * This method is used internally to resolve a single component, fragment or entity from the scope
371
+ *
372
+ * @param component
373
+ * @param instructions
374
+ * @returns
375
+ */
280
376
  resolveOnce(component, instructions) {
377
+ if (A_TypeGuards_helper_1.A_TypeGuards.isScopeConstructor(component))
378
+ component;
379
+ if (typeof component == 'function' && component.name === 'A_Scope')
380
+ component;
281
381
  switch (true) {
282
- case a_utils_1.A_CommonHelper.isInheritedFrom(component, A_Entity_class_1.A_Entity): {
382
+ case A_TypeGuards_helper_1.A_TypeGuards.isEntityConstructor(component): {
283
383
  return this.resolveEntity(component, instructions);
284
384
  }
285
- case a_utils_1.A_CommonHelper.isInheritedFrom(component, A_Fragment_class_1.A_Fragment): {
385
+ case A_TypeGuards_helper_1.A_TypeGuards.isFragmentConstructor(component): {
286
386
  return this.resolveFragment(component);
287
387
  }
288
- case a_utils_1.A_CommonHelper.isInheritedFrom(component, A_Scope): {
388
+ case A_TypeGuards_helper_1.A_TypeGuards.isScopeConstructor(component): {
289
389
  return this.resolveScope(component);
290
390
  }
291
- case a_utils_1.A_CommonHelper.isInheritedFrom(component, A_Component_class_1.A_Component): {
391
+ case A_TypeGuards_helper_1.A_TypeGuards.isComponentConstructor(component): {
292
392
  return this.resolveComponent(component);
293
393
  }
294
394
  default:
295
395
  throw new Error(`Injected Component ${component} not found in the scope`);
296
396
  }
297
397
  }
398
+ /**
399
+ * This method is used internally to resolve a single entity from the scope based on the provided instructions
400
+ *
401
+ * [!] Note that this method can return either a single entity or an array of entities depending on the instructions provided
402
+ *
403
+ * @param entity
404
+ * @param instructions
405
+ * @returns
406
+ */
298
407
  resolveEntity(entity, instructions) {
299
408
  var _a;
300
409
  const query = (instructions === null || instructions === void 0 ? void 0 : instructions.query) || {};
301
410
  const count = ((_a = instructions === null || instructions === void 0 ? void 0 : instructions.pagination) === null || _a === void 0 ? void 0 : _a.count) || 1;
302
411
  switch (true) {
412
+ /**
413
+ * 1) In case when no instructions provided, return the first found entity of the provided type
414
+ *
415
+ * [!] Note that it returns ONLY ONE entity
416
+ * [!!] In case when no entity found in the current scope, it tries to resolve it from the parent scope (if exists)
417
+ */
303
418
  case !instructions: {
304
- const entities = Array.from(this._entities.values());
305
- const found = entities.find(e => e instanceof entity);
419
+ const found = this.entities.find(e => e instanceof entity);
306
420
  switch (true) {
307
421
  case !!found:
308
422
  return found;
@@ -312,31 +426,53 @@ class A_Scope {
312
426
  throw new Error(`Entity ${entity.name} not found in the scope ${this.name}`);
313
427
  }
314
428
  }
429
+ /**
430
+ * 2) In case when aseid is provided in the query, we can directly get the entity from the map
431
+ *
432
+ * [!] Note that it returns ONLY ONE entity
433
+ */
315
434
  case !!query.aseid
316
435
  && typeof query.aseid === 'string'
317
436
  && this._entities.has(query.aseid):
318
437
  {
319
438
  return this._entities.get(query.aseid);
320
439
  }
440
+ /**
441
+ * 3) In case when aseid is provided as ASEID instance, we can directly get the entity from the map
442
+ *
443
+ * [!] Note that it returns ONLY ONE entity
444
+ */
321
445
  case !!query.aseid
322
446
  && typeof query.aseid === 'object'
323
- && query.aseid instanceof a_utils_1.ASEID
447
+ && query.aseid instanceof ASEID_class_1.ASEID
324
448
  && this._entities.has(query.aseid.toString()):
325
449
  {
326
450
  return this._entities.get(query.aseid.toString());
327
451
  }
452
+ /**
453
+ * 4) In case when id is provided in the query, we have to find the entity by the id
454
+ *
455
+ * [!] Note that it returns ONLY ONE entity
456
+ */
328
457
  case !!query.id: {
329
- // in this case we have to find the entity by the id
330
- const entities = Array.from(this._entities.values());
331
- const found = entities.filter(e => e instanceof entity).find(e => {
332
- return String(e.id) === String(query.id);
333
- });
458
+ const found = this.entities
459
+ .filter(e => e instanceof entity)
460
+ .find(e => String(e.id) === String(query.id));
334
461
  return found;
335
462
  }
463
+ /**
464
+ * 5) In case when there's a query object, we have to filter the entities by the query
465
+ *
466
+ * [!] Note that it can return either a single entity or an array of entities depending on the count instruction
467
+ * [!!] In case when no entity found in the current scope, it tries to resolve it from the parent scope (if exists)
468
+ */
336
469
  default: {
337
- const entities = Array.from(this._entities.values());
338
- const found = entities.filter(e => e instanceof entity).filter(e => {
339
- return Object.entries(query).every(([key, value]) => {
470
+ const found = this.entities
471
+ .filter(e => e instanceof entity)
472
+ .filter(e => {
473
+ return Object
474
+ .entries(query)
475
+ .every(([key, value]) => {
340
476
  if (key in e) {
341
477
  return e[key] === value;
342
478
  }
@@ -351,131 +487,143 @@ class A_Scope {
351
487
  }
352
488
  }
353
489
  }
490
+ /**
491
+ * This method is used internally to resolve a single fragment from the scope
492
+ *
493
+ * @param fragment
494
+ * @returns
495
+ */
354
496
  resolveFragment(fragment) {
355
- const fragmentInstancePresented = this.fragments.some(fr => fr instanceof fragment);
497
+ const fragmentInstancePresented = this._fragments.get(fragment);
356
498
  switch (true) {
357
499
  case fragmentInstancePresented && this._fragments.has(fragment):
358
- return this._fragments.get(fragment);
359
- case fragmentInstancePresented && !this._fragments.has(fragment):
360
- return this.fragments.find(fr => fr instanceof fragment);
500
+ return fragmentInstancePresented;
361
501
  case !fragmentInstancePresented && !!this._parent:
362
502
  return this._parent.resolveFragment(fragment);
363
503
  default:
364
504
  throw new Error(`Fragment ${fragment.name} not found in the scope ${this.name}`);
365
505
  }
366
506
  }
507
+ /**
508
+ * This method is used internally to resolve a single scope from the current scope
509
+ *
510
+ * @param scope
511
+ * @returns
512
+ */
367
513
  resolveScope(scope) {
368
514
  return this;
369
515
  }
516
+ /**
517
+ * This method is used internally to resolve a single component from the scope
518
+ *
519
+ * @param component
520
+ * @returns
521
+ */
370
522
  resolveComponent(component) {
371
523
  // The idea here that in case when Scope has no exact component we have to resolve it from the _parent
372
524
  // BUT: if it's not presented in _parent we have to check for inheritance
373
525
  // That means that we should ensure that there's no components that are children of the required component
374
526
  switch (true) {
375
- // In case when the component is available and exists in the scope
376
- case this.components.includes(component) && this._components.has(component): {
527
+ // 1) In case when the component is available and exists in the scope
528
+ case this.allowedComponents.has(component) && this._components.has(component): {
377
529
  return this._components.get(component);
378
530
  }
379
- // In case the component available but does NOT exist in the scope
380
- case this.components.includes(component) && !this._components.has(component): {
531
+ // 2) In case the component available but does NOT exist in the scope
532
+ case this.allowedComponents.has(component) && !this._components.has(component): {
381
533
  const componentMeta = A_Context_class_1.A_Context.meta(component);
382
- const argsMeta = componentMeta.get(A_Component_types_1.A_TYPES__ComponentMetaKey.INJECTIONS);
534
+ const argsMeta = componentMeta.get(A_Component_constants_1.A_TYPES__ComponentMetaKey.INJECTIONS);
383
535
  const resolvedArgs = ((argsMeta === null || argsMeta === void 0 ? void 0 : argsMeta.get('constructor')) || [])
384
536
  .map(arg => {
385
537
  if ('instructions' in arg) {
386
538
  const { target, instructions } = arg;
387
539
  return this.resolve(target, instructions);
388
540
  }
541
+ // TODO: Fix types mismatch here
389
542
  return this.resolve(arg.target);
390
543
  });
391
544
  const newComponent = new component(...resolvedArgs);
392
545
  this.register(newComponent);
393
546
  return this._components.get(component);
394
547
  }
395
- // In case when there's a component that is inherited from the required component
396
- case !this.components.includes(component) && this.components.some(el => a_utils_1.A_CommonHelper.isInheritedFrom(el, component)): {
397
- const found = this.components.find(el => a_utils_1.A_CommonHelper.isInheritedFrom(el, component));
548
+ // 3) In case when there's a component that is inherited from the required component
549
+ case !this.allowedComponents.has(component) && Array.from(this.allowedComponents).some(el => A_Common_helper_1.A_CommonHelper.isInheritedFrom(el, component)): {
550
+ const found = Array.from(this.allowedComponents).find(el => A_Common_helper_1.A_CommonHelper.isInheritedFrom(el, component));
398
551
  return this.resolveComponent(found);
399
552
  }
400
- // In case when the component is not available in the scope but the _parent is available
401
- case !this.components.includes(component) && !!this._parent: {
553
+ // 4) In case when the component is not available in the scope but the _parent is available
554
+ case !!this._parent: {
402
555
  return this._parent.resolveComponent(component);
403
556
  }
404
557
  default:
405
558
  throw new Error(`Component ${component.name} not found in the scope ${this.name}`);
406
559
  }
407
560
  }
408
- /**
409
- * Should be similar to resolveEntity but for commands
410
- *
411
- * @param command
412
- */
413
- resolveCommand(command) {
414
- const commands = Array.from(this._commands.values());
415
- const found = commands.find(e => e instanceof command);
416
- switch (true) {
417
- case !!found:
418
- return found;
419
- case !found && !!this._parent:
420
- return this._parent.resolveCommand(command);
421
- default:
422
- throw new Error(`Command ${command.name} not found in the scope ${this.name}`);
423
- }
424
- }
425
561
  register(param1) {
426
562
  switch (true) {
427
- case param1 instanceof A_Component_class_1.A_Component && !this._components.has(param1.constructor): {
563
+ // ------------------------------------------
564
+ // ------------ Instances ----------------
565
+ // ------------------------------------------
566
+ // 1) In case when it's a A-Component instance
567
+ case param1 instanceof A_Component_class_1.A_Component: {
568
+ if (!this.allowedComponents.has(param1.constructor))
569
+ this.allowedComponents.add(param1.constructor);
428
570
  this._components.set(param1.constructor, param1);
429
- const allowedComponent = this.components.find(c => c === param1.constructor);
430
- if (!allowedComponent) {
431
- this.components.push(param1.constructor);
432
- }
433
571
  A_Context_class_1.A_Context.register(this, param1);
434
572
  break;
435
573
  }
574
+ // 3) In case when it's a A-Entity instance
436
575
  case param1 instanceof A_Entity_class_1.A_Entity && !this._entities.has(param1.aseid.toString()): {
576
+ if (!this.allowedEntities.has(param1.constructor))
577
+ this.allowedEntities.add(param1.constructor);
437
578
  this._entities.set(param1.aseid.toString(), param1);
438
579
  A_Context_class_1.A_Context.register(this, param1);
439
580
  break;
440
581
  }
441
- case param1 instanceof A_Fragment_class_1.A_Fragment && !this._fragments.has(param1.constructor): {
442
- const allowedFragment = this.fragments.find(fr => fr instanceof param1.constructor);
443
- if (!allowedFragment) {
444
- this.fragments.push(param1);
445
- }
582
+ // 4) In case when it's a A-Fragment instance
583
+ case param1 instanceof A_Fragment_class_1.A_Fragment: {
584
+ if (!this.allowedFragments.has(param1.constructor))
585
+ this.allowedFragments.add(param1.constructor);
446
586
  this._fragments.set(param1.constructor, param1);
447
587
  A_Context_class_1.A_Context.register(this, param1);
448
588
  break;
449
589
  }
450
- case param1 instanceof A_Component_class_1.A_Component: {
451
- this._components.set(param1.constructor, param1);
452
- const allowedComponent = this.components.find(c => c === param1.constructor);
453
- if (!allowedComponent) {
454
- this.components.push(param1.constructor);
455
- }
456
- A_Context_class_1.A_Context.register(this, param1);
590
+ // 5) In case when it's a A-Error instance
591
+ case param1 instanceof A_Error_class_1.A_Error: {
592
+ if (!this.allowedErrors.has(param1.constructor))
593
+ this.allowedErrors.add(param1.constructor);
594
+ // A_Context.register(this, param1);
457
595
  break;
458
596
  }
459
- case typeof param1 === 'function' && a_utils_1.A_CommonHelper.isInheritedFrom(param1, A_Component_class_1.A_Component): {
460
- const allowedComponent = this.components.find(c => c === param1);
461
- if (!allowedComponent)
462
- this.components.push(param1);
597
+ // ------------------------------------------
598
+ // ------------ Constructors ----------------
599
+ // ------------------------------------------
600
+ // 6) In case when it's a A-Component constructor
601
+ case A_TypeGuards_helper_1.A_TypeGuards.isComponentConstructor(param1): {
602
+ if (!this.allowedComponents.has(param1))
603
+ this.allowedComponents.add(param1);
463
604
  break;
464
605
  }
465
- case typeof param1 === 'function' && a_utils_1.A_CommonHelper.isInheritedFrom(param1, A_Entity_class_1.A_Entity): {
466
- const allowedEntity = this.params.entities.find(e => e.constructor === param1);
467
- if (!allowedEntity) {
468
- this.params.entities.push(new param1());
469
- }
606
+ // 8) In case when it's a A-Fragment constructor
607
+ case A_TypeGuards_helper_1.A_TypeGuards.isFragmentConstructor(param1): {
608
+ if (!this.allowedFragments.has(param1))
609
+ this.allowedFragments.add(param1);
470
610
  break;
471
611
  }
472
- case typeof param1 === 'function' && a_utils_1.A_CommonHelper.isInheritedFrom(param1, A_Command_class_1.A_Command): {
473
- const allowedCommand = this.commands.find(c => c === param1);
474
- if (!allowedCommand) {
475
- this.commands.push(param1);
476
- }
612
+ // 9) In case when it's a A-Entity constructor
613
+ case A_TypeGuards_helper_1.A_TypeGuards.isEntityConstructor(param1): {
614
+ if (!this.allowedEntities.has(param1))
615
+ this.allowedEntities.add(param1);
477
616
  break;
478
617
  }
618
+ // 10) In case when it's a A-Error constructor
619
+ case A_TypeGuards_helper_1.A_TypeGuards.isErrorConstructor(param1): {
620
+ if (!this.allowedErrors.has(param1))
621
+ this.allowedErrors.add(param1);
622
+ break;
623
+ }
624
+ // ------------------------------------------
625
+ // ------------ Invalid Cases ----------------
626
+ // ------------------------------------------
479
627
  default:
480
628
  if (param1 instanceof A_Entity_class_1.A_Entity)
481
629
  throw new Error(`Entity with ASEID ${param1.aseid.toString()} is already registered in the scope ${this.name}`);
@@ -485,12 +633,110 @@ class A_Scope {
485
633
  throw new Error(`Cannot register ${param1} in the scope ${this.name}`);
486
634
  }
487
635
  }
636
+ /**
637
+ * This method is useful when you want to serialize the scope to JSON
638
+ *
639
+ * [!] Note this is not a deep serialization, only the fragments are serialized
640
+ * [!] Fragments are a storage for information which is relevant to the scope
641
+ *
642
+ * @returns
643
+ */
488
644
  toJSON() {
489
- return this.fragments.reduce((acc, fragment) => {
645
+ return this.fragments
646
+ .reduce((acc, fragment) => {
490
647
  const serialized = fragment.toJSON();
491
648
  return Object.assign(Object.assign({}, acc), { [serialized.name]: serialized });
492
649
  }, {});
493
650
  }
651
+ //==========================================================================
652
+ // --------------------Scope Type Check Helpers---------------------------
653
+ //==========================================================================
654
+ /**
655
+ * Type guard to check if the constructor is of type A_Component and is allowed in the scope
656
+ *
657
+ * @param ctor
658
+ * @returns
659
+ */
660
+ isAllowedComponent(ctor) {
661
+ return A_TypeGuards_helper_1.A_TypeGuards.isComponentConstructor(ctor) && this.allowedComponents.has(ctor);
662
+ }
663
+ /**
664
+ * Type guard to check if the constructor is of type A_Entity and is allowed in the scope
665
+ *
666
+ * @param ctor
667
+ * @returns
668
+ */
669
+ isAllowedEntity(ctor) {
670
+ return A_TypeGuards_helper_1.A_TypeGuards.isEntityConstructor(ctor) && this.allowedEntities.has(ctor);
671
+ }
672
+ /**
673
+ * Type guard to check if the constructor is of type A_Fragment and is allowed in the scope
674
+ *
675
+ * @param ctor
676
+ * @returns
677
+ */
678
+ isAllowedFragment(ctor) {
679
+ return A_TypeGuards_helper_1.A_TypeGuards.isFragmentConstructor(ctor) && this.allowedFragments.has(ctor);
680
+ }
681
+ /**
682
+ * Type guard to check if the constructor is of type A_Error and is allowed in the scope
683
+ *
684
+ * @param ctor
685
+ * @returns
686
+ */
687
+ isAllowedError(ctor) {
688
+ return A_TypeGuards_helper_1.A_TypeGuards.isErrorConstructor(ctor) && this.allowedErrors.has(ctor);
689
+ }
690
+ // ==========================================================================
691
+ // --------------------DEBUG & Helpers Methods--------------------------------
692
+ // ===========================================================================
693
+ /**
694
+ * This method is used to check if the scope is inherited from another scope
695
+ *
696
+ * @param scope
697
+ * @returns
698
+ */
699
+ isInheritedFrom(scope) {
700
+ let current = this;
701
+ while (current) {
702
+ if (current === scope) {
703
+ return true;
704
+ }
705
+ current = current._parent;
706
+ }
707
+ return false;
708
+ }
709
+ /**
710
+ * Helper method to check circular inheritance
711
+ * Should return a full sequence of inheritance for logging purposes
712
+ *
713
+ * @param scope
714
+ * @returns
715
+ */
716
+ checkCircularInheritance(scope) {
717
+ const inheritanceChain = [];
718
+ let current = this._parent;
719
+ while (current) {
720
+ inheritanceChain.push(current.name);
721
+ if (current === scope) {
722
+ return inheritanceChain;
723
+ }
724
+ current = current._parent;
725
+ }
726
+ return false;
727
+ }
728
+ /**
729
+ * Helper method to print the inheritance chain of the scope
730
+ */
731
+ printInheritanceChain() {
732
+ const chain = [];
733
+ let current = this;
734
+ while (current) {
735
+ chain.push(current.name);
736
+ current = current._parent;
737
+ }
738
+ console.log(chain.join(' -> '));
739
+ }
494
740
  }
495
741
  exports.A_Scope = A_Scope;
496
742
  //# sourceMappingURL=A-Scope.class.js.map