@onyx-p/imlib-web 1.3.9 → 1.4.1
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/index.esm.js +53 -55
- package/index.umd.js +53 -55
- package/package.json +1 -1
- package/types/model/baseMessage.d.ts +1 -2
- package/types/model/iReceivedConversation.d.ts +2 -3
- package/types/model/iReceivedMessage.d.ts +6 -7
- package/types/model/messages/recallCommandMessage.d.ts +1 -2
- package/types/types.d.ts +8 -9
package/index.esm.js
CHANGED
@@ -13262,9 +13262,9 @@ class AccountStore {
|
|
13262
13262
|
setLogged(info) {
|
13263
13263
|
this._user = {
|
13264
13264
|
active: true,
|
13265
|
-
uid: info.uid
|
13266
|
-
deviceId: info.deviceId,
|
13267
|
-
sessionId: info.sessionId
|
13265
|
+
uid: Long.isLong(info.uid) ? info.uid.toString() : info.uid,
|
13266
|
+
deviceId: Long.isLong(info.deviceId) ? info.deviceId.toString() : info.deviceId,
|
13267
|
+
sessionId: Long.isLong(info.sessionId) ? info.sessionId.toString() : info.sessionId
|
13268
13268
|
};
|
13269
13269
|
}
|
13270
13270
|
logOut() {
|
@@ -13273,9 +13273,9 @@ class AccountStore {
|
|
13273
13273
|
createDefaultUser() {
|
13274
13274
|
return {
|
13275
13275
|
active: false,
|
13276
|
-
uid:
|
13277
|
-
deviceId:
|
13278
|
-
sessionId:
|
13276
|
+
uid: '0',
|
13277
|
+
deviceId: '0',
|
13278
|
+
sessionId: '0',
|
13279
13279
|
token: ''
|
13280
13280
|
};
|
13281
13281
|
}
|
@@ -13386,9 +13386,9 @@ class WebSocketServer {
|
|
13386
13386
|
const networkReq = {
|
13387
13387
|
cmdId: cmdId,
|
13388
13388
|
messageSeq: Long.fromNumber(messageSeq),
|
13389
|
-
deviceId: accountStore.user.deviceId,
|
13390
|
-
sessionId: accountStore.user.sessionId,
|
13391
|
-
uid: accountStore.user.uid,
|
13389
|
+
deviceId: Long.fromString(accountStore.user.deviceId),
|
13390
|
+
sessionId: Long.fromString(accountStore.user.sessionId),
|
13391
|
+
uid: Long.fromString(accountStore.user.uid),
|
13392
13392
|
protocolVersion: SOCKET_PROTOCOL_VER,
|
13393
13393
|
destId: '',
|
13394
13394
|
body: body,
|
@@ -18426,7 +18426,7 @@ const splitFullDialog = dialogId => {
|
|
18426
18426
|
const conversationType = extractConversationType(dialogId);
|
18427
18427
|
return {
|
18428
18428
|
conversationType,
|
18429
|
-
targetId:
|
18429
|
+
targetId: Long.isLong(dialogId) ? dialogId.toString() : dialogId
|
18430
18430
|
};
|
18431
18431
|
};
|
18432
18432
|
|
@@ -18440,10 +18440,12 @@ const getDialogKey = dialogIds => webSocketServer.send(CmdIds$1.GetDialogKey, {
|
|
18440
18440
|
encoder: GetDialogKeyReq,
|
18441
18441
|
decoder: GetDialogKeyResp
|
18442
18442
|
});
|
18443
|
-
const sendPrivateChatMessage = params =>
|
18444
|
-
|
18445
|
-
|
18446
|
-
|
18443
|
+
const sendPrivateChatMessage = params => {
|
18444
|
+
return webSocketServer.send(CmdIds$1.SendPrivateChatMessage, params, {
|
18445
|
+
encoder: SendPrivateChatMessageReq,
|
18446
|
+
decoder: SendPrivateChatMessageResp
|
18447
|
+
});
|
18448
|
+
};
|
18447
18449
|
const sendGroupChatMessage = params => webSocketServer.send(CmdIds$1.SendGroupChatMessage, params, {
|
18448
18450
|
encoder: SendGroupChatMessageReq,
|
18449
18451
|
decoder: SendGroupChatMessageResp
|
@@ -18460,16 +18462,16 @@ const recallChatMessage = (dialogId, messageUId) => {
|
|
18460
18462
|
let type = extractConversationType(dialogId);
|
18461
18463
|
if (type == ConversationType.GROUP) {
|
18462
18464
|
reqPromise = webSocketServer.send(CmdIds$1.RecallGroupMessage, {
|
18463
|
-
groupId: dialogId,
|
18464
|
-
msgId: messageUId
|
18465
|
+
groupId: Long.fromString(dialogId),
|
18466
|
+
msgId: Long.fromString(messageUId)
|
18465
18467
|
}, {
|
18466
18468
|
encoder: RecallGroupChatMessageReq,
|
18467
18469
|
decoder: rpc_baseExports.BaseResp
|
18468
18470
|
});
|
18469
18471
|
} else {
|
18470
18472
|
reqPromise = webSocketServer.send(CmdIds$1.RecallPrivateMessage, {
|
18471
|
-
destId: dialogId,
|
18472
|
-
msgId: messageUId
|
18473
|
+
destId: Long.fromString(dialogId),
|
18474
|
+
msgId: Long.fromString(messageUId)
|
18473
18475
|
}, {
|
18474
18476
|
encoder: RecallPrivateChatMessageReq,
|
18475
18477
|
decoder: rpc_baseExports.BaseResp
|
@@ -18479,7 +18481,7 @@ const recallChatMessage = (dialogId, messageUId) => {
|
|
18479
18481
|
};
|
18480
18482
|
const getRemoteMessages = params => {
|
18481
18483
|
const reqParams = {
|
18482
|
-
dialogKeys: params.dialogId,
|
18484
|
+
dialogKeys: Long.fromString(params.dialogId),
|
18483
18485
|
newToOld: params.newToOld,
|
18484
18486
|
rows: params.count
|
18485
18487
|
};
|
@@ -18495,7 +18497,7 @@ const getRemoteMessages = params => {
|
|
18495
18497
|
};
|
18496
18498
|
const deleteMessages$1 = (dialogId, messageUIds) => {
|
18497
18499
|
const reqPromise = webSocketServer.send(CmdIds$1.DeleteChatMessages, {
|
18498
|
-
destId: dialogId,
|
18500
|
+
destId: Long.fromString(dialogId),
|
18499
18501
|
msgIdList: messageUIds.map(e => Long.fromString(e))
|
18500
18502
|
}, {
|
18501
18503
|
encoder: DeleteChatMessageReq,
|
@@ -18505,7 +18507,7 @@ const deleteMessages$1 = (dialogId, messageUIds) => {
|
|
18505
18507
|
};
|
18506
18508
|
const clearHistoryMessage = (dialogId, timestamp) => {
|
18507
18509
|
return webSocketServer.send(CmdIds$1.ClearChatHistoryMessage, {
|
18508
|
-
destId: dialogId,
|
18510
|
+
destId: Long.fromString(dialogId),
|
18509
18511
|
type: extractConversationType(dialogId) == ConversationType.GROUP ? 1 : 0,
|
18510
18512
|
msgTime: Long.fromNumber(timestamp)
|
18511
18513
|
}, {
|
@@ -18519,7 +18521,7 @@ const getDialogList = params => webSocketServer.send(CmdIds$1.GetDialogList, par
|
|
18519
18521
|
});
|
18520
18522
|
const getBriefDialogList = dialogIds => {
|
18521
18523
|
return webSocketServer.send(CmdIds$1.GetBriefDialogList, {
|
18522
|
-
destId: dialogIds
|
18524
|
+
destId: dialogIds.map(e => Long.fromString(e))
|
18523
18525
|
}, {
|
18524
18526
|
encoder: GetBriefDialogListReq,
|
18525
18527
|
decoder: GetBriefDialogListResp
|
@@ -18529,7 +18531,7 @@ const updateChatMuteConfig = (dialogId, muteFlag) => {
|
|
18529
18531
|
let reqPromise;
|
18530
18532
|
if (extractConversationType(dialogId) == ConversationType.GROUP) {
|
18531
18533
|
reqPromise = webSocketServer.send(CmdIds$1.UpdateGroupChatMuteConfig, {
|
18532
|
-
groupId: dialogId,
|
18534
|
+
groupId: Long.fromString(dialogId),
|
18533
18535
|
muteFlag
|
18534
18536
|
}, {
|
18535
18537
|
encoder: UpdateGroupChatDialogMuteConfigReq,
|
@@ -18537,7 +18539,7 @@ const updateChatMuteConfig = (dialogId, muteFlag) => {
|
|
18537
18539
|
});
|
18538
18540
|
} else {
|
18539
18541
|
reqPromise = webSocketServer.send(CmdIds$1.UpdatePrivateChatMuteConfig, {
|
18540
|
-
destId: dialogId,
|
18542
|
+
destId: Long.fromString(dialogId),
|
18541
18543
|
muteFlag
|
18542
18544
|
}, {
|
18543
18545
|
encoder: UpdatePrivateChatDialogMuteConfigReq,
|
@@ -18550,7 +18552,7 @@ const updateChatStickyConfig = (dialogId, stickyFlag) => {
|
|
18550
18552
|
let reqPromise;
|
18551
18553
|
if (extractConversationType(dialogId) == ConversationType.GROUP) {
|
18552
18554
|
reqPromise = webSocketServer.send(CmdIds$1.UpdateGroupChatStickyConfig, {
|
18553
|
-
groupId: dialogId,
|
18555
|
+
groupId: Long.fromString(dialogId),
|
18554
18556
|
stickyFlag
|
18555
18557
|
}, {
|
18556
18558
|
encoder: UpdateGroupChatDialogStickyConfigReq,
|
@@ -18558,7 +18560,7 @@ const updateChatStickyConfig = (dialogId, stickyFlag) => {
|
|
18558
18560
|
});
|
18559
18561
|
} else {
|
18560
18562
|
reqPromise = webSocketServer.send(CmdIds$1.UpdatePrivateChatStickyConfig, {
|
18561
|
-
destId: dialogId,
|
18563
|
+
destId: Long.fromString(dialogId),
|
18562
18564
|
stickyFlag
|
18563
18565
|
}, {
|
18564
18566
|
encoder: UpdatePrivateChatDialogStickyConfigReq,
|
@@ -18571,14 +18573,14 @@ const deleteDialog = dialogId => {
|
|
18571
18573
|
let reqPromise;
|
18572
18574
|
if (extractConversationType(dialogId) == ConversationType.GROUP) {
|
18573
18575
|
reqPromise = webSocketServer.send(CmdIds$1.DeleteGroupDialog, {
|
18574
|
-
groupId: dialogId
|
18576
|
+
groupId: Long.fromString(dialogId)
|
18575
18577
|
}, {
|
18576
18578
|
encoder: DeleteGroupChatDialogReq,
|
18577
18579
|
decoder: rpc_baseExports.BaseResp
|
18578
18580
|
});
|
18579
18581
|
} else {
|
18580
18582
|
reqPromise = webSocketServer.send(CmdIds$1.DeletePrivateDialog, {
|
18581
|
-
destId: dialogId
|
18583
|
+
destId: Long.fromString(dialogId)
|
18582
18584
|
}, {
|
18583
18585
|
encoder: DeletePrivateChatDialogReq,
|
18584
18586
|
decoder: rpc_baseExports.BaseResp
|
@@ -18888,7 +18890,7 @@ const parseSingleDialogMessages = (dialogId, originalMessageList, aesKey) => {
|
|
18888
18890
|
if (isDef(messageInstance)) {
|
18889
18891
|
const receivedMessage = {
|
18890
18892
|
...conversation,
|
18891
|
-
senderUserId: dialogMessage.srcId,
|
18893
|
+
senderUserId: dialogMessage.srcId.toString(),
|
18892
18894
|
messageDirection: dialogMessage.isOut ? MessageDirection.SEND : MessageDirection.RECEIVE,
|
18893
18895
|
isCounted: messageInstance.isCounted,
|
18894
18896
|
isMentioned: dialogMessage.atFlag,
|
@@ -18896,11 +18898,11 @@ const parseSingleDialogMessages = (dialogId, originalMessageList, aesKey) => {
|
|
18896
18898
|
messageType: messageInstance.messageType,
|
18897
18899
|
isOffLineMessage: false,
|
18898
18900
|
isPersited: messageInstance.isPersited,
|
18899
|
-
messageId: Long.isLong(dialogMessage.localId) ? dialogMessage.localId : undefined,
|
18900
|
-
messageUId: dialogMessage.msgId,
|
18901
|
-
sentTime: dialogMessage.seqno,
|
18901
|
+
messageId: Long.isLong(dialogMessage.localId) ? dialogMessage.localId.toString() : undefined,
|
18902
|
+
messageUId: dialogMessage.msgId.toString(),
|
18903
|
+
sentTime: dialogMessage.seqno.toString(),
|
18902
18904
|
sentStatus: SentStatus.SENT,
|
18903
|
-
receivedTime:
|
18905
|
+
receivedTime: getServerTime$1().toString(),
|
18904
18906
|
isStatusMessage: messageInstance.isStatusMessage,
|
18905
18907
|
receivedStatus: ReceivedStatus.READ,
|
18906
18908
|
disableNotification: false
|
@@ -19011,7 +19013,7 @@ class ConversationStore {
|
|
19011
19013
|
const arr = key.split('_');
|
19012
19014
|
if (arr.length >= 2) {
|
19013
19015
|
const conversationType = arr.shift();
|
19014
|
-
const targetId =
|
19016
|
+
const targetId = arr.shift();
|
19015
19017
|
return {
|
19016
19018
|
conversationType: Number(conversationType),
|
19017
19019
|
targetId
|
@@ -19019,7 +19021,7 @@ class ConversationStore {
|
|
19019
19021
|
}
|
19020
19022
|
return {
|
19021
19023
|
conversationType: ConversationType.PRIVATE,
|
19022
|
-
targetId:
|
19024
|
+
targetId: '0'
|
19023
19025
|
};
|
19024
19026
|
}
|
19025
19027
|
updateUnreadCount(message) {
|
@@ -19177,7 +19179,7 @@ const transBriefDialog2IReceivedConversation = dialog => {
|
|
19177
19179
|
notificationStatus: dialog.muteFlag ? NotificationStatus.OPEN : NotificationStatus.CLOSE,
|
19178
19180
|
notificationLevel: dialog.muteFlag ? NotificationLevel.NOT_MESSAGE_NOTIFICATION : NotificationLevel.ALL_MESSAGE,
|
19179
19181
|
isTop: !!dialog.stickyFlag,
|
19180
|
-
lastUnreadTime:
|
19182
|
+
lastUnreadTime: '0'
|
19181
19183
|
};
|
19182
19184
|
return conversationObj;
|
19183
19185
|
};
|
@@ -19330,7 +19332,7 @@ class ConversationManager {
|
|
19330
19332
|
conversationType,
|
19331
19333
|
targetId
|
19332
19334
|
};
|
19333
|
-
const updatedTime =
|
19335
|
+
const updatedTime = getServerTime$1().toString();
|
19334
19336
|
const storageConversation = this.store.get(conOpt);
|
19335
19337
|
const updatedItems = {};
|
19336
19338
|
if (isDef(notificationLevel) && storageConversation.notificationLevel !== notificationLevel) {
|
@@ -19696,7 +19698,7 @@ class MessageLoader {
|
|
19696
19698
|
const conversationType = extractConversationType(Long.fromString(dialogId));
|
19697
19699
|
return {
|
19698
19700
|
conversationType,
|
19699
|
-
targetId:
|
19701
|
+
targetId: dialogId
|
19700
19702
|
};
|
19701
19703
|
});
|
19702
19704
|
ConversationManager$1.get().loadConvsationsIfNotExist(cons);
|
@@ -26537,10 +26539,10 @@ const transSentAttrs2IReceivedMessage = (message, options, sentStatus = SentStat
|
|
26537
26539
|
isOffLineMessage: false,
|
26538
26540
|
isPersited: message.isPersited,
|
26539
26541
|
messageId: options.messageId,
|
26540
|
-
messageUId:
|
26542
|
+
messageUId: '0',
|
26541
26543
|
sentTime: options.sentTime,
|
26542
26544
|
sentStatus,
|
26543
|
-
receivedTime:
|
26545
|
+
receivedTime: '0',
|
26544
26546
|
isStatusMessage: message.isStatusMessage,
|
26545
26547
|
receivedStatus: ReceivedStatus.UNREAD,
|
26546
26548
|
disableNotification: false
|
@@ -26558,11 +26560,7 @@ function generateMessageId() {
|
|
26558
26560
|
|
26559
26561
|
const MAX_MESSAGE_CONTENT_BYTES = 80 * 1024;
|
26560
26562
|
async function sendMessage$1(conversation, message, options) {
|
26561
|
-
|
26562
|
-
if (typeof tmpConversation.targetId === 'string') {
|
26563
|
-
tmpConversation.targetId = Long.fromString(tmpConversation.targetId);
|
26564
|
-
}
|
26565
|
-
return internal_sendMessage(tmpConversation, message, options);
|
26563
|
+
return internal_sendMessage(conversation, message, options);
|
26566
26564
|
}
|
26567
26565
|
const sendRecallMessage = async (conversation, options) => {
|
26568
26566
|
const dialogId = getFullDialogId(conversation);
|
@@ -26579,8 +26577,8 @@ const sendRecallMessage = async (conversation, options) => {
|
|
26579
26577
|
const sentAttris = {
|
26580
26578
|
conversation,
|
26581
26579
|
senderUserId: accountStore.uid,
|
26582
|
-
messageId:
|
26583
|
-
sentTime:
|
26580
|
+
messageId: '0',
|
26581
|
+
sentTime: getServerTime$1().toString()
|
26584
26582
|
};
|
26585
26583
|
const receivedMessage = transSentAttrs2IReceivedMessage(recallCommandMessage, sentAttris, SentStatus.SENT);
|
26586
26584
|
ConversationManager$1.get().setConversationCacheByMessage(receivedMessage);
|
@@ -26627,8 +26625,8 @@ function beforeSend(conversation, message, options) {
|
|
26627
26625
|
const sentArgs = {
|
26628
26626
|
conversation: conversation,
|
26629
26627
|
senderUserId: accountStore.uid,
|
26630
|
-
messageId: options?.messageId ??
|
26631
|
-
sentTime:
|
26628
|
+
messageId: options?.messageId ?? generateMessageId().toString(),
|
26629
|
+
sentTime: getMessageSentTime().toString(),
|
26632
26630
|
pushConfig: options?.pushConfig
|
26633
26631
|
};
|
26634
26632
|
if (options?.onSendBefore) {
|
@@ -26667,7 +26665,7 @@ async function send(message, sentArgs) {
|
|
26667
26665
|
const mediaEncryptedString = aes256Encrypt(mediaAttribute, secretKey);
|
26668
26666
|
SentMessageStore.addMessage(sentArgs.messageId);
|
26669
26667
|
const baseParams = {
|
26670
|
-
localId: sentArgs.messageId,
|
26668
|
+
localId: Long.fromString(sentArgs.messageId),
|
26671
26669
|
mediaFlag: false,
|
26672
26670
|
mediaConstructor: message.messageType,
|
26673
26671
|
msgPreContent: '',
|
@@ -26678,7 +26676,7 @@ async function send(message, sentArgs) {
|
|
26678
26676
|
if (sentArgs.conversation.conversationType === ConversationType.GROUP) {
|
26679
26677
|
const groupParams = {
|
26680
26678
|
...baseParams,
|
26681
|
-
groupId: dialogId
|
26679
|
+
groupId: Long.fromString(dialogId)
|
26682
26680
|
};
|
26683
26681
|
if (isDef(message.content.mentionedInfo)) {
|
26684
26682
|
const mentionedInfo = message.content.mentionedInfo;
|
@@ -26690,13 +26688,13 @@ async function send(message, sentArgs) {
|
|
26690
26688
|
} else {
|
26691
26689
|
const privateParams = {
|
26692
26690
|
...baseParams,
|
26693
|
-
destId: dialogId
|
26691
|
+
destId: Long.fromString(dialogId)
|
26694
26692
|
};
|
26695
26693
|
response = await sendPrivateChatMessage(privateParams);
|
26696
26694
|
}
|
26697
26695
|
if (response.code === ErrorCode.SUCCESS) {
|
26698
|
-
receivedMessage.sentTime = response.data.msgSendTime;
|
26699
|
-
receivedMessage.messageUId = response.data.msgId;
|
26696
|
+
receivedMessage.sentTime = response.data.msgSendTime.toString();
|
26697
|
+
receivedMessage.messageUId = response.data.msgId.toString();
|
26700
26698
|
receivedMessage.sentStatus = SentStatus.SENT;
|
26701
26699
|
ConversationManager$1.get().setConversationCacheByMessage(receivedMessage);
|
26702
26700
|
} else {
|
@@ -26822,7 +26820,7 @@ class IMClient extends EventEmitter {
|
|
26822
26820
|
[dialogId.toString()]: data.msg ?? {}
|
26823
26821
|
}, (_, outputMsgs) => {
|
26824
26822
|
const messageList = outputMsgs.get(dialogId.toString()) ?? [];
|
26825
|
-
messageList.sort((e1, e2) => e1.sentTime.lessThan(e2.sentTime) ? -1 : 1);
|
26823
|
+
messageList.sort((e1, e2) => Long.fromString(e1.sentTime).lessThan(Long.fromString(e2.sentTime)) ? -1 : 1);
|
26826
26824
|
resolve({
|
26827
26825
|
code: ErrorCode.SUCCESS,
|
26828
26826
|
data: {
|
package/index.umd.js
CHANGED
@@ -13268,9 +13268,9 @@
|
|
13268
13268
|
setLogged(info) {
|
13269
13269
|
this._user = {
|
13270
13270
|
active: true,
|
13271
|
-
uid: info.uid
|
13272
|
-
deviceId: info.deviceId,
|
13273
|
-
sessionId: info.sessionId
|
13271
|
+
uid: Long.isLong(info.uid) ? info.uid.toString() : info.uid,
|
13272
|
+
deviceId: Long.isLong(info.deviceId) ? info.deviceId.toString() : info.deviceId,
|
13273
|
+
sessionId: Long.isLong(info.sessionId) ? info.sessionId.toString() : info.sessionId
|
13274
13274
|
};
|
13275
13275
|
}
|
13276
13276
|
logOut() {
|
@@ -13279,9 +13279,9 @@
|
|
13279
13279
|
createDefaultUser() {
|
13280
13280
|
return {
|
13281
13281
|
active: false,
|
13282
|
-
uid:
|
13283
|
-
deviceId:
|
13284
|
-
sessionId:
|
13282
|
+
uid: '0',
|
13283
|
+
deviceId: '0',
|
13284
|
+
sessionId: '0',
|
13285
13285
|
token: ''
|
13286
13286
|
};
|
13287
13287
|
}
|
@@ -13392,9 +13392,9 @@
|
|
13392
13392
|
const networkReq = {
|
13393
13393
|
cmdId: cmdId,
|
13394
13394
|
messageSeq: Long.fromNumber(messageSeq),
|
13395
|
-
deviceId: accountStore.user.deviceId,
|
13396
|
-
sessionId: accountStore.user.sessionId,
|
13397
|
-
uid: accountStore.user.uid,
|
13395
|
+
deviceId: Long.fromString(accountStore.user.deviceId),
|
13396
|
+
sessionId: Long.fromString(accountStore.user.sessionId),
|
13397
|
+
uid: Long.fromString(accountStore.user.uid),
|
13398
13398
|
protocolVersion: SOCKET_PROTOCOL_VER,
|
13399
13399
|
destId: '',
|
13400
13400
|
body: body,
|
@@ -18432,7 +18432,7 @@
|
|
18432
18432
|
const conversationType = extractConversationType(dialogId);
|
18433
18433
|
return {
|
18434
18434
|
conversationType,
|
18435
|
-
targetId:
|
18435
|
+
targetId: Long.isLong(dialogId) ? dialogId.toString() : dialogId
|
18436
18436
|
};
|
18437
18437
|
};
|
18438
18438
|
|
@@ -18446,10 +18446,12 @@
|
|
18446
18446
|
encoder: GetDialogKeyReq,
|
18447
18447
|
decoder: GetDialogKeyResp
|
18448
18448
|
});
|
18449
|
-
const sendPrivateChatMessage = params =>
|
18450
|
-
|
18451
|
-
|
18452
|
-
|
18449
|
+
const sendPrivateChatMessage = params => {
|
18450
|
+
return webSocketServer.send(CmdIds$1.SendPrivateChatMessage, params, {
|
18451
|
+
encoder: SendPrivateChatMessageReq,
|
18452
|
+
decoder: SendPrivateChatMessageResp
|
18453
|
+
});
|
18454
|
+
};
|
18453
18455
|
const sendGroupChatMessage = params => webSocketServer.send(CmdIds$1.SendGroupChatMessage, params, {
|
18454
18456
|
encoder: SendGroupChatMessageReq,
|
18455
18457
|
decoder: SendGroupChatMessageResp
|
@@ -18466,16 +18468,16 @@
|
|
18466
18468
|
let type = extractConversationType(dialogId);
|
18467
18469
|
if (type == exports.ConversationType.GROUP) {
|
18468
18470
|
reqPromise = webSocketServer.send(CmdIds$1.RecallGroupMessage, {
|
18469
|
-
groupId: dialogId,
|
18470
|
-
msgId: messageUId
|
18471
|
+
groupId: Long.fromString(dialogId),
|
18472
|
+
msgId: Long.fromString(messageUId)
|
18471
18473
|
}, {
|
18472
18474
|
encoder: RecallGroupChatMessageReq,
|
18473
18475
|
decoder: rpc_baseExports.BaseResp
|
18474
18476
|
});
|
18475
18477
|
} else {
|
18476
18478
|
reqPromise = webSocketServer.send(CmdIds$1.RecallPrivateMessage, {
|
18477
|
-
destId: dialogId,
|
18478
|
-
msgId: messageUId
|
18479
|
+
destId: Long.fromString(dialogId),
|
18480
|
+
msgId: Long.fromString(messageUId)
|
18479
18481
|
}, {
|
18480
18482
|
encoder: RecallPrivateChatMessageReq,
|
18481
18483
|
decoder: rpc_baseExports.BaseResp
|
@@ -18485,7 +18487,7 @@
|
|
18485
18487
|
};
|
18486
18488
|
const getRemoteMessages = params => {
|
18487
18489
|
const reqParams = {
|
18488
|
-
dialogKeys: params.dialogId,
|
18490
|
+
dialogKeys: Long.fromString(params.dialogId),
|
18489
18491
|
newToOld: params.newToOld,
|
18490
18492
|
rows: params.count
|
18491
18493
|
};
|
@@ -18501,7 +18503,7 @@
|
|
18501
18503
|
};
|
18502
18504
|
const deleteMessages$1 = (dialogId, messageUIds) => {
|
18503
18505
|
const reqPromise = webSocketServer.send(CmdIds$1.DeleteChatMessages, {
|
18504
|
-
destId: dialogId,
|
18506
|
+
destId: Long.fromString(dialogId),
|
18505
18507
|
msgIdList: messageUIds.map(e => Long.fromString(e))
|
18506
18508
|
}, {
|
18507
18509
|
encoder: DeleteChatMessageReq,
|
@@ -18511,7 +18513,7 @@
|
|
18511
18513
|
};
|
18512
18514
|
const clearHistoryMessage = (dialogId, timestamp) => {
|
18513
18515
|
return webSocketServer.send(CmdIds$1.ClearChatHistoryMessage, {
|
18514
|
-
destId: dialogId,
|
18516
|
+
destId: Long.fromString(dialogId),
|
18515
18517
|
type: extractConversationType(dialogId) == exports.ConversationType.GROUP ? 1 : 0,
|
18516
18518
|
msgTime: Long.fromNumber(timestamp)
|
18517
18519
|
}, {
|
@@ -18525,7 +18527,7 @@
|
|
18525
18527
|
});
|
18526
18528
|
const getBriefDialogList = dialogIds => {
|
18527
18529
|
return webSocketServer.send(CmdIds$1.GetBriefDialogList, {
|
18528
|
-
destId: dialogIds
|
18530
|
+
destId: dialogIds.map(e => Long.fromString(e))
|
18529
18531
|
}, {
|
18530
18532
|
encoder: GetBriefDialogListReq,
|
18531
18533
|
decoder: GetBriefDialogListResp
|
@@ -18535,7 +18537,7 @@
|
|
18535
18537
|
let reqPromise;
|
18536
18538
|
if (extractConversationType(dialogId) == exports.ConversationType.GROUP) {
|
18537
18539
|
reqPromise = webSocketServer.send(CmdIds$1.UpdateGroupChatMuteConfig, {
|
18538
|
-
groupId: dialogId,
|
18540
|
+
groupId: Long.fromString(dialogId),
|
18539
18541
|
muteFlag
|
18540
18542
|
}, {
|
18541
18543
|
encoder: UpdateGroupChatDialogMuteConfigReq,
|
@@ -18543,7 +18545,7 @@
|
|
18543
18545
|
});
|
18544
18546
|
} else {
|
18545
18547
|
reqPromise = webSocketServer.send(CmdIds$1.UpdatePrivateChatMuteConfig, {
|
18546
|
-
destId: dialogId,
|
18548
|
+
destId: Long.fromString(dialogId),
|
18547
18549
|
muteFlag
|
18548
18550
|
}, {
|
18549
18551
|
encoder: UpdatePrivateChatDialogMuteConfigReq,
|
@@ -18556,7 +18558,7 @@
|
|
18556
18558
|
let reqPromise;
|
18557
18559
|
if (extractConversationType(dialogId) == exports.ConversationType.GROUP) {
|
18558
18560
|
reqPromise = webSocketServer.send(CmdIds$1.UpdateGroupChatStickyConfig, {
|
18559
|
-
groupId: dialogId,
|
18561
|
+
groupId: Long.fromString(dialogId),
|
18560
18562
|
stickyFlag
|
18561
18563
|
}, {
|
18562
18564
|
encoder: UpdateGroupChatDialogStickyConfigReq,
|
@@ -18564,7 +18566,7 @@
|
|
18564
18566
|
});
|
18565
18567
|
} else {
|
18566
18568
|
reqPromise = webSocketServer.send(CmdIds$1.UpdatePrivateChatStickyConfig, {
|
18567
|
-
destId: dialogId,
|
18569
|
+
destId: Long.fromString(dialogId),
|
18568
18570
|
stickyFlag
|
18569
18571
|
}, {
|
18570
18572
|
encoder: UpdatePrivateChatDialogStickyConfigReq,
|
@@ -18577,14 +18579,14 @@
|
|
18577
18579
|
let reqPromise;
|
18578
18580
|
if (extractConversationType(dialogId) == exports.ConversationType.GROUP) {
|
18579
18581
|
reqPromise = webSocketServer.send(CmdIds$1.DeleteGroupDialog, {
|
18580
|
-
groupId: dialogId
|
18582
|
+
groupId: Long.fromString(dialogId)
|
18581
18583
|
}, {
|
18582
18584
|
encoder: DeleteGroupChatDialogReq,
|
18583
18585
|
decoder: rpc_baseExports.BaseResp
|
18584
18586
|
});
|
18585
18587
|
} else {
|
18586
18588
|
reqPromise = webSocketServer.send(CmdIds$1.DeletePrivateDialog, {
|
18587
|
-
destId: dialogId
|
18589
|
+
destId: Long.fromString(dialogId)
|
18588
18590
|
}, {
|
18589
18591
|
encoder: DeletePrivateChatDialogReq,
|
18590
18592
|
decoder: rpc_baseExports.BaseResp
|
@@ -18894,7 +18896,7 @@
|
|
18894
18896
|
if (isDef(messageInstance)) {
|
18895
18897
|
const receivedMessage = {
|
18896
18898
|
...conversation,
|
18897
|
-
senderUserId: dialogMessage.srcId,
|
18899
|
+
senderUserId: dialogMessage.srcId.toString(),
|
18898
18900
|
messageDirection: dialogMessage.isOut ? exports.MessageDirection.SEND : exports.MessageDirection.RECEIVE,
|
18899
18901
|
isCounted: messageInstance.isCounted,
|
18900
18902
|
isMentioned: dialogMessage.atFlag,
|
@@ -18902,11 +18904,11 @@
|
|
18902
18904
|
messageType: messageInstance.messageType,
|
18903
18905
|
isOffLineMessage: false,
|
18904
18906
|
isPersited: messageInstance.isPersited,
|
18905
|
-
messageId: Long.isLong(dialogMessage.localId) ? dialogMessage.localId : undefined,
|
18906
|
-
messageUId: dialogMessage.msgId,
|
18907
|
-
sentTime: dialogMessage.seqno,
|
18907
|
+
messageId: Long.isLong(dialogMessage.localId) ? dialogMessage.localId.toString() : undefined,
|
18908
|
+
messageUId: dialogMessage.msgId.toString(),
|
18909
|
+
sentTime: dialogMessage.seqno.toString(),
|
18908
18910
|
sentStatus: exports.SentStatus.SENT,
|
18909
|
-
receivedTime:
|
18911
|
+
receivedTime: getServerTime$1().toString(),
|
18910
18912
|
isStatusMessage: messageInstance.isStatusMessage,
|
18911
18913
|
receivedStatus: exports.ReceivedStatus.READ,
|
18912
18914
|
disableNotification: false
|
@@ -19017,7 +19019,7 @@
|
|
19017
19019
|
const arr = key.split('_');
|
19018
19020
|
if (arr.length >= 2) {
|
19019
19021
|
const conversationType = arr.shift();
|
19020
|
-
const targetId =
|
19022
|
+
const targetId = arr.shift();
|
19021
19023
|
return {
|
19022
19024
|
conversationType: Number(conversationType),
|
19023
19025
|
targetId
|
@@ -19025,7 +19027,7 @@
|
|
19025
19027
|
}
|
19026
19028
|
return {
|
19027
19029
|
conversationType: exports.ConversationType.PRIVATE,
|
19028
|
-
targetId:
|
19030
|
+
targetId: '0'
|
19029
19031
|
};
|
19030
19032
|
}
|
19031
19033
|
updateUnreadCount(message) {
|
@@ -19183,7 +19185,7 @@
|
|
19183
19185
|
notificationStatus: dialog.muteFlag ? exports.NotificationStatus.OPEN : exports.NotificationStatus.CLOSE,
|
19184
19186
|
notificationLevel: dialog.muteFlag ? exports.NotificationLevel.NOT_MESSAGE_NOTIFICATION : exports.NotificationLevel.ALL_MESSAGE,
|
19185
19187
|
isTop: !!dialog.stickyFlag,
|
19186
|
-
lastUnreadTime:
|
19188
|
+
lastUnreadTime: '0'
|
19187
19189
|
};
|
19188
19190
|
return conversationObj;
|
19189
19191
|
};
|
@@ -19336,7 +19338,7 @@
|
|
19336
19338
|
conversationType,
|
19337
19339
|
targetId
|
19338
19340
|
};
|
19339
|
-
const updatedTime =
|
19341
|
+
const updatedTime = getServerTime$1().toString();
|
19340
19342
|
const storageConversation = this.store.get(conOpt);
|
19341
19343
|
const updatedItems = {};
|
19342
19344
|
if (isDef(notificationLevel) && storageConversation.notificationLevel !== notificationLevel) {
|
@@ -19702,7 +19704,7 @@
|
|
19702
19704
|
const conversationType = extractConversationType(Long.fromString(dialogId));
|
19703
19705
|
return {
|
19704
19706
|
conversationType,
|
19705
|
-
targetId:
|
19707
|
+
targetId: dialogId
|
19706
19708
|
};
|
19707
19709
|
});
|
19708
19710
|
ConversationManager$1.get().loadConvsationsIfNotExist(cons);
|
@@ -26543,10 +26545,10 @@
|
|
26543
26545
|
isOffLineMessage: false,
|
26544
26546
|
isPersited: message.isPersited,
|
26545
26547
|
messageId: options.messageId,
|
26546
|
-
messageUId:
|
26548
|
+
messageUId: '0',
|
26547
26549
|
sentTime: options.sentTime,
|
26548
26550
|
sentStatus,
|
26549
|
-
receivedTime:
|
26551
|
+
receivedTime: '0',
|
26550
26552
|
isStatusMessage: message.isStatusMessage,
|
26551
26553
|
receivedStatus: exports.ReceivedStatus.UNREAD,
|
26552
26554
|
disableNotification: false
|
@@ -26564,11 +26566,7 @@
|
|
26564
26566
|
|
26565
26567
|
const MAX_MESSAGE_CONTENT_BYTES = 80 * 1024;
|
26566
26568
|
async function sendMessage$1(conversation, message, options) {
|
26567
|
-
|
26568
|
-
if (typeof tmpConversation.targetId === 'string') {
|
26569
|
-
tmpConversation.targetId = Long.fromString(tmpConversation.targetId);
|
26570
|
-
}
|
26571
|
-
return internal_sendMessage(tmpConversation, message, options);
|
26569
|
+
return internal_sendMessage(conversation, message, options);
|
26572
26570
|
}
|
26573
26571
|
const sendRecallMessage = async (conversation, options) => {
|
26574
26572
|
const dialogId = getFullDialogId(conversation);
|
@@ -26585,8 +26583,8 @@
|
|
26585
26583
|
const sentAttris = {
|
26586
26584
|
conversation,
|
26587
26585
|
senderUserId: accountStore.uid,
|
26588
|
-
messageId:
|
26589
|
-
sentTime:
|
26586
|
+
messageId: '0',
|
26587
|
+
sentTime: getServerTime$1().toString()
|
26590
26588
|
};
|
26591
26589
|
const receivedMessage = transSentAttrs2IReceivedMessage(recallCommandMessage, sentAttris, exports.SentStatus.SENT);
|
26592
26590
|
ConversationManager$1.get().setConversationCacheByMessage(receivedMessage);
|
@@ -26633,8 +26631,8 @@
|
|
26633
26631
|
const sentArgs = {
|
26634
26632
|
conversation: conversation,
|
26635
26633
|
senderUserId: accountStore.uid,
|
26636
|
-
messageId: options?.messageId ??
|
26637
|
-
sentTime:
|
26634
|
+
messageId: options?.messageId ?? generateMessageId().toString(),
|
26635
|
+
sentTime: getMessageSentTime().toString(),
|
26638
26636
|
pushConfig: options?.pushConfig
|
26639
26637
|
};
|
26640
26638
|
if (options?.onSendBefore) {
|
@@ -26673,7 +26671,7 @@
|
|
26673
26671
|
const mediaEncryptedString = aes256Encrypt(mediaAttribute, secretKey);
|
26674
26672
|
SentMessageStore.addMessage(sentArgs.messageId);
|
26675
26673
|
const baseParams = {
|
26676
|
-
localId: sentArgs.messageId,
|
26674
|
+
localId: Long.fromString(sentArgs.messageId),
|
26677
26675
|
mediaFlag: false,
|
26678
26676
|
mediaConstructor: message.messageType,
|
26679
26677
|
msgPreContent: '',
|
@@ -26684,7 +26682,7 @@
|
|
26684
26682
|
if (sentArgs.conversation.conversationType === exports.ConversationType.GROUP) {
|
26685
26683
|
const groupParams = {
|
26686
26684
|
...baseParams,
|
26687
|
-
groupId: dialogId
|
26685
|
+
groupId: Long.fromString(dialogId)
|
26688
26686
|
};
|
26689
26687
|
if (isDef(message.content.mentionedInfo)) {
|
26690
26688
|
const mentionedInfo = message.content.mentionedInfo;
|
@@ -26696,13 +26694,13 @@
|
|
26696
26694
|
} else {
|
26697
26695
|
const privateParams = {
|
26698
26696
|
...baseParams,
|
26699
|
-
destId: dialogId
|
26697
|
+
destId: Long.fromString(dialogId)
|
26700
26698
|
};
|
26701
26699
|
response = await sendPrivateChatMessage(privateParams);
|
26702
26700
|
}
|
26703
26701
|
if (response.code === exports.ErrorCode.SUCCESS) {
|
26704
|
-
receivedMessage.sentTime = response.data.msgSendTime;
|
26705
|
-
receivedMessage.messageUId = response.data.msgId;
|
26702
|
+
receivedMessage.sentTime = response.data.msgSendTime.toString();
|
26703
|
+
receivedMessage.messageUId = response.data.msgId.toString();
|
26706
26704
|
receivedMessage.sentStatus = exports.SentStatus.SENT;
|
26707
26705
|
ConversationManager$1.get().setConversationCacheByMessage(receivedMessage);
|
26708
26706
|
} else {
|
@@ -26828,7 +26826,7 @@
|
|
26828
26826
|
[dialogId.toString()]: data.msg ?? {}
|
26829
26827
|
}, (_, outputMsgs) => {
|
26830
26828
|
const messageList = outputMsgs.get(dialogId.toString()) ?? [];
|
26831
|
-
messageList.sort((e1, e2) => e1.sentTime.lessThan(e2.sentTime) ? -1 : 1);
|
26829
|
+
messageList.sort((e1, e2) => Long.fromString(e1.sentTime).lessThan(Long.fromString(e2.sentTime)) ? -1 : 1);
|
26832
26830
|
resolve({
|
26833
26831
|
code: exports.ErrorCode.SUCCESS,
|
26834
26832
|
data: {
|
package/package.json
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import { ConversationType, NotificationLevel, NotificationStatus } from './statusTypes';
|
2
2
|
import IReceivedMessage from './iReceivedMessage';
|
3
|
-
import Long from 'long';
|
4
3
|
/**
|
5
4
|
* 从服务器拉取到的会话数据结构
|
6
5
|
*/
|
@@ -15,7 +14,7 @@ export default interface IReceivedConversation {
|
|
15
14
|
* 1. 当 `conversationType` 为 `ConversationType.GROUP` 时,该值为群组 Id
|
16
15
|
* 1. 当 `conversationType` 为 `ConversationType.PRIVATE` 时,该值为对方用户 Id
|
17
16
|
*/
|
18
|
-
targetId:
|
17
|
+
targetId: string;
|
19
18
|
/**
|
20
19
|
* 当前会话的未读消息数
|
21
20
|
*/
|
@@ -43,7 +42,7 @@ export default interface IReceivedConversation {
|
|
43
42
|
/**
|
44
43
|
* 会话中消息的最后未读时间
|
45
44
|
*/
|
46
|
-
lastUnreadTime:
|
45
|
+
lastUnreadTime: string;
|
47
46
|
/**
|
48
47
|
* @ 消息未读数
|
49
48
|
*/
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import Long from 'long';
|
2
1
|
import { ConversationType, MessageDirection, SentStatus } from './statusTypes';
|
3
2
|
/**
|
4
3
|
* 消息数据
|
@@ -11,11 +10,11 @@ export default interface IReceivedMessage {
|
|
11
10
|
/**
|
12
11
|
* 会话 targetId
|
13
12
|
*/
|
14
|
-
targetId:
|
13
|
+
targetId: string;
|
15
14
|
/**
|
16
15
|
* 消息发送者的用户 Id
|
17
16
|
*/
|
18
|
-
senderUserId:
|
17
|
+
senderUserId: string;
|
19
18
|
/**
|
20
19
|
* 消息内容
|
21
20
|
*/
|
@@ -28,7 +27,7 @@ export default interface IReceivedMessage {
|
|
28
27
|
/**
|
29
28
|
* 服务端存储的消息 Id
|
30
29
|
*/
|
31
|
-
messageUId:
|
30
|
+
messageUId: string;
|
32
31
|
/**
|
33
32
|
* 消息方向是发出 or 收取
|
34
33
|
*/
|
@@ -40,12 +39,12 @@ export default interface IReceivedMessage {
|
|
40
39
|
/**
|
41
40
|
* 消息在服务器端的发送时间
|
42
41
|
*/
|
43
|
-
sentTime:
|
42
|
+
sentTime: string;
|
44
43
|
/**
|
45
44
|
* 消息接收时间,该时间通过消息的 `sentTime` 值在本地进行计算得出,不推荐使用
|
46
45
|
* @description 当 isOffLineMessage 为 true 时,该值无效
|
47
46
|
*/
|
48
|
-
receivedTime:
|
47
|
+
receivedTime: string;
|
49
48
|
/**
|
50
49
|
* 是否存储
|
51
50
|
* @default true
|
@@ -76,7 +75,7 @@ export default interface IReceivedMessage {
|
|
76
75
|
/**
|
77
76
|
* CPP 独有字段 消息本地 ID
|
78
77
|
*/
|
79
|
-
messageId?:
|
78
|
+
messageId?: string;
|
80
79
|
/**
|
81
80
|
* 消息发送状态
|
82
81
|
*/
|
@@ -1,10 +1,9 @@
|
|
1
|
-
import Long from "long";
|
2
1
|
import { IBaseMessageBody } from "../baseMessage";
|
3
2
|
/**
|
4
3
|
* 撤回通知消息(被撤回消息摘要)
|
5
4
|
*/
|
6
5
|
export interface IRecallCommandMessageBody extends IBaseMessageBody {
|
7
|
-
msgId:
|
6
|
+
msgId: string;
|
8
7
|
}
|
9
8
|
declare const RecallCommandMessage: new (content: IRecallCommandMessageBody) => import("../baseMessage").BaseMessage<IRecallCommandMessageBody>;
|
10
9
|
export default RecallCommandMessage;
|
package/types/types.d.ts
CHANGED
@@ -2,7 +2,6 @@ import { BaseMessage, IExtraData, IUserInfo } from './model/baseMessage';
|
|
2
2
|
import IReceivedMessage from './model/iReceivedMessage';
|
3
3
|
import { ConnectionStatus, ConversationType, ErrorCode, IUserProfile, MessageDirection, NotificationLevel, NotificationStatus } from './model/statusTypes';
|
4
4
|
import IReceivedConversation from './model/iReceivedConversation';
|
5
|
-
import Long from 'long';
|
6
5
|
export declare enum LogLevel {
|
7
6
|
DEBUG = 0,
|
8
7
|
INFO = 1,
|
@@ -24,9 +23,9 @@ export type IInitOption = {
|
|
24
23
|
serverInfo?: string;
|
25
24
|
};
|
26
25
|
export interface ProfileInfo {
|
27
|
-
deviceId:
|
28
|
-
sessionId:
|
29
|
-
uid:
|
26
|
+
deviceId: string;
|
27
|
+
sessionId: string;
|
28
|
+
uid: string;
|
30
29
|
}
|
31
30
|
export declare enum Events {
|
32
31
|
CONNECTING = "CONNECTING",
|
@@ -57,7 +56,7 @@ export type EventListeners = {
|
|
57
56
|
};
|
58
57
|
export interface IBaseConversationInfo {
|
59
58
|
conversationType: ConversationType;
|
60
|
-
targetId:
|
59
|
+
targetId: string;
|
61
60
|
}
|
62
61
|
export interface IConversationState extends IBaseConversationInfo {
|
63
62
|
unreadCount: number;
|
@@ -72,7 +71,7 @@ export interface IConversationState extends IBaseConversationInfo {
|
|
72
71
|
export type IConversationOption = IBaseConversationInfo;
|
73
72
|
export type IUpdatedConversationItemKeys = Extract<keyof IReceivedConversation, 'isTop' | 'notificationStatus' | 'notificationLevel' | 'unreadMessageCount' | 'hasMentioned' | 'unreadMentionedCount' | 'latestMessage'>;
|
74
73
|
export type IUpdatedConversationItem = Partial<Record<IUpdatedConversationItemKeys, {
|
75
|
-
time:
|
74
|
+
time: string;
|
76
75
|
val: any;
|
77
76
|
}>>;
|
78
77
|
/**
|
@@ -118,7 +117,7 @@ export interface ISendMessageOptions {
|
|
118
117
|
* 当要重发消息时所有参数需与原始消息参数一致,messageId 必须存在。
|
119
118
|
* 正常发消息时无需传该参数。
|
120
119
|
*/
|
121
|
-
messageId?:
|
120
|
+
messageId?: string;
|
122
121
|
/**
|
123
122
|
* 推送配置,用于配置移动端远程推送的推送栏显示内容
|
124
123
|
*/
|
@@ -172,11 +171,11 @@ export interface IRecallMessageOptions {
|
|
172
171
|
/**
|
173
172
|
* 消息的唯一id,客户端依赖此属性查找要撤回的消息
|
174
173
|
*/
|
175
|
-
messageUId:
|
174
|
+
messageUId: string;
|
176
175
|
/**
|
177
176
|
* 消息发送时间,服务端依赖此属性查找要撤回的消息
|
178
177
|
*/
|
179
|
-
sentTime:
|
178
|
+
sentTime: string;
|
180
179
|
/**
|
181
180
|
* 撤回消息携带用户信息
|
182
181
|
*/
|