@adaas/a-concept 0.0.29 → 0.0.31

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 (185) hide show
  1. package/dist/examples/fe-be/channels/Test.channel.d.ts +6 -0
  2. package/dist/examples/fe-be/channels/Test.channel.js +14 -0
  3. package/dist/examples/fe-be/channels/Test.channel.js.map +1 -0
  4. package/dist/examples/fe-be/components/BE-Controller.component.d.ts +4 -0
  5. package/dist/examples/fe-be/components/BE-Controller.component.js +24 -0
  6. package/dist/examples/fe-be/components/BE-Controller.component.js.map +1 -0
  7. package/dist/examples/fe-be/components/FE.component.d.ts +4 -0
  8. package/dist/examples/fe-be/components/FE.component.js +31 -0
  9. package/dist/examples/fe-be/components/FE.component.js.map +1 -0
  10. package/dist/examples/fe-be/components/UserActions.component.d.ts +5 -0
  11. package/dist/examples/fe-be/components/UserActions.component.js +25 -0
  12. package/dist/examples/fe-be/components/UserActions.component.js.map +1 -0
  13. package/dist/examples/fe-be/concept.d.ts +0 -0
  14. package/dist/examples/fe-be/concept.js +2 -0
  15. package/dist/examples/fe-be/concept.js.map +1 -0
  16. package/dist/examples/fe-be/containers/ServerApp.container.d.ts +3 -0
  17. package/dist/examples/fe-be/containers/ServerApp.container.js +8 -0
  18. package/dist/examples/fe-be/containers/ServerApp.container.js.map +1 -0
  19. package/dist/examples/fe-be/containers/WebApp.container.d.ts +3 -0
  20. package/dist/examples/fe-be/containers/WebApp.container.js +8 -0
  21. package/dist/examples/fe-be/containers/WebApp.container.js.map +1 -0
  22. package/dist/examples/multi-container/channels/Direct.channel.d.ts +9 -0
  23. package/dist/examples/multi-container/channels/Direct.channel.js +32 -0
  24. package/dist/examples/multi-container/channels/Direct.channel.js.map +1 -0
  25. package/dist/examples/multi-container/concept.d.ts +0 -0
  26. package/dist/examples/multi-container/concept.js +2 -0
  27. package/dist/examples/multi-container/concept.js.map +1 -0
  28. package/dist/examples/multi-container/containers/Command.container.d.ts +11 -0
  29. package/dist/examples/multi-container/containers/Command.container.js +51 -0
  30. package/dist/examples/multi-container/containers/Command.container.js.map +1 -0
  31. package/dist/examples/multi-container/containers/Schedule.container.d.ts +15 -0
  32. package/dist/examples/multi-container/containers/Schedule.container.js +67 -0
  33. package/dist/examples/multi-container/containers/Schedule.container.js.map +1 -0
  34. package/dist/examples/simple/components/A.component.js.map +1 -1
  35. package/dist/examples/simple/containers/Main.container.js +7 -3
  36. package/dist/examples/simple/containers/Main.container.js.map +1 -1
  37. package/dist/examples/simple/entities/EntityA.entity.d.ts +8 -0
  38. package/dist/examples/simple/entities/EntityA.entity.js +22 -0
  39. package/dist/examples/simple/entities/EntityA.entity.js.map +1 -0
  40. package/dist/examples/simple-http-server/contexts/http-request.context.d.ts +0 -1
  41. package/dist/examples/simple-http-server/contexts/http-request.context.js +6 -8
  42. package/dist/examples/simple-http-server/contexts/http-request.context.js.map +1 -1
  43. package/dist/index.d.ts +8 -2
  44. package/dist/index.js +16 -7
  45. package/dist/index.js.map +1 -1
  46. package/dist/src/base/A-Errors/A-Error.entity.d.ts +3 -0
  47. package/dist/src/base/A-Errors/A-Error.entity.js +8 -0
  48. package/dist/src/base/A-Errors/A-Error.entity.js.map +1 -0
  49. package/dist/src/base/A-Errors/A-Errors.context.js +1 -1
  50. package/dist/src/base/A-Errors/A-Errors.context.js.map +1 -1
  51. package/dist/src/decorators/A-Abstraction/A-Abstraction.decorator.d.ts +14 -0
  52. package/dist/src/decorators/A-Abstraction/A-Abstraction.decorator.js +53 -0
  53. package/dist/src/decorators/A-Abstraction/A-Abstraction.decorator.js.map +1 -0
  54. package/dist/src/decorators/A-Abstraction/A-Abstraction.decorator.types.d.ts +2 -0
  55. package/dist/src/decorators/A-Abstraction/A-Abstraction.decorator.types.js +3 -0
  56. package/dist/src/decorators/A-Abstraction/A-Abstraction.decorator.types.js.map +1 -0
  57. package/dist/src/decorators/A-Connect/A-Connect.decorator.d.ts +19 -0
  58. package/dist/src/decorators/A-Connect/A-Connect.decorator.js +31 -0
  59. package/dist/src/decorators/A-Connect/A-Connect.decorator.js.map +1 -0
  60. package/dist/src/decorators/A-Connect/A-Connect.decorator.types.d.ts +1 -0
  61. package/dist/src/decorators/A-Connect/A-Connect.decorator.types.js +3 -0
  62. package/dist/src/decorators/A-Connect/A-Connect.decorator.types.js.map +1 -0
  63. package/dist/src/decorators/A-Entity/A-Entity-List.decorator.d.ts +1 -0
  64. package/dist/src/decorators/A-Entity/A-Entity-List.decorator.js +8 -0
  65. package/dist/src/decorators/A-Entity/A-Entity-List.decorator.js.map +1 -0
  66. package/dist/src/decorators/A-Entity/A-Entity.decorator.types.d.ts +14 -0
  67. package/dist/src/decorators/A-Entity/A-Entity.decorator.types.js +3 -0
  68. package/dist/src/decorators/A-Entity/A-Entity.decorator.types.js.map +1 -0
  69. package/dist/src/decorators/A-Feature/A-Feature-Define.decorator.js +7 -5
  70. package/dist/src/decorators/A-Feature/A-Feature-Define.decorator.js.map +1 -1
  71. package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.js +9 -0
  72. package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.js.map +1 -1
  73. package/dist/src/decorators/A-Feature/A-Feature.decorator.types.d.ts +36 -0
  74. package/dist/src/decorators/A-Inject/A-Inject.decorator.d.ts +2 -3
  75. package/dist/src/decorators/A-Inject/A-Inject.decorator.js.map +1 -1
  76. package/dist/src/decorators/A-Inject/A-Inject.decorator.types.d.ts +44 -0
  77. package/dist/src/global/A-Channel/A-Channel.class.d.ts +8 -10
  78. package/dist/src/global/A-Channel/A-Channel.class.js +12 -26
  79. package/dist/src/global/A-Channel/A-Channel.class.js.map +1 -1
  80. package/dist/src/global/A-Channel/A-Channel.types.d.ts +32 -0
  81. package/dist/src/global/A-Component/A-Component.class.d.ts +2 -1
  82. package/dist/src/global/A-Component/A-Component.class.js +1 -0
  83. package/dist/src/global/A-Component/A-Component.class.js.map +1 -1
  84. package/dist/src/global/A-Component/A-Component.meta.d.ts +16 -0
  85. package/dist/src/global/A-Component/A-Component.meta.js +37 -3
  86. package/dist/src/global/A-Component/A-Component.meta.js.map +1 -1
  87. package/dist/src/global/A-Component/A-Component.types.d.ts +26 -38
  88. package/dist/src/global/A-Component/A-Component.types.js +1 -7
  89. package/dist/src/global/A-Component/A-Component.types.js.map +1 -1
  90. package/dist/src/global/A-Concept/A_Concept.class.d.ts +7 -7
  91. package/dist/src/global/A-Concept/A_Concept.class.js +30 -30
  92. package/dist/src/global/A-Concept/A_Concept.class.js.map +1 -1
  93. package/dist/src/global/A-Concept/A_Concept.types.d.ts +42 -2
  94. package/dist/src/global/A-Concept/A_Concept.types.js.map +1 -1
  95. package/dist/src/global/A-Container/A-Container.class.d.ts +1 -8
  96. package/dist/src/global/A-Container/A-Container.class.js +1 -31
  97. package/dist/src/global/A-Container/A-Container.class.js.map +1 -1
  98. package/dist/src/global/A-Container/A-Container.meta.d.ts +8 -0
  99. package/dist/src/global/A-Container/A-Container.meta.js +29 -0
  100. package/dist/src/global/A-Container/A-Container.meta.js.map +1 -1
  101. package/dist/src/global/A-Container/A-Container.types.d.ts +32 -8
  102. package/dist/src/global/A-Container/A-Container.types.js +2 -1
  103. package/dist/src/global/A-Container/A-Container.types.js.map +1 -1
  104. package/dist/src/global/A-Context/A-Context.class.js +29 -36
  105. package/dist/src/global/A-Context/A-Context.class.js.map +1 -1
  106. package/dist/src/global/A-Entity/A-Entity.class.d.ts +1 -2
  107. package/dist/src/global/A-Entity/A-Entity.class.js +6 -7
  108. package/dist/src/global/A-Entity/A-Entity.class.js.map +1 -1
  109. package/dist/src/global/A-Entity/A-Entity.types.d.ts +12 -6
  110. package/dist/src/global/A-Entity/A-Entity.types.js.map +1 -1
  111. package/dist/src/global/A-Feature/A-Feature.class.d.ts +30 -6
  112. package/dist/src/global/A-Feature/A-Feature.class.js +49 -40
  113. package/dist/src/global/A-Feature/A-Feature.class.js.map +1 -1
  114. package/dist/src/global/A-Feature/A-Feature.types.d.ts +2 -24
  115. package/dist/src/global/A-Feature/A-Feature.types.js +21 -0
  116. package/dist/src/global/A-Feature/A-Feature.types.js.map +1 -1
  117. package/dist/src/global/A-Fragment/A-Fragment.class.d.ts +8 -0
  118. package/dist/src/global/A-Fragment/A-Fragment.class.js +10 -0
  119. package/dist/src/global/A-Fragment/A-Fragment.class.js.map +1 -1
  120. package/dist/src/global/A-Scope/A-Scope.class.d.ts +7 -5
  121. package/dist/src/global/A-Scope/A-Scope.class.js +33 -10
  122. package/dist/src/global/A-Scope/A-Scope.class.js.map +1 -1
  123. package/dist/src/global/A-Scope/A-Scope.types.d.ts +2 -1
  124. package/dist/src/global/A-Stage/A-Stage.class.d.ts +69 -0
  125. package/dist/src/global/A-Stage/A-Stage.class.js +181 -0
  126. package/dist/src/global/A-Stage/A-Stage.class.js.map +1 -0
  127. package/dist/src/global/A-Stage/A-Stage.types.d.ts +78 -0
  128. package/dist/src/global/A-Stage/A-Stage.types.js +59 -0
  129. package/dist/src/global/A-Stage/A-Stage.types.js.map +1 -0
  130. package/dist/src/helpers/StepsManager.class.d.ts +15 -0
  131. package/dist/src/helpers/StepsManager.class.js +85 -0
  132. package/dist/src/helpers/StepsManager.class.js.map +1 -0
  133. package/examples/fe-be/channels/Test.channel.ts +24 -0
  134. package/examples/fe-be/components/BE-Controller.component.ts +20 -0
  135. package/examples/fe-be/components/FE.component.ts +13 -0
  136. package/examples/fe-be/concept.ts +0 -0
  137. package/examples/fe-be/containers/ServerApp.container.ts +8 -0
  138. package/examples/fe-be/containers/WebApp.container.ts +13 -0
  139. package/examples/multi-container/channels/Direct.channel.ts +39 -0
  140. package/examples/multi-container/concept.ts +0 -0
  141. package/examples/multi-container/containers/Command.container.ts +41 -0
  142. package/examples/multi-container/containers/Schedule.container.ts +57 -0
  143. package/examples/simple/components/A.component.ts +2 -1
  144. package/examples/simple/containers/Main.container.ts +11 -3
  145. package/examples/simple/entities/EntityA.entity.ts +16 -0
  146. package/examples/simple-http-server/contexts/http-request.context.ts +6 -6
  147. package/index.ts +12 -3
  148. package/package.json +1 -1
  149. package/src/base/A-Errors/A-Error.entity.ts +10 -0
  150. package/src/base/A-Errors/A-Errors.context.ts +2 -2
  151. package/src/decorators/A-Abstraction/A-Abstraction.decorator.ts +82 -0
  152. package/src/decorators/{A-Stage/A-Stage.decorator.types.ts → A-Abstraction/A-Abstraction.decorator.types.ts} +1 -3
  153. package/src/decorators/A-Connect/A-Connect.decorator.ts +71 -0
  154. package/src/decorators/A-Connect/A-Connect.decorator.types.ts +6 -0
  155. package/src/decorators/A-Entity/A-Entity-List.decorator.ts +12 -0
  156. package/src/decorators/A-Entity/A-Entity.decorator.types.ts +18 -0
  157. package/src/decorators/A-Feature/A-Feature-Define.decorator.ts +16 -9
  158. package/src/decorators/A-Feature/A-Feature-Extend.decorator.ts +10 -2
  159. package/src/decorators/A-Feature/A-Feature.decorator.types.ts +46 -0
  160. package/src/decorators/A-Inject/A-Inject.decorator.ts +7 -7
  161. package/src/decorators/A-Inject/A-Inject.decorator.types.ts +47 -1
  162. package/src/global/A-Channel/A-Channel.class.ts +25 -28
  163. package/src/global/A-Channel/A-Channel.types.ts +53 -0
  164. package/src/global/A-Component/A-Component.class.ts +10 -2
  165. package/src/global/A-Component/A-Component.meta.ts +59 -6
  166. package/src/global/A-Component/A-Component.types.ts +28 -45
  167. package/src/global/A-Concept/A_Concept.class.ts +52 -31
  168. package/src/global/A-Concept/A_Concept.types.ts +48 -3
  169. package/src/global/A-Container/A-Container.class.ts +3 -39
  170. package/src/global/A-Container/A-Container.meta.ts +41 -4
  171. package/src/global/A-Container/A-Container.types.ts +36 -8
  172. package/src/global/A-Context/A-Context.class.ts +37 -50
  173. package/src/global/A-Entity/A-Entity.class.ts +8 -6
  174. package/src/global/A-Entity/A-Entity.types.ts +13 -6
  175. package/src/global/A-Feature/A-Feature.class.ts +73 -61
  176. package/src/global/A-Feature/A-Feature.types.ts +24 -23
  177. package/src/global/A-Fragment/A-Fragment.class.ts +15 -0
  178. package/src/global/A-Scope/A-Scope.class.ts +58 -25
  179. package/src/global/A-Scope/A-Scope.types.ts +2 -1
  180. package/src/global/A-Stage/A-Stage.class.ts +234 -0
  181. package/src/global/A-Stage/A-Stage.types.ts +101 -0
  182. package/src/helpers/StepsManager.class.ts +104 -0
  183. package/tests/channel.ts +213 -0
  184. package/tests/log.ts +88 -40
  185. package/src/decorators/A-Stage/A-Stage.decorator.ts +0 -84
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.A_TYPES__A_Stage_Status = void 0;
4
+ var A_TYPES__A_Stage_Status;
5
+ (function (A_TYPES__A_Stage_Status) {
6
+ /**
7
+ * The stage is currently being processed
8
+ */
9
+ A_TYPES__A_Stage_Status["PROCESSING"] = "PROCESSING";
10
+ /**
11
+ * The stage has been completed
12
+ */
13
+ A_TYPES__A_Stage_Status["COMPLETED"] = "COMPLETED";
14
+ /**
15
+ * The stage has failed
16
+ */
17
+ A_TYPES__A_Stage_Status["FAILED"] = "FAILED";
18
+ /**
19
+ * The stage has been skipped
20
+ */
21
+ A_TYPES__A_Stage_Status["SKIPPED"] = "SKIPPED";
22
+ /**
23
+ * The stage has been paused
24
+ */
25
+ // PAUSED = 'PAUSED',
26
+ /**
27
+ * The stage has been stopped
28
+ */
29
+ // STOPPED = 'STOPPED',
30
+ /**
31
+ * The stage has been started
32
+ */
33
+ // STARTED = 'STARTED',
34
+ /**
35
+ * The stage has been initialized
36
+ */
37
+ A_TYPES__A_Stage_Status["INITIALIZED"] = "INITIALIZED";
38
+ /**
39
+ * The stage has been reset
40
+ */
41
+ // RESET = 'RESET',
42
+ /**
43
+ * The stage has been resumed
44
+ */
45
+ // RESUMED = 'RESUMED',
46
+ /**
47
+ * The stage has been suspended
48
+ */
49
+ // SUSPENDED = 'SUSPENDED',
50
+ /**
51
+ * The stage has been terminated
52
+ */
53
+ // TERMINATED = 'TERMINATED',
54
+ /**
55
+ * The stage has been aborted
56
+ */
57
+ A_TYPES__A_Stage_Status["ABORTED"] = "ABORTED";
58
+ })(A_TYPES__A_Stage_Status || (exports.A_TYPES__A_Stage_Status = A_TYPES__A_Stage_Status = {}));
59
+ //# sourceMappingURL=A-Stage.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"A-Stage.types.js","sourceRoot":"","sources":["../../../../src/global/A-Stage/A-Stage.types.ts"],"names":[],"mappings":";;;AAOA,IAAY,uBAqDX;AArDD,WAAY,uBAAuB;IAC/B;;OAEG;IACH,oDAAyB,CAAA;IACzB;;OAEG;IACH,kDAAuB,CAAA;IACvB;;OAEG;IACH,4CAAiB,CAAA;IACjB;;OAEG;IACH,8CAAmB,CAAA;IACnB;;OAEG;IACH,qBAAqB;IACrB;;OAEG;IACH,uBAAuB;IACvB;;OAEG;IACH,uBAAuB;IACvB;;OAEG;IACH,sDAA2B,CAAA;IAC3B;;OAEG;IACH,mBAAmB;IACnB;;OAEG;IACH,uBAAuB;IACvB;;OAEG;IACH,2BAA2B;IAC3B;;OAEG;IACH,6BAA6B;IAC7B;;OAEG;IACH,8CAAmB,CAAA;AACvB,CAAC,EArDW,uBAAuB,uCAAvB,uBAAuB,QAqDlC"}
@@ -0,0 +1,15 @@
1
+ import { A_Feature } from "../global/A-Feature/A-Feature.class";
2
+ import { A_Stage } from "../global/A-Stage/A-Stage.class";
3
+ import { A_TYPES__A_StageStep } from "../global/A-Stage/A-Stage.types";
4
+ export declare class StepsManager {
5
+ entities: A_TYPES__A_StageStep[];
6
+ graph: Map<string, Set<string>>;
7
+ visited: Set<string>;
8
+ tempMark: Set<string>;
9
+ sortedEntities: string[];
10
+ constructor(entities: A_TYPES__A_StageStep[]);
11
+ private buildGraph;
12
+ private matchEntities;
13
+ private visit;
14
+ toStages(feature: A_Feature): Array<A_Stage>;
15
+ }
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StepsManager = void 0;
4
+ const A_Stage_class_1 = require("../global/A-Stage/A-Stage.class");
5
+ class StepsManager {
6
+ constructor(entities) {
7
+ this.entities = entities;
8
+ this.graph = new Map();
9
+ this.visited = new Set();
10
+ this.tempMark = new Set();
11
+ this.sortedEntities = [];
12
+ }
13
+ buildGraph() {
14
+ // Initialize graph nodes
15
+ this.entities.forEach(entity => this.graph.set(entity.name, new Set()));
16
+ // Add directed edges based on 'before' and 'after'
17
+ this.entities.forEach(entity => {
18
+ const { name, before = [], after = [] } = entity;
19
+ // Add edges for 'before' dependencies
20
+ before.forEach(dep => {
21
+ const targets = this.matchEntities(dep);
22
+ targets.forEach(target => {
23
+ if (!this.graph.has(target))
24
+ this.graph.set(target, new Set());
25
+ this.graph.get(target).add(name); // target -> name (target should be before name)
26
+ });
27
+ });
28
+ // Add edges for 'after' dependencies
29
+ after.forEach(dep => {
30
+ const sources = this.matchEntities(dep);
31
+ sources.forEach(source => {
32
+ if (!this.graph.has(name))
33
+ this.graph.set(name, new Set());
34
+ this.graph.get(name).add(source); // name -> source (name should be before source)
35
+ });
36
+ });
37
+ });
38
+ }
39
+ // Match entities by name or regex
40
+ matchEntities(pattern) {
41
+ const regex = new RegExp(`^${pattern}$`);
42
+ return this.entities
43
+ .filter(entity => regex.test(entity.name))
44
+ .map(entity => entity.name);
45
+ }
46
+ // Topological sort with cycle detection
47
+ visit(node) {
48
+ if (this.tempMark.has(node))
49
+ throw new Error("Circular dependency detected");
50
+ if (!this.visited.has(node)) {
51
+ this.tempMark.add(node);
52
+ (this.graph.get(node) || []).forEach(neighbor => this.visit(neighbor));
53
+ this.tempMark.delete(node);
54
+ this.visited.add(node);
55
+ this.sortedEntities.push(node);
56
+ }
57
+ }
58
+ // Sort the entities based on dependencies
59
+ toStages(feature) {
60
+ this.buildGraph();
61
+ // Start topological sort
62
+ this.entities.forEach(entity => {
63
+ if (!this.visited.has(entity.name))
64
+ this.visit(entity.name);
65
+ });
66
+ const stages = [];
67
+ // Map sorted names back to entity objects
68
+ this.sortedEntities
69
+ .map(name => {
70
+ const step = this.entities.find(entity => entity.name === name);
71
+ let stage = stages.find(stage => {
72
+ return stage.after.every(after => step.after.includes(after))
73
+ && step.before.every(before => stage.after.includes(before));
74
+ });
75
+ if (!stage) {
76
+ stage = new A_Stage_class_1.A_Stage(feature);
77
+ stages.push(stage);
78
+ }
79
+ stage.add(step);
80
+ });
81
+ return stages;
82
+ }
83
+ }
84
+ exports.StepsManager = StepsManager;
85
+ //# sourceMappingURL=StepsManager.class.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StepsManager.class.js","sourceRoot":"","sources":["../../../src/helpers/StepsManager.class.ts"],"names":[],"mappings":";;;AACA,mEAA0D;AAG1D,MAAa,YAAY;IASrB,YAAY,QAAgC;QACxC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;IAC7B,CAAC;IAEO,UAAU;QACd,yBAAyB;QACzB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC;QAExE,mDAAmD;QACnD,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YAC3B,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,EAAE,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC;YAEjD,sCAAsC;YACtC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;gBACjB,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;gBACxC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;oBACrB,IA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AAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;uBACtD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;YACrE,CAAC,CAAC,CAAC;YAGH,IAAI,CAAC,KAAK,EAAE,CAAC;gBACT,KAAK,GAAG,IAAI,uBAAO,CAAC,OAAO,CAAC,CAAC;gBAC7B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACvB,CAAC;YAED,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC,CAAC,CAAC;QAEP,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAnGD,oCAmGC"}
@@ -0,0 +1,24 @@
1
+ import { A_Channel } from "@adaas/a-concept/global/A-Channel/A-Channel.class";
2
+
3
+
4
+ export class TestChannel extends A_Channel<any> {
5
+
6
+
7
+ getVersion(
8
+ params
9
+ ) {
10
+
11
+ }
12
+
13
+
14
+ getUser() {
15
+
16
+ }
17
+
18
+
19
+ getPage() {
20
+ }
21
+
22
+
23
+
24
+ }
@@ -0,0 +1,20 @@
1
+ import { A_Component } from "@adaas/a-concept/global/A-Component/A-Component.class";
2
+ import { A_Feature } from "@adaas/a-concept/global/A-Feature/A-Feature.class";
3
+
4
+
5
+
6
+ export class BEController extends A_Component {
7
+
8
+
9
+
10
+ @A_Feature.Define({
11
+ name: 'getOrdersCount',
12
+ // channel
13
+ })
14
+ getOrdersCount() {
15
+
16
+ return 0;
17
+ }
18
+
19
+
20
+ }
@@ -0,0 +1,13 @@
1
+ import { A_Component } from "@adaas/a-concept/global/A-Component/A-Component.class";
2
+ import { A_Concept } from "@adaas/a-concept/global/A-Concept/A_Concept.class";
3
+
4
+
5
+
6
+ export class FEComponent extends A_Component {
7
+
8
+
9
+ @A_Concept.Load()
10
+ async renderHomePage() {
11
+
12
+ }
13
+ }
File without changes
@@ -0,0 +1,8 @@
1
+ import { A_Container } from "@adaas/a-concept/global/A-Container/A-Container.class";
2
+
3
+
4
+ export class ServerApp extends A_Container {
5
+
6
+
7
+
8
+ }
@@ -0,0 +1,13 @@
1
+ import { A_Container } from "@adaas/a-concept/global/A-Container/A-Container.class";
2
+
3
+
4
+
5
+ export class WebApp extends A_Container {
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+ }
@@ -0,0 +1,39 @@
1
+ import { A_Channel } from "@adaas/a-concept/global/A-Channel/A-Channel.class";
2
+ import { A_TYPES__A_ChannelAggregateMethods, A_TYPES__A_ChannelCallParams } from "@adaas/a-concept/global/A-Channel/A-Channel.types";
3
+ import { A_Component } from "@adaas/a-concept/global/A-Component/A-Component.class";
4
+ import { A_Container } from "@adaas/a-concept/global/A-Container/A-Container.class";
5
+
6
+
7
+ export class DirectChannel<
8
+ T extends A_Container<any>,
9
+ > extends A_Channel<[T]> {
10
+
11
+ protected instance: T
12
+
13
+ constructor(
14
+ public container: T
15
+ ) {
16
+ super({
17
+ id: `direct-channel--${container.name}`
18
+ });
19
+
20
+ this.instance = container;
21
+ }
22
+
23
+
24
+ async call<_Resp extends unknown>(
25
+ prop: A_TYPES__A_ChannelAggregateMethods<[T]>,
26
+ params?: Partial<A_TYPES__A_ChannelCallParams>
27
+ ): Promise<_Resp> {
28
+
29
+ if (!this.instance[prop]) {
30
+ throw new Error(`Method ${prop} not found in ${this.instance.name}`);
31
+ }
32
+
33
+ return await (this.instance[prop] as any)(params) as Promise<_Resp>;
34
+ }
35
+
36
+ }
37
+
38
+
39
+
File without changes
@@ -0,0 +1,41 @@
1
+ import { A_Connect } from "@adaas/a-concept/decorators/A-Connect/A-Connect.decorator";
2
+ import { A_Channel } from "@adaas/a-concept/global/A-Channel/A-Channel.class";
3
+ import { A_TYPES__A_ChannelCallParams } from "@adaas/a-concept/global/A-Channel/A-Channel.types";
4
+ import { A_Container } from "@adaas/a-concept/global/A-Container/A-Container.class";
5
+ import { A_Feature } from "@adaas/a-concept/global/A-Feature/A-Feature.class";
6
+ import { ScheduleContainer } from "./Schedule.container";
7
+
8
+
9
+
10
+ export class CommandContainer extends A_Container<[
11
+ 'execute',
12
+ ]> {
13
+
14
+ constructor() {
15
+ super({});
16
+ }
17
+
18
+
19
+
20
+ @A_Feature.Define({
21
+ name: 'execute',
22
+ // channels: []
23
+ })
24
+ async execute(
25
+ arg: Partial<A_TYPES__A_ChannelCallParams>
26
+ ) {
27
+ console.log('CommandContainer -> command()');
28
+ }
29
+
30
+
31
+
32
+
33
+ async doSomething(
34
+ @A_Connect(A_Channel, '') schedule: A_Channel<[ScheduleContainer]>
35
+ ) {
36
+
37
+ schedule.call('schedule', {});
38
+
39
+ }
40
+
41
+ }
@@ -0,0 +1,57 @@
1
+ import { A_Connect } from "@adaas/a-concept/decorators/A-Connect/A-Connect.decorator";
2
+ import { A_Feature_Define } from "@adaas/a-concept/decorators/A-Feature/A-Feature-Define.decorator";
3
+ import { A_Inject } from "@adaas/a-concept/decorators/A-Inject/A-Inject.decorator";
4
+ import { A_Channel } from "@adaas/a-concept/global/A-Channel/A-Channel.class";
5
+ import { A_Container } from "@adaas/a-concept/global/A-Container/A-Container.class";
6
+ import { CommandContainer } from "./Command.container";
7
+ import { A_TYPES__A_ExecutableMethods } from "@adaas/a-concept/global/A-Channel/A-Channel.types";
8
+
9
+
10
+ export class ScheduleContainer extends A_Container<[
11
+ 'schedule',
12
+ 'start',
13
+ 'stop',
14
+ 'pause',
15
+ ]> {
16
+
17
+ private tasks = [];
18
+
19
+
20
+ constructor() {
21
+ super({});
22
+ }
23
+
24
+
25
+
26
+ @A_Feature_Define({
27
+ name: 'schedule',
28
+ // channels: []
29
+ })
30
+ async schedule(
31
+ // @A_Inject('task') task: any
32
+ ) {
33
+ console.log('ScheduleContainer -> schedule()');
34
+ }
35
+
36
+
37
+
38
+ @A_Feature_Define({
39
+ name: 'start',
40
+ // channels: []
41
+ })
42
+ async start() {
43
+ console.log('ScheduleContainer -> start()');
44
+ }
45
+
46
+
47
+
48
+ async onExecution(
49
+ @A_Connect(A_Channel, '') commands: A_Channel<[CommandContainer]>
50
+ ) {
51
+ const result = await commands.call('execute', {
52
+ fragments: []
53
+ });
54
+
55
+ }
56
+
57
+ }
@@ -16,7 +16,8 @@ export class ComponentA extends A_Component {
16
16
  @A_Feature.Extend()
17
17
  async method_A(
18
18
  @A_Inject(ContextFragmentA) fragmentA: ContextFragmentA,
19
- @A_Inject(A_Logger) logger: A_Logger
19
+ @A_Inject(A_Logger) logger: A_Logger,
20
+
20
21
  ) {
21
22
  logger.log('red', 'Component A -> method_A()');
22
23
  fragmentA.decrement();
@@ -7,6 +7,7 @@ import { A_Inject } from "@adaas/a-concept/decorators/A-Inject/A-Inject.decorato
7
7
  import { A_Context } from "@adaas/a-concept/global/A-Context/A-Context.class";
8
8
  import { A_Logger } from "@adaas/a-concept/base/A-Logger/A-Logger.component";
9
9
  import { A_Scope } from "@adaas/a-concept/global/A-Scope/A-Scope.class";
10
+ import { EntityA } from "../entities/EntityA.entity";
10
11
 
11
12
 
12
13
 
@@ -49,6 +50,13 @@ export class MainContainer extends A_Container<
49
50
  ) {
50
51
  console.log('Method B', A_Context.root);
51
52
 
53
+ const entity = new EntityA('test@test:test:0000000001');
54
+
55
+ this.Scope.register(entity);
56
+
57
+ await entity.doSomething();
58
+
59
+
52
60
  const logger = this.Scope.resolve(A_Logger);
53
61
 
54
62
  // or you can manually call the feature
@@ -57,10 +65,10 @@ export class MainContainer extends A_Container<
57
65
  fragments: [new ContextFragmentA(), new ContextFragmentB()]
58
66
  });
