@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,5 @@
1
+ import { A_Container } from "../../global/A-Container/A-Container.class";
2
+ import { A_Errors } from "./A-Errors.namespace";
3
+ export declare class A_ErrorsInitializer extends A_Container<A_Errors> {
4
+ init(): Promise<void>;
5
+ }
@@ -0,0 +1,32 @@
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_ErrorsInitializer = 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
+ class A_ErrorsInitializer extends A_Container_class_1.A_Container {
22
+ init() {
23
+ return __awaiter(this, void 0, void 0, function* () {
24
+ yield this.namespace.ready;
25
+ });
26
+ }
27
+ }
28
+ exports.A_ErrorsInitializer = A_ErrorsInitializer;
29
+ __decorate([
30
+ (0, A_Load_decorator_1.A_Load)({})
31
+ ], A_ErrorsInitializer.prototype, "init", null);
32
+ //# sourceMappingURL=A-Errors.container.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"A-Errors.container.js","sourceRoot":"","sources":["../../../../src/containers/A-Errors/A-Errors.container.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,6FAAoF;AAEpF,6GAAgG;AAIhG,MAAa,mBAAoB,SAAQ,+BAAqB;IAGpD,IAAI;;YACN,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;QAC/B,CAAC;KAAA;CAEJ;AAPD,kDAOC;AAJS;IADL,IAAA,yBAAM,EAAC,EAAE,CAAC;+CAGV"}
@@ -0,0 +1,40 @@
1
+ import { A_Namespace } from "../../global/A-Namespace/A_Namespace.class";
2
+ import { A_CONSTANTS__ERROR_CODES, A_Error, A_ServerError, A_TYPES__Dictionary, A_TYPES__Error, A_TYPES__ServerError } from "@adaas/a-utils";
3
+ import { A_TYPES__A_ErrorsConstructor } from "./A-Errors.types";
4
+ export declare class A_Errors extends A_Namespace<Partial<A_TYPES__A_ErrorsConstructor>> {
5
+ protected registeredErrors: Map<string, A_TYPES__Error | A_TYPES__ServerError>;
6
+ constructor(params: Partial<A_TYPES__A_ErrorsConstructor>);
7
+ /**
8
+ * This method adds a dictionary of errors to the registry.
9
+ *
10
+ * @param registry
11
+ */
12
+ addRegistry(registry: A_TYPES__Dictionary<A_TYPES__Error> | A_TYPES__Error[]): A_Errors;
13
+ /**
14
+ *
15
+ * Adds an error to the registry
16
+ *
17
+ * @param error
18
+ */
19
+ registerError(error: A_TYPES__Error): A_Errors;
20
+ /**
21
+ * This method returns an error object by its code.
22
+ *
23
+ * @param code
24
+ * @returns
25
+ */
26
+ getError(code: A_CONSTANTS__ERROR_CODES | string): A_ServerError | A_Error | undefined;
27
+ /**
28
+ * This method throws an error by its code.
29
+ *
30
+ * @param code
31
+ */
32
+ throw(code: A_CONSTANTS__ERROR_CODES | string): never;
33
+ /**
34
+ * This method wraps an error into the SDK error object.
35
+ *
36
+ * @param error
37
+ * @returns
38
+ */
39
+ wrap(error: Error | A_Error | unknown): A_ServerError | A_Error;
40
+ }
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.A_Errors = void 0;
4
+ const A_Namespace_class_1 = require("../../global/A-Namespace/A_Namespace.class");
5
+ const a_utils_1 = require("@adaas/a-utils");
6
+ const errors_constants_1 = require("@adaas/a-utils/dist/src/constants/errors.constants");
7
+ class A_Errors extends A_Namespace_class_1.A_Namespace {
8
+ constructor(params) {
9
+ super(params);
10
+ this.registeredErrors = new Map();
11
+ if (params.errors) {
12
+ this.addRegistry(params.errors);
13
+ }
14
+ this.addRegistry(errors_constants_1.A_CONSTANTS__DEFAULT_ERRORS);
15
+ }
16
+ /**
17
+ * This method adds a dictionary of errors to the registry.
18
+ *
19
+ * @param registry
20
+ */
21
+ addRegistry(registry) {
22
+ const errors = Array.isArray(registry) ? registry : Object.values(registry);
23
+ errors.forEach(err => this.registerError(err));
24
+ return this;
25
+ }
26
+ /**
27
+ *
28
+ * Adds an error to the registry
29
+ *
30
+ * @param error
31
+ */
32
+ registerError(error) {
33
+ this.registeredErrors.set(error.code, Object.assign(Object.assign({}, error), { code: `${this.name}@error:${error.code}` }));
34
+ return this;
35
+ }
36
+ /**
37
+ * This method returns an error object by its code.
38
+ *
39
+ * @param code
40
+ * @returns
41
+ */
42
+ getError(code) {
43
+ let template = this.registeredErrors.get(code);
44
+ if (!template)
45
+ template = this.registeredErrors.get(a_utils_1.A_CONSTANTS__ERROR_CODES.UNEXPECTED_ERROR);
46
+ if (template.serverCode) {
47
+ return new a_utils_1.A_ServerError(template);
48
+ }
49
+ else {
50
+ return new a_utils_1.A_Error(template);
51
+ }
52
+ }
53
+ /**
54
+ * This method throws an error by its code.
55
+ *
56
+ * @param code
57
+ */
58
+ throw(code) {
59
+ const err = this.getError(code);
60
+ throw err;
61
+ }
62
+ /**
63
+ * This method wraps an error into the SDK error object.
64
+ *
65
+ * @param error
66
+ * @returns
67
+ */
68
+ wrap(error) {
69
+ if (error instanceof a_utils_1.A_Error) {
70
+ return new a_utils_1.A_ServerError(error);
71
+ }
72
+ return new a_utils_1.A_Error(error);
73
+ }
74
+ }
75
+ exports.A_Errors = A_Errors;
76
+ //# sourceMappingURL=A-Errors.namespace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"A-Errors.namespace.js","sourceRoot":"","sources":["../../../../src/containers/A-Errors/A-Errors.namespace.ts"],"names":[],"mappings":";;;AAAA,6FAAoF;AACpF,4CAA6I;AAE7I,yFAAiG;AAGjG,MAAa,QAAS,SAAQ,+BAAkD;IAM5E,YACI,MAA6C;QAE7C,KAAK,CAAC,MAAM,CAAC,CAAC;QALR,qBAAgB,GAAuD,IAAI,GAAG,EAAE,CAAC;QAOvF,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACpC,CAAC;QACD,IAAI,CAAC,WAAW,CAAC,8CAA2B,CAAC,CAAC;IAClD,CAAC;IAGD;;;;OAIG;IACH,WAAW,CACP,QAAgE;QAEhE,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAE5E,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;QAE/C,OAAO,IAAI,CAAC;IAChB,CAAC;IAGD;;;;;OAKG;IACH,aAAa,CAAC,KAAqB;QAC/B,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,kCAC7B,KAAK,KACR,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,UAAU,KAAK,CAAC,IAAI,EAAE,IAC1C,CAAC;QAEH,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACH,QAAQ,CAAC,IAAuC;QAC5C,IAAI,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAE/C,IAAI,CAAC,QAAQ;YACT,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,kCAAwB,CAAC,gBAAgB,CAAC,CAAC;QAEpF,IAAK,QAAiC,CAAC,UAAU,EAAE,CAAC;YAChD,OAAO,IAAI,uBAAa,CAAC,QAAgC,CAAC,CAAC;QAC/D,CAAC;aAAM,CAAC;YACJ,OAAO,IAAI,iBAAO,CAAC,QAAQ,CAAC,CAAC;QACjC,CAAC;IACL,CAAC;IAGD;;;;OAIG;IACH,KAAK,CAAC,IAAuC;QAEzC,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEhC,MAAM,GAAG,CAAC;IACd,CAAC;IAGD;;;;;OAKG;IACH,IAAI,CAAC,KAAgC;QACjC,IAAI,KAAK,YAAY,iBAAO,EAAE,CAAC;YAC3B,OAAO,IAAI,uBAAa,CAAC,KAAK,CAAC,CAAC;QACpC,CAAC;QAED,OAAO,IAAI,iBAAO,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;CAGJ;AAjGD,4BAiGC"}
@@ -0,0 +1,5 @@
1
+ import { A_TYPES__NamespaceConstructor } from "../../global/A-Namespace/A_Namespace.types";
2
+ import { A_TYPES__Dictionary, A_TYPES__Error } from "@adaas/a-utils";
3
+ export type A_TYPES__A_ErrorsConstructor = {
4
+ errors: A_TYPES__Dictionary<A_TYPES__Error> | A_TYPES__Error[];
5
+ } & A_TYPES__NamespaceConstructor;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=A-Errors.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"A-Errors.types.js","sourceRoot":"","sources":["../../../../src/containers/A-Errors/A-Errors.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { A_Container } from "../../global/A-Container/A-Container.class";
2
+ import { A_LoggerContext } from "./A-Logger.namespace";
3
+ import { A_Config } from "../A-Config/A-Config.namespace";
4
+ export declare class A_Logger extends A_Container<A_LoggerContext> {
5
+ init(config: A_Config): Promise<void>;
6
+ }
@@ -0,0 +1,41 @@
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 __param = (this && this.__param) || function (paramIndex, decorator) {
9
+ return function (target, key) { decorator(target, key, paramIndex); }
10
+ };
11
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
+ return new (P || (P = Promise))(function (resolve, reject) {
14
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
18
+ });
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.A_Logger = void 0;
22
+ const A_Container_class_1 = require("../../global/A-Container/A-Container.class");
23
+ const A_Load_decorator_1 = require("../../decorators/A-ConceptLifecycle/A-Load/A-Load.decorator");
24
+ const Logger_component_1 = require("./components/Logger.component");
25
+ const A_Inject_decorator_1 = require("../../decorators/A-Inject/A-Inject.decorator");
26
+ const A_Context_class_1 = require("../../global/A-Context/A-Context.class");
27
+ const A_Config_namespace_1 = require("../A-Config/A-Config.namespace");
28
+ class A_Logger extends A_Container_class_1.A_Container {
29
+ init(config) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ yield this.namespace.ready;
32
+ this.namespace.Logger = A_Context_class_1.A_Context.resolve(Logger_component_1.Logger);
33
+ });
34
+ }
35
+ }
36
+ exports.A_Logger = A_Logger;
37
+ __decorate([
38
+ (0, A_Load_decorator_1.A_Load)({}),
39
+ __param(0, (0, A_Inject_decorator_1.A_Inject)(A_Config_namespace_1.A_Config))
40
+ ], A_Logger.prototype, "init", null);
41
+ //# sourceMappingURL=A-Logger.container.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"A-Logger.container.js","sourceRoot":"","sources":["../../../../src/containers/A-Logger/A-Logger.container.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,6FAAoF;AACpF,6GAAgG;AAChG,oEAAuD;AAEvD,gGAAmF;AACnF,uFAA8E;AAC9E,uEAA0D;AAI1D,MAAa,QAAS,SAAQ,+BAA4B;IAIhD,IAAI,CACc,MAAgB;;YAEpC,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;YAE3B,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,2BAAS,CAAC,OAAO,CAAC,yBAAM,CAAC,CAAC;QACtD,CAAC;KAAA;CACJ;AAXD,4BAWC;AAPS;IADL,IAAA,yBAAM,EAAC,EAAE,CAAC;IAEN,WAAA,IAAA,6BAAQ,EAAC,6BAAQ,CAAC,CAAA;oCAKtB"}
@@ -0,0 +1,17 @@
1
+ import { A_Namespace } from "../../global/A-Namespace/A_Namespace.class";
2
+ import { Logger } from "./components/Logger.component";
3
+ export declare class A_LoggerContext extends A_Namespace {
4
+ Logger: Logger;
5
+ readonly colors: {
6
+ readonly green: "32";
7
+ readonly blue: "34";
8
+ readonly red: "31";
9
+ readonly yellow: "33";
10
+ readonly gray: "90";
11
+ readonly magenta: "35";
12
+ readonly cyan: "36";
13
+ readonly white: "37";
14
+ readonly pink: "95";
15
+ };
16
+ constructor();
17
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.A_LoggerContext = void 0;
4
+ const A_Namespace_class_1 = require("../../global/A-Namespace/A_Namespace.class");
5
+ class A_LoggerContext extends A_Namespace_class_1.A_Namespace {
6
+ constructor() {
7
+ super();
8
+ this.colors = {
9
+ green: '32',
10
+ blue: '34',
11
+ red: '31',
12
+ yellow: '33',
13
+ gray: '90',
14
+ magenta: '35',
15
+ cyan: '36',
16
+ white: '37',
17
+ pink: '95',
18
+ };
19
+ }
20
+ }
21
+ exports.A_LoggerContext = A_LoggerContext;
22
+ //# sourceMappingURL=A-Logger.namespace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"A-Logger.namespace.js","sourceRoot":"","sources":["../../../../src/containers/A-Logger/A-Logger.namespace.ts"],"names":[],"mappings":";;;AAAA,6FAAoF;AAIpF,MAAa,eAAgB,SAAQ,+BAAW;IAiB5C;QACI,KAAK,EAAE,CAAC;QAdH,WAAM,GAAG;YACd,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,IAAI;YACV,GAAG,EAAE,IAAI;YACT,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,IAAI;SACJ,CAAA;IAKV,CAAC;CAEJ;AArBD,0CAqBC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=A-Logger.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"A-Logger.types.js","sourceRoot":"","sources":["../../../../src/containers/A-Logger/A-Logger.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,29 @@
1
+ import { A_Component } from "../../../global/A-Component/A-Component.class";
2
+ import { A_Namespace } from "../../../global/A-Namespace/A_Namespace.class";
3
+ import { A_Error } from "@adaas/a-utils";
4
+ import { A_Config } from "src/containers/A-Config/A-Config.namespace";
5
+ export declare class Logger extends A_Component {
6
+ protected namespace: A_Namespace;
7
+ protected config: A_Config;
8
+ constructor(namespace: A_Namespace, config: A_Config);
9
+ readonly colors: {
10
+ readonly green: "32";
11
+ readonly blue: "34";
12
+ readonly red: "31";
13
+ readonly yellow: "33";
14
+ readonly gray: "90";
15
+ readonly magenta: "35";
16
+ readonly cyan: "36";
17
+ readonly white: "37";
18
+ readonly pink: "95";
19
+ };
20
+ get namespaceLength(): any;
21
+ compile(color: keyof typeof this.colors, ...args: any[]): Array<string>;
22
+ log(...args: any[]): void;
23
+ warning(...args: any[]): void;
24
+ error(...args: any[]): void;
25
+ protected log_A_Error(error: A_Error): void;
26
+ protected compile_A_Error(error: A_Error): string;
27
+ protected compile_Error(error: Error): string;
28
+ protected getTime(): string;
29
+ }
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Logger = void 0;
4
+ const A_Component_class_1 = require("../../../global/A-Component/A-Component.class");
5
+ const a_utils_1 = require("@adaas/a-utils");
6
+ class Logger extends A_Component_class_1.A_Component {
7
+ constructor(namespace, config) {
8
+ super(namespace);
9
+ this.namespace = namespace;
10
+ this.config = config;
11
+ this.colors = {
12
+ green: '32',
13
+ blue: '34',
14
+ red: '31',
15
+ yellow: '33',
16
+ gray: '90',
17
+ magenta: '35',
18
+ cyan: '36',
19
+ white: '37',
20
+ pink: '95',
21
+ };
22
+ }
23
+ get namespaceLength() {
24
+ return this.namespaceLength;
25
+ }
26
+ compile(color, ...args) {
27
+ return [
28
+ `\x1b[${this.colors[color]}m[${this.namespace}] |${this.getTime()}|`,
29
+ (args.length > 1
30
+ ? '\n' + `${' '.repeat(this.namespaceLength + 3)}|-------------------------------`
31
+ : ''),
32
+ ...(args
33
+ .map((arg, i) => {
34
+ switch (true) {
35
+ case arg instanceof a_utils_1.A_Error:
36
+ return this.compile_A_Error(arg);
37
+ case arg instanceof Error:
38
+ return this.compile_Error(arg);
39
+ case typeof arg === 'object':
40
+ return JSON.stringify(arg, null, 2)
41
+ .replace(/\n/g, '\n' + `${' '.repeat(this.namespaceLength + 3)}| `);
42
+ default:
43
+ return String(((i > 0 || args.length > 1) ? '\n' : '')
44
+ + arg)
45
+ .replace(/\n/g, '\n' + `${' '.repeat(this.namespaceLength + 3)}| `);
46
+ }
47
+ })),
48
+ (args.length > 1
49
+ ? '\n' + `${' '.repeat(this.namespaceLength + 3)}|-------------------------------\x1b[0m`
50
+ : '\x1b[0m')
51
+ ];
52
+ }
53
+ log(...args) {
54
+ if (!this.config.get('CONFIG_VERBOSE'))
55
+ return;
56
+ console.log(...this.compile('blue', ...args));
57
+ }
58
+ warning(...args) {
59
+ if (!this.config.get('CONFIG_VERBOSE'))
60
+ return;
61
+ console.log(...this.compile('yellow', ...args));
62
+ }
63
+ error(...args) {
64
+ if (this.config.get('CONFIG_IGNORE_ERRORS'))
65
+ return;
66
+ return console.log(...this.compile('red', ...args));
67
+ }
68
+ log_A_Error(error) {
69
+ var _a, _b;
70
+ const time = this.getTime();
71
+ console.log(`\x1b[31m[${this.namespace}] |${time}| ERROR ${error.code}
72
+ ${' '.repeat(this.namespaceLength + 3)}| ${error.message}
73
+ ${' '.repeat(this.namespaceLength + 3)}| ${error.description}
74
+ ${' '.repeat(this.namespaceLength + 3)}|-------------------------------
75
+ ${' '.repeat(this.namespaceLength + 3)}| ${((_a = error.stack) === null || _a === void 0 ? void 0 : _a.split('\n').map((line, index) => index === 0 ? line : `${' '.repeat(this.namespaceLength + 3)}| ${line}`).join('\n')) || 'No stack trace'}
76
+ ${' '.repeat(this.namespaceLength + 3)}|-------------------------------
77
+ \x1b[0m`
78
+ + (error.originalError ? `\x1b[31m${' '.repeat(this.namespaceLength + 3)}| Wrapped From ${error.originalError.message}
79
+ ${' '.repeat(this.namespaceLength + 3)}|-------------------------------
80
+ ${' '.repeat(this.namespaceLength + 3)}| ${((_b = error.originalError.stack) === null || _b === void 0 ? void 0 : _b.split('\n').map((line, index) => index === 0 ? line : `${' '.repeat(this.namespaceLength + 3)}| ${line}`).join('\n')) || 'No stack trace'}
81
+ ${' '.repeat(this.namespaceLength + 3)}|-------------------------------
82
+ \x1b[0m` : '')
83
+ + (error.link ? `\x1b[31m${' '.repeat(this.namespaceLength + 3)}| Read in docs: ${error.link}
84
+ ${' '.repeat(this.namespaceLength + 3)}|-------------------------------
85
+ \x1b[0m` : ''));
86
+ }
87
+ compile_A_Error(error) {
88
+ var _a, _b;
89
+ const time = this.getTime();
90
+ return '\n' +
91
+ `${' '.repeat(this.namespaceLength + 3)}|-------------------------------` +
92
+ '\n' +
93
+ `${' '.repeat(this.namespaceLength + 3)}| Error: | ${error.code}
94
+ ${' '.repeat(this.namespaceLength + 3)}|-------------------------------
95
+ ${' '.repeat(this.namespaceLength + 3)}|${' '.repeat(10)}| ${error.message}
96
+ ${' '.repeat(this.namespaceLength + 3)}|${' '.repeat(10)}| ${error.description}
97
+ ${' '.repeat(this.namespaceLength + 3)}|-------------------------------
98
+ ${' '.repeat(this.namespaceLength + 3)}| ${((_a = error.stack) === null || _a === void 0 ? void 0 : _a.split('\n').map((line, index) => index === 0 ? line : `${' '.repeat(this.namespaceLength + 3)}| ${line}`).join('\n')) || 'No stack trace'}
99
+ ${' '.repeat(this.namespaceLength + 3)}|-------------------------------`
100
+ +
101
+ (error.originalError ? `${' '.repeat(this.namespaceLength + 3)}| Wrapped From ${error.originalError.message}
102
+ ${' '.repeat(this.namespaceLength + 3)}|-------------------------------
103
+ ${' '.repeat(this.namespaceLength + 3)}| ${((_b = error.originalError.stack) === null || _b === void 0 ? void 0 : _b.split('\n').map((line, index) => index === 0 ? line : `${' '.repeat(this.namespaceLength + 3)}| ${line}`).join('\n')) || 'No stack trace'}
104
+ ${' '.repeat(this.namespaceLength + 3)}|-------------------------------` : '')
105
+ +
106
+ (error.link ? `${' '.repeat(this.namespaceLength + 3)}| Read in docs: ${error.link}
107
+ ${' '.repeat(this.namespaceLength + 3)}|-------------------------------` : '');
108
+ }
109
+ compile_Error(error) {
110
+ var _a;
111
+ return JSON.stringify({
112
+ name: error.name,
113
+ message: error.message,
114
+ stack: (_a = error.stack) === null || _a === void 0 ? void 0 : _a.split('\n').map((line, index) => index === 0 ? line : `${' '.repeat(this.namespaceLength + 3)}| ${line}`).join('\n')
115
+ }, null, 2)
116
+ .replace(/\n/g, '\n' + `${' '.repeat(this.namespaceLength + 3)}| `)
117
+ .replace(/\\n/g, '\n');
118
+ }
119
+ getTime() {
120
+ const now = new Date();
121
+ const minutes = String(now.getMinutes()).padStart(2, '0');
122
+ const seconds = String(now.getSeconds()).padStart(2, '0');
123
+ const milliseconds = String(now.getMilliseconds()).padStart(4, '0');
124
+ return `${minutes}:${seconds}:${milliseconds}`;
125
+ }
126
+ }
127
+ exports.Logger = Logger;
128
+ //# sourceMappingURL=Logger.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Logger.component.js","sourceRoot":"","sources":["../../../../../src/containers/A-Logger/components/Logger.component.ts"],"names":[],"mappings":";;;AAAA,6FAAoF;AAEpF,4CAAyC;AAIzC,MAAa,MAAO,SAAQ,+BAAW;IAEnC,YACc,SAAsB,EACtB,MAAgB;QAE1B,KAAK,CAAC,SAAS,CAAC,CAAC;QAHP,cAAS,GAAT,SAAS,CAAa;QACtB,WAAM,GAAN,MAAM,CAAU;QAKrB,WAAM,GAAG;YACd,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,IAAI;YACV,GAAG,EAAE,IAAI;YACT,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,IAAI;SACJ,CAAA;IAZV,CAAC;IAeD,IAAI,eAAe;QACf,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAGD,OAAO,CACH,KAA+B,EAC/B,GAAG,IAAW;QAGd,OAAO;YACH,QAAQ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,SAAS,MAA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K,EAAE,EAAE,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE,EAC5F,IAAI,CAAC,IAAI,CAAC;SAElB,EAAE,IAAI,EAAE,CAAC,CAAC;aACN,OAAO,CAAC,KAAK,EAAE,IAAI,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC;aAClE,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAC9B,CAAC;IAIS,OAAO;QACb,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAC1D,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAC1D,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACpE,OAAO,GAAG,OAAO,IAAI,OAAO,IAAI,YAAY,EAAE,CAAC;IACnD,CAAC;CACJ;AAlKD,wBAkKC"}
@@ -0,0 +1,34 @@
1
+ export type A_TYPES__ConceptLifecycle_MethodDeclarationConfig = {
2
+ /**
3
+ * The name of the method. If not provided, the name of the function will be used.
4
+ * The name is connected to the class name.
5
+ * e.g. 'YourClass.yourMethod'
6
+ */
7
+ name: string;
8
+ /**
9
+ * Allows to override the method with a new implementation.
10
+ * The methods listed will not be called.
11
+ * e.g. ['YourClass.yourMethod']
12
+ */
13
+ override: Array<string> | string | Function;
14
+ /**
15
+ * Defines a flexible dependency management mechanism to enable pipeline-like behavior.
16
+ * The target method will be called before the methods listed.
17
+ * e.g. ['YourClass.yourMethod']
18
+ */
19
+ before: Array<string> | string | Function;
20
+ /**
21
+ * Defines a flexible dependency management mechanism to enable pipeline-like behavior.
22
+ * The target method will be called after the methods listed.
23
+ * e.g. ['YourClass.yourMethod']
24
+ */
25
+ after: Array<string> | string | Function;
26
+ /**
27
+ * Allows to define a behavior of the method
28
+ * Sync - blocks other Concept Lifecycle methods until the method is ready
29
+ * Async - allows to initialize method after Concept Lifecycle initialization
30
+ */
31
+ behavior: 'sync' | 'async';
32
+ type: 'extension' | 'pipe';
33
+ };
34
+ export type A_TYPES__ConceptLifecycle_MethodDeclarationStorage = {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=A-ConceptLifecycle.decorator.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"A-ConceptLifecycle.decorator.types.js","sourceRoot":"","sources":["../../../../src/decorators/A-ConceptLifecycle/A-ConceptLifecycle.decorator.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import { A_TYPES__A_LoadDecoratorConfig, A_TYPES__A_LoadDecoratorDescriptor } from "./A-Load.decorator.types";
2
+ import { A_Container } from "../../../global/A-Container/A-Container.class";
3
+ /**
4
+ * A-Load decorator
5
+ *
6
+ * This Decorator allows to an extended flow of Concept loading.
7
+ *
8
+ * @param params
9
+ * @returns
10
+ */
11
+ export declare function A_Load(config?: Partial<A_TYPES__A_LoadDecoratorConfig>): (target: A_Container, propertyKey: string, descriptor: A_TYPES__A_LoadDecoratorDescriptor) => void;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.A_Load = A_Load;
4
+ const A_Concept_storage_1 = require("src/storage/A_Concept.storage");
5
+ const a_utils_1 = require("@adaas/a-utils");
6
+ const A_ConceptLifecycle_constants_1 = require("../../../constants/A_ConceptLifecycle.constants");
7
+ /**
8
+ * A-Load decorator
9
+ *
10
+ * This Decorator allows to an extended flow of Concept loading.
11
+ *
12
+ * @param params
13
+ * @returns
14
+ */
15
+ function A_Load(config = {}) {
16
+ return function (target, propertyKey, descriptor) {
17
+ const targetProperty = A_Concept_storage_1.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootLoad;
18
+ const existedMeta = A_Concept_storage_1.A_CONCEPT_ModulesDeclarationStorage.get(target.constructor) || new Map();
19
+ const inheritMeta = A_Concept_storage_1.A_CONCEPT_ModulesDeclarationStorage.get(Object.getPrototypeOf(target.constructor)) || new Map();
20
+ const inheritedInstructions = inheritMeta.get(targetProperty) || [];
21
+ const instructions = existedMeta.get(targetProperty) || [...inheritedInstructions];
22
+ /**
23
+ * That's is needed to remove the previous definition of the method from parent classes
24
+ * and override it with the new one
25
+ */
26
+ const targetInstructions = instructions
27
+ .filter((instr) => instr.handler !== propertyKey);
28
+ targetInstructions.push({
29
+ handler: propertyKey,
30
+ config: a_utils_1.A_CommonHelper.deepCloneAndMerge(config, A_ConceptLifecycle_constants_1.A_CONSTANTS__DEFAULT_CONCEPT_LIFECYCLE_METHOD_DECLARATION_CONFIG)
31
+ });
32
+ existedMeta.set(targetProperty, targetInstructions);
33
+ A_Concept_storage_1.A_CONCEPT_ModulesDeclarationStorage.set(target.constructor, existedMeta);
34
+ };
35
+ }
36
+ //# sourceMappingURL=A-Load.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"A-Load.decorator.js","sourceRoot":"","sources":["../../../../../src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.ts"],"names":[],"mappings":";;AAiBA,wBAqCC;AArDD,qEAA8I;AAC9I,4CAAgD;AAChD,0GAA2I;AAM3I;;;;;;;GAOG;AACH,SAAgB,MAAM,CAClB,SAAkD,EAAE;IAGpD,OAAO,UACH,MAAmB,EACnB,WAAmB,EACnB,UAA8C;QAE9C,MAAM,cAAc,GAAW,4EAAwD,CAAC;QAIxF,MAAM,WAAW,GAAG,uDAAmC,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC;QAC7F,MAAM,WAAW,GAAG,uDAAmC,CAAC,GAAG,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC;QAEpH,MAAM,qBAAqB,GAAG,WAAW,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;QACpE,MAAM,YAAY,GAAsD,WAAW,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,qBAAqB,CAAC,CAAC;QAEtI;;;WAGG;QACH,MAAM,kBAAkB,GAAG,YAAY;aAClC,MAAM,CACH,CAAC,KAAiD,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,KAAK,WAAW,CACvF,CAAC;QAEN,kBAAkB,CAAC,IAAI,CAAC;YACpB,OAAO,EAAE,WAAW;YACpB,MAAM,EAAE,wBAAc,CAAC,iBAAiB,CAAC,MAAM,EAAE,+FAAgE,CAAC;SACrH,CAAC,CAAC;QAEH,WAAW,CAAC,GAAG,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;QAEpD,uDAAmC,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAC7E,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { A_TYPES__ConceptLifecycle_MethodDeclarationConfig } from "../A-ConceptLifecycle.decorator.types";
2
+ export type A_TYPES__A_LoadDecoratorDescriptor = TypedPropertyDescriptor<(...args: any[]) => void> | TypedPropertyDescriptor<(...args: any[]) => Promise<void>>;
3
+ export type A_TYPES__A_LoadDecoratorConfig = {} & A_TYPES__ConceptLifecycle_MethodDeclarationConfig;
4
+ export type A_TYPES__A_LoadDecoratorStorageInstruction = {
5
+ handler: string;
6
+ config: A_TYPES__A_LoadDecoratorConfig;
7
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=A-Load.decorator.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"A-Load.decorator.types.js","sourceRoot":"","sources":["../../../../../src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { A_TYPES__A_RunDecoratorConfig, A_TYPES__A_RunDecoratorDescriptor } from "./A-Run.decorator.types";
2
+ import { A_Container } from "../../../global/A-Container/A-Container.class";
3
+ /**
4
+ * A-Run decorator
5
+ *
6
+ * This decorator is used to define a method that will be executed during the lifecycle of the module.
7
+ * Depending on the definition and configurations
8
+ * it will be executed during the run command
9
+ * modifying and adjusting the whole [root.run] pipeline.
10
+ *
11
+ * This decorator can be used in case of the need to define a custom logic that will be executed during the run command.
12
+ *
13
+ *
14
+ * @param params
15
+ * @returns
16
+ */
17
+ export declare function A_Run(config?: Partial<A_TYPES__A_RunDecoratorConfig>): (target: A_Container, propertyKey: string, descriptor: A_TYPES__A_RunDecoratorDescriptor) => void;