@mx-space/api-client 3.1.0 → 3.3.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.
@@ -4,6 +4,7 @@ interface RequestOptions {
4
4
  data?: Record<string, any>;
5
5
  params?: Record<string, any> | URLSearchParams;
6
6
  headers?: Record<string, string>;
7
+ transformResponse?: false | (<T = any>(data: any) => T);
7
8
  [key: string]: any;
8
9
  }
9
10
  //#endregion
@@ -4,6 +4,7 @@ interface RequestOptions {
4
4
  data?: Record<string, any>;
5
5
  params?: Record<string, any> | URLSearchParams;
6
6
  headers?: Record<string, string>;
7
+ transformResponse?: false | (<T = any>(data: any) => T);
7
8
  [key: string]: any;
8
9
  }
9
10
  //#endregion
@@ -1,4 +1,7 @@
1
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
2
5
  //#region \0rolldown/runtime.js
3
6
  var __create = Object.create;
4
7
  var __defProp = Object.defineProperty;
@@ -7,16 +10,12 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
10
  var __getProtoOf = Object.getPrototypeOf;
8
11
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
12
  var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
- key = keys[i];
13
- if (!__hasOwnProp.call(to, key) && key !== except) {
14
- __defProp(to, key, {
15
- get: ((k) => from[k]).bind(null, key),
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
18
- }
19
- }
13
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
14
+ key = keys[i];
15
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: ((k) => from[k]).bind(null, key),
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
20
19
  }
21
20
  return to;
22
21
  };
@@ -24,11 +23,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
23
  value: mod,
25
24
  enumerable: true
26
25
  }) : target, mod));
27
-
28
26
  //#endregion
29
27
  let axios = require("axios");
30
- axios = __toESM(axios);
31
-
28
+ axios = __toESM(axios, 1);
32
29
  //#region adaptors/axios.ts
33
30
  const $http = /* @__PURE__ */ axios.default.create({});
34
31
  const axiosAdaptor = Object.preventExtensions({
@@ -56,8 +53,7 @@ const axiosAdaptor = Object.preventExtensions({
56
53
  return $http.patch(url, data, config);
57
54
  }
58
55
  });
59
-
60
56
  //#endregion
61
57
  exports.__toESM = __toESM;
62
58
  exports.axiosAdaptor = axiosAdaptor;
63
- exports.default = axiosAdaptor;
59
+ exports.default = axiosAdaptor;
@@ -1,4 +1,4 @@
1
- import { n as IRequestAdapter } from "../adapter-DLzJOGbI.cjs";
1
+ import { n as IRequestAdapter } from "../adapter-DB4Vji9d.cjs";
2
2
  import { AxiosInstance, AxiosResponse } from "axios";
3
3
 
4
4
  //#region adaptors/axios.d.ts
@@ -1,4 +1,4 @@
1
- import { n as IRequestAdapter } from "../adapter-D1g1obyM.mjs";
1
+ import { n as IRequestAdapter } from "../adapter-BICozHDF.mjs";
2
2
  import { AxiosInstance, AxiosResponse } from "axios";
3
3
 
4
4
  //#region adaptors/axios.d.ts
@@ -1,5 +1,4 @@
1
1
  import axios from "axios";
2
-
3
2
  //#region adaptors/axios.ts
4
3
  const $http = /* @__PURE__ */ axios.create({});
5
4
  const axiosAdaptor = Object.preventExtensions({
@@ -27,6 +26,5 @@ const axiosAdaptor = Object.preventExtensions({
27
26
  return $http.patch(url, data, config);
28
27
  }
29
28
  });
30
-
31
29
  //#endregion
32
- export { axiosAdaptor, axiosAdaptor as default };
30
+ export { axiosAdaptor, axiosAdaptor as default };
@@ -1,5 +1,4 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
2
  //#region adaptors/fetch.ts
4
3
  const jsonDataAttachResponse = async (response) => {
5
4
  const cloned = response.clone();
@@ -72,6 +71,5 @@ const fetchAdaptor = Object.preventExtensions({
72
71
  },
73
72
  responseWrapper: {}
74
73
  });
75
-
76
74
  //#endregion
77
- exports.fetchAdaptor = fetchAdaptor;
75
+ exports.fetchAdaptor = fetchAdaptor;
@@ -1,4 +1,4 @@
1
- import { n as IRequestAdapter } from "../adapter-DLzJOGbI.cjs";
1
+ import { n as IRequestAdapter } from "../adapter-DB4Vji9d.cjs";
2
2
 
3
3
  //#region adaptors/fetch.d.ts
4
4
  declare const fetchAdaptor: IRequestAdapter<typeof fetch>;
@@ -1,4 +1,4 @@
1
- import { n as IRequestAdapter } from "../adapter-D1g1obyM.mjs";
1
+ import { n as IRequestAdapter } from "../adapter-BICozHDF.mjs";
2
2
 
3
3
  //#region adaptors/fetch.d.ts
4
4
  declare const fetchAdaptor: IRequestAdapter<typeof fetch>;
@@ -70,6 +70,5 @@ const fetchAdaptor = Object.preventExtensions({
70
70
  },
71
71
  responseWrapper: {}
72
72
  });
73
-
74
73
  //#endregion
75
- export { fetchAdaptor };
74
+ export { fetchAdaptor };
@@ -1,9 +1,10 @@
1
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
- const require_adaptors_axios = require('./axios.cjs');
3
- let umi_request = require("umi-request");
4
-
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ require("./axios.cjs");
5
6
  //#region adaptors/umi-request.ts
6
- const $http = /* @__PURE__ */ (0, umi_request.extend)({
7
+ const $http = /* @__PURE__ */ (0, require("umi-request").extend)({
7
8
  getResponse: true,
8
9
  requestType: "json",
9
10
  responseType: "json"
@@ -29,7 +30,6 @@ const umiAdaptor = Object.preventExtensions({
29
30
  return $http.patch(url, options);
30
31
  }
31
32
  });
32
-
33
33
  //#endregion
34
34
  exports.default = umiAdaptor;
35
- exports.umiAdaptor = umiAdaptor;
35
+ exports.umiAdaptor = umiAdaptor;
@@ -1,4 +1,4 @@
1
- import { n as IRequestAdapter } from "../adapter-DLzJOGbI.cjs";
1
+ import { n as IRequestAdapter } from "../adapter-DB4Vji9d.cjs";
2
2
  import { RequestMethod, RequestResponse } from "umi-request";
3
3
 
4
4
  //#region adaptors/umi-request.d.ts
@@ -1,4 +1,4 @@
1
- import { n as IRequestAdapter } from "../adapter-D1g1obyM.mjs";
1
+ import { n as IRequestAdapter } from "../adapter-BICozHDF.mjs";
2
2
  import { RequestMethod, RequestResponse } from "umi-request";
3
3
 
4
4
  //#region adaptors/umi-request.d.ts
@@ -1,5 +1,4 @@
1
1
  import { extend } from "umi-request";
2
-
3
2
  //#region adaptors/umi-request.ts
4
3
  const $http = /* @__PURE__ */ extend({
5
4
  getResponse: true,
@@ -27,6 +26,5 @@ const umiAdaptor = Object.preventExtensions({
27
26
  return $http.patch(url, options);
28
27
  }
29
28
  });
30
-
31
29
  //#endregion
32
- export { umiAdaptor as default, umiAdaptor };
30
+ export { umiAdaptor as default, umiAdaptor };
package/dist/index.cjs CHANGED
@@ -1,5 +1,7 @@
1
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
-
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
3
5
  //#region utils/index.ts
4
6
  const isPlainObject = (obj) => isObject(obj) && Object.prototype.toString.call(obj) === "[object Object]" && Object.getPrototypeOf(obj) === Object.prototype;
5
7
  const sortOrderToNumber = (order) => {
@@ -35,7 +37,6 @@ const attachRawFromOneToAnthor = (from, to) => {
35
37
  });
36
38
  });
37
39
  };
38
-
39
40
  //#endregion
40
41
  //#region utils/camelcase-keys.ts
41
42
  /**
@@ -57,14 +58,12 @@ function camelcase(str) {
57
58
  });
58
59
  }
59
60
  const isMongoId = (id) => id.length === 24 && /^[\dA-F]{24}$/i.test(id);
60
-
61
61
  //#endregion
62
62
  //#region utils/path.ts
63
63
  const resolveFullPath = (endpoint, path) => {
64
64
  if (!path.startsWith("/")) path = `/${path}`;
65
65
  return `${endpoint}${path}`;
66
66
  };
67
-
68
67
  //#endregion
69
68
  //#region utils/auto-bind.ts
70
69
  const getAllProperties = (object) => {
@@ -88,7 +87,6 @@ function autoBind(self, { include, exclude } = {}) {
88
87
  }
89
88
  return self;
90
89
  }
91
-
92
90
  //#endregion
93
91
  //#region controllers/ack.ts
94
92
  /**
@@ -114,7 +112,6 @@ var AckController = class {
114
112
  } });
115
113
  }
116
114
  };
117
-
118
115
  //#endregion
119
116
  //#region controllers/activity.ts
120
117
  /**
@@ -141,7 +138,17 @@ var ActivityController = class {
141
138
  * @support core >= 5.0.0
142
139
  */
143
140
  getPresence(roomName) {
144
- return this.proxy.presence.get({ params: { room_name: roomName } });
141
+ return this.proxy.presence.get({
142
+ params: { room_name: roomName },
143
+ transformResponse: (data) => {
144
+ const payload = data;
145
+ return {
146
+ ...camelcaseKeys(Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "data" && key !== "readers"))),
147
+ data: Object.fromEntries(Object.entries(payload.data ?? {}).map(([identity, value]) => [identity, camelcaseKeys(value)])),
148
+ readers: Object.fromEntries(Object.entries(payload.readers ?? {}).map(([id, value]) => [id, camelcaseKeys(value)]))
149
+ };
150
+ }
151
+ });
145
152
  }
