@upstash/workflow 0.2.8 → 0.2.9
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/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
makeNotifyRequest,
|
|
11
11
|
serve,
|
|
12
12
|
triggerFirstInvocation
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-IPXJZU3K.mjs";
|
|
14
14
|
|
|
15
15
|
// src/client/index.ts
|
|
16
16
|
import { Client as QStashClient } from "@upstash/qstash";
|
|
@@ -173,7 +173,8 @@ var Client = class {
|
|
|
173
173
|
body,
|
|
174
174
|
headers,
|
|
175
175
|
workflowRunId,
|
|
176
|
-
retries
|
|
176
|
+
retries,
|
|
177
|
+
flowControl
|
|
177
178
|
}) {
|
|
178
179
|
const finalWorkflowRunId = getWorkflowRunId(workflowRunId);
|
|
179
180
|
const context = new WorkflowContext({
|
|
@@ -185,8 +186,9 @@ var Client = class {
|
|
|
185
186
|
url,
|
|
186
187
|
workflowRunId: finalWorkflowRunId,
|
|
187
188
|
retries,
|
|
188
|
-
telemetry: void 0
|
|
189
|
+
telemetry: void 0,
|
|
189
190
|
// can't know workflow telemetry here
|
|
191
|
+
flowControl
|
|
190
192
|
});
|
|
191
193
|
const result = await triggerFirstInvocation({
|
|
192
194
|
workflowContext: context,
|
|
@@ -200,35 +202,35 @@ var Client = class {
|
|
|
200
202
|
}
|
|
201
203
|
}
|
|
202
204
|
/**
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
205
|
+
* Fetches logs for workflow runs.
|
|
206
|
+
*
|
|
207
|
+
* @param workflowRunId - The ID of the workflow run to fetch logs for.
|
|
208
|
+
* @param cursor - The cursor for pagination.
|
|
209
|
+
* @param count - Number of runs to fetch. Default value is 10.
|
|
210
|
+
* @param state - The state of the workflow run.
|
|
211
|
+
* @param workflowUrl - The URL of the workflow. Should be an exact match.
|
|
212
|
+
* @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.
|
|
213
|
+
* @returns A promise that resolves to either a `WorkflowRunLog` or a `WorkflowRunResponse`.
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* Fetch logs for a specific workflow run:
|
|
217
|
+
* ```typescript
|
|
218
|
+
* const { runs } = await client.logs({ workflowRunId: '12345' });
|
|
219
|
+
* const steps = runs[0].steps; // access steps
|
|
220
|
+
* ```
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* Fetch logs with pagination:
|
|
224
|
+
* ```typescript
|
|
225
|
+
* const { runs, cursor } = await client.logs();
|
|
226
|
+
* const steps = runs[0].steps // access steps
|
|
227
|
+
*
|
|
228
|
+
* const { runs: nextRuns, cursor: nextCursor } = await client.logs({ cursor, count: 2 });
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
229
231
|
async logs(params) {
|
|
230
232
|
const { workflowRunId, cursor, count, state, workflowUrl, workflowCreatedAt } = params ?? {};
|
|
231
|
-
const urlParams = new URLSearchParams({
|
|
233
|
+
const urlParams = new URLSearchParams({ groupBy: "workflowRunId" });
|
|
232
234
|
if (workflowRunId) {
|
|
233
235
|
urlParams.append("workflowRunId", workflowRunId);
|
|
234
236
|
}
|
package/nextjs.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { NextApiHandler } from 'next';
|
|
2
|
-
import { R as RouteFunction, k as PublicServeOptions } from './types-
|
|
1
|
+
import { NextApiHandler, NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
+
import { R as RouteFunction, k as PublicServeOptions, t as InvokableWorkflow } from './types-CYhDXnf8.mjs';
|
|
3
|
+
import { s as serveManyBase } from './serve-many-BVDpPsF-.mjs';
|
|
3
4
|
import '@upstash/qstash';
|
|
4
5
|
import 'zod';
|
|
5
6
|
import 'ai';
|
|
@@ -14,11 +15,19 @@ import '@ai-sdk/openai';
|
|
|
14
15
|
* @param options workflow options
|
|
15
16
|
* @returns
|
|
16
17
|
*/
|
|
17
|
-
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: PublicServeOptions<TInitialPayload>) => {
|
|
18
|
+
declare const serve: <TInitialPayload = unknown, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload>) => {
|
|
18
19
|
POST: (request: Request) => Promise<Response>;
|
|
19
20
|
};
|
|
20
|
-
declare const
|
|
21
|
+
declare const createWorkflow: <TInitialPayload, TResult>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload> | undefined) => InvokableWorkflow<TInitialPayload, TResult>;
|
|
22
|
+
declare const serveMany: (workflows: Parameters<typeof serveManyBase>[0]["workflows"], options?: Parameters<typeof serveManyBase>[0]["options"]) => {
|
|
23
|
+
POST: (request: Request) => Promise<any>;
|
|
24
|
+
};
|
|
25
|
+
declare const servePagesRouter: <TInitialPayload = unknown, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload>) => {
|
|
21
26
|
handler: NextApiHandler;
|
|
22
27
|
};
|
|
28
|
+
declare const createWorkflowPagesRouter: <TInitialPayload, TResult>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload> | undefined) => InvokableWorkflow<TInitialPayload, TResult>;
|
|
29
|
+
declare const serveManyPagesRouter: (workflows: Parameters<typeof serveManyBase>[0]["workflows"], options?: Parameters<typeof serveManyBase>[0]["options"]) => {
|
|
30
|
+
handler: (req: NextApiRequest, res: NextApiResponse<any>) => Promise<any>;
|
|
31
|
+
};
|
|
23
32
|
|
|
24
|
-
export { serve, servePagesRouter };
|
|
33
|
+
export { createWorkflow, createWorkflowPagesRouter, serve, serveMany, serveManyPagesRouter, servePagesRouter };
|
package/nextjs.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { NextApiHandler } from 'next';
|
|
2
|
-
import { R as RouteFunction, k as PublicServeOptions } from './types-
|
|
1
|
+
import { NextApiHandler, NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
+
import { R as RouteFunction, k as PublicServeOptions, t as InvokableWorkflow } from './types-CYhDXnf8.js';
|
|
3
|
+
import { s as serveManyBase } from './serve-many-e4zufyXN.js';
|
|
3
4
|
import '@upstash/qstash';
|
|
4
5
|
import 'zod';
|
|
5
6
|
import 'ai';
|
|
@@ -14,11 +15,19 @@ import '@ai-sdk/openai';
|
|
|
14
15
|
* @param options workflow options
|
|
15
16
|
* @returns
|
|
16
17
|
*/
|
|
17
|
-
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: PublicServeOptions<TInitialPayload>) => {
|
|
18
|
+
declare const serve: <TInitialPayload = unknown, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload>) => {
|
|
18
19
|
POST: (request: Request) => Promise<Response>;
|
|
19
20
|
};
|
|
20
|
-
declare const
|
|
21
|
+
declare const createWorkflow: <TInitialPayload, TResult>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload> | undefined) => InvokableWorkflow<TInitialPayload, TResult>;
|
|
22
|
+
declare const serveMany: (workflows: Parameters<typeof serveManyBase>[0]["workflows"], options?: Parameters<typeof serveManyBase>[0]["options"]) => {
|
|
23
|
+
POST: (request: Request) => Promise<any>;
|
|
24
|
+
};
|
|
25
|
+
declare const servePagesRouter: <TInitialPayload = unknown, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload>) => {
|
|
21
26
|
handler: NextApiHandler;
|
|
22
27
|
};
|
|
28
|
+
declare const createWorkflowPagesRouter: <TInitialPayload, TResult>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload> | undefined) => InvokableWorkflow<TInitialPayload, TResult>;
|
|
29
|
+
declare const serveManyPagesRouter: (workflows: Parameters<typeof serveManyBase>[0]["workflows"], options?: Parameters<typeof serveManyBase>[0]["options"]) => {
|
|
30
|
+
handler: (req: NextApiRequest, res: NextApiResponse<any>) => Promise<any>;
|
|
31
|
+
};
|
|
23
32
|
|
|
24
|
-
export { serve, servePagesRouter };
|
|
33
|
+
export { createWorkflow, createWorkflowPagesRouter, serve, serveMany, serveManyPagesRouter, servePagesRouter };
|