@mx-space/api-client 1.10.1 → 1.11.0-alpha.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.
@@ -1,7 +1,11 @@
1
1
  import type { IRequestAdapter } from '~/interfaces/adapter'
2
2
  import type { IController } from '~/interfaces/controller'
3
3
  import type { IRequestHandler } from '~/interfaces/request'
4
- import type { ActivityPresence, RoomsData } from '~/models/activity'
4
+ import type {
5
+ ActivityPresence,
6
+ RecentActivities,
7
+ RoomsData,
8
+ } from '~/models/activity'
5
9
  import type { HTTPClient } from '../core'
6
10
 
7
11
  import { autoBind } from '~/utils/auto-bind'
@@ -87,4 +91,8 @@ export class ActivityController<ResponseWrapper> implements IController {
87
91
  async getRoomsInfo() {
88
92
  return this.proxy.rooms.get<RoomsData>()
89
93
  }
94
+
95
+ async getRecentActivities() {
96
+ return this.proxy.recent.get<RecentActivities>()
97
+ }
90
98
  }
@@ -4,11 +4,10 @@ import type { IRequestHandler, RequestProxyResult } from '~/interfaces/request'
4
4
  import type { SelectFields } from '~/interfaces/types'
5
5
  import type { ModelWithLiked, PaginateResult } from '~/models/base'
6
6
  import type { PostModel } from '~/models/post'
7
+ import type { HTTPClient } from '../core/client'
7
8
 
8
9
  import { autoBind } from '~/utils/auto-bind'
9
10
 
10
- import { HTTPClient } from '../core/client'
11
-
12
11
  declare module '../core/client' {
13
12
  interface HTTPClient<
14
13
  T extends IRequestAdapter = IRequestAdapter,
@@ -86,4 +85,8 @@ export class PostController<ResponseWrapper> implements IController {
86
85
  getLatest() {
87
86
  return this.proxy.latest.get<ModelWithLiked<PostModel>>()
88
87
  }
88
+
89
+ getFullUrl(slug: string) {
90
+ return this.proxy('get-url')(slug).get<{ path: string }>()
91
+ }
89
92
  }
package/dist/index.cjs CHANGED
@@ -244,6 +244,9 @@ var ActivityController = class {
244
244
  async getRoomsInfo() {
245
245
  return this.proxy.rooms.get();
246
246
  }
247
+ async getRecentActivities() {
248
+ return this.proxy.recent.get();
249
+ }
247
250
  };
248
251
 
249
252
  // controllers/aggregate.ts
@@ -617,6 +620,9 @@ var PostController = class {
617
620
  getLatest() {
618
621
  return this.proxy.latest.get();
619
622
  }
623
+ getFullUrl(slug) {
624
+ return this.proxy("get-url")(slug).get();
625
+ }
620
626
  };
621
627
 
622
628
  // controllers/project.ts
package/dist/index.d.cts CHANGED
@@ -121,6 +121,13 @@ declare class AckController<ResponseWrapper> implements IController {
121
121
  }>;
122
122
  }
123
123
 
124
+ declare enum CollectionRefTypes {
125
+ Post = "posts",
126
+ Note = "notes",
127
+ Page = "pages",
128
+ Recently = "recentlies"
129
+ }
130
+
124
131
  interface Count {
125
132
  read: number;
126
133
  like: number;
@@ -240,6 +247,50 @@ interface RoomsData {
240
247
  pages: RoomOmittedPage[];
241
248
  };
242
249
  }
250
+ interface RecentActivities {
251
+ like: RecentLike[];
252
+ comment: RecentComment[];
253
+ recent: RecentRecent[];
254
+ post: RecentPost[];
255
+ note: RecentNote[];
256
+ }
257
+ interface RecentComment {
258
+ created: string;
259
+ author: string;
260
+ text: string;
261
+ id: string;
262
+ title: string;
263
+ slug: string;
264
+ type: string;
265
+ }
266
+ interface RecentLike {
267
+ created: string;
268
+ id: string;
269
+ type: CollectionRefTypes.Post | CollectionRefTypes.Note;
270
+ nid?: number;
271
+ slug?: string;
272
+ }
273
+ interface RecentNote {
274
+ id: string;
275
+ created: string;
276
+ title: string;
277
+ modified: string;
278
+ nid: number;
279
+ }
280
+ interface RecentPost {
281
+ id: string;
282
+ created: string;
283
+ title: string;
284
+ modified: string;
285
+ slug: string;
286
+ }
287
+ interface RecentRecent {
288
+ id: string;
289
+ content: string;
290
+ up: number;
291
+ down: number;
292
+ created: string;
293
+ }
243
294
 
