@upstash/qstash 2.7.16 → 2.7.18

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/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-RORrka04.js';
3
+ import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-B0bFJMw6.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
- constructor(message) {
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(body.length > 0 ? body : `Error: status=${response.status}`);
364
+ throw new QstashError(
365
+ body.length > 0 ? body : `Error: status=${response.status}`,
366
+ response.status
367
+ );
361
368
  }
362
369
  }
363
370
  };
@@ -597,6 +604,7 @@ var BaseProvider = class {
597
604
  var LLMProvider = class extends BaseProvider {
598
605
  apiKind = "llm";
599
606
  organization;
607
+ method = "POST";
600
608
  constructor(baseUrl, token, owner, organization) {
601
609
  super(baseUrl, token, owner);
602
610
  this.organization = organization;
@@ -657,15 +665,24 @@ var getProviderInfo = (api, upstashToken) => {
657
665
  baseUrl: finalProvider.baseUrl,
658
666
  route: finalProvider.getRoute(),
659
667
  appendHeaders: finalProvider.getHeaders(parameters),
660
- owner: finalProvider.owner
668
+ owner: finalProvider.owner,
669
+ method: finalProvider.method
661
670
  };
662
671
  return finalProvider.onFinish(providerInfo, parameters);
663
672
  };
664
- var processApi = (request, upstashToken) => {
673
+ var safeJoinHeaders = (headers, record) => {
674
+ const joinedHeaders = new Headers(record);
675
+ for (const [header, value] of headers.entries()) {
676
+ joinedHeaders.set(header, value);
677
+ }
678
+ return joinedHeaders;
679
+ };
680
+ var processApi = (request, headers, upstashToken) => {
665
681
  if (!request.api) {
682
+ request.headers = headers;
666
683
  return request;
667
684
  }
668
- const { url, appendHeaders, owner } = getProviderInfo(request.api, upstashToken);
685
+ const { url, appendHeaders, owner, method } = getProviderInfo(request.api, upstashToken);
669
686
  if (request.api.name === "llm") {
670
687
  const callback = request.callback;
671
688
  if (!callback) {
@@ -673,21 +690,15 @@ var processApi = (request, upstashToken) => {
673
690
  }
674
691
  return {
675
692
  ...request,
676
- // @ts-expect-error undici header conflict
677
- headers: new Headers({
678
- ...request.headers,
679
- ...appendHeaders
680
- }),
693
+ method: request.method ?? method,
694
+ headers: safeJoinHeaders(headers, appendHeaders),
681
695
  ...owner === "upstash" && !request.api.analytics ? { api: { name: "llm" }, url: void 0, callback } : { url, api: void 0 }
682
696
  };
683
697
  } else {
684
698
  return {
685
699
  ...request,
686
- // @ts-expect-error undici header conflict
687
- headers: new Headers({
688
- ...request.headers,
689
- ...appendHeaders
690
- }),
700
+ method: request.method ?? method,
701
+ headers: safeJoinHeaders(headers, appendHeaders),
691
702
  url,
692
703
  api: void 0
693
704
  };
@@ -897,9 +908,8 @@ var Queue = class {
897
908
  async enqueueJSON(request) {
898
909
  const headers = prefixHeaders(new Headers(request.headers));
899
910
  headers.set("Content-Type", "application/json");
900
- request.headers = headers;
901
911
  const upstashToken = String(this.http.authorization).split("Bearer ")[1];
902
- const nonApiRequest = processApi(request, upstashToken);
912
+ const nonApiRequest = processApi(request, headers, upstashToken);
903
913
  const response = await this.enqueue({
904
914
  ...nonApiRequest,
905
915
  body: JSON.stringify(nonApiRequest.body),
@@ -1163,6 +1173,10 @@ var Client = class {
1163
1173
  * Access the workflow API.
1164
1174
  *
1165
1175
  * cancel workflows.
1176
+ *
1177
+ * @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
1178
+ * Please use @upstash/workflow instead https://github.com/upstash/workflow-js
1179
+ * Migration Guide: https://upstash.com/docs/workflow/migration
1166
1180
  */
1167
1181
  get workflow() {
1168
1182
  return new Workflow(this.http);
@@ -1200,9 +1214,8 @@ var Client = class {
1200
1214
  async publishJSON(request) {
1201
1215
  const headers = prefixHeaders(new Headers(request.headers));
1202
1216
  headers.set("Content-Type", "application/json");
1203
- request.headers = headers;
1204
1217
  const upstashToken = String(this.http.authorization).split("Bearer ")[1];
1205
- const nonApiRequest = processApi(request, upstashToken);
1218
+ const nonApiRequest = processApi(request, headers, upstashToken);
1206
1219
  const response = await this.publish({
1207
1220
  ...nonApiRequest,
1208
1221
  body: JSON.stringify(nonApiRequest.body)
@@ -1243,9 +1256,8 @@ var Client = class {
1243
1256
  if ("body" in message) {
1244
1257
  message.body = JSON.stringify(message.body);
1245
1258
  }
1246
- message.headers = new Headers(message.headers);
1247
1259
  const upstashToken = String(this.http.authorization).split("Bearer ")[1];
1248
- const nonApiMessage = processApi(message, upstashToken);
1260
+ const nonApiMessage = processApi(message, new Headers(message.headers), upstashToken);
1249
1261
  nonApiMessage.headers.set("Content-Type", "application/json");
1250
1262
  return nonApiMessage;
1251
1263
  });
@@ -1883,7 +1895,7 @@ var validateParallelSteps = (lazySteps, stepsFromRequest) => {
1883
1895
  };
1884
1896
  var sortSteps = (steps) => {
1885
1897
  const getStepId = (step) => step.targetStep ?? step.stepId;
1886
- return steps.toSorted((step, stepOther) => getStepId(step) - getStepId(stepOther));
1898
+ return [...steps].sort((step, stepOther) => getStepId(step) - getStepId(stepOther));
1887
1899
  };
1888
1900
 
1889
1901
  // src/client/workflow/steps.ts
package/nextjs.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Receiver,
3
3
  serve
4
- } from "./chunk-GWAFAA2M.mjs";
4
+ } from "./chunk-A3H5A6JL.mjs";
5
5
 
6
6
  // platforms/nextjs.ts
7
7
  var BAD_REQUEST = 400;
package/nuxt.d.mts CHANGED
@@ -1,7 +1,9 @@
1
1
  import * as h3 from 'h3';
2
2
 
3
3
  /**
4
- * @deprecated Use import { verifySignatureH3 } from "@upstash/qstash/h3" instead
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 Use import { verifySignatureH3 } from "@upstash/qstash/h3" instead
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-7UVG6FOM.mjs";
4
- import "./chunk-OX4OZYVD.mjs";
5
- import "./chunk-GWAFAA2M.mjs";
3
+ } from "./chunk-A5VKSI7H.mjs";
4
+ import "./chunk-K2ZUMNWA.mjs";
5
+ import "./chunk-A3H5A6JL.mjs";
6
6
 
7
7
  // platforms/nuxt.ts
8
8
  var verifySignatureNuxt = verifySignatureH3;
package/package.json CHANGED
@@ -1 +1 @@
1
- {"version":"v2.7.16","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"}}
1
+ {"version":"v2.7.18","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-RORrka04.mjs';
2
+ import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-B0bFJMw6.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-RORrka04.js';
2
+ import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-B0bFJMw6.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
- constructor(message) {
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(body.length > 0 ? body : `Error: status=${response.status}`);
361
+ throw new QstashError(
362
+ body.length > 0 ? body : `Error: status=${response.status}`,
363
+ response.status
364
+ );
358
365
  }
359
366
  }
360
367
  };
@@ -594,6 +601,7 @@ var BaseProvider = class {
594
601
  var LLMProvider = class extends BaseProvider {
595
602
  apiKind = "llm";
596
603
  organization;
604
+ method = "POST";
597
605
  constructor(baseUrl, token, owner, organization) {
598
606
  super(baseUrl, token, owner);
599
607
  this.organization = organization;
@@ -654,15 +662,24 @@ var getProviderInfo = (api, upstashToken) => {
654
662
  baseUrl: finalProvider.baseUrl,
655
663
  route: finalProvider.getRoute(),
656
664
  appendHeaders: finalProvider.getHeaders(parameters),
657
- owner: finalProvider.owner
665
+ owner: finalProvider.owner,
666
+ method: finalProvider.method
658
667
  };
659
668
  return finalProvider.onFinish(providerInfo, parameters);
660
669
  };
661
- var processApi = (request, upstashToken) => {
670
+ var safeJoinHeaders = (headers, record) => {
671
+ const joinedHeaders = new Headers(record);
672
+ for (const [header, value] of headers.entries()) {
673
+ joinedHeaders.set(header, value);
674
+ }
675
+ return joinedHeaders;
676
+ };
677
+ var processApi = (request, headers, upstashToken) => {
662
678
  if (!request.api) {
679
+ request.headers = headers;
663
680
  return request;
664
681
  }
665
- const { url, appendHeaders, owner } = getProviderInfo(request.api, upstashToken);
682
+ const { url, appendHeaders, owner, method } = getProviderInfo(request.api, upstashToken);
666
683
  if (request.api.name === "llm") {
667
684
  const callback = request.callback;
668
685
  if (!callback) {
@@ -670,21 +687,15 @@ var processApi = (request, upstashToken) => {
670
687
  }
671
688
  return {
672
689
  ...request,
673
- // @ts-expect-error undici header conflict
674
- headers: new Headers({
675
- ...request.headers,
676
- ...appendHeaders
677
- }),
690
+ method: request.method ?? method,
691
+ headers: safeJoinHeaders(headers, appendHeaders),
678
692
  ...owner === "upstash" && !request.api.analytics ? { api: { name: "llm" }, url: void 0, callback } : { url, api: void 0 }
679
693
  };
680
694
  } else {
681
695
  return {
682
696
  ...request,
683
- // @ts-expect-error undici header conflict
684
- headers: new Headers({
685
- ...request.headers,
686
- ...appendHeaders
687
- }),
697
+ method: request.method ?? method,
698
+ headers: safeJoinHeaders(headers, appendHeaders),
688
699
  url,
689
700
  api: void 0
690
701
  };
@@ -894,9 +905,8 @@ var Queue = class {
894
905
  async enqueueJSON(request) {
895
906
  const headers = prefixHeaders(new Headers(request.headers));
896
907
  headers.set("Content-Type", "application/json");
897
- request.headers = headers;
898
908
  const upstashToken = String(this.http.authorization).split("Bearer ")[1];
899
- const nonApiRequest = processApi(request, upstashToken);
909
+ const nonApiRequest = processApi(request, headers, upstashToken);
900
910
  const response = await this.enqueue({
901
911
  ...nonApiRequest,
902
912
  body: JSON.stringify(nonApiRequest.body),
@@ -1680,7 +1690,7 @@ var validateParallelSteps = (lazySteps, stepsFromRequest) => {
1680
1690
  };
1681
1691
  var sortSteps = (steps) => {
1682
1692
  const getStepId = (step) => step.targetStep ?? step.stepId;
1683
- return steps.toSorted((step, stepOther) => getStepId(step) - getStepId(stepOther));
1693
+ return [...steps].sort((step, stepOther) => getStepId(step) - getStepId(stepOther));
1684
1694
  };
1685
1695
 
1686
1696
  // src/client/workflow/steps.ts
@@ -2546,6 +2556,10 @@ var Client = class {
2546
2556
  * Access the workflow API.
2547
2557
  *
2548
2558
  * cancel workflows.
2559
+ *
2560
+ * @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
2561
+ * Please use @upstash/workflow instead https://github.com/upstash/workflow-js
2562
+ * Migration Guide: https://upstash.com/docs/workflow/migration
2549
2563
  */
2550
2564
  get workflow() {
2551
2565
  return new Workflow(this.http);
@@ -2583,9 +2597,8 @@ var Client = class {
2583
2597
  async publishJSON(request) {
2584
2598
  const headers = prefixHeaders(new Headers(request.headers));
2585
2599
  headers.set("Content-Type", "application/json");
2586
- request.headers = headers;
2587
2600
  const upstashToken = String(this.http.authorization).split("Bearer ")[1];
2588
- const nonApiRequest = processApi(request, upstashToken);
2601
+ const nonApiRequest = processApi(request, headers, upstashToken);
2589
2602
  const response = await this.publish({
2590
2603
  ...nonApiRequest,
2591
2604
  body: JSON.stringify(nonApiRequest.body)
@@ -2626,9 +2639,8 @@ var Client = class {
2626
2639
  if ("body" in message) {
2627
2640
  message.body = JSON.stringify(message.body);
2628
2641
  }
2629
- message.headers = new Headers(message.headers);
2630
2642
  const upstashToken = String(this.http.authorization).split("Bearer ")[1];
2631
- const nonApiMessage = processApi(message, upstashToken);
2643
+ const nonApiMessage = processApi(message, new Headers(message.headers), upstashToken);
2632
2644
  nonApiMessage.headers.set("Content-Type", "application/json");
2633
2645
  return nonApiMessage;
2634
2646
  });
package/solidjs.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import "./chunk-OX4OZYVD.mjs";
1
+ import "./chunk-K2ZUMNWA.mjs";
2
2
  import {
3
3
  Receiver,
4
4
  serve
5
- } from "./chunk-GWAFAA2M.mjs";
5
+ } from "./chunk-A3H5A6JL.mjs";
6
6
 
7
7
  // platforms/solidjs.ts
8
8
  var verifySignatureSolidjs = (handler, config) => {
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-RORrka04.mjs';
2
+ import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-B0bFJMw6.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-RORrka04.js';
2
+ import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-B0bFJMw6.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"];