@upstash/qstash 2.7.19 → 2.7.21

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BaseProvider
3
- } from "./chunk-S5ODGXCI.mjs";
3
+ } from "./chunk-QHCEWG63.mjs";
4
4
 
5
5
  // src/client/api/email.ts
6
6
  var EmailProvider = class extends BaseProvider {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Receiver,
3
3
  serve
4
- } from "./chunk-S5ODGXCI.mjs";
4
+ } from "./chunk-QHCEWG63.mjs";
5
5
 
6
6
  // node_modules/defu/dist/defu.mjs
7
7
  function isPlainObject(value) {
@@ -587,6 +587,9 @@ var LLMProvider = class extends BaseProvider {
587
587
  if (this.owner === "openai" && this.organization) {
588
588
  headers["OpenAI-Organization"] = this.organization;
589
589
  }
590
+ if (this.owner === "anthropic") {
591
+ headers["anthropic-version"] = "2023-06-01";
592
+ }
590
593
  return headers;
591
594
  }
592
595
  /**
@@ -1110,14 +1113,22 @@ var Client = class {
1110
1113
  http;
1111
1114
  token;
1112
1115
  constructor(config) {
1116
+ const environment = typeof process === "undefined" ? {} : process.env;
1117
+ const baseUrl = config?.baseUrl ? config.baseUrl.replace(/\/$/, "") : environment.QSTASH_URL ?? "https://qstash.upstash.io";
1118
+ const token = config?.token ?? environment.QSTASH_TOKEN;
1113
1119
  this.http = new HttpClient({
1114
- retry: config.retry,
1115
- baseUrl: config.baseUrl ? config.baseUrl.replace(/\/$/, "") : "https://qstash.upstash.io",
1116
- authorization: `Bearer ${config.token}`,
1120
+ retry: config?.retry,
1121
+ baseUrl,
1122
+ authorization: `Bearer ${token}`,
1117
1123
  //@ts-expect-error caused by undici and bunjs type overlap
1118
- headers: prefixHeaders(new Headers(config.headers))
1124
+ headers: prefixHeaders(new Headers(config?.headers ?? {}))
1119
1125
  });
1120
- this.token = config.token;
1126
+ if (!token) {
1127
+ console.warn(
1128
+ "[Upstash QStash] client token is not set. Either pass a token or set QSTASH_TOKEN env variable."
1129
+ );
1130
+ }
1131
+ this.token = token;
1121
1132
  }
1122
1133
  /**
1123
1134
  * Access the urlGroup API.
@@ -1564,13 +1564,20 @@ type ClientConfig = {
1564
1564
  *
1565
1565
  * This is only used for testing.
1566
1566
  *
1567
+ * If not provided, value of the QSTASH_URL environment
1568
+ * variable will be used if it exists. If the QSTASH_URL
1569
+ * environment variable isn't set either, default is used.
1570
+ *
1567
1571
  * @default "https://qstash.upstash.io"
1568
1572
  */
1569
1573
  baseUrl?: string;
1570
1574
  /**
1571
1575
  * The authorization token from the upstash console.
1576
+ *
1577
+ * If not provided, value of the QSTASH_TOKEN environment
1578
+ * variable will be used if it exists.
1572
1579
  */
1573
- token: string;
1580
+ token?: string;
1574
1581
  /**
1575
1582
  * Configure how the client should retry requests.
1576
1583
  */
@@ -1792,7 +1799,7 @@ type QueueRequest = {
1792
1799
  declare class Client {
1793
1800
  http: Requester;
1794
1801
  private token;
1795
- constructor(config: ClientConfig);
1802
+ constructor(config?: ClientConfig);
1796
1803
  /**
1797
1804
  * Access the urlGroup API.
1798
1805
  *
@@ -1564,13 +1564,20 @@ type ClientConfig = {
1564
1564
  *
1565
1565
  * This is only used for testing.
1566
1566
  *
1567
+ * If not provided, value of the QSTASH_URL environment
1568
+ * variable will be used if it exists. If the QSTASH_URL
1569
+ * environment variable isn't set either, default is used.
1570
+ *
1567
1571
  * @default "https://qstash.upstash.io"
1568
1572
  */
1569
1573
  baseUrl?: string;
1570
1574
  /**
1571
1575
  * The authorization token from the upstash console.
1576
+ *
1577
+ * If not provided, value of the QSTASH_TOKEN environment
1578
+ * variable will be used if it exists.
1572
1579
  */
1573
- token: string;
1580
+ token?: string;
1574
1581
  /**
1575
1582
  * Configure how the client should retry requests.
1576
1583
  */
@@ -1792,7 +1799,7 @@ type QueueRequest = {
1792
1799
  declare class Client {
1793
1800
  http: Requester;
1794
1801
  private token;
1795
- constructor(config: ClientConfig);
1802
+ constructor(config?: ClientConfig);
1796
1803
  /**
1797
1804
  * Access the urlGroup API.
1798
1805
  *
package/cloudflare.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-CdYtp0E1.mjs';
1
+ import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-DuOcoFUv.mjs';
2
2
  import 'neverthrow';
3
3
 
4
4
  type WorkflowBindings = {
package/cloudflare.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-CdYtp0E1.js';
1
+ import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-DuOcoFUv.js';
2
2
  import 'neverthrow';
3
3
 
4
4
  type WorkflowBindings = {
package/cloudflare.js CHANGED
@@ -623,6 +623,9 @@ var LLMProvider = class extends BaseProvider {
623
623
  if (this.owner === "openai" && this.organization) {
624
624
  headers["OpenAI-Organization"] = this.organization;
625
625
  }
626
+ if (this.owner === "anthropic") {
627
+ headers["anthropic-version"] = "2023-06-01";
628
+ }
626
629
  return headers;
627
630
  }
628
631
  /**
@@ -1130,14 +1133,22 @@ var Client = class {
1130
1133
  http;
1131
1134
  token;
1132
1135
  constructor(config) {
1136
+ const environment = typeof process === "undefined" ? {} : process.env;
1137
+ const baseUrl = config?.baseUrl ? config.baseUrl.replace(/\/$/, "") : environment.QSTASH_URL ?? "https://qstash.upstash.io";
1138
+ const token = config?.token ?? environment.QSTASH_TOKEN;
1133
1139
  this.http = new HttpClient({
1134
- retry: config.retry,
1135
- baseUrl: config.baseUrl ? config.baseUrl.replace(/\/$/, "") : "https://qstash.upstash.io",
1136
- authorization: `Bearer ${config.token}`,
1140
+ retry: config?.retry,
1141
+ baseUrl,
1142
+ authorization: `Bearer ${token}`,
1137
1143
  //@ts-expect-error caused by undici and bunjs type overlap
1138
- headers: prefixHeaders(new Headers(config.headers))
1144
+ headers: prefixHeaders(new Headers(config?.headers ?? {}))
1139
1145
  });
1140
- this.token = config.token;
1146
+ if (!token) {
1147
+ console.warn(
1148
+ "[Upstash QStash] client token is not set. Either pass a token or set QSTASH_TOKEN env variable."
1149
+ );
1150
+ }
1151
+ this.token = token;
1141
1152
  }
1142
1153
  /**
1143
1154
  * Access the urlGroup API.
package/cloudflare.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  serve
3
- } from "./chunk-S5ODGXCI.mjs";
3
+ } from "./chunk-QHCEWG63.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-CdYtp0E1.mjs';
3
+ import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-DuOcoFUv.mjs';
4
4
  import 'neverthrow';
5
5
 
6
6
  type VerifySignatureConfig = {
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-CdYtp0E1.js';
3
+ import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-DuOcoFUv.js';
4
4
  import 'neverthrow';
5
5
 
6
6
  type VerifySignatureConfig = {
package/h3.js CHANGED
@@ -947,6 +947,9 @@ var LLMProvider = class extends BaseProvider {
947
947
  if (this.owner === "openai" && this.organization) {
948
948
  headers["OpenAI-Organization"] = this.organization;
949
949
  }
950
+ if (this.owner === "anthropic") {
951
+ headers["anthropic-version"] = "2023-06-01";
952
+ }
950
953
  return headers;
951
954
  }
952
955
  /**
@@ -2840,14 +2843,22 @@ var Client = class {
2840
2843
  http;
2841
2844
  token;
2842
2845
  constructor(config) {
2846
+ const environment = typeof process === "undefined" ? {} : process.env;
2847
+ const baseUrl = config?.baseUrl ? config.baseUrl.replace(/\/$/, "") : environment.QSTASH_URL ?? "https://qstash.upstash.io";
2848
+ const token = config?.token ?? environment.QSTASH_TOKEN;
2843
2849
  this.http = new HttpClient({
2844
- retry: config.retry,
2845
- baseUrl: config.baseUrl ? config.baseUrl.replace(/\/$/, "") : "https://qstash.upstash.io",
2846
- authorization: `Bearer ${config.token}`,
2850
+ retry: config?.retry,
2851
+ baseUrl,
2852
+ authorization: `Bearer ${token}`,
2847
2853
  //@ts-expect-error caused by undici and bunjs type overlap
2848
- headers: prefixHeaders(new Headers(config.headers))
2854
+ headers: prefixHeaders(new Headers(config?.headers ?? {}))
2849
2855
  });
2850
- this.token = config.token;
2856
+ if (!token) {
2857
+ console.warn(
2858
+ "[Upstash QStash] client token is not set. Either pass a token or set QSTASH_TOKEN env variable."
2859
+ );
2860
+ }
2861
+ this.token = token;
2851
2862
  }
2852
2863
  /**
2853
2864
  * Access the urlGroup API.
package/h3.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  serve,
3
3
  verifySignatureH3
4
- } from "./chunk-L2DZYBAR.mjs";
5
- import "./chunk-RNFKMAEP.mjs";
6
- import "./chunk-S5ODGXCI.mjs";
4
+ } from "./chunk-FGKPOZOO.mjs";
5
+ import "./chunk-3D34OUXY.mjs";
6
+ import "./chunk-QHCEWG63.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-CdYtp0E1.mjs';
2
+ import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-DuOcoFUv.mjs';
3
3
  import 'neverthrow';
4
4
 
5
5
  type WorkflowBindings = {
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-CdYtp0E1.js';
2
+ import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-DuOcoFUv.js';
3
3
  import 'neverthrow';
4
4
 
5
5
  type WorkflowBindings = {
package/hono.js CHANGED
@@ -623,6 +623,9 @@ var LLMProvider = class extends BaseProvider {
623
623
  if (this.owner === "openai" && this.organization) {
624
624
  headers["OpenAI-Organization"] = this.organization;
625
625
  }
626
+ if (this.owner === "anthropic") {
627
+ headers["anthropic-version"] = "2023-06-01";
628
+ }
626
629
  return headers;
627
630
  }
628
631
  /**
@@ -1130,14 +1133,22 @@ var Client = class {
1130
1133
  http;
1131
1134
  token;
1132
1135
  constructor(config) {
1136
+ const environment = typeof process === "undefined" ? {} : process.env;
1137
+ const baseUrl = config?.baseUrl ? config.baseUrl.replace(/\/$/, "") : environment.QSTASH_URL ?? "https://qstash.upstash.io";
1138
+ const token = config?.token ?? environment.QSTASH_TOKEN;
1133
1139
  this.http = new HttpClient({
1134
- retry: config.retry,
1135
- baseUrl: config.baseUrl ? config.baseUrl.replace(/\/$/, "") : "https://qstash.upstash.io",
1136
- authorization: `Bearer ${config.token}`,
1140
+ retry: config?.retry,
1141
+ baseUrl,
1142
+ authorization: `Bearer ${token}`,
1137
1143
  //@ts-expect-error caused by undici and bunjs type overlap
1138
- headers: prefixHeaders(new Headers(config.headers))
1144
+ headers: prefixHeaders(new Headers(config?.headers ?? {}))
1139
1145
  });
1140
- this.token = config.token;
1146
+ if (!token) {
1147
+ console.warn(
1148
+ "[Upstash QStash] client token is not set. Either pass a token or set QSTASH_TOKEN env variable."
1149
+ );
1150
+ }
1151
+ this.token = token;
1141
1152
  }
1142
1153
  /**
1143
1154
  * Access the urlGroup API.
package/hono.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  serve
3
- } from "./chunk-S5ODGXCI.mjs";
3
+ } from "./chunk-QHCEWG63.mjs";
4
4
 
5
5
  // platforms/hono.ts
6
6
  var serve2 = (routeFunction, options) => {
package/index.d.mts CHANGED
@@ -1,5 +1,5 @@
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-CdYtp0E1.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-CdYtp0E1.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-DuOcoFUv.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-DuOcoFUv.mjs';
3
3
  import 'neverthrow';
4
4
 
5
5
  /**
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
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-CdYtp0E1.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-CdYtp0E1.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-DuOcoFUv.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-DuOcoFUv.js';
3
3
  import 'neverthrow';
4
4
 
5
5
  /**
package/index.js CHANGED
@@ -643,6 +643,9 @@ var LLMProvider = class extends BaseProvider {
643
643
  if (this.owner === "openai" && this.organization) {
644
644
  headers["OpenAI-Organization"] = this.organization;
645
645
  }
646
+ if (this.owner === "anthropic") {
647
+ headers["anthropic-version"] = "2023-06-01";
648
+ }
646
649
  return headers;
647
650
  }
648
651
  /**
@@ -1192,14 +1195,22 @@ var Client = class {
1192
1195
  http;
1193
1196
  token;
1194
1197
  constructor(config) {
1198
+ const environment = typeof process === "undefined" ? {} : process.env;
1199
+ const baseUrl = config?.baseUrl ? config.baseUrl.replace(/\/$/, "") : environment.QSTASH_URL ?? "https://qstash.upstash.io";
1200
+ const token = config?.token ?? environment.QSTASH_TOKEN;
1195
1201
  this.http = new HttpClient({
1196
- retry: config.retry,
1197
- baseUrl: config.baseUrl ? config.baseUrl.replace(/\/$/, "") : "https://qstash.upstash.io",
1198
- authorization: `Bearer ${config.token}`,
1202
+ retry: config?.retry,
1203
+ baseUrl,
1204
+ authorization: `Bearer ${token}`,
1199
1205
  //@ts-expect-error caused by undici and bunjs type overlap
1200
- headers: prefixHeaders(new Headers(config.headers))
1206
+ headers: prefixHeaders(new Headers(config?.headers ?? {}))
1201
1207
  });
1202
- this.token = config.token;
1208
+ if (!token) {
1209
+ console.warn(
1210
+ "[Upstash QStash] client token is not set. Either pass a token or set QSTASH_TOKEN env variable."
1211
+ );
1212
+ }
1213
+ this.token = token;
1203
1214
  }
1204
1215
  /**
1205
1216
  * Access the urlGroup API.
package/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resend
3
- } from "./chunk-RNFKMAEP.mjs";
3
+ } from "./chunk-3D34OUXY.mjs";
4
4
  import {
5
5
  Chat,
6
6
  Client,
@@ -22,7 +22,7 @@ import {
22
22
  openai,
23
23
  setupAnalytics,
24
24
  upstash
25
- } from "./chunk-S5ODGXCI.mjs";
25
+ } from "./chunk-QHCEWG63.mjs";
26
26
  export {
27
27
  Chat,
28
28
  Client,
package/nextjs.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { NextApiHandler } from 'next';
2
2
  import { NextRequest, NextFetchEvent } from 'next/server';
3
- import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-CdYtp0E1.mjs';
3
+ import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-DuOcoFUv.mjs';
4
4
  import 'neverthrow';
5
5
 
6
6
  type VerifySignatureConfig = {
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-CdYtp0E1.js';
3
+ import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-DuOcoFUv.js';
4
4
  import 'neverthrow';
5
5
 
6
6
  type VerifySignatureConfig = {
package/nextjs.js CHANGED
@@ -627,6 +627,9 @@ var LLMProvider = class extends BaseProvider {
627
627
  if (this.owner === "openai" && this.organization) {
628
628
  headers["OpenAI-Organization"] = this.organization;
629
629
  }
630
+ if (this.owner === "anthropic") {
631
+ headers["anthropic-version"] = "2023-06-01";
632
+ }
630
633
  return headers;
631
634
  }
632
635
  /**
@@ -1134,14 +1137,22 @@ var Client = class {
1134
1137
  http;
1135
1138
  token;
1136
1139
  constructor(config) {
1140
+ const environment = typeof process === "undefined" ? {} : process.env;
1141
+ const baseUrl = config?.baseUrl ? config.baseUrl.replace(/\/$/, "") : environment.QSTASH_URL ?? "https://qstash.upstash.io";
1142
+ const token = config?.token ?? environment.QSTASH_TOKEN;
1137
1143
  this.http = new HttpClient({
1138
- retry: config.retry,
1139
- baseUrl: config.baseUrl ? config.baseUrl.replace(/\/$/, "") : "https://qstash.upstash.io",
1140
- authorization: `Bearer ${config.token}`,
1144
+ retry: config?.retry,
1145
+ baseUrl,
1146
+ authorization: `Bearer ${token}`,
1141
1147
  //@ts-expect-error caused by undici and bunjs type overlap
1142
- headers: prefixHeaders(new Headers(config.headers))
1148
+ headers: prefixHeaders(new Headers(config?.headers ?? {}))
1143
1149
  });
1144
- this.token = config.token;
1150
+ if (!token) {
1151
+ console.warn(
1152
+ "[Upstash QStash] client token is not set. Either pass a token or set QSTASH_TOKEN env variable."
1153
+ );
1154
+ }
1155
+ this.token = token;
1145
1156
  }
1146
1157
  /**
1147
1158
  * Access the urlGroup API.
package/nextjs.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Receiver,
3
3
  serve
4
- } from "./chunk-S5ODGXCI.mjs";
4
+ } from "./chunk-QHCEWG63.mjs";
5
5
 
6
6
  // platforms/nextjs.ts
7
7
  var BAD_REQUEST = 400;
package/nuxt.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  verifySignatureH3
3
- } from "./chunk-L2DZYBAR.mjs";
4
- import "./chunk-RNFKMAEP.mjs";
5
- import "./chunk-S5ODGXCI.mjs";
3
+ } from "./chunk-FGKPOZOO.mjs";
4
+ import "./chunk-3D34OUXY.mjs";
5
+ import "./chunk-QHCEWG63.mjs";
6
6
 
7
7
  // platforms/nuxt.ts
8
8
  var verifySignatureNuxt = verifySignatureH3;
package/package.json CHANGED
@@ -1 +1 @@
1
- {"version":"v2.7.19","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.21","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-CdYtp0E1.mjs';
2
+ import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-DuOcoFUv.mjs';
3
3
  import 'neverthrow';
4
4
 
5
5
  type VerifySignatureConfig = {
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-CdYtp0E1.js';
2
+ import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-DuOcoFUv.js';
3
3
  import 'neverthrow';
4
4
 
5
5
  type VerifySignatureConfig = {
package/solidjs.js CHANGED
@@ -624,6 +624,9 @@ var LLMProvider = class extends BaseProvider {
624
624
  if (this.owner === "openai" && this.organization) {
625
625
  headers["OpenAI-Organization"] = this.organization;
626
626
  }
627
+ if (this.owner === "anthropic") {
628
+ headers["anthropic-version"] = "2023-06-01";
629
+ }
627
630
  return headers;
628
631
  }
629
632
  /**
@@ -2517,14 +2520,22 @@ var Client = class {
2517
2520
  http;
2518
2521
  token;
2519
2522
  constructor(config) {
2523
+ const environment = typeof process === "undefined" ? {} : process.env;
2524
+ const baseUrl = config?.baseUrl ? config.baseUrl.replace(/\/$/, "") : environment.QSTASH_URL ?? "https://qstash.upstash.io";
2525
+ const token = config?.token ?? environment.QSTASH_TOKEN;
2520
2526
  this.http = new HttpClient({
2521
- retry: config.retry,
2522
- baseUrl: config.baseUrl ? config.baseUrl.replace(/\/$/, "") : "https://qstash.upstash.io",
2523
- authorization: `Bearer ${config.token}`,
2527
+ retry: config?.retry,
2528
+ baseUrl,
2529
+ authorization: `Bearer ${token}`,
2524
2530
  //@ts-expect-error caused by undici and bunjs type overlap
2525
- headers: prefixHeaders(new Headers(config.headers))
2531
+ headers: prefixHeaders(new Headers(config?.headers ?? {}))
2526
2532
  });
2527
- this.token = config.token;
2533
+ if (!token) {
2534
+ console.warn(
2535
+ "[Upstash QStash] client token is not set. Either pass a token or set QSTASH_TOKEN env variable."
2536
+ );
2537
+ }
2538
+ this.token = token;
2528
2539
  }
2529
2540
  /**
2530
2541
  * Access the urlGroup API.
package/solidjs.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import "./chunk-RNFKMAEP.mjs";
1
+ import "./chunk-3D34OUXY.mjs";
2
2
  import {
3
3
  Receiver,
4
4
  serve
5
- } from "./chunk-S5ODGXCI.mjs";
5
+ } from "./chunk-QHCEWG63.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-CdYtp0E1.mjs';
2
+ import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-DuOcoFUv.mjs';
3
3
  import 'neverthrow';
4
4
 
5
5
  type VerifySignatureConfig = {
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-CdYtp0E1.js';
2
+ import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-DuOcoFUv.js';
3
3
  import 'neverthrow';
4
4
 
5
5
  type VerifySignatureConfig = {
package/svelte.js CHANGED
@@ -624,6 +624,9 @@ var LLMProvider = class extends BaseProvider {
624
624
  if (this.owner === "openai" && this.organization) {
625
625
  headers["OpenAI-Organization"] = this.organization;
626
626
  }
627
+ if (this.owner === "anthropic") {
628
+ headers["anthropic-version"] = "2023-06-01";
629
+ }
627
630
  return headers;
628
631
  }
629
632
  /**
@@ -2517,14 +2520,22 @@ var Client = class {
2517
2520
  http;
2518
2521
  token;
2519
2522
  constructor(config) {
2523
+ const environment = typeof process === "undefined" ? {} : process.env;
2524
+ const baseUrl = config?.baseUrl ? config.baseUrl.replace(/\/$/, "") : environment.QSTASH_URL ?? "https://qstash.upstash.io";
2525
+ const token = config?.token ?? environment.QSTASH_TOKEN;
2520
2526
  this.http = new HttpClient({
2521
- retry: config.retry,
2522
- baseUrl: config.baseUrl ? config.baseUrl.replace(/\/$/, "") : "https://qstash.upstash.io",
2523
- authorization: `Bearer ${config.token}`,
2527
+ retry: config?.retry,
2528
+ baseUrl,
2529
+ authorization: `Bearer ${token}`,
2524
2530
  //@ts-expect-error caused by undici and bunjs type overlap
2525
- headers: prefixHeaders(new Headers(config.headers))
2531
+ headers: prefixHeaders(new Headers(config?.headers ?? {}))
2526
2532
  });
2527
- this.token = config.token;
2533
+ if (!token) {
2534
+ console.warn(
2535
+ "[Upstash QStash] client token is not set. Either pass a token or set QSTASH_TOKEN env variable."
2536
+ );
2537
+ }
2538
+ this.token = token;
2528
2539
  }
2529
2540
  /**
2530
2541
  * Access the urlGroup API.
package/svelte.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import "./chunk-RNFKMAEP.mjs";
1
+ import "./chunk-3D34OUXY.mjs";
2
2
  import {
3
3
  Receiver,
4
4
  serve
5
- } from "./chunk-S5ODGXCI.mjs";
5
+ } from "./chunk-QHCEWG63.mjs";
6
6
 
7
7
  // platforms/svelte.ts
8
8
  var verifySignatureSvelte = (handler, config) => {
package/workflow.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export { ag as AsyncStepFunction, a9 as DisabledWorkflowContext, F as FailureFunctionPayload, aj as FinishCondition, al as LogLevel, ai as ParallelCallState, ae as RawStep, ak as RequiredExceptFields, a3 as RouteFunction, S as Step, ah as StepFunction, ad as StepType, ac as StepTypes, af as SyncStepFunction, a5 as Workflow, aa as WorkflowClient, a8 as WorkflowContext, an as WorkflowLogger, am as WorkflowLoggerOptions, ab as WorkflowReceiver, a4 as WorkflowServeOptions, a6 as processOptions, a7 as serve } from './client-CdYtp0E1.mjs';
1
+ export { ag as AsyncStepFunction, a9 as DisabledWorkflowContext, F as FailureFunctionPayload, aj as FinishCondition, al as LogLevel, ai as ParallelCallState, ae as RawStep, ak as RequiredExceptFields, a3 as RouteFunction, S as Step, ah as StepFunction, ad as StepType, ac as StepTypes, af as SyncStepFunction, a5 as Workflow, aa as WorkflowClient, a8 as WorkflowContext, an as WorkflowLogger, am as WorkflowLoggerOptions, ab as WorkflowReceiver, a4 as WorkflowServeOptions, a6 as processOptions, a7 as serve } from './client-DuOcoFUv.mjs';
2
2
  import 'neverthrow';
package/workflow.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { ag as AsyncStepFunction, a9 as DisabledWorkflowContext, F as FailureFunctionPayload, aj as FinishCondition, al as LogLevel, ai as ParallelCallState, ae as RawStep, ak as RequiredExceptFields, a3 as RouteFunction, S as Step, ah as StepFunction, ad as StepType, ac as StepTypes, af as SyncStepFunction, a5 as Workflow, aa as WorkflowClient, a8 as WorkflowContext, an as WorkflowLogger, am as WorkflowLoggerOptions, ab as WorkflowReceiver, a4 as WorkflowServeOptions, a6 as processOptions, a7 as serve } from './client-CdYtp0E1.js';
1
+ export { ag as AsyncStepFunction, a9 as DisabledWorkflowContext, F as FailureFunctionPayload, aj as FinishCondition, al as LogLevel, ai as ParallelCallState, ae as RawStep, ak as RequiredExceptFields, a3 as RouteFunction, S as Step, ah as StepFunction, ad as StepType, ac as StepTypes, af as SyncStepFunction, a5 as Workflow, aa as WorkflowClient, a8 as WorkflowContext, an as WorkflowLogger, am as WorkflowLoggerOptions, ab as WorkflowReceiver, a4 as WorkflowServeOptions, a6 as processOptions, a7 as serve } from './client-DuOcoFUv.js';
2
2
  import 'neverthrow';
package/workflow.js CHANGED
@@ -629,6 +629,9 @@ var LLMProvider = class extends BaseProvider {
629
629
  if (this.owner === "openai" && this.organization) {
630
630
  headers["OpenAI-Organization"] = this.organization;
631
631
  }
632
+ if (this.owner === "anthropic") {
633
+ headers["anthropic-version"] = "2023-06-01";
634
+ }
632
635
  return headers;
633
636
  }
634
637
  /**
@@ -1136,14 +1139,22 @@ var Client = class {
1136
1139
  http;
1137
1140
  token;
1138
1141
  constructor(config) {
1142
+ const environment = typeof process === "undefined" ? {} : process.env;
1143
+ const baseUrl = config?.baseUrl ? config.baseUrl.replace(/\/$/, "") : environment.QSTASH_URL ?? "https://qstash.upstash.io";
1144
+ const token = config?.token ?? environment.QSTASH_TOKEN;
1139
1145
  this.http = new HttpClient({
1140
- retry: config.retry,
1141
- baseUrl: config.baseUrl ? config.baseUrl.replace(/\/$/, "") : "https://qstash.upstash.io",
1142
- authorization: `Bearer ${config.token}`,
1146
+ retry: config?.retry,
1147
+ baseUrl,
1148
+ authorization: `Bearer ${token}`,
1143
1149
  //@ts-expect-error caused by undici and bunjs type overlap
1144
- headers: prefixHeaders(new Headers(config.headers))
1150
+ headers: prefixHeaders(new Headers(config?.headers ?? {}))
1145
1151
  });
1146
- this.token = config.token;
1152
+ if (!token) {
1153
+ console.warn(
1154
+ "[Upstash QStash] client token is not set. Either pass a token or set QSTASH_TOKEN env variable."
1155
+ );
1156
+ }
1157
+ this.token = token;
1147
1158
  }
1148
1159
  /**
1149
1160
  * Access the urlGroup API.
package/workflow.mjs CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  WorkflowLogger,
7
7
  processOptions,
8
8
  serve
9
- } from "./chunk-S5ODGXCI.mjs";
9
+ } from "./chunk-QHCEWG63.mjs";
10
10
  export {
11
11
  DisabledWorkflowContext,
12
12
  StepTypes,