@athenna/http 1.1.1 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +4 -4
- package/src/Kernels/HttpKernel.d.ts +18 -0
- package/src/Kernels/HttpKernel.js +6 -0
- package/src/Router/Route.js +2 -1
package/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export * from './src/Http';
|
|
10
10
|
export * from './src/Router/Router';
|
|
11
|
+
export * from './src/Kernels/HttpKernel';
|
|
11
12
|
export * from './src/Providers/HttpRouteProvider';
|
|
12
13
|
export * from './src/Providers/HttpServerProvider';
|
|
13
14
|
export * from './src/Contracts/MiddlewareContract';
|
package/index.js
CHANGED
|
@@ -20,6 +20,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
__exportStar(require("./src/Http"), exports);
|
|
22
22
|
__exportStar(require("./src/Router/Router"), exports);
|
|
23
|
+
__exportStar(require("./src/Kernels/HttpKernel"), exports);
|
|
23
24
|
__exportStar(require("./src/Providers/HttpRouteProvider"), exports);
|
|
24
25
|
__exportStar(require("./src/Providers/HttpServerProvider"), exports);
|
|
25
26
|
__exportStar(require("./src/Contracts/MiddlewareContract"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@athenna/http",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "The Athenna Http server. Built on top of fastify",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "João Lenon <lenon@athenna.io>",
|
|
@@ -158,9 +158,9 @@
|
|
|
158
158
|
}
|
|
159
159
|
},
|
|
160
160
|
"dependencies": {
|
|
161
|
-
"@athenna/config": "1.0.
|
|
162
|
-
"@athenna/ioc": "1.
|
|
163
|
-
"@secjs/utils": "1.8.
|
|
161
|
+
"@athenna/config": "1.0.6",
|
|
162
|
+
"@athenna/ioc": "1.1.1",
|
|
163
|
+
"@secjs/utils": "1.8.2",
|
|
164
164
|
"fastify": "3.27.4",
|
|
165
165
|
"reflect-metadata": "0.1.13",
|
|
166
166
|
"tscpaths": "0.0.9"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MiddlewareContract } from '../Contracts/MiddlewareContract';
|
|
2
|
+
export declare type MiddlewareContractClass = {
|
|
3
|
+
new (container?: any): MiddlewareContract;
|
|
4
|
+
};
|
|
5
|
+
export declare abstract class HttpKernel {
|
|
6
|
+
/**
|
|
7
|
+
* The application's global HTTP middlewares.
|
|
8
|
+
*
|
|
9
|
+
* This middlewares are run during every request to your http server.
|
|
10
|
+
*/
|
|
11
|
+
protected abstract globalMiddlewares: MiddlewareContractClass[];
|
|
12
|
+
/**
|
|
13
|
+
* The application's named HTTP middlewares.
|
|
14
|
+
*
|
|
15
|
+
* Here you define all your named middlewares to use inside routes/http file.
|
|
16
|
+
*/
|
|
17
|
+
protected abstract namedMiddlewares: Record<string, MiddlewareContractClass>;
|
|
18
|
+
}
|
package/src/Router/Route.js
CHANGED
|
@@ -47,7 +47,8 @@ class Route {
|
|
|
47
47
|
};
|
|
48
48
|
const insertionType = prepend ? 'unshift' : 'push';
|
|
49
49
|
if (utils_1.Is.String(middleware)) {
|
|
50
|
-
const mid = ioc.
|
|
50
|
+
const mid = ioc.use(`App/Middlewares/Names/${middleware}`) ||
|
|
51
|
+
ioc.safeUse(`App/Middlewares/${middleware}`);
|
|
51
52
|
if (!mid) {
|
|
52
53
|
throw new MiddlewareNotFoundException_1.MiddlewareNotFoundException(middleware);
|
|
53
54
|
}
|