@wiajs/req 1.7.16 → 1.7.17

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