@adaas/a-concept 0.0.28 → 0.0.30
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/fe-be/channels/Test.channel.d.ts +6 -0
- package/dist/examples/fe-be/channels/Test.channel.js +14 -0
- package/dist/examples/fe-be/channels/Test.channel.js.map +1 -0
- package/dist/examples/fe-be/components/BE-Controller.component.d.ts +4 -0
- package/dist/examples/fe-be/components/BE-Controller.component.js +24 -0
- package/dist/examples/fe-be/components/BE-Controller.component.js.map +1 -0
- package/dist/examples/fe-be/components/FE.component.d.ts +4 -0
- package/dist/examples/fe-be/components/FE.component.js +31 -0
- package/dist/examples/fe-be/components/FE.component.js.map +1 -0
- package/dist/examples/fe-be/components/UserActions.component.d.ts +5 -0
- package/dist/examples/fe-be/components/UserActions.component.js +25 -0
- package/dist/examples/fe-be/components/UserActions.component.js.map +1 -0
- package/dist/examples/fe-be/concept.d.ts +0 -0
- package/dist/examples/fe-be/concept.js +2 -0
- package/dist/examples/fe-be/concept.js.map +1 -0
- package/dist/examples/fe-be/containers/ServerApp.container.d.ts +3 -0
- package/dist/examples/fe-be/containers/ServerApp.container.js +8 -0
- package/dist/examples/fe-be/containers/ServerApp.container.js.map +1 -0
- package/dist/examples/fe-be/containers/WebApp.container.d.ts +3 -0
- package/dist/examples/fe-be/containers/WebApp.container.js +8 -0
- package/dist/examples/fe-be/containers/WebApp.container.js.map +1 -0
- package/dist/examples/multi-container/channels/Direct.channel.d.ts +9 -0
- package/dist/examples/multi-container/channels/Direct.channel.js +32 -0
- package/dist/examples/multi-container/channels/Direct.channel.js.map +1 -0
- package/dist/examples/multi-container/concept.d.ts +0 -0
- package/dist/examples/multi-container/concept.js +2 -0
- package/dist/examples/multi-container/concept.js.map +1 -0
- package/dist/examples/multi-container/containers/Command.container.d.ts +11 -0
- package/dist/examples/multi-container/containers/Command.container.js +51 -0
- package/dist/examples/multi-container/containers/Command.container.js.map +1 -0
- package/dist/examples/multi-container/containers/Schedule.container.d.ts +15 -0
- package/dist/examples/multi-container/containers/Schedule.container.js +67 -0
- package/dist/examples/multi-container/containers/Schedule.container.js.map +1 -0
- package/dist/examples/simple/components/A.component.js.map +1 -1
- package/dist/examples/simple/containers/Main.container.js +7 -3
- package/dist/examples/simple/containers/Main.container.js.map +1 -1
- package/dist/examples/simple/entities/EntityA.entity.d.ts +8 -0
- package/dist/examples/simple/entities/EntityA.entity.js +22 -0
- package/dist/examples/simple/entities/EntityA.entity.js.map +1 -0
- package/dist/examples/simple-http-server/contexts/http-request.context.d.ts +0 -1
- package/dist/examples/simple-http-server/contexts/http-request.context.js +6 -8
- package/dist/examples/simple-http-server/contexts/http-request.context.js.map +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.js +16 -7
- package/dist/index.js.map +1 -1
- package/dist/src/base/A-Config/components/ConfigReader.component.d.ts +2 -1
- package/dist/src/base/A-Config/components/ConfigReader.component.js +12 -12
- package/dist/src/base/A-Config/components/ConfigReader.component.js.map +1 -1
- package/dist/src/decorators/A-Abstraction/A-Abstraction.decorator.d.ts +14 -0
- package/dist/src/decorators/A-Abstraction/A-Abstraction.decorator.js +53 -0
- package/dist/src/decorators/A-Abstraction/A-Abstraction.decorator.js.map +1 -0
- package/dist/src/decorators/A-Abstraction/A-Abstraction.decorator.types.d.ts +2 -0
- package/dist/src/decorators/A-Abstraction/A-Abstraction.decorator.types.js +3 -0
- package/dist/src/decorators/A-Abstraction/A-Abstraction.decorator.types.js.map +1 -0
- package/dist/src/decorators/A-Connect/A-Connect.decorator.d.ts +19 -0
- package/dist/src/decorators/A-Connect/A-Connect.decorator.js +31 -0
- package/dist/src/decorators/A-Connect/A-Connect.decorator.js.map +1 -0
- package/dist/src/decorators/A-Connect/A-Connect.decorator.types.d.ts +1 -0
- package/dist/src/decorators/A-Connect/A-Connect.decorator.types.js +3 -0
- package/dist/src/decorators/A-Connect/A-Connect.decorator.types.js.map +1 -0
- package/dist/src/decorators/A-Entity/A-Entity-List.decorator.d.ts +1 -0
- package/dist/src/decorators/A-Entity/A-Entity-List.decorator.js +8 -0
- package/dist/src/decorators/A-Entity/A-Entity-List.decorator.js.map +1 -0
- package/dist/src/decorators/A-Entity/A-Entity.decorator.types.d.ts +14 -0
- package/dist/src/decorators/A-Entity/A-Entity.decorator.types.js +3 -0
- package/dist/src/decorators/A-Entity/A-Entity.decorator.types.js.map +1 -0
- package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.js +9 -0
- 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 +28 -0
- package/dist/src/decorators/A-Inject/A-Inject.decorator.d.ts +2 -3
- package/dist/src/decorators/A-Inject/A-Inject.decorator.js.map +1 -1
- package/dist/src/decorators/A-Inject/A-Inject.decorator.types.d.ts +44 -0
- package/dist/src/global/A-Channel/A-Channel.class.d.ts +8 -10
- package/dist/src/global/A-Channel/A-Channel.class.js +12 -26
- package/dist/src/global/A-Channel/A-Channel.class.js.map +1 -1
- package/dist/src/global/A-Channel/A-Channel.types.d.ts +32 -0
- package/dist/src/global/A-Component/A-Component.class.d.ts +2 -1
- package/dist/src/global/A-Component/A-Component.class.js +1 -0
- package/dist/src/global/A-Component/A-Component.class.js.map +1 -1
- package/dist/src/global/A-Component/A-Component.meta.d.ts +8 -0
- package/dist/src/global/A-Component/A-Component.meta.js +27 -1
- package/dist/src/global/A-Component/A-Component.meta.js.map +1 -1
- package/dist/src/global/A-Component/A-Component.types.d.ts +19 -34
- package/dist/src/global/A-Component/A-Component.types.js +1 -7
- package/dist/src/global/A-Component/A-Component.types.js.map +1 -1
- package/dist/src/global/A-Concept/A_Concept.class.d.ts +7 -7
- package/dist/src/global/A-Concept/A_Concept.class.js +30 -30
- package/dist/src/global/A-Concept/A_Concept.class.js.map +1 -1
- package/dist/src/global/A-Concept/A_Concept.types.d.ts +42 -2
- package/dist/src/global/A-Concept/A_Concept.types.js.map +1 -1
- package/dist/src/global/A-Container/A-Container.class.d.ts +1 -8
- package/dist/src/global/A-Container/A-Container.class.js +1 -31
- package/dist/src/global/A-Container/A-Container.class.js.map +1 -1
- package/dist/src/global/A-Container/A-Container.meta.d.ts +8 -0
- package/dist/src/global/A-Container/A-Container.meta.js +29 -0
- package/dist/src/global/A-Container/A-Container.meta.js.map +1 -1
- package/dist/src/global/A-Container/A-Container.types.d.ts +23 -7
- package/dist/src/global/A-Container/A-Container.types.js +2 -1
- package/dist/src/global/A-Container/A-Container.types.js.map +1 -1
- package/dist/src/global/A-Context/A-Context.class.js +6 -35
- package/dist/src/global/A-Context/A-Context.class.js.map +1 -1
- package/dist/src/global/A-Entity/A-Entity.class.d.ts +1 -2
- package/dist/src/global/A-Entity/A-Entity.class.js +6 -7
- package/dist/src/global/A-Entity/A-Entity.class.js.map +1 -1
- package/dist/src/global/A-Entity/A-Entity.types.d.ts +4 -5
- package/dist/src/global/A-Entity/A-Entity.types.js.map +1 -1
- package/dist/src/global/A-Feature/A-Feature.class.d.ts +30 -6
- package/dist/src/global/A-Feature/A-Feature.class.js +49 -40
- 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 -24
- package/dist/src/global/A-Feature/A-Feature.types.js +21 -0
- package/dist/src/global/A-Feature/A-Feature.types.js.map +1 -1
- package/dist/src/global/A-Fragment/A-Fragment.class.d.ts +8 -0
- package/dist/src/global/A-Fragment/A-Fragment.class.js +10 -0
- package/dist/src/global/A-Fragment/A-Fragment.class.js.map +1 -1
- package/dist/src/global/A-Scope/A-Scope.class.d.ts +7 -5
- package/dist/src/global/A-Scope/A-Scope.class.js +33 -10
- package/dist/src/global/A-Scope/A-Scope.class.js.map +1 -1
- package/dist/src/global/A-Scope/A-Scope.types.d.ts +2 -1
- package/dist/src/global/A-Stage/A-Stage.class.d.ts +69 -0
- package/dist/src/global/A-Stage/A-Stage.class.js +176 -0
- package/dist/src/global/A-Stage/A-Stage.class.js.map +1 -0
- package/dist/src/global/A-Stage/A-Stage.types.d.ts +83 -0
- package/dist/src/global/A-Stage/A-Stage.types.js +59 -0
- package/dist/src/global/A-Stage/A-Stage.types.js.map +1 -0
- package/dist/src/helpers/StepsManager.class.d.ts +15 -0
- package/dist/src/helpers/StepsManager.class.js +85 -0
- package/dist/src/helpers/StepsManager.class.js.map +1 -0
- package/examples/fe-be/channels/Test.channel.ts +24 -0
- package/examples/fe-be/components/BE-Controller.component.ts +20 -0
- package/examples/fe-be/components/FE.component.ts +13 -0
- package/examples/fe-be/concept.ts +0 -0
- package/examples/fe-be/containers/ServerApp.container.ts +8 -0
- package/examples/fe-be/containers/WebApp.container.ts +13 -0
- package/examples/multi-container/channels/Direct.channel.ts +39 -0
- package/examples/multi-container/concept.ts +0 -0
- package/examples/multi-container/containers/Command.container.ts +41 -0
- package/examples/multi-container/containers/Schedule.container.ts +57 -0
- package/examples/simple/components/A.component.ts +2 -1
- package/examples/simple/containers/Main.container.ts +11 -3
- package/examples/simple/entities/EntityA.entity.ts +16 -0
- package/examples/simple-http-server/contexts/http-request.context.ts +6 -6
- package/index.ts +12 -3
- package/package.json +1 -1
- package/src/base/A-Config/components/ConfigReader.component.ts +12 -11
- package/src/decorators/A-Abstraction/A-Abstraction.decorator.ts +82 -0
- package/src/decorators/{A-Stage/A-Stage.decorator.types.ts → A-Abstraction/A-Abstraction.decorator.types.ts} +1 -3
- package/src/decorators/A-Connect/A-Connect.decorator.ts +71 -0
- package/src/decorators/A-Connect/A-Connect.decorator.types.ts +6 -0
- package/src/decorators/A-Entity/A-Entity-List.decorator.ts +12 -0
- package/src/decorators/A-Entity/A-Entity.decorator.types.ts +18 -0
- package/src/decorators/A-Feature/A-Feature-Extend.decorator.ts +10 -0
- package/src/decorators/A-Feature/A-Feature.decorator.types.ts +36 -0
- package/src/decorators/A-Inject/A-Inject.decorator.ts +7 -7
- package/src/decorators/A-Inject/A-Inject.decorator.types.ts +47 -1
- package/src/global/A-Channel/A-Channel.class.ts +25 -28
- package/src/global/A-Channel/A-Channel.types.ts +53 -0
- package/src/global/A-Component/A-Component.class.ts +10 -2
- package/src/global/A-Component/A-Component.meta.ts +42 -1
- package/src/global/A-Component/A-Component.types.ts +20 -40
- package/src/global/A-Concept/A_Concept.class.ts +52 -31
- package/src/global/A-Concept/A_Concept.types.ts +48 -3
- package/src/global/A-Container/A-Container.class.ts +3 -39
- package/src/global/A-Container/A-Container.meta.ts +41 -4
- package/src/global/A-Container/A-Container.types.ts +28 -7
- package/src/global/A-Context/A-Context.class.ts +9 -49
- package/src/global/A-Entity/A-Entity.class.ts +8 -6
- package/src/global/A-Entity/A-Entity.types.ts +4 -5
- package/src/global/A-Feature/A-Feature.class.ts +73 -61
- package/src/global/A-Feature/A-Feature.types.ts +24 -23
- package/src/global/A-Fragment/A-Fragment.class.ts +15 -0
- package/src/global/A-Scope/A-Scope.class.ts +58 -25
- package/src/global/A-Scope/A-Scope.types.ts +2 -1
- package/src/global/A-Stage/A-Stage.class.ts +225 -0
- package/src/global/A-Stage/A-Stage.types.ts +106 -0
- package/src/helpers/StepsManager.class.ts +104 -0
- package/tests/channel.ts +213 -0
- package/tests/log.ts +88 -40
- package/src/decorators/A-Stage/A-Stage.decorator.ts +0 -84
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { A_Component } from "@adaas/a-concept/global/A-Component/A-Component.class";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
A_TYPES__A_InjectDecorator_EntityInjectionInstructions,
|
|
4
|
+
A_TYPES__A_InjectDecoratorReturn
|
|
5
|
+
} from "./A-Inject.decorator.types";
|
|
3
6
|
import { A_Fragment } from "@adaas/a-concept/global/A-Fragment/A-Fragment.class";
|
|
4
7
|
import { A_Scope } from "@adaas/a-concept/global/A-Scope/A-Scope.class";
|
|
5
8
|
import { A_Context } from "@adaas/a-concept/global/A-Context/A-Context.class";
|
|
6
|
-
import {
|
|
9
|
+
import { A_TYPES__ComponentMetaKey } from "@adaas/a-concept/global/A-Component/A-Component.types";
|
|
7
10
|
import { A_Meta } from "@adaas/a-concept/global/A-Meta/A-Meta.class";
|
|
8
11
|
import { A_Feature } from "@adaas/a-concept/global/A-Feature/A-Feature.class";
|
|
9
12
|
import { A_Entity } from "@adaas/a-concept/global/A-Entity/A-Entity.class";
|
|
@@ -42,7 +45,7 @@ export function A_Inject(
|
|
|
42
45
|
|
|
43
46
|
export function A_Inject(
|
|
44
47
|
entity: { new(...args: any[]): A_Entity },
|
|
45
|
-
config: Partial<
|
|
48
|
+
config: Partial<A_TYPES__A_InjectDecorator_EntityInjectionInstructions>
|
|
46
49
|
): A_TYPES__A_InjectDecoratorReturn
|
|
47
50
|
|
|
48
51
|
// ====================== BASE FUNCTION ======================
|
|
@@ -52,10 +55,7 @@ export function A_Inject(
|
|
|
52
55
|
| { new(...args: any[]): A_Component }
|
|
53
56
|
| { new(...args: any[]): A_Fragment }
|
|
54
57
|
| { new(...args: any[]): A_Entity },
|
|
55
|
-
param2?:
|
|
56
|
-
aseid?: string,
|
|
57
|
-
id?: string,
|
|
58
|
-
}
|
|
58
|
+
param2?: Partial<A_TYPES__A_InjectDecorator_EntityInjectionInstructions>
|
|
59
59
|
): A_TYPES__A_InjectDecoratorReturn {
|
|
60
60
|
return function (
|
|
61
61
|
target: A_Component,
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import { A_Component } from "@adaas/a-concept/global/A-Component/A-Component.class";
|
|
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";
|
|
4
|
+
import { A_Feature } from "@adaas/a-concept/global/A-Feature/A-Feature.class";
|
|
5
|
+
import { A_Fragment } from "@adaas/a-concept/global/A-Fragment/A-Fragment.class";
|
|
6
|
+
import { A_Scope } from "@adaas/a-concept/global/A-Scope/A-Scope.class";
|
|
7
|
+
import { ASEID } from "@adaas/a-utils";
|
|
1
8
|
|
|
2
9
|
export type A_TYPES__A_InjectDecoratorDescriptor = TypedPropertyDescriptor<(
|
|
3
10
|
...args: any[]
|
|
@@ -34,4 +41,43 @@ export type A_TYPES__A_InjectDecoratorStorageInstruction = Array<
|
|
|
34
41
|
// | Array<typeof A_Container>
|
|
35
42
|
// | Array<typeof A_ContextFragment>
|
|
36
43
|
| { new(...args: any[]): any }
|
|
37
|
-
>
|
|
44
|
+
>
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
export type A_TYPES__A_InjectDecorator_Meta = Array<{
|
|
49
|
+
target: A_TYPES__A_InjectDecorator_Injectable
|
|
50
|
+
} | {
|
|
51
|
+
target: { new(...args: any[]): A_Entity },
|
|
52
|
+
instructions: Partial<A_TYPES__A_InjectDecorator_EntityInjectionInstructions>
|
|
53
|
+
}>;
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
export type A_TYPES__A_InjectDecorator_Injectable =
|
|
57
|
+
{ new(...args: any[]): A_Fragment }
|
|
58
|
+
| { new(...args: any[]): A_Component }
|
|
59
|
+
| { new(...args: any[]): A_Container<any> }
|
|
60
|
+
| { new(...args: any[]): A_Scope }
|
|
61
|
+
| { new(...args: any[]): A_Feature }
|
|
62
|
+
| { new(...args: any[]): A_Entity<any, any, any> };
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
export type A_TYPES__A_InjectDecorator_EntityInjectionInstructions = {
|
|
66
|
+
query: Partial<A_TYPES__A_InjectDecorator_EntityInjectionQuery>,
|
|
67
|
+
pagination: Partial<A_TYPES__A_InjectDecorator_EntityInjectionPagination>
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
export type A_TYPES__A_InjectDecorator_EntityInjectionQuery = {
|
|
72
|
+
aseid: string | ASEID,
|
|
73
|
+
id: string,
|
|
74
|
+
type: { new(...args: any[]): A_Entity<any, any, any> },
|
|
75
|
+
entity: string
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
export type A_TYPES__A_InjectDecorator_EntityInjectionPagination = {
|
|
80
|
+
count: number,
|
|
81
|
+
from: 'start' | 'end'
|
|
82
|
+
}
|
|
83
|
+
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { A_Component } from "../A-Component/A-Component.class";
|
|
2
|
+
import { A_Container } from "../A-Container/A-Container.class";
|
|
3
|
+
import { A_TYPES__A_ChannelAggregated, A_TYPES__A_ChannelAggregateMethods, A_TYPES__A_ChannelCallParams, A_TYPES__A_ChannelConstructor } from "./A-Channel.types";
|
|
1
4
|
|
|
2
5
|
|
|
3
6
|
/**
|
|
@@ -7,42 +10,36 @@
|
|
|
7
10
|
* When One container needs to communicate with another container, it uses A_Channel.
|
|
8
11
|
*
|
|
9
12
|
*/
|
|
10
|
-
export class A_Channel<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
export class A_Channel<
|
|
14
|
+
T extends Array<A_Component | A_Container> = any[],
|
|
15
|
+
_Constructor extends A_TYPES__A_ChannelConstructor = A_TYPES__A_ChannelConstructor
|
|
16
|
+
> {
|
|
13
17
|
|
|
14
|
-
|
|
15
|
-
private realClass: { new(...args: any[]): T },
|
|
16
|
-
private args: any[]
|
|
17
|
-
) {
|
|
18
|
+
id: string;
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
protected channel: A_TYPES__A_ChannelAggregated<T>;
|
|
20
21
|
|
|
21
|
-
protected async loadInstance(): Promise<T> {
|
|
22
|
-
if (!this.realInstance)
|
|
23
|
-
this.realInstance = new this.realClass(...this.args);
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
constructor(params: A_TYPES__A_ChannelConstructor) {
|
|
24
|
+
this.id = params.id;
|
|
27
25
|
|
|
26
|
+
this.channel = new Proxy(
|
|
27
|
+
{} as A_TYPES__A_ChannelAggregated<T>,
|
|
28
|
+
{
|
|
29
|
+
get: (target, prop) => {
|
|
30
|
+
return async (...args: any[]) => {
|
|
31
|
+
this.call(prop as A_TYPES__A_ChannelAggregateMethods<T>);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
28
36
|
|
|
29
|
-
public async resolve(): Promise<T> {
|
|
30
|
-
if (!this.proxyInstance) {
|
|
31
|
-
const realInstance = await this.loadInstance();
|
|
32
37
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const value = (realInstance as any)[prop];
|
|
38
|
+
async call<_Resp extends any>(prop: A_TYPES__A_ChannelAggregateMethods<T>, params?: Partial<A_TYPES__A_ChannelCallParams>): Promise<_Resp> {
|
|
39
|
+
// do HTTP Call or just inject class or whatever you want
|
|
36
40
|
|
|
37
|
-
|
|
38
|
-
if (typeof value === 'function') {
|
|
39
|
-
return value.bind(realInstance);
|
|
40
|
-
}
|
|
41
|
-
return value;
|
|
42
|
-
}
|
|
43
|
-
}) as T;
|
|
44
|
-
}
|
|
41
|
+
console.log('Calling method', prop);
|
|
45
42
|
|
|
46
|
-
return
|
|
43
|
+
return {} as _Resp;
|
|
47
44
|
}
|
|
48
45
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { A_Component } from "../A-Component/A-Component.class"
|
|
2
|
+
import { A_TYPES__ContainerCallParams } from "../A-Container/A-Container.types"
|
|
3
|
+
import { A_Fragment } from "../A-Fragment/A-Fragment.class"
|
|
1
4
|
|
|
2
5
|
|
|
3
6
|
export type A_TYPES__A_DependencyReferenceConstructor = {
|
|
@@ -58,3 +61,53 @@ export type A_TYPES__A_DependencyReferenceConstructorConfig = {
|
|
|
58
61
|
timeout: number
|
|
59
62
|
}
|
|
60
63
|
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
export type A_TYPES__A_ChannelCallParams = {
|
|
67
|
+
fragments: Array<A_Fragment>,
|
|
68
|
+
components: Array<typeof A_Component>
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Returns a string set of possible methods that could be called on a provided A-Component
|
|
74
|
+
*/
|
|
75
|
+
export type A_TYPES__A_ExecutableMethods<T> = {
|
|
76
|
+
[K in keyof T]: T[K] extends (...arg: Partial<A_TYPES__A_ChannelCallParams>[]) => Promise<any> ? K : never
|
|
77
|
+
}[keyof T];
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Returns a string set of possible methods that could be called on a set of provided set of A-Components
|
|
82
|
+
*/
|
|
83
|
+
export type A_TYPES__A_ChannelAggregateMethods<TClasses extends A_Component[]> = {
|
|
84
|
+
[K in keyof TClasses]: TClasses[K] extends infer Instance
|
|
85
|
+
? A_TYPES__A_ExecutableMethods<Instance>
|
|
86
|
+
: never;
|
|
87
|
+
}[number];
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Describes a type of proxy object and consists of all callable methods from a set opf provided components
|
|
92
|
+
*/
|
|
93
|
+
export type A_TYPES__A_ChannelAggregated<TClasses extends any[]> = {
|
|
94
|
+
[Method in A_TYPES__A_ChannelAggregateMethods<TClasses>]: {
|
|
95
|
+
[Class in keyof TClasses]: TClasses[Class] extends infer Instance
|
|
96
|
+
? Method extends keyof Instance
|
|
97
|
+
// Just put it here for possible cases with detailed params
|
|
98
|
+
// ? Instance[Method]
|
|
99
|
+
? (params: Partial<A_TYPES__A_ChannelCallParams>) => Promise<any>
|
|
100
|
+
: never
|
|
101
|
+
: never;
|
|
102
|
+
}[number]; // Select the method signature from any matching class
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* A set of parameters are required to construct a new A-Channel
|
|
110
|
+
*/
|
|
111
|
+
export type A_TYPES__A_ChannelConstructor = {
|
|
112
|
+
id: string,
|
|
113
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { A_TYPES__Required } from "@adaas/a-utils";
|
|
2
2
|
import { A_Context } from "../A-Context/A-Context.class";
|
|
3
|
-
import { A_TYPES__ComponentCallParams } from "./A-Component.types";
|
|
3
|
+
import { A_TYPES__ComponentCallParams, A_TYPES__ComponentConstructor } from "./A-Component.types";
|
|
4
4
|
import { A_Scope } from "../A-Scope/A-Scope.class";
|
|
5
5
|
|
|
6
|
+
|
|
7
|
+
|
|
6
8
|
/**
|
|
7
9
|
* This element only contains the specific code
|
|
8
10
|
*
|
|
@@ -10,6 +12,9 @@ import { A_Scope } from "../A-Scope/A-Scope.class";
|
|
|
10
12
|
export class A_Component<
|
|
11
13
|
_FeatureNames extends Array<string> = any,
|
|
12
14
|
> {
|
|
15
|
+
constructor(
|
|
16
|
+
params?: Partial<A_TYPES__ComponentConstructor<_FeatureNames>>
|
|
17
|
+
) { }
|
|
13
18
|
|
|
14
19
|
|
|
15
20
|
/**
|
|
@@ -62,4 +67,7 @@ export class A_Component<
|
|
|
62
67
|
|
|
63
68
|
return await newFeature.process();
|
|
64
69
|
}
|
|
65
|
-
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { A_TYPES__ConceptAbstractionMeta, A_TYPES__ConceptStage } from "../A-Concept/A_Concept.types";
|
|
1
2
|
import { A_Meta } from "../A-Meta/A-Meta.class";
|
|
2
3
|
import { A_TYPES__ComponentMeta, A_TYPES__ComponentMetaExtension, A_TYPES__ComponentMetaKey } from "./A-Component.types";
|
|
3
4
|
|
|
@@ -35,7 +36,10 @@ export class A_ComponentMeta extends A_Meta<A_TYPES__ComponentMeta> {
|
|
|
35
36
|
// component: constructor,
|
|
36
37
|
name: extension.name,
|
|
37
38
|
handler: extension.handler,
|
|
38
|
-
args
|
|
39
|
+
args,
|
|
40
|
+
behavior: extension.behavior,
|
|
41
|
+
before: extension.before || [],
|
|
42
|
+
after: extension.after || []
|
|
39
43
|
});
|
|
40
44
|
|
|
41
45
|
});
|
|
@@ -45,4 +49,41 @@ export class A_ComponentMeta extends A_Meta<A_TYPES__ComponentMeta> {
|
|
|
45
49
|
return steps;
|
|
46
50
|
}
|
|
47
51
|
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Returns a set of instructions to run proper methods in Component during A-Concept Stage
|
|
55
|
+
*
|
|
56
|
+
* @param stage
|
|
57
|
+
* @returns
|
|
58
|
+
*/
|
|
59
|
+
abstractions(
|
|
60
|
+
abstraction: A_TYPES__ConceptStage
|
|
61
|
+
): A_TYPES__ConceptAbstractionMeta[] {
|
|
62
|
+
const steps: A_TYPES__ConceptAbstractionMeta[] = [];
|
|
63
|
+
|
|
64
|
+
const abstractions = this.get(A_TYPES__ComponentMetaKey.ABSTRACTIONS);
|
|
65
|
+
const injections = this.get(A_TYPES__ComponentMetaKey.INJECTIONS);
|
|
66
|
+
|
|
67
|
+
// const constructor = A_Context.component(this);
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
abstractions
|
|
71
|
+
// returns all extensions that match the feature
|
|
72
|
+
?.find(`CONCEPT_ABSTRACTION::${abstraction}`)
|
|
73
|
+
.forEach(([handler, extensions]) => {
|
|
74
|
+
extensions.forEach(extension => {
|
|
75
|
+
const args = injections?.get(extension.handler) || [];
|
|
76
|
+
|
|
77
|
+
steps.push({
|
|
78
|
+
...extension,
|
|
79
|
+
// component: constructor,
|
|
80
|
+
args,
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
return steps;
|
|
88
|
+
}
|
|
48
89
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A_Feature } from "../A-Feature/A-Feature.class"
|
|
1
|
+
import { A_TYPES__A_InjectDecorator_Meta } from "@adaas/a-concept/decorators/A-Inject/A-Inject.decorator.types"
|
|
3
2
|
import { A_Fragment } from "../A-Fragment/A-Fragment.class"
|
|
4
3
|
import { A_Meta } from "../A-Meta/A-Meta.class"
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { A_TYPES__A_ExtendDecorator_BehaviorConfig, A_TYPES__A_ExtendDecorator_Meta } from "@adaas/a-concept/decorators/A-Feature/A-Feature.decorator.types"
|
|
5
|
+
import { A_TYPES__ConceptAbstraction, A_TYPES__ConceptAbstractionMeta } from "../A-Concept/A_Concept.types"
|
|
7
6
|
|
|
7
|
+
export type A_TYPES__ComponentConstructor<_Exports extends Array<String>> = {
|
|
8
|
+
exports: _Exports,
|
|
9
|
+
}
|
|
8
10
|
|
|
9
11
|
export type A_TYPES__ComponentCallParams<T extends string> = {
|
|
10
12
|
name: T,
|
|
@@ -23,7 +25,7 @@ export type A_TYPES__ComponentMeta = {
|
|
|
23
25
|
*
|
|
24
26
|
* Where value is the extension instructions
|
|
25
27
|
*/
|
|
26
|
-
[Key: string]:
|
|
28
|
+
[Key: string]: A_TYPES__A_ExtendDecorator_Meta[]
|
|
27
29
|
}>,
|
|
28
30
|
|
|
29
31
|
|
|
@@ -36,7 +38,16 @@ export type A_TYPES__ComponentMeta = {
|
|
|
36
38
|
*
|
|
37
39
|
* Where value is the list of injections
|
|
38
40
|
*/
|
|
39
|
-
[Key: string]:
|
|
41
|
+
[Key: string]: A_TYPES__A_InjectDecorator_Meta
|
|
42
|
+
}>
|
|
43
|
+
|
|
44
|
+
[A_TYPES__ComponentMetaKey.ABSTRACTIONS]: A_Meta<{
|
|
45
|
+
/**
|
|
46
|
+
* Where Key is the name of the stage
|
|
47
|
+
*
|
|
48
|
+
* Where value is the list of injections
|
|
49
|
+
*/
|
|
50
|
+
[Key: string]: A_TYPES__ConceptAbstraction[]
|
|
40
51
|
}>
|
|
41
52
|
}
|
|
42
53
|
|
|
@@ -44,7 +55,7 @@ export enum A_TYPES__ComponentMetaKey {
|
|
|
44
55
|
EXTENSIONS = 'a-component-extensions',
|
|
45
56
|
FEATURES = 'a-component-features',
|
|
46
57
|
INJECTIONS = 'a-component-injections',
|
|
47
|
-
|
|
58
|
+
ABSTRACTIONS = 'a-component-abstractions',
|
|
48
59
|
}
|
|
49
60
|
|
|
50
61
|
export type A_TYPES__ComponentMetaExtension = {
|
|
@@ -59,39 +70,8 @@ export type A_TYPES__ComponentMetaExtension = {
|
|
|
59
70
|
/**
|
|
60
71
|
* The arguments that will be passed to the handler
|
|
61
72
|
*/
|
|
62
|
-
args:
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
export type A_TYPES__ComponentMeta_ExtensionItem = {
|
|
67
|
-
name: string,
|
|
68
|
-
handler: string,
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export type A_TYPES__ComponentMeta_InjectionParams = Array<{
|
|
72
|
-
target: A_TYPES__ComponentMeta_InjectionParam
|
|
73
|
-
} | {
|
|
74
|
-
target: { new(...args: any[]): A_Entity },
|
|
75
|
-
instructions: Partial<A_TYPES__ComponentMeta_EntityInjectionInstructions>
|
|
76
|
-
}>;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
export type A_TYPES__ComponentMeta_EntityInjectionInstructions = {
|
|
80
|
-
aseid: string,
|
|
81
|
-
id: string,
|
|
82
|
-
}
|
|
73
|
+
args: A_TYPES__A_InjectDecorator_Meta
|
|
83
74
|
|
|
75
|
+
} & A_TYPES__A_ExtendDecorator_BehaviorConfig
|
|
84
76
|
|
|
85
|
-
export type A_TYPES__ComponentMeta_InjectionParam =
|
|
86
|
-
{ new(...args: any[]): A_Fragment }
|
|
87
|
-
| { new(...args: any[]): A_Component }
|
|
88
|
-
// | { new(...args: any[]): any }
|
|
89
|
-
| { new(...args: any[]): A_Scope }
|
|
90
|
-
| { new(...args: any[]): A_Feature };
|
|
91
|
-
// |
|
|
92
|
-
// typeof A_Fragment
|
|
93
|
-
// | typeof A_Component
|
|
94
|
-
// // | { new(...args: any[]): any }
|
|
95
|
-
// | typeof A_Scope
|
|
96
|
-
// | typeof A_Feature;
|
|
97
77
|
|
|
@@ -4,7 +4,9 @@ import { A_Container } from "../A-Container/A-Container.class";
|
|
|
4
4
|
// import { A_Logger } from "@adaas/a-concept/base/A-Logger/A-Logger.component";
|
|
5
5
|
import { A_Fragment } from "../A-Fragment/A-Fragment.class";
|
|
6
6
|
import { A_TYPES__ContainerMetaKey } from "../A-Container/A-Container.types";
|
|
7
|
-
import {
|
|
7
|
+
import { A_Abstraction } from "@adaas/a-concept/decorators/A-Abstraction/A-Abstraction.decorator";
|
|
8
|
+
import { A_TYPES__A_StageStep } from "../A-Stage/A-Stage.types";
|
|
9
|
+
import { A_Channel } from "../A-Channel/A-Channel.class";
|
|
8
10
|
|
|
9
11
|
|
|
10
12
|
|
|
@@ -35,8 +37,8 @@ export class A_Concept<
|
|
|
35
37
|
/**
|
|
36
38
|
* Load the concept. This step runs before any other steps to ensure that all components are loaded.
|
|
37
39
|
*/
|
|
38
|
-
static
|
|
39
|
-
return
|
|
40
|
+
static Load() {
|
|
41
|
+
return A_Abstraction(A_TYPES__ConceptStage.Load);
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
/**
|
|
@@ -44,15 +46,15 @@ export class A_Concept<
|
|
|
44
46
|
*
|
|
45
47
|
* [!] To extend the logic just create a custom containers and override the default behavior.
|
|
46
48
|
*/
|
|
47
|
-
static
|
|
48
|
-
return
|
|
49
|
+
static Publish() {
|
|
50
|
+
return A_Abstraction(A_TYPES__ConceptStage.Publish);
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
/**
|
|
52
54
|
* Deploy the concept to the environment.
|
|
53
55
|
*/
|
|
54
|
-
static
|
|
55
|
-
return
|
|
56
|
+
static Deploy() {
|
|
57
|
+
return A_Abstraction(A_TYPES__ConceptStage.Deploy);
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
/**
|
|
@@ -61,29 +63,29 @@ export class A_Concept<
|
|
|
61
63
|
* Can be used for static websites or any other concept that requires a build step.
|
|
62
64
|
*
|
|
63
65
|
*/
|
|
64
|
-
static
|
|
65
|
-
return
|
|
66
|
+
static Build() {
|
|
67
|
+
return A_Abstraction(A_TYPES__ConceptStage.Build);
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
/**
|
|
69
71
|
* Main execution of the concept.
|
|
70
72
|
*/
|
|
71
|
-
static
|
|
72
|
-
return
|
|
73
|
+
static Run() {
|
|
74
|
+
return A_Abstraction(A_TYPES__ConceptStage.Run);
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
/**
|
|
76
78
|
* Start the concept. Uses for servers or any other background services.
|
|
77
79
|
*/
|
|
78
|
-
static
|
|
79
|
-
return
|
|
80
|
+
static Start() {
|
|
81
|
+
return A_Abstraction(A_TYPES__ConceptStage.Start);
|
|
80
82
|
}
|
|
81
83
|
|
|
82
84
|
/**
|
|
83
85
|
* Stop the concept. Uses for servers or any other background services.
|
|
84
86
|
*/
|
|
85
|
-
static
|
|
86
|
-
return
|
|
87
|
+
static Stop() {
|
|
88
|
+
return A_Abstraction(A_TYPES__ConceptStage.Stop);
|
|
87
89
|
}
|
|
88
90
|
|
|
89
91
|
|
|
@@ -182,26 +184,46 @@ export class A_Concept<
|
|
|
182
184
|
params: Partial<A_TYPES__ConceptStageParams>
|
|
183
185
|
) {
|
|
184
186
|
|
|
185
|
-
const
|
|
187
|
+
const abstractions: {
|
|
188
|
+
container: A_Container<any>,
|
|
189
|
+
runners: Array<A_TYPES__A_StageStep>
|
|
190
|
+
}[] = [];
|
|
191
|
+
|
|
186
192
|
|
|
187
193
|
this.containers.map(container => {
|
|
188
194
|
const meta = A_Context.meta(container);
|
|
189
195
|
|
|
190
|
-
const
|
|
196
|
+
const containerAbstractions: Array<A_TYPES__A_StageStep> = meta
|
|
197
|
+
.abstractions(method)
|
|
198
|
+
.map(step => ({
|
|
199
|
+
component: container,
|
|
200
|
+
...step
|
|
201
|
+
}));
|
|
202
|
+
|
|
203
|
+
const containerScope = A_Context.scope(container);
|
|
204
|
+
|
|
205
|
+
const componentsAbstractions = containerScope.components
|
|
206
|
+
.map(component => A_Context.meta(component).abstractions(method).map(step => ({
|
|
207
|
+
component,
|
|
208
|
+
...step
|
|
209
|
+
})))
|
|
210
|
+
.flat();
|
|
211
|
+
|
|
212
|
+
abstractions.push({
|
|
213
|
+
container,
|
|
214
|
+
runners: [
|
|
215
|
+
...containerAbstractions.map(step => ({
|
|
216
|
+
...step,
|
|
217
|
+
component: container,
|
|
218
|
+
})),
|
|
219
|
+
|
|
220
|
+
...componentsAbstractions
|
|
221
|
+
]
|
|
222
|
+
});
|
|
223
|
+
});
|
|
191
224
|
|
|
192
225
|
|
|
193
|
-
if (containerStages) {
|
|
194
|
-
for (const [name, stage] of containerStages) {
|
|
195
|
-
if (stage.name === method) {
|
|
196
|
-
stages.push({
|
|
197
|
-
name,
|
|
198
|
-
container,
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
226
|
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
227
|
|
|
206
228
|
const scope = A_Context.allocate(this, {
|
|
207
229
|
components: params.components,
|
|
@@ -209,9 +231,6 @@ export class A_Concept<
|
|
|
209
231
|
parent: A_Context.scope(this)
|
|
210
232
|
});
|
|
211
233
|
|
|
212
|
-
for (const stage of stages) {
|
|
213
|
-
await stage.container[stage.name](params);
|
|
214
|
-
}
|
|
215
234
|
|
|
216
235
|
}
|
|
217
236
|
|
|
@@ -235,3 +254,5 @@ export class A_Concept<
|
|
|
235
254
|
|
|
236
255
|
}
|
|
237
256
|
|
|
257
|
+
|
|
258
|
+
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import { A_TYPES__A_InjectDecorator_Meta } from "@adaas/a-concept/decorators/A-Inject/A-Inject.decorator.types";
|
|
1
2
|
import { A_Container } from "../A-Container/A-Container.class";
|
|
2
3
|
import { A_Fragment } from "../A-Fragment/A-Fragment.class";
|
|
4
|
+
import { A_Entity } from "../A-Entity/A-Entity.class";
|
|
5
|
+
import { A_Component } from "../A-Component/A-Component.class";
|
|
6
|
+
import { A_TYPES__A_ExtendDecorator_BehaviorConfig } from "@adaas/a-concept/decorators/A-Feature/A-Feature.decorator.types";
|
|
3
7
|
|
|
4
8
|
|
|
5
9
|
export enum A_TYPES__ConceptStage {
|
|
@@ -58,6 +62,42 @@ export interface A_TYPES__IConceptConstructor<
|
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Uses as a transfer object to pass configurations to Feature constructor
|
|
67
|
+
*/
|
|
68
|
+
export type A_TYPES__ConceptAbstractionMeta = {
|
|
69
|
+
/**
|
|
70
|
+
* The name of original Extension Definition
|
|
71
|
+
*/
|
|
72
|
+
name: string,
|
|
73
|
+
/**
|
|
74
|
+
* The name of the handler that will be used to apply the extension
|
|
75
|
+
*/
|
|
76
|
+
handler: string,
|
|
77
|
+
/**
|
|
78
|
+
* The arguments that will be passed to the handler
|
|
79
|
+
*/
|
|
80
|
+
args: A_TYPES__A_InjectDecorator_Meta
|
|
81
|
+
} & A_TYPES__A_ExtendDecorator_BehaviorConfig
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Uses to define the extension that will be applied to the Concept
|
|
87
|
+
*/
|
|
88
|
+
export type A_TYPES__ConceptAbstraction = {
|
|
89
|
+
/**
|
|
90
|
+
* The name of original Extension Definition
|
|
91
|
+
*/
|
|
92
|
+
name: string,
|
|
93
|
+
/**
|
|
94
|
+
* The name of the handler that will be used to apply the extension
|
|
95
|
+
*/
|
|
96
|
+
handler: string,
|
|
97
|
+
} & A_TYPES__A_ExtendDecorator_BehaviorConfig
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
61
101
|
|
|
62
102
|
|
|
63
103
|
// =======================================================================
|
|
@@ -68,12 +108,17 @@ export interface A_TYPES__IConceptConstructor<
|
|
|
68
108
|
|
|
69
109
|
export type A_TYPES__ConceptStageParams = {
|
|
70
110
|
fragments: Array<A_Fragment>,
|
|
71
|
-
components: Array<{ new(...args: any[]):
|
|
111
|
+
components: Array<{ new(...args: any[]): A_Component }>,
|
|
112
|
+
entities: Array<{ new(...args: any[]): A_Entity }>
|
|
72
113
|
}
|
|
73
114
|
|
|
74
115
|
|
|
75
116
|
export type A_TYPES__ConceptCallParams<T extends string> = {
|
|
76
117
|
name: T,
|
|
77
118
|
fragments: Array<A_Fragment>,
|
|
78
|
-
components: Array<{ new(...args: any[]):
|
|
79
|
-
}
|
|
119
|
+
components: Array<{ new(...args: any[]): A_Component }>,
|
|
120
|
+
entities: Array<{ new(...args: any[]): A_Entity<any, any, any> }>
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|