@upstash/workflow 1.4.0 → 1.5.0

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.
Files changed (223) hide show
  1. package/README.md +9 -0
  2. package/astro.d.mts +19 -2
  3. package/astro.d.ts +19 -2
  4. package/astro.js +670 -159
  5. package/astro.mjs +1 -1
  6. package/{chunk-DRHEHWMS.mjs → chunk-J3PXPHSB.mjs} +828 -317
  7. package/cloudflare.d.mts +17 -2
  8. package/cloudflare.d.ts +17 -2
  9. package/cloudflare.js +670 -159
  10. package/cloudflare.mjs +1 -1
  11. package/docs/agents/examples.mdx +8 -0
  12. package/docs/agents/features.mdx +374 -0
  13. package/docs/agents/getting-started.mdx +139 -0
  14. package/docs/agents/overview.mdx +40 -0
  15. package/docs/agents/patterns/evaluator-optimizer.mdx +72 -0
  16. package/docs/agents/patterns/orchestrator-workers.mdx +95 -0
  17. package/docs/agents/patterns/parallelization.mdx +77 -0
  18. package/docs/agents/patterns/prompt-chaining.mdx +84 -0
  19. package/docs/basics/best-practices/at-least-one-step.mdx +57 -0
  20. package/docs/basics/best-practices/business-logic-in-steps.mdx +52 -0
  21. package/docs/basics/best-practices/deterministic-code.mdx +132 -0
  22. package/docs/basics/best-practices/idempotency.mdx +38 -0
  23. package/docs/basics/best-practices/nested-context-methods.mdx +38 -0
  24. package/docs/basics/best-practices/overview.mdx +35 -0
  25. package/docs/basics/best-practices/promise-any.mdx +9 -0
  26. package/docs/basics/best-practices/return-step-results.mdx +80 -0
  27. package/docs/basics/best-practices/workflow-limits.mdx +62 -0
  28. package/docs/basics/client/cancel.mdx +137 -0
  29. package/docs/basics/client/dlq/callback.mdx +21 -0
  30. package/docs/basics/client/dlq/delete.mdx +120 -0
  31. package/docs/basics/client/dlq/list.mdx +96 -0
  32. package/docs/basics/client/dlq/restart.mdx +164 -0
  33. package/docs/basics/client/dlq/resume.mdx +167 -0
  34. package/docs/basics/client/logs.mdx +139 -0
  35. package/docs/basics/client/notify.mdx +79 -0
  36. package/docs/basics/client/trigger.mdx +139 -0
  37. package/docs/basics/client/waiters.mdx +31 -0
  38. package/docs/basics/client.mdx +40 -0
  39. package/docs/basics/how.mdx +65 -0
  40. package/docs/basics/serve/advanced.mdx +435 -0
  41. package/docs/basics/serve.mdx +142 -0
  42. package/docs/changelog.mdx +174 -0
  43. package/docs/examples/allInOne.mdx +377 -0
  44. package/docs/examples/authWebhook.mdx +567 -0
  45. package/docs/examples/customRetry.mdx +309 -0
  46. package/docs/examples/customerOnboarding.mdx +230 -0
  47. package/docs/examples/dynamicWorkflow.mdx +203 -0
  48. package/docs/examples/eCommerceOrderFulfillment.mdx +281 -0
  49. package/docs/examples/imageProcessing.mdx +339 -0
  50. package/docs/examples/paymentRetry.mdx +438 -0
  51. package/docs/examples/waitForEvent.mdx +201 -0
  52. package/docs/features/dlq/callback.mdx +42 -0
  53. package/docs/features/dlq/delete.mdx +29 -0
  54. package/docs/features/dlq/restart.mdx +33 -0
  55. package/docs/features/dlq/resume.mdx +37 -0
  56. package/docs/features/dlq.mdx +39 -0
  57. package/docs/features/failure-callback.mdx +102 -0
  58. package/docs/features/failureFunction/advanced.mdx +36 -0
  59. package/docs/features/failureFunction/reliability.mdx +33 -0
  60. package/docs/features/flow-control/monitor.mdx +22 -0
  61. package/docs/features/flow-control/parallelism.mdx +45 -0
  62. package/docs/features/flow-control/rate-period.mdx +46 -0
  63. package/docs/features/flow-control.mdx +164 -0
  64. package/docs/features/invoke/serveMany.mdx +109 -0
  65. package/docs/features/invoke.mdx +39 -0
  66. package/docs/features/notify.mdx +127 -0
  67. package/docs/features/parallel-steps.mdx +41 -0
  68. package/docs/features/retries/prevent-retries.mdx +140 -0
  69. package/docs/features/retries.mdx +93 -0
  70. package/docs/features/wait-for-event.mdx +104 -0
  71. package/docs/features/wait.mdx +44 -0
  72. package/docs/features/webhooks.mdx +116 -0
  73. package/docs/getstarted.mdx +200 -0
  74. package/docs/howto/cancel.mdx +50 -0
  75. package/docs/howto/changes.mdx +33 -0
  76. package/docs/howto/configure.mdx +42 -0
  77. package/docs/howto/failures.mdx +185 -0
  78. package/docs/howto/get-token.mdx +18 -0
  79. package/docs/howto/local-development/development-server.mdx +130 -0
  80. package/docs/howto/local-development/local-tunnel.mdx +73 -0
  81. package/docs/howto/middlewares.mdx +263 -0
  82. package/docs/howto/migrations.mdx +335 -0
  83. package/docs/howto/multi-region.mdx +107 -0
  84. package/docs/howto/parallel-runs.mdx +52 -0
  85. package/docs/howto/readonly-token.mdx +19 -0
  86. package/docs/howto/realtime/basic.mdx +315 -0
  87. package/docs/howto/realtime/human-in-the-loop.mdx +454 -0
  88. package/docs/howto/redact-fields.mdx +61 -0
  89. package/docs/howto/retry-now.mdx +41 -0
  90. package/docs/howto/schedule.mdx +104 -0
  91. package/docs/howto/security.mdx +143 -0
  92. package/docs/howto/singleton.mdx +137 -0
  93. package/docs/howto/start.mdx +69 -0
  94. package/docs/howto/use-webhooks.mdx +256 -0
  95. package/docs/integrations/aisdk.mdx +316 -0
  96. package/docs/integrations/anthropic.mdx +51 -0
  97. package/docs/integrations/datadog.mdx +69 -0
  98. package/docs/integrations/openai.mdx +87 -0
  99. package/docs/integrations/prometheus.mdx +65 -0
  100. package/docs/integrations/resend.mdx +82 -0
  101. package/docs/llms-txt.mdx +4 -0
  102. package/docs/openapi.yaml +2944 -0
  103. package/docs/pricing.mdx +22 -0
  104. package/docs/quickstarts/astro.mdx +185 -0
  105. package/docs/quickstarts/cloudflare-workers.mdx +190 -0
  106. package/docs/quickstarts/express.mdx +190 -0
  107. package/docs/quickstarts/fastapi.mdx +282 -0
  108. package/docs/quickstarts/flask.mdx +282 -0
  109. package/docs/quickstarts/hono.mdx +221 -0
  110. package/docs/quickstarts/nextjs-fastapi.mdx +147 -0
  111. package/docs/quickstarts/nextjs-flask.mdx +147 -0
  112. package/docs/quickstarts/nuxt.mdx +169 -0
  113. package/docs/quickstarts/platforms.mdx +78 -0
  114. package/docs/quickstarts/solidjs.mdx +161 -0
  115. package/docs/quickstarts/svelte.mdx +170 -0
  116. package/docs/quickstarts/tanstack-start.mdx +205 -0
  117. package/docs/quickstarts/vercel-nextjs.mdx +233 -0
  118. package/docs/roadmap.mdx +8 -0
  119. package/docs/sdk/workflow-js.mdx +4 -0
  120. package/docs/sdk/workflow-py.mdx +4 -0
  121. package/docs/steps/api.mdx +64 -0
  122. package/docs/steps/call.mdx +183 -0
  123. package/docs/steps/cancel.mdx +25 -0
  124. package/docs/steps/createWebhook.mdx +40 -0
  125. package/docs/steps/invoke.mdx +100 -0
  126. package/docs/steps/notify.mdx +105 -0
  127. package/docs/steps/run.mdx +150 -0
  128. package/docs/steps/sleep.mdx +97 -0
  129. package/docs/steps/sleepUntil.mdx +88 -0
  130. package/docs/steps/waitForEvent.mdx +60 -0
  131. package/docs/steps/waitForWebhook.mdx +78 -0
  132. package/docs/steps.mdx +108 -0
  133. package/docs/troubleshooting/general.mdx +331 -0
  134. package/docs/troubleshooting/vercel.mdx +82 -0
  135. package/express.d.mts +19 -2
  136. package/express.d.ts +19 -2
  137. package/express.js +670 -159
  138. package/express.mjs +1 -1
  139. package/h3.d.mts +19 -2
  140. package/h3.d.ts +19 -2
  141. package/h3.js +670 -159
  142. package/h3.mjs +1 -1
  143. package/hono.d.mts +17 -2
  144. package/hono.d.ts +17 -2
  145. package/hono.js +670 -159
  146. package/hono.mjs +1 -1
  147. package/index.d.mts +50 -21
  148. package/index.d.ts +50 -21
  149. package/index.js +686 -171
  150. package/index.mjs +17 -13
  151. package/nextjs.d.mts +40 -2
  152. package/nextjs.d.ts +40 -2
  153. package/nextjs.js +670 -159
  154. package/nextjs.mjs +1 -1
  155. package/package.json +1 -1
  156. package/react-router.d.mts +16 -2
  157. package/react-router.d.ts +16 -2
  158. package/react-router.js +670 -159
  159. package/react-router.mjs +1 -1
  160. package/{serve-many-CG3BFvO3.d.mts → serve-many-BKukvLNl.d.mts} +1 -1
  161. package/{serve-many-iJF1IUXk.d.ts → serve-many-CrLKQpuZ.d.ts} +1 -1
  162. package/solidjs.d.mts +10 -1
  163. package/solidjs.d.ts +10 -1
  164. package/solidjs.js +670 -159
  165. package/solidjs.mjs +1 -1
  166. package/src/platforms/astro.ts +84 -0
  167. package/src/platforms/cloudflare.ts +127 -0
  168. package/src/platforms/express.ts +147 -0
  169. package/src/platforms/h3.ts +105 -0
  170. package/src/platforms/hono.ts +103 -0
  171. package/src/platforms/nextjs.ts +193 -0
  172. package/src/platforms/react-router.ts +92 -0
  173. package/src/platforms/solidjs.ts +59 -0
  174. package/src/platforms/svelte.ts +99 -0
  175. package/src/platforms/tanstack.ts +96 -0
  176. package/src/src/client/dlq.ts +387 -0
  177. package/src/src/client/filter-types.ts +166 -0
  178. package/src/src/client/index.ts +350 -0
  179. package/src/src/client/types.ts +501 -0
  180. package/src/src/client/utils.ts +307 -0
  181. package/src/src/constants.ts +82 -0
  182. package/src/src/context/api/anthropic.ts +58 -0
  183. package/src/src/context/api/base.ts +52 -0
  184. package/src/src/context/api/index.ts +24 -0
  185. package/src/src/context/api/openai.ts +125 -0
  186. package/src/src/context/api/resend.ts +57 -0
  187. package/src/src/context/auto-executor.ts +707 -0
  188. package/src/src/context/context.ts +681 -0
  189. package/src/src/context/index.ts +1 -0
  190. package/src/src/context/provider.ts +37 -0
  191. package/src/src/context/steps.ts +965 -0
  192. package/src/src/error.ts +203 -0
  193. package/src/src/index.ts +13 -0
  194. package/src/src/middleware/default-callbacks.ts +20 -0
  195. package/src/src/middleware/index.ts +2 -0
  196. package/src/src/middleware/logging.ts +39 -0
  197. package/src/src/middleware/manager.ts +148 -0
  198. package/src/src/middleware/middleware.ts +46 -0
  199. package/src/src/middleware/types.ts +72 -0
  200. package/src/src/qstash/headers.ts +397 -0
  201. package/src/src/qstash/step-config.ts +268 -0
  202. package/src/src/qstash/submit-steps.ts +284 -0
  203. package/src/src/serve/authorization.ts +118 -0
  204. package/src/src/serve/index.ts +475 -0
  205. package/src/src/serve/multi-region/handlers.ts +225 -0
  206. package/src/src/serve/multi-region/utils.ts +88 -0
  207. package/src/src/serve/options.ts +241 -0
  208. package/src/src/serve/serve-many.ts +117 -0
  209. package/src/src/serve/utils.ts +11 -0
  210. package/src/src/types.ts +590 -0
  211. package/src/src/utils.ts +141 -0
  212. package/src/src/workflow-parser.ts +472 -0
  213. package/src/src/workflow-requests.ts +575 -0
  214. package/svelte.d.mts +17 -2
  215. package/svelte.d.ts +17 -2
  216. package/svelte.js +670 -159
  217. package/svelte.mjs +1 -1
  218. package/tanstack.d.mts +15 -2
  219. package/tanstack.d.ts +15 -2
  220. package/tanstack.js +670 -159
  221. package/tanstack.mjs +1 -1
  222. package/{types-CekOpKvz.d.ts → types-CrgK5P6p.d.mts} +372 -32
  223. package/{types-CekOpKvz.d.mts → types-CrgK5P6p.d.ts} +372 -32
