@mx-space/api-client 3.3.0 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -256,7 +256,7 @@ var AIController = class {
256
256
  });
257
257
  }
258
258
  /**
259
- * Core >= 8.3.0
259
+ * @deprecated Feature removed from core; see ai-insights equivalent.
260
260
  * @param articleId
261
261
  */
262
262
  async getDeepReading(articleId) {
@@ -339,6 +339,48 @@ var AIController = class {
339
339
  }
340
340
  });
341
341
  }
342
+ /**
343
+ * Get cached AI insights for an article
344
+ * @support core >= 11.3.0
345
+ */
346
+ async getInsights({ articleId, lang = "zh", onlyDb }) {
347
+ return this.proxy.insights.article(articleId).get({ params: {
348
+ lang,
349
+ onlyDb
350
+ } });
351
+ }
352
+ /**
353
+ * Get URL for streaming insights generation (SSE)
354
+ *
355
+ * @see AIInsightsStreamEvent for event types
356
+ * @support core >= 11.3.0
357
+ */
358
+ getInsightsGenerateUrl({ articleId, lang }) {
359
+ const baseUrl = this.client.endpoint;
360
+ const params = new URLSearchParams();
361
+ if (lang) params.set("lang", lang);
362
+ const query = params.toString();
363
+ return `${baseUrl}/${this.base}/insights/article/${articleId}/generate${query ? `?${query}` : ""}`;
364
+ }
365
+ /**
366
+ * Stream insights generation using fetch
367
+ *
368
+ * @see AIInsightsStreamEvent for event types
369
+ * @support core >= 11.3.0
370
+ */
371
+ async streamInsightsGenerate({ articleId, lang }, fetchOptions) {
372
+ const url = this.getInsightsGenerateUrl({
373
+ articleId,
374
+ lang
375
+ });
376
+ return fetch(url, {
377
+ ...fetchOptions,
378
+ headers: {
379
+ Accept: "text/event-stream",
380
+ ...fetchOptions?.headers
381
+ }
382
+ });
383
+ }
342
384
  };
343
385
  //#endregion
344
386
  //#region core/error.ts
package/dist/index.d.cts CHANGED
@@ -708,6 +708,32 @@ type AITranslationStreamEvent = {
708
708
  type: 'error';
709
709
  data: string;
710
710
  };
711
+ interface AIInsightsModel {
712
+ id: string;
713
+ created: string;
714
+ updated?: string;
715
+ hash: string;
716
+ refId: string;
717
+ lang: string;
718
+ content: string;
719
+ isTranslation: boolean;
720
+ sourceInsightsId?: string;
721
+ sourceLang?: string;
722
+ modelInfo?: {
723
+ provider: string;
724
+ model: string;
725
+ };
726
+ }
727
+ type AIInsightsStreamEvent = {
728
+ type: 'token';
729
+ data: string;
730
+ } | {
731
+ type: 'done';
732
+ data: undefined;
733
+ } | {
734
+ type: 'error';
735
+ data: string;
736
+ };
711
737
  //#endregion
712
738
  //#region models/auth.d.ts
