@onyx-p/imlib-web 2.1.0 → 2.1.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 CHANGED
@@ -9516,7 +9516,7 @@ var CmdIds;
9516
9516
  CmdIds[CmdIds["GetRemoteMessages"] = 1610682419] = "GetRemoteMessages";
9517
9517
  CmdIds[CmdIds["GetSuperGroupRemoteMessages"] = 1610776956] = "GetSuperGroupRemoteMessages";
9518
9518
  CmdIds[CmdIds["DeleteChatMessages"] = 1610682381] = "DeleteChatMessages";
9519
- CmdIds[CmdIds["ClearChatHistoryMessage"] = 1610777164] = "ClearChatHistoryMessage";
9519
+ CmdIds[CmdIds["ClearChatHistoryMessage"] = 1610682421] = "ClearChatHistoryMessage";
9520
9520
  CmdIds[CmdIds["GetDialogList"] = 1610711096] = "GetDialogList";
9521
9521
  CmdIds[CmdIds["GetBriefDialogList"] = 1610682399] = "GetBriefDialogList";
9522
9522
  CmdIds[CmdIds["UpdatePrivateChatMuteConfig"] = 1610682379] = "UpdatePrivateChatMuteConfig";
@@ -15446,9 +15446,10 @@ const CleanHistoryMessageReq = $root$2.CleanHistoryMessageReq = (() => {
15446
15446
  * Properties of a CleanHistoryMessageReq.
15447
15447
  * @exports ICleanHistoryMessageReq
15448
15448
  * @interface ICleanHistoryMessageReq
15449
- * @property {Long|null} [destId] CleanHistoryMessageReq destId
15450
- * @property {number|null} [type] CleanHistoryMessageReq type
15451
- * @property {Long|null} [msgTime] CleanHistoryMessageReq msgTime
15449
+ * @property {string|null} [destId] CleanHistoryMessageReq destId
15450
+ * @property {Long|null} [msgId] CleanHistoryMessageReq msgId
15451
+ * @property {Array.<Long>|null} [msgIdList] CleanHistoryMessageReq msgIdList
15452
+ * @property {Array.<string>|null} [destIdList] CleanHistoryMessageReq destIdList
15452
15453
  */
15453
15454
 
15454
15455
  /**
@@ -15460,32 +15461,42 @@ const CleanHistoryMessageReq = $root$2.CleanHistoryMessageReq = (() => {
15460
15461
  * @param {ICleanHistoryMessageReq=} [properties] Properties to set
15461
15462
  */
15462
15463
  function CleanHistoryMessageReq(properties) {
15464
+ this.msgIdList = [];
15465
+ this.destIdList = [];
15463
15466
  if (properties) for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
15464
15467
  }
15465
15468
 
15466
15469
  /**
15467
15470
  * CleanHistoryMessageReq destId.
15468
- * @member {Long} destId
15471
+ * @member {string} destId
15469
15472
  * @memberof CleanHistoryMessageReq
15470
15473
  * @instance
15471
15474
  */
15472
- CleanHistoryMessageReq.prototype.destId = $util$2.Long ? $util$2.Long.fromBits(0, 0, false) : 0;
15475
+ CleanHistoryMessageReq.prototype.destId = "";
15473
15476
 
15474
15477
  /**
15475
- * CleanHistoryMessageReq type.
15476
- * @member {number} type
15478
+ * CleanHistoryMessageReq msgId.
15479
+ * @member {Long} msgId
15480
+ * @memberof CleanHistoryMessageReq
15481
+ * @instance
15482
+ */
15483
+ CleanHistoryMessageReq.prototype.msgId = $util$2.Long ? $util$2.Long.fromBits(0, 0, false) : 0;
15484
+
15485
+ /**
15486
+ * CleanHistoryMessageReq msgIdList.
15487
+ * @member {Array.<Long>} msgIdList
15477
15488
  * @memberof CleanHistoryMessageReq
15478
15489
  * @instance
15479
15490
  */
15480
- CleanHistoryMessageReq.prototype.type = 0;
15491
+ CleanHistoryMessageReq.prototype.msgIdList = $util$2.emptyArray;
15481
15492
 
15482
15493
  /**
15483
- * CleanHistoryMessageReq msgTime.
15484
- * @member {Long} msgTime
15494
+ * CleanHistoryMessageReq destIdList.
15495
+ * @member {Array.<string>} destIdList
15485
15496
  * @memberof CleanHistoryMessageReq
15486
15497
  * @instance
15487
15498
  */
15488
- CleanHistoryMessageReq.prototype.msgTime = $util$2.Long ? $util$2.Long.fromBits(0, 0, false) : 0;
15499
+ CleanHistoryMessageReq.prototype.destIdList = $util$2.emptyArray;
15489
15500
 
15490
15501
  /**
15491
15502
  * Encodes the specified CleanHistoryMessageReq message. Does not implicitly {@link CleanHistoryMessageReq.verify|verify} messages.
@@ -15498,9 +15509,14 @@ const CleanHistoryMessageReq = $root$2.CleanHistoryMessageReq = (() => {
15498
15509
  */
15499
15510
  CleanHistoryMessageReq.encode = function encode(message, writer) {
15500
15511
  if (!writer) writer = $Writer$2.create();
15501
- if (message.destId != null && Object.hasOwnProperty.call(message, "destId")) writer.uint32(/* id 1, wireType 0 =*/8).int64(message.destId);
15502
- if (message.type != null && Object.hasOwnProperty.call(message, "type")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type);
15503
- if (message.msgTime != null && Object.hasOwnProperty.call(message, "msgTime")) writer.uint32(/* id 3, wireType 0 =*/24).int64(message.msgTime);
15512
+ if (message.destId != null && Object.hasOwnProperty.call(message, "destId")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.destId);
15513
+ if (message.msgId != null && Object.hasOwnProperty.call(message, "msgId")) writer.uint32(/* id 2, wireType 0 =*/16).int64(message.msgId);
15514
+ if (message.msgIdList != null && message.msgIdList.length) {
15515
+ writer.uint32(/* id 3, wireType 2 =*/26).fork();
15516
+ for (let i = 0; i < message.msgIdList.length; ++i) writer.int64(message.msgIdList[i]);
15517
+ writer.ldelim();
15518
+ }
15519
+ if (message.destIdList != null && message.destIdList.length) for (let i = 0; i < message.destIdList.length; ++i) writer.uint32(/* id 4, wireType 2 =*/34).string(message.destIdList[i]);
15504
15520
  return writer;
15505
15521
  };
15506
15522
 
@@ -15524,17 +15540,27 @@ const CleanHistoryMessageReq = $root$2.CleanHistoryMessageReq = (() => {
15524
15540
  switch (tag >>> 3) {
15525
15541
  case 1:
15526
15542
  {
15527
- message.destId = reader.int64();
15543
+ message.destId = reader.string();
15528
15544
  break;
15529
15545
  }
15530
15546
  case 2:
15531
15547
  {
15532
- message.type = reader.int32();
15548
+ message.msgId = reader.int64();
15533
15549
  break;
15534
15550
  }
15535
15551
  case 3:
15536
15552
  {
15537
- message.msgTime = reader.int64();
15553
+ if (!(message.msgIdList && message.msgIdList.length)) message.msgIdList = [];
15554
+ if ((tag & 7) === 2) {
15555
+ let end2 = reader.uint32() + reader.pos;
15556
+ while (reader.pos < end2) message.msgIdList.push(reader.int64());
15557
+ } else message.msgIdList.push(reader.int64());
15558
+ break;
15559
+ }
15560
+ case 4:
15561
+ {
15562
+ if (!(message.destIdList && message.destIdList.length)) message.destIdList = [];
15563
+ message.destIdList.push(reader.string());
15538
15564
  break;
15539
15565
  }
15540
15566
  default:
@@ -19247,11 +19273,9 @@ const deleteMessages$1 = (dialogId, messageUIds) => {
19247
19273
  });
19248
19274
  return reqPromise;
19249
19275
  };
19250
- const clearHistoryMessage = (dialogId, timestamp) => {
19276
+ const clearHistoryMessage = dialogId => {
19251
19277
  return webSocketServer.send(CmdIds$1.ClearChatHistoryMessage, {
19252
- destId: Long.fromString(dialogId),
19253
- type: extractConversationType(dialogId) == ConversationType.GROUP ? 1 : 0,
19254
- msgTime: Long.fromNumber(timestamp)
19278
+ destId: dialogId
19255
19279
  }, {
19256
19280
  encoder: CleanHistoryMessageReq,
19257
19281
  decoder: BaseResp
@@ -29171,10 +29195,10 @@ class IMClient extends EventEmitter {
29171
29195
  MessageCache$1.get()?.removeMessagesByUId(list.map(e => e.messageUId));
29172
29196
  return deleteMessages$1(getFullDialogId(conversation), list.map(e => e.messageUId)).then(result => result.code);
29173
29197
  }
29174
- async deleteRemoteMessageByTimestamp(conversation, timestamp) {
29198
+ async deleteRemoteMessageByTimestamp(conversation) {
29175
29199
  MessageCache$1.get()?.clearConversationCache(conversation);
29176
29200
  ConversationManager$1.get().clearHistoryMessages(conversation);
29177
- return clearHistoryMessage(getFullDialogId(conversation), timestamp === 0 ? Number.MAX_VALUE : timestamp).then(result => result.code);
29201
+ return clearHistoryMessage(getFullDialogId(conversation)).then(result => result.code);
29178
29202
  }
29179
29203
  async getConversationList(count, conversationType, startTime, order) {
29180
29204
  const params = {
@@ -30574,12 +30598,11 @@ const deleteMessages = async (conversation, messages) => {
30574
30598
  code: ErrorCode.SUCCESS
30575
30599
  };
30576
30600
  };
30577
- const clearHistoryMessages = async (conversation, timestamp) => {
30578
- assert('timestamp', timestamp, val => AssertRules.NUMBER(val) && val >= 0, true);
30601
+ const clearHistoryMessages = async conversation => {
30579
30602
  assert('conversation', conversation, AssertRules.CONVERSATION);
30580
30603
  const paramsStr = 'conversationType:' + conversation.conversationType + ',targetId:' + conversation.targetId;
30581
30604
  logger.debug('clear message ->' + paramsStr);
30582
- const code = await imClient.deleteRemoteMessageByTimestamp(conversation, timestamp);
30605
+ const code = await imClient.deleteRemoteMessageByTimestamp(conversation);
30583
30606
  if (code !== ErrorCode.SUCCESS) {
30584
30607
  logger.warn('clear message ->' + code + ':' + ErrorDesc(code) + ',' + paramsStr);
30585
30608
  return {
package/index.umd.js CHANGED
@@ -9522,7 +9522,7 @@
9522
9522
  CmdIds[CmdIds["GetRemoteMessages"] = 1610682419] = "GetRemoteMessages";
9523
9523
  CmdIds[CmdIds["GetSuperGroupRemoteMessages"] = 1610776956] = "GetSuperGroupRemoteMessages";
9524
9524
  CmdIds[CmdIds["DeleteChatMessages"] = 1610682381] = "DeleteChatMessages";
9525
- CmdIds[CmdIds["ClearChatHistoryMessage"] = 1610777164] = "ClearChatHistoryMessage";
9525
+ CmdIds[CmdIds["ClearChatHistoryMessage"] = 1610682421] = "ClearChatHistoryMessage";
9526
9526
  CmdIds[CmdIds["GetDialogList"] = 1610711096] = "GetDialogList";
9527
9527
  CmdIds[CmdIds["GetBriefDialogList"] = 1610682399] = "GetBriefDialogList";
9528
9528
  CmdIds[CmdIds["UpdatePrivateChatMuteConfig"] = 1610682379] = "UpdatePrivateChatMuteConfig";
@@ -15452,9 +15452,10 @@
15452
15452
  * Properties of a CleanHistoryMessageReq.
15453
15453
  * @exports ICleanHistoryMessageReq
15454
15454
  * @interface ICleanHistoryMessageReq
15455
- * @property {Long|null} [destId] CleanHistoryMessageReq destId
15456
- * @property {number|null} [type] CleanHistoryMessageReq type
15457
- * @property {Long|null} [msgTime] CleanHistoryMessageReq msgTime
15455
+ * @property {string|null} [destId] CleanHistoryMessageReq destId
15456
+ * @property {Long|null} [msgId] CleanHistoryMessageReq msgId
15457
+ * @property {Array.<Long>|null} [msgIdList] CleanHistoryMessageReq msgIdList
15458
+ * @property {Array.<string>|null} [destIdList] CleanHistoryMessageReq destIdList
15458
15459
  */
15459
15460
 
15460
15461
  /**
@@ -15466,32 +15467,42 @@
15466
15467
  * @param {ICleanHistoryMessageReq=} [properties] Properties to set
15467
15468
  */
15468
15469
  function CleanHistoryMessageReq(properties) {
15470
+ this.msgIdList = [];
15471
+ this.destIdList = [];
15469
15472
  if (properties) for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
15470
15473
  }
15471
15474
 
15472
15475
  /**
15473
15476
  * CleanHistoryMessageReq destId.
15474
- * @member {Long} destId
15477
+ * @member {string} destId
15475
15478
  * @memberof CleanHistoryMessageReq
15476
15479
  * @instance
15477
15480
  */
15478
- CleanHistoryMessageReq.prototype.destId = $util$2.Long ? $util$2.Long.fromBits(0, 0, false) : 0;
15481
+ CleanHistoryMessageReq.prototype.destId = "";
15479
15482
 
15480
15483
  /**
15481
- * CleanHistoryMessageReq type.
15482
- * @member {number} type
15484
+ * CleanHistoryMessageReq msgId.
15485
+ * @member {Long} msgId
15486
+ * @memberof CleanHistoryMessageReq
15487
+ * @instance
15488
+ */
15489
+ CleanHistoryMessageReq.prototype.msgId = $util$2.Long ? $util$2.Long.fromBits(0, 0, false) : 0;
15490
+
15491
+ /**
15492
+ * CleanHistoryMessageReq msgIdList.
15493
+ * @member {Array.<Long>} msgIdList
15483
15494
  * @memberof CleanHistoryMessageReq
15484
15495
  * @instance
15485
15496
  */
15486
- CleanHistoryMessageReq.prototype.type = 0;
15497
+ CleanHistoryMessageReq.prototype.msgIdList = $util$2.emptyArray;
15487
15498
 
15488
15499
  /**
15489
- * CleanHistoryMessageReq msgTime.
15490
- * @member {Long} msgTime
15500
+ * CleanHistoryMessageReq destIdList.
15501
+ * @member {Array.<string>} destIdList
15491
15502
  * @memberof CleanHistoryMessageReq
15492
15503
  * @instance
15493
15504
  */
15494
- CleanHistoryMessageReq.prototype.msgTime = $util$2.Long ? $util$2.Long.fromBits(0, 0, false) : 0;
15505
+ CleanHistoryMessageReq.prototype.destIdList = $util$2.emptyArray;
15495
15506
 
15496
15507
  /**
15497
15508
  * Encodes the specified CleanHistoryMessageReq message. Does not implicitly {@link CleanHistoryMessageReq.verify|verify} messages.
@@ -15504,9 +15515,14 @@
15504
15515
  */
15505
15516
  CleanHistoryMessageReq.encode = function encode(message, writer) {
15506
15517
  if (!writer) writer = $Writer$2.create();
15507
- if (message.destId != null && Object.hasOwnProperty.call(message, "destId")) writer.uint32(/* id 1, wireType 0 =*/8).int64(message.destId);
15508
- if (message.type != null && Object.hasOwnProperty.call(message, "type")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type);
15509
- if (message.msgTime != null && Object.hasOwnProperty.call(message, "msgTime")) writer.uint32(/* id 3, wireType 0 =*/24).int64(message.msgTime);
15518
+ if (message.destId != null && Object.hasOwnProperty.call(message, "destId")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.destId);
15519
+ if (message.msgId != null && Object.hasOwnProperty.call(message, "msgId")) writer.uint32(/* id 2, wireType 0 =*/16).int64(message.msgId);
15520
+ if (message.msgIdList != null && message.msgIdList.length) {
15521
+ writer.uint32(/* id 3, wireType 2 =*/26).fork();
15522
+ for (let i = 0; i < message.msgIdList.length; ++i) writer.int64(message.msgIdList[i]);
15523
+ writer.ldelim();
15524
+ }
15525
+ if (message.destIdList != null && message.destIdList.length) for (let i = 0; i < message.destIdList.length; ++i) writer.uint32(/* id 4, wireType 2 =*/34).string(message.destIdList[i]);
15510
15526
  return writer;
15511
15527
  };
15512
15528
 
@@ -15530,17 +15546,27 @@
15530
15546
  switch (tag >>> 3) {
15531
15547
  case 1:
15532
15548
  {
15533
- message.destId = reader.int64();
15549
+ message.destId = reader.string();
15534
15550
  break;
15535
15551
  }
15536
15552
  case 2:
15537
15553
  {
15538
- message.type = reader.int32();
15554
+ message.msgId = reader.int64();
15539
15555
  break;
15540
15556
  }
15541
15557
  case 3:
15542
15558
  {
15543
- message.msgTime = reader.int64();
15559
+ if (!(message.msgIdList && message.msgIdList.length)) message.msgIdList = [];
15560
+ if ((tag & 7) === 2) {
15561
+ let end2 = reader.uint32() + reader.pos;
15562
+ while (reader.pos < end2) message.msgIdList.push(reader.int64());
15563
+ } else message.msgIdList.push(reader.int64());
15564
+ break;
15565
+ }
15566
+ case 4:
15567
+ {
15568
+ if (!(message.destIdList && message.destIdList.length)) message.destIdList = [];
15569
+ message.destIdList.push(reader.string());
15544
15570
  break;
15545
15571
  }
15546
15572
  default:
@@ -19253,11 +19279,9 @@
19253
19279
  });
19254
19280
  return reqPromise;
19255
19281
  };
19256
- const clearHistoryMessage = (dialogId, timestamp) => {
19282
+ const clearHistoryMessage = dialogId => {
19257
19283
  return webSocketServer.send(CmdIds$1.ClearChatHistoryMessage, {
19258
- destId: Long.fromString(dialogId),
19259
- type: extractConversationType(dialogId) == exports.ConversationType.GROUP ? 1 : 0,
19260
- msgTime: Long.fromNumber(timestamp)
19284
+ destId: dialogId
19261
19285
  }, {
19262
19286
  encoder: CleanHistoryMessageReq,
19263
19287
  decoder: BaseResp
@@ -29177,10 +29201,10 @@
29177
29201
  MessageCache$1.get()?.removeMessagesByUId(list.map(e => e.messageUId));
29178
29202
  return deleteMessages$1(getFullDialogId(conversation), list.map(e => e.messageUId)).then(result => result.code);
29179
29203
  }
29180
- async deleteRemoteMessageByTimestamp(conversation, timestamp) {
29204
+ async deleteRemoteMessageByTimestamp(conversation) {
29181
29205
  MessageCache$1.get()?.clearConversationCache(conversation);
29182
29206
  ConversationManager$1.get().clearHistoryMessages(conversation);
29183
- return clearHistoryMessage(getFullDialogId(conversation), timestamp === 0 ? Number.MAX_VALUE : timestamp).then(result => result.code);
29207
+ return clearHistoryMessage(getFullDialogId(conversation)).then(result => result.code);
29184
29208
  }
29185
29209
  async getConversationList(count, conversationType, startTime, order) {
29186
29210
  const params = {
@@ -30580,12 +30604,11 @@
30580
30604
  code: exports.ErrorCode.SUCCESS
30581
30605
  };
30582
30606
  };
30583
- const clearHistoryMessages = async (conversation, timestamp) => {
30584
- assert('timestamp', timestamp, val => AssertRules.NUMBER(val) && val >= 0, true);
30607
+ const clearHistoryMessages = async conversation => {
30585
30608
  assert('conversation', conversation, AssertRules.CONVERSATION);
30586
30609
  const paramsStr = 'conversationType:' + conversation.conversationType + ',targetId:' + conversation.targetId;
30587
30610
  logger.debug('clear message ->' + paramsStr);
30588
- const code = await imClient.deleteRemoteMessageByTimestamp(conversation, timestamp);
30611
+ const code = await imClient.deleteRemoteMessageByTimestamp(conversation);
30589
30612
  if (code !== exports.ErrorCode.SUCCESS) {
30590
30613
  logger.warn('clear message ->' + code + ':' + ErrorDesc(code) + ',' + paramsStr);
30591
30614
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onyx-p/imlib-web",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "main": "index.umd.js",
5
5
  "module": "index.esm.js",
6
6
  "types": "types/index.d.ts",
package/types/index.d.ts CHANGED
@@ -222,7 +222,7 @@ export declare const deleteMessages: (conversation: IConversationOption, message
222
222
  * @param conversation 会话
223
223
  * @param timestamp 清除时间点, 该时间之前的消息将被清除
224
224
  */
225
- export declare const clearHistoryMessages: (conversation: IConversationOption, timestamp: number) => IPromiseResult<void>;
225
+ export declare const clearHistoryMessages: (conversation: IConversationOption) => IPromiseResult<void>;
226
226
  export declare const parseChatRecordMsgDetails: (conversation: IConversationOption, detailItems: IChatRecordMsgDetail[]) => IReceivedMessage[];
227
227
  /**
228
228
  * 发送已读回执