@upstash/workflow 1.3.3 → 1.4.0-rc

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 (50) hide show
  1. package/astro.d.mts +3 -2
  2. package/astro.d.ts +3 -2
  3. package/astro.js +587 -139
  4. package/astro.mjs +3 -1
  5. package/{chunk-WEQGCISK.mjs → chunk-UH6O5IJY.mjs} +749 -301
  6. package/cloudflare.d.mts +3 -2
  7. package/cloudflare.d.ts +3 -2
  8. package/cloudflare.js +587 -139
  9. package/cloudflare.mjs +3 -1
  10. package/express.d.mts +3 -2
  11. package/express.d.ts +3 -2
  12. package/express.js +588 -139
  13. package/express.mjs +4 -1
  14. package/h3.d.mts +3 -2
  15. package/h3.d.ts +3 -2
  16. package/h3.js +587 -139
  17. package/h3.mjs +3 -1
  18. package/hono.d.mts +3 -2
  19. package/hono.d.ts +3 -2
  20. package/hono.js +587 -139
  21. package/hono.mjs +3 -1
  22. package/index.d.mts +25 -6
  23. package/index.d.ts +25 -6
  24. package/index.js +610 -141
  25. package/index.mjs +26 -3
  26. package/nextjs.d.mts +3 -2
  27. package/nextjs.d.ts +3 -2
  28. package/nextjs.js +588 -139
  29. package/nextjs.mjs +4 -1
  30. package/package.json +1 -1
  31. package/react-router.d.mts +3 -2
  32. package/react-router.d.ts +3 -2
  33. package/react-router.js +587 -139
  34. package/react-router.mjs +3 -1
  35. package/{serve-many-iJF1IUXk.d.ts → serve-many-BCtZg31b.d.ts} +1 -1
  36. package/{serve-many-CG3BFvO3.d.mts → serve-many-CbIV7145.d.mts} +1 -1
  37. package/solidjs.d.mts +2 -1
  38. package/solidjs.d.ts +2 -1
  39. package/solidjs.js +587 -139
  40. package/solidjs.mjs +3 -1
  41. package/svelte.d.mts +3 -2
  42. package/svelte.d.ts +3 -2
  43. package/svelte.js +587 -139
  44. package/svelte.mjs +3 -1
  45. package/tanstack.d.mts +3 -2
  46. package/tanstack.d.ts +3 -2
  47. package/tanstack.js +587 -139
  48. package/tanstack.mjs +3 -1
  49. package/{types-CekOpKvz.d.ts → types-ffLPVG5_.d.mts} +248 -8
  50. package/{types-CekOpKvz.d.mts → types-ffLPVG5_.d.ts} +248 -8
package/hono.mjs CHANGED
@@ -2,14 +2,16 @@ import {
2
2
  SDK_TELEMETRY,
3
3
  serveBase,
4
4
  serveManyBase
5
- } from "./chunk-WEQGCISK.mjs";
5
+ } from "./chunk-UH6O5IJY.mjs";
6
6
 
7
7
  // platforms/hono.ts
8
+ import { startDevServer } from "@upstash/qstash";
8
9
  var telemetry = {
9
10
  sdk: SDK_TELEMETRY,
10
11
  framework: "hono"
11
12
  };
