| 1 | type MethodsHeaders = Partial<
|
|---|
| 2 | {
|
|---|
| 3 | [Key in axios.Method as Lowercase<Key>]: AxiosHeaders;
|
|---|
| 4 | } & { common: AxiosHeaders }
|
|---|
| 5 | >;
|
|---|
| 6 |
|
|---|
| 7 | type AxiosHeaderMatcher =
|
|---|
| 8 | | string
|
|---|
| 9 | | RegExp
|
|---|
| 10 | | ((this: AxiosHeaders, value: string, name: string) => boolean);
|
|---|
| 11 |
|
|---|
| 12 | type AxiosHeaderParser = (this: AxiosHeaders, value: axios.AxiosHeaderValue, header: string) => any;
|
|---|
| 13 |
|
|---|
| 14 | type CommonRequestHeadersList =
|
|---|
| 15 | | 'Accept'
|
|---|
| 16 | | 'Content-Length'
|
|---|
| 17 | | 'User-Agent'
|
|---|
| 18 | | 'Content-Encoding'
|
|---|
| 19 | | 'Authorization'
|
|---|
| 20 | | 'Location';
|
|---|
| 21 |
|
|---|
| 22 | type ContentType =
|
|---|
| 23 | | axios.AxiosHeaderValue
|
|---|
| 24 | | 'text/html'
|
|---|
| 25 | | 'text/plain'
|
|---|
| 26 | | 'multipart/form-data'
|
|---|
| 27 | | 'application/json'
|
|---|
| 28 | | 'application/x-www-form-urlencoded'
|
|---|
| 29 | | 'application/octet-stream';
|
|---|
| 30 |
|
|---|
| 31 | type CommonResponseHeadersList =
|
|---|
| 32 | | 'Server'
|
|---|
| 33 | | 'Content-Type'
|
|---|
| 34 | | 'Content-Length'
|
|---|
| 35 | | 'Cache-Control'
|
|---|
| 36 | | 'Content-Encoding';
|
|---|
| 37 |
|
|---|
| 38 | type CommonResponseHeaderKey = CommonResponseHeadersList | Lowercase<CommonResponseHeadersList>;
|
|---|
| 39 |
|
|---|
| 40 | type BrowserProgressEvent = any;
|
|---|
| 41 |
|
|---|
| 42 | declare class AxiosHeaders {
|
|---|
| 43 | constructor(headers?: axios.RawAxiosHeaders | AxiosHeaders | string);
|
|---|
| 44 |
|
|---|
| 45 | [key: string]: any;
|
|---|
| 46 |
|
|---|
| 47 | set(
|
|---|
| 48 | headerName?: string,
|
|---|
| 49 | value?: axios.AxiosHeaderValue,
|
|---|
| 50 | rewrite?: boolean | AxiosHeaderMatcher
|
|---|
| 51 | ): AxiosHeaders;
|
|---|
| 52 | set(headers?: axios.RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean): AxiosHeaders;
|
|---|
| 53 |
|
|---|
| 54 | get(headerName: string, parser: RegExp): RegExpExecArray | null;
|
|---|
| 55 | get(headerName: string, matcher?: true | AxiosHeaderParser): axios.AxiosHeaderValue;
|
|---|
| 56 |
|
|---|
| 57 | has(header: string, matcher?: AxiosHeaderMatcher): boolean;
|
|---|
| 58 |
|
|---|
| 59 | delete(header: string | string[], matcher?: AxiosHeaderMatcher): boolean;
|
|---|
| 60 |
|
|---|
| 61 | clear(matcher?: AxiosHeaderMatcher): boolean;
|
|---|
| 62 |
|
|---|
| 63 | normalize(format: boolean): AxiosHeaders;
|
|---|
| 64 |
|
|---|
| 65 | concat(
|
|---|
| 66 | ...targets: Array<AxiosHeaders | axios.RawAxiosHeaders | string | undefined | null>
|
|---|
| 67 | ): AxiosHeaders;
|
|---|
| 68 |
|
|---|
| 69 | toJSON(asStrings?: boolean): axios.RawAxiosHeaders;
|
|---|
| 70 |
|
|---|
| 71 | static from(thing?: AxiosHeaders | axios.RawAxiosHeaders | string): AxiosHeaders;
|
|---|
| 72 |
|
|---|
| 73 | static accessor(header: string | string[]): AxiosHeaders;
|
|---|
| 74 |
|
|---|
| 75 | static concat(
|
|---|
| 76 | ...targets: Array<AxiosHeaders | axios.RawAxiosHeaders | string | undefined | null>
|
|---|
| 77 | ): AxiosHeaders;
|
|---|
| 78 |
|
|---|
| 79 | setContentType(value: ContentType, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
|---|
| 80 | getContentType(parser?: RegExp): RegExpExecArray | null;
|
|---|
| 81 | getContentType(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
|---|
| 82 | hasContentType(matcher?: AxiosHeaderMatcher): boolean;
|
|---|
| 83 |
|
|---|
| 84 | setContentLength(
|
|---|
| 85 | value: axios.AxiosHeaderValue,
|
|---|
| 86 | rewrite?: boolean | AxiosHeaderMatcher
|
|---|
| 87 | ): AxiosHeaders;
|
|---|
| 88 | getContentLength(parser?: RegExp): RegExpExecArray | null;
|
|---|
| 89 | getContentLength(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
|---|
| 90 | hasContentLength(matcher?: AxiosHeaderMatcher): boolean;
|
|---|
| 91 |
|
|---|
| 92 | setAccept(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
|---|
| 93 | getAccept(parser?: RegExp): RegExpExecArray | null;
|
|---|
| 94 | getAccept(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
|---|
| 95 | hasAccept(matcher?: AxiosHeaderMatcher): boolean;
|
|---|
| 96 |
|
|---|
| 97 | setUserAgent(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
|---|
| 98 | getUserAgent(parser?: RegExp): RegExpExecArray | null;
|
|---|
| 99 | getUserAgent(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
|---|
| 100 | hasUserAgent(matcher?: AxiosHeaderMatcher): boolean;
|
|---|
| 101 |
|
|---|
| 102 | setContentEncoding(
|
|---|
| 103 | value: axios.AxiosHeaderValue,
|
|---|
| 104 | rewrite?: boolean | AxiosHeaderMatcher
|
|---|
| 105 | ): AxiosHeaders;
|
|---|
| 106 | getContentEncoding(parser?: RegExp): RegExpExecArray | null;
|
|---|
| 107 | getContentEncoding(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
|---|
| 108 | hasContentEncoding(matcher?: AxiosHeaderMatcher): boolean;
|
|---|
| 109 |
|
|---|
| 110 | setAuthorization(
|
|---|
| 111 | value: axios.AxiosHeaderValue,
|
|---|
| 112 | rewrite?: boolean | AxiosHeaderMatcher
|
|---|
| 113 | ): AxiosHeaders;
|
|---|
| 114 | getAuthorization(parser?: RegExp): RegExpExecArray | null;
|
|---|
| 115 | getAuthorization(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
|---|
| 116 | hasAuthorization(matcher?: AxiosHeaderMatcher): boolean;
|
|---|
| 117 |
|
|---|
| 118 | getSetCookie(): string[];
|
|---|
| 119 |
|
|---|
| 120 | [Symbol.iterator](): IterableIterator<[string, axios.AxiosHeaderValue]>;
|
|---|
| 121 | }
|
|---|
| 122 |
|
|---|
| 123 | declare class AxiosError<T = unknown, D = any> extends Error {
|
|---|
| 124 | constructor(
|
|---|
| 125 | message?: string,
|
|---|
| 126 | code?: string,
|
|---|
| 127 | config?: axios.InternalAxiosRequestConfig<D>,
|
|---|
| 128 | request?: any,
|
|---|
| 129 | response?: axios.AxiosResponse<T, D>
|
|---|
| 130 | );
|
|---|
| 131 |
|
|---|
| 132 | config?: axios.InternalAxiosRequestConfig<D>;
|
|---|
| 133 | code?: string;
|
|---|
| 134 | request?: any;
|
|---|
| 135 | response?: axios.AxiosResponse<T, D>;
|
|---|
| 136 | isAxiosError: boolean;
|
|---|
| 137 | status?: number;
|
|---|
| 138 | toJSON: () => object;
|
|---|
| 139 | cause?: Error;
|
|---|
| 140 | event?: BrowserProgressEvent;
|
|---|
| 141 | static from<T = unknown, D = any>(
|
|---|
| 142 | error: Error | unknown,
|
|---|
| 143 | code?: string,
|
|---|
| 144 | config?: axios.InternalAxiosRequestConfig<D>,
|
|---|
| 145 | request?: any,
|
|---|
| 146 | response?: axios.AxiosResponse<T, D>,
|
|---|
| 147 | customProps?: object
|
|---|
| 148 | ): AxiosError<T, D>;
|
|---|
| 149 | static readonly ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
|
|---|
| 150 | static readonly ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
|
|---|
| 151 | static readonly ERR_BAD_OPTION = 'ERR_BAD_OPTION';
|
|---|
| 152 | static readonly ERR_NETWORK = 'ERR_NETWORK';
|
|---|
| 153 | static readonly ERR_DEPRECATED = 'ERR_DEPRECATED';
|
|---|
| 154 | static readonly ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
|
|---|
| 155 | static readonly ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
|
|---|
| 156 | static readonly ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
|
|---|
| 157 | static readonly ERR_INVALID_URL = 'ERR_INVALID_URL';
|
|---|
| 158 | static readonly ERR_CANCELED = 'ERR_CANCELED';
|
|---|
| 159 | static readonly ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
|
|---|
| 160 | static readonly ECONNABORTED = 'ECONNABORTED';
|
|---|
| 161 | static readonly ECONNREFUSED = 'ECONNREFUSED';
|
|---|
| 162 | static readonly ETIMEDOUT = 'ETIMEDOUT';
|
|---|
| 163 | }
|
|---|
| 164 |
|
|---|
| 165 | declare class CanceledError<T> extends AxiosError<T> {}
|
|---|
| 166 |
|
|---|
| 167 | declare class Axios {
|
|---|
| 168 | constructor(config?: axios.AxiosRequestConfig);
|
|---|
| 169 | defaults: axios.AxiosDefaults;
|
|---|
| 170 | interceptors: {
|
|---|
| 171 | request: axios.AxiosInterceptorManager<axios.InternalAxiosRequestConfig>;
|
|---|
| 172 | response: axios.AxiosInterceptorManager<axios.AxiosResponse>;
|
|---|
| 173 | };
|
|---|
| 174 | getUri(config?: axios.AxiosRequestConfig): string;
|
|---|
| 175 | request<T = any, R = axios.AxiosResponse<T>, D = any>(
|
|---|
| 176 | config: axios.AxiosRequestConfig<D>
|
|---|
| 177 | ): Promise<R>;
|
|---|
| 178 | get<T = any, R = axios.AxiosResponse<T>, D = any>(
|
|---|
| 179 | url: string,
|
|---|
| 180 | config?: axios.AxiosRequestConfig<D>
|
|---|
| 181 | ): Promise<R>;
|
|---|
| 182 | delete<T = any, R = axios.AxiosResponse<T>, D = any>(
|
|---|
| 183 | url: string,
|
|---|
| 184 | config?: axios.AxiosRequestConfig<D>
|
|---|
| 185 | ): Promise<R>;
|
|---|
| 186 | head<T = any, R = axios.AxiosResponse<T>, D = any>(
|
|---|
| 187 | url: string,
|
|---|
| 188 | config?: axios.AxiosRequestConfig<D>
|
|---|
| 189 | ): Promise<R>;
|
|---|
| 190 | options<T = any, R = axios.AxiosResponse<T>, D = any>(
|
|---|
| 191 | url: string,
|
|---|
| 192 | config?: axios.AxiosRequestConfig<D>
|
|---|
| 193 | ): Promise<R>;
|
|---|
| 194 | post<T = any, R = axios.AxiosResponse<T>, D = any>(
|
|---|
| 195 | url: string,
|
|---|
| 196 | data?: D,
|
|---|
| 197 | config?: axios.AxiosRequestConfig<D>
|
|---|
| 198 | ): Promise<R>;
|
|---|
| 199 | put<T = any, R = axios.AxiosResponse<T>, D = any>(
|
|---|
| 200 | url: string,
|
|---|
| 201 | data?: D,
|
|---|
| 202 | config?: axios.AxiosRequestConfig<D>
|
|---|
| 203 | ): Promise<R>;
|
|---|
| 204 | patch<T = any, R = axios.AxiosResponse<T>, D = any>(
|
|---|
| 205 | url: string,
|
|---|
| 206 | data?: D,
|
|---|
| 207 | config?: axios.AxiosRequestConfig<D>
|
|---|
| 208 | ): Promise<R>;
|
|---|
| 209 | postForm<T = any, R = axios.AxiosResponse<T>, D = any>(
|
|---|
| 210 | url: string,
|
|---|
| 211 | data?: D,
|
|---|
| 212 | config?: axios.AxiosRequestConfig<D>
|
|---|
| 213 | ): Promise<R>;
|
|---|
| 214 | putForm<T = any, R = axios.AxiosResponse<T>, D = any>(
|
|---|
| 215 | url: string,
|
|---|
| 216 | data?: D,
|
|---|
| 217 | config?: axios.AxiosRequestConfig<D>
|
|---|
| 218 | ): Promise<R>;
|
|---|
| 219 | patchForm<T = any, R = axios.AxiosResponse<T>, D = any>(
|
|---|
| 220 | url: string,
|
|---|
| 221 | data?: D,
|
|---|
| 222 | config?: axios.AxiosRequestConfig<D>
|
|---|
| 223 | ): Promise<R>;
|
|---|
| 224 | query<T = any, R = axios.AxiosResponse<T>, D = any>(
|
|---|
| 225 | url: string,
|
|---|
| 226 | data?: D,
|
|---|
| 227 | config?: axios.AxiosRequestConfig<D>
|
|---|
| 228 | ): Promise<R>;
|
|---|
| 229 | }
|
|---|
| 230 |
|
|---|
| 231 | declare enum HttpStatusCode {
|
|---|
| 232 | Continue = 100,
|
|---|
| 233 | SwitchingProtocols = 101,
|
|---|
| 234 | Processing = 102,
|
|---|
| 235 | EarlyHints = 103,
|
|---|
| 236 | Ok = 200,
|
|---|
| 237 | Created = 201,
|
|---|
| 238 | Accepted = 202,
|
|---|
| 239 | NonAuthoritativeInformation = 203,
|
|---|
| 240 | NoContent = 204,
|
|---|
| 241 | ResetContent = 205,
|
|---|
| 242 | PartialContent = 206,
|
|---|
| 243 | MultiStatus = 207,
|
|---|
| 244 | AlreadyReported = 208,
|
|---|
| 245 | ImUsed = 226,
|
|---|
| 246 | MultipleChoices = 300,
|
|---|
| 247 | MovedPermanently = 301,
|
|---|
| 248 | Found = 302,
|
|---|
| 249 | SeeOther = 303,
|
|---|
| 250 | NotModified = 304,
|
|---|
| 251 | UseProxy = 305,
|
|---|
| 252 | Unused = 306,
|
|---|
| 253 | TemporaryRedirect = 307,
|
|---|
| 254 | PermanentRedirect = 308,
|
|---|
| 255 | BadRequest = 400,
|
|---|
| 256 | Unauthorized = 401,
|
|---|
| 257 | PaymentRequired = 402,
|
|---|
| 258 | Forbidden = 403,
|
|---|
| 259 | NotFound = 404,
|
|---|
| 260 | MethodNotAllowed = 405,
|
|---|
| 261 | NotAcceptable = 406,
|
|---|
| 262 | ProxyAuthenticationRequired = 407,
|
|---|
| 263 | RequestTimeout = 408,
|
|---|
| 264 | Conflict = 409,
|
|---|
| 265 | Gone = 410,
|
|---|
| 266 | LengthRequired = 411,
|
|---|
| 267 | PreconditionFailed = 412,
|
|---|
| 268 | PayloadTooLarge = 413,
|
|---|
| 269 | UriTooLong = 414,
|
|---|
| 270 | UnsupportedMediaType = 415,
|
|---|
| 271 | RangeNotSatisfiable = 416,
|
|---|
| 272 | ExpectationFailed = 417,
|
|---|
| 273 | ImATeapot = 418,
|
|---|
| 274 | MisdirectedRequest = 421,
|
|---|
| 275 | UnprocessableEntity = 422,
|
|---|
| 276 | Locked = 423,
|
|---|
| 277 | FailedDependency = 424,
|
|---|
| 278 | TooEarly = 425,
|
|---|
| 279 | UpgradeRequired = 426,
|
|---|
| 280 | PreconditionRequired = 428,
|
|---|
| 281 | TooManyRequests = 429,
|
|---|
| 282 | RequestHeaderFieldsTooLarge = 431,
|
|---|
| 283 | UnavailableForLegalReasons = 451,
|
|---|
| 284 | InternalServerError = 500,
|
|---|
| 285 | NotImplemented = 501,
|
|---|
| 286 | BadGateway = 502,
|
|---|
| 287 | ServiceUnavailable = 503,
|
|---|
| 288 | GatewayTimeout = 504,
|
|---|
| 289 | HttpVersionNotSupported = 505,
|
|---|
| 290 | VariantAlsoNegotiates = 506,
|
|---|
| 291 | InsufficientStorage = 507,
|
|---|
| 292 | LoopDetected = 508,
|
|---|
| 293 | NotExtended = 510,
|
|---|
| 294 | NetworkAuthenticationRequired = 511,
|
|---|
| 295 | }
|
|---|
| 296 |
|
|---|
| 297 | type InternalAxiosError<T = unknown, D = any> = AxiosError<T, D>;
|
|---|
| 298 |
|
|---|
| 299 | declare namespace axios {
|
|---|
| 300 | type AxiosError<T = unknown, D = any> = InternalAxiosError<T, D>;
|
|---|
| 301 |
|
|---|
| 302 | interface RawAxiosHeaders {
|
|---|
| 303 | [key: string]: AxiosHeaderValue;
|
|---|
| 304 | }
|
|---|
| 305 |
|
|---|
| 306 | type RawAxiosRequestHeaders = Partial<
|
|---|
| 307 | RawAxiosHeaders & {
|
|---|
| 308 | [Key in CommonRequestHeadersList]: AxiosHeaderValue;
|
|---|
| 309 | } & {
|
|---|
| 310 | 'Content-Type': ContentType;
|
|---|
| 311 | }
|
|---|
| 312 | >;
|
|---|
| 313 |
|
|---|
| 314 | type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders;
|
|---|
| 315 |
|
|---|
| 316 | type AxiosHeaderValue = AxiosHeaders | string | string[] | number | boolean | null;
|
|---|
| 317 |
|
|---|
| 318 | type RawCommonResponseHeaders = {
|
|---|
| 319 | [Key in CommonResponseHeaderKey]: AxiosHeaderValue;
|
|---|
| 320 | } & {
|
|---|
| 321 | 'set-cookie': string[];
|
|---|
| 322 | };
|
|---|
| 323 |
|
|---|
| 324 | type RawAxiosResponseHeaders = Partial<RawAxiosHeaders & RawCommonResponseHeaders>;
|
|---|
| 325 |
|
|---|
| 326 | type AxiosResponseHeaders = RawAxiosResponseHeaders & AxiosHeaders;
|
|---|
| 327 |
|
|---|
| 328 | interface AxiosRequestTransformer {
|
|---|
| 329 | (this: InternalAxiosRequestConfig, data: any, headers: AxiosRequestHeaders): any;
|
|---|
| 330 | }
|
|---|
| 331 |
|
|---|
| 332 | interface AxiosResponseTransformer {
|
|---|
| 333 | (
|
|---|
| 334 | this: InternalAxiosRequestConfig,
|
|---|
| 335 | data: any,
|
|---|
| 336 | headers: AxiosResponseHeaders,
|
|---|
| 337 | status?: number
|
|---|
| 338 | ): any;
|
|---|
| 339 | }
|
|---|
| 340 |
|
|---|
| 341 | interface AxiosAdapter {
|
|---|
| 342 | (config: InternalAxiosRequestConfig): AxiosPromise;
|
|---|
| 343 | }
|
|---|
| 344 |
|
|---|
| 345 | interface AxiosBasicCredentials {
|
|---|
| 346 | username: string;
|
|---|
| 347 | password: string;
|
|---|
| 348 | }
|
|---|
| 349 |
|
|---|
| 350 | interface AxiosProxyConfig {
|
|---|
| 351 | host: string;
|
|---|
| 352 | port: number;
|
|---|
| 353 | auth?: AxiosBasicCredentials;
|
|---|
| 354 | protocol?: string;
|
|---|
| 355 | }
|
|---|
| 356 |
|
|---|
| 357 | type UppercaseMethod =
|
|---|
| 358 | | 'GET'
|
|---|
| 359 | | 'DELETE'
|
|---|
| 360 | | 'HEAD'
|
|---|
| 361 | | 'OPTIONS'
|
|---|
| 362 | | 'POST'
|
|---|
| 363 | | 'PUT'
|
|---|
| 364 | | 'PATCH'
|
|---|
| 365 | | 'PURGE'
|
|---|
| 366 | | 'LINK'
|
|---|
| 367 | | 'UNLINK'
|
|---|
| 368 | | 'QUERY';
|
|---|
| 369 |
|
|---|
| 370 | type Method = (UppercaseMethod | Lowercase<UppercaseMethod>) & {};
|
|---|
| 371 |
|
|---|
| 372 | type ResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream' | 'formdata';
|
|---|
| 373 |
|
|---|
| 374 | type UppercaseResponseEncoding =
|
|---|
| 375 | | 'ASCII'
|
|---|
| 376 | | 'ANSI'
|
|---|
| 377 | | 'BINARY'
|
|---|
| 378 | | 'BASE64'
|
|---|
| 379 | | 'BASE64URL'
|
|---|
| 380 | | 'HEX'
|
|---|
| 381 | | 'LATIN1'
|
|---|
| 382 | | 'UCS-2'
|
|---|
| 383 | | 'UCS2'
|
|---|
| 384 | | 'UTF-8'
|
|---|
| 385 | | 'UTF8'
|
|---|
| 386 | | 'UTF16LE';
|
|---|
| 387 |
|
|---|
| 388 | type responseEncoding = (UppercaseResponseEncoding | Lowercase<UppercaseResponseEncoding>) & {};
|
|---|
| 389 |
|
|---|
| 390 | interface TransitionalOptions {
|
|---|
| 391 | silentJSONParsing?: boolean;
|
|---|
| 392 | forcedJSONParsing?: boolean;
|
|---|
| 393 | clarifyTimeoutError?: boolean;
|
|---|
| 394 | legacyInterceptorReqResOrdering?: boolean;
|
|---|
| 395 | }
|
|---|
| 396 |
|
|---|
| 397 | interface GenericAbortSignal {
|
|---|
| 398 | readonly aborted: boolean;
|
|---|
| 399 | onabort?: ((...args: any) => any) | null;
|
|---|
| 400 | addEventListener?: (...args: any) => any;
|
|---|
| 401 | removeEventListener?: (...args: any) => any;
|
|---|
| 402 | }
|
|---|
| 403 |
|
|---|
| 404 | interface FormDataVisitorHelpers {
|
|---|
| 405 | defaultVisitor: SerializerVisitor;
|
|---|
| 406 | convertValue: (value: any) => any;
|
|---|
| 407 | isVisitable: (value: any) => boolean;
|
|---|
| 408 | }
|
|---|
| 409 |
|
|---|
| 410 | interface SerializerVisitor {
|
|---|
| 411 | (
|
|---|
| 412 | this: GenericFormData,
|
|---|
| 413 | value: any,
|
|---|
| 414 | key: string | number,
|
|---|
| 415 | path: null | Array<string | number>,
|
|---|
| 416 | helpers: FormDataVisitorHelpers
|
|---|
| 417 | ): boolean;
|
|---|
| 418 | }
|
|---|
| 419 |
|
|---|
| 420 | interface SerializerOptions {
|
|---|
| 421 | visitor?: SerializerVisitor;
|
|---|
| 422 | dots?: boolean;
|
|---|
| 423 | metaTokens?: boolean;
|
|---|
| 424 | indexes?: boolean | null;
|
|---|
| 425 | }
|
|---|
| 426 |
|
|---|
| 427 | // tslint:disable-next-line
|
|---|
| 428 | interface FormSerializerOptions extends SerializerOptions {}
|
|---|
| 429 |
|
|---|
| 430 | interface ParamEncoder {
|
|---|
| 431 | (value: any, defaultEncoder: (value: any) => any): any;
|
|---|
| 432 | }
|
|---|
| 433 |
|
|---|
| 434 | interface CustomParamsSerializer {
|
|---|
| 435 | (params: Record<string, any>, options?: ParamsSerializerOptions): string;
|
|---|
| 436 | }
|
|---|
| 437 |
|
|---|
| 438 | interface ParamsSerializerOptions extends SerializerOptions {
|
|---|
| 439 | encode?: ParamEncoder;
|
|---|
| 440 | serialize?: CustomParamsSerializer;
|
|---|
| 441 | }
|
|---|
| 442 |
|
|---|
| 443 | type MaxUploadRate = number;
|
|---|
| 444 |
|
|---|
| 445 | type MaxDownloadRate = number;
|
|---|
| 446 |
|
|---|
| 447 | interface AxiosProgressEvent {
|
|---|
| 448 | loaded: number;
|
|---|
| 449 | total?: number;
|
|---|
| 450 | progress?: number;
|
|---|
| 451 | bytes: number;
|
|---|
| 452 | rate?: number;
|
|---|
| 453 | estimated?: number;
|
|---|
| 454 | upload?: boolean;
|
|---|
| 455 | download?: boolean;
|
|---|
| 456 | event?: BrowserProgressEvent;
|
|---|
| 457 | lengthComputable: boolean;
|
|---|
| 458 | }
|
|---|
| 459 |
|
|---|
| 460 | type Milliseconds = number;
|
|---|
| 461 |
|
|---|
| 462 | type AxiosAdapterName = 'fetch' | 'xhr' | 'http' | (string & {});
|
|---|
| 463 |
|
|---|
| 464 | type AxiosAdapterConfig = AxiosAdapter | AxiosAdapterName;
|
|---|
| 465 |
|
|---|
| 466 | type AddressFamily = 4 | 6 | undefined;
|
|---|
| 467 |
|
|---|
| 468 | interface LookupAddressEntry {
|
|---|
| 469 | address: string;
|
|---|
| 470 | family?: AddressFamily;
|
|---|
| 471 | }
|
|---|
| 472 |
|
|---|
| 473 | type LookupAddress = string | LookupAddressEntry;
|
|---|
| 474 |
|
|---|
| 475 | interface AxiosRequestConfig<D = any> {
|
|---|
| 476 | url?: string;
|
|---|
| 477 | method?: Method | string;
|
|---|
| 478 | baseURL?: string;
|
|---|
| 479 | allowAbsoluteUrls?: boolean;
|
|---|
| 480 | transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[];
|
|---|
| 481 | transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[];
|
|---|
| 482 | headers?: (RawAxiosRequestHeaders & MethodsHeaders) | AxiosHeaders;
|
|---|
| 483 | params?: any;
|
|---|
| 484 | paramsSerializer?: ParamsSerializerOptions | CustomParamsSerializer;
|
|---|
| 485 | data?: D;
|
|---|
| 486 | timeout?: Milliseconds;
|
|---|
| 487 | timeoutErrorMessage?: string;
|
|---|
| 488 | withCredentials?: boolean;
|
|---|
| 489 | adapter?: AxiosAdapterConfig | AxiosAdapterConfig[];
|
|---|
| 490 | auth?: AxiosBasicCredentials;
|
|---|
| 491 | responseType?: ResponseType;
|
|---|
| 492 | responseEncoding?: responseEncoding | string;
|
|---|
| 493 | xsrfCookieName?: string;
|
|---|
| 494 | xsrfHeaderName?: string;
|
|---|
| 495 | onUploadProgress?: (progressEvent: AxiosProgressEvent) => void;
|
|---|
| 496 | onDownloadProgress?: (progressEvent: AxiosProgressEvent) => void;
|
|---|
| 497 | maxContentLength?: number;
|
|---|
| 498 | validateStatus?: ((status: number) => boolean) | null;
|
|---|
| 499 | maxBodyLength?: number;
|
|---|
| 500 | maxRedirects?: number;
|
|---|
| 501 | maxRate?: number | [MaxUploadRate, MaxDownloadRate];
|
|---|
| 502 | beforeRedirect?: (
|
|---|
| 503 | options: Record<string, any>,
|
|---|
| 504 | responseDetails: { headers: Record<string, string>; statusCode: HttpStatusCode },
|
|---|
| 505 | requestDetails: { headers: Record<string, string>; url: string; method: string },
|
|---|
| 506 | ) => void;
|
|---|
| 507 | socketPath?: string | null;
|
|---|
| 508 | allowedSocketPaths?: string | string[] | null;
|
|---|
| 509 | transport?: any;
|
|---|
| 510 | httpAgent?: any;
|
|---|
| 511 | httpsAgent?: any;
|
|---|
| 512 | proxy?: AxiosProxyConfig | false;
|
|---|
| 513 | cancelToken?: CancelToken | undefined;
|
|---|
| 514 | decompress?: boolean;
|
|---|
| 515 | transitional?: TransitionalOptions;
|
|---|
| 516 | signal?: GenericAbortSignal;
|
|---|
| 517 | insecureHTTPParser?: boolean;
|
|---|
| 518 | env?: {
|
|---|
| 519 | FormData?: new (...args: any[]) => object;
|
|---|
| 520 | fetch?: (input: URL | Request | string, init?: RequestInit) => Promise<Response>;
|
|---|
| 521 | Request?: new (input: URL | Request | string, init?: RequestInit) => Request;
|
|---|
| 522 | Response?: new (
|
|---|
| 523 | body?: ArrayBuffer | ArrayBufferView | Blob | FormData | URLSearchParams | string | null,
|
|---|
| 524 | init?: ResponseInit
|
|---|
| 525 | ) => Response;
|
|---|
| 526 | };
|
|---|
| 527 | formSerializer?: FormSerializerOptions;
|
|---|
| 528 | family?: AddressFamily;
|
|---|
| 529 | lookup?:
|
|---|
| 530 | | ((
|
|---|
| 531 | hostname: string,
|
|---|
| 532 | options: object,
|
|---|
| 533 | cb: (
|
|---|
| 534 | err: Error | null,
|
|---|
| 535 | address: LookupAddress | LookupAddress[],
|
|---|
| 536 | family?: AddressFamily
|
|---|
| 537 | ) => void
|
|---|
| 538 | ) => void)
|
|---|
| 539 | | ((
|
|---|
| 540 | hostname: string,
|
|---|
| 541 | options: object
|
|---|
| 542 | ) => Promise<
|
|---|
| 543 | | [address: LookupAddressEntry | LookupAddressEntry[], family?: AddressFamily]
|
|---|
| 544 | | LookupAddress
|
|---|
| 545 | >);
|
|---|
| 546 | withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined);
|
|---|
| 547 | parseReviver?: (this: any, key: string, value: any, context?: { source?: string }) => any;
|
|---|
| 548 | fetchOptions?:
|
|---|
| 549 | | Omit<RequestInit, 'body' | 'headers' | 'method' | 'signal'>
|
|---|
| 550 | | Record<string, any>;
|
|---|
| 551 | httpVersion?: 1 | 2;
|
|---|
| 552 | http2Options?: Record<string, any> & {
|
|---|
| 553 | sessionTimeout?: number;
|
|---|
| 554 | };
|
|---|
| 555 | formDataHeaderPolicy?: 'legacy' | 'content-only';
|
|---|
| 556 | redact?: string[];
|
|---|
| 557 | }
|
|---|
| 558 |
|
|---|
| 559 | // Alias
|
|---|
| 560 | type RawAxiosRequestConfig<D = any> = AxiosRequestConfig<D>;
|
|---|
| 561 |
|
|---|
| 562 | interface InternalAxiosRequestConfig<D = any> extends AxiosRequestConfig<D> {
|
|---|
| 563 | headers: AxiosRequestHeaders;
|
|---|
| 564 | }
|
|---|
| 565 |
|
|---|
| 566 | interface HeadersDefaults {
|
|---|
| 567 | common: RawAxiosRequestHeaders;
|
|---|
| 568 | delete: RawAxiosRequestHeaders;
|
|---|
| 569 | get: RawAxiosRequestHeaders;
|
|---|
| 570 | head: RawAxiosRequestHeaders;
|
|---|
| 571 | post: RawAxiosRequestHeaders;
|
|---|
| 572 | put: RawAxiosRequestHeaders;
|
|---|
| 573 | patch: RawAxiosRequestHeaders;
|
|---|
| 574 | options?: RawAxiosRequestHeaders;
|
|---|
| 575 | purge?: RawAxiosRequestHeaders;
|
|---|
| 576 | link?: RawAxiosRequestHeaders;
|
|---|
| 577 | unlink?: RawAxiosRequestHeaders;
|
|---|
| 578 | query?: RawAxiosRequestHeaders;
|
|---|
| 579 | }
|
|---|
| 580 |
|
|---|
| 581 | interface AxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {
|
|---|
| 582 | headers: HeadersDefaults;
|
|---|
| 583 | }
|
|---|
| 584 |
|
|---|
| 585 | interface CreateAxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {
|
|---|
| 586 | headers?: RawAxiosRequestHeaders | AxiosHeaders | Partial<HeadersDefaults>;
|
|---|
| 587 | }
|
|---|
| 588 |
|
|---|
| 589 | interface AxiosResponse<T = any, D = any, H = {}> {
|
|---|
| 590 | data: T;
|
|---|
| 591 | status: number;
|
|---|
| 592 | statusText: string;
|
|---|
| 593 | headers: (H & RawAxiosResponseHeaders) | AxiosResponseHeaders;
|
|---|
| 594 | config: InternalAxiosRequestConfig<D>;
|
|---|
| 595 | request?: any;
|
|---|
| 596 | }
|
|---|
| 597 |
|
|---|
| 598 | type AxiosPromise<T = any> = Promise<AxiosResponse<T>>;
|
|---|
| 599 |
|
|---|
| 600 | interface CancelStatic {
|
|---|
| 601 | new (message?: string): Cancel;
|
|---|
| 602 | }
|
|---|
| 603 |
|
|---|
| 604 | interface Cancel {
|
|---|
| 605 | message: string | undefined;
|
|---|
| 606 | }
|
|---|
| 607 |
|
|---|
| 608 | interface Canceler {
|
|---|
| 609 | (message?: string, config?: AxiosRequestConfig, request?: any): void;
|
|---|
| 610 | }
|
|---|
| 611 |
|
|---|
| 612 | interface CancelTokenStatic {
|
|---|
| 613 | new (executor: (cancel: Canceler) => void): CancelToken;
|
|---|
| 614 | source(): CancelTokenSource;
|
|---|
| 615 | }
|
|---|
| 616 |
|
|---|
| 617 | interface CancelToken {
|
|---|
| 618 | promise: Promise<Cancel>;
|
|---|
| 619 | reason?: Cancel;
|
|---|
| 620 | throwIfRequested(): void;
|
|---|
| 621 | }
|
|---|
| 622 |
|
|---|
| 623 | interface CancelTokenSource {
|
|---|
| 624 | token: CancelToken;
|
|---|
| 625 | cancel: Canceler;
|
|---|
| 626 | }
|
|---|
| 627 |
|
|---|
| 628 | interface AxiosInterceptorOptions {
|
|---|
| 629 | synchronous?: boolean;
|
|---|
| 630 | runWhen?: ((config: InternalAxiosRequestConfig) => boolean) | null;
|
|---|
| 631 | }
|
|---|
| 632 |
|
|---|
| 633 | type AxiosInterceptorFulfilled<T> = (value: T) => T | Promise<T>;
|
|---|
| 634 | type AxiosInterceptorRejected = (error: any) => any;
|
|---|
| 635 |
|
|---|
| 636 | type AxiosRequestInterceptorUse<T> = (
|
|---|
| 637 | onFulfilled?: AxiosInterceptorFulfilled<T> | null,
|
|---|
| 638 | onRejected?: AxiosInterceptorRejected | null,
|
|---|
| 639 | options?: AxiosInterceptorOptions
|
|---|
| 640 | ) => number;
|
|---|
| 641 |
|
|---|
| 642 | type AxiosResponseInterceptorUse<T> = (
|
|---|
| 643 | onFulfilled?: AxiosInterceptorFulfilled<T> | null,
|
|---|
| 644 | onRejected?: AxiosInterceptorRejected | null
|
|---|
| 645 | ) => number;
|
|---|
| 646 |
|
|---|
| 647 | interface AxiosInterceptorHandler<T> {
|
|---|
| 648 | fulfilled: AxiosInterceptorFulfilled<T>;
|
|---|
| 649 | rejected?: AxiosInterceptorRejected;
|
|---|
| 650 | synchronous: boolean;
|
|---|
| 651 | runWhen?: ((config: InternalAxiosRequestConfig) => boolean) | null;
|
|---|
| 652 | }
|
|---|
| 653 |
|
|---|
| 654 | interface AxiosInterceptorManager<V> {
|
|---|
| 655 | use: V extends AxiosResponse ? AxiosResponseInterceptorUse<V> : AxiosRequestInterceptorUse<V>;
|
|---|
| 656 | eject(id: number): void;
|
|---|
| 657 | clear(): void;
|
|---|
| 658 | handlers?: Array<AxiosInterceptorHandler<V>>;
|
|---|
| 659 | }
|
|---|
| 660 |
|
|---|
| 661 | interface AxiosInstance extends Axios {
|
|---|
| 662 | <T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D>): Promise<R>;
|
|---|
| 663 | <T = any, R = AxiosResponse<T>, D = any>(
|
|---|
| 664 | url: string,
|
|---|
| 665 | config?: AxiosRequestConfig<D>
|
|---|
| 666 | ): Promise<R>;
|
|---|
| 667 |
|
|---|
| 668 | create(config?: CreateAxiosDefaults): AxiosInstance;
|
|---|
| 669 | defaults: Omit<AxiosDefaults, 'headers'> & {
|
|---|
| 670 | headers: HeadersDefaults & {
|
|---|
| 671 | [key: string]: AxiosHeaderValue;
|
|---|
| 672 | };
|
|---|
| 673 | };
|
|---|
| 674 | }
|
|---|
| 675 |
|
|---|
| 676 | interface GenericFormData {
|
|---|
| 677 | append(name: string, value: any, options?: any): any;
|
|---|
| 678 | }
|
|---|
| 679 |
|
|---|
| 680 | interface GenericHTMLFormElement {
|
|---|
| 681 | name: string;
|
|---|
| 682 | method: string;
|
|---|
| 683 | submit(): void;
|
|---|
| 684 | }
|
|---|
| 685 |
|
|---|
| 686 | interface AxiosStatic extends AxiosInstance {
|
|---|
| 687 | Cancel: CancelStatic;
|
|---|
| 688 | CancelToken: CancelTokenStatic;
|
|---|
| 689 | Axios: typeof Axios;
|
|---|
| 690 | AxiosError: typeof AxiosError;
|
|---|
| 691 | CanceledError: typeof CanceledError;
|
|---|
| 692 | HttpStatusCode: typeof HttpStatusCode;
|
|---|
| 693 | readonly VERSION: string;
|
|---|
| 694 | isCancel(value: any): value is Cancel;
|
|---|
| 695 | all<T>(values: Array<T | Promise<T>>): Promise<T[]>;
|
|---|
| 696 | spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
|
|---|
| 697 | isAxiosError<T = any, D = any>(payload: any): payload is AxiosError<T, D>;
|
|---|
| 698 | toFormData(
|
|---|
| 699 | sourceObj: object,
|
|---|
| 700 | targetFormData?: GenericFormData,
|
|---|
| 701 | options?: FormSerializerOptions
|
|---|
| 702 | ): GenericFormData;
|
|---|
| 703 | formToJSON(form: GenericFormData | GenericHTMLFormElement): object;
|
|---|
| 704 | getAdapter(adapters: AxiosAdapterConfig | AxiosAdapterConfig[] | undefined): AxiosAdapter;
|
|---|
| 705 | AxiosHeaders: typeof AxiosHeaders;
|
|---|
| 706 | mergeConfig<D = any>(
|
|---|
| 707 | config1: AxiosRequestConfig<D>,
|
|---|
| 708 | config2: AxiosRequestConfig<D>
|
|---|
| 709 | ): AxiosRequestConfig<D>;
|
|---|
| 710 | }
|
|---|
| 711 | }
|
|---|
| 712 |
|
|---|
| 713 | declare const axios: axios.AxiosStatic;
|
|---|
| 714 |
|
|---|
| 715 | export = axios;
|
|---|