mezon-js 2.8.32 → 2.8.34
Sign up to get free protection for your applications and to get access to all the features.
- package/api/api.ts +19515 -0
- package/api.gen.ts +38 -0
- package/dist/api.gen.d.ts +28 -0
- package/dist/mezon-js.cjs.js +2 -1
- package/dist/mezon-js.esm.mjs +2 -1
- package/dist/socket.d.ts +11 -102
- package/google/protobuf/timestamp.ts +220 -0
- package/google/protobuf/wrappers.ts +626 -0
- package/package.json +1 -1
- package/rtapi/realtime.ts +6670 -0
- package/socket.ts +15 -155
package/socket.ts
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
import {ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiNotification, ApiRpc} from "./api.gen";
|
17
|
+
import {ApiChannelMessage, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiNotification, ApiRpc} from "./api.gen";
|
18
18
|
import {Session} from "./session";
|
19
19
|
import {Notification} from "./client";
|
20
20
|
import {WebSocketAdapter, WebSocketAdapterText} from "./web_socket_adapter"
|
@@ -153,98 +153,6 @@ export interface LastSeenMessageEvent {
|
|
153
153
|
message_id: string;
|
154
154
|
}
|
155
155
|
|
156
|
-
/** User is react to message */
|
157
|
-
export interface MessageReactionEvent {
|
158
|
-
// id of reaction message
|
159
|
-
id: string;
|
160
|
-
/** The channel this message belongs to. */
|
161
|
-
channel_id:string;
|
162
|
-
// The mode
|
163
|
-
mode: number;
|
164
|
-
// The channel label
|
165
|
-
channel_label: string;
|
166
|
-
/** The message that user react */
|
167
|
-
message_id: string;
|
168
|
-
/** Message sender, usually a user ID. */
|
169
|
-
sender_id: string;
|
170
|
-
//
|
171
|
-
sender_name?: string;
|
172
|
-
//
|
173
|
-
sender_avatar?: string;
|
174
|
-
/** Emoji id. */
|
175
|
-
emoji_id: string;
|
176
|
-
/** Emoji shortname. */
|
177
|
-
emoji: string;
|
178
|
-
// count of emoji
|
179
|
-
count: number;
|
180
|
-
// action
|
181
|
-
action: boolean;
|
182
|
-
}
|
183
|
-
|
184
|
-
/** User is react to message */
|
185
|
-
export interface MessageMentionEvent {
|
186
|
-
/** The channel this message belongs to. */
|
187
|
-
channel_id:string;
|
188
|
-
// The mode
|
189
|
-
mode: number;
|
190
|
-
// The channel label
|
191
|
-
channel_label: string;
|
192
|
-
/** The message that user react */
|
193
|
-
message_id: string;
|
194
|
-
/** Message sender, usually a user ID. */
|
195
|
-
sender_id: string;
|
196
|
-
// mention user id
|
197
|
-
user_id: string;
|
198
|
-
// mention username
|
199
|
-
username: string;
|
200
|
-
// start position
|
201
|
-
s?: number;
|
202
|
-
// end position
|
203
|
-
e?: number;
|
204
|
-
}
|
205
|
-
|
206
|
-
/** User is react to message */
|
207
|
-
export interface MessageAttachmentEvent {
|
208
|
-
/** The channel this message belongs to. */
|
209
|
-
channel_id:string;
|
210
|
-
// The mode
|
211
|
-
mode: number;
|
212
|
-
// The channel label
|
213
|
-
channel_label: string;
|
214
|
-
/** The message that user react */
|
215
|
-
message_id: string;
|
216
|
-
/** Message sender, usually a user ID. */
|
217
|
-
sender_id: string;
|
218
|
-
// Attachment file name
|
219
|
-
filename: string;
|
220
|
-
// Attachment file size
|
221
|
-
size: number;
|
222
|
-
// Attachment url
|
223
|
-
url: string;
|
224
|
-
// Attachment file type
|
225
|
-
filetype: string;
|
226
|
-
// Attachment width
|
227
|
-
width?: number;
|
228
|
-
// Attachment width
|
229
|
-
height?: number;
|
230
|
-
}
|
231
|
-
|
232
|
-
/** User is delete to message */
|
233
|
-
export interface MessageRefEvent {
|
234
|
-
/** The channel this message belongs to. */
|
235
|
-
channel_id:string;
|
236
|
-
// The mode
|
237
|
-
mode: number;
|
238
|
-
// The channel label
|
239
|
-
channel_label: string;
|
240
|
-
/** The message that user react */
|
241
|
-
message_id: string;
|
242
|
-
/** Message reference ID. */
|
243
|
-
message_ref_id: string;
|
244
|
-
/** reference type */
|
245
|
-
ref_type: number;
|
246
|
-
}
|
247
|
-
|
248
156
|
/** User is typing */
|
249
157
|
export interface MessageTypingEvent {
|
250
158
|
/** The channel this message belongs to. */
|
@@ -273,55 +181,6 @@ export interface UserProfileUpdatedEvent{
|
|
273
181
|
clan_id: string;
|
274
182
|
}
|
275
183
|
|
276
|
-
/** An incoming message on a realtime chat channel. */
|
277
|
-
export interface ChannelMessageEvent {
|
278
|
-
avatar?: string;
|
279
|
-
//The channel this message belongs to.
|
280
|
-
channel_id:string;
|
281
|
-
// The mode
|
282
|
-
mode: number;
|
283
|
-
//The name of the chat room, or an empty string if this message was not sent through a chat room.
|
284
|
-
channel_label: string;
|
285
|
-
//The clan this message belong to.
|
286
|
-
clan_id?: string;
|
287
|
-
//The code representing a message type or category.
|
288
|
-
code: number;
|
289
|
-
//The content payload.
|
290
|
-
content: string;
|
291
|
-
//The UNIX time (for gRPC clients) or ISO string (for REST clients) when the message was created.
|
292
|
-
create_time: string;
|
293
|
-
//The unique ID of this message.
|
294
|
-
id: string;
|
295
|
-
//True if the message was persisted to the channel's history, false otherwise.
|
296
|
-
persistent?: boolean;
|
297
|
-
//Message sender, usually a user ID.
|
298
|
-
sender_id: string;
|
299
|
-
//The UNIX time (for gRPC clients) or ISO string (for REST clients) when the message was last updated.
|
300
|
-
update_time: string;
|
301
|
-
//The ID of the first DM user, or an empty string if this message was not sent through a DM chat.
|
302
|
-
clan_logo: string;
|
303
|
-
//The ID of the second DM user, or an empty string if this message was not sent through a DM chat.
|
304
|
-
category_name: string;
|
305
|
-
//The username of the message sender, if any.
|
306
|
-
username: string;
|
307
|
-
// The clan nick name
|
308
|
-
clan_nick: string;
|
309
|
-
// The clan avatar
|
310
|
-
clan_avatar: string;
|
311
|
-
// The display name
|
312
|
-
display_name: string;
|
313
|
-
//
|
314
|
-
reactions?: Array<ApiMessageReaction>;
|
315
|
-
//
|
316
|
-
mentions?: Array<ApiMessageMention>;
|
317
|
-
//
|
318
|
-
attachments?: Array<ApiMessageAttachment>;
|
319
|
-
//
|
320
|
-
references?: Array<ApiMessageRef>;
|
321
|
-
//
|
322
|
-
referenced_message?: ChannelMessageEvent;
|
323
|
-
}
|
324
|
-
|
325
184
|
/** An acknowledgement received in response to sending a message on a chat channel. */
|
326
185
|
export interface ChannelMessageAck {
|
327
186
|
/** The server-assigned channel ID. */
|
@@ -356,9 +215,9 @@ interface ChannelMessageSend {
|
|
356
215
|
/** The content payload. */
|
357
216
|
content: any;
|
358
217
|
//
|
359
|
-
mentions?: Array<
|
218
|
+
mentions?: Array<ApiMessageMention>;
|
360
219
|
//
|
361
|
-
attachments?: Array<
|
220
|
+
attachments?: Array<ApiMessageAttachment>;
|
362
221
|
//
|
363
222
|
anonymous_message?: boolean;
|
364
223
|
//
|
@@ -380,9 +239,9 @@ interface ChannelMessageUpdate {
|
|
380
239
|
/** The content payload. */
|
381
240
|
content: any,
|
382
241
|
/** mentions */
|
383
|
-
mentions?: Array<
|
242
|
+
mentions?: Array<ApiMessageMention>;
|
384
243
|
/** attachments */
|
385
|
-
attachments?: Array<
|
244
|
+
attachments?: Array<ApiMessageAttachment>;
|
386
245
|
/** The mode payload. */
|
387
246
|
mode: number;
|
388
247
|
};
|
@@ -832,7 +691,7 @@ export interface Socket {
|
|
832
691
|
writeMessageTyping(clan_id: string, channel_id: string, mode: number) : Promise<MessageTypingEvent>;
|
833
692
|
|
834
693
|
/** Send message reaction */
|
835
|
-
writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean) : Promise<
|
694
|
+
writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean) : Promise<ApiMessageReaction>;
|
836
695
|
|
837
696
|
/** Send last seen message */
|
838
697
|
writeLastSeenMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp: string) : Promise<LastSeenMessageEvent>;
|
@@ -878,13 +737,13 @@ export interface Socket {
|
|
878
737
|
oncustomstatus: (statusEvent: CustomStatusEvent) => void;
|
879
738
|
|
880
739
|
/** Receive channel message. */
|
881
|
-
onchannelmessage: (channelMessage:
|
740
|
+
onchannelmessage: (channelMessage: ApiChannelMessage) => void;
|
882
741
|
|
883
742
|
/** Receive typing event */
|
884
743
|
onmessagetyping: (messageTypingEvent: MessageTypingEvent) => void;
|
885
744
|
|
886
745
|
/** Receive reaction event */
|
887
|
-
onmessagereaction: (messageReactionEvent:
|
746
|
+
onmessagereaction: (messageReactionEvent: ApiMessageReaction) => void;
|
888
747
|
|
889
748
|
/** Receive channel presence updates. */
|
890
749
|
onchannelpresence: (channelPresence: ChannelPresenceEvent) => void;
|
@@ -1077,7 +936,8 @@ export class DefaultSocket implements Socket {
|
|
1077
936
|
} catch(e) {
|
1078
937
|
//console.log("references is invalid", e);
|
1079
938
|
}
|
1080
|
-
var e:
|
939
|
+
var e: ApiChannelMessage = {
|
940
|
+
id: message.id,
|
1081
941
|
avatar: message.channel_message.avatar,
|
1082
942
|
channel_id: message.channel_message.channel_id,
|
1083
943
|
mode: message.channel_message.mode,
|
@@ -1085,7 +945,7 @@ export class DefaultSocket implements Socket {
|
|
1085
945
|
clan_id: message.channel_message.clan_id,
|
1086
946
|
code: message.channel_message.code,
|
1087
947
|
create_time: message.channel_message.create_time,
|
1088
|
-
|
948
|
+
message_id: message.channel_message.message_id,
|
1089
949
|
sender_id: message.channel_message.sender_id,
|
1090
950
|
update_time: message.channel_message.update_time,
|
1091
951
|
clan_logo: message.channel_message.clan_logo,
|
@@ -1104,7 +964,7 @@ export class DefaultSocket implements Socket {
|
|
1104
964
|
} else if (message.message_typing_event) {
|
1105
965
|
this.onmessagetyping(<MessageTypingEvent>message.message_typing_event);
|
1106
966
|
} else if (message.message_reaction_event) {
|
1107
|
-
this.onmessagereaction(<
|
967
|
+
this.onmessagereaction(<ApiMessageReaction>message.message_reaction_event);
|
1108
968
|
} else if (message.channel_presence_event) {
|
1109
969
|
this.onchannelpresence(<ChannelPresenceEvent>message.channel_presence_event);
|
1110
970
|
} else if (message.last_pin_message_event) {
|
@@ -1198,13 +1058,13 @@ export class DefaultSocket implements Socket {
|
|
1198
1058
|
}
|
1199
1059
|
}
|
1200
1060
|
|
1201
|
-
onmessagereaction(messagereaction:
|
1061
|
+
onmessagereaction(messagereaction: ApiMessageReaction) {
|
1202
1062
|
if (this.verbose && window && window.console) {
|
1203
1063
|
console.log(messagereaction);
|
1204
1064
|
}
|
1205
1065
|
}
|
1206
1066
|
|
1207
|
-
onchannelmessage(channelMessage:
|
1067
|
+
onchannelmessage(channelMessage: ApiChannelMessage) {
|
1208
1068
|
if (this.verbose && window && window.console) {
|
1209
1069
|
console.log(channelMessage);
|
1210
1070
|
}
|
@@ -1453,7 +1313,7 @@ export class DefaultSocket implements Socket {
|
|
1453
1313
|
return response.channel_message_ack;
|
1454
1314
|
}
|
1455
1315
|
|
1456
|
-
async writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<
|
1316
|
+
async writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<ApiMessageReaction> {
|
1457
1317
|
const response = await this.send({message_reaction_event: {id: id, clan_id: clan_id, channel_id: channel_id, mode: mode, message_id: message_id, emoji_id: emoji_id, emoji: emoji, count: count, message_sender_id: message_sender_id, action: action_delete}});
|
1458
1318
|
return response.message_reaction_event
|
1459
1319
|
}
|