/** * Configuration types for the Reveal SDK API client */ /** * Request interceptor function type */ export type RequestInterceptor = (config: RequestConfig) => RequestConfig | Promise; /** * Response interceptor function type */ export type ResponseInterceptor = (response: Response) => Response | Promise; /** * Error interceptor function type */ export type ErrorInterceptor = (error: ApiError) => ApiError | Promise; /** * Configuration for individual HTTP requests */ export interface RequestConfig { /** Request URL */ url: string; /** HTTP method */ method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'; /** Request headers */ headers?: Record; /** Request body */ body?: unknown; /** Request timeout in milliseconds */ timeout?: number; /** AbortSignal for cancellation */ signal?: AbortSignal; } /** * Error object for API errors */ export interface ApiError extends Error { /** HTTP status code */ status?: number; /** Response data if available */ data?: unknown; /** Original request configuration */ config?: RequestConfig; } /** * Interceptor configuration */ export interface Interceptors { /** Request interceptors (executed in order) */ request: RequestInterceptor[]; /** Response interceptors (executed in order) */ response: ResponseInterceptor[]; /** Error interceptors (executed in order) */ error: ErrorInterceptor[]; } /** * Configuration options for the Reveal SDK client */ export interface RevealSdkClientConfig { /** * Base URL of the Reveal API server * @example "https://api.example.com" */ hostUrl: string; /** * Default timeout for API requests in milliseconds * @default 30000 (30 seconds) */ timeout?: number; /** * Additional headers to include in all requests */ headers?: Record; /** * Bearer token for authentication * If provided, will be added as "Authorization: Bearer {token}" */ bearerToken?: string; /** * Function to retrieve a bearer token dynamically * Useful for token refresh scenarios * Takes precedence over bearerToken if both are provided */ getBearerToken?: () => string | Promise; /** * Custom request interceptor * Called before each request is sent */ onRequest?: RequestInterceptor; /** * Custom response interceptor * Called after each successful response */ onResponse?: ResponseInterceptor; /** * Custom error interceptor * Called when a request fails */ onError?: ErrorInterceptor; /** * Enable debug logging * @default false */ debug?: boolean; } /** * Progress event for streaming operations */ export interface ProgressEvent { /** Event type */ type: 'start' | 'progress' | 'complete' | 'error'; /** Progress message */ message: string; /** Additional data */ data?: unknown; /** Timestamp */ timestamp: Date; } /** * Loading state for async operations */ export interface LoadingState { /** Whether the operation is currently loading */ isLoading: boolean; /** Progress percentage (0-100) if available */ progress?: number; /** Current operation message */ message?: string; } /** * Result wrapper for API operations */ export interface ApiResult { /** Whether the operation was successful */ success: boolean; /** Result data if successful */ data?: T; /** Error if failed */ error?: ApiError; /** Loading state */ loading: LoadingState; } //# sourceMappingURL=config.d.ts.map