@adaas/a-concept 0.0.8 → 0.0.10
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/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.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 +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.d.ts +2 -2
- 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-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 +4 -1
- 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/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/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 +1 -1
- package/src/global/A-Entity/A-Entity.class.ts +30 -2
- package/src/global/A-Feature/A-Feature.class.ts +4 -3
- package/src/global/A-Feature/A-Feature.types.ts +2 -2
- package/src/global/A-Meta/A-Meta.class.ts +1 -1
- package/src/global/A-Scope/A-Scope.class.ts +33 -6
|
@@ -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
|
};
|
|
@@ -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"}
|
|
@@ -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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BAC7B,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;gBACrC,MAAM;YAEV;gBACI,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAE7C,CAAC;QAGD,sCAAsC;QAEtC,2CAA2C;QAE3C,gCAAgC;QAChC,wBAAwB;QAExB,wCAAwC;QACxC,yBAAyB;QACzB,6BAA6B;QAC7B,eAAe;QACf,2CAA2C;QAC3C,gCAAgC;QAChC,QAAQ;QAER,UAAU;QACV,wEAAwE;QACxE,gFAAgF;QAChF,UAAU;QACV,iBAAiB;QACjB,2BAA2B;QAC3B,6CAA6C;QAC7C,yCAAyC;QACzC,iDAAiD;QACjD,6BAA6B;QAG7B,sBAAsB;QACtB,iCAAiC;QAEjC,4DAA4D;QAE5D,mBAAmB;IAEvB,CAAC;CACJ;AA9dD,8BA8dC"}
|
|
@@ -1,5 +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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M,CAAC;QACd,IAAI,EAAE,0CAAyB,CAAC,IAAI;KACvC,CAAC;oCACQ"}
|
|
@@ -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,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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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
|
};
|
|
@@ -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,GAAG;AACH,GAAG;AACH,GAAG;;;AAGH;;;;GAIG;AACH,MAAa,MAAM;IAAnB;QAKc,SAAI,GAAiE,IAAI,GAAG,EAAE,CAAC;IAyK7F,CAAC;IAtKG;;;;OAIG;IACH,CAAC,MAAM,CAAC,QAAQ,CAAC;QACb,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QACrC,OAAO;YACH,IAAI,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE;SAC9B,CAAC;IACN,CAAC;IAID,sGAAsG;IACtG,sGAAsG;IACtG,sGAAsG;IACtG;;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C;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"}
|
|
@@ -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;
|
|
@@ -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.ts"],"names":[],"mappings":";;;AAAA,4CAAgD;AAEhD,qEA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AC,4BAA4B,CAAC,CAAC;QACtD,CAAC;IAIL,CAAC;CACJ;AApRD,0BAoRC"}
|
|
@@ -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.10",
|
|
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
|
+
|
|
@@ -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 }
|
|
@@ -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);
|
|
@@ -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 {
|
|
@@ -3,6 +3,7 @@ import { A_Feature_Extend } from "@adaas/a-concept/decorators/A-Feature/A-Featur
|
|
|
3
3
|
import { A_TYPES__FeatureConstructor, A_TYPES__FeatureIteratorReturn, A_TYPES__FeatureState, A_TYPES__FeatureStep } from "./A-Feature.types";
|
|
4
4
|
import { 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
|
|
|
@@ -84,7 +85,7 @@ export class A_Feature {
|
|
|
84
85
|
value: async () => {
|
|
85
86
|
|
|
86
87
|
if (instance[handler]) {
|
|
87
|
-
const callArgs = A_Context.scope(this).resolve(args);
|
|
88
|
+
const callArgs = A_Context.scope(this).resolve(args.map(arg => arg.target));
|
|
88
89
|
await instance[handler](...callArgs);
|
|
89
90
|
}
|
|
90
91
|
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|
|
@@ -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>
|
|
138
|
+
): InstanceType<T>
|
|
139
|
+
resolve<T extends A_TYPES__ComponentMeta_InjectionParam>(
|
|
140
|
+
component: Array<T>
|
|
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
|
|