@upstash/qstash
Version:
Official Typescript client for QStash
101 lines (95 loc) • 4.69 kB
text/typescript
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-CUioGZfg.mjs';
export { A as AddEndpointsRequest, Y as BodyInit, a0 as Chat, a2 as ChatCompletion, a3 as ChatCompletionChunk, a1 as ChatCompletionMessage, a9 as ChatRequest, j as Client, v as CreateScheduleRequest, x as Endpoint, K as Event, O as EventPayload, h as EventsRequest, $ as FlowControl, r as FlowControlApi, o as FlowControlInfo, W as GetEventsPayload, i as GetEventsResponse, T as GetLogsPayload, G as GetLogsResponse, p as GlobalParallelismInfo, I as HTTPMethods, Z as HeadersInit, J as Log, N as LogPayload, g as LogsRequest, M as Message, s as MessagePayload, t as Messages, a7 as OpenAIChatModel, q as PinFlowControlOptions, a8 as PromptChatRequest, d as PublishBatchRequest, f as PublishJsonRequest, e as PublishRequest, n as PublishResponse, k as PublishToApiResponse, m as PublishToUrlGroupsResponse, l as PublishToUrlResponse, Q as QueueRequest, c as Receiver, a as ReceiverConfig, y as RemoveEndpointsRequest, _ as RequestOptions, u as Schedule, w as Schedules, b as SignatureError, H as State, a5 as StreamDisabled, a4 as StreamEnabled, a6 as StreamParameter, U as UnpinFlowControlOptions, z as UrlGroup, D as UrlGroups, V as VerifyRequest, X as WithCursor, ac as anthropic, ad as custom, ab as openai, aa as upstash } from './client-CUioGZfg.mjs';
import 'neverthrow';
/**
* Result of 500 Internal Server Error
*/
declare class QstashError extends Error {
readonly status?: number;
constructor(message: string, status?: number);
}
declare class QstashRatelimitError extends QstashError {
limit: string | null;
remaining: string | null;
reset: string | null;
constructor(args: RateLimit);
}
declare class QstashChatRatelimitError extends QstashError {
limitRequests: string | null;
limitTokens: string | null;
remainingRequests: string | null;
remainingTokens: string | null;
resetRequests: string | null;
resetTokens: string | null;
constructor(args: ChatRateLimit);
}
declare class QstashDailyRatelimitError extends QstashError {
limit: string | null;
remaining: string | null;
reset: string | null;
constructor(args: RateLimit);
}
/**
* Raised when an empty array is passed as a query parameter.
* This is a safety net to prevent accidental bulk operations
* (e.g. delete-all, cancel-all) when no IDs were intended.
*/
declare class QstashEmptyArrayError extends QstashError {
constructor(parameterName: string);
}
/**
* Error raised during Workflow execution
*/
declare class QStashWorkflowError extends QstashError {
constructor(message: string);
}
/**
* Raised when the workflow executes a function and aborts
*/
declare class QStashWorkflowAbort extends Error {
stepInfo?: Step;
stepName: string;
constructor(stepName: string, stepInfo?: Step);
}
/**
* Formats an unknown error to match the FailureFunctionPayload format
*
* @param error
* @returns
*/
declare const formatWorkflowError: (error: unknown) => FailureFunctionPayload;
/**
* When the base64 string has unicode characters, atob doesn't decode
* them correctly since it only outputs ASCII characters. Therefore,
* instead of using atob, we properly decode them.
*
* If the decoding into unicode somehow fails, returns the result of atob
*
* https://developer.mozilla.org/en-US/docs/Glossary/Base64#the_unicode_problem
*
* @param base64 encoded string
*/
declare function decodeBase64(base64: string): string;
type AnalyticsConfig = {
name: "helicone";
token: string;
};
type AnalyticsSetup = {
baseURL?: string;
defaultHeaders?: Record<string, string | undefined>;
};
declare const setupAnalytics: (analytics: AnalyticsConfig | undefined, providerApiKey: string, providerBaseUrl?: string, provider?: LLMOwner) => AnalyticsSetup;
declare class EmailProvider extends BaseProvider<"email", EmailOwner> {
readonly apiKind = "email";
readonly batch: boolean;
readonly method = "POST";
constructor(baseUrl: string, token: string, owner: EmailOwner, batch: boolean);
getRoute(): string[];
getHeaders(_options: unknown): Record<string, string>;
onFinish(providerInfo: ProviderInfo, _options: unknown): ProviderInfo;
}
declare const resend: ({ token, batch, }: {
token: string;
batch?: boolean;
}) => EmailProvider;
export { ChatRateLimit, QStashWorkflowAbort, QStashWorkflowError, QstashChatRatelimitError, QstashDailyRatelimitError, QstashEmptyArrayError, QstashError, QstashRatelimitError, RateLimit, decodeBase64, formatWorkflowError, resend, setupAnalytics };