@upstash/workflow 0.2.23 → 0.3.0-rc1
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 +4 -6
- package/astro.d.ts +4 -6
- package/astro.js +892 -960
- package/astro.mjs +1 -1
- package/{chunk-GZRDB6Z5.mjs → chunk-2Z32SOYM.mjs} +850 -951
- package/cloudflare.d.mts +4 -6
- package/cloudflare.d.ts +4 -6
- package/cloudflare.js +892 -960
- package/cloudflare.mjs +1 -1
- package/express.d.mts +4 -6
- package/express.d.ts +4 -6
- package/express.js +902 -965
- package/express.mjs +11 -6
- package/h3.d.mts +4 -6
- package/h3.d.ts +4 -6
- package/h3.js +906 -973
- package/h3.mjs +16 -15
- package/hono.d.mts +4 -6
- package/hono.d.ts +4 -6
- package/hono.js +892 -960
- package/hono.mjs +1 -1
- package/index.d.mts +98 -66
- package/index.d.ts +98 -66
- package/index.js +886 -978
- package/index.mjs +30 -23
- package/nextjs.d.mts +6 -8
- package/nextjs.d.ts +6 -8
- package/nextjs.js +893 -961
- package/nextjs.mjs +2 -2
- package/package.json +1 -1
- package/{serve-many-BCV7INWe.d.ts → serve-many-DhB8-zPD.d.mts} +2 -2
- package/{serve-many-B5Vbacm6.d.mts → serve-many-qnfynN1x.d.ts} +2 -2
- package/solidjs.d.mts +2 -4
- package/solidjs.d.ts +2 -4
- package/solidjs.js +860 -924
- package/solidjs.mjs +6 -2
- package/svelte.d.mts +7 -10
- package/svelte.d.ts +7 -10
- package/svelte.js +905 -966
- package/svelte.mjs +14 -7
- package/tanstack.d.mts +4 -6
- package/tanstack.d.ts +4 -6
- package/tanstack.js +892 -960
- package/tanstack.mjs +1 -1
- package/{types-BD06btU6.d.ts → types-pEje3VEB.d.mts} +193 -537
- package/{types-BD06btU6.d.mts → types-pEje3VEB.d.ts} +193 -537
package/hono.mjs
CHANGED
package/index.d.mts
CHANGED
|
@@ -1,34 +1,7 @@
|
|
|
1
|
-
import { R as
|
|
2
|
-
export { A as AsyncStepFunction, C as CallResponse,
|
|
3
|
-
import { FlowControl, PublishRequest,
|
|
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-pEje3VEB.mjs';
|
|
2
|
+
export { A as AsyncStepFunction, C as CallResponse, v as CallSettings, D as DetailedFinishCondition, t as Duration, E as ExclusiveValidationOptions, o as FailureFunctionPayload, F as FinishCondition, H as HeaderParams, x as InvokableWorkflow, w as InvokeStepResponse, I as InvokeWorkflowRequest, L as LazyInvokeStepParams, s as NotifyStepResponse, P as ParallelCallState, Q as QStashClientExtraConfig, p as RequiredExceptFields, l as Step, n as StepFunction, k as StepTypes, m as SyncStepFunction, u as WaitEventOptions, q as WaitRequest, r as WaitStepResponse, g as WorkflowAbort, j as WorkflowContext, f as WorkflowError, h as WorkflowNonRetryableError, i as WorkflowRetryAfterError } from './types-pEje3VEB.mjs';
|
|
3
|
+
import { HTTPMethods, FlowControl, PublishRequest, Client as Client$1 } from '@upstash/qstash';
|
|
4
4
|
import 'zod';
|
|
5
|
-
import 'ai';
|
|
6
|
-
import '@ai-sdk/openai';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Creates an async method that handles incoming requests and runs the provided
|
|
10
|
-
* route function as a workflow.
|
|
11
|
-
*
|
|
12
|
-
* Not exported in the package. Instead, used in framework specific serve implementations.
|
|
13
|
-
*
|
|
14
|
-
* Only difference from regular serve is the `useJSONContent` parameter.
|
|
15
|
-
*
|
|
16
|
-
* @param routeFunction - A function that uses WorkflowContext as a parameter and runs a workflow.
|
|
17
|
-
* @param options - Options including the client, onFinish callback, and initialPayloadParser.
|
|
18
|
-
* @returns An async method that consumes incoming requests and runs the workflow.
|
|
19
|
-
*/
|
|
20
|
-
declare const serveBase: <TInitialPayload = unknown, TRequest extends Request = Request, TResponse extends Response = Response, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, telemetry?: Telemetry, options?: WorkflowServeOptions<TResponse, TInitialPayload>) => {
|
|
21
|
-
handler: (request: TRequest) => Promise<TResponse>;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Creates an async method that handles incoming requests and runs the provided
|
|
25
|
-
* route function as a workflow.
|
|
26
|
-
*
|
|
27
|
-
* @param routeFunction - A function that uses WorkflowContext as a parameter and runs a workflow.
|
|
28
|
-
* @param options - Options including the client, onFinish callback, and initialPayloadParser.
|
|
29
|
-
* @returns An async method that consumes incoming requests and runs the workflow.
|
|
30
|
-
*/
|
|
31
|
-
declare const serve: <TInitialPayload = unknown, TRequest extends Request = Request, TResponse extends Response = Response, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: Omit<WorkflowServeOptions<TResponse, TInitialPayload>, "useJSONContent" | "schema" | "initialPayloadParser"> & ExclusiveValidationOptions<TInitialPayload>) => ReturnType<typeof serveBase<TInitialPayload, TRequest, TResponse, TResult>>;
|
|
32
5
|
|
|
33
6
|
type BaseStepLog = {
|
|
34
7
|
/**
|
|
@@ -241,7 +214,7 @@ type FailureFunctionLog = {
|
|
|
241
214
|
/**
|
|
242
215
|
* State of the message published for failure
|
|
243
216
|
*/
|
|
244
|
-
state:
|
|
217
|
+
state: "CALLBACK_INPROGRESS" | "CALLBACK_SUCCESS" | "CALLBACK_FAIL";
|
|
245
218
|
/**
|
|
246
219
|
* Headers received from the step which caused the workflow to fail
|
|
247
220
|
*/
|
|
@@ -432,13 +405,6 @@ type TriggerOptions = {
|
|
|
432
405
|
* Can be used to filter the workflow run logs.
|
|
433
406
|
*/
|
|
434
407
|
label?: string;
|
|
435
|
-
/**
|
|
436
|
-
* Whether to apply the configuration (flow control,
|
|
437
|
-
* retries, failure url, retry delay) passed in trigger
|
|
438
|
-
*
|
|
439
|
-
* @default false
|
|
440
|
-
*/
|
|
441
|
-
keepTriggerConfig?: boolean;
|
|
442
408
|
/**
|
|
443
409
|
* By default, Workflow SDK sends telemetry about SDK version, framework or runtime.
|
|
444
410
|
*
|
|
@@ -447,31 +413,11 @@ type TriggerOptions = {
|
|
|
447
413
|
* @default false
|
|
448
414
|
*/
|
|
449
415
|
disableTelemetry?: boolean;
|
|
450
|
-
} & ({
|
|
451
|
-
/**
|
|
452
|
-
* URL to call if the first request to the workflow endpoint fails
|
|
453
|
-
*/
|
|
454
|
-
failureUrl?: never;
|
|
455
|
-
/**
|
|
456
|
-
* Whether the workflow endpoint has a failure function
|
|
457
|
-
* defined to be invoked if the first request fails.
|
|
458
|
-
*
|
|
459
|
-
* If true, the failureUrl will be ignored.
|
|
460
|
-
*/
|
|
461
|
-
useFailureFunction?: true;
|
|
462
|
-
} | {
|
|
463
416
|
/**
|
|
464
417
|
* URL to call if the first request to the workflow endpoint fails
|
|
465
418
|
*/
|
|
466
419
|
failureUrl?: string;
|
|
467
|
-
|
|
468
|
-
* Whether the workflow endpoint has a failure function
|
|
469
|
-
* defined to be invoked if the first request fails.
|
|
470
|
-
*
|
|
471
|
-
* If true, the failureUrl will be ignored.
|
|
472
|
-
*/
|
|
473
|
-
useFailureFunction?: never;
|
|
474
|
-
});
|
|
420
|
+
};
|
|
475
421
|
type DLQResumeRestartOptions<TDLQId extends string | string[] = string | string[]> = {
|
|
476
422
|
dlqId: TDLQId;
|
|
477
423
|
} & Pick<TriggerOptions, "flowControl" | "retries">;
|
|
@@ -486,6 +432,78 @@ type DLQResumeRestartResponse = {
|
|
|
486
432
|
workflowCreatedAt: string;
|
|
487
433
|
};
|
|
488
434
|
|
|
435
|
+
declare const loggingMiddleware: WorkflowMiddleware<unknown, unknown>;
|
|
436
|
+
|
|
437
|
+
declare const VALID_REGIONS: readonly ["EU_CENTRAL_1", "US_EAST_1"];
|
|
438
|
+
type QStashRegion = (typeof VALID_REGIONS)[number];
|
|
439
|
+
/**
|
|
440
|
+
* Regional handler containing client and optional receiver
|
|
441
|
+
*/
|
|
442
|
+
type RegionalHandler = {
|
|
443
|
+
client: WorkflowClient;
|
|
444
|
+
receiver?: WorkflowReceiver;
|
|
445
|
+
};
|
|
446
|
+
/**
|
|
447
|
+
* QStash handlers for single or multi-region mode
|
|
448
|
+
*/
|
|
449
|
+
type QStashHandlers = {
|
|
450
|
+
mode: "single-region";
|
|
451
|
+
handlers: RegionalHandler;
|
|
452
|
+
} | {
|
|
453
|
+
mode: "multi-region";
|
|
454
|
+
handlers: Record<QStashRegion, RegionalHandler>;
|
|
455
|
+
defaultRegion: QStashRegion;
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
type ResponseData = {
|
|
459
|
+
text: string;
|
|
460
|
+
status: number;
|
|
461
|
+
headers: Record<string, string>;
|
|
462
|
+
};
|
|
463
|
+
/**
|
|
464
|
+
* Internal options for serveBase that are not exposed to users
|
|
465
|
+
*/
|
|
466
|
+
type InternalServeOptions<TResponse extends Response = Response> = {
|
|
467
|
+
/**
|
|
468
|
+
* Function to generate a Response from ResponseData
|
|
469
|
+
*/
|
|
470
|
+
generateResponse: (responseData: ResponseData) => TResponse;
|
|
471
|
+
/**
|
|
472
|
+
* Whether the framework should use `content-type: application/json`
|
|
473
|
+
* in `triggerFirstInvocation`.
|
|
474
|
+
*/
|
|
475
|
+
useJSONContent: boolean;
|
|
476
|
+
/**
|
|
477
|
+
* QStash handlers for single or multi-region mode
|
|
478
|
+
*/
|
|
479
|
+
qstashHandlers: QStashHandlers;
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Creates an async method that handles incoming requests and runs the provided
|
|
484
|
+
* route function as a workflow.
|
|
485
|
+
*
|
|
486
|
+
* Not exported in the package. Instead, used in framework specific serve implementations.
|
|
487
|
+
*
|
|
488
|
+
* Only difference from regular serve is the `useJSONContent` parameter.
|
|
489
|
+
*
|
|
490
|
+
* @param routeFunction - A function that uses WorkflowContext as a parameter and runs a workflow.
|
|
491
|
+
* @param options - Options including the client, onFinish callback, and initialPayloadParser.
|
|
492
|
+
* @returns An async method that consumes incoming requests and runs the workflow.
|
|
493
|
+
*/
|
|
494
|
+
declare const serveBase: <TInitialPayload = unknown, TRequest extends Request = Request, TResponse extends Response = Response, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, telemetry?: Telemetry, options?: WorkflowServeOptions<TInitialPayload, TResult>, internalOptions?: Partial<InternalServeOptions<TResponse>>) => {
|
|
495
|
+
handler: (request: TRequest) => Promise<TResponse>;
|
|
496
|
+
};
|
|
497
|
+
/**
|
|
498
|
+
* Creates an async method that handles incoming requests and runs the provided
|
|
499
|
+
* route function as a workflow.
|
|
500
|
+
*
|
|
501
|
+
* @param routeFunction - A function that uses WorkflowContext as a parameter and runs a workflow.
|
|
502
|
+
* @param options - Options including the client and initialPayloadParser.
|
|
503
|
+
* @returns An async method that consumes incoming requests and runs the workflow.
|
|
504
|
+
*/
|
|
505
|
+
declare const serve: <TInitialPayload = unknown, TRequest extends Request = Request, TResponse extends Response = Response, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: WorkflowServeOptions<TInitialPayload, TResult>) => ReturnType<typeof serveBase<TInitialPayload, TRequest, TResponse, TResult>>;
|
|
506
|
+
|
|
489
507
|
type QStashDLQFilterOptions = NonNullable<Required<Parameters<Client$1["dlq"]["listMessages"]>[0]>>["filter"];
|
|
490
508
|
type DLQFilterOptions = Pick<QStashDLQFilterOptions, "fromDate" | "toDate" | "url" | "responseStatus"> & {
|
|
491
509
|
workflowRunId?: string;
|
|
@@ -539,15 +557,19 @@ declare class DLQ {
|
|
|
539
557
|
/**
|
|
540
558
|
* list the items in the DLQ
|
|
541
559
|
*
|
|
542
|
-
* @param
|
|
543
|
-
* @param
|
|
544
|
-
* @param
|
|
560
|
+
* @param parameters - Optional parameters object
|
|
561
|
+
* @param parameters.cursor - Optional cursor for pagination
|
|
562
|
+
* @param parameters.count - Optional number of items to return
|
|
563
|
+
* @param parameters.filter - Optional filter options to apply to the DLQ items.
|
|
545
564
|
* The available filter options are:
|
|
546
565
|
* - `fromDate`: Filter items which entered the DLQ after this date.
|
|
547
566
|
* - `toDate`: Filter items which entered the DLQ before this date.
|
|
548
567
|
* - `url`: Filter items by the URL they were sent to.
|
|
549
568
|
* - `responseStatus`: Filter items by the response status code.
|
|
550
|
-
*
|
|
569
|
+
* - `workflowRunId`: Filter items by workflow run ID.
|
|
570
|
+
* - `workflowCreatedAt`: Filter items by workflow creation time.
|
|
571
|
+
* - `failureFunctionState`: Filter items by failure callback state.
|
|
572
|
+
* - `label`: Filter items by label.
|
|
551
573
|
*/
|
|
552
574
|
list(parameters?: {
|
|
553
575
|
cursor?: string;
|
|
@@ -649,13 +671,23 @@ declare class DLQ {
|
|
|
649
671
|
* Retry the failure callback of a workflow run whose failureUrl/failureFunction
|
|
650
672
|
* request has failed.
|
|
651
673
|
*
|
|
652
|
-
* @param dlqId - The ID of the DLQ message to retry
|
|
653
|
-
* @returns
|
|
674
|
+
* @param dlqId - The ID of the DLQ message to retry
|
|
675
|
+
* @returns response with workflow run information
|
|
654
676
|
*/
|
|
655
677
|
retryFailureFunction({ dlqId }: Pick<DLQResumeRestartOptions<string>, "dlqId">): Promise<DLQResumeRestartResponse & {
|
|
656
678
|
error?: string;
|
|
657
679
|
}>;
|
|
680
|
+
/**
|
|
681
|
+
* Handles DLQ options and prepares headers and query parameters.
|
|
682
|
+
*
|
|
683
|
+
* @param options - DLQ resume/restart options
|
|
684
|
+
*/
|
|
658
685
|
private static handleDLQOptions;
|
|
686
|
+
/**
|
|
687
|
+
* Converts DLQ ID(s) to query parameter string.
|
|
688
|
+
*
|
|
689
|
+
* @param dlqId - Single DLQ ID or array of DLQ IDs
|
|
690
|
+
*/
|
|
659
691
|
private static getDlqIdQueryParameter;
|
|
660
692
|
}
|
|
661
693
|
|
|
@@ -877,4 +909,4 @@ declare class Client {
|
|
|
877
909
|
get dlq(): DLQ;
|
|
878
910
|
}
|
|
879
911
|
|
|
880
|
-
export { Client, type DLQResumeRestartOptions, type DLQResumeRestartResponse,
|
|
912
|
+
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 };
|
package/index.d.ts
CHANGED
|
@@ -1,34 +1,7 @@
|
|
|
1
|
-
import { R as
|
|
2
|
-
export { A as AsyncStepFunction, C as CallResponse,
|
|
3
|
-
import { FlowControl, PublishRequest,
|
|
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-pEje3VEB.js';
|
|
2
|
+
export { A as AsyncStepFunction, C as CallResponse, v as CallSettings, D as DetailedFinishCondition, t as Duration, E as ExclusiveValidationOptions, o as FailureFunctionPayload, F as FinishCondition, H as HeaderParams, x as InvokableWorkflow, w as InvokeStepResponse, I as InvokeWorkflowRequest, L as LazyInvokeStepParams, s as NotifyStepResponse, P as ParallelCallState, Q as QStashClientExtraConfig, p as RequiredExceptFields, l as Step, n as StepFunction, k as StepTypes, m as SyncStepFunction, u as WaitEventOptions, q as WaitRequest, r as WaitStepResponse, g as WorkflowAbort, j as WorkflowContext, f as WorkflowError, h as WorkflowNonRetryableError, i as WorkflowRetryAfterError } from './types-pEje3VEB.js';
|
|
3
|
+
import { HTTPMethods, FlowControl, PublishRequest, Client as Client$1 } from '@upstash/qstash';
|
|
4
4
|
import 'zod';
|
|
5
|
-
import 'ai';
|
|
6
|
-
import '@ai-sdk/openai';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Creates an async method that handles incoming requests and runs the provided
|
|
10
|
-
* route function as a workflow.
|
|
11
|
-
*
|
|
12
|
-
* Not exported in the package. Instead, used in framework specific serve implementations.
|
|
13
|
-
*
|
|
14
|
-
* Only difference from regular serve is the `useJSONContent` parameter.
|
|
15
|
-
*
|
|
16
|
-
* @param routeFunction - A function that uses WorkflowContext as a parameter and runs a workflow.
|
|
17
|
-
* @param options - Options including the client, onFinish callback, and initialPayloadParser.
|
|
18
|
-
* @returns An async method that consumes incoming requests and runs the workflow.
|
|
19
|
-
*/
|
|
20
|
-
declare const serveBase: <TInitialPayload = unknown, TRequest extends Request = Request, TResponse extends Response = Response, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, telemetry?: Telemetry, options?: WorkflowServeOptions<TResponse, TInitialPayload>) => {
|
|
21
|
-
handler: (request: TRequest) => Promise<TResponse>;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Creates an async method that handles incoming requests and runs the provided
|
|
25
|
-
* route function as a workflow.
|
|
26
|
-
*
|
|
27
|
-
* @param routeFunction - A function that uses WorkflowContext as a parameter and runs a workflow.
|
|
28
|
-
* @param options - Options including the client, onFinish callback, and initialPayloadParser.
|
|
29
|
-
* @returns An async method that consumes incoming requests and runs the workflow.
|
|
30
|
-
*/
|
|
31
|
-
declare const serve: <TInitialPayload = unknown, TRequest extends Request = Request, TResponse extends Response = Response, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: Omit<WorkflowServeOptions<TResponse, TInitialPayload>, "useJSONContent" | "schema" | "initialPayloadParser"> & ExclusiveValidationOptions<TInitialPayload>) => ReturnType<typeof serveBase<TInitialPayload, TRequest, TResponse, TResult>>;
|
|
32
5
|
|
|
33
6
|
type BaseStepLog = {
|
|
34
7
|
/**
|
|
@@ -241,7 +214,7 @@ type FailureFunctionLog = {
|
|
|
241
214
|
/**
|
|
242
215
|
* State of the message published for failure
|
|
243
216
|
*/
|
|
244
|
-
state:
|
|
217
|
+
state: "CALLBACK_INPROGRESS" | "CALLBACK_SUCCESS" | "CALLBACK_FAIL";
|
|
245
218
|
/**
|
|
246
219
|
* Headers received from the step which caused the workflow to fail
|
|
247
220
|
*/
|
|
@@ -432,13 +405,6 @@ type TriggerOptions = {
|
|
|
432
405
|
* Can be used to filter the workflow run logs.
|
|
433
406
|
*/
|
|
434
407
|
label?: string;
|
|
435
|
-
/**
|
|
436
|
-
* Whether to apply the configuration (flow control,
|
|
437
|
-
* retries, failure url, retry delay) passed in trigger
|
|
438
|
-
*
|
|
439
|
-
* @default false
|
|
440
|
-
*/
|
|
441
|
-
keepTriggerConfig?: boolean;
|
|
442
408
|
/**
|
|
443
409
|
* By default, Workflow SDK sends telemetry about SDK version, framework or runtime.
|
|
444
410
|
*
|
|
@@ -447,31 +413,11 @@ type TriggerOptions = {
|
|
|
447
413
|
* @default false
|
|
448
414
|
*/
|
|
449
415
|
disableTelemetry?: boolean;
|
|
450
|
-
} & ({
|
|
451
|
-
/**
|
|
452
|
-
* URL to call if the first request to the workflow endpoint fails
|
|
453
|
-
*/
|
|
454
|
-
failureUrl?: never;
|
|
455
|
-
/**
|
|
456
|
-
* Whether the workflow endpoint has a failure function
|
|
457
|
-
* defined to be invoked if the first request fails.
|
|
458
|
-
*
|
|
459
|
-
* If true, the failureUrl will be ignored.
|
|
460
|
-
*/
|
|
461
|
-
useFailureFunction?: true;
|
|
462
|
-
} | {
|
|
463
416
|
/**
|
|
464
417
|
* URL to call if the first request to the workflow endpoint fails
|
|
465
418
|
*/
|
|
466
419
|
failureUrl?: string;
|
|
467
|
-
|
|
468
|
-
* Whether the workflow endpoint has a failure function
|
|
469
|
-
* defined to be invoked if the first request fails.
|
|
470
|
-
*
|
|
471
|
-
* If true, the failureUrl will be ignored.
|
|
472
|
-
*/
|
|
473
|
-
useFailureFunction?: never;
|
|
474
|
-
});
|
|
420
|
+
};
|
|
475
421
|
type DLQResumeRestartOptions<TDLQId extends string | string[] = string | string[]> = {
|
|
476
422
|
dlqId: TDLQId;
|
|
477
423
|
} & Pick<TriggerOptions, "flowControl" | "retries">;
|
|
@@ -486,6 +432,78 @@ type DLQResumeRestartResponse = {
|
|
|
486
432
|
workflowCreatedAt: string;
|
|
487
433
|
};
|
|
488
434
|
|
|
435
|
+
declare const loggingMiddleware: WorkflowMiddleware<unknown, unknown>;
|
|
436
|
+
|
|
437
|
+
declare const VALID_REGIONS: readonly ["EU_CENTRAL_1", "US_EAST_1"];
|
|
438
|
+
type QStashRegion = (typeof VALID_REGIONS)[number];
|
|
439
|
+
/**
|
|
440
|
+
* Regional handler containing client and optional receiver
|
|
441
|
+
*/
|
|
442
|
+
type RegionalHandler = {
|
|
443
|
+
client: WorkflowClient;
|
|
444
|
+
receiver?: WorkflowReceiver;
|
|
445
|
+
};
|
|
446
|
+
/**
|
|
447
|
+
* QStash handlers for single or multi-region mode
|
|
448
|
+
*/
|
|
449
|
+
type QStashHandlers = {
|
|
450
|
+
mode: "single-region";
|
|
451
|
+
handlers: RegionalHandler;
|
|
452
|
+
} | {
|
|
453
|
+
mode: "multi-region";
|
|
454
|
+
handlers: Record<QStashRegion, RegionalHandler>;
|
|
455
|
+
defaultRegion: QStashRegion;
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
type ResponseData = {
|
|
459
|
+
text: string;
|
|
460
|
+
status: number;
|
|
461
|
+
headers: Record<string, string>;
|
|
462
|
+
};
|
|
463
|
+
/**
|
|
464
|
+
* Internal options for serveBase that are not exposed to users
|
|
465
|
+
*/
|
|
466
|
+
type InternalServeOptions<TResponse extends Response = Response> = {
|
|
467
|
+
/**
|
|
468
|
+
* Function to generate a Response from ResponseData
|
|
469
|
+
*/
|
|
470
|
+
generateResponse: (responseData: ResponseData) => TResponse;
|
|
471
|
+
/**
|
|
472
|
+
* Whether the framework should use `content-type: application/json`
|
|
473
|
+
* in `triggerFirstInvocation`.
|
|
474
|
+
*/
|
|
475
|
+
useJSONContent: boolean;
|
|
476
|
+
/**
|
|
477
|
+
* QStash handlers for single or multi-region mode
|
|
478
|
+
*/
|
|
479
|
+
qstashHandlers: QStashHandlers;
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Creates an async method that handles incoming requests and runs the provided
|
|
484
|
+
* route function as a workflow.
|
|
485
|
+
*
|
|
486
|
+
* Not exported in the package. Instead, used in framework specific serve implementations.
|
|
487
|
+
*
|
|
488
|
+
* Only difference from regular serve is the `useJSONContent` parameter.
|
|
489
|
+
*
|
|
490
|
+
* @param routeFunction - A function that uses WorkflowContext as a parameter and runs a workflow.
|
|
491
|
+
* @param options - Options including the client, onFinish callback, and initialPayloadParser.
|
|
492
|
+
* @returns An async method that consumes incoming requests and runs the workflow.
|
|
493
|
+
*/
|
|
494
|
+
declare const serveBase: <TInitialPayload = unknown, TRequest extends Request = Request, TResponse extends Response = Response, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, telemetry?: Telemetry, options?: WorkflowServeOptions<TInitialPayload, TResult>, internalOptions?: Partial<InternalServeOptions<TResponse>>) => {
|
|
495
|
+
handler: (request: TRequest) => Promise<TResponse>;
|
|
496
|
+
};
|
|
497
|
+
/**
|
|
498
|
+
* Creates an async method that handles incoming requests and runs the provided
|
|
499
|
+
* route function as a workflow.
|
|
500
|
+
*
|
|
501
|
+
* @param routeFunction - A function that uses WorkflowContext as a parameter and runs a workflow.
|
|
502
|
+
* @param options - Options including the client and initialPayloadParser.
|
|
503
|
+
* @returns An async method that consumes incoming requests and runs the workflow.
|
|
504
|
+
*/
|
|
505
|
+
declare const serve: <TInitialPayload = unknown, TRequest extends Request = Request, TResponse extends Response = Response, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: WorkflowServeOptions<TInitialPayload, TResult>) => ReturnType<typeof serveBase<TInitialPayload, TRequest, TResponse, TResult>>;
|
|
506
|
+
|
|
489
507
|
type QStashDLQFilterOptions = NonNullable<Required<Parameters<Client$1["dlq"]["listMessages"]>[0]>>["filter"];
|
|
490
508
|
type DLQFilterOptions = Pick<QStashDLQFilterOptions, "fromDate" | "toDate" | "url" | "responseStatus"> & {
|
|
491
509
|
workflowRunId?: string;
|
|
@@ -539,15 +557,19 @@ declare class DLQ {
|
|
|
539
557
|
/**
|
|
540
558
|
* list the items in the DLQ
|
|
541
559
|
*
|
|
542
|
-
* @param
|
|
543
|
-
* @param
|
|
544
|
-
* @param
|
|
560
|
+
* @param parameters - Optional parameters object
|
|
561
|
+
* @param parameters.cursor - Optional cursor for pagination
|
|
562
|
+
* @param parameters.count - Optional number of items to return
|
|
563
|
+
* @param parameters.filter - Optional filter options to apply to the DLQ items.
|
|
545
564
|
* The available filter options are:
|
|
546
565
|
* - `fromDate`: Filter items which entered the DLQ after this date.
|
|
547
566
|
* - `toDate`: Filter items which entered the DLQ before this date.
|
|
548
567
|
* - `url`: Filter items by the URL they were sent to.
|
|
549
568
|
* - `responseStatus`: Filter items by the response status code.
|
|
550
|
-
*
|
|
569
|
+
* - `workflowRunId`: Filter items by workflow run ID.
|
|
570
|
+
* - `workflowCreatedAt`: Filter items by workflow creation time.
|
|
571
|
+
* - `failureFunctionState`: Filter items by failure callback state.
|
|
572
|
+
* - `label`: Filter items by label.
|
|
551
573
|
*/
|
|
552
574
|
list(parameters?: {
|
|
553
575
|
cursor?: string;
|
|
@@ -649,13 +671,23 @@ declare class DLQ {
|
|
|
649
671
|
* Retry the failure callback of a workflow run whose failureUrl/failureFunction
|
|
650
672
|
* request has failed.
|
|
651
673
|
*
|
|
652
|
-
* @param dlqId - The ID of the DLQ message to retry
|
|
653
|
-
* @returns
|
|
674
|
+
* @param dlqId - The ID of the DLQ message to retry
|
|
675
|
+
* @returns response with workflow run information
|
|
654
676
|
*/
|
|
655
677
|
retryFailureFunction({ dlqId }: Pick<DLQResumeRestartOptions<string>, "dlqId">): Promise<DLQResumeRestartResponse & {
|
|
656
678
|
error?: string;
|
|
657
679
|
}>;
|
|
680
|
+
/**
|
|
681
|
+
* Handles DLQ options and prepares headers and query parameters.
|
|
682
|
+
*
|
|
683
|
+
* @param options - DLQ resume/restart options
|
|
684
|
+
*/
|
|
658
685
|
private static handleDLQOptions;
|
|
686
|
+
/**
|
|
687
|
+
* Converts DLQ ID(s) to query parameter string.
|
|
688
|
+
*
|
|
689
|
+
* @param dlqId - Single DLQ ID or array of DLQ IDs
|
|
690
|
+
*/
|
|
659
691
|
private static getDlqIdQueryParameter;
|
|
660
692
|
}
|
|
661
693
|
|
|
@@ -877,4 +909,4 @@ declare class Client {
|
|
|
877
909
|
get dlq(): DLQ;
|
|
878
910
|
}
|
|
879
911
|
|
|
880
|
-
export { Client, type DLQResumeRestartOptions, type DLQResumeRestartResponse,
|
|
912
|
+
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 };
|