web_api_base 2.6.2 → 2.7.1

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.
Files changed (35) hide show
  1. package/package.json +6 -1
  2. package/readme.md +23 -14
  3. package/dist/Application.d.ts +0 -16
  4. package/dist/Application.js +0 -164
  5. package/dist/Application.js.map +0 -1
  6. package/dist/ApplicationConfiguration.d.ts +0 -11
  7. package/dist/ApplicationConfiguration.js +0 -70
  8. package/dist/ApplicationConfiguration.js.map +0 -1
  9. package/dist/controllers/base/ControllerBase.d.ts +0 -12
  10. package/dist/controllers/base/ControllerBase.js +0 -31
  11. package/dist/controllers/base/ControllerBase.js.map +0 -1
  12. package/dist/decorators/controllers/ControllerDecorators.d.ts +0 -36
  13. package/dist/decorators/controllers/ControllerDecorators.js +0 -112
  14. package/dist/decorators/controllers/ControllerDecorators.js.map +0 -1
  15. package/dist/dependencyInjection/DependecyService.d.ts +0 -18
  16. package/dist/dependencyInjection/DependecyService.js +0 -76
  17. package/dist/dependencyInjection/DependecyService.js.map +0 -1
  18. package/dist/enums/httpVerbs/HttpVerbs.d.ts +0 -6
  19. package/dist/enums/httpVerbs/HttpVerbs.js +0 -11
  20. package/dist/enums/httpVerbs/HttpVerbs.js.map +0 -1
  21. package/dist/index.d.ts +0 -23
  22. package/dist/index.js +0 -58
  23. package/dist/index.js.map +0 -1
  24. package/dist/interfaces/IApplication.d.ts +0 -7
  25. package/dist/interfaces/IApplication.js +0 -3
  26. package/dist/interfaces/IApplication.js.map +0 -1
  27. package/dist/interfaces/IApplicationConfiguration.d.ts +0 -6
  28. package/dist/interfaces/IApplicationConfiguration.js +0 -3
  29. package/dist/interfaces/IApplicationConfiguration.js.map +0 -1
  30. package/dist/interfaces/IController.d.ts +0 -5
  31. package/dist/interfaces/IController.js +0 -3
  32. package/dist/interfaces/IController.js.map +0 -1
  33. package/dist/midlewares/IMidleware.d.ts +0 -9
  34. package/dist/midlewares/IMidleware.js +0 -3
  35. package/dist/midlewares/IMidleware.js.map +0 -1
