/** * An adapter for Next.js to serve and register any declared functions with * Inngest, making them available to be triggered by events. * * Supports Next.js 12+, both serverless and edge. * * @example Next.js <=12 or the pages router can export the handler directly * ```ts * export default serve({ client: inngest, functions: [fn1, fn2] }); * ``` * * @example Next.js >=13 with the `app` dir must export individual methods * ```ts * export const { GET, POST, PUT } = serve({ * client: inngest, * functions: [fn1, fn2], * }); * ``` * * @module */ import { type NextRequest } from "next/server.js"; import { type ServeHandlerOptions } from "./components/InngestCommHandler.js"; import { type SupportedFrameworkName } from "./types.js"; /** * The name of the framework, used to identify the framework in Inngest * dashboards and during testing. */ export declare const frameworkName: SupportedFrameworkName; /** * The shape of a request handler, supporting Next.js 12+. * * We are intentionally abstract with the arguments here, as Next.js's type * checking when building varies wildly between major versions; specifying * different types (even optional types) here can cause issues with the build. * * This change was initially made for Next.js 15, which specifies the second * argument as `RouteContext`, whereas Next.js 13 and 14 omit it and Next.js 12 * provides a `NextApiResponse`, which is varies based on the execution * environment used (edge vs serverless). */ export type RequestHandler = (expectedReq: NextRequest, res: unknown) => Promise; /** * In Next.js, serve and register any declared functions with Inngest, making * them available to be triggered by events. * * Supports Next.js 12+, both serverless and edge. * * @example Next.js <=12 or the pages router can export the handler directly * ```ts * export default serve({ client: inngest, functions: [fn1, fn2] }); * ``` * * @example Next.js >=13 with the `app` dir must export individual methods * ```ts * export const { GET, POST, PUT } = serve({ * client: inngest, * functions: [fn1, fn2], * }); * ``` * * @public */ export declare const serve: (options: ServeHandlerOptions) => RequestHandler & { GET: RequestHandler; POST: RequestHandler; PUT: RequestHandler; }; //# sourceMappingURL=next.d.ts.map