@adaas/a-concept 0.1.24 → 0.1.26

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 (227) hide show
  1. package/dist/index.cjs +3 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.mts +3961 -0
  4. package/dist/index.d.ts +3961 -50
  5. package/dist/index.mjs +3 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/package.json +5 -6
  8. package/src/global/A-Abstraction/A-Abstraction-Extend.decorator.ts +2 -1
  9. package/src/global/A-Context/A-Context.class.ts +81 -7
  10. package/src/global/A-Context/A-Context.error.ts +4 -0
  11. package/src/global/A-Dependency/A-Dependency-Default.decorator.ts +75 -0
  12. package/src/global/A-Dependency/A-Dependency-Load.decorator.ts +80 -0
  13. package/src/global/A-Dependency/A-Dependency-Require.decorator.ts +68 -0
  14. package/src/global/A-Dependency/A-Dependency.class.ts +33 -0
  15. package/src/global/A-Dependency/A-Dependency.error.ts +13 -0
  16. package/src/global/A-Dependency/A-Dependency.types.ts +28 -0
  17. package/src/global/A-Feature/A-Feature-Define.decorator.ts +2 -1
  18. package/src/global/A-Feature/A-Feature-Extend.decorator.ts +2 -1
  19. package/src/global/A-Feature/A-Feature.class.ts +11 -0
  20. package/src/global/A-Inject/A-Inject.decorator.ts +4 -2
  21. package/src/global/A-Inject/A-Inject.types.ts +5 -3
  22. package/src/global/A-Scope/A-Scope.class.ts +85 -57
  23. package/src/global/A-Stage/A-Stage.class.ts +22 -2
  24. package/src/global/A-Stage/A-Stage.error.ts +2 -0
  25. package/src/helpers/A_Common.helper.ts +101 -0
  26. package/src/helpers/A_TypeGuards.helper.ts +8 -0
  27. package/src/index.ts +88 -0
  28. package/tests/A-Component.test.ts +1 -1
  29. package/tests/A-Concept.test.ts +5 -6
  30. package/tests/A-Dependency.test.ts +93 -0
  31. package/tests/A-Feature.test.ts +7 -7
  32. package/tests/A-Scope.test.ts +10 -10
  33. package/tsconfig.json +2 -2
  34. package/tsup.config.ts +32 -0
  35. package/dist/index.js +0 -112
  36. package/dist/index.js.map +0 -1
  37. package/dist/src/constants/env.constants.d.ts +0 -33
  38. package/dist/src/constants/env.constants.js +0 -47
  39. package/dist/src/constants/env.constants.js.map +0 -1
  40. package/dist/src/global/A-Abstraction/A-Abstraction-Extend.decorator.d.ts +0 -23
  41. package/dist/src/global/A-Abstraction/A-Abstraction-Extend.decorator.js +0 -96
  42. package/dist/src/global/A-Abstraction/A-Abstraction-Extend.decorator.js.map +0 -1
  43. package/dist/src/global/A-Abstraction/A-Abstraction.class.d.ts +0 -74
  44. package/dist/src/global/A-Abstraction/A-Abstraction.class.js +0 -130
  45. package/dist/src/global/A-Abstraction/A-Abstraction.class.js.map +0 -1
  46. package/dist/src/global/A-Abstraction/A-Abstraction.error.d.ts +0 -7
  47. package/dist/src/global/A-Abstraction/A-Abstraction.error.js +0 -12
  48. package/dist/src/global/A-Abstraction/A-Abstraction.error.js.map +0 -1
  49. package/dist/src/global/A-Abstraction/A-Abstraction.types.d.ts +0 -38
  50. package/dist/src/global/A-Abstraction/A-Abstraction.types.js +0 -3
  51. package/dist/src/global/A-Abstraction/A-Abstraction.types.js.map +0 -1
  52. package/dist/src/global/A-Caller/A_Caller.class.d.ts +0 -33
  53. package/dist/src/global/A-Caller/A_Caller.class.js +0 -44
  54. package/dist/src/global/A-Caller/A_Caller.class.js.map +0 -1
  55. package/dist/src/global/A-Caller/A_Caller.error.d.ts +0 -7
  56. package/dist/src/global/A-Caller/A_Caller.error.js +0 -12
  57. package/dist/src/global/A-Caller/A_Caller.error.js.map +0 -1
  58. package/dist/src/global/A-Caller/A_Caller.types.d.ts +0 -18
  59. package/dist/src/global/A-Caller/A_Caller.types.js +0 -3
  60. package/dist/src/global/A-Caller/A_Caller.types.js.map +0 -1
  61. package/dist/src/global/A-Component/A-Component.class.d.ts +0 -34
  62. package/dist/src/global/A-Component/A-Component.class.js +0 -56
  63. package/dist/src/global/A-Component/A-Component.class.js.map +0 -1
  64. package/dist/src/global/A-Component/A-Component.constants.d.ts +0 -6
  65. package/dist/src/global/A-Component/A-Component.constants.js +0 -11
  66. package/dist/src/global/A-Component/A-Component.constants.js.map +0 -1
  67. package/dist/src/global/A-Component/A-Component.meta.d.ts +0 -34
  68. package/dist/src/global/A-Component/A-Component.meta.js +0 -78
  69. package/dist/src/global/A-Component/A-Component.meta.js.map +0 -1
  70. package/dist/src/global/A-Component/A-Component.types.d.ts +0 -76
  71. package/dist/src/global/A-Component/A-Component.types.js +0 -4
  72. package/dist/src/global/A-Component/A-Component.types.js.map +0 -1
  73. package/dist/src/global/A-Concept/A-Concept.class.d.ts +0 -153
  74. package/dist/src/global/A-Concept/A-Concept.class.js +0 -260
  75. package/dist/src/global/A-Concept/A-Concept.class.js.map +0 -1
  76. package/dist/src/global/A-Concept/A-Concept.constants.d.ts +0 -33
  77. package/dist/src/global/A-Concept/A-Concept.constants.js +0 -39
  78. package/dist/src/global/A-Concept/A-Concept.constants.js.map +0 -1
  79. package/dist/src/global/A-Concept/A-Concept.meta.d.ts +0 -6
  80. package/dist/src/global/A-Concept/A-Concept.meta.js +0 -12
  81. package/dist/src/global/A-Concept/A-Concept.meta.js.map +0 -1
  82. package/dist/src/global/A-Concept/A-Concept.types.d.ts +0 -66
  83. package/dist/src/global/A-Concept/A-Concept.types.js +0 -3
  84. package/dist/src/global/A-Concept/A-Concept.types.js.map +0 -1
  85. package/dist/src/global/A-Container/A-Container.class.d.ts +0 -52
  86. package/dist/src/global/A-Container/A-Container.class.js +0 -78
  87. package/dist/src/global/A-Container/A-Container.class.js.map +0 -1
  88. package/dist/src/global/A-Container/A-Container.constants.d.ts +0 -6
  89. package/dist/src/global/A-Container/A-Container.constants.js +0 -11
  90. package/dist/src/global/A-Container/A-Container.constants.js.map +0 -1
  91. package/dist/src/global/A-Container/A-Container.meta.d.ts +0 -35
  92. package/dist/src/global/A-Container/A-Container.meta.js +0 -76
  93. package/dist/src/global/A-Container/A-Container.meta.js.map +0 -1
  94. package/dist/src/global/A-Container/A-Container.types.d.ts +0 -75
  95. package/dist/src/global/A-Container/A-Container.types.js +0 -4
  96. package/dist/src/global/A-Container/A-Container.types.js.map +0 -1
  97. package/dist/src/global/A-Context/A-Context.class.d.ts +0 -361
  98. package/dist/src/global/A-Context/A-Context.class.js +0 -603
  99. package/dist/src/global/A-Context/A-Context.class.js.map +0 -1
  100. package/dist/src/global/A-Context/A-Context.error.d.ts +0 -20
  101. package/dist/src/global/A-Context/A-Context.error.js +0 -25
  102. package/dist/src/global/A-Context/A-Context.error.js.map +0 -1
  103. package/dist/src/global/A-Context/A-Context.types.d.ts +0 -5
  104. package/dist/src/global/A-Context/A-Context.types.js +0 -3
  105. package/dist/src/global/A-Context/A-Context.types.js.map +0 -1
  106. package/dist/src/global/A-Dependency/A-DependencyReference.class.d.ts +0 -0
  107. package/dist/src/global/A-Dependency/A-DependencyReference.class.js +0 -49
  108. package/dist/src/global/A-Dependency/A-DependencyReference.class.js.map +0 -1
  109. package/dist/src/global/A-Dependency/A-DependencyReference.types.d.ts +0 -0
  110. package/dist/src/global/A-Dependency/A-DependencyReference.types.js +0 -58
  111. package/dist/src/global/A-Dependency/A-DependencyReference.types.js.map +0 -1
  112. package/dist/src/global/A-Entity/A-Entity.class.d.ts +0 -214
  113. package/dist/src/global/A-Entity/A-Entity.class.js +0 -282
  114. package/dist/src/global/A-Entity/A-Entity.class.js.map +0 -1
  115. package/dist/src/global/A-Entity/A-Entity.constants.d.ts +0 -11
  116. package/dist/src/global/A-Entity/A-Entity.constants.js +0 -17
  117. package/dist/src/global/A-Entity/A-Entity.constants.js.map +0 -1
  118. package/dist/src/global/A-Entity/A-Entity.error.d.ts +0 -7
  119. package/dist/src/global/A-Entity/A-Entity.error.js +0 -12
  120. package/dist/src/global/A-Entity/A-Entity.error.js.map +0 -1
  121. package/dist/src/global/A-Entity/A-Entity.meta.d.ts +0 -11
  122. package/dist/src/global/A-Entity/A-Entity.meta.js +0 -18
  123. package/dist/src/global/A-Entity/A-Entity.meta.js.map +0 -1
  124. package/dist/src/global/A-Entity/A-Entity.types.d.ts +0 -56
  125. package/dist/src/global/A-Entity/A-Entity.types.js +0 -5
  126. package/dist/src/global/A-Entity/A-Entity.types.js.map +0 -1
  127. package/dist/src/global/A-Error/A_Error.class.d.ts +0 -229
  128. package/dist/src/global/A-Error/A_Error.class.js +0 -296
  129. package/dist/src/global/A-Error/A_Error.class.js.map +0 -1
  130. package/dist/src/global/A-Error/A_Error.constants.d.ts +0 -5
  131. package/dist/src/global/A-Error/A_Error.constants.js +0 -9
  132. package/dist/src/global/A-Error/A_Error.constants.js.map +0 -1
  133. package/dist/src/global/A-Error/A_Error.types.d.ts +0 -93
  134. package/dist/src/global/A-Error/A_Error.types.js +0 -3
  135. package/dist/src/global/A-Error/A_Error.types.js.map +0 -1
  136. package/dist/src/global/A-Feature/A-Feature-Define.decorator.d.ts +0 -15
  137. package/dist/src/global/A-Feature/A-Feature-Define.decorator.js +0 -76
  138. package/dist/src/global/A-Feature/A-Feature-Define.decorator.js.map +0 -1
  139. package/dist/src/global/A-Feature/A-Feature-Extend.decorator.d.ts +0 -56
  140. package/dist/src/global/A-Feature/A-Feature-Extend.decorator.js +0 -128
  141. package/dist/src/global/A-Feature/A-Feature-Extend.decorator.js.map +0 -1
  142. package/dist/src/global/A-Feature/A-Feature.class.d.ts +0 -175
  143. package/dist/src/global/A-Feature/A-Feature.class.js +0 -318
  144. package/dist/src/global/A-Feature/A-Feature.class.js.map +0 -1
  145. package/dist/src/global/A-Feature/A-Feature.error.d.ts +0 -25
  146. package/dist/src/global/A-Feature/A-Feature.error.js +0 -33
  147. package/dist/src/global/A-Feature/A-Feature.error.js.map +0 -1
  148. package/dist/src/global/A-Feature/A-Feature.types.d.ts +0 -334
  149. package/dist/src/global/A-Feature/A-Feature.types.js +0 -26
  150. package/dist/src/global/A-Feature/A-Feature.types.js.map +0 -1
  151. package/dist/src/global/A-Fragment/A-Fragment.class.d.ts +0 -36
  152. package/dist/src/global/A-Fragment/A-Fragment.class.js +0 -46
  153. package/dist/src/global/A-Fragment/A-Fragment.class.js.map +0 -1
  154. package/dist/src/global/A-Fragment/A-Fragment.types.d.ts +0 -21
  155. package/dist/src/global/A-Fragment/A-Fragment.types.js +0 -6
  156. package/dist/src/global/A-Fragment/A-Fragment.types.js.map +0 -1
  157. package/dist/src/global/A-Inject/A-Inject.decorator.d.ts +0 -80
  158. package/dist/src/global/A-Inject/A-Inject.decorator.js +0 -49
  159. package/dist/src/global/A-Inject/A-Inject.decorator.js.map +0 -1
  160. package/dist/src/global/A-Inject/A-Inject.error.d.ts +0 -5
  161. package/dist/src/global/A-Inject/A-Inject.error.js +0 -10
  162. package/dist/src/global/A-Inject/A-Inject.error.js.map +0 -1
  163. package/dist/src/global/A-Inject/A-Inject.types.d.ts +0 -42
  164. package/dist/src/global/A-Inject/A-Inject.types.js +0 -3
  165. package/dist/src/global/A-Inject/A-Inject.types.js.map +0 -1
  166. package/dist/src/global/A-Meta/A-Meta.class.d.ts +0 -97
  167. package/dist/src/global/A-Meta/A-Meta.class.js +0 -164
  168. package/dist/src/global/A-Meta/A-Meta.class.js.map +0 -1
  169. package/dist/src/global/A-Meta/A-Meta.types.d.ts +0 -14
  170. package/dist/src/global/A-Meta/A-Meta.types.js +0 -3
  171. package/dist/src/global/A-Meta/A-Meta.types.js.map +0 -1
  172. package/dist/src/global/A-Scope/A-Scope.class.d.ts +0 -466
  173. package/dist/src/global/A-Scope/A-Scope.class.js +0 -791
  174. package/dist/src/global/A-Scope/A-Scope.class.js.map +0 -1
  175. package/dist/src/global/A-Scope/A-Scope.error.d.ts +0 -8
  176. package/dist/src/global/A-Scope/A-Scope.error.js +0 -13
  177. package/dist/src/global/A-Scope/A-Scope.error.js.map +0 -1
  178. package/dist/src/global/A-Scope/A-Scope.types.d.ts +0 -81
  179. package/dist/src/global/A-Scope/A-Scope.types.js +0 -3
  180. package/dist/src/global/A-Scope/A-Scope.types.js.map +0 -1
  181. package/dist/src/global/A-Stage/A-Stage.class.d.ts +0 -112
  182. package/dist/src/global/A-Stage/A-Stage.class.js +0 -240
  183. package/dist/src/global/A-Stage/A-Stage.class.js.map +0 -1
  184. package/dist/src/global/A-Stage/A-Stage.error.d.ts +0 -4
  185. package/dist/src/global/A-Stage/A-Stage.error.js +0 -11
  186. package/dist/src/global/A-Stage/A-Stage.error.js.map +0 -1
  187. package/dist/src/global/A-Stage/A-Stage.types.d.ts +0 -101
  188. package/dist/src/global/A-Stage/A-Stage.types.js +0 -43
  189. package/dist/src/global/A-Stage/A-Stage.types.js.map +0 -1
  190. package/dist/src/global/A-StepManager/A-StepManager.class.d.ts +0 -20
  191. package/dist/src/global/A-StepManager/A-StepManager.class.js +0 -112
  192. package/dist/src/global/A-StepManager/A-StepManager.class.js.map +0 -1
  193. package/dist/src/global/A-StepManager/A-StepManager.error.d.ts +0 -4
  194. package/dist/src/global/A-StepManager/A-StepManager.error.js +0 -9
  195. package/dist/src/global/A-StepManager/A-StepManager.error.js.map +0 -1
  196. package/dist/src/global/ASEID/ASEID.class.d.ts +0 -130
  197. package/dist/src/global/ASEID/ASEID.class.js +0 -167
  198. package/dist/src/global/ASEID/ASEID.class.js.map +0 -1
  199. package/dist/src/global/ASEID/ASEID.constants.d.ts +0 -0
  200. package/dist/src/global/ASEID/ASEID.constants.js +0 -2
  201. package/dist/src/global/ASEID/ASEID.constants.js.map +0 -1
  202. package/dist/src/global/ASEID/ASEID.error.d.ts +0 -5
  203. package/dist/src/global/ASEID/ASEID.error.js +0 -10
  204. package/dist/src/global/ASEID/ASEID.error.js.map +0 -1
  205. package/dist/src/global/ASEID/ASEID.types.d.ts +0 -65
  206. package/dist/src/global/ASEID/ASEID.types.js +0 -5
  207. package/dist/src/global/ASEID/ASEID.types.js.map +0 -1
  208. package/dist/src/helpers/A_Common.helper.d.ts +0 -28
  209. package/dist/src/helpers/A_Common.helper.js +0 -170
  210. package/dist/src/helpers/A_Common.helper.js.map +0 -1
  211. package/dist/src/helpers/A_Formatter.helper.d.ts +0 -35
  212. package/dist/src/helpers/A_Formatter.helper.js +0 -62
  213. package/dist/src/helpers/A_Formatter.helper.js.map +0 -1
  214. package/dist/src/helpers/A_Identity.helper.d.ts +0 -29
  215. package/dist/src/helpers/A_Identity.helper.js +0 -43
  216. package/dist/src/helpers/A_Identity.helper.js.map +0 -1
  217. package/dist/src/helpers/A_TypeGuards.helper.d.ts +0 -207
  218. package/dist/src/helpers/A_TypeGuards.helper.js +0 -296
  219. package/dist/src/helpers/A_TypeGuards.helper.js.map +0 -1
  220. package/dist/src/types/A_Common.types.d.ts +0 -36
  221. package/dist/src/types/A_Common.types.js +0 -3
  222. package/dist/src/types/A_Common.types.js.map +0 -1
  223. package/index.ts +0 -81
  224. package/src/global/A-Dependency/A-DependencyReference.class.ts +0 -61
  225. package/src/global/A-Dependency/A-DependencyReference.types.ts +0 -61
  226. package/trace-require.js +0 -46
  227. package/tsconfig.build.json +0 -58