713
739
  interface AuthUser {
@@ -1277,7 +1303,7 @@ declare class AIController<ResponseWrapper> implements IController {
1277
1303
  $serialized: AISummaryModel;
1278
1304
  }>;
1279
1305
  /**
1280
- * Core >= 8.3.0
1306
+ * @deprecated Feature removed from core; see ai-insights equivalent.
1281
1307
  * @param articleId
1282
1308
  */
1283
1309
  getDeepReading(articleId: string): Promise<AIDeepReadingModel & {
@@ -1524,6 +1550,87 @@ declare class AIController<ResponseWrapper> implements IController {
1524
1550
  articleId: string;
1525
1551
  lang: string;
1526
1552
  }, fetchOptions?: RequestInit): Promise<Response>;
1553
+ /**
1554
+ * Get cached AI insights for an article
1555
+ * @support core >= 11.3.0
1556
+ */
1557
+ getInsights({
1558
+ articleId,
1559
+ lang,
1560
+ onlyDb
1561
+ }: {
1562
+ articleId: string;
1563
+ lang?: string;
1564
+ onlyDb?: boolean;
1565
+ }): Promise<AIInsightsModel & {
1566
+ $raw: ResponseWrapper extends {
1567
+ data: infer T;
1568
+ } ? ResponseWrapper : ResponseWrapper extends unknown ? {
1569
+ [i: string]: any;
1570
+ data: (ResponseWrapper extends unknown ? {
1571
+ [key: string]: any;
1572
+ data: AIInsightsModel | null;
1573
+ } : ResponseWrapper extends {
1574
+ data: AIInsightsModel | null;
1575
+ } ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
1576
+ data: AIInsightsModel | null;
1577
+ }) extends infer T_1 ? T_1 extends (ResponseWrapper extends unknown ? {
1578
+ [key: string]: any;
1579
+ data: AIInsightsModel | null;
1580
+ } : ResponseWrapper extends {
1581
+ data: AIInsightsModel | null;
1582
+ } ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
1583
+ data: AIInsightsModel | null;
1584
+ }) ? T_1 extends unknown ? {
1585
+ id: string;
1586
+ created: string;
1587
+ updated?: string | undefined;
1588
+ hash: string;
1589
+ ref_id: string;
1590
+ lang: string;
1591
+ content: string;
1592
+ is_translation: boolean;
1593
+ source_insights_id?: string | undefined;
1594
+ source_lang?: string | undefined;
1595
+ model_info?: {
1596
+ provider: string;
1597
+ model: string;
1598
+ } | undefined;
1599
+ } : T_1 : never : never;
1600
+ } : ResponseWrapper;
1601
+ $request: {
1602
+ path: string;
1603
+ method: string;
1604
+ [k: string]: string;
1605
+ };
1606
+ $serialized: AIInsightsModel;
1607
+ }>;
1608
+ /**
1609
+ * Get URL for streaming insights generation (SSE)
1610
+ *
1611
+ * @see AIInsightsStreamEvent for event types
1612
+ * @support core >= 11.3.0
1613
+ */
1614
+ getInsightsGenerateUrl({
1615
+ articleId,
1616
+ lang
1617
+ }: {
1618
+ articleId: string;
1619
+ lang?: string;
1620
+ }): string;
1621
+ /**
1622
+ * Stream insights generation using fetch
1623
+ *
1624
+ * @see AIInsightsStreamEvent for event types
1625
+ * @support core >= 11.3.0
1626
+ */
1627
+ streamInsightsGenerate({
1628
+ articleId,
1629
+ lang
1630
+ }: {
1631
+ articleId: string;
1632
+ lang?: string;
1633
+ }, fetchOptions?: RequestInit): Promise<Response>;
1527
1634
  }
1528
1635
  //#endregion
1529
1636
  //#region controllers/category.d.ts
@@ -1574,7 +1681,7 @@ declare class CategoryController<ResponseWrapper> implements IController {
1574
1681
  name: string;
1575
1682
  created: string;
1576
1683
  id: string;
1577
- children: Pick<PostModel, "id" | "title" | "slug" | "modified" | "created">[];
1684
+ children: Pick<PostModel, "id" | "created" | "title" | "slug" | "modified">[];
1578
1685
  } : T_1 : never : never;
1579
1686
  } : ResponseWrapper;
1580
1687
  $request: {
@@ -1626,7 +1733,7 @@ declare class CategoryController<ResponseWrapper> implements IController {
1626
1733
  };
1627
1734
  }) ? T_1 extends unknown ? {
1628
1735
  tag: string;
1629
- data: Pick<PostModel, "category" | "id" | "title" | "slug" | "created">[];
1736
+ data: Pick<PostModel, "category" | "id" | "created" | "title" | "slug">[];
1630
1737
  } : T_1 : never : never;
1631
1738
  } : ResponseWrapper;
1632
1739
  $request: {
@@ -2467,35 +2574,35 @@ declare class SearchController<ResponseWrapper> implements IController {
2467
2574
  search(type: 'note', keyword: string, options?: SearchOption): Promise<RequestProxyResult<PaginateResult<Pick<NoteModel, 'modified' | 'id' | 'title' | 'created' | 'nid'> & SearchResultHighlight>, ResponseWrapper>>;
2468
2575
  search(type: 'post', keyword: string, options?: SearchOption): Promise<RequestProxyResult<PaginateResult<Pick<PostModel, 'modified' | 'id' | 'title' | 'created' | 'slug' | 'category'> & SearchResultHighlight>, ResponseWrapper>>;
2469
2576
  search(type: 'page', keyword: string, options?: SearchOption): Promise<RequestProxyResult<PaginateResult<Pick<PageModel, 'modified' | 'id' | 'title' | 'created' | 'slug'> & SearchResultHighlight>, ResponseWrapper>>;
2470
- searchAll(keyword: string, options?: SearchOption): RequestProxyResult<RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2577
+ searchAll(keyword: string, options?: SearchOption): RequestProxyResult<RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2471
2578
  type: "post";
2472
- }) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & SearchResultHighlight & {
2579
+ }) | (Pick<NoteModel, "id" | "created" | "title" | "modified" | "nid"> & SearchResultHighlight & {
2473
2580
  type: "note";
2474
- }) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2581
+ }) | (Pick<PageModel, "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2475
2582
  type: "page";
2476
2583
  })>, ResponseWrapper>, ResponseWrapper, ResponseWrapper extends unknown ? {
2477
2584
  [key: string]: any;
2478
- data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2585
+ data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2479
2586
  type: "post";
2480
- }) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & SearchResultHighlight & {
2587
+ }) | (Pick<NoteModel, "id" | "created" | "title" | "modified" | "nid"> & SearchResultHighlight & {
2481
2588
  type: "note";
2482
- }) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2589
+ }) | (Pick<PageModel, "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2483
2590
  type: "page";
2484
2591
  })>, ResponseWrapper>;
