@adaas/a-concept 0.0.29 → 0.0.30

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 (175) 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/decorators/A-Abstraction/A-Abstraction.decorator.d.ts +14 -0
  47. package/dist/src/decorators/A-Abstraction/A-Abstraction.decorator.js +53 -0
  48. package/dist/src/decorators/A-Abstraction/A-Abstraction.decorator.js.map +1 -0
  49. package/dist/src/decorators/A-Abstraction/A-Abstraction.decorator.types.d.ts +2 -0
  50. package/dist/src/decorators/A-Abstraction/A-Abstraction.decorator.types.js +3 -0
  51. package/dist/src/decorators/A-Abstraction/A-Abstraction.decorator.types.js.map +1 -0
  52. package/dist/src/decorators/A-Connect/A-Connect.decorator.d.ts +19 -0
  53. package/dist/src/decorators/A-Connect/A-Connect.decorator.js +31 -0
  54. package/dist/src/decorators/A-Connect/A-Connect.decorator.js.map +1 -0
  55. package/dist/src/decorators/A-Connect/A-Connect.decorator.types.d.ts +1 -0
  56. package/dist/src/decorators/A-Connect/A-Connect.decorator.types.js +3 -0
  57. package/dist/src/decorators/A-Connect/A-Connect.decorator.types.js.map +1 -0
  58. package/dist/src/decorators/A-Entity/A-Entity-List.decorator.d.ts +1 -0
  59. package/dist/src/decorators/A-Entity/A-Entity-List.decorator.js +8 -0
  60. package/dist/src/decorators/A-Entity/A-Entity-List.decorator.js.map +1 -0
  61. package/dist/src/decorators/A-Entity/A-Entity.decorator.types.d.ts +14 -0
  62. package/dist/src/decorators/A-Entity/A-Entity.decorator.types.js +3 -0
  63. package/dist/src/decorators/A-Entity/A-Entity.decorator.types.js.map +1 -0
  64. package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.js +9 -0
  65. package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.js.map +1 -1
  66. package/dist/src/decorators/A-Feature/A-Feature.decorator.types.d.ts +28 -0
  67. package/dist/src/decorators/A-Inject/A-Inject.decorator.d.ts +2 -3
  68. package/dist/src/decorators/A-Inject/A-Inject.decorator.js.map +1 -1
  69. package/dist/src/decorators/A-Inject/A-Inject.decorator.types.d.ts +44 -0
  70. package/dist/src/global/A-Channel/A-Channel.class.d.ts +8 -10
  71. package/dist/src/global/A-Channel/A-Channel.class.js +12 -26
  72. package/dist/src/global/A-Channel/A-Channel.class.js.map +1 -1
  73. package/dist/src/global/A-Channel/A-Channel.types.d.ts +32 -0
  74. package/dist/src/global/A-Component/A-Component.class.d.ts +2 -1
  75. package/dist/src/global/A-Component/A-Component.class.js +1 -0
  76. package/dist/src/global/A-Component/A-Component.class.js.map +1 -1
  77. package/dist/src/global/A-Component/A-Component.meta.d.ts +8 -0
  78. package/dist/src/global/A-Component/A-Component.meta.js +27 -1
  79. package/dist/src/global/A-Component/A-Component.meta.js.map +1 -1
  80. package/dist/src/global/A-Component/A-Component.types.d.ts +19 -34
  81. package/dist/src/global/A-Component/A-Component.types.js +1 -7
  82. package/dist/src/global/A-Component/A-Component.types.js.map +1 -1
  83. package/dist/src/global/A-Concept/A_Concept.class.d.ts +7 -7
  84. package/dist/src/global/A-Concept/A_Concept.class.js +30 -30
  85. package/dist/src/global/A-Concept/A_Concept.class.js.map +1 -1
  86. package/dist/src/global/A-Concept/A_Concept.types.d.ts +42 -2
  87. package/dist/src/global/A-Concept/A_Concept.types.js.map +1 -1
  88. package/dist/src/global/A-Container/A-Container.class.d.ts +1 -8
  89. package/dist/src/global/A-Container/A-Container.class.js +1 -31
  90. package/dist/src/global/A-Container/A-Container.class.js.map +1 -1
  91. package/dist/src/global/A-Container/A-Container.meta.d.ts +8 -0
  92. package/dist/src/global/A-Container/A-Container.meta.js +29 -0
  93. package/dist/src/global/A-Container/A-Container.meta.js.map +1 -1
  94. package/dist/src/global/A-Container/A-Container.types.d.ts +23 -7
  95. package/dist/src/global/A-Container/A-Container.types.js +2 -1
  96. package/dist/src/global/A-Container/A-Container.types.js.map +1 -1
  97. package/dist/src/global/A-Context/A-Context.class.js +6 -35
  98. package/dist/src/global/A-Context/A-Context.class.js.map +1 -1
  99. package/dist/src/global/A-Entity/A-Entity.class.d.ts +1 -2
  100. package/dist/src/global/A-Entity/A-Entity.class.js +6 -7
  101. package/dist/src/global/A-Entity/A-Entity.class.js.map +1 -1
  102. package/dist/src/global/A-Entity/A-Entity.types.d.ts +4 -5
  103. package/dist/src/global/A-Entity/A-Entity.types.js.map +1 -1
  104. package/dist/src/global/A-Feature/A-Feature.class.d.ts +30 -6
  105. package/dist/src/global/A-Feature/A-Feature.class.js +49 -40
  106. package/dist/src/global/A-Feature/A-Feature.class.js.map +1 -1
  107. package/dist/src/global/A-Feature/A-Feature.types.d.ts +2 -24
  108. package/dist/src/global/A-Feature/A-Feature.types.js +21 -0
  109. package/dist/src/global/A-Feature/A-Feature.types.js.map +1 -1
  110. package/dist/src/global/A-Fragment/A-Fragment.class.d.ts +8 -0
  111. package/dist/src/global/A-Fragment/A-Fragment.class.js +10 -0
  112. package/dist/src/global/A-Fragment/A-Fragment.class.js.map +1 -1
  113. package/dist/src/global/A-Scope/A-Scope.class.d.ts +7 -5
  114. package/dist/src/global/A-Scope/A-Scope.class.js +33 -10
  115. package/dist/src/global/A-Scope/A-Scope.class.js.map +1 -1
  116. package/dist/src/global/A-Scope/A-Scope.types.d.ts +2 -1
  117. package/dist/src/global/A-Stage/A-Stage.class.d.ts +69 -0
  118. package/dist/src/global/A-Stage/A-Stage.class.js +176 -0
  119. package/dist/src/global/A-Stage/A-Stage.class.js.map +1 -0
  120. package/dist/src/global/A-Stage/A-Stage.types.d.ts +83 -0
  121. package/dist/src/global/A-Stage/A-Stage.types.js +59 -0
  122. package/dist/src/global/A-Stage/A-Stage.types.js.map +1 -0
  123. package/dist/src/helpers/StepsManager.class.d.ts +15 -0
  124. package/dist/src/helpers/StepsManager.class.js +85 -0
  125. package/dist/src/helpers/StepsManager.class.js.map +1 -0
  126. package/examples/fe-be/channels/Test.channel.ts +24 -0
  127. package/examples/fe-be/components/BE-Controller.component.ts +20 -0
  128. package/examples/fe-be/components/FE.component.ts +13 -0
  129. package/examples/fe-be/concept.ts +0 -0
  130. package/examples/fe-be/containers/ServerApp.container.ts +8 -0
  131. package/examples/fe-be/containers/WebApp.container.ts +13 -0
  132. package/examples/multi-container/channels/Direct.channel.ts +39 -0
  133. package/examples/multi-container/concept.ts +0 -0
  134. package/examples/multi-container/containers/Command.container.ts +41 -0
  135. package/examples/multi-container/containers/Schedule.container.ts +57 -0
  136. package/examples/simple/components/A.component.ts +2 -1
  137. package/examples/simple/containers/Main.container.ts +11 -3
  138. package/examples/simple/entities/EntityA.entity.ts +16 -0
  139. package/examples/simple-http-server/contexts/http-request.context.ts +6 -6
  140. package/index.ts +12 -3
  141. package/package.json +1 -1
  142. package/src/decorators/A-Abstraction/A-Abstraction.decorator.ts +82 -0
  143. package/src/decorators/{A-Stage/A-Stage.decorator.types.ts → A-Abstraction/A-Abstraction.decorator.types.ts} +1 -3
  144. package/src/decorators/A-Connect/A-Connect.decorator.ts +71 -0
  145. package/src/decorators/A-Connect/A-Connect.decorator.types.ts +6 -0
  146. package/src/decorators/A-Entity/A-Entity-List.decorator.ts +12 -0
  147. package/src/decorators/A-Entity/A-Entity.decorator.types.ts +18 -0
  148. package/src/decorators/A-Feature/A-Feature-Extend.decorator.ts +10 -0
  149. package/src/decorators/A-Feature/A-Feature.decorator.types.ts +36 -0
  150. package/src/decorators/A-Inject/A-Inject.decorator.ts +7 -7
  151. package/src/decorators/A-Inject/A-Inject.decorator.types.ts +47 -1
  152. package/src/global/A-Channel/A-Channel.class.ts +25 -28
  153. package/src/global/A-Channel/A-Channel.types.ts +53 -0
  154. package/src/global/A-Component/A-Component.class.ts +10 -2
  155. package/src/global/A-Component/A-Component.meta.ts +42 -1
  156. package/src/global/A-Component/A-Component.types.ts +20 -40
  157. package/src/global/A-Concept/A_Concept.class.ts +52 -31
  158. package/src/global/A-Concept/A_Concept.types.ts +48 -3
  159. package/src/global/A-Container/A-Container.class.ts +3 -39
  160. package/src/global/A-Container/A-Container.meta.ts +41 -4
  161. package/src/global/A-Container/A-Container.types.ts +28 -7
  162. package/src/global/A-Context/A-Context.class.ts +9 -49
  163. package/src/global/A-Entity/A-Entity.class.ts +8 -6
  164. package/src/global/A-Entity/A-Entity.types.ts +4 -5
  165. package/src/global/A-Feature/A-Feature.class.ts +73 -61
  166. package/src/global/A-Feature/A-Feature.types.ts +24 -23
  167. package/src/global/A-Fragment/A-Fragment.class.ts +15 -0
  168. package/src/global/A-Scope/A-Scope.class.ts +58 -25
  169. package/src/global/A-Scope/A-Scope.types.ts +2 -1
  170. package/src/global/A-Stage/A-Stage.class.ts +225 -0
  171. package/src/global/A-Stage/A-Stage.types.ts +106 -0
  172. package/src/helpers/StepsManager.class.ts +104 -0
  173. package/tests/channel.ts +213 -0
  174. package/tests/log.ts +88 -40
  175. package/src/decorators/A-Stage/A-Stage.decorator.ts +0 -84
