@adaas/a-concept 0.0.7 → 0.0.9
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.d.ts +3 -1
- package/dist/src/decorators/A-Feature/A-Feature-Define.decorator.js +22 -4
- package/dist/src/decorators/A-Feature/A-Feature-Define.decorator.js.map +1 -1
- package/dist/src/decorators/A-Inject/A-Inject.decorator.d.ts +11 -4
- package/dist/src/decorators/A-Inject/A-Inject.decorator.js +5 -3
- package/dist/src/decorators/A-Inject/A-Inject.decorator.js.map +1 -1
- package/dist/src/global/A-Component/A-Component.types.d.ts +15 -2
- package/dist/src/global/A-Component/A-Component.types.js +1 -0
- package/dist/src/global/A-Component/A-Component.types.js.map +1 -1
- package/dist/src/global/A-Context/A-Context.class.d.ts +1 -0
- package/dist/src/global/A-Context/A-Context.class.js.map +1 -1
- package/dist/src/global/A-Entity/A-Entity.class.d.ts +8 -3
- package/dist/src/global/A-Entity/A-Entity.class.js +35 -1
- package/dist/src/global/A-Entity/A-Entity.class.js.map +1 -1
- package/dist/src/global/A-Feature/A-Feature.class.js +1 -1
- package/dist/src/global/A-Feature/A-Feature.class.js.map +1 -1
- package/dist/src/global/A-Feature/A-Feature.types.d.ts +2 -2
- package/dist/src/global/A-Scope/A-Scope.class.d.ts +6 -3
- package/dist/src/global/A-Scope/A-Scope.class.js +8 -2
- package/dist/src/global/A-Scope/A-Scope.class.js.map +1 -1
- package/package.json +1 -1
- package/src/decorators/A-Feature/A-Feature-Define.decorator.ts +31 -6
- package/src/decorators/A-Inject/A-Inject.decorator.ts +22 -20
- package/src/global/A-Component/A-Component.types.ts +16 -2
- package/src/global/A-Context/A-Context.class.ts +10 -1
- package/src/global/A-Entity/A-Entity.class.ts +30 -2
- package/src/global/A-Feature/A-Feature.class.ts +1 -1
- package/src/global/A-Feature/A-Feature.types.ts +2 -2
- package/src/global/A-Scope/A-Scope.class.ts +35 -8
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { A_Component } from "../../global/A-Component/A-Component.class";
|
|
1
2
|
import { A_TYPES__A_FeatureDecoratorConfig, A_TYPES__A_FeatureDecoratorDescriptor } from "./A-Feature.decorator.types";
|
|
2
3
|
import { A_Container } from "../../global/A-Container/A-Container.class";
|
|
4
|
+
import { A_Entity } from "@adaas/a-utils";
|
|
3
5
|
/**
|
|
4
6
|
* A-Feature decorator
|
|
5
7
|
*
|
|
@@ -13,4 +15,4 @@ import { A_Container } from "../../global/A-Container/A-Container.class";
|
|
|
13
15
|
* @param params
|
|
14
16
|
* @returns
|
|
15
17
|
*/
|
|
16
|
-
export declare function A_Feature_Define(config?: Partial<A_TYPES__A_FeatureDecoratorConfig>): (target: A_Container<any
|
|
18
|
+
export declare function A_Feature_Define(config?: Partial<A_TYPES__A_FeatureDecoratorConfig>): (target: A_Container<any> | A_Entity | A_Component, propertyKey: string, descriptor: A_TYPES__A_FeatureDecoratorDescriptor) => void;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.A_Feature_Define = A_Feature_Define;
|
|
4
|
+
const A_Component_class_1 = require("../../global/A-Component/A-Component.class");
|
|
5
|
+
const A_Container_class_1 = require("../../global/A-Container/A-Container.class");
|
|
4
6
|
const A_Container_types_1 = require("../../global/A-Container/A-Container.types");
|
|
5
7
|
const A_Context_class_1 = require("../../global/A-Context/A-Context.class");
|
|
8
|
+
const a_utils_1 = require("@adaas/a-utils");
|
|
9
|
+
const A_Entity_types_1 = require("../../global/A-Entity/A-Entity.types");
|
|
10
|
+
const A_Component_types_1 = require("../../global/A-Component/A-Component.types");
|
|
6
11
|
/**
|
|
7
12
|
* A-Feature decorator
|
|
8
13
|
*
|
|
@@ -18,10 +23,23 @@ const A_Context_class_1 = require("../../global/A-Context/A-Context.class");
|
|
|
18
23
|
*/
|
|
19
24
|
function A_Feature_Define(config = {}) {
|
|
20
25
|
return function (target, propertyKey, descriptor) {
|
|
26
|
+
const meta = A_Context_class_1.A_Context.meta(target);
|
|
27
|
+
let metaKey;
|
|
28
|
+
switch (true) {
|
|
29
|
+
case target instanceof a_utils_1.A_Entity:
|
|
30
|
+
metaKey = A_Entity_types_1.A_TYPES__EntityMetaKey.FEATURES;
|
|
31
|
+
break;
|
|
32
|
+
case target instanceof A_Container_class_1.A_Container:
|
|
33
|
+
metaKey = A_Container_types_1.A_TYPES__ContainerMetaKey.FEATURES;
|
|
34
|
+
break;
|
|
35
|
+
case target instanceof A_Component_class_1.A_Component:
|
|
36
|
+
metaKey = A_Component_types_1.A_TYPES__ComponentMetaKey.FEATURES;
|
|
37
|
+
break;
|
|
38
|
+
default:
|
|
39
|
+
throw new Error(`A-Feature cannot be defined on the ${target} level`);
|
|
40
|
+
}
|
|
21
41
|
// Get the existed metadata or create a new one
|
|
22
|
-
const existedMeta =
|
|
23
|
-
.meta(target)
|
|
24
|
-
.get(A_Container_types_1.A_TYPES__ContainerMetaKey.FEATURES)
|
|
42
|
+
const existedMeta = meta.get(metaKey)
|
|
25
43
|
|| new Map();
|
|
26
44
|
// Set the metadata of the method to define a custom Feature with name
|
|
27
45
|
existedMeta.set(propertyKey, {
|
|
@@ -31,7 +49,7 @@ function A_Feature_Define(config = {}) {
|
|
|
31
49
|
// Update the metadata of the container with the new Feature definition
|
|
32
50
|
A_Context_class_1.A_Context
|
|
33
51
|
.meta(target)
|
|
34
|
-
.set(
|
|
52
|
+
.set(metaKey, existedMeta);
|
|
35
53
|
};
|
|
36
54
|
}
|
|
37
55
|
//# sourceMappingURL=A-Feature-Define.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Feature-Define.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/A-Feature/A-Feature-Define.decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"A-Feature-Define.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/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"}
|
|
@@ -2,6 +2,9 @@ import { A_Component } from "../../global/A-Component/A-Component.class";
|
|
|
2
2
|
import { A_TYPES__A_InjectDecoratorReturn } from "./A-Inject.decorator.types";
|
|
3
3
|
import { A_Fragment } from "../../global/A-Fragment/A-Fragment.class";
|
|
4
4
|
import { A_Scope } from "../../global/A-Scope/A-Scope.class";
|
|
5
|
+
import { A_TYPES__ComponentMeta_EntityInjectionInstructions } from "../../global/A-Component/A-Component.types";
|
|
6
|
+
import { A_Feature } from "../../global/A-Feature/A-Feature.class";
|
|
7
|
+
import { A_Entity } from "../../global/A-Entity/A-Entity.class";
|
|
5
8
|
/**
|
|
6
9
|
* A-Inject decorator
|
|
7
10
|
*
|
|
@@ -14,9 +17,13 @@ import { A_Scope } from "../../global/A-Scope/A-Scope.class";
|
|
|
14
17
|
* @returns
|
|
15
18
|
*/
|
|
16
19
|
export declare function A_Inject(scope: typeof A_Scope): A_TYPES__A_InjectDecoratorReturn;
|
|
17
|
-
export declare function A_Inject(
|
|
20
|
+
export declare function A_Inject(feature: typeof A_Feature): A_TYPES__A_InjectDecoratorReturn;
|
|
18
21
|
export declare function A_Inject(component: {
|
|
19
|
-
new (...args: any[]):
|
|
22
|
+
new (...args: any[]): A_Component;
|
|
20
23
|
}): A_TYPES__A_InjectDecoratorReturn;
|
|
21
|
-
export declare function A_Inject(fragment:
|
|
22
|
-
|
|
24
|
+
export declare function A_Inject(fragment: {
|
|
25
|
+
new (...args: any[]): A_Fragment;
|
|
26
|
+
}): A_TYPES__A_InjectDecoratorReturn;
|
|
27
|
+
export declare function A_Inject(entity: {
|
|
28
|
+
new (...args: any[]): A_Entity;
|
|
29
|
+
}, config: Partial<A_TYPES__ComponentMeta_EntityInjectionInstructions>): A_TYPES__A_InjectDecoratorReturn;
|
|
@@ -5,16 +5,18 @@ const A_Context_class_1 = require("../../global/A-Context/A-Context.class");
|
|
|
5
5
|
const A_Component_types_1 = require("../../global/A-Component/A-Component.types");
|
|
6
6
|
const A_Meta_class_1 = require("../../global/A-Meta/A-Meta.class");
|
|
7
7
|
// ====================== BASE FUNCTION ======================
|
|
8
|
-
function A_Inject(param1) {
|
|
8
|
+
function A_Inject(param1, param2) {
|
|
9
9
|
return function (target, methodName, parameterIndex) {
|
|
10
10
|
const method = methodName ? String(methodName) : 'constructor';
|
|
11
|
-
console.log('target: ', target);
|
|
12
11
|
const existedMeta = A_Context_class_1.A_Context
|
|
13
12
|
.meta(target)
|
|
14
13
|
.get(A_Component_types_1.A_TYPES__ComponentMetaKey.INJECTIONS)
|
|
15
14
|
|| new A_Meta_class_1.A_Meta();
|
|
16
15
|
const paramsArray = existedMeta.get(method) || [];
|
|
17
|
-
paramsArray[parameterIndex] =
|
|
16
|
+
paramsArray[parameterIndex] = {
|
|
17
|
+
target: param1,
|
|
18
|
+
instructions: param2
|
|
19
|
+
};
|
|
18
20
|
existedMeta.set(method, paramsArray);
|
|
19
21
|
A_Context_class_1.A_Context
|
|
20
22
|
.meta(target)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Inject.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/A-Inject/A-Inject.decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"A-Inject.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/A-Inject/A-Inject.decorator.ts"],"names":[],"mappings":";;AAgDA,4BAyCC;AArFD,uFAA8E;AAC9E,6FAAsJ;AACtJ,8EAAqE;AAyCrE,8DAA8D;AAC9D,SAAgB,QAAQ,CACpB,MAIuC,EACvC,MAGC;IAED,OAAO,UACH,MAAmB,EACnB,UAAuC,EACvC,cAAsB;QAGtB,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;QAE/D,MAAM,WAAW,GAAG,2BAAS;aACxB,IAAI,CAAC,MAAM,CAAC;aACZ,GAAG,CAAC,6CAAyB,CAAC,UAAU,CAAC;eACvC,IAAI,qBAAM,EAAE,CAAC;QAGpB,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QAElD,WAAW,CAAC,cAAc,CAAC,GAAG;YAC1B,MAAM,EAAE,MAAM;YACd,YAAY,EAAE,MAAM;SACvB,CAAA;QAED,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QAErC,2BAAS;aACJ,IAAI,CAAC,MAAM,CAAC;aACZ,GAAG,CACA,6CAAyB,CAAC,UAAU,EACpC,WAAW,CACd,CAAC;IACV,CAAC,CAAA;AACL,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { A_Entity } from "../A-Entity/A-Entity.class";
|
|
1
2
|
import { A_Feature } from "../A-Feature/A-Feature.class";
|
|
2
3
|
import { A_Fragment } from "../A-Fragment/A-Fragment.class";
|
|
3
4
|
import { A_Meta } from "../A-Meta/A-Meta.class";
|
|
@@ -28,7 +29,7 @@ export type A_TYPES__ComponentMeta = {
|
|
|
28
29
|
*
|
|
29
30
|
* Where value is the list of injections
|
|
30
31
|
*/
|
|
31
|
-
[Key: string]:
|
|
32
|
+
[Key: string]: A_TYPES__ComponentMeta_InjectionParams;
|
|
32
33
|
}>;
|
|
33
34
|
};
|
|
34
35
|
export declare enum A_TYPES__ComponentMetaKey {
|
|
@@ -38,12 +39,24 @@ export declare enum A_TYPES__ComponentMetaKey {
|
|
|
38
39
|
}
|
|
39
40
|
export type A_TYPES__ComponentMetaExtension = {
|
|
40
41
|
handler: string;
|
|
41
|
-
args:
|
|
42
|
+
args: A_TYPES__ComponentMeta_InjectionParams;
|
|
42
43
|
};
|
|
43
44
|
export type A_TYPES__ComponentMeta_ExtensionItem = {
|
|
44
45
|
name: string;
|
|
45
46
|
handler: string;
|
|
46
47
|
};
|
|
48
|
+
export type A_TYPES__ComponentMeta_InjectionParams = Array<{
|
|
49
|
+
target: A_TYPES__ComponentMeta_InjectionParam;
|
|
50
|
+
} | {
|
|
51
|
+
target: {
|
|
52
|
+
new (...args: any[]): A_Entity;
|
|
53
|
+
};
|
|
54
|
+
instructions: Partial<A_TYPES__ComponentMeta_EntityInjectionInstructions>;
|
|
55
|
+
}>;
|
|
56
|
+
export type A_TYPES__ComponentMeta_EntityInjectionInstructions = {
|
|
57
|
+
aseid: string;
|
|
58
|
+
id: string;
|
|
59
|
+
};
|
|
47
60
|
export type A_TYPES__ComponentMeta_InjectionParam = {
|
|
48
61
|
new (...args: any[]): A_Fragment;
|
|
49
62
|
} | {
|
|
@@ -7,6 +7,7 @@ var A_TYPES__ComponentMetaKey;
|
|
|
7
7
|
A_TYPES__ComponentMetaKey["FEATURES"] = "a-component-features";
|
|
8
8
|
A_TYPES__ComponentMetaKey["INJECTIONS"] = "a-component-injections";
|
|
9
9
|
})(A_TYPES__ComponentMetaKey || (exports.A_TYPES__ComponentMetaKey = A_TYPES__ComponentMetaKey = {}));
|
|
10
|
+
// |
|
|
10
11
|
// typeof A_Fragment
|
|
11
12
|
// | typeof A_Component
|
|
12
13
|
// // | { new(...args: any[]): any }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Component.types.js","sourceRoot":"","sources":["../../../../src/global/A-Component/A-Component.types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"A-Component.types.js","sourceRoot":"","sources":["../../../../src/global/A-Component/A-Component.types.ts"],"names":[],"mappings":";;;AA0CA,IAAY,yBAIX;AAJD,WAAY,yBAAyB;IACjC,kEAAqC,CAAA;IACrC,8DAAiC,CAAA;IACjC,kEAAqC,CAAA;AACzC,CAAC,EAJW,yBAAyB,yCAAzB,yBAAyB,QAIpC;AAiCD,KAAK;AACL,oBAAoB;AACpB,uBAAuB;AACvB,oCAAoC;AACpC,mBAAmB;AACnB,sBAAsB"}
|
|
@@ -63,6 +63,7 @@ export declare class A_Context {
|
|
|
63
63
|
static meta(container: typeof A_Container): A_ContainerMeta;
|
|
64
64
|
static meta(container: A_Container<any>): A_ContainerMeta;
|
|
65
65
|
static meta(entity: A_Entity): A_ContainerMeta;
|
|
66
|
+
static meta(entity: typeof A_Entity): A_ContainerMeta;
|
|
66
67
|
static meta(component: typeof A_Component): A_ComponentMeta;
|
|
67
68
|
static meta(component: A_Component): A_ComponentMeta;
|
|
68
69
|
static meta<T extends Record<string, any>>(component: {
|
|
@@ -1 +1 @@
|
|
|
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,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,sGAAsG;IACtG,sGAAsG;IACtG,sGAAsG;IAItG;;;;OAIG;IACH,MAAM,CAAC,WAAW;QACd,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;YACtB,SAAS,CAAC,QAAQ,GAAG,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 +1,6 @@
|
|
|
1
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";
|
|
2
|
+
import { A_TYPES__Entity_JSON, A_TYPES__EntityBaseMethod, A_TYPES__EntityBaseMethods, A_TYPES__EntityCallParams, A_TYPES__IEntity } from "./A-Entity.types";
|
|
3
|
+
import { A_Fragment } from "../A-Fragment/A-Fragment.class";
|
|
3
4
|
/**
|
|
4
5
|
* A_Entity is another abstraction that describes all major participants in the system business logic.
|
|
5
6
|
* Each Entity should have a clear definition and a clear set of responsibilities.
|
|
@@ -7,7 +8,7 @@ import { A_TYPES__Entity_JSON, A_TYPES__EntityBaseMethods, A_TYPES__EntityCallPa
|
|
|
7
8
|
*
|
|
8
9
|
* Each entity should be connected to the ContextFragment (Scope) and should be able to communicate with other entities.
|
|
9
10
|
*/
|
|
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 {
|
|
11
|
+
export declare class A_Entity<_ConstructorType = any, _SerializedType extends A_TYPES__Entity_JSON = A_TYPES__Entity_JSON, _FeatureNames extends Array<string | A_TYPES__EntityBaseMethod> = A_TYPES__EntityBaseMethods> extends A_Fragment implements A_TYPES__IEntity {
|
|
11
12
|
aseid: ASEID;
|
|
12
13
|
constructor(aseid: string);
|
|
13
14
|
constructor(aseid: ASEID);
|
|
@@ -63,11 +64,15 @@ export declare class A_Entity<_ConstructorType = any, _SerializedType extends A_
|
|
|
63
64
|
/**
|
|
64
65
|
* A-Feature method name to be called
|
|
65
66
|
*/
|
|
66
|
-
feature:
|
|
67
|
+
feature: _FeatureNames[number],
|
|
67
68
|
/**
|
|
68
69
|
* Parameters to provide additional data to the feature
|
|
69
70
|
*/
|
|
70
71
|
params: Partial<A_TYPES__EntityCallParams<_FeatureNames[number]>>): Promise<any>;
|
|
72
|
+
load(): void;
|
|
73
|
+
update(): void;
|
|
74
|
+
destroy(): void;
|
|
75
|
+
save(): void;
|
|
71
76
|
protected fromNewEntity(newEntity: _ConstructorType): void;
|
|
72
77
|
protected fromSerialized(serialized: _SerializedType): void;
|
|
73
78
|
/**
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
2
8
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
9
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
10
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -11,8 +17,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
18
|
exports.A_Entity = void 0;
|
|
13
19
|
const a_utils_1 = require("@adaas/a-utils");
|
|
20
|
+
const A_Entity_types_1 = require("./A-Entity.types");
|
|
14
21
|
const errors_constants_1 = require("@adaas/a-utils/dist/src/constants/errors.constants");
|
|
15
22
|
const A_Context_class_1 = require("../A-Context/A-Context.class");
|
|
23
|
+
const A_Feature_class_1 = require("../A-Feature/A-Feature.class");
|
|
24
|
+
const A_Fragment_class_1 = require("../A-Fragment/A-Fragment.class");
|
|
16
25
|
/**
|
|
17
26
|
* A_Entity is another abstraction that describes all major participants in the system business logic.
|
|
18
27
|
* Each Entity should have a clear definition and a clear set of responsibilities.
|
|
@@ -20,8 +29,9 @@ const A_Context_class_1 = require("../A-Context/A-Context.class");
|
|
|
20
29
|
*
|
|
21
30
|
* Each entity should be connected to the ContextFragment (Scope) and should be able to communicate with other entities.
|
|
22
31
|
*/
|
|
23
|
-
class A_Entity {
|
|
32
|
+
class A_Entity extends A_Fragment_class_1.A_Fragment {
|
|
24
33
|
constructor(props) {
|
|
34
|
+
super();
|
|
25
35
|
switch (true) {
|
|
26
36
|
case (typeof props === 'string' && a_utils_1.ASEID.isASEID(props)):
|
|
27
37
|
this.aseid = new a_utils_1.ASEID(props);
|
|
@@ -96,6 +106,10 @@ class A_Entity {
|
|
|
96
106
|
return yield newFeature.process();
|
|
97
107
|
});
|
|
98
108
|
}
|
|
109
|
+
load() { }
|
|
110
|
+
update() { }
|
|
111
|
+
destroy() { }
|
|
112
|
+
save() { }
|
|
99
113
|
fromNewEntity(newEntity) {
|
|
100
114
|
return;
|
|
101
115
|
}
|
|
@@ -119,4 +133,24 @@ class A_Entity {
|
|
|
119
133
|
}
|
|
120
134
|
}
|
|
121
135
|
exports.A_Entity = A_Entity;
|
|
136
|
+
__decorate([
|
|
137
|
+
A_Feature_class_1.A_Feature.Define({
|
|
138
|
+
name: A_Entity_types_1.A_TYPES__EntityBaseMethod.LOAD
|
|
139
|
+
})
|
|
140
|
+
], A_Entity.prototype, "load", null);
|
|
141
|
+
__decorate([
|
|
142
|
+
A_Feature_class_1.A_Feature.Define({
|
|
143
|
+
name: A_Entity_types_1.A_TYPES__EntityBaseMethod.UPDATE
|
|
144
|
+
})
|
|
145
|
+
], A_Entity.prototype, "update", null);
|
|
146
|
+
__decorate([
|
|
147
|
+
A_Feature_class_1.A_Feature.Define({
|
|
148
|
+
name: A_Entity_types_1.A_TYPES__EntityBaseMethod.DESTROY
|
|
149
|
+
})
|
|
150
|
+
], A_Entity.prototype, "destroy", null);
|
|
151
|
+
__decorate([
|
|
152
|
+
A_Feature_class_1.A_Feature.Define({
|
|
153
|
+
name: A_Entity_types_1.A_TYPES__EntityBaseMethod.SAVE
|
|
154
|
+
})
|
|
155
|
+
], A_Entity.prototype, "save", null);
|
|
122
156
|
//# sourceMappingURL=A-Entity.class.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Entity.class.js","sourceRoot":"","sources":["../../../../src/global/A-Entity/A-Entity.class.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"A-Entity.class.js","sourceRoot":"","sources":["../../../../src/global/A-Entity/A-Entity.class.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,4CAGwB;AACxB,qDAM0B;AAC1B,yFAAiG;AACjG,kEAAyD;AACzD,kEAAyD;AACzD,qEAA4D;AAI5D;;;;;;GAMG;AACH,MAAa,QAKT,SAAQ,6BAAU;IAkBlB,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,OAAO,KAAK,KAAK,QAAQ,IAAK,KAAa,CAAC,KAAK,CAAC;gBACpD,IAAI,CAAC,cAAc,CAAC,KAAwB,CAAC,CAAC;gBAC9C,MAAM;YAEV,KAAK,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC;gBAC5B,IAAI,CAAC,aAAa,CAAC,KAAyB,CAAC,CAAC;gBAC9C,MAAK;YAET;gBACI,MAAM,IAAI,iBAAO,CAAC,8CAA2B,CAAC,8BAA8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ChD,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;IAID,QAAQ;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;CACJ;AAxMD,4BAwMC;AAlDG;IAHC,2BAAS,CAAC,MAAM,CAAC;QACd,IAAI,EAAE,0CAAyB,CAAC,IAAI;KACvC,CAAC;oCACQ;AAMV;IAHC,2BAAS,CAAC,MAAM,CAAC;QACd,IAAI,EAAE,0CAAyB,CAAC,MAAM;KACzC,CAAC;sCACU;AAKZ;IAHC,2BAAS,CAAC,MAAM,CAAC;QACd,IAAI,EAAE,0CAAyB,CAAC,OAAO;KAC1C,CAAC;uCACW;AAMb;IAHC,2BAAS,CAAC,MAAM,CAAC;QACd,IAAI,EAAE,0CAAyB,CAAC,IAAI;KACvC,CAAC;oCACQ"}
|
|
@@ -66,7 +66,7 @@ class A_Feature {
|
|
|
66
66
|
return {
|
|
67
67
|
value: () => __awaiter(this, void 0, void 0, function* () {
|
|
68
68
|
if (instance[handler]) {
|
|
69
|
-
const callArgs = A_Context_class_1.A_Context.scope(this).resolve(args);
|
|
69
|
+
const callArgs = A_Context_class_1.A_Context.scope(this).resolve(args.map(arg => arg.target));
|
|
70
70
|
yield instance[handler](...callArgs);
|
|
71
71
|
}
|
|
72
72
|
this._index++;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Feature.class.js","sourceRoot":"","sources":["../../../../src/global/A-Feature/A-Feature.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iHAAoG;AACpG,iHAAoG;AACpG,uDAA6I;AAC7I,4CAA4D;AAC5D,kEAAyD;AAIzD;;;;;;;GAOG;AAC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"../A-Component/A-Component.class";
|
|
2
|
-
import {
|
|
2
|
+
import { A_TYPES__ComponentMeta_InjectionParams } from "../A-Component/A-Component.types";
|
|
3
3
|
import { A_TYPES__ScopeConfig, A_TYPES__ScopeConstructor } from "../A-Scope/A-Scope.types";
|
|
4
4
|
export type A_TYPES__FeatureIteratorReturn<T extends any = any> = () => Promise<T>;
|
|
5
5
|
export type A_TYPES__FeatureConstructor = {
|
|
@@ -14,5 +14,5 @@ export declare enum A_TYPES__FeatureState {
|
|
|
14
14
|
export type A_TYPES__FeatureStep = {
|
|
15
15
|
component: typeof A_Component;
|
|
16
16
|
handler: string;
|
|
17
|
-
args:
|
|
17
|
+
args: A_TYPES__ComponentMeta_InjectionParams;
|
|
18
18
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { A_TYPES__ScopeConfig, A_TYPES__ScopeConstructor } from "./A-Scope.types";
|
|
2
2
|
import { A_Fragment } from "../A-Fragment/A-Fragment.class";
|
|
3
|
-
import { A_TYPES__ComponentMeta_InjectionParam } from "../A-Component/A-Component.types";
|
|
3
|
+
import { A_TYPES__ComponentMeta_EntityInjectionInstructions, A_TYPES__ComponentMeta_InjectionParam } from "../A-Component/A-Component.types";
|
|
4
4
|
import { A_Component } from "../A-Component/A-Component.class";
|
|
5
5
|
import { A_Entity } from "../A-Entity/A-Entity.class";
|
|
6
6
|
/**
|
|
@@ -44,6 +44,9 @@ export declare class A_Scope {
|
|
|
44
44
|
* @returns
|
|
45
45
|
*/
|
|
46
46
|
resolve<T extends A_TYPES__ComponentMeta_InjectionParam>(component: T): InstanceType<T>;
|
|
47
|
+
resolve<T extends {
|
|
48
|
+
new (...args: any[]): A_Entity;
|
|
49
|
+
}>(entity: T, instructions: Partial<A_TYPES__ComponentMeta_EntityInjectionInstructions>): InstanceType<T>;
|
|
47
50
|
resolve<T extends A_TYPES__ComponentMeta_InjectionParam>(component: Array<T>): Array<InstanceType<T>>;
|
|
48
51
|
private resolveOnce;
|
|
49
52
|
private resolveFragment;
|
|
@@ -54,7 +57,7 @@ export declare class A_Scope {
|
|
|
54
57
|
*
|
|
55
58
|
* @param fragment
|
|
56
59
|
*/
|
|
57
|
-
register(
|
|
58
|
-
register(
|
|
60
|
+
register(entity: A_Entity): void;
|
|
61
|
+
register(component: A_Component): void;
|
|
59
62
|
register(fragment: A_Fragment): void;
|
|
60
63
|
}
|
|
@@ -96,7 +96,7 @@ class A_Scope {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
resolveOnce(component) {
|
|
99
|
+
resolveOnce(component, instructions) {
|
|
100
100
|
switch (true) {
|
|
101
101
|
case a_utils_1.A_CommonHelper.isInheritedFrom(component, A_Fragment_class_1.A_Fragment): {
|
|
102
102
|
return this.resolveFragment(component);
|
|
@@ -130,7 +130,13 @@ class A_Scope {
|
|
|
130
130
|
const componentMeta = A_Context_class_1.A_Context.meta(component);
|
|
131
131
|
const argsMeta = componentMeta.get(A_Component_types_1.A_TYPES__ComponentMetaKey.INJECTIONS);
|
|
132
132
|
const resolvedArgs = ((argsMeta === null || argsMeta === void 0 ? void 0 : argsMeta.get('constructor')) || [])
|
|
133
|
-
.map(arg =>
|
|
133
|
+
.map(arg => {
|
|
134
|
+
if ('instructions' in arg) {
|
|
135
|
+
const { target, instructions } = arg;
|
|
136
|
+
return this.resolve(target, instructions);
|
|
137
|
+
}
|
|
138
|
+
return this.resolve(arg.target);
|
|
139
|
+
});
|
|
134
140
|
const newComponent = new component(...resolvedArgs);
|
|
135
141
|
this.register(newComponent);
|
|
136
142
|
return this._components.get(component);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Scope.class.js","sourceRoot":"","sources":["../../../../src/global/A-Scope/A-Scope.class.ts"],"names":[],"mappings":";;;AAAA,4CAAgD;AAEhD,qEAA4D;AAC5D,kEAAyD;AACzD,
|
|
1
|
+
{"version":3,"file":"A-Scope.class.js","sourceRoot":"","sources":["../../../../src/global/A-Scope/A-Scope.class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AAM;YACV,CAAC;YAED;gBACI,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QACtD,CAAC;IAIL,CAAC;CACJ;AApRD,0BAoRC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaas/a-concept",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
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,3 +1,4 @@
|
|
|
1
|
+
import { A_Component } from "@adaas/a-concept/global/A-Component/A-Component.class";
|
|
1
2
|
import {
|
|
2
3
|
A_TYPES__A_FeatureDecoratorConfig,
|
|
3
4
|
A_TYPES__A_FeatureDecoratorDescriptor,
|
|
@@ -5,6 +6,12 @@ import {
|
|
|
5
6
|
import { A_Container } from "@adaas/a-concept/global/A-Container/A-Container.class";
|
|
6
7
|
import { A_TYPES__ContainerMetaKey } from "@adaas/a-concept/global/A-Container/A-Container.types";
|
|
7
8
|
import { A_Context } from "@adaas/a-concept/global/A-Context/A-Context.class";
|
|
9
|
+
import { A_Entity } from "@adaas/a-utils";
|
|
10
|
+
import { A_EntityMeta } from "@adaas/a-concept/global/A-Entity/A-Entity.meta";
|
|
11
|
+
import { A_ContainerMeta } from "@adaas/a-concept/global/A-Container/A-Container.meta";
|
|
12
|
+
import { A_ComponentMeta } from "@adaas/a-concept/global/A-Component/A-Component.meta";
|
|
13
|
+
import { A_TYPES__EntityMetaKey } from "@adaas/a-concept/global/A-Entity/A-Entity.types";
|
|
14
|
+
import { A_TYPES__ComponentMetaKey } from "@adaas/a-concept/global/A-Component/A-Component.types";
|
|
8
15
|
|
|
9
16
|
|
|
10
17
|
/**
|
|
@@ -24,15 +31,33 @@ export function A_Feature_Define(
|
|
|
24
31
|
config: Partial<A_TYPES__A_FeatureDecoratorConfig> = {}
|
|
25
32
|
) {
|
|
26
33
|
return function (
|
|
27
|
-
target: A_Container<any
|
|
34
|
+
target: A_Container<any> | A_Entity | A_Component,
|
|
28
35
|
propertyKey: string,
|
|
29
36
|
descriptor: A_TYPES__A_FeatureDecoratorDescriptor
|
|
30
37
|
) {
|
|
31
38
|
|
|
39
|
+
const meta: A_EntityMeta | A_ContainerMeta | A_ComponentMeta = A_Context.meta(target as any);
|
|
40
|
+
|
|
41
|
+
let metaKey;
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
switch (true) {
|
|
45
|
+
case target instanceof A_Entity:
|
|
46
|
+
metaKey = A_TYPES__EntityMetaKey.FEATURES;
|
|
47
|
+
break;
|
|
48
|
+
case target instanceof A_Container:
|
|
49
|
+
metaKey = A_TYPES__ContainerMetaKey.FEATURES
|
|
50
|
+
break;
|
|
51
|
+
case target instanceof A_Component:
|
|
52
|
+
metaKey = A_TYPES__ComponentMetaKey.FEATURES
|
|
53
|
+
break;
|
|
54
|
+
default:
|
|
55
|
+
throw new Error(`A-Feature cannot be defined on the ${target} level`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
32
59
|
// Get the existed metadata or create a new one
|
|
33
|
-
const existedMeta =
|
|
34
|
-
.meta(target)
|
|
35
|
-
.get(A_TYPES__ContainerMetaKey.FEATURES)
|
|
60
|
+
const existedMeta = meta.get(metaKey)
|
|
36
61
|
|| new Map();
|
|
37
62
|
|
|
38
63
|
|
|
@@ -47,9 +72,9 @@ export function A_Feature_Define(
|
|
|
47
72
|
|
|
48
73
|
// Update the metadata of the container with the new Feature definition
|
|
49
74
|
A_Context
|
|
50
|
-
.meta(target)
|
|
75
|
+
.meta(target as any)
|
|
51
76
|
.set(
|
|
52
|
-
|
|
77
|
+
metaKey,
|
|
53
78
|
existedMeta
|
|
54
79
|
);
|
|
55
80
|
};
|
|
@@ -3,10 +3,10 @@ import { A_TYPES__A_InjectDecoratorReturn } from "./A-Inject.decorator.types";
|
|
|
3
3
|
import { A_Fragment } from "@adaas/a-concept/global/A-Fragment/A-Fragment.class";
|
|
4
4
|
import { A_Scope } from "@adaas/a-concept/global/A-Scope/A-Scope.class";
|
|
5
5
|
import { A_Context } from "@adaas/a-concept/global/A-Context/A-Context.class";
|
|
6
|
-
import { A_TYPES__ComponentMetaKey } from "@adaas/a-concept/global/A-Component/A-Component.types";
|
|
6
|
+
import { A_TYPES__ComponentMeta_EntityInjectionInstructions, A_TYPES__ComponentMetaKey } from "@adaas/a-concept/global/A-Component/A-Component.types";
|
|
7
7
|
import { A_Meta } from "@adaas/a-concept/global/A-Meta/A-Meta.class";
|
|
8
8
|
import { A_Feature } from "@adaas/a-concept/global/A-Feature/A-Feature.class";
|
|
9
|
-
|
|
9
|
+
import { A_Entity } from "@adaas/a-concept/global/A-Entity/A-Entity.class";
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -25,35 +25,37 @@ import { A_Feature } from "@adaas/a-concept/global/A-Feature/A-Feature.class";
|
|
|
25
25
|
export function A_Inject(
|
|
26
26
|
scope: typeof A_Scope
|
|
27
27
|
): A_TYPES__A_InjectDecoratorReturn
|
|
28
|
-
|
|
29
28
|
export function A_Inject(
|
|
30
|
-
|
|
29
|
+
feature: typeof A_Feature
|
|
31
30
|
): A_TYPES__A_InjectDecoratorReturn
|
|
32
31
|
export function A_Inject(
|
|
33
|
-
component: { new(...args: any[]):
|
|
32
|
+
component: { new(...args: any[]): A_Component }
|
|
34
33
|
): A_TYPES__A_InjectDecoratorReturn
|
|
35
|
-
|
|
36
34
|
// Allows to inject just one container
|
|
37
35
|
// export function A_Inject(
|
|
38
36
|
// container: typeof A_Container
|
|
39
37
|
// ): A_TYPES__A_InjectDecoratorReturn
|
|
40
|
-
|
|
41
38
|
// Allows to inject just one Context Fragment
|
|
42
39
|
export function A_Inject(
|
|
43
|
-
fragment:
|
|
40
|
+
fragment: { new(...args: any[]): A_Fragment }
|
|
44
41
|
): A_TYPES__A_InjectDecoratorReturn
|
|
45
42
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
>(
|
|
50
|
-
fragments: T
|
|
43
|
+
export function A_Inject(
|
|
44
|
+
entity: { new(...args: any[]): A_Entity },
|
|
45
|
+
config: Partial<A_TYPES__ComponentMeta_EntityInjectionInstructions>
|
|
51
46
|
): A_TYPES__A_InjectDecoratorReturn
|
|
52
47
|
|
|
53
48
|
// ====================== BASE FUNCTION ======================
|
|
54
49
|
export function A_Inject(
|
|
55
|
-
param1: typeof
|
|
56
|
-
|
|
50
|
+
param1: typeof A_Scope
|
|
51
|
+
| typeof A_Feature
|
|
52
|
+
| { new(...args: any[]): A_Component }
|
|
53
|
+
| { new(...args: any[]): A_Fragment }
|
|
54
|
+
| { new(...args: any[]): A_Entity },
|
|
55
|
+
param2?: {
|
|
56
|
+
aseid?: string,
|
|
57
|
+
id?: string,
|
|
58
|
+
}
|
|
57
59
|
): A_TYPES__A_InjectDecoratorReturn {
|
|
58
60
|
return function (
|
|
59
61
|
target: A_Component,
|
|
@@ -63,8 +65,6 @@ export function A_Inject(
|
|
|
63
65
|
|
|
64
66
|
const method = methodName ? String(methodName) : 'constructor';
|
|
65
67
|
|
|
66
|
-
console.log('target: ', target);
|
|
67
|
-
|
|
68
68
|
const existedMeta = A_Context
|
|
69
69
|
.meta(target)
|
|
70
70
|
.get(A_TYPES__ComponentMetaKey.INJECTIONS)
|
|
@@ -73,16 +73,18 @@ export function A_Inject(
|
|
|
73
73
|
|
|
74
74
|
const paramsArray = existedMeta.get(method) || [];
|
|
75
75
|
|
|
76
|
-
paramsArray[parameterIndex] =
|
|
76
|
+
paramsArray[parameterIndex] = {
|
|
77
|
+
target: param1,
|
|
78
|
+
instructions: param2
|
|
79
|
+
}
|
|
77
80
|
|
|
78
81
|
existedMeta.set(method, paramsArray);
|
|
79
82
|
|
|
80
|
-
|
|
81
83
|
A_Context
|
|
82
84
|
.meta(target)
|
|
83
85
|
.set(
|
|
84
86
|
A_TYPES__ComponentMetaKey.INJECTIONS,
|
|
85
87
|
existedMeta
|
|
86
|
-
)
|
|
88
|
+
);
|
|
87
89
|
}
|
|
88
90
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { A_Entity } from "../A-Entity/A-Entity.class"
|
|
1
2
|
import { A_Feature } from "../A-Feature/A-Feature.class"
|
|
2
3
|
import { A_Fragment } from "../A-Fragment/A-Fragment.class"
|
|
3
4
|
import { A_Meta } from "../A-Meta/A-Meta.class"
|
|
@@ -35,7 +36,7 @@ export type A_TYPES__ComponentMeta = {
|
|
|
35
36
|
*
|
|
36
37
|
* Where value is the list of injections
|
|
37
38
|
*/
|
|
38
|
-
[Key: string]:
|
|
39
|
+
[Key: string]: A_TYPES__ComponentMeta_InjectionParams
|
|
39
40
|
}>
|
|
40
41
|
}
|
|
41
42
|
|
|
@@ -47,7 +48,7 @@ export enum A_TYPES__ComponentMetaKey {
|
|
|
47
48
|
|
|
48
49
|
export type A_TYPES__ComponentMetaExtension = {
|
|
49
50
|
handler: string,
|
|
50
|
-
args:
|
|
51
|
+
args: A_TYPES__ComponentMeta_InjectionParams
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
|
|
@@ -56,6 +57,18 @@ export type A_TYPES__ComponentMeta_ExtensionItem = {
|
|
|
56
57
|
handler: string,
|
|
57
58
|
}
|
|
58
59
|
|
|
60
|
+
export type A_TYPES__ComponentMeta_InjectionParams = Array<{
|
|
61
|
+
target: A_TYPES__ComponentMeta_InjectionParam
|
|
62
|
+
} | {
|
|
63
|
+
target: { new(...args: any[]): A_Entity },
|
|
64
|
+
instructions: Partial<A_TYPES__ComponentMeta_EntityInjectionInstructions>
|
|
65
|
+
}>;
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
export type A_TYPES__ComponentMeta_EntityInjectionInstructions = {
|
|
69
|
+
aseid: string,
|
|
70
|
+
id: string,
|
|
71
|
+
}
|
|
59
72
|
|
|
60
73
|
|
|
61
74
|
export type A_TYPES__ComponentMeta_InjectionParam =
|
|
@@ -64,6 +77,7 @@ export type A_TYPES__ComponentMeta_InjectionParam =
|
|
|
64
77
|
// | { new(...args: any[]): any }
|
|
65
78
|
| { new(...args: any[]): A_Scope }
|
|
66
79
|
| { new(...args: any[]): A_Feature };
|
|
80
|
+
// |
|
|
67
81
|
// typeof A_Fragment
|
|
68
82
|
// | typeof A_Component
|
|
69
83
|
// // | { new(...args: any[]): any }
|
|
@@ -167,6 +167,9 @@ export class A_Context {
|
|
|
167
167
|
static meta(
|
|
168
168
|
entity: A_Entity,
|
|
169
169
|
): A_ContainerMeta
|
|
170
|
+
static meta(
|
|
171
|
+
entity: typeof A_Entity,
|
|
172
|
+
): A_ContainerMeta
|
|
170
173
|
static meta(
|
|
171
174
|
component: typeof A_Component,
|
|
172
175
|
): A_ComponentMeta
|
|
@@ -177,7 +180,13 @@ export class A_Context {
|
|
|
177
180
|
component: { new(...args: any[]): any },
|
|
178
181
|
): A_Meta<T>
|
|
179
182
|
static meta<T extends Record<string, any>>(
|
|
180
|
-
param1:
|
|
183
|
+
param1: A_Container<any>
|
|
184
|
+
| typeof A_Container
|
|
185
|
+
| A_Component
|
|
186
|
+
| typeof A_Component
|
|
187
|
+
| A_Entity
|
|
188
|
+
| typeof A_Entity
|
|
189
|
+
| { new(...args: any[]): any }
|
|
181
190
|
): A_ContainerMeta | A_ComponentMeta | A_Meta<T> {
|
|
182
191
|
const instance = this.getInstance();
|
|
183
192
|
|
|
@@ -4,12 +4,15 @@ import {
|
|
|
4
4
|
} from "@adaas/a-utils";
|
|
5
5
|
import {
|
|
6
6
|
A_TYPES__Entity_JSON,
|
|
7
|
+
A_TYPES__EntityBaseMethod,
|
|
7
8
|
A_TYPES__EntityBaseMethods,
|
|
8
9
|
A_TYPES__EntityCallParams,
|
|
9
10
|
A_TYPES__IEntity
|
|
10
11
|
} from "./A-Entity.types";
|
|
11
12
|
import { A_CONSTANTS__DEFAULT_ERRORS } from "@adaas/a-utils/dist/src/constants/errors.constants";
|
|
12
13
|
import { A_Context } from "../A-Context/A-Context.class";
|
|
14
|
+
import { A_Feature } from "../A-Feature/A-Feature.class";
|
|
15
|
+
import { A_Fragment } from "../A-Fragment/A-Fragment.class";
|
|
13
16
|
|
|
14
17
|
|
|
15
18
|
|
|
@@ -23,8 +26,9 @@ import { A_Context } from "../A-Context/A-Context.class";
|
|
|
23
26
|
export class A_Entity<
|
|
24
27
|
_ConstructorType = any,
|
|
25
28
|
_SerializedType extends A_TYPES__Entity_JSON = A_TYPES__Entity_JSON,
|
|
26
|
-
_FeatureNames extends Array<string> = A_TYPES__EntityBaseMethods
|
|
29
|
+
_FeatureNames extends Array<string | A_TYPES__EntityBaseMethod> = A_TYPES__EntityBaseMethods
|
|
27
30
|
>
|
|
31
|
+
extends A_Fragment
|
|
28
32
|
implements A_TYPES__IEntity {
|
|
29
33
|
|
|
30
34
|
aseid!: ASEID;
|
|
@@ -43,6 +47,7 @@ export class A_Entity<
|
|
|
43
47
|
newEntity: _ConstructorType
|
|
44
48
|
)
|
|
45
49
|
constructor(props: string | ASEID | _SerializedType | _ConstructorType) {
|
|
50
|
+
super();
|
|
46
51
|
|
|
47
52
|
switch (true) {
|
|
48
53
|
case (typeof props === 'string' && ASEID.isASEID(props)):
|
|
@@ -140,7 +145,7 @@ export class A_Entity<
|
|
|
140
145
|
/**
|
|
141
146
|
* A-Feature method name to be called
|
|
142
147
|
*/
|
|
143
|
-
feature:
|
|
148
|
+
feature: _FeatureNames[number],
|
|
144
149
|
/**
|
|
145
150
|
* Parameters to provide additional data to the feature
|
|
146
151
|
*/
|
|
@@ -165,6 +170,29 @@ export class A_Entity<
|
|
|
165
170
|
}
|
|
166
171
|
|
|
167
172
|
|
|
173
|
+
@A_Feature.Define({
|
|
174
|
+
name: A_TYPES__EntityBaseMethod.LOAD
|
|
175
|
+
})
|
|
176
|
+
load() { }
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
@A_Feature.Define({
|
|
180
|
+
name: A_TYPES__EntityBaseMethod.UPDATE
|
|
181
|
+
})
|
|
182
|
+
update() { }
|
|
183
|
+
|
|
184
|
+
@A_Feature.Define({
|
|
185
|
+
name: A_TYPES__EntityBaseMethod.DESTROY
|
|
186
|
+
})
|
|
187
|
+
destroy() { }
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
@A_Feature.Define({
|
|
191
|
+
name: A_TYPES__EntityBaseMethod.SAVE
|
|
192
|
+
})
|
|
193
|
+
save() { }
|
|
194
|
+
|
|
195
|
+
|
|
168
196
|
|
|
169
197
|
|
|
170
198
|
protected fromNewEntity(newEntity: _ConstructorType): void {
|
|
@@ -84,7 +84,7 @@ export class A_Feature {
|
|
|
84
84
|
value: async () => {
|
|
85
85
|
|
|
86
86
|
if (instance[handler]) {
|
|
87
|
-
const callArgs = A_Context.scope(this).resolve(args);
|
|
87
|
+
const callArgs = A_Context.scope(this).resolve(args.map(arg => arg.target));
|
|
88
88
|
await instance[handler](...callArgs);
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { A_Component } from "../A-Component/A-Component.class"
|
|
2
|
-
import { A_TYPES__ComponentMeta_InjectionParam } from "../A-Component/A-Component.types"
|
|
2
|
+
import { A_TYPES__ComponentMeta_InjectionParam, A_TYPES__ComponentMeta_InjectionParams } from "../A-Component/A-Component.types"
|
|
3
3
|
import { A_TYPES__ScopeConfig, A_TYPES__ScopeConstructor } from "../A-Scope/A-Scope.types"
|
|
4
4
|
|
|
5
5
|
|
|
@@ -22,5 +22,5 @@ export enum A_TYPES__FeatureState {
|
|
|
22
22
|
export type A_TYPES__FeatureStep = {
|
|
23
23
|
component: typeof A_Component,
|
|
24
24
|
handler: string,
|
|
25
|
-
args:
|
|
25
|
+
args: A_TYPES__ComponentMeta_InjectionParams
|
|
26
26
|
}
|
|
@@ -2,7 +2,7 @@ import { A_CommonHelper } from "@adaas/a-utils";
|
|
|
2
2
|
import { A_TYPES__ScopeConfig, A_TYPES__ScopeConstructor } from "./A-Scope.types";
|
|
3
3
|
import { A_Fragment } from "../A-Fragment/A-Fragment.class";
|
|
4
4
|
import { A_Context } from "../A-Context/A-Context.class";
|
|
5
|
-
import { A_TYPES__ComponentMeta_InjectionParam, A_TYPES__ComponentMetaKey } from "../A-Component/A-Component.types";
|
|
5
|
+
import { A_TYPES__ComponentMeta_EntityInjectionInstructions, A_TYPES__ComponentMeta_InjectionParam, A_TYPES__ComponentMetaKey } from "../A-Component/A-Component.types";
|
|
6
6
|
import { A_Component } from "../A-Component/A-Component.class";
|
|
7
7
|
import { A_Entity } from "../A-Entity/A-Entity.class";
|
|
8
8
|
|
|
@@ -129,12 +129,20 @@ export class A_Scope {
|
|
|
129
129
|
* @param component
|
|
130
130
|
* @returns
|
|
131
131
|
*/
|
|
132
|
-
resolve<T extends A_TYPES__ComponentMeta_InjectionParam>(
|
|
133
|
-
|
|
132
|
+
resolve<T extends A_TYPES__ComponentMeta_InjectionParam>(
|
|
133
|
+
component: T
|
|
134
|
+
): InstanceType<T>
|
|
135
|
+
resolve<T extends { new(...args: any[]): A_Entity }>(
|
|
136
|
+
entity: T,
|
|
137
|
+
instructions: Partial<A_TYPES__ComponentMeta_EntityInjectionInstructions>): InstanceType<T>
|
|
138
|
+
resolve<
|
|
139
|
+
T extends A_TYPES__ComponentMeta_InjectionParam>(component: Array<T>
|
|
140
|
+
|
|
141
|
+
): Array<InstanceType<T>>
|
|
134
142
|
// base definition
|
|
135
143
|
resolve<T extends A_TYPES__ComponentMeta_InjectionParam>(
|
|
136
144
|
param1: Array<T> | T,
|
|
137
|
-
param2?: string
|
|
145
|
+
param2?: string | Partial<A_TYPES__ComponentMeta_EntityInjectionInstructions>
|
|
138
146
|
): Array<InstanceType<T>> | InstanceType<T> {
|
|
139
147
|
|
|
140
148
|
switch (true) {
|
|
@@ -154,7 +162,17 @@ export class A_Scope {
|
|
|
154
162
|
|
|
155
163
|
|
|
156
164
|
|
|
157
|
-
private resolveOnce<T extends
|
|
165
|
+
private resolveOnce<T extends { new(...args: any[]): A_Entity }>(
|
|
166
|
+
entity: T,
|
|
167
|
+
instructions: Partial<A_TYPES__ComponentMeta_EntityInjectionInstructions>
|
|
168
|
+
): InstanceType<T>
|
|
169
|
+
private resolveOnce<T extends A_TYPES__ComponentMeta_InjectionParam>(
|
|
170
|
+
component: T
|
|
171
|
+
): InstanceType<T>
|
|
172
|
+
private resolveOnce<T extends { new(...args: any[]): A_Entity } | A_TYPES__ComponentMeta_InjectionParam>(
|
|
173
|
+
component: T,
|
|
174
|
+
instructions?: Partial<A_TYPES__ComponentMeta_EntityInjectionInstructions>
|
|
175
|
+
): InstanceType<T> {
|
|
158
176
|
switch (true) {
|
|
159
177
|
case A_CommonHelper.isInheritedFrom(component, A_Fragment): {
|
|
160
178
|
return this.resolveFragment(component as typeof A_Fragment) as InstanceType<T>;
|
|
@@ -206,7 +224,16 @@ export class A_Scope {
|
|
|
206
224
|
const argsMeta = componentMeta.get(A_TYPES__ComponentMetaKey.INJECTIONS);
|
|
207
225
|
|
|
208
226
|
const resolvedArgs = (argsMeta?.get('constructor') || [])
|
|
209
|
-
.map(arg =>
|
|
227
|
+
.map(arg => {
|
|
228
|
+
if ('instructions' in arg) {
|
|
229
|
+
const { target, instructions } = arg
|
|
230
|
+
return this.resolve(
|
|
231
|
+
target,
|
|
232
|
+
instructions
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
return this.resolve(arg.target)
|
|
236
|
+
});
|
|
210
237
|
|
|
211
238
|
const newComponent = new component(...resolvedArgs)
|
|
212
239
|
|
|
@@ -231,8 +258,8 @@ export class A_Scope {
|
|
|
231
258
|
*
|
|
232
259
|
* @param fragment
|
|
233
260
|
*/
|
|
234
|
-
register(
|
|
235
|
-
register(
|
|
261
|
+
register(entity: A_Entity): void
|
|
262
|
+
register(component: A_Component): void
|
|
236
263
|
register(fragment: A_Fragment): void
|
|
237
264
|
register(
|
|
238
265
|
param1: A_Fragment | A_Component | A_Entity
|