UNPKG

@altostra/core

Version:

Core library for shared types and logic

16 lines (15 loc) 662 B
import type { Maybe } from "../../common/Maybe"; import type { AxiosError } from 'axios'; import type { IAxiosRetryConfig } from 'axios-retry'; export declare type RetryCondition = Required<IAxiosRetryConfig>['retryCondition']; export declare type RetryConditionOverride = (err: AxiosError) => Maybe<boolean>; export declare class OverridableRetryCondition { #private; constructor(retryCondition?: RetryCondition); readonly retryCondition: RetryCondition; withOverride<T>({ override, action, }: WithOverrideOptions<T>): Promise<T>; } export interface WithOverrideOptions<T> { override: RetryConditionOverride; action: () => Promise<T>; }