59
67
 
60
- for (const step of feature) {
61
- logger.log('Manual Loop Execution Step', feature.current);
68
+ for (const stage of feature) {
69
+ logger.log('Manual Loop Execution Step', feature.stage);
62
70
 
63
- await step();
71
+ await stage.process();
64
72
  }
65
73
  }
66
74
  }
@@ -0,0 +1,16 @@
1
+ import { A_Entity } from "@adaas/a-concept/global/A-Entity/A-Entity.class";
2
+ import { A_TYPES__EntityBaseMethods } from "@adaas/a-concept/global/A-Entity/A-Entity.types";
3
+
4
+
5
+
6
+ export class EntityA extends A_Entity<any, any, [
7
+ ...A_TYPES__EntityBaseMethods,
8
+ 'doSomething'
9
+ ]> {
10
+
11
+
12
+
13
+ async doSomething() {
14
+ await this.call('doSomething');
15
+ }
16
+ }
@@ -33,13 +33,13 @@ export class HTTPRequest extends A_Fragment {
33
33
  }
34
34
 
35
35
 
36
- async toJSON<T extends any>(): Promise<T> {
37
- if (!this._body) {
38
- this._body = await this.parseBody();
39
- }
36
+ // async toJSON<T extends any>(): Promise<T> {
37
+ // if (!this._body) {
38
+ // this._body = await this.parseBody();
39
+ // }
40
40
 
41
- return this._body;
42
- }
41
+ // return this._body;
42
+ // }
43
43
 
