@athenna/http 3.10.0 → 4.0.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.
Files changed (126) hide show
  1. package/package.json +238 -234
  2. package/src/{Decorators → annotations}/Controller.d.ts +1 -1
  3. package/src/{Decorators → annotations}/Controller.js +2 -0
  4. package/src/{Decorators → annotations}/Interceptor.d.ts +2 -2
  5. package/src/{Decorators → annotations}/Interceptor.js +5 -2
  6. package/src/{Decorators → annotations}/Middleware.d.ts +1 -1
  7. package/src/{Decorators → annotations}/Middleware.js +4 -1
  8. package/src/{Decorators → annotations}/Terminator.d.ts +2 -2
  9. package/src/{Decorators → annotations}/Terminator.js +5 -2
  10. package/src/{Commands → commands}/MakeControllerCommand.js +0 -1
  11. package/src/{Commands → commands}/MakeInterceptorCommand.js +0 -1
  12. package/src/{Commands → commands}/MakeMiddlewareCommand.js +0 -1
  13. package/src/{Commands → commands}/MakeTerminatorCommand.js +0 -1
  14. package/src/{Context → context}/Request.d.ts +1 -1
  15. package/src/{Context → context}/Request.js +0 -4
  16. package/src/{Context → context}/Response.d.ts +2 -2
  17. package/src/{Context → context}/Response.js +0 -4
  18. package/src/debug/index.d.ts +10 -0
  19. package/src/debug/index.js +10 -0
  20. package/src/{Exceptions → exceptions}/BadGatewayException.d.ts +1 -1
  21. package/src/{Exceptions → exceptions}/BadGatewayException.js +1 -1
  22. package/src/{Exceptions → exceptions}/BadRequestException.d.ts +1 -1
  23. package/src/{Exceptions → exceptions}/BadRequestException.js +1 -1
  24. package/src/{Exceptions → exceptions}/ForbiddenException.d.ts +1 -1
  25. package/src/{Exceptions → exceptions}/ForbiddenException.js +1 -1
  26. package/src/{Exceptions → exceptions}/HttpException.d.ts +3 -2
  27. package/src/{Exceptions → exceptions}/InternalServerException.d.ts +1 -1
  28. package/src/{Exceptions → exceptions}/InternalServerException.js +1 -1
  29. package/src/{Exceptions → exceptions}/MethodNotAllowedException.d.ts +1 -1
  30. package/src/{Exceptions → exceptions}/MethodNotAllowedException.js +1 -1
  31. package/src/{Exceptions → exceptions}/NotAcceptableException.d.ts +1 -1
  32. package/src/{Exceptions → exceptions}/NotAcceptableException.js +1 -1
  33. package/src/{Exceptions → exceptions}/NotFoundException.d.ts +1 -1
  34. package/src/{Exceptions → exceptions}/NotFoundException.js +1 -1
  35. package/src/{Exceptions → exceptions}/NotImplementedException.d.ts +1 -1
  36. package/src/{Exceptions → exceptions}/NotImplementedException.js +1 -1
  37. package/src/{Exceptions → exceptions}/PayloadTooLargeException.d.ts +1 -1
  38. package/src/{Exceptions → exceptions}/PayloadTooLargeException.js +1 -1
  39. package/src/{Exceptions → exceptions}/RequestTimeoutException.d.ts +1 -1
  40. package/src/{Exceptions → exceptions}/RequestTimeoutException.js +1 -1
  41. package/src/{Exceptions → exceptions}/ServiceUnavailableException.d.ts +1 -1
  42. package/src/{Exceptions → exceptions}/ServiceUnavailableException.js +1 -1
  43. package/src/{Exceptions → exceptions}/UnauthorizedException.d.ts +1 -1
  44. package/src/{Exceptions → exceptions}/UnauthorizedException.js +1 -1
  45. package/src/{Exceptions → exceptions}/UnprocessableEntityException.d.ts +1 -1
  46. package/src/{Exceptions → exceptions}/UnprocessableEntityException.js +1 -1
  47. package/src/{Facades → facades}/Route.d.ts +2 -2
  48. package/src/{Facades → facades}/Server.d.ts +2 -2
  49. package/src/{Handlers → handlers}/FastifyHandler.d.ts +4 -4
  50. package/src/{Handlers → handlers}/FastifyHandler.js +2 -2
  51. package/src/{Handlers → handlers}/HttpExceptionHandler.d.ts +1 -1
  52. package/src/{Handlers → handlers}/HttpExceptionHandler.js +8 -8
  53. package/src/index.d.ts +32 -40
  54. package/src/index.js +32 -40
  55. package/src/{Kernels → kernels}/HttpKernel.js +16 -2
  56. package/src/{Providers → providers}/HttpRouteProvider.js +1 -1
  57. package/src/{Providers → providers}/HttpServerProvider.js +1 -1
  58. package/src/{Router → router}/Route.d.ts +3 -9
  59. package/src/{Router → router}/Route.js +1 -5
  60. package/src/{Router → router}/RouteGroup.d.ts +3 -5
  61. package/src/{Router → router}/RouteGroup.js +2 -6
  62. package/src/{Router → router}/RouteResource.d.ts +2 -5
  63. package/src/{Router → router}/RouteResource.js +5 -13
  64. package/src/{Router → router}/Router.d.ts +7 -9
  65. package/src/{Router → router}/Router.js +15 -17
  66. package/src/{Server → server}/ServerImpl.d.ts +11 -14
  67. package/src/{Server → server}/ServerImpl.js +1 -9
  68. package/src/{Testing/Plugins → testing/plugins}/index.d.ts +5 -5
  69. package/src/{Testing/Plugins → testing/plugins}/index.js +5 -5
  70. package/src/{Testing/Plugins/Request → testing/plugins/request}/TestRequest.d.ts +2 -2
  71. package/src/{Testing/Plugins/Request → testing/plugins/request}/TestRequest.js +7 -5
  72. package/src/{Testing/Plugins/Request → testing/plugins/request}/TestResponse.d.ts +1 -1
  73. package/src/{Testing/Plugins/Request → testing/plugins/request}/TestResponse.js +1 -8
  74. package/src/{Types/Contexts → types/contexts}/Context.d.ts +2 -2
  75. package/src/types/contexts/Context.js +10 -0
  76. package/src/{Types/Contexts → types/contexts}/ErrorContext.d.ts +2 -2
  77. package/src/{Types/Contexts → types/contexts}/ErrorContext.js +2 -1
  78. package/src/{Types/Contexts → types/contexts}/InterceptContext.d.ts +2 -2
  79. package/src/{Types/Contexts → types/contexts}/InterceptContext.js +2 -1
  80. package/src/{Types/Contexts → types/contexts}/TerminateContext.d.ts +2 -2
  81. package/src/{Types/Contexts → types/contexts}/TerminateContext.js +2 -1
  82. package/src/{Contracts → types/contracts}/InterceptorContract.d.ts +1 -1
  83. package/src/{Contracts → types/contracts}/MiddlewareContract.d.ts +1 -1
  84. package/src/{Contracts → types/contracts}/TerminatorContract.d.ts +1 -1
  85. package/src/types/index.d.ts +24 -0
  86. package/src/types/index.js +24 -0
  87. package/src/{Types/Middlewares → types/middlewares}/InterceptorRouteType.d.ts +2 -2
  88. package/src/{Types/Middlewares → types/middlewares}/MiddlewareHandler.d.ts +3 -3
  89. package/src/{Types/Middlewares → types/middlewares}/MiddlewareRouteType.d.ts +2 -2
  90. package/src/{Types/Middlewares → types/middlewares}/TerminatorRouteType.d.ts +2 -2
  91. package/src/{Types/Router → types/router}/RouteHandler.d.ts +1 -1
  92. package/src/{Types/Router/RouteJSON.d.ts → types/router/RouteJson.d.ts} +3 -4
  93. package/src/Types/Router/RouteJSON.js +0 -9
  94. package/templates/controller.edge +0 -24
  95. package/templates/interceptor.edge +0 -8
  96. package/templates/middleware.edge +0 -6
  97. package/templates/terminator.edge +0 -6
  98. /package/src/{Commands → commands}/MakeControllerCommand.d.ts +0 -0
  99. /package/src/{Commands → commands}/MakeInterceptorCommand.d.ts +0 -0
  100. /package/src/{Commands → commands}/MakeMiddlewareCommand.d.ts +0 -0
  101. /package/src/{Commands → commands}/MakeTerminatorCommand.d.ts +0 -0
  102. /package/src/{Commands → commands}/RouteListCommand.d.ts +0 -0
  103. /package/src/{Commands → commands}/RouteListCommand.js +0 -0
  104. /package/src/{Exceptions → exceptions}/HttpException.js +0 -0
  105. /package/src/{Exceptions → exceptions}/UndefinedMethodException.d.ts +0 -0
  106. /package/src/{Exceptions → exceptions}/UndefinedMethodException.js +0 -0
  107. /package/src/{Facades → facades}/Route.js +0 -0
  108. /package/src/{Facades → facades}/Server.js +0 -0
  109. /package/src/{Kernels → kernels}/HttpKernel.d.ts +0 -0
  110. /package/src/{Providers → providers}/HttpRouteProvider.d.ts +0 -0
  111. /package/src/{Providers → providers}/HttpServerProvider.d.ts +0 -0
  112. /package/src/{Contracts → types/contracts}/InterceptorContract.js +0 -0
  113. /package/src/{Contracts → types/contracts}/MiddlewareContract.js +0 -0
  114. /package/src/{Contracts → types/contracts}/TerminatorContract.js +0 -0
  115. /package/src/{Types/Controllers → types/controllers}/ControllerOptions.d.ts +0 -0
  116. /package/src/{Types/Controllers → types/controllers}/ControllerOptions.js +0 -0
  117. /package/src/{Types/Middlewares → types/middlewares}/InterceptorRouteType.js +0 -0
  118. /package/src/{Types/Middlewares → types/middlewares}/MiddlewareHandler.js +0 -0
  119. /package/src/{Types/Middlewares → types/middlewares}/MiddlewareOptions.d.ts +0 -0
  120. /package/src/{Types/Middlewares → types/middlewares}/MiddlewareOptions.js +0 -0
  121. /package/src/{Types/Middlewares → types/middlewares}/MiddlewareRouteType.js +0 -0
  122. /package/src/{Types/Middlewares → types/middlewares}/TerminatorRouteType.js +0 -0
  123. /package/src/{Types/Router → types/router}/RouteHandler.js +0 -0
  124. /package/src/{Types/Contexts/Context.js → types/router/RouteJson.js} +0 -0
  125. /package/src/{Types/Router → types/router}/RouteResourceTypes.d.ts +0 -0
  126. /package/src/{Types/Router → types/router}/RouteResourceTypes.js +0 -0
