@adaas/a-concept 0.1.23 → 0.1.25

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 (234) hide show
  1. package/dist/index.cjs +3 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.mts +3952 -0
  4. package/dist/index.d.ts +3952 -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 +18 -13
  9. package/src/global/A-Component/A-Component.meta.ts +3 -2
  10. package/src/global/A-Container/A-Container.meta.ts +5 -8
  11. package/src/global/A-Context/A-Context.class.ts +81 -7
  12. package/src/global/A-Context/A-Context.error.ts +4 -0
  13. package/src/global/A-Dependency/A-Dependency-Default.decorator.ts +75 -0
  14. package/src/global/A-Dependency/A-Dependency-Load.decorator.ts +80 -0
  15. package/src/global/A-Dependency/A-Dependency-Require.decorator.ts +68 -0
  16. package/src/global/A-Dependency/A-Dependency.class.ts +33 -0
  17. package/src/global/A-Dependency/A-Dependency.error.ts +13 -0
  18. package/src/global/A-Dependency/A-Dependency.types.ts +28 -0
  19. package/src/global/A-Entity/A-Entity.class.ts +2 -1
  20. package/src/global/A-Feature/A-Feature-Define.decorator.ts +7 -4
  21. package/src/global/A-Feature/A-Feature-Extend.decorator.ts +23 -17
  22. package/src/global/A-Feature/A-Feature.class.ts +12 -1
  23. package/src/global/A-Feature/A-Feature.types.ts +33 -8
  24. package/src/global/A-Inject/A-Inject.decorator.ts +4 -2
  25. package/src/global/A-Inject/A-Inject.types.ts +5 -3
  26. package/src/global/A-Scope/A-Scope.class.ts +85 -57
  27. package/src/global/A-Stage/A-Stage.class.ts +22 -2
  28. package/src/global/A-Stage/A-Stage.error.ts +2 -0
  29. package/src/global/A-Stage/A-Stage.types.ts +7 -2
  30. package/src/global/A-StepManager/A-StepManager.class.ts +19 -13
  31. package/src/helpers/A_Common.helper.ts +101 -0
  32. package/src/helpers/A_TypeGuards.helper.ts +8 -0
  33. package/src/index.ts +88 -0
  34. package/tests/A-Component.test.ts +1 -1
  35. package/tests/A-Concept.test.ts +58 -10
  36. package/tests/A-Dependency.test.ts +93 -0
  37. package/tests/A-Feature.test.ts +11 -11
  38. package/tests/A-Scope.test.ts +10 -10
  39. package/tests/A-StepManager.test.ts +60 -11
  40. package/tsconfig.json +2 -2
  41. package/tsup.config.ts +32 -0
  42. package/dist/index.js +0 -112
  43. package/dist/index.js.map +0 -1
  44. package/dist/src/constants/env.constants.d.ts +0 -33
  45. package/dist/src/constants/env.constants.js +0 -47
  46. package/dist/src/constants/env.constants.js.map +0 -1
  47. package/dist/src/global/A-Abstraction/A-Abstraction-Extend.decorator.d.ts +0 -23
  48. package/dist/src/global/A-Abstraction/A-Abstraction-Extend.decorator.js +0 -89
  49. package/dist/src/global/A-Abstraction/A-Abstraction-Extend.decorator.js.map +0 -1
  50. package/dist/src/global/A-Abstraction/A-Abstraction.class.d.ts +0 -74
  51. package/dist/src/global/A-Abstraction/A-Abstraction.class.js +0 -130
  52. package/dist/src/global/A-Abstraction/A-Abstraction.class.js.map +0 -1
  53. package/dist/src/global/A-Abstraction/A-Abstraction.error.d.ts +0 -7
  54. package/dist/src/global/A-Abstraction/A-Abstraction.error.js +0 -12
  55. package/dist/src/global/A-Abstraction/A-Abstraction.error.js.map +0 -1
  56. package/dist/src/global/A-Abstraction/A-Abstraction.types.d.ts +0 -38
  57. package/dist/src/global/A-Abstraction/A-Abstraction.types.js +0 -3
  58. package/dist/src/global/A-Abstraction/A-Abstraction.types.js.map +0 -1
  59. package/dist/src/global/A-Caller/A_Caller.class.d.ts +0 -33
  60. package/dist/src/global/A-Caller/A_Caller.class.js +0 -44
  61. package/dist/src/global/A-Caller/A_Caller.class.js.map +0 -1
  62. package/dist/src/global/A-Caller/A_Caller.error.d.ts +0 -7
  63. package/dist/src/global/A-Caller/A_Caller.error.js +0 -12
  64. package/dist/src/global/A-Caller/A_Caller.error.js.map +0 -1
  65. package/dist/src/global/A-Caller/A_Caller.types.d.ts +0 -18
  66. package/dist/src/global/A-Caller/A_Caller.types.js +0 -3
  67. package/dist/src/global/A-Caller/A_Caller.types.js.map +0 -1
  68. package/dist/src/global/A-Component/A-Component.class.d.ts +0 -34
  69. package/dist/src/global/A-Component/A-Component.class.js +0 -56
  70. package/dist/src/global/A-Component/A-Component.class.js.map +0 -1
  71. package/dist/src/global/A-Component/A-Component.constants.d.ts +0 -6
  72. package/dist/src/global/A-Component/A-Component.constants.js +0 -11
  73. package/dist/src/global/A-Component/A-Component.constants.js.map +0 -1
  74. package/dist/src/global/A-Component/A-Component.meta.d.ts +0 -34
  75. package/dist/src/global/A-Component/A-Component.meta.js +0 -77
  76. package/dist/src/global/A-Component/A-Component.meta.js.map +0 -1
  77. package/dist/src/global/A-Component/A-Component.types.d.ts +0 -76
  78. package/dist/src/global/A-Component/A-Component.types.js +0 -4
  79. package/dist/src/global/A-Component/A-Component.types.js.map +0 -1
  80. package/dist/src/global/A-Concept/A-Concept.class.d.ts +0 -153
  81. package/dist/src/global/A-Concept/A-Concept.class.js +0 -260
  82. package/dist/src/global/A-Concept/A-Concept.class.js.map +0 -1
  83. package/dist/src/global/A-Concept/A-Concept.constants.d.ts +0 -33
  84. package/dist/src/global/A-Concept/A-Concept.constants.js +0 -39
  85. package/dist/src/global/A-Concept/A-Concept.constants.js.map +0 -1
  86. package/dist/src/global/A-Concept/A-Concept.meta.d.ts +0 -6
  87. package/dist/src/global/A-Concept/A-Concept.meta.js +0 -12
  88. package/dist/src/global/A-Concept/A-Concept.meta.js.map +0 -1
  89. package/dist/src/global/A-Concept/A-Concept.types.d.ts +0 -66
  90. package/dist/src/global/A-Concept/A-Concept.types.js +0 -3
  91. package/dist/src/global/A-Concept/A-Concept.types.js.map +0 -1
  92. package/dist/src/global/A-Container/A-Container.class.d.ts +0 -52
  93. package/dist/src/global/A-Container/A-Container.class.js +0 -78
  94. package/dist/src/global/A-Container/A-Container.class.js.map +0 -1
  95. package/dist/src/global/A-Container/A-Container.constants.d.ts +0 -6
  96. package/dist/src/global/A-Container/A-Container.constants.js +0 -11
  97. package/dist/src/global/A-Container/A-Container.constants.js.map +0 -1
  98. package/dist/src/global/A-Container/A-Container.meta.d.ts +0 -35
  99. package/dist/src/global/A-Container/A-Container.meta.js +0 -83
  100. package/dist/src/global/A-Container/A-Container.meta.js.map +0 -1
  101. package/dist/src/global/A-Container/A-Container.types.d.ts +0 -75
  102. package/dist/src/global/A-Container/A-Container.types.js +0 -4
  103. package/dist/src/global/A-Container/A-Container.types.js.map +0 -1
  104. package/dist/src/global/A-Context/A-Context.class.d.ts +0 -361
  105. package/dist/src/global/A-Context/A-Context.class.js +0 -603
  106. package/dist/src/global/A-Context/A-Context.class.js.map +0 -1
  107. package/dist/src/global/A-Context/A-Context.error.d.ts +0 -20
  108. package/dist/src/global/A-Context/A-Context.error.js +0 -25
  109. package/dist/src/global/A-Context/A-Context.error.js.map +0 -1
  110. package/dist/src/global/A-Context/A-Context.types.d.ts +0 -5
  111. package/dist/src/global/A-Context/A-Context.types.js +0 -3
  112. package/dist/src/global/A-Context/A-Context.types.js.map +0 -1
  113. package/dist/src/global/A-Dependency/A-DependencyReference.class.d.ts +0 -0
  114. package/dist/src/global/A-Dependency/A-DependencyReference.class.js +0 -49
  115. package/dist/src/global/A-Dependency/A-DependencyReference.class.js.map +0 -1
  116. package/dist/src/global/A-Dependency/A-DependencyReference.types.d.ts +0 -0
  117. package/dist/src/global/A-Dependency/A-DependencyReference.types.js +0 -58
  118. package/dist/src/global/A-Dependency/A-DependencyReference.types.js.map +0 -1
  119. package/dist/src/global/A-Entity/A-Entity.class.d.ts +0 -214
  120. package/dist/src/global/A-Entity/A-Entity.class.js +0 -281
  121. package/dist/src/global/A-Entity/A-Entity.class.js.map +0 -1
  122. package/dist/src/global/A-Entity/A-Entity.constants.d.ts +0 -11
  123. package/dist/src/global/A-Entity/A-Entity.constants.js +0 -17
  124. package/dist/src/global/A-Entity/A-Entity.constants.js.map +0 -1
  125. package/dist/src/global/A-Entity/A-Entity.error.d.ts +0 -7
  126. package/dist/src/global/A-Entity/A-Entity.error.js +0 -12
  127. package/dist/src/global/A-Entity/A-Entity.error.js.map +0 -1
  128. package/dist/src/global/A-Entity/A-Entity.meta.d.ts +0 -11
  129. package/dist/src/global/A-Entity/A-Entity.meta.js +0 -18
  130. package/dist/src/global/A-Entity/A-Entity.meta.js.map +0 -1
  131. package/dist/src/global/A-Entity/A-Entity.types.d.ts +0 -56
  132. package/dist/src/global/A-Entity/A-Entity.types.js +0 -5
  133. package/dist/src/global/A-Entity/A-Entity.types.js.map +0 -1
  134. package/dist/src/global/A-Error/A_Error.class.d.ts +0 -229
  135. package/dist/src/global/A-Error/A_Error.class.js +0 -296
  136. package/dist/src/global/A-Error/A_Error.class.js.map +0 -1
  137. package/dist/src/global/A-Error/A_Error.constants.d.ts +0 -5
  138. package/dist/src/global/A-Error/A_Error.constants.js +0 -9
  139. package/dist/src/global/A-Error/A_Error.constants.js.map +0 -1
  140. package/dist/src/global/A-Error/A_Error.types.d.ts +0 -93
  141. package/dist/src/global/A-Error/A_Error.types.js +0 -3
  142. package/dist/src/global/A-Error/A_Error.types.js.map +0 -1
  143. package/dist/src/global/A-Feature/A-Feature-Define.decorator.d.ts +0 -15
  144. package/dist/src/global/A-Feature/A-Feature-Define.decorator.js +0 -76
  145. package/dist/src/global/A-Feature/A-Feature-Define.decorator.js.map +0 -1
  146. package/dist/src/global/A-Feature/A-Feature-Extend.decorator.d.ts +0 -56
  147. package/dist/src/global/A-Feature/A-Feature-Extend.decorator.js +0 -119
  148. package/dist/src/global/A-Feature/A-Feature-Extend.decorator.js.map +0 -1
  149. package/dist/src/global/A-Feature/A-Feature.class.d.ts +0 -175
  150. package/dist/src/global/A-Feature/A-Feature.class.js +0 -318
  151. package/dist/src/global/A-Feature/A-Feature.class.js.map +0 -1
  152. package/dist/src/global/A-Feature/A-Feature.error.d.ts +0 -25
  153. package/dist/src/global/A-Feature/A-Feature.error.js +0 -33
  154. package/dist/src/global/A-Feature/A-Feature.error.js.map +0 -1
  155. package/dist/src/global/A-Feature/A-Feature.types.d.ts +0 -310
  156. package/dist/src/global/A-Feature/A-Feature.types.js +0 -26
  157. package/dist/src/global/A-Feature/A-Feature.types.js.map +0 -1
  158. package/dist/src/global/A-Fragment/A-Fragment.class.d.ts +0 -36
  159. package/dist/src/global/A-Fragment/A-Fragment.class.js +0 -46
  160. package/dist/src/global/A-Fragment/A-Fragment.class.js.map +0 -1
  161. package/dist/src/global/A-Fragment/A-Fragment.types.d.ts +0 -21
  162. package/dist/src/global/A-Fragment/A-Fragment.types.js +0 -6
  163. package/dist/src/global/A-Fragment/A-Fragment.types.js.map +0 -1
  164. package/dist/src/global/A-Inject/A-Inject.decorator.d.ts +0 -80
  165. package/dist/src/global/A-Inject/A-Inject.decorator.js +0 -49
  166. package/dist/src/global/A-Inject/A-Inject.decorator.js.map +0 -1
  167. package/dist/src/global/A-Inject/A-Inject.error.d.ts +0 -5
  168. package/dist/src/global/A-Inject/A-Inject.error.js +0 -10
  169. package/dist/src/global/A-Inject/A-Inject.error.js.map +0 -1
  170. package/dist/src/global/A-Inject/A-Inject.types.d.ts +0 -42
  171. package/dist/src/global/A-Inject/A-Inject.types.js +0 -3
  172. package/dist/src/global/A-Inject/A-Inject.types.js.map +0 -1
  173. package/dist/src/global/A-Meta/A-Meta.class.d.ts +0 -97
  174. package/dist/src/global/A-Meta/A-Meta.class.js +0 -164
  175. package/dist/src/global/A-Meta/A-Meta.class.js.map +0 -1
  176. package/dist/src/global/A-Meta/A-Meta.types.d.ts +0 -14
  177. package/dist/src/global/A-Meta/A-Meta.types.js +0 -3
  178. package/dist/src/global/A-Meta/A-Meta.types.js.map +0 -1
  179. package/dist/src/global/A-Scope/A-Scope.class.d.ts +0 -466
  180. package/dist/src/global/A-Scope/A-Scope.class.js +0 -791
  181. package/dist/src/global/A-Scope/A-Scope.class.js.map +0 -1
  182. package/dist/src/global/A-Scope/A-Scope.error.d.ts +0 -8
  183. package/dist/src/global/A-Scope/A-Scope.error.js +0 -13
  184. package/dist/src/global/A-Scope/A-Scope.error.js.map +0 -1
  185. package/dist/src/global/A-Scope/A-Scope.types.d.ts +0 -81
  186. package/dist/src/global/A-Scope/A-Scope.types.js +0 -3
  187. package/dist/src/global/A-Scope/A-Scope.types.js.map +0 -1
  188. package/dist/src/global/A-Stage/A-Stage.class.d.ts +0 -112
  189. package/dist/src/global/A-Stage/A-Stage.class.js +0 -240
  190. package/dist/src/global/A-Stage/A-Stage.class.js.map +0 -1
  191. package/dist/src/global/A-Stage/A-Stage.error.d.ts +0 -4
  192. package/dist/src/global/A-Stage/A-Stage.error.js +0 -11
  193. package/dist/src/global/A-Stage/A-Stage.error.js.map +0 -1
  194. package/dist/src/global/A-Stage/A-Stage.types.d.ts +0 -97
  195. package/dist/src/global/A-Stage/A-Stage.types.js +0 -43
  196. package/dist/src/global/A-Stage/A-Stage.types.js.map +0 -1
  197. package/dist/src/global/A-StepManager/A-StepManager.class.d.ts +0 -20
  198. package/dist/src/global/A-StepManager/A-StepManager.class.js +0 -111
  199. package/dist/src/global/A-StepManager/A-StepManager.class.js.map +0 -1
  200. package/dist/src/global/A-StepManager/A-StepManager.error.d.ts +0 -4
  201. package/dist/src/global/A-StepManager/A-StepManager.error.js +0 -9
  202. package/dist/src/global/A-StepManager/A-StepManager.error.js.map +0 -1
  203. package/dist/src/global/ASEID/ASEID.class.d.ts +0 -130
  204. package/dist/src/global/ASEID/ASEID.class.js +0 -167
  205. package/dist/src/global/ASEID/ASEID.class.js.map +0 -1
  206. package/dist/src/global/ASEID/ASEID.constants.d.ts +0 -0
  207. package/dist/src/global/ASEID/ASEID.constants.js +0 -2
  208. package/dist/src/global/ASEID/ASEID.constants.js.map +0 -1
  209. package/dist/src/global/ASEID/ASEID.error.d.ts +0 -5
  210. package/dist/src/global/ASEID/ASEID.error.js +0 -10
  211. package/dist/src/global/ASEID/ASEID.error.js.map +0 -1
  212. package/dist/src/global/ASEID/ASEID.types.d.ts +0 -65
  213. package/dist/src/global/ASEID/ASEID.types.js +0 -5
  214. package/dist/src/global/ASEID/ASEID.types.js.map +0 -1
  215. package/dist/src/helpers/A_Common.helper.d.ts +0 -28
  216. package/dist/src/helpers/A_Common.helper.js +0 -170
  217. package/dist/src/helpers/A_Common.helper.js.map +0 -1
  218. package/dist/src/helpers/A_Formatter.helper.d.ts +0 -35
  219. package/dist/src/helpers/A_Formatter.helper.js +0 -62
  220. package/dist/src/helpers/A_Formatter.helper.js.map +0 -1
  221. package/dist/src/helpers/A_Identity.helper.d.ts +0 -29
  222. package/dist/src/helpers/A_Identity.helper.js +0 -43
  223. package/dist/src/helpers/A_Identity.helper.js.map +0 -1
  224. package/dist/src/helpers/A_TypeGuards.helper.d.ts +0 -207
  225. package/dist/src/helpers/A_TypeGuards.helper.js +0 -296
  226. package/dist/src/helpers/A_TypeGuards.helper.js.map +0 -1
  227. package/dist/src/types/A_Common.types.d.ts +0 -36
  228. package/dist/src/types/A_Common.types.js +0 -3
  229. package/dist/src/types/A_Common.types.js.map +0 -1
  230. package/index.ts +0 -81
  231. package/src/global/A-Dependency/A-DependencyReference.class.ts +0 -61
  232. package/src/global/A-Dependency/A-DependencyReference.types.ts +0 -61
  233. package/trace-require.js +0 -46
  234. package/tsconfig.build.json +0 -58