44
44
  private parseBody(): Promise<any> {
45
45
  return new Promise((resolve, reject) => {
package/index.ts CHANGED
@@ -1,7 +1,7 @@
1
-
2
1
  // =================================================================================================
3
2
  // ============================= Export Framework Components =======================================
4
3
  // =================================================================================================
4
+
5
5
  // ---------------------- Major Components ----------------------
6
6
  export { A_Context } from './src/global/A-Context/A-Context.class';
7
7
  // export * from './src/global/A-Context/A-Context.types';
@@ -23,9 +23,15 @@ export * from './src/global/A-Entity/A-Entity.types';
23
23
 
24
24
 
25
25
  // ---------------------- Common Components ----------------------
26
+ export { A_Channel } from './src/global/A-Channel/A-Channel.class';
27
+ export * from './src/global/A-Channel/A-Channel.types';
28
+
26
29
  export { A_Feature } from './src/global/A-Feature/A-Feature.class';
27
30
  export * from './src/global/A-Feature/A-Feature.types';
28
31
 
32
+ export { A_Stage } from './src/global/A-Stage/A-Stage.class';
33
+ export * from './src/global/A-Stage/A-Stage.types';
34
+
29
35
  export { A_Scope } from './src/global/A-Scope/A-Scope.class';
30
36
  export * from './src/global/A-Scope/A-Scope.types';
31
37
 
@@ -47,8 +53,11 @@ export { A_Feature_Define } from './src/decorators/A-Feature/A-Feature-Define.de
47
53
  export { A_Feature_Extend } from './src/decorators/A-Feature/A-Feature-Extend.decorator';
48
54
  export * from './src/decorators/A-Feature/A-Feature.decorator.types';
49
55
 
50
- export { A_Stage } from './src/decorators/A-Stage/A-Stage.decorator';
51
- export * from './src/decorators/A-Stage/A-Stage.decorator.types';
56
+ export { A_Abstraction } from './src/decorators/A-Abstraction/A-Abstraction.decorator';
57
+ export * from './src/decorators/A-Abstraction/A-Abstraction.decorator.types';
58
+
59
+ export { A_Connect } from './src/decorators/A-Connect/A-Connect.decorator';
60
+ export * from './src/decorators/A-Connect/A-Connect.decorator.types';
52
61
 
53
62
 
54
63
  // =================================================================================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaas/a-concept",
3
- "version": "0.0.29",
3
+ "version": "0.0.31",
4
4
  "description": "A-Concept is a framework to build new Applications within or outside the ADAAS ecosystem. This framework is designed to be modular structure regardless environment and program goal.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -0,0 +1,10 @@
1
+ import { A_Entity } from "@adaas/a-concept/global/A-Entity/A-Entity.class";
2
+
3
+
4
+
5
+ export class A_Error extends A_Entity {
6
+
7
+
8
+
9
+
10
+ }
@@ -17,11 +17,11 @@ export class A_Errors extends A_Fragment {
17
17
  name: params.name || 'a-errors'
18
18
  });
19
19
 
20
+ this.addRegistry(A_CONSTANTS__DEFAULT_ERRORS);
21
+
20
22
  if (params.errors) {
21
23
  this.addRegistry(params.errors);
22
24
  }
23
-
24
- this.addRegistry(A_CONSTANTS__DEFAULT_ERRORS);
25
25
  }
26
26
 
27
27
 
@@ -0,0 +1,82 @@
1
+ import { A_Component } from "@adaas/a-concept/global/A-Component/A-Component.class";
2
+ import {
3
+ A_TYPES__A_AbstractionDecoratorDescriptor,
4
+ } from "./A-Abstraction.decorator.types";
5
+ import { A_TYPES__ComponentMetaKey } from "@adaas/a-concept/global/A-Component/A-Component.types";
6
+ import { A_Context } from "@adaas/a-concept/global/A-Context/A-Context.class";
7
+ import { A_Container } from "@adaas/a-concept/global/A-Container/A-Container.class";
8
+ import { A_TYPES__ContainerMetaKey } from "@adaas/a-concept/global/A-Container/A-Container.types";
9
+ import { A_TYPES__ConceptAbstraction, A_TYPES__ConceptStage } from "@adaas/a-concept/global/A-Concept/A_Concept.types";
10
+ import { A_ContainerMeta } from "@adaas/a-concept/global/A-Container/A-Container.meta";
11
+ import { A_ComponentMeta } from "@adaas/a-concept/global/A-Component/A-Component.meta";
12
+ import { A_Meta } from "@adaas/a-concept/global/A-Meta/A-Meta.class";
13
+ import { A_TYPES__A_ExtendDecoratorConfig } from "../A-Feature/A-Feature.decorator.types";
14
+
15
+
16
+ /**
17
+ * A_Stage Decorator uses to extend basic A-Concept Stage methods inside Containers.
18
+ *
19
+ * Using this decorator you can define extend a logic and sequence of the Container Stage methods execution.
20
+ *
21
+ * @param params
22
+ * @returns
23
+ */
24
+ export function A_Abstraction(
25
+ method: A_TYPES__ConceptStage,
26
+ config: Partial<A_TYPES__A_ExtendDecoratorConfig> = {}
27
+ ) {
28
+ return function (
29
+ target: A_Container<any> | A_Component,
30
+ propertyKey: string,
31
+ descriptor: A_TYPES__A_AbstractionDecoratorDescriptor
32
+ ) {
33
+
34
+ const meta: A_ContainerMeta | A_ComponentMeta = A_Context.meta(target as any);
35
+
36
+ let metaKey;
37
+
38
+ const StageKey = `CONCEPT_ABSTRACTION::${method}`;
39
+
40
+ switch (true) {
41
+ case target instanceof A_Container:
42
+ metaKey = A_TYPES__ContainerMetaKey.ABSTRACTIONS
43
+ break;
44
+ case target instanceof A_Component:
45
+ metaKey = A_TYPES__ComponentMetaKey.ABSTRACTIONS
46
+ break;
47
+ default:
48
+ throw new Error(`Concept Stage cannot be defined on the ${target} level`);
49
+ }
50
+
51
+ // Get the existed metadata or create a new one
52
+ const existedMeta: A_Meta<{
53
+ [Key: string]: A_TYPES__ConceptAbstraction[];
54
+ }> = meta.get(metaKey) || new A_Meta();
55
+
56
+ // Set the metadata of the method to define a custom Stage with name
57
+ const existedMetaValue = existedMeta.get(StageKey) || [];
58
+
59
+
60
+ // Add the new method to the metadata
61
+ existedMetaValue.push({
62
+ name: method,
63
+ handler: propertyKey,
64
+ before: config.before || [],
65
+ after: config.after || [],
66
+ behavior: config.behavior || 'sync'
67
+ });
68
+
69
+ // Set the metadata of the method to define a custom Feature with name
70
+ existedMeta.set(StageKey, existedMetaValue);
71
+
72
+
73
+ // Update the metadata of the container with the new Stage definition
74
+ A_Context
75
+ .meta(target as any)
76
+ .set(
77
+ metaKey,
78
+ existedMeta
79
+ );
80
+
81
+ };
82
+ }
@@ -1,7 +1,5 @@
1
- import { A_Concept } from "@adaas/a-concept/global/A-Concept/A_Concept.class"
2
- import { A_TYPES__ConceptStage } from "@adaas/a-concept/global/A-Concept/A_Concept.types"
3
1
 
4
- export type A_TYPES__A_StageDecoratorDescriptor =
2
+ export type A_TYPES__A_AbstractionDecoratorDescriptor =
5
3
 
6
4
  TypedPropertyDescriptor<() => any>
7
5
  |