@upstash/workflow 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -71,7 +71,19 @@ var formatWorkflowError = (error) => {
71
71
  };
72
72
  };
73
73
 
74
+ // src/types.ts
75
+ var StepTypes = [
76
+ "Initial",
77
+ "Run",
78
+ "SleepFor",
79
+ "SleepUntil",
80
+ "Call",
81
+ "Wait",
82
+ "Notify"
83
+ ];
84
+
74
85
  // src/client/utils.ts
86
+ import { QstashError as QstashError2 } from "@upstash/qstash";
75
87
  var makeNotifyRequest = async (requester, eventId, eventData) => {
76
88
  const result = await requester.request({
77
89
  path: ["v2", "notify", eventId],
@@ -105,24 +117,28 @@ var getSteps = async (requester, workflowRunId, messageId, debug) => {
105
117
  await debug?.log("INFO", "ENDPOINT_START", {
106
118
  message: `Pulled ${steps.length} steps from QStashand returned them without filtering with messageId.`
107
119
  });
108
- return steps;
120
+ return { steps, workflowRunEnded: false };
109
121
  } else {
110
122
  const index = steps.findIndex((item) => item.messageId === messageId);
111
123
  if (index === -1) {
112
- return [];
124
+ return { steps: [], workflowRunEnded: false };
113
125
  }
114
126
  const filteredSteps = steps.slice(0, index + 1);
115
127
  await debug?.log("INFO", "ENDPOINT_START", {
116
128
  message: `Pulled ${steps.length} steps from QStash and filtered them to ${filteredSteps.length} using messageId.`
117
129
  });
118
- return filteredSteps;
130
+ return { steps: filteredSteps, workflowRunEnded: false };
119
131
  }
120
132
  } catch (error) {
121
- await debug?.log("ERROR", "ERROR", {
122
- message: "failed while fetching steps.",
123
- error
124
- });
125
- throw new WorkflowError(`Failed while pulling steps. ${error}`);
133
+ if (error instanceof QstashError2 && error.status === 404) {
134
+ await debug?.log("WARN", "ENDPOINT_START", {
135
+ message: "Couldn't fetch workflow run steps. This can happen if the workflow run succesfully ends before some callback is executed.",
136
+ error
137
+ });
138
+ return { steps: void 0, workflowRunEnded: true };
139
+ } else {
140
+ throw error;
141
+ }
126
142
  }
127
143
  };
128
144
 
@@ -734,20 +750,9 @@ var DEFAULT_CONTENT_TYPE = "application/json";
734
750
  var NO_CONCURRENCY = 1;
735
751
  var DEFAULT_RETRIES = 3;
736
752
 
737
- // src/types.ts
738
- var StepTypes = [
739
- "Initial",
740
- "Run",
741
- "SleepFor",
742
- "SleepUntil",
743
- "Call",
744
- "Wait",
745
- "Notify"
746
- ];
747
-
748
753
  // src/workflow-requests.ts
749
- import { QstashError as QstashError2 } from "@upstash/qstash";
750
- var triggerFirstInvocation = async (workflowContext, retries, debug) => {
754
+ import { QstashError as QstashError3 } from "@upstash/qstash";
755
+ var triggerFirstInvocation = async (workflowContext, retries, useJSONContent, debug) => {
751
756
  const { headers } = getHeaders(
752
757
  "true",
753
758
  workflowContext.workflowRunId,
@@ -757,6 +762,9 @@ var triggerFirstInvocation = async (workflowContext, retries, debug) => {
757
762
  workflowContext.failureUrl,
758
763
  retries
759
764
  );
765
+ if (useJSONContent) {
766
+ headers["content-type"] = "application/json";
767
+ }
760
768
  try {
761
769
  const body = typeof workflowContext.requestPayload === "string" ? workflowContext.requestPayload : JSON.stringify(workflowContext.requestPayload);
762
770
  const result = await workflowContext.qstashClient.publish({
@@ -800,7 +808,7 @@ var triggerRouteFunction = async ({
800
808
  return ok("workflow-finished");
801
809
  } catch (error) {
802
810
  const error_ = error;
803
- if (error instanceof QstashError2 && error.status === 400) {
811
+ if (error instanceof QstashError3 && error.status === 400) {
804
812
  await debug?.log("WARN", "RESPONSE_WORKFLOW", {
805
813
  message: `tried to append to a cancelled workflow. exiting without publishing.`,
806
814
  name: error.name,
@@ -834,7 +842,7 @@ var triggerWorkflowDelete = async (workflowContext, debug, cancel = false) => {
834
842
  );
835
843
  return { deleted: true };
836
844
  } catch (error) {
837
- if (error instanceof QstashError2 && error.status === 404) {
845
+ if (error instanceof QstashError3 && error.status === 404) {
838
846
  await debug?.log("WARN", "SUBMIT_CLEANUP", {
839
847
  message: `Failed to remove workflow run ${workflowContext.workflowRunId} as it doesn't exist.`,
840
848
  name: error.name,
@@ -871,11 +879,19 @@ var handleThirdPartyCallResult = async (request, requestPayload, client, workflo
871
879
  if (!workflowRunId2)
872
880
  throw new WorkflowError("workflow run id missing in context.call lazy fetch.");
873
881
  if (!messageId) throw new WorkflowError("message id missing in context.call lazy fetch.");
874
- const steps = await getSteps(client.http, workflowRunId2, messageId, debug);
882
+ const { steps, workflowRunEnded } = await getSteps(
883
+ client.http,
884
+ workflowRunId2,
885
+ messageId,
886
+ debug
887
+ );
888
+ if (workflowRunEnded) {
889
+ return ok("workflow-ended");
890
+ }
875
891
  const failingStep = steps.find((step) => step.messageId === messageId);
876
892
  if (!failingStep)
877
893
  throw new WorkflowError(
878
- "Failed to submit the context.call." + (steps.length === 0 ? "No steps found." : `No step was found with matching messageId ${messageId} out of ${steps.length} steps.`)
894
+ "Failed to submit the context.call. " + (steps.length === 0 ? "No steps found." : `No step was found with matching messageId ${messageId} out of ${steps.length} steps.`)
879
895
  );
880
896
  callbackPayload = atob(failingStep.body);
881
897
  }
@@ -1914,7 +1930,7 @@ function decodeBase64(base64) {
1914
1930
  }
1915
1931
 
1916
1932
  // src/serve/authorization.ts
1917
- import { Client } from "@upstash/qstash";
1933
+ import { Client as Client2 } from "@upstash/qstash";
1918
1934
  var DisabledWorkflowContext = class _DisabledWorkflowContext extends WorkflowContext {
1919
1935
  static disabledMessage = "disabled-qstash-worklfow-run";
1920
1936
  /**
@@ -1945,7 +1961,7 @@ var DisabledWorkflowContext = class _DisabledWorkflowContext extends WorkflowCon
1945
1961
  */
1946
1962
  static async tryAuthentication(routeFunction, context) {
1947
1963
  const disabledContext = new _DisabledWorkflowContext({
1948
- qstashClient: new Client({
1964
+ qstashClient: new Client2({
1949
1965
  baseUrl: "disabled-client",
1950
1966
  token: "disabled-client"
1951
1967
  }),
@@ -2069,7 +2085,8 @@ var parseRequest = async (requestPayload, isFirstInvocation, workflowRunId, requ
2069
2085
  return {
2070
2086
  rawInitialPayload: requestPayload ?? "",
2071
2087
  steps: [],
2072
- isLastDuplicate: false
2088
+ isLastDuplicate: false,
2089
+ workflowRunEnded: false
2073
2090
  };
2074
2091
  } else {
2075
2092
  let rawSteps;
@@ -2079,7 +2096,21 @@ var parseRequest = async (requestPayload, isFirstInvocation, workflowRunId, requ
2079
2096
  "ENDPOINT_START",
2080
2097
  "request payload is empty, steps will be fetched from QStash."
2081
2098
  );
2082
- rawSteps = await getSteps(requester, workflowRunId, messageId, debug);
2099
+ const { steps: fetchedSteps, workflowRunEnded } = await getSteps(
2100
+ requester,
2101
+ workflowRunId,
2102
+ messageId,
2103
+ debug
2104
+ );
2105
+ if (workflowRunEnded) {
2106
+ return {
2107
+ rawInitialPayload: void 0,
2108
+ steps: void 0,
2109
+ isLastDuplicate: void 0,
2110
+ workflowRunEnded: true
2111
+ };
2112
+ }
2113
+ rawSteps = fetchedSteps;
2083
2114
  } else {
2084
2115
  rawSteps = JSON.parse(requestPayload);
2085
2116
  }
@@ -2089,7 +2120,8 @@ var parseRequest = async (requestPayload, isFirstInvocation, workflowRunId, requ
2089
2120
  return {
2090
2121
  rawInitialPayload,
2091
2122
  steps: deduplicatedSteps,
2092
- isLastDuplicate
2123
+ isLastDuplicate,
2124
+ workflowRunEnded: false
2093
2125
  };
2094
2126
  }
2095
2127
  };
@@ -2144,14 +2176,14 @@ var handleFailure = async (request, requestPayload, qstashClient, initialPayload
2144
2176
 
2145
2177
  // src/serve/options.ts
2146
2178
  import { Receiver } from "@upstash/qstash";
2147
- import { Client as Client2 } from "@upstash/qstash";
2179
+ import { Client as Client3 } from "@upstash/qstash";
2148
2180
  var processOptions = (options) => {
2149
2181
  const environment = options?.env ?? (typeof process === "undefined" ? {} : process.env);
2150
2182
  const receiverEnvironmentVariablesSet = Boolean(
2151
2183
  environment.QSTASH_CURRENT_SIGNING_KEY && environment.QSTASH_NEXT_SIGNING_KEY
2152
2184
  );
2153
2185
  return {
2154
- qstashClient: new Client2({
2186
+ qstashClient: new Client3({
2155
2187
  baseUrl: environment.QSTASH_URL,
2156
2188
  token: environment.QSTASH_TOKEN
2157
2189
  }),
@@ -2192,6 +2224,7 @@ var processOptions = (options) => {
2192
2224
  baseUrl: environment.UPSTASH_WORKFLOW_URL,
2193
2225
  env: environment,
2194
2226
  retries: DEFAULT_RETRIES,
2227
+ useJSONContent: false,
2195
2228
  ...options
2196
2229
  };
2197
2230
  };
@@ -2208,6 +2241,16 @@ var determineUrls = async (request, url, baseUrl, failureFunction, failureUrl, d
2208
2241
  });
2209
2242
  }
2210
2243
  const workflowFailureUrl = failureFunction ? workflowUrl : failureUrl;
2244
+ if (workflowUrl.includes("localhost")) {
2245
+ await debug?.log("WARN", "ENDPOINT_START", {
2246
+ message: `Workflow URL contains localhost. This can happen in local development, but shouldn't happen in production unless you have a route which contains localhost. Received: ${workflowUrl}`
2247
+ });
2248
+ }
2249
+ if (!(workflowUrl.startsWith("http://") || workflowUrl.startsWith("https://"))) {
2250
+ throw new WorkflowError(
2251
+ `Workflow URL should start with 'http://' or 'https://'. Recevied is '${workflowUrl}'`
2252
+ );
2253
+ }
2211
2254
  return {
2212
2255
  workflowUrl,
2213
2256
  workflowFailureUrl
@@ -2216,7 +2259,7 @@ var determineUrls = async (request, url, baseUrl, failureFunction, failureUrl, d
2216
2259
  var AUTH_FAIL_MESSAGE = `Failed to authenticate Workflow request. If this is unexpected, see the caveat https://upstash.com/docs/workflow/basics/caveats#avoid-non-deterministic-code-outside-context-run`;
2217
2260
 
2218
2261
  // src/serve/index.ts
2219
- var serve = (routeFunction, options) => {
2262
+ var serveBase = (routeFunction, options) => {
2220
2263
  const {
2221
2264
  qstashClient,
2222
2265
  onStepFinish,
@@ -2228,7 +2271,8 @@ var serve = (routeFunction, options) => {
2228
2271
  failureFunction,
2229
2272
  baseUrl,
2230
2273
  env,
2231
- retries
2274
+ retries,
2275
+ useJSONContent
2232
2276
  } = processOptions(options);
2233
2277
  const debug = WorkflowLogger.getLogger(verbose);
2234
2278
  const handler = async (request) => {
@@ -2245,7 +2289,7 @@ var serve = (routeFunction, options) => {
2245
2289
  await verifyRequest(requestPayload, request.headers.get("upstash-signature"), receiver);
2246
2290
  const { isFirstInvocation, workflowRunId } = validateRequest(request);
2247
2291
  debug?.setWorkflowRunId(workflowRunId);
2248
- const { rawInitialPayload, steps, isLastDuplicate } = await parseRequest(
2292
+ const { rawInitialPayload, steps, isLastDuplicate, workflowRunEnded } = await parseRequest(
2249
2293
  requestPayload,
2250
2294
  isFirstInvocation,
2251
2295
  workflowRunId,
@@ -2253,8 +2297,11 @@ var serve = (routeFunction, options) => {
2253
2297
  request.headers.get("upstash-message-id"),
2254
2298
  debug
2255
2299
  );
2300
+ if (workflowRunEnded) {
2301
+ return onStepFinish(workflowRunId, "workflow-already-ended");
2302
+ }
2256
2303
  if (isLastDuplicate) {
2257
- return onStepFinish("no-workflow-id", "duplicate-step");
2304
+ return onStepFinish(workflowRunId, "duplicate-step");
2258
2305
  }
2259
2306
  const failureCheck = await handleFailure(
2260
2307
  request,
@@ -2268,7 +2315,7 @@ var serve = (routeFunction, options) => {
2268
2315
  throw failureCheck.error;
2269
2316
  } else if (failureCheck.value === "is-failure-callback") {
2270
2317
  await debug?.log("WARN", "RESPONSE_DEFAULT", "failureFunction executed");
2271
- return onStepFinish("no-workflow-id", "failure-callback");
2318
+ return onStepFinish(workflowRunId, "failure-callback");
2272
2319
  }
2273
2320
  const workflowContext = new WorkflowContext({
2274
2321
  qstashClient,
@@ -2311,7 +2358,7 @@ var serve = (routeFunction, options) => {
2311
2358
  });
2312
2359
  throw callReturnCheck.error;
2313
2360
  } else if (callReturnCheck.value === "continue-workflow") {
2314
- const result = isFirstInvocation ? await triggerFirstInvocation(workflowContext, retries, debug) : await triggerRouteFunction({
2361
+ const result = isFirstInvocation ? await triggerFirstInvocation(workflowContext, retries, useJSONContent, debug) : await triggerRouteFunction({
2315
2362
  onStep: async () => routeFunction(workflowContext),
2316
2363
  onCleanup: async () => {
2317
2364
  await triggerWorkflowDelete(workflowContext, debug);
@@ -2327,6 +2374,8 @@ var serve = (routeFunction, options) => {
2327
2374
  }
2328
2375
  await debug?.log("INFO", "RESPONSE_WORKFLOW");
2329
2376
  return onStepFinish(workflowContext.workflowRunId, "success");
2377
+ } else if (callReturnCheck.value === "workflow-ended") {
2378
+ return onStepFinish(workflowContext.workflowRunId, "workflow-already-ended");
2330
2379
  }
2331
2380
  await debug?.log("INFO", "RESPONSE_DEFAULT");
2332
2381
  return onStepFinish("no-workflow-id", "fromCallback");
@@ -2343,198 +2392,24 @@ var serve = (routeFunction, options) => {
2343
2392
  };
2344
2393
  return { handler: safeHandler };
2345
2394
  };
2346
-
2347
- // src/client/index.ts
2348
- import { Client as QStashClient } from "@upstash/qstash";
2349
- var Client3 = class {
2350
- client;
2351
- constructor(clientConfig) {
2352
- if (!clientConfig.token) {
2353
- console.error(
2354
- "QStash token is required for Upstash Workflow!\n\nTo fix this:\n1. Get your token from the Upstash Console (https://console.upstash.com/qstash)\n2. Initialize the workflow client with:\n\n const client = new Client({\n token: '<YOUR_QSTASH_TOKEN>'\n });"
2355
- );
2356
- }
2357
- this.client = new QStashClient(clientConfig);
2358
- }
2359
- /**
2360
- * Cancel an ongoing workflow
2361
- *
2362
- * Returns true if workflow is canceled succesfully. Otherwise, throws error.
2363
- *
2364
- * There are multiple ways you can cancel workflows:
2365
- * - pass one or more workflow run ids to cancel them
2366
- * - pass a workflow url to cancel all runs starting with this url
2367
- * - cancel all pending or active workflow runs
2368
- *
2369
- * ### Cancel a set of workflow runs
2370
- *
2371
- * ```ts
2372
- * // cancel a single workflow
2373
- * await client.cancel({ ids: "<WORKFLOW_RUN_ID>" })
2374
- *
2375
- * // cancel a set of workflow runs
2376
- * await client.cancel({ ids: [
2377
- * "<WORKFLOW_RUN_ID_1>",
2378
- * "<WORKFLOW_RUN_ID_2>",
2379
- * ]})
2380
- * ```
2381
- *
2382
- * ### Cancel workflows starting with a url
2383
- *
2384
- * If you have an endpoint called `https://your-endpoint.com` and you
2385
- * want to cancel all workflow runs on it, you can use `urlStartingWith`.
2386
- *
2387
- * Note that this will cancel workflows in all endpoints under
2388
- * `https://your-endpoint.com`.
2389
- *
2390
- * ```ts
2391
- * await client.cancel({ urlStartingWith: "https://your-endpoint.com" })
2392
- * ```
2393
- *
2394
- * ### Cancel *all* workflows
2395
- *
2396
- * To cancel all pending and currently running workflows, you can
2397
- * do it like this:
2398
- *
2399
- * ```ts
2400
- * await client.cancel({ all: true })
2401
- * ```
2402
- *
2403
- * @param ids run id of the workflow to delete
2404
- * @param urlStartingWith cancel workflows starting with this url. Will be ignored
2405
- * if `ids` parameter is set.
2406
- * @param all set to true in order to cancel all workflows. Will be ignored
2407
- * if `ids` or `urlStartingWith` parameters are set.
2408
- * @returns true if workflow is succesfully deleted. Otherwise throws QStashError
2409
- */
2410
- async cancel({
2411
- ids,
2412
- urlStartingWith,
2413
- all
2414
- }) {
2415
- let body;
2416
- if (ids) {
2417
- const runIdArray = typeof ids === "string" ? [ids] : ids;
2418
- body = JSON.stringify({ workflowRunIds: runIdArray });
2419
- } else if (urlStartingWith) {
2420
- body = JSON.stringify({ workflowUrl: urlStartingWith });
2421
- } else if (all) {
2422
- body = "{}";
2423
- } else {
2424
- throw new TypeError("The `cancel` method cannot be called without any options.");
2425
- }
2426
- const result = await this.client.http.request({
2427
- path: ["v2", "workflows", "runs"],
2428
- method: "DELETE",
2429
- body,
2430
- headers: {
2431
- "Content-Type": "application/json"
2432
- }
2433
- });
2434
- return result;
2435
- }
2436
- /**
2437
- * Notify a workflow run waiting for an event
2438
- *
2439
- * ```ts
2440
- * import { Client } from "@upstash/workflow";
2441
- *
2442
- * const client = new Client({ token: "<QSTASH_TOKEN>" })
2443
- * await client.notify({
2444
- * eventId: "my-event-id",
2445
- * eventData: "my-data" // data passed to the workflow run
2446
- * });
2447
- * ```
2448
- *
2449
- * @param eventId event id to notify
2450
- * @param eventData data to provide to the workflow
2451
- */
2452
- async notify({
2453
- eventId,
2454
- eventData
2455
- }) {
2456
- return await makeNotifyRequest(this.client.http, eventId, eventData);
2457
- }
2458
- /**
2459
- * Check waiters of an event
2460
- *
2461
- * ```ts
2462
- * import { Client } from "@upstash/workflow";
2463
- *
2464
- * const client = new Client({ token: "<QSTASH_TOKEN>" })
2465
- * const result = await client.getWaiters({
2466
- * eventId: "my-event-id"
2467
- * })
2468
- * ```
2469
- *
2470
- * @param eventId event id to check
2471
- */
2472
- async getWaiters({ eventId }) {
2473
- return await makeGetWaitersRequest(this.client.http, eventId);
2474
- }
2475
- /**
2476
- * Trigger new workflow run and returns the workflow run id
2477
- *
2478
- * ```ts
2479
- * const { workflowRunId } = await client.trigger({
2480
- * url: "https://workflow-endpoint.com",
2481
- * body: "hello there!", // Optional body
2482
- * headers: { ... }, // Optional headers
2483
- * workflowRunId: "my-workflow", // Optional workflow run ID
2484
- * retries: 3 // Optional retries for the initial request
2485
- * });
2486
- *
2487
- * console.log(workflowRunId)
2488
- * // wfr_my-workflow
2489
- * ```
2490
- *
2491
- * @param url URL of the workflow
2492
- * @param body body to start the workflow with
2493
- * @param headers headers to use in the request
2494
- * @param workflowRunId optional workflow run id to use. mind that
2495
- * you should pass different workflow run ids for different runs.
2496
- * The final workflowRunId will be `wfr_${workflowRunId}`, in
2497
- * other words: the workflow run id you pass will be prefixed
2498
- * with `wfr_`.
2499
- * @param retries retry to use in the initial request. in the rest of
2500
- * the workflow, `retries` option of the `serve` will be used.
2501
- * @returns workflow run id
2502
- */
2503
- async trigger({
2504
- url,
2505
- body,
2506
- headers,
2507
- workflowRunId,
2508
- retries
2509
- }) {
2510
- const finalWorkflowRunId = getWorkflowRunId(workflowRunId);
2511
- const context = new WorkflowContext({
2512
- qstashClient: this.client,
2513
- // @ts-expect-error headers type mismatch
2514
- headers: new Headers(headers ?? {}),
2515
- initialPayload: body,
2516
- steps: [],
2517
- url,
2518
- workflowRunId: finalWorkflowRunId
2519
- });
2520
- const result = await triggerFirstInvocation(context, retries ?? DEFAULT_RETRIES);
2521
- if (result.isOk()) {
2522
- return { workflowRunId: finalWorkflowRunId };
2523
- } else {
2524
- throw result.error;
2525
- }
2526
- }
2395
+ var serve = (routeFunction, options) => {
2396
+ return serveBase(routeFunction, options);
2527
2397
  };
2528
2398
 
2529
2399
  export {
2530
2400
  __require,
2531
2401
  __commonJS,
2532
2402
  __toESM,
2403
+ makeNotifyRequest,
2404
+ makeGetWaitersRequest,
2533
2405
  WorkflowError,
2534
2406
  WorkflowAbort,
2407
+ DEFAULT_RETRIES,
2535
2408
  StepTypes,
2409
+ triggerFirstInvocation,
2536
2410
  WorkflowContext,
2537
2411
  WorkflowLogger,
2538
- serve,
2539
- Client3 as Client
2412
+ getWorkflowRunId,
2413
+ serveBase,
2414
+ serve
2540
2415
  };
package/cloudflare.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { R as RouteFunction, W as WorkflowServeOptions } from './types-Be4hC1mu.mjs';
1
+ import { R as RouteFunction, j as PublicServeOptions } from './types-APRap-aV.mjs';
2
2
  import '@upstash/qstash';
3
3
 
4
4
  type WorkflowBindings = {
@@ -28,7 +28,7 @@ type WorkersHandlerArgs = [Request, Record<string, string | undefined>];
28
28
  * @param options workflow options
29
29
  * @returns
30
30
  */
31
- declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => {
31
+ declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: PublicServeOptions<TInitialPayload>) => {
32
32
  fetch: (...args: PagesHandlerArgs | WorkersHandlerArgs) => Promise<Response>;
33
33
  };
34
34
 
package/cloudflare.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { R as RouteFunction, W as WorkflowServeOptions } from './types-Be4hC1mu.js';
1
+ import { R as RouteFunction, j as PublicServeOptions } from './types-APRap-aV.js';
2
2
  import '@upstash/qstash';
3
3
 
4
4
  type WorkflowBindings = {
@@ -28,7 +28,7 @@ type WorkersHandlerArgs = [Request, Record<string, string | undefined>];
28
28
  * @param options workflow options
29
29
  * @returns
30
30
  */
31
- declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => {
31
+ declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: PublicServeOptions<TInitialPayload>) => {
32
32
  fetch: (...args: PagesHandlerArgs | WorkersHandlerArgs) => Promise<Response>;
33
33
  };
34
34