@adaas/a-concept 0.0.2 → 0.0.4
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 +64 -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 +25 -7
- package/dist/index.js +55 -13
- 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 +14 -0
- package/dist/src/base/A-Config/A-Config.types.js +3 -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 +36 -54
- package/dist/src/global/A-Context/A-Context.class.js +127 -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.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 +10 -0
- package/dist/src/global/A-Entity/A-Entity.class.js +16 -0
- package/dist/src/global/A-Entity/A-Entity.class.js.map +1 -0
- package/dist/src/global/A-Entity/A-Entity.types.js +2 -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 +11 -0
- package/dist/src/global/A-Meta/A-Meta.class.js +43 -0
- package/dist/src/global/A-Meta/A-Meta.class.js.map +1 -0
- package/dist/src/global/A-Meta/A-Meta.types.d.ts +0 -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 +133 -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 +41 -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 +55 -8
- package/jest.config.ts +2 -0
- 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 +10 -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 +65 -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 +177 -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 +231 -130
- package/src/global/A-Context/A-Context.types.ts +15 -0
- package/src/global/A-Dependency/A-DependencyReference.types.ts +56 -56
- package/src/global/A-Entity/A-Entity.class.ts +16 -0
- package/src/global/A-Entity/A-Entity.types.ts +0 -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 +60 -0
- package/src/global/A-Meta/A-Meta.types.ts +0 -0
- package/src/global/A-Scope/A-Scope.class.ts +208 -0
- package/src/global/A-Scope/A-Scope.types.ts +37 -0
- package/src/storage/A_Component.storage.ts +28 -0
- package/src/storage/A_Concept.storage.ts +5 -1
- package/src/storage/A_Container.storage.ts +21 -0
- package/src/storage/A_Inject.storage.ts +30 -0
- package/tsconfig.json +3 -1
- 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/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-Entity/A-Entity.types.d.ts} +0 -0
|
@@ -18,52 +18,56 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.
|
|
21
|
+
exports.HttpServer = void 0;
|
|
22
22
|
const A_Container_class_1 = require("../../../src/global/A-Container/A-Container.class");
|
|
23
23
|
const http_1 = require("http");
|
|
24
|
-
const A_Run_decorator_1 = require("../../../src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator");
|
|
25
24
|
const A_Inject_decorator_1 = require("../../../src/decorators/A-Inject/A-Inject.decorator");
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
// import { A_Feature } from "@adaas/a-concept/decorators/A-Feature/A-Feature.decorator";
|
|
26
|
+
const A_Concept_class_1 = require("../../../src/global/A-Concept/A_Concept.class");
|
|
27
|
+
const A_Config_context_1 = require("../../../src/base/A-Config/A-Config.context");
|
|
28
|
+
const A_Feature_class_1 = require("../../../src/global/A-Feature/A-Feature.class");
|
|
29
|
+
const http_request_context_1 = require("../contexts/http-request.context");
|
|
30
|
+
class HttpServer extends A_Container_class_1.A_Container {
|
|
31
|
+
create(config) {
|
|
30
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
33
|
// Set the server to listen on port 3000
|
|
32
34
|
this.port = config.get('PORT') || 3000;
|
|
33
35
|
// Create the HTTP server
|
|
34
|
-
this.server = (0, http_1.createServer)((
|
|
35
|
-
// Set the response headers
|
|
36
|
-
res.statusCode = 200;
|
|
37
|
-
res.setHeader('Content-Type', 'text/plain');
|
|
38
|
-
// Routing logic (basic example)
|
|
39
|
-
if (req.url === '/') {
|
|
40
|
-
res.end('Welcome to the homepage!');
|
|
41
|
-
}
|
|
42
|
-
else if (req.url === '/about') {
|
|
43
|
-
res.end('Welcome to the about page!');
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
res.statusCode = 404;
|
|
47
|
-
res.end('404 - Page not found');
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
this.namespace.registerServer(this.server, this.port);
|
|
36
|
+
this.server = (0, http_1.createServer)(this.onRequest.bind(this));
|
|
51
37
|
});
|
|
52
38
|
}
|
|
53
|
-
run(
|
|
39
|
+
run() {
|
|
54
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
41
|
this.server.listen(this.port, () => {
|
|
56
42
|
console.log(`Server is running on http://localhost:${this.port}`);
|
|
57
43
|
});
|
|
58
44
|
});
|
|
59
45
|
}
|
|
46
|
+
onRequest(req, res) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
return yield this.call('onRequest', {
|
|
49
|
+
fragments: [
|
|
50
|
+
new http_request_context_1.HTTPRequest(req, res)
|
|
51
|
+
]
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
stop() {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
57
|
+
}
|
|
60
58
|
}
|
|
61
|
-
exports.
|
|
59
|
+
exports.HttpServer = HttpServer;
|
|
60
|
+
__decorate([
|
|
61
|
+
A_Concept_class_1.A_Concept.Load(),
|
|
62
|
+
__param(0, (0, A_Inject_decorator_1.A_Inject)(A_Config_context_1.A_Config))
|
|
63
|
+
], HttpServer.prototype, "create", null);
|
|
64
|
+
__decorate([
|
|
65
|
+
A_Concept_class_1.A_Concept.Start()
|
|
66
|
+
], HttpServer.prototype, "run", null);
|
|
62
67
|
__decorate([
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
], DefaultHttpServer.prototype, "create", null);
|
|
68
|
+
A_Feature_class_1.A_Feature.Define()
|
|
69
|
+
], HttpServer.prototype, "onRequest", null);
|
|
66
70
|
__decorate([
|
|
67
|
-
|
|
68
|
-
],
|
|
71
|
+
A_Concept_class_1.A_Concept.Stop()
|
|
72
|
+
], HttpServer.prototype, "stop", null);
|
|
69
73
|
//# sourceMappingURL=http-server.container.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-server.container.js","sourceRoot":"","sources":["../../../../examples/simple-http-server/containers/http-server.container.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,6FAAoF;
|
|
1
|
+
{"version":3,"file":"http-server.container.js","sourceRoot":"","sources":["../../../../examples/simple-http-server/containers/http-server.container.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,6FAAoF;AACpF,+BAA6E;AAC7E,gGAAmF;AACnF,yFAAyF;AACzF,uFAA8E;AAC9E,sFAA2E;AAC3E,uFAA8E;AAC9E,2EAA+D;AAM/D,MAAa,UAAW,SAAQ,+BAA2C;IAOjE,MAAM,CACY,MAAwB;;YAE5C,wCAAwC;YACxC,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC;YAEvC,yBAAyB;YACzB,IAAI,CAAC,MAAM,GAAG,IAAA,mBAAY,EAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1D,CAAC;KAAA;IAGK,GAAG;;YACL,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE;gBAC/B,OAAO,CAAC,GAAG,CAAC,yCAAyC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YACtE,CAAC,CAAC,CAAC;QACP,CAAC;KAAA;IAIK,SAAS,CACX,GAAoB,EACpB,GAAmB;;YAEnB,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;gBAChC,SAAS,EAAE;oBACP,IAAI,kCAAW,CAAC,GAAG,EAAE,GAAG,CAAC;iBAC5B;aACJ,CAAC,CAAC;QACP,CAAC;KAAA;IAIK,IAAI;8DAAK,CAAC;KAAA;CACnB;AAxCD,gCAwCC;AAjCS;IADL,2BAAS,CAAC,IAAI,EAAE;IAEZ,WAAA,IAAA,6BAAQ,EAAC,2BAAQ,CAAC,CAAA;wCAOtB;AAGK;IADL,2BAAS,CAAC,KAAK,EAAE;qCAKjB;AAIK;IADL,2BAAS,CAAC,MAAM,EAAE;2CAUlB;AAIK;IADL,2BAAS,CAAC,IAAI,EAAE;sCACD"}
|
|
@@ -19,7 +19,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.HttpServerController = void 0;
|
|
22
|
-
const A_Load_decorator_1 = require("
|
|
22
|
+
const A_Load_decorator_1 = require("@adaas/a-concept/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator");
|
|
23
23
|
const A_Container_class_1 = require("../../../src/global/A-Container/A-Container.class");
|
|
24
24
|
const A_Inject_decorator_1 = require("../../../src/decorators/A-Inject/A-Inject.decorator");
|
|
25
25
|
const A_Config_namespace_1 = require("src/containers/A-Config/A-Config.namespace");
|
|
@@ -22,11 +22,11 @@ exports.HttpServerRouter = void 0;
|
|
|
22
22
|
const A_Container_class_1 = require("../../../src/global/A-Container/A-Container.class");
|
|
23
23
|
const A_Inject_decorator_1 = require("../../../src/decorators/A-Inject/A-Inject.decorator");
|
|
24
24
|
const A_Config_namespace_1 = require("src/containers/A-Config/A-Config.namespace");
|
|
25
|
-
const A_ConceptLifecycle_1 = require("
|
|
25
|
+
const A_ConceptLifecycle_1 = require("@adaas/a-concept/decorators/A-ConceptLifecycle");
|
|
26
26
|
class HttpServerRouter extends A_Container_class_1.A_Container {
|
|
27
27
|
listen(config) {
|
|
28
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
const server = this.namespace.getServer(this.namespace.port);
|
|
29
|
+
// const server = this.namespace.getServer(this.namespace.port);
|
|
30
30
|
// Do something with Server e.g. assign routes
|
|
31
31
|
});
|
|
32
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-server.router.js","sourceRoot":"","sources":["../../../../examples/simple-http-server/containers/http-server.router.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,6FAAoF;AAGpF,gGAAmF;AACnF,mFAAsE;AACtE,uFAA6E;AAM7E,MAAa,gBAAiB,SAAQ,+BAAuB;IAG5C,MAAM,CACK,MAAwB;;YAE5C,
|
|
1
|
+
{"version":3,"file":"http-server.router.js","sourceRoot":"","sources":["../../../../examples/simple-http-server/containers/http-server.router.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,6FAAoF;AAGpF,gGAAmF;AACnF,mFAAsE;AACtE,uFAA6E;AAM7E,MAAa,gBAAiB,SAAQ,+BAAuB;IAG5C,MAAM,CACK,MAAwB;;YAE5C,gEAAgE;YAEhE,8CAA8C;QAClD,CAAC;KAAA;CAEJ;AAXD,4CAWC;AARgB;IADZ,gCAAW,CAAC,IAAI,EAAE;IAEd,WAAA,IAAA,6BAAQ,EAAC,6BAAQ,CAAC,CAAA;8CAKtB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { A_Fragment } from "../../../src/global/A-Fragment/A-Fragment.class";
|
|
2
|
+
import { IncomingMessage, ServerResponse } from "http";
|
|
3
|
+
export declare class HTTPRequest extends A_Fragment {
|
|
4
|
+
request: IncomingMessage;
|
|
5
|
+
response: ServerResponse;
|
|
6
|
+
private _body;
|
|
7
|
+
state: 'open' | 'end';
|
|
8
|
+
constructor(request: IncomingMessage, response: ServerResponse);
|
|
9
|
+
protected onInit(): Promise<void>;
|
|
10
|
+
toJSON<T extends any>(): Promise<T>;
|
|
11
|
+
private parseBody;
|
|
12
|
+
end(body: string): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
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.HTTPRequest = void 0;
|
|
13
|
+
const A_Fragment_class_1 = require("../../../src/global/A-Fragment/A-Fragment.class");
|
|
14
|
+
class HTTPRequest extends A_Fragment_class_1.A_Fragment {
|
|
15
|
+
constructor(request, response) {
|
|
16
|
+
super();
|
|
17
|
+
this.state = 'open';
|
|
18
|
+
this.request = request;
|
|
19
|
+
this.response = response;
|
|
20
|
+
}
|
|
21
|
+
onInit() {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
this.response.statusCode = 200;
|
|
24
|
+
this.response.setHeader('Content-Type', 'text/plain');
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
toJSON() {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
if (!this._body) {
|
|
30
|
+
this._body = yield this.parseBody();
|
|
31
|
+
}
|
|
32
|
+
return this._body;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
parseBody() {
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
let body = '';
|
|
38
|
+
this.request.on('data', chunk => body += chunk.toString());
|
|
39
|
+
this.request.on('end', () => resolve(JSON.parse(body)));
|
|
40
|
+
this.request.on('error', reject);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
end(body) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
this.state = 'end';
|
|
46
|
+
this.response.end(body);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.HTTPRequest = HTTPRequest;
|
|
51
|
+
//# sourceMappingURL=http-request.context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-request.context.js","sourceRoot":"","sources":["../../../../examples/simple-http-server/contexts/http-request.context.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0FAAiF;AAMjF,MAAa,WAAY,SAAQ,6BAAU;IAWvC,YACI,OAAwB,EACxB,QAAwB;QAGxB,KAAK,EAAE,CAAC;QARZ,UAAK,GAAmB,MAAM,CAAA;QAU1B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAGe,MAAM;;YAClB,IAAI,CAAC,QAAQ,CAAC,UAAU,GAAG,GAAG,CAAC;YAC/B,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;QAC1D,CAAC;KAAA;IAGK,MAAM;;YACR,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;gBACd,IAAI,CAAC,KAAK,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;YACxC,CAAC;YAED,OAAO,IAAI,CAAC,KAAK,CAAC;QACtB,CAAC;KAAA;IAEO,SAAS;QACb,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACnC,IAAI,IAAI,GAAG,EAAE,CAAC;YACd,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC3D,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACxD,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;IACP,CAAC;IAGK,GAAG,CAAC,IAAY;;YAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;YACnB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;KAAA;CAEJ;AApDD,kCAoDC"}
|
|
@@ -1,100 +1,2 @@
|
|
|
1
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
const A_ConceptLifecycle_1 = require("../../../src/decorators/A-ConceptLifecycle");
|
|
19
|
-
const A_Component_class_1 = require("../../../src/global/A-Component/A-Component.class");
|
|
20
|
-
const A_Container_class_1 = require("../../../src/global/A-Container/A-Container.class");
|
|
21
|
-
const A_Namespace_class_1 = require("../../../src/global/A-Namespace/A_Namespace.class");
|
|
22
|
-
//=========== EXAMPLES============\
|
|
23
|
-
/**
|
|
24
|
-
* Stores information about DB connection, models, other things, etc.
|
|
25
|
-
*/
|
|
26
|
-
class A_DB extends A_Namespace_class_1.A_Namespace {
|
|
27
|
-
constructor() {
|
|
28
|
-
super(...arguments);
|
|
29
|
-
this.models = [];
|
|
30
|
-
}
|
|
31
|
-
registerModel(model) {
|
|
32
|
-
this.models.push(model);
|
|
33
|
-
}
|
|
34
|
-
connect(connection) {
|
|
35
|
-
this.connection = connection;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Container that deals with the DB connection.
|
|
40
|
-
*/
|
|
41
|
-
class PostgresDB extends A_Container_class_1.A_Container {
|
|
42
|
-
connect() {
|
|
43
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
// Connect to the DB
|
|
45
|
-
this.namespace.connect(
|
|
46
|
-
// Just for example
|
|
47
|
-
'connection');
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
init() {
|
|
51
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
this.namespace.registerModel(
|
|
53
|
-
// Just for example
|
|
54
|
-
'model');
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
__decorate([
|
|
59
|
-
A_ConceptLifecycle_1.A_Lifecycle.Load()
|
|
60
|
-
], PostgresDB.prototype, "connect", null);
|
|
61
|
-
__decorate([
|
|
62
|
-
A_ConceptLifecycle_1.A_Lifecycle.Load()
|
|
63
|
-
], PostgresDB.prototype, "init", null);
|
|
64
|
-
/**
|
|
65
|
-
* Stores information about the models with methods to interact with them.
|
|
66
|
-
*/
|
|
67
|
-
class PostgresDBRepository extends A_Component_class_1.A_Component {
|
|
68
|
-
save(model) {
|
|
69
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
// Save the model
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
find(model) {
|
|
74
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
// Find the model
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
delete(model) {
|
|
79
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
-
// Delete the model
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
class A_Auth extends A_Namespace_class_1.A_Namespace {
|
|
85
|
-
constructor() {
|
|
86
|
-
super(...arguments);
|
|
87
|
-
this.users = [];
|
|
88
|
-
}
|
|
89
|
-
// dosomething<
|
|
90
|
-
// S extends A_TYPES__NamespaceConstructor,
|
|
91
|
-
// T extends A_Namespace<S>>(
|
|
92
|
-
// conatienr: typeof A_Container<T>,
|
|
93
|
-
// params: S
|
|
94
|
-
// ) { }
|
|
95
|
-
registerUser(user) {
|
|
96
|
-
this.users.push(user);
|
|
97
|
-
// Do something with the user
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
2
|
//# sourceMappingURL=http-server.context.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-server.context.types.js","sourceRoot":"","sources":["../../../../examples/simple-http-server/contexts/http-server.context.types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http-server.context.types.js","sourceRoot":"","sources":["../../../../examples/simple-http-server/contexts/http-server.context.types.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A_Namespace } from "
|
|
1
|
+
import { A_Namespace } from "@adaas/a-concept/global/A-Namespace/A_Namespace.class";
|
|
2
2
|
import { IncomingMessage, Server } from "http";
|
|
3
3
|
import { A_TYPES__HttpServerNamespaceConstructor } from "./http-server.context.types";
|
|
4
4
|
export declare class HttpServer extends A_Namespace<A_TYPES__HttpServerNamespaceConstructor> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HttpServer = void 0;
|
|
4
|
-
const A_Namespace_class_1 = require("
|
|
4
|
+
const A_Namespace_class_1 = require("@adaas/a-concept/global/A-Namespace/A_Namespace.class");
|
|
5
5
|
class HttpServer extends A_Namespace_class_1.A_Namespace {
|
|
6
6
|
get port() {
|
|
7
7
|
const [name, port] = this.name.split(':');
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// import { A_Load } from "
|
|
2
|
+
// import { A_Load } from "@adaas/a-concept/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator"
|
|
3
3
|
// import { A_Module } from "@adaas/a-concept/global/A_Module.class"
|
|
4
4
|
// import { SimpleHTTPServerModule } from "../modules/simple-http-server.module"
|
|
5
5
|
// import { IncomingMessage, ServerResponse } from "http"
|
|
6
6
|
// import { SimpleHTTPServerContext } from "../modules/simple-http-server.context"
|
|
7
7
|
// import { A_Dependency } from "@adaas/a-concept/decorators/A-Dependency/A-Dependency.decorator"
|
|
8
|
-
// import { A_Run } from "
|
|
8
|
+
// import { A_Run } from "@adaas/a-concept/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator"
|
|
9
9
|
// import { A_Inject } from "../../../src/decorators/A-Inject/A-Inject.decorator"
|
|
10
10
|
// import { OrderController } from "./orders.controller"
|
|
11
11
|
// declare module "../modules/simple-http-server.types" {
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
declare function Inject(): (target: any, key: string, index: number) => void;
|
|
2
|
+
/**
|
|
3
|
+
* Allows to define a new lifecycle method
|
|
4
|
+
*/
|
|
5
|
+
declare function Define(...args: any[]): any;
|
|
6
|
+
declare class User {
|
|
7
|
+
}
|
|
8
|
+
declare class CRUDController {
|
|
9
|
+
constructor();
|
|
10
|
+
post(request: ControllerRequest): void;
|
|
11
|
+
}
|
|
12
|
+
declare class StatsController {
|
|
13
|
+
onRequest(): void;
|
|
14
|
+
count(request: ControllerRequest): void;
|
|
15
|
+
}
|
|
16
|
+
declare class ControllerRequest {
|
|
17
|
+
user: User;
|
|
18
|
+
constructor(user: User);
|
|
19
|
+
}
|
|
20
|
+
declare class DependencyResolver {
|
|
21
|
+
resolve<T extends {
|
|
22
|
+
new (...args: any[]): any;
|
|
23
|
+
}>(target: any): T;
|
|
24
|
+
}
|
|
25
|
+
declare class Architecture {
|
|
26
|
+
private static instance;
|
|
27
|
+
private definitions;
|
|
28
|
+
private constructor();
|
|
29
|
+
static getInstance(): Architecture;
|
|
30
|
+
static register(constructor: {
|
|
31
|
+
new (...args: any[]): any;
|
|
32
|
+
}, config: {
|
|
33
|
+
name: string;
|
|
34
|
+
}): void;
|
|
35
|
+
static getLifecycle(constructor: {
|
|
36
|
+
new (...args: any[]): any;
|
|
37
|
+
}): Map<string, Function> | undefined;
|
|
38
|
+
}
|
|
39
|
+
declare class Container {
|
|
40
|
+
}
|
|
41
|
+
interface Feature<_LifecycleMethodName extends string, _RuntimeContext extends any> {
|
|
42
|
+
name: _LifecycleMethodName;
|
|
43
|
+
context: new (...args: any[]) => _RuntimeContext;
|
|
44
|
+
}
|
|
45
|
+
declare class Concept<_LifecycleMethodNames extends string, _RuntimeContext extends any, _FeaturesDefinition2 extends Record<_LifecycleMethodNames, new (...args: any[]) => _RuntimeContext>> {
|
|
46
|
+
constructor(props: {
|
|
47
|
+
exports: _FeaturesDefinition2;
|
|
48
|
+
context: [];
|
|
49
|
+
import: any[];
|
|
50
|
+
});
|
|
51
|
+
resolve2(): Promise<{
|
|
52
|
+
[K in keyof _FeaturesDefinition2]: (context: InstanceType<_FeaturesDefinition2[K]>) => void;
|
|
53
|
+
}>;
|
|
54
|
+
}
|
|
55
|
+
declare class App extends Container {
|
|
56
|
+
server: any;
|
|
57
|
+
components: any[];
|
|
58
|
+
constructor(components: any[]);
|
|
59
|
+
static get Lifecycle(): {
|
|
60
|
+
onRequest: (...args: any[]) => any;
|
|
61
|
+
};
|
|
62
|
+
onRequest(request: any): void;
|
|
63
|
+
}
|
|
64
|
+
declare class startContext {
|
|
65
|
+
}
|
|
66
|
+
declare const myConcept: Concept<string, unknown, {
|
|
67
|
+
start: typeof startContext;
|
|
68
|
+
}>;
|
|
@@ -0,0 +1,162 @@
|
|
|
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
|
+
function Inject() {
|
|
21
|
+
return function (target, key, index) {
|
|
22
|
+
console.log('Inject', target, key, index);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function Define(name, ...args) {
|
|
26
|
+
return function (target, key, descriptor) {
|
|
27
|
+
Architecture
|
|
28
|
+
.register(target.constructor, {
|
|
29
|
+
name
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
class User {
|
|
34
|
+
}
|
|
35
|
+
class CRUDController {
|
|
36
|
+
constructor(
|
|
37
|
+
// Context Injection to adjust behavior
|
|
38
|
+
// @Inject(User) user
|
|
39
|
+
) {
|
|
40
|
+
}
|
|
41
|
+
post(request) {
|
|
42
|
+
request.user;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
__decorate([
|
|
46
|
+
__param(0, Inject())
|
|
47
|
+
], CRUDController.prototype, "post", null);
|
|
48
|
+
class StatsController {
|
|
49
|
+
// This method is context independent and "extends" the behavior of the parent Class (without inheritance)
|
|
50
|
+
// Here you can define what to expect from the previous step
|
|
51
|
+
// Basically here we can extend the behavior of the parent class
|
|
52
|
+
onRequest() {
|
|
53
|
+
}
|
|
54
|
+
// This method is context dependent
|
|
55
|
+
count(request) {
|
|
56
|
+
request.user;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
__decorate([
|
|
60
|
+
App.Lifecycle.onRequest()
|
|
61
|
+
], StatsController.prototype, "onRequest", null);
|
|
62
|
+
__decorate([
|
|
63
|
+
__param(0, Inject())
|
|
64
|
+
], StatsController.prototype, "count", null);
|
|
65
|
+
class ControllerRequest {
|
|
66
|
+
constructor(user) {
|
|
67
|
+
this.user = user;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
class DependencyResolver {
|
|
71
|
+
resolve(target) {
|
|
72
|
+
return new target();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
class Architecture {
|
|
76
|
+
constructor() {
|
|
77
|
+
this.definitions = new Map();
|
|
78
|
+
}
|
|
79
|
+
static getInstance() {
|
|
80
|
+
if (!this.instance) {
|
|
81
|
+
this.instance = new Architecture();
|
|
82
|
+
}
|
|
83
|
+
return this.instance;
|
|
84
|
+
}
|
|
85
|
+
static register(constructor, config) {
|
|
86
|
+
const instance = this.getInstance();
|
|
87
|
+
instance.definitions.set(constructor, {
|
|
88
|
+
lifecycle: new Map()
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
static getLifecycle(constructor) {
|
|
92
|
+
var _a;
|
|
93
|
+
const instance = this.getInstance();
|
|
94
|
+
return (_a = instance.definitions.get(constructor)) === null || _a === void 0 ? void 0 : _a.lifecycle;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
class Container {
|
|
98
|
+
}
|
|
99
|
+
class Concept {
|
|
100
|
+
// private steps!: _FeaturesDefinition
|
|
101
|
+
constructor(props) {
|
|
102
|
+
}
|
|
103
|
+
// async resolve(): Promise<{
|
|
104
|
+
// [K in _FeaturesDefinition[number]['name']]: (
|
|
105
|
+
// context: InstanceType<
|
|
106
|
+
// Extract<_FeaturesDefinition[number], { name: K }>['context']
|
|
107
|
+
// >
|
|
108
|
+
// ) => void;
|
|
109
|
+
// }> {
|
|
110
|
+
// return {} as any
|
|
111
|
+
// }
|
|
112
|
+
resolve2() {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
return {};
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
class App extends Container {
|
|
119
|
+
constructor(components) {
|
|
120
|
+
super();
|
|
121
|
+
this.components = [];
|
|
122
|
+
// this.server = new Server();
|
|
123
|
+
this.components = components;
|
|
124
|
+
}
|
|
125
|
+
static get Lifecycle() {
|
|
126
|
+
return {
|
|
127
|
+
onRequest: (...args) => Define('onRequest', ...args)
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
// The container has a set of lifecycle methods that can be used to extend the behavior by adding new methods
|
|
131
|
+
// Define Decorator allows to create a custom lifecycle attached to the class.
|
|
132
|
+
// So any other classes injected here will be able to use the lifecycle methods
|
|
133
|
+
onRequest(request) {
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
__decorate([
|
|
137
|
+
Define()
|
|
138
|
+
], App.prototype, "onRequest", null);
|
|
139
|
+
class startContext {
|
|
140
|
+
}
|
|
141
|
+
const myConcept = new Concept({
|
|
142
|
+
exports: {
|
|
143
|
+
start: startContext
|
|
144
|
+
},
|
|
145
|
+
context: [],
|
|
146
|
+
import: [
|
|
147
|
+
// We say that concept has User Entity
|
|
148
|
+
User,
|
|
149
|
+
// We say that concept has an APP with CRUDController
|
|
150
|
+
new App([
|
|
151
|
+
//
|
|
152
|
+
CRUDController,
|
|
153
|
+
// new CRUDController(),
|
|
154
|
+
])
|
|
155
|
+
]
|
|
156
|
+
});
|
|
157
|
+
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
158
|
+
// const target2 = await myConcept
|
|
159
|
+
// .resolve2();
|
|
160
|
+
// target2.start()
|
|
161
|
+
}))();
|
|
162
|
+
//# sourceMappingURL=test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../examples/simple-http-server/test.ts"],"names":[],"mappings":"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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,30 @@
|
|
|
1
|
+
export { A_Context } from './src/global/A-Context/A-Context.class';
|
|
2
|
+
export * from './src/global/A-Context/A-Context.types';
|
|
1
3
|
export { A_Concept } from './src/global/A-Concept/A_Concept.class';
|
|
4
|
+
export { A_ConceptMeta } from './src/global/A-Concept/A_Concept.meta';
|
|
2
5
|
export * from './src/global/A-Concept/A_Concept.types';
|
|
3
6
|
export { A_Container } from './src/global/A-Container/A-Container.class';
|
|
4
|
-
export {
|
|
5
|
-
export * from './src/global/A-
|
|
7
|
+
export { A_ContainerMeta } from './src/global/A-Container/A-Container.meta';
|
|
8
|
+
export * from './src/global/A-Container/A-Container.class';
|
|
9
|
+
export { A_Component } from './src/global/A-Component/A-Component.class';
|
|
10
|
+
export { A_ComponentMeta } from './src/global/A-Component/A-Component.meta';
|
|
11
|
+
export * from './src/global/A-Component/A-Component.types';
|
|
12
|
+
export { A_Feature } from './src/global/A-Feature/A-Feature.class';
|
|
13
|
+
export * from './src/global/A-Feature/A-Feature.types';
|
|
14
|
+
export { A_Scope } from './src/global/A-Scope/A-Scope.class';
|
|
15
|
+
export * from './src/global/A-Scope/A-Scope.types';
|
|
16
|
+
export { A_Meta } from './src/global/A-Meta/A-Meta.class';
|
|
17
|
+
export { A_Fragment } from './src/global/A-Fragment/A-Fragment.class';
|
|
18
|
+
export * from './src/global/A-Fragment/A-Fragment.types';
|
|
6
19
|
export { A_Inject } from './src/decorators/A-Inject/A-Inject.decorator';
|
|
7
20
|
export * from './src/decorators/A-Inject/A-Inject.decorator.types';
|
|
8
|
-
export {
|
|
9
|
-
export
|
|
10
|
-
export {
|
|
11
|
-
export
|
|
12
|
-
export {
|
|
21
|
+
export { A_ConfigLoader } from './src/base/A-Config/A-Config.container';
|
|
22
|
+
export { A_Config } from './src/base/A-Config/A-Config.context';
|
|
23
|
+
export { ConfigReader } from './src/base/A-Config/components/ConfigReader.component';
|
|
24
|
+
export { ENVConfigReader } from './src/base/A-Config/components/ENVConfigReader.component';
|
|
25
|
+
export { FileConfigReader } from './src/base/A-Config/components/FileConfigReader.component';
|
|
26
|
+
export * from './src/base/A-Config/A-Config.types';
|
|
27
|
+
export * from './src/base/A-Logger/A-Logger.component';
|
|
28
|
+
export { A_ErrorsManager } from './src/base/A-Errors/A-Errors.component';
|
|
29
|
+
export { A_Errors } from './src/base/A-Errors/A-Errors.context';
|
|
30
|
+
export * from './src/base/A-Errors/A-Errors.types';
|