durable-actors-observer 0.8.1 → 0.9.0

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/client.d.ts CHANGED
@@ -103,6 +103,7 @@ export interface RequestTracePage {
103
103
  nextCursor?: string | null;
104
104
  resumeCursor?: string;
105
105
  reset?: boolean;
106
+ snapshot?: boolean;
106
107
  epoch: string;
107
108
  cursor: number;
108
109
  capacity: number;
package/dist/index.js CHANGED
@@ -252,7 +252,7 @@ function xe({ bounds: e, range: n, onChange: i, children: o }) {
252
252
  //#endregion
253
253
  //#region src/request-timeline.ts
254
254
  function Se(e) {
255
- let t = [...e].sort((e, t) => e.startedAtMs - t.startedAtMs || e.sequence - t.sequence), n = t[0]?.startedAtMs ?? 0, r = n, i = /* @__PURE__ */ new Map(), a = t.map((e) => {
255
+ let t = [...e].sort((e, t) => e.startedAtMs - t.startedAtMs || e.sequence - t.sequence || (e.eventId ?? "").localeCompare(t.eventId ?? "")), n = t[0]?.startedAtMs ?? 0, r = n, i = /* @__PURE__ */ new Map(), a = t.map((e) => {
256
256
  let t = JSON.stringify([
257
257
  e.projectId,
258
258
  e.actorName,
@@ -1235,12 +1235,12 @@ function St(e, n = !0) {
1235
1235
  };
1236
1236
  }
1237
1237
  function Ct(e, t) {
1238
- let n = new Map((e?.epoch === t.epoch && !t.reset ? e.records : []).map((e) => [e.eventId ?? e.sequence, e]));
1238
+ let n = new Map((e?.epoch === t.epoch && !t.reset && !t.snapshot ? e.records : []).map((e) => [e.eventId ?? e.sequence, e]));
1239
1239
  for (let e of t.records) n.set(e.eventId ?? e.sequence, e);
1240
1240
  return {
1241
1241
  ...t,
1242
1242
  reset: t.reset || e?.epoch === t.epoch && e.reset,
1243
- records: [...n.values()].sort((e, t) => t.sequence - e.sequence).slice(0, t.capacity)
1243
+ records: [...n.values()].sort((e, t) => t.sequence - e.sequence || (t.eventId ?? "").localeCompare(e.eventId ?? "")).slice(0, t.capacity)
1244
1244
  };
1245
1245
  }
1246
1246
  function wt(e, n, r, i = 1e4) {
@@ -4347,7 +4347,7 @@ function Ar(e) {
4347
4347
  t.capacity,
4348
4348
  t.evicted,
4349
4349
  t.dropped
4350
- ].every(jr) && (t.persistenceFailed === void 0 || typeof t.persistenceFailed == "boolean") && (t.nextCursor == null || typeof t.nextCursor == "string") && (t.resumeCursor === void 0 || typeof t.resumeCursor == "string") && (t.reset === void 0 || typeof t.reset == "boolean") && t.capacity > 0 && t.capacity <= 500 && Array.isArray(t.records) && t.records.length <= t.capacity && t.records.every((e) => Mr(e) && e.sequence <= t.cursor);
4350
+ ].every(jr) && (t.persistenceFailed === void 0 || typeof t.persistenceFailed == "boolean") && (t.nextCursor == null || typeof t.nextCursor == "string") && (t.resumeCursor === void 0 || typeof t.resumeCursor == "string") && (t.reset === void 0 || typeof t.reset == "boolean") && (t.snapshot === void 0 || typeof t.snapshot == "boolean") && t.capacity > 0 && t.capacity <= 500 && Array.isArray(t.records) && t.records.length <= t.capacity && t.records.every((e) => Mr(e) && e.sequence <= t.cursor);
4351
4351
  }
4352
4352
  function jr(e) {
4353
4353
  return Number.isSafeInteger(e) && Number(e) >= 0;