146
153
  /**
147
154
  *
@@ -168,7 +175,6 @@ var ActivityController = class {
168
175
  return this.proxy(`last-year`).publication.get();
169
176
  }
170
177
  };
171
-
172
178
  //#endregion
173
179
  //#region controllers/aggregate.ts
174
180
  var AggregateController = class {
@@ -219,7 +225,6 @@ var AggregateController = class {
219
225
  return this.proxy.stat.get();
220
226
  }
221
227
  };
222
-
223
228
  //#endregion
224
229
  //#region controllers/ai.ts
225
230
  /**
@@ -335,7 +340,6 @@ var AIController = class {
335
340
  });
336
341
  }
337
342
  };
338
-
339
343
  //#endregion
340
344
  //#region core/error.ts
341
345
  var RequestError = class extends Error {
@@ -346,7 +350,6 @@ var RequestError = class extends Error {
346
350
  this.raw = raw;
347
351
  }
348
352
  };
349
-
350
353
  //#endregion
351
354
  //#region models/category.ts
352
355
  let CategoryType = /* @__PURE__ */ function(CategoryType) {
@@ -354,7 +357,6 @@ let CategoryType = /* @__PURE__ */ function(CategoryType) {
354
357
  CategoryType[CategoryType["Tag"] = 1] = "Tag";
355
358
  return CategoryType;
356
359
  }({});
357
-
358
360
  //#endregion
359
361
  //#region controllers/category.ts
360
362
  var CategoryController = class {
@@ -368,10 +370,10 @@ var CategoryController = class {
368
370
  return this.client.proxy(this.base);
369
371
  }
370
372
  getAllCategories() {
371
- return this.proxy.get({ params: { type: CategoryType.Category } });
373
+ return this.proxy.get({ params: { type: 0 } });
372
374
  }
373
375
  getAllTags() {
374
- return this.proxy.get({ params: { type: CategoryType.Tag } });
376
+ return this.proxy.get({ params: { type: 1 } });
375
377
  }
376
378
  async getCategoryDetail(ids) {
377
379
  if (typeof ids === "string") {
@@ -395,7 +397,6 @@ var CategoryController = class {
395
397
  return await this.proxy(name).get({ params: { tag: 1 } });
396
398
  }
397
399
  };
398
-
399
400
  //#endregion
400
401
  //#region controllers/comment.ts
401
402
  var CommentController = class {
@@ -418,11 +419,13 @@ var CommentController = class {
418
419
  * 获取文章的评论列表
419
420
  * @param refId 文章 Id
420
421
  */
421
- getByRefId(refId, pagination = {}) {
422
- const { page, size } = pagination;
422
+ getByRefId(refId, params = {}) {
423
+ const { page, size, sort, around } = params;
423
424
  return this.proxy.ref(refId).get({ params: {
424
425
  page: page || 1,
425
- size: size || 10
426
+ size: size || 10,
427
+ ...sort ? { sort } : {},
428
+ ...around ? { around } : {}
426
429
  } });
427
430
  }
428
431
  getThreadReplies(rootCommentId, params = {}) {
@@ -447,7 +450,6 @@ var CommentController = class {
447
450
  return this.proxy.reader.reply(commentId).post({ data });
448
451
  }
449
452
  };
450
-
451
453
  //#endregion
452
454
  //#region controllers/base.ts
453
455
  var BaseCrudController = class {
@@ -477,7 +479,6 @@ var BaseCrudController = class {
477
479
  } });
478
480
  }
479
481
  };
480
-
481
482
  //#endregion
482
483
  //#region controllers/link.ts
483
484
  var LinkController = class extends BaseCrudController {
@@ -496,7 +497,6 @@ var LinkController = class extends BaseCrudController {
496
497
  return await this.proxy.audit.post({ data });
497
498
  }
498
499
  };
499
-
500
500
  //#endregion
501
501
  //#region controllers/note.ts
502
502
  var NoteController = class {
@@ -592,7 +592,6 @@ var NoteController = class {
592
592
  } });
593
593
  }
594
594
  };
595
-
596
595
  //#endregion
597
596
  //#region controllers/owner.ts
598
597
  var UserController = class {
@@ -667,7 +666,6 @@ var UserController = class {
667
666
  return this.proxy.check_logged.get({ params: normalized ? { token: normalized } : void 0 });
668
667
  }
669
668
  };
670
-
671
669
  //#endregion
672
670
  //#region controllers/page.ts
673
671
  var PageController = class {
@@ -708,7 +706,6 @@ var PageController = class {
708
706
  return this.proxy.slug(slug).get({ params: options?.prefer ? { prefer: options.prefer } : void 0 });
709
707
  }
710
708
  };
711
-
712
709
  //#endregion
713
710
  //#region controllers/post.ts
714
711
  var PostController = class {
@@ -760,7 +757,6 @@ var PostController = class {
760
757
  return this.proxy("get-url")(slug).get();
761
758
  }
762
759
  };
763
-
764
760
  //#endregion
765
761
  //#region controllers/project.ts
766
762
  var ProjectController = class extends BaseCrudController {
@@ -772,7 +768,6 @@ var ProjectController = class extends BaseCrudController {
772
768
  autoBind(this);
773
769
  }
774
770
  };
775
-
776
771
  //#endregion
777
772
  //#region controllers/recently.ts
778
773
  let RecentlyAttitudeResultEnum = /* @__PURE__ */ function(RecentlyAttitudeResultEnum) {
@@ -819,7 +814,6 @@ var RecentlyController = class {
819
814
  return this.proxy.attitude(id).get({ params: { attitude } });
820
815
  }
821
816
  };
822
-
823
817
  //#endregion
824
818
  //#region controllers/say.ts
825
819
  var SayController = class extends BaseCrudController {
@@ -840,7 +834,6 @@ var SayController = class extends BaseCrudController {
840
834
  return this.proxy.random.get();
841
835
  }
842
836
  };
843
-
844
837
  //#endregion
845
838
  //#region controllers/search.ts
846
839
  var SearchController = class {
@@ -866,7 +859,6 @@ var SearchController = class {
866
859
  } });
867
860
  }
868
861
  };
869
-
870
862
  //#endregion
871
863
  //#region controllers/severless.ts
872
864
  var ServerlessController = class {
@@ -883,7 +875,6 @@ var ServerlessController = class {
883
875
  return this.proxy(reference)(name).get();
884
876
  }
885
877
  };
886
-
887
878
  //#endregion
888
879
  //#region controllers/snippet.ts
889
880
  var SnippetController = class {
@@ -900,7 +891,6 @@ var SnippetController = class {
900
891
  return this.proxy(reference)(name).get();
901
892
  }
902
893
  };
903
-
904
894
  //#endregion
905
895
  //#region controllers/subscribe.ts
906
896
  var SubscribeController = class {
@@ -932,7 +922,6 @@ var SubscribeController = class {
932
922
  } });
933
923
  }
934
924
  };
935
-
936
925
  //#endregion
937
926
  //#region controllers/topic.ts
938
927
  var TopicController = class extends BaseCrudController {
@@ -950,7 +939,6 @@ var TopicController = class extends BaseCrudController {
950
939
  return this.proxy.slug(slug).get();
951
940
  }
952
941
  };
953
-
954
942
  //#endregion
955
943
  //#region controllers/index.ts
956
944
  const allControllers = [
@@ -997,7 +985,6 @@ const allControllerNames = [
997
985
  "friend",
998
986
  "shorthand"
999
987
  ];
1000
-
1001
988
  //#endregion
1002
989
  //#region core/attach-request.ts
1003
990
  function attachRequestMethod(target) {
@@ -1027,7 +1014,6 @@ function handleSearchParams(obj) {
1027
1014
  });
1028
1015
  return search.toString();
1029
1016
  }
1030
-
1031
1017
  //#endregion
1032
1018
  //#region core/client.ts
1033
1019
  const methodPrefix = "_$";
@@ -1115,14 +1101,15 @@ var HTTPClient = class {
1115
1101
  return path.startsWith("/") ? path : `/${path}`;
1116
1102
  }
1117
1103
  };
