@upstash/workflow 0.2.8-rc-invoke → 0.2.8

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.js CHANGED
@@ -26,6 +26,7 @@ __export(src_exports, {
26
26
  WorkflowContext: () => WorkflowContext,
27
27
  WorkflowError: () => WorkflowError,
28
28
  WorkflowLogger: () => WorkflowLogger,
29
+ WorkflowTool: () => WorkflowTool,
29
30
  serve: () => serve
30
31
  });
31
32
  module.exports = __toCommonJS(src_exports);
@@ -101,7 +102,7 @@ var WORKFLOW_PROTOCOL_VERSION_HEADER = "Upstash-Workflow-Sdk-Version";
101
102
  var DEFAULT_CONTENT_TYPE = "application/json";
102
103
  var NO_CONCURRENCY = 1;
103
104
  var DEFAULT_RETRIES = 3;
104
- var VERSION = "v0.2.7";
105
+ var VERSION = "v0.2.3";
105
106
  var SDK_TELEMETRY = `@upstash/workflow@${VERSION}`;
106
107
  var TELEMETRY_HEADER_SDK = "Upstash-Telemetry-Sdk";
107
108
  var TELEMETRY_HEADER_FRAMEWORK = "Upstash-Telemetry-Framework";
@@ -148,31 +149,6 @@ var formatWorkflowError = (error) => {
148
149
  };
149
150
  };
150
151
 
151
- // src/utils.ts
152
- var NANOID_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_";
153
- var NANOID_LENGTH = 21;
154
- function getRandomInt() {
155
- return Math.floor(Math.random() * NANOID_CHARS.length);
156
- }
157
- function nanoid() {
158
- return Array.from({ length: NANOID_LENGTH }).map(() => NANOID_CHARS[getRandomInt()]).join("");
159
- }
160
- function getWorkflowRunId(id) {
161
- return `wfr_${id ?? nanoid()}`;
162
- }
163
- function decodeBase64(base64) {
164
- try {
165
- const binString = atob(base64);
166
- const intArray = Uint8Array.from(binString, (m) => m.codePointAt(0));
167
- return new TextDecoder().decode(intArray);
168
- } catch (error) {
169
- console.warn(
170
- `Upstash Qstash: Failed while decoding base64 "${base64}". Decoding with atob and returning it instead. ${error}`
171
- );
172
- return atob(base64);
173
- }
174
- }
175
-
176
152
  // src/context/steps.ts
177
153
  var BaseLazyStep = class {
178
154
  stepName;
@@ -353,41 +329,6 @@ var LazyNotifyStep = class extends LazyFunctionStep {
353
329
  });
354
330
  }
355
331
  };
356
- var LazyInvokeStep = class extends BaseLazyStep {
357
- stepType = "Invoke";
358
- params;
359
- constructor(stepName, { workflow, body, headers = {}, workflowRunId, retries }) {
360
- super(stepName);
361
- this.params = {
362
- workflow,
363
- body,
364
- headers,
365
- workflowRunId: getWorkflowRunId(workflowRunId),
366
- retries
367
- };
368
- }
369
- getPlanStep(concurrent, targetStep) {
370
- return {
371
- stepId: 0,
372
- stepName: this.stepName,
373
- stepType: this.stepType,
374
- concurrent,
375
- targetStep
376
- };
377
- }
378
- /**
379
- * won't be used as it's the server who will add the result step
380
- * in Invoke step.
381
- */
382
- getResultStep(concurrent, stepId) {
383
- return Promise.resolve({
384
- stepId,
385
- stepName: this.stepName,
386
- stepType: this.stepType,
387
- concurrent
388
- });
389
- }
390
- };
391
332
 
392
333
  // node_modules/neverthrow/dist/index.es.js
