@upstash/qstash 2.7.10 → 2.8.0-canary
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-HIWMJGFU.mjs → dist/chunk-KWSSCN6R.mjs} +39 -20
- package/{chunk-O2RN672L.mjs → dist/chunk-XLCNEVA2.mjs} +1 -1
- package/{client-orcgOcAm.d.mts → dist/client-DkrYCqaq.d.mts} +26 -17
- package/{client-orcgOcAm.d.ts → dist/client-DkrYCqaq.d.ts} +26 -17
- package/{cloudflare.d.mts → dist/cloudflare.d.mts} +1 -1
- package/{cloudflare.d.ts → dist/cloudflare.d.ts} +1 -1
- package/{chunk-KZOQ64Z6.js → dist/cloudflare.js} +265 -255
- package/{cloudflare.mjs → dist/cloudflare.mjs} +1 -1
- package/{h3.d.mts → dist/h3.d.mts} +1 -1
- package/{h3.d.ts → dist/h3.d.ts} +1 -1
- package/dist/h3.js +3338 -0
- package/{h3.mjs → dist/h3.mjs} +2 -2
- package/{hono.d.mts → dist/hono.d.mts} +1 -1
- package/{hono.d.ts → dist/hono.d.ts} +1 -1
- package/dist/hono.js +2958 -0
- package/{hono.mjs → dist/hono.mjs} +1 -1
- package/{index.d.mts → dist/index.d.mts} +2 -2
- package/{index.d.ts → dist/index.d.ts} +2 -2
- package/dist/index.js +1639 -0
- package/{index.mjs → dist/index.mjs} +1 -1
- package/{nextjs.d.mts → dist/nextjs.d.mts} +1 -1
- package/{nextjs.d.ts → dist/nextjs.d.ts} +1 -1
- package/dist/nextjs.js +4742 -0
- package/dist/nextjs.mjs +1802 -0
- package/dist/nuxt.js +832 -0
- package/{nuxt.mjs → dist/nuxt.mjs} +2 -2
- package/{solidjs.d.mts → dist/solidjs.d.mts} +1 -1
- package/{solidjs.d.ts → dist/solidjs.d.ts} +1 -1
- package/dist/solidjs.js +2991 -0
- package/{solidjs.mjs → dist/solidjs.mjs} +1 -1
- package/{svelte.d.mts → dist/svelte.d.mts} +1 -1
- package/{svelte.d.ts → dist/svelte.d.ts} +1 -1
- package/dist/svelte.js +2988 -0
- package/{svelte.mjs → dist/svelte.mjs} +1 -1
- package/{workflow.d.mts → dist/workflow.d.mts} +1 -1
- package/{workflow.d.ts → dist/workflow.d.ts} +1 -1
- package/dist/workflow.js +2954 -0
- package/{workflow.mjs → dist/workflow.mjs} +1 -1
- package/package.json +1 -1
- package/chunk-Q6JW7JKT.js +0 -403
- package/chunk-VN7YQ2UN.js +0 -1
- package/cloudflare.js +0 -37
- package/h3.js +0 -10
- package/hono.js +0 -22
- package/index.js +0 -43
- package/nextjs.js +0 -178
- package/nextjs.mjs +0 -178
- package/nuxt.js +0 -11
- package/solidjs.js +0 -56
- package/svelte.js +0 -53
- package/workflow.js +0 -18
- /package/{chunk-CIVGPRQN.mjs → dist/chunk-CIVGPRQN.mjs} +0 -0
- /package/{nuxt.d.mts → dist/nuxt.d.mts} +0 -0
- /package/{nuxt.d.ts → dist/nuxt.d.ts} +0 -0
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
+
mod
|
|
25
|
+
));
|
|
26
|
+
|
|
1
27
|
// src/receiver.ts
|
|
2
28
|
import * as jose from "jose";
|
|
3
29
|
import crypto2 from "crypto-js";
|
|
@@ -352,20 +378,13 @@ var upstash = () => {
|
|
|
352
378
|
return {
|
|
353
379
|
owner: "upstash",
|
|
354
380
|
baseUrl: "https://qstash.upstash.io/llm",
|
|
355
|
-
token: ""
|
|
356
|
-
organization: void 0
|
|
381
|
+
token: ""
|
|
357
382
|
};
|
|
358
383
|
};
|
|
359
384
|
var openai = ({
|
|
360
|
-
token
|
|
361
|
-
organization
|
|
385
|
+
token
|
|
362
386
|
}) => {
|
|
363
|
-
return {
|
|
364
|
-
token,
|
|
365
|
-
owner: "openai",
|
|
366
|
-
baseUrl: "https://api.openai.com",
|
|
367
|
-
organization
|
|
368
|
-
};
|
|
387
|
+
return { token, owner: "openai", baseUrl: "https://api.openai.com" };
|
|
369
388
|
};
|
|
370
389
|
var custom = ({
|
|
371
390
|
baseUrl,
|
|
@@ -375,8 +394,7 @@ var custom = ({
|
|
|
375
394
|
return {
|
|
376
395
|
token,
|
|
377
396
|
owner: "custom",
|
|
378
|
-
baseUrl: trimmedBaseUrl
|
|
379
|
-
organization: void 0
|
|
397
|
+
baseUrl: trimmedBaseUrl
|
|
380
398
|
};
|
|
381
399
|
};
|
|
382
400
|
|
|
@@ -456,7 +474,7 @@ var Chat = class _Chat {
|
|
|
456
474
|
*/
|
|
457
475
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
458
476
|
createThirdParty = async (request) => {
|
|
459
|
-
const { baseUrl, token, owner
|
|
477
|
+
const { baseUrl, token, owner } = request.provider;
|
|
460
478
|
if (owner === "upstash")
|
|
461
479
|
throw new Error("Upstash is not 3rd party provider!");
|
|
462
480
|
delete request.provider;
|
|
@@ -470,9 +488,6 @@ var Chat = class _Chat {
|
|
|
470
488
|
const headers = {
|
|
471
489
|
"Content-Type": "application/json",
|
|
472
490
|
Authorization: `Bearer ${token}`,
|
|
473
|
-
...organization ? {
|
|
474
|
-
"OpenAI-Organization": organization
|
|
475
|
-
} : {},
|
|
476
491
|
...isStream ? {
|
|
477
492
|
Connection: "keep-alive",
|
|
478
493
|
Accept: "text/event-stream",
|
|
@@ -688,7 +703,7 @@ function decodeBase64(base64) {
|
|
|
688
703
|
return new TextDecoder().decode(intArray);
|
|
689
704
|
} catch (error) {
|
|
690
705
|
console.warn(
|
|
691
|
-
`Upstash Qstash: Failed while decoding base64 "${base64}". Decoding with atob and returning it instead. ${error}`
|
|
706
|
+
`Upstash Qstash: Failed while decoding base64 "${base64}". Decoding with atob and returning it instead. Error: ${error}`
|
|
692
707
|
);
|
|
693
708
|
return atob(base64);
|
|
694
709
|
}
|
|
@@ -1641,11 +1656,11 @@ var handleThirdPartyCallResult = async (request, requestPayload, client, workflo
|
|
|
1641
1656
|
if (!(callbackMessage.status >= 200 && callbackMessage.status < 300)) {
|
|
1642
1657
|
await debug?.log("WARN", "SUBMIT_THIRD_PARTY_RESULT", {
|
|
1643
1658
|
status: callbackMessage.status,
|
|
1644
|
-
body:
|
|
1659
|
+
body: decodeBase64(callbackMessage.body)
|
|
1645
1660
|
});
|
|
1646
1661
|
console.warn(
|
|
1647
1662
|
`Workflow Warning: "context.call" failed with status ${callbackMessage.status} and will retry (if there are retries remaining). Error Message:
|
|
1648
|
-
${
|
|
1663
|
+
${decodeBase64(callbackMessage.body)}`
|
|
1649
1664
|
);
|
|
1650
1665
|
return ok("call-will-retry");
|
|
1651
1666
|
}
|
|
@@ -1681,7 +1696,7 @@ ${atob(callbackMessage.body)}`
|
|
|
1681
1696
|
stepId: Number(stepIdString),
|
|
1682
1697
|
stepName,
|
|
1683
1698
|
stepType,
|
|
1684
|
-
out:
|
|
1699
|
+
out: decodeBase64(callbackMessage.body),
|
|
1685
1700
|
concurrent: Number(concurrentString)
|
|
1686
1701
|
};
|
|
1687
1702
|
await debug?.log("SUBMIT", "SUBMIT_THIRD_PARTY_RESULT", {
|
|
@@ -2075,6 +2090,7 @@ var AutoExecutor = class _AutoExecutor {
|
|
|
2075
2090
|
* @param index index of the current step
|
|
2076
2091
|
* @returns result[index] if lazyStepList > 1, otherwise result
|
|
2077
2092
|
*/
|
|
2093
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
2078
2094
|
static getResult(lazyStepList, result, index) {
|
|
2079
2095
|
if (lazyStepList.length === 1) {
|
|
2080
2096
|
return result;
|
|
@@ -2500,6 +2516,7 @@ var WorkflowContext = class {
|
|
|
2500
2516
|
* @param headers call headers
|
|
2501
2517
|
* @returns call result (parsed as JSON if possible)
|
|
2502
2518
|
*/
|
|
2519
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
2503
2520
|
async call(stepName, url, method, body, headers) {
|
|
2504
2521
|
const result = await this.addStep(
|
|
2505
2522
|
new LazyCallStep(stepName, url, method, body, headers ?? {})
|
|
@@ -2934,6 +2951,8 @@ var Workflow = class {
|
|
|
2934
2951
|
};
|
|
2935
2952
|
|
|
2936
2953
|
export {
|
|
2954
|
+
__commonJS,
|
|
2955
|
+
__toESM,
|
|
2937
2956
|
SignatureError,
|
|
2938
2957
|
Receiver,
|
|
2939
2958
|
QstashError,
|
|
@@ -105,12 +105,10 @@ type RateLimit = {
|
|
|
105
105
|
reset: string | null;
|
|
106
106
|
};
|
|
107
107
|
|
|
108
|
-
type
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
token: TToken;
|
|
113
|
-
organization: TOrganization;
|
|
108
|
+
type ProviderReturnType = {
|
|
109
|
+
owner: "upstash" | "openai" | "custom";
|
|
110
|
+
baseUrl: string;
|
|
111
|
+
token: string;
|
|
114
112
|
};
|
|
115
113
|
type AnalyticsConfig = {
|
|
116
114
|
name: "helicone";
|
|
@@ -121,15 +119,26 @@ type AnalyticsSetup = {
|
|
|
121
119
|
defaultHeaders?: Record<string, string | undefined>;
|
|
122
120
|
};
|
|
123
121
|
declare const setupAnalytics: (analytics: AnalyticsConfig | undefined, providerApiKey: string, providerBaseUrl?: string, provider?: "openai" | "upstash" | "custom") => AnalyticsSetup;
|
|
124
|
-
declare const upstash: () =>
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
declare const
|
|
122
|
+
declare const upstash: () => {
|
|
123
|
+
owner: "upstash";
|
|
124
|
+
baseUrl: "https://qstash.upstash.io/llm";
|
|
125
|
+
token: string;
|
|
126
|
+
};
|
|
127
|
+
declare const openai: ({ token, }: {
|
|
128
|
+
token: string;
|
|
129
|
+
}) => {
|
|
130
|
+
owner: "openai";
|
|
131
|
+
baseUrl: "https://api.openai.com";
|
|
132
|
+
token: string;
|
|
133
|
+
};
|
|
134
|
+
declare const custom: ({ baseUrl, token, }: {
|
|
135
|
+
token: string;
|
|
136
|
+
baseUrl: string;
|
|
137
|
+
}) => {
|
|
138
|
+
owner: "custom";
|
|
130
139
|
baseUrl: string;
|
|
131
|
-
token:
|
|
132
|
-
}
|
|
140
|
+
token: string;
|
|
141
|
+
};
|
|
133
142
|
|
|
134
143
|
type ChatCompletionMessage = {
|
|
135
144
|
role: "system" | "assistant" | "user";
|
|
@@ -218,21 +227,21 @@ type ChatRequestFields = ChatRequestCommonFields & {
|
|
|
218
227
|
messages: ChatCompletionMessage[];
|
|
219
228
|
};
|
|
220
229
|
type ChatRequestProviders = {
|
|
221
|
-
provider: ProviderReturnType
|
|
230
|
+
provider: ProviderReturnType;
|
|
222
231
|
model: OpenAIChatModel;
|
|
223
232
|
analytics?: {
|
|
224
233
|
name: "helicone";
|
|
225
234
|
token: string;
|
|
226
235
|
};
|
|
227
236
|
} | {
|
|
228
|
-
provider: ProviderReturnType
|
|
237
|
+
provider: ProviderReturnType;
|
|
229
238
|
model: string;
|
|
230
239
|
analytics?: {
|
|
231
240
|
name: "helicone";
|
|
232
241
|
token: string;
|
|
233
242
|
};
|
|
234
243
|
} | {
|
|
235
|
-
provider: ProviderReturnType
|
|
244
|
+
provider: ProviderReturnType;
|
|
236
245
|
model: ChatModel;
|
|
237
246
|
analytics?: {
|
|
238
247
|
name: "helicone";
|
|
@@ -105,12 +105,10 @@ type RateLimit = {
|
|
|
105
105
|
reset: string | null;
|
|
106
106
|
};
|
|
107
107
|
|
|
108
|
-
type
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
token: TToken;
|
|
113
|
-
organization: TOrganization;
|
|
108
|
+
type ProviderReturnType = {
|
|
109
|
+
owner: "upstash" | "openai" | "custom";
|
|
110
|
+
baseUrl: string;
|
|
111
|
+
token: string;
|
|
114
112
|
};
|
|
115
113
|
type AnalyticsConfig = {
|
|
116
114
|
name: "helicone";
|
|
@@ -121,15 +119,26 @@ type AnalyticsSetup = {
|
|
|
121
119
|
defaultHeaders?: Record<string, string | undefined>;
|
|
122
120
|
};
|
|
123
121
|
declare const setupAnalytics: (analytics: AnalyticsConfig | undefined, providerApiKey: string, providerBaseUrl?: string, provider?: "openai" | "upstash" | "custom") => AnalyticsSetup;
|
|
124
|
-
declare const upstash: () =>
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
declare const
|
|
122
|
+
declare const upstash: () => {
|
|
123
|
+
owner: "upstash";
|
|
124
|
+
baseUrl: "https://qstash.upstash.io/llm";
|
|
125
|
+
token: string;
|
|
126
|
+
};
|
|
127
|
+
declare const openai: ({ token, }: {
|
|
128
|
+
token: string;
|
|
129
|
+
}) => {
|
|
130
|
+
owner: "openai";
|
|
131
|
+
baseUrl: "https://api.openai.com";
|
|
132
|
+
token: string;
|
|
133
|
+
};
|
|
134
|
+
declare const custom: ({ baseUrl, token, }: {
|
|
135
|
+
token: string;
|
|
136
|
+
baseUrl: string;
|
|
137
|
+
}) => {
|
|
138
|
+
owner: "custom";
|
|
130
139
|
baseUrl: string;
|
|
131
|
-
token:
|
|
132
|
-
}
|
|
140
|
+
token: string;
|
|
141
|
+
};
|
|
133
142
|
|
|
134
143
|
type ChatCompletionMessage = {
|
|
135
144
|
role: "system" | "assistant" | "user";
|
|
@@ -218,21 +227,21 @@ type ChatRequestFields = ChatRequestCommonFields & {
|
|
|
218
227
|
messages: ChatCompletionMessage[];
|
|
219
228
|
};
|
|
220
229
|
type ChatRequestProviders = {
|
|
221
|
-
provider: ProviderReturnType
|
|
230
|
+
provider: ProviderReturnType;
|
|
222
231
|
model: OpenAIChatModel;
|
|
223
232
|
analytics?: {
|
|
224
233
|
name: "helicone";
|
|
225
234
|
token: string;
|
|
226
235
|
};
|
|
227
236
|
} | {
|
|
228
|
-
provider: ProviderReturnType
|
|
237
|
+
provider: ProviderReturnType;
|
|
229
238
|
model: string;
|
|
230
239
|
analytics?: {
|
|
231
240
|
name: "helicone";
|
|
232
241
|
token: string;
|
|
233
242
|
};
|
|
234
243
|
} | {
|
|
235
|
-
provider: ProviderReturnType
|
|
244
|
+
provider: ProviderReturnType;
|
|
236
245
|
model: ChatModel;
|
|
237
246
|
analytics?: {
|
|
238
247
|
name: "helicone";
|