mezon-js 2.8.96 → 2.8.98
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/dist/mezon-js.cjs.js +35 -0
- package/dist/mezon-js.esm.mjs +35 -0
- package/dist/socket.d.ts +71 -10
- package/package.json +1 -1
- package/socket.ts +117 -11
package/dist/mezon-js.cjs.js
CHANGED
@@ -5091,6 +5091,16 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5091
5091
|
this.oneventcreated(message.clan_event_created);
|
5092
5092
|
} else if (message.give_coffee_event) {
|
5093
5093
|
this.oncoffeegiven(message.give_coffee_event);
|
5094
|
+
} else if (message.role_assign_event) {
|
5095
|
+
this.onroleassign(message.role_assign_event);
|
5096
|
+
} else if (message.streaming_started_event) {
|
5097
|
+
this.onstreamingchannelstarted(message.streaming_started_event);
|
5098
|
+
} else if (message.streaming_ended_event) {
|
5099
|
+
this.onstreamingchannelended(message.streaming_ended_event);
|
5100
|
+
} else if (message.streaming_joined_event) {
|
5101
|
+
this.onstreamingchanneljoined(message.streaming_joined_event);
|
5102
|
+
} else if (message.streaming_leaved_event) {
|
5103
|
+
this.onstreamingchannelleaved(message.streaming_leaved_event);
|
5094
5104
|
} else {
|
5095
5105
|
if (this.verbose && window && window.console) {
|
5096
5106
|
console.log("Unrecognized message received: %o", message);
|
@@ -5318,6 +5328,31 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5318
5328
|
console.log(give_coffee_event);
|
5319
5329
|
}
|
5320
5330
|
}
|
5331
|
+
onroleassign(role_assign_event) {
|
5332
|
+
if (this.verbose && window && window.console) {
|
5333
|
+
console.log(role_assign_event);
|
5334
|
+
}
|
5335
|
+
}
|
5336
|
+
onstreamingchannelstarted(streaming_started_event) {
|
5337
|
+
if (this.verbose && window && window.console) {
|
5338
|
+
console.log(streaming_started_event);
|
5339
|
+
}
|
5340
|
+
}
|
5341
|
+
onstreamingchannelended(streaming_ended_event) {
|
5342
|
+
if (this.verbose && window && window.console) {
|
5343
|
+
console.log(streaming_ended_event);
|
5344
|
+
}
|
5345
|
+
}
|
5346
|
+
onstreamingchanneljoined(streaming_joined_event) {
|
5347
|
+
if (this.verbose && window && window.console) {
|
5348
|
+
console.log(streaming_joined_event);
|
5349
|
+
}
|
5350
|
+
}
|
5351
|
+
onstreamingchannelleaved(streaming_leaved_event) {
|
5352
|
+
if (this.verbose && window && window.console) {
|
5353
|
+
console.log(streaming_leaved_event);
|
5354
|
+
}
|
5355
|
+
}
|
5321
5356
|
send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
|
5322
5357
|
const untypedMessage = message;
|
5323
5358
|
return new Promise((resolve, reject) => {
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -5062,6 +5062,16 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5062
5062
|
this.oneventcreated(message.clan_event_created);
|
5063
5063
|
} else if (message.give_coffee_event) {
|
5064
5064
|
this.oncoffeegiven(message.give_coffee_event);
|
5065
|
+
} else if (message.role_assign_event) {
|
5066
|
+
this.onroleassign(message.role_assign_event);
|
5067
|
+
} else if (message.streaming_started_event) {
|
5068
|
+
this.onstreamingchannelstarted(message.streaming_started_event);
|
5069
|
+
} else if (message.streaming_ended_event) {
|
5070
|
+
this.onstreamingchannelended(message.streaming_ended_event);
|
5071
|
+
} else if (message.streaming_joined_event) {
|
5072
|
+
this.onstreamingchanneljoined(message.streaming_joined_event);
|
5073
|
+
} else if (message.streaming_leaved_event) {
|
5074
|
+
this.onstreamingchannelleaved(message.streaming_leaved_event);
|
5065
5075
|
} else {
|
5066
5076
|
if (this.verbose && window && window.console) {
|
5067
5077
|
console.log("Unrecognized message received: %o", message);
|
@@ -5289,6 +5299,31 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5289
5299
|
console.log(give_coffee_event);
|
5290
5300
|
}
|
5291
5301
|
}
|
5302
|
+
onroleassign(role_assign_event) {
|
5303
|
+
if (this.verbose && window && window.console) {
|
5304
|
+
console.log(role_assign_event);
|
5305
|
+
}
|
5306
|
+
}
|
5307
|
+
onstreamingchannelstarted(streaming_started_event) {
|
5308
|
+
if (this.verbose && window && window.console) {
|
5309
|
+
console.log(streaming_started_event);
|
5310
|
+
}
|
5311
|
+
}
|
5312
|
+
onstreamingchannelended(streaming_ended_event) {
|
5313
|
+
if (this.verbose && window && window.console) {
|
5314
|
+
console.log(streaming_ended_event);
|
5315
|
+
}
|
5316
|
+
}
|
5317
|
+
onstreamingchanneljoined(streaming_joined_event) {
|
5318
|
+
if (this.verbose && window && window.console) {
|
5319
|
+
console.log(streaming_joined_event);
|
5320
|
+
}
|
5321
|
+
}
|
5322
|
+
onstreamingchannelleaved(streaming_leaved_event) {
|
5323
|
+
if (this.verbose && window && window.console) {
|
5324
|
+
console.log(streaming_leaved_event);
|
5325
|
+
}
|
5326
|
+
}
|
5292
5327
|
send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
|
5293
5328
|
const untypedMessage = message;
|
5294
5329
|
return new Promise((resolve, reject) => {
|
package/dist/socket.d.ts
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
* See the License for the specific language governing permissions and
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
|
-
import { ApiChannelMessageHeader, ApiCreateEventRequest, ApiGiveCoffeeEvent, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiPermissionList, ApiRoleList, ApiRpc, ApiUser } from "./api.gen";
|
16
|
+
import { ApiChannelMessageHeader, ApiCreateEventRequest, ApiGiveCoffeeEvent, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiPermissionList, ApiRole, ApiRoleList, ApiRpc, ApiUser } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { ChannelMessage, Notification } from "./client";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -458,15 +458,9 @@ export interface RoleListEvent {
|
|
458
458
|
roles: ApiRoleList;
|
459
459
|
}
|
460
460
|
export interface RoleEvent {
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
user_ids_assigned: Array<string>;
|
465
|
-
permission_ids_assigned: Array<string>;
|
466
|
-
user_ids_removed: Array<string>;
|
467
|
-
permission_ids_removed: Array<string>;
|
468
|
-
role_title: string;
|
469
|
-
status: string;
|
461
|
+
role: ApiRole;
|
462
|
+
status: number;
|
463
|
+
user_id: string;
|
470
464
|
}
|
471
465
|
export interface EventEmoji {
|
472
466
|
id: string;
|
@@ -583,6 +577,63 @@ export interface GetUserEmojiUsageEvent {
|
|
583
577
|
clanId: string;
|
584
578
|
user_emoji_usage: Array<UserEmojiUsage>;
|
585
579
|
}
|
580
|
+
/** On role assign */
|
581
|
+
export interface RoleAssignedEvent {
|
582
|
+
/** The clan of this role */
|
583
|
+
ClanId: string;
|
584
|
+
/** Role ID */
|
585
|
+
role_id: string;
|
586
|
+
/** UserIds Assigned */
|
587
|
+
user_ids_assigned: string[];
|
588
|
+
/** UserIds Removed */
|
589
|
+
user_ids_removed: string[];
|
590
|
+
}
|
591
|
+
/** Streaming Joined event */
|
592
|
+
export interface StreamingLeavedEvent {
|
593
|
+
/** id */
|
594
|
+
id: string;
|
595
|
+
/** The unique identifier of the chat clan. */
|
596
|
+
clan_id: string;
|
597
|
+
/** streaming channel name */
|
598
|
+
streaming_channel_id: string;
|
599
|
+
/** streaming user_id */
|
600
|
+
streaming_user_id: string;
|
601
|
+
}
|
602
|
+
/** Streaming Joined event */
|
603
|
+
export interface StreamingJoinedEvent {
|
604
|
+
/** The unique identifier of the chat clan. */
|
605
|
+
clan_id: string;
|
606
|
+
/** The channel name */
|
607
|
+
clan_name: string;
|
608
|
+
/** id streaming */
|
609
|
+
id: string;
|
610
|
+
/** streaming participant */
|
611
|
+
participant: string;
|
612
|
+
/** user id */
|
613
|
+
user_id: string;
|
614
|
+
/** streaming channel label */
|
615
|
+
streaming_channel_label: string;
|
616
|
+
/** streaming channel id */
|
617
|
+
streaming_channel_id: string;
|
618
|
+
}
|
619
|
+
/** Streaming start event */
|
620
|
+
export interface StreamingStartedEvent {
|
621
|
+
/** clan id */
|
622
|
+
clan_id: string;
|
623
|
+
/** channel id */
|
624
|
+
channel_id: string;
|
625
|
+
/** stream url */
|
626
|
+
streaming_url: string;
|
627
|
+
/** status */
|
628
|
+
is_streaming: boolean;
|
629
|
+
}
|
630
|
+
/** Streaming start event */
|
631
|
+
export interface StreamingEndedEvent {
|
632
|
+
/** clan id */
|
633
|
+
clan_id: string;
|
634
|
+
/** channel id */
|
635
|
+
channel_id: string;
|
636
|
+
}
|
586
637
|
/** A socket connection to Mezon server. */
|
587
638
|
export interface Socket {
|
588
639
|
/** Connection is Open */
|
@@ -698,6 +749,11 @@ export interface Socket {
|
|
698
749
|
oneventcreated: (clan_event_created: ApiCreateEventRequest) => void;
|
699
750
|
oncoffeegiven: (give_coffee_event: ApiGiveCoffeeEvent) => void;
|
700
751
|
oneventemoji: (event_emoji: EventEmoji) => void;
|
752
|
+
onroleassign: (role_assign_event: RoleAssignedEvent) => void;
|
753
|
+
onstreamingchannelstarted: (streaming_started_event: StreamingStartedEvent) => void;
|
754
|
+
onstreamingchannelended: (streaming_ended_event: StreamingEndedEvent) => void;
|
755
|
+
onstreamingchanneljoined: (streaming_joined_event: StreamingJoinedEvent) => void;
|
756
|
+
onstreamingchannelleaved: (streaming_leaved_event: StreamingLeavedEvent) => void;
|
701
757
|
}
|
702
758
|
/** Reports an error received from a socket message. */
|
703
759
|
export interface SocketError {
|
@@ -762,6 +818,11 @@ export declare class DefaultSocket implements Socket {
|
|
762
818
|
oncustomstatus(statusEvent: CustomStatusEvent): void;
|
763
819
|
oneventcreated(clan_event_created: ApiCreateEventRequest): void;
|
764
820
|
oncoffeegiven(give_coffee_event: ApiGiveCoffeeEvent): void;
|
821
|
+
onroleassign(role_assign_event: RoleAssignedEvent): void;
|
822
|
+
onstreamingchannelstarted(streaming_started_event: StreamingStartedEvent): void;
|
823
|
+
onstreamingchannelended(streaming_ended_event: StreamingEndedEvent): void;
|
824
|
+
onstreamingchanneljoined(streaming_joined_event: StreamingJoinedEvent): void;
|
825
|
+
onstreamingchannelleaved(streaming_leaved_event: StreamingLeavedEvent): void;
|
765
826
|
send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping, sendTimeout?: number): Promise<any>;
|
766
827
|
followUsers(userIds: string[]): Promise<Status>;
|
767
828
|
joinClanChat(clan_id: string): Promise<ClanJoin>;
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
import { ApiChannelMessageHeader, ApiCreateEventRequest, ApiGiveCoffeeEvent, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiNotification, ApiPermissionList, ApiRoleList, ApiRpc, ApiUser} from "./api.gen";
|
17
|
+
import { ApiChannelMessageHeader, ApiCreateEventRequest, ApiGiveCoffeeEvent, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiNotification, ApiPermissionList, ApiRole, ApiRoleList, ApiRpc, ApiUser} from "./api.gen";
|
18
18
|
import {Session} from "./session";
|
19
19
|
import {ChannelMessage, Notification} from "./client";
|
20
20
|
import {WebSocketAdapter, WebSocketAdapterText} from "./web_socket_adapter"
|
@@ -667,15 +667,9 @@ export interface RoleListEvent {
|
|
667
667
|
}
|
668
668
|
|
669
669
|
export interface RoleEvent {
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
user_ids_assigned: Array<string>;
|
674
|
-
permission_ids_assigned: Array<string>;
|
675
|
-
user_ids_removed: Array<string>;
|
676
|
-
permission_ids_removed: Array<string>;
|
677
|
-
role_title: string;
|
678
|
-
status: string;
|
670
|
+
role: ApiRole;
|
671
|
+
status: number;
|
672
|
+
user_id: string;
|
679
673
|
}
|
680
674
|
|
681
675
|
export interface EventEmoji {
|
@@ -869,6 +863,68 @@ export interface GetUserEmojiUsageEvent {
|
|
869
863
|
user_emoji_usage: Array<UserEmojiUsage>;
|
870
864
|
}
|
871
865
|
|
866
|
+
/** On role assign */
|
867
|
+
export interface RoleAssignedEvent {
|
868
|
+
/** The clan of this role */
|
869
|
+
ClanId: string;
|
870
|
+
/** Role ID */
|
871
|
+
role_id: string;
|
872
|
+
/** UserIds Assigned */
|
873
|
+
user_ids_assigned: string[];
|
874
|
+
/** UserIds Removed */
|
875
|
+
user_ids_removed: string[];
|
876
|
+
}
|
877
|
+
|
878
|
+
/** Streaming Joined event */
|
879
|
+
export interface StreamingLeavedEvent {
|
880
|
+
/** id */
|
881
|
+
id: string;
|
882
|
+
/** The unique identifier of the chat clan. */
|
883
|
+
clan_id: string;
|
884
|
+
/** streaming channel name */
|
885
|
+
streaming_channel_id: string;
|
886
|
+
/** streaming user_id */
|
887
|
+
streaming_user_id: string;
|
888
|
+
}
|
889
|
+
|
890
|
+
/** Streaming Joined event */
|
891
|
+
export interface StreamingJoinedEvent {
|
892
|
+
/** The unique identifier of the chat clan. */
|
893
|
+
clan_id: string;
|
894
|
+
/** The channel name */
|
895
|
+
clan_name: string;
|
896
|
+
/** id streaming */
|
897
|
+
id: string;
|
898
|
+
/** streaming participant */
|
899
|
+
participant: string;
|
900
|
+
/** user id */
|
901
|
+
user_id: string;
|
902
|
+
/** streaming channel label */
|
903
|
+
streaming_channel_label: string;
|
904
|
+
/** streaming channel id */
|
905
|
+
streaming_channel_id: string;
|
906
|
+
}
|
907
|
+
|
908
|
+
/** Streaming start event */
|
909
|
+
export interface StreamingStartedEvent {
|
910
|
+
/** clan id */
|
911
|
+
clan_id: string;
|
912
|
+
/** channel id */
|
913
|
+
channel_id: string;
|
914
|
+
/** stream url */
|
915
|
+
streaming_url: string;
|
916
|
+
/** status */
|
917
|
+
is_streaming: boolean;
|
918
|
+
}
|
919
|
+
|
920
|
+
/** Streaming start event */
|
921
|
+
export interface StreamingEndedEvent {
|
922
|
+
/** clan id */
|
923
|
+
clan_id: string;
|
924
|
+
/** channel id */
|
925
|
+
channel_id: string;
|
926
|
+
}
|
927
|
+
|
872
928
|
/** A socket connection to Mezon server. */
|
873
929
|
export interface Socket {
|
874
930
|
/** Connection is Open */
|
@@ -1070,6 +1126,16 @@ export interface Socket {
|
|
1070
1126
|
|
1071
1127
|
oneventemoji: (event_emoji: EventEmoji) => void;
|
1072
1128
|
|
1129
|
+
onroleassign: (role_assign_event: RoleAssignedEvent) => void;
|
1130
|
+
|
1131
|
+
onstreamingchannelstarted: (streaming_started_event: StreamingStartedEvent) => void;
|
1132
|
+
|
1133
|
+
onstreamingchannelended: (streaming_ended_event: StreamingEndedEvent) => void;
|
1134
|
+
|
1135
|
+
onstreamingchanneljoined: (streaming_joined_event: StreamingJoinedEvent) => void;
|
1136
|
+
|
1137
|
+
onstreamingchannelleaved: (streaming_leaved_event: StreamingLeavedEvent) => void;
|
1138
|
+
|
1073
1139
|
}
|
1074
1140
|
|
1075
1141
|
/** Reports an error received from a socket message. */
|
@@ -1252,9 +1318,19 @@ export class DefaultSocket implements Socket {
|
|
1252
1318
|
} else if (message.user_clan_removed_event) {
|
1253
1319
|
this.onuserclanremoved(<UserClanRemovedEvent>message.user_clan_removed_event);
|
1254
1320
|
} else if(message.clan_event_created){
|
1255
|
-
|
1321
|
+
this.oneventcreated(message.clan_event_created);
|
1256
1322
|
} else if(message.give_coffee_event){
|
1257
1323
|
this.oncoffeegiven(<ApiGiveCoffeeEvent>message.give_coffee_event);
|
1324
|
+
} else if(message.role_assign_event){
|
1325
|
+
this.onroleassign(<RoleAssignedEvent>message.role_assign_event);
|
1326
|
+
} else if(message.streaming_started_event){
|
1327
|
+
this.onstreamingchannelstarted(<StreamingStartedEvent>message.streaming_started_event);
|
1328
|
+
} else if(message.streaming_ended_event){
|
1329
|
+
this.onstreamingchannelended(<StreamingEndedEvent>message.streaming_ended_event);
|
1330
|
+
} else if(message.streaming_joined_event){
|
1331
|
+
this.onstreamingchanneljoined(<StreamingJoinedEvent>message.streaming_joined_event);
|
1332
|
+
} else if(message.streaming_leaved_event){
|
1333
|
+
this.onstreamingchannelleaved(<StreamingLeavedEvent>message.streaming_leaved_event);
|
1258
1334
|
} else {
|
1259
1335
|
if (this.verbose && window && window.console) {
|
1260
1336
|
console.log("Unrecognized message received: %o", message);
|
@@ -1526,6 +1602,36 @@ export class DefaultSocket implements Socket {
|
|
1526
1602
|
console.log(give_coffee_event);
|
1527
1603
|
}
|
1528
1604
|
}
|
1605
|
+
|
1606
|
+
onroleassign(role_assign_event: RoleAssignedEvent) {
|
1607
|
+
if (this.verbose && window && window.console) {
|
1608
|
+
console.log(role_assign_event);
|
1609
|
+
}
|
1610
|
+
}
|
1611
|
+
|
1612
|
+
onstreamingchannelstarted(streaming_started_event: StreamingStartedEvent) {
|
1613
|
+
if (this.verbose && window && window.console) {
|
1614
|
+
console.log(streaming_started_event);
|
1615
|
+
}
|
1616
|
+
}
|
1617
|
+
|
1618
|
+
onstreamingchannelended(streaming_ended_event: StreamingEndedEvent) {
|
1619
|
+
if (this.verbose && window && window.console) {
|
1620
|
+
console.log(streaming_ended_event);
|
1621
|
+
}
|
1622
|
+
}
|
1623
|
+
|
1624
|
+
onstreamingchanneljoined(streaming_joined_event: StreamingJoinedEvent) {
|
1625
|
+
if (this.verbose && window && window.console) {
|
1626
|
+
console.log(streaming_joined_event);
|
1627
|
+
}
|
1628
|
+
}
|
1629
|
+
|
1630
|
+
onstreamingchannelleaved(streaming_leaved_event: StreamingLeavedEvent) {
|
1631
|
+
if (this.verbose && window && window.console) {
|
1632
|
+
console.log(streaming_leaved_event);
|
1633
|
+
}
|
1634
|
+
}
|
1529
1635
|
|
1530
1636
|
send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent |
|
1531
1637
|
ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping, sendTimeout = DefaultSocket.DefaultSendTimeoutMs): Promise<any> {
|