@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
@@ -0,0 +1,408 @@
1
+ import {
2
+ A_TYPES__Error_Init,
3
+ A_TYPES__Error_Serialized
4
+ } from './A_Error.types';
5
+ import {
6
+ A_CONSTANTS__ERROR_CODES,
7
+ A_CONSTANTS__ERROR_DESCRIPTION
8
+ } from './A_Error.constants';
9
+ import { A_FormatterHelper } from '@adaas/a-concept/helpers/A_Formatter.helper';
10
+ import { A_Context } from '../A-Context/A-Context.class';
11
+ import { A_TypeGuards } from '@adaas/a-concept/helpers/A_TypeGuards.helper';
12
+ import { ASEID } from '../ASEID/ASEID.class';
13
+
14
+
15
+ export class A_Error<
16
+ _ConstructorType extends A_TYPES__Error_Init = A_TYPES__Error_Init,
17
+ _SerializedType extends A_TYPES__Error_Serialized = A_TYPES__Error_Serialized
18
+ > extends Error {
19
+ // ====================================================================
20
+ // ================== Static A-Error Information ======================
21
+ // ====================================================================
22
+ /**
23
+ * Error Identifier that corresponds to the class name
24
+ */
25
+ static get entity(): string {
26
+ return A_FormatterHelper.toKebabCase(this.name);
27
+ }
28
+ /**
29
+ * DEFAULT Namespace of the error from environment variable A_CONCEPT_NAMESPACE
30
+ *
31
+ * [!] If environment variable is not set, it will default to 'a-concept'
32
+ */
33
+ static get concept(): string {
34
+ return A_Context.concept;
35
+ }
36
+ /**
37
+ * DEFAULT Scope of the entity from environment variable A_CONCEPT_DEFAULT_SCOPE
38
+ *
39
+ * [!] If environment variable is not set, it will default to 'core'
40
+ * [!] Scope is an application specific identifier that can be used to group entities together
41
+ * [!] e.g. 'default', 'core', 'public', 'internal', etc
42
+ */
43
+ static get scope(): string {
44
+ return A_Context.root.name;
45
+ }
46
+
47
+ // ====================================================================
48
+ // ================== Hidden A-Error Information ======================
49
+ // ====================================================================
50
+ /**
51
+ * ASEID of the error instance
52
+ */
53
+ protected _aseid!: ASEID;
54
+ /**
55
+ * Possible Scope if needed to identify the error by it's execution environment
56
+ */
57
+ protected _scope?: string;
58
+ /**
59
+ * Unique code representing the type of error
60
+ */
61
+ protected _code?: string;
62
+ /**
63
+ * Detailed description of the error
64
+ */
65
+ protected _description?: string;
66
+ /**
67
+ * Original Error if any
68
+ */
69
+ protected _originalError?: Error | any
70
+ /**
71
+ * Link to the documentation or support page for the error
72
+ */
73
+ protected _link?: string;
74
+
75
+
76
+
77
+ /**
78
+ * A_Error is a custom error class for A_Concept framework.
79
+ * This error allows to have more structured error handling.
80
+ * Each error has a unique code, description and a link to the documentation.
81
+ *
82
+ * Example of usage:
83
+ * ```typescript
84
+ *
85
+ * // 1) all parameters will be used as provided
86
+ * throw new A_Error({
87
+ * message: 'User not found',
88
+ * code: 'USER_NOT_FOUND',
89
+ * description: 'The user with the given ID was not found.',
90
+ * link: 'https://support.adaas.org/error/USER_NOT_FOUND'
91
+ * });
92
+ *
93
+ * // or
94
+ * // 2) only message is provided, other parameters will be set to default values:
95
+ * // - code: 'user-not-found' (kebab-case of the message)
96
+ * // - description: 'User not found' (same as message)
97
+ * // - link: Empty
98
+ * throw new A_Error('User not found');
99
+ *
100
+ * // or
101
+ * // 3) Provided Message and Description, other parameters will be set to default values:
102
+ * // - code: 'user-not-found' (kebab-case of the message)
103
+ * // - description: 'The user with the given ID was not found.' (as provided)
104
+ * // - link: Empty
105
+ * throw new A_Error('User not found', 'The user with the given ID was not found.');
106
+ *
107
+ *
108
+ * ```
109
+ * [!] Note: The behavior of A_Error is similar to the A_Entity however it cannot have own A_Features.
110
+ * [!] Note: This class can be inherited to create custom error classes.
111
+ *
112
+ * @param message
113
+ */
114
+ constructor(
115
+ /**
116
+ * A_Error Constructor params
117
+ */
118
+ params: _ConstructorType
119
+ )
120
+ constructor(
121
+ /**
122
+ * Error message
123
+ */
124
+ message: string
125
+ )
126
+ constructor(
127
+ /**
128
+ * Original JS Error
129
+ */
130
+ error: Error
131
+ )
132
+ constructor(
133
+ /**
134
+ * Error message
135
+ */
136
+ message: string,
137
+ /**
138
+ * Detailed description of the error
139
+ */
140
+ description: string
141
+ )
142
+
143
+ constructor(
144
+ param1: _ConstructorType | Error | string | A_Error,
145
+ param2?: string
146
+ ) {
147
+ // to prevent errors accumulation in the stack trace it returns the original error if provided param1 is A_Error
148
+ if (param1 instanceof A_Error) {
149
+ return param1 as A_Error<_ConstructorType, _SerializedType>;
150
+ } else if (A_TypeGuards.isConstructorType<_ConstructorType>(param1)) {
151
+ super(param1.message);
152
+ } else if (param1 instanceof Error) {
153
+ super(param1.message);
154
+ } else if (A_TypeGuards.isString(param1)) {
155
+ super(param1);
156
+ } else {
157
+ console.log('INVALID PARAMS PROVIDED TO A_ERROR CONSTRUCTOR: ', param1);
158
+
159
+ throw new A_Error(
160
+ A_CONSTANTS__ERROR_CODES.VALIDATION_ERROR,
161
+ 'Invalid parameters provided to A_Error constructor'
162
+ );
163
+ }
164
+
165
+ // check message length
166
+ this.validateMessage(this.message);
167
+
168
+ const initializer = this.getInitializer(param1);
169
+ // the returned initializer is already bound to `this` (we used .bind(this)),
170
+ // so calling it will run the appropriate logic on this instance:
171
+ initializer.call(this, param1, param2);
172
+ }
173
+
174
+
175
+
176
+ // ====================================================================
177
+ // ================== Public A-Error Information ======================
178
+ // ====================================================================
179
+ /**
180
+ * Returns the ASEID of the error instance
181
+ */
182
+ get aseid(): ASEID {
183
+ return this._aseid;
184
+ }
185
+ /**
186
+ * Returns an Error message what is a brief title of the error
187
+ *
188
+ * Example: 'User not found', 'Validation error', 'Unauthorized access', etc.
189
+ *
190
+ * [!] Note: This message should be short and concise, less than 60 characters
191
+ * [!] Note: If message exceeds 60 characters, there would be an error thrown
192
+ * [!] Note: This message is intended to be human-readable and can be displayed in UI or logs
193
+ */
194
+ get message(): string {
195
+ return super.message;
196
+ }
197
+ /**
198
+ * Returns a unique code representing the type of error
199
+ *
200
+ * If code is not provided, it will generate a kebab-case of the message
201
+ *
202
+ * Example: 'validation-error', 'not-found', 'user-not-found', 'unauthorized' etc.
203
+ *
204
+ * [!] Note: It is recommended to use kebab-case for error codes
205
+ * [!] Note: If not provided would be used a kebab-case message of the error
206
+ */
207
+ get code(): string {
208
+ return this._code || A_FormatterHelper.toKebabCase(this.message);
209
+ }
210
+ /**
211
+ * Returns the type of the error which corresponds to the static entity of the class
212
+ *
213
+ * Example: 'a-error', 'validation-error', 'not-found-error', 'user-error', etc.
214
+ *
215
+ * Defaults to the kebab-case of the class name
216
+ *
217
+ * [!] Note: naming ad separation are fully dependent on the architecture of the application
218
+ * [!] Note: It is recommended to use kebab-case for error types
219
+ * [!] Note: This type is intended to group similar errors together
220
+ */
221
+ get type() {
222
+ return (this.constructor as typeof A_Error).entity;
223
+ }
224
+ /**
225
+ * Returns a link with possible documentation or support page for the error
226
+ * If link is not provided, it will generate a link based on the ASEID of the error that points to the A-Concept support page
227
+ *
228
+ * Example: https://adaas.support/a-concept/errors/{ASEID}
229
+ *
230
+ * [!] Note: ASEID is generated based on the static properties of the class (concept, scope, entity) and the code of the error
231
+ */
232
+ get link() {
233
+ if (this._link)
234
+ return this._link;
235
+
236
+ const url = new URL(`https://adaas.support/a-concept/errors/${this.aseid.toString()}`);
237
+
238
+ return url.toString();
239
+ }
240
+ /**
241
+ * The scope name of the error instance
242
+ *
243
+ * If scope is not provided, it will use the static scope of the class
244
+ *
245
+ * [!] Note: Scope is an application specific identifier that can be used to group entities together
246
+ * [!] e.g. 'default', 'core', 'public', 'internal', etc
247
+ */
248
+ get scope() {
249
+ return this._aseid.scope
250
+ }
251
+ /**
252
+ * A detailed description of the error
253
+ * If description is not provided, it will use the environment variable A_ERROR_DEFAULT_DESCRIPTION or a generic message
254
+ *
255
+ * Example: 'The user with the given ID was not found.', 'The provided data is invalid.', 'You do not have permission to access this resource.', etc.
256
+ *
257
+ * [!] Note: This description is intended to provide more context about the error and can be used for debugging or logging purposes
258
+ */
259
+ get description(): string {
260
+ return this._description || process.env.A_ERROR_DEFAULT_DESCRIPTION || A_CONSTANTS__ERROR_DESCRIPTION;
261
+ }
262
+ /**
263
+ * Returns the original error if any
264
+ *
265
+ * This can be useful for debugging purposes to see the original stack trace or error message
266
+ *
267
+ * [!] Note: Original error is optional and may not be present in all cases
268
+ */
269
+ get originalError(): Error | any | undefined {
270
+ return this._originalError;
271
+ }
272
+
273
+
274
+
275
+ /**
276
+ * Determines which initializer method to use based on the type of the first parameter.
277
+ *
278
+ * @param param1
279
+ * @returns
280
+ */
281
+ protected getInitializer(
282
+ param1: _ConstructorType | Error | string | any,
283
+ ): (param1: any, param2: any) => void | (() => void) {
284
+ switch (true) {
285
+ case A_TypeGuards.isString(param1):
286
+ return this.fromString;
287
+
288
+ case param1 instanceof Error:
289
+ return this.fromError;
290
+
291
+
292
+ case A_TypeGuards.isConstructorType<_ConstructorType>(param1):
293
+ return this.fromConstructor;
294
+
295
+ default: {
296
+ console.log('INVALID PARAMS PROVIDED TO A_ERROR CONSTRUCTOR: ', param1);
297
+
298
+ throw new A_Error(
299
+ A_CONSTANTS__ERROR_CODES.VALIDATION_ERROR,
300
+ 'Invalid parameters provided to A_Error constructor'
301
+ );
302
+ }
303
+ }
304
+ }
305
+
306
+ /**
307
+ * Initializes the A_Error instance from a standard Error object.
308
+ *
309
+ * @param error
310
+ */
311
+ protected fromError(error: Error): void {
312
+ this._code = A_CONSTANTS__ERROR_CODES.UNEXPECTED_ERROR;
313
+
314
+ this._aseid = new ASEID({
315
+ concept: (this.constructor as typeof A_Error).concept,
316
+ scope: (this.constructor as typeof A_Error).scope,
317
+ entity: (this.constructor as typeof A_Error).entity,
318
+ id: this.code
319
+ });
320
+
321
+ this._description = 'If you see this error please let us know.';
322
+ this._originalError = error;
323
+ }
324
+ /**
325
+ * Initializes the A_Error instance from a string message and optional description.
326
+ *
327
+ * @param message
328
+ * @param description
329
+ */
330
+ protected fromString(message: string, description?: string ): void {
331
+ this._code = A_FormatterHelper.toKebabCase(message);
332
+ this._scope = A_TypeGuards.isScopeInstance(description) ? description.name : undefined;
333
+
334
+
335
+ this._aseid = new ASEID({
336
+ concept: (this.constructor as typeof A_Error).concept,
337
+ scope: this._scope || (this.constructor as typeof A_Error).scope,
338
+ entity: (this.constructor as typeof A_Error).entity,
339
+ id: this.code
340
+ });
341
+
342
+ this._description = A_TypeGuards.isString(description) ? description : undefined;
343
+
344
+ this._link = undefined;
345
+ this._originalError = undefined;
346
+ }
347
+ /**
348
+ * Initializes the A_Error instance from a constructor parameters object.
349
+ *
350
+ * @param params
351
+ */
352
+ protected fromConstructor(params: _ConstructorType): void {
353
+ this._code = params.code;
354
+ this._scope = params.scope ? (A_TypeGuards.isScopeInstance(params.scope) ? params.scope.name : params.scope) : undefined;
355
+
356
+ this._aseid = new ASEID({
357
+ concept: (this.constructor as typeof A_Error).concept,
358
+ scope: this._scope || (this.constructor as typeof A_Error).scope,
359
+ entity: (this.constructor as typeof A_Error).entity,
360
+ id: this.code
361
+ });
362
+
363
+ this._description = params.description;
364
+ this._link = params.link;
365
+ this._originalError = params.originalError;
366
+ }
367
+
368
+ /**
369
+ * Serializes the A_Error instance to a plain object.
370
+ *
371
+ *
372
+ * @returns
373
+ */
374
+ toJSON(): _SerializedType {
375
+ return {
376
+ aseid: this.aseid.toString(),
377
+ code: this.code,
378
+ type: this.type,
379
+ message: this.message,
380
+ link: this.link,
381
+ scope: this.scope,
382
+ description: this.description,
383
+ originalError: this.originalError?.message
384
+ } as _SerializedType;
385
+ }
386
+
387
+
388
+
389
+ // --------------------------------------------------------------------------
390
+ // ----------------------- PROTECTED HELPERS --------------------------------
391
+ // --------------------------------------------------------------------------
392
+ /**
393
+ * Checks if the provided message exceeds 60 characters.
394
+ * If it does, throws a validation A_Error.
395
+ *
396
+ * @param message
397
+ */
398
+ protected validateMessage(message: string) {
399
+ if (message.length > 60) {
400
+ throw new A_Error(A_CONSTANTS__ERROR_CODES.VALIDATION_ERROR, 'A-Error message exceeds 60 characters limit.');
401
+ }
402
+ if (message.length === 0) {
403
+ throw new A_Error(A_CONSTANTS__ERROR_CODES.VALIDATION_ERROR, 'A-Error message cannot be empty.');
404
+ }
405
+ }
406
+
407
+
408
+ }
@@ -0,0 +1,11 @@
1
+
2
+
3
+
4
+ export const A_CONSTANTS__ERROR_CODES = {
5
+ UNEXPECTED_ERROR: 'A-Error Unexpected Error',
6
+ VALIDATION_ERROR: 'A-Error Validation Error',
7
+ } as const;
8
+
9
+
10
+
11
+ export const A_CONSTANTS__ERROR_DESCRIPTION = 'If you see this error please let us know.'
@@ -0,0 +1,96 @@
1
+ import { A_Scope } from "../A-Scope/A-Scope.class";
2
+ import { A_Error } from "./A_Error.class";
3
+
4
+
5
+ // ============================================================================
6
+ // --------------------------- Primary Types ----------------------------------
7
+ // ============================================================================
8
+ /**
9
+ * Entity constructor type
10
+ * Uses the generic type T to specify the type of the entity
11
+ */
12
+ export type A_TYPES__Error_Constructor<T = A_Error> = new (...args: any[]) => T;
13
+ /**
14
+ * Error initialization type
15
+ */
16
+ export type A_TYPES__Error_Init = {
17
+ /**
18
+ * Error message
19
+ *
20
+ * A short description of the error
21
+ */
22
+ message: string;
23
+
24
+
25
+ /**
26
+ * Error code representing the type of error
27
+ *
28
+ * Should be unique within the application or service
29
+ *
30
+ * Example: 'validation-error', 'not-found', 'user-not-found', 'unauthorized' etc.
31
+ *
32
+ * [!] Note: It is recommended to use kebab-case for error codes
33
+ * [!] Note: If not provided would be used a kebab-case message of the error
34
+ */
35
+ code?: string;
36
+ /**
37
+ * Possible Scope if needed to identify the error by it's execution environment
38
+ *
39
+ * For example, error of type 'validation' could happen in different scopes
40
+ * like 'user', 'admin', 'system' etc. This will help to identify the error context better
41
+ *
42
+ * Could be string or A_Scope instance
43
+ *
44
+ * [!] Note: If not provided, the default scope of the A_Error will be used (A_Context.root.name)
45
+ */
46
+ scope?: string | A_Scope
47
+ /**
48
+ * Detailed description of the error
49
+ */
50
+ description?: string,
51
+ /**
52
+ * Link to the documentation or support page for the error
53
+ */
54
+ link?: string,
55
+ /**
56
+ * Original Error if any
57
+ */
58
+ originalError?: Error | unknown
59
+ }
60
+ /**
61
+ * Error serialized type
62
+ */
63
+ export type A_TYPES__Error_Serialized = {
64
+ /**
65
+ * ASEID of the error
66
+ */
67
+ aseid: string,
68
+ /**
69
+ * Error message
70
+ */
71
+ message: string,
72
+ /**
73
+ * Type of the error
74
+ */
75
+ type: string,
76
+ /**
77
+ * Error code
78
+ */
79
+ code: string,
80
+ /**
81
+ * Error description
82
+ */
83
+ description: string,
84
+ /**
85
+ * Link to documentation or support page
86
+ */
87
+ link?: string,
88
+ /**
89
+ * Scope of the error
90
+ */
91
+ scope: string,
92
+ /**
93
+ * Original error message if any
94
+ */
95
+ originalError?: string
96
+ };
@@ -1,22 +1,19 @@
1
1
  import {
2
- A_TYPES__A_DefineDecorator_Meta,
3
- A_TYPES__A_FeatureDecoratorConfig,
4
- A_TYPES__A_FeatureDecoratorDescriptor,
5
- } from "./A-Feature.decorator.types";
6
- import { A_Entity } from "@adaas/a-concept/global/A-Entity/A-Entity.class";
2
+ A_TYPES__FeatureDefineDecoratorConfig,
3
+ A_TYPES__FeatureDefineDecoratorDescriptor,
4
+ A_TYPES__FeatureDefineDecoratorMeta,
5
+ A_TYPES__FeatureDefineDecoratorTarget
6
+ } from "./A-Feature.types";
7
7
  import { A_Context } from "@adaas/a-concept/global/A-Context/A-Context.class";
