@upstash/workflow 1.3.2 → 1.4.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/astro.d.mts +3 -2
- package/astro.d.ts +3 -2
- package/astro.js +595 -140
- package/astro.mjs +3 -1
- package/{chunk-ICDNN4UW.mjs → chunk-UH6O5IJY.mjs} +751 -281
- package/cloudflare.d.mts +3 -2
- package/cloudflare.d.ts +3 -2
- package/cloudflare.js +595 -140
- package/cloudflare.mjs +3 -1
- package/express.d.mts +3 -2
- package/express.d.ts +3 -2
- package/express.js +596 -140
- package/express.mjs +4 -1
- package/h3.d.mts +3 -2
- package/h3.d.ts +3 -2
- package/h3.js +595 -140
- package/h3.mjs +3 -1
- package/hono.d.mts +3 -2
- package/hono.d.ts +3 -2
- package/hono.js +595 -140
- package/hono.mjs +3 -1
- package/index.d.mts +64 -17
- package/index.d.ts +64 -17
- package/index.js +652 -150
- package/index.mjs +49 -11
- package/nextjs.d.mts +3 -2
- package/nextjs.d.ts +3 -2
- package/nextjs.js +596 -140
- package/nextjs.mjs +4 -1
- package/package.json +1 -1
- package/react-router.d.mts +3 -2
- package/react-router.d.ts +3 -2
- package/react-router.js +595 -140
- package/react-router.mjs +3 -1
- package/{serve-many-iJF1IUXk.d.ts → serve-many-BCtZg31b.d.ts} +1 -1
- package/{serve-many-CG3BFvO3.d.mts → serve-many-CbIV7145.d.mts} +1 -1
- package/solidjs.d.mts +2 -1
- package/solidjs.d.ts +2 -1
- package/solidjs.js +595 -140
- package/solidjs.mjs +3 -1
- package/svelte.d.mts +3 -2
- package/svelte.d.ts +3 -2
- package/svelte.js +595 -140
- package/svelte.mjs +3 -1
- package/tanstack.d.mts +3 -2
- package/tanstack.d.ts +3 -2
- package/tanstack.js +595 -140
- package/tanstack.mjs +3 -1
- package/{types-CekOpKvz.d.ts → types-ffLPVG5_.d.mts} +248 -8
- package/{types-CekOpKvz.d.mts → types-ffLPVG5_.d.ts} +248 -8
package/index.mjs
CHANGED
|
@@ -8,8 +8,10 @@ import {
|
|
|
8
8
|
WorkflowMiddleware,
|
|
9
9
|
WorkflowNonRetryableError,
|
|
10
10
|
WorkflowRetryAfterError,
|
|
11
|
+
assertNonEmptyId,
|
|
11
12
|
buildBulkActionQueryParameters,
|
|
12
13
|
getWorkflowRunId,
|
|
14
|
+
isInstanceOf,
|
|
13
15
|
loggingMiddleware,
|
|
14
16
|
makeGetWaitersRequest,
|
|
15
17
|
makeNotifyRequest,
|
|
@@ -17,15 +19,17 @@ import {
|
|
|
17
19
|
prepareFlowControl,
|
|
18
20
|
serializeLabel,
|
|
19
21
|
serve,
|
|
22
|
+
toNonEmptyIdArray,
|
|
20
23
|
triggerFirstInvocation,
|
|
21
24
|
validateFlowControl,
|
|
22
25
|
validateLabel
|
|
23
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-UH6O5IJY.mjs";
|
|
24
27
|
|
|
25
28
|
// src/client/index.ts
|
|
26
|
-
import { Client as
|
|
29
|
+
import { Client as QStashClient2 } from "@upstash/qstash";
|
|
27
30
|
|
|
28
31
|
// src/client/dlq.ts
|
|
32
|
+
import { QstashError } from "@upstash/qstash";
|
|
29
33
|
function buildResumeRestartHeaders(options) {
|
|
30
34
|
const headers = {};
|
|
31
35
|
if (options?.flowControl) {
|
|
@@ -86,8 +90,11 @@ var DLQ = class {
|
|
|
86
90
|
});
|
|
87
91
|
return Array.isArray(dlqId) ? workflowRuns : workflowRuns[0];
|
|
88
92
|
}
|
|
89
|
-
if (typeof request === "string"
|
|
90
|
-
|
|
93
|
+
if (typeof request === "string" || Array.isArray(request)) {
|
|
94
|
+
const ids = toNonEmptyIdArray(request, "DLQ id");
|
|
95
|
+
if (ids.length === 0) return { workflowRuns: [] };
|
|
96
|
+
request = ids;
|
|
97
|
+
}
|
|
91
98
|
const filters = Array.isArray(request) ? { dlqIds: request } : request;
|
|
92
99
|
return normalizeCursor(
|
|
93
100
|
await this.client.http.request({
|
|
@@ -110,8 +117,11 @@ var DLQ = class {
|
|
|
110
117
|
});
|
|
111
118
|
return Array.isArray(dlqId) ? workflowRuns : workflowRuns[0];
|
|
112
119
|
}
|
|
113
|
-
if (typeof request === "string"
|
|
114
|
-
|
|
120
|
+
if (typeof request === "string" || Array.isArray(request)) {
|
|
121
|
+
const ids = toNonEmptyIdArray(request, "DLQ id");
|
|
122
|
+
if (ids.length === 0) return { workflowRuns: [] };
|
|
123
|
+
request = ids;
|
|
124
|
+
}
|
|
115
125
|
const filters = Array.isArray(request) ? { dlqIds: request } : request;
|
|
116
126
|
return normalizeCursor(
|
|
117
127
|
await this.client.http.request({
|
|
@@ -130,12 +140,34 @@ var DLQ = class {
|
|
|
130
140
|
* @returns response with workflow run information
|
|
131
141
|
*/
|
|
132
142
|
async retryFailureFunction({ dlqId }) {
|
|
143
|
+
assertNonEmptyId(dlqId, "DLQ id");
|
|
133
144
|
const response = await this.client.http.request({
|
|
134
145
|
path: ["v2", "workflows", "dlq", "callback", dlqId],
|
|
135
146
|
method: "POST"
|
|
136
147
|
});
|
|
137
148
|
return response;
|
|
138
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Cancel the in-progress failure function (failureUrl/failureFunction) call
|
|
152
|
+
* of a workflow run.
|
|
153
|
+
*
|
|
154
|
+
* Fails if the run has no failure function call in progress.
|
|
155
|
+
*
|
|
156
|
+
* @param dlqId - The ID of the DLQ message whose failure function call will be canceled
|
|
157
|
+
*/
|
|
158
|
+
async cancelFailureFunction({ dlqId }) {
|
|
159
|
+
assertNonEmptyId(dlqId, "DLQ id");
|
|
160
|
+
try {
|
|
161
|
+
await this.client.http.request({
|
|
162
|
+
path: ["v2", "workflows", "dlq", "callback", dlqId],
|
|
163
|
+
method: "DELETE",
|
|
164
|
+
parseResponseAsJson: false
|
|
165
|
+
});
|
|
166
|
+
} catch (error) {
|
|
167
|
+
if (isInstanceOf(error, QstashError) && error.status === 302) return;
|
|
168
|
+
throw error;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
139
171
|
/**
|
|
140
172
|
* Delete DLQ messages.
|
|
141
173
|
*
|
|
@@ -157,8 +189,11 @@ var DLQ = class {
|
|
|
157
189
|
* ```
|
|
158
190
|
*/
|
|
159
191
|
async delete(request) {
|
|
160
|
-
if (typeof request === "string"
|
|
161
|
-
|
|
192
|
+
if (typeof request === "string" || Array.isArray(request)) {
|
|
193
|
+
const ids = toNonEmptyIdArray(request, "DLQ id");
|
|
194
|
+
if (ids.length === 0) return { deleted: 0 };
|
|
195
|
+
request = ids;
|
|
196
|
+
}
|
|
162
197
|
const filters = Array.isArray(request) ? { dlqIds: request } : request;
|
|
163
198
|
return normalizeCursor(
|
|
164
199
|
await this.client.http.request({
|
|
@@ -174,7 +209,7 @@ var DLQ = class {
|
|
|
174
209
|
var Client = class {
|
|
175
210
|
client;
|
|
176
211
|
constructor(clientConfig) {
|
|
177
|
-
this.client = new
|
|
212
|
+
this.client = new QStashClient2(clientConfig);
|
|
178
213
|
}
|
|
179
214
|
async cancel(request) {
|
|
180
215
|
if (typeof request === "object" && !Array.isArray(request) && ("ids" in request || "urlStartingWith" in request)) {
|
|
@@ -187,8 +222,11 @@ var Client = class {
|
|
|
187
222
|
return this.cancel({ filter: { workflowUrlStartingWith: legacy.urlStartingWith } });
|
|
188
223
|
}
|
|
189
224
|
}
|
|
190
|
-
if (typeof request === "string"
|
|
191
|
-
|
|
225
|
+
if (typeof request === "string" || Array.isArray(request)) {
|
|
226
|
+
const ids = toNonEmptyIdArray(request, "Workflow run id");
|
|
227
|
+
if (ids.length === 0) return { cancelled: 0 };
|
|
228
|
+
request = ids;
|
|
229
|
+
}
|
|
192
230
|
const filters = Array.isArray(request) ? { workflowRunIds: request } : request;
|
|
193
231
|
return await this.client.http.request({
|
|
194
232
|
path: ["v2", "workflows", "runs"],
|
package/nextjs.d.mts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { NextApiHandler, NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
-
import { c as RouteFunction, d as WorkflowServeOptions, I as InvokableWorkflow } from './types-
|
|
3
|
-
import { s as serveManyBase } from './serve-many-
|
|
2
|
+
import { c as RouteFunction, d as WorkflowServeOptions, I as InvokableWorkflow } from './types-ffLPVG5_.mjs';
|
|
3
|
+
import { s as serveManyBase } from './serve-many-CbIV7145.mjs';
|
|
4
4
|
import '@upstash/qstash';
|
|
5
5
|
import 'zod';
|
|
6
|
+
import 'neverthrow';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Serve method to serve a Upstash Workflow in a Nextjs project
|
package/nextjs.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { NextApiHandler, NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
-
import { c as RouteFunction, d as WorkflowServeOptions, I as InvokableWorkflow } from './types-
|
|
3
|
-
import { s as serveManyBase } from './serve-many-
|
|
2
|
+
import { c as RouteFunction, d as WorkflowServeOptions, I as InvokableWorkflow } from './types-ffLPVG5_.js';
|
|
3
|
+
import { s as serveManyBase } from './serve-many-BCtZg31b.js';
|
|
4
4
|
import '@upstash/qstash';
|
|
5
5
|
import 'zod';
|
|
6
|
+
import 'neverthrow';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Serve method to serve a Upstash Workflow in a Nextjs project
|