393
334
  var defaultErrorConfig = {
@@ -812,8 +753,7 @@ var StepTypes = [
812
753
  "SleepUntil",
813
754
  "Call",
814
755
  "Wait",
815
- "Notify",
816
- "Invoke"
756
+ "Notify"
817
757
  ];
818
758
 
819
759
  // src/workflow-requests.ts
@@ -877,8 +817,8 @@ var triggerRouteFunction = async ({
877
817
  debug
878
818
  }) => {
879
819
  try {
880
- const result = await onStep();
881
- await onCleanup(result);
820
+ await onStep();
821
+ await onCleanup();
882
822
  return ok("workflow-finished");
883
823
  } catch (error) {
884
824
  const error_ = error;
@@ -899,15 +839,14 @@ var triggerRouteFunction = async ({
899
839
  }
900
840
  }
901
841
  };
902
- var triggerWorkflowDelete = async (workflowContext, result, debug, cancel = false) => {
842
+ var triggerWorkflowDelete = async (workflowContext, debug, cancel = false) => {
903
843
  await debug?.log("SUBMIT", "SUBMIT_CLEANUP", {
904
844
  deletedWorkflowRunId: workflowContext.workflowRunId
905
845
  });
906
846
  await workflowContext.qstashClient.http.request({
907
847
  path: ["v2", "workflows", "runs", `${workflowContext.workflowRunId}?cancel=${cancel}`],
908
848
  method: "DELETE",
909
- parseResponseAsJson: false,
910
- body: JSON.stringify(result)
849
+ parseResponseAsJson: false
911
850
  });
912
851
  await debug?.log(
913
852
  "SUBMIT",
@@ -1062,14 +1001,11 @@ var getHeaders = ({
1062
1001
  callTimeout,
1063
1002
  telemetry
1064
1003
  }) => {
1065
- const contentType = (userHeaders ? userHeaders.get("Content-Type") : void 0) ?? DEFAULT_CONTENT_TYPE;
1066
1004
  const baseHeaders = {
1067
1005
  [WORKFLOW_INIT_HEADER]: initHeaderValue,
1068
1006
  [WORKFLOW_ID_HEADER]: workflowRunId,
1069
1007
  [WORKFLOW_URL_HEADER]: workflowUrl,
1070
1008
  [WORKFLOW_FEATURE_HEADER]: "LazyFetch,InitialBody",
1071
- [WORKFLOW_PROTOCOL_VERSION_HEADER]: WORKFLOW_PROTOCOL_VERSION,
1072
- "content-type": contentType,
1073
1009
  ...telemetry ? getTelemetryHeaders(telemetry) : {}
1074
1010
  };
1075
1011
  if (!step?.callUrl) {
@@ -1080,13 +1016,18 @@ var getHeaders = ({
1080
1016
  }
1081
1017
  if (failureUrl) {
1082
1018
  baseHeaders[`Upstash-Failure-Callback-Forward-${WORKFLOW_FAILURE_HEADER}`] = "true";
1019
+ baseHeaders[`Upstash-Failure-Callback-Forward-Upstash-Workflow-Failure-Callback`] = "true";
1020
+ baseHeaders["Upstash-Failure-Callback-Workflow-Runid"] = workflowRunId;
1021
+ baseHeaders["Upstash-Failure-Callback-Workflow-Init"] = "false";
1022
+ baseHeaders["Upstash-Failure-Callback-Workflow-Url"] = workflowUrl;
1023
+ baseHeaders["Upstash-Failure-Callback-Workflow-Calltype"] = "failureCall";
1024
+ if (retries !== void 0) {
1025
+ baseHeaders["Upstash-Failure-Callback-Retries"] = retries.toString();
1026
+ }
1083
1027
  if (!step?.callUrl) {
1084
1028
  baseHeaders["Upstash-Failure-Callback"] = failureUrl;
1085
1029
  }
1086
1030
  }
1087
- if (step?.stepType === "Invoke") {
1088
- baseHeaders["upstash-workflow-invoke"] = "true";
1089
- }
1090
1031
  if (step?.callUrl) {
1091
1032
  baseHeaders["Upstash-Retries"] = callRetries?.toString() ?? "0";
1092
1033
  baseHeaders[WORKFLOW_FEATURE_HEADER] = "WF_NoDelete,InitialBody";
@@ -1108,6 +1049,7 @@ var getHeaders = ({
1108
1049
  baseHeaders[`Upstash-Failure-Callback-Forward-${header}`] = userHeaders.get(header);
1109
1050
  }
1110
1051
  }
1052
+ const contentType = (userHeaders ? userHeaders.get("Content-Type") : void 0) ?? DEFAULT_CONTENT_TYPE;
1111
1053
  if (step?.callHeaders) {
1112
1054
  const forwardedHeaders = Object.fromEntries(
1113
1055
  Object.entries(step.callHeaders).map(([header, value]) => [
@@ -1157,7 +1099,8 @@ var getHeaders = ({
1157
1099
  "Upstash-Workflow-Runid": [workflowRunId],
1158
1100
  [WORKFLOW_INIT_HEADER]: ["false"],
1159
1101
  [WORKFLOW_URL_HEADER]: [workflowUrl],
1160
- "Upstash-Workflow-CallType": ["step"]
1102
+ "Upstash-Workflow-CallType": ["step"],
1103
+ "Content-Type": [contentType]
1161
1104
  }
1162
1105
  };
1163
1106
  }
@@ -1452,23 +1395,7 @@ var AutoExecutor = class _AutoExecutor {
1452
1395
  method: "POST",
1453
1396
  parseResponseAsJson: false
1454
1397
  });
1455
- throw new WorkflowAbort(waitStep.stepName, waitStep);
1456
- }
1457
- if (steps.length === 1 && lazySteps[0] instanceof LazyInvokeStep) {
1458
- const invokeStep = steps[0];
1459
- const lazyInvokeStep = lazySteps[0];
1460
- await lazyInvokeStep.params.workflow.callback(
1461
- {
1462
- body: lazyInvokeStep.params.body,
1463
- headers: lazyInvokeStep.params.headers,
1464
- workflowRunId: lazyInvokeStep.params.workflowRunId,
1465
- workflow: lazyInvokeStep.params.workflow,
1466
- retries: lazyInvokeStep.params.retries
1467
- },
1468
- invokeStep,
1469
- this.context
1470
- );
1471
- throw new WorkflowAbort(invokeStep.stepName, invokeStep);
1398
+ throw new WorkflowAbort(steps[0].stepName, steps[0]);
1472
1399
  }
1473
1400
  const result = await this.context.qstashClient.batchJSON(
1474
1401
  steps.map((singleStep, index) => {
@@ -1787,9 +1714,10 @@ var wrapTools = ({
1787
1714
  return Object.fromEntries(
1788
1715
  Object.entries(tools).map((toolInfo) => {
1789
1716
  const [toolName, tool3] = toolInfo;
1717
+ const executeAsStep = "executeAsStep" in tool3 ? tool3.executeAsStep : true;
1790
1718
  const aiSDKTool = convertToAISDKTool(tool3);
1791
1719
  const execute = aiSDKTool.execute;
1792
- if (execute) {
1720
+ if (execute && executeAsStep) {
1793
1721
  const wrappedExecute = (...params) => {
1794
1722
  return context.run(`Run tool ${toolName}`, () => execute(...params));
1795
1723
  };
@@ -1810,6 +1738,37 @@ var convertLangchainTool = (langchainTool) => {
1810
1738
  execute: async (...param) => langchainTool.invoke(...param)
1811
1739
  });
1812
1740
  };
1741
+ var WorkflowTool = class {
1742
+ /**
1743
+ * description of the tool
1744
+ */
1745
+ description;
1746
+ /**
1747
+ * schema of the tool
1748
+ */
1749
+ schema;
1750
+ /**
1751
+ * function to invoke the tool
1752
+ */
1753
+ invoke;
1754
+ /**
1755
+ * whether the invoke method of the tool is to be wrapped with `context.run`
1756
+ */
1757
+ executeAsStep;
1758
+ /**
1759
+ *
1760
+ * @param description description of the tool
1761
+ * @param schema schema of the tool
1762
+ * @param invoke function to invoke the tool
1763
+ * @param executeAsStep whether the invoke method of the tool is to be wrapped with `context.run`
1764
+ */
1765
+ constructor(params) {
1766
+ this.description = params.description;
1767
+ this.schema = params.schema;
1768
+ this.invoke = params.invoke;
1769
+ this.executeAsStep = params.executeAsStep ?? true;
1770
+ }
1771
+ };
1813
1772
 
1814
1773
  // src/agents/agent.ts
1815
1774
  var import_zod = require("zod");
@@ -2385,13 +2344,6 @@ var WorkflowContext = class {
2385
2344
  return result;
2386
2345
  }
2387
2346
  }
2388
- async invoke(stepName, settings) {
2389
- const result = await this.addStep(new LazyInvokeStep(stepName, settings));
2390
- return {
2391
- ...result,
2392
- body: result.body ? JSON.parse(result.body) : void 0
2393
- };
2394
- }
2395
2347
  /**
2396
2348
  * Cancel the current workflow run
2397
2349
  *
@@ -2469,6 +2421,31 @@ var WorkflowLogger = class _WorkflowLogger {
2469
2421
  }
2470
2422
  };
2471
2423
 
2424
+ // src/utils.ts
2425
+ var NANOID_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_";
2426
+ var NANOID_LENGTH = 21;
2427
+ function getRandomInt() {
2428
+ return Math.floor(Math.random() * NANOID_CHARS.length);
2429
+ }
2430
+ function nanoid() {
2431
+ return Array.from({ length: NANOID_LENGTH }).map(() => NANOID_CHARS[getRandomInt()]).join("");
2432
+ }
2433
+ function getWorkflowRunId(id) {
2434
+ return `wfr_${id ?? nanoid()}`;
2435
+ }
2436
+ function decodeBase64(base64) {
2437
+ try {
2438
+ const binString = atob(base64);
2439
+ const intArray = Uint8Array.from(binString, (m) => m.codePointAt(0));
2440
+ return new TextDecoder().decode(intArray);
2441
+ } catch (error) {
2442
+ console.warn(
2443
+ `Upstash Qstash: Failed while decoding base64 "${base64}". Decoding with atob and returning it instead. ${error}`
2444
+ );
2445
+ return atob(base64);
2446
+ }
2447
+ }
2448
+
2472
2449
  // src/serve/authorization.ts
2473
2450
  var import_qstash8 = require("@upstash/qstash");
2474
2451
  var DisabledWorkflowContext = class _DisabledWorkflowContext extends WorkflowContext {
@@ -2914,8 +2891,8 @@ var serveBase = (routeFunction, telemetry, options) => {
2914
2891
  } else if (callReturnCheck.value === "continue-workflow") {
2915
2892
  const result = isFirstInvocation ? await triggerFirstInvocation({ workflowContext, useJSONContent, telemetry, debug }) : await triggerRouteFunction({
2916
2893
  onStep: async () => routeFunction(workflowContext),
2917
- onCleanup: async (result2) => {
2918
- await triggerWorkflowDelete(workflowContext, result2, debug);
2894
+ onCleanup: async () => {
2895
+ await triggerWorkflowDelete(workflowContext, debug);
2919
2896
  },
2920
2897
  onCancel: async () => {
2921
2898
  await makeCancelRequest(workflowContext.qstashClient.http, workflowRunId);
@@ -3144,6 +3121,59 @@ var Client4 = class {
3144
3121
  throw result.error;
3145
3122
  }
3146
3123
  }
3124
+ /**
3125
+ * Fetches logs for workflow runs.
3126
+ *
3127
+ * @param workflowRunId - The ID of the workflow run to fetch logs for.
3128
+ * @param cursor - The cursor for pagination.
3129
+ * @param count - Number of runs to fetch. Default value is 10.
3130
+ * @param state - The state of the workflow run.
3131
+ * @param workflowUrl - The URL of the workflow. Should be an exact match.
3132
+ * @param workflowCreatedAt - The creation time of the workflow. If you have two workflow runs with the same URL, you can use this to filter them.
3133
+ * @returns A promise that resolves to either a `WorkflowRunLog` or a `WorkflowRunResponse`.
3134
+ *
3135
+ * @example
3136
+ * Fetch logs for a specific workflow run:
3137
+ * ```typescript
3138
+ * const { runs } = await client.logs({ workflowRunId: '12345' });
3139
+ * const steps = runs[0].steps; // access steps
3140
+ * ```
3141
+ *
3142
+ * @example
3143
+ * Fetch logs with pagination:
3144
+ * ```typescript
3145
+ * const { runs, cursor } = await client.logs();
3146
+ * const steps = runs[0].steps // access steps
3147
+ *
3148
+ * const { runs: nextRuns, cursor: nextCursor } = await client.logs({ cursor, count: 2 });
3149
+ * ```
3150
+ */
3151
+ async logs(params) {
3152
+ const { workflowRunId, cursor, count, state, workflowUrl, workflowCreatedAt } = params ?? {};
3153
+ const urlParams = new URLSearchParams({ "groupBy": "workflowRunId" });
3154
+ if (workflowRunId) {
3155
+ urlParams.append("workflowRunId", workflowRunId);
3156
+ }
3157
+ if (cursor) {
3158
+ urlParams.append("cursor", cursor);
3159
+ }
3160
+ if (count) {
3161
+ urlParams.append("count", count.toString());
3162
+ }
3163
+ if (state) {
3164
+ urlParams.append("state", state);
3165
+ }
3166
+ if (workflowUrl) {
3167
+ urlParams.append("workflowUrl", workflowUrl);
3168
+ }
3169
+ if (workflowCreatedAt) {
3170
+ urlParams.append("workflowCreatedAt", workflowCreatedAt.toString());
3171
+ }
3172
+ const result = await this.client.http.request({
3173
+ path: ["v2", "workflows", `events?${urlParams.toString()}`]
3174
+ });
3175
+ return result;
3176
+ }
3147
3177
  };
3148
3178
  // Annotate the CommonJS export names for ESM import in node:
3149
3179
  0 && (module.exports = {
@@ -3153,5 +3183,6 @@ var Client4 = class {
3153
3183
  WorkflowContext,
3154
3184
  WorkflowError,
3155
3185
  WorkflowLogger,
3186
+ WorkflowTool,
3156
3187
  serve
3157
3188
  });
package/index.mjs CHANGED
@@ -4,12 +4,13 @@ import {
4
4
  WorkflowContext,
5
5
  WorkflowError,
6
6
  WorkflowLogger,
7
+ WorkflowTool,
7
8
  getWorkflowRunId,
8
9
  makeGetWaitersRequest,
9
10
  makeNotifyRequest,
10
11
  serve,
11
12
  triggerFirstInvocation
12
- } from "./chunk-IWAW7GIG.mjs";
13
+ } from "./chunk-BPUSHNSD.mjs";
13
14
 
14
15
  // src/client/index.ts
15
16
  import { Client as QStashClient } from "@upstash/qstash";
@@ -198,6 +199,59 @@ var Client = class {
198
199
  throw result.error;
199
200
  }
200
201
  }
202
+ /**
203
+ * Fetches logs for workflow runs.
204
+ *
205
+ * @param workflowRunId - The ID of the workflow run to fetch logs for.
206
+ * @param cursor - The cursor for pagination.
207
+ * @param count - Number of runs to fetch. Default value is 10.
208
+ * @param state - The state of the workflow run.
209
+ * @param workflowUrl - The URL of the workflow. Should be an exact match.
210
+ * @param workflowCreatedAt - The creation time of the workflow. If you have two workflow runs with the same URL, you can use this to filter them.
211
+ * @returns A promise that resolves to either a `WorkflowRunLog` or a `WorkflowRunResponse`.
212
+ *
213
+ * @example
214
+ * Fetch logs for a specific workflow run:
215
+ * ```typescript
216
+ * const { runs } = await client.logs({ workflowRunId: '12345' });
217
+ * const steps = runs[0].steps; // access steps
218
+ * ```
219
+ *
220
+ * @example
221
+ * Fetch logs with pagination:
222
+ * ```typescript
223
+ * const { runs, cursor } = await client.logs();
224
+ * const steps = runs[0].steps // access steps
225
+ *
226
+ * const { runs: nextRuns, cursor: nextCursor } = await client.logs({ cursor, count: 2 });
227
+ * ```
228
+ */
229
+ async logs(params) {
230
+ const { workflowRunId, cursor, count, state, workflowUrl, workflowCreatedAt } = params ?? {};
231
+ const urlParams = new URLSearchParams({ "groupBy": "workflowRunId" });
232
+ if (workflowRunId) {
233
+ urlParams.append("workflowRunId", workflowRunId);
234
+ }
235
+ if (cursor) {
236
+ urlParams.append("cursor", cursor);
237
+ }
238
+ if (count) {
239
+ urlParams.append("count", count.toString());
240
+ }
241
+ if (state) {
242
+ urlParams.append("state", state);
243
+ }
244
+ if (workflowUrl) {
245
+ urlParams.append("workflowUrl", workflowUrl);
246
+ }
247
+ if (workflowCreatedAt) {
248
+ urlParams.append("workflowCreatedAt", workflowCreatedAt.toString());
249
+ }
250
+ const result = await this.client.http.request({
251
+ path: ["v2", "workflows", `events?${urlParams.toString()}`]
252
+ });
253
+ return result;
254
+ }
201
255
  };
202
256
  export {
203
257
  Client,
@@ -206,5 +260,6 @@ export {
206
260
  WorkflowContext,
207
261
  WorkflowError,
208
262
  WorkflowLogger,
263
+ WorkflowTool,
209
264
  serve
210
265
  };
package/nextjs.d.mts CHANGED
@@ -1,6 +1,5 @@
1
- import { NextApiHandler, NextApiRequest, NextApiResponse } from 'next';
2
- import { R as RouteFunction, j as PublicServeOptions, t as InvokableWorkflow } from './types-C7Y7WUQd.mjs';
3
- import { s as serveManyBase } from './serve-many-BlBvXfBS.mjs';
1
+ import { NextApiHandler } from 'next';
2
+ import { R as RouteFunction, k as PublicServeOptions } from './types-B62AnIU3.mjs';
4
3
  import '@upstash/qstash';
5
4
  import 'zod';
6
5
  import 'ai';
@@ -15,19 +14,11 @@ import '@ai-sdk/openai';
15
14
  * @param options workflow options
16
15
  * @returns
17
16
  */
18
- declare const serve: <TInitialPayload = unknown, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload>) => {
17
+ declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: PublicServeOptions<TInitialPayload>) => {
19
18
  POST: (request: Request) => Promise<Response>;
20
19
  };
21
- declare const createWorkflow: <TInitialPayload, TResult>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload> | undefined) => InvokableWorkflow<TInitialPayload, TResult, Parameters<ReturnType<typeof serve<TInitialPayload, TResult>>["POST"]>>;
22
- declare const serveMany: (workflows: Parameters<typeof serveManyBase>[0]["workflows"]) => {
23
- POST: (request: Request) => Promise<any>;
24
- };
25
- declare const servePagesRouter: <TInitialPayload = unknown, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload>) => {
20
+ declare const servePagesRouter: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: PublicServeOptions<TInitialPayload>) => {
26
21
  handler: NextApiHandler;
27
22
  };
28
- declare const createWorkflowPagesRouter: <TInitialPayload, TResult>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload> | undefined) => InvokableWorkflow<TInitialPayload, TResult, Parameters<ReturnType<typeof servePagesRouter<TInitialPayload, TResult>>["handler"]>>;
29
- declare const serveManyPagesRouter: (workflows: Parameters<typeof serveManyBase>[0]["workflows"]) => {
30
- handler: (req: NextApiRequest, res: NextApiResponse<any>) => Promise<any>;
31
- };
32
23
 
33
- export { createWorkflow, createWorkflowPagesRouter, serve, serveMany, serveManyPagesRouter, servePagesRouter };
24
+ export { serve, servePagesRouter };
package/nextjs.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- import { NextApiHandler, NextApiRequest, NextApiResponse } from 'next';
2
- import { R as RouteFunction, j as PublicServeOptions, t as InvokableWorkflow } from './types-C7Y7WUQd.js';
3
- import { s as serveManyBase } from './serve-many-Dw-UUnH6.js';
1
+ import { NextApiHandler } from 'next';
2
+ import { R as RouteFunction, k as PublicServeOptions } from './types-B62AnIU3.js';
4
3
  import '@upstash/qstash';
5
4
  import 'zod';
6
5
  import 'ai';
@@ -15,19 +14,11 @@ import '@ai-sdk/openai';
15
14
  * @param options workflow options
16
15
  * @returns
17
16
  */
18
- declare const serve: <TInitialPayload = unknown, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload>) => {
17
+ declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: PublicServeOptions<TInitialPayload>) => {
19
18
  POST: (request: Request) => Promise<Response>;
20
19
  };
21
- declare const createWorkflow: <TInitialPayload, TResult>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload> | undefined) => InvokableWorkflow<TInitialPayload, TResult, Parameters<ReturnType<typeof serve<TInitialPayload, TResult>>["POST"]>>;
22
- declare const serveMany: (workflows: Parameters<typeof serveManyBase>[0]["workflows"]) => {
23
- POST: (request: Request) => Promise<any>;
24
- };
25
- declare const servePagesRouter: <TInitialPayload = unknown, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload>) => {
20
+ declare const servePagesRouter: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: PublicServeOptions<TInitialPayload>) => {
26
21
  handler: NextApiHandler;
27
22
  };
28
- declare const createWorkflowPagesRouter: <TInitialPayload, TResult>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload> | undefined) => InvokableWorkflow<TInitialPayload, TResult, Parameters<ReturnType<typeof servePagesRouter<TInitialPayload, TResult>>["handler"]>>;
29
- declare const serveManyPagesRouter: (workflows: Parameters<typeof serveManyBase>[0]["workflows"]) => {
30
- handler: (req: NextApiRequest, res: NextApiResponse<any>) => Promise<any>;
31
- };
32
23
 
33
- export { createWorkflow, createWorkflowPagesRouter, serve, serveMany, serveManyPagesRouter, servePagesRouter };
24
+ export { serve, servePagesRouter };