8
- import { A_Component } from "@adaas/a-concept/global/A-Component/A-Component.class";
9
- import { A_Container } from "@adaas/a-concept/global/A-Container/A-Container.class";
10
- import { A_TYPES__ContainerMetaKey } from "@adaas/a-concept/global/A-Container/A-Container.types";
11
8
  import { A_EntityMeta } from "@adaas/a-concept/global/A-Entity/A-Entity.meta";
12
9
  import { A_ContainerMeta } from "@adaas/a-concept/global/A-Container/A-Container.meta";
13
10
  import { A_ComponentMeta } from "@adaas/a-concept/global/A-Component/A-Component.meta";
14
- import { A_TYPES__EntityMetaKey } from "@adaas/a-concept/global/A-Entity/A-Entity.types";
15
- import { A_TYPES__ComponentMetaKey } from "@adaas/a-concept/global/A-Component/A-Component.types";
16
11
  import { A_Meta } from "@adaas/a-concept/global/A-Meta/A-Meta.class";
17
- import { A_Command } from "@adaas/a-concept/global/A-Command/A-Command.class";
18
- import { A_TYPES__CommandMetaKey } from "@adaas/a-concept/global/A-Command/A-Command.types";
19
- import { A_CommandMeta } from "@adaas/a-concept/global/A-Command/A-Command.meta";
12
+ import { A_TYPES__EntityMetaKey } from "@adaas/a-concept/global/A-Entity/A-Entity.constants";
13
+ import { A_TYPES__ContainerMetaKey } from "@adaas/a-concept/global/A-Container/A-Container.constants";
14
+ import { A_TYPES__ComponentMetaKey } from "@adaas/a-concept/global/A-Component/A-Component.constants";
15
+ import { A_TypeGuards } from "@adaas/a-concept/helpers/A_TypeGuards.helper";
16
+ import { A_FeatureError } from "./A-Feature.error";
20
17
 
