@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,19 @@
|
|
|
1
|
+
export declare const A_CONCEPT_STORAGE__MODULE_DECLARATION_Config: unique symbol;
|
|
2
|
+
export declare const A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootRun: unique symbol;
|
|
3
|
+
export declare const A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootLoad: unique symbol;
|
|
4
|
+
export declare const A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootBuild: unique symbol;
|
|
5
|
+
export declare const A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootPublish: unique symbol;
|
|
6
|
+
export declare const A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootTest: unique symbol;
|
|
7
|
+
/**
|
|
8
|
+
* Storage to keep the module declarations across all modules
|
|
9
|
+
*/
|
|
10
|
+
export declare const A_CONCEPT_ModulesDeclarationStorage: WeakMap<any, Map<string | Symbol, any>>;
|
|
11
|
+
/**
|
|
12
|
+
* Storage to keep the lifecycle declarations across all modules
|
|
13
|
+
*/
|
|
14
|
+
export declare const A_CONCEPT_LifecycleDeclarationsStorage: Map<Symbol, any>;
|
|
15
|
+
/**
|
|
16
|
+
* The simplest way to store the decorators
|
|
17
|
+
* If any extra API is needed, it can be added here or replaced with a new class
|
|
18
|
+
*/
|
|
19
|
+
export declare const A_CONCEPT_Storage: WeakMap<object, any>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.A_CONCEPT_Storage = exports.A_CONCEPT_LifecycleDeclarationsStorage = exports.A_CONCEPT_ModulesDeclarationStorage = exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootTest = exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootPublish = exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootBuild = exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootLoad = exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootRun = exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Config = void 0;
|
|
4
|
+
// --------------------------------------------------------------
|
|
5
|
+
// ----- A Concept -> Module Declaration -> Main Config ---------
|
|
6
|
+
// --------------------------------------------------------------
|
|
7
|
+
exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Config = Symbol('a-concept-modules-declaration');
|
|
8
|
+
// -------------------------------------------------------------------------------
|
|
9
|
+
// ----- A Concept -> Module Declaration -> Concept Lifecycle Extension_ ---------
|
|
10
|
+
// -------------------------------------------------------------------------------
|
|
11
|
+
exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootRun = Symbol('a-concept-modules-declaration-lifecycle-root-run');
|
|
12
|
+
exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootLoad = Symbol('a-concept-modules-declaration-lifecycle-root-load');
|
|
13
|
+
exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootBuild = Symbol('a-concept-modules-declaration-lifecycle-root-build');
|
|
14
|
+
exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootPublish = Symbol('a-concept-modules-declaration-lifecycle-root-publish');
|
|
15
|
+
exports.A_CONCEPT_STORAGE__MODULE_DECLARATION_Lifecycle_RootTest = Symbol('a-concept-modules-declaration-lifecycle-root-test');
|
|
16
|
+
/**
|
|
17
|
+
* Storage to keep the module declarations across all modules
|
|
18
|
+
*/
|
|
19
|
+
exports.A_CONCEPT_ModulesDeclarationStorage = new WeakMap();
|
|
20
|
+
/**
|
|
21
|
+
* Storage to keep the lifecycle declarations across all modules
|
|
22
|
+
*/
|
|
23
|
+
exports.A_CONCEPT_LifecycleDeclarationsStorage = new Map();
|
|
24
|
+
/**
|
|
25
|
+
* The simplest way to store the decorators
|
|
26
|
+
* If any extra API is needed, it can be added here or replaced with a new class
|
|
27
|
+
*/
|
|
28
|
+
exports.A_CONCEPT_Storage = new WeakMap();
|
|
29
|
+
//# sourceMappingURL=A_Concept.storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A_Concept.storage.js","sourceRoot":"","sources":["../../../src/storage/A_Concept.storage.ts"],"names":[],"mappings":";;;AAEA,iEAAiE;AACjE,iEAAiE;AACjE,iEAAiE;AACpD,QAAA,4CAA4C,GAAG,MAAM,CAAC,+BAA+B,CAAC,CAAC;AAIpG,kFAAkF;AAClF,mFAAmF;AACnF,kFAAkF;AACrE,QAAA,uDAAuD,GAAG,MAAM,CAAC,kDAAkD,CAAC,CAAC;AACrH,QAAA,wDAAwD,GAAG,MAAM,CAAC,mDAAmD,CAAC,CAAC;AACvH,QAAA,yDAAyD,GAAG,MAAM,CAAC,oDAAoD,CAAC,CAAC;AACzH,QAAA,2DAA2D,GAAG,MAAM,CAAC,sDAAsD,CAAC,CAAC;AAC7H,QAAA,wDAAwD,GAAG,MAAM,CAAC,mDAAmD,CAAC,CAAC;AAKpI;;GAEG;AACU,QAAA,mCAAmC,GAG5C,IAAI,OAAO,EAAE,CAAC;AAIlB;;GAEG;AACU,QAAA,sCAAsC,GAAqB,IAAI,GAAG,EAAE,CAAC;AAMlF;;;GAGG;AACU,QAAA,iBAAiB,GAAG,IAAI,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { A_Module } from "../global/A_Module.class";
|
|
2
|
+
export type A_DependencyManagerConstructorDependency = {
|
|
3
|
+
/**
|
|
4
|
+
* The name of the dependency
|
|
5
|
+
*/
|
|
6
|
+
behavior: 'sync' | 'async';
|
|
7
|
+
/**
|
|
8
|
+
* The source of the dependency
|
|
9
|
+
* Could be:
|
|
10
|
+
* - a string representing the path to the module
|
|
11
|
+
* - a module class
|
|
12
|
+
* - a module class constructor
|
|
13
|
+
*/
|
|
14
|
+
source: string | A_Module | typeof A_Module;
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A_DependencyManager.types.js","sourceRoot":"","sources":["../../../src/types/A_DependencyManager.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare enum A_TYPES__ModuleState {
|
|
2
|
+
INIT = "INIT",
|
|
3
|
+
LOADING = "LOADING",
|
|
4
|
+
READY = "READY",
|
|
5
|
+
FAILED = "FAILED"
|
|
6
|
+
}
|
|
7
|
+
export declare enum A_TYPES__ModuleTypes {
|
|
8
|
+
/**
|
|
9
|
+
* Custom module type allows additional external control over the module
|
|
10
|
+
*/
|
|
11
|
+
CUSTOM = "CUSTOM",
|
|
12
|
+
/**
|
|
13
|
+
* Default module type is a module that is used by default and has no additional control.
|
|
14
|
+
*/
|
|
15
|
+
DEFAULT = "DEFAULT"
|
|
16
|
+
}
|
|
17
|
+
export type A_TYPES__ModuleConstructor = {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.A_TYPES__ModuleTypes = exports.A_TYPES__ModuleState = void 0;
|
|
4
|
+
var A_TYPES__ModuleState;
|
|
5
|
+
(function (A_TYPES__ModuleState) {
|
|
6
|
+
A_TYPES__ModuleState["INIT"] = "INIT";
|
|
7
|
+
A_TYPES__ModuleState["LOADING"] = "LOADING";
|
|
8
|
+
A_TYPES__ModuleState["READY"] = "READY";
|
|
9
|
+
A_TYPES__ModuleState["FAILED"] = "FAILED";
|
|
10
|
+
})(A_TYPES__ModuleState || (exports.A_TYPES__ModuleState = A_TYPES__ModuleState = {}));
|
|
11
|
+
var A_TYPES__ModuleTypes;
|
|
12
|
+
(function (A_TYPES__ModuleTypes) {
|
|
13
|
+
/**
|
|
14
|
+
* Custom module type allows additional external control over the module
|
|
15
|
+
*/
|
|
16
|
+
A_TYPES__ModuleTypes["CUSTOM"] = "CUSTOM";
|
|
17
|
+
/**
|
|
18
|
+
* Default module type is a module that is used by default and has no additional control.
|
|
19
|
+
*/
|
|
20
|
+
A_TYPES__ModuleTypes["DEFAULT"] = "DEFAULT";
|
|
21
|
+
})(A_TYPES__ModuleTypes || (exports.A_TYPES__ModuleTypes = A_TYPES__ModuleTypes = {}));
|
|
22
|
+
//# sourceMappingURL=A_Module.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A_Module.types.js","sourceRoot":"","sources":["../../../src/types/A_Module.types.ts"],"names":[],"mappings":";;;AAAA,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC5B,qCAAa,CAAA;IACb,2CAAmB,CAAA;IACnB,uCAAe,CAAA;IACf,yCAAiB,CAAA;AACrB,CAAC,EALW,oBAAoB,oCAApB,oBAAoB,QAK/B;AAED,IAAY,oBAUX;AAVD,WAAY,oBAAoB;IAC5B;;OAEG;IACH,yCAAiB,CAAA;IAEjB;;OAEG;IACH,2CAAmB,CAAA;AACvB,CAAC,EAVW,oBAAoB,oCAApB,oBAAoB,QAU/B"}
|
package/docs/logo.png
ADDED
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// import { A_Concept } from "@adaas/a-concept/global/A-Concept/A_Concept.class";
|
|
2
|
+
// import { UsersAPIModule } from "./users.api";
|
|
3
|
+
// import { OrdersAPIModule } from "./orders.api";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
// (async () => {
|
|
7
|
+
// const simpleConcept = new A_Concept({
|
|
8
|
+
// name: 'simple-api-concept',
|
|
9
|
+
// modules: [
|
|
10
|
+
// new UsersAPIModule({
|
|
11
|
+
// behavior: 'sync'
|
|
12
|
+
// }),
|
|
13
|
+
// new OrdersAPIModule({
|
|
14
|
+
// behavior: 'sync'
|
|
15
|
+
// })
|
|
16
|
+
// ],
|
|
17
|
+
// context: [
|
|
18
|
+
|
|
19
|
+
// ]
|
|
20
|
+
// });
|
|
21
|
+
|
|
22
|
+
// await simpleConcept.run();
|
|
23
|
+
|
|
24
|
+
// })();
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// import { A_Module } from "@adaas/a-concept/global/A_Module.class"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
// declare module "@adaas/a-concept/global/A_Concept.class" {
|
|
5
|
+
// interface A_Concept {
|
|
6
|
+
// Orders: OrdersAPIModule;
|
|
7
|
+
// }
|
|
8
|
+
// }
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
// export class OrdersAPIModule extends A_Module {
|
|
12
|
+
|
|
13
|
+
// async makeSome1() {
|
|
14
|
+
// console.log('Making some request')
|
|
15
|
+
// }
|
|
16
|
+
|
|
17
|
+
// async makeSome2() {
|
|
18
|
+
// console.log('Making some request')
|
|
19
|
+
// }
|
|
20
|
+
|
|
21
|
+
// }
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// import { A_Module } from "@adaas/a-concept/global/A_Module.class"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
// declare module "@adaas/a-concept/global/A_Concept.class" {
|
|
5
|
+
// interface A_Concept {
|
|
6
|
+
// Users: UsersAPIModule;
|
|
7
|
+
// }
|
|
8
|
+
// }
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
// export class UsersAPIModule extends A_Module {
|
|
12
|
+
|
|
13
|
+
// async makeSome1() {
|
|
14
|
+
// console.log('Making some request')
|
|
15
|
+
// }
|
|
16
|
+
|
|
17
|
+
// async makeSome2() {
|
|
18
|
+
// console.log('Making some request')
|
|
19
|
+
// }
|
|
20
|
+
|
|
21
|
+
// }
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// import { A_Concept } from "@adaas/a-concept/global/A-Concept/A_Concept.class";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
// (async () => {
|
|
5
|
+
// const simpleConcept = new A_Concept({
|
|
6
|
+
// name: 'simple-concept',
|
|
7
|
+
// modules: [
|
|
8
|
+
|
|
9
|
+
// ],
|
|
10
|
+
// context: [
|
|
11
|
+
// ]
|
|
12
|
+
// });
|
|
13
|
+
|
|
14
|
+
// await simpleConcept.run();
|
|
15
|
+
|
|
16
|
+
// })();
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { A_Concept } from "@adaas/a-concept/global/A-Concept/A_Concept.class";
|
|
2
|
+
import { DefaultHttpServer } from "./containers/http-server.container";
|
|
3
|
+
import { HttpServer } from "./contexts/http-server.namespace";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
(async () => {
|
|
7
|
+
const simpleConcept = new A_Concept({
|
|
8
|
+
name: 'test-server',
|
|
9
|
+
// import: [
|
|
10
|
+
// server1,
|
|
11
|
+
// server2
|
|
12
|
+
// ],
|
|
13
|
+
containers: [
|
|
14
|
+
DefaultHttpServer
|
|
15
|
+
],
|
|
16
|
+
context: [
|
|
17
|
+
new HttpServer({
|
|
18
|
+
port: 3000
|
|
19
|
+
}),
|
|
20
|
+
new HttpServer({
|
|
21
|
+
port: 3001
|
|
22
|
+
})
|
|
23
|
+
],
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
await simpleConcept.run();
|
|
29
|
+
|
|
30
|
+
})();
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { A_Container } from "@adaas/a-concept/global/A-Container/A-Container.class";
|
|
2
|
+
import { HttpServer } from "../contexts/http-server.namespace";
|
|
3
|
+
import { createServer, IncomingMessage, Server, ServerResponse } from "http";
|
|
4
|
+
import { A_Run } from "@adaas/a-concept/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator";
|
|
5
|
+
import { A_Inject } from "@adaas/a-concept/decorators/A-Inject/A-Inject.decorator";
|
|
6
|
+
// import { A_Feature } from "@adaas/a-concept/decorators/A-Feature/A-Feature.decorator";
|
|
7
|
+
import { A_Concept } from "@adaas/a-concept/global/A-Concept/A_Concept.class";
|
|
8
|
+
import { A_TYPES__A_CONCEPT_RootRunParams } from "@adaas/a-concept/global/A-Concept/A_Concept.types";
|
|
9
|
+
import { A_Lifecycle } from "@adaas/a-concept/decorators/A-ConceptLifecycle";
|
|
10
|
+
import { A_Config } from "src/containers/A-Config/A-Config.namespace";
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export class DefaultHttpServer extends A_Container<HttpServer> {
|
|
17
|
+
|
|
18
|
+
server!: Server
|
|
19
|
+
port!: number
|
|
20
|
+
|
|
21
|
+
@A_Lifecycle.Load()
|
|
22
|
+
public async create(
|
|
23
|
+
concept: A_Concept,
|
|
24
|
+
@A_Inject(A_Config) config: A_Config<'PORT'>
|
|
25
|
+
) {
|
|
26
|
+
// Set the server to listen on port 3000
|
|
27
|
+
this.port = config.get('PORT') || 3000;
|
|
28
|
+
|
|
29
|
+
// Create the HTTP server
|
|
30
|
+
this.server = createServer((req: IncomingMessage, res: ServerResponse) => {
|
|
31
|
+
// Set the response headers
|
|
32
|
+
res.statusCode = 200;
|
|
33
|
+
res.setHeader('Content-Type', 'text/plain');
|
|
34
|
+
|
|
35
|
+
// Routing logic (basic example)
|
|
36
|
+
if (req.url === '/') {
|
|
37
|
+
res.end('Welcome to the homepage!');
|
|
38
|
+
} else if (req.url === '/about') {
|
|
39
|
+
res.end('Welcome to the about page!');
|
|
40
|
+
} else {
|
|
41
|
+
res.statusCode = 404;
|
|
42
|
+
res.end('404 - Page not found');
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
this.namespace.registerServer(this.server, this.port);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@A_Run({})
|
|
52
|
+
async run(
|
|
53
|
+
params: A_TYPES__A_CONCEPT_RootRunParams,
|
|
54
|
+
) {
|
|
55
|
+
this.server.listen(this.port, () => {
|
|
56
|
+
console.log(`Server is running on http://localhost:${this.port}`);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
// @A_Feature({
|
|
63
|
+
// name: 'stop',
|
|
64
|
+
// description: 'Stop the server'
|
|
65
|
+
// })
|
|
66
|
+
// async stop() {
|
|
67
|
+
|
|
68
|
+
// }
|
|
69
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { A_Load } from "@adaas/a-concept/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator";
|
|
2
|
+
import { A_Container } from "@adaas/a-concept/global/A-Container/A-Container.class";
|
|
3
|
+
import { HttpServer } from "../contexts/http-server.namespace";
|
|
4
|
+
import { createServer, IncomingMessage, Server, ServerResponse } from "http";
|
|
5
|
+
import { A_Inject } from "@adaas/a-concept/decorators/A-Inject/A-Inject.decorator";
|
|
6
|
+
import { A_Concept } from "@adaas/a-concept/global/A-Concept/A_Concept.class";
|
|
7
|
+
import { A_Config } from "src/containers/A-Config/A-Config.namespace";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
export class HttpServerController extends A_Container<HttpServer> {
|
|
14
|
+
|
|
15
|
+
@A_Load(
|
|
16
|
+
)
|
|
17
|
+
public async create(
|
|
18
|
+
concept: A_Concept,
|
|
19
|
+
@A_Inject(A_Config) config: A_Config<'PORT'>
|
|
20
|
+
) {
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { A_Container } from "@adaas/a-concept/global/A-Container/A-Container.class";
|
|
2
|
+
import { HttpServer } from "../contexts/http-server.namespace";
|
|
3
|
+
import { createServer, IncomingMessage, Server, ServerResponse } from "http";
|
|
4
|
+
import { A_Inject } from "@adaas/a-concept/decorators/A-Inject/A-Inject.decorator";
|
|
5
|
+
import { A_Config } from "src/containers/A-Config/A-Config.namespace";
|
|
6
|
+
import { A_Lifecycle } from "@adaas/a-concept/decorators/A-ConceptLifecycle";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export class HttpServerRouter extends A_Container<HttpServer> {
|
|
13
|
+
|
|
14
|
+
@A_Lifecycle.Load()
|
|
15
|
+
public async listen(
|
|
16
|
+
@A_Inject(A_Config) config: A_Config<'PORT'>
|
|
17
|
+
) {
|
|
18
|
+
const server = this.namespace.getServer(this.namespace.port);
|
|
19
|
+
|
|
20
|
+
// Do something with Server e.g. assign routes
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { A_Lifecycle } from "@adaas/a-concept/decorators/A-ConceptLifecycle";
|
|
2
|
+
import { A_Component } from "@adaas/a-concept/global/A-Component/A-Component.class";
|
|
3
|
+
import { A_Container } from "@adaas/a-concept/global/A-Container/A-Container.class";
|
|
4
|
+
import { A_Namespace } from "@adaas/a-concept/global/A-Namespace/A_Namespace.class";
|
|
5
|
+
import { A_TYPES__NamespaceConstructor } from "@adaas/a-concept/global/A-Namespace/A_Namespace.types";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export type A_TYPES__HttpServerNamespaceConstructor = {
|
|
9
|
+
port: number
|
|
10
|
+
} & A_TYPES__NamespaceConstructor
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
//=========== EXAMPLES============\
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Stores information about DB connection, models, other things, etc.
|
|
22
|
+
*/
|
|
23
|
+
class A_DB extends A_Namespace {
|
|
24
|
+
|
|
25
|
+
private models: Array<any> = [];
|
|
26
|
+
private connection: any;
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
registerModel(model: any) {
|
|
30
|
+
this.models.push(model);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
connect(
|
|
34
|
+
connection: any
|
|
35
|
+
) {
|
|
36
|
+
this.connection = connection;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Container that deals with the DB connection.
|
|
44
|
+
*/
|
|
45
|
+
class PostgresDB extends A_Container<A_DB> {
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@A_Lifecycle.Load()
|
|
49
|
+
async connect() {
|
|
50
|
+
// Connect to the DB
|
|
51
|
+
this.namespace.connect(
|
|
52
|
+
// Just for example
|
|
53
|
+
'connection'
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@A_Lifecycle.Load()
|
|
59
|
+
async init() {
|
|
60
|
+
this.namespace.registerModel(
|
|
61
|
+
// Just for example
|
|
62
|
+
'model'
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Stores information about the models with methods to interact with them.
|
|
70
|
+
*/
|
|
71
|
+
class PostgresDBRepository extends A_Component {
|
|
72
|
+
|
|
73
|
+
async save(model: any) {
|
|
74
|
+
// Save the model
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async find(model: any) {
|
|
78
|
+
// Find the model
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async delete(model: any) {
|
|
82
|
+
// Delete the model
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
class A_Auth extends A_Namespace {
|
|
90
|
+
|
|
91
|
+
private users: Array<any> = [];
|
|
92
|
+
|
|
93
|
+
// dosomething<
|
|
94
|
+
// S extends A_TYPES__NamespaceConstructor,
|
|
95
|
+
// T extends A_Namespace<S>>(
|
|
96
|
+
// conatienr: typeof A_Container<T>,
|
|
97
|
+
// params: S
|
|
98
|
+
|
|
99
|
+
// ) { }
|
|
100
|
+
|
|
101
|
+
registerUser(user: any) {
|
|
102
|
+
this.users.push(user);
|
|
103
|
+
|
|
104
|
+
// Do something with the user
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { A_Namespace } from "@adaas/a-concept/global/A-Namespace/A_Namespace.class";
|
|
2
|
+
import { IncomingMessage, Server } from "http";
|
|
3
|
+
import { A_TYPES__HttpServerNamespaceConstructor } from "./http-server.context.types";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export class HttpServer extends A_Namespace<A_TYPES__HttpServerNamespaceConstructor> {
|
|
7
|
+
|
|
8
|
+
servers!: Map<string, Server>
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
get port(): number {
|
|
14
|
+
const [name, port] = this.name.split(':');
|
|
15
|
+
|
|
16
|
+
return parseInt(port);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
registerServer(server: Server, port: number) {
|
|
21
|
+
this.servers.set(port.toString(), server);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
getServer(port: number) {
|
|
25
|
+
return this.servers.get(port.toString());
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
parseBody(req: IncomingMessage): Promise<any> {
|
|
29
|
+
return new Promise((resolve, reject) => {
|
|
30
|
+
let body = '';
|
|
31
|
+
req.on('data', chunk => body += chunk.toString());
|
|
32
|
+
req.on('end', () => resolve(JSON.parse(body)));
|
|
33
|
+
req.on('error', reject);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
// declare module "../modules/simple-http-server.types" {
|
|
3
|
+
// interface SimpleHTTPServerModuleControllers {
|
|
4
|
+
// Orders: OrderController
|
|
5
|
+
// }
|
|
6
|
+
// }
|
|
7
|
+
|
|
8
|
+
import { A_Component } from "@adaas/a-concept/global/A-Component/A-Component.class"
|
|
9
|
+
|
|
10
|
+
export class OrderController extends A_Component {
|
|
11
|
+
|
|
12
|
+
async makeSome1() {
|
|
13
|
+
console.log('Making some request')
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async makeSome2() {
|
|
17
|
+
console.log('Making some request')
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// import { A_Load } from "@adaas/a-concept/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator"
|
|
2
|
+
// import { A_Module } from "@adaas/a-concept/global/A_Module.class"
|
|
3
|
+
// import { SimpleHTTPServerModule } from "../modules/simple-http-server.module"
|
|
4
|
+
// import { IncomingMessage, ServerResponse } from "http"
|
|
5
|
+
// import { SimpleHTTPServerContext } from "../modules/simple-http-server.context"
|
|
6
|
+
// import { A_Dependency } from "@adaas/a-concept/decorators/A-Dependency/A-Dependency.decorator"
|
|
7
|
+
// import { A_Run } from "@adaas/a-concept/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator"
|
|
8
|
+
// import { A_Inject } from "@adaas/a-concept/decorators/A-Inject/A-Inject.decorator"
|
|
9
|
+
// import { OrderController } from "./orders.controller"
|
|
10
|
+
|
|
11
|
+
// declare module "../modules/simple-http-server.types" {
|
|
12
|
+
// interface SimpleHTTPServerModuleControllers {
|
|
13
|
+
// Users: UserController
|
|
14
|
+
// }
|
|
15
|
+
// }
|
|
16
|
+
|
|
17
|
+
// declare module "../modules/simple-http-server.context" {
|
|
18
|
+
// interface SimpleHTTPServerContext {
|
|
19
|
+
// users: Array<any>
|
|
20
|
+
// }
|
|
21
|
+
// }
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
// // @A_Dependency({
|
|
26
|
+
// // name: 'users-controller',
|
|
27
|
+
// // version: '0.0.1',
|
|
28
|
+
// // dependencies: [
|
|
29
|
+
// // SimpleHTTPServerModule
|
|
30
|
+
// // ]
|
|
31
|
+
// // })
|
|
32
|
+
// export class UserController extends A_Module {
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
// private SomeModule = A_Inject(OrderController)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
// @A_Load(
|
|
39
|
+
// // after: [SimpleHTTPServerModule]
|
|
40
|
+
// )
|
|
41
|
+
// async defineListeners(
|
|
42
|
+
// ) {
|
|
43
|
+
|
|
44
|
+
// /**
|
|
45
|
+
// * Approach with Dependency Manager allows to resolve the module and context in the method
|
|
46
|
+
// */
|
|
47
|
+
// const simpleHTTPServerModule1 = await this.DM.resolve(SimpleHTTPServerModule);
|
|
48
|
+
// const context1 = await this.DM.resolve(SimpleHTTPServerContext);
|
|
49
|
+
// /**
|
|
50
|
+
// * OR
|
|
51
|
+
// *
|
|
52
|
+
// * It's possible to resolve multiple dependencies at once
|
|
53
|
+
// */
|
|
54
|
+
// const [
|
|
55
|
+
// simpleHTTPServerModule2,
|
|
56
|
+
// context
|
|
57
|
+
// ] = await this.DM.resolve([
|
|
58
|
+
// SimpleHTTPServerModule,
|
|
59
|
+
// SimpleHTTPServerContext
|
|
60
|
+
// ]);
|
|
61
|
+
|
|
62
|
+
// // simpleHTTPServerModule.create();
|
|
63
|
+
// context.users = [
|
|
64
|
+
// { id: 1, name: 'John Doe' },
|
|
65
|
+
// { id: 2, name: 'Jane Doe' }
|
|
66
|
+
// ];
|
|
67
|
+
// }
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
// @A_Load()
|
|
72
|
+
// /**
|
|
73
|
+
// *
|
|
74
|
+
// * Approach with direct injection allows to use the module directly in the method
|
|
75
|
+
// * However, this approach is not recommended as it makes the code less readable and testable
|
|
76
|
+
// * In the example below Injection changes the original method signature that may impact the readability/testability of the code
|
|
77
|
+
// *
|
|
78
|
+
// */
|
|
79
|
+
// async run(
|
|
80
|
+
// @A_Inject(SimpleHTTPServerModule) simpleHTTPServerModule: SimpleHTTPServerModule
|
|
81
|
+
// ) {
|
|
82
|
+
// // simpleHTTPServerModule.create();
|
|
83
|
+
// }
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
// async getUser(
|
|
87
|
+
// req: IncomingMessage,
|
|
88
|
+
// res: ServerResponse,
|
|
89
|
+
// id: number
|
|
90
|
+
// ) {
|
|
91
|
+
|
|
92
|
+
// const context = new SimpleHTTPServerContext()
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
// const user = context.users.find(u => u.id === id);
|
|
96
|
+
// if (user) {
|
|
97
|
+
// res.writeHead(200);
|
|
98
|
+
// res.end(JSON.stringify(user));
|
|
99
|
+
// } else {
|
|
100
|
+
// res.writeHead(404);
|
|
101
|
+
// res.end(JSON.stringify({ message: 'User not found' }));
|
|
102
|
+
// }
|
|
103
|
+
// }
|
|
104
|
+
// }
|
package/index.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { A_Concept } from './src/global/A-Concept/A_Concept.class';
|
|
2
|
+
export * from './src/global/A-Concept/A_Concept.types';
|
|
3
|
+
export { A_Container } from './src/global/A-Container/A-Container.class';
|
|
4
|
+
// export * from './src/global/A-Container/A-Container.class';
|
|
5
|
+
export { A_Namespace } from './src/global/A-Namespace/A_Namespace.class';
|
|
6
|
+
export * from './src/global/A-Namespace/A_Namespace.types';
|
|
7
|
+
export { A_Inject } from './src/decorators/A-Inject/A-Inject.decorator';
|
|
8
|
+
export * from './src/decorators/A-Inject/A-Inject.decorator.types';
|
|
9
|
+
export { A_Load } from './src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator';
|
|
10
|
+
export * from './src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.types';
|
|
11
|
+
export { A_Run } from './src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator';
|
|
12
|
+
export * from './src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.types';
|
|
13
|
+
|
|
14
|
+
export { A_Lifecycle } from './src/decorators/A-ConceptLifecycle';
|