@7365admin1/core 3.120.0 → 3.121.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
@@ -61893,7 +61893,8 @@ function normalisePatrolPlan(raw) {
61893
61893
  floorNo: Number.isInteger(route.floorNo) ? route.floorNo : null,
61894
61894
  checkpoints: drawn,
61895
61895
  currentCheckpoint: Number.isInteger(cur) && cur >= 0 && cur < drawn.length ? cur : null,
61896
- ...stops.length ? { stops } : {}
61896
+ ...stops.length ? { stops } : {},
61897
+ ...plainText(route.mapId, 80) ? { mapId: plainText(route.mapId, 80) } : {}
61897
61898
  });
61898
61899
  }
61899
61900
  const schedule = [];
@@ -64591,6 +64592,19 @@ function padbotPlanShare(frame2, x, y) {
64591
64592
  return null;
64592
64593
  return { x: Math.round(sx * 100) / 100, y: Math.round(sy * 100) / 100 };
64593
64594
  }
64595
+ function padbotCanReachMap(maps, fromMapId, toMapId) {
64596
+ if (typeof toMapId !== "string" || !toMapId || typeof fromMapId !== "string" || !fromMapId)
64597
+ return false;
64598
+ if (fromMapId === toMapId)
64599
+ return true;
64600
+ const list = Array.isArray(maps) ? maps : [];
64601
+ const group = (id) => {
64602
+ const g = list.find((m) => m?.mapId === id)?.mapGroup;
64603
+ return typeof g === "string" ? g.trim() : "";
64604
+ };
64605
+ return group(fromMapId) !== "" && group(fromMapId) === group(toMapId);
64606
+ }
64607
+ var PADBOT_OTHER_MAP_TEXT = "The robot must be on this map first.";
64594
64608
  function padbotAlarmFault(alarm) {
64595
64609
  if (!alarm?.alarmType)
64596
64610
  return null;
@@ -64643,21 +64657,19 @@ function padbotPatrolPlan(paths, maps, states = {}) {
64643
64657
  checkpoints: placed,
64644
64658
  currentCheckpoint: null,
64645
64659
  stops: placed.map((c) => c.name).filter(Boolean),
64646
- _mapId: p?.mapId,
64660
+ ...typeof p?.mapId === "string" && p.mapId ? { mapId: p.mapId } : {},
64647
64661
  _default: !!p?.isDefault
64648
64662
  };
64649
64663
  });
64650
64664
  const next = walking ? nav.nextTargetPointName : null;
64651
- const candidates = next ? routes.filter((r) => r._mapId === currentMap && r.checkpoints.some((c) => c.name === next)) : [];
64665
+ const candidates = next ? routes.filter((r) => r.mapId === currentMap && r.checkpoints.some((c) => c.name === next)) : [];
64652
64666
  if (candidates.length === 1) {
64653
64667
  const r = candidates[0];
64654
64668
  r.currentCheckpoint = r.checkpoints.findIndex((c) => c.name === next);
64655
64669
  }
64656
64670
  routes.sort((a, b) => Number(b.currentCheckpoint !== null) - Number(a.currentCheckpoint !== null) || Number(b._default) - Number(a._default));
64657
- for (const r of routes) {
64658
- delete r._mapId;
64671
+ for (const r of routes)
64659
64672
  delete r._default;
64660
- }
64661
64673
  return { routes, schedule: [], scheduleShared: false };
64662
64674
  }