21
18
  /**
22
19
  * A-Feature decorator
@@ -32,36 +29,37 @@ import { A_CommandMeta } from "@adaas/a-concept/global/A-Command/A-Command.meta"
32
29
  * @returns
33
30
  */
34
31
  export function A_Feature_Define(
35
- config: Partial<A_TYPES__A_FeatureDecoratorConfig> = {}
32
+ config: Partial<A_TYPES__FeatureDefineDecoratorConfig> = {}
36
33
  ) {
37
34
  return function (
38
- target: A_Container | A_Entity | A_Component | A_Command,
35
+ target: A_TYPES__FeatureDefineDecoratorTarget,
39
36
  propertyKey: string,
40
- descriptor: A_TYPES__A_FeatureDecoratorDescriptor
37
+ descriptor: A_TYPES__FeatureDefineDecoratorDescriptor
41
38
  ) {
39
+ // for error messages
40
+ const componentName = (target as any)?.constructor?.name || String(target) || 'Unknown';
42
41
 
43
- const meta: A_EntityMeta | A_ContainerMeta | A_ComponentMeta | A_CommandMeta = A_Context.meta(target.constructor as any);
44
42
 
45
- let metaKey;
43
+ if (!A_TypeGuards.isAllowedForFeatureDefinition(target))
44
+ throw new A_FeatureError(
45
+ A_FeatureError.FeatureDefinitionError,
46
+ `A-Feature cannot be defined on the ${componentName} level`
47
+ );
46
48
 
49
+ const meta: A_EntityMeta | A_ContainerMeta | A_ComponentMeta = A_Context.meta(target.constructor as any);
50
+
51
+ let metaKey;
47
52
 
48
53
  switch (true) {
49
- case target instanceof A_Entity:
54
+ case A_TypeGuards.isEntityInstance(target):
50
55
  metaKey = A_TYPES__EntityMetaKey.FEATURES;
51
56
  break;
52
- case target instanceof A_Container:
57
+ case A_TypeGuards.isContainerInstance(target):
53
58
  metaKey = A_TYPES__ContainerMetaKey.FEATURES
54
59
  break;
55
- case target instanceof A_Component:
60
+ case A_TypeGuards.isComponentInstance(target):
56
61
  metaKey = A_TYPES__ComponentMetaKey.FEATURES
57
62
  break;
58
- case target instanceof A_Command:
59
- metaKey = A_TYPES__CommandMetaKey.FEATURES
60
- break;
61
- default: {
62
- console.log(target);
63
- throw new Error(`A-Feature cannot be defined on the ${(target as any).constructor.name} level`);
64
- }
65
63
  }
66
64
 
67
65
 
@@ -72,19 +70,18 @@ export function A_Feature_Define(
72
70
  *
73
71
  * Where value is the list of features
74
72
  */
75
- [Key: string]: A_TYPES__A_DefineDecorator_Meta
73
+ [Key: string]: A_TYPES__FeatureDefineDecoratorMeta
76
74
  }> = meta.get(metaKey) || new A_Meta();
77
75
 
78
76
 
79
-
80
- const handlerName = config.name || propertyKey;
77
+ const name = config.name || propertyKey;
81
78
  // default to false
82
79
  const invoke = config.invoke || false;
83
80
 
84
81
 
85
82
  // Set the metadata of the method to define a custom Feature with name
86
83
  existedMeta.set(propertyKey, {
87
- name: `${target.constructor.name}.${handlerName}`,
84
+ name: `${target.constructor.name}.${name}`,
88
85
  handler: propertyKey,
89
86
  invoke: invoke,
90
87
  template: config.template && config.template.length ? config.template.map(
@@ -95,7 +92,6 @@ export function A_Feature_Define(
95
92
  behavior: item.behavior || 'sync',
96
93
  })
97
94
  ) : [],
98
- channel: config.channel || []
99
95
  });
100
96
 
101
97
  // Update the metadata of the container with the new Feature definition
@@ -106,10 +102,8 @@ export function A_Feature_Define(
106
102
  existedMeta
107
103
  );
108
104
 
109
-
110
105
  const originalMethod = descriptor.value!;
111
106
 
112
-
113
107
  // Wrap the original method to add the call to `call`
114
108
  // this helps to automatically call the container/entity/component method when it's called
115
109
  descriptor.value = function (...args: any[]) {
@@ -121,8 +115,8 @@ export function A_Feature_Define(
121
115
  originalMethod.apply(this, args);
122
116
 
123
117
  // Call your `call` with the function name
124
- if (typeof (this as any).call === "function" && invoke)
125
- return (this as any).call(handlerName);
118
+ if (typeof (this as A_TYPES__FeatureDefineDecoratorTarget).call === "function" && invoke)
119
+ return (this as A_TYPES__FeatureDefineDecoratorTarget).call(name);
126
120
 
127
121
  };
128
122