244
295
  declare module '../core/client' {
245
296
  interface HTTPClient<T extends IRequestAdapter = IRequestAdapter, ResponseWrapper = unknown> {
@@ -332,6 +383,40 @@ declare class ActivityController<ResponseWrapper> implements IController {
332
383
  };
333
384
  $serialized: RoomsData;
334
385
  }>;
386
+ getRecentActivities(): Promise<RecentActivities & {
387
+ $raw: ResponseWrapper extends {
388
+ data: infer T;
389
+ } ? ResponseWrapper : ResponseWrapper extends unknown ? {
390
+ [i: string]: any;
391
+ data: (ResponseWrapper extends unknown ? {
392
+ [key: string]: any;
393
+ data: RecentActivities;
394
+ } : ResponseWrapper extends {
395
+ data: RecentActivities;
396
+ } ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
397
+ data: RecentActivities;
398
+ }) extends infer T ? T extends (ResponseWrapper extends unknown ? {
399
+ [key: string]: any;
400
+ data: RecentActivities;
401
+ } : ResponseWrapper extends {
402
+ data: RecentActivities;
403
+ } ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
404
+ data: RecentActivities;
405
+ }) ? T extends unknown ? {
406
+ like: RecentLike[];
407
+ comment: RecentComment[];
408
+ recent: RecentRecent[];
409
+ post: RecentPost[];
410
+ note: RecentNote[];
411
+ } : T : never : never;
412
+ } : ResponseWrapper;
413
+ $request: {
414
+ [k: string]: string;
415
+ path: string;
416
+ method: string;
417
+ };
418
+ $serialized: RecentActivities;
419
+ }>;
335
420
  }
336
421
 
337
422
  type SortOrder = 'asc' | 'desc';
@@ -722,13 +807,6 @@ interface PaginationParams {
722
807
  page?: number;
723
808
  }
724
809
 
725
- declare enum CollectionRefTypes {
726
- Post = "posts",
727
- Note = "notes",
728
- Page = "pages",
729
- Recently = "recentlies"
730
- }
731
-
732
810
  interface CommentModel extends BaseModel {
733
811
  refType: CollectionRefTypes;
734
812
  ref: string;
@@ -1116,6 +1194,22 @@ declare class PostController<ResponseWrapper> implements IController {
1116
1194
  } ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
1117
1195
  data: ModelWithLiked<PostModel>;
1118
1196
  }>;
1197
+ getFullUrl(slug: string): RequestProxyResult<{
1198
+ path: string;
1199
+ }, ResponseWrapper, ResponseWrapper extends unknown ? {
1200
+ [key: string]: any;
1201
+ data: {
1202
+ path: string;
1203
+ };
1204
+ } : ResponseWrapper extends {
1205
+ data: {
1206
+ path: string;
1207
+ };
1208
+ } ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
1209
+ data: {
1210
+ path: string;
1211
+ };
1212
+ }>;
1119
1213
  }
1120
1214
 