2485
2592
  } : ResponseWrapper extends {
2486
- data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2593
+ data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2487
2594
  type: "post";
2488
- }) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & SearchResultHighlight & {
2595
+ }) | (Pick<NoteModel, "id" | "created" | "title" | "modified" | "nid"> & SearchResultHighlight & {
2489
2596
  type: "note";
2490
- }) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2597
+ }) | (Pick<PageModel, "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2491
2598
  type: "page";
2492
2599
  })>, ResponseWrapper>;
2493
2600
  } ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
2494
- data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2601
+ data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2495
2602
  type: "post";
2496
- }) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & SearchResultHighlight & {
2603
+ }) | (Pick<NoteModel, "id" | "created" | "title" | "modified" | "nid"> & SearchResultHighlight & {
2497
2604
  type: "note";
2498
- }) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2605
+ }) | (Pick<PageModel, "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2499
2606
  type: "page";
2500
2607
  })>, ResponseWrapper>;
2501
2608
  }>;
@@ -2639,4 +2746,4 @@ declare const allControllerNames: readonly ["ai", "ack", "activity", "aggregate"
2639
2746
  */
2640
2747
  declare const camelcaseKeys: <T = any>(obj: any) => T;
2641
2748
  //#endregion
2642
- export { AIController, AIDeepReadingModel, AISummaryModel, AISummaryStreamEvent, AITranslationModel, AITranslationStreamEvent, AcademicMetadata, AckController, ActivityController, ActivityPresence, AdminExtraModel, AggregateAIConfig, AggregateController, AggregateRoot, AggregateRootWithTheme, AggregateSiteInfo, AggregateStat, AggregateTop, AggregateTopNote, AggregateTopPost, AnonymousCommentDto, AuthUser, BackupOptionsModel, BaiduSearchOptionsModel, BaseCommentIndexModel, BaseModel, BetterAuthSession, BetterAuthSessionResult, BetterAuthSignInResult, BetterAuthUser, BetterAuthUserRole, BingSearchOptionsModel, BookMetadata, CategoryController, CategoryEntries, CategoryModel$1 as CategoryModel, CategoryType, CategoryWithChildrenModel, CheckLoggedResult, CodeMetadata, CollectionRefTypes, CommentController, CommentDto, CommentModel, CommentOptionsModel, CommentRef, CommentReplyWindow, CommentState, CommentThreadItem, CommentThreadReplies, Coordinate, Count, EnumPageType, GithubMetadata, type HTTPClient, IConfig, IConfigKeys, type IRequestAdapter, Image, LastYearPublication, LatestCombinedItem, LatestData, LatestNoteItem, LatestPostItem, LinkController, LinkMetadata, LinkModel, LinkState, LinkType, MailOptionsModel, MediaMetadata, ModelWithLiked, ModelWithTranslation, MusicMetadata, NoteController, type NoteMiddleListOptions, NoteModel, type NoteTimelineItem, type NoteTopicListItem, type NoteTopicListOptions, NoteWrappedPayload, NoteWrappedWithLikedAndTranslationPayload, NoteWrappedWithLikedPayload, OwnerAllowLoginResult, OwnerSessionResult, PageController, PageModel, Pager, PaginateResult, PostController, type PostListItem, type PostListOptions, PostModel, ProjectController, ProjectModel, ReaderCommentDto, ReaderModel, RecentActivities, RecentComment, RecentLike, RecentNote, RecentPost, RecentRecent, RecentlyAttitudeEnum, RecentlyAttitudeResultEnum, RecentlyController, RecentlyMetadata, RecentlyModel, RecentlyRefType, RecentlyRefTypes, RecentlyTypeEnum, RequestError, RoomOmittedNote, RoomOmittedPage, RoomOmittedPost, RoomsData, SayController, SayModel, SearchController, SeoOptionModel, ServerlessController, SnippetController, SnippetModel, SnippetType, SubscribeAllBit, SubscribeController, SubscribeNoteCreateBit, SubscribePostCreateBit, SubscribeRecentCreateBit, SubscribeSayCreateBit, SubscribeType, SubscribeTypeToBitMap, TLogin, TagModel, TextBaseModel, TextBaseModelLexical, TextBaseModelMarkdown, ThirdPartyServiceIntegrationModel, TimelineData, TimelineType, TopicController, TopicModel, TranslationMeta, Url, UrlOptionModel, UserController, UserModel, allControllerNames, allControllers, createClient, createClient as default, camelcaseKeys as simpleCamelcaseKeys };
2749
+ export { AIController, AIDeepReadingModel, AIInsightsModel, AIInsightsStreamEvent, AISummaryModel, AISummaryStreamEvent, AITranslationModel, AITranslationStreamEvent, AcademicMetadata, AckController, ActivityController, ActivityPresence, AdminExtraModel, AggregateAIConfig, AggregateController, AggregateRoot, AggregateRootWithTheme, AggregateSiteInfo, AggregateStat, AggregateTop, AggregateTopNote, AggregateTopPost, AnonymousCommentDto, AuthUser, BackupOptionsModel, BaiduSearchOptionsModel, BaseCommentIndexModel, BaseModel, BetterAuthSession, BetterAuthSessionResult, BetterAuthSignInResult, BetterAuthUser, BetterAuthUserRole, BingSearchOptionsModel, BookMetadata, CategoryController, CategoryEntries, CategoryModel$1 as CategoryModel, CategoryType, CategoryWithChildrenModel, CheckLoggedResult, CodeMetadata, CollectionRefTypes, CommentController, CommentDto, CommentModel, CommentOptionsModel, CommentRef, CommentReplyWindow, CommentState, CommentThreadItem, CommentThreadReplies, Coordinate, Count, EnumPageType, GithubMetadata, type HTTPClient, IConfig, IConfigKeys, type IRequestAdapter, Image, LastYearPublication, LatestCombinedItem, LatestData, LatestNoteItem, LatestPostItem, LinkController, LinkMetadata, LinkModel, LinkState, LinkType, MailOptionsModel, MediaMetadata, ModelWithLiked, ModelWithTranslation, MusicMetadata, NoteController, type NoteMiddleListOptions, NoteModel, type NoteTimelineItem, type NoteTopicListItem, type NoteTopicListOptions, NoteWrappedPayload, NoteWrappedWithLikedAndTranslationPayload, NoteWrappedWithLikedPayload, OwnerAllowLoginResult, OwnerSessionResult, PageController, PageModel, Pager, PaginateResult, PostController, type PostListItem, type PostListOptions, PostModel, ProjectController, ProjectModel, ReaderCommentDto, ReaderModel, RecentActivities, RecentComment, RecentLike, RecentNote, RecentPost, RecentRecent, RecentlyAttitudeEnum, RecentlyAttitudeResultEnum, RecentlyController, RecentlyMetadata, RecentlyModel, RecentlyRefType, RecentlyRefTypes, RecentlyTypeEnum, RequestError, RoomOmittedNote, RoomOmittedPage, RoomOmittedPost, RoomsData, SayController, SayModel, SearchController, SeoOptionModel, ServerlessController, SnippetController, SnippetModel, SnippetType, SubscribeAllBit, SubscribeController, SubscribeNoteCreateBit, SubscribePostCreateBit, SubscribeRecentCreateBit, SubscribeSayCreateBit, SubscribeType, SubscribeTypeToBitMap, TLogin, TagModel, TextBaseModel, TextBaseModelLexical, TextBaseModelMarkdown, ThirdPartyServiceIntegrationModel, TimelineData, TimelineType, TopicController, TopicModel, TranslationMeta, Url, UrlOptionModel, UserController, UserModel, allControllerNames, allControllers, createClient, createClient as default, camelcaseKeys as simpleCamelcaseKeys };
package/dist/index.d.mts CHANGED
@@ -708,6 +708,32 @@ type AITranslationStreamEvent = {
708
708
  type: 'error';
709
709
  data: string;
710
710
  };
711
+ interface AIInsightsModel {
712
+ id: string;
713
+ created: string;
714
+ updated?: string;
715
+ hash: string;
716
+ refId: string;
717
+ lang: string;
718
+ content: string;
719
+ isTranslation: boolean;
720
+ sourceInsightsId?: string;
721
+ sourceLang?: string;
722
+ modelInfo?: {
723
+ provider: string;
724
+ model: string;
725
+ };
726
+ }
727
+ type AIInsightsStreamEvent = {
728
+ type: 'token';
729
+ data: string;
730
+ } | {
731
+ type: 'done';
732
+ data: undefined;
733
+ } | {
734
+ type: 'error';
735
+ data: string;
736
+ };
711
737
  //#endregion
712
738
  //#region models/auth.d.ts
713
739
  interface AuthUser {
@@ -1277,7 +1303,7 @@ declare class AIController<ResponseWrapper> implements IController {
1277
1303
  $serialized: AISummaryModel;
1278
1304
  }>;
1279
1305
  /**
1280
- * Core >= 8.3.0
1306
+ * @deprecated Feature removed from core; see ai-insights equivalent.
1281
1307
  * @param articleId
1282
1308
  */
1283
1309
  getDeepReading(articleId: string): Promise<AIDeepReadingModel & {
@@ -1524,6 +1550,87 @@ declare class AIController<ResponseWrapper> implements IController {
1524
1550
  articleId: string;
1525
1551
  lang: string;
1526
1552
  }, fetchOptions?: RequestInit): Promise<Response>;
1553
+ /**
1554
+ * Get cached AI insights for an article
1555
+ * @support core >= 11.3.0
1556
+ */
1557
+ getInsights({
1558
+ articleId,
1559
+ lang,
1560
+ onlyDb
1561
+ }: {
1562
+ articleId: string;
1563
+ lang?: string;
1564
+ onlyDb?: boolean;
1565
+ }): Promise<AIInsightsModel & {
1566
+ $raw: ResponseWrapper extends {
1567
+ data: infer T;
1568
+ } ? ResponseWrapper : ResponseWrapper extends unknown ? {
1569
+ [i: string]: any;
1570
+ data: (ResponseWrapper extends unknown ? {
1571
+ [key: string]: any;
1572
+ data: AIInsightsModel | null;
1573
+ } : ResponseWrapper extends {
1574
+ data: AIInsightsModel | null;
1575
+ } ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
1576
+ data: AIInsightsModel | null;
1577
+ }) extends infer T_1 ? T_1 extends (ResponseWrapper extends unknown ? {
1578
+ [key: string]: any;
1579
+ data: AIInsightsModel | null;
1580
+ } : ResponseWrapper extends {
1581
+ data: AIInsightsModel | null;
1582
+ } ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
1583
+ data: AIInsightsModel | null;
1584
+ }) ? T_1 extends unknown ? {
1585
+ id: string;
1586
+ created: string;
1587
+ updated?: string | undefined;
1588
+ hash: string;
1589
+ ref_id: string;
1590
+ lang: string;
1591
+ content: string;
1592
+ is_translation: boolean;
1593
+ source_insights_id?: string | undefined;
1594
+ source_lang?: string | undefined;
1595
+ model_info?: {
1596
+ provider: string;
1597
+ model: string;
1598
+ } | undefined;
1599
+ } : T_1 : never : never;
1600
+ } : ResponseWrapper;
1601
+ $request: {
1602
+ path: string;
1603
+ method: string;
1604
+ [k: string]: string;
1605
+ };
1606
+ $serialized: AIInsightsModel;
1607
+ }>;
1608
+ /**
1609
+ * Get URL for streaming insights generation (SSE)
1610
+ *
1611
+ * @see AIInsightsStreamEvent for event types
1612
+ * @support core >= 11.3.0
1613
+ */
1614
+ getInsightsGenerateUrl({
1615
+ articleId,
1616
+ lang
1617
+ }: {
1618
+ articleId: string;
1619
+ lang?: string;
1620
+ }): string;
1621
+ /**
1622
+ * Stream insights generation using fetch
1623
+ *
1624
+ * @see AIInsightsStreamEvent for event types
1625
+ * @support core >= 11.3.0
1626
+ */
1627
+ streamInsightsGenerate({
1628
+ articleId,
1629
+ lang
1630
+ }: {
1631
+ articleId: string;
1632
+ lang?: string;
1633
+ }, fetchOptions?: RequestInit): Promise<Response>;
1527
1634
  }
