export type APIHeaders = Record; export declare class ApiError extends Error { readonly status: number | undefined; readonly headers: APIHeaders | undefined; readonly error: object | undefined; /** The whole parsed response body, including fields beside `error` like `code` and `reason`. */ readonly body: object | undefined; readonly code: string | null | undefined; readonly param: string | null | undefined; readonly type: string | undefined; constructor(status: number | undefined, error: object | undefined, message: string | undefined, headers: APIHeaders | undefined, body?: object); private static makeMessage; static generate(status: number | undefined, errorResponse: object | undefined, message: string | undefined, headers: APIHeaders | undefined): ApiError; } export declare class ApiConnectionError extends ApiError { readonly status: undefined; constructor({ message, cause }: { message?: string; cause?: Error | undefined; }); } export declare class BadRequestError extends ApiError { readonly status: 400; } export declare class AuthenticationError extends ApiError { readonly status: 401; } export declare class PermissionDeniedError extends ApiError { readonly status: 403; } /** * True when `error` is a 401/403 from the Trigger API (e.g. expired run-scoped PAT on realtime streams). * Uses structural checks so it works even if multiple copies of `@trigger.dev/core` are bundled (subclass `instanceof` can fail). */ export declare function isTriggerRealtimeAuthError(error: unknown): boolean; export declare class NotFoundError extends ApiError { readonly status: 404; } export declare class ConflictError extends ApiError { readonly status: 409; } export declare class UnprocessableEntityError extends ApiError { readonly status: 422; } export declare class RateLimitError extends ApiError { readonly status: 429; get millisecondsUntilReset(): number | undefined; } export declare class InternalServerError extends ApiError { } export declare class ApiSchemaValidationError extends ApiError { readonly status: 200; readonly rawBody: any; constructor({ message, cause, status, rawBody, headers, }: { message?: string; cause?: Error | undefined; status: number; rawBody: any; headers: APIHeaders | undefined; }); } /** * Error thrown when a batch stream completes but the batch was not sealed. * This indicates that not all expected items were received by the server. * The client should retry sending all items, or investigate the mismatch. */ export declare class BatchNotSealedError extends Error { readonly name = "BatchNotSealedError"; /** The batch ID that was not sealed */ readonly batchId: string; /** Number of items currently enqueued on the server */ readonly enqueuedCount: number; /** Number of items expected to complete the batch */ readonly expectedCount: number; /** Number of items accepted in this request */ readonly itemsAccepted: number; /** Number of items deduplicated in this request */ readonly itemsDeduplicated: number; constructor(options: { batchId: string; enqueuedCount: number; expectedCount: number; itemsAccepted: number; itemsDeduplicated: number; }); }