@harperfast/harper 5.0.20 → 5.0.21

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.
@@ -272,6 +272,8 @@ function makeTable(options) {
272
272
  ensureLoaded: false,
273
273
  nodeId: event.nodeId,
274
274
  viaNodeId: event.viaNodeId,
275
+ // use per-event expiresAt: batched txn context only holds the first event's expiration
276
+ expiresAt: event.expiresAt,
275
277
  async: true,
276
278
  };
277
279
  const id = event.id;
@@ -1578,7 +1580,7 @@ function makeTable(options) {
1578
1580
  let residencyId;
1579
1581
  if (options?.residencyId != undefined)
1580
1582
  residencyId = options.residencyId;
1581
- const expiresAt = context?.expiresAt ?? (expirationMs ? expirationMs + Date.now() : -1);
1583
+ const expiresAt = options?.expiresAt ?? context?.expiresAt ?? (expirationMs ? expirationMs + Date.now() : -1);
1582
1584
  const additionalAuditRefs = []; // track additional audit refs to store
1583
1585
  if (precedesExisting <= 0) {
1584
1586
  // This block is to handle the case of saving an update where the transaction timestamp is older than the
@@ -1759,8 +1761,8 @@ function makeTable(options) {
1759
1761
  })());
1760
1762
  updateIndices(id, existingRecord, recordToStore, transaction && { transaction });
1761
1763
  writeCommit(true);
1762
- if (context.expiresAt)
1763
- scheduleCleanup();
1764
+ if (expiresAt >= 0)
1765
+ scheduleCleanup(); // arm for replicated writes too, not just local-context writes
1764
1766
  function writeCommit(storeRecord) {
1765
1767
  // we need to write the commit. if storeRecord then we need to store the record, otherwise we just need to store the audit record
1766
1768
  updateRecord(id, storeRecord ? recordToStore : undefined, storeRecord ? existingEntry : { ...existingEntry, value: undefined }, isRocksDB