mezon-js 2.10.97 → 2.10.99
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/api.gen.ts +5 -5
- package/client.ts +29 -7
- package/dist/api.gen.d.ts +3 -3
- package/dist/client.d.ts +3 -1
- package/dist/mezon-js.cjs.js +27 -8
- package/dist/mezon-js.esm.mjs +27 -8
- package/dist/socket.d.ts +5 -5
- package/package.json +1 -1
- package/socket.ts +8 -8
package/api.gen.ts
CHANGED
@@ -761,8 +761,8 @@ export interface ApiChannelDescription {
|
|
761
761
|
meeting_code?: string;
|
762
762
|
//
|
763
763
|
meeting_uri?: string;
|
764
|
-
//The
|
765
|
-
|
764
|
+
//The parent channel this message belongs to.
|
765
|
+
parent_id?: string;
|
766
766
|
//
|
767
767
|
is_online?: Array<boolean>;
|
768
768
|
//
|
@@ -1111,8 +1111,8 @@ export interface ApiCreateChannelDescRequest {
|
|
1111
1111
|
channel_private?: number;
|
1112
1112
|
//
|
1113
1113
|
clan_id?: string;
|
1114
|
-
//The
|
1115
|
-
|
1114
|
+
//The parent channel this message belongs to.
|
1115
|
+
parent_id?: string;
|
1116
1116
|
//The channel type.
|
1117
1117
|
type?: number;
|
1118
1118
|
//The users to add.
|
@@ -1417,7 +1417,7 @@ export interface ApiHashtagDm {
|
|
1417
1417
|
//
|
1418
1418
|
meeting_code?: string;
|
1419
1419
|
//
|
1420
|
-
|
1420
|
+
parent_id?: string;
|
1421
1421
|
//
|
1422
1422
|
type?: number;
|
1423
1423
|
}
|
package/client.ts
CHANGED
@@ -561,6 +561,9 @@ export class Client {
|
|
561
561
|
/** The low level API client for Mezon server. */
|
562
562
|
private readonly apiClient: MezonApi;
|
563
563
|
|
564
|
+
/** thre refreshTokenPromise */
|
565
|
+
private refreshTokenPromise: Promise<Session> | null = null;
|
566
|
+
|
564
567
|
constructor(
|
565
568
|
readonly serverkey = DEFAULT_SERVER_KEY,
|
566
569
|
readonly host = DEFAULT_HOST,
|
@@ -2404,12 +2407,31 @@ export class Client {
|
|
2404
2407
|
);
|
2405
2408
|
}
|
2406
2409
|
|
2407
|
-
|
2408
|
-
|
2409
|
-
|
2410
|
+
if (this.refreshTokenPromise) {
|
2411
|
+
return this.refreshTokenPromise; // Reuse existing promise
|
2412
|
+
}
|
2413
|
+
|
2414
|
+
this.refreshTokenPromise = new Promise<Session>(async (resolve, reject) => {
|
2415
|
+
try {
|
2416
|
+
const apiSession = await this.apiClient.sessionRefresh(
|
2417
|
+
this.serverkey,
|
2418
|
+
"",
|
2419
|
+
{
|
2420
|
+
token: session.refresh_token,
|
2421
|
+
vars: vars,
|
2422
|
+
}
|
2423
|
+
);
|
2424
|
+
session.update(apiSession.token!, apiSession.refresh_token!);
|
2425
|
+
this.refreshTokenPromise = null; // Reset the promise
|
2426
|
+
resolve(session);
|
2427
|
+
} catch (error) {
|
2428
|
+
console.error("Session refresh failed:", error);
|
2429
|
+
this.refreshTokenPromise = null; // Reset promise on error
|
2430
|
+
reject(error);
|
2431
|
+
}
|
2410
2432
|
});
|
2411
|
-
|
2412
|
-
return
|
2433
|
+
|
2434
|
+
return this.refreshTokenPromise;
|
2413
2435
|
}
|
2414
2436
|
|
2415
2437
|
/** Remove the Apple ID from the social profiles on the current user's account. */
|
@@ -4134,7 +4156,7 @@ export class Client {
|
|
4134
4156
|
type?: number,
|
4135
4157
|
limit?: number,
|
4136
4158
|
page?: number,
|
4137
|
-
|
4159
|
+
channelLabel?: string
|
4138
4160
|
): Promise<ApiChannelSettingListResponse> {
|
4139
4161
|
if (
|
4140
4162
|
this.autoRefreshSession &&
|
@@ -4156,7 +4178,7 @@ export class Client {
|
|
4156
4178
|
type,
|
4157
4179
|
limit,
|
4158
4180
|
page,
|
4159
|
-
|
4181
|
+
channelLabel
|
4160
4182
|
)
|
4161
4183
|
.then((response: any) => {
|
4162
4184
|
return Promise.resolve(response);
|
package/dist/api.gen.d.ts
CHANGED
@@ -440,7 +440,7 @@ export interface ApiChannelDescription {
|
|
440
440
|
last_sent_message?: ApiChannelMessageHeader;
|
441
441
|
meeting_code?: string;
|
442
442
|
meeting_uri?: string;
|
443
|
-
|
443
|
+
parent_id?: string;
|
444
444
|
is_online?: Array<boolean>;
|
445
445
|
topic?: string;
|
446
446
|
type?: number;
|
@@ -635,7 +635,7 @@ export interface ApiCreateChannelDescRequest {
|
|
635
635
|
channel_label?: string;
|
636
636
|
channel_private?: number;
|
637
637
|
clan_id?: string;
|
638
|
-
|
638
|
+
parent_id?: string;
|
639
639
|
type?: number;
|
640
640
|
user_ids?: Array<string>;
|
641
641
|
}
|
@@ -811,7 +811,7 @@ export interface ApiHashtagDm {
|
|
811
811
|
clan_id?: string;
|
812
812
|
clan_name?: string;
|
813
813
|
meeting_code?: string;
|
814
|
-
|
814
|
+
parent_id?: string;
|
815
815
|
type?: number;
|
816
816
|
}
|
817
817
|
/** */
|
package/dist/client.d.ts
CHANGED
@@ -347,6 +347,8 @@ export declare class Client {
|
|
347
347
|
expiredTimespanMs: number;
|
348
348
|
/** The low level API client for Mezon server. */
|
349
349
|
private readonly apiClient;
|
350
|
+
/** thre refreshTokenPromise */
|
351
|
+
private refreshTokenPromise;
|
350
352
|
constructor(serverkey?: string, host?: string, port?: string, useSSL?: boolean, timeout?: number, autoRefreshSession?: boolean);
|
351
353
|
/** Add users to a channel, or accept their join requests. */
|
352
354
|
addChannelUsers(session: Session, channelId: string, ids?: Array<string>): Promise<boolean>;
|
@@ -600,7 +602,7 @@ export declare class Client {
|
|
600
602
|
/** List Threads. */
|
601
603
|
listThreadDescs(session: Session, channelId: string, limit?: number, state?: number, clanId?: string, threadId?: string, page?: number): Promise<ApiChannelDescList>;
|
602
604
|
leaveThread(session: Session, channelId: string): Promise<any>;
|
603
|
-
getChannelSettingInClan(session: Session, clanId: string, parentId?: string, categoryId?: string, privateChannel?: number, active?: number, status?: number, type?: number, limit?: number, page?: number,
|
605
|
+
getChannelSettingInClan(session: Session, clanId: string, parentId?: string, categoryId?: string, privateChannel?: number, active?: number, status?: number, type?: number, limit?: number, page?: number, channelLabel?: string): Promise<ApiChannelSettingListResponse>;
|
604
606
|
getChannelCanvasList(session: Session, channelId: string, clanId?: string, limit?: number, page?: number): Promise<ApiChannelCanvasListResponse>;
|
605
607
|
getChannelCanvasDetail(session: Session, id: string, clanId?: string, channelId?: string): Promise<any>;
|
606
608
|
editChannelCanvases(session: Session, request: ApiEditChannelCanvasRequest): Promise<any>;
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -8352,6 +8352,8 @@ var Client = class {
|
|
8352
8352
|
this.autoRefreshSession = autoRefreshSession;
|
8353
8353
|
/** The expired timespan used to check session lifetime. */
|
8354
8354
|
this.expiredTimespanMs = DEFAULT_EXPIRED_TIMESPAN_MS;
|
8355
|
+
/** thre refreshTokenPromise */
|
8356
|
+
this.refreshTokenPromise = null;
|
8355
8357
|
const scheme = useSSL ? "https://" : "http://";
|
8356
8358
|
const basePath = `${scheme}${host}:${port}`;
|
8357
8359
|
this.apiClient = new MezonApi(serverkey, basePath, timeout);
|
@@ -9506,12 +9508,29 @@ var Client = class {
|
|
9506
9508
|
"Session refresh lifetime too short, please set '--session.refresh_token_expiry_sec' option. See the documentation for more info: https://mezon.vn/docs/mezon/getting-started/configuration/#session"
|
9507
9509
|
);
|
9508
9510
|
}
|
9509
|
-
|
9510
|
-
|
9511
|
-
|
9512
|
-
|
9513
|
-
|
9514
|
-
|
9511
|
+
if (this.refreshTokenPromise) {
|
9512
|
+
return this.refreshTokenPromise;
|
9513
|
+
}
|
9514
|
+
this.refreshTokenPromise = new Promise((resolve, reject) => __async(this, null, function* () {
|
9515
|
+
try {
|
9516
|
+
const apiSession = yield this.apiClient.sessionRefresh(
|
9517
|
+
this.serverkey,
|
9518
|
+
"",
|
9519
|
+
{
|
9520
|
+
token: session.refresh_token,
|
9521
|
+
vars
|
9522
|
+
}
|
9523
|
+
);
|
9524
|
+
session.update(apiSession.token, apiSession.refresh_token);
|
9525
|
+
this.refreshTokenPromise = null;
|
9526
|
+
resolve(session);
|
9527
|
+
} catch (error) {
|
9528
|
+
console.error("Session refresh failed:", error);
|
9529
|
+
this.refreshTokenPromise = null;
|
9530
|
+
reject(error);
|
9531
|
+
}
|
9532
|
+
}));
|
9533
|
+
return this.refreshTokenPromise;
|
9515
9534
|
});
|
9516
9535
|
}
|
9517
9536
|
/** Remove the Apple ID from the social profiles on the current user's account. */
|
@@ -10469,7 +10488,7 @@ var Client = class {
|
|
10469
10488
|
});
|
10470
10489
|
});
|
10471
10490
|
}
|
10472
|
-
getChannelSettingInClan(session, clanId, parentId, categoryId, privateChannel, active, status, type, limit, page,
|
10491
|
+
getChannelSettingInClan(session, clanId, parentId, categoryId, privateChannel, active, status, type, limit, page, channelLabel) {
|
10473
10492
|
return __async(this, null, function* () {
|
10474
10493
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
10475
10494
|
yield this.sessionRefresh(session);
|
@@ -10485,7 +10504,7 @@ var Client = class {
|
|
10485
10504
|
type,
|
10486
10505
|
limit,
|
10487
10506
|
page,
|
10488
|
-
|
10507
|
+
channelLabel
|
10489
10508
|
).then((response) => {
|
10490
10509
|
return Promise.resolve(response);
|
10491
10510
|
});
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -8318,6 +8318,8 @@ var Client = class {
|
|
8318
8318
|
this.autoRefreshSession = autoRefreshSession;
|
8319
8319
|
/** The expired timespan used to check session lifetime. */
|
8320
8320
|
this.expiredTimespanMs = DEFAULT_EXPIRED_TIMESPAN_MS;
|
8321
|
+
/** thre refreshTokenPromise */
|
8322
|
+
this.refreshTokenPromise = null;
|
8321
8323
|
const scheme = useSSL ? "https://" : "http://";
|
8322
8324
|
const basePath = `${scheme}${host}:${port}`;
|
8323
8325
|
this.apiClient = new MezonApi(serverkey, basePath, timeout);
|
@@ -9472,12 +9474,29 @@ var Client = class {
|
|
9472
9474
|
"Session refresh lifetime too short, please set '--session.refresh_token_expiry_sec' option. See the documentation for more info: https://mezon.vn/docs/mezon/getting-started/configuration/#session"
|
9473
9475
|
);
|
9474
9476
|
}
|
9475
|
-
|
9476
|
-
|
9477
|
-
|
9478
|
-
|
9479
|
-
|
9480
|
-
|
9477
|
+
if (this.refreshTokenPromise) {
|
9478
|
+
return this.refreshTokenPromise;
|
9479
|
+
}
|
9480
|
+
this.refreshTokenPromise = new Promise((resolve, reject) => __async(this, null, function* () {
|
9481
|
+
try {
|
9482
|
+
const apiSession = yield this.apiClient.sessionRefresh(
|
9483
|
+
this.serverkey,
|
9484
|
+
"",
|
9485
|
+
{
|
9486
|
+
token: session.refresh_token,
|
9487
|
+
vars
|
9488
|
+
}
|
9489
|
+
);
|
9490
|
+
session.update(apiSession.token, apiSession.refresh_token);
|
9491
|
+
this.refreshTokenPromise = null;
|
9492
|
+
resolve(session);
|
9493
|
+
} catch (error) {
|
9494
|
+
console.error("Session refresh failed:", error);
|
9495
|
+
this.refreshTokenPromise = null;
|
9496
|
+
reject(error);
|
9497
|
+
}
|
9498
|
+
}));
|
9499
|
+
return this.refreshTokenPromise;
|
9481
9500
|
});
|
9482
9501
|
}
|
9483
9502
|
/** Remove the Apple ID from the social profiles on the current user's account. */
|
@@ -10435,7 +10454,7 @@ var Client = class {
|
|
10435
10454
|
});
|
10436
10455
|
});
|
10437
10456
|
}
|
10438
|
-
getChannelSettingInClan(session, clanId, parentId, categoryId, privateChannel, active, status, type, limit, page,
|
10457
|
+
getChannelSettingInClan(session, clanId, parentId, categoryId, privateChannel, active, status, type, limit, page, channelLabel) {
|
10439
10458
|
return __async(this, null, function* () {
|
10440
10459
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
10441
10460
|
yield this.sessionRefresh(session);
|
@@ -10451,7 +10470,7 @@ var Client = class {
|
|
10451
10470
|
type,
|
10452
10471
|
limit,
|
10453
10472
|
page,
|
10454
|
-
|
10473
|
+
channelLabel
|
10455
10474
|
).then((response) => {
|
10456
10475
|
return Promise.resolve(response);
|
10457
10476
|
});
|
package/dist/socket.d.ts
CHANGED
@@ -313,7 +313,7 @@ export interface ChannelUpdatedEvent {
|
|
313
313
|
clan_id: string;
|
314
314
|
category_id: string;
|
315
315
|
creator_id: string;
|
316
|
-
|
316
|
+
parent_id: string;
|
317
317
|
channel_id: string;
|
318
318
|
channel_label: string;
|
319
319
|
channel_type: number;
|
@@ -331,7 +331,7 @@ export interface ChannelCreatedEvent {
|
|
331
331
|
clan_id: string;
|
332
332
|
category_id: string;
|
333
333
|
creator_id: string;
|
334
|
-
|
334
|
+
parent_id: string;
|
335
335
|
channel_id: string;
|
336
336
|
channel_label: string;
|
337
337
|
channel_private: number;
|
@@ -345,7 +345,7 @@ export interface ChannelDeletedEvent {
|
|
345
345
|
category_id: string;
|
346
346
|
channel_id: string;
|
347
347
|
deletor: string;
|
348
|
-
|
348
|
+
parent_id: string;
|
349
349
|
}
|
350
350
|
export interface StickerCreateEvent {
|
351
351
|
clan_id: string;
|
@@ -515,7 +515,7 @@ export interface ChannelDescription {
|
|
515
515
|
channel_private?: number;
|
516
516
|
meeting_code?: string;
|
517
517
|
clan_name?: string;
|
518
|
-
|
518
|
+
parent_id?: string;
|
519
519
|
last_sent_message?: ApiChannelMessageHeader;
|
520
520
|
}
|
521
521
|
export interface HashtagDm {
|
@@ -526,7 +526,7 @@ export interface HashtagDm {
|
|
526
526
|
meeting_code?: string;
|
527
527
|
type?: number;
|
528
528
|
channel_private?: number;
|
529
|
-
|
529
|
+
parent_id?: string;
|
530
530
|
}
|
531
531
|
export interface NotificationSetting {
|
532
532
|
id?: string;
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -456,8 +456,8 @@ export interface ChannelUpdatedEvent {
|
|
456
456
|
category_id: string;
|
457
457
|
// creator
|
458
458
|
creator_id: string;
|
459
|
-
//
|
460
|
-
|
459
|
+
// parent_id
|
460
|
+
parent_id: string;
|
461
461
|
// channel id
|
462
462
|
channel_id: string;
|
463
463
|
// channel label
|
@@ -491,8 +491,8 @@ export interface ChannelCreatedEvent {
|
|
491
491
|
category_id: string;
|
492
492
|
// creator
|
493
493
|
creator_id: string;
|
494
|
-
//
|
495
|
-
|
494
|
+
// parent_id
|
495
|
+
parent_id: string;
|
496
496
|
// channel id
|
497
497
|
channel_id: string;
|
498
498
|
// channel label
|
@@ -518,8 +518,8 @@ export interface ChannelDeletedEvent {
|
|
518
518
|
channel_id: string;
|
519
519
|
// deletor
|
520
520
|
deletor: string;
|
521
|
-
//
|
522
|
-
|
521
|
+
// parent id
|
522
|
+
parent_id: string;
|
523
523
|
}
|
524
524
|
|
525
525
|
export interface StickerCreateEvent {
|
@@ -756,7 +756,7 @@ export interface ChannelDescription {
|
|
756
756
|
//
|
757
757
|
clan_name?: string;
|
758
758
|
//
|
759
|
-
|
759
|
+
parent_id?: string;
|
760
760
|
//
|
761
761
|
last_sent_message?: ApiChannelMessageHeader;
|
762
762
|
}
|
@@ -778,7 +778,7 @@ export interface HashtagDm {
|
|
778
778
|
//
|
779
779
|
channel_private?: number;
|
780
780
|
//
|
781
|
-
|
781
|
+
parent_id?: string;
|
782
782
|
}
|
783
783
|
|
784
784
|
export interface NotificationSetting {
|