@adaas/a-concept 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nvmrc +1 -0
- package/LICENSE +22 -0
- package/README.md +19 -0
- package/dist/examples/sdk/concept.d.ts +0 -0
- package/dist/examples/sdk/concept.js +21 -0
- package/dist/examples/sdk/concept.js.map +1 -0
- package/dist/examples/sdk/orders.api.d.ts +0 -0
- package/dist/examples/sdk/orders.api.js +16 -0
- package/dist/examples/sdk/orders.api.js.map +1 -0
- package/dist/examples/sdk/users.api.d.ts +0 -0
- package/dist/examples/sdk/users.api.js +16 -0
- package/dist/examples/sdk/users.api.js.map +1 -0
- package/dist/examples/simple/concept.d.ts +0 -0
- package/dist/examples/simple/concept.js +13 -0
- package/dist/examples/simple/concept.js.map +1 -0
- package/dist/examples/simple-http-server/concept.d.ts +1 -0
- package/dist/examples/simple-http-server/concept.js +36 -0
- package/dist/examples/simple-http-server/concept.js.map +1 -0
- package/dist/examples/simple-http-server/containers/http-server.container.d.ts +12 -0
- package/dist/examples/simple-http-server/containers/http-server.container.js +69 -0
- package/dist/examples/simple-http-server/containers/http-server.container.js.map +1 -0
- package/dist/examples/simple-http-server/containers/http-server.controller.d.ts +7 -0
- package/dist/examples/simple-http-server/containers/http-server.controller.js +37 -0
- package/dist/examples/simple-http-server/containers/http-server.controller.js.map +1 -0
- package/dist/examples/simple-http-server/containers/http-server.router.d.ts +6 -0
- package/dist/examples/simple-http-server/containers/http-server.router.js +39 -0
- package/dist/examples/simple-http-server/containers/http-server.router.js.map +1 -0
- package/dist/examples/simple-http-server/contexts/http-server.context.types.d.ts +4 -0
- package/dist/examples/simple-http-server/contexts/http-server.context.types.js +100 -0
- package/dist/examples/simple-http-server/contexts/http-server.context.types.js.map +1 -0
- package/dist/examples/simple-http-server/contexts/http-server.namespace.d.ts +10 -0
- package/dist/examples/simple-http-server/contexts/http-server.namespace.js +26 -0
- package/dist/examples/simple-http-server/contexts/http-server.namespace.js.map +1 -0
- package/dist/examples/simple-http-server/controllers/orders.controller.d.ts +5 -0
- package/dist/examples/simple-http-server/controllers/orders.controller.js +32 -0
- package/dist/examples/simple-http-server/controllers/orders.controller.js.map +1 -0
- package/dist/examples/simple-http-server/controllers/users.controller.d.ts +0 -0
- package/dist/examples/simple-http-server/controllers/users.controller.js +87 -0
- package/dist/examples/simple-http-server/controllers/users.controller.js.map +1 -0
- package/dist/examples/simple-http-server/modules/simple-http-server.context.d.ts +5 -0
- package/dist/examples/simple-http-server/modules/simple-http-server.context.js +25 -0
- package/dist/examples/simple-http-server/modules/simple-http-server.context.js.map +1 -0
- package/dist/examples/simple-http-server/modules/simple-http-server.module.d.ts +16 -0
- package/dist/examples/simple-http-server/modules/simple-http-server.module.js +8 -0
- package/dist/examples/simple-http-server/modules/simple-http-server.module.js.map +1 -0
- package/dist/examples/simple-http-server/modules/simple-http-server.types.d.ts +2 -0
- package/dist/examples/simple-http-server/modules/simple-http-server.types.js +3 -0
- package/dist/examples/simple-http-server/modules/simple-http-server.types.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/src/constants/A_ConceptLifecycle.constants.d.ts +2 -0
- package/dist/src/constants/A_ConceptLifecycle.constants.js +12 -0
- package/dist/src/constants/A_ConceptLifecycle.constants.js.map +1 -0
- package/dist/src/containers/A-Config/A-Config.container.d.ts +7 -0
- package/dist/src/containers/A-Config/A-Config.container.js +65 -0
- package/dist/src/containers/A-Config/A-Config.container.js.map +1 -0
- package/dist/src/containers/A-Config/A-Config.namespace.d.ts +28 -0
- package/dist/src/containers/A-Config/A-Config.namespace.js +54 -0
- package/dist/src/containers/A-Config/A-Config.namespace.js.map +1 -0
- package/dist/src/containers/A-Config/A-Config.types.d.ts +12 -0
- package/dist/src/containers/A-Config/A-Config.types.js +3 -0
- package/dist/src/containers/A-Config/A-Config.types.js.map +1 -0
- package/dist/src/containers/A-Config/components/ConfigReader.component.d.ts +18 -0
- package/dist/src/containers/A-Config/components/ConfigReader.component.js +37 -0
- package/dist/src/containers/A-Config/components/ConfigReader.component.js.map +1 -0
- package/dist/src/containers/A-Config/components/ENVConfigReader.component.d.ts +10 -0
- package/dist/src/containers/A-Config/components/ENVConfigReader.component.js +37 -0
- package/dist/src/containers/A-Config/components/ENVConfigReader.component.js.map +1 -0
- package/dist/src/containers/A-Config/components/FileConfigReader.component.d.ts +11 -0
- package/dist/src/containers/A-Config/components/FileConfigReader.component.js +47 -0
- package/dist/src/containers/A-Config/components/FileConfigReader.component.js.map +1 -0
- package/dist/src/containers/A-Errors/A-Errors.container.d.ts +5 -0
- package/dist/src/containers/A-Errors/A-Errors.container.js +32 -0
- package/dist/src/containers/A-Errors/A-Errors.container.js.map +1 -0
- package/dist/src/containers/A-Errors/A-Errors.namespace.d.ts +40 -0
- package/dist/src/containers/A-Errors/A-Errors.namespace.js +76 -0
- package/dist/src/containers/A-Errors/A-Errors.namespace.js.map +1 -0
- package/dist/src/containers/A-Errors/A-Errors.types.d.ts +5 -0
- package/dist/src/containers/A-Errors/A-Errors.types.js +3 -0
- package/dist/src/containers/A-Errors/A-Errors.types.js.map +1 -0
- package/dist/src/containers/A-Logger/A-Logger.container.d.ts +6 -0
- package/dist/src/containers/A-Logger/A-Logger.container.js +41 -0
- package/dist/src/containers/A-Logger/A-Logger.container.js.map +1 -0
- package/dist/src/containers/A-Logger/A-Logger.namespace.d.ts +17 -0
- package/dist/src/containers/A-Logger/A-Logger.namespace.js +22 -0
- package/dist/src/containers/A-Logger/A-Logger.namespace.js.map +1 -0
- package/dist/src/containers/A-Logger/A-Logger.types.d.ts +0 -0
- package/dist/src/containers/A-Logger/A-Logger.types.js +2 -0
- package/dist/src/containers/A-Logger/A-Logger.types.js.map +1 -0
- package/dist/src/containers/A-Logger/components/Logger.component.d.ts +29 -0
- package/dist/src/containers/A-Logger/components/Logger.component.js +128 -0
- package/dist/src/containers/A-Logger/components/Logger.component.js.map +1 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-ConceptLifecycle.decorator.types.d.ts +34 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-ConceptLifecycle.decorator.types.js +3 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-ConceptLifecycle.decorator.types.js.map +1 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.d.ts +11 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.js +36 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.js.map +1 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.types.d.ts +7 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.types.js +3 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.types.js.map +1 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.d.ts +17 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.js +42 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.js.map +1 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.types.d.ts +8 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.types.js +3 -0
- package/dist/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.types.js.map +1 -0
- package/dist/src/decorators/A-ConceptLifecycle/index.d.ts +7 -0
- package/dist/src/decorators/A-ConceptLifecycle/index.js +11 -0
- package/dist/src/decorators/A-ConceptLifecycle/index.js.map +1 -0
- package/dist/src/decorators/A-Feature/A-Feature.decorator.d.ts +0 -0
- package/dist/src/decorators/A-Feature/A-Feature.decorator.js +11 -0
- package/dist/src/decorators/A-Feature/A-Feature.decorator.js.map +1 -0
- package/dist/src/decorators/A-Feature/A-Feature.decorator.types.d.ts +0 -0
- package/dist/src/decorators/A-Feature/A-Feature.decorator.types.js +2 -0
- package/dist/src/decorators/A-Feature/A-Feature.decorator.types.js.map +1 -0
- package/dist/src/decorators/A-Inject/A-Inject.decorator.d.ts +22 -0
- package/dist/src/decorators/A-Inject/A-Inject.decorator.js +32 -0
- package/dist/src/decorators/A-Inject/A-Inject.decorator.js.map +1 -0
- package/dist/src/decorators/A-Inject/A-Inject.decorator.types.d.ts +4 -0
- package/dist/src/decorators/A-Inject/A-Inject.decorator.types.js +3 -0
- package/dist/src/decorators/A-Inject/A-Inject.decorator.types.js.map +1 -0
- package/dist/src/decorators/A_ConceptMethods.decorator.d.ts +0 -0
- package/dist/src/decorators/A_ConceptMethods.decorator.js +2 -0
- package/dist/src/decorators/A_ConceptMethods.decorator.js.map +1 -0
- package/dist/src/decorators/A_Lazy.decorator.d.ts +5 -0
- package/dist/src/decorators/A_Lazy.decorator.js +20 -0
- package/dist/src/decorators/A_Lazy.decorator.js.map +1 -0
- package/dist/src/global/A-Component/A-Component.class.d.ts +16 -0
- package/dist/src/global/A-Component/A-Component.class.js +18 -0
- package/dist/src/global/A-Component/A-Component.class.js.map +1 -0
- package/dist/src/global/A-Concept/A_Concept.class.d.ts +46 -0
- package/dist/src/global/A-Concept/A_Concept.class.js +106 -0
- package/dist/src/global/A-Concept/A_Concept.class.js.map +1 -0
- package/dist/src/global/A-Concept/A_Concept.types.d.ts +26 -0
- package/dist/src/global/A-Concept/A_Concept.types.js +3 -0
- package/dist/src/global/A-Concept/A_Concept.types.js.map +1 -0
- package/dist/src/global/A-Container/A-Container.class.d.ts +14 -0
- package/dist/src/global/A-Container/A-Container.class.js +21 -0
- package/dist/src/global/A-Container/A-Container.class.js.map +1 -0
- package/dist/src/global/A-Context/A-Context.class.d.ts +88 -0
- package/dist/src/global/A-Context/A-Context.class.js +118 -0
- package/dist/src/global/A-Context/A-Context.class.js.map +1 -0
- package/dist/src/global/A-Context/A-Context.types.d.ts +0 -0
- package/dist/src/global/A-Context/A-Context.types.js +2 -0
- package/dist/src/global/A-Context/A-Context.types.js.map +1 -0
- package/dist/src/global/A-Dependency/A-DependencyReference.class.d.ts +17 -0
- package/dist/src/global/A-Dependency/A-DependencyReference.class.js +67 -0
- package/dist/src/global/A-Dependency/A-DependencyReference.class.js.map +1 -0
- package/dist/src/global/A-Dependency/A-DependencyReference.types.d.ts +55 -0
- package/dist/src/global/A-Dependency/A-DependencyReference.types.js +3 -0
- package/dist/src/global/A-Dependency/A-DependencyReference.types.js.map +1 -0
- package/dist/src/global/A-Namespace/A_Namespace.class.d.ts +47 -0
- package/dist/src/global/A-Namespace/A_Namespace.class.js +112 -0
- package/dist/src/global/A-Namespace/A_Namespace.class.js.map +1 -0
- package/dist/src/global/A-Namespace/A_Namespace.types.d.ts +19 -0
- package/dist/src/global/A-Namespace/A_Namespace.types.js +3 -0
- package/dist/src/global/A-Namespace/A_Namespace.types.js.map +1 -0
- package/dist/src/managers/A_DependencyManager.class.d.ts +24 -0
- package/dist/src/managers/A_DependencyManager.class.js +129 -0
- package/dist/src/managers/A_DependencyManager.class.js.map +1 -0
- package/dist/src/storage/A_Concept.storage.d.ts +19 -0
- package/dist/src/storage/A_Concept.storage.js +29 -0
- package/dist/src/storage/A_Concept.storage.js.map +1 -0
- package/dist/src/types/A_DependencyManager.types.d.ts +15 -0
- package/dist/src/types/A_DependencyManager.types.js +3 -0
- package/dist/src/types/A_DependencyManager.types.js.map +1 -0
- package/dist/src/types/A_Module.types.d.ts +17 -0
- package/dist/src/types/A_Module.types.js +22 -0
- package/dist/src/types/A_Module.types.js.map +1 -0
- package/docs/logo.png +0 -0
- package/examples/sdk/concept.ts +24 -0
- package/examples/sdk/orders.api.ts +21 -0
- package/examples/sdk/users.api.ts +21 -0
- package/examples/simple/concept.ts +16 -0
- package/examples/simple-http-server/concept.ts +30 -0
- package/examples/simple-http-server/containers/http-server.container.ts +69 -0
- package/examples/simple-http-server/containers/http-server.controller.ts +24 -0
- package/examples/simple-http-server/containers/http-server.router.ts +23 -0
- package/examples/simple-http-server/contexts/http-server.context.types.ts +108 -0
- package/examples/simple-http-server/contexts/http-server.namespace.ts +36 -0
- package/examples/simple-http-server/controllers/orders.controller.ts +20 -0
- package/examples/simple-http-server/controllers/users.controller.ts +104 -0
- package/index.ts +14 -0
- package/jest.config.ts +22 -0
- package/package.json +73 -0
- package/src/constants/A_ConceptLifecycle.constants.ts +12 -0
- package/src/containers/A-Config/A-Config.container.ts +60 -0
- package/src/containers/A-Config/A-Config.namespace.ts +98 -0
- package/src/containers/A-Config/A-Config.types.ts +31 -0
- package/src/containers/A-Config/components/ConfigReader.component.ts +30 -0
- package/src/containers/A-Config/components/ENVConfigReader.component.ts +31 -0
- package/src/containers/A-Config/components/FileConfigReader.component.ts +42 -0
- package/src/containers/A-Errors/A-Errors.container.ts +14 -0
- package/src/containers/A-Errors/A-Errors.namespace.ts +104 -0
- package/src/containers/A-Errors/A-Errors.types.ts +6 -0
- package/src/containers/A-Logger/A-Logger.container.ts +22 -0
- package/src/containers/A-Logger/A-Logger.namespace.ts +26 -0
- package/src/containers/A-Logger/A-Logger.types.ts +0 -0
- package/src/containers/A-Logger/components/Logger.component.ts +169 -0
- package/src/decorators/A-ConceptLifecycle/A-ConceptLifecycle.decorator.types.ts +46 -0
- package/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.ts +55 -0
- package/src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator.types.ts +20 -0
- package/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.ts +62 -0
- package/src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator.types.ts +28 -0
- package/src/decorators/A-ConceptLifecycle/index.ts +9 -0
- package/src/decorators/A-Feature/A-Feature.decorator.ts +13 -0
- package/src/decorators/A-Feature/A-Feature.decorator.types.ts +0 -0
- package/src/decorators/A-Inject/A-Inject.decorator.ts +75 -0
- package/src/decorators/A-Inject/A-Inject.decorator.types.ts +10 -0
- package/src/decorators/A_ConceptMethods.decorator.ts +0 -0
- package/src/decorators/A_Lazy.decorator.ts +31 -0
- package/src/global/A-Component/A-Component.class.ts +33 -0
- package/src/global/A-Concept/A_Concept.class.ts +143 -0
- package/src/global/A-Concept/A_Concept.types.ts +44 -0
- package/src/global/A-Container/A-Container.class.ts +39 -0
- package/src/global/A-Context/A-Context.class.ts +230 -0
- package/src/global/A-Context/A-Context.types.ts +0 -0
- package/src/global/A-Dependency/A-DependencyReference.class.ts +61 -0
- package/src/global/A-Dependency/A-DependencyReference.types.ts +61 -0
- package/src/global/A-Namespace/A_Namespace.class.ts +128 -0
- package/src/global/A-Namespace/A_Namespace.types.ts +24 -0
- package/src/storage/A_Concept.storage.ts +45 -0
- package/src/types/A_Module.types.ts +23 -0
- package/tests/context.test.ts +124 -0
- package/tests/default.test.ts +159 -0
- package/tests/log.ts +54 -0
- package/tests/polyfill.test.ts +37 -0
- package/tsconfig.json +61 -0
- package/tslint.json +98 -0
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
v20.10.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
(The MIT License)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 ADAAS <https://adaas.org>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
'Software'), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<img align="left" style="margin-right:40px; margin-bottom:80px;" width="180" height="80" src="./docs/logo.png" alt="ADAAS Logo">
|
|
2
|
+
|
|
3
|
+
# A Set Of Shared Types across ADAAS SDKs
|
|
4
|
+
|
|
5
|
+
| LTS | Latest | npm |
|
|
6
|
+
|---------------|----------|---------------------------|
|
|
7
|
+
| v1.0.0 | v1.0.1 | [@adaas/a-concept](https://npm.com) |
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## Install SDK
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
|
|
14
|
+
cd /your/project/location
|
|
15
|
+
adf
|
|
16
|
+
npm i @adaas/a-concept
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { A_Concept } from "../../src/global/A-Concept/A_Concept.class";
|
|
3
|
+
// import { UsersAPIModule } from "./users.api";
|
|
4
|
+
// import { OrdersAPIModule } from "./orders.api";
|
|
5
|
+
// (async () => {
|
|
6
|
+
// const simpleConcept = new A_Concept({
|
|
7
|
+
// name: 'simple-api-concept',
|
|
8
|
+
// modules: [
|
|
9
|
+
// new UsersAPIModule({
|
|
10
|
+
// behavior: 'sync'
|
|
11
|
+
// }),
|
|
12
|
+
// new OrdersAPIModule({
|
|
13
|
+
// behavior: 'sync'
|
|
14
|
+
// })
|
|
15
|
+
// ],
|
|
16
|
+
// context: [
|
|
17
|
+
// ]
|
|
18
|
+
// });
|
|
19
|
+
// await simpleConcept.run();
|
|
20
|
+
// })();
|
|
21
|
+
//# sourceMappingURL=concept.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concept.js","sourceRoot":"","sources":["../../../examples/sdk/concept.ts"],"names":[],"mappings":";AAAA,iFAAiF;AACjF,gDAAgD;AAChD,kDAAkD;AAGlD,iBAAiB;AACjB,4CAA4C;AAC5C,sCAAsC;AACtC,qBAAqB;AACrB,mCAAmC;AACnC,mCAAmC;AACnC,kBAAkB;AAClB,oCAAoC;AACpC,mCAAmC;AACnC,iBAAiB;AACjB,aAAa;AACb,qBAAqB;AAErB,YAAY;AACZ,UAAU;AAEV,iCAAiC;AAEjC,QAAQ"}
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { A_Module } from "@adaas/a-concept/global/A_Module.class"
|
|
3
|
+
// declare module "@adaas/a-concept/global/A_Concept.class" {
|
|
4
|
+
// interface A_Concept {
|
|
5
|
+
// Orders: OrdersAPIModule;
|
|
6
|
+
// }
|
|
7
|
+
// }
|
|
8
|
+
// export class OrdersAPIModule extends A_Module {
|
|
9
|
+
// async makeSome1() {
|
|
10
|
+
// console.log('Making some request')
|
|
11
|
+
// }
|
|
12
|
+
// async makeSome2() {
|
|
13
|
+
// console.log('Making some request')
|
|
14
|
+
// }
|
|
15
|
+
// }
|
|
16
|
+
//# sourceMappingURL=orders.api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orders.api.js","sourceRoot":"","sources":["../../../examples/sdk/orders.api.ts"],"names":[],"mappings":";AAAA,oEAAoE;AAGpE,6DAA6D;AAC7D,4BAA4B;AAC5B,mCAAmC;AACnC,QAAQ;AACR,IAAI;AAGJ,kDAAkD;AAElD,0BAA0B;AAC1B,6CAA6C;AAC7C,QAAQ;AAER,0BAA0B;AAC1B,6CAA6C;AAC7C,QAAQ;AAER,IAAI"}
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { A_Module } from "@adaas/a-concept/global/A_Module.class"
|
|
3
|
+
// declare module "@adaas/a-concept/global/A_Concept.class" {
|
|
4
|
+
// interface A_Concept {
|
|
5
|
+
// Users: UsersAPIModule;
|
|
6
|
+
// }
|
|
7
|
+
// }
|
|
8
|
+
// export class UsersAPIModule extends A_Module {
|
|
9
|
+
// async makeSome1() {
|
|
10
|
+
// console.log('Making some request')
|
|
11
|
+
// }
|
|
12
|
+
// async makeSome2() {
|
|
13
|
+
// console.log('Making some request')
|
|
14
|
+
// }
|
|
15
|
+
// }
|
|
16
|
+
//# sourceMappingURL=users.api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.api.js","sourceRoot":"","sources":["../../../examples/sdk/users.api.ts"],"names":[],"mappings":";AAAA,oEAAoE;AAGpE,6DAA6D;AAC7D,4BAA4B;AAC5B,iCAAiC;AACjC,QAAQ;AACR,IAAI;AAGJ,iDAAiD;AAEjD,0BAA0B;AAC1B,6CAA6C;AAC7C,QAAQ;AAER,0BAA0B;AAC1B,6CAA6C;AAC7C,QAAQ;AAER,IAAI"}
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { A_Concept } from "../../src/global/A-Concept/A_Concept.class";
|
|
3
|
+
// (async () => {
|
|
4
|
+
// const simpleConcept = new A_Concept({
|
|
5
|
+
// name: 'simple-concept',
|
|
6
|
+
// modules: [
|
|
7
|
+
// ],
|
|
8
|
+
// context: [
|
|
9
|
+
// ]
|
|
10
|
+
// });
|
|
11
|
+
// await simpleConcept.run();
|
|
12
|
+
// })();
|
|
13
|
+
//# sourceMappingURL=concept.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concept.js","sourceRoot":"","sources":["../../../examples/simple/concept.ts"],"names":[],"mappings":";AAAA,iFAAiF;AAGjF,iBAAiB;AACjB,4CAA4C;AAC5C,kCAAkC;AAClC,qBAAqB;AAErB,aAAa;AACb,qBAAqB;AACrB,YAAY;AACZ,UAAU;AAEV,iCAAiC;AAEjC,QAAQ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
const A_Concept_class_1 = require("../../src/global/A-Concept/A_Concept.class");
|
|
13
|
+
const http_server_container_1 = require("./containers/http-server.container");
|
|
14
|
+
const http_server_namespace_1 = require("./contexts/http-server.namespace");
|
|
15
|
+
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
const simpleConcept = new A_Concept_class_1.A_Concept({
|
|
17
|
+
name: 'test-server',
|
|
18
|
+
// import: [
|
|
19
|
+
// server1,
|
|
20
|
+
// server2
|
|
21
|
+
// ],
|
|
22
|
+
containers: [
|
|
23
|
+
http_server_container_1.DefaultHttpServer
|
|
24
|
+
],
|
|
25
|
+
context: [
|
|
26
|
+
new http_server_namespace_1.HttpServer({
|
|
27
|
+
port: 3000
|
|
28
|
+
}),
|
|
29
|
+
new http_server_namespace_1.HttpServer({
|
|
30
|
+
port: 3001
|
|
31
|
+
})
|
|
32
|
+
],
|
|
33
|
+
});
|
|
34
|
+
yield simpleConcept.run();
|
|
35
|
+
}))();
|
|
36
|
+
//# sourceMappingURL=concept.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concept.js","sourceRoot":"","sources":["../../../examples/simple-http-server/concept.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uFAA8E;AAC9E,8EAAuE;AACvE,4EAA8D;AAG9D,CAAC,GAAS,EAAE;IACR,MAAM,aAAa,GAAG,IAAI,2BAAS,CAAC;QAChC,IAAI,EAAE,aAAa;QACnB,YAAY;QACZ,eAAe;QACf,cAAc;QACd,KAAK;QACL,UAAU,EAAE;YACR,yCAAiB;SACpB;QACD,OAAO,EAAE;YACL,IAAI,kCAAU,CAAC;gBACX,IAAI,EAAE,IAAI;aACb,CAAC;YACF,IAAI,kCAAU,CAAC;gBACX,IAAI,EAAE,IAAI;aACb,CAAC;SACL;KACJ,CAAC,CAAA;IAIF,MAAM,aAAa,CAAC,GAAG,EAAE,CAAC;AAE9B,CAAC,CAAA,CAAC,EAAE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { A_Container } from "../../../src/global/A-Container/A-Container.class";
|
|
2
|
+
import { HttpServer } from "../contexts/http-server.namespace";
|
|
3
|
+
import { Server } from "http";
|
|
4
|
+
import { A_Concept } from "../../../src/global/A-Concept/A_Concept.class";
|
|
5
|
+
import { A_TYPES__A_CONCEPT_RootRunParams } from "../../../src/global/A-Concept/A_Concept.types";
|
|
6
|
+
import { A_Config } from "src/containers/A-Config/A-Config.namespace";
|
|
7
|
+
export declare class DefaultHttpServer extends A_Container<HttpServer> {
|
|
8
|
+
server: Server;
|
|
9
|
+
port: number;
|
|
10
|
+
create(concept: A_Concept, config: A_Config<'PORT'>): Promise<void>;
|
|
11
|
+
run(params: A_TYPES__A_CONCEPT_RootRunParams): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
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.DefaultHttpServer = void 0;
|
|
22
|
+
const A_Container_class_1 = require("../../../src/global/A-Container/A-Container.class");
|
|
23
|
+
const http_1 = require("http");
|
|
24
|
+
const A_Run_decorator_1 = require("../../../src/decorators/A-ConceptLifecycle/A-Run/A-Run.decorator");
|
|
25
|
+
const A_Inject_decorator_1 = require("../../../src/decorators/A-Inject/A-Inject.decorator");
|
|
26
|
+
const A_ConceptLifecycle_1 = require("../../../src/decorators/A-ConceptLifecycle");
|
|
27
|
+
const A_Config_namespace_1 = require("src/containers/A-Config/A-Config.namespace");
|
|
28
|
+
class DefaultHttpServer extends A_Container_class_1.A_Container {
|
|
29
|
+
create(concept, config) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
// Set the server to listen on port 3000
|
|
32
|
+
this.port = config.get('PORT') || 3000;
|
|
33
|
+
// Create the HTTP server
|
|
34
|
+
this.server = (0, http_1.createServer)((req, res) => {
|
|
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);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
run(params) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
this.server.listen(this.port, () => {
|
|
56
|
+
console.log(`Server is running on http://localhost:${this.port}`);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.DefaultHttpServer = DefaultHttpServer;
|
|
62
|
+
__decorate([
|
|
63
|
+
A_ConceptLifecycle_1.A_Lifecycle.Load(),
|
|
64
|
+
__param(1, (0, A_Inject_decorator_1.A_Inject)(A_Config_namespace_1.A_Config))
|
|
65
|
+
], DefaultHttpServer.prototype, "create", null);
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, A_Run_decorator_1.A_Run)({})
|
|
68
|
+
], DefaultHttpServer.prototype, "run", null);
|
|
69
|
+
//# sourceMappingURL=http-server.container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-server.container.js","sourceRoot":"","sources":["../../../../examples/simple-http-server/containers/http-server.container.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,6FAAoF;AAEpF,+BAA6E;AAC7E,0GAA6F;AAC7F,gGAAmF;AAInF,uFAA6E;AAC7E,mFAAsE;AAMtE,MAAa,iBAAkB,SAAQ,+BAAuB;IAM7C,MAAM,CACf,OAAkB,EACE,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,CAAC,GAAoB,EAAE,GAAmB,EAAE,EAAE;gBACrE,2BAA2B;gBAC3B,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC;gBACrB,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;gBAE5C,gCAAgC;gBAChC,IAAI,GAAG,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;oBAClB,GAAG,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;gBACxC,CAAC;qBAAM,IAAI,GAAG,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;oBAC9B,GAAG,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;gBAC1C,CAAC;qBAAM,CAAC;oBACJ,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC;oBACrB,GAAG,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;gBACpC,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1D,CAAC;KAAA;IAKK,GAAG,CACL,MAAwC;;YAExC,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;CAWJ;AArDD,8CAqDC;AA/CgB;IADZ,gCAAW,CAAC,IAAI,EAAE;IAGd,WAAA,IAAA,6BAAQ,EAAC,6BAAQ,CAAC,CAAA;+CAuBtB;AAKK;IADL,IAAA,uBAAK,EAAC,EAAE,CAAC;4CAOT"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { A_Container } from "../../../src/global/A-Container/A-Container.class";
|
|
2
|
+
import { HttpServer } from "../contexts/http-server.namespace";
|
|
3
|
+
import { A_Concept } from "../../../src/global/A-Concept/A_Concept.class";
|
|
4
|
+
import { A_Config } from "src/containers/A-Config/A-Config.namespace";
|
|
5
|
+
export declare class HttpServerController extends A_Container<HttpServer> {
|
|
6
|
+
create(concept: A_Concept, config: A_Config<'PORT'>): Promise<void>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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.HttpServerController = void 0;
|
|
22
|
+
const A_Load_decorator_1 = require("../../../src/decorators/A-ConceptLifecycle/A-Load/A-Load.decorator");
|
|
23
|
+
const A_Container_class_1 = require("../../../src/global/A-Container/A-Container.class");
|
|
24
|
+
const A_Inject_decorator_1 = require("../../../src/decorators/A-Inject/A-Inject.decorator");
|
|
25
|
+
const A_Config_namespace_1 = require("src/containers/A-Config/A-Config.namespace");
|
|
26
|
+
class HttpServerController extends A_Container_class_1.A_Container {
|
|
27
|
+
create(concept, config) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.HttpServerController = HttpServerController;
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, A_Load_decorator_1.A_Load)(),
|
|
35
|
+
__param(1, (0, A_Inject_decorator_1.A_Inject)(A_Config_namespace_1.A_Config))
|
|
36
|
+
], HttpServerController.prototype, "create", null);
|
|
37
|
+
//# sourceMappingURL=http-server.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-server.controller.js","sourceRoot":"","sources":["../../../../examples/simple-http-server/containers/http-server.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,6GAAgG;AAChG,6FAAoF;AAGpF,gGAAmF;AAEnF,mFAAsE;AAMtE,MAAa,oBAAqB,SAAQ,+BAAuB;IAIhD,MAAM,CACf,OAAkB,EACE,MAAwB;;QAGhD,CAAC;KAAA;CAEJ;AAXD,oDAWC;AAPgB;IAFZ,IAAA,yBAAM,GACN;IAGI,WAAA,IAAA,6BAAQ,EAAC,6BAAQ,CAAC,CAAA;kDAGtB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { A_Container } from "../../../src/global/A-Container/A-Container.class";
|
|
2
|
+
import { HttpServer } from "../contexts/http-server.namespace";
|
|
3
|
+
import { A_Config } from "src/containers/A-Config/A-Config.namespace";
|
|
4
|
+
export declare class HttpServerRouter extends A_Container<HttpServer> {
|
|
5
|
+
listen(config: A_Config<'PORT'>): Promise<void>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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.HttpServerRouter = void 0;
|
|
22
|
+
const A_Container_class_1 = require("../../../src/global/A-Container/A-Container.class");
|
|
23
|
+
const A_Inject_decorator_1 = require("../../../src/decorators/A-Inject/A-Inject.decorator");
|
|
24
|
+
const A_Config_namespace_1 = require("src/containers/A-Config/A-Config.namespace");
|
|
25
|
+
const A_ConceptLifecycle_1 = require("../../../src/decorators/A-ConceptLifecycle");
|
|
26
|
+
class HttpServerRouter extends A_Container_class_1.A_Container {
|
|
27
|
+
listen(config) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const server = this.namespace.getServer(this.namespace.port);
|
|
30
|
+
// Do something with Server e.g. assign routes
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.HttpServerRouter = HttpServerRouter;
|
|
35
|
+
__decorate([
|
|
36
|
+
A_ConceptLifecycle_1.A_Lifecycle.Load(),
|
|
37
|
+
__param(0, (0, A_Inject_decorator_1.A_Inject)(A_Config_namespace_1.A_Config))
|
|
38
|
+
], HttpServerRouter.prototype, "listen", null);
|
|
39
|
+
//# sourceMappingURL=http-server.router.js.map
|
|
@@ -0,0 +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,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAE7D,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,100 @@
|
|
|
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
|
+
//# sourceMappingURL=http-server.context.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-server.context.types.js","sourceRoot":"","sources":["../../../../examples/simple-http-server/contexts/http-server.context.types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uFAA6E;AAC7E,6FAAoF;AACpF,6FAAoF;AACpF,6FAAoF;AAapF,mCAAmC;AAGnC;;GAEG;AACH,MAAM,IAAK,SAAQ,+BAAW;IAA9B;;QAEY,WAAM,GAAe,EAAE,CAAC;IAcpC,CAAC;IAVG,aAAa,CAAC,KAAU;QACpB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,CACH,UAAe;QAEf,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;CAEJ;AAGD;;GAEG;AACH,MAAM,UAAW,SAAQ,+BAAiB;IAIhC,OAAO;;YACT,oBAAoB;YACpB,IAAI,CAAC,SAAS,CAAC,OAAO;YAClB,mBAAmB;YACnB,YAAY,CACf,CAAC;QACN,CAAC;KAAA;IAIK,IAAI;;YACN,IAAI,CAAC,SAAS,CAAC,aAAa;YACxB,mBAAmB;YACnB,OAAO,CACV,CAAC;QACN,CAAC;KAAA;CACJ;AAhBS;IADL,gCAAW,CAAC,IAAI,EAAE;yCAOlB;AAIK;IADL,gCAAW,CAAC,IAAI,EAAE;sCAMlB;AAIL;;GAEG;AACH,MAAM,oBAAqB,SAAQ,+BAAW;IAEpC,IAAI,CAAC,KAAU;;YACjB,iBAAiB;QACrB,CAAC;KAAA;IAEK,IAAI,CAAC,KAAU;;YACjB,iBAAiB;QACrB,CAAC;KAAA;IAEK,MAAM,CAAC,KAAU;;YACnB,mBAAmB;QACvB,CAAC;KAAA;CAEJ;AAID,MAAM,MAAO,SAAQ,+BAAW;IAAhC;;QAEY,UAAK,GAAe,EAAE,CAAC;IAiBnC,CAAC;IAfG,eAAe;IACf,+CAA+C;IAC/C,iCAAiC;IACjC,4CAA4C;IAC5C,oBAAoB;IAEpB,YAAY;IAEZ,YAAY,CAAC,IAAS;QAClB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEtB,6BAA6B;IAGjC,CAAC;CACJ"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { A_Namespace } from "../../../src/global/A-Namespace/A_Namespace.class";
|
|
2
|
+
import { IncomingMessage, Server } from "http";
|
|
3
|
+
import { A_TYPES__HttpServerNamespaceConstructor } from "./http-server.context.types";
|
|
4
|
+
export declare class HttpServer extends A_Namespace<A_TYPES__HttpServerNamespaceConstructor> {
|
|
5
|
+
servers: Map<string, Server>;
|
|
6
|
+
get port(): number;
|
|
7
|
+
registerServer(server: Server, port: number): void;
|
|
8
|
+
getServer(port: number): Server<typeof IncomingMessage, typeof import("http").ServerResponse> | undefined;
|
|
9
|
+
parseBody(req: IncomingMessage): Promise<any>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HttpServer = void 0;
|
|
4
|
+
const A_Namespace_class_1 = require("../../../src/global/A-Namespace/A_Namespace.class");
|
|
5
|
+
class HttpServer extends A_Namespace_class_1.A_Namespace {
|
|
6
|
+
get port() {
|
|
7
|
+
const [name, port] = this.name.split(':');
|
|
8
|
+
return parseInt(port);
|
|
9
|
+
}
|
|
10
|
+
registerServer(server, port) {
|
|
11
|
+
this.servers.set(port.toString(), server);
|
|
12
|
+
}
|
|
13
|
+
getServer(port) {
|
|
14
|
+
return this.servers.get(port.toString());
|
|
15
|
+
}
|
|
16
|
+
parseBody(req) {
|
|
17
|
+
return new Promise((resolve, reject) => {
|
|
18
|
+
let body = '';
|
|
19
|
+
req.on('data', chunk => body += chunk.toString());
|
|
20
|
+
req.on('end', () => resolve(JSON.parse(body)));
|
|
21
|
+
req.on('error', reject);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.HttpServer = HttpServer;
|
|
26
|
+
//# sourceMappingURL=http-server.namespace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-server.namespace.js","sourceRoot":"","sources":["../../../../examples/simple-http-server/contexts/http-server.namespace.ts"],"names":[],"mappings":";;;AAAA,6FAAoF;AAKpF,MAAa,UAAW,SAAQ,+BAAoD;IAOhF,IAAI,IAAI;QACJ,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAE1C,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAGD,cAAc,CAAC,MAAc,EAAE,IAAY;QACvC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED,SAAS,CAAC,IAAY;QAClB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,SAAS,CAAC,GAAoB;QAC1B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACnC,IAAI,IAAI,GAAG,EAAE,CAAC;YACd,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;YAClD,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC/C,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AA9BD,gCA8BC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// declare module "../modules/simple-http-server.types" {
|
|
3
|
+
// interface SimpleHTTPServerModuleControllers {
|
|
4
|
+
// Orders: OrderController
|
|
5
|
+
// }
|
|
6
|
+
// }
|
|
7
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.OrderController = void 0;
|
|
18
|
+
const A_Component_class_1 = require("../../../src/global/A-Component/A-Component.class");
|
|
19
|
+
class OrderController extends A_Component_class_1.A_Component {
|
|
20
|
+
makeSome1() {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
console.log('Making some request');
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
makeSome2() {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
console.log('Making some request');
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.OrderController = OrderController;
|
|
32
|
+
//# sourceMappingURL=orders.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orders.controller.js","sourceRoot":"","sources":["../../../../examples/simple-http-server/controllers/orders.controller.ts"],"names":[],"mappings":";AACA,yDAAyD;AACzD,oDAAoD;AACpD,kCAAkC;AAClC,QAAQ;AACR,IAAI;;;;;;;;;;;;AAEJ,6FAAmF;AAEnF,MAAa,eAAgB,SAAQ,+BAAW;IAEtC,SAAS;;YACX,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAA;QACtC,CAAC;KAAA;IAEK,SAAS;;YACX,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAA;QACtC,CAAC;KAAA;CAEJ;AAVD,0CAUC"}
|
|
File without changes
|