@@ -0,0 +1,213 @@
1
+ // import { A_Inject } from "@adaas/a-concept/decorators/A-Inject/A-Inject.decorator";
2
+ // import { A_Component } from "@adaas/a-concept/global/A-Component/A-Component.class";
3
+ // import { A_Container } from "@adaas/a-concept/global/A-Container/A-Container.class";
4
+ // import { A_Feature } from "@adaas/a-concept/global/A-Feature/A-Feature.class";
5
+ // import { EventEmitter } from "stream";
6
+
7
+
8
+ // class ComponentA extends A_Component<[
9
+ // 'method1',
10
+ // 'method2'
11
+ // ]> {
12
+
13
+ // @A_Feature.Define({
14
+ // name: 'method1',
15
+ // channels: []
16
+ // } as any)
17
+ // async method1() {
18
+
19
+ // }
20
+
21
+ // @A_Feature.Define({
22
+ // name: 'method2',
23
+ // channels: []
24
+ // } as any)
25
+ // async method2() {
26
+
27
+ // }
28
+ // }
29
+
30
+
31
+ // class ComponentB extends A_Component<[
32
+ // 'ComponentB_method3',
33
+ // 'ComponentB_method4'
34
+ // ]> {
35
+
36
+ // @A_Feature.Define({
37
+ // name: 'ComponentB_method3',
38
+ // channels: []
39
+ // } as any)
40
+ // async ComponentB_method3(param1: {
41
+ // key: string
42
+ // }) {
43
+
44
+ // }
45
+
46
+ // @A_Feature.Define({
47
+ // name: 'ComponentB_method4',
48
+ // channels: []
49
+ // } as any)
50
+ // async ComponentB_method4(foo: number) {
51
+
52
+ // }
53
+ // }
54
+
55
+
56
+
57
+ // type MethodsWithSpecificArg<T, ArgType> = {
58
+ // [K in keyof T]: T[K] extends (arg: ArgType, ...args: any[]) => Promise<any> ? K : never
59
+ // }[keyof T];
60
+
61
+ // // Example argument type
62
+ // type SpecificArgType = { key: string };
63
+
64
+ // type AggregateMethods<TClasses extends A_Component[]> = {
65
+ // [K in keyof TClasses]: TClasses[K] extends infer Instance
66
+ // ? MethodsWithSpecificArg<Instance, SpecificArgType>
67
+ // : never;
68
+ // }[number];
69
+
70
+
71
+ // type MethodObject2<TClasses extends any[]> = {
72
+ // [Method in AggregateMethods<TClasses>]: {
73
+ // [Class in keyof TClasses]: TClasses[Class] extends infer Instance
74
+ // ? Method extends keyof Instance
75
+ // ? Instance[Method]
76
+ // : never
77
+ // : never;
78
+ // }[number]; // Select the method signature from any matching class
79
+ // };
80
+
81
+
82
+
83
+ // // decorator to create a channel
84
+ // function A_Connect() {
85
+ // return function (target: any, prop: string) {
86
+ // console.log('A_Connect', target, prop);
87
+ // }
88
+ // }
89
+
90
+
91
+
92
+ // class Channel<T extends A_Component[]> {
93
+
94
+ // channel: MethodObject2<T>;
95
+
96
+ // constructor() {
97
+ // this.channel = new Proxy(
98
+ // {} as MethodObject2<T>,
99
+ // {
100
+ // get: (target, prop) => {
101
+ // return async (...args: any[]) => {
102
+ // this.call(prop as AggregateMethods<T>);
103
+ // };
104
+ // }
105
+ // });
106
+ // }
107
+
108
+
109
+ // async call(prop: AggregateMethods<T>) {
110
+ // // do HTTP Call or just inject class or whatever you want
111
+
112
+ // console.log('Calling method', prop);
113
+ // }
114
+
115
+ // }
116
+
117
+
118
+
119
+
120
+ // class HTTP<T extends A_Component[]> extends Channel<T> {
121
+
122
+ // async call(prop: AggregateMethods<T>): Promise<void> {
123
+
124
+ // console.log('HTTP Call', prop);
125
+ // }
126
+ // }
127
+
128
+ // class ConceptDirect<T extends A_Component[]> extends Channel<T> {
129
+
130
+ // // protected originalInstance: T;
131
+
132
+ // async call(prop: AggregateMethods<T>): Promise<void> {
133
+ // console.log('Direct Call', prop);
134
+ // }
135
+
136
+ // }
137
+
138
+
139
+
140
+ // class ConceptEE extends Channel<any> {
141
+
142
+ // private emitter: EventEmitter = new EventEmitter();
143
+
144
+ // constructor() {
145
+ // super();
146
+ // }
147
+
148
+ // async call(prop: string): Promise<void> {
149
+ // console.log('EE Call', prop);
150
+ // }
151
+
152
+ // on = this.emitter.on.bind(this.emitter);
153
+
154
+ // emit = this.emitter.emit.bind(this.emitter);
155
+
156
+ // }
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+ // class FooContainer extends A_Container<[
179
+ // 'doSomething',
180
+ // 'doAnotherThing'
181
+ // ]> {
182
+
183
+
184
+ // @A_Feature.Define({
185
+ // name: 'doSomething',
186
+ // channels: [ConceptDirect, HTTP]
187
+ // } as any)
188
+ // async doSomething(
189
+ // @A_Inject(HTTP) http: HTTP<[ComponentA, ComponentB]>,
190
+ // ) {
191
+
192
+ // // @A_Connect(http, 'ComponentB_method3')
193
+
194
+ // const foo = await http.channel.ComponentB_method3({
195
+ // key: 'value'
196
+ // });
197
+ // }
198
+
199
+
200
+
201
+
202
+ // @A_Feature.Define({
203
+ // name: 'doAnotherThing',
204
+ // channels: [HTTP]
205
+ // } as any)
206
+ // async onRequest() {
207
+ // await this.call('doSomething');
208
+ // }
209
+ // }
210
+
211
+
212
+
213
+
package/tests/log.ts CHANGED
@@ -1,54 +1,102 @@
1
- // import { A_CONSTANTS__DEFAULT_ERRORS } from "@adaas/a-concept/constants/errors.constants";
2
- // import { A_Context } from "@adaas/a-concept/global/A-Namespace/A_Namespace.class"
3
- // import { A_Error } from "@adaas/a-concept/global/A_Error.class";
4
- // import rl from 'readline';
1
+ // import { A_Container } from "@adaas/a-concept/global/A-Container/A-Container.class";
2
+ // import { A_Feature } from "@adaas/a-concept/global/A-Feature/A-Feature.class";
3
+ // import EventEmitter from "events";
5
4
 
