@upstash/workflow 0.2.22-rc → 0.3.0-rc
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/README.md +39 -0
- package/astro.d.mts +3 -5
- package/astro.d.ts +3 -5
- package/astro.js +126 -397
- package/astro.mjs +1 -1
- package/{chunk-CAQSUCHB.mjs → chunk-AGYYZKP7.mjs} +94 -400
- package/cloudflare.d.mts +3 -5
- package/cloudflare.d.ts +3 -5
- package/cloudflare.js +126 -397
- package/cloudflare.mjs +1 -1
- package/express.d.mts +3 -5
- package/express.d.ts +3 -5
- package/express.js +128 -398
- package/express.mjs +3 -2
- package/h3.d.mts +3 -5
- package/h3.d.ts +3 -5
- package/h3.js +136 -410
- package/h3.mjs +11 -14
- package/hono.d.mts +4 -6
- package/hono.d.ts +4 -6
- package/hono.js +126 -397
- package/hono.mjs +1 -1
- package/index.d.mts +11 -5
- package/index.d.ts +11 -5
- package/index.js +130 -433
- package/index.mjs +5 -6
- package/nextjs.d.mts +4 -6
- package/nextjs.d.ts +4 -6
- package/nextjs.js +128 -398
- package/nextjs.mjs +3 -2
- package/package.json +1 -1
- package/{serve-many-BNusWYgt.d.mts → serve-many-DEwKPF6H.d.mts} +1 -1
- package/{serve-many-CXqQP3RI.d.ts → serve-many-DVtHRxeg.d.ts} +1 -1
- package/solidjs.d.mts +1 -3
- package/solidjs.d.ts +1 -3
- package/solidjs.js +126 -397
- package/solidjs.mjs +1 -1
- package/svelte.d.mts +4 -6
- package/svelte.d.ts +4 -6
- package/svelte.js +126 -397
- package/svelte.mjs +1 -1
- package/tanstack.d.mts +3 -5
- package/tanstack.d.ts +3 -5
- package/tanstack.js +126 -397
- package/tanstack.mjs +1 -1
- package/{types-Q3dM0UlR.d.ts → types-DESkn7K9.d.mts} +15 -306
- package/{types-Q3dM0UlR.d.mts → types-DESkn7K9.d.ts} +15 -306
package/README.md
CHANGED
|
@@ -83,6 +83,15 @@ waiting for an event or get the workflows waiting for an event:
|
|
|
83
83
|
import { Client } from "@upstash/workflow";
|
|
84
84
|
const client = new Client({ token: "<QSTASH_TOKEN>" });
|
|
85
85
|
|
|
86
|
+
// trigger a workflow
|
|
87
|
+
const { workflowRunId } = await client.trigger({
|
|
88
|
+
url: "https://workflow-endpoint.com",
|
|
89
|
+
body: "hello there!", // Optional body
|
|
90
|
+
headers: { ... }, // Optional headers
|
|
91
|
+
workflowRunId: "my-workflow", // Optional workflow run ID
|
|
92
|
+
retries: 3 // Optional retries for the initial request
|
|
93
|
+
});
|
|
94
|
+
|
|
86
95
|
// cancel workflow:
|
|
87
96
|
await client.cancel({ workflowRunId: "<WORKFLOW_RUN_ID>" });
|
|
88
97
|
|
|
@@ -98,6 +107,36 @@ const result = await client.getWaiters({
|
|
|
98
107
|
});
|
|
99
108
|
```
|
|
100
109
|
|
|
110
|
+
## Telemetry
|
|
111
|
+
|
|
112
|
+
This sdk sends anonymous telemetry headers to help us improve your experience.
|
|
113
|
+
We collect the following:
|
|
114
|
+
|
|
115
|
+
- SDK version
|
|
116
|
+
- Platform (Cloudflare, AWS or Vercel)
|
|
117
|
+
- Runtime version (node@18.x)
|
|
118
|
+
|
|
119
|
+
You can opt out by setting `disableTelemetry: true` when triggering the workflow and in the serve options:
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
// client
|
|
123
|
+
const client = new Client(/***/);
|
|
124
|
+
await client.trigger({
|
|
125
|
+
// ...
|
|
126
|
+
disableTelemetry: true,
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// workflow endpoint
|
|
130
|
+
export const { POST } = serve(
|
|
131
|
+
async (context) => {
|
|
132
|
+
// ...
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
disableTelemetry: true,
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
```
|
|
139
|
+
|
|
101
140
|
## Contributing
|
|
102
141
|
|
|
103
142
|
### Setup
|
package/astro.d.mts
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { APIContext, APIRoute } from 'astro';
|
|
2
|
-
import { g as WorkflowContext, n as PublicServeOptions, y as InvokableWorkflow } from './types-
|
|
3
|
-
import { s as serveManyBase } from './serve-many-
|
|
2
|
+
import { g as WorkflowContext, n as PublicServeOptions, y as InvokableWorkflow } from './types-DESkn7K9.mjs';
|
|
3
|
+
import { s as serveManyBase } from './serve-many-DEwKPF6H.mjs';
|
|
4
4
|
import '@upstash/qstash';
|
|
5
5
|
import 'zod';
|
|
6
|
-
import 'ai';
|
|
7
|
-
import '@ai-sdk/openai';
|
|
8
6
|
|
|
9
7
|
declare function serve<TInitialPayload = unknown, TResult = unknown>(routeFunction: (workflowContext: WorkflowContext<TInitialPayload>, apiContext: APIContext) => Promise<TResult>, options?: PublicServeOptions<TInitialPayload>): {
|
|
10
8
|
POST: APIRoute;
|
|
11
9
|
};
|
|
12
|
-
declare const createWorkflow: <TInitialPayload, TResult>(
|
|
10
|
+
declare const createWorkflow: <TInitialPayload, TResult>(...params: Parameters<typeof serve<TInitialPayload, TResult>>) => InvokableWorkflow<TInitialPayload, TResult>;
|
|
13
11
|
declare const serveMany: (workflows: Parameters<typeof serveManyBase>[0]["workflows"], options?: Parameters<typeof serveManyBase>[0]["options"]) => {
|
|
14
12
|
POST: (context: APIContext<Record<string, any>, Record<string, string | undefined>>) => Promise<any>;
|
|
15
13
|
};
|
package/astro.d.ts
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { APIContext, APIRoute } from 'astro';
|
|
2
|
-
import { g as WorkflowContext, n as PublicServeOptions, y as InvokableWorkflow } from './types-
|
|
3
|
-
import { s as serveManyBase } from './serve-many-
|
|
2
|
+
import { g as WorkflowContext, n as PublicServeOptions, y as InvokableWorkflow } from './types-DESkn7K9.js';
|
|
3
|
+
import { s as serveManyBase } from './serve-many-DVtHRxeg.js';
|
|
4
4
|
import '@upstash/qstash';
|
|
5
5
|
import 'zod';
|
|
6
|
-
import 'ai';
|
|
7
|
-
import '@ai-sdk/openai';
|
|
8
6
|
|
|
9
7
|
declare function serve<TInitialPayload = unknown, TResult = unknown>(routeFunction: (workflowContext: WorkflowContext<TInitialPayload>, apiContext: APIContext) => Promise<TResult>, options?: PublicServeOptions<TInitialPayload>): {
|
|
10
8
|
POST: APIRoute;
|
|
11
9
|
};
|
|
12
|
-
declare const createWorkflow: <TInitialPayload, TResult>(
|
|
10
|
+
declare const createWorkflow: <TInitialPayload, TResult>(...params: Parameters<typeof serve<TInitialPayload, TResult>>) => InvokableWorkflow<TInitialPayload, TResult>;
|
|
13
11
|
declare const serveMany: (workflows: Parameters<typeof serveManyBase>[0]["workflows"], options?: Parameters<typeof serveManyBase>[0]["options"]) => {
|
|
14
12
|
POST: (context: APIContext<Record<string, any>, Record<string, string | undefined>>) => Promise<any>;
|
|
15
13
|
};
|