@adaas/a-concept 0.0.2

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 (231) hide show
  1. package/.nvmrc +1 -0
  2. package/LICENSE +22 -0
  3. package/README.md +19 -0
  4. package/dist/examples/sdk/concept.d.ts +0 -0
  5. package/dist/examples/sdk/concept.js +21 -0
  6. package/dist/examples/sdk/concept.js.map +1 -0
  7. package/dist/examples/sdk/orders.api.d.ts +0 -0
  8. package/dist/examples/sdk/orders.api.js +16 -0
  9. package/dist/examples/sdk/orders.api.js.map +1 -0
  10. package/dist/examples/sdk/users.api.d.ts +0 -0
  11. package/dist/examples/sdk/users.api.js +16 -0
  12. package/dist/examples/sdk/users.api.js.map +1 -0
  13. package/dist/examples/simple/concept.d.ts +0 -0
  14. package/dist/examples/simple/concept.js +13 -0
  15. package/dist/examples/simple/concept.js.map +1 -0
  16. package/dist/examples/simple-http-server/concept.d.ts +1 -0
  17. package/dist/examples/simple-http-server/concept.js +36 -0
  18. package/dist/examples/simple-http-server/concept.js.map +1 -0
  19. package/dist/examples/simple-http-server/containers/http-server.container.d.ts +12 -0
  20. package/dist/examples/simple-http-server/containers/http-server.container.js +69 -0
  21. package/dist/examples/simple-http-server/containers/http-server.container.js.map +1 -0
  22. package/dist/examples/simple-http-server/containers/http-server.controller.d.ts +7 -0
  23. package/dist/examples/simple-http-server/containers/http-server.controller.js +37 -0
  24. package/dist/examples/simple-http-server/containers/http-server.controller.js.map +1 -0
  25. package/dist/examples/simple-http-server/containers/http-server.router.d.ts +6 -0
  26. package/dist/examples/simple-http-server/containers/http-server.router.js +39 -0
  27. package/dist/examples/simple-http-server/containers/http-server.router.js.map +1 -0
  28. package/dist/examples/simple-http-server/contexts/http-server.context.types.d.ts +4 -0
  29. package/dist/examples/simple-http-server/contexts/http-server.context.types.js +100 -0
  30. package/dist/examples/simple-http-server/contexts/http-server.context.types.js.map +1 -0
  31. package/dist/examples/simple-http-server/contexts/http-server.namespace.d.ts +10 -0
  32. package/dist/examples/simple-http-server/contexts/http-server.namespace.js +26 -0
  33. package/dist/examples/simple-http-server/contexts/http-server.namespace.js.map +1 -0
  34. package/dist/examples/simple-http-server/controllers/orders.controller.d.ts +5 -0
  35. package/dist/examples/simple-http-server/controllers/orders.controller.js +32 -0
  36. package/dist/examples/simple-http-server/controllers/orders.controller.js.map +1 -0
  37. package/dist/examples/simple-http-server/controllers/users.controller.d.ts +0 -0
  38. package/dist/examples/simple-http-server/controllers/users.controller.js +87 -0
  39. package/dist/examples/simple-http-server/controllers/users.controller.js.map +1 -0
  40. package/dist/examples/simple-http-server/modules/simple-http-server.context.d.ts +5 -0
  41. package/dist/examples/simple-http-server/modules/simple-http-server.context.js +25 -0
  42. package/dist/examples/simple-http-server/modules/simple-http-server.context.js.map +1 -0
  43. package/dist/examples/simple-http-server/modules/simple-http-server.module.d.ts +16 -0
  44. package/dist/examples/simple-http-server/modules/simple-http-server.module.js +8 -0
  45. package/dist/examples/simple-http-server/modules/simple-http-server.module.js.map +1 -0
  46. package/dist/examples/simple-http-server/modules/simple-http-server.types.d.ts +2 -0
  47. package/dist/examples/simple-http-server/modules/simple-http-server.types.js +3 -0
  48. package/dist/examples/simple-http-server/modules/simple-http-server.types.js.map +1 -0
  49. package/dist/index.d.ts +12 -0
  50. package/dist/index.js +38 -0
  51. package/dist/index.js.map +1 -0
  52. package/dist/src/constants/A_ConceptLifecycle.constants.d.ts +2 -0
  53. package/dist/src/constants/A_ConceptLifecycle.constants.js +12 -0
  54. package/dist/src/constants/A_ConceptLifecycle.constants.js.map +1 -0
  55. package/dist/src/containers/A-Config/A-Config.container.d.ts +7 -0
  56. package/dist/src/containers/A-Config/A-Config.container.js +65 -0
  57. package/dist/src/containers/A-Config/A-Config.container.js.map +1 -0
  58. package/dist/src/containers/A-Config/A-Config.namespace.d.ts +28 -0
  59. package/dist/src/containers/A-Config/A-Config.namespace.js +54 -0
  60. package/dist/src/containers/A-Config/A-Config.namespace.js.map +1 -0
  61. package/dist/src/containers/A-Config/A-Config.types.d.ts +12 -0
  62. package/dist/src/containers/A-Config/A-Config.types.js +3 -0
  63. package/dist/src/containers/A-Config/A-Config.types.js.map +1 -0
  64. package/dist/src/containers/A-Config/components/ConfigReader.component.d.ts +18 -0
  65. package/dist/src/containers/A-Config/components/ConfigReader.component.js +37 -0
  66. package/dist/src/containers/A-Config/components/ConfigReader.component.js.map +1 -0
  67. package/dist/src/containers/A-Config/components/ENVConfigReader.component.d.ts +10 -0
  68. package/dist/src/containers/A-Config/components/ENVConfigReader.component.js +37 -0
  69. package/dist/src/containers/A-Config/components/ENVConfigReader.component.js.map +1 -0
  70. package/dist/src/containers/A-Config/components/FileConfigReader.component.d.ts +11 -0
  71. package/dist/src/containers/A-Config/components/FileConfigReader.component.js +47 -0
  72. package/dist/src/containers/A-Config/components/FileConfigReader.component.js.map +1 -0
  73. package/dist/src/containers/A-Errors/A-Errors.container.d.ts +5 -0
  74. package/dist/src/containers/A-Errors/A-Errors.container.js +32 -0
  75. package/dist/src/containers/A-Errors/A-Errors.container.js.map +1 -0
  76. package/dist/src/containers/A-Errors/A-Errors.namespace.d.ts +40 -0
  77. package/dist/src/containers/A-Errors/A-Errors.namespace.js +76 -0
  78. package/dist/src/containers/A-Errors/A-Errors.namespace.js.map +1 -0
  79. package/dist/src/containers/A-Errors/A-Errors.types.d.ts +5 -0
  80. package/dist/src/containers/A-Errors/A-Errors.types.js +3 -0
  81. package/dist/src/containers/A-Errors/A-Errors.types.js.map +1 -0
  82. package/dist/src/containers/A-Logger/A-Logger.container.d.ts +6 -0
  83. package/dist/src/containers/A-Logger/A-Logger.container.js +41 -0
  84. package/dist/src/containers/A-Logger/A-Logger.container.js.map +1 -0
  85. package/dist/src/containers/A-Logger/A-Logger.namespace.d.ts +17 -0
  86. package/dist/src/containers/A-Logger/A-Logger.namespace.js +22 -0
  87. package/dist/src/containers/A-Logger/A-Logger.namespace.js.map +1 -0
  88. package/dist/src/containers/A-Logger/A-Logger.types.d.ts +0 -0
  89. package/dist/src/containers/A-Logger/A-Logger.types.js +2 -0
  90. package/dist/src/containers/A-Logger/A-Logger.types.js.map +1 -0
  91. package/dist/src/containers/A-Logger/components/Logger.component.d.ts +29 -0
  92. package/dist/src/containers/A-Logger/components/Logger.component.js +128 -0
  93. package/dist/src/containers/A-Logger/components/Logger.component.js.map +1 -0
  94. package/dist/src/decorators/A-ConceptLifecycle/A-ConceptLifecycle.decorator.types.d.ts +34 -0
  95. package/dist/src/decorators/A-ConceptLifecycle/A-ConceptLifecycle.decorator.types.js +3 -0
  96. package/dist/src/decorators/A-ConceptLifecycle/A-ConceptLifecycle.decorator.types.js.map +1 -0
  97. package/dist/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.d.ts +11 -0
  98. package/dist/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.js +36 -0
  99. package/dist/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.js.map +1 -0
  100. package/dist/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.types.d.ts +7 -0
  101. package/dist/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.types.js +3 -0
  102. package/dist/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.types.js.map +1 -0
  103. package/dist/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.d.ts +17 -0
  104. package/dist/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.js +42 -0
  105. package/dist/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.js.map +1 -0
  106. package/dist/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.types.d.ts +8 -0
  107. package/dist/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.types.js +3 -0
  108. package/dist/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.types.js.map +1 -0
  109. package/dist/src/decorators/A-ConceptLifecycle/index.d.ts +7 -0
  110. package/dist/src/decorators/A-ConceptLifecycle/index.js +11 -0
  111. package/dist/src/decorators/A-ConceptLifecycle/index.js.map +1 -0
  112. package/dist/src/decorators/A-Feature/A-Feature.decorator.d.ts +0 -0
  113. package/dist/src/decorators/A-Feature/A-Feature.decorator.js +11 -0
  114. package/dist/src/decorators/A-Feature/A-Feature.decorator.js.map +1 -0
  115. package/dist/src/decorators/A-Feature/A-Feature.decorator.types.d.ts +0 -0
  116. package/dist/src/decorators/A-Feature/A-Feature.decorator.types.js +2 -0
  117. package/dist/src/decorators/A-Feature/A-Feature.decorator.types.js.map +1 -0
  118. package/dist/src/decorators/A-Inject/A-Inject.decorator.d.ts +22 -0
  119. package/dist/src/decorators/A-Inject/A-Inject.decorator.js +32 -0
  120. package/dist/src/decorators/A-Inject/A-Inject.decorator.js.map +1 -0
  121. package/dist/src/decorators/A-Inject/A-Inject.decorator.types.d.ts +4 -0
  122. package/dist/src/decorators/A-Inject/A-Inject.decorator.types.js +3 -0
  123. package/dist/src/decorators/A-Inject/A-Inject.decorator.types.js.map +1 -0
  124. package/dist/src/decorators/A_ConceptMethods.decorator.d.ts +0 -0
  125. package/dist/src/decorators/A_ConceptMethods.decorator.js +2 -0
  126. package/dist/src/decorators/A_ConceptMethods.decorator.js.map +1 -0
  127. package/dist/src/decorators/A_Lazy.decorator.d.ts +5 -0
  128. package/dist/src/decorators/A_Lazy.decorator.js +20 -0
  129. package/dist/src/decorators/A_Lazy.decorator.js.map +1 -0
  130. package/dist/src/global/A-Component/A-Component.class.d.ts +16 -0
  131. package/dist/src/global/A-Component/A-Component.class.js +18 -0
  132. package/dist/src/global/A-Component/A-Component.class.js.map +1 -0
  133. package/dist/src/global/A-Concept/A_Concept.class.d.ts +46 -0
  134. package/dist/src/global/A-Concept/A_Concept.class.js +106 -0
  135. package/dist/src/global/A-Concept/A_Concept.class.js.map +1 -0
  136. package/dist/src/global/A-Concept/A_Concept.types.d.ts +26 -0
  137. package/dist/src/global/A-Concept/A_Concept.types.js +3 -0
  138. package/dist/src/global/A-Concept/A_Concept.types.js.map +1 -0
  139. package/dist/src/global/A-Container/A-Container.class.d.ts +14 -0
  140. package/dist/src/global/A-Container/A-Container.class.js +21 -0
  141. package/dist/src/global/A-Container/A-Container.class.js.map +1 -0
  142. package/dist/src/global/A-Context/A-Context.class.d.ts +88 -0
  143. package/dist/src/global/A-Context/A-Context.class.js +118 -0
  144. package/dist/src/global/A-Context/A-Context.class.js.map +1 -0
  145. package/dist/src/global/A-Context/A-Context.types.d.ts +0 -0
  146. package/dist/src/global/A-Context/A-Context.types.js +2 -0
  147. package/dist/src/global/A-Context/A-Context.types.js.map +1 -0
  148. package/dist/src/global/A-Dependency/A-DependencyReference.class.d.ts +17 -0
  149. package/dist/src/global/A-Dependency/A-DependencyReference.class.js +67 -0
  150. package/dist/src/global/A-Dependency/A-DependencyReference.class.js.map +1 -0
  151. package/dist/src/global/A-Dependency/A-DependencyReference.types.d.ts +55 -0
  152. package/dist/src/global/A-Dependency/A-DependencyReference.types.js +3 -0
  153. package/dist/src/global/A-Dependency/A-DependencyReference.types.js.map +1 -0
  154. package/dist/src/global/A-Namespace/A_Namespace.class.d.ts +47 -0
  155. package/dist/src/global/A-Namespace/A_Namespace.class.js +112 -0
  156. package/dist/src/global/A-Namespace/A_Namespace.class.js.map +1 -0
  157. package/dist/src/global/A-Namespace/A_Namespace.types.d.ts +19 -0
  158. package/dist/src/global/A-Namespace/A_Namespace.types.js +3 -0
  159. package/dist/src/global/A-Namespace/A_Namespace.types.js.map +1 -0
  160. package/dist/src/managers/A_DependencyManager.class.d.ts +24 -0
  161. package/dist/src/managers/A_DependencyManager.class.js +129 -0
  162. package/dist/src/managers/A_DependencyManager.class.js.map +1 -0
  163. package/dist/src/storage/A_Concept.storage.d.ts +19 -0
  164. package/dist/src/storage/A_Concept.storage.js +29 -0
  165. package/dist/src/storage/A_Concept.storage.js.map +1 -0
  166. package/dist/src/types/A_DependencyManager.types.d.ts +15 -0
  167. package/dist/src/types/A_DependencyManager.types.js +3 -0
  168. package/dist/src/types/A_DependencyManager.types.js.map +1 -0
  169. package/dist/src/types/A_Module.types.d.ts +17 -0
  170. package/dist/src/types/A_Module.types.js +22 -0
  171. package/dist/src/types/A_Module.types.js.map +1 -0
  172. package/docs/logo.png +0 -0
  173. package/examples/sdk/concept.ts +24 -0
  174. package/examples/sdk/orders.api.ts +21 -0
  175. package/examples/sdk/users.api.ts +21 -0
  176. package/examples/simple/concept.ts +16 -0
  177. package/examples/simple-http-server/concept.ts +30 -0
  178. package/examples/simple-http-server/containers/http-server.container.ts +69 -0
  179. package/examples/simple-http-server/containers/http-server.controller.ts +24 -0
  180. package/examples/simple-http-server/containers/http-server.router.ts +23 -0
  181. package/examples/simple-http-server/contexts/http-server.context.types.ts +108 -0
  182. package/examples/simple-http-server/contexts/http-server.namespace.ts +36 -0
  183. package/examples/simple-http-server/controllers/orders.controller.ts +20 -0
  184. package/examples/simple-http-server/controllers/users.controller.ts +104 -0
  185. package/index.ts +14 -0
  186. package/jest.config.ts +22 -0
  187. package/package.json +73 -0
  188. package/src/constants/A_ConceptLifecycle.constants.ts +12 -0
  189. package/src/containers/A-Config/A-Config.container.ts +60 -0
  190. package/src/containers/A-Config/A-Config.namespace.ts +98 -0
  191. package/src/containers/A-Config/A-Config.types.ts +31 -0
  192. package/src/containers/A-Config/components/ConfigReader.component.ts +30 -0
  193. package/src/containers/A-Config/components/ENVConfigReader.component.ts +31 -0
  194. package/src/containers/A-Config/components/FileConfigReader.component.ts +42 -0
  195. package/src/containers/A-Errors/A-Errors.container.ts +14 -0
  196. package/src/containers/A-Errors/A-Errors.namespace.ts +104 -0
  197. package/src/containers/A-Errors/A-Errors.types.ts +6 -0
  198. package/src/containers/A-Logger/A-Logger.container.ts +22 -0
  199. package/src/containers/A-Logger/A-Logger.namespace.ts +26 -0
  200. package/src/containers/A-Logger/A-Logger.types.ts +0 -0
  201. package/src/containers/A-Logger/components/Logger.component.ts +169 -0
  202. package/src/decorators/A-ConceptLifecycle/A-ConceptLifecycle.decorator.types.ts +46 -0
  203. package/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.ts +55 -0
  204. package/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.types.ts +20 -0
  205. package/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.ts +62 -0
  206. package/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.types.ts +28 -0
  207. package/src/decorators/A-ConceptLifecycle/index.ts +9 -0
  208. package/src/decorators/A-Feature/A-Feature.decorator.ts +13 -0
  209. package/src/decorators/A-Feature/A-Feature.decorator.types.ts +0 -0
  210. package/src/decorators/A-Inject/A-Inject.decorator.ts +75 -0
  211. package/src/decorators/A-Inject/A-Inject.decorator.types.ts +10 -0
  212. package/src/decorators/A_ConceptMethods.decorator.ts +0 -0
  213. package/src/decorators/A_Lazy.decorator.ts +31 -0
  214. package/src/global/A-Component/A-Component.class.ts +33 -0
  215. package/src/global/A-Concept/A_Concept.class.ts +143 -0
  216. package/src/global/A-Concept/A_Concept.types.ts +44 -0
  217. package/src/global/A-Container/A-Container.class.ts +39 -0
  218. package/src/global/A-Context/A-Context.class.ts +230 -0
  219. package/src/global/A-Context/A-Context.types.ts +0 -0
  220. package/src/global/A-Dependency/A-DependencyReference.class.ts +61 -0
  221. package/src/global/A-Dependency/A-DependencyReference.types.ts +61 -0
  222. package/src/global/A-Namespace/A_Namespace.class.ts +128 -0
  223. package/src/global/A-Namespace/A_Namespace.types.ts +24 -0
  224. package/src/storage/A_Concept.storage.ts +45 -0
  225. package/src/types/A_Module.types.ts +23 -0
  226. package/tests/context.test.ts +124 -0
  227. package/tests/default.test.ts +159 -0
  228. package/tests/log.ts +54 -0
  229. package/tests/polyfill.test.ts +37 -0
  230. package/tsconfig.json +61 -0
  231. package/tslint.json +98 -0
