Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,429 changes: 2,334 additions & 1,095 deletions package-lock.json

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@athenna/http",
"version": "5.32.0",
"version": "5.33.0",
"description": "The Athenna Http server. Built on top of fastify.",
"license": "MIT",
"author": "João Lenon <[email protected]>",
Expand Down Expand Up @@ -74,40 +74,40 @@
"#tests": "./tests/index.js"
},
"devDependencies": {
"@athenna/artisan": "^5.6.0",
"@athenna/common": "^5.7.0",
"@athenna/config": "^5.3.0",
"@athenna/ioc": "^5.1.0",
"@athenna/logger": "^5.3.0",
"@athenna/test": "^5.3.0",
"@athenna/artisan": "^5.7.0",
"@athenna/common": "^5.14.0",
"@athenna/config": "^5.4.0",
"@athenna/ioc": "^5.2.0",
"@athenna/logger": "^5.7.0",
"@athenna/test": "^5.5.0",
"@athenna/tsconfig": "^5.0.0",
"@athenna/view": "^5.3.0",
"@athenna/vite": "^5.13.0",
"@fastify/cors": "^10.0.2",
"@fastify/cors": "^10.1.0",
"@fastify/helmet": "^13.0.1",
"@fastify/multipart": "^9.0.3",
"@fastify/rate-limit": "^10.2.2",
"@fastify/static": "^8.0.4",
"@fastify/swagger": "^9.4.2",
"@fastify/swagger-ui": "^5.2.1",
"@typescript-eslint/eslint-plugin": "^8.21.0",
"@typescript-eslint/parser": "^8.21.0",
"@fastify/rate-limit": "^10.3.0",
"@fastify/static": "^8.2.0",
"@fastify/swagger": "^9.5.1",
"@fastify/swagger-ui": "^5.2.3",
"@typescript-eslint/eslint-plugin": "^8.38.0",
"@typescript-eslint/parser": "^8.38.0",
"autocannon": "^7.15.0",
"commitizen": "^4.3.1",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.57.1",
"eslint-config-prettier": "^8.10.0",
"eslint-config-prettier": "^8.10.2",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-prettier": "^4.2.5",
"eslint-plugin-promise": "^6.6.0",
"foreground-child": "^2.0.0",
"husky": "^3.1.0",
"lint-staged": "^12.5.0",
"ora": "^8.1.1",
"ora": "^8.2.0",
"prettier": "^2.8.8",
"vite": "^6.0.11",
"vite": "^6.3.5",
"vite-plugin-restart": "^0.4.2"
},
"c8": {
Expand Down
12 changes: 3 additions & 9 deletions src/commands/RouteListCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,7 @@ export class RouteListCommand extends BaseCommand {
* Resolve the http routes file.
*/
private async resolveRoute() {
const path = Config.get(
'rc.commands.route:list.route',
Path.routes(`http.${Path.ext()}`)
)
const path = Config.get('rc.http.route', Path.routes(`http.${Path.ext()}`))

await Module.resolve(path, this.getParentURL())
}
Expand All @@ -89,14 +86,11 @@ export class RouteListCommand extends BaseCommand {
* Get the http kernel module from RC file or resolve the default one.
*/
private async getHttpKernel() {
if (!Config.exists('rc.commands.route:list.kernel')) {
if (!Config.exists('rc.http.kernel')) {
return HttpKernel
}

return Module.resolve(
Config.get('rc.commands.route:list.kernel'),
this.getParentURL()
)
return Module.resolve(Config.get('rc.http.kernel'), this.getParentURL())
}

/**
Expand Down
20 changes: 3 additions & 17 deletions src/handlers/HttpExceptionHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,27 +71,13 @@ export class HttpExceptionHandler {
error = error.toAthennaException()
}

const isUsingJsonFormatter = Config.is(
'logging.channels.exception.formatter',
'json'
)

if (isUsingJsonFormatter) {
Log.channelOrVanilla('exception').error({
name: error.name,
code: error.code,
status: error.status,
message: error.message,
help: error.help,
cause: error.cause,
details: error.details,
stack: error.stack
})
if (Config.is('http.logger.prettifyException', true)) {
Log.channelOrVanilla('exception').error(await error.prettify())

return
}

Log.channelOrVanilla('exception').error(await error.prettify())
Log.channelOrVanilla('exception').error(error)
}

/**
Expand Down
11 changes: 6 additions & 5 deletions tests/fixtures/consoles/base-console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ await Config.loadAll(Path.fixtures('config'))

Config.set('rc.parentURL', Path.toHref(Path.pwd() + sep))

Config.set('rc.http', {
route: './tests/fixtures/routes/http.js',
kernel: './tests/fixtures/kernels/HttpKernel.js'
})

Config.set('rc.commands', {
'route:list': {
path: '#src/commands/RouteListCommand',
route: './tests/fixtures/routes/http.js',
kernel: './tests/fixtures/kernels/HttpKernel.js'
},
'route:list': '#src/commands/RouteListCommand',
'make:controller': '#src/commands/MakeControllerCommand',
'make:interceptor': '#src/commands/MakeInterceptorCommand',
'make:middleware': '#src/commands/MakeMiddlewareCommand',
Expand Down
11 changes: 6 additions & 5 deletions tests/fixtures/consoles/console-mock-dest-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ await Config.loadAll(Path.fixtures('config'))

Config.set('rc.parentURL', Path.toHref(Path.pwd() + sep))

Config.set('rc.http', {
route: './tests/fixtures/routes/http.js',
kernel: './tests/fixtures/kernels/HttpKernel.js'
})

Config.set('rc.commands', {
'route:list': {
path: '#src/commands/RouteListCommand',
route: './tests/fixtures/routes/http.js',
kernel: './tests/fixtures/kernels/HttpKernel.js'
},
'route:list': '#src/commands/RouteListCommand',
'make:controller': {
path: '#src/commands/MakeControllerCommand',
destination: './tests/fixtures/storage/controllers'
Expand Down
9 changes: 0 additions & 9 deletions tests/unit/kernels/HttpKernelTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,6 @@ export default class HttpKernelTest {
assert.isFalse(Server.fastify.hasPlugin('cls-rtracer'))
}

@Test()
public async shouldNotRegisterTheFastifyRTracerPluginIfTheTraceOptionsIsSetToFalse({ assert }: Context) {
const { HttpKernel } = await import(`../../../src/kernels/HttpKernel.js?v=${Math.random()}`)
const kernel = new HttpKernel()
await kernel.registerRTracer(false)

assert.isFalse(Server.fastify.hasPlugin('cls-rtracer'))
}

@Test()
@Cleanup(() => Config.set('http.rTracer.enabled', true))
public async shouldNotRegisterTheFastifyRTracerPluginIfTheConfigurationIsDisabled({ assert }: Context) {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/server/ServerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default class ServerTest {

@Test()
public async shouldBeAbleToGetTheFastifyVersionFromTheHttpServer({ assert }: Context) {
assert.equal(Server.getFastifyVersion(), '5.2.1')
assert.equal(Server.getFastifyVersion(), '5.4.0')
}

@Test()
Expand Down