@adaas/a-concept 0.0.29 → 0.0.31
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-Errors/A-Error.entity.d.ts +3 -0
- package/dist/src/base/A-Errors/A-Error.entity.js +8 -0
- package/dist/src/base/A-Errors/A-Error.entity.js.map +1 -0
- package/dist/src/base/A-Errors/A-Errors.context.js +1 -1
- package/dist/src/base/A-Errors/A-Errors.context.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-Define.decorator.js +7 -5
- package/dist/src/decorators/A-Feature/A-Feature-Define.decorator.js.map +1 -1
- package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.js +9 -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 +36 -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 +16 -0
- package/dist/src/global/A-Component/A-Component.meta.js +37 -3
- package/dist/src/global/A-Component/A-Component.meta.js.map +1 -1
- package/dist/src/global/A-Component/A-Component.types.d.ts +26 -38
- 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 +32 -8
- 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 +29 -36
- 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 +12 -6
- 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 +181 -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 +78 -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-Errors/A-Error.entity.ts +10 -0
- package/src/base/A-Errors/A-Errors.context.ts +2 -2
- 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-Define.decorator.ts +16 -9
- package/src/decorators/A-Feature/A-Feature-Extend.decorator.ts +10 -2
- package/src/decorators/A-Feature/A-Feature.decorator.types.ts +46 -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 +59 -6
- package/src/global/A-Component/A-Component.types.ts +28 -45
- 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 +36 -8
- package/src/global/A-Context/A-Context.class.ts +37 -50
- package/src/global/A-Entity/A-Entity.class.ts +8 -6
- package/src/global/A-Entity/A-Entity.types.ts +13 -6
- 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 +234 -0
- package/src/global/A-Stage/A-Stage.types.ts +101 -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,10 +1,13 @@
|
|
|
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_DefineDecorator_Meta, 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"
|
|
6
|
+
import { A_TYPES__ContainerMeta_FeatureItem } from "../A-Container/A-Container.types"
|
|
7
7
|
|
|
8
|
+
export type A_TYPES__ComponentConstructor<_Exports extends Array<String> = any> = {
|
|
9
|
+
exports: _Exports,
|
|
10
|
+
}
|
|
8
11
|
|
|
9
12
|
export type A_TYPES__ComponentCallParams<T extends string> = {
|
|
10
13
|
name: T,
|
|
@@ -23,11 +26,18 @@ export type A_TYPES__ComponentMeta = {
|
|
|
23
26
|
*
|
|
24
27
|
* Where value is the extension instructions
|
|
25
28
|
*/
|
|
26
|
-
[Key: string]:
|
|
29
|
+
[Key: string]: A_TYPES__A_ExtendDecorator_Meta[]
|
|
27
30
|
}>,
|
|
28
31
|
|
|
29
32
|
|
|
30
|
-
[A_TYPES__ComponentMetaKey.FEATURES]:
|
|
33
|
+
[A_TYPES__ComponentMetaKey.FEATURES]: A_Meta<{
|
|
34
|
+
/**
|
|
35
|
+
* Where Key is the name of the feature
|
|
36
|
+
*
|
|
37
|
+
* Where value is the list of features
|
|
38
|
+
*/
|
|
39
|
+
[Key: string]: A_TYPES__A_DefineDecorator_Meta
|
|
40
|
+
}>
|
|
31
41
|
|
|
32
42
|
|
|
33
43
|
[A_TYPES__ComponentMetaKey.INJECTIONS]: A_Meta<{
|
|
@@ -36,7 +46,16 @@ export type A_TYPES__ComponentMeta = {
|
|
|
36
46
|
*
|
|
37
47
|
* Where value is the list of injections
|
|
38
48
|
*/
|
|
39
|
-
[Key: string]:
|
|
49
|
+
[Key: string]: A_TYPES__A_InjectDecorator_Meta
|
|
50
|
+
}>
|
|
51
|
+
|
|
52
|
+
[A_TYPES__ComponentMetaKey.ABSTRACTIONS]: A_Meta<{
|
|
53
|
+
/**
|
|
54
|
+
* Where Key is the name of the stage
|
|
55
|
+
*
|
|
56
|
+
* Where value is the list of injections
|
|
57
|
+
*/
|
|
58
|
+
[Key: string]: A_TYPES__ConceptAbstraction[]
|
|
40
59
|
}>
|
|
41
60
|
}
|
|
42
61
|
|
|
@@ -44,7 +63,7 @@ export enum A_TYPES__ComponentMetaKey {
|
|
|
44
63
|
EXTENSIONS = 'a-component-extensions',
|
|
45
64
|
FEATURES = 'a-component-features',
|
|
46
65
|
INJECTIONS = 'a-component-injections',
|
|
47
|
-
|
|
66
|
+
ABSTRACTIONS = 'a-component-abstractions',
|
|
48
67
|
}
|
|
49
68
|
|
|
50
69
|
export type A_TYPES__ComponentMetaExtension = {
|
|
@@ -56,42 +75,6 @@ export type A_TYPES__ComponentMetaExtension = {
|
|
|
56
75
|
* The name of the handler that will be used to apply the extension
|
|
57
76
|
*/
|
|
58
77
|
handler: string,
|
|
59
|
-
|
|
60
|
-
* The arguments that will be passed to the handler
|
|
61
|
-
*/
|
|
62
|
-
args: A_TYPES__ComponentMeta_InjectionParams
|
|
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
|
-
}
|
|
83
|
-
|
|
78
|
+
} & A_TYPES__A_ExtendDecorator_BehaviorConfig
|
|
84
79
|
|
|
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
80
|
|
|
@@ -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
|
+
|
|
@@ -18,7 +18,7 @@ import { A_TYPES__FeatureConstructor } from "../A-Feature/A-Feature.types";
|
|
|
18
18
|
* - etc.
|
|
19
19
|
*/
|
|
20
20
|
export class A_Container<
|
|
21
|
-
_FeatureNames extends Array<string>
|
|
21
|
+
_FeatureNames extends Array<string> = any
|
|
22
22
|
> {
|
|
23
23
|
// scope!: A_Scope
|
|
24
24
|
|
|
@@ -55,46 +55,10 @@ export class A_Container<
|
|
|
55
55
|
|
|
56
56
|
A_Context.allocate(this, config);
|
|
57
57
|
|
|
58
|
-
/**
|
|
59
|
-
* Run Async Initialization
|
|
60
|
-
*/
|
|
61
|
-
this.init();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
protected hasInherited(cl: { new(...args: any[]) }): boolean {
|
|
66
|
-
return this.constructor === cl
|
|
67
|
-
? false
|
|
68
|
-
: true
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Initializes the Namespace or can be used to reinitialize the Namespace
|
|
74
|
-
*/
|
|
75
|
-
private async init() {
|
|
76
|
-
if (!this.ready)
|
|
77
|
-
this.ready = new Promise(async (resolve, reject) => {
|
|
78
|
-
try {
|
|
79
|
-
await this.onBeforeInit();
|
|
80
|
-
|
|
81
|
-
await this.onInit();
|
|
82
|
-
|
|
83
|
-
await this.onAfterInit();
|
|
84
58
|
|
|
85
|
-
|
|
86
|
-
return resolve();
|
|
87
|
-
} catch (error) {
|
|
88
|
-
return reject(error);
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
else
|
|
92
|
-
await this.ready;
|
|
93
59
|
}
|
|
94
60
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
61
|
+
|
|
98
62
|
|
|
99
63
|
/**
|
|
100
64
|
* This method allows to call the lifecycle method of the container as well as any other Feature defined for it
|
|
@@ -138,7 +102,7 @@ export class A_Container<
|
|
|
138
102
|
? param2 || {}
|
|
139
103
|
: param1;
|
|
140
104
|
|
|
141
|
-
const newFeature = A_Context.feature(this
|
|
105
|
+
const newFeature = A_Context.feature(A_Context.scope(this), this, feature, params);
|
|
142
106
|
|
|
143
107
|
return await newFeature.process();
|
|
144
108
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A_Context } from "../A-Context/A-Context.class";
|
|
3
|
-
import { A_TYPES__FeatureStep } from "../A-Feature/A-Feature.types";
|
|
1
|
+
import { A_TYPES__ConceptAbstractionMeta, A_TYPES__ConceptStage } from "../A-Concept/A_Concept.types";
|
|
4
2
|
import { A_Meta } from "../A-Meta/A-Meta.class";
|
|
5
|
-
import { A_Container } from "./A-Container.class";
|
|
6
3
|
import {
|
|
7
4
|
A_TYPES__ContainerMeta,
|
|
8
5
|
A_TYPES__ContainerMetaKey
|
|
@@ -13,4 +10,44 @@ import {
|
|
|
13
10
|
export class A_ContainerMeta extends A_Meta<A_TYPES__ContainerMeta> {
|
|
14
11
|
|
|
15
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Returns a set of instructions to run proper methods in Container during A-Concept Stage
|
|
15
|
+
*
|
|
16
|
+
* @param stage
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
abstractions(
|
|
20
|
+
abstraction: A_TYPES__ConceptStage
|
|
21
|
+
): A_TYPES__ConceptAbstractionMeta[] {
|
|
22
|
+
const steps: A_TYPES__ConceptAbstractionMeta[] = [];
|
|
23
|
+
|
|
24
|
+
const abstractions = this.get(A_TYPES__ContainerMetaKey.ABSTRACTIONS);
|
|
25
|
+
const injections = this.get(A_TYPES__ContainerMetaKey.INJECTIONS);
|
|
26
|
+
|
|
27
|
+
// const constructor = A_Context.component(this);
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
abstractions
|
|
31
|
+
// returns all extensions that match the feature
|
|
32
|
+
?.find(`CONCEPT_ABSTRACTION::${abstraction}`)
|
|
33
|
+
.forEach(([handler, extensions]) => {
|
|
34
|
+
extensions.forEach(extension => {
|
|
35
|
+
const args = injections?.get(extension.handler) || [];
|
|
36
|
+
|
|
37
|
+
steps.push({
|
|
38
|
+
name: extension.name,
|
|
39
|
+
handler: extension.handler,
|
|
40
|
+
args,
|
|
41
|
+
before: extension.before,
|
|
42
|
+
behavior: extension.behavior,
|
|
43
|
+
after: extension.after
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
return steps;
|
|
51
|
+
}
|
|
52
|
+
|
|
16
53
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A_TYPES__A_InjectDecorator_Meta } from "@adaas/a-concept/decorators/A-Inject/A-Inject.decorator.types";
|
|
2
|
+
import { A_TYPES__ConceptAbstraction, A_TYPES__ConceptAbstractionMeta, A_TYPES__ConceptStage } from "../A-Concept/A_Concept.types";
|
|
2
3
|
import { A_Fragment } from "../A-Fragment/A-Fragment.class";
|
|
4
|
+
import { A_Meta } from "../A-Meta/A-Meta.class";
|
|
3
5
|
import { A_TYPES__ScopeConstructor } from "../A-Scope/A-Scope.types";
|
|
6
|
+
import { A_TYPES__A_DefineDecorator_Meta, A_TYPES__A_ExtendDecorator_BehaviorConfig } from "@adaas/a-concept/decorators/A-Feature/A-Feature.decorator.types";
|
|
4
7
|
|
|
5
8
|
|
|
6
9
|
|
|
@@ -17,20 +20,45 @@ export type A_TYPES__ContainerCallParams<T extends string> = {
|
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
export type A_TYPES__ContainerMeta = {
|
|
20
|
-
[A_TYPES__ContainerMetaKey.FEATURES]:
|
|
21
|
-
|
|
23
|
+
[A_TYPES__ContainerMetaKey.FEATURES]: A_Meta<{
|
|
24
|
+
/**
|
|
25
|
+
* Where Key is the name of the feature
|
|
26
|
+
*
|
|
27
|
+
* Where value is the list of features
|
|
28
|
+
*/
|
|
29
|
+
[Key: string]: A_TYPES__A_DefineDecorator_Meta
|
|
30
|
+
}>
|
|
31
|
+
[A_TYPES__ContainerMetaKey.ABSTRACTIONS]: A_Meta<{
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Where Key the regexp for what to apply the extension
|
|
35
|
+
* A set of container names or a wildcard, or a regexp
|
|
36
|
+
*
|
|
37
|
+
*
|
|
38
|
+
* Where value is the extension instructions
|
|
39
|
+
*/
|
|
40
|
+
[Key: string]: A_TYPES__ConceptAbstraction[]
|
|
41
|
+
}>,
|
|
42
|
+
[A_TYPES__ContainerMetaKey.INJECTIONS]: A_Meta<{
|
|
43
|
+
/**
|
|
44
|
+
* Where Key is the name of the injection
|
|
45
|
+
*
|
|
46
|
+
* Where value is the list of injections
|
|
47
|
+
*/
|
|
48
|
+
[Key: string]: A_TYPES__A_InjectDecorator_Meta
|
|
49
|
+
}>
|
|
50
|
+
|
|
22
51
|
}
|
|
23
52
|
|
|
24
53
|
|
|
25
54
|
export enum A_TYPES__ContainerMetaKey {
|
|
26
55
|
FEATURES = 'a-container-features',
|
|
27
|
-
|
|
56
|
+
INJECTIONS = 'a-container-injections',
|
|
57
|
+
ABSTRACTIONS = 'a-container-abstractions',
|
|
28
58
|
}
|
|
29
59
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
handler: string,
|
|
33
|
-
}
|
|
60
|
+
|
|
61
|
+
|
|
34
62
|
|
|
35
63
|
|
|
36
64
|
export type A_TYPES__ContainerMeta_FeatureItem = {
|
|
@@ -9,10 +9,14 @@ import { A_Meta } from "../A-Meta/A-Meta.class";
|
|
|
9
9
|
import { A_ComponentMeta } from "../A-Component/A-Component.meta";
|
|
10
10
|
import { A_ContainerMeta } from "../A-Container/A-Container.meta";
|
|
11
11
|
import { A_Concept } from "../A-Concept/A_Concept.class";
|
|
12
|
-
import { A_TYPES__EntityBaseMethod } from "../A-Entity/A-Entity.types";
|
|
12
|
+
import { A_TYPES__EntityBaseMethod, A_TYPES__EntityMetaKey } from "../A-Entity/A-Entity.types";
|
|
13
13
|
import { A_Entity } from "../A-Entity/A-Entity.class";
|
|
14
14
|
import { A_EntityMeta } from "../A-Entity/A-Entity.meta";
|
|
15
|
-
import { A_TYPES__FeatureConstructor
|
|
15
|
+
import { A_TYPES__FeatureConstructor } from "../A-Feature/A-Feature.types";
|
|
16
|
+
import { A_TYPES__A_StageStep } from "../A-Stage/A-Stage.types";
|
|
17
|
+
import { A_TYPES__A_FeatureDecoratorConfig } from "@adaas/a-concept/decorators/A-Feature/A-Feature.decorator.types";
|
|
18
|
+
import { A_TYPES__ContainerMetaKey } from "../A-Container/A-Container.types";
|
|
19
|
+
import { A_TYPES__ComponentMetaKey } from "../A-Component/A-Component.types";
|
|
16
20
|
|
|
17
21
|
|
|
18
22
|
/**
|
|
@@ -61,8 +65,6 @@ export class A_Context {
|
|
|
61
65
|
/**
|
|
62
66
|
* A set of allocated scopes per every element in the program.
|
|
63
67
|
*/
|
|
64
|
-
// protected scopes: WeakMap<A_Container<any> | A_Feature | A_Component | any, A_Scope> = new WeakMap();
|
|
65
|
-
|
|
66
68
|
protected conceptsMeta: Map<typeof A_Concept.constructor, A_Meta<any>> = new Map();
|
|
67
69
|
protected containersMeta: Map<typeof A_Container.constructor, A_ContainerMeta> = new Map();
|
|
68
70
|
protected componentsMeta: Map<typeof A_Component, A_ComponentMeta> = new Map();
|
|
@@ -369,8 +371,6 @@ export class A_Context {
|
|
|
369
371
|
param2: string | T[number],
|
|
370
372
|
param3?: Partial<A_TYPES__ScopeConstructor>
|
|
371
373
|
): A_TYPES__Required<Partial<A_TYPES__FeatureConstructor>, ['steps', 'fragments', 'name', 'components']> {
|
|
372
|
-
|
|
373
|
-
|
|
374
374
|
const instance = this.getInstance();
|
|
375
375
|
|
|
376
376
|
const component = param1;
|
|
@@ -407,7 +407,31 @@ export class A_Context {
|
|
|
407
407
|
* While Scope we use just to store the scope where the component registered.
|
|
408
408
|
*
|
|
409
409
|
*/
|
|
410
|
-
|
|
410
|
+
let metaKey;
|
|
411
|
+
|
|
412
|
+
switch (true) {
|
|
413
|
+
case component instanceof A_Entity:
|
|
414
|
+
metaKey = A_TYPES__EntityMetaKey.FEATURES;
|
|
415
|
+
break;
|
|
416
|
+
case component instanceof A_Container:
|
|
417
|
+
metaKey = A_TYPES__ContainerMetaKey.FEATURES
|
|
418
|
+
break;
|
|
419
|
+
case component instanceof A_Component:
|
|
420
|
+
metaKey = A_TYPES__ComponentMetaKey.FEATURES
|
|
421
|
+
break;
|
|
422
|
+
default:
|
|
423
|
+
throw new Error(`A-Feature cannot be defined on the ${component} level`);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
const featureDefinition: A_TYPES__A_FeatureDecoratorConfig = this.meta(component).get(metaKey);
|
|
427
|
+
|
|
428
|
+
if (!featureDefinition)
|
|
429
|
+
throw new Error(`[!] A-Concept Context: Feature not found.`);
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
const steps: A_TYPES__A_StageStep[] = [
|
|
433
|
+
...featureDefinition.template
|
|
434
|
+
];
|
|
411
435
|
// const feature: string = new ASEID({
|
|
412
436
|
// id: `${param2}-${Math.random()}`,
|
|
413
437
|
// entity: 'a-feature',
|
|
@@ -427,12 +451,10 @@ export class A_Context {
|
|
|
427
451
|
// Get all extensions for the feature
|
|
428
452
|
meta
|
|
429
453
|
.extensions(feature)
|
|
430
|
-
.forEach((
|
|
454
|
+
.forEach((declaration) => {
|
|
431
455
|
steps.push({
|
|
432
456
|
component: constructor,
|
|
433
|
-
|
|
434
|
-
handler,
|
|
435
|
-
args
|
|
457
|
+
...declaration
|
|
436
458
|
});
|
|
437
459
|
});
|
|
438
460
|
});
|
|
@@ -513,7 +535,6 @@ export class A_Context {
|
|
|
513
535
|
scope: A_Scope,
|
|
514
536
|
param1: A_Fragment | A_Container<any> | A_Entity | A_Component
|
|
515
537
|
) {
|
|
516
|
-
|
|
517
538
|
const instance = this.getInstance();
|
|
518
539
|
|
|
519
540
|
if (!instance._root)
|
|
@@ -532,49 +553,15 @@ export class A_Context {
|
|
|
532
553
|
instance.registry.set(param1, scope);
|
|
533
554
|
break;
|
|
534
555
|
|
|
535
|
-
case param1 instanceof A_Fragment:
|
|
556
|
+
case param1 instanceof A_Fragment && !instance.registry.has(param1):
|
|
536
557
|
instance.registry.set(param1, scope);
|
|
537
558
|
break;
|
|
538
559
|
|
|
539
560
|
default:
|
|
540
|
-
instance.registry.
|
|
561
|
+
if (!instance.registry.has(param1))
|
|
562
|
+
instance.registry.set(param1, scope);
|
|
541
563
|
|
|
564
|
+
break;
|
|
542
565
|
}
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
// if (param1 instanceof A_Fragment) {
|
|
546
|
-
|
|
547
|
-
// const instance = this.getInstance();
|
|
548
|
-
|
|
549
|
-
// let fragment: A_Fragment;
|
|
550
|
-
// let name: string;
|
|
551
|
-
|
|
552
|
-
// if (typeof param2 === 'string') {
|
|
553
|
-
// name = param2;
|
|
554
|
-
// fragment = param1;
|
|
555
|
-
// } else {
|
|
556
|
-
// fragment = param1 as A_Fragment;
|
|
557
|
-
// name = fragment.name;
|
|
558
|
-
// }
|
|
559
|
-
|
|
560
|
-
// /**
|
|
561
|
-
// * If the namespace is not provided, then use the root namespace.
|
|
562
|
-
// * If the root namespace is not provided, then use the default namespace.
|
|
563
|
-
// */
|
|
564
|
-
// if (!name)
|
|
565
|
-
// name = this.root
|
|
566
|
-
// || process.env.ADAAS_NAMESPACE
|
|
567
|
-
// || process.env.A_NAMESPACE
|
|
568
|
-
// || process.env.ADAAS_APP_NAMESPACE
|
|
569
|
-
// || 'a-concept'
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
// if (!this.root)
|
|
573
|
-
// instance._root = name;
|
|
574
|
-
|
|
575
|
-
// // instance.namedFragments.set(namespace, Namespace);
|
|
576
|
-
|
|
577
|
-
// return name;
|
|
578
|
-
|
|
579
566
|
}
|
|
580
567
|
}
|