import { type Update } from "../types.js"; /** * HTTP Web frameworks for which grammY provides compatible callback out of the * box. */ export type SupportedFrameworks = keyof typeof adapters; /** * Abstraction over a request-response cycle, providing access to the update, as * well as a mechanism for responding to the request and to end it. */ export interface ReqResHandler { /** * The update object sent from Telegram, usually resolves the request's JSON * body */ update: Promise; /** * X-Telegram-Bot-Api-Secret-Token header of the request, or undefined if * not present */ header?: string; /** * Ends the request immediately without body, called after every request * unless a webhook reply was performed */ end?: () => void; /** * Sends the specified JSON as a payload in the body, used for webhook * replies */ respond: (json: string) => unknown | Promise; /** * Responds that the request is unauthorized due to mismatching * X-Telegram-Bot-Api-Secret-Token headers */ unauthorized: () => unknown | Promise; /** * Some frameworks (e.g. Deno's std/http `listenAndServe`) assume that * handler returns something */ handlerReturn?: any; } /** * Middleware for a web framework. Creates a request-response handler for a * request. The handler will be used to integrate with the compatible framework. */ export type FrameworkAdapter = (...args: any[]) => ReqResHandler; export declare const adapters: { express: FrameworkAdapter; koa: FrameworkAdapter; fastify: FrameworkAdapter; serveHttp: FrameworkAdapter; "std/http": FrameworkAdapter; oak: FrameworkAdapter; http: FrameworkAdapter; https: FrameworkAdapter; "aws-lambda": FrameworkAdapter; "aws-lambda-async": FrameworkAdapter; azure: FrameworkAdapter; "next-js": FrameworkAdapter; sveltekit: FrameworkAdapter; cloudflare: FrameworkAdapter; "cloudflare-mod": FrameworkAdapter; hono: FrameworkAdapter; worktop: FrameworkAdapter; };