mezon-js 2.8.15 → 2.8.18

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 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
- response.messages!.forEach(m => {
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: m.content ? JSON.parse(m.content) : undefined,
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: m.attachments ? JSON.parse(m.attachments) : [],
1080
- mentions: m.mentions ? JSON.parse(m.mentions) : [],
1081
- reactions: m.reactions ? JSON.parse(m.reactions) : [],
1082
- references: m.references ? JSON.parse(m.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 {
@@ -5700,6 +5700,27 @@ 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
+ }
5708
+ try {
5709
+ reactions = JSON.parse(m.reactions || "[]");
5710
+ } catch (e) {
5711
+ }
5712
+ try {
5713
+ mentions = JSON.parse(m.mentions || "[]");
5714
+ } catch (e) {
5715
+ }
5716
+ try {
5717
+ attachments = JSON.parse(m.attachments || "[]");
5718
+ } catch (e) {
5719
+ }
5720
+ try {
5721
+ references = JSON.parse(m.references || "[]");
5722
+ } catch (e) {
5723
+ }
5703
5724
  result.messages.push({
5704
5725
  channel_id: m.channel_id,
5705
5726
  code: m.code ? Number(m.code) : 0,
@@ -5710,17 +5731,19 @@ var Client = class {
5710
5731
  username: m.username,
5711
5732
  display_name: m.display_name,
5712
5733
  avatar: m.avatar,
5713
- content: m.content ? JSON.parse(m.content) : void 0,
5734
+ content,
5714
5735
  channel_label: m.channel_label,
5715
5736
  clan_logo: m.clan_logo,
5716
5737
  category_name: m.category_name,
5717
5738
  clan_nick: m.clan_nick,
5718
5739
  clan_avatar: m.clan_avatar,
5719
- attachments: m.attachments ? JSON.parse(m.attachments) : [],
5720
- mentions: m.mentions ? JSON.parse(m.mentions) : [],
5721
- reactions: m.reactions ? JSON.parse(m.reactions) : [],
5722
- references: m.references ? JSON.parse(m.references) : [],
5723
- clan_id: m.clan_id
5740
+ attachments,
5741
+ mentions,
5742
+ reactions,
5743
+ references,
5744
+ clan_id: m.clan_id,
5745
+ create_time_ms: m.create_time_ms,
5746
+ update_time_ms: m.update_time_ms
5724
5747
  });
5725
5748
  });
5726
5749
  return Promise.resolve(result);
@@ -5671,6 +5671,27 @@ 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
+ }
5679
+ try {
5680
+ reactions = JSON.parse(m.reactions || "[]");
5681
+ } catch (e) {
5682
+ }
5683
+ try {
5684
+ mentions = JSON.parse(m.mentions || "[]");
5685
+ } catch (e) {
5686
+ }
5687
+ try {
5688
+ attachments = JSON.parse(m.attachments || "[]");
5689
+ } catch (e) {
5690
+ }
5691
+ try {
5692
+ references = JSON.parse(m.references || "[]");
5693
+ } catch (e) {
5694
+ }
5674
5695
  result.messages.push({
5675
5696
  channel_id: m.channel_id,
5676
5697
  code: m.code ? Number(m.code) : 0,
@@ -5681,17 +5702,19 @@ var Client = class {
5681
5702
  username: m.username,
5682
5703
  display_name: m.display_name,
5683
5704
  avatar: m.avatar,
5684
- content: m.content ? JSON.parse(m.content) : void 0,
5705
+ content,
5685
5706
  channel_label: m.channel_label,
5686
5707
  clan_logo: m.clan_logo,
5687
5708
  category_name: m.category_name,
5688
5709
  clan_nick: m.clan_nick,
5689
5710
  clan_avatar: m.clan_avatar,
5690
- attachments: m.attachments ? JSON.parse(m.attachments) : [],
5691
- mentions: m.mentions ? JSON.parse(m.mentions) : [],
5692
- reactions: m.reactions ? JSON.parse(m.reactions) : [],
5693
- references: m.references ? JSON.parse(m.references) : [],
5694
- clan_id: m.clan_id
5711
+ attachments,
5712
+ mentions,
5713
+ reactions,
5714
+ references,
5715
+ clan_id: m.clan_id,
5716
+ create_time_ms: m.create_time_ms,
5717
+ update_time_ms: m.update_time_ms
5695
5718
  });
5696
5719
  });
5697
5720
  return Promise.resolve(result);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.8.15",
3
+ "version": "2.8.18",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },