@mx-space/api-client 1.16.1 → 1.18.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/controllers/ack.ts +1 -2
- package/controllers/activity.ts +1 -2
- package/controllers/aggregate.ts +1 -2
- package/controllers/ai.ts +12 -3
- package/controllers/base.ts +1 -2
- package/controllers/category.ts +4 -6
- package/controllers/comment.ts +1 -2
- package/controllers/link.ts +1 -3
- package/controllers/note.ts +5 -3
- package/controllers/page.ts +1 -2
- package/controllers/post.ts +1 -2
- package/controllers/project.ts +1 -3
- package/controllers/recently.ts +1 -2
- package/controllers/say.ts +1 -3
- package/controllers/search.ts +2 -3
- package/controllers/severless.ts +1 -2
- package/controllers/snippet.ts +1 -2
- package/controllers/subscribe.ts +1 -2
- package/controllers/topic.ts +1 -3
- package/controllers/user.ts +1 -2
- package/dist/adapter-B1dtiutp.d.cts +25 -0
- package/dist/adapter-CRsPadpS.d.mts +25 -0
- package/dist/adaptors/axios.cjs +53 -57
- package/dist/adaptors/axios.d.cts +5 -4
- package/dist/adaptors/axios.d.mts +7 -0
- package/dist/adaptors/axios.mjs +33 -0
- package/dist/adaptors/fetch.cjs +72 -108
- package/dist/adaptors/fetch.d.cts +4 -3
- package/dist/adaptors/fetch.d.mts +6 -0
- package/dist/adaptors/fetch.mjs +75 -0
- package/dist/adaptors/umi-request.cjs +32 -54
- package/dist/adaptors/umi-request.d.cts +5 -4
- package/dist/adaptors/umi-request.d.mts +7 -0
- package/dist/adaptors/umi-request.mjs +33 -0
- package/dist/index.cjs +1042 -1199
- package/dist/index.d.cts +1758 -1643
- package/dist/index.d.mts +2016 -0
- package/dist/index.mjs +1101 -0
- package/index.ts +0 -1
- package/interfaces/request.ts +3 -1
- package/mod-dts.mjs +15 -12
- package/models/aggregate.ts +0 -2
- package/models/ai.ts +9 -0
- package/models/comment.ts +1 -2
- package/models/note.ts +1 -1
- package/models/recently.ts +2 -0
- package/models/setting.ts +5 -0
- package/package.json +20 -20
- package/readme.md +3 -3
- package/tsconfig.json +11 -11
- package/{tsup.config.ts → tsdown.config.ts} +2 -2
- package/vitest.config.ts +0 -1
- package/.eslintcache +0 -1
- package/coverage/clover.xml +0 -591
- package/coverage/coverage-final.json +0 -5944
- package/coverage/lcov-report/adaptors/axios.ts.html +0 -201
- package/coverage/lcov-report/adaptors/index.html +0 -196
- package/coverage/lcov-report/adaptors/umi-request.ts.html +0 -186
- package/coverage/lcov-report/auto-bind.ts.html +0 -228
- package/coverage/lcov-report/base.css +0 -354
- package/coverage/lcov-report/block-navigation.js +0 -85
- package/coverage/lcov-report/controllers/aggregate.ts.html +0 -294
- package/coverage/lcov-report/controllers/base.ts.html +0 -183
- package/coverage/lcov-report/controllers/category.ts.html +0 -441
- package/coverage/lcov-report/controllers/comment.ts.html +0 -291
- package/coverage/lcov-report/controllers/index.html +0 -476
- package/coverage/lcov-report/controllers/index.ts.html +0 -297
- package/coverage/lcov-report/controllers/link.ts.html +0 -216
- package/coverage/lcov-report/controllers/note.ts.html +0 -375
- package/coverage/lcov-report/controllers/page.ts.html +0 -279
- package/coverage/lcov-report/controllers/post.ts.html +0 -369
- package/coverage/lcov-report/controllers/project.ts.html +0 -168
- package/coverage/lcov-report/controllers/recently.ts.html +0 -246
- package/coverage/lcov-report/controllers/say.ts.html +0 -207
- package/coverage/lcov-report/controllers/search.ts.html +0 -411
- package/coverage/lcov-report/controllers/severless.ts.html +0 -180
- package/coverage/lcov-report/controllers/snippet.ts.html +0 -195
- package/coverage/lcov-report/controllers/user.ts.html +0 -240
- package/coverage/lcov-report/core/attach-request.ts.html +0 -216
- package/coverage/lcov-report/core/client.ts.html +0 -786
- package/coverage/lcov-report/core/error.ts.html +0 -117
- package/coverage/lcov-report/core/index.html +0 -236
- package/coverage/lcov-report/core/index.ts.html +0 -93
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -276
- package/coverage/lcov-report/index.ts.html +0 -243
- package/coverage/lcov-report/models/aggregate.ts.html +0 -300
- package/coverage/lcov-report/models/category.ts.html +0 -162
- package/coverage/lcov-report/models/index.html +0 -196
- package/coverage/lcov-report/prettify.css +0 -101
- package/coverage/lcov-report/prettify.js +0 -1004
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -191
- package/coverage/lcov-report/utils/auto-bind.ts.html +0 -231
- package/coverage/lcov-report/utils/index.html +0 -216
- package/coverage/lcov-report/utils/index.ts.html +0 -246
- package/coverage/lcov-report/utils/path.ts.html +0 -105
- package/coverage/lcov.info +0 -1209
- package/dist/adapter-B8tKfr1O.d.cts +0 -23
- package/dist/adapter-B8tKfr1O.d.ts +0 -23
- package/dist/adaptors/axios.d.ts +0 -6
- package/dist/adaptors/axios.global.js +0 -14151
- package/dist/adaptors/axios.js +0 -33
- package/dist/adaptors/fetch.d.ts +0 -5
- package/dist/adaptors/fetch.global.js +0 -87
- package/dist/adaptors/fetch.js +0 -87
- package/dist/adaptors/umi-request.d.ts +0 -6
- package/dist/adaptors/umi-request.global.js +0 -7379
- package/dist/adaptors/umi-request.js +0 -33
- package/dist/index.d.ts +0 -1901
- package/dist/index.global.js +0 -1193
- package/dist/index.js +0 -1234
- package/esm/apps/core/src/modules/subscribe/subscribe.constant.d.ts +0 -12
- package/esm/apps/core/src/modules/subscribe/subscribe.constant.js +0 -16
- package/esm/apps/core/src/modules/subscribe/subscribe.constant.js.map +0 -1
- package/esm/packages/api-client/adaptors/axios.d.ts +0 -4
- package/esm/packages/api-client/adaptors/axios.js +0 -37
- package/esm/packages/api-client/adaptors/axios.js.map +0 -1
- package/esm/packages/api-client/adaptors/fetch.d.ts +0 -2
- package/esm/packages/api-client/adaptors/fetch.js +0 -95
- package/esm/packages/api-client/adaptors/fetch.js.map +0 -1
- package/esm/packages/api-client/adaptors/ky.d.ts +0 -23
- package/esm/packages/api-client/adaptors/ky.js +0 -62
- package/esm/packages/api-client/adaptors/ky.js.map +0 -1
- package/esm/packages/api-client/adaptors/umi-request.d.ts +0 -4
- package/esm/packages/api-client/adaptors/umi-request.js +0 -31
- package/esm/packages/api-client/adaptors/umi-request.js.map +0 -1
- package/esm/packages/api-client/controllers/aggregate.d.ts +0 -64
- package/esm/packages/api-client/controllers/aggregate.js +0 -46
- package/esm/packages/api-client/controllers/aggregate.js.map +0 -1
- package/esm/packages/api-client/controllers/base.d.ts +0 -43
- package/esm/packages/api-client/controllers/base.js +0 -27
- package/esm/packages/api-client/controllers/base.js.map +0 -1
- package/esm/packages/api-client/controllers/category.d.ts +0 -120
- package/esm/packages/api-client/controllers/category.js +0 -68
- package/esm/packages/api-client/controllers/category.js.map +0 -1
- package/esm/packages/api-client/controllers/comment.d.ts +0 -81
- package/esm/packages/api-client/controllers/comment.js +0 -47
- package/esm/packages/api-client/controllers/comment.js.map +0 -1
- package/esm/packages/api-client/controllers/index.d.ts +0 -19
- package/esm/packages/api-client/controllers/index.js +0 -60
- package/esm/packages/api-client/controllers/index.js.map +0 -1
- package/esm/packages/api-client/controllers/link.d.ts +0 -20
- package/esm/packages/api-client/controllers/link.js +0 -21
- package/esm/packages/api-client/controllers/link.js.map +0 -1
- package/esm/packages/api-client/controllers/note.d.ts +0 -103
- package/esm/packages/api-client/controllers/note.js +0 -68
- package/esm/packages/api-client/controllers/note.js.map +0 -1
- package/esm/packages/api-client/controllers/page.d.ts +0 -59
- package/esm/packages/api-client/controllers/page.js +0 -42
- package/esm/packages/api-client/controllers/page.js.map +0 -1
- package/esm/packages/api-client/controllers/post.d.ts +0 -72
- package/esm/packages/api-client/controllers/post.js +0 -52
- package/esm/packages/api-client/controllers/post.js.map +0 -1
- package/esm/packages/api-client/controllers/project.d.ts +0 -15
- package/esm/packages/api-client/controllers/project.js +0 -12
- package/esm/packages/api-client/controllers/project.js.map +0 -1
- package/esm/packages/api-client/controllers/recently.d.ts +0 -110
- package/esm/packages/api-client/controllers/recently.js +0 -49
- package/esm/packages/api-client/controllers/recently.js.map +0 -1
- package/esm/packages/api-client/controllers/say.d.ts +0 -37
- package/esm/packages/api-client/controllers/say.js +0 -21
- package/esm/packages/api-client/controllers/say.js.map +0 -1
- package/esm/packages/api-client/controllers/search.d.ts +0 -87
- package/esm/packages/api-client/controllers/search.js +0 -28
- package/esm/packages/api-client/controllers/search.js.map +0 -1
- package/esm/packages/api-client/controllers/severless.d.ts +0 -24
- package/esm/packages/api-client/controllers/severless.js +0 -16
- package/esm/packages/api-client/controllers/severless.js.map +0 -1
- package/esm/packages/api-client/controllers/snippet.d.ts +0 -24
- package/esm/packages/api-client/controllers/snippet.js +0 -19
- package/esm/packages/api-client/controllers/snippet.js.map +0 -1
- package/esm/packages/api-client/controllers/subscribe.d.ts +0 -64
- package/esm/packages/api-client/controllers/subscribe.js +0 -35
- package/esm/packages/api-client/controllers/subscribe.js.map +0 -1
- package/esm/packages/api-client/controllers/topic.d.ts +0 -26
- package/esm/packages/api-client/controllers/topic.js +0 -18
- package/esm/packages/api-client/controllers/topic.js.map +0 -1
- package/esm/packages/api-client/controllers/user.d.ts +0 -70
- package/esm/packages/api-client/controllers/user.js +0 -40
- package/esm/packages/api-client/controllers/user.js.map +0 -1
- package/esm/packages/api-client/core/attach-request.d.ts +0 -2
- package/esm/packages/api-client/core/attach-request.js +0 -36
- package/esm/packages/api-client/core/attach-request.js.map +0 -1
- package/esm/packages/api-client/core/client.d.ts +0 -29
- package/esm/packages/api-client/core/client.js +0 -193
- package/esm/packages/api-client/core/client.js.map +0 -1
- package/esm/packages/api-client/core/error.d.ts +0 -6
- package/esm/packages/api-client/core/error.js +0 -9
- package/esm/packages/api-client/core/error.js.map +0 -1
- package/esm/packages/api-client/core/index.d.ts +0 -2
- package/esm/packages/api-client/core/index.js +0 -3
- package/esm/packages/api-client/core/index.js.map +0 -1
- package/esm/packages/api-client/dtos/comment.d.ts +0 -8
- package/esm/packages/api-client/dtos/comment.js +0 -2
- package/esm/packages/api-client/dtos/comment.js.map +0 -1
- package/esm/packages/api-client/dtos/index.d.ts +0 -1
- package/esm/packages/api-client/dtos/index.js +0 -2
- package/esm/packages/api-client/dtos/index.js.map +0 -1
- package/esm/packages/api-client/index.d.ts +0 -8
- package/esm/packages/api-client/index.js +0 -9
- package/esm/packages/api-client/index.js.map +0 -1
- package/esm/packages/api-client/interfaces/adapter.d.ts +0 -14
- package/esm/packages/api-client/interfaces/adapter.js +0 -2
- package/esm/packages/api-client/interfaces/adapter.js.map +0 -1
- package/esm/packages/api-client/interfaces/client.d.ts +0 -13
- package/esm/packages/api-client/interfaces/client.js +0 -2
- package/esm/packages/api-client/interfaces/client.js.map +0 -1
- package/esm/packages/api-client/interfaces/controller.d.ts +0 -4
- package/esm/packages/api-client/interfaces/controller.js +0 -2
- package/esm/packages/api-client/interfaces/controller.js.map +0 -1
- package/esm/packages/api-client/interfaces/instance.d.ts +0 -7
- package/esm/packages/api-client/interfaces/instance.js +0 -2
- package/esm/packages/api-client/interfaces/instance.js.map +0 -1
- package/esm/packages/api-client/interfaces/options.d.ts +0 -1
- package/esm/packages/api-client/interfaces/options.js +0 -2
- package/esm/packages/api-client/interfaces/options.js.map +0 -1
- package/esm/packages/api-client/interfaces/params.d.ts +0 -4
- package/esm/packages/api-client/interfaces/params.js +0 -2
- package/esm/packages/api-client/interfaces/params.js.map +0 -1
- package/esm/packages/api-client/interfaces/request.d.ts +0 -44
- package/esm/packages/api-client/interfaces/request.js +0 -2
- package/esm/packages/api-client/interfaces/request.js.map +0 -1
- package/esm/packages/api-client/interfaces/types.d.ts +0 -2
- package/esm/packages/api-client/interfaces/types.js +0 -2
- package/esm/packages/api-client/interfaces/types.js.map +0 -1
- package/esm/packages/api-client/models/aggregate.d.ts +0 -67
- package/esm/packages/api-client/models/aggregate.js +0 -6
- package/esm/packages/api-client/models/aggregate.js.map +0 -1
- package/esm/packages/api-client/models/base.d.ts +0 -40
- package/esm/packages/api-client/models/base.js +0 -2
- package/esm/packages/api-client/models/base.js.map +0 -1
- package/esm/packages/api-client/models/category.d.ts +0 -22
- package/esm/packages/api-client/models/category.js +0 -6
- package/esm/packages/api-client/models/category.js.map +0 -1
- package/esm/packages/api-client/models/comment.d.ts +0 -39
- package/esm/packages/api-client/models/comment.js +0 -13
- package/esm/packages/api-client/models/comment.js.map +0 -1
- package/esm/packages/api-client/models/index.d.ts +0 -16
- package/esm/packages/api-client/models/index.js +0 -17
- package/esm/packages/api-client/models/index.js.map +0 -1
- package/esm/packages/api-client/models/link.d.ts +0 -22
- package/esm/packages/api-client/models/link.js +0 -14
- package/esm/packages/api-client/models/link.js.map +0 -1
- package/esm/packages/api-client/models/note.d.ts +0 -38
- package/esm/packages/api-client/models/note.js +0 -2
- package/esm/packages/api-client/models/note.js.map +0 -1
- package/esm/packages/api-client/models/page.d.ts +0 -14
- package/esm/packages/api-client/models/page.js +0 -7
- package/esm/packages/api-client/models/page.js.map +0 -1
- package/esm/packages/api-client/models/post.d.ts +0 -17
- package/esm/packages/api-client/models/post.js +0 -2
- package/esm/packages/api-client/models/post.js.map +0 -1
- package/esm/packages/api-client/models/project.d.ts +0 -11
- package/esm/packages/api-client/models/project.js +0 -2
- package/esm/packages/api-client/models/project.js.map +0 -1
- package/esm/packages/api-client/models/recently.d.ts +0 -20
- package/esm/packages/api-client/models/recently.js +0 -7
- package/esm/packages/api-client/models/recently.js.map +0 -1
- package/esm/packages/api-client/models/say.d.ts +0 -6
- package/esm/packages/api-client/models/say.js +0 -2
- package/esm/packages/api-client/models/say.js.map +0 -1
- package/esm/packages/api-client/models/setting.d.ts +0 -66
- package/esm/packages/api-client/models/setting.js +0 -2
- package/esm/packages/api-client/models/setting.js.map +0 -1
- package/esm/packages/api-client/models/snippet.d.ts +0 -18
- package/esm/packages/api-client/models/snippet.js +0 -8
- package/esm/packages/api-client/models/snippet.js.map +0 -1
- package/esm/packages/api-client/models/subscribe.d.ts +0 -3
- package/esm/packages/api-client/models/subscribe.js +0 -2
- package/esm/packages/api-client/models/subscribe.js.map +0 -1
- package/esm/packages/api-client/models/topic.d.ts +0 -8
- package/esm/packages/api-client/models/topic.js +0 -2
- package/esm/packages/api-client/models/topic.js.map +0 -1
- package/esm/packages/api-client/models/user.d.ts +0 -21
- package/esm/packages/api-client/models/user.js +0 -2
- package/esm/packages/api-client/models/user.js.map +0 -1
- package/esm/packages/api-client/tsup.config.d.ts +0 -2
- package/esm/packages/api-client/tsup.config.js +0 -14
- package/esm/packages/api-client/tsup.config.js.map +0 -1
- package/esm/packages/api-client/utils/auto-bind.d.ts +0 -4
- package/esm/packages/api-client/utils/auto-bind.js +0 -36
- package/esm/packages/api-client/utils/auto-bind.js.map +0 -1
- package/esm/packages/api-client/utils/camelcase-keys.d.ts +0 -6
- package/esm/packages/api-client/utils/camelcase-keys.js +0 -23
- package/esm/packages/api-client/utils/camelcase-keys.js.map +0 -1
- package/esm/packages/api-client/utils/index.d.ts +0 -5
- package/esm/packages/api-client/utils/index.js +0 -43
- package/esm/packages/api-client/utils/index.js.map +0 -1
- package/esm/packages/api-client/utils/path.d.ts +0 -1
- package/esm/packages/api-client/utils/path.js +0 -7
- package/esm/packages/api-client/utils/path.js.map +0 -1
- package/esm/packages/api-client/vitest.config.d.ts +0 -2
- package/esm/packages/api-client/vitest.config.js +0 -15
- package/esm/packages/api-client/vitest.config.js.map +0 -1
package/dist/adaptors/fetch.cjs
CHANGED
|
@@ -1,112 +1,76 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
1
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
default: {
|
|
36
|
-
data = await cloned.text();
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
const nextResponse = Object.assign({}, response, {
|
|
41
|
-
data
|
|
42
|
-
});
|
|
43
|
-
if (response.ok) {
|
|
44
|
-
return nextResponse;
|
|
45
|
-
} else {
|
|
46
|
-
return Promise.reject(nextResponse);
|
|
47
|
-
}
|
|
2
|
+
//#region adaptors/fetch.ts
|
|
3
|
+
const jsonDataAttachResponse = async (response) => {
|
|
4
|
+
const cloned = response.clone();
|
|
5
|
+
let data = {};
|
|
6
|
+
switch (cloned.headers.get("Content-Type")?.split(";")[0].trim() || "") {
|
|
7
|
+
case "application/json":
|
|
8
|
+
data = await cloned.json();
|
|
9
|
+
break;
|
|
10
|
+
default:
|
|
11
|
+
data = await cloned.text();
|
|
12
|
+
break;
|
|
13
|
+
}
|
|
14
|
+
const nextResponse = Object.assign({}, response, { data });
|
|
15
|
+
if (response.ok) return nextResponse;
|
|
16
|
+
else return Promise.reject(nextResponse);
|
|
48
17
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
18
|
+
/**
|
|
19
|
+
* transform options to fetch options
|
|
20
|
+
* @param options
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
const parseOptions = (options) => {
|
|
24
|
+
const { headers = {}, data, ...rest } = options;
|
|
25
|
+
if (typeof data === "object" && !(data instanceof FormData)) {
|
|
26
|
+
const key = "Content-Type";
|
|
27
|
+
const value = "application/json";
|
|
28
|
+
if (Array.isArray(headers)) headers.push([key, value]);
|
|
29
|
+
else if (Object.prototype.toString.call(headers) === "[object Object]") headers[key] = value;
|
|
30
|
+
else if (headers instanceof Headers) headers.append(key, value);
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
headers,
|
|
34
|
+
body: typeof data === "object" ? JSON.stringify(data) : data,
|
|
35
|
+
...rest
|
|
36
|
+
};
|
|
67
37
|
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
method: "PUT"
|
|
104
|
-
});
|
|
105
|
-
return jsonDataAttachResponse(response);
|
|
106
|
-
},
|
|
107
|
-
responseWrapper: {}
|
|
108
|
-
});
|
|
109
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
110
|
-
0 && (module.exports = {
|
|
111
|
-
fetchAdaptor
|
|
38
|
+
const fetchAdaptor = Object.preventExtensions({
|
|
39
|
+
get default() {
|
|
40
|
+
return fetch;
|
|
41
|
+
},
|
|
42
|
+
async delete(url, options) {
|
|
43
|
+
return jsonDataAttachResponse(await fetch(url, {
|
|
44
|
+
...options,
|
|
45
|
+
method: "DELETE"
|
|
46
|
+
}));
|
|
47
|
+
},
|
|
48
|
+
async get(url, options) {
|
|
49
|
+
return jsonDataAttachResponse(await fetch(url, {
|
|
50
|
+
...options,
|
|
51
|
+
method: "GET"
|
|
52
|
+
}));
|
|
53
|
+
},
|
|
54
|
+
async patch(url, options) {
|
|
55
|
+
return jsonDataAttachResponse(await fetch(url, {
|
|
56
|
+
...parseOptions(options),
|
|
57
|
+
method: "PATCH"
|
|
58
|
+
}));
|
|
59
|
+
},
|
|
60
|
+
async post(url, options) {
|
|
61
|
+
return jsonDataAttachResponse(await fetch(url, {
|
|
62
|
+
...parseOptions(options),
|
|
63
|
+
method: "POST"
|
|
64
|
+
}));
|
|
65
|
+
},
|
|
66
|
+
async put(url, options) {
|
|
67
|
+
return jsonDataAttachResponse(await fetch(url, {
|
|
68
|
+
...parseOptions(options),
|
|
69
|
+
method: "PUT"
|
|
70
|
+
}));
|
|
71
|
+
},
|
|
72
|
+
responseWrapper: {}
|
|
112
73
|
});
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
76
|
+
exports.fetchAdaptor = fetchAdaptor;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as IRequestAdapter } from "../adapter-B1dtiutp.cjs";
|
|
2
2
|
|
|
3
|
+
//#region adaptors/fetch.d.ts
|
|
3
4
|
declare const fetchAdaptor: IRequestAdapter<typeof fetch>;
|
|
4
|
-
|
|
5
|
-
export { fetchAdaptor };
|
|
5
|
+
//#endregion
|
|
6
|
+
export { fetchAdaptor };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
//#region adaptors/fetch.ts
|
|
2
|
+
const jsonDataAttachResponse = async (response) => {
|
|
3
|
+
const cloned = response.clone();
|
|
4
|
+
let data = {};
|
|
5
|
+
switch (cloned.headers.get("Content-Type")?.split(";")[0].trim() || "") {
|
|
6
|
+
case "application/json":
|
|
7
|
+
data = await cloned.json();
|
|
8
|
+
break;
|
|
9
|
+
default:
|
|
10
|
+
data = await cloned.text();
|
|
11
|
+
break;
|
|
12
|
+
}
|
|
13
|
+
const nextResponse = Object.assign({}, response, { data });
|
|
14
|
+
if (response.ok) return nextResponse;
|
|
15
|
+
else return Promise.reject(nextResponse);
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* transform options to fetch options
|
|
19
|
+
* @param options
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
const parseOptions = (options) => {
|
|
23
|
+
const { headers = {}, data, ...rest } = options;
|
|
24
|
+
if (typeof data === "object" && !(data instanceof FormData)) {
|
|
25
|
+
const key = "Content-Type";
|
|
26
|
+
const value = "application/json";
|
|
27
|
+
if (Array.isArray(headers)) headers.push([key, value]);
|
|
28
|
+
else if (Object.prototype.toString.call(headers) === "[object Object]") headers[key] = value;
|
|
29
|
+
else if (headers instanceof Headers) headers.append(key, value);
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
headers,
|
|
33
|
+
body: typeof data === "object" ? JSON.stringify(data) : data,
|
|
34
|
+
...rest
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
const fetchAdaptor = Object.preventExtensions({
|
|
38
|
+
get default() {
|
|
39
|
+
return fetch;
|
|
40
|
+
},
|
|
41
|
+
async delete(url, options) {
|
|
42
|
+
return jsonDataAttachResponse(await fetch(url, {
|
|
43
|
+
...options,
|
|
44
|
+
method: "DELETE"
|
|
45
|
+
}));
|
|
46
|
+
},
|
|
47
|
+
async get(url, options) {
|
|
48
|
+
return jsonDataAttachResponse(await fetch(url, {
|
|
49
|
+
...options,
|
|
50
|
+
method: "GET"
|
|
51
|
+
}));
|
|
52
|
+
},
|
|
53
|
+
async patch(url, options) {
|
|
54
|
+
return jsonDataAttachResponse(await fetch(url, {
|
|
55
|
+
...parseOptions(options),
|
|
56
|
+
method: "PATCH"
|
|
57
|
+
}));
|
|
58
|
+
},
|
|
59
|
+
async post(url, options) {
|
|
60
|
+
return jsonDataAttachResponse(await fetch(url, {
|
|
61
|
+
...parseOptions(options),
|
|
62
|
+
method: "POST"
|
|
63
|
+
}));
|
|
64
|
+
},
|
|
65
|
+
async put(url, options) {
|
|
66
|
+
return jsonDataAttachResponse(await fetch(url, {
|
|
67
|
+
...parseOptions(options),
|
|
68
|
+
method: "PUT"
|
|
69
|
+
}));
|
|
70
|
+
},
|
|
71
|
+
responseWrapper: {}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
//#endregion
|
|
75
|
+
export { fetchAdaptor };
|
|
@@ -1,58 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
const require_adaptors_axios = require('./axios.cjs');
|
|
3
|
+
let umi_request = require("umi-request");
|
|
19
4
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
5
|
+
//#region adaptors/umi-request.ts
|
|
6
|
+
const $http = /* @__PURE__ */ (0, umi_request.extend)({
|
|
7
|
+
getResponse: true,
|
|
8
|
+
requestType: "json",
|
|
9
|
+
responseType: "json"
|
|
25
10
|
});
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
delete(url, options) {
|
|
48
|
-
return $http.delete(url, options);
|
|
49
|
-
},
|
|
50
|
-
patch(url, options) {
|
|
51
|
-
return $http.patch(url, options);
|
|
52
|
-
}
|
|
11
|
+
const umiAdaptor = Object.preventExtensions({
|
|
12
|
+
get default() {
|
|
13
|
+
return $http;
|
|
14
|
+
},
|
|
15
|
+
responseWrapper: {},
|
|
16
|
+
get(url, options) {
|
|
17
|
+
return $http.get(url, options);
|
|
18
|
+
},
|
|
19
|
+
post(url, options) {
|
|
20
|
+
return $http.post(url, options);
|
|
21
|
+
},
|
|
22
|
+
put(url, options) {
|
|
23
|
+
return $http.put(url, options);
|
|
24
|
+
},
|
|
25
|
+
delete(url, options) {
|
|
26
|
+
return $http.delete(url, options);
|
|
27
|
+
},
|
|
28
|
+
patch(url, options) {
|
|
29
|
+
return $http.patch(url, options);
|
|
30
|
+
}
|
|
53
31
|
});
|
|
54
32
|
var umi_request_default = umiAdaptor;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
exports.default = umi_request_default;
|
|
36
|
+
exports.umiAdaptor = umiAdaptor;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { RequestMethod, RequestResponse } from
|
|
1
|
+
import { n as IRequestAdapter } from "../adapter-B1dtiutp.cjs";
|
|
2
|
+
import { RequestMethod, RequestResponse } from "umi-request";
|
|
3
3
|
|
|
4
|
+
//#region adaptors/umi-request.d.ts
|
|
4
5
|
declare const umiAdaptor: IRequestAdapter<RequestMethod<true>, RequestResponse>;
|
|
5
|
-
|
|
6
|
-
export { umiAdaptor as default, umiAdaptor };
|
|
6
|
+
//#endregion
|
|
7
|
+
export { umiAdaptor as default, umiAdaptor };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { n as IRequestAdapter } from "../adapter-CRsPadpS.mjs";
|
|
2
|
+
import { RequestMethod, RequestResponse } from "umi-request";
|
|
3
|
+
|
|
4
|
+
//#region adaptors/umi-request.d.ts
|
|
5
|
+
declare const umiAdaptor: IRequestAdapter<RequestMethod<true>, RequestResponse>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { umiAdaptor as default, umiAdaptor };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { extend } from "umi-request";
|
|
2
|
+
|
|
3
|
+
//#region adaptors/umi-request.ts
|
|
4
|
+
const $http = /* @__PURE__ */ extend({
|
|
5
|
+
getResponse: true,
|
|
6
|
+
requestType: "json",
|
|
7
|
+
responseType: "json"
|
|
8
|
+
});
|
|
9
|
+
const umiAdaptor = Object.preventExtensions({
|
|
10
|
+
get default() {
|
|
11
|
+
return $http;
|
|
12
|
+
},
|
|
13
|
+
responseWrapper: {},
|
|
14
|
+
get(url, options) {
|
|
15
|
+
return $http.get(url, options);
|
|
16
|
+
},
|
|
17
|
+
post(url, options) {
|
|
18
|
+
return $http.post(url, options);
|
|
19
|
+
},
|
|
20
|
+
put(url, options) {
|
|
21
|
+
return $http.put(url, options);
|
|
22
|
+
},
|
|
23
|
+
delete(url, options) {
|
|
24
|
+
return $http.delete(url, options);
|
|
25
|
+
},
|
|
26
|
+
patch(url, options) {
|
|
27
|
+
return $http.patch(url, options);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var umi_request_default = umiAdaptor;
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
export { umi_request_default as default, umiAdaptor };
|