@adaas/a-concept 0.0.2 → 0.0.4

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 (303) hide show
  1. package/dist/examples/simple/components/A.component.d.ts +7 -0
  2. package/dist/examples/simple/components/A.component.js +57 -0
  3. package/dist/examples/simple/components/A.component.js.map +1 -0
  4. package/dist/examples/simple/components/B.component.d.ts +9 -0
  5. package/dist/examples/simple/components/B.component.js +77 -0
  6. package/dist/examples/simple/components/B.component.js.map +1 -0
  7. package/dist/examples/simple/concept.d.ts +1 -0
  8. package/dist/examples/simple/concept.js +53 -11
  9. package/dist/examples/simple/concept.js.map +1 -1
  10. package/dist/examples/simple/containers/Main.container.d.ts +11 -0
  11. package/dist/examples/simple/containers/Main.container.js +64 -0
  12. package/dist/examples/simple/containers/Main.container.js.map +1 -0
  13. package/dist/examples/simple/context/Fragment_A.context.d.ts +6 -0
  14. package/dist/examples/simple/context/Fragment_A.context.js +16 -0
  15. package/dist/examples/simple/context/Fragment_A.context.js.map +1 -0
  16. package/dist/examples/simple/context/Fragment_B.context.d.ts +6 -0
  17. package/dist/examples/simple/context/Fragment_B.context.js +16 -0
  18. package/dist/examples/simple/context/Fragment_B.context.js.map +1 -0
  19. package/dist/examples/simple-http-server/components/http-error-handler.component.d.ts +9 -0
  20. package/dist/examples/simple-http-server/components/http-error-handler.component.js +63 -0
  21. package/dist/examples/simple-http-server/components/http-error-handler.component.js.map +1 -0
  22. package/dist/examples/simple-http-server/components/http-request-handler.component.d.ts +2 -0
  23. package/dist/examples/simple-http-server/components/http-request-handler.component.js +7 -0
  24. package/dist/examples/simple-http-server/components/http-request-handler.component.js.map +1 -0
  25. package/dist/examples/simple-http-server/concept.js +21 -22
  26. package/dist/examples/simple-http-server/concept.js.map +1 -1
  27. package/dist/examples/simple-http-server/containers/http-server.container.d.ts +8 -8
  28. package/dist/examples/simple-http-server/containers/http-server.container.js +34 -30
  29. package/dist/examples/simple-http-server/containers/http-server.container.js.map +1 -1
  30. package/dist/examples/simple-http-server/containers/http-server.controller.js +1 -1
  31. package/dist/examples/simple-http-server/containers/http-server.router.js +2 -2
  32. package/dist/examples/simple-http-server/containers/http-server.router.js.map +1 -1
  33. package/dist/examples/simple-http-server/contexts/http-request.context.d.ts +13 -0
  34. package/dist/examples/simple-http-server/contexts/http-request.context.js +51 -0
  35. package/dist/examples/simple-http-server/contexts/http-request.context.js.map +1 -0
  36. package/dist/examples/simple-http-server/contexts/http-server.context.types.d.ts +0 -4
  37. package/dist/examples/simple-http-server/contexts/http-server.context.types.js +0 -98
  38. package/dist/examples/simple-http-server/contexts/http-server.context.types.js.map +1 -1
  39. package/dist/examples/simple-http-server/contexts/http-server.namespace.d.ts +1 -1
  40. package/dist/examples/simple-http-server/contexts/http-server.namespace.js +1 -1
  41. package/dist/examples/simple-http-server/controllers/users.controller.js +2 -2
  42. package/dist/examples/simple-http-server/test.d.ts +68 -0
  43. package/dist/examples/simple-http-server/test.js +162 -0
  44. package/dist/examples/simple-http-server/test.js.map +1 -0
  45. package/dist/index.d.ts +25 -7
  46. package/dist/index.js +55 -13
  47. package/dist/index.js.map +1 -1
  48. package/dist/src/base/A-Config/A-Config.container.d.ts +8 -0
  49. package/dist/src/base/A-Config/A-Config.container.js +64 -0
  50. package/dist/src/base/A-Config/A-Config.container.js.map +1 -0
  51. package/dist/src/base/A-Config/A-Config.context.d.ts +30 -0
  52. package/dist/src/base/A-Config/A-Config.context.js +58 -0
  53. package/dist/src/base/A-Config/A-Config.context.js.map +1 -0
  54. package/dist/src/base/A-Config/A-Config.types.d.ts +14 -0
  55. package/dist/src/base/A-Config/A-Config.types.js +3 -0
  56. package/dist/src/base/A-Config/A-Config.types.js.map +1 -0
  57. package/dist/src/base/A-Config/components/ConfigReader.component.d.ts +19 -0
  58. package/dist/src/base/A-Config/components/ConfigReader.component.js +53 -0
  59. package/dist/src/base/A-Config/components/ConfigReader.component.js.map +1 -0
  60. package/dist/src/base/A-Config/components/ENVConfigReader.component.d.ts +10 -0
  61. package/dist/src/base/A-Config/components/ENVConfigReader.component.js +37 -0
  62. package/dist/src/base/A-Config/components/ENVConfigReader.component.js.map +1 -0
  63. package/dist/src/base/A-Config/components/FileConfigReader.component.d.ts +11 -0
  64. package/dist/src/base/A-Config/components/FileConfigReader.component.js +47 -0
  65. package/dist/src/base/A-Config/components/FileConfigReader.component.js.map +1 -0
  66. package/dist/src/base/A-Errors/A-Errors.component.d.ts +18 -0
  67. package/dist/src/base/A-Errors/A-Errors.component.js +85 -0
  68. package/dist/src/base/A-Errors/A-Errors.component.js.map +1 -0
  69. package/dist/src/base/A-Errors/A-Errors.context.d.ts +27 -0
  70. package/dist/src/base/A-Errors/A-Errors.context.js +50 -0
  71. package/dist/src/base/A-Errors/A-Errors.context.js.map +1 -0
  72. package/dist/src/base/A-Errors/A-Errors.types.d.ts +5 -0
  73. package/dist/src/base/A-Errors/A-Errors.types.js +3 -0
  74. package/dist/src/base/A-Errors/A-Errors.types.js.map +1 -0
  75. package/dist/src/base/A-Logger/A-Logger.component.d.ts +28 -0
  76. package/dist/src/base/A-Logger/A-Logger.component.js +142 -0
  77. package/dist/src/base/A-Logger/A-Logger.component.js.map +1 -0
  78. package/dist/src/base/A-Logger/A-Logger.types.js +2 -0
  79. package/dist/src/base/A-Logger/A-Logger.types.js.map +1 -0
  80. package/dist/src/constants/A_ConceptLifecycle.constants.d.ts +0 -2
  81. package/dist/src/constants/A_ConceptLifecycle.constants.js +9 -10
  82. package/dist/src/constants/A_ConceptLifecycle.constants.js.map +1 -1
  83. package/dist/src/containers/A-Config/A-Config.container.js +1 -1
  84. package/dist/src/containers/A-Config/A-Config.namespace.d.ts +1 -1
  85. package/dist/src/containers/A-Config/A-Config.namespace.js +1 -1
  86. package/dist/src/containers/A-Config/A-Config.types.d.ts +1 -1
  87. package/dist/src/containers/A-Errors/A-Errors.container.js +1 -1
  88. package/dist/src/containers/A-Errors/A-Errors.namespace.d.ts +1 -1
  89. package/dist/src/containers/A-Errors/A-Errors.namespace.js +1 -1
  90. package/dist/src/containers/A-Errors/A-Errors.types.d.ts +1 -1
  91. package/dist/src/containers/A-Logger/A-Logger.container.js +1 -1
  92. package/dist/src/containers/A-Logger/A-Logger.namespace.d.ts +1 -1
  93. package/dist/src/containers/A-Logger/A-Logger.namespace.js +1 -1
  94. package/dist/src/containers/A-Logger/components/Logger.component.d.ts +1 -1
  95. package/dist/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.js.map +1 -1
  96. package/dist/src/decorators/A-Define/Feature/Feature.decorator.d.ts +16 -0
  97. package/dist/src/decorators/A-Define/Feature/Feature.decorator.js +36 -0
  98. package/dist/src/decorators/A-Define/Feature/Feature.decorator.js.map +1 -0
  99. package/dist/src/decorators/A-Define/Feature/Feature.decorator.types.d.ts +8 -0
  100. package/dist/src/decorators/A-Define/Feature/Feature.decorator.types.js +3 -0
  101. package/dist/src/decorators/A-Define/Feature/Feature.decorator.types.js.map +1 -0
  102. package/dist/src/decorators/A-Define/Lifecycle/Lifecycle.decorator.d.ts +14 -0
  103. package/dist/src/decorators/A-Define/Lifecycle/Lifecycle.decorator.js +24 -0
  104. package/dist/src/decorators/A-Define/Lifecycle/Lifecycle.decorator.js.map +1 -0
  105. package/dist/src/decorators/A-Define/Lifecycle/Lifecycle.decorator.types.d.ts +8 -0
  106. package/dist/src/decorators/A-Define/Lifecycle/Lifecycle.decorator.types.js +3 -0
  107. package/dist/src/decorators/A-Define/Lifecycle/Lifecycle.decorator.types.js.map +1 -0
  108. package/dist/src/decorators/A-Define/index.d.ts +7 -0
  109. package/dist/src/decorators/A-Define/index.js +10 -0
  110. package/dist/src/decorators/A-Define/index.js.map +1 -0
  111. package/dist/src/decorators/A-Extend/A-Extend.decorator.d.ts +18 -0
  112. package/dist/src/decorators/A-Extend/A-Extend.decorator.js +37 -0
  113. package/dist/src/decorators/A-Extend/A-Extend.decorator.js.map +1 -0
  114. package/dist/src/decorators/A-Extend/A-Extend.decorator.types.d.ts +21 -0
  115. package/dist/src/decorators/A-Extend/A-Extend.decorator.types.js +3 -0
  116. package/dist/src/decorators/A-Extend/A-Extend.decorator.types.js.map +1 -0
  117. package/dist/src/decorators/A-Feature/A-Feature-Define.decorator.d.ts +16 -0
  118. package/dist/src/decorators/A-Feature/A-Feature-Define.decorator.js +37 -0
  119. package/dist/src/decorators/A-Feature/A-Feature-Define.decorator.js.map +1 -0
  120. package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.d.ts +16 -0
  121. package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.js +42 -0
  122. package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.js.map +1 -0
  123. package/dist/src/decorators/A-Feature/A-Feature.decorator.types.d.ts +20 -0
  124. package/dist/src/decorators/A-Feature/A-Feature.decorator.types.js +1 -0
  125. package/dist/src/decorators/A-Inject/A-Inject.decorator.d.ts +12 -10
  126. package/dist/src/decorators/A-Inject/A-Inject.decorator.js +16 -26
  127. package/dist/src/decorators/A-Inject/A-Inject.decorator.js.map +1 -1
  128. package/dist/src/decorators/A-Inject/A-Inject.decorator.types.d.ts +4 -3
  129. package/dist/src/decorators/A-Stage/A-Stage.decorator.d.ts +12 -0
  130. package/dist/src/decorators/A-Stage/A-Stage.decorator.js +35 -0
  131. package/dist/src/decorators/A-Stage/A-Stage.decorator.js.map +1 -0
  132. package/dist/src/decorators/A-Stage/A-Stage.decorator.types.d.ts +2 -0
  133. package/dist/src/decorators/A-Stage/A-Stage.decorator.types.js +3 -0
  134. package/dist/src/decorators/A-Stage/A-Stage.decorator.types.js.map +1 -0
  135. package/dist/src/global/A-Channel/A-Channel.class.d.ts +18 -0
  136. package/dist/src/global/A-Channel/A-Channel.class.js +54 -0
  137. package/dist/src/global/A-Channel/A-Channel.class.js.map +1 -0
  138. package/dist/src/global/A-Channel/A-Channel.types.d.ts +35 -0
  139. package/dist/src/global/A-Channel/A-Channel.types.js +3 -0
  140. package/dist/src/global/A-Channel/A-Channel.types.js.map +1 -0
  141. package/dist/src/global/A-Component/A-Component.class.d.ts +1 -11
  142. package/dist/src/global/A-Component/A-Component.class.js +0 -7
  143. package/dist/src/global/A-Component/A-Component.class.js.map +1 -1
  144. package/dist/src/global/A-Component/A-Component.meta.d.ts +4 -0
  145. package/dist/src/global/A-Component/A-Component.meta.js +8 -0
  146. package/dist/src/global/A-Component/A-Component.meta.js.map +1 -0
  147. package/dist/src/global/A-Component/A-Component.types.d.ts +18 -0
  148. package/dist/src/global/A-Component/A-Component.types.js +10 -0
  149. package/dist/src/global/A-Component/A-Component.types.js.map +1 -0
  150. package/dist/src/global/A-Concept/A_Concept.class.d.ts +41 -17
  151. package/dist/src/global/A-Concept/A_Concept.class.js +120 -43
  152. package/dist/src/global/A-Concept/A_Concept.class.js.map +1 -1
  153. package/dist/src/global/A-Concept/A_Concept.meta.d.ts +3 -0
  154. package/dist/src/global/A-Concept/A_Concept.meta.js +9 -0
  155. package/dist/src/global/A-Concept/A_Concept.meta.js.map +1 -0
  156. package/dist/src/global/A-Concept/A_Concept.types.d.ts +31 -16
  157. package/dist/src/global/A-Concept/A_Concept.types.js +25 -0
  158. package/dist/src/global/A-Concept/A_Concept.types.js.map +1 -1
  159. package/dist/src/global/A-Container/A-Container.class.d.ts +72 -10
  160. package/dist/src/global/A-Container/A-Container.class.js +119 -9
  161. package/dist/src/global/A-Container/A-Container.class.js.map +1 -1
  162. package/dist/src/global/A-Container/A-Container.meta.d.ts +7 -0
  163. package/dist/src/global/A-Container/A-Container.meta.js +54 -0
  164. package/dist/src/global/A-Container/A-Container.meta.js.map +1 -0
  165. package/dist/src/global/A-Container/A-Container.types.d.ts +31 -0
  166. package/dist/src/global/A-Container/A-Container.types.js +9 -0
  167. package/dist/src/global/A-Container/A-Container.types.js.map +1 -0
  168. package/dist/src/global/A-Context/A-Context.class.d.ts +36 -54
  169. package/dist/src/global/A-Context/A-Context.class.js +127 -61
  170. package/dist/src/global/A-Context/A-Context.class.js.map +1 -1
  171. package/dist/src/global/A-Context/A-Context.types.d.ts +12 -0
  172. package/dist/src/global/A-Context/A-Context.types.js +1 -0
  173. package/dist/src/global/A-Context/A-ContextFragment.class.d.ts +12 -0
  174. package/dist/src/global/A-Context/A-ContextFragment.class.js +19 -0
  175. package/dist/src/global/A-Context/A-ContextFragment.class.js.map +1 -0
  176. package/dist/src/global/A-Dependency/A-DependencyReference.types.d.ts +0 -55
  177. package/dist/src/global/A-Dependency/A-DependencyReference.types.js +56 -1
  178. package/dist/src/global/A-Dependency/A-DependencyReference.types.js.map +1 -1
  179. package/dist/src/global/A-Entity/A-Entity.class.d.ts +10 -0
  180. package/dist/src/global/A-Entity/A-Entity.class.js +16 -0
  181. package/dist/src/global/A-Entity/A-Entity.class.js.map +1 -0
  182. package/dist/src/global/A-Entity/A-Entity.types.js +2 -0
  183. package/dist/src/global/A-Entity/A-Entity.types.js.map +1 -0
  184. package/dist/src/global/A-Feature/A-Feature.class.d.ts +44 -0
  185. package/dist/src/global/A-Feature/A-Feature.class.js +125 -0
  186. package/dist/src/global/A-Feature/A-Feature.class.js.map +1 -0
  187. package/dist/src/global/A-Feature/A-Feature.types.d.ts +17 -0
  188. package/dist/src/global/A-Feature/A-Feature.types.js +11 -0
  189. package/dist/src/global/A-Feature/A-Feature.types.js.map +1 -0
  190. package/dist/src/global/A-Fragment/A-Fragment.class.d.ts +38 -0
  191. package/dist/src/global/A-Fragment/A-Fragment.class.js +107 -0
  192. package/dist/src/global/A-Fragment/A-Fragment.class.js.map +1 -0
  193. package/dist/src/global/A-Fragment/A-Fragment.types.d.ts +3 -0
  194. package/dist/src/global/A-Fragment/A-Fragment.types.js +3 -0
  195. package/dist/src/global/A-Fragment/A-Fragment.types.js.map +1 -0
  196. package/dist/src/global/A-Meta/A-Meta.class.d.ts +11 -0
  197. package/dist/src/global/A-Meta/A-Meta.class.js +43 -0
  198. package/dist/src/global/A-Meta/A-Meta.class.js.map +1 -0
  199. package/dist/src/global/A-Meta/A-Meta.types.d.ts +0 -0
  200. package/dist/src/global/A-Meta/A-Meta.types.js +2 -0
  201. package/dist/src/global/A-Meta/A-Meta.types.js.map +1 -0
  202. package/dist/src/global/A-Scope/A-Scope.class.d.ts +51 -0
  203. package/dist/src/global/A-Scope/A-Scope.class.js +133 -0
  204. package/dist/src/global/A-Scope/A-Scope.class.js.map +1 -0
  205. package/dist/src/global/A-Scope/A-Scope.types.d.ts +32 -0
  206. package/dist/src/global/A-Scope/A-Scope.types.js +3 -0
  207. package/dist/src/global/A-Scope/A-Scope.types.js.map +1 -0
  208. package/dist/src/storage/A_Component.storage.d.ts +10 -0
  209. package/dist/src/storage/A_Component.storage.js +17 -0
  210. package/dist/src/storage/A_Component.storage.js.map +1 -0
  211. package/dist/src/storage/A_Concept.storage.js +2 -2
  212. package/dist/src/storage/A_Concept.storage.js.map +1 -1
  213. package/dist/src/storage/A_Container.storage.d.ts +8 -0
  214. package/dist/src/storage/A_Container.storage.js +17 -0
  215. package/dist/src/storage/A_Container.storage.js.map +1 -0
  216. package/dist/src/storage/A_Inject.storage.d.ts +9 -0
  217. package/dist/src/storage/A_Inject.storage.js +13 -0
  218. package/dist/src/storage/A_Inject.storage.js.map +1 -0
  219. package/examples/simple/components/A.component.ts +35 -0
  220. package/examples/simple/components/B.component.ts +46 -0
  221. package/examples/simple/concept.ts +49 -12
  222. package/examples/simple/containers/Main.container.ts +41 -0
  223. package/examples/simple/context/Fragment_A.context.ts +25 -0
  224. package/examples/simple/context/Fragment_B.context.ts +19 -0
  225. package/examples/simple-http-server/components/http-error-handler.component.ts +44 -0
  226. package/examples/simple-http-server/components/http-request-handler.component.ts +9 -0
  227. package/examples/simple-http-server/concept.ts +22 -21
  228. package/examples/simple-http-server/containers/http-server.container.ts +23 -38
  229. package/examples/simple-http-server/contexts/http-request.context.ts +59 -0
  230. package/examples/simple-http-server/contexts/http-server.context.types.ts +0 -108
  231. package/examples/simple-http-server/test.ts +290 -0
  232. package/index.ts +55 -8
  233. package/jest.config.ts +2 -0
  234. package/package.json +4 -7
  235. package/src/{containers → base}/A-Config/A-Config.container.ts +21 -20
  236. package/src/{containers/A-Config/A-Config.namespace.ts → base/A-Config/A-Config.context.ts} +12 -5
  237. package/src/{containers → base}/A-Config/A-Config.types.ts +10 -4
  238. package/src/{containers → base}/A-Config/components/ConfigReader.component.ts +7 -3
  239. package/src/{containers → base}/A-Config/components/ENVConfigReader.component.ts +1 -1
  240. package/src/{containers → base}/A-Config/components/FileConfigReader.component.ts +1 -1
  241. package/src/base/A-Errors/A-Errors.component.ts +102 -0
  242. package/src/{containers/A-Errors/A-Errors.namespace.ts → base/A-Errors/A-Errors.context.ts} +24 -39
  243. package/src/{containers → base}/A-Errors/A-Errors.types.ts +2 -2
  244. package/src/base/A-Logger/A-Logger.component.ts +169 -0
  245. package/src/base/A-Logger/A-Logger.types.ts +0 -0
  246. package/src/constants/A_ConceptLifecycle.constants.ts +9 -9
  247. package/src/decorators/A-Feature/A-Feature-Define.decorator.ts +57 -0
  248. package/src/decorators/A-Feature/A-Feature-Extend.decorator.ts +57 -0
  249. package/src/decorators/A-Feature/A-Feature.decorator.types.ts +56 -0
  250. package/src/decorators/A-Inject/A-Inject.decorator.ts +65 -53
  251. package/src/decorators/A-Inject/A-Inject.decorator.types.ts +31 -4
  252. package/src/decorators/A-Stage/A-Stage.decorator.ts +57 -0
  253. package/src/decorators/A-Stage/A-Stage.decorator.types.ts +23 -0
  254. package/src/global/A-Channel/A-Channel.class.ts +48 -0
  255. package/src/global/A-Channel/A-Channel.types.ts +60 -0
  256. package/src/global/A-Component/A-Component.class.ts +1 -29
  257. package/src/global/A-Component/A-Component.meta.ts +9 -0
  258. package/src/global/A-Component/A-Component.types.ts +40 -0
  259. package/src/global/A-Concept/A_Concept.class.ts +160 -66
  260. package/src/global/A-Concept/A_Concept.meta.ts +9 -0
  261. package/src/global/A-Concept/A_Concept.types.ts +45 -10
  262. package/src/global/A-Container/A-Container.class.ts +177 -22
  263. package/src/global/A-Container/A-Container.meta.ts +80 -0
  264. package/src/global/A-Container/A-Container.types.ts +40 -0
  265. package/src/global/A-Context/A-Context.class.ts +231 -130
  266. package/src/global/A-Context/A-Context.types.ts +15 -0
  267. package/src/global/A-Dependency/A-DependencyReference.types.ts +56 -56
  268. package/src/global/A-Entity/A-Entity.class.ts +16 -0
  269. package/src/global/A-Entity/A-Entity.types.ts +0 -0
  270. package/src/global/A-Feature/A-Feature.class.ts +156 -0
  271. package/src/global/A-Feature/A-Feature.types.ts +20 -0
  272. package/src/global/{A-Namespace/A_Namespace.class.ts → A-Fragment/A-Fragment.class.ts} +24 -30
  273. package/src/global/A-Fragment/A-Fragment.types.ts +6 -0
  274. package/src/global/A-Meta/A-Meta.class.ts +60 -0
  275. package/src/global/A-Meta/A-Meta.types.ts +0 -0
  276. package/src/global/A-Scope/A-Scope.class.ts +208 -0
  277. package/src/global/A-Scope/A-Scope.types.ts +37 -0
  278. package/src/storage/A_Component.storage.ts +28 -0
  279. package/src/storage/A_Concept.storage.ts +5 -1
  280. package/src/storage/A_Container.storage.ts +21 -0
  281. package/src/storage/A_Inject.storage.ts +30 -0
  282. package/tsconfig.json +3 -1
  283. package/examples/sdk/concept.ts +0 -24
  284. package/examples/sdk/orders.api.ts +0 -21
  285. package/examples/sdk/users.api.ts +0 -21
  286. package/examples/simple-http-server/containers/http-server.controller.ts +0 -24
  287. package/examples/simple-http-server/containers/http-server.router.ts +0 -23
  288. package/examples/simple-http-server/contexts/http-server.namespace.ts +0 -36
  289. package/src/containers/A-Errors/A-Errors.container.ts +0 -14
  290. package/src/containers/A-Logger/A-Logger.container.ts +0 -22
  291. package/src/containers/A-Logger/A-Logger.namespace.ts +0 -26
  292. package/src/containers/A-Logger/components/Logger.component.ts +0 -169
  293. package/src/decorators/A-ConceptLifecycle/A-ConceptLifecycle.decorator.types.ts +0 -46
  294. package/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.ts +0 -55
  295. package/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.types.ts +0 -20
  296. package/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.ts +0 -62
  297. package/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.types.ts +0 -28
  298. package/src/decorators/A-ConceptLifecycle/index.ts +0 -9
  299. package/src/decorators/A-Feature/A-Feature.decorator.ts +0 -13
  300. package/src/decorators/A_Lazy.decorator.ts +0 -31
  301. package/src/global/A-Namespace/A_Namespace.types.ts +0 -24
  302. /package/{src/containers/A-Logger/A-Logger.types.ts → dist/src/base/A-Logger/A-Logger.types.d.ts} +0 -0
  303. /package/{src/decorators/A_ConceptMethods.decorator.ts → dist/src/global/A-Entity/A-Entity.types.d.ts} +0 -0