1528
1635
  //#endregion
1529
1636
  //#region controllers/category.d.ts
@@ -1574,7 +1681,7 @@ declare class CategoryController<ResponseWrapper> implements IController {
1574
1681
  name: string;
1575
1682
  created: string;
1576
1683
  id: string;
1577
- children: Pick<PostModel, "id" | "title" | "slug" | "modified" | "created">[];
1684
+ children: Pick<PostModel, "id" | "created" | "title" | "slug" | "modified">[];
1578
1685
  } : T_1 : never : never;
1579
1686
  } : ResponseWrapper;
1580
1687
  $request: {
@@ -1626,7 +1733,7 @@ declare class CategoryController<ResponseWrapper> implements IController {
1626
1733
  };
1627
1734
  }) ? T_1 extends unknown ? {
1628
1735
  tag: string;
1629
- data: Pick<PostModel, "category" | "id" | "title" | "slug" | "created">[];
1736
+ data: Pick<PostModel, "category" | "id" | "created" | "title" | "slug">[];
1630
1737
  } : T_1 : never : never;
1631
1738
  } : ResponseWrapper;
1632
1739
  $request: {
@@ -2467,35 +2574,35 @@ declare class SearchController<ResponseWrapper> implements IController {
2467
2574
  search(type: 'note', keyword: string, options?: SearchOption): Promise<RequestProxyResult<PaginateResult<Pick<NoteModel, 'modified' | 'id' | 'title' | 'created' | 'nid'> & SearchResultHighlight>, ResponseWrapper>>;
2468
2575
  search(type: 'post', keyword: string, options?: SearchOption): Promise<RequestProxyResult<PaginateResult<Pick<PostModel, 'modified' | 'id' | 'title' | 'created' | 'slug' | 'category'> & SearchResultHighlight>, ResponseWrapper>>;
2469
2576
  search(type: 'page', keyword: string, options?: SearchOption): Promise<RequestProxyResult<PaginateResult<Pick<PageModel, 'modified' | 'id' | 'title' | 'created' | 'slug'> & SearchResultHighlight>, ResponseWrapper>>;
2470
- searchAll(keyword: string, options?: SearchOption): RequestProxyResult<RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2577
+ searchAll(keyword: string, options?: SearchOption): RequestProxyResult<RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2471
2578
  type: "post";
2472
- }) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & SearchResultHighlight & {
2579
+ }) | (Pick<NoteModel, "id" | "created" | "title" | "modified" | "nid"> & SearchResultHighlight & {
2473
2580
  type: "note";
2474
- }) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2581
+ }) | (Pick<PageModel, "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2475
2582
  type: "page";
2476
2583
  })>, ResponseWrapper>, ResponseWrapper, ResponseWrapper extends unknown ? {
2477
2584
  [key: string]: any;
2478
- data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2585
+ data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2479
2586
  type: "post";
2480
- }) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & SearchResultHighlight & {
2587
+ }) | (Pick<NoteModel, "id" | "created" | "title" | "modified" | "nid"> & SearchResultHighlight & {
2481
2588
  type: "note";
2482
- }) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2589
+ }) | (Pick<PageModel, "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2483
2590
  type: "page";
2484
2591
  })>, ResponseWrapper>;
