mezon-js 2.8.3 → 2.8.6

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -6,11 +6,13 @@ import { encode } from 'js-base64';
6
6
 
7
7
  /** A single user-role pair. */
8
8
  export interface ChannelUserListChannelUser {
9
- //
10
- clan_nick?: string;
11
9
  //
12
10
  clan_avatar?: string;
13
11
  //
12
+ clan_id?: string;
13
+ //
14
+ clan_nick?: string;
15
+ //
14
16
  id?: string;
15
17
  //Their relationship to the role.
16
18
  role_id?: Array<string>;
@@ -22,6 +24,8 @@ export interface ChannelUserListChannelUser {
22
24
 
23
25
  /** A single user-role pair. */
24
26
  export interface ClanUserListClanUser {
27
+ //from the `avatar_url` field in the `clan_desc_profile` table.
28
+ clan_avatar?: string;
25
29
  //from the `nick_name` field in the `clan_desc_profile` table.
26
30
  clan_nick?: string;
27
31
  //Their relationship to the role.
@@ -469,6 +473,8 @@ export interface ApiChannelMessageHeader {
469
473
  export interface ApiChannelMessageList {
470
474
  //
471
475
  last_seen_message?: ApiChannelMessageHeader;
476
+ //
477
+ last_sent_message?: ApiChannelMessageHeader;
472
478
  //A list of messages.
473
479
  messages?: Array<ApiChannelMessage>;
474
480
  }
@@ -965,6 +971,8 @@ export interface ApiMessageReaction {
965
971
  //
966
972
  action?: boolean;
967
973
  //
974
+ emoji_id?: string;
975
+ //
968
976
  emoji?: string;
969
977
  //
970
978
  id?: string;
package/client.ts CHANGED
@@ -253,6 +253,8 @@ export interface ChannelMessageList {
253
253
  cacheable_cursor?: string;
254
254
  /**last seen message from user on channel */
255
255
  last_seen_message?: ApiChannelMessageHeader;
256
+ /**last sent message from channel */
257
+ last_sent_message?: ApiChannelMessageHeader;
256
258
  /** A list of messages. */
257
259
  messages?: Array<ChannelMessage>;
258
260
  /** The cursor to send when retireving the next page, if any. */
@@ -1049,7 +1051,8 @@ export class Client {
1049
1051
  return this.apiClient.listChannelMessages(session.token, channelId, messageId, direction, limit).then((response: ApiChannelMessageList) => {
1050
1052
  var result: ChannelMessageList = {
1051
1053
  messages: [],
1052
- last_seen_message: response.last_seen_message
1054
+ last_seen_message: response.last_seen_message,
1055
+ last_sent_message: response.last_sent_message
1053
1056
  };
1054
1057
 
1055
1058
  if (response.messages == null) {
package/dist/api.gen.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  /** A single user-role pair. */
2
2
  export interface ChannelUserListChannelUser {
3
- clan_nick?: string;
4
3
  clan_avatar?: string;
4
+ clan_id?: string;
5
+ clan_nick?: string;
5
6
  id?: string;
6
7
  role_id?: Array<string>;
7
8
  thread_id?: string;
@@ -9,6 +10,7 @@ export interface ChannelUserListChannelUser {
9
10
  }
10
11
  /** A single user-role pair. */
11
12
  export interface ClanUserListClanUser {
13
+ clan_avatar?: string;
12
14
  clan_nick?: string;
13
15
  role_id?: string;
14
16
  user?: ApiUser;
@@ -266,6 +268,7 @@ export interface ApiChannelMessageHeader {
266
268
  /** A list of channel messages, usually a result of a list operation. */
267
269
  export interface ApiChannelMessageList {
268
270
  last_seen_message?: ApiChannelMessageHeader;
271
+ last_sent_message?: ApiChannelMessageHeader;
269
272
  messages?: Array<ApiChannelMessage>;
270
273
  }
271
274
  /** A list of users belonging to a channel, along with their role. */
@@ -554,6 +557,7 @@ export interface ApiMessageMention {
554
557
  /** */
555
558
  export interface ApiMessageReaction {
556
559
  action?: boolean;
560
+ emoji_id?: string;
557
561
  emoji?: string;
558
562
  id?: string;
559
563
  sender_id?: string;
package/dist/client.d.ts CHANGED
@@ -122,6 +122,8 @@ export interface ChannelMessageList {
122
122
  cacheable_cursor?: string;
123
123
  /**last seen message from user on channel */
124
124
  last_seen_message?: ApiChannelMessageHeader;
125
+ /**last sent message from channel */
126
+ last_sent_message?: ApiChannelMessageHeader;
125
127
  /** A list of messages. */
126
128
  messages?: Array<ChannelMessage>;
127
129
  /** The cursor to send when retireving the next page, if any. */
@@ -4796,7 +4796,9 @@ var _DefaultSocket = class _DefaultSocket {
4796
4796
  this.oncustomstatus(message.custom_status_event);
4797
4797
  } else if (message.user_channel_added_event) {
4798
4798
  this.onuserchanneladded(message.user_channel_added_event);
4799
- } else if (message.user_channel_removed_event) {
4799
+ } else if (message.user_channel_added_event) {
4800
+ this.onuserprofileupdate(message.user_profile_updated_event);
4801
+ } else if (message.user_profile_updated_event) {
4800
4802
  this.onuserchannelremoved(message.user_channel_removed_event);
4801
4803
  } else if (message.user_clan_removed_event) {
4802
4804
  this.onuserclanremoved(message.user_clan_removed_event);
@@ -4887,6 +4889,11 @@ var _DefaultSocket = class _DefaultSocket {
4887
4889
  console.log(user);
4888
4890
  }
4889
4891
  }
4892
+ onuserprofileupdate(user) {
4893
+ if (this.verbose && window && window.console) {
4894
+ console.log(user);
4895
+ }
4896
+ }
4890
4897
  onuserchannelremoved(user) {
4891
4898
  if (this.verbose && window && window.console) {
4892
4899
  console.log(user);
@@ -5663,7 +5670,8 @@ var Client = class {
5663
5670
  return this.apiClient.listChannelMessages(session.token, channelId, messageId, direction, limit).then((response) => {
5664
5671
  var result = {
5665
5672
  messages: [],
5666
- last_seen_message: response.last_seen_message
5673
+ last_seen_message: response.last_seen_message,
5674
+ last_sent_message: response.last_sent_message
5667
5675
  };
5668
5676
  if (response.messages == null) {
5669
5677
  return Promise.resolve(result);
@@ -4767,7 +4767,9 @@ var _DefaultSocket = class _DefaultSocket {
4767
4767
  this.oncustomstatus(message.custom_status_event);
4768
4768
  } else if (message.user_channel_added_event) {
4769
4769
  this.onuserchanneladded(message.user_channel_added_event);
4770
- } else if (message.user_channel_removed_event) {
4770
+ } else if (message.user_channel_added_event) {
4771
+ this.onuserprofileupdate(message.user_profile_updated_event);
4772
+ } else if (message.user_profile_updated_event) {
4771
4773
  this.onuserchannelremoved(message.user_channel_removed_event);
4772
4774
  } else if (message.user_clan_removed_event) {
4773
4775
  this.onuserclanremoved(message.user_clan_removed_event);
@@ -4858,6 +4860,11 @@ var _DefaultSocket = class _DefaultSocket {
4858
4860
  console.log(user);
4859
4861
  }
4860
4862
  }
4863
+ onuserprofileupdate(user) {
4864
+ if (this.verbose && window && window.console) {
4865
+ console.log(user);
4866
+ }
4867
+ }
4861
4868
  onuserchannelremoved(user) {
4862
4869
  if (this.verbose && window && window.console) {
4863
4870
  console.log(user);
@@ -5634,7 +5641,8 @@ var Client = class {
5634
5641
  return this.apiClient.listChannelMessages(session.token, channelId, messageId, direction, limit).then((response) => {
5635
5642
  var result = {
5636
5643
  messages: [],
5637
- last_seen_message: response.last_seen_message
5644
+ last_seen_message: response.last_seen_message,
5645
+ last_sent_message: response.last_sent_message
5638
5646
  };
5639
5647
  if (response.messages == null) {
5640
5648
  return Promise.resolve(result);
package/dist/socket.d.ts CHANGED
@@ -184,6 +184,14 @@ export interface MessageTypingEvent {
184
184
  /** Message sender, usually a user ID. */
185
185
  sender_id: string;
186
186
  }
187
+ export interface UserProfileUpdatedEvent {
188
+ user_id: string;
189
+ display_name: string;
190
+ avatar: string;
191
+ about_me: string;
192
+ channel_id: string;
193
+ clan_id: string;
194
+ }
187
195
  /** An incoming message on a realtime chat channel. */
188
196
  export interface ChannelMessageEvent {
189
197
  avatar?: string;
@@ -351,6 +359,7 @@ export interface ClanProfileUpdatedEvent {
351
359
  user_id: string;
352
360
  clan_nick: string;
353
361
  clan_avatar: string;
362
+ clan_id: string;
354
363
  }
355
364
  /** Stream identifier */
356
365
  export interface StreamId {
@@ -497,6 +506,8 @@ export interface Socket {
497
506
  onpinmessage: (pin: LastPinMessageEvent) => void;
498
507
  /** Receive added user event */
499
508
  onuserchanneladded: (user: UserChannelAddedEvent) => void;
509
+ /** Receive update user event */
510
+ onuserprofileupdate: (user: UserProfileUpdatedEvent) => void;
500
511
  /** Receive channel removed user event */
501
512
  onuserchannelremoved: (user: UserChannelRemovedEvent) => void;
502
513
  /** Receive clan removed user event */
@@ -548,6 +559,7 @@ export declare class DefaultSocket implements Socket {
548
559
  onchannelmessage(channelMessage: ChannelMessageEvent): void;
549
560
  onchannelpresence(channelPresence: ChannelPresenceEvent): void;
550
561
  onuserchanneladded(user: UserChannelAddedEvent): void;
562
+ onuserprofileupdate(user: UserProfileUpdatedEvent): void;
551
563
  onuserchannelremoved(user: UserChannelRemovedEvent): void;
552
564
  onuserclanremoved(user: UserClanRemovedEvent): void;
553
565
  onnotification(notification: Notification): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.8.3",
3
+ "version": "2.8.6",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },
package/socket.ts CHANGED
@@ -251,6 +251,22 @@ export interface MessageTypingEvent {
251
251
  sender_id: string;
252
252
  }
253
253
 
254
+ // user profile updated event
255
+ export interface UserProfileUpdatedEvent{
256
+ // the user id
257
+ user_id: string;
258
+ // the display_name
259
+ display_name: string;
260
+ // the avatar
261
+ avatar: string;
262
+ // the about_me
263
+ about_me: string;
264
+ // the channel_id
265
+ channel_id: string;
266
+ // the clan_id
267
+ clan_id: string;
268
+ }
269
+
254
270
  /** An incoming message on a realtime chat channel. */
255
271
  export interface ChannelMessageEvent {
256
272
  avatar?: string;
@@ -517,6 +533,8 @@ export interface ClanProfileUpdatedEvent {
517
533
  clan_nick: string;
518
534
  // the avatar
519
535
  clan_avatar: string;
536
+ // the clan_id
537
+ clan_id: string;
520
538
  }
521
539
 
522
540
  /** Stream identifier */
@@ -703,6 +721,9 @@ export interface Socket {
703
721
  /** Receive added user event */
704
722
  onuserchanneladded: (user: UserChannelAddedEvent) => void;
705
723
 
724
+ /** Receive update user event */
725
+ onuserprofileupdate: (user: UserProfileUpdatedEvent) => void;
726
+
706
727
  /** Receive channel removed user event */
707
728
  onuserchannelremoved: (user: UserChannelRemovedEvent) => void;
708
729
 
@@ -883,7 +904,9 @@ export class DefaultSocket implements Socket {
883
904
  this.oncustomstatus(<CustomStatusEvent>message.custom_status_event);
884
905
  } else if (message.user_channel_added_event) {
885
906
  this.onuserchanneladded(<UserChannelAddedEvent>message.user_channel_added_event);
886
- } else if (message.user_channel_removed_event) {
907
+ } else if (message.user_channel_added_event) {
908
+ this.onuserprofileupdate(<UserProfileUpdatedEvent>message.user_profile_updated_event);
909
+ } else if (message.user_profile_updated_event) {
887
910
  this.onuserchannelremoved(<UserChannelRemovedEvent>message.user_channel_removed_event);
888
911
  } else if (message.user_clan_removed_event) {
889
912
  this.onuserclanremoved(<UserClanRemovedEvent>message.user_clan_removed_event);
@@ -989,7 +1012,11 @@ export class DefaultSocket implements Socket {
989
1012
  console.log(user);
990
1013
  }
991
1014
  }
992
-
1015
+ onuserprofileupdate(user: UserProfileUpdatedEvent) {
1016
+ if (this.verbose && window && window.console) {
1017
+ console.log(user);
1018
+ }
1019
+ }
993
1020
  onuserchannelremoved(user: UserChannelRemovedEvent) {
994
1021
  if (this.verbose && window && window.console) {
995
1022
  console.log(user);