@mx-space/api-client 1.20.0 → 1.21.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/LICENSE ADDED
@@ -0,0 +1,33 @@
1
+ ** Mix Space Open Source License**
2
+
3
+ This project is dual-licensed under different terms for different parts of the project. It is important for users and contributors to understand the licensing terms applicable to each part of the project.
4
+
5
+ ### For the `apps/` Directory
6
+
7
+ **License:** GNU Affero General Public License v3.0 (AGPLv3) with Additional Terms (ADDITIONAL_TERMS).
8
+
9
+ **Scope:** This license applies exclusively to all files within the `apps/` directory of this project.
10
+
11
+ **Summary:**
12
+ - The AGPLv3 is a free, copyleft license suitable for software that will be distributed over a network. It allows users to use, modify, and distribute the software and any modifications under the same terms.
13
+ - The "Additional Terms" (ADDITIONAL_TERMS) are specific conditions that are added to the AGPLv3 license. These terms must be reviewed in the accompanying LICENSE file or documentation to understand any additional restrictions or permissions that apply to the software.
14
+
15
+ ### For Other Parts of the Project
16
+
17
+ **License:** MIT License.
18
+
19
+ **Scope:** This license applies to all parts of the project that are not included within the `apps/` directory.
20
+
21
+ **Summary:**
22
+ - The MIT License is a permissive open-source license that allows users considerable freedom. It permits use, copying, modification, merging, publishing, distribution, sublicensing, and/or selling copies of the software.
23
+ - It also protects the authors by including a limitation of liability and a disclaimer of warranty.
24
+
25
+ **General Conditions:**
26
+ - Redistribution and use in source and binary forms, with or without modification, are permitted provided that the above license notices and this permission notice appear in all copies of the software.
27
+ - The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement.
28
+
29
+ **Contribution:**
30
+ - Contributions to this project are accepted under the terms of the same license as the part of the project to which the contribution is made.
31
+
32
+ **Notice:**
33
+ - This summary is not the license itself and is not a substitute for reading the licenses in their entirety. All users and contributors are encouraged to read the full text of the licenses for a comprehensive understanding.
@@ -1,5 +1,5 @@
1
- Object.defineProperty(exports, '__esModule', { value: true });
2
- //#region rolldown:runtime
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+ //#region \0rolldown/runtime.js
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,3 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
2
 
2
3
  //#region adaptors/fetch.ts
