mezon-js 2.7.10 → 2.7.12
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 +3 -16
- package/dist/mezon-js.esm.mjs +5251 -5264
- package/dist/socket.d.ts +3 -19
- package/package.json +49 -49
- package/socket.ts +5 -37
package/dist/socket.d.ts
CHANGED
@@ -122,17 +122,6 @@ export interface MessageAttachmentEvent {
|
|
122
122
|
height?: number;
|
123
123
|
}
|
124
124
|
/** User is delete to message */
|
125
|
-
export interface MessageDeletedEvent {
|
126
|
-
/** The channel this message belongs to. */
|
127
|
-
channel_id: string;
|
128
|
-
mode: number;
|
129
|
-
channel_label: string;
|
130
|
-
/** The message that user react */
|
131
|
-
message_id: string;
|
132
|
-
/** Message sender, usually a user ID. */
|
133
|
-
deletor: string;
|
134
|
-
}
|
135
|
-
/** User is delete to message */
|
136
125
|
export interface MessageRefEvent {
|
137
126
|
/** The channel this message belongs to. */
|
138
127
|
channel_id: string;
|
@@ -208,6 +197,7 @@ interface ChannelMessageSend {
|
|
208
197
|
content: any;
|
209
198
|
mentions?: Array<MessageMentionEvent>;
|
210
199
|
attachments?: Array<MessageAttachmentEvent>;
|
200
|
+
anonymous_message?: boolean;
|
211
201
|
};
|
212
202
|
}
|
213
203
|
/** Update a message previously sent to a realtime chat channel. */
|
@@ -550,13 +540,11 @@ export interface Socket {
|
|
550
540
|
/** Update the status for the current user online. */
|
551
541
|
updateStatus(status?: string): Promise<void>;
|
552
542
|
/** Send a chat message to a chat channel on the server. */
|
553
|
-
writeChatMessage(clan_id: string, channel_id: string, channel_label: string, mode: number, content?: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef
|
543
|
+
writeChatMessage(clan_id: string, channel_id: string, channel_label: string, mode: number, content?: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean): Promise<ChannelMessageAck>;
|
554
544
|
/** Send message typing */
|
555
545
|
writeMessageTyping(channel_id: string, channel_label: string, mode: number): Promise<MessageTypingEvent>;
|
556
546
|
/** Send message reaction */
|
557
547
|
writeMessageReaction(id: string, channel_id: string, channel_label: string, mode: number, message_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<MessageReactionEvent>;
|
558
|
-
/** Send message mention */
|
559
|
-
writeMessageDeleted(channel_id: string, channel_label: string, mode: number, message_id: string, deletor: string): Promise<MessageDeletedEvent>;
|
560
548
|
/** Send last seen message */
|
561
549
|
writeLastSeenMessage(channel_id: string, channel_label: string, mode: number, message_id: string, timestamp: string): Promise<LastSeenMessageEvent>;
|
562
550
|
/** send voice joined */
|
@@ -600,8 +588,6 @@ export interface Socket {
|
|
600
588
|
onmessagetyping: (messageTypingEvent: MessageTypingEvent) => void;
|
601
589
|
/** Receive reaction event */
|
602
590
|
onmessagereaction: (messageReactionEvent: MessageReactionEvent) => void;
|
603
|
-
/** Receive deleted message */
|
604
|
-
onmessagedeleted: (messageDeletedEvent: MessageDeletedEvent) => void;
|
605
591
|
/** Receive channel presence updates. */
|
606
592
|
onchannelpresence: (channelPresence: ChannelPresenceEvent) => void;
|
607
593
|
onvoicejoined: (voiceParticipant: VoiceJoinedEvent) => void;
|
@@ -642,7 +628,6 @@ export declare class DefaultSocket implements Socket {
|
|
642
628
|
onerror(evt: Event): void;
|
643
629
|
onmessagetyping(messagetyping: MessageTypingEvent): void;
|
644
630
|
onmessagereaction(messagereaction: MessageReactionEvent): void;
|
645
|
-
onmessagedeleted(messagedeleted: MessageDeletedEvent): void;
|
646
631
|
onchannelmessage(channelMessage: ChannelMessageEvent): void;
|
647
632
|
onchannelpresence(channelPresence: ChannelPresenceEvent): void;
|
648
633
|
onnotification(notification: Notification): void;
|
@@ -680,9 +665,8 @@ export declare class DefaultSocket implements Socket {
|
|
680
665
|
unfollowUsers(user_ids: string[]): Promise<void>;
|
681
666
|
updateChatMessage(channel_id: string, channel_label: string, mode: number, message_id: string, content: any): Promise<ChannelMessageAck>;
|
682
667
|
updateStatus(status?: string): Promise<void>;
|
683
|
-
writeChatMessage(clan_id: string, channel_id: string, channel_label: string, mode: number, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef
|
668
|
+
writeChatMessage(clan_id: string, channel_id: string, channel_label: string, mode: number, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean): Promise<ChannelMessageAck>;
|
684
669
|
writeMessageReaction(id: string, channel_id: string, channel_label: string, mode: number, message_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<MessageReactionEvent>;
|
685
|
-
writeMessageDeleted(channel_id: string, channel_label: string, mode: number, message_id: string): Promise<MessageDeletedEvent>;
|
686
670
|
writeMessageTyping(channel_id: string, channel_label: string, mode: number): Promise<MessageTypingEvent>;
|
687
671
|
writeLastSeenMessage(channel_id: string, channel_label: string, mode: number, message_id: string, timestamp: string): Promise<LastSeenMessageEvent>;
|
688
672
|
writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string): Promise<VoiceJoinedEvent>;
|
package/package.json
CHANGED
@@ -1,49 +1,49 @@
|
|
1
|
-
{
|
2
|
-
"name": "mezon-js",
|
3
|
-
"version": "2.7.
|
4
|
-
"scripts": {
|
5
|
-
"build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
|
6
|
-
},
|
7
|
-
"description": "JavaScript client for Mezon server written in TypeScript.",
|
8
|
-
"main": "dist/mezon-js.cjs.js",
|
9
|
-
"module": "dist/mezon-js.esm.mjs",
|
10
|
-
"types": "dist/index.d.ts",
|
11
|
-
"exports": {
|
12
|
-
"./package.json": "./package.json",
|
13
|
-
".": {
|
14
|
-
"types": "./dist/index.d.ts",
|
15
|
-
"import": "./dist/mezon-js.esm.mjs",
|
16
|
-
"require": "./dist/mezon-js.cjs.js"
|
17
|
-
}
|
18
|
-
},
|
19
|
-
"keywords": [
|
20
|
-
"app server",
|
21
|
-
"client library",
|
22
|
-
"game server",
|
23
|
-
"mezon",
|
24
|
-
"realtime",
|
25
|
-
"realtime chat"
|
26
|
-
],
|
27
|
-
"repository": {
|
28
|
-
"type": "git",
|
29
|
-
"url": "git+https://github.com/nccasia/mezon-js.git"
|
30
|
-
},
|
31
|
-
"homepage": "https://mezon.vn",
|
32
|
-
"bugs": {
|
33
|
-
"url": "https://github.com/nccasia/mezon-js/issues"
|
34
|
-
},
|
35
|
-
"license": "Apache-2.0",
|
36
|
-
"dependencies": {
|
37
|
-
"@scarf/scarf": "^1.1.1",
|
38
|
-
"base64-arraybuffer": "^1.0.2",
|
39
|
-
"esbuild": "^0.19.11",
|
40
|
-
"js-base64": "^3.7.4",
|
41
|
-
"whatwg-fetch": "^3.6.2"
|
42
|
-
},
|
43
|
-
"devDependencies": {
|
44
|
-
"@rollup/plugin-node-resolve": "^15.0.1",
|
45
|
-
"@rollup/plugin-typescript": "^11.0.0",
|
46
|
-
"rollup": "^3.10.0",
|
47
|
-
"tslib": "^2.4.1"
|
48
|
-
}
|
49
|
-
}
|
1
|
+
{
|
2
|
+
"name": "mezon-js",
|
3
|
+
"version": "2.7.12",
|
4
|
+
"scripts": {
|
5
|
+
"build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
|
6
|
+
},
|
7
|
+
"description": "JavaScript client for Mezon server written in TypeScript.",
|
8
|
+
"main": "dist/mezon-js.cjs.js",
|
9
|
+
"module": "dist/mezon-js.esm.mjs",
|
10
|
+
"types": "dist/index.d.ts",
|
11
|
+
"exports": {
|
12
|
+
"./package.json": "./package.json",
|
13
|
+
".": {
|
14
|
+
"types": "./dist/index.d.ts",
|
15
|
+
"import": "./dist/mezon-js.esm.mjs",
|
16
|
+
"require": "./dist/mezon-js.cjs.js"
|
17
|
+
}
|
18
|
+
},
|
19
|
+
"keywords": [
|
20
|
+
"app server",
|
21
|
+
"client library",
|
22
|
+
"game server",
|
23
|
+
"mezon",
|
24
|
+
"realtime",
|
25
|
+
"realtime chat"
|
26
|
+
],
|
27
|
+
"repository": {
|
28
|
+
"type": "git",
|
29
|
+
"url": "git+https://github.com/nccasia/mezon-js.git"
|
30
|
+
},
|
31
|
+
"homepage": "https://mezon.vn",
|
32
|
+
"bugs": {
|
33
|
+
"url": "https://github.com/nccasia/mezon-js/issues"
|
34
|
+
},
|
35
|
+
"license": "Apache-2.0",
|
36
|
+
"dependencies": {
|
37
|
+
"@scarf/scarf": "^1.1.1",
|
38
|
+
"base64-arraybuffer": "^1.0.2",
|
39
|
+
"esbuild": "^0.19.11",
|
40
|
+
"js-base64": "^3.7.4",
|
41
|
+
"whatwg-fetch": "^3.6.2"
|
42
|
+
},
|
43
|
+
"devDependencies": {
|
44
|
+
"@rollup/plugin-node-resolve": "^15.0.1",
|
45
|
+
"@rollup/plugin-typescript": "^11.0.0",
|
46
|
+
"rollup": "^3.10.0",
|
47
|
+
"tslib": "^2.4.1"
|
48
|
+
}
|
49
|
+
}
|
package/socket.ts
CHANGED
@@ -164,21 +164,6 @@ export interface MessageAttachmentEvent {
|
|
164
164
|
height?: number;
|
165
165
|
}
|
166
166
|
|
167
|
-
/** User is delete to message */
|
168
|
-
export interface MessageDeletedEvent {
|
169
|
-
/** The channel this message belongs to. */
|
170
|
-
channel_id:string;
|
171
|
-
// The mode
|
172
|
-
mode: number;
|
173
|
-
// The channel label
|
174
|
-
channel_label: string;
|
175
|
-
/** The message that user react */
|
176
|
-
message_id: string;
|
177
|
-
/** Message sender, usually a user ID. */
|
178
|
-
deletor: string;
|
179
|
-
}
|
180
|
-
|
181
|
-
|
182
167
|
/** User is delete to message */
|
183
168
|
export interface MessageRefEvent {
|
184
169
|
/** The channel this message belongs to. */
|
@@ -287,6 +272,8 @@ interface ChannelMessageSend {
|
|
287
272
|
mentions?: Array<MessageMentionEvent>;
|
288
273
|
//
|
289
274
|
attachments?: Array<MessageAttachmentEvent>;
|
275
|
+
//
|
276
|
+
anonymous_message?: boolean;
|
290
277
|
};
|
291
278
|
}
|
292
279
|
|
@@ -707,7 +694,7 @@ export interface Socket {
|
|
707
694
|
updateStatus(status? : string) : Promise<void>;
|
708
695
|
|
709
696
|
/** Send a chat message to a chat channel on the server. */
|
710
|
-
writeChatMessage(clan_id: string, channel_id: string, channel_label: string, mode: number, content?: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef
|
697
|
+
writeChatMessage(clan_id: string, channel_id: string, channel_label: string, mode: number, content?: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean) : Promise<ChannelMessageAck>;
|
711
698
|
|
712
699
|
/** Send message typing */
|
713
700
|
writeMessageTyping(channel_id: string, channel_label: string, mode: number) : Promise<MessageTypingEvent>;
|
@@ -715,9 +702,6 @@ export interface Socket {
|
|
715
702
|
/** Send message reaction */
|
716
703
|
writeMessageReaction(id: string, channel_id: string, channel_label: string, mode: number, message_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean) : Promise<MessageReactionEvent>;
|
717
704
|
|
718
|
-
/** Send message mention */
|
719
|
-
writeMessageDeleted(channel_id: string, channel_label: string, mode: number, message_id: string, deletor: string) : Promise<MessageDeletedEvent>;
|
720
|
-
|
721
705
|
/** Send last seen message */
|
722
706
|
writeLastSeenMessage(channel_id: string, channel_label: string, mode: number, message_id: string, timestamp: string) : Promise<LastSeenMessageEvent>;
|
723
707
|
|
@@ -780,9 +764,6 @@ export interface Socket {
|
|
780
764
|
/** Receive reaction event */
|
781
765
|
onmessagereaction: (messageReactionEvent: MessageReactionEvent) => void;
|
782
766
|
|
783
|
-
/** Receive deleted message */
|
784
|
-
onmessagedeleted: (messageDeletedEvent: MessageDeletedEvent) => void;
|
785
|
-
|
786
767
|
/** Receive channel presence updates. */
|
787
768
|
onchannelpresence: (channelPresence: ChannelPresenceEvent) => void;
|
788
769
|
|
@@ -920,8 +901,6 @@ export class DefaultSocket implements Socket {
|
|
920
901
|
this.onmessagetyping(<MessageTypingEvent>message.message_typing_event);
|
921
902
|
} else if (message.message_reaction_event) {
|
922
903
|
this.onmessagereaction(<MessageReactionEvent>message.message_reaction_event);
|
923
|
-
} else if (message.message_deleted_event) {
|
924
|
-
this.onmessagedeleted(<MessageDeletedEvent>message.message_deleted_event);
|
925
904
|
} else if (message.channel_presence_event) {
|
926
905
|
this.onchannelpresence(<ChannelPresenceEvent>message.channel_presence_event);
|
927
906
|
} else if (message.party_data) {
|
@@ -1023,12 +1002,6 @@ export class DefaultSocket implements Socket {
|
|
1023
1002
|
}
|
1024
1003
|
}
|
1025
1004
|
|
1026
|
-
onmessagedeleted(messagedeleted: MessageDeletedEvent) {
|
1027
|
-
if (this.verbose && window && window.console) {
|
1028
|
-
console.log(messagedeleted);
|
1029
|
-
}
|
1030
|
-
}
|
1031
|
-
|
1032
1005
|
onchannelmessage(channelMessage: ChannelMessageEvent) {
|
1033
1006
|
if (this.verbose && window && window.console) {
|
1034
1007
|
console.log(channelMessage);
|
@@ -1300,8 +1273,8 @@ export class DefaultSocket implements Socket {
|
|
1300
1273
|
return this.send({status_update: {status: status}});
|
1301
1274
|
}
|
1302
1275
|
|
1303
|
-
async writeChatMessage(clan_id: string, channel_id: string, channel_label: string, mode: number, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef
|
1304
|
-
const response = await this.send({channel_message_send: {clan_id: clan_id, channel_id: channel_id, channel_label:channel_label, mode:mode, content: content, mentions: mentions, attachments: attachments, references: references}});
|
1276
|
+
async writeChatMessage(clan_id: string, channel_id: string, channel_label: string, mode: number, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean ): Promise<ChannelMessageAck> {
|
1277
|
+
const response = await this.send({channel_message_send: {clan_id: clan_id, channel_id: channel_id, channel_label:channel_label, mode:mode, content: content, mentions: mentions, attachments: attachments, references: references, anonymous_message: anonymous_message}});
|
1305
1278
|
return response.channel_message_ack;
|
1306
1279
|
}
|
1307
1280
|
|
@@ -1310,11 +1283,6 @@ export class DefaultSocket implements Socket {
|
|
1310
1283
|
return response.message_reaction_event
|
1311
1284
|
}
|
1312
1285
|
|
1313
|
-
async writeMessageDeleted(channel_id: string, channel_label: string, mode: number, message_id: string) : Promise<MessageDeletedEvent> {
|
1314
|
-
const response = await this.send({message_deleted_event: {channel_id: channel_id, channel_label: channel_label, mode: mode, message_id: message_id}});
|
1315
|
-
return response.message_deleted_event
|
1316
|
-
}
|
1317
|
-
|
1318
1286
|
async writeMessageTyping(channel_id: string, channel_label: string, mode: number) : Promise<MessageTypingEvent> {
|
1319
1287
|
const response = await this.send({message_typing_event: {channel_id: channel_id, channel_label: channel_label, mode:mode}});
|
1320
1288
|
return response.message_typing_event
|