@@ -1,296 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.A_Error = void 0;
4
- const A_Error_constants_1 = require("./A_Error.constants");
5
- const A_Formatter_helper_1 = require("../../helpers/A_Formatter.helper");
6
- const A_Context_class_1 = require("../A-Context/A-Context.class");
7
- const A_TypeGuards_helper_1 = require("../../helpers/A_TypeGuards.helper");
8
- const ASEID_class_1 = require("../ASEID/ASEID.class");
9
- const env_constants_1 = require("../../constants/env.constants");
10
- class A_Error extends Error {
11
- // ====================================================================
12
- // ================== Static A-Error Information ======================
13
- // ====================================================================
14
- /**
15
- * Error Identifier that corresponds to the class name
16
- */
17
- static get entity() {
18
- return A_Formatter_helper_1.A_FormatterHelper.toKebabCase(this.name);
19
- }
20
- /**
21
- * DEFAULT Namespace of the error from environment variable A_CONCEPT_NAMESPACE
22
- *
23
- * [!] If environment variable is not set, it will default to 'a-concept'
24
- */
25
- static get concept() {
26
- return A_Context_class_1.A_Context.concept;
27
- }
28
- /**
29
- * DEFAULT Scope of the entity from environment variable A_CONCEPT_DEFAULT_SCOPE
30
- *
31
- * [!] If environment variable is not set, it will default to 'core'
32
- * [!] Scope is an application specific identifier that can be used to group entities together
33
- * [!] e.g. 'default', 'core', 'public', 'internal', etc
34
- */
35
- static get scope() {
36
- return A_Context_class_1.A_Context.root.name;
37
- }
38
- constructor(param1, param2) {
39
- // to prevent errors accumulation in the stack trace it returns the original error if provided param1 is A_Error
40
- switch (true) {
41
- case param1 instanceof A_Error:
42
- return param1;
43
- case param1 instanceof Error:
44
- super(param1.message);
45
- break;
46
- case A_TypeGuards_helper_1.A_TypeGuards.isConstructorType(param1) && 'description' in param1:
47
- super(`[${param1.title}]: ${param1.description}`);
48
- break;
49
- case A_TypeGuards_helper_1.A_TypeGuards.isConstructorType(param1) && !('description' in param1):
50
- super(param1.title);
51
- break;
52
- case A_TypeGuards_helper_1.A_TypeGuards.isString(param1) && !param2:
53
- super(param1);
54
- break;
55
- case A_TypeGuards_helper_1.A_TypeGuards.isString(param1) && !!param2:
56
- super(`[${param1}]: ${param2}`);
57
- break;
58
- default:
59
- throw new A_Error(A_Error_constants_1.A_CONSTANTS__ERROR_CODES.VALIDATION_ERROR, 'Invalid parameters provided to A_Error constructor');
60
- }
61
- const initializer = this.getInitializer(param1, param2);
62
- // the returned initializer is already bound to `this` (we used .bind(this)),
63
- // so calling it will run the appropriate logic on this instance:
64
- initializer.call(this, param1, param2);
65
- }
66
- // ====================================================================
67
- // ================== Public A-Error Information ======================
68
- // ====================================================================
69
- /**
70
- * Returns the ASEID of the error instance
71
- */
72
- get aseid() {
73
- return this._aseid;
74
- }
75
- /**
76
- * Returns the title of the error
77
- *
78
- * Example: 'User not found', 'Validation error', 'Unauthorized access', etc.
79
- *
80
- * [!] Note: This title should be short and concise, less than 60 characters
81
- * [!] Note: If title exceeds 60 characters, there would be an error thrown
82
- * [!] Note: This title is intended to be human-readable and can be displayed in UI or logs
83
- */
84
- get title() {
85
- return this._title;
86
- }
87
- /**
88
- * Returns an Error message what is a brief title of the error
89
- *
90
- */
91
- get message() {
92
- return super.message;
93
- }
94
- /**
95
- * Returns a unique code representing the type of error
96
- *
97
- * If code is not provided, it will generate a kebab-case of the message
98
- *
99
- * Example: 'validation-error', 'not-found', 'user-not-found', 'unauthorized' etc.
100
- *
101
- * [!] Note: It is recommended to use kebab-case for error codes
102
- * [!] Note: If not provided would be used a kebab-case message of the error
103
- */
104
- get code() {
105
- return this._code || A_Formatter_helper_1.A_FormatterHelper.toKebabCase(this.title);
106
- }
107
- /**
108
- * Returns the type of the error which corresponds to the static entity of the class
109
- *
110
- * Example: 'a-error', 'validation-error', 'not-found-error', 'user-error', etc.
111
- *
112
- * Defaults to the kebab-case of the class name
113
- *
114
- * [!] Note: naming ad separation are fully dependent on the architecture of the application
115
- * [!] Note: It is recommended to use kebab-case for error types
116
- * [!] Note: This type is intended to group similar errors together
117
- */
118
- get type() {
119
- return this.constructor.entity;
120
- }
121
- /**
122
- * Returns a link with possible documentation or support page for the error
123
- * If link is not provided, it will generate a link based on the ASEID of the error that points to the A-Concept support page
124
- *
125
- * Example: https://adaas.support/a-concept/errors/{ASEID}
126
- *
127
- * [!] Note: ASEID is generated based on the static properties of the class (concept, scope, entity) and the code of the error
128
- */
129
- get link() {
130
- if (this._link)
131
- return this._link;
132
- const url = new URL(`https://adaas.support/a-concept/errors/${this.aseid.toString()}`);
133
- return url.toString();
134
- }
135
- /**
136
- * The scope name of the error instance
137
- *
138
- * If scope is not provided, it will use the static scope of the class
139
- *
140
- * [!] Note: Scope is an application specific identifier that can be used to group entities together
141
- * [!] e.g. 'default', 'core', 'public', 'internal', etc
142
- */
143
- get scope() {
144
- return this._aseid.scope;
145
- }
146
- /**
147
- * A detailed description of the error
148
- * If description is not provided, it will use the environment variable A_ERROR_DEFAULT_DESCRIPTION or a generic message
149
- *
150
- * Example: 'The user with the given ID was not found.', 'The provided data is invalid.', 'You do not have permission to access this resource.', etc.
151
- *
152
- * [!] Note: This description is intended to provide more context about the error and can be used for debugging or logging purposes
153
- */
154
- get description() {
155
- return this._description || process.env[env_constants_1.A_CONSTANTS__DEFAULT_ENV_VARIABLES.A_ERROR_DEFAULT_DESCRIPTION] || A_Error_constants_1.A_CONSTANTS__ERROR_DESCRIPTION;
156
- }
157
- /**
158
- * Returns the original error if any
159
- *
160
- * This can be useful for debugging purposes to see the original stack trace or error message
161
- *
162
- * [!] Note: Original error is optional and may not be present in all cases
163
- */
164
- get originalError() {
165
- return this._originalError;
166
- }
167
- /**
168
- * Determines which initializer method to use based on the type of the first parameter.
169
- *
170
- * @param param1
171
- * @returns
172
- */
173
- getInitializer(param1, param2) {
174
- switch (true) {
175
- case A_TypeGuards_helper_1.A_TypeGuards.isString(param1) && !param2:
176
- return this.fromMessage;
177
- case A_TypeGuards_helper_1.A_TypeGuards.isString(param1) && !!param2:
178
- return this.fromTitle;
179
- case param1 instanceof Error:
180
- return this.fromError;
181
- case A_TypeGuards_helper_1.A_TypeGuards.isConstructorType(param1):
182
- return this.fromConstructor;
183
- default: {
184
- console.log('INVALID PARAMS PROVIDED TO A_ERROR CONSTRUCTOR: ', param1);
185
- throw new A_Error(A_Error_constants_1.A_CONSTANTS__ERROR_CODES.VALIDATION_ERROR, 'Invalid parameters provided to A_Error constructor');
186
- }
187
- }
188
- }
189
- /**
190
- * Initializes the A_Error instance from a standard Error object.
191
- *
192
- * @param error
193
- */
194
- fromError(error) {
195
- this._title = A_Error_constants_1.A_CONSTANTS__ERROR_CODES.UNEXPECTED_ERROR;
196
- this._aseid = new ASEID_class_1.ASEID({
197
- concept: this.constructor.concept,
198
- scope: this.constructor.scope,
199
- entity: this.constructor.entity,
200
- id: this.code
201
- });
202
- this._originalError = error;
203
- }
204
- /**
205
- * Initializes the A_Error instance from a message.
206
- *
207
- * @param title
208
- * @param description
209
- */
210
- fromMessage(message) {
211
- this._title = A_Error_constants_1.A_CONSTANTS__ERROR_CODES.UNEXPECTED_ERROR;
212
- this._aseid = new ASEID_class_1.ASEID({
213
- concept: this.constructor.concept,
214
- scope: this._scope || this.constructor.scope,
215
- entity: this.constructor.entity,
216
- id: this.code
217
- });
218
- this._link = undefined;
219
- this._originalError = undefined;
220
- }
221
- fromTitle(title, description) {
222
- this.validateTitle(title);
223
- this._title = title;
224
- this._description = description;
225
- this._aseid = new ASEID_class_1.ASEID({
226
- concept: this.constructor.concept,
227
- scope: this._scope || this.constructor.scope,
228
- entity: this.constructor.entity,
229
- id: this.code
230
- });
231
- this._link = undefined;
232
- this._originalError = undefined;
233
- }
234
- /**
235
- * Initializes the A_Error instance from a constructor parameters object.
236
- *
237
- * @param params
238
- */
239
- fromConstructor(params) {
240
- this.validateTitle(params.title);
241
- this._title = params.title;
242
- this._code = params.code;
243
- this._scope = params.scope ? (A_TypeGuards_helper_1.A_TypeGuards.isScopeInstance(params.scope) ? params.scope.name : params.scope) : undefined;
244
- this._aseid = new ASEID_class_1.ASEID({
245
- concept: this.constructor.concept,
246
- scope: this._scope || this.constructor.scope,
247
- entity: this.constructor.entity,
248
- id: this.code
249
- });
250
- this._description = params.description;
251
- this._link = params.link;
252
- this._originalError = params.originalError;
253
- }
254
- /**
255
- * Serializes the A_Error instance to a plain object.
256
- *
257
- *
258
- * @returns
259
- */
260
- toJSON() {
261
- var _a;
262
- return {
263
- aseid: this.aseid.toString(),
264
- title: this.title,
265
- code: this.code,
266
- type: this.type,
267
- message: this.message,
268
- link: this.link,
269
- scope: this.scope,
270
- description: this.description,
271
- originalError: (_a = this.originalError) === null || _a === void 0 ? void 0 : _a.message
272
- };
273
- }
274
- // --------------------------------------------------------------------------
275
- // ----------------------- PROTECTED HELPERS --------------------------------
276
- // --------------------------------------------------------------------------
277
- /**
278
- * Checks if the provided title exceeds 60 characters.
279
- * If it does, throws a validation A_Error.
280
- *
281
- * @param title
282
- */
283
- validateTitle(title) {
284
- if (title.length > 60) {
285
- throw new A_Error(A_Error_constants_1.A_CONSTANTS__ERROR_CODES.VALIDATION_ERROR, 'A-Error title exceeds 60 characters limit.');
286
- }
287
- if (title.length === 0) {
288
- throw new A_Error(A_Error_constants_1.A_CONSTANTS__ERROR_CODES.VALIDATION_ERROR, 'A-Error title cannot be empty.');
289
- }
290
- }
291
- }
292
- exports.A_Error = A_Error;
293
- // message = title + description for better printing in the console
294
- // description = detailed information about the error
295
- // code = kebabcase (title)
296
- //# sourceMappingURL=A_Error.class.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"A_Error.class.js","sourceRoot":"","sources":["../../../../src/global/A-Error/A_Error.class.ts"],"names":[],"mappings":";;;AAIA,2DAG6B;AAC7B,oFAAgF;AAChF,kEAAyD;AACzD,sFAA4E;AAC5E,sDAA6C;AAC7C,4EAA8F;AAG9F,MAAa,OAGX,SAAQ,KAAK;IACX,uEAAuE;IACvE,uEAAuE;IACvE,uEAAuE;IACvE;;OAEG;IACH,MAAM,KAAK,MAAM;QACb,OAAO,sCAAiB,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpD,CAAC;IACD;;;;OAIG;IACH,MAAM,KAAK,OAAO;QACd,OAAO,2BAAS,CAAC,OAAO,CAAC;IAC7B,CAAC;IACD;;;;;;OAMG;IACH,MAAM,KAAK,KAAK;QACZ,OAAO,2BAAS,CAAC,IAAI,CAAC,IAAI,CAAC;IAC/B,CAAC;IAqGD,YACI,MAAmD,EACnD,MAAe;QAEf,iHAAiH;QACjH,QAAQ,IAAI,EAAE,CAAC;YACX,KAAK,MAAM,YAAY,OAAO;gBAC1B,OAAO,MAAoD,CAAC;YAEhE,KAAK,MAAM,YAAY,KAAK;gBACxB,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBACtB,MAAM;YAEV,KAAK,kCAAY,CAAC,iBAAiB,CAAmB,MAAM,CAAC,IAAI,aAAa,IAAI,MAAM;gBACpF,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;gBAClD,MAAM;YAEV,KAAK,kCAAY,CAAC,iBAAiB,CAAmB,MAAM,C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CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,aAAa,EAAE,MAAA,IAAI,CAAC,aAAa,0CAAE,OAAO;SAC1B,CAAC;IACzB,CAAC;IAID,6EAA6E;IAC7E,6EAA6E;IAC7E,6EAA6E;IAC7E;;;;;OAKG;IACO,aAAa,CAAC,KAAa;QACjC,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;YACpB,MAAM,IAAI,OAAO,CACb,4CAAwB,CAAC,gBAAgB,EACzC,4CAA4C,CAC/C,CAAC;QACN,CAAC;QACD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrB,MAAM,IAAI,OAAO,CACb,4CAAwB,CAAC,gBAAgB,EACzC,gCAAgC,CACnC,CAAC;QACN,CAAC;IACL,CAAC;CACJ;AAvbD,0BAubC;AAMD,mEAAmE;AACnE,qDAAqD;AACrD,2BAA2B"}
@@ -1,5 +0,0 @@
1
- export declare const A_CONSTANTS__ERROR_CODES: {
2
- readonly UNEXPECTED_ERROR: "A-Error Unexpected Error";
3
- readonly VALIDATION_ERROR: "A-Error Validation Error";
4
- };
5
- export declare const A_CONSTANTS__ERROR_DESCRIPTION = "If you see this error please let us know.";
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.A_CONSTANTS__ERROR_DESCRIPTION = exports.A_CONSTANTS__ERROR_CODES = void 0;
4
- exports.A_CONSTANTS__ERROR_CODES = {
5
- UNEXPECTED_ERROR: 'A-Error Unexpected Error',
6
- VALIDATION_ERROR: 'A-Error Validation Error',
7
- };
8
- exports.A_CONSTANTS__ERROR_DESCRIPTION = 'If you see this error please let us know.';
9
- //# sourceMappingURL=A_Error.constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"A_Error.constants.js","sourceRoot":"","sources":["../../../../src/global/A-Error/A_Error.constants.ts"],"names":[],"mappings":";;;AAGa,QAAA,wBAAwB,GAAG;IACpC,gBAAgB,EAAE,0BAA0B;IAC5C,gBAAgB,EAAE,0BAA0B;CACtC,CAAC;AAIE,QAAA,8BAA8B,GAAG,2CAA2C,CAAA"}
@@ -1,93 +0,0 @@
1
- import { A_Scope } from "../A-Scope/A-Scope.class";
2
- import { A_Error } from "./A_Error.class";
3
- /**
4
- * Entity constructor type
5
- * Uses the generic type T to specify the type of the entity
6
- */
7
- export type A_TYPES__Error_Constructor<T = A_Error> = new (...args: any[]) => T;
8
- /**
9
- * Error initialization type
10
- */
11
- export type A_TYPES__Error_Init = {
12
- /**
13
- * Error title
14
- *
15
- * A short description of the error
16
- */
17
- title: string;
18
- /**
19
- * Error code representing the type of error
20
- *
21
- * Should be unique within the application or service
22
- *
23
- * Example: 'validation-error', 'not-found', 'user-not-found', 'unauthorized' etc.
24
- *
25
- * [!] Note: It is recommended to use kebab-case for error codes
26
- * [!] Note: If not provided would be used a kebab-case message of the error
27
- */
28
- code?: string;
29
- /**
30
- * Possible Scope if needed to identify the error by it's execution environment
31
- *
32
- * For example, error of type 'validation' could happen in different scopes
33
- * like 'user', 'admin', 'system' etc. This will help to identify the error context better
34
- *
35
- * Could be string or A_Scope instance
36
- *
37
- * [!] Note: If not provided, the default scope of the A_Error will be used (A_Context.root.name)
38
- */
39
- scope?: string | A_Scope;
40
- /**
41
- * Detailed description of the error
42
- */
43
- description?: string;
44
- /**
45
- * Link to the documentation or support page for the error
46
- */
47
- link?: string;
48
- /**
49
- * Original Error if any
50
- */
51
- originalError?: Error | unknown;
52
- };
53
- /**
54
- * Error serialized type
55
- */
56
- export type A_TYPES__Error_Serialized = {
57
- /**
58
- * ASEID of the error
59
- */
60
- aseid: string;
61
- /**
62
- * A brief title of the error
63
- */
64
- title: string;
65
- /**
66
- * Error message
67
- */
68
- message: string;
69
- /**
70
- * Type of the error
71
- */
72
- type: string;
73
- /**
74
- * Error code
75
- */
76
- code: string;
77
- /**
78
- * Error description
79
- */
80
- description: string;
81
- /**
82
- * Link to documentation or support page
83
- */
84
- link?: string;
85
- /**
86
- * Scope of the error
87
- */
88
- scope: string;
89
- /**
90
- * Original error message if any
91
- */
92
- originalError?: string;
93
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=A_Error.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"A_Error.types.js","sourceRoot":"","sources":["../../../../src/global/A-Error/A_Error.types.ts"],"names":[],"mappings":""}
@@ -1,15 +0,0 @@
1
- import { A_TYPES__FeatureDefineDecoratorConfig, A_TYPES__FeatureDefineDecoratorDescriptor, A_TYPES__FeatureDefineDecoratorTarget } from "./A-Feature.types";
2
- /**
3
- * A-Feature decorator
4
- *
5
- * This decorator allows to define a custom lifecycle stage for the Container.
6
- * These stages are executed in a container-specific order and can be extended by components that are injected into the container.
7
- * This approach allows to create a flexible and extendable architecture for the application.
8
- *
9
- * The main difference between the A-Feature and A-Feature decorators is that A-Feature methods can be inherited and overridden by child classes.
10
- *
11
- *
12
- * @param params
13
- * @returns
14
- */
15
- export declare function A_Feature_Define(config?: Partial<A_TYPES__FeatureDefineDecoratorConfig>): (target: A_TYPES__FeatureDefineDecoratorTarget, propertyKey: string, descriptor: A_TYPES__FeatureDefineDecoratorDescriptor) => A_TYPES__FeatureDefineDecoratorDescriptor;
@@ -1,76 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.A_Feature_Define = A_Feature_Define;
4
- const A_Context_class_1 = require("../A-Context/A-Context.class");
5
- const A_Meta_class_1 = require("../A-Meta/A-Meta.class");
6
- const A_Entity_constants_1 = require("../A-Entity/A-Entity.constants");
7
- const A_Container_constants_1 = require("../A-Container/A-Container.constants");
8
- const A_Component_constants_1 = require("../A-Component/A-Component.constants");
9
- const A_TypeGuards_helper_1 = require("../../helpers/A_TypeGuards.helper");
10
- const A_Feature_error_1 = require("./A-Feature.error");
11
- /**
12
- * A-Feature decorator
13
- *
14
- * This decorator allows to define a custom lifecycle stage for the Container.
15
- * These stages are executed in a container-specific order and can be extended by components that are injected into the container.
16
- * This approach allows to create a flexible and extendable architecture for the application.
17
- *
18
- * The main difference between the A-Feature and A-Feature decorators is that A-Feature methods can be inherited and overridden by child classes.
19
- *
20
- *
21
- * @param params
22
- * @returns
23
- */
24
- function A_Feature_Define(config = {}) {
25
- return function (target, propertyKey, descriptor) {
26
- var _a;
27
- // for error messages
28
- const componentName = ((_a = target === null || target === void 0 ? void 0 : target.constructor) === null || _a === void 0 ? void 0 : _a.name) || String(target) || 'Unknown';
29
- if (!A_TypeGuards_helper_1.A_TypeGuards.isAllowedForFeatureDefinition(target))
30
- throw new A_Feature_error_1.A_FeatureError(A_Feature_error_1.A_FeatureError.FeatureDefinitionError, `A-Feature cannot be defined on the ${componentName} level`);
31
- const meta = A_Context_class_1.A_Context.meta(target.constructor);
32
- let metaKey;
33
- switch (true) {
34
- case A_TypeGuards_helper_1.A_TypeGuards.isEntityInstance(target):
35
- metaKey = A_Entity_constants_1.A_TYPES__EntityMetaKey.FEATURES;
36
- break;
37
- case A_TypeGuards_helper_1.A_TypeGuards.isContainerInstance(target):
38
- metaKey = A_Container_constants_1.A_TYPES__ContainerMetaKey.FEATURES;
39
- break;
40
- case A_TypeGuards_helper_1.A_TypeGuards.isComponentInstance(target):
41
- metaKey = A_Component_constants_1.A_TYPES__ComponentMetaKey.FEATURES;
42
- break;
43
- }
44
- // Get the existed metadata or create a new one
45
- const existedMeta = meta.get(metaKey) || new A_Meta_class_1.A_Meta();
46
- const name = config.name || propertyKey;
47
- // default to false
48
- const invoke = config.invoke || false;
49
- // Set the metadata of the method to define a custom Feature with name
50
- existedMeta.set(propertyKey, {
51
- name: `${target.constructor.name}.${name}`,
52
- handler: propertyKey,
53
- invoke: invoke,
54
- template: config.template && config.template.length ? config.template.map(item => (Object.assign(Object.assign({}, item), { before: item.before || '', after: item.after || '', behavior: item.behavior || 'sync', throwOnError: true, override: item.override || '' }))) : [],
55
- });
56
- // Update the metadata of the container with the new Feature definition
57
- A_Context_class_1.A_Context
58
- .meta(target.constructor)
59
- .set(metaKey, existedMeta);
60
- const originalMethod = descriptor.value;
61
- // Wrap the original method to add the call to `call`
62
- // this helps to automatically call the container/entity/component method when it's called
63
- descriptor.value = function (...args) {
64
- // Call the original method
65
- if (!invoke)
66
- return originalMethod.apply(this, args);
67
- else
68
- originalMethod.apply(this, args);
69
- // Call your `call` with the function name
70
- if (typeof this.call === "function" && invoke)
71
- return this.call(name);
72
- };
73
- return descriptor;
74
- };
75
- }
76
- //# sourceMappingURL=A-Feature-Define.decorator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"A-Feature-Define.decorator.js","sourceRoot":"","sources":["../../../../src/global/A-Feature/A-Feature-Define.decorator.ts"],"names":[],"mappings":";;AA8BA,4CAiGC;AAzHD,uFAA8E;AAI9E,8EAAqE;AACrE,4FAA6F;AAC7F,qGAAsG;AACtG,qGAAsG;AACtG,sFAA4E;AAC5E,uDAAmD;AAEnD;;;;;;;;;;;;GAYG;AACH,SAAgB,gBAAgB,CAC5B,SAAyD,EAAE;IAE3D,OAAO,UACH,MAA6C,EAC7C,WAAmB,EACnB,UAAqD;;QAErD,qBAAqB;QACrB,MAAM,aAAa,GAAG,CAAA,MAAC,MAAc,aAAd,MAAM,uBAAN,MAAM,CAAU,WAAW,0CAAE,IAAI,KAAI,MAAM,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC;QAGxF,IAAI,CAAC,kCAAY,CAAC,6BAA6B,CAAC,MAAM,CAAC;YACnD,MAAM,IAAI,gCAAc,CACpB,gCAAc,CAAC,sBAAsB,EACrC,sCAAsC,aAAa,QAAQ,CAC9D,CAAC;QAEN,MAAM,IAAI,GAAqD,2BAAS,CAAC,IAAI,CAAC,MAAM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I,EAAE,IAE/B,CACL,CAAC,CAAC,CAAC,EAAE;SACT,CAAC,CAAC;QAEH,wEAAwE;QACxE,2BAAS;aACJ,IAAI,CAAC,MAAM,CAAC,WAAkB,CAAC;aAC/B,GAAG,CACA,OAAO,EACP,WAAW,CACd,CAAC;QAEN,MAAM,cAAc,GAAG,UAAU,CAAC,KAAM,CAAC;QAEzC,qDAAqD;QACrD,0FAA0F;QAC1F,UAAU,CAAC,KAAK,GAAG,UAAU,GAAG,IAAW;YAEvC,2BAA2B;YAC3B,IAAI,CAAC,MAAM;gBACP,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;;gBAExC,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAErC,0CAA0C;YAC1C,IAAI,OAAQ,IAA8C,CAAC,IAAI,KAAK,UAAU,IAAI,MAAM;gBACpF,OAAQ,IAA8C,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE1E,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACtB,CAAC,CAAC;AACN,CAAC"}
@@ -1,56 +0,0 @@
1
- import { A_TYPES__FeatureExtendDecoratorConfig } from "./A-Feature.types";
2
- /**
3
- * A-Extend decorator
4
- *
5
- * This decorator allows to define a custom Extend stage for the Container.
6
- * These stages are executed in a container-specific order and can be extended by components that are injected into the container.
7
- * This approach allows to create a flexible and extendable architecture for the application.
8
- *
9
- * The main difference between the A-Extend and A-Extend decorators is that A-Extend methods can be inherited and overridden by child classes.
10
- *
11
- *
12
- * @param params
13
- * @returns
14
- */
15
- /**
16
- * Use regexp in case if you need more flexibility and control over the name of the method
17
- *
18
- * @param regexp
19
- */
20
- export declare function A_Feature_Extend(
21
- /**
22
- * The regular expression to match the name of the Feature method to be extended
23
- *
24
- * Example:
25
- *
26
- * ```ts
27
- * @A_Feature.Extend(/.*\.load/)
28
- * ```
29
- */
30
- regexp: RegExp): any;
31
- /**
32
- * In this case the name configurations will be used as an input to get scope and name of target function
33
- * [!] Not that for all SCOPE will be used OR operator
34
- *
35
- * @param config
36
- */
37
- export declare function A_Feature_Extend(
38
- /**
39
- * Configuration for the A-Feature-Extend decorator
40
- */
41
- config: Partial<A_TYPES__FeatureExtendDecoratorConfig>): any;
42
- /**
43
- * In this case the name of function will be used as a name of the Feature.
44
- * [!] AND it will be applicable for ANY element where the name is the same as the name of the function
45
- */
46
- export declare function A_Feature_Extend(): any;
47
- /**
48
- * Builds a target regular expression based on the provided parameters.
49
- *
50
- * @param param1 - The first parameter, which can be a string or an object.
51
- * @param include - An array of items to include in the regular expression.
52
- * @param exclude - An array of items to exclude from the regular expression.
53
- * @param propertyKey - The property key to use in the regular expression.
54
- * @returns A regular expression object.
55
- */
56
- export declare function buildTargetRegexp(param1: any, include: any[], exclude: any[], propertyKey: string): RegExp;