UNPKG

@upstash/qstash

Version:

Official Typescript client for QStash

48 lines (45 loc) 2.63 kB
import { NextApiHandler } from 'next'; import { NextRequest, NextFetchEvent } from 'next/server'; import { a9 as RouteFunction, aa as WorkflowServeOptions } from './client-DKNfczbM.mjs'; 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; }; 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; export { type VerifySignatureConfig, serve, servePagesRouter, verifySignature, verifySignatureAppRouter, verifySignatureEdge };