From 343a74c8636253ba5e5740b52c7df78c9f6a65a8 Mon Sep 17 00:00:00 2001 From: jlenon7 Date: Wed, 6 Aug 2025 13:16:26 -0300 Subject: [PATCH] chore(http): fix method overload when lambda is true --- package-lock.json | 4 ++-- package.json | 2 +- src/applications/Http.ts | 9 +++++++-- src/ignite/Ignite.ts | 7 ++++++- tests/unit/applications/HttpTest.ts | 2 +- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3681dd1..49209c8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@athenna/core", - "version": "5.23.0", + "version": "5.24.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@athenna/core", - "version": "5.23.0", + "version": "5.24.0", "license": "MIT", "dependencies": { "pretty-repl": "^3.1.2", diff --git a/package.json b/package.json index 3a23ca3..04b80f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@athenna/core", - "version": "5.23.0", + "version": "5.24.0", "description": "One foundation for multiple applications.", "license": "MIT", "author": "João Lenon ", diff --git a/src/applications/Http.ts b/src/applications/Http.ts index 115d7d5..d6d0e8b 100644 --- a/src/applications/Http.ts +++ b/src/applications/Http.ts @@ -32,13 +32,18 @@ export class Http { return server } - public static async boot(options: HttpOptions & { isAWSLambda: true }): Promise + public static async boot( + options: HttpOptions & { isAWSLambda: true } + ): Promise + public static async boot(options?: HttpOptions): Promise /** * Boot the Http application. */ - public static async boot(options?: HttpOptions): Promise { + public static async boot( + options?: HttpOptions + ): Promise { options = Options.create(options, { initOnly: false, isAWSLambda: false, diff --git a/src/ignite/Ignite.ts b/src/ignite/Ignite.ts index 1e89a17..cd1f3c1 100644 --- a/src/ignite/Ignite.ts +++ b/src/ignite/Ignite.ts @@ -18,6 +18,7 @@ import type { import { Ioc } from '@athenna/ioc' import { Cron } from '#src/applications/Cron' import { Http } from '#src/applications/Http' +import type { ServerImpl } from '@athenna/http' import { EnvHelper, Rc } from '@athenna/config' import { isAbsolute, resolve } from 'node:path' import type { ReplImpl } from '#src/repl/ReplImpl' @@ -26,6 +27,7 @@ import { CommanderHandler } from '@athenna/artisan' import { LoadHelper } from '#src/helpers/LoadHelper' import { Log, LoggerProvider } from '@athenna/logger' import { Repl as ReplApp } from '#src/applications/Repl' +import type { Handler as AWSLambdaHandler } from 'aws-lambda' import { parse as semverParse, satisfies as semverSatisfies } from 'semver' import { Is, Path, File, Module, Options, Macroable } from '@athenna/common' import { NotSatisfiedNodeVersion } from '#src/exceptions/NotSatisfiedNodeVersion' @@ -134,10 +136,13 @@ export class Ignite extends Macroable { } } + public async httpServer(options: HttpOptions & { isAWSLambda: true }): Promise + public async httpServer(options?: HttpOptions): Promise + /** * Ignite the Http server application. */ - public async httpServer(options?: HttpOptions) { + public async httpServer(options?: HttpOptions): Promise { try { this.options.environments.push('http') diff --git a/tests/unit/applications/HttpTest.ts b/tests/unit/applications/HttpTest.ts index fa01113..590db76 100644 --- a/tests/unit/applications/HttpTest.ts +++ b/tests/unit/applications/HttpTest.ts @@ -136,7 +136,7 @@ export default class HttpTest { Server.when('listen').resolve(undefined) await Http.boot({ host: '::1' }) - + assert.calledOnceWith(Server.listen, { host: '::1', port: 3000 }) assert.calledWith(successMock, 'Http server started on ({yellow} localhost:3000)') assert.calledWith(successMock, 'Kernel ({yellow} HttpKernel) successfully booted')