5
+ // type MethodsOfComponent<T> = T extends typeof BaseComponent<infer M extends Array<string>> ? M : never;
6
6
 
7
- // (async () => {
8
7
 
9
- // await A_Context.ready;
10
8
 
11
- // A_Context.configure({
12
- // verbose: true
13
- // })
9
+ // class BaseComponent<_Methods extends string[] = []> {
14
10
 
15
- // A_Context.Logger.log('Test Log', {
16
- // test: 'test',
17
- // test2: 'test2',
18
- // foo: {
19
- // bar: 'bar',
20
- // baz: {
21
- // qux: 'qux'
11
+ // constructor(
12
+ // private params?: Partial<{
13
+ // exports: _Methods
14
+ // }>) {
15
+
16
+ // }
17
+ // }
18
+
19
+ // class BaseContainer<_AllComponents extends typeof BaseComponent<string[]>[]> {
20
+
21
+ // constructor(public components: _AllComponents) {
22
+ // // this.allMethods = components
23
+ // // .map((component) => component.methods)
24
+ // // .flat(); // Extract methods at runtime
25
+ // }
26
+
27
+
28
+ // callMethod(method: MethodsOfComponent<_AllComponents[number]>[number]) {
29
+ // // if (!this.allMethods.includes(method)) {
30
+ // // throw new Error(`Method ${method} is not available.`);
31
+ // // }
32
+ // console.log(`Calling method: ${method}`);
33
+ // }
34
+ // }
35
+
36
+
37
+
38
+ // // Define your components
39
+ // class ComponentA extends BaseComponent<['doSomething']> {
40
+ // // constructor() {
41
+ // // super(['doSomething']);
42
+ // // }
43
+ // }
44
+
45
+
46
+ // type ProxyTypeWithMethods<T> = T extends BaseContainer<infer M extends typeof BaseComponent<string[]>[]> ? MethodsOfComponent<M[number]> : never;
47
+
48
+
49
+ // class channel<T extends BaseContainer<typeof BaseComponent<string[]>[]>> {
50
+
51
+
52
+ // getProvider()
53
+ // : {
54
+ // [K in ProxyTypeWithMethods<T>[number]]: () => void
55
+ // } {
56
+ // return new Proxy({} as any, {
57
+ // get(target, prop, receiver) {
58
+ // return target[prop];
22
59
  // }