1118
- if (methods.includes(name)) return async (options) => {
1104
+ if (methods.includes(name)) return async (options = {}) => {
1119
1105
  const url = resolveFullPath(that.endpoint, route.join("/"));
1120
1106
  route.length = 0;
1107
+ const { transformResponse: perRequestTransformResponse, ...requestOptions } = options;
1121
1108
  let res;
1122
1109
  try {
1123
1110
  res = await manager.request({
1124
1111
  method: name,
1125
- ...options,
1112
+ ...requestOptions,
1126
1113
  url
1127
1114
  });
1128
1115
  } catch (error) {
@@ -1137,7 +1124,8 @@ var HTTPClient = class {
1137
1124
  }
1138
1125
  const data = that.options.getDataFromResponse(res);
1139
1126
  if (!data) return null;
1140
- const cameledObject = (Array.isArray(data) || isPlainObject(data)) && that.options.transformResponse ? that.options.transformResponse(data) : data;
1127
+ const responseTransformer = perRequestTransformResponse === void 0 ? that.options.transformResponse : perRequestTransformResponse || void 0;
1128
+ const cameledObject = (Array.isArray(data) || isPlainObject(data)) && responseTransformer ? responseTransformer(data) : data;
1141
1129
  let nextObject = cameledObject;
1142
1130
  if (cameledObject && typeof cameledObject === "object") {
1143
1131
  nextObject = Array.isArray(cameledObject) ? [...cameledObject] : { ...cameledObject };
@@ -1184,7 +1172,6 @@ function createClient(adapter) {
1184
1172
  return client;
1185
1173
  };
1186
1174
  }
1187
-
1188
1175
  //#endregion
1189
1176
  //#region models/aggregate.ts
1190
1177
  let TimelineType = /* @__PURE__ */ function(TimelineType) {
@@ -1192,7 +1179,6 @@ let TimelineType = /* @__PURE__ */ function(TimelineType) {
1192
1179
  TimelineType[TimelineType["Note"] = 1] = "Note";
1193
1180
  return TimelineType;
1194
1181
  }({});
1195
-
1196
1182
  //#endregion
1197
1183
  //#region ../../apps/core/src/constants/db.constant.ts
1198
1184
  const NOTE_COLLECTION_NAME = "notes";
@@ -1206,7 +1192,6 @@ let CollectionRefTypes = /* @__PURE__ */ function(CollectionRefTypes) {
1206
1192
  CollectionRefTypes[CollectionRefTypes["Recently"] = RECENTLY_COLLECTION_NAME] = "Recently";
1207
1193
  return CollectionRefTypes;
1208
1194
  }({});
1209
-
1210
1195
  //#endregion
1211
1196
  //#region models/comment.ts
1212
1197
  let CommentState = /* @__PURE__ */ function(CommentState) {
@@ -1215,7 +1200,6 @@ let CommentState = /* @__PURE__ */ function(CommentState) {
1215
1200
  CommentState[CommentState["Junk"] = 2] = "Junk";
1216
1201
  return CommentState;
1217
1202
  }({});
1218
-
1219
1203
  //#endregion
1220
1204
  //#region models/link.ts
1221
1205
  let LinkType = /* @__PURE__ */ function(LinkType) {
@@ -1231,7 +1215,6 @@ let LinkState = /* @__PURE__ */ function(LinkState) {
1231
1215
  LinkState[LinkState["Reject"] = 4] = "Reject";
1232
1216
  return LinkState;
1233
1217
  }({});
1234
-
1235
1218
  //#endregion
1236
1219
  //#region models/page.ts
1237
1220
  let EnumPageType = /* @__PURE__ */ function(EnumPageType) {
@@ -1240,7 +1223,6 @@ let EnumPageType = /* @__PURE__ */ function(EnumPageType) {
1240
1223
  EnumPageType["frame"] = "frame";
1241
1224
  return EnumPageType;
1242
1225
  }({});
1243
-
1244
1226
  //#endregion
1245
1227
  //#region models/recently.ts
1246
1228
  let RecentlyRefTypes = /* @__PURE__ */ function(RecentlyRefTypes) {
@@ -1260,7 +1242,6 @@ let RecentlyTypeEnum = /* @__PURE__ */ function(RecentlyTypeEnum) {
1260
1242
  RecentlyTypeEnum["Code"] = "code";
1261
1243
  return RecentlyTypeEnum;
1262
1244
  }({});
1263
-
1264
1245
  //#endregion
1265
1246
  //#region models/snippet.ts
1266
1247
  let SnippetType = /* @__PURE__ */ function(SnippetType) {
@@ -1270,7 +1251,6 @@ let SnippetType = /* @__PURE__ */ function(SnippetType) {
1270
1251
  SnippetType["YAML"] = "yaml";
1271
1252
  return SnippetType;
1272
1253
  }({});
1273
-
1274
1254
  //#endregion
1275
1255
  //#region ../../apps/core/src/modules/subscribe/subscribe.constant.ts
1276
1256
  const SubscribePostCreateBit = 1;
@@ -1279,17 +1259,15 @@ const SubscribeSayCreateBit = 4;
1279
1259
  const SubscribeRecentCreateBit = 8;
1280
1260
  const SubscribeAllBit = 15;
1281
1261
  const SubscribeTypeToBitMap = {
1282
- post_c: SubscribePostCreateBit,
1283
- note_c: SubscribeNoteCreateBit,
1284
- say_c: SubscribeSayCreateBit,
1285
- recently_c: SubscribeRecentCreateBit,
1286
- all: SubscribeAllBit
1262
+ post_c: 1,
1263
+ note_c: 2,
1264
+ say_c: 4,
1265
+ recently_c: 8,
1266
+ all: 15
1287
1267
  };
1288
-
1289
1268
  //#endregion
1290
1269
  //#region index.ts
1291
1270
  var api_client_default = createClient;
1292
-
1293
1271
  //#endregion
1294
1272
  exports.AIController = AIController;
1295
1273
  exports.AckController = AckController;
@@ -1333,4 +1311,4 @@ exports.allControllerNames = allControllerNames;
1333
1311
  exports.allControllers = allControllers;
1334
1312
  exports.createClient = createClient;
1335
1313
  exports.default = api_client_default;
1336
- exports.simpleCamelcaseKeys = camelcaseKeys;
1314
+ exports.simpleCamelcaseKeys = camelcaseKeys;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as IRequestAdapter, r as RequestOptions, t as IAdaptorRequestResponseType } from "./adapter-DLzJOGbI.cjs";
1
+ import { n as IRequestAdapter, r as RequestOptions, t as IAdaptorRequestResponseType } from "./adapter-DB4Vji9d.cjs";
2
2
 
3
3
  //#region interfaces/controller.d.ts
4
4
  interface IController {
@@ -295,6 +295,10 @@ interface RecentComment {
295
295
  type: string;
296
296
  avatar: string;
297
297
  nid?: string;
298
+ category?: {
299
+ slug: string;
300
+ name: string;
301
+ };
298
302
  }
299
303
  interface RecentLike {
300
304
  created: string;
@@ -317,6 +321,10 @@ interface RecentPost {
317
321
  title: string;
318
322
  modified: string;
319
323
  slug: string;
324
+ category?: {
325
+ slug: string;
326
+ name: string;
327
+ };
320
328
  }
321
329
  interface RecentRecent {
322
330
  id: string;
@@ -1566,7 +1574,7 @@ declare class CategoryController<ResponseWrapper> implements IController {
1566
1574
  name: string;
1567
1575
  created: string;
1568
1576
  id: string;
1569
- children: Pick<PostModel, "id" | "created" | "title" | "slug" | "modified">[];
1577
+ children: Pick<PostModel, "id" | "title" | "slug" | "modified" | "created">[];
1570
1578
  } : T_1 : never : never;
1571
1579
  } : ResponseWrapper;
1572
1580
  $request: {
@@ -1618,7 +1626,7 @@ declare class CategoryController<ResponseWrapper> implements IController {
1618
1626
  };
1619
1627
  }) ? T_1 extends unknown ? {
1620
1628
  tag: string;
1621
- data: Pick<PostModel, "category" | "id" | "created" | "title" | "slug">[];
1629
+ data: Pick<PostModel, "category" | "id" | "title" | "slug" | "created">[];
1622
1630
  } : T_1 : never : never;
1623
1631
  } : ResponseWrapper;
1624
1632
  $request: {
@@ -1689,7 +1697,10 @@ declare class CommentController<ResponseWrapper> implements IController {
1689
1697
  * 获取文章的评论列表
1690
1698
  * @param refId 文章 Id
1691
1699
  */
1692
- getByRefId(refId: string, pagination?: PaginationParams): RequestProxyResult<PaginateResult<CommentThreadItem & {
1700
+ getByRefId(refId: string, params?: PaginationParams & {
1701
+ sort?: 'pinned' | 'newest' | 'oldest';
1702
+ around?: string;
1703
+ }): RequestProxyResult<PaginateResult<CommentThreadItem & {
1693
1704
  ref: string;
1694
1705
  }> & {
1695
1706
  readers: Record<string, ReaderModel>;
@@ -2456,35 +2467,35 @@ declare class SearchController<ResponseWrapper> implements IController {
2456
2467
  search(type: 'note', keyword: string, options?: SearchOption): Promise<RequestProxyResult<PaginateResult<Pick<NoteModel, 'modified' | 'id' | 'title' | 'created' | 'nid'> & SearchResultHighlight>, ResponseWrapper>>;
2457
2468
  search(type: 'post', keyword: string, options?: SearchOption): Promise<RequestProxyResult<PaginateResult<Pick<PostModel, 'modified' | 'id' | 'title' | 'created' | 'slug' | 'category'> & SearchResultHighlight>, ResponseWrapper>>;
2458
2469
  search(type: 'page', keyword: string, options?: SearchOption): Promise<RequestProxyResult<PaginateResult<Pick<PageModel, 'modified' | 'id' | 'title' | 'created' | 'slug'> & SearchResultHighlight>, ResponseWrapper>>;
2459
- searchAll(keyword: string, options?: SearchOption): RequestProxyResult<RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2470
+ searchAll(keyword: string, options?: SearchOption): RequestProxyResult<RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2460
2471
  type: "post";
2461
- }) | (Pick<NoteModel, "id" | "created" | "title" | "modified" | "nid"> & SearchResultHighlight & {
2472
+ }) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & SearchResultHighlight & {
2462
2473
  type: "note";
2463
- }) | (Pick<PageModel, "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2474
+ }) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2464
2475
  type: "page";
2465
2476
  })>, ResponseWrapper>, ResponseWrapper, ResponseWrapper extends unknown ? {
2466
2477
  [key: string]: any;
2467
- data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2478
+ data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2468
2479
  type: "post";
2469
- }) | (Pick<NoteModel, "id" | "created" | "title" | "modified" | "nid"> & SearchResultHighlight & {
2480
+ }) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & SearchResultHighlight & {
2470
2481
  type: "note";
2471
- }) | (Pick<PageModel, "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2482
+ }) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2472
2483
  type: "page";
2473
2484
  })>, ResponseWrapper>;
2474
2485
  } : ResponseWrapper extends {
2475
- data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2486
+ data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2476
2487
  type: "post";
2477
- }) | (Pick<NoteModel, "id" | "created" | "title" | "modified" | "nid"> & SearchResultHighlight & {
2488
+ }) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & SearchResultHighlight & {
2478
2489
  type: "note";
2479
- }) | (Pick<PageModel, "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2490
+ }) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2480
2491
  type: "page";
