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

index.d.cts 21KB

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