@7365admin1/core 3.124.0 → 3.124.2
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 +112 -3
- package/dist/index.js +166 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +159 -28
- package/dist/index.mjs.map +1 -1
- package/logs/.6b77785a74c362881f6fb7e95a7530280abbf9ed-audit.json +5 -5
- package/logs/.ca6dad43b7d35307d69543a741eb24d3ce997028-audit.json +5 -5
- package/logs/dahua/.6ec119960df5f4d6b0eca28515ba03f28bca7d1b-audit.json +5 -0
- package/logs/dahua/.ddefed381272b698d725b4376425900c8428d7a4-audit.json +5 -0
- package/package.json +2 -2
- package/test/camera-alert.util.test.mjs +20 -0
- package/test/padbot-movement.test.mjs +157 -0
- package/test/padbot.test.mjs +4 -4
- package/test/site-incident-counter.test.mjs +70 -0
- package/logs/combined-2026-09-10.log +0 -0
- package/logs/error-2026-09-10.log +0 -0
package/dist/index.mjs
CHANGED
|
@@ -5708,7 +5708,21 @@ function MSite(value) {
|
|
|
5708
5708
|
name: value.name ?? "",
|
|
5709
5709
|
description: value.description ?? "",
|
|
5710
5710
|
orgId: value.orgId ?? "",
|
|
5711
|
-
|
|
5711
|
+
/*
|
|
5712
|
+
* `incidentCounter` is seeded at creation rather than left absent.
|
|
5713
|
+
*
|
|
5714
|
+
* `incident-report.service.ts` increments it for every report, and it used
|
|
5715
|
+
* to spring into existence on the first one — a dotted `$set` creates the
|
|
5716
|
+
* key. Seeding it means a site's shape does not depend on whether anybody
|
|
5717
|
+
* has filed a report yet, so a reader cannot meet the field as `undefined`
|
|
5718
|
+
* on a new site and only as a number on an old one.
|
|
5719
|
+
*
|
|
5720
|
+
* `siteSchema` does not permit `metadata` on creation at all, so the spread
|
|
5721
|
+
* below never fires today — it is there so that a caller supplying its own
|
|
5722
|
+
* metadata would still win if the schema ever allows it, rather than having
|
|
5723
|
+
* its counter silently reset to zero.
|
|
5724
|
+
*/
|
|
5725
|
+
metadata: { incidentCounter: 0, ...value.metadata ?? {} },
|
|
5712
5726
|
status: "active",
|
|
5713
5727
|
createdAt: /* @__PURE__ */ new Date(),
|
|
5714
5728
|
address: value.address,
|
|
@@ -21733,6 +21747,9 @@ function shouldAlertOnFailure(consecutiveFailures) {
|
|
|
21733
21747
|
return false;
|
|
21734
21748
|
return (consecutiveFailures - CAMERA_ALERT_EVERY_AFTER) % CAMERA_ALERT_EVERY_AFTER === 0;
|
|
21735
21749
|
}
|
|
21750
|
+
function shouldStoreCameraFault(alertedThisOutage) {
|
|
21751
|
+
return alertedThisOutage === 0;
|
|
21752
|
+
}
|
|
21736
21753
|
|
|
21737
21754
|
// src/utils/dahua-protocol.util.ts
|
|
21738
21755
|
var DAHUA_AUTH_ATTEMPTS_BEFORE_ALERT = 2;
|
|
@@ -22900,6 +22917,7 @@ function useDahuaService() {
|
|
|
22900
22917
|
`[${camera?.siteName}-${camera?.direction}] Connection lost or error: ${error.message || error}. Retrying in 10 seconds... (failure ${connectionFailureCount})`
|
|
22901
22918
|
);
|
|
22902
22919
|
if (onDetected && shouldAlertOnFailure(connectionFailureCount)) {
|
|
22920
|
+
const storeInInbox = shouldStoreCameraFault(alertedFailureCount);
|
|
22903
22921
|
alertedFailureCount = connectionFailureCount;
|
|
22904
22922
|
onDetected({
|
|
22905
22923
|
site: camera?.site,
|
|
@@ -22908,7 +22926,8 @@ function useDahuaService() {
|
|
|
22908
22926
|
camera: camera?._id?.toString(),
|
|
22909
22927
|
message: cameraUnreachableMessage(camera)
|
|
22910
22928
|
});
|
|
22911
|
-
|
|
22929
|
+
if (storeInInbox)
|
|
22930
|
+
notifyCameraFault(camera, cameraUnreachableMessage(camera));
|
|
22912
22931
|
}
|
|
22913
22932
|
}
|
|
22914
22933
|
} finally {
|
|
@@ -64692,9 +64711,9 @@ function padbotReadiness(states, now = Date.now()) {
|
|
|
64692
64711
|
const charging = st["1002"]?.chargingState;
|
|
64693
64712
|
const notes = [];
|
|
64694
64713
|
if (es.wheelLockState === 1)
|
|
64695
|
-
notes.push("
|
|
64714
|
+
notes.push("Wheel motor lock reads 1 (1006). The S2 reads 1 even while it drives, so this does not stop it.");
|
|
64696
64715
|
if (charging === 2)
|
|
64697
|
-
notes.push("Charging state 2
|
|
64716
|
+
notes.push("Charging state 2 = docked on the charger (inferred from the S2; PadBot's v4.0 document lists only 0 and 1).");
|
|
64698
64717
|
return {
|
|
64699
64718
|
online: padbotMode(st, now).online,
|
|
64700
64719
|
heartbeatAt: st["1000"]?.updatedAt ?? null,
|
|
@@ -64728,6 +64747,33 @@ function padbotFailureText(p) {
|
|
|
64728
64747
|
return null;
|
|
64729
64748
|
return `Could not reach ${p.target || "its destination"}${p.message ? ` (${p.message})` : ""}`;
|
|
64730
64749
|
}
|
|
64750
|
+
var PADBOT_CHARGING = { OFF: 0, UNDOCKING_OR_CHARGING: 1, DOCKED: 2, DOCKING: 3 };
|
|
64751
|
+
var PADBOT_MOVED_M = 0.3;
|
|
64752
|
+
var PADBOT_ARRIVED_M = 0.5;
|
|
64753
|
+
var PADBOT_MOTION_MS = 3 * 6e4;
|
|
64754
|
+
function padbotMotion(m, now) {
|
|
64755
|
+
const c = typeof now.charging === "number" ? now.charging : null;
|
|
64756
|
+
const walked = m.pose && now.pose ? Math.hypot(now.pose.x - m.pose.x, now.pose.y - m.pose.y) : null;
|
|
64757
|
+
const moved = c !== null && m.charging !== null && c !== m.charging || walked !== null && walked > PADBOT_MOVED_M;
|
|
64758
|
+
if (!moved)
|
|
64759
|
+
return null;
|
|
64760
|
+
if (m.kind === "return") {
|
|
64761
|
+
if (c === PADBOT_CHARGING.DOCKING)
|
|
64762
|
+
return { text: "Docking", mode: "WORKING", done: false };
|
|
64763
|
+
if (c === PADBOT_CHARGING.DOCKED || c === PADBOT_CHARGING.UNDOCKING_OR_CHARGING)
|
|
64764
|
+
return { text: "Back on charger", mode: null, done: true };
|
|
64765
|
+
return { text: "On the way to the charger", mode: "WORKING", done: false };
|
|
64766
|
+
}
|
|
64767
|
+
if (m.charging === PADBOT_CHARGING.DOCKED && c === PADBOT_CHARGING.UNDOCKING_OR_CHARGING)
|
|
64768
|
+
return { text: "Leaving the charger", mode: "WORKING", done: false };
|
|
64769
|
+
const t = m.target;
|
|
64770
|
+
if (t && t.x !== null && t.y !== null && now.pose && Math.hypot(now.pose.x - t.x, now.pose.y - t.y) <= PADBOT_ARRIVED_M) {
|
|
64771
|
+
return { text: `Arrived at ${t.name}`, mode: null, done: true };
|
|
64772
|
+
}
|
|
64773
|
+
if (t)
|
|
64774
|
+
return { text: `On the way to ${t.name}`, mode: "WORKING", done: false };
|
|
64775
|
+
return { text: m.kind === "full" || m.kind === "area" || m.kind === "patrol-resume" ? "Patrolling" : "On the way", mode: "WORKING", done: false };
|
|
64776
|
+
}
|
|
64731
64777
|
function networkText(net) {
|
|
64732
64778
|
const say = (label2, v) => v < 0 ? ` \xB7 ${label2} ${v} dBm` : ` \xB7 ${label2} signal ${v}`;
|
|
64733
64779
|
const wifi = num(net?.wifi?.signalStrength);
|
|
@@ -64996,6 +65042,9 @@ function clearPadbotCache() {
|
|
|
64996
65042
|
live.clear();
|
|
64997
65043
|
commandLog.clear();
|
|
64998
65044
|
lastFailure.clear();
|
|
65045
|
+
motions.clear();
|
|
65046
|
+
robotReads.clear();
|
|
65047
|
+
alarmReads.clear();
|
|
64999
65048
|
}
|
|
65000
65049
|
function forgetPadbotMaps(appid, robotSn) {
|
|
65001
65050
|
for (const key of cache2.keys())
|
|
@@ -65024,6 +65073,11 @@ function logCommand(accountKey, robotSn, entry) {
|
|
|
65024
65073
|
var padbotCommandLog = (accountKey, robotSn) => commandLog.get(`${accountKey}:${robotSn}`) ?? [];
|
|
65025
65074
|
var lastFailure = /* @__PURE__ */ new Map();
|
|
65026
65075
|
var PADBOT_FAILURE_SHOW_MS = 3 * 6e4;
|
|
65076
|
+
var motions = /* @__PURE__ */ new Map();
|
|
65077
|
+
var PADBOT_ROBOT_READ_MS = 900;
|
|
65078
|
+
var robotReads = /* @__PURE__ */ new Map();
|
|
65079
|
+
var PADBOT_ALARM_READ_MS = 1e4;
|
|
65080
|
+
var alarmReads = /* @__PURE__ */ new Map();
|
|
65027
65081
|
async function readPadbotStates(credentials, robotSn, stateTypes) {
|
|
65028
65082
|
const list = await createPadbotClient(credentials).call(PADBOT_PATHS.states, { serialNumbers: [robotSn], stateTypes });
|
|
65029
65083
|
const entry = (list ?? []).find((e) => e?.serialNumber === robotSn);
|
|
@@ -65049,7 +65103,7 @@ async function listPadbotAlarmsSince(credentials, serials, startTime) {
|
|
|
65049
65103
|
}
|
|
65050
65104
|
function createPadbotAdapter(credentials, options = {}) {
|
|
65051
65105
|
const { call, raw } = createPadbotClient(credentials, options);
|
|
65052
|
-
const watch = options.watch === void 0 ? { everyMs: 2e3, forMs:
|
|
65106
|
+
const watch = options.watch === void 0 ? { everyMs: 2e3, forMs: 6e4 } : options.watch;
|
|
65053
65107
|
const sleep3 = options.sleep ?? ((ms2) => new Promise((resolve) => {
|
|
65054
65108
|
const t = setTimeout(resolve, ms2);
|
|
65055
65109
|
t?.unref?.();
|
|
@@ -65065,14 +65119,43 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
65065
65119
|
const entry = (list ?? []).find((e) => e?.serialNumber === sn);
|
|
65066
65120
|
return entry ? statesByType(entry) : null;
|
|
65067
65121
|
};
|
|
65068
|
-
|
|
65122
|
+
function openAlarm(robotSn) {
|
|
65123
|
+
const k = `${account}:${robotSn}`;
|
|
65124
|
+
const hit = alarmReads.get(k);
|
|
65125
|
+
if (hit && now() - hit.at < PADBOT_ALARM_READ_MS)
|
|
65126
|
+
return hit.value;
|
|
65127
|
+
if (alarmReads.size > 2e3)
|
|
65128
|
+
alarmReads.clear();
|
|
65129
|
+
const value = call(PADBOT_PATHS.alarms, { serialNumbers: [robotSn], resolved: false, pageNumber: 1, pageSize: 1 }).then((d) => d?.items?.[0] ?? null).catch(() => {
|
|
65130
|
+
alarmReads.delete(k);
|
|
65131
|
+
return null;
|
|
65132
|
+
});
|
|
65133
|
+
alarmReads.set(k, { at: now(), value });
|
|
65134
|
+
return value;
|
|
65135
|
+
}
|
|
65136
|
+
function getRobot(robotSn) {
|
|
65137
|
+
const k = `${account}:${robotSn}`;
|
|
65138
|
+
const hit = robotReads.get(k);
|
|
65139
|
+
if (hit && now() - hit.at < PADBOT_ROBOT_READ_MS)
|
|
65140
|
+
return hit.value;
|
|
65141
|
+
if (robotReads.size > 2e3)
|
|
65142
|
+
robotReads.clear();
|
|
65143
|
+
const value = readRobot(robotSn);
|
|
65144
|
+
robotReads.set(k, { at: now(), value });
|
|
65145
|
+
value.catch(() => robotReads.delete(k));
|
|
65146
|
+
return value;
|
|
65147
|
+
}
|
|
65148
|
+
async function readRobot(robotSn) {
|
|
65149
|
+
const heard = padbotLive(account, robotSn);
|
|
65150
|
+
const pose = heard?.pose && now() - heard.pose.at < PADBOT_LIVE_POSE_MS ? heard.pose : null;
|
|
65151
|
+
const locRead = pose ? Promise.resolve({ mapId: pose.mapId, worldX: pose.x, worldY: pose.y, yaw: pose.yawDeg }) : call(PADBOT_PATHS.location, { serialNumber: robotSn }).catch(() => null);
|
|
65152
|
+
const alarmRead = openAlarm(robotSn);
|
|
65069
65153
|
const [st, list] = await Promise.all([states(robotSn), roster().catch(() => [])]);
|
|
65070
65154
|
if (!st)
|
|
65071
65155
|
return null;
|
|
65072
65156
|
const info = (list ?? []).find((r) => r?.serialNumber === robotSn);
|
|
65073
65157
|
const { online, mode, statusName } = padbotMode(st, now());
|
|
65074
65158
|
const floor = st["1007"]?.floor;
|
|
65075
|
-
const heard = padbotLive(account, robotSn);
|
|
65076
65159
|
const restBatteryAt = ms(st["1001"]?.updatedAt);
|
|
65077
65160
|
const battery = heard?.batteryPercent !== void 0 && (!Number.isFinite(restBatteryAt) || (heard.batteryAt ?? 0) > restBatteryAt) ? heard.batteryPercent : num(st["1001"]?.batteryPercent);
|
|
65078
65161
|
const failed = lastFailure.get(`${account}:${robotSn}`);
|
|
@@ -65099,11 +65182,8 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
65099
65182
|
}
|
|
65100
65183
|
if (!online)
|
|
65101
65184
|
return robot;
|
|
65102
|
-
const
|
|
65103
|
-
const
|
|
65104
|
-
pose ? Promise.resolve({ mapId: pose.mapId, worldX: pose.x, worldY: pose.y, yaw: pose.yawDeg }) : call(PADBOT_PATHS.location, { serialNumber: robotSn }).catch(() => null),
|
|
65105
|
-
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)
|
|
65106
|
-
]);
|
|
65185
|
+
const [loc, openA] = await Promise.all([locRead, alarmRead]);
|
|
65186
|
+
const alarm = robot.fault ? null : openA;
|
|
65107
65187
|
const lx = num(loc?.worldX ?? loc?.x);
|
|
65108
65188
|
const ly = num(loc?.worldY ?? loc?.y);
|
|
65109
65189
|
if (typeof loc?.mapId === "string" && loc.mapId)
|
|
@@ -65115,6 +65195,13 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
65115
65195
|
robot.position = { x: lx, y: ly, theta: (num(loc.yaw ?? loc.r) ?? 0) * Math.PI / 180 };
|
|
65116
65196
|
robot.planPosition = padbotPlanShare(map, lx, ly);
|
|
65117
65197
|
}
|
|
65198
|
+
const mo = motions.get(`${account}:${robotSn}`);
|
|
65199
|
+
const going = mo && now() - mo.sentAt < PADBOT_MOTION_MS && /^(Standing by|Charging)/.test(robot.statusName ?? "") ? padbotMotion(mo, { charging: st["1002"]?.chargingState, pose: robot.position ? { x: robot.position.x, y: robot.position.y } : null }) : null;
|
|
65200
|
+
if (going) {
|
|
65201
|
+
robot.statusName = (robot.statusName ?? "").replace(/^(Standing by|Charging)/, going.text);
|
|
65202
|
+
if (going.mode)
|
|
65203
|
+
robot.mode = going.mode;
|
|
65204
|
+
}
|
|
65118
65205
|
const last = heard?.pose;
|
|
65119
65206
|
if (!robot.position && last && (last.mapId === null || last.mapId === robot.mapId) && (robot.mode === "IDLE" || robot.mode === "CHARGING_CYCLE" || robot.mode === "CHARGED")) {
|
|
65120
65207
|
robot.position = { x: last.x, y: last.y, theta: (last.yawDeg ?? 0) * Math.PI / 180 };
|
|
@@ -65127,7 +65214,8 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
65127
65214
|
if (pile) {
|
|
65128
65215
|
robot.position = { x: pile.worldX, y: pile.worldY, theta: (num(pile.yaw) ?? 0) * Math.PI / 180 };
|
|
65129
65216
|
robot.planPosition = padbotPlanShare(map, pile.worldX, pile.worldY);
|
|
65130
|
-
|
|
65217
|
+
if (!going || going.done)
|
|
65218
|
+
robot.statusName = `${robot.statusName} \xB7 At charger`;
|
|
65131
65219
|
}
|
|
65132
65220
|
if (!robot.position)
|
|
65133
65221
|
robot.statusName = `${robot.statusName} \xB7 Position not reported`;
|
|
@@ -65148,7 +65236,7 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
65148
65236
|
const ids2 = [loc?.mapId, st?.["1007"]?.mapId];
|
|
65149
65237
|
const map = padbotCurrentMap(all, ids2, st?.["1007"]?.floor);
|
|
65150
65238
|
const mapId = map?.mapId ?? ids2.find((id) => typeof id === "string" && id) ?? null;
|
|
65151
|
-
return { st: st ?? {}, all: all ?? [], mapId };
|
|
65239
|
+
return { st: st ?? {}, all: all ?? [], mapId, loc };
|
|
65152
65240
|
}
|
|
65153
65241
|
const mapName = (all, id) => {
|
|
65154
65242
|
const m = all.find((x) => x?.mapId === id);
|
|
@@ -65172,10 +65260,10 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
65172
65260
|
}
|
|
65173
65261
|
return String(rawRoute.pathId);
|
|
65174
65262
|
}
|
|
65175
|
-
async function watchReaction(robotSn, entry, sentAt) {
|
|
65263
|
+
async function watchReaction(robotSn, entry, sentAt, motion) {
|
|
65176
65264
|
if (!watch)
|
|
65177
65265
|
return;
|
|
65178
|
-
const r = entry.reaction = { watching: true, points: [], failure: null, moved: false };
|
|
65266
|
+
const r = entry.reaction = { watching: true, points: [], failure: null, moved: false, firstChangeAfterSeconds: null, progress: null };
|
|
65179
65267
|
let last = "";
|
|
65180
65268
|
try {
|
|
65181
65269
|
for (let waited = 0; waited < watch.forMs; ) {
|
|
@@ -65185,19 +65273,28 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
65185
65273
|
if (!st)
|
|
65186
65274
|
continue;
|
|
65187
65275
|
const p = padbotReactionPoint(st);
|
|
65276
|
+
const after = Math.round((now() - sentAt) / 1e3);
|
|
65188
65277
|
const key = JSON.stringify(p);
|
|
65189
|
-
if (key !== last && r.points.length <
|
|
65190
|
-
r.points.push({ ...p, afterSeconds:
|
|
65278
|
+
if (key !== last && r.points.length < 30)
|
|
65279
|
+
r.points.push({ ...p, afterSeconds: after });
|
|
65191
65280
|
last = key;
|
|
65192
|
-
|
|
65281
|
+
const heard = padbotLive(account, robotSn)?.pose;
|
|
65282
|
+
const pose = heard && now() - heard.at < PADBOT_LIVE_POSE_MS ? { x: heard.x, y: heard.y } : null;
|
|
65283
|
+
const going = padbotMotion(motion, { charging: p.charging, pose });
|
|
65284
|
+
if (going || p.state >= 1 && p.state <= 5) {
|
|
65285
|
+
if (!r.moved)
|
|
65286
|
+
r.firstChangeAfterSeconds = after;
|
|
65193
65287
|
r.moved = true;
|
|
65288
|
+
}
|
|
65289
|
+
if (going)
|
|
65290
|
+
r.progress = going.text;
|
|
65194
65291
|
const failure = padbotFailureText(p);
|
|
65195
65292
|
if (failure) {
|
|
65196
65293
|
r.failure = failure;
|
|
65197
65294
|
lastFailure.set(`${account}:${robotSn}`, { at: now(), text: failure });
|
|
65198
65295
|
break;
|
|
65199
65296
|
}
|
|
65200
|
-
if (p.state === 5)
|
|
65297
|
+
if (p.state === 5 || going?.done)
|
|
65201
65298
|
break;
|
|
65202
65299
|
}
|
|
65203
65300
|
} finally {
|
|
@@ -65206,22 +65303,48 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
65206
65303
|
}
|
|
65207
65304
|
async function sendCommand2(robotSn, command) {
|
|
65208
65305
|
const sn = { serialNumber: robotSn };
|
|
65306
|
+
const where = command.kind === "go-to-point" ? await whereIs(robotSn) : null;
|
|
65307
|
+
let motion = null;
|
|
65209
65308
|
if (MOVING_COMMANDS.has(command.kind)) {
|
|
65210
|
-
const
|
|
65309
|
+
const before = where?.st ?? await states(robotSn);
|
|
65310
|
+
const block = padbotCommandBlock(before, command.kind, now());
|
|
65211
65311
|
if (block)
|
|
65212
65312
|
throw new BadRequestError135(block);
|
|
65213
65313
|
lastFailure.delete(`${account}:${robotSn}`);
|
|
65214
|
-
|
|
65314
|
+
const heard = padbotLive(account, robotSn)?.pose;
|
|
65315
|
+
const lx = num(where?.loc?.worldX);
|
|
65316
|
+
const ly = num(where?.loc?.worldY);
|
|
65317
|
+
let target = null;
|
|
65318
|
+
if (command.kind === "go-to-point") {
|
|
65319
|
+
const pt = (where?.all ?? []).flatMap((m) => Array.isArray(m?.targetPoints) ? m.targetPoints : []).find((t) => t?.targetPointId === command.targetPointId);
|
|
65320
|
+
target = { name: String(pt?.name || "the chosen point"), x: num(pt?.worldX), y: num(pt?.worldY) };
|
|
65321
|
+
}
|
|
65322
|
+
motion = {
|
|
65323
|
+
kind: command.kind,
|
|
65324
|
+
sentAt: 0,
|
|
65325
|
+
charging: typeof before?.["1002"]?.chargingState === "number" ? before["1002"].chargingState : null,
|
|
65326
|
+
pose: lx !== null && ly !== null ? { x: lx, y: ly } : heard ? { x: heard.x, y: heard.y } : null,
|
|
65327
|
+
target
|
|
65328
|
+
};
|
|
65329
|
+
} else if (command.kind === "cancel")
|
|
65330
|
+
motions.delete(`${account}:${robotSn}`);
|
|
65215
65331
|
const call2 = async (path5, body) => {
|
|
65216
65332
|
const at2 = new Date(now()).toISOString();
|
|
65217
65333
|
const meta = {};
|
|
65334
|
+
const t0 = Date.now();
|
|
65218
65335
|
try {
|
|
65219
65336
|
await callRaw(path5, body, meta);
|
|
65220
|
-
const entry = { at: at2, command: command.kind, path: path5, body, ok: true, vendorCode: 0, vendorMessage: meta.message, requestId: meta.requestId };
|
|
65337
|
+
const entry = { at: at2, command: command.kind, path: path5, body, ok: true, vendorCode: 0, vendorMessage: meta.message, requestId: meta.requestId, vendorMs: Date.now() - t0 };
|
|
65221
65338
|
logCommand(account, robotSn, entry);
|
|
65222
|
-
if (
|
|
65223
|
-
|
|
65339
|
+
if (motion) {
|
|
65340
|
+
motion.sentAt = now();
|
|
65341
|
+
if (motions.size > 2e3)
|
|
65342
|
+
motions.clear();
|
|
65343
|
+
motions.set(`${account}:${robotSn}`, motion);
|
|
65344
|
+
robotReads.delete(`${account}:${robotSn}`);
|
|
65345
|
+
void watchReaction(robotSn, entry, motion.sentAt, motion).catch(() => {
|
|
65224
65346
|
});
|
|
65347
|
+
}
|
|
65225
65348
|
} catch (e) {
|
|
65226
65349
|
logCommand(account, robotSn, {
|
|
65227
65350
|
at: at2,
|
|
@@ -65266,7 +65389,6 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
65266
65389
|
await call2(PADBOT_PATHS.relocate, { ...sn, worldX: command.x, worldY: command.y });
|
|
65267
65390
|
return;
|
|
65268
65391
|
case "go-to-point": {
|
|
65269
|
-
const where = await whereIs(robotSn);
|
|
65270
65392
|
if (!padbotCanReachMap(where.all, where.mapId, command.mapId))
|
|
65271
65393
|
throw new BadRequestError135(PADBOT_OTHER_MAP_TEXT);
|
|
65272
65394
|
await call2(PADBOT_PATHS.navigateTarget, { ...sn, mapId: command.mapId, targetPointId: command.targetPointId });
|
|
@@ -65364,6 +65486,8 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
65364
65486
|
}
|
|
65365
65487
|
for (let i = 0; i < ids2.length; i += 100)
|
|
65366
65488
|
await call(PADBOT_PATHS.resolve, { alarmIds: ids2.slice(i, i + 100) });
|
|
65489
|
+
robotReads.delete(`${account}:${robotSn}`);
|
|
65490
|
+
alarmReads.delete(`${account}:${robotSn}`);
|
|
65367
65491
|
return ids2.length;
|
|
65368
65492
|
},
|
|
65369
65493
|
async getPatrolHistory(robotSn, pageNumber, pageSize) {
|
|
@@ -89970,7 +90094,7 @@ function useNewDashboardRepo() {
|
|
|
89970
90094
|
todayAttentions.push({
|
|
89971
90095
|
id: pendingIncidentDocs[0]._id.toString(),
|
|
89972
90096
|
type: "incident",
|
|
89973
|
-
title: `${pendingIncidentCount} incident${pendingIncidentCount === 1 ? "" : "s"}
|
|
90097
|
+
title: `${pendingIncidentCount} incident${pendingIncidentCount === 1 ? "" : "s"} waiting to be acknowledged`,
|
|
89974
90098
|
createdAt: pendingIncidentDocs[0].updatedAt || pendingIncidentDocs[0].createdAt || /* @__PURE__ */ new Date()
|
|
89975
90099
|
});
|
|
89976
90100
|
}
|
|
@@ -89978,7 +90102,7 @@ function useNewDashboardRepo() {
|
|
|
89978
90102
|
todayAttentions.push({
|
|
89979
90103
|
id: pendingFacilityBookingDocs[0]._id.toString(),
|
|
89980
90104
|
type: "facility-booking",
|
|
89981
|
-
title: `${pendingFacilityBookingCount} facility booking${pendingFacilityBookingCount === 1 ? "" : "s"}
|
|
90105
|
+
title: `${pendingFacilityBookingCount} facility booking${pendingFacilityBookingCount === 1 ? "" : "s"} waiting for approval`,
|
|
89982
90106
|
createdAt: pendingFacilityBookingDocs[0].createdAt || /* @__PURE__ */ new Date()
|
|
89983
90107
|
});
|
|
89984
90108
|
}
|
|
@@ -104918,20 +105042,26 @@ export {
|
|
|
104918
105042
|
PADBOT_ACTION_TEXT,
|
|
104919
105043
|
PADBOT_ALARMS,
|
|
104920
105044
|
PADBOT_ALARM_POLL_MS,
|
|
105045
|
+
PADBOT_ALARM_READ_MS,
|
|
104921
105046
|
PADBOT_ALARM_TEXT,
|
|
105047
|
+
PADBOT_ARRIVED_M,
|
|
104922
105048
|
PADBOT_BRAND,
|
|
104923
105049
|
PADBOT_BRAND_DEFINITION,
|
|
104924
105050
|
PADBOT_CAPABILITIES,
|
|
105051
|
+
PADBOT_CHARGING,
|
|
104925
105052
|
PADBOT_DISPLAY_NAME,
|
|
104926
105053
|
PADBOT_FAILURE_SHOW_MS,
|
|
104927
105054
|
PADBOT_LIVE_POSE_MS,
|
|
104928
105055
|
PADBOT_MAKER_APP_ONLY,
|
|
104929
105056
|
PADBOT_MODELS,
|
|
104930
105057
|
PADBOT_MOTION,
|
|
105058
|
+
PADBOT_MOTION_MS,
|
|
105059
|
+
PADBOT_MOVED_M,
|
|
104931
105060
|
PADBOT_MQTT_SYNC_MS,
|
|
104932
105061
|
PADBOT_ONLINE_WINDOW_MS,
|
|
104933
105062
|
PADBOT_OTHER_MAP_TEXT,
|
|
104934
105063
|
PADBOT_PATHS,
|
|
105064
|
+
PADBOT_ROBOT_READ_MS,
|
|
104935
105065
|
PATROL_CCTV_CAMERA_FILTER,
|
|
104936
105066
|
PATROL_EMAIL_MAX_LOGS,
|
|
104937
105067
|
PATROL_EMAIL_MAX_PER_HOUR,
|
|
@@ -105282,6 +105412,7 @@ export {
|
|
|
105282
105412
|
padbotLive,
|
|
105283
105413
|
padbotManualDriveEnabled,
|
|
105284
105414
|
padbotMode,
|
|
105415
|
+
padbotMotion,
|
|
105285
105416
|
padbotMqttEnabled,
|
|
105286
105417
|
padbotPatrolPlan,
|
|
105287
105418
|
padbotPatrolRecord,
|