1121
1215
  interface ProjectModel extends BaseModel {
@@ -1629,4 +1723,4 @@ interface SnippetModel<T = unknown> extends BaseModel {
1629
1723
  */
1630
1724
  declare const camelcaseKeys: <T = any>(obj: any) => T;
1631
1725
 
1632
- export { AckController, ActivityController, type ActivityPresence, AdminExtraModel, AggregateController, type AggregateRoot, type AggregateRootWithTheme, type AggregateStat, type AggregateTop, type AggregateTopNote, type AggregateTopPost, AlgoliaSearchOptionsModel, 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, 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, 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 };
1726
+ export { AckController, ActivityController, type ActivityPresence, AdminExtraModel, AggregateController, type AggregateRoot, type AggregateRootWithTheme, type AggregateStat, type AggregateTop, type AggregateTopNote, type AggregateTopPost, AlgoliaSearchOptionsModel, 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, 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 };
package/dist/index.d.ts CHANGED
@@ -121,6 +121,13 @@ declare class AckController<ResponseWrapper> implements IController {
121
121
  }>;
122
122
  }
123
123
 
124
+ declare enum CollectionRefTypes {
125
+ Post = "posts",
126
+ Note = "notes",
127
+ Page = "pages",
128
+ Recently = "recentlies"
129
+ }
130
+
124
131
  interface Count {
125
132
  read: number;
126
133
  like: number;
@@ -240,6 +247,50 @@ interface RoomsData {
240
247
  pages: RoomOmittedPage[];
241
248
  };
242
249
  }
250
+ interface RecentActivities {
251
+ like: RecentLike[];
252
+ comment: RecentComment[];
253
+ recent: RecentRecent[];
254
+ post: RecentPost[];
255
+ note: RecentNote[];
256
+ }
257
+ interface RecentComment {
258
+ created: string;
259
+ author: string;
260
+ text: string;
261
+ id: string;
262
+ title: string;
263
+ slug: string;
264
+ type: string;
265
+ }
266
+ interface RecentLike {
267
+ created: string;
268
+ id: string;
269
+ type: CollectionRefTypes.Post | CollectionRefTypes.Note;
270
+ nid?: number;
271
+ slug?: string;
272
+ }
273
+ interface RecentNote {
274
+ id: string;
275
+ created: string;
276
+ title: string;
277
+ modified: string;
278
+ nid: number;
279
+ }
280
+ interface RecentPost {
281
+ id: string;
282
+ created: string;
283
+ title: string;
284
+ modified: string;
285
+ slug: string;
286
+ }
287
+ interface RecentRecent {
288
+ id: string;
289
+ content: string;
290
+ up: number;
291
+ down: number;
292
+ created: string;
293
+ }
243
294
 
244
295
  declare module '@mx-space/api-client' {
245
296
  interface HTTPClient<T extends IRequestAdapter = IRequestAdapter, ResponseWrapper = unknown> {
@@ -332,6 +383,40 @@ declare class ActivityController<ResponseWrapper> implements IController {
332
383
  };
333
384
  $serialized: RoomsData;
334
385
  }>;
386
+ getRecentActivities(): Promise<RecentActivities & {
387
+ $raw: ResponseWrapper extends {
388
+ data: infer T;
389
+ } ? ResponseWrapper : ResponseWrapper extends unknown ? {
390
+ [i: string]: any;
391
+ data: (ResponseWrapper extends unknown ? {
392
+ [key: string]: any;
393
+ data: RecentActivities;
394
+ } : ResponseWrapper extends {
395
+ data: RecentActivities;
396
+ } ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
397
+ data: RecentActivities;
398
+ }) extends infer T ? T extends (ResponseWrapper extends unknown ? {
399
+ [key: string]: any;
400
+ data: RecentActivities;
401
+ } : ResponseWrapper extends {
402
+ data: RecentActivities;
403
+ } ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
404
+ data: RecentActivities;
405
+ }) ? T extends unknown ? {
406
+ like: RecentLike[];
407
+ comment: RecentComment[];
408
+ recent: RecentRecent[];
409
+ post: RecentPost[];
410
+ note: RecentNote[];
411
+ } : T : never : never;
412
+ } : ResponseWrapper;
413
+ $request: {
414
+ [k: string]: string;
415
+ path: string;
416
+ method: string;
417
+ };
418
+ $serialized: RecentActivities;
419
+ }>;
335
420
  }
336
421
 
337
422
  type SortOrder = 'asc' | 'desc';
@@ -722,13 +807,6 @@ interface PaginationParams {
722
807
  page?: number;
723
808
  }
724
809
 
725
- declare enum CollectionRefTypes {
726
- Post = "posts",
727
- Note = "notes",
728
- Page = "pages",
729
- Recently = "recentlies"
730
- }
731
-
732
810
  interface CommentModel extends BaseModel {
733
811
  refType: CollectionRefTypes;
734
812
  ref: string;
@@ -1116,6 +1194,22 @@ declare class PostController<ResponseWrapper> implements IController {
1116
1194
  } ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
1117
1195
  data: ModelWithLiked<PostModel>;
1118
1196
  }>;
1197
+ getFullUrl(slug: string): RequestProxyResult<{
1198
+ path: string;
1199
+ }, ResponseWrapper, ResponseWrapper extends unknown ? {
1200
+ [key: string]: any;
1201
+ data: {
1202
+ path: string;
1203
+ };
1204
+ } : ResponseWrapper extends {
1205
+ data: {
1206
+ path: string;
1207
+ };
1208
+ } ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
1209
+ data: {
1210
+ path: string;
1211
+ };
1212
+ }>;
1119
1213
  }
