@upstash/workflow 0.2.16 → 0.2.18

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.
package/index.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  SDK_TELEMETRY,
3
3
  StepTypes,
4
+ WORKFLOW_LABEL_HEADER,
4
5
  WorkflowAbort,
5
6
  WorkflowContext,
6
7
  WorkflowError,
@@ -13,7 +14,7 @@ import {
13
14
  prepareFlowControl,
14
15
  serve,
15
16
  triggerFirstInvocation
16
- } from "./chunk-TGEGSOSN.mjs";
17
+ } from "./chunk-EHL7SSJF.mjs";
17
18
 
18
19
  // src/client/index.ts
19
20
  import { Client as QStashClient } from "@upstash/qstash";
@@ -73,6 +74,20 @@ var DLQ = class _DLQ {
73
74
  }
74
75
  return workflowRuns[0];
75
76
  }
77
+ /**
78
+ * Retry the failure callback of a workflow run whose failureUrl/failureFunction
79
+ * request has failed.
80
+ *
81
+ * @param dlqId - The ID of the DLQ message to retry.
82
+ * @returns
83
+ */
84
+ async retryFailureFunction({ dlqId }) {
85
+ const response = await this.client.http.request({
86
+ path: ["v2", "workflows", "dlq", "callback", dlqId],
87
+ method: "POST"
88
+ });
89
+ return response;
90
+ }
76
91
  static handleDLQOptions(options) {
77
92
  const { dlqId, flowControl, retries } = options;
78
93
  const headers = {};
@@ -231,16 +246,21 @@ var Client = class {
231
246
  const finalWorkflowRunId = getWorkflowRunId(option.workflowRunId);
232
247
  const context = new WorkflowContext({
233
248
  qstashClient: this.client,
234
- // @ts-expect-error headers type mismatch
235
- headers: new Headers(option.headers ?? {}),
249
+ // @ts-expect-error header type mismatch because of bun
250
+ headers: new Headers({
251
+ ...option.headers ?? {},
252
+ ...option.label ? { [WORKFLOW_LABEL_HEADER]: option.label } : {}
253
+ }),
236
254
  initialPayload: option.body,
237
255
  steps: [],
238
256
  url: option.url,
239
257
  workflowRunId: finalWorkflowRunId,
240
258
  retries: option.retries,
259
+ retryDelay: option.retryDelay,
241
260
  telemetry: { sdk: SDK_TELEMETRY },
242
261
  flowControl: option.flowControl,
243
- failureUrl
262
+ failureUrl,
263
+ label: option.label
244
264
  });
245
265
  return {
246
266
  workflowContext: context,
@@ -306,6 +326,9 @@ var Client = class {
306
326
  if (workflowCreatedAt) {
307
327
  urlParams.append("workflowCreatedAt", workflowCreatedAt.toString());
308
328
  }
329
+ if (params?.label) {
330
+ urlParams.append("label", params.label);
331
+ }
309
332
  const result = await this.client.http.request({
310
333
  path: ["v2", "workflows", `events?${urlParams.toString()}`]
311
334
  });
package/nextjs.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { NextApiHandler, NextApiRequest, NextApiResponse } from 'next';
2
- import { R as RouteFunction, n as PublicServeOptions, w as InvokableWorkflow } from './types-Dd-3bPoU.mjs';
3
- import { s as serveManyBase } from './serve-many-AFwJPR3S.mjs';
2
+ import { R as RouteFunction, n as PublicServeOptions, x as InvokableWorkflow } from './types-B7_5AkKQ.mjs';
3
+ import { s as serveManyBase } from './serve-many-CEUYWQvV.mjs';
4
4
  import '@upstash/qstash';
5
5
  import 'zod';
6
6
  import 'ai';
package/nextjs.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { NextApiHandler, NextApiRequest, NextApiResponse } from 'next';
2
- import { R as RouteFunction, n as PublicServeOptions, w as InvokableWorkflow } from './types-Dd-3bPoU.js';
3
- import { s as serveManyBase } from './serve-many-AaKSQyi7.js';
2
+ import { R as RouteFunction, n as PublicServeOptions, x as InvokableWorkflow } from './types-B7_5AkKQ.js';
3
+ import { s as serveManyBase } from './serve-many-BObe3pdI.js';
4
4
  import '@upstash/qstash';
5
5
  import 'zod';
6
6
  import 'ai';