@@ -0,0 +1,156 @@
1
+ import { A_Feature_Define } from "@adaas/a-concept/decorators/A-Feature/A-Feature-Define.decorator";
2
+ import { A_Feature_Extend } from "@adaas/a-concept/decorators/A-Feature/A-Feature-Extend.decorator";
3
+ import { A_TYPES__FeatureConstructor, A_TYPES__FeatureState, A_TYPES__FeatureStep } from "./A-Feature.types";
4
+ import { A_Scope } from "../A-Scope/A-Scope.class";
5
+ import { A_Error, A_TYPES__Required } from "@adaas/a-utils";
6
+ import { A_Context } from "../A-Context/A-Context.class";
7
+
8
+
9
+
10
+ /**
11
+ * A_Feature is representing a feature that can be executed across multiple components
12
+ * This class stores the steps of the feature and executes them in order of appearance
13
+ *
14
+ * Using A_Feature.Define and A_Feature.Extend decorators to define and extend the feature methods
15
+ * across the different, distributed components
16
+ *
17
+ */
18
+ export class A_Feature {
19
+
20
+
21
+ /**
22
+ * Define a new A-Feature
23
+ */
24
+ static get Define() {
25
+ return A_Feature_Define;
26
+ }
27
+
28
+
29
+ /**
30
+ * Extend an existing A-Feature
31
+ */
32
+ static get Extend() {
33
+ return A_Feature_Extend;
34
+ }
35
+
36
+
37
+
38
+
39
+ // protected scope: A_Scope
40
+ protected steps: A_TYPES__FeatureStep[] = []
41
+
42
+ state: A_TYPES__FeatureState = A_TYPES__FeatureState.INITIALIZED;
43
+
44
+ result?: any
45
+ error?: A_Error
46
+
47
+ constructor(
48
+ params: A_TYPES__Required<Partial<A_TYPES__FeatureConstructor>, ['steps']>
49
+ ) {
50
+ // this.scope = params.scope;
51
+ this.steps = params.steps;
52
+
53
+ A_Context.allocate(this, params);
54
+
55
+ }
56
+
57
+
58
+ /**
59
+ * This method marks the feature as completed and returns the result
60
+ * Uses to interrupt or end the feature processing
61
+ *
62
+ * @param result
63
+ * @returns
64
+ */
65
+ async completed<T extends any>(
66
+ ...result: T[]
67
+ ): Promise<T> {
68
+
69
+ this.result = result;
70
+ this.state = A_TYPES__FeatureState.COMPLETED;
71
+
72
+ return this.result;
73
+ }
74
+
75
+
76
+ /**
77
+ * This method marks the feature as failed and throws an error
78
+ * Uses to interrupt or end the feature processing
79
+ *
80
+ * @param error
81
+ */
82
+ async failed(
83
+ error: Error | A_Error | unknown
84
+ ) {
85
+ this.error = error as A_Error;
86
+ this.state = A_TYPES__FeatureState.FAILED;
87
+
88
+ await this.errorHandler(error);
89
+ }
90
+
91
+
92
+
93
+ async process() {
94
+ try {
95
+ this.state = A_TYPES__FeatureState.PROCESSING;
96
+
97
+ for (const { component, handler, args } of this.steps) {
98
+
99
+ if (
100
+ (this.state as any) === A_TYPES__FeatureState.FAILED
101
+ ||
102
+ (this.state as any) === A_TYPES__FeatureState.COMPLETED
103
+ ) {
104
+ throw new Error('FEATURE_PROCESSING_INTERRUPTED');
105
+ }
106
+
107
+ const instance = A_Context.scope(this).resolve(component);
108
+
109
+ if (instance[handler]) {
110
+ const callArgs = A_Context.scope(this).resolve(args);
111
+ await instance[handler](...callArgs);
112
+ }
113
+ }
114
+
115
+ await this.completed();
116
+
117
+ } catch (error) {
118
+ console.log('Feature processing error:', error);
119
+
120
+ await this.failed(error);
121
+ }
122
+ }
123
+
124
+
125
+ protected async errorHandler(error: Error | A_Error | unknown) {
126
+ switch (true) {
127
+ case error instanceof A_Error:
128
+ throw error;
129
+
130
+
131
+ case error instanceof Error
132
+ && error.message === 'FEATURE_PROCESSING_INTERRUPTED'
133
+ && this.state === A_TYPES__FeatureState.FAILED:
134
+ throw new A_Error({
135
+ message: 'FEATURE_PROCESSING_INTERRUPTED',
136
+ code: 'FEATURE_PROCESSING_INTERRUPTED',
137
+ data: {
138
+ feature: this
139
+ }
140
+ });
141
+
142
+
143
+ case error instanceof Error
144
+ && error.message === 'FEATURE_PROCESSING_INTERRUPTED'
145
+ && this.state === A_TYPES__FeatureState.COMPLETED:
146
+
147
+ // Do nothing
148
+ break;
149
+
150
+ default:
151
+ throw error;
152
+ }
153
+ }
154
+
155
+
156
+ }
@@ -0,0 +1,20 @@
1
+ import { A_TYPES__ScopeConfig, A_TYPES__ScopeConstructor } from "../A-Scope/A-Scope.types"
2
+
3
+ export type A_TYPES__FeatureConstructor = {
4
+ steps: A_TYPES__FeatureStep[]
5
+ } & A_TYPES__ScopeConstructor & A_TYPES__ScopeConfig
6
+
7
+ export enum A_TYPES__FeatureState {
8
+ INITIALIZED = "INITIALIZED",
9
+ PROCESSING = "PROCESSING",
10
+
11
+ COMPLETED = "COMPLETED",
12
+ FAILED = "FAILED",
13
+ }
14
+
15
+
16
+ export type A_TYPES__FeatureStep = {
17
+ component: { new(...args: any[]): any },
18
+ handler: string,
19
+ args: any[]
20
+ }
@@ -1,48 +1,37 @@
1
- import { A_Polyfills } from '@adaas/a-utils';
2
- import {
3
- A_TYPES__NamespaceConstructor,
4
- A_TYPES__INamespace,
5
- } from './A_Namespace.types';
6
- import { A_Context } from '../A-Context/A-Context.class';
1
+ import { A_Context } from "../A-Context/A-Context.class";
2
+ import { A_TYPES__FragmentConstructor } from "./A-Fragment.types";
7
3
 
