@athenna/http 1.0.5 → 1.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@athenna/http",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
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>",
@@ -7,14 +7,13 @@
7
7
  * file that was distributed with this source code.
8
8
  */
9
9
  import { RequestContract } from '../../RequestContract';
10
- import { ResponseContract } from '../../ResponseContract';
11
10
  import { NextInterceptContract } from './NextInterceptContract';
12
11
  export interface InterceptContextContract {
13
12
  request: RequestContract;
14
- response: ResponseContract;
15
13
  params: Record<string, string>;
16
14
  queries: Record<string, string>;
17
15
  body: Record<string, any>;
16
+ status: number;
18
17
  data: Record<string, any>;
19
18
  next: NextInterceptContract;
20
19
  }
@@ -17,7 +17,7 @@ declare module 'fastify' {
17
17
  }
18
18
  }
19
19
  export declare class FastifyHandler {
20
- static createOnSendHandler(handler: InterceptHandlerContract): (req: any, res: any, payload: any, done: any) => any;
20
+ static createOnSendHandler(handler: InterceptHandlerContract): (req: any, _res: any, payload: any, done: any) => any;
21
21
  static createDoneHandler(handler: HandleHandlerContract): (req: any, res: any, done: any) => any;
22
22
  static createErrorHandler(handler: ErrorHandlerContract): (error: any, req: FastifyRequest, res: FastifyReply) => any;
23
23
  static createRequestHandler(handler: HandlerContract): (req: FastifyRequest, res: FastifyReply) => Promise<any>;
@@ -15,9 +15,8 @@ const Request_1 = require("../Context/Request");
15
15
  const Response_1 = require("../Context/Response");
16
16
  class FastifyHandler {
17
17
  static createOnSendHandler(handler) {
18
- return (req, res, payload, done) => {
18
+ return (req, _res, payload, done) => {
19
19
  const request = new Request_1.Request(req);
20
- const response = new Response_1.Response(res);
21
20
  if (!req.data)
22
21
  req.data = {};
23
22
  if (!req.query)
@@ -30,8 +29,8 @@ class FastifyHandler {
30
29
  }
31
30
  return handler({
32
31
  request,
33
- response,
34
32
  body,
33
+ status: _res.statusCode,
35
34
  params: req.params,
36
35
  queries: req.query,
37
36
  data: req.data,