@delta-comic/request 1.3.0 → 1.3.1

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.
@@ -0,0 +1,8 @@
1
+ export declare class SmartAbortController implements AbortController {
2
+ private _controller;
3
+ private mitt;
4
+ get signal(): AbortSignal;
5
+ abort(reason?: any): void;
6
+ onAbort(fn: () => any): () => void;
7
+ onAbortOnce(fn: () => any): void;
8
+ }
@@ -0,0 +1,39 @@
1
+ import { AxiosError, AxiosResponse, AxiosInstance, CreateAxiosDefaults, AxiosRequestConfig } from 'axios';
2
+ export declare const checkType: {
3
+ isPost: (v: {
4
+ config: {
5
+ method?: string;
6
+ };
7
+ }) => boolean;
8
+ isPut: (v: {
9
+ config: {
10
+ method?: string;
11
+ };
12
+ }) => boolean;
13
+ isGet: (v: {
14
+ config: {
15
+ method?: string;
16
+ };
17
+ }) => boolean;
18
+ };
19
+ export declare const interceptors: {
20
+ checkIsAxiosError<T extends object>(err: any): err is AxiosError<T, any>;
21
+ useUnreadableRetry<T extends () => Promise<AxiosResponse>>(fn: T, times?: number): Promise<Awaited<ReturnType<T>>["data"]>;
22
+ useForceRetry<T extends () => Promise<AxiosResponse>>(fn: T, times?: number): Promise<Awaited<ReturnType<T>>["data"]>;
23
+ createAutoRetry(api: AxiosInstance, times?: number): (err: any) => Promise<AxiosResponse<any, any, {}>>;
24
+ isClientError(err: any): Promise<never>;
25
+ passCorsError(err: any): Promise<never>;
26
+ };
27
+ export type Requester = ReturnType<typeof createAxios>;
28
+ export declare const createAxios: (fork: () => Promise<string> | string, config?: CreateAxiosDefaults & Partial<{
29
+ noPassClientError: boolean;
30
+ }>, middle?: (axios: AxiosInstance) => AxiosInstance) => {
31
+ get: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
32
+ post: <T>(url: string, data?: any, config?: AxiosRequestConfig) => Promise<T>;
33
+ postForm: <T>(url: string, data?: any, config?: AxiosRequestConfig) => Promise<T>;
34
+ put: <T>(url: string, data?: any, config?: AxiosRequestConfig) => Promise<T>;
35
+ putForm: <T>(url: string, data?: any, config?: AxiosRequestConfig) => Promise<T>;
36
+ delete: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
37
+ patch: <T>(url: string, data?: any, config?: AxiosRequestConfig) => Promise<T>;
38
+ patchForm: <T>(url: string, data?: any, config?: AxiosRequestConfig) => Promise<T>;
39
+ };
@@ -0,0 +1,9 @@
1
+ declare module 'axios' {
2
+ interface AxiosRequestConfig {
3
+ __retryCount?: number;
4
+ disretry?: boolean;
5
+ allowEmpty?: boolean;
6
+ }
7
+ }
8
+ export * from './abort';
9
+ export * from './axios';
package/dist/pack.tgz CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delta-comic/request",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "空阙虱楼",
5
5
  "homepage": "https://github.com/delta-comic/delta-comic",
6
6
  "license": "AGPL-3.0-only",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "peerDependencies": {
41
41
  "axios": "^1.13",
42
- "@delta-comic/utils": "1.3.0"
42
+ "@delta-comic/utils": "1.3.1"
43
43
  },
44
44
  "release": {
45
45
  "tagFormat": "request-${version}"