@upstash/qstash 2.7.14 → 2.7.15

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,7 +1,7 @@
1
1
  import {
2
2
  Receiver,
3
3
  serve
4
- } from "./chunk-Q2AGFQYM.mjs";
4
+ } from "./chunk-Y52A3KZT.mjs";
5
5
 
6
6
  // node_modules/defu/dist/defu.mjs
7
7
  function isPlainObject(value) {
@@ -0,0 +1,34 @@
1
+ import {
2
+ BaseProvider
3
+ } from "./chunk-Y52A3KZT.mjs";
4
+
5
+ // src/client/api/email.ts
6
+ var EmailProvider = class extends BaseProvider {
7
+ apiKind = "email";
8
+ batch;
9
+ constructor(baseUrl, token, owner, batch) {
10
+ super(baseUrl, token, owner);
11
+ this.batch = batch;
12
+ }
13
+ getRoute() {
14
+ return this.batch ? ["emails", "batch"] : ["emails"];
15
+ }
16
+ getHeaders(_options) {
17
+ return {
18
+ "upstash-forward-authorization": `Bearer ${this.token}`
19
+ };
20
+ }
21
+ onFinish(providerInfo, _options) {
22
+ return providerInfo;
23
+ }
24
+ };
25
+ var resend = ({
26
+ token,
27
+ batch = false
28
+ }) => {
29
+ return new EmailProvider("https://api.resend.com", token, "resend", batch);
30
+ };
31
+
32
+ export {
33
+ resend
34
+ };
@@ -58,14 +58,6 @@ var Receiver = class {
58
58
  }
59
59
  };
60
60
 
61
- // src/client/api/utils.ts
62
- var appendAPIOptions = (request, headers) => {
63
- if (request.api?.name === "email") {
64
- headers.set("Authorization", request.api.provider.token);
65
- request.method = request.method ?? "POST";
66
- }
67
- };
68
-
69
61
  // src/client/dlq.ts
70
62
  var DLQ = class {
71
63
  http;
@@ -213,7 +205,7 @@ var HttpClient = class {
213
205
  attempts: 1,
214
206
  backoff: () => 0
215
207
  } : {
216
- attempts: config.retry?.retries ? config.retry.retries + 1 : 5,
208
+ attempts: config.retry?.retries ?? 5,
217
209
  backoff: config.retry?.backoff ?? ((retryCount) => Math.exp(retryCount) * 50)
218
210
  };
219
211
  }