2481
2492
  })>, ResponseWrapper>;
2482
2493
  } ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
2483
- data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2494
+ data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2484
2495
  type: "post";
2485
- }) | (Pick<NoteModel, "id" | "created" | "title" | "modified" | "nid"> & SearchResultHighlight & {
2496
+ }) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & SearchResultHighlight & {
2486
2497
  type: "note";
2487
- }) | (Pick<PageModel, "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2498
+ }) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2488
2499
  type: "page";
2489
2500
  })>, ResponseWrapper>;
2490
2501
  }>;
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as IRequestAdapter, r as RequestOptions, t as IAdaptorRequestResponseType } from "./adapter-DLzJOGbI.cjs";
1
+ import { n as IRequestAdapter, r as RequestOptions, t as IAdaptorRequestResponseType } from "./adapter-DB4Vji9d.cjs";
2
2
 
3
3
  //#region interfaces/controller.d.ts
4
4
  interface IController {
@@ -295,6 +295,10 @@ interface RecentComment {
295
295
  type: string;
296
296
  avatar: string;
297
297
  nid?: string;
298
+ category?: {
299
+ slug: string;
300
+ name: string;
301
+ };
298
302
  }
299
303
  interface RecentLike {
300
304
  created: string;
@@ -317,6 +321,10 @@ interface RecentPost {
317
321
  title: string;
318
322
  modified: string;
319
323
  slug: string;
324
+ category?: {
325
+ slug: string;
326
+ name: string;
327
+ };
320
328
  }
321
329
  interface RecentRecent {
322
330
  id: string;
@@ -1566,7 +1574,7 @@ declare class CategoryController<ResponseWrapper> implements IController {
1566
1574
  name: string;
1567
1575
  created: string;
1568
1576
  id: string;
1569
- children: Pick<PostModel, "id" | "created" | "title" | "slug" | "modified">[];
1577
+ children: Pick<PostModel, "id" | "title" | "slug" | "modified" | "created">[];
1570
1578
  } : T_1 : never : never;
1571
1579
  } : ResponseWrapper;
1572
1580
  $request: {
@@ -1618,7 +1626,7 @@ declare class CategoryController<ResponseWrapper> implements IController {
1618
1626
  };
1619
1627
  }) ? T_1 extends unknown ? {
1620
1628
  tag: string;
1621
- data: Pick<PostModel, "category" | "id" | "created" | "title" | "slug">[];
1629
+ data: Pick<PostModel, "category" | "id" | "title" | "slug" | "created">[];
1622
1630
  } : T_1 : never : never;
1623
1631
  } : ResponseWrapper;
1624
1632
  $request: {
@@ -1689,7 +1697,10 @@ declare class CommentController<ResponseWrapper> implements IController {
1689
1697
  * 获取文章的评论列表
1690
1698
  * @param refId 文章 Id
1691
1699
  */
1692
- getByRefId(refId: string, pagination?: PaginationParams): RequestProxyResult<PaginateResult<CommentThreadItem & {
1700
+ getByRefId(refId: string, params?: PaginationParams & {
1701
+ sort?: 'pinned' | 'newest' | 'oldest';
1702
+ around?: string;
1703
+ }): RequestProxyResult<PaginateResult<CommentThreadItem & {
1693
1704
  ref: string;
1694
1705
  }> & {
1695
1706
  readers: Record<string, ReaderModel>;
@@ -2456,35 +2467,35 @@ declare class SearchController<ResponseWrapper> implements IController {
2456
2467
  search(type: 'note', keyword: string, options?: SearchOption): Promise<RequestProxyResult<PaginateResult<Pick<NoteModel, 'modified' | 'id' | 'title' | 'created' | 'nid'> & SearchResultHighlight>, ResponseWrapper>>;
2457
2468
  search(type: 'post', keyword: string, options?: SearchOption): Promise<RequestProxyResult<PaginateResult<Pick<PostModel, 'modified' | 'id' | 'title' | 'created' | 'slug' | 'category'> & SearchResultHighlight>, ResponseWrapper>>;
2458
2469
  search(type: 'page', keyword: string, options?: SearchOption): Promise<RequestProxyResult<PaginateResult<Pick<PageModel, 'modified' | 'id' | 'title' | 'created' | 'slug'> & SearchResultHighlight>, ResponseWrapper>>;
2459
- searchAll(keyword: string, options?: SearchOption): RequestProxyResult<RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2470
+ searchAll(keyword: string, options?: SearchOption): RequestProxyResult<RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2460
2471
  type: "post";
2461
- }) | (Pick<NoteModel, "id" | "created" | "title" | "modified" | "nid"> & SearchResultHighlight & {
2472
+ }) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & SearchResultHighlight & {
2462
2473
  type: "note";
2463
- }) | (Pick<PageModel, "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2474
+ }) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2464
2475
  type: "page";
2465
2476
  })>, ResponseWrapper>, ResponseWrapper, ResponseWrapper extends unknown ? {
2466
2477
  [key: string]: any;
2467
- data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2478
+ data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2468
2479
  type: "post";
2469
- }) | (Pick<NoteModel, "id" | "created" | "title" | "modified" | "nid"> & SearchResultHighlight & {
2480
+ }) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & SearchResultHighlight & {
2470
2481
  type: "note";
2471
- }) | (Pick<PageModel, "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2482
+ }) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2472
2483
  type: "page";