2485
2592
  } : ResponseWrapper extends {
2486
- data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2593
+ data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2487
2594
  type: "post";
2488
- }) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & SearchResultHighlight & {
2595
+ }) | (Pick<NoteModel, "id" | "created" | "title" | "modified" | "nid"> & SearchResultHighlight & {
2489
2596
  type: "note";
2490
- }) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2597
+ }) | (Pick<PageModel, "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2491
2598
  type: "page";
2492
2599
  })>, ResponseWrapper>;
2493
2600
  } ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
2494
- data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2601
+ data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2495
2602
  type: "post";
2496
- }) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & SearchResultHighlight & {
2603
+ }) | (Pick<NoteModel, "id" | "created" | "title" | "modified" | "nid"> & SearchResultHighlight & {
2497
2604
  type: "note";
2498
- }) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & SearchResultHighlight & {
2605
+ }) | (Pick<PageModel, "id" | "created" | "title" | "slug" | "modified"> & SearchResultHighlight & {
2499
2606
  type: "page";
2500
2607
  })>, ResponseWrapper>;
2501
2608
  }>;
@@ -2639,4 +2746,4 @@ declare const allControllerNames: readonly ["ai", "ack", "activity", "aggregate"
2639
2746
  */
2640
2747
  declare const camelcaseKeys: <T = any>(obj: any) => T;
2641
2748
  //#endregion
2642
- export { AIController, AIDeepReadingModel, AISummaryModel, AISummaryStreamEvent, AITranslationModel, AITranslationStreamEvent, AcademicMetadata, AckController, ActivityController, ActivityPresence, AdminExtraModel, AggregateAIConfig, AggregateController, AggregateRoot, AggregateRootWithTheme, AggregateSiteInfo, AggregateStat, AggregateTop, AggregateTopNote, AggregateTopPost, AnonymousCommentDto, AuthUser, BackupOptionsModel, BaiduSearchOptionsModel, BaseCommentIndexModel, BaseModel, BetterAuthSession, BetterAuthSessionResult, BetterAuthSignInResult, BetterAuthUser, BetterAuthUserRole, BingSearchOptionsModel, BookMetadata, CategoryController, CategoryEntries, CategoryModel$1 as CategoryModel, CategoryType, CategoryWithChildrenModel, CheckLoggedResult, CodeMetadata, CollectionRefTypes, CommentController, CommentDto, CommentModel, CommentOptionsModel, CommentRef, CommentReplyWindow, CommentState, CommentThreadItem, CommentThreadReplies, Coordinate, Count, EnumPageType, GithubMetadata, type HTTPClient, IConfig, IConfigKeys, type IRequestAdapter, Image, LastYearPublication, LatestCombinedItem, LatestData, LatestNoteItem, LatestPostItem, LinkController, LinkMetadata, LinkModel, LinkState, LinkType, MailOptionsModel, MediaMetadata, ModelWithLiked, ModelWithTranslation, MusicMetadata, NoteController, type NoteMiddleListOptions, NoteModel, type NoteTimelineItem, type NoteTopicListItem, type NoteTopicListOptions, NoteWrappedPayload, NoteWrappedWithLikedAndTranslationPayload, NoteWrappedWithLikedPayload, OwnerAllowLoginResult, OwnerSessionResult, PageController, PageModel, Pager, PaginateResult, PostController, type PostListItem, type PostListOptions, PostModel, ProjectController, ProjectModel, ReaderCommentDto, ReaderModel, RecentActivities, RecentComment, RecentLike, RecentNote, RecentPost, RecentRecent, RecentlyAttitudeEnum, RecentlyAttitudeResultEnum, RecentlyController, RecentlyMetadata, RecentlyModel, RecentlyRefType, RecentlyRefTypes, RecentlyTypeEnum, RequestError, RoomOmittedNote, RoomOmittedPage, RoomOmittedPost, RoomsData, SayController, SayModel, SearchController, SeoOptionModel, ServerlessController, SnippetController, SnippetModel, SnippetType, SubscribeAllBit, SubscribeController, SubscribeNoteCreateBit, SubscribePostCreateBit, SubscribeRecentCreateBit, SubscribeSayCreateBit, SubscribeType, SubscribeTypeToBitMap, TLogin, TagModel, TextBaseModel, TextBaseModelLexical, TextBaseModelMarkdown, ThirdPartyServiceIntegrationModel, TimelineData, TimelineType, TopicController, TopicModel, TranslationMeta, Url, UrlOptionModel, UserController, UserModel, allControllerNames, allControllers, createClient, createClient as default, camelcaseKeys as simpleCamelcaseKeys };
2749
+ export { AIController, AIDeepReadingModel, AIInsightsModel, AIInsightsStreamEvent, AISummaryModel, AISummaryStreamEvent, AITranslationModel, AITranslationStreamEvent, AcademicMetadata, AckController, ActivityController, ActivityPresence, AdminExtraModel, AggregateAIConfig, AggregateController, AggregateRoot, AggregateRootWithTheme, AggregateSiteInfo, AggregateStat, AggregateTop, AggregateTopNote, AggregateTopPost, AnonymousCommentDto, AuthUser, BackupOptionsModel, BaiduSearchOptionsModel, BaseCommentIndexModel, BaseModel, BetterAuthSession, BetterAuthSessionResult, BetterAuthSignInResult, BetterAuthUser, BetterAuthUserRole, BingSearchOptionsModel, BookMetadata, CategoryController, CategoryEntries, CategoryModel$1 as CategoryModel, CategoryType, CategoryWithChildrenModel, CheckLoggedResult, CodeMetadata, CollectionRefTypes, CommentController, CommentDto, CommentModel, CommentOptionsModel, CommentRef, CommentReplyWindow, CommentState, CommentThreadItem, CommentThreadReplies, Coordinate, Count, EnumPageType, GithubMetadata, type HTTPClient, IConfig, IConfigKeys, type IRequestAdapter, Image, LastYearPublication, LatestCombinedItem, LatestData, LatestNoteItem, LatestPostItem, LinkController, LinkMetadata, LinkModel, LinkState, LinkType, MailOptionsModel, MediaMetadata, ModelWithLiked, ModelWithTranslation, MusicMetadata, NoteController, type NoteMiddleListOptions, NoteModel, type NoteTimelineItem, type NoteTopicListItem, type NoteTopicListOptions, NoteWrappedPayload, NoteWrappedWithLikedAndTranslationPayload, NoteWrappedWithLikedPayload, OwnerAllowLoginResult, OwnerSessionResult, PageController, PageModel, Pager, PaginateResult, PostController, type PostListItem, type PostListOptions, PostModel, ProjectController, ProjectModel, ReaderCommentDto, ReaderModel, RecentActivities, RecentComment, RecentLike, RecentNote, RecentPost, RecentRecent, RecentlyAttitudeEnum, RecentlyAttitudeResultEnum, RecentlyController, RecentlyMetadata, RecentlyModel, RecentlyRefType, RecentlyRefTypes, RecentlyTypeEnum, RequestError, RoomOmittedNote, RoomOmittedPage, RoomOmittedPost, RoomsData, SayController, SayModel, SearchController, SeoOptionModel, ServerlessController, SnippetController, SnippetModel, SnippetType, SubscribeAllBit, SubscribeController, SubscribeNoteCreateBit, SubscribePostCreateBit, SubscribeRecentCreateBit, SubscribeSayCreateBit, SubscribeType, SubscribeTypeToBitMap, TLogin, TagModel, TextBaseModel, TextBaseModelLexical, TextBaseModelMarkdown, ThirdPartyServiceIntegrationModel, TimelineData, TimelineType, TopicController, TopicModel, TranslationMeta, Url, UrlOptionModel, UserController, UserModel, allControllerNames, allControllers, createClient, createClient as default, camelcaseKeys as simpleCamelcaseKeys };
package/dist/index.mjs CHANGED
@@ -252,7 +252,7 @@ var AIController = class {
252
252
  });
