@upstash/qstash 2.7.15 → 2.7.17
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/{chunk-Y52A3KZT.mjs → chunk-2V6WQVIN.mjs} +23 -9
- package/{chunk-LSYJT55T.mjs → chunk-IJTMXF3U.mjs} +1 -1
- package/{chunk-X4MWA7DF.mjs → chunk-JR675EKS.mjs} +1 -1
- package/{client-RORrka04.d.ts → client-BY4y-4To.d.mts} +21 -0
- package/{client-RORrka04.d.mts → client-BY4y-4To.d.ts} +21 -0
- package/cloudflare.d.mts +5 -1
- package/cloudflare.d.ts +5 -1
- package/cloudflare.js +23 -9
- package/cloudflare.mjs +1 -1
- package/h3.d.mts +6 -1
- package/h3.d.ts +6 -1
- package/h3.js +23 -9
- package/h3.mjs +3 -3
- package/hono.d.mts +5 -1
- package/hono.d.ts +5 -1
- package/hono.js +23 -9
- package/hono.mjs +1 -1
- package/index.d.mts +4 -3
- package/index.d.ts +4 -3
- package/index.js +22 -8
- package/index.mjs +2 -2
- package/nextjs.d.mts +10 -1
- package/nextjs.d.ts +10 -1
- package/nextjs.js +23 -9
- package/nextjs.mjs +1 -1
- package/nuxt.d.mts +3 -1
- package/nuxt.d.ts +3 -1
- package/nuxt.mjs +3 -3
- package/package.json +1 -1
- package/solidjs.d.mts +5 -1
- package/solidjs.d.ts +5 -1
- package/solidjs.js +23 -9
- package/solidjs.mjs +2 -2
- package/svelte.d.mts +5 -1
- package/svelte.d.ts +5 -1
- package/svelte.js +23 -9
- package/svelte.mjs +2 -2
- package/workflow.d.mts +1 -1
- package/workflow.d.ts +1 -1
- package/workflow.js +23 -9
- package/workflow.mjs +1 -1
package/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { R as RateLimit, C as ChatRateLimit, S as Step, F as FailureFunctionPayload, L as LLMOwner, B as BaseProvider, E as EmailOwner, P as ProviderInfo } from './client-
|
|
2
|
-
export { A as AddEndpointsRequest, y as BodyInit, I as Chat, K as ChatCompletion, N as ChatCompletionChunk, J as ChatCompletionMessage, _ as ChatRequest, h as Client, p as CreateScheduleRequest, r as Endpoint, v as Event, w as EventPayload, g as EventsRequest, x as GetEventsPayload, G as GetEventsResponse, H as HTTPMethods, z as HeadersInit, M as Message, m as MessagePayload, n as Messages, Y as OpenAIChatModel, Z as PromptChatRequest, d as PublishBatchRequest, f as PublishJsonRequest, e as PublishRequest, l as PublishResponse, i as PublishToApiResponse, k as PublishToUrlGroupsResponse, j as PublishToUrlResponse, Q as QueueRequest, c as Receiver, a as ReceiverConfig, s as RemoveEndpointsRequest, D as RequestOptions, o as Schedule, q as Schedules, b as SignatureError, u as State, T as StreamDisabled, O as StreamEnabled, X as StreamParameter, U as UrlGroup, t as UrlGroups, V as VerifyRequest, W as WithCursor, a1 as anthropic, a2 as custom, a0 as openai, $ as upstash } from './client-
|
|
1
|
+
import { R as RateLimit, C as ChatRateLimit, S as Step, F as FailureFunctionPayload, L as LLMOwner, B as BaseProvider, E as EmailOwner, P as ProviderInfo } from './client-BY4y-4To.js';
|
|
2
|
+
export { A as AddEndpointsRequest, y as BodyInit, I as Chat, K as ChatCompletion, N as ChatCompletionChunk, J as ChatCompletionMessage, _ as ChatRequest, h as Client, p as CreateScheduleRequest, r as Endpoint, v as Event, w as EventPayload, g as EventsRequest, x as GetEventsPayload, G as GetEventsResponse, H as HTTPMethods, z as HeadersInit, M as Message, m as MessagePayload, n as Messages, Y as OpenAIChatModel, Z as PromptChatRequest, d as PublishBatchRequest, f as PublishJsonRequest, e as PublishRequest, l as PublishResponse, i as PublishToApiResponse, k as PublishToUrlGroupsResponse, j as PublishToUrlResponse, Q as QueueRequest, c as Receiver, a as ReceiverConfig, s as RemoveEndpointsRequest, D as RequestOptions, o as Schedule, q as Schedules, b as SignatureError, u as State, T as StreamDisabled, O as StreamEnabled, X as StreamParameter, U as UrlGroup, t as UrlGroups, V as VerifyRequest, W as WithCursor, a1 as anthropic, a2 as custom, a0 as openai, $ as upstash } from './client-BY4y-4To.js';
|
|
3
3
|
import 'neverthrow';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Result of 500 Internal Server Error
|
|
7
7
|
*/
|
|
8
8
|
declare class QstashError extends Error {
|
|
9
|
-
|
|
9
|
+
readonly status?: number;
|
|
10
|
+
constructor(message: string, status?: number);
|
|
10
11
|
}
|
|
11
12
|
declare class QstashRatelimitError extends QstashError {
|
|
12
13
|
limit: string | null;
|
package/index.js
CHANGED
|
@@ -172,10 +172,13 @@ var DLQ = class {
|
|
|
172
172
|
};
|
|
173
173
|
|
|
174
174
|
// src/client/error.ts
|
|
175
|
+
var RATELIMIT_STATUS = 429;
|
|
175
176
|
var QstashError = class extends Error {
|
|
176
|
-
|
|
177
|
+
status;
|
|
178
|
+
constructor(message, status) {
|
|
177
179
|
super(message);
|
|
178
180
|
this.name = "QstashError";
|
|
181
|
+
this.status = status;
|
|
179
182
|
}
|
|
180
183
|
};
|
|
181
184
|
var QstashRatelimitError = class extends QstashError {
|
|
@@ -183,7 +186,7 @@ var QstashRatelimitError = class extends QstashError {
|
|
|
183
186
|
remaining;
|
|
184
187
|
reset;
|
|
185
188
|
constructor(args) {
|
|
186
|
-
super(`Exceeded burst rate limit. ${JSON.stringify(args)}
|
|
189
|
+
super(`Exceeded burst rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
|
|
187
190
|
this.name = "QstashRatelimitError";
|
|
188
191
|
this.limit = args.limit;
|
|
189
192
|
this.remaining = args.remaining;
|
|
@@ -198,7 +201,8 @@ var QstashChatRatelimitError = class extends QstashError {
|
|
|
198
201
|
resetRequests;
|
|
199
202
|
resetTokens;
|
|
200
203
|
constructor(args) {
|
|
201
|
-
super(`Exceeded chat rate limit. ${JSON.stringify(args)}
|
|
204
|
+
super(`Exceeded chat rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
|
|
205
|
+
this.name = "QstashChatRatelimitError";
|
|
202
206
|
this.limitRequests = args["limit-requests"];
|
|
203
207
|
this.limitTokens = args["limit-tokens"];
|
|
204
208
|
this.remainingRequests = args["remaining-requests"];
|
|
@@ -212,11 +216,11 @@ var QstashDailyRatelimitError = class extends QstashError {
|
|
|
212
216
|
remaining;
|
|
213
217
|
reset;
|
|
214
218
|
constructor(args) {
|
|
215
|
-
super(`Exceeded daily rate limit. ${JSON.stringify(args)}
|
|
219
|
+
super(`Exceeded daily rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
|
|
220
|
+
this.name = "QstashDailyRatelimitError";
|
|
216
221
|
this.limit = args.limit;
|
|
217
222
|
this.remaining = args.remaining;
|
|
218
223
|
this.reset = args.reset;
|
|
219
|
-
this.name = "QstashChatRatelimitError";
|
|
220
224
|
}
|
|
221
225
|
};
|
|
222
226
|
var QStashWorkflowError = class extends QstashError {
|
|
@@ -373,7 +377,10 @@ var HttpClient = class {
|
|
|
373
377
|
}
|
|
374
378
|
if (response.status < 200 || response.status >= 300) {
|
|
375
379
|
const body = await response.text();
|
|
376
|
-
throw new QstashError(
|
|
380
|
+
throw new QstashError(
|
|
381
|
+
body.length > 0 ? body : `Error: status=${response.status}`,
|
|
382
|
+
response.status
|
|
383
|
+
);
|
|
377
384
|
}
|
|
378
385
|
}
|
|
379
386
|
};
|
|
@@ -622,11 +629,14 @@ var LLMProvider = class extends BaseProvider {
|
|
|
622
629
|
}
|
|
623
630
|
getHeaders(options) {
|
|
624
631
|
if (this.owner === "upstash" && !options.analytics) {
|
|
625
|
-
return {};
|
|
632
|
+
return { "content-type": "application/json" };
|
|
626
633
|
}
|
|
627
634
|
const header = this.owner === "anthropic" ? "x-api-key" : "authorization";
|
|
628
635
|
const headerValue = this.owner === "anthropic" ? this.token : `Bearer ${this.token}`;
|
|
629
|
-
const headers = {
|
|
636
|
+
const headers = {
|
|
637
|
+
[header]: headerValue,
|
|
638
|
+
"content-type": "application/json"
|
|
639
|
+
};
|
|
630
640
|
if (this.owner === "openai" && this.organization) {
|
|
631
641
|
headers["OpenAI-Organization"] = this.organization;
|
|
632
642
|
}
|
|
@@ -1218,6 +1228,10 @@ var Client = class {
|
|
|
1218
1228
|
* Access the workflow API.
|
|
1219
1229
|
*
|
|
1220
1230
|
* cancel workflows.
|
|
1231
|
+
*
|
|
1232
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
1233
|
+
* Please use @upstash/workflow instead https://github.com/upstash/workflow-js
|
|
1234
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
1221
1235
|
*/
|
|
1222
1236
|
get workflow() {
|
|
1223
1237
|
return new Workflow(this.http);
|
package/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resend
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JR675EKS.mjs";
|
|
4
4
|
import {
|
|
5
5
|
Chat,
|
|
6
6
|
Client,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
openai,
|
|
23
23
|
setupAnalytics,
|
|
24
24
|
upstash
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-2V6WQVIN.mjs";
|
|
26
26
|
export {
|
|
27
27
|
Chat,
|
|
28
28
|
Client,
|
package/nextjs.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NextApiHandler } from 'next';
|
|
2
2
|
import { NextRequest, NextFetchEvent } from 'next/server';
|
|
3
|
-
import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-
|
|
3
|
+
import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-BY4y-4To.mjs';
|
|
4
4
|
import 'neverthrow';
|
|
5
5
|
|
|
6
6
|
type VerifySignatureConfig = {
|
|
@@ -31,8 +31,17 @@ declare function verifySignatureAppRouter(handler: ((request: Request, params?:
|
|
|
31
31
|
* @param routeFunction workflow function
|
|
32
32
|
* @param options workflow options
|
|
33
33
|
* @returns
|
|
34
|
+
*
|
|
35
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
36
|
+
* Please use https://github.com/upstash/workflow-js
|
|
37
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
34
38
|
*/
|
|
35
39
|
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => ((request: Request) => Promise<Response>);
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
42
|
+
* Please use https://github.com/upstash/workflow-js
|
|
43
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
44
|
+
*/
|
|
36
45
|
declare const servePagesRouter: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => NextApiHandler;
|
|
37
46
|
|
|
38
47
|
export { type VerifySignatureConfig, serve, servePagesRouter, verifySignature, verifySignatureAppRouter, verifySignatureEdge };
|
package/nextjs.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NextApiHandler } from 'next';
|
|
2
2
|
import { NextRequest, NextFetchEvent } from 'next/server';
|
|
3
|
-
import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-
|
|
3
|
+
import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-BY4y-4To.js';
|
|
4
4
|
import 'neverthrow';
|
|
5
5
|
|
|
6
6
|
type VerifySignatureConfig = {
|
|
@@ -31,8 +31,17 @@ declare function verifySignatureAppRouter(handler: ((request: Request, params?:
|
|
|
31
31
|
* @param routeFunction workflow function
|
|
32
32
|
* @param options workflow options
|
|
33
33
|
* @returns
|
|
34
|
+
*
|
|
35
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
36
|
+
* Please use https://github.com/upstash/workflow-js
|
|
37
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
34
38
|
*/
|
|
35
39
|
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => ((request: Request) => Promise<Response>);
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
42
|
+
* Please use https://github.com/upstash/workflow-js
|
|
43
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
44
|
+
*/
|
|
36
45
|
declare const servePagesRouter: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => NextApiHandler;
|
|
37
46
|
|
|
38
47
|
export { type VerifySignatureConfig, serve, servePagesRouter, verifySignature, verifySignatureAppRouter, verifySignatureEdge };
|
package/nextjs.js
CHANGED
|
@@ -156,10 +156,13 @@ var DLQ = class {
|
|
|
156
156
|
};
|
|
157
157
|
|
|
158
158
|
// src/client/error.ts
|
|
159
|
+
var RATELIMIT_STATUS = 429;
|
|
159
160
|
var QstashError = class extends Error {
|
|
160
|
-
|
|
161
|
+
status;
|
|
162
|
+
constructor(message, status) {
|
|
161
163
|
super(message);
|
|
162
164
|
this.name = "QstashError";
|
|
165
|
+
this.status = status;
|
|
163
166
|
}
|
|
164
167
|
};
|
|
165
168
|
var QstashRatelimitError = class extends QstashError {
|
|
@@ -167,7 +170,7 @@ var QstashRatelimitError = class extends QstashError {
|
|
|
167
170
|
remaining;
|
|
168
171
|
reset;
|
|
169
172
|
constructor(args) {
|
|
170
|
-
super(`Exceeded burst rate limit. ${JSON.stringify(args)}
|
|
173
|
+
super(`Exceeded burst rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
|
|
171
174
|
this.name = "QstashRatelimitError";
|
|
172
175
|
this.limit = args.limit;
|
|
173
176
|
this.remaining = args.remaining;
|
|
@@ -182,7 +185,8 @@ var QstashChatRatelimitError = class extends QstashError {
|
|
|
182
185
|
resetRequests;
|
|
183
186
|
resetTokens;
|
|
184
187
|
constructor(args) {
|
|
185
|
-
super(`Exceeded chat rate limit. ${JSON.stringify(args)}
|
|
188
|
+
super(`Exceeded chat rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
|
|
189
|
+
this.name = "QstashChatRatelimitError";
|
|
186
190
|
this.limitRequests = args["limit-requests"];
|
|
187
191
|
this.limitTokens = args["limit-tokens"];
|
|
188
192
|
this.remainingRequests = args["remaining-requests"];
|
|
@@ -196,11 +200,11 @@ var QstashDailyRatelimitError = class extends QstashError {
|
|
|
196
200
|
remaining;
|
|
197
201
|
reset;
|
|
198
202
|
constructor(args) {
|
|
199
|
-
super(`Exceeded daily rate limit. ${JSON.stringify(args)}
|
|
203
|
+
super(`Exceeded daily rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
|
|
204
|
+
this.name = "QstashDailyRatelimitError";
|
|
200
205
|
this.limit = args.limit;
|
|
201
206
|
this.remaining = args.remaining;
|
|
202
207
|
this.reset = args.reset;
|
|
203
|
-
this.name = "QstashChatRatelimitError";
|
|
204
208
|
}
|
|
205
209
|
};
|
|
206
210
|
var QStashWorkflowError = class extends QstashError {
|
|
@@ -357,7 +361,10 @@ var HttpClient = class {
|
|
|
357
361
|
}
|
|
358
362
|
if (response.status < 200 || response.status >= 300) {
|
|
359
363
|
const body = await response.text();
|
|
360
|
-
throw new QstashError(
|
|
364
|
+
throw new QstashError(
|
|
365
|
+
body.length > 0 ? body : `Error: status=${response.status}`,
|
|
366
|
+
response.status
|
|
367
|
+
);
|
|
361
368
|
}
|
|
362
369
|
}
|
|
363
370
|
};
|
|
@@ -606,11 +613,14 @@ var LLMProvider = class extends BaseProvider {
|
|
|
606
613
|
}
|
|
607
614
|
getHeaders(options) {
|
|
608
615
|
if (this.owner === "upstash" && !options.analytics) {
|
|
609
|
-
return {};
|
|
616
|
+
return { "content-type": "application/json" };
|
|
610
617
|
}
|
|
611
618
|
const header = this.owner === "anthropic" ? "x-api-key" : "authorization";
|
|
612
619
|
const headerValue = this.owner === "anthropic" ? this.token : `Bearer ${this.token}`;
|
|
613
|
-
const headers = {
|
|
620
|
+
const headers = {
|
|
621
|
+
[header]: headerValue,
|
|
622
|
+
"content-type": "application/json"
|
|
623
|
+
};
|
|
614
624
|
if (this.owner === "openai" && this.organization) {
|
|
615
625
|
headers["OpenAI-Organization"] = this.organization;
|
|
616
626
|
}
|
|
@@ -1160,6 +1170,10 @@ var Client = class {
|
|
|
1160
1170
|
* Access the workflow API.
|
|
1161
1171
|
*
|
|
1162
1172
|
* cancel workflows.
|
|
1173
|
+
*
|
|
1174
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
1175
|
+
* Please use @upstash/workflow instead https://github.com/upstash/workflow-js
|
|
1176
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
1163
1177
|
*/
|
|
1164
1178
|
get workflow() {
|
|
1165
1179
|
return new Workflow(this.http);
|
|
@@ -1880,7 +1894,7 @@ var validateParallelSteps = (lazySteps, stepsFromRequest) => {
|
|
|
1880
1894
|
};
|
|
1881
1895
|
var sortSteps = (steps) => {
|
|
1882
1896
|
const getStepId = (step) => step.targetStep ?? step.stepId;
|
|
1883
|
-
return steps.
|
|
1897
|
+
return [...steps].sort((step, stepOther) => getStepId(step) - getStepId(stepOther));
|
|
1884
1898
|
};
|
|
1885
1899
|
|
|
1886
1900
|
// src/client/workflow/steps.ts
|
package/nextjs.mjs
CHANGED
package/nuxt.d.mts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as h3 from 'h3';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @deprecated
|
|
4
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
5
|
+
* Please use https://github.com/upstash/workflow-js
|
|
6
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
5
7
|
*/
|
|
6
8
|
declare const verifySignatureNuxt: (handler: (event: h3.H3Event<h3.EventHandlerRequest>) => Promise<unknown>, config?: {
|
|
7
9
|
currentSigningKey?: string | undefined;
|
package/nuxt.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as h3 from 'h3';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @deprecated
|
|
4
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
5
|
+
* Please use https://github.com/upstash/workflow-js
|
|
6
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
5
7
|
*/
|
|
6
8
|
declare const verifySignatureNuxt: (handler: (event: h3.H3Event<h3.EventHandlerRequest>) => Promise<unknown>, config?: {
|
|
7
9
|
currentSigningKey?: string | undefined;
|
package/nuxt.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
verifySignatureH3
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-IJTMXF3U.mjs";
|
|
4
|
+
import "./chunk-JR675EKS.mjs";
|
|
5
|
+
import "./chunk-2V6WQVIN.mjs";
|
|
6
6
|
|
|
7
7
|
// platforms/nuxt.ts
|
|
8
8
|
var verifySignatureNuxt = verifySignatureH3;
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"v2.7.
|
|
1
|
+
{"version":"v2.7.17","name":"@upstash/qstash","description":"Official Typescript client for QStash","author":"Andreas Thomas <dev@chronark.com>","license":"MIT","homepage":"https://github.com/upstash/sdk-qstash-ts#readme","repository":{"type":"git","url":"git+https://github.com/upstash/sdk-qstash-ts.git"},"bugs":{"url":"https://github.com/upstash/sdk-qstash-ts/issues"},"main":"./index.js","module":"./index.mjs","types":"./index.d.ts","files":["./*"],"exports":{".":{"import":"./index.mjs","require":"./index.js"},"./dist/nextjs":{"import":"./nextjs.mjs","require":"./nextjs.js"},"./nextjs":{"import":"./nextjs.mjs","require":"./nextjs.js"},"./h3":{"import":"./h3.mjs","require":"./h3.js"},"./nuxt":{"import":"./nuxt.mjs","require":"./nuxt.js"},"./svelte":{"import":"./svelte.mjs","require":"./svelte.js"},"./solidjs":{"import":"./solidjs.mjs","require":"./solidjs.js"},"./workflow":{"import":"./workflow.mjs","require":"./workflow.js"},"./hono":{"import":"./hono.mjs","require":"./hono.js"},"./cloudflare":{"import":"./cloudflare.mjs","require":"./cloudflare.js"}},"keywords":["qstash","queue","events","serverless","upstash"],"scripts":{"build":"tsup && cp README.md ./dist/ && cp package.json ./dist/ && cp LICENSE ./dist/","test":"bun test src","fmt":"prettier --write .","lint":"tsc && eslint \"{src,platforms}/**/*.{js,ts,tsx}\" --quiet --fix","check-exports":"bun run build && cd dist && attw -P"},"devDependencies":{"@commitlint/cli":"^19.2.2","@commitlint/config-conventional":"^19.2.2","@eslint/eslintrc":"^3.1.0","@eslint/js":"^9.10.0","@solidjs/start":"^1.0.6","@sveltejs/kit":"^2.5.18","@types/bun":"^1.1.1","@types/crypto-js":"^4.2.0","@typescript-eslint/eslint-plugin":"^8.4.0","@typescript-eslint/parser":"^8.4.0","ai":"^3.1.28","bun-types":"^1.1.7","eslint":"^9.10.0","eslint-plugin-unicorn":"^51.0.1","h3":"^1.12.0","hono":"^4.5.8","husky":"^9.0.10","next":"^14.0.2","prettier":"^3.2.5","tsup":"latest","typescript":"^5.4.5","undici-types":"^6.16.0","vitest":"latest"},"dependencies":{"crypto-js":">=4.2.0","jose":"^5.2.3","neverthrow":"^7.0.1"}}
|
package/solidjs.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { APIHandler, APIEvent } from '@solidjs/start/server';
|
|
2
|
-
import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-
|
|
2
|
+
import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-BY4y-4To.mjs';
|
|
3
3
|
import 'neverthrow';
|
|
4
4
|
|
|
5
5
|
type VerifySignatureConfig = {
|
|
@@ -16,6 +16,10 @@ declare const verifySignatureSolidjs: (handler: APIHandler, config?: VerifySigna
|
|
|
16
16
|
* @param routeFunction workflow function
|
|
17
17
|
* @param options workflow options
|
|
18
18
|
* @returns
|
|
19
|
+
*
|
|
20
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
21
|
+
* Please use https://github.com/upstash/workflow-js
|
|
22
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
19
23
|
*/
|
|
20
24
|
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => (event: APIEvent) => Promise<Response>;
|
|
21
25
|
|
package/solidjs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { APIHandler, APIEvent } from '@solidjs/start/server';
|
|
2
|
-
import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-
|
|
2
|
+
import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-BY4y-4To.js';
|
|
3
3
|
import 'neverthrow';
|
|
4
4
|
|
|
5
5
|
type VerifySignatureConfig = {
|
|
@@ -16,6 +16,10 @@ declare const verifySignatureSolidjs: (handler: APIHandler, config?: VerifySigna
|
|
|
16
16
|
* @param routeFunction workflow function
|
|
17
17
|
* @param options workflow options
|
|
18
18
|
* @returns
|
|
19
|
+
*
|
|
20
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
21
|
+
* Please use https://github.com/upstash/workflow-js
|
|
22
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
19
23
|
*/
|
|
20
24
|
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => (event: APIEvent) => Promise<Response>;
|
|
21
25
|
|
package/solidjs.js
CHANGED
|
@@ -153,10 +153,13 @@ var DLQ = class {
|
|
|
153
153
|
};
|
|
154
154
|
|
|
155
155
|
// src/client/error.ts
|
|
156
|
+
var RATELIMIT_STATUS = 429;
|
|
156
157
|
var QstashError = class extends Error {
|
|
157
|
-
|
|
158
|
+
status;
|
|
159
|
+
constructor(message, status) {
|
|
158
160
|
super(message);
|
|
159
161
|
this.name = "QstashError";
|
|
162
|
+
this.status = status;
|
|
160
163
|
}
|
|
161
164
|
};
|
|
162
165
|
var QstashRatelimitError = class extends QstashError {
|
|
@@ -164,7 +167,7 @@ var QstashRatelimitError = class extends QstashError {
|
|
|
164
167
|
remaining;
|
|
165
168
|
reset;
|
|
166
169
|
constructor(args) {
|
|
167
|
-
super(`Exceeded burst rate limit. ${JSON.stringify(args)}
|
|
170
|
+
super(`Exceeded burst rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
|
|
168
171
|
this.name = "QstashRatelimitError";
|
|
169
172
|
this.limit = args.limit;
|
|
170
173
|
this.remaining = args.remaining;
|
|
@@ -179,7 +182,8 @@ var QstashChatRatelimitError = class extends QstashError {
|
|
|
179
182
|
resetRequests;
|
|
180
183
|
resetTokens;
|
|
181
184
|
constructor(args) {
|
|
182
|
-
super(`Exceeded chat rate limit. ${JSON.stringify(args)}
|
|
185
|
+
super(`Exceeded chat rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
|
|
186
|
+
this.name = "QstashChatRatelimitError";
|
|
183
187
|
this.limitRequests = args["limit-requests"];
|
|
184
188
|
this.limitTokens = args["limit-tokens"];
|
|
185
189
|
this.remainingRequests = args["remaining-requests"];
|
|
@@ -193,11 +197,11 @@ var QstashDailyRatelimitError = class extends QstashError {
|
|
|
193
197
|
remaining;
|
|
194
198
|
reset;
|
|
195
199
|
constructor(args) {
|
|
196
|
-
super(`Exceeded daily rate limit. ${JSON.stringify(args)}
|
|
200
|
+
super(`Exceeded daily rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
|
|
201
|
+
this.name = "QstashDailyRatelimitError";
|
|
197
202
|
this.limit = args.limit;
|
|
198
203
|
this.remaining = args.remaining;
|
|
199
204
|
this.reset = args.reset;
|
|
200
|
-
this.name = "QstashChatRatelimitError";
|
|
201
205
|
}
|
|
202
206
|
};
|
|
203
207
|
var QStashWorkflowError = class extends QstashError {
|
|
@@ -354,7 +358,10 @@ var HttpClient = class {
|
|
|
354
358
|
}
|
|
355
359
|
if (response.status < 200 || response.status >= 300) {
|
|
356
360
|
const body = await response.text();
|
|
357
|
-
throw new QstashError(
|
|
361
|
+
throw new QstashError(
|
|
362
|
+
body.length > 0 ? body : `Error: status=${response.status}`,
|
|
363
|
+
response.status
|
|
364
|
+
);
|
|
358
365
|
}
|
|
359
366
|
}
|
|
360
367
|
};
|
|
@@ -603,11 +610,14 @@ var LLMProvider = class extends BaseProvider {
|
|
|
603
610
|
}
|
|
604
611
|
getHeaders(options) {
|
|
605
612
|
if (this.owner === "upstash" && !options.analytics) {
|
|
606
|
-
return {};
|
|
613
|
+
return { "content-type": "application/json" };
|
|
607
614
|
}
|
|
608
615
|
const header = this.owner === "anthropic" ? "x-api-key" : "authorization";
|
|
609
616
|
const headerValue = this.owner === "anthropic" ? this.token : `Bearer ${this.token}`;
|
|
610
|
-
const headers = {
|
|
617
|
+
const headers = {
|
|
618
|
+
[header]: headerValue,
|
|
619
|
+
"content-type": "application/json"
|
|
620
|
+
};
|
|
611
621
|
if (this.owner === "openai" && this.organization) {
|
|
612
622
|
headers["OpenAI-Organization"] = this.organization;
|
|
613
623
|
}
|
|
@@ -1677,7 +1687,7 @@ var validateParallelSteps = (lazySteps, stepsFromRequest) => {
|
|
|
1677
1687
|
};
|
|
1678
1688
|
var sortSteps = (steps) => {
|
|
1679
1689
|
const getStepId = (step) => step.targetStep ?? step.stepId;
|
|
1680
|
-
return steps.
|
|
1690
|
+
return [...steps].sort((step, stepOther) => getStepId(step) - getStepId(stepOther));
|
|
1681
1691
|
};
|
|
1682
1692
|
|
|
1683
1693
|
// src/client/workflow/steps.ts
|
|
@@ -2543,6 +2553,10 @@ var Client = class {
|
|
|
2543
2553
|
* Access the workflow API.
|
|
2544
2554
|
*
|
|
2545
2555
|
* cancel workflows.
|
|
2556
|
+
*
|
|
2557
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
2558
|
+
* Please use @upstash/workflow instead https://github.com/upstash/workflow-js
|
|
2559
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
2546
2560
|
*/
|
|
2547
2561
|
get workflow() {
|
|
2548
2562
|
return new Workflow(this.http);
|
package/solidjs.mjs
CHANGED
package/svelte.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequestHandler } from '@sveltejs/kit';
|
|
2
|
-
import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-
|
|
2
|
+
import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-BY4y-4To.mjs';
|
|
3
3
|
import 'neverthrow';
|
|
4
4
|
|
|
5
5
|
type VerifySignatureConfig = {
|
|
@@ -16,6 +16,10 @@ declare const verifySignatureSvelte: <Parameters extends Partial<Record<string,
|
|
|
16
16
|
* @param routeFunction workflow function
|
|
17
17
|
* @param options workflow options
|
|
18
18
|
* @returns
|
|
19
|
+
*
|
|
20
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
21
|
+
* Please use https://github.com/upstash/workflow-js
|
|
22
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
19
23
|
*/
|
|
20
24
|
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish"> & {
|
|
21
25
|
env: WorkflowServeOptions["env"];
|
package/svelte.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequestHandler } from '@sveltejs/kit';
|
|
2
|
-
import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-
|
|
2
|
+
import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-BY4y-4To.js';
|
|
3
3
|
import 'neverthrow';
|
|
4
4
|
|
|
5
5
|
type VerifySignatureConfig = {
|
|
@@ -16,6 +16,10 @@ declare const verifySignatureSvelte: <Parameters extends Partial<Record<string,
|
|
|
16
16
|
* @param routeFunction workflow function
|
|
17
17
|
* @param options workflow options
|
|
18
18
|
* @returns
|
|
19
|
+
*
|
|
20
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
21
|
+
* Please use https://github.com/upstash/workflow-js
|
|
22
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
19
23
|
*/
|
|
20
24
|
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish"> & {
|
|
21
25
|
env: WorkflowServeOptions["env"];
|
package/svelte.js
CHANGED
|
@@ -153,10 +153,13 @@ var DLQ = class {
|
|
|
153
153
|
};
|
|
154
154
|
|
|
155
155
|
// src/client/error.ts
|
|
156
|
+
var RATELIMIT_STATUS = 429;
|
|
156
157
|
var QstashError = class extends Error {
|
|
157
|
-
|
|
158
|
+
status;
|
|
159
|
+
constructor(message, status) {
|
|
158
160
|
super(message);
|
|
159
161
|
this.name = "QstashError";
|
|
162
|
+
this.status = status;
|
|
160
163
|
}
|
|
161
164
|
};
|
|
162
165
|
var QstashRatelimitError = class extends QstashError {
|
|
@@ -164,7 +167,7 @@ var QstashRatelimitError = class extends QstashError {
|
|
|
164
167
|
remaining;
|
|
165
168
|
reset;
|
|
166
169
|
constructor(args) {
|
|
167
|
-
super(`Exceeded burst rate limit. ${JSON.stringify(args)}
|
|
170
|
+
super(`Exceeded burst rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
|
|
168
171
|
this.name = "QstashRatelimitError";
|
|
169
172
|
this.limit = args.limit;
|
|
170
173
|
this.remaining = args.remaining;
|
|
@@ -179,7 +182,8 @@ var QstashChatRatelimitError = class extends QstashError {
|
|
|
179
182
|
resetRequests;
|
|
180
183
|
resetTokens;
|
|
181
184
|
constructor(args) {
|
|
182
|
-
super(`Exceeded chat rate limit. ${JSON.stringify(args)}
|
|
185
|
+
super(`Exceeded chat rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
|
|
186
|
+
this.name = "QstashChatRatelimitError";
|
|
183
187
|
this.limitRequests = args["limit-requests"];
|
|
184
188
|
this.limitTokens = args["limit-tokens"];
|
|
185
189
|
this.remainingRequests = args["remaining-requests"];
|
|
@@ -193,11 +197,11 @@ var QstashDailyRatelimitError = class extends QstashError {
|
|
|
193
197
|
remaining;
|
|
194
198
|
reset;
|
|
195
199
|
constructor(args) {
|
|
196
|
-
super(`Exceeded daily rate limit. ${JSON.stringify(args)}
|
|
200
|
+
super(`Exceeded daily rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
|
|
201
|
+
this.name = "QstashDailyRatelimitError";
|
|
197
202
|
this.limit = args.limit;
|
|
198
203
|
this.remaining = args.remaining;
|
|
199
204
|
this.reset = args.reset;
|
|
200
|
-
this.name = "QstashChatRatelimitError";
|
|
201
205
|
}
|
|
202
206
|
};
|
|
203
207
|
var QStashWorkflowError = class extends QstashError {
|
|
@@ -354,7 +358,10 @@ var HttpClient = class {
|
|
|
354
358
|
}
|
|
355
359
|
if (response.status < 200 || response.status >= 300) {
|
|
356
360
|
const body = await response.text();
|
|
357
|
-
throw new QstashError(
|
|
361
|
+
throw new QstashError(
|
|
362
|
+
body.length > 0 ? body : `Error: status=${response.status}`,
|
|
363
|
+
response.status
|
|
364
|
+
);
|
|
358
365
|
}
|
|
359
366
|
}
|
|
360
367
|
};
|
|
@@ -603,11 +610,14 @@ var LLMProvider = class extends BaseProvider {
|
|
|
603
610
|
}
|
|
604
611
|
getHeaders(options) {
|
|
605
612
|
if (this.owner === "upstash" && !options.analytics) {
|
|
606
|
-
return {};
|
|
613
|
+
return { "content-type": "application/json" };
|
|
607
614
|
}
|
|
608
615
|
const header = this.owner === "anthropic" ? "x-api-key" : "authorization";
|
|
609
616
|
const headerValue = this.owner === "anthropic" ? this.token : `Bearer ${this.token}`;
|
|
610
|
-
const headers = {
|
|
617
|
+
const headers = {
|
|
618
|
+
[header]: headerValue,
|
|
619
|
+
"content-type": "application/json"
|
|
620
|
+
};
|
|
611
621
|
if (this.owner === "openai" && this.organization) {
|
|
612
622
|
headers["OpenAI-Organization"] = this.organization;
|
|
613
623
|
}
|
|
@@ -1677,7 +1687,7 @@ var validateParallelSteps = (lazySteps, stepsFromRequest) => {
|
|
|
1677
1687
|
};
|
|
1678
1688
|
var sortSteps = (steps) => {
|
|
1679
1689
|
const getStepId = (step) => step.targetStep ?? step.stepId;
|
|
1680
|
-
return steps.
|
|
1690
|
+
return [...steps].sort((step, stepOther) => getStepId(step) - getStepId(stepOther));
|
|
1681
1691
|
};
|
|
1682
1692
|
|
|
1683
1693
|
// src/client/workflow/steps.ts
|
|
@@ -2543,6 +2553,10 @@ var Client = class {
|
|
|
2543
2553
|
* Access the workflow API.
|
|
2544
2554
|
*
|
|
2545
2555
|
* cancel workflows.
|
|
2556
|
+
*
|
|
2557
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
2558
|
+
* Please use @upstash/workflow instead https://github.com/upstash/workflow-js
|
|
2559
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
2546
2560
|
*/
|
|
2547
2561
|
get workflow() {
|
|
2548
2562
|
return new Workflow(this.http);
|
package/svelte.mjs
CHANGED
package/workflow.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ag as AsyncStepFunction, a9 as DisabledWorkflowContext, F as FailureFunctionPayload, aj as FinishCondition, al as LogLevel, ai as ParallelCallState, ae as RawStep, ak as RequiredExceptFields, a3 as RouteFunction, S as Step, ah as StepFunction, ad as StepType, ac as StepTypes, af as SyncStepFunction, a5 as Workflow, aa as WorkflowClient, a8 as WorkflowContext, an as WorkflowLogger, am as WorkflowLoggerOptions, ab as WorkflowReceiver, a4 as WorkflowServeOptions, a6 as processOptions, a7 as serve } from './client-
|
|
1
|
+
export { ag as AsyncStepFunction, a9 as DisabledWorkflowContext, F as FailureFunctionPayload, aj as FinishCondition, al as LogLevel, ai as ParallelCallState, ae as RawStep, ak as RequiredExceptFields, a3 as RouteFunction, S as Step, ah as StepFunction, ad as StepType, ac as StepTypes, af as SyncStepFunction, a5 as Workflow, aa as WorkflowClient, a8 as WorkflowContext, an as WorkflowLogger, am as WorkflowLoggerOptions, ab as WorkflowReceiver, a4 as WorkflowServeOptions, a6 as processOptions, a7 as serve } from './client-BY4y-4To.mjs';
|
|
2
2
|
import 'neverthrow';
|
package/workflow.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ag as AsyncStepFunction, a9 as DisabledWorkflowContext, F as FailureFunctionPayload, aj as FinishCondition, al as LogLevel, ai as ParallelCallState, ae as RawStep, ak as RequiredExceptFields, a3 as RouteFunction, S as Step, ah as StepFunction, ad as StepType, ac as StepTypes, af as SyncStepFunction, a5 as Workflow, aa as WorkflowClient, a8 as WorkflowContext, an as WorkflowLogger, am as WorkflowLoggerOptions, ab as WorkflowReceiver, a4 as WorkflowServeOptions, a6 as processOptions, a7 as serve } from './client-
|
|
1
|
+
export { ag as AsyncStepFunction, a9 as DisabledWorkflowContext, F as FailureFunctionPayload, aj as FinishCondition, al as LogLevel, ai as ParallelCallState, ae as RawStep, ak as RequiredExceptFields, a3 as RouteFunction, S as Step, ah as StepFunction, ad as StepType, ac as StepTypes, af as SyncStepFunction, a5 as Workflow, aa as WorkflowClient, a8 as WorkflowContext, an as WorkflowLogger, am as WorkflowLoggerOptions, ab as WorkflowReceiver, a4 as WorkflowServeOptions, a6 as processOptions, a7 as serve } from './client-BY4y-4To.js';
|
|
2
2
|
import 'neverthrow';
|