@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/index.mjs CHANGED
@@ -11,6 +11,7 @@ import {
11
11
  assertNonEmptyId,
12
12
  buildBulkActionQueryParameters,
13
13
  getWorkflowRunId,
14
+ isInstanceOf,
14
15
  loggingMiddleware,
15
16
  makeGetWaitersRequest,
16
17
  makeNotifyRequest,
@@ -22,12 +23,13 @@ import {
22
23
  triggerFirstInvocation,
23
24
  validateFlowControl,
24
25
  validateLabel
25
- } from "./chunk-WEQGCISK.mjs";
26
+ } from "./chunk-UH6O5IJY.mjs";
26
27
 
27
28
  // src/client/index.ts
28
- import { Client as QStashClient } from "@upstash/qstash";
29
+ import { Client as QStashClient2 } from "@upstash/qstash";
29
30
 
30
31
  // src/client/dlq.ts
32
+ import { QstashError } from "@upstash/qstash";
31
33
  function buildResumeRestartHeaders(options) {
32
34
  const headers = {};
33
35
  if (options?.flowControl) {
@@ -145,6 +147,27 @@ var DLQ = class {
145
147
  });
146
148
  return response;
147
149
  }
150
+ /**
151
+ * Cancel the in-progress failure function (failureUrl/failureFunction) call
152
+ * of a workflow run.
153
+ *
154
+ * Fails if the run has no failure function call in progress.
155
+ *
156
+ * @param dlqId - The ID of the DLQ message whose failure function call will be canceled
157
+ */
158
+ async cancelFailureFunction({ dlqId }) {
159
+ assertNonEmptyId(dlqId, "DLQ id");
160
+ try {
161
+ await this.client.http.request({
162
+ path: ["v2", "workflows", "dlq", "callback", dlqId],
163
+ method: "DELETE",
164
+ parseResponseAsJson: false
165
+ });
166
+ } catch (error) {
167
+ if (isInstanceOf(error, QstashError) && error.status === 302) return;
168
+ throw error;
169
+ }
170
+ }
148
171
  /**
149
172
  * Delete DLQ messages.
150
173
  *
@@ -186,7 +209,7 @@ var DLQ = class {
186
209
  var Client = class {
187
210
  client;
188
211
  constructor(clientConfig) {
189
- this.client = new QStashClient(clientConfig);
212
+ this.client = new QStashClient2(clientConfig);
190
213
  }
191
214
  async cancel(request) {
192
215
  if (typeof request === "object" && !Array.isArray(request) && ("ids" in request || "urlStartingWith" in request)) {
package/nextjs.d.mts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { NextApiHandler, NextApiRequest, NextApiResponse } from 'next';
2
- import { c as RouteFunction, d as WorkflowServeOptions, I as InvokableWorkflow } from './types-CekOpKvz.mjs';
3
- import { s as serveManyBase } from './serve-many-CG3BFvO3.mjs';
2
+ import { c as RouteFunction, d as WorkflowServeOptions, I as InvokableWorkflow } from './types-ffLPVG5_.mjs';
3
+ import { s as serveManyBase } from './serve-many-CbIV7145.mjs';
4
4
  import '@upstash/qstash';
5
5
  import 'zod';
6
+ import 'neverthrow';
6
7
 
7
8
  /**
8
9
  * Serve method to serve a Upstash Workflow in a Nextjs project
package/nextjs.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { NextApiHandler, NextApiRequest, NextApiResponse } from 'next';
2
- import { c as RouteFunction, d as WorkflowServeOptions, I as InvokableWorkflow } from './types-CekOpKvz.js';
3
- import { s as serveManyBase } from './serve-many-iJF1IUXk.js';
2
+ import { c as RouteFunction, d as WorkflowServeOptions, I as InvokableWorkflow } from './types-ffLPVG5_.js';
3
+ import { s as serveManyBase } from './serve-many-BCtZg31b.js';
4
4
  import '@upstash/qstash';
5
5
  import 'zod';
6
+ import 'neverthrow';
6
7
 
7
8
  /**
8
9
  * Serve method to serve a Upstash Workflow in a Nextjs project