@mx-space/api-client 1.21.2 → 2.0.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 +155 -33
- package/dist/index.d.cts +500 -90
- package/dist/index.d.mts +500 -90
- package/dist/index.mjs +155 -33
- package/package.json +9 -9
- package/readme.md +70 -1
- package/LICENSE +0 -33
package/dist/index.d.cts
CHANGED
|
@@ -170,6 +170,8 @@ interface TextBaseModel extends BaseCommentIndexModel {
|
|
|
170
170
|
text: string;
|
|
171
171
|
images?: Image[];
|
|
172
172
|
modified: string | null;
|
|
173
|
+
contentFormat?: 'markdown' | 'lexical';
|
|
174
|
+
content?: string;
|
|
173
175
|
}
|
|
174
176
|
type ModelWithLiked<T> = T & {
|
|
175
177
|
liked: boolean;
|
|
@@ -425,15 +427,25 @@ declare class UrlOptionModel {
|
|
|
425
427
|
serverUrl: string;
|
|
426
428
|
wsUrl: string;
|
|
427
429
|
}
|
|
428
|
-
declare class
|
|
429
|
-
port
|
|
430
|
-
host
|
|
430
|
+
declare class SmtpOptionsModel {
|
|
431
|
+
port?: number;
|
|
432
|
+
host?: string;
|
|
433
|
+
secure?: boolean;
|
|
434
|
+
}
|
|
435
|
+
declare class SmtpConfigModel {
|
|
436
|
+
user?: string;
|
|
437
|
+
pass?: string;
|
|
438
|
+
options?: SmtpOptionsModel;
|
|
439
|
+
}
|
|
440
|
+
declare class ResendConfigModel {
|
|
441
|
+
apiKey?: string;
|
|
431
442
|
}
|
|
432
443
|
declare class MailOptionsModel {
|
|
433
444
|
enable: boolean;
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
445
|
+
provider?: 'smtp' | 'resend';
|
|
446
|
+
from?: string;
|
|
447
|
+
smtp?: SmtpConfigModel;
|
|
448
|
+
resend?: ResendConfigModel;
|
|
437
449
|
}
|
|
438
450
|
declare class CommentOptionsModel {
|
|
439
451
|
antiSpam: boolean;
|
|
@@ -471,6 +483,9 @@ declare class AdminExtraModel {
|
|
|
471
483
|
*/
|
|
472
484
|
enableAdminProxy?: boolean;
|
|
473
485
|
}
|
|
486
|
+
declare class ThirdPartyServiceIntegrationModel {
|
|
487
|
+
githubToken?: string;
|
|
488
|
+
}
|
|
474
489
|
interface IConfig {
|
|
475
490
|
seo: SeoOptionModel;
|
|
476
491
|
url: UrlOptionModel;
|
|
@@ -480,6 +495,7 @@ interface IConfig {
|
|
|
480
495
|
baiduSearchOptions: BaiduSearchOptionsModel;
|
|
481
496
|
algoliaSearchOptions: AlgoliaSearchOptionsModel;
|
|
482
497
|
adminExtra: AdminExtraModel;
|
|
498
|
+
thirdPartyServiceIntegration: ThirdPartyServiceIntegrationModel;
|
|
483
499
|
}
|
|
484
500
|
declare type IConfigKeys = keyof IConfig;
|
|
485
501
|
//#endregion
|
|
@@ -504,6 +520,51 @@ type TLogin = {
|
|
|
504
520
|
lastLoginTime: null | string;
|
|
505
521
|
lastLoginIp?: null | string;
|
|
506
522
|
} & Pick<UserModel, 'name' | 'username' | 'created' | 'url' | 'mail' | 'avatar' | 'id'>;
|
|
523
|
+
type BetterAuthUserRole = 'owner' | 'reader';
|
|
524
|
+
interface BetterAuthUser {
|
|
525
|
+
id: string;
|
|
526
|
+
email?: string | null;
|
|
527
|
+
name?: string | null;
|
|
528
|
+
image?: string | null;
|
|
529
|
+
role?: BetterAuthUserRole;
|
|
530
|
+
handle?: string | null;
|
|
531
|
+
username?: string | null;
|
|
532
|
+
displayUsername?: string | null;
|
|
533
|
+
[key: string]: unknown;
|
|
534
|
+
}
|
|
535
|
+
interface BetterAuthSession {
|
|
536
|
+
id?: string;
|
|
537
|
+
token: string;
|
|
538
|
+
userId: string;
|
|
539
|
+
expiresAt: string;
|
|
540
|
+
createdAt: string;
|
|
541
|
+
updatedAt: string;
|
|
542
|
+
ipAddress?: string | null;
|
|
543
|
+
userAgent?: string | null;
|
|
544
|
+
provider?: string | null;
|
|
545
|
+
[key: string]: unknown;
|
|
546
|
+
}
|
|
547
|
+
interface BetterAuthSignInResult {
|
|
548
|
+
token: string;
|
|
549
|
+
user: BetterAuthUser;
|
|
550
|
+
}
|
|
551
|
+
interface BetterAuthSessionResult {
|
|
552
|
+
session: BetterAuthSession;
|
|
553
|
+
user: BetterAuthUser;
|
|
554
|
+
}
|
|
555
|
+
interface OwnerSessionResult extends BetterAuthUser {
|
|
556
|
+
provider?: string;
|
|
557
|
+
providerAccountId?: string;
|
|
558
|
+
session?: BetterAuthSession;
|
|
559
|
+
}
|
|
560
|
+
type CheckLoggedResult = {
|
|
561
|
+
ok: number;
|
|
562
|
+
isGuest: boolean;
|
|
563
|
+
};
|
|
564
|
+
type OwnerAllowLoginResult = {
|
|
565
|
+
password: boolean;
|
|
566
|
+
passkey: boolean;
|
|
567
|
+
} & Record<string, boolean>;
|
|
507
568
|
//#endregion
|
|
508
569
|
//#region models/aggregate.d.ts
|
|
509
570
|
interface AggregateAIConfig {
|
|
@@ -581,6 +642,21 @@ interface AISummaryModel {
|
|
|
581
642
|
refId: string;
|
|
582
643
|
lang: string;
|
|
583
644
|
}
|
|
645
|
+
interface AITranslationModel {
|
|
646
|
+
id: string;
|
|
647
|
+
created: string;
|
|
648
|
+
hash: string;
|
|
649
|
+
refId: string;
|
|
650
|
+
refType: string;
|
|
651
|
+
lang: string;
|
|
652
|
+
sourceLang: string;
|
|
653
|
+
title: string;
|
|
654
|
+
text: string;
|
|
655
|
+
summary?: string;
|
|
656
|
+
tags?: string[];
|
|
657
|
+
aiModel?: string;
|
|
658
|
+
aiProvider?: string;
|
|
659
|
+
}
|
|
584
660
|
interface AIDeepReadingModel {
|
|
585
661
|
id: string;
|
|
586
662
|
hash: string;
|
|
@@ -589,6 +665,32 @@ interface AIDeepReadingModel {
|
|
|
589
665
|
criticalAnalysis: string;
|
|
590
666
|
content: string;
|
|
591
667
|
}
|
|
668
|
+
/**
|
|
669
|
+
* SSE Stream Event Types
|
|
670
|
+
*
|
|
671
|
+
* Note: All data fields are transmitted as strings over SSE.
|
|
672
|
+
* Objects are JSON.stringify'd before sending.
|
|
673
|
+
*/
|
|
674
|
+
type AISummaryStreamEvent = {
|
|
675
|
+
type: 'token';
|
|
676
|
+
data: string;
|
|
677
|
+
} | {
|
|
678
|
+
type: 'done';
|
|
679
|
+
data: undefined;
|
|
680
|
+
} | {
|
|
681
|
+
type: 'error';
|
|
682
|
+
data: string;
|
|
683
|
+
};
|
|
684
|
+
type AITranslationStreamEvent = {
|
|
685
|
+
type: 'token';
|
|
686
|
+
data: string;
|
|
687
|
+
} | {
|
|
688
|
+
type: 'done';
|
|
689
|
+
data: undefined;
|
|
690
|
+
} | {
|
|
691
|
+
type: 'error';
|
|
692
|
+
data: string;
|
|
693
|
+
};
|
|
592
694
|
//#endregion
|
|
593
695
|
//#region models/auth.d.ts
|
|
594
696
|
interface AuthUser {
|
|
@@ -723,7 +825,7 @@ interface SnippetModel<T = unknown> extends BaseModel {
|
|
|
723
825
|
}
|
|
724
826
|
//#endregion
|
|
725
827
|
//#region ../../apps/core/src/modules/subscribe/subscribe.constant.d.ts
|
|
726
|
-
declare const SubscribePostCreateBit
|
|
828
|
+
declare const SubscribePostCreateBit = 1;
|
|
727
829
|
declare const SubscribeNoteCreateBit: number;
|
|
728
830
|
declare const SubscribeSayCreateBit: number;
|
|
729
831
|
declare const SubscribeRecentCreateBit: number;
|
|
@@ -1084,6 +1186,214 @@ declare class AIController<ResponseWrapper> implements IController {
|
|
|
1084
1186
|
};
|
|
1085
1187
|
$serialized: AIDeepReadingModel;
|
|
1086
1188
|
}>;
|
|
1189
|
+
/**
|
|
1190
|
+
* Get translation for an article
|
|
1191
|
+
* @support core >= 9.4.0
|
|
1192
|
+
*/
|
|
1193
|
+
getTranslation({
|
|
1194
|
+
articleId,
|
|
1195
|
+
lang
|
|
1196
|
+
}: {
|
|
1197
|
+
articleId: string;
|
|
1198
|
+
lang: string;
|
|
1199
|
+
}): Promise<AITranslationModel & {
|
|
1200
|
+
$raw: ResponseWrapper extends {
|
|
1201
|
+
data: infer T;
|
|
1202
|
+
} ? ResponseWrapper : ResponseWrapper extends unknown ? {
|
|
1203
|
+
[i: string]: any;
|
|
1204
|
+
data: (ResponseWrapper extends unknown ? {
|
|
1205
|
+
[key: string]: any;
|
|
1206
|
+
data: AITranslationModel;
|
|
1207
|
+
} : ResponseWrapper extends {
|
|
1208
|
+
data: AITranslationModel;
|
|
1209
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
1210
|
+
data: AITranslationModel;
|
|
1211
|
+
}) extends infer T_1 ? T_1 extends (ResponseWrapper extends unknown ? {
|
|
1212
|
+
[key: string]: any;
|
|
1213
|
+
data: AITranslationModel;
|
|
1214
|
+
} : ResponseWrapper extends {
|
|
1215
|
+
data: AITranslationModel;
|
|
1216
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
1217
|
+
data: AITranslationModel;
|
|
1218
|
+
}) ? T_1 extends unknown ? {
|
|
1219
|
+
id: string;
|
|
1220
|
+
created: string;
|
|
1221
|
+
hash: string;
|
|
1222
|
+
ref_id: string;
|
|
1223
|
+
ref_type: string;
|
|
1224
|
+
lang: string;
|
|
1225
|
+
source_lang: string;
|
|
1226
|
+
title: string;
|
|
1227
|
+
text: string;
|
|
1228
|
+
summary?: string | undefined;
|
|
1229
|
+
tags?: string[] | undefined;
|
|
1230
|
+
ai_model?: string | undefined;
|
|
1231
|
+
ai_provider?: string | undefined;
|
|
1232
|
+
} : T_1 : never : never;
|
|
1233
|
+
} : ResponseWrapper;
|
|
1234
|
+
$request: {
|
|
1235
|
+
path: string;
|
|
1236
|
+
method: string;
|
|
1237
|
+
[k: string]: string;
|
|
1238
|
+
};
|
|
1239
|
+
$serialized: AITranslationModel;
|
|
1240
|
+
}>;
|
|
1241
|
+
/**
|
|
1242
|
+
* Get available translation languages for an article
|
|
1243
|
+
* @support core >= 9.4.0
|
|
1244
|
+
*/
|
|
1245
|
+
getAvailableLanguages(articleId: string): Promise<string[] & {
|
|
1246
|
+
$raw: ResponseWrapper extends {
|
|
1247
|
+
data: infer T;
|
|
1248
|
+
} ? ResponseWrapper : ResponseWrapper extends unknown ? {
|
|
1249
|
+
[i: string]: any;
|
|
1250
|
+
data: (ResponseWrapper extends unknown ? {
|
|
1251
|
+
[key: string]: any;
|
|
1252
|
+
data: string[];
|
|
1253
|
+
} : ResponseWrapper extends {
|
|
1254
|
+
data: string[];
|
|
1255
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
1256
|
+
data: string[];
|
|
1257
|
+
}) extends infer T_1 ? T_1 extends (ResponseWrapper extends unknown ? {
|
|
1258
|
+
[key: string]: any;
|
|
1259
|
+
data: string[];
|
|
1260
|
+
} : ResponseWrapper extends {
|
|
1261
|
+
data: string[];
|
|
1262
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
1263
|
+
data: string[];
|
|
1264
|
+
}) ? T_1 extends unknown ? {
|
|
1265
|
+
length: number;
|
|
1266
|
+
to_string: () => string;
|
|
1267
|
+
to_locale_string: {
|
|
1268
|
+
(): string;
|
|
1269
|
+
(locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string;
|
|
1270
|
+
};
|
|
1271
|
+
pop: () => string | undefined;
|
|
1272
|
+
push: (...items: string[]) => number;
|
|
1273
|
+
concat: {
|
|
1274
|
+
(...items: ConcatArray<string>[]): string[];
|
|
1275
|
+
(...items: (string | ConcatArray<string>)[]): string[];
|
|
1276
|
+
};
|
|
1277
|
+
join: (separator?: string) => string;
|
|
1278
|
+
reverse: () => string[];
|
|
1279
|
+
shift: () => string | undefined;
|
|
1280
|
+
slice: (start?: number, end?: number) => string[];
|
|
1281
|
+
sort: (compareFn?: ((a: string, b: string) => number) | undefined) => string[];
|
|
1282
|
+
splice: {
|
|
1283
|
+
(start: number, deleteCount?: number): string[];
|
|
1284
|
+
(start: number, deleteCount: number, ...items: string[]): string[];
|
|
1285
|
+
};
|
|
1286
|
+
unshift: (...items: string[]) => number;
|
|
1287
|
+
index_of: (searchElement: string, fromIndex?: number) => number;
|
|
1288
|
+
last_index_of: (searchElement: string, fromIndex?: number) => number;
|
|
1289
|
+
every: {
|
|
1290
|
+
<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): this is S[];
|
|
1291
|
+
(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean;
|
|
1292
|
+
};
|
|
1293
|
+
some: (predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any) => boolean;
|
|
1294
|
+
for_each: (callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any) => void;
|
|
1295
|
+
map: <U>(callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[];
|
|
1296
|
+
filter: {
|
|
1297
|
+
<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S[];
|
|
1298
|
+
(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[];
|
|
1299
|
+
};
|
|
1300
|
+
reduce: {
|
|
1301
|
+
(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
|
|
1302
|
+
(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
|
|
1303
|
+
<U>(callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U;
|
|
1304
|
+
};
|
|
1305
|
+
reduce_right: {
|
|
1306
|
+
(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
|
|
1307
|
+
(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
|
|
1308
|
+
<U>(callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U;
|
|
1309
|
+
};
|
|
1310
|
+
find: {
|
|
1311
|
+
<S extends string>(predicate: (value: string, index: number, obj: string[]) => value is S, thisArg?: any): S | undefined;
|
|
1312
|
+
(predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): string | undefined;
|
|
1313
|
+
};
|
|
1314
|
+
find_index: (predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any) => number;
|
|
1315
|
+
fill: (value: string, start?: number, end?: number) => string[];
|
|
1316
|
+
copy_within: (target: number, start: number, end?: number) => string[];
|
|
1317
|
+
entries: () => ArrayIterator<[number, string]>;
|
|
1318
|
+
keys: () => ArrayIterator<number>;
|
|
1319
|
+
values: () => ArrayIterator<string>;
|
|
1320
|
+
includes: (searchElement: string, fromIndex?: number) => boolean;
|
|
1321
|
+
flat_map: <U, This = undefined>(callback: (this: This, value: string, index: number, array: string[]) => U | readonly U[], thisArg?: This | undefined) => U[];
|
|
1322
|
+
flat: <A, D extends number = 1>(this: A, depth?: D | undefined) => FlatArray<A, D>[];
|
|
1323
|
+
at: (index: number) => string | undefined;
|
|
1324
|
+
find_last: {
|
|
1325
|
+
<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S | undefined;
|
|
1326
|
+
(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string | undefined;
|
|
1327
|
+
};
|
|
1328
|
+
find_last_index: (predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any) => number;
|
|
1329
|
+
to_reversed: () => string[];
|
|
1330
|
+
to_sorted: (compareFn?: ((a: string, b: string) => number) | undefined) => string[];
|
|
1331
|
+
to_spliced: {
|
|
1332
|
+
(start: number, deleteCount: number, ...items: string[]): string[];
|
|
1333
|
+
(start: number, deleteCount?: number): string[];
|
|
1334
|
+
};
|
|
1335
|
+
with: (index: number, value: string) => string[];
|
|
1336
|
+
} : T_1 : never : never;
|
|
1337
|
+
} : ResponseWrapper;
|
|
1338
|
+
$request: {
|
|
1339
|
+
path: string;
|
|
1340
|
+
method: string;
|
|
1341
|
+
[k: string]: string;
|
|
1342
|
+
};
|
|
1343
|
+
$serialized: string[];
|
|
1344
|
+
}>;
|
|
1345
|
+
/**
|
|
1346
|
+
* Get URL for streaming summary generation (SSE)
|
|
1347
|
+
*
|
|
1348
|
+
* @see AISummaryStreamEvent for event types
|
|
1349
|
+
* @support core >= 9.4.0
|
|
1350
|
+
*/
|
|
1351
|
+
getSummaryGenerateUrl({
|
|
1352
|
+
articleId,
|
|
1353
|
+
lang
|
|
1354
|
+
}: {
|
|
1355
|
+
articleId: string;
|
|
1356
|
+
lang?: string;
|
|
1357
|
+
}): string;
|
|
1358
|
+
/**
|
|
1359
|
+
* Stream summary generation using fetch
|
|
1360
|
+
*
|
|
1361
|
+
* @see AISummaryStreamEvent for event types
|
|
1362
|
+
* @support core >= 9.4.0
|
|
1363
|
+
*/
|
|
1364
|
+
streamSummaryGenerate({
|
|
1365
|
+
articleId,
|
|
1366
|
+
lang
|
|
1367
|
+
}: {
|
|
1368
|
+
articleId: string;
|
|
1369
|
+
lang?: string;
|
|
1370
|
+
}, fetchOptions?: RequestInit): Promise<Response>;
|
|
1371
|
+
/**
|
|
1372
|
+
* Get URL for streaming translation generation (SSE)
|
|
1373
|
+
*
|
|
1374
|
+
* @see AITranslationStreamEvent for event types
|
|
1375
|
+
* @support core >= 9.4.0
|
|
1376
|
+
*/
|
|
1377
|
+
getTranslationGenerateUrl({
|
|
1378
|
+
articleId,
|
|
1379
|
+
lang
|
|
1380
|
+
}: {
|
|
1381
|
+
articleId: string;
|
|
1382
|
+
lang: string;
|
|
1383
|
+
}): string;
|
|
1384
|
+
/**
|
|
1385
|
+
* Stream translation generation using fetch
|
|
1386
|
+
*
|
|
1387
|
+
* @see AITranslationStreamEvent for event types
|
|
1388
|
+
* @support core >= 9.4.0
|
|
1389
|
+
*/
|
|
1390
|
+
streamTranslationGenerate({
|
|
1391
|
+
articleId,
|
|
1392
|
+
lang
|
|
1393
|
+
}: {
|
|
1394
|
+
articleId: string;
|
|
1395
|
+
lang: string;
|
|
1396
|
+
}, fetchOptions?: RequestInit): Promise<Response>;
|
|
1087
1397
|
}
|
|
1088
1398
|
//#endregion
|
|
1089
1399
|
//#region controllers/category.d.ts
|
|
@@ -1134,7 +1444,7 @@ declare class CategoryController<ResponseWrapper> implements IController {
|
|
|
1134
1444
|
name: string;
|
|
1135
1445
|
created: string;
|
|
1136
1446
|
id: string;
|
|
1137
|
-
children: Pick<PostModel, "id" | "
|
|
1447
|
+
children: Pick<PostModel, "id" | "slug" | "title" | "modified" | "created">[];
|
|
1138
1448
|
} : T_1 : never : never;
|
|
1139
1449
|
} : ResponseWrapper;
|
|
1140
1450
|
$request: {
|
|
@@ -1186,7 +1496,7 @@ declare class CategoryController<ResponseWrapper> implements IController {
|
|
|
1186
1496
|
};
|
|
1187
1497
|
}) ? T_1 extends unknown ? {
|
|
1188
1498
|
tag: string;
|
|
1189
|
-
data: Pick<PostModel, "category" | "id" | "
|
|
1499
|
+
data: Pick<PostModel, "category" | "id" | "slug" | "title" | "created">[];
|
|
1190
1500
|
} : T_1 : never : never;
|
|
1191
1501
|
} : ResponseWrapper;
|
|
1192
1502
|
$request: {
|
|
@@ -1478,6 +1788,173 @@ declare class NoteController<ResponseWrapper> implements IController {
|
|
|
1478
1788
|
}>;
|
|
1479
1789
|
}
|
|
1480
1790
|
//#endregion
|
|
1791
|
+
//#region controllers/owner.d.ts
|
|
1792
|
+
declare module '@mx-space/api-client' {
|
|
1793
|
+
interface HTTPClient<T extends IRequestAdapter = IRequestAdapter, ResponseWrapper = unknown> {
|
|
1794
|
+
owner: UserController<ResponseWrapper>;
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
declare class UserController<ResponseWrapper> implements IController {
|
|
1798
|
+
private readonly client;
|
|
1799
|
+
constructor(client: HTTPClient);
|
|
1800
|
+
base: string;
|
|
1801
|
+
name: string[];
|
|
1802
|
+
get proxy(): IRequestHandler<ResponseWrapper>;
|
|
1803
|
+
private get authProxy();
|
|
1804
|
+
private normalizeToken;
|
|
1805
|
+
/**
|
|
1806
|
+
* @deprecated Use `getOwnerInfo()` instead.
|
|
1807
|
+
*/
|
|
1808
|
+
getMasterInfo(): RequestProxyResult<UserModel, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
1809
|
+
[key: string]: any;
|
|
1810
|
+
data: UserModel;
|
|
1811
|
+
} : ResponseWrapper extends {
|
|
1812
|
+
data: UserModel;
|
|
1813
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
1814
|
+
data: UserModel;
|
|
1815
|
+
}>;
|
|
1816
|
+
getOwnerInfo(): RequestProxyResult<UserModel, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
1817
|
+
[key: string]: any;
|
|
1818
|
+
data: UserModel;
|
|
1819
|
+
} : ResponseWrapper extends {
|
|
1820
|
+
data: UserModel;
|
|
1821
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
1822
|
+
data: UserModel;
|
|
1823
|
+
}>;
|
|
1824
|
+
login(username: string, password: string, options?: {
|
|
1825
|
+
callbackURL?: string;
|
|
1826
|
+
rememberMe?: boolean;
|
|
1827
|
+
}): RequestProxyResult<BetterAuthSignInResult, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
1828
|
+
[key: string]: any;
|
|
1829
|
+
data: BetterAuthSignInResult;
|
|
1830
|
+
} : ResponseWrapper extends {
|
|
1831
|
+
data: BetterAuthSignInResult;
|
|
1832
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
1833
|
+
data: BetterAuthSignInResult;
|
|
1834
|
+
}>;
|
|
1835
|
+
logout(): RequestProxyResult<{
|
|
1836
|
+
success: boolean;
|
|
1837
|
+
}, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
1838
|
+
[key: string]: any;
|
|
1839
|
+
data: {
|
|
1840
|
+
success: boolean;
|
|
1841
|
+
};
|
|
1842
|
+
} : ResponseWrapper extends {
|
|
1843
|
+
data: {
|
|
1844
|
+
success: boolean;
|
|
1845
|
+
};
|
|
1846
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
1847
|
+
data: {
|
|
1848
|
+
success: boolean;
|
|
1849
|
+
};
|
|
1850
|
+
}>;
|
|
1851
|
+
/**
|
|
1852
|
+
* Better Auth raw session (`/auth/get-session`).
|
|
1853
|
+
*/
|
|
1854
|
+
getAuthSession(options?: {
|
|
1855
|
+
disableCookieCache?: boolean;
|
|
1856
|
+
disableRefresh?: boolean;
|
|
1857
|
+
}): RequestProxyResult<BetterAuthSessionResult | null, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
1858
|
+
[key: string]: any;
|
|
1859
|
+
data: BetterAuthSessionResult | null;
|
|
1860
|
+
} : ResponseWrapper extends {
|
|
1861
|
+
data: BetterAuthSessionResult | null;
|
|
1862
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
1863
|
+
data: BetterAuthSessionResult | null;
|
|
1864
|
+
}>;
|
|
1865
|
+
/**
|
|
1866
|
+
* Core session summary (`/auth/session`).
|
|
1867
|
+
*/
|
|
1868
|
+
getSession(): RequestProxyResult<OwnerSessionResult | null, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
1869
|
+
[key: string]: any;
|
|
1870
|
+
data: OwnerSessionResult | null;
|
|
1871
|
+
} : ResponseWrapper extends {
|
|
1872
|
+
data: OwnerSessionResult | null;
|
|
1873
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
1874
|
+
data: OwnerSessionResult | null;
|
|
1875
|
+
}>;
|
|
1876
|
+
getProviders(): RequestProxyResult<string[], ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
1877
|
+
[key: string]: any;
|
|
1878
|
+
data: string[];
|
|
1879
|
+
} : ResponseWrapper extends {
|
|
1880
|
+
data: string[];
|
|
1881
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
1882
|
+
data: string[];
|
|
1883
|
+
}>;
|
|
1884
|
+
getAllowLoginMethods(): RequestProxyResult<OwnerAllowLoginResult, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
1885
|
+
[key: string]: any;
|
|
1886
|
+
data: OwnerAllowLoginResult;
|
|
1887
|
+
} : ResponseWrapper extends {
|
|
1888
|
+
data: OwnerAllowLoginResult;
|
|
1889
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
1890
|
+
data: OwnerAllowLoginResult;
|
|
1891
|
+
}>;
|
|
1892
|
+
listSessions(): RequestProxyResult<BetterAuthSession[], ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
1893
|
+
[key: string]: any;
|
|
1894
|
+
data: BetterAuthSession[];
|
|
1895
|
+
} : ResponseWrapper extends {
|
|
1896
|
+
data: BetterAuthSession[];
|
|
1897
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
1898
|
+
data: BetterAuthSession[];
|
|
1899
|
+
}>;
|
|
1900
|
+
revokeSession(token: string): RequestProxyResult<{
|
|
1901
|
+
status: boolean;
|
|
1902
|
+
}, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
1903
|
+
[key: string]: any;
|
|
1904
|
+
data: {
|
|
1905
|
+
status: boolean;
|
|
1906
|
+
};
|
|
1907
|
+
} : ResponseWrapper extends {
|
|
1908
|
+
data: {
|
|
1909
|
+
status: boolean;
|
|
1910
|
+
};
|
|
1911
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
1912
|
+
data: {
|
|
1913
|
+
status: boolean;
|
|
1914
|
+
};
|
|
1915
|
+
}>;
|
|
1916
|
+
revokeSessions(): RequestProxyResult<{
|
|
1917
|
+
status: boolean;
|
|
1918
|
+
}, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
1919
|
+
[key: string]: any;
|
|
1920
|
+
data: {
|
|
1921
|
+
status: boolean;
|
|
1922
|
+
};
|
|
1923
|
+
} : ResponseWrapper extends {
|
|
1924
|
+
data: {
|
|
1925
|
+
status: boolean;
|
|
1926
|
+
};
|
|
1927
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
1928
|
+
data: {
|
|
1929
|
+
status: boolean;
|
|
1930
|
+
};
|
|
1931
|
+
}>;
|
|
1932
|
+
revokeOtherSessions(): RequestProxyResult<{
|
|
1933
|
+
status: boolean;
|
|
1934
|
+
}, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
1935
|
+
[key: string]: any;
|
|
1936
|
+
data: {
|
|
1937
|
+
status: boolean;
|
|
1938
|
+
};
|
|
1939
|
+
} : ResponseWrapper extends {
|
|
1940
|
+
data: {
|
|
1941
|
+
status: boolean;
|
|
1942
|
+
};
|
|
1943
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
1944
|
+
data: {
|
|
1945
|
+
status: boolean;
|
|
1946
|
+
};
|
|
1947
|
+
}>;
|
|
1948
|
+
checkTokenValid(token?: string): RequestProxyResult<CheckLoggedResult, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
1949
|
+
[key: string]: any;
|
|
1950
|
+
data: CheckLoggedResult;
|
|
1951
|
+
} : ResponseWrapper extends {
|
|
1952
|
+
data: CheckLoggedResult;
|
|
1953
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
1954
|
+
data: CheckLoggedResult;
|
|
1955
|
+
}>;
|
|
1956
|
+
}
|
|
1957
|
+
//#endregion
|
|
1481
1958
|
//#region controllers/page.d.ts
|
|
1482
1959
|
declare module '@mx-space/api-client' {
|
|
1483
1960
|
interface HTTPClient<T extends IRequestAdapter = IRequestAdapter, ResponseWrapper = unknown> {
|
|
@@ -1818,11 +2295,11 @@ declare class SearchController<ResponseWrapper> implements IController {
|
|
|
1818
2295
|
* @param options
|
|
1819
2296
|
* @returns
|
|
1820
2297
|
*/
|
|
1821
|
-
searchByAlgolia(keyword: string, options?: SearchOption): RequestProxyResult<RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "
|
|
2298
|
+
searchByAlgolia(keyword: string, options?: SearchOption): RequestProxyResult<RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "slug" | "title" | "modified" | "created"> & {
|
|
1822
2299
|
type: "post";
|
|
1823
|
-
}) | (Pick<NoteModel, "id" | "
|
|
2300
|
+
}) | (Pick<NoteModel, "id" | "nid" | "title" | "modified" | "created"> & {
|
|
1824
2301
|
type: "note";
|
|
1825
|
-
}) | (Pick<PageModel, "id" | "
|
|
2302
|
+
}) | (Pick<PageModel, "id" | "slug" | "title" | "modified" | "created"> & {
|
|
1826
2303
|
type: "page";
|
|
1827
2304
|
})> & {
|
|
1828
2305
|
/**
|
|
@@ -1831,11 +2308,11 @@ declare class SearchController<ResponseWrapper> implements IController {
|
|
|
1831
2308
|
raw?: any;
|
|
1832
2309
|
}, ResponseWrapper>, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
1833
2310
|
[key: string]: any;
|
|
1834
|
-
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "
|
|
2311
|
+
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "slug" | "title" | "modified" | "created"> & {
|
|
1835
2312
|
type: "post";
|
|
1836
|
-
}) | (Pick<NoteModel, "id" | "
|
|
2313
|
+
}) | (Pick<NoteModel, "id" | "nid" | "title" | "modified" | "created"> & {
|
|
1837
2314
|
type: "note";
|
|
1838
|
-
}) | (Pick<PageModel, "id" | "
|
|
2315
|
+
}) | (Pick<PageModel, "id" | "slug" | "title" | "modified" | "created"> & {
|
|
1839
2316
|
type: "page";
|
|
1840
2317
|
})> & {
|
|
1841
2318
|
/**
|
|
@@ -1844,11 +2321,11 @@ declare class SearchController<ResponseWrapper> implements IController {
|
|
|
1844
2321
|
raw?: any;
|
|
1845
2322
|
}, ResponseWrapper>;
|
|
1846
2323
|
} : ResponseWrapper extends {
|
|
1847
|
-
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "
|
|
2324
|
+
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "slug" | "title" | "modified" | "created"> & {
|
|
1848
2325
|
type: "post";
|
|
1849
|
-
}) | (Pick<NoteModel, "id" | "
|
|
2326
|
+
}) | (Pick<NoteModel, "id" | "nid" | "title" | "modified" | "created"> & {
|
|
1850
2327
|
type: "note";
|
|
1851
|
-
}) | (Pick<PageModel, "id" | "
|
|
2328
|
+
}) | (Pick<PageModel, "id" | "slug" | "title" | "modified" | "created"> & {
|
|
1852
2329
|
type: "page";
|
|
1853
2330
|
})> & {
|
|
1854
2331
|
/**
|
|
@@ -1857,11 +2334,11 @@ declare class SearchController<ResponseWrapper> implements IController {
|
|
|
1857
2334
|
raw?: any;
|
|
1858
2335
|
}, ResponseWrapper>;
|
|
1859
2336
|
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
1860
|
-
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "
|
|
2337
|
+
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "slug" | "title" | "modified" | "created"> & {
|
|
1861
2338
|
type: "post";
|
|
1862
|
-
}) | (Pick<NoteModel, "id" | "
|
|
2339
|
+
}) | (Pick<NoteModel, "id" | "nid" | "title" | "modified" | "created"> & {
|
|
1863
2340
|
type: "note";
|
|
1864
|
-
}) | (Pick<PageModel, "id" | "
|
|
2341
|
+
}) | (Pick<PageModel, "id" | "slug" | "title" | "modified" | "created"> & {
|
|
1865
2342
|
type: "page";
|
|
1866
2343
|
})> & {
|
|
1867
2344
|
/**
|
|
@@ -1999,76 +2476,9 @@ declare class TopicController<ResponseWrapper> extends BaseCrudController<TopicM
|
|
|
1999
2476
|
}>;
|
|
2000
2477
|
}
|
|
2001
2478
|
//#endregion
|
|
2002
|
-
//#region controllers/user.d.ts
|
|
2003
|
-
declare module '@mx-space/api-client' {
|
|
2004
|
-
interface HTTPClient<T extends IRequestAdapter = IRequestAdapter, ResponseWrapper = unknown> {
|
|
2005
|
-
user: UserController<ResponseWrapper>;
|
|
2006
|
-
master: UserController<ResponseWrapper>;
|
|
2007
|
-
}
|
|
2008
|
-
}
|
|
2009
|
-
declare class UserController<ResponseWrapper> implements IController {
|
|
2010
|
-
private readonly client;
|
|
2011
|
-
constructor(client: HTTPClient);
|
|
2012
|
-
base: string;
|
|
2013
|
-
name: string[];
|
|
2014
|
-
get proxy(): IRequestHandler<ResponseWrapper>;
|
|
2015
|
-
getMasterInfo(): RequestProxyResult<UserModel, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
2016
|
-
[key: string]: any;
|
|
2017
|
-
data: UserModel;
|
|
2018
|
-
} : ResponseWrapper extends {
|
|
2019
|
-
data: UserModel;
|
|
2020
|
-
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
2021
|
-
data: UserModel;
|
|
2022
|
-
}>;
|
|
2023
|
-
login(username: string, password: string): RequestProxyResult<TLogin, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
2024
|
-
[key: string]: any;
|
|
2025
|
-
data: TLogin;
|
|
2026
|
-
} : ResponseWrapper extends {
|
|
2027
|
-
data: TLogin;
|
|
2028
|
-
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
2029
|
-
data: TLogin;
|
|
2030
|
-
}>;
|
|
2031
|
-
loginWithToken(token?: string): RequestProxyResult<{
|
|
2032
|
-
token: string;
|
|
2033
|
-
}, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
2034
|
-
[key: string]: any;
|
|
2035
|
-
data: {
|
|
2036
|
-
token: string;
|
|
2037
|
-
};
|
|
2038
|
-
} : ResponseWrapper extends {
|
|
2039
|
-
data: {
|
|
2040
|
-
token: string;
|
|
2041
|
-
};
|
|
2042
|
-
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
2043
|
-
data: {
|
|
2044
|
-
token: string;
|
|
2045
|
-
};
|
|
2046
|
-
}>;
|
|
2047
|
-
checkTokenValid(token: string): RequestProxyResult<{
|
|
2048
|
-
ok: number;
|
|
2049
|
-
isGuest: boolean;
|
|
2050
|
-
}, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
2051
|
-
[key: string]: any;
|
|
2052
|
-
data: {
|
|
2053
|
-
ok: number;
|
|
2054
|
-
isGuest: boolean;
|
|
2055
|
-
};
|
|
2056
|
-
} : ResponseWrapper extends {
|
|
2057
|
-
data: {
|
|
2058
|
-
ok: number;
|
|
2059
|
-
isGuest: boolean;
|
|
2060
|
-
};
|
|
2061
|
-
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
2062
|
-
data: {
|
|
2063
|
-
ok: number;
|
|
2064
|
-
isGuest: boolean;
|
|
2065
|
-
};
|
|
2066
|
-
}>;
|
|
2067
|
-
}
|
|
2068
|
-
//#endregion
|
|
2069
2479
|
//#region controllers/index.d.ts
|
|
2070
2480
|
declare const allControllers: (typeof AckController | typeof ActivityController | typeof AggregateController | typeof AIController | typeof CategoryController | typeof CommentController | typeof LinkController | typeof NoteController | typeof PageController | typeof PostController | typeof ProjectController | typeof RecentlyController | typeof SayController | typeof SearchController | typeof ServerlessController | typeof SnippetController | typeof SubscribeController | typeof TopicController | typeof UserController)[];
|
|
2071
|
-
declare const allControllerNames: readonly ["ai", "ack", "activity", "aggregate", "category", "comment", "link", "note", "page", "post", "project", "topic", "recently", "say", "search", "snippet", "serverless", "subscribe", "
|
|
2481
|
+
declare const allControllerNames: readonly ["ai", "ack", "activity", "aggregate", "category", "comment", "link", "note", "page", "post", "project", "topic", "recently", "say", "search", "snippet", "serverless", "subscribe", "owner", "friend", "shorthand"];
|
|
2072
2482
|
//#endregion
|
|
2073
2483
|
//#region utils/camelcase-keys.d.ts
|
|
2074
2484
|
/**
|
|
@@ -2077,4 +2487,4 @@ declare const allControllerNames: readonly ["ai", "ack", "activity", "aggregate"
|
|
|
2077
2487
|
*/
|
|
2078
2488
|
declare const camelcaseKeys: <T = any>(obj: any) => T;
|
|
2079
2489
|
//#endregion
|
|
2080
|
-
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, type NoteMiddleListOptions, NoteModel, type NoteTimelineItem, type NoteTopicListItem, type NoteTopicListOptions, 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 };
|
|
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 };
|