8
4
 
9
5
  /**
10
- * A_Namespace is a base class for all Namespaces in the A
6
+ * A-Fragment = Context Fragments is a set of arguments that can be used to define a Context for the pipeline.
7
+ * In other words it is a dynamic context that will be created on pipeline start and destroyed on pipeline end.
8
+ * During the execution of the pipeline, the Context Fragments can be used to pass the data between the pipeline steps.
11
9
  *
12
- * Namespace is a shared object within some environment, service or Application.
13
- * It is used to share some data, configuration, dependencies, etc. between different parts of the application.
10
+ * Or to store the data that is required for the pipeline execution
14
11
  *
15
- * Namespace allow to :
16
- * - share some data between different parts of the application,
17
- * - share some configuration between different parts of the application,
18
- * - share some dependencies between different parts of the application,
19
- * - extend the capabilities of the application by adding new features or modifying existing ones into base classes
20
- *
21
12
  */
22
- export class A_Namespace<
23
- _ConstructorConfigType extends A_TYPES__NamespaceConstructor = any
24
- > implements A_TYPES__INamespace {
13
+ export class A_Fragment {
14
+
15
+ name: string;
25
16
 
26
- /**
27
- * Namespace namespace
28
- */
29
- name!: string;
30
17
 
31
18
  /**
32
- * Ready Promise to ensure the SDK is ready to use
19
+ * Indicates that Context Fragment is ready to use
33
20
  */
34
21
  ready!: Promise<void>;
35
22
 
36
- constructor(
37
- protected config?: _ConstructorConfigType
38
- ) {
23
+
24
+ constructor(params: Partial<A_TYPES__FragmentConstructor> = {}) {
25
+
26
+ this.name = params.name || this.constructor.name;
27
+
39
28
  /**
40
29
  * Register the Namespace in the global Namespace provider
41
30
  */
42
31
  this.name = A_Context
43
32
  .register(
44
33
  this,
45
- config?.name
34
+ this.name
46
35
  );
47
36
 
48
37
  /**
@@ -53,6 +42,7 @@ export class A_Namespace<
53
42
 
54
43
 
55
44
 
45
+
56
46
  private hasInherited(cl: { new(...args: any[]) }): boolean {
57
47
  return this.constructor === cl
58
48
  ? false
@@ -62,7 +52,7 @@ export class A_Namespace<
62
52
  /**
63
53
  * Initializes the Namespace or can be used to reinitialize the Namespace
64
54
  */
65
- protected async init() {
55
+ private async init() {
66
56
  if (!this.ready)
67
57
  this.ready = new Promise(async (resolve, reject) => {
68
58
  try {
@@ -83,6 +73,10 @@ export class A_Namespace<
83
73
 
84
74
 
85
75
 
76
+
77
+
78
+
79
+
86
80
  // ==============================================================
87
81
  // ======================= HOOKS ================================
88
82
  // ==============================================================
@@ -100,9 +94,8 @@ export class A_Namespace<
100
94
  * Main initialization method for the SDK
101
95
  */
102
96
  protected async onInit() {
103
-
104
97
  // global logger configuration
105
- if (A_Context.environment === 'server' && !this.hasInherited(A_Namespace)) {
98
+ if (A_Context.environment === 'server' && !this.hasInherited(A_Fragment)) {
106
99
  // eslint-disable-next-line no-use-before-define
107
100
  // process.on('uncaughtException', (error) => {
108
101
  // // log only in case of A_AUTH_Error
@@ -125,4 +118,5 @@ export class A_Namespace<
125
118
  protected async onAfterInit() {
126
119
  return;
127
120
  }
121
+
128
122
  }
@@ -0,0 +1,6 @@
1
+
2
+
3
+
4
+ export type A_TYPES__FragmentConstructor = {
5
+ name: string
6
+ }
@@ -0,0 +1,60 @@
1
+ import { A_TYPES__Dictionary } from "@adaas/a-utils";
2
+ import { A_Component } from "../A-Component/A-Component.class";
3
+ import { A_Container } from "../A-Container/A-Container.class";
4
+
5
+
6
+
7
+ /**
8
+ * A Meta is an entity that stores all the metadata for the specific entity like container, component, feature, etc.
9
+ *
10
+ * [!] Meta can be different depending on the type of input data
11
+ */
12
+ export class A_Meta<
13
+ _StorageItems extends Record<string, any>
14
+ // _StorageItems extends Record<string, Map<string | Symbol, any> | Array<any> | A_TYPES__Dictionary<any>>
15
+ > {
16
+
17
+ protected meta: Map<keyof _StorageItems, _StorageItems[keyof _StorageItems]> = new Map();
18
+
19
+
20
+ from(
21
+ meta: A_Meta<_StorageItems>
22
+ ): A_Meta<_StorageItems> {
23
+ this.meta = new Map(meta.meta);
24
+
25
+ return this;
26
+ }
27
+
28
+
29
+ // ===================================================================================================
30
+ // ================================ META OPERATIONS ==================================================
31
+ // ===================================================================================================
32
+
33
+ // Method to set values in the map
34
+ set<K extends keyof _StorageItems>(key: K, value: _StorageItems[K]) {
35
+
36
+ const inheritedValue = this.meta.get(key)
37
+ || Array.isArray(value)
38
+ ? []
39
+ : (value as any) instanceof Map
40
+ ? new Map()
41
+ : {};
42
+ const targetValue = this.meta.get(key)
43
+ || Array.isArray(value)
44
+ ? [
45
+ ...inheritedValue as any
46
+ ] : (value as any) instanceof Map
47
+ ? new Map(inheritedValue as any)
48
+ : { ...inheritedValue };
49
+
50
+ this.meta.set(key, value);
51
+
52
+ }
53
+
54
+ // Method to get values from the map
55
+ get<K extends keyof _StorageItems>(key: K): _StorageItems[K] | undefined {
56
+ return this.meta.get(key) as _StorageItems[K];
57
+ }
58
+ }
59
+
60
+
File without changes
@@ -0,0 +1,208 @@
1
+ import { A_CommonHelper } from "@adaas/a-utils";
2
+ import { A_TYPES__ScopeConfig, A_TYPES__ScopeConstructor } from "./A-Scope.types";
3
+ import { A_STORAGE__A_Inject_Instructions } from "@adaas/a-concept/storage/A_Inject.storage";
4
+ import { A_Fragment } from "../A-Fragment/A-Fragment.class";
5
+
6
+ /**
7
+ *
8
+ *
9
+ * A_Scope refers to the visibility and accessibility of :
10
+ * - variables,
11
+ * - Components,
12
+ * - Context Fragments
13
+ * - and objects in different parts of your code.
14
+ * Scope determines where a particular piece of data (like a variable or function)
15
+ * can be accessed, modified, or referenced, and it plays a crucial role in avoiding naming collisions and ensuring data integrity.
16
+ *
17
+ *
18
+ */
19
+ export class A_Scope {
20
+
21
+ name: string = '';
22
+
23
+ private _components: WeakMap<{ new(...args: any[]): any }, any> = new WeakMap();
24
+ private _fragments: WeakMap<typeof A_Fragment.constructor, any> = new WeakMap();
25
+
26
+ private parent?: A_Scope;
27
+
28
+ protected params!: A_TYPES__ScopeConstructor
29
+
30
+
31
+ constructor(
32
+ params: Partial<A_TYPES__ScopeConstructor>,
33
+ config: Partial<A_TYPES__ScopeConfig> = {}
34
+ ) {
35
+ this.name = params.name || this.constructor.name;
36
+
37
+ // TODO: move to defaults
38
+ const defaultParams: A_TYPES__ScopeConstructor = {
39
+ name: '',
40
+ components: [],
41
+ fragments: [],
42
+ import: [],
43
+ export: [],
44
+ };
45
+
46
+
47
+ this.params = A_CommonHelper.deepCloneAndMerge<A_TYPES__ScopeConstructor>(params, defaultParams);
48
+
49
+ this.initComponents(params.components || []);
50
+ this.initFragments(params.fragments || []);
51
+
52
+ if (config.parent) {
53
+ this.parent = config.parent;
54
+ }
55
+ }
56
+
57
+
58
+ private initComponents(_components: Array<{ new(...args: any[]): any }>) {
59
+ // _components.forEach(component => {
60
+ // this._components.set(component, new component());
61
+ // })
62
+ }
63
+
64
+
65
+ private initFragments(_fragments: Array<A_Fragment>) {
66
+ _fragments.forEach(this.register.bind(this));
67
+ }
68
+
69
+
70
+ get components() {
71
+ return this.params.components || [];
72
+ }
73
+
74
+
75
+
76
+ /**
77
+ * This method is used to check if the component is available in the scope
78
+ *
79
+ * @param component
80
+ * @returns
81
+ */
82
+ has(
83
+ component: { new(...args: any[]): any }
84
+ ): boolean
85
+ has(
86
+ fragment: A_Fragment
87
+ ): boolean
88
+ has(
89
+ entity: { new(...args: any[]): any } | A_Fragment
90
+ ): boolean {
91
+
92
+ switch (true) {
93
+ case entity instanceof A_Fragment
94
+ && this._fragments.has(entity.constructor): {
95
+ return true;
96
+ }
97
+
98
+ case entity instanceof A_Fragment
99
+ && !this._fragments.has(entity.constructor)
100
+ && !!this.parent: {
101
+ return this.parent.has(entity);
102
+ }
103
+
104
+ case !(entity instanceof A_Fragment)
105
+ && this._components.has(entity): {
106
+ return true;
107
+ }
108
+
109
+ case !(entity instanceof A_Fragment)
110
+ && !this._components.has(entity)
111
+ && !!this.parent: {
112
+ return this.parent.has(entity);
113
+ }
114
+
115
+ default: {
116
+ return false;
117
+ }
118
+ }
119
+ }
120
+
121
+
122
+ /**
123
+ * This method is used to get the component by class
124
+ *
125
+ * @param component
126
+ * @returns
127
+ */
128
+ resolve<T extends { new(...args: any[]): any }>(component: T): InstanceType<T>
129
+ resolve<T extends { new(...args: any[]): any }>(component: Array<T>): Array<InstanceType<T>>
130
+ // base definition
131
+ resolve<T extends { new(...args: any[]): any }>(
132
+ param1: Array<T> | T,
133
+ param2?: string
134
+ ): Array<InstanceType<T>> | InstanceType<T> {
135
+
136
+ switch (true) {
137
+ case Array.isArray(param1): {
138
+ return param1.map(c => this.resolveOnce(c));
139
+ }
140
+
141
+ case typeof param1 === 'function': {
142
+ return this.resolveOnce(param1);
143
+ }
144
+
145
+ default: {
146
+ throw new Error('Invalid arguments provided');
147
+ }
148
+ }
149
+ }
150
+
151
+
152
+
153
+
154
+ private resolveOnce<T extends { new(...args: any[]): any }>(component: T): InstanceType<T> {
155
+ switch (true) {
156
+ case A_CommonHelper.isInheritedFrom(component, A_Fragment): {
157
+ return this.resolveFragment(component);
158
+ }
159
+
160
+ case this.components.includes(component) && this._components.has(component): {
161
+
162
+ return this._components.get(component);
163
+ }
164
+ case this.components.includes(component) && !this._components.has(component): {
165
+
166
+ const argsMeta = A_STORAGE__A_Inject_Instructions.get(component);
167
+
168
+ let resolvedArgs: Array<any> = [];
169
+
170
+ if (argsMeta)
171
+ resolvedArgs = (argsMeta.get('constructor') || [])
172
+ .map(arg => this.resolve(arg));
173
+
174
+ this._components.set(component, new component());
175
+
176
+ return this._components.get(component);
177
+ }
178
+
179
+ case !this.components.includes(component) && !!this.parent: {
180
+
181
+ return this.parent.resolve(component);
182
+ }
183
+ default:
184
+ throw new Error(`Component ${component.name} not found in the scope`);
185
+ }
186
+ }
187
+
188
+
189
+
190
+ private resolveFragment<T extends { new(...args: any[]): any }>(fragment: T): InstanceType<T> {
191
+
192
+ if (this._fragments.has(fragment)) {
193
+ return this._fragments.get(fragment);
194
+ }
195
+
196
+ if (this.parent) {
197
+ return this.parent.resolveFragment(fragment);
198
+ }
199
+
200
+ throw new Error(`Fragment ${fragment.name} not found in the scope ${this.name}`);
201
+ }
202
+
203
+
204
+
205
+ register(fragment: A_Fragment): void {
206
+ this._fragments.set(fragment.constructor, fragment);
207
+ }
208
+ }
@@ -0,0 +1,37 @@
1
+ import { A_Fragment } from "../A-Fragment/A-Fragment.class"
2
+ import { A_Scope } from "./A-Scope.class"
3
+
4
+
5
+ export type A_TYPES__ScopeConstructor = {
6
+
7
+ /**
8
+ * Scope Name
9
+ */
10
+ name: string,
11
+ /**
12
+ * A list of Context Fragments available in the Scope
13
+ */
14
+ fragments: Array<A_Fragment>
15
+ /**
16
+ * A set of Components available in the Scope
17
+ */
18
+ components: Array<{ new(...args: any[]): any }>
19
+
20
+
21
+ /**
22
+ * A list of Features/Lifecycle Hooks available in the Scope
23
+ */
24
+ import: Array<string>,
25
+ /**
26
+ * A list of Features/Lifecycle Hooks available to be exported from the Scope
27
+ */
28
+ export: Array<string>
29
+ }
30
+
31
+
32
+ export type A_TYPES__ScopeConfig = {
33
+ /**
34
+ * Allows to define a parent to take dependencies from in case of the current scope does not have the required component
35
+ */
36
+ parent: A_Scope
37
+ }
@@ -0,0 +1,28 @@
1
+ // =================================================================================================
2
+ // ========== Component Storage ====================================================================
3
+ // =================================================================================================
4
+
5
+ import { A_Component } from "../global/A-Component/A-Component.class";
6
+
7
+
8
+ // -------------------------------------------------------------------------------
9
+ // ----- A Concept -> Component Declaration -> Symbol Declaration Keys ---------------
10
+ // -------------------------------------------------------------------------------
11
+ export const A_COMPONENT_STORAGE__Definition__Extensions = Symbol('a-container-extensions');
12
+ export const A_COMPONENT_STORAGE__Definition__Feature = Symbol('a-container-feature');
13
+
14
+
15
+
16
+ /**
17
+ *
18
+ * This storage is used to store the containers metadata, definitions and configurations
19
+ */
20
+ export const A_COMPONENT_Storage: Map<
21
+ typeof A_Component | { new(...args: any[]): any },
22
+ Map<
23
+ Symbol | string,
24
+ any
25
+ >
26
+ > = new Map();
27
+
28
+
@@ -2,6 +2,9 @@
2
2
 
3
3
  // --------------------------------------------------------------
4
4
  // ----- A Concept -> Module Declaration -> Main Config ---------
5
+
6
+ import { A_Container } from "../global/A-Container/A-Container.class";
7
+
5
8
  // --------------------------------------------------------------
6
9
  export const A_CONCEPT_STORAGE__MODULE_DECLARATION_Config = Symbol('a-concept-modules-declaration');
7
10
 
@@ -42,4 +45,5 @@ export const A_CONCEPT_LifecycleDeclarationsStorage: Map<Symbol, any> = new Map(
42
45
  * The simplest way to store the decorators
43
46
  * If any extra API is needed, it can be added here or replaced with a new class
44
47
  */
45
- export const A_CONCEPT_Storage = new WeakMap();
48
+ export const A_CONCEPT_Storage = new WeakMap();
49
+
@@ -0,0 +1,21 @@
1
+ // =================================================================================================
2
+ // ========== Container Storage ====================================================================
3
+ // =================================================================================================
4
+
5
+ import { A_Container } from "../global/A-Container/A-Container.class";
6
+
7
+ // -------------------------------------------------------------------------------
8
+ // ----- A Concept -> Container Declaration -> Symbol Declaration Keys ---------------
9
+ // -------------------------------------------------------------------------------
10
+ export const A_CONTAINER_STORAGE__Definition__Lifecycle = Symbol('a-container-lifecycle');
11
+ export const A_CONTAINER_STORAGE__Definition__Feature = Symbol('a-container-feature');
12
+
13
+
14
+
15
+ /**
16
+ * This storage is used to store the containers metadata, definitions and configurations
17
+ *
18
+ */
19
+ export const A_CONTAINER_Storage: WeakMap<typeof A_Container.constructor, Map<Symbol | string, any>> = new WeakMap();
20
+
21
+