mezon-js 2.14.52 → 2.14.54

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
@@ -946,25 +946,15 @@ export interface ApiChannelDescription {
946
946
  }
947
947
 
948
948
  /** */
949
- export interface ApiChannelMessageHeader {
950
- //
951
- attachment?: Uint8Array;
952
- //
953
- content?: string;
949
+ export interface ApiChannelMessageHeader {
954
950
  //
955
951
  id?: string;
956
952
  //
957
- mention?: Uint8Array;
958
- //
959
- reaction?: Uint8Array;
960
- //
961
- reference?: Uint8Array;
962
- //
963
- repliers?: Array<string>;
964
- //
965
953
  sender_id?: string;
966
954
  //
967
955
  timestamp_seconds?: number;
956
+ //
957
+ content?: string;
968
958
  }
969
959
 
970
960
  /** A list of channel messages, usually a result of a list operation. */
package/client.ts CHANGED
@@ -1196,25 +1196,41 @@ export class Client {
1196
1196
  console.log("error parse content", e);
1197
1197
  }
1198
1198
  try {
1199
- reactions = decodeReactions(m.reactions || '');
1199
+ const decodedReactions = decodeReactions(m.reactions);
1200
+ reactions =
1201
+ decodedReactions?.reactions || decodedReactions ||
1202
+ safeJSONParse(m.reactions || "[]");
1200
1203
  } catch (e) {
1201
- console.log("error parse reactions", e);
1204
+ reactions = safeJSONParse(m.reactions || "[]");
1202
1205
  }
1206
+
1203
1207
  try {
1204
- mentions = decodeMentions(m.mentions || '');
1208
+ const decodedMentions = decodeMentions(m.mentions);
1209
+ mentions =
1210
+ decodedMentions?.mentions || decodedMentions ||
1211
+ safeJSONParse(m.mentions || "[]");
1205
1212
  } catch (e) {
1206
- console.log("error parse mentions", e);
1213
+ mentions = safeJSONParse(m.mentions || "[]");
1207
1214
  }
1215
+
1208
1216
  try {
1209
- attachments = decodeAttachments(m.attachments || '');
1217
+ const decodedAttachments = decodeAttachments(m.attachments);
1218
+ attachments =
1219
+ decodedAttachments?.attachments || decodedAttachments ||
1220
+ safeJSONParse(m.attachments || "[]");
1210
1221
  } catch (e) {
1211
- console.log("error parse attachments", e);
1222
+ attachments = safeJSONParse(m.attachments || "[]");
1212
1223
  }
1224
+
1213
1225
  try {
1214
- references = decodeRefs(m.references || '');
1226
+ const decodedReferences = decodeRefs(m.references);
1227
+ references =
1228
+ decodedReferences?.refs || decodedReferences ||
1229
+ safeJSONParse(m.references || "[]");
1215
1230
  } catch (e) {
1216
- console.log("error parse references", e);
1231
+ references = safeJSONParse(m.references || "[]");
1217
1232
  }
1233
+
1218
1234
  result.messages!.push({
1219
1235
  channel_id: m.channel_id,
1220
1236
  code: m.code ? Number(m.code) : 0,
@@ -1229,10 +1245,10 @@ export class Client {
1229
1245
  category_name: m.category_name,
1230
1246
  clan_nick: m.clan_nick,
1231
1247
  clan_avatar: m.clan_avatar,
1232
- attachments: attachments?.attachments,
1233
- mentions: mentions?.mentions,
1234
- reactions: reactions?.reactions,
1235
- references: references?.refs,
1248
+ attachments: attachments,
1249
+ mentions: mentions,
1250
+ reactions: reactions,
1251
+ references: references,
1236
1252
  clan_id: m.clan_id,
1237
1253
  create_time_seconds: m.create_time_seconds,
1238
1254
  update_time_seconds: m.update_time_seconds,
package/dist/api.gen.d.ts CHANGED
@@ -544,15 +544,10 @@ export interface ApiChannelDescription {
544
544
  }
545
545
  /** */
546
546
  export interface ApiChannelMessageHeader {
547
- attachment?: Uint8Array;
548
- content?: string;
549
547
  id?: string;
550
- mention?: Uint8Array;
551
- reaction?: Uint8Array;
552
- reference?: Uint8Array;
553
- repliers?: Array<string>;
554
548
  sender_id?: string;
555
549
  timestamp_seconds?: number;
550
+ content?: string;
556
551
  }
557
552
  /** A list of channel messages, usually a result of a list operation. */
558
553
  export interface ApiChannelMessageList {
@@ -40372,7 +40372,7 @@ var _DefaultSocket = class _DefaultSocket {
40372
40372
  unfollowUsers(user_ids) {
40373
40373
  return this.send({ status_unfollow: { user_ids } });
40374
40374
  }
40375
- updateChatMessage(clan_id, channel_id, mode, is_public, message_id, content, mentions, attachments, hideEditted, topic_id, is_update_msg_topic, old_mentions) {
40375
+ updateChatMessage(clan_id, channel_id, mode, is_public, message_id, content, mentions, attachments, hideEditted, topic_id, is_update_msg_topic) {
40376
40376
  return __async(this, null, function* () {
40377
40377
  const response = yield this.send({
40378
40378
  channel_message_update: {
@@ -40386,8 +40386,7 @@ var _DefaultSocket = class _DefaultSocket {
40386
40386
  is_public,
40387
40387
  hide_editted: hideEditted,
40388
40388
  topic_id,
40389
- is_update_msg_topic,
40390
- old_mentions
40389
+ is_update_msg_topic
40391
40390
  }
40392
40391
  });
40393
40392
  return response.channel_message_ack;
@@ -41244,24 +41243,28 @@ var Client = class {
41244
41243
  console.log("error parse content", e);
41245
41244
  }
41246
41245
  try {
41247
- reactions = decodeReactions(m.reactions || "");
41246
+ const decodedReactions = decodeReactions(m.reactions);
41247
+ reactions = (decodedReactions == null ? void 0 : decodedReactions.reactions) || decodedReactions || safeJSONParse(m.reactions || "[]");
41248
41248
  } catch (e) {
41249
- console.log("error parse reactions", e);
41249
+ reactions = safeJSONParse(m.reactions || "[]");
41250
41250
  }
41251
41251
  try {
41252
- mentions = decodeMentions(m.mentions || "");
41252
+ const decodedMentions = decodeMentions(m.mentions);
41253
+ mentions = (decodedMentions == null ? void 0 : decodedMentions.mentions) || decodedMentions || safeJSONParse(m.mentions || "[]");
41253
41254
  } catch (e) {
41254
- console.log("error parse mentions", e);
41255
+ mentions = safeJSONParse(m.mentions || "[]");
41255
41256
  }
41256
41257
  try {
41257
- attachments = decodeAttachments(m.attachments || "");
41258
+ const decodedAttachments = decodeAttachments(m.attachments);
41259
+ attachments = (decodedAttachments == null ? void 0 : decodedAttachments.attachments) || decodedAttachments || safeJSONParse(m.attachments || "[]");
41258
41260
  } catch (e) {
41259
- console.log("error parse attachments", e);
41261
+ attachments = safeJSONParse(m.attachments || "[]");
41260
41262
  }
41261
41263
  try {
41262
- references = decodeRefs(m.references || "");
41264
+ const decodedReferences = decodeRefs(m.references);
41265
+ references = (decodedReferences == null ? void 0 : decodedReferences.refs) || decodedReferences || safeJSONParse(m.references || "[]");
41263
41266
  } catch (e) {
41264
- console.log("error parse references", e);
41267
+ references = safeJSONParse(m.references || "[]");
41265
41268
  }
41266
41269
  result.messages.push({
41267
41270
  channel_id: m.channel_id,
@@ -41277,10 +41280,10 @@ var Client = class {
41277
41280
  category_name: m.category_name,
41278
41281
  clan_nick: m.clan_nick,
41279
41282
  clan_avatar: m.clan_avatar,
41280
- attachments: attachments == null ? void 0 : attachments.attachments,
41281
- mentions: mentions == null ? void 0 : mentions.mentions,
41282
- reactions: reactions == null ? void 0 : reactions.reactions,
41283
- references: references == null ? void 0 : references.refs,
41283
+ attachments,
41284
+ mentions,
41285
+ reactions,
41286
+ references,
41284
41287
  clan_id: m.clan_id,
41285
41288
  create_time_seconds: m.create_time_seconds,
41286
41289
  update_time_seconds: m.update_time_seconds,
@@ -40337,7 +40337,7 @@ var _DefaultSocket = class _DefaultSocket {
40337
40337
  unfollowUsers(user_ids) {
40338
40338
  return this.send({ status_unfollow: { user_ids } });
40339
40339
  }
40340
- updateChatMessage(clan_id, channel_id, mode, is_public, message_id, content, mentions, attachments, hideEditted, topic_id, is_update_msg_topic, old_mentions) {
40340
+ updateChatMessage(clan_id, channel_id, mode, is_public, message_id, content, mentions, attachments, hideEditted, topic_id, is_update_msg_topic) {
40341
40341
  return __async(this, null, function* () {
40342
40342
  const response = yield this.send({
40343
40343
  channel_message_update: {
@@ -40351,8 +40351,7 @@ var _DefaultSocket = class _DefaultSocket {
40351
40351
  is_public,
40352
40352
  hide_editted: hideEditted,
40353
40353
  topic_id,
40354
- is_update_msg_topic,
40355
- old_mentions
40354
+ is_update_msg_topic
40356
40355
  }
40357
40356
  });
40358
40357
  return response.channel_message_ack;
@@ -41209,24 +41208,28 @@ var Client = class {
41209
41208
  console.log("error parse content", e);
41210
41209
  }
41211
41210
  try {
41212
- reactions = decodeReactions(m.reactions || "");
41211
+ const decodedReactions = decodeReactions(m.reactions);
41212
+ reactions = (decodedReactions == null ? void 0 : decodedReactions.reactions) || decodedReactions || safeJSONParse(m.reactions || "[]");
41213
41213
  } catch (e) {
41214
- console.log("error parse reactions", e);
41214
+ reactions = safeJSONParse(m.reactions || "[]");
41215
41215
  }
41216
41216
  try {
41217
- mentions = decodeMentions(m.mentions || "");
41217
+ const decodedMentions = decodeMentions(m.mentions);
41218
+ mentions = (decodedMentions == null ? void 0 : decodedMentions.mentions) || decodedMentions || safeJSONParse(m.mentions || "[]");
41218
41219
  } catch (e) {
41219
- console.log("error parse mentions", e);
41220
+ mentions = safeJSONParse(m.mentions || "[]");
41220
41221
  }
41221
41222
  try {
41222
- attachments = decodeAttachments(m.attachments || "");
41223
+ const decodedAttachments = decodeAttachments(m.attachments);
41224
+ attachments = (decodedAttachments == null ? void 0 : decodedAttachments.attachments) || decodedAttachments || safeJSONParse(m.attachments || "[]");
41223
41225
  } catch (e) {
41224
- console.log("error parse attachments", e);
41226
+ attachments = safeJSONParse(m.attachments || "[]");
41225
41227
  }
41226
41228
  try {
41227
- references = decodeRefs(m.references || "");
41229
+ const decodedReferences = decodeRefs(m.references);
41230
+ references = (decodedReferences == null ? void 0 : decodedReferences.refs) || decodedReferences || safeJSONParse(m.references || "[]");
41228
41231
  } catch (e) {
41229
- console.log("error parse references", e);
41232
+ references = safeJSONParse(m.references || "[]");
41230
41233
  }
41231
41234
  result.messages.push({
41232
41235
  channel_id: m.channel_id,
@@ -41242,10 +41245,10 @@ var Client = class {
41242
41245
  category_name: m.category_name,
41243
41246
  clan_nick: m.clan_nick,
41244
41247
  clan_avatar: m.clan_avatar,
41245
- attachments: attachments == null ? void 0 : attachments.attachments,
41246
- mentions: mentions == null ? void 0 : mentions.mentions,
41247
- reactions: reactions == null ? void 0 : reactions.reactions,
41248
- references: references == null ? void 0 : references.refs,
41248
+ attachments,
41249
+ mentions,
41250
+ reactions,
41251
+ references,
41249
41252
  clan_id: m.clan_id,
41250
41253
  create_time_seconds: m.create_time_seconds,
41251
41254
  update_time_seconds: m.update_time_seconds,
package/dist/socket.d.ts CHANGED
@@ -943,7 +943,7 @@ export interface Socket {
943
943
  /** Unfollow one or more users from their status updates. */
944
944
  unfollowUsers(user_ids: string[]): Promise<void>;
945
945
  /** Update a chat message on a chat channel in the server. */
946
- updateChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, hideEditted?: boolean, topic_id?: string, is_update_msg_topic?: boolean, old_mentions?: Uint8Array): Promise<ChannelMessageAck>;
946
+ updateChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, hideEditted?: boolean, topic_id?: string, is_update_msg_topic?: boolean): Promise<ChannelMessageAck>;
947
947
  /** Update the status for the current user online. */
948
948
  updateStatus(status?: string): Promise<void>;
949
949
  /** Send a chat message to a chat channel on the server. */
@@ -1185,7 +1185,7 @@ export declare class DefaultSocket implements Socket {
1185
1185
  removeChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, has_attachment?: boolean, topic_id?: string, mentions?: string, references?: string): Promise<ChannelMessageAck>;
1186
1186
  rpc(id?: string, payload?: string, http_key?: string): Promise<ApiRpc>;
1187
1187
  unfollowUsers(user_ids: string[]): Promise<void>;
1188
- updateChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, hideEditted?: boolean, topic_id?: string, is_update_msg_topic?: boolean, old_mentions?: Uint8Array): Promise<ChannelMessageAck>;
1188
+ updateChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, hideEditted?: boolean, topic_id?: string, is_update_msg_topic?: boolean): Promise<ChannelMessageAck>;
1189
1189
  updateStatus(status?: string): Promise<void>;
1190
1190
  writeQuickMenuEvent(menu_name: string, clan_id: string, channel_id: string, mode: number, is_public: boolean, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: Boolean, avatar?: string, code?: number, topic_id?: string): Promise<QuickMenuEvent>;
1191
1191
  writeEphemeralMessage(receiver_id: string, clan_id: string, channel_id: string, mode: number, is_public: boolean, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: Boolean, avatar?: string, code?: number, topic_id?: string, id?: string): Promise<ChannelMessageAck>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.14.52",
3
+ "version": "2.14.54",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },
package/socket.ts CHANGED
@@ -1474,8 +1474,7 @@ export interface Socket {
1474
1474
  attachments?: Array<ApiMessageAttachment>,
1475
1475
  hideEditted?: boolean,
1476
1476
  topic_id?: string,
1477
- is_update_msg_topic?: boolean,
1478
- old_mentions?: Uint8Array
1477
+ is_update_msg_topic?: boolean
1479
1478
  ): Promise<ChannelMessageAck>;
1480
1479
 
1481
1480
  /** Update the status for the current user online. */
@@ -2839,8 +2838,7 @@ export class DefaultSocket implements Socket {
2839
2838
  attachments?: Array<ApiMessageAttachment>,
2840
2839
  hideEditted?: boolean,
2841
2840
  topic_id?: string,
2842
- is_update_msg_topic?: boolean,
2843
- old_mentions?: Uint8Array
2841
+ is_update_msg_topic?: boolean
2844
2842
  ): Promise<ChannelMessageAck> {
2845
2843
  const response = await this.send({
2846
2844
  channel_message_update: {
@@ -2854,8 +2852,7 @@ export class DefaultSocket implements Socket {
2854
2852
  is_public: is_public,
2855
2853
  hide_editted: hideEditted,
2856
2854
  topic_id: topic_id,
2857
- is_update_msg_topic: is_update_msg_topic,
2858
- old_mentions: old_mentions
2855
+ is_update_msg_topic: is_update_msg_topic
2859
2856
  },
2860
2857
  });
2861
2858
  return response.channel_message_ack;