@7365admin1/core 3.132.0 → 3.133.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
@@ -2237,10 +2237,10 @@ function useOccurrenceEntryRepo() {
2237
2237
  const cacheKey = makeCacheKey3(namespace_collection3, {
2238
2238
  dailyOccurrenceBookId
2239
2239
  });
2240
- const cached3 = await getCache(cacheKey);
2241
- if (cached3) {
2240
+ const cached4 = await getCache(cacheKey);
2241
+ if (cached4) {
2242
2242
  logger5.info(`Cache hit for key: ${cacheKey}`);
2243
- return cached3;
2243
+ return cached4;
2244
2244
  }
2245
2245
  const bookId = typeof dailyOccurrenceBookId === "string" ? new ObjectId9(dailyOccurrenceBookId) : dailyOccurrenceBookId;
2246
2246
  const data = await collection.findOne(
@@ -17963,13 +17963,13 @@ function useFileRepo() {
17963
17963
  }
17964
17964
  const cacheKey = makeCacheKey14(namespace_collection3, { _id: String(_id) });
17965
17965
  try {
17966
- const cached3 = await getCache(cacheKey);
17967
- if (cached3) {
17966
+ const cached4 = await getCache(cacheKey);
17967
+ if (cached4) {
17968
17968
  logger30.log({
17969
17969
  level: "info",
17970
17970
  message: `Cache hit for getById file: ${cacheKey}`
17971
17971
  });
17972
- return cached3;
17972
+ return cached4;
17973
17973
  }
17974
17974
  const result = await collection.findOne({
17975
17975
  _id
@@ -22065,9 +22065,9 @@ function useCameraViewService() {
22065
22065
  async function refreshProbe(target, channel) {
22066
22066
  if (!target?.enabled)
22067
22067
  return null;
22068
- const cached3 = await cachedProbe(target, channel);
22069
- if (cached3)
22070
- return cached3;
22068
+ const cached4 = await cachedProbe(target, channel);
22069
+ if (cached4)
22070
+ return cached4;
22071
22071
  const probe = await probeDeviceCapabilities({
22072
22072
  adapter: createDeviceHttpAdapter({ target, budget: authBudget }),
22073
22073
  channel
@@ -22438,9 +22438,9 @@ function useCameraViewService() {
22438
22438
  };
22439
22439
  }
22440
22440
  const cacheKey = `device:${resolved.device.host}:${resolved.device.port}`;
22441
- const cached3 = await getCache(cacheKey);
22442
- const reachable = typeof cached3 === "boolean" ? cached3 : await probeDevice(resolved.device);
22443
- if (typeof cached3 !== "boolean") {
22441
+ const cached4 = await getCache(cacheKey);
22442
+ const reachable = typeof cached4 === "boolean" ? cached4 : await probeDevice(resolved.device);
22443
+ if (typeof cached4 !== "boolean") {
22444
22444
  setCache(cacheKey, reachable, cacheSeconds).catch(
22445
22445
  (error) => logger33.info(`Camera device health cache write failed: ${error?.message}`)
22446
22446
  );
@@ -22473,10 +22473,10 @@ function useCameraViewService() {
22473
22473
  const subtype = knownNoSubStream ? 0 : wanted;
22474
22474
  const fellBackFromCache = subtype !== wanted;
22475
22475
  const cacheKey = `snapshot:${params.cameraId}:${subtype}`;
22476
- const cached3 = await getCache(cacheKey);
22477
- if (cached3) {
22476
+ const cached4 = await getCache(cacheKey);
22477
+ if (cached4) {
22478
22478
  return {
22479
- buffer: Buffer.from(cached3, "base64"),
22479
+ buffer: Buffer.from(cached4, "base64"),
22480
22480
  cached: true,
22481
22481
  stream: subtype === 0 ? "main" : "sub",
22482
22482
  fellBackToMain: fellBackFromCache
@@ -22566,9 +22566,9 @@ function useCameraViewService() {
22566
22566
  };
22567
22567
  }
22568
22568
  const cacheKey = `device:${resolved.device.host}:${resolved.device.port}`;
22569
- const cached3 = await getCache(cacheKey);
22570
- const reachable = typeof cached3 === "boolean" ? cached3 : await probeDevice(resolved.device);
22571
- if (typeof cached3 !== "boolean") {
22569
+ const cached4 = await getCache(cacheKey);
22570
+ const reachable = typeof cached4 === "boolean" ? cached4 : await probeDevice(resolved.device);
22571
+ if (typeof cached4 !== "boolean") {
22572
22572
  setCache(cacheKey, reachable, DEVICE_HEALTH_CACHE_SECONDS).catch(
22573
22573
  (error) => logger33.info(`Camera device health cache write failed: ${error?.message}`)
22574
22574
  );
@@ -25839,13 +25839,13 @@ function usePersonRepo() {
25839
25839
  _id: String(_id)
25840
25840
  });
25841
25841
  try {
25842
- const cached3 = await getCache(cacheKey);
25843
- if (cached3) {
25842
+ const cached4 = await getCache(cacheKey);
25843
+ if (cached4) {
25844
25844
  logger39.log({
25845
25845
  level: "info",
25846
25846
  message: `Cache hit for getById person: ${cacheKey}`
25847
25847
  });
25848
- return cached3;
25848
+ return cached4;
25849
25849
  }
25850
25850
  const result = await collection.findOne({
25851
25851
  _id
@@ -26271,13 +26271,13 @@ function usePersonRepo() {
26271
26271
  user: userId
26272
26272
  });
26273
26273
  try {
26274
- const cached3 = await getCache(cacheKey);
26275
- if (cached3) {
26274
+ const cached4 = await getCache(cacheKey);
26275
+ if (cached4) {
26276
26276
  logger39.log({
26277
26277
  level: "info",
26278
26278
  message: `Cache hit for getByUserId person: ${cacheKey}`
26279
26279
  });
26280
- return cached3;
26280
+ return cached4;
26281
26281
  }
26282
26282
  const result = await collection.findOne({
26283
26283
  user
@@ -36966,13 +36966,13 @@ function useBuildingUnitRepo() {
36966
36966
  message: `Cache key for getAll building units: ${cacheKey}`
36967
36967
  });
36968
36968
  try {
36969
- const cached3 = await getCache(cacheKey);
36970
- if (cached3) {
36969
+ const cached4 = await getCache(cacheKey);
36970
+ if (cached4) {
36971
36971
  logger69.log({
36972
36972
  level: "info",
36973
36973
  message: `Cache hit for getAll building units: ${cacheKey}`
36974
36974
  });
36975
- return cached3;
36975
+ return cached4;
36976
36976
  }
36977
36977
  const pipeline = [
36978
36978
  { $match: query2 },
@@ -37107,13 +37107,13 @@ function useBuildingUnitRepo() {
37107
37107
  message: `Cache key for getAll building units: ${cacheKey}`
37108
37108
  });
37109
37109
  try {
37110
- const cached3 = await getCache(cacheKey);
37111
- if (cached3) {
37110
+ const cached4 = await getCache(cacheKey);
37111
+ if (cached4) {
37112
37112
  logger69.log({
37113
37113
  level: "info",
37114
37114
  message: `Cache hit for getAll building units: ${cacheKey}`
37115
37115
  });
37116
- return cached3;
37116
+ return cached4;
37117
37117
  }
37118
37118
  const items = await collection.aggregate(
37119
37119
  [
@@ -37202,13 +37202,13 @@ function useBuildingUnitRepo() {
37202
37202
  level: level2
37203
37203
  });
37204
37204
  try {
37205
- const cached3 = await getCache(cacheKey);
37206
- if (cached3) {
37205
+ const cached4 = await getCache(cacheKey);
37206
+ if (cached4) {
37207
37207
  logger69.log({
37208
37208
  level: "info",
37209
37209
  message: `Cache hit for getById building unit: ${cacheKey}`
37210
37210
  });
37211
- return cached3;
37211
+ return cached4;
37212
37212
  }
37213
37213
  const result = await collection.findOne({
37214
37214
  building,
@@ -37275,13 +37275,13 @@ function useBuildingUnitRepo() {
37275
37275
  building: String(building)
37276
37276
  });
37277
37277
  try {
37278
- const cached3 = await getCache(cacheKey);
37279
- if (cached3) {
37278
+ const cached4 = await getCache(cacheKey);
37279
+ if (cached4) {
37280
37280
  logger69.log({
37281
37281
  level: "info",
37282
37282
  message: `Cache hit for getById building unit: ${cacheKey}`
37283
37283
  });
37284
- return cached3;
37284
+ return cached4;
37285
37285
  }
37286
37286
  const result = await collection.findOne({
37287
37287
  building,
@@ -37487,13 +37487,13 @@ function useBuildingUnitRepo() {
37487
37487
  cacheOptions
37488
37488
  );
37489
37489
  try {
37490
- const cached3 = await getCache(cacheKey);
37491
- if (cached3) {
37490
+ const cached4 = await getCache(cacheKey);
37491
+ if (cached4) {
37492
37492
  logger69.log({
37493
37493
  level: "info",
37494
37494
  message: `Cache hit for getById building unit: ${cacheKey}`
37495
37495
  });
37496
- return cached3;
37496
+ return cached4;
37497
37497
  }
37498
37498
  const result = await collection.findOne(query2, {
37499
37499
  session
@@ -37533,13 +37533,13 @@ function useBuildingUnitRepo() {
37533
37533
  level: level2
37534
37534
  });
37535
37535
  try {
37536
- const cached3 = await getCache(cacheKey);
37537
- if (cached3) {
37536
+ const cached4 = await getCache(cacheKey);
37537
+ if (cached4) {
37538
37538
  logger69.log({
37539
37539
  level: "info",
37540
37540
  message: `Cache hit for getById building unit: ${cacheKey}`
37541
37541
  });
37542
- return cached3;
37542
+ return cached4;
37543
37543
  }
37544
37544
  const query2 = {
37545
37545
  site,
@@ -37905,9 +37905,9 @@ function useVehicleService() {
37905
37905
  const siteZones = /* @__PURE__ */ new Map();
37906
37906
  async function siteTimezone(site) {
37907
37907
  const key = String(site ?? "");
37908
- const cached3 = siteZones.get(key);
37909
- if (cached3 && Date.now() - cached3.at < 5 * 6e4)
37910
- return cached3.zone;
37908
+ const cached4 = siteZones.get(key);
37909
+ if (cached4 && Date.now() - cached4.at < 5 * 6e4)
37910
+ return cached4.zone;
37911
37911
  let zone = resolveSiteTimezone(null);
37912
37912
  if (key) {
37913
37913
  try {
@@ -40801,13 +40801,13 @@ function useBuildingRepo() {
40801
40801
  message: `Cache key for getAll buildings: ${cacheKey}`
40802
40802
  });
40803
40803
  try {
40804
- const cached3 = await getCache(cacheKey);
40805
- if (cached3) {
40804
+ const cached4 = await getCache(cacheKey);
40805
+ if (cached4) {
40806
40806
  logger76.log({
40807
40807
  level: "info",
40808
40808
  message: `Cache hit for getAll buildings: ${cacheKey}`
40809
40809
  });
40810
- return cached3;
40810
+ return cached4;
40811
40811
  }
40812
40812
  const items = await collection.aggregate(
40813
40813
  [
@@ -40936,13 +40936,13 @@ function useBuildingRepo() {
40936
40936
  _id: String(_id)
40937
40937
  });
40938
40938
  try {
40939
- const cached3 = await getCache(cacheKey);
40940
- if (cached3) {
40939
+ const cached4 = await getCache(cacheKey);
40940
+ if (cached4) {
40941
40941
  logger76.log({
40942
40942
  level: "info",
40943
40943
  message: `Cache hit for getById building: ${cacheKey}`
40944
40944
  });
40945
- return cached3;
40945
+ return cached4;
40946
40946
  }
40947
40947
  const result = await collection.findOne({
40948
40948
  _id
@@ -41006,13 +41006,13 @@ function useBuildingRepo() {
41006
41006
  const cacheOptions = { ...query2 };
41007
41007
  const cacheKey = makeCacheKey28(buildings_namespace_collection, cacheOptions);
41008
41008
  try {
41009
- const cached3 = await getCache(cacheKey);
41010
- if (cached3) {
41009
+ const cached4 = await getCache(cacheKey);
41010
+ if (cached4) {
41011
41011
  logger76.log({
41012
41012
  level: "info",
41013
41013
  message: `Cache hit for getById building: ${cacheKey}`
41014
41014
  });
41015
- return cached3;
41015
+ return cached4;
41016
41016
  }
41017
41017
  const result = await collection.findOne(query2);
41018
41018
  setCache(cacheKey, result, 300).then(() => {
@@ -41510,13 +41510,13 @@ function useBuildingLevelRepo() {
41510
41510
  message: `Cache key for getAll building levels: ${cacheKey}`
41511
41511
  });
41512
41512
  try {
41513
- const cached3 = await getCache(cacheKey);
41514
- if (cached3) {
41513
+ const cached4 = await getCache(cacheKey);
41514
+ if (cached4) {
41515
41515
  logger78.log({
41516
41516
  level: "info",
41517
41517
  message: `Cache hit for getAll building levels: ${cacheKey}`
41518
41518
  });
41519
- return cached3;
41519
+ return cached4;
41520
41520
  }
41521
41521
  const sortStage = Object.keys(sort).length > 0 ? { $sort: sort } : { $sort: { name: 1 } };
41522
41522
  const items = await collection.aggregate(
@@ -41561,13 +41561,13 @@ function useBuildingLevelRepo() {
41561
41561
  const cacheKey = makeCacheKey29(building_level_namespace_collection, {
41562
41562
  _id
41563
41563
  });
41564
- const cached3 = await getCache(cacheKey);
41565
- if (cached3) {
41564
+ const cached4 = await getCache(cacheKey);
41565
+ if (cached4) {
41566
41566
  logger78.log({
41567
41567
  level: "info",
41568
41568
  message: `Cache hit for getById building level: ${cacheKey}`
41569
41569
  });
41570
- return cached3;
41570
+ return cached4;
41571
41571
  }
41572
41572
  try {
41573
41573
  _id = new ObjectId88(_id);
@@ -45241,7 +45241,7 @@ function useCameraViewController() {
45241
45241
  }
45242
45242
  async function snapshot2(req, res, next) {
45243
45243
  try {
45244
- const { buffer, cached: cached3, stream, fellBackToMain } = await getSnapshot({
45244
+ const { buffer, cached: cached4, stream, fellBackToMain } = await getSnapshot({
45245
45245
  cameraId: String(req.params.id ?? ""),
45246
45246
  userId: callerId5(req)
45247
45247
  });
@@ -45250,7 +45250,7 @@ function useCameraViewController() {
45250
45250
  "Cache-Control",
45251
45251
  `private, max-age=${CAMERA_SNAPSHOT_CACHE_SECONDS}`
45252
45252
  );
45253
- res.setHeader("X-Camera-Snapshot-Cached", cached3 ? "1" : "0");
45253
+ res.setHeader("X-Camera-Snapshot-Cached", cached4 ? "1" : "0");
45254
45254
  res.setHeader("X-Camera-Stream", stream);
45255
45255
  res.setHeader("X-Camera-Stream-Fallback", fellBackToMain ? "1" : "0");
45256
45256
  res.status(200).end(buffer);
@@ -63568,6 +63568,9 @@ var ROBOT_CLOUD_PATHS = {
63568
63568
  taskList: "/portal/cleaning/get-task-list",
63569
63569
  alertList: "/portal/alert/get-alert-list",
63570
63570
  liftList: "/portal/lift/get-lift-list",
63571
+ workHours: "/portal/workhours/get-work-hours",
63572
+ haltPlans: "/portal/halt-plan/get",
63573
+ stationState: "/portal/detailstate/get-station-detail-state",
63571
63574
  mapList: "/portal/maps/get-map-list",
63572
63575
  fileUrl: "/portal/maps/get-file-url",
63573
63576
  tracking: "/portal/robots/tracking",
@@ -63864,6 +63867,9 @@ var STEP_NAMES = {
63864
63867
  [ROBOT_CLOUD_PATHS.filePreview]: "the map images",
63865
63868
  [ROBOT_CLOUD_PATHS.plansV2]: "the cleaning schedule",
63866
63869
  [ROBOT_CLOUD_PATHS.taskList]: "the cleaning records",
63870
+ [ROBOT_CLOUD_PATHS.workHours]: "the consumable hours",
63871
+ [ROBOT_CLOUD_PATHS.haltPlans]: "the power schedule",
63872
+ [ROBOT_CLOUD_PATHS.stationState]: "the base station state",
63867
63873
  [ROBOT_CLOUD_PATHS.alertList]: "the alert history",
63868
63874
  [ROBOT_CLOUD_PATHS.liftList]: "the lift list"
63869
63875
  };
@@ -64068,6 +64074,23 @@ function useRobotCloudService(credentials, options = {}) {
64068
64074
  async function getLiftList(sceneId) {
64069
64075
  return post(ROBOT_CLOUD_PATHS.liftList, { sceneid: sceneId }, "liftlist");
64070
64076
  }
64077
+ async function getWorkHours(robotId) {
64078
+ return post(ROBOT_CLOUD_PATHS.workHours, { robotId }, "unitlist");
64079
+ }
64080
+ async function getHaltPlans(robotId) {
64081
+ return post(
64082
+ ROBOT_CLOUD_PATHS.haltPlans,
64083
+ { planId: 0, robotId, pageNo: 1, pageSize: 20 },
64084
+ "planList"
64085
+ );
64086
+ }
64087
+ async function getStationState(robotId) {
64088
+ const data = await post(
64089
+ ROBOT_CLOUD_PATHS.stationState,
64090
+ { robotId, options: "state" }
64091
+ );
64092
+ return data.state ?? null;
64093
+ }
64071
64094
  async function getMaps(robotSn) {
64072
64095
  const data = await post(
64073
64096
  ROBOT_CLOUD_PATHS.mapList,
@@ -64149,6 +64172,9 @@ function useRobotCloudService(credentials, options = {}) {
64149
64172
  getPlansV2,
64150
64173
  getTaskList,
64151
64174
  getAlerts,
64175
+ getWorkHours,
64176
+ getHaltPlans,
64177
+ getStationState,
64152
64178
  getLiftList,
64153
64179
  getMaps,
64154
64180
  getFileUrls,
@@ -64162,6 +64188,7 @@ function useRobotCloudService(credentials, options = {}) {
64162
64188
  }
64163
64189
 
64164
64190
  // src/services/ounitech.adapter.ts
64191
+ import axios4 from "axios";
64165
64192
  var OUNITECH_BRAND = "ounitech";
64166
64193
  var OUNITECH_CAPABILITIES = {
64167
64194
  // Pose in the chapter-6 robot list (metres) and the tracking stream.
@@ -64343,12 +64370,319 @@ function ounitechFault(list) {
64343
64370
  return { code: "error", message: String(list[0]).slice(0, 200) };
64344
64371
  return { code: "error", message: "The robot reports an error" };
64345
64372
  }
64373
+ function ounitechMapShare(map, x, y) {
64374
+ const w = map?.width, h = map?.height, r = map?.resolution;
64375
+ const wx = num(x), wy = num(y);
64376
+ if (!finite(w) || !finite(h) || !finite(r) || w <= 0 || h <= 0 || r <= 0 || wx === void 0 || wy === void 0)
64377
+ return null;
64378
+ const sx = (wx - (num(map?.originX) ?? 0)) / r / w * 100;
64379
+ const sy = 100 - (wy - (num(map?.originY) ?? 0)) / r / h * 100;
64380
+ if (sx < 0 || sx > 100 || sy < 0 || sy > 100)
64381
+ return null;
64382
+ return { x: Math.round(sx * 100) / 100, y: Math.round(sy * 100) / 100 };
64383
+ }
64384
+ function ounitechMapView(m, imageUrl, partitionImageUrl, size) {
64385
+ const floorNo2 = Number.isInteger(m.floorNo) ? m.floorNo : null;
64386
+ const width = size?.width ?? null;
64387
+ const height = size?.height ?? null;
64388
+ const frame2 = { width, height, resolution: m.resolution, originX: m.originX, originY: m.originY };
64389
+ const areas = (Array.isArray(m.areaList) ? m.areaList : []).filter((a) => typeof a?.areaName === "string" && a.areaName.trim()).map((a) => {
64390
+ const px = num(a.x), py = num(a.y);
64391
+ const at2 = width && height && px !== void 0 && py !== void 0 && (px > 0 || py > 0) && px <= width && py <= height ? { x: Math.round(px / width * 1e4) / 100, y: Math.round(py / height * 1e4) / 100 } : null;
64392
+ return { ...a.areaId != null ? { areaId: a.areaId } : {}, areaName: a.areaName.trim(), rgba: a.rgba, x: a.x, y: a.y, at: at2 };
64393
+ });
64394
+ return {
64395
+ mapId: String(m.mapId ?? `floor-${floorNo2 ?? 0}`),
64396
+ floor: floorNo2,
64397
+ floorNo: floorNo2,
64398
+ mapDisplayName: String(m.mapName ?? "").trim(),
64399
+ mapName: m.mapName,
64400
+ imageUrl,
64401
+ partitionImageUrl,
64402
+ width,
64403
+ height,
64404
+ resolution: m.resolution,
64405
+ originX: m.originX,
64406
+ originY: m.originY,
64407
+ backgroundFileKey: m.backgroundFileKey,
64408
+ partitionFileKey: m.partitionFileKey,
64409
+ totalArea: m.totalArea,
64410
+ baseX: m.baseX,
64411
+ baseY: m.baseY,
64412
+ baseTheta: m.baseTheta,
64413
+ createTime: m.createTime,
64414
+ dock: ounitechMapShare(frame2, m.baseX ?? 0, m.baseY ?? 0),
64415
+ positionApproximate: true,
64416
+ // The raw areas, kept for older screens.
64417
+ areaList: areas.map(({ at: _at, ...a }) => a),
64418
+ areas: areas.map((a) => ({ name: a.areaName, at: a.at }))
64419
+ };
64420
+ }
64421
+ function ounitechCurrentMap(maps, taskMapId, floorNo2) {
64422
+ const byTask = taskMapId != null ? maps.find((m) => m.mapId === String(taskMapId)) : void 0;
64423
+ if (byTask)
64424
+ return byTask;
64425
+ if (Number.isInteger(floorNo2))
64426
+ return maps.find((m) => m.floorNo === floorNo2) ?? null;
64427
+ return maps.length === 1 ? maps[0] : null;
64428
+ }
64429
+ function pngSize(bytes) {
64430
+ if (!bytes || bytes.length < 24)
64431
+ return null;
64432
+ const ihdr = String.fromCharCode(bytes[12], bytes[13], bytes[14], bytes[15]);
64433
+ if (bytes[1] !== 80 || ihdr !== "IHDR")
64434
+ return null;
64435
+ const dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
64436
+ const width = dv.getUint32(16), height = dv.getUint32(20);
64437
+ return width > 0 && height > 0 && width < 2e4 && height < 2e4 ? { width, height } : null;
64438
+ }
64439
+ async function fetchPngSize(url2) {
64440
+ try {
64441
+ const res = await axios4.get(url2, { responseType: "arraybuffer", headers: { Range: "bytes=0-63" }, timeout: 8e3 });
64442
+ return pngSize(new Uint8Array(res.data));
64443
+ } catch {
64444
+ return null;
64445
+ }
64446
+ }
64447
+ function ounitechTime(v, tzMinutes = 480) {
64448
+ const m = typeof v === "string" ? /^(\d{4}-\d{2}-\d{2})[ T](\d{2}:\d{2}(?::\d{2})?)/.exec(v.trim()) : null;
64449
+ if (!m)
64450
+ return null;
64451
+ const t = Date.parse(`${m[1]}T${m[2].length === 5 ? `${m[2]}:00` : m[2]}Z`) - tzMinutes * 6e4;
64452
+ return Number.isFinite(t) ? new Date(t).toISOString() : null;
64453
+ }
64454
+ var MODE_WORDS = { \u5438\u5C18: "Vacuum", \u6D17\u5730: "Wash floor", \u5C18\u63A8: "Dust mop", \u62D6\u5730: "Mop" };
64455
+ var TYPE_WORDS = {
64456
+ \u51C6\u5907\u6E05\u6D01: "Getting ready",
64457
+ \u8131\u79BB\u57FA\u7AD9\u4E2D: "Leaving the charger",
64458
+ \u5168\u5C40\u6E05\u626B: "Clean all",
64459
+ \u5206\u533A\u6E05\u626B: "Area clean",
64460
+ \u5B9A\u70B9\u6E05\u626B: "Spot clean",
64461
+ \u56DE\u5145: "Returning to charge",
64462
+ \u6CBF\u8FB9\u6E05\u626B: "Edge clean"
64463
+ };
64464
+ var SOURCE_WORDS = { plan: "Schedule", app: "Ounitech app", btn: "Button on the robot" };
64465
+ var round1 = (v) => v !== void 0 ? Math.round(v * 10) / 10 : null;
64466
+ function ounitechTaskRecord(t, maps = [], tz = 480) {
64467
+ const map = maps.find((m) => m.mapId === String(t.mapId));
64468
+ const kind = String(t.typeName ?? "").trim();
64469
+ const mode = String(t.subTypeName ?? "").trim();
64470
+ const src = String(t.source ?? "").split(",")[0].trim();
64471
+ const mileage = num(t.cleanedMileage);
64472
+ return {
64473
+ id: String(t.taskId ?? ""),
64474
+ start: ounitechTime(t.timeFrom, tz),
64475
+ end: ounitechTime(t.timeTo, tz),
64476
+ durationSec: num(t.durationSeconds) ?? num(t.accTime) ?? null,
64477
+ areaM2: round1(num(t.cleanedArea) ?? num(t.accArea)),
64478
+ plannedM2: round1(num(t.countArea)),
64479
+ percent: num(t.accPercent) ?? null,
64480
+ distanceM: mileage !== void 0 ? Math.round(mileage) : null,
64481
+ result: String(t.statusName ?? "").trim() || null,
64482
+ job: TYPE_WORDS[kind] ?? (kind || null),
64483
+ mode: MODE_WORDS[mode] ?? (mode || null),
64484
+ source: SOURCE_WORDS[src] ?? (src || null),
64485
+ map: map ? map.mapDisplayName || (map.floorNo !== null ? `Floor ${map.floorNo}` : null) : null,
64486
+ floorNo: Number.isInteger(t.floorNo) ? t.floorNo : map?.floorNo ?? null
64487
+ };
64488
+ }
64489
+ var ALERT_WORDS = {
64490
+ "540": "Floor check: cliff sensor switched on",
64491
+ "601": "Left wheel driver reset",
64492
+ "620": "Right wheel driver offline",
64493
+ "621": "Right wheel driver reset",
64494
+ "734": "IMU zero offset too large",
64495
+ "785": "Localisation ready"
64496
+ };
64497
+ var ALERT_LEVEL_WORDS = { \u63D0\u793A: "Notice", \u8B66\u544A: "Warning", \u6545\u969C: "Fault", \u9519\u8BEF: "Error", \u4E25\u91CD: "Critical" };
64498
+ function ounitechAlertRecord(a, tz = 480) {
64499
+ const raw = String(a.errMsg ?? a.errCode ?? "").trim();
64500
+ const m = /^\s*(\d+)\s*-\s*(.*)$/.exec(raw);
64501
+ const code = m?.[1] ?? "";
64502
+ let rest = (m?.[2] ?? raw).trim();
64503
+ const resolved = /\(Resolved\)\s*$/i.test(rest);
64504
+ rest = rest.replace(/\(Resolved\)\s*$/i, "").replace(/\(\s*\d+\s*\)\s*$/, "").trim();
64505
+ const lv = /^\(([^)]*)\)/.exec(rest);
64506
+ if (lv)
64507
+ rest = rest.slice(lv[0].length).trim();
64508
+ return {
64509
+ code,
64510
+ level: lv ? ALERT_LEVEL_WORDS[lv[1].trim()] ?? lv[1].trim() : null,
64511
+ message: ALERT_WORDS[code] ?? (rest || raw),
64512
+ vendorText: rest || raw,
64513
+ resolved,
64514
+ at: ounitechTime(a.createTime, tz)
64515
+ };
64516
+ }
64517
+ var READINGS = {
64518
+ "battery-percent": { group: "Battery", label: "Battery", unit: "%" },
64519
+ "left-battery-percent": { group: "Battery", label: "Left battery", unit: "%" },
64520
+ "right-battery-percent": { group: "Battery", label: "Right battery", unit: "%" },
64521
+ "bat-vol-left": { group: "Battery", label: "Left battery voltage", unit: "V" },
64522
+ "bat-vol-right": { group: "Battery", label: "Right battery voltage", unit: "V" },
64523
+ BatteryOffline: { group: "Battery", label: "Battery disconnected", bad: "true" },
64524
+ BatteryClosed: { group: "Battery", label: "Battery switched off", bad: "true" },
64525
+ "clean-water": { group: "Water", label: "Clean water", unit: "%" },
64526
+ "dirty-water": { group: "Water", label: "Dirty water", unit: "%" },
64527
+ "clean-water-level": { group: "Water", label: "Clean water level" },
64528
+ "dirty-water-level": { group: "Water", label: "Dirty water level" },
64529
+ "ctank-full": { group: "Water", label: "Clean water tank full" },
64530
+ "cmop-pump-low": { group: "Water", label: "Mop water running low", bad: "true" },
64531
+ "top-cover": { group: "Parts in place", label: "Top cover closed", bad: "false" },
64532
+ "hand-push-rod": { group: "Parts in place", label: "Push handle in place", bad: "false" },
64533
+ "clean-water-tank": { group: "Parts in place", label: "Clean water tank fitted", bad: "false" },
64534
+ "waste-water-tank": { group: "Parts in place", label: "Dirty water tank fitted", bad: "false" },
64535
+ "dust-box": { group: "Parts in place", label: "Dust box fitted", bad: "false" },
64536
+ "collision-left": { group: "Sensors", label: "Left bumper pressed", bad: "true" },
64537
+ "collision-right": { group: "Sensors", label: "Right bumper pressed", bad: "true" },
64538
+ "wfan-brake-flag": { group: "Sensors", label: "Water suction fan blocked", bad: "true" },
64539
+ "sfan-brake-flag": { group: "Sensors", label: "Dust suction fan blocked", bad: "true" },
64540
+ "wfan-brake-percent": { group: "Sensors", label: "Water suction fan blockage", unit: "%" },
64541
+ "sfan-brake-percent": { group: "Sensors", label: "Dust suction fan blockage", unit: "%" },
64542
+ job: { group: "Current job", label: "Job" },
64543
+ status: { group: "Current job", label: "Work status" },
64544
+ "acc-percent": { group: "Current job", label: "Job done", unit: "%" },
64545
+ "acc-area": { group: "Current job", label: "Area cleaned", unit: "m\xB2" },
64546
+ "count-area": { group: "Current job", label: "Area planned", unit: "m\xB2" },
64547
+ "acc-mile": { group: "Current job", label: "Distance driven", unit: "m" },
64548
+ "acc-time": { group: "Current job", label: "Cleaning time" },
64549
+ "acc-task": { group: "Current job", label: "Jobs counted" },
64550
+ "avg-speed": { group: "Current job", label: "Average speed", unit: "m\xB2/s" },
64551
+ x: { group: "Position", label: "Position x", unit: "m" },
64552
+ y: { group: "Position", label: "Position y", unit: "m" },
64553
+ theta: { group: "Position", label: "Heading", unit: "rad" },
64554
+ "mcu-state": { group: "Connection", label: "Main board connected", bad: "false" },
64555
+ bslink: { group: "Connection", label: "Linked to the base station" },
64556
+ RouterSignalStrength: { group: "Connection", label: "Mobile signal" },
64557
+ IsOfflineMode: { group: "Connection", label: "Offline mode", bad: "true" },
64558
+ OfflineVersion: { group: "Software", label: "Offline map version" },
64559
+ McuSW: { group: "Software", label: "Main board software" },
64560
+ FaceH7SW: { group: "Software", label: "Front panel software" },
64561
+ SlamType: { group: "Software", label: "Mapping type" },
64562
+ LockType: { group: "Software", label: "Lock type" }
64563
+ };
64564
+ var STATION_READINGS = {
64565
+ "clean-water": { group: "Base station", label: "Station clean water", unit: "L" },
64566
+ "dirty-water": { group: "Base station", label: "Station dirty water", unit: "L" },
64567
+ "clean-percent": { group: "Base station", label: "Station clean water", unit: "%" },
64568
+ "dirty-percent": { group: "Base station", label: "Station dirty water", unit: "%" },
64569
+ temperature: { group: "Base station", label: "Station temperature", unit: "\xB0C" },
64570
+ "bluetooth-err": { group: "Base station", label: "Bluetooth fault", bad: "true" },
64571
+ "charge-err": { group: "Base station", label: "Charging fault", bad: "true" },
64572
+ "clean-box-err": { group: "Base station", label: "Clean water box fault", bad: "true" },
64573
+ "clean-pump-err": { group: "Base station", label: "Clean water pump fault", bad: "true" },
64574
+ "dirty-box-err": { group: "Base station", label: "Dirty water box fault", bad: "true" },
64575
+ "dirty-pump-err": { group: "Base station", label: "Dirty water pump fault", bad: "true" },
64576
+ "dust-box-err": { group: "Base station", label: "Dust box fault", bad: "true" },
64577
+ "dust-fan-err": { group: "Base station", label: "Dust fan fault", bad: "true" },
64578
+ "ir-err": { group: "Base station", label: "Docking sensor fault", bad: "true" },
64579
+ "solenoid-err": { group: "Base station", label: "Water valve fault", bad: "true" },
64580
+ "temperature-err": { group: "Base station", label: "Temperature fault", bad: "true" },
64581
+ "water-sensor-err": { group: "Base station", label: "Water sensor fault", bad: "true" }
64582
+ };
64583
+ var HIDDEN_READINGS = /* @__PURE__ */ new Set(["RobotIP", "RouterIccid"]);
64584
+ var LEVEL_READING = { \u4F4E: "Low", \u4E2D: "Medium", \u9AD8: "High", \u7A7A: "Empty", \u6EE1: "Full" };
64585
+ function ounitechReadings(props, station = false) {
64586
+ const defs = station ? STATION_READINGS : READINGS;
64587
+ const out = [];
64588
+ for (const p of Array.isArray(props) ? props : []) {
64589
+ const key = String(p?.key ?? "").trim();
64590
+ if (!key || HIDDEN_READINGS.has(key))
64591
+ continue;
64592
+ const raw = p?.value == null ? "" : String(p.value).trim();
64593
+ if (raw === "" || raw === "-")
64594
+ continue;
64595
+ const d = defs[key] ?? { group: station ? "Base station" : "Other readings", label: key };
64596
+ let value;
64597
+ if (raw === "true" || raw === "false")
64598
+ value = raw === "true" ? "Yes" : "No";
64599
+ else if (key === "job")
64600
+ value = JOB_WORDS[raw] ?? raw;
64601
+ else if (key === "status")
64602
+ value = ROBOT_STATUS_NAMES[STATUS_CODE_BY_READING[raw] ?? -1] ?? raw;
64603
+ else if (LEVEL_READING[raw])
64604
+ value = LEVEL_READING[raw];
64605
+ else if (key === "acc-time" && num(raw) !== void 0)
64606
+ value = `${Math.round(num(raw) / 60)} min`;
64607
+ else
64608
+ value = d.unit === "%" ? `${raw}%` : d.unit ? `${raw} ${d.unit}` : raw;
64609
+ out.push({ key, group: d.group, label: d.label, value, attention: !!d.bad && raw === d.bad });
64610
+ }
64611
+ return out;
64612
+ }
64613
+ var PART_WORDS = {
64614
+ left_side_brush_plastic: "Left side brush",
64615
+ right_side_brush_plastic: "Right side brush",
64616
+ dust_bag: "Dust bag",
64617
+ single_suction_mouth_rubber: "Suction rubber",
64618
+ floor_brush_double_roller_structure: "Floor brush rollers",
64619
+ floor_mop_double_roller_structure: "Mop rollers"
64620
+ };
64621
+ function ounitechConsumable(u) {
64622
+ const code = String(u.unitcode ?? "").trim();
64623
+ const minutes = num(u.workminutes);
64624
+ return {
64625
+ part: PART_WORDS[code] ?? (code.replace(/_/g, " ") || String(u.unitname ?? "").trim() || "Part"),
64626
+ hours: minutes !== void 0 ? Math.round(minutes / 6) / 10 : null,
64627
+ days: num(u.workdays) ?? null
64628
+ };
64629
+ }
64630
+ function ounitechPowerPlan(p) {
64631
+ return {
64632
+ days: (Array.isArray(p.dateList) ? p.dateList : []).map(Number).filter((d) => d >= 1 && d <= 7),
64633
+ time: String(p.actionTime ?? "").trim(),
64634
+ action: Number(p.actionFlag) === 1 ? "on" : "off",
64635
+ enabled: p.enableFlag !== false
64636
+ };
64637
+ }
64638
+ var MAP_TTL_MS = 10 * 6e4;
64639
+ var RECORDS_TTL_MS = 2 * 6e4;
64640
+ var mapCache = /* @__PURE__ */ new Map();
64641
+ var recordsCache = /* @__PURE__ */ new Map();
64642
+ function cached2(cache3, field, key, ttl, load) {
64643
+ const hit = cache3.get(key);
64644
+ if (hit && Date.now() - hit.at < ttl)
64645
+ return hit[field];
64646
+ const p = load();
64647
+ cache3.set(key, { at: Date.now(), [field]: p });
64648
+ p.catch(() => cache3.delete(key));
64649
+ return p;
64650
+ }
64651
+ function clearOunitechCaches() {
64652
+ mapCache.clear();
64653
+ recordsCache.clear();
64654
+ }
64346
64655
  var robotTime = (d) => robotCloudTimestamp(d, "yyyy-MM-dd HH:mm:ss", "Asia/Shanghai");
64347
64656
  function createOunitechAdapter(credentials, options) {
64348
64657
  const cloud = useRobotCloudService(credentials, options);
64349
64658
  async function liveFor(row) {
64350
64659
  return needsLiveState(row) ? cloud.getRobotState(row.robotId).catch(() => null) : null;
64351
64660
  }
64661
+ function floorMaps(sceneId) {
64662
+ return cached2(mapCache, "maps", `${options?.baseUrl ?? ""}|${credentials.appid}|${sceneId}`, MAP_TTL_MS, async () => {
64663
+ const list = (await cloud.getFloorMaps(sceneId)).filter((m) => m.latestFlag !== false);
64664
+ const keys = list.flatMap((m) => [m.backgroundFileKey, m.partitionFileKey]).filter((k) => typeof k === "string" && !!k);
64665
+ const files = keys.length ? await cloud.previewFiles(keys).catch(() => []) : [];
64666
+ const url2 = (k) => files.find((f) => f.fileKey === k)?.url || null;
64667
+ return Promise.all(
64668
+ list.map(async (m) => {
64669
+ const imageUrl = url2(m.backgroundFileKey);
64670
+ return ounitechMapView(m, imageUrl, url2(m.partitionFileKey), imageUrl ? await fetchPngSize(imageUrl) : null);
64671
+ })
64672
+ );
64673
+ });
64674
+ }
64675
+ async function placed(row, robot) {
64676
+ if (!robot.online || !finite(row.sceneId))
64677
+ return robot;
64678
+ const maps = await floorMaps(row.sceneId).catch(() => []);
64679
+ const map = ounitechCurrentMap(maps, row.taskState?.mapId, robot.floorNo);
64680
+ if (!map)
64681
+ return robot;
64682
+ robot.mapId = map.mapId;
64683
+ robot.planPosition = robot.position ? ounitechMapShare(map, robot.position.x, robot.position.y) : null;
64684
+ return robot;
64685
+ }
64352
64686
  async function rowFor(robotSn) {
64353
64687
  return (await cloud.getHomeRobots()).find((r) => r.robotSn === robotSn) ?? null;
64354
64688
  }
@@ -64357,7 +64691,9 @@ function createOunitechAdapter(credentials, options) {
64357
64691
  displayName: "Ounitech (Q3-G / Q3-W)",
64358
64692
  capabilities: OUNITECH_CAPABILITIES,
64359
64693
  async listRobots() {
64360
- return Promise.all((await cloud.getHomeRobots()).map(async (row) => ounitechRobotFromHomeRow(row, await liveFor(row))));
64694
+ return Promise.all(
64695
+ (await cloud.getHomeRobots()).map(async (row) => placed(row, ounitechRobotFromHomeRow(row, await liveFor(row))))
64696
+ );
64361
64697
  },
64362
64698
  async getRobot(robotSn) {
64363
64699
  const row = await rowFor(robotSn);
@@ -64373,7 +64709,7 @@ function createOunitechAdapter(credentials, options) {
64373
64709
  position: null
64374
64710
  };
64375
64711
  }
64376
- return ounitechRobotFromHomeRow(row, await liveFor(row));
64712
+ return placed(row, ounitechRobotFromHomeRow(row, await liveFor(row)));
64377
64713
  },
64378
64714
  async sendCommand(robotSn, command) {
64379
64715
  const options2 = {
@@ -64401,31 +64737,16 @@ function createOunitechAdapter(credentials, options) {
64401
64737
  );
64402
64738
  }
64403
64739
  },
64404
- /** Chapter 6 floor maps, in the chapter-2 shape the screens read (walls left out - they are large). */
64740
+ /**
64741
+ * Chapter 6 floor maps (walls left out - they are large): the chapter-2
64742
+ * fields plus `mapId`, `imageUrl`, `width` / `height` (from the PNG) and
64743
+ * the areas' centres, so robot detail draws the real map with the robot on it.
64744
+ */
64405
64745
  async getMaps(robotSn) {
64406
64746
  const row = await rowFor(robotSn);
64407
64747
  if (!row || !finite(row.sceneId))
64408
64748
  return [];
64409
- return (await cloud.getFloorMaps(row.sceneId)).filter((m) => m.latestFlag !== false).map((m) => ({
64410
- floorNo: m.floorNo,
64411
- mapName: m.mapName,
64412
- backgroundFileKey: m.backgroundFileKey,
64413
- partitionFileKey: m.partitionFileKey,
64414
- originX: m.originX,
64415
- originY: m.originY,
64416
- resolution: m.resolution,
64417
- totalArea: m.totalArea,
64418
- baseX: m.baseX,
64419
- baseY: m.baseY,
64420
- baseTheta: m.baseTheta,
64421
- createTime: m.createTime,
64422
- areaList: (Array.isArray(m.areaList) ? m.areaList : []).map((a) => ({
64423
- areaName: a.areaName,
64424
- rgba: a.rgba,
64425
- x: a.x,
64426
- y: a.y
64427
- }))
64428
- }));
64749
+ return floorMaps(row.sceneId);
64429
64750
  },
64430
64751
  async getMapImages(_robotSn, fileKeys) {
64431
64752
  return cloud.previewFiles(fileKeys);
@@ -64444,6 +64765,53 @@ function createOunitechAdapter(credentials, options) {
64444
64765
  jobList: p.cleanList ?? p.jobList ?? []
64445
64766
  }));
64446
64767
  },
64768
+ /**
64769
+ * Robot detail's records (read-only, cached 2 min - the vendor rate-limits):
64770
+ * cleaning jobs (14 days), alert history (30 days), consumable hours, power
64771
+ * schedule, lifts, every live reading and the base station. Reads run one
64772
+ * after another (gentler on the rate limit); each part carries its own error.
64773
+ */
64774
+ async getRecords(robotSn) {
64775
+ return cached2(recordsCache, "value", `${options?.baseUrl ?? ""}|${credentials.appid}|${robotSn}`, RECORDS_TTL_MS, async () => {
64776
+ const row = await rowFor(robotSn);
64777
+ if (!row || !finite(row.robotId))
64778
+ return { supported: true, error: `Serial ${robotSn} is not on this Ounitech account.` };
64779
+ const robotId = row.robotId;
64780
+ const tz = finite(row.timezone) ? row.timezone : 480;
64781
+ const now = /* @__PURE__ */ new Date();
64782
+ const since = (days) => robotTime(new Date(now.getTime() - days * 864e5));
64783
+ const part = async (read2) => {
64784
+ try {
64785
+ return { items: await read2() };
64786
+ } catch (e) {
64787
+ return { items: [], error: String(e?.message ?? e).slice(0, 300) };
64788
+ }
64789
+ };
64790
+ const maps = finite(row.sceneId) ? await floorMaps(row.sceneId).catch(() => []) : [];
64791
+ const tasks = await part(
64792
+ async () => ((await cloud.getTaskList(robotId, since(14), robotTime(now))).taskList ?? []).map((t) => ounitechTaskRecord(t, maps, tz)).sort((a, b) => String(b.start ?? "").localeCompare(String(a.start ?? ""))).slice(0, 50)
64793
+ );
64794
+ const alerts = await part(
64795
+ async () => ((await cloud.getAlerts(robotId, since(30), robotTime(now))).alertList ?? []).map((a) => ounitechAlertRecord(a, tz))
64796
+ );
64797
+ const consumables = await part(async () => ((await cloud.getWorkHours(robotId)).unitlist ?? []).map(ounitechConsumable));
64798
+ const power = await part(async () => ((await cloud.getHaltPlans(robotId)).planList ?? []).map(ounitechPowerPlan));
64799
+ const lifts = finite(row.sceneId) ? await part(
64800
+ async () => ((await cloud.getLiftList(row.sceneId)).liftlist ?? []).map((l) => ({
64801
+ name: String(l.liftname ?? "").trim() || `Lift ${l.liftno ?? ""}`.trim(),
64802
+ floorNo: Number.isInteger(l.floorno) ? l.floorno : null,
64803
+ online: Number(l.onlineflag) === 1,
64804
+ enabled: l.enableflag !== false
64805
+ }))
64806
+ ) : { items: [] };
64807
+ const readings = await part(async () => ounitechReadings((await cloud.getRobotState(robotId)).properties));
64808
+ const station = await part(async () => {
64809
+ const st = await cloud.getStationState(robotId);
64810
+ return st ? [{ status: String(st.statusName ?? "").trim() || null, readings: ounitechReadings(st.properties, true) }] : [];
64811
+ });
64812
+ return { supported: true, readAt: now.toISOString(), tasks, alerts, consumables, power, lifts, readings, station };
64813
+ });
64814
+ },
64447
64815
  /**
64448
64816
  * Staff Diagnose: every other read-only chapter-6 call, with the vendor's
64449
64817
  * answer (lists cut to 3). Never a command, never the signed envelope.
@@ -64517,6 +64885,9 @@ function createOunitechAdapter(credentials, options) {
64517
64885
  const r = await cloud.getAlerts(robotId, window.timeFrom, window.timeTo);
64518
64886
  return { total: r.total ?? r.alertList?.length ?? 0, latest: cut(r.alertList ?? []) };
64519
64887
  });
64888
+ await run("consumable hours (get-work-hours)", ROBOT_CLOUD_PATHS.workHours, { robotId }, async () => cut((await cloud.getWorkHours(robotId)).unitlist ?? []));
64889
+ await run("power schedule (halt-plan/get)", ROBOT_CLOUD_PATHS.haltPlans, { robotId }, async () => cut((await cloud.getHaltPlans(robotId)).planList ?? []));
64890
+ await run("base station (get-station-detail-state)", ROBOT_CLOUD_PATHS.stationState, { robotId, options: "state" }, async () => cloud.getStationState(robotId));
64520
64891
  if (finite(row.sceneId)) {
64521
64892
  const sceneId = row.sceneId;
64522
64893
  await run("lifts (get-lift-list)", ROBOT_CLOUD_PATHS.liftList, { sceneid: sceneId }, async () => {
@@ -64550,7 +64921,7 @@ var OUNITECH_BRAND_DEFINITION = {
64550
64921
  { name: "Q3-G", codes: ["Q3G", "Q3-G"] },
64551
64922
  { name: "Q3-W", codes: ["Q3W", "Q3-W"] }
64552
64923
  ],
64553
- info: { makerApp: "the Ounitech app", makerAppOnly: ["pausing or stopping a job", "cleaning across floors"] },
64924
+ info: { makerApp: "the Ounitech app", makerAppOnly: ["pausing or stopping a job", "cleaning across floors", "changing maps, areas and schedules"] },
64554
64925
  create: (credentials) => createOunitechAdapter(credentials)
64555
64926
  };
64556
64927
  function registerOunitechBrand() {
@@ -65349,7 +65720,7 @@ function createOpenRmfClient(config2, deps) {
65349
65720
  throw new OpenRmfError("The fleet server sent a reply that is not JSON.");
65350
65721
  }
65351
65722
  }
65352
- function cached3(key, ttlMs, load) {
65723
+ function cached4(key, ttlMs, load) {
65353
65724
  const k = `${config2?.baseUrl}|${key}`;
65354
65725
  const hit = cache.get(k);
65355
65726
  if (hit && now() - hit.at < ttlMs)
@@ -65361,8 +65732,8 @@ function createOpenRmfClient(config2, deps) {
65361
65732
  }
65362
65733
  const enc2 = encodeURIComponent;
65363
65734
  return {
65364
- fleets: () => cached3("fleets", 1500, () => call("GET", "/fleets")),
65365
- buildingMap: () => cached3("building_map", 6e4, () => call("GET", "/building_map")),
65735
+ fleets: () => cached4("fleets", 1500, () => call("GET", "/fleets")),
65736
+ buildingMap: () => cached4("building_map", 6e4, () => call("GET", "/building_map")),
65366
65737
  doors: () => call("GET", "/doors"),
65367
65738
  doorState: (name) => call("GET", `/doors/${enc2(name)}/state`),
65368
65739
  doorRequest: (name, mode) => call("POST", `/doors/${enc2(name)}/request`, { mode }),
@@ -66806,7 +67177,7 @@ function mapSummary(m) {
66806
67177
  }
66807
67178
  var CACHE_TTL_MS = 5 * 6e4;
66808
67179
  var cache2 = /* @__PURE__ */ new Map();
66809
- function cached2(key, load) {
67180
+ function cached3(key, load) {
66810
67181
  const hit = cache2.get(key);
66811
67182
  if (hit && Date.now() - hit.at < CACHE_TTL_MS)
66812
67183
  return hit.value;
@@ -66892,8 +67263,8 @@ function createPadbotAdapter(credentials, options = {}) {
66892
67263
  const ns = `${credentials.appid}@${options.baseUrl ?? padbotBaseUrl()}`;
66893
67264
  const account = padbotAccountKey(credentials);
66894
67265
  const callRaw = call;
66895
- const roster = () => cached2(`${ns}:robots`, () => call(PADBOT_PATHS.robots, { robotTypes: ["PATROL"] }));
66896
- const maps = (sn) => cached2(`${ns}:maps:${sn}`, () => call(PADBOT_PATHS.maps, { serialNumber: sn }).then(asList));
67266
+ const roster = () => cached3(`${ns}:robots`, () => call(PADBOT_PATHS.robots, { robotTypes: ["PATROL"] }));
67267
+ const maps = (sn) => cached3(`${ns}:maps:${sn}`, () => call(PADBOT_PATHS.maps, { serialNumber: sn }).then(asList));
66897
67268
  const states = async (sn) => {
66898
67269
  const list = await call(PADBOT_PATHS.states, { serialNumbers: [sn] });
66899
67270
  const entry = (list ?? []).find((e) => e?.serialNumber === sn);
@@ -67461,6 +67832,12 @@ function useRobotFleetService(deps) {
67461
67832
  return [];
67462
67833
  return adapter.getMapImages(await resolveRobotSn(robot), fileKeys);
67463
67834
  }
67835
+ async function getRecords(robot) {
67836
+ const adapter = adapterFor(robot);
67837
+ if (!adapter.getRecords)
67838
+ return null;
67839
+ return adapter.getRecords(await resolveRobotSn(robot));
67840
+ }
67464
67841
  async function getPlans(robot) {
67465
67842
  const adapter = adapterFor(robot);
67466
67843
  if (!adapter.getPlans)
@@ -67830,6 +68207,7 @@ function useRobotFleetService(deps) {
67830
68207
  getMaps,
67831
68208
  getMapImages,
67832
68209
  getPlans,
68210
+ getRecords,
67833
68211
  getPatrolRoutes,
67834
68212
  dispatch: dispatch2
67835
68213
  };
@@ -70423,9 +70801,9 @@ function rmfSummary(rmf) {
70423
70801
  }
70424
70802
 
70425
70803
  // src/services/robot-tracking.service.ts
70426
- import axios4 from "axios";
70804
+ import axios5 from "axios";
70427
70805
  async function openWithAxios(url2, body) {
70428
- const response = await axios4.post(url2, body, {
70806
+ const response = await axios5.post(url2, body, {
70429
70807
  responseType: "stream",
70430
70808
  // No read timeout: this connection is SUPPOSED to stay open and mostly
70431
70809
  // silent. A request timeout here would sever a healthy stream on a quiet
@@ -70638,6 +71016,14 @@ function useRobotFleetController(deps) {
70638
71016
  fail(next, error);
70639
71017
  }
70640
71018
  }
71019
+ async function getRecords(req, res, next) {
71020
+ try {
71021
+ const robot = await entitleRobot(req, req.params.id);
71022
+ res.json(await getFleet2().getRecords(robot) ?? { supported: false });
71023
+ } catch (error) {
71024
+ fail(next, error);
71025
+ }
71026
+ }
70641
71027
  async function getPatrolRoutes(req, res, next) {
70642
71028
  try {
70643
71029
  const robot = await entitleRobot(req, req.params.id);
@@ -70931,6 +71317,7 @@ function useRobotFleetController(deps) {
70931
71317
  getMaps,
70932
71318
  getMapImages,
70933
71319
  getPlans,
71320
+ getRecords,
70934
71321
  getPatrolRoutes,
70935
71322
  sendCommand: sendCommand2,
70936
71323
  trackRobot,
@@ -79699,13 +80086,13 @@ function useSiteBillingItemRepo() {
79699
80086
  }
79700
80087
  const cacheKey = makeCacheKey44(namespace_collection3, { _id: String(_id) });
79701
80088
  try {
79702
- const cached3 = await getCache(cacheKey);
79703
- if (cached3) {
80089
+ const cached4 = await getCache(cacheKey);
80090
+ if (cached4) {
79704
80091
  logger142.log({
79705
80092
  level: "info",
79706
80093
  message: `Cache hit for getById site billing items: ${cacheKey}`
79707
80094
  });
79708
- return cached3;
80095
+ return cached4;
79709
80096
  }
79710
80097
  const result = await collection.findOne({
79711
80098
  _id
@@ -80073,13 +80460,13 @@ function useSiteBillingConfigurationRepo() {
80073
80460
  }
80074
80461
  const cacheKey = makeCacheKey45(namespace_collection3, { _id: String(_id) });
80075
80462
  try {
80076
- const cached3 = await getCache(cacheKey);
80077
- if (cached3) {
80463
+ const cached4 = await getCache(cacheKey);
80464
+ if (cached4) {
80078
80465
  logger144.log({
80079
80466
  level: "info",
80080
80467
  message: `Cache hit for getById site billing configuration: ${cacheKey}`
80081
80468
  });
80082
- return cached3;
80469
+ return cached4;
80083
80470
  }
80084
80471
  const result = await collection.findOne({
80085
80472
  _id
@@ -81750,13 +82137,13 @@ function useSiteUnitBillingRepo() {
81750
82137
  }
81751
82138
  const cacheKey = makeCacheKey47(namespace_collection3, { _id: String(_id) });
81752
82139
  try {
81753
- const cached3 = await getCache(cacheKey);
81754
- if (cached3) {
82140
+ const cached4 = await getCache(cacheKey);
82141
+ if (cached4) {
81755
82142
  logger152.log({
81756
82143
  level: "info",
81757
82144
  message: `Cache hit for getById site unit billing: ${cacheKey}`
81758
82145
  });
81759
- return cached3;
82146
+ return cached4;
81760
82147
  }
81761
82148
  const result = await collection.findOne({
81762
82149
  _id
@@ -84581,13 +84968,13 @@ function useNfcPatrolRouteRepo() {
84581
84968
  }
84582
84969
  const cacheKey = makeCacheKey49(namespace_collection3, cacheParams);
84583
84970
  try {
84584
- const cached3 = await getCache(cacheKey);
84585
- if (cached3) {
84971
+ const cached4 = await getCache(cacheKey);
84972
+ if (cached4) {
84586
84973
  logger157.log({
84587
84974
  level: "info",
84588
84975
  message: `Cache hit for getById ${namespace_collection3}: ${cacheKey}`
84589
84976
  });
84590
- return cached3;
84977
+ return cached4;
84591
84978
  }
84592
84979
  let result;
84593
84980
  if (isStart === true) {
@@ -86057,13 +86444,13 @@ function useStatementOfAccountRepo() {
86057
86444
  }
86058
86445
  const cacheKey = makeCacheKey51(namespace_collection3, { _id: String(_id) });
86059
86446
  try {
86060
- const cached3 = await getCache(cacheKey);
86061
- if (cached3) {
86447
+ const cached4 = await getCache(cacheKey);
86448
+ if (cached4) {
86062
86449
  logger163.log({
86063
86450
  level: "info",
86064
86451
  message: `Cache hit for getById soa: ${cacheKey}`
86065
86452
  });
86066
- return cached3;
86453
+ return cached4;
86067
86454
  }
86068
86455
  const result = await collection.findOne({
86069
86456
  _id
@@ -93237,7 +93624,7 @@ import {
93237
93624
  } from "@7365admin1/node-server-utils";
93238
93625
 
93239
93626
  // src/utils/hrmlabs-attendance.util.ts
93240
- import axios5 from "axios";
93627
+ import axios6 from "axios";
93241
93628
  import moment8 from "moment-timezone";
93242
93629
  var default_early_checkIn = 4;
93243
93630
  async function hrmLabsAuthentication({
@@ -93246,7 +93633,7 @@ async function hrmLabsAuthentication({
93246
93633
  password,
93247
93634
  domain
93248
93635
  }) {
93249
- const res = await axios5.post(
93636
+ const res = await axios6.post(
93250
93637
  authUrl,
93251
93638
  {
93252
93639
  grant_type: "password",
@@ -93276,7 +93663,7 @@ async function fetchAttendanceData({
93276
93663
  search
93277
93664
  }) {
93278
93665
  try {
93279
- const res = await axios5.post(
93666
+ const res = await axios6.post(
93280
93667
  attendanceUrl,
93281
93668
  {
93282
93669
  start: startDate,
@@ -93476,7 +93863,7 @@ async function fetchSites({ siteUrl, token }) {
93476
93863
  do {
93477
93864
  try {
93478
93865
  attempt++;
93479
- const res = await axios5.get(siteUrl, {
93866
+ const res = await axios6.get(siteUrl, {
93480
93867
  headers: { Authorization: `Bearer ${token}` },
93481
93868
  timeout: 15e3
93482
93869
  });
@@ -97077,7 +97464,7 @@ async function manpowerEvents(io) {
97077
97464
  }
97078
97465
 
97079
97466
  // src/services/reddot-payment.service.ts
97080
- import axios6 from "axios";
97467
+ import axios7 from "axios";
97081
97468
 
97082
97469
  // src/utils/payment-signature.util.ts
97083
97470
  import * as crypto11 from "crypto";
@@ -97719,7 +98106,7 @@ var useRedDotPaymentSvc = () => {
97719
98106
  );
97720
98107
  }
97721
98108
  const url2 = process.env.MERCHANT_PAYMENT;
97722
- const response = await axios6.post(url2, dataString, { headers });
98109
+ const response = await axios7.post(url2, dataString, { headers });
97723
98110
  const result = response.data;
97724
98111
  return result;
97725
98112
  } catch (error) {
@@ -97753,7 +98140,7 @@ var useRedDotPaymentSvc = () => {
97753
98140
  );
97754
98141
  }
97755
98142
  const url2 = process.env.MERCHANT_ENQUIRY;
97756
- const response = await axios6.post(url2, dataString, { headers });
98143
+ const response = await axios7.post(url2, dataString, { headers });
97757
98144
  const result = response.data;
97758
98145
  const transactionId = result.transaction_id;
97759
98146
  const amount = result.request_amount || 0;
@@ -107032,6 +107419,7 @@ export {
107032
107419
  claimReadsAsStale,
107033
107420
  clampChassis,
107034
107421
  clampPtzSpeed,
107422
+ clearOunitechCaches,
107035
107423
  clearPadbotCache,
107036
107424
  clearRobotBrands,
107037
107425
  clockDriftSeconds,
@@ -107225,10 +107613,19 @@ export {
107225
107613
  orgQualifiesForOwnerRepair,
107226
107614
  orgRoleSets,
107227
107615
  orgSchema,
107616
+ ounitechAlertRecord,
107228
107617
  ounitechCleaning,
107618
+ ounitechConsumable,
107619
+ ounitechCurrentMap,
107229
107620
  ounitechFault,
107230
107621
  ounitechJobWords,
107622
+ ounitechMapShare,
107623
+ ounitechMapView,
107624
+ ounitechPowerPlan,
107625
+ ounitechReadings,
107231
107626
  ounitechRobotFromHomeRow,
107627
+ ounitechTaskRecord,
107628
+ ounitechTime,
107232
107629
  overnight_parking_requests_namespace_collection,
107233
107630
  padbotAccountKey,
107234
107631
  padbotAlarmFault,
@@ -107281,6 +107678,7 @@ export {
107281
107678
  platform_terms_namespace_collection,
107282
107679
  playbackRelays,
107283
107680
  playbackWindowRefusal,
107681
+ pngSize,
107284
107682
  promoCodeRefusal,
107285
107683
  promoCodeSchema,
107286
107684
  promoCodeStatusSchema,