1120
1214
 
1121
1215
  interface ProjectModel extends BaseModel {
@@ -1629,4 +1723,4 @@ interface SnippetModel<T = unknown> extends BaseModel {
1629
1723
  */
1630
1724
  declare const camelcaseKeys: <T = any>(obj: any) => T;
1631
1725
 
1632
- export { AckController, ActivityController, type ActivityPresence, AdminExtraModel, AggregateController, type AggregateRoot, type AggregateRootWithTheme, type AggregateStat, type AggregateTop, type AggregateTopNote, type AggregateTopPost, AlgoliaSearchOptionsModel, 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, 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, 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 };
1726
+ export { AckController, ActivityController, type ActivityPresence, AdminExtraModel, AggregateController, type AggregateRoot, type AggregateRootWithTheme, type AggregateStat, type AggregateTop, type AggregateTopNote, type AggregateTopPost, AlgoliaSearchOptionsModel, 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, 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 };
@@ -180,6 +180,9 @@
180
180
  async getRoomsInfo() {
181
181
  return this.proxy.rooms.get();
182
182
  }
183
+ async getRecentActivities() {
184
+ return this.proxy.recent.get();
185
+ }
183
186
  };
184
187
 
185
188
  // controllers/aggregate.ts
@@ -553,6 +556,9 @@
553
556
  getLatest() {
554
557
  return this.proxy.latest.get();
555
558
  }
559
+ getFullUrl(slug) {
560
+ return this.proxy("get-url")(slug).get();
561
+ }
556
562
  };
557
563
 
558
564
  // controllers/project.ts
package/dist/index.js CHANGED
@@ -178,6 +178,9 @@ var ActivityController = class {
178
178
  async getRoomsInfo() {
179
179
  return this.proxy.rooms.get();
180
180
  }
181
+ async getRecentActivities() {
182
+ return this.proxy.recent.get();
183
+ }
181
184
  };
182
185
 
183
186
  // controllers/aggregate.ts
@@ -551,6 +554,9 @@ var PostController = class {
551
554
  getLatest() {
552
555
  return this.proxy.latest.get();
553
556
  }
557
+ getFullUrl(slug) {
558
+ return this.proxy("get-url")(slug).get();
559
+ }
554
560
  };
555
561
 
556
562
  // controllers/project.ts
@@ -1,3 +1,4 @@
1
+ import type { CollectionRefTypes } from '@core/constants/db.constant'
1
2
  import type { CategoryModel } from './category'
2
3
 
3
4
  export interface ActivityPresence {
@@ -45,3 +46,54 @@ export interface RoomsData {
45
46
  pages: RoomOmittedPage[]
46
47
  }
47
48
  }
49
+
50
+ export interface RecentActivities {
51
+ like: RecentLike[]
52
+ comment: RecentComment[]
53
+ recent: RecentRecent[]
54
+ post: RecentPost[]
55
+ note: RecentNote[]
56
+ }
57
+
58
+ export interface RecentComment {
59
+ created: string
60
+ author: string
61
+ text: string
62
+ id: string
63
+ title: string
64
+ slug: string
65
+ type: string
66
+ }
67
+
68
+ export interface RecentLike {
69
+ created: string
70
+ id: string
71
+ type: CollectionRefTypes.Post | CollectionRefTypes.Note
72
+ nid?: number
73
+ slug?: string
74
+ }
75
+
76
+ export interface RecentNote {
77
+ id: string
78
+ created: string
79
+ title: string
80
+ modified: string
81
+ nid: number
82
+ }
83
+
84
+ export interface RecentPost {
85
+ id: string
86
+ created: string
87
+ title: string
88
+ modified: string
89
+ slug: string
90
+ }
91
+
92
+ export interface RecentRecent {
93
+ id: string
94
+
95
+ content: string
96
+ up: number
97
+ down: number
98
+ created: string
99
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-space/api-client",
3
- "version": "1.10.1",
3
+ "version": "1.11.0-alpha.0",
4
4
  "type": "module",
5
5
  "description": "A api client for mx-space server@next",
6
6
  "author": "Innei",