@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
@@ -1,7 +1,15 @@
1
- import { A_CONCEPT_LifecycleDeclarationsStorage } from "src/storage/A_Concept.storage";
2
- import { A_TYPES__A_CONCEPT_RootRunParams, A_TYPES__IConceptConstructor } from "./A_Concept.types";
1
+ import { A_TYPES__ConceptStage, A_TYPES__ConceptStageParams, A_TYPES__IConceptConstructor } from "./A_Concept.types";
3
2
  import { A_Context } from "../A-Context/A-Context.class";
4
- import { A_Errors } from "src/containers/A-Errors/A-Errors.namespace";
3
+ import { A_Container } from "../A-Container/A-Container.class";
4
+ import { A_Logger } from "@adaas/a-concept/base/A-Logger/A-Logger.component";
5
+ import { A_Fragment } from "../A-Fragment/A-Fragment.class";
6
+ import { A_TYPES__ContainerMetaKey } from "../A-Container/A-Container.types";
7
+ import { A_Stage } from "@adaas/a-concept/decorators/A-Stage/A-Stage.decorator";
8
+
9
+
10
+
11
+
12
+ // export type RunParams<T> = T extends A_Container<any, infer Params> ? Params : never;
5
13
 
6
14
 
7
15
 
@@ -17,56 +25,95 @@ import { A_Errors } from "src/containers/A-Errors/A-Errors.namespace";
17
25
  *
18
26
  *
19
27
  */
