@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,87 @@
1
+ "use strict";
2
+ // import { A_Load } from "../../../src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator"
3
+ // import { A_Module } from "@adaas/a-concept/global/A_Module.class"
4
+ // import { SimpleHTTPServerModule } from "../modules/simple-http-server.module"
5
+ // import { IncomingMessage, ServerResponse } from "http"
6
+ // import { SimpleHTTPServerContext } from "../modules/simple-http-server.context"
7
+ // import { A_Dependency } from "@adaas/a-concept/decorators/A-Dependency/A-Dependency.decorator"
8
+ // import { A_Run } from "../../../src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator"
9
+ // import { A_Inject } from "../../../src/decorators/A-Inject/A-Inject.decorator"
10
+ // import { OrderController } from "./orders.controller"
11
+ // declare module "../modules/simple-http-server.types" {
12
+ // interface SimpleHTTPServerModuleControllers {
13
+ // Users: UserController
14
+ // }
15
+ // }
16
+ // declare module "../modules/simple-http-server.context" {
17
+ // interface SimpleHTTPServerContext {
18
+ // users: Array<any>
19
+ // }
20
+ // }
21
+ // // @A_Dependency({
22
+ // // name: 'users-controller',
23
+ // // version: '0.0.1',
24
+ // // dependencies: [
25
+ // // SimpleHTTPServerModule
26
+ // // ]
27
+ // // })
28
+ // export class UserController extends A_Module {
29
+ // private SomeModule = A_Inject(OrderController)
30
+ // @A_Load(
31
+ // // after: [SimpleHTTPServerModule]
32
+ // )
33
+ // async defineListeners(
34
+ // ) {
35
+ // /**
36
+ // * Approach with Dependency Manager allows to resolve the module and context in the method
37
+ // */
38
+ // const simpleHTTPServerModule1 = await this.DM.resolve(SimpleHTTPServerModule);
39
+ // const context1 = await this.DM.resolve(SimpleHTTPServerContext);
40
+ // /**
41
+ // * OR
42
+ // *
43
+ // * It's possible to resolve multiple dependencies at once
44
+ // */
45
+ // const [
46
+ // simpleHTTPServerModule2,
47
+ // context
48
+ // ] = await this.DM.resolve([
49
+ // SimpleHTTPServerModule,
50
+ // SimpleHTTPServerContext
51
+ // ]);
52
+ // // simpleHTTPServerModule.create();
53
+ // context.users = [
54
+ // { id: 1, name: 'John Doe' },
55
+ // { id: 2, name: 'Jane Doe' }
56
+ // ];
57
+ // }
58
+ // @A_Load()
59
+ // /**
60
+ // *
61
+ // * Approach with direct injection allows to use the module directly in the method
62
+ // * However, this approach is not recommended as it makes the code less readable and testable
63
+ // * In the example below Injection changes the original method signature that may impact the readability/testability of the code
64
+ // *
65
+ // */
66
+ // async run(
67
+ // @A_Inject(SimpleHTTPServerModule) simpleHTTPServerModule: SimpleHTTPServerModule
68
+ // ) {
69
+ // // simpleHTTPServerModule.create();
70
+ // }
71
+ // async getUser(
72
+ // req: IncomingMessage,
73
+ // res: ServerResponse,
74
+ // id: number
75
+ // ) {
76
+ // const context = new SimpleHTTPServerContext()
77
+ // const user = context.users.find(u => u.id === id);
78
+ // if (user) {
79
+ // res.writeHead(200);
80
+ // res.end(JSON.stringify(user));
81
+ // } else {
82
+ // res.writeHead(404);
83
+ // res.end(JSON.stringify({ message: 'User not found' }));
84
+ // }
85
+ // }
86
+ // }
87
+ //# sourceMappingURL=users.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"users.controller.js","sourceRoot":"","sources":["../../../../examples/simple-http-server/controllers/users.controller.ts"],"names":[],"mappings":";AAAA,kGAAkG;AAClG,oEAAoE;AACpE,gFAAgF;AAChF,yDAAyD;AACzD,kFAAkF;AAClF,iGAAiG;AACjG,+FAA+F;AAC/F,qFAAqF;AACrF,wDAAwD;AAExD,yDAAyD;AACzD,oDAAoD;AACpD,gCAAgC;AAChC,QAAQ;AACR,IAAI;AAEJ,2DAA2D;AAC3D,0CAA0C;AAC1C,4BAA4B;AAC5B,QAAQ;AACR,IAAI;AAIJ,qBAAqB;AACrB,mCAAmC;AACnC,2BAA2B;AAC3B,yBAAyB;AACzB,oCAAoC;AACpC,WAAW;AACX,QAAQ;AACR,iDAAiD;AAGjD,sDAAsD;AAGtD,eAAe;AACf,6CAA6C;AAC7C,QAAQ;AACR,6BAA6B;AAC7B,UAAU;AAEV,cAAc;AACd,qGAAqG;AACrG,cAAc;AACd,yFAAyF;AACzF,2EAA2E;AAC3E,cAAc;AACd,gBAAgB;AAChB,cAAc;AACd,oEAAoE;AACpE,cAAc;AACd,kBAAkB;AAClB,uCAAuC;AACvC,sBAAsB;AACtB,sCAAsC;AACtC,sCAAsC;AACtC,sCAAsC;AACtC,cAAc;AAEd,8CAA8C;AAC9C,4BAA4B;AAC5B,2CAA2C;AAC3C,0CAA0C;AAC1C,aAAa;AACb,QAAQ;AAIR,gBAAgB;AAChB,UAAU;AACV,UAAU;AACV,wFAAwF;AACxF,mGAAmG;AACnG,sIAAsI;AACtI,UAAU;AACV,UAAU;AACV,iBAAiB;AACjB,2FAA2F;AAC3F,UAAU;AACV,8CAA8C;AAC9C,QAAQ;AAGR,qBAAqB;AACrB,gCAAgC;AAChC,+BAA+B;AAC/B,qBAAqB;AACrB,UAAU;AAEV,wDAAwD;AAGxD,6DAA6D;AAC7D,sBAAsB;AACtB,kCAAkC;AAClC,6CAA6C;AAC7C,mBAAmB;AACnB,kCAAkC;AAClC,sEAAsE;AACtE,YAAY;AACZ,QAAQ;AACR,IAAI"}
@@ -0,0 +1,5 @@
1
+ import { IncomingMessage, Server } from "http";
2
+ export declare class SimpleHTTPServerContext {
3
+ server: Server;
4
+ parseBody(req: IncomingMessage): Promise<any>;
5
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.SimpleHTTPServerContext = void 0;
10
+ const A_Namespace_class_1 = require("../../../src/global/A-Namespace/A_Namespace.class");
11
+ let SimpleHTTPServerContext = class SimpleHTTPServerContext {
12
+ parseBody(req) {
13
+ return new Promise((resolve, reject) => {
14
+ let body = '';
15
+ req.on('data', chunk => body += chunk.toString());
16
+ req.on('end', () => resolve(JSON.parse(body)));
17
+ req.on('error', reject);
18
+ });
19
+ }
20
+ };
21
+ exports.SimpleHTTPServerContext = SimpleHTTPServerContext;
22
+ exports.SimpleHTTPServerContext = SimpleHTTPServerContext = __decorate([
23
+ (0, A_Namespace_class_1.A_Context)({})
24
+ ], SimpleHTTPServerContext);
25
+ //# sourceMappingURL=simple-http-server.context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple-http-server.context.js","sourceRoot":"","sources":["../../../../examples/simple-http-server/modules/simple-http-server.context.ts"],"names":[],"mappings":";;;;;;;;;AAAA,6FAAkF;AAM3E,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAIhC,SAAS,CAAC,GAAoB;QAC1B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACnC,IAAI,IAAI,GAAG,EAAE,CAAC;YACd,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;YAClD,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC/C,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AAZY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,6BAAS,EAAC,EAAE,CAAC;GACD,uBAAuB,CAYnC"}
@@ -0,0 +1,16 @@
1
+ import { A_Module } from "@adaas/a-concept/global/A_Module.class";
2
+ import { A_TYPES__ModuleConstructor } from "../../../src/types/A_Module.types";
3
+ import { Server } from 'http';
4
+ import { SimpleHTTPServerModuleControllers } from "./simple-http-server.types";
5
+ declare module "@adaas/a-concept/global/A-Concept/A_Concept.class" {
6
+ interface A_Concept {
7
+ server: any;
8
+ }
9
+ }
10
+ export type SimpleServerModuleConfig = {
11
+ port: number;
12
+ } & A_TYPES__ModuleConstructor;
13
+ export declare class SimpleHTTPServerModule extends A_Module<SimpleServerModuleConfig> {
14
+ server: Server;
15
+ controllers: SimpleHTTPServerModuleControllers;
16
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SimpleHTTPServerModule = void 0;
4
+ const A_Module_class_1 = require("@adaas/a-concept/global/A_Module.class");
5
+ class SimpleHTTPServerModule extends A_Module_class_1.A_Module {
6
+ }
7
+ exports.SimpleHTTPServerModule = SimpleHTTPServerModule;
8
+ //# sourceMappingURL=simple-http-server.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple-http-server.module.js","sourceRoot":"","sources":["../../../../examples/simple-http-server/modules/simple-http-server.module.ts"],"names":[],"mappings":";;;AACA,2EAAkE;AAmBlE,MAAa,sBAAuB,SAAQ,yBAAkC;CAM7E;AAND,wDAMC"}
@@ -0,0 +1,2 @@
1
+ export interface SimpleHTTPServerModuleControllers {
2
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=simple-http-server.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple-http-server.types.js","sourceRoot":"","sources":["../../../../examples/simple-http-server/modules/simple-http-server.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
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 { A_Namespace } from './src/global/A-Namespace/A_Namespace.class';
5
+ export * from './src/global/A-Namespace/A_Namespace.types';
6
+ export { A_Inject } from './src/decorators/A-Inject/A-Inject.decorator';
7
+ export * from './src/decorators/A-Inject/A-Inject.decorator.types';
8
+ export { A_Load } from './src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator';
9
+ export * from './src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.types';
10
+ export { A_Run } from './src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator';
11
+ export * from './src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.types';
12
+ export { A_Lifecycle } from './src/decorators/A-ConceptLifecycle';
package/dist/index.js ADDED
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.A_Lifecycle = exports.A_Run = exports.A_Load = exports.A_Inject = exports.A_Namespace = exports.A_Container = exports.A_Concept = void 0;
18
+ var A_Concept_class_1 = require("./src/global/A-Concept/A_Concept.class");
19
+ Object.defineProperty(exports, "A_Concept", { enumerable: true, get: function () { return A_Concept_class_1.A_Concept; } });
20
+ __exportStar(require("./src/global/A-Concept/A_Concept.types"), exports);
21
+ var A_Container_class_1 = require("./src/global/A-Container/A-Container.class");
22
+ Object.defineProperty(exports, "A_Container", { enumerable: true, get: function () { return A_Container_class_1.A_Container; } });
23
+ // export * from './src/global/A-Container/A-Container.class';
24
+ var A_Namespace_class_1 = require("./src/global/A-Namespace/A_Namespace.class");
25
+ Object.defineProperty(exports, "A_Namespace", { enumerable: true, get: function () { return A_Namespace_class_1.A_Namespace; } });
26
+ __exportStar(require("./src/global/A-Namespace/A_Namespace.types"), exports);
27
+ var A_Inject_decorator_1 = require("./src/decorators/A-Inject/A-Inject.decorator");
28
+ Object.defineProperty(exports, "A_Inject", { enumerable: true, get: function () { return A_Inject_decorator_1.A_Inject; } });
29
+ __exportStar(require("./src/decorators/A-Inject/A-Inject.decorator.types"), exports);
30
+ var A_Load_decorator_1 = require("./src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator");
31
+ Object.defineProperty(exports, "A_Load", { enumerable: true, get: function () { return A_Load_decorator_1.A_Load; } });
32
+ __exportStar(require("./src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.types"), exports);
33
+ var A_Run_decorator_1 = require("./src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator");
34
+ Object.defineProperty(exports, "A_Run", { enumerable: true, get: function () { return A_Run_decorator_1.A_Run; } });
35
+ __exportStar(require("./src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.types"), exports);
36
+ var A_ConceptLifecycle_1 = require("./src/decorators/A-ConceptLifecycle");
37
+ Object.defineProperty(exports, "A_Lifecycle", { enumerable: true, get: function () { return A_ConceptLifecycle_1.A_Lifecycle; } });
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0EAAmE;AAA1D,4GAAA,SAAS,OAAA;AAClB,yEAAuD;AACvD,gFAAyE;AAAhE,gHAAA,WAAW,OAAA;AACpB,8DAA8D;AAC9D,gFAAyE;AAAhE,gHAAA,WAAW,OAAA;AACpB,6EAA2D;AAC3D,mFAAwE;AAA/D,8GAAA,QAAQ,OAAA;AACjB,qFAAmE;AACnE,gGAAqF;AAA5E,0GAAA,MAAM,OAAA;AACf,oGAAkF;AAClF,6FAAkF;AAAzE,wGAAA,KAAK,OAAA;AACd,kGAAgF;AAEhF,0EAAkE;AAAzD,iHAAA,WAAW,OAAA"}
@@ -0,0 +1,2 @@
1
+ import { A_TYPES__ConceptLifecycle_MethodDeclarationConfig } from "../decorators/A-ConceptLifecycle/A-ConceptLifecycle.decorator.types";
2
+ export declare const A_CONSTANTS__DEFAULT_CONCEPT_LIFECYCLE_METHOD_DECLARATION_CONFIG: A_TYPES__ConceptLifecycle_MethodDeclarationConfig;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.A_CONSTANTS__DEFAULT_CONCEPT_LIFECYCLE_METHOD_DECLARATION_CONFIG = void 0;
4
+ exports.A_CONSTANTS__DEFAULT_CONCEPT_LIFECYCLE_METHOD_DECLARATION_CONFIG = {
5
+ name: '',
6
+ behavior: 'sync',
7
+ type: 'extension',
8
+ after: [],
9
+ before: [],
10
+ override: []
11
+ };
12
+ //# sourceMappingURL=A_ConceptLifecycle.constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"A_ConceptLifecycle.constants.js","sourceRoot":"","sources":["../../../src/constants/A_ConceptLifecycle.constants.ts"],"names":[],"mappings":";;;AAIa,QAAA,gEAAgE,GAAsD;IAC/H,IAAI,EAAE,EAAE;IACR,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,EAAE;CACf,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { A_Container } from "../../global/A-Container/A-Container.class";
2
+ import { A_Config } from "./A-Config.namespace";
3
+ export declare class A_ConfigInitializer extends A_Container<A_Config> {
4
+ private reader;
5
+ identifyReader(): Promise<void>;
6
+ readVariables(): Promise<void>;
7
+ }
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
9
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
10
+ return new (P || (P = Promise))(function (resolve, reject) {
11
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
12
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
13
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
14
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
15
+ });
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.A_ConfigInitializer = void 0;
19
+ const A_Container_class_1 = require("../../global/A-Container/A-Container.class");
20
+ const A_Load_decorator_1 = require("../../decorators/A-ConceptLifecycle/A-Load/A-Load.decorator");
21
+ const a_utils_1 = require("@adaas/a-utils");
22
+ const FileConfigReader_component_1 = require("./components/FileConfigReader.component");
23
+ const ENVConfigReader_component_1 = require("./components/ENVConfigReader.component");
24
+ const A_Context_class_1 = require("../../global/A-Context/A-Context.class");
25
+ // @A_Injectable({
26
+ // })
27
+ class A_ConfigInitializer extends A_Container_class_1.A_Container {
28
+ identifyReader(
29
+ // @A_Inject(A_LoggerContext) logger: A_LoggerContext
30
+ ) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ // OR Inject the logger by calling Context Provider
33
+ // const logger2 = await this.CP.resolve(A_LoggerContext);
34
+ const fs = yield a_utils_1.A_Polyfills.fs();
35
+ switch (true) {
36
+ case A_Context_class_1.A_Context.environment === 'server' && !!fs.existsSync(`${this.namespace}.conf.json`):
37
+ this.reader = A_Context_class_1.A_Context.resolve(FileConfigReader_component_1.FileConfigReader);
38
+ break;
39
+ case A_Context_class_1.A_Context.environment === 'server':
40
+ !fs.existsSync(`${this.namespace}.conf.json`);
41
+ this.reader = A_Context_class_1.A_Context.resolve(ENVConfigReader_component_1.ENVConfigReader);
42
+ break;
43
+ case A_Context_class_1.A_Context.environment === 'browser':
44
+ this.reader = A_Context_class_1.A_Context.resolve(ENVConfigReader_component_1.ENVConfigReader);
45
+ break;
46
+ default:
47
+ throw new Error(`Environment ${A_Context_class_1.A_Context.environment} is not supported`);
48
+ }
49
+ });
50
+ }
51
+ readVariables() {
52
+ return __awaiter(this, void 0, void 0, function* () {
53
+ const config = yield this.reader.read(this.namespace.CONFIG_PROPERTIES);
54
+ this.namespace.set(config);
55
+ });
56
+ }
57
+ }
58
+ exports.A_ConfigInitializer = A_ConfigInitializer;
59
+ __decorate([
60
+ (0, A_Load_decorator_1.A_Load)({})
61
+ ], A_ConfigInitializer.prototype, "identifyReader", null);
62
+ __decorate([
63
+ (0, A_Load_decorator_1.A_Load)({})
64
+ ], A_ConfigInitializer.prototype, "readVariables", null);
65
+ //# sourceMappingURL=A-Config.container.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"A-Config.container.js","sourceRoot":"","sources":["../../../../src/containers/A-Config/A-Config.container.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,6FAAoF;AAEpF,6GAAgG;AAChG,4CAA6C;AAC7C,wFAA2E;AAC3E,sFAAyE;AAEzE,uFAA8E;AAI9E,kBAAkB;AAElB,KAAK;AACL,MAAa,mBAAoB,SAAQ,+BAAqB;IAOpD,cAAc;IAChB,qDAAqD;;;YAGrD,mDAAmD;YACnD,0DAA0D;YAE1D,MAAM,EAAE,GAAG,MAAM,qBAAW,CAAC,EAAE,EAAE,CAAC;YAElC,QAAQ,IAAI,EAAE,CAAC;gBAEX,KAAK,2BAAS,CAAC,WAAW,KAAK,QAAQ,IAAI,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,SAAS,YAAY,CAAC;oBACrF,IAAI,CAAC,MAAM,GAAG,2BAAS,CAAC,OAAO,CAAC,6CAAgB,CAAC,CAAC;oBAClD,MAAM;gBAGV,KAAK,2BAAS,CAAC,WAAW,KAAK,QAAQ;oBAAE,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,SAAS,YAAY,CAAC,CAAA;oBAClF,IAAI,CAAC,MAAM,GAAG,2BAAS,CAAC,OAAO,CAAC,2CAAe,CAAC,CAAC;oBACjD,MAAM;gBAEV,KAAK,2BAAS,CAAC,WAAW,KAAK,SAAS;oBACpC,IAAI,CAAC,MAAM,GAAG,2BAAS,CAAC,OAAO,CAAC,2CAAe,CAAC,CAAC;oBACjD,MAAM;gBAEV;oBACI,MAAM,IAAI,KAAK,CAAC,eAAe,2BAAS,CAAC,WAAW,mBAAmB,CAAC,CAAC;YACjF,CAAC;QACL,CAAC;KAAA;IAIK,aAAa;;YACf,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;YAExE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC/B,CAAC;KAAA;CAGJ;AA7CD,kDA6CC;AAtCS;IAFL,IAAA,yBAAM,EAAC,EACP,CAAC;yDA4BD;AAIK;IADL,IAAA,yBAAM,EAAC,EAAE,CAAC;wDAKV"}
@@ -0,0 +1,28 @@
1
+ import { A_Namespace } from "../../global/A-Namespace/A_Namespace.class";
2
+ import { A_TYPES__ConfigContainerConstructor } from "./A-Config.types";
3
+ export declare class A_Config<T extends string = any> extends A_Namespace<A_TYPES__ConfigContainerConstructor<T>> {
4
+ private VARIABLES;
5
+ CONFIG_PROPERTIES: T[];
6
+ protected DEFAULT_ALLOWED_TO_READ_PROPERTIES: readonly ["CONFIG_SDK_VALIDATION", "CONFIG_VERBOSE", "CONFIG_IGNORE_ERRORS"];
7
+ constructor(config: A_TYPES__ConfigContainerConstructor<T>);
8
+ /**
9
+ * This method is used to get the configuration property by name
10
+ *
11
+ * @param property
12
+ * @returns
13
+ */
14
+ get<_OutType = any>(property: T | typeof this.DEFAULT_ALLOWED_TO_READ_PROPERTIES[number]): _OutType;
15
+ /**
16
+ *
17
+ * This method is used to set the configuration property by name
18
+ * OR set multiple properties at once by passing an array of objects
19
+ *
20
+ * @param variables
21
+ */
22
+ set<V extends string = T | typeof this.DEFAULT_ALLOWED_TO_READ_PROPERTIES[number]>(variables: Array<{
23
+ property: V;
24
+ value: any;
25
+ }>): any;
26
+ set<V extends string = T | typeof this.DEFAULT_ALLOWED_TO_READ_PROPERTIES[number]>(variables: Record<V, any>): any;
27
+ set<V extends string = T | typeof this.DEFAULT_ALLOWED_TO_READ_PROPERTIES[number]>(property: V, value: any): any;
28
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.A_Config = void 0;
4
+ const A_Namespace_class_1 = require("../../global/A-Namespace/A_Namespace.class");
5
+ class A_Config extends A_Namespace_class_1.A_Namespace {
6
+ constructor(config) {
7
+ super(config);
8
+ // Custom properties
9
+ this.VARIABLES = new Map();
10
+ this.CONFIG_PROPERTIES = [];
11
+ this.DEFAULT_ALLOWED_TO_READ_PROPERTIES = [
12
+ 'CONFIG_SDK_VALIDATION',
13
+ 'CONFIG_VERBOSE',
14
+ 'CONFIG_IGNORE_ERRORS',
15
+ ];
16
+ const targetConfig = config;
17
+ this.CONFIG_PROPERTIES = targetConfig.variables ? targetConfig.variables : [];
18
+ }
19
+ /**
20
+ * This method is used to get the configuration property by name
21
+ *
22
+ * @param property
23
+ * @returns
24
+ */
25
+ get(property) {
26
+ if (this.CONFIG_PROPERTIES.includes(property))
27
+ return this.VARIABLES.get(property);
28
+ throw new Error('Property not exists or not allowed to read');
29
+ // return this.concept.Errors.throw(A_SDK_CONSTANTS__ERROR_CODES.CONFIGURATION_PROPERTY_NOT_EXISTS_OR_NOT_ALLOWED_TO_READ) as never;
30
+ }
31
+ set(property, value) {
32
+ var _a;
33
+ const array = Array.isArray(property)
34
+ ? property
35
+ : typeof property === 'string'
36
+ ? [{ property, value }]
37
+ : Object
38
+ .keys(property)
39
+ .map((key) => ({
40
+ property: key,
41
+ value: property[key]
42
+ }));
43
+ for (const { property, value } of array) {
44
+ let targetValue = value
45
+ ? value
46
+ : ((_a = this.config) === null || _a === void 0 ? void 0 : _a.defaults)
47
+ ? this.config.defaults[property]
48
+ : undefined;
49
+ this.VARIABLES.set(property, targetValue);
50
+ }
51
+ }
52
+ }
53
+ exports.A_Config = A_Config;
54
+ //# sourceMappingURL=A-Config.namespace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"A-Config.namespace.js","sourceRoot":"","sources":["../../../../src/containers/A-Config/A-Config.namespace.ts"],"names":[],"mappings":";;;AAAA,6FAAoF;AAIpF,MAAa,QAEX,SAAQ,+BAAmD;IAazD,YACI,MAA8C;QAE9C,KAAK,CAAC,MAAM,CAAC,CAAC;QAdlB,oBAAoB;QACZ,cAAS,GAAqB,IAAI,GAAG,EAAe,CAAC;QAC7D,sBAAiB,GAAQ,EAAE,CAAC;QAElB,uCAAkC,GAAG;YAC3C,uBAAuB;YACvB,gBAAgB;YAChB,sBAAsB;SAChB,CAAC;QAQP,MAAM,YAAY,GAAG,MAAM,CAAA;QAE3B,IAAI,CAAC,iBAAiB,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IAClF,CAAC;IAGD;;;;;OAKG;IACH,GAAG,CACC,QAAoE;QAEpE,IAAI,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,QAAe,CAAC;YAChD,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAkB,CAAa,CAAC;QAE9D,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAU,CAAC;QACvE,oIAAoI;IACxI,CAAC;IAwBD,GAAG,CACC,QAGmB,EACnB,KAAW;;QAEX,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;YACjC,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,OAAO,QAAQ,KAAK,QAAQ;gBAC1B,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;gBACvB,CAAC,CAAC,MAAM;qBACH,IAAI,CAAC,QAAQ,CAAC;qBACd,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;oBACX,QAAQ,EAAE,GAAG;oBACb,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC;iBACvB,CAAC,CAAC,CAAC;QAEhB,KAAK,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,KAAK,EAAE,CAAC;YAEtC,IAAI,WAAW,GAAG,KAAK;gBACnB,CAAC,CAAC,KAAK;gBACP,CAAC,CAAC,CAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,QAAQ;oBACnB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAa,CAAC;oBACrC,CAAC,CAAC,SAAS,CAAC;YAEpB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAkB,EAAE,WAAW,CAAC,CAAC;QACxD,CAAC;IACL,CAAC;CACJ;AA7FD,4BA6FC"}
@@ -0,0 +1,12 @@
1
+ import { A_TYPES__NamespaceConstructor } from "../../global/A-Namespace/A_Namespace.types";
2
+ export type A_TYPES__ConfigContainerConstructor<T extends string> = {
3
+ /**
4
+ * The name of the Config Container
5
+ */
6
+ variables?: Array<T>;
7
+ /**
8
+ * Allows to set the default values for the variables
9
+ */
10
+ defaults?: Record<T, any>;
11
+ } & A_TYPES__NamespaceConstructor;
12
+ export type A_TYPES__ConfigContainer_DefaultProperties = 'CONFIG_SDK_VALIDATION' | 'CONFIG_VERBOSE' | 'CONFIG_IGNORE_ERRORS';
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=A-Config.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"A-Config.types.js","sourceRoot":"","sources":["../../../../src/containers/A-Config/A-Config.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import { A_Component } from "../../../global/A-Component/A-Component.class";
2
+ import { A_Config } from "../A-Config.namespace";
3
+ /**
4
+ * Config Reader
5
+ */
6
+ export declare class ConfigReader extends A_Component<A_Config> {
7
+ /**
8
+ * Get the configuration property by Name
9
+ * @param property
10
+ */
11
+ resolve<_ReturnType = any>(property: string): _ReturnType;
12
+ /**
13
+ * This method reads the configuration and sets the values to the context
14
+ *
15
+ * @returns
16
+ */
17
+ read<T extends string>(variables?: Array<T>): Promise<Record<T, any>>;
18
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ConfigReader = void 0;
13
+ const A_Component_class_1 = require("../../../global/A-Component/A-Component.class");
14
+ /**
15
+ * Config Reader
16
+ */
17
+ class ConfigReader extends A_Component_class_1.A_Component {
18
+ /**
19
+ * Get the configuration property by Name
20
+ * @param property
21
+ */
22
+ resolve(property) {
23
+ return property;
24
+ }
25
+ /**
26
+ * This method reads the configuration and sets the values to the context
27
+ *
28
+ * @returns
29
+ */
30
+ read() {
31
+ return __awaiter(this, arguments, void 0, function* (variables = []) {
32
+ return {};
33
+ });
34
+ }
35
+ }
36
+ exports.ConfigReader = ConfigReader;
37
+ //# sourceMappingURL=ConfigReader.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigReader.component.js","sourceRoot":"","sources":["../../../../../src/containers/A-Config/components/ConfigReader.component.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6FAAoF;AAKpF;;GAEG;AACH,MAAa,YAAa,SAAQ,+BAAqB;IAGnD;;;OAGG;IACH,OAAO,CAAoB,QAAgB;QACvC,OAAO,QAAuB,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACG,IAAI;6DACN,YAAsB,EAAE;YAExB,OAAO,EAAoB,CAAC;QAChC,CAAC;KAAA;CACJ;AArBD,oCAqBC"}
@@ -0,0 +1,10 @@
1
+ import { ConfigReader } from "./ConfigReader.component";
2
+ export declare class ENVConfigReader extends ConfigReader {
3
+ /**
4
+ * Get the configuration property Name
5
+ * @param property
6
+ */
7
+ getConfigurationProperty_ENV_Alias(property: string): string;
8
+ resolve<_ReturnType = any>(property: string): _ReturnType;
9
+ read<T extends string>(variables?: Array<T>): Promise<Record<T, any>>;
10
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ENVConfigReader = void 0;
13
+ const a_utils_1 = require("@adaas/a-utils");
14
+ const ConfigReader_component_1 = require("./ConfigReader.component");
15
+ class ENVConfigReader extends ConfigReader_component_1.ConfigReader {
16
+ /**
17
+ * Get the configuration property Name
18
+ * @param property
19
+ */
20
+ getConfigurationProperty_ENV_Alias(property) {
21
+ return `${a_utils_1.A_CommonHelper.toUpperSnakeCase(this.namespace.name)}_${a_utils_1.A_CommonHelper.toUpperSnakeCase(property)}`;
22
+ }
23
+ resolve(property) {
24
+ return process.env[this.getConfigurationProperty_ENV_Alias(property)];
25
+ }
26
+ read() {
27
+ return __awaiter(this, arguments, void 0, function* (variables = []) {
28
+ const config = {};
29
+ variables.forEach(variable => {
30
+ config[variable] = this.resolve(variable);
31
+ });
32
+ return config;
33
+ });
34
+ }
35
+ }
36
+ exports.ENVConfigReader = ENVConfigReader;
37
+ //# sourceMappingURL=ENVConfigReader.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ENVConfigReader.component.js","sourceRoot":"","sources":["../../../../../src/containers/A-Config/components/ENVConfigReader.component.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAgD;AAChD,qEAAwD;AAGxD,MAAa,eAAgB,SAAQ,qCAAY;IAG7C;;;OAGG;IACH,kCAAkC,CAAC,QAAgB;QAC/C,OAAO,GAAG,wBAAc,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,wBAAc,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;IAClH,CAAC;IAGD,OAAO,CAAoB,QAAgB;QACvC,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,kCAAkC,CAAC,QAAQ,CAAC,CAAgB,CAAC;IACzF,CAAC;IAGK,IAAI;6DAAmB,YAAsB,EAAE;YACjD,MAAM,MAAM,GAAmB,EAAoB,CAAC;YAEpD,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;gBACzB,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC9C,CAAC,CAAC,CAAC;YAEH,OAAO,MAAM,CAAC;QAClB,CAAC;KAAA;CACJ;AA1BD,0CA0BC"}
@@ -0,0 +1,11 @@
1
+ import { ConfigReader } from "./ConfigReader.component";
2
+ export declare class FileConfigReader extends ConfigReader {
3
+ private FileData;
4
+ /**
5
+ * Get the configuration property Name
6
+ * @param property
7
+ */
8
+ getConfigurationProperty_File_Alias(property: string): string;
9
+ resolve<_ReturnType = any>(property: string): _ReturnType;
10
+ read<T extends string>(variables?: Array<T>): Promise<Record<T, any>>;
11
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.FileConfigReader = void 0;
13
+ const a_utils_1 = require("@adaas/a-utils");
14
+ const ConfigReader_component_1 = require("./ConfigReader.component");
15
+ class FileConfigReader extends ConfigReader_component_1.ConfigReader {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.FileData = new Map();
19
+ }
20
+ /**
21
+ * Get the configuration property Name
22
+ * @param property
23
+ */
24
+ getConfigurationProperty_File_Alias(property) {
25
+ return a_utils_1.A_CommonHelper.toCamelCase(property);
26
+ }
27
+ resolve(property) {
28
+ return this.FileData.get(this.getConfigurationProperty_File_Alias(property));
29
+ }
30
+ read(variables) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ const fs = yield a_utils_1.A_Polyfills.fs();
33
+ try {
34
+ const data = fs.readFileSync(`${this.namespace.name}.conf.json`, 'utf8');
35
+ const config = JSON.parse(data);
36
+ this.FileData = new Map(Object.entries(config));
37
+ return config;
38
+ }
39
+ catch (error) {
40
+ // this.context.Logger.error(error);
41
+ return {};
42
+ }
43
+ });
44
+ }
45
+ }
46
+ exports.FileConfigReader = FileConfigReader;
47
+ //# sourceMappingURL=FileConfigReader.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileConfigReader.component.js","sourceRoot":"","sources":["../../../../../src/containers/A-Config/components/FileConfigReader.component.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA6D;AAC7D,qEAAwD;AAIxD,MAAa,gBAAiB,SAAQ,qCAAY;IAAlD;;QAEY,aAAQ,GAAqB,IAAI,GAAG,EAAe,CAAC;IAkChE,CAAC;IAhCG;;;OAGG;IACH,mCAAmC,CAAC,QAAgB;QAChD,OAAO,wBAAc,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC;IAGD,OAAO,CAAoB,QAAgB;QACvC,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,mCAAmC,CAAC,QAAQ,CAAC,CAAgB,CAAC;IAChG,CAAC;IAGK,IAAI,CACN,SAAoB;;YAEpB,MAAM,EAAE,GAAG,MAAM,qBAAW,CAAC,EAAE,EAAE,CAAC;YAClC,IAAI,CAAC;gBACD,MAAM,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,YAAY,EAAE,MAAM,CAAC,CAAC;gBAEzE,MAAM,MAAM,GAAmB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAEhD,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;gBAEhD,OAAO,MAAM,CAAC;YAElB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,oCAAoC;gBACpC,OAAO,EAAoB,CAAC;YAChC,CAAC;QACL,CAAC;KAAA;CACJ;AApCD,4CAoCC"}