/*! * Copyright (c) 2020 Ville de Montreal. All rights reserved. * Licensed under the MIT license. * See LICENSE file in the project root for full license information. */ import { AxiosAdapter, AxiosRequestConfig, AxiosInstance, AxiosError } from 'axios'; import { IAxiosPlugin } from './IAxiosPlugin'; import { IAxiosPluginImplementation } from './IAxiosPluginImplementation'; export declare const adapterFlag: unique symbol; /** * The plugin context used while processing a request. */ export interface IAxiosPluginContext { target: AxiosInstance | AxiosRequestConfig; plugins: IAxiosPluginImplementation[]; oldAdapter: AxiosAdapter; newAdapter: AxiosAdapter; retries?: number; } /** * Builds a new plugin from its implementation. * @param implementation the plugin callbacks * @returns the returned plugin can be bound to an AxiosRequestConfig * or a new Axios instance. */ export declare function makeAxiosPlugin(implementation: IAxiosPluginImplementation): IAxiosPlugin; export declare function removeAdapter(config: any): any; /** * lets plugin vote to decide if we can retry the request or not * @param ctx the context * @param config the config * @param error the error to evaluate * @returns true if at least one plugin votes for a retry, * false if at least one plugin vote against and no plugin votes for. * Finally, it will return undefined if no plugin casts a vote. */ export declare function pluginErrorPoll(ctx: IAxiosPluginContext, config: AxiosRequestConfig, error: AxiosError): boolean | undefined;