3
4
  const jsonDataAttachResponse = async (response) => {
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
2
  const require_adaptors_axios = require('./axios.cjs');
3
3
  let umi_request = require("umi-request");
4
4
 
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
2
 
3
3
  //#region utils/index.ts
4
4
  const isPlainObject = (obj) => isObject(obj) && Object.prototype.toString.call(obj) === "[object Object]" && Object.getPrototypeOf(obj) === Object.prototype;
@@ -528,10 +528,11 @@ var PostController = class {
528
528
  * 获取文章列表分页
529
529
  * @param page
530
530
  * @param perPage
531
- * @returns
531
+ * @param options 可选参数,包含 lang 用于获取翻译版本
532
+ * @returns 当传入 lang 时,返回的文章可能包含 isTranslated 和 translationMeta 字段
532
533
  */
533
534
  getList(page = 1, perPage = 10, options = {}) {
534
- const { select, sortBy, sortOrder, year, truncate } = options;
535
+ const { select, sortBy, sortOrder, year, truncate, lang } = options;
535
536
  return this.proxy.get({ params: {
536
537
  page,
537
538
  size: perPage,
@@ -539,7 +540,8 @@ var PostController = class {
539
540
  sortBy,
540
541
  sortOrder,
541
542
  year,
542
- truncate
543
+ truncate,
544
+ lang
543
545
  } });
544
546
  }
545
547
  getPost(idOrCategoryName, slug, options) {
package/dist/index.d.cts CHANGED
@@ -182,6 +182,7 @@ interface TranslationMeta {
182
182
  type ModelWithTranslation<T> = T & {
183
183
  isTranslated: boolean;
184
184
  translationMeta?: TranslationMeta;
185
+ availableTranslations?: string[];
185
186
  };
186
187
  //#endregion
187
188
  //#region models/post.d.ts
@@ -1521,7 +1522,13 @@ type PostListOptions = {
1521
1522
  year?: number;
1522
1523
  sortBy?: 'categoryId' | 'title' | 'created' | 'modified';
1523
1524
  sortOrder?: 1 | -1;
1524
- truncate?: number;
1525
+ truncate?: number; /** 语言代码,用于获取翻译版本 */
1526
+ lang?: string;
1527
+ };
1528
+ /** 文章列表项,可能包含翻译信息 */
1529
+ type PostListItem = PostModel & {
1530
+ isTranslated?: boolean;
1531
+ translationMeta?: TranslationMeta;
1525
1532
  };
1526
1533
  declare class PostController<ResponseWrapper> implements IController {
1527
1534
  private client;
@@ -1533,15 +1540,16 @@ declare class PostController<ResponseWrapper> implements IController {
1533
1540
  * 获取文章列表分页
1534
1541
  * @param page
1535
1542
  * @param perPage
1536
- * @returns
1543
+ * @param options 可选参数,包含 lang 用于获取翻译版本
1544
+ * @returns 当传入 lang 时,返回的文章可能包含 isTranslated 和 translationMeta 字段
1537
1545
  */
1538
- getList(page?: number, perPage?: number, options?: PostListOptions): RequestProxyResult<PaginateResult<PostModel>, ResponseWrapper, ResponseWrapper extends unknown ? {
1546
+ getList(page?: number, perPage?: number, options?: PostListOptions): RequestProxyResult<PaginateResult<PostListItem>, ResponseWrapper, ResponseWrapper extends unknown ? {
1539
1547
  [key: string]: any;
1540
- data: PaginateResult<PostModel>;
1548
+ data: PaginateResult<PostListItem>;
1541
1549
  } : ResponseWrapper extends {
1542
- data: PaginateResult<PostModel>;
1550
+ data: PaginateResult<PostListItem>;
1543
1551
  } ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
1544
- data: PaginateResult<PostModel>;
1552
+ data: PaginateResult<PostListItem>;
1545
1553
  }>;
1546
1554
  /**
1547
1555
  * 根据分类和路径查找文章
@@ -2048,4 +2056,4 @@ declare const allControllerNames: readonly ["ai", "ack", "activity", "aggregate"
2048
2056
  */
2049
2057
  declare const camelcaseKeys: <T = any>(obj: any) => T;
2050
2058
  //#endregion
2051
- export { AIController, AIDeepReadingModel, AISummaryModel, AckController, ActivityController, ActivityPresence, AdminExtraModel, AggregateAIConfig, AggregateController, AggregateRoot, AggregateRootWithTheme, AggregateStat, AggregateTop, AggregateTopNote, AggregateTopPost, AlgoliaSearchOptionsModel, AuthUser, BackupOptionsModel, BaiduSearchOptionsModel, BaseCommentIndexModel, BaseModel, BingSearchOptionsModel, CategoryController, CategoryEntries, CategoryModel, CategoryType, CategoryWithChildrenModel, CollectionRefTypes, CommentController, CommentDto, CommentModel, CommentOptionsModel, CommentRef, CommentState, Coordinate, Count, EnumPageType, type HTTPClient, IConfig, IConfigKeys, type IRequestAdapter, Image, LastYearPublication, LinkController, LinkModel, LinkState, LinkType, MailOptionsModel, ModelWithLiked, ModelWithTranslation, NoteController, NoteModel, NoteWrappedPayload, NoteWrappedWithLikedAndTranslationPayload, NoteWrappedWithLikedPayload, PageController, PageModel, Pager, PaginateResult, PostController, PostModel, ProjectController, ProjectModel, ReaderModel, RecentActivities, RecentComment, RecentLike, RecentNote, RecentPost, RecentRecent, RecentlyAttitudeEnum, RecentlyAttitudeResultEnum, RecentlyController, RecentlyModel, RecentlyRefType, RecentlyRefTypes, RequestError, RoomOmittedNote, RoomOmittedPage, RoomOmittedPost, RoomsData, SayController, SayModel, SearchController, SeoOptionModel, ServerlessController, SnippetController, SnippetModel, SnippetType, SubscribeAllBit, SubscribeController, SubscribeNoteCreateBit, SubscribePostCreateBit, SubscribeRecentCreateBit, SubscribeSayCreateBit, SubscribeType, SubscribeTypeToBitMap, TLogin, TagModel, TextBaseModel, TimelineData, TimelineType, TopicController, TopicModel, TranslationMeta, Url, UrlOptionModel, UserController, UserModel, allControllerNames, allControllers, createClient, createClient as default, camelcaseKeys as simpleCamelcaseKeys };
2059
+ export { AIController, AIDeepReadingModel, AISummaryModel, AckController, ActivityController, ActivityPresence, AdminExtraModel, AggregateAIConfig, AggregateController, AggregateRoot, AggregateRootWithTheme, AggregateStat, AggregateTop, AggregateTopNote, AggregateTopPost, AlgoliaSearchOptionsModel, AuthUser, BackupOptionsModel, BaiduSearchOptionsModel, BaseCommentIndexModel, BaseModel, BingSearchOptionsModel, CategoryController, CategoryEntries, CategoryModel, CategoryType, CategoryWithChildrenModel, CollectionRefTypes, CommentController, CommentDto, CommentModel, CommentOptionsModel, CommentRef, CommentState, Coordinate, Count, EnumPageType, type HTTPClient, IConfig, IConfigKeys, type IRequestAdapter, Image, LastYearPublication, LinkController, LinkModel, LinkState, LinkType, MailOptionsModel, ModelWithLiked, ModelWithTranslation, NoteController, NoteModel, NoteWrappedPayload, NoteWrappedWithLikedAndTranslationPayload, NoteWrappedWithLikedPayload, PageController, PageModel, Pager, PaginateResult, PostController, type PostListItem, type PostListOptions, PostModel, ProjectController, ProjectModel, ReaderModel, RecentActivities, RecentComment, RecentLike, RecentNote, RecentPost, RecentRecent, RecentlyAttitudeEnum, RecentlyAttitudeResultEnum, RecentlyController, RecentlyModel, RecentlyRefType, RecentlyRefTypes, RequestError, RoomOmittedNote, RoomOmittedPage, RoomOmittedPost, RoomsData, SayController, SayModel, SearchController, SeoOptionModel, ServerlessController, SnippetController, SnippetModel, SnippetType, SubscribeAllBit, SubscribeController, SubscribeNoteCreateBit, SubscribePostCreateBit, SubscribeRecentCreateBit, SubscribeSayCreateBit, SubscribeType, SubscribeTypeToBitMap, TLogin, TagModel, TextBaseModel, TimelineData, TimelineType, TopicController, TopicModel, TranslationMeta, Url, UrlOptionModel, UserController, UserModel, allControllerNames, allControllers, createClient, createClient as default, camelcaseKeys as simpleCamelcaseKeys };
package/dist/index.d.mts CHANGED
@@ -182,6 +182,7 @@ interface TranslationMeta {
182
182
  type ModelWithTranslation<T> = T & {
183
183
  isTranslated: boolean;
184
184
  translationMeta?: TranslationMeta;
185
+ availableTranslations?: string[];
185
186
  };
186
187
  //#endregion
187
188
  //#region models/post.d.ts
@@ -1521,7 +1522,13 @@ type PostListOptions = {
1521
1522
  year?: number;
1522
1523
  sortBy?: 'categoryId' | 'title' | 'created' | 'modified';
1523
1524
  sortOrder?: 1 | -1;
1524
- truncate?: number;
1525
+ truncate?: number; /** 语言代码,用于获取翻译版本 */
1526
+ lang?: string;
1527
+ };
1528
+ /** 文章列表项,可能包含翻译信息 */
1529
+ type PostListItem = PostModel & {
1530
+ isTranslated?: boolean;
1531
+ translationMeta?: TranslationMeta;
1525
1532
  };
1526
1533
  declare class PostController<ResponseWrapper> implements IController {
1527
1534
  private client;
@@ -1533,15 +1540,16 @@ declare class PostController<ResponseWrapper> implements IController {
1533
1540
  * 获取文章列表分页
1534
1541
  * @param page
1535
1542
  * @param perPage
1536
- * @returns
1543
+ * @param options 可选参数,包含 lang 用于获取翻译版本
1544
+ * @returns 当传入 lang 时,返回的文章可能包含 isTranslated 和 translationMeta 字段
1537
1545
  */
1538
- getList(page?: number, perPage?: number, options?: PostListOptions): RequestProxyResult<PaginateResult<PostModel>, ResponseWrapper, ResponseWrapper extends unknown ? {
1546
+ getList(page?: number, perPage?: number, options?: PostListOptions): RequestProxyResult<PaginateResult<PostListItem>, ResponseWrapper, ResponseWrapper extends unknown ? {
1539
1547
  [key: string]: any;
1540
- data: PaginateResult<PostModel>;
1548
+ data: PaginateResult<PostListItem>;
1541
1549
  } : ResponseWrapper extends {
1542
- data: PaginateResult<PostModel>;
1550
+ data: PaginateResult<PostListItem>;
1543
1551
  } ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
1544
- data: PaginateResult<PostModel>;
1552
+ data: PaginateResult<PostListItem>;
1545
1553
  }>;
1546
1554
  /**
1547
1555
  * 根据分类和路径查找文章
@@ -2048,4 +2056,4 @@ declare const allControllerNames: readonly ["ai", "ack", "activity", "aggregate"
2048
2056
  */
2049
2057
  declare const camelcaseKeys: <T = any>(obj: any) => T;
2050
2058
  //#endregion
2051
- export { AIController, AIDeepReadingModel, AISummaryModel, AckController, ActivityController, ActivityPresence, AdminExtraModel, AggregateAIConfig, AggregateController, AggregateRoot, AggregateRootWithTheme, AggregateStat, AggregateTop, AggregateTopNote, AggregateTopPost, AlgoliaSearchOptionsModel, AuthUser, BackupOptionsModel, BaiduSearchOptionsModel, BaseCommentIndexModel, BaseModel, BingSearchOptionsModel, CategoryController, CategoryEntries, CategoryModel, CategoryType, CategoryWithChildrenModel, CollectionRefTypes, CommentController, CommentDto, CommentModel, CommentOptionsModel, CommentRef, CommentState, Coordinate, Count, EnumPageType, type HTTPClient, IConfig, IConfigKeys, type IRequestAdapter, Image, LastYearPublication, LinkController, LinkModel, LinkState, LinkType, MailOptionsModel, ModelWithLiked, ModelWithTranslation, NoteController, NoteModel, NoteWrappedPayload, NoteWrappedWithLikedAndTranslationPayload, NoteWrappedWithLikedPayload, PageController, PageModel, Pager, PaginateResult, PostController, PostModel, ProjectController, ProjectModel, ReaderModel, RecentActivities, RecentComment, RecentLike, RecentNote, RecentPost, RecentRecent, RecentlyAttitudeEnum, RecentlyAttitudeResultEnum, RecentlyController, RecentlyModel, RecentlyRefType, RecentlyRefTypes, RequestError, RoomOmittedNote, RoomOmittedPage, RoomOmittedPost, RoomsData, SayController, SayModel, SearchController, SeoOptionModel, ServerlessController, SnippetController, SnippetModel, SnippetType, SubscribeAllBit, SubscribeController, SubscribeNoteCreateBit, SubscribePostCreateBit, SubscribeRecentCreateBit, SubscribeSayCreateBit, SubscribeType, SubscribeTypeToBitMap, TLogin, TagModel, TextBaseModel, TimelineData, TimelineType, TopicController, TopicModel, TranslationMeta, Url, UrlOptionModel, UserController, UserModel, allControllerNames, allControllers, createClient, createClient as default, camelcaseKeys as simpleCamelcaseKeys };
2059
+ export { AIController, AIDeepReadingModel, AISummaryModel, AckController, ActivityController, ActivityPresence, AdminExtraModel, AggregateAIConfig, AggregateController, AggregateRoot, AggregateRootWithTheme, AggregateStat, AggregateTop, AggregateTopNote, AggregateTopPost, AlgoliaSearchOptionsModel, AuthUser, BackupOptionsModel, BaiduSearchOptionsModel, BaseCommentIndexModel, BaseModel, BingSearchOptionsModel, CategoryController, CategoryEntries, CategoryModel, CategoryType, CategoryWithChildrenModel, CollectionRefTypes, CommentController, CommentDto, CommentModel, CommentOptionsModel, CommentRef, CommentState, Coordinate, Count, EnumPageType, type HTTPClient, IConfig, IConfigKeys, type IRequestAdapter, Image, LastYearPublication, LinkController, LinkModel, LinkState, LinkType, MailOptionsModel, ModelWithLiked, ModelWithTranslation, NoteController, NoteModel, NoteWrappedPayload, NoteWrappedWithLikedAndTranslationPayload, NoteWrappedWithLikedPayload, PageController, PageModel, Pager, PaginateResult, PostController, type PostListItem, type PostListOptions, PostModel, ProjectController, ProjectModel, ReaderModel, RecentActivities, RecentComment, RecentLike, RecentNote, RecentPost, RecentRecent, RecentlyAttitudeEnum, RecentlyAttitudeResultEnum, RecentlyController, RecentlyModel, RecentlyRefType, RecentlyRefTypes, RequestError, RoomOmittedNote, RoomOmittedPage, RoomOmittedPost, RoomsData, SayController, SayModel, SearchController, SeoOptionModel, ServerlessController, SnippetController, SnippetModel, SnippetType, SubscribeAllBit, SubscribeController, SubscribeNoteCreateBit, SubscribePostCreateBit, SubscribeRecentCreateBit, SubscribeSayCreateBit, SubscribeType, SubscribeTypeToBitMap, TLogin, TagModel, TextBaseModel, TimelineData, TimelineType, TopicController, TopicModel, TranslationMeta, Url, UrlOptionModel, UserController, UserModel, allControllerNames, allControllers, createClient, createClient as default, camelcaseKeys as simpleCamelcaseKeys };
package/dist/index.mjs CHANGED
@@ -526,10 +526,11 @@ var PostController = class {
526
526
  * 获取文章列表分页
527
527
  * @param page
528
528
  * @param perPage
529
- * @returns
529
+ * @param options 可选参数,包含 lang 用于获取翻译版本
530
+ * @returns 当传入 lang 时,返回的文章可能包含 isTranslated 和 translationMeta 字段
530
531
  */
531
532
  getList(page = 1, perPage = 10, options = {}) {
532
- const { select, sortBy, sortOrder, year, truncate } = options;
533
+ const { select, sortBy, sortOrder, year, truncate, lang } = options;
533
534
  return this.proxy.get({ params: {
534
535
  page,
535
536
  size: perPage,
@@ -537,7 +538,8 @@ var PostController = class {
537
538
  sortBy,
538
539
  sortOrder,
539
540
  year,
540
- truncate
541
+ truncate,
542
+ lang
541
543
  } });
542
544
  }
543
545
  getPost(idOrCategoryName, slug, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-space/api-client",
3
- "version": "1.20.0",
3
+ "version": "1.21.0",
4
4
  "description": "A api client for mx-space server@next",
5
5
  "type": "module",
6
6
  "engines": {
@@ -42,13 +42,6 @@
42
42
  "tag": false,
43
43
  "commit_message": "chore(release): bump @mx-space/api-client to v${NEW_VERSION}"
44
44
  },
45
- "scripts": {
46
- "package": "rm -rf dist && tsdown && node mod-dts.mjs",
47
- "build": "npm run package",
48
- "prepackage": "rm -rf dist",
49
- "test": "vitest",
50
- "dev": "vitest"
51
- },
52
45
  "devDependencies": {
53
46
  "@types/cors": "2.8.19",
54
47
  "@types/express": "5.0.6",
@@ -63,5 +56,12 @@
63
56
  "umi-request": "1.4.0",
64
57
  "vite": "^7.3.1",
65
58
  "vitest": "4.0.18"
59
+ },
60
+ "scripts": {
61
+ "package": "rm -rf dist && tsdown && node mod-dts.mjs",
62
+ "build": "npm run package",
63
+ "prepackage": "rm -rf dist",
64
+ "test": "vitest",
65
+ "dev": "vitest"
66
66
  }
67
- }
67
+ }