@adaas/a-concept 0.0.5 → 0.0.7
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/components/A.component.d.ts +4 -2
- package/dist/examples/simple/components/A.component.js +7 -4
- package/dist/examples/simple/components/A.component.js.map +1 -1
- package/dist/examples/simple/components/B.component.d.ts +6 -2
- package/dist/examples/simple/components/B.component.js +18 -7
- package/dist/examples/simple/components/B.component.js.map +1 -1
- package/dist/examples/simple/concept.js +59 -32
- package/dist/examples/simple/concept.js.map +1 -1
- package/dist/examples/simple/containers/Main.container.d.ts +1 -2
- package/dist/examples/simple/containers/Main.container.js +18 -5
- package/dist/examples/simple/containers/Main.container.js.map +1 -1
- package/dist/examples/simple-http-server/components/http-error-handler.component.d.ts +2 -1
- package/dist/examples/simple-http-server/components/http-error-handler.component.js +3 -1
- package/dist/examples/simple-http-server/components/http-error-handler.component.js.map +1 -1
- package/dist/examples/simple-http-server/components/http-request-handler.component.d.ts +2 -1
- package/dist/examples/simple-http-server/components/http-request-handler.component.js +2 -1
- package/dist/examples/simple-http-server/components/http-request-handler.component.js.map +1 -1
- package/dist/examples/simple-http-server/containers/http-server.container.d.ts +1 -2
- package/dist/index.d.ts +5 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/src/base/A-Config/A-Config.container.d.ts +1 -3
- package/dist/src/base/A-Config/A-Config.container.js +6 -22
- package/dist/src/base/A-Config/A-Config.container.js.map +1 -1
- package/dist/src/base/A-Config/A-Config.context.d.ts +1 -0
- package/dist/src/base/A-Config/A-Config.context.js +20 -2
- package/dist/src/base/A-Config/A-Config.context.js.map +1 -1
- package/dist/src/base/A-Config/A-Config.types.d.ts +2 -2
- package/dist/src/base/A-Config/components/ConfigReader.component.d.ts +2 -1
- package/dist/src/base/A-Config/components/ConfigReader.component.js +3 -1
- package/dist/src/base/A-Config/components/ConfigReader.component.js.map +1 -1
- package/dist/src/base/A-Errors/A-Errors.component.d.ts +2 -1
- package/dist/src/base/A-Errors/A-Errors.component.js +3 -1
- package/dist/src/base/A-Errors/A-Errors.component.js.map +1 -1
- package/dist/src/base/A-Logger/A-Logger.component.d.ts +4 -2
- package/dist/src/base/A-Logger/A-Logger.component.js +11 -3
- package/dist/src/base/A-Logger/A-Logger.component.js.map +1 -1
- 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 +9 -9
- package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.js.map +1 -1
- package/dist/src/decorators/A-Inject/A-Inject.decorator.d.ts +0 -2
- package/dist/src/decorators/A-Inject/A-Inject.decorator.js +4 -2
- package/dist/src/decorators/A-Inject/A-Inject.decorator.js.map +1 -1
- package/dist/src/global/A-Component/A-Component.class.d.ts +28 -1
- package/dist/src/global/A-Component/A-Component.class.js +22 -0
- package/dist/src/global/A-Component/A-Component.class.js.map +1 -1
- package/dist/src/global/A-Component/A-Component.meta.d.ts +8 -1
- package/dist/src/global/A-Component/A-Component.meta.js +26 -0
- package/dist/src/global/A-Component/A-Component.meta.js.map +1 -1
- package/dist/src/global/A-Component/A-Component.types.d.ts +43 -6
- package/dist/src/global/A-Component/A-Component.types.js +5 -0
- package/dist/src/global/A-Component/A-Component.types.js.map +1 -1
- package/dist/src/global/A-Concept/A_Concept.class.d.ts +7 -7
- package/dist/src/global/A-Concept/A_Concept.class.js +1 -2
- package/dist/src/global/A-Concept/A_Concept.class.js.map +1 -1
- package/dist/src/global/A-Container/A-Container.class.d.ts +5 -4
- package/dist/src/global/A-Container/A-Container.class.js +13 -24
- package/dist/src/global/A-Container/A-Container.class.js.map +1 -1
- package/dist/src/global/A-Container/A-Container.meta.d.ts +0 -3
- package/dist/src/global/A-Container/A-Container.meta.js +0 -46
- package/dist/src/global/A-Container/A-Container.meta.js.map +1 -1
- package/dist/src/global/A-Context/A-Context.class.d.ts +35 -5
- package/dist/src/global/A-Context/A-Context.class.js +135 -53
- package/dist/src/global/A-Context/A-Context.class.js.map +1 -1
- package/dist/src/global/A-Context/A-Context.types.d.ts +0 -12
- package/dist/src/global/A-Context/A-Context.types.js +0 -1
- package/dist/src/global/A-Entity/A-Entity.class.d.ts +28 -4
- package/dist/src/global/A-Entity/A-Entity.class.js +23 -3
- package/dist/src/global/A-Entity/A-Entity.class.js.map +1 -1
- package/dist/src/global/A-Entity/A-Entity.meta.d.ts +4 -0
- package/dist/src/global/A-Entity/A-Entity.meta.js +8 -0
- package/dist/src/global/A-Entity/A-Entity.meta.js.map +1 -0
- package/dist/src/global/A-Entity/A-Entity.types.d.ts +43 -0
- package/dist/src/global/A-Entity/A-Entity.types.js +13 -0
- package/dist/src/global/A-Entity/A-Entity.types.js.map +1 -1
- package/dist/src/global/A-Feature/A-Feature.class.d.ts +11 -1
- package/dist/src/global/A-Feature/A-Feature.class.js +48 -12
- package/dist/src/global/A-Feature/A-Feature.class.js.map +1 -1
- package/dist/src/global/A-Feature/A-Feature.types.d.ts +5 -4
- package/dist/src/global/A-Feature/A-Feature.types.js.map +1 -1
- package/dist/src/global/A-Fragment/A-Fragment.class.js +1 -2
- package/dist/src/global/A-Fragment/A-Fragment.class.js.map +1 -1
- package/dist/src/global/A-Meta/A-Meta.class.d.ts +75 -1
- package/dist/src/global/A-Meta/A-Meta.class.js +100 -10
- package/dist/src/global/A-Meta/A-Meta.class.js.map +1 -1
- package/dist/src/global/A-Scope/A-Scope.class.d.ts +15 -6
- package/dist/src/global/A-Scope/A-Scope.class.js +53 -17
- package/dist/src/global/A-Scope/A-Scope.class.js.map +1 -1
- package/examples/simple/components/A.component.ts +6 -3
- package/examples/simple/components/B.component.ts +19 -6
- package/examples/simple/concept.ts +65 -33
- package/examples/simple/containers/Main.container.ts +28 -7
- package/examples/simple-http-server/components/http-error-handler.component.ts +5 -2
- package/examples/simple-http-server/components/http-request-handler.component.ts +3 -1
- package/index.ts +6 -1
- package/package.json +1 -1
- package/src/base/A-Config/A-Config.container.ts +5 -8
- package/src/base/A-Config/A-Config.context.ts +10 -2
- package/src/base/A-Config/A-Config.types.ts +2 -2
- package/src/base/A-Config/components/ConfigReader.component.ts +5 -2
- package/src/base/A-Errors/A-Errors.component.ts +3 -2
- package/src/base/A-Logger/A-Logger.component.ts +21 -3
- package/src/decorators/A-Feature/A-Feature-Define.decorator.ts +0 -1
- package/src/decorators/A-Feature/A-Feature-Extend.decorator.ts +15 -10
- package/src/decorators/A-Inject/A-Inject.decorator.ts +13 -11
- package/src/global/A-Component/A-Component.class.ts +56 -1
- package/src/global/A-Component/A-Component.meta.ts +40 -1
- package/src/global/A-Component/A-Component.types.ts +51 -19
- package/src/global/A-Concept/A_Concept.class.ts +2 -2
- package/src/global/A-Container/A-Container.class.ts +22 -34
- package/src/global/A-Container/A-Container.meta.ts +0 -64
- package/src/global/A-Context/A-Context.class.ts +240 -79
- package/src/global/A-Context/A-Context.types.ts +0 -15
- package/src/global/A-Entity/A-Entity.class.ts +65 -8
- package/src/global/A-Entity/A-Entity.meta.ts +9 -0
- package/src/global/A-Entity/A-Entity.types.ts +58 -0
- package/src/global/A-Feature/A-Feature.class.ts +62 -20
- package/src/global/A-Feature/A-Feature.types.ts +8 -2
- package/src/global/A-Fragment/A-Fragment.class.ts +1 -5
- package/src/global/A-Meta/A-Meta.class.ts +114 -22
- package/src/global/A-Scope/A-Scope.class.ts +93 -33
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.A_Container = void 0;
|
|
13
|
-
const A_Feature_class_1 = require("../A-Feature/A-Feature.class");
|
|
14
13
|
const A_Context_class_1 = require("../A-Context/A-Context.class");
|
|
15
14
|
/**
|
|
16
15
|
* This class should combine Components to achieve the goal withing Concept
|
|
@@ -30,6 +29,9 @@ class A_Container {
|
|
|
30
29
|
get name() {
|
|
31
30
|
return this.config.name || this.constructor.name;
|
|
32
31
|
}
|
|
32
|
+
get Scope() {
|
|
33
|
+
return A_Context_class_1.A_Context.scope(this);
|
|
34
|
+
}
|
|
33
35
|
constructor(
|
|
34
36
|
/**
|
|
35
37
|
* Configuration of the container that will be used to run it.
|
|
@@ -38,10 +40,7 @@ class A_Container {
|
|
|
38
40
|
this.config = config;
|
|
39
41
|
const components = config.components || [];
|
|
40
42
|
const fragments = config.fragments || [];
|
|
41
|
-
A_Context_class_1.A_Context.allocate(this,
|
|
42
|
-
components,
|
|
43
|
-
fragments
|
|
44
|
-
});
|
|
43
|
+
A_Context_class_1.A_Context.allocate(this, config);
|
|
45
44
|
/**
|
|
46
45
|
* Run Async Initialization
|
|
47
46
|
*/
|
|
@@ -74,26 +73,16 @@ class A_Container {
|
|
|
74
73
|
});
|
|
75
74
|
}
|
|
76
75
|
call(param1, param2) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
params =
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
const meta = A_Context_class_1.A_Context.meta(this);
|
|
88
|
-
const steps = meta.feature(this, feature);
|
|
89
|
-
const newFeature = new A_Feature_class_1.A_Feature({
|
|
90
|
-
name: `${this.constructor.name}.${feature}`,
|
|
91
|
-
fragments: (param2 === null || param2 === void 0 ? void 0 : param2.fragments) || [],
|
|
92
|
-
components: (param2 === null || param2 === void 0 ? void 0 : param2.components) || [],
|
|
93
|
-
steps,
|
|
94
|
-
parent: A_Context_class_1.A_Context.scope(this)
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
const feature = typeof param1 === 'string'
|
|
78
|
+
? param1
|
|
79
|
+
: param1.name;
|
|
80
|
+
const params = typeof param1 === 'string'
|
|
81
|
+
? param2 || {}
|
|
82
|
+
: param1;
|
|
83
|
+
const newFeature = A_Context_class_1.A_Context.feature(this, feature, params);
|
|
84
|
+
return yield newFeature.process();
|
|
95
85
|
});
|
|
96
|
-
return newFeature;
|
|
97
86
|
}
|
|
98
87
|
// ==============================================================
|
|
99
88
|
// ======================= HOOKS ================================
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Container.class.js","sourceRoot":"","sources":["../../../../src/global/A-Container/A-Container.class.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"A-Container.class.js","sourceRoot":"","sources":["../../../../src/global/A-Container/A-Container.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,kEAAyD;AAKzD;;;;;;;;;;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,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;wBAGzB,OAAO,OAAO,EAAE,CAAC;oBACrB,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBACb,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;oBACzB,CAAC;gBACL,CAAC,CAAA,CAAC,CAAC;;gBAEH,MAAM,IAAI,CAAC,KAAK,CAAC;QACzB,CAAC;KAAA;IAoCK,IAAI,CACN,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,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;YAE5D,OAAO,MAAM,UAAU,CAAC,OAAO,EAAE,CAAC;QACtC,CAAC;KAAA;IAID,iEAAiE;IACjE,iEAAiE;IACjE,iEAAiE;IAEjE;;;;OAIG;IACa,YAAY;;YACxB,OAAO;QACX,CAAC;KAAA;IAED;;OAEG;IACa,MAAM;;YAClB,OAAO;QACX,CAAC;KAAA;IAED;;;;OAIG;IACa,WAAW;;YACvB,OAAO;QACX,CAAC;KAAA;CAEJ;AA7JD,kCA6JC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { A_TYPES__FeatureStep } from "../A-Feature/A-Feature.types";
|
|
2
1
|
import { A_Meta } from "../A-Meta/A-Meta.class";
|
|
3
|
-
import { A_Container } from "./A-Container.class";
|
|
4
2
|
import { A_TYPES__ContainerMeta } from "./A-Container.types";
|
|
5
3
|
export declare class A_ContainerMeta extends A_Meta<A_TYPES__ContainerMeta> {
|
|
6
|
-
feature<T extends string>(container: A_Container<any>, name: T): A_TYPES__FeatureStep[];
|
|
7
4
|
}
|
|
@@ -1,54 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.A_ContainerMeta = void 0;
|
|
4
|
-
const A_Component_types_1 = require("../A-Component/A-Component.types");
|
|
5
|
-
const A_Context_class_1 = require("../A-Context/A-Context.class");
|
|
6
4
|
const A_Meta_class_1 = require("../A-Meta/A-Meta.class");
|
|
7
|
-
const A_Container_types_1 = require("./A-Container.types");
|
|
8
5
|
class A_ContainerMeta extends A_Meta_class_1.A_Meta {
|
|
9
|
-
feature(container, name) {
|
|
10
|
-
const scope = A_Context_class_1.A_Context.scope(container);
|
|
11
|
-
// First lets validate that there'are registered method with the same name
|
|
12
|
-
const featureMeta = this.get(A_Container_types_1.A_TYPES__ContainerMetaKey.FEATURES);
|
|
13
|
-
if (!featureMeta) {
|
|
14
|
-
throw new Error(`Container ${container.constructor.name} has no metadata defined`);
|
|
15
|
-
}
|
|
16
|
-
const instruction = featureMeta.get(name);
|
|
17
|
-
if (!instruction)
|
|
18
|
-
throw new Error(`Method ${name} is not defined in ${this.constructor.name}`);
|
|
19
|
-
// const scope = new A_Scope({
|
|
20
|
-
// name: `${this.constructor.name}.${feature}`,
|
|
21
|
-
// fragments: param2?.fragments || [],
|
|
22
|
-
// components: param2?.components || []
|
|
23
|
-
// }, {
|
|
24
|
-
// parent: this.scope
|
|
25
|
-
// });
|
|
26
|
-
// Now we need to resolve the method from all registered components
|
|
27
|
-
return scope
|
|
28
|
-
.components
|
|
29
|
-
.reduce((acc, component) => {
|
|
30
|
-
const componentMeta = A_Context_class_1.A_Context.meta(component);
|
|
31
|
-
const extensions = componentMeta.get(A_Component_types_1.A_TYPES__ComponentMetaKey.EXTENSIONS) || [];
|
|
32
|
-
const injections = componentMeta.get(A_Component_types_1.A_TYPES__ComponentMetaKey.INJECTIONS);
|
|
33
|
-
const out = [];
|
|
34
|
-
extensions.forEach((extension, handler) => {
|
|
35
|
-
if (extension.name === name
|
|
36
|
-
&&
|
|
37
|
-
(extension.container === container.constructor.name || extension.container === '*')) {
|
|
38
|
-
const args = (injections === null || injections === void 0 ? void 0 : injections.get(handler)) || [];
|
|
39
|
-
out.push({
|
|
40
|
-
component,
|
|
41
|
-
handler,
|
|
42
|
-
args
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
return [
|
|
47
|
-
...acc,
|
|
48
|
-
...out
|
|
49
|
-
];
|
|
50
|
-
}, []);
|
|
51
|
-
}
|
|
52
6
|
}
|
|
53
7
|
exports.A_ContainerMeta = A_ContainerMeta;
|
|
54
8
|
//# sourceMappingURL=A-Container.meta.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Container.meta.js","sourceRoot":"","sources":["../../../../src/global/A-Container/A-Container.meta.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"A-Container.meta.js","sourceRoot":"","sources":["../../../../src/global/A-Container/A-Container.meta.ts"],"names":[],"mappings":";;;AAGA,yDAAgD;AAShD,MAAa,eAAgB,SAAQ,qBAA8B;CAGlE;AAHD,0CAGC"}
|
|
@@ -8,6 +8,9 @@ import { A_Meta } from "../A-Meta/A-Meta.class";
|
|
|
8
8
|
import { A_ComponentMeta } from "../A-Component/A-Component.meta";
|
|
9
9
|
import { A_ContainerMeta } from "../A-Container/A-Container.meta";
|
|
10
10
|
import { A_Concept } from "../A-Concept/A_Concept.class";
|
|
11
|
+
import { A_TYPES__EntityBaseMethod } from "../A-Entity/A-Entity.types";
|
|
12
|
+
import { A_Entity } from "../A-Entity/A-Entity.class";
|
|
13
|
+
import { A_EntityMeta } from "../A-Entity/A-Entity.meta";
|
|
11
14
|
/**
|
|
12
15
|
* Namespace Provider is responsible for providing the Namespace to the Containers and other Namespaces.
|
|
13
16
|
* This class stores all Namespaces across the Program.
|
|
@@ -29,12 +32,17 @@ export declare class A_Context {
|
|
|
29
32
|
* A set of globally registered concepts.
|
|
30
33
|
*/
|
|
31
34
|
protected concepts: WeakMap<A_Concept<any>, A_Scope>;
|
|
35
|
+
/**
|
|
36
|
+
* Uses to store the scope of every element in the program.
|
|
37
|
+
*/
|
|
38
|
+
protected registry: WeakMap<A_Concept<any> | A_Container<any> | A_Feature | A_Component | A_Fragment | A_Entity, A_Scope>;
|
|
32
39
|
/**
|
|
33
40
|
* A set of allocated scopes per every element in the program.
|
|
34
41
|
*/
|
|
35
42
|
protected conceptsMeta: Map<typeof A_Concept.constructor, A_Meta<any>>;
|
|
36
43
|
protected containersMeta: Map<typeof A_Container.constructor, A_ContainerMeta>;
|
|
37
|
-
protected componentsMeta: Map<typeof
|
|
44
|
+
protected componentsMeta: Map<typeof A_Component, A_ComponentMeta>;
|
|
45
|
+
protected entitiesMeta: Map<typeof A_Entity.constructor, A_EntityMeta>;
|
|
38
46
|
protected customMeta: Map<typeof A_Container.constructor, A_Meta<any>>;
|
|
39
47
|
/**
|
|
40
48
|
* Root Namespace is a Namespace that is used to run the program.
|
|
@@ -54,18 +62,40 @@ export declare class A_Context {
|
|
|
54
62
|
static allocate(container: A_Container<any>, importing: Partial<A_TYPES__ScopeConstructor & A_TYPES__ScopeConfig>): A_Scope;
|
|
55
63
|
static meta(container: typeof A_Container): A_ContainerMeta;
|
|
56
64
|
static meta(container: A_Container<any>): A_ContainerMeta;
|
|
65
|
+
static meta(entity: A_Entity): A_ContainerMeta;
|
|
57
66
|
static meta(component: typeof A_Component): A_ComponentMeta;
|
|
58
67
|
static meta(component: A_Component): A_ComponentMeta;
|
|
59
68
|
static meta<T extends Record<string, any>>(component: {
|
|
60
69
|
new (...args: any[]): any;
|
|
61
70
|
}): A_Meta<T>;
|
|
71
|
+
static scope(entity: A_Entity): A_Scope;
|
|
72
|
+
static scope(component: A_Component): A_Scope;
|
|
62
73
|
static scope(concept: A_Concept): A_Scope;
|
|
63
|
-
static scope(
|
|
64
|
-
static scope(
|
|
74
|
+
static scope(container: A_Container<any>): A_Scope;
|
|
75
|
+
static scope(feature: A_Fragment): A_Scope;
|
|
76
|
+
static scope(feature: A_Feature): A_Scope;
|
|
77
|
+
/**
|
|
78
|
+
* This method returns a component by its meta.
|
|
79
|
+
*
|
|
80
|
+
* @param meta
|
|
81
|
+
* @returns
|
|
82
|
+
*/
|
|
83
|
+
static component(meta: A_ComponentMeta): typeof A_Component;
|
|
84
|
+
/**
|
|
85
|
+
* This method returns a step-by-step instructions of feature implementation depending on the feature name and the class.
|
|
86
|
+
*
|
|
87
|
+
* @param scope
|
|
88
|
+
* @returns
|
|
89
|
+
*/
|
|
90
|
+
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;
|
|
91
|
+
static feature<T extends Array<string>>(container: A_Container<T>, feature: T[number], params?: Partial<A_TYPES__ScopeConstructor>): A_Feature;
|
|
92
|
+
static feature(component: A_Component, feature: string, params?: Partial<A_TYPES__ScopeConstructor>): A_Feature;
|
|
65
93
|
/**
|
|
66
94
|
* Register a Namespace in the provider.
|
|
67
95
|
* @param Namespace
|
|
68
96
|
*/
|
|
69
|
-
static register(
|
|
70
|
-
static register(
|
|
97
|
+
static register(scope: A_Scope, container: A_Container<any>): any;
|
|
98
|
+
static register(scope: A_Scope, entity: A_Entity): any;
|
|
99
|
+
static register(scope: A_Scope, component: A_Component): any;
|
|
100
|
+
static register(scope: A_Scope, fragment: A_Fragment): any;
|
|
71
101
|
}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.A_Context = void 0;
|
|
4
4
|
const a_utils_1 = require("@adaas/a-utils");
|
|
5
5
|
const A_Component_class_1 = require("../A-Component/A-Component.class");
|
|
6
|
+
const A_Fragment_class_1 = require("../A-Fragment/A-Fragment.class");
|
|
6
7
|
const A_Feature_class_1 = require("../A-Feature/A-Feature.class");
|
|
7
8
|
const A_Container_class_1 = require("../A-Container/A-Container.class");
|
|
8
9
|
const A_Scope_class_1 = require("../A-Scope/A-Scope.class");
|
|
@@ -10,6 +11,8 @@ const A_Meta_class_1 = require("../A-Meta/A-Meta.class");
|
|
|
10
11
|
const A_Component_meta_1 = require("../A-Component/A-Component.meta");
|
|
11
12
|
const A_Container_meta_1 = require("../A-Container/A-Container.meta");
|
|
12
13
|
const A_Concept_class_1 = require("../A-Concept/A_Concept.class");
|
|
14
|
+
const A_Entity_class_1 = require("../A-Entity/A-Entity.class");
|
|
15
|
+
const A_Entity_meta_1 = require("../A-Entity/A-Entity.meta");
|
|
13
16
|
/**
|
|
14
17
|
* Namespace Provider is responsible for providing the Namespace to the Containers and other Namespaces.
|
|
15
18
|
* This class stores all Namespaces across the Program.
|
|
@@ -31,6 +34,10 @@ class A_Context {
|
|
|
31
34
|
* A set of globally registered concepts.
|
|
32
35
|
*/
|
|
33
36
|
this.concepts = new WeakMap();
|
|
37
|
+
/**
|
|
38
|
+
* Uses to store the scope of every element in the program.
|
|
39
|
+
*/
|
|
40
|
+
this.registry = new WeakMap();
|
|
34
41
|
/**
|
|
35
42
|
* A set of allocated scopes per every element in the program.
|
|
36
43
|
*/
|
|
@@ -38,6 +45,7 @@ class A_Context {
|
|
|
38
45
|
this.conceptsMeta = new Map();
|
|
39
46
|
this.containersMeta = new Map();
|
|
40
47
|
this.componentsMeta = new Map();
|
|
48
|
+
this.entitiesMeta = new Map();
|
|
41
49
|
// uses to allow to store custom meta data
|
|
42
50
|
this.customMeta = new Map();
|
|
43
51
|
}
|
|
@@ -83,63 +91,56 @@ class A_Context {
|
|
|
83
91
|
const instance = this.getInstance();
|
|
84
92
|
let metaStorage;
|
|
85
93
|
let property;
|
|
86
|
-
let
|
|
94
|
+
let metaType;
|
|
87
95
|
switch (true) {
|
|
88
96
|
case param1 instanceof A_Container_class_1.A_Container: {
|
|
89
97
|
metaStorage = instance.containersMeta;
|
|
90
98
|
property = param1.constructor;
|
|
91
|
-
|
|
92
|
-
const inheritMeta = metaStorage.get(Object.getPrototypeOf(property)) || new A_Container_meta_1.A_ContainerMeta();
|
|
93
|
-
metaStorage.set(property, new A_Container_meta_1.A_ContainerMeta().from(inheritMeta));
|
|
94
|
-
}
|
|
95
|
-
meta = metaStorage.get(property);
|
|
99
|
+
metaType = A_Container_meta_1.A_ContainerMeta;
|
|
96
100
|
break;
|
|
97
101
|
}
|
|
98
102
|
case a_utils_1.A_CommonHelper.isInheritedFrom(param1, A_Container_class_1.A_Container): {
|
|
99
103
|
metaStorage = instance.containersMeta;
|
|
100
104
|
property = param1;
|
|
101
|
-
|
|
102
|
-
const inheritMeta = metaStorage.get(Object.getPrototypeOf(property)) || new A_Container_meta_1.A_ContainerMeta();
|
|
103
|
-
metaStorage.set(property, new A_Container_meta_1.A_ContainerMeta().from(inheritMeta));
|
|
104
|
-
}
|
|
105
|
-
meta = metaStorage.get(property);
|
|
105
|
+
metaType = A_Container_meta_1.A_ContainerMeta;
|
|
106
106
|
break;
|
|
107
107
|
}
|
|
108
108
|
case param1 instanceof A_Component_class_1.A_Component: {
|
|
109
109
|
metaStorage = instance.componentsMeta;
|
|
110
110
|
property = param1.constructor;
|
|
111
|
-
|
|
112
|
-
const inheritMeta = metaStorage.get(Object.getPrototypeOf(property)) || new A_Component_meta_1.A_ComponentMeta();
|
|
113
|
-
metaStorage.set(property, new A_Component_meta_1.A_ComponentMeta().from(inheritMeta));
|
|
114
|
-
}
|
|
115
|
-
meta = metaStorage.get(property);
|
|
111
|
+
metaType = A_Component_meta_1.A_ComponentMeta;
|
|
116
112
|
break;
|
|
117
113
|
}
|
|
118
114
|
case a_utils_1.A_CommonHelper.isInheritedFrom(param1, A_Component_class_1.A_Component): {
|
|
119
115
|
metaStorage = instance.componentsMeta;
|
|
120
116
|
property = param1;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
117
|
+
metaType = A_Component_meta_1.A_ComponentMeta;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
case param1 instanceof A_Entity_class_1.A_Entity: {
|
|
121
|
+
metaStorage = instance.entitiesMeta;
|
|
122
|
+
property = param1.constructor;
|
|
123
|
+
metaType = A_Component_meta_1.A_ComponentMeta;
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
case a_utils_1.A_CommonHelper.isInheritedFrom(param1, A_Entity_class_1.A_Entity): {
|
|
127
|
+
metaStorage = instance.entitiesMeta;
|
|
128
|
+
property = param1;
|
|
129
|
+
metaType = A_Entity_meta_1.A_EntityMeta;
|
|
126
130
|
break;
|
|
127
131
|
}
|
|
128
132
|
default: {
|
|
129
133
|
metaStorage = instance.customMeta;
|
|
130
134
|
property = typeof param1 === 'function' ? param1 : param1.constructor;
|
|
131
|
-
|
|
132
|
-
const inheritMeta = metaStorage.get(Object.getPrototypeOf(property)) || new A_Meta_class_1.A_Meta();
|
|
133
|
-
metaStorage.set(property, new A_Meta_class_1.A_Meta().from(inheritMeta));
|
|
134
|
-
}
|
|
135
|
-
meta = metaStorage.get(property);
|
|
135
|
+
metaType = A_Meta_class_1.A_Meta;
|
|
136
136
|
break;
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
if (!metaStorage.has(property)) {
|
|
140
|
+
const inheritMeta = metaStorage.get(Object.getPrototypeOf(property)) || new metaType();
|
|
141
|
+
metaStorage.set(property, new metaType().from(inheritMeta));
|
|
142
|
+
}
|
|
143
|
+
return metaStorage.get(property);
|
|
143
144
|
}
|
|
144
145
|
static scope(param1) {
|
|
145
146
|
const instance = this.getInstance();
|
|
@@ -150,36 +151,117 @@ class A_Context {
|
|
|
150
151
|
return instance.features.get(param1);
|
|
151
152
|
case param1 instanceof A_Concept_class_1.A_Concept:
|
|
152
153
|
return instance.concepts.get(param1);
|
|
154
|
+
case param1 instanceof A_Entity_class_1.A_Entity:
|
|
155
|
+
return instance.registry.get(param1);
|
|
156
|
+
case param1 instanceof A_Component_class_1.A_Component:
|
|
157
|
+
return instance.registry.get(param1);
|
|
158
|
+
case param1 instanceof A_Fragment_class_1.A_Fragment:
|
|
159
|
+
return instance.registry.get(param1);
|
|
153
160
|
default:
|
|
154
161
|
throw new Error(`[!] A-Concept Context: Unknown type of the parameter.`);
|
|
155
162
|
}
|
|
156
163
|
}
|
|
157
|
-
|
|
164
|
+
/**
|
|
165
|
+
* This method returns a component by its meta.
|
|
166
|
+
*
|
|
167
|
+
* @param meta
|
|
168
|
+
* @returns
|
|
169
|
+
*/
|
|
170
|
+
static component(meta) {
|
|
158
171
|
const instance = this.getInstance();
|
|
159
|
-
let
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
172
|
+
let component;
|
|
173
|
+
instance.componentsMeta.forEach((meta, constructor) => {
|
|
174
|
+
if (meta === meta) {
|
|
175
|
+
component = constructor;
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
if (!component) {
|
|
179
|
+
throw new Error(`[!] A-Concept Context: Component not found.`);
|
|
164
180
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
181
|
+
return component;
|
|
182
|
+
}
|
|
183
|
+
static feature(param1, param2, param3) {
|
|
184
|
+
const instance = this.getInstance();
|
|
185
|
+
const component = param1;
|
|
186
|
+
const feature = param2;
|
|
187
|
+
const config = param3 || {};
|
|
188
|
+
// TODO: have no idea why it's not working because of that "any"
|
|
189
|
+
const scope = this.scope(component);
|
|
190
|
+
const steps = [];
|
|
191
|
+
// Now we need to resolve the method from all registered components
|
|
192
|
+
// We need to get all components that has extensions for the feature in component
|
|
193
|
+
instance.componentsMeta
|
|
194
|
+
.forEach((meta, constructor) => {
|
|
195
|
+
try {
|
|
196
|
+
// Just try to make sure that component not only Indexed but also presented in scope
|
|
197
|
+
scope.resolve(constructor);
|
|
198
|
+
// Get all extensions for the feature
|
|
199
|
+
meta
|
|
200
|
+
.extensions(feature)
|
|
201
|
+
.forEach(({ handler, args }) => {
|
|
202
|
+
steps.push({
|
|
203
|
+
component: constructor,
|
|
204
|
+
handler,
|
|
205
|
+
args
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
// do nothing
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
const newFeature = new A_Feature_class_1.A_Feature({
|
|
214
|
+
name: `${component.constructor.name}.${feature}`,
|
|
215
|
+
fragments: config.fragments,
|
|
216
|
+
components: config.components,
|
|
217
|
+
steps,
|
|
218
|
+
parent: component instanceof A_Container_class_1.A_Container ? this.scope(component) : undefined
|
|
219
|
+
});
|
|
220
|
+
return newFeature;
|
|
221
|
+
}
|
|
222
|
+
static register(scope, param1) {
|
|
223
|
+
const instance = this.getInstance();
|
|
224
|
+
switch (true) {
|
|
225
|
+
case param1 instanceof A_Component_class_1.A_Component:
|
|
226
|
+
instance.registry.set(param1, scope);
|
|
227
|
+
break;
|
|
228
|
+
case param1 instanceof A_Container_class_1.A_Container:
|
|
229
|
+
instance.registry.set(param1, scope);
|
|
230
|
+
break;
|
|
231
|
+
case param1 instanceof A_Entity_class_1.A_Entity:
|
|
232
|
+
instance.registry.set(param1, scope);
|
|
233
|
+
break;
|
|
234
|
+
case param1 instanceof A_Fragment_class_1.A_Fragment:
|
|
235
|
+
instance.registry.set(param1, scope);
|
|
236
|
+
break;
|
|
237
|
+
default:
|
|
238
|
+
instance.registry.set(param1, scope);
|
|
168
239
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
if (
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
//
|
|
182
|
-
|
|
240
|
+
// if (param1 instanceof A_Fragment) {
|
|
241
|
+
// const instance = this.getInstance();
|
|
242
|
+
// let fragment: A_Fragment;
|
|
243
|
+
// let name: string;
|
|
244
|
+
// if (typeof param2 === 'string') {
|
|
245
|
+
// name = param2;
|
|
246
|
+
// fragment = param1;
|
|
247
|
+
// } else {
|
|
248
|
+
// fragment = param1 as A_Fragment;
|
|
249
|
+
// name = fragment.name;
|
|
250
|
+
// }
|
|
251
|
+
// /**
|
|
252
|
+
// * If the namespace is not provided, then use the root namespace.
|
|
253
|
+
// * If the root namespace is not provided, then use the default namespace.
|
|
254
|
+
// */
|
|
255
|
+
// if (!name)
|
|
256
|
+
// name = this.root
|
|
257
|
+
// || process.env.ADAAS_NAMESPACE
|
|
258
|
+
// || process.env.A_NAMESPACE
|
|
259
|
+
// || process.env.ADAAS_APP_NAMESPACE
|
|
260
|
+
// || 'a-concept'
|
|
261
|
+
// if (!this.root)
|
|
262
|
+
// instance._root = name;
|
|
263
|
+
// // instance.namedFragments.set(namespace, Namespace);
|
|
264
|
+
// return name;
|
|
183
265
|
}
|
|
184
266
|
}
|
|
185
267
|
exports.A_Context = A_Context;
|
|
@@ -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,4CAA6D;AAC7D,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,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
3
|
-
scope: A_Scope;
|
|
4
|
-
steps: A_TYPES__ContextExecutionPipelineStep[];
|
|
5
|
-
};
|
|
6
|
-
export type A_TYPES__ContextExecutionPipelineStep = {
|
|
7
|
-
component: {
|
|
8
|
-
new (...args: any[]): any;
|
|
9
|
-
};
|
|
10
|
-
handler: string;
|
|
11
|
-
args: any[];
|
|
12
|
-
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { ASEID } from "@adaas/a-utils";
|
|
2
|
-
import { A_TYPES__Entity_JSON, A_TYPES__IEntity } from "./A-Entity.types";
|
|
3
|
-
import { A_Fragment } from "../A-Fragment/A-Fragment.class";
|
|
1
|
+
import { A_TYPES__Required, ASEID } from "@adaas/a-utils";
|
|
2
|
+
import { A_TYPES__Entity_JSON, A_TYPES__EntityBaseMethods, A_TYPES__EntityCallParams, A_TYPES__IEntity } from "./A-Entity.types";
|
|
4
3
|
/**
|
|
5
4
|
* A_Entity is another abstraction that describes all major participants in the system business logic.
|
|
6
5
|
* Each Entity should have a clear definition and a clear set of responsibilities.
|
|
@@ -8,7 +7,7 @@ import { A_Fragment } from "../A-Fragment/A-Fragment.class";
|
|
|
8
7
|
*
|
|
9
8
|
* Each entity should be connected to the ContextFragment (Scope) and should be able to communicate with other entities.
|
|
10
9
|
*/
|
|
11
|
-
export declare class A_Entity<_ConstructorType = any, _SerializedType extends A_TYPES__Entity_JSON = A_TYPES__Entity_JSON
|
|
10
|
+
export declare class A_Entity<_ConstructorType = any, _SerializedType extends A_TYPES__Entity_JSON = A_TYPES__Entity_JSON, _FeatureNames extends Array<string> = A_TYPES__EntityBaseMethods> implements A_TYPES__IEntity {
|
|
12
11
|
aseid: ASEID;
|
|
13
12
|
constructor(aseid: string);
|
|
14
13
|
constructor(aseid: ASEID);
|
|
@@ -44,6 +43,31 @@ export declare class A_Entity<_ConstructorType = any, _SerializedType extends A_
|
|
|
44
43
|
* shard is the shard of the entity
|
|
45
44
|
*/
|
|
46
45
|
get shard(): string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Call a feature of the component
|
|
48
|
+
*
|
|
49
|
+
* @param lifecycleMethod
|
|
50
|
+
* @param args
|
|
51
|
+
*/
|
|
52
|
+
call(
|
|
53
|
+
/**
|
|
54
|
+
* A-Feature method name to be called
|
|
55
|
+
*/
|
|
56
|
+
feature: _FeatureNames[number]): Promise<any>;
|
|
57
|
+
call(
|
|
58
|
+
/**
|
|
59
|
+
* A-Feature name to be called
|
|
60
|
+
*/
|
|
61
|
+
params: A_TYPES__Required<Partial<A_TYPES__EntityCallParams<_FeatureNames[number]>>, ['name']>): Promise<any>;
|
|
62
|
+
call(
|
|
63
|
+
/**
|
|
64
|
+
* A-Feature method name to be called
|
|
65
|
+
*/
|
|
66
|
+
feature: string,
|
|
67
|
+
/**
|
|
68
|
+
* Parameters to provide additional data to the feature
|
|
69
|
+
*/
|
|
70
|
+
params: Partial<A_TYPES__EntityCallParams<_FeatureNames[number]>>): Promise<any>;
|
|
47
71
|
protected fromNewEntity(newEntity: _ConstructorType): void;
|
|
48
72
|
protected fromSerialized(serialized: _SerializedType): void;
|
|
49
73
|
/**
|