@mx-space/api-client 1.16.1 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/controllers/ack.ts +1 -2
- package/controllers/activity.ts +1 -2
- package/controllers/aggregate.ts +1 -2
- package/controllers/ai.ts +12 -3
- package/controllers/base.ts +1 -2
- package/controllers/category.ts +4 -6
- package/controllers/comment.ts +1 -2
- package/controllers/link.ts +1 -3
- package/controllers/note.ts +5 -3
- package/controllers/page.ts +1 -2
- package/controllers/post.ts +1 -2
- package/controllers/project.ts +1 -3
- package/controllers/recently.ts +1 -2
- package/controllers/say.ts +1 -3
- package/controllers/search.ts +2 -3
- package/controllers/severless.ts +1 -2
- package/controllers/snippet.ts +1 -2
- package/controllers/subscribe.ts +1 -2
- package/controllers/topic.ts +1 -3
- package/controllers/user.ts +1 -2
- package/dist/adapter-B1dtiutp.d.cts +25 -0
- package/dist/adapter-CRsPadpS.d.mts +25 -0
- package/dist/adaptors/axios.cjs +53 -57
- package/dist/adaptors/axios.d.cts +5 -4
- package/dist/adaptors/axios.d.mts +7 -0
- package/dist/adaptors/axios.mjs +33 -0
- package/dist/adaptors/fetch.cjs +72 -108
- package/dist/adaptors/fetch.d.cts +4 -3
- package/dist/adaptors/fetch.d.mts +6 -0
- package/dist/adaptors/fetch.mjs +75 -0
- package/dist/adaptors/umi-request.cjs +32 -54
- package/dist/adaptors/umi-request.d.cts +5 -4
- package/dist/adaptors/umi-request.d.mts +7 -0
- package/dist/adaptors/umi-request.mjs +33 -0
- package/dist/index.cjs +1042 -1199
- package/dist/index.d.cts +1758 -1643
- package/dist/index.d.mts +2016 -0
- package/dist/index.mjs +1101 -0
- package/index.ts +0 -1
- package/interfaces/request.ts +3 -1
- package/mod-dts.mjs +15 -12
- package/models/aggregate.ts +0 -2
- package/models/ai.ts +9 -0
- package/models/comment.ts +1 -2
- package/models/note.ts +1 -1
- package/models/recently.ts +2 -0
- package/models/setting.ts +5 -0
- package/package.json +20 -20
- package/readme.md +3 -3
- package/tsconfig.json +11 -11
- package/{tsup.config.ts → tsdown.config.ts} +2 -2
- package/vitest.config.ts +0 -1
- package/.eslintcache +0 -1
- package/coverage/clover.xml +0 -591
- package/coverage/coverage-final.json +0 -5944
- package/coverage/lcov-report/adaptors/axios.ts.html +0 -201
- package/coverage/lcov-report/adaptors/index.html +0 -196
- package/coverage/lcov-report/adaptors/umi-request.ts.html +0 -186
- package/coverage/lcov-report/auto-bind.ts.html +0 -228
- package/coverage/lcov-report/base.css +0 -354
- package/coverage/lcov-report/block-navigation.js +0 -85
- package/coverage/lcov-report/controllers/aggregate.ts.html +0 -294
- package/coverage/lcov-report/controllers/base.ts.html +0 -183
- package/coverage/lcov-report/controllers/category.ts.html +0 -441
- package/coverage/lcov-report/controllers/comment.ts.html +0 -291
- package/coverage/lcov-report/controllers/index.html +0 -476
- package/coverage/lcov-report/controllers/index.ts.html +0 -297
- package/coverage/lcov-report/controllers/link.ts.html +0 -216
- package/coverage/lcov-report/controllers/note.ts.html +0 -375
- package/coverage/lcov-report/controllers/page.ts.html +0 -279
- package/coverage/lcov-report/controllers/post.ts.html +0 -369
- package/coverage/lcov-report/controllers/project.ts.html +0 -168
- package/coverage/lcov-report/controllers/recently.ts.html +0 -246
- package/coverage/lcov-report/controllers/say.ts.html +0 -207
- package/coverage/lcov-report/controllers/search.ts.html +0 -411
- package/coverage/lcov-report/controllers/severless.ts.html +0 -180
- package/coverage/lcov-report/controllers/snippet.ts.html +0 -195
- package/coverage/lcov-report/controllers/user.ts.html +0 -240
- package/coverage/lcov-report/core/attach-request.ts.html +0 -216
- package/coverage/lcov-report/core/client.ts.html +0 -786
- package/coverage/lcov-report/core/error.ts.html +0 -117
- package/coverage/lcov-report/core/index.html +0 -236
- package/coverage/lcov-report/core/index.ts.html +0 -93
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -276
- package/coverage/lcov-report/index.ts.html +0 -243
- package/coverage/lcov-report/models/aggregate.ts.html +0 -300
- package/coverage/lcov-report/models/category.ts.html +0 -162
- package/coverage/lcov-report/models/index.html +0 -196
- package/coverage/lcov-report/prettify.css +0 -101
- package/coverage/lcov-report/prettify.js +0 -1004
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -191
- package/coverage/lcov-report/utils/auto-bind.ts.html +0 -231
- package/coverage/lcov-report/utils/index.html +0 -216
- package/coverage/lcov-report/utils/index.ts.html +0 -246
- package/coverage/lcov-report/utils/path.ts.html +0 -105
- package/coverage/lcov.info +0 -1209
- package/dist/adapter-B8tKfr1O.d.cts +0 -23
- package/dist/adapter-B8tKfr1O.d.ts +0 -23
- package/dist/adaptors/axios.d.ts +0 -6
- package/dist/adaptors/axios.global.js +0 -14151
- package/dist/adaptors/axios.js +0 -33
- package/dist/adaptors/fetch.d.ts +0 -5
- package/dist/adaptors/fetch.global.js +0 -87
- package/dist/adaptors/fetch.js +0 -87
- package/dist/adaptors/umi-request.d.ts +0 -6
- package/dist/adaptors/umi-request.global.js +0 -7379
- package/dist/adaptors/umi-request.js +0 -33
- package/dist/index.d.ts +0 -1901
- package/dist/index.global.js +0 -1193
- package/dist/index.js +0 -1234
- package/esm/apps/core/src/modules/subscribe/subscribe.constant.d.ts +0 -12
- package/esm/apps/core/src/modules/subscribe/subscribe.constant.js +0 -16
- package/esm/apps/core/src/modules/subscribe/subscribe.constant.js.map +0 -1
- package/esm/packages/api-client/adaptors/axios.d.ts +0 -4
- package/esm/packages/api-client/adaptors/axios.js +0 -37
- package/esm/packages/api-client/adaptors/axios.js.map +0 -1
- package/esm/packages/api-client/adaptors/fetch.d.ts +0 -2
- package/esm/packages/api-client/adaptors/fetch.js +0 -95
- package/esm/packages/api-client/adaptors/fetch.js.map +0 -1
- package/esm/packages/api-client/adaptors/ky.d.ts +0 -23
- package/esm/packages/api-client/adaptors/ky.js +0 -62
- package/esm/packages/api-client/adaptors/ky.js.map +0 -1
- package/esm/packages/api-client/adaptors/umi-request.d.ts +0 -4
- package/esm/packages/api-client/adaptors/umi-request.js +0 -31
- package/esm/packages/api-client/adaptors/umi-request.js.map +0 -1
- package/esm/packages/api-client/controllers/aggregate.d.ts +0 -64
- package/esm/packages/api-client/controllers/aggregate.js +0 -46
- package/esm/packages/api-client/controllers/aggregate.js.map +0 -1
- package/esm/packages/api-client/controllers/base.d.ts +0 -43
- package/esm/packages/api-client/controllers/base.js +0 -27
- package/esm/packages/api-client/controllers/base.js.map +0 -1
- package/esm/packages/api-client/controllers/category.d.ts +0 -120
- package/esm/packages/api-client/controllers/category.js +0 -68
- package/esm/packages/api-client/controllers/category.js.map +0 -1
- package/esm/packages/api-client/controllers/comment.d.ts +0 -81
- package/esm/packages/api-client/controllers/comment.js +0 -47
- package/esm/packages/api-client/controllers/comment.js.map +0 -1
- package/esm/packages/api-client/controllers/index.d.ts +0 -19
- package/esm/packages/api-client/controllers/index.js +0 -60
- package/esm/packages/api-client/controllers/index.js.map +0 -1
- package/esm/packages/api-client/controllers/link.d.ts +0 -20
- package/esm/packages/api-client/controllers/link.js +0 -21
- package/esm/packages/api-client/controllers/link.js.map +0 -1
- package/esm/packages/api-client/controllers/note.d.ts +0 -103
- package/esm/packages/api-client/controllers/note.js +0 -68
- package/esm/packages/api-client/controllers/note.js.map +0 -1
- package/esm/packages/api-client/controllers/page.d.ts +0 -59
- package/esm/packages/api-client/controllers/page.js +0 -42
- package/esm/packages/api-client/controllers/page.js.map +0 -1
- package/esm/packages/api-client/controllers/post.d.ts +0 -72
- package/esm/packages/api-client/controllers/post.js +0 -52
- package/esm/packages/api-client/controllers/post.js.map +0 -1
- package/esm/packages/api-client/controllers/project.d.ts +0 -15
- package/esm/packages/api-client/controllers/project.js +0 -12
- package/esm/packages/api-client/controllers/project.js.map +0 -1
- package/esm/packages/api-client/controllers/recently.d.ts +0 -110
- package/esm/packages/api-client/controllers/recently.js +0 -49
- package/esm/packages/api-client/controllers/recently.js.map +0 -1
- package/esm/packages/api-client/controllers/say.d.ts +0 -37
- package/esm/packages/api-client/controllers/say.js +0 -21
- package/esm/packages/api-client/controllers/say.js.map +0 -1
- package/esm/packages/api-client/controllers/search.d.ts +0 -87
- package/esm/packages/api-client/controllers/search.js +0 -28
- package/esm/packages/api-client/controllers/search.js.map +0 -1
- package/esm/packages/api-client/controllers/severless.d.ts +0 -24
- package/esm/packages/api-client/controllers/severless.js +0 -16
- package/esm/packages/api-client/controllers/severless.js.map +0 -1
- package/esm/packages/api-client/controllers/snippet.d.ts +0 -24
- package/esm/packages/api-client/controllers/snippet.js +0 -19
- package/esm/packages/api-client/controllers/snippet.js.map +0 -1
- package/esm/packages/api-client/controllers/subscribe.d.ts +0 -64
- package/esm/packages/api-client/controllers/subscribe.js +0 -35
- package/esm/packages/api-client/controllers/subscribe.js.map +0 -1
- package/esm/packages/api-client/controllers/topic.d.ts +0 -26
- package/esm/packages/api-client/controllers/topic.js +0 -18
- package/esm/packages/api-client/controllers/topic.js.map +0 -1
- package/esm/packages/api-client/controllers/user.d.ts +0 -70
- package/esm/packages/api-client/controllers/user.js +0 -40
- package/esm/packages/api-client/controllers/user.js.map +0 -1
- package/esm/packages/api-client/core/attach-request.d.ts +0 -2
- package/esm/packages/api-client/core/attach-request.js +0 -36
- package/esm/packages/api-client/core/attach-request.js.map +0 -1
- package/esm/packages/api-client/core/client.d.ts +0 -29
- package/esm/packages/api-client/core/client.js +0 -193
- package/esm/packages/api-client/core/client.js.map +0 -1
- package/esm/packages/api-client/core/error.d.ts +0 -6
- package/esm/packages/api-client/core/error.js +0 -9
- package/esm/packages/api-client/core/error.js.map +0 -1
- package/esm/packages/api-client/core/index.d.ts +0 -2
- package/esm/packages/api-client/core/index.js +0 -3
- package/esm/packages/api-client/core/index.js.map +0 -1
- package/esm/packages/api-client/dtos/comment.d.ts +0 -8
- package/esm/packages/api-client/dtos/comment.js +0 -2
- package/esm/packages/api-client/dtos/comment.js.map +0 -1
- package/esm/packages/api-client/dtos/index.d.ts +0 -1
- package/esm/packages/api-client/dtos/index.js +0 -2
- package/esm/packages/api-client/dtos/index.js.map +0 -1
- package/esm/packages/api-client/index.d.ts +0 -8
- package/esm/packages/api-client/index.js +0 -9
- package/esm/packages/api-client/index.js.map +0 -1
- package/esm/packages/api-client/interfaces/adapter.d.ts +0 -14
- package/esm/packages/api-client/interfaces/adapter.js +0 -2
- package/esm/packages/api-client/interfaces/adapter.js.map +0 -1
- package/esm/packages/api-client/interfaces/client.d.ts +0 -13
- package/esm/packages/api-client/interfaces/client.js +0 -2
- package/esm/packages/api-client/interfaces/client.js.map +0 -1
- package/esm/packages/api-client/interfaces/controller.d.ts +0 -4
- package/esm/packages/api-client/interfaces/controller.js +0 -2
- package/esm/packages/api-client/interfaces/controller.js.map +0 -1
- package/esm/packages/api-client/interfaces/instance.d.ts +0 -7
- package/esm/packages/api-client/interfaces/instance.js +0 -2
- package/esm/packages/api-client/interfaces/instance.js.map +0 -1
- package/esm/packages/api-client/interfaces/options.d.ts +0 -1
- package/esm/packages/api-client/interfaces/options.js +0 -2
- package/esm/packages/api-client/interfaces/options.js.map +0 -1
- package/esm/packages/api-client/interfaces/params.d.ts +0 -4
- package/esm/packages/api-client/interfaces/params.js +0 -2
- package/esm/packages/api-client/interfaces/params.js.map +0 -1
- package/esm/packages/api-client/interfaces/request.d.ts +0 -44
- package/esm/packages/api-client/interfaces/request.js +0 -2
- package/esm/packages/api-client/interfaces/request.js.map +0 -1
- package/esm/packages/api-client/interfaces/types.d.ts +0 -2
- package/esm/packages/api-client/interfaces/types.js +0 -2
- package/esm/packages/api-client/interfaces/types.js.map +0 -1
- package/esm/packages/api-client/models/aggregate.d.ts +0 -67
- package/esm/packages/api-client/models/aggregate.js +0 -6
- package/esm/packages/api-client/models/aggregate.js.map +0 -1
- package/esm/packages/api-client/models/base.d.ts +0 -40
- package/esm/packages/api-client/models/base.js +0 -2
- package/esm/packages/api-client/models/base.js.map +0 -1
- package/esm/packages/api-client/models/category.d.ts +0 -22
- package/esm/packages/api-client/models/category.js +0 -6
- package/esm/packages/api-client/models/category.js.map +0 -1
- package/esm/packages/api-client/models/comment.d.ts +0 -39
- package/esm/packages/api-client/models/comment.js +0 -13
- package/esm/packages/api-client/models/comment.js.map +0 -1
- package/esm/packages/api-client/models/index.d.ts +0 -16
- package/esm/packages/api-client/models/index.js +0 -17
- package/esm/packages/api-client/models/index.js.map +0 -1
- package/esm/packages/api-client/models/link.d.ts +0 -22
- package/esm/packages/api-client/models/link.js +0 -14
- package/esm/packages/api-client/models/link.js.map +0 -1
- package/esm/packages/api-client/models/note.d.ts +0 -38
- package/esm/packages/api-client/models/note.js +0 -2
- package/esm/packages/api-client/models/note.js.map +0 -1
- package/esm/packages/api-client/models/page.d.ts +0 -14
- package/esm/packages/api-client/models/page.js +0 -7
- package/esm/packages/api-client/models/page.js.map +0 -1
- package/esm/packages/api-client/models/post.d.ts +0 -17
- package/esm/packages/api-client/models/post.js +0 -2
- package/esm/packages/api-client/models/post.js.map +0 -1
- package/esm/packages/api-client/models/project.d.ts +0 -11
- package/esm/packages/api-client/models/project.js +0 -2
- package/esm/packages/api-client/models/project.js.map +0 -1
- package/esm/packages/api-client/models/recently.d.ts +0 -20
- package/esm/packages/api-client/models/recently.js +0 -7
- package/esm/packages/api-client/models/recently.js.map +0 -1
- package/esm/packages/api-client/models/say.d.ts +0 -6
- package/esm/packages/api-client/models/say.js +0 -2
- package/esm/packages/api-client/models/say.js.map +0 -1
- package/esm/packages/api-client/models/setting.d.ts +0 -66
- package/esm/packages/api-client/models/setting.js +0 -2
- package/esm/packages/api-client/models/setting.js.map +0 -1
- package/esm/packages/api-client/models/snippet.d.ts +0 -18
- package/esm/packages/api-client/models/snippet.js +0 -8
- package/esm/packages/api-client/models/snippet.js.map +0 -1
- package/esm/packages/api-client/models/subscribe.d.ts +0 -3
- package/esm/packages/api-client/models/subscribe.js +0 -2
- package/esm/packages/api-client/models/subscribe.js.map +0 -1
- package/esm/packages/api-client/models/topic.d.ts +0 -8
- package/esm/packages/api-client/models/topic.js +0 -2
- package/esm/packages/api-client/models/topic.js.map +0 -1
- package/esm/packages/api-client/models/user.d.ts +0 -21
- package/esm/packages/api-client/models/user.js +0 -2
- package/esm/packages/api-client/models/user.js.map +0 -1
- package/esm/packages/api-client/tsup.config.d.ts +0 -2
- package/esm/packages/api-client/tsup.config.js +0 -14
- package/esm/packages/api-client/tsup.config.js.map +0 -1
- package/esm/packages/api-client/utils/auto-bind.d.ts +0 -4
- package/esm/packages/api-client/utils/auto-bind.js +0 -36
- package/esm/packages/api-client/utils/auto-bind.js.map +0 -1
- package/esm/packages/api-client/utils/camelcase-keys.d.ts +0 -6
- package/esm/packages/api-client/utils/camelcase-keys.js +0 -23
- package/esm/packages/api-client/utils/camelcase-keys.js.map +0 -1
- package/esm/packages/api-client/utils/index.d.ts +0 -5
- package/esm/packages/api-client/utils/index.js +0 -43
- package/esm/packages/api-client/utils/index.js.map +0 -1
- package/esm/packages/api-client/utils/path.d.ts +0 -1
- package/esm/packages/api-client/utils/path.js +0 -7
- package/esm/packages/api-client/utils/path.js.map +0 -1
- package/esm/packages/api-client/vitest.config.d.ts +0 -2
- package/esm/packages/api-client/vitest.config.js +0 -15
- package/esm/packages/api-client/vitest.config.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,1301 +1,1144 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
19
2
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
CategoryController: () => CategoryController,
|
|
28
|
-
CategoryType: () => CategoryType,
|
|
29
|
-
CollectionRefTypes: () => CollectionRefTypes,
|
|
30
|
-
CommentController: () => CommentController,
|
|
31
|
-
CommentState: () => CommentState,
|
|
32
|
-
EnumPageType: () => EnumPageType,
|
|
33
|
-
LinkController: () => LinkController,
|
|
34
|
-
LinkState: () => LinkState,
|
|
35
|
-
LinkType: () => LinkType,
|
|
36
|
-
NoteController: () => NoteController,
|
|
37
|
-
PageController: () => PageController,
|
|
38
|
-
PostController: () => PostController,
|
|
39
|
-
ProjectController: () => ProjectController,
|
|
40
|
-
RecentlyAttitudeEnum: () => RecentlyAttitudeEnum,
|
|
41
|
-
RecentlyAttitudeResultEnum: () => RecentlyAttitudeResultEnum,
|
|
42
|
-
RecentlyController: () => RecentlyController,
|
|
43
|
-
RecentlyRefTypes: () => RecentlyRefTypes,
|
|
44
|
-
RequestError: () => RequestError,
|
|
45
|
-
SayController: () => SayController,
|
|
46
|
-
SearchController: () => SearchController,
|
|
47
|
-
ServerlessController: () => ServerlessController,
|
|
48
|
-
SnippetController: () => SnippetController,
|
|
49
|
-
SnippetType: () => SnippetType,
|
|
50
|
-
SubscribeAllBit: () => SubscribeAllBit,
|
|
51
|
-
SubscribeController: () => SubscribeController,
|
|
52
|
-
SubscribeNoteCreateBit: () => SubscribeNoteCreateBit,
|
|
53
|
-
SubscribePostCreateBit: () => SubscribePostCreateBit,
|
|
54
|
-
SubscribeRecentCreateBit: () => SubscribeRecentCreateBit,
|
|
55
|
-
SubscribeSayCreateBit: () => SubscribeSayCreateBit,
|
|
56
|
-
SubscribeTypeToBitMap: () => SubscribeTypeToBitMap,
|
|
57
|
-
TimelineType: () => TimelineType,
|
|
58
|
-
TopicController: () => TopicController,
|
|
59
|
-
UserController: () => UserController,
|
|
60
|
-
allControllerNames: () => allControllerNames,
|
|
61
|
-
allControllers: () => allControllers,
|
|
62
|
-
createClient: () => createClient,
|
|
63
|
-
default: () => api_client_default,
|
|
64
|
-
simpleCamelcaseKeys: () => camelcaseKeys
|
|
65
|
-
});
|
|
66
|
-
module.exports = __toCommonJS(api_client_exports);
|
|
67
|
-
|
|
68
|
-
// utils/index.ts
|
|
69
|
-
var isPlainObject = (obj) => isObject(obj) && Object.prototype.toString.call(obj) === "[object Object]" && Object.getPrototypeOf(obj) === Object.prototype;
|
|
70
|
-
var sortOrderToNumber = (order) => {
|
|
71
|
-
return {
|
|
72
|
-
asc: 1,
|
|
73
|
-
desc: -1
|
|
74
|
-
}[order] || 1;
|
|
3
|
+
//#region utils/index.ts
|
|
4
|
+
const isPlainObject = (obj) => isObject(obj) && Object.prototype.toString.call(obj) === "[object Object]" && Object.getPrototypeOf(obj) === Object.prototype;
|
|
5
|
+
const sortOrderToNumber = (order) => {
|
|
6
|
+
return {
|
|
7
|
+
asc: 1,
|
|
8
|
+
desc: -1
|
|
9
|
+
}[order] || 1;
|
|
75
10
|
};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const d = Object.assign({}, data);
|
|
88
|
-
attachRawFromOneToAnthor(payload, d);
|
|
89
|
-
return d;
|
|
90
|
-
}
|
|
91
|
-
return payload;
|
|
11
|
+
const isObject = (obj) => obj && typeof obj === "object";
|
|
12
|
+
const destructureData = (payload) => {
|
|
13
|
+
if (typeof payload !== "object") return payload;
|
|
14
|
+
if (payload === null) return payload;
|
|
15
|
+
const data = payload.data;
|
|
16
|
+
if (isPlainObject(data) && Object.keys(payload).length === 1) {
|
|
17
|
+
const d = Object.assign({}, data);
|
|
18
|
+
attachRawFromOneToAnthor(payload, d);
|
|
19
|
+
return d;
|
|
20
|
+
}
|
|
21
|
+
return payload;
|
|
92
22
|
};
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
23
|
+
const attachRawFromOneToAnthor = (from, to) => {
|
|
24
|
+
if (!from || !isObject(to)) return;
|
|
25
|
+
[
|
|
26
|
+
"$raw",
|
|
27
|
+
"$request",
|
|
28
|
+
"$serialized"
|
|
29
|
+
].forEach((key) => {
|
|
30
|
+
from[key] && Object.defineProperty(to, key, {
|
|
31
|
+
get() {
|
|
32
|
+
return from[key];
|
|
33
|
+
},
|
|
34
|
+
enumerable: false
|
|
35
|
+
});
|
|
36
|
+
});
|
|
106
37
|
};
|
|
107
38
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region utils/camelcase-keys.ts
|
|
41
|
+
/**
|
|
42
|
+
* A simple camelCase function that only handles strings, but not handling symbol, date, or other complex case.
|
|
43
|
+
* If you need to handle more complex cases, please use camelcase-keys package.
|
|
44
|
+
*/
|
|
45
|
+
const camelcaseKeys = (obj) => {
|
|
46
|
+
if (Array.isArray(obj)) return obj.map((x) => camelcaseKeys(x));
|
|
47
|
+
if (isPlainObject(obj)) return Object.keys(obj).reduce((result, key) => {
|
|
48
|
+
const nextKey = isMongoId(key) ? key : camelcase(key);
|
|
49
|
+
result[nextKey] = camelcaseKeys(obj[key]);
|
|
50
|
+
return result;
|
|
51
|
+
}, {});
|
|
52
|
+
return obj;
|
|
121
53
|
};
|
|
122
54
|
function camelcase(str) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
55
|
+
return str.replace(/^_+/, "").replaceAll(/([_-][a-z])/gi, ($1) => {
|
|
56
|
+
return $1.toUpperCase().replace("-", "").replace("_", "");
|
|
57
|
+
});
|
|
126
58
|
}
|
|
127
|
-
|
|
59
|
+
const isMongoId = (id) => id.length === 24 && /^[\dA-F]{24}$/i.test(id);
|
|
128
60
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
return `${endpoint}${path}`;
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region utils/path.ts
|
|
63
|
+
const resolveFullPath = (endpoint, path) => {
|
|
64
|
+
if (!path.startsWith("/")) path = `/${path}`;
|
|
65
|
+
return `${endpoint}${path}`;
|
|
135
66
|
};
|
|
136
67
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
return properties;
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region utils/auto-bind.ts
|
|
70
|
+
const getAllProperties = (object) => {
|
|
71
|
+
const properties = /* @__PURE__ */ new Set();
|
|
72
|
+
do
|
|
73
|
+
for (const key of Reflect.ownKeys(object)) properties.add([object, key]);
|
|
74
|
+
while ((object = Reflect.getPrototypeOf(object)) && object !== Object.prototype);
|
|
75
|
+
return properties;
|
|
146
76
|
};
|
|
147
77
|
function autoBind(self, { include, exclude } = {}) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
continue;
|
|
161
|
-
}
|
|
162
|
-
const descriptor = Reflect.getOwnPropertyDescriptor(object, key);
|
|
163
|
-
if (descriptor && typeof descriptor.value === "function") {
|
|
164
|
-
self[key] = self[key].bind(self);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
return self;
|
|
78
|
+
const filter = (key) => {
|
|
79
|
+
const match = (pattern) => typeof pattern === "string" ? key === pattern : pattern.test(key);
|
|
80
|
+
if (include) return include.some(match);
|
|
81
|
+
if (exclude) return !exclude.some(match);
|
|
82
|
+
return true;
|
|
83
|
+
};
|
|
84
|
+
for (const [object, key] of getAllProperties(self.constructor.prototype)) {
|
|
85
|
+
if (key === "constructor" || !filter(key)) continue;
|
|
86
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(object, key);
|
|
87
|
+
if (descriptor && typeof descriptor.value === "function") self[key] = self[key].bind(self);
|
|
88
|
+
}
|
|
89
|
+
return self;
|
|
168
90
|
}
|
|
169
91
|
|
|
170
|
-
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region controllers/ack.ts
|
|
94
|
+
/**
|
|
95
|
+
* @support core >= 4.4.0
|
|
96
|
+
*/
|
|
171
97
|
var AckController = class {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
});
|
|
191
|
-
}
|
|
98
|
+
constructor(client) {
|
|
99
|
+
this.client = client;
|
|
100
|
+
this.base = "ack";
|
|
101
|
+
this.name = "ack";
|
|
102
|
+
autoBind(this);
|
|
103
|
+
}
|
|
104
|
+
get proxy() {
|
|
105
|
+
return this.client.proxy(this.base);
|
|
106
|
+
}
|
|
107
|
+
read(type, id) {
|
|
108
|
+
return this.proxy.post({ data: {
|
|
109
|
+
type: "read",
|
|
110
|
+
payload: {
|
|
111
|
+
type,
|
|
112
|
+
id
|
|
113
|
+
}
|
|
114
|
+
} });
|
|
115
|
+
}
|
|
192
116
|
};
|
|
193
117
|
|
|
194
|
-
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region controllers/activity.ts
|
|
120
|
+
/**
|
|
121
|
+
* @support core >= 4.3.0
|
|
122
|
+
*/
|
|
195
123
|
var ActivityController = class {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
roomName,
|
|
243
|
-
sid,
|
|
244
|
-
readerId,
|
|
245
|
-
displayName
|
|
246
|
-
}
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
async getRoomsInfo() {
|
|
250
|
-
return this.proxy.rooms.get();
|
|
251
|
-
}
|
|
252
|
-
async getRecentActivities() {
|
|
253
|
-
return this.proxy.recent.get();
|
|
254
|
-
}
|
|
255
|
-
async getLastYearPublication() {
|
|
256
|
-
return this.proxy(`last-year`).publication.get();
|
|
257
|
-
}
|
|
124
|
+
constructor(client) {
|
|
125
|
+
this.client = client;
|
|
126
|
+
this.base = "activity";
|
|
127
|
+
this.name = "activity";
|
|
128
|
+
autoBind(this);
|
|
129
|
+
}
|
|
130
|
+
get proxy() {
|
|
131
|
+
return this.client.proxy(this.base);
|
|
132
|
+
}
|
|
133
|
+
likeIt(type, id) {
|
|
134
|
+
return this.proxy.like.post({ data: {
|
|
135
|
+
type: type.toLowerCase(),
|
|
136
|
+
id
|
|
137
|
+
} });
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
*
|
|
141
|
+
* @support core >= 5.0.0
|
|
142
|
+
*/
|
|
143
|
+
getPresence(roomName) {
|
|
144
|
+
return this.proxy.presence.get({ params: { room_name: roomName } });
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
*
|
|
148
|
+
* @support core >= 5.0.0
|
|
149
|
+
*/
|
|
150
|
+
updatePresence({ identity, position, roomName, sid, ts, displayName, readerId }) {
|
|
151
|
+
return this.proxy.presence.update.post({ data: {
|
|
152
|
+
identity,
|
|
153
|
+
position,
|
|
154
|
+
ts: ts || Date.now(),
|
|
155
|
+
roomName,
|
|
156
|
+
sid,
|
|
157
|
+
readerId,
|
|
158
|
+
displayName
|
|
159
|
+
} });
|
|
160
|
+
}
|
|
161
|
+
async getRoomsInfo() {
|
|
162
|
+
return this.proxy.rooms.get();
|
|
163
|
+
}
|
|
164
|
+
async getRecentActivities() {
|
|
165
|
+
return this.proxy.recent.get();
|
|
166
|
+
}
|
|
167
|
+
async getLastYearPublication() {
|
|
168
|
+
return this.proxy(`last-year`).publication.get();
|
|
169
|
+
}
|
|
258
170
|
};
|
|
259
171
|
|
|
260
|
-
|
|
172
|
+
//#endregion
|
|
173
|
+
//#region controllers/aggregate.ts
|
|
261
174
|
var AggregateController = class {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* 获取聚合数据统计
|
|
299
|
-
*/
|
|
300
|
-
getStat() {
|
|
301
|
-
return this.proxy.stat.get();
|
|
302
|
-
}
|
|
175
|
+
constructor(client) {
|
|
176
|
+
this.client = client;
|
|
177
|
+
this.base = "aggregate";
|
|
178
|
+
this.name = "aggregate";
|
|
179
|
+
autoBind(this);
|
|
180
|
+
}
|
|
181
|
+
get proxy() {
|
|
182
|
+
return this.client.proxy(this.base);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* 获取聚合数据
|
|
186
|
+
*/
|
|
187
|
+
getAggregateData(theme) {
|
|
188
|
+
return this.proxy.get({ params: { theme } });
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* 获取最新发布的内容
|
|
192
|
+
*/
|
|
193
|
+
getTop(size = 5) {
|
|
194
|
+
return this.proxy.top.get({ params: { size } });
|
|
195
|
+
}
|
|
196
|
+
getTimeline(options) {
|
|
197
|
+
const { sort, type, year } = options || {};
|
|
198
|
+
return this.proxy.timeline.get({ params: {
|
|
199
|
+
sort: sort && sortOrderToNumber(sort),
|
|
200
|
+
type,
|
|
201
|
+
year
|
|
202
|
+
} });
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* 获取聚合数据统计
|
|
206
|
+
*/
|
|
207
|
+
getStat() {
|
|
208
|
+
return this.proxy.stat.get();
|
|
209
|
+
}
|
|
303
210
|
};
|
|
304
211
|
|
|
305
|
-
|
|
212
|
+
//#endregion
|
|
213
|
+
//#region controllers/ai.ts
|
|
214
|
+
/**
|
|
215
|
+
* @support core >= 5.6.0
|
|
216
|
+
*/
|
|
306
217
|
var AIController = class {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
}
|
|
218
|
+
constructor(client) {
|
|
219
|
+
this.client = client;
|
|
220
|
+
this.base = "ai";
|
|
221
|
+
this.name = "ai";
|
|
222
|
+
autoBind(this);
|
|
223
|
+
}
|
|
224
|
+
get proxy() {
|
|
225
|
+
return this.client.proxy(this.base);
|
|
226
|
+
}
|
|
227
|
+
async getSummary({ articleId, lang = "zh-CN", onlyDb }) {
|
|
228
|
+
return this.proxy.summaries.article(articleId).get({ params: {
|
|
229
|
+
lang,
|
|
230
|
+
onlyDb
|
|
231
|
+
} });
|
|
232
|
+
}
|
|
233
|
+
async generateSummary(articleId, lang = "zh-CN", token = "") {
|
|
234
|
+
return this.proxy.summaries.generate.post({
|
|
235
|
+
params: { token },
|
|
236
|
+
data: {
|
|
237
|
+
lang,
|
|
238
|
+
refId: articleId
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Core >= 8.3.0
|
|
244
|
+
* @param articleId
|
|
245
|
+
*/
|
|
246
|
+
async getDeepReading(articleId) {
|
|
247
|
+
return this.proxy("deep-readings").article(articleId).get();
|
|
248
|
+
}
|
|
339
249
|
};
|
|
340
250
|
|
|
341
|
-
|
|
251
|
+
//#endregion
|
|
252
|
+
//#region core/error.ts
|
|
342
253
|
var RequestError = class extends Error {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
254
|
+
constructor(message, status, path, raw) {
|
|
255
|
+
super(message);
|
|
256
|
+
this.status = status;
|
|
257
|
+
this.path = path;
|
|
258
|
+
this.raw = raw;
|
|
259
|
+
}
|
|
349
260
|
};
|
|
350
261
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region models/category.ts
|
|
264
|
+
let CategoryType = /* @__PURE__ */ function(CategoryType$1) {
|
|
265
|
+
CategoryType$1[CategoryType$1["Category"] = 0] = "Category";
|
|
266
|
+
CategoryType$1[CategoryType$1["Tag"] = 1] = "Tag";
|
|
267
|
+
return CategoryType$1;
|
|
268
|
+
}({});
|
|
357
269
|
|
|
358
|
-
|
|
270
|
+
//#endregion
|
|
271
|
+
//#region controllers/category.ts
|
|
359
272
|
var CategoryController = class {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
ids: ids.join(",")
|
|
397
|
-
}
|
|
398
|
-
});
|
|
399
|
-
const entries = data?.entries;
|
|
400
|
-
if (!entries) {
|
|
401
|
-
throw new RequestError(
|
|
402
|
-
"data structure error",
|
|
403
|
-
500,
|
|
404
|
-
data.$request.path,
|
|
405
|
-
data
|
|
406
|
-
);
|
|
407
|
-
}
|
|
408
|
-
const map = new Map(
|
|
409
|
-
Object.entries(entries).map(([id, value]) => [id.toLowerCase(), value])
|
|
410
|
-
);
|
|
411
|
-
attachRawFromOneToAnthor(data, map);
|
|
412
|
-
return map;
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
async getCategoryByIdOrSlug(idOrSlug) {
|
|
416
|
-
const res = await this.proxy(idOrSlug).get();
|
|
417
|
-
return destructureData(res);
|
|
418
|
-
}
|
|
419
|
-
async getTagByName(name) {
|
|
420
|
-
const res = await this.proxy(name).get({
|
|
421
|
-
params: {
|
|
422
|
-
tag: 1
|
|
423
|
-
}
|
|
424
|
-
});
|
|
425
|
-
return res;
|
|
426
|
-
}
|
|
273
|
+
constructor(client) {
|
|
274
|
+
this.client = client;
|
|
275
|
+
this.name = "category";
|
|
276
|
+
this.base = "categories";
|
|
277
|
+
autoBind(this);
|
|
278
|
+
}
|
|
279
|
+
get proxy() {
|
|
280
|
+
return this.client.proxy(this.base);
|
|
281
|
+
}
|
|
282
|
+
getAllCategories() {
|
|
283
|
+
return this.proxy.get({ params: { type: CategoryType.Category } });
|
|
284
|
+
}
|
|
285
|
+
getAllTags() {
|
|
286
|
+
return this.proxy.get({ params: { type: CategoryType.Tag } });
|
|
287
|
+
}
|
|
288
|
+
async getCategoryDetail(ids) {
|
|
289
|
+
if (typeof ids === "string") {
|
|
290
|
+
const data = await this.proxy.get({ params: { ids } });
|
|
291
|
+
const result = Object.values(data.entries)[0];
|
|
292
|
+
attachRawFromOneToAnthor(data, result);
|
|
293
|
+
return result;
|
|
294
|
+
} else if (Array.isArray(ids)) {
|
|
295
|
+
const data = await this.proxy.get({ params: { ids: ids.join(",") } });
|
|
296
|
+
const entries = data?.entries;
|
|
297
|
+
if (!entries) throw new RequestError("data structure error", 500, data.$request.path, data);
|
|
298
|
+
const map = new Map(Object.entries(entries).map(([id, value]) => [id.toLowerCase(), value]));
|
|
299
|
+
attachRawFromOneToAnthor(data, map);
|
|
300
|
+
return map;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
async getCategoryByIdOrSlug(idOrSlug) {
|
|
304
|
+
return destructureData(await this.proxy(idOrSlug).get());
|
|
305
|
+
}
|
|
306
|
+
async getTagByName(name) {
|
|
307
|
+
return await this.proxy(name).get({ params: { tag: 1 } });
|
|
308
|
+
}
|
|
427
309
|
};
|
|
428
310
|
|
|
429
|
-
|
|
311
|
+
//#endregion
|
|
312
|
+
//#region controllers/comment.ts
|
|
430
313
|
var CommentController = class {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
data
|
|
470
|
-
});
|
|
471
|
-
}
|
|
314
|
+
constructor(client) {
|
|
315
|
+
this.client = client;
|
|
316
|
+
this.base = "comments";
|
|
317
|
+
this.name = "comment";
|
|
318
|
+
autoBind(this);
|
|
319
|
+
}
|
|
320
|
+
get proxy() {
|
|
321
|
+
return this.client.proxy(this.base);
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* 根据 comment id 获取评论,包括子评论
|
|
325
|
+
*/
|
|
326
|
+
getById(id) {
|
|
327
|
+
return this.proxy(id).get();
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* 获取文章的评论列表
|
|
331
|
+
* @param refId 文章 Id
|
|
332
|
+
*/
|
|
333
|
+
getByRefId(refId, pagination = {}) {
|
|
334
|
+
const { page, size } = pagination;
|
|
335
|
+
return this.proxy.ref(refId).get({ params: {
|
|
336
|
+
page: page || 1,
|
|
337
|
+
size: size || 10
|
|
338
|
+
} });
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* 评论
|
|
342
|
+
*/
|
|
343
|
+
comment(refId, data) {
|
|
344
|
+
return this.proxy(refId).post({ data });
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* 回复评论
|
|
348
|
+
*/
|
|
349
|
+
reply(commentId, data) {
|
|
350
|
+
return this.proxy.reply(commentId).post({ data });
|
|
351
|
+
}
|
|
472
352
|
};
|
|
473
353
|
|
|
474
|
-
|
|
354
|
+
//#endregion
|
|
355
|
+
//#region controllers/base.ts
|
|
475
356
|
var BaseCrudController = class {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
357
|
+
constructor(client) {
|
|
358
|
+
this.client = client;
|
|
359
|
+
autoBind(this);
|
|
360
|
+
}
|
|
361
|
+
get proxy() {
|
|
362
|
+
return this.client.proxy(this.base);
|
|
363
|
+
}
|
|
364
|
+
getById(id) {
|
|
365
|
+
return this.proxy(id).get();
|
|
366
|
+
}
|
|
367
|
+
getAll() {
|
|
368
|
+
return this.proxy.all.get();
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* 带分页的查询
|
|
372
|
+
* @param page
|
|
373
|
+
* @param perPage
|
|
374
|
+
*/
|
|
375
|
+
getAllPaginated(page, perPage, sortOption) {
|
|
376
|
+
return this.proxy.get({ params: {
|
|
377
|
+
page,
|
|
378
|
+
size: perPage,
|
|
379
|
+
...sortOption
|
|
380
|
+
} });
|
|
381
|
+
}
|
|
499
382
|
};
|
|
500
383
|
|
|
501
|
-
|
|
384
|
+
//#endregion
|
|
385
|
+
//#region controllers/link.ts
|
|
502
386
|
var LinkController = class extends BaseCrudController {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
return await this.proxy.audit.post({ data });
|
|
518
|
-
}
|
|
387
|
+
constructor(client) {
|
|
388
|
+
super(client);
|
|
389
|
+
this.client = client;
|
|
390
|
+
this.name = ["link", "friend"];
|
|
391
|
+
this.base = "links";
|
|
392
|
+
autoBind(this);
|
|
393
|
+
}
|
|
394
|
+
async canApplyLink() {
|
|
395
|
+
const { can } = await this.proxy.audit.get();
|
|
396
|
+
return can;
|
|
397
|
+
}
|
|
398
|
+
async applyLink(data) {
|
|
399
|
+
return await this.proxy.audit.post({ data });
|
|
400
|
+
}
|
|
519
401
|
};
|
|
520
402
|
|
|
521
|
-
|
|
403
|
+
//#endregion
|
|
404
|
+
//#region controllers/note.ts
|
|
522
405
|
var NoteController = class {
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
return this.proxy.topics(topicId).get({
|
|
577
|
-
params: { page, size, ...sortOptions }
|
|
578
|
-
});
|
|
579
|
-
}
|
|
406
|
+
constructor(client) {
|
|
407
|
+
this.client = client;
|
|
408
|
+
this.base = "notes";
|
|
409
|
+
this.name = "note";
|
|
410
|
+
autoBind(this);
|
|
411
|
+
}
|
|
412
|
+
get proxy() {
|
|
413
|
+
return this.client.proxy(this.base);
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* 最新日记
|
|
417
|
+
*/
|
|
418
|
+
getLatest() {
|
|
419
|
+
return this.proxy.latest.get();
|
|
420
|
+
}
|
|
421
|
+
getNoteById(...rest) {
|
|
422
|
+
const [id, password = void 0, singleResult = false] = rest;
|
|
423
|
+
if (typeof id === "number") return this.proxy.nid(id.toString()).get({ params: {
|
|
424
|
+
password,
|
|
425
|
+
single: singleResult ? "1" : void 0
|
|
426
|
+
} });
|
|
427
|
+
else return this.proxy(id).get();
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* 日记列表分页
|
|
431
|
+
*/
|
|
432
|
+
getList(page = 1, perPage = 10, options = {}) {
|
|
433
|
+
const { select, sortBy, sortOrder, year } = options;
|
|
434
|
+
return this.proxy.get({ params: {
|
|
435
|
+
page,
|
|
436
|
+
size: perPage,
|
|
437
|
+
select: select?.join(" "),
|
|
438
|
+
sortBy,
|
|
439
|
+
sortOrder,
|
|
440
|
+
year
|
|
441
|
+
} });
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* 获取当前日记的上下各 n / 2 篇日记
|
|
445
|
+
*/
|
|
446
|
+
getMiddleList(id, size = 5) {
|
|
447
|
+
return this.proxy.list(id).get({ params: { size } });
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* 获取专栏内的所有日记
|
|
451
|
+
*/
|
|
452
|
+
getNoteByTopicId(topicId, page = 1, size = 10, sortOptions = {}) {
|
|
453
|
+
return this.proxy.topics(topicId).get({ params: {
|
|
454
|
+
page,
|
|
455
|
+
size,
|
|
456
|
+
...sortOptions
|
|
457
|
+
} });
|
|
458
|
+
}
|
|
580
459
|
};
|
|
581
460
|
|
|
582
|
-
|
|
461
|
+
//#endregion
|
|
462
|
+
//#region controllers/page.ts
|
|
583
463
|
var PageController = class {
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
return this.proxy.slug(slug).get({});
|
|
621
|
-
}
|
|
464
|
+
constructor(client) {
|
|
465
|
+
this.client = client;
|
|
466
|
+
this.base = "pages";
|
|
467
|
+
this.name = "page";
|
|
468
|
+
autoBind(this);
|
|
469
|
+
}
|
|
470
|
+
get proxy() {
|
|
471
|
+
return this.client.proxy(this.base);
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* 页面列表
|
|
475
|
+
*/
|
|
476
|
+
getList(page = 1, perPage = 10, options = {}) {
|
|
477
|
+
const { select, sortBy, sortOrder } = options;
|
|
478
|
+
return this.proxy.get({ params: {
|
|
479
|
+
page,
|
|
480
|
+
size: perPage,
|
|
481
|
+
select: select?.join(" "),
|
|
482
|
+
sortBy,
|
|
483
|
+
sortOrder
|
|
484
|
+
} });
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* 页面详情
|
|
488
|
+
*/
|
|
489
|
+
getById(id) {
|
|
490
|
+
return this.proxy(id).get();
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* 根据路径获取页面
|
|
494
|
+
* @param slug 路径
|
|
495
|
+
* @returns
|
|
496
|
+
*/
|
|
497
|
+
getBySlug(slug) {
|
|
498
|
+
return this.proxy.slug(slug).get({});
|
|
499
|
+
}
|
|
622
500
|
};
|
|
623
501
|
|
|
624
|
-
|
|
502
|
+
//#endregion
|
|
503
|
+
//#region controllers/post.ts
|
|
625
504
|
var PostController = class {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
return this.proxy.latest.get();
|
|
667
|
-
}
|
|
668
|
-
getFullUrl(slug) {
|
|
669
|
-
return this.proxy("get-url")(slug).get();
|
|
670
|
-
}
|
|
505
|
+
constructor(client) {
|
|
506
|
+
this.client = client;
|
|
507
|
+
this.base = "posts";
|
|
508
|
+
this.name = "post";
|
|
509
|
+
autoBind(this);
|
|
510
|
+
}
|
|
511
|
+
get proxy() {
|
|
512
|
+
return this.client.proxy(this.base);
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* 获取文章列表分页
|
|
516
|
+
* @param page
|
|
517
|
+
* @param perPage
|
|
518
|
+
* @returns
|
|
519
|
+
*/
|
|
520
|
+
getList(page = 1, perPage = 10, options = {}) {
|
|
521
|
+
const { select, sortBy, sortOrder, year, truncate } = options;
|
|
522
|
+
return this.proxy.get({ params: {
|
|
523
|
+
page,
|
|
524
|
+
size: perPage,
|
|
525
|
+
select: select?.join(" "),
|
|
526
|
+
sortBy,
|
|
527
|
+
sortOrder,
|
|
528
|
+
year,
|
|
529
|
+
truncate
|
|
530
|
+
} });
|
|
531
|
+
}
|
|
532
|
+
getPost(idOrCategoryName, slug) {
|
|
533
|
+
if (arguments.length == 1) return this.proxy(idOrCategoryName).get();
|
|
534
|
+
else return this.proxy(idOrCategoryName)(slug).get();
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* 获取最新的文章
|
|
538
|
+
*/
|
|
539
|
+
getLatest() {
|
|
540
|
+
return this.proxy.latest.get();
|
|
541
|
+
}
|
|
542
|
+
getFullUrl(slug) {
|
|
543
|
+
return this.proxy("get-url")(slug).get();
|
|
544
|
+
}
|
|
671
545
|
};
|
|
672
546
|
|
|
673
|
-
|
|
547
|
+
//#endregion
|
|
548
|
+
//#region controllers/project.ts
|
|
674
549
|
var ProjectController = class extends BaseCrudController {
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
550
|
+
constructor(client) {
|
|
551
|
+
super(client);
|
|
552
|
+
this.client = client;
|
|
553
|
+
this.base = "projects";
|
|
554
|
+
this.name = "project";
|
|
555
|
+
autoBind(this);
|
|
556
|
+
}
|
|
682
557
|
};
|
|
683
558
|
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
559
|
+
//#endregion
|
|
560
|
+
//#region controllers/recently.ts
|
|
561
|
+
let RecentlyAttitudeResultEnum = /* @__PURE__ */ function(RecentlyAttitudeResultEnum$1) {
|
|
562
|
+
RecentlyAttitudeResultEnum$1[RecentlyAttitudeResultEnum$1["Inc"] = 1] = "Inc";
|
|
563
|
+
RecentlyAttitudeResultEnum$1[RecentlyAttitudeResultEnum$1["Dec"] = -1] = "Dec";
|
|
564
|
+
return RecentlyAttitudeResultEnum$1;
|
|
565
|
+
}({});
|
|
566
|
+
let RecentlyAttitudeEnum = /* @__PURE__ */ function(RecentlyAttitudeEnum$1) {
|
|
567
|
+
RecentlyAttitudeEnum$1[RecentlyAttitudeEnum$1["Up"] = 0] = "Up";
|
|
568
|
+
RecentlyAttitudeEnum$1[RecentlyAttitudeEnum$1["Down"] = 1] = "Down";
|
|
569
|
+
return RecentlyAttitudeEnum$1;
|
|
570
|
+
}({});
|
|
695
571
|
var RecentlyController = class {
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
return this.proxy(id).get();
|
|
729
|
-
}
|
|
730
|
-
/** 表态:点赞,点踩 */
|
|
731
|
-
attitude(id, attitude) {
|
|
732
|
-
return this.proxy.attitude(id).get({
|
|
733
|
-
params: {
|
|
734
|
-
attitude
|
|
735
|
-
}
|
|
736
|
-
});
|
|
737
|
-
}
|
|
572
|
+
constructor(client) {
|
|
573
|
+
this.client = client;
|
|
574
|
+
this.base = "recently";
|
|
575
|
+
this.name = ["recently", "shorthand"];
|
|
576
|
+
autoBind(this);
|
|
577
|
+
}
|
|
578
|
+
get proxy() {
|
|
579
|
+
return this.client.proxy(this.base);
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* 获取最新一条
|
|
583
|
+
*/
|
|
584
|
+
getLatestOne() {
|
|
585
|
+
return this.proxy.latest.get();
|
|
586
|
+
}
|
|
587
|
+
getAll() {
|
|
588
|
+
return this.proxy.all.get();
|
|
589
|
+
}
|
|
590
|
+
getList({ before, after, size } = {}) {
|
|
591
|
+
return this.proxy.get({ params: {
|
|
592
|
+
before,
|
|
593
|
+
after,
|
|
594
|
+
size
|
|
595
|
+
} });
|
|
596
|
+
}
|
|
597
|
+
getById(id) {
|
|
598
|
+
return this.proxy(id).get();
|
|
599
|
+
}
|
|
600
|
+
/** 表态:点赞,点踩 */
|
|
601
|
+
attitude(id, attitude) {
|
|
602
|
+
return this.proxy.attitude(id).get({ params: { attitude } });
|
|
603
|
+
}
|
|
738
604
|
};
|
|
739
605
|
|
|
740
|
-
|
|
606
|
+
//#endregion
|
|
607
|
+
//#region controllers/say.ts
|
|
741
608
|
var SayController = class extends BaseCrudController {
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
609
|
+
constructor(client) {
|
|
610
|
+
super(client);
|
|
611
|
+
this.client = client;
|
|
612
|
+
this.base = "says";
|
|
613
|
+
this.name = "say";
|
|
614
|
+
autoBind(this);
|
|
615
|
+
}
|
|
616
|
+
get proxy() {
|
|
617
|
+
return this.client.proxy(this.base);
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* 获取随机一条
|
|
621
|
+
*/
|
|
622
|
+
getRandom() {
|
|
623
|
+
return this.proxy.random.get();
|
|
624
|
+
}
|
|
758
625
|
};
|
|
759
626
|
|
|
760
|
-
|
|
627
|
+
//#endregion
|
|
628
|
+
//#region controllers/search.ts
|
|
761
629
|
var SearchController = class {
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
630
|
+
constructor(client) {
|
|
631
|
+
this.client = client;
|
|
632
|
+
this.base = "search";
|
|
633
|
+
this.name = "search";
|
|
634
|
+
autoBind(this);
|
|
635
|
+
}
|
|
636
|
+
get proxy() {
|
|
637
|
+
return this.client.proxy(this.base);
|
|
638
|
+
}
|
|
639
|
+
search(type, keyword, options = {}) {
|
|
640
|
+
return this.proxy(type).get({ params: {
|
|
641
|
+
keyword,
|
|
642
|
+
...options
|
|
643
|
+
} });
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* 从 algolya 搜索
|
|
647
|
+
* https://www.algolia.com/doc/api-reference/api-methods/search/
|
|
648
|
+
* @param keyword
|
|
649
|
+
* @param options
|
|
650
|
+
* @returns
|
|
651
|
+
*/
|
|
652
|
+
searchByAlgolia(keyword, options) {
|
|
653
|
+
return this.proxy("algolia").get({ params: {
|
|
654
|
+
keyword,
|
|
655
|
+
...options
|
|
656
|
+
} });
|
|
657
|
+
}
|
|
786
658
|
};
|
|
787
659
|
|
|
788
|
-
|
|
660
|
+
//#endregion
|
|
661
|
+
//#region controllers/severless.ts
|
|
789
662
|
var ServerlessController = class {
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
663
|
+
constructor(client) {
|
|
664
|
+
this.client = client;
|
|
665
|
+
this.base = "serverless";
|
|
666
|
+
this.name = "serverless";
|
|
667
|
+
autoBind(this);
|
|
668
|
+
}
|
|
669
|
+
get proxy() {
|
|
670
|
+
return this.client.proxy(this.base);
|
|
671
|
+
}
|
|
672
|
+
getByReferenceAndName(reference, name) {
|
|
673
|
+
return this.proxy(reference)(name).get();
|
|
674
|
+
}
|
|
802
675
|
};
|
|
803
676
|
|
|
804
|
-
|
|
677
|
+
//#endregion
|
|
678
|
+
//#region controllers/snippet.ts
|
|
805
679
|
var SnippetController = class {
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
getByReferenceAndName(reference, name) {
|
|
819
|
-
return this.proxy(reference)(name).get();
|
|
820
|
-
}
|
|
680
|
+
constructor(client) {
|
|
681
|
+
this.client = client;
|
|
682
|
+
this.base = "snippets";
|
|
683
|
+
this.name = "snippet";
|
|
684
|
+
autoBind(this);
|
|
685
|
+
}
|
|
686
|
+
get proxy() {
|
|
687
|
+
return this.client.proxy(this.base);
|
|
688
|
+
}
|
|
689
|
+
getByReferenceAndName(reference, name) {
|
|
690
|
+
return this.proxy(reference)(name).get();
|
|
691
|
+
}
|
|
821
692
|
};
|
|
822
693
|
|
|
823
|
-
|
|
694
|
+
//#endregion
|
|
695
|
+
//#region controllers/subscribe.ts
|
|
824
696
|
var SubscribeController = class {
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
cancelToken
|
|
853
|
-
}
|
|
854
|
-
});
|
|
855
|
-
}
|
|
697
|
+
constructor(client) {
|
|
698
|
+
this.client = client;
|
|
699
|
+
this.base = "subscribe";
|
|
700
|
+
this.name = "subscribe";
|
|
701
|
+
autoBind(this);
|
|
702
|
+
}
|
|
703
|
+
get proxy() {
|
|
704
|
+
return this.client.proxy(this.base);
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* 检查开启状态
|
|
708
|
+
*/
|
|
709
|
+
check() {
|
|
710
|
+
return this.proxy.status.get();
|
|
711
|
+
}
|
|
712
|
+
subscribe(email, types) {
|
|
713
|
+
return this.proxy.post({ data: {
|
|
714
|
+
email,
|
|
715
|
+
types
|
|
716
|
+
} });
|
|
717
|
+
}
|
|
718
|
+
unsubscribe(email, cancelToken) {
|
|
719
|
+
return this.proxy.unsubscribe.get({ params: {
|
|
720
|
+
email,
|
|
721
|
+
cancelToken
|
|
722
|
+
} });
|
|
723
|
+
}
|
|
856
724
|
};
|
|
857
725
|
|
|
858
|
-
|
|
726
|
+
//#endregion
|
|
727
|
+
//#region controllers/topic.ts
|
|
859
728
|
var TopicController = class extends BaseCrudController {
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
729
|
+
constructor(client) {
|
|
730
|
+
super(client);
|
|
731
|
+
this.client = client;
|
|
732
|
+
this.base = "topics";
|
|
733
|
+
this.name = "topic";
|
|
734
|
+
autoBind(this);
|
|
735
|
+
}
|
|
736
|
+
get proxy() {
|
|
737
|
+
return this.client.proxy(this.base);
|
|
738
|
+
}
|
|
739
|
+
getTopicBySlug(slug) {
|
|
740
|
+
return this.proxy.slug(slug).get();
|
|
741
|
+
}
|
|
873
742
|
};
|
|
874
743
|
|
|
875
|
-
|
|
744
|
+
//#endregion
|
|
745
|
+
//#region controllers/user.ts
|
|
876
746
|
var UserController = class {
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
} : void 0
|
|
902
|
-
});
|
|
903
|
-
}
|
|
904
|
-
checkTokenValid(token) {
|
|
905
|
-
return this.proxy.check_logged.get({
|
|
906
|
-
params: {
|
|
907
|
-
token: `bearer ${token.replace(/^bearer\s/i, "")}`
|
|
908
|
-
}
|
|
909
|
-
});
|
|
910
|
-
}
|
|
747
|
+
constructor(client) {
|
|
748
|
+
this.client = client;
|
|
749
|
+
this.base = "master";
|
|
750
|
+
this.name = ["user", "master"];
|
|
751
|
+
autoBind(this);
|
|
752
|
+
}
|
|
753
|
+
get proxy() {
|
|
754
|
+
return this.client.proxy(this.base);
|
|
755
|
+
}
|
|
756
|
+
getMasterInfo() {
|
|
757
|
+
return this.proxy.get();
|
|
758
|
+
}
|
|
759
|
+
login(username, password) {
|
|
760
|
+
return this.proxy.login.post({ data: {
|
|
761
|
+
username,
|
|
762
|
+
password
|
|
763
|
+
} });
|
|
764
|
+
}
|
|
765
|
+
loginWithToken(token) {
|
|
766
|
+
return this.proxy.login.put({ params: token ? { token: `bearer ${token.replace(/^bearer\s/i, "")}` } : void 0 });
|
|
767
|
+
}
|
|
768
|
+
checkTokenValid(token) {
|
|
769
|
+
return this.proxy.check_logged.get({ params: { token: `bearer ${token.replace(/^bearer\s/i, "")}` } });
|
|
770
|
+
}
|
|
911
771
|
};
|
|
912
772
|
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
773
|
+
//#endregion
|
|
774
|
+
//#region controllers/index.ts
|
|
775
|
+
const allControllers = [
|
|
776
|
+
AckController,
|
|
777
|
+
ActivityController,
|
|
778
|
+
AggregateController,
|
|
779
|
+
AIController,
|
|
780
|
+
CategoryController,
|
|
781
|
+
CommentController,
|
|
782
|
+
LinkController,
|
|
783
|
+
NoteController,
|
|
784
|
+
PageController,
|
|
785
|
+
PostController,
|
|
786
|
+
ProjectController,
|
|
787
|
+
RecentlyController,
|
|
788
|
+
SayController,
|
|
789
|
+
SearchController,
|
|
790
|
+
ServerlessController,
|
|
791
|
+
SnippetController,
|
|
792
|
+
SubscribeController,
|
|
793
|
+
TopicController,
|
|
794
|
+
UserController
|
|
934
795
|
];
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
"shorthand"
|
|
796
|
+
const allControllerNames = [
|
|
797
|
+
"ai",
|
|
798
|
+
"ack",
|
|
799
|
+
"activity",
|
|
800
|
+
"aggregate",
|
|
801
|
+
"category",
|
|
802
|
+
"comment",
|
|
803
|
+
"link",
|
|
804
|
+
"note",
|
|
805
|
+
"page",
|
|
806
|
+
"post",
|
|
807
|
+
"project",
|
|
808
|
+
"topic",
|
|
809
|
+
"recently",
|
|
810
|
+
"say",
|
|
811
|
+
"search",
|
|
812
|
+
"snippet",
|
|
813
|
+
"serverless",
|
|
814
|
+
"subscribe",
|
|
815
|
+
"user",
|
|
816
|
+
"friend",
|
|
817
|
+
"master",
|
|
818
|
+
"shorthand"
|
|
959
819
|
];
|
|
960
820
|
|
|
961
|
-
|
|
821
|
+
//#endregion
|
|
822
|
+
//#region core/attach-request.ts
|
|
962
823
|
function attachRequestMethod(target) {
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
824
|
+
Object.defineProperty(target, "$$get", { value(url, options) {
|
|
825
|
+
const { params = {}, ...rest } = options;
|
|
826
|
+
const qs = handleSearchParams(params);
|
|
827
|
+
return target.instance.get(`${url}${qs ? String(`?${qs}`) : ""}`, rest);
|
|
828
|
+
} });
|
|
829
|
+
[
|
|
830
|
+
"put",
|
|
831
|
+
"post",
|
|
832
|
+
"patch",
|
|
833
|
+
"delete"
|
|
834
|
+
].forEach((method) => {
|
|
835
|
+
Object.defineProperty(target, `$$${method}`, { value(path, options) {
|
|
836
|
+
return target.instance[method](path, options);
|
|
837
|
+
} });
|
|
838
|
+
});
|
|
977
839
|
}
|
|
978
840
|
function handleSearchParams(obj) {
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
if (typeof v === "undefined" || Object.prototype.toString.call(v) === "[object Null]") {
|
|
988
|
-
return;
|
|
989
|
-
}
|
|
990
|
-
search.set(k, v);
|
|
991
|
-
});
|
|
992
|
-
return search.toString();
|
|
841
|
+
if (!obj && typeof obj !== "object") throw new TypeError("params must be object.");
|
|
842
|
+
if (obj instanceof URLSearchParams) return obj.toString();
|
|
843
|
+
const search = new URLSearchParams();
|
|
844
|
+
Object.entries(obj).forEach(([k, v]) => {
|
|
845
|
+
if (typeof v === "undefined" || Object.prototype.toString.call(v) === "[object Null]") return;
|
|
846
|
+
search.set(k, v);
|
|
847
|
+
});
|
|
848
|
+
return search.toString();
|
|
993
849
|
}
|
|
994
850
|
|
|
995
|
-
|
|
996
|
-
|
|
851
|
+
//#endregion
|
|
852
|
+
//#region core/client.ts
|
|
853
|
+
const methodPrefix = "_$";
|
|
997
854
|
var HTTPClient = class {
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
});
|
|
1142
|
-
}
|
|
1143
|
-
return nextObject;
|
|
1144
|
-
};
|
|
1145
|
-
}
|
|
1146
|
-
route.push(name);
|
|
1147
|
-
return new Proxy(noop, handler);
|
|
1148
|
-
},
|
|
1149
|
-
// @ts-ignore
|
|
1150
|
-
apply(target, _, args) {
|
|
1151
|
-
route.push(...args.filter((x) => x !== null));
|
|
1152
|
-
return new Proxy(noop, handler);
|
|
1153
|
-
}
|
|
1154
|
-
};
|
|
1155
|
-
return new Proxy(noop, handler);
|
|
1156
|
-
};
|
|
1157
|
-
}
|
|
855
|
+
constructor(_endpoint, _adaptor, options = {}) {
|
|
856
|
+
this._endpoint = _endpoint;
|
|
857
|
+
this._adaptor = _adaptor;
|
|
858
|
+
this.options = options;
|
|
859
|
+
this._endpoint = _endpoint.replace(/\/*$/, "");
|
|
860
|
+
this._proxy = this.buildRoute(this)();
|
|
861
|
+
options.transformResponse || (options.transformResponse = (data) => camelcaseKeys(data));
|
|
862
|
+
options.getDataFromResponse || (options.getDataFromResponse = (res) => res.data);
|
|
863
|
+
this.initGetClient();
|
|
864
|
+
attachRequestMethod(this);
|
|
865
|
+
}
|
|
866
|
+
initGetClient() {
|
|
867
|
+
for (const name of allControllerNames) Object.defineProperty(this, name, {
|
|
868
|
+
get() {
|
|
869
|
+
const client = Reflect.get(this, `${methodPrefix}${name}`);
|
|
870
|
+
if (!client) throw new ReferenceError(`${name.charAt(0).toUpperCase() + name.slice(1)} Client not inject yet, please inject with client.injectClients(...)`);
|
|
871
|
+
return client;
|
|
872
|
+
},
|
|
873
|
+
configurable: false,
|
|
874
|
+
enumerable: false
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
injectControllers(Controller, ...rest) {
|
|
878
|
+
Controller = Array.isArray(Controller) ? Controller : [Controller, ...rest];
|
|
879
|
+
for (const Client of Controller) {
|
|
880
|
+
const cl = new Client(this);
|
|
881
|
+
if (Array.isArray(cl.name)) for (const name of cl.name) attach.call(this, name, cl);
|
|
882
|
+
else attach.call(this, cl.name, cl);
|
|
883
|
+
}
|
|
884
|
+
function attach(name, cl) {
|
|
885
|
+
Object.defineProperty(this, `${methodPrefix}${name.toLowerCase()}`, {
|
|
886
|
+
get() {
|
|
887
|
+
return cl;
|
|
888
|
+
},
|
|
889
|
+
enumerable: false,
|
|
890
|
+
configurable: false
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
get endpoint() {
|
|
895
|
+
return this._endpoint;
|
|
896
|
+
}
|
|
897
|
+
get instance() {
|
|
898
|
+
return this._adaptor;
|
|
899
|
+
}
|
|
900
|
+
request(options) {
|
|
901
|
+
return this[`$$${String(options.method || "get").toLowerCase()}`](options.url, options);
|
|
902
|
+
}
|
|
903
|
+
get proxy() {
|
|
904
|
+
return this._proxy;
|
|
905
|
+
}
|
|
906
|
+
buildRoute(manager) {
|
|
907
|
+
const noop = () => {};
|
|
908
|
+
const methods = [
|
|
909
|
+
"get",
|
|
910
|
+
"post",
|
|
911
|
+
"delete",
|
|
912
|
+
"patch",
|
|
913
|
+
"put"
|
|
914
|
+
];
|
|
915
|
+
const reflectors = [
|
|
916
|
+
"toString",
|
|
917
|
+
"valueOf",
|
|
918
|
+
"inspect",
|
|
919
|
+
"constructor",
|
|
920
|
+
Symbol.toPrimitive
|
|
921
|
+
];
|
|
922
|
+
const that = this;
|
|
923
|
+
return () => {
|
|
924
|
+
const route = [""];
|
|
925
|
+
const handler = {
|
|
926
|
+
get(target, name) {
|
|
927
|
+
if (reflectors.includes(name)) return (withBase) => {
|
|
928
|
+
if (withBase) {
|
|
929
|
+
const path = resolveFullPath(that.endpoint, route.join("/"));
|
|
930
|
+
route.length = 0;
|
|
931
|
+
return path;
|
|
932
|
+
} else {
|
|
933
|
+
const path = route.join("/");
|
|
934
|
+
route.length = 0;
|
|
935
|
+
return path.startsWith("/") ? path : `/${path}`;
|
|
936
|
+
}
|
|
937
|
+
};
|
|
938
|
+
if (methods.includes(name)) return async (options) => {
|
|
939
|
+
const url = resolveFullPath(that.endpoint, route.join("/"));
|
|
940
|
+
route.length = 0;
|
|
941
|
+
let res;
|
|
942
|
+
try {
|
|
943
|
+
res = await manager.request({
|
|
944
|
+
method: name,
|
|
945
|
+
...options,
|
|
946
|
+
url
|
|
947
|
+
});
|
|
948
|
+
} catch (error) {
|
|
949
|
+
let message = error.message;
|
|
950
|
+
let code = error.code || error.status || error.statusCode || error.response?.status || error.response?.statusCode || error.response?.code || 500;
|
|
951
|
+
if (that.options.getCodeMessageFromException) {
|
|
952
|
+
const errorInfo = that.options.getCodeMessageFromException(error);
|
|
953
|
+
message = errorInfo.message || message;
|
|
954
|
+
code = errorInfo.code || code;
|
|
955
|
+
}
|
|
956
|
+
throw that.options.customThrowResponseError ? that.options.customThrowResponseError(error) : new RequestError(message, code, url, error);
|
|
957
|
+
}
|
|
958
|
+
const data = that.options.getDataFromResponse(res);
|
|
959
|
+
if (!data) return null;
|
|
960
|
+
const cameledObject = (Array.isArray(data) || isPlainObject(data)) && that.options.transformResponse ? that.options.transformResponse(data) : data;
|
|
961
|
+
let nextObject = cameledObject;
|
|
962
|
+
if (cameledObject && typeof cameledObject === "object") {
|
|
963
|
+
nextObject = Array.isArray(cameledObject) ? [...cameledObject] : { ...cameledObject };
|
|
964
|
+
Object.defineProperty(nextObject, "$raw", {
|
|
965
|
+
get() {
|
|
966
|
+
return res;
|
|
967
|
+
},
|
|
968
|
+
enumerable: false,
|
|
969
|
+
configurable: false
|
|
970
|
+
});
|
|
971
|
+
Object.defineProperty(nextObject, "$request", {
|
|
972
|
+
get() {
|
|
973
|
+
return {
|
|
974
|
+
url,
|
|
975
|
+
method: name,
|
|
976
|
+
options
|
|
977
|
+
};
|
|
978
|
+
},
|
|
979
|
+
enumerable: false
|
|
980
|
+
});
|
|
981
|
+
Object.defineProperty(nextObject, "$serialized", { get() {
|
|
982
|
+
return cameledObject;
|
|
983
|
+
} });
|
|
984
|
+
}
|
|
985
|
+
return nextObject;
|
|
986
|
+
};
|
|
987
|
+
route.push(name);
|
|
988
|
+
return new Proxy(noop, handler);
|
|
989
|
+
},
|
|
990
|
+
apply(target, _, args) {
|
|
991
|
+
route.push(...args.filter((x) => x !== null));
|
|
992
|
+
return new Proxy(noop, handler);
|
|
993
|
+
}
|
|
994
|
+
};
|
|
995
|
+
return new Proxy(noop, handler);
|
|
996
|
+
};
|
|
997
|
+
}
|
|
1158
998
|
};
|
|
1159
999
|
function createClient(adapter) {
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
const { controllers } = options || {};
|
|
1167
|
-
if (controllers) {
|
|
1168
|
-
client.injectControllers(controllers);
|
|
1169
|
-
}
|
|
1170
|
-
return client;
|
|
1171
|
-
};
|
|
1000
|
+
return (endpoint, options) => {
|
|
1001
|
+
const client = new HTTPClient(endpoint, adapter, options);
|
|
1002
|
+
const { controllers } = options || {};
|
|
1003
|
+
if (controllers) client.injectControllers(controllers);
|
|
1004
|
+
return client;
|
|
1005
|
+
};
|
|
1172
1006
|
}
|
|
1173
1007
|
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1008
|
+
//#endregion
|
|
1009
|
+
//#region models/aggregate.ts
|
|
1010
|
+
let TimelineType = /* @__PURE__ */ function(TimelineType$1) {
|
|
1011
|
+
TimelineType$1[TimelineType$1["Post"] = 0] = "Post";
|
|
1012
|
+
TimelineType$1[TimelineType$1["Note"] = 1] = "Note";
|
|
1013
|
+
return TimelineType$1;
|
|
1014
|
+
}({});
|
|
1180
1015
|
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1016
|
+
//#endregion
|
|
1017
|
+
//#region ../../apps/core/src/constants/db.constant.ts
|
|
1018
|
+
const POST_COLLECTION_NAME = "posts";
|
|
1019
|
+
const NOTE_COLLECTION_NAME = "notes";
|
|
1020
|
+
const PAGE_COLLECTION_NAME = "pages";
|
|
1021
|
+
const RECENTLY_COLLECTION_NAME = "recentlies";
|
|
1022
|
+
let CollectionRefTypes = /* @__PURE__ */ function(CollectionRefTypes$1) {
|
|
1023
|
+
CollectionRefTypes$1[CollectionRefTypes$1["Post"] = POST_COLLECTION_NAME] = "Post";
|
|
1024
|
+
CollectionRefTypes$1[CollectionRefTypes$1["Note"] = NOTE_COLLECTION_NAME] = "Note";
|
|
1025
|
+
CollectionRefTypes$1[CollectionRefTypes$1["Page"] = PAGE_COLLECTION_NAME] = "Page";
|
|
1026
|
+
CollectionRefTypes$1[CollectionRefTypes$1["Recently"] = RECENTLY_COLLECTION_NAME] = "Recently";
|
|
1027
|
+
return CollectionRefTypes$1;
|
|
1028
|
+
}({});
|
|
1193
1029
|
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1030
|
+
//#endregion
|
|
1031
|
+
//#region models/comment.ts
|
|
1032
|
+
let CommentState = /* @__PURE__ */ function(CommentState$1) {
|
|
1033
|
+
CommentState$1[CommentState$1["Unread"] = 0] = "Unread";
|
|
1034
|
+
CommentState$1[CommentState$1["Read"] = 1] = "Read";
|
|
1035
|
+
CommentState$1[CommentState$1["Junk"] = 2] = "Junk";
|
|
1036
|
+
return CommentState$1;
|
|
1037
|
+
}({});
|
|
1201
1038
|
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1039
|
+
//#endregion
|
|
1040
|
+
//#region models/link.ts
|
|
1041
|
+
let LinkType = /* @__PURE__ */ function(LinkType$1) {
|
|
1042
|
+
LinkType$1[LinkType$1["Friend"] = 0] = "Friend";
|
|
1043
|
+
LinkType$1[LinkType$1["Collection"] = 1] = "Collection";
|
|
1044
|
+
return LinkType$1;
|
|
1045
|
+
}({});
|
|
1046
|
+
let LinkState = /* @__PURE__ */ function(LinkState$1) {
|
|
1047
|
+
LinkState$1[LinkState$1["Pass"] = 0] = "Pass";
|
|
1048
|
+
LinkState$1[LinkState$1["Audit"] = 1] = "Audit";
|
|
1049
|
+
LinkState$1[LinkState$1["Outdate"] = 2] = "Outdate";
|
|
1050
|
+
LinkState$1[LinkState$1["Banned"] = 3] = "Banned";
|
|
1051
|
+
LinkState$1[LinkState$1["Reject"] = 4] = "Reject";
|
|
1052
|
+
return LinkState$1;
|
|
1053
|
+
}({});
|
|
1216
1054
|
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1055
|
+
//#endregion
|
|
1056
|
+
//#region models/page.ts
|
|
1057
|
+
let EnumPageType = /* @__PURE__ */ function(EnumPageType$1) {
|
|
1058
|
+
EnumPageType$1["md"] = "md";
|
|
1059
|
+
EnumPageType$1["html"] = "html";
|
|
1060
|
+
EnumPageType$1["frame"] = "frame";
|
|
1061
|
+
return EnumPageType$1;
|
|
1062
|
+
}({});
|
|
1224
1063
|
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1064
|
+
//#endregion
|
|
1065
|
+
//#region models/recently.ts
|
|
1066
|
+
let RecentlyRefTypes = /* @__PURE__ */ function(RecentlyRefTypes$1) {
|
|
1067
|
+
RecentlyRefTypes$1["Post"] = "Post";
|
|
1068
|
+
RecentlyRefTypes$1["Note"] = "Note";
|
|
1069
|
+
RecentlyRefTypes$1["Page"] = "Page";
|
|
1070
|
+
return RecentlyRefTypes$1;
|
|
1071
|
+
}({});
|
|
1232
1072
|
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1073
|
+
//#endregion
|
|
1074
|
+
//#region models/snippet.ts
|
|
1075
|
+
let SnippetType = /* @__PURE__ */ function(SnippetType$1) {
|
|
1076
|
+
SnippetType$1["JSON"] = "json";
|
|
1077
|
+
SnippetType$1["Function"] = "function";
|
|
1078
|
+
SnippetType$1["Text"] = "text";
|
|
1079
|
+
SnippetType$1["YAML"] = "yaml";
|
|
1080
|
+
return SnippetType$1;
|
|
1081
|
+
}({});
|
|
1241
1082
|
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1083
|
+
//#endregion
|
|
1084
|
+
//#region ../../apps/core/src/modules/subscribe/subscribe.constant.ts
|
|
1085
|
+
const SubscribePostCreateBit = Math.trunc(1);
|
|
1086
|
+
const SubscribeNoteCreateBit = 2;
|
|
1087
|
+
const SubscribeSayCreateBit = 4;
|
|
1088
|
+
const SubscribeRecentCreateBit = 8;
|
|
1089
|
+
const SubscribeAllBit = 15;
|
|
1090
|
+
const SubscribeTypeToBitMap = {
|
|
1091
|
+
post_c: SubscribePostCreateBit,
|
|
1092
|
+
note_c: SubscribeNoteCreateBit,
|
|
1093
|
+
say_c: SubscribeSayCreateBit,
|
|
1094
|
+
recently_c: SubscribeRecentCreateBit,
|
|
1095
|
+
all: SubscribeAllBit
|
|
1254
1096
|
};
|
|
1255
1097
|
|
|
1256
|
-
|
|
1098
|
+
//#endregion
|
|
1099
|
+
//#region index.ts
|
|
1257
1100
|
var api_client_default = createClient;
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1101
|
+
|
|
1102
|
+
//#endregion
|
|
1103
|
+
exports.AIController = AIController;
|
|
1104
|
+
exports.AckController = AckController;
|
|
1105
|
+
exports.ActivityController = ActivityController;
|
|
1106
|
+
exports.AggregateController = AggregateController;
|
|
1107
|
+
exports.CategoryController = CategoryController;
|
|
1108
|
+
exports.CategoryType = CategoryType;
|
|
1109
|
+
exports.CollectionRefTypes = CollectionRefTypes;
|
|
1110
|
+
exports.CommentController = CommentController;
|
|
1111
|
+
exports.CommentState = CommentState;
|
|
1112
|
+
exports.EnumPageType = EnumPageType;
|
|
1113
|
+
exports.LinkController = LinkController;
|
|
1114
|
+
exports.LinkState = LinkState;
|
|
1115
|
+
exports.LinkType = LinkType;
|
|
1116
|
+
exports.NoteController = NoteController;
|
|
1117
|
+
exports.PageController = PageController;
|
|
1118
|
+
exports.PostController = PostController;
|
|
1119
|
+
exports.ProjectController = ProjectController;
|
|
1120
|
+
exports.RecentlyAttitudeEnum = RecentlyAttitudeEnum;
|
|
1121
|
+
exports.RecentlyAttitudeResultEnum = RecentlyAttitudeResultEnum;
|
|
1122
|
+
exports.RecentlyController = RecentlyController;
|
|
1123
|
+
exports.RecentlyRefTypes = RecentlyRefTypes;
|
|
1124
|
+
exports.RequestError = RequestError;
|
|
1125
|
+
exports.SayController = SayController;
|
|
1126
|
+
exports.SearchController = SearchController;
|
|
1127
|
+
exports.ServerlessController = ServerlessController;
|
|
1128
|
+
exports.SnippetController = SnippetController;
|
|
1129
|
+
exports.SnippetType = SnippetType;
|
|
1130
|
+
exports.SubscribeAllBit = SubscribeAllBit;
|
|
1131
|
+
exports.SubscribeController = SubscribeController;
|
|
1132
|
+
exports.SubscribeNoteCreateBit = SubscribeNoteCreateBit;
|
|
1133
|
+
exports.SubscribePostCreateBit = SubscribePostCreateBit;
|
|
1134
|
+
exports.SubscribeRecentCreateBit = SubscribeRecentCreateBit;
|
|
1135
|
+
exports.SubscribeSayCreateBit = SubscribeSayCreateBit;
|
|
1136
|
+
exports.SubscribeTypeToBitMap = SubscribeTypeToBitMap;
|
|
1137
|
+
exports.TimelineType = TimelineType;
|
|
1138
|
+
exports.TopicController = TopicController;
|
|
1139
|
+
exports.UserController = UserController;
|
|
1140
|
+
exports.allControllerNames = allControllerNames;
|
|
1141
|
+
exports.allControllers = allControllers;
|
|
1142
|
+
exports.createClient = createClient;
|
|
1143
|
+
exports.default = api_client_default;
|
|
1144
|
+
exports.simpleCamelcaseKeys = camelcaseKeys;
|