@mx-space/api-client 2.0.0 → 2.1.1
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 +11 -5
- package/dist/index.d.cts +40 -27
- package/dist/index.d.mts +40 -27
- package/dist/index.mjs +11 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -509,11 +509,12 @@ var NoteController = class {
|
|
|
509
509
|
* @param options 可选参数:password, single, lang
|
|
510
510
|
*/
|
|
511
511
|
getNoteByNid(nid, options) {
|
|
512
|
-
const { password, single, lang } = options || {};
|
|
512
|
+
const { password, single, lang, prefer } = options || {};
|
|
513
513
|
return this.proxy.nid(nid.toString()).get({ params: {
|
|
514
514
|
password,
|
|
515
515
|
single: single ? "1" : void 0,
|
|
516
|
-
lang
|
|
516
|
+
lang,
|
|
517
|
+
prefer
|
|
517
518
|
} });
|
|
518
519
|
}
|
|
519
520
|
/**
|
|
@@ -672,8 +673,8 @@ var PageController = class {
|
|
|
672
673
|
* @param slug 路径
|
|
673
674
|
* @returns
|
|
674
675
|
*/
|
|
675
|
-
getBySlug(slug) {
|
|
676
|
-
return this.proxy.slug(slug).get({});
|
|
676
|
+
getBySlug(slug, options) {
|
|
677
|
+
return this.proxy.slug(slug).get({ params: options?.prefer ? { prefer: options.prefer } : void 0 });
|
|
677
678
|
}
|
|
678
679
|
};
|
|
679
680
|
|
|
@@ -711,7 +712,12 @@ var PostController = class {
|
|
|
711
712
|
}
|
|
712
713
|
getPost(idOrCategoryName, slug, options) {
|
|
713
714
|
if (arguments.length == 1) return this.proxy(idOrCategoryName).get();
|
|
714
|
-
else
|
|
715
|
+
else {
|
|
716
|
+
const params = {};
|
|
717
|
+
if (options?.lang) params.lang = options.lang;
|
|
718
|
+
if (options?.prefer) params.prefer = options.prefer;
|
|
719
|
+
return this.proxy(idOrCategoryName)(slug).get({ params: Object.keys(params).length ? params : void 0 });
|
|
720
|
+
}
|
|
715
721
|
}
|
|
716
722
|
/**
|
|
717
723
|
* 获取最新的文章
|
package/dist/index.d.cts
CHANGED
|
@@ -165,14 +165,25 @@ interface BaseCommentIndexModel extends BaseModel {
|
|
|
165
165
|
commentsIndex?: number;
|
|
166
166
|
allowComment: boolean;
|
|
167
167
|
}
|
|
168
|
-
interface
|
|
168
|
+
interface TextBaseModelMarkdown extends BaseCommentIndexModel {
|
|
169
169
|
title: string;
|
|
170
170
|
text: string;
|
|
171
|
+
contentFormat?: 'markdown';
|
|
172
|
+
content?: undefined;
|
|
171
173
|
images?: Image[];
|
|
172
174
|
modified: string | null;
|
|
173
|
-
|
|
174
|
-
content?: string;
|
|
175
|
+
meta?: Record<string, any> | null;
|
|
175
176
|
}
|
|
177
|
+
interface TextBaseModelLexical extends BaseCommentIndexModel {
|
|
178
|
+
title: string;
|
|
179
|
+
text?: string;
|
|
180
|
+
contentFormat: 'lexical';
|
|
181
|
+
content: string;
|
|
182
|
+
images?: Image[];
|
|
183
|
+
modified: string | null;
|
|
184
|
+
meta?: Record<string, any> | null;
|
|
185
|
+
}
|
|
186
|
+
type TextBaseModel = TextBaseModelMarkdown | TextBaseModelLexical;
|
|
176
187
|
type ModelWithLiked<T> = T & {
|
|
177
188
|
liked: boolean;
|
|
178
189
|
};
|
|
@@ -188,13 +199,11 @@ type ModelWithTranslation<T> = T & {
|
|
|
188
199
|
};
|
|
189
200
|
//#endregion
|
|
190
201
|
//#region models/post.d.ts
|
|
191
|
-
|
|
202
|
+
type PostModel = TextBaseModel & {
|
|
192
203
|
summary?: string | null;
|
|
193
204
|
copyright: boolean;
|
|
194
205
|
tags: string[];
|
|
195
206
|
count: Count;
|
|
196
|
-
text: string;
|
|
197
|
-
title: string;
|
|
198
207
|
slug: string;
|
|
199
208
|
categoryId: string;
|
|
200
209
|
images: Image[];
|
|
@@ -202,7 +211,7 @@ interface PostModel extends TextBaseModel {
|
|
|
202
211
|
pin?: string | null;
|
|
203
212
|
pinOrder?: number;
|
|
204
213
|
related?: Pick<PostModel, 'id' | 'category' | 'categoryId' | 'created' | 'modified' | 'title' | 'slug' | 'summary'>[];
|
|
205
|
-
}
|
|
214
|
+
};
|
|
206
215
|
//#endregion
|
|
207
216
|
//#region models/category.d.ts
|
|
208
217
|
declare enum CategoryType {
|
|
@@ -355,7 +364,7 @@ interface TopicModel extends BaseModel {
|
|
|
355
364
|
}
|
|
356
365
|
//#endregion
|
|
357
366
|
//#region models/note.d.ts
|
|
358
|
-
|
|
367
|
+
type NoteModel = TextBaseModel & {
|
|
359
368
|
isPublished: boolean;
|
|
360
369
|
count: {
|
|
361
370
|
read: number;
|
|
@@ -371,7 +380,7 @@ interface NoteModel extends TextBaseModel {
|
|
|
371
380
|
coordinates?: Coordinate;
|
|
372
381
|
topic?: TopicModel;
|
|
373
382
|
topicId?: string;
|
|
374
|
-
}
|
|
383
|
+
};
|
|
375
384
|
interface Coordinate {
|
|
376
385
|
latitude: number;
|
|
377
386
|
longitude: number;
|
|
@@ -398,14 +407,14 @@ declare enum EnumPageType {
|
|
|
398
407
|
'html' = "html",
|
|
399
408
|
'frame' = "frame"
|
|
400
409
|
}
|
|
401
|
-
|
|
410
|
+
type PageModel = TextBaseModel & {
|
|
402
411
|
created: string;
|
|
403
412
|
slug: string;
|
|
404
413
|
subtitle?: string;
|
|
405
414
|
order?: number;
|
|
406
415
|
type?: EnumPageType;
|
|
407
416
|
options?: object;
|
|
408
|
-
}
|
|
417
|
+
};
|
|
409
418
|
//#endregion
|
|
410
419
|
//#region models/say.d.ts
|
|
411
420
|
interface SayModel extends BaseModel {
|
|
@@ -1444,7 +1453,7 @@ declare class CategoryController<ResponseWrapper> implements IController {
|
|
|
1444
1453
|
name: string;
|
|
1445
1454
|
created: string;
|
|
1446
1455
|
id: string;
|
|
1447
|
-
children: Pick<PostModel, "id" | "
|
|
1456
|
+
children: Pick<PostModel, "id" | "created" | "title" | "slug" | "modified">[];
|
|
1448
1457
|
} : T_1 : never : never;
|
|
1449
1458
|
} : ResponseWrapper;
|
|
1450
1459
|
$request: {
|
|
@@ -1496,7 +1505,7 @@ declare class CategoryController<ResponseWrapper> implements IController {
|
|
|
1496
1505
|
};
|
|
1497
1506
|
}) ? T_1 extends unknown ? {
|
|
1498
1507
|
tag: string;
|
|
1499
|
-
data: Pick<PostModel, "category" | "id" | "
|
|
1508
|
+
data: Pick<PostModel, "category" | "id" | "created" | "title" | "slug">[];
|
|
1500
1509
|
} : T_1 : never : never;
|
|
1501
1510
|
} : ResponseWrapper;
|
|
1502
1511
|
$request: {
|
|
@@ -1686,6 +1695,7 @@ type NoteByNidOptions = {
|
|
|
1686
1695
|
password?: string;
|
|
1687
1696
|
single?: boolean;
|
|
1688
1697
|
lang?: string;
|
|
1698
|
+
prefer?: 'lexical';
|
|
1689
1699
|
};
|
|
1690
1700
|
type NoteMiddleListOptions = {
|
|
1691
1701
|
lang?: string;
|
|
@@ -1999,7 +2009,9 @@ declare class PageController<ResponseWrapper> implements IController {
|
|
|
1999
2009
|
* @param slug 路径
|
|
2000
2010
|
* @returns
|
|
2001
2011
|
*/
|
|
2002
|
-
getBySlug(slug: string
|
|
2012
|
+
getBySlug(slug: string, options?: {
|
|
2013
|
+
prefer?: 'lexical';
|
|
2014
|
+
}): RequestProxyResult<PageModel, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
2003
2015
|
[key: string]: any;
|
|
2004
2016
|
data: PageModel;
|
|
2005
2017
|
} : ResponseWrapper extends {
|
|
@@ -2057,6 +2069,7 @@ declare class PostController<ResponseWrapper> implements IController {
|
|
|
2057
2069
|
*/
|
|
2058
2070
|
getPost(categoryName: string, slug: string, options?: {
|
|
2059
2071
|
lang?: string;
|
|
2072
|
+
prefer?: 'lexical';
|
|
2060
2073
|
}): RequestProxyResult<ModelWithLiked<ModelWithTranslation<PostModel>>, ResponseWrapper>;
|
|
2061
2074
|
/**
|
|
2062
2075
|
* 根据 ID 查找文章
|
|
@@ -2295,11 +2308,11 @@ declare class SearchController<ResponseWrapper> implements IController {
|
|
|
2295
2308
|
* @param options
|
|
2296
2309
|
* @returns
|
|
2297
2310
|
*/
|
|
2298
|
-
searchByAlgolia(keyword: string, options?: SearchOption): RequestProxyResult<RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "
|
|
2311
|
+
searchByAlgolia(keyword: string, options?: SearchOption): RequestProxyResult<RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "created" | "title" | "slug" | "modified"> & {
|
|
2299
2312
|
type: "post";
|
|
2300
|
-
}) | (Pick<NoteModel, "id" | "
|
|
2313
|
+
}) | (Pick<NoteModel, "id" | "created" | "title" | "modified" | "nid"> & {
|
|
2301
2314
|
type: "note";
|
|
2302
|
-
}) | (Pick<PageModel, "id" | "
|
|
2315
|
+
}) | (Pick<PageModel, "id" | "created" | "title" | "slug" | "modified"> & {
|
|
2303
2316
|
type: "page";
|
|
2304
2317
|
})> & {
|
|
2305
2318
|
/**
|
|
@@ -2308,11 +2321,11 @@ declare class SearchController<ResponseWrapper> implements IController {
|
|
|
2308
2321
|
raw?: any;
|
|
2309
2322
|
}, ResponseWrapper>, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
2310
2323
|
[key: string]: any;
|
|
2311
|
-
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "
|
|
2324
|
+
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "created" | "title" | "slug" | "modified"> & {
|
|
2312
2325
|
type: "post";
|
|
2313
|
-
}) | (Pick<NoteModel, "id" | "
|
|
2326
|
+
}) | (Pick<NoteModel, "id" | "created" | "title" | "modified" | "nid"> & {
|
|
2314
2327
|
type: "note";
|
|
2315
|
-
}) | (Pick<PageModel, "id" | "
|
|
2328
|
+
}) | (Pick<PageModel, "id" | "created" | "title" | "slug" | "modified"> & {
|
|
2316
2329
|
type: "page";
|
|
2317
2330
|
})> & {
|
|
2318
2331
|
/**
|
|
@@ -2321,11 +2334,11 @@ declare class SearchController<ResponseWrapper> implements IController {
|
|
|
2321
2334
|
raw?: any;
|
|
2322
2335
|
}, ResponseWrapper>;
|
|
2323
2336
|
} : ResponseWrapper extends {
|
|
2324
|
-
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "
|
|
2337
|
+
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "created" | "title" | "slug" | "modified"> & {
|
|
2325
2338
|
type: "post";
|
|
2326
|
-
}) | (Pick<NoteModel, "id" | "
|
|
2339
|
+
}) | (Pick<NoteModel, "id" | "created" | "title" | "modified" | "nid"> & {
|
|
2327
2340
|
type: "note";
|
|
2328
|
-
}) | (Pick<PageModel, "id" | "
|
|
2341
|
+
}) | (Pick<PageModel, "id" | "created" | "title" | "slug" | "modified"> & {
|
|
2329
2342
|
type: "page";
|
|
2330
2343
|
})> & {
|
|
2331
2344
|
/**
|
|
@@ -2334,11 +2347,11 @@ declare class SearchController<ResponseWrapper> implements IController {
|
|
|
2334
2347
|
raw?: any;
|
|
2335
2348
|
}, ResponseWrapper>;
|
|
2336
2349
|
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
2337
|
-
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "
|
|
2350
|
+
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "created" | "title" | "slug" | "modified"> & {
|
|
2338
2351
|
type: "post";
|
|
2339
|
-
}) | (Pick<NoteModel, "id" | "
|
|
2352
|
+
}) | (Pick<NoteModel, "id" | "created" | "title" | "modified" | "nid"> & {
|
|
2340
2353
|
type: "note";
|
|
2341
|
-
}) | (Pick<PageModel, "id" | "
|
|
2354
|
+
}) | (Pick<PageModel, "id" | "created" | "title" | "slug" | "modified"> & {
|
|
2342
2355
|
type: "page";
|
|
2343
2356
|
})> & {
|
|
2344
2357
|
/**
|
|
@@ -2487,4 +2500,4 @@ declare const allControllerNames: readonly ["ai", "ack", "activity", "aggregate"
|
|
|
2487
2500
|
*/
|
|
2488
2501
|
declare const camelcaseKeys: <T = any>(obj: any) => T;
|
|
2489
2502
|
//#endregion
|
|
2490
|
-
export { AIController, AIDeepReadingModel, AISummaryModel, AISummaryStreamEvent, AITranslationModel, AITranslationStreamEvent, AckController, ActivityController, ActivityPresence, AdminExtraModel, AggregateAIConfig, AggregateController, AggregateRoot, AggregateRootWithTheme, AggregateStat, AggregateTop, AggregateTopNote, AggregateTopPost, AlgoliaSearchOptionsModel, AuthUser, BackupOptionsModel, BaiduSearchOptionsModel, BaseCommentIndexModel, BaseModel, BetterAuthSession, BetterAuthSessionResult, BetterAuthSignInResult, BetterAuthUser, BetterAuthUserRole, BingSearchOptionsModel, CategoryController, CategoryEntries, CategoryModel, CategoryType, CategoryWithChildrenModel, CheckLoggedResult, 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, 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, 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, ThirdPartyServiceIntegrationModel, TimelineData, TimelineType, TopicController, TopicModel, TranslationMeta, Url, UrlOptionModel, UserController, UserModel, allControllerNames, allControllers, createClient, createClient as default, camelcaseKeys as simpleCamelcaseKeys };
|
|
2503
|
+
export { AIController, AIDeepReadingModel, AISummaryModel, AISummaryStreamEvent, AITranslationModel, AITranslationStreamEvent, AckController, ActivityController, ActivityPresence, AdminExtraModel, AggregateAIConfig, AggregateController, AggregateRoot, AggregateRootWithTheme, AggregateStat, AggregateTop, AggregateTopNote, AggregateTopPost, AlgoliaSearchOptionsModel, AuthUser, BackupOptionsModel, BaiduSearchOptionsModel, BaseCommentIndexModel, BaseModel, BetterAuthSession, BetterAuthSessionResult, BetterAuthSignInResult, BetterAuthUser, BetterAuthUserRole, BingSearchOptionsModel, CategoryController, CategoryEntries, CategoryModel, CategoryType, CategoryWithChildrenModel, CheckLoggedResult, 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, 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, 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, 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
|
@@ -165,14 +165,25 @@ interface BaseCommentIndexModel extends BaseModel {
|
|
|
165
165
|
commentsIndex?: number;
|
|
166
166
|
allowComment: boolean;
|
|
167
167
|
}
|
|
168
|
-
interface
|
|
168
|
+
interface TextBaseModelMarkdown extends BaseCommentIndexModel {
|
|
169
169
|
title: string;
|
|
170
170
|
text: string;
|
|
171
|
+
contentFormat?: 'markdown';
|
|
172
|
+
content?: undefined;
|
|
171
173
|
images?: Image[];
|
|
172
174
|
modified: string | null;
|
|
173
|
-
|
|
174
|
-
content?: string;
|
|
175
|
+
meta?: Record<string, any> | null;
|
|
175
176
|
}
|
|
177
|
+
interface TextBaseModelLexical extends BaseCommentIndexModel {
|
|
178
|
+
title: string;
|
|
179
|
+
text?: string;
|
|
180
|
+
contentFormat: 'lexical';
|
|
181
|
+
content: string;
|
|
182
|
+
images?: Image[];
|
|
183
|
+
modified: string | null;
|
|
184
|
+
meta?: Record<string, any> | null;
|
|
185
|
+
}
|
|
186
|
+
type TextBaseModel = TextBaseModelMarkdown | TextBaseModelLexical;
|
|
176
187
|
type ModelWithLiked<T> = T & {
|
|
177
188
|
liked: boolean;
|
|
178
189
|
};
|
|
@@ -188,13 +199,11 @@ type ModelWithTranslation<T> = T & {
|
|
|
188
199
|
};
|
|
189
200
|
//#endregion
|
|
190
201
|
//#region models/post.d.ts
|
|
191
|
-
|
|
202
|
+
type PostModel = TextBaseModel & {
|
|
192
203
|
summary?: string | null;
|
|
193
204
|
copyright: boolean;
|
|
194
205
|
tags: string[];
|
|
195
206
|
count: Count;
|
|
196
|
-
text: string;
|
|
197
|
-
title: string;
|
|
198
207
|
slug: string;
|
|
199
208
|
categoryId: string;
|
|
200
209
|
images: Image[];
|
|
@@ -202,7 +211,7 @@ interface PostModel extends TextBaseModel {
|
|
|
202
211
|
pin?: string | null;
|
|
203
212
|
pinOrder?: number;
|
|
204
213
|
related?: Pick<PostModel, 'id' | 'category' | 'categoryId' | 'created' | 'modified' | 'title' | 'slug' | 'summary'>[];
|
|
205
|
-
}
|
|
214
|
+
};
|
|
206
215
|
//#endregion
|
|
207
216
|
//#region models/category.d.ts
|
|
208
217
|
declare enum CategoryType {
|
|
@@ -355,7 +364,7 @@ interface TopicModel extends BaseModel {
|
|
|
355
364
|
}
|
|
356
365
|
//#endregion
|
|
357
366
|
//#region models/note.d.ts
|
|
358
|
-
|
|
367
|
+
type NoteModel = TextBaseModel & {
|
|
359
368
|
isPublished: boolean;
|
|
360
369
|
count: {
|
|
361
370
|
read: number;
|
|
@@ -371,7 +380,7 @@ interface NoteModel extends TextBaseModel {
|
|
|
371
380
|
coordinates?: Coordinate;
|
|
372
381
|
topic?: TopicModel;
|
|
373
382
|
topicId?: string;
|
|
374
|
-
}
|
|
383
|
+
};
|
|
375
384
|
interface Coordinate {
|
|
376
385
|
latitude: number;
|
|
377
386
|
longitude: number;
|
|
@@ -398,14 +407,14 @@ declare enum EnumPageType {
|
|
|
398
407
|
'html' = "html",
|
|
399
408
|
'frame' = "frame"
|
|
400
409
|
}
|
|
401
|
-
|
|
410
|
+
type PageModel = TextBaseModel & {
|
|
402
411
|
created: string;
|
|
403
412
|
slug: string;
|
|
404
413
|
subtitle?: string;
|
|
405
414
|
order?: number;
|
|
406
415
|
type?: EnumPageType;
|
|
407
416
|
options?: object;
|
|
408
|
-
}
|
|
417
|
+
};
|
|
409
418
|
//#endregion
|
|
410
419
|
//#region models/say.d.ts
|
|
411
420
|
interface SayModel extends BaseModel {
|
|
@@ -1444,7 +1453,7 @@ declare class CategoryController<ResponseWrapper> implements IController {
|
|
|
1444
1453
|
name: string;
|
|
1445
1454
|
created: string;
|
|
1446
1455
|
id: string;
|
|
1447
|
-
children: Pick<PostModel, "id" | "
|
|
1456
|
+
children: Pick<PostModel, "id" | "created" | "title" | "slug" | "modified">[];
|
|
1448
1457
|
} : T_1 : never : never;
|
|
1449
1458
|
} : ResponseWrapper;
|
|
1450
1459
|
$request: {
|
|
@@ -1496,7 +1505,7 @@ declare class CategoryController<ResponseWrapper> implements IController {
|
|
|
1496
1505
|
};
|
|
1497
1506
|
}) ? T_1 extends unknown ? {
|
|
1498
1507
|
tag: string;
|
|
1499
|
-
data: Pick<PostModel, "category" | "id" | "
|
|
1508
|
+
data: Pick<PostModel, "category" | "id" | "created" | "title" | "slug">[];
|
|
1500
1509
|
} : T_1 : never : never;
|
|
1501
1510
|
} : ResponseWrapper;
|
|
1502
1511
|
$request: {
|
|
@@ -1686,6 +1695,7 @@ type NoteByNidOptions = {
|
|
|
1686
1695
|
password?: string;
|
|
1687
1696
|
single?: boolean;
|
|
1688
1697
|
lang?: string;
|
|
1698
|
+
prefer?: 'lexical';
|
|
1689
1699
|
};
|
|
1690
1700
|
type NoteMiddleListOptions = {
|
|
1691
1701
|
lang?: string;
|
|
@@ -1999,7 +2009,9 @@ declare class PageController<ResponseWrapper> implements IController {
|
|
|
1999
2009
|
* @param slug 路径
|
|
2000
2010
|
* @returns
|
|
2001
2011
|
*/
|
|
2002
|
-
getBySlug(slug: string
|
|
2012
|
+
getBySlug(slug: string, options?: {
|
|
2013
|
+
prefer?: 'lexical';
|
|
2014
|
+
}): RequestProxyResult<PageModel, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
2003
2015
|
[key: string]: any;
|
|
2004
2016
|
data: PageModel;
|
|
2005
2017
|
} : ResponseWrapper extends {
|
|
@@ -2057,6 +2069,7 @@ declare class PostController<ResponseWrapper> implements IController {
|
|
|
2057
2069
|
*/
|
|
2058
2070
|
getPost(categoryName: string, slug: string, options?: {
|
|
2059
2071
|
lang?: string;
|
|
2072
|
+
prefer?: 'lexical';
|
|
2060
2073
|
}): RequestProxyResult<ModelWithLiked<ModelWithTranslation<PostModel>>, ResponseWrapper>;
|
|
2061
2074
|
/**
|
|
2062
2075
|
* 根据 ID 查找文章
|
|
@@ -2295,11 +2308,11 @@ declare class SearchController<ResponseWrapper> implements IController {
|
|
|
2295
2308
|
* @param options
|
|
2296
2309
|
* @returns
|
|
2297
2310
|
*/
|
|
2298
|
-
searchByAlgolia(keyword: string, options?: SearchOption): RequestProxyResult<RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "
|
|
2311
|
+
searchByAlgolia(keyword: string, options?: SearchOption): RequestProxyResult<RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "created" | "title" | "slug" | "modified"> & {
|
|
2299
2312
|
type: "post";
|
|
2300
|
-
}) | (Pick<NoteModel, "id" | "
|
|
2313
|
+
}) | (Pick<NoteModel, "id" | "created" | "title" | "modified" | "nid"> & {
|
|
2301
2314
|
type: "note";
|
|
2302
|
-
}) | (Pick<PageModel, "id" | "
|
|
2315
|
+
}) | (Pick<PageModel, "id" | "created" | "title" | "slug" | "modified"> & {
|
|
2303
2316
|
type: "page";
|
|
2304
2317
|
})> & {
|
|
2305
2318
|
/**
|
|
@@ -2308,11 +2321,11 @@ declare class SearchController<ResponseWrapper> implements IController {
|
|
|
2308
2321
|
raw?: any;
|
|
2309
2322
|
}, ResponseWrapper>, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
2310
2323
|
[key: string]: any;
|
|
2311
|
-
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "
|
|
2324
|
+
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "created" | "title" | "slug" | "modified"> & {
|
|
2312
2325
|
type: "post";
|
|
2313
|
-
}) | (Pick<NoteModel, "id" | "
|
|
2326
|
+
}) | (Pick<NoteModel, "id" | "created" | "title" | "modified" | "nid"> & {
|
|
2314
2327
|
type: "note";
|
|
2315
|
-
}) | (Pick<PageModel, "id" | "
|
|
2328
|
+
}) | (Pick<PageModel, "id" | "created" | "title" | "slug" | "modified"> & {
|
|
2316
2329
|
type: "page";
|
|
2317
2330
|
})> & {
|
|
2318
2331
|
/**
|
|
@@ -2321,11 +2334,11 @@ declare class SearchController<ResponseWrapper> implements IController {
|
|
|
2321
2334
|
raw?: any;
|
|
2322
2335
|
}, ResponseWrapper>;
|
|
2323
2336
|
} : ResponseWrapper extends {
|
|
2324
|
-
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "
|
|
2337
|
+
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "created" | "title" | "slug" | "modified"> & {
|
|
2325
2338
|
type: "post";
|
|
2326
|
-
}) | (Pick<NoteModel, "id" | "
|
|
2339
|
+
}) | (Pick<NoteModel, "id" | "created" | "title" | "modified" | "nid"> & {
|
|
2327
2340
|
type: "note";
|
|
2328
|
-
}) | (Pick<PageModel, "id" | "
|
|
2341
|
+
}) | (Pick<PageModel, "id" | "created" | "title" | "slug" | "modified"> & {
|
|
2329
2342
|
type: "page";
|
|
2330
2343
|
})> & {
|
|
2331
2344
|
/**
|
|
@@ -2334,11 +2347,11 @@ declare class SearchController<ResponseWrapper> implements IController {
|
|
|
2334
2347
|
raw?: any;
|
|
2335
2348
|
}, ResponseWrapper>;
|
|
2336
2349
|
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
2337
|
-
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "
|
|
2350
|
+
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "created" | "title" | "slug" | "modified"> & {
|
|
2338
2351
|
type: "post";
|
|
2339
|
-
}) | (Pick<NoteModel, "id" | "
|
|
2352
|
+
}) | (Pick<NoteModel, "id" | "created" | "title" | "modified" | "nid"> & {
|
|
2340
2353
|
type: "note";
|
|
2341
|
-
}) | (Pick<PageModel, "id" | "
|
|
2354
|
+
}) | (Pick<PageModel, "id" | "created" | "title" | "slug" | "modified"> & {
|
|
2342
2355
|
type: "page";
|
|
2343
2356
|
})> & {
|
|
2344
2357
|
/**
|
|
@@ -2487,4 +2500,4 @@ declare const allControllerNames: readonly ["ai", "ack", "activity", "aggregate"
|
|
|
2487
2500
|
*/
|
|
2488
2501
|
declare const camelcaseKeys: <T = any>(obj: any) => T;
|
|
2489
2502
|
//#endregion
|
|
2490
|
-
export { AIController, AIDeepReadingModel, AISummaryModel, AISummaryStreamEvent, AITranslationModel, AITranslationStreamEvent, AckController, ActivityController, ActivityPresence, AdminExtraModel, AggregateAIConfig, AggregateController, AggregateRoot, AggregateRootWithTheme, AggregateStat, AggregateTop, AggregateTopNote, AggregateTopPost, AlgoliaSearchOptionsModel, AuthUser, BackupOptionsModel, BaiduSearchOptionsModel, BaseCommentIndexModel, BaseModel, BetterAuthSession, BetterAuthSessionResult, BetterAuthSignInResult, BetterAuthUser, BetterAuthUserRole, BingSearchOptionsModel, CategoryController, CategoryEntries, CategoryModel, CategoryType, CategoryWithChildrenModel, CheckLoggedResult, 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, 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, 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, ThirdPartyServiceIntegrationModel, TimelineData, TimelineType, TopicController, TopicModel, TranslationMeta, Url, UrlOptionModel, UserController, UserModel, allControllerNames, allControllers, createClient, createClient as default, camelcaseKeys as simpleCamelcaseKeys };
|
|
2503
|
+
export { AIController, AIDeepReadingModel, AISummaryModel, AISummaryStreamEvent, AITranslationModel, AITranslationStreamEvent, AckController, ActivityController, ActivityPresence, AdminExtraModel, AggregateAIConfig, AggregateController, AggregateRoot, AggregateRootWithTheme, AggregateStat, AggregateTop, AggregateTopNote, AggregateTopPost, AlgoliaSearchOptionsModel, AuthUser, BackupOptionsModel, BaiduSearchOptionsModel, BaseCommentIndexModel, BaseModel, BetterAuthSession, BetterAuthSessionResult, BetterAuthSignInResult, BetterAuthUser, BetterAuthUserRole, BingSearchOptionsModel, CategoryController, CategoryEntries, CategoryModel, CategoryType, CategoryWithChildrenModel, CheckLoggedResult, 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, 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, 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, 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
|
@@ -507,11 +507,12 @@ var NoteController = class {
|
|
|
507
507
|
* @param options 可选参数:password, single, lang
|
|
508
508
|
*/
|
|
509
509
|
getNoteByNid(nid, options) {
|
|
510
|
-
const { password, single, lang } = options || {};
|
|
510
|
+
const { password, single, lang, prefer } = options || {};
|
|
511
511
|
return this.proxy.nid(nid.toString()).get({ params: {
|
|
512
512
|
password,
|
|
513
513
|
single: single ? "1" : void 0,
|
|
514
|
-
lang
|
|
514
|
+
lang,
|
|
515
|
+
prefer
|
|
515
516
|
} });
|
|
516
517
|
}
|
|
517
518
|
/**
|
|
@@ -670,8 +671,8 @@ var PageController = class {
|
|
|
670
671
|
* @param slug 路径
|
|
671
672
|
* @returns
|
|
672
673
|
*/
|
|
673
|
-
getBySlug(slug) {
|
|
674
|
-
return this.proxy.slug(slug).get({});
|
|
674
|
+
getBySlug(slug, options) {
|
|
675
|
+
return this.proxy.slug(slug).get({ params: options?.prefer ? { prefer: options.prefer } : void 0 });
|
|
675
676
|
}
|
|
676
677
|
};
|
|
677
678
|
|
|
@@ -709,7 +710,12 @@ var PostController = class {
|
|
|
709
710
|
}
|
|
710
711
|
getPost(idOrCategoryName, slug, options) {
|
|
711
712
|
if (arguments.length == 1) return this.proxy(idOrCategoryName).get();
|
|
712
|
-
else
|
|
713
|
+
else {
|
|
714
|
+
const params = {};
|
|
715
|
+
if (options?.lang) params.lang = options.lang;
|
|
716
|
+
if (options?.prefer) params.prefer = options.prefer;
|
|
717
|
+
return this.proxy(idOrCategoryName)(slug).get({ params: Object.keys(params).length ? params : void 0 });
|
|
718
|
+
}
|
|
713
719
|
}
|
|
714
720
|
/**
|
|
715
721
|
* 获取最新的文章
|