@upstash/workflow 0.2.12 → 0.2.14
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 +2 -2
- package/astro.d.ts +2 -2
- package/astro.js +1254 -1072
- package/astro.mjs +1 -1
- package/{chunk-4GTHIL7S.mjs → chunk-RMS2NQ3K.mjs} +918 -734
- package/cloudflare.d.mts +2 -2
- package/cloudflare.d.ts +2 -2
- package/cloudflare.js +1254 -1072
- package/cloudflare.mjs +1 -1
- package/express.d.mts +2 -2
- package/express.d.ts +2 -2
- package/express.js +1270 -1088
- package/express.mjs +1 -1
- package/h3.d.mts +2 -2
- package/h3.d.ts +2 -2
- package/h3.js +1254 -1072
- package/h3.mjs +1 -1
- package/hono.d.mts +2 -2
- package/hono.d.ts +2 -2
- package/hono.js +1255 -1073
- package/hono.mjs +2 -2
- package/index.d.mts +124 -15
- package/index.d.ts +124 -15
- package/index.js +1259 -1101
- package/index.mjs +32 -56
- package/nextjs.d.mts +2 -2
- package/nextjs.d.ts +2 -2
- package/nextjs.js +1254 -1072
- package/nextjs.mjs +1 -1
- package/package.json +1 -1
- package/{serve-many-DLguU9iR.d.mts → serve-many-BF71QZHQ.d.mts} +1 -1
- package/{serve-many-BdMq5rFX.d.ts → serve-many-BMlN2PAB.d.ts} +1 -1
- package/solidjs.d.mts +1 -1
- package/solidjs.d.ts +1 -1
- package/solidjs.js +1220 -1038
- package/solidjs.mjs +1 -1
- package/svelte.d.mts +2 -2
- package/svelte.d.ts +2 -2
- package/svelte.js +1254 -1072
- package/svelte.mjs +1 -1
- package/{types-D1W0VOpy.d.ts → types-C1WIgVLA.d.mts} +58 -45
- package/{types-D1W0VOpy.d.mts → types-C1WIgVLA.d.ts} +58 -45
package/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
makeNotifyRequest,
|
|
11
11
|
serve,
|
|
12
12
|
triggerFirstInvocation
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-RMS2NQ3K.mjs";
|
|
14
14
|
|
|
15
15
|
// src/client/index.ts
|
|
16
16
|
import { Client as QStashClient } from "@upstash/qstash";
|
|
@@ -140,63 +140,39 @@ var Client = class {
|
|
|
140
140
|
async getWaiters({ eventId }) {
|
|
141
141
|
return await makeGetWaitersRequest(this.client.http, eventId);
|
|
142
142
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
* @returns workflow run id
|
|
170
|
-
*/
|
|
171
|
-
async trigger({
|
|
172
|
-
url,
|
|
173
|
-
body,
|
|
174
|
-
headers,
|
|
175
|
-
workflowRunId,
|
|
176
|
-
retries,
|
|
177
|
-
flowControl
|
|
178
|
-
}) {
|
|
179
|
-
const finalWorkflowRunId = getWorkflowRunId(workflowRunId);
|
|
180
|
-
const context = new WorkflowContext({
|
|
181
|
-
qstashClient: this.client,
|
|
182
|
-
// @ts-expect-error headers type mismatch
|
|
183
|
-
headers: new Headers(headers ?? {}),
|
|
184
|
-
initialPayload: body,
|
|
185
|
-
steps: [],
|
|
186
|
-
url,
|
|
187
|
-
workflowRunId: finalWorkflowRunId,
|
|
188
|
-
retries,
|
|
189
|
-
telemetry: void 0,
|
|
190
|
-
// can't know workflow telemetry here
|
|
191
|
-
flowControl
|
|
192
|
-
});
|
|
193
|
-
const result = await triggerFirstInvocation({
|
|
194
|
-
workflowContext: context,
|
|
195
|
-
telemetry: void 0
|
|
196
|
-
// can't know workflow telemetry here
|
|
143
|
+
async trigger(params) {
|
|
144
|
+
const isBatchInput = Array.isArray(params);
|
|
145
|
+
const options = isBatchInput ? params : [params];
|
|
146
|
+
const invocations = options.map((option) => {
|
|
147
|
+
const failureUrl = option.useFailureFunction ? option.url : option.failureUrl;
|
|
148
|
+
const finalWorkflowRunId = getWorkflowRunId(option.workflowRunId);
|
|
149
|
+
const context = new WorkflowContext({
|
|
150
|
+
qstashClient: this.client,
|
|
151
|
+
// @ts-expect-error headers type mismatch
|
|
152
|
+
headers: new Headers(option.headers ?? {}),
|
|
153
|
+
initialPayload: option.body,
|
|
154
|
+
steps: [],
|
|
155
|
+
url: option.url,
|
|
156
|
+
workflowRunId: finalWorkflowRunId,
|
|
157
|
+
retries: option.retries,
|
|
158
|
+
telemetry: void 0,
|
|
159
|
+
// can't know workflow telemetry here
|
|
160
|
+
flowControl: option.flowControl,
|
|
161
|
+
failureUrl
|
|
162
|
+
});
|
|
163
|
+
return {
|
|
164
|
+
workflowContext: context,
|
|
165
|
+
telemetry: void 0,
|
|
166
|
+
// can't know workflow telemetry here
|
|
167
|
+
delay: option.delay
|
|
168
|
+
};
|
|
197
169
|
});
|
|
170
|
+
const result = await triggerFirstInvocation(invocations);
|
|
171
|
+
const workflowRunIds = invocations.map(
|
|
172
|
+
(invocation) => invocation.workflowContext.workflowRunId
|
|
173
|
+
);
|
|
198
174
|
if (result.isOk()) {
|
|
199
|
-
return { workflowRunId:
|
|
175
|
+
return isBatchInput ? workflowRunIds.map((id) => ({ workflowRunId: id })) : { workflowRunId: workflowRunIds[0] };
|
|
200
176
|
} else {
|
|
201
177
|
throw result.error;
|
|
202
178
|
}
|
package/nextjs.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NextApiHandler, NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
-
import { R as RouteFunction, k as PublicServeOptions, t as InvokableWorkflow } from './types-
|
|
3
|
-
import { s as serveManyBase } from './serve-many-
|
|
2
|
+
import { R as RouteFunction, k as PublicServeOptions, t as InvokableWorkflow } from './types-C1WIgVLA.mjs';
|
|
3
|
+
import { s as serveManyBase } from './serve-many-BF71QZHQ.mjs';
|
|
4
4
|
import '@upstash/qstash';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import 'ai';
|
package/nextjs.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NextApiHandler, NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
-
import { R as RouteFunction, k as PublicServeOptions, t as InvokableWorkflow } from './types-
|
|
3
|
-
import { s as serveManyBase } from './serve-many-
|
|
2
|
+
import { R as RouteFunction, k as PublicServeOptions, t as InvokableWorkflow } from './types-C1WIgVLA.js';
|
|
3
|
+
import { s as serveManyBase } from './serve-many-BMlN2PAB.js';
|
|
4
4
|
import '@upstash/qstash';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import 'ai';
|