@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
|
@@ -116,10 +116,13 @@ var DLQ = class {
|
|
|
116
116
|
};
|
|
117
117
|
|
|
118
118
|
// src/client/error.ts
|
|
119
|
+
var RATELIMIT_STATUS = 429;
|
|
119
120
|
var QstashError = class extends Error {
|
|
120
|
-
|
|
121
|
+
status;
|
|
122
|
+
constructor(message, status) {
|
|
121
123
|
super(message);
|
|
122
124
|
this.name = "QstashError";
|
|
125
|
+
this.status = status;
|
|
123
126
|
}
|
|
124
127
|
};
|
|
125
128
|
var QstashRatelimitError = class extends QstashError {
|
|
@@ -127,7 +130,7 @@ var QstashRatelimitError = class extends QstashError {
|
|
|
127
130
|
remaining;
|
|
128
131
|
reset;
|
|
129
132
|
constructor(args) {
|
|
130
|
-
super(`Exceeded burst rate limit. ${JSON.stringify(args)}
|
|
133
|
+
super(`Exceeded burst rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
|
|
131
134
|
this.name = "QstashRatelimitError";
|
|
132
135
|
this.limit = args.limit;
|
|
133
136
|
this.remaining = args.remaining;
|
|
@@ -142,7 +145,8 @@ var QstashChatRatelimitError = class extends QstashError {
|
|
|
142
145
|
resetRequests;
|
|
143
146
|
resetTokens;
|
|
144
147
|
constructor(args) {
|
|
145
|
-
super(`Exceeded chat rate limit. ${JSON.stringify(args)}
|
|
148
|
+
super(`Exceeded chat rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
|
|
149
|
+
this.name = "QstashChatRatelimitError";
|
|
146
150
|
this.limitRequests = args["limit-requests"];
|
|
147
151
|
this.limitTokens = args["limit-tokens"];
|
|
148
152
|
this.remainingRequests = args["remaining-requests"];
|
|
@@ -156,11 +160,11 @@ var QstashDailyRatelimitError = class extends QstashError {
|
|
|
156
160
|
remaining;
|
|
157
161
|
reset;
|
|
158
162
|
constructor(args) {
|
|
159
|
-
super(`Exceeded daily rate limit. ${JSON.stringify(args)}
|
|
163
|
+
super(`Exceeded daily rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
|
|
164
|
+
this.name = "QstashDailyRatelimitError";
|
|
160
165
|
this.limit = args.limit;
|
|
161
166
|
this.remaining = args.remaining;
|
|
162
167
|
this.reset = args.reset;
|
|
163
|
-
this.name = "QstashChatRatelimitError";
|
|
164
168
|
}
|
|
165
169
|
};
|
|
166
170
|
var QStashWorkflowError = class extends QstashError {
|
|
@@ -317,7 +321,10 @@ var HttpClient = class {
|
|
|
317
321
|
}
|
|
318
322
|
if (response.status < 200 || response.status >= 300) {
|
|
319
323
|
const body = await response.text();
|
|
320
|
-
throw new QstashError(
|
|
324
|
+
throw new QstashError(
|
|
325
|
+
body.length > 0 ? body : `Error: status=${response.status}`,
|
|
326
|
+
response.status
|
|
327
|
+
);
|
|
321
328
|
}
|
|
322
329
|
}
|
|
323
330
|
};
|
|
@@ -566,11 +573,14 @@ var LLMProvider = class extends BaseProvider {
|
|
|
566
573
|
}
|
|
567
574
|
getHeaders(options) {
|
|
568
575
|
if (this.owner === "upstash" && !options.analytics) {
|
|
569
|
-
return {};
|
|
576
|
+
return { "content-type": "application/json" };
|
|
570
577
|
}
|
|
571
578
|
const header = this.owner === "anthropic" ? "x-api-key" : "authorization";
|
|
572
579
|
const headerValue = this.owner === "anthropic" ? this.token : `Bearer ${this.token}`;
|
|
573
|
-
const headers = {
|
|
580
|
+
const headers = {
|
|
581
|
+
[header]: headerValue,
|
|
582
|
+
"content-type": "application/json"
|
|
583
|
+
};
|
|
574
584
|
if (this.owner === "openai" && this.organization) {
|
|
575
585
|
headers["OpenAI-Organization"] = this.organization;
|
|
576
586
|
}
|
|
@@ -1136,6 +1146,10 @@ var Client = class {
|
|
|
1136
1146
|
* Access the workflow API.
|
|
1137
1147
|
*
|
|
1138
1148
|
* cancel workflows.
|
|
1149
|
+
*
|
|
1150
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
1151
|
+
* Please use @upstash/workflow instead https://github.com/upstash/workflow-js
|
|
1152
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
1139
1153
|
*/
|
|
1140
1154
|
get workflow() {
|
|
1141
1155
|
return new Workflow(this.http);
|
|
@@ -1856,7 +1870,7 @@ var validateParallelSteps = (lazySteps, stepsFromRequest) => {
|
|
|
1856
1870
|
};
|
|
1857
1871
|
var sortSteps = (steps) => {
|
|
1858
1872
|
const getStepId = (step) => step.targetStep ?? step.stepId;
|
|
1859
|
-
return steps.
|
|
1873
|
+
return [...steps].sort((step, stepOther) => getStepId(step) - getStepId(stepOther));
|
|
1860
1874
|
};
|
|
1861
1875
|
|
|
1862
1876
|
// src/client/workflow/steps.ts
|
|
@@ -182,6 +182,14 @@ declare class LLMProvider<TOwner extends LLMOwner> extends BaseProvider<"llm", L
|
|
|
182
182
|
*/
|
|
183
183
|
onFinish(providerInfo: ProviderInfo, options: LLMOptions): ProviderInfo;
|
|
184
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
187
|
+
*
|
|
188
|
+
* Please use an alternative LLM provider.
|
|
189
|
+
*
|
|
190
|
+
* openai: https://upstash.com/docs/qstash/integrations/llm
|
|
191
|
+
* anthropic: https://upstash.com/docs/qstash/integrations/anthropic
|
|
192
|
+
*/
|
|
185
193
|
declare const upstash: () => LLMProvider<"upstash">;
|
|
186
194
|
declare const openai: ({ token, organization, }: {
|
|
187
195
|
token: string;
|
|
@@ -1517,9 +1525,18 @@ declare const processOptions: <TResponse extends Response = Response, TInitialPa
|
|
|
1517
1525
|
* @param routeFunction - A function that uses WorkflowContext as a parameter and runs a workflow.
|
|
1518
1526
|
* @param options - Options including the client, onFinish callback, and initialPayloadParser.
|
|
1519
1527
|
* @returns An async method that consumes incoming requests and runs the workflow.
|
|
1528
|
+
*
|
|
1529
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
1530
|
+
* Please use https://github.com/upstash/workflow-js
|
|
1531
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
1520
1532
|
*/
|
|
1521
1533
|
declare const serve: <TInitialPayload = unknown, TRequest extends Request = Request, TResponse extends Response = Response>(routeFunction: RouteFunction<TInitialPayload>, options?: WorkflowServeOptions<TResponse, TInitialPayload>) => ((request: TRequest) => Promise<TResponse>);
|
|
1522
1534
|
|
|
1535
|
+
/**
|
|
1536
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
1537
|
+
* Please use https://github.com/upstash/workflow-js
|
|
1538
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
1539
|
+
*/
|
|
1523
1540
|
declare class Workflow {
|
|
1524
1541
|
private readonly http;
|
|
1525
1542
|
constructor(http: Requester);
|
|
@@ -1800,6 +1817,10 @@ declare class Client {
|
|
|
1800
1817
|
* Access the workflow API.
|
|
1801
1818
|
*
|
|
1802
1819
|
* cancel workflows.
|
|
1820
|
+
*
|
|
1821
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
1822
|
+
* Please use @upstash/workflow instead https://github.com/upstash/workflow-js
|
|
1823
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
1803
1824
|
*/
|
|
1804
1825
|
get workflow(): Workflow;
|
|
1805
1826
|
/**
|
|
@@ -182,6 +182,14 @@ declare class LLMProvider<TOwner extends LLMOwner> extends BaseProvider<"llm", L
|
|
|
182
182
|
*/
|
|
183
183
|
onFinish(providerInfo: ProviderInfo, options: LLMOptions): ProviderInfo;
|
|
184
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
187
|
+
*
|
|
188
|
+
* Please use an alternative LLM provider.
|
|
189
|
+
*
|
|
190
|
+
* openai: https://upstash.com/docs/qstash/integrations/llm
|
|
191
|
+
* anthropic: https://upstash.com/docs/qstash/integrations/anthropic
|
|
192
|
+
*/
|
|
185
193
|
declare const upstash: () => LLMProvider<"upstash">;
|
|
186
194
|
declare const openai: ({ token, organization, }: {
|
|
187
195
|
token: string;
|
|
@@ -1517,9 +1525,18 @@ declare const processOptions: <TResponse extends Response = Response, TInitialPa
|
|
|
1517
1525
|
* @param routeFunction - A function that uses WorkflowContext as a parameter and runs a workflow.
|
|
1518
1526
|
* @param options - Options including the client, onFinish callback, and initialPayloadParser.
|
|
1519
1527
|
* @returns An async method that consumes incoming requests and runs the workflow.
|
|
1528
|
+
*
|
|
1529
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
1530
|
+
* Please use https://github.com/upstash/workflow-js
|
|
1531
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
1520
1532
|
*/
|
|
1521
1533
|
declare const serve: <TInitialPayload = unknown, TRequest extends Request = Request, TResponse extends Response = Response>(routeFunction: RouteFunction<TInitialPayload>, options?: WorkflowServeOptions<TResponse, TInitialPayload>) => ((request: TRequest) => Promise<TResponse>);
|
|
1522
1534
|
|
|
1535
|
+
/**
|
|
1536
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
1537
|
+
* Please use https://github.com/upstash/workflow-js
|
|
1538
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
1539
|
+
*/
|
|
1523
1540
|
declare class Workflow {
|
|
1524
1541
|
private readonly http;
|
|
1525
1542
|
constructor(http: Requester);
|
|
@@ -1800,6 +1817,10 @@ declare class Client {
|
|
|
1800
1817
|
* Access the workflow API.
|
|
1801
1818
|
*
|
|
1802
1819
|
* cancel workflows.
|
|
1820
|
+
*
|
|
1821
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
1822
|
+
* Please use @upstash/workflow instead https://github.com/upstash/workflow-js
|
|
1823
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
1803
1824
|
*/
|
|
1804
1825
|
get workflow(): Workflow;
|
|
1805
1826
|
/**
|
package/cloudflare.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-
|
|
1
|
+
import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-BY4y-4To.mjs';
|
|
2
2
|
import 'neverthrow';
|
|
3
3
|
|
|
4
4
|
type WorkflowBindings = {
|
|
@@ -27,6 +27,10 @@ type WorkersHandlerArgs = [Request, Record<string, string | undefined>];
|
|
|
27
27
|
* @param routeFunction workflow function
|
|
28
28
|
* @param options workflow options
|
|
29
29
|
* @returns
|
|
30
|
+
*
|
|
31
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
32
|
+
* Please use https://github.com/upstash/workflow-js
|
|
33
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
30
34
|
*/
|
|
31
35
|
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => ((...args: PagesHandlerArgs | WorkersHandlerArgs) => Promise<Response>);
|
|
32
36
|
|
package/cloudflare.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-
|
|
1
|
+
import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-BY4y-4To.js';
|
|
2
2
|
import 'neverthrow';
|
|
3
3
|
|
|
4
4
|
type WorkflowBindings = {
|
|
@@ -27,6 +27,10 @@ type WorkersHandlerArgs = [Request, Record<string, string | undefined>];
|
|
|
27
27
|
* @param routeFunction workflow function
|
|
28
28
|
* @param options workflow options
|
|
29
29
|
* @returns
|
|
30
|
+
*
|
|
31
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
32
|
+
* Please use https://github.com/upstash/workflow-js
|
|
33
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
30
34
|
*/
|
|
31
35
|
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => ((...args: PagesHandlerArgs | WorkersHandlerArgs) => Promise<Response>);
|
|
32
36
|
|
package/cloudflare.js
CHANGED
|
@@ -152,10 +152,13 @@ var DLQ = class {
|
|
|
152
152
|
};
|
|
153
153
|
|
|
154
154
|
// src/client/error.ts
|
|
155
|
+
var RATELIMIT_STATUS = 429;
|
|
155
156
|
var QstashError = class extends Error {
|
|
156
|
-
|
|
157
|
+
status;
|
|
158
|
+
constructor(message, status) {
|
|
157
159
|
super(message);
|
|
158
160
|
this.name = "QstashError";
|
|
161
|
+
this.status = status;
|
|
159
162
|
}
|
|
160
163
|
};
|
|
161
164
|
var QstashRatelimitError = class extends QstashError {
|
|
@@ -163,7 +166,7 @@ var QstashRatelimitError = class extends QstashError {
|
|
|
163
166
|
remaining;
|
|
164
167
|
reset;
|
|
165
168
|
constructor(args) {
|
|
166
|
-
super(`Exceeded burst rate limit. ${JSON.stringify(args)}
|
|
169
|
+
super(`Exceeded burst rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
|
|
167
170
|
this.name = "QstashRatelimitError";
|
|
168
171
|
this.limit = args.limit;
|
|
169
172
|
this.remaining = args.remaining;
|
|
@@ -178,7 +181,8 @@ var QstashChatRatelimitError = class extends QstashError {
|
|
|
178
181
|
resetRequests;
|
|
179
182
|
resetTokens;
|
|
180
183
|
constructor(args) {
|
|
181
|
-
super(`Exceeded chat rate limit. ${JSON.stringify(args)}
|
|
184
|
+
super(`Exceeded chat rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
|
|
185
|
+
this.name = "QstashChatRatelimitError";
|
|
182
186
|
this.limitRequests = args["limit-requests"];
|
|
183
187
|
this.limitTokens = args["limit-tokens"];
|
|
184
188
|
this.remainingRequests = args["remaining-requests"];
|
|
@@ -192,11 +196,11 @@ var QstashDailyRatelimitError = class extends QstashError {
|
|
|
192
196
|
remaining;
|
|
193
197
|
reset;
|
|
194
198
|
constructor(args) {
|
|
195
|
-
super(`Exceeded daily rate limit. ${JSON.stringify(args)}
|
|
199
|
+
super(`Exceeded daily rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
|
|
200
|
+
this.name = "QstashDailyRatelimitError";
|
|
196
201
|
this.limit = args.limit;
|
|
197
202
|
this.remaining = args.remaining;
|
|
198
203
|
this.reset = args.reset;
|
|
199
|
-
this.name = "QstashChatRatelimitError";
|
|
200
204
|
}
|
|
201
205
|
};
|
|
202
206
|
var QStashWorkflowError = class extends QstashError {
|
|
@@ -353,7 +357,10 @@ var HttpClient = class {
|
|
|
353
357
|
}
|
|
354
358
|
if (response.status < 200 || response.status >= 300) {
|
|
355
359
|
const body = await response.text();
|
|
356
|
-
throw new QstashError(
|
|
360
|
+
throw new QstashError(
|
|
361
|
+
body.length > 0 ? body : `Error: status=${response.status}`,
|
|
362
|
+
response.status
|
|
363
|
+
);
|
|
357
364
|
}
|
|
358
365
|
}
|
|
359
366
|
};
|
|
@@ -602,11 +609,14 @@ var LLMProvider = class extends BaseProvider {
|
|
|
602
609
|
}
|
|
603
610
|
getHeaders(options) {
|
|
604
611
|
if (this.owner === "upstash" && !options.analytics) {
|
|
605
|
-
return {};
|
|
612
|
+
return { "content-type": "application/json" };
|
|
606
613
|
}
|
|
607
614
|
const header = this.owner === "anthropic" ? "x-api-key" : "authorization";
|
|
608
615
|
const headerValue = this.owner === "anthropic" ? this.token : `Bearer ${this.token}`;
|
|
609
|
-
const headers = {
|
|
616
|
+
const headers = {
|
|
617
|
+
[header]: headerValue,
|
|
618
|
+
"content-type": "application/json"
|
|
619
|
+
};
|
|
610
620
|
if (this.owner === "openai" && this.organization) {
|
|
611
621
|
headers["OpenAI-Organization"] = this.organization;
|
|
612
622
|
}
|
|
@@ -1156,6 +1166,10 @@ var Client = class {
|
|
|
1156
1166
|
* Access the workflow API.
|
|
1157
1167
|
*
|
|
1158
1168
|
* cancel workflows.
|
|
1169
|
+
*
|
|
1170
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
1171
|
+
* Please use @upstash/workflow instead https://github.com/upstash/workflow-js
|
|
1172
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
1159
1173
|
*/
|
|
1160
1174
|
get workflow() {
|
|
1161
1175
|
return new Workflow(this.http);
|
|
@@ -1876,7 +1890,7 @@ var validateParallelSteps = (lazySteps, stepsFromRequest) => {
|
|
|
1876
1890
|
};
|
|
1877
1891
|
var sortSteps = (steps) => {
|
|
1878
1892
|
const getStepId = (step) => step.targetStep ?? step.stepId;
|
|
1879
|
-
return steps.
|
|
1893
|
+
return [...steps].sort((step, stepOther) => getStepId(step) - getStepId(stepOther));
|
|
1880
1894
|
};
|
|
1881
1895
|
|
|
1882
1896
|
// src/client/workflow/steps.ts
|
package/cloudflare.mjs
CHANGED
package/h3.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as h3 from 'h3';
|
|
2
2
|
import { H3Event } from 'h3';
|
|
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 = {
|
|
@@ -9,6 +9,11 @@ type VerifySignatureConfig = {
|
|
|
9
9
|
clockTolerance?: number;
|
|
10
10
|
};
|
|
11
11
|
declare const verifySignatureH3: (handler: (event: H3Event) => Promise<unknown>, config?: VerifySignatureConfig) => h3.EventHandler<h3.EventHandlerRequest, Promise<unknown>>;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
14
|
+
* Please use https://github.com/upstash/workflow-js
|
|
15
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
16
|
+
*/
|
|
12
17
|
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => h3.EventHandler<h3.EventHandlerRequest, Promise<Response | {
|
|
13
18
|
status: number;
|
|
14
19
|
body: string;
|
package/h3.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as h3 from 'h3';
|
|
2
2
|
import { H3Event } from 'h3';
|
|
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 = {
|
|
@@ -9,6 +9,11 @@ type VerifySignatureConfig = {
|
|
|
9
9
|
clockTolerance?: number;
|
|
10
10
|
};
|
|
11
11
|
declare const verifySignatureH3: (handler: (event: H3Event) => Promise<unknown>, config?: VerifySignatureConfig) => h3.EventHandler<h3.EventHandlerRequest, Promise<unknown>>;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
14
|
+
* Please use https://github.com/upstash/workflow-js
|
|
15
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
16
|
+
*/
|
|
12
17
|
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => h3.EventHandler<h3.EventHandlerRequest, Promise<Response | {
|
|
13
18
|
status: number;
|
|
14
19
|
body: string;
|
package/h3.js
CHANGED
|
@@ -476,10 +476,13 @@ var DLQ = class {
|
|
|
476
476
|
};
|
|
477
477
|
|
|
478
478
|
// src/client/error.ts
|
|
479
|
+
var RATELIMIT_STATUS = 429;
|
|
479
480
|
var QstashError = class extends Error {
|
|
480
|
-
|
|
481
|
+
status;
|
|
482
|
+
constructor(message, status) {
|
|
481
483
|
super(message);
|
|
482
484
|
this.name = "QstashError";
|
|
485
|
+
this.status = status;
|
|
483
486
|
}
|
|
484
487
|
};
|
|
485
488
|
var QstashRatelimitError = class extends QstashError {
|
|
@@ -487,7 +490,7 @@ var QstashRatelimitError = class extends QstashError {
|
|
|
487
490
|
remaining;
|
|
488
491
|
reset;
|
|
489
492
|
constructor(args) {
|
|
490
|
-
super(`Exceeded burst rate limit. ${JSON.stringify(args)}
|
|
493
|
+
super(`Exceeded burst rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
|
|
491
494
|
this.name = "QstashRatelimitError";
|
|
492
495
|
this.limit = args.limit;
|
|
493
496
|
this.remaining = args.remaining;
|
|
@@ -502,7 +505,8 @@ var QstashChatRatelimitError = class extends QstashError {
|
|
|
502
505
|
resetRequests;
|
|
503
506
|
resetTokens;
|
|
504
507
|
constructor(args) {
|
|
505
|
-
super(`Exceeded chat rate limit. ${JSON.stringify(args)}
|
|
508
|
+
super(`Exceeded chat rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
|
|
509
|
+
this.name = "QstashChatRatelimitError";
|
|
506
510
|
this.limitRequests = args["limit-requests"];
|
|
507
511
|
this.limitTokens = args["limit-tokens"];
|
|
508
512
|
this.remainingRequests = args["remaining-requests"];
|
|
@@ -516,11 +520,11 @@ var QstashDailyRatelimitError = class extends QstashError {
|
|
|
516
520
|
remaining;
|
|
517
521
|
reset;
|
|
518
522
|
constructor(args) {
|
|
519
|
-
super(`Exceeded daily rate limit. ${JSON.stringify(args)}
|
|
523
|
+
super(`Exceeded daily rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
|
|
524
|
+
this.name = "QstashDailyRatelimitError";
|
|
520
525
|
this.limit = args.limit;
|
|
521
526
|
this.remaining = args.remaining;
|
|
522
527
|
this.reset = args.reset;
|
|
523
|
-
this.name = "QstashChatRatelimitError";
|
|
524
528
|
}
|
|
525
529
|
};
|
|
526
530
|
var QStashWorkflowError = class extends QstashError {
|
|
@@ -677,7 +681,10 @@ var HttpClient = class {
|
|
|
677
681
|
}
|
|
678
682
|
if (response.status < 200 || response.status >= 300) {
|
|
679
683
|
const body = await response.text();
|
|
680
|
-
throw new QstashError(
|
|
684
|
+
throw new QstashError(
|
|
685
|
+
body.length > 0 ? body : `Error: status=${response.status}`,
|
|
686
|
+
response.status
|
|
687
|
+
);
|
|
681
688
|
}
|
|
682
689
|
}
|
|
683
690
|
};
|
|
@@ -926,11 +933,14 @@ var LLMProvider = class extends BaseProvider {
|
|
|
926
933
|
}
|
|
927
934
|
getHeaders(options) {
|
|
928
935
|
if (this.owner === "upstash" && !options.analytics) {
|
|
929
|
-
return {};
|
|
936
|
+
return { "content-type": "application/json" };
|
|
930
937
|
}
|
|
931
938
|
const header = this.owner === "anthropic" ? "x-api-key" : "authorization";
|
|
932
939
|
const headerValue = this.owner === "anthropic" ? this.token : `Bearer ${this.token}`;
|
|
933
|
-
const headers = {
|
|
940
|
+
const headers = {
|
|
941
|
+
[header]: headerValue,
|
|
942
|
+
"content-type": "application/json"
|
|
943
|
+
};
|
|
934
944
|
if (this.owner === "openai" && this.organization) {
|
|
935
945
|
headers["OpenAI-Organization"] = this.organization;
|
|
936
946
|
}
|
|
@@ -2000,7 +2010,7 @@ var validateParallelSteps = (lazySteps, stepsFromRequest) => {
|
|
|
2000
2010
|
};
|
|
2001
2011
|
var sortSteps = (steps) => {
|
|
2002
2012
|
const getStepId = (step) => step.targetStep ?? step.stepId;
|
|
2003
|
-
return steps.
|
|
2013
|
+
return [...steps].sort((step, stepOther) => getStepId(step) - getStepId(stepOther));
|
|
2004
2014
|
};
|
|
2005
2015
|
|
|
2006
2016
|
// src/client/workflow/steps.ts
|
|
@@ -2866,6 +2876,10 @@ var Client = class {
|
|
|
2866
2876
|
* Access the workflow API.
|
|
2867
2877
|
*
|
|
2868
2878
|
* cancel workflows.
|
|
2879
|
+
*
|
|
2880
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
2881
|
+
* Please use @upstash/workflow instead https://github.com/upstash/workflow-js
|
|
2882
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
2869
2883
|
*/
|
|
2870
2884
|
get workflow() {
|
|
2871
2885
|
return new Workflow(this.http);
|
package/h3.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
serve,
|
|
3
3
|
verifySignatureH3
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-IJTMXF3U.mjs";
|
|
5
|
+
import "./chunk-JR675EKS.mjs";
|
|
6
|
+
import "./chunk-2V6WQVIN.mjs";
|
|
7
7
|
export {
|
|
8
8
|
serve,
|
|
9
9
|
verifySignatureH3
|
package/hono.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Context } from 'hono';
|
|
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 WorkflowBindings = {
|
|
@@ -17,6 +17,10 @@ type WorkflowBindings = {
|
|
|
17
17
|
* @param routeFunction workflow function
|
|
18
18
|
* @param options workflow options
|
|
19
19
|
* @returns
|
|
20
|
+
*
|
|
21
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
22
|
+
* Please use https://github.com/upstash/workflow-js
|
|
23
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
20
24
|
*/
|
|
21
25
|
declare const serve: <TInitialPayload = unknown, TBindings extends WorkflowBindings = WorkflowBindings>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => ((context: Context<{
|
|
22
26
|
Bindings: TBindings;
|
package/hono.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Context } from 'hono';
|
|
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 WorkflowBindings = {
|
|
@@ -17,6 +17,10 @@ type WorkflowBindings = {
|
|
|
17
17
|
* @param routeFunction workflow function
|
|
18
18
|
* @param options workflow options
|
|
19
19
|
* @returns
|
|
20
|
+
*
|
|
21
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
22
|
+
* Please use https://github.com/upstash/workflow-js
|
|
23
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
20
24
|
*/
|
|
21
25
|
declare const serve: <TInitialPayload = unknown, TBindings extends WorkflowBindings = WorkflowBindings>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => ((context: Context<{
|
|
22
26
|
Bindings: TBindings;
|
package/hono.js
CHANGED
|
@@ -152,10 +152,13 @@ var DLQ = class {
|
|
|
152
152
|
};
|
|
153
153
|
|
|
154
154
|
// src/client/error.ts
|
|
155
|
+
var RATELIMIT_STATUS = 429;
|
|
155
156
|
var QstashError = class extends Error {
|
|
156
|
-
|
|
157
|
+
status;
|
|
158
|
+
constructor(message, status) {
|
|
157
159
|
super(message);
|
|
158
160
|
this.name = "QstashError";
|
|
161
|
+
this.status = status;
|
|
159
162
|
}
|
|
160
163
|
};
|
|
161
164
|
var QstashRatelimitError = class extends QstashError {
|
|
@@ -163,7 +166,7 @@ var QstashRatelimitError = class extends QstashError {
|
|
|
163
166
|
remaining;
|
|
164
167
|
reset;
|
|
165
168
|
constructor(args) {
|
|
166
|
-
super(`Exceeded burst rate limit. ${JSON.stringify(args)}
|
|
169
|
+
super(`Exceeded burst rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
|
|
167
170
|
this.name = "QstashRatelimitError";
|
|
168
171
|
this.limit = args.limit;
|
|
169
172
|
this.remaining = args.remaining;
|
|
@@ -178,7 +181,8 @@ var QstashChatRatelimitError = class extends QstashError {
|
|
|
178
181
|
resetRequests;
|
|
179
182
|
resetTokens;
|
|
180
183
|
constructor(args) {
|
|
181
|
-
super(`Exceeded chat rate limit. ${JSON.stringify(args)}
|
|
184
|
+
super(`Exceeded chat rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
|
|
185
|
+
this.name = "QstashChatRatelimitError";
|
|
182
186
|
this.limitRequests = args["limit-requests"];
|
|
183
187
|
this.limitTokens = args["limit-tokens"];
|
|
184
188
|
this.remainingRequests = args["remaining-requests"];
|
|
@@ -192,11 +196,11 @@ var QstashDailyRatelimitError = class extends QstashError {
|
|
|
192
196
|
remaining;
|
|
193
197
|
reset;
|
|
194
198
|
constructor(args) {
|
|
195
|
-
super(`Exceeded daily rate limit. ${JSON.stringify(args)}
|
|
199
|
+
super(`Exceeded daily rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
|
|
200
|
+
this.name = "QstashDailyRatelimitError";
|
|
196
201
|
this.limit = args.limit;
|
|
197
202
|
this.remaining = args.remaining;
|
|
198
203
|
this.reset = args.reset;
|
|
199
|
-
this.name = "QstashChatRatelimitError";
|
|
200
204
|
}
|
|
201
205
|
};
|
|
202
206
|
var QStashWorkflowError = class extends QstashError {
|
|
@@ -353,7 +357,10 @@ var HttpClient = class {
|
|
|
353
357
|
}
|
|
354
358
|
if (response.status < 200 || response.status >= 300) {
|
|
355
359
|
const body = await response.text();
|
|
356
|
-
throw new QstashError(
|
|
360
|
+
throw new QstashError(
|
|
361
|
+
body.length > 0 ? body : `Error: status=${response.status}`,
|
|
362
|
+
response.status
|
|
363
|
+
);
|
|
357
364
|
}
|
|
358
365
|
}
|
|
359
366
|
};
|
|
@@ -602,11 +609,14 @@ var LLMProvider = class extends BaseProvider {
|
|
|
602
609
|
}
|
|
603
610
|
getHeaders(options) {
|
|
604
611
|
if (this.owner === "upstash" && !options.analytics) {
|
|
605
|
-
return {};
|
|
612
|
+
return { "content-type": "application/json" };
|
|
606
613
|
}
|
|
607
614
|
const header = this.owner === "anthropic" ? "x-api-key" : "authorization";
|
|
608
615
|
const headerValue = this.owner === "anthropic" ? this.token : `Bearer ${this.token}`;
|
|
609
|
-
const headers = {
|
|
616
|
+
const headers = {
|
|
617
|
+
[header]: headerValue,
|
|
618
|
+
"content-type": "application/json"
|
|
619
|
+
};
|
|
610
620
|
if (this.owner === "openai" && this.organization) {
|
|
611
621
|
headers["OpenAI-Organization"] = this.organization;
|
|
612
622
|
}
|
|
@@ -1156,6 +1166,10 @@ var Client = class {
|
|
|
1156
1166
|
* Access the workflow API.
|
|
1157
1167
|
*
|
|
1158
1168
|
* cancel workflows.
|
|
1169
|
+
*
|
|
1170
|
+
* @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
|
|
1171
|
+
* Please use @upstash/workflow instead https://github.com/upstash/workflow-js
|
|
1172
|
+
* Migration Guide: https://upstash.com/docs/workflow/migration
|
|
1159
1173
|
*/
|
|
1160
1174
|
get workflow() {
|
|
1161
1175
|
return new Workflow(this.http);
|
|
@@ -1876,7 +1890,7 @@ var validateParallelSteps = (lazySteps, stepsFromRequest) => {
|
|
|
1876
1890
|
};
|
|
1877
1891
|
var sortSteps = (steps) => {
|
|
1878
1892
|
const getStepId = (step) => step.targetStep ?? step.stepId;
|
|
1879
|
-
return steps.
|
|
1893
|
+
return [...steps].sort((step, stepOther) => getStepId(step) - getStepId(stepOther));
|
|
1880
1894
|
};
|
|
1881
1895
|
|
|
1882
1896
|
// src/client/workflow/steps.ts
|
package/hono.mjs
CHANGED
package/index.d.mts
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.mjs';
|
|
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.mjs';
|
|
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;
|