@mx-space/api-client 1.3.5 → 1.4.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.
- package/.eslintcache +1 -1
- package/controllers/aggregate.ts +7 -7
- package/controllers/base.ts +4 -4
- package/controllers/category.ts +12 -11
- package/controllers/comment.ts +9 -9
- package/controllers/link.ts +4 -3
- package/controllers/note.ts +9 -9
- package/controllers/page.ts +8 -8
- package/controllers/post.ts +8 -8
- package/controllers/project.ts +4 -3
- package/controllers/recently.ts +6 -6
- package/controllers/say.ts +6 -5
- package/controllers/search.ts +9 -9
- package/controllers/severless.ts +5 -5
- package/controllers/snippet.ts +5 -5
- package/controllers/subscribe.ts +6 -6
- package/controllers/topic.ts +6 -5
- package/controllers/user.ts +6 -6
- package/coverage/clover.xml +591 -0
- package/coverage/coverage-final.json +5944 -0
- package/coverage/lcov-report/adaptors/axios.ts.html +201 -0
- package/coverage/lcov-report/adaptors/index.html +196 -0
- package/coverage/lcov-report/adaptors/umi-request.ts.html +186 -0
- package/coverage/lcov-report/auto-bind.ts.html +228 -0
- package/coverage/lcov-report/base.css +354 -0
- package/coverage/lcov-report/block-navigation.js +85 -0
- package/coverage/lcov-report/controllers/aggregate.ts.html +294 -0
- package/coverage/lcov-report/controllers/base.ts.html +183 -0
- package/coverage/lcov-report/controllers/category.ts.html +441 -0
- package/coverage/lcov-report/controllers/comment.ts.html +291 -0
- package/coverage/lcov-report/controllers/index.html +476 -0
- package/coverage/lcov-report/controllers/index.ts.html +297 -0
- package/coverage/lcov-report/controllers/link.ts.html +216 -0
- package/coverage/lcov-report/controllers/note.ts.html +375 -0
- package/coverage/lcov-report/controllers/page.ts.html +279 -0
- package/coverage/lcov-report/controllers/post.ts.html +369 -0
- package/coverage/lcov-report/controllers/project.ts.html +168 -0
- package/coverage/lcov-report/controllers/recently.ts.html +246 -0
- package/coverage/lcov-report/controllers/say.ts.html +207 -0
- package/coverage/lcov-report/controllers/search.ts.html +411 -0
- package/coverage/lcov-report/controllers/severless.ts.html +180 -0
- package/coverage/lcov-report/controllers/snippet.ts.html +195 -0
- package/coverage/lcov-report/controllers/user.ts.html +240 -0
- package/coverage/lcov-report/core/attach-request.ts.html +216 -0
- package/coverage/lcov-report/core/client.ts.html +786 -0
- package/coverage/lcov-report/core/error.ts.html +117 -0
- package/coverage/lcov-report/core/index.html +236 -0
- package/coverage/lcov-report/core/index.ts.html +93 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +276 -0
- package/coverage/lcov-report/index.ts.html +243 -0
- package/coverage/lcov-report/models/aggregate.ts.html +300 -0
- package/coverage/lcov-report/models/category.ts.html +162 -0
- package/coverage/lcov-report/models/index.html +196 -0
- package/coverage/lcov-report/prettify.css +101 -0
- package/coverage/lcov-report/prettify.js +1004 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +191 -0
- package/coverage/lcov-report/utils/auto-bind.ts.html +231 -0
- package/coverage/lcov-report/utils/index.html +216 -0
- package/coverage/lcov-report/utils/index.ts.html +246 -0
- package/coverage/lcov-report/utils/path.ts.html +105 -0
- package/coverage/lcov.info +1209 -0
- package/dist/adaptors/axios.d.ts +1 -1
- package/dist/adaptors/axios.global.js +146 -95
- package/dist/adaptors/ky.global.js +13 -12
- package/dist/adaptors/umi-request.d.ts +1 -1
- package/dist/adaptors/umi-request.global.js +22 -13
- package/dist/index.cjs +21 -13
- package/dist/index.d.ts +22 -193
- package/dist/index.global.js +21 -13
- package/dist/index.js +21 -13
- package/interfaces/adapter.ts +1 -1
- package/interfaces/client.ts +2 -2
- package/interfaces/request.ts +3 -1
- package/models/aggregate.ts +20 -9
- package/models/base.ts +0 -2
- package/models/category.ts +2 -2
- package/models/comment.ts +2 -2
- package/models/link.ts +1 -1
- package/models/note.ts +2 -2
- package/models/page.ts +1 -1
- package/models/post.ts +2 -2
- package/models/project.ts +1 -1
- package/models/recently.ts +1 -1
- package/models/say.ts +1 -1
- package/models/snippet.ts +1 -1
- package/models/subscribe.ts +1 -1
- package/models/topic.ts +1 -1
- package/models/user.ts +1 -1
- package/package.json +10 -23
- package/tsconfig.json +1 -1
package/dist/index.global.js
CHANGED
|
@@ -29,13 +29,14 @@
|
|
|
29
29
|
if (!from || !isObject(to)) {
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
;
|
|
33
|
+
["$raw", "$request", "$serialized"].forEach((key) => {
|
|
34
|
+
from[key] && Object.defineProperty(to, key, {
|
|
35
|
+
get() {
|
|
36
|
+
return from[key];
|
|
37
|
+
},
|
|
38
|
+
enumerable: false
|
|
39
|
+
});
|
|
39
40
|
});
|
|
40
41
|
};
|
|
41
42
|
|
|
@@ -909,16 +910,18 @@
|
|
|
909
910
|
if (!data) {
|
|
910
911
|
return null;
|
|
911
912
|
}
|
|
912
|
-
const
|
|
913
|
-
|
|
914
|
-
|
|
913
|
+
const cameledObject = (Array.isArray(data) || isPlainObject(data)) && that.options.transformResponse ? that.options.transformResponse(data) : data;
|
|
914
|
+
let nextObject = cameledObject;
|
|
915
|
+
if (cameledObject && typeof cameledObject === "object") {
|
|
916
|
+
nextObject = { ...cameledObject };
|
|
917
|
+
Object.defineProperty(nextObject, "$raw", {
|
|
915
918
|
get() {
|
|
916
919
|
return res;
|
|
917
920
|
},
|
|
918
921
|
enumerable: false,
|
|
919
922
|
configurable: false
|
|
920
923
|
});
|
|
921
|
-
Object.defineProperty(
|
|
924
|
+
Object.defineProperty(nextObject, "$request", {
|
|
922
925
|
get() {
|
|
923
926
|
return {
|
|
924
927
|
url,
|
|
@@ -928,8 +931,13 @@
|
|
|
928
931
|
},
|
|
929
932
|
enumerable: false
|
|
930
933
|
});
|
|
934
|
+
Object.defineProperty(nextObject, "$serialized", {
|
|
935
|
+
get() {
|
|
936
|
+
return cameledObject;
|
|
937
|
+
}
|
|
938
|
+
});
|
|
931
939
|
}
|
|
932
|
-
return
|
|
940
|
+
return nextObject;
|
|
933
941
|
};
|
|
934
942
|
}
|
|
935
943
|
route.push(name);
|
|
@@ -1021,7 +1029,7 @@
|
|
|
1021
1029
|
return SnippetType2;
|
|
1022
1030
|
})(SnippetType || {});
|
|
1023
1031
|
|
|
1024
|
-
// ../../src/modules/subscribe/subscribe.constant.ts
|
|
1032
|
+
// ../../apps/core/src/modules/subscribe/subscribe.constant.ts
|
|
1025
1033
|
var SubscribePostCreateBit = 1 << 0;
|
|
1026
1034
|
var SubscribeNoteCreateBit = 1 << 1;
|
|
1027
1035
|
var SubscribeSayCreateBit = 1 << 2;
|
package/dist/index.js
CHANGED
|
@@ -27,13 +27,14 @@ var attachRawFromOneToAnthor = (from, to) => {
|
|
|
27
27
|
if (!from || !isObject(to)) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
;
|
|
31
|
+
["$raw", "$request", "$serialized"].forEach((key) => {
|
|
32
|
+
from[key] && Object.defineProperty(to, key, {
|
|
33
|
+
get() {
|
|
34
|
+
return from[key];
|
|
35
|
+
},
|
|
36
|
+
enumerable: false
|
|
37
|
+
});
|
|
37
38
|
});
|
|
38
39
|
};
|
|
39
40
|
|
|
@@ -907,16 +908,18 @@ var HTTPClient = class {
|
|
|
907
908
|
if (!data) {
|
|
908
909
|
return null;
|
|
909
910
|
}
|
|
910
|
-
const
|
|
911
|
-
|
|
912
|
-
|
|
911
|
+
const cameledObject = (Array.isArray(data) || isPlainObject(data)) && that.options.transformResponse ? that.options.transformResponse(data) : data;
|
|
912
|
+
let nextObject = cameledObject;
|
|
913
|
+
if (cameledObject && typeof cameledObject === "object") {
|
|
914
|
+
nextObject = { ...cameledObject };
|
|
915
|
+
Object.defineProperty(nextObject, "$raw", {
|
|
913
916
|
get() {
|
|
914
917
|
return res;
|
|
915
918
|
},
|
|
916
919
|
enumerable: false,
|
|
917
920
|
configurable: false
|
|
918
921
|
});
|
|
919
|
-
Object.defineProperty(
|
|
922
|
+
Object.defineProperty(nextObject, "$request", {
|
|
920
923
|
get() {
|
|
921
924
|
return {
|
|
922
925
|
url,
|
|
@@ -926,8 +929,13 @@ var HTTPClient = class {
|
|
|
926
929
|
},
|
|
927
930
|
enumerable: false
|
|
928
931
|
});
|
|
932
|
+
Object.defineProperty(nextObject, "$serialized", {
|
|
933
|
+
get() {
|
|
934
|
+
return cameledObject;
|
|
935
|
+
}
|
|
936
|
+
});
|
|
929
937
|
}
|
|
930
|
-
return
|
|
938
|
+
return nextObject;
|
|
931
939
|
};
|
|
932
940
|
}
|
|
933
941
|
route.push(name);
|
|
@@ -1019,7 +1027,7 @@ var SnippetType = /* @__PURE__ */ ((SnippetType2) => {
|
|
|
1019
1027
|
return SnippetType2;
|
|
1020
1028
|
})(SnippetType || {});
|
|
1021
1029
|
|
|
1022
|
-
// ../../src/modules/subscribe/subscribe.constant.ts
|
|
1030
|
+
// ../../apps/core/src/modules/subscribe/subscribe.constant.ts
|
|
1023
1031
|
var SubscribePostCreateBit = 1 << 0;
|
|
1024
1032
|
var SubscribeNoteCreateBit = 1 << 1;
|
|
1025
1033
|
var SubscribeSayCreateBit = 1 << 2;
|
package/interfaces/adapter.ts
CHANGED
package/interfaces/client.ts
CHANGED
package/interfaces/request.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RequestOptions } from './instance'
|
|
1
|
+
import type { RequestOptions } from './instance'
|
|
2
2
|
|
|
3
3
|
type NoStringIndex<T> = { [K in keyof T as string extends K ? never : K]: T[K] }
|
|
4
4
|
|
|
@@ -70,6 +70,8 @@ type ResponseWrapperType<Response, RawData, T> = {
|
|
|
70
70
|
method: string
|
|
71
71
|
[k: string]: string
|
|
72
72
|
}
|
|
73
|
+
|
|
74
|
+
$serialized: T
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
export type ResponseProxyExtraRaw<
|
package/models/aggregate.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { CategoryModel } from './category'
|
|
2
|
-
import { NoteModel } from './note'
|
|
3
|
-
import { PageModel } from './page'
|
|
4
|
-
import { PostModel } from './post'
|
|
5
|
-
import { SayModel } from './say'
|
|
6
|
-
import { SeoOptionModel } from './setting'
|
|
7
|
-
import { UserModel } from './user'
|
|
1
|
+
import type { CategoryModel } from './category'
|
|
2
|
+
import type { NoteModel } from './note'
|
|
3
|
+
import type { PageModel } from './page'
|
|
4
|
+
import type { PostModel } from './post'
|
|
5
|
+
import type { SayModel } from './say'
|
|
6
|
+
import type { SeoOptionModel } from './setting'
|
|
7
|
+
import type { UserModel } from './user'
|
|
8
8
|
|
|
9
9
|
export interface AggregateRoot {
|
|
10
10
|
user: UserModel
|
|
@@ -20,9 +20,20 @@ export interface Url {
|
|
|
20
20
|
webUrl: string
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
24
|
+
export interface AggregateTopNote
|
|
25
|
+
extends Pick<NoteModel, 'id' | 'title' | 'created' | 'nid' | 'images'> {}
|
|
26
|
+
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
28
|
+
export interface AggregateTopPost
|
|
29
|
+
extends Pick<
|
|
30
|
+
PostModel,
|
|
31
|
+
'id' | 'slug' | 'created' | 'title' | 'category' | 'images'
|
|
32
|
+
> {}
|
|
33
|
+
|
|
23
34
|
export interface AggregateTop {
|
|
24
|
-
notes:
|
|
25
|
-
posts:
|
|
35
|
+
notes: AggregateTopNote[]
|
|
36
|
+
posts: AggregateTopPost[]
|
|
26
37
|
says: SayModel[]
|
|
27
38
|
}
|
|
28
39
|
|
package/models/base.ts
CHANGED
package/models/category.ts
CHANGED
package/models/comment.ts
CHANGED
package/models/link.ts
CHANGED
package/models/note.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ModelWithLiked, TextBaseModel } from './base'
|
|
2
|
-
import { TopicModel } from './topic'
|
|
1
|
+
import type { ModelWithLiked, TextBaseModel } from './base'
|
|
2
|
+
import type { TopicModel } from './topic'
|
|
3
3
|
|
|
4
4
|
export interface NoteModel extends TextBaseModel {
|
|
5
5
|
hide: boolean
|
package/models/page.ts
CHANGED
package/models/post.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Count, Image, TextBaseModel } from './base'
|
|
2
|
-
import { CategoryModel } from './category'
|
|
1
|
+
import type { Count, Image, TextBaseModel } from './base'
|
|
2
|
+
import type { CategoryModel } from './category'
|
|
3
3
|
|
|
4
4
|
export interface PostModel extends TextBaseModel {
|
|
5
5
|
summary?: string
|
package/models/project.ts
CHANGED
package/models/recently.ts
CHANGED
package/models/say.ts
CHANGED
package/models/snippet.ts
CHANGED
package/models/subscribe.ts
CHANGED
package/models/topic.ts
CHANGED
package/models/user.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mx-space/api-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A api client for mx-space server@next",
|
|
6
6
|
"author": "Innei",
|
|
@@ -24,11 +24,6 @@
|
|
|
24
24
|
},
|
|
25
25
|
"./package.json": "./package.json"
|
|
26
26
|
},
|
|
27
|
-
"husky": {
|
|
28
|
-
"hooks": {
|
|
29
|
-
"pre-commit": "lint-staged"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
27
|
"bump": {
|
|
33
28
|
"before": [
|
|
34
29
|
"git pull --rebase",
|
|
@@ -41,15 +36,6 @@
|
|
|
41
36
|
"tag": false,
|
|
42
37
|
"commit_message": "chore(release): bump @mx-space/api-client to v${NEW_VERSION}"
|
|
43
38
|
},
|
|
44
|
-
"lint-staged": {
|
|
45
|
-
"*.{js,jsx,ts,tsx}": [
|
|
46
|
-
"prettier --ignore-path ./.prettierignore --write ",
|
|
47
|
-
"eslint --cache"
|
|
48
|
-
]
|
|
49
|
-
},
|
|
50
|
-
"engines": {
|
|
51
|
-
"pnpm": ">=6"
|
|
52
|
-
},
|
|
53
39
|
"scripts": {
|
|
54
40
|
"package": "rm -rf dist && tsup && node mod-dts.mjs",
|
|
55
41
|
"build": "npm run package",
|
|
@@ -60,17 +46,18 @@
|
|
|
60
46
|
"devDependencies": {
|
|
61
47
|
"@types/cors": "2.8.13",
|
|
62
48
|
"@types/express": "4.17.17",
|
|
63
|
-
"@types/lodash": "4.14.
|
|
49
|
+
"@types/lodash": "4.14.195",
|
|
64
50
|
"abort-controller": "3.0.0",
|
|
65
|
-
"axios": "^1.
|
|
66
|
-
"camelcase-keys": "
|
|
51
|
+
"axios": "^1.4.0",
|
|
52
|
+
"camelcase-keys": "^7.0.2",
|
|
67
53
|
"cors": "2.8.5",
|
|
68
54
|
"express": "4.18.2",
|
|
69
|
-
"ky": "0.33.
|
|
55
|
+
"ky": "0.33.3",
|
|
70
56
|
"lodash": "4.17.21",
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
57
|
+
"tsup": "6.7.0",
|
|
58
|
+
"umi-request": "1.4.0",
|
|
59
|
+
"vitest": "^0.31.4",
|
|
60
|
+
"vite": "^4.3.9",
|
|
61
|
+
"form-data": "4.0.0"
|
|
75
62
|
}
|
|
76
63
|
}
|