mezon-js 2.8.15 → 2.8.17
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +8 -0
- package/client.ts +41 -11
- package/dist/api.gen.d.ts +4 -0
- package/dist/client.d.ts +3 -1
- package/dist/mezon-js.cjs.js +34 -6
- package/dist/mezon-js.esm.mjs +34 -6
- package/package.json +1 -1
package/api.gen.ts
CHANGED
@@ -379,6 +379,8 @@ export interface ApiChannelDescription {
|
|
379
379
|
clan_id?: string;
|
380
380
|
//
|
381
381
|
count_mess_unread?: number;
|
382
|
+
//
|
383
|
+
create_time_ms?: number;
|
382
384
|
//creator ID.
|
383
385
|
creator_id?: string;
|
384
386
|
//
|
@@ -400,6 +402,8 @@ export interface ApiChannelDescription {
|
|
400
402
|
//The channel type.
|
401
403
|
type?: number;
|
402
404
|
//
|
405
|
+
update_time_ms?: number;
|
406
|
+
//
|
403
407
|
user_id?: Array<string>;
|
404
408
|
//
|
405
409
|
usernames?: string;
|
@@ -432,6 +436,8 @@ export interface ApiChannelMessage {
|
|
432
436
|
//The UNIX time (for gRPC clients) or ISO string (for REST clients) when the message was created.
|
433
437
|
create_time?: string;
|
434
438
|
//
|
439
|
+
create_time_ms?: number;
|
440
|
+
//
|
435
441
|
display_name?: string;
|
436
442
|
//
|
437
443
|
mentions?: string;
|
@@ -447,6 +453,8 @@ export interface ApiChannelMessage {
|
|
447
453
|
sender_id: string;
|
448
454
|
//The UNIX time (for gRPC clients) or ISO string (for REST clients) when the message was last updated.
|
449
455
|
update_time?: string;
|
456
|
+
//
|
457
|
+
update_time_ms?: number;
|
450
458
|
//The username of the message sender, if any.
|
451
459
|
username?: string;
|
452
460
|
}
|
package/client.ts
CHANGED
@@ -200,6 +200,8 @@ export interface StorageObjects {
|
|
200
200
|
|
201
201
|
/** A message sent on a channel. */
|
202
202
|
export interface ChannelMessage {
|
203
|
+
//The unique ID of this message.
|
204
|
+
id: string;
|
203
205
|
//
|
204
206
|
avatar?: string;
|
205
207
|
//The channel this message belongs to.
|
@@ -224,9 +226,6 @@ export interface ChannelMessage {
|
|
224
226
|
references?: Array<ApiMessageRef>;
|
225
227
|
//
|
226
228
|
referenced_message?: ChannelMessage;
|
227
|
-
|
228
|
-
//The unique ID of this message.
|
229
|
-
id: string;
|
230
229
|
//True if the message was persisted to the channel's history, false otherwise.
|
231
230
|
persistent?: boolean;
|
232
231
|
//Message sender, usually a user ID.
|
@@ -245,6 +244,10 @@ export interface ChannelMessage {
|
|
245
244
|
clan_avatar?: string;
|
246
245
|
//
|
247
246
|
display_name?: string;
|
247
|
+
//
|
248
|
+
create_time_ms?: number;
|
249
|
+
//
|
250
|
+
update_time_ms?: number;
|
248
251
|
}
|
249
252
|
|
250
253
|
/** A list of channel messages, usually a result of a list operation. */
|
@@ -1058,8 +1061,33 @@ export class Client {
|
|
1058
1061
|
if (response.messages == null) {
|
1059
1062
|
return Promise.resolve(result);
|
1060
1063
|
}
|
1061
|
-
|
1062
|
-
|
1064
|
+
response.messages!.forEach(m => {
|
1065
|
+
var content, reactions, mentions, attachments, references;
|
1066
|
+
try {
|
1067
|
+
content = JSON.parse(m.content);
|
1068
|
+
} catch(e) {
|
1069
|
+
console.log("error parse content", e);
|
1070
|
+
}
|
1071
|
+
try {
|
1072
|
+
reactions = JSON.parse(m.reactions || '[]');
|
1073
|
+
} catch(e) {
|
1074
|
+
console.log("error parse reactions", e);
|
1075
|
+
}
|
1076
|
+
try {
|
1077
|
+
mentions = JSON.parse(m.mentions || '[]');
|
1078
|
+
} catch(e) {
|
1079
|
+
console.log("error parse mentions", e);
|
1080
|
+
}
|
1081
|
+
try {
|
1082
|
+
attachments = JSON.parse(m.attachments || '[]');
|
1083
|
+
} catch(e) {
|
1084
|
+
console.log("error parse attachments", e);
|
1085
|
+
}
|
1086
|
+
try {
|
1087
|
+
references = JSON.parse(m.references || '[]');
|
1088
|
+
} catch(e) {
|
1089
|
+
console.log("error parse references", e);
|
1090
|
+
}
|
1063
1091
|
result.messages!.push({
|
1064
1092
|
channel_id: m.channel_id,
|
1065
1093
|
code: m.code ? Number(m.code) : 0,
|
@@ -1070,17 +1098,19 @@ export class Client {
|
|
1070
1098
|
username: m.username,
|
1071
1099
|
display_name: m.display_name,
|
1072
1100
|
avatar: m.avatar,
|
1073
|
-
content:
|
1101
|
+
content: content,
|
1074
1102
|
channel_label: m.channel_label,
|
1075
1103
|
clan_logo: m.clan_logo,
|
1076
1104
|
category_name: m.category_name,
|
1077
1105
|
clan_nick: m.clan_nick,
|
1078
1106
|
clan_avatar: m.clan_avatar,
|
1079
|
-
attachments:
|
1080
|
-
mentions:
|
1081
|
-
reactions:
|
1082
|
-
references:
|
1083
|
-
clan_id: m.clan_id
|
1107
|
+
attachments: attachments,
|
1108
|
+
mentions: mentions,
|
1109
|
+
reactions: reactions,
|
1110
|
+
references: references,
|
1111
|
+
clan_id: m.clan_id,
|
1112
|
+
create_time_ms: m.create_time_ms,
|
1113
|
+
update_time_ms: m.update_time_ms,
|
1084
1114
|
})
|
1085
1115
|
});
|
1086
1116
|
return Promise.resolve(result);
|
package/dist/api.gen.d.ts
CHANGED
@@ -218,6 +218,7 @@ export interface ApiChannelDescription {
|
|
218
218
|
channel_private?: number;
|
219
219
|
clan_id?: string;
|
220
220
|
count_mess_unread?: number;
|
221
|
+
create_time_ms?: number;
|
221
222
|
creator_id?: string;
|
222
223
|
creator_name?: string;
|
223
224
|
last_pin_message?: string;
|
@@ -228,6 +229,7 @@ export interface ApiChannelDescription {
|
|
228
229
|
parrent_id?: string;
|
229
230
|
status?: number;
|
230
231
|
type?: number;
|
232
|
+
update_time_ms?: number;
|
231
233
|
user_id?: Array<string>;
|
232
234
|
usernames?: string;
|
233
235
|
}
|
@@ -245,6 +247,7 @@ export interface ApiChannelMessage {
|
|
245
247
|
code: number;
|
246
248
|
content: string;
|
247
249
|
create_time?: string;
|
250
|
+
create_time_ms?: number;
|
248
251
|
display_name?: string;
|
249
252
|
mentions?: string;
|
250
253
|
message_id: string;
|
@@ -253,6 +256,7 @@ export interface ApiChannelMessage {
|
|
253
256
|
references?: string;
|
254
257
|
sender_id: string;
|
255
258
|
update_time?: string;
|
259
|
+
update_time_ms?: number;
|
256
260
|
username?: string;
|
257
261
|
}
|
258
262
|
/** */
|
package/dist/client.d.ts
CHANGED
@@ -93,6 +93,7 @@ export interface StorageObjects {
|
|
93
93
|
}
|
94
94
|
/** A message sent on a channel. */
|
95
95
|
export interface ChannelMessage {
|
96
|
+
id: string;
|
96
97
|
avatar?: string;
|
97
98
|
channel_id: string;
|
98
99
|
channel_label: string;
|
@@ -105,7 +106,6 @@ export interface ChannelMessage {
|
|
105
106
|
attachments?: Array<ApiMessageAttachment>;
|
106
107
|
references?: Array<ApiMessageRef>;
|
107
108
|
referenced_message?: ChannelMessage;
|
108
|
-
id: string;
|
109
109
|
persistent?: boolean;
|
110
110
|
sender_id: string;
|
111
111
|
update_time?: string;
|
@@ -115,6 +115,8 @@ export interface ChannelMessage {
|
|
115
115
|
clan_nick?: string;
|
116
116
|
clan_avatar?: string;
|
117
117
|
display_name?: string;
|
118
|
+
create_time_ms?: number;
|
119
|
+
update_time_ms?: number;
|
118
120
|
}
|
119
121
|
/** A list of channel messages, usually a result of a list operation. */
|
120
122
|
export interface ChannelMessageList {
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -5700,6 +5700,32 @@ var Client = class {
|
|
5700
5700
|
return Promise.resolve(result);
|
5701
5701
|
}
|
5702
5702
|
response.messages.forEach((m) => {
|
5703
|
+
var content, reactions, mentions, attachments, references;
|
5704
|
+
try {
|
5705
|
+
content = JSON.parse(m.content);
|
5706
|
+
} catch (e) {
|
5707
|
+
console.log("error parse content", e);
|
5708
|
+
}
|
5709
|
+
try {
|
5710
|
+
reactions = JSON.parse(m.reactions || "[]");
|
5711
|
+
} catch (e) {
|
5712
|
+
console.log("error parse reactions", e);
|
5713
|
+
}
|
5714
|
+
try {
|
5715
|
+
mentions = JSON.parse(m.mentions || "[]");
|
5716
|
+
} catch (e) {
|
5717
|
+
console.log("error parse mentions", e);
|
5718
|
+
}
|
5719
|
+
try {
|
5720
|
+
attachments = JSON.parse(m.attachments || "[]");
|
5721
|
+
} catch (e) {
|
5722
|
+
console.log("error parse attachments", e);
|
5723
|
+
}
|
5724
|
+
try {
|
5725
|
+
references = JSON.parse(m.references || "[]");
|
5726
|
+
} catch (e) {
|
5727
|
+
console.log("error parse references", e);
|
5728
|
+
}
|
5703
5729
|
result.messages.push({
|
5704
5730
|
channel_id: m.channel_id,
|
5705
5731
|
code: m.code ? Number(m.code) : 0,
|
@@ -5710,17 +5736,19 @@ var Client = class {
|
|
5710
5736
|
username: m.username,
|
5711
5737
|
display_name: m.display_name,
|
5712
5738
|
avatar: m.avatar,
|
5713
|
-
content
|
5739
|
+
content,
|
5714
5740
|
channel_label: m.channel_label,
|
5715
5741
|
clan_logo: m.clan_logo,
|
5716
5742
|
category_name: m.category_name,
|
5717
5743
|
clan_nick: m.clan_nick,
|
5718
5744
|
clan_avatar: m.clan_avatar,
|
5719
|
-
attachments
|
5720
|
-
mentions
|
5721
|
-
reactions
|
5722
|
-
references
|
5723
|
-
clan_id: m.clan_id
|
5745
|
+
attachments,
|
5746
|
+
mentions,
|
5747
|
+
reactions,
|
5748
|
+
references,
|
5749
|
+
clan_id: m.clan_id,
|
5750
|
+
create_time_ms: m.create_time_ms,
|
5751
|
+
update_time_ms: m.update_time_ms
|
5724
5752
|
});
|
5725
5753
|
});
|
5726
5754
|
return Promise.resolve(result);
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -5671,6 +5671,32 @@ var Client = class {
|
|
5671
5671
|
return Promise.resolve(result);
|
5672
5672
|
}
|
5673
5673
|
response.messages.forEach((m) => {
|
5674
|
+
var content, reactions, mentions, attachments, references;
|
5675
|
+
try {
|
5676
|
+
content = JSON.parse(m.content);
|
5677
|
+
} catch (e) {
|
5678
|
+
console.log("error parse content", e);
|
5679
|
+
}
|
5680
|
+
try {
|
5681
|
+
reactions = JSON.parse(m.reactions || "[]");
|
5682
|
+
} catch (e) {
|
5683
|
+
console.log("error parse reactions", e);
|
5684
|
+
}
|
5685
|
+
try {
|
5686
|
+
mentions = JSON.parse(m.mentions || "[]");
|
5687
|
+
} catch (e) {
|
5688
|
+
console.log("error parse mentions", e);
|
5689
|
+
}
|
5690
|
+
try {
|
5691
|
+
attachments = JSON.parse(m.attachments || "[]");
|
5692
|
+
} catch (e) {
|
5693
|
+
console.log("error parse attachments", e);
|
5694
|
+
}
|
5695
|
+
try {
|
5696
|
+
references = JSON.parse(m.references || "[]");
|
5697
|
+
} catch (e) {
|
5698
|
+
console.log("error parse references", e);
|
5699
|
+
}
|
5674
5700
|
result.messages.push({
|
5675
5701
|
channel_id: m.channel_id,
|
5676
5702
|
code: m.code ? Number(m.code) : 0,
|
@@ -5681,17 +5707,19 @@ var Client = class {
|
|
5681
5707
|
username: m.username,
|
5682
5708
|
display_name: m.display_name,
|
5683
5709
|
avatar: m.avatar,
|
5684
|
-
content
|
5710
|
+
content,
|
5685
5711
|
channel_label: m.channel_label,
|
5686
5712
|
clan_logo: m.clan_logo,
|
5687
5713
|
category_name: m.category_name,
|
5688
5714
|
clan_nick: m.clan_nick,
|
5689
5715
|
clan_avatar: m.clan_avatar,
|
5690
|
-
attachments
|
5691
|
-
mentions
|
5692
|
-
reactions
|
5693
|
-
references
|
5694
|
-
clan_id: m.clan_id
|
5716
|
+
attachments,
|
5717
|
+
mentions,
|
5718
|
+
reactions,
|
5719
|
+
references,
|
5720
|
+
clan_id: m.clan_id,
|
5721
|
+
create_time_ms: m.create_time_ms,
|
5722
|
+
update_time_ms: m.update_time_ms
|
5695
5723
|
});
|
5696
5724
|
});
|
5697
5725
|
return Promise.resolve(result);
|