package/package.json CHANGED
@@ -1,12 +1,17 @@
1
1
  {
2
2
  "name": "web_api_base",
3
- "version": "2.6.2",
3
+ "version": "2.7.1",
4
4
  "description": "web api base",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [
8
8
  "/dist"
9
9
  ],
10
+ "bin":
11
+ {
12
+ "create-controller" : "./dist/bin/CreateController.js",
13
+ "create-application" : "./dist/bin/CreateApplication.js"
14
+ },
10
15
  "scripts": {
11
16
  "test": "jest",
12
17
  "debug": "node ./dist/Index.js",
package/readme.md CHANGED
@@ -18,17 +18,22 @@ After that, we need to create some controllers and they must inherit the abstra
18
18
 
19
19
  ### ./controllers/SampleController.ts
20
20
 
21
+ We can create a controller using the __create-controller__ command :
22
+
23
+ ```bash
24
+ npx create-controller
25
+ ```
26
+
21
27
  ```typescript
22
28
 
23
- import { ControllerBase, HTTPVerbs as verbs, Use, Verb, Route, Action } from "web_api_base";
29
+ import { ControllerBase, Route, Action } from "web_api_base";
24
30
 
25
31
 
26
- @Route("/sample")
32
+ @Route()
27
33
  export default class SampleController extends ControllerBase
28
34
  {
29
-
30
- @Verb(verbs.GET)
31
- @Action("/hello")
35
+
36
+ @Action()
32
37
  public Hello() : void
33
38
  {
34
39
  this.OK({message: "Hello Word!"})
@@ -38,7 +43,12 @@ export default class SampleController extends ControllerBase
38
43
  ```
39
44
 
40
45
  ### App.ts
46
+ We can create a app using the __create-application__ command :
41
47
 
48
+ ```bash
49
+ npx create-application
50
+ ```
51
+
42
52
  ```typescript
43
53
  import SampleController from "./controllers/SampleController ";
44
54
 
@@ -68,7 +78,7 @@ import Application from './Application';
68
78
  new Application().StartAsync();
69
79
  ```
70
80
 
71
- ## Dependecy injection service
81
+ ## Dependecy Injection
72
82
  Consider this abstraction of a service and some imnplementations
73
83
 
74
84
  ### ./services/SampleService.ts
@@ -100,10 +110,10 @@ We can use the DI service like this
100
110
 
101
111
  ```typescript
102
112
 
103
- import { ControllerBase, HTTPVerbs as verbs, Use, Verb, Route, Action } from "web_api_base";
113
+ import { ControllerBase, Route, Action, Inject } from "web_api_base";
104
114
  import {SampleServiceAbstract } from '../services/SampleService.ts';
105
115
 
106
- @Route("/sample")
116
+ @Route()
107
117
  export default class SampleController extends ControllerBase
108
118
  {
109
119
  @Inject() // say to DI that this property will be inject on the instance
@@ -114,9 +124,8 @@ export default class SampleController extends ControllerBase
114
124
  super();
115
125
  this.SomeDepency = someDependecy ;
116
126
  }
117
-
118
- @Verb(verbs.GET)
119
- @Action("/hello")
127
+
128
+ @Action()
120
129
  public Hello() : void
121
130
  {
122
131
  this.OK({message: "Hello Word!"})
@@ -131,7 +140,7 @@ And we can register our dependecies in Application ConfigureAsync method
131
140
 
132
141
  ```typescript
133
142
 
134
- import { Application, IApplicationConfiguration, DependecyService, } from "web_api_base";
143
+ import { Application, IApplicationConfiguration} from "web_api_base";
135
144
 
136
145
  import { SampleService, SampleServiceAbstract } from './service/SampleService';
137
146
 
@@ -147,8 +156,8 @@ export default class App extends Application
147
156
  {
148
157
  this.UseCors();
149
158
 
150
- // everytime some class need a SampleServiceAbstract it will get a intance of SampleService
151
- DependecyService.RegisterFor(SampleServiceAbstract, SampleService);
159
+ //DI AddScoped, AddTransient and AddSingleton
160
+ App.AddScoped(SampleServiceAbstract, SampleService);
152
161
 
153
162
  this.UseControllers();
154
163
 
@@ -1,16 +0,0 @@
1
- import { Express } from "express";
2
- import IApplication from "./interfaces/IApplication";
3
- import IApplicationConfiguration from "./interfaces/IApplicationConfiguration";
4
- import IController from "./interfaces/IController";
5
- export default abstract class Application implements IApplication {
6
- private ApplicationConfiguration;
7
- Express: Express;
8
- constructor();
9
- StartAsync(): Promise<void>;
10
- UseCors(): void;
11
- protected UseControllers(root?: string): Promise<void>;
12
- protected AppendController<T extends IController>(ctor: {
13
- new (...args: any[]): T;
14
- }): void;
15
- abstract ConfigureAsync(appConfig: IApplicationConfiguration): Promise<void>;
16
- }
@@ -1,164 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- var __importDefault = (this && this.__importDefault) || function (mod) {
35
- return (mod && mod.__esModule) ? mod : { "default": mod };
36
- };
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- const express_1 = __importDefault(require("express"));
39
- const ApplicationConfiguration_1 = __importDefault(require("./ApplicationConfiguration"));
40
- const ControllerDecorators_1 = __importDefault(require("./decorators/controllers/ControllerDecorators"));
41
- const DependecyService_1 = __importDefault(require("./dependencyInjection/DependecyService"));
42
- const HttpVerbs_1 = require("./enums/httpVerbs/HttpVerbs");
43
- const fs_1 = __importDefault(require("fs"));
44
- const path_1 = __importDefault(require("path"));
45
- class Application {
46
- constructor() {
47
- this.ApplicationConfiguration = new ApplicationConfiguration_1.default();
48
- this.Express = (0, express_1.default)();
49
- }
50
- StartAsync() {
51
- return __awaiter(this, void 0, void 0, function* () {
52
- yield this.ApplicationConfiguration.StartAsync();
53
- this.Express.use(express_1.default.json({ limit: 50 * 1024 * 1024 }));
54
- yield this.ConfigureAsync(this.ApplicationConfiguration);
55
- this.Express.listen(this.ApplicationConfiguration.Port, this.ApplicationConfiguration.Host, () => {
56
- console.log(`App running on ${this.ApplicationConfiguration.Host}:${this.ApplicationConfiguration.Port}`);
57
- });
58
- });
59
- }
60
- UseCors() {
61
- this.Express.use(require('cors')());
62
- }
63
- UseControllers(root) {
64
- return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
65
- let controllersPath = path_1.default.join(root !== null && root !== void 0 ? root : this.ApplicationConfiguration.RootPath, "controllers");
66
- console.debug(`reading controllers in ${controllersPath}`);
67
- if (!fs_1.default.existsSync(controllersPath))
68
- return;
69
- let files = fs_1.default.readdirSync(controllersPath).filter(s => s.toLocaleLowerCase().endsWith("controller.js"));
70
- for (let controllerFile of files) {
71
- try {
72
- let controllerClass = yield Promise.resolve().then(() => __importStar(require(path_1.default.join(controllersPath, controllerFile))));
73
- let controller = Reflect.construct(controllerClass.default.prototype.constructor, []);
74
- if (controller != undefined && controller != null) {
75
- this.AppendController(controllerClass.default.prototype.constructor);
76
- }
77
- }
78
- catch (_a) { }
79
- }
80
- resolve();
81
- }));
82
- }
83
- AppendController(ctor) {
84
- let empty = new ctor();
85
- let methods = Reflect.ownKeys(empty.constructor.prototype).filter(m => {
86
- return typeof empty[m] == "function";
87
- });
88
- let route = ControllerDecorators_1.default.GetRoute(empty);
89
- if (!route)
90
- return;
91
- for (let method of methods) {
92
- let action = ControllerDecorators_1.default.GetAction(empty, method.toString());
93
- if (!action) {
94
- continue;
95
- }
96
- let verb = ControllerDecorators_1.default.GetVerb(empty, method.toString());
97
- if (!verb)
98
- verb = HttpVerbs_1.HTTPVerbs.GET;
99
- console.debug("appended : ", verb, `${route}${action}`);
100
- this.Express[verb.toString().toLowerCase()](`${route}${action}`, (request, response) => {
101
- let midlewares = ControllerDecorators_1.default.GetMidlewares(empty).reverse();
102
- midlewares.push(...ControllerDecorators_1.default.GetBefores(empty, method.toString()).reverse());
103
- let handler = (context) => {
104
- let args = ControllerDecorators_1.default.GetArgumentsHandler(empty, method.toString());
105
- let params = [];
106
- if (args) {
107
- if (args.Arguments.length > 0) {
108
- if (context.Request.body && verb == (HttpVerbs_1.HTTPVerbs.POST || verb == HttpVerbs_1.HTTPVerbs.PUT))
109
- params = args.CreateArgumentsList(context.Request.body);
110
- if (context.Request.query)
111
- params.push(...args.CreateArgumentsList(context.Request.query));
112
- }
113
- }
114
- let controller = DependecyService_1.default.ResolveCtor(empty.constructor);
115
- if (controller == undefined)
116
- controller = new ctor();
117
- DependecyService_1.default.CheckForDependenciesAndResolve(controller);
118
- controller.Request = context.Request;
119
- controller.Response = context.Response;
120
- controller[method](...params);
121
- };
122
- if (midlewares && midlewares.length > 0) {
123
- let httpRequestContexts = [];
124
- let pipeline = [];
125
- for (let i = 0; i <= midlewares.length; i++) {
126
- httpRequestContexts.push({
127
- Request: request,
128
- Response: response,
129
- Next: () => { }
130
- });
131
- }
132
- for (let i = 0; i < httpRequestContexts.length; i++) {
133
- let box = {
134
- v: i
135
- };
136
- pipeline.push({
137
- Execute: () => {
138
- pipeline.length - 1 == box.v ? handler(httpRequestContexts[box.v]) : midlewares[box.v](httpRequestContexts[box.v]);
139
- },
140
- Next: () => {
141
- let call = pipeline.length - 1 == box.v ? undefined : pipeline[box.v + 1];
142
- if (call != undefined)
143
- call.Execute();
144
- }
145
- });
146
- }
147
- for (let i = 0; i < pipeline.length; i++) {
148
- httpRequestContexts[i].Next = i == pipeline.length - 1 ? () => { } : () => pipeline[i + 1].Execute();
149
- }
150
- pipeline[0].Execute();
151
- }
152
- else {
153
- handler({
154
- Request: request,
155
- Response: response,
156
- Next: () => { }
157
- });
158
- }
159
- });
160
- }
161
- }
162
- }
163
- exports.default = Application;
164
- //# sourceMappingURL=Application.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Application.js","sourceRoot":"","sources":["../Application.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sDAAoC;AACpC,0FAAiE;AAIjE,yGAAkF;AAClF,8FAAsE;AACtE,2DAAwD;AAGxD,4CAAsB;AACtB,gDAAwB;AAGxB,MAA8B,WAAW;IAQrC;QAEI,IAAI,CAAC,wBAAwB,GAAG,IAAI,kCAAwB,EAAE,CAAC;QAE/D,IAAI,CAAC,OAAO,GAAG,IAAA,iBAAa,GAAE,CAAC;IAEnC,CAAC;IAGY,UAAU;;YAEnB,MAAM,IAAI,CAAC,wBAAwB,CAAC,UAAU,EAAE,CAAC;YAEjD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAa,CAAC,IAAI,CAAC,EAAC,KAAK,EAAG,EAAE,GAAG,IAAI,GAAG,IAAI,EAAC,CAAC,CAAC,CAAC;YAEjE,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;YAEzD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,IAAI,EAAE,IAAI,CAAC,wBAAwB,CAAC,IAAI,EAAE,GAAE,EAAE;gBAE5F,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,CAAC,wBAAwB,CAAC,IAAI,IAAI,IAAI,CAAC,wBAAwB,CAAC,IAAI,EAAE,CAAC,CAAC;YAC9G,CAAC,CAAC,CAAA;QACN,CAAC;KAAA;IAEM,OAAO;QAEV,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,EAA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;oBAED,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;iBACzB;qBACG;oBAEA,OAAO,CAAC;wBACJ,OAAO,EAAG,OAAO;wBACjB,QAAQ,EAAG,QAAQ;wBACnB,IAAI,EAAG,GAAG,EAAE,GAAE,CAAC;qBAClB,CAAC,CAAC;iBACN;YAGL,CAAC,CAAC,CAAA;SACL;IAEL,CAAC;CAMJ;AAlND,8BAkNC"}
@@ -1,11 +0,0 @@
1
- import IApplicationConfiguration from './interfaces/IApplicationConfiguration';
2
- export default class Configuration implements IApplicationConfiguration {
3
- Host: string;
4
- Port: number;
5
- RootPath: string;
6
- constructor();
7
- StartAsync(): Promise<void>;
8
- private CheckFileAsync;
9
- private ReadFileAsync;
10
- private CreateFileAsync;
11
- }
@@ -1,70 +0,0 @@
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
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const fs_1 = __importDefault(require("fs"));
16
- class Configuration {
17
- constructor() {
18
- var _a, _b;
19
- this.Host = "0.0.0.0";
20
- this.Port = 5555;
21
- this.RootPath = (_b = (_a = process.mainModule) === null || _a === void 0 ? void 0 : _a.path) !== null && _b !== void 0 ? _b : __dirname;
22
- }
23
- StartAsync() {
24
- return __awaiter(this, void 0, void 0, function* () {
25
- if (!(yield this.CheckFileAsync())) {
26
- yield this.CreateFileAsync();
27
- }
28
- else {
29
- yield this.ReadFileAsync();
30
- }
31
- });
32
- }
33
- CheckFileAsync() {
34
- return __awaiter(this, void 0, void 0, function* () {
35
- return new Promise((resolve, _) => resolve(fs_1.default.existsSync(`${__dirname}\\config.json`)));
36
- });
37
- }
38
- ReadFileAsync() {
39
- return __awaiter(this, void 0, void 0, function* () {
40
- return new Promise((resolve, _) => {
41
- fs_1.default.readFile(`${__dirname}\\config.json`, 'utf-8', (error, data) => {
42
- if (error) {
43
- throw error;
44
- }
45
- let json = JSON.parse(data);
46
- for (let key in this) {
47
- if (json[key] != undefined) {
48
- this[key] = json[key];
49
- }
50
- }
51
- resolve(true);
52
- });
53
- });
54
- });
55
- }
56
- CreateFileAsync() {
57
- return __awaiter(this, void 0, void 0, function* () {
58
- return new Promise((resolve, _) => {
59
- fs_1.default.writeFile(`${__dirname}\\config.json`, JSON.stringify(this), 'utf-8', error => {
60
- if (error) {
61
- throw error;
62
- }
63
- resolve(true);
64
- });
65
- });
66
- });
67
- }
68
- }
69
- exports.default = Configuration;
70
- //# sourceMappingURL=ApplicationConfiguration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ApplicationConfiguration.js","sourceRoot":"","sources":["../ApplicationConfiguration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,4CAAsB;AAKtB,MAAqB,aAAa;IAO9B;;QAJO,SAAI,GAAY,SAAS,CAAC;QAC1B,SAAI,GAAY,IAAI,CAAC;QAKxB,IAAI,CAAC,QAAQ,GAAG,MAAA,MAAA,OAAO,CAAC,UAAU,0CAAE,IAAI,mCAAI,SAAS,CAAC;IAC1D,CAAC;IAEY,UAAU;;YAEnB,IAAG,CAAC,CAAA,MAAM,IAAI,CAAC,cAAc,EAAE,CAAA,EAC/B;gBACI,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;aAEhC;iBAAI;gBAED,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;aAC9B;QACL,CAAC;KAAA;IAEa,cAAc;;YAExB,OAAO,IAAI,OAAO,CAAU,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,YAAI,CAAC,UAAU,CAAC,GAAG,SAAS,eAAe,CAAC,CAAC,CAAC,CAAC;QACvG,CAAC;KAAA;IAEa,aAAa;;YAEvB,OAAO,IAAI,OAAO,CAAU,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE;gBAEvC,YAAI,CAAC,QAAQ,CAAC,GAAG,SAAS,eAAe,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;oBAEhE,IAAG,KAAK,EACR;wBACI,MAAM,KAAK,CAAC;qBACf;oBAED,IAAI,IAAI,GAAS,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;oBAElC,KAAI,IAAI,GAAG,IAAI,IAAI,EACnB;wBACI,IAAG,IAAI,CAAC,GAAG,CAAC,IAAI,SAAS,EACzB;4BACI,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;yBACzB;qBACJ;oBAED,OAAO,CAAC,IAAI,CAAC,CAAC;gBAElB,CAAC,CAAC,CAAA;YACN,CAAC,CAAC,CAAA;QACN,CAAC;KAAA;IAEa,eAAe;;YAGzB,OAAO,IAAI,OAAO,CAAU,CAAC,OAAO,EAAE,CAAC,EAAC,EAAE;gBAEtC,YAAI,CAAC,SAAS,CAAC,GAAG,SAAS,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE;oBAG/E,IAAG,KAAK,EACR;wBACI,MAAM,KAAK,CAAC;qBACf;oBAED,OAAO,CAAC,IAAI,CAAC,CAAC;gBAElB,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAA;QAEN,CAAC;KAAA;CAEJ;AA5ED,gCA4EC"}
@@ -1,12 +0,0 @@
1
- import IController from "../../interfaces/IController";
2
- import { Request, Response } from 'express';
3
- export declare class ControllerBase implements IController {
4
- Request: Request;
5
- Response: Response;
6
- constructor();
7
- OK<T>(result: T): void;
8
- Created(): void;
9
- BadRequest<T>(result: T): void;
10
- Error<T>(result: T): void;
11
- SendResponse<T>(status: number, result: T): void;
12
- }
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ControllerBase = void 0;
4
- class ControllerBase {
5
- constructor() {
6
- this.Request = {};
7
- this.Response = {};
8
- }
9
- OK(result) {
10
- this.Response.status(200);
11
- this.Response.json(result);
12
- }
13
- Created() {
14
- this.Response.status(201);
15
- this.Response.end();
16
- }
17
- BadRequest(result) {
18
- this.Response.status(400);
19
- this.Response.json(result);
20
- }
21
- Error(result) {
22
- this.Response.status(500);
23
- this.Response.json(result);
24
- }
25
- SendResponse(status, result) {
26
- this.Response.status(status);
27
- this.Response.json(result);
28
- }
29
- }
30
- exports.ControllerBase = ControllerBase;
31
- //# sourceMappingURL=ControllerBase.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ControllerBase.js","sourceRoot":"","sources":["../../../controllers/base/ControllerBase.ts"],"names":[],"mappings":";;;AAIA,MAAa,cAAc;IAKvB;QAHA,YAAO,GAAa,EAAa,CAAC;QAClC,aAAQ,GAAc,EAAc,CAAC;IAKrC,CAAC;IAEM,EAAE,CAAI,MAAU;QAEnB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAEM,OAAO;QAEV,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;IACxB,CAAC;IAEM,UAAU,CAAI,MAAU;QAE3B,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAEM,KAAK,CAAI,MAAU;QAEtB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAEM,YAAY,CAAI,MAAe,EAAE,MAAU;QAE9C,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC7B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;CAEJ;AAxCD,wCAwCC"}
@@ -1,36 +0,0 @@
1
- import 'reflect-metadata';
2
- import { HTTPVerbs } from '../../enums/httpVerbs/HttpVerbs';
3
- import IController from '../../interfaces/IController';
4
- import IMidleware from '../../midlewares/IMidleware';
5
- export default class ControllersDecorators {
6
- constructor();
7
- private static RouteKeyMetadata;
8
- private static ActionVerbKeyMetadata;
9
- private static ActionNameKeyMetadata;
10
- private static ArgumentsHandlerKeyMetadata;
11
- private static ControllerMidlewaresKeyMetadata;
12
- private static ActionsMidlewaresKeyMetadata;
13
- static Route(route?: string): (target: Function) => void;
14
- static Use(midleware: IMidleware): (target: Function) => void;
15
- static GetMidlewares(controller: IController): IMidleware[];
16
- static Before(midleware: IMidleware): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
17
- static GetBefores(controller: IController, methodName: string): IMidleware[];
18
- static GetRoute(controller: IController): string | undefined;
19
- static Verb(verb: HTTPVerbs): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
20
- static GetVerb(target: IController, methodName: string): HTTPVerbs | undefined;
21
- static Action(actionName?: String): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
22
- static GetAction(target: IController, methodName: string): string | undefined;
23
- static Argument<T>(argName1: string): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
24
- static Argument<T, U>(argName1: string, argName2?: string): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
25
- static Argument<T, U, K>(argName1: string, argName2?: string, argName3?: string): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
26
- static Argument<T, U, K, Y>(argName1: string, argName2?: string, argName3?: string, argName4?: string): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
27
- static Argument<T, U, K, Y, J>(argName1: string, argName2?: string, argName3?: string, argName4?: string, argName5?: string): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
28
- static GetArgumentsHandler(target: IController, methodName: string): IArgumentResolverHandler | undefined;
29
- private static SetMetaData;
30
- private static GetMetaData;
31
- }
32
- interface IArgumentResolverHandler {
33
- Arguments: string[];
34
- CreateArgumentsList: (args: any) => any[];
35
- }
36
- export {};
@@ -1,112 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- require("reflect-metadata");
4
- class ControllersDecorators {
5
- constructor() {
6
- }
7
- static Route(route) {
8
- return function (target) {
9
- let value = route !== null && route !== void 0 ? route : target.name.toLocaleLowerCase().replace("controller", "");
10
- Reflect.defineMetadata(ControllersDecorators.RouteKeyMetadata, value, target);
11
- };
12
- }
13
- static Use(midleware) {
14
- return function (target) {
15
- var _a;
16
- let current = (_a = Reflect.getMetadata(ControllersDecorators.ControllerMidlewaresKeyMetadata, target)) !== null && _a !== void 0 ? _a : [];
17
- current.push(midleware);
18
- Reflect.defineMetadata(ControllersDecorators.ControllerMidlewaresKeyMetadata, current, target);
19
- };
20
- }
21
- static GetMidlewares(controller) {
22
- var _a;
23
- return (_a = Reflect.getMetadata(ControllersDecorators.ControllerMidlewaresKeyMetadata, controller.constructor)) !== null && _a !== void 0 ? _a : [];
24
- }
25
- static Before(midleware) {
26
- return function (target, methodName, propertyDescriptor) {
27
- var _a;
28
- let current = (_a = Reflect.getMetadata(ControllersDecorators.ActionsMidlewaresKeyMetadata, target, methodName)) !== null && _a !== void 0 ? _a : [];
29
- current.push(midleware);
30
- ControllersDecorators.SetMetaData(ControllersDecorators.ActionsMidlewaresKeyMetadata, target, methodName, current);
31
- };
32
- }
33
- static GetBefores(controller, methodName) {
34
- var _a;
35
- return (_a = this.GetMetaData(ControllersDecorators.ActionsMidlewaresKeyMetadata, controller, methodName)) !== null && _a !== void 0 ? _a : [];
36
- }
37
- static GetRoute(controller) {
38
- let meta = Reflect.getMetadata(ControllersDecorators.RouteKeyMetadata, controller.constructor);
39
- if (meta && meta[0] != '/') {
40
- return `/${meta}`;
41
- }
42
- return meta;
43
- }
44
- static Verb(verb) {
45
- return function (target, methodName, propertyDescriptor) {
46
- ControllersDecorators.SetMetaData(ControllersDecorators.ActionVerbKeyMetadata, target, methodName, verb);
47
- };
48
- }
49
- static GetVerb(target, methodName) {
50
- let meta = this.GetMetaData(ControllersDecorators.ActionVerbKeyMetadata, target, methodName);
51
- return meta;
52
- }
53
- static Action(actionName) {
54
- return function (target, methodName, propertyDescriptor) {
55
- ControllersDecorators.SetMetaData(ControllersDecorators.ActionNameKeyMetadata, target, methodName, actionName !== null && actionName !== void 0 ? actionName : methodName.toLocaleLowerCase());
56
- };
57
- }
58
- static GetAction(target, methodName) {
59
- let meta = this.GetMetaData(ControllersDecorators.ActionNameKeyMetadata, target, methodName);
60
- if (meta && meta[0] != '/') {
61
- return `/${meta}`;
62
- }
63
- return meta;
64
- }
65
- static Argument(argName1, argName2, argName3, argName4, argName5, argName6) {
66
- return function (target, methodName, propertyDescriptor) {
67
- ControllersDecorators.SetMetaData(ControllersDecorators.ArgumentsHandlerKeyMetadata, target, methodName, {
68
- Arguments: [argName1, argName2, argName3, argName4, argName5, argName6],
69
- CreateArgumentsList: (args) => {
70
- let results = [];
71
- if (argName1 && args[argName1] != undefined)
72
- results[0] = args[argName1];
73
- if (argName2 && args[argName2] != undefined)
74
- results[1] = args[argName2];
75
- if (argName3 && args[argName3] != undefined)
76
- results[2] = args[argName3];
77
- if (argName4 && args[argName4] != undefined)
78
- results[3] = args[argName4];
79
- if (argName5 && args[argName5] != undefined)
80
- results[4] = args[argName5];
81
- if (argName6 && args[argName6] != undefined)
82
- results[5] = args[argName6];
83
- return results;
84
- }
85
- });
86
- };
87
- }
88
- static GetArgumentsHandler(target, methodName) {
89
- let handler = this.GetMetaData(ControllersDecorators.ArgumentsHandlerKeyMetadata, target, methodName);
90
- return handler;
91
- }
92
- static SetMetaData(key, target, methodName, value) {
93
- var meta = Reflect.getOwnMetadata(key, target, methodName);
94
- if (!meta)
95
- Reflect.defineMetadata(key, value, target, methodName);
96
- }
97
- static GetMetaData(key, target, methodName) {
98
- var meta = Reflect.getMetadata(key, target, methodName);
99
- if (meta != undefined)
100
- return meta;
101
- else
102
- return undefined;
103
- }
104
- }
105
- exports.default = ControllersDecorators;
106
- ControllersDecorators.RouteKeyMetadata = "meta:controllerRoute";
107
- ControllersDecorators.ActionVerbKeyMetadata = "meta:actionVerb";
108
- ControllersDecorators.ActionNameKeyMetadata = "meta:actionName";
109
- ControllersDecorators.ArgumentsHandlerKeyMetadata = "meta:argHandler";
110
- ControllersDecorators.ControllerMidlewaresKeyMetadata = "meta:controllerMidlewaresKey";
111
- ControllersDecorators.ActionsMidlewaresKeyMetadata = "meta:actionMidlewaresKey";
112
- //# sourceMappingURL=ControllerDecorators.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ControllerDecorators.js","sourceRoot":"","sources":["../../../decorators/controllers/ControllerDecorators.ts"],"names":[],"mappings":";;AACA,4BAA0B;AAM1B,MAAqB,qBAAqB;IAEtC;IAGA,CAAC;IAUM,MAAM,CAAC,KAAK,CAAC,KAAe;QAE/B,OAAO,UAAU,MAAiB;YAE9B,IAAI,KAAK,GAAG,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,MAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,OAAO,CAAC,YAAY,EAAC,EAAE,CAAC,CAAC;YAC9E,OAAO,CAAC,cAAc,CAAC,qBAAqB,CAAC,gBAAgB,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC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;aACJ,CAAC,CAAC;QAEX,CAAC,CAAA;IACL,CAAC;IAIM,MAAM,CAAC,mBAAmB,CAAC,MAAoB,EAAE,UAAmB;QAEvE,IAAI,OAAO,GAAG,IAAI,CAAC,WAAW,CAA2B,qBAAqB,CAAC,2BAA2B,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;QAEhI,OAAO,OAAO,CAAC;IACnB,CAAC;IAEO,MAAM,CAAC,WAAW,CAAI,GAAW,EAAE,MAAe,EAAE,UAAmB,EAAE,KAAS;QAEtF,IAAI,IAAI,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,EAAE,MAAgB,EAAE,UAAU,CAAC,CAAC;QAErE,IAAG,CAAC,IAAI;YACJ,OAAO,CAAC,cAAc,CAAC,GAAG,EAAE,KAAK,EAAE,MAAgB,EAAE,UAAU,CAAC,CAAC;IACzE,CAAC;IAGO,MAAM,CAAC,WAAW,CAAI,GAAW,EAAE,MAAe,EAAE,UAAmB;QAE3E,IAAI,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;QAExD,IAAG,IAAI,IAAI,SAAS;YAChB,OAAO,IAAS,CAAC;;YAEjB,OAAO,SAAS,CAAC;IACzB,CAAC;;AAxLL,wCA0LC;AAnLkB,sCAAgB,GAAG,sBAAsB,CAAC;AAC1C,2CAAqB,GAAG,iBAAiB,CAAC;AAC1C,2CAAqB,GAAG,iBAAiB,CAAC;AAC1C,iDAA2B,GAAG,iBAAiB,CAAC;AAChD,qDAA+B,GAAG,8BAA8B,CAAC;AACjE,kDAA4B,GAAG,0BAA0B,CAAC"}
@@ -1,18 +0,0 @@
1
- import 'reflect-metadata';
2
- export default class DependecyService {
3
- private static _services;
4
- private static _injectableKey;
5
- private static _injectableTypeKey;
6
- static RegisterFor(type: Function, ctor: {
7
- new (...args: any[]): any;
8
- }, builder?: () => any): void;
9
- static Register(type: Function, builder?: () => any): void;
10
- static Resolve<T>(type: Function, args?: any[]): T;
11
- static ResolveCtor(ctor: Function, args?: any[]): any;
12
- static Injectable(): (target: Object, property: string | symbol) => void;
13
- static IsInjectable(target: object, property: string): boolean;
14
- static InjectOne(tp: Function): (target: Object, property: string | symbol) => void;
15
- static GetDIType(target: object, property: string): any;
16
- static CheckForDependenciesAndResolve(object: any): void;
17
- static Build<T extends Function>(Ctor: T): T;
18
- }
@@ -1,76 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- require("reflect-metadata");
4
- class DependecyService {
5
- static RegisterFor(type, ctor, builder) {
6
- let defaultBuilder = () => Reflect.construct(ctor !== null && ctor !== void 0 ? ctor : type, []);
7
- let exist = this._services.find(s => s.Type == type);
8
- if (exist === undefined)
9
- this._services.push({ Type: type, Builder: builder !== null && builder !== void 0 ? builder : defaultBuilder });
10
- else
11
- exist.Builder = builder !== null && builder !== void 0 ? builder : defaultBuilder;
12
- }
13
- static Register(type, builder) {
14
- let defaultBuilder = () => Reflect.construct(type, []);
15
- let exist = this._services.find(s => s.Type == type);
16
- if (exist === undefined)
17
- this._services.push({ Type: type, Builder: builder !== null && builder !== void 0 ? builder : defaultBuilder });
18
- else
19
- exist.Builder = builder !== null && builder !== void 0 ? builder : defaultBuilder;
20
- }
21
- static Resolve(type, args) {
22
- var _a;
23
- return (_a = this._services.find(u => u.Type == type)) === null || _a === void 0 ? void 0 : _a.Builder(args);
24
- }
25
- static ResolveCtor(ctor, args) {
26
- var _a;
27
- return (_a = this._services.find(u => u.Type == ctor)) === null || _a === void 0 ? void 0 : _a.Builder(args);
28
- }
29
- static Injectable() {
30
- return function (target, property) {
31
- Reflect.defineMetadata(DependecyService._injectableKey, true, target.constructor, property);
32
- };
33
- }
34
- static IsInjectable(target, property) {
35
- var _a;
36
- let marked = (_a = Reflect.getMetadata(DependecyService._injectableKey, target, property)) !== null && _a !== void 0 ? _a : false;
37
- let type = Reflect.getMetadata(DependecyService._injectableTypeKey, target, property) != undefined;
38
- return marked || type;
39
- }
40
- static InjectOne(tp) {
41
- return function (target, property) {
42
- Reflect.defineMetadata(DependecyService._injectableTypeKey, tp, target.constructor, property);
43
- };
44
- }
45
- static GetDIType(target, property) {
46
- let type = Reflect.getMetadata(DependecyService._injectableTypeKey, target.constructor, property);
47
- if (!type)
48
- type = Reflect.getMetadata("design:type", target, property);
49
- return type;
50
- }
51
- static CheckForDependenciesAndResolve(object) {
52
- for (let k of Object.keys(object)) {
53
- if (object[k] != 'function') {
54
- if (DependecyService.IsInjectable(object.constructor, k)) {
55
- let tp = DependecyService.GetDIType(object, k);
56
- if (tp == undefined)
57
- throw new Error(`Can not resolve the dependecy of ${object.constructor.name}.${k}`);
58
- let instance = DependecyService.Resolve(tp);
59
- if (instance == undefined)
60
- throw new Error(`Can not resolve the dependecy of ${object.constructor.name}.${k}`);
61
- object[k] = instance;
62
- }
63
- }
64
- }
65
- }
66
- static Build(Ctor) {
67
- let object = Reflect.construct(Ctor, []);
68
- this.CheckForDependenciesAndResolve(object);
69
- return object;
70
- }
71
- }
72
- exports.default = DependecyService;
73
- DependecyService._services = [];
74
- DependecyService._injectableKey = "di:injectable";
75
- DependecyService._injectableTypeKey = "di:injectable-type";
76
- //# sourceMappingURL=DependecyService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DependecyService.js","sourceRoot":"","sources":["../../dependencyInjection/DependecyService.ts"],"names":[],"mappings":";;AAAA,4BAA0B;AAE1B,MAAqB,gBAAgB;IAO1B,MAAM,CAAC,WAAW,CAAC,IAAe,EAAE,IAAsC,EAAE,OAAoB;QAEnG,IAAI,cAAc,GAAG,GAAG,EAAE,CAAE,OAAO,CAAC,SAAS,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,IAAI,EAAE,EAAE,CAAQ,CAAC;QAEvE,IAAI,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC;QAErD,IAAG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IAAI,UAAU,EAC1B;gBACI,IAAG,gBAAgB,CAAC,YAAY,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,EACvD;oBACI,IAAI,EAAE,GAAG,gBAAgB,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;oBAE/C,IAAG,EAAE,IAAI,SAAS;wBACd,MAAM,IAAI,KAAK,CAAC,oCAAoC,MAAM,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC;oBAExF,IAAI,QAAQ,GAAG,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;oBAE5C,IAAG,QAAQ,IAAI,SAAS;wBACpB,MAAM,IAAI,KAAK,CAAC,oCAAoC,MAAM,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC;oBAExF,MAAM,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC;iBACxB;aACJ;SACJ;IACL,CAAC;IAEM,MAAM,CAAC,KAAK,CAAqB,IAAQ;QAE5C,IAAI,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAEzC,IAAI,CAAC,8BAA8B,CAAC,MAAM,CAAC,CAAC;QAE5C,OAAO,MAAW,CAAC;IACvB,CAAC;;AA7GL,mCAiHC;AA/GkB,0BAAS,GAAgB,EAAE,CAAC;AAE5B,+BAAc,GAAY,eAAe,CAAC;AAC1C,mCAAkB,GAAY,oBAAoB,CAAC"}
@@ -1,6 +0,0 @@
1
- export declare enum HTTPVerbs {
2
- GET = "GET",
3
- POST = "POST",
4
- PUT = "PUT",
5
- DELETE = "DELETE"
6
- }
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HTTPVerbs = void 0;
4
- var HTTPVerbs;
5
- (function (HTTPVerbs) {
6
- HTTPVerbs["GET"] = "GET";
7
- HTTPVerbs["POST"] = "POST";
8
- HTTPVerbs["PUT"] = "PUT";
9
- HTTPVerbs["DELETE"] = "DELETE";
10
- })(HTTPVerbs = exports.HTTPVerbs || (exports.HTTPVerbs = {}));
11
- //# sourceMappingURL=HttpVerbs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HttpVerbs.js","sourceRoot":"","sources":["../../../enums/httpVerbs/HttpVerbs.ts"],"names":[],"mappings":";;;AAAA,IAAY,SAMX;AAND,WAAY,SAAS;IAEjB,wBAAW,CAAA;IACX,0BAAa,CAAA;IACb,wBAAW,CAAA;IACX,8BAAiB,CAAA;AACrB,CAAC,EANW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAMpB"}
package/dist/index.d.ts DELETED
@@ -1,23 +0,0 @@
1
- export { default as Application } from "./Application";
2
- export { default as ApplicationConfiguration } from "./ApplicationConfiguration";
3
- export { default as ControllersDecorators } from "./decorators/controllers/ControllerDecorators";
4
- export { ControllerBase } from "./controllers/base/ControllerBase";
5
- export { HTTPVerbs } from './enums/httpVerbs/HttpVerbs';
6
- export { default as DependecyService } from "./dependencyInjection/DependecyService";
7
- export { default as IMidleware } from './midlewares/IMidleware';
8
- export { default as IApplicationConfiguration } from "./interfaces/IApplicationConfiguration";
9
- export { default as IApplication } from "./interfaces/IApplication";
10
- export { default as IApplicatiIControllernConfiguration } from "./interfaces/IController";
11
- import { HTTPVerbs } from "./enums/httpVerbs/HttpVerbs";
12
- import IMidleware from "./midlewares/IMidleware";
13
- export declare function Use(midleware: IMidleware): (target: Function) => void;
14
- export declare function Run(midleware: IMidleware): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
15
- export declare function Action(actionName: String): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
16
- export declare function Route(route?: string): (target: Function) => void;
17
- export declare function Verb(verb: HTTPVerbs): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
18
- export declare function Inject(): (target: Object, property: string | symbol) => void;
19
- export declare function InjectAbstract(object: Function): (target: Object, property: string | symbol) => void;
20
- export declare function Argument<T>(argName1: string): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
21
- export declare function Argument<T, U>(argName1: string, argName2?: string): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
22
- export declare function Argument<T, U, K>(argName1: string, argName2?: string, argName3?: string): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
23
- export declare function Argument<T, U, K, Y>(argName1: string, argName2?: string, argName3?: string, argName4?: string): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
package/dist/index.js DELETED
@@ -1,58 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Argument = exports.InjectAbstract = exports.Inject = exports.Verb = exports.Route = exports.Action = exports.Run = exports.Use = exports.DependecyService = exports.HTTPVerbs = exports.ControllerBase = exports.ControllersDecorators = exports.ApplicationConfiguration = exports.Application = void 0;
7
- var Application_1 = require("./Application");
8
- Object.defineProperty(exports, "Application", { enumerable: true, get: function () { return __importDefault(Application_1).default; } });
9
- var ApplicationConfiguration_1 = require("./ApplicationConfiguration");
10
- Object.defineProperty(exports, "ApplicationConfiguration", { enumerable: true, get: function () { return __importDefault(ApplicationConfiguration_1).default; } });
11
- var ControllerDecorators_1 = require("./decorators/controllers/ControllerDecorators");
12
- Object.defineProperty(exports, "ControllersDecorators", { enumerable: true, get: function () { return __importDefault(ControllerDecorators_1).default; } });
13
- var ControllerBase_1 = require("./controllers/base/ControllerBase");
14
- Object.defineProperty(exports, "ControllerBase", { enumerable: true, get: function () { return ControllerBase_1.ControllerBase; } });
15
- var HttpVerbs_1 = require("./enums/httpVerbs/HttpVerbs");
16
- Object.defineProperty(exports, "HTTPVerbs", { enumerable: true, get: function () { return HttpVerbs_1.HTTPVerbs; } });
17
- var DependecyService_1 = require("./dependencyInjection/DependecyService");
18
- Object.defineProperty(exports, "DependecyService", { enumerable: true, get: function () { return __importDefault(DependecyService_1).default; } });
19
- const ControllerDecorators_2 = __importDefault(require("./decorators/controllers/ControllerDecorators"));
20
- const DependecyService_2 = __importDefault(require("./dependencyInjection/DependecyService"));
21
- function Use(midleware) {
22
- return ControllerDecorators_2.default.Use(midleware);
23
- }
24
- exports.Use = Use;
25
- ;
26
- function Run(midleware) {
27
- return ControllerDecorators_2.default.Before(midleware);
28
- }
29
- exports.Run = Run;
30
- ;
31
- function Action(actionName) {
32
- return ControllerDecorators_2.default.Action(actionName);
33
- }
34
- exports.Action = Action;
35
- ;
36
- function Route(route) {
37
- return ControllerDecorators_2.default.Route(route);
38
- }
39
- exports.Route = Route;
40
- ;
41
- function Verb(verb) {
42
- return ControllerDecorators_2.default.Verb(verb);
43
- }
44
- exports.Verb = Verb;
45
- ;
46
- function Inject() {
47
- return DependecyService_2.default.Injectable();
48
- }
49
- exports.Inject = Inject;
50
- function InjectAbstract(object) {
51
- return DependecyService_2.default.InjectOne(object);
52
- }
53
- exports.InjectAbstract = InjectAbstract;
54
- function Argument(argName1, argName2, argName3, argName4, argName5) {
55
- return ControllerDecorators_2.default.Argument(argName1, argName2, argName3, argName4, argName5);
56
- }
57
- exports.Argument = Argument;
58
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAsD;AAA7C,2HAAA,OAAO,OAAe;AAC/B,uEAAiF;AAAxE,qJAAA,OAAO,OAA4B;AAE5C,sFAAiG;AAAxF,8IAAA,OAAO,OAAyB;AACzC,oEAAmE;AAA1D,gHAAA,cAAc,OAAA;AAEvB,yDAAwD;AAA/C,sGAAA,SAAS,OAAA;AAElB,2EAAqF;AAA5E,qIAAA,OAAO,OAAoB;AAQpC,yGAAkF;AAClF,8FAAsE;AAItE,SAAgB,GAAG,CAAC,SAAsB;IAEtC,OAAO,8BAAqB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AAChD,CAAC;AAHD,kBAGC;AAAC,CAAC;AAEH,SAAgB,GAAG,CAAC,SAAsB;IAEtC,OAAO,8BAAqB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AACnD,CAAC;AAHD,kBAGC;AAAC,CAAC;AAEH,SAAgB,MAAM,CAAC,UAAmB;IAEtC,OAAO,8BAAqB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AACpD,CAAC;AAHD,wBAGC;AAAC,CAAC;AAEH,SAAgB,KAAK,CAAC,KAAe;IAEjC,OAAO,8BAAqB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC9C,CAAC;AAHD,sBAGC;AAAC,CAAC;AAGH,SAAgB,IAAI,CAAC,IAAgB;IAGjC,OAAO,8BAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAJD,oBAIC;AAAC,CAAC;AAEH,SAAgB,MAAM;IAElB,OAAO,0BAAgB,CAAC,UAAU,EAAE,CAAC;AACzC,CAAC;AAHD,wBAGC;AAED,SAAgB,cAAc,CAAC,MAAiB;IAE5C,OAAO,0BAAgB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AAC9C,CAAC;AAHD,wCAGC;AAQD,SAAgB,QAAQ,CAAiB,QAAiB,EAAE,QAAkB,EAAE,QAAkB,EAAE,QAAkB,EAAE,QAAkB;IAEtI,OAAO,8BAAqB,CAAC,QAAQ,CAAiB,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC5G,CAAC;AAHD,4BAGC"}
@@ -1,7 +0,0 @@
1
- import { Express } from "express";
2
- import IApplicationConfiguration from './IApplicationConfiguration';
3
- export default interface IApplication {
4
- Express: Express;
5
- StartAsync(): Promise<void>;
6
- ConfigureAsync(appConfig: IApplicationConfiguration): Promise<void>;
7
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=IApplication.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IApplication.js","sourceRoot":"","sources":["../../interfaces/IApplication.ts"],"names":[],"mappings":""}
@@ -1,6 +0,0 @@
1
- export default interface IApplicationConfiguration {
2
- Host: string;
3
- Port: number;
4
- RootPath: string;
5
- StartAsync(): Promise<void>;
6
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=IApplicationConfiguration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IApplicationConfiguration.js","sourceRoot":"","sources":["../../interfaces/IApplicationConfiguration.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- import { Request, Response } from 'express';
2
- export default interface IController {
3
- Request: Request;
4
- Response: Response;
5
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=IController.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IController.js","sourceRoot":"","sources":["../../interfaces/IController.ts"],"names":[],"mappings":""}
@@ -1,9 +0,0 @@
1
- import { Request, Response } from "express";
2
- export default interface IMidleware {
3
- (context: HTTPRequestContext): void;
4
- }
5
- export interface HTTPRequestContext {
6
- Request: Request;
7
- Response: Response;
8
- Next: (context: HTTPRequestContext) => void;
9
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=IMidleware.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IMidleware.js","sourceRoot":"","sources":["../../midlewares/IMidleware.ts"],"names":[],"mappings":""}