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
5 changes: 5 additions & 0 deletions .changeset/silver-nights-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@smooai/utils': patch
---

Making it easier type wise to accept Hono apps.
6 changes: 4 additions & 2 deletions src/api/hono.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import { fromZodError } from 'zod-validation-error';

const logger = new AwsServerLogger();

export function addHonoMiddleware(appFunction: (app: Hono) => Hono): ReturnType<typeof handle> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- accepting any hono generic
export function addHonoMiddleware(appFunction: (app: Hono<any>) => Hono<any>): ReturnType<typeof handle> {
const app = new Hono();

app.use(requestId());
Expand Down Expand Up @@ -57,7 +58,8 @@ export function addHonoMiddleware(appFunction: (app: Hono) => Hono): ReturnType<
};
}

export function createHonoAwsLambdaHandler(app: Hono, appFunction: (app: Hono) => Hono): ReturnType<typeof handle> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- accepting any hono generic
export function createHonoAwsLambdaHandler(app: Hono<any>, appFunction: (app: Hono<any>) => Hono<any>): ReturnType<typeof handle> {
const appWithRoutes = appFunction(app);
return (event: LambdaEvent, lambdaContext?: LambdaContext) => {
logger.addLambdaContext(event as unknown as APIGatewayProxyEventV2, lambdaContext as unknown as Context);
Expand Down
Loading