@adaas/a-concept 0.0.24 → 0.0.26
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/examples/simple/containers/Main.container.d.ts +2 -1
- package/dist/examples/simple/containers/Main.container.js +5 -7
- package/dist/examples/simple/containers/Main.container.js.map +1 -1
- package/dist/src/global/A-Component/A-Component.class.d.ts +4 -3
- package/dist/src/global/A-Component/A-Component.class.js +2 -2
- package/dist/src/global/A-Component/A-Component.class.js.map +1 -1
- package/dist/src/global/A-Container/A-Container.class.js +2 -2
- 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 -6
- package/dist/src/global/A-Context/A-Context.class.js +42 -6
- package/dist/src/global/A-Context/A-Context.class.js.map +1 -1
- package/dist/src/global/A-Entity/A-Entity.class.js +1 -1
- package/dist/src/global/A-Entity/A-Entity.class.js.map +1 -1
- package/examples/simple/containers/Main.container.ts +6 -8
- package/package.json +1 -1
- package/src/global/A-Component/A-Component.class.ts +6 -1
- package/src/global/A-Container/A-Container.class.ts +2 -2
- package/src/global/A-Context/A-Context.class.ts +51 -5
- package/src/global/A-Entity/A-Entity.class.ts +5 -5
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { A_Container } from "../../../src/global/A-Container/A-Container.class";
|
|
2
|
+
import { A_Scope } from "../../../src/global/A-Scope/A-Scope.class";
|
|
2
3
|
export declare class MainContainer extends A_Container<[
|
|
3
4
|
'method_A',
|
|
4
5
|
'method_B'
|
|
5
6
|
]> {
|
|
6
7
|
load(): Promise<void>;
|
|
7
|
-
start(
|
|
8
|
+
start(scope: A_Scope): Promise<void>;
|
|
8
9
|
method_A(): Promise<void>;
|
|
9
10
|
method_B(): Promise<void>;
|
|
10
11
|
}
|
|
@@ -27,18 +27,16 @@ const A_Concept_class_1 = require("../../../src/global/A-Concept/A_Concept.class
|
|
|
27
27
|
const A_Inject_decorator_1 = require("../../../src/decorators/A-Inject/A-Inject.decorator");
|
|
28
28
|
const A_Context_class_1 = require("../../../src/global/A-Context/A-Context.class");
|
|
29
29
|
const A_Logger_component_1 = require("../../../src/base/A-Logger/A-Logger.component");
|
|
30
|
+
const A_Scope_class_1 = require("../../../src/global/A-Scope/A-Scope.class");
|
|
30
31
|
class MainContainer extends A_Container_class_1.A_Container {
|
|
31
32
|
load() {
|
|
32
33
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
34
|
console.log('Main container loaded');
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
|
-
start(
|
|
37
|
+
start(scope) {
|
|
37
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
|
|
39
|
-
console.log('Start');
|
|
40
|
-
}
|
|
41
|
-
A_Context_class_1.A_Context.feature(this, 'method_A');
|
|
39
|
+
A_Context_class_1.A_Context.feature(scope, this, 'method_A');
|
|
42
40
|
});
|
|
43
41
|
}
|
|
44
42
|
method_A() {
|
|
@@ -57,7 +55,7 @@ class MainContainer extends A_Container_class_1.A_Container {
|
|
|
57
55
|
console.log('Method B', A_Context_class_1.A_Context.root);
|
|
58
56
|
const logger = this.Scope.resolve(A_Logger_component_1.A_Logger);
|
|
59
57
|
// or you can manually call the feature
|
|
60
|
-
const feature = A_Context_class_1.A_Context.feature(this, 'method_B', {
|
|
58
|
+
const feature = A_Context_class_1.A_Context.feature(this.Scope, this, 'method_B', {
|
|
61
59
|
fragments: [new Fragment_A_context_1.ContextFragmentA(), new Fragment_B_context_1.ContextFragmentB()]
|
|
62
60
|
});
|
|
63
61
|
for (const step of feature) {
|
|
@@ -73,7 +71,7 @@ __decorate([
|
|
|
73
71
|
], MainContainer.prototype, "load", null);
|
|
74
72
|
__decorate([
|
|
75
73
|
A_Concept_class_1.A_Concept.Start(),
|
|
76
|
-
__param(0, (0, A_Inject_decorator_1.A_Inject)(
|
|
74
|
+
__param(0, (0, A_Inject_decorator_1.A_Inject)(A_Scope_class_1.A_Scope))
|
|
77
75
|
], MainContainer.prototype, "start", null);
|
|
78
76
|
__decorate([
|
|
79
77
|
A_Feature_class_1.A_Feature.Define()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Main.container.js","sourceRoot":"","sources":["../../../../examples/simple/containers/Main.container.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,6FAAoF;AACpF,uFAA8E;AAC9E,sEAAiE;AACjE,sEAAiE;AACjE,uFAA8E;AAC9E,gGAAmF;AACnF,uFAA8E;AAC9E,0FAA6E;
|
|
1
|
+
{"version":3,"file":"Main.container.js","sourceRoot":"","sources":["../../../../examples/simple/containers/Main.container.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,6FAAoF;AACpF,uFAA8E;AAC9E,sEAAiE;AACjE,sEAAiE;AACjE,uFAA8E;AAC9E,gGAAmF;AACnF,uFAA8E;AAC9E,0FAA6E;AAC7E,iFAAwE;AAIxE,MAAa,aAAc,SAAQ,+BAElC;IAGS,IAAI;;YACN,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;QACzC,CAAC;KAAA;IAGK,KAAK,CACY,KAAc;;YAGjC,2BAAS,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;QAC/C,CAAC;KAAA;IAMK,QAAQ;;YACV,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YACxB,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;gBACxB,SAAS,EAAE;oBACP,IAAI,qCAAgB,EAAE;oBACtB,IAAI,qCAAgB,EAAE;iBACzB;aACJ,CAAC,CAAC;QACP,CAAC;KAAA;IAMK,QAAQ;;YAEV,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,2BAAS,CAAC,IAAI,CAAC,CAAC;YAExC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,6BAAQ,CAAC,CAAC;YAE5C,wCAAwC;YAExC,MAAM,OAAO,GAAG,2BAAS,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE;gBAC5D,SAAS,EAAE,CAAC,IAAI,qCAAgB,EAAE,EAAE,IAAI,qCAAgB,EAAE,CAAC;aAC9D,CAAC,CAAC;YAEH,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;gBACzB,MAAM,CAAC,GAAG,CAAC,4BAA4B,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;gBAE1D,MAAM,IAAI,EAAE,CAAC;YACjB,CAAC;QACL,CAAC;KAAA;CACJ;AArDD,sCAqDC;AAhDS;IADL,2BAAS,CAAC,IAAI,EAAE;yCAGhB;AAGK;IADL,2BAAS,CAAC,KAAK,EAAE;IAEb,WAAA,IAAA,6BAAQ,EAAC,uBAAO,CAAC,CAAA;0CAIrB;AAMK;IADL,2BAAS,CAAC,MAAM,EAAE;6CASlB;AAMK;IADL,2BAAS,CAAC,MAAM,EAAE;6CAkBlB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { A_TYPES__Required } from "@adaas/a-utils";
|
|
2
2
|
import { A_TYPES__ComponentCallParams } from "./A-Component.types";
|
|
3
|
+
import { A_Scope } from "../A-Scope/A-Scope.class";
|
|
3
4
|
/**
|
|
4
5
|
* This element only contains the specific code
|
|
5
6
|
*
|
|
@@ -11,17 +12,17 @@ export declare class A_Component<_FeatureNames extends Array<string> = any> {
|
|
|
11
12
|
* @param lifecycleMethod
|
|
12
13
|
* @param args
|
|
13
14
|
*/
|
|
14
|
-
call(
|
|
15
|
+
call(scope: A_Scope,
|
|
15
16
|
/**
|
|
16
17
|
* A-Feature method name to be called
|
|
17
18
|
*/
|
|
18
19
|
feature: _FeatureNames[number]): Promise<any>;
|
|
19
|
-
call(
|
|
20
|
+
call(scope: A_Scope,
|
|
20
21
|
/**
|
|
21
22
|
* A-Feature name to be called
|
|
22
23
|
*/
|
|
23
24
|
params: A_TYPES__Required<Partial<A_TYPES__ComponentCallParams<_FeatureNames[number]>>, ['name']>): Promise<any>;
|
|
24
|
-
call(
|
|
25
|
+
call(scope: A_Scope,
|
|
25
26
|
/**
|
|
26
27
|
* A-Feature method name to be called
|
|
27
28
|
*/
|
|
@@ -16,7 +16,7 @@ const A_Context_class_1 = require("../A-Context/A-Context.class");
|
|
|
16
16
|
*
|
|
17
17
|
*/
|
|
18
18
|
class A_Component {
|
|
19
|
-
call(param1, param2) {
|
|
19
|
+
call(scope, param1, param2) {
|
|
20
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
21
|
const feature = typeof param1 === 'string'
|
|
22
22
|
? param1
|
|
@@ -24,7 +24,7 @@ class A_Component {
|
|
|
24
24
|
const params = typeof param1 === 'string'
|
|
25
25
|
? param2 || {}
|
|
26
26
|
: param1;
|
|
27
|
-
const newFeature = A_Context_class_1.A_Context.feature(this, feature, params);
|
|
27
|
+
const newFeature = A_Context_class_1.A_Context.feature(scope, this, feature, params);
|
|
28
28
|
return yield newFeature.process();
|
|
29
29
|
});
|
|
30
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Component.class.js","sourceRoot":"","sources":["../../../../src/global/A-Component/A-Component.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,kEAAyD;
|
|
1
|
+
{"version":3,"file":"A-Component.class.js","sourceRoot":"","sources":["../../../../src/global/A-Component/A-Component.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,kEAAyD;AAIzD;;;GAGG;AACH,MAAa,WAAW;IAsCd,IAAI,CACN,KAAc,EACd,MAAyH,EACzH,MAAqE;;YAGrE,MAAM,OAAO,GAAW,OAAO,MAAM,KAAK,QAAQ;gBAC9C,CAAC,CAAC,MAAM;gBACR,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;YAClB,MAAM,MAAM,GAAiE,OAAO,MAAM,KAAK,QAAQ;gBACnG,CAAC,CAAC,MAAM,IAAI,EAAE;gBACd,CAAC,CAAC,MAAM,CAAC;YAEb,MAAM,UAAU,GAAG,2BAAS,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;YAEnE,OAAO,MAAM,UAAU,CAAC,OAAO,EAAE,CAAC;QACtC,CAAC;KAAA;CACJ;AAvDD,kCAuDC"}
|
|
@@ -80,7 +80,7 @@ class A_Container {
|
|
|
80
80
|
const params = typeof param1 === 'string'
|
|
81
81
|
? param2 || {}
|
|
82
82
|
: param1;
|
|
83
|
-
const newFeature = A_Context_class_1.A_Context.feature(this, feature, params);
|
|
83
|
+
const newFeature = A_Context_class_1.A_Context.feature(this.Scope, this, feature, params);
|
|
84
84
|
return yield newFeature.process();
|
|
85
85
|
});
|
|
86
86
|
}
|
|
@@ -91,7 +91,7 @@ class A_Container {
|
|
|
91
91
|
const params = typeof param1 === 'string'
|
|
92
92
|
? param2 || {}
|
|
93
93
|
: param1;
|
|
94
|
-
return A_Context_class_1.A_Context.featureDefinition(this, feature, params);
|
|
94
|
+
return A_Context_class_1.A_Context.featureDefinition(this.Scope, this, feature, params);
|
|
95
95
|
}
|
|
96
96
|
// ==============================================================
|
|
97
97
|
// ======================= HOOKS ================================
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Container.class.js","sourceRoot":"","sources":["../../../../src/global/A-Container/A-Container.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,kEAAyD;AAMzD;;;;;;;;;;GAUG;AACH,MAAa,WAAW;IAYpB,IAAI,OAAO;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,EAAS,CAAC;IAC5C,CAAC;IAED,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACrD,CAAC;IAED,IAAI,KAAK;QACL,OAAO,2BAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAGD;IACI;;OAEG;IACH,MAA6D;QAE7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G,2BAAS,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"A-Container.class.js","sourceRoot":"","sources":["../../../../src/global/A-Container/A-Container.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,kEAAyD;AAMzD;;;;;;;;;;GAUG;AACH,MAAa,WAAW;IAYpB,IAAI,OAAO;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,EAAS,CAAC;IAC5C,CAAC;IAED,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACrD,CAAC;IAED,IAAI,KAAK;QACL,OAAO,2BAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAGD;IACI;;OAEG;IACH,MAA6D;QAE7D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;QAC3C,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC;QAEzC,2BAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAEjC;;WAEG;QACH,IAAI,CAAC,IAAI,EAAE,CAAC;IAChB,CAAC;IAGS,YAAY,CAAC,EAA2B;QAC9C,OAAO,IAAI,CAAC,WAAW,KAAK,EAAE;YAC1B,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,IAAI,CAAA;IACd,CAAC;IAGD;;OAEG;IACW,IAAI;;YACd,IAAI,CAAC,IAAI,CAAC,KAAK;gBACX,IAAI,CAAC,KAAK,GAAG,IAAI,OAAO,CAAC,CAAO,OAAO,EAAE,MAAM,EAAE,EAAE;oBAC/C,IAAI,CAAC;wBACD,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;wBAE1B,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;wBAEpB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B,OAAO;QACX,CAAC;KAAA;IAED;;;;OAIG;IACa,WAAW;;YACvB,OAAO;QACX,CAAC;KAAA;CAEJ;AA5MD,kCA4MC"}
|
|
@@ -90,18 +90,18 @@ export declare class A_Context {
|
|
|
90
90
|
* @param scope
|
|
91
91
|
* @returns
|
|
92
92
|
*/
|
|
93
|
-
static featureDefinition<T extends Array<string>>(entity: A_Entity<any, any, T>, feature: A_TYPES__EntityBaseMethod | string | T[number] | RegExp, params?: Partial<A_TYPES__ScopeConstructor>): A_TYPES__Required<Partial<A_TYPES__FeatureConstructor>, ['steps', 'fragments', 'name', 'components']>;
|
|
94
|
-
static featureDefinition<T extends Array<string>>(container: A_Container<T>, feature: T[number], params?: Partial<A_TYPES__ScopeConstructor>): A_TYPES__Required<Partial<A_TYPES__FeatureConstructor>, ['steps', 'fragments', 'name', 'components']>;
|
|
95
|
-
static featureDefinition(component: A_Component, feature: string, params?: Partial<A_TYPES__ScopeConstructor>): A_TYPES__Required<Partial<A_TYPES__FeatureConstructor>, ['steps', 'fragments', 'name', 'components']>;
|
|
93
|
+
static featureDefinition<T extends Array<string>>(scope: A_Scope, entity: A_Entity<any, any, T>, feature: A_TYPES__EntityBaseMethod | string | T[number] | RegExp, params?: Partial<A_TYPES__ScopeConstructor>): A_TYPES__Required<Partial<A_TYPES__FeatureConstructor>, ['steps', 'fragments', 'name', 'components']>;
|
|
94
|
+
static featureDefinition<T extends Array<string>>(scope: A_Scope, container: A_Container<T>, feature: T[number], params?: Partial<A_TYPES__ScopeConstructor>): A_TYPES__Required<Partial<A_TYPES__FeatureConstructor>, ['steps', 'fragments', 'name', 'components']>;
|
|
95
|
+
static featureDefinition(scope: A_Scope, component: A_Component, feature: string, params?: Partial<A_TYPES__ScopeConstructor>): A_TYPES__Required<Partial<A_TYPES__FeatureConstructor>, ['steps', 'fragments', 'name', 'components']>;
|
|
96
96
|
/**
|
|
97
97
|
* This method returns a step-by-step instructions of feature implementation depending on the feature name and the class.
|
|
98
98
|
*
|
|
99
99
|
* @param scope
|
|
100
100
|
* @returns
|
|
101
101
|
*/
|
|
102
|
-
static feature<T extends Array<string>>(entity: A_Entity<any, any, T>, feature: A_TYPES__EntityBaseMethod | string | T[number] | RegExp, params?: Partial<A_TYPES__ScopeConstructor>): A_Feature;
|
|
103
|
-
static feature<T extends Array<string>>(container: A_Container<T>, feature: T[number], params?: Partial<A_TYPES__ScopeConstructor>): A_Feature;
|
|
104
|
-
static feature(component: A_Component, feature: string, params?: Partial<A_TYPES__ScopeConstructor>): A_Feature;
|
|
102
|
+
static feature<T extends Array<string>>(scope: A_Scope, entity: A_Entity<any, any, T>, feature: A_TYPES__EntityBaseMethod | string | T[number] | RegExp, params?: Partial<A_TYPES__ScopeConstructor>): A_Feature;
|
|
103
|
+
static feature<T extends Array<string>>(scope: A_Scope, container: A_Container<T>, feature: T[number], params?: Partial<A_TYPES__ScopeConstructor>): A_Feature;
|
|
104
|
+
static feature(scope: A_Scope, component: A_Component, feature: string, params?: Partial<A_TYPES__ScopeConstructor>): A_Feature;
|
|
105
105
|
/**
|
|
106
106
|
* Register a Namespace in the provider.
|
|
107
107
|
* @param Namespace
|
|
@@ -180,13 +180,49 @@ class A_Context {
|
|
|
180
180
|
}
|
|
181
181
|
return component;
|
|
182
182
|
}
|
|
183
|
-
static featureDefinition(param1, param2, param3) {
|
|
183
|
+
static featureDefinition(scope, param1, param2, param3) {
|
|
184
184
|
const instance = this.getInstance();
|
|
185
185
|
const component = param1;
|
|
186
|
-
const feature = `${component.constructor.name}.${param2}`;
|
|
187
186
|
const config = param3 || {};
|
|
188
|
-
|
|
187
|
+
/**
|
|
188
|
+
* Important NOTE::: Component Scope and Parent Scope are different things.
|
|
189
|
+
*
|
|
190
|
+
* Component Scope is a scope where Component Registered.
|
|
191
|
+
* Parent Scope is a scope From Where Feature Requested.
|
|
192
|
+
*
|
|
193
|
+
*
|
|
194
|
+
* Example: ComponentA registered in ScopeA of ContainerA.
|
|
195
|
+
* When FeatureA Requested from ContainerA, then Parent Scope is ScopeA For the FeatureA [!]
|
|
196
|
+
* BUT In FeatureA may be used ComponentB with FeatureB.
|
|
197
|
+
*
|
|
198
|
+
*
|
|
199
|
+
* ------------------------------Execution-----------------------------------------------------------
|
|
200
|
+
* ContainerA -> FeatureA -> ComponentA -> FeatureB -> ComponentB
|
|
201
|
+
* - Scope:ScopeA -> - Scope: FeatA -> - Scope: ScopeA -> - Scope: FeatB -> - Scope: ScopeA
|
|
202
|
+
* - Parent: ScopeA -> - Parent: ROOT -> - Parent: FeatA -> - Parent: ROOT
|
|
203
|
+
* --------------------------------------------------------------------------------------------------
|
|
204
|
+
*
|
|
205
|
+
* So ComponentA and ComponentB are registered in the SAME scope of ContainerA.
|
|
206
|
+
* But Each Feature has its own Scope and Parent Scope.
|
|
207
|
+
*
|
|
208
|
+
*
|
|
209
|
+
* Component AND Entity DO [!] NOT HAVE THEIR OWN SCOPE.
|
|
210
|
+
*
|
|
211
|
+
* Feature AND Container HAVE OWN SCOPE.
|
|
212
|
+
*
|
|
213
|
+
*
|
|
214
|
+
* So Parent can come from the Container or from the Feature.
|
|
215
|
+
* While Scope we use just to store the scope where the component registered.
|
|
216
|
+
*
|
|
217
|
+
*/
|
|
189
218
|
const steps = [];
|
|
219
|
+
// const feature: string = new ASEID({
|
|
220
|
+
// id: `${param2}-${Math.random()}`,
|
|
221
|
+
// entity: 'a-feature',
|
|
222
|
+
// namespace: component.constructor.name,
|
|
223
|
+
// scope: scope.name
|
|
224
|
+
// }).toString();
|
|
225
|
+
const feature = `${component.constructor.name}.${param2}`;
|
|
190
226
|
// Now we need to resolve the method from all registered components
|
|
191
227
|
// We need to get all components that has extensions for the feature in component
|
|
192
228
|
instance.componentsMeta
|
|
@@ -210,11 +246,11 @@ class A_Context {
|
|
|
210
246
|
fragments: config.fragments || [],
|
|
211
247
|
components: config.components || [],
|
|
212
248
|
steps,
|
|
213
|
-
parent: this.scope(component)
|
|
249
|
+
parent: component instanceof A_Container_class_1.A_Container ? this.scope(component) : undefined
|
|
214
250
|
};
|
|
215
251
|
}
|
|
216
|
-
static feature(param1, param2, param3) {
|
|
217
|
-
const featureConstructor = this.featureDefinition(param1, param2, param3);
|
|
252
|
+
static feature(scope, param1, param2, param3) {
|
|
253
|
+
const featureConstructor = this.featureDefinition(scope, param1, param2, param3);
|
|
218
254
|
const newFeature = new A_Feature_class_1.A_Feature(featureConstructor);
|
|
219
255
|
return newFeature;
|
|
220
256
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Context.class.js","sourceRoot":"","sources":["../../../../src/global/A-Context/A-Context.class.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"A-Context.class.js","sourceRoot":"","sources":["../../../../src/global/A-Context/A-Context.class.ts"],"names":[],"mappings":";;;AAAA,4CAAuF;AACvF,wEAA+D;AAC/D,qEAA4D;AAC5D,kEAAyD;AACzD,wEAA+D;AAC/D,4DAAmD;AAEnD,yDAAgD;AAChD,sEAAkE;AAClE,sEAAkE;AAClE,kEAAyD;AAEzD,+DAAsD;AACtD,6DAAyD;AAIzD;;;;;;GAMG;AACH,MAAa,SAAS;IAwDlB;QApDA;;WAEG;QACO,eAAU,GAAuC,IAAI,OAAO,EAAE,CAAC;QAEzE;;WAEG;QACO,aAAQ,GAAgC,IAAI,OAAO,EAAE,CAAC;QAEhE;;WAEG;QACO,aAAQ,GAAqC,IAAI,OAAO,EAAE,CAAC;QAGrE;;WAEG;QACO,aAAQ,GAQd,IAAI,OAAO,EAAE,CAAC;QAKlB;;WAEG;QACH,wGAAwG;QAE9F,iBAAY,GAAmD,IAAI,GAAG,EAAE,CAAC;QACzE,mBAAc,GAAyD,IAAI,GAAG,EAAE,CAAC;QACjF,mBAAc,GAA6C,IAAI,GAAG,EAAE,CAAC;QACrE,iBAAY,GAAmD,IAAI,GAAG,EAAE,CAAC;QAEnF,0CAA0C;QAChC,eAAU,GAAqD,IAAI,GAAG,EAAE,CAAC;IAS3D,CAAC;IAIzB,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AAI,CAAC;QAEhC,QAAQ,IAAI,EAAE,CAAC;YACX,KAAK,MAAM,YAAY,+BAAW;gBAC9B,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;gBACrC,MAAM;YAEV,KAAK,MAAM,YAAY,+BAAW;gBAC9B,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;gBACrC,MAAM;YAEV,KAAK,MAAM,YAAY,yBAAQ;gBAC3B,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;gBACrC,MAAM;YAEV,KAAK,MAAM,YAAY,6BAAU;gBAC7B,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;gBACrC,MAAM;YAEV;gBACI,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAE7C,CAAC;QAGD,sCAAsC;QAEtC,2CAA2C;QAE3C,gCAAgC;QAChC,wBAAwB;QAExB,wCAAwC;QACxC,yBAAyB;QACzB,6BAA6B;QAC7B,eAAe;QACf,2CAA2C;QAC3C,gCAAgC;QAChC,QAAQ;QAER,UAAU;QACV,wEAAwE;QACxE,gFAAgF;QAChF,UAAU;QACV,iBAAiB;QACjB,2BAA2B;QAC3B,6CAA6C;QAC7C,yCAAyC;QACzC,iDAAiD;QACjD,6BAA6B;QAG7B,sBAAsB;QACtB,iCAAiC;QAEjC,4DAA4D;QAE5D,mBAAmB;IAEvB,CAAC;CACJ;AA3iBD,8BA2iBC"}
|
|
@@ -105,7 +105,7 @@ class A_Entity extends A_Fragment_class_1.A_Fragment {
|
|
|
105
105
|
const params = typeof param1 === 'string'
|
|
106
106
|
? param2 || {}
|
|
107
107
|
: param1;
|
|
108
|
-
const newFeature = A_Context_class_1.A_Context.feature(this, feature, params);
|
|
108
|
+
const newFeature = A_Context_class_1.A_Context.feature(A_Context_class_1.A_Context.scope(this), this, feature, params);
|
|
109
109
|
return yield newFeature.process();
|
|
110
110
|
});
|
|
111
111
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Entity.class.js","sourceRoot":"","sources":["../../../../src/global/A-Entity/A-Entity.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAIwB;AACxB,qDAM0B;AAC1B,yFAAiG;AACjG,kEAAyD;AACzD,qEAA4D;AAI5D;;;;;;GAMG;AACH,MAAa,QAKT,SAAQ,6BAAU;IAMlB;;OAEG;IACH,MAAM,KAAK,MAAM;QACb,OAAO,wBAAc;aAChB,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;aACvC,iBAAiB,EAAE;aACnB,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC5B,CAAC;IAcD,YAAY,KAA0D;QAClE,KAAK,EAAE,CAAC;QAER,QAAQ,IAAI,EAAE,CAAC;YACX,KAAK,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,eAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gBACpD,IAAI,CAAC,KAAK,GAAG,IAAI,eAAK,CAAC,KAAK,CAAC,CAAC;gBAC9B,MAAM;YACV,KAAK,CAAC,KAAK,YAAY,eAAK,CAAC;gBACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;gBACnB,MAAM;YACV,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK,CAAC;gBAC3D,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACrB,MAAM;YAEV,KAAK,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC;gBAC5B,IAAI,CAAC,OAAO,CAAC,KAAyB,CAAC,CAAC;gBACxC,MAAK;YAET;gBACI,MAAM,IAAI,iBAAO,CAAC,8CAA2B,CAAC,8BAA8B,CAAC,CAAC;QACtF,CAAC;IACL,CAAC;IAED,uEAAuE;IACvE,uEAAuE;IACvE,uEAAuE;IAEvE;;;OAGG;IACH,IAAI,EAAE;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;IACzB,CAAC;IAED;;;OAGG;IACH,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAA;IAC/B,CAAC;IAED;;;OAGG;IACH,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC7B,CAAC;IAED;;;OAGG;IAEH,IAAI,OAAO;QACP,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACH,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;IAC5B,CAAC;IAgCK,IAAI,CACN,MAAsH,EACtH,MAAkE;;YAGlE,MAAM,OAAO,GAAW,OAAO,MAAM,KAAK,QAAQ;gBAC9C,CAAC,CAAC,MAAM;gBACR,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;YAClB,MAAM,MAAM,GAA8D,OAAO,MAAM,KAAK,QAAQ;gBAChG,CAAC,CAAC,MAAM,IAAI,EAAE;gBACd,CAAC,CAAC,MAAM,CAAC;YAEb,MAAM,UAAU,GAAG,2BAAS,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"A-Entity.class.js","sourceRoot":"","sources":["../../../../src/global/A-Entity/A-Entity.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAIwB;AACxB,qDAM0B;AAC1B,yFAAiG;AACjG,kEAAyD;AACzD,qEAA4D;AAI5D;;;;;;GAMG;AACH,MAAa,QAKT,SAAQ,6BAAU;IAMlB;;OAEG;IACH,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AuE;IACvE,uEAAuE;IAEvE,OAAO,CAAC,SAA2B;QAC/B,OAAO;IACX,CAAC;IAED,QAAQ,CAAC,UAA2B;QAChC,IAAI,CAAC,KAAK,GAAG,IAAI,eAAK,CAAC,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC;QAC3C,OAAO;IACX,CAAC;IAID;;;;;OAKG;IACH,MAAM;QACF,OAAO;YACH,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;SACZ,CAAC;IACzB,CAAC;IAGD,QAAQ;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACtE,CAAC;CACJ;AAhOD,4BAgOC"}
|
|
@@ -6,6 +6,7 @@ import { A_Concept } from "@adaas/a-concept/global/A-Concept/A_Concept.class";
|
|
|
6
6
|
import { A_Inject } from "@adaas/a-concept/decorators/A-Inject/A-Inject.decorator";
|
|
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
|
+
import { A_Scope } from "@adaas/a-concept/global/A-Scope/A-Scope.class";
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
|
|
@@ -20,14 +21,10 @@ export class MainContainer extends A_Container<
|
|
|
20
21
|
|
|
21
22
|
@A_Concept.Start()
|
|
22
23
|
async start(
|
|
23
|
-
@A_Inject(
|
|
24
|
+
@A_Inject(A_Scope) scope: A_Scope
|
|
24
25
|
) {
|
|
25
|
-
if (params) {
|
|
26
|
-
console.log('Start');
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
A_Context.feature(this, 'method_A');
|
|
27
|
+
A_Context.feature(scope, this, 'method_A');
|
|
31
28
|
}
|
|
32
29
|
|
|
33
30
|
|
|
@@ -48,14 +45,15 @@ export class MainContainer extends A_Container<
|
|
|
48
45
|
|
|
49
46
|
|
|
50
47
|
@A_Feature.Define()
|
|
51
|
-
async method_B(
|
|
48
|
+
async method_B(
|
|
49
|
+
) {
|
|
52
50
|
console.log('Method B', A_Context.root);
|
|
53
51
|
|
|
54
52
|
const logger = this.Scope.resolve(A_Logger);
|
|
55
53
|
|
|
56
54
|
// or you can manually call the feature
|
|
57
55
|
|
|
58
|
-
const feature = A_Context.feature(this, 'method_B', {
|
|
56
|
+
const feature = A_Context.feature(this.Scope, this, 'method_B', {
|
|
59
57
|
fragments: [new ContextFragmentA(), new ContextFragmentB()]
|
|
60
58
|
});
|
|
61
59
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaas/a-concept",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
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",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { A_TYPES__Required } from "@adaas/a-utils";
|
|
2
2
|
import { A_Context } from "../A-Context/A-Context.class";
|
|
3
3
|
import { A_TYPES__ComponentCallParams } from "./A-Component.types";
|
|
4
|
+
import { A_Scope } from "../A-Scope/A-Scope.class";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* This element only contains the specific code
|
|
@@ -18,12 +19,14 @@ export class A_Component<
|
|
|
18
19
|
* @param args
|
|
19
20
|
*/
|
|
20
21
|
async call(
|
|
22
|
+
scope: A_Scope,
|
|
21
23
|
/**
|
|
22
24
|
* A-Feature method name to be called
|
|
23
25
|
*/
|
|
24
26
|
feature: _FeatureNames[number],
|
|
25
27
|
): Promise<any>
|
|
26
28
|
async call(
|
|
29
|
+
scope: A_Scope,
|
|
27
30
|
/**
|
|
28
31
|
* A-Feature name to be called
|
|
29
32
|
*/
|
|
@@ -31,6 +34,7 @@ export class A_Component<
|
|
|
31
34
|
): Promise<any>
|
|
32
35
|
|
|
33
36
|
async call(
|
|
37
|
+
scope: A_Scope,
|
|
34
38
|
/**
|
|
35
39
|
* A-Feature method name to be called
|
|
36
40
|
*/
|
|
@@ -42,6 +46,7 @@ export class A_Component<
|
|
|
42
46
|
): Promise<any>
|
|
43
47
|
|
|
44
48
|
async call(
|
|
49
|
+
scope: A_Scope,
|
|
45
50
|
param1: _FeatureNames[number] | A_TYPES__Required<Partial<A_TYPES__ComponentCallParams<_FeatureNames[number]>>, ['name']>,
|
|
46
51
|
param2?: Partial<A_TYPES__ComponentCallParams<_FeatureNames[number]>>
|
|
47
52
|
): Promise<any> {
|
|
@@ -53,7 +58,7 @@ export class A_Component<
|
|
|
53
58
|
? param2 || {}
|
|
54
59
|
: param1;
|
|
55
60
|
|
|
56
|
-
const newFeature = A_Context.feature(this, feature, params);
|
|
61
|
+
const newFeature = A_Context.feature(scope, this, feature, params);
|
|
57
62
|
|
|
58
63
|
return await newFeature.process();
|
|
59
64
|
}
|
|
@@ -138,7 +138,7 @@ export class A_Container<
|
|
|
138
138
|
? param2 || {}
|
|
139
139
|
: param1;
|
|
140
140
|
|
|
141
|
-
const newFeature = A_Context.feature(this, feature, params);
|
|
141
|
+
const newFeature = A_Context.feature(this.Scope, this, feature, params);
|
|
142
142
|
|
|
143
143
|
return await newFeature.process();
|
|
144
144
|
}
|
|
@@ -187,7 +187,7 @@ export class A_Container<
|
|
|
187
187
|
? param2 || {}
|
|
188
188
|
: param1;
|
|
189
189
|
|
|
190
|
-
return A_Context.featureDefinition(this, feature, params);
|
|
190
|
+
return A_Context.featureDefinition(this.Scope, this, feature, params);
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A_CommonHelper, A_Polyfills, A_TYPES__Required } from "@adaas/a-utils";
|
|
1
|
+
import { A_CommonHelper, A_Polyfills, A_TYPES__Required, ASEID } from "@adaas/a-utils";
|
|
2
2
|
import { A_Component } from "../A-Component/A-Component.class";
|
|
3
3
|
import { A_Fragment } from "../A-Fragment/A-Fragment.class";
|
|
4
4
|
import { A_Feature } from "../A-Feature/A-Feature.class";
|
|
@@ -346,21 +346,25 @@ export class A_Context {
|
|
|
346
346
|
* @returns
|
|
347
347
|
*/
|
|
348
348
|
static featureDefinition<T extends Array<string>>(
|
|
349
|
+
scope: A_Scope,
|
|
349
350
|
entity: A_Entity<any, any, T>,
|
|
350
351
|
feature: A_TYPES__EntityBaseMethod | string | T[number] | RegExp,
|
|
351
352
|
params?: Partial<A_TYPES__ScopeConstructor>
|
|
352
353
|
): A_TYPES__Required<Partial<A_TYPES__FeatureConstructor>, ['steps', 'fragments', 'name', 'components']>
|
|
353
354
|
static featureDefinition<T extends Array<string>>(
|
|
355
|
+
scope: A_Scope,
|
|
354
356
|
container: A_Container<T>,
|
|
355
357
|
feature: T[number],
|
|
356
358
|
params?: Partial<A_TYPES__ScopeConstructor>
|
|
357
359
|
): A_TYPES__Required<Partial<A_TYPES__FeatureConstructor>, ['steps', 'fragments', 'name', 'components']>
|
|
358
360
|
static featureDefinition(
|
|
361
|
+
scope: A_Scope,
|
|
359
362
|
component: A_Component,
|
|
360
363
|
feature: string,
|
|
361
364
|
params?: Partial<A_TYPES__ScopeConstructor>
|
|
362
365
|
): A_TYPES__Required<Partial<A_TYPES__FeatureConstructor>, ['steps', 'fragments', 'name', 'components']>
|
|
363
366
|
static featureDefinition<T extends Array<string>>(
|
|
367
|
+
scope: A_Scope,
|
|
364
368
|
param1: A_Component<T> | A_Container<T> | A_Entity<any, any, T>,
|
|
365
369
|
param2: string | T[number],
|
|
366
370
|
param3?: Partial<A_TYPES__ScopeConstructor>
|
|
@@ -370,10 +374,48 @@ export class A_Context {
|
|
|
370
374
|
const instance = this.getInstance();
|
|
371
375
|
|
|
372
376
|
const component = param1;
|
|
373
|
-
const feature: string = `${component.constructor.name}.${param2}`;
|
|
374
377
|
const config = param3 || {};
|
|
375
|
-
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Important NOTE::: Component Scope and Parent Scope are different things.
|
|
381
|
+
*
|
|
382
|
+
* Component Scope is a scope where Component Registered.
|
|
383
|
+
* Parent Scope is a scope From Where Feature Requested.
|
|
384
|
+
*
|
|
385
|
+
*
|
|
386
|
+
* Example: ComponentA registered in ScopeA of ContainerA.
|
|
387
|
+
* When FeatureA Requested from ContainerA, then Parent Scope is ScopeA For the FeatureA [!]
|
|
388
|
+
* BUT In FeatureA may be used ComponentB with FeatureB.
|
|
389
|
+
*
|
|
390
|
+
*
|
|
391
|
+
* ------------------------------Execution-----------------------------------------------------------
|
|
392
|
+
* ContainerA -> FeatureA -> ComponentA -> FeatureB -> ComponentB
|
|
393
|
+
* - Scope:ScopeA -> - Scope: FeatA -> - Scope: ScopeA -> - Scope: FeatB -> - Scope: ScopeA
|
|
394
|
+
* - Parent: ScopeA -> - Parent: ROOT -> - Parent: FeatA -> - Parent: ROOT
|
|
395
|
+
* --------------------------------------------------------------------------------------------------
|
|
396
|
+
*
|
|
397
|
+
* So ComponentA and ComponentB are registered in the SAME scope of ContainerA.
|
|
398
|
+
* But Each Feature has its own Scope and Parent Scope.
|
|
399
|
+
*
|
|
400
|
+
*
|
|
401
|
+
* Component AND Entity DO [!] NOT HAVE THEIR OWN SCOPE.
|
|
402
|
+
*
|
|
403
|
+
* Feature AND Container HAVE OWN SCOPE.
|
|
404
|
+
*
|
|
405
|
+
*
|
|
406
|
+
* So Parent can come from the Container or from the Feature.
|
|
407
|
+
* While Scope we use just to store the scope where the component registered.
|
|
408
|
+
*
|
|
409
|
+
*/
|
|
376
410
|
const steps: A_TYPES__FeatureStep[] = [];
|
|
411
|
+
// const feature: string = new ASEID({
|
|
412
|
+
// id: `${param2}-${Math.random()}`,
|
|
413
|
+
// entity: 'a-feature',
|
|
414
|
+
// namespace: component.constructor.name,
|
|
415
|
+
// scope: scope.name
|
|
416
|
+
// }).toString();
|
|
417
|
+
|
|
418
|
+
const feature = `${component.constructor.name}.${param2}`;
|
|
377
419
|
|
|
378
420
|
// Now we need to resolve the method from all registered components
|
|
379
421
|
|
|
@@ -401,7 +443,7 @@ export class A_Context {
|
|
|
401
443
|
fragments: config.fragments || [],
|
|
402
444
|
components: config.components || [],
|
|
403
445
|
steps,
|
|
404
|
-
parent: this.scope(component)
|
|
446
|
+
parent: component instanceof A_Container ? this.scope(component) : undefined
|
|
405
447
|
};
|
|
406
448
|
}
|
|
407
449
|
|
|
@@ -414,27 +456,31 @@ export class A_Context {
|
|
|
414
456
|
* @returns
|
|
415
457
|
*/
|
|
416
458
|
static feature<T extends Array<string>>(
|
|
459
|
+
scope: A_Scope,
|
|
417
460
|
entity: A_Entity<any, any, T>,
|
|
418
461
|
feature: A_TYPES__EntityBaseMethod | string | T[number] | RegExp,
|
|
419
462
|
params?: Partial<A_TYPES__ScopeConstructor>
|
|
420
463
|
): A_Feature
|
|
421
464
|
static feature<T extends Array<string>>(
|
|
465
|
+
scope: A_Scope,
|
|
422
466
|
container: A_Container<T>,
|
|
423
467
|
feature: T[number],
|
|
424
468
|
params?: Partial<A_TYPES__ScopeConstructor>
|
|
425
469
|
): A_Feature
|
|
426
470
|
static feature(
|
|
471
|
+
scope: A_Scope,
|
|
427
472
|
component: A_Component,
|
|
428
473
|
feature: string,
|
|
429
474
|
params?: Partial<A_TYPES__ScopeConstructor>
|
|
430
475
|
): A_Feature
|
|
431
476
|
static feature<T extends Array<string>>(
|
|
477
|
+
scope: A_Scope,
|
|
432
478
|
param1: A_Component<T> | A_Container<T> | A_Entity<any, any, T>,
|
|
433
479
|
param2: string | T[number],
|
|
434
480
|
param3?: Partial<A_TYPES__ScopeConstructor>
|
|
435
481
|
): A_Feature {
|
|
436
482
|
|
|
437
|
-
const featureConstructor = this.featureDefinition(param1, param2, param3);
|
|
483
|
+
const featureConstructor = this.featureDefinition(scope, param1, param2, param3);
|
|
438
484
|
|
|
439
485
|
const newFeature = new A_Feature(featureConstructor);
|
|
440
486
|
|
|
@@ -175,7 +175,7 @@ export class A_Entity<
|
|
|
175
175
|
? param2 || {}
|
|
176
176
|
: param1;
|
|
177
177
|
|
|
178
|
-
const newFeature = A_Context.feature(this, feature, params);
|
|
178
|
+
const newFeature = A_Context.feature(A_Context.scope(this), this, feature, params);
|
|
179
179
|
|
|
180
180
|
return await newFeature.process();
|
|
181
181
|
}
|
|
@@ -185,7 +185,7 @@ export class A_Entity<
|
|
|
185
185
|
// ================== Entity Base Methods =============================
|
|
186
186
|
// ====================================================================
|
|
187
187
|
|
|
188
|
-
|
|
188
|
+
|
|
189
189
|
async load() {
|
|
190
190
|
await this.call(A_TYPES__EntityBaseMethod.DESTROY, {
|
|
191
191
|
fragments: [
|
|
@@ -195,7 +195,7 @@ export class A_Entity<
|
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
|
|
198
|
-
|
|
198
|
+
|
|
199
199
|
async destroy() {
|
|
200
200
|
await this.call(A_TYPES__EntityBaseMethod.DESTROY, {
|
|
201
201
|
fragments: [
|
|
@@ -205,7 +205,7 @@ export class A_Entity<
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
|
|
208
|
-
|
|
208
|
+
|
|
209
209
|
async save() {
|
|
210
210
|
await this.call(A_TYPES__EntityBaseMethod.SAVE, {
|
|
211
211
|
fragments: [
|
|
@@ -245,6 +245,6 @@ export class A_Entity<
|
|
|
245
245
|
|
|
246
246
|
|
|
247
247
|
toString(): string {
|
|
248
|
-
return this.aseid? this.aseid.toString() : this.constructor.name;
|
|
248
|
+
return this.aseid ? this.aseid.toString() : this.constructor.name;
|
|
249
249
|
}
|
|
250
250
|
}
|