@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
package/dist/index.js
CHANGED
|
@@ -14,38 +14,70 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.A_Errors = exports.A_ErrorsManager = exports.FileConfigReader = exports.ENVConfigReader = exports.ConfigReader = exports.A_Config = exports.A_ConfigLoader = exports.A_Inject = exports.A_Fragment = exports.A_Meta = exports.A_Scope = exports.A_Feature = exports.A_Entity = exports.A_ComponentMeta = exports.A_Component = exports.A_ContainerMeta = exports.A_Container = exports.A_ConceptMeta = exports.A_Concept = exports.A_Context = void 0;
|
|
18
|
+
// =================================================================================================
|
|
19
|
+
// ============================= Export Framework Components =======================================
|
|
20
|
+
// =================================================================================================
|
|
21
|
+
// ---------------------- Major Components ----------------------
|
|
22
|
+
var A_Context_class_1 = require("./src/global/A-Context/A-Context.class");
|
|
23
|
+
Object.defineProperty(exports, "A_Context", { enumerable: true, get: function () { return A_Context_class_1.A_Context; } });
|
|
24
|
+
__exportStar(require("./src/global/A-Context/A-Context.types"), exports);
|
|
18
25
|
var A_Concept_class_1 = require("./src/global/A-Concept/A_Concept.class");
|
|
19
26
|
Object.defineProperty(exports, "A_Concept", { enumerable: true, get: function () { return A_Concept_class_1.A_Concept; } });
|
|
27
|
+
var A_Concept_meta_1 = require("./src/global/A-Concept/A_Concept.meta");
|
|
28
|
+
Object.defineProperty(exports, "A_ConceptMeta", { enumerable: true, get: function () { return A_Concept_meta_1.A_ConceptMeta; } });
|
|
20
29
|
__exportStar(require("./src/global/A-Concept/A_Concept.types"), exports);
|
|
21
30
|
var A_Container_class_1 = require("./src/global/A-Container/A-Container.class");
|
|
22
31
|
Object.defineProperty(exports, "A_Container", { enumerable: true, get: function () { return A_Container_class_1.A_Container; } });
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
var A_Container_meta_1 = require("./src/global/A-Container/A-Container.meta");
|
|
33
|
+
Object.defineProperty(exports, "A_ContainerMeta", { enumerable: true, get: function () { return A_Container_meta_1.A_ContainerMeta; } });
|
|
34
|
+
__exportStar(require("./src/global/A-Container/A-Container.class"), exports);
|
|
35
|
+
var A_Component_class_1 = require("./src/global/A-Component/A-Component.class");
|
|
36
|
+
Object.defineProperty(exports, "A_Component", { enumerable: true, get: function () { return A_Component_class_1.A_Component; } });
|
|
37
|
+
var A_Component_meta_1 = require("./src/global/A-Component/A-Component.meta");
|
|
38
|
+
Object.defineProperty(exports, "A_ComponentMeta", { enumerable: true, get: function () { return A_Component_meta_1.A_ComponentMeta; } });
|
|
39
|
+
__exportStar(require("./src/global/A-Component/A-Component.types"), exports);
|
|
40
|
+
var A_Entity_class_1 = require("./src/global/A-Entity/A-Entity.class");
|
|
41
|
+
Object.defineProperty(exports, "A_Entity", { enumerable: true, get: function () { return A_Entity_class_1.A_Entity; } });
|
|
42
|
+
__exportStar(require("./src/global/A-Entity/A-Entity.types"), exports);
|
|
43
|
+
// ---------------------- Common Components ----------------------
|
|
44
|
+
var A_Feature_class_1 = require("./src/global/A-Feature/A-Feature.class");
|
|
45
|
+
Object.defineProperty(exports, "A_Feature", { enumerable: true, get: function () { return A_Feature_class_1.A_Feature; } });
|
|
46
|
+
__exportStar(require("./src/global/A-Feature/A-Feature.types"), exports);
|
|
47
|
+
var A_Scope_class_1 = require("./src/global/A-Scope/A-Scope.class");
|
|
48
|
+
Object.defineProperty(exports, "A_Scope", { enumerable: true, get: function () { return A_Scope_class_1.A_Scope; } });
|
|
49
|
+
__exportStar(require("./src/global/A-Scope/A-Scope.types"), exports);
|
|
50
|
+
var A_Meta_class_1 = require("./src/global/A-Meta/A-Meta.class");
|
|
51
|
+
Object.defineProperty(exports, "A_Meta", { enumerable: true, get: function () { return A_Meta_class_1.A_Meta; } });
|
|
52
|
+
// export * from './src/global/A-Meta/A-Meta.types';
|
|
53
|
+
var A_Fragment_class_1 = require("./src/global/A-Fragment/A-Fragment.class");
|
|
54
|
+
Object.defineProperty(exports, "A_Fragment", { enumerable: true, get: function () { return A_Fragment_class_1.A_Fragment; } });
|
|
55
|
+
__exportStar(require("./src/global/A-Fragment/A-Fragment.types"), exports);
|
|
56
|
+
// =================================================================================================
|
|
57
|
+
// =============================== Export Decorators ============================================
|
|
58
|
+
// =================================================================================================
|
|
27
59
|
var A_Inject_decorator_1 = require("./src/decorators/A-Inject/A-Inject.decorator");
|
|
28
60
|
Object.defineProperty(exports, "A_Inject", { enumerable: true, get: function () { return A_Inject_decorator_1.A_Inject; } });
|
|
29
61
|
__exportStar(require("./src/decorators/A-Inject/A-Inject.decorator.types"), exports);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var
|
|
34
|
-
Object.defineProperty(exports, "
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
__exportStar(require("./src/
|
|
44
|
-
__exportStar(require("./src/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
__exportStar(require("./src/
|
|
62
|
+
// =================================================================================================
|
|
63
|
+
// =============================== Export Base Entities ============================================
|
|
64
|
+
// =================================================================================================
|
|
65
|
+
var A_Config_container_1 = require("./src/base/A-Config/A-Config.container");
|
|
66
|
+
Object.defineProperty(exports, "A_ConfigLoader", { enumerable: true, get: function () { return A_Config_container_1.A_ConfigLoader; } });
|
|
67
|
+
var A_Config_context_1 = require("./src/base/A-Config/A-Config.context");
|
|
68
|
+
Object.defineProperty(exports, "A_Config", { enumerable: true, get: function () { return A_Config_context_1.A_Config; } });
|
|
69
|
+
var ConfigReader_component_1 = require("./src/base/A-Config/components/ConfigReader.component");
|
|
70
|
+
Object.defineProperty(exports, "ConfigReader", { enumerable: true, get: function () { return ConfigReader_component_1.ConfigReader; } });
|
|
71
|
+
var ENVConfigReader_component_1 = require("./src/base/A-Config/components/ENVConfigReader.component");
|
|
72
|
+
Object.defineProperty(exports, "ENVConfigReader", { enumerable: true, get: function () { return ENVConfigReader_component_1.ENVConfigReader; } });
|
|
73
|
+
var FileConfigReader_component_1 = require("./src/base/A-Config/components/FileConfigReader.component");
|
|
74
|
+
Object.defineProperty(exports, "FileConfigReader", { enumerable: true, get: function () { return FileConfigReader_component_1.FileConfigReader; } });
|
|
75
|
+
__exportStar(require("./src/base/A-Config/A-Config.types"), exports);
|
|
76
|
+
__exportStar(require("./src/base/A-Logger/A-Logger.component"), exports);
|
|
77
|
+
// export * from './src/base/A-Logger/A-Logger.types';
|
|
78
|
+
var A_Errors_component_1 = require("./src/base/A-Errors/A-Errors.component");
|
|
79
|
+
Object.defineProperty(exports, "A_ErrorsManager", { enumerable: true, get: function () { return A_Errors_component_1.A_ErrorsManager; } });
|
|
80
|
+
var A_Errors_context_1 = require("./src/base/A-Errors/A-Errors.context");
|
|
81
|
+
Object.defineProperty(exports, "A_Errors", { enumerable: true, get: function () { return A_Errors_context_1.A_Errors; } });
|
|
82
|
+
__exportStar(require("./src/base/A-Errors/A-Errors.types"), exports);
|
|
51
83
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,oGAAoG;AACpG,oGAAoG;AACpG,oGAAoG;AACpG,iEAAiE;AACjE,0EAAmE;AAA1D,4GAAA,SAAS,OAAA;AAClB,yEAAuD;AAEvD,0EAAmE;AAA1D,4GAAA,SAAS,OAAA;AAClB,wEAAsE;AAA7D,+GAAA,aAAa,OAAA;AACtB,yEAAuD;AAEvD,gFAAyE;AAAhE,gHAAA,WAAW,OAAA;AACpB,8EAA4E;AAAnE,mHAAA,eAAe,OAAA;AACxB,6EAA2D;AAE3D,gFAAyE;AAAhE,gHAAA,WAAW,OAAA;AACpB,8EAA4E;AAAnE,mHAAA,eAAe,OAAA;AACxB,6EAA2D;AAE3D,uEAAgE;AAAvD,0GAAA,QAAQ,OAAA;AACjB,uEAAqD;AAGrD,kEAAkE;AAClE,0EAAmE;AAA1D,4GAAA,SAAS,OAAA;AAClB,yEAAuD;AAEvD,oEAA6D;AAApD,wGAAA,OAAO,OAAA;AAChB,qEAAmD;AAEnD,iEAA0D;AAAjD,sGAAA,MAAM,OAAA;AACf,oDAAoD;AAEpD,6EAAsE;AAA7D,8GAAA,UAAU,OAAA;AACnB,2EAAyD;AAGzD,oGAAoG;AACpG,iGAAiG;AACjG,oGAAoG;AAEpG,mFAAwE;AAA/D,8GAAA,QAAQ,OAAA;AACjB,qFAAmE;AAKnE,oGAAoG;AACpG,oGAAoG;AACpG,oGAAoG;AACpG,6EAAwE;AAA/D,oHAAA,cAAc,OAAA;AACvB,yEAAgE;AAAvD,4GAAA,QAAQ,OAAA;AACjB,gGAAqF;AAA5E,sHAAA,YAAY,OAAA;AACrB,sGAA2F;AAAlF,4HAAA,eAAe,OAAA;AACxB,wGAA6F;AAApF,8HAAA,gBAAgB,OAAA;AACzB,qEAAmD;AAEnD,yEAAuD;AACvD,sDAAsD;AAEtD,6EAAyE;AAAhE,qHAAA,eAAe,OAAA;AACxB,yEAAgE;AAAvD,4GAAA,QAAQ,OAAA;AACjB,qEAAmD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { A_Container } from "../../global/A-Container/A-Container.class";
|
|
2
|
+
import { A_Logger } from "../A-Logger/A-Logger.component";
|
|
3
|
+
import { A_Scope } from "../../global/A-Scope/A-Scope.class";
|
|
4
|
+
export declare class A_ConfigLoader extends A_Container<['load', 'read']> {
|
|
5
|
+
private reader;
|
|
6
|
+
identifyReader(scope: A_Scope, logger: A_Logger): Promise<void>;
|
|
7
|
+
readVariables(): Promise<void>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
9
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
10
|
+
};
|
|
11
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
17
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.A_ConfigLoader = void 0;
|
|
22
|
+
const A_Container_class_1 = require("../../global/A-Container/A-Container.class");
|
|
23
|
+
const A_Logger_component_1 = require("../A-Logger/A-Logger.component");
|
|
24
|
+
const A_Inject_decorator_1 = require("../../decorators/A-Inject/A-Inject.decorator");
|
|
25
|
+
const a_utils_1 = require("@adaas/a-utils");
|
|
26
|
+
const A_Context_class_1 = require("../../global/A-Context/A-Context.class");
|
|
27
|
+
const FileConfigReader_component_1 = require("./components/FileConfigReader.component");
|
|
28
|
+
const ENVConfigReader_component_1 = require("./components/ENVConfigReader.component");
|
|
29
|
+
const A_Scope_class_1 = require("../../global/A-Scope/A-Scope.class");
|
|
30
|
+
class A_ConfigLoader extends A_Container_class_1.A_Container {
|
|
31
|
+
identifyReader(scope, logger) {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
// OR Inject the logger by calling Context Provider
|
|
34
|
+
// const logger2 = await this.CP.resolve(A_LoggerContext);
|
|
35
|
+
const fs = yield a_utils_1.A_Polyfills.fs();
|
|
36
|
+
switch (true) {
|
|
37
|
+
case A_Context_class_1.A_Context.environment === 'server' && !!fs.existsSync(`${scope.name}.conf.json`):
|
|
38
|
+
this.reader = scope.resolve(FileConfigReader_component_1.FileConfigReader);
|
|
39
|
+
break;
|
|
40
|
+
case A_Context_class_1.A_Context.environment === 'server':
|
|
41
|
+
!fs.existsSync(`${scope.name}.conf.json`);
|
|
42
|
+
this.reader = scope.resolve(ENVConfigReader_component_1.ENVConfigReader);
|
|
43
|
+
break;
|
|
44
|
+
case A_Context_class_1.A_Context.environment === 'browser':
|
|
45
|
+
this.reader = scope.resolve(ENVConfigReader_component_1.ENVConfigReader);
|
|
46
|
+
break;
|
|
47
|
+
default:
|
|
48
|
+
throw new Error(`Environment ${A_Context_class_1.A_Context.environment} is not supported`);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
readVariables() {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
// const config = await this.reader.read(this.namespace.CONFIG_PROPERTIES);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.A_ConfigLoader = A_ConfigLoader;
|
|
59
|
+
__decorate([
|
|
60
|
+
__param(0, (0, A_Inject_decorator_1.A_Inject)(A_Scope_class_1.A_Scope)),
|
|
61
|
+
__param(1, (0, A_Inject_decorator_1.A_Inject)(A_Logger_component_1.A_Logger))
|
|
62
|
+
], A_ConfigLoader.prototype, "identifyReader", null);
|
|
63
|
+
const foo = new A_ConfigLoader({});
|
|
64
|
+
//# sourceMappingURL=A-Config.container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A-Config.container.js","sourceRoot":"","sources":["../../../../src/base/A-Config/A-Config.container.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,6FAAoF;AAEpF,uEAA0D;AAC1D,gGAAmF;AACnF,4CAA6C;AAC7C,uFAA8E;AAC9E,wFAA2E;AAC3E,sFAAyE;AACzE,iFAAwE;AAMxE,MAAa,cAAe,SAAQ,+BAA6B;IAMvD,cAAc,CACG,KAAc,EACb,MAAgB;;YAGpC,mDAAmD;YACnD,0DAA0D;YAE1D,MAAM,EAAE,GAAG,MAAM,qBAAW,CAAC,EAAE,EAAE,CAAC;YAElC,QAAQ,IAAI,EAAE,CAAC;gBAEX,KAAK,2BAAS,CAAC,WAAW,KAAK,QAAQ,IAAI,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC,IAAI,YAAY,CAAC;oBACjF,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,6CAAgB,CAAC,CAAC;oBAC9C,MAAM;gBAGV,KAAK,2BAAS,CAAC,WAAW,KAAK,QAAQ;oBAAE,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC,IAAI,YAAY,CAAC,CAAA;oBAC9E,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,2CAAe,CAAC,CAAC;oBAC7C,MAAM;gBAEV,KAAK,2BAAS,CAAC,WAAW,KAAK,SAAS;oBACpC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,2CAAe,CAAC,CAAC;oBAC7C,MAAM;gBAEV;oBACI,MAAM,IAAI,KAAK,CAAC,eAAe,2BAAS,CAAC,WAAW,mBAAmB,CAAC,CAAC;YACjF,CAAC;QACL,CAAC;KAAA;IAEK,aAAa;;YACf,2EAA2E;QAG/E,CAAC;KAAA;CAEJ;AA1CD,wCA0CC;AApCS;IACD,WAAA,IAAA,6BAAQ,EAAC,uBAAO,CAAC,CAAA;IACjB,WAAA,IAAA,6BAAQ,EAAC,6BAAQ,CAAC,CAAA;oDA0BtB;AAYL,MAAM,GAAG,GAAG,IAAI,cAAc,CAAC,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { A_TYPES__Required } from "@adaas/a-utils";
|
|
2
|
+
import { A_TYPES__ConfigContainerConstructor } from "./A-Config.types";
|
|
3
|
+
import { A_Fragment } from "../../global/A-Fragment/A-Fragment.class";
|
|
4
|
+
export declare class A_Config<T extends string = any> extends A_Fragment {
|
|
5
|
+
config: A_TYPES__ConfigContainerConstructor<T>;
|
|
6
|
+
private VARIABLES;
|
|
7
|
+
CONFIG_PROPERTIES: T[];
|
|
8
|
+
protected DEFAULT_ALLOWED_TO_READ_PROPERTIES: readonly ["CONFIG_SDK_VALIDATION", "CONFIG_VERBOSE", "CONFIG_IGNORE_ERRORS"];
|
|
9
|
+
constructor(config: A_TYPES__Required<Partial<A_TYPES__ConfigContainerConstructor<T>>, ['variables']>);
|
|
10
|
+
/**
|
|
11
|
+
* This method is used to get the configuration property by name
|
|
12
|
+
*
|
|
13
|
+
* @param property
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
get<_OutType = any>(property: T | typeof this.DEFAULT_ALLOWED_TO_READ_PROPERTIES[number]): _OutType;
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* This method is used to set the configuration property by name
|
|
20
|
+
* OR set multiple properties at once by passing an array of objects
|
|
21
|
+
*
|
|
22
|
+
* @param variables
|
|
23
|
+
*/
|
|
24
|
+
set<V extends string = T | typeof this.DEFAULT_ALLOWED_TO_READ_PROPERTIES[number]>(variables: Array<{
|
|
25
|
+
property: V;
|
|
26
|
+
value: any;
|
|
27
|
+
}>): any;
|
|
28
|
+
set<V extends string = T | typeof this.DEFAULT_ALLOWED_TO_READ_PROPERTIES[number]>(variables: Record<V, any>): any;
|
|
29
|
+
set<V extends string = T | typeof this.DEFAULT_ALLOWED_TO_READ_PROPERTIES[number]>(property: V, value: any): any;
|
|
30
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.A_Config = void 0;
|
|
4
|
+
const a_utils_1 = require("@adaas/a-utils");
|
|
5
|
+
const A_Fragment_class_1 = require("../../global/A-Fragment/A-Fragment.class");
|
|
6
|
+
class A_Config extends A_Fragment_class_1.A_Fragment {
|
|
7
|
+
constructor(config) {
|
|
8
|
+
super(config);
|
|
9
|
+
// Custom properties
|
|
10
|
+
this.VARIABLES = new Map();
|
|
11
|
+
this.CONFIG_PROPERTIES = [];
|
|
12
|
+
this.DEFAULT_ALLOWED_TO_READ_PROPERTIES = [
|
|
13
|
+
'CONFIG_SDK_VALIDATION',
|
|
14
|
+
'CONFIG_VERBOSE',
|
|
15
|
+
'CONFIG_IGNORE_ERRORS',
|
|
16
|
+
];
|
|
17
|
+
this.config = a_utils_1.A_CommonHelper.deepCloneAndMerge(config, {
|
|
18
|
+
name: this.name,
|
|
19
|
+
defaults: {}
|
|
20
|
+
});
|
|
21
|
+
this.CONFIG_PROPERTIES = this.config.variables ? this.config.variables : [];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* This method is used to get the configuration property by name
|
|
25
|
+
*
|
|
26
|
+
* @param property
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
get(property) {
|
|
30
|
+
if (this.CONFIG_PROPERTIES.includes(property))
|
|
31
|
+
return this.VARIABLES.get(property);
|
|
32
|
+
throw new Error('Property not exists or not allowed to read');
|
|
33
|
+
// return this.concept.Errors.throw(A_SDK_CONSTANTS__ERROR_CODES.CONFIGURATION_PROPERTY_NOT_EXISTS_OR_NOT_ALLOWED_TO_READ) as never;
|
|
34
|
+
}
|
|
35
|
+
set(property, value) {
|
|
36
|
+
var _a;
|
|
37
|
+
const array = Array.isArray(property)
|
|
38
|
+
? property
|
|
39
|
+
: typeof property === 'string'
|
|
40
|
+
? [{ property, value }]
|
|
41
|
+
: Object
|
|
42
|
+
.keys(property)
|
|
43
|
+
.map((key) => ({
|
|
44
|
+
property: key,
|
|
45
|
+
value: property[key]
|
|
46
|
+
}));
|
|
47
|
+
for (const { property, value } of array) {
|
|
48
|
+
let targetValue = value
|
|
49
|
+
? value
|
|
50
|
+
: ((_a = this.config) === null || _a === void 0 ? void 0 : _a.defaults)
|
|
51
|
+
? this.config.defaults[property]
|
|
52
|
+
: undefined;
|
|
53
|
+
this.VARIABLES.set(property, targetValue);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.A_Config = A_Config;
|
|
58
|
+
//# sourceMappingURL=A-Config.context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A-Config.context.js","sourceRoot":"","sources":["../../../../src/base/A-Config/A-Config.context.ts"],"names":[],"mappings":";;;AAAA,4CAAmE;AAEnE,0FAAiF;AAGjF,MAAa,QAEX,SAAQ,6BAAU;IAgBhB,YACI,MAAyF;QAEzF,KAAK,CAAC,MAAM,CAAC,CAAC;QAflB,oBAAoB;QACZ,cAAS,GAAqB,IAAI,GAAG,EAAe,CAAC;QAE7D,sBAAiB,GAAQ,EAAE,CAAC;QAElB,uCAAkC,GAAG;YAC3C,uBAAuB;YACvB,gBAAgB;YAChB,sBAAsB;SAChB,CAAC;QAQP,IAAI,CAAC,MAAM,GAAG,wBAAc,CAAC,iBAAiB,CAAyC,MAAa,EAAE;YAClG,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,QAAQ,EAAE,EAAoB;SACjC,CAAC,CAAC;QAEH,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IAChF,CAAC;IAGD;;;;;OAKG;IACH,GAAG,CACC,QAAoE;QAEpE,IAAI,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,QAAe,CAAC;YAChD,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAkB,CAAa,CAAC;QAE9D,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAU,CAAC;QACvE,oIAAoI;IACxI,CAAC;IAwBD,GAAG,CACC,QAGmB,EACnB,KAAW;;QAEX,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;YACjC,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,OAAO,QAAQ,KAAK,QAAQ;gBAC1B,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;gBACvB,CAAC,CAAC,MAAM;qBACH,IAAI,CAAC,QAAQ,CAAC;qBACd,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;oBACX,QAAQ,EAAE,GAAG;oBACb,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC;iBACvB,CAAC,CAAC,CAAC;QAEhB,KAAK,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,KAAK,EAAE,CAAC;YAEtC,IAAI,WAAW,GAAG,KAAK;gBACnB,CAAC,CAAC,KAAK;gBACP,CAAC,CAAC,CAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,QAAQ;oBACnB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAa,CAAC;oBACrC,CAAC,CAAC,SAAS,CAAC;YAEpB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAkB,EAAE,WAAW,CAAC,CAAC;QACxD,CAAC;IACL,CAAC;CACJ;AAnGD,4BAmGC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { A_TYPES__FragmentConstructor } from "../../global/A-Fragment/A-Fragment.types";
|
|
2
|
+
export declare enum A_TYPES__ConfigFeature {
|
|
3
|
+
}
|
|
4
|
+
export type A_TYPES__ConfigContainerConstructor<T extends string> = {
|
|
5
|
+
/**
|
|
6
|
+
* Allows to define the names of variable to be loaded
|
|
7
|
+
*/
|
|
8
|
+
variables?: Array<T>;
|
|
9
|
+
/**
|
|
10
|
+
* Allows to set the default values for the variables
|
|
11
|
+
*/
|
|
12
|
+
defaults?: {
|
|
13
|
+
[key in T]?: any;
|
|
14
|
+
};
|
|
15
|
+
} & A_TYPES__FragmentConstructor;
|
|
16
|
+
export type A_TYPES__ConfigContainer_DefaultProperties = 'CONFIG_SDK_VALIDATION' | 'CONFIG_VERBOSE' | 'CONFIG_IGNORE_ERRORS';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.A_TYPES__ConfigFeature = void 0;
|
|
4
|
+
var A_TYPES__ConfigFeature;
|
|
5
|
+
(function (A_TYPES__ConfigFeature) {
|
|
6
|
+
})(A_TYPES__ConfigFeature || (exports.A_TYPES__ConfigFeature = A_TYPES__ConfigFeature = {}));
|
|
7
|
+
//# sourceMappingURL=A-Config.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A-Config.types.js","sourceRoot":"","sources":["../../../../src/base/A-Config/A-Config.types.ts"],"names":[],"mappings":";;;AAGA,IAAY,sBAEX;AAFD,WAAY,sBAAsB;AAElC,CAAC,EAFW,sBAAsB,sCAAtB,sBAAsB,QAEjC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { A_Scope } from "../../../global/A-Scope/A-Scope.class";
|
|
2
|
+
/**
|
|
3
|
+
* Config Reader
|
|
4
|
+
*/
|
|
5
|
+
export declare class ConfigReader {
|
|
6
|
+
protected scope: A_Scope;
|
|
7
|
+
constructor(scope: A_Scope);
|
|
8
|
+
/**
|
|
9
|
+
* Get the configuration property by Name
|
|
10
|
+
* @param property
|
|
11
|
+
*/
|
|
12
|
+
resolve<_ReturnType = any>(property: string): _ReturnType;
|
|
13
|
+
/**
|
|
14
|
+
* This method reads the configuration and sets the values to the context
|
|
15
|
+
*
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
read<T extends string>(variables?: Array<T>): Promise<Record<T, any>>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
9
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
10
|
+
};
|
|
11
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
17
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.ConfigReader = void 0;
|
|
22
|
+
const A_Scope_class_1 = require("../../../global/A-Scope/A-Scope.class");
|
|
23
|
+
const A_Inject_decorator_1 = require("../../../decorators/A-Inject/A-Inject.decorator");
|
|
24
|
+
/**
|
|
25
|
+
* Config Reader
|
|
26
|
+
*/
|
|
27
|
+
let ConfigReader = class ConfigReader {
|
|
28
|
+
constructor(scope) {
|
|
29
|
+
this.scope = scope;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get the configuration property by Name
|
|
33
|
+
* @param property
|
|
34
|
+
*/
|
|
35
|
+
resolve(property) {
|
|
36
|
+
return property;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* This method reads the configuration and sets the values to the context
|
|
40
|
+
*
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
43
|
+
read() {
|
|
44
|
+
return __awaiter(this, arguments, void 0, function* (variables = []) {
|
|
45
|
+
return {};
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
exports.ConfigReader = ConfigReader;
|
|
50
|
+
exports.ConfigReader = ConfigReader = __decorate([
|
|
51
|
+
__param(0, (0, A_Inject_decorator_1.A_Inject)(A_Scope_class_1.A_Scope))
|
|
52
|
+
], ConfigReader);
|
|
53
|
+
//# sourceMappingURL=ConfigReader.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigReader.component.js","sourceRoot":"","sources":["../../../../../src/base/A-Config/components/ConfigReader.component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,iFAAwE;AACxE,gGAAmF;AAInF;;GAEG;AACI,IAAM,YAAY,GAAlB,MAAM,YAAY;IAErB,YACiC,KAAc;QAAd,UAAK,GAAL,KAAK,CAAS;IAC3C,CAAC;IAGL;;;OAGG;IACH,OAAO,CAAoB,QAAgB;QACvC,OAAO,QAAuB,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACG,IAAI;6DACN,YAAsB,EAAE;YAExB,OAAO,EAAoB,CAAC;QAChC,CAAC;KAAA;CACJ,CAAA;AAzBY,oCAAY;uBAAZ,YAAY;IAGhB,WAAA,IAAA,6BAAQ,EAAC,uBAAO,CAAC,CAAA;GAHb,YAAY,CAyBxB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ConfigReader } from "./ConfigReader.component";
|
|
2
|
+
export declare class ENVConfigReader extends ConfigReader {
|
|
3
|
+
/**
|
|
4
|
+
* Get the configuration property Name
|
|
5
|
+
* @param property
|
|
6
|
+
*/
|
|
7
|
+
getConfigurationProperty_ENV_Alias(property: string): string;
|
|
8
|
+
resolve<_ReturnType = any>(property: string): _ReturnType;
|
|
9
|
+
read<T extends string>(variables?: Array<T>): Promise<Record<T, any>>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ENVConfigReader = void 0;
|
|
13
|
+
const a_utils_1 = require("@adaas/a-utils");
|
|
14
|
+
const ConfigReader_component_1 = require("./ConfigReader.component");
|
|
15
|
+
class ENVConfigReader extends ConfigReader_component_1.ConfigReader {
|
|
16
|
+
/**
|
|
17
|
+
* Get the configuration property Name
|
|
18
|
+
* @param property
|
|
19
|
+
*/
|
|
20
|
+
getConfigurationProperty_ENV_Alias(property) {
|
|
21
|
+
return `${a_utils_1.A_CommonHelper.toUpperSnakeCase(this.scope.name)}_${a_utils_1.A_CommonHelper.toUpperSnakeCase(property)}`;
|
|
22
|
+
}
|
|
23
|
+
resolve(property) {
|
|
24
|
+
return process.env[this.getConfigurationProperty_ENV_Alias(property)];
|
|
25
|
+
}
|
|
26
|
+
read() {
|
|
27
|
+
return __awaiter(this, arguments, void 0, function* (variables = []) {
|
|
28
|
+
const config = {};
|
|
29
|
+
variables.forEach(variable => {
|
|
30
|
+
config[variable] = this.resolve(variable);
|
|
31
|
+
});
|
|
32
|
+
return config;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.ENVConfigReader = ENVConfigReader;
|
|
37
|
+
//# sourceMappingURL=ENVConfigReader.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ENVConfigReader.component.js","sourceRoot":"","sources":["../../../../../src/base/A-Config/components/ENVConfigReader.component.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAgD;AAChD,qEAAwD;AAGxD,MAAa,eAAgB,SAAQ,qCAAY;IAG7C;;;OAGG;IACH,kCAAkC,CAAC,QAAgB;QAC/C,OAAO,GAAG,wBAAc,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,wBAAc,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;IAC9G,CAAC;IAGD,OAAO,CAAoB,QAAgB;QACvC,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,kCAAkC,CAAC,QAAQ,CAAC,CAAgB,CAAC;IACzF,CAAC;IAGK,IAAI;6DAAmB,YAAsB,EAAE;YACjD,MAAM,MAAM,GAAmB,EAAoB,CAAC;YAEpD,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;gBACzB,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC9C,CAAC,CAAC,CAAC;YAEH,OAAO,MAAM,CAAC;QAClB,CAAC;KAAA;CACJ;AA1BD,0CA0BC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ConfigReader } from "./ConfigReader.component";
|
|
2
|
+
export declare class FileConfigReader extends ConfigReader {
|
|
3
|
+
private FileData;
|
|
4
|
+
/**
|
|
5
|
+
* Get the configuration property Name
|
|
6
|
+
* @param property
|
|
7
|
+
*/
|
|
8
|
+
getConfigurationProperty_File_Alias(property: string): string;
|
|
9
|
+
resolve<_ReturnType = any>(property: string): _ReturnType;
|
|
10
|
+
read<T extends string>(variables?: Array<T>): Promise<Record<T, any>>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.FileConfigReader = void 0;
|
|
13
|
+
const a_utils_1 = require("@adaas/a-utils");
|
|
14
|
+
const ConfigReader_component_1 = require("./ConfigReader.component");
|
|
15
|
+
class FileConfigReader extends ConfigReader_component_1.ConfigReader {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.FileData = new Map();
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get the configuration property Name
|
|
22
|
+
* @param property
|
|
23
|
+
*/
|
|
24
|
+
getConfigurationProperty_File_Alias(property) {
|
|
25
|
+
return a_utils_1.A_CommonHelper.toCamelCase(property);
|
|
26
|
+
}
|
|
27
|
+
resolve(property) {
|
|
28
|
+
return this.FileData.get(this.getConfigurationProperty_File_Alias(property));
|
|
29
|
+
}
|
|
30
|
+
read(variables) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const fs = yield a_utils_1.A_Polyfills.fs();
|
|
33
|
+
try {
|
|
34
|
+
const data = fs.readFileSync(`${this.scope.name}.conf.json`, 'utf8');
|
|
35
|
+
const config = JSON.parse(data);
|
|
36
|
+
this.FileData = new Map(Object.entries(config));
|
|
37
|
+
return config;
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
// this.context.Logger.error(error);
|
|
41
|
+
return {};
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.FileConfigReader = FileConfigReader;
|
|
47
|
+
//# sourceMappingURL=FileConfigReader.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileConfigReader.component.js","sourceRoot":"","sources":["../../../../../src/base/A-Config/components/FileConfigReader.component.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA6D;AAC7D,qEAAwD;AAIxD,MAAa,gBAAiB,SAAQ,qCAAY;IAAlD;;QAEY,aAAQ,GAAqB,IAAI,GAAG,EAAe,CAAC;IAkChE,CAAC;IAhCG;;;OAGG;IACH,mCAAmC,CAAC,QAAgB;QAChD,OAAO,wBAAc,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC;IAGD,OAAO,CAAoB,QAAgB;QACvC,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,mCAAmC,CAAC,QAAQ,CAAC,CAAgB,CAAC;IAChG,CAAC;IAGK,IAAI,CACN,SAAoB;;YAEpB,MAAM,EAAE,GAAG,MAAM,qBAAW,CAAC,EAAE,EAAE,CAAC;YAClC,IAAI,CAAC;gBACD,MAAM,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,YAAY,EAAE,MAAM,CAAC,CAAC;gBAErE,MAAM,MAAM,GAAmB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAEhD,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;gBAEhD,OAAO,MAAM,CAAC;YAElB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,oCAAoC;gBACpC,OAAO,EAAoB,CAAC;YAChC,CAAC;QACL,CAAC;KAAA;CACJ;AApCD,4CAoCC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { A_Scope } from "../../global/A-Scope/A-Scope.class";
|
|
2
|
+
import { A_Errors } from "./A-Errors.context";
|
|
3
|
+
import { A_CONSTANTS__ERROR_CODES, A_Error, A_ServerError } from "@adaas/a-utils";
|
|
4
|
+
export declare class A_ErrorsManager {
|
|
5
|
+
protected scope: A_Scope;
|
|
6
|
+
protected errors: A_Errors;
|
|
7
|
+
constructor(scope: A_Scope, errors: A_Errors);
|
|
8
|
+
throw(error: Error | unknown | any): never;
|
|
9
|
+
throw(code: A_CONSTANTS__ERROR_CODES | string): never;
|
|
10
|
+
throw(error: A_Error | A_ServerError): never;
|
|
11
|
+
/**
|
|
12
|
+
* This method wraps an error into the SDK error object.
|
|
13
|
+
*
|
|
14
|
+
* @param error
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
wrap(error: Error | A_Error | unknown | any): A_ServerError | A_Error;
|
|
18
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
9
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.A_ErrorsManager = void 0;
|
|
13
|
+
const A_Scope_class_1 = require("../../global/A-Scope/A-Scope.class");
|
|
14
|
+
const A_Inject_decorator_1 = require("../../decorators/A-Inject/A-Inject.decorator");
|
|
15
|
+
const A_Errors_context_1 = require("./A-Errors.context");
|
|
16
|
+
const a_utils_1 = require("@adaas/a-utils");
|
|
17
|
+
const A_Context_class_1 = require("../../global/A-Context/A-Context.class");
|
|
18
|
+
let A_ErrorsManager = class A_ErrorsManager {
|
|
19
|
+
constructor(scope, errors) {
|
|
20
|
+
this.scope = scope;
|
|
21
|
+
this.errors = errors;
|
|
22
|
+
}
|
|
23
|
+
throw(param) {
|
|
24
|
+
switch (true) {
|
|
25
|
+
// In case of error code
|
|
26
|
+
case typeof param === 'string':
|
|
27
|
+
const template = this.errors.get(param);
|
|
28
|
+
const namedCode = `${A_Context_class_1.A_Context.root}@${this.scope.name}:error:${template.code}`;
|
|
29
|
+
if ('serverCode' in template)
|
|
30
|
+
throw new a_utils_1.A_ServerError(Object.assign(Object.assign({}, template), { code: namedCode }));
|
|
31
|
+
else
|
|
32
|
+
throw new a_utils_1.A_Error(Object.assign(Object.assign({}, template), { code: namedCode }));
|
|
33
|
+
// In case of error object
|
|
34
|
+
case param instanceof a_utils_1.A_Error:
|
|
35
|
+
throw param;
|
|
36
|
+
// Otherwise wrap the error
|
|
37
|
+
default:
|
|
38
|
+
throw this.wrap(param);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* This method wraps an error into the SDK error object.
|
|
43
|
+
*
|
|
44
|
+
* @param error
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
wrap(error) {
|
|
48
|
+
switch (true) {
|
|
49
|
+
case error instanceof a_utils_1.A_Error:
|
|
50
|
+
let newCode = `${A_Context_class_1.A_Context.root}@${this.scope.name}:error:${error.code}`;
|
|
51
|
+
if (a_utils_1.ASEID.isASEID(error.code)) {
|
|
52
|
+
const aseid = new a_utils_1.ASEID(error.code);
|
|
53
|
+
if (aseid.scope !== this.scope.name)
|
|
54
|
+
newCode = `${A_Context_class_1.A_Context.root}@${this.scope.name}:error:${aseid.id}`;
|
|
55
|
+
}
|
|
56
|
+
if ('serverCode' in error)
|
|
57
|
+
return new a_utils_1.A_ServerError({
|
|
58
|
+
originalError: error,
|
|
59
|
+
code: newCode,
|
|
60
|
+
serverCode: error.serverCode,
|
|
61
|
+
name: error.name,
|
|
62
|
+
message: error.message,
|
|
63
|
+
link: error.link,
|
|
64
|
+
description: error.description
|
|
65
|
+
});
|
|
66
|
+
else
|
|
67
|
+
return new a_utils_1.A_Error({
|
|
68
|
+
originalError: error,
|
|
69
|
+
code: newCode,
|
|
70
|
+
name: error.name,
|
|
71
|
+
message: error.message,
|
|
72
|
+
link: error.link,
|
|
73
|
+
description: error.description
|
|
74
|
+
});
|
|
75
|
+
default:
|
|
76
|
+
return new a_utils_1.A_Error(error);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
exports.A_ErrorsManager = A_ErrorsManager;
|
|
81
|
+
exports.A_ErrorsManager = A_ErrorsManager = __decorate([
|
|
82
|
+
__param(0, (0, A_Inject_decorator_1.A_Inject)(A_Scope_class_1.A_Scope)),
|
|
83
|
+
__param(1, (0, A_Inject_decorator_1.A_Inject)(A_Errors_context_1.A_Errors))
|
|
84
|
+
], A_ErrorsManager);
|
|
85
|
+
//# sourceMappingURL=A-Errors.component.js.map
|