@onyx-p/imlib-web 1.8.7 → 1.8.8

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
@@ -28561,8 +28561,8 @@ class IMClient extends EventEmitter {
28561
28561
  });
28562
28562
  }
28563
28563
  async getPreviousHistoryMessages(conversation, timestamp, count = 20) {
28564
- const cachedMessages = MessageCache.get().getPreviousMessages(conversation, timestamp, count);
28565
- if (!timestamp) {
28564
+ const cachedMessages = MessageCache.get().getPreviousMessages(conversation, timestamp ?? "0", count);
28565
+ if (!timestamp && cachedMessages.length) {
28566
28566
  ConversationManager$1.get().refreshLatestMessage(conversation, cachedMessages[cachedMessages.length - 1]);
28567
28567
  }
28568
28568
  if (cachedMessages.length >= count) {
@@ -29973,7 +29973,6 @@ const getHistoryMessages = async (conversation, options) => {
29973
29973
  return response;
29974
29974
  };
29975
29975
  const getRemoteHistoryMessages = async (conversation, options) => {
29976
- assert('options.timestamp', options.timestamp ?? 0, AssertRules.NUMBER);
29977
29976
  assert('options.count', options.count ?? 0, AssertRules.NUMBER);
29978
29977
  assert('options.order', options.order ?? 0, value => {
29979
29978
  return value === 0 || value === 1;
@@ -29981,8 +29980,11 @@ const getRemoteHistoryMessages = async (conversation, options) => {
29981
29980
  assert('conversation', conversation, AssertRules.CONVERSATION, true);
29982
29981
  const paramsStr = 'conversationType:' + conversation.conversationType + ',targetId:' + conversation.targetId;
29983
29982
  logger.debug('get remote history message ->' + paramsStr);
29983
+ if (isDef(options.timestamp)) {
29984
+ options.timestamp = options.timestamp.toString();
29985
+ }
29984
29986
  let response;
29985
- if (options.order === 0) {
29987
+ if (!options.order) {
29986
29988
  response = await imClient.getPreviousHistoryMessages(conversation, options.timestamp, options.count);
29987
29989
  } else {
29988
29990
  response = await imClient.getRemoteHistoryMessages(conversation, options);
package/index.umd.js CHANGED
@@ -28567,8 +28567,8 @@
28567
28567
  });
28568
28568
  }
28569
28569
  async getPreviousHistoryMessages(conversation, timestamp, count = 20) {
28570
- const cachedMessages = MessageCache.get().getPreviousMessages(conversation, timestamp, count);
28571
- if (!timestamp) {
28570
+ const cachedMessages = MessageCache.get().getPreviousMessages(conversation, timestamp ?? "0", count);
28571
+ if (!timestamp && cachedMessages.length) {
28572
28572
  ConversationManager$1.get().refreshLatestMessage(conversation, cachedMessages[cachedMessages.length - 1]);
28573
28573
  }
28574
28574
  if (cachedMessages.length >= count) {
@@ -29979,7 +29979,6 @@
29979
29979
  return response;
29980
29980
  };
29981
29981
  const getRemoteHistoryMessages = async (conversation, options) => {
29982
- assert('options.timestamp', options.timestamp ?? 0, AssertRules.NUMBER);
29983
29982
  assert('options.count', options.count ?? 0, AssertRules.NUMBER);
29984
29983
  assert('options.order', options.order ?? 0, value => {
29985
29984
  return value === 0 || value === 1;
@@ -29987,8 +29986,11 @@
29987
29986
  assert('conversation', conversation, AssertRules.CONVERSATION, true);
29988
29987
  const paramsStr = 'conversationType:' + conversation.conversationType + ',targetId:' + conversation.targetId;
29989
29988
  logger.debug('get remote history message ->' + paramsStr);
29989
+ if (isDef(options.timestamp)) {
29990
+ options.timestamp = options.timestamp.toString();
29991
+ }
29990
29992
  let response;
29991
- if (options.order === 0) {
29993
+ if (!options.order) {
29992
29994
  response = await imClient.getPreviousHistoryMessages(conversation, options.timestamp, options.count);
29993
29995
  } else {
29994
29996
  response = await imClient.getRemoteHistoryMessages(conversation, options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onyx-p/imlib-web",
3
- "version": "1.8.7",
3
+ "version": "1.8.8",
4
4
  "main": "index.umd.js",
5
5
  "module": "index.esm.js",
6
6
  "types": "types/index.d.ts",