@upstash/qstash 2.7.13 → 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.
- package/{chunk-IYU467WN.mjs → chunk-LSYJT55T.mjs} +1 -1
- package/chunk-X4MWA7DF.mjs +34 -0
- package/{chunk-Q6E5NF42.mjs → chunk-Y52A3KZT.mjs} +217 -121
- package/{client-DEZq0-qk.d.ts → client-RORrka04.d.mts} +113 -35
- package/{client-DEZq0-qk.d.mts → client-RORrka04.d.ts} +113 -35
- package/cloudflare.d.mts +1 -1
- package/cloudflare.d.ts +1 -1
- package/cloudflare.js +197 -88
- package/cloudflare.mjs +1 -1
- package/h3.d.mts +1 -1
- package/h3.d.ts +1 -1
- package/h3.js +197 -88
- package/h3.mjs +3 -3
- package/hono.d.mts +1 -1
- package/hono.d.ts +1 -1
- package/hono.js +197 -88
- package/hono.mjs +1 -1
- package/index.d.mts +26 -3
- package/index.d.ts +26 -3
- package/index.js +244 -119
- package/index.mjs +7 -2
- package/nextjs.d.mts +1 -1
- package/nextjs.d.ts +1 -1
- package/nextjs.js +197 -88
- package/nextjs.mjs +1 -1
- package/nuxt.js +11 -6
- package/nuxt.mjs +3 -3
- package/package.json +1 -1
- package/solidjs.d.mts +1 -1
- package/solidjs.d.ts +1 -1
- package/solidjs.js +197 -88
- package/solidjs.mjs +2 -2
- package/svelte.d.mts +1 -1
- package/svelte.d.ts +1 -1
- package/svelte.js +197 -88
- package/svelte.mjs +2 -2
- package/workflow.d.mts +1 -1
- package/workflow.d.ts +1 -1
- package/workflow.js +197 -88
- package/workflow.mjs +1 -1
- package/chunk-CIVGPRQN.mjs +0 -0
package/hono.js
CHANGED
|
@@ -60,11 +60,14 @@ var Receiver = class {
|
|
|
60
60
|
* If that fails, the signature is invalid and a `SignatureError` is thrown.
|
|
61
61
|
*/
|
|
62
62
|
async verify(request) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
let payload;
|
|
64
|
+
try {
|
|
65
|
+
payload = await this.verifyWithKey(this.currentSigningKey, request);
|
|
66
|
+
} catch {
|
|
67
|
+
payload = await this.verifyWithKey(this.nextSigningKey, request);
|
|
66
68
|
}
|
|
67
|
-
|
|
69
|
+
this.verifyBodyAndUrl(payload, request);
|
|
70
|
+
return true;
|
|
68
71
|
}
|
|
69
72
|
/**
|
|
70
73
|
* Verify signature with a specific signing key
|
|
@@ -76,7 +79,10 @@ var Receiver = class {
|
|
|
76
79
|
}).catch((error) => {
|
|
77
80
|
throw new SignatureError(error.message);
|
|
78
81
|
});
|
|
79
|
-
|
|
82
|
+
return jwt.payload;
|
|
83
|
+
}
|
|
84
|
+
verifyBodyAndUrl(payload, request) {
|
|
85
|
+
const p = payload;
|
|
80
86
|
if (request.url !== void 0 && p.sub !== request.url) {
|
|
81
87
|
throw new SignatureError(`invalid subject: ${p.sub}, want: ${request.url}`);
|
|
82
88
|
}
|
|
@@ -85,7 +91,6 @@ var Receiver = class {
|
|
|
85
91
|
if (p.body.replace(padding, "") !== bodyHash.replace(padding, "")) {
|
|
86
92
|
throw new SignatureError(`body hash does not match, want: ${p.body}, got: ${bodyHash}`);
|
|
87
93
|
}
|
|
88
|
-
return true;
|
|
89
94
|
}
|
|
90
95
|
};
|
|
91
96
|
|
|
@@ -236,7 +241,7 @@ var HttpClient = class {
|
|
|
236
241
|
attempts: 1,
|
|
237
242
|
backoff: () => 0
|
|
238
243
|
} : {
|
|
239
|
-
attempts: config.retry?.retries
|
|
244
|
+
attempts: config.retry?.retries ?? 5,
|
|
240
245
|
backoff: config.retry?.backoff ?? ((retryCount) => Math.exp(retryCount) * 50)
|
|
241
246
|
};
|
|
242
247
|
}
|
|
@@ -281,13 +286,15 @@ var HttpClient = class {
|
|
|
281
286
|
const [url, requestOptions] = this.processRequest(request);
|
|
282
287
|
let response = void 0;
|
|
283
288
|
let error = void 0;
|
|
284
|
-
for (let index = 0; index
|
|
289
|
+
for (let index = 0; index <= this.retry.attempts; index++) {
|
|
285
290
|
try {
|
|
286
291
|
response = await fetch(url.toString(), requestOptions);
|
|
287
292
|
break;
|
|
288
293
|
} catch (error_) {
|
|
289
294
|
error = error_;
|
|
290
|
-
|
|
295
|
+
if (index < this.retry.attempts) {
|
|
296
|
+
await new Promise((r) => setTimeout(r, this.retry.backoff(index)));
|
|
297
|
+
}
|
|
291
298
|
}
|
|
292
299
|
}
|
|
293
300
|
if (!response) {
|
|
@@ -459,7 +466,6 @@ var Chat = class _Chat {
|
|
|
459
466
|
* @param request ChatRequest with messages
|
|
460
467
|
* @returns Chat completion or stream
|
|
461
468
|
*/
|
|
462
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
|
463
469
|
createThirdParty = async (request) => {
|
|
464
470
|
const { baseUrl, token, owner, organization } = request.provider;
|
|
465
471
|
if (owner === "upstash")
|
|
@@ -520,63 +526,6 @@ var Chat = class _Chat {
|
|
|
520
526
|
};
|
|
521
527
|
};
|
|
522
528
|
|
|
523
|
-
// src/client/llm/utils.ts
|
|
524
|
-
function appendLLMOptionsIfNeeded(request, headers, http) {
|
|
525
|
-
if (!request.api)
|
|
526
|
-
return;
|
|
527
|
-
const provider = request.api.provider;
|
|
528
|
-
const analytics = request.api.analytics;
|
|
529
|
-
if (provider?.owner === "upstash") {
|
|
530
|
-
handleUpstashProvider(request, headers, http, analytics);
|
|
531
|
-
return;
|
|
532
|
-
}
|
|
533
|
-
if (!("provider" in request.api))
|
|
534
|
-
return;
|
|
535
|
-
const { baseUrl, token } = validateProviderConfig(provider);
|
|
536
|
-
const analyticsConfig = analytics ? setupAnalytics({ name: analytics.name, token: analytics.token }, token, baseUrl, "custom") : void 0;
|
|
537
|
-
if (analyticsConfig) {
|
|
538
|
-
setAnalyticsHeaders(headers, analyticsConfig);
|
|
539
|
-
request.url = analyticsConfig.baseURL;
|
|
540
|
-
} else {
|
|
541
|
-
request.url = `${baseUrl}/v1/chat/completions`;
|
|
542
|
-
headers.set("Authorization", `Bearer ${token}`);
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
function handleUpstashProvider(request, headers, http, analytics) {
|
|
546
|
-
if (analytics) {
|
|
547
|
-
const analyticsConfig = setupAnalytics(
|
|
548
|
-
{ name: analytics.name, token: analytics.token },
|
|
549
|
-
//@ts-expect-error hacky way to get bearer token
|
|
550
|
-
String(http.authorization).split("Bearer ")[1],
|
|
551
|
-
request.api?.provider?.baseUrl,
|
|
552
|
-
"upstash"
|
|
553
|
-
);
|
|
554
|
-
setAnalyticsHeaders(headers, analyticsConfig);
|
|
555
|
-
request.url = analyticsConfig.baseURL;
|
|
556
|
-
} else {
|
|
557
|
-
request.api = { name: "llm" };
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
function validateProviderConfig(provider) {
|
|
561
|
-
if (!provider?.baseUrl)
|
|
562
|
-
throw new Error("baseUrl cannot be empty or undefined!");
|
|
563
|
-
if (!provider.token)
|
|
564
|
-
throw new Error("token cannot be empty or undefined!");
|
|
565
|
-
return { baseUrl: provider.baseUrl, token: provider.token };
|
|
566
|
-
}
|
|
567
|
-
function setAnalyticsHeaders(headers, analyticsConfig) {
|
|
568
|
-
headers.set("Helicone-Auth", analyticsConfig.defaultHeaders?.["Helicone-Auth"] ?? "");
|
|
569
|
-
headers.set("Authorization", analyticsConfig.defaultHeaders?.Authorization ?? "");
|
|
570
|
-
if (analyticsConfig.defaultHeaders?.["Helicone-Target-Url"]) {
|
|
571
|
-
headers.set("Helicone-Target-Url", analyticsConfig.defaultHeaders["Helicone-Target-Url"]);
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
function ensureCallbackPresent(request) {
|
|
575
|
-
if (request.api?.name === "llm" && !request.callback) {
|
|
576
|
-
throw new TypeError("Callback cannot be undefined when using LLM");
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
|
|
580
529
|
// src/client/messages.ts
|
|
581
530
|
var Messages = class {
|
|
582
531
|
http;
|
|
@@ -625,6 +574,144 @@ var Messages = class {
|
|
|
625
574
|
}
|
|
626
575
|
};
|
|
627
576
|
|
|
577
|
+
// src/client/api/base.ts
|
|
578
|
+
var BaseProvider = class {
|
|
579
|
+
baseUrl;
|
|
580
|
+
token;
|
|
581
|
+
owner;
|
|
582
|
+
constructor(baseUrl, token, owner) {
|
|
583
|
+
this.baseUrl = baseUrl;
|
|
584
|
+
this.token = token;
|
|
585
|
+
this.owner = owner;
|
|
586
|
+
}
|
|
587
|
+
getUrl() {
|
|
588
|
+
return `${this.baseUrl}/${this.getRoute().join("/")}`;
|
|
589
|
+
}
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
// src/client/api/llm.ts
|
|
593
|
+
var LLMProvider = class extends BaseProvider {
|
|
594
|
+
apiKind = "llm";
|
|
595
|
+
organization;
|
|
596
|
+
constructor(baseUrl, token, owner, organization) {
|
|
597
|
+
super(baseUrl, token, owner);
|
|
598
|
+
this.organization = organization;
|
|
599
|
+
}
|
|
600
|
+
getRoute() {
|
|
601
|
+
return this.owner === "anthropic" ? ["v1", "messages"] : ["v1", "chat", "completions"];
|
|
602
|
+
}
|
|
603
|
+
getHeaders(options) {
|
|
604
|
+
if (this.owner === "upstash" && !options.analytics) {
|
|
605
|
+
return {};
|
|
606
|
+
}
|
|
607
|
+
const header = this.owner === "anthropic" ? "x-api-key" : "authorization";
|
|
608
|
+
const headerValue = this.owner === "anthropic" ? this.token : `Bearer ${this.token}`;
|
|
609
|
+
const headers = { [header]: headerValue };
|
|
610
|
+
if (this.owner === "openai" && this.organization) {
|
|
611
|
+
headers["OpenAI-Organization"] = this.organization;
|
|
612
|
+
}
|
|
613
|
+
return headers;
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Checks if callback exists and adds analytics in place if it's set.
|
|
617
|
+
*
|
|
618
|
+
* @param request
|
|
619
|
+
* @param options
|
|
620
|
+
*/
|
|
621
|
+
onFinish(providerInfo, options) {
|
|
622
|
+
if (options.analytics) {
|
|
623
|
+
return updateWithAnalytics(providerInfo, options.analytics);
|
|
624
|
+
}
|
|
625
|
+
return providerInfo;
|
|
626
|
+
}
|
|
627
|
+
};
|
|
628
|
+
var upstash = () => {
|
|
629
|
+
return new LLMProvider("https://qstash.upstash.io/llm", "", "upstash");
|
|
630
|
+
};
|
|
631
|
+
|
|
632
|
+
// src/client/api/utils.ts
|
|
633
|
+
var getProviderInfo = (api, upstashToken) => {
|
|
634
|
+
const { name, provider, ...parameters } = api;
|
|
635
|
+
const finalProvider = provider ?? upstash();
|
|
636
|
+
if (finalProvider.owner === "upstash" && !finalProvider.token) {
|
|
637
|
+
finalProvider.token = upstashToken;
|
|
638
|
+
}
|
|
639
|
+
if (!finalProvider.baseUrl)
|
|
640
|
+
throw new TypeError("baseUrl cannot be empty or undefined!");
|
|
641
|
+
if (!finalProvider.token)
|
|
642
|
+
throw new TypeError("token cannot be empty or undefined!");
|
|
643
|
+
if (finalProvider.apiKind !== name) {
|
|
644
|
+
throw new TypeError(
|
|
645
|
+
`Unexpected api name. Expected '${finalProvider.apiKind}', received ${name}`
|
|
646
|
+
);
|
|
647
|
+
}
|
|
648
|
+
const providerInfo = {
|
|
649
|
+
url: finalProvider.getUrl(),
|
|
650
|
+
baseUrl: finalProvider.baseUrl,
|
|
651
|
+
route: finalProvider.getRoute(),
|
|
652
|
+
appendHeaders: finalProvider.getHeaders(parameters),
|
|
653
|
+
owner: finalProvider.owner
|
|
654
|
+
};
|
|
655
|
+
return finalProvider.onFinish(providerInfo, parameters);
|
|
656
|
+
};
|
|
657
|
+
var processApi = (request, upstashToken) => {
|
|
658
|
+
if (!request.api) {
|
|
659
|
+
return request;
|
|
660
|
+
}
|
|
661
|
+
const { url, appendHeaders, owner } = getProviderInfo(request.api, upstashToken);
|
|
662
|
+
if (request.api.name === "llm") {
|
|
663
|
+
const callback = request.callback;
|
|
664
|
+
if (!callback) {
|
|
665
|
+
throw new TypeError("Callback cannot be undefined when using LLM api.");
|
|
666
|
+
}
|
|
667
|
+
return {
|
|
668
|
+
...request,
|
|
669
|
+
// @ts-expect-error undici header conflict
|
|
670
|
+
headers: new Headers({
|
|
671
|
+
...request.headers,
|
|
672
|
+
...appendHeaders
|
|
673
|
+
}),
|
|
674
|
+
...owner === "upstash" && !request.api.analytics ? { api: { name: "llm" }, url: void 0, callback } : { url, api: void 0 }
|
|
675
|
+
};
|
|
676
|
+
} else {
|
|
677
|
+
return {
|
|
678
|
+
...request,
|
|
679
|
+
// @ts-expect-error undici header conflict
|
|
680
|
+
headers: new Headers({
|
|
681
|
+
...request.headers,
|
|
682
|
+
...appendHeaders
|
|
683
|
+
}),
|
|
684
|
+
url,
|
|
685
|
+
api: void 0
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
function updateWithAnalytics(providerInfo, analytics) {
|
|
690
|
+
switch (analytics.name) {
|
|
691
|
+
case "helicone": {
|
|
692
|
+
providerInfo.appendHeaders["Helicone-Auth"] = `Bearer ${analytics.token}`;
|
|
693
|
+
if (providerInfo.owner === "upstash") {
|
|
694
|
+
updateProviderInfo(providerInfo, "https://qstash.helicone.ai", [
|
|
695
|
+
"llm",
|
|
696
|
+
...providerInfo.route
|
|
697
|
+
]);
|
|
698
|
+
} else {
|
|
699
|
+
providerInfo.appendHeaders["Helicone-Target-Url"] = providerInfo.baseUrl;
|
|
700
|
+
updateProviderInfo(providerInfo, "https://gateway.helicone.ai", providerInfo.route);
|
|
701
|
+
}
|
|
702
|
+
return providerInfo;
|
|
703
|
+
}
|
|
704
|
+
default: {
|
|
705
|
+
throw new Error("Unknown analytics provider");
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
function updateProviderInfo(providerInfo, baseUrl, route) {
|
|
710
|
+
providerInfo.baseUrl = baseUrl;
|
|
711
|
+
providerInfo.route = route;
|
|
712
|
+
providerInfo.url = `${baseUrl}/${route.join("/")}`;
|
|
713
|
+
}
|
|
714
|
+
|
|
628
715
|
// src/client/utils.ts
|
|
629
716
|
var isIgnoredHeader = (header) => {
|
|
630
717
|
const lowerCaseHeader = header.toLowerCase();
|
|
@@ -657,7 +744,7 @@ function processHeaders(request) {
|
|
|
657
744
|
if (request.deduplicationId !== void 0) {
|
|
658
745
|
headers.set("Upstash-Deduplication-Id", request.deduplicationId);
|
|
659
746
|
}
|
|
660
|
-
if (request.contentBasedDeduplication
|
|
747
|
+
if (request.contentBasedDeduplication) {
|
|
661
748
|
headers.set("Upstash-Content-Based-Deduplication", "true");
|
|
662
749
|
}
|
|
663
750
|
if (request.retries !== void 0) {
|
|
@@ -679,7 +766,16 @@ function processHeaders(request) {
|
|
|
679
766
|
return headers;
|
|
680
767
|
}
|
|
681
768
|
function getRequestPath(request) {
|
|
682
|
-
|
|
769
|
+
const nonApiPath = request.url ?? request.urlGroup ?? request.topic;
|
|
770
|
+
if (nonApiPath)
|
|
771
|
+
return nonApiPath;
|
|
772
|
+
if (request.api?.name === "llm")
|
|
773
|
+
return `api/llm`;
|
|
774
|
+
if (request.api?.name === "email") {
|
|
775
|
+
const providerInfo = getProviderInfo(request.api, "not-needed");
|
|
776
|
+
return providerInfo.baseUrl;
|
|
777
|
+
}
|
|
778
|
+
throw new QstashError(`Failed to infer request path for ${JSON.stringify(request)}`);
|
|
683
779
|
}
|
|
684
780
|
var NANOID_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_";
|
|
685
781
|
var NANOID_LENGTH = 21;
|
|
@@ -692,10 +788,18 @@ function decodeBase64(base64) {
|
|
|
692
788
|
const intArray = Uint8Array.from(binString, (m) => m.codePointAt(0));
|
|
693
789
|
return new TextDecoder().decode(intArray);
|
|
694
790
|
} catch (error) {
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
791
|
+
try {
|
|
792
|
+
const result = atob(base64);
|
|
793
|
+
console.warn(
|
|
794
|
+
`Upstash QStash: Failed while decoding base64 "${base64}". Decoding with atob and returning it instead. ${error}`
|
|
795
|
+
);
|
|
796
|
+
return result;
|
|
797
|
+
} catch (error2) {
|
|
798
|
+
console.warn(
|
|
799
|
+
`Upstash QStash: Failed to decode base64 "${base64}" with atob. Returning it as it is. ${error2}`
|
|
800
|
+
);
|
|
801
|
+
return base64;
|
|
802
|
+
}
|
|
699
803
|
}
|
|
700
804
|
}
|
|
701
805
|
|
|
@@ -786,11 +890,12 @@ var Queue = class {
|
|
|
786
890
|
async enqueueJSON(request) {
|
|
787
891
|
const headers = prefixHeaders(new Headers(request.headers));
|
|
788
892
|
headers.set("Content-Type", "application/json");
|
|
789
|
-
|
|
790
|
-
|
|
893
|
+
request.headers = headers;
|
|
894
|
+
const upstashToken = String(this.http.authorization).split("Bearer ")[1];
|
|
895
|
+
const nonApiRequest = processApi(request, upstashToken);
|
|
791
896
|
const response = await this.enqueue({
|
|
792
|
-
...
|
|
793
|
-
body: JSON.stringify(
|
|
897
|
+
...nonApiRequest,
|
|
898
|
+
body: JSON.stringify(nonApiRequest.body),
|
|
794
899
|
headers
|
|
795
900
|
});
|
|
796
901
|
return response;
|
|
@@ -870,6 +975,9 @@ var Schedules = class {
|
|
|
870
975
|
if (request.scheduleId !== void 0) {
|
|
871
976
|
headers.set("Upstash-Schedule-Id", request.scheduleId);
|
|
872
977
|
}
|
|
978
|
+
if (request.queueName !== void 0) {
|
|
979
|
+
headers.set("Upstash-Queue-Name", request.queueName);
|
|
980
|
+
}
|
|
873
981
|
return await this.http.request({
|
|
874
982
|
method: "POST",
|
|
875
983
|
headers,
|
|
@@ -1085,12 +1193,12 @@ var Client = class {
|
|
|
1085
1193
|
async publishJSON(request) {
|
|
1086
1194
|
const headers = prefixHeaders(new Headers(request.headers));
|
|
1087
1195
|
headers.set("Content-Type", "application/json");
|
|
1088
|
-
|
|
1089
|
-
|
|
1196
|
+
request.headers = headers;
|
|
1197
|
+
const upstashToken = String(this.http.authorization).split("Bearer ")[1];
|
|
1198
|
+
const nonApiRequest = processApi(request, upstashToken);
|
|
1090
1199
|
const response = await this.publish({
|
|
1091
|
-
...
|
|
1092
|
-
|
|
1093
|
-
body: JSON.stringify(request.body)
|
|
1200
|
+
...nonApiRequest,
|
|
1201
|
+
body: JSON.stringify(nonApiRequest.body)
|
|
1094
1202
|
});
|
|
1095
1203
|
return response;
|
|
1096
1204
|
}
|
|
@@ -1124,16 +1232,17 @@ var Client = class {
|
|
|
1124
1232
|
* Batch publish messages to QStash, serializing each body to JSON.
|
|
1125
1233
|
*/
|
|
1126
1234
|
async batchJSON(request) {
|
|
1127
|
-
|
|
1235
|
+
const batchPayload = request.map((message) => {
|
|
1128
1236
|
if ("body" in message) {
|
|
1129
1237
|
message.body = JSON.stringify(message.body);
|
|
1130
1238
|
}
|
|
1131
1239
|
message.headers = new Headers(message.headers);
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1240
|
+
const upstashToken = String(this.http.authorization).split("Bearer ")[1];
|
|
1241
|
+
const nonApiMessage = processApi(message, upstashToken);
|
|
1242
|
+
nonApiMessage.headers.set("Content-Type", "application/json");
|
|
1243
|
+
return nonApiMessage;
|
|
1244
|
+
});
|
|
1245
|
+
const response = await this.batch(batchPayload);
|
|
1137
1246
|
return response;
|
|
1138
1247
|
}
|
|
1139
1248
|
/**
|
package/hono.mjs
CHANGED
package/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RateLimit, C as ChatRateLimit, S as Step, F as FailureFunctionPayload } from './client-
|
|
2
|
-
export { A as AddEndpointsRequest,
|
|
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';
|
|
3
3
|
import 'neverthrow';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -64,4 +64,27 @@ declare const formatWorkflowError: (error: unknown) => FailureFunctionPayload;
|
|
|
64
64
|
*/
|
|
65
65
|
declare function decodeBase64(base64: string): string;
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
type AnalyticsConfig = {
|
|
68
|
+
name: "helicone";
|
|
69
|
+
token: string;
|
|
70
|
+
};
|
|
71
|
+
type AnalyticsSetup = {
|
|
72
|
+
baseURL?: string;
|
|
73
|
+
defaultHeaders?: Record<string, string | undefined>;
|
|
74
|
+
};
|
|
75
|
+
declare const setupAnalytics: (analytics: AnalyticsConfig | undefined, providerApiKey: string, providerBaseUrl?: string, provider?: LLMOwner) => AnalyticsSetup;
|
|
76
|
+
|
|
77
|
+
declare class EmailProvider extends BaseProvider<"email", EmailOwner> {
|
|
78
|
+
readonly apiKind = "email";
|
|
79
|
+
readonly batch: boolean;
|
|
80
|
+
constructor(baseUrl: string, token: string, owner: EmailOwner, batch: boolean);
|
|
81
|
+
getRoute(): string[];
|
|
82
|
+
getHeaders(_options: unknown): Record<string, string>;
|
|
83
|
+
onFinish(providerInfo: ProviderInfo, _options: unknown): ProviderInfo;
|
|
84
|
+
}
|
|
85
|
+
declare const resend: ({ token, batch, }: {
|
|
86
|
+
token: string;
|
|
87
|
+
batch?: boolean;
|
|
88
|
+
}) => EmailProvider;
|
|
89
|
+
|
|
90
|
+
export { ChatRateLimit, QStashWorkflowAbort, QStashWorkflowError, QstashChatRatelimitError, QstashDailyRatelimitError, QstashError, QstashRatelimitError, RateLimit, decodeBase64, formatWorkflowError, resend, setupAnalytics };
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RateLimit, C as ChatRateLimit, S as Step, F as FailureFunctionPayload } from './client-
|
|
2
|
-
export { A as AddEndpointsRequest,
|
|
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';
|
|
3
3
|
import 'neverthrow';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -64,4 +64,27 @@ declare const formatWorkflowError: (error: unknown) => FailureFunctionPayload;
|
|
|
64
64
|
*/
|
|
65
65
|
declare function decodeBase64(base64: string): string;
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
type AnalyticsConfig = {
|
|
68
|
+
name: "helicone";
|
|
69
|
+
token: string;
|
|
70
|
+
};
|
|
71
|
+
type AnalyticsSetup = {
|
|
72
|
+
baseURL?: string;
|
|
73
|
+
defaultHeaders?: Record<string, string | undefined>;
|
|
74
|
+
};
|
|
75
|
+
declare const setupAnalytics: (analytics: AnalyticsConfig | undefined, providerApiKey: string, providerBaseUrl?: string, provider?: LLMOwner) => AnalyticsSetup;
|
|
76
|
+
|
|
77
|
+
declare class EmailProvider extends BaseProvider<"email", EmailOwner> {
|
|
78
|
+
readonly apiKind = "email";
|
|
79
|
+
readonly batch: boolean;
|
|
80
|
+
constructor(baseUrl: string, token: string, owner: EmailOwner, batch: boolean);
|
|
81
|
+
getRoute(): string[];
|
|
82
|
+
getHeaders(_options: unknown): Record<string, string>;
|
|
83
|
+
onFinish(providerInfo: ProviderInfo, _options: unknown): ProviderInfo;
|
|
84
|
+
}
|
|
85
|
+
declare const resend: ({ token, batch, }: {
|
|
86
|
+
token: string;
|
|
87
|
+
batch?: boolean;
|
|
88
|
+
}) => EmailProvider;
|
|
89
|
+
|
|
90
|
+
export { ChatRateLimit, QStashWorkflowAbort, QStashWorkflowError, QstashChatRatelimitError, QstashDailyRatelimitError, QstashError, QstashRatelimitError, RateLimit, decodeBase64, formatWorkflowError, resend, setupAnalytics };
|