@7365admin1/core 3.91.0 → 3.92.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/index.mjs CHANGED
@@ -62709,6 +62709,12 @@ function useRobotLiftSessionRepo() {
62709
62709
  await advance(key, now);
62710
62710
  return collection.find({ liftKey: { $in: keys }, open: true }).sort({ requestedAt: 1, _id: 1 }).toArray();
62711
62711
  }
62712
+ async function getRecent(mapId, liftNames, since) {
62713
+ const keys = liftNames.map((name) => liftQueueKey(String(mapId), name));
62714
+ if (!keys.length)
62715
+ return [];
62716
+ return collection.find({ liftKey: { $in: keys }, status: { $in: ["released", "expired"] }, closedAt: { $gte: since } }).sort({ closedAt: -1, _id: -1 }).limit(20).toArray();
62717
+ }
62712
62718
  async function refresh(id) {
62713
62719
  const now = /* @__PURE__ */ new Date();
62714
62720
  const res = await collection.updateOne(
@@ -62764,6 +62770,7 @@ function useRobotLiftSessionRepo() {
62764
62770
  enqueue,
62765
62771
  getSessionById,
62766
62772
  getQueue,
62773
+ getRecent,
62767
62774
  refresh,
62768
62775
  release,
62769
62776
  getOpenForRobot,
@@ -62911,6 +62918,7 @@ function useRobotMapController(deps) {
62911
62918
  fail(next, e);
62912
62919
  }
62913
62920
  }
62921
+ const RECENT_LIFT_MS = 10 * 60 * 1e3;
62914
62922
  const sessionView = (s) => ({
62915
62923
  _id: s._id,
62916
62924
  liftName: s.liftName,
@@ -62922,12 +62930,14 @@ function useRobotMapController(deps) {
62922
62930
  requestedAt: s.requestedAt,
62923
62931
  activeAt: s.activeAt ?? null,
62924
62932
  expiresAt: s.expiresAt,
62933
+ closedAt: s.closedAt ?? null,
62925
62934
  closedReason: s.closedReason
62926
62935
  });
62927
62936
  async function queueFor(map) {
62928
62937
  const names = (map.lifts ?? []).map((l) => l.name);
62929
62938
  const open = await lifts().getQueue(map._id, names);
62930
62939
  const at2 = now();
62940
+ const recent = await lifts().getRecent(map._id, names, new Date(at2 - RECENT_LIFT_MS));
62931
62941
  return Promise.all(
62932
62942
  (map.lifts ?? []).map(async (lift2) => {
62933
62943
  const rows = open.filter((s) => s.liftName === lift2.name);
@@ -62955,7 +62965,8 @@ function useRobotMapController(deps) {
62955
62965
  phase,
62956
62966
  safeToCross: active ? isSafeToCross(state, phase === "boarding" ? String(active.fromFloor) : String(active.toFloor)) : false,
62957
62967
  active: active ? sessionView(active) : null,
62958
- queue: rows.filter((s) => s.status === "queued").map(sessionView)
62968
+ queue: rows.filter((s) => s.status === "queued").map(sessionView),
62969
+ recent: recent.filter((s) => s.liftName === lift2.name).map(sessionView)
62959
62970
  };
62960
62971
  })
62961
62972
  );