23
- // }
24
- // }, 'Maybe its a hige update');
60
+ // });
61
+ // }
62
+ // }
63
+
64
+ // class ComponentB extends BaseComponent<['doAnotherThing']> {
65
+ // // constructor() {
66
+ // // super(['doAnotherThing']);
67
+ // // }
68
+
69
+
70
+
71
+ // method3() {
72
+
73
+
74
+ // }
75
+ // }
76
+
77
+ // // Instantiate the container
78
+ // const container = new BaseContainer([
79
+ // ComponentA,
80
+ // ComponentB
81
+ // ]);
82
+
83
+
84
+
85
+
86
+
87
+ // // Correct usage
88
+ // container.callMethod('doSomething'); // Calling method: doSomething
89
+ // container.callMethod('doAnotherThing'); // Calling method: doAnotherThing
25
90
 
26
- // A_Context.Logger.error(new Error('Test Error'), new A_Error(A_CONSTANTS__DEFAULT_ERRORS.CONFIGURATION_PROPERTY_NOT_EXISTS_OR_NOT_ALLOWED_TO_READ));
27
- // A_Context.Logger.error(new A_Error(A_CONSTANTS__DEFAULT_ERRORS.CONFIGURATION_PROPERTY_NOT_EXISTS_OR_NOT_ALLOWED_TO_READ));
28
- // A_Context.Logger.log(new A_Error(A_CONSTANTS__DEFAULT_ERRORS.CONFIGURATION_PROPERTY_NOT_EXISTS_OR_NOT_ALLOWED_TO_READ));
29
91
 
30
- // const rlInterface = rl.createInterface({
31
- // input: process.stdin,
32
- // output: process.stdout
33
- // });
34
92
 
35
- // const answer = await new Promise<string>(resolve => rlInterface
36
- // .question(
37
- // A_Context.Logger.compile('pink', 'What is your name?', '(1,2,3,4)').join(' ') + '\n' +
38
- // A_Context.Logger.compile('pink', 'Answer (1,2,3,4)').join(' '),
39
- // resolve));
93
+ // const channelInstance = new channel<typeof container>();
40
94
 
41
- // rl.moveCursor(process.stdout, 0, -1); // Move cursor to the beginning of the previous line
42
- // rl.clearLine(process.stdout, 0); // Clear the current line
95
+ // const provider = channelInstance.getProvider();
43
96
 
44
- // const answer2 = await new Promise<string>(resolve => rlInterface
45
- // .question(
46
- // A_Context.Logger.compile('pink', 'Answer (1,2,3,4)').join(' '),
47
- // resolve));
97
+ // provider.doAnotherThing();
48
98
 
49
- // rl.moveCursor(process.stdout, 0, -1); // Move cursor to the beginning of the previous line
50
- // rl.clearLine(process.stdout, 0); // Clear the current line
51
- // // console.log('Asnwer: ', answer);
52
99
 
100
+ // // Incorrect usage
101
+ // // container.callMethod('nonExistentMethod'); // Throws error: Method nonExistentMethod is not available
53
102
 
54
- // })()
@@ -1,84 +0,0 @@
1
- import { A_Component } from "@adaas/a-concept/global/A-Component/A-Component.class";
2
- import {
3
- A_TYPES__A_StageDecoratorConfig,
4
- A_TYPES__A_StageDecoratorDescriptor,
5
- } from "./A-Stage.decorator.types";
6
- import { A_TYPES__ComponentMetaKey } from "@adaas/a-concept/global/A-Component/A-Component.types";
7
- import { A_Context } from "@adaas/a-concept/global/A-Context/A-Context.class";
8
- import { A_Container } from "@adaas/a-concept/global/A-Container/A-Container.class";
9
- import { A_TYPES__ContainerMetaKey } from "@adaas/a-concept/global/A-Container/A-Container.types";
10
- import { A_TYPES__ConceptStage } from "@adaas/a-concept/global/A-Concept/A_Concept.types";
11
- import { A_ContainerMeta } from "@adaas/a-concept/global/A-Container/A-Container.meta";
12
- import { A_ComponentMeta } from "@adaas/a-concept/global/A-Component/A-Component.meta";
13
-
14
-
15
-
16
-
17
- /**
18
- * A_Stage Decorator uses to extend basic A-Concept Stage methods inside Containers.
19
- *
20
- * Using this decorator you can define extend a logic and sequence of the Container Stage methods execution.
21
- *
22
- * @param params
23
- * @returns
24
- */
25
- export function A_Stage(
26
- method: A_TYPES__ConceptStage
27
- ) {
28
-
29
-
30
- return function A_Stage(
31
- config: Partial<A_TYPES__A_StageDecoratorConfig> = {}
32
- ) {
33
- return function (
34
- target: A_Container<any> | A_Component,
35
- propertyKey: string,
36
- descriptor: A_TYPES__A_StageDecoratorDescriptor
37
- ) {
38
-
39
- const meta: A_ContainerMeta | A_ComponentMeta = A_Context.meta(target as any);
40
-
41
- let metaKey;
42
-
43
- const StageKey = `CONCEPT_STAGE::${method}`
44
-
45
- switch (true) {
46
- case target instanceof A_Container:
47
- metaKey = A_TYPES__ContainerMetaKey.STAGES
48
- break;
49
- case target instanceof A_Component:
50
- metaKey = A_TYPES__ComponentMetaKey.STAGES
51
- break;
52
- default:
53
- throw new Error(`A-Feature cannot be defined on the ${target} level`);
54
- }
55
-
56
- // Get the existed metadata or create a new one
57
- const existedMeta = meta.get(metaKey)
58
- || new Map();
59
-
60
- // Set the metadata of the method to define a custom Stage with name
61
-
62
- const existedMetaValue = existedMeta.get(StageKey) || [];
63
-
64
- // Add the new method to the metadata
65
- existedMetaValue.push({
66
- name: StageKey,
67
- handler: propertyKey,
68
- });
69
-
70
- // Set the metadata of the method to define a custom Feature with name
71
- existedMeta.set(StageKey, existedMetaValue);
72
-
73
-
74
- // Update the metadata of the container with the new Stage definition
75
- A_Context
76
- .meta(target as any)
77
- .set(
78
- metaKey,
79
- existedMeta
80
- );
81
-
82
- };
83
- }
84
- }