@upstash/qstash 2.7.10 → 2.7.11-canary-2
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-O2RN672L.mjs → chunk-E4S2C5HM.mjs} +1 -1
- package/{chunk-HIWMJGFU.mjs → chunk-KGI26PDH.mjs} +11 -20
- package/{client-orcgOcAm.d.mts → client-DkrYCqaq.d.mts} +26 -17
- package/{client-orcgOcAm.d.ts → client-DkrYCqaq.d.ts} +26 -17
- package/cloudflare.d.mts +1 -1
- package/cloudflare.d.ts +1 -1
- package/cloudflare.js +2942 -6
- package/cloudflare.mjs +1 -1
- package/h3.d.mts +1 -1
- package/h3.d.ts +1 -1
- package/h3.js +3333 -5
- package/h3.mjs +2 -2
- package/hono.d.mts +1 -1
- package/hono.d.ts +1 -1
- package/hono.js +2942 -6
- package/hono.mjs +1 -1
- package/index.d.mts +2 -2
- package/index.d.ts +2 -2
- package/index.js +1623 -27
- package/index.mjs +1 -1
- package/nextjs.d.mts +1 -1
- package/nextjs.d.ts +1 -1
- package/nextjs.js +2973 -34
- package/nextjs.mjs +1 -1
- package/nuxt.js +828 -7
- package/nuxt.mjs +2 -2
- package/package.json +1 -1
- package/solidjs.d.mts +1 -1
- package/solidjs.d.ts +1 -1
- package/solidjs.js +2946 -11
- package/solidjs.mjs +1 -1
- package/svelte.d.mts +1 -1
- package/svelte.d.ts +1 -1
- package/svelte.js +2943 -8
- package/svelte.mjs +1 -1
- package/workflow.d.mts +1 -1
- package/workflow.d.ts +1 -1
- package/workflow.js +2939 -3
- package/workflow.mjs +1 -1
- package/LICENSE +0 -21
- package/README.md +0 -167
- package/chunk-KZOQ64Z6.js +0 -2963
- package/chunk-Q6JW7JKT.js +0 -403
- package/chunk-VN7YQ2UN.js +0 -1
|
@@ -352,20 +352,13 @@ var upstash = () => {
|
|
|
352
352
|
return {
|
|
353
353
|
owner: "upstash",
|
|
354
354
|
baseUrl: "https://qstash.upstash.io/llm",
|
|
355
|
-
token: ""
|
|
356
|
-
organization: void 0
|
|
355
|
+
token: ""
|
|
357
356
|
};
|
|
358
357
|
};
|
|
359
358
|
var openai = ({
|
|
360
|
-
token
|
|
361
|
-
organization
|
|
359
|
+
token
|
|
362
360
|
}) => {
|
|
363
|
-
return {
|
|
364
|
-
token,
|
|
365
|
-
owner: "openai",
|
|
366
|
-
baseUrl: "https://api.openai.com",
|
|
367
|
-
organization
|
|
368
|
-
};
|
|
361
|
+
return { token, owner: "openai", baseUrl: "https://api.openai.com" };
|
|
369
362
|
};
|
|
370
363
|
var custom = ({
|
|
371
364
|
baseUrl,
|
|
@@ -375,8 +368,7 @@ var custom = ({
|
|
|
375
368
|
return {
|
|
376
369
|
token,
|
|
377
370
|
owner: "custom",
|
|
378
|
-
baseUrl: trimmedBaseUrl
|
|
379
|
-
organization: void 0
|
|
371
|
+
baseUrl: trimmedBaseUrl
|
|
380
372
|
};
|
|
381
373
|
};
|
|
382
374
|
|
|
@@ -456,7 +448,7 @@ var Chat = class _Chat {
|
|
|
456
448
|
*/
|
|
457
449
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
458
450
|
createThirdParty = async (request) => {
|
|
459
|
-
const { baseUrl, token, owner
|
|
451
|
+
const { baseUrl, token, owner } = request.provider;
|
|
460
452
|
if (owner === "upstash")
|
|
461
453
|
throw new Error("Upstash is not 3rd party provider!");
|
|
462
454
|
delete request.provider;
|
|
@@ -470,9 +462,6 @@ var Chat = class _Chat {
|
|
|
470
462
|
const headers = {
|
|
471
463
|
"Content-Type": "application/json",
|
|
472
464
|
Authorization: `Bearer ${token}`,
|
|
473
|
-
...organization ? {
|
|
474
|
-
"OpenAI-Organization": organization
|
|
475
|
-
} : {},
|
|
476
465
|
...isStream ? {
|
|
477
466
|
Connection: "keep-alive",
|
|
478
467
|
Accept: "text/event-stream",
|
|
@@ -688,7 +677,7 @@ function decodeBase64(base64) {
|
|
|
688
677
|
return new TextDecoder().decode(intArray);
|
|
689
678
|
} catch (error) {
|
|
690
679
|
console.warn(
|
|
691
|
-
`Upstash Qstash: Failed while decoding base64 "${base64}". Decoding with atob and returning it instead. ${error}`
|
|
680
|
+
`Upstash Qstash: Failed while decoding base64 "${base64}". Decoding with atob and returning it instead. Error: ${error}`
|
|
692
681
|
);
|
|
693
682
|
return atob(base64);
|
|
694
683
|
}
|
|
@@ -1641,11 +1630,11 @@ var handleThirdPartyCallResult = async (request, requestPayload, client, workflo
|
|
|
1641
1630
|
if (!(callbackMessage.status >= 200 && callbackMessage.status < 300)) {
|
|
1642
1631
|
await debug?.log("WARN", "SUBMIT_THIRD_PARTY_RESULT", {
|
|
1643
1632
|
status: callbackMessage.status,
|
|
1644
|
-
body:
|
|
1633
|
+
body: decodeBase64(callbackMessage.body)
|
|
1645
1634
|
});
|
|
1646
1635
|
console.warn(
|
|
1647
1636
|
`Workflow Warning: "context.call" failed with status ${callbackMessage.status} and will retry (if there are retries remaining). Error Message:
|
|
1648
|
-
${
|
|
1637
|
+
${decodeBase64(callbackMessage.body)}`
|
|
1649
1638
|
);
|
|
1650
1639
|
return ok("call-will-retry");
|
|
1651
1640
|
}
|
|
@@ -1681,7 +1670,7 @@ ${atob(callbackMessage.body)}`
|
|
|
1681
1670
|
stepId: Number(stepIdString),
|
|
1682
1671
|
stepName,
|
|
1683
1672
|
stepType,
|
|
1684
|
-
out:
|
|
1673
|
+
out: decodeBase64(callbackMessage.body),
|
|
1685
1674
|
concurrent: Number(concurrentString)
|
|
1686
1675
|
};
|
|
1687
1676
|
await debug?.log("SUBMIT", "SUBMIT_THIRD_PARTY_RESULT", {
|
|
@@ -2075,6 +2064,7 @@ var AutoExecutor = class _AutoExecutor {
|
|
|
2075
2064
|
* @param index index of the current step
|
|
2076
2065
|
* @returns result[index] if lazyStepList > 1, otherwise result
|
|
2077
2066
|
*/
|
|
2067
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
2078
2068
|
static getResult(lazyStepList, result, index) {
|
|
2079
2069
|
if (lazyStepList.length === 1) {
|
|
2080
2070
|
return result;
|
|
@@ -2500,6 +2490,7 @@ var WorkflowContext = class {
|
|
|
2500
2490
|
* @param headers call headers
|
|
2501
2491
|
* @returns call result (parsed as JSON if possible)
|
|
2502
2492
|
*/
|
|
2493
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
2503
2494
|
async call(stepName, url, method, body, headers) {
|
|
2504
2495
|
const result = await this.addStep(
|
|
2505
2496
|
new LazyCallStep(stepName, url, method, body, headers ?? {})
|
|
@@ -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";
|
package/cloudflare.d.mts
CHANGED
package/cloudflare.d.ts
CHANGED