@upstash/workflow 0.2.8 → 0.2.10-hono-generics
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 +393 -82
- package/astro.mjs +36 -8
- package/{chunk-BPUSHNSD.mjs → chunk-IPXJZU3K.mjs} +1226 -943
- package/cloudflare.d.mts +9 -4
- package/cloudflare.d.ts +9 -4
- package/cloudflare.js +392 -88
- package/cloudflare.mjs +35 -14
- package/express.d.mts +7 -3
- package/express.d.ts +7 -3
- package/express.js +400 -92
- package/express.mjs +43 -18
- package/h3.d.mts +9 -7
- package/h3.d.ts +9 -7
- package/h3.js +397 -95
- package/h3.mjs +40 -21
- package/hono.d.mts +10 -4
- package/hono.d.ts +10 -4
- package/hono.js +391 -90
- package/hono.mjs +34 -16
- package/index.d.mts +47 -33
- package/index.d.ts +47 -33
- package/index.js +315 -92
- package/index.mjs +32 -30
- package/nextjs.d.mts +14 -5
- package/nextjs.d.ts +14 -5
- package/nextjs.js +408 -77
- package/nextjs.mjs +63 -17
- package/package.json +1 -1
- package/serve-many-BVDpPsF-.d.mts +13 -0
- package/serve-many-e4zufyXN.d.ts +13 -0
- package/solidjs.d.mts +3 -3
- package/solidjs.d.ts +3 -3
- package/solidjs.js +289 -71
- package/solidjs.mjs +7 -10
- package/svelte.d.mts +13 -6
- package/svelte.d.ts +13 -6
- package/svelte.js +391 -88
- package/svelte.mjs +34 -14
- package/{types-B62AnIU3.d.mts → types-CYhDXnf8.d.mts} +74 -8
- package/{types-B62AnIU3.d.ts → types-CYhDXnf8.d.ts} +74 -8
package/svelte.mjs
CHANGED
|
@@ -1,26 +1,46 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SDK_TELEMETRY,
|
|
3
|
-
serveBase
|
|
4
|
-
|
|
3
|
+
serveBase,
|
|
4
|
+
serveManyBase
|
|
5
|
+
} from "./chunk-IPXJZU3K.mjs";
|
|
5
6
|
|
|
6
7
|
// platforms/svelte.ts
|
|
8
|
+
var telemetry = {
|
|
9
|
+
sdk: SDK_TELEMETRY,
|
|
10
|
+
framework: "svelte"
|
|
11
|
+
};
|
|
7
12
|
var serve = (routeFunction, options) => {
|
|
8
13
|
const handler = async ({ request }) => {
|
|
9
|
-
const { handler: serveHandler } = serveBase(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
framework: "svelte"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
...options,
|
|
17
|
-
useJSONContent: true
|
|
18
|
-
}
|
|
19
|
-
);
|
|
14
|
+
const { handler: serveHandler } = serveBase(routeFunction, telemetry, {
|
|
15
|
+
...options,
|
|
16
|
+
useJSONContent: true
|
|
17
|
+
});
|
|
20
18
|
return await serveHandler(request);
|
|
21
19
|
};
|
|
22
20
|
return { POST: handler };
|
|
23
21
|
};
|
|
22
|
+
var createWorkflow = (...params) => {
|
|
23
|
+
const [routeFunction, options = {}] = params;
|
|
24
|
+
return {
|
|
25
|
+
workflowId: void 0,
|
|
26
|
+
routeFunction,
|
|
27
|
+
options
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
var serveMany = (workflows, options) => {
|
|
31
|
+
return {
|
|
32
|
+
POST: serveManyBase({
|
|
33
|
+
workflows,
|
|
34
|
+
getUrl(params) {
|
|
35
|
+
return params.url.toString();
|
|
36
|
+
},
|
|
37
|
+
options,
|
|
38
|
+
serveMethod: (...params) => serve(...params).POST
|
|
39
|
+
}).handler
|
|
40
|
+
};
|
|
41
|
+
};
|
|
24
42
|
export {
|
|
25
|
-
|
|
43
|
+
createWorkflow,
|
|
44
|
+
serve,
|
|
45
|
+
serveMany
|
|
26
46
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PublishRequest, Client, Receiver, HTTPMethods as HTTPMethods$1 } from '@upstash/qstash';
|
|
1
|
+
import { PublishRequest, FlowControl, Client, Receiver, HTTPMethods as HTTPMethods$1 } from '@upstash/qstash';
|
|
2
2
|
import { ZodType, z } from 'zod';
|
|
3
3
|
import * as ai from 'ai';
|
|
4
4
|
import { CoreTool, generateText } from 'ai';
|
|
@@ -67,11 +67,12 @@ declare class AutoExecutor {
|
|
|
67
67
|
private readonly nonPlanStepCount;
|
|
68
68
|
private readonly steps;
|
|
69
69
|
private indexInCurrentList;
|
|
70
|
+
private invokeCount;
|
|
70
71
|
private telemetry?;
|
|
71
72
|
stepCount: number;
|
|
72
73
|
planStepCount: number;
|
|
73
74
|
protected executingStep: string | false;
|
|
74
|
-
constructor(context: WorkflowContext, steps: Step[], telemetry?: Telemetry, debug?: WorkflowLogger);
|
|
75
|
+
constructor(context: WorkflowContext, steps: Step[], telemetry?: Telemetry, invokeCount?: number, debug?: WorkflowLogger);
|
|
75
76
|
/**
|
|
76
77
|
* Adds the step function to the list of step functions to run in
|
|
77
78
|
* parallel. After adding the function, defers the execution, so
|
|
@@ -815,7 +816,12 @@ declare class WorkflowContext<TInitialPayload = unknown> {
|
|
|
815
816
|
* Number of retries
|
|
816
817
|
*/
|
|
817
818
|
readonly retries: number;
|
|
818
|
-
|
|
819
|
+
/**
|
|
820
|
+
* Settings for controlling the number of active requests
|
|
821
|
+
* and number of requests per second with the same key.
|
|
822
|
+
*/
|
|
823
|
+
readonly flowControl?: FlowControl;
|
|
824
|
+
constructor({ qstashClient, workflowRunId, headers, steps, url, failureUrl, debug, initialPayload, env, retries, telemetry, invokeCount, flowControl, }: {
|
|
819
825
|
qstashClient: WorkflowClient;
|
|
820
826
|
workflowRunId: string;
|
|
821
827
|
headers: Headers;
|
|
@@ -827,6 +833,8 @@ declare class WorkflowContext<TInitialPayload = unknown> {
|
|
|
827
833
|
env?: Record<string, string | undefined>;
|
|
828
834
|
retries?: number;
|
|
829
835
|
telemetry?: Telemetry;
|
|
836
|
+
invokeCount?: number;
|
|
837
|
+
flowControl?: FlowControl;
|
|
830
838
|
});
|
|
831
839
|
/**
|
|
832
840
|
* Executes a workflow step
|
|
@@ -971,6 +979,11 @@ declare class WorkflowContext<TInitialPayload = unknown> {
|
|
|
971
979
|
* @returns notify response which has event id, event data and list of waiters which were notified
|
|
972
980
|
*/
|
|
973
981
|
notify(stepName: string, eventId: string, eventData: unknown): Promise<NotifyStepResponse>;
|
|
982
|
+
invoke<TInitialPayload, TResult>(stepName: string, settings: LazyInvokeStepParams<TInitialPayload, TResult>): Promise<{
|
|
983
|
+
body: TResult;
|
|
984
|
+
isCanceled?: boolean;
|
|
985
|
+
isFailed?: boolean;
|
|
986
|
+
}>;
|
|
974
987
|
/**
|
|
975
988
|
* Cancel the current workflow run
|
|
976
989
|
*
|
|
@@ -1006,7 +1019,7 @@ type WorkflowClient = {
|
|
|
1006
1019
|
type WorkflowReceiver = {
|
|
1007
1020
|
verify: InstanceType<typeof Receiver>["verify"];
|
|
1008
1021
|
};
|
|
1009
|
-
declare const StepTypes: readonly ["Initial", "Run", "SleepFor", "SleepUntil", "Call", "Wait", "Notify"];
|
|
1022
|
+
declare const StepTypes: readonly ["Initial", "Run", "SleepFor", "SleepUntil", "Call", "Wait", "Notify", "Invoke"];
|
|
1010
1023
|
type StepType = (typeof StepTypes)[number];
|
|
1011
1024
|
type ThirdPartyCallFields<TBody = unknown> = {
|
|
1012
1025
|
/**
|
|
@@ -1089,7 +1102,7 @@ type SyncStepFunction<TResult> = () => TResult;
|
|
|
1089
1102
|
type AsyncStepFunction<TResult> = () => Promise<TResult>;
|
|
1090
1103
|
type StepFunction<TResult> = AsyncStepFunction<TResult> | SyncStepFunction<TResult>;
|
|
1091
1104
|
type ParallelCallState = "first" | "partial" | "discard" | "last";
|
|
1092
|
-
type RouteFunction<TInitialPayload> = (context: WorkflowContext<TInitialPayload>) => Promise<
|
|
1105
|
+
type RouteFunction<TInitialPayload, TResult = unknown> = (context: WorkflowContext<TInitialPayload>) => Promise<TResult>;
|
|
1093
1106
|
type FinishCondition = "success" | "duplicate-step" | "fromCallback" | "auth-fail" | "failure-callback" | "workflow-already-ended";
|
|
1094
1107
|
type WorkflowServeOptions<TResponse extends Response = Response, TInitialPayload = unknown> = ValidationOptions<TInitialPayload> & {
|
|
1095
1108
|
/**
|
|
@@ -1139,7 +1152,7 @@ type WorkflowServeOptions<TResponse extends Response = Response, TInitialPayload
|
|
|
1139
1152
|
* @returns void
|
|
1140
1153
|
*/
|
|
1141
1154
|
failureFunction?: (failureData: {
|
|
1142
|
-
context: Omit<WorkflowContext<TInitialPayload>, "run" | "sleepUntil" | "sleep" | "call" | "waitForEvent" | "notify" | "cancel" | "api">;
|
|
1155
|
+
context: Omit<WorkflowContext<TInitialPayload>, "run" | "sleepUntil" | "sleep" | "call" | "waitForEvent" | "notify" | "cancel" | "api" | "invoke" | "agents">;
|
|
1143
1156
|
failStatus: number;
|
|
1144
1157
|
failResponse: string;
|
|
1145
1158
|
failHeaders: Record<string, string[]>;
|
|
@@ -1167,7 +1180,7 @@ type WorkflowServeOptions<TResponse extends Response = Response, TInitialPayload
|
|
|
1167
1180
|
/**
|
|
1168
1181
|
* Number of retries to use in workflow requests
|
|
1169
1182
|
*
|
|
1170
|
-
* 3
|
|
1183
|
+
* @default 3
|
|
1171
1184
|
*/
|
|
1172
1185
|
retries?: number;
|
|
1173
1186
|
/**
|
|
@@ -1181,8 +1194,15 @@ type WorkflowServeOptions<TResponse extends Response = Response, TInitialPayload
|
|
|
1181
1194
|
* By default, Workflow SDK sends telemetry about SDK version, framework or runtime.
|
|
1182
1195
|
*
|
|
1183
1196
|
* Set `disableTelemetry` to disable this behavior.
|
|
1197
|
+
*
|
|
1198
|
+
* @default false
|
|
1184
1199
|
*/
|
|
1185
1200
|
disableTelemetry?: boolean;
|
|
1201
|
+
/**
|
|
1202
|
+
* Settings for controlling the number of active requests
|
|
1203
|
+
* and number of requests per second with the same key.
|
|
1204
|
+
*/
|
|
1205
|
+
flowControl?: FlowControl;
|
|
1186
1206
|
} & ValidationOptions<TInitialPayload>;
|
|
1187
1207
|
type ValidationOptions<TInitialPayload> = {
|
|
1188
1208
|
schema?: z.ZodType<TInitialPayload>;
|
|
@@ -1302,6 +1322,7 @@ type CallSettings<TBody = unknown> = {
|
|
|
1302
1322
|
headers?: Record<string, string>;
|
|
1303
1323
|
retries?: number;
|
|
1304
1324
|
timeout?: Duration | number;
|
|
1325
|
+
flowControl?: FlowControl;
|
|
1305
1326
|
};
|
|
1306
1327
|
type HeaderParams = {
|
|
1307
1328
|
/**
|
|
@@ -1334,6 +1355,15 @@ type HeaderParams = {
|
|
|
1334
1355
|
* Only needed/used when the step is a waitForEvent step
|
|
1335
1356
|
*/
|
|
1336
1357
|
telemetry?: Telemetry;
|
|
1358
|
+
/**
|
|
1359
|
+
* invoke count to include in headers
|
|
1360
|
+
*/
|
|
1361
|
+
invokeCount?: number;
|
|
1362
|
+
/**
|
|
1363
|
+
* Settings for controlling the number of active requests
|
|
1364
|
+
* and number of requests per second with the same key.
|
|
1365
|
+
*/
|
|
1366
|
+
flowControl?: FlowControl;
|
|
1337
1367
|
} & ({
|
|
1338
1368
|
/**
|
|
1339
1369
|
* step to generate headers for
|
|
@@ -1347,6 +1377,13 @@ type HeaderParams = {
|
|
|
1347
1377
|
* timeout duration in context.call
|
|
1348
1378
|
*/
|
|
1349
1379
|
callTimeout?: number | Duration;
|
|
1380
|
+
/**
|
|
1381
|
+
* Settings for controlling the number of active requests
|
|
1382
|
+
* and number of requests per second with the same key.
|
|
1383
|
+
*
|
|
1384
|
+
* will be passed in context.call.
|
|
1385
|
+
*/
|
|
1386
|
+
callFlowControl?: FlowControl;
|
|
1350
1387
|
} | {
|
|
1351
1388
|
/**
|
|
1352
1389
|
* step not passed. Either first invocation or simply getting headers for
|
|
@@ -1365,6 +1402,35 @@ type HeaderParams = {
|
|
|
1365
1402
|
* set to never because this is not a context.call step
|
|
1366
1403
|
*/
|
|
1367
1404
|
callTimeout?: never;
|
|
1405
|
+
/**
|
|
1406
|
+
* Settings for controlling the number of active requests
|
|
1407
|
+
* and number of requests per second with the same key.
|
|
1408
|
+
*
|
|
1409
|
+
* will be passed in context.call.
|
|
1410
|
+
*/
|
|
1411
|
+
callFlowControl?: never;
|
|
1368
1412
|
});
|
|
1413
|
+
type InvokeWorkflowRequest = {
|
|
1414
|
+
workflowUrl: string;
|
|
1415
|
+
workflowRunId: string;
|
|
1416
|
+
headers: Record<string, string[]>;
|
|
1417
|
+
step: Step;
|
|
1418
|
+
body: string;
|
|
1419
|
+
};
|
|
1420
|
+
type LazyInvokeStepParams<TInitiaPayload, TResult> = {
|
|
1421
|
+
workflow: Pick<InvokableWorkflow<TInitiaPayload, TResult>, "routeFunction" | "workflowId" | "options">;
|
|
1422
|
+
body: TInitiaPayload;
|
|
1423
|
+
workflowRunId?: string;
|
|
1424
|
+
} & Pick<CallSettings, "retries" | "headers" | "flowControl">;
|
|
1425
|
+
type InvokeStepResponse<TBody> = {
|
|
1426
|
+
body: TBody;
|
|
1427
|
+
isCanceled?: boolean;
|
|
1428
|
+
isFailed?: boolean;
|
|
1429
|
+
};
|
|
1430
|
+
type InvokableWorkflow<TInitialPayload, TResult> = {
|
|
1431
|
+
routeFunction: RouteFunction<TInitialPayload, TResult>;
|
|
1432
|
+
options: WorkflowServeOptions<Response, TInitialPayload>;
|
|
1433
|
+
workflowId?: string;
|
|
1434
|
+
};
|
|
1369
1435
|
|
|
1370
|
-
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
|
|
1436
|
+
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 LazyInvokeStepParams as L, type NotifyResponse as N, type ParallelCallState as P, type RouteFunction as R, type StepType as S, type Telemetry as T, type WorkflowServeOptions as W, type RawStep as a, type Waiter as b, type Step as c, WorkflowTool as d, WorkflowContext as e, type WorkflowClient as f, type WorkflowReceiver as g, StepTypes as h, type SyncStepFunction as i, type StepFunction as j, type PublicServeOptions as k, type FailureFunctionPayload as l, type RequiredExceptFields as m, type WaitRequest as n, type WaitStepResponse as o, type NotifyStepResponse as p, type WaitEventOptions as q, type CallSettings as r, type InvokeStepResponse as s, type InvokableWorkflow as t, type LogLevel as u, type WorkflowLoggerOptions as v, WorkflowLogger as w };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PublishRequest, Client, Receiver, HTTPMethods as HTTPMethods$1 } from '@upstash/qstash';
|
|
1
|
+
import { PublishRequest, FlowControl, Client, Receiver, HTTPMethods as HTTPMethods$1 } from '@upstash/qstash';
|
|
2
2
|
import { ZodType, z } from 'zod';
|
|
3
3
|
import * as ai from 'ai';
|
|
4
4
|
import { CoreTool, generateText } from 'ai';
|
|
@@ -67,11 +67,12 @@ declare class AutoExecutor {
|
|
|
67
67
|
private readonly nonPlanStepCount;
|
|
68
68
|
private readonly steps;
|
|
69
69
|
private indexInCurrentList;
|
|
70
|
+
private invokeCount;
|
|
70
71
|
private telemetry?;
|
|
71
72
|
stepCount: number;
|
|
72
73
|
planStepCount: number;
|
|
73
74
|
protected executingStep: string | false;
|
|
74
|
-
constructor(context: WorkflowContext, steps: Step[], telemetry?: Telemetry, debug?: WorkflowLogger);
|
|
75
|
+
constructor(context: WorkflowContext, steps: Step[], telemetry?: Telemetry, invokeCount?: number, debug?: WorkflowLogger);
|
|
75
76
|
/**
|
|
76
77
|
* Adds the step function to the list of step functions to run in
|
|
77
78
|
* parallel. After adding the function, defers the execution, so
|
|
@@ -815,7 +816,12 @@ declare class WorkflowContext<TInitialPayload = unknown> {
|
|
|
815
816
|
* Number of retries
|
|
816
817
|
*/
|
|
817
818
|
readonly retries: number;
|
|
818
|
-
|
|
819
|
+
/**
|
|
820
|
+
* Settings for controlling the number of active requests
|
|
821
|
+
* and number of requests per second with the same key.
|
|
822
|
+
*/
|
|
823
|
+
readonly flowControl?: FlowControl;
|
|
824
|
+
constructor({ qstashClient, workflowRunId, headers, steps, url, failureUrl, debug, initialPayload, env, retries, telemetry, invokeCount, flowControl, }: {
|
|
819
825
|
qstashClient: WorkflowClient;
|
|
820
826
|
workflowRunId: string;
|
|
821
827
|
headers: Headers;
|
|
@@ -827,6 +833,8 @@ declare class WorkflowContext<TInitialPayload = unknown> {
|
|
|
827
833
|
env?: Record<string, string | undefined>;
|
|
828
834
|
retries?: number;
|
|
829
835
|
telemetry?: Telemetry;
|
|
836
|
+
invokeCount?: number;
|
|
837
|
+
flowControl?: FlowControl;
|
|
830
838
|
});
|
|
831
839
|
/**
|
|
832
840
|
* Executes a workflow step
|
|
@@ -971,6 +979,11 @@ declare class WorkflowContext<TInitialPayload = unknown> {
|
|
|
971
979
|
* @returns notify response which has event id, event data and list of waiters which were notified
|
|
972
980
|
*/
|
|
973
981
|
notify(stepName: string, eventId: string, eventData: unknown): Promise<NotifyStepResponse>;
|
|
982
|
+
invoke<TInitialPayload, TResult>(stepName: string, settings: LazyInvokeStepParams<TInitialPayload, TResult>): Promise<{
|
|
983
|
+
body: TResult;
|
|
984
|
+
isCanceled?: boolean;
|
|
985
|
+
isFailed?: boolean;
|
|
986
|
+
}>;
|
|
974
987
|
/**
|
|
975
988
|
* Cancel the current workflow run
|
|
976
989
|
*
|
|
@@ -1006,7 +1019,7 @@ type WorkflowClient = {
|
|
|
1006
1019
|
type WorkflowReceiver = {
|
|
1007
1020
|
verify: InstanceType<typeof Receiver>["verify"];
|
|
1008
1021
|
};
|
|
1009
|
-
declare const StepTypes: readonly ["Initial", "Run", "SleepFor", "SleepUntil", "Call", "Wait", "Notify"];
|
|
1022
|
+
declare const StepTypes: readonly ["Initial", "Run", "SleepFor", "SleepUntil", "Call", "Wait", "Notify", "Invoke"];
|
|
1010
1023
|
type StepType = (typeof StepTypes)[number];
|
|
1011
1024
|
type ThirdPartyCallFields<TBody = unknown> = {
|
|
1012
1025
|
/**
|
|
@@ -1089,7 +1102,7 @@ type SyncStepFunction<TResult> = () => TResult;
|
|
|
1089
1102
|
type AsyncStepFunction<TResult> = () => Promise<TResult>;
|
|
1090
1103
|
type StepFunction<TResult> = AsyncStepFunction<TResult> | SyncStepFunction<TResult>;
|
|
1091
1104
|
type ParallelCallState = "first" | "partial" | "discard" | "last";
|
|
1092
|
-
type RouteFunction<TInitialPayload> = (context: WorkflowContext<TInitialPayload>) => Promise<
|
|
1105
|
+
type RouteFunction<TInitialPayload, TResult = unknown> = (context: WorkflowContext<TInitialPayload>) => Promise<TResult>;
|
|
1093
1106
|
type FinishCondition = "success" | "duplicate-step" | "fromCallback" | "auth-fail" | "failure-callback" | "workflow-already-ended";
|
|
1094
1107
|
type WorkflowServeOptions<TResponse extends Response = Response, TInitialPayload = unknown> = ValidationOptions<TInitialPayload> & {
|
|
1095
1108
|
/**
|
|
@@ -1139,7 +1152,7 @@ type WorkflowServeOptions<TResponse extends Response = Response, TInitialPayload
|
|
|
1139
1152
|
* @returns void
|
|
1140
1153
|
*/
|
|
1141
1154
|
failureFunction?: (failureData: {
|
|
1142
|
-
context: Omit<WorkflowContext<TInitialPayload>, "run" | "sleepUntil" | "sleep" | "call" | "waitForEvent" | "notify" | "cancel" | "api">;
|
|
1155
|
+
context: Omit<WorkflowContext<TInitialPayload>, "run" | "sleepUntil" | "sleep" | "call" | "waitForEvent" | "notify" | "cancel" | "api" | "invoke" | "agents">;
|
|
1143
1156
|
failStatus: number;
|
|
1144
1157
|
failResponse: string;
|
|
1145
1158
|
failHeaders: Record<string, string[]>;
|
|
@@ -1167,7 +1180,7 @@ type WorkflowServeOptions<TResponse extends Response = Response, TInitialPayload
|
|
|
1167
1180
|
/**
|
|
1168
1181
|
* Number of retries to use in workflow requests
|
|
1169
1182
|
*
|
|
1170
|
-
* 3
|
|
1183
|
+
* @default 3
|
|
1171
1184
|
*/
|
|
1172
1185
|
retries?: number;
|
|
1173
1186
|
/**
|
|
@@ -1181,8 +1194,15 @@ type WorkflowServeOptions<TResponse extends Response = Response, TInitialPayload
|
|
|
1181
1194
|
* By default, Workflow SDK sends telemetry about SDK version, framework or runtime.
|
|
1182
1195
|
*
|
|
1183
1196
|
* Set `disableTelemetry` to disable this behavior.
|
|
1197
|
+
*
|
|
1198
|
+
* @default false
|
|
1184
1199
|
*/
|
|
1185
1200
|
disableTelemetry?: boolean;
|
|
1201
|
+
/**
|
|
1202
|
+
* Settings for controlling the number of active requests
|
|
1203
|
+
* and number of requests per second with the same key.
|
|
1204
|
+
*/
|
|
1205
|
+
flowControl?: FlowControl;
|
|
1186
1206
|
} & ValidationOptions<TInitialPayload>;
|
|
1187
1207
|
type ValidationOptions<TInitialPayload> = {
|
|
1188
1208
|
schema?: z.ZodType<TInitialPayload>;
|
|
@@ -1302,6 +1322,7 @@ type CallSettings<TBody = unknown> = {
|
|
|
1302
1322
|
headers?: Record<string, string>;
|
|
1303
1323
|
retries?: number;
|
|
1304
1324
|
timeout?: Duration | number;
|
|
1325
|
+
flowControl?: FlowControl;
|
|
1305
1326
|
};
|
|
1306
1327
|
type HeaderParams = {
|
|
1307
1328
|
/**
|
|
@@ -1334,6 +1355,15 @@ type HeaderParams = {
|
|
|
1334
1355
|
* Only needed/used when the step is a waitForEvent step
|
|
1335
1356
|
*/
|
|
1336
1357
|
telemetry?: Telemetry;
|
|
1358
|
+
/**
|
|
1359
|
+
* invoke count to include in headers
|
|
1360
|
+
*/
|
|
1361
|
+
invokeCount?: number;
|
|
1362
|
+
/**
|
|
1363
|
+
* Settings for controlling the number of active requests
|
|
1364
|
+
* and number of requests per second with the same key.
|
|
1365
|
+
*/
|
|
1366
|
+
flowControl?: FlowControl;
|
|
1337
1367
|
} & ({
|
|
1338
1368
|
/**
|
|
1339
1369
|
* step to generate headers for
|
|
@@ -1347,6 +1377,13 @@ type HeaderParams = {
|
|
|
1347
1377
|
* timeout duration in context.call
|
|
1348
1378
|
*/
|
|
1349
1379
|
callTimeout?: number | Duration;
|
|
1380
|
+
/**
|
|
1381
|
+
* Settings for controlling the number of active requests
|
|
1382
|
+
* and number of requests per second with the same key.
|
|
1383
|
+
*
|
|
1384
|
+
* will be passed in context.call.
|
|
1385
|
+
*/
|
|
1386
|
+
callFlowControl?: FlowControl;
|
|
1350
1387
|
} | {
|
|
1351
1388
|
/**
|
|
1352
1389
|
* step not passed. Either first invocation or simply getting headers for
|
|
@@ -1365,6 +1402,35 @@ type HeaderParams = {
|
|
|
1365
1402
|
* set to never because this is not a context.call step
|
|
1366
1403
|
*/
|
|
1367
1404
|
callTimeout?: never;
|
|
1405
|
+
/**
|
|
1406
|
+
* Settings for controlling the number of active requests
|
|
1407
|
+
* and number of requests per second with the same key.
|
|
1408
|
+
*
|
|
1409
|
+
* will be passed in context.call.
|
|
1410
|
+
*/
|
|
1411
|
+
callFlowControl?: never;
|
|
1368
1412
|
});
|
|
1413
|
+
type InvokeWorkflowRequest = {
|
|
1414
|
+
workflowUrl: string;
|
|
1415
|
+
workflowRunId: string;
|
|
1416
|
+
headers: Record<string, string[]>;
|
|
1417
|
+
step: Step;
|
|
1418
|
+
body: string;
|
|
1419
|
+
};
|
|
1420
|
+
type LazyInvokeStepParams<TInitiaPayload, TResult> = {
|
|
1421
|
+
workflow: Pick<InvokableWorkflow<TInitiaPayload, TResult>, "routeFunction" | "workflowId" | "options">;
|
|
1422
|
+
body: TInitiaPayload;
|
|
1423
|
+
workflowRunId?: string;
|
|
1424
|
+
} & Pick<CallSettings, "retries" | "headers" | "flowControl">;
|
|
1425
|
+
type InvokeStepResponse<TBody> = {
|
|
1426
|
+
body: TBody;
|
|
1427
|
+
isCanceled?: boolean;
|
|
1428
|
+
isFailed?: boolean;
|
|
1429
|
+
};
|
|
1430
|
+
type InvokableWorkflow<TInitialPayload, TResult> = {
|
|
1431
|
+
routeFunction: RouteFunction<TInitialPayload, TResult>;
|
|
1432
|
+
options: WorkflowServeOptions<Response, TInitialPayload>;
|
|
1433
|
+
workflowId?: string;
|
|
1434
|
+
};
|
|
1369
1435
|
|
|
1370
|
-
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
|
|
1436
|
+
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 LazyInvokeStepParams as L, type NotifyResponse as N, type ParallelCallState as P, type RouteFunction as R, type StepType as S, type Telemetry as T, type WorkflowServeOptions as W, type RawStep as a, type Waiter as b, type Step as c, WorkflowTool as d, WorkflowContext as e, type WorkflowClient as f, type WorkflowReceiver as g, StepTypes as h, type SyncStepFunction as i, type StepFunction as j, type PublicServeOptions as k, type FailureFunctionPayload as l, type RequiredExceptFields as m, type WaitRequest as n, type WaitStepResponse as o, type NotifyStepResponse as p, type WaitEventOptions as q, type CallSettings as r, type InvokeStepResponse as s, type InvokableWorkflow as t, type LogLevel as u, type WorkflowLoggerOptions as v, WorkflowLogger as w };
|