@adaas/a-concept 0.0.37 → 0.0.38
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/global/A-Stage/A-Stage.class.d.ts +13 -6
- package/dist/src/global/A-Stage/A-Stage.class.js +30 -17
- package/dist/src/global/A-Stage/A-Stage.class.js.map +1 -1
- package/dist/src/global/A-Stage/A-Stage.types.d.ts +1 -2
- package/package.json +1 -1
- package/src/global/A-Stage/A-Stage.class.ts +32 -15
- package/src/global/A-Stage/A-Stage.types.ts +2 -2
|
@@ -12,8 +12,8 @@ import { A_Scope } from "../A-Scope/A-Scope.class";
|
|
|
12
12
|
*/
|
|
13
13
|
export declare class A_Stage {
|
|
14
14
|
private feature;
|
|
15
|
-
private
|
|
16
|
-
constructor(feature: A_Feature,
|
|
15
|
+
private _steps;
|
|
16
|
+
constructor(feature: A_Feature, _steps?: A_TYPES__A_StageStep[]);
|
|
17
17
|
status: A_TYPES__A_Stage_Status;
|
|
18
18
|
/**
|
|
19
19
|
* Promise that will be resolved when the stage is Processed
|
|
@@ -21,13 +21,16 @@ export declare class A_Stage {
|
|
|
21
21
|
processed: Promise<void> | undefined;
|
|
22
22
|
get before(): string[];
|
|
23
23
|
get after(): string[];
|
|
24
|
+
get steps(): A_TYPES__A_StageStep[];
|
|
25
|
+
get asyncSteps(): A_TYPES__A_StageStep[];
|
|
26
|
+
get syncSteps(): A_TYPES__A_StageStep[];
|
|
24
27
|
/**
|
|
25
28
|
* Resolves the arguments of the step
|
|
26
29
|
*
|
|
27
30
|
* @param step
|
|
28
31
|
* @returns
|
|
29
32
|
*/
|
|
30
|
-
protected getStepArgs(step: A_TYPES__A_StageStep, scope
|
|
33
|
+
protected getStepArgs(step: A_TYPES__A_StageStep, scope: A_Scope): Promise<(import("../A-Fragment/A-Fragment.class").A_Fragment | import("../A-Component/A-Component.class").A_Component | A_Container | import("../A-Entity/A-Entity.class").A_Entity<any, import("../A-Entity/A-Entity.types").A_TYPES__Entity_JSON> | A_Scope | A_Feature)[]>;
|
|
31
34
|
/**
|
|
32
35
|
* Adds a step to the stage
|
|
33
36
|
*
|
|
@@ -48,13 +51,17 @@ export declare class A_Stage {
|
|
|
48
51
|
* @param step
|
|
49
52
|
* @returns
|
|
50
53
|
*/
|
|
51
|
-
protected callStepHandler(step: A_TYPES__A_StageStep, scope
|
|
54
|
+
protected callStepHandler(step: A_TYPES__A_StageStep, scope: A_Scope): Promise<any>;
|
|
52
55
|
/**
|
|
53
|
-
* Runs async all the
|
|
56
|
+
* Runs async all the _steps of the stage
|
|
54
57
|
*
|
|
55
58
|
* @returns
|
|
56
59
|
*/
|
|
57
|
-
process(
|
|
60
|
+
process(
|
|
61
|
+
/**
|
|
62
|
+
* Scope to be used to resolve the steps dependencies
|
|
63
|
+
*/
|
|
64
|
+
scope?: A_Scope, params?: Partial<A_TYPES__A_StageStepProcessingExtraParams>): Promise<void>;
|
|
58
65
|
/**
|
|
59
66
|
* Skips the stage
|
|
60
67
|
*
|
|
@@ -24,31 +24,40 @@ const A_Scope_class_1 = require("../A-Scope/A-Scope.class");
|
|
|
24
24
|
* A-Stage is a common object that uses to simplify logic and re-use of A-Feature internals for better composition.
|
|
25
25
|
*/
|
|
26
26
|
class A_Stage {
|
|
27
|
-
constructor(feature,
|
|
27
|
+
constructor(feature, _steps = []) {
|
|
28
28
|
this.feature = feature;
|
|
29
|
-
this.
|
|
29
|
+
this._steps = _steps;
|
|
30
30
|
this.status = A_Stage_types_1.A_TYPES__A_Stage_Status.INITIALIZED;
|
|
31
31
|
}
|
|
32
32
|
get before() {
|
|
33
|
-
return this.
|
|
33
|
+
return this._steps.reduce((acc, step) => ([
|
|
34
34
|
...acc,
|
|
35
35
|
...step.before
|
|
36
36
|
]), []);
|
|
37
37
|
}
|
|
38
38
|
get after() {
|
|
39
|
-
return this.
|
|
39
|
+
return this._steps.reduce((acc, step) => ([
|
|
40
40
|
...acc,
|
|
41
41
|
...step.after
|
|
42
42
|
]), []);
|
|
43
43
|
}
|
|
44
|
+
get steps() {
|
|
45
|
+
return this._steps;
|
|
46
|
+
}
|
|
47
|
+
get asyncSteps() {
|
|
48
|
+
return this._steps.filter(step => step.behavior === 'async');
|
|
49
|
+
}
|
|
50
|
+
get syncSteps() {
|
|
51
|
+
return this._steps.filter(step => step.behavior === 'sync');
|
|
52
|
+
}
|
|
44
53
|
/**
|
|
45
54
|
* Resolves the arguments of the step
|
|
46
55
|
*
|
|
47
56
|
* @param step
|
|
48
57
|
* @returns
|
|
49
58
|
*/
|
|
50
|
-
getStepArgs(
|
|
51
|
-
return __awaiter(this,
|
|
59
|
+
getStepArgs(step, scope) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
61
|
return Promise
|
|
53
62
|
.all(A_Context_class_1.A_Context
|
|
54
63
|
.meta(step.component instanceof A_Container_class_1.A_Container
|
|
@@ -71,7 +80,7 @@ class A_Stage {
|
|
|
71
80
|
* @returns
|
|
72
81
|
*/
|
|
73
82
|
add(step) {
|
|
74
|
-
this.
|
|
83
|
+
this._steps.push(step);
|
|
75
84
|
return this;
|
|
76
85
|
}
|
|
77
86
|
/**
|
|
@@ -106,12 +115,16 @@ class A_Stage {
|
|
|
106
115
|
});
|
|
107
116
|
}
|
|
108
117
|
/**
|
|
109
|
-
* Runs async all the
|
|
118
|
+
* Runs async all the _steps of the stage
|
|
110
119
|
*
|
|
111
120
|
* @returns
|
|
112
121
|
*/
|
|
113
|
-
process(
|
|
114
|
-
return __awaiter(this,
|
|
122
|
+
process() {
|
|
123
|
+
return __awaiter(this, arguments, void 0, function* (
|
|
124
|
+
/**
|
|
125
|
+
* Scope to be used to resolve the steps dependencies
|
|
126
|
+
*/
|
|
127
|
+
scope = new A_Scope_class_1.A_Scope({}, {}), params) {
|
|
115
128
|
if (!this.processed)
|
|
116
129
|
this.processed = new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
117
130
|
try {
|
|
@@ -119,18 +132,18 @@ class A_Stage {
|
|
|
119
132
|
if ((params === null || params === void 0 ? void 0 : params.steps) && params.steps.length) {
|
|
120
133
|
params.steps.forEach(step => this.add(step));
|
|
121
134
|
}
|
|
122
|
-
const syncSteps = this.
|
|
123
|
-
const asyncSteps = this.
|
|
124
|
-
// Run sync
|
|
135
|
+
const syncSteps = this.syncSteps.filter((params === null || params === void 0 ? void 0 : params.filter) || (() => true));
|
|
136
|
+
const asyncSteps = this.asyncSteps.filter((params === null || params === void 0 ? void 0 : params.filter) || (() => true));
|
|
137
|
+
// Run sync _steps
|
|
125
138
|
yield Promise
|
|
126
139
|
.all([
|
|
127
|
-
// Run async
|
|
128
|
-
...asyncSteps.map(step => this.callStepHandler(step,
|
|
129
|
-
// Run sync
|
|
140
|
+
// Run async _steps that are independent of each other
|
|
141
|
+
...asyncSteps.map(step => this.callStepHandler(step, scope)),
|
|
142
|
+
// Run sync _steps that are dependent on each other
|
|
130
143
|
new Promise((r, j) => __awaiter(this, void 0, void 0, function* () {
|
|
131
144
|
try {
|
|
132
145
|
for (const step of syncSteps) {
|
|
133
|
-
yield this.callStepHandler(step,
|
|
146
|
+
yield this.callStepHandler(step, scope);
|
|
134
147
|
}
|
|
135
148
|
return r();
|
|
136
149
|
}
|
|
@@ -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;AAE/D,4DAAmD;AAGnD;;;;;;GAMG;AACH,MAAa,OAAO;IAIhB,YACY,OAAkB,EAClB,
|
|
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;AA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C,6CAA6C;IAG7C;;;OAGG;IACH,MAAM;QAEF,OAAO;YACH,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,IAAI,CAAC,MAAM;SACtB,CAAA;IACL,CAAC;CACJ;AAxPD,0BAwPC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { A_Component } from "../A-Component/A-Component.class";
|
|
2
2
|
import { A_Container } from "../A-Container/A-Container.class";
|
|
3
3
|
import { A_TYPES__A_ExtendDecorator_BehaviorConfig } from "../../decorators/A-Feature/A-Feature.decorator.types";
|
|
4
|
-
import { A_Scope } from "../A-Scope/A-Scope.class";
|
|
5
4
|
export declare enum A_TYPES__A_Stage_Status {
|
|
6
5
|
/**
|
|
7
6
|
* The stage is currently being processed
|
|
@@ -79,5 +78,5 @@ export type A_TYPES__A_Stage_JSON = {
|
|
|
79
78
|
};
|
|
80
79
|
export type A_TYPES__A_StageStepProcessingExtraParams = {
|
|
81
80
|
steps: A_TYPES__A_StageStep[];
|
|
82
|
-
|
|
81
|
+
filter: (step: A_TYPES__A_StageStep) => boolean;
|
|
83
82
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaas/a-concept",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.38",
|
|
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",
|
|
@@ -20,7 +20,7 @@ export class A_Stage {
|
|
|
20
20
|
|
|
21
21
|
constructor(
|
|
22
22
|
private feature: A_Feature,
|
|
23
|
-
private
|
|
23
|
+
private _steps: A_TYPES__A_StageStep[] = []
|
|
24
24
|
) {
|
|
25
25
|
|
|
26
26
|
}
|
|
@@ -33,19 +33,32 @@ export class A_Stage {
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
get before(): string[] {
|
|
36
|
-
return this.
|
|
36
|
+
return this._steps.reduce((acc, step) => ([
|
|
37
37
|
...acc,
|
|
38
38
|
...step.before
|
|
39
39
|
]), [] as string[]);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
get after(): string[] {
|
|
43
|
-
return this.
|
|
43
|
+
return this._steps.reduce((acc, step) => ([
|
|
44
44
|
...acc,
|
|
45
45
|
...step.after
|
|
46
46
|
]), [] as string[]);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
get steps(): A_TYPES__A_StageStep[] {
|
|
50
|
+
return this._steps;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
get asyncSteps(): A_TYPES__A_StageStep[] {
|
|
55
|
+
return this._steps.filter(step => step.behavior === 'async');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
get syncSteps(): A_TYPES__A_StageStep[] {
|
|
59
|
+
return this._steps.filter(step => step.behavior === 'sync');
|
|
60
|
+
}
|
|
61
|
+
|
|
49
62
|
|
|
50
63
|
/**
|
|
51
64
|
* Resolves the arguments of the step
|
|
@@ -55,7 +68,7 @@ export class A_Stage {
|
|
|
55
68
|
*/
|
|
56
69
|
protected async getStepArgs(
|
|
57
70
|
step: A_TYPES__A_StageStep,
|
|
58
|
-
scope: A_Scope
|
|
71
|
+
scope: A_Scope
|
|
59
72
|
) {
|
|
60
73
|
|
|
61
74
|
return Promise
|
|
@@ -87,7 +100,7 @@ export class A_Stage {
|
|
|
87
100
|
add(
|
|
88
101
|
step: A_TYPES__A_StageStep
|
|
89
102
|
): this {
|
|
90
|
-
this.
|
|
103
|
+
this._steps.push(step);
|
|
91
104
|
|
|
92
105
|
return this;
|
|
93
106
|
}
|
|
@@ -127,7 +140,7 @@ export class A_Stage {
|
|
|
127
140
|
*/
|
|
128
141
|
protected async callStepHandler(
|
|
129
142
|
step: A_TYPES__A_StageStep,
|
|
130
|
-
scope
|
|
143
|
+
scope: A_Scope
|
|
131
144
|
) {
|
|
132
145
|
const instance = await this.getStepInstance(step);
|
|
133
146
|
const callArgs = await this.getStepArgs(step, scope);
|
|
@@ -137,11 +150,15 @@ export class A_Stage {
|
|
|
137
150
|
|
|
138
151
|
|
|
139
152
|
/**
|
|
140
|
-
* Runs async all the
|
|
153
|
+
* Runs async all the _steps of the stage
|
|
141
154
|
*
|
|
142
155
|
* @returns
|
|
143
156
|
*/
|
|
144
157
|
async process(
|
|
158
|
+
/**
|
|
159
|
+
* Scope to be used to resolve the steps dependencies
|
|
160
|
+
*/
|
|
161
|
+
scope: A_Scope = new A_Scope({}, {}),
|
|
145
162
|
params?: Partial<A_TYPES__A_StageStepProcessingExtraParams>
|
|
146
163
|
): Promise<void> {
|
|
147
164
|
if (!this.processed)
|
|
@@ -154,22 +171,22 @@ export class A_Stage {
|
|
|
154
171
|
params.steps.forEach(step => this.add(step));
|
|
155
172
|
}
|
|
156
173
|
|
|
157
|
-
const syncSteps = this.
|
|
158
|
-
const asyncSteps = this.
|
|
174
|
+
const syncSteps = this.syncSteps.filter(params?.filter || (() => true));
|
|
175
|
+
const asyncSteps = this.asyncSteps.filter(params?.filter || (() => true));
|
|
159
176
|
|
|
160
|
-
// Run sync
|
|
161
|
-
await Promise
|
|
177
|
+
// Run sync _steps
|
|
178
|
+
await Promise
|
|
162
179
|
.all([
|
|
163
180
|
|
|
164
|
-
// Run async
|
|
165
|
-
...asyncSteps.map(step => this.callStepHandler(step,
|
|
181
|
+
// Run async _steps that are independent of each other
|
|
182
|
+
...asyncSteps.map(step => this.callStepHandler(step, scope)),
|
|
166
183
|
|
|
167
|
-
// Run sync
|
|
184
|
+
// Run sync _steps that are dependent on each other
|
|
168
185
|
new Promise<void>(
|
|
169
186
|
async (r, j) => {
|
|
170
187
|
try {
|
|
171
188
|
for (const step of syncSteps) {
|
|
172
|
-
await this.callStepHandler(step,
|
|
189
|
+
await this.callStepHandler(step, scope);
|
|
173
190
|
}
|
|
174
191
|
|
|
175
192
|
return r();
|