@chzky/reqwest 0.0.1 → 0.1.0
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 +314 -0
- package/esm/_dnt.polyfills.d.ts +11 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -10
- package/esm/_dnt.polyfills.js +24 -66
- package/esm/_dnt.shims.d.ts +1 -13
- package/esm/_dnt.shims.d.ts.map +1 -1
- package/esm/_dnt.shims.js +57 -1
- package/esm/lib/mod.d.ts +1 -1
- package/esm/lib/mod.d.ts.map +1 -1
- package/esm/lib/mod.js +1 -1
- package/esm/lib/reqwest/class.d.ts +116 -78
- package/esm/lib/reqwest/class.d.ts.map +1 -1
- package/esm/lib/reqwest/class.js +175 -1
- package/esm/lib/reqwest/core.d.ts +5 -0
- package/esm/lib/reqwest/core.d.ts.map +1 -1
- package/esm/lib/reqwest/core.js +154 -244
- package/esm/lib/reqwest/factor.d.ts +2 -2
- package/esm/lib/reqwest/factor.d.ts.map +1 -1
- package/esm/lib/reqwest/factor.js +32 -1
- package/esm/lib/reqwest/interface.d.ts +166 -42
- package/esm/lib/reqwest/interface.d.ts.map +1 -1
- package/esm/lib/reqwest/interface.js +1 -1
- package/esm/lib/reqwest/mod.d.ts +1 -1
- package/esm/lib/reqwest/mod.d.ts.map +1 -1
- package/esm/lib/reqwest/mod.js +2 -2
- package/esm/lib/{helper → utils}/mod.d.ts +1 -0
- package/esm/lib/utils/mod.d.ts.map +1 -0
- package/esm/lib/{helper → utils}/mod.js +1 -0
- package/esm/lib/utils/other/mod.d.ts +2 -0
- package/esm/lib/utils/other/mod.d.ts.map +1 -0
- package/esm/lib/utils/other/mod.js +1 -0
- package/esm/lib/utils/other/sseParse.d.ts +34 -0
- package/esm/lib/utils/other/sseParse.d.ts.map +1 -0
- package/esm/lib/utils/other/sseParse.js +42 -0
- package/{script/lib/helper → esm/lib/utils}/request/RESTful.d.ts +43 -11
- package/esm/lib/utils/request/RESTful.d.ts.map +1 -0
- package/esm/lib/utils/request/RESTful.js +129 -0
- package/esm/lib/utils/request/baseConf.d.ts +22 -0
- package/esm/lib/utils/request/baseConf.d.ts.map +1 -0
- package/esm/lib/utils/request/baseConf.js +37 -0
- package/esm/lib/utils/request/factors.d.ts +30 -0
- package/esm/lib/utils/request/factors.d.ts.map +1 -0
- package/esm/lib/utils/request/factors.js +39 -0
- package/esm/lib/{helper → utils}/request/input.d.ts +4 -3
- package/esm/lib/utils/request/input.d.ts.map +1 -0
- package/esm/lib/utils/request/input.js +24 -0
- package/esm/lib/utils/request/mod.d.ts +7 -0
- package/esm/lib/utils/request/mod.d.ts.map +1 -0
- package/esm/lib/utils/request/mod.js +6 -0
- package/esm/lib/utils/request/process.d.ts +16 -0
- package/esm/lib/utils/request/process.d.ts.map +1 -0
- package/esm/lib/utils/request/process.js +37 -0
- package/esm/lib/utils/request/wait.d.ts +10 -0
- package/esm/lib/utils/request/wait.d.ts.map +1 -0
- package/esm/lib/utils/request/wait.js +14 -0
- package/esm/lib/utils/response/blobToUrl.d.ts +10 -0
- package/esm/lib/utils/response/blobToUrl.d.ts.map +1 -0
- package/esm/lib/utils/response/blobToUrl.js +21 -0
- package/esm/lib/utils/response/mod.d.ts +5 -0
- package/esm/lib/utils/response/mod.d.ts.map +1 -0
- package/esm/lib/utils/response/mod.js +4 -0
- package/esm/lib/utils/response/openLink.d.ts +7 -0
- package/esm/lib/utils/response/openLink.d.ts.map +1 -0
- package/esm/lib/utils/response/openLink.js +20 -0
- package/esm/lib/utils/response/output.d.ts +16 -0
- package/esm/lib/utils/response/output.d.ts.map +1 -0
- package/esm/lib/utils/response/output.js +24 -0
- package/esm/lib/utils/response/pick.d.ts +23 -0
- package/esm/lib/utils/response/pick.d.ts.map +1 -0
- package/esm/lib/utils/response/pick.js +25 -0
- package/esm/lib/utils/use/mod.d.ts.map +1 -0
- package/esm/lib/utils/use/mod.js +2 -0
- package/esm/lib/utils/use/useCancel.d.ts +33 -0
- package/esm/lib/utils/use/useCancel.d.ts.map +1 -0
- package/esm/lib/utils/use/useCancel.js +41 -0
- package/esm/lib/utils/use/useLoading.d.ts +34 -0
- package/esm/lib/utils/use/useLoading.d.ts.map +1 -0
- package/esm/lib/utils/use/useLoading.js +57 -0
- package/package.json +4 -11
- package/script/_dnt.polyfills.d.ts +11 -0
- package/script/_dnt.polyfills.d.ts.map +1 -1
- package/script/_dnt.polyfills.js +15 -0
- package/script/_dnt.shims.d.ts +1 -13
- package/script/_dnt.shims.d.ts.map +1 -1
- package/script/_dnt.shims.js +2 -21
- package/script/lib/mod.d.ts +1 -1
- package/script/lib/mod.d.ts.map +1 -1
- package/script/lib/mod.js +1 -1
- package/script/lib/reqwest/class.d.ts +116 -78
- package/script/lib/reqwest/class.d.ts.map +1 -1
- package/script/lib/reqwest/class.js +135 -25
- package/script/lib/reqwest/core.d.ts +5 -0
- package/script/lib/reqwest/core.d.ts.map +1 -1
- package/script/lib/reqwest/core.js +119 -23
- package/script/lib/reqwest/factor.d.ts +2 -2
- package/script/lib/reqwest/factor.d.ts.map +1 -1
- package/script/lib/reqwest/factor.js +2 -2
- package/script/lib/reqwest/interface.d.ts +160 -11
- package/script/lib/reqwest/interface.d.ts.map +1 -1
- package/script/lib/reqwest/mod.d.ts +1 -1
- package/script/lib/reqwest/mod.d.ts.map +1 -1
- package/script/lib/{helper → utils}/mod.d.ts +1 -0
- package/script/lib/utils/mod.d.ts.map +1 -0
- package/script/lib/{helper → utils}/mod.js +1 -0
- package/script/lib/utils/other/mod.d.ts +2 -0
- package/script/lib/utils/other/mod.d.ts.map +1 -0
- package/script/lib/{helper/response → utils/other}/mod.js +1 -2
- package/script/lib/utils/other/sseParse.d.ts +34 -0
- package/script/lib/utils/other/sseParse.d.ts.map +1 -0
- package/script/lib/utils/other/sseParse.js +45 -0
- package/{esm/lib/helper → script/lib/utils}/request/RESTful.d.ts +43 -11
- package/script/lib/utils/request/RESTful.d.ts.map +1 -0
- package/script/lib/utils/request/RESTful.js +140 -0
- package/script/lib/utils/request/baseConf.d.ts +22 -0
- package/script/lib/utils/request/baseConf.d.ts.map +1 -0
- package/script/lib/utils/request/baseConf.js +42 -0
- package/script/lib/utils/request/factors.d.ts +30 -0
- package/script/lib/utils/request/factors.d.ts.map +1 -0
- package/script/lib/utils/request/factors.js +42 -0
- package/script/lib/{helper → utils}/request/input.d.ts +4 -3
- package/script/lib/utils/request/input.d.ts.map +1 -0
- package/script/lib/{helper → utils}/request/input.js +10 -10
- package/script/lib/utils/request/mod.d.ts +7 -0
- package/script/lib/utils/request/mod.d.ts.map +1 -0
- package/script/lib/utils/request/mod.js +22 -0
- package/script/lib/utils/request/process.d.ts +16 -0
- package/script/lib/utils/request/process.d.ts.map +1 -0
- package/script/lib/utils/request/process.js +41 -0
- package/script/lib/utils/request/wait.d.ts +10 -0
- package/script/lib/utils/request/wait.d.ts.map +1 -0
- package/script/lib/utils/request/wait.js +17 -0
- package/script/lib/utils/response/blobToUrl.d.ts +10 -0
- package/script/lib/utils/response/blobToUrl.d.ts.map +1 -0
- package/script/lib/utils/response/blobToUrl.js +24 -0
- package/script/lib/utils/response/mod.d.ts +5 -0
- package/script/lib/utils/response/mod.d.ts.map +1 -0
- package/script/lib/{helper/request → utils/response}/mod.js +4 -3
- package/script/lib/utils/response/openLink.d.ts +7 -0
- package/script/lib/utils/response/openLink.d.ts.map +1 -0
- package/script/lib/{helper/use/useLoading.js → utils/response/openLink.js} +17 -22
- package/script/lib/utils/response/output.d.ts +16 -0
- package/script/lib/utils/response/output.d.ts.map +1 -0
- package/script/lib/utils/response/output.js +28 -0
- package/script/lib/utils/response/pick.d.ts +23 -0
- package/script/lib/utils/response/pick.d.ts.map +1 -0
- package/script/lib/utils/response/pick.js +28 -0
- package/script/lib/utils/use/mod.d.ts.map +1 -0
- package/script/lib/{helper → utils}/use/mod.js +2 -2
- package/script/lib/utils/use/useCancel.d.ts +33 -0
- package/script/lib/utils/use/useCancel.d.ts.map +1 -0
- package/script/lib/utils/use/useCancel.js +44 -0
- package/script/lib/utils/use/useLoading.d.ts +34 -0
- package/script/lib/utils/use/useLoading.d.ts.map +1 -0
- package/script/lib/utils/use/useLoading.js +60 -0
- package/esm/lib/helper/mod.d.ts.map +0 -1
- package/esm/lib/helper/request/RESTful.d.ts.map +0 -1
- package/esm/lib/helper/request/RESTful.js +0 -1
- package/esm/lib/helper/request/baseConf.d.ts +0 -15
- package/esm/lib/helper/request/baseConf.d.ts.map +0 -1
- package/esm/lib/helper/request/baseConf.js +0 -1
- package/esm/lib/helper/request/input.d.ts.map +0 -1
- package/esm/lib/helper/request/input.js +0 -1
- package/esm/lib/helper/request/mod.d.ts +0 -4
- package/esm/lib/helper/request/mod.d.ts.map +0 -1
- package/esm/lib/helper/request/mod.js +0 -3
- package/esm/lib/helper/response/mod.d.ts +0 -3
- package/esm/lib/helper/response/mod.d.ts.map +0 -1
- package/esm/lib/helper/response/mod.js +0 -2
- package/esm/lib/helper/response/output.d.ts +0 -5
- package/esm/lib/helper/response/output.d.ts.map +0 -1
- package/esm/lib/helper/response/output.js +0 -1
- package/esm/lib/helper/response/pick.d.ts +0 -7
- package/esm/lib/helper/response/pick.d.ts.map +0 -1
- package/esm/lib/helper/response/pick.js +0 -1
- package/esm/lib/helper/use/mod.d.ts.map +0 -1
- package/esm/lib/helper/use/mod.js +0 -2
- package/esm/lib/helper/use/useCancel.d.ts +0 -4
- package/esm/lib/helper/use/useCancel.d.ts.map +0 -1
- package/esm/lib/helper/use/useCancel.js +0 -1
- package/esm/lib/helper/use/useLoading.d.ts +0 -15
- package/esm/lib/helper/use/useLoading.d.ts.map +0 -1
- package/esm/lib/helper/use/useLoading.js +0 -1
- package/script/lib/helper/mod.d.ts.map +0 -1
- package/script/lib/helper/request/RESTful.d.ts.map +0 -1
- package/script/lib/helper/request/RESTful.js +0 -86
- package/script/lib/helper/request/baseConf.d.ts +0 -15
- package/script/lib/helper/request/baseConf.d.ts.map +0 -1
- package/script/lib/helper/request/baseConf.js +0 -27
- package/script/lib/helper/request/input.d.ts.map +0 -1
- package/script/lib/helper/request/mod.d.ts +0 -4
- package/script/lib/helper/request/mod.d.ts.map +0 -1
- package/script/lib/helper/response/mod.d.ts +0 -3
- package/script/lib/helper/response/mod.d.ts.map +0 -1
- package/script/lib/helper/response/output.d.ts +0 -5
- package/script/lib/helper/response/output.d.ts.map +0 -1
- package/script/lib/helper/response/output.js +0 -15
- package/script/lib/helper/response/pick.d.ts +0 -7
- package/script/lib/helper/response/pick.d.ts.map +0 -1
- package/script/lib/helper/response/pick.js +0 -12
- package/script/lib/helper/use/mod.d.ts.map +0 -1
- package/script/lib/helper/use/useCancel.d.ts +0 -4
- package/script/lib/helper/use/useCancel.d.ts.map +0 -1
- package/script/lib/helper/use/useCancel.js +0 -15
- package/script/lib/helper/use/useLoading.d.ts +0 -15
- package/script/lib/helper/use/useLoading.d.ts.map +0 -1
- /package/esm/lib/{helper → utils}/use/mod.d.ts +0 -0
- /package/script/lib/{helper → utils}/use/mod.d.ts +0 -0
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.post = post;
|
|
4
|
-
exports.get = get;
|
|
5
|
-
exports.put = put;
|
|
6
|
-
exports.del = del;
|
|
7
|
-
exports.form = form;
|
|
8
|
-
const fp_1 = require("@chzky/fp");
|
|
9
|
-
/** ### `post` : post请求
|
|
10
|
-
@param url `string` - 请求地址
|
|
11
|
-
@param [data={}] `unknown` - 请求数据
|
|
12
|
-
@param [query={}] `Record<string, unknown>` - URL形式的请求参数
|
|
13
|
-
@type `Interceptor` - `Request`
|
|
14
|
-
@category `Request`
|
|
15
|
-
*/
|
|
16
|
-
function post(url, data = {}, query = {}) {
|
|
17
|
-
return (conf) => {
|
|
18
|
-
conf.method = 'post';
|
|
19
|
-
conf.url = url;
|
|
20
|
-
conf.data = data;
|
|
21
|
-
conf.params = query;
|
|
22
|
-
return (0, fp_1.Ok)();
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
/** ### `get` : get请求
|
|
26
|
-
@param url `string` - 请求地址
|
|
27
|
-
@param [query={}] `Record<string, unknown>` - URL形式的请求参数
|
|
28
|
-
@type `Interceptor` - `Request`
|
|
29
|
-
@category `Request`
|
|
30
|
-
*/
|
|
31
|
-
function get(url, query = {}) {
|
|
32
|
-
return (conf) => {
|
|
33
|
-
conf.method = 'get';
|
|
34
|
-
conf.url = url;
|
|
35
|
-
conf.params = query;
|
|
36
|
-
return (0, fp_1.Ok)();
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
/** ### `put` : put请求
|
|
40
|
-
@param url `string` - 请求地址
|
|
41
|
-
@param [data={}] `unknown` - 请求数据
|
|
42
|
-
@param [query={}] `Record<string, unknown>` - URL形式的请求参数
|
|
43
|
-
@type `Interceptor` - `Request`
|
|
44
|
-
@category `Request`
|
|
45
|
-
*/
|
|
46
|
-
function put(url, data = {}, query = {}) {
|
|
47
|
-
return (conf) => {
|
|
48
|
-
conf.method = 'put';
|
|
49
|
-
conf.url = url;
|
|
50
|
-
conf.data = data;
|
|
51
|
-
conf.params = query;
|
|
52
|
-
return (0, fp_1.Ok)();
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
/** ### `del` : delete请求
|
|
56
|
-
@param url `string` - 请求地址
|
|
57
|
-
@param [query={}] `Record<string, unknown>` - query形式的请求参数
|
|
58
|
-
@type `Interceptor` - `Request`
|
|
59
|
-
@category `Request`
|
|
60
|
-
*/
|
|
61
|
-
function del(url, query = {}) {
|
|
62
|
-
return (conf) => {
|
|
63
|
-
conf.method = 'delete';
|
|
64
|
-
conf.url = url;
|
|
65
|
-
conf.params = query;
|
|
66
|
-
return (0, fp_1.Ok)();
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
/** ### `form` : FormData形式请求
|
|
70
|
-
@param url `string` - 请求地址
|
|
71
|
-
@param data `Record<string, string | Blob>` - 请求数据
|
|
72
|
-
@type `Interceptor` - `Request`
|
|
73
|
-
@category `Request`
|
|
74
|
-
*/
|
|
75
|
-
function form(url, data) {
|
|
76
|
-
return (conf) => {
|
|
77
|
-
conf.method = 'post';
|
|
78
|
-
conf.url = url;
|
|
79
|
-
const fdata = new FormData();
|
|
80
|
-
Object.entries(data).forEach(([key, value]) => {
|
|
81
|
-
fdata.append(key, value);
|
|
82
|
-
});
|
|
83
|
-
conf.data = fdata;
|
|
84
|
-
return (0, fp_1.Ok)();
|
|
85
|
-
};
|
|
86
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { RequestInterceptor } from '../../../mod.js';
|
|
2
|
-
import type { AxiosRequestHeaders, ResponseType } from 'axios';
|
|
3
|
-
/** ## `header` : 修改请求头数据
|
|
4
|
-
@param header `AxiosRequestHeaders` - 请求头数据
|
|
5
|
-
@type `Interceptor` - `Request`
|
|
6
|
-
@category `Request`
|
|
7
|
-
*/
|
|
8
|
-
export declare function header(header: AxiosRequestHeaders): RequestInterceptor<never>;
|
|
9
|
-
/** ## `response_type` : 修改响应数据类型
|
|
10
|
-
@param type `ResponseType` - 响应数据类型
|
|
11
|
-
@type `Interceptor` - `Request`
|
|
12
|
-
@category `Request`
|
|
13
|
-
*/
|
|
14
|
-
export declare function response_type(type: ResponseType): RequestInterceptor<never>;
|
|
15
|
-
//# sourceMappingURL=baseConf.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"baseConf.d.ts","sourceRoot":"","sources":["../../../../src/lib/helper/request/baseConf.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAE9D;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,mBAAmB,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAK7E;AAED;;;;EAIE;AACF,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAK3E"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.header = header;
|
|
4
|
-
exports.response_type = response_type;
|
|
5
|
-
const fp_1 = require("@chzky/fp");
|
|
6
|
-
/** ## `header` : 修改请求头数据
|
|
7
|
-
@param header `AxiosRequestHeaders` - 请求头数据
|
|
8
|
-
@type `Interceptor` - `Request`
|
|
9
|
-
@category `Request`
|
|
10
|
-
*/
|
|
11
|
-
function header(header) {
|
|
12
|
-
return (conf) => {
|
|
13
|
-
conf.headers = header;
|
|
14
|
-
return (0, fp_1.Ok)();
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
/** ## `response_type` : 修改响应数据类型
|
|
18
|
-
@param type `ResponseType` - 响应数据类型
|
|
19
|
-
@type `Interceptor` - `Request`
|
|
20
|
-
@category `Request`
|
|
21
|
-
*/
|
|
22
|
-
function response_type(type) {
|
|
23
|
-
return (conf) => {
|
|
24
|
-
conf.responseType = type;
|
|
25
|
-
return (0, fp_1.Ok)();
|
|
26
|
-
};
|
|
27
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../../src/lib/helper/request/input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,GAAG,EAAM,MAAM,WAAW,CAAA;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAIzD;;;;;;EAME;AACF,wBAAgB,KAAK,CACnB,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,EAC3B,SAAS,CAAC,EAAE,MAAM,GAAG,QAAQ,GAC5B,kBAAkB,CAAC,aAAa,CAAC,CAYnC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../src/lib/helper/request/mod.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../src/lib/helper/response/mod.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { ResponseInterceptor } from '../../../mod.js';
|
|
2
|
-
import { type zod, CheckingError } from '@chzky/fp';
|
|
3
|
-
/** ### `output` : 对输出类型进行类型校验 */
|
|
4
|
-
export declare function output<T>(schema: zod.Schema<T>): ResponseInterceptor<any, zod.infer<typeof schema>, CheckingError>;
|
|
5
|
-
//# sourceMappingURL=output.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../../src/lib/helper/response/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,KAAK,GAAG,EAAE,aAAa,EAAM,MAAM,WAAW,CAAA;AAEvD,iCAAiC;AACjC,wBAAgB,MAAM,CAAC,CAAC,EACtB,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GACpB,mBAAmB,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,EAAE,aAAa,CAAC,CAQnE"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.output = output;
|
|
4
|
-
const fp_1 = require("@chzky/fp");
|
|
5
|
-
/** ### `output` : 对输出类型进行类型校验 */
|
|
6
|
-
function output(schema) {
|
|
7
|
-
return (response) => {
|
|
8
|
-
try {
|
|
9
|
-
return (0, fp_1.Ok)(schema.parse(response));
|
|
10
|
-
}
|
|
11
|
-
catch (e) {
|
|
12
|
-
return fp_1.CheckingError.err(e);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ResponseInterceptor } from '../../../mod.js';
|
|
2
|
-
import type { AxiosResponse } from 'axios';
|
|
3
|
-
/** ### `pick` : 提取data字段
|
|
4
|
-
一般来说axios返回的数据是一个AxiosResponse对象,而我们只需要其中的data字段作为业务数据需要的字段
|
|
5
|
-
*/
|
|
6
|
-
export declare function pick<T = never>(key?: keyof AxiosResponse): ResponseInterceptor<AxiosResponse, T extends never ? AxiosResponse[typeof key] : T, never>;
|
|
7
|
-
//# sourceMappingURL=pick.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pick.d.ts","sourceRoot":"","sources":["../../../../src/lib/helper/response/pick.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAG1C;;EAEE;AACF,wBAAgB,IAAI,CAAC,CAAC,GAAG,KAAK,EAC5B,GAAG,GAAE,MAAM,aAAsB,GAChC,mBAAmB,CAAC,aAAa,EAAE,CAAC,SAAS,KAAK,GAAG,aAAa,CAAC,OAAO,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAI5F"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.pick = pick;
|
|
4
|
-
const fp_1 = require("@chzky/fp");
|
|
5
|
-
/** ### `pick` : 提取data字段
|
|
6
|
-
一般来说axios返回的数据是一个AxiosResponse对象,而我们只需要其中的data字段作为业务数据需要的字段
|
|
7
|
-
*/
|
|
8
|
-
function pick(key = 'data') {
|
|
9
|
-
return (response) => {
|
|
10
|
-
return (0, fp_1.Ok)(response[key]);
|
|
11
|
-
};
|
|
12
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../src/lib/helper/use/mod.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCancel.d.ts","sourceRoot":"","sources":["../../../../src/lib/helper/use/useCancel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAGzD,6BAA6B;AAC7B,wBAAgB,MAAM,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,CAAC,eAAe,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAS9F"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cancel = cancel;
|
|
4
|
-
const fp_1 = require("@chzky/fp");
|
|
5
|
-
/** ### `cancel` : 允许取消的请求 */
|
|
6
|
-
function cancel(control) {
|
|
7
|
-
const contro = control || new AbortController();
|
|
8
|
-
return [
|
|
9
|
-
contro,
|
|
10
|
-
(conf) => {
|
|
11
|
-
conf.signal = contro.signal;
|
|
12
|
-
return (0, fp_1.Ok)();
|
|
13
|
-
},
|
|
14
|
-
];
|
|
15
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Ref } from 'vue-demi';
|
|
2
|
-
import type { Reqwest, ReqwestInterceptor } from '../../../mod.js';
|
|
3
|
-
type LoadingConfig = {
|
|
4
|
-
/** 最大等待时间,超时之后loding状态会变为false,默认值是`Axios.timeout` */
|
|
5
|
-
maximum?: number;
|
|
6
|
-
/** 超时回调 */
|
|
7
|
-
maximun_handler?: () => void;
|
|
8
|
-
};
|
|
9
|
-
/** ## `loading_control` : 控制Loading状态
|
|
10
|
-
@type `Interceptor`
|
|
11
|
-
@category `Reqwest`
|
|
12
|
-
*/
|
|
13
|
-
export declare function loading_control<T extends Reqwest<any, any, any>>(loading: Ref<boolean, boolean>, conf?: LoadingConfig): T extends Reqwest<infer O, infer E, infer ER> ? ReqwestInterceptor<O, E, ER> : never;
|
|
14
|
-
export {};
|
|
15
|
-
//# sourceMappingURL=useLoading.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useLoading.d.ts","sourceRoot":"","sources":["../../../../src/lib/helper/use/useLoading.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,KAAK,EACV,OAAO,EAEP,kBAAkB,EAEnB,MAAM,iBAAiB,CAAA;AAExB,KAAK,aAAa,GAAG;IACnB,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW;IACX,eAAe,CAAC,EAAE,MAAM,IAAI,CAAA;CAC7B,CAAA;AAED;;;EAGE;AACF,wBAAgB,eAAe,CAAC,CAAC,SAAS,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAC9D,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,EAC9B,IAAI,GAAE,aAAkB,GACvB,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,CAoBtF"}
|
|
File without changes
|
|
File without changes
|