mezon-js 2.7.50 → 2.7.51
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 +28 -146
- package/dist/mezon-js.esm.mjs +28 -146
- package/dist/socket.d.ts +17 -222
- package/package.json +1 -1
- package/socket.ts +36 -374
package/dist/socket.d.ts
CHANGED
@@ -213,7 +213,6 @@ interface ChannelMessageUpdate {
|
|
213
213
|
/** The server-assigned channel ID. */
|
214
214
|
channel_id: string;
|
215
215
|
/** The server-assigned channel label. */
|
216
|
-
channel_label: string;
|
217
216
|
/** A unique ID for the chat message to be updated. */
|
218
217
|
message_id: string;
|
219
218
|
/** The content payload. */
|
@@ -328,163 +327,6 @@ export interface StreamPresenceEvent {
|
|
328
327
|
/** Presences of users who left the stream. */
|
329
328
|
leaves: Presence[];
|
330
329
|
}
|
331
|
-
/** Incoming information about a party. */
|
332
|
-
export interface Party {
|
333
|
-
/** The unique party identifier. */
|
334
|
-
party_id: string;
|
335
|
-
/** True, if the party is open to join. */
|
336
|
-
open: boolean;
|
337
|
-
/** The maximum number of party members. */
|
338
|
-
max_size: number;
|
339
|
-
/** The current user in this party, i.e. yourself. */
|
340
|
-
self: Presence;
|
341
|
-
/** The current party leader. */
|
342
|
-
leader: Presence;
|
343
|
-
/** All members currently in the party. */
|
344
|
-
presences: Presence[];
|
345
|
-
}
|
346
|
-
/** Create a party. */
|
347
|
-
export interface PartyCreate {
|
348
|
-
party_create: {
|
349
|
-
/** True, if the party is open to join. */
|
350
|
-
open: boolean;
|
351
|
-
/** The maximum number of party members. */
|
352
|
-
max_size: number;
|
353
|
-
};
|
354
|
-
}
|
355
|
-
/** Join a party. */
|
356
|
-
interface PartyJoin {
|
357
|
-
party_join: {
|
358
|
-
/** The unique party identifier. */
|
359
|
-
party_id: string;
|
360
|
-
};
|
361
|
-
}
|
362
|
-
/** Leave a party. */
|
363
|
-
interface PartyLeave {
|
364
|
-
party_leave: {
|
365
|
-
/** The unique party identifier. */
|
366
|
-
party_id: string;
|
367
|
-
};
|
368
|
-
}
|
369
|
-
/** Promote a new party leader. */
|
370
|
-
interface PartyPromote {
|
371
|
-
party_promote: {
|
372
|
-
/** The unique party identifier. */
|
373
|
-
party_id: string;
|
374
|
-
/** The user presence being promoted to leader. */
|
375
|
-
presence: Presence;
|
376
|
-
};
|
377
|
-
}
|
378
|
-
/** Announcement of a new party leader. */
|
379
|
-
export interface PartyLeader {
|
380
|
-
/** The unique party identifier. */
|
381
|
-
party_id: string;
|
382
|
-
/** The presence of the new party leader. */
|
383
|
-
presence: Presence;
|
384
|
-
}
|
385
|
-
/** Accept a request to join. */
|
386
|
-
interface PartyAccept {
|
387
|
-
party_accept: {
|
388
|
-
/** The unique party identifier. */
|
389
|
-
party_id: string;
|
390
|
-
/** The presence being accepted to join the party. */
|
391
|
-
presence: Presence;
|
392
|
-
};
|
393
|
-
}
|
394
|
-
/** End a party, kicking all party members and closing it. */
|
395
|
-
interface PartyClose {
|
396
|
-
party_close: {
|
397
|
-
/** The unique party identifier. */
|
398
|
-
party_id: string;
|
399
|
-
};
|
400
|
-
}
|
401
|
-
/** Incoming party data delivered from the server. */
|
402
|
-
export interface PartyData {
|
403
|
-
/** The unique party identifier. */
|
404
|
-
party_id: string;
|
405
|
-
/** A reference to the user presence that sent this data, if any. */
|
406
|
-
presence: Presence;
|
407
|
-
/** The operation code the message was sent with. */
|
408
|
-
op_code: number;
|
409
|
-
/** Data payload, if any. */
|
410
|
-
data: Uint8Array;
|
411
|
-
}
|
412
|
-
/** A client to server request to send data to a party. */
|
413
|
-
interface PartyDataSend {
|
414
|
-
party_data_send: {
|
415
|
-
/** The unique party identifier. */
|
416
|
-
party_id: string;
|
417
|
-
/** The operation code the message was sent with. */
|
418
|
-
op_code: number;
|
419
|
-
/** Data payload, if any. */
|
420
|
-
data: string | Uint8Array;
|
421
|
-
};
|
422
|
-
}
|
423
|
-
/** Incoming notification for one or more new presences attempting to join the party. */
|
424
|
-
export interface PartyJoinRequest {
|
425
|
-
/** The ID of the party to get a list of join requests for. */
|
426
|
-
party_id: string;
|
427
|
-
/** Presences attempting to join, or who have joined. */
|
428
|
-
presences: Presence[];
|
429
|
-
}
|
430
|
-
/** Request a list of pending join requests for a party. */
|
431
|
-
export interface PartyJoinRequestList {
|
432
|
-
party_join_request_list: {
|
433
|
-
/** The ID of the party to get a list of join requests for. */
|
434
|
-
party_id: string;
|
435
|
-
};
|
436
|
-
}
|
437
|
-
/** Begin matchmaking as a party. */
|
438
|
-
interface PartyMatchmakerAdd {
|
439
|
-
party_matchmaker_add: {
|
440
|
-
/** The ID of the party to create a matchmaker ticket for. */
|
441
|
-
party_id: string;
|
442
|
-
/** Minimum total user count to match together. */
|
443
|
-
min_count: number;
|
444
|
-
/** Maximum total user count to match together. */
|
445
|
-
max_count: number;
|
446
|
-
/** Filter query used to identify suitable users. */
|
447
|
-
query: string;
|
448
|
-
/** String properties describing the party (e.g. region). */
|
449
|
-
string_properties?: Record<string, string>;
|
450
|
-
/** Numeric properties describing the party (e.g. rank). */
|
451
|
-
numeric_properties?: Record<string, number>;
|
452
|
-
};
|
453
|
-
}
|
454
|
-
/** Cancel a party matchmaking process using a ticket. */
|
455
|
-
interface PartyMatchmakerRemove {
|
456
|
-
party_matchmaker_remove: {
|
457
|
-
/** The ID of the party to cancel a matchmaker ticket for. */
|
458
|
-
party_id: string;
|
459
|
-
/** The ticket to remove. */
|
460
|
-
ticket: string;
|
461
|
-
};
|
462
|
-
}
|
463
|
-
/** A response from starting a new party matchmaking process. */
|
464
|
-
export interface PartyMatchmakerTicket {
|
465
|
-
/** The ID of the party. */
|
466
|
-
party_id: string;
|
467
|
-
/** The matchmaker ticket created. */
|
468
|
-
ticket: string;
|
469
|
-
}
|
470
|
-
/** Presence update for a particular party. */
|
471
|
-
export interface PartyPresenceEvent {
|
472
|
-
/** The ID of the party. */
|
473
|
-
party_id: string;
|
474
|
-
/** The user presences that have just joined the party. */
|
475
|
-
joins: Presence[];
|
476
|
-
/** The user presences that have just left the party. */
|
477
|
-
leaves: Presence[];
|
478
|
-
}
|
479
|
-
/** Kick a party member, or decline a request to join. */
|
480
|
-
interface PartyRemove {
|
481
|
-
party_remove: {
|
482
|
-
/** The ID of the party to remove/reject from. */
|
483
|
-
party_id: string;
|
484
|
-
/** The presence to remove/reject. */
|
485
|
-
presence: Presence;
|
486
|
-
};
|
487
|
-
}
|
488
330
|
/** Execute an Lua function on the server. */
|
489
331
|
interface Rpc {
|
490
332
|
rpc: ApiRpc;
|
@@ -531,52 +373,32 @@ export interface Socket {
|
|
531
373
|
connect(session: Session, createStatus: boolean): Promise<Session>;
|
532
374
|
/** Disconnect from the server. */
|
533
375
|
disconnect(fireDisconnectEvent: boolean): void;
|
534
|
-
/** Accept a request to join. */
|
535
|
-
acceptPartyMember(party_id: string, presence: Presence): Promise<void>;
|
536
|
-
/** End a party, kicking all party members and closing it. */
|
537
|
-
closeParty(party_id: string): Promise<void>;
|
538
|
-
/** Create a party. */
|
539
|
-
createParty(open: boolean, max_size: number): Promise<Party>;
|
540
376
|
/** Subscribe to one or more users for their status updates. */
|
541
377
|
followUsers(user_ids: string[]): Promise<Status>;
|
542
378
|
/** Join clan chat */
|
543
379
|
joinClanChat(clan_id: string): Promise<ClanJoin>;
|
544
380
|
/** Join a chat channel on the server. */
|
545
|
-
joinChat(channel_id: string,
|
546
|
-
/** Join a party. */
|
547
|
-
joinParty(party_id: string): Promise<void>;
|
381
|
+
joinChat(channel_id: string, mode: number, type: number, persistence: boolean, hidden: boolean): Promise<Channel>;
|
548
382
|
/** Leave a chat channel on the server. */
|
549
|
-
leaveChat(channel_id: string,
|
550
|
-
/** Leave a multiplayer match on the server. */
|
551
|
-
leaveMatch(matchId: string): Promise<void>;
|
552
|
-
/** Leave a party. */
|
553
|
-
leaveParty(party_id: string): Promise<void>;
|
554
|
-
/** Request a list of pending join requests for a party. */
|
555
|
-
listPartyJoinRequests(party_id: string): Promise<PartyJoinRequest>;
|
556
|
-
/** Promote a new party leader. */
|
557
|
-
promotePartyMember(party_id: string, party_member: Presence): Promise<PartyLeader>;
|
383
|
+
leaveChat(channel_id: string, mode: number): Promise<void>;
|
558
384
|
/** Remove a chat message from a chat channel on the server. */
|
559
|
-
removeChatMessage(channel_id: string,
|
560
|
-
/** Kick a party member, or decline a request to join. */
|
561
|
-
removePartyMember(party_id: string, presence: Presence): Promise<void>;
|
385
|
+
removeChatMessage(channel_id: string, mode: number, message_id: string): Promise<ChannelMessageAck>;
|
562
386
|
/** Execute an RPC function to the server. */
|
563
387
|
rpc(id?: string, payload?: string, http_key?: string): Promise<ApiRpc>;
|
564
|
-
/** Send data to a party. */
|
565
|
-
sendPartyData(party_id: string, opcode: number, data: string | Uint8Array): Promise<void>;
|
566
388
|
/** Unfollow one or more users from their status updates. */
|
567
389
|
unfollowUsers(user_ids: string[]): Promise<void>;
|
568
390
|
/** Update a chat message on a chat channel in the server. */
|
569
|
-
updateChatMessage(channel_id: string,
|
391
|
+
updateChatMessage(channel_id: string, mode: number, message_id: string, content: any): Promise<ChannelMessageAck>;
|
570
392
|
/** Update the status for the current user online. */
|
571
393
|
updateStatus(status?: string): Promise<void>;
|
572
394
|
/** Send a chat message to a chat channel on the server. */
|
573
|
-
writeChatMessage(clan_id: string, channel_id: string,
|
395
|
+
writeChatMessage(clan_id: string, channel_id: string, mode: number, content?: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: boolean, notifi_content?: any): Promise<ChannelMessageAck>;
|
574
396
|
/** Send message typing */
|
575
|
-
writeMessageTyping(channel_id: string,
|
397
|
+
writeMessageTyping(channel_id: string, mode: number): Promise<MessageTypingEvent>;
|
576
398
|
/** Send message reaction */
|
577
|
-
writeMessageReaction(id: string, channel_id: string,
|
399
|
+
writeMessageReaction(id: string, channel_id: string, mode: number, message_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<MessageReactionEvent>;
|
578
400
|
/** Send last seen message */
|
579
|
-
writeLastSeenMessage(channel_id: string,
|
401
|
+
writeLastSeenMessage(channel_id: string, mode: number, message_id: string, timestamp: string): Promise<LastSeenMessageEvent>;
|
580
402
|
/** send voice joined */
|
581
403
|
writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string): Promise<VoiceJoinedEvent>;
|
582
404
|
/** send voice leaved */
|
@@ -587,18 +409,6 @@ export interface Socket {
|
|
587
409
|
onerror: (evt: Event) => void;
|
588
410
|
/** Receive notifications from the socket. */
|
589
411
|
onnotification: (notification: Notification) => void;
|
590
|
-
/** Receive party events. */
|
591
|
-
onparty: (party: Party) => void;
|
592
|
-
/** Receive party close events. */
|
593
|
-
onpartyclose: (partyClose: PartyClose) => void;
|
594
|
-
/** Receive party data updates. */
|
595
|
-
onpartydata: (partyData: PartyData) => void;
|
596
|
-
/** Receive party join requests, if party leader. */
|
597
|
-
onpartyjoinrequest: (partyJoinRequest: PartyJoinRequest) => void;
|
598
|
-
/** Receive announcements of a new party leader. */
|
599
|
-
onpartyleader: (partyLeader: PartyLeader) => void;
|
600
|
-
/** Receive a presence update for a party. */
|
601
|
-
onpartypresence: (partyPresence: PartyPresenceEvent) => void;
|
602
412
|
/** Receive status presence updates. */
|
603
413
|
onstatuspresence: (statusPresence: StatusPresenceEvent) => void;
|
604
414
|
/** Receive stream presence updates. */
|
@@ -664,13 +474,6 @@ export declare class DefaultSocket implements Socket {
|
|
664
474
|
onchannelmessage(channelMessage: ChannelMessageEvent): void;
|
665
475
|
onchannelpresence(channelPresence: ChannelPresenceEvent): void;
|
666
476
|
onnotification(notification: Notification): void;
|
667
|
-
onparty(party: Party): void;
|
668
|
-
onpartyclose(close: PartyClose): void;
|
669
|
-
onpartyjoinrequest(partyJoinRequest: PartyJoinRequest): void;
|
670
|
-
onpartydata(partyData: PartyData): void;
|
671
|
-
onpartyleader(partyLeader: PartyLeader): void;
|
672
|
-
onpartymatchmakerticket(partyMatched: PartyMatchmakerTicket): void;
|
673
|
-
onpartypresence(partyPresence: PartyPresenceEvent): void;
|
674
477
|
onstatuspresence(statusPresence: StatusPresenceEvent): void;
|
675
478
|
onvoiceended(voice: VoiceEndedEvent): void;
|
676
479
|
onvoicestarted(voice: VoiceStartedEvent): void;
|
@@ -682,30 +485,22 @@ export declare class DefaultSocket implements Socket {
|
|
682
485
|
onstreampresence(streamPresence: StreamPresenceEvent): void;
|
683
486
|
onstreamdata(streamData: StreamData): void;
|
684
487
|
onheartbeattimeout(): void;
|
685
|
-
send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent |
|
686
|
-
acceptPartyMember(party_id: string, presence: Presence): Promise<void>;
|
687
|
-
closeParty(party_id: string): Promise<void>;
|
688
|
-
createParty(open: boolean, max_size: number): Promise<Party>;
|
488
|
+
send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping, sendTimeout?: number): Promise<any>;
|
689
489
|
followUsers(userIds: string[]): Promise<Status>;
|
690
490
|
joinClanChat(clan_id: string): Promise<ClanJoin>;
|
691
|
-
joinChat(channel_id: string,
|
692
|
-
|
693
|
-
|
694
|
-
leaveMatch(matchId: string): Promise<void>;
|
695
|
-
leaveParty(party_id: string): Promise<void>;
|
696
|
-
listPartyJoinRequests(party_id: string): Promise<PartyJoinRequest>;
|
697
|
-
promotePartyMember(party_id: string, party_member: Presence): Promise<PartyLeader>;
|
698
|
-
removeChatMessage(channel_id: string, channel_label: string, mode: number, message_id: string): Promise<ChannelMessageAck>;
|
491
|
+
joinChat(channel_id: string, mode: number, type: number, persistence: boolean, hidden: boolean): Promise<Channel>;
|
492
|
+
leaveChat(channel_id: string, mode: number): Promise<void>;
|
493
|
+
removeChatMessage(channel_id: string, mode: number, message_id: string): Promise<ChannelMessageAck>;
|
699
494
|
removePartyMember(party_id: string, member: Presence): Promise<void>;
|
700
495
|
rpc(id?: string, payload?: string, http_key?: string): Promise<ApiRpc>;
|
701
496
|
sendPartyData(party_id: string, op_code: number, data: string | Uint8Array): Promise<void>;
|
702
497
|
unfollowUsers(user_ids: string[]): Promise<void>;
|
703
|
-
updateChatMessage(channel_id: string,
|
498
|
+
updateChatMessage(channel_id: string, mode: number, message_id: string, content: any): Promise<ChannelMessageAck>;
|
704
499
|
updateStatus(status?: string): Promise<void>;
|
705
|
-
writeChatMessage(clan_id: string, channel_id: string,
|
706
|
-
writeMessageReaction(id: string, channel_id: string,
|
707
|
-
writeMessageTyping(channel_id: string,
|
708
|
-
writeLastSeenMessage(channel_id: string,
|
500
|
+
writeChatMessage(clan_id: string, channel_id: string, mode: number, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: Boolean, notifi_content?: any): Promise<ChannelMessageAck>;
|
501
|
+
writeMessageReaction(id: string, channel_id: string, mode: number, message_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<MessageReactionEvent>;
|
502
|
+
writeMessageTyping(channel_id: string, mode: number): Promise<MessageTypingEvent>;
|
503
|
+
writeLastSeenMessage(channel_id: string, mode: number, message_id: string, timestamp: string): Promise<LastSeenMessageEvent>;
|
709
504
|
writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string): Promise<VoiceJoinedEvent>;
|
710
505
|
writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
|
711
506
|
private pingPong;
|