@upstash/qstash 2.7.16 → 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.
@@ -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
- constructor(message) {
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(body.length > 0 ? body : `Error: status=${response.status}`);
324
+ throw new QstashError(
325
+ body.length > 0 ? body : `Error: status=${response.status}`,
326
+ response.status
327
+ );
321
328
  }
322
329
  }
323
330
  };
@@ -1139,6 +1146,10 @@ var Client = class {
1139
1146
  * Access the workflow API.
1140
1147
  *
1141
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
1142
1153
  */
1143
1154
  get workflow() {
1144
1155
  return new Workflow(this.http);
@@ -1859,7 +1870,7 @@ var validateParallelSteps = (lazySteps, stepsFromRequest) => {
1859
1870
  };
1860
1871
  var sortSteps = (steps) => {
1861
1872
  const getStepId = (step) => step.targetStep ?? step.stepId;
1862
- return steps.toSorted((step, stepOther) => getStepId(step) - getStepId(stepOther));
1873
+ return [...steps].sort((step, stepOther) => getStepId(step) - getStepId(stepOther));
1863
1874
  };
1864
1875
 
1865
1876
  // src/client/workflow/steps.ts
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Receiver,
3
3
  serve
4
- } from "./chunk-GWAFAA2M.mjs";
4
+ } from "./chunk-2V6WQVIN.mjs";
5
5
 
6
6
  // node_modules/defu/dist/defu.mjs
7
7
  function isPlainObject(value) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BaseProvider
3
- } from "./chunk-GWAFAA2M.mjs";
3
+ } from "./chunk-2V6WQVIN.mjs";
4
4
 
5
5
  // src/client/api/email.ts
6
6
  var EmailProvider = class extends BaseProvider {
@@ -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-RORrka04.mjs';
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-RORrka04.js';
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
- constructor(message) {
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(body.length > 0 ? body : `Error: status=${response.status}`);
360
+ throw new QstashError(
361
+ body.length > 0 ? body : `Error: status=${response.status}`,
362
+ response.status
363
+ );
357
364
  }
358
365
  }
359
366
  };
@@ -1159,6 +1166,10 @@ var Client = class {
1159
1166
  * Access the workflow API.
1160
1167
  *
1161
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
1162
1173
  */
1163
1174
  get workflow() {
1164
1175
  return new Workflow(this.http);
@@ -1879,7 +1890,7 @@ var validateParallelSteps = (lazySteps, stepsFromRequest) => {
1879
1890
  };
1880
1891
  var sortSteps = (steps) => {
1881
1892
  const getStepId = (step) => step.targetStep ?? step.stepId;
1882
- return steps.toSorted((step, stepOther) => getStepId(step) - getStepId(stepOther));
1893
+ return [...steps].sort((step, stepOther) => getStepId(step) - getStepId(stepOther));
1883
1894
  };
1884
1895
 
1885
1896
  // src/client/workflow/steps.ts
package/cloudflare.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  serve
3
- } from "./chunk-GWAFAA2M.mjs";
3
+ } from "./chunk-2V6WQVIN.mjs";
4
4
 
5
5
  // platforms/cloudflare.ts
6
6
  var getArgs = (args) => {
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-RORrka04.mjs';
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-RORrka04.js';
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
- constructor(message) {
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(body.length > 0 ? body : `Error: status=${response.status}`);
684
+ throw new QstashError(
685
+ body.length > 0 ? body : `Error: status=${response.status}`,
686
+ response.status
687
+ );
681
688
  }
682
689
  }
683
690
  };
@@ -2003,7 +2010,7 @@ var validateParallelSteps = (lazySteps, stepsFromRequest) => {
2003
2010
  };
2004
2011
  var sortSteps = (steps) => {
2005
2012
  const getStepId = (step) => step.targetStep ?? step.stepId;
2006
- return steps.toSorted((step, stepOther) => getStepId(step) - getStepId(stepOther));
2013
+ return [...steps].sort((step, stepOther) => getStepId(step) - getStepId(stepOther));
2007
2014
  };
2008
2015
 
2009
2016
  // src/client/workflow/steps.ts
@@ -2869,6 +2876,10 @@ var Client = class {
2869
2876
  * Access the workflow API.
2870
2877
  *
2871
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
2872
2883
  */
2873
2884
  get workflow() {
2874
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-7UVG6FOM.mjs";
5
- import "./chunk-OX4OZYVD.mjs";
6
- import "./chunk-GWAFAA2M.mjs";
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-RORrka04.mjs';
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-RORrka04.js';
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
- constructor(message) {
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(body.length > 0 ? body : `Error: status=${response.status}`);
360
+ throw new QstashError(
361
+ body.length > 0 ? body : `Error: status=${response.status}`,
362
+ response.status
363
+ );
357
364
  }
358
365
  }
359
366
  };
@@ -1159,6 +1166,10 @@ var Client = class {
1159
1166
  * Access the workflow API.
1160
1167
  *
1161
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
1162
1173
  */
1163
1174
  get workflow() {
1164
1175
  return new Workflow(this.http);
@@ -1879,7 +1890,7 @@ var validateParallelSteps = (lazySteps, stepsFromRequest) => {
1879
1890
  };
1880
1891
  var sortSteps = (steps) => {
1881
1892
  const getStepId = (step) => step.targetStep ?? step.stepId;
1882
- return steps.toSorted((step, stepOther) => getStepId(step) - getStepId(stepOther));
1893
+ return [...steps].sort((step, stepOther) => getStepId(step) - getStepId(stepOther));
1883
1894
  };
1884
1895
 
1885
1896
  // src/client/workflow/steps.ts
package/hono.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  serve
3
- } from "./chunk-GWAFAA2M.mjs";
3
+ } from "./chunk-2V6WQVIN.mjs";
4
4
 
5
5
  // platforms/hono.ts
6
6
  var serve2 = (routeFunction, options) => {
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-RORrka04.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-RORrka04.mjs';
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
- constructor(message: string);
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.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-RORrka04.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-RORrka04.js';
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
- constructor(message: string);
9
+ readonly status?: number;
10
+ constructor(message: string, status?: number);
10
11
  }
11
12
  declare class QstashRatelimitError extends QstashError {
12
13
  limit: string | null;