@@ -258,13 +250,15 @@ var HttpClient = class {
258
250
  const [url, requestOptions] = this.processRequest(request);
259
251
  let response = void 0;
260
252
  let error = void 0;
261
- for (let index = 0; index < this.retry.attempts; index++) {
253
+ for (let index = 0; index <= this.retry.attempts; index++) {
262
254
  try {
263
255
  response = await fetch(url.toString(), requestOptions);
264
256
  break;
265
257
  } catch (error_) {
266
258
  error = error_;
267
- await new Promise((r) => setTimeout(r, this.retry.backoff(index)));
259
+ if (index < this.retry.attempts) {
260
+ await new Promise((r) => setTimeout(r, this.retry.backoff(index)));
261
+ }
268
262
  }
269
263
  }
270
264
  if (!response) {
@@ -361,37 +355,6 @@ var setupAnalytics = (analytics, providerApiKey, providerBaseUrl, provider) => {
361
355
  }
362
356
  }
363
357
  };
364
- var upstash = () => {
365
- return {
366
- owner: "upstash",
367
- baseUrl: "https://qstash.upstash.io/llm",
368
- token: "",
369
- organization: void 0
370
- };
371
- };
372
- var openai = ({
373
- token,
374
- organization
375
- }) => {
376
- return {
377
- token,
378
- owner: "openai",
379
- baseUrl: "https://api.openai.com",
380
- organization
381
- };
382
- };
383
- var custom = ({
384
- baseUrl,
385
- token
386
- }) => {
387
- const trimmedBaseUrl = baseUrl.replace(/\/(v1\/)?chat\/completions$/, "");
388
- return {
389
- token,
390
- owner: "custom",
391
- baseUrl: trimmedBaseUrl,
392
- organization: void 0
393
- };
394
- };
395
358
 
396
359
  // src/client/llm/chat.ts
397
360
  var Chat = class _Chat {
@@ -467,7 +430,6 @@ var Chat = class _Chat {
467
430
  * @param request ChatRequest with messages
468
431
  * @returns Chat completion or stream
469
432
  */
470
- // eslint-disable-next-line @typescript-eslint/require-await
471
433
  createThirdParty = async (request) => {
472
434
  const { baseUrl, token, owner, organization } = request.provider;
473
435
  if (owner === "upstash")
@@ -528,63 +490,6 @@ var Chat = class _Chat {
528
490
  };
529
491
  };
530
492
 
531
- // src/client/llm/utils.ts
532
- function appendLLMOptionsIfNeeded(request, headers, http) {
533
- if (request.api?.name === "email" || !request.api)
534
- return;
535
- const provider = request.api.provider;
536
- const analytics = request.api.analytics;
537
- if (provider?.owner === "upstash") {
538
- handleUpstashProvider(request, headers, http, analytics);
539
- return;
540
- }
541
- if (!("provider" in request.api))
542
- return;
543
- const { baseUrl, token } = validateProviderConfig(provider);
544
- const analyticsConfig = analytics ? setupAnalytics({ name: analytics.name, token: analytics.token }, token, baseUrl, "custom") : void 0;
545
- if (analyticsConfig) {
546
- setAnalyticsHeaders(headers, analyticsConfig);
547
- request.url = analyticsConfig.baseURL;
548
- } else {
549
- request.url = `${baseUrl}/v1/chat/completions`;
550
- headers.set("Authorization", `Bearer ${token}`);
551
- }
552
- }
553
- function handleUpstashProvider(request, headers, http, analytics) {
554
- if (analytics) {
555
- const analyticsConfig = setupAnalytics(
556
- { name: analytics.name, token: analytics.token },
557
- //@ts-expect-error hacky way to get bearer token
558
- String(http.authorization).split("Bearer ")[1],
559
- request.api?.provider?.baseUrl,
560
- "upstash"
561
- );
562
- setAnalyticsHeaders(headers, analyticsConfig);
563
- request.url = analyticsConfig.baseURL;
564
- } else {
565
- request.api = { name: "llm" };
566
- }
567
- }
568
- function validateProviderConfig(provider) {
569
- if (!provider?.baseUrl)
570
- throw new Error("baseUrl cannot be empty or undefined!");
571
- if (!provider.token)
572
- throw new Error("token cannot be empty or undefined!");
573
- return { baseUrl: provider.baseUrl, token: provider.token };
574
- }
575
- function setAnalyticsHeaders(headers, analyticsConfig) {
576
- headers.set("Helicone-Auth", analyticsConfig.defaultHeaders?.["Helicone-Auth"] ?? "");
577
- headers.set("Authorization", analyticsConfig.defaultHeaders?.Authorization ?? "");
578
- if (analyticsConfig.defaultHeaders?.["Helicone-Target-Url"]) {
579
- headers.set("Helicone-Target-Url", analyticsConfig.defaultHeaders["Helicone-Target-Url"]);
580
- }
581
- }
582
- function ensureCallbackPresent(request) {
583
- if (request.api?.name === "llm" && !request.callback) {
584
- throw new TypeError("Callback cannot be undefined when using LLM");
585
- }
586
- }
587
-
588
493
  // src/client/messages.ts
589
494
  var Messages = class {
590
495
  http;
@@ -633,6 +538,160 @@ var Messages = class {
633
538
  }
634
539
  };
635
540
 
541
+ // src/client/api/base.ts
542
+ var BaseProvider = class {
543
+ baseUrl;
544
+ token;
545
+ owner;
546
+ constructor(baseUrl, token, owner) {
547
+ this.baseUrl = baseUrl;
548
+ this.token = token;
549
+ this.owner = owner;
550
+ }
551
+ getUrl() {
552
+ return `${this.baseUrl}/${this.getRoute().join("/")}`;
553
+ }
554
+ };
555
+
556
+ // src/client/api/llm.ts
557
+ var LLMProvider = class extends BaseProvider {
558
+ apiKind = "llm";
559
+ organization;
560
+ constructor(baseUrl, token, owner, organization) {
561
+ super(baseUrl, token, owner);
562
+ this.organization = organization;
563
+ }
564
+ getRoute() {
565
+ return this.owner === "anthropic" ? ["v1", "messages"] : ["v1", "chat", "completions"];
566
+ }
567
+ getHeaders(options) {
568
+ if (this.owner === "upstash" && !options.analytics) {
569
+ return {};
570
+ }
571
+ const header = this.owner === "anthropic" ? "x-api-key" : "authorization";
572
+ const headerValue = this.owner === "anthropic" ? this.token : `Bearer ${this.token}`;
573
+ const headers = { [header]: headerValue };
574
+ if (this.owner === "openai" && this.organization) {
575
+ headers["OpenAI-Organization"] = this.organization;
576
+ }
577
+ return headers;
578
+ }
579
+ /**
580
+ * Checks if callback exists and adds analytics in place if it's set.
581
+ *
582
+ * @param request
583
+ * @param options
584
+ */
585
+ onFinish(providerInfo, options) {
586
+ if (options.analytics) {
587
+ return updateWithAnalytics(providerInfo, options.analytics);
588
+ }
589
+ return providerInfo;
590
+ }
591
+ };
592
+ var upstash = () => {
593
+ return new LLMProvider("https://qstash.upstash.io/llm", "", "upstash");
594
+ };
595
+ var openai = ({
596
+ token,
597
+ organization
598
+ }) => {
599
+ return new LLMProvider("https://api.openai.com", token, "openai", organization);
600
+ };
601
+ var anthropic = ({ token }) => {
602
+ return new LLMProvider("https://api.anthropic.com", token, "anthropic");
603
+ };
604
+ var custom = ({
605
+ baseUrl,
606
+ token
607
+ }) => {
608
+ const trimmedBaseUrl = baseUrl.replace(/\/(v1\/)?chat\/completions$/, "");
609
+ return new LLMProvider(trimmedBaseUrl, token, "custom");
610
+ };
611
+
612
+ // src/client/api/utils.ts
613
+ var getProviderInfo = (api, upstashToken) => {
614
+ const { name, provider, ...parameters } = api;
615
+ const finalProvider = provider ?? upstash();
616
+ if (finalProvider.owner === "upstash" && !finalProvider.token) {
617
+ finalProvider.token = upstashToken;
618
+ }
619
+ if (!finalProvider.baseUrl)
620
+ throw new TypeError("baseUrl cannot be empty or undefined!");
621
+ if (!finalProvider.token)
622
+ throw new TypeError("token cannot be empty or undefined!");
623
+ if (finalProvider.apiKind !== name) {
624
+ throw new TypeError(
625
+ `Unexpected api name. Expected '${finalProvider.apiKind}', received ${name}`
626
+ );
627
+ }
628
+ const providerInfo = {
629
+ url: finalProvider.getUrl(),
630
+ baseUrl: finalProvider.baseUrl,
631
+ route: finalProvider.getRoute(),
632
+ appendHeaders: finalProvider.getHeaders(parameters),
633
+ owner: finalProvider.owner
634
+ };
635
+ return finalProvider.onFinish(providerInfo, parameters);
636
+ };
637
+ var processApi = (request, upstashToken) => {
638
+ if (!request.api) {
639
+ return request;
640
+ }
641
+ const { url, appendHeaders, owner } = getProviderInfo(request.api, upstashToken);
642
+ if (request.api.name === "llm") {
643
+ const callback = request.callback;
644
+ if (!callback) {
645
+ throw new TypeError("Callback cannot be undefined when using LLM api.");
646
+ }
647
+ return {
648
+ ...request,
649
+ // @ts-expect-error undici header conflict
650
+ headers: new Headers({
651
+ ...request.headers,
652
+ ...appendHeaders
653
+ }),
654
+ ...owner === "upstash" && !request.api.analytics ? { api: { name: "llm" }, url: void 0, callback } : { url, api: void 0 }
655
+ };
656
+ } else {
657
+ return {
658
+ ...request,
659
+ // @ts-expect-error undici header conflict
660
+ headers: new Headers({
661
+ ...request.headers,
662
+ ...appendHeaders
663
+ }),
664
+ url,
665
+ api: void 0
666
+ };
667
+ }
668
+ };
669
+ function updateWithAnalytics(providerInfo, analytics) {
670
+ switch (analytics.name) {
671
+ case "helicone": {
672
+ providerInfo.appendHeaders["Helicone-Auth"] = `Bearer ${analytics.token}`;
673
+ if (providerInfo.owner === "upstash") {
674
+ updateProviderInfo(providerInfo, "https://qstash.helicone.ai", [
675
+ "llm",
676
+ ...providerInfo.route
677
+ ]);
678
+ } else {
679
+ providerInfo.appendHeaders["Helicone-Target-Url"] = providerInfo.baseUrl;
680
+ updateProviderInfo(providerInfo, "https://gateway.helicone.ai", providerInfo.route);
681
+ }
682
+ return providerInfo;
683
+ }
684
+ default: {
685
+ throw new Error("Unknown analytics provider");
686
+ }
687
+ }
688
+ }
689
+ function updateProviderInfo(providerInfo, baseUrl, route) {
690
+ providerInfo.baseUrl = baseUrl;
691
+ providerInfo.route = route;
692
+ providerInfo.url = `${baseUrl}/${route.join("/")}`;
693
+ }
694
+
636
695
  // src/client/utils.ts
637
696
  var isIgnoredHeader = (header) => {
638
697
  const lowerCaseHeader = header.toLowerCase();
@@ -665,7 +724,7 @@ function processHeaders(request) {
665
724
  if (request.deduplicationId !== void 0) {
666
725
  headers.set("Upstash-Deduplication-Id", request.deduplicationId);
667
726
  }
668
- if (request.contentBasedDeduplication !== void 0) {
727
+ if (request.contentBasedDeduplication) {
669
728
  headers.set("Upstash-Content-Based-Deduplication", "true");
670
729
  }
671
730
  if (request.retries !== void 0) {
@@ -691,9 +750,10 @@ function getRequestPath(request) {
691
750
  if (nonApiPath)
692
751
  return nonApiPath;
693
752
  if (request.api?.name === "llm")
694
- return `api/${request.api.name}`;
753
+ return `api/llm`;
695
754
  if (request.api?.name === "email") {
696
- return request.api.provider.baseUrl;
755
+ const providerInfo = getProviderInfo(request.api, "not-needed");
756
+ return providerInfo.baseUrl;
697
757
  }
698
758
  throw new QstashError(`Failed to infer request path for ${JSON.stringify(request)}`);
699
759
  }
@@ -810,12 +870,12 @@ var Queue = class {
810
870
  async enqueueJSON(request) {
811
871
  const headers = prefixHeaders(new Headers(request.headers));
812
872
  headers.set("Content-Type", "application/json");
813
- ensureCallbackPresent(request);
814
- appendLLMOptionsIfNeeded(request, headers, this.http);
815
- appendAPIOptions(request, headers);
873
+ request.headers = headers;
874
+ const upstashToken = String(this.http.authorization).split("Bearer ")[1];
875
+ const nonApiRequest = processApi(request, upstashToken);
816
876
  const response = await this.enqueue({
817
- ...request,
818
- body: JSON.stringify(request.body),
877
+ ...nonApiRequest,
878
+ body: JSON.stringify(nonApiRequest.body),
819
879
  headers
820
880
  });
821
881
  return response;
@@ -1113,13 +1173,12 @@ var Client = class {
1113
1173
  async publishJSON(request) {
1114
1174
  const headers = prefixHeaders(new Headers(request.headers));
1115
1175
  headers.set("Content-Type", "application/json");
1116
- ensureCallbackPresent(request);
1117
- appendLLMOptionsIfNeeded(request, headers, this.http);
1118
- appendAPIOptions(request, headers);
1176
+ request.headers = headers;
1177
+ const upstashToken = String(this.http.authorization).split("Bearer ")[1];
1178
+ const nonApiRequest = processApi(request, upstashToken);
1119
1179
  const response = await this.publish({
1120
- ...request,
1121
- headers,
1122
- body: JSON.stringify(request.body)
1180
+ ...nonApiRequest,
1181
+ body: JSON.stringify(nonApiRequest.body)
1123
1182
  });
1124
1183
  return response;
1125
1184
  }
@@ -1153,17 +1212,17 @@ var Client = class {
1153
1212
  * Batch publish messages to QStash, serializing each body to JSON.
1154
1213
  */
1155
1214
  async batchJSON(request) {
1156
- for (const message of request) {
1215
+ const batchPayload = request.map((message) => {
1157
1216
  if ("body" in message) {
1158
1217
  message.body = JSON.stringify(message.body);
1159
1218
  }
1160
1219
  message.headers = new Headers(message.headers);
1161
- ensureCallbackPresent(message);
1162
- appendLLMOptionsIfNeeded(message, message.headers, this.http);
1163
- appendAPIOptions(message, message.headers);
1164
- message.headers.set("Content-Type", "application/json");
1165
- }
1166
- const response = await this.batch(request);
1220
+ const upstashToken = String(this.http.authorization).split("Bearer ")[1];
1221
+ const nonApiMessage = processApi(message, upstashToken);
1222
+ nonApiMessage.headers.set("Content-Type", "application/json");
1223
+ return nonApiMessage;
1224
+ });
1225
+ const response = await this.batch(batchPayload);
1167
1226
  return response;
1168
1227
  }
1169
1228
  /**
@@ -2616,11 +2675,13 @@ export {
2616
2675
  QStashWorkflowAbort,
2617
2676
  formatWorkflowError,
2618
2677
  setupAnalytics,
2678
+ Chat,
2679
+ Messages,
2680
+ BaseProvider,
2619
2681
  upstash,
2620
2682
  openai,
2683
+ anthropic,
2621
2684
  custom,
2622
- Chat,
2623
- Messages,
2624
2685
  decodeBase64,
2625
2686
  Schedules,
2626
2687
  UrlGroups,
@@ -62,16 +62,6 @@ declare class Receiver {
62
62
  private verifyBodyAndUrl;
63
63
  }
64
64
 
65
- type EmailProviderReturnType = {
66
- owner: "resend";
67
- baseUrl: "https://api.resend.com/emails" | "https://api.resend.com/emails/batch";
68
- token: string;
69
- };
70
- declare const resend: ({ token, batch, }: {
71
- token: string;
72
- batch?: boolean;
73
- }) => EmailProviderReturnType;
74
-
75
65
  type State = "CREATED" | "ACTIVE" | "DELIVERED" | "ERROR" | "RETRY" | "FAILED";
76
66
  type HTTPMethods = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
77
67
  type Event = {
@@ -116,31 +106,94 @@ type RateLimit = {
116
106
  reset: string | null;
117
107
  };
118
108
 
119
- type Owner = "upstash" | "openai" | "custom";
120
- type ProviderReturnType<TOwner extends Owner = Owner, TBaseUrl extends string = string, TToken extends string = string, TOrganization extends string | undefined = string | undefined> = {
121
- owner: TOwner;
122
- baseUrl: TBaseUrl;
123
- token: TToken;
124
- organization: TOrganization;
109
+ type ProviderInfo = {
110
+ /**
111
+ * full url used for request
112
+ */
113
+ url: string;
114
+ /**
115
+ * base url of the request
116
+ */
117
+ baseUrl: string;
118
+ /**
119
+ * route elements which will follow the baseUrl
120
+ */
121
+ route: string[];
122
+ /**
123
+ * headers to include in the request
124
+ */
125
+ appendHeaders: Record<string, string>;
126
+ /**
127
+ * provider owner
128
+ */
129
+ owner: Owner;
125
130
  };
126
- type AnalyticsConfig = {
127
- name: "helicone";
128
- token: string;
131
+ type ApiKind = "llm" | "email";
132
+ type Owner = EmailOwner | LLMOwner;
133
+ type PublishApi<TName extends ApiKind, TProvider extends BaseProvider<TName>> = {
134
+ name: TName;
135
+ provider?: TProvider;
129
136
  };
130
- type AnalyticsSetup = {
131
- baseURL?: string;
132
- defaultHeaders?: Record<string, string | undefined>;
137
+ /**
138
+ * Email
139
+ */
140
+ type EmailOwner = "resend";
141
+ type PublishEmailApi = Required<PublishApi<"email", BaseProvider<"email", EmailOwner>>>;
142
+ /**
143
+ * LLM
144
+ */
145
+ type LLMOwner = "upstash" | "openai" | "anthropic" | "custom";
146
+ type LLMOptions = {
147
+ analytics?: {
148
+ name: "helicone";
149
+ token: string;
150
+ };
133
151
  };
134
- declare const setupAnalytics: (analytics: AnalyticsConfig | undefined, providerApiKey: string, providerBaseUrl?: string, provider?: "openai" | "upstash" | "custom") => AnalyticsSetup;
135
- declare const upstash: () => ProviderReturnType<"upstash", "https://qstash.upstash.io/llm", "">;
136
- declare const openai: <TToken extends string = string, TOrganization extends string | undefined = undefined>({ token, organization, }: {
137
- token: TToken;
138
- organization?: TOrganization;
139
- }) => ProviderReturnType<"openai", "https://api.openai.com", TToken, TOrganization extends string ? TOrganization : undefined>;
140
- declare const custom: <TToken extends string = string>({ baseUrl, token, }: {
152
+ type PublishLLMApi = PublishApi<"llm", BaseProvider<"llm", LLMOwner>> & LLMOptions;
153
+
154
+ declare abstract class BaseProvider<TName extends ApiKind, TOwner = Owner> {
155
+ abstract readonly apiKind: TName;
156
+ readonly baseUrl: string;
157
+ token: string;
158
+ readonly owner: TOwner;
159
+ constructor(baseUrl: string, token: string, owner: TOwner);
160
+ /**
161
+ * called before returning the final request
162
+ *
163
+ * @param request
164
+ */
165
+ abstract onFinish(request: ProviderInfo, options: unknown): ProviderInfo;
166
+ abstract getRoute(): string[];
167
+ abstract getHeaders(options: unknown): Record<string, string>;
168
+ getUrl(): string;
169
+ }
170
+
171
+ declare class LLMProvider<TOwner extends LLMOwner> extends BaseProvider<"llm", LLMOwner> {
172
+ readonly apiKind = "llm";
173
+ readonly organization?: string;
174
+ constructor(baseUrl: string, token: string, owner: TOwner, organization?: string);
175
+ getRoute(): string[];
176
+ getHeaders(options: LLMOptions): Record<string, string>;
177
+ /**
178
+ * Checks if callback exists and adds analytics in place if it's set.
179
+ *
180
+ * @param request
181
+ * @param options
182
+ */
183
+ onFinish(providerInfo: ProviderInfo, options: LLMOptions): ProviderInfo;
184
+ }
185
+ declare const upstash: () => LLMProvider<"upstash">;
186
+ declare const openai: ({ token, organization, }: {
187
+ token: string;
188
+ organization?: string;
189
+ }) => LLMProvider<"openai">;
190
+ declare const anthropic: ({ token }: {
191
+ token: string;
192
+ }) => LLMProvider<"anthropic">;
193
+ declare const custom: ({ baseUrl, token, }: {
141
194
  baseUrl: string;
142
- token: TToken;
143
- }) => ProviderReturnType<"custom", string, TToken>;
195
+ token: string;
196
+ }) => LLMProvider<"custom">;
144
197
 
145
198
  type ChatCompletionMessage = {
146
199
  role: "system" | "assistant" | "user";
@@ -229,21 +282,21 @@ type ChatRequestFields = ChatRequestCommonFields & {
229
282
  messages: ChatCompletionMessage[];
230
283
  };
231
284
  type ChatRequestProviders = {
232
- provider: ProviderReturnType<"openai">;
285
+ provider: LLMProvider<"openai">;
233
286
  model: OpenAIChatModel;
234
287
  analytics?: {
235
288
  name: "helicone";
236
289
  token: string;
237
290
  };
238
291
  } | {
239
- provider: ProviderReturnType<"custom">;
292
+ provider: LLMProvider<"custom">;
240
293
  model: string;
241
294
  analytics?: {
242
295
  name: "helicone";
243
296
  token: string;
244
297
  };
245
298
  } | {
246
- provider: ProviderReturnType<"upstash">;
299
+ provider: LLMProvider<"upstash">;
247
300
  model: ChatModel;
248
301
  analytics?: {
249
302
  name: "helicone";
@@ -282,6 +335,11 @@ type UpstashRequest = {
282
335
  * @default true
283
336
  */
284
337
  parseResponseAsJson?: boolean;
338
+ /**
339
+ * optionally overwrite the baseUrl of the http.
340
+ *
341
+ * default value of the http is base qstash url.
342
+ */
285
343
  baseUrl?: string;
286
344
  };
287
345
  type UpstashResponse<TResult> = TResult & {
@@ -1633,14 +1691,7 @@ type PublishRequest<TBody = BodyInit> = {
1633
1691
  /**
1634
1692
  * The api endpoint the request should be sent to.
1635
1693
  */
1636
- api: {
1637
- name: "llm";
1638
- provider?: ProviderReturnType;
1639
- analytics?: {
1640
- name: "helicone";
1641
- token: string;
1642
- };
1643
- };
1694
+ api: PublishLLMApi;
1644
1695
  topic?: never;
1645
1696
  /**
1646
1697
  * Use a callback url to forward the response of your destination server to your callback url.
@@ -1656,10 +1707,7 @@ type PublishRequest<TBody = BodyInit> = {
1656
1707
  /**
1657
1708
  * The api endpoint the request should be sent to.
1658
1709
  */
1659
- api: {
1660
- name: "email";
1661
- provider: EmailProviderReturnType;
1662
- };
1710
+ api: PublishEmailApi;
1663
1711
  topic?: never;
1664
1712
  callback?: string;
1665
1713
  } | {
@@ -1815,4 +1863,4 @@ type PublishResponse<TRequest> = TRequest extends {
1815
1863
  urlGroup: string;
1816
1864
  } ? PublishToUrlGroupsResponse : PublishToApiResponse;
1817
1865
 
1818
- export { type AnalyticsConfig as $, type AddEndpointsRequest as A, type BodyInit as B, type ChatRateLimit as C, type ChatCompletion as D, type EventsRequest as E, type FailureFunctionPayload as F, type GetEventsResponse as G, type HTTPMethods as H, type ChatCompletionChunk as I, type StreamEnabled as J, type StreamDisabled as K, type StreamParameter as L, type Message as M, type PromptChatRequest as N, type OpenAIChatModel as O, type PublishBatchRequest as P, type QueueRequest as Q, type RateLimit as R, type Step as S, type ChatRequest as T, type UrlGroup as U, type VerifyRequest as V, type WithCursor as W, custom as X, openai as Y, upstash as Z, type ProviderReturnType as _, type ReceiverConfig as a, type AnalyticsSetup as a0, setupAnalytics as a1, resend as a2, type RouteFunction as a3, type WorkflowServeOptions as a4, Workflow as a5, processOptions as a6, serve as a7, WorkflowContext as a8, DisabledWorkflowContext as a9, type WorkflowClient as aa, type WorkflowReceiver as ab, StepTypes as ac, type StepType as ad, type RawStep as ae, type SyncStepFunction as af, type AsyncStepFunction as ag, type StepFunction as ah, type ParallelCallState as ai, type FinishCondition as aj, type RequiredExceptFields as ak, type LogLevel as al, type WorkflowLoggerOptions as am, WorkflowLogger as an, SignatureError as b, Receiver as c, type PublishRequest as d, type PublishJsonRequest as e, Client as f, type PublishToApiResponse as g, type PublishToUrlResponse as h, type PublishToUrlGroupsResponse as i, type PublishResponse as j, type MessagePayload as k, Messages as l, type Schedule as m, type CreateScheduleRequest as n, Schedules as o, type Endpoint as p, type RemoveEndpointsRequest as q, UrlGroups as r, type State as s, type Event as t, type EventPayload as u, type GetEventsPayload as v, type HeadersInit as w, type RequestOptions as x, Chat as y, type ChatCompletionMessage as z };
1866
+ export { upstash as $, type AddEndpointsRequest as A, BaseProvider as B, type ChatRateLimit as C, type RequestOptions as D, type EmailOwner as E, type FailureFunctionPayload as F, type GetEventsResponse as G, type HTTPMethods as H, Chat as I, type ChatCompletionMessage as J, type ChatCompletion as K, type LLMOwner as L, type Message as M, type ChatCompletionChunk as N, type StreamEnabled as O, type ProviderInfo as P, type QueueRequest as Q, type RateLimit as R, type Step as S, type StreamDisabled as T, type UrlGroup as U, type VerifyRequest as V, type WithCursor as W, type StreamParameter as X, type OpenAIChatModel as Y, type PromptChatRequest as Z, type ChatRequest as _, type ReceiverConfig as a, openai as a0, anthropic as a1, custom as a2, type RouteFunction as a3, type WorkflowServeOptions as a4, Workflow as a5, processOptions as a6, serve as a7, WorkflowContext as a8, DisabledWorkflowContext as a9, type WorkflowClient as aa, type WorkflowReceiver as ab, StepTypes as ac, type StepType as ad, type RawStep as ae, type SyncStepFunction as af, type AsyncStepFunction as ag, type StepFunction as ah, type ParallelCallState as ai, type FinishCondition as aj, type RequiredExceptFields as ak, type LogLevel as al, type WorkflowLoggerOptions as am, WorkflowLogger as an, SignatureError as b, Receiver as c, type PublishBatchRequest as d, type PublishRequest as e, type PublishJsonRequest as f, type EventsRequest as g, Client as h, type PublishToApiResponse as i, type PublishToUrlResponse as j, type PublishToUrlGroupsResponse as k, type PublishResponse as l, type MessagePayload as m, Messages as n, type Schedule as o, type CreateScheduleRequest as p, Schedules as q, type Endpoint as r, type RemoveEndpointsRequest as s, UrlGroups as t, type State as u, type Event as v, type EventPayload as w, type GetEventsPayload as x, type BodyInit as y, type HeadersInit as z };