import type { EmailLogger } from '../utils/logger.js'; /** * Custom error for IM token fetch failures */ export declare class TokenFetchError extends Error { readonly attempts: number; readonly lastError: unknown; readonly retryable: boolean; readonly name = "TokenFetchError"; constructor(message: string, attempts: number, lastError: unknown, retryable?: boolean); } /** * Check if an error is retryable */ export declare function isRetryableError(error: any): boolean; /** * Format error for logging */ export declare function formatError(error: unknown): string; /** * Validate parameters for token fetch */ export declare function validateParams(apiKey: string, email: string): void; /** * Validate token API response */ export declare function validateResponse(response: any): void; /** * Fetch IM token once (single attempt, no retry) */ declare function fetchTokenOnce(apiKey: string, email: string, log: EmailLogger): Promise; export { fetchTokenOnce }; /** * Fetch IM token with automatic retry * * @param apiKey - API key (ck_live_xxx format) * @param email - User email address * @param log - Logger instance * @returns IM access token * @throws TokenFetchError if all attempts fail */ export declare function fetchIMToken(apiKey: string, email: string, log: EmailLogger): Promise;