20
- export class A_Concept {
21
-
28
+ export class A_Concept<
29
+ _Features extends A_Container<any>[] = any
30
+ > {
22
31
 
32
+ // ==============================================================================
33
+ // ==================== STATIC LIFECYCLE DECORATORS ===========================
34
+ // ==============================================================================
23
35
  /**
24
- * Context is a root namespace for the concept.
36
+ * Load the concept. This step runs before any other steps to ensure that all components are loaded.
25
37
  */
26
- Context!: typeof A_Context;
38
+ static get Load() {
39
+ return A_Stage(A_TYPES__ConceptStage.Load);
40
+ }
27
41
 
28
42
  /**
29
- * Context provider is a singleton that provides the context for ALL concepts.
43
+ * Publish the concept to ADAAS platform. (Or any other place defined in the concept)
44
+ *
45
+ * [!] To extend the logic just create a custom containers and override the default behavior.
30
46
  */
47
+ static get Publish() {
48
+ return A_Stage(A_TYPES__ConceptStage.Publish);
49
+ }
31
50
 
32
- protected props!: A_TYPES__IConceptConstructor;
33
-
34
- constructor(
35
- props: A_TYPES__IConceptConstructor
36
- ) {
37
- this.props = props;
38
-
39
- this.Context = A_Context;
51
+ /**
52
+ * Deploy the concept to the environment.
53
+ */
54
+ static get Deploy() {
55
+ return A_Stage(A_TYPES__ConceptStage.Deploy);
40
56
  }
41
57
 
58
+ /**
59
+ * Compiles the Concept in case there are some containers that require that.
60
+ *
61
+ * Can be used for static websites or any other concept that requires a build step.
62
+ *
63
+ */
64
+ static get Build() {
65
+ return A_Stage(A_TYPES__ConceptStage.Build);
66
+ }
42
67
 
43
- get namespace() {
44
- return this.Context.root
68
+ /**
69
+ * Main execution of the concept.
70
+ */
71
+ static get Run() {
72
+ return A_Stage(A_TYPES__ConceptStage.Run);
45
73
  }
46
74
 
75
+ /**
76
+ * Start the concept. Uses for servers or any other background services.
77
+ */
78
+ static get Start() {
79
+ return A_Stage(A_TYPES__ConceptStage.Start);
80
+ }
47
81
 
48
82
  /**
49
- * Returns true if the class has inherited from the given class.
50
- *
51
- * @param cl
52
- * @returns
83
+ * Stop the concept. Uses for servers or any other background services.
53
84
  */
54
- private hasInherited(cl: { new(...args: any[]) }): boolean {
55
- return this.constructor === cl
56
- ? false
57
- : true
85
+ static get Stop() {
86
+ return A_Stage(A_TYPES__ConceptStage.Stop);
58
87
  }
59
88
 
60
89
 
61
90
 
91
+ // ==============================================================================
92
+ // ========================== MAIN Class ======================================
93
+ // ==============================================================================
62
94
 
63
- protected async init() {
64
- // await this.Context.init();
95
+ protected containers: A_Container<any>[] = [];
65
96
 
66
- // await this.DM.init();
97
+ constructor(
98
+ protected props: A_TYPES__IConceptConstructor<_Features>
99
+ ) {
100
+ A_Context.allocate(this, {
101
+ name: props.name,
102
+ fragments: props.fragments || [],
103
+ // containers: props.containers
104
+ components: [
105
+ A_Logger,
106
+ ]
107
+ });
108
+
109
+ this.containers = props.containers || [];
67
110
  }
68
111
 
69
112
 
113
+ get namespace() {
114
+ return A_Context.scope(this).name;
115
+ }
116
+
70
117
 
71
118
  // =======================================================================
72
119
  // ========================== LIFECYCLE ================================
@@ -76,35 +123,18 @@ export class A_Concept {
76
123
  * Run the concept.
77
124
  */
78
125
  async run(
79
- params: A_TYPES__A_CONCEPT_RootRunParams = {}
126
+ params?: Partial<A_TYPES__ConceptStageParams>
80
127
  ) {
81
128
 
82
- // to prevent modification of the method parameters use the A_Context directly without decorators
83
- const [
84
- Errors
85
- ] = this.Context.resolve([A_Errors]);
86
-
87
- if (this.hasInherited(A_Concept))
88
- Errors.throw('[root.run] method can not be overridden in the inherited classes');
89
-
90
-
91
- // const allRunDeclarations = A_CONCEPT_LifecycleDeclarationsStorage
92
- // .get(A_CONCEPT_STORAGE__DECORATORS_RUN_DECLARATIONS);
93
129
  }
94
130
 
95
131
 
96
132
  /**
97
133
  * Build the concept.
98
134
  */
99
- async build() {
100
- // to prevent modification of the method parameters use the A_Context directly without decorators
101
- const [
102
- Errors
103
- ] = this.Context.resolve([A_Errors]);
104
-
105
-
106
- if (this.hasInherited(A_Concept))
107
- Errors.throw('[root.build] method can not be overridden in the inherited classes');
135
+ async build(
136
+ params?: Partial<A_TYPES__ConceptStageParams>
137
+ ) {
108
138
 
109
139
  }
110
140
 
@@ -112,32 +142,96 @@ export class A_Concept {
112
142
  // /**
113
143
  // * Deploy the concept.
114
144
  // */
115
- // async deploy() {
116
- // if (this.hasInherited(A_Concept))
117
- // this.Context.Errors.throw('[root.deploy] method can not be overridden in the inherited classes');
118
- // }
145
+ async deploy(
146
+ params?: Partial<A_TYPES__ConceptStageParams>
147
+ ) {
148
+
149
+ }
119
150
 
120
151
 
121
152
  // /**
122
153
  // * Publish the concept.
123
154
  // */
124
- // async publish() {
125
- // if (this.hasInherited(A_Concept))
126
- // this.Context.Errors.throw('[root.publish] method can not be overridden in the inherited classes');
127
- // }
155
+ async publish(
156
+ params?: Partial<A_TYPES__ConceptStageParams>
157
+ ) {
158
+
159
+ }
128
160
 
129
161
 
130
162
  /**
131
163
  * Call the specific method of the concept or included modules.
132
164
  */
133
- async call() {
134
- // to prevent modification of the method parameters use the A_Context directly without decorators
135
- const [
136
- Errors
137
- ] = this.Context.resolve([A_Errors]);
165
+ async call<
166
+ K extends Record<_Features[number]['name'], _Features[number]['exports'][number]>
167
+ >(
168
+ container: K[keyof K],
169
+ params?: A_Fragment[]
170
+ ) {
171
+ // for (const feature of this.features) {
172
+ // if (methodName in feature) {
173
+ // (feature as any)[methodName](...args);
174
+ // }
138
175
 
139
- // if (this.hasInherited(A_Concept))
140
- // this.Context.Errors.throw('[root.call] method can not be overridden in the inherited classes');
176
+ // }
141
177
  }
142
178
 
143
- }
179
+
180
+ private async runStage(
181
+ method: A_TYPES__ConceptStage,
182
+ params: Partial<A_TYPES__ConceptStageParams>
183
+ ) {
184
+
185
+ const stages: any[] = [];
186
+
187
+ this.containers.map(container => {
188
+ const meta = A_Context.meta(container);
189
+
190
+ const containerStages = meta.get(A_TYPES__ContainerMetaKey.STAGES)
191
+
192
+
193
+ if (containerStages) {
194
+ for (const [name, stage] of containerStages) {
195
+ if (stage.name === method) {
196
+ stages.push({
197
+ name,
198
+ container,
199
+ });
200
+ }
201
+ }
202
+
203
+ }
204
+ });
205
+
206
+ const scope = A_Context.allocate(this, {
207
+ components: params.components,
208
+ fragments: params.fragments,
209
+ parent: A_Context.scope(this)
210
+ });
211
+
212
+ for (const stage of stages) {
213
+ await stage.container[stage.name](params);
214
+ }
215
+
216
+ }
217
+
218
+
219
+ private async execute(
220
+ params: Partial<A_TYPES__ConceptStageParams>
221
+ ) {
222
+ const fragments = params.fragments || [];
223
+ const component = params.components || [];
224
+
225
+
226
+ this.containers.map(container => {
227
+ const meta = A_Context.meta(container);
228
+
229
+ meta.get(A_TYPES__ContainerMetaKey.FEATURES)
230
+
231
+ });
232
+
233
+
234
+ }
235
+
236
+ }
237
+
@@ -0,0 +1,9 @@
1
+ import { A_Meta } from "../A-Meta/A-Meta.class";
2
+ // import { A_TYPES__ComponentMeta } from "./A-Component.types";
3
+
4
+
5
+ export class A_ConceptMeta extends A_Meta<any> {
6
+
7
+
8
+
9
+ }
@@ -1,32 +1,60 @@
1
- import { A_Concept } from "./A_Concept.class";
2
- import { A_Namespace } from "../A-Namespace/A_Namespace.class";
3
1
  import { A_Container } from "../A-Container/A-Container.class";
2
+ import { A_Fragment } from "../A-Fragment/A-Fragment.class";
4
3
 
5
4
 
6
- export interface A_TYPES__IConceptConstructor {
5
+ export enum A_TYPES__ConceptStage {
6
+ Run = 'run',
7
+ Build = 'build',
8
+ Publish = 'publish',
9
+ Deploy = 'deploy',
10
+ Load = 'load',
11
+ Start = 'start',
12
+ Stop = 'stop',
13
+ }
14
+
15
+
16
+ // export type A_TYPES__ConceptMeta = {
17
+ // [A_TYPES__ConceptMetaKey.EXTENSIONS]: Map<string, A_TYPES__ConceptMeta_ExtensionItem>,
18
+ // [A_TYPES__ConceptMetaKey.FEATURES]: any[],
19
+ // // [A_TYPES__ConceptMetaKey.INJECTIONS]: Map<
20
+ // // // Where key is method name
21
+ // // Symbol | string,
22
+ // // // And value is Injection instructions
23
+ // // A_TYPES__ConceptMeta_InjectionParams
24
+ // // >
25
+
26
+ // }
27
+
28
+ export enum A_TYPES__ConceptMetaKey {
29
+ LIFECYCLE = 'a-component-extensions',
30
+ }
31
+
32
+
33
+ export interface A_TYPES__IConceptConstructor<
34
+ T extends Array<A_Container<any>>
35
+ > {
7
36
  name: string,
8
- description?: string,
9
37
 
10
38
  /**
11
- * A set of Namespaces that the concept depends on.
12
- * These namespaces will create a new Context for the concept.
39
+ * A set of Context Fragments to register globally for the concept.
40
+ * These fragments will be available in the global context.
13
41
  *
14
42
  */
15
- context?: Array<A_Namespace>,
43
+ fragments?: Array<A_Fragment>,
16
44
 
17
45
 
18
46
  /**
19
47
  * A set of Containers that the concept depends on.
20
48
  * These containers will create a new Container for the concept.
21
49
  */
22
- containers?: Array<{ new(...args: any[]): A_Container }>,
50
+ containers?: T,
23
51
 
24
52
 
25
53
  /**
26
54
  * A set of external Concepts that can be used in the current Concept.
27
55
  * To provide additional functionality or extend the current Concept.
28
56
  */
29
- import?: Array<A_Concept>
57
+ // import?: Array<A_Concept>
30
58
  }
31
59
 
32
60
 
@@ -38,7 +66,14 @@ export interface A_TYPES__IConceptConstructor {
38
66
  // =======================================================================
39
67
  // =======================================================================
40
68
 
41
- export type A_TYPES__A_CONCEPT_RootRunParams = {
69
+ export type A_TYPES__ConceptStageParams = {
70
+ fragments: Array<A_Fragment>,
71
+ components: Array<{ new(...args: any[]): any }>
72
+ }
42
73
 
43
74
 
75
+ export type A_TYPES__ConceptCallParams<T extends string> = {
76
+ name: T,
77
+ fragments: Array<A_Fragment>,
78
+ components: Array<{ new(...args: any[]): any }>
44
79
  }
@@ -1,39 +1,194 @@
1
- import { A_Namespace } from "../A-Namespace/A_Namespace.class";
1
+ import { A_TYPES__ContainerCallParams, A_TYPES__ContainerConstructor } from "./A-Container.types";
2
+ import { A_Scope } from "../A-Scope/A-Scope.class";
3
+ import { A_TYPES__Required } from "@adaas/a-utils";
4
+ import { A_Feature } from "../A-Feature/A-Feature.class";
5
+ import { A_CONTAINER_Storage, A_CONTAINER_STORAGE__Definition__Lifecycle } from "@adaas/a-concept/storage/A_Container.storage";
6
+ import { A_COMPONENT_Storage } from "@adaas/a-concept/storage/A_Component.storage";
7
+ import { A_TYPES__FeatureStep } from "../A-Feature/A-Feature.types";
8
+ import { A_Context } from "../A-Context/A-Context.class";
9
+ import { A_Fragment } from "../A-Fragment/A-Fragment.class";
2
10
 
3
11
 
4
12
 
5
13
  /**
6
- * This class should combine Components to achieve the goal withing Context
7
- * Container could be interpreted as any Structure Entity, or Abstract Entity
8
- * For example:
9
- * - Controller (all Controllers with base logic)
10
- * - Service (all Services with base logic)
11
- * - Module (all Modules with base logic)
14
+ * This class should combine Components to achieve the goal withing Concept
15
+ *
16
+ * Container is a direct container that should be "run" to make Concept work.
17
+ * So because of that Container can be:
18
+ * - HTTP Server
19
+ * - BASH Script
20
+ * - Database Connection
21
+ * - Microservice
12
22
  * - etc.
13
23
  */
14
- export class A_Container<T extends A_Namespace = A_Namespace> {
24
+ export class A_Container<
25
+ _FeatureNames extends Array<string>
26
+ > {
27
+ // scope!: A_Scope
15
28
 
16
- protected readonly namespace!: T;
29
+ protected readonly config!: Partial<A_TYPES__ContainerConstructor<_FeatureNames>>;
30
+
31
+ /**
32
+ * Promise that will be resolved when the container is ready to be used.
33
+ */
34
+ ready!: Promise<void>;
35
+
36
+ get exports(): _FeatureNames {
37
+ return this.config.exports || [] as any;
38
+ }
39
+
40
+ get name() {
41
+ return this.config.name || this.constructor.name;
42
+ }
17
43
 
18
44
 
19
45
  constructor(
20
- namespace?: T
46
+ /**
47
+ * Configuration of the container that will be used to run it.
48
+ */
49
+ config: Partial<A_TYPES__ContainerConstructor<_FeatureNames>>
21
50
  ) {
22
- if (namespace) {
23
- this.namespace = namespace;
51
+ this.config = config;
52
+
53
+ const components = config.components || [];
54
+ const fragments = config.fragments || [];
55
+
56
+ A_Context.allocate(this, {
57
+ components,
58
+ fragments
59
+ });
60
+
61
+ /**
62
+ * Run Async Initialization
63
+ */
64
+ this.init();
65
+ }
66
+
67
+
68
+ protected hasInherited(cl: { new(...args: any[]) }): boolean {
69
+ return this.constructor === cl
70
+ ? false
71
+ : true
72
+ }
73
+
74
+
75
+ /**
76
+ * Initializes the Namespace or can be used to reinitialize the Namespace
77
+ */
78
+ private async init() {
79
+ if (!this.ready)
80
+ this.ready = new Promise(async (resolve, reject) => {
81
+ try {
82
+ await this.onBeforeInit();
83
+
84
+ await this.onInit();
85
+
86
+ await this.onAfterInit();
87
+
88
+
89
+ return resolve();
90
+ } catch (error) {
91
+ return reject(error);
92
+ }
93
+ });
94
+ else
95
+ await this.ready;
96
+ }
97
+
98
+
99
+
100
+
101
+
102
+ /**
103
+ * This method allows to call the lifecycle method of the container as well as any other Feature defined for it
104
+ *
105
+ * @param lifecycleMethod
106
+ * @param args
107
+ */
108
+ call(
109
+ /**
110
+ * A-Feature method name to be called
111
+ */
112
+ feature: _FeatureNames[number],
113
+ ): A_Feature
114
+ call(
115
+ /**
116
+ * A-Feature name to be called
117
+ */
118
+ params: A_TYPES__Required<Partial<A_TYPES__ContainerCallParams<_FeatureNames[number]>>, ['name']>,
119
+ ): A_Feature
120
+
121
+ call(
122
+ /**
123
+ * A-Feature method name to be called
124
+ */
125
+ feature: _FeatureNames[number],
126
+ /**
127
+ * Parameters to provide additional data to the feature
128
+ */
129
+ params: Partial<A_TYPES__ContainerCallParams<_FeatureNames[number]>>,
130
+ ): A_Feature
131
+
132
+ call(
133
+ param1: _FeatureNames[number] | A_TYPES__Required<Partial<A_TYPES__ContainerCallParams<_FeatureNames[number]>>, ['name']>,
134
+ param2?: Partial<A_TYPES__ContainerCallParams<_FeatureNames[number]>>
135
+ ): A_Feature {
136
+
137
+ let feature: string;
138
+ let params: Partial<A_TYPES__ContainerCallParams<_FeatureNames[number]>>;
139
+
140
+ if (typeof param1 === 'string') {
141
+ feature = param1;
142
+ params = param2 || {};
143
+ } else {
144
+ feature = param1.name;
145
+ params = param1;
24
146
  }
147
+
148
+ const meta = A_Context.meta(this);
149
+
150
+ const steps = meta.feature(this, feature);
151
+
152
+ const newFeature = new A_Feature({
153
+ name: `${this.constructor.name}.${feature}`,
154
+ fragments: param2?.fragments || [],
155
+ components: param2?.components || [],
156
+ steps,
157
+ parent: A_Context.scope(this)
158
+ });
159
+
160
+ return newFeature;
25
161
  }
26
162
 
27
163
 
28
- // bind(
29
- // Context: T,
30
- // /**
31
- // * Context provider from parent Concept
32
- // * It's possible to use the same ContextProvider for all Containers
33
- // */
34
- // ContextProvider: A_ContextProvider
35
- // ) {
36
- // this.Context = Context;
37
- // }
164
+
165
+ // ==============================================================
166
+ // ======================= HOOKS ================================
167
+ // ==============================================================
168
+
169
+ /**
170
+ * Before init hook to be used in inherited classes
171
+ *
172
+ * @returns
173
+ */
174
+ protected async onBeforeInit() {
175
+ return;
176
+ }
177
+
178
+ /**
179
+ * Main initialization method for the Container
180
+ */
181
+ protected async onInit() {
182
+ return;
183
+ }
184
+
185
+ /**
186
+ * After init hook to be used in inherited classes
187
+ *
188
+ * @returns
189
+ */
190
+ protected async onAfterInit() {
191
+ return;
192
+ }
38
193
 
39
194
  }
@@ -0,0 +1,80 @@
1
+ import { A_TYPES__ComponentMetaKey } from "../A-Component/A-Component.types";
2
+ import { A_Context } from "../A-Context/A-Context.class";
3
+ import { A_TYPES__FeatureStep } from "../A-Feature/A-Feature.types";
4
+ import { A_Meta } from "../A-Meta/A-Meta.class";
5
+ import { A_Container } from "./A-Container.class";
6
+ import {
7
+ A_TYPES__ContainerMeta,
8
+ A_TYPES__ContainerMetaKey
9
+ } from "./A-Container.types";
10
+
11
+
12
+
13
+ export class A_ContainerMeta extends A_Meta<A_TYPES__ContainerMeta> {
14
+
15
+
16
+ feature<T extends string>(
17
+ container: A_Container<any>,
18
+ name: T,
19
+ // params:
20
+ ) {
21
+ const scope = A_Context.scope(container);
22
+
23
+ // First lets validate that there'are registered method with the same name
24
+ const featureMeta = this.get(A_TYPES__ContainerMetaKey.FEATURES);
25
+
26
+ if (!featureMeta) {
27
+ throw new Error(`Container ${container.constructor.name} has no metadata defined`);
28
+ }
29
+
30
+ const instruction = featureMeta.get(name);
31
+
32
+ if (!instruction)
33
+ throw new Error(`Method ${name} is not defined in ${this.constructor.name}`);
34
+
35
+ // const scope = new A_Scope({
36
+ // name: `${this.constructor.name}.${feature}`,
37
+ // fragments: param2?.fragments || [],
38
+ // components: param2?.components || []
39
+ // }, {
40
+ // parent: this.scope
41
+ // });
42
+
43
+
44
+ // Now we need to resolve the method from all registered components
45
+ return scope
46
+ .components
47
+ .reduce((
48
+ acc, component
49
+ ) => {
50
+ const componentMeta = A_Context.meta(component);
51
+
52
+ const extensions = componentMeta.get(A_TYPES__ComponentMetaKey.EXTENSIONS) || [];
53
+ const injections = componentMeta.get(A_TYPES__ComponentMetaKey.INJECTIONS);
54
+
55
+ const out: A_TYPES__FeatureStep[] = [];
56
+
57
+ extensions.forEach((extension, handler) => {
58
+ if (
59
+ extension.name === name
60
+ &&
61
+ (extension.container === container.constructor.name || extension.container === '*')
62
+ ) {
63
+ const args = injections?.get(handler) || [];
64
+
65
+ out.push({
66
+ component,
67
+ handler,
68
+ args
69
+ });
70
+ }
71
+ });
72
+
73
+ return [
74
+ ...acc,
75
+ ...out
76
+ ];
77
+
78
+ }, [] as A_TYPES__FeatureStep[])
79
+ }
80
+ }