2473
2484
  })>, ResponseWrapper>;
2474
2485
  } : ResponseWrapper extends {
2475
- data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2486
+ data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2476
2487
  type: "post";
2477
- }) | (Pick<NoteModel, "id" | "created" | "title" | "modified" | "nid"> & SearchResultHighlight & {
2488
+ }) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & SearchResultHighlight & {
2478
2489
  type: "note";
2479
- }) | (Pick<PageModel, "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2490
+ }) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2480
2491
  type: "page";
2481
2492
  })>, ResponseWrapper>;
2482
2493
  } ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
2483
- data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2494
+ data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2484
2495
  type: "post";
2485
- }) | (Pick<NoteModel, "id" | "created" | "title" | "modified" | "nid"> & SearchResultHighlight & {
2496
+ }) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & SearchResultHighlight & {
2486
2497
  type: "note";
2487
- }) | (Pick<PageModel, "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2498
+ }) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2488
2499
  type: "page";
2489
2500
  })>, ResponseWrapper>;
2490
2501
  }>;
package/dist/index.mjs CHANGED
@@ -33,7 +33,6 @@ const attachRawFromOneToAnthor = (from, to) => {
33
33
  });
34
34
  });
35
35
  };
36
-
37
36
  //#endregion
38
37
  //#region utils/camelcase-keys.ts
39
38
  /**
@@ -55,14 +54,12 @@ function camelcase(str) {
55
54
  });
56
55
  }
57
56
  const isMongoId = (id) => id.length === 24 && /^[\dA-F]{24}$/i.test(id);
58
-
59
57
  //#endregion
60
58
  //#region utils/path.ts
61
59
  const resolveFullPath = (endpoint, path) => {
62
60
  if (!path.startsWith("/")) path = `/${path}`;
63
61
  return `${endpoint}${path}`;
64
62
  };
65
-
66
63
  //#endregion
67
64
  //#region utils/auto-bind.ts
68
65
  const getAllProperties = (object) => {
@@ -86,7 +83,6 @@ function autoBind(self, { include, exclude } = {}) {
86
83
  }
87
84
  return self;
88
85
  }
89
-
90
86
  //#endregion
91
87
  //#region controllers/ack.ts
92
88
  /**
@@ -112,7 +108,6 @@ var AckController = class {
112
108
  } });
113
109
  }
114
110
  };
115
-
116
111
  //#endregion
117
112
  //#region controllers/activity.ts
118
113
  /**
@@ -139,7 +134,17 @@ var ActivityController = class {
139
134
  * @support core >= 5.0.0
140
135
  */
141
136
  getPresence(roomName) {
142
- return this.proxy.presence.get({ params: { room_name: roomName } });
137
+ return this.proxy.presence.get({
138
+ params: { room_name: roomName },
139
+ transformResponse: (data) => {
140
+ const payload = data;
141
+ return {
142
+ ...camelcaseKeys(Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "data" && key !== "readers"))),
143
+ data: Object.fromEntries(Object.entries(payload.data ?? {}).map(([identity, value]) => [identity, camelcaseKeys(value)])),
144
+ readers: Object.fromEntries(Object.entries(payload.readers ?? {}).map(([id, value]) => [id, camelcaseKeys(value)]))
145
+ };
146
+ }
147
+ });
143
148
  }
144
149
  /**
145
150
  *
@@ -166,7 +171,6 @@ var ActivityController = class {
166
171
  return this.proxy(`last-year`).publication.get();
167
172
  }
168
173
  };
169
-
170
174
  //#endregion
171
175
  //#region controllers/aggregate.ts
172
176
  var AggregateController = class {
@@ -217,7 +221,6 @@ var AggregateController = class {
217
221
  return this.proxy.stat.get();
218
222
  }
219
223
  };
220
-
221
224
  //#endregion
222
225
  //#region controllers/ai.ts
223
226
  /**
@@ -333,7 +336,6 @@ var AIController = class {
333
336
  });
334
337
  }
335
338
  };
336
-
337
339
  //#endregion
338
340
  //#region core/error.ts
339
341
  var RequestError = class extends Error {
@@ -344,7 +346,6 @@ var RequestError = class extends Error {
344
346
  this.raw = raw;
345
347
  }
346
348
  };
347
-
348
349
  //#endregion
349
350
  //#region models/category.ts
350
351
  let CategoryType = /* @__PURE__ */ function(CategoryType) {
@@ -352,7 +353,6 @@ let CategoryType = /* @__PURE__ */ function(CategoryType) {
352
353
  CategoryType[CategoryType["Tag"] = 1] = "Tag";
353
354
  return CategoryType;
354
355
  }({});
355
-
356
356
  //#endregion
357
357
  //#region controllers/category.ts
358
358
  var CategoryController = class {
@@ -366,10 +366,10 @@ var CategoryController = class {
366
366
  return this.client.proxy(this.base);
367
367
  }
368
368
  getAllCategories() {
369
- return this.proxy.get({ params: { type: CategoryType.Category } });
369
+ return this.proxy.get({ params: { type: 0 } });
370
370
  }
371
371
  getAllTags() {
372
- return this.proxy.get({ params: { type: CategoryType.Tag } });
372
+ return this.proxy.get({ params: { type: 1 } });
373
373
  }
374
374
  async getCategoryDetail(ids) {
375
375
  if (typeof ids === "string") {
@@ -393,7 +393,6 @@ var CategoryController = class {
393
393
  return await this.proxy(name).get({ params: { tag: 1 } });
394
394
  }
395
395
  };
396
-
397
396
  //#endregion
398
397
  //#region controllers/comment.ts
399
398
  var CommentController = class {
@@ -416,11 +415,13 @@ var CommentController = class {
416
415
  * 获取文章的评论列表
417
416
  * @param refId 文章 Id
418
417
  */
419
- getByRefId(refId, pagination = {}) {
420
- const { page, size } = pagination;
418
+ getByRefId(refId, params = {}) {
419
+ const { page, size, sort, around } = params;
421
420
  return this.proxy.ref(refId).get({ params: {
422
421
  page: page || 1,
423
- size: size || 10
422
+ size: size || 10,
423
+ ...sort ? { sort } : {},
424
+ ...around ? { around } : {}
424
425
  } });
425
426
  }
426
427
  getThreadReplies(rootCommentId, params = {}) {
@@ -445,7 +446,6 @@ var CommentController = class {
445
446
  return this.proxy.reader.reply(commentId).post({ data });
446
447
  }
447
448
  };
448
-
449
449
  //#endregion
450
450
  //#region controllers/base.ts
451
451
  var BaseCrudController = class {
@@ -475,7 +475,6 @@ var BaseCrudController = class {
475
475
  } });
476
476
  }
477
477
  };
478
-
479
478
  //#endregion
480
479
  //#region controllers/link.ts
481
480
  var LinkController = class extends BaseCrudController {
@@ -494,7 +493,6 @@ var LinkController = class extends BaseCrudController {
494
493
  return await this.proxy.audit.post({ data });
495
494
  }
496
495
  };
497
-
498
496
  //#endregion
499
497
  //#region controllers/note.ts
500
498
  var NoteController = class {
@@ -590,7 +588,6 @@ var NoteController = class {
590
588
  } });
591
589
  }
592
590
  };
