智慧水务管理系统 - 精河县供水工程综合管理平台

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