@@ -0,0 +1,19 @@
1
+ export declare const A_CONCEPT_STORAGE__MODULE_DECLARATION_Config: unique symbol;
2
+ export declare const A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootRun: unique symbol;
3
+ export declare const A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootLoad: unique symbol;
4
+ export declare const A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootBuild: unique symbol;
5
+ export declare const A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootPublish: unique symbol;
6
+ export declare const A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootTest: unique symbol;
7
+ /**
8
+ * Storage to keep the module declarations across all modules
9
+ */
10
+ export declare const A_CONCEPT_ModulesDeclarationStorage: WeakMap<any, Map<string | Symbol, any>>;
11
+ /**
12
+ * Storage to keep the lifecycle declarations across all modules
13
+ */
14
+ export declare const A_CONCEPT_LifecycleDeclarationsStorage: Map<Symbol, any>;
15
+ /**
16
+ * The simplest way to store the decorators
17
+ * If any extra API is needed, it can be added here or replaced with a new class
18
+ */
19
+ export declare const A_CONCEPT_Storage: WeakMap<object, any>;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.A_CONCEPT_Storage = exports.A_CONCEPT_LifecycleDeclarationsStorage = exports.A_CONCEPT_ModulesDeclarationStorage = exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootTest = exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootPublish = exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootBuild = exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootLoad = exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootRun = exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Config = void 0;
4
+ // --------------------------------------------------------------
5
+ // ----- A Concept -> Module Declaration -> Main Config ---------
6
+ // --------------------------------------------------------------
7
+ exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Config = Symbol('a-concept-modules-declaration');
8
+ // -------------------------------------------------------------------------------
9
+ // ----- A Concept -> Module Declaration -> Concept Lifecycle Extension_ ---------
10
+ // -------------------------------------------------------------------------------
11
+ exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootRun = Symbol('a-concept-modules-declaration-lifecycle-root-run');
12
+ exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootLoad = Symbol('a-concept-modules-declaration-lifecycle-root-load');
13
+ exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootBuild = Symbol('a-concept-modules-declaration-lifecycle-root-build');
14
+ exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootPublish = Symbol('a-concept-modules-declaration-lifecycle-root-publish');
15
+ exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootTest = Symbol('a-concept-modules-declaration-lifecycle-root-test');
16
+ /**
17
+ * Storage to keep the module declarations across all modules
18
+ */
19
+ exports.A_CONCEPT_ModulesDeclarationStorage = new WeakMap();
20
+ /**
21
+ * Storage to keep the lifecycle declarations across all modules
22
+ */
23
+ exports.A_CONCEPT_LifecycleDeclarationsStorage = new Map();
24
+ /**
25
+ * The simplest way to store the decorators
26
+ * If any extra API is needed, it can be added here or replaced with a new class
27
+ */
28
+ exports.A_CONCEPT_Storage = new WeakMap();
29
+ //# sourceMappingURL=A_Concept.storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"A_Concept.storage.js","sourceRoot":"","sources":["../../../src/storage/A_Concept.storage.ts"],"names":[],"mappings":";;;AAEA,iEAAiE;AACjE,iEAAiE;AACjE,iEAAiE;AACpD,QAAA,4CAA4C,GAAG,MAAM,CAAC,+BAA+B,CAAC,CAAC;AAIpG,kFAAkF;AAClF,mFAAmF;AACnF,kFAAkF;AACrE,QAAA,uDAAuD,GAAG,MAAM,CAAC,kDAAkD,CAAC,CAAC;AACrH,QAAA,wDAAwD,GAAG,MAAM,CAAC,mDAAmD,CAAC,CAAC;AACvH,QAAA,yDAAyD,GAAG,MAAM,CAAC,oDAAoD,CAAC,CAAC;AACzH,QAAA,2DAA2D,GAAG,MAAM,CAAC,sDAAsD,CAAC,CAAC;AAC7H,QAAA,wDAAwD,GAAG,MAAM,CAAC,mDAAmD,CAAC,CAAC;AAKpI;;GAEG;AACU,QAAA,mCAAmC,GAG5C,IAAI,OAAO,EAAE,CAAC;AAIlB;;GAEG;AACU,QAAA,sCAAsC,GAAqB,IAAI,GAAG,EAAE,CAAC;AAMlF;;;GAGG;AACU,QAAA,iBAAiB,GAAG,IAAI,OAAO,EAAE,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { A_Module } from "../global/A_Module.class";
2
+ export type A_DependencyManagerConstructorDependency = {
3
+ /**
4
+ * The name of the dependency
5
+ */
6
+ behavior: 'sync' | 'async';
7
+ /**
8
+ * The source of the dependency
9
+ * Could be:
10
+ * - a string representing the path to the module
11
+ * - a module class
12
+ * - a module class constructor
13
+ */
14
+ source: string | A_Module | typeof A_Module;
15
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=A_DependencyManager.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"A_DependencyManager.types.js","sourceRoot":"","sources":["../../../src/types/A_DependencyManager.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ export declare enum A_TYPES__ModuleState {
2
+ INIT = "INIT",
3
+ LOADING = "LOADING",
4
+ READY = "READY",
5
+ FAILED = "FAILED"
6
+ }
7
+ export declare enum A_TYPES__ModuleTypes {
8
+ /**
9
+ * Custom module type allows additional external control over the module
10
+ */
11
+ CUSTOM = "CUSTOM",
12
+ /**
13
+ * Default module type is a module that is used by default and has no additional control.
14
+ */
15
+ DEFAULT = "DEFAULT"
16
+ }
17
+ export type A_TYPES__ModuleConstructor = {};
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.A_TYPES__ModuleTypes = exports.A_TYPES__ModuleState = void 0;
4
+ var A_TYPES__ModuleState;
5
+ (function (A_TYPES__ModuleState) {
6
+ A_TYPES__ModuleState["INIT"] = "INIT";
7
+ A_TYPES__ModuleState["LOADING"] = "LOADING";
8
+ A_TYPES__ModuleState["READY"] = "READY";
9
+ A_TYPES__ModuleState["FAILED"] = "FAILED";
10
+ })(A_TYPES__ModuleState || (exports.A_TYPES__ModuleState = A_TYPES__ModuleState = {}));
11
+ var A_TYPES__ModuleTypes;
12
+ (function (A_TYPES__ModuleTypes) {
13
+ /**
14
+ * Custom module type allows additional external control over the module
15
+ */
16
+ A_TYPES__ModuleTypes["CUSTOM"] = "CUSTOM";
17
+ /**
18
+ * Default module type is a module that is used by default and has no additional control.
19
+ */
20
+ A_TYPES__ModuleTypes["DEFAULT"] = "DEFAULT";
21
+ })(A_TYPES__ModuleTypes || (exports.A_TYPES__ModuleTypes = A_TYPES__ModuleTypes = {}));
22
+ //# sourceMappingURL=A_Module.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"A_Module.types.js","sourceRoot":"","sources":["../../../src/types/A_Module.types.ts"],"names":[],"mappings":";;;AAAA,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC5B,qCAAa,CAAA;IACb,2CAAmB,CAAA;IACnB,uCAAe,CAAA;IACf,yCAAiB,CAAA;AACrB,CAAC,EALW,oBAAoB,oCAApB,oBAAoB,QAK/B;AAED,IAAY,oBAUX;AAVD,WAAY,oBAAoB;IAC5B;;OAEG;IACH,yCAAiB,CAAA;IAEjB;;OAEG;IACH,2CAAmB,CAAA;AACvB,CAAC,EAVW,oBAAoB,oCAApB,oBAAoB,QAU/B"}
package/docs/logo.png ADDED
Binary file
@@ -0,0 +1,24 @@
1
+ // import { A_Concept } from "@adaas/a-concept/global/A-Concept/A_Concept.class";
2
+ // import { UsersAPIModule } from "./users.api";
3
+ // import { OrdersAPIModule } from "./orders.api";
4
+
5
+
6
+ // (async () => {
7
+ // const simpleConcept = new A_Concept({
8
+ // name: 'simple-api-concept',
9
+ // modules: [
10
+ // new UsersAPIModule({
11
+ // behavior: 'sync'
12
+ // }),
13
+ // new OrdersAPIModule({
14
+ // behavior: 'sync'
15
+ // })
16
+ // ],
17
+ // context: [
18
+
19
+ // ]
20
+ // });
21
+
22
+ // await simpleConcept.run();
23
+
24
+ // })();
@@ -0,0 +1,21 @@
1
+ // import { A_Module } from "@adaas/a-concept/global/A_Module.class"
2
+
3
+
4
+ // declare module "@adaas/a-concept/global/A_Concept.class" {
5
+ // interface A_Concept {
6
+ // Orders: OrdersAPIModule;
7
+ // }
8
+ // }
9
+
10
+
11
+ // export class OrdersAPIModule extends A_Module {
12
+
13
+ // async makeSome1() {
14
+ // console.log('Making some request')
15
+ // }
16
+
17
+ // async makeSome2() {
18
+ // console.log('Making some request')
19
+ // }
20
+
21
+ // }
@@ -0,0 +1,21 @@
1
+ // import { A_Module } from "@adaas/a-concept/global/A_Module.class"
2
+
3
+
4
+ // declare module "@adaas/a-concept/global/A_Concept.class" {
5
+ // interface A_Concept {
6
+ // Users: UsersAPIModule;
7
+ // }
8
+ // }
9
+
10
+
11
+ // export class UsersAPIModule extends A_Module {
12
+
13
+ // async makeSome1() {
14
+ // console.log('Making some request')
15
+ // }
16
+
17
+ // async makeSome2() {
18
+ // console.log('Making some request')
19
+ // }
20
+
21
+ // }
@@ -0,0 +1,16 @@
1
+ // import { A_Concept } from "@adaas/a-concept/global/A-Concept/A_Concept.class";
2
+
3
+
4
+ // (async () => {
5
+ // const simpleConcept = new A_Concept({
6
+ // name: 'simple-concept',
7
+ // modules: [
8
+
9
+ // ],
10
+ // context: [
11
+ // ]
12
+ // });
13
+
14
+ // await simpleConcept.run();
15
+
16
+ // })();
@@ -0,0 +1,30 @@
1
+ import { A_Concept } from "@adaas/a-concept/global/A-Concept/A_Concept.class";
2
+ import { DefaultHttpServer } from "./containers/http-server.container";
3
+ import { HttpServer } from "./contexts/http-server.namespace";
4
+
5
+
6
+ (async () => {
7
+ const simpleConcept = new A_Concept({
8
+ name: 'test-server',
9
+ // import: [
10
+ // server1,
11
+ // server2
12
+ // ],
13
+ containers: [
14
+ DefaultHttpServer
15
+ ],
16
+ context: [
17
+ new HttpServer({
18
+ port: 3000
19
+ }),
20
+ new HttpServer({
21
+ port: 3001
22
+ })
23
+ ],
24
+ })
25
+
26
+
27
+
28
+ await simpleConcept.run();
29
+
30
+ })();
@@ -0,0 +1,69 @@
1
+ import { A_Container } from "@adaas/a-concept/global/A-Container/A-Container.class";
2
+ import { HttpServer } from "../contexts/http-server.namespace";
3
+ import { createServer, IncomingMessage, Server, ServerResponse } from "http";
4
+ import { A_Run } from "@adaas/a-concept/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator";
5
+ import { A_Inject } from "@adaas/a-concept/decorators/A-Inject/A-Inject.decorator";
6
+ // import { A_Feature } from "@adaas/a-concept/decorators/A-Feature/A-Feature.decorator";
7
+ import { A_Concept } from "@adaas/a-concept/global/A-Concept/A_Concept.class";
8
+ import { A_TYPES__A_CONCEPT_RootRunParams } from "@adaas/a-concept/global/A-Concept/A_Concept.types";
9
+ import { A_Lifecycle } from "@adaas/a-concept/decorators/A-ConceptLifecycle";
10
+ import { A_Config } from "src/containers/A-Config/A-Config.namespace";
11
+
12
+
13
+
14
+
15
+
16
+ export class DefaultHttpServer extends A_Container<HttpServer> {
17
+
18
+ server!: Server
19
+ port!: number
20
+
21
+ @A_Lifecycle.Load()
22
+ public async create(
23
+ concept: A_Concept,
24
+ @A_Inject(A_Config) config: A_Config<'PORT'>
25
+ ) {
26
+ // Set the server to listen on port 3000
27
+ this.port = config.get('PORT') || 3000;
28
+
29
+ // Create the HTTP server
30
+ this.server = createServer((req: IncomingMessage, res: ServerResponse) => {
31
+ // Set the response headers
32
+ res.statusCode = 200;
33
+ res.setHeader('Content-Type', 'text/plain');
34
+
35
+ // Routing logic (basic example)
36
+ if (req.url === '/') {
37
+ res.end('Welcome to the homepage!');
38
+ } else if (req.url === '/about') {
39
+ res.end('Welcome to the about page!');
40
+ } else {
41
+ res.statusCode = 404;
42
+ res.end('404 - Page not found');
43
+ }
44
+ });
45
+
46
+ this.namespace.registerServer(this.server, this.port);
47
+ }
48
+
49
+
50
+
51
+ @A_Run({})
52
+ async run(
53
+ params: A_TYPES__A_CONCEPT_RootRunParams,
54
+ ) {
55
+ this.server.listen(this.port, () => {
56
+ console.log(`Server is running on http://localhost:${this.port}`);
57
+ });
58
+ }
59
+
60
+
61
+
62
+ // @A_Feature({
63
+ // name: 'stop',
64
+ // description: 'Stop the server'
65
+ // })
66
+ // async stop() {
67
+
68
+ // }
69
+ }
@@ -0,0 +1,24 @@
1
+ import { A_Load } from "@adaas/a-concept/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator";
2
+ import { A_Container } from "@adaas/a-concept/global/A-Container/A-Container.class";
3
+ import { HttpServer } from "../contexts/http-server.namespace";
4
+ import { createServer, IncomingMessage, Server, ServerResponse } from "http";
5
+ import { A_Inject } from "@adaas/a-concept/decorators/A-Inject/A-Inject.decorator";
6
+ import { A_Concept } from "@adaas/a-concept/global/A-Concept/A_Concept.class";
7
+ import { A_Config } from "src/containers/A-Config/A-Config.namespace";
8
+
9
+
10
+
11
+
12
+
13
+ export class HttpServerController extends A_Container<HttpServer> {
14
+
15
+ @A_Load(
16
+ )
17
+ public async create(
18
+ concept: A_Concept,
19
+ @A_Inject(A_Config) config: A_Config<'PORT'>
20
+ ) {
21
+
22
+ }
23
+
24
+ }
@@ -0,0 +1,23 @@
1
+ import { A_Container } from "@adaas/a-concept/global/A-Container/A-Container.class";
2
+ import { HttpServer } from "../contexts/http-server.namespace";
3
+ import { createServer, IncomingMessage, Server, ServerResponse } from "http";
4
+ import { A_Inject } from "@adaas/a-concept/decorators/A-Inject/A-Inject.decorator";
5
+ import { A_Config } from "src/containers/A-Config/A-Config.namespace";
6
+ import { A_Lifecycle } from "@adaas/a-concept/decorators/A-ConceptLifecycle";
7
+
8
+
9
+
10
+
11
+
12
+ export class HttpServerRouter extends A_Container<HttpServer> {
13
+
14
+ @A_Lifecycle.Load()
15
+ public async listen(
16
+ @A_Inject(A_Config) config: A_Config<'PORT'>
17
+ ) {
18
+ const server = this.namespace.getServer(this.namespace.port);
19
+
20
+ // Do something with Server e.g. assign routes
21
+ }
22
+
23
+ }
@@ -0,0 +1,108 @@
1
+ import { A_Lifecycle } from "@adaas/a-concept/decorators/A-ConceptLifecycle";
2
+ import { A_Component } from "@adaas/a-concept/global/A-Component/A-Component.class";
3
+ import { A_Container } from "@adaas/a-concept/global/A-Container/A-Container.class";
4
+ import { A_Namespace } from "@adaas/a-concept/global/A-Namespace/A_Namespace.class";
5
+ import { A_TYPES__NamespaceConstructor } from "@adaas/a-concept/global/A-Namespace/A_Namespace.types";
6
+
7
+
8
+ export type A_TYPES__HttpServerNamespaceConstructor = {
9
+ port: number
10
+ } & A_TYPES__NamespaceConstructor
11
+
12
+
13
+
14
+
15
+
16
+
17
+ //=========== EXAMPLES============\
18
+
19
+
20
+ /**
21
+ * Stores information about DB connection, models, other things, etc.
22
+ */
23
+ class A_DB extends A_Namespace {
24
+
25
+ private models: Array<any> = [];
26
+ private connection: any;
27
+
28
+
29
+ registerModel(model: any) {
30
+ this.models.push(model);
31
+ }
32
+
33
+ connect(
34
+ connection: any
35
+ ) {
36
+ this.connection = connection;
37
+ }
38
+
39
+ }
40
+
41
+
42
+ /**
43
+ * Container that deals with the DB connection.
44
+ */
45
+ class PostgresDB extends A_Container<A_DB> {
46
+
47
+
48
+ @A_Lifecycle.Load()
49
+ async connect() {
50
+ // Connect to the DB
51
+ this.namespace.connect(
52
+ // Just for example
53
+ 'connection'
54
+ );
55
+ }
56
+
57
+
58
+ @A_Lifecycle.Load()
59
+ async init() {
60
+ this.namespace.registerModel(
61
+ // Just for example
62
+ 'model'
63
+ );
64
+ }
65
+ }
66
+
67
+
68
+ /**
69
+ * Stores information about the models with methods to interact with them.
70
+ */
71
+ class PostgresDBRepository extends A_Component {
72
+
73
+ async save(model: any) {
74
+ // Save the model
75
+ }
76
+
77
+ async find(model: any) {
78
+ // Find the model
79
+ }
80
+
81
+ async delete(model: any) {
82
+ // Delete the model
83
+ }
84
+
85
+ }
86
+
87
+
88
+
89
+ class A_Auth extends A_Namespace {
90
+
91
+ private users: Array<any> = [];
92
+
93
+ // dosomething<
94
+ // S extends A_TYPES__NamespaceConstructor,
95
+ // T extends A_Namespace<S>>(
96
+ // conatienr: typeof A_Container<T>,
97
+ // params: S
98
+
99
+ // ) { }
100
+
101
+ registerUser(user: any) {
102
+ this.users.push(user);
103
+
104
+ // Do something with the user
105
+
106
+
107
+ }
108
+ }
@@ -0,0 +1,36 @@
1
+ import { A_Namespace } from "@adaas/a-concept/global/A-Namespace/A_Namespace.class";
2
+ import { IncomingMessage, Server } from "http";
3
+ import { A_TYPES__HttpServerNamespaceConstructor } from "./http-server.context.types";
4
+
5
+
6
+ export class HttpServer extends A_Namespace<A_TYPES__HttpServerNamespaceConstructor> {
7
+
8
+ servers!: Map<string, Server>
9
+
10
+
11
+
12
+
13
+ get port(): number {
14
+ const [name, port] = this.name.split(':');
15
+
16
+ return parseInt(port);
17
+ }
18
+
19
+
20
+ registerServer(server: Server, port: number) {
21
+ this.servers.set(port.toString(), server);
22
+ }
23
+
24
+ getServer(port: number) {
25
+ return this.servers.get(port.toString());
26
+ }
27
+
28
+ parseBody(req: IncomingMessage): Promise<any> {
29
+ return new Promise((resolve, reject) => {
30
+ let body = '';
31
+ req.on('data', chunk => body += chunk.toString());
32
+ req.on('end', () => resolve(JSON.parse(body)));
33
+ req.on('error', reject);
34
+ });
35
+ }
36
+ }
@@ -0,0 +1,20 @@
1
+
2
+ // declare module "../modules/simple-http-server.types" {
3
+ // interface SimpleHTTPServerModuleControllers {
4
+ // Orders: OrderController
5
+ // }
6
+ // }
7
+
8
+ import { A_Component } from "@adaas/a-concept/global/A-Component/A-Component.class"
9
+
10
+ export class OrderController extends A_Component {
11
+
12
+ async makeSome1() {
13
+ console.log('Making some request')
14
+ }
15
+
16
+ async makeSome2() {
17
+ console.log('Making some request')
18
+ }
19
+
20
+ }
@@ -0,0 +1,104 @@
1
+ // import { A_Load } from "@adaas/a-concept/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator"
2
+ // import { A_Module } from "@adaas/a-concept/global/A_Module.class"
3
+ // import { SimpleHTTPServerModule } from "../modules/simple-http-server.module"
4
+ // import { IncomingMessage, ServerResponse } from "http"
5
+ // import { SimpleHTTPServerContext } from "../modules/simple-http-server.context"
6
+ // import { A_Dependency } from "@adaas/a-concept/decorators/A-Dependency/A-Dependency.decorator"
7
+ // import { A_Run } from "@adaas/a-concept/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator"
8
+ // import { A_Inject } from "@adaas/a-concept/decorators/A-Inject/A-Inject.decorator"
9
+ // import { OrderController } from "./orders.controller"
10
+
11
+ // declare module "../modules/simple-http-server.types" {
12
+ // interface SimpleHTTPServerModuleControllers {
13
+ // Users: UserController
14
+ // }
15
+ // }
16
+
17
+ // declare module "../modules/simple-http-server.context" {
18
+ // interface SimpleHTTPServerContext {
19
+ // users: Array<any>
20
+ // }
21
+ // }
22
+
23
+
24
+
25
+ // // @A_Dependency({
26
+ // // name: 'users-controller',
27
+ // // version: '0.0.1',
28
+ // // dependencies: [
29
+ // // SimpleHTTPServerModule
30
+ // // ]
31
+ // // })
32
+ // export class UserController extends A_Module {
33
+
34
+
35
+ // private SomeModule = A_Inject(OrderController)
36
+
37
+
38
+ // @A_Load(
39
+ // // after: [SimpleHTTPServerModule]
40
+ // )
41
+ // async defineListeners(
42
+ // ) {
43
+
44
+ // /**
45
+ // * Approach with Dependency Manager allows to resolve the module and context in the method
46
+ // */
47
+ // const simpleHTTPServerModule1 = await this.DM.resolve(SimpleHTTPServerModule);
48
+ // const context1 = await this.DM.resolve(SimpleHTTPServerContext);
49
+ // /**
50
+ // * OR
51
+ // *
52
+ // * It's possible to resolve multiple dependencies at once
53
+ // */
54
+ // const [
55
+ // simpleHTTPServerModule2,
56
+ // context
57
+ // ] = await this.DM.resolve([
58
+ // SimpleHTTPServerModule,
59
+ // SimpleHTTPServerContext
60
+ // ]);
61
+
62
+ // // simpleHTTPServerModule.create();
63
+ // context.users = [
64
+ // { id: 1, name: 'John Doe' },
65
+ // { id: 2, name: 'Jane Doe' }
66
+ // ];
67
+ // }
68
+
69
+
70
+
71
+ // @A_Load()
72
+ // /**
73
+ // *
74
+ // * Approach with direct injection allows to use the module directly in the method
75
+ // * However, this approach is not recommended as it makes the code less readable and testable
76
+ // * In the example below Injection changes the original method signature that may impact the readability/testability of the code
77
+ // *
78
+ // */
79
+ // async run(
80
+ // @A_Inject(SimpleHTTPServerModule) simpleHTTPServerModule: SimpleHTTPServerModule
81
+ // ) {
82
+ // // simpleHTTPServerModule.create();
83
+ // }
84
+
85
+
86
+ // async getUser(
87
+ // req: IncomingMessage,
88
+ // res: ServerResponse,
89
+ // id: number
90
+ // ) {
91
+
92
+ // const context = new SimpleHTTPServerContext()
93
+
94
+
95
+ // const user = context.users.find(u => u.id === id);
96
+ // if (user) {
97
+ // res.writeHead(200);
98
+ // res.end(JSON.stringify(user));
99
+ // } else {
100
+ // res.writeHead(404);
101
+ // res.end(JSON.stringify({ message: 'User not found' }));
102
+ // }
103
+ // }
104
+ // }
package/index.ts ADDED
@@ -0,0 +1,14 @@
1
+ export { A_Concept } from './src/global/A-Concept/A_Concept.class';
2
+ export * from './src/global/A-Concept/A_Concept.types';
3
+ export { A_Container } from './src/global/A-Container/A-Container.class';
4
+ // export * from './src/global/A-Container/A-Container.class';
5
+ export { A_Namespace } from './src/global/A-Namespace/A_Namespace.class';
6
+ export * from './src/global/A-Namespace/A_Namespace.types';
7
+ export { A_Inject } from './src/decorators/A-Inject/A-Inject.decorator';
8
+ export * from './src/decorators/A-Inject/A-Inject.decorator.types';
9
+ export { A_Load } from './src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator';
10
+ export * from './src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.types';
11
+ export { A_Run } from './src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator';
12
+ export * from './src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.types';
13
+
14
+ export { A_Lifecycle } from './src/decorators/A-ConceptLifecycle';