/**
 * Defines the options for the retry mechanism.
 */
export interface RetryOptions {
    /**
     * The maximum number of retry attempts.
     * Defaults to 3.
     */
    retries?: number;
    /**
     * The delay in milliseconds before the next retry.
     * Can be a fixed number or a function that returns a number (e.g., for exponential backoff).
     * Defaults to 1000ms.
     */
    delayMs?: number | ((attempt: number) => number);
    /**
     * An optional function that determines if a retry should be attempted based on the error.
     * If not provided, all errors will trigger a retry up to the maximum number of retries.
     * @param error The error that occurred.
     * @returns True if a retry should be attempted, false otherwise.
     */
    shouldRetry?: (error: Error) => boolean;
}
/**
 * Calculates an exponential backoff delay for retry attempts.
 * The delay doubles with each attempt.
 *
 * @param attempt The current retry attempt number (should be 1-indexed).
 * @param initialDelay The initial delay in milliseconds. Defaults to 1000ms.
 * @returns The calculated delay in milliseconds.
 */
export declare function exponentialBackoffDelay(attempt: number, initialDelay?: number): number;
/**
 * Checks if the API error should be retried based on its status code.
 * If the status code is 404, it returns false (do not retry).
 * For other status codes, it returns true (retry).
 * @param error The error to check.
 */
export declare function shouldRetryApiError(error: Error): boolean;
/**
 * Executes an asynchronous operation with a retry mechanism.
 *
 * @param operation A function that returns a Promise to be executed.
 * @param options Optional retry configurations.
 * @returns A Promise that resolves with the result of the operation or rejects if all retries fail.
 * @example
 * ```typescript
 * import { shouldRetryApiError, exponentialBackoffDelay, retry } from '../data/retry_logic.js'
 *
 * override async create(data: Partial<IUser>): Promise<IUser> {
 *   const operation = async (): Promise<UserData> => {
 *     // ... perform API call or other async operation
 *   }
 *   const retryOptions: RetryOptions = {
 *     retries: 5,
 *     delayMs: exponentialBackoffDelay,
 *     shouldRetry: shouldRetryApiError,
 *   }
 *   const data = await retry(operation, retryOptions)
 *   this.dispatchEvent(new CustomEvent('data-changed', { detail: data }))
 *   return data
 * }
 * ```
 */
export declare function retry<R>(operation: () => Promise<R>, options?: RetryOptions): Promise<R>;
//# sourceMappingURL=retry_logic.d.ts.map