253
253
  }
254
254
  /**
255
- * Core >= 8.3.0
255
+ * @deprecated Feature removed from core; see ai-insights equivalent.
256
256
  * @param articleId
257
257
  */
258
258
  async getDeepReading(articleId) {
@@ -335,6 +335,48 @@ var AIController = class {
335
335
  }
336
336
  });
337
337
  }
338
+ /**
339
+ * Get cached AI insights for an article
340
+ * @support core >= 11.3.0
341
+ */
342
+ async getInsights({ articleId, lang = "zh", onlyDb }) {
343
+ return this.proxy.insights.article(articleId).get({ params: {
344
+ lang,
345
+ onlyDb
346
+ } });
347
+ }
348
+ /**
349
+ * Get URL for streaming insights generation (SSE)
350
+ *
351
+ * @see AIInsightsStreamEvent for event types
352
+ * @support core >= 11.3.0
353
+ */
354
+ getInsightsGenerateUrl({ articleId, lang }) {
355
+ const baseUrl = this.client.endpoint;
356
+ const params = new URLSearchParams();
357
+ if (lang) params.set("lang", lang);
358
+ const query = params.toString();
359
+ return `${baseUrl}/${this.base}/insights/article/${articleId}/generate${query ? `?${query}` : ""}`;
360
+ }
361
+ /**
362
+ * Stream insights generation using fetch
363
+ *
364
+ * @see AIInsightsStreamEvent for event types
365
+ * @support core >= 11.3.0
366
+ */
367
+ async streamInsightsGenerate({ articleId, lang }, fetchOptions) {
368
+ const url = this.getInsightsGenerateUrl({
369
+ articleId,
370
+ lang
371
+ });
372
+ return fetch(url, {
373
+ ...fetchOptions,
374
+ headers: {
375
+ Accept: "text/event-stream",
376
+ ...fetchOptions?.headers
377
+ }
378
+ });
379
+ }
338
380
  };
339
381
  //#endregion
340
382
  //#region core/error.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-space/api-client",
3
- "version": "3.3.0",
3
+ "version": "3.5.0",
4
4
  "description": "A api client for mx-space server@next",
5
5
  "type": "module",
6
6
  "engines": {