@athenna/http 1.3.3 → 1.3.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.
Files changed (95) hide show
  1. package/LICENSE.md +3 -15
  2. package/README.md +8 -5
  3. package/package.json +95 -106
  4. package/src/Context/Request.js +168 -137
  5. package/src/Context/Response.js +102 -94
  6. package/src/Exceptions/UndefinedMethodException.js +30 -0
  7. package/src/Facades/Route.js +7 -5
  8. package/src/Facades/Server.js +7 -5
  9. package/src/Handlers/FastifyHandler.js +134 -115
  10. package/src/Handlers/HttpExceptionHandler.js +71 -68
  11. package/src/Kernels/HttpKernel.js +142 -124
  12. package/src/Providers/ControllerProvider.js +30 -39
  13. package/src/Providers/HttpRouteProvider.js +15 -16
  14. package/src/Providers/HttpServerProvider.js +13 -15
  15. package/src/Providers/MiddlewareProvider.js +30 -39
  16. package/src/Router/Route.js +192 -99
  17. package/src/Router/RouteGroup.js +66 -40
  18. package/src/Router/RouteResource.js +156 -74
  19. package/src/Router/Router.js +284 -112
  20. package/src/Utils/isMiddlewareContract.js +8 -6
  21. package/src/Utils/removeSlashes.js +21 -0
  22. package/src/index.d.ts +658 -0
  23. package/src/index.js +284 -0
  24. package/index.d.ts +0 -29
  25. package/index.js +0 -41
  26. package/src/Context/Request.d.ts +0 -103
  27. package/src/Context/Response.d.ts +0 -77
  28. package/src/Contracts/Context/ContextContract.d.ts +0 -17
  29. package/src/Contracts/Context/ContextContract.js +0 -10
  30. package/src/Contracts/Context/Error/ErrorContextContract.d.ts +0 -18
  31. package/src/Contracts/Context/Error/ErrorContextContract.js +0 -10
  32. package/src/Contracts/Context/Error/ErrorHandlerContract.d.ts +0 -12
  33. package/src/Contracts/Context/Error/ErrorHandlerContract.js +0 -10
  34. package/src/Contracts/Context/HandlerContract.d.ts +0 -12
  35. package/src/Contracts/Context/HandlerContract.js +0 -10
  36. package/src/Contracts/Context/Middlewares/Handle/HandleContextContract.d.ts +0 -19
  37. package/src/Contracts/Context/Middlewares/Handle/HandleContextContract.js +0 -10
  38. package/src/Contracts/Context/Middlewares/Handle/HandleHandlerContract.d.ts +0 -12
  39. package/src/Contracts/Context/Middlewares/Handle/HandleHandlerContract.js +0 -10
  40. package/src/Contracts/Context/Middlewares/Intercept/InterceptContextContract.d.ts +0 -19
  41. package/src/Contracts/Context/Middlewares/Intercept/InterceptContextContract.js +0 -10
  42. package/src/Contracts/Context/Middlewares/Intercept/InterceptHandlerContract.d.ts +0 -12
  43. package/src/Contracts/Context/Middlewares/Intercept/InterceptHandlerContract.js +0 -10
  44. package/src/Contracts/Context/Middlewares/Terminate/TerminateContextContract.d.ts +0 -23
  45. package/src/Contracts/Context/Middlewares/Terminate/TerminateContextContract.js +0 -10
  46. package/src/Contracts/Context/Middlewares/Terminate/TerminateHandlerContract.d.ts +0 -12
  47. package/src/Contracts/Context/Middlewares/Terminate/TerminateHandlerContract.js +0 -10
  48. package/src/Contracts/Context/NextContract.d.ts +0 -11
  49. package/src/Contracts/Context/NextContract.js +0 -10
  50. package/src/Contracts/Context/RequestContract.d.ts +0 -25
  51. package/src/Contracts/Context/RequestContract.js +0 -10
  52. package/src/Contracts/Context/ResponseContract.d.ts +0 -20
  53. package/src/Contracts/Context/ResponseContract.js +0 -2
  54. package/src/Contracts/FastifyErrorHandlerContract.d.ts +0 -12
  55. package/src/Contracts/FastifyErrorHandlerContract.js +0 -10
  56. package/src/Contracts/FastifyHandlerContract.d.ts +0 -12
  57. package/src/Contracts/FastifyHandlerContract.js +0 -10
  58. package/src/Contracts/HttpMethodTypes.d.ts +0 -9
  59. package/src/Contracts/HttpMethodTypes.js +0 -10
  60. package/src/Contracts/MiddlewareContract.d.ts +0 -16
  61. package/src/Contracts/MiddlewareContract.js +0 -10
  62. package/src/Contracts/MiddlewareTypes.d.ts +0 -9
  63. package/src/Contracts/MiddlewareTypes.js +0 -10
  64. package/src/Contracts/MiddlewareTypesContract.d.ts +0 -16
  65. package/src/Contracts/MiddlewareTypesContract.js +0 -10
  66. package/src/Contracts/RouteContract.d.ts +0 -16
  67. package/src/Contracts/RouteContract.js +0 -10
  68. package/src/Exceptions/BadRequestException.d.ts +0 -12
  69. package/src/Exceptions/BadRequestException.js +0 -18
  70. package/src/Exceptions/CannotDefineGroupException.d.ts +0 -12
  71. package/src/Exceptions/CannotDefineGroupException.js +0 -19
  72. package/src/Exceptions/MiddlewareNotFoundException.d.ts +0 -12
  73. package/src/Exceptions/MiddlewareNotFoundException.js +0 -19
  74. package/src/Exceptions/UndefinedControllerMethodException.d.ts +0 -12
  75. package/src/Exceptions/UndefinedControllerMethodException.js +0 -19
  76. package/src/Facades/Route.d.ts +0 -10
  77. package/src/Facades/Server.d.ts +0 -10
  78. package/src/Handlers/FastifyHandler.d.ts +0 -26
  79. package/src/Handlers/HttpExceptionHandler.d.ts +0 -27
  80. package/src/Http.d.ts +0 -167
  81. package/src/Http.js +0 -223
  82. package/src/Kernels/HttpKernel.d.ts +0 -54
  83. package/src/Providers/ControllerProvider.d.ts +0 -17
  84. package/src/Providers/HttpRouteProvider.d.ts +0 -17
  85. package/src/Providers/HttpServerProvider.d.ts +0 -17
  86. package/src/Providers/MiddlewareProvider.d.ts +0 -17
  87. package/src/Router/Route.d.ts +0 -32
  88. package/src/Router/RouteGroup.d.ts +0 -24
  89. package/src/Router/RouteResource.d.ts +0 -29
  90. package/src/Router/Router.d.ts +0 -39
  91. package/src/Utils/getAppFiles.d.ts +0 -10
  92. package/src/Utils/getAppFiles.js +0 -22
  93. package/src/Utils/isMiddlewareContract.d.ts +0 -10
  94. package/src/Utils/removeSlash.d.ts +0 -9
  95. package/src/Utils/removeSlash.js +0 -23
