@7365admin1/core 3.116.0 → 3.117.1
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 +12 -0
- package/dist/index.d.ts +43 -4
- package/dist/index.js +165 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +163 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/test/padbot-real-data.test.mjs +165 -0
- package/test/padbot.test.mjs +2 -2
- package/test/robot-fault.test.mjs +26 -5
- package/test/robot-vendor-errors.test.mjs +34 -0
package/dist/index.js
CHANGED
|
@@ -351,6 +351,7 @@ __export(src_exports, {
|
|
|
351
351
|
allowsRobotListing: () => allowsRobotListing,
|
|
352
352
|
applyTrackingFrame: () => applyTrackingFrame,
|
|
353
353
|
areaColourToHex: () => areaColourToHex,
|
|
354
|
+
asList: () => asList,
|
|
354
355
|
attendanceSchema: () => attendanceSchema,
|
|
355
356
|
attendanceSettingsSchema: () => attendanceSettingsSchema,
|
|
356
357
|
buildSelfServiceEmailContext: () => buildSelfServiceEmailContext,
|
|
@@ -524,6 +525,7 @@ __export(src_exports, {
|
|
|
524
525
|
moduleGateMode: () => moduleGateMode,
|
|
525
526
|
moduleImpact: () => moduleImpact,
|
|
526
527
|
moduleListGateOn: () => moduleListGateOn,
|
|
528
|
+
networkText: () => networkText,
|
|
527
529
|
newCode: () => newCode,
|
|
528
530
|
newSecret: () => newSecret,
|
|
529
531
|
nfcPatrolSettingsSchema: () => nfcPatrolSettingsSchema,
|
|
@@ -10927,12 +10929,16 @@ function planFaultChanges(open, reading) {
|
|
|
10927
10929
|
want.push({ code: fault.code, message: fault.message || fault.code, since: fault.since });
|
|
10928
10930
|
const clear = [];
|
|
10929
10931
|
const toOpen = [];
|
|
10932
|
+
const refresh = [];
|
|
10930
10933
|
for (const w of want) {
|
|
10931
10934
|
const existing = byCode.get(w.code);
|
|
10932
10935
|
if (!existing) {
|
|
10933
10936
|
toOpen.push(w);
|
|
10934
10937
|
continue;
|
|
10935
10938
|
}
|
|
10939
|
+
if (w.code === OFFLINE_FAULT_CODE && typeof existing.message === "string" && existing.message !== w.message) {
|
|
10940
|
+
refresh.push({ id: existing._id, message: w.message });
|
|
10941
|
+
}
|
|
10936
10942
|
const newOccurrence = typeof w.since === "number" && Math.abs(new Date(existing.since).getTime() - w.since) > SAME_OCCURRENCE_MS;
|
|
10937
10943
|
if (newOccurrence) {
|
|
10938
10944
|
clear.push(existing._id);
|
|
@@ -10947,7 +10953,7 @@ function planFaultChanges(open, reading) {
|
|
|
10947
10953
|
continue;
|
|
10948
10954
|
clear.push(r._id);
|
|
10949
10955
|
}
|
|
10950
|
-
return { open: toOpen, clear };
|
|
10956
|
+
return { open: toOpen, clear, refresh };
|
|
10951
10957
|
}
|
|
10952
10958
|
function robotFaultSweepConfig(env2 = process.env) {
|
|
10953
10959
|
const num3 = (v, def, min, max) => {
|
|
@@ -62422,15 +62428,18 @@ function normalisePatrolPlan(raw) {
|
|
|
62422
62428
|
if (!id || !name || routes.some((x) => x.id === id))
|
|
62423
62429
|
continue;
|
|
62424
62430
|
const checkpoints = (Array.isArray(route.checkpoints) ? route.checkpoints.slice(0, 100) : []).map((c) => ({ name: plainText(c?.name), x: planPct(c?.x), y: planPct(c?.y) })).filter((c) => c.name && c.x !== null && c.y !== null);
|
|
62425
|
-
|
|
62431
|
+
const stops = (Array.isArray(route.stops) ? route.stops.slice(0, 100) : []).map((s) => plainText(s)).filter(Boolean);
|
|
62432
|
+
if (checkpoints.length < 2 && !stops.length)
|
|
62426
62433
|
continue;
|
|
62434
|
+
const drawn = checkpoints.length >= 2 ? checkpoints : [];
|
|
62427
62435
|
const cur = route.currentCheckpoint;
|
|
62428
62436
|
routes.push({
|
|
62429
62437
|
id,
|
|
62430
62438
|
name,
|
|
62431
62439
|
floorNo: Number.isInteger(route.floorNo) ? route.floorNo : null,
|
|
62432
|
-
checkpoints,
|
|
62433
|
-
currentCheckpoint: Number.isInteger(cur) && cur >= 0 && cur <
|
|
62440
|
+
checkpoints: drawn,
|
|
62441
|
+
currentCheckpoint: Number.isInteger(cur) && cur >= 0 && cur < drawn.length ? cur : null,
|
|
62442
|
+
...stops.length ? { stops } : {}
|
|
62434
62443
|
});
|
|
62435
62444
|
}
|
|
62436
62445
|
const schedule = [];
|
|
@@ -62453,7 +62462,7 @@ function normalisePatrolPlan(raw) {
|
|
|
62453
62462
|
continue;
|
|
62454
62463
|
schedule.push({ routeId, days, startTime, endTime, rounds: Math.min(row.rounds, 99) });
|
|
62455
62464
|
}
|
|
62456
|
-
return { routes, schedule };
|
|
62465
|
+
return { routes, schedule, ...r.scheduleShared === false ? { scheduleShared: false } : {} };
|
|
62457
62466
|
}
|
|
62458
62467
|
var COMMAND_NEEDS = {
|
|
62459
62468
|
full: "startProcess",
|
|
@@ -64666,11 +64675,12 @@ function padbotMode(states, now = Date.now()) {
|
|
|
64666
64675
|
return { online: true, mode, statusName: `${base}${networkText(states["1107"])}` };
|
|
64667
64676
|
}
|
|
64668
64677
|
function networkText(net) {
|
|
64678
|
+
const say = (label2, v) => v < 0 ? ` \xB7 ${label2} ${v} dBm` : ` \xB7 ${label2} signal ${v}`;
|
|
64669
64679
|
const wifi = num(net?.wifi?.signalStrength);
|
|
64670
64680
|
if (wifi !== null)
|
|
64671
|
-
return
|
|
64681
|
+
return say("Wi-Fi", wifi);
|
|
64672
64682
|
const cell = num(net?.cellular?.signalStrength);
|
|
64673
|
-
return cell !== null ?
|
|
64683
|
+
return cell !== null ? say("Mobile", cell) : "";
|
|
64674
64684
|
}
|
|
64675
64685
|
function padbotPlanShare(frame2, x, y) {
|
|
64676
64686
|
const w = num(frame2?.width), h = num(frame2?.height), r = num(frame2?.resolution);
|
|
@@ -64698,26 +64708,41 @@ function padbotAlarmFault(alarm) {
|
|
|
64698
64708
|
};
|
|
64699
64709
|
}
|
|
64700
64710
|
function padbotPatrolPlan(paths, maps, states = {}) {
|
|
64701
|
-
const
|
|
64711
|
+
const allMaps = Array.isArray(maps) ? maps : [];
|
|
64712
|
+
const mapById = new Map(allMaps.map((m) => [m?.mapId, m]));
|
|
64702
64713
|
const nav = states["1003"] ?? {};
|
|
64703
64714
|
const walking = states["1010"]?.workState === 1 && states["1010"]?.taskType === 2;
|
|
64704
64715
|
const currentMap = states["1007"]?.mapId;
|
|
64705
|
-
const
|
|
64706
|
-
const
|
|
64707
|
-
const
|
|
64708
|
-
|
|
64709
|
-
|
|
64710
|
-
|
|
64711
|
-
|
|
64716
|
+
const findPoint = (mapId, id, name) => {
|
|
64717
|
+
const order = [mapById.get(mapId), ...allMaps.filter((m) => m?.mapId !== mapId)].filter(Boolean);
|
|
64718
|
+
for (const by of ["id", "name"]) {
|
|
64719
|
+
for (const map of order) {
|
|
64720
|
+
const tp = (map.targetPoints ?? []).find(
|
|
64721
|
+
(t) => by === "id" ? id && t?.targetPointId === id : name && t?.name === name
|
|
64722
|
+
);
|
|
64723
|
+
if (tp)
|
|
64724
|
+
return { map, tp };
|
|
64725
|
+
}
|
|
64726
|
+
}
|
|
64727
|
+
return null;
|
|
64728
|
+
};
|
|
64729
|
+
const routes = (Array.isArray(paths) ? paths : []).map((p) => {
|
|
64730
|
+
const map = mapById.get(p?.mapId);
|
|
64731
|
+
const raw = Array.isArray(p?.points) && p.points.length ? [...p.points].sort((a, b) => (a?.pointIndex ?? 0) - (b?.pointIndex ?? 0)).map((pt) => ({ id: pt?.targetPointId, name: pt?.targetPointName, mapId: pt?.mapId ?? p?.mapId })) : (Array.isArray(p?.pointNames) ? p.pointNames : []).map((n) => ({ name: n, mapId: p?.mapId }));
|
|
64732
|
+
const placed = raw.map((pt) => {
|
|
64733
|
+
const hit = findPoint(pt.mapId, pt.id, pt.name);
|
|
64734
|
+
const share = hit ? padbotPlanShare(hit.map, hit.tp?.worldX, hit.tp?.worldY) : null;
|
|
64735
|
+
return { name: String(pt.name ?? hit?.tp?.name ?? ""), x: share?.x, y: share?.y };
|
|
64712
64736
|
});
|
|
64713
64737
|
return {
|
|
64714
|
-
id: String(p
|
|
64715
|
-
name: `${p
|
|
64738
|
+
id: String(p?.pathId ?? ""),
|
|
64739
|
+
name: `${p?.pathName || "Route"}${p?.isDefault ? " (default)" : ""}`,
|
|
64716
64740
|
floorNo: Number.isInteger(map?.floor) ? map.floor : null,
|
|
64717
|
-
checkpoints,
|
|
64741
|
+
checkpoints: placed,
|
|
64718
64742
|
currentCheckpoint: null,
|
|
64719
|
-
|
|
64720
|
-
|
|
64743
|
+
stops: placed.map((c) => c.name).filter(Boolean),
|
|
64744
|
+
_mapId: p?.mapId,
|
|
64745
|
+
_default: !!p?.isDefault
|
|
64721
64746
|
};
|
|
64722
64747
|
});
|
|
64723
64748
|
const next = walking ? nav.nextTargetPointName : null;
|
|
@@ -64731,7 +64756,7 @@ function padbotPatrolPlan(paths, maps, states = {}) {
|
|
|
64731
64756
|
delete r._mapId;
|
|
64732
64757
|
delete r._default;
|
|
64733
64758
|
}
|
|
64734
|
-
return { routes, schedule: [] };
|
|
64759
|
+
return { routes, schedule: [], scheduleShared: false };
|
|
64735
64760
|
}
|
|
64736
64761
|
function padbotPatrolRecord(r) {
|
|
64737
64762
|
return {
|
|
@@ -64756,6 +64781,7 @@ function padbotCheckpointVisit(d) {
|
|
|
64756
64781
|
maxTempC: num(d?.maxTemperature)
|
|
64757
64782
|
};
|
|
64758
64783
|
}
|
|
64784
|
+
var asList = (d) => Array.isArray(d) ? d : Array.isArray(d?.items) ? d.items : Array.isArray(d?.list) ? d.list : Array.isArray(d?.records) ? d.records : [];
|
|
64759
64785
|
var page = (data, map) => ({
|
|
64760
64786
|
items: (Array.isArray(data?.items) ? data.items : []).map(map),
|
|
64761
64787
|
total: num(data?.totalItems) ?? 0,
|
|
@@ -64789,7 +64815,56 @@ function createPadbotClient(credentials, options = {}) {
|
|
|
64789
64815
|
throw new import_node_server_utils162.BadRequestError(padbotErrorText(Number(json?.code)));
|
|
64790
64816
|
return json.data;
|
|
64791
64817
|
}
|
|
64792
|
-
|
|
64818
|
+
async function raw(path5, body = {}) {
|
|
64819
|
+
const t0 = Date.now();
|
|
64820
|
+
const req = padbotSignedRequest({ path: path5, body, accessKeyId: credentials.appid, accessKeySecret: credentials.secret, now: options.now });
|
|
64821
|
+
try {
|
|
64822
|
+
const res = await doFetch(`${baseUrl}${path5}`, { method: "POST", headers: req.headers, body: req.body, signal: AbortSignal.timeout(timeoutMs) });
|
|
64823
|
+
const text2 = await res.text();
|
|
64824
|
+
let json = null;
|
|
64825
|
+
try {
|
|
64826
|
+
json = JSON.parse(text2);
|
|
64827
|
+
} catch {
|
|
64828
|
+
}
|
|
64829
|
+
return {
|
|
64830
|
+
httpStatus: res.status,
|
|
64831
|
+
code: typeof json?.code === "number" ? json.code : null,
|
|
64832
|
+
message: typeof json?.message === "string" ? json.message.slice(0, 300) : json ? "" : `not JSON (${text2.length} bytes)`,
|
|
64833
|
+
data: json?.data ?? null,
|
|
64834
|
+
ms: Date.now() - t0
|
|
64835
|
+
};
|
|
64836
|
+
} catch (error) {
|
|
64837
|
+
return { httpStatus: null, code: null, message: error?.name === "TimeoutError" ? "timed out" : "unreachable", data: null, ms: Date.now() - t0 };
|
|
64838
|
+
}
|
|
64839
|
+
}
|
|
64840
|
+
return { call, raw, baseUrl };
|
|
64841
|
+
}
|
|
64842
|
+
function mapSummary(m) {
|
|
64843
|
+
const count = (v) => Array.isArray(v) ? v.length : 0;
|
|
64844
|
+
return {
|
|
64845
|
+
mapId: m?.mapId,
|
|
64846
|
+
mapName: m?.mapName,
|
|
64847
|
+
mapDisplayName: m?.mapDisplayName,
|
|
64848
|
+
building: m?.building,
|
|
64849
|
+
floor: m?.floor,
|
|
64850
|
+
isDefault: m?.isDefault,
|
|
64851
|
+
width: m?.width,
|
|
64852
|
+
height: m?.height,
|
|
64853
|
+
resolution: m?.resolution,
|
|
64854
|
+
originX: m?.originX,
|
|
64855
|
+
originY: m?.originY,
|
|
64856
|
+
targetPoints: (Array.isArray(m?.targetPoints) ? m.targetPoints : []).slice(0, 200).map((t) => ({
|
|
64857
|
+
targetPointId: t?.targetPointId,
|
|
64858
|
+
mapId: t?.mapId,
|
|
64859
|
+
name: t?.name,
|
|
64860
|
+
worldX: t?.worldX,
|
|
64861
|
+
worldY: t?.worldY,
|
|
64862
|
+
yaw: t?.yaw,
|
|
64863
|
+
targetPointType: t?.targetPointType
|
|
64864
|
+
})),
|
|
64865
|
+
counts: { targetPoints: count(m?.targetPoints), restrictedAreas: count(m?.restrictedAreas), speedLimitAreas: count(m?.speedLimitAreas), passableAreas: count(m?.passableAreas), virtualTracks: count(m?.virtualTracks) },
|
|
64866
|
+
otherKeys: Object.keys(m ?? {}).filter((k) => !["targetPoints", "restrictedAreas", "speedLimitAreas", "passableAreas", "virtualTracks", "imageUrl", "mapFileUrl"].includes(k))
|
|
64867
|
+
};
|
|
64793
64868
|
}
|
|
64794
64869
|
var CACHE_TTL_MS = 5 * 6e4;
|
|
64795
64870
|
var cache2 = /* @__PURE__ */ new Map();
|
|
@@ -64808,11 +64883,11 @@ function clearPadbotCache() {
|
|
|
64808
64883
|
cache2.clear();
|
|
64809
64884
|
}
|
|
64810
64885
|
function createPadbotAdapter(credentials, options = {}) {
|
|
64811
|
-
const { call } = createPadbotClient(credentials, options);
|
|
64886
|
+
const { call, raw } = createPadbotClient(credentials, options);
|
|
64812
64887
|
const now = options.now ?? Date.now;
|
|
64813
64888
|
const ns = `${credentials.appid}@${options.baseUrl ?? padbotBaseUrl()}`;
|
|
64814
64889
|
const roster = () => cached2(`${ns}:robots`, () => call(PADBOT_PATHS.robots, { robotTypes: ["PATROL"] }));
|
|
64815
|
-
const maps = (sn) => cached2(`${ns}:maps:${sn}`, () => call(PADBOT_PATHS.maps, { serialNumber: sn }));
|
|
64890
|
+
const maps = (sn) => cached2(`${ns}:maps:${sn}`, () => call(PADBOT_PATHS.maps, { serialNumber: sn }).then(asList));
|
|
64816
64891
|
const states = async (sn) => {
|
|
64817
64892
|
const list = await call(PADBOT_PATHS.states, { serialNumbers: [sn] });
|
|
64818
64893
|
const entry = (list ?? []).find((e) => e?.serialNumber === sn);
|
|
@@ -64850,11 +64925,15 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
64850
64925
|
call(PADBOT_PATHS.location, { serialNumber: robotSn }).catch(() => null),
|
|
64851
64926
|
robot.fault ? Promise.resolve(null) : call(PADBOT_PATHS.alarms, { serialNumbers: [robotSn], resolved: false, pageNumber: 1, pageSize: 1 }).then((d) => d?.items?.[0] ?? null).catch(() => null)
|
|
64852
64927
|
]);
|
|
64853
|
-
|
|
64854
|
-
|
|
64855
|
-
|
|
64856
|
-
robot.
|
|
64857
|
-
|
|
64928
|
+
const lx = num(loc?.worldX ?? loc?.x);
|
|
64929
|
+
const ly = num(loc?.worldY ?? loc?.y);
|
|
64930
|
+
if (lx !== null && ly !== null) {
|
|
64931
|
+
robot.position = { x: lx, y: ly, theta: (num(loc.yaw ?? loc.r) ?? 0) * Math.PI / 180 };
|
|
64932
|
+
const map = await maps(robotSn).then((all) => (all ?? []).find((m) => m.mapId === (loc.mapId ?? st["1007"]?.mapId))).catch(() => null);
|
|
64933
|
+
robot.planPosition = padbotPlanShare(map, lx, ly);
|
|
64934
|
+
}
|
|
64935
|
+
if (!robot.position)
|
|
64936
|
+
robot.statusName = `${robot.statusName} \xB7 Position not reported`;
|
|
64858
64937
|
if (alarm)
|
|
64859
64938
|
robot.fault = padbotAlarmFault(alarm);
|
|
64860
64939
|
return robot;
|
|
@@ -64923,16 +65002,38 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
64923
65002
|
async getMaps(robotSn) {
|
|
64924
65003
|
return await maps(robotSn) ?? [];
|
|
64925
65004
|
},
|
|
65005
|
+
/**
|
|
65006
|
+
* Staff Diagnose: PadBot's raw answers (code, message, data) for the reads
|
|
65007
|
+
* behind the robot screen - states, location, maps (summarised), patrol
|
|
65008
|
+
* routes, newest alarm, newest patrol record. Read-only; no credential,
|
|
65009
|
+
* no MQTT credential, ever.
|
|
65010
|
+
*/
|
|
65011
|
+
async diagnose(robotSn) {
|
|
65012
|
+
const sn = { serialNumber: robotSn };
|
|
65013
|
+
const steps = [];
|
|
65014
|
+
const run = async (step, path5, body, shape = (d) => d) => {
|
|
65015
|
+
const r = await raw(path5, body);
|
|
65016
|
+
steps.push({ step, path: path5, body, httpStatus: r.httpStatus, code: r.code, message: r.message, ms: r.ms, data: r.code === 0 ? shape(r.data) : r.data });
|
|
65017
|
+
};
|
|
65018
|
+
await run("states (4.2)", PADBOT_PATHS.states, { serialNumbers: [robotSn] });
|
|
65019
|
+
await run("location (4.3)", PADBOT_PATHS.location, sn);
|
|
65020
|
+
await run("maps (5.1)", PADBOT_PATHS.maps, sn, (d) => Array.isArray(d) ? d.slice(0, 100).map(mapSummary) : d);
|
|
65021
|
+
await run("patrol routes (6.1)", PADBOT_PATHS.patrolRoutes, sn, (d) => Array.isArray(d) ? d.slice(0, 50) : d);
|
|
65022
|
+
await run("alarms (6.4)", PADBOT_PATHS.alarms, { serialNumbers: [robotSn], pageNumber: 1, pageSize: 3 });
|
|
65023
|
+
await run("patrol records (6.7)", PADBOT_PATHS.records, { serialNumbers: [robotSn], pageNumber: 1, pageSize: 3 });
|
|
65024
|
+
return steps;
|
|
65025
|
+
},
|
|
64926
65026
|
async getPatrolRoutes(robotSn) {
|
|
64927
65027
|
const [paths, allMaps, st] = await Promise.all([
|
|
64928
|
-
call(PADBOT_PATHS.patrolRoutes, { serialNumber: robotSn }),
|
|
65028
|
+
call(PADBOT_PATHS.patrolRoutes, { serialNumber: robotSn }).then(asList),
|
|
64929
65029
|
maps(robotSn).catch(() => []),
|
|
64930
65030
|
states(robotSn).catch(() => null)
|
|
64931
65031
|
]);
|
|
64932
65032
|
return padbotPatrolPlan(paths ?? [], allMaps ?? [], st ?? {});
|
|
64933
65033
|
},
|
|
64934
|
-
|
|
64935
|
-
|
|
65034
|
+
// §6.5: the robot's current surveillance stream; 1 = HD main stream, 2 = smooth sub stream (default here).
|
|
65035
|
+
async getLiveVideo(robotSn, quality) {
|
|
65036
|
+
const d = await call(PADBOT_PATHS.video, { serialNumber: robotSn, quality: quality === "hd" ? 1 : 2 });
|
|
64936
65037
|
if (!d?.playbackUrl)
|
|
64937
65038
|
throw new import_node_server_utils162.BadRequestError("PadBot has no video for this robot right now.");
|
|
64938
65039
|
return { url: String(d.playbackUrl), expiresAt: d.expiresAt ?? null };
|
|
@@ -65163,9 +65264,9 @@ function useRobotFleetService(deps) {
|
|
|
65163
65264
|
}
|
|
65164
65265
|
return { adapter, fn: fn.bind(adapter) };
|
|
65165
65266
|
}
|
|
65166
|
-
async function getLiveVideo(robot) {
|
|
65267
|
+
async function getLiveVideo(robot, quality) {
|
|
65167
65268
|
const { fn } = extra(robot, "getLiveVideo", "liveVideo", "live video");
|
|
65168
|
-
return fn(await resolveRobotSn(robot));
|
|
65269
|
+
return fn(await resolveRobotSn(robot), quality);
|
|
65169
65270
|
}
|
|
65170
65271
|
async function resolveAlerts(robot, code) {
|
|
65171
65272
|
const { fn } = extra(robot, "resolveAlerts", "resolveAlerts", "resolving alerts");
|
|
@@ -65305,6 +65406,25 @@ function useRobotFleetService(deps) {
|
|
|
65305
65406
|
return out("maps", describeFailure(e).detail);
|
|
65306
65407
|
}
|
|
65307
65408
|
}
|
|
65409
|
+
if (adapter.diagnose) {
|
|
65410
|
+
try {
|
|
65411
|
+
for (const r of await adapter.diagnose(serial)) {
|
|
65412
|
+
const ok = r.code === 0;
|
|
65413
|
+
steps.push({
|
|
65414
|
+
step: String(r.step),
|
|
65415
|
+
ok,
|
|
65416
|
+
ms: r.ms,
|
|
65417
|
+
detail: ok ? "Answered." : `Vendor answered ${r.httpStatus ?? "nothing"}${r.code !== null && r.code !== void 0 ? `, code ${r.code}` : ""}${r.message ? `: ${r.message}` : ""}.`,
|
|
65418
|
+
...r.httpStatus ? { httpStatus: r.httpStatus } : {},
|
|
65419
|
+
...r.code !== null && r.code !== void 0 ? { vendorCode: String(r.code) } : {},
|
|
65420
|
+
...r.message ? { vendorMessage: r.message } : {},
|
|
65421
|
+
raw: { path: r.path, body: r.body, data: r.data }
|
|
65422
|
+
});
|
|
65423
|
+
}
|
|
65424
|
+
} catch (e) {
|
|
65425
|
+
steps.push({ step: "vendor reads", ok: false, ...describeFailure(e) });
|
|
65426
|
+
}
|
|
65427
|
+
}
|
|
65308
65428
|
return out(null, "Every step worked.");
|
|
65309
65429
|
}
|
|
65310
65430
|
return {
|
|
@@ -67141,7 +67261,7 @@ function useRobotFaultRepo() {
|
|
|
67141
67261
|
}
|
|
67142
67262
|
}
|
|
67143
67263
|
async function getOpenFaults() {
|
|
67144
|
-
return collection.find({ clearedAt: null }, { projection: { robotId: 1, code: 1, since: 1 } }).toArray();
|
|
67264
|
+
return collection.find({ clearedAt: null }, { projection: { robotId: 1, code: 1, since: 1, message: 1 } }).toArray();
|
|
67145
67265
|
}
|
|
67146
67266
|
async function getOpenFault(robotId, code) {
|
|
67147
67267
|
return collection.findOne({ robotId: toId3(robotId), code, clearedAt: null });
|
|
@@ -67202,6 +67322,9 @@ function useRobotFaultRepo() {
|
|
|
67202
67322
|
async function markNotified(id, at2) {
|
|
67203
67323
|
await collection.updateOne({ _id: toId3(id), notifiedAt: null }, { $set: { notifiedAt: at2 } });
|
|
67204
67324
|
}
|
|
67325
|
+
async function setFaultMessage(id, message) {
|
|
67326
|
+
await collection.updateOne({ _id: toId3(id), clearedAt: null }, { $set: { message } });
|
|
67327
|
+
}
|
|
67205
67328
|
async function clearFault(id) {
|
|
67206
67329
|
await collection.updateOne(
|
|
67207
67330
|
{ _id: toId3(id), clearedAt: null },
|
|
@@ -67231,6 +67354,7 @@ function useRobotFaultRepo() {
|
|
|
67231
67354
|
findNotifiedOccurrence,
|
|
67232
67355
|
markNotified,
|
|
67233
67356
|
clearFault,
|
|
67357
|
+
setFaultMessage,
|
|
67234
67358
|
listNetworkFaults,
|
|
67235
67359
|
countNetworkFaults
|
|
67236
67360
|
};
|
|
@@ -67385,6 +67509,8 @@ function useRobotFaultSweep(deps) {
|
|
|
67385
67509
|
await repo.clearFault(id);
|
|
67386
67510
|
out.cleared++;
|
|
67387
67511
|
}
|
|
67512
|
+
for (const r of plan.refresh)
|
|
67513
|
+
await repo.setFaultMessage(r.id, r.message);
|
|
67388
67514
|
if (offlineRec) {
|
|
67389
67515
|
const online = plan.clear.includes(offlineRec._id);
|
|
67390
67516
|
if (await alertConnection(robot, offlineRec._id, online, cfg.offlineAlertMinutes, deps?.connectionNotifyFn))
|
|
@@ -67626,8 +67752,9 @@ function useRobotFleetController(deps) {
|
|
|
67626
67752
|
async function getLiveVideo(req, res, next) {
|
|
67627
67753
|
try {
|
|
67628
67754
|
const robot = await entitleRobot(req, req.params.id);
|
|
67755
|
+
const quality = req.body?.quality === "hd" ? "hd" : "smooth";
|
|
67629
67756
|
res.set("Cache-Control", "no-store");
|
|
67630
|
-
res.json(await getFleet2().getLiveVideo(robot));
|
|
67757
|
+
res.json(await getFleet2().getLiveVideo(robot, quality));
|
|
67631
67758
|
} catch (error) {
|
|
67632
67759
|
fail(next, error);
|
|
67633
67760
|
}
|
|
@@ -103202,6 +103329,7 @@ function usePersonalEmergencyChainController() {
|
|
|
103202
103329
|
allowsRobotListing,
|
|
103203
103330
|
applyTrackingFrame,
|
|
103204
103331
|
areaColourToHex,
|
|
103332
|
+
asList,
|
|
103205
103333
|
attendanceSchema,
|
|
103206
103334
|
attendanceSettingsSchema,
|
|
103207
103335
|
buildSelfServiceEmailContext,
|
|
@@ -103375,6 +103503,7 @@ function usePersonalEmergencyChainController() {
|
|
|
103375
103503
|
moduleGateMode,
|
|
103376
103504
|
moduleImpact,
|
|
103377
103505
|
moduleListGateOn,
|
|
103506
|
+
networkText,
|
|
103378
103507
|
newCode,
|
|
103379
103508
|
newSecret,
|
|
103380
103509
|
nfcPatrolSettingsSchema,
|