@adaas/a-concept 0.0.39 → 0.0.41
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.
- package/dist/src/decorators/A-Feature/A-Feature-Define.decorator.js +1 -0
- package/dist/src/decorators/A-Feature/A-Feature-Define.decorator.js.map +1 -1
- package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.js +10 -0
- package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.js.map +1 -1
- package/dist/src/decorators/A-Feature/A-Feature.decorator.types.d.ts +1 -0
- package/dist/src/global/A-Abstraction/A-Abstraction.class.d.ts +8 -2
- package/dist/src/global/A-Abstraction/A-Abstraction.class.js +5 -1
- package/dist/src/global/A-Abstraction/A-Abstraction.class.js.map +1 -1
- package/dist/src/global/A-Abstraction/A-Abstraction.types.d.ts +13 -4
- package/dist/src/global/A-Abstraction/A-Abstraction.types.js.map +1 -1
- package/dist/src/global/A-Component/A-Component.class.d.ts +11 -4
- package/dist/src/global/A-Component/A-Component.class.js +13 -4
- package/dist/src/global/A-Component/A-Component.class.js.map +1 -1
- package/dist/src/global/A-Concept/A_Concept.class.d.ts +11 -10
- package/dist/src/global/A-Concept/A_Concept.class.js +24 -20
- package/dist/src/global/A-Concept/A_Concept.class.js.map +1 -1
- package/dist/src/global/A-Concept/A_Concept.meta.d.ts +4 -4
- package/dist/src/global/A-Concept/A_Concept.meta.js +14 -6
- package/dist/src/global/A-Concept/A_Concept.meta.js.map +1 -1
- package/dist/src/global/A-Container/A-Container.class.d.ts +3 -4
- package/dist/src/global/A-Container/A-Container.class.js +8 -8
- package/dist/src/global/A-Container/A-Container.class.js.map +1 -1
- package/dist/src/global/A-Context/A-Context.class.d.ts +6 -11
- package/dist/src/global/A-Context/A-Context.class.js +32 -32
- package/dist/src/global/A-Context/A-Context.class.js.map +1 -1
- package/dist/src/global/A-Entity/A-Entity.class.d.ts +2 -2
- package/dist/src/global/A-Entity/A-Entity.class.js +4 -4
- package/dist/src/global/A-Entity/A-Entity.class.js.map +1 -1
- package/dist/src/global/A-Feature/A-Feature.class.d.ts +10 -8
- package/dist/src/global/A-Feature/A-Feature.class.js +20 -28
- package/dist/src/global/A-Feature/A-Feature.class.js.map +1 -1
- package/dist/src/global/A-Feature/A-Feature.types.d.ts +13 -2
- package/dist/src/global/A-Feature/A-Feature.types.js.map +1 -1
- package/dist/src/global/A-Meta/A-Meta.class.d.ts +6 -0
- package/dist/src/global/A-Meta/A-Meta.class.js +8 -0
- package/dist/src/global/A-Meta/A-Meta.class.js.map +1 -1
- package/dist/src/global/A-Scope/A-Scope.class.d.ts +14 -0
- package/dist/src/global/A-Scope/A-Scope.class.js +48 -5
- package/dist/src/global/A-Scope/A-Scope.class.js.map +1 -1
- package/dist/src/global/A-Stage/A-Stage.class.d.ts +3 -2
- package/dist/src/global/A-Stage/A-Stage.class.js +18 -5
- package/dist/src/global/A-Stage/A-Stage.class.js.map +1 -1
- package/dist/src/global/A-Stage/A-Stage.error.d.ts +3 -0
- package/dist/src/global/A-Stage/A-Stage.error.js +8 -0
- package/dist/src/global/A-Stage/A-Stage.error.js.map +1 -0
- package/dist/src/helpers/StepsManager.class.d.ts +17 -0
- package/dist/src/helpers/StepsManager.class.js +41 -3
- package/dist/src/helpers/StepsManager.class.js.map +1 -1
- package/examples/simple/components/A.component.ts +12 -3
- package/examples/simple/concept.ts +10 -4
- package/examples/simple/containers/Main.container.ts +6 -5
- package/examples/simple-http-server/concept.ts +1 -0
- package/examples/simple-http-server/containers/http-server.container.ts +4 -2
- package/package.json +1 -1
- package/src/decorators/A-Feature/A-Feature-Define.decorator.ts +1 -0
- package/src/decorators/A-Feature/A-Feature-Extend.decorator.ts +17 -0
- package/src/decorators/A-Feature/A-Feature.decorator.types.ts +1 -0
- package/src/global/A-Abstraction/A-Abstraction.class.ts +11 -3
- package/src/global/A-Abstraction/A-Abstraction.types.ts +13 -6
- package/src/global/A-Component/A-Component.class.ts +12 -7
- package/src/global/A-Concept/A_Concept.class.ts +29 -21
- package/src/global/A-Concept/A_Concept.meta.ts +8 -15
- package/src/global/A-Container/A-Container.class.ts +13 -11
- package/src/global/A-Context/A-Context.class.ts +37 -99
- package/src/global/A-Entity/A-Entity.class.ts +5 -4
- package/src/global/A-Feature/A-Feature.class.ts +40 -36
- package/src/global/A-Feature/A-Feature.types.ts +14 -2
- package/src/global/A-Meta/A-Meta.class.ts +10 -0
- package/src/global/A-Scope/A-Scope.class.ts +61 -5
- package/src/global/A-Stage/A-Stage.class.ts +34 -11
- package/src/global/A-Stage/A-Stage.error.ts +9 -0
- package/src/helpers/StepsManager.class.ts +63 -3
|
@@ -11,8 +11,9 @@ import { A_Scope } from "../A-Scope/A-Scope.class";
|
|
|
11
11
|
* A-Stage is a common object that uses to simplify logic and re-use of A-Feature internals for better composition.
|
|
12
12
|
*/
|
|
13
13
|
export declare class A_Stage {
|
|
14
|
-
|
|
15
|
-
private
|
|
14
|
+
readonly name: string;
|
|
15
|
+
private readonly feature;
|
|
16
|
+
private readonly _steps;
|
|
16
17
|
constructor(feature: A_Feature, _steps?: A_TYPES__A_StageStep[]);
|
|
17
18
|
status: A_TYPES__A_Stage_Status;
|
|
18
19
|
/**
|
|
@@ -16,6 +16,7 @@ const A_Feature_class_1 = require("../A-Feature/A-Feature.class");
|
|
|
16
16
|
const A_Stage_types_1 = require("./A-Stage.types");
|
|
17
17
|
const A_Container_class_1 = require("../A-Container/A-Container.class");
|
|
18
18
|
const A_Scope_class_1 = require("../A-Scope/A-Scope.class");
|
|
19
|
+
const A_Stage_error_1 = require("./A-Stage.error");
|
|
19
20
|
/**
|
|
20
21
|
* A_Stage is a set of A_Functions within A_Feature that should be run in a specific order.
|
|
21
22
|
* Each stage may contain one or more functions.
|
|
@@ -25,9 +26,17 @@ const A_Scope_class_1 = require("../A-Scope/A-Scope.class");
|
|
|
25
26
|
*/
|
|
26
27
|
class A_Stage {
|
|
27
28
|
constructor(feature, _steps = []) {
|
|
29
|
+
this.name = 'A_Stage';
|
|
30
|
+
this.status = A_Stage_types_1.A_TYPES__A_Stage_Status.INITIALIZED;
|
|
28
31
|
this.feature = feature;
|
|
29
32
|
this._steps = _steps;
|
|
30
|
-
this.
|
|
33
|
+
this.name = `${this.feature.name}::a-stage:[sync:${this
|
|
34
|
+
.syncSteps
|
|
35
|
+
.map(s => s.component.name + '.' + s.handler)
|
|
36
|
+
.join(' -> ')}][async:${this
|
|
37
|
+
.asyncSteps
|
|
38
|
+
.map(s => s.component.name + '.' + s.handler)
|
|
39
|
+
.join(' -> ')}]`;
|
|
31
40
|
}
|
|
32
41
|
get before() {
|
|
33
42
|
return this._steps.reduce((acc, step) => ([
|
|
@@ -68,7 +77,6 @@ class A_Stage {
|
|
|
68
77
|
if (a_utils_1.A_CommonHelper.isInheritedFrom(arg.target, A_Feature_class_1.A_Feature))
|
|
69
78
|
return this.feature;
|
|
70
79
|
return scope
|
|
71
|
-
.merge(A_Context_class_1.A_Context.scope(this.feature))
|
|
72
80
|
.resolve(arg.target);
|
|
73
81
|
})));
|
|
74
82
|
});
|
|
@@ -94,7 +102,7 @@ class A_Stage {
|
|
|
94
102
|
// TODO: probably would be better to do it another way. let's think about it
|
|
95
103
|
const instance = component instanceof A_Container_class_1.A_Container
|
|
96
104
|
? component
|
|
97
|
-
:
|
|
105
|
+
: this.feature.Scope.resolve(component);
|
|
98
106
|
if (!instance)
|
|
99
107
|
throw new Error(`Unable to resolve component ${component.name}`);
|
|
100
108
|
if (!instance[handler])
|
|
@@ -111,7 +119,7 @@ class A_Stage {
|
|
|
111
119
|
return __awaiter(this, void 0, void 0, function* () {
|
|
112
120
|
const instance = yield this.getStepInstance(step);
|
|
113
121
|
const callArgs = yield this.getStepArgs(step, scope);
|
|
114
|
-
return instance[step.handler](...callArgs);
|
|
122
|
+
return yield instance[step.handler](...callArgs);
|
|
115
123
|
});
|
|
116
124
|
}
|
|
117
125
|
/**
|
|
@@ -125,6 +133,8 @@ class A_Stage {
|
|
|
125
133
|
* Scope to be used to resolve the steps dependencies
|
|
126
134
|
*/
|
|
127
135
|
scope = new A_Scope_class_1.A_Scope({}, {}), params) {
|
|
136
|
+
scope = scope.inherit(this.feature.Scope);
|
|
137
|
+
console.log(' -> Init stage processing:', this.name);
|
|
128
138
|
if (!this.processed)
|
|
129
139
|
this.processed = new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
130
140
|
try {
|
|
@@ -143,7 +153,9 @@ class A_Stage {
|
|
|
143
153
|
new Promise((r, j) => __awaiter(this, void 0, void 0, function* () {
|
|
144
154
|
try {
|
|
145
155
|
for (const step of syncSteps) {
|
|
156
|
+
console.log(' - -> Processing stage step:', step.handler, ' with Regexp: ', step.name);
|
|
146
157
|
yield this.callStepHandler(step, scope);
|
|
158
|
+
console.log(' - -> Finished processing stage step:', step.handler);
|
|
147
159
|
}
|
|
148
160
|
return r();
|
|
149
161
|
}
|
|
@@ -153,6 +165,7 @@ class A_Stage {
|
|
|
153
165
|
}))
|
|
154
166
|
]);
|
|
155
167
|
this.completed();
|
|
168
|
+
console.log(' -> Finished stage processing:', this.name);
|
|
156
169
|
return resolve();
|
|
157
170
|
}
|
|
158
171
|
catch (error) {
|
|
@@ -180,7 +193,7 @@ class A_Stage {
|
|
|
180
193
|
}
|
|
181
194
|
failed(error) {
|
|
182
195
|
this.status = A_Stage_types_1.A_TYPES__A_Stage_Status.FAILED;
|
|
183
|
-
this.feature.failed(error);
|
|
196
|
+
this.feature.failed(new A_Stage_error_1.A_StageError(error));
|
|
184
197
|
}
|
|
185
198
|
// ==========================================
|
|
186
199
|
// ============ Serialization ===============
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Stage.class.js","sourceRoot":"","sources":["../../../../src/global/A-Stage/A-Stage.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAyD;AACzD,kEAAyD;AACzD,kEAAyD;AACzD,mDAAkJ;AAClJ,wEAA+D;
|
|
1
|
+
{"version":3,"file":"A-Stage.class.js","sourceRoot":"","sources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
3
|
+
exports.A_StageError = void 0;
|
|
4
|
+
const a_utils_1 = require("@adaas/a-utils");
|
|
5
|
+
class A_StageError extends a_utils_1.A_Error {
|
|
6
|
+
}
|
|
7
|
+
exports.A_StageError = A_StageError;
|
|
8
|
+
//# sourceMappingURL=A-Stage.error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A-Stage.error.js","sourceRoot":"","sources":["../../../../src/global/A-Stage/A-Stage.error.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AAGzC,MAAa,YAAa,SAAQ,iBAAO;CAKxC;AALD,oCAKC"}
|
|
@@ -14,3 +14,20 @@ export declare class StepsManager {
|
|
|
14
14
|
private visit;
|
|
15
15
|
toStages(feature: A_Feature): Array<A_Stage>;
|
|
16
16
|
}
|
|
17
|
+
export declare class A_TmpStage {
|
|
18
|
+
readonly name: string;
|
|
19
|
+
private readonly _steps;
|
|
20
|
+
constructor(_steps?: A_TYPES__A_StageStep[]);
|
|
21
|
+
get before(): string[];
|
|
22
|
+
get after(): string[];
|
|
23
|
+
get steps(): A_TYPES__A_StageStep[];
|
|
24
|
+
get asyncSteps(): A_TYPES__A_StageStep[];
|
|
25
|
+
get syncSteps(): A_TYPES__A_StageStep[];
|
|
26
|
+
/**
|
|
27
|
+
* Adds a step to the stage
|
|
28
|
+
*
|
|
29
|
+
* @param step
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
add(step: A_TYPES__A_StageStep): this;
|
|
33
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StepsManager = void 0;
|
|
3
|
+
exports.A_TmpStage = exports.StepsManager = void 0;
|
|
4
4
|
const A_Stage_class_1 = require("../global/A-Stage/A-Stage.class");
|
|
5
5
|
class StepsManager {
|
|
6
6
|
constructor(entities) {
|
|
@@ -76,13 +76,51 @@ class StepsManager {
|
|
|
76
76
|
&& step.before.every(before => stage.after.includes(before));
|
|
77
77
|
});
|
|
78
78
|
if (!stage) {
|
|
79
|
-
stage = new
|
|
79
|
+
stage = new A_TmpStage();
|
|
80
80
|
stages.push(stage);
|
|
81
81
|
}
|
|
82
82
|
stage.add(step);
|
|
83
83
|
});
|
|
84
|
-
return stages;
|
|
84
|
+
return stages.map(stage => new A_Stage_class_1.A_Stage(feature, stage.steps));
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
exports.StepsManager = StepsManager;
|
|
88
|
+
class A_TmpStage {
|
|
89
|
+
constructor(_steps = []) {
|
|
90
|
+
this.name = 'A_TmpStage';
|
|
91
|
+
this._steps = _steps;
|
|
92
|
+
}
|
|
93
|
+
get before() {
|
|
94
|
+
return this._steps.reduce((acc, step) => ([
|
|
95
|
+
...acc,
|
|
96
|
+
...step.before
|
|
97
|
+
]), []);
|
|
98
|
+
}
|
|
99
|
+
get after() {
|
|
100
|
+
return this._steps.reduce((acc, step) => ([
|
|
101
|
+
...acc,
|
|
102
|
+
...step.after
|
|
103
|
+
]), []);
|
|
104
|
+
}
|
|
105
|
+
get steps() {
|
|
106
|
+
return this._steps;
|
|
107
|
+
}
|
|
108
|
+
get asyncSteps() {
|
|
109
|
+
return this._steps.filter(step => step.behavior === 'async');
|
|
110
|
+
}
|
|
111
|
+
get syncSteps() {
|
|
112
|
+
return this._steps.filter(step => step.behavior === 'sync');
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Adds a step to the stage
|
|
116
|
+
*
|
|
117
|
+
* @param step
|
|
118
|
+
* @returns
|
|
119
|
+
*/
|
|
120
|
+
add(step) {
|
|
121
|
+
this._steps.push(step);
|
|
122
|
+
return this;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
exports.A_TmpStage = A_TmpStage;
|
|
88
126
|
//# sourceMappingURL=StepsManager.class.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepsManager.class.js","sourceRoot":"","sources":["../../../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@ export class ComponentA extends A_Component {
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
@A_Feature.Extend()
|
|
17
|
+
@A_Feature.Define()
|
|
17
18
|
async method_A(
|
|
18
19
|
@A_Inject(ContextFragmentA) fragmentA: ContextFragmentA,
|
|
19
20
|
@A_Inject(A_Logger) logger: A_Logger,
|
|
20
|
-
|
|
21
21
|
) {
|
|
22
22
|
logger.log('red', 'Component A -> method_A()');
|
|
23
23
|
fragmentA.decrement();
|
|
@@ -31,9 +31,18 @@ export class ComponentA extends A_Component {
|
|
|
31
31
|
async someMethod(
|
|
32
32
|
@A_Inject(ContextFragmentB) fragmentB: ContextFragmentB
|
|
33
33
|
) {
|
|
34
|
-
|
|
34
|
+
// throw new Error('Some error occurred');
|
|
35
|
+
|
|
36
|
+
return new Promise<void>((resolve, reject) => {
|
|
37
|
+
setTimeout(() => {
|
|
38
|
+
console.log('Component A -> method_A() -> someMethod()');
|
|
39
|
+
|
|
40
|
+
fragmentB.increment();
|
|
41
|
+
console.log('awaited after 5 sec');
|
|
42
|
+
resolve();
|
|
35
43
|
|
|
36
|
-
|
|
44
|
+
}, 5000);
|
|
45
|
+
});
|
|
37
46
|
}
|
|
38
47
|
|
|
39
48
|
|
|
@@ -48,16 +48,22 @@ console.log('Simple concept loaded', A_Concept);
|
|
|
48
48
|
]
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
await concept.
|
|
51
|
+
// await concept.load();
|
|
52
|
+
// await concept.start();
|
|
52
53
|
|
|
53
54
|
|
|
54
|
-
await main.method_B()
|
|
55
|
+
// await main.method_B()
|
|
55
56
|
|
|
56
57
|
|
|
57
|
-
await main.method_C();
|
|
58
|
+
// await main.method_C();
|
|
58
59
|
|
|
60
|
+
try {
|
|
61
|
+
await main.call('method_A')
|
|
62
|
+
|
|
63
|
+
} catch (error) {
|
|
64
|
+
console.error('Error occurred:', error);
|
|
65
|
+
}
|
|
59
66
|
|
|
60
|
-
await main.call('method_A')
|
|
61
67
|
|
|
62
68
|
|
|
63
69
|
})();
|
|
@@ -36,12 +36,13 @@ export class MainContainer extends A_Container {
|
|
|
36
36
|
@A_Feature.Define()
|
|
37
37
|
async method_A() {
|
|
38
38
|
console.log('Method A');
|
|
39
|
-
await this.call('method_A', {
|
|
39
|
+
await this.call('method_A', new A_Scope({
|
|
40
|
+
name: `method-A::${Date.now()}`,
|
|
40
41
|
fragments: [
|
|
41
42
|
new ContextFragmentA(),
|
|
42
43
|
new ContextFragmentB()
|
|
43
44
|
]
|
|
44
|
-
});
|
|
45
|
+
}));
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
|
|
@@ -62,10 +63,10 @@ export class MainContainer extends A_Container {
|
|
|
62
63
|
const logger = this.Scope.resolve(A_Logger);
|
|
63
64
|
|
|
64
65
|
// or you can manually call the feature
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
const feature = A_Context.feature(this, 'method_B', new A_Scope({
|
|
67
|
+
name: `method-B::${Date.now()}`,
|
|
67
68
|
fragments: [new ContextFragmentA(), new ContextFragmentB()]
|
|
68
|
-
});
|
|
69
|
+
}));
|
|
69
70
|
|
|
70
71
|
for (const stage of feature) {
|
|
71
72
|
logger.log('Manual Loop Execution Step', feature.stage);
|
|
@@ -5,6 +5,7 @@ import { A_Concept } from "@adaas/a-concept/global/A-Concept/A_Concept.class";
|
|
|
5
5
|
import { A_Config } from "@adaas/a-concept/base/A-Config/A-Config.context";
|
|
6
6
|
import { A_Feature } from "@adaas/a-concept/global/A-Feature/A-Feature.class";
|
|
7
7
|
import { HTTPRequest } from "../contexts/http-request.context";
|
|
8
|
+
import { A_Scope } from "@adaas/a-concept/global/A-Scope/A-Scope.class";
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
|
|
@@ -42,11 +43,12 @@ export class HttpServer extends A_Container {
|
|
|
42
43
|
req: IncomingMessage,
|
|
43
44
|
res: ServerResponse
|
|
44
45
|
) {
|
|
45
|
-
return await this.call('onRequest', {
|
|
46
|
+
return await this.call('onRequest', new A_Scope({
|
|
47
|
+
name: `http-request::${Date.now()}`,
|
|
46
48
|
fragments: [
|
|
47
49
|
new HTTPRequest(req, res)
|
|
48
50
|
]
|
|
49
|
-
});
|
|
51
|
+
}));
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaas/a-concept",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.41",
|
|
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",
|
|
@@ -77,6 +77,7 @@ export function A_Feature_Define(
|
|
|
77
77
|
existedMeta.set(propertyKey, {
|
|
78
78
|
name: `${target.constructor.name}.${handlerName}`,
|
|
79
79
|
handler: handlerName,
|
|
80
|
+
invoke: invoke,
|
|
80
81
|
template: config.template && config.template.length ? config.template.map(
|
|
81
82
|
item => ({
|
|
82
83
|
...item,
|
|
@@ -80,6 +80,12 @@ export function A_Feature_Extend(
|
|
|
80
80
|
targetRegexp = new RegExp(`^.*\\.${propertyKey}$`);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
const existedDefinitions = A_Context
|
|
84
|
+
.meta(target)
|
|
85
|
+
.get(A_TYPES__ComponentMetaKey.FEATURES);
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
83
89
|
// Get the existed metadata or create a new one
|
|
84
90
|
const existedMeta = A_Context
|
|
85
91
|
.meta(target)
|
|
@@ -87,6 +93,17 @@ export function A_Feature_Extend(
|
|
|
87
93
|
|| new A_Meta();
|
|
88
94
|
|
|
89
95
|
|
|
96
|
+
if (existedDefinitions
|
|
97
|
+
&& existedDefinitions.size()
|
|
98
|
+
&& existedDefinitions.has(propertyKey)
|
|
99
|
+
&& existedDefinitions.get(propertyKey)!.invoke
|
|
100
|
+
) {
|
|
101
|
+
|
|
102
|
+
throw new Error(`A-Feature-Extend cannot be used on the method "${propertyKey}" because it is already defined as a Feature with "invoke" set to true.
|
|
103
|
+
Please remove the A-Feature-Extend decorator or set "invoke" to false in the A-Feature decorator.`);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
|
|
90
107
|
const existedMetaValue = existedMeta.get(targetRegexp.source) || [];
|
|
91
108
|
|
|
92
109
|
// Add the new method to the metadata
|
|
@@ -39,6 +39,7 @@ export type A_TYPES__A_FeatureTemplateItem = A_TYPES__Required<Partial<A_TYPES__
|
|
|
39
39
|
export type A_TYPES__A_DefineDecorator_Meta = {
|
|
40
40
|
name: string,
|
|
41
41
|
handler: string,
|
|
42
|
+
invoke: boolean,
|
|
42
43
|
channel: Array<typeof A_Channel>
|
|
43
44
|
template: Array<A_TYPES__A_StageStep>
|
|
44
45
|
}
|
|
@@ -2,6 +2,7 @@ import { A_Abstraction_Extend } from "@adaas/a-concept/decorators/A-Abstraction/
|
|
|
2
2
|
import { A_Feature } from "../A-Feature/A-Feature.class";
|
|
3
3
|
import { A_TYPES__A_AbstractionConstructor, A_TYPES__AbstractionState } from "./A-Abstraction.types";
|
|
4
4
|
import { A_Error, A_TYPES__Required } from "@adaas/a-utils";
|
|
5
|
+
import { A_Scope } from "../A-Scope/A-Scope.class";
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
export class A_Abstraction {
|
|
@@ -15,6 +16,7 @@ export class A_Abstraction {
|
|
|
15
16
|
error?: A_Error
|
|
16
17
|
|
|
17
18
|
|
|
19
|
+
readonly Scope!: A_Scope;
|
|
18
20
|
|
|
19
21
|
/**
|
|
20
22
|
* Define a new A-Abstraction
|
|
@@ -24,9 +26,14 @@ export class A_Abstraction {
|
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
constructor(
|
|
30
|
+
/**
|
|
31
|
+
* Parameters to define the A-Abstraction
|
|
32
|
+
*/
|
|
33
|
+
params: A_TYPES__A_AbstractionConstructor
|
|
34
|
+
) {
|
|
29
35
|
this.name = params.name;
|
|
36
|
+
|
|
30
37
|
this.features = params.features.map(def => new A_Feature(def));
|
|
31
38
|
|
|
32
39
|
this._current = this.features[0];
|
|
@@ -37,6 +44,7 @@ export class A_Abstraction {
|
|
|
37
44
|
return this._current;
|
|
38
45
|
}
|
|
39
46
|
|
|
47
|
+
|
|
40
48
|
[Symbol.iterator](): Iterator<A_Feature, any> {
|
|
41
49
|
return {
|
|
42
50
|
// Custom next method
|
|
@@ -110,7 +118,7 @@ export class A_Abstraction {
|
|
|
110
118
|
|
|
111
119
|
|
|
112
120
|
async process() {
|
|
113
|
-
if (this.isDone())
|
|
121
|
+
if (this.isDone())
|
|
114
122
|
return;
|
|
115
123
|
try {
|
|
116
124
|
this.state = A_TYPES__AbstractionState.PROCESSING;
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import { A_TYPES__Required } from "@adaas/a-utils";
|
|
2
|
-
import { A_Container } from "../A-Container/A-Container.class";
|
|
3
1
|
import { A_TYPES__FeatureConstructor } from "../A-Feature/A-Feature.types";
|
|
4
|
-
import {
|
|
5
|
-
import { A_TYPES__A_StageStep } from "../A-Stage/A-Stage.types";
|
|
2
|
+
import { A_Scope } from "../A-Scope/A-Scope.class";
|
|
6
3
|
|
|
7
4
|
|
|
8
5
|
|
|
9
6
|
export type A_TYPES__A_AbstractionConstructor = {
|
|
7
|
+
/**
|
|
8
|
+
* Name of the A-Abstraction
|
|
9
|
+
*/
|
|
10
10
|
name: string,
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Features that compose the A-Abstraction
|
|
13
|
+
*/
|
|
14
|
+
features: Array<A_TYPES__FeatureConstructor>
|
|
15
|
+
/**
|
|
16
|
+
* Scope in which the A-Abstraction will be executed
|
|
17
|
+
*/
|
|
18
|
+
scope: A_Scope
|
|
19
|
+
}
|
|
13
20
|
|
|
14
21
|
|
|
15
22
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { A_Context } from "../A-Context/A-Context.class";
|
|
2
2
|
import { A_TYPES__ComponentConstructor } from "./A-Component.types";
|
|
3
3
|
import { A_TYPES__FeatureCallParams } from "../A-Feature/A-Feature.types";
|
|
4
|
+
import { A_Scope } from "../A-Scope/A-Scope.class";
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
|
|
@@ -9,24 +10,28 @@ import { A_TYPES__FeatureCallParams } from "../A-Feature/A-Feature.types";
|
|
|
9
10
|
*
|
|
10
11
|
*/
|
|
11
12
|
export class A_Component {
|
|
12
|
-
constructor(
|
|
13
|
-
params?: Partial<A_TYPES__ComponentConstructor<any>>
|
|
14
|
-
) {
|
|
13
|
+
constructor() {
|
|
15
14
|
console.log('A-Component instance created', this);
|
|
16
15
|
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
|
|
20
19
|
async call(
|
|
20
|
+
/**
|
|
21
|
+
* Name of the feature to call
|
|
22
|
+
*/
|
|
21
23
|
feature: string,
|
|
22
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Scope in which the feature will be executed
|
|
26
|
+
*/
|
|
27
|
+
scope?: A_Scope,
|
|
23
28
|
) {
|
|
24
|
-
|
|
29
|
+
scope = scope ? scope.inherit(A_Context.scope(this)) : A_Context.scope(this);
|
|
30
|
+
|
|
31
|
+
const newFeature = A_Context.feature(this, feature, scope);
|
|
25
32
|
|
|
26
33
|
return await newFeature.process();
|
|
27
34
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
|