@adaas/a-concept 0.0.9 → 0.0.11
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-http-server/components/http-error-handler.component.js +1 -1
- package/dist/examples/simple-http-server/components/http-error-handler.component.js.map +1 -1
- package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.d.ts +19 -3
- package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.js +15 -18
- package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.js.map +1 -1
- package/dist/src/decorators/A-Feature/A-Feature.decorator.types.d.ts +16 -1
- package/dist/src/global/A-Context/A-Context.class.js +1 -1
- package/dist/src/global/A-Context/A-Context.class.js.map +1 -1
- package/dist/src/global/A-Entity/A-Entity.class.d.ts +5 -6
- package/dist/src/global/A-Entity/A-Entity.class.js +38 -14
- package/dist/src/global/A-Entity/A-Entity.class.js.map +1 -1
- package/dist/src/global/A-Entity/A-Entity.types.d.ts +0 -2
- package/dist/src/global/A-Entity/A-Entity.types.js +0 -1
- package/dist/src/global/A-Entity/A-Entity.types.js.map +1 -1
- package/dist/src/global/A-Feature/A-Feature.class.d.ts +2 -2
- package/dist/src/global/A-Feature/A-Feature.class.js +5 -1
- package/dist/src/global/A-Feature/A-Feature.class.js.map +1 -1
- package/dist/src/global/A-Meta/A-Meta.class.js +1 -1
- package/dist/src/global/A-Meta/A-Meta.class.js.map +1 -1
- package/dist/src/global/A-Scope/A-Scope.class.d.ts +1 -0
- package/dist/src/global/A-Scope/A-Scope.class.js +28 -4
- package/dist/src/global/A-Scope/A-Scope.class.js.map +1 -1
- package/examples/simple-http-server/components/http-error-handler.component.ts +2 -2
- package/package.json +1 -1
- package/src/decorators/A-Feature/A-Feature-Extend.decorator.ts +41 -6
- package/src/decorators/A-Feature/A-Feature.decorator.types.ts +17 -1
- package/src/global/A-Context/A-Context.class.ts +1 -1
- package/src/global/A-Entity/A-Entity.class.ts +33 -14
- package/src/global/A-Entity/A-Entity.types.ts +0 -2
- package/src/global/A-Feature/A-Feature.class.ts +11 -5
- package/src/global/A-Meta/A-Meta.class.ts +1 -1
- package/src/global/A-Scope/A-Scope.class.ts +49 -10
|
@@ -50,7 +50,7 @@ exports.HTTPErrorHandler = HTTPErrorHandler;
|
|
|
50
50
|
__decorate([
|
|
51
51
|
A_Feature_class_1.A_Feature.Extend({
|
|
52
52
|
name: 'onRequest',
|
|
53
|
-
|
|
53
|
+
scope: [http_server_container_1.HttpServer]
|
|
54
54
|
}),
|
|
55
55
|
__param(0, (0, A_Inject_decorator_1.A_Inject)(http_request_context_1.HTTPRequest)),
|
|
56
56
|
__param(1, (0, A_Inject_decorator_1.A_Inject)(A_Feature_class_1.A_Feature))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-error-handler.component.js","sourceRoot":"","sources":["../../../../examples/simple-http-server/components/http-error-handler.component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,gGAAmF;AACnF,2EAA+D;AAC/D,0FAA6E;AAC7E,+EAAiE;AACjE,uFAA8E;AAC9E,6FAAoF;AAG7E,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,+BAAW;IAE7C,YACgC,MAAgB;QAE5C,KAAK,EAAE,CAAC;QAFoB,WAAM,GAAN,MAAM,CAAU;IAGhD,CAAC;IAQK,WAAW,CACU,OAAoB,EACtB,OAAkB;;YAEvC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;YAEvD,MAAM,OAAO,CAAC,SAAS,EAAE,CAAC;YAE1B,IAAI,OAAO,CAAC,KAAK,KAAK,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,KAAK,QAAQ;gBAC3D,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAElC,CAAC;KAAA;IAKK,SAAS,CACY,OAAoB;;YAE3C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;YAErD,IAAI,OAAO,CAAC,KAAK,KAAK,KAAK;gBACvB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC7B,CAAC;KAAA;CACJ,CAAA;AAtCY,4CAAgB;AAcnB;IAJL,2BAAS,CAAC,MAAM,CAAC;QACd,IAAI,EAAE,WAAW;QACjB,
|
|
1
|
+
{"version":3,"file":"http-error-handler.component.js","sourceRoot":"","sources":["../../../../examples/simple-http-server/components/http-error-handler.component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,gGAAmF;AACnF,2EAA+D;AAC/D,0FAA6E;AAC7E,+EAAiE;AACjE,uFAA8E;AAC9E,6FAAoF;AAG7E,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,+BAAW;IAE7C,YACgC,MAAgB;QAE5C,KAAK,EAAE,CAAC;QAFoB,WAAM,GAAN,MAAM,CAAU;IAGhD,CAAC;IAQK,WAAW,CACU,OAAoB,EACtB,OAAkB;;YAEvC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;YAEvD,MAAM,OAAO,CAAC,SAAS,EAAE,CAAC;YAE1B,IAAI,OAAO,CAAC,KAAK,KAAK,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,KAAK,QAAQ;gBAC3D,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAElC,CAAC;KAAA;IAKK,SAAS,CACY,OAAoB;;YAE3C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;YAErD,IAAI,OAAO,CAAC,KAAK,KAAK,KAAK;gBACvB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC7B,CAAC;KAAA;CACJ,CAAA;AAtCY,4CAAgB;AAcnB;IAJL,2BAAS,CAAC,MAAM,CAAC;QACd,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,CAAC,kCAAU,CAAC;KACtB,CAAC;IAEG,WAAA,IAAA,6BAAQ,EAAC,kCAAW,CAAC,CAAA;IACrB,WAAA,IAAA,6BAAQ,EAAC,2BAAS,CAAC,CAAA;mDASvB;AAKK;IADL,2BAAS,CAAC,MAAM,EAAE;IAEd,WAAA,IAAA,6BAAQ,EAAC,kCAAW,CAAC,CAAA;iDAMzB;2BArCQ,gBAAgB;IAGpB,WAAA,IAAA,6BAAQ,EAAC,6BAAQ,CAAC,CAAA;GAHd,gBAAgB,CAsC5B"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A_TYPES__A_ExtendDecoratorConfig, A_TYPES__A_ExtendDecoratorDescriptor } from "./A-Feature.decorator.types";
|
|
1
|
+
import { A_TYPES__A_ExtendDecoratorConfig } from "./A-Feature.decorator.types";
|
|
3
2
|
/**
|
|
4
3
|
* A-Extend decorator
|
|
5
4
|
*
|
|
@@ -13,4 +12,21 @@ import { A_TYPES__A_ExtendDecoratorConfig, A_TYPES__A_ExtendDecoratorDescriptor
|
|
|
13
12
|
* @param params
|
|
14
13
|
* @returns
|
|
15
14
|
*/
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Use regexp in case if you need more flexibility and control over the name of the method
|
|
17
|
+
*
|
|
18
|
+
* @param regexp
|
|
19
|
+
*/
|
|
20
|
+
export declare function A_Feature_Extend(regexp: RegExp): any;
|
|
21
|
+
/**
|
|
22
|
+
* In this case the name configurations will be used as an input to get scope and name of target function
|
|
23
|
+
* [!] Not that for all SCOPE will be used OR operator
|
|
24
|
+
*
|
|
25
|
+
* @param config
|
|
26
|
+
*/
|
|
27
|
+
export declare function A_Feature_Extend(config: Partial<A_TYPES__A_ExtendDecoratorConfig>): any;
|
|
28
|
+
/**
|
|
29
|
+
* In this case the name of function will be used as a name of the Feature.
|
|
30
|
+
* [!] AND it will be applicable for ANY element where the name is the same as the name of the function
|
|
31
|
+
*/
|
|
32
|
+
export declare function A_Feature_Extend(): any;
|
|
@@ -4,35 +4,32 @@ exports.A_Feature_Extend = A_Feature_Extend;
|
|
|
4
4
|
const A_Component_types_1 = require("../../global/A-Component/A-Component.types");
|
|
5
5
|
const A_Context_class_1 = require("../../global/A-Context/A-Context.class");
|
|
6
6
|
const A_Meta_class_1 = require("../../global/A-Meta/A-Meta.class");
|
|
7
|
-
|
|
8
|
-
* A-Extend decorator
|
|
9
|
-
*
|
|
10
|
-
* This decorator allows to define a custom Extend stage for the Container.
|
|
11
|
-
* These stages are executed in a container-specific order and can be extended by components that are injected into the container.
|
|
12
|
-
* This approach allows to create a flexible and extendable architecture for the application.
|
|
13
|
-
*
|
|
14
|
-
* The main difference between the A-Extend and A-Extend decorators is that A-Extend methods can be inherited and overridden by child classes.
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* @param params
|
|
18
|
-
* @returns
|
|
19
|
-
*/
|
|
20
|
-
function A_Feature_Extend(config = {}) {
|
|
7
|
+
function A_Feature_Extend(param1) {
|
|
21
8
|
return function (target, propertyKey, descriptor) {
|
|
22
|
-
|
|
9
|
+
let targetRegexp;
|
|
10
|
+
// Check if the config is a RegExp
|
|
11
|
+
if (param1 instanceof RegExp) {
|
|
12
|
+
targetRegexp = param1;
|
|
13
|
+
}
|
|
14
|
+
else if (!!param1) {
|
|
15
|
+
targetRegexp = new RegExp(`^(${(param1.scope || []).map(el => el.constructor.name).join('|')})\.${param1.name || propertyKey}$`);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
targetRegexp = new RegExp(`^.*\\.${propertyKey}$`);
|
|
19
|
+
}
|
|
23
20
|
// Get the existed metadata or create a new one
|
|
24
21
|
const existedMeta = A_Context_class_1.A_Context
|
|
25
22
|
.meta(target)
|
|
26
23
|
.get(A_Component_types_1.A_TYPES__ComponentMetaKey.EXTENSIONS)
|
|
27
24
|
|| new A_Meta_class_1.A_Meta();
|
|
28
|
-
const existedMetaValue = existedMeta.get(
|
|
25
|
+
const existedMetaValue = existedMeta.get(targetRegexp.source) || [];
|
|
29
26
|
// Add the new method to the metadata
|
|
30
27
|
existedMetaValue.push({
|
|
31
|
-
name:
|
|
28
|
+
name: targetRegexp.source,
|
|
32
29
|
handler: propertyKey,
|
|
33
30
|
});
|
|
34
31
|
// Set the metadata of the method to define a custom Feature with name
|
|
35
|
-
existedMeta.set(
|
|
32
|
+
existedMeta.set(targetRegexp.source, existedMetaValue);
|
|
36
33
|
// Update the metadata of the container with the new Feature definition
|
|
37
34
|
A_Context_class_1.A_Context
|
|
38
35
|
.meta(target)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Feature-Extend.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/A-Feature/A-Feature-Extend.decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"A-Feature-Extend.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/A-Feature/A-Feature-Extend.decorator.ts"],"names":[],"mappings":";;AAiDA,4CA8CC;AA1FD,6FAAkG;AAClG,uFAA8E;AAG9E,8EAAqE;AAwCrE,SAAgB,gBAAgB,CAC5B,MAA2D;IAE3D,OAAO,UACH,MAAmB,EACnB,WAAmB,EACnB,UAAgD;QAGhD,IAAI,YAAoB,CAAC;QAGzB,kCAAkC;QAClC,IAAI,MAAM,YAAY,MAAM,EAAE,CAAC;YAC3B,YAAY,GAAG,MAAM,CAAC;QAC1B,CAAC;aACI,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;YAChB,YAAY,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,IAAI,IAAI,WAAW,GAAG,CAAC,CAAC;QACrI,CAAC;aACI,CAAC;YACF,YAAY,GAAG,IAAI,MAAM,CAAC,SAAS,WAAW,GAAG,CAAC,CAAC;QACvD,CAAC;QAED,+CAA+C;QAC/C,MAAM,WAAW,GAAG,2BAAS;aACxB,IAAI,CAAC,MAAM,CAAC;aACZ,GAAG,CAAC,6CAAyB,CAAC,UAAU,CAAC;eACvC,IAAI,qBAAM,EAAE,CAAC;QAGpB,MAAM,gBAAgB,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QAEpE,qCAAqC;QACrC,gBAAgB,CAAC,IAAI,CAAC;YAClB,IAAI,EAAE,YAAY,CAAC,MAAM;YACzB,OAAO,EAAE,WAAW;SACvB,CAAC,CAAC;QAEH,sEAAsE;QACtE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;QAEvD,wEAAwE;QACxE,2BAAS;aACJ,IAAI,CAAC,MAAM,CAAC;aACZ,GAAG,CAAC,6CAAyB,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAChE,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
import { A_Component } from "../../global/A-Component/A-Component.class";
|
|
1
2
|
import { A_Container } from "../../global/A-Container/A-Container.class";
|
|
3
|
+
import { A_Entity } from "../../global/A-Entity/A-Entity.class";
|
|
4
|
+
export type A_TYPES__A_Feature_Extend = {
|
|
5
|
+
(regexp: RegExp): MethodDecorator;
|
|
6
|
+
(config: Partial<A_TYPES__A_ExtendDecoratorConfig>): MethodDecorator;
|
|
7
|
+
(): MethodDecorator;
|
|
8
|
+
};
|
|
2
9
|
export type A_TYPES__A_FeatureDecoratorDescriptor = TypedPropertyDescriptor<() => any> | TypedPropertyDescriptor<(...args: any[]) => any> | TypedPropertyDescriptor<(...args: any[]) => Promise<any>> | TypedPropertyDescriptor<() => Promise<any>>;
|
|
3
10
|
export type A_TYPES__A_FeatureDecoratorConfig = {
|
|
4
11
|
name: string;
|
|
@@ -9,12 +16,20 @@ export type A_TYPES__A_ExtendDecoratorConfig = {
|
|
|
9
16
|
* Name of the container Lifecycle method to be extended.
|
|
10
17
|
*
|
|
11
18
|
* [!] If not provided will be used the name of the method.
|
|
19
|
+
* [!!] If name contains "." dot it will be considered as a path to the method.
|
|
12
20
|
*/
|
|
13
21
|
name: string;
|
|
14
22
|
/**
|
|
15
23
|
* Container class or container name uses to identify the proper container in case when the name is not unique.
|
|
16
24
|
*
|
|
17
25
|
* [!] If not provided will be applied to all containers with the same name.
|
|
26
|
+
* [!!] By default uses OR to join all provided items. If you need more complex Logic, please use Regexp instead
|
|
18
27
|
*/
|
|
19
|
-
|
|
28
|
+
scope: Array<{
|
|
29
|
+
new (...args: any[]): A_Container<any>;
|
|
30
|
+
} | {
|
|
31
|
+
new (...args: any[]): A_Entity;
|
|
32
|
+
} | {
|
|
33
|
+
new (...args: any[]): A_Component;
|
|
34
|
+
}>;
|
|
20
35
|
};
|
|
@@ -183,7 +183,7 @@ class A_Context {
|
|
|
183
183
|
static feature(param1, param2, param3) {
|
|
184
184
|
const instance = this.getInstance();
|
|
185
185
|
const component = param1;
|
|
186
|
-
const feature = param2
|
|
186
|
+
const feature = `${component.constructor.name}.${param2}`;
|
|
187
187
|
const config = param3 || {};
|
|
188
188
|
// TODO: have no idea why it's not working because of that "any"
|
|
189
189
|
const scope = this.scope(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;QA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G,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;AA9dD,8BA8dC"}
|
|
@@ -69,12 +69,11 @@ export declare class A_Entity<_ConstructorType = any, _SerializedType extends A_
|
|
|
69
69
|
* Parameters to provide additional data to the feature
|
|
70
70
|
*/
|
|
71
71
|
params: Partial<A_TYPES__EntityCallParams<_FeatureNames[number]>>): Promise<any>;
|
|
72
|
-
load(): void
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
protected fromSerialized(serialized: _SerializedType): void;
|
|
72
|
+
load(): Promise<void>;
|
|
73
|
+
destroy(): Promise<void>;
|
|
74
|
+
save(): Promise<void>;
|
|
75
|
+
fromNew(newEntity: _ConstructorType): void;
|
|
76
|
+
fromJSON(serialized: _SerializedType): void;
|
|
78
77
|
/**
|
|
79
78
|
* Converts the entity to a JSON object
|
|
80
79
|
*
|
|
@@ -39,11 +39,11 @@ class A_Entity extends A_Fragment_class_1.A_Fragment {
|
|
|
39
39
|
case (props instanceof a_utils_1.ASEID):
|
|
40
40
|
this.aseid = props;
|
|
41
41
|
break;
|
|
42
|
-
case (typeof props === 'object' && props
|
|
43
|
-
this.
|
|
42
|
+
case (!!props && typeof props === 'object' && 'aseid' in props):
|
|
43
|
+
this.fromJSON(props);
|
|
44
44
|
break;
|
|
45
45
|
case (typeof props === 'object'):
|
|
46
|
-
this.
|
|
46
|
+
this.fromNew(props);
|
|
47
47
|
break;
|
|
48
48
|
default:
|
|
49
49
|
throw new a_utils_1.A_Error(errors_constants_1.A_CONSTANTS__DEFAULT_ERRORS.INCORRECT_A_ENTITY_CONSTRUCTOR);
|
|
@@ -106,14 +106,43 @@ class A_Entity extends A_Fragment_class_1.A_Fragment {
|
|
|
106
106
|
return yield newFeature.process();
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
109
|
+
// ====================================================================
|
|
110
|
+
// ================== Entity Base Methods =============================
|
|
111
|
+
// ====================================================================
|
|
112
|
+
load() {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
yield this.call(A_Entity_types_1.A_TYPES__EntityBaseMethod.DESTROY, {
|
|
115
|
+
fragments: [
|
|
116
|
+
this
|
|
117
|
+
]
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
destroy() {
|
|
122
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
yield this.call(A_Entity_types_1.A_TYPES__EntityBaseMethod.DESTROY, {
|
|
124
|
+
fragments: [
|
|
125
|
+
this
|
|
126
|
+
]
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
save() {
|
|
131
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
132
|
+
yield this.call(A_Entity_types_1.A_TYPES__EntityBaseMethod.SAVE, {
|
|
133
|
+
fragments: [
|
|
134
|
+
this
|
|
135
|
+
]
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
// ====================================================================
|
|
140
|
+
// ================== Entity Serialization ============================
|
|
141
|
+
// ====================================================================
|
|
142
|
+
fromNew(newEntity) {
|
|
114
143
|
return;
|
|
115
144
|
}
|
|
116
|
-
|
|
145
|
+
fromJSON(serialized) {
|
|
117
146
|
this.aseid = new a_utils_1.ASEID((serialized).aseid);
|
|
118
147
|
return;
|
|
119
148
|
}
|
|
@@ -138,11 +167,6 @@ __decorate([
|
|
|
138
167
|
name: A_Entity_types_1.A_TYPES__EntityBaseMethod.LOAD
|
|
139
168
|
})
|
|
140
169
|
], 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
170
|
__decorate([
|
|
147
171
|
A_Feature_class_1.A_Feature.Define({
|
|
148
172
|
name: A_Entity_types_1.A_TYPES__EntityBaseMethod.DESTROY
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
1
|
+
{"version":3,"file":"A-Entity.class.js","sourceRoot":"","sources":["../../../../src/global/A-Entity/A-Entity.class.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;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AQ,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,QAAQ,EAAE,CAAC;IACjC,CAAC;CACJ;AA3ND,4BA2NC;AAjES;IAHL,2BAAS,CAAC,MAAM,CAAC;QACd,IAAI,EAAE,0CAAyB,CAAC,IAAI;KACvC,CAAC;oCAOD;AAMK;IAHL,2BAAS,CAAC,MAAM,CAAC;QACd,IAAI,EAAE,0CAAyB,CAAC,OAAO;KAC1C,CAAC;uCAOD;AAMK;IAHL,2BAAS,CAAC,MAAM,CAAC;QACd,IAAI,EAAE,0CAAyB,CAAC,IAAI;KACvC,CAAC;oCAOD"}
|
|
@@ -10,13 +10,11 @@ export type A_TYPES__EntityCallParams<T extends string> = {
|
|
|
10
10
|
};
|
|
11
11
|
export type A_TYPES__EntityBaseMethods = [
|
|
12
12
|
A_TYPES__EntityBaseMethod.SAVE,
|
|
13
|
-
A_TYPES__EntityBaseMethod.UPDATE,
|
|
14
13
|
A_TYPES__EntityBaseMethod.DESTROY,
|
|
15
14
|
A_TYPES__EntityBaseMethod.LOAD
|
|
16
15
|
];
|
|
17
16
|
export declare enum A_TYPES__EntityBaseMethod {
|
|
18
17
|
SAVE = "save",
|
|
19
|
-
UPDATE = "update",
|
|
20
18
|
DESTROY = "destroy",
|
|
21
19
|
LOAD = "load"
|
|
22
20
|
}
|
|
@@ -4,7 +4,6 @@ exports.A_TYPES__EntityMetaKey = exports.A_TYPES__EntityBaseMethod = void 0;
|
|
|
4
4
|
var A_TYPES__EntityBaseMethod;
|
|
5
5
|
(function (A_TYPES__EntityBaseMethod) {
|
|
6
6
|
A_TYPES__EntityBaseMethod["SAVE"] = "save";
|
|
7
|
-
A_TYPES__EntityBaseMethod["UPDATE"] = "update";
|
|
8
7
|
A_TYPES__EntityBaseMethod["DESTROY"] = "destroy";
|
|
9
8
|
A_TYPES__EntityBaseMethod["LOAD"] = "load";
|
|
10
9
|
})(A_TYPES__EntityBaseMethod || (exports.A_TYPES__EntityBaseMethod = A_TYPES__EntityBaseMethod = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Entity.types.js","sourceRoot":"","sources":["../../../../src/global/A-Entity/A-Entity.types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"A-Entity.types.js","sourceRoot":"","sources":["../../../../src/global/A-Entity/A-Entity.types.ts"],"names":[],"mappings":";;;AAkBA,IAAY,yBAIX;AAJD,WAAY,yBAAyB;IACjC,0CAAa,CAAA;IACb,gDAAmB,CAAA;IACnB,0CAAa,CAAA;AACjB,CAAC,EAJW,yBAAyB,yCAAzB,yBAAyB,QAIpC;AAOA,CAAC;AAgCF,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAC9B,+DAAqC,CAAA;IACrC,2DAAiC,CAAA;AACrC,CAAC,EAHW,sBAAsB,sCAAtB,sBAAsB,QAGjC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { A_Feature_Define } from "../../decorators/A-Feature/A-Feature-Define.decorator";
|
|
2
|
-
import { A_Feature_Extend } from "../../decorators/A-Feature/A-Feature-Extend.decorator";
|
|
3
2
|
import { A_TYPES__FeatureConstructor, A_TYPES__FeatureIteratorReturn, A_TYPES__FeatureState, A_TYPES__FeatureStep } from "./A-Feature.types";
|
|
4
3
|
import { A_Error, A_TYPES__Required } from "@adaas/a-utils";
|
|
4
|
+
import { A_TYPES__A_Feature_Extend } from "../../decorators/A-Feature/A-Feature.decorator.types";
|
|
5
5
|
/**
|
|
6
6
|
* A_Feature is representing a feature that can be executed across multiple components
|
|
7
7
|
* This class stores the steps of the feature and executes them in order of appearance
|
|
@@ -18,7 +18,7 @@ export declare class A_Feature {
|
|
|
18
18
|
/**
|
|
19
19
|
* Extend an existing A-Feature
|
|
20
20
|
*/
|
|
21
|
-
static get Extend():
|
|
21
|
+
static get Extend(): A_TYPES__A_Feature_Extend;
|
|
22
22
|
protected steps: A_TYPES__FeatureStep[];
|
|
23
23
|
protected _current?: A_TYPES__FeatureStep;
|
|
24
24
|
protected _index: number;
|
|
@@ -66,7 +66,11 @@ class A_Feature {
|
|
|
66
66
|
return {
|
|
67
67
|
value: () => __awaiter(this, void 0, void 0, function* () {
|
|
68
68
|
if (instance[handler]) {
|
|
69
|
-
const callArgs =
|
|
69
|
+
const callArgs = args.map(arg =>
|
|
70
|
+
// In case if the target is a feature step then pass the current feature
|
|
71
|
+
a_utils_1.A_CommonHelper.isInheritedFrom(arg.target, A_Feature)
|
|
72
|
+
? this
|
|
73
|
+
: A_Context_class_1.A_Context.scope(this).resolve(arg.target));
|
|
70
74
|
yield instance[handler](...callArgs);
|
|
71
75
|
}
|
|
72
76
|
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,
|
|
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,4CAA4E;AAC5E,kEAAyD;AAKzD;;;;;;;GAOG;AACH,MAAa,SAAS;IAGlB;;OAEG;IACH,MAAM,KAAK,MAAM;QACb,OAAO,6CAAgB,CAAC;IAC5B,CAAC;IAGD;;OAEG;IACH,MAAM,KAAK,MAAM;QACb,OAAO,6CAAgB,CAAC;IAC5B,CAAC;IAeD,YACI,MAA0E;QAX9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C,SAAS,EAAE,CAAC;YAE3B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,OAAO,CAAC,GAAG,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC;gBAEpD,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC7B,CAAC;QACL,CAAC;KAAA;IAGe,YAAY,CAAC,KAAgC;;YACzD,QAAQ,IAAI,EAAE,CAAC;gBACX,KAAK,KAAK,YAAY,iBAAO;oBACzB,MAAM,KAAK,CAAC;gBAGhB,KAAK,KAAK,YAAY,KAAK;uBACpB,KAAK,CAAC,OAAO,KAAK,gCAAgC;uBAClD,IAAI,CAAC,KAAK,KAAK,uCAAqB,CAAC,MAAM;oBAC9C,MAAM,IAAI,iBAAO,CAAC;wBACd,OAAO,EAAE,gCAAgC;wBACzC,IAAI,EAAE,gCAAgC;wBACtC,IAAI,EAAE;4BACF,OAAO,EAAE,IAAI;yBAChB;qBACJ,CAAC,CAAC;gBAGP,KAAK,KAAK,YAAY,KAAK;uBACpB,KAAK,CAAC,OAAO,KAAK,gCAAgC;uBAClD,IAAI,CAAC,KAAK,KAAK,uCAAqB,CAAC,SAAS;oBAEjD,aAAa;oBACb,MAAM;gBAEV;oBACI,MAAM,KAAK,CAAC;YACpB,CAAC;QACL,CAAC;KAAA;CAGJ;AA1LD,8BA0LC"}
|
|
@@ -108,7 +108,7 @@ class A_Meta {
|
|
|
108
108
|
find(name) {
|
|
109
109
|
const results = [];
|
|
110
110
|
for (const [key, value] of this.meta.entries()) {
|
|
111
|
-
if (this.convertToRegExp(
|
|
111
|
+
if (this.convertToRegExp(String(key)).test(name)) {
|
|
112
112
|
results.push([key, value]);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Meta.class.js","sourceRoot":"","sources":["../../../../src/global/A-Meta/A-Meta.class.ts"],"names":[],"mappings":";AAAA,GAAG;AACH,GAAG;AACH,GAAG;AACH,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EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;YAC7C,IAAI,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;YAC/B,CAAC;QACL,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;IAGD;;;;;;;OAOG;IACH,WAAW,CAAC,KAAa;QACrB,MAAM,OAAO,GAAqE,EAAE,CAAC;QACrF,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;YAC7C,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;gBAC1B,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;YAC/B,CAAC;QACL,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;IAGD;;;;;OAKG;IACH,GAAG,CAAC,GAAwB;QACxB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;IAGD;;;;OAIG;IACH,OAAO;QACH,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;IAC/B,CAAC;IAGD;;OAEG;IACH,KAAK;QACD,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;CACJ;AA9KD,wBA8KC"}
|
|
@@ -49,6 +49,7 @@ export declare class A_Scope {
|
|
|
49
49
|
}>(entity: T, instructions: Partial<A_TYPES__ComponentMeta_EntityInjectionInstructions>): InstanceType<T>;
|
|
50
50
|
resolve<T extends A_TYPES__ComponentMeta_InjectionParam>(component: Array<T>): Array<InstanceType<T>>;
|
|
51
51
|
private resolveOnce;
|
|
52
|
+
private resolveEntity;
|
|
52
53
|
private resolveFragment;
|
|
53
54
|
private resolveScope;
|
|
54
55
|
private resolveComponent;
|
|
@@ -98,6 +98,9 @@ class A_Scope {
|
|
|
98
98
|
}
|
|
99
99
|
resolveOnce(component, instructions) {
|
|
100
100
|
switch (true) {
|
|
101
|
+
case a_utils_1.A_CommonHelper.isInheritedFrom(component, A_Entity_class_1.A_Entity): {
|
|
102
|
+
return this.resolveEntity(component, instructions);
|
|
103
|
+
}
|
|
101
104
|
case a_utils_1.A_CommonHelper.isInheritedFrom(component, A_Fragment_class_1.A_Fragment): {
|
|
102
105
|
return this.resolveFragment(component);
|
|
103
106
|
}
|
|
@@ -111,6 +114,27 @@ class A_Scope {
|
|
|
111
114
|
throw new Error(`Injected Component ${component} not found in the scope`);
|
|
112
115
|
}
|
|
113
116
|
}
|
|
117
|
+
resolveEntity(entity, instructions) {
|
|
118
|
+
switch (true) {
|
|
119
|
+
case !instructions: {
|
|
120
|
+
// in this case we have to find the entity by the class or common parent class
|
|
121
|
+
const entities = Array.from(this._entities.values());
|
|
122
|
+
const found = entities.find(e => e instanceof entity);
|
|
123
|
+
return found;
|
|
124
|
+
}
|
|
125
|
+
case !!instructions && !!instructions.aseid && this._entities.has(instructions.aseid): {
|
|
126
|
+
return this._entities.get(instructions.aseid);
|
|
127
|
+
}
|
|
128
|
+
case !!instructions && !!instructions.id && this._entities.has(instructions.id): {
|
|
129
|
+
// in this case we have to find the entity by the id
|
|
130
|
+
const entities = Array.from(this._entities.values());
|
|
131
|
+
const found = entities.find(e => e.id === instructions.id);
|
|
132
|
+
return found;
|
|
133
|
+
}
|
|
134
|
+
default:
|
|
135
|
+
throw new Error(`Entity ${entity.constructor.name} not found in the scope ${this.name}`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
114
138
|
resolveFragment(fragment) {
|
|
115
139
|
if (this._fragments.has(fragment)) {
|
|
116
140
|
return this._fragments.get(fragment);
|
|
@@ -150,14 +174,14 @@ class A_Scope {
|
|
|
150
174
|
}
|
|
151
175
|
register(param1) {
|
|
152
176
|
switch (true) {
|
|
153
|
-
case param1 instanceof
|
|
154
|
-
this.
|
|
177
|
+
case param1 instanceof A_Entity_class_1.A_Entity && !this._entities.has(param1.aseid.toString()): {
|
|
178
|
+
this._entities.set(param1.aseid.toString(), param1);
|
|
155
179
|
// The same situation. Have not idea how to fix it
|
|
156
180
|
A_Context_class_1.A_Context.register(this, param1);
|
|
157
181
|
break;
|
|
158
182
|
}
|
|
159
|
-
case param1 instanceof
|
|
160
|
-
this.
|
|
183
|
+
case param1 instanceof A_Fragment_class_1.A_Fragment && !this._fragments.has(param1.constructor): {
|
|
184
|
+
this._fragments.set(param1.constructor, param1);
|
|
161
185
|
// The same situation. Have not idea how to fix it
|
|
162
186
|
A_Context_class_1.A_Context.register(this, param1);
|
|
163
187
|
break;
|
|
@@ -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,wEAAwK;AACxK,wEAA+D;AAC/D,+DAAsD;AAEtD;;;;;;;;;;;;GAYG;AACH,MAAa,OAAO;IAahB,YACI,MAA0C,EAC1C,SAAwC,EAAE;QAb9C,SAAI,GAAW,EAAE,CAAC;QAEV,gBAAW,GAAiD,IAAI,OAAO,EAAE,CAAC;QAC1E,eAAU,GAAgD,IAAI,OAAO,EAAE,CAAC;QACxE,cAAS,GAA0B,IAAI,GAAG,EAAE,CAAC;QAWjD,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAEjD,yBAAyB;QACzB,MAAM,aAAa,GAA8B;YAC7C,IAAI,EAAE,EAAE;YACR,UAAU,EAAE,EAAE;YACd,SAAS,EAAE,EAAE;YACb,MAAM,EAAE,EAAE;YACV,MAA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,YAAY,yBAAQ,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;gBAC9E,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAC;gBACpD,kDAAkD;gBAClD,2BAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAa,CAAC,CAAC;gBACxC,MAAM;YACV,CAAC;YAED,KAAK,MAAM,YAAY,6BAAU,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;gBAC5E,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;gBAChD,kDAAkD;gBAClD,2BAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAa,CAAC,CAAC;gBACxC,MAAM;YACV,CAAC;YAED,KAAK,MAAM,YAAY,+BAAW,CAAC,CAAC,CAAC;gBACjC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;gBACjD,kDAAkD;gBAClD,2BAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAa,CAAC,CAAC;gBACxC,MAAM;YACV,CAAC;YAED;gBACI,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QACtD,CAAC;IAIL,CAAC;CACJ;AA3TD,0BA2TC"}
|
|
@@ -10,7 +10,7 @@ export class HTTPErrorHandler extends A_Component {
|
|
|
10
10
|
|
|
11
11
|
constructor(
|
|
12
12
|
@A_Inject(A_Logger) private logger: A_Logger
|
|
13
|
-
) {
|
|
13
|
+
) {
|
|
14
14
|
super();
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -18,7 +18,7 @@ export class HTTPErrorHandler extends A_Component {
|
|
|
18
18
|
|
|
19
19
|
@A_Feature.Extend({
|
|
20
20
|
name: 'onRequest',
|
|
21
|
-
|
|
21
|
+
scope: [HttpServer]
|
|
22
22
|
})
|
|
23
23
|
async onErrorPage(
|
|
24
24
|
@A_Inject(HTTPRequest) request: HTTPRequest,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaas/a-concept",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
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",
|
|
@@ -25,8 +25,30 @@ import { A_Meta } from "@adaas/a-concept/global/A-Meta/A-Meta.class";
|
|
|
25
25
|
* @param params
|
|
26
26
|
* @returns
|
|
27
27
|
*/
|
|
28
|
+
/**
|
|
29
|
+
* Use regexp in case if you need more flexibility and control over the name of the method
|
|
30
|
+
*
|
|
31
|
+
* @param regexp
|
|
32
|
+
*/
|
|
33
|
+
export function A_Feature_Extend(
|
|
34
|
+
regexp: RegExp
|
|
35
|
+
)
|
|
36
|
+
/**
|
|
37
|
+
* In this case the name configurations will be used as an input to get scope and name of target function
|
|
38
|
+
* [!] Not that for all SCOPE will be used OR operator
|
|
39
|
+
*
|
|
40
|
+
* @param config
|
|
41
|
+
*/
|
|
28
42
|
export function A_Feature_Extend(
|
|
29
|
-
config: Partial<A_TYPES__A_ExtendDecoratorConfig>
|
|
43
|
+
config: Partial<A_TYPES__A_ExtendDecoratorConfig>
|
|
44
|
+
)
|
|
45
|
+
/**
|
|
46
|
+
* In this case the name of function will be used as a name of the Feature.
|
|
47
|
+
* [!] AND it will be applicable for ANY element where the name is the same as the name of the function
|
|
48
|
+
*/
|
|
49
|
+
export function A_Feature_Extend()
|
|
50
|
+
export function A_Feature_Extend(
|
|
51
|
+
param1?: Partial<A_TYPES__A_ExtendDecoratorConfig> | RegExp
|
|
30
52
|
) {
|
|
31
53
|
return function (
|
|
32
54
|
target: A_Component,
|
|
@@ -34,7 +56,19 @@ export function A_Feature_Extend(
|
|
|
34
56
|
descriptor: A_TYPES__A_ExtendDecoratorDescriptor
|
|
35
57
|
) {
|
|
36
58
|
|
|
37
|
-
|
|
59
|
+
let targetRegexp: RegExp;
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
// Check if the config is a RegExp
|
|
63
|
+
if (param1 instanceof RegExp) {
|
|
64
|
+
targetRegexp = param1;
|
|
65
|
+
}
|
|
66
|
+
else if (!!param1) {
|
|
67
|
+
targetRegexp = new RegExp(`^(${(param1.scope || []).map(el => el.constructor.name).join('|')})\.${param1.name || propertyKey}$`);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
targetRegexp = new RegExp(`^.*\\.${propertyKey}$`);
|
|
71
|
+
}
|
|
38
72
|
|
|
39
73
|
// Get the existed metadata or create a new one
|
|
40
74
|
const existedMeta = A_Context
|
|
@@ -43,20 +77,21 @@ export function A_Feature_Extend(
|
|
|
43
77
|
|| new A_Meta();
|
|
44
78
|
|
|
45
79
|
|
|
46
|
-
const existedMetaValue = existedMeta.get(
|
|
80
|
+
const existedMetaValue = existedMeta.get(targetRegexp.source) || [];
|
|
47
81
|
|
|
48
82
|
// Add the new method to the metadata
|
|
49
83
|
existedMetaValue.push({
|
|
50
|
-
name:
|
|
84
|
+
name: targetRegexp.source,
|
|
51
85
|
handler: propertyKey,
|
|
52
86
|
});
|
|
53
87
|
|
|
54
88
|
// Set the metadata of the method to define a custom Feature with name
|
|
55
|
-
existedMeta.set(
|
|
89
|
+
existedMeta.set(targetRegexp.source, existedMetaValue);
|
|
56
90
|
|
|
57
91
|
// Update the metadata of the container with the new Feature definition
|
|
58
92
|
A_Context
|
|
59
93
|
.meta(target)
|
|
60
94
|
.set(A_TYPES__ComponentMetaKey.EXTENSIONS, existedMeta);
|
|
61
95
|
};
|
|
62
|
-
}
|
|
96
|
+
}
|
|
97
|
+
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
+
import { A_Component } from "@adaas/a-concept/global/A-Component/A-Component.class"
|
|
1
2
|
import { A_Container } from "@adaas/a-concept/global/A-Container/A-Container.class"
|
|
3
|
+
import { A_Entity } from "@adaas/a-concept/global/A-Entity/A-Entity.class"
|
|
2
4
|
|
|
3
5
|
|
|
6
|
+
export type A_TYPES__A_Feature_Extend = {
|
|
7
|
+
(regexp: RegExp): MethodDecorator;
|
|
8
|
+
(config: Partial<A_TYPES__A_ExtendDecoratorConfig>): MethodDecorator;
|
|
9
|
+
(): MethodDecorator;
|
|
10
|
+
};
|
|
11
|
+
|
|
4
12
|
export type A_TYPES__A_FeatureDecoratorDescriptor =
|
|
5
13
|
|
|
6
14
|
TypedPropertyDescriptor<() => any>
|
|
@@ -42,15 +50,23 @@ export type A_TYPES__A_ExtendDecoratorConfig = {
|
|
|
42
50
|
* Name of the container Lifecycle method to be extended.
|
|
43
51
|
*
|
|
44
52
|
* [!] If not provided will be used the name of the method.
|
|
53
|
+
* [!!] If name contains "." dot it will be considered as a path to the method.
|
|
45
54
|
*/
|
|
46
55
|
name: string,
|
|
47
56
|
/**
|
|
48
57
|
* Container class or container name uses to identify the proper container in case when the name is not unique.
|
|
49
58
|
*
|
|
50
59
|
* [!] If not provided will be applied to all containers with the same name.
|
|
60
|
+
* [!!] By default uses OR to join all provided items. If you need more complex Logic, please use Regexp instead
|
|
51
61
|
*/
|
|
52
|
-
|
|
62
|
+
scope: Array<
|
|
63
|
+
{ new(...args: any[]): A_Container<any> }
|
|
64
|
+
| { new(...args: any[]): A_Entity }
|
|
65
|
+
| { new(...args: any[]): A_Component }
|
|
66
|
+
>
|
|
53
67
|
}
|
|
54
68
|
|
|
55
69
|
|
|
56
70
|
|
|
71
|
+
|
|
72
|
+
|
|
@@ -371,7 +371,7 @@ export class A_Context {
|
|
|
371
371
|
const instance = this.getInstance();
|
|
372
372
|
|
|
373
373
|
const component = param1;
|
|
374
|
-
const feature: string = param2
|
|
374
|
+
const feature: string = `${component.constructor.name}.${param2}`;
|
|
375
375
|
const config = param3 || {};
|
|
376
376
|
// TODO: have no idea why it's not working because of that "any"
|
|
377
377
|
const scope = this.scope(component as any);
|
|
@@ -56,12 +56,12 @@ export class A_Entity<
|
|
|
56
56
|
case (props instanceof ASEID):
|
|
57
57
|
this.aseid = props;
|
|
58
58
|
break;
|
|
59
|
-
case (typeof props === 'object' &&
|
|
60
|
-
this.
|
|
59
|
+
case (!!props && typeof props === 'object' && 'aseid' in props):
|
|
60
|
+
this.fromJSON(props);
|
|
61
61
|
break;
|
|
62
62
|
|
|
63
63
|
case (typeof props === 'object'):
|
|
64
|
-
this.
|
|
64
|
+
this.fromNew(props as _ConstructorType);
|
|
65
65
|
break
|
|
66
66
|
|
|
67
67
|
default:
|
|
@@ -170,36 +170,56 @@ export class A_Entity<
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
|
|
173
|
+
// ====================================================================
|
|
174
|
+
// ================== Entity Base Methods =============================
|
|
175
|
+
// ====================================================================
|
|
176
|
+
|
|
173
177
|
@A_Feature.Define({
|
|
174
178
|
name: A_TYPES__EntityBaseMethod.LOAD
|
|
175
179
|
})
|
|
176
|
-
load() {
|
|
177
|
-
|
|
180
|
+
async load() {
|
|
181
|
+
await this.call(A_TYPES__EntityBaseMethod.DESTROY, {
|
|
182
|
+
fragments: [
|
|
183
|
+
this
|
|
184
|
+
]
|
|
185
|
+
});
|
|
186
|
+
}
|
|
178
187
|
|
|
179
|
-
@A_Feature.Define({
|
|
180
|
-
name: A_TYPES__EntityBaseMethod.UPDATE
|
|
181
|
-
})
|
|
182
|
-
update() { }
|
|
183
188
|
|
|
184
189
|
@A_Feature.Define({
|
|
185
190
|
name: A_TYPES__EntityBaseMethod.DESTROY
|
|
186
191
|
})
|
|
187
|
-
destroy() {
|
|
192
|
+
async destroy() {
|
|
193
|
+
await this.call(A_TYPES__EntityBaseMethod.DESTROY, {
|
|
194
|
+
fragments: [
|
|
195
|
+
this
|
|
196
|
+
]
|
|
197
|
+
});
|
|
198
|
+
}
|
|
188
199
|
|
|
189
200
|
|
|
190
201
|
@A_Feature.Define({
|
|
191
202
|
name: A_TYPES__EntityBaseMethod.SAVE
|
|
192
203
|
})
|
|
193
|
-
save() {
|
|
204
|
+
async save() {
|
|
205
|
+
await this.call(A_TYPES__EntityBaseMethod.SAVE, {
|
|
206
|
+
fragments: [
|
|
207
|
+
this
|
|
208
|
+
]
|
|
209
|
+
});
|
|
210
|
+
}
|
|
194
211
|
|
|
195
212
|
|
|
196
213
|
|
|
214
|
+
// ====================================================================
|
|
215
|
+
// ================== Entity Serialization ============================
|
|
216
|
+
// ====================================================================
|
|
197
217
|
|
|
198
|
-
|
|
218
|
+
fromNew(newEntity: _ConstructorType): void {
|
|
199
219
|
return;
|
|
200
220
|
}
|
|
201
221
|
|
|
202
|
-
|
|
222
|
+
fromJSON(serialized: _SerializedType): void {
|
|
203
223
|
this.aseid = new ASEID((serialized).aseid);
|
|
204
224
|
return;
|
|
205
225
|
}
|
|
@@ -219,7 +239,6 @@ export class A_Entity<
|
|
|
219
239
|
}
|
|
220
240
|
|
|
221
241
|
|
|
222
|
-
|
|
223
242
|
toString(): string {
|
|
224
243
|
return this.aseid.toString();
|
|
225
244
|
}
|
|
@@ -12,14 +12,12 @@ export type A_TYPES__EntityCallParams<T extends string> = {
|
|
|
12
12
|
|
|
13
13
|
export type A_TYPES__EntityBaseMethods = [
|
|
14
14
|
A_TYPES__EntityBaseMethod.SAVE,
|
|
15
|
-
A_TYPES__EntityBaseMethod.UPDATE,
|
|
16
15
|
A_TYPES__EntityBaseMethod.DESTROY,
|
|
17
16
|
A_TYPES__EntityBaseMethod.LOAD
|
|
18
17
|
]
|
|
19
18
|
|
|
20
19
|
export enum A_TYPES__EntityBaseMethod {
|
|
21
20
|
SAVE = 'save',
|
|
22
|
-
UPDATE = 'update',
|
|
23
21
|
DESTROY = 'destroy',
|
|
24
22
|
LOAD = 'load'
|
|
25
23
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { A_Feature_Define } from "@adaas/a-concept/decorators/A-Feature/A-Feature-Define.decorator";
|
|
2
2
|
import { A_Feature_Extend } from "@adaas/a-concept/decorators/A-Feature/A-Feature-Extend.decorator";
|
|
3
3
|
import { A_TYPES__FeatureConstructor, A_TYPES__FeatureIteratorReturn, A_TYPES__FeatureState, A_TYPES__FeatureStep } from "./A-Feature.types";
|
|
4
|
-
import { A_Error, A_TYPES__Required } from "@adaas/a-utils";
|
|
4
|
+
import { A_CommonHelper, A_Error, A_TYPES__Required } from "@adaas/a-utils";
|
|
5
5
|
import { A_Context } from "../A-Context/A-Context.class";
|
|
6
|
+
import { A_TYPES__A_Feature_Extend } from "@adaas/a-concept/decorators/A-Feature/A-Feature.decorator.types";
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
|
|
@@ -20,7 +21,7 @@ export class A_Feature {
|
|
|
20
21
|
/**
|
|
21
22
|
* Define a new A-Feature
|
|
22
23
|
*/
|
|
23
|
-
static get Define() {
|
|
24
|
+
static get Define(): typeof A_Feature_Define {
|
|
24
25
|
return A_Feature_Define;
|
|
25
26
|
}
|
|
26
27
|
|
|
@@ -28,7 +29,7 @@ export class A_Feature {
|
|
|
28
29
|
/**
|
|
29
30
|
* Extend an existing A-Feature
|
|
30
31
|
*/
|
|
31
|
-
static get Extend() {
|
|
32
|
+
static get Extend(): A_TYPES__A_Feature_Extend {
|
|
32
33
|
return A_Feature_Extend;
|
|
33
34
|
}
|
|
34
35
|
|
|
@@ -82,9 +83,14 @@ export class A_Feature {
|
|
|
82
83
|
|
|
83
84
|
return {
|
|
84
85
|
value: async () => {
|
|
85
|
-
|
|
86
86
|
if (instance[handler]) {
|
|
87
|
-
const callArgs =
|
|
87
|
+
const callArgs = args.map(arg =>
|
|
88
|
+
// In case if the target is a feature step then pass the current feature
|
|
89
|
+
A_CommonHelper.isInheritedFrom(arg.target, A_Feature)
|
|
90
|
+
? this
|
|
91
|
+
: A_Context.scope(this).resolve(arg.target)
|
|
92
|
+
);
|
|
93
|
+
|
|
88
94
|
await instance[handler](...callArgs);
|
|
89
95
|
}
|
|
90
96
|
|
|
@@ -131,7 +131,7 @@ export class A_Meta<
|
|
|
131
131
|
find(name: string) {
|
|
132
132
|
const results: Array<[keyof _StorageItems, _StorageItems[keyof _StorageItems]]> = [];
|
|
133
133
|
for (const [key, value] of this.meta.entries()) {
|
|
134
|
-
if (this.convertToRegExp(
|
|
134
|
+
if (this.convertToRegExp(String(key)).test(name)) {
|
|
135
135
|
results.push([key, value]);
|
|
136
136
|
}
|
|
137
137
|
}
|
|
@@ -134,11 +134,11 @@ export class A_Scope {
|
|
|
134
134
|
): InstanceType<T>
|
|
135
135
|
resolve<T extends { new(...args: any[]): A_Entity }>(
|
|
136
136
|
entity: T,
|
|
137
|
-
instructions: Partial<A_TYPES__ComponentMeta_EntityInjectionInstructions>
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
137
|
+
instructions: Partial<A_TYPES__ComponentMeta_EntityInjectionInstructions>
|
|
138
|
+
): InstanceType<T>
|
|
139
|
+
resolve<T extends A_TYPES__ComponentMeta_InjectionParam>(
|
|
140
|
+
component: Array<T>
|
|
141
|
+
): Array<InstanceType<T>>
|
|
142
142
|
// base definition
|
|
143
143
|
resolve<T extends A_TYPES__ComponentMeta_InjectionParam>(
|
|
144
144
|
param1: Array<T> | T,
|
|
@@ -165,7 +165,7 @@ export class A_Scope {
|
|
|
165
165
|
private resolveOnce<T extends { new(...args: any[]): A_Entity }>(
|
|
166
166
|
entity: T,
|
|
167
167
|
instructions: Partial<A_TYPES__ComponentMeta_EntityInjectionInstructions>
|
|
168
|
-
): InstanceType<T>
|
|
168
|
+
): InstanceType<T> | undefined
|
|
169
169
|
private resolveOnce<T extends A_TYPES__ComponentMeta_InjectionParam>(
|
|
170
170
|
component: T
|
|
171
171
|
): InstanceType<T>
|
|
@@ -174,6 +174,10 @@ export class A_Scope {
|
|
|
174
174
|
instructions?: Partial<A_TYPES__ComponentMeta_EntityInjectionInstructions>
|
|
175
175
|
): InstanceType<T> {
|
|
176
176
|
switch (true) {
|
|
177
|
+
case A_CommonHelper.isInheritedFrom(component, A_Entity): {
|
|
178
|
+
return this.resolveEntity(component as typeof A_Entity, instructions) as InstanceType<T>;
|
|
179
|
+
}
|
|
180
|
+
|
|
177
181
|
case A_CommonHelper.isInheritedFrom(component, A_Fragment): {
|
|
178
182
|
return this.resolveFragment(component as typeof A_Fragment) as InstanceType<T>;
|
|
179
183
|
}
|
|
@@ -192,6 +196,40 @@ export class A_Scope {
|
|
|
192
196
|
}
|
|
193
197
|
|
|
194
198
|
|
|
199
|
+
private resolveEntity<T extends { new(...args: any[]): A_Entity }>(
|
|
200
|
+
entity: T,
|
|
201
|
+
instructions?: Partial<A_TYPES__ComponentMeta_EntityInjectionInstructions>
|
|
202
|
+
): InstanceType<T> | undefined {
|
|
203
|
+
|
|
204
|
+
switch (true) {
|
|
205
|
+
case !instructions: {
|
|
206
|
+
// in this case we have to find the entity by the class or common parent class
|
|
207
|
+
const entities = Array.from(this._entities.values());
|
|
208
|
+
|
|
209
|
+
const found = entities.find(e => e instanceof entity);
|
|
210
|
+
|
|
211
|
+
return found as InstanceType<T>;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
case !!instructions && !!instructions.aseid && this._entities.has(instructions.aseid): {
|
|
215
|
+
return this._entities.get(instructions.aseid) as InstanceType<T>;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
case !!instructions && !!instructions.id && this._entities.has(instructions.id): {
|
|
219
|
+
// in this case we have to find the entity by the id
|
|
220
|
+
const entities = Array.from(this._entities.values());
|
|
221
|
+
|
|
222
|
+
const found = entities.find(e => e.id === instructions.id);
|
|
223
|
+
|
|
224
|
+
return found as InstanceType<T>;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
default:
|
|
228
|
+
throw new Error(`Entity ${entity.constructor.name} not found in the scope ${this.name}`);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
|
|
195
233
|
|
|
196
234
|
private resolveFragment<T extends typeof A_Fragment>(fragment: T): InstanceType<T> {
|
|
197
235
|
|
|
@@ -206,6 +244,7 @@ export class A_Scope {
|
|
|
206
244
|
throw new Error(`Fragment ${fragment.name} not found in the scope ${this.name}`);
|
|
207
245
|
}
|
|
208
246
|
|
|
247
|
+
|
|
209
248
|
private resolveScope(scope: typeof A_Scope): A_Scope {
|
|
210
249
|
return this;
|
|
211
250
|
}
|
|
@@ -267,15 +306,15 @@ export class A_Scope {
|
|
|
267
306
|
|
|
268
307
|
|
|
269
308
|
switch (true) {
|
|
270
|
-
case param1 instanceof
|
|
271
|
-
this.
|
|
309
|
+
case param1 instanceof A_Entity && !this._entities.has(param1.aseid.toString()): {
|
|
310
|
+
this._entities.set(param1.aseid.toString(), param1);
|
|
272
311
|
// The same situation. Have not idea how to fix it
|
|
273
312
|
A_Context.register(this, param1 as any);
|
|
274
313
|
break;
|
|
275
314
|
}
|
|
276
315
|
|
|
277
|
-
case param1 instanceof
|
|
278
|
-
this.
|
|
316
|
+
case param1 instanceof A_Fragment && !this._fragments.has(param1.constructor): {
|
|
317
|
+
this._fragments.set(param1.constructor, param1);
|
|
279
318
|
// The same situation. Have not idea how to fix it
|
|
280
319
|
A_Context.register(this, param1 as any);
|
|
281
320
|
break;
|