@expressots/adapter-express 1.1.0 → 1.1.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.
- package/lib/CHANGELOG.md +11 -0
- package/lib/cjs/adapter-express/application-express.js +33 -3
- package/lib/cjs/types/adapter-express/application-base.d.ts +0 -1
- package/lib/cjs/types/adapter-express/application-express.d.ts +20 -2
- package/lib/cjs/types/adapter-express/application-express.interface.d.ts +0 -1
- package/lib/cjs/types/adapter-express/express-utils/base-middleware.d.ts +0 -1
- package/lib/cjs/types/adapter-express/express-utils/constants.d.ts +0 -1
- package/lib/cjs/types/adapter-express/express-utils/content/httpContent.d.ts +0 -1
- package/lib/cjs/types/adapter-express/express-utils/decorators.d.ts +0 -1
- package/lib/cjs/types/adapter-express/express-utils/httpResponseMessage.d.ts +0 -1
- package/lib/cjs/types/adapter-express/express-utils/index.d.ts +0 -1
- package/lib/cjs/types/adapter-express/express-utils/interfaces.d.ts +0 -1
- package/lib/cjs/types/adapter-express/express-utils/inversify-express-server.d.ts +0 -1
- package/lib/cjs/types/adapter-express/express-utils/utils.d.ts +0 -1
- package/lib/cjs/types/adapter-express/index.d.ts +0 -1
- package/lib/cjs/types/index.d.ts +0 -1
- package/lib/package.json +4 -9
- package/package.json +4 -9
- package/lib/cjs/types/adapter-express/application-base.d.ts.map +0 -1
- package/lib/cjs/types/adapter-express/application-express.d.ts.map +0 -1
- package/lib/cjs/types/adapter-express/application-express.interface.d.ts.map +0 -1
- package/lib/cjs/types/adapter-express/express-utils/base-middleware.d.ts.map +0 -1
- package/lib/cjs/types/adapter-express/express-utils/constants.d.ts.map +0 -1
- package/lib/cjs/types/adapter-express/express-utils/content/httpContent.d.ts.map +0 -1
- package/lib/cjs/types/adapter-express/express-utils/decorators.d.ts.map +0 -1
- package/lib/cjs/types/adapter-express/express-utils/httpResponseMessage.d.ts.map +0 -1
- package/lib/cjs/types/adapter-express/express-utils/index.d.ts.map +0 -1
- package/lib/cjs/types/adapter-express/express-utils/interfaces.d.ts.map +0 -1
- package/lib/cjs/types/adapter-express/express-utils/inversify-express-server.d.ts.map +0 -1
- package/lib/cjs/types/adapter-express/express-utils/utils.d.ts.map +0 -1
- package/lib/cjs/types/adapter-express/index.d.ts.map +0 -1
- package/lib/cjs/types/index.d.ts.map +0 -1
- package/lib/esm/adapter-express/application-base.js +0 -36
- package/lib/esm/adapter-express/application-express.interface.js +0 -2
- package/lib/esm/adapter-express/application-express.js +0 -152
- package/lib/esm/adapter-express/express-utils/base-middleware.js +0 -22
- package/lib/esm/adapter-express/express-utils/constants.js +0 -46
- package/lib/esm/adapter-express/express-utils/content/httpContent.js +0 -10
- package/lib/esm/adapter-express/express-utils/decorators.js +0 -110
- package/lib/esm/adapter-express/express-utils/httpResponseMessage.js +0 -33
- package/lib/esm/adapter-express/express-utils/index.js +0 -17
- package/lib/esm/adapter-express/express-utils/interfaces.js +0 -2
- package/lib/esm/adapter-express/express-utils/inversify-express-server.js +0 -293
- package/lib/esm/adapter-express/express-utils/utils.js +0 -58
- package/lib/esm/adapter-express/index.js +0 -21
- package/lib/esm/index.mjs +0 -17
- package/lib/esm/types/adapter-express/application-base.d.ts +0 -55
- package/lib/esm/types/adapter-express/application-base.d.ts.map +0 -1
- package/lib/esm/types/adapter-express/application-express.d.ts +0 -71
- package/lib/esm/types/adapter-express/application-express.d.ts.map +0 -1
- package/lib/esm/types/adapter-express/application-express.interface.d.ts +0 -29
- package/lib/esm/types/adapter-express/application-express.interface.d.ts.map +0 -1
- package/lib/esm/types/adapter-express/express-utils/base-middleware.d.ts +0 -9
- package/lib/esm/types/adapter-express/express-utils/base-middleware.d.ts.map +0 -1
- package/lib/esm/types/adapter-express/express-utils/constants.d.ts +0 -39
- package/lib/esm/types/adapter-express/express-utils/constants.d.ts.map +0 -1
- package/lib/esm/types/adapter-express/express-utils/content/httpContent.d.ts +0 -8
- package/lib/esm/types/adapter-express/express-utils/content/httpContent.d.ts.map +0 -1
- package/lib/esm/types/adapter-express/express-utils/decorators.d.ts +0 -24
- package/lib/esm/types/adapter-express/express-utils/decorators.d.ts.map +0 -1
- package/lib/esm/types/adapter-express/express-utils/httpResponseMessage.d.ts +0 -16
- package/lib/esm/types/adapter-express/express-utils/httpResponseMessage.d.ts.map +0 -1
- package/lib/esm/types/adapter-express/express-utils/index.d.ts +0 -3
- package/lib/esm/types/adapter-express/express-utils/index.d.ts.map +0 -1
- package/lib/esm/types/adapter-express/express-utils/interfaces.d.ts +0 -76
- package/lib/esm/types/adapter-express/express-utils/interfaces.d.ts.map +0 -1
- package/lib/esm/types/adapter-express/express-utils/inversify-express-server.d.ts +0 -60
- package/lib/esm/types/adapter-express/express-utils/inversify-express-server.d.ts.map +0 -1
- package/lib/esm/types/adapter-express/express-utils/utils.d.ts +0 -10
- package/lib/esm/types/adapter-express/express-utils/utils.d.ts.map +0 -1
- package/lib/esm/types/adapter-express/index.d.ts +0 -4
- package/lib/esm/types/adapter-express/index.d.ts.map +0 -1
- package/lib/esm/types/index.d.ts +0 -2
- package/lib/esm/types/index.d.ts.map +0 -1
package/lib/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
## [1.1.1](https://github.com/expressots/adapter-express/compare/1.1.0...1.1.1) (2023-10-10)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* add global prefix on opinionated ([d9d5a06](https://github.com/expressots/adapter-express/commit/d9d5a0669241ed14541a1452aa0deaa12c1109b4))
|
|
9
|
+
* add global route prefix for both templates ([046fd2c](https://github.com/expressots/adapter-express/commit/046fd2c2e2c5beacf9602f929b223713d48e8b9c))
|
|
10
|
+
* adjust build pipeline ([4f164a2](https://github.com/expressots/adapter-express/commit/4f164a2f6ee5c23512a8e6643b90a74891ec52c4))
|
|
11
|
+
* adjust build script and remove esm build option ([b35af7b](https://github.com/expressots/adapter-express/commit/b35af7b9ea91935572920314eddc8f5258bca4bc))
|
|
12
|
+
* path in codeql analysis report ([035aa16](https://github.com/expressots/adapter-express/commit/035aa16a9d62de8d7e2b39bae052d8d5499799da))
|
|
13
|
+
|
|
3
14
|
## 1.1.0 (2023-09-21)
|
|
4
15
|
|
|
5
16
|
|
|
@@ -57,16 +57,17 @@ let ApplicationExpress = class ApplicationExpress extends application_base_1.App
|
|
|
57
57
|
* @param middlewares - An array of Express middlewares to be applied.
|
|
58
58
|
* @returns The configured Application instance.
|
|
59
59
|
*/
|
|
60
|
-
|
|
60
|
+
init(container, middlewares = []) {
|
|
61
61
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
this.container = container;
|
|
63
62
|
yield Promise.resolve(this.configureServices());
|
|
64
63
|
const middleware = container.get(core_1.Middleware);
|
|
65
64
|
const sortedMiddlewarePipeline = middleware.getMiddlewarePipeline();
|
|
66
65
|
const pipeline = sortedMiddlewarePipeline.map((entry) => entry.middleware);
|
|
67
66
|
this.middlewares.push(...middlewares, ...pipeline);
|
|
68
67
|
const allMiddlewareEntries = [...this.middlewares];
|
|
69
|
-
const expressServer = new inversify_express_server_1.InversifyExpressServer(container
|
|
68
|
+
const expressServer = new inversify_express_server_1.InversifyExpressServer(container, null, {
|
|
69
|
+
rootPath: this.globalPrefix,
|
|
70
|
+
});
|
|
70
71
|
expressServer.setConfig((app) => {
|
|
71
72
|
allMiddlewareEntries.forEach((entry) => {
|
|
72
73
|
if (typeof entry === "function") {
|
|
@@ -94,6 +95,20 @@ let ApplicationExpress = class ApplicationExpress extends application_base_1.App
|
|
|
94
95
|
return this;
|
|
95
96
|
});
|
|
96
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Create and configure the Express application.
|
|
100
|
+
* @param container - The InversifyJS container.
|
|
101
|
+
* @param middlewares - An array of Express middlewares to be applied.
|
|
102
|
+
* @returns The configured Application instance.
|
|
103
|
+
*/
|
|
104
|
+
create(container, middlewares = []) {
|
|
105
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
106
|
+
this.container = container;
|
|
107
|
+
this.middlewares = middlewares;
|
|
108
|
+
this.globalPrefix = this.globalPrefix || "/";
|
|
109
|
+
return this;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
97
112
|
/**
|
|
98
113
|
* Start listening on the given port and environment.
|
|
99
114
|
* @param port - The port number to listen on.
|
|
@@ -102,6 +117,9 @@ let ApplicationExpress = class ApplicationExpress extends application_base_1.App
|
|
|
102
117
|
*/
|
|
103
118
|
listen(port, environment, consoleMessage) {
|
|
104
119
|
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
/* Initializes the application and executes the middleware pipeline */
|
|
121
|
+
yield this.init(this.container, this.middlewares);
|
|
122
|
+
/* Sets the port and environment */
|
|
105
123
|
this.port = port;
|
|
106
124
|
this.environment = environment;
|
|
107
125
|
this.app.set("env", environment);
|
|
@@ -115,6 +133,18 @@ let ApplicationExpress = class ApplicationExpress extends application_base_1.App
|
|
|
115
133
|
yield Promise.resolve(this.postServerInitialization());
|
|
116
134
|
});
|
|
117
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Sets the global route prefix for the application.
|
|
138
|
+
*
|
|
139
|
+
* @public
|
|
140
|
+
* @method setGlobalRoutePrefix
|
|
141
|
+
*
|
|
142
|
+
* @param {string} prefix - The prefix to use for all routes.
|
|
143
|
+
*
|
|
144
|
+
*/
|
|
145
|
+
setGlobalRoutePrefix(prefix) {
|
|
146
|
+
this.globalPrefix = prefix;
|
|
147
|
+
}
|
|
118
148
|
/**
|
|
119
149
|
* Configures the application's view engine based on the provided configuration options.
|
|
120
150
|
*
|
|
@@ -3,6 +3,7 @@ import { Container } from "inversify";
|
|
|
3
3
|
import { IApplicationMessageToConsole, RenderTemplateOptions } from "@expressots/core";
|
|
4
4
|
import { IApplicationExpress } from "./application-express.interface";
|
|
5
5
|
import { ApplicationBase } from "./application-base";
|
|
6
|
+
type ExpressHandler = express.ErrorRequestHandler | express.RequestParamHandler | express.RequestHandler | undefined;
|
|
6
7
|
/**
|
|
7
8
|
* Enum representing possible server environments.
|
|
8
9
|
*/
|
|
@@ -20,6 +21,7 @@ declare class ApplicationExpress extends ApplicationBase implements IApplication
|
|
|
20
21
|
private environment;
|
|
21
22
|
private container;
|
|
22
23
|
private middlewares;
|
|
24
|
+
private globalPrefix;
|
|
23
25
|
protected configureServices(): void | Promise<void>;
|
|
24
26
|
protected postServerInitialization(): void | Promise<void>;
|
|
25
27
|
protected serverShutdown(): void | Promise<void>;
|
|
@@ -33,7 +35,14 @@ declare class ApplicationExpress extends ApplicationBase implements IApplication
|
|
|
33
35
|
* @param middlewares - An array of Express middlewares to be applied.
|
|
34
36
|
* @returns The configured Application instance.
|
|
35
37
|
*/
|
|
36
|
-
|
|
38
|
+
private init;
|
|
39
|
+
/**
|
|
40
|
+
* Create and configure the Express application.
|
|
41
|
+
* @param container - The InversifyJS container.
|
|
42
|
+
* @param middlewares - An array of Express middlewares to be applied.
|
|
43
|
+
* @returns The configured Application instance.
|
|
44
|
+
*/
|
|
45
|
+
create(container: Container, middlewares?: Array<ExpressHandler>): Promise<ApplicationExpress>;
|
|
37
46
|
/**
|
|
38
47
|
* Start listening on the given port and environment.
|
|
39
48
|
* @param port - The port number to listen on.
|
|
@@ -41,6 +50,16 @@ declare class ApplicationExpress extends ApplicationBase implements IApplication
|
|
|
41
50
|
* @param consoleMessage - Optional message to display in the console.
|
|
42
51
|
*/
|
|
43
52
|
listen(port: number, environment: ServerEnvironment, consoleMessage?: IApplicationMessageToConsole): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Sets the global route prefix for the application.
|
|
55
|
+
*
|
|
56
|
+
* @public
|
|
57
|
+
* @method setGlobalRoutePrefix
|
|
58
|
+
*
|
|
59
|
+
* @param {string} prefix - The prefix to use for all routes.
|
|
60
|
+
*
|
|
61
|
+
*/
|
|
62
|
+
setGlobalRoutePrefix(prefix: string): void;
|
|
44
63
|
/**
|
|
45
64
|
* Configures the application's view engine based on the provided configuration options.
|
|
46
65
|
*
|
|
@@ -68,4 +87,3 @@ declare class ApplicationExpress extends ApplicationBase implements IApplication
|
|
|
68
87
|
get ExpressApp(): express.Application;
|
|
69
88
|
}
|
|
70
89
|
export { ApplicationExpress as AppExpress, ServerEnvironment };
|
|
71
|
-
//# sourceMappingURL=application-express.d.ts.map
|
|
@@ -6,4 +6,3 @@ export declare abstract class BaseMiddleware implements BaseMiddleware {
|
|
|
6
6
|
protected bind<T>(serviceIdentifier: inversifyInterfaces.ServiceIdentifier<T>): inversifyInterfaces.BindingToSyntax<T>;
|
|
7
7
|
abstract handler(req: Request, res: Response, next: NextFunction): void;
|
|
8
8
|
}
|
|
9
|
-
//# sourceMappingURL=base-middleware.d.ts.map
|
|
@@ -21,4 +21,3 @@ export declare const cookies: (cookieName?: string) => ParameterDecorator;
|
|
|
21
21
|
export declare const next: () => ParameterDecorator;
|
|
22
22
|
export declare const Principal: () => ParameterDecorator;
|
|
23
23
|
export declare function params(type: PARAMETER_TYPE, parameterName?: string): (target: unknown | Controller, methodName: string | symbol, index: number) => void;
|
|
24
|
-
//# sourceMappingURL=decorators.d.ts.map
|
|
@@ -7,4 +7,3 @@ export declare function getControllerMethodMetadata(constructor: NewableFunction
|
|
|
7
7
|
export declare function getControllerParameterMetadata(constructor: NewableFunction): ControllerParameterMetadata;
|
|
8
8
|
export declare function cleanUpMetadata(): void;
|
|
9
9
|
export declare function instanceOfIHttpActionResult(value: unknown): value is IHttpActionResult;
|
|
10
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/lib/cjs/types/index.d.ts
CHANGED
package/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expressots/adapter-express",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Expressots - modern, fast, lightweight nodejs web framework (@adapter-express)",
|
|
5
5
|
"author": "",
|
|
6
6
|
"main": "./lib/cjs/index.js",
|
|
@@ -51,15 +51,10 @@
|
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"prepare": "husky install",
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"linux-cpy": "cp package.json README.md CHANGELOG.md lib/",
|
|
58
|
-
"build:win": "npm run win-clean && npm run build:esm && npm run build:cjs && npm run win-cpy",
|
|
59
|
-
"build:linux": "npm run linux-clean && npm run build:esm && npm run build:cjs && npm run linux-cpy",
|
|
60
|
-
"build:esm": "tsc -p tsconfig.esm.json && mv lib/esm/index.js lib/esm/index.mjs ",
|
|
54
|
+
"clean": "node scripts/rm.js lib",
|
|
55
|
+
"copy": "node scripts/copy.js package.json README.md CHANGELOG.md lib",
|
|
56
|
+
"build": "npm run clean && npm run build:cjs && npm run copy",
|
|
61
57
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
62
|
-
"git": "powershell -Command \"git add .; git commit -m \"%1\"; npm run release\"",
|
|
63
58
|
"release": "release-it",
|
|
64
59
|
"test": "jest",
|
|
65
60
|
"format": "prettier --write \"src/**/*.ts\" --cache",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expressots/adapter-express",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Expressots - modern, fast, lightweight nodejs web framework (@adapter-express)",
|
|
5
5
|
"author": "",
|
|
6
6
|
"main": "./lib/cjs/index.js",
|
|
@@ -51,15 +51,10 @@
|
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"prepare": "husky install",
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"linux-cpy": "cp package.json README.md CHANGELOG.md lib/",
|
|
58
|
-
"build:win": "npm run win-clean && npm run build:esm && npm run build:cjs && npm run win-cpy",
|
|
59
|
-
"build:linux": "npm run linux-clean && npm run build:esm && npm run build:cjs && npm run linux-cpy",
|
|
60
|
-
"build:esm": "tsc -p tsconfig.esm.json && mv lib/esm/index.js lib/esm/index.mjs ",
|
|
54
|
+
"clean": "node scripts/rm.js lib",
|
|
55
|
+
"copy": "node scripts/copy.js package.json README.md CHANGELOG.md lib",
|
|
56
|
+
"build": "npm run clean && npm run build:cjs && npm run copy",
|
|
61
57
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
62
|
-
"git": "powershell -Command \"git add .; git commit -m \"%1\"; npm run release\"",
|
|
63
58
|
"release": "release-it",
|
|
64
59
|
"test": "jest",
|
|
65
60
|
"format": "prettier --write \"src/**/*.ts\" --cache",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"application-base.d.ts","sourceRoot":"","sources":["../../../../src/adapter-express/application-base.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,uBACe,eAAe;IAC5B;;;;;;;;OAQG;IACH,SAAS,CAAC,QAAQ,CAAC,iBAAiB,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAE5D;;;;;;;;OAQG;IACH,SAAS,CAAC,QAAQ,CAAC,wBAAwB,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAEnE;;;;;;;;;OASG;IACH,SAAS,CAAC,QAAQ,CAAC,cAAc,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAC1D;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"application-express.d.ts","sourceRoot":"","sources":["../../../../src/adapter-express/application-express.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EAEL,4BAA4B,EAK5B,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAarD;;GAEG;AACH,aAAK,iBAAiB;IACpB,WAAW,gBAAgB;IAC3B,UAAU,eAAe;CAC1B;AAED;;;GAGG;AACH,cACM,kBAAmB,SAAQ,eAAgB,YAAW,mBAAmB;IAC7E,OAAO,CAAC,GAAG,CAAsB;IACjC,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,WAAW,CAAoB;IACvC,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,WAAW,CAA6B;IAEhD,SAAS,CAAC,iBAAiB,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IACnD,SAAS,CAAC,wBAAwB,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1D,SAAS,CAAC,cAAc,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAEhD;;OAEG;IACH,OAAO,CAAC,UAAU;IAKlB;;;;;OAKG;IACU,MAAM,CACjB,SAAS,EAAE,SAAS,EACpB,WAAW,GAAE,KAAK,CAAC,OAAO,CAAC,cAAc,CAAM,GAC9C,OAAO,CAAC,kBAAkB,CAAC;IA0C9B;;;;;OAKG;IACU,MAAM,CACjB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,iBAAiB,EAC9B,cAAc,CAAC,EAAE,4BAA4B,GAC5C,OAAO,CAAC,IAAI,CAAC;IAmBhB;;;;;;;;;;OAUG;IACI,SAAS,CAAC,CAAC,SAAS,qBAAqB,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI;IASnE;;;;OAIG;IACH,SAAS,CAAC,aAAa,IAAI,OAAO;IAWlC;;;;;OAKG;IACH,IAAW,UAAU,IAAI,OAAO,CAAC,WAAW,CAE3C;CACF;AAED,OAAO,EAAE,kBAAkB,IAAI,UAAU,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"application-express.interface.d.ts","sourceRoot":"","sources":["../../../../src/adapter-express/application-express.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D;;;GAGG;AACH,UAAU,mBAAmB;IAC3B;;;;;OAKG;IACH,MAAM,CACJ,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,iBAAiB,EAC9B,cAAc,CAAC,EAAE,4BAA4B,GAC5C,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAExB;;;;;;;;;;OAUG;IACH,SAAS,CAAC,CAAC,SAAS,qBAAqB,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;CAC9D;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-middleware.d.ts","sourceRoot":"","sources":["../../../../../src/adapter-express/express-utils/base-middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAc,UAAU,IAAI,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,8BACsB,cAAe,YAAW,cAAc;IAGrD,WAAW,EAAG,WAAW,CAAC;IAEjC,SAAS,CAAC,IAAI,CAAC,CAAC,EACd,iBAAiB,EAAE,mBAAmB,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAC1D,mBAAmB,CAAC,eAAe,CAAC,CAAC,CAAC;aAIzB,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI;CAC/E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/adapter-express/express-utils/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI;;;;CAIhB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;CAKxB,CAAC;AAEF,oBAAY,cAAc;IACxB,OAAO,IAAA;IACP,QAAQ,IAAA;IACR,MAAM,IAAA;IACN,KAAK,IAAA;IACL,IAAI,IAAA;IACJ,OAAO,IAAA;IACP,OAAO,IAAA;IACP,IAAI,IAAA;IACJ,SAAS,IAAA;CACV;AAED,oBAAY,eAAe;IACzB,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,GAAG,QAAQ;IACX,KAAK,UAAU;CAChB;AAED,eAAO,MAAM,0BAA0B,SAAU,MAAM,KAAG,MACJ,CAAC;AAEvD,eAAO,MAAM,oBAAoB,QAGL,CAAC;AAE7B,eAAO,MAAM,yBAAyB,MAAM,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"httpContent.d.ts","sourceRoot":"","sources":["../../../../../../src/adapter-express/express-utils/content/httpContent.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAErD,8BAAsB,WAAW;IAC/B,OAAO,CAAC,QAAQ,CAA2B;IAE3C,IAAW,OAAO,IAAI,mBAAmB,CAExC;aAEe,SAAS,IAAI,OAAO,CAElC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAC7D;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../../../../src/adapter-express/express-utils/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAsB,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,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;IAE7B,IAAW,UAAU,IAAI,MAAM,CAE9B;IAED,IAAW,UAAU,CAAC,IAAI,EAAE,MAAM,EAMjC;gBAEW,UAAU,SAAM;CAG7B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/adapter-express/express-utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../../src/adapter-express/express-utils/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5F,OAAO,EAAE,UAAU,IAAI,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,KAAK,SAAS,CAAC,CAAC,IAAI;KACjB,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,eAAe,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS;CACvE,GAAG;IACF,WAAW,EAAE,eAAe,CAAC;CAC9B,CAAC;AAEF,UAAU,mBAAmB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACvD,KAAK,GAAG,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACjC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;CACzB;AAED,MAAM,MAAM,eAAe,CAAC,CAAC,GAAG,OAAO,IAAI,mBAAmB,CAAC,CAAC,CAAC,GAAG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;CAClB;AAED,MAAM,WAAW,SAAS,CAAC,CAAC,GAAG,OAAO;IACpC,OAAO,EAAE,CAAC,CAAC;IACX,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAEpC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEzC,eAAe,CAAC,UAAU,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACxD;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;CAC9E;AAED,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,OAAO;IACtC,SAAS,EAAE,mBAAmB,CAAC,SAAS,CAAC;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,YAAY,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC9C;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,WAAW;IAC1B,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,cAAc,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAChD,iBAAiB,EAAE,2BAA2B,CAAC;CAChD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inversify-express-server.d.ts","sourceRoot":"","sources":["../../../../../src/adapter-express/express-utils/inversify-express-server.ts"],"names":[],"mappings":"A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
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/adapter-express/express-utils/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,wBAAwB,EACxB,2BAA2B,EAC3B,eAAe,EACf,iBAAiB,EAClB,MAAM,cAAc,CAAC;AAEtB,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,UAAU,CAAC,SAAS,EAC/B,gBAAgB,EAAE,OAAO,GACxB,KAAK,CAAC,cAAc,CAAC,CASvB;AAED,wBAAgB,0BAA0B,IAAI,KAAK,CAAC,eAAe,CAAC,CAInE;AAED,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,eAAe,GAAG,kBAAkB,CAMtF;AAED,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,eAAe,GAC3B,KAAK,CAAC,wBAAwB,CAAC,CAkBjC;AAED,wBAAgB,8BAA8B,CAC5C,WAAW,EAAE,eAAe,GAC3B,2BAA2B,CAkB7B;AAED,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAEtF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/adapter-express/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.ApplicationBase = void 0;
|
|
10
|
-
const inversify_binding_decorators_1 = require("inversify-binding-decorators");
|
|
11
|
-
/**
|
|
12
|
-
* Abstract class ApplicationBase.
|
|
13
|
-
*
|
|
14
|
-
* ApplicationBase serves as the foundational structure for building
|
|
15
|
-
* server applications. It declares the lifecycle hooks that allow
|
|
16
|
-
* subclasses to configure services, handle post-server initialization,
|
|
17
|
-
* and perform cleanup when the server is shutting down. Extending
|
|
18
|
-
* classes are required to provide implementations for these methods
|
|
19
|
-
* to define specific behaviors for their particular use cases.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* class Application extends ApplicationBase {
|
|
23
|
-
* protected configureServices() { //... }
|
|
24
|
-
* protected postServerInitialization() { //... }
|
|
25
|
-
* protected serverShutdown() { //... }
|
|
26
|
-
* }
|
|
27
|
-
*
|
|
28
|
-
* @export
|
|
29
|
-
* @abstract
|
|
30
|
-
*/
|
|
31
|
-
let ApplicationBase = class ApplicationBase {
|
|
32
|
-
};
|
|
33
|
-
exports.ApplicationBase = ApplicationBase;
|
|
34
|
-
exports.ApplicationBase = ApplicationBase = __decorate([
|
|
35
|
-
(0, inversify_binding_decorators_1.provide)(ApplicationBase)
|
|
36
|
-
], ApplicationBase);
|
|
@@ -1,152 +0,0 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ServerEnvironment = exports.AppExpress = void 0;
|
|
13
|
-
const inversify_binding_decorators_1 = require("inversify-binding-decorators");
|
|
14
|
-
const process_1 = __importDefault(require("process"));
|
|
15
|
-
const core_1 = require("@expressots/core");
|
|
16
|
-
const inversify_express_server_1 = require("./express-utils/inversify-express-server");
|
|
17
|
-
const application_base_1 = require("./application-base");
|
|
18
|
-
/**
|
|
19
|
-
* Enum representing possible server environments.
|
|
20
|
-
*/
|
|
21
|
-
var ServerEnvironment;
|
|
22
|
-
(function (ServerEnvironment) {
|
|
23
|
-
ServerEnvironment["Development"] = "development";
|
|
24
|
-
ServerEnvironment["Production"] = "production";
|
|
25
|
-
})(ServerEnvironment || (exports.ServerEnvironment = ServerEnvironment = {}));
|
|
26
|
-
/**
|
|
27
|
-
* The Application class provides a way to configure and manage an Express application.
|
|
28
|
-
* @provide Application
|
|
29
|
-
*/
|
|
30
|
-
let ApplicationExpress = class ApplicationExpress extends application_base_1.ApplicationBase {
|
|
31
|
-
app;
|
|
32
|
-
port;
|
|
33
|
-
environment;
|
|
34
|
-
container;
|
|
35
|
-
middlewares = [];
|
|
36
|
-
configureServices() { }
|
|
37
|
-
postServerInitialization() { }
|
|
38
|
-
serverShutdown() { }
|
|
39
|
-
/**
|
|
40
|
-
* Handles process exit by calling serverShutdown and then exiting the process.
|
|
41
|
-
*/
|
|
42
|
-
handleExit() {
|
|
43
|
-
this.serverShutdown();
|
|
44
|
-
process_1.default.exit(0);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Create and configure the Express application.
|
|
48
|
-
* @param container - The InversifyJS container.
|
|
49
|
-
* @param middlewares - An array of Express middlewares to be applied.
|
|
50
|
-
* @returns The configured Application instance.
|
|
51
|
-
*/
|
|
52
|
-
async create(container, middlewares = []) {
|
|
53
|
-
this.container = container;
|
|
54
|
-
await Promise.resolve(this.configureServices());
|
|
55
|
-
const middleware = container.get(core_1.Middleware);
|
|
56
|
-
const sortedMiddlewarePipeline = middleware.getMiddlewarePipeline();
|
|
57
|
-
const pipeline = sortedMiddlewarePipeline.map((entry) => entry.middleware);
|
|
58
|
-
this.middlewares.push(...middlewares, ...pipeline);
|
|
59
|
-
const allMiddlewareEntries = [...this.middlewares];
|
|
60
|
-
const expressServer = new inversify_express_server_1.InversifyExpressServer(container);
|
|
61
|
-
expressServer.setConfig((app) => {
|
|
62
|
-
allMiddlewareEntries.forEach((entry) => {
|
|
63
|
-
if (typeof entry === "function") {
|
|
64
|
-
app.use(entry);
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
const { path, middlewares } = entry;
|
|
68
|
-
middlewares.forEach((middleware) => {
|
|
69
|
-
if (path) {
|
|
70
|
-
app.use(path, middleware);
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
app.use(middleware);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
expressServer.setErrorConfig((app) => {
|
|
80
|
-
if (middleware.getErrorHandler()) {
|
|
81
|
-
app.use(middleware.getErrorHandler());
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
this.app = expressServer.build();
|
|
85
|
-
return this;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Start listening on the given port and environment.
|
|
89
|
-
* @param port - The port number to listen on.
|
|
90
|
-
* @param environment - The server environment.
|
|
91
|
-
* @param consoleMessage - Optional message to display in the console.
|
|
92
|
-
*/
|
|
93
|
-
async listen(port, environment, consoleMessage) {
|
|
94
|
-
this.port = port;
|
|
95
|
-
this.environment = environment;
|
|
96
|
-
this.app.set("env", environment);
|
|
97
|
-
this.app.listen(this.port, () => {
|
|
98
|
-
const console = this.container.get(core_1.Console);
|
|
99
|
-
console.messageServer(this.port, this.environment, consoleMessage);
|
|
100
|
-
["SIGTERM", "SIGHUP", "SIGBREAK", "SIGQUIT", "SIGINT"].forEach((signal) => {
|
|
101
|
-
process_1.default.on(signal, this.handleExit.bind(this));
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
await Promise.resolve(this.postServerInitialization());
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Configures the application's view engine based on the provided configuration options.
|
|
108
|
-
*
|
|
109
|
-
* @public
|
|
110
|
-
* @method setEngine
|
|
111
|
-
* @template T - A generic type extending from RenderTemplateOptions.
|
|
112
|
-
*
|
|
113
|
-
* @param {T} options - An object of type T (must be an object that extends RenderTemplateOptions)
|
|
114
|
-
* that provides the configuration options for setting the view engine.
|
|
115
|
-
* This includes the extension name, view path, and the engine function itself.
|
|
116
|
-
*/
|
|
117
|
-
setEngine(options) {
|
|
118
|
-
if ("extName" in options) {
|
|
119
|
-
const { extName, viewPath, engine } = options;
|
|
120
|
-
this.app.engine(extName, engine);
|
|
121
|
-
this.app.set("view engine", extName);
|
|
122
|
-
this.app.set("views", viewPath);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Verifies if the current environment is development.
|
|
127
|
-
*
|
|
128
|
-
* @returns A boolean value indicating whether the current environment is development or not.
|
|
129
|
-
*/
|
|
130
|
-
isDevelopment() {
|
|
131
|
-
if (this.app) {
|
|
132
|
-
return this.app.get("env") === ServerEnvironment.Development;
|
|
133
|
-
}
|
|
134
|
-
this.container
|
|
135
|
-
.get(core_1.Logger)
|
|
136
|
-
.error("isDevelopment() method must be called on `PostServerInitialization`", "application");
|
|
137
|
-
return false;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Verifies if the current environment is production.
|
|
141
|
-
*
|
|
142
|
-
* @returns A boolean value indicating whether the current environment is production or not.
|
|
143
|
-
*
|
|
144
|
-
*/
|
|
145
|
-
get ExpressApp() {
|
|
146
|
-
return this.app;
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
exports.AppExpress = ApplicationExpress;
|
|
150
|
-
exports.AppExpress = ApplicationExpress = __decorate([
|
|
151
|
-
(0, inversify_binding_decorators_1.provide)(ApplicationExpress)
|
|
152
|
-
], ApplicationExpress);
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.BaseMiddleware = void 0;
|
|
10
|
-
const inversify_1 = require("inversify");
|
|
11
|
-
let BaseMiddleware = class BaseMiddleware {
|
|
12
|
-
// httpContext is initialized when the middleware is invoked
|
|
13
|
-
// see resolveMiddleware in server.ts for more details
|
|
14
|
-
httpContext;
|
|
15
|
-
bind(serviceIdentifier) {
|
|
16
|
-
return this.httpContext.container.bind(serviceIdentifier);
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
exports.BaseMiddleware = BaseMiddleware;
|
|
20
|
-
exports.BaseMiddleware = BaseMiddleware = __decorate([
|
|
21
|
-
(0, inversify_1.injectable)()
|
|
22
|
-
], BaseMiddleware);
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_ROUTING_ROOT_PATH = exports.NO_CONTROLLERS_FOUND = exports.DUPLICATED_CONTROLLER_NAME = exports.HTTP_VERBS_ENUM = exports.PARAMETER_TYPE = exports.METADATA_KEY = exports.TYPE = void 0;
|
|
4
|
-
exports.TYPE = {
|
|
5
|
-
AuthProvider: Symbol.for("AuthProvider"),
|
|
6
|
-
Controller: Symbol.for("Controller"),
|
|
7
|
-
HttpContext: Symbol.for("HttpContext"),
|
|
8
|
-
};
|
|
9
|
-
exports.METADATA_KEY = {
|
|
10
|
-
controller: "inversify-express-utils:controller",
|
|
11
|
-
controllerMethod: "inversify-express-utils:controller-method",
|
|
12
|
-
controllerParameter: "inversify-express-utils:controller-parameter",
|
|
13
|
-
httpContext: "inversify-express-utils:httpcontext",
|
|
14
|
-
};
|
|
15
|
-
var PARAMETER_TYPE;
|
|
16
|
-
(function (PARAMETER_TYPE) {
|
|
17
|
-
PARAMETER_TYPE[PARAMETER_TYPE["REQUEST"] = 0] = "REQUEST";
|
|
18
|
-
PARAMETER_TYPE[PARAMETER_TYPE["RESPONSE"] = 1] = "RESPONSE";
|
|
19
|
-
PARAMETER_TYPE[PARAMETER_TYPE["PARAMS"] = 2] = "PARAMS";
|
|
20
|
-
PARAMETER_TYPE[PARAMETER_TYPE["QUERY"] = 3] = "QUERY";
|
|
21
|
-
PARAMETER_TYPE[PARAMETER_TYPE["BODY"] = 4] = "BODY";
|
|
22
|
-
PARAMETER_TYPE[PARAMETER_TYPE["HEADERS"] = 5] = "HEADERS";
|
|
23
|
-
PARAMETER_TYPE[PARAMETER_TYPE["COOKIES"] = 6] = "COOKIES";
|
|
24
|
-
PARAMETER_TYPE[PARAMETER_TYPE["NEXT"] = 7] = "NEXT";
|
|
25
|
-
PARAMETER_TYPE[PARAMETER_TYPE["PRINCIPAL"] = 8] = "PRINCIPAL";
|
|
26
|
-
})(PARAMETER_TYPE || (exports.PARAMETER_TYPE = PARAMETER_TYPE = {}));
|
|
27
|
-
var HTTP_VERBS_ENUM;
|
|
28
|
-
(function (HTTP_VERBS_ENUM) {
|
|
29
|
-
HTTP_VERBS_ENUM["all"] = "ALL";
|
|
30
|
-
HTTP_VERBS_ENUM["connect"] = "CONNECT";
|
|
31
|
-
HTTP_VERBS_ENUM["delete"] = "DELETE";
|
|
32
|
-
HTTP_VERBS_ENUM["get"] = "GET";
|
|
33
|
-
HTTP_VERBS_ENUM["head"] = "HEAD";
|
|
34
|
-
HTTP_VERBS_ENUM["options"] = "OPTIONS";
|
|
35
|
-
HTTP_VERBS_ENUM["patch"] = "PATCH";
|
|
36
|
-
HTTP_VERBS_ENUM["post"] = "POST";
|
|
37
|
-
HTTP_VERBS_ENUM["propfind"] = "PROPFIND";
|
|
38
|
-
HTTP_VERBS_ENUM["put"] = "PUT";
|
|
39
|
-
HTTP_VERBS_ENUM["trace"] = "TRACE";
|
|
40
|
-
})(HTTP_VERBS_ENUM || (exports.HTTP_VERBS_ENUM = HTTP_VERBS_ENUM = {}));
|
|
41
|
-
const DUPLICATED_CONTROLLER_NAME = (name) => `Two controllers cannot have the same name: ${name}`;
|
|
42
|
-
exports.DUPLICATED_CONTROLLER_NAME = DUPLICATED_CONTROLLER_NAME;
|
|
43
|
-
exports.NO_CONTROLLERS_FOUND = "No controllers" +
|
|
44
|
-
"have been found! Please ensure that you have register" +
|
|
45
|
-
"at least one Controller.";
|
|
46
|
-
exports.DEFAULT_ROUTING_ROOT_PATH = "/";
|