@upstash/workflow 0.2.8-rc-invoke → 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 +4 -4
- package/astro.d.ts +4 -4
- package/astro.js +282 -135
- package/astro.mjs +17 -15
- package/{chunk-IWAW7GIG.mjs → chunk-IPXJZU3K.mjs} +851 -592
- package/cloudflare.d.mts +4 -4
- package/cloudflare.d.ts +4 -4
- package/cloudflare.js +278 -135
- package/cloudflare.mjs +13 -15
- package/express.d.mts +4 -4
- package/express.d.ts +4 -4
- package/express.js +281 -144
- package/express.mjs +16 -22
- package/h3.d.mts +4 -4
- package/h3.d.ts +4 -4
- package/h3.js +275 -135
- package/h3.mjs +10 -15
- package/hono.d.mts +4 -4
- package/hono.d.ts +4 -4
- package/hono.js +277 -134
- package/hono.mjs +12 -14
- package/index.d.mts +268 -5
- package/index.d.ts +268 -5
- package/index.js +297 -43
- package/index.mjs +60 -3
- package/nextjs.d.mts +6 -6
- package/nextjs.d.ts +6 -6
- package/nextjs.js +286 -143
- package/nextjs.mjs +21 -23
- 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 +1 -1
- package/solidjs.d.ts +1 -1
- package/solidjs.js +207 -41
- package/solidjs.mjs +1 -1
- package/svelte.d.mts +8 -9
- package/svelte.d.ts +8 -9
- package/svelte.js +278 -135
- package/svelte.mjs +13 -15
- package/{types-C7Y7WUQd.d.mts → types-CYhDXnf8.d.mts} +110 -18
- package/{types-C7Y7WUQd.d.ts → types-CYhDXnf8.d.ts} +110 -18
- package/chunk-LCZMBGEM.mjs +0 -95
- package/serve-many-BlBvXfBS.d.mts +0 -10
- package/serve-many-Dw-UUnH6.d.ts +0 -10
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-
|
|
13
|
+
} from "./chunk-IPXJZU3K.mjs";
|
|
13
14
|
|
|
14
15
|
// src/client/index.ts
|
|
15
16
|
import { Client as QStashClient } from "@upstash/qstash";
|
|
@@ -172,7 +173,8 @@ var Client = class {
|
|
|
172
173
|
body,
|
|
173
174
|
headers,
|
|
174
175
|
workflowRunId,
|
|
175
|
-
retries
|
|
176
|
+
retries,
|
|
177
|
+
flowControl
|
|
176
178
|
}) {
|
|
177
179
|
const finalWorkflowRunId = getWorkflowRunId(workflowRunId);
|
|
178
180
|
const context = new WorkflowContext({
|
|
@@ -184,8 +186,9 @@ var Client = class {
|
|
|
184
186
|
url,
|
|
185
187
|
workflowRunId: finalWorkflowRunId,
|
|
186
188
|
retries,
|
|
187
|
-
telemetry: void 0
|
|
189
|
+
telemetry: void 0,
|
|
188
190
|
// can't know workflow telemetry here
|
|
191
|
+
flowControl
|
|
189
192
|
});
|
|
190
193
|
const result = await triggerFirstInvocation({
|
|
191
194
|
workflowContext: context,
|
|
@@ -198,6 +201,59 @@ var Client = class {
|
|
|
198
201
|
throw result.error;
|
|
199
202
|
}
|
|
200
203
|
}
|
|
204
|
+
/**
|
|
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
|
+
*/
|
|
231
|
+
async logs(params) {
|
|
232
|
+
const { workflowRunId, cursor, count, state, workflowUrl, workflowCreatedAt } = params ?? {};
|
|
233
|
+
const urlParams = new URLSearchParams({ groupBy: "workflowRunId" });
|
|
234
|
+
if (workflowRunId) {
|
|
235
|
+
urlParams.append("workflowRunId", workflowRunId);
|
|
236
|
+
}
|
|
237
|
+
if (cursor) {
|
|
238
|
+
urlParams.append("cursor", cursor);
|
|
239
|
+
}
|
|
240
|
+
if (count) {
|
|
241
|
+
urlParams.append("count", count.toString());
|
|
242
|
+
}
|
|
243
|
+
if (state) {
|
|
244
|
+
urlParams.append("state", state);
|
|
245
|
+
}
|
|
246
|
+
if (workflowUrl) {
|
|
247
|
+
urlParams.append("workflowUrl", workflowUrl);
|
|
248
|
+
}
|
|
249
|
+
if (workflowCreatedAt) {
|
|
250
|
+
urlParams.append("workflowCreatedAt", workflowCreatedAt.toString());
|
|
251
|
+
}
|
|
252
|
+
const result = await this.client.http.request({
|
|
253
|
+
path: ["v2", "workflows", `events?${urlParams.toString()}`]
|
|
254
|
+
});
|
|
255
|
+
return result;
|
|
256
|
+
}
|
|
201
257
|
};
|
|
202
258
|
export {
|
|
203
259
|
Client,
|
|
@@ -206,5 +262,6 @@ export {
|
|
|
206
262
|
WorkflowContext,
|
|
207
263
|
WorkflowError,
|
|
208
264
|
WorkflowLogger,
|
|
265
|
+
WorkflowTool,
|
|
209
266
|
serve
|
|
210
267
|
};
|
package/nextjs.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NextApiHandler, NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
-
import { R as RouteFunction,
|
|
3
|
-
import { s as serveManyBase } from './serve-many-
|
|
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';
|
|
4
4
|
import '@upstash/qstash';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import 'ai';
|
|
@@ -18,15 +18,15 @@ import '@ai-sdk/openai';
|
|
|
18
18
|
declare const serve: <TInitialPayload = unknown, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload>) => {
|
|
19
19
|
POST: (request: Request) => Promise<Response>;
|
|
20
20
|
};
|
|
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"]) => {
|
|
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
23
|
POST: (request: Request) => Promise<any>;
|
|
24
24
|
};
|
|
25
25
|
declare const servePagesRouter: <TInitialPayload = unknown, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload>) => {
|
|
26
26
|
handler: NextApiHandler;
|
|
27
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"]) => {
|
|
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
30
|
handler: (req: NextApiRequest, res: NextApiResponse<any>) => Promise<any>;
|
|
31
31
|
};
|
|
32
32
|
|
package/nextjs.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NextApiHandler, NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
-
import { R as RouteFunction,
|
|
3
|
-
import { s as serveManyBase } from './serve-many-
|
|
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';
|
|
4
4
|
import '@upstash/qstash';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import 'ai';
|
|
@@ -18,15 +18,15 @@ import '@ai-sdk/openai';
|
|
|
18
18
|
declare const serve: <TInitialPayload = unknown, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload>) => {
|
|
19
19
|
POST: (request: Request) => Promise<Response>;
|
|
20
20
|
};
|
|
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"]) => {
|
|
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
23
|
POST: (request: Request) => Promise<any>;
|
|
24
24
|
};
|
|
25
25
|
declare const servePagesRouter: <TInitialPayload = unknown, TResult = unknown>(routeFunction: RouteFunction<TInitialPayload, TResult>, options?: PublicServeOptions<TInitialPayload>) => {
|
|
26
26
|
handler: NextApiHandler;
|
|
27
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"]) => {
|
|
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
30
|
handler: (req: NextApiRequest, res: NextApiResponse<any>) => Promise<any>;
|
|
31
31
|
};
|
|
32
32
|
|