@adaas/a-concept 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/examples/simple/components/A.component.d.ts +7 -0
- package/dist/examples/simple/components/A.component.js +57 -0
- package/dist/examples/simple/components/A.component.js.map +1 -0
- package/dist/examples/simple/components/B.component.d.ts +9 -0
- package/dist/examples/simple/components/B.component.js +77 -0
- package/dist/examples/simple/components/B.component.js.map +1 -0
- package/dist/examples/simple/concept.d.ts +1 -0
- package/dist/examples/simple/concept.js +53 -11
- package/dist/examples/simple/concept.js.map +1 -1
- package/dist/examples/simple/containers/Main.container.d.ts +11 -0
- package/dist/examples/simple/containers/Main.container.js +71 -0
- package/dist/examples/simple/containers/Main.container.js.map +1 -0
- package/dist/examples/simple/context/Fragment_A.context.d.ts +6 -0
- package/dist/examples/simple/context/Fragment_A.context.js +16 -0
- package/dist/examples/simple/context/Fragment_A.context.js.map +1 -0
- package/dist/examples/simple/context/Fragment_B.context.d.ts +6 -0
- package/dist/examples/simple/context/Fragment_B.context.js +16 -0
- package/dist/examples/simple/context/Fragment_B.context.js.map +1 -0
- package/dist/examples/simple-http-server/components/http-error-handler.component.d.ts +9 -0
- package/dist/examples/simple-http-server/components/http-error-handler.component.js +63 -0
- package/dist/examples/simple-http-server/components/http-error-handler.component.js.map +1 -0
- package/dist/examples/simple-http-server/components/http-request-handler.component.d.ts +2 -0
- package/dist/examples/simple-http-server/components/http-request-handler.component.js +7 -0
- package/dist/examples/simple-http-server/components/http-request-handler.component.js.map +1 -0
- package/dist/examples/simple-http-server/concept.js +21 -22
- package/dist/examples/simple-http-server/concept.js.map +1 -1
- package/dist/examples/simple-http-server/containers/http-server.container.d.ts +8 -8
- package/dist/examples/simple-http-server/containers/http-server.container.js +34 -30
- package/dist/examples/simple-http-server/containers/http-server.container.js.map +1 -1
- package/dist/examples/simple-http-server/containers/http-server.controller.js +1 -1
- package/dist/examples/simple-http-server/containers/http-server.router.js +2 -2
- package/dist/examples/simple-http-server/containers/http-server.router.js.map +1 -1
- package/dist/examples/simple-http-server/contexts/http-request.context.d.ts +13 -0
- package/dist/examples/simple-http-server/contexts/http-request.context.js +51 -0
- package/dist/examples/simple-http-server/contexts/http-request.context.js.map +1 -0
- package/dist/examples/simple-http-server/contexts/http-server.context.types.d.ts +0 -4
- package/dist/examples/simple-http-server/contexts/http-server.context.types.js +0 -98
- package/dist/examples/simple-http-server/contexts/http-server.context.types.js.map +1 -1
- package/dist/examples/simple-http-server/contexts/http-server.namespace.d.ts +1 -1
- package/dist/examples/simple-http-server/contexts/http-server.namespace.js +1 -1
- package/dist/examples/simple-http-server/controllers/users.controller.js +2 -2
- package/dist/examples/simple-http-server/test.d.ts +68 -0
- package/dist/examples/simple-http-server/test.js +162 -0
- package/dist/examples/simple-http-server/test.js.map +1 -0
- package/dist/index.d.ts +27 -19
- package/dist/index.js +58 -26
- package/dist/index.js.map +1 -1
- package/dist/src/base/A-Config/A-Config.container.d.ts +8 -0
- package/dist/src/base/A-Config/A-Config.container.js +64 -0
- package/dist/src/base/A-Config/A-Config.container.js.map +1 -0
- package/dist/src/base/A-Config/A-Config.context.d.ts +30 -0
- package/dist/src/base/A-Config/A-Config.context.js +58 -0
- package/dist/src/base/A-Config/A-Config.context.js.map +1 -0
- package/dist/src/base/A-Config/A-Config.types.d.ts +16 -0
- package/dist/src/base/A-Config/A-Config.types.js +7 -0
- package/dist/src/base/A-Config/A-Config.types.js.map +1 -0
- package/dist/src/base/A-Config/components/ConfigReader.component.d.ts +19 -0
- package/dist/src/base/A-Config/components/ConfigReader.component.js +53 -0
- package/dist/src/base/A-Config/components/ConfigReader.component.js.map +1 -0
- package/dist/src/base/A-Config/components/ENVConfigReader.component.d.ts +10 -0
- package/dist/src/base/A-Config/components/ENVConfigReader.component.js +37 -0
- package/dist/src/base/A-Config/components/ENVConfigReader.component.js.map +1 -0
- package/dist/src/base/A-Config/components/FileConfigReader.component.d.ts +11 -0
- package/dist/src/base/A-Config/components/FileConfigReader.component.js +47 -0
- package/dist/src/base/A-Config/components/FileConfigReader.component.js.map +1 -0
- package/dist/src/base/A-Errors/A-Errors.component.d.ts +18 -0
- package/dist/src/base/A-Errors/A-Errors.component.js +85 -0
- package/dist/src/base/A-Errors/A-Errors.component.js.map +1 -0
- package/dist/src/base/A-Errors/A-Errors.context.d.ts +27 -0
- package/dist/src/base/A-Errors/A-Errors.context.js +50 -0
- package/dist/src/base/A-Errors/A-Errors.context.js.map +1 -0
- package/dist/src/base/A-Errors/A-Errors.types.d.ts +5 -0
- package/dist/src/base/A-Errors/A-Errors.types.js +3 -0
- package/dist/src/base/A-Errors/A-Errors.types.js.map +1 -0
- package/dist/src/base/A-Logger/A-Logger.component.d.ts +28 -0
- package/dist/src/base/A-Logger/A-Logger.component.js +142 -0
- package/dist/src/base/A-Logger/A-Logger.component.js.map +1 -0
- package/dist/src/base/A-Logger/A-Logger.types.js +2 -0
- package/dist/src/base/A-Logger/A-Logger.types.js.map +1 -0
- package/dist/src/constants/A_ConceptLifecycle.constants.d.ts +0 -2
- package/dist/src/constants/A_ConceptLifecycle.constants.js +9 -10
- package/dist/src/constants/A_ConceptLifecycle.constants.js.map +1 -1
- package/dist/src/containers/A-Config/A-Config.container.js +1 -1
- package/dist/src/containers/A-Config/A-Config.namespace.d.ts +1 -1
- package/dist/src/containers/A-Config/A-Config.namespace.js +1 -1
- package/dist/src/containers/A-Config/A-Config.types.d.ts +1 -1
- package/dist/src/containers/A-Errors/A-Errors.container.js +1 -1
- package/dist/src/containers/A-Errors/A-Errors.namespace.d.ts +1 -1
- package/dist/src/containers/A-Errors/A-Errors.namespace.js +1 -1
- package/dist/src/containers/A-Errors/A-Errors.types.d.ts +1 -1
- package/dist/src/containers/A-Logger/A-Logger.container.js +1 -1
- package/dist/src/containers/A-Logger/A-Logger.namespace.d.ts +1 -1
- package/dist/src/containers/A-Logger/A-Logger.namespace.js +1 -1
- package/dist/src/containers/A-Logger/components/Logger.component.d.ts +1 -1
- package/dist/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.js.map +1 -1
- package/dist/src/decorators/A-Define/Feature/Feature.decorator.d.ts +16 -0
- package/dist/src/decorators/A-Define/Feature/Feature.decorator.js +36 -0
- package/dist/src/decorators/A-Define/Feature/Feature.decorator.js.map +1 -0
- package/dist/src/decorators/A-Define/Feature/Feature.decorator.types.d.ts +8 -0
- package/dist/src/decorators/A-Define/Feature/Feature.decorator.types.js +3 -0
- package/dist/src/decorators/A-Define/Feature/Feature.decorator.types.js.map +1 -0
- package/dist/src/decorators/A-Define/Lifecycle/Lifecycle.decorator.d.ts +14 -0
- package/dist/src/decorators/A-Define/Lifecycle/Lifecycle.decorator.js +24 -0
- package/dist/src/decorators/A-Define/Lifecycle/Lifecycle.decorator.js.map +1 -0
- package/dist/src/decorators/A-Define/Lifecycle/Lifecycle.decorator.types.d.ts +8 -0
- package/dist/src/decorators/A-Define/Lifecycle/Lifecycle.decorator.types.js +3 -0
- package/dist/src/decorators/A-Define/Lifecycle/Lifecycle.decorator.types.js.map +1 -0
- package/dist/src/decorators/A-Define/index.d.ts +7 -0
- package/dist/src/decorators/A-Define/index.js +10 -0
- package/dist/src/decorators/A-Define/index.js.map +1 -0
- package/dist/src/decorators/A-Extend/A-Extend.decorator.d.ts +18 -0
- package/dist/src/decorators/A-Extend/A-Extend.decorator.js +37 -0
- package/dist/src/decorators/A-Extend/A-Extend.decorator.js.map +1 -0
- package/dist/src/decorators/A-Extend/A-Extend.decorator.types.d.ts +21 -0
- package/dist/src/decorators/A-Extend/A-Extend.decorator.types.js +3 -0
- package/dist/src/decorators/A-Extend/A-Extend.decorator.types.js.map +1 -0
- package/dist/src/decorators/A-Feature/A-Feature-Define.decorator.d.ts +16 -0
- package/dist/src/decorators/A-Feature/A-Feature-Define.decorator.js +37 -0
- package/dist/src/decorators/A-Feature/A-Feature-Define.decorator.js.map +1 -0
- package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.d.ts +16 -0
- package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.js +42 -0
- package/dist/src/decorators/A-Feature/A-Feature-Extend.decorator.js.map +1 -0
- package/dist/src/decorators/A-Feature/A-Feature.decorator.types.d.ts +20 -0
- package/dist/src/decorators/A-Feature/A-Feature.decorator.types.js +1 -0
- package/dist/src/decorators/A-Inject/A-Inject.decorator.d.ts +12 -10
- package/dist/src/decorators/A-Inject/A-Inject.decorator.js +16 -26
- 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 +4 -3
- package/dist/src/decorators/A-Stage/A-Stage.decorator.d.ts +12 -0
- package/dist/src/decorators/A-Stage/A-Stage.decorator.js +35 -0
- package/dist/src/decorators/A-Stage/A-Stage.decorator.js.map +1 -0
- package/dist/src/decorators/A-Stage/A-Stage.decorator.types.d.ts +2 -0
- package/dist/src/decorators/A-Stage/A-Stage.decorator.types.js +3 -0
- package/dist/src/decorators/A-Stage/A-Stage.decorator.types.js.map +1 -0
- package/dist/src/global/A-Channel/A-Channel.class.d.ts +18 -0
- package/dist/src/global/A-Channel/A-Channel.class.js +54 -0
- package/dist/src/global/A-Channel/A-Channel.class.js.map +1 -0
- package/dist/src/global/A-Channel/A-Channel.types.d.ts +35 -0
- package/dist/src/global/A-Channel/A-Channel.types.js +3 -0
- package/dist/src/global/A-Channel/A-Channel.types.js.map +1 -0
- package/dist/src/global/A-Component/A-Component.class.d.ts +1 -11
- package/dist/src/global/A-Component/A-Component.class.js +0 -7
- package/dist/src/global/A-Component/A-Component.class.js.map +1 -1
- package/dist/src/global/A-Component/A-Component.meta.d.ts +4 -0
- package/dist/src/global/A-Component/A-Component.meta.js +8 -0
- package/dist/src/global/A-Component/A-Component.meta.js.map +1 -0
- package/dist/src/global/A-Component/A-Component.types.d.ts +18 -0
- package/dist/src/global/A-Component/A-Component.types.js +10 -0
- package/dist/src/global/A-Component/A-Component.types.js.map +1 -0
- package/dist/src/global/A-Concept/A_Concept.class.d.ts +41 -17
- package/dist/src/global/A-Concept/A_Concept.class.js +120 -43
- package/dist/src/global/A-Concept/A_Concept.class.js.map +1 -1
- package/dist/src/global/A-Concept/A_Concept.meta.d.ts +3 -0
- package/dist/src/global/A-Concept/A_Concept.meta.js +9 -0
- package/dist/src/global/A-Concept/A_Concept.meta.js.map +1 -0
- package/dist/src/global/A-Concept/A_Concept.types.d.ts +31 -16
- package/dist/src/global/A-Concept/A_Concept.types.js +25 -0
- package/dist/src/global/A-Concept/A_Concept.types.js.map +1 -1
- package/dist/src/global/A-Container/A-Container.class.d.ts +72 -10
- package/dist/src/global/A-Container/A-Container.class.js +119 -9
- package/dist/src/global/A-Container/A-Container.class.js.map +1 -1
- package/dist/src/global/A-Container/A-Container.meta.d.ts +7 -0
- package/dist/src/global/A-Container/A-Container.meta.js +54 -0
- package/dist/src/global/A-Container/A-Container.meta.js.map +1 -0
- package/dist/src/global/A-Container/A-Container.types.d.ts +31 -0
- package/dist/src/global/A-Container/A-Container.types.js +9 -0
- package/dist/src/global/A-Container/A-Container.types.js.map +1 -0
- package/dist/src/global/A-Context/A-Context.class.d.ts +37 -54
- package/dist/src/global/A-Context/A-Context.class.js +129 -61
- package/dist/src/global/A-Context/A-Context.class.js.map +1 -1
- package/dist/src/global/A-Context/A-Context.types.d.ts +12 -0
- package/dist/src/global/A-Context/A-Context.types.js +1 -0
- package/dist/src/global/A-Context/A-ContextFragment.class.d.ts +12 -0
- package/dist/src/global/A-Context/A-ContextFragment.class.js +19 -0
- package/dist/src/global/A-Context/A-ContextFragment.class.js.map +1 -0
- package/dist/src/global/A-Dependency/A-DependencyReference.class.d.ts +0 -17
- package/dist/src/global/A-Dependency/A-DependencyReference.class.js +47 -65
- package/dist/src/global/A-Dependency/A-DependencyReference.class.js.map +1 -1
- package/dist/src/global/A-Dependency/A-DependencyReference.types.d.ts +0 -55
- package/dist/src/global/A-Dependency/A-DependencyReference.types.js +56 -1
- package/dist/src/global/A-Dependency/A-DependencyReference.types.js.map +1 -1
- package/dist/src/global/A-Entity/A-Entity.class.d.ts +57 -0
- package/dist/src/global/A-Entity/A-Entity.class.js +102 -0
- package/dist/src/global/A-Entity/A-Entity.class.js.map +1 -0
- package/dist/src/global/A-Entity/A-Entity.types.d.ts +13 -0
- package/dist/src/global/A-Entity/A-Entity.types.js +4 -0
- package/dist/src/global/A-Entity/A-Entity.types.js.map +1 -0
- package/dist/src/global/A-Feature/A-Feature.class.d.ts +44 -0
- package/dist/src/global/A-Feature/A-Feature.class.js +125 -0
- package/dist/src/global/A-Feature/A-Feature.class.js.map +1 -0
- package/dist/src/global/A-Feature/A-Feature.types.d.ts +17 -0
- package/dist/src/global/A-Feature/A-Feature.types.js +11 -0
- package/dist/src/global/A-Feature/A-Feature.types.js.map +1 -0
- package/dist/src/global/A-Fragment/A-Fragment.class.d.ts +38 -0
- package/dist/src/global/A-Fragment/A-Fragment.class.js +107 -0
- package/dist/src/global/A-Fragment/A-Fragment.class.js.map +1 -0
- package/dist/src/global/A-Fragment/A-Fragment.types.d.ts +3 -0
- package/dist/src/global/A-Fragment/A-Fragment.types.js +3 -0
- package/dist/src/global/A-Fragment/A-Fragment.types.js.map +1 -0
- package/dist/src/global/A-Meta/A-Meta.class.d.ts +16 -0
- package/dist/src/global/A-Meta/A-Meta.class.js +69 -0
- package/dist/src/global/A-Meta/A-Meta.class.js.map +1 -0
- package/dist/src/global/A-Meta/A-Meta.types.js +2 -0
- package/dist/src/global/A-Meta/A-Meta.types.js.map +1 -0
- package/dist/src/global/A-Scope/A-Scope.class.d.ts +51 -0
- package/dist/src/global/A-Scope/A-Scope.class.js +135 -0
- package/dist/src/global/A-Scope/A-Scope.class.js.map +1 -0
- package/dist/src/global/A-Scope/A-Scope.types.d.ts +32 -0
- package/dist/src/global/A-Scope/A-Scope.types.js +3 -0
- package/dist/src/global/A-Scope/A-Scope.types.js.map +1 -0
- package/dist/src/storage/A_Component.storage.d.ts +10 -0
- package/dist/src/storage/A_Component.storage.js +17 -0
- package/dist/src/storage/A_Component.storage.js.map +1 -0
- package/dist/src/storage/A_Concept.storage.js +2 -2
- package/dist/src/storage/A_Concept.storage.js.map +1 -1
- package/dist/src/storage/A_Container.storage.d.ts +8 -0
- package/dist/src/storage/A_Container.storage.js +17 -0
- package/dist/src/storage/A_Container.storage.js.map +1 -0
- package/dist/src/storage/A_Inject.storage.d.ts +9 -0
- package/dist/src/storage/A_Inject.storage.js +13 -0
- package/dist/src/storage/A_Inject.storage.js.map +1 -0
- package/examples/simple/components/A.component.ts +35 -0
- package/examples/simple/components/B.component.ts +46 -0
- package/examples/simple/concept.ts +49 -12
- package/examples/simple/containers/Main.container.ts +47 -0
- package/examples/simple/context/Fragment_A.context.ts +25 -0
- package/examples/simple/context/Fragment_B.context.ts +19 -0
- package/examples/simple-http-server/components/http-error-handler.component.ts +44 -0
- package/examples/simple-http-server/components/http-request-handler.component.ts +9 -0
- package/examples/simple-http-server/concept.ts +22 -21
- package/examples/simple-http-server/containers/http-server.container.ts +23 -38
- package/examples/simple-http-server/contexts/http-request.context.ts +59 -0
- package/examples/simple-http-server/contexts/http-server.context.types.ts +0 -108
- package/examples/simple-http-server/test.ts +290 -0
- package/index.ts +53 -22
- package/jest.config.ts +1 -3
- package/package.json +4 -7
- package/src/{containers → base}/A-Config/A-Config.container.ts +21 -20
- package/src/{containers/A-Config/A-Config.namespace.ts → base/A-Config/A-Config.context.ts} +12 -5
- package/src/{containers → base}/A-Config/A-Config.types.ts +15 -4
- package/src/{containers → base}/A-Config/components/ConfigReader.component.ts +7 -3
- package/src/{containers → base}/A-Config/components/ENVConfigReader.component.ts +1 -1
- package/src/{containers → base}/A-Config/components/FileConfigReader.component.ts +1 -1
- package/src/base/A-Errors/A-Errors.component.ts +102 -0
- package/src/{containers/A-Errors/A-Errors.namespace.ts → base/A-Errors/A-Errors.context.ts} +24 -39
- package/src/{containers → base}/A-Errors/A-Errors.types.ts +2 -2
- package/src/base/A-Logger/A-Logger.component.ts +169 -0
- package/src/base/A-Logger/A-Logger.types.ts +0 -0
- package/src/constants/A_ConceptLifecycle.constants.ts +9 -9
- package/src/decorators/A-Feature/A-Feature-Define.decorator.ts +57 -0
- package/src/decorators/A-Feature/A-Feature-Extend.decorator.ts +57 -0
- package/src/decorators/A-Feature/A-Feature.decorator.types.ts +56 -0
- package/src/decorators/A-Inject/A-Inject.decorator.ts +64 -53
- package/src/decorators/A-Inject/A-Inject.decorator.types.ts +31 -4
- package/src/decorators/A-Stage/A-Stage.decorator.ts +57 -0
- package/src/decorators/A-Stage/A-Stage.decorator.types.ts +23 -0
- package/src/global/A-Channel/A-Channel.class.ts +48 -0
- package/src/global/A-Channel/A-Channel.types.ts +60 -0
- package/src/global/A-Component/A-Component.class.ts +1 -29
- package/src/global/A-Component/A-Component.meta.ts +9 -0
- package/src/global/A-Component/A-Component.types.ts +40 -0
- package/src/global/A-Concept/A_Concept.class.ts +160 -66
- package/src/global/A-Concept/A_Concept.meta.ts +9 -0
- package/src/global/A-Concept/A_Concept.types.ts +45 -10
- package/src/global/A-Container/A-Container.class.ts +172 -22
- package/src/global/A-Container/A-Container.meta.ts +80 -0
- package/src/global/A-Container/A-Container.types.ts +40 -0
- package/src/global/A-Context/A-Context.class.ts +233 -130
- package/src/global/A-Context/A-Context.types.ts +15 -0
- package/src/global/A-Dependency/A-DependencyReference.class.ts +61 -61
- package/src/global/A-Dependency/A-DependencyReference.types.ts +56 -56
- package/src/global/A-Entity/A-Entity.class.ts +141 -0
- package/src/global/A-Entity/A-Entity.types.ts +17 -0
- package/src/global/A-Feature/A-Feature.class.ts +156 -0
- package/src/global/A-Feature/A-Feature.types.ts +20 -0
- package/src/global/{A-Namespace/A_Namespace.class.ts → A-Fragment/A-Fragment.class.ts} +24 -30
- package/src/global/A-Fragment/A-Fragment.types.ts +6 -0
- package/src/global/A-Meta/A-Meta.class.ts +96 -0
- package/src/global/A-Meta/A-Meta.types.ts +0 -0
- package/src/global/A-Scope/A-Scope.class.ts +211 -0
- package/src/global/A-Scope/A-Scope.types.ts +37 -0
- package/tsconfig.json +1 -3
- package/examples/sdk/concept.ts +0 -24
- package/examples/sdk/orders.api.ts +0 -21
- package/examples/sdk/users.api.ts +0 -21
- package/examples/simple-http-server/containers/http-server.controller.ts +0 -24
- package/examples/simple-http-server/containers/http-server.router.ts +0 -23
- package/examples/simple-http-server/contexts/http-server.namespace.ts +0 -36
- package/src/containers/A-Errors/A-Errors.container.ts +0 -14
- package/src/containers/A-Logger/A-Logger.container.ts +0 -22
- package/src/containers/A-Logger/A-Logger.namespace.ts +0 -26
- package/src/containers/A-Logger/components/Logger.component.ts +0 -169
- package/src/decorators/A-ConceptLifecycle/A-ConceptLifecycle.decorator.types.ts +0 -46
- package/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.ts +0 -55
- package/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.types.ts +0 -20
- package/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.ts +0 -62
- package/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.types.ts +0 -28
- package/src/decorators/A-ConceptLifecycle/index.ts +0 -9
- package/src/decorators/A-Feature/A-Feature.decorator.ts +0 -13
- package/src/decorators/A_Lazy.decorator.ts +0 -31
- package/src/global/A-Namespace/A_Namespace.types.ts +0 -24
- package/src/storage/A_Concept.storage.ts +0 -45
- /package/{src/containers/A-Logger/A-Logger.types.ts → dist/src/base/A-Logger/A-Logger.types.d.ts} +0 -0
- /package/{src/decorators/A_ConceptMethods.decorator.ts → dist/src/global/A-Meta/A-Meta.types.d.ts} +0 -0
|
@@ -1,108 +0,0 @@
|
|
|
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,290 @@
|
|
|
1
|
+
|
|
2
|
+
function Inject() {
|
|
3
|
+
return function (target: any, key: string, index: number) {
|
|
4
|
+
console.log('Inject', target, key, index);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Allows to define a new lifecycle method
|
|
11
|
+
*/
|
|
12
|
+
function Define(
|
|
13
|
+
...args: any[]
|
|
14
|
+
)
|
|
15
|
+
function Define(
|
|
16
|
+
name: string,
|
|
17
|
+
...args: any[]
|
|
18
|
+
) {
|
|
19
|
+
return function (target: any, key: string, descriptor: PropertyDescriptor) {
|
|
20
|
+
Architecture
|
|
21
|
+
.register(target.constructor, {
|
|
22
|
+
name
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class User {
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class CRUDController {
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
constructor(
|
|
38
|
+
// Context Injection to adjust behavior
|
|
39
|
+
// @Inject(User) user
|
|
40
|
+
) {
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
post(
|
|
45
|
+
// Runtime injection to get the request object or any other
|
|
46
|
+
@Inject() request: ControllerRequest,
|
|
47
|
+
) {
|
|
48
|
+
request.user;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
class StatsController {
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
// This method is context independent and "extends" the behavior of the parent Class (without inheritance)
|
|
56
|
+
// Here you can define what to expect from the previous step
|
|
57
|
+
// Basically here we can extend the behavior of the parent class
|
|
58
|
+
@App.Lifecycle.onRequest()
|
|
59
|
+
onRequest(
|
|
60
|
+
|
|
61
|
+
) {
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
// This method is context dependent
|
|
68
|
+
count(
|
|
69
|
+
@Inject() request: ControllerRequest,
|
|
70
|
+
) {
|
|
71
|
+
request.user;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
class ControllerRequest {
|
|
76
|
+
|
|
77
|
+
constructor(
|
|
78
|
+
public user: User
|
|
79
|
+
) {
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class DependencyResolver {
|
|
87
|
+
resolve<T extends { new(...args: any[]): any }>(
|
|
88
|
+
target: any,
|
|
89
|
+
|
|
90
|
+
): T {
|
|
91
|
+
return new target();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class Architecture {
|
|
98
|
+
|
|
99
|
+
private static instance: Architecture;
|
|
100
|
+
|
|
101
|
+
private definitions: Map<{ new(...args: any[]): any }, {
|
|
102
|
+
lifecycle: Map<string, Function>
|
|
103
|
+
}> = new Map();
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
private constructor() {
|
|
107
|
+
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
static getInstance() {
|
|
112
|
+
if (!this.instance) {
|
|
113
|
+
this.instance = new Architecture();
|
|
114
|
+
}
|
|
115
|
+
return this.instance;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
static register(
|
|
120
|
+
constructor: { new(...args: any[]): any },
|
|
121
|
+
config: {
|
|
122
|
+
name: string
|
|
123
|
+
}
|
|
124
|
+
) {
|
|
125
|
+
const instance = this.getInstance();
|
|
126
|
+
|
|
127
|
+
instance.definitions.set(constructor, {
|
|
128
|
+
lifecycle: new Map()
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
static getLifecycle(
|
|
134
|
+
constructor: { new(...args: any[]): any }
|
|
135
|
+
) {
|
|
136
|
+
const instance = this.getInstance();
|
|
137
|
+
|
|
138
|
+
return instance.definitions.get(constructor)?.lifecycle;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
class Container {
|
|
145
|
+
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
// Concept
|
|
151
|
+
// - run
|
|
152
|
+
// - build
|
|
153
|
+
|
|
154
|
+
// Container #1
|
|
155
|
+
// - start
|
|
156
|
+
// - stop
|
|
157
|
+
|
|
158
|
+
// Container #2
|
|
159
|
+
// - build
|
|
160
|
+
// - request
|
|
161
|
+
// - response
|
|
162
|
+
// - error
|
|
163
|
+
|
|
164
|
+
// Container #3
|
|
165
|
+
// - start
|
|
166
|
+
// - stop
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
interface Feature<
|
|
171
|
+
_LifecycleMethodName extends string,
|
|
172
|
+
_RuntimeContext extends any,
|
|
173
|
+
> {
|
|
174
|
+
name: _LifecycleMethodName;
|
|
175
|
+
context: new (...args: any[]) => _RuntimeContext; // The class constructor for the context
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
class Concept<
|
|
182
|
+
_LifecycleMethodNames extends string,
|
|
183
|
+
_RuntimeContext extends any,
|
|
184
|
+
|
|
185
|
+
// _FeaturesDefinition extends Feature<_LifecycleMethodNames, _RuntimeContext>[],
|
|
186
|
+
_FeaturesDefinition2 extends Record<_LifecycleMethodNames, new (...args: any[]) => _RuntimeContext>
|
|
187
|
+
> {
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
// private steps!: _FeaturesDefinition
|
|
191
|
+
|
|
192
|
+
constructor(props: {
|
|
193
|
+
// features: _FeaturesDefinition,
|
|
194
|
+
exports: _FeaturesDefinition2
|
|
195
|
+
context: [],
|
|
196
|
+
import: any[]
|
|
197
|
+
}) {
|
|
198
|
+
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// async resolve(): Promise<{
|
|
202
|
+
// [K in _FeaturesDefinition[number]['name']]: (
|
|
203
|
+
// context: InstanceType<
|
|
204
|
+
// Extract<_FeaturesDefinition[number], { name: K }>['context']
|
|
205
|
+
// >
|
|
206
|
+
// ) => void;
|
|
207
|
+
// }> {
|
|
208
|
+
// return {} as any
|
|
209
|
+
// }
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
async resolve2(): Promise<{
|
|
213
|
+
[K in keyof _FeaturesDefinition2]: (
|
|
214
|
+
context: InstanceType<
|
|
215
|
+
_FeaturesDefinition2[K]
|
|
216
|
+
>
|
|
217
|
+
) => void;
|
|
218
|
+
}> {
|
|
219
|
+
return {} as any
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
class App extends Container {
|
|
226
|
+
|
|
227
|
+
server: any;
|
|
228
|
+
components: any[] = [];
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
constructor(components: any[]) {
|
|
232
|
+
super();
|
|
233
|
+
// this.server = new Server();
|
|
234
|
+
|
|
235
|
+
this.components = components;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
static get Lifecycle() {
|
|
239
|
+
return {
|
|
240
|
+
onRequest: (...args: any[]) => Define('onRequest', ...args)
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// The container has a set of lifecycle methods that can be used to extend the behavior by adding new methods
|
|
245
|
+
// Define Decorator allows to create a custom lifecycle attached to the class.
|
|
246
|
+
// So any other classes injected here will be able to use the lifecycle methods
|
|
247
|
+
@Define()
|
|
248
|
+
onRequest(request: any) {
|
|
249
|
+
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
class startContext {
|
|
255
|
+
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
const myConcept = new Concept(
|
|
261
|
+
{
|
|
262
|
+
exports: {
|
|
263
|
+
start: startContext
|
|
264
|
+
},
|
|
265
|
+
context: [],
|
|
266
|
+
import: [
|
|
267
|
+
// We say that concept has User Entity
|
|
268
|
+
User,
|
|
269
|
+
|
|
270
|
+
// We say that concept has an APP with CRUDController
|
|
271
|
+
new App([
|
|
272
|
+
//
|
|
273
|
+
CRUDController,
|
|
274
|
+
// new CRUDController(),
|
|
275
|
+
])
|
|
276
|
+
]
|
|
277
|
+
}
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
(async () => {
|
|
281
|
+
// const target2 = await myConcept
|
|
282
|
+
// .resolve2();
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
// target2.start()
|
|
286
|
+
|
|
287
|
+
})()
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
|
package/index.ts
CHANGED
|
@@ -1,33 +1,64 @@
|
|
|
1
|
+
|
|
2
|
+
// =================================================================================================
|
|
3
|
+
// ============================= Export Framework Components =======================================
|
|
4
|
+
// =================================================================================================
|
|
5
|
+
// ---------------------- Major Components ----------------------
|
|
6
|
+
export { A_Context } from './src/global/A-Context/A-Context.class';
|
|
7
|
+
export * from './src/global/A-Context/A-Context.types';
|
|
8
|
+
|
|
1
9
|
export { A_Concept } from './src/global/A-Concept/A_Concept.class';
|
|
10
|
+
export { A_ConceptMeta } from './src/global/A-Concept/A_Concept.meta';
|
|
2
11
|
export * from './src/global/A-Concept/A_Concept.types';
|
|
12
|
+
|
|
3
13
|
export { A_Container } from './src/global/A-Container/A-Container.class';
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
14
|
+
export { A_ContainerMeta } from './src/global/A-Container/A-Container.meta';
|
|
15
|
+
export * from './src/global/A-Container/A-Container.class';
|
|
16
|
+
|
|
17
|
+
export { A_Component } from './src/global/A-Component/A-Component.class';
|
|
18
|
+
export { A_ComponentMeta } from './src/global/A-Component/A-Component.meta';
|
|
19
|
+
export * from './src/global/A-Component/A-Component.types';
|
|
20
|
+
|
|
21
|
+
export { A_Entity } from './src/global/A-Entity/A-Entity.class';
|
|
22
|
+
export * from './src/global/A-Entity/A-Entity.types';
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
// ---------------------- Common Components ----------------------
|
|
26
|
+
export { A_Feature } from './src/global/A-Feature/A-Feature.class';
|
|
27
|
+
export * from './src/global/A-Feature/A-Feature.types';
|
|
28
|
+
|
|
29
|
+
export { A_Scope } from './src/global/A-Scope/A-Scope.class';
|
|
30
|
+
export * from './src/global/A-Scope/A-Scope.types';
|
|
31
|
+
|
|
32
|
+
export { A_Meta } from './src/global/A-Meta/A-Meta.class';
|
|
33
|
+
// export * from './src/global/A-Meta/A-Meta.types';
|
|
34
|
+
|
|
35
|
+
export { A_Fragment } from './src/global/A-Fragment/A-Fragment.class';
|
|
36
|
+
export * from './src/global/A-Fragment/A-Fragment.types';
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
// =================================================================================================
|
|
40
|
+
// =============================== Export Decorators ============================================
|
|
41
|
+
// =================================================================================================
|
|
42
|
+
|
|
7
43
|
export { A_Inject } from './src/decorators/A-Inject/A-Inject.decorator';
|
|
8
44
|
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';
|
|
15
45
|
|
|
16
46
|
|
|
17
|
-
export * from './src/containers/A-Config/A-Config.namespace';
|
|
18
|
-
export * from './src/containers/A-Config/A-Config.container';
|
|
19
|
-
export * from './src/containers/A-Config/A-Config.types';
|
|
20
|
-
export * from './src/containers/A-Config/components/ConfigReader.component';
|
|
21
|
-
export * from './src/containers/A-Config/components/ENVConfigReader.component';
|
|
22
|
-
export * from './src/containers/A-Config/components/FileConfigReader.component';
|
|
23
47
|
|
|
24
48
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
49
|
+
// =================================================================================================
|
|
50
|
+
// =============================== Export Base Entities ============================================
|
|
51
|
+
// =================================================================================================
|
|
52
|
+
export { A_ConfigLoader } from './src/base/A-Config/A-Config.container';
|
|
53
|
+
export { A_Config } from './src/base/A-Config/A-Config.context';
|
|
54
|
+
export { ConfigReader } from './src/base/A-Config/components/ConfigReader.component';
|
|
55
|
+
export { ENVConfigReader } from './src/base/A-Config/components/ENVConfigReader.component';
|
|
56
|
+
export { FileConfigReader } from './src/base/A-Config/components/FileConfigReader.component';
|
|
57
|
+
export * from './src/base/A-Config/A-Config.types';
|
|
28
58
|
|
|
59
|
+
export * from './src/base/A-Logger/A-Logger.component';
|
|
60
|
+
// export * from './src/base/A-Logger/A-Logger.types';
|
|
29
61
|
|
|
30
|
-
export
|
|
31
|
-
export
|
|
32
|
-
|
|
33
|
-
export * from './src/containers/A-Logger/components/Logger.component';
|
|
62
|
+
export { A_ErrorsManager } from './src/base/A-Errors/A-Errors.component';
|
|
63
|
+
export { A_Errors } from './src/base/A-Errors/A-Errors.context';
|
|
64
|
+
export * from './src/base/A-Errors/A-Errors.types';
|
package/jest.config.ts
CHANGED
|
@@ -13,9 +13,7 @@ const config: Config.InitialOptions = {
|
|
|
13
13
|
"@adaas/a-concept/types/(.*)": ["<rootDir>/src/types/$1"],
|
|
14
14
|
"@adaas/a-concept/helpers/(.*)": ["<rootDir>/src/helpers/$1"],
|
|
15
15
|
"@adaas/a-concept/decorators/(.*)": ["<rootDir>/src/decorators/$1"],
|
|
16
|
-
"@adaas/a-concept/
|
|
17
|
-
"@adaas/a-concept/providers/(.*)": ["<rootDir>/src/providers/$1"],
|
|
18
|
-
"@adaas/a-concept/modules/(.*)": ["<rootDir>/src/modules/$1"],
|
|
16
|
+
"@adaas/a-concept/base/(.*)": ["<rootDir>/src/base/$1"],
|
|
19
17
|
}
|
|
20
18
|
|
|
21
19
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaas/a-concept",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "A-Concept is a framework to build new Applications within or outside the ADAAS ecosystem. This framework is designed to be modular structure regardless environment and program goal.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -13,12 +13,8 @@
|
|
|
13
13
|
"node_modules"
|
|
14
14
|
],
|
|
15
15
|
"watch": [
|
|
16
|
-
"config",
|
|
17
|
-
"constants",
|
|
18
16
|
"src",
|
|
19
|
-
"
|
|
20
|
-
"db",
|
|
21
|
-
"shared"
|
|
17
|
+
"examples"
|
|
22
18
|
],
|
|
23
19
|
"exec": "node -r tsconfig-paths/register -r ts-node/register ",
|
|
24
20
|
"ext": "ts, js"
|
|
@@ -31,7 +27,8 @@
|
|
|
31
27
|
"version": "echo git add .",
|
|
32
28
|
"postversion": "git push --no-verify && git push --tags --no-verify && echo \"\n======Version Pushed Successfully=====\n\" ",
|
|
33
29
|
"echo-version": "echo $npm_package_version",
|
|
34
|
-
"build": "tsc --declaration --project tsconfig.json && tscpaths -p tsconfig.json -s ./ -o ./dist && rm -r ./dist/tests"
|
|
30
|
+
"build": "tsc --declaration --project tsconfig.json && tscpaths -p tsconfig.json -s ./ -o ./dist && rm -r ./dist/tests",
|
|
31
|
+
"test:simple": "nodemon ./examples/simple/concept.ts"
|
|
35
32
|
},
|
|
36
33
|
"repository": {
|
|
37
34
|
"type": "git",
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { A_Container } from "@adaas/a-concept/global/A-Container/A-Container.class";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { ConfigReader } from "./components/ConfigReader.component";
|
|
3
|
+
import { A_Logger } from "../A-Logger/A-Logger.component";
|
|
4
|
+
import { A_Inject } from "@adaas/a-concept/decorators/A-Inject/A-Inject.decorator";
|
|
4
5
|
import { A_Polyfills } from "@adaas/a-utils";
|
|
6
|
+
import { A_Context } from "@adaas/a-concept/global/A-Context/A-Context.class";
|
|
5
7
|
import { FileConfigReader } from "./components/FileConfigReader.component";
|
|
6
8
|
import { ENVConfigReader } from "./components/ENVConfigReader.component";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
+
import { A_Scope } from "@adaas/a-concept/global/A-Scope/A-Scope.class";
|
|
10
|
+
|
|
9
11
|
|
|
10
12
|
|
|
11
13
|
|
|
12
|
-
// @A_Injectable({
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
export class A_ConfigInitializer extends A_Container<A_Config> {
|
|
15
|
+
export class A_ConfigLoader extends A_Container<['load', 'read']> {
|
|
16
16
|
|
|
17
17
|
private reader!: ConfigReader
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
})
|
|
20
|
+
|
|
22
21
|
async identifyReader(
|
|
23
|
-
|
|
22
|
+
@A_Inject(A_Scope) scope: A_Scope,
|
|
23
|
+
@A_Inject(A_Logger) logger: A_Logger
|
|
24
24
|
) {
|
|
25
25
|
|
|
26
26
|
// OR Inject the logger by calling Context Provider
|
|
@@ -30,17 +30,17 @@ export class A_ConfigInitializer extends A_Container<A_Config> {
|
|
|
30
30
|
|
|
31
31
|
switch (true) {
|
|
32
32
|
|
|
33
|
-
case A_Context.environment === 'server' && !!fs.existsSync(`${
|
|
34
|
-
this.reader =
|
|
33
|
+
case A_Context.environment === 'server' && !!fs.existsSync(`${scope.name}.conf.json`):
|
|
34
|
+
this.reader = scope.resolve(FileConfigReader);
|
|
35
35
|
break;
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
case A_Context.environment === 'server': !fs.existsSync(`${
|
|
39
|
-
this.reader =
|
|
38
|
+
case A_Context.environment === 'server': !fs.existsSync(`${scope.name}.conf.json`)
|
|
39
|
+
this.reader = scope.resolve(ENVConfigReader);
|
|
40
40
|
break;
|
|
41
41
|
|
|
42
42
|
case A_Context.environment === 'browser':
|
|
43
|
-
this.reader =
|
|
43
|
+
this.reader = scope.resolve(ENVConfigReader);
|
|
44
44
|
break;
|
|
45
45
|
|
|
46
46
|
default:
|
|
@@ -48,13 +48,14 @@ export class A_ConfigInitializer extends A_Container<A_Config> {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
@A_Load({})
|
|
53
51
|
async readVariables() {
|
|
54
|
-
const config = await this.reader.read(this.namespace.CONFIG_PROPERTIES);
|
|
52
|
+
// const config = await this.reader.read(this.namespace.CONFIG_PROPERTIES);
|
|
55
53
|
|
|
56
|
-
this.namespace.set(config);
|
|
57
|
-
}
|
|
58
54
|
|
|
55
|
+
}
|
|
59
56
|
|
|
60
57
|
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
const foo = new A_ConfigLoader({});
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A_CommonHelper, A_TYPES__Required } from "@adaas/a-utils";
|
|
2
2
|
import { A_TYPES__ConfigContainerConstructor } from "./A-Config.types";
|
|
3
|
+
import { A_Fragment } from "@adaas/a-concept/global/A-Fragment/A-Fragment.class";
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
export class A_Config<
|
|
6
7
|
T extends string = any
|
|
7
|
-
> extends
|
|
8
|
+
> extends A_Fragment {
|
|
9
|
+
|
|
10
|
+
config: A_TYPES__ConfigContainerConstructor<T>;
|
|
8
11
|
|
|
9
12
|
// Custom properties
|
|
10
13
|
private VARIABLES: Map<string, any> = new Map<string, any>();
|
|
14
|
+
|
|
11
15
|
CONFIG_PROPERTIES: T[] = [];
|
|
12
16
|
|
|
13
17
|
protected DEFAULT_ALLOWED_TO_READ_PROPERTIES = [
|
|
@@ -18,13 +22,16 @@ export class A_Config<
|
|
|
18
22
|
|
|
19
23
|
|
|
20
24
|
constructor(
|
|
21
|
-
config: A_TYPES__ConfigContainerConstructor<T>
|
|
25
|
+
config: A_TYPES__Required<Partial<A_TYPES__ConfigContainerConstructor<T>>, ['variables']>
|
|
22
26
|
) {
|
|
23
27
|
super(config);
|
|
24
28
|
|
|
25
|
-
|
|
29
|
+
this.config = A_CommonHelper.deepCloneAndMerge<A_TYPES__ConfigContainerConstructor<T>>(config as any, {
|
|
30
|
+
name: this.name,
|
|
31
|
+
defaults: {} as Record<T, any>
|
|
32
|
+
});
|
|
26
33
|
|
|
27
|
-
this.CONFIG_PROPERTIES =
|
|
34
|
+
this.CONFIG_PROPERTIES = this.config.variables ? this.config.variables : [];
|
|
28
35
|
}
|
|
29
36
|
|
|
30
37
|
|
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A_TYPES__FragmentConstructor } from "@adaas/a-concept/global/A-Fragment/A-Fragment.types";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export enum A_TYPES__ConfigFeature {
|
|
5
|
+
|
|
6
|
+
}
|
|
7
|
+
|
|
2
8
|
|
|
3
9
|
export type A_TYPES__ConfigContainerConstructor<T extends string> = {
|
|
10
|
+
|
|
4
11
|
/**
|
|
5
|
-
*
|
|
12
|
+
* Allows to define the names of variable to be loaded
|
|
6
13
|
*/
|
|
7
14
|
variables?: Array<T>
|
|
15
|
+
|
|
8
16
|
/**
|
|
9
17
|
* Allows to set the default values for the variables
|
|
10
18
|
*/
|
|
11
|
-
defaults?:
|
|
19
|
+
defaults?: {
|
|
20
|
+
[key in T]?: any
|
|
21
|
+
}
|
|
22
|
+
|
|
12
23
|
// credentials?: {
|
|
13
24
|
// /**
|
|
14
25
|
// * Api Credentials Client ID to authenticate the SDK
|
|
@@ -23,7 +34,7 @@ export type A_TYPES__ConfigContainerConstructor<T extends string> = {
|
|
|
23
34
|
// client_secret: string
|
|
24
35
|
|
|
25
36
|
// }
|
|
26
|
-
} &
|
|
37
|
+
} & A_TYPES__FragmentConstructor;
|
|
27
38
|
|
|
28
39
|
|
|
29
40
|
export type A_TYPES__ConfigContainer_DefaultProperties = 'CONFIG_SDK_VALIDATION'
|