From 2f6de5af3f0ce8263d1f0c2b6568afecb3b86bcc Mon Sep 17 00:00:00 2001 From: Thada Wangthammang Date: Thu, 16 Jan 2025 22:43:10 +0700 Subject: [PATCH] type: fix Azure Function v4 Adapter HttpRequest and InvocationContext Type (#742) * type: fix Azure Function v4 Adapter HttpRequest and Context Type * type: fix remove unnecessary export types --- src/convenience/frameworks.ts | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/convenience/frameworks.ts b/src/convenience/frameworks.ts index edc28596..d796cc15 100644 --- a/src/convenience/frameworks.ts +++ b/src/convenience/frameworks.ts @@ -86,13 +86,23 @@ export type AzureAdapter = (context: { [key: string]: any; }; }, request: { body?: unknown }) => ReqResHandler; -export type AzureAdapterV4 = (request: Request, context: { - res?: { - status: number; - body: string; - headers?: Record; - }; -}) => ReqResHandler<{ status: number; body?: string } | { jsonBody: string }>; +type AzureV4HttpRequest = { + method: string; + url: string; + headers: any; + query: URLSearchParams; + body: any; +} +type AzureV4InvocationContext = { + invocationId: string; + functionName: string; +} +export type AzureAdapterV4 = (request: AzureV4HttpRequest, context: AzureV4InvocationContext) => ReqResHandler<{ + status: number; + body?: string; +} | { + jsonBody: string; +}>; export type BunAdapter = (request: { headers: Headers;