593
-
594
591
  //#endregion
595
592
  //#region controllers/owner.ts
596
593
  var UserController = class {
@@ -665,7 +662,6 @@ var UserController = class {
665
662
  return this.proxy.check_logged.get({ params: normalized ? { token: normalized } : void 0 });
666
663
  }
667
664
  };
668
-
669
665
  //#endregion
670
666
  //#region controllers/page.ts
671
667
  var PageController = class {
@@ -706,7 +702,6 @@ var PageController = class {
706
702
  return this.proxy.slug(slug).get({ params: options?.prefer ? { prefer: options.prefer } : void 0 });
707
703
  }
708
704
  };
709
-
710
705
  //#endregion
711
706
  //#region controllers/post.ts
712
707
  var PostController = class {
@@ -758,7 +753,6 @@ var PostController = class {
758
753
  return this.proxy("get-url")(slug).get();
759
754
  }
760
755
  };
761
-
762
756
  //#endregion
763
757
  //#region controllers/project.ts
764
758
  var ProjectController = class extends BaseCrudController {
@@ -770,7 +764,6 @@ var ProjectController = class extends BaseCrudController {
770
764
  autoBind(this);
771
765
  }
772
766
  };
773
-
774
767
  //#endregion
775
768
  //#region controllers/recently.ts
776
769
  let RecentlyAttitudeResultEnum = /* @__PURE__ */ function(RecentlyAttitudeResultEnum) {
@@ -817,7 +810,6 @@ var RecentlyController = class {
817
810
  return this.proxy.attitude(id).get({ params: { attitude } });
818
811
  }
819
812
  };
820
-
821
813
  //#endregion
822
814
  //#region controllers/say.ts
823
815
  var SayController = class extends BaseCrudController {
@@ -838,7 +830,6 @@ var SayController = class extends BaseCrudController {
838
830
  return this.proxy.random.get();
839
831
  }
840
832
  };
841
-
842
833
  //#endregion
843
834
  //#region controllers/search.ts
844
835
  var SearchController = class {
@@ -864,7 +855,6 @@ var SearchController = class {
864
855
  } });
865
856
  }
866
857
  };
867
-
868
858
  //#endregion
869
859
  //#region controllers/severless.ts
870
860
  var ServerlessController = class {
@@ -881,7 +871,6 @@ var ServerlessController = class {
881
871
  return this.proxy(reference)(name).get();
882
872
  }
883
873
  };
884
-
885
874
  //#endregion
886
875
  //#region controllers/snippet.ts
887
876
  var SnippetController = class {
@@ -898,7 +887,6 @@ var SnippetController = class {
898
887
  return this.proxy(reference)(name).get();
899
888
  }
900
889
  };
901
-
902
890
  //#endregion
903
891
  //#region controllers/subscribe.ts
904
892
  var SubscribeController = class {
@@ -930,7 +918,6 @@ var SubscribeController = class {
930
918
  } });
931
919
  }
932
920
  };
933
-
934
921
  //#endregion
935
922
  //#region controllers/topic.ts
936
923
  var TopicController = class extends BaseCrudController {
@@ -948,7 +935,6 @@ var TopicController = class extends BaseCrudController {
948
935
  return this.proxy.slug(slug).get();
949
936
  }
950
937
  };
951
-
952
938
  //#endregion
953
939
  //#region controllers/index.ts
954
940
  const allControllers = [
@@ -995,7 +981,6 @@ const allControllerNames = [
995
981
  "friend",
996
982
  "shorthand"
997
983
  ];
998
-
999
984
  //#endregion
1000
985
  //#region core/attach-request.ts
1001
986
  function attachRequestMethod(target) {
@@ -1025,7 +1010,6 @@ function handleSearchParams(obj) {
1025
1010
  });
1026
1011
  return search.toString();
1027
1012
  }
1028
-
1029
1013
  //#endregion
1030
1014
  //#region core/client.ts
1031
1015
  const methodPrefix = "_$";
@@ -1113,14 +1097,15 @@ var HTTPClient = class {
1113
1097
  return path.startsWith("/") ? path : `/${path}`;
1114
1098
  }
1115
1099
  };