@@ -1,119 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.A_Feature_Extend = A_Feature_Extend;
4
- exports.buildTargetRegexp = buildTargetRegexp;
5
- const A_Context_class_1 = require("../A-Context/A-Context.class");
6
- const A_Meta_class_1 = require("../A-Meta/A-Meta.class");
7
- const A_TypeGuards_helper_1 = require("../../helpers/A_TypeGuards.helper");
8
- const A_Component_constants_1 = require("../A-Component/A-Component.constants");
9
- const A_Feature_error_1 = require("./A-Feature.error");
10
- function A_Feature_Extend(param1) {
11
- return function (target, propertyKey, descriptor) {
12
- var _a, _b, _c;
13
- // for error messages
14
- const componentName = ((_a = target === null || target === void 0 ? void 0 : target.constructor) === null || _a === void 0 ? void 0 : _a.name) || String(target) || 'Unknown';
15
- if (!A_TypeGuards_helper_1.A_TypeGuards.isAllowedForFeatureExtension(target))
16
- throw new A_Feature_error_1.A_FeatureError(A_Feature_error_1.A_FeatureError.FeatureExtensionError, `A-Feature-Extend cannot be applied on the ${componentName} level`);
17
- let targetRegexp;
18
- let behavior = 'sync';
19
- let before = [];
20
- let after = [];
21
- let include = [];
22
- let exclude = [];
23
- let throwOnError = true;
24
- switch (true) {
25
- case A_TypeGuards_helper_1.A_TypeGuards.isRegExp(param1):
26
- targetRegexp = param1;
27
- break;
28
- case !!param1 && typeof param1 === 'object':
29
- if (Array.isArray(param1.scope))
30
- include = param1.scope;
31
- else if (!!param1.scope && typeof param1.scope === 'object') {
32
- if (Array.isArray(param1.scope.include))
33
- include = param1.scope.include;
34
- if (Array.isArray(param1.scope.exclude))
35
- exclude = param1.scope.exclude;
36
- }
37
- targetRegexp = buildTargetRegexp(param1, include, exclude, propertyKey);
38
- behavior = param1.behavior || behavior;
39
- throwOnError = param1.throwOnError !== undefined ? param1.throwOnError : throwOnError;
40
- before = ((_b = param1.before) === null || _b === void 0 ? void 0 : _b.map(e => e instanceof RegExp
41
- ? e.source
42
- : new RegExp(`^.*${e.replace(/\./g, '\\.')}$`).source))
43
- || before;
44
- after = ((_c = param1.after) === null || _c === void 0 ? void 0 : _c.map(e => e instanceof RegExp
45
- ? e.source
46
- : new RegExp(`^.*${e.replace(/\./g, '\\.')}$`).source))
47
- || after;
48
- break;
49
- default:
50
- targetRegexp = new RegExp(`^.*${propertyKey.replace(/\./g, '\\.')}$`);
51
- break;
52
- }
53
- const existedDefinitions = A_Context_class_1.A_Context
54
- .meta(target)
55
- .get(A_Component_constants_1.A_TYPES__ComponentMetaKey.FEATURES);
56
- // Get the existed metadata or create a new one
57
- const meta = A_Context_class_1.A_Context
58
- .meta(target);
59
- const existedMeta = meta.get(A_Component_constants_1.A_TYPES__ComponentMetaKey.EXTENSIONS)
60
- ? new A_Meta_class_1.A_Meta().from(meta.get(A_Component_constants_1.A_TYPES__ComponentMetaKey.EXTENSIONS))
61
- : new A_Meta_class_1.A_Meta();
62
- if (existedDefinitions
63
- && existedDefinitions.size()
64
- && existedDefinitions.has(propertyKey)
65
- && existedDefinitions.get(propertyKey).invoke) {
66
- throw new A_Feature_error_1.A_FeatureError(A_Feature_error_1.A_FeatureError.FeatureExtensionError, `A-Feature-Extend cannot be used on the method "${propertyKey}" because it is already defined as a Feature with "invoke" set to true. Please remove the A-Feature-Extend decorator or set "invoke" to false in the A-Feature decorator.`);
67
- }
68
- const existedMetaValue = [
69
- ...(existedMeta.get(targetRegexp.source) || [])
70
- ];
71
- const existedIndex = existedMetaValue.findIndex(item => item.handler === propertyKey);
72
- const extension = {
73
- name: targetRegexp.source,
74
- handler: propertyKey,
75
- behavior,
76
- before,
77
- after,
78
- throwOnError
79
- };
80
- if (existedIndex !== -1) {
81
- // Update the existing method in the metadata
82
- existedMetaValue[existedIndex] = extension;
83
- }
84
- else {
85
- // Add the new method to the metadata
86
- existedMetaValue.push(extension);
87
- }
88
- // Add the new method to the metadata
89
- existedMetaValue.push();
90
- // Set the metadata of the method to define a custom Feature with name
91
- existedMeta.set(targetRegexp.source, existedMetaValue);
92
- // Update the metadata of the container with the new Feature definition
93
- A_Context_class_1.A_Context
94
- .meta(target)
95
- .set(A_Component_constants_1.A_TYPES__ComponentMetaKey.EXTENSIONS, existedMeta);
96
- };
97
- }
98
- /**
99
- * Builds a target regular expression based on the provided parameters.
100
- *
101
- * @param param1 - The first parameter, which can be a string or an object.
102
- * @param include - An array of items to include in the regular expression.
103
- * @param exclude - An array of items to exclude from the regular expression.
104
- * @param propertyKey - The property key to use in the regular expression.
105
- * @returns A regular expression object.
106
- */
107
- function buildTargetRegexp(param1, include, exclude, propertyKey) {
108
- const includePart = include.length
109
- ? `(${include.map(el => el.name).join('|')})`
110
- : `.*`;
111
- const excludePart = exclude.length
112
- ? `(?!${exclude.map(el => el.name).join('|')})`
113
- : ``;
114
- const pattern = param1.scope
115
- ? `^${excludePart}${includePart}\\.${param1.name || propertyKey}$`
116
- : `.*\\.${param1.name || propertyKey}$`;
117
- return new RegExp(pattern);
118
- }
119
- //# sourceMappingURL=A-Feature-Extend.decorator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"A-Feature-Extend.decorator.js","sourceRoot":"","sources":["../../../../src/global/A-Feature/A-Feature-Extend.decorator.ts"],"names":[],"mappings":";;AAyDA,4CAgIC;AAYD,8CAmBC;AAxND,uFAA8E;AAC9E,8EAAqE;AAErE,sFAA4E;AAC5E,gFAAiF;AACjF,uDAAmD;AAoDnD,SAAgB,gBAAgB,CAC5B,MAAgE;IAEhE,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;QAExF,IAAI,CAAC,kCAAY,CAAC,4BAA4B,CAAC,MAAM,CAAC;YAClD,MAAM,IAAI,gCAAc,CACpB,gCAAc,CAAC,qBAAqB,EACpC,6CAA6C,aAAa,QAAQ,CACrE,CAAC;QAEN,IAAI,YAAoB,CAAC;QACzB,IAAI,QAAQ,GAAqB,MAAM,CAAC;QACxC,IAAI,MAAM,GAAa,EAAE,CAAC;QAC1B,IAAI,KAAK,GAAa,EAAE,CAAC;QACzB,IAAI,OAAO,GAAoD,EAAE,CAAC;QAClE,IAAI,OAAO,GAAoD,EAAE,CAAC;QAClE,IAAI,YAAY,GAAY,IAAI,CAAC;QAIjC,QAAQ,IAAI,EAAE,CAAC;YACX,KAAK,kCAAY,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAC9B,YAAY,GAAG,MAAM,CAAC;gBACtB,MAAM;YAEV,KAAK,CAAC,CAAC,MA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,IAAI,WAAW,GAAG;QAClE,CAAC,CAAC,QAAQ,MAAM,CAAC,IAAI,IAAI,WAAW,GAAG,CAAC;IAE5C,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;AAC/B,CAAC"}
@@ -1,175 +0,0 @@
1
- import { A_TYPES__Feature_Init, A_TYPES__Feature_InitWithComponent, A_TYPES__Feature_InitWithTemplate, A_TYPES__FeatureAvailableComponents, A_TYPES__FeatureState } from "./A-Feature.types";
2
- import { A_Feature_Define } from "./A-Feature-Define.decorator";
3
- import { A_Feature_Extend } from "./A-Feature-Extend.decorator";
4
- import { A_Stage } from "../A-Stage/A-Stage.class";
5
- import { A_StepsManager } from "../A-StepManager/A-StepManager.class";
6
- import { A_StageError } from "../A-Stage/A-Stage.error";
7
- import { A_FeatureError } from "./A-Feature.error";
8
- import { A_Caller } from "../A-Caller/A_Caller.class";
9
- import { A_Scope } from "../A-Scope/A-Scope.class";
10
- /**
11
- * A_Feature is representing a feature that can be executed across multiple components
12
- * This class stores the steps of the feature and executes them in order of appearance
13
- *
14
- * Using A_Feature.Define and A_Feature.Extend decorators to define and extend the feature methods
15
- * across the different, distributed components
16
- *
17
- */
18
- export declare class A_Feature<T extends A_TYPES__FeatureAvailableComponents = A_TYPES__FeatureAvailableComponents> {
19
- /**
20
- * Define a new A-Feature
21
- */
22
- static get Define(): typeof A_Feature_Define;
23
- /**
24
- * Extend an existing A-Feature
25
- */
26
- static get Extend(): typeof A_Feature_Extend;
27
- /**
28
- * The name of the Feature
29
- */
30
- protected _name: string;
31
- /**
32
- * List of stages that are part of this Feature
33
- */
34
- protected _stages: Array<A_Stage>;
35
- /**
36
- * The Stage currently being processed
37
- */
38
- protected _current?: A_Stage;
39
- /**
40
- * Actual Index of the current Stage being processed
41
- */
42
- protected _index: number;
43
- /**
44
- * Steps Manager to organize the steps into stages
45
- */
46
- protected _SM: A_StepsManager;
47
- /**
48
- * The Caller that initiated the Feature call
49
- */
50
- protected _caller: A_Caller<T>;
51
- /**
52
- * The current state of the Feature
53
- */
54
- protected _state: A_TYPES__FeatureState;
55
- /**
56
- * The error that caused the Feature to be interrupted
57
- */
58
- protected _error?: A_FeatureError;
59
- /**
60
- * A-Feature is a pipeline distributed by multiple components that can be easily attached or detached from the scope.
61
- * Feature itself does not have scope, but attached to the caller who dictates how feature should be processed.
62
- *
63
- * Comparing to A-Command Feature does not store any state except statuses for better analysis.
64
- *
65
- * [!] Note: If A-Feature should have result use A-Fragment
66
- *
67
- * @param params
68
- */
69
- constructor(
70
- /**
71
- * Feature Initialization parameters
72
- */
73
- params: A_TYPES__Feature_Init<T>);
74
- /**
75
- * The name of the Feature
76
- */
77
- get name(): string;
78
- /**
79
- * The error that caused the Feature to be interrupted
80
- */
81
- get error(): A_FeatureError | undefined;
82
- /**
83
- * The current state of the Feature
84
- */
85
- get state(): A_TYPES__FeatureState;
86
- /**
87
- * Sets the current state of the Feature
88
- */
89
- get index(): number;
90
- /**
91
- * Returns the current A-Feature Stage
92
- */
93
- get stage(): A_Stage | undefined;
94
- /**
95
- * The Caller that initiated the Feature call
96
- */
97
- get caller(): A_Caller<T>;
98
- /**
99
- * The Scope allocated for the Feature Execution
100
- */
101
- get scope(): A_Scope;
102
- /**
103
- * This method checks if the A-Feature is done
104
- *
105
- * @returns
106
- */
107
- get isDone(): boolean;
108
- /**
109
- * Iterator to iterate over the steps of the feature
110
- *
111
- * @returns
112
- */
113
- [Symbol.iterator](): Iterator<A_Stage, any>;
114
- /**
115
- * Validates the provided parameters for A-Feature initialization
116
- *
117
- * @param params
118
- */
119
- protected validateParams(params: A_TYPES__Feature_Init<T>): void;
120
- /**
121
- * Returns the appropriate initializer method based on the provided parameters
122
- *
123
- * @param params
124
- * @returns
125
- */
126
- protected getInitializer(params: A_TYPES__Feature_Init<T>): (param1: any) => void | (() => void);
127
- /**
128
- * Initializes the A-Feature from the provided template
129
- *
130
- * @param params
131
- */
132
- protected fromTemplate(params: A_TYPES__Feature_InitWithTemplate<T>): void;
133
- /**
134
- * Initializes the A-Feature from the provided component
135
- *
136
- * @param params
137
- */
138
- protected fromComponent(params: A_TYPES__Feature_InitWithComponent<T>): void;
139
- /**
140
- * This method processes the feature by executing all the stages
141
- *
142
- */
143
- process(
144
- /**
145
- * Optional scope to be used to resolve the steps dependencies
146
- * If not provided, the scope of the caller component will be used
147
- */
148
- scope?: A_Scope): Promise<void>;
149
- /**
150
- * This method moves the feature to the next stage
151
- *
152
- * @param stage
153
- */
154
- next(stage: any): void;
155
- /**
156
- * This method marks the feature as completed and returns the result
157
- * Uses to interrupt or end the feature processing
158
- *
159
- * @param result
160
- * @returns
161
- */
162
- completed(): Promise<void>;
163
- /**
164
- * This method marks the feature as failed and throws an error
165
- * Uses to interrupt or end the feature processing
166
- *
167
- * @param error
168
- */
169
- interrupt(
170
- /**
171
- * The reason of feature interruption
172
- */
173
- reason?: string | A_StageError | Error): Promise<void>;
174
- toString(): string;
175
- }
@@ -1,318 +0,0 @@
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.A_Feature = void 0;
13
- const A_Feature_types_1 = require("./A-Feature.types");
14
- const A_Feature_Define_decorator_1 = require("./A-Feature-Define.decorator");
15
- const A_Feature_Extend_decorator_1 = require("./A-Feature-Extend.decorator");
16
- const A_StepManager_class_1 = require("../A-StepManager/A-StepManager.class");
17
- const A_TypeGuards_helper_1 = require("../../helpers/A_TypeGuards.helper");
18
- const A_Feature_error_1 = require("./A-Feature.error");
19
- const A_Context_class_1 = require("../A-Context/A-Context.class");
20
- const A_Caller_class_1 = require("../A-Caller/A_Caller.class");
21
- const A_Scope_class_1 = require("../A-Scope/A-Scope.class");
22
- const A_Component_class_1 = require("../A-Component/A-Component.class");
23
- /**
24
- * A_Feature is representing a feature that can be executed across multiple components
25
- * This class stores the steps of the feature and executes them in order of appearance
26
- *
27
- * Using A_Feature.Define and A_Feature.Extend decorators to define and extend the feature methods
28
- * across the different, distributed components
29
- *
30
- */
31
- class A_Feature {
32
- // =============================================================================
33
- // --------------------------- Static Methods ---------------------------------
34
- // =============================================================================
35
- /**
36
- * Define a new A-Feature
37
- */
38
- static get Define() {
39
- return A_Feature_Define_decorator_1.A_Feature_Define;
40
- }
41
- /**
42
- * Extend an existing A-Feature
43
- */
44
- static get Extend() {
45
- return A_Feature_Extend_decorator_1.A_Feature_Extend;
46
- }
47
- /**
48
- * A-Feature is a pipeline distributed by multiple components that can be easily attached or detached from the scope.
49
- * Feature itself does not have scope, but attached to the caller who dictates how feature should be processed.
50
- *
51
- * Comparing to A-Command Feature does not store any state except statuses for better analysis.
52
- *
53
- * [!] Note: If A-Feature should have result use A-Fragment
54
- *
55
- * @param params
56
- */
57
- constructor(
58
- /**
59
- * Feature Initialization parameters
60
- */
61
- params) {
62
- /**
63
- * List of stages that are part of this Feature
64
- */
65
- this._stages = [];
66
- /**
67
- * Actual Index of the current Stage being processed
68
- */
69
- this._index = 0;
70
- /**
71
- * The current state of the Feature
72
- */
73
- this._state = A_Feature_types_1.A_TYPES__FeatureState.INITIALIZED;
74
- this.validateParams(params);
75
- const initializer = this.getInitializer(params);
76
- // the returned initializer is already bound to `this` (we used .bind(this)),
77
- // so calling it will run the appropriate logic on this instance:
78
- initializer.call(this, params);
79
- }
80
- /**
81
- * The name of the Feature
82
- */
83
- get name() { return this._name; }
84
- /**
85
- * The error that caused the Feature to be interrupted
86
- */
87
- get error() { return this._error; }
88
- /**
89
- * The current state of the Feature
90
- */
91
- get state() { return this._state; }
92
- /**
93
- * Sets the current state of the Feature
94
- */
95
- get index() { return this._index; }
96
- /**
97
- * Returns the current A-Feature Stage
98
- */
99
- get stage() { return this._current; }
100
- /**
101
- * The Caller that initiated the Feature call
102
- */
103
- get caller() { return this._caller; }
104
- /**
105
- * The Scope allocated for the Feature Execution
106
- */
107
- get scope() { return A_Context_class_1.A_Context.scope(this); }
108
- /**
109
- * This method checks if the A-Feature is done
110
- *
111
- * @returns
112
- */
113
- get isDone() {
114
- return !this.stage
115
- || this._index >= this._stages.length
116
- || this.state === A_Feature_types_1.A_TYPES__FeatureState.COMPLETED
117
- || this.state === A_Feature_types_1.A_TYPES__FeatureState.INTERRUPTED;
118
- }
119
- /**
120
- * Iterator to iterate over the steps of the feature
121
- *
122
- * @returns
123
- */
124
- [Symbol.iterator]() {
125
- return {
126
- next: () => {
127
- if (!this.isDone) {
128
- this._current = this._stages[this._index];
129
- this._index++;
130
- return {
131
- value: this._current,
132
- done: false
133
- };
134
- }
135
- else {
136
- this._current = undefined; // Reset current on end
137
- return {
138
- value: undefined,
139
- done: true
140
- };
141
- }
142
- }
143
- };
144
- }
145
- // ============================================================================
146
- // ------------------------ Initialization Methods ----------------------------
147
- // ============================================================================
148
- /**
149
- * Validates the provided parameters for A-Feature initialization
150
- *
151
- * @param params
152
- */
153
- validateParams(params) {
154
- if (!params || typeof params !== 'object') {
155
- throw new A_Feature_error_1.A_FeatureError(A_Feature_error_1.A_FeatureError.FeatureInitializationError, `Invalid A-Feature initialization parameters of type: ${typeof params} with value: ${JSON.stringify(params).slice(0, 100)}...`);
156
- }
157
- }
158
- /**
159
- * Returns the appropriate initializer method based on the provided parameters
160
- *
161
- * @param params
162
- * @returns
163
- */
164
- getInitializer(params) {
165
- switch (true) {
166
- case !('template' in params):
167
- return this.fromComponent;
168
- case 'template' in params:
169
- return this.fromTemplate;
170
- default:
171
- throw new A_Feature_error_1.A_FeatureError(A_Feature_error_1.A_FeatureError.FeatureInitializationError, `Invalid A-Feature initialization parameters of type: ${typeof params} with value: ${JSON.stringify(params).slice(0, 100)}...`);
172
- }
173
- }
174
- /**
175
- * Initializes the A-Feature from the provided template
176
- *
177
- * @param params
178
- */
179
- fromTemplate(params) {
180
- if (!params.template || !Array.isArray(params.template)) {
181
- throw new A_Feature_error_1.A_FeatureError(A_Feature_error_1.A_FeatureError.FeatureInitializationError, `Invalid A-Feature template provided of type: ${typeof params.template} with value: ${JSON.stringify(params.template).slice(0, 100)}...`);
182
- }
183
- if (!params.component && (!params.scope || !(params.scope instanceof A_Scope_class_1.A_Scope))) {
184
- throw new A_Feature_error_1.A_FeatureError(A_Feature_error_1.A_FeatureError.FeatureInitializationError, `Invalid A-Feature scope provided of type: ${typeof params.scope} with value: ${JSON.stringify(params.scope).slice(0, 100)}...`);
185
- }
186
- // 1) save feature name
187
- this._name = params.name;
188
- // 2) get scope from where feature is called
189
- const componentScope = params.component
190
- ? A_Context_class_1.A_Context.scope(params.component)
191
- : params.scope;
192
- // 3) create caller wrapper for the simple injection of the caller component
193
- // - Just to prevent issues with undefined caller in features without component
194
- // - TODO: maybe would be better to allow passing caller in params?
195
- this._caller = new A_Caller_class_1.A_Caller(params.component || new A_Component_class_1.A_Component());
196
- // 4) allocate new scope for the feature
197
- const scope = A_Context_class_1.A_Context.allocate(this);
198
- // 5) ensure that the scope of the caller component is inherited by the feature scope
199
- scope.inherit(componentScope);
200
- // 6) create steps manager to organize steps into stages
201
- this._SM = new A_StepManager_class_1.A_StepsManager(params.template);
202
- // 7) create stages from the steps
203
- this._stages = this._SM.toStages(this);
204
- // 8) set the first stage as current
205
- this._current = this._stages[0];
206
- }
207
- /**
208
- * Initializes the A-Feature from the provided component
209
- *
210
- * @param params
211
- */
212
- fromComponent(params) {
213
- if (!params.component || !A_TypeGuards_helper_1.A_TypeGuards.isAllowedForFeatureDefinition(params.component)) {
214
- throw new A_Feature_error_1.A_FeatureError(A_Feature_error_1.A_FeatureError.FeatureInitializationError, `Invalid A-Feature component provided of type: ${typeof params.component} with value: ${JSON.stringify(params.component).slice(0, 100)}...`);
215
- }
216
- // 1) save feature name
217
- this._name = params.name;
218
- // 2) get scope from where feature is called
219
- const componentScope = A_Context_class_1.A_Context.scope(params.component);
220
- // 3) create caller wrapper for the simple injection of the caller component
221
- this._caller = new A_Caller_class_1.A_Caller(params.component);
222
- // 4) allocate new scope for the feature
223
- const scope = A_Context_class_1.A_Context.allocate(this);
224
- // 5) ensure that the scope of the caller component is inherited by the feature scope
225
- scope.inherit(componentScope);
226
- // 6) retrieve the template from the context
227
- const template = A_Context_class_1.A_Context.featureTemplate(this._name, this._caller.component, scope);
228
- // 7) create steps manager to organize steps into stages
229
- this._SM = new A_StepManager_class_1.A_StepsManager(template);
230
- // 8) create stages from the steps
231
- this._stages = this._SM.toStages(this);
232
- // 9) set the first stage as current
233
- this._current = this._stages[0];
234
- }
235
- // ============================================================================
236
- // ----------------------- Main Processing Methods ----------------------------
237
- // ============================================================================
238
- /**
239
- * This method processes the feature by executing all the stages
240
- *
241
- */
242
- process(
243
- /**
244
- * Optional scope to be used to resolve the steps dependencies
245
- * If not provided, the scope of the caller component will be used
246
- */
247
- scope) {
248
- return __awaiter(this, void 0, void 0, function* () {
249
- if (this.isDone)
250
- return;
251
- this._state = A_Feature_types_1.A_TYPES__FeatureState.PROCESSING;
252
- for (const stage of this) {
253
- yield stage.process(scope);
254
- }
255
- return yield this.completed();
256
- });
257
- }
258
- /**
259
- * This method moves the feature to the next stage
260
- *
261
- * @param stage
262
- */
263
- next(stage) {
264
- const stageIndex = this._stages.indexOf(stage);
265
- this._index = stageIndex + 1;
266
- if (this._index >= this._stages.length) {
267
- this.completed();
268
- }
269
- }
270
- /**
271
- * This method marks the feature as completed and returns the result
272
- * Uses to interrupt or end the feature processing
273
- *
274
- * @param result
275
- * @returns
276
- */
277
- completed() {
278
- return __awaiter(this, void 0, void 0, function* () {
279
- this._state = A_Feature_types_1.A_TYPES__FeatureState.COMPLETED;
280
- });
281
- }
282
- /**
283
- * This method marks the feature as failed and throws an error
284
- * Uses to interrupt or end the feature processing
285
- *
286
- * @param error
287
- */
288
- interrupt(
289
- /**
290
- * The reason of feature interruption
291
- */
292
- reason) {
293
- return __awaiter(this, void 0, void 0, function* () {
294
- switch (true) {
295
- case A_TypeGuards_helper_1.A_TypeGuards.isString(reason):
296
- this._error = new A_Feature_error_1.A_FeatureError(A_Feature_error_1.A_FeatureError.Interruption, reason);
297
- break;
298
- case A_TypeGuards_helper_1.A_TypeGuards.isErrorInstance(reason):
299
- this._error = new A_Feature_error_1.A_FeatureError({
300
- code: A_Feature_error_1.A_FeatureError.Interruption,
301
- title: reason.title,
302
- description: reason.description,
303
- originalError: reason
304
- });
305
- break;
306
- default:
307
- break;
308
- }
309
- this._state = A_Feature_types_1.A_TYPES__FeatureState.INTERRUPTED;
310
- });
311
- }
312
- toString() {
313
- var _a, _b;
314
- return `A-Feature(${((_b = (_a = this.caller.component) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) || 'Unknown'}::${this.name})`;
315
- }
316
- }
317
- exports.A_Feature = A_Feature;
318
- //# sourceMappingURL=A-Feature.class.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"A-Feature.class.js","sourceRoot":"","sources":["../../../../src/global/A-Feature/A-Feature.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uDAM2B;AAC3B,6GAAgG;AAChG,6GAAgG;AAEhG,mGAA2F;AAE3F,sFAA4E;AAC5E,uDAAmD;AACnD,kEAAyD;AACzD,+DAAsD;AACtD,4DAAmD;AACnD,wEAA+D;AAG/D;;;;;;;GAOG;AACH,MAAa,SAAS;IAElB,gFAAgF;IAChF,+EAA+E;IAC/E,gFAAgF;IAChF;;OAEG;IACH,MAAM,KAAK,MAAM;QACb,OAAO,6CAAgB,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,MAAM,KAAK,MAAM;QACb,OAAO,6CAAgB,CAAC;IAC5B,CAAC;IAuCD;;;;;;;;;OASG;IACH;IACI;;OA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AAS;IACX;;OAEG;IACH,MAAsC;;YAEtC,QAAQ,IAAI,EAAE,CAAC;gBACX,KAAK,kCAAY,CAAC,QAAQ,CAAC,MAAM,CAAC;oBAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,gCAAc,CAAC,gCAAc,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;oBACtE,MAAM;gBAEV,KAAK,kCAAY,CAAC,eAAe,CAAC,MAAM,CAAC;oBACrC,IAAI,CAAC,MAAM,GAAG,IAAI,gCAAc,CAAC;wBAC7B,IAAI,EAAE,gCAAc,CAAC,YAAY;wBACjC,KAAK,EAAE,MAAM,CAAC,KAAK;wBACnB,WAAW,EAAE,MAAM,CAAC,WAAW;wBAC/B,aAAa,EAAE,MAAM;qBACxB,CAAC,CAAC;oBACH,MAAM;gBAEV;oBACI,MAAM;YACd,CAAC;YAED,IAAI,CAAC,MAAM,GAAG,uCAAqB,CAAC,WAAW,CAAC;QACpD,CAAC;KAAA;IAKD,QAAQ;;QACJ,OAAO,aAAa,CAAA,MAAA,MAAA,IAAI,CAAC,MAAM,CAAC,SAAS,0CAAE,WAAW,0CAAE,IAAI,KAAI,SAAS,KAAK,IAAI,CAAC,IAAI,GAAG,CAAC;IAC/F,CAAC;CACJ;AApXD,8BAoXC"}
@@ -1,25 +0,0 @@
1
- import { A_Error } from "../A-Error/A_Error.class";
2
- export declare class A_FeatureError extends A_Error {
3
- /**
4
- * Indicates that the Feature has been interrupted
5
- */
6
- static readonly Interruption = "Feature Interrupted";
7
- /**
8
- * Indicates that there was an error initializing the Feature
9
- *
10
- * Failed during the A-Feature initialization process
11
- */
12
- static readonly FeatureInitializationError = "Unable to initialize A-Feature";
13
- /**
14
- * Indicates that there was an error defining the Feature
15
- *
16
- * Failed during the @A_Feature.Define() decorator execution
17
- */
18
- static readonly FeatureDefinitionError = "Unable to define A-Feature";
19
- /**
20
- * Indicates that there was an error extending the Feature
21
- *
22
- * Failed during the @A_Feature.Extend() decorator execution
23
- */
24
- static readonly FeatureExtensionError = "Unable to extend A-Feature";
25
- }