@mx-space/api-client 1.14.3 → 1.16.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/comment.ts +9 -6
- package/controllers/index.ts +6 -7
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +23 -6
- package/dist/index.d.ts +23 -6
- package/dist/index.global.js +2 -2
- package/dist/index.js +2 -2
- package/models/comment.ts +1 -0
- package/models/index.ts +1 -0
- package/models/reader.ts +9 -0
- package/package.json +2 -2
package/controllers/comment.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { IRequestAdapter } from '~/interfaces/adapter'
|
|
|
2
2
|
import type { IController } from '~/interfaces/controller'
|
|
3
3
|
import type { PaginationParams } from '~/interfaces/params'
|
|
4
4
|
import type { IRequestHandler } from '~/interfaces/request'
|
|
5
|
+
import type { ReaderModel } from '~/models'
|
|
5
6
|
import type { PaginateResult } from '~/models/base'
|
|
6
7
|
import type { CommentModel } from '~/models/comment'
|
|
7
8
|
import type { HTTPClient } from '../core'
|
|
@@ -31,7 +32,7 @@ export class CommentController<ResponseWrapper> implements IController {
|
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
/**
|
|
34
|
-
* 根据 comment id
|
|
35
|
+
* 根据 comment id 获取评论,包括子评论
|
|
35
36
|
*/
|
|
36
37
|
getById(id: string) {
|
|
37
38
|
return this.proxy(id).get<CommentModel & { ref: string }>()
|
|
@@ -43,11 +44,13 @@ export class CommentController<ResponseWrapper> implements IController {
|
|
|
43
44
|
*/
|
|
44
45
|
getByRefId(refId: string, pagination: PaginationParams = {}) {
|
|
45
46
|
const { page, size } = pagination
|
|
46
|
-
return this.proxy
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
return this.proxy.ref(refId).get<
|
|
48
|
+
PaginateResult<CommentModel & { ref: string }> & {
|
|
49
|
+
readers: Record<string, ReaderModel>
|
|
50
|
+
}
|
|
51
|
+
>({
|
|
52
|
+
params: { page: page || 1, size: size || 10 },
|
|
53
|
+
})
|
|
51
54
|
}
|
|
52
55
|
/**
|
|
53
56
|
* 评论
|
package/controllers/index.ts
CHANGED
|
@@ -72,10 +72,10 @@ export const allControllerNames = [
|
|
|
72
72
|
] as const
|
|
73
73
|
|
|
74
74
|
export {
|
|
75
|
-
AIController,
|
|
76
75
|
AckController,
|
|
77
76
|
ActivityController,
|
|
78
77
|
AggregateController,
|
|
78
|
+
AIController,
|
|
79
79
|
CategoryController,
|
|
80
80
|
CommentController,
|
|
81
81
|
LinkController,
|
|
@@ -83,16 +83,15 @@ export {
|
|
|
83
83
|
PageController,
|
|
84
84
|
PostController,
|
|
85
85
|
ProjectController,
|
|
86
|
+
// Enum
|
|
87
|
+
RecentlyAttitudeEnum,
|
|
88
|
+
RecentlyAttitudeResultEnum,
|
|
86
89
|
RecentlyController,
|
|
87
90
|
SayController,
|
|
88
91
|
SearchController,
|
|
89
|
-
SnippetController,
|
|
90
92
|
ServerlessController,
|
|
93
|
+
SnippetController,
|
|
91
94
|
SubscribeController,
|
|
92
|
-
UserController,
|
|
93
95
|
TopicController,
|
|
94
|
-
|
|
95
|
-
// Enum
|
|
96
|
-
RecentlyAttitudeEnum,
|
|
97
|
-
RecentlyAttitudeResultEnum,
|
|
96
|
+
UserController,
|
|
98
97
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -438,7 +438,7 @@ var CommentController = class {
|
|
|
438
438
|
return this.client.proxy(this.base);
|
|
439
439
|
}
|
|
440
440
|
/**
|
|
441
|
-
* 根据 comment id
|
|
441
|
+
* 根据 comment id 获取评论,包括子评论
|
|
442
442
|
*/
|
|
443
443
|
getById(id) {
|
|
444
444
|
return this.proxy(id).get();
|
|
@@ -999,7 +999,7 @@ var HTTPClient = class {
|
|
|
999
999
|
this._endpoint = _endpoint;
|
|
1000
1000
|
this._adaptor = _adaptor;
|
|
1001
1001
|
this.options = options;
|
|
1002
|
-
this._endpoint = _endpoint.replace(/\/*$/, "")
|
|
1002
|
+
this._endpoint = _endpoint.replace(/\/*$/, "");
|
|
1003
1003
|
this._proxy = this.buildRoute(this)();
|
|
1004
1004
|
options.transformResponse || (options.transformResponse = (data) => camelcaseKeys(data));
|
|
1005
1005
|
options.getDataFromResponse || (options.getDataFromResponse = (res) => res.data);
|
package/dist/index.d.cts
CHANGED
|
@@ -571,6 +571,7 @@ interface CommentModel extends BaseModel {
|
|
|
571
571
|
isWhispers?: boolean;
|
|
572
572
|
location?: string;
|
|
573
573
|
source?: string;
|
|
574
|
+
readerId?: string;
|
|
574
575
|
}
|
|
575
576
|
interface CommentRef {
|
|
576
577
|
id: string;
|
|
@@ -618,6 +619,14 @@ interface ProjectModel extends BaseModel {
|
|
|
618
619
|
text: string;
|
|
619
620
|
}
|
|
620
621
|
|
|
622
|
+
interface ReaderModel {
|
|
623
|
+
email: string;
|
|
624
|
+
name: string;
|
|
625
|
+
handle: string;
|
|
626
|
+
image: string;
|
|
627
|
+
isOwner: boolean;
|
|
628
|
+
}
|
|
629
|
+
|
|
621
630
|
declare enum RecentlyRefTypes {
|
|
622
631
|
Post = "Post",
|
|
623
632
|
Note = "Note",
|
|
@@ -1103,7 +1112,7 @@ declare class CommentController<ResponseWrapper> implements IController {
|
|
|
1103
1112
|
constructor(client: HTTPClient);
|
|
1104
1113
|
get proxy(): IRequestHandler<ResponseWrapper>;
|
|
1105
1114
|
/**
|
|
1106
|
-
* 根据 comment id
|
|
1115
|
+
* 根据 comment id 获取评论,包括子评论
|
|
1107
1116
|
*/
|
|
1108
1117
|
getById(id: string): RequestProxyResult<CommentModel & {
|
|
1109
1118
|
ref: string;
|
|
@@ -1127,19 +1136,27 @@ declare class CommentController<ResponseWrapper> implements IController {
|
|
|
1127
1136
|
*/
|
|
1128
1137
|
getByRefId(refId: string, pagination?: PaginationParams): RequestProxyResult<PaginateResult<CommentModel & {
|
|
1129
1138
|
ref: string;
|
|
1130
|
-
}
|
|
1139
|
+
}> & {
|
|
1140
|
+
readers: Record<string, ReaderModel>;
|
|
1141
|
+
}, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
1131
1142
|
[key: string]: any;
|
|
1132
1143
|
data: PaginateResult<CommentModel & {
|
|
1133
1144
|
ref: string;
|
|
1134
|
-
}
|
|
1145
|
+
}> & {
|
|
1146
|
+
readers: Record<string, ReaderModel>;
|
|
1147
|
+
};
|
|
1135
1148
|
} : ResponseWrapper extends {
|
|
1136
1149
|
data: PaginateResult<CommentModel & {
|
|
1137
1150
|
ref: string;
|
|
1138
|
-
}
|
|
1151
|
+
}> & {
|
|
1152
|
+
readers: Record<string, ReaderModel>;
|
|
1153
|
+
};
|
|
1139
1154
|
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
1140
1155
|
data: PaginateResult<CommentModel & {
|
|
1141
1156
|
ref: string;
|
|
1142
|
-
}
|
|
1157
|
+
}> & {
|
|
1158
|
+
readers: Record<string, ReaderModel>;
|
|
1159
|
+
};
|
|
1143
1160
|
}>;
|
|
1144
1161
|
/**
|
|
1145
1162
|
* 评论
|
|
@@ -1880,4 +1897,4 @@ declare const allControllerNames: readonly ["ai", "ack", "activity", "aggregate"
|
|
|
1880
1897
|
*/
|
|
1881
1898
|
declare const camelcaseKeys: <T = any>(obj: any) => T;
|
|
1882
1899
|
|
|
1883
|
-
export { AIController, type AISummaryModel, AckController, ActivityController, type ActivityPresence, AdminExtraModel, AggregateController, type AggregateRoot, type AggregateRootWithTheme, type AggregateStat, type AggregateTop, type AggregateTopNote, type AggregateTopPost, AlgoliaSearchOptionsModel, type AuthUser, BackupOptionsModel, BaiduSearchOptionsModel, type BaseCommentIndexModel, type BaseModel, CategoryController, type CategoryEntries, type CategoryModel, CategoryType, type CategoryWithChildrenModel, CollectionRefTypes, CommentController, type CommentDto, type CommentModel, CommentOptionsModel, type CommentRef, CommentState, type Coordinate, type Count, EnumPageType, HTTPClient, type IConfig, type IConfigKeys, IRequestAdapter, type Image, type LastYearPublication, LinkController, type LinkModel, LinkState, LinkType, MailOptionsModel, type ModelWithLiked, NoteController, type NoteModel, type NoteWrappedPayload, type NoteWrappedWithLikedPayload, PageController, type PageModel, type Pager, type PaginateResult, PostController, type PostModel, ProjectController, type ProjectModel, type RecentActivities, type RecentComment, type RecentLike, type RecentNote, type RecentPost, type RecentRecent, RecentlyAttitudeEnum, RecentlyAttitudeResultEnum, RecentlyController, type RecentlyModel, type RecentlyRefType, RecentlyRefTypes, RequestError, type RoomOmittedNote, type RoomOmittedPage, type RoomOmittedPost, type RoomsData, SayController, type SayModel, SearchController, SeoOptionModel, ServerlessController, SnippetController, type SnippetModel, SnippetType, SubscribeAllBit, SubscribeController, SubscribeNoteCreateBit, SubscribePostCreateBit, SubscribeRecentCreateBit, SubscribeSayCreateBit, type SubscribeType, SubscribeTypeToBitMap, type TLogin, type TagModel, type TextBaseModel, type TimelineData, TimelineType, TopicController, type TopicModel, type Url, UrlOptionModel, UserController, type UserModel, allControllerNames, allControllers, createClient, createClient as default, camelcaseKeys as simpleCamelcaseKeys };
|
|
1900
|
+
export { AIController, type AISummaryModel, AckController, ActivityController, type ActivityPresence, AdminExtraModel, AggregateController, type AggregateRoot, type AggregateRootWithTheme, type AggregateStat, type AggregateTop, type AggregateTopNote, type AggregateTopPost, AlgoliaSearchOptionsModel, type AuthUser, BackupOptionsModel, BaiduSearchOptionsModel, type BaseCommentIndexModel, type BaseModel, CategoryController, type CategoryEntries, type CategoryModel, CategoryType, type CategoryWithChildrenModel, CollectionRefTypes, CommentController, type CommentDto, type CommentModel, CommentOptionsModel, type CommentRef, CommentState, type Coordinate, type Count, EnumPageType, HTTPClient, type IConfig, type IConfigKeys, IRequestAdapter, type Image, type LastYearPublication, LinkController, type LinkModel, LinkState, LinkType, MailOptionsModel, type ModelWithLiked, NoteController, type NoteModel, type NoteWrappedPayload, type NoteWrappedWithLikedPayload, PageController, type PageModel, type Pager, type PaginateResult, PostController, type PostModel, ProjectController, type ProjectModel, type ReaderModel, type RecentActivities, type RecentComment, type RecentLike, type RecentNote, type RecentPost, type RecentRecent, RecentlyAttitudeEnum, RecentlyAttitudeResultEnum, RecentlyController, type RecentlyModel, type RecentlyRefType, RecentlyRefTypes, RequestError, type RoomOmittedNote, type RoomOmittedPage, type RoomOmittedPost, type RoomsData, SayController, type SayModel, SearchController, SeoOptionModel, ServerlessController, SnippetController, type SnippetModel, SnippetType, SubscribeAllBit, SubscribeController, SubscribeNoteCreateBit, SubscribePostCreateBit, SubscribeRecentCreateBit, SubscribeSayCreateBit, type SubscribeType, SubscribeTypeToBitMap, type TLogin, type TagModel, type TextBaseModel, type TimelineData, TimelineType, TopicController, type TopicModel, type Url, UrlOptionModel, UserController, type UserModel, allControllerNames, allControllers, createClient, createClient as default, camelcaseKeys as simpleCamelcaseKeys };
|
package/dist/index.d.ts
CHANGED
|
@@ -571,6 +571,7 @@ interface CommentModel extends BaseModel {
|
|
|
571
571
|
isWhispers?: boolean;
|
|
572
572
|
location?: string;
|
|
573
573
|
source?: string;
|
|
574
|
+
readerId?: string;
|
|
574
575
|
}
|
|
575
576
|
interface CommentRef {
|
|
576
577
|
id: string;
|
|
@@ -618,6 +619,14 @@ interface ProjectModel extends BaseModel {
|
|
|
618
619
|
text: string;
|
|
619
620
|
}
|
|
620
621
|
|
|
622
|
+
interface ReaderModel {
|
|
623
|
+
email: string;
|
|
624
|
+
name: string;
|
|
625
|
+
handle: string;
|
|
626
|
+
image: string;
|
|
627
|
+
isOwner: boolean;
|
|
628
|
+
}
|
|
629
|
+
|
|
621
630
|
declare enum RecentlyRefTypes {
|
|
622
631
|
Post = "Post",
|
|
623
632
|
Note = "Note",
|
|
@@ -1103,7 +1112,7 @@ declare class CommentController<ResponseWrapper> implements IController {
|
|
|
1103
1112
|
constructor(client: HTTPClient);
|
|
1104
1113
|
get proxy(): IRequestHandler<ResponseWrapper>;
|
|
1105
1114
|
/**
|
|
1106
|
-
* 根据 comment id
|
|
1115
|
+
* 根据 comment id 获取评论,包括子评论
|
|
1107
1116
|
*/
|
|
1108
1117
|
getById(id: string): RequestProxyResult<CommentModel & {
|
|
1109
1118
|
ref: string;
|
|
@@ -1127,19 +1136,27 @@ declare class CommentController<ResponseWrapper> implements IController {
|
|
|
1127
1136
|
*/
|
|
1128
1137
|
getByRefId(refId: string, pagination?: PaginationParams): RequestProxyResult<PaginateResult<CommentModel & {
|
|
1129
1138
|
ref: string;
|
|
1130
|
-
}
|
|
1139
|
+
}> & {
|
|
1140
|
+
readers: Record<string, ReaderModel>;
|
|
1141
|
+
}, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
1131
1142
|
[key: string]: any;
|
|
1132
1143
|
data: PaginateResult<CommentModel & {
|
|
1133
1144
|
ref: string;
|
|
1134
|
-
}
|
|
1145
|
+
}> & {
|
|
1146
|
+
readers: Record<string, ReaderModel>;
|
|
1147
|
+
};
|
|
1135
1148
|
} : ResponseWrapper extends {
|
|
1136
1149
|
data: PaginateResult<CommentModel & {
|
|
1137
1150
|
ref: string;
|
|
1138
|
-
}
|
|
1151
|
+
}> & {
|
|
1152
|
+
readers: Record<string, ReaderModel>;
|
|
1153
|
+
};
|
|
1139
1154
|
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
1140
1155
|
data: PaginateResult<CommentModel & {
|
|
1141
1156
|
ref: string;
|
|
1142
|
-
}
|
|
1157
|
+
}> & {
|
|
1158
|
+
readers: Record<string, ReaderModel>;
|
|
1159
|
+
};
|
|
1143
1160
|
}>;
|
|
1144
1161
|
/**
|
|
1145
1162
|
* 评论
|
|
@@ -1880,4 +1897,4 @@ declare const allControllerNames: readonly ["ai", "ack", "activity", "aggregate"
|
|
|
1880
1897
|
*/
|
|
1881
1898
|
declare const camelcaseKeys: <T = any>(obj: any) => T;
|
|
1882
1899
|
|
|
1883
|
-
export { AIController, type AISummaryModel, AckController, ActivityController, type ActivityPresence, AdminExtraModel, AggregateController, type AggregateRoot, type AggregateRootWithTheme, type AggregateStat, type AggregateTop, type AggregateTopNote, type AggregateTopPost, AlgoliaSearchOptionsModel, type AuthUser, BackupOptionsModel, BaiduSearchOptionsModel, type BaseCommentIndexModel, type BaseModel, CategoryController, type CategoryEntries, type CategoryModel, CategoryType, type CategoryWithChildrenModel, CollectionRefTypes, CommentController, type CommentDto, type CommentModel, CommentOptionsModel, type CommentRef, CommentState, type Coordinate, type Count, EnumPageType, HTTPClient, type IConfig, type IConfigKeys, IRequestAdapter, type Image, type LastYearPublication, LinkController, type LinkModel, LinkState, LinkType, MailOptionsModel, type ModelWithLiked, NoteController, type NoteModel, type NoteWrappedPayload, type NoteWrappedWithLikedPayload, PageController, type PageModel, type Pager, type PaginateResult, PostController, type PostModel, ProjectController, type ProjectModel, type RecentActivities, type RecentComment, type RecentLike, type RecentNote, type RecentPost, type RecentRecent, RecentlyAttitudeEnum, RecentlyAttitudeResultEnum, RecentlyController, type RecentlyModel, type RecentlyRefType, RecentlyRefTypes, RequestError, type RoomOmittedNote, type RoomOmittedPage, type RoomOmittedPost, type RoomsData, SayController, type SayModel, SearchController, SeoOptionModel, ServerlessController, SnippetController, type SnippetModel, SnippetType, SubscribeAllBit, SubscribeController, SubscribeNoteCreateBit, SubscribePostCreateBit, SubscribeRecentCreateBit, SubscribeSayCreateBit, type SubscribeType, SubscribeTypeToBitMap, type TLogin, type TagModel, type TextBaseModel, type TimelineData, TimelineType, TopicController, type TopicModel, type Url, UrlOptionModel, UserController, type UserModel, allControllerNames, allControllers, createClient, createClient as default, camelcaseKeys as simpleCamelcaseKeys };
|
|
1900
|
+
export { AIController, type AISummaryModel, AckController, ActivityController, type ActivityPresence, AdminExtraModel, AggregateController, type AggregateRoot, type AggregateRootWithTheme, type AggregateStat, type AggregateTop, type AggregateTopNote, type AggregateTopPost, AlgoliaSearchOptionsModel, type AuthUser, BackupOptionsModel, BaiduSearchOptionsModel, type BaseCommentIndexModel, type BaseModel, CategoryController, type CategoryEntries, type CategoryModel, CategoryType, type CategoryWithChildrenModel, CollectionRefTypes, CommentController, type CommentDto, type CommentModel, CommentOptionsModel, type CommentRef, CommentState, type Coordinate, type Count, EnumPageType, HTTPClient, type IConfig, type IConfigKeys, IRequestAdapter, type Image, type LastYearPublication, LinkController, type LinkModel, LinkState, LinkType, MailOptionsModel, type ModelWithLiked, NoteController, type NoteModel, type NoteWrappedPayload, type NoteWrappedWithLikedPayload, PageController, type PageModel, type Pager, type PaginateResult, PostController, type PostModel, ProjectController, type ProjectModel, type ReaderModel, type RecentActivities, type RecentComment, type RecentLike, type RecentNote, type RecentPost, type RecentRecent, RecentlyAttitudeEnum, RecentlyAttitudeResultEnum, RecentlyController, type RecentlyModel, type RecentlyRefType, RecentlyRefTypes, RequestError, type RoomOmittedNote, type RoomOmittedPage, type RoomOmittedPost, type RoomsData, SayController, type SayModel, SearchController, SeoOptionModel, ServerlessController, SnippetController, type SnippetModel, SnippetType, SubscribeAllBit, SubscribeController, SubscribeNoteCreateBit, SubscribePostCreateBit, SubscribeRecentCreateBit, SubscribeSayCreateBit, type SubscribeType, SubscribeTypeToBitMap, type TLogin, type TagModel, type TextBaseModel, type TimelineData, TimelineType, TopicController, type TopicModel, type Url, UrlOptionModel, UserController, type UserModel, allControllerNames, allControllers, createClient, createClient as default, camelcaseKeys as simpleCamelcaseKeys };
|
package/dist/index.global.js
CHANGED
|
@@ -373,7 +373,7 @@
|
|
|
373
373
|
return this.client.proxy(this.base);
|
|
374
374
|
}
|
|
375
375
|
/**
|
|
376
|
-
* 根据 comment id
|
|
376
|
+
* 根据 comment id 获取评论,包括子评论
|
|
377
377
|
*/
|
|
378
378
|
getById(id) {
|
|
379
379
|
return this.proxy(id).get();
|
|
@@ -934,7 +934,7 @@
|
|
|
934
934
|
this._endpoint = _endpoint;
|
|
935
935
|
this._adaptor = _adaptor;
|
|
936
936
|
this.options = options;
|
|
937
|
-
this._endpoint = _endpoint.replace(/\/*$/, "")
|
|
937
|
+
this._endpoint = _endpoint.replace(/\/*$/, "");
|
|
938
938
|
this._proxy = this.buildRoute(this)();
|
|
939
939
|
options.transformResponse || (options.transformResponse = (data) => camelcaseKeys(data));
|
|
940
940
|
options.getDataFromResponse || (options.getDataFromResponse = (res) => res.data);
|
package/dist/index.js
CHANGED
|
@@ -371,7 +371,7 @@ var CommentController = class {
|
|
|
371
371
|
return this.client.proxy(this.base);
|
|
372
372
|
}
|
|
373
373
|
/**
|
|
374
|
-
* 根据 comment id
|
|
374
|
+
* 根据 comment id 获取评论,包括子评论
|
|
375
375
|
*/
|
|
376
376
|
getById(id) {
|
|
377
377
|
return this.proxy(id).get();
|
|
@@ -932,7 +932,7 @@ var HTTPClient = class {
|
|
|
932
932
|
this._endpoint = _endpoint;
|
|
933
933
|
this._adaptor = _adaptor;
|
|
934
934
|
this.options = options;
|
|
935
|
-
this._endpoint = _endpoint.replace(/\/*$/, "")
|
|
935
|
+
this._endpoint = _endpoint.replace(/\/*$/, "");
|
|
936
936
|
this._proxy = this.buildRoute(this)();
|
|
937
937
|
options.transformResponse || (options.transformResponse = (data) => camelcaseKeys(data));
|
|
938
938
|
options.getDataFromResponse || (options.getDataFromResponse = (res) => res.data);
|
package/models/comment.ts
CHANGED
package/models/index.ts
CHANGED
package/models/reader.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mx-space/api-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A api client for mx-space server@next",
|
|
6
6
|
"author": "Innei",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"axios": "^1.6.7",
|
|
52
52
|
"camelcase-keys": "^9.1.3",
|
|
53
53
|
"cors": "2.8.5",
|
|
54
|
-
"express": "4.
|
|
54
|
+
"express": "4.20.0",
|
|
55
55
|
"form-data": "4.0.0",
|
|
56
56
|
"lodash": "4.17.21",
|
|
57
57
|
"tsup": "8.2.4",
|