@@ -16,7 +16,6 @@ import { Path } from '@athenna/common';
16
16
  import { sep, resolve, isAbsolute } from 'node:path';
17
17
  import { BaseCommand, Argument } from '@athenna/artisan';
18
18
  export class MakeMiddlewareCommand extends BaseCommand {
19
- name;
20
19
  static signature() {
21
20
  return 'make:middleware';
22
21
  }
@@ -16,7 +16,6 @@ import { Path } from '@athenna/common';
16
16
  import { sep, resolve, isAbsolute } from 'node:path';
17
17
  import { BaseCommand, Argument } from '@athenna/artisan';
18
18
  export class MakeTerminatorCommand extends BaseCommand {
19
- name;
20
19
  static signature() {
21
20
  return 'make:terminator';
22
21
  }
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { FastifyRequest } from 'fastify';
9
+ import type { FastifyRequest } from 'fastify';
10
10
  export declare class Request {
11
11
  /**
12
12
  * The fastify request object.
@@ -8,10 +8,6 @@
8
8
  */
9
9
  import { Is, Json } from '@athenna/common';
10
10
  export class Request {
11
- /**
12
- * The fastify request object.
13
- */
14
- request;
15
11
  constructor(request) {
16
12
  this.request = request;
17
13
  }
@@ -6,8 +6,8 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { FastifyReply } from 'fastify';
10
- import { FastifyHelmetOptions } from '@fastify/helmet';
9
+ import type { FastifyReply } from 'fastify';
10
+ import type { FastifyHelmetOptions } from '@fastify/helmet';
11
11
  export declare class Response {
12
12
  /**
13
13
  * The fastify response object.
@@ -7,10 +7,6 @@
7
7
  * file that was distributed with this source code.
8
8
  */
9
9
  export class Response {
10
- /**
11
- * The fastify response object.
12
- */
13
- response;
14
10
  constructor(response) {
15
11
  this.response = response;
16
12
  }
@@ -0,0 +1,10 @@
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
+ /// <reference types="node" resolution-mode="require"/>
10
+ export declare const debug: import("util").DebugLogger;
@@ -0,0 +1,10 @@
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 { debuglog } from 'node:util';
10
+ export const debug = debuglog('athenna:http');
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export declare class BadGatewayException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 502 status code and the "E_BAD_GATEWAY_ERROR" code.
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export class BadGatewayException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 502 status code and the "E_BAD_GATEWAY_ERROR" code.
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export declare class BadRequestException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 400 status code and the "E_BAD_REQUEST_ERROR" code.
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export class BadRequestException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 400 status code and the "E_BAD_REQUEST_ERROR" code.
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export declare class ForbiddenException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 403 status code and the "E_FORBIDDEN_ERROR" code.
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export class ForbiddenException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 403 status code and the "E_FORBIDDEN_ERROR" code.
@@ -6,7 +6,8 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { Exception, ExceptionJSON } from '@athenna/common';
9
+ import { Exception } from '@athenna/common';
10
+ import type { ExceptionJson } from '@athenna/common/types';
10
11
  export declare class HttpException extends Exception {
11
12
  /**
12
13
  * This exception uses the 500 status code and the "E_HTTP_ERROR" code.
@@ -16,5 +17,5 @@ export declare class HttpException extends Exception {
16
17
  * throw new HttpException()
17
18
  * ```
18
19
  */
19
- constructor(options?: ExceptionJSON);
20
+ constructor(options?: ExceptionJson);
20
21
  }
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export declare class InternalServerException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 500 status code and the "E_INTERNAL_ERROR" code.
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export class InternalServerException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 500 status code and the "E_INTERNAL_ERROR" code.
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export declare class MethodNotAllowedException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 405 status code and the "E_METHOD_NOT_ALLOWED_ERROR" code.
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export class MethodNotAllowedException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 405 status code and the "E_METHOD_NOT_ALLOWED_ERROR" code.
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export declare class NotAcceptableException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 406 status code and the "E_NOT_ACCEPTABLE_ERROR" code.
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export class NotAcceptableException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 406 status code and the "E_NOT_ACCEPTABLE_ERROR" code.
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export declare class NotFoundException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 404 status code and the "E_NOT_FOUND_ERROR" code.
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export class NotFoundException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 404 status code and the "E_NOT_FOUND_ERROR" code.
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export declare class NotImplementedException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 501 status code and the "E_NOT_IMPLEMENTED_ERROR" code.
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export class NotImplementedException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 501 status code and the "E_NOT_IMPLEMENTED_ERROR" code.
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export declare class PayloadTooLargeException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 413 status code and the "E_PAYLOAD_TOO_LARGE_ERROR" code.
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export class PayloadTooLargeException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 413 status code and the "E_PAYLOAD_TOO_LARGE_ERROR" code.
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export declare class RequestTimeoutException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 408 status code and the "E_REQUEST_TIMEOUT_ERROR" code.
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export class RequestTimeoutException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 408 status code and the "E_REQUEST_TIMEOUT_ERROR" code.
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export declare class ServiceUnavailableException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 503 status code and the "E_SERVICE_UNAVAILABLE_ERROR" code.
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export class ServiceUnavailableException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 503 status code and the "E_SERVICE_UNAVAILABLE_ERROR" code.
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export declare class UnauthorizedException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 401 status code and the "E_UNAUTHORIZED_ERROR" code.
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export class UnauthorizedException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 401 status code and the "E_UNAUTHORIZED_ERROR" code.
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export declare class UnprocessableEntityException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 422 status code and the "E_UNPROCESSABLE_ENTITY_ERROR" code.
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { HttpException } from '#src/Exceptions/HttpException';
9
+ import { HttpException } from '#src/exceptions/HttpException';
10
10
  export class UnprocessableEntityException extends HttpException {
11
11
  /**
12
12
  * This exception uses the 422 status code and the "E_UNPROCESSABLE_ENTITY_ERROR" code.
@@ -6,5 +6,5 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { Router } from '#src/Router/Router';
10
- export declare const Route: import("@athenna/ioc").FacadeType<Router>;
9
+ import type { Router } from '#src/router/Router';
10
+ export declare const Route: import("@athenna/ioc/types").FacadeType<Router>;
@@ -6,5 +6,5 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { ServerImpl } from '#src/Server/ServerImpl';
10
- export declare const Server: import("@athenna/ioc").FacadeType<ServerImpl>;
9
+ import type { ServerImpl } from '#src/server/ServerImpl';
10
+ export declare const Server: import("@athenna/ioc/types").FacadeType<ServerImpl>;
@@ -6,10 +6,10 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { InterceptHandler, TerminateHandler } from '#src/Types/Middlewares/MiddlewareHandler';
10
- import { RequestHandler } from '#src/Types/Contexts/Context';
11
- import { ErrorHandler } from '#src/Types/Contexts/ErrorContext';
12
- import { FastifyReply, FastifyRequest, RouteHandlerMethod } from 'fastify';
9
+ import type { InterceptHandler, TerminateHandler } from '#src/types';
10
+ import type { RequestHandler } from '#src/types/contexts/Context';
11
+ import type { ErrorHandler } from '#src/types/contexts/ErrorContext';
12
+ import type { FastifyReply, FastifyRequest, RouteHandlerMethod } from 'fastify';
13
13
  export declare class FastifyHandler {
14
14
  /**
15
15
  * Parse the fastify request handler and the preHandler hook to an Athenna
@@ -7,8 +7,8 @@
7
7
  * file that was distributed with this source code.
8
8
  */
9
9
  import { Is } from '@athenna/common';
10
- import { Request } from '#src/Context/Request';
11
- import { Response } from '#src/Context/Response';
10
+ import { Request } from '#src/context/Request';
11
+ import { Response } from '#src/context/Response';
12
12
  export class FastifyHandler {
13
13
  /**
14
14
  * Parse the fastify request handler and the preHandler hook to an Athenna
@@ -6,7 +6,7 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { ErrorContext } from '#src';
9
+ import type { ErrorContext } from '#src/types';
10
10
  export declare class HttpExceptionHandler {
11
11
  /**
12
12
  * Error codes that should be ignored from logging.
@@ -7,33 +7,33 @@
7
7
  * file that was distributed with this source code.
8
8
  */
9
9
  import { Log } from '@athenna/logger';
10
- import { Is, String } from '@athenna/common';
10
+ import { Is, Json, String } from '@athenna/common';
11
11
  export class HttpExceptionHandler {
12
12
  /**
13
13
  * Error codes that should be ignored from logging.
14
14
  */
15
15
  get ignoreCodes() {
16
- return [];
16
+ return Config.get('http.logger.ignoreCodes', []);
17
17
  }
18
18
  /**
19
19
  * Error statuses that should be ignored from logging.
20
20
  */
21
21
  get ignoreStatuses() {
22
- return [];
22
+ return Config.get('http.logger.ignoreStatuses', []);
23
23
  }
24
24
  /**
25
25
  * The exception handler of all request handlers.
26
26
  */
27
27
  async handle({ error, response }) {
28
28
  const body = {
29
- statusCode: error.statusCode || error.status || 500,
29
+ statusCode: Json.copy(error.statusCode) || Json.copy(error.status) || 500,
30
30
  code: String.toSnakeCase(error.code || error.name).toUpperCase(),
31
- name: error.name,
32
- message: error.message,
33
- stack: error.stack,
31
+ name: Json.copy(error.name),
32
+ message: Json.copy(error.message),
33
+ stack: Json.copy(error.stack),
34
34
  };
35
35
  if (error.help) {
36
- body.help = error.help;
36
+ body.help = Json.copy(error.help);
37
37
  }
38
38
  const isInternalServerError = Is.Error(error) && !Is.Exception(error);
39
39
  const isDebugMode = Config.is('app.debug', true);
package/src/index.d.ts CHANGED
@@ -31,43 +31,35 @@ declare module 'fastify' {
31
31
  operationId?: string;
32
32
  }
33
33
  }
34
- export * from './Context/Request.js';
35
- export * from './Context/Response.js';
36
- export * from './Contracts/MiddlewareContract.js';
37
- export * from './Contracts/TerminatorContract.js';
38
- export * from './Contracts/InterceptorContract.js';
39
- export * from './Decorators/Controller.js';
40
- export * from './Decorators/Middleware.js';
41
- export * from './Decorators/Interceptor.js';
42
- export * from './Decorators/Terminator.js';
43
- export * from './Facades/Route.js';
44
- export * from './Facades/Server.js';
45
- export * from './Providers/HttpRouteProvider.js';
46
- export * from './Providers/HttpServerProvider.js';
47
- export * from './Kernels/HttpKernel.js';
48
- export * from './Handlers/FastifyHandler.js';
49
- export * from './Handlers/HttpExceptionHandler.js';
50
- export * from './Router/Router.js';
51
- export * from './Server/ServerImpl.js';
52
- export * from './Types/Router/RouteJSON.js';
53
- export * from './Types/Router/RouteHandler.js';
54
- export * from './Types/Router/RouteResourceTypes.js';
55
- export * from './Types/Contexts/Context.js';
56
- export * from './Types/Contexts/ErrorContext.js';
57
- export * from './Types/Contexts/TerminateContext.js';
58
- export * from './Types/Contexts/InterceptContext.js';
59
- export * from './Types/Middlewares/MiddlewareHandler.js';
60
- export * from './Exceptions/BadGatewayException.js';
61
- export * from './Exceptions/BadRequestException.js';
62
- export * from './Exceptions/ForbiddenException.js';
63
- export * from './Exceptions/HttpException.js';
64
- export * from './Exceptions/InternalServerException.js';
65
- export * from './Exceptions/MethodNotAllowedException.js';
66
- export * from './Exceptions/NotAcceptableException.js';
67
- export * from './Exceptions/NotFoundException.js';
68
- export * from './Exceptions/NotImplementedException.js';
69
- export * from './Exceptions/PayloadTooLargeException.js';
70
- export * from './Exceptions/RequestTimeoutException.js';
71
- export * from './Exceptions/ServiceUnavailableException.js';
72
- export * from './Exceptions/UnauthorizedException.js';
73
- export * from './Exceptions/UnprocessableEntityException.js';
34
+ export * from '#src/context/Request';
35
+ export * from '#src/context/Response';
36
+ export * from '#src/types/contracts/MiddlewareContract';
37
+ export * from '#src/types/contracts/TerminatorContract';
38
+ export * from '#src/types/contracts/InterceptorContract';
39
+ export * from '#src/annotations/Controller';
40
+ export * from '#src/annotations/Middleware';
41
+ export * from '#src/annotations/Interceptor';
42
+ export * from '#src/annotations/Terminator';
43
+ export * from '#src/facades/Route';
44
+ export * from '#src/facades/Server';
45
+ export * from '#src/providers/HttpRouteProvider';
46
+ export * from '#src/providers/HttpServerProvider';
47
+ export * from '#src/kernels/HttpKernel';
48
+ export * from '#src/handlers/FastifyHandler';
49
+ export * from '#src/handlers/HttpExceptionHandler';
50
+ export * from '#src/router/Router';
51
+ export * from '#src/server/ServerImpl';
52
+ export * from '#src/exceptions/BadGatewayException';
53
+ export * from '#src/exceptions/BadRequestException';
54
+ export * from '#src/exceptions/ForbiddenException';
55
+ export * from '#src/exceptions/HttpException';
56
+ export * from '#src/exceptions/InternalServerException';
57
+ export * from '#src/exceptions/MethodNotAllowedException';
58
+ export * from '#src/exceptions/NotAcceptableException';
59
+ export * from '#src/exceptions/NotFoundException';
60
+ export * from '#src/exceptions/NotImplementedException';
61
+ export * from '#src/exceptions/PayloadTooLargeException';
62
+ export * from '#src/exceptions/RequestTimeoutException';
63
+ export * from '#src/exceptions/ServiceUnavailableException';
64
+ export * from '#src/exceptions/UnauthorizedException';
65
+ export * from '#src/exceptions/UnprocessableEntityException';