@expressots/core 2.0.0 → 2.2.0
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 +43 -1
- package/lib/cjs/middleware/interfaces/cookie-parser.interface.js +2 -0
- package/lib/cjs/middleware/interfaces/cookie-session/cookie-session.interface.js +2 -0
- package/lib/cjs/middleware/interfaces/cookie-session/keygrip.interface.js +2 -0
- package/lib/cjs/middleware/interfaces/serve-favicon.interface.js +2 -0
- package/lib/cjs/middleware/middleware-resolver.js +5 -2
- package/lib/cjs/middleware/middleware-service.js +117 -15
- package/lib/cjs/types/middleware/index.d.ts +4 -0
- package/lib/cjs/types/middleware/index.d.ts.map +1 -1
- package/lib/cjs/types/middleware/interfaces/cookie-parser.interface.d.ts +10 -0
- package/lib/cjs/types/middleware/interfaces/cookie-parser.interface.d.ts.map +1 -0
- package/lib/cjs/types/middleware/interfaces/cookie-session/cookie-session.interface.d.ts +58 -0
- package/lib/cjs/types/middleware/interfaces/cookie-session/cookie-session.interface.d.ts.map +1 -0
- package/lib/cjs/types/middleware/interfaces/cookie-session/keygrip.interface.d.ts +28 -0
- package/lib/cjs/types/middleware/interfaces/cookie-session/keygrip.interface.d.ts.map +1 -0
- package/lib/cjs/types/middleware/interfaces/serve-favicon.interface.d.ts +12 -0
- package/lib/cjs/types/middleware/interfaces/serve-favicon.interface.d.ts.map +1 -0
- package/lib/cjs/types/middleware/middleware-resolver.d.ts.map +1 -1
- package/lib/cjs/types/middleware/middleware-service.d.ts +92 -7
- package/lib/cjs/types/middleware/middleware-service.d.ts.map +1 -1
- package/lib/esm/middleware/interfaces/cookie-parser.interface.js +2 -0
- package/lib/esm/middleware/interfaces/cookie-session/cookie-session.interface.js +2 -0
- package/lib/esm/middleware/interfaces/cookie-session/keygrip.interface.js +2 -0
- package/lib/esm/middleware/interfaces/serve-favicon.interface.js +2 -0
- package/lib/esm/middleware/middleware-resolver.js +5 -2
- package/lib/esm/middleware/middleware-service.js +114 -15
- package/lib/esm/types/middleware/index.d.ts +4 -0
- package/lib/esm/types/middleware/index.d.ts.map +1 -1
- package/lib/esm/types/middleware/interfaces/cookie-parser.interface.d.ts +10 -0
- package/lib/esm/types/middleware/interfaces/cookie-parser.interface.d.ts.map +1 -0
- package/lib/esm/types/middleware/interfaces/cookie-session/cookie-session.interface.d.ts +58 -0
- package/lib/esm/types/middleware/interfaces/cookie-session/cookie-session.interface.d.ts.map +1 -0
- package/lib/esm/types/middleware/interfaces/cookie-session/keygrip.interface.d.ts +28 -0
- package/lib/esm/types/middleware/interfaces/cookie-session/keygrip.interface.d.ts.map +1 -0
- package/lib/esm/types/middleware/interfaces/serve-favicon.interface.d.ts +12 -0
- package/lib/esm/types/middleware/interfaces/serve-favicon.interface.d.ts.map +1 -0
- package/lib/esm/types/middleware/middleware-resolver.d.ts.map +1 -1
- package/lib/esm/types/middleware/middleware-service.d.ts +92 -7
- package/lib/esm/types/middleware/middleware-service.d.ts.map +1 -1
- package/lib/package.json +10 -8
- package/package.json +10 -8
package/lib/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
## [2.2.0](https://github.com/expressots/expressots/compare/2.1.0...2.2.0) (2023-09-21)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add middleware based routing ([3d7720e](https://github.com/expressots/expressots/commit/3d7720e21807117333d60e7f2b7bb01789b96060))
|
|
9
|
+
* add serve-favicon middleware ([024bdc4](https://github.com/expressots/expressots/commit/024bdc4d8d4f9890175975d052ca09c5b4e245cf))
|
|
10
|
+
* add serve-favicon middleware ([0733697](https://github.com/expressots/expressots/commit/0733697ed66a7133e60ec6fa09bdaeb0bf1985d7))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* add chore message to pre-commit hook ([45ae428](https://github.com/expressots/expressots/commit/45ae428652bb6e4f49cb2a6334686be0dee3669d))
|
|
16
|
+
* add middleware validation based on path ([7035153](https://github.com/expressots/expressots/commit/7035153dededd3ca7c5159544f4ab79baee2c4d7))
|
|
17
|
+
* re-write cp, mv and rm improving performance ([68d68ad](https://github.com/expressots/expressots/commit/68d68ad11385ca783fa5c51e3092937a6f898ac6))
|
|
18
|
+
* update contribute_howto doc ([4bf6e12](https://github.com/expressots/expressots/commit/4bf6e121091e894a7675ff78959ab4647ec04f6d))
|
|
19
|
+
* update contribute_howto doc ([fbbe47d](https://github.com/expressots/expressots/commit/fbbe47d6df76211fadd736fab864aa41e0313ec9))
|
|
20
|
+
* update templates for v2 scaffold ([74811f3](https://github.com/expressots/expressots/commit/74811f3ac54610be7367de75f37363dc0c107dbc))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Build System
|
|
24
|
+
|
|
25
|
+
* **scripts:** add cross platform build scripts ([e6cecbc](https://github.com/expressots/expressots/commit/e6cecbc6b7a309f00aa6cd60f6d8207dc8d4c5cb))
|
|
26
|
+
* **scripts:** add cross platform build scripts ([8b5c133](https://github.com/expressots/expressots/commit/8b5c133e4e28d67b8a7edca5b04bfe04a6d12540))
|
|
27
|
+
|
|
28
|
+
## [2.1.0](https://github.com/expressots/expressots/compare/2.0.0...2.1.0) (2023-09-16)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Features
|
|
32
|
+
|
|
33
|
+
* add cookie-parser middleware ([2fe9377](https://github.com/expressots/expressots/commit/2fe93776423355503211a0d96f2b1952e3bc6320))
|
|
34
|
+
* add cookie-parser middleware ([a53a0c2](https://github.com/expressots/expressots/commit/a53a0c2e23dafc188286cd0ff5a6145cf3416ad0))
|
|
35
|
+
* add cookie-session middleware ([323c2d3](https://github.com/expressots/expressots/commit/323c2d32c5e4a9c78f19fe47807f323139fb306a))
|
|
36
|
+
* add cookie-session middleware ([60ac1fa](https://github.com/expressots/expressots/commit/60ac1fa36b2a8388983be0ab8f2d8a1696089d78))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Bug Fixes
|
|
40
|
+
|
|
41
|
+
* create folder for interface and print pck name instead of curated name ([2a47508](https://github.com/expressots/expressots/commit/2a47508f5170950ddd8b471fffc8d43a8fb57e32))
|
|
42
|
+
|
|
1
43
|
## [2.0.0](https://github.com/expressots/expressots/compare/1.9.1...2.0.0) (2023-09-14)
|
|
2
44
|
|
|
3
45
|
### Features
|
|
@@ -298,4 +340,4 @@
|
|
|
298
340
|
|
|
299
341
|
### Bug Fixes
|
|
300
342
|
|
|
301
|
-
- fix pipeline for tag name ([b9ec52d](https://github.com/expressots/expressots/commit/b9ec52dc065763185f69364d8f083b1a95fa37e0))
|
|
343
|
+
- fix pipeline for tag name ([b9ec52d](https://github.com/expressots/expressots/commit/b9ec52dc065763185f69364d8f083b1a95fa37e0))
|
|
@@ -17,6 +17,9 @@ class MiddlewareResolver {
|
|
|
17
17
|
this.middlewareRegistry = {
|
|
18
18
|
cors: "cors",
|
|
19
19
|
compression: "compression",
|
|
20
|
+
cookieParser: "cookie-parser",
|
|
21
|
+
cookieSession: "cookie-session",
|
|
22
|
+
serveFavicon: "serve-favicon",
|
|
20
23
|
// Add other middlewares
|
|
21
24
|
};
|
|
22
25
|
this.logger = new logger_service_1.Logger();
|
|
@@ -31,7 +34,7 @@ class MiddlewareResolver {
|
|
|
31
34
|
getMiddleware(middlewareName, ...options) {
|
|
32
35
|
const packageName = this.middlewareRegistry[middlewareName];
|
|
33
36
|
if (!packageName) {
|
|
34
|
-
|
|
37
|
+
this.logger.error(`Middleware ${packageName} not found`, "middleware-resolver");
|
|
35
38
|
return null;
|
|
36
39
|
}
|
|
37
40
|
let hasMiddleware = "";
|
|
@@ -39,7 +42,7 @@ class MiddlewareResolver {
|
|
|
39
42
|
hasMiddleware = require.resolve(packageName, { paths: [process.cwd()] });
|
|
40
43
|
}
|
|
41
44
|
catch (error) {
|
|
42
|
-
this.logger.warn(`Middleware [${
|
|
45
|
+
this.logger.warn(`Middleware [${packageName}] not installed. Please install it using your package manager.`, "middleware-resolver");
|
|
43
46
|
}
|
|
44
47
|
if (hasMiddleware) {
|
|
45
48
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
@@ -25,7 +25,7 @@ const middleware_resolver_1 = require("./middleware-resolver");
|
|
|
25
25
|
*/
|
|
26
26
|
let Middleware = Middleware_1 = class Middleware {
|
|
27
27
|
constructor() {
|
|
28
|
-
this.
|
|
28
|
+
this.middlewarePipeline = [];
|
|
29
29
|
this.logger = new logger_service_1.Logger();
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
@@ -36,8 +36,12 @@ let Middleware = Middleware_1 = class Middleware {
|
|
|
36
36
|
* @returns A boolean value indicating whether the middleware exists or not.
|
|
37
37
|
*/
|
|
38
38
|
middlewareExists(middlewareName) {
|
|
39
|
-
const
|
|
40
|
-
|
|
39
|
+
const middlewareIndex = this.middlewarePipeline.findIndex((m) => {
|
|
40
|
+
var _a;
|
|
41
|
+
return typeof m.middleware === "object"
|
|
42
|
+
? m.middleware.middlewares.some((mw) => (mw === null || mw === void 0 ? void 0 : mw.name) === middlewareName)
|
|
43
|
+
: ((_a = m.middleware) === null || _a === void 0 ? void 0 : _a.name) === middlewareName;
|
|
44
|
+
});
|
|
41
45
|
return middlewareIndex !== -1;
|
|
42
46
|
}
|
|
43
47
|
/**
|
|
@@ -51,7 +55,10 @@ let Middleware = Middleware_1 = class Middleware {
|
|
|
51
55
|
this.logger.warn(`[jsonParser] already exists. Skipping...`, "configure-service");
|
|
52
56
|
}
|
|
53
57
|
else {
|
|
54
|
-
this.
|
|
58
|
+
this.middlewarePipeline.push({
|
|
59
|
+
timestamp: new Date(),
|
|
60
|
+
middleware: express_1.default.json(options),
|
|
61
|
+
});
|
|
55
62
|
}
|
|
56
63
|
}
|
|
57
64
|
/**
|
|
@@ -63,7 +70,10 @@ let Middleware = Middleware_1 = class Middleware {
|
|
|
63
70
|
const middleware = (0, middleware_resolver_1.middlewareResolver)("cors", options);
|
|
64
71
|
const middlewareExist = this.middlewareExists("cors");
|
|
65
72
|
if (middleware && !middlewareExist) {
|
|
66
|
-
this.
|
|
73
|
+
this.middlewarePipeline.push({
|
|
74
|
+
timestamp: new Date(),
|
|
75
|
+
middleware,
|
|
76
|
+
});
|
|
67
77
|
}
|
|
68
78
|
}
|
|
69
79
|
/**
|
|
@@ -75,7 +85,58 @@ let Middleware = Middleware_1 = class Middleware {
|
|
|
75
85
|
const middleware = (0, middleware_resolver_1.middlewareResolver)("compression", options);
|
|
76
86
|
const middlewareExist = this.middlewareExists("compression");
|
|
77
87
|
if (middleware && !middlewareExist) {
|
|
78
|
-
this.
|
|
88
|
+
this.middlewarePipeline.push({
|
|
89
|
+
timestamp: new Date(),
|
|
90
|
+
middleware,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Adds Cookie Parser middleware to parse the cookie header and populate req.cookies with an object keyed by the cookie names.
|
|
96
|
+
*
|
|
97
|
+
* @param secret - A string or array used for signing cookies. This is optional and if not specified, the cookie-parser will not parse signed cookies.
|
|
98
|
+
* @param options - Optional configuration options for Cookie Parser.
|
|
99
|
+
*/
|
|
100
|
+
addCookieParser(secret, options) {
|
|
101
|
+
const middleware = (0, middleware_resolver_1.middlewareResolver)("cookieParser", secret, options);
|
|
102
|
+
const middlewareExist = this.middlewareExists("cookieParser");
|
|
103
|
+
if (middleware && !middlewareExist) {
|
|
104
|
+
this.middlewarePipeline.push({
|
|
105
|
+
timestamp: new Date(),
|
|
106
|
+
middleware,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Adds Cookie Session middleware to enable cookie-based sessions.
|
|
112
|
+
*
|
|
113
|
+
* @param options - Optional configuration options for Cookie Session. Defines the behavior of cookie sessions like the name of the cookie, keys to sign the cookie, etc.
|
|
114
|
+
*/
|
|
115
|
+
addCookieSession(options) {
|
|
116
|
+
const middleware = (0, middleware_resolver_1.middlewareResolver)("cookieSession", options);
|
|
117
|
+
const middlewareExist = this.middlewareExists("cookieSession");
|
|
118
|
+
if (middleware && !middlewareExist) {
|
|
119
|
+
this.middlewarePipeline.push({
|
|
120
|
+
timestamp: new Date(),
|
|
121
|
+
middleware,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Adds a middleware to serve the favicon to the middleware collection.
|
|
127
|
+
* The favicon is the icon that is displayed in the browser tab for the application.
|
|
128
|
+
*
|
|
129
|
+
* @param path - The path to the favicon file.
|
|
130
|
+
* @param options - Optional configuration options for serving the favicon. Defines the behavior of the favicon middleware like cache control, custom headers, etc.
|
|
131
|
+
*/
|
|
132
|
+
addServeFavicon(path, options) {
|
|
133
|
+
const middleware = (0, middleware_resolver_1.middlewareResolver)("serveFavicon", path, options);
|
|
134
|
+
const middlewareExist = this.middlewareExists("serveFavicon");
|
|
135
|
+
if (middleware && !middlewareExist) {
|
|
136
|
+
this.middlewarePipeline.push({
|
|
137
|
+
timestamp: new Date(),
|
|
138
|
+
middleware,
|
|
139
|
+
});
|
|
79
140
|
}
|
|
80
141
|
}
|
|
81
142
|
/**
|
|
@@ -104,7 +165,10 @@ let Middleware = Middleware_1 = class Middleware {
|
|
|
104
165
|
this.logger.warn(`[serveStatic] already exists. Skipping...`, "configure-service");
|
|
105
166
|
}
|
|
106
167
|
else {
|
|
107
|
-
this.
|
|
168
|
+
this.middlewarePipeline.push({
|
|
169
|
+
timestamp: new Date(),
|
|
170
|
+
middleware: express_1.default.static(root, options),
|
|
171
|
+
});
|
|
108
172
|
}
|
|
109
173
|
}
|
|
110
174
|
/**
|
|
@@ -113,22 +177,60 @@ let Middleware = Middleware_1 = class Middleware {
|
|
|
113
177
|
* @param middleware - The Express request handler function to be added to the middleware collection.
|
|
114
178
|
*
|
|
115
179
|
*/
|
|
116
|
-
addMiddleware(middleware) {
|
|
117
|
-
|
|
118
|
-
if (
|
|
119
|
-
|
|
180
|
+
addMiddleware(...middleware) {
|
|
181
|
+
let config;
|
|
182
|
+
if (typeof middleware[0] === "string") {
|
|
183
|
+
const [path, ...middlewares] = middleware;
|
|
184
|
+
config = {
|
|
185
|
+
path,
|
|
186
|
+
middlewares: middlewares,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
191
|
+
config = {
|
|
192
|
+
middlewares: middleware,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
if (config.path) {
|
|
196
|
+
// verify if middleware if path already exists
|
|
197
|
+
const middlewareIndex = this.middlewarePipeline.findIndex((m) => typeof m.middleware === "object" && m.middleware.path === config.path);
|
|
198
|
+
if (middlewareIndex !== -1) {
|
|
199
|
+
this.logger.warn(`[${config.path}] route already exists. Skipping...`, "configure-service");
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
this.middlewarePipeline.push({
|
|
203
|
+
timestamp: new Date(),
|
|
204
|
+
middleware: config,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
120
207
|
}
|
|
121
208
|
else {
|
|
122
|
-
|
|
209
|
+
config.middlewares.forEach((m) => {
|
|
210
|
+
const middlewareName = (m === null || m === void 0 ? void 0 : m.name) || "anonymous";
|
|
211
|
+
const middlewareExist = this.middlewareExists(middlewareName);
|
|
212
|
+
console.log(middlewareExist);
|
|
213
|
+
if (middlewareExist) {
|
|
214
|
+
this.logger.warn(`[${middlewareName}] already exists. Skipping...`, "configure-service");
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
this.middlewarePipeline.push({
|
|
218
|
+
timestamp: new Date(),
|
|
219
|
+
middleware: config,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
});
|
|
123
223
|
}
|
|
124
224
|
}
|
|
125
225
|
/**
|
|
126
|
-
* Retrieves
|
|
226
|
+
* Retrieves middleware pipeline in the order they were added.
|
|
127
227
|
*
|
|
128
228
|
* @returns An array of Express request handlers representing the middlewares.
|
|
129
229
|
*/
|
|
130
|
-
|
|
131
|
-
return this.
|
|
230
|
+
getMiddlewarePipeline() {
|
|
231
|
+
return this.middlewarePipeline.sort((a, b) => {
|
|
232
|
+
return a.timestamp.getTime() - b.timestamp.getTime();
|
|
233
|
+
});
|
|
132
234
|
}
|
|
133
235
|
/**
|
|
134
236
|
* Gets the configured error handler middleware.
|
|
@@ -2,4 +2,8 @@ export { IMiddleware, Middleware } from "./middleware-service";
|
|
|
2
2
|
export { OptionsJson } from "./interfaces/body-parser.interface";
|
|
3
3
|
export { CorsOptions } from "./interfaces/cors.interface";
|
|
4
4
|
export { CompressionOptions } from "./interfaces/compression.interface";
|
|
5
|
+
export { CookieSessionOptions } from "./interfaces/cookie-session/cookie-session.interface";
|
|
6
|
+
export { Keygrip } from "./interfaces/cookie-session/keygrip.interface";
|
|
7
|
+
export { CookieParserOptions } from "./interfaces/cookie-parser.interface";
|
|
8
|
+
export { ServeFaviconOptions } from "./interfaces/serve-favicon.interface";
|
|
5
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/middleware/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/middleware/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAC5F,OAAO,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface CookieParserOptions {
|
|
2
|
+
/**
|
|
3
|
+
* A function used for decoding cookies.
|
|
4
|
+
* By default, `decodeURIComponent` is used.
|
|
5
|
+
* You can provide a custom decoding function here.
|
|
6
|
+
*/
|
|
7
|
+
decode?(val: string): string;
|
|
8
|
+
}
|
|
9
|
+
export { CookieParserOptions };
|
|
10
|
+
//# sourceMappingURL=cookie-parser.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookie-parser.interface.d.ts","sourceRoot":"","sources":["../../../../../packages/core/src/middleware/interfaces/cookie-parser.interface.ts"],"names":[],"mappings":"AAAA,UAAU,mBAAmB;IAC3B;;;;OAIG;IACH,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Keygrip } from "./keygrip.interface";
|
|
2
|
+
interface CookieSessionOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The name of the cookie to set, defaults to session.
|
|
5
|
+
*/
|
|
6
|
+
name?: string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* The list of keys to use to sign & verify cookie values. Set cookies are always signed with keys[0], while the other keys are valid for verification, allowing for key rotation.
|
|
9
|
+
*/
|
|
10
|
+
keys: Array<string> | Keygrip;
|
|
11
|
+
/**
|
|
12
|
+
* A string which will be used as single key if keys is not provided.
|
|
13
|
+
*/
|
|
14
|
+
secret?: string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* a number representing the milliseconds from Date.now() for expiry.
|
|
17
|
+
*/
|
|
18
|
+
maxAge?: number | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* a Date object indicating the cookie's expiration date (expires at the end of session by default).
|
|
21
|
+
*/
|
|
22
|
+
expires?: Date | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* a string indicating the path of the cookie (/ by default).
|
|
25
|
+
*/
|
|
26
|
+
path?: string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* a string indicating the domain of the cookie (no default).
|
|
29
|
+
*/
|
|
30
|
+
domain?: string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* a boolean or string indicating whether the cookie is a "same site" cookie (false by default). This can be set to 'strict', 'lax', 'none', or true (which maps to 'strict').
|
|
33
|
+
*/
|
|
34
|
+
sameSite?: "strict" | "lax" | "none" | boolean | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* a boolean indicating whether the cookie is only to be sent over HTTPS (false by default for HTTP, true by default for HTTPS).
|
|
37
|
+
*/
|
|
38
|
+
secure?: boolean | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* a boolean indicating whether the cookie is only to be sent over HTTPS (use this if you handle SSL not in your node process).
|
|
41
|
+
*/
|
|
42
|
+
secureProxy?: boolean | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* a boolean indicating whether the cookie is only to be sent over HTTP(S), and not made available to client JavaScript (true by default).
|
|
45
|
+
*/
|
|
46
|
+
httpOnly?: boolean | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* a boolean indicating whether the cookie is to be signed (true by default). If this is true, another cookie of the same name with the .sig suffix appended will also be sent, with a 27-byte url-safe base64 SHA1 value representing the hash of cookie-name=cookie-value against the
|
|
49
|
+
* first Keygrip key. This signature key is used to detect tampering the next time a cookie is received.
|
|
50
|
+
*/
|
|
51
|
+
signed?: boolean | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* a boolean indicating whether to overwrite previously set cookies of the same name (true by default). If this is true, all cookies set during the same request with the same name (regardless of path or domain) are filtered out of the Set-Cookie header when setting this cookie.
|
|
54
|
+
*/
|
|
55
|
+
overwrite?: boolean | undefined;
|
|
56
|
+
}
|
|
57
|
+
export { CookieSessionOptions };
|
|
58
|
+
//# sourceMappingURL=cookie-session.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookie-session.interface.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/src/middleware/interfaces/cookie-session/cookie-session.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,UAAU,oBAAoB;IAC5B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1B;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC;IAE9B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B;;OAEG;IACH,OAAO,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IAE3B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IAE3D;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE7B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAElC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE/B;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE7B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACjC;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
interface Keygrip {
|
|
2
|
+
/**
|
|
3
|
+
* Signs the provided data and returns the signature as a string.
|
|
4
|
+
* @param data Data to be signed.
|
|
5
|
+
* @returns Signature string.
|
|
6
|
+
*/
|
|
7
|
+
sign(data: any): string;
|
|
8
|
+
/**
|
|
9
|
+
* Verifies the provided data against a given digest (signature).
|
|
10
|
+
* @param data Data to be verified.
|
|
11
|
+
* @param digest Signature to verify against.
|
|
12
|
+
* @returns True if the verification is successful, otherwise false.
|
|
13
|
+
*/
|
|
14
|
+
verify(data: any, digest: string): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Retrieves the index of the provided data in relation to a given digest (signature).
|
|
17
|
+
* @param data Data to find the index for.
|
|
18
|
+
* @param digest Signature to search for.
|
|
19
|
+
* @returns Index of the data, or -1 if not found.
|
|
20
|
+
*/
|
|
21
|
+
index(data: any, digest: string): number;
|
|
22
|
+
}
|
|
23
|
+
interface KeygripFunction {
|
|
24
|
+
new (keys: ReadonlyArray<string>, algorithm?: string, encoding?: string): Keygrip;
|
|
25
|
+
(keys: ReadonlyArray<string>, algorithm?: string, encoding?: string): Keygrip;
|
|
26
|
+
}
|
|
27
|
+
export { KeygripFunction as Keygrip };
|
|
28
|
+
//# sourceMappingURL=keygrip.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keygrip.interface.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/src/middleware/interfaces/cookie-session/keygrip.interface.ts"],"names":[],"mappings":"AACA,UAAU,OAAO;IACf;;;;OAIG;IAEH,IAAI,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,CAAC;IAExB;;;;;OAKG;IAEH,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IAE3C;;;;;OAKG;IAEH,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1C;AAGD,UAAU,eAAe;IACvB,KACE,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,EAC3B,SAAS,CAAC,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC;IACX,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/E;AAGD,OAAO,EAAE,eAAe,IAAI,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ServeFaviconOptions defines the available options for configuring the serve-favicon middleware.
|
|
3
|
+
*/
|
|
4
|
+
interface ServeFaviconOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The cache-control max-age directive in ms, defaulting to 1 year.
|
|
7
|
+
* This can also be a string accepted by the `ms` module.
|
|
8
|
+
*/
|
|
9
|
+
maxAge?: number | string | undefined;
|
|
10
|
+
}
|
|
11
|
+
export { ServeFaviconOptions };
|
|
12
|
+
//# sourceMappingURL=serve-favicon.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve-favicon.interface.d.ts","sourceRoot":"","sources":["../../../../../packages/core/src/middleware/interfaces/serve-favicon.interface.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,UAAU,mBAAmB;IAC3B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACtC;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware-resolver.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/middleware/middleware-resolver.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"middleware-resolver.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/middleware/middleware-resolver.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAsE9B;;;;;;;GAOG;AACH,iBAAS,kBAAkB,CACzB,UAAU,EAAE,MAAM,EAClB,GAAG,OAAO,EAAE,GAAG,GACd,OAAO,CAAC,cAAc,GAAG,IAAI,CAG/B;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1,9 +1,52 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import express from "express";
|
|
2
3
|
import { OptionsJson } from "./interfaces/body-parser.interface";
|
|
3
4
|
import { CompressionOptions } from "./interfaces/compression.interface";
|
|
4
5
|
import { CorsOptions } from "./interfaces/cors.interface";
|
|
6
|
+
import { CookieParserOptions } from "./interfaces/cookie-parser.interface";
|
|
5
7
|
import { ServeStaticOptions } from "./interfaces/serve-static.interface";
|
|
8
|
+
import { CookieSessionOptions } from "./interfaces/cookie-session/cookie-session.interface";
|
|
9
|
+
import { ServeFaviconOptions } from "./interfaces/serve-favicon.interface";
|
|
10
|
+
/**
|
|
11
|
+
* ExpressHandler Type
|
|
12
|
+
*
|
|
13
|
+
* The ExpressHandler type is a union type that represents various types of Express middleware functions.
|
|
14
|
+
* It can be one of the following types:
|
|
15
|
+
* - express.ErrorRequestHandler: Handles errors in the middleware pipeline.
|
|
16
|
+
* - express.RequestParamHandler: Handles parameters in the middleware pipeline.
|
|
17
|
+
* - express.RequestHandler: General request handler.
|
|
18
|
+
* - undefined: Represents the absence of a handler.
|
|
19
|
+
*/
|
|
6
20
|
type ExpressHandler = express.ErrorRequestHandler | express.RequestParamHandler | express.RequestHandler | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* MiddlewareArgs Type
|
|
23
|
+
*
|
|
24
|
+
* The MiddlewareArgs type represents arguments that can be passed to a middleware function.
|
|
25
|
+
* It can either be a string (a route or path) or an instance of ExpressHandler.
|
|
26
|
+
*/
|
|
27
|
+
type MiddlewareArgs = string | ExpressHandler;
|
|
28
|
+
/**
|
|
29
|
+
* MiddlewareConfig Interface
|
|
30
|
+
*
|
|
31
|
+
* The MiddlewareConfig interface specifies the structure for middleware configuration objects.
|
|
32
|
+
* - path: Optional. The route path for which the middleware is configured.
|
|
33
|
+
* - middlewares: An array of ExpressHandler types that make up the middleware pipeline for the route specified by 'path'.
|
|
34
|
+
*/
|
|
35
|
+
type MiddlewareConfig = {
|
|
36
|
+
path?: string;
|
|
37
|
+
middlewares: Array<ExpressHandler>;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* MiddlewarePipeline Interface
|
|
41
|
+
*
|
|
42
|
+
* The MiddlewarePipeline interface represents the metadata and actual middleware to be executed in a middleware pipeline.
|
|
43
|
+
* - timestamp: The date and time at which the middleware was added to the pipeline.
|
|
44
|
+
* - middleware: Can be either an ExpressHandler function or a MiddlewareConfig object defining a more complex middleware setup.
|
|
45
|
+
*/
|
|
46
|
+
interface MiddlewarePipeline {
|
|
47
|
+
timestamp: Date;
|
|
48
|
+
middleware: ExpressHandler | MiddlewareConfig;
|
|
49
|
+
}
|
|
7
50
|
/**
|
|
8
51
|
* Interface for configuring and managing middlewares in the application.
|
|
9
52
|
* Provides methods to be added automatically in the application without the need to import packages.
|
|
@@ -28,6 +71,27 @@ interface IMiddleware {
|
|
|
28
71
|
* @param options - Optional configuration options for Compression. Allows fine-tuning the compression behavior, such as setting the compression level, threshold, and filter functions to determine which requests should be compressed.
|
|
29
72
|
*/
|
|
30
73
|
addCompression(options?: CompressionOptions): void;
|
|
74
|
+
/**
|
|
75
|
+
* Adds Cookie Parser middleware to parse the cookie header and populate req.cookies with an object keyed by the cookie names.
|
|
76
|
+
*
|
|
77
|
+
* @param secret - A string or array used for signing cookies. This is optional and if not specified, the cookie-parser will not parse signed cookies.
|
|
78
|
+
* @param options - Optional configuration options for Cookie Parser.
|
|
79
|
+
*/
|
|
80
|
+
addCookieParser(secret?: string | Array<string> | undefined, options?: CookieParserOptions): void;
|
|
81
|
+
/**
|
|
82
|
+
* Adds Cookie Session middleware to enable cookie-based sessions.
|
|
83
|
+
*
|
|
84
|
+
* @param options - Optional configuration options for Cookie Session. Defines the behavior of cookie sessions like the name of the cookie, keys to sign the cookie, etc.
|
|
85
|
+
*/
|
|
86
|
+
addCookieSession(options: CookieSessionOptions): void;
|
|
87
|
+
/**
|
|
88
|
+
* Adds a middleware to serve the favicon to the middleware collection.
|
|
89
|
+
* The favicon is the icon that is displayed in the browser tab for the application.
|
|
90
|
+
*
|
|
91
|
+
* @param path - The path to the favicon file.
|
|
92
|
+
* @param options - Optional configuration options for serving the favicon. Defines the behavior of the favicon middleware like cache control, custom headers, etc.
|
|
93
|
+
*/
|
|
94
|
+
addServeFavicon(path: string | Buffer, options?: ServeFaviconOptions): void;
|
|
31
95
|
/**
|
|
32
96
|
* Configures the error handling middleware for the application.
|
|
33
97
|
*
|
|
@@ -48,13 +112,13 @@ interface IMiddleware {
|
|
|
48
112
|
* @param middleware - The Express request handler function to be added to the middleware collection.
|
|
49
113
|
*
|
|
50
114
|
*/
|
|
51
|
-
addMiddleware(middleware:
|
|
115
|
+
addMiddleware(...middleware: Array<MiddlewareArgs>): void;
|
|
52
116
|
/**
|
|
53
|
-
* Retrieves
|
|
117
|
+
* Retrieves middleware pipeline in the order they were added.
|
|
54
118
|
*
|
|
55
119
|
* @returns An array of Express request handlers representing the middlewares.
|
|
56
120
|
*/
|
|
57
|
-
|
|
121
|
+
getMiddlewarePipeline(): Array<MiddlewarePipeline>;
|
|
58
122
|
/**
|
|
59
123
|
* Gets the configured error handler middleware.
|
|
60
124
|
*
|
|
@@ -70,7 +134,7 @@ interface IMiddleware {
|
|
|
70
134
|
* @see IConfigure
|
|
71
135
|
*/
|
|
72
136
|
declare class Middleware implements IMiddleware {
|
|
73
|
-
private
|
|
137
|
+
private middlewarePipeline;
|
|
74
138
|
private errorHandler;
|
|
75
139
|
private logger;
|
|
76
140
|
/**
|
|
@@ -99,6 +163,27 @@ declare class Middleware implements IMiddleware {
|
|
|
99
163
|
* @param options - Optional configuration options for Compression. Allows fine-tuning the compression behavior, such as setting the compression level, threshold, and filter functions to determine which requests should be compressed.
|
|
100
164
|
*/
|
|
101
165
|
addCompression(options?: CompressionOptions): void;
|
|
166
|
+
/**
|
|
167
|
+
* Adds Cookie Parser middleware to parse the cookie header and populate req.cookies with an object keyed by the cookie names.
|
|
168
|
+
*
|
|
169
|
+
* @param secret - A string or array used for signing cookies. This is optional and if not specified, the cookie-parser will not parse signed cookies.
|
|
170
|
+
* @param options - Optional configuration options for Cookie Parser.
|
|
171
|
+
*/
|
|
172
|
+
addCookieParser(secret?: string | Array<string> | undefined, options?: CookieParserOptions | undefined): void;
|
|
173
|
+
/**
|
|
174
|
+
* Adds Cookie Session middleware to enable cookie-based sessions.
|
|
175
|
+
*
|
|
176
|
+
* @param options - Optional configuration options for Cookie Session. Defines the behavior of cookie sessions like the name of the cookie, keys to sign the cookie, etc.
|
|
177
|
+
*/
|
|
178
|
+
addCookieSession(options: CookieSessionOptions): void;
|
|
179
|
+
/**
|
|
180
|
+
* Adds a middleware to serve the favicon to the middleware collection.
|
|
181
|
+
* The favicon is the icon that is displayed in the browser tab for the application.
|
|
182
|
+
*
|
|
183
|
+
* @param path - The path to the favicon file.
|
|
184
|
+
* @param options - Optional configuration options for serving the favicon. Defines the behavior of the favicon middleware like cache control, custom headers, etc.
|
|
185
|
+
*/
|
|
186
|
+
addServeFavicon(path: string | Buffer, options?: ServeFaviconOptions): void;
|
|
102
187
|
/**
|
|
103
188
|
* Configures the error handling middleware for the application.
|
|
104
189
|
*
|
|
@@ -119,13 +204,13 @@ declare class Middleware implements IMiddleware {
|
|
|
119
204
|
* @param middleware - The Express request handler function to be added to the middleware collection.
|
|
120
205
|
*
|
|
121
206
|
*/
|
|
122
|
-
addMiddleware(middleware:
|
|
207
|
+
addMiddleware(...middleware: Array<MiddlewareArgs>): void;
|
|
123
208
|
/**
|
|
124
|
-
* Retrieves
|
|
209
|
+
* Retrieves middleware pipeline in the order they were added.
|
|
125
210
|
*
|
|
126
211
|
* @returns An array of Express request handlers representing the middlewares.
|
|
127
212
|
*/
|
|
128
|
-
|
|
213
|
+
getMiddlewarePipeline(): Array<MiddlewarePipeline>;
|
|
129
214
|
/**
|
|
130
215
|
* Gets the configured error handler middleware.
|
|
131
216
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware-service.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/middleware/middleware-service.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAI9B,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"middleware-service.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/middleware/middleware-service.ts"],"names":[],"mappings":"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"}
|
|
@@ -20,6 +20,9 @@ class MiddlewareResolver {
|
|
|
20
20
|
middlewareRegistry = {
|
|
21
21
|
cors: "cors",
|
|
22
22
|
compression: "compression",
|
|
23
|
+
cookieParser: "cookie-parser",
|
|
24
|
+
cookieSession: "cookie-session",
|
|
25
|
+
serveFavicon: "serve-favicon",
|
|
23
26
|
// Add other middlewares
|
|
24
27
|
};
|
|
25
28
|
/**
|
|
@@ -32,7 +35,7 @@ class MiddlewareResolver {
|
|
|
32
35
|
getMiddleware(middlewareName, ...options) {
|
|
33
36
|
const packageName = this.middlewareRegistry[middlewareName];
|
|
34
37
|
if (!packageName) {
|
|
35
|
-
|
|
38
|
+
this.logger.error(`Middleware ${packageName} not found`, "middleware-resolver");
|
|
36
39
|
return null;
|
|
37
40
|
}
|
|
38
41
|
let hasMiddleware = "";
|
|
@@ -40,7 +43,7 @@ class MiddlewareResolver {
|
|
|
40
43
|
hasMiddleware = require.resolve(packageName, { paths: [process.cwd()] });
|
|
41
44
|
}
|
|
42
45
|
catch (error) {
|
|
43
|
-
this.logger.warn(`Middleware [${
|
|
46
|
+
this.logger.warn(`Middleware [${packageName}] not installed. Please install it using your package manager.`, "middleware-resolver");
|
|
44
47
|
}
|
|
45
48
|
if (hasMiddleware) {
|
|
46
49
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
@@ -24,7 +24,7 @@ const middleware_resolver_1 = require("./middleware-resolver");
|
|
|
24
24
|
* @see IConfigure
|
|
25
25
|
*/
|
|
26
26
|
let Middleware = Middleware_1 = class Middleware {
|
|
27
|
-
|
|
27
|
+
middlewarePipeline = [];
|
|
28
28
|
errorHandler;
|
|
29
29
|
logger = new logger_service_1.Logger();
|
|
30
30
|
/**
|
|
@@ -35,8 +35,9 @@ let Middleware = Middleware_1 = class Middleware {
|
|
|
35
35
|
* @returns A boolean value indicating whether the middleware exists or not.
|
|
36
36
|
*/
|
|
37
37
|
middlewareExists(middlewareName) {
|
|
38
|
-
const
|
|
39
|
-
|
|
38
|
+
const middlewareIndex = this.middlewarePipeline.findIndex((m) => typeof m.middleware === "object"
|
|
39
|
+
? m.middleware.middlewares.some((mw) => mw?.name === middlewareName)
|
|
40
|
+
: m.middleware?.name === middlewareName);
|
|
40
41
|
return middlewareIndex !== -1;
|
|
41
42
|
}
|
|
42
43
|
/**
|
|
@@ -50,7 +51,10 @@ let Middleware = Middleware_1 = class Middleware {
|
|
|
50
51
|
this.logger.warn(`[jsonParser] already exists. Skipping...`, "configure-service");
|
|
51
52
|
}
|
|
52
53
|
else {
|
|
53
|
-
this.
|
|
54
|
+
this.middlewarePipeline.push({
|
|
55
|
+
timestamp: new Date(),
|
|
56
|
+
middleware: express_1.default.json(options),
|
|
57
|
+
});
|
|
54
58
|
}
|
|
55
59
|
}
|
|
56
60
|
/**
|
|
@@ -62,7 +66,10 @@ let Middleware = Middleware_1 = class Middleware {
|
|
|
62
66
|
const middleware = (0, middleware_resolver_1.middlewareResolver)("cors", options);
|
|
63
67
|
const middlewareExist = this.middlewareExists("cors");
|
|
64
68
|
if (middleware && !middlewareExist) {
|
|
65
|
-
this.
|
|
69
|
+
this.middlewarePipeline.push({
|
|
70
|
+
timestamp: new Date(),
|
|
71
|
+
middleware,
|
|
72
|
+
});
|
|
66
73
|
}
|
|
67
74
|
}
|
|
68
75
|
/**
|
|
@@ -74,7 +81,58 @@ let Middleware = Middleware_1 = class Middleware {
|
|
|
74
81
|
const middleware = (0, middleware_resolver_1.middlewareResolver)("compression", options);
|
|
75
82
|
const middlewareExist = this.middlewareExists("compression");
|
|
76
83
|
if (middleware && !middlewareExist) {
|
|
77
|
-
this.
|
|
84
|
+
this.middlewarePipeline.push({
|
|
85
|
+
timestamp: new Date(),
|
|
86
|
+
middleware,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Adds Cookie Parser middleware to parse the cookie header and populate req.cookies with an object keyed by the cookie names.
|
|
92
|
+
*
|
|
93
|
+
* @param secret - A string or array used for signing cookies. This is optional and if not specified, the cookie-parser will not parse signed cookies.
|
|
94
|
+
* @param options - Optional configuration options for Cookie Parser.
|
|
95
|
+
*/
|
|
96
|
+
addCookieParser(secret, options) {
|
|
97
|
+
const middleware = (0, middleware_resolver_1.middlewareResolver)("cookieParser", secret, options);
|
|
98
|
+
const middlewareExist = this.middlewareExists("cookieParser");
|
|
99
|
+
if (middleware && !middlewareExist) {
|
|
100
|
+
this.middlewarePipeline.push({
|
|
101
|
+
timestamp: new Date(),
|
|
102
|
+
middleware,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Adds Cookie Session middleware to enable cookie-based sessions.
|
|
108
|
+
*
|
|
109
|
+
* @param options - Optional configuration options for Cookie Session. Defines the behavior of cookie sessions like the name of the cookie, keys to sign the cookie, etc.
|
|
110
|
+
*/
|
|
111
|
+
addCookieSession(options) {
|
|
112
|
+
const middleware = (0, middleware_resolver_1.middlewareResolver)("cookieSession", options);
|
|
113
|
+
const middlewareExist = this.middlewareExists("cookieSession");
|
|
114
|
+
if (middleware && !middlewareExist) {
|
|
115
|
+
this.middlewarePipeline.push({
|
|
116
|
+
timestamp: new Date(),
|
|
117
|
+
middleware,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Adds a middleware to serve the favicon to the middleware collection.
|
|
123
|
+
* The favicon is the icon that is displayed in the browser tab for the application.
|
|
124
|
+
*
|
|
125
|
+
* @param path - The path to the favicon file.
|
|
126
|
+
* @param options - Optional configuration options for serving the favicon. Defines the behavior of the favicon middleware like cache control, custom headers, etc.
|
|
127
|
+
*/
|
|
128
|
+
addServeFavicon(path, options) {
|
|
129
|
+
const middleware = (0, middleware_resolver_1.middlewareResolver)("serveFavicon", path, options);
|
|
130
|
+
const middlewareExist = this.middlewareExists("serveFavicon");
|
|
131
|
+
if (middleware && !middlewareExist) {
|
|
132
|
+
this.middlewarePipeline.push({
|
|
133
|
+
timestamp: new Date(),
|
|
134
|
+
middleware,
|
|
135
|
+
});
|
|
78
136
|
}
|
|
79
137
|
}
|
|
80
138
|
/**
|
|
@@ -103,7 +161,10 @@ let Middleware = Middleware_1 = class Middleware {
|
|
|
103
161
|
this.logger.warn(`[serveStatic] already exists. Skipping...`, "configure-service");
|
|
104
162
|
}
|
|
105
163
|
else {
|
|
106
|
-
this.
|
|
164
|
+
this.middlewarePipeline.push({
|
|
165
|
+
timestamp: new Date(),
|
|
166
|
+
middleware: express_1.default.static(root, options),
|
|
167
|
+
});
|
|
107
168
|
}
|
|
108
169
|
}
|
|
109
170
|
/**
|
|
@@ -112,22 +173,60 @@ let Middleware = Middleware_1 = class Middleware {
|
|
|
112
173
|
* @param middleware - The Express request handler function to be added to the middleware collection.
|
|
113
174
|
*
|
|
114
175
|
*/
|
|
115
|
-
addMiddleware(middleware) {
|
|
116
|
-
|
|
117
|
-
if (
|
|
118
|
-
|
|
176
|
+
addMiddleware(...middleware) {
|
|
177
|
+
let config;
|
|
178
|
+
if (typeof middleware[0] === "string") {
|
|
179
|
+
const [path, ...middlewares] = middleware;
|
|
180
|
+
config = {
|
|
181
|
+
path,
|
|
182
|
+
middlewares: middlewares,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
187
|
+
config = {
|
|
188
|
+
middlewares: middleware,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
if (config.path) {
|
|
192
|
+
// verify if middleware if path already exists
|
|
193
|
+
const middlewareIndex = this.middlewarePipeline.findIndex((m) => typeof m.middleware === "object" && m.middleware.path === config.path);
|
|
194
|
+
if (middlewareIndex !== -1) {
|
|
195
|
+
this.logger.warn(`[${config.path}] route already exists. Skipping...`, "configure-service");
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
this.middlewarePipeline.push({
|
|
199
|
+
timestamp: new Date(),
|
|
200
|
+
middleware: config,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
119
203
|
}
|
|
120
204
|
else {
|
|
121
|
-
|
|
205
|
+
config.middlewares.forEach((m) => {
|
|
206
|
+
const middlewareName = m?.name || "anonymous";
|
|
207
|
+
const middlewareExist = this.middlewareExists(middlewareName);
|
|
208
|
+
console.log(middlewareExist);
|
|
209
|
+
if (middlewareExist) {
|
|
210
|
+
this.logger.warn(`[${middlewareName}] already exists. Skipping...`, "configure-service");
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
this.middlewarePipeline.push({
|
|
214
|
+
timestamp: new Date(),
|
|
215
|
+
middleware: config,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
});
|
|
122
219
|
}
|
|
123
220
|
}
|
|
124
221
|
/**
|
|
125
|
-
* Retrieves
|
|
222
|
+
* Retrieves middleware pipeline in the order they were added.
|
|
126
223
|
*
|
|
127
224
|
* @returns An array of Express request handlers representing the middlewares.
|
|
128
225
|
*/
|
|
129
|
-
|
|
130
|
-
return this.
|
|
226
|
+
getMiddlewarePipeline() {
|
|
227
|
+
return this.middlewarePipeline.sort((a, b) => {
|
|
228
|
+
return a.timestamp.getTime() - b.timestamp.getTime();
|
|
229
|
+
});
|
|
131
230
|
}
|
|
132
231
|
/**
|
|
133
232
|
* Gets the configured error handler middleware.
|
|
@@ -2,4 +2,8 @@ export { IMiddleware, Middleware } from "./middleware-service";
|
|
|
2
2
|
export { OptionsJson } from "./interfaces/body-parser.interface";
|
|
3
3
|
export { CorsOptions } from "./interfaces/cors.interface";
|
|
4
4
|
export { CompressionOptions } from "./interfaces/compression.interface";
|
|
5
|
+
export { CookieSessionOptions } from "./interfaces/cookie-session/cookie-session.interface";
|
|
6
|
+
export { Keygrip } from "./interfaces/cookie-session/keygrip.interface";
|
|
7
|
+
export { CookieParserOptions } from "./interfaces/cookie-parser.interface";
|
|
8
|
+
export { ServeFaviconOptions } from "./interfaces/serve-favicon.interface";
|
|
5
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/middleware/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/middleware/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAC5F,OAAO,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface CookieParserOptions {
|
|
2
|
+
/**
|
|
3
|
+
* A function used for decoding cookies.
|
|
4
|
+
* By default, `decodeURIComponent` is used.
|
|
5
|
+
* You can provide a custom decoding function here.
|
|
6
|
+
*/
|
|
7
|
+
decode?(val: string): string;
|
|
8
|
+
}
|
|
9
|
+
export { CookieParserOptions };
|
|
10
|
+
//# sourceMappingURL=cookie-parser.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookie-parser.interface.d.ts","sourceRoot":"","sources":["../../../../../packages/core/src/middleware/interfaces/cookie-parser.interface.ts"],"names":[],"mappings":"AAAA,UAAU,mBAAmB;IAC3B;;;;OAIG;IACH,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Keygrip } from "./keygrip.interface";
|
|
2
|
+
interface CookieSessionOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The name of the cookie to set, defaults to session.
|
|
5
|
+
*/
|
|
6
|
+
name?: string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* The list of keys to use to sign & verify cookie values. Set cookies are always signed with keys[0], while the other keys are valid for verification, allowing for key rotation.
|
|
9
|
+
*/
|
|
10
|
+
keys: Array<string> | Keygrip;
|
|
11
|
+
/**
|
|
12
|
+
* A string which will be used as single key if keys is not provided.
|
|
13
|
+
*/
|
|
14
|
+
secret?: string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* a number representing the milliseconds from Date.now() for expiry.
|
|
17
|
+
*/
|
|
18
|
+
maxAge?: number | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* a Date object indicating the cookie's expiration date (expires at the end of session by default).
|
|
21
|
+
*/
|
|
22
|
+
expires?: Date | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* a string indicating the path of the cookie (/ by default).
|
|
25
|
+
*/
|
|
26
|
+
path?: string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* a string indicating the domain of the cookie (no default).
|
|
29
|
+
*/
|
|
30
|
+
domain?: string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* a boolean or string indicating whether the cookie is a "same site" cookie (false by default). This can be set to 'strict', 'lax', 'none', or true (which maps to 'strict').
|
|
33
|
+
*/
|
|
34
|
+
sameSite?: "strict" | "lax" | "none" | boolean | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* a boolean indicating whether the cookie is only to be sent over HTTPS (false by default for HTTP, true by default for HTTPS).
|
|
37
|
+
*/
|
|
38
|
+
secure?: boolean | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* a boolean indicating whether the cookie is only to be sent over HTTPS (use this if you handle SSL not in your node process).
|
|
41
|
+
*/
|
|
42
|
+
secureProxy?: boolean | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* a boolean indicating whether the cookie is only to be sent over HTTP(S), and not made available to client JavaScript (true by default).
|
|
45
|
+
*/
|
|
46
|
+
httpOnly?: boolean | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* a boolean indicating whether the cookie is to be signed (true by default). If this is true, another cookie of the same name with the .sig suffix appended will also be sent, with a 27-byte url-safe base64 SHA1 value representing the hash of cookie-name=cookie-value against the
|
|
49
|
+
* first Keygrip key. This signature key is used to detect tampering the next time a cookie is received.
|
|
50
|
+
*/
|
|
51
|
+
signed?: boolean | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* a boolean indicating whether to overwrite previously set cookies of the same name (true by default). If this is true, all cookies set during the same request with the same name (regardless of path or domain) are filtered out of the Set-Cookie header when setting this cookie.
|
|
54
|
+
*/
|
|
55
|
+
overwrite?: boolean | undefined;
|
|
56
|
+
}
|
|
57
|
+
export { CookieSessionOptions };
|
|
58
|
+
//# sourceMappingURL=cookie-session.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookie-session.interface.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/src/middleware/interfaces/cookie-session/cookie-session.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,UAAU,oBAAoB;IAC5B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1B;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC;IAE9B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B;;OAEG;IACH,OAAO,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IAE3B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IAE3D;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE7B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAElC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE/B;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE7B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACjC;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
interface Keygrip {
|
|
2
|
+
/**
|
|
3
|
+
* Signs the provided data and returns the signature as a string.
|
|
4
|
+
* @param data Data to be signed.
|
|
5
|
+
* @returns Signature string.
|
|
6
|
+
*/
|
|
7
|
+
sign(data: any): string;
|
|
8
|
+
/**
|
|
9
|
+
* Verifies the provided data against a given digest (signature).
|
|
10
|
+
* @param data Data to be verified.
|
|
11
|
+
* @param digest Signature to verify against.
|
|
12
|
+
* @returns True if the verification is successful, otherwise false.
|
|
13
|
+
*/
|
|
14
|
+
verify(data: any, digest: string): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Retrieves the index of the provided data in relation to a given digest (signature).
|
|
17
|
+
* @param data Data to find the index for.
|
|
18
|
+
* @param digest Signature to search for.
|
|
19
|
+
* @returns Index of the data, or -1 if not found.
|
|
20
|
+
*/
|
|
21
|
+
index(data: any, digest: string): number;
|
|
22
|
+
}
|
|
23
|
+
interface KeygripFunction {
|
|
24
|
+
new (keys: ReadonlyArray<string>, algorithm?: string, encoding?: string): Keygrip;
|
|
25
|
+
(keys: ReadonlyArray<string>, algorithm?: string, encoding?: string): Keygrip;
|
|
26
|
+
}
|
|
27
|
+
export { KeygripFunction as Keygrip };
|
|
28
|
+
//# sourceMappingURL=keygrip.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keygrip.interface.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/src/middleware/interfaces/cookie-session/keygrip.interface.ts"],"names":[],"mappings":"AACA,UAAU,OAAO;IACf;;;;OAIG;IAEH,IAAI,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,CAAC;IAExB;;;;;OAKG;IAEH,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IAE3C;;;;;OAKG;IAEH,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1C;AAGD,UAAU,eAAe;IACvB,KACE,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,EAC3B,SAAS,CAAC,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC;IACX,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/E;AAGD,OAAO,EAAE,eAAe,IAAI,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ServeFaviconOptions defines the available options for configuring the serve-favicon middleware.
|
|
3
|
+
*/
|
|
4
|
+
interface ServeFaviconOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The cache-control max-age directive in ms, defaulting to 1 year.
|
|
7
|
+
* This can also be a string accepted by the `ms` module.
|
|
8
|
+
*/
|
|
9
|
+
maxAge?: number | string | undefined;
|
|
10
|
+
}
|
|
11
|
+
export { ServeFaviconOptions };
|
|
12
|
+
//# sourceMappingURL=serve-favicon.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve-favicon.interface.d.ts","sourceRoot":"","sources":["../../../../../packages/core/src/middleware/interfaces/serve-favicon.interface.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,UAAU,mBAAmB;IAC3B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACtC;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware-resolver.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/middleware/middleware-resolver.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"middleware-resolver.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/middleware/middleware-resolver.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAsE9B;;;;;;;GAOG;AACH,iBAAS,kBAAkB,CACzB,UAAU,EAAE,MAAM,EAClB,GAAG,OAAO,EAAE,GAAG,GACd,OAAO,CAAC,cAAc,GAAG,IAAI,CAG/B;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1,9 +1,52 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import express from "express";
|
|
2
3
|
import { OptionsJson } from "./interfaces/body-parser.interface";
|
|
3
4
|
import { CompressionOptions } from "./interfaces/compression.interface";
|
|
4
5
|
import { CorsOptions } from "./interfaces/cors.interface";
|
|
6
|
+
import { CookieParserOptions } from "./interfaces/cookie-parser.interface";
|
|
5
7
|
import { ServeStaticOptions } from "./interfaces/serve-static.interface";
|
|
8
|
+
import { CookieSessionOptions } from "./interfaces/cookie-session/cookie-session.interface";
|
|
9
|
+
import { ServeFaviconOptions } from "./interfaces/serve-favicon.interface";
|
|
10
|
+
/**
|
|
11
|
+
* ExpressHandler Type
|
|
12
|
+
*
|
|
13
|
+
* The ExpressHandler type is a union type that represents various types of Express middleware functions.
|
|
14
|
+
* It can be one of the following types:
|
|
15
|
+
* - express.ErrorRequestHandler: Handles errors in the middleware pipeline.
|
|
16
|
+
* - express.RequestParamHandler: Handles parameters in the middleware pipeline.
|
|
17
|
+
* - express.RequestHandler: General request handler.
|
|
18
|
+
* - undefined: Represents the absence of a handler.
|
|
19
|
+
*/
|
|
6
20
|
type ExpressHandler = express.ErrorRequestHandler | express.RequestParamHandler | express.RequestHandler | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* MiddlewareArgs Type
|
|
23
|
+
*
|
|
24
|
+
* The MiddlewareArgs type represents arguments that can be passed to a middleware function.
|
|
25
|
+
* It can either be a string (a route or path) or an instance of ExpressHandler.
|
|
26
|
+
*/
|
|
27
|
+
type MiddlewareArgs = string | ExpressHandler;
|
|
28
|
+
/**
|
|
29
|
+
* MiddlewareConfig Interface
|
|
30
|
+
*
|
|
31
|
+
* The MiddlewareConfig interface specifies the structure for middleware configuration objects.
|
|
32
|
+
* - path: Optional. The route path for which the middleware is configured.
|
|
33
|
+
* - middlewares: An array of ExpressHandler types that make up the middleware pipeline for the route specified by 'path'.
|
|
34
|
+
*/
|
|
35
|
+
type MiddlewareConfig = {
|
|
36
|
+
path?: string;
|
|
37
|
+
middlewares: Array<ExpressHandler>;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* MiddlewarePipeline Interface
|
|
41
|
+
*
|
|
42
|
+
* The MiddlewarePipeline interface represents the metadata and actual middleware to be executed in a middleware pipeline.
|
|
43
|
+
* - timestamp: The date and time at which the middleware was added to the pipeline.
|
|
44
|
+
* - middleware: Can be either an ExpressHandler function or a MiddlewareConfig object defining a more complex middleware setup.
|
|
45
|
+
*/
|
|
46
|
+
interface MiddlewarePipeline {
|
|
47
|
+
timestamp: Date;
|
|
48
|
+
middleware: ExpressHandler | MiddlewareConfig;
|
|
49
|
+
}
|
|
7
50
|
/**
|
|
8
51
|
* Interface for configuring and managing middlewares in the application.
|
|
9
52
|
* Provides methods to be added automatically in the application without the need to import packages.
|
|
@@ -28,6 +71,27 @@ interface IMiddleware {
|
|
|
28
71
|
* @param options - Optional configuration options for Compression. Allows fine-tuning the compression behavior, such as setting the compression level, threshold, and filter functions to determine which requests should be compressed.
|
|
29
72
|
*/
|
|
30
73
|
addCompression(options?: CompressionOptions): void;
|
|
74
|
+
/**
|
|
75
|
+
* Adds Cookie Parser middleware to parse the cookie header and populate req.cookies with an object keyed by the cookie names.
|
|
76
|
+
*
|
|
77
|
+
* @param secret - A string or array used for signing cookies. This is optional and if not specified, the cookie-parser will not parse signed cookies.
|
|
78
|
+
* @param options - Optional configuration options for Cookie Parser.
|
|
79
|
+
*/
|
|
80
|
+
addCookieParser(secret?: string | Array<string> | undefined, options?: CookieParserOptions): void;
|
|
81
|
+
/**
|
|
82
|
+
* Adds Cookie Session middleware to enable cookie-based sessions.
|
|
83
|
+
*
|
|
84
|
+
* @param options - Optional configuration options for Cookie Session. Defines the behavior of cookie sessions like the name of the cookie, keys to sign the cookie, etc.
|
|
85
|
+
*/
|
|
86
|
+
addCookieSession(options: CookieSessionOptions): void;
|
|
87
|
+
/**
|
|
88
|
+
* Adds a middleware to serve the favicon to the middleware collection.
|
|
89
|
+
* The favicon is the icon that is displayed in the browser tab for the application.
|
|
90
|
+
*
|
|
91
|
+
* @param path - The path to the favicon file.
|
|
92
|
+
* @param options - Optional configuration options for serving the favicon. Defines the behavior of the favicon middleware like cache control, custom headers, etc.
|
|
93
|
+
*/
|
|
94
|
+
addServeFavicon(path: string | Buffer, options?: ServeFaviconOptions): void;
|
|
31
95
|
/**
|
|
32
96
|
* Configures the error handling middleware for the application.
|
|
33
97
|
*
|
|
@@ -48,13 +112,13 @@ interface IMiddleware {
|
|
|
48
112
|
* @param middleware - The Express request handler function to be added to the middleware collection.
|
|
49
113
|
*
|
|
50
114
|
*/
|
|
51
|
-
addMiddleware(middleware:
|
|
115
|
+
addMiddleware(...middleware: Array<MiddlewareArgs>): void;
|
|
52
116
|
/**
|
|
53
|
-
* Retrieves
|
|
117
|
+
* Retrieves middleware pipeline in the order they were added.
|
|
54
118
|
*
|
|
55
119
|
* @returns An array of Express request handlers representing the middlewares.
|
|
56
120
|
*/
|
|
57
|
-
|
|
121
|
+
getMiddlewarePipeline(): Array<MiddlewarePipeline>;
|
|
58
122
|
/**
|
|
59
123
|
* Gets the configured error handler middleware.
|
|
60
124
|
*
|
|
@@ -70,7 +134,7 @@ interface IMiddleware {
|
|
|
70
134
|
* @see IConfigure
|
|
71
135
|
*/
|
|
72
136
|
declare class Middleware implements IMiddleware {
|
|
73
|
-
private
|
|
137
|
+
private middlewarePipeline;
|
|
74
138
|
private errorHandler;
|
|
75
139
|
private logger;
|
|
76
140
|
/**
|
|
@@ -99,6 +163,27 @@ declare class Middleware implements IMiddleware {
|
|
|
99
163
|
* @param options - Optional configuration options for Compression. Allows fine-tuning the compression behavior, such as setting the compression level, threshold, and filter functions to determine which requests should be compressed.
|
|
100
164
|
*/
|
|
101
165
|
addCompression(options?: CompressionOptions): void;
|
|
166
|
+
/**
|
|
167
|
+
* Adds Cookie Parser middleware to parse the cookie header and populate req.cookies with an object keyed by the cookie names.
|
|
168
|
+
*
|
|
169
|
+
* @param secret - A string or array used for signing cookies. This is optional and if not specified, the cookie-parser will not parse signed cookies.
|
|
170
|
+
* @param options - Optional configuration options for Cookie Parser.
|
|
171
|
+
*/
|
|
172
|
+
addCookieParser(secret?: string | Array<string> | undefined, options?: CookieParserOptions | undefined): void;
|
|
173
|
+
/**
|
|
174
|
+
* Adds Cookie Session middleware to enable cookie-based sessions.
|
|
175
|
+
*
|
|
176
|
+
* @param options - Optional configuration options for Cookie Session. Defines the behavior of cookie sessions like the name of the cookie, keys to sign the cookie, etc.
|
|
177
|
+
*/
|
|
178
|
+
addCookieSession(options: CookieSessionOptions): void;
|
|
179
|
+
/**
|
|
180
|
+
* Adds a middleware to serve the favicon to the middleware collection.
|
|
181
|
+
* The favicon is the icon that is displayed in the browser tab for the application.
|
|
182
|
+
*
|
|
183
|
+
* @param path - The path to the favicon file.
|
|
184
|
+
* @param options - Optional configuration options for serving the favicon. Defines the behavior of the favicon middleware like cache control, custom headers, etc.
|
|
185
|
+
*/
|
|
186
|
+
addServeFavicon(path: string | Buffer, options?: ServeFaviconOptions): void;
|
|
102
187
|
/**
|
|
103
188
|
* Configures the error handling middleware for the application.
|
|
104
189
|
*
|
|
@@ -119,13 +204,13 @@ declare class Middleware implements IMiddleware {
|
|
|
119
204
|
* @param middleware - The Express request handler function to be added to the middleware collection.
|
|
120
205
|
*
|
|
121
206
|
*/
|
|
122
|
-
addMiddleware(middleware:
|
|
207
|
+
addMiddleware(...middleware: Array<MiddlewareArgs>): void;
|
|
123
208
|
/**
|
|
124
|
-
* Retrieves
|
|
209
|
+
* Retrieves middleware pipeline in the order they were added.
|
|
125
210
|
*
|
|
126
211
|
* @returns An array of Express request handlers representing the middlewares.
|
|
127
212
|
*/
|
|
128
|
-
|
|
213
|
+
getMiddlewarePipeline(): Array<MiddlewarePipeline>;
|
|
129
214
|
/**
|
|
130
215
|
* Gets the configured error handler middleware.
|
|
131
216
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware-service.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/middleware/middleware-service.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAI9B,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"middleware-service.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/middleware/middleware-service.ts"],"names":[],"mappings":"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"}
|
package/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expressots/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Expressots - modern, fast, lightweight nodejs web framework (@core)",
|
|
5
5
|
"author": "Richard Zampieri",
|
|
6
6
|
"main": "./lib/cjs/index.js",
|
|
@@ -51,13 +51,11 @@
|
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"prepare": "husky install",
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"build:
|
|
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
|
+
"rename:esm": "node scripts/mv.js lib/esm/index.js lib/esm/index.mjs",
|
|
57
|
+
"build": "npm run clean && npm run build:esm && npm run build:cjs && npm run copy",
|
|
58
|
+
"build:esm": "tsc -p tsconfig.esm.json && npm run rename:esm",
|
|
61
59
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
62
60
|
"release": "release-it",
|
|
63
61
|
"coverage": "vitest run --coverage",
|
|
@@ -145,6 +143,10 @@
|
|
|
145
143
|
{
|
|
146
144
|
"type": "ci",
|
|
147
145
|
"section": "Continuous Integrations"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"type": "chore",
|
|
149
|
+
"hidden": true
|
|
148
150
|
}
|
|
149
151
|
]
|
|
150
152
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expressots/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Expressots - modern, fast, lightweight nodejs web framework (@core)",
|
|
5
5
|
"author": "Richard Zampieri",
|
|
6
6
|
"main": "./lib/cjs/index.js",
|
|
@@ -51,13 +51,11 @@
|
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"prepare": "husky install",
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"build:
|
|
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
|
+
"rename:esm": "node scripts/mv.js lib/esm/index.js lib/esm/index.mjs",
|
|
57
|
+
"build": "npm run clean && npm run build:esm && npm run build:cjs && npm run copy",
|
|
58
|
+
"build:esm": "tsc -p tsconfig.esm.json && npm run rename:esm",
|
|
61
59
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
62
60
|
"release": "release-it",
|
|
63
61
|
"coverage": "vitest run --coverage",
|
|
@@ -145,6 +143,10 @@
|
|
|
145
143
|
{
|
|
146
144
|
"type": "ci",
|
|
147
145
|
"section": "Continuous Integrations"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"type": "chore",
|
|
149
|
+
"hidden": true
|
|
148
150
|
}
|
|
149
151
|
]
|
|
150
152
|
}
|