@@ -1,5 +1,6 @@
1
1
  import { QstashError, PublishRequest, HTTPMethods as HTTPMethods$1, FlowControl, Client, Receiver } from '@upstash/qstash';
2
2
  import { z } from 'zod';
3
+ import { Ok, Err } from 'neverthrow';
3
4
 
4
5
  /**
5
6
  * Error raised during Workflow execution
@@ -22,6 +23,8 @@ declare class WorkflowAbort extends Error {
22
23
  }
23
24
  /**
24
25
  * Raised when the workflow is failed due to a non-retryable error
26
+ *
27
+ * @see node_modules/@upstash/workflow/docs/features/retries/prevent-retries.mdx
25
28
  */
26
29
  declare class WorkflowNonRetryableError extends WorkflowAbort {
27
30
  /**
@@ -92,6 +95,9 @@ type DispatchDebug = <K extends DebugEvent>(event: K, params: DebugEventParamete
92
95
  */
93
96
  type DispatchLifecycle<TResult = unknown> = <K extends LifeCycleEvent>(event: K, params: LifeCycleEventParameters<TResult>[K]) => Promise<void>;
94
97
 
98
+ /**
99
+ * @see node_modules/@upstash/workflow/docs/howto/middlewares.mdx
100
+ */
95
101
  declare class WorkflowMiddleware<TInitialPayload = unknown, TResult = unknown> {
96
102
  readonly name: string;
97
103
  private initCallbacks?;
@@ -170,7 +176,14 @@ type HeadersResponse = {
170
176
  type StepParams = {
171
177
  context: WorkflowContext;
172
178
  } & Pick<HeaderParams, "telemetry"> & Required<Pick<HeaderParams, "step" | "invokeCount">>;
173
- type GetHeaderParams = StepParams;
179
+ type GetHeaderParams = StepParams & {
180
+ /**
181
+ * step-level settings to apply to the message being published. Set
182
+ * when the next step has settings and this step's submission is what
183
+ * will produce the delivery that executes it.
184
+ */
185
+ stepSettings?: StepSettings;
186
+ };
174
187
  type GetBodyParams = StepParams & Omit<HeadersResponse, "contentType">;
175
188
  type SubmitStepParams = StepParams & Pick<HeadersResponse, "headers"> & {
176
189
  body: string;
@@ -188,7 +201,27 @@ declare abstract class BaseLazyStep<TResult = unknown> {
188
201
  abstract readonly stepType: StepType;
189
202
  protected abstract readonly allowUndefinedOut: boolean;
190
203
  protected readonly context: WorkflowContext;
191
- constructor(context: WorkflowContext, stepName: string);
204
+ /**
205
+ * step-level settings (flow control, retries etc.) which override the
206
+ * settings the workflow run was triggered with, for this step only.
207
+ */
208
+ readonly stepSettings?: StepSettings;
209
+ /**
210
+ * whether this step's result can be submitted after the route function
211
+ * has moved on, instead of right away.
212
+ *
213
+ * Enabled for steps whose `getResultStep` produces the final `out` —
214
+ * which is not the same as "needs no server round trip":
215
+ * `LazyCreateWebhookStep` builds its result in `getBody` and returns
216
+ * `out: undefined` from `getResultStep`, so deferring it would hand
217
+ * `undefined` to the route function.
218
+ *
219
+ * Deferring lets the route function continue and reveal the next step,
220
+ * so that step's settings can ride on this step's submission instead
221
+ * of needing a step config request of their own.
222
+ */
223
+ readonly supportsDeferredSubmission: boolean;
224
+ constructor(context: WorkflowContext, stepName: string, stepSettings?: StepSettings);
192
225
  /**
193
226
  * plan step to submit when step will run parallel with other
194
227
  * steps (parallel call state `first`)
@@ -219,7 +252,7 @@ declare abstract class BaseLazyStep<TResult = unknown> {
219
252
  protected handleUndefinedOut(step: Step): TResult;
220
253
  protected static tryParsing(stepOut: unknown): any;
221
254
  getBody({ step }: GetBodyParams): string;
222
- getHeaders({ context, telemetry, invokeCount, step }: GetHeaderParams): HeadersResponse;
255
+ getHeaders({ context, telemetry, invokeCount, step, stepSettings, }: GetHeaderParams): HeadersResponse;
223
256
  submitStep({ context, body, headers }: SubmitStepParams): Promise<{
224
257
  messageId: string;
225
258
  }[]>;
@@ -236,6 +269,63 @@ type WaitForWebhookResponse = {
236
269
  request: undefined;
237
270
  };
238
271
 
272
+ /**
273
+ * The configuration QStash applied to the delivery in hand.
274
+ *
275
+ * Reported on every delivery through the `Upstash-Flow-Control-*`,
276
+ * `Upstash-Retries` and `Upstash-Retry-Delay` headers. For an ordinary delivery this is the configuration the run was triggered with; for a
277
+ * step-configured delivery it is that step's own configuration, which
278
+ * delivery is meant to execute.
279
+ */
280
+ type EffectiveConfig = {
281
+ /**
282
+ * flow control applied to this delivery, if any
283
+ */
284
+ flowControl?: NormalizedFlowControl;
285
+ /**
286
+ * retry limit of this delivery, or undefined when QStash did not
287
+ * report one (a version which predates the header)
288
+ */
289
+ retries?: number;
290
+ /**
291
+ * retry delay expression applied to this delivery, if any
292
+ */
293
+ retryDelay?: string;
294
+ /**
295
+ * whether the message of this delivery was published with step-level
296
+ * settings (the guard marker).
297
+ */
298
+ hasStepConfig: boolean;
299
+ };
300
+ /**
301
+ * Flow control reduced to a form both sides of the protocol agree on.
302
+ *
303
+ * Needed because the SDK and QStash format the same values differently:
304
+ * the SDK joins the control value with ", " and writes durations
305
+ * (`period=1m`), QStash joins with "," and writes whole seconds
306
+ * (`period=60`). `rate` and `ratePerSecond` are aliases on the SDK side.
307
+ * Comparing the header strings would report a mismatch for values which
308
+ * are in fact identical, so both sides are parsed into this shape first.
309
+ */
310
+ type NormalizedFlowControl = {
311
+ key: string;
312
+ parallelism: number;
313
+ rate: number;
314
+ /**
315
+ * period in whole seconds
316
+ */
317
+ period: number;
318
+ };
319
+
320
+ /**
321
+ * What came of submitting the step being held, if one was.
322
+ */
323
+ type PendingStepOutcome = {
324
+ result: "submitted-step";
325
+ abort: WorkflowAbort;
326
+ } | {
327
+ result: "no-pending-step";
328
+ };
239
329
  declare class AutoExecutor {
240
330
  private context;
241
331
  private promises;
@@ -250,6 +340,25 @@ declare class AutoExecutor {
250
340
  stepCount: number;
251
341
  planStepCount: number;
252
342
  protected executingStep: string | false;
343
+ /**
344
+ * an executed step whose result hasn't been submitted to QStash yet.
345
+ *
346
+ * Set when a step which can produce its result in-process executes. The
347
+ * submission waits so that the route function can continue and reveal
348
+ * what comes next: if that is a single step with step-level settings,
349
+ * the settings ride on this submission and no step config request is
350
+ * needed, since the delivery of the submission is what executes it.
351
+ *
352
+ * Flushed when the next step is reached (see `addStep`) or when the
353
+ * route function ends (see `flushPendingStep` in `serve`).
354
+ */
355
+ private pendingStep?;
356
+ /**
357
+ * configuration QStash applied to the delivery being handled. A step
358
+ * with step-level settings is settled by comparing its settings against
359
+ * this.
360
+ */
361
+ private readonly effectiveConfig;
253
362
  /**
254
363
  * @param context workflow context
255
364
  * @param steps list of steps
@@ -257,8 +366,10 @@ declare class AutoExecutor {
257
366
  * @param dispatchLifecycle lifecycle event dispatcher
258
367
  * @param telemetry optional telemetry information
259
368
  * @param invokeCount optional invoke count
369
+ * @param effectiveConfig configuration QStash applied to the delivery
370
+ * being handled
260
371
  */
261
- constructor(context: WorkflowContext, steps: Step[], dispatchDebug: DispatchDebug, dispatchLifecycle: DispatchLifecycle, telemetry?: Telemetry, invokeCount?: number);
372
+ constructor(context: WorkflowContext, steps: Step[], dispatchDebug: DispatchDebug, dispatchLifecycle: DispatchLifecycle, telemetry?: Telemetry, invokeCount?: number, effectiveConfig?: EffectiveConfig);
262
373
  /**
263
374
  * Adds the step function to the list of step functions to run in
264
375
  * parallel. After adding the function, defers the execution, so
@@ -300,6 +411,31 @@ declare class AutoExecutor {
300
411
  * @returns step result
301
412
  */
302
413
  protected runSingle<TResult>(lazyStep: BaseLazyStep<TResult>): Promise<TResult>;
414
+ /**
415
+ * Submits the result of the step being held, if there is one, and
416
+ * returns the abort the caller has to throw to end the invocation.
417
+ *
418
+ * Returns undefined when no step is being held, which is the caller's
419
+ * signal that there is nothing to end. Throws instead of returning
420
+ * when the submission itself fails, so that error reaches the caller
421
+ * rather than an abort claiming the step was submitted.
422
+ *
423
+ * Callers which arrive while a submission is already under way (the
424
+ * steps of a parallel group, added together) wait for that one and get
425
+ * the same abort, rather than submitting a second time.
426
+ *
427
+ * The next step's settings are attached whenever it has any, without
428
+ * checking them against the current delivery: the executor only knows
429
+ * the configuration of the delivery in hand, which inside a
430
+ * delivery is the *previous* step's, so such a check would be wrong
431
+ * exactly when two steps with settings follow each other.
432
+ *
433
+ * @param nextStepSettings step-level settings of the next step
434
+ * @returns `submitted-step` with the abort which ends this invocation,
435
+ * or `no-pending-step` when nothing was held and there is nothing to
436
+ * end
437
+ */
438
+ submitPendingStep(nextStepSettings?: StepSettings): Promise<Ok<PendingStepOutcome, never> | Err<never, Error>>;
303
439
  /**
304
440
  * Runs steps in parallel.
305
441
  *
@@ -448,6 +584,11 @@ type ChatCompletion$1 = {
448
584
  usage: unknown;
449
585
  };
450
586
  declare class AnthropicAPI extends BaseWorkflowApi {
587
+ /**
588
+ * Runs as a `context.call` step, so the `context.call` caveats apply.
589
+ *
590
+ * @see node_modules/@upstash/workflow/docs/integrations/anthropic.mdx
591
+ */
451
592
  call<TResult = ChatCompletion$1, TBody = CreateChatCompletion$1>(stepName: string, settings: ApiCallSettings<TBody, {
452
593
  token: string;
453
594
  operation: "messages.create";
@@ -532,6 +673,11 @@ type ChatCompletionChoice = {
532
673
  };
533
674
  };
534
675
  declare class OpenAIAPI extends BaseWorkflowApi {
676
+ /**
677
+ * Runs as a `context.call` step, so the `context.call` caveats apply.
678
+ *
679
+ * @see node_modules/@upstash/workflow/docs/integrations/openai.mdx
680
+ */
535
681
  call<TResult = ChatCompletion, TBody = CreateChatCompletion>(stepName: string, settings: ApiCallSettings<TBody, {
536
682
  token: string;
537
683
  organization?: string;
@@ -565,6 +711,11 @@ type SendBatchEmailResponse = {
565
711
  data: SendEmailResponse[];
566
712
  };
567
713
  declare class ResendAPI extends BaseWorkflowApi {
714
+ /**
715
+ * Runs as a `context.call` step, so the `context.call` caveats apply.
716
+ *
717
+ * @see node_modules/@upstash/workflow/docs/integrations/resend.mdx
718
+ */
568
719
  call<TBatch extends boolean = false, TResult = TBatch extends true ? SendBatchEmailResponse : SendEmailResponse, TBody = TBatch extends true ? SendBatchEmail : SendEmail>(stepName: string, settings: ApiCallSettings<TBody, {
569
720
  token: string;
570
721
  batch?: TBatch;
@@ -581,6 +732,16 @@ declare class WorkflowApi extends BaseWorkflowApi {
581
732
  * Upstash Workflow context
582
733
  *
583
734
  * See the docs for fields and methods https://upstash.com/docs/qstash/workflows/basics/context
735
+ *
736
+ * Code outside steps runs again on every request of the run. Anything it branches on or
737
+ * returns early on (Date.now(), database rows, random values) must give the same answer on
738
+ * every request, or later requests fail with "Incompatible step name" or "Failed to
739
+ * authenticate Workflow request". Read such values inside `context.run` and branch on its
740
+ * result.
741
+ *
742
+ * @see node_modules/@upstash/workflow/docs/steps.mdx
743
+ * @see node_modules/@upstash/workflow/docs/basics/best-practices/deterministic-code.mdx
744
+ * @see node_modules/@upstash/workflow/docs/basics/best-practices/business-logic-in-steps.mdx
584
745
  */
585
746
  declare class WorkflowContext<TInitialPayload = unknown> {
586
747
  protected readonly executor: AutoExecutor;
@@ -592,8 +753,9 @@ declare class WorkflowContext<TInitialPayload = unknown> {
592
753
  *
593
754
  * ```ts
594
755
  * import { Client } from "@upstash/qstash"
756
+ * import { serve } from "@upstash/workflow/nextjs"
595
757
  *
596
- * export const POST = serve(
758
+ * export const { POST } = serve(
597
759
  * async (context) => {
598
760
  * ...
599
761
  * },
@@ -618,7 +780,7 @@ declare class WorkflowContext<TInitialPayload = unknown> {
618
780
  * Can be overwritten by passing a `url` parameter in `serve`:
619
781
  *
620
782
  * ```ts
621
- * export const POST = serve(
783
+ * export const { POST } = serve(
622
784
  * async (context) => {
623
785
  * ...
624
786
  * },
@@ -636,7 +798,7 @@ declare class WorkflowContext<TInitialPayload = unknown> {
636
798
  *
637
799
  * ```ts
638
800
  * // set requestPayload type to MyPayload:
639
- * export const POST = serve<MyPayload>(
801
+ * export const { POST } = serve<MyPayload>(
640
802
  * async (context) => {
641
803
  * ...
642
804
  * }
@@ -648,7 +810,7 @@ declare class WorkflowContext<TInitialPayload = unknown> {
648
810
  * the `initialPayloadParser` parameter:
649
811
  *
650
812
  * ```ts
651
- * export const POST = serve<MyPayload>(
813
+ * export const { POST } = serve<MyPayload>(
652
814
  * async (context) => {
653
815
  * ...
654
816
  * },
@@ -657,6 +819,13 @@ declare class WorkflowContext<TInitialPayload = unknown> {
657
819
  * }
658
820
  * )
659
821
  * ```
822
+ *
823
+ * When a `context.call` response comes back, the route runs up to its first step with this
824
+ * set to the call-result envelope (and `workflowRunId` set to a random id) before the SDK
825
+ * recognizes the request. Code before the first step must not dereference, validate or
826
+ * return early on the payload; read it inside `context.run`.
827
+ *
828
+ * @see node_modules/@upstash/workflow/docs/basics/serve/advanced.mdx
660
829
  */
661
830
  readonly requestPayload: TInitialPayload;
662
831
  /**
@@ -669,7 +838,7 @@ declare class WorkflowContext<TInitialPayload = unknown> {
669
838
  * Can be set using the `env` option of serve:
670
839
  *
671
840
  * ```ts
672
- * export const POST = serve<MyPayload>(
841
+ * export const { POST } = serve<MyPayload>(
673
842
  * async (context) => {
674
843
  * const key = context.env["API_KEY"];
675
844
  * },
@@ -715,7 +884,41 @@ declare class WorkflowContext<TInitialPayload = unknown> {
715
884
  * `1` on the first retry, `2` on the second, and so on.
716
885
  */
717
886
  readonly retried: number;
718
- constructor({ qstashClient, workflowRunId, workflowRunCreatedAt, headers, steps, url, initialPayload, env, telemetry, invokeCount, label, retried, middlewareManager, }: {
887
+ /**
888
+ * Configuration QStash applied to the request being handled.
889
+ *
890
+ * This is the configuration of *this delivery*, not of the run: it is
891
+ * the configuration the run was triggered with, except inside the
892
+ * delivery which executes a step that has step-level settings, where
893
+ * it is that step's settings. The fields below expose it; the executor
894
+ * gets it directly rather than reaching through the context.
895
+ */
896
+ private readonly effectiveConfig;
897
+ /**
898
+ * Flow control QStash applied to the request being handled, if any.
899
+ *
900
+ * This is the flow control of the request in hand, which is the one the
901
+ * run was triggered with except inside a step carrying its own.
902
+ */
903
+ get flowControl(): NormalizedFlowControl | undefined;
904
+ /**
905
+ * Retry limit QStash applied to the request being handled, if it
906
+ * reported one.
907
+ *
908
+ * Not to be confused with {@link retried}, which is how many retries
909
+ * have already happened.
910
+ *
911
+ * @see {@link flowControl} for what "the request being handled" means
912
+ */
913
+ get retries(): number | undefined;
914
+ /**
915
+ * Retry delay expression QStash applied to the request being handled,
916
+ * if any.
917
+ *
918
+ * @see {@link flowControl} for what "the request being handled" means
919
+ */
920
+ get retryDelay(): string | undefined;
921
+ constructor({ qstashClient, workflowRunId, workflowRunCreatedAt, headers, steps, url, initialPayload, env, telemetry, invokeCount, label, retried, middlewareManager, effectiveConfig, }: {
719
922
  qstashClient: WorkflowClient;
720
923
  workflowRunId: string;
721
924
  workflowRunCreatedAt: number;
@@ -729,6 +932,12 @@ declare class WorkflowContext<TInitialPayload = unknown> {
729
932
  label?: string | string[];
730
933
  retried?: number;
731
934
  middlewareManager?: MiddlewareManager<TInitialPayload>;
935
+ /**
936
+ * configuration QStash applied to the delivery being handled, read
937
+ * from its headers. Defaults to no flow control and no retries,
938
+ * which is what a context created outside a delivery observes.
939
+ */
940
+ effectiveConfig?: EffectiveConfig;
732
941
  });
733
942
  /**
734
943
  * Executes a workflow step
@@ -753,11 +962,33 @@ declare class WorkflowContext<TInitialPayload = unknown> {
753
962
  * ])
754
963
  * ```
755
964
  *
965
+ * Step-level settings can be passed as a third argument, overriding
966
+ * the settings the workflow run was triggered with for this step only:
967
+ *
968
+ * ```typescript
969
+ * const result = await context.run(
970
+ * "step 1",
971
+ * () => {
972
+ * return "result"
973
+ * },
974
+ * {
975
+ * flowControl: { key: "custom-key", parallelism: 3 },
976
+ * retries: 5,
977
+ * }
978
+ * )
979
+ * ```
980
+ *
981
+ * Do not wrap steps in try/catch or `.catch` without rethrowing `WorkflowAbort`: each step
982
+ * throws it to end the request. To stop retrying a failed step, throw
983
+ * `WorkflowNonRetryableError`.
984
+ *
756
985
  * @param stepName name of the step
757
986
  * @param stepFunction step function to be executed
987
+ * @param stepSettings step-level settings for this step
758
988
  * @returns result of the step function
989
+ * @see node_modules/@upstash/workflow/docs/steps/run.mdx
759
990
  */
760
- run<TResult>(stepName: string, stepFunction: StepFunction<TResult>): Promise<TResult>;
991
+ run<TResult>(stepName: string, stepFunction: StepFunction<TResult>, stepSettings?: StepSettings): Promise<TResult>;
761
992
  /**
762
993
  * Stops the execution for the duration provided.
763
994
  *
@@ -766,8 +997,9 @@ declare class WorkflowContext<TInitialPayload = unknown> {
766
997
  * ```
767
998
  *
768
999
  * @param stepName
769
- * @param duration sleep duration in seconds
1000
+ * @param duration sleep duration in seconds, or a duration string such as "10m"
770
1001
  * @returns undefined
1002
+ * @see node_modules/@upstash/workflow/docs/steps/sleep.mdx
771
1003
  */
772
1004
  sleep(stepName: string, duration: number | Duration): Promise<void>;
773
1005
  /**
@@ -779,8 +1011,11 @@ declare class WorkflowContext<TInitialPayload = unknown> {
779
1011
  *
780
1012
  * @param stepName
781
1013
  * @param datetime time to sleep until. Can be provided as a number (in unix seconds),
782
- * as a Date object or a string (passed to `new Date(datetimeString)`)
1014
+ * as a Date object or a string (passed to `new Date(datetimeString)`).
1015
+ * A millisecond timestamp such as `Date.now()` is too far in the future, so QStash
1016
+ * rejects the step and the run fails. Pass `new Date(ms)` instead.
783
1017
  * @returns undefined
1018
+ * @see node_modules/@upstash/workflow/docs/steps/sleepUntil.mdx
784
1019
  */
785
1020
  sleepUntil(stepName: string, datetime: Date | string | number): Promise<void>;
786
1021
  /**
@@ -800,7 +1035,17 @@ declare class WorkflowContext<TInitialPayload = unknown> {
800
1035
  *
801
1036
  * tries to parse the result of the request as JSON. If it's
802
1037
  * not a JSON which can be parsed, simply returns the response
803
- * body as it is.
1038
+ * body as it is. This applies to text/plain too: "42" comes back as the number 42,
1039
+ * "3.10" as 3.1 and "null" as null. To keep text exact, use fetch inside `context.run`.
1040
+ *
1041
+ * The response comes back to this endpoint as a separate request. Before the SDK
1042
+ * recognizes it, your route runs up to its first step with `requestPayload` set to the
1043
+ * call-result envelope and a random `workflowRunId`. Code before the first step must not
1044
+ * dereference, validate or return early on the payload, or look anything up by
1045
+ * `workflowRunId`; do that inside `context.run`.
1046
+ *
1047
+ * Do not wrap steps in try/catch or `.catch` without rethrowing `WorkflowAbort`: each step
1048
+ * throws it to end the request. A non-2xx response is returned, not thrown; check `status`.
804
1049
  *
805
1050
  * @param stepName
806
1051
  * @param url url to call
@@ -809,12 +1054,14 @@ declare class WorkflowContext<TInitialPayload = unknown> {
809
1054
  * @param headers call headers
810
1055
  * @param retries number of call retries. 0 by default
811
1056
  * @param retryDelay delay / time gap between retries.
812
- * @param timeout max duration to wait for the endpoint to respond. in seconds.
1057
+ * @param timeout max duration to wait for the endpoint to respond, as a duration string
1058
+ * such as "10s". See `CallSettings.timeout`.
813
1059
  * @returns call result as {
814
1060
  * status: number;
815
1061
  * body: unknown;
816
1062
  * header: Record<string, string[]>
817
1063
  * }
1064
+ * @see node_modules/@upstash/workflow/docs/steps/call.mdx
818
1065
  */
819
1066
  call<TResult = unknown>(stepName: string, settings: CallSettings): Promise<CallResponse<TResult>>;
820
1067
  call<TResult extends {
@@ -826,7 +1073,7 @@ declare class WorkflowContext<TInitialPayload = unknown> {
826
1073
  * Pauses workflow execution until a specific event occurs or a timeout is reached.
827
1074
  *
828
1075
  *```ts
829
- * const result = await workflow.waitForEvent("payment-confirmed", "payment.confirmed", {
1076
+ * const result = await context.waitForEvent("payment-confirmed", "payment.confirmed", {
830
1077
  * timeout: "5m"
831
1078
  * });
832
1079
  *```
@@ -850,11 +1097,14 @@ declare class WorkflowContext<TInitialPayload = unknown> {
850
1097
  * Alternatively, you can use the `context.notify` method.
851
1098
  *
852
1099
  * @param stepName
853
- * @param eventId - Unique identifier for the event to wait for
1100
+ * @param eventId - Unique identifier for the event to wait for. Only letters, digits,
1101
+ * "-", "_" and "." are allowed. QStash rejects other characters, such as ":", which
1102
+ * stops the run with only a "Tried to append to a cancelled workflow" warning.
854
1103
  * @param options - Configuration options.
855
1104
  * @returns `{ timeout: boolean, eventData: TEventData }`.
856
1105
  * The `timeout` property specifies if the workflow has timed out. The `eventData`
857
1106
  * is the data passed when notifying this workflow of an event.
1107
+ * @see node_modules/@upstash/workflow/docs/steps/waitForEvent.mdx
858
1108
  */
859
1109
  waitForEvent<TEventData = unknown>(stepName: string, eventId: string, options?: WaitEventOptions): Promise<WaitStepResponse<TEventData>>;
860
1110
  /**
@@ -870,32 +1120,43 @@ declare class WorkflowContext<TInitialPayload = unknown> {
870
1120
  * will receive the given event data and resume execution.
871
1121
  *
872
1122
  * The response includes the same eventId and eventData. Additionally, there is
873
- * a notifyResponse field which contains a list of `Waiter` objects, each corresponding
874
- * to a notified workflow run.
875
- *
876
- * Optionally, you can pass a workflowRunId to enable lookback functionality:
877
- *
878
- * ```ts
879
- * const { eventId, eventData, notifyResponse } = await context.notify(
880
- * "notify step", "event-id", "event-data", "wfr_123"
881
- * );
882
- * ```
1123
+ * a notifyResponse field which contains a list of `NotifyResponse` objects, each corresponding
1124
+ * to a notified workflow run. The notified `Waiter` is under `notifyResponse[i].waiter`.
883
1125
  *
884
1126
  * @param stepName
885
- * @param eventId event id to notify
1127
+ * @param eventId event id to notify. Only letters, digits, "-", "_" and "." are allowed.
1128
+ * QStash rejects other characters, such as ":", which stops the run with only a
1129
+ * "Tried to append to a cancelled workflow" warning.
886
1130
  * @param eventData event data to notify with
887
- * @param workflowRunId optional workflow run id for lookback support
888
- * @returns notify response which has event id, event data and list of waiters which were notified
1131
+ * @param workflowRunId optional workflow run id for lookback: the event is kept for the run
1132
+ * even if it has not reached `waitForEvent` yet
1133
+ * @returns notify response which has event id, event data and list of waiters which were
1134
+ * notified. With `workflowRunId`, QStash returns `notifyResponse` as a single object instead
1135
+ * of an array, despite the type.
1136
+ * @see node_modules/@upstash/workflow/docs/steps/notify.mdx
889
1137
  */
890
1138
  notify(stepName: string, eventId: string, eventData: unknown, workflowRunId?: string): Promise<NotifyStepResponse>;
1139
+ /**
1140
+ * Starts another workflow run and waits for its result.
1141
+ *
1142
+ * @see node_modules/@upstash/workflow/docs/steps/invoke.mdx
1143
+ */
891
1144
  invoke<TInitialPayload, TResult>(stepName: string, settings: LazyInvokeStepParams<TInitialPayload, TResult>): Promise<InvokeStepResponse<TResult>>;
1145
+ /**
1146
+ * @see node_modules/@upstash/workflow/docs/steps/createWebhook.mdx
1147
+ */
892
1148
  createWebhook(stepName: string): Promise<Webhook>;
1149
+ /**
1150
+ * @see node_modules/@upstash/workflow/docs/steps/waitForWebhook.mdx
1151
+ */
893
1152
  waitForWebhook(stepName: string, webhook: Webhook, timeout: Duration): Promise<WaitForWebhookResponse>;
894
1153
  /**
895
1154
  * Cancel the current workflow run
896
1155
  *
897
1156
  * Will throw WorkflowCancelAbort to stop workflow execution.
898
1157
  * Shouldn't be inside try/catch.
1158
+ *
1159
+ * @see node_modules/@upstash/workflow/docs/steps/cancel.mdx
899
1160
  */
900
1161
  cancel(): Promise<void>;
901
1162
  /**
@@ -903,6 +1164,11 @@ declare class WorkflowContext<TInitialPayload = unknown> {
903
1164
  * DisabledWorkflowContext.
904
1165
  */
905
1166
  protected addStep<TResult = unknown>(step: BaseLazyStep<TResult>): Promise<TResult>;
1167
+ /**
1168
+ * Calls OpenAI, Anthropic or Resend through QStash, like `context.call`.
1169
+ *
1170
+ * @see node_modules/@upstash/workflow/docs/steps/api.mdx
1171
+ */
906
1172
  get api(): WorkflowApi;
907
1173
  }
908
1174
 
@@ -1003,7 +1269,7 @@ type Step<TResult = unknown, TBody = unknown> = {
1003
1269
  type RawStep = {
1004
1270
  messageId: string;
1005
1271
  body: string;
1006
- callType: "step" | "toCallback" | "fromCallback";
1272
+ callType: "step" | "toCallback" | "fromCallback" | "stepConfig";
1007
1273
  };
1008
1274
  type SyncStepFunction<TResult> = () => TResult;
1009
1275
  type AsyncStepFunction<TResult> = () => Promise<TResult>;
@@ -1026,6 +1292,11 @@ type DetailedFinishCondition = {
1026
1292
  };
1027
1293
  type WorkflowContextWithoutMethods<TInitialPayload> = Omit<WorkflowContext<TInitialPayload>, "run" | "sleepUntil" | "sleep" | "call" | "waitForEvent" | "notify" | "cancel" | "api" | "invoke" | "createWebhook" | "waitForWebhook">;
1028
1294
  type QStashClientExtraConfig = Omit<NonNullable<ConstructorParameters<typeof Client>[0]>, "baseUrl" | "token">;
1295
+ /**
1296
+ * Options of `serve`.
1297
+ *
1298
+ * @see node_modules/@upstash/workflow/docs/basics/serve/advanced.mdx
1299
+ */
1029
1300
  type WorkflowServeOptions<TInitialPayload = unknown, TResult = unknown> = {
1030
1301
  /**
1031
1302
  * QStash client or client configuration
@@ -1056,6 +1327,7 @@ type WorkflowServeOptions<TInitialPayload = unknown, TResult = unknown> = {
1056
1327
  * @param failStatus error status
1057
1328
  * @param failResponse error message
1058
1329
  * @returns void
1330
+ * @see node_modules/@upstash/workflow/docs/features/failure-callback.mdx
1059
1331
  */
1060
1332
  failureFunction?: (failureData: {
1061
1333
  context: WorkflowContextWithoutMethods<TInitialPayload>;
@@ -1094,6 +1366,8 @@ type WorkflowServeOptions<TInitialPayload = unknown, TResult = unknown> = {
1094
1366
  disableTelemetry?: boolean;
1095
1367
  /**
1096
1368
  * List of workflow middlewares to use
1369
+ *
1370
+ * @see node_modules/@upstash/workflow/docs/howto/middlewares.mdx
1097
1371
  */
1098
1372
  middlewares?: WorkflowMiddleware<TInitialPayload, TResult>[];
1099
1373
  /**
@@ -1206,6 +1480,9 @@ type CallResponse<TResult = unknown> = {
1206
1480
  * @example "1d" // 1 day
1207
1481
  */
1208
1482
  type Duration = `${bigint}${"s" | "m" | "h" | "d"}`;
1483
+ /**
1484
+ * @see node_modules/@upstash/workflow/docs/steps/waitForEvent.mdx
1485
+ */
1209
1486
  interface WaitEventOptions {
1210
1487
  /**
1211
1488
  * Duration in seconds to wait for an event before timing out the workflow.
@@ -1215,6 +1492,63 @@ interface WaitEventOptions {
1215
1492
  */
1216
1493
  timeout?: number | Duration;
1217
1494
  }
1495
+ /**
1496
+ * Step-level settings which override the workflow run settings
1497
+ * passed in `client.trigger` for the execution of a single step.
1498
+ *
1499
+ * Passed as the third argument of `context.run`:
1500
+ *
1501
+ * ```ts
1502
+ * const result = await context.run(
1503
+ * "step",
1504
+ * () => { ... },
1505
+ * { flowControl: { key: "custom-key", parallelism: 3 }, retries: 5 }
1506
+ * );
1507
+ * ```
1508
+ *
1509
+ * The settings must be applied to the request whose delivery executes
1510
+ * the step:
1511
+ *
1512
+ * - a step running in parallel with others carries its settings on its
1513
+ * own plan step, whose delivery is what executes the step. No extra
1514
+ * request is made.
1515
+ * - otherwise, the SDK can only learn about the step once the workflow
1516
+ * function has been replayed, which happens in a delivery that was
1517
+ * published before the step was known. So instead of executing the
1518
+ * step in that delivery, a hidden request carrying the
1519
+ * settings is published and the step executes when QStash delivers it.
1520
+ * This costs one extra message and one extra endpoint invocation per
1521
+ * step which carries settings. QStash hides the request from the
1522
+ * step logs.
1523
+ */
1524
+ type StepSettings = {
1525
+ /**
1526
+ * Settings for controlling the number of active requests
1527
+ * and number of requests per second with the same key
1528
+ * while executing this step.
1529
+ *
1530
+ * Overrides the flow control settings passed when triggering
1531
+ * the workflow for this step only.
1532
+ */
1533
+ flowControl?: FlowControl;
1534
+ /**
1535
+ * Number of times QStash will retry the delivery which executes
1536
+ * this step.
1537
+ *
1538
+ * Overrides the retries passed when triggering the workflow for
1539
+ * this step only.
1540
+ */
1541
+ retries?: number;
1542
+ /**
1543
+ * Delay between retries of the delivery which executes this step.
1544
+ * Leading and trailing whitespace is trimmed. An empty or whitespace-only
1545
+ * string leaves the workflow run's retry delay unchanged.
1546
+ */
1547
+ retryDelay?: string;
1548
+ };
1549
+ /**
1550
+ * @see node_modules/@upstash/workflow/docs/steps/call.mdx
1551
+ */
1218
1552
  type CallSettings = {
1219
1553
  url: string;
1220
1554
  method?: HTTPMethods$1;
@@ -1222,6 +1556,12 @@ type CallSettings = {
1222
1556
  headers?: Record<string, string>;
1223
1557
  retries?: number;
1224
1558
  retryDelay?: string;
1559
+ /**
1560
+ * Max time to wait for the endpoint to respond. Pass a duration string such as "10s".
1561
+ * A number is sent without a unit and QStash rejects the step ("missing unit in
1562
+ * duration"), which stops the run with only a "Tried to append to a cancelled workflow"
1563
+ * warning.
1564
+ */
1225
1565
  timeout?: Duration | number;
1226
1566
  flowControl?: FlowControl;
1227
1567
  };
@@ -1342,4 +1682,4 @@ type InvokableWorkflow<TInitialPayload, TResult> = {
1342
1682
  useJSONContent?: boolean;
1343
1683
  };
1344
1684
 
1345
- export { type AsyncStepFunction as A, type CallResponse as C, type DetailedFinishCondition as D, type ExclusiveValidationOptions as E, type FailureFunctionPayload as F, type HeaderParams as H, type InvokableWorkflow as I, type LazyInvokeStepParams as L, type NotifyResponse as N, type ParallelCallState as P, type QStashClientExtraConfig as Q, type RawStep as R, type StepType as S, type Telemetry as T, WorkflowMiddleware as W, type WorkflowClient as a, type WorkflowReceiver as b, type RouteFunction as c, type WorkflowServeOptions as d, type Waiter as e, type CallSettings as f, type Duration as g, type FinishCondition as h, type InvokeStepResponse as i, type InvokeWorkflowRequest as j, type NotifyStepResponse as k, type RequiredExceptFields as l, type Step as m, type StepFunction as n, StepTypes as o, type SyncStepFunction as p, type WaitEventOptions as q, type WaitRequest as r, type WaitStepResponse as s, WorkflowAbort as t, WorkflowContext as u, WorkflowError as v, WorkflowNonRetryableError as w, WorkflowRetryAfterError as x };
1685
+ export { type AsyncStepFunction as A, type CallResponse as C, type DetailedFinishCondition as D, type ExclusiveValidationOptions as E, type FailureFunctionPayload as F, type HeaderParams as H, type InvokableWorkflow as I, type LazyInvokeStepParams as L, type NotifyResponse as N, type ParallelCallState as P, type QStashClientExtraConfig as Q, type RawStep as R, type StepType as S, type Telemetry as T, WorkflowMiddleware as W, type WorkflowClient as a, type WorkflowReceiver as b, type RouteFunction as c, type WorkflowServeOptions as d, type Waiter as e, type CallSettings as f, type Duration as g, type FinishCondition as h, type InvokeStepResponse as i, type InvokeWorkflowRequest as j, type NotifyStepResponse as k, type RequiredExceptFields as l, type Step as m, type StepFunction as n, type StepSettings as o, StepTypes as p, type SyncStepFunction as q, type WaitEventOptions as r, type WaitRequest as s, type WaitStepResponse as t, WorkflowAbort as u, WorkflowContext as v, WorkflowError as w, WorkflowNonRetryableError as x, WorkflowRetryAfterError as y };