@orangecheck/chat-core 0.2.0 → 0.2.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/dist/index.mjs CHANGED
@@ -920,6 +920,7 @@ var PAGE = 200;
920
920
  var MAX_DIRECTORY_PAGES = 25;
921
921
  var AUDIT_PAGES = 2;
922
922
  var HEADER_BUDGET = 128;
923
+ var sentOn = (got) => Math.max(got.sent ?? 0, got.events.length);
923
924
  var REFERENCE_LEGACY_CLAIMS = directory_legacy_default;
924
925
  var legacyIndex = (entries) => new Map(entries.map((e) => [e.listing_event_id, e]));
925
926
  async function readAll(page, relay, d, maxPages) {
@@ -941,7 +942,7 @@ async function readAll(page, relay, d, maxPages) {
941
942
  }
942
943
  until = until === void 0 ? ev.created_at : Math.min(until, ev.created_at);
943
944
  }
944
- if (got.events.length < PAGE) return [...seen.values()];
945
+ if (sentOn(got) < PAGE) return [...seen.values()];
945
946
  if (added === 0) return null;
946
947
  }
947
948
  return null;
@@ -965,7 +966,7 @@ async function readSome(page, relay, d, pages) {
965
966
  seen.set(ev.id, ev);
966
967
  until = until === void 0 ? ev.created_at : Math.min(until, ev.created_at);
967
968
  }
968
- if (!got.complete || got.events.length < PAGE) break;
969
+ if (!got.complete || sentOn(got) < PAGE) break;
969
970
  }
970
971
  return [...seen.values()];
971
972
  }