@7365admin1/core 3.79.1-staging.355 → 3.79.1-staging.356
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/.changeset/robot-lift-recent.md +5 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/test/e2e/robot-map-lift.e2e.test.mjs +8 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@7365admin1/core": minor
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
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.
|
package/dist/index.d.ts
CHANGED
|
@@ -8961,6 +8961,7 @@ declare function useRobotLiftSessionRepo(): {
|
|
|
8961
8961
|
}) => Promise<ObjectId>;
|
|
8962
8962
|
getSessionById: (id: string | ObjectId) => Promise<mongodb.WithId<TRobotLiftSession>>;
|
|
8963
8963
|
getQueue: (mapId: ObjectId, liftNames: string[]) => Promise<mongodb.WithId<TRobotLiftSession>[]>;
|
|
8964
|
+
getRecent: (mapId: ObjectId, liftNames: string[], since: Date) => Promise<mongodb.WithId<TRobotLiftSession>[]>;
|
|
8964
8965
|
refresh: (id: ObjectId) => Promise<void>;
|
|
8965
8966
|
release: (session: TRobotLiftSession & {
|
|
8966
8967
|
_id: ObjectId;
|
package/dist/index.js
CHANGED
|
@@ -64477,6 +64477,12 @@ function useRobotLiftSessionRepo() {
|
|
|
64477
64477
|
await advance(key, now);
|
|
64478
64478
|
return collection.find({ liftKey: { $in: keys }, open: true }).sort({ requestedAt: 1, _id: 1 }).toArray();
|
|
64479
64479
|
}
|
|
64480
|
+
async function getRecent(mapId, liftNames, since) {
|
|
64481
|
+
const keys = liftNames.map((name) => liftQueueKey(String(mapId), name));
|
|
64482
|
+
if (!keys.length)
|
|
64483
|
+
return [];
|
|
64484
|
+
return collection.find({ liftKey: { $in: keys }, status: { $in: ["released", "expired"] }, closedAt: { $gte: since } }).sort({ closedAt: -1, _id: -1 }).limit(20).toArray();
|
|
64485
|
+
}
|
|
64480
64486
|
async function refresh(id) {
|
|
64481
64487
|
const now = /* @__PURE__ */ new Date();
|
|
64482
64488
|
const res = await collection.updateOne(
|
|
@@ -64532,6 +64538,7 @@ function useRobotLiftSessionRepo() {
|
|
|
64532
64538
|
enqueue,
|
|
64533
64539
|
getSessionById,
|
|
64534
64540
|
getQueue,
|
|
64541
|
+
getRecent,
|
|
64535
64542
|
refresh,
|
|
64536
64543
|
release,
|
|
64537
64544
|
getOpenForRobot,
|
|
@@ -64679,6 +64686,7 @@ function useRobotMapController(deps) {
|
|
|
64679
64686
|
fail(next, e);
|
|
64680
64687
|
}
|
|
64681
64688
|
}
|
|
64689
|
+
const RECENT_LIFT_MS = 10 * 60 * 1e3;
|
|
64682
64690
|
const sessionView = (s) => ({
|
|
64683
64691
|
_id: s._id,
|
|
64684
64692
|
liftName: s.liftName,
|
|
@@ -64690,12 +64698,14 @@ function useRobotMapController(deps) {
|
|
|
64690
64698
|
requestedAt: s.requestedAt,
|
|
64691
64699
|
activeAt: s.activeAt ?? null,
|
|
64692
64700
|
expiresAt: s.expiresAt,
|
|
64701
|
+
closedAt: s.closedAt ?? null,
|
|
64693
64702
|
closedReason: s.closedReason
|
|
64694
64703
|
});
|
|
64695
64704
|
async function queueFor(map) {
|
|
64696
64705
|
const names = (map.lifts ?? []).map((l) => l.name);
|
|
64697
64706
|
const open = await lifts().getQueue(map._id, names);
|
|
64698
64707
|
const at2 = now();
|
|
64708
|
+
const recent = await lifts().getRecent(map._id, names, new Date(at2 - RECENT_LIFT_MS));
|
|
64699
64709
|
return Promise.all(
|
|
64700
64710
|
(map.lifts ?? []).map(async (lift2) => {
|
|
64701
64711
|
const rows = open.filter((s) => s.liftName === lift2.name);
|
|
@@ -64723,7 +64733,8 @@ function useRobotMapController(deps) {
|
|
|
64723
64733
|
phase,
|
|
64724
64734
|
safeToCross: active ? isSafeToCross(state, phase === "boarding" ? String(active.fromFloor) : String(active.toFloor)) : false,
|
|
64725
64735
|
active: active ? sessionView(active) : null,
|
|
64726
|
-
queue: rows.filter((s) => s.status === "queued").map(sessionView)
|
|
64736
|
+
queue: rows.filter((s) => s.status === "queued").map(sessionView),
|
|
64737
|
+
recent: recent.filter((s) => s.liftName === lift2.name).map(sessionView)
|
|
64727
64738
|
};
|
|
64728
64739
|
})
|
|
64729
64740
|
);
|