1116
- if (methods.includes(name)) return async (options) => {
1100
+ if (methods.includes(name)) return async (options = {}) => {
1117
1101
  const url = resolveFullPath(that.endpoint, route.join("/"));
1118
1102
  route.length = 0;
1103
+ const { transformResponse: perRequestTransformResponse, ...requestOptions } = options;
1119
1104
  let res;
1120
1105
  try {
1121
1106
  res = await manager.request({
1122
1107
  method: name,
1123
- ...options,
1108
+ ...requestOptions,
1124
1109
  url
1125
1110
  });
1126
1111
  } catch (error) {
@@ -1135,7 +1120,8 @@ var HTTPClient = class {
1135
1120
  }
1136
1121
  const data = that.options.getDataFromResponse(res);
1137
1122
  if (!data) return null;
1138
- const cameledObject = (Array.isArray(data) || isPlainObject(data)) && that.options.transformResponse ? that.options.transformResponse(data) : data;
1123
+ const responseTransformer = perRequestTransformResponse === void 0 ? that.options.transformResponse : perRequestTransformResponse || void 0;
1124
+ const cameledObject = (Array.isArray(data) || isPlainObject(data)) && responseTransformer ? responseTransformer(data) : data;
1139
1125
  let nextObject = cameledObject;
1140
1126
  if (cameledObject && typeof cameledObject === "object") {
1141
1127
  nextObject = Array.isArray(cameledObject) ? [...cameledObject] : { ...cameledObject };
@@ -1182,7 +1168,6 @@ function createClient(adapter) {
1182
1168
  return client;
1183
1169
  };
1184
1170
  }
1185
-
1186
1171
  //#endregion
1187
1172
  //#region models/aggregate.ts
1188
1173
  let TimelineType = /* @__PURE__ */ function(TimelineType) {
@@ -1190,7 +1175,6 @@ let TimelineType = /* @__PURE__ */ function(TimelineType) {
1190
1175
  TimelineType[TimelineType["Note"] = 1] = "Note";
1191
1176
  return TimelineType;
1192
1177
  }({});
1193
-
1194
1178
  //#endregion
1195
1179
  //#region ../../apps/core/src/constants/db.constant.ts
1196
1180
  const NOTE_COLLECTION_NAME = "notes";
@@ -1204,7 +1188,6 @@ let CollectionRefTypes = /* @__PURE__ */ function(CollectionRefTypes) {
1204
1188
  CollectionRefTypes[CollectionRefTypes["Recently"] = RECENTLY_COLLECTION_NAME] = "Recently";
1205
1189
  return CollectionRefTypes;
1206
1190
  }({});
1207
-
1208
1191
  //#endregion
1209
1192
  //#region models/comment.ts
1210
1193
  let CommentState = /* @__PURE__ */ function(CommentState) {
@@ -1213,7 +1196,6 @@ let CommentState = /* @__PURE__ */ function(CommentState) {
1213
1196
  CommentState[CommentState["Junk"] = 2] = "Junk";
1214
1197
  return CommentState;
1215
1198
  }({});
1216
-
1217
1199
  //#endregion
1218
1200
  //#region models/link.ts
1219
1201
  let LinkType = /* @__PURE__ */ function(LinkType) {
@@ -1229,7 +1211,6 @@ let LinkState = /* @__PURE__ */ function(LinkState) {
1229
1211
  LinkState[LinkState["Reject"] = 4] = "Reject";
1230
1212
  return LinkState;
1231
1213
  }({});
1232
-
1233
1214
  //#endregion
1234
1215
  //#region models/page.ts
1235
1216
  let EnumPageType = /* @__PURE__ */ function(EnumPageType) {
@@ -1238,7 +1219,6 @@ let EnumPageType = /* @__PURE__ */ function(EnumPageType) {
1238
1219
  EnumPageType["frame"] = "frame";
1239
1220
  return EnumPageType;
1240
1221
  }({});
1241
-
1242
1222
  //#endregion
1243
1223
  //#region models/recently.ts
1244
1224
  let RecentlyRefTypes = /* @__PURE__ */ function(RecentlyRefTypes) {
@@ -1258,7 +1238,6 @@ let RecentlyTypeEnum = /* @__PURE__ */ function(RecentlyTypeEnum) {
1258
1238
  RecentlyTypeEnum["Code"] = "code";
1259
1239
  return RecentlyTypeEnum;
1260
1240
  }({});
1261
-
1262
1241
  //#endregion
1263
1242
  //#region models/snippet.ts
1264
1243
  let SnippetType = /* @__PURE__ */ function(SnippetType) {
@@ -1268,7 +1247,6 @@ let SnippetType = /* @__PURE__ */ function(SnippetType) {
1268
1247
  SnippetType["YAML"] = "yaml";
1269
1248
  return SnippetType;
1270
1249
  }({});
1271
-
1272
1250
  //#endregion
1273
1251
  //#region ../../apps/core/src/modules/subscribe/subscribe.constant.ts
1274
1252
  const SubscribePostCreateBit = 1;
@@ -1277,16 +1255,14 @@ const SubscribeSayCreateBit = 4;
1277
1255
  const SubscribeRecentCreateBit = 8;
1278
1256
  const SubscribeAllBit = 15;
1279
1257
  const SubscribeTypeToBitMap = {
1280
- post_c: SubscribePostCreateBit,
1281
- note_c: SubscribeNoteCreateBit,
1282
- say_c: SubscribeSayCreateBit,
1283
- recently_c: SubscribeRecentCreateBit,
1284
- all: SubscribeAllBit
1258
+ post_c: 1,
1259
+ note_c: 2,
1260
+ say_c: 4,
1261
+ recently_c: 8,
1262
+ all: 15
1285
1263
  };
1286
-
1287
1264
  //#endregion
1288
1265
  //#region index.ts
1289
1266
  var api_client_default = createClient;
1290
-
1291
1267
  //#endregion
1292
- export { AIController, AckController, ActivityController, AggregateController, CategoryController, CategoryType, CollectionRefTypes, CommentController, CommentState, EnumPageType, LinkController, LinkState, LinkType, NoteController, PageController, PostController, ProjectController, RecentlyAttitudeEnum, RecentlyAttitudeResultEnum, RecentlyController, RecentlyRefTypes, RecentlyTypeEnum, RequestError, SayController, SearchController, ServerlessController, SnippetController, SnippetType, SubscribeAllBit, SubscribeController, SubscribeNoteCreateBit, SubscribePostCreateBit, SubscribeRecentCreateBit, SubscribeSayCreateBit, SubscribeTypeToBitMap, TimelineType, TopicController, UserController, allControllerNames, allControllers, createClient, api_client_default as default, camelcaseKeys as simpleCamelcaseKeys };
1268
+ export { AIController, AckController, ActivityController, AggregateController, CategoryController, CategoryType, CollectionRefTypes, CommentController, CommentState, EnumPageType, LinkController, LinkState, LinkType, NoteController, PageController, PostController, ProjectController, RecentlyAttitudeEnum, RecentlyAttitudeResultEnum, RecentlyController, RecentlyRefTypes, RecentlyTypeEnum, RequestError, SayController, SearchController, ServerlessController, SnippetController, SnippetType, SubscribeAllBit, SubscribeController, SubscribeNoteCreateBit, SubscribePostCreateBit, SubscribeRecentCreateBit, SubscribeSayCreateBit, SubscribeTypeToBitMap, TimelineType, TopicController, UserController, allControllerNames, allControllers, createClient, api_client_default as default, camelcaseKeys as simpleCamelcaseKeys };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-space/api-client",
3
- "version": "3.1.0",
3
+ "version": "3.3.0",
4
4
  "description": "A api client for mx-space server@next",
5
5
  "type": "module",
6
6
  "engines": {
@@ -53,15 +53,15 @@
53
53
  "@types/cors": "2.8.19",
54
54
  "@types/express": "5.0.6",
55
55
  "abort-controller": "3.0.0",
56
- "axios": "^1.13.3",
56
+ "axios": "^1.15.0",
57
57
  "camelcase-keys": "^10.0.2",
58
58
  "cors": "2.8.6",
59
- "es-toolkit": "1.45.0",
60
- "express": "4.21.2",
59
+ "es-toolkit": "1.45.1",
60
+ "express": "5.2.1",
61
61
  "form-data": "4.0.5",
62
- "tsdown": "0.21.0-beta.2",
62
+ "tsdown": "0.21.9",
63
63
  "umi-request": "1.4.0",
64
- "vite": "^7.3.1",
65
- "vitest": "4.0.18"
64
+ "vite": "^8.0.8",
65
+ "vitest": "4.1.4"
66
66
  }
67
67
  }