@upstash/qstash
Advanced tools
Comparing version 0.0.0-ci.caf2f91c1f3e36c97e40751812b904699443dc80-20241029164528 to 0.0.0-ci.cf7004d4d21ccdc65fbb46fe2c433e4fd2303065-20241030164022
@@ -1,2 +0,2 @@ | ||
import { $ as RouteFunction, a0 as WorkflowServeOptions } from './client-DFaav2I_.js'; | ||
import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-RORrka04.js'; | ||
import 'neverthrow'; | ||
@@ -3,0 +3,0 @@ |
import * as h3 from 'h3'; | ||
import { H3Event } from 'h3'; | ||
import { $ as RouteFunction, a0 as WorkflowServeOptions } from './client-DFaav2I_.js'; | ||
import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-RORrka04.js'; | ||
import 'neverthrow'; | ||
@@ -5,0 +5,0 @@ |
import { Context } from 'hono'; | ||
import { $ as RouteFunction, a0 as WorkflowServeOptions } from './client-DFaav2I_.js'; | ||
import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-RORrka04.js'; | ||
import 'neverthrow'; | ||
@@ -4,0 +4,0 @@ |
@@ -1,3 +0,3 @@ | ||
import { R as RateLimit, C as ChatRateLimit, S as Step, F as FailureFunctionPayload, L as LLMOwner, B as BaseProvider, E as EmailOwner, H as HeadersInit, P as ProviderInfo } from './client-DFaav2I_.js'; | ||
export { A as AddEndpointsRequest, z 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, w as Event, x as EventPayload, g as EventsRequest, y as GetEventsPayload, G as GetEventsResponse, v as HTTPMethods, 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 } from './client-DFaav2I_.js'; | ||
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'; | ||
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'; | ||
import 'neverthrow'; | ||
@@ -82,3 +82,3 @@ | ||
getRoute(): string[]; | ||
getHeaders(): HeadersInit; | ||
getHeaders(_options: unknown): Record<string, string>; | ||
onFinish(providerInfo: ProviderInfo, _options: unknown): ProviderInfo; | ||
@@ -91,2 +91,2 @@ } | ||
export { ChatRateLimit, HeadersInit, QStashWorkflowAbort, QStashWorkflowError, QstashChatRatelimitError, QstashDailyRatelimitError, QstashError, QstashRatelimitError, RateLimit, decodeBase64, formatWorkflowError, resend, setupAnalytics }; | ||
export { ChatRateLimit, QStashWorkflowAbort, QStashWorkflowError, QstashChatRatelimitError, QstashDailyRatelimitError, QstashError, QstashRatelimitError, RateLimit, decodeBase64, formatWorkflowError, resend, setupAnalytics }; |
105
index.js
@@ -46,6 +46,10 @@ "use strict"; | ||
UrlGroups: () => UrlGroups, | ||
anthropic: () => anthropic, | ||
custom: () => custom, | ||
decodeBase64: () => decodeBase64, | ||
formatWorkflowError: () => formatWorkflowError, | ||
openai: () => openai, | ||
resend: () => resend, | ||
setupAnalytics: () => setupAnalytics | ||
setupAnalytics: () => setupAnalytics, | ||
upstash: () => upstash | ||
}); | ||
@@ -618,11 +622,13 @@ module.exports = __toCommonJS(src_exports); | ||
} | ||
getHeaders() { | ||
getHeaders(options) { | ||
if (this.owner === "upstash" && !options.analytics) { | ||
return {}; | ||
} | ||
const header = this.owner === "anthropic" ? "x-api-key" : "authorization"; | ||
const headerValue = this.owner === "anthropic" ? this.token : `Bearer ${this.token}`; | ||
return { | ||
[header]: headerValue, | ||
...this.organization ? { | ||
"OpenAI-Organization": this.organization | ||
} : {} | ||
}; | ||
const headers = { [header]: headerValue }; | ||
if (this.organization) { | ||
headers["OpenAI-Organization"] = this.organization; | ||
} | ||
return headers; | ||
} | ||
@@ -637,25 +643,6 @@ /** | ||
if (options.analytics) { | ||
return this.updateWithAnalytics(providerInfo, options.analytics, this.owner === "upstash"); | ||
return updateWithAnalytics(providerInfo, options.analytics); | ||
} | ||
return providerInfo; | ||
} | ||
updateWithAnalytics(providerInfo, analytics, isUpstash) { | ||
switch (analytics.name) { | ||
case "helicone": { | ||
providerInfo.appendHeaders.set("Helicone-Auth", `Bearer ${analytics.token}`); | ||
if (isUpstash) { | ||
providerInfo.baseUrl = "https://qstash.helicone.ai"; | ||
providerInfo.route = ["llm", "v1", "chat", "completions"]; | ||
} else { | ||
providerInfo.appendHeaders.set("Helicone-Target-Url", providerInfo.url); | ||
providerInfo.baseUrl = "https://gateway.helicone.ai"; | ||
providerInfo.route = ["v1", "chat", "completions"]; | ||
} | ||
return providerInfo; | ||
} | ||
default: { | ||
throw new Error("Unknown analytics provider"); | ||
} | ||
} | ||
} | ||
}; | ||
@@ -665,2 +652,43 @@ var upstash = () => { | ||
}; | ||
var openai = ({ | ||
token, | ||
organization | ||
}) => { | ||
return new LLMProvider("https://api.openai.com", token, "openai", organization); | ||
}; | ||
var anthropic = ({ token }) => { | ||
return new LLMProvider("https://api.anthropic.com", token, "anthropic"); | ||
}; | ||
var custom = ({ | ||
baseUrl, | ||
token | ||
}) => { | ||
const trimmedBaseUrl = baseUrl.replace(/\/(v1\/)?chat\/completions$/, ""); | ||
return new LLMProvider(trimmedBaseUrl, token, "custom"); | ||
}; | ||
function updateWithAnalytics(providerInfo, analytics) { | ||
switch (analytics.name) { | ||
case "helicone": { | ||
providerInfo.appendHeaders["Helicone-Auth"] = `Bearer ${analytics.token}`; | ||
if (providerInfo.owner === "upstash") { | ||
updateProviderInfo(providerInfo, "https://qstash.helicone.ai", [ | ||
"llm", | ||
...providerInfo.route | ||
]); | ||
} else { | ||
providerInfo.appendHeaders["Helicone-Target-Url"] = providerInfo.baseUrl; | ||
updateProviderInfo(providerInfo, "https://gateway.helicone.ai", providerInfo.route); | ||
} | ||
return providerInfo; | ||
} | ||
default: { | ||
throw new Error("Unknown analytics provider"); | ||
} | ||
} | ||
} | ||
function updateProviderInfo(providerInfo, baseUrl, route) { | ||
providerInfo.baseUrl = baseUrl; | ||
providerInfo.route = route; | ||
providerInfo.url = `${baseUrl}/${route.join("/")}`; | ||
} | ||
@@ -687,4 +715,4 @@ // src/client/api/utils.ts | ||
route: finalProvider.getRoute(), | ||
appendHeaders: finalProvider.getHeaders(), | ||
provider: finalProvider | ||
appendHeaders: finalProvider.getHeaders(parameters), | ||
owner: finalProvider.owner | ||
}; | ||
@@ -697,3 +725,3 @@ return finalProvider.onFinish(providerInfo, parameters); | ||
} | ||
const { url, appendHeaders, provider } = getProviderInfo(request.api, upstashToken); | ||
const { url, appendHeaders, owner } = getProviderInfo(request.api, upstashToken); | ||
if (request.api.name === "llm") { | ||
@@ -711,3 +739,3 @@ const callback = request.callback; | ||
}), | ||
...provider.owner === "upstash" ? { api: { name: "llm" }, url: void 0, callback } : { url, api: void 0 } | ||
...owner === "upstash" && !request.api.analytics ? { api: { name: "llm" }, url: void 0, callback } : { url, api: void 0 } | ||
}; | ||
@@ -786,5 +814,6 @@ } else { | ||
if (request.api?.name === "llm") | ||
return `api/${request.api.name}`; | ||
return `api/llm`; | ||
if (request.api?.name === "email") { | ||
return request.api.provider.baseUrl; | ||
const providerInfo = getProviderInfo(request.api, "not-needed"); | ||
return providerInfo.baseUrl; | ||
} | ||
@@ -1351,3 +1380,3 @@ throw new QstashError(`Failed to infer request path for ${JSON.stringify(request)}`); | ||
} | ||
getHeaders() { | ||
getHeaders(_options) { | ||
return { | ||
@@ -1382,6 +1411,10 @@ "upstash-forward-authorization": `Bearer ${this.token}` | ||
UrlGroups, | ||
anthropic, | ||
custom, | ||
decodeBase64, | ||
formatWorkflowError, | ||
openai, | ||
resend, | ||
setupAnalytics | ||
setupAnalytics, | ||
upstash | ||
}); |
import { NextApiHandler } from 'next'; | ||
import { NextRequest, NextFetchEvent } from 'next/server'; | ||
import { $ as RouteFunction, a0 as WorkflowServeOptions } from './client-DFaav2I_.js'; | ||
import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-RORrka04.js'; | ||
import 'neverthrow'; | ||
@@ -5,0 +5,0 @@ |
@@ -1,1 +0,1 @@ | ||
{ "version": "v0.0.0-ci.caf2f91c1f3e36c97e40751812b904699443dc80-20241029164528", "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", "prepare": "husky" }, "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": { "neverthrow": "^7.0.1", "crypto-js": ">=4.2.0", "jose": "^5.2.3" } } | ||
{ "version": "v0.0.0-ci.cf7004d4d21ccdc65fbb46fe2c433e4fd2303065-20241030164022", "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", "prepare": "husky" }, "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": { "neverthrow": "^7.0.1", "crypto-js": ">=4.2.0", "jose": "^5.2.3" } } |
import { APIHandler, APIEvent } from '@solidjs/start/server'; | ||
import { $ as RouteFunction, a0 as WorkflowServeOptions } from './client-DFaav2I_.js'; | ||
import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-RORrka04.js'; | ||
import 'neverthrow'; | ||
@@ -4,0 +4,0 @@ |
import { RequestHandler } from '@sveltejs/kit'; | ||
import { $ as RouteFunction, a0 as WorkflowServeOptions } from './client-DFaav2I_.js'; | ||
import { a3 as RouteFunction, a4 as WorkflowServeOptions } from './client-RORrka04.js'; | ||
import 'neverthrow'; | ||
@@ -4,0 +4,0 @@ |
@@ -1,2 +0,2 @@ | ||
export { ac as AsyncStepFunction, a5 as DisabledWorkflowContext, F as FailureFunctionPayload, af as FinishCondition, ah as LogLevel, ae as ParallelCallState, aa as RawStep, ag as RequiredExceptFields, $ as RouteFunction, S as Step, ad as StepFunction, a9 as StepType, a8 as StepTypes, ab as SyncStepFunction, a1 as Workflow, a6 as WorkflowClient, a4 as WorkflowContext, aj as WorkflowLogger, ai as WorkflowLoggerOptions, a7 as WorkflowReceiver, a0 as WorkflowServeOptions, a2 as processOptions, a3 as serve } from './client-DFaav2I_.js'; | ||
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-RORrka04.js'; | ||
import 'neverthrow'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
904792
26801
10