UNPKG

@upstash/workflow

Version:

Durable, Reliable and Performant Serverless Functions

37 lines (34 loc) 1.67 kB
import { R as RouteFunction, n as PublicServeOptions, y as InvokableWorkflow } from './types-Q3dM0UlR.js'; import { s as serveManyBase } from './serve-many-CXqQP3RI.js'; import '@upstash/qstash'; import 'zod'; import 'ai'; import '@ai-sdk/openai'; /** * Serve method to serve a Upstash Workflow in a TanStack Start project * * This wrapper allows you to access both the workflow context and TanStack route context * * @param routeFunction workflow function that receives both workflow context and TanStack route context * @param options workflow options (same as Next.js serve options) * @returns handler object with POST method compatible with TanStack Start */ declare function serve<TInitialPayload = unknown, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload>): { POST: (tanstackContext: { request: Request; }) => Promise<Response>; }; declare const createWorkflow: <TInitialPayload, TResult>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload> | undefined) => InvokableWorkflow<TInitialPayload, TResult>; /** * Serve multiple workflows from a single endpoint using dynamic routing in TanStack Start * * @param workflows object containing workflow definitions * @param options serve options * @returns handler object with POST method */ declare const serveMany: (workflows: Parameters<typeof serveManyBase>[0]["workflows"], options?: Parameters<typeof serveManyBase>[0]["options"]) => { POST: (tanstackContext: { request: Request; }) => Promise<any>; }; export { createWorkflow, serve, serveMany };