@mx-space/api-client 3.1.0 → 3.5.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/dist/{adapter-D1g1obyM.d.mts → adapter-BICozHDF.d.mts} +1 -0
- package/dist/{adapter-DLzJOGbI.d.cts → adapter-DB4Vji9d.d.cts} +1 -0
- package/dist/adaptors/axios.cjs +12 -16
- package/dist/adaptors/axios.d.cts +1 -1
- package/dist/adaptors/axios.d.mts +1 -1
- package/dist/adaptors/axios.mjs +1 -3
- package/dist/adaptors/fetch.cjs +2 -4
- package/dist/adaptors/fetch.d.cts +1 -1
- package/dist/adaptors/fetch.d.mts +1 -1
- package/dist/adaptors/fetch.mjs +1 -2
- package/dist/adaptors/umi-request.cjs +7 -7
- package/dist/adaptors/umi-request.d.cts +1 -1
- package/dist/adaptors/umi-request.d.mts +1 -1
- package/dist/adaptors/umi-request.mjs +1 -3
- package/dist/index.cjs +76 -56
- package/dist/index.d.cts +122 -4
- package/dist/index.d.mts +122 -4
- package/dist/index.mjs +72 -54
- package/package.json +7 -7
package/dist/adaptors/axios.cjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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;
|
package/dist/adaptors/axios.mjs
CHANGED
|
@@ -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 };
|
package/dist/adaptors/fetch.cjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value:
|
|
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;
|
package/dist/adaptors/fetch.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
|
|
3
|
-
|
|
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,
|
|
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,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, {
|
|
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({
|
|
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
|
/**
|
|
@@ -251,7 +256,7 @@ var AIController = class {
|
|
|
251
256
|
});
|
|
252
257
|
}
|
|
253
258
|
/**
|
|
254
|
-
*
|
|
259
|
+
* @deprecated Feature removed from core; see ai-insights equivalent.
|
|
255
260
|
* @param articleId
|
|
256
261
|
*/
|
|
257
262
|
async getDeepReading(articleId) {
|
|
@@ -334,8 +339,49 @@ var AIController = class {
|
|
|
334
339
|
}
|
|
335
340
|
});
|
|
336
341
|
}
|
|
342
|
+
/**
|
|
343
|
+
* Get cached AI insights for an article
|
|
344
|
+
* @support core >= 11.3.0
|
|
345
|
+
*/
|
|
346
|
+
async getInsights({ articleId, lang = "zh", onlyDb }) {
|
|
347
|
+
return this.proxy.insights.article(articleId).get({ params: {
|
|
348
|
+
lang,
|
|
349
|
+
onlyDb
|
|
350
|
+
} });
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Get URL for streaming insights generation (SSE)
|
|
354
|
+
*
|
|
355
|
+
* @see AIInsightsStreamEvent for event types
|
|
356
|
+
* @support core >= 11.3.0
|
|
357
|
+
*/
|
|
358
|
+
getInsightsGenerateUrl({ articleId, lang }) {
|
|
359
|
+
const baseUrl = this.client.endpoint;
|
|
360
|
+
const params = new URLSearchParams();
|
|
361
|
+
if (lang) params.set("lang", lang);
|
|
362
|
+
const query = params.toString();
|
|
363
|
+
return `${baseUrl}/${this.base}/insights/article/${articleId}/generate${query ? `?${query}` : ""}`;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Stream insights generation using fetch
|
|
367
|
+
*
|
|
368
|
+
* @see AIInsightsStreamEvent for event types
|
|
369
|
+
* @support core >= 11.3.0
|
|
370
|
+
*/
|
|
371
|
+
async streamInsightsGenerate({ articleId, lang }, fetchOptions) {
|
|
372
|
+
const url = this.getInsightsGenerateUrl({
|
|
373
|
+
articleId,
|
|
374
|
+
lang
|
|
375
|
+
});
|
|
376
|
+
return fetch(url, {
|
|
377
|
+
...fetchOptions,
|
|
378
|
+
headers: {
|
|
379
|
+
Accept: "text/event-stream",
|
|
380
|
+
...fetchOptions?.headers
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
}
|
|
337
384
|
};
|
|
338
|
-
|
|
339
385
|
//#endregion
|
|
340
386
|
//#region core/error.ts
|
|
341
387
|
var RequestError = class extends Error {
|
|
@@ -346,7 +392,6 @@ var RequestError = class extends Error {
|
|
|
346
392
|
this.raw = raw;
|
|
347
393
|
}
|
|
348
394
|
};
|
|
349
|
-
|
|
350
395
|
//#endregion
|
|
351
396
|
//#region models/category.ts
|
|
352
397
|
let CategoryType = /* @__PURE__ */ function(CategoryType) {
|
|
@@ -354,7 +399,6 @@ let CategoryType = /* @__PURE__ */ function(CategoryType) {
|
|
|
354
399
|
CategoryType[CategoryType["Tag"] = 1] = "Tag";
|
|
355
400
|
return CategoryType;
|
|
356
401
|
}({});
|
|
357
|
-
|
|
358
402
|
//#endregion
|
|
359
403
|
//#region controllers/category.ts
|
|
360
404
|
var CategoryController = class {
|
|
@@ -368,10 +412,10 @@ var CategoryController = class {
|
|
|
368
412
|
return this.client.proxy(this.base);
|
|
369
413
|
}
|
|
370
414
|
getAllCategories() {
|
|
371
|
-
return this.proxy.get({ params: { type:
|
|
415
|
+
return this.proxy.get({ params: { type: 0 } });
|
|
372
416
|
}
|
|
373
417
|
getAllTags() {
|
|
374
|
-
return this.proxy.get({ params: { type:
|
|
418
|
+
return this.proxy.get({ params: { type: 1 } });
|
|
375
419
|
}
|
|
376
420
|
async getCategoryDetail(ids) {
|
|
377
421
|
if (typeof ids === "string") {
|
|
@@ -395,7 +439,6 @@ var CategoryController = class {
|
|
|
395
439
|
return await this.proxy(name).get({ params: { tag: 1 } });
|
|
396
440
|
}
|
|
397
441
|
};
|
|
398
|
-
|
|
399
442
|
//#endregion
|
|
400
443
|
//#region controllers/comment.ts
|
|
401
444
|
var CommentController = class {
|
|
@@ -418,11 +461,13 @@ var CommentController = class {
|
|
|
418
461
|
* 获取文章的评论列表
|
|
419
462
|
* @param refId 文章 Id
|
|
420
463
|
*/
|
|
421
|
-
getByRefId(refId,
|
|
422
|
-
const { page, size } =
|
|
464
|
+
getByRefId(refId, params = {}) {
|
|
465
|
+
const { page, size, sort, around } = params;
|
|
423
466
|
return this.proxy.ref(refId).get({ params: {
|
|
424
467
|
page: page || 1,
|
|
425
|
-
size: size || 10
|
|
468
|
+
size: size || 10,
|
|
469
|
+
...sort ? { sort } : {},
|
|
470
|
+
...around ? { around } : {}
|
|
426
471
|
} });
|
|
427
472
|
}
|
|
428
473
|
getThreadReplies(rootCommentId, params = {}) {
|
|
@@ -447,7 +492,6 @@ var CommentController = class {
|
|
|
447
492
|
return this.proxy.reader.reply(commentId).post({ data });
|
|
448
493
|
}
|
|
449
494
|
};
|
|
450
|
-
|
|
451
495
|
//#endregion
|
|
452
496
|
//#region controllers/base.ts
|
|
453
497
|
var BaseCrudController = class {
|
|
@@ -477,7 +521,6 @@ var BaseCrudController = class {
|
|
|
477
521
|
} });
|
|
478
522
|
}
|
|
479
523
|
};
|
|
480
|
-
|
|
481
524
|
//#endregion
|
|
482
525
|
//#region controllers/link.ts
|
|
483
526
|
var LinkController = class extends BaseCrudController {
|
|
@@ -496,7 +539,6 @@ var LinkController = class extends BaseCrudController {
|
|
|
496
539
|
return await this.proxy.audit.post({ data });
|
|
497
540
|
}
|
|
498
541
|
};
|
|
499
|
-
|
|
500
542
|
//#endregion
|
|
501
543
|
//#region controllers/note.ts
|
|
502
544
|
var NoteController = class {
|
|
@@ -592,7 +634,6 @@ var NoteController = class {
|
|
|
592
634
|
} });
|
|
593
635
|
}
|
|
594
636
|
};
|
|
595
|
-
|
|
596
637
|
//#endregion
|
|
597
638
|
//#region controllers/owner.ts
|
|
598
639
|
var UserController = class {
|
|
@@ -667,7 +708,6 @@ var UserController = class {
|
|
|
667
708
|
return this.proxy.check_logged.get({ params: normalized ? { token: normalized } : void 0 });
|
|
668
709
|
}
|
|
669
710
|
};
|
|
670
|
-
|
|
671
711
|
//#endregion
|
|
672
712
|
//#region controllers/page.ts
|
|
673
713
|
var PageController = class {
|
|
@@ -708,7 +748,6 @@ var PageController = class {
|
|
|
708
748
|
return this.proxy.slug(slug).get({ params: options?.prefer ? { prefer: options.prefer } : void 0 });
|
|
709
749
|
}
|
|
710
750
|
};
|
|
711
|
-
|
|
712
751
|
//#endregion
|
|
713
752
|
//#region controllers/post.ts
|
|
714
753
|
var PostController = class {
|
|
@@ -760,7 +799,6 @@ var PostController = class {
|
|
|
760
799
|
return this.proxy("get-url")(slug).get();
|
|
761
800
|
}
|
|
762
801
|
};
|
|
763
|
-
|
|
764
802
|
//#endregion
|
|
765
803
|
//#region controllers/project.ts
|
|
766
804
|
var ProjectController = class extends BaseCrudController {
|
|
@@ -772,7 +810,6 @@ var ProjectController = class extends BaseCrudController {
|
|
|
772
810
|
autoBind(this);
|
|
773
811
|
}
|
|
774
812
|
};
|
|
775
|
-
|
|
776
813
|
//#endregion
|
|
777
814
|
//#region controllers/recently.ts
|
|
778
815
|
let RecentlyAttitudeResultEnum = /* @__PURE__ */ function(RecentlyAttitudeResultEnum) {
|
|
@@ -819,7 +856,6 @@ var RecentlyController = class {
|
|
|
819
856
|
return this.proxy.attitude(id).get({ params: { attitude } });
|
|
820
857
|
}
|
|
821
858
|
};
|
|
822
|
-
|
|
823
859
|
//#endregion
|
|
824
860
|
//#region controllers/say.ts
|
|
825
861
|
var SayController = class extends BaseCrudController {
|
|
@@ -840,7 +876,6 @@ var SayController = class extends BaseCrudController {
|
|
|
840
876
|
return this.proxy.random.get();
|
|
841
877
|
}
|
|
842
878
|
};
|
|
843
|
-
|
|
844
879
|
//#endregion
|
|
845
880
|
//#region controllers/search.ts
|
|
846
881
|
var SearchController = class {
|
|
@@ -866,7 +901,6 @@ var SearchController = class {
|
|
|
866
901
|
} });
|
|
867
902
|
}
|
|
868
903
|
};
|
|
869
|
-
|
|
870
904
|
//#endregion
|
|
871
905
|
//#region controllers/severless.ts
|
|
872
906
|
var ServerlessController = class {
|
|
@@ -883,7 +917,6 @@ var ServerlessController = class {
|
|
|
883
917
|
return this.proxy(reference)(name).get();
|
|
884
918
|
}
|
|
885
919
|
};
|
|
886
|
-
|
|
887
920
|
//#endregion
|
|
888
921
|
//#region controllers/snippet.ts
|
|
889
922
|
var SnippetController = class {
|
|
@@ -900,7 +933,6 @@ var SnippetController = class {
|
|
|
900
933
|
return this.proxy(reference)(name).get();
|
|
901
934
|
}
|
|
902
935
|
};
|
|
903
|
-
|
|
904
936
|
//#endregion
|
|
905
937
|
//#region controllers/subscribe.ts
|
|
906
938
|
var SubscribeController = class {
|
|
@@ -932,7 +964,6 @@ var SubscribeController = class {
|
|
|
932
964
|
} });
|
|
933
965
|
}
|
|
934
966
|
};
|
|
935
|
-
|
|
936
967
|
//#endregion
|
|
937
968
|
//#region controllers/topic.ts
|
|
938
969
|
var TopicController = class extends BaseCrudController {
|
|
@@ -950,7 +981,6 @@ var TopicController = class extends BaseCrudController {
|
|
|
950
981
|
return this.proxy.slug(slug).get();
|
|
951
982
|
}
|
|
952
983
|
};
|
|
953
|
-
|
|
954
984
|
//#endregion
|
|
955
985
|
//#region controllers/index.ts
|
|
956
986
|
const allControllers = [
|
|
@@ -997,7 +1027,6 @@ const allControllerNames = [
|
|
|
997
1027
|
"friend",
|
|
998
1028
|
"shorthand"
|
|
999
1029
|
];
|
|
1000
|
-
|
|
1001
1030
|
//#endregion
|
|
1002
1031
|
//#region core/attach-request.ts
|
|
1003
1032
|
function attachRequestMethod(target) {
|
|
@@ -1027,7 +1056,6 @@ function handleSearchParams(obj) {
|
|
|
1027
1056
|
});
|
|
1028
1057
|
return search.toString();
|
|
1029
1058
|
}
|
|
1030
|
-
|
|
1031
1059
|
//#endregion
|
|
1032
1060
|
//#region core/client.ts
|
|
1033
1061
|
const methodPrefix = "_$";
|
|
@@ -1115,14 +1143,15 @@ var HTTPClient = class {
|
|
|
1115
1143
|
return path.startsWith("/") ? path : `/${path}`;
|
|
1116
1144
|
}
|
|
1117
1145
|
};
|
|
1118
|
-
if (methods.includes(name)) return async (options) => {
|
|
1146
|
+
if (methods.includes(name)) return async (options = {}) => {
|
|
1119
1147
|
const url = resolveFullPath(that.endpoint, route.join("/"));
|
|
1120
1148
|
route.length = 0;
|
|
1149
|
+
const { transformResponse: perRequestTransformResponse, ...requestOptions } = options;
|
|
1121
1150
|
let res;
|
|
1122
1151
|
try {
|
|
1123
1152
|
res = await manager.request({
|
|
1124
1153
|
method: name,
|
|
1125
|
-
...
|
|
1154
|
+
...requestOptions,
|
|
1126
1155
|
url
|
|
1127
1156
|
});
|
|
1128
1157
|
} catch (error) {
|
|
@@ -1137,7 +1166,8 @@ var HTTPClient = class {
|
|
|
1137
1166
|
}
|
|
1138
1167
|
const data = that.options.getDataFromResponse(res);
|
|
1139
1168
|
if (!data) return null;
|
|
1140
|
-
const
|
|
1169
|
+
const responseTransformer = perRequestTransformResponse === void 0 ? that.options.transformResponse : perRequestTransformResponse || void 0;
|
|
1170
|
+
const cameledObject = (Array.isArray(data) || isPlainObject(data)) && responseTransformer ? responseTransformer(data) : data;
|
|
1141
1171
|
let nextObject = cameledObject;
|
|
1142
1172
|
if (cameledObject && typeof cameledObject === "object") {
|
|
1143
1173
|
nextObject = Array.isArray(cameledObject) ? [...cameledObject] : { ...cameledObject };
|
|
@@ -1184,7 +1214,6 @@ function createClient(adapter) {
|
|
|
1184
1214
|
return client;
|
|
1185
1215
|
};
|
|
1186
1216
|
}
|
|
1187
|
-
|
|
1188
1217
|
//#endregion
|
|
1189
1218
|
//#region models/aggregate.ts
|
|
1190
1219
|
let TimelineType = /* @__PURE__ */ function(TimelineType) {
|
|
@@ -1192,7 +1221,6 @@ let TimelineType = /* @__PURE__ */ function(TimelineType) {
|
|
|
1192
1221
|
TimelineType[TimelineType["Note"] = 1] = "Note";
|
|
1193
1222
|
return TimelineType;
|
|
1194
1223
|
}({});
|
|
1195
|
-
|
|
1196
1224
|
//#endregion
|
|
1197
1225
|
//#region ../../apps/core/src/constants/db.constant.ts
|
|
1198
1226
|
const NOTE_COLLECTION_NAME = "notes";
|
|
@@ -1206,7 +1234,6 @@ let CollectionRefTypes = /* @__PURE__ */ function(CollectionRefTypes) {
|
|
|
1206
1234
|
CollectionRefTypes[CollectionRefTypes["Recently"] = RECENTLY_COLLECTION_NAME] = "Recently";
|
|
1207
1235
|
return CollectionRefTypes;
|
|
1208
1236
|
}({});
|
|
1209
|
-
|
|
1210
1237
|
//#endregion
|
|
1211
1238
|
//#region models/comment.ts
|
|
1212
1239
|
let CommentState = /* @__PURE__ */ function(CommentState) {
|
|
@@ -1215,7 +1242,6 @@ let CommentState = /* @__PURE__ */ function(CommentState) {
|
|
|
1215
1242
|
CommentState[CommentState["Junk"] = 2] = "Junk";
|
|
1216
1243
|
return CommentState;
|
|
1217
1244
|
}({});
|
|
1218
|
-
|
|
1219
1245
|
//#endregion
|
|
1220
1246
|
//#region models/link.ts
|
|
1221
1247
|
let LinkType = /* @__PURE__ */ function(LinkType) {
|
|
@@ -1231,7 +1257,6 @@ let LinkState = /* @__PURE__ */ function(LinkState) {
|
|
|
1231
1257
|
LinkState[LinkState["Reject"] = 4] = "Reject";
|
|
1232
1258
|
return LinkState;
|
|
1233
1259
|
}({});
|
|
1234
|
-
|
|
1235
1260
|
//#endregion
|
|
1236
1261
|
//#region models/page.ts
|
|
1237
1262
|
let EnumPageType = /* @__PURE__ */ function(EnumPageType) {
|
|
@@ -1240,7 +1265,6 @@ let EnumPageType = /* @__PURE__ */ function(EnumPageType) {
|
|
|
1240
1265
|
EnumPageType["frame"] = "frame";
|
|
1241
1266
|
return EnumPageType;
|
|
1242
1267
|
}({});
|
|
1243
|
-
|
|
1244
1268
|
//#endregion
|
|
1245
1269
|
//#region models/recently.ts
|
|
1246
1270
|
let RecentlyRefTypes = /* @__PURE__ */ function(RecentlyRefTypes) {
|
|
@@ -1260,7 +1284,6 @@ let RecentlyTypeEnum = /* @__PURE__ */ function(RecentlyTypeEnum) {
|
|
|
1260
1284
|
RecentlyTypeEnum["Code"] = "code";
|
|
1261
1285
|
return RecentlyTypeEnum;
|
|
1262
1286
|
}({});
|
|
1263
|
-
|
|
1264
1287
|
//#endregion
|
|
1265
1288
|
//#region models/snippet.ts
|
|
1266
1289
|
let SnippetType = /* @__PURE__ */ function(SnippetType) {
|
|
@@ -1270,7 +1293,6 @@ let SnippetType = /* @__PURE__ */ function(SnippetType) {
|
|
|
1270
1293
|
SnippetType["YAML"] = "yaml";
|
|
1271
1294
|
return SnippetType;
|
|
1272
1295
|
}({});
|
|
1273
|
-
|
|
1274
1296
|
//#endregion
|
|
1275
1297
|
//#region ../../apps/core/src/modules/subscribe/subscribe.constant.ts
|
|
1276
1298
|
const SubscribePostCreateBit = 1;
|
|
@@ -1279,17 +1301,15 @@ const SubscribeSayCreateBit = 4;
|
|
|
1279
1301
|
const SubscribeRecentCreateBit = 8;
|
|
1280
1302
|
const SubscribeAllBit = 15;
|
|
1281
1303
|
const SubscribeTypeToBitMap = {
|
|
1282
|
-
post_c:
|
|
1283
|
-
note_c:
|
|
1284
|
-
say_c:
|
|
1285
|
-
recently_c:
|
|
1286
|
-
all:
|
|
1304
|
+
post_c: 1,
|
|
1305
|
+
note_c: 2,
|
|
1306
|
+
say_c: 4,
|
|
1307
|
+
recently_c: 8,
|
|
1308
|
+
all: 15
|
|
1287
1309
|
};
|
|
1288
|
-
|
|
1289
1310
|
//#endregion
|
|
1290
1311
|
//#region index.ts
|
|
1291
1312
|
var api_client_default = createClient;
|
|
1292
|
-
|
|
1293
1313
|
//#endregion
|
|
1294
1314
|
exports.AIController = AIController;
|
|
1295
1315
|
exports.AckController = AckController;
|
|
@@ -1333,4 +1353,4 @@ exports.allControllerNames = allControllerNames;
|
|
|
1333
1353
|
exports.allControllers = allControllers;
|
|
1334
1354
|
exports.createClient = createClient;
|
|
1335
1355
|
exports.default = api_client_default;
|
|
1336
|
-
exports.simpleCamelcaseKeys = camelcaseKeys;
|
|
1356
|
+
exports.simpleCamelcaseKeys = camelcaseKeys;
|