import { NextApiHandler } from 'next';
import { NextRequest, NextFetchEvent } from 'next/server';
import { ae as RouteFunction, af as WorkflowServeOptions } from './client-CUioGZfg.js';
import 'neverthrow';

type VerifySignatureConfig = {
    currentSigningKey?: string;
    nextSigningKey?: string;
    /**
     * The url of this api route, including the protocol.
     *
     * If you omit this, the url will be automatically determined by checking the `VERCEL_URL` env variable and assuming `https`
     */
    url?: string;
    /**
     * Number of seconds to tolerate when checking `nbf` and `exp` claims, to deal with small clock differences among different servers
     *
     * @default 0
     */
    clockTolerance?: number;
    /**
     * Use the local dev server signing keys. Pair this with
     * `new Client({ devMode: true })` for end-to-end local development.
     *
     * - `true`: use dev server signing keys
     * - `false`: never use dev server signing keys (ignores QSTASH_DEV env var)
     * - `undefined`: check QSTASH_DEV env var
     *
     * @default undefined
     */
    devMode?: boolean;
};
declare function verifySignature(handler: NextApiHandler, config?: VerifySignatureConfig): NextApiHandler;
declare function verifySignatureEdge(handler: (request: NextRequest, nfe?: NextFetchEvent) => Response | Promise<Response>, config?: VerifySignatureConfig): (request: NextRequest, nfe: NextFetchEvent) => Promise<Response>;
type VerifySignatureAppRouterResponse = Response | Promise<Response>;
declare function verifySignatureAppRouter(handler: ((request: Request, params?: any) => VerifySignatureAppRouterResponse) | ((request: NextRequest, params?: any) => VerifySignatureAppRouterResponse), config?: VerifySignatureConfig): (request: NextRequest | Request, params?: any) => Promise<Response>;
/**
 * Serve method to serve a Upstash Workflow in a Nextjs project
 *
 * See for options https://upstash.com/docs/qstash/workflows/basics/serve
 *
 * @param routeFunction workflow function
 * @param options workflow options
 * @returns
 *
 * @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
 * Please use https://github.com/upstash/workflow-js
 * Migration Guide: https://upstash.com/docs/workflow/migration
 */
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => ((request: Request) => Promise<Response>);
/**
 * @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
 * Please use https://github.com/upstash/workflow-js
 * Migration Guide: https://upstash.com/docs/workflow/migration
 */
declare const servePagesRouter: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => NextApiHandler;
/**
 * Start the QStash dev server early during Next.js initialization.
 *
 * Call this inside your `instrumentation.ts` `register()` function so
 * the dev server is ready before any request — including edge routes
 * that cannot start it themselves.
 *
 * No-op in production, during `next build`, or in edge runtime.
 *
 * @example
 * ```ts
 * // instrumentation.ts
 * import { registerQStashDev } from "@upstash/qstash/nextjs";
 *
 * export function register() {
 *   registerQStashDev();
 * }
 * ```
 */
declare function registerQStashDev(): Promise<void>;

export { type VerifySignatureConfig, registerQStashDev, serve, servePagesRouter, verifySignature, verifySignatureAppRouter, verifySignatureEdge };
