@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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @iservice365/core
2
2
 
3
+ ## 3.92.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 2b0ca36: Lift queue: each lift in `GET /robots/building-maps/:mapId/lifts` now carries `recent` - the rides released or timed out in the last 10 minutes (newest 20) - and every session view carries `closedAt`, so the HERO lift queue can show "released" and "timed out" rows.
8
+
3
9
  ## 3.91.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -8895,6 +8895,7 @@ declare function useRobotLiftSessionRepo(): {
8895
8895
  }) => Promise<ObjectId>;
8896
8896
  getSessionById: (id: string | ObjectId) => Promise<mongodb.WithId<TRobotLiftSession>>;
8897
8897
  getQueue: (mapId: ObjectId, liftNames: string[]) => Promise<mongodb.WithId<TRobotLiftSession>[]>;
8898
+ getRecent: (mapId: ObjectId, liftNames: string[], since: Date) => Promise<mongodb.WithId<TRobotLiftSession>[]>;
8898
8899
  refresh: (id: ObjectId) => Promise<void>;
8899
8900
  release: (session: TRobotLiftSession & {
8900
8901
  _id: ObjectId;
package/dist/index.js CHANGED
@@ -63189,6 +63189,12 @@ function useRobotLiftSessionRepo() {
63189
63189
  await advance(key, now);
63190
63190
  return collection.find({ liftKey: { $in: keys }, open: true }).sort({ requestedAt: 1, _id: 1 }).toArray();
63191
63191
  }
63192
+ async function getRecent(mapId, liftNames, since) {
63193
+ const keys = liftNames.map((name) => liftQueueKey(String(mapId), name));
63194
+ if (!keys.length)
63195
+ return [];
63196
+ return collection.find({ liftKey: { $in: keys }, status: { $in: ["released", "expired"] }, closedAt: { $gte: since } }).sort({ closedAt: -1, _id: -1 }).limit(20).toArray();
63197
+ }
63192
63198
  async function refresh(id) {
63193
63199
  const now = /* @__PURE__ */ new Date();
63194
63200
  const res = await collection.updateOne(
@@ -63244,6 +63250,7 @@ function useRobotLiftSessionRepo() {
63244
63250
  enqueue,
63245
63251
  getSessionById,
63246
63252
  getQueue,
63253
+ getRecent,
63247
63254
  refresh,
63248
63255
  release,
63249
63256
  getOpenForRobot,
@@ -63391,6 +63398,7 @@ function useRobotMapController(deps) {
63391
63398
  fail(next, e);
63392
63399
  }
63393
63400
  }
63401
+ const RECENT_LIFT_MS = 10 * 60 * 1e3;
63394
63402
  const sessionView = (s) => ({
63395
63403
  _id: s._id,
63396
63404
  liftName: s.liftName,
@@ -63402,12 +63410,14 @@ function useRobotMapController(deps) {
63402
63410
  requestedAt: s.requestedAt,
63403
63411
  activeAt: s.activeAt ?? null,
63404
63412
  expiresAt: s.expiresAt,
63413
+ closedAt: s.closedAt ?? null,
63405
63414
  closedReason: s.closedReason
63406
63415
  });
63407
63416
  async function queueFor(map) {
63408
63417
  const names = (map.lifts ?? []).map((l) => l.name);
63409
63418
  const open = await lifts().getQueue(map._id, names);
63410
63419
  const at2 = now();
63420
+ const recent = await lifts().getRecent(map._id, names, new Date(at2 - RECENT_LIFT_MS));
63411
63421
  return Promise.all(
63412
63422
  (map.lifts ?? []).map(async (lift2) => {
63413
63423
  const rows = open.filter((s) => s.liftName === lift2.name);
@@ -63435,7 +63445,8 @@ function useRobotMapController(deps) {
63435
63445
  phase,
63436
63446
  safeToCross: active ? isSafeToCross(state, phase === "boarding" ? String(active.fromFloor) : String(active.toFloor)) : false,
63437
63447
  active: active ? sessionView(active) : null,
63438
- queue: rows.filter((s) => s.status === "queued").map(sessionView)
63448
+ queue: rows.filter((s) => s.status === "queued").map(sessionView),
63449
+ recent: recent.filter((s) => s.liftName === lift2.name).map(sessionView)
63439
63450
  };
63440
63451
  })
63441
63452
  );