@adaas/a-concept 0.0.2
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/.nvmrc +1 -0
- package/LICENSE +22 -0
- package/README.md +19 -0
- package/dist/examples/sdk/concept.d.ts +0 -0
- package/dist/examples/sdk/concept.js +21 -0
- package/dist/examples/sdk/concept.js.map +1 -0
- package/dist/examples/sdk/orders.api.d.ts +0 -0
- package/dist/examples/sdk/orders.api.js +16 -0
- package/dist/examples/sdk/orders.api.js.map +1 -0
- package/dist/examples/sdk/users.api.d.ts +0 -0
- package/dist/examples/sdk/users.api.js +16 -0
- package/dist/examples/sdk/users.api.js.map +1 -0
- package/dist/examples/simple/concept.d.ts +0 -0
- package/dist/examples/simple/concept.js +13 -0
- package/dist/examples/simple/concept.js.map +1 -0
- package/dist/examples/simple-http-server/concept.d.ts +1 -0
- package/dist/examples/simple-http-server/concept.js +36 -0
- package/dist/examples/simple-http-server/concept.js.map +1 -0
- package/dist/examples/simple-http-server/containers/http-server.container.d.ts +12 -0
- package/dist/examples/simple-http-server/containers/http-server.container.js +69 -0
- package/dist/examples/simple-http-server/containers/http-server.container.js.map +1 -0
- package/dist/examples/simple-http-server/containers/http-server.controller.d.ts +7 -0
- package/dist/examples/simple-http-server/containers/http-server.controller.js +37 -0
- package/dist/examples/simple-http-server/containers/http-server.controller.js.map +1 -0
- package/dist/examples/simple-http-server/containers/http-server.router.d.ts +6 -0
- package/dist/examples/simple-http-server/containers/http-server.router.js +39 -0
- package/dist/examples/simple-http-server/containers/http-server.router.js.map +1 -0
- package/dist/examples/simple-http-server/contexts/http-server.context.types.d.ts +4 -0
- package/dist/examples/simple-http-server/contexts/http-server.context.types.js +100 -0
- package/dist/examples/simple-http-server/contexts/http-server.context.types.js.map +1 -0
- package/dist/examples/simple-http-server/contexts/http-server.namespace.d.ts +10 -0
- package/dist/examples/simple-http-server/contexts/http-server.namespace.js +26 -0
- package/dist/examples/simple-http-server/contexts/http-server.namespace.js.map +1 -0
- package/dist/examples/simple-http-server/controllers/orders.controller.d.ts +5 -0
- package/dist/examples/simple-http-server/controllers/orders.controller.js +32 -0
- package/dist/examples/simple-http-server/controllers/orders.controller.js.map +1 -0
- package/dist/examples/simple-http-server/controllers/users.controller.d.ts +0 -0
- package/dist/examples/simple-http-server/controllers/users.controller.js +87 -0
- package/dist/examples/simple-http-server/controllers/users.controller.js.map +1 -0
- package/dist/examples/simple-http-server/modules/simple-http-server.context.d.ts +5 -0
- package/dist/examples/simple-http-server/modules/simple-http-server.context.js +25 -0
- package/dist/examples/simple-http-server/modules/simple-http-server.context.js.map +1 -0
- package/dist/examples/simple-http-server/modules/simple-http-server.module.d.ts +16 -0
- package/dist/examples/simple-http-server/modules/simple-http-server.module.js +8 -0
- package/dist/examples/simple-http-server/modules/simple-http-server.module.js.map +1 -0
- package/dist/examples/simple-http-server/modules/simple-http-server.types.d.ts +2 -0
- package/dist/examples/simple-http-server/modules/simple-http-server.types.js +3 -0
- package/dist/examples/simple-http-server/modules/simple-http-server.types.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/src/constants/A_ConceptLifecycle.constants.d.ts +2 -0
- package/dist/src/constants/A_ConceptLifecycle.constants.js +12 -0
- package/dist/src/constants/A_ConceptLifecycle.constants.js.map +1 -0
- package/dist/src/containers/A-Config/A-Config.container.d.ts +7 -0
- package/dist/src/containers/A-Config/A-Config.container.js +65 -0
- package/dist/src/containers/A-Config/A-Config.container.js.map +1 -0
- package/dist/src/containers/A-Config/A-Config.namespace.d.ts +28 -0
- package/dist/src/containers/A-Config/A-Config.namespace.js +54 -0
- package/dist/src/containers/A-Config/A-Config.namespace.js.map +1 -0
- package/dist/src/containers/A-Config/A-Config.types.d.ts +12 -0
- package/dist/src/containers/A-Config/A-Config.types.js +3 -0
- package/dist/src/containers/A-Config/A-Config.types.js.map +1 -0
- package/dist/src/containers/A-Config/components/ConfigReader.component.d.ts +18 -0
- package/dist/src/containers/A-Config/components/ConfigReader.component.js +37 -0
- package/dist/src/containers/A-Config/components/ConfigReader.component.js.map +1 -0
- package/dist/src/containers/A-Config/components/ENVConfigReader.component.d.ts +10 -0
- package/dist/src/containers/A-Config/components/ENVConfigReader.component.js +37 -0
- package/dist/src/containers/A-Config/components/ENVConfigReader.component.js.map +1 -0
- package/dist/src/containers/A-Config/components/FileConfigReader.component.d.ts +11 -0
- package/dist/src/containers/A-Config/components/FileConfigReader.component.js +47 -0
- package/dist/src/containers/A-Config/components/FileConfigReader.component.js.map +1 -0
- package/dist/src/containers/A-Errors/A-Errors.container.d.ts +5 -0
- package/dist/src/containers/A-Errors/A-Errors.container.js +32 -0
- package/dist/src/containers/A-Errors/A-Errors.container.js.map +1 -0
- package/dist/src/containers/A-Errors/A-Errors.namespace.d.ts +40 -0
- package/dist/src/containers/A-Errors/A-Errors.namespace.js +76 -0
- package/dist/src/containers/A-Errors/A-Errors.namespace.js.map +1 -0
- package/dist/src/containers/A-Errors/A-Errors.types.d.ts +5 -0
- package/dist/src/containers/A-Errors/A-Errors.types.js +3 -0
- package/dist/src/containers/A-Errors/A-Errors.types.js.map +1 -0
- package/dist/src/containers/A-Logger/A-Logger.container.d.ts +6 -0
- package/dist/src/containers/A-Logger/A-Logger.container.js +41 -0
- package/dist/src/containers/A-Logger/A-Logger.container.js.map +1 -0
- package/dist/src/containers/A-Logger/A-Logger.namespace.d.ts +17 -0
- package/dist/src/containers/A-Logger/A-Logger.namespace.js +22 -0
- package/dist/src/containers/A-Logger/A-Logger.namespace.js.map +1 -0
- package/dist/src/containers/A-Logger/A-Logger.types.d.ts +0 -0
- package/dist/src/containers/A-Logger/A-Logger.types.js +2 -0
- package/dist/src/containers/A-Logger/A-Logger.types.js.map +1 -0
- package/dist/src/containers/A-Logger/components/Logger.component.d.ts +29 -0
- package/dist/src/containers/A-Logger/components/Logger.component.js +128 -0
- package/dist/src/containers/A-Logger/components/Logger.component.js.map +1 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-ConceptLifecycle.decorator.types.d.ts +34 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-ConceptLifecycle.decorator.types.js +3 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-ConceptLifecycle.decorator.types.js.map +1 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.d.ts +11 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.js +36 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.js.map +1 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.types.d.ts +7 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.types.js +3 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.types.js.map +1 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.d.ts +17 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.js +42 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.js.map +1 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.types.d.ts +8 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.types.js +3 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.types.js.map +1 -0
- package/dist/src/decorators/A-ConceptLifecycle/index.d.ts +7 -0
- package/dist/src/decorators/A-ConceptLifecycle/index.js +11 -0
- package/dist/src/decorators/A-ConceptLifecycle/index.js.map +1 -0
- package/dist/src/decorators/A-Feature/A-Feature.decorator.d.ts +0 -0
- package/dist/src/decorators/A-Feature/A-Feature.decorator.js +11 -0
- package/dist/src/decorators/A-Feature/A-Feature.decorator.js.map +1 -0
- package/dist/src/decorators/A-Feature/A-Feature.decorator.types.d.ts +0 -0
- package/dist/src/decorators/A-Feature/A-Feature.decorator.types.js +2 -0
- package/dist/src/decorators/A-Feature/A-Feature.decorator.types.js.map +1 -0
- package/dist/src/decorators/A-Inject/A-Inject.decorator.d.ts +22 -0
- package/dist/src/decorators/A-Inject/A-Inject.decorator.js +32 -0
- package/dist/src/decorators/A-Inject/A-Inject.decorator.js.map +1 -0
- package/dist/src/decorators/A-Inject/A-Inject.decorator.types.d.ts +4 -0
- package/dist/src/decorators/A-Inject/A-Inject.decorator.types.js +3 -0
- package/dist/src/decorators/A-Inject/A-Inject.decorator.types.js.map +1 -0
- package/dist/src/decorators/A_ConceptMethods.decorator.d.ts +0 -0
- package/dist/src/decorators/A_ConceptMethods.decorator.js +2 -0
- package/dist/src/decorators/A_ConceptMethods.decorator.js.map +1 -0
- package/dist/src/decorators/A_Lazy.decorator.d.ts +5 -0
- package/dist/src/decorators/A_Lazy.decorator.js +20 -0
- package/dist/src/decorators/A_Lazy.decorator.js.map +1 -0
- package/dist/src/global/A-Component/A-Component.class.d.ts +16 -0
- package/dist/src/global/A-Component/A-Component.class.js +18 -0
- package/dist/src/global/A-Component/A-Component.class.js.map +1 -0
- package/dist/src/global/A-Concept/A_Concept.class.d.ts +46 -0
- package/dist/src/global/A-Concept/A_Concept.class.js +106 -0
- package/dist/src/global/A-Concept/A_Concept.class.js.map +1 -0
- package/dist/src/global/A-Concept/A_Concept.types.d.ts +26 -0
- package/dist/src/global/A-Concept/A_Concept.types.js +3 -0
- package/dist/src/global/A-Concept/A_Concept.types.js.map +1 -0
- package/dist/src/global/A-Container/A-Container.class.d.ts +14 -0
- package/dist/src/global/A-Container/A-Container.class.js +21 -0
- package/dist/src/global/A-Container/A-Container.class.js.map +1 -0
- package/dist/src/global/A-Context/A-Context.class.d.ts +88 -0
- package/dist/src/global/A-Context/A-Context.class.js +118 -0
- package/dist/src/global/A-Context/A-Context.class.js.map +1 -0
- package/dist/src/global/A-Context/A-Context.types.d.ts +0 -0
- package/dist/src/global/A-Context/A-Context.types.js +2 -0
- package/dist/src/global/A-Context/A-Context.types.js.map +1 -0
- package/dist/src/global/A-Dependency/A-DependencyReference.class.d.ts +17 -0
- package/dist/src/global/A-Dependency/A-DependencyReference.class.js +67 -0
- package/dist/src/global/A-Dependency/A-DependencyReference.class.js.map +1 -0
- package/dist/src/global/A-Dependency/A-DependencyReference.types.d.ts +55 -0
- package/dist/src/global/A-Dependency/A-DependencyReference.types.js +3 -0
- package/dist/src/global/A-Dependency/A-DependencyReference.types.js.map +1 -0
- package/dist/src/global/A-Namespace/A_Namespace.class.d.ts +47 -0
- package/dist/src/global/A-Namespace/A_Namespace.class.js +112 -0
- package/dist/src/global/A-Namespace/A_Namespace.class.js.map +1 -0
- package/dist/src/global/A-Namespace/A_Namespace.types.d.ts +19 -0
- package/dist/src/global/A-Namespace/A_Namespace.types.js +3 -0
- package/dist/src/global/A-Namespace/A_Namespace.types.js.map +1 -0
- package/dist/src/managers/A_DependencyManager.class.d.ts +24 -0
- package/dist/src/managers/A_DependencyManager.class.js +129 -0
- package/dist/src/managers/A_DependencyManager.class.js.map +1 -0
- package/dist/src/storage/A_Concept.storage.d.ts +19 -0
- package/dist/src/storage/A_Concept.storage.js +29 -0
- package/dist/src/storage/A_Concept.storage.js.map +1 -0
- package/dist/src/types/A_DependencyManager.types.d.ts +15 -0
- package/dist/src/types/A_DependencyManager.types.js +3 -0
- package/dist/src/types/A_DependencyManager.types.js.map +1 -0
- package/dist/src/types/A_Module.types.d.ts +17 -0
- package/dist/src/types/A_Module.types.js +22 -0
- package/dist/src/types/A_Module.types.js.map +1 -0
- package/docs/logo.png +0 -0
- package/examples/sdk/concept.ts +24 -0
- package/examples/sdk/orders.api.ts +21 -0
- package/examples/sdk/users.api.ts +21 -0
- package/examples/simple/concept.ts +16 -0
- package/examples/simple-http-server/concept.ts +30 -0
- package/examples/simple-http-server/containers/http-server.container.ts +69 -0
- package/examples/simple-http-server/containers/http-server.controller.ts +24 -0
- package/examples/simple-http-server/containers/http-server.router.ts +23 -0
- package/examples/simple-http-server/contexts/http-server.context.types.ts +108 -0
- package/examples/simple-http-server/contexts/http-server.namespace.ts +36 -0
- package/examples/simple-http-server/controllers/orders.controller.ts +20 -0
- package/examples/simple-http-server/controllers/users.controller.ts +104 -0
- package/index.ts +14 -0
- package/jest.config.ts +22 -0
- package/package.json +73 -0
- package/src/constants/A_ConceptLifecycle.constants.ts +12 -0
- package/src/containers/A-Config/A-Config.container.ts +60 -0
- package/src/containers/A-Config/A-Config.namespace.ts +98 -0
- package/src/containers/A-Config/A-Config.types.ts +31 -0
- package/src/containers/A-Config/components/ConfigReader.component.ts +30 -0
- package/src/containers/A-Config/components/ENVConfigReader.component.ts +31 -0
- package/src/containers/A-Config/components/FileConfigReader.component.ts +42 -0
- package/src/containers/A-Errors/A-Errors.container.ts +14 -0
- package/src/containers/A-Errors/A-Errors.namespace.ts +104 -0
- package/src/containers/A-Errors/A-Errors.types.ts +6 -0
- package/src/containers/A-Logger/A-Logger.container.ts +22 -0
- package/src/containers/A-Logger/A-Logger.namespace.ts +26 -0
- package/src/containers/A-Logger/A-Logger.types.ts +0 -0
- package/src/containers/A-Logger/components/Logger.component.ts +169 -0
- package/src/decorators/A-ConceptLifecycle/A-ConceptLifecycle.decorator.types.ts +46 -0
- package/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.ts +55 -0
- package/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.types.ts +20 -0
- package/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.ts +62 -0
- package/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.types.ts +28 -0
- package/src/decorators/A-ConceptLifecycle/index.ts +9 -0
- package/src/decorators/A-Feature/A-Feature.decorator.ts +13 -0
- package/src/decorators/A-Feature/A-Feature.decorator.types.ts +0 -0
- package/src/decorators/A-Inject/A-Inject.decorator.ts +75 -0
- package/src/decorators/A-Inject/A-Inject.decorator.types.ts +10 -0
- package/src/decorators/A_ConceptMethods.decorator.ts +0 -0
- package/src/decorators/A_Lazy.decorator.ts +31 -0
- package/src/global/A-Component/A-Component.class.ts +33 -0
- package/src/global/A-Concept/A_Concept.class.ts +143 -0
- package/src/global/A-Concept/A_Concept.types.ts +44 -0
- package/src/global/A-Container/A-Container.class.ts +39 -0
- package/src/global/A-Context/A-Context.class.ts +230 -0
- package/src/global/A-Context/A-Context.types.ts +0 -0
- package/src/global/A-Dependency/A-DependencyReference.class.ts +61 -0
- package/src/global/A-Dependency/A-DependencyReference.types.ts +61 -0
- package/src/global/A-Namespace/A_Namespace.class.ts +128 -0
- package/src/global/A-Namespace/A_Namespace.types.ts +24 -0
- package/src/storage/A_Concept.storage.ts +45 -0
- package/src/types/A_Module.types.ts +23 -0
- package/tests/context.test.ts +124 -0
- package/tests/default.test.ts +159 -0
- package/tests/log.ts +54 -0
- package/tests/polyfill.test.ts +37 -0
- package/tsconfig.json +61 -0
- package/tslint.json +98 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { A_CONCEPT_LifecycleDeclarationsStorage } from "src/storage/A_Concept.storage";
|
|
2
|
+
import { A_TYPES__A_CONCEPT_RootRunParams, A_TYPES__IConceptConstructor } from "./A_Concept.types";
|
|
3
|
+
import { A_Context } from "../A-Context/A-Context.class";
|
|
4
|
+
import { A_Errors } from "src/containers/A-Errors/A-Errors.namespace";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A_Concept is a placeholder for the concept of the ani program.
|
|
10
|
+
*
|
|
11
|
+
* Concept - could be any Program regardless environment and it's goal.
|
|
12
|
+
* It could be mobile, web or simple html page.
|
|
13
|
+
* All depends on Containers and Components installed and provided in the Concept.
|
|
14
|
+
*
|
|
15
|
+
*
|
|
16
|
+
* [!] Concept operates ONLY with all Components and Containers provided to achieve the goal.
|
|
17
|
+
*
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
export class A_Concept {
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Context is a root namespace for the concept.
|
|
25
|
+
*/
|
|
26
|
+
Context!: typeof A_Context;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Context provider is a singleton that provides the context for ALL concepts.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
protected props!: A_TYPES__IConceptConstructor;
|
|
33
|
+
|
|
34
|
+
constructor(
|
|
35
|
+
props: A_TYPES__IConceptConstructor
|
|
36
|
+
) {
|
|
37
|
+
this.props = props;
|
|
38
|
+
|
|
39
|
+
this.Context = A_Context;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
get namespace() {
|
|
44
|
+
return this.Context.root
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Returns true if the class has inherited from the given class.
|
|
50
|
+
*
|
|
51
|
+
* @param cl
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
private hasInherited(cl: { new(...args: any[]) }): boolean {
|
|
55
|
+
return this.constructor === cl
|
|
56
|
+
? false
|
|
57
|
+
: true
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
protected async init() {
|
|
64
|
+
// await this.Context.init();
|
|
65
|
+
|
|
66
|
+
// await this.DM.init();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
// =======================================================================
|
|
72
|
+
// ========================== LIFECYCLE ================================
|
|
73
|
+
// =======================================================================
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Run the concept.
|
|
77
|
+
*/
|
|
78
|
+
async run(
|
|
79
|
+
params: A_TYPES__A_CONCEPT_RootRunParams = {}
|
|
80
|
+
) {
|
|
81
|
+
|
|
82
|
+
// to prevent modification of the method parameters use the A_Context directly without decorators
|
|
83
|
+
const [
|
|
84
|
+
Errors
|
|
85
|
+
] = this.Context.resolve([A_Errors]);
|
|
86
|
+
|
|
87
|
+
if (this.hasInherited(A_Concept))
|
|
88
|
+
Errors.throw('[root.run] method can not be overridden in the inherited classes');
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
// const allRunDeclarations = A_CONCEPT_LifecycleDeclarationsStorage
|
|
92
|
+
// .get(A_CONCEPT_STORAGE__DECORATORS_RUN_DECLARATIONS);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Build the concept.
|
|
98
|
+
*/
|
|
99
|
+
async build() {
|
|
100
|
+
// to prevent modification of the method parameters use the A_Context directly without decorators
|
|
101
|
+
const [
|
|
102
|
+
Errors
|
|
103
|
+
] = this.Context.resolve([A_Errors]);
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
if (this.hasInherited(A_Concept))
|
|
107
|
+
Errors.throw('[root.build] method can not be overridden in the inherited classes');
|
|
108
|
+
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
// /**
|
|
113
|
+
// * Deploy the concept.
|
|
114
|
+
// */
|
|
115
|
+
// async deploy() {
|
|
116
|
+
// if (this.hasInherited(A_Concept))
|
|
117
|
+
// this.Context.Errors.throw('[root.deploy] method can not be overridden in the inherited classes');
|
|
118
|
+
// }
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
// /**
|
|
122
|
+
// * Publish the concept.
|
|
123
|
+
// */
|
|
124
|
+
// async publish() {
|
|
125
|
+
// if (this.hasInherited(A_Concept))
|
|
126
|
+
// this.Context.Errors.throw('[root.publish] method can not be overridden in the inherited classes');
|
|
127
|
+
// }
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Call the specific method of the concept or included modules.
|
|
132
|
+
*/
|
|
133
|
+
async call() {
|
|
134
|
+
// to prevent modification of the method parameters use the A_Context directly without decorators
|
|
135
|
+
const [
|
|
136
|
+
Errors
|
|
137
|
+
] = this.Context.resolve([A_Errors]);
|
|
138
|
+
|
|
139
|
+
// if (this.hasInherited(A_Concept))
|
|
140
|
+
// this.Context.Errors.throw('[root.call] method can not be overridden in the inherited classes');
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { A_Concept } from "./A_Concept.class";
|
|
2
|
+
import { A_Namespace } from "../A-Namespace/A_Namespace.class";
|
|
3
|
+
import { A_Container } from "../A-Container/A-Container.class";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export interface A_TYPES__IConceptConstructor {
|
|
7
|
+
name: string,
|
|
8
|
+
description?: string,
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A set of Namespaces that the concept depends on.
|
|
12
|
+
* These namespaces will create a new Context for the concept.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
context?: Array<A_Namespace>,
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A set of Containers that the concept depends on.
|
|
20
|
+
* These containers will create a new Container for the concept.
|
|
21
|
+
*/
|
|
22
|
+
containers?: Array<{ new(...args: any[]): A_Container }>,
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A set of external Concepts that can be used in the current Concept.
|
|
27
|
+
* To provide additional functionality or extend the current Concept.
|
|
28
|
+
*/
|
|
29
|
+
import?: Array<A_Concept>
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
// =======================================================================
|
|
36
|
+
// =======================================================================
|
|
37
|
+
// ===================== A CONCEPT LIFE CYCLE ============================
|
|
38
|
+
// =======================================================================
|
|
39
|
+
// =======================================================================
|
|
40
|
+
|
|
41
|
+
export type A_TYPES__A_CONCEPT_RootRunParams = {
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { A_Namespace } from "../A-Namespace/A_Namespace.class";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This class should combine Components to achieve the goal withing Context
|
|
7
|
+
* Container could be interpreted as any Structure Entity, or Abstract Entity
|
|
8
|
+
* For example:
|
|
9
|
+
* - Controller (all Controllers with base logic)
|
|
10
|
+
* - Service (all Services with base logic)
|
|
11
|
+
* - Module (all Modules with base logic)
|
|
12
|
+
* - etc.
|
|
13
|
+
*/
|
|
14
|
+
export class A_Container<T extends A_Namespace = A_Namespace> {
|
|
15
|
+
|
|
16
|
+
protected readonly namespace!: T;
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
constructor(
|
|
20
|
+
namespace?: T
|
|
21
|
+
) {
|
|
22
|
+
if (namespace) {
|
|
23
|
+
this.namespace = namespace;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
// bind(
|
|
29
|
+
// Context: T,
|
|
30
|
+
// /**
|
|
31
|
+
// * Context provider from parent Concept
|
|
32
|
+
// * It's possible to use the same ContextProvider for all Containers
|
|
33
|
+
// */
|
|
34
|
+
// ContextProvider: A_ContextProvider
|
|
35
|
+
// ) {
|
|
36
|
+
// this.Context = Context;
|
|
37
|
+
// }
|
|
38
|
+
|
|
39
|
+
}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { A_CommonHelper, A_Polyfills } from "@adaas/a-utils";
|
|
2
|
+
import { A_Namespace } from "../A-Namespace/A_Namespace.class";
|
|
3
|
+
import { A_Component } from "../A-Component/A-Component.class";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Namespace Provider is responsible for providing the Namespace to the Containers and other Namespaces.
|
|
8
|
+
* This class stores all Namespaces across the Program.
|
|
9
|
+
*
|
|
10
|
+
* Namespace provider is a singleton class that is used to store all the Namespaces in the program.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export class A_Context {
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
static instance: A_Context;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Stores all the Namespaces by namespace.
|
|
20
|
+
* There might be a Namespaces of the same type but with different namespaces.
|
|
21
|
+
* That might be useful for the cases when you need to have multiple instances of the same Namespace e.g.
|
|
22
|
+
* - multiple http servers
|
|
23
|
+
* - multitenant applications
|
|
24
|
+
* - etc.
|
|
25
|
+
*/
|
|
26
|
+
namespaced: Map<string, A_Namespace> = new Map();
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Stores the singleton Namespaces.
|
|
30
|
+
* Singleton Namespaces are the Namespaces that are used only once in the program.
|
|
31
|
+
* In most cases, the singleton Namespace is the main Namespace of the program.
|
|
32
|
+
* It could be :
|
|
33
|
+
* - the main Namespace of the Program
|
|
34
|
+
* - the authentication Namespace
|
|
35
|
+
* - the main database Namespace
|
|
36
|
+
* - etc.
|
|
37
|
+
*/
|
|
38
|
+
singleton: WeakMap<{ new(...args: any[]): A_Namespace }, A_Namespace> = new WeakMap();
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Stores the components that are used in the program.
|
|
43
|
+
*/
|
|
44
|
+
components: Map<string, any> = new Map();
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Root Namespace is a Namespace that is used to run the program.
|
|
48
|
+
*/
|
|
49
|
+
private _root!: string
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
private constructor() {
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Get the instance of the Namespace Provider.
|
|
58
|
+
*
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
static getInstance() {
|
|
62
|
+
if (!A_Context.instance) {
|
|
63
|
+
A_Context.instance = new A_Context();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return A_Context.instance;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
static get root(): string {
|
|
70
|
+
return this.getInstance()._root;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
static get environment(): 'server' | 'browser' {
|
|
74
|
+
return A_Polyfills.env;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Register a Namespace in the provider.
|
|
79
|
+
* @param Namespace
|
|
80
|
+
*/
|
|
81
|
+
static register(Namespace: A_Namespace): string
|
|
82
|
+
static register(
|
|
83
|
+
Namespace: A_Namespace,
|
|
84
|
+
namespace?: string
|
|
85
|
+
): string
|
|
86
|
+
static register(
|
|
87
|
+
param1: A_Namespace,
|
|
88
|
+
param2?: A_Namespace | string,
|
|
89
|
+
): string {
|
|
90
|
+
|
|
91
|
+
const instance = this.getInstance();
|
|
92
|
+
|
|
93
|
+
let Namespace: A_Namespace;
|
|
94
|
+
let namespace: string;
|
|
95
|
+
|
|
96
|
+
if (typeof param2 === 'string') {
|
|
97
|
+
namespace = param2;
|
|
98
|
+
Namespace = param1;
|
|
99
|
+
} else {
|
|
100
|
+
Namespace = param1 as A_Namespace;
|
|
101
|
+
namespace = Namespace.name;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* If the namespace is not provided, then use the root namespace.
|
|
106
|
+
* If the root namespace is not provided, then use the default namespace.
|
|
107
|
+
*/
|
|
108
|
+
if (!namespace)
|
|
109
|
+
namespace = this.root
|
|
110
|
+
|| process.env.ADAAS_NAMESPACE
|
|
111
|
+
|| process.env.A_NAMESPACE
|
|
112
|
+
|| process.env.ADAAS_APP_NAMESPACE
|
|
113
|
+
|| 'a-concept'
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
if (!this.root)
|
|
118
|
+
instance._root = namespace;
|
|
119
|
+
|
|
120
|
+
instance.namespaced.set(namespace, Namespace);
|
|
121
|
+
|
|
122
|
+
return namespace;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Get the Namespace by namespace.
|
|
132
|
+
* @param namespace
|
|
133
|
+
*/
|
|
134
|
+
static get(namespace: string) {
|
|
135
|
+
const instance = this.getInstance();
|
|
136
|
+
|
|
137
|
+
return instance.namespaced.get(namespace)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Resolve the Component by Class.
|
|
146
|
+
*
|
|
147
|
+
* @param component
|
|
148
|
+
*/
|
|
149
|
+
static resolve<T extends A_Component>(
|
|
150
|
+
component: { new(...args: any[]): T }
|
|
151
|
+
): T
|
|
152
|
+
static resolve<T extends A_Namespace>(
|
|
153
|
+
namespace: { new(...args: any[]): T }
|
|
154
|
+
): T
|
|
155
|
+
static resolve<
|
|
156
|
+
T extends A_Namespace,
|
|
157
|
+
>(
|
|
158
|
+
namespaces: Array<{ new(...args: any[]): T }>
|
|
159
|
+
): Array<T>
|
|
160
|
+
static resolve<T extends A_Namespace>(
|
|
161
|
+
namespace: { new(...args: any[]): T },
|
|
162
|
+
name: string
|
|
163
|
+
): T
|
|
164
|
+
static resolve<
|
|
165
|
+
T extends A_Namespace,
|
|
166
|
+
K extends A_Component,
|
|
167
|
+
>(
|
|
168
|
+
param1: { new(...args: any[]): T } | { new(...args: any[]): K } | Array<{ new(...args: any[]): T }>,
|
|
169
|
+
param2?: string
|
|
170
|
+
): T | K | Array<T> {
|
|
171
|
+
|
|
172
|
+
switch (true) {
|
|
173
|
+
|
|
174
|
+
// If the first parameter is a Namespace
|
|
175
|
+
case Array.isArray(param1) && param1.every(namespace => A_CommonHelper.isInheritedFrom(namespace, A_Namespace)):
|
|
176
|
+
return param1.map(namespace => this.resolveNamespace(namespace));
|
|
177
|
+
|
|
178
|
+
// If the first parameter is a Namespace and the second parameter is a string
|
|
179
|
+
case !!param2 && typeof param1 === 'function' && A_CommonHelper.isInheritedFrom(param1, A_Namespace):
|
|
180
|
+
return this.resolveNamespace(param1 as typeof A_Namespace, param2) as T;
|
|
181
|
+
|
|
182
|
+
// If the first parameter is a Component
|
|
183
|
+
case !!param2 && typeof param1 === 'function' && A_CommonHelper.isInheritedFrom(param1, A_Component):
|
|
184
|
+
return this.resolveComponent(param1 as { new(...args: any[]): A_Component }) as K;
|
|
185
|
+
|
|
186
|
+
default:
|
|
187
|
+
throw new Error(`[!] A-Concept Context: Unknown type of the parameter.`);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
private static resolveComponent<T extends A_Component>(
|
|
194
|
+
component: { new(...args: any[]): T }
|
|
195
|
+
): T {
|
|
196
|
+
const instance = this.getInstance();
|
|
197
|
+
|
|
198
|
+
return instance.components.get(component.name) as T;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
*
|
|
205
|
+
* Allowing to resolve the Namespace by Class and Name.
|
|
206
|
+
*
|
|
207
|
+
* @param namespace
|
|
208
|
+
* @param name
|
|
209
|
+
*/
|
|
210
|
+
private static resolveNamespace<T extends A_Namespace>(
|
|
211
|
+
namespace: { new(...args: any[]): T },
|
|
212
|
+
name: string
|
|
213
|
+
): T
|
|
214
|
+
private static resolveNamespace<T extends A_Namespace>(
|
|
215
|
+
namespace: { new(...args: any[]): T }
|
|
216
|
+
): T
|
|
217
|
+
private static resolveNamespace<T extends A_Namespace>(
|
|
218
|
+
param1: { new(...args: any[]): T },
|
|
219
|
+
param2?: string
|
|
220
|
+
): T {
|
|
221
|
+
const instance = this.getInstance();
|
|
222
|
+
|
|
223
|
+
return instance.namespaced.get(
|
|
224
|
+
param2 || param1.name
|
|
225
|
+
) as T;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
class RealDependency {
|
|
2
|
+
constructor(private name: string) { }
|
|
3
|
+
|
|
4
|
+
getName() {
|
|
5
|
+
return this.name;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
performAction() {
|
|
9
|
+
console.log(`${this.name} is performing an action.`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
class DependencyReference<T> {
|
|
14
|
+
private proxyInstance: T | null = null;
|
|
15
|
+
private realInstance: T | null = null;
|
|
16
|
+
|
|
17
|
+
constructor(private realClass: { new(...args: any[]): T }, private args: any[]) { }
|
|
18
|
+
|
|
19
|
+
// Simulate async loading (e.g., dynamic imports, API calls, etc.)
|
|
20
|
+
private async loadInstance(): Promise<T> {
|
|
21
|
+
if (!this.realInstance) {
|
|
22
|
+
console.log('Loading real dependency...');
|
|
23
|
+
// Simulate async loading with a delay
|
|
24
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
25
|
+
this.realInstance = new this.realClass(...this.args);
|
|
26
|
+
}
|
|
27
|
+
return this.realInstance;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public async resolve(): Promise<T> {
|
|
31
|
+
if (!this.proxyInstance) {
|
|
32
|
+
const realInstance = await this.loadInstance();
|
|
33
|
+
|
|
34
|
+
this.proxyInstance = new Proxy({}, {
|
|
35
|
+
get: (target, prop) => {
|
|
36
|
+
const value = (realInstance as any)[prop];
|
|
37
|
+
|
|
38
|
+
// If the property is a method, return a bound function
|
|
39
|
+
if (typeof value === 'function') {
|
|
40
|
+
return value.bind(realInstance);
|
|
41
|
+
}
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
}) as T;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return this.proxyInstance;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
// Example usage:
|
|
53
|
+
(async () => {
|
|
54
|
+
const lazyDependency = new DependencyReference(RealDependency, ['ComponentA']);
|
|
55
|
+
|
|
56
|
+
const proxy = await lazyDependency.resolve(); // Loads the instance asynchronously
|
|
57
|
+
|
|
58
|
+
proxy.performAction(); // Will call the method on the real instance
|
|
59
|
+
|
|
60
|
+
console.log(proxy.getName()); // Calls method on the real instance
|
|
61
|
+
})();
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { A_Namespace } from "@adaas/a-concept/global/A-Namespace/A_Namespace.class"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export type A_TYPES__A_DependencyReferenceConstructor = {
|
|
5
|
+
/**
|
|
6
|
+
* The name of the dependency
|
|
7
|
+
*/
|
|
8
|
+
name: string
|
|
9
|
+
/**
|
|
10
|
+
* The version of the module
|
|
11
|
+
* By default it is 1.0.0
|
|
12
|
+
*/
|
|
13
|
+
version: string
|
|
14
|
+
/**
|
|
15
|
+
* The dependencies of the module
|
|
16
|
+
* Could be:
|
|
17
|
+
* - other Modules
|
|
18
|
+
* - other Contexts
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
dependencies: Array<typeof A_Namespace>
|
|
22
|
+
/**
|
|
23
|
+
* The source of the dependency
|
|
24
|
+
* Could be:
|
|
25
|
+
* - a string representing the path to the module
|
|
26
|
+
* - a module class (in case when config should be provided via the module constructor)
|
|
27
|
+
* - a module class constructor
|
|
28
|
+
* - a context class (in case when config should be provided via the context constructor)
|
|
29
|
+
* - a context class constructor
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
// source: A_Module | A_Context | typeof A_Module | typeof A_Context | string
|
|
33
|
+
source: A_Namespace
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
export type A_TYPES__A_DependencyReferenceConstructorConfig = {
|
|
38
|
+
/**
|
|
39
|
+
* Sync - blocks A-Express Application initialization until module is ready
|
|
40
|
+
* Async - allows to initialize module after A-Express Application initialization
|
|
41
|
+
*/
|
|
42
|
+
behavior: 'async' | 'sync',
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Allows to define a scheme of retries
|
|
46
|
+
*/
|
|
47
|
+
retries: {
|
|
48
|
+
/**
|
|
49
|
+
* The number of retries
|
|
50
|
+
* Default is 3
|
|
51
|
+
*/
|
|
52
|
+
n: number,
|
|
53
|
+
/**
|
|
54
|
+
* The timeout between retries
|
|
55
|
+
* Multiplied by the number of retries
|
|
56
|
+
* So after each retry the timeout is increased e.g. 1000ms * 1, 1000ms * 2, 1000ms * 3
|
|
57
|
+
* Default is 1000
|
|
58
|
+
*/
|
|
59
|
+
timeout: number
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { A_Polyfills } from '@adaas/a-utils';
|
|
2
|
+
import {
|
|
3
|
+
A_TYPES__NamespaceConstructor,
|
|
4
|
+
A_TYPES__INamespace,
|
|
5
|
+
} from './A_Namespace.types';
|
|
6
|
+
import { A_Context } from '../A-Context/A-Context.class';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A_Namespace is a base class for all Namespaces in the A
|
|
11
|
+
*
|
|
12
|
+
* Namespace is a shared object within some environment, service or Application.
|
|
13
|
+
* It is used to share some data, configuration, dependencies, etc. between different parts of the application.
|
|
14
|
+
*
|
|
15
|
+
* Namespace allow to :
|
|
16
|
+
* - share some data between different parts of the application,
|
|
17
|
+
* - share some configuration between different parts of the application,
|
|
18
|
+
* - share some dependencies between different parts of the application,
|
|
19
|
+
* - extend the capabilities of the application by adding new features or modifying existing ones into base classes
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
export class A_Namespace<
|
|
23
|
+
_ConstructorConfigType extends A_TYPES__NamespaceConstructor = any
|
|
24
|
+
> implements A_TYPES__INamespace {
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Namespace namespace
|
|
28
|
+
*/
|
|
29
|
+
name!: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Ready Promise to ensure the SDK is ready to use
|
|
33
|
+
*/
|
|
34
|
+
ready!: Promise<void>;
|
|
35
|
+
|
|
36
|
+
constructor(
|
|
37
|
+
protected config?: _ConstructorConfigType
|
|
38
|
+
) {
|
|
39
|
+
/**
|
|
40
|
+
* Register the Namespace in the global Namespace provider
|
|
41
|
+
*/
|
|
42
|
+
this.name = A_Context
|
|
43
|
+
.register(
|
|
44
|
+
this,
|
|
45
|
+
config?.name
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Run Async Initialization
|
|
50
|
+
*/
|
|
51
|
+
this.init();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
private hasInherited(cl: { new(...args: any[]) }): boolean {
|
|
57
|
+
return this.constructor === cl
|
|
58
|
+
? false
|
|
59
|
+
: true
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Initializes the Namespace or can be used to reinitialize the Namespace
|
|
64
|
+
*/
|
|
65
|
+
protected async init() {
|
|
66
|
+
if (!this.ready)
|
|
67
|
+
this.ready = new Promise(async (resolve, reject) => {
|
|
68
|
+
try {
|
|
69
|
+
await this.onBeforeInit();
|
|
70
|
+
|
|
71
|
+
await this.onInit();
|
|
72
|
+
|
|
73
|
+
await this.onAfterInit();
|
|
74
|
+
|
|
75
|
+
return resolve();
|
|
76
|
+
} catch (error) {
|
|
77
|
+
return reject(error);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
else
|
|
81
|
+
await this.ready;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
// ==============================================================
|
|
87
|
+
// ======================= HOOKS ================================
|
|
88
|
+
// ==============================================================
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Before init hook to be used in inherited classes
|
|
92
|
+
*
|
|
93
|
+
* @returns
|
|
94
|
+
*/
|
|
95
|
+
protected async onBeforeInit() {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Main initialization method for the SDK
|
|
101
|
+
*/
|
|
102
|
+
protected async onInit() {
|
|
103
|
+
|
|
104
|
+
// global logger configuration
|
|
105
|
+
if (A_Context.environment === 'server' && !this.hasInherited(A_Namespace)) {
|
|
106
|
+
// eslint-disable-next-line no-use-before-define
|
|
107
|
+
// process.on('uncaughtException', (error) => {
|
|
108
|
+
// // log only in case of A_AUTH_Error
|
|
109
|
+
// if (error instanceof A_Error)
|
|
110
|
+
// this.Logger.error(error);
|
|
111
|
+
// });
|
|
112
|
+
// // eslint-disable-next-line no-use-before-define
|
|
113
|
+
// process.on('unhandledRejection', (error) => {
|
|
114
|
+
// if (error instanceof A_Error)
|
|
115
|
+
// this.Logger.error(error);
|
|
116
|
+
// });
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* After init hook to be used in inherited classes
|
|
122
|
+
*
|
|
123
|
+
* @returns
|
|
124
|
+
*/
|
|
125
|
+
protected async onAfterInit() {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
}
|