@upstash/workflow 0.2.7 → 0.2.8-rc-invoke
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 +8 -3
- package/astro.d.ts +8 -3
- package/astro.js +238 -65
- package/astro.mjs +33 -7
- package/{chunk-U6XFLG7W.mjs → chunk-IWAW7GIG.mjs} +103 -38
- package/chunk-LCZMBGEM.mjs +95 -0
- package/cloudflare.d.mts +9 -4
- package/cloudflare.d.ts +9 -4
- package/cloudflare.js +241 -71
- package/cloudflare.mjs +36 -13
- package/express.d.mts +7 -3
- package/express.d.ts +7 -3
- package/express.js +248 -68
- package/express.mjs +41 -10
- package/h3.d.mts +9 -7
- package/h3.d.ts +9 -7
- package/h3.js +249 -78
- package/h3.mjs +44 -20
- package/hono.d.mts +10 -4
- package/hono.d.ts +10 -4
- package/hono.js +240 -73
- package/hono.mjs +35 -15
- package/index.d.mts +17 -4
- package/index.d.ts +17 -4
- package/index.js +102 -38
- package/index.mjs +2 -2
- package/nextjs.d.mts +14 -5
- package/nextjs.d.ts +14 -5
- package/nextjs.js +249 -52
- package/nextjs.mjs +64 -16
- package/package.json +1 -1
- package/serve-many-BlBvXfBS.d.mts +10 -0
- package/serve-many-Dw-UUnH6.d.ts +10 -0
- package/solidjs.d.mts +3 -3
- package/solidjs.d.ts +3 -3
- package/solidjs.js +107 -46
- package/solidjs.mjs +7 -10
- package/svelte.d.mts +12 -4
- package/svelte.d.ts +12 -4
- package/svelte.js +240 -71
- package/svelte.mjs +35 -13
- package/{types-Cuqlx2Cr.d.mts → types-C7Y7WUQd.d.mts} +31 -3
- package/{types-Cuqlx2Cr.d.ts → types-C7Y7WUQd.d.ts} +31 -3
|
@@ -33,6 +33,11 @@ declare abstract class BaseLazyStep<TResult = unknown> {
|
|
|
33
33
|
*/
|
|
34
34
|
abstract getResultStep(concurrent: number, stepId: number): Promise<Step<TResult>>;
|
|
35
35
|
}
|
|
36
|
+
type LazyInvokeStepParams<TInitiaPayload, TResult> = {
|
|
37
|
+
workflow: Pick<InvokableWorkflow<TInitiaPayload, TResult, unknown[]>, "callback" | "workflowId">;
|
|
38
|
+
body: TInitiaPayload;
|
|
39
|
+
workflowRunId?: string;
|
|
40
|
+
} & Pick<CallSettings, "retries" | "headers">;
|
|
36
41
|
|
|
37
42
|
declare const LOG_LEVELS: readonly ["DEBUG", "INFO", "SUBMIT", "WARN", "ERROR"];
|
|
38
43
|
type LogLevel = (typeof LOG_LEVELS)[number];
|
|
@@ -917,6 +922,11 @@ declare class WorkflowContext<TInitialPayload = unknown> {
|
|
|
917
922
|
* @returns notify response which has event id, event data and list of waiters which were notified
|
|
918
923
|
*/
|
|
919
924
|
notify(stepName: string, eventId: string, eventData: unknown): Promise<NotifyStepResponse>;
|
|
925
|
+
invoke<TInitialPayload, TResult>(stepName: string, settings: LazyInvokeStepParams<TInitialPayload, TResult>): Promise<{
|
|
926
|
+
body: any;
|
|
927
|
+
isCanceled?: boolean;
|
|
928
|
+
isFailed?: boolean;
|
|
929
|
+
}>;
|
|
920
930
|
/**
|
|
921
931
|
* Cancel the current workflow run
|
|
922
932
|
*
|
|
@@ -952,7 +962,7 @@ type WorkflowClient = {
|
|
|
952
962
|
type WorkflowReceiver = {
|
|
953
963
|
verify: InstanceType<typeof Receiver>["verify"];
|
|
954
964
|
};
|
|
955
|
-
declare const StepTypes: readonly ["Initial", "Run", "SleepFor", "SleepUntil", "Call", "Wait", "Notify"];
|
|
965
|
+
declare const StepTypes: readonly ["Initial", "Run", "SleepFor", "SleepUntil", "Call", "Wait", "Notify", "Invoke"];
|
|
956
966
|
type StepType = (typeof StepTypes)[number];
|
|
957
967
|
type ThirdPartyCallFields<TBody = unknown> = {
|
|
958
968
|
/**
|
|
@@ -1035,7 +1045,7 @@ type SyncStepFunction<TResult> = () => TResult;
|
|
|
1035
1045
|
type AsyncStepFunction<TResult> = () => Promise<TResult>;
|
|
1036
1046
|
type StepFunction<TResult> = AsyncStepFunction<TResult> | SyncStepFunction<TResult>;
|
|
1037
1047
|
type ParallelCallState = "first" | "partial" | "discard" | "last";
|
|
1038
|
-
type RouteFunction<TInitialPayload> = (context: WorkflowContext<TInitialPayload>) => Promise<
|
|
1048
|
+
type RouteFunction<TInitialPayload, TResult = unknown> = (context: WorkflowContext<TInitialPayload>) => Promise<TResult>;
|
|
1039
1049
|
type FinishCondition = "success" | "duplicate-step" | "fromCallback" | "auth-fail" | "failure-callback" | "workflow-already-ended";
|
|
1040
1050
|
type WorkflowServeOptions<TResponse extends Response = Response, TInitialPayload = unknown> = ValidationOptions<TInitialPayload> & {
|
|
1041
1051
|
/**
|
|
@@ -1312,5 +1322,23 @@ type HeaderParams = {
|
|
|
1312
1322
|
*/
|
|
1313
1323
|
callTimeout?: never;
|
|
1314
1324
|
});
|
|
1325
|
+
type InvokeWorkflowRequest = {
|
|
1326
|
+
workflowUrl: string;
|
|
1327
|
+
workflowRunId: string;
|
|
1328
|
+
headers: Record<string, string[]>;
|
|
1329
|
+
step: Step;
|
|
1330
|
+
body: string;
|
|
1331
|
+
};
|
|
1332
|
+
type InvokeStepResponse<TBody> = {
|
|
1333
|
+
body: TBody;
|
|
1334
|
+
isCanceled?: boolean;
|
|
1335
|
+
isFailed?: boolean;
|
|
1336
|
+
};
|
|
1337
|
+
type InvokeCallback<TInitiaPayload, TResult> = (settings: LazyInvokeStepParams<TInitiaPayload, TResult>, invokeStep: Step, context: WorkflowContext) => Promise<TResult>;
|
|
1338
|
+
type InvokableWorkflow<TInitialPayload, TResult, THandlerParams extends unknown[]> = {
|
|
1339
|
+
handler: (...args: THandlerParams) => any;
|
|
1340
|
+
callback: InvokeCallback<TInitialPayload, TResult>;
|
|
1341
|
+
workflowId?: string;
|
|
1342
|
+
};
|
|
1315
1343
|
|
|
1316
|
-
export { type AsyncStepFunction as A, type CallResponse as C, type Duration as D, type ExclusiveValidationOptions as E, type FinishCondition as F, type HeaderParams as H, type LogLevel as L, type NotifyResponse as N, type ParallelCallState as P, type RouteFunction as R, type Step as S, type Telemetry as T, type WorkflowServeOptions as W, type Waiter as a, WorkflowContext as b, type WorkflowClient as c, type WorkflowReceiver as d, StepTypes as e, type StepType as f, type RawStep as g, type SyncStepFunction as h, type StepFunction as i, type PublicServeOptions as j, type FailureFunctionPayload as k, type RequiredExceptFields as l, type WaitRequest as m, type WaitStepResponse as n, type NotifyStepResponse as o, type WaitEventOptions as p, type CallSettings as q, type
|
|
1344
|
+
export { type AsyncStepFunction as A, type CallResponse as C, type Duration as D, type ExclusiveValidationOptions as E, type FinishCondition as F, type HeaderParams as H, type InvokeWorkflowRequest as I, type LogLevel as L, type NotifyResponse as N, type ParallelCallState as P, type RouteFunction as R, type Step as S, type Telemetry as T, type WorkflowServeOptions as W, type Waiter as a, WorkflowContext as b, type WorkflowClient as c, type WorkflowReceiver as d, StepTypes as e, type StepType as f, type RawStep as g, type SyncStepFunction as h, type StepFunction as i, type PublicServeOptions as j, type FailureFunctionPayload as k, type RequiredExceptFields as l, type WaitRequest as m, type WaitStepResponse as n, type NotifyStepResponse as o, type WaitEventOptions as p, type CallSettings as q, type InvokeStepResponse as r, type InvokeCallback as s, type InvokableWorkflow as t, type WorkflowLoggerOptions as u, WorkflowLogger as v };
|