@athenna/http 5.32.0 → 5.34.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": "5.32.0",
3
+ "version": "5.34.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>",
@@ -74,40 +74,40 @@
74
74
  "#tests": "./tests/index.js"
75
75
  },
76
76
  "devDependencies": {
77
- "@athenna/artisan": "^5.6.0",
78
- "@athenna/common": "^5.7.0",
79
- "@athenna/config": "^5.3.0",
80
- "@athenna/ioc": "^5.1.0",
81
- "@athenna/logger": "^5.3.0",
82
- "@athenna/test": "^5.3.0",
77
+ "@athenna/artisan": "^5.7.0",
78
+ "@athenna/common": "^5.14.0",
79
+ "@athenna/config": "^5.4.0",
80
+ "@athenna/ioc": "^5.2.0",
81
+ "@athenna/logger": "^5.7.0",
82
+ "@athenna/test": "^5.5.0",
83
83
  "@athenna/tsconfig": "^5.0.0",
84
84
  "@athenna/view": "^5.3.0",
85
85
  "@athenna/vite": "^5.13.0",
86
- "@fastify/cors": "^10.0.2",
86
+ "@fastify/cors": "^10.1.0",
87
87
  "@fastify/helmet": "^13.0.1",
88
88
  "@fastify/multipart": "^9.0.3",
89
- "@fastify/rate-limit": "^10.2.2",
90
- "@fastify/static": "^8.0.4",
91
- "@fastify/swagger": "^9.4.2",
92
- "@fastify/swagger-ui": "^5.2.1",
93
- "@typescript-eslint/eslint-plugin": "^8.21.0",
94
- "@typescript-eslint/parser": "^8.21.0",
89
+ "@fastify/rate-limit": "^10.3.0",
90
+ "@fastify/static": "^8.2.0",
91
+ "@fastify/swagger": "^9.5.1",
92
+ "@fastify/swagger-ui": "^5.2.3",
93
+ "@typescript-eslint/eslint-plugin": "^8.38.0",
94
+ "@typescript-eslint/parser": "^8.38.0",
95
95
  "autocannon": "^7.15.0",
96
96
  "commitizen": "^4.3.1",
97
97
  "cz-conventional-changelog": "^3.3.0",
98
98
  "eslint": "^8.57.1",
99
- "eslint-config-prettier": "^8.10.0",
99
+ "eslint-config-prettier": "^8.10.2",
100
100
  "eslint-config-standard": "^17.1.0",
101
- "eslint-plugin-import": "^2.31.0",
101
+ "eslint-plugin-import": "^2.32.0",
102
102
  "eslint-plugin-n": "^15.7.0",
103
- "eslint-plugin-prettier": "^4.2.1",
103
+ "eslint-plugin-prettier": "^4.2.5",
104
104
  "eslint-plugin-promise": "^6.6.0",
105
105
  "foreground-child": "^2.0.0",
106
106
  "husky": "^3.1.0",
107
107
  "lint-staged": "^12.5.0",
108
- "ora": "^8.1.1",
108
+ "ora": "^8.2.0",
109
109
  "prettier": "^2.8.8",
110
- "vite": "^6.0.11",
110
+ "vite": "^6.3.5",
111
111
  "vite-plugin-restart": "^0.4.2"
112
112
  },
113
113
  "c8": {
@@ -61,17 +61,17 @@ export class RouteListCommand extends BaseCommand {
61
61
  * Resolve the http routes file.
62
62
  */
63
63
  async resolveRoute() {
64
- const path = Config.get('rc.commands.route:list.route', Path.routes(`http.${Path.ext()}`));
64
+ const path = Config.get('rc.http.route', Path.routes(`http.${Path.ext()}`));
65
65
  await Module.resolve(path, this.getParentURL());
66
66
  }
67
67
  /**
68
68
  * Get the http kernel module from RC file or resolve the default one.
69
69
  */
70
70
  async getHttpKernel() {
71
- if (!Config.exists('rc.commands.route:list.kernel')) {
71
+ if (!Config.exists('rc.http.kernel')) {
72
72
  return HttpKernel;
73
73
  }
74
- return Module.resolve(Config.get('rc.commands.route:list.kernel'), this.getParentURL());
74
+ return Module.resolve(Config.get('rc.http.kernel'), this.getParentURL());
75
75
  }
76
76
  /**
77
77
  * Get the parent URL of the project.
@@ -56,21 +56,11 @@ export class HttpExceptionHandler {
56
56
  if (!Is.Exception(error)) {
57
57
  error = error.toAthennaException();
58
58
  }
59
- const isUsingJsonFormatter = Config.is('logging.channels.exception.formatter', 'json');
60
- if (isUsingJsonFormatter) {
61
- Log.channelOrVanilla('exception').error({
62
- name: error.name,
63
- code: error.code,
64
- status: error.status,
65
- message: error.message,
66
- help: error.help,
67
- cause: error.cause,
68
- details: error.details,
69
- stack: error.stack
70
- });
59
+ if (Config.is('http.logger.prettifyException', true)) {
60
+ Log.channelOrVanilla('exception').error(await error.prettify());
71
61
  return;
72
62
  }
73
- Log.channelOrVanilla('exception').error(await error.prettify());
63
+ Log.channelOrVanilla('exception').error(error);
74
64
  }
75
65
  /**
76
66
  * Return a boolean indicating if the error can be logged or not.
@@ -162,13 +162,14 @@ export class HttpKernel {
162
162
  debug('Not able to register http request logger. Enable it in your http.logger.enabled configuration.');
163
163
  return;
164
164
  }
165
- const { channel, isToLogRequest } = Config.get('http.logger');
165
+ const channel = Config.get('http.logger.channel', 'request');
166
+ const isToLogRequest = Config.get('http.logger.isToLogRequest');
166
167
  Server.terminate(ctx => {
167
168
  if (!isToLogRequest) {
168
- return Log.channelOrVanilla(channel || 'request').info(ctx);
169
+ return Log.channelOrVanilla(channel).info(ctx);
169
170
  }
170
171
  if (isToLogRequest(ctx)) {
171
- return Log.channelOrVanilla(channel || 'request').info(ctx);
172
+ return Log.channelOrVanilla(channel).info(ctx);
172
173
  }
173
174
  });
174
175
  }