@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/astro.d.mts +2 -2
- package/astro.d.ts +2 -2
- package/astro.js +201 -41
- package/astro.mjs +1 -1
- package/{chunk-TGEGSOSN.mjs → chunk-EHL7SSJF.mjs} +202 -41
- package/cloudflare.d.mts +2 -2
- package/cloudflare.d.ts +2 -2
- package/cloudflare.js +201 -41
- package/cloudflare.mjs +1 -1
- package/express.d.mts +2 -2
- package/express.d.ts +2 -2
- package/express.js +7086 -7201
- package/express.mjs +6706 -6981
- package/h3.d.mts +2 -2
- package/h3.d.ts +2 -2
- package/h3.js +201 -41
- package/h3.mjs +1 -1
- package/hono.d.mts +2 -2
- package/hono.d.ts +2 -2
- package/hono.js +201 -41
- package/hono.mjs +1 -1
- package/index.d.mts +131 -11
- package/index.d.ts +131 -11
- package/index.js +218 -42
- package/index.mjs +27 -4
- package/nextjs.d.mts +2 -2
- package/nextjs.d.ts +2 -2
- package/nextjs.js +204 -41
- package/nextjs.mjs +4 -1
- package/package.json +1 -1
- package/{serve-many-AaKSQyi7.d.ts → serve-many-BObe3pdI.d.ts} +1 -1
- package/{serve-many-AFwJPR3S.d.mts → serve-many-CEUYWQvV.d.mts} +1 -1
- package/solidjs.d.mts +1 -1
- package/solidjs.d.ts +1 -1
- package/solidjs.js +193 -39
- package/solidjs.mjs +1 -1
- package/svelte.d.mts +2 -2
- package/svelte.d.ts +2 -2
- package/svelte.js +201 -41
- package/svelte.mjs +1 -1
- package/{types-Dd-3bPoU.d.ts → types-B7_5AkKQ.d.mts} +118 -14
- package/{types-Dd-3bPoU.d.mts → types-B7_5AkKQ.d.ts} +118 -14
package/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RouteFunction, W as WorkflowServeOptions, E as ExclusiveValidationOptions, T as Telemetry, S as StepType, a as RawStep, N as NotifyResponse, b as Waiter } from './types-
|
|
2
|
-
export { A as AsyncStepFunction, C as CallResponse,
|
|
1
|
+
import { R as RouteFunction, W as WorkflowServeOptions, E as ExclusiveValidationOptions, T as Telemetry, S as StepType, a as RawStep, N as NotifyResponse, b as Waiter } from './types-B7_5AkKQ.mjs';
|
|
2
|
+
export { A as AsyncStepFunction, C as CallResponse, v as CallSettings, D as DetailedFinishCondition, t as Duration, o as FailureFunctionPayload, F as FinishCondition, H as HeaderParams, x as InvokableWorkflow, w as InvokeStepResponse, I as InvokeWorkflowRequest, L as LazyInvokeStepParams, y as LogLevel, s as NotifyStepResponse, P as ParallelCallState, n as PublicServeOptions, p as RequiredExceptFields, k as Step, m as StepFunction, j as StepTypes, l as SyncStepFunction, u as WaitEventOptions, q as WaitRequest, r as WaitStepResponse, d as WorkflowAbort, h as WorkflowClient, g as WorkflowContext, c as WorkflowError, B as WorkflowLogger, z as WorkflowLoggerOptions, e as WorkflowNonRetryableError, i as WorkflowReceiver, f as WorkflowTool } from './types-B7_5AkKQ.mjs';
|
|
3
3
|
import { FlowControl, PublishRequest, HTTPMethods, State, Client as Client$1 } from '@upstash/qstash';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import 'ai';
|
|
@@ -64,6 +64,10 @@ type BaseStepLog = {
|
|
|
64
64
|
* number of retries for the step
|
|
65
65
|
*/
|
|
66
66
|
retries: number;
|
|
67
|
+
/**
|
|
68
|
+
* retry delay parameter for the step if it was set
|
|
69
|
+
*/
|
|
70
|
+
retryDelay?: string;
|
|
67
71
|
/**
|
|
68
72
|
* number of parallel steps
|
|
69
73
|
*
|
|
@@ -163,6 +167,25 @@ type StepLog = BaseStepLog & AsOptional<CallUrlGroup> & AsOptional<CallResponseS
|
|
|
163
167
|
}> & AsOptional<{
|
|
164
168
|
sleepUntil: number;
|
|
165
169
|
}> & AsOptional<WaitEventGroup>;
|
|
170
|
+
type StepError = {
|
|
171
|
+
/**
|
|
172
|
+
* error message associated with the request
|
|
173
|
+
*
|
|
174
|
+
* example:
|
|
175
|
+
* ```
|
|
176
|
+
* detected a non-workflow destination for trigger/invoke.
|
|
177
|
+
* make sure you are sending the request to the correct endpoint
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
error: string;
|
|
181
|
+
/**
|
|
182
|
+
* response body returned in the request which resulted in an error
|
|
183
|
+
*/
|
|
184
|
+
body: string;
|
|
185
|
+
headers: Record<string, string[]>;
|
|
186
|
+
status: number;
|
|
187
|
+
time: number;
|
|
188
|
+
};
|
|
166
189
|
type StepLogGroup = {
|
|
167
190
|
/**
|
|
168
191
|
* Log which belongs to a single step
|
|
@@ -192,15 +215,14 @@ type StepLogGroup = {
|
|
|
192
215
|
* retries
|
|
193
216
|
*/
|
|
194
217
|
retries: number;
|
|
218
|
+
/**
|
|
219
|
+
* retry delay parameter for the step if it was set
|
|
220
|
+
*/
|
|
221
|
+
retryDelay?: string;
|
|
195
222
|
/**
|
|
196
223
|
* errors which occured in the step
|
|
197
224
|
*/
|
|
198
|
-
errors?:
|
|
199
|
-
error: string;
|
|
200
|
-
headers: Record<string, string[]>;
|
|
201
|
-
status: number;
|
|
202
|
-
time: number;
|
|
203
|
-
}[];
|
|
225
|
+
errors?: StepError[];
|
|
204
226
|
}[];
|
|
205
227
|
/**
|
|
206
228
|
* Log which belongs to the next step
|
|
@@ -236,6 +258,22 @@ type FailureFunctionLog = {
|
|
|
236
258
|
* @deprecated use dlqId field of the workflow run itself
|
|
237
259
|
*/
|
|
238
260
|
dlqId: string;
|
|
261
|
+
/**
|
|
262
|
+
* Errors received while running failure function
|
|
263
|
+
*/
|
|
264
|
+
errors?: StepError[];
|
|
265
|
+
/**
|
|
266
|
+
* String body returned from the failure function
|
|
267
|
+
*/
|
|
268
|
+
responseBody?: string;
|
|
269
|
+
/**
|
|
270
|
+
* Headers received from the failure function
|
|
271
|
+
*/
|
|
272
|
+
responseHeaders?: Record<string, string[]>;
|
|
273
|
+
/**
|
|
274
|
+
* Status code of the response from the failure function
|
|
275
|
+
*/
|
|
276
|
+
responseStatus?: number;
|
|
239
277
|
};
|
|
240
278
|
type WorkflowRunLog = {
|
|
241
279
|
/**
|
|
@@ -305,6 +343,10 @@ type WorkflowRunLog = {
|
|
|
305
343
|
* If the workflow run has failed, id of the run in DLQ
|
|
306
344
|
*/
|
|
307
345
|
dlqId?: string;
|
|
346
|
+
/**
|
|
347
|
+
* Label of the workflow run
|
|
348
|
+
*/
|
|
349
|
+
label?: string;
|
|
308
350
|
};
|
|
309
351
|
type WorkflowRunLogs = {
|
|
310
352
|
cursor: string;
|
|
@@ -334,6 +376,37 @@ type TriggerOptions = {
|
|
|
334
376
|
* @default 3
|
|
335
377
|
*/
|
|
336
378
|
retries?: number;
|
|
379
|
+
/**
|
|
380
|
+
* Delay between retries.
|
|
381
|
+
*
|
|
382
|
+
* By default, the `retryDelay` is exponential backoff.
|
|
383
|
+
* More details can be found in: https://upstash.com/docs/qstash/features/retry.
|
|
384
|
+
*
|
|
385
|
+
* The `retryDelay` option allows you to customize the delay (in milliseconds) between retry attempts when message delivery fails.
|
|
386
|
+
*
|
|
387
|
+
* You can use mathematical expressions and the following built-in functions to calculate the delay dynamically.
|
|
388
|
+
* The special variable `retried` represents the current retry attempt count (starting from 0).
|
|
389
|
+
*
|
|
390
|
+
* Supported functions:
|
|
391
|
+
* - `pow`
|
|
392
|
+
* - `sqrt`
|
|
393
|
+
* - `abs`
|
|
394
|
+
* - `exp`
|
|
395
|
+
* - `floor`
|
|
396
|
+
* - `ceil`
|
|
397
|
+
* - `round`
|
|
398
|
+
* - `min`
|
|
399
|
+
* - `max`
|
|
400
|
+
*
|
|
401
|
+
* Examples of valid `retryDelay` values:
|
|
402
|
+
* ```ts
|
|
403
|
+
* 1000 // 1 second
|
|
404
|
+
* 1000 * (1 + retried) // 1 second multiplied by the current retry attempt
|
|
405
|
+
* pow(2, retried) // 2 to the power of the current retry attempt
|
|
406
|
+
* max(10, pow(2, retried)) // The greater of 10 or 2^retried
|
|
407
|
+
* ```
|
|
408
|
+
*/
|
|
409
|
+
retryDelay?: string;
|
|
337
410
|
/**
|
|
338
411
|
* Flow control to use for the workflow run.
|
|
339
412
|
* If not provided, no flow control will be used.
|
|
@@ -343,6 +416,12 @@ type TriggerOptions = {
|
|
|
343
416
|
* Delay to apply before triggering the workflow.
|
|
344
417
|
*/
|
|
345
418
|
delay?: PublishRequest["delay"];
|
|
419
|
+
/**
|
|
420
|
+
* Label to apply to the workflow run.
|
|
421
|
+
*
|
|
422
|
+
* Can be used to filter the workflow run logs.
|
|
423
|
+
*/
|
|
424
|
+
label?: string;
|
|
346
425
|
} & ({
|
|
347
426
|
/**
|
|
348
427
|
* URL to call if the first request to the workflow endpoint fails
|
|
@@ -383,9 +462,23 @@ type DLQResumeRestartResponse = {
|
|
|
383
462
|
};
|
|
384
463
|
|
|
385
464
|
type QStashDLQFilterOptions = NonNullable<Required<Parameters<Client$1["dlq"]["listMessages"]>[0]>>["filter"];
|
|
386
|
-
type DLQFilterOptions = Pick<QStashDLQFilterOptions, "fromDate" | "toDate" | "url" | "responseStatus"
|
|
465
|
+
type DLQFilterOptions = Pick<QStashDLQFilterOptions, "fromDate" | "toDate" | "url" | "responseStatus"> & {
|
|
466
|
+
workflowRunId?: string;
|
|
467
|
+
workflowCreatedAt?: string;
|
|
468
|
+
failureFunctionState?: FailureCallbackInfo["state"];
|
|
469
|
+
label?: string;
|
|
470
|
+
};
|
|
471
|
+
type FailureCallbackInfo = {
|
|
472
|
+
state?: "CALLBACK_FAIL" | "CALLBACK_SUCCESS" | "CALLBACK_INPROGRESS";
|
|
473
|
+
responseStatus?: number;
|
|
474
|
+
responseBody?: string;
|
|
475
|
+
responseHeaders?: Record<string, string[]>;
|
|
476
|
+
};
|
|
387
477
|
type DLQMessage = {
|
|
388
478
|
messageId: string;
|
|
479
|
+
/**
|
|
480
|
+
* URL of the workflow
|
|
481
|
+
*/
|
|
389
482
|
url: string;
|
|
390
483
|
method: string;
|
|
391
484
|
header: Record<string, string[]>;
|
|
@@ -401,8 +494,20 @@ type DLQMessage = {
|
|
|
401
494
|
responseHeader: Record<string, string[]>;
|
|
402
495
|
responseBody: string;
|
|
403
496
|
dlqId: string;
|
|
497
|
+
/**
|
|
498
|
+
* URL of the failure callback
|
|
499
|
+
*/
|
|
500
|
+
failureCallback?: string;
|
|
501
|
+
/**
|
|
502
|
+
* status of the failure callback
|
|
503
|
+
*/
|
|
504
|
+
failureCallbackInfo?: FailureCallbackInfo;
|
|
505
|
+
/**
|
|
506
|
+
* label passed when triggering workflow
|
|
507
|
+
*/
|
|
508
|
+
label?: string;
|
|
404
509
|
};
|
|
405
|
-
type PublicDLQMessage = Pick<DLQMessage, "header" | "body" | "maxRetries" | "notBefore" | "createdAt" | "callerIP" | "workflowRunId" | "workflowCreatedAt" | "workflowUrl" | "responseStatus" | "responseHeader" | "responseBody" | "dlqId">;
|
|
510
|
+
type PublicDLQMessage = Pick<DLQMessage, "header" | "body" | "maxRetries" | "notBefore" | "createdAt" | "callerIP" | "workflowRunId" | "workflowCreatedAt" | "workflowUrl" | "responseStatus" | "responseHeader" | "responseBody" | "dlqId" | "failureCallback" | "failureCallbackInfo" | "label">;
|
|
406
511
|
declare class DLQ {
|
|
407
512
|
private client;
|
|
408
513
|
constructor(client: Client$1);
|
|
@@ -515,6 +620,16 @@ declare class DLQ {
|
|
|
515
620
|
*/
|
|
516
621
|
restart(parameters: DLQResumeRestartOptions<string>): Promise<DLQResumeRestartResponse>;
|
|
517
622
|
restart(parameters: DLQResumeRestartOptions<string[]>): Promise<DLQResumeRestartResponse[]>;
|
|
623
|
+
/**
|
|
624
|
+
* Retry the failure callback of a workflow run whose failureUrl/failureFunction
|
|
625
|
+
* request has failed.
|
|
626
|
+
*
|
|
627
|
+
* @param dlqId - The ID of the DLQ message to retry.
|
|
628
|
+
* @returns
|
|
629
|
+
*/
|
|
630
|
+
retryFailureFunction({ dlqId }: Pick<DLQResumeRestartOptions<string>, "dlqId">): Promise<DLQResumeRestartResponse & {
|
|
631
|
+
error?: string;
|
|
632
|
+
}>;
|
|
518
633
|
private static handleDLQOptions;
|
|
519
634
|
private static getDlqIdQueryParameter;
|
|
520
635
|
}
|
|
@@ -640,6 +755,7 @@ declare class Client {
|
|
|
640
755
|
* headers: { ... }, // Optional headers
|
|
641
756
|
* workflowRunId: "my-workflow", // Optional workflow run ID
|
|
642
757
|
* retries: 3 // Optional retries for the initial request
|
|
758
|
+
* retryDelay: "1000" // Optional retry delay for the delay between retries
|
|
643
759
|
* });
|
|
644
760
|
*
|
|
645
761
|
* console.log(workflowRunId)
|
|
@@ -654,6 +770,7 @@ declare class Client {
|
|
|
654
770
|
* headers: { ... }, // Optional headers
|
|
655
771
|
* workflowRunId: "my-workflow", // Optional workflow run ID
|
|
656
772
|
* retries: 3 // Optional retries for the initial request
|
|
773
|
+
* retryDelay: "1000" // Optional retry delay for the delay between retries
|
|
657
774
|
* },
|
|
658
775
|
* {
|
|
659
776
|
* url: "https://workflow-endpoint-2.com",
|
|
@@ -661,6 +778,7 @@ declare class Client {
|
|
|
661
778
|
* headers: { ... }, // Optional headers
|
|
662
779
|
* workflowRunId: "my-workflow-2", // Optional workflow run ID
|
|
663
780
|
* retries: 5 // Optional retries for the initial request
|
|
781
|
+
* retryDelay: "1000" // Optional retry delay for the delay between retries
|
|
664
782
|
* },
|
|
665
783
|
* ]);
|
|
666
784
|
*
|
|
@@ -681,6 +799,7 @@ declare class Client {
|
|
|
681
799
|
* with `wfr_`.
|
|
682
800
|
* @param retries retry to use in the initial request. in the rest of
|
|
683
801
|
* the workflow, `retries` option of the `serve` will be used.
|
|
802
|
+
* @param retryDelay delay between retries.
|
|
684
803
|
* @param flowControl Settings for controlling the number of active requests
|
|
685
804
|
* and number of requests per second with the same key.
|
|
686
805
|
* @param delay Delay for the workflow run. This is used to delay the
|
|
@@ -728,8 +847,9 @@ declare class Client {
|
|
|
728
847
|
state?: WorkflowRunLog["workflowState"];
|
|
729
848
|
workflowUrl?: WorkflowRunLog["workflowUrl"];
|
|
730
849
|
workflowCreatedAt?: WorkflowRunLog["workflowRunCreatedAt"];
|
|
850
|
+
label?: WorkflowRunLog["label"];
|
|
731
851
|
}): Promise<WorkflowRunLogs>;
|
|
732
852
|
get dlq(): DLQ;
|
|
733
853
|
}
|
|
734
854
|
|
|
735
|
-
export { Client, type DLQResumeRestartOptions, type DLQResumeRestartResponse, ExclusiveValidationOptions, NotifyResponse, RawStep, RouteFunction, type StepLog, StepType, Telemetry, type TriggerOptions, Waiter, type WorkflowRunLog, type WorkflowRunLogs, WorkflowServeOptions, serve };
|
|
855
|
+
export { Client, type DLQResumeRestartOptions, type DLQResumeRestartResponse, ExclusiveValidationOptions, NotifyResponse, RawStep, RouteFunction, type StepError, type StepLog, StepType, Telemetry, type TriggerOptions, Waiter, type WorkflowRunLog, type WorkflowRunLogs, WorkflowServeOptions, serve };
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RouteFunction, W as WorkflowServeOptions, E as ExclusiveValidationOptions, T as Telemetry, S as StepType, a as RawStep, N as NotifyResponse, b as Waiter } from './types-
|
|
2
|
-
export { A as AsyncStepFunction, C as CallResponse,
|
|
1
|
+
import { R as RouteFunction, W as WorkflowServeOptions, E as ExclusiveValidationOptions, T as Telemetry, S as StepType, a as RawStep, N as NotifyResponse, b as Waiter } from './types-B7_5AkKQ.js';
|
|
2
|
+
export { A as AsyncStepFunction, C as CallResponse, v as CallSettings, D as DetailedFinishCondition, t as Duration, o as FailureFunctionPayload, F as FinishCondition, H as HeaderParams, x as InvokableWorkflow, w as InvokeStepResponse, I as InvokeWorkflowRequest, L as LazyInvokeStepParams, y as LogLevel, s as NotifyStepResponse, P as ParallelCallState, n as PublicServeOptions, p as RequiredExceptFields, k as Step, m as StepFunction, j as StepTypes, l as SyncStepFunction, u as WaitEventOptions, q as WaitRequest, r as WaitStepResponse, d as WorkflowAbort, h as WorkflowClient, g as WorkflowContext, c as WorkflowError, B as WorkflowLogger, z as WorkflowLoggerOptions, e as WorkflowNonRetryableError, i as WorkflowReceiver, f as WorkflowTool } from './types-B7_5AkKQ.js';
|
|
3
3
|
import { FlowControl, PublishRequest, HTTPMethods, State, Client as Client$1 } from '@upstash/qstash';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import 'ai';
|
|
@@ -64,6 +64,10 @@ type BaseStepLog = {
|
|
|
64
64
|
* number of retries for the step
|
|
65
65
|
*/
|
|
66
66
|
retries: number;
|
|
67
|
+
/**
|
|
68
|
+
* retry delay parameter for the step if it was set
|
|
69
|
+
*/
|
|
70
|
+
retryDelay?: string;
|
|
67
71
|
/**
|
|
68
72
|
* number of parallel steps
|
|
69
73
|
*
|
|
@@ -163,6 +167,25 @@ type StepLog = BaseStepLog & AsOptional<CallUrlGroup> & AsOptional<CallResponseS
|
|
|
163
167
|
}> & AsOptional<{
|
|
164
168
|
sleepUntil: number;
|
|
165
169
|
}> & AsOptional<WaitEventGroup>;
|
|
170
|
+
type StepError = {
|
|
171
|
+
/**
|
|
172
|
+
* error message associated with the request
|
|
173
|
+
*
|
|
174
|
+
* example:
|
|
175
|
+
* ```
|
|
176
|
+
* detected a non-workflow destination for trigger/invoke.
|
|
177
|
+
* make sure you are sending the request to the correct endpoint
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
error: string;
|
|
181
|
+
/**
|
|
182
|
+
* response body returned in the request which resulted in an error
|
|
183
|
+
*/
|
|
184
|
+
body: string;
|
|
185
|
+
headers: Record<string, string[]>;
|
|
186
|
+
status: number;
|
|
187
|
+
time: number;
|
|
188
|
+
};
|
|
166
189
|
type StepLogGroup = {
|
|
167
190
|
/**
|
|
168
191
|
* Log which belongs to a single step
|
|
@@ -192,15 +215,14 @@ type StepLogGroup = {
|
|
|
192
215
|
* retries
|
|
193
216
|
*/
|
|
194
217
|
retries: number;
|
|
218
|
+
/**
|
|
219
|
+
* retry delay parameter for the step if it was set
|
|
220
|
+
*/
|
|
221
|
+
retryDelay?: string;
|
|
195
222
|
/**
|
|
196
223
|
* errors which occured in the step
|
|
197
224
|
*/
|
|
198
|
-
errors?:
|
|
199
|
-
error: string;
|
|
200
|
-
headers: Record<string, string[]>;
|
|
201
|
-
status: number;
|
|
202
|
-
time: number;
|
|
203
|
-
}[];
|
|
225
|
+
errors?: StepError[];
|
|
204
226
|
}[];
|
|
205
227
|
/**
|
|
206
228
|
* Log which belongs to the next step
|
|
@@ -236,6 +258,22 @@ type FailureFunctionLog = {
|
|
|
236
258
|
* @deprecated use dlqId field of the workflow run itself
|
|
237
259
|
*/
|
|
238
260
|
dlqId: string;
|
|
261
|
+
/**
|
|
262
|
+
* Errors received while running failure function
|
|
263
|
+
*/
|
|
264
|
+
errors?: StepError[];
|
|
265
|
+
/**
|
|
266
|
+
* String body returned from the failure function
|
|
267
|
+
*/
|
|
268
|
+
responseBody?: string;
|
|
269
|
+
/**
|
|
270
|
+
* Headers received from the failure function
|
|
271
|
+
*/
|
|
272
|
+
responseHeaders?: Record<string, string[]>;
|
|
273
|
+
/**
|
|
274
|
+
* Status code of the response from the failure function
|
|
275
|
+
*/
|
|
276
|
+
responseStatus?: number;
|
|
239
277
|
};
|
|
240
278
|
type WorkflowRunLog = {
|
|
241
279
|
/**
|
|
@@ -305,6 +343,10 @@ type WorkflowRunLog = {
|
|
|
305
343
|
* If the workflow run has failed, id of the run in DLQ
|
|
306
344
|
*/
|
|
307
345
|
dlqId?: string;
|
|
346
|
+
/**
|
|
347
|
+
* Label of the workflow run
|
|
348
|
+
*/
|
|
349
|
+
label?: string;
|
|
308
350
|
};
|
|
309
351
|
type WorkflowRunLogs = {
|
|
310
352
|
cursor: string;
|
|
@@ -334,6 +376,37 @@ type TriggerOptions = {
|
|
|
334
376
|
* @default 3
|
|
335
377
|
*/
|
|
336
378
|
retries?: number;
|
|
379
|
+
/**
|
|
380
|
+
* Delay between retries.
|
|
381
|
+
*
|
|
382
|
+
* By default, the `retryDelay` is exponential backoff.
|
|
383
|
+
* More details can be found in: https://upstash.com/docs/qstash/features/retry.
|
|
384
|
+
*
|
|
385
|
+
* The `retryDelay` option allows you to customize the delay (in milliseconds) between retry attempts when message delivery fails.
|
|
386
|
+
*
|
|
387
|
+
* You can use mathematical expressions and the following built-in functions to calculate the delay dynamically.
|
|
388
|
+
* The special variable `retried` represents the current retry attempt count (starting from 0).
|
|
389
|
+
*
|
|
390
|
+
* Supported functions:
|
|
391
|
+
* - `pow`
|
|
392
|
+
* - `sqrt`
|
|
393
|
+
* - `abs`
|
|
394
|
+
* - `exp`
|
|
395
|
+
* - `floor`
|
|
396
|
+
* - `ceil`
|
|
397
|
+
* - `round`
|
|
398
|
+
* - `min`
|
|
399
|
+
* - `max`
|
|
400
|
+
*
|
|
401
|
+
* Examples of valid `retryDelay` values:
|
|
402
|
+
* ```ts
|
|
403
|
+
* 1000 // 1 second
|
|
404
|
+
* 1000 * (1 + retried) // 1 second multiplied by the current retry attempt
|
|
405
|
+
* pow(2, retried) // 2 to the power of the current retry attempt
|
|
406
|
+
* max(10, pow(2, retried)) // The greater of 10 or 2^retried
|
|
407
|
+
* ```
|
|
408
|
+
*/
|
|
409
|
+
retryDelay?: string;
|
|
337
410
|
/**
|
|
338
411
|
* Flow control to use for the workflow run.
|
|
339
412
|
* If not provided, no flow control will be used.
|
|
@@ -343,6 +416,12 @@ type TriggerOptions = {
|
|
|
343
416
|
* Delay to apply before triggering the workflow.
|
|
344
417
|
*/
|
|
345
418
|
delay?: PublishRequest["delay"];
|
|
419
|
+
/**
|
|
420
|
+
* Label to apply to the workflow run.
|
|
421
|
+
*
|
|
422
|
+
* Can be used to filter the workflow run logs.
|
|
423
|
+
*/
|
|
424
|
+
label?: string;
|
|
346
425
|
} & ({
|
|
347
426
|
/**
|
|
348
427
|
* URL to call if the first request to the workflow endpoint fails
|
|
@@ -383,9 +462,23 @@ type DLQResumeRestartResponse = {
|
|
|
383
462
|
};
|
|
384
463
|
|
|
385
464
|
type QStashDLQFilterOptions = NonNullable<Required<Parameters<Client$1["dlq"]["listMessages"]>[0]>>["filter"];
|
|
386
|
-
type DLQFilterOptions = Pick<QStashDLQFilterOptions, "fromDate" | "toDate" | "url" | "responseStatus"
|
|
465
|
+
type DLQFilterOptions = Pick<QStashDLQFilterOptions, "fromDate" | "toDate" | "url" | "responseStatus"> & {
|
|
466
|
+
workflowRunId?: string;
|
|
467
|
+
workflowCreatedAt?: string;
|
|
468
|
+
failureFunctionState?: FailureCallbackInfo["state"];
|
|
469
|
+
label?: string;
|
|
470
|
+
};
|
|
471
|
+
type FailureCallbackInfo = {
|
|
472
|
+
state?: "CALLBACK_FAIL" | "CALLBACK_SUCCESS" | "CALLBACK_INPROGRESS";
|
|
473
|
+
responseStatus?: number;
|
|
474
|
+
responseBody?: string;
|
|
475
|
+
responseHeaders?: Record<string, string[]>;
|
|
476
|
+
};
|
|
387
477
|
type DLQMessage = {
|
|
388
478
|
messageId: string;
|
|
479
|
+
/**
|
|
480
|
+
* URL of the workflow
|
|
481
|
+
*/
|
|
389
482
|
url: string;
|
|
390
483
|
method: string;
|
|
391
484
|
header: Record<string, string[]>;
|
|
@@ -401,8 +494,20 @@ type DLQMessage = {
|
|
|
401
494
|
responseHeader: Record<string, string[]>;
|
|
402
495
|
responseBody: string;
|
|
403
496
|
dlqId: string;
|
|
497
|
+
/**
|
|
498
|
+
* URL of the failure callback
|
|
499
|
+
*/
|
|
500
|
+
failureCallback?: string;
|
|
501
|
+
/**
|
|
502
|
+
* status of the failure callback
|
|
503
|
+
*/
|
|
504
|
+
failureCallbackInfo?: FailureCallbackInfo;
|
|
505
|
+
/**
|
|
506
|
+
* label passed when triggering workflow
|
|
507
|
+
*/
|
|
508
|
+
label?: string;
|
|
404
509
|
};
|
|
405
|
-
type PublicDLQMessage = Pick<DLQMessage, "header" | "body" | "maxRetries" | "notBefore" | "createdAt" | "callerIP" | "workflowRunId" | "workflowCreatedAt" | "workflowUrl" | "responseStatus" | "responseHeader" | "responseBody" | "dlqId">;
|
|
510
|
+
type PublicDLQMessage = Pick<DLQMessage, "header" | "body" | "maxRetries" | "notBefore" | "createdAt" | "callerIP" | "workflowRunId" | "workflowCreatedAt" | "workflowUrl" | "responseStatus" | "responseHeader" | "responseBody" | "dlqId" | "failureCallback" | "failureCallbackInfo" | "label">;
|
|
406
511
|
declare class DLQ {
|
|
407
512
|
private client;
|
|
408
513
|
constructor(client: Client$1);
|
|
@@ -515,6 +620,16 @@ declare class DLQ {
|
|
|
515
620
|
*/
|
|
516
621
|
restart(parameters: DLQResumeRestartOptions<string>): Promise<DLQResumeRestartResponse>;
|
|
517
622
|
restart(parameters: DLQResumeRestartOptions<string[]>): Promise<DLQResumeRestartResponse[]>;
|
|
623
|
+
/**
|
|
624
|
+
* Retry the failure callback of a workflow run whose failureUrl/failureFunction
|
|
625
|
+
* request has failed.
|
|
626
|
+
*
|
|
627
|
+
* @param dlqId - The ID of the DLQ message to retry.
|
|
628
|
+
* @returns
|
|
629
|
+
*/
|
|
630
|
+
retryFailureFunction({ dlqId }: Pick<DLQResumeRestartOptions<string>, "dlqId">): Promise<DLQResumeRestartResponse & {
|
|
631
|
+
error?: string;
|
|
632
|
+
}>;
|
|
518
633
|
private static handleDLQOptions;
|
|
519
634
|
private static getDlqIdQueryParameter;
|
|
520
635
|
}
|
|
@@ -640,6 +755,7 @@ declare class Client {
|
|
|
640
755
|
* headers: { ... }, // Optional headers
|
|
641
756
|
* workflowRunId: "my-workflow", // Optional workflow run ID
|
|
642
757
|
* retries: 3 // Optional retries for the initial request
|
|
758
|
+
* retryDelay: "1000" // Optional retry delay for the delay between retries
|
|
643
759
|
* });
|
|
644
760
|
*
|
|
645
761
|
* console.log(workflowRunId)
|
|
@@ -654,6 +770,7 @@ declare class Client {
|
|
|
654
770
|
* headers: { ... }, // Optional headers
|
|
655
771
|
* workflowRunId: "my-workflow", // Optional workflow run ID
|
|
656
772
|
* retries: 3 // Optional retries for the initial request
|
|
773
|
+
* retryDelay: "1000" // Optional retry delay for the delay between retries
|
|
657
774
|
* },
|
|
658
775
|
* {
|
|
659
776
|
* url: "https://workflow-endpoint-2.com",
|
|
@@ -661,6 +778,7 @@ declare class Client {
|
|
|
661
778
|
* headers: { ... }, // Optional headers
|
|
662
779
|
* workflowRunId: "my-workflow-2", // Optional workflow run ID
|
|
663
780
|
* retries: 5 // Optional retries for the initial request
|
|
781
|
+
* retryDelay: "1000" // Optional retry delay for the delay between retries
|
|
664
782
|
* },
|
|
665
783
|
* ]);
|
|
666
784
|
*
|
|
@@ -681,6 +799,7 @@ declare class Client {
|
|
|
681
799
|
* with `wfr_`.
|
|
682
800
|
* @param retries retry to use in the initial request. in the rest of
|
|
683
801
|
* the workflow, `retries` option of the `serve` will be used.
|
|
802
|
+
* @param retryDelay delay between retries.
|
|
684
803
|
* @param flowControl Settings for controlling the number of active requests
|
|
685
804
|
* and number of requests per second with the same key.
|
|
686
805
|
* @param delay Delay for the workflow run. This is used to delay the
|
|
@@ -728,8 +847,9 @@ declare class Client {
|
|
|
728
847
|
state?: WorkflowRunLog["workflowState"];
|
|
729
848
|
workflowUrl?: WorkflowRunLog["workflowUrl"];
|
|
730
849
|
workflowCreatedAt?: WorkflowRunLog["workflowRunCreatedAt"];
|
|
850
|
+
label?: WorkflowRunLog["label"];
|
|
731
851
|
}): Promise<WorkflowRunLogs>;
|
|
732
852
|
get dlq(): DLQ;
|
|
733
853
|
}
|
|
734
854
|
|
|
735
|
-
export { Client, type DLQResumeRestartOptions, type DLQResumeRestartResponse, ExclusiveValidationOptions, NotifyResponse, RawStep, RouteFunction, type StepLog, StepType, Telemetry, type TriggerOptions, Waiter, type WorkflowRunLog, type WorkflowRunLogs, WorkflowServeOptions, serve };
|
|
855
|
+
export { Client, type DLQResumeRestartOptions, type DLQResumeRestartResponse, ExclusiveValidationOptions, NotifyResponse, RawStep, RouteFunction, type StepError, type StepLog, StepType, Telemetry, type TriggerOptions, Waiter, type WorkflowRunLog, type WorkflowRunLogs, WorkflowServeOptions, serve };
|