64663
64675
  function padbotPatrolRecord(r) {
@@ -64871,6 +64883,7 @@ function createPadbotAdapter(credentials, options = {}) {
64871
64883
  batteryPercent: battery,
64872
64884
  floorNo: Number.isInteger(floor) ? floor : null,
64873
64885
  floorKnown: Number.isInteger(floor),
64886
+ mapId: typeof st["1007"]?.mapId === "string" && st["1007"].mapId ? st["1007"].mapId : null,
64874
64887
  position: null,
64875
64888
  planPosition: null,
64876
64889
  fault: null
@@ -64891,6 +64904,8 @@ function createPadbotAdapter(credentials, options = {}) {
64891
64904
  const ly = num(loc?.worldY ?? loc?.y);
64892
64905
  if (lx !== null && ly !== null) {
64893
64906
  robot.position = { x: lx, y: ly, theta: (num(loc.yaw ?? loc.r) ?? 0) * Math.PI / 180 };
64907
+ if (typeof loc.mapId === "string" && loc.mapId)
64908
+ robot.mapId = loc.mapId;
64894
64909
  const map = await maps(robotSn).then((all) => (all ?? []).find((m) => m.mapId === (loc.mapId ?? st["1007"]?.mapId))).catch(() => null);
64895
64910
  robot.planPosition = padbotPlanShare(map, lx, ly);
64896
64911
  }
@@ -64950,9 +64965,13 @@ function createPadbotAdapter(credentials, options = {}) {
64950
64965
  case "relocalize":
64951
64966
  await call2(PADBOT_PATHS.relocate, { ...sn, worldX: command.x, worldY: command.y });
64952
64967
  return;
64953
- case "go-to-point":
64968
+ case "go-to-point": {
64969
+ const [st, all] = await Promise.all([states(robotSn), maps(robotSn).catch(() => [])]);
64970
+ if (!padbotCanReachMap(all, st?.["1007"]?.mapId, command.mapId))
64971
+ throw new BadRequestError135(PADBOT_OTHER_MAP_TEXT);
64954
64972
  await call2(PADBOT_PATHS.navigateTarget, { ...sn, mapId: command.mapId, targetPointId: command.targetPointId });
64955
64973
  return;
64974
+ }
64956
64975
  default:
64957
64976
  throw new BadRequestError135(`PadBot robots cannot "${command.kind}" through the PadBot API.`);
64958
64977
  }
@@ -65151,6 +65170,7 @@ function useRobotFleetService(deps) {
65151
65170
  batteryPercent: null,
65152
65171
  floorNo: null,
65153
65172
  floorKnown: false,
65173
+ mapId: null,
65154
65174
  position: null,
65155
65175
  planPosition: null,
65156
65176
  fault: null,
@@ -65182,6 +65202,7 @@ function useRobotFleetService(deps) {
65182
65202
  batteryPercent: found.batteryPercent ?? null,
65183
65203
  floorNo: found.floorNo ?? null,
65184
65204
  floorKnown: found.floorKnown === true,
65205
+ mapId: typeof found.mapId === "string" && found.mapId ? found.mapId : null,
65185
65206
  position: found.position ?? null,
65186
65207
  planPosition: found.planPosition ?? null,
65187
65208
  fault,
@@ -68419,7 +68440,7 @@ function useRobotFleetController(deps) {
68419
68440
  return;
68420
68441
  heardAt = Date.now();
68421
68442
  void Promise.resolve(adapter.getMaps?.(robotSn) ?? []).then((maps) => padbotPlanShare((maps ?? []).find((m) => m?.mapId === e.mapId), e.x, e.y)).catch(() => null).then(
68422
- (planPosition) => send2({ type: "pose", pose: { x: e.x, y: e.y, theta: (e.yawDeg ?? 0) * Math.PI / 180 }, planPosition, at: Date.now() })
68443
+ (planPosition) => send2({ type: "pose", pose: { x: e.x, y: e.y, theta: (e.yawDeg ?? 0) * Math.PI / 180 }, planPosition, mapId: e.mapId ?? null, at: Date.now() })
68423
68444
  );
68424
68445
  });
68425
68446
  }
@@ -104523,6 +104544,7 @@ export {
104523
104544
  PADBOT_MOTION,
104524
104545
  PADBOT_MQTT_SYNC_MS,
104525
104546
  PADBOT_ONLINE_WINDOW_MS,
104547
+ PADBOT_OTHER_MAP_TEXT,
104526
104548
  PADBOT_PATHS,
104527
104549
  PATROL_CCTV_CAMERA_FILTER,
104528
104550
  PATROL_EMAIL_MAX_LOGS,
@@ -104858,6 +104880,7 @@ export {
104858
104880
  padbotAlarmPlace,
104859
104881
  padbotAlarmPollEnabled,
104860
104882
  padbotBaseUrl,
104883
+ padbotCanReachMap,
104861
104884
  padbotCheckpointVisit,
104862
104885
  padbotCommandLog,
104863
104886
  padbotDriveBlock,