mezon-js 2.8.14 → 2.8.17

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -26,6 +26,8 @@ export interface ChannelUserListChannelUser {
26
26
  export interface ClanUserListClanUser {
27
27
  //from the `avatar_url` field in the `clan_desc_profile` table.
28
28
  clan_avatar?: string;
29
+ //
30
+ clan_id?: string;
29
31
  //from the `nick_name` field in the `clan_desc_profile` table.
30
32
  clan_nick?: string;
31
33
  //Their relationship to the role.
@@ -377,6 +379,8 @@ export interface ApiChannelDescription {
377
379
  clan_id?: string;
378
380
  //
379
381
  count_mess_unread?: number;
382
+ //
383
+ create_time_ms?: number;
380
384
  //creator ID.
381
385
  creator_id?: string;
382
386
  //
@@ -398,6 +402,8 @@ export interface ApiChannelDescription {
398
402
  //The channel type.
399
403
  type?: number;
400
404
  //
405
+ update_time_ms?: number;
406
+ //
401
407
  user_id?: Array<string>;
402
408
  //
403
409
  usernames?: string;
@@ -430,6 +436,8 @@ export interface ApiChannelMessage {
430
436
  //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the message was created.
431
437
  create_time?: string;
432
438
  //
439
+ create_time_ms?: number;
440
+ //
433
441
  display_name?: string;
434
442
  //
435
443
  mentions?: string;
@@ -445,6 +453,8 @@ export interface ApiChannelMessage {
445
453
  sender_id: string;
446
454
  //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the message was last updated.
447
455
  update_time?: string;
456
+ //
457
+ update_time_ms?: number;
448
458
  //The username of the message sender, if any.
449
459
  username?: string;
450
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,16 +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) : [],
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,
1083
1114
  })
1084
1115
  });
1085
1116
  return Promise.resolve(result);
@@ -1158,6 +1189,7 @@ export class Client {
1158
1189
  clan_avatar: gu.clan_avatar,
1159
1190
  clan_nick: gu.clan_nick,
1160
1191
  id: gu.id,
1192
+ clan_id: gu.clan_id
1161
1193
  })
1162
1194
  });
1163
1195
  return Promise.resolve(result);
package/dist/api.gen.d.ts CHANGED
@@ -11,6 +11,7 @@ export interface ChannelUserListChannelUser {
11
11
  /** A single user-role pair. */
12
12
  export interface ClanUserListClanUser {
13
13
  clan_avatar?: string;
14
+ clan_id?: string;
14
15
  clan_nick?: string;
15
16
  role_id?: string;
16
17
  user?: ApiUser;
@@ -217,6 +218,7 @@ export interface ApiChannelDescription {
217
218
  channel_private?: number;
218
219
  clan_id?: string;
219
220
  count_mess_unread?: number;
221
+ create_time_ms?: number;
220
222
  creator_id?: string;
221
223
  creator_name?: string;
222
224
  last_pin_message?: string;
@@ -227,6 +229,7 @@ export interface ApiChannelDescription {
227
229
  parrent_id?: string;
228
230
  status?: number;
229
231
  type?: number;
232
+ update_time_ms?: number;
230
233
  user_id?: Array<string>;
231
234
  usernames?: string;
232
235
  }
@@ -244,6 +247,7 @@ export interface ApiChannelMessage {
244
247
  code: number;
245
248
  content: string;
246
249
  create_time?: string;
250
+ create_time_ms?: number;
247
251
  display_name?: string;
248
252
  mentions?: string;
249
253
  message_id: string;
@@ -252,6 +256,7 @@ export interface ApiChannelMessage {
252
256
  references?: string;
253
257
  sender_id: string;
254
258
  update_time?: string;
259
+ update_time_ms?: number;
255
260
  username?: string;
256
261
  }
257
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,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,16 +5736,19 @@ var Client = class {
5710
5736
  username: m.username,
5711
5737
  display_name: m.display_name,
5712
5738
  avatar: m.avatar,
5713
- content: m.content ? JSON.parse(m.content) : void 0,
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: 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) : []
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
5723
5752
  });
5724
5753
  });
5725
5754
  return Promise.resolve(result);
@@ -5792,7 +5821,8 @@ var Client = class {
5792
5821
  thread_id: gu.thread_id,
5793
5822
  clan_avatar: gu.clan_avatar,
5794
5823
  clan_nick: gu.clan_nick,
5795
- id: gu.id
5824
+ id: gu.id,
5825
+ clan_id: gu.clan_id
5796
5826
  });
5797
5827
  });
5798
5828
  return Promise.resolve(result);
@@ -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,16 +5707,19 @@ var Client = class {
5681
5707
  username: m.username,
5682
5708
  display_name: m.display_name,
5683
5709
  avatar: m.avatar,
5684
- content: m.content ? JSON.parse(m.content) : void 0,
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: 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) : []
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
5694
5723
  });
5695
5724
  });
5696
5725
  return Promise.resolve(result);
@@ -5763,7 +5792,8 @@ var Client = class {
5763
5792
  thread_id: gu.thread_id,
5764
5793
  clan_avatar: gu.clan_avatar,
5765
5794
  clan_nick: gu.clan_nick,
5766
- id: gu.id
5795
+ id: gu.id,
5796
+ clan_id: gu.clan_id
5767
5797
  });
5768
5798
  });
5769
5799
  return Promise.resolve(result);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.8.14",
3
+ "version": "2.8.17",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },