@athenna/http 3.9.0 → 3.11.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@athenna/http",
3
- "version": "3.9.0",
3
+ "version": "3.11.0",
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>",
@@ -64,13 +64,13 @@
64
64
  "fastify": "^4.15.0"
65
65
  },
66
66
  "devDependencies": {
67
- "@athenna/artisan": "^3.8.0",
68
- "@athenna/common": "^3.5.1",
69
- "@athenna/config": "^3.4.1",
70
- "@athenna/ioc": "^3.3.0",
71
- "@athenna/logger": "^3.3.0",
72
- "@athenna/test": "^3.5.1",
73
- "@athenna/view": "^3.2.0",
67
+ "@athenna/artisan": "^3.9.0",
68
+ "@athenna/common": "^3.6.0",
69
+ "@athenna/config": "^3.6.0",
70
+ "@athenna/ioc": "^3.4.0",
71
+ "@athenna/logger": "^3.4.0",
72
+ "@athenna/test": "^3.6.0",
73
+ "@athenna/view": "^3.3.0",
74
74
  "@fastify/cors": "^8.1.1",
75
75
  "@fastify/helmet": "^10.0.2",
76
76
  "@fastify/rate-limit": "^7.5.0",
@@ -80,7 +80,6 @@
80
80
  "@typescript-eslint/eslint-plugin": "^5.56.0",
81
81
  "@typescript-eslint/parser": "^5.56.0",
82
82
  "c8": "^7.12.0",
83
- "cls-rtracer": "^2.6.2",
84
83
  "commitizen": "^4.2.6",
85
84
  "cross-env": "^7.0.3",
86
85
  "cz-conventional-changelog": "^3.3.0",
@@ -45,7 +45,7 @@ export class MakeControllerCommand extends BaseCommand {
45
45
  * Get the destination path for the file that will be generated.
46
46
  */
47
47
  getDestinationPath() {
48
- let destination = Config.get('rc.commands.make:controller.destination', Path.http('Controllers'));
48
+ let destination = Config.get('rc.commands.make:controller.destination', Path.controllers());
49
49
  if (!isAbsolute(destination)) {
50
50
  destination = resolve(Path.pwd(), destination);
51
51
  }
@@ -45,7 +45,7 @@ export class MakeInterceptorCommand extends BaseCommand {
45
45
  * Get the destination path for the file that will be generated.
46
46
  */
47
47
  getDestinationPath() {
48
- let destination = Config.get('rc.commands.make:interceptor.destination', Path.http('Interceptors'));
48
+ let destination = Config.get('rc.commands.make:interceptor.destination', Path.interceptors());
49
49
  if (!isAbsolute(destination)) {
50
50
  destination = resolve(Path.pwd(), destination);
51
51
  }
@@ -45,7 +45,7 @@ export class MakeMiddlewareCommand extends BaseCommand {
45
45
  * Get the destination path for the file that will be generated.
46
46
  */
47
47
  getDestinationPath() {
48
- let destination = Config.get('rc.commands.make:middleware.destination', Path.http('Middlewares'));
48
+ let destination = Config.get('rc.commands.make:middleware.destination', Path.middlewares());
49
49
  if (!isAbsolute(destination)) {
50
50
  destination = resolve(Path.pwd(), destination);
51
51
  }
@@ -45,7 +45,7 @@ export class MakeTerminatorCommand extends BaseCommand {
45
45
  * Get the destination path for the file that will be generated.
46
46
  */
47
47
  getDestinationPath() {
48
- let destination = Config.get('rc.commands.make:terminator.destination', Path.http('Terminators'));
48
+ let destination = Config.get('rc.commands.make:terminator.destination', Path.terminators());
49
49
  if (!isAbsolute(destination)) {
50
50
  destination = resolve(Path.pwd(), destination);
51
51
  }
@@ -13,13 +13,13 @@ export class HttpExceptionHandler {
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.
@@ -27,7 +27,7 @@ export declare class HttpKernel {
27
27
  /**
28
28
  * Register the cls-rtracer plugin in the Http server.
29
29
  */
30
- registerRTracer(): Promise<void>;
30
+ registerRTracer(trace?: boolean): Promise<void>;
31
31
  /**
32
32
  * Register the global log terminator in the Http server.
33
33
  */
@@ -61,7 +61,10 @@ export class HttpKernel {
61
61
  /**
62
62
  * Register the cls-rtracer plugin in the Http server.
63
63
  */
64
- async registerRTracer() {
64
+ async registerRTracer(trace) {
65
+ if (trace === false) {
66
+ return;
67
+ }
65
68
  if (!rTracerPlugin) {
66
69
  return;
67
70
  }
@@ -72,7 +75,8 @@ export class HttpKernel {
72
75
  * Register the global log terminator in the Http server.
73
76
  */
74
77
  async registerLoggerTerminator() {
75
- if (!Config.exists('http.logger') || Config.is('http.logger', false)) {
78
+ if (!Config.exists('http.logger.enabled') ||
79
+ Config.is('http.logger.enabled', false)) {
76
80
  return;
77
81
  }
78
82
  Server.terminate(ctx => Log.channelOrVanilla('request').info(ctx));