12
13
  var serve = (routeFunction, options) => {
14
+ void startDevServer();
13
15
  const handler = async (context) => {
14
16
  const environment = context.env ? context.env : typeof process === "undefined" ? {} : process.env;
15
17
  const request = context.req.raw;
package/index.d.mts CHANGED
@@ -1,7 +1,8 @@
1
- import { S as StepType, R as RawStep, W as WorkflowMiddleware, a as WorkflowClient, b as WorkflowReceiver, c as RouteFunction, d as WorkflowServeOptions, T as Telemetry, N as NotifyResponse, e as Waiter } from './types-CekOpKvz.mjs';
2
- export { A as AsyncStepFunction, C as CallResponse, f as CallSettings, D as DetailedFinishCondition, g as Duration, E as ExclusiveValidationOptions, F as FailureFunctionPayload, h as FinishCondition, H as HeaderParams, I as InvokableWorkflow, i as InvokeStepResponse, j as InvokeWorkflowRequest, L as LazyInvokeStepParams, k as NotifyStepResponse, P as ParallelCallState, Q as QStashClientExtraConfig, l as RequiredExceptFields, m as Step, n as StepFunction, o as StepTypes, p as SyncStepFunction, q as WaitEventOptions, r as WaitRequest, s as WaitStepResponse, t as WorkflowAbort, u as WorkflowContext, v as WorkflowError, w as WorkflowNonRetryableError, x as WorkflowRetryAfterError } from './types-CekOpKvz.mjs';
1
+ import { S as StepType, R as RawStep, W as WorkflowMiddleware, a as WorkflowClient, b as WorkflowReceiver, c as RouteFunction, d as WorkflowServeOptions, T as Telemetry, N as NotifyResponse, e as Waiter } from './types-ffLPVG5_.mjs';
2
+ export { A as AsyncStepFunction, C as CallResponse, f as CallSettings, D as DetailedFinishCondition, g as Duration, E as ExclusiveValidationOptions, F as FailureFunctionPayload, h as FinishCondition, H as HeaderParams, I as InvokableWorkflow, i as InvokeStepResponse, j as InvokeWorkflowRequest, L as LazyInvokeStepParams, k as NotifyStepResponse, P as ParallelCallState, Q as QStashClientExtraConfig, l as RequiredExceptFields, m as Step, n as StepFunction, o as StepSettings, p as StepTypes, q as SyncStepFunction, r as WaitEventOptions, s as WaitRequest, t as WaitStepResponse, u as WorkflowAbort, v as WorkflowContext, w as WorkflowError, x as WorkflowNonRetryableError, y as WorkflowRetryAfterError } from './types-ffLPVG5_.mjs';
3
3
  import { FlowControl, PublishRequest, HTTPMethods, Client as Client$1 } from '@upstash/qstash';
4
4
  import 'zod';
5
+ import 'neverthrow';
5
6
 
6
7
  type BaseStepLog = {
7
8
  /**
@@ -209,6 +210,11 @@ type StepLogGroup = {
209
210
  */
210
211
  type: "next";
211
212
  };
213
+ /**
214
+ * State of the failure function (`failureUrl`/`failureFunction`) call of a
215
+ * failed workflow run.
216
+ */
217
+ type FailureFunctionState = "CALLBACK_INPROGRESS" | "CALLBACK_SUCCESS" | "CALLBACK_FAIL" | "CALLBACK_CANCELED";
212
218
  type FailureFunctionLog = {
213
219
  /**
214
220
  * messageId of the message published for handling the failure
@@ -221,7 +227,7 @@ type FailureFunctionLog = {
221
227
  /**
222
228
  * State of the message published for failure
223
229
  */
224
- state: "CALLBACK_INPROGRESS" | "CALLBACK_SUCCESS" | "CALLBACK_FAIL" | "CALLBACK_CANCELED";
230
+ state: FailureFunctionState;
225
231
  /**
226
232
  * Headers received from the step which caused the workflow to fail
227
233
  */
@@ -570,7 +576,11 @@ type WorkflowFilterFields = {
570
576
  workflowUrl?: string | string[];
571
577
  workflowRunId?: string;
572
578
  workflowCreatedAt?: number;
573
- failureFunctionState?: string;
579
+ /**
580
+ * Filter by the state of the failure function call. Supports multiple values:
581
+ * pass an array to match runs in any of the given states (OR semantics).
582
+ */
583
+ failureFunctionState?: FailureFunctionState | FailureFunctionState[];
574
584
  };
575
585
  type WorkflowLogsFilterFields = {
576
586
  state?: WorkflowRunLog["workflowState"];
@@ -680,7 +690,7 @@ type ResumeRestartOptions = {
680
690
  retries?: number;
681
691
  };
682
692
  type FailureCallbackInfo = {
683
- state?: "CALLBACK_FAIL" | "CALLBACK_SUCCESS" | "CALLBACK_INPROGRESS" | "CALLBACK_CANCELED";
693
+ state?: FailureFunctionState;
684
694
  responseStatus?: number;
685
695
  responseBody?: string;
686
696
  responseHeaders?: Record<string, string[]>;
@@ -834,6 +844,15 @@ declare class DLQ {
834
844
  retryFailureFunction({ dlqId }: Pick<DLQResumeRestartOptions<string>, "dlqId">): Promise<DLQResumeRestartResponse & {
835
845
  error?: string;
836
846
  }>;
847
+ /**
848
+ * Cancel the in-progress failure function (failureUrl/failureFunction) call
849
+ * of a workflow run.
850
+ *
851
+ * Fails if the run has no failure function call in progress.
852
+ *
853
+ * @param dlqId - The ID of the DLQ message whose failure function call will be canceled
854
+ */
855
+ cancelFailureFunction({ dlqId }: Pick<DLQResumeRestartOptions<string>, "dlqId">): Promise<void>;
837
856
  /**
838
857
  * Delete DLQ messages.
839
858
  *
@@ -1071,4 +1090,4 @@ declare class Client {
1071
1090
  get dlq(): DLQ;
1072
1091
  }
1073
1092
 
1074
- export { Client, type DLQResumeRestartOptions, type DLQResumeRestartResponse, NotifyResponse, RawStep, RouteFunction, type StepError, type StepLog, StepType, Telemetry, type TriggerOptions, Waiter, WorkflowClient, WorkflowMiddleware, WorkflowReceiver, type WorkflowRunLog, type WorkflowRunLogs, WorkflowServeOptions, loggingMiddleware, serve };
1093
+ export { Client, type DLQResumeRestartOptions, type DLQResumeRestartResponse, type FailureFunctionState, NotifyResponse, RawStep, RouteFunction, type StepError, type StepLog, StepType, Telemetry, type TriggerOptions, Waiter, WorkflowClient, WorkflowMiddleware, WorkflowReceiver, type WorkflowRunLog, type WorkflowRunLogs, WorkflowServeOptions, loggingMiddleware, serve };
package/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- import { S as StepType, R as RawStep, W as WorkflowMiddleware, a as WorkflowClient, b as WorkflowReceiver, c as RouteFunction, d as WorkflowServeOptions, T as Telemetry, N as NotifyResponse, e as Waiter } from './types-CekOpKvz.js';
2
- export { A as AsyncStepFunction, C as CallResponse, f as CallSettings, D as DetailedFinishCondition, g as Duration, E as ExclusiveValidationOptions, F as FailureFunctionPayload, h as FinishCondition, H as HeaderParams, I as InvokableWorkflow, i as InvokeStepResponse, j as InvokeWorkflowRequest, L as LazyInvokeStepParams, k as NotifyStepResponse, P as ParallelCallState, Q as QStashClientExtraConfig, l as RequiredExceptFields, m as Step, n as StepFunction, o as StepTypes, p as SyncStepFunction, q as WaitEventOptions, r as WaitRequest, s as WaitStepResponse, t as WorkflowAbort, u as WorkflowContext, v as WorkflowError, w as WorkflowNonRetryableError, x as WorkflowRetryAfterError } from './types-CekOpKvz.js';
1
+ import { S as StepType, R as RawStep, W as WorkflowMiddleware, a as WorkflowClient, b as WorkflowReceiver, c as RouteFunction, d as WorkflowServeOptions, T as Telemetry, N as NotifyResponse, e as Waiter } from './types-ffLPVG5_.js';
2
+ export { A as AsyncStepFunction, C as CallResponse, f as CallSettings, D as DetailedFinishCondition, g as Duration, E as ExclusiveValidationOptions, F as FailureFunctionPayload, h as FinishCondition, H as HeaderParams, I as InvokableWorkflow, i as InvokeStepResponse, j as InvokeWorkflowRequest, L as LazyInvokeStepParams, k as NotifyStepResponse, P as ParallelCallState, Q as QStashClientExtraConfig, l as RequiredExceptFields, m as Step, n as StepFunction, o as StepSettings, p as StepTypes, q as SyncStepFunction, r as WaitEventOptions, s as WaitRequest, t as WaitStepResponse, u as WorkflowAbort, v as WorkflowContext, w as WorkflowError, x as WorkflowNonRetryableError, y as WorkflowRetryAfterError } from './types-ffLPVG5_.js';
3
3
  import { FlowControl, PublishRequest, HTTPMethods, Client as Client$1 } from '@upstash/qstash';
4
4
  import 'zod';
5
+ import 'neverthrow';
5
6
 
6
7
  type BaseStepLog = {
7
8
  /**
@@ -209,6 +210,11 @@ type StepLogGroup = {
209
210
  */
210
211
  type: "next";
211
212
  };
213
+ /**
214
+ * State of the failure function (`failureUrl`/`failureFunction`) call of a
215
+ * failed workflow run.
216
+ */
217
+ type FailureFunctionState = "CALLBACK_INPROGRESS" | "CALLBACK_SUCCESS" | "CALLBACK_FAIL" | "CALLBACK_CANCELED";
212
218
  type FailureFunctionLog = {
213
219
  /**
214
220
  * messageId of the message published for handling the failure
@@ -221,7 +227,7 @@ type FailureFunctionLog = {
221
227
  /**
222
228
  * State of the message published for failure
223
229
  */
224
- state: "CALLBACK_INPROGRESS" | "CALLBACK_SUCCESS" | "CALLBACK_FAIL" | "CALLBACK_CANCELED";
230
+ state: FailureFunctionState;
225
231
  /**
226
232
  * Headers received from the step which caused the workflow to fail
227
233
  */
@@ -570,7 +576,11 @@ type WorkflowFilterFields = {
570
576
  workflowUrl?: string | string[];
571
577
  workflowRunId?: string;
572
578
  workflowCreatedAt?: number;
573
- failureFunctionState?: string;
579
+ /**
580
+ * Filter by the state of the failure function call. Supports multiple values:
581
+ * pass an array to match runs in any of the given states (OR semantics).
582
+ */
583
+ failureFunctionState?: FailureFunctionState | FailureFunctionState[];
574
584
  };
575
585
  type WorkflowLogsFilterFields = {
576
586
  state?: WorkflowRunLog["workflowState"];
@@ -680,7 +690,7 @@ type ResumeRestartOptions = {
680
690
  retries?: number;
681
691
  };
682
692
  type FailureCallbackInfo = {
683
- state?: "CALLBACK_FAIL" | "CALLBACK_SUCCESS" | "CALLBACK_INPROGRESS" | "CALLBACK_CANCELED";
693
+ state?: FailureFunctionState;
684
694
  responseStatus?: number;
685
695
  responseBody?: string;
686
696
  responseHeaders?: Record<string, string[]>;
@@ -834,6 +844,15 @@ declare class DLQ {
834
844
  retryFailureFunction({ dlqId }: Pick<DLQResumeRestartOptions<string>, "dlqId">): Promise<DLQResumeRestartResponse & {
835
845
  error?: string;
836
846
  }>;
847
+ /**
848
+ * Cancel the in-progress failure function (failureUrl/failureFunction) call
849
+ * of a workflow run.
850
+ *
851
+ * Fails if the run has no failure function call in progress.
852
+ *
853
+ * @param dlqId - The ID of the DLQ message whose failure function call will be canceled
854
+ */
855
+ cancelFailureFunction({ dlqId }: Pick<DLQResumeRestartOptions<string>, "dlqId">): Promise<void>;
837
856
  /**
838
857
  * Delete DLQ messages.
839
858
  *
@@ -1071,4 +1090,4 @@ declare class Client {
1071
1090
  get dlq(): DLQ;
1072
1091
  }
1073
1092
 
1074
- export { Client, type DLQResumeRestartOptions, type DLQResumeRestartResponse, NotifyResponse, RawStep, RouteFunction, type StepError, type StepLog, StepType, Telemetry, type TriggerOptions, Waiter, WorkflowClient, WorkflowMiddleware, WorkflowReceiver, type WorkflowRunLog, type WorkflowRunLogs, WorkflowServeOptions, loggingMiddleware, serve };
1093
+ export { Client, type DLQResumeRestartOptions, type DLQResumeRestartResponse, type FailureFunctionState, NotifyResponse, RawStep, RouteFunction, type StepError, type StepLog, StepType, Telemetry, type TriggerOptions, Waiter, WorkflowClient, WorkflowMiddleware, WorkflowReceiver, type WorkflowRunLog, type WorkflowRunLogs, WorkflowServeOptions, loggingMiddleware, serve };