@@ -1,10 +0,0 @@
1
- "use strict";
2
- /**
3
- * @athenna/http
4
- *
5
- * (c) João Lenon <lenon@athenna.io>
6
- *
7
- * For the full copyright and license information, please view the LICENSE
8
- * file that was distributed with this source code.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,19 +0,0 @@
1
- /**
2
- * @athenna/http
3
- *
4
- * (c) João Lenon <lenon@athenna.io>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- import { RequestContract } from '../../RequestContract';
10
- import { ResponseContract } from '../../ResponseContract';
11
- export interface InterceptContextContract {
12
- request: RequestContract;
13
- response: ResponseContract;
14
- params: any;
15
- queries: any;
16
- body: any;
17
- status: number;
18
- data: any;
19
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- /**
3
- * @athenna/http
4
- *
5
- * (c) João Lenon <lenon@athenna.io>
6
- *
7
- * For the full copyright and license information, please view the LICENSE
8
- * file that was distributed with this source code.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,12 +0,0 @@
1
- /**
2
- * @athenna/http
3
- *
4
- * (c) João Lenon <lenon@athenna.io>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- import { InterceptContextContract } from './InterceptContextContract';
10
- export interface InterceptHandlerContract {
11
- (ctx: InterceptContextContract): Promise<any> | any;
12
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- /**
3
- * @athenna/http
4
- *
5
- * (c) João Lenon <lenon@athenna.io>
6
- *
7
- * For the full copyright and license information, please view the LICENSE
8
- * file that was distributed with this source code.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,23 +0,0 @@
1
- /**
2
- * @athenna/http
3
- *
4
- * (c) João Lenon <lenon@athenna.io>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- import { NextContract } from '../../NextContract';
10
- import { RequestContract } from '../../RequestContract';
11
- import { ResponseContract } from '../../ResponseContract';
12
- export interface TerminateContextContract {
13
- request: RequestContract;
14
- response: ResponseContract;
15
- data: any;
16
- params: any;
17
- queries: any;
18
- body: any;
19
- headers: any;
20
- status: number;
21
- responseTime: number;
22
- next: NextContract;
23
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- /**
3
- * @athenna/http
4
- *
5
- * (c) João Lenon <lenon@athenna.io>
6
- *
7
- * For the full copyright and license information, please view the LICENSE
8
- * file that was distributed with this source code.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,12 +0,0 @@
1
- /**
2
- * @athenna/http
3
- *
4
- * (c) João Lenon <lenon@athenna.io>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- import { TerminateContextContract } from './TerminateContextContract';
10
- export interface TerminateHandlerContract {
11
- (ctx: TerminateContextContract): Promise<any> | any;
12
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- /**
3
- * @athenna/http
4
- *
5
- * (c) João Lenon <lenon@athenna.io>
6
- *
7
- * For the full copyright and license information, please view the LICENSE
8
- * file that was distributed with this source code.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,11 +0,0 @@
1
- /**
2
- * @athenna/http
3
- *
4
- * (c) João Lenon <lenon@athenna.io>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- export interface NextContract {
10
- (...params: any[]): void;
11
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- /**
3
- * @athenna/http
4
- *
5
- * (c) João Lenon <lenon@athenna.io>
6
- *
7
- * For the full copyright and license information, please view the LICENSE
8
- * file that was distributed with this source code.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,25 +0,0 @@
1
- /**
2
- * @athenna/http
3
- *
4
- * (c) João Lenon <lenon@athenna.io>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- import { FastifyRequest } from 'fastify';
10
- export interface RequestContract {
11
- ip: string;
12
- method: string;
13
- hostUrl: string;
14
- baseUrl: string;
15
- originalUrl: string;
16
- body: any;
17
- params: any;
18
- queries: any;
19
- headers: any;
20
- param(param: string, defaultValue?: string): string | undefined;
21
- query(query: string, defaultValue?: string): string | undefined;
22
- header(header: string, defaultValue?: string): string | string[] | undefined;
23
- payload(payload: string, defaultValue?: string): any | undefined;
24
- getFastifyRequest(): FastifyRequest;
25
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- /**
3
- * @athenna/http
4
- *
5
- * (c) João Lenon <lenon@athenna.io>
6
- *
7
- * For the full copyright and license information, please view the LICENSE
8
- * file that was distributed with this source code.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,20 +0,0 @@
1
- import { FastifyReply } from 'fastify';
2
- /**
3
- * @athenna/http
4
- *
5
- * (c) João Lenon <lenon@athenna.io>
6
- *
7
- * For the full copyright and license information, please view the LICENSE
8
- * file that was distributed with this source code.
9
- */
10
- export interface ResponseContract {
11
- send(data?: any): Promise<void> | void;
12
- json(data?: any): Promise<void> | void;
13
- status(code: number): this;
14
- removeHeader(header: string): this;
15
- header(header: string, value: any): this;
16
- safeHeader(header: string, value: any): this;
17
- redirectTo(url: string): Promise<void> | void;
18
- redirectTo(url: string, statusCode: number): Promise<void> | void;
19
- getFastifyResponse(): FastifyReply;
20
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,12 +0,0 @@
1
- /**
2
- * @athenna/http
3
- *
4
- * (c) João Lenon <lenon@athenna.io>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- import { FastifyError, FastifyReply, FastifyRequest } from 'fastify';
10
- export interface FastifyErrorHandlerContract {
11
- (error: FastifyError, request: FastifyRequest, reply: FastifyReply): Promise<void> | void;
12
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- /**
3
- * @athenna/http
4
- *
5
- * (c) João Lenon <lenon@athenna.io>
6
- *
7
- * For the full copyright and license information, please view the LICENSE
8
- * file that was distributed with this source code.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,12 +0,0 @@
1
- /**
2
- * @athenna/http
3
- *
4
- * (c) João Lenon <lenon@athenna.io>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- import { FastifyReply, FastifyRequest } from 'fastify';
10
- export interface FastifyHandlerContract {
11
- (request: FastifyRequest, reply: FastifyReply, next?: any): Promise<void> | void;
12
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- /**
3
- * @athenna/http
4
- *
5
- * (c) João Lenon <lenon@athenna.io>
6
- *
7
- * For the full copyright and license information, please view the LICENSE
8
- * file that was distributed with this source code.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,9 +0,0 @@
1
- /**
2
- * @athenna/http
3
- *
4
- * (c) João Lenon <lenon@athenna.io>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- export declare type HttpMethodTypes = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
@@ -1,10 +0,0 @@
1
- "use strict";
2
- /**
3
- * @athenna/http
4
- *
5
- * (c) João Lenon <lenon@athenna.io>
6
- *
7
- * For the full copyright and license information, please view the LICENSE
8
- * file that was distributed with this source code.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,16 +0,0 @@
1
- /**
2
- * @athenna/http
3
- *
4
- * (c) João Lenon <lenon@athenna.io>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- import { HandleContextContract } from './Context/Middlewares/Handle/HandleContextContract';
10
- import { InterceptContextContract } from './Context/Middlewares/Intercept/InterceptContextContract';
11
- import { TerminateContextContract } from './Context/Middlewares/Terminate/TerminateContextContract';
12
- export interface MiddlewareContract {
13
- handle?: (ctx: HandleContextContract) => void | Promise<void>;
14
- intercept?: (ctx: InterceptContextContract) => any | Promise<any>;
15
- terminate?: (ctx: TerminateContextContract) => void | Promise<void>;
16
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- /**
3
- * @athenna/http
4
- *
5
- * (c) João Lenon <lenon@athenna.io>
6
- *
7
- * For the full copyright and license information, please view the LICENSE
8
- * file that was distributed with this source code.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,9 +0,0 @@
1
- /**
2
- * @athenna/http
3
- *
4
- * (c) João Lenon <lenon@athenna.io>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- export declare type MiddlewareTypes = 'handle' | 'terminate' | 'intercept';
@@ -1,10 +0,0 @@
1
- "use strict";
2
- /**
3
- * @athenna/http
4
- *
5
- * (c) João Lenon <lenon@athenna.io>
6
- *
7
- * For the full copyright and license information, please view the LICENSE
8
- * file that was distributed with this source code.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,16 +0,0 @@
1
- /**
2
- * @athenna/http
3
- *
4
- * (c) João Lenon <lenon@athenna.io>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- import { HandleHandlerContract } from './Context/Middlewares/Handle/HandleHandlerContract';
10
- import { TerminateHandlerContract } from './Context/Middlewares/Terminate/TerminateHandlerContract';
11
- import { InterceptHandlerContract } from './Context/Middlewares/Intercept/InterceptHandlerContract';
12
- export interface MiddlewareTypesContract {
13
- handlers: HandleHandlerContract[];
14
- terminators: TerminateHandlerContract[];
15
- interceptors: InterceptHandlerContract[];
16
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- /**
3
- * @athenna/http
4
- *
5
- * (c) João Lenon <lenon@athenna.io>
6
- *
7
- * For the full copyright and license information, please view the LICENSE
8
- * file that was distributed with this source code.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,16 +0,0 @@
1
- /**
2
- * @athenna/http
3
- *
4
- * (c) João Lenon <lenon@athenna.io>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- import { HttpMethodTypes } from './HttpMethodTypes';
10
- import { FastifyHandlerContract } from './FastifyHandlerContract';
11
- export interface RouteContract {
12
- method: HttpMethodTypes;
13
- url: string;
14
- handler: FastifyHandlerContract;
15
- preHandler?: FastifyHandlerContract[];
16
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- /**
3
- * @athenna/http
4
- *
5
- * (c) João Lenon <lenon@athenna.io>
6
- *
7
- * For the full copyright and license information, please view the LICENSE
8
- * file that was distributed with this source code.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,12 +0,0 @@
1
- /**
2
- * @athenna/http
3
- *
4
- * (c) João Lenon <lenon@athenna.io>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- import { Exception } from '@secjs/utils';
10
- export declare class BadRequestException extends Exception {
11
- constructor(content?: string);
12
- }
@@ -1,18 +0,0 @@
1
- "use strict";
2
- /**
3
- * @athenna/http
4
- *
5
- * (c) João Lenon <lenon@athenna.io>
6
- *
7
- * For the full copyright and license information, please view the LICENSE
8
- * file that was distributed with this source code.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.BadRequestException = void 0;
12
- const utils_1 = require("@secjs/utils");
13
- class BadRequestException extends utils_1.Exception {
14
- constructor(content = 'Bad request exception has occurred') {
15
- super(content, 400, 'BAD_REQUEST_ERROR');
16
- }
17
- }
18
- exports.BadRequestException = BadRequestException;
@@ -1,12 +0,0 @@
1
- /**
2
- * @athenna/http
3
- *
4
- * (c) João Lenon <lenon@athenna.io>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- import { Exception } from '@secjs/utils';
10
- export declare class CannotDefineGroupException extends Exception {
11
- constructor();
12
- }
@@ -1,19 +0,0 @@
1
- "use strict";
2
- /**
3
- * @athenna/http
4
- *
5
- * (c) João Lenon <lenon@athenna.io>
6
- *
7
- * For the full copyright and license information, please view the LICENSE
8
- * file that was distributed with this source code.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.CannotDefineGroupException = void 0;
12
- const utils_1 = require("@secjs/utils");
13
- class CannotDefineGroupException extends utils_1.Exception {
14
- constructor() {
15
- const content = `Cannot define group name`;
16
- super(content, 500, 'DEFINE_GROUP_ERROR');
17
- }
18
- }
19
- exports.CannotDefineGroupException = CannotDefineGroupException;
@@ -1,12 +0,0 @@
1
- /**
2
- * @athenna/http
3
- *
4
- * (c) João Lenon <lenon@athenna.io>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- import { Exception } from '@secjs/utils';
10
- export declare class MiddlewareNotFoundException extends Exception {
11
- constructor(middlewareName: string);
12
- }
@@ -1,19 +0,0 @@
1
- "use strict";
2
- /**
3
- * @athenna/http
4
- *
5
- * (c) João Lenon <lenon@athenna.io>
6
- *
7
- * For the full copyright and license information, please view the LICENSE
8
- * file that was distributed with this source code.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.MiddlewareNotFoundException = void 0;
12
- const utils_1 = require("@secjs/utils");
13
- class MiddlewareNotFoundException extends utils_1.Exception {
14
- constructor(middlewareName) {
15
- const content = `Middleware ${middlewareName} not found in ioc container`;
16
- super(content, 500, 'NOT_FOUND_ERROR', `Remember registering your middleware in kernel file`);
17
- }
18
- }
19
- exports.MiddlewareNotFoundException = MiddlewareNotFoundException;
@@ -1,12 +0,0 @@
1
- /**
2
- * @athenna/http
3
- *
4
- * (c) João Lenon <lenon@athenna.io>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- import { Exception } from '@secjs/utils';
10
- export declare class UndefinedControllerMethodException extends Exception {
11
- constructor(method: string, controller: string);
12
- }
@@ -1,19 +0,0 @@
1
- "use strict";
2
- /**
3
- * @athenna/http
4
- *
5
- * (c) João Lenon <lenon@athenna.io>
6
- *
7
- * For the full copyright and license information, please view the LICENSE
8
- * file that was distributed with this source code.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.UndefinedControllerMethodException = void 0;
12
- const utils_1 = require("@secjs/utils");
13
- class UndefinedControllerMethodException extends utils_1.Exception {
14
- constructor(method, controller) {
15
- const content = `The method ${method} is not defined inside your controller ${controller}`;
16
- super(content, 500, 'UNDEFINED_METHOD_ERROR', `Remember defining the method ${method} inside your controller ${controller}`);
17
- }
18
- }
19
- exports.UndefinedControllerMethodException = UndefinedControllerMethodException;
@@ -1,10 +0,0 @@
1
- /**
2
- * @athenna/http
3
- *
4
- * (c) João Lenon <lenon@athenna.io>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- import { Router } from '../Router/Router';
10
- export declare const Route: Router;
@@ -1,10 +0,0 @@
1
- /**
2
- * @athenna/http
3
- *
4
- * (c) João Lenon <lenon@athenna.io>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- import { Http } from '../Http';
10
- export declare const Server: Http;
@@ -1,26 +0,0 @@
1
- /**
2
- * @athenna/http
3
- *
4
- * (c) João Lenon <lenon@athenna.io>
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- import { FastifyReply, FastifyRequest } from 'fastify';
10
- import { HandlerContract } from '../Contracts/Context/HandlerContract';
11
- import { ErrorHandlerContract } from '../Contracts/Context/Error/ErrorHandlerContract';
12
- import { HandleHandlerContract } from '../Contracts/Context/Middlewares/Handle/HandleHandlerContract';
13
- import { InterceptHandlerContract } from '../Contracts/Context/Middlewares/Intercept/InterceptHandlerContract';
14
- import { TerminateHandlerContract } from '../Contracts/Context/Middlewares/Terminate/TerminateHandlerContract';
15
- declare module 'fastify' {
16
- interface FastifyRequest {
17
- data: any;
18
- }
19
- }
20
- export declare class FastifyHandler {
21
- static createOnSendHandler(handler: InterceptHandlerContract): (req: FastifyRequest, res: FastifyReply, payload: any) => Promise<any>;
22
- static createDoneHandler(handler: HandleHandlerContract): (req: FastifyRequest, res: FastifyReply, done: any) => any;
23
- static createResponseHandler(handler: TerminateHandlerContract): (req: FastifyRequest, res: FastifyReply, done: any) => any;
24
- static createErrorHandler(handler: ErrorHandlerContract): (error: any, req: FastifyRequest, res: FastifyReply) => any;
25
- static createRequestHandler(handler: HandlerContract): (req: FastifyRequest, res: FastifyReply) => Promise<any>;
26
- }
@@ -1,27 +0,0 @@
1
- import { ErrorContextContract } from '../Contracts/Context/Error/ErrorContextContract';
2
- export declare class HttpExceptionHandler {
3
- /**
4
- * Set if error logs will come with stack.
5
- *
6
- * @protected
7
- */
8
- protected addStack: boolean;
9
- /**
10
- * Error codes that should be ignored by Log.
11
- *
12
- * @protected
13
- */
14
- protected ignoreCodes: string[];
15
- /**
16
- * Error statuses that should be ignored by Log.
17
- *
18
- * @protected
19
- */
20
- protected ignoreStatuses: number[];
21
- /**
22
- * The global exception handler of all HTTP requests.
23
- *
24
- * @param ctx
25
- */
26
- handle({ error, response }: ErrorContextContract): Promise<void>;
27
- }