larapi 0.2.13 → 0.2.15
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/README.md +37 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/lib/Core.d.ts +5 -3
- package/lib/Http.d.ts +6 -4
- package/lib/Queue.d.ts +7 -9
- package/lib/index.d.ts +32 -34
- package/lib/types.d.ts +36 -8
- package/package.json +1 -1
- package/src/Core.ts +62 -6
- package/src/Http.ts +13 -10
- package/src/Queue.ts +13 -15
- package/src/index.ts +30 -29
- package/src/types.ts +43 -9
package/src/types.ts
CHANGED
|
@@ -4,12 +4,21 @@ export type TCacheBody = {
|
|
|
4
4
|
time: number;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
export type TUser = {
|
|
8
|
+
id: number;
|
|
9
|
+
[index: string]: any;
|
|
10
|
+
};
|
|
11
|
+
|
|
7
12
|
export type TCache = {
|
|
8
13
|
[index: string]: TCacheBody;
|
|
9
14
|
}
|
|
10
15
|
|
|
16
|
+
export type TError = {
|
|
17
|
+
message?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
11
20
|
export type TData = {
|
|
12
|
-
[index: string]: any;
|
|
21
|
+
[index: string]: any | ((...args: any) => any);
|
|
13
22
|
}
|
|
14
23
|
|
|
15
24
|
export type TGroupsData = {
|
|
@@ -27,20 +36,45 @@ export type TRequestProgress = {
|
|
|
27
36
|
percent: number;
|
|
28
37
|
total: number;
|
|
29
38
|
loaded: number;
|
|
30
|
-
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type TCoreRviverObject = {
|
|
42
|
+
and?: {
|
|
43
|
+
[index: string]: string[];
|
|
44
|
+
};
|
|
45
|
+
or?: {
|
|
46
|
+
[index: string]: string[];
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export type TConfigDataReviver = {
|
|
51
|
+
[index: string]: (value: any) => any;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export type TConfig = {
|
|
55
|
+
host: string;
|
|
56
|
+
reviver?: (this: any, key: string, value: any) => any;
|
|
57
|
+
dataReviver?: TConfigDataReviver;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export type TResponseData = {
|
|
61
|
+
success: TData;
|
|
62
|
+
error?: TError;
|
|
63
|
+
fail?: TError;
|
|
64
|
+
};
|
|
31
65
|
|
|
32
|
-
export type TParams = {
|
|
33
|
-
path:
|
|
34
|
-
data?:
|
|
66
|
+
export type TParams<P = string | keyof TResponseData['success'], D extends ((...args: any) => any) = TResponseData['success']['?'] | ((...args: any) => any), M extends TMethod = TMethod, E extends TError = TError, F extends TError = TError> = {
|
|
67
|
+
path: P;
|
|
68
|
+
data?: Parameters<D>[0];
|
|
35
69
|
cache?: string | boolean;
|
|
36
70
|
cacheUpdate?: TCacheControll | TCacheControll[];
|
|
37
71
|
cacheClear?: TCacheControll | TCacheControll[];
|
|
38
72
|
globalName?: string;
|
|
39
73
|
queueThrottling?: boolean;
|
|
40
|
-
success?: (data:
|
|
41
|
-
error?: (
|
|
42
|
-
fail?: (
|
|
43
|
-
complete?: (
|
|
74
|
+
success?: (data: ReturnType<D>) => void;
|
|
75
|
+
error?: (error: E) => void;
|
|
76
|
+
fail?: (fail: F) => void;
|
|
77
|
+
complete?: (complete: any) => void;
|
|
44
78
|
progress?: (progress: TRequestProgress) => void;
|
|
45
79
|
}
|
|
46
80
|
|