@7365admin1/core 3.94.0 → 3.95.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
@@ -10167,11 +10167,11 @@ function moduleGateData() {
10167
10167
  };
10168
10168
  }
10169
10169
  function memoisedGateData(data) {
10170
- const cache = /* @__PURE__ */ new Map();
10170
+ const cache2 = /* @__PURE__ */ new Map();
10171
10171
  const once = (key, load) => {
10172
- if (!cache.has(key))
10173
- cache.set(key, load());
10174
- return cache.get(key);
10172
+ if (!cache2.has(key))
10173
+ cache2.set(key, load());
10174
+ return cache2.get(key);
10175
10175
  };
10176
10176
  return {
10177
10177
  ...data,
@@ -60432,7 +60432,7 @@ var OUNITECH_PENDING_COMMANDS = ["pause", "resume", "cancel"].map(
60432
60432
  );
60433
60433
  function createOunitechAdapter(credentials, options) {
60434
60434
  const cloud = useRobotCloudService(credentials, options);
60435
- function toAdapterRobot(raw) {
60435
+ function toAdapterRobot2(raw) {
60436
60436
  return {
60437
60437
  robotSn: raw.robotSn,
60438
60438
  name: raw.robotName,
@@ -60454,7 +60454,7 @@ function createOunitechAdapter(credentials, options) {
60454
60454
  capabilities: OUNITECH_CAPABILITIES,
60455
60455
  async listRobots() {
60456
60456
  const fleet2 = await cloud.getRobots();
60457
- return fleet2.map(toAdapterRobot);
60457
+ return fleet2.map(toAdapterRobot2);
60458
60458
  },
60459
60459
  async getRobot(robotSn) {
60460
60460
  const fleet2 = await cloud.getRobots();
@@ -60471,7 +60471,7 @@ function createOunitechAdapter(credentials, options) {
60471
60471
  position: null
60472
60472
  };
60473
60473
  }
60474
- return toAdapterRobot(match);
60474
+ return toAdapterRobot2(match);
60475
60475
  },
60476
60476
  async sendCommand(robotSn, command) {
60477
60477
  const options2 = {
@@ -61009,6 +61009,708 @@ function registerDemoBrand() {
61009
61009
  }
61010
61010
  registerDemoBrand();
61011
61011
 
61012
+ // src/utils/lift-contract.util.ts
61013
+ var LIFT_DOOR = {
61014
+ CLOSED: 0,
61015
+ MOVING: 1,
61016
+ OPEN: 2
61017
+ };
61018
+ var LIFT_MOTION = {
61019
+ STOPPED: 0,
61020
+ UP: 1,
61021
+ DOWN: 2,
61022
+ UNKNOWN: 3
61023
+ };
61024
+ var LIFT_MODE = {
61025
+ UNKNOWN: 0,
61026
+ HUMAN: 1,
61027
+ AGV: 2,
61028
+ FIRE: 3,
61029
+ OFFLINE: 4,
61030
+ EMERGENCY: 5
61031
+ };
61032
+ var LIFT_REQUEST = {
61033
+ END_SESSION: 0,
61034
+ AGV_MODE: 1,
61035
+ HUMAN_MODE: 2
61036
+ };
61037
+ function isLiftAvailable(state) {
61038
+ if (!state)
61039
+ return false;
61040
+ return state.currentMode === LIFT_MODE.HUMAN || state.currentMode === LIFT_MODE.AGV;
61041
+ }
61042
+ function isSafeToCross(state, floor) {
61043
+ if (!isLiftAvailable(state) || !state)
61044
+ return false;
61045
+ if (state.currentFloor !== floor)
61046
+ return false;
61047
+ if (state.motionState !== LIFT_MOTION.STOPPED)
61048
+ return false;
61049
+ return state.doorState === LIFT_DOOR.OPEN;
61050
+ }
61051
+ function holdsLift(state, sessionId) {
61052
+ if (!state || !sessionId)
61053
+ return false;
61054
+ return state.sessionId === sessionId;
61055
+ }
61056
+ function servesFloor(state, floor) {
61057
+ if (!state || !floor)
61058
+ return false;
61059
+ return state.availableFloors.includes(floor);
61060
+ }
61061
+ function createLiftSimulator(options) {
61062
+ const { name, floors } = options;
61063
+ if (floors.length === 0)
61064
+ throw new Error("A lift must serve some floors.");
61065
+ const msPerFloor = options.msPerFloor ?? 2e3;
61066
+ const doorDwellMs = options.doorDwellMs ?? 5e3;
61067
+ const state = {
61068
+ liftName: name,
61069
+ liftTime: 0,
61070
+ availableFloors: [...floors],
61071
+ currentFloor: options.startFloor ?? floors[0],
61072
+ destinationFloor: options.startFloor ?? floors[0],
61073
+ doorState: LIFT_DOOR.CLOSED,
61074
+ motionState: LIFT_MOTION.STOPPED,
61075
+ currentMode: LIFT_MODE.HUMAN,
61076
+ sessionId: ""
61077
+ };
61078
+ let travelRemaining = 0;
61079
+ let doorTimer = 0;
61080
+ function tick(ms) {
61081
+ state.liftTime += ms;
61082
+ if (state.motionState !== LIFT_MOTION.STOPPED) {
61083
+ travelRemaining -= ms;
61084
+ if (travelRemaining <= 0) {
61085
+ state.currentFloor = state.destinationFloor;
61086
+ state.motionState = LIFT_MOTION.STOPPED;
61087
+ state.doorState = LIFT_DOOR.OPEN;
61088
+ doorTimer = doorDwellMs;
61089
+ }
61090
+ return;
61091
+ }
61092
+ if (state.doorState === LIFT_DOOR.OPEN) {
61093
+ doorTimer -= ms;
61094
+ if (doorTimer <= 0)
61095
+ state.doorState = LIFT_DOOR.CLOSED;
61096
+ }
61097
+ }
61098
+ return {
61099
+ name,
61100
+ state,
61101
+ tick,
61102
+ async read() {
61103
+ return { ...state, availableFloors: [...state.availableFloors] };
61104
+ },
61105
+ async request(request2) {
61106
+ if (request2.requestType === LIFT_REQUEST.END_SESSION) {
61107
+ if (state.sessionId === request2.sessionId) {
61108
+ state.sessionId = "";
61109
+ state.currentMode = LIFT_MODE.HUMAN;
61110
+ }
61111
+ return;
61112
+ }
61113
+ if (state.sessionId && state.sessionId !== request2.sessionId) {
61114
+ throw new Error(`Lift ${name} is held by ${state.sessionId}.`);
61115
+ }
61116
+ if (!state.availableFloors.includes(request2.destinationFloor)) {
61117
+ throw new Error(
61118
+ `Lift ${name} does not serve ${request2.destinationFloor}.`
61119
+ );
61120
+ }
61121
+ state.sessionId = request2.sessionId;
61122
+ state.currentMode = request2.requestType === LIFT_REQUEST.AGV_MODE ? LIFT_MODE.AGV : LIFT_MODE.HUMAN;
61123
+ state.destinationFloor = request2.destinationFloor;
61124
+ if (state.currentFloor === request2.destinationFloor) {
61125
+ state.motionState = LIFT_MOTION.STOPPED;
61126
+ state.doorState = LIFT_DOOR.OPEN;
61127
+ doorTimer = doorDwellMs;
61128
+ return;
61129
+ }
61130
+ const from = state.availableFloors.indexOf(state.currentFloor);
61131
+ const to = state.availableFloors.indexOf(request2.destinationFloor);
61132
+ state.motionState = to > from ? LIFT_MOTION.UP : LIFT_MOTION.DOWN;
61133
+ state.doorState = LIFT_DOOR.CLOSED;
61134
+ travelRemaining = Math.abs(to - from) * msPerFloor;
61135
+ },
61136
+ async refresh(sessionId) {
61137
+ if (state.sessionId !== sessionId)
61138
+ return;
61139
+ if (state.doorState === LIFT_DOOR.OPEN)
61140
+ doorTimer = doorDwellMs;
61141
+ },
61142
+ async release(sessionId) {
61143
+ if (state.sessionId !== sessionId)
61144
+ return;
61145
+ state.sessionId = "";
61146
+ state.currentMode = LIFT_MODE.HUMAN;
61147
+ }
61148
+ };
61149
+ }
61150
+ var LIFT_QUEUE_TTL_MS = 10 * 6e4;
61151
+ var LIFT_LEASE_MS = 3 * 6e4;
61152
+ var LIFT_SIM_MS_PER_FLOOR = 4e3;
61153
+ var LIFT_SIM_DOOR_DWELL_MS = 8e3;
61154
+ var LIFT_SIM_BOARD_MS = 6e3;
61155
+ var LIFT_SESSION_STATUS = [
61156
+ "queued",
61157
+ "active",
61158
+ "released",
61159
+ "expired",
61160
+ "cancelled"
61161
+ ];
61162
+ async function simulatedLiftState(options) {
61163
+ const sim = createLiftSimulator({
61164
+ name: options.name,
61165
+ floors: options.floors,
61166
+ msPerFloor: LIFT_SIM_MS_PER_FLOOR,
61167
+ doorDwellMs: LIFT_SIM_DOOR_DWELL_MS
61168
+ });
61169
+ const session = options.session;
61170
+ if (!session || !options.floors.includes(session.fromFloor) || !options.floors.includes(session.toFloor)) {
61171
+ return { state: await sim.read(), phase: "idle" };
61172
+ }
61173
+ const STEP = 250;
61174
+ const elapsed = Math.max(0, options.now - session.activeAt);
61175
+ let phase = "to-pickup";
61176
+ let boardingLeft = LIFT_SIM_BOARD_MS;
61177
+ await sim.request({
61178
+ liftName: options.name,
61179
+ sessionId: session.id,
61180
+ requestType: LIFT_REQUEST.AGV_MODE,
61181
+ destinationFloor: session.fromFloor,
61182
+ doorState: LIFT_DOOR.OPEN
61183
+ });
61184
+ if (isSafeToCross(sim.state, session.fromFloor))
61185
+ phase = "boarding";
61186
+ for (let t = 0; t < elapsed; t += STEP) {
61187
+ const ms = Math.min(STEP, elapsed - t);
61188
+ sim.tick(ms);
61189
+ const s = sim.state;
61190
+ if (phase === "to-pickup") {
61191
+ if (isSafeToCross(s, session.fromFloor))
61192
+ phase = "boarding";
61193
+ } else if (phase === "boarding") {
61194
+ await sim.refresh(session.id);
61195
+ boardingLeft -= ms;
61196
+ if (boardingLeft <= 0) {
61197
+ phase = "to-destination";
61198
+ await sim.request({
61199
+ liftName: options.name,
61200
+ sessionId: session.id,
61201
+ requestType: LIFT_REQUEST.AGV_MODE,
61202
+ destinationFloor: session.toFloor,
61203
+ doorState: LIFT_DOOR.CLOSED
61204
+ });
61205
+ }
61206
+ } else if (phase === "to-destination") {
61207
+ if (isSafeToCross(s, session.toFloor))
61208
+ phase = "arrived";
61209
+ } else if (phase === "arrived") {
61210
+ await sim.refresh(session.id);
61211
+ }
61212
+ }
61213
+ return { state: await sim.read(), phase };
61214
+ }
61215
+ function liftQueueKey(mapId, liftName) {
61216
+ return `${mapId}:${liftName}`;
61217
+ }
61218
+
61219
+ // src/utils/door-contract.util.ts
61220
+ var DOOR_MODE = {
61221
+ CLOSED: 0,
61222
+ MOVING: 1,
61223
+ OPEN: 2,
61224
+ OFFLINE: 3,
61225
+ UNKNOWN: 4
61226
+ };
61227
+ var MODES = new Set(Object.values(DOOR_MODE));
61228
+ function doorModeOf(value) {
61229
+ return typeof value === "number" && MODES.has(value) ? value : DOOR_MODE.UNKNOWN;
61230
+ }
61231
+ function isDoorPassable(state) {
61232
+ return state?.currentMode === DOOR_MODE.OPEN;
61233
+ }
61234
+
61235
+ // src/services/open-rmf.adapter.ts
61236
+ var OPEN_RMF_BRAND = "fleet-core";
61237
+ var OPEN_RMF_DISPLAY_NAME = "HERO Fleet Core";
61238
+ var OPEN_RMF_CAPABILITIES = {
61239
+ readLocation: true,
61240
+ // robot_state.location {map, x, y, yaw}
61241
+ battery: true,
61242
+ // robot_state.battery 0..1
61243
+ floorReporting: true,
61244
+ // location.map = level name
61245
+ multiFloor: true,
61246
+ // RMF rides lifts itself (lift supervisor)
61247
+ startProcess: true,
61248
+ // clean / patrol tasks
61249
+ pauseProcess: true,
61250
+ // interrupt_task / resume_task / cancel_task
61251
+ pauseResume: true,
61252
+ // same calls
61253
+ processCompletion: true,
61254
+ // task_state.status
61255
+ pathAndEta: true,
61256
+ // task_state.estimate_millis
61257
+ sendToDock: true,
61258
+ // go_to_place the robot's charger waypoint
61259
+ navigateToPoint: false,
61260
+ // api takes waypoint names only
61261
+ relocalize: false,
61262
+ // no api call
61263
+ spotClean: false
61264
+ // clean zones are named waypoints, not points
61265
+ };
61266
+ function openRmfConfig(env2 = process.env) {
61267
+ const baseUrl = (env2.OPEN_RMF_API_URL ?? "").trim().replace(/\/+$/, "");
61268
+ if (!/^https?:\/\/\S+$/.test(baseUrl))
61269
+ return null;
61270
+ return { baseUrl, token: (env2.OPEN_RMF_TOKEN ?? "").trim() };
61271
+ }
61272
+ var OpenRmfError = class extends Error {
61273
+ };
61274
+ var TIMEOUT_MS = 4e3;
61275
+ var cache = /* @__PURE__ */ new Map();
61276
+ function createOpenRmfClient(config2, deps) {
61277
+ const doFetch = deps?.fetch ?? globalThis.fetch;
61278
+ const now = deps?.now ?? Date.now;
61279
+ async function call(method, path5, body) {
61280
+ if (!config2)
61281
+ throw new OpenRmfError("Fleet Core is not configured on this server.");
61282
+ let res;
61283
+ try {
61284
+ res = await doFetch(config2.baseUrl + path5, {
61285
+ method,
61286
+ headers: {
61287
+ ...config2.token ? { Authorization: `Bearer ${config2.token}` } : {},
61288
+ ...body === void 0 ? {} : { "Content-Type": "application/json" }
61289
+ },
61290
+ body: body === void 0 ? void 0 : JSON.stringify(body),
61291
+ signal: AbortSignal.timeout(deps?.timeoutMs ?? TIMEOUT_MS)
61292
+ });
61293
+ } catch (e) {
61294
+ throw new OpenRmfError(
61295
+ `The fleet server did not answer (${e?.name === "TimeoutError" ? "timed out" : "unreachable"}).`
61296
+ );
61297
+ }
61298
+ const text2 = await res.text();
61299
+ if (!res.ok)
61300
+ throw new OpenRmfError(`The fleet server refused ${method} ${path5.split("?")[0]} (HTTP ${res.status}).`);
61301
+ try {
61302
+ return text2 ? JSON.parse(text2) : null;
61303
+ } catch {
61304
+ throw new OpenRmfError("The fleet server sent a reply that is not JSON.");
61305
+ }
61306
+ }
61307
+ function cached(key, ttlMs, load) {
61308
+ const k = `${config2?.baseUrl}|${key}`;
61309
+ const hit = cache.get(k);
61310
+ if (hit && now() - hit.at < ttlMs)
61311
+ return hit.value;
61312
+ const value = load();
61313
+ cache.set(k, { at: now(), value });
61314
+ value.catch(() => cache.delete(k));
61315
+ return value;
61316
+ }
61317
+ const enc2 = encodeURIComponent;
61318
+ return {
61319
+ fleets: () => cached("fleets", 1500, () => call("GET", "/fleets")),
61320
+ buildingMap: () => cached("building_map", 6e4, () => call("GET", "/building_map")),
61321
+ doors: () => call("GET", "/doors"),
61322
+ doorState: (name) => call("GET", `/doors/${enc2(name)}/state`),
61323
+ doorRequest: (name, mode) => call("POST", `/doors/${enc2(name)}/request`, { mode }),
61324
+ liftState: (name) => call("GET", `/lifts/${enc2(name)}/state`),
61325
+ liftRequest: (name, body) => call("POST", `/lifts/${enc2(name)}/request`, body),
61326
+ robotTask: (fleet2, robot, request2) => call("POST", "/tasks/robot_task", {
61327
+ type: "robot_task_request",
61328
+ fleet: fleet2,
61329
+ robot,
61330
+ request: request2
61331
+ }),
61332
+ cancelTask: (taskId) => call("POST", "/tasks/cancel_task", { type: "cancel_task_request", task_id: taskId }),
61333
+ interruptTask: (taskId) => call("POST", "/tasks/interrupt_task", { type: "interrupt_task_request", task_id: taskId, labels: ["iservice365"] }),
61334
+ // RMF answers a resume only when it names the interruption tokens to discard.
61335
+ resumeTask: (taskId, tokens) => call("POST", "/tasks/resume_task", {
61336
+ type: "resume_task_request",
61337
+ for_task: taskId,
61338
+ for_tokens: tokens,
61339
+ labels: ["iservice365"]
61340
+ }),
61341
+ taskState: (taskId) => call("GET", `/tasks/${enc2(taskId)}/state`)
61342
+ };
61343
+ }
61344
+ function floorNoOf(map) {
61345
+ if (typeof map !== "string")
61346
+ return null;
61347
+ const m = /^(L|B)(\d{1,3})$/i.exec(map.trim());
61348
+ if (m)
61349
+ return m[1].toUpperCase() === "B" ? -Number(m[2]) : Number(m[2]);
61350
+ return /^G$/i.test(map.trim()) ? 0 : null;
61351
+ }
61352
+ function splitRobotSn(robotSn) {
61353
+ const i = robotSn.indexOf("/");
61354
+ if (i <= 0 || i === robotSn.length - 1)
61355
+ return null;
61356
+ return { fleet: robotSn.slice(0, i), robot: robotSn.slice(i + 1) };
61357
+ }
61358
+ var hasParam = (v, p) => (v.params ?? []).some((x) => x.name === p);
61359
+ function levelBounds(building, map) {
61360
+ const level2 = building?.levels.find((l) => l.name === map);
61361
+ if (!level2)
61362
+ return null;
61363
+ const xs = [];
61364
+ const ys = [];
61365
+ for (const g of level2.nav_graphs)
61366
+ for (const v of g.vertices)
61367
+ xs.push(v.x), ys.push(v.y);
61368
+ for (const d of level2.doors)
61369
+ xs.push(d.v1_x, d.v2_x), ys.push(d.v1_y, d.v2_y);
61370
+ if (!xs.length)
61371
+ return null;
61372
+ const pad = 3;
61373
+ return { minX: Math.min(...xs) - pad, maxX: Math.max(...xs) + pad, minY: Math.min(...ys) - pad, maxY: Math.max(...ys) + pad };
61374
+ }
61375
+ function planShareOf(building, loc) {
61376
+ if (!loc)
61377
+ return null;
61378
+ const b = levelBounds(building, loc.map);
61379
+ if (!b)
61380
+ return null;
61381
+ const pct = (v) => Math.round(Math.min(100, Math.max(0, v)) * 10) / 10;
61382
+ return { x: pct((loc.x - b.minX) / (b.maxX - b.minX) * 100), y: pct((b.maxY - loc.y) / (b.maxY - b.minY) * 100) };
61383
+ }
61384
+ var MODE_BY_STATUS2 = {
61385
+ idle: "IDLE",
61386
+ working: "WORKING",
61387
+ charging: "CHARGING_CYCLE",
61388
+ error: "MAINTENANCE"
61389
+ };
61390
+ function toAdapterRobot(fleet2, name, s, building, paused = false) {
61391
+ const status = s.status ?? "uninitialized";
61392
+ const online = !["offline", "shutdown", "uninitialized"].includes(status);
61393
+ let mode = online ? MODE_BY_STATUS2[status] ?? "UNAVAILABLE" : "UNAVAILABLE";
61394
+ if (mode === "CHARGING_CYCLE" && (s.battery ?? 0) >= 0.995)
61395
+ mode = "CHARGED";
61396
+ if (paused && mode === "WORKING")
61397
+ mode = "PAUSED";
61398
+ const issue = (s.issues ?? []).find((i) => i?.category);
61399
+ const loc = s.location ?? null;
61400
+ const floorNo2 = floorNoOf(loc?.map);
61401
+ return {
61402
+ robotSn: `${fleet2}/${name}`,
61403
+ name,
61404
+ model: fleet2,
61405
+ online,
61406
+ mode,
61407
+ statusName: s.task_id ? `${status} \xB7 task ${s.task_id.slice(0, 8)}` : status,
61408
+ batteryPercent: typeof s.battery === "number" ? Math.round(s.battery * 100) : null,
61409
+ floorNo: floorNo2,
61410
+ floorKnown: floorNo2 !== null,
61411
+ position: loc ? { x: loc.x, y: loc.y, theta: loc.yaw } : null,
61412
+ planPosition: planShareOf(building, loc),
61413
+ fault: issue ? {
61414
+ code: String(issue.category).slice(0, 60),
61415
+ message: (typeof issue.detail === "string" ? issue.detail : JSON.stringify(issue.detail ?? "")).slice(0, 200)
61416
+ } : null
61417
+ };
61418
+ }
61419
+ function robotGraphIndex(building, loc) {
61420
+ const level2 = loc && building?.levels.find((l) => l.name === loc.map);
61421
+ if (!level2)
61422
+ return null;
61423
+ let best = null;
61424
+ for (const g of level2.nav_graphs) {
61425
+ for (const v of g.vertices) {
61426
+ const d = (v.x - loc.x) ** 2 + (v.y - loc.y) ** 2;
61427
+ if (!best || d < best.d)
61428
+ best = { name: g.name, d };
61429
+ }
61430
+ }
61431
+ return best?.name ?? null;
61432
+ }
61433
+ function waypointsFor(building, loc) {
61434
+ const graph = robotGraphIndex(building, loc);
61435
+ const level2 = loc && building?.levels.find((l) => l.name === loc.map);
61436
+ const vertices = level2?.nav_graphs.find((g) => g.name === graph)?.vertices.filter((v) => v.name) ?? [];
61437
+ return {
61438
+ chargers: vertices.filter((v) => hasParam(v, "is_charger")),
61439
+ cleaningZones: vertices.filter((v) => hasParam(v, "is_cleaning_zone")),
61440
+ places: vertices.filter((v) => !hasParam(v, "is_charger") && !hasParam(v, "is_cleaning_zone"))
61441
+ };
61442
+ }
61443
+ function cleanActivities(zone) {
61444
+ return [
61445
+ { category: "go_to_place", description: zone },
61446
+ {
61447
+ category: "perform_action",
61448
+ description: {
61449
+ unix_millis_action_duration_estimate: 6e4,
61450
+ category: "clean",
61451
+ expected_finish_location: zone,
61452
+ description: { zone },
61453
+ use_tool_sink: true
61454
+ }
61455
+ }
61456
+ ];
61457
+ }
61458
+ var composed = (category, activities) => ({
61459
+ category: "compose",
61460
+ requester: "iservice365",
61461
+ description: {
61462
+ category,
61463
+ phases: [{ activity: { category: "sequence", description: { activities } } }]
61464
+ }
61465
+ });
61466
+ function taskRequestFor(command, robotType, wp) {
61467
+ const pick = (names, allowed, what) => {
61468
+ const known = new Set(allowed.map((v) => v.name));
61469
+ const bad = names.filter((n) => !known.has(n));
61470
+ if (!names.length || bad.length) {
61471
+ throw new OpenRmfError(
61472
+ `Unknown ${what}${bad.length ? `: ${bad.join(", ")}` : ""}. Known: ${[...known].join(", ") || "none"}.`
61473
+ );
61474
+ }
61475
+ return names;
61476
+ };
61477
+ switch (command.kind) {
61478
+ case "full":
61479
+ if (robotType === "security") {
61480
+ return { category: "patrol", requester: "iservice365", description: { places: pick(wp.places.map((v) => v.name), wp.places, "patrol places"), rounds: 1 } };
61481
+ }
61482
+ return composed("clean", pick(wp.cleaningZones.map((v) => v.name), wp.cleaningZones, "cleaning zones").flatMap(cleanActivities));
61483
+ case "area":
61484
+ if (robotType === "security") {
61485
+ return { category: "patrol", requester: "iservice365", description: { places: command.areas.slice(0, 20), rounds: 1 } };
61486
+ }
61487
+ return composed("clean", pick(command.areas.slice(0, 20), wp.cleaningZones, "cleaning zones").flatMap(cleanActivities));
61488
+ case "return": {
61489
+ const charger = wp.chargers[0]?.name;
61490
+ if (!charger)
61491
+ throw new OpenRmfError("This robot has no charger on its current floor.");
61492
+ return composed("go_to_place", [{ category: "go_to_place", description: charger }]);
61493
+ }
61494
+ default:
61495
+ throw new OpenRmfError(`These robots do not take "${command.kind}".`);
61496
+ }
61497
+ }
61498
+ var DOOR_TYPE_SLIDING = /* @__PURE__ */ new Set([1, 2, 3, 4]);
61499
+ function buildingFromRmf(building) {
61500
+ const levels = building.levels.slice(0, 200);
61501
+ const floorOf = (name, i) => floorNoOf(name) ?? i + 1;
61502
+ const byName = new Map(levels.map((l, i) => [l.name, floorOf(l.name, i)]));
61503
+ return {
61504
+ name: String(building.name ?? "Building").slice(0, 60),
61505
+ levels: levels.map((l, i) => ({ floorNo: floorOf(l.name, i), name: l.name, elevationM: l.elevation })),
61506
+ doors: levels.flatMap(
61507
+ (l, i) => l.doors.map((d) => ({
61508
+ name: d.name,
61509
+ floorNo: floorOf(l.name, i),
61510
+ type: DOOR_TYPE_SLIDING.has(d.door_type) ? "sliding" : "hinged",
61511
+ start: { x: d.v1_x, y: d.v1_y },
61512
+ end: { x: d.v2_x, y: d.v2_y }
61513
+ }))
61514
+ ),
61515
+ lifts: building.lifts.map((l) => ({
61516
+ name: l.name,
61517
+ x: l.ref_x,
61518
+ y: l.ref_y,
61519
+ widthM: l.width,
61520
+ depthM: l.depth,
61521
+ floors: l.levels.map((n) => byName.get(n)).filter((n) => typeof n === "number")
61522
+ }))
61523
+ };
61524
+ }
61525
+ function openRmfDoorDriver(client, doorName) {
61526
+ return {
61527
+ name: doorName,
61528
+ async read() {
61529
+ const s = await client.doorState(doorName).catch((e) => {
61530
+ if (/HTTP 404/.test(String(e?.message)))
61531
+ return null;
61532
+ throw e;
61533
+ });
61534
+ if (!s)
61535
+ return null;
61536
+ const t = s.door_time ?? {};
61537
+ return {
61538
+ doorName: s.door_name ?? doorName,
61539
+ doorTime: Number(t.sec ?? 0) * 1e3 + Math.round(Number(t.nanosec ?? 0) / 1e6),
61540
+ currentMode: doorModeOf(s.current_mode?.value)
61541
+ };
61542
+ },
61543
+ async request(request2) {
61544
+ if (request2.requestedMode !== DOOR_MODE.OPEN && request2.requestedMode !== DOOR_MODE.CLOSED) {
61545
+ throw new OpenRmfError("A door can only be asked to open or close.");
61546
+ }
61547
+ await client.doorRequest(doorName, request2.requestedMode);
61548
+ }
61549
+ };
61550
+ }
61551
+ function openRmfLiftDriver(client, liftName) {
61552
+ const destinations = /* @__PURE__ */ new Map();
61553
+ const send2 = (requestType, sessionId, destination, doorState) => client.liftRequest(liftName, {
61554
+ request_type: requestType,
61555
+ door_mode: doorState,
61556
+ destination,
61557
+ additional_session_ids: [sessionId]
61558
+ });
61559
+ return {
61560
+ name: liftName,
61561
+ async read() {
61562
+ const s = await client.liftState(liftName).catch((e) => {
61563
+ if (/HTTP 404/.test(String(e?.message)))
61564
+ return null;
61565
+ throw e;
61566
+ });
61567
+ if (!s)
61568
+ return null;
61569
+ const t = s.lift_time ?? {};
61570
+ return {
61571
+ liftName: s.lift_name ?? liftName,
61572
+ liftTime: Number(t.sec ?? 0) * 1e3 + Math.round(Number(t.nanosec ?? 0) / 1e6),
61573
+ availableFloors: Array.isArray(s.available_floors) ? s.available_floors.map(String) : [],
61574
+ currentFloor: String(s.current_floor ?? ""),
61575
+ destinationFloor: String(s.destination_floor ?? ""),
61576
+ doorState: [0, 1, 2].includes(s.door_state) ? s.door_state : 0,
61577
+ motionState: [0, 1, 2, 3].includes(s.motion_state) ? s.motion_state : 3,
61578
+ currentMode: [0, 1, 2, 3, 4, 5].includes(s.current_mode) ? s.current_mode : 0,
61579
+ sessionId: String(s.session_id ?? "")
61580
+ };
61581
+ },
61582
+ async request(r) {
61583
+ destinations.set(r.sessionId, r.destinationFloor);
61584
+ await send2(r.requestType, r.sessionId, r.destinationFloor, r.doorState);
61585
+ },
61586
+ async refresh(sessionId) {
61587
+ const destination = destinations.get(sessionId);
61588
+ if (destination)
61589
+ await send2(LIFT_REQUEST.AGV_MODE, sessionId, destination, 2);
61590
+ },
61591
+ async release(sessionId) {
61592
+ destinations.delete(sessionId);
61593
+ await send2(LIFT_REQUEST.END_SESSION, sessionId, "", 0);
61594
+ }
61595
+ };
61596
+ }
61597
+ function createOpenRmfAdapter(options) {
61598
+ const client = createOpenRmfClient(options && "config" in options ? options.config ?? null : openRmfConfig(), {
61599
+ fetch: options?.fetch,
61600
+ timeoutMs: options?.timeoutMs
61601
+ });
61602
+ async function states() {
61603
+ const [fleets, building] = await Promise.all([client.fleets(), client.buildingMap().catch(() => null)]);
61604
+ return { fleets: fleets ?? [], building };
61605
+ }
61606
+ async function openInterruptions(taskId) {
61607
+ if (!taskId)
61608
+ return [];
61609
+ const t = await client.taskState(taskId).catch(() => null);
61610
+ return Object.entries(t?.interruptions ?? {}).filter(([, v]) => !v?.resumed_by).map(([token]) => token);
61611
+ }
61612
+ async function find(robotSn) {
61613
+ const key = splitRobotSn(robotSn);
61614
+ if (!key)
61615
+ return null;
61616
+ const { fleets, building } = await states();
61617
+ const s = fleets.find((f) => f.name === key.fleet)?.robots?.[key.robot];
61618
+ return s ? { key, s, building } : null;
61619
+ }
61620
+ return {
61621
+ client,
61622
+ brand: OPEN_RMF_BRAND,
61623
+ displayName: OPEN_RMF_DISPLAY_NAME,
61624
+ capabilities: OPEN_RMF_CAPABILITIES,
61625
+ async listRobots() {
61626
+ const { fleets, building } = await states();
61627
+ return fleets.flatMap((f) => Object.entries(f.robots ?? {}).map(([n, s]) => toAdapterRobot(f.name, n, s, building)));
61628
+ },
61629
+ async getRobot(robotSn) {
61630
+ const hit = await find(robotSn);
61631
+ if (!hit)
61632
+ return null;
61633
+ return toAdapterRobot(hit.key.fleet, hit.key.robot, hit.s, hit.building, (await openInterruptions(hit.s.task_id)).length > 0);
61634
+ },
61635
+ async sendCommand(robotSn, command) {
61636
+ const hit = await find(robotSn);
61637
+ if (!hit)
61638
+ throw new OpenRmfError(`The fleet server does not list the robot "${robotSn}".`);
61639
+ const taskId = hit.s.task_id ?? "";
61640
+ if (command.kind === "pause" || command.kind === "resume" || command.kind === "cancel") {
61641
+ if (!taskId)
61642
+ throw new OpenRmfError("This robot has no task to " + command.kind + ".");
61643
+ let res2;
61644
+ if (command.kind === "resume") {
61645
+ const tokens = await openInterruptions(taskId);
61646
+ if (!tokens.length)
61647
+ throw new OpenRmfError("This robot's task is not paused.");
61648
+ res2 = await client.resumeTask(taskId, tokens);
61649
+ } else {
61650
+ res2 = command.kind === "pause" ? await client.interruptTask(taskId) : await client.cancelTask(taskId);
61651
+ }
61652
+ if (res2 && res2.success === false)
61653
+ throw new OpenRmfError(`The fleet server refused to ${command.kind} the task.`);
61654
+ return;
61655
+ }
61656
+ const wp = waypointsFor(hit.building, hit.s.location);
61657
+ const request2 = taskRequestFor(command, wp.cleaningZones.length ? "cleaning" : "security", wp);
61658
+ const res = await client.robotTask(hit.key.fleet, hit.key.robot, request2);
61659
+ if (!res?.success)
61660
+ throw new OpenRmfError("The fleet server did not accept the task.");
61661
+ },
61662
+ /**
61663
+ * The robot's current patrol, from its task state: each phase is
61664
+ * "Go to [place:<name>]", in order, and the active phase is the checkpoint
61665
+ * it is heading for. (A direct robot task keeps no request record on the
61666
+ * api-server, so the state is the only source.)
61667
+ */
61668
+ async getPatrolRoutes(robotSn) {
61669
+ const none = { routes: [], schedule: [] };
61670
+ const hit = await find(robotSn);
61671
+ const taskId = hit?.s.task_id;
61672
+ if (!hit || !taskId)
61673
+ return none;
61674
+ const t = await client.taskState(taskId).catch(() => null);
61675
+ if (!t || !/^patrol$/i.test(String(t.category ?? "")))
61676
+ return none;
61677
+ const level2 = hit.building?.levels.find((l) => l.name === hit.s.location?.map);
61678
+ const vertex = (name) => level2?.nav_graphs.flatMap((g) => g.vertices).find((v) => v.name === name);
61679
+ const phases = Object.entries(t.phases ?? {}).sort(([a], [b]) => Number(a) - Number(b)).map(([id, p]) => ({ id: Number(id), place: /\[place:([^\]]+)\]/.exec(String(p?.category ?? ""))?.[1] ?? "" })).filter((p) => p.place && vertex(p.place));
61680
+ const checkpoints = phases.map((p) => {
61681
+ const v = vertex(p.place);
61682
+ return { name: p.place, ...planShareOf(hit.building, { map: level2.name, x: v.x, y: v.y, yaw: 0 }) };
61683
+ });
61684
+ const current = phases.findIndex((p) => p.id === t.active);
61685
+ return {
61686
+ routes: [
61687
+ {
61688
+ id: taskId,
61689
+ name: `Patrol \xB7 ${checkpoints.map((c) => c.name).join(" \u2192 ")}`.slice(0, 80),
61690
+ floorNo: floorNoOf(level2?.name),
61691
+ checkpoints,
61692
+ currentCheckpoint: current >= 0 ? current : null
61693
+ }
61694
+ ],
61695
+ schedule: []
61696
+ };
61697
+ }
61698
+ };
61699
+ }
61700
+ function registerOpenRmfBrand(env2 = process.env) {
61701
+ if (!openRmfConfig(env2))
61702
+ return false;
61703
+ registerRobotBrand({
61704
+ brand: OPEN_RMF_BRAND,
61705
+ displayName: OPEN_RMF_DISPLAY_NAME,
61706
+ capabilities: OPEN_RMF_CAPABILITIES,
61707
+ types: ["cleaning", "security"],
61708
+ create: () => createOpenRmfAdapter()
61709
+ });
61710
+ return true;
61711
+ }
61712
+ registerOpenRmfBrand();
61713
+
61012
61714
  // src/services/robot-fleet.service.ts
61013
61715
  function useRobotFleetService(deps) {
61014
61716
  const adapterFor = deps?.adapterFor ?? ((robot) => adapterForRobot(robot));
@@ -61556,213 +62258,6 @@ function robotActionsFor(actor) {
61556
62258
  );
61557
62259
  }
61558
62260
 
61559
- // src/utils/lift-contract.util.ts
61560
- var LIFT_DOOR = {
61561
- CLOSED: 0,
61562
- MOVING: 1,
61563
- OPEN: 2
61564
- };
61565
- var LIFT_MOTION = {
61566
- STOPPED: 0,
61567
- UP: 1,
61568
- DOWN: 2,
61569
- UNKNOWN: 3
61570
- };
61571
- var LIFT_MODE = {
61572
- UNKNOWN: 0,
61573
- HUMAN: 1,
61574
- AGV: 2,
61575
- FIRE: 3,
61576
- OFFLINE: 4,
61577
- EMERGENCY: 5
61578
- };
61579
- var LIFT_REQUEST = {
61580
- END_SESSION: 0,
61581
- AGV_MODE: 1,
61582
- HUMAN_MODE: 2
61583
- };
61584
- function isLiftAvailable(state) {
61585
- if (!state)
61586
- return false;
61587
- return state.currentMode === LIFT_MODE.HUMAN || state.currentMode === LIFT_MODE.AGV;
61588
- }
61589
- function isSafeToCross(state, floor) {
61590
- if (!isLiftAvailable(state) || !state)
61591
- return false;
61592
- if (state.currentFloor !== floor)
61593
- return false;
61594
- if (state.motionState !== LIFT_MOTION.STOPPED)
61595
- return false;
61596
- return state.doorState === LIFT_DOOR.OPEN;
61597
- }
61598
- function holdsLift(state, sessionId) {
61599
- if (!state || !sessionId)
61600
- return false;
61601
- return state.sessionId === sessionId;
61602
- }
61603
- function servesFloor(state, floor) {
61604
- if (!state || !floor)
61605
- return false;
61606
- return state.availableFloors.includes(floor);
61607
- }
61608
- function createLiftSimulator(options) {
61609
- const { name, floors } = options;
61610
- if (floors.length === 0)
61611
- throw new Error("A lift must serve some floors.");
61612
- const msPerFloor = options.msPerFloor ?? 2e3;
61613
- const doorDwellMs = options.doorDwellMs ?? 5e3;
61614
- const state = {
61615
- liftName: name,
61616
- liftTime: 0,
61617
- availableFloors: [...floors],
61618
- currentFloor: options.startFloor ?? floors[0],
61619
- destinationFloor: options.startFloor ?? floors[0],
61620
- doorState: LIFT_DOOR.CLOSED,
61621
- motionState: LIFT_MOTION.STOPPED,
61622
- currentMode: LIFT_MODE.HUMAN,
61623
- sessionId: ""
61624
- };
61625
- let travelRemaining = 0;
61626
- let doorTimer = 0;
61627
- function tick(ms) {
61628
- state.liftTime += ms;
61629
- if (state.motionState !== LIFT_MOTION.STOPPED) {
61630
- travelRemaining -= ms;
61631
- if (travelRemaining <= 0) {
61632
- state.currentFloor = state.destinationFloor;
61633
- state.motionState = LIFT_MOTION.STOPPED;
61634
- state.doorState = LIFT_DOOR.OPEN;
61635
- doorTimer = doorDwellMs;
61636
- }
61637
- return;
61638
- }
61639
- if (state.doorState === LIFT_DOOR.OPEN) {
61640
- doorTimer -= ms;
61641
- if (doorTimer <= 0)
61642
- state.doorState = LIFT_DOOR.CLOSED;
61643
- }
61644
- }
61645
- return {
61646
- name,
61647
- state,
61648
- tick,
61649
- async read() {
61650
- return { ...state, availableFloors: [...state.availableFloors] };
61651
- },
61652
- async request(request2) {
61653
- if (request2.requestType === LIFT_REQUEST.END_SESSION) {
61654
- if (state.sessionId === request2.sessionId) {
61655
- state.sessionId = "";
61656
- state.currentMode = LIFT_MODE.HUMAN;
61657
- }
61658
- return;
61659
- }
61660
- if (state.sessionId && state.sessionId !== request2.sessionId) {
61661
- throw new Error(`Lift ${name} is held by ${state.sessionId}.`);
61662
- }
61663
- if (!state.availableFloors.includes(request2.destinationFloor)) {
61664
- throw new Error(
61665
- `Lift ${name} does not serve ${request2.destinationFloor}.`
61666
- );
61667
- }
61668
- state.sessionId = request2.sessionId;
61669
- state.currentMode = request2.requestType === LIFT_REQUEST.AGV_MODE ? LIFT_MODE.AGV : LIFT_MODE.HUMAN;
61670
- state.destinationFloor = request2.destinationFloor;
61671
- if (state.currentFloor === request2.destinationFloor) {
61672
- state.motionState = LIFT_MOTION.STOPPED;
61673
- state.doorState = LIFT_DOOR.OPEN;
61674
- doorTimer = doorDwellMs;
61675
- return;
61676
- }
61677
- const from = state.availableFloors.indexOf(state.currentFloor);
61678
- const to = state.availableFloors.indexOf(request2.destinationFloor);
61679
- state.motionState = to > from ? LIFT_MOTION.UP : LIFT_MOTION.DOWN;
61680
- state.doorState = LIFT_DOOR.CLOSED;
61681
- travelRemaining = Math.abs(to - from) * msPerFloor;
61682
- },
61683
- async refresh(sessionId) {
61684
- if (state.sessionId !== sessionId)
61685
- return;
61686
- if (state.doorState === LIFT_DOOR.OPEN)
61687
- doorTimer = doorDwellMs;
61688
- },
61689
- async release(sessionId) {
61690
- if (state.sessionId !== sessionId)
61691
- return;
61692
- state.sessionId = "";
61693
- state.currentMode = LIFT_MODE.HUMAN;
61694
- }
61695
- };
61696
- }
61697
- var LIFT_QUEUE_TTL_MS = 10 * 6e4;
61698
- var LIFT_LEASE_MS = 3 * 6e4;
61699
- var LIFT_SIM_MS_PER_FLOOR = 4e3;
61700
- var LIFT_SIM_DOOR_DWELL_MS = 8e3;
61701
- var LIFT_SIM_BOARD_MS = 6e3;
61702
- var LIFT_SESSION_STATUS = [
61703
- "queued",
61704
- "active",
61705
- "released",
61706
- "expired",
61707
- "cancelled"
61708
- ];
61709
- async function simulatedLiftState(options) {
61710
- const sim = createLiftSimulator({
61711
- name: options.name,
61712
- floors: options.floors,
61713
- msPerFloor: LIFT_SIM_MS_PER_FLOOR,
61714
- doorDwellMs: LIFT_SIM_DOOR_DWELL_MS
61715
- });
61716
- const session = options.session;
61717
- if (!session || !options.floors.includes(session.fromFloor) || !options.floors.includes(session.toFloor)) {
61718
- return { state: await sim.read(), phase: "idle" };
61719
- }
61720
- const STEP = 250;
61721
- const elapsed = Math.max(0, options.now - session.activeAt);
61722
- let phase = "to-pickup";
61723
- let boardingLeft = LIFT_SIM_BOARD_MS;
61724
- await sim.request({
61725
- liftName: options.name,
61726
- sessionId: session.id,
61727
- requestType: LIFT_REQUEST.AGV_MODE,
61728
- destinationFloor: session.fromFloor,
61729
- doorState: LIFT_DOOR.OPEN
61730
- });
61731
- if (isSafeToCross(sim.state, session.fromFloor))
61732
- phase = "boarding";
61733
- for (let t = 0; t < elapsed; t += STEP) {
61734
- const ms = Math.min(STEP, elapsed - t);
61735
- sim.tick(ms);
61736
- const s = sim.state;
61737
- if (phase === "to-pickup") {
61738
- if (isSafeToCross(s, session.fromFloor))
61739
- phase = "boarding";
61740
- } else if (phase === "boarding") {
61741
- await sim.refresh(session.id);
61742
- boardingLeft -= ms;
61743
- if (boardingLeft <= 0) {
61744
- phase = "to-destination";
61745
- await sim.request({
61746
- liftName: options.name,
61747
- sessionId: session.id,
61748
- requestType: LIFT_REQUEST.AGV_MODE,
61749
- destinationFloor: session.toFloor,
61750
- doorState: LIFT_DOOR.CLOSED
61751
- });
61752
- }
61753
- } else if (phase === "to-destination") {
61754
- if (isSafeToCross(s, session.toFloor))
61755
- phase = "arrived";
61756
- } else if (phase === "arrived") {
61757
- await sim.refresh(session.id);
61758
- }
61759
- }
61760
- return { state: await sim.read(), phase };
61761
- }
61762
- function liftQueueKey(mapId, liftName) {
61763
- return `${mapId}:${liftName}`;
61764
- }
61765
-
61766
62261
  // src/utils/building-map.util.ts
61767
62262
  var WALL_HEIGHT_M = 2.5;
61768
62263
  var WALL_THICKNESS_M = 0.1;
@@ -62506,7 +63001,7 @@ function useRobotFleetController(deps) {
62506
63001
 
62507
63002
  `);
62508
63003
  };
62509
- const handle = robot.brand === DEMO_BRAND ? startDemoTracking(getFleet2().adapterFor(robot), robotSn, send2) : startRobotTracking({
63004
+ const handle = robot.brand === DEMO_BRAND || robot.brand === OPEN_RMF_BRAND ? startDemoTracking(getFleet2().adapterFor(robot), robotSn, send2) : startRobotTracking({
62510
63005
  credentials: {
62511
63006
  appid: (robot.appKey ?? "").trim(),
62512
63007
  secret: (robot.appToken ?? "").trim()
@@ -62911,7 +63406,7 @@ function useRobotLiftSessionRepo() {
62911
63406
 
62912
63407
  // src/controllers/robot-map.controller.ts
62913
63408
  import Joi78 from "joi";
62914
- import { AppError as AppError22, BadRequestError as BadRequestError137, logger as logger108 } from "@7365admin1/node-server-utils";
63409
+ import { AppError as AppError22, BadRequestError as BadRequestError137, NotFoundError as NotFoundError45, logger as logger108 } from "@7365admin1/node-server-utils";
62915
63410
  function useRobotMapController(deps) {
62916
63411
  const now = () => deps?.now?.() ?? Date.now();
62917
63412
  const robots = () => useRobotRepo();
@@ -63216,7 +63711,34 @@ function useRobotMapController(deps) {
63216
63711
  fail(next, e);
63217
63712
  }
63218
63713
  }
63714
+ async function getOpenRmfBuilding(req, res, next) {
63715
+ const { error, value } = Joi78.object({ site: hexId, appSlug: Joi78.string().allow("") }).validate(req.query);
63716
+ if (error)
63717
+ return fail(next, new BadRequestError137(error.message));
63718
+ try {
63719
+ await requireSiteReach(req, value.site);
63720
+ const config2 = openRmfConfig();
63721
+ if (!config2)
63722
+ throw new NotFoundError45("Fleet Core is not configured on this server.");
63723
+ const client = createOpenRmfClient(config2);
63724
+ const building = buildingFromRmf(await client.buildingMap());
63725
+ const [doorStates, liftStates] = await Promise.all([
63726
+ Promise.all(building.doors.slice(0, 100).map((d) => openRmfDoorDriver(client, d.name).read().catch(() => null))),
63727
+ Promise.all(building.lifts.slice(0, 20).map((l) => openRmfLiftDriver(client, l.name).read().catch(() => null)))
63728
+ ]);
63729
+ res.json({
63730
+ source: "fleet-core",
63731
+ readOnly: true,
63732
+ ...building,
63733
+ doorStates: doorStates.filter(Boolean),
63734
+ liftStates: liftStates.filter(Boolean)
63735
+ });
63736
+ } catch (e) {
63737
+ fail(next, e instanceof OpenRmfError ? new AppError22(e.message, 502) : e);
63738
+ }
63739
+ }
63219
63740
  return {
63741
+ getOpenRmfBuilding,
63220
63742
  listMaps,
63221
63743
  getMap,
63222
63744
  createMap,
@@ -63236,7 +63758,7 @@ import { BadRequestError as BadRequestError139, logger as logger110 } from "@736
63236
63758
 
63237
63759
  // src/controllers/robot-site.controller.ts
63238
63760
  import Joi79 from "joi";
63239
- import { BadRequestError as BadRequestError138, NotFoundError as NotFoundError45, logger as logger109 } from "@7365admin1/node-server-utils";
63761
+ import { BadRequestError as BadRequestError138, NotFoundError as NotFoundError46, logger as logger109 } from "@7365admin1/node-server-utils";
63240
63762
  var ROBOT_AUDIT_ACTIONS = Object.values(ConsoleAuditAction).filter((a) => a.startsWith("robot."));
63241
63763
  var SITE_STATES_MAX = 50;
63242
63764
  async function readLiveItems(robots) {
@@ -63427,7 +63949,7 @@ function useRobotSiteController() {
63427
63949
  let targets;
63428
63950
  if (q.robot) {
63429
63951
  if (!robotIds.includes(String(q.robot)))
63430
- throw new NotFoundError45("Robot not found.");
63952
+ throw new NotFoundError46("Robot not found.");
63431
63953
  targets = [String(q.robot)];
63432
63954
  } else {
63433
63955
  targets = [...robotIds, ...await useRobotBuildingMapRepo().getMapIdsAtSite(q.site)];
@@ -63532,7 +64054,7 @@ function useRobotSiteController() {
63532
64054
  }
63533
64055
 
63534
64056
  // src/controllers/robot-network.controller.ts
63535
- var MODES = ["IDLE", "CHARGED", "WORKING", "PAUSED", "CHARGING_CYCLE", "MAINTENANCE", "IN_TRANSIT", "MANUAL", "UNAVAILABLE"];
64057
+ var MODES2 = ["IDLE", "CHARGED", "WORKING", "PAUSED", "CHARGING_CYCLE", "MAINTENANCE", "IN_TRANSIT", "MANUAL", "UNAVAILABLE"];
63536
64058
  var NETWORK_STATES_MAX = 50;
63537
64059
  function useRobotNetworkController() {
63538
64060
  const hex = Joi80.string().hex().length(24).allow("", null);
@@ -63548,7 +64070,7 @@ function useRobotNetworkController() {
63548
64070
  brand: Joi80.string().trim().max(60).allow("", null),
63549
64071
  faultsOnly: Joi80.boolean().default(false),
63550
64072
  offlineOnly: Joi80.boolean().default(false),
63551
- status: Joi80.string().valid(...MODES).allow("", null)
64073
+ status: Joi80.string().valid(...MODES2).allow("", null)
63552
64074
  });
63553
64075
  const faultsSchema = Joi80.object({
63554
64076
  page: Joi80.number().integer().min(1).max(1e4).default(1),
@@ -64171,10 +64693,10 @@ import {
64171
64693
  import { ObjectId as ObjectId110 } from "mongodb";
64172
64694
 
64173
64695
  // src/utils/update-result.util.ts
64174
- import { NotFoundError as NotFoundError46 } from "@7365admin1/node-server-utils";
64696
+ import { NotFoundError as NotFoundError47 } from "@7365admin1/node-server-utils";
64175
64697
  function assertUpdateMatched(result, message) {
64176
64698
  if (result?.matchedCount === 0) {
64177
- throw new NotFoundError46(message);
64699
+ throw new NotFoundError47(message);
64178
64700
  }
64179
64701
  return result;
64180
64702
  }
@@ -65336,7 +65858,7 @@ function usePatrolLogRepo() {
65336
65858
  import {
65337
65859
  BadRequestError as BadRequestError148,
65338
65860
  logger as logger119,
65339
- NotFoundError as NotFoundError47,
65861
+ NotFoundError as NotFoundError48,
65340
65862
  useAtlas as useAtlas83
65341
65863
  } from "@7365admin1/node-server-utils";
65342
65864
  function patrolProblem(status) {
@@ -65376,7 +65898,7 @@ function usePatrolLogService() {
65376
65898
  session
65377
65899
  );
65378
65900
  if (file.matchedCount === 0) {
65379
- throw new NotFoundError47(`File not found: ${fileId}`);
65901
+ throw new NotFoundError48(`File not found: ${fileId}`);
65380
65902
  }
65381
65903
  }
65382
65904
  }
@@ -65741,7 +66263,7 @@ import {
65741
66263
  BadRequestError as BadRequestError151,
65742
66264
  InternalServerError as InternalServerError55,
65743
66265
  logger as logger121,
65744
- NotFoundError as NotFoundError48,
66266
+ NotFoundError as NotFoundError49,
65745
66267
  paginate as paginate38,
65746
66268
  useAtlas as useAtlas84
65747
66269
  } from "@7365admin1/node-server-utils";
@@ -65931,7 +66453,7 @@ function usePatrolEmailRepo() {
65931
66453
  throw new InternalServerError55("Failed to retrieve the patrol email.");
65932
66454
  }
65933
66455
  if (!data) {
65934
- throw new NotFoundError48("Patrol email not found.");
66456
+ throw new NotFoundError49("Patrol email not found.");
65935
66457
  }
65936
66458
  const [decorated] = await withResendState([data], session);
65937
66459
  return decorated;
@@ -65946,7 +66468,7 @@ function usePatrolEmailRepo() {
65946
66468
  { session }
65947
66469
  );
65948
66470
  if (result.matchedCount === 0) {
65949
- throw new NotFoundError48("Patrol email not found.");
66471
+ throw new NotFoundError49("Patrol email not found.");
65950
66472
  }
65951
66473
  return result;
65952
66474
  } catch (error) {
@@ -65975,7 +66497,7 @@ import {
65975
66497
  compileHandlebar as compileHandlebar5,
65976
66498
  getDirectory as getDirectory5,
65977
66499
  logger as logger123,
65978
- NotFoundError as NotFoundError49,
66500
+ NotFoundError as NotFoundError50,
65979
66501
  useMailer as useMailer5
65980
66502
  } from "@7365admin1/node-server-utils";
65981
66503
 
@@ -66170,7 +66692,7 @@ function usePatrolEmailService() {
66170
66692
  for (const id of logIds) {
66171
66693
  const log = await _getPatrolLogById(id);
66172
66694
  if (!log) {
66173
- throw new NotFoundError49("Patrol log not found.");
66695
+ throw new NotFoundError50("Patrol log not found.");
66174
66696
  }
66175
66697
  if (String(log.site) !== String(site)) {
66176
66698
  throw new BadRequestError154(
@@ -66220,7 +66742,7 @@ function usePatrolEmailService() {
66220
66742
  async function claimUploadedPdf(fileId) {
66221
66743
  const file = await _getFileById(fileId);
66222
66744
  if (!file) {
66223
- throw new NotFoundError49("Uploaded PDF not found.");
66745
+ throw new NotFoundError50("Uploaded PDF not found.");
66224
66746
  }
66225
66747
  if (!isClaimableUpload(file)) {
66226
66748
  throw new BadRequestError154(
@@ -66229,7 +66751,7 @@ function usePatrolEmailService() {
66229
66751
  }
66230
66752
  const promoted = await _updateFileStatusById(fileId, { status: "active" });
66231
66753
  if (promoted.matchedCount === 0) {
66232
- throw new NotFoundError49("Uploaded PDF not found.");
66754
+ throw new NotFoundError50("Uploaded PDF not found.");
66233
66755
  }
66234
66756
  return {
66235
66757
  file: fileId,
@@ -66238,7 +66760,7 @@ function usePatrolEmailService() {
66238
66760
  };
66239
66761
  }
66240
66762
  function sanitizeError(error) {
66241
- if (error instanceof BadRequestError154 || error instanceof NotFoundError49) {
66763
+ if (error instanceof BadRequestError154 || error instanceof NotFoundError50) {
66242
66764
  return error.message;
66243
66765
  }
66244
66766
  return "Failed to send the patrol log email.";
@@ -66839,7 +67361,7 @@ import {
66839
67361
  InternalServerError as InternalServerError56,
66840
67362
  logger as logger125,
66841
67363
  makeCacheKey as makeCacheKey39,
66842
- NotFoundError as NotFoundError50,
67364
+ NotFoundError as NotFoundError51,
66843
67365
  paginate as paginate39,
66844
67366
  useAtlas as useAtlas85,
66845
67367
  useCache as useCache44
@@ -66970,7 +67492,7 @@ function useSiteFacilityRepo() {
66970
67492
  try {
66971
67493
  const data = await collection.findOne({ _id }, { session });
66972
67494
  if (!data) {
66973
- throw new NotFoundError50("Site facility not found.");
67495
+ throw new NotFoundError51("Site facility not found.");
66974
67496
  }
66975
67497
  setCache(cacheKey, data, 15 * 60).then(() => {
66976
67498
  logger125.info(`Cache set for key: ${cacheKey}`);
@@ -67095,7 +67617,7 @@ function useSiteFacilityRepo() {
67095
67617
  try {
67096
67618
  const data = await collection.findOne(query2, { session });
67097
67619
  if (!data) {
67098
- throw new NotFoundError50("Site facility not found.");
67620
+ throw new NotFoundError51("Site facility not found.");
67099
67621
  }
67100
67622
  setCache(cacheKey, data, 15 * 60).then(() => {
67101
67623
  logger125.info(`Cache set for key: ${cacheKey}`);
@@ -67236,7 +67758,7 @@ function useSiteFacilityService() {
67236
67758
  // src/controllers/site-facility.controller.ts
67237
67759
  import {
67238
67760
  BadRequestError as BadRequestError157,
67239
- NotFoundError as NotFoundError51,
67761
+ NotFoundError as NotFoundError52,
67240
67762
  UnauthorizedError as UnauthorizedError19,
67241
67763
  logger as logger126
67242
67764
  } from "@7365admin1/node-server-utils";
@@ -67256,7 +67778,7 @@ function useSiteFacilityController() {
67256
67778
  const facility = await _getSiteFacilityById(id);
67257
67779
  const { canReach } = await siteReachOf(req);
67258
67780
  if (!await canReach(facility)) {
67259
- throw new NotFoundError51("Site facility not found.");
67781
+ throw new NotFoundError52("Site facility not found.");
67260
67782
  }
67261
67783
  return facility;
67262
67784
  }
@@ -67521,7 +68043,7 @@ import {
67521
68043
  InternalServerError as InternalServerError57,
67522
68044
  logger as logger127,
67523
68045
  makeCacheKey as makeCacheKey40,
67524
- NotFoundError as NotFoundError52,
68046
+ NotFoundError as NotFoundError53,
67525
68047
  paginate as paginate40,
67526
68048
  useAtlas as useAtlas87,
67527
68049
  useCache as useCache45
@@ -67636,7 +68158,7 @@ function useServiceProviderBillingRepo() {
67636
68158
  try {
67637
68159
  const data = await collection.findOne({ _id }, { session });
67638
68160
  if (!data) {
67639
- throw new NotFoundError52("Service provider billing not found.");
68161
+ throw new NotFoundError53("Service provider billing not found.");
67640
68162
  }
67641
68163
  setCache(cacheKey, data, 15 * 60).then(() => {
67642
68164
  logger127.info(`Cache set for key: ${cacheKey}`);
@@ -68191,7 +68713,7 @@ import {
68191
68713
  InternalServerError as InternalServerError58,
68192
68714
  logger as logger129,
68193
68715
  makeCacheKey as makeCacheKey41,
68194
- NotFoundError as NotFoundError53,
68716
+ NotFoundError as NotFoundError54,
68195
68717
  paginate as paginate41,
68196
68718
  toObjectId as toObjectId18,
68197
68719
  useAtlas as useAtlas89,
@@ -68307,7 +68829,7 @@ function useSiteFacilityBookingRepo() {
68307
68829
  try {
68308
68830
  const data = await collection.findOne({ _id }, { session });
68309
68831
  if (!data) {
68310
- throw new NotFoundError53("Site facility booking not found.");
68832
+ throw new NotFoundError54("Site facility booking not found.");
68311
68833
  }
68312
68834
  setCache(cacheKey, data, 15 * 60).then(() => {
68313
68835
  logger129.info(`Cache set for key: ${cacheKey}`);
@@ -68450,7 +68972,7 @@ function useSiteFacilityBookingService() {
68450
68972
  // src/controllers/site-facility-booking.controller.ts
68451
68973
  import {
68452
68974
  BadRequestError as BadRequestError161,
68453
- NotFoundError as NotFoundError54,
68975
+ NotFoundError as NotFoundError55,
68454
68976
  logger as logger130
68455
68977
  } from "@7365admin1/node-server-utils";
68456
68978
  import Joi94 from "joi";
@@ -68468,7 +68990,7 @@ function useSiteFacilityBookingController() {
68468
68990
  const booking = await _getSiteFacilityBookingById(id);
68469
68991
  const { canReach } = await siteReachOf(req);
68470
68992
  if (!await canReach(booking)) {
68471
- throw new NotFoundError54("Site facility booking not found.");
68993
+ throw new NotFoundError55("Site facility booking not found.");
68472
68994
  }
68473
68995
  return booking;
68474
68996
  }
@@ -68760,7 +69282,7 @@ import {
68760
69282
  InternalServerError as InternalServerError59,
68761
69283
  logger as logger131,
68762
69284
  makeCacheKey as makeCacheKey42,
68763
- NotFoundError as NotFoundError55,
69285
+ NotFoundError as NotFoundError56,
68764
69286
  paginate as paginate42,
68765
69287
  useAtlas as useAtlas91,
68766
69288
  useCache as useCache47
@@ -68934,7 +69456,7 @@ function useDocumentManagementRepo() {
68934
69456
  }
68935
69457
  ]).toArray();
68936
69458
  if (!data || !data.length) {
68937
- throw new NotFoundError55("Document not found.");
69459
+ throw new NotFoundError56("Document not found.");
68938
69460
  }
68939
69461
  setCache(cacheKey, data[0], 15 * 60).then(() => {
68940
69462
  logger131.info(`Cache set for key: ${cacheKey}`);
@@ -69007,7 +69529,7 @@ function useDocumentManagementRepo() {
69007
69529
  { $set: updateValue }
69008
69530
  );
69009
69531
  if (res.matchedCount === 0) {
69010
- throw new NotFoundError55("Folder not found.");
69532
+ throw new NotFoundError56("Folder not found.");
69011
69533
  }
69012
69534
  delNamespace().then(() => {
69013
69535
  logger131.info(`Cache cleared for namespace: ${namespace_collection3}`);
@@ -69097,7 +69619,7 @@ function useDocumentManagementRepo() {
69097
69619
  session ? { session } : void 0
69098
69620
  ).toArray();
69099
69621
  if (!folders || folders.length === 0) {
69100
- throw new NotFoundError55("Folder not found.");
69622
+ throw new NotFoundError56("Folder not found.");
69101
69623
  }
69102
69624
  const ids2 = folders[0].ids;
69103
69625
  const res = await collection.updateMany(
@@ -69426,7 +69948,7 @@ function useDocumentManagementService() {
69426
69948
  import {
69427
69949
  BadRequestError as BadRequestError164,
69428
69950
  logger as logger133,
69429
- NotFoundError as NotFoundError56
69951
+ NotFoundError as NotFoundError57
69430
69952
  } from "@7365admin1/node-server-utils";
69431
69953
  import Joi96 from "joi";
69432
69954
  function useDocumentManagementController() {
@@ -69452,7 +69974,7 @@ function useDocumentManagementController() {
69452
69974
  return;
69453
69975
  const org = doc?.org?.toString() ?? "";
69454
69976
  if (!org || !actor.orgIds.includes(org)) {
69455
- throw new NotFoundError56("Document not found.");
69977
+ throw new NotFoundError57("Document not found.");
69456
69978
  }
69457
69979
  }
69458
69980
  async function add(req, res, next) {
@@ -69860,7 +70382,7 @@ import {
69860
70382
  InternalServerError as InternalServerError60,
69861
70383
  logger as logger134,
69862
70384
  makeCacheKey as makeCacheKey43,
69863
- NotFoundError as NotFoundError57,
70385
+ NotFoundError as NotFoundError58,
69864
70386
  paginate as paginate43,
69865
70387
  useAtlas as useAtlas93,
69866
70388
  useCache as useCache48
@@ -69996,7 +70518,7 @@ function useBulletinBoardRepo() {
69996
70518
  try {
69997
70519
  const data = await collection.findOne({ _id }, { session });
69998
70520
  if (!data) {
69999
- throw new NotFoundError57("Bulletin board not found.");
70521
+ throw new NotFoundError58("Bulletin board not found.");
70000
70522
  }
70001
70523
  setCache(cacheKey, data, 15 * 60).then(() => {
70002
70524
  logger134.info(`Cache set for key: ${cacheKey}`);
@@ -70095,7 +70617,7 @@ function useBulletinBoardRepo() {
70095
70617
  { session }
70096
70618
  );
70097
70619
  if (res.matchedCount === 0) {
70098
- throw new NotFoundError57("No bulletin boards found to update.");
70620
+ throw new NotFoundError58("No bulletin boards found to update.");
70099
70621
  }
70100
70622
  delNamespace().then(() => {
70101
70623
  logger134.info(
@@ -70130,7 +70652,7 @@ function useBulletinBoardRepo() {
70130
70652
  { session }
70131
70653
  );
70132
70654
  if (res.matchedCount === 0) {
70133
- throw new NotFoundError57(
70655
+ throw new NotFoundError58(
70134
70656
  "No upcoming bulletin boards found to activate."
70135
70657
  );
70136
70658
  }
@@ -70162,7 +70684,7 @@ function useBulletinBoardRepo() {
70162
70684
  }
70163
70685
 
70164
70686
  // src/services/bulletin-board.service.ts
70165
- import { useAtlas as useAtlas94, NotFoundError as NotFoundError58 } from "@7365admin1/node-server-utils";
70687
+ import { useAtlas as useAtlas94, NotFoundError as NotFoundError59 } from "@7365admin1/node-server-utils";
70166
70688
  import { ObjectId as ObjectId126 } from "mongodb";
70167
70689
 
70168
70690
  // src/utils/bulletin-service-apps.util.ts
@@ -70209,7 +70731,7 @@ function useBulletinBoardService() {
70209
70731
  session
70210
70732
  );
70211
70733
  if (!file) {
70212
- throw new NotFoundError58("File not found.");
70734
+ throw new NotFoundError59("File not found.");
70213
70735
  }
70214
70736
  }
70215
70737
  }
@@ -70358,7 +70880,7 @@ function useBulletinBoardService() {
70358
70880
  // src/controllers/bulletin-board.controller.ts
70359
70881
  import {
70360
70882
  BadRequestError as BadRequestError166,
70361
- NotFoundError as NotFoundError59,
70883
+ NotFoundError as NotFoundError60,
70362
70884
  UnauthorizedError as UnauthorizedError20,
70363
70885
  logger as logger135
70364
70886
  } from "@7365admin1/node-server-utils";
@@ -70375,7 +70897,7 @@ function useBulletinBoardController() {
70375
70897
  const bulletin = await _getBulletinBoardById(id);
70376
70898
  const { canReach } = await siteReachOf(req);
70377
70899
  if (!await canReach(scopeOf(bulletin))) {
70378
- throw new NotFoundError59("Bulletin board not found.");
70900
+ throw new NotFoundError60("Bulletin board not found.");
70379
70901
  }
70380
70902
  return bulletin;
70381
70903
  }
@@ -71955,7 +72477,7 @@ import {
71955
72477
  InternalServerError as InternalServerError63,
71956
72478
  logger as logger144,
71957
72479
  makeCacheKey as makeCacheKey46,
71958
- NotFoundError as NotFoundError62,
72480
+ NotFoundError as NotFoundError63,
71959
72481
  paginate as paginate46,
71960
72482
  useAtlas as useAtlas99,
71961
72483
  useCache as useCache51
@@ -72129,7 +72651,7 @@ function useEventManagementRepo() {
72129
72651
  try {
72130
72652
  const data = await collection.findOne({ _id }, { session });
72131
72653
  if (!data) {
72132
- throw new NotFoundError62("Event not found.");
72654
+ throw new NotFoundError63("Event not found.");
72133
72655
  }
72134
72656
  setCache(cacheKey, data, 15 * 60).then(() => {
72135
72657
  logger144.info(`Cache set for key: ${cacheKey}`);
@@ -72226,7 +72748,7 @@ function useEventManagementRepo() {
72226
72748
  { session }
72227
72749
  );
72228
72750
  if (res.matchedCount === 0) {
72229
- throw new NotFoundError62("No bulletin boards found to update.");
72751
+ throw new NotFoundError63("No bulletin boards found to update.");
72230
72752
  }
72231
72753
  delNamespace().then(() => {
72232
72754
  logger144.info(
@@ -72338,7 +72860,7 @@ function useEventManagementService() {
72338
72860
  // src/controllers/event-management.controller.ts
72339
72861
  import {
72340
72862
  BadRequestError as BadRequestError176,
72341
- NotFoundError as NotFoundError63,
72863
+ NotFoundError as NotFoundError64,
72342
72864
  logger as logger145
72343
72865
  } from "@7365admin1/node-server-utils";
72344
72866
  import Joi104 from "joi";
@@ -72353,7 +72875,7 @@ function useEventManagementController() {
72353
72875
  const event = await _getEventManagementById(id);
72354
72876
  const { canReach } = await siteReachOf(req);
72355
72877
  if (!await canReach(event)) {
72356
- throw new NotFoundError63("Event not found.");
72878
+ throw new NotFoundError64("Event not found.");
72357
72879
  }
72358
72880
  return event;
72359
72881
  }
@@ -75274,7 +75796,7 @@ import {
75274
75796
  InternalServerError as InternalServerError65,
75275
75797
  logger as logger150,
75276
75798
  makeCacheKey as makeCacheKey48,
75277
- NotFoundError as NotFoundError65,
75799
+ NotFoundError as NotFoundError66,
75278
75800
  paginate as paginate48,
75279
75801
  useAtlas as useAtlas104,
75280
75802
  useCache as useCache53
@@ -75477,7 +75999,7 @@ function useNfcPatrolTagRepo() {
75477
75999
  }
75478
76000
  const tag = await collection.findOne({ _id }, { session });
75479
76001
  if (!tag) {
75480
- throw new NotFoundError65("NFC Patrol Tag not found.");
76002
+ throw new NotFoundError66("NFC Patrol Tag not found.");
75481
76003
  }
75482
76004
  return tag;
75483
76005
  }
@@ -76074,7 +76596,7 @@ import {
76074
76596
  InternalServerError as InternalServerError66,
76075
76597
  logger as logger154,
76076
76598
  makeCacheKey as makeCacheKey49,
76077
- NotFoundError as NotFoundError66,
76599
+ NotFoundError as NotFoundError67,
76078
76600
  paginate as paginate49,
76079
76601
  useAtlas as useAtlas106,
76080
76602
  useCache as useCache54
@@ -76215,7 +76737,7 @@ function useBulletinVideoRepo() {
76215
76737
  { session }
76216
76738
  );
76217
76739
  if (!data) {
76218
- throw new NotFoundError66("Bulletin video not found.");
76740
+ throw new NotFoundError67("Bulletin video not found.");
76219
76741
  }
76220
76742
  setCache(cacheKey, data, 15 * 60).then(() => {
76221
76743
  logger154.info(`Cache set for key: ${cacheKey}`);
@@ -76307,7 +76829,7 @@ function useBulletinVideoRepo() {
76307
76829
  }
76308
76830
 
76309
76831
  // src/services/bulletin-video.service.ts
76310
- import { useAtlas as useAtlas107, NotFoundError as NotFoundError67 } from "@7365admin1/node-server-utils";
76832
+ import { useAtlas as useAtlas107, NotFoundError as NotFoundError68 } from "@7365admin1/node-server-utils";
76311
76833
  function useBulletinVideoService() {
76312
76834
  const {
76313
76835
  add: _add,
@@ -76328,7 +76850,7 @@ function useBulletinVideoService() {
76328
76850
  session
76329
76851
  );
76330
76852
  if (!file) {
76331
- throw new NotFoundError67("File not found.");
76853
+ throw new NotFoundError68("File not found.");
76332
76854
  }
76333
76855
  }
76334
76856
  await _add(value, session);
@@ -76384,7 +76906,7 @@ function useBulletinVideoService() {
76384
76906
  // src/controllers/bulletin-video.controller.ts
76385
76907
  import {
76386
76908
  BadRequestError as BadRequestError188,
76387
- NotFoundError as NotFoundError68,
76909
+ NotFoundError as NotFoundError69,
76388
76910
  logger as logger155
76389
76911
  } from "@7365admin1/node-server-utils";
76390
76912
  import Joi113 from "joi";
@@ -76399,7 +76921,7 @@ function useBulletinVideoController() {
76399
76921
  const video = await _getBulletinVideoById(id);
76400
76922
  const { canReach } = await siteReachOf(req);
76401
76923
  if (!await canReach(video)) {
76402
- throw new NotFoundError68("Bulletin video not found.");
76924
+ throw new NotFoundError69("Bulletin video not found.");
76403
76925
  }
76404
76926
  return video;
76405
76927
  }
@@ -77693,7 +78215,7 @@ import {
77693
78215
  InternalServerError as InternalServerError68,
77694
78216
  logger as logger161,
77695
78217
  makeCacheKey as makeCacheKey51,
77696
- NotFoundError as NotFoundError70,
78218
+ NotFoundError as NotFoundError71,
77697
78219
  paginate as paginate51,
77698
78220
  useAtlas as useAtlas110,
77699
78221
  useCache as useCache56
@@ -77861,7 +78383,7 @@ function useEntryPassSettingsRepo() {
77861
78383
  }
77862
78384
  ]).toArray();
77863
78385
  if (!data || !data.length) {
77864
- throw new NotFoundError70("Entry Pass Settings not found.");
78386
+ throw new NotFoundError71("Entry Pass Settings not found.");
77865
78387
  }
77866
78388
  setCache(cacheKey, data[0], 15 * 60).then(() => {
77867
78389
  logger161.info(`Cache set for key: ${cacheKey}`);
@@ -77997,7 +78519,7 @@ function useEntryPassSettingsRepo() {
77997
78519
  }
77998
78520
  ]).toArray();
77999
78521
  if (!data || !data.length) {
78000
- throw new NotFoundError70("Entry Pass Settings not found.");
78522
+ throw new NotFoundError71("Entry Pass Settings not found.");
78001
78523
  }
78002
78524
  setCache(cacheKey, data[0], 15 * 60).then(() => {
78003
78525
  logger161.info(`Cache set for key: ${cacheKey}`);
@@ -78806,7 +79328,7 @@ function useNfcPatrolRouteService() {
78806
79328
  import {
78807
79329
  BadRequestError as BadRequestError200,
78808
79330
  logger as logger168,
78809
- NotFoundError as NotFoundError72
79331
+ NotFoundError as NotFoundError73
78810
79332
  } from "@7365admin1/node-server-utils";
78811
79333
  import Joi120 from "joi";
78812
79334
  function useNfcPatrolRouteController() {
@@ -78898,7 +79420,7 @@ function useNfcPatrolRouteController() {
78898
79420
  const nfcPatrolRoute = await _getById(value?.id, value?.isStart);
78899
79421
  await requireSiteReachIfSignedIn(req, nfcPatrolRoute?.site);
78900
79422
  if (!nfcPatrolRoute) {
78901
- throw new NotFoundError72("NFC Patrol Route not found.");
79423
+ throw new NotFoundError73("NFC Patrol Route not found.");
78902
79424
  }
78903
79425
  res.json({
78904
79426
  message: "Successfully retrieved nfc patrol route.",
@@ -79296,7 +79818,7 @@ function MIncidentReport(value) {
79296
79818
  import {
79297
79819
  useAtlas as useAtlas115,
79298
79820
  BadRequestError as BadRequestError202,
79299
- NotFoundError as NotFoundError74
79821
+ NotFoundError as NotFoundError75
79300
79822
  } from "@7365admin1/node-server-utils";
79301
79823
 
79302
79824
  // src/repositories/incident-report.repo.ts
@@ -79305,7 +79827,7 @@ import {
79305
79827
  InternalServerError as InternalServerError71,
79306
79828
  logger as logger169,
79307
79829
  makeCacheKey as makeCacheKey54,
79308
- NotFoundError as NotFoundError73,
79830
+ NotFoundError as NotFoundError74,
79309
79831
  paginate as paginate53,
79310
79832
  useAtlas as useAtlas114,
79311
79833
  useCache as useCache59
@@ -79563,7 +80085,7 @@ function useIncidentReportRepo() {
79563
80085
  { session }
79564
80086
  );
79565
80087
  if (!data) {
79566
- throw new NotFoundError73("Incident report not found.");
80088
+ throw new NotFoundError74("Incident report not found.");
79567
80089
  }
79568
80090
  setCache(cacheKey, data, 15 * 60).then(() => {
79569
80091
  logger169.info(`Cache set for key: ${cacheKey}`);
@@ -79846,7 +80368,7 @@ function useIncidentReportService() {
79846
80368
  session
79847
80369
  );
79848
80370
  if (!file) {
79849
- throw new NotFoundError74("File not found.");
80371
+ throw new NotFoundError75("File not found.");
79850
80372
  }
79851
80373
  }
79852
80374
  }
@@ -80329,7 +80851,7 @@ import {
80329
80851
  InternalServerError as InternalServerError72,
80330
80852
  logger as logger172,
80331
80853
  makeCacheKey as makeCacheKey55,
80332
- NotFoundError as NotFoundError75,
80854
+ NotFoundError as NotFoundError76,
80333
80855
  useAtlas as useAtlas116,
80334
80856
  useCache as useCache60
80335
80857
  } from "@7365admin1/node-server-utils";
@@ -80419,7 +80941,7 @@ function useNfcPatrolSettingsRepository() {
80419
80941
  { session }
80420
80942
  );
80421
80943
  if (res.matchedCount === 0) {
80422
- throw new NotFoundError75("NFC patrol settings not found for this site.");
80944
+ throw new NotFoundError76("NFC patrol settings not found for this site.");
80423
80945
  }
80424
80946
  delNamespace().then(() => {
80425
80947
  logger172.info(`Cache cleared for namespace: ${namespace_collection3}`);
@@ -80586,7 +81108,7 @@ import {
80586
81108
  InternalServerError as InternalServerError73,
80587
81109
  logger as logger175,
80588
81110
  makeCacheKey as makeCacheKey56,
80589
- NotFoundError as NotFoundError76,
81111
+ NotFoundError as NotFoundError77,
80590
81112
  paginate as paginate54,
80591
81113
  useAtlas as useAtlas118,
80592
81114
  useCache as useCache61
@@ -80814,7 +81336,7 @@ function useOccurrenceSubjectRepo() {
80814
81336
  try {
80815
81337
  const data = await collection.findOne({ _id }, { session });
80816
81338
  if (!data) {
80817
- throw new NotFoundError76("Occurrence subject not found.");
81339
+ throw new NotFoundError77("Occurrence subject not found.");
80818
81340
  }
80819
81341
  setCache(cacheKey, data, 15 * 60).then(() => {
80820
81342
  logger175.info(`Cache set for key: ${cacheKey}`);
@@ -81295,7 +81817,7 @@ import {
81295
81817
  InternalServerError as InternalServerError74,
81296
81818
  logger as logger177,
81297
81819
  makeCacheKey as makeCacheKey57,
81298
- NotFoundError as NotFoundError77,
81820
+ NotFoundError as NotFoundError78,
81299
81821
  paginate as paginate55,
81300
81822
  useAtlas as useAtlas120,
81301
81823
  useCache as useCache62
@@ -81441,7 +81963,7 @@ function useOnlineFormRepo() {
81441
81963
  }
81442
81964
  ]).toArray();
81443
81965
  if (!data || !data.length) {
81444
- throw new NotFoundError77("Document not found.");
81966
+ throw new NotFoundError78("Document not found.");
81445
81967
  }
81446
81968
  setCache(cacheKey, data[0], 15 * 60).then(() => {
81447
81969
  logger177.info(`Cache set for key: ${cacheKey}`);
@@ -81585,7 +82107,7 @@ function useOnlineFormRepo() {
81585
82107
  // src/controllers/online-form.controller.ts
81586
82108
  import {
81587
82109
  BadRequestError as BadRequestError211,
81588
- NotFoundError as NotFoundError78,
82110
+ NotFoundError as NotFoundError79,
81589
82111
  UnauthorizedError as UnauthorizedError23,
81590
82112
  logger as logger178
81591
82113
  } from "@7365admin1/node-server-utils";
@@ -81603,7 +82125,7 @@ function useOnlineFormController() {
81603
82125
  const form = await _getOnlineFormById(id);
81604
82126
  const { canReach } = await siteReachOf(req);
81605
82127
  if (!await canReach(form)) {
81606
- throw new NotFoundError78("Document not found.");
82128
+ throw new NotFoundError79("Document not found.");
81607
82129
  }
81608
82130
  return form;
81609
82131
  }
@@ -82182,7 +82704,7 @@ function useNfcPatrolLogRepo() {
82182
82704
  // src/services/nfc-patrol-log.service.ts
82183
82705
  import {
82184
82706
  BadRequestError as BadRequestError214,
82185
- NotFoundError as NotFoundError80,
82707
+ NotFoundError as NotFoundError81,
82186
82708
  useAtlas as useAtlas123
82187
82709
  } from "@7365admin1/node-server-utils";
82188
82710
  function useNfcPatrolLogService() {
@@ -82339,7 +82861,7 @@ function useNfcPatrolLogService() {
82339
82861
  async function sign(id, value) {
82340
82862
  const log = await getById(id);
82341
82863
  if (!log) {
82342
- throw new NotFoundError80("Patrol log not found.");
82864
+ throw new NotFoundError81("Patrol log not found.");
82343
82865
  }
82344
82866
  const canSign = log.checkPoints.every(
82345
82867
  (c) => c.status === "Completed" || c.status === "Skipped"
@@ -85570,7 +86092,7 @@ function useManpowerDesignationRepo() {
85570
86092
  // src/controllers/manpower-designations.controller.ts
85571
86093
  import {
85572
86094
  BadRequestError as BadRequestError223,
85573
- NotFoundError as NotFoundError83,
86095
+ NotFoundError as NotFoundError84,
85574
86096
  logger as logger189
85575
86097
  } from "@7365admin1/node-server-utils";
85576
86098
  import Joi136 from "joi";
@@ -85585,7 +86107,7 @@ function useManpowerDesignationCtrl() {
85585
86107
  const row = await _getManpowerDesignationsById(_id);
85586
86108
  const { canReach } = await siteReachOf(req);
85587
86109
  if (!row || !await canReach({ site: row.siteId })) {
85588
- throw new NotFoundError83("Manpower designations not found.");
86110
+ throw new NotFoundError84("Manpower designations not found.");
85589
86111
  }
85590
86112
  return row;
85591
86113
  }
@@ -85599,7 +86121,7 @@ function useManpowerDesignationCtrl() {
85599
86121
  }
85600
86122
  const { actor, canReach } = await siteReachOf(req);
85601
86123
  if (!await canReach({ site: payload.siteId })) {
85602
- throw new NotFoundError83("Site not found.");
86124
+ throw new NotFoundError84("Site not found.");
85603
86125
  }
85604
86126
  payload.createdBy = actor.id;
85605
86127
  payload.createdByName = actor.name;
@@ -88337,7 +88859,7 @@ import {
88337
88859
  useAtlas as useAtlas136,
88338
88860
  logger as logger204,
88339
88861
  BadRequestError as BadRequestError234,
88340
- NotFoundError as NotFoundError84,
88862
+ NotFoundError as NotFoundError85,
88341
88863
  AppError as AppError37,
88342
88864
  paginate as paginate66
88343
88865
  } from "@7365admin1/node-server-utils";
@@ -88395,7 +88917,7 @@ var useRedDotPaymentRepo = () => {
88395
88917
  { session }
88396
88918
  );
88397
88919
  if (!payment) {
88398
- throw new NotFoundError84("Payment not found.");
88920
+ throw new NotFoundError85("Payment not found.");
88399
88921
  }
88400
88922
  return payment;
88401
88923
  } catch (error) {
@@ -88727,7 +89249,7 @@ var useRedDotPaymentRepo = () => {
88727
89249
  { session }
88728
89250
  );
88729
89251
  if (res.matchedCount === 0) {
88730
- throw new NotFoundError84(
89252
+ throw new NotFoundError85(
88731
89253
  "Payment not found or is no longer pending."
88732
89254
  );
88733
89255
  }
@@ -89058,7 +89580,7 @@ import {
89058
89580
  logger as logger207,
89059
89581
  getDirectory as getDirectory7,
89060
89582
  BadRequestError as BadRequestError238,
89061
- NotFoundError as NotFoundError87,
89583
+ NotFoundError as NotFoundError88,
89062
89584
  InternalServerError as InternalServerError87,
89063
89585
  UnauthorizedError as UnauthorizedError24,
89064
89586
  useAtlas as useAtlas140,
@@ -89072,7 +89594,7 @@ import {
89072
89594
  BadRequestError as BadRequestError237,
89073
89595
  comparePassword as comparePassword3,
89074
89596
  InternalServerError as InternalServerError86,
89075
- NotFoundError as NotFoundError86,
89597
+ NotFoundError as NotFoundError87,
89076
89598
  useAtlas as useAtlas139,
89077
89599
  useCache as useCache73
89078
89600
  } from "@7365admin1/node-server-utils";
@@ -89086,7 +89608,7 @@ import {
89086
89608
  logger as logger206,
89087
89609
  BadRequestError as BadRequestError236,
89088
89610
  paginate as paginate67,
89089
- NotFoundError as NotFoundError85,
89611
+ NotFoundError as NotFoundError86,
89090
89612
  AppError as AppError38,
89091
89613
  useCache as useCache72,
89092
89614
  makeCacheKey as makeCacheKey65,
@@ -89219,7 +89741,7 @@ function useUserRepoV2() {
89219
89741
  ]).toArray();
89220
89742
  const data = results.length > 0 ? results[0] : null;
89221
89743
  if (!data)
89222
- throw new NotFoundError85("User not found.");
89744
+ throw new NotFoundError86("User not found.");
89223
89745
  setCache(cacheKey, data, 15 * 60).then(() => logger206.info(`Cache set for key: ${cacheKey}`)).catch(
89224
89746
  (err) => logger206.error(`Failed to set cache for key: ${cacheKey}`, err)
89225
89747
  );
@@ -89585,7 +90107,7 @@ function useAuthServiceV2() {
89585
90107
  try {
89586
90108
  const user = await getUserByEmail(email);
89587
90109
  if (!user) {
89588
- throw new NotFoundError86(
90110
+ throw new NotFoundError87(
89589
90111
  "Invalid user email. Please check your email and try again."
89590
90112
  );
89591
90113
  }
@@ -89848,7 +90370,7 @@ function useVerificationServiceV2() {
89848
90370
  session?.startTransaction();
89849
90371
  const item = await _getByVerificationCode(verificationCode);
89850
90372
  if (!item) {
89851
- throw new NotFoundError87("Verification not found.");
90373
+ throw new NotFoundError88("Verification not found.");
89852
90374
  }
89853
90375
  switch (item.status) {
89854
90376
  case "expired" /* EXPIRED */:
@@ -90110,7 +90632,7 @@ function useVerificationServiceV2() {
90110
90632
  async function resendSignUpVerification(email) {
90111
90633
  const item = await _getPendingVerificationByEmail(email);
90112
90634
  if (!item) {
90113
- throw new NotFoundError87(
90635
+ throw new NotFoundError88(
90114
90636
  "Pending verification not found."
90115
90637
  );
90116
90638
  }
@@ -90166,7 +90688,7 @@ function useVerificationServiceV2() {
90166
90688
  }
90167
90689
  async function assertInviteOpen(invite) {
90168
90690
  if (!invite) {
90169
- throw new NotFoundError87("Invitation not found.");
90691
+ throw new NotFoundError88("Invitation not found.");
90170
90692
  }
90171
90693
  if (invite.type !== "user-invite" /* USER_INVITE */ && invite.type !== "member-invite" /* MEMBER_INVITE */) {
90172
90694
  throw new BadRequestError238("This link is not a user invitation.");
@@ -90334,7 +90856,7 @@ function useVerificationServiceV2() {
90334
90856
  const email = await callerEmail(userId);
90335
90857
  const invite = await _getVerificationByIdFresh(inviteId);
90336
90858
  if (!invite) {
90337
- throw new NotFoundError87("Invitation not found.");
90859
+ throw new NotFoundError88("Invitation not found.");
90338
90860
  }
90339
90861
  if (invite.email.toLowerCase() !== email.toLowerCase()) {
90340
90862
  throw new UnauthorizedError24("Not authorized.");
@@ -91098,7 +91620,7 @@ import {
91098
91620
  comparePassword as comparePassword4,
91099
91621
  hashPassword as hashPassword5,
91100
91622
  InternalServerError as InternalServerError88,
91101
- NotFoundError as NotFoundError88,
91623
+ NotFoundError as NotFoundError89,
91102
91624
  useAtlas as useAtlas141,
91103
91625
  useS3 as useS33
91104
91626
  } from "@7365admin1/node-server-utils";
@@ -91202,14 +91724,14 @@ function useUserServiceV2() {
91202
91724
  try {
91203
91725
  const otpDoc = await _getVerificationById(id);
91204
91726
  if (!otpDoc) {
91205
- throw new NotFoundError88("You are using an invalid reset link.");
91727
+ throw new NotFoundError89("You are using an invalid reset link.");
91206
91728
  }
91207
91729
  if (otpDoc.status === "complete" /* COMPLETE */) {
91208
91730
  throw new BadRequestError241("This link has already been invalidated.");
91209
91731
  }
91210
91732
  const user = await _getUserByEmail(otpDoc.email);
91211
91733
  if (!user) {
91212
- throw new NotFoundError88("User not found.");
91734
+ throw new NotFoundError89("User not found.");
91213
91735
  }
91214
91736
  if (!user._id) {
91215
91737
  throw new InternalServerError88("Invalid user ID.");
@@ -92080,7 +92602,7 @@ function MPost(value) {
92080
92602
  import {
92081
92603
  BadRequestError as BadRequestError247,
92082
92604
  InternalServerError as InternalServerError90,
92083
- NotFoundError as NotFoundError89,
92605
+ NotFoundError as NotFoundError90,
92084
92606
  paginate as paginate68,
92085
92607
  useAtlas as useAtlas143
92086
92608
  } from "@7365admin1/node-server-utils";
@@ -92303,7 +92825,7 @@ function usePostPrelovedRepo() {
92303
92825
  ]).toArray();
92304
92826
  const data = result[0] ?? null;
92305
92827
  if (!data)
92306
- throw new NotFoundError89("Post not found.");
92828
+ throw new NotFoundError90("Post not found.");
92307
92829
  return data;
92308
92830
  } catch (error) {
92309
92831
  throw error;
@@ -92613,7 +93135,7 @@ import { useAtlas as useAtlas145 } from "@7365admin1/node-server-utils";
92613
93135
  import {
92614
93136
  BadRequestError as BadRequestError248,
92615
93137
  InternalServerError as InternalServerError91,
92616
- NotFoundError as NotFoundError90,
93138
+ NotFoundError as NotFoundError91,
92617
93139
  useAtlas as useAtlas144
92618
93140
  } from "@7365admin1/node-server-utils";
92619
93141
  import { ObjectId as ObjectId179 } from "mongodb";
@@ -92709,7 +93231,7 @@ function usePostFavoriteRepo() {
92709
93231
  }
92710
93232
  const result = await collection.findOne({ _id });
92711
93233
  if (!result)
92712
- throw new NotFoundError90("Favorite not found.");
93234
+ throw new NotFoundError91("Favorite not found.");
92713
93235
  return result;
92714
93236
  }
92715
93237
  async function getByPostId(postId) {
@@ -92720,7 +93242,7 @@ function usePostFavoriteRepo() {
92720
93242
  }
92721
93243
  const result = await collection.findOne({ postId });
92722
93244
  if (!result)
92723
- throw new NotFoundError90("Favorite not found.");
93245
+ throw new NotFoundError91("Favorite not found.");
92724
93246
  return result;
92725
93247
  }
92726
93248
  async function updateById(_id, userId, session) {
@@ -93232,7 +93754,7 @@ function MCategoryPreloved(value) {
93232
93754
  import {
93233
93755
  BadRequestError as BadRequestError251,
93234
93756
  InternalServerError as InternalServerError92,
93235
- NotFoundError as NotFoundError91,
93757
+ NotFoundError as NotFoundError92,
93236
93758
  useAtlas as useAtlas147
93237
93759
  } from "@7365admin1/node-server-utils";
93238
93760
  import { ObjectId as ObjectId182 } from "mongodb";
@@ -93275,7 +93797,7 @@ function useCategoryPrelovedRepo() {
93275
93797
  try {
93276
93798
  const data = await collection.findOne({ _id: objectId2 });
93277
93799
  if (!data) {
93278
- throw new NotFoundError91("Category not found.");
93800
+ throw new NotFoundError92("Category not found.");
93279
93801
  }
93280
93802
  return data;
93281
93803
  } catch (error) {
@@ -93304,7 +93826,7 @@ function useCategoryPrelovedRepo() {
93304
93826
  }
93305
93827
  const existing = await collection.findOne({ _id: objectId2 });
93306
93828
  if (!existing)
93307
- throw new NotFoundError91("Category not found.");
93829
+ throw new NotFoundError92("Category not found.");
93308
93830
  const res = await collection.updateOne(
93309
93831
  { _id: objectId2 },
93310
93832
  { $set: { ...value, updatedAt: (/* @__PURE__ */ new Date()).toISOString() } }
@@ -93322,7 +93844,7 @@ function useCategoryPrelovedRepo() {
93322
93844
  }
93323
93845
  const existing = await collection.findOne({ _id: objectId2 });
93324
93846
  if (!existing)
93325
- throw new NotFoundError91("Category not found.");
93847
+ throw new NotFoundError92("Category not found.");
93326
93848
  const res = await collection.deleteOne({ _id: objectId2 });
93327
93849
  if (res.deletedCount === 0)
93328
93850
  throw new InternalServerError92("Unable to delete category.");
@@ -93489,7 +94011,7 @@ function MSubcategoryPreloved(value) {
93489
94011
  import {
93490
94012
  BadRequestError as BadRequestError253,
93491
94013
  InternalServerError as InternalServerError93,
93492
- NotFoundError as NotFoundError92,
94014
+ NotFoundError as NotFoundError93,
93493
94015
  useAtlas as useAtlas148
93494
94016
  } from "@7365admin1/node-server-utils";
93495
94017
  import { ObjectId as ObjectId184 } from "mongodb";
@@ -93540,7 +94062,7 @@ function useSubcategoryPrelovedRepo() {
93540
94062
  try {
93541
94063
  const data = await collection.findOne({ _id: objectId2 });
93542
94064
  if (!data) {
93543
- throw new NotFoundError92("Subcategory not found.");
94065
+ throw new NotFoundError93("Subcategory not found.");
93544
94066
  }
93545
94067
  return data;
93546
94068
  } catch (error) {
@@ -93815,7 +94337,7 @@ function MChatPreloved(value) {
93815
94337
  import {
93816
94338
  BadRequestError as BadRequestError255,
93817
94339
  InternalServerError as InternalServerError94,
93818
- NotFoundError as NotFoundError93,
94340
+ NotFoundError as NotFoundError94,
93819
94341
  useAtlas as useAtlas149
93820
94342
  } from "@7365admin1/node-server-utils";
93821
94343
  import { ObjectId as ObjectId186 } from "mongodb";
@@ -93855,7 +94377,7 @@ function useChatPrelovedRepo() {
93855
94377
  }
93856
94378
  const existing = await collection.findOne({ _id: objectId2 });
93857
94379
  if (!existing)
93858
- throw new NotFoundError93("Chat not found.");
94380
+ throw new NotFoundError94("Chat not found.");
93859
94381
  value.edited = true;
93860
94382
  value.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
93861
94383
  const res = await collection.updateOne({ _id: objectId2 }, { $set: value });
@@ -93872,7 +94394,7 @@ function useChatPrelovedRepo() {
93872
94394
  }
93873
94395
  const existing = await collection.findOne({ _id: objectId2 });
93874
94396
  if (!existing)
93875
- throw new NotFoundError93("Chat not found.");
94397
+ throw new NotFoundError94("Chat not found.");
93876
94398
  const res = await collection.updateOne(
93877
94399
  { _id: objectId2 },
93878
94400
  { $set: { deletedAt: (/* @__PURE__ */ new Date()).toISOString(), updatedAt: (/* @__PURE__ */ new Date()).toISOString() } }
@@ -94605,7 +95127,7 @@ function useChannelPrelovedController() {
94605
95127
  // src/repositories/bid-preloved.repo.ts
94606
95128
  import {
94607
95129
  InternalServerError as InternalServerError98,
94608
- NotFoundError as NotFoundError94,
95130
+ NotFoundError as NotFoundError95,
94609
95131
  useAtlas as useAtlas153
94610
95132
  } from "@7365admin1/node-server-utils";
94611
95133
  import { ObjectId as ObjectId190 } from "mongodb";
@@ -94627,7 +95149,7 @@ function useBidPrelovedRepo() {
94627
95149
  const objectId2 = typeof _id === "string" ? new ObjectId190(_id) : _id;
94628
95150
  const existing = await collection.findOne({ _id: objectId2 });
94629
95151
  if (!existing)
94630
- throw new NotFoundError94("Bid not found.");
95152
+ throw new NotFoundError95("Bid not found.");
94631
95153
  const res = await collection.updateOne(
94632
95154
  { _id: objectId2 },
94633
95155
  { $set: { status, updatedAt: (/* @__PURE__ */ new Date()).toISOString() } }
@@ -94641,7 +95163,7 @@ function useBidPrelovedRepo() {
94641
95163
  _id = new ObjectId190(_id);
94642
95164
  const result = await collection.findOne({ _id });
94643
95165
  if (!result)
94644
- throw new NotFoundError94("Bid not found.");
95166
+ throw new NotFoundError95("Bid not found.");
94645
95167
  return result;
94646
95168
  }
94647
95169
  return { add, getById, updateStatus };
@@ -94948,7 +95470,7 @@ var residentFormEntry = Joi168.object({
94948
95470
  import {
94949
95471
  BadRequestError as BadRequestError260,
94950
95472
  InternalServerError as InternalServerError100,
94951
- NotFoundError as NotFoundError95,
95473
+ NotFoundError as NotFoundError96,
94952
95474
  paginate as paginate71,
94953
95475
  useAtlas as useAtlas155,
94954
95476
  useCache as useCache76
@@ -95053,7 +95575,7 @@ function useFormEntryRepo() {
95053
95575
  try {
95054
95576
  const [data] = await collection.aggregate([{ $match: query2 }]).toArray();
95055
95577
  if (!data) {
95056
- throw new NotFoundError95("Document not found.");
95578
+ throw new NotFoundError96("Document not found.");
95057
95579
  }
95058
95580
  return data;
95059
95581
  } catch (error) {
@@ -95077,7 +95599,7 @@ function useFormEntryRepo() {
95077
95599
  }
95078
95600
  const onlineFormRequest = await collection.findOne({ _id });
95079
95601
  if (!onlineFormRequest) {
95080
- throw new NotFoundError95("Online form not found.");
95602
+ throw new NotFoundError96("Online form not found.");
95081
95603
  }
95082
95604
  if (onlineFormRequest.userId) {
95083
95605
  const user = await getUserById(onlineFormRequest.userId.toString());
@@ -95190,7 +95712,7 @@ function useFormEntryRepo() {
95190
95712
  // src/controllers/online-forms-v2.controller.ts
95191
95713
  import {
95192
95714
  BadRequestError as BadRequestError261,
95193
- NotFoundError as NotFoundError96,
95715
+ NotFoundError as NotFoundError97,
95194
95716
  UnauthorizedError as UnauthorizedError27,
95195
95717
  logger as logger224
95196
95718
  } from "@7365admin1/node-server-utils";
@@ -95213,7 +95735,7 @@ function useFormEntryController() {
95213
95735
  const owner = entry?.userId?.toString?.() ?? "";
95214
95736
  const isOwner = Boolean(actor.id) && owner === actor.id;
95215
95737
  if (!isOwner && !await canReach(entry)) {
95216
- throw new NotFoundError96("Document not found.");
95738
+ throw new NotFoundError97("Document not found.");
95217
95739
  }
95218
95740
  return { entry, isOwner, actor };
95219
95741
  }
@@ -97497,6 +98019,7 @@ export {
97497
98019
  DEMO_ROUTES,
97498
98020
  DEVICE_STATUS,
97499
98021
  DOBStatus,
98022
+ DOOR_MODE,
97500
98023
  DUPLICATE_TERMS_VERSION_MESSAGE,
97501
98024
  DayOfWeek,
97502
98025
  E164,
@@ -97636,6 +98159,9 @@ export {
97636
98159
  NotificationModule,
97637
98160
  NotificationService,
97638
98161
  OFFLINE_FAULT_CODE,
98162
+ OPEN_RMF_BRAND,
98163
+ OPEN_RMF_CAPABILITIES,
98164
+ OPEN_RMF_DISPLAY_NAME,
97639
98165
  ORG_MARKETPLACE_VENDOR_FIELD,
97640
98166
  ORG_OWNER_REPAIR_CLAIM_STALE_MS,
97641
98167
  ORG_OWNER_REPAIR_CLAIM_TAKEN_REASON,
@@ -97644,6 +98170,7 @@ export {
97644
98170
  OUNITECH_BRAND,
97645
98171
  OUNITECH_CAPABILITIES,
97646
98172
  OUNITECH_PENDING_COMMANDS,
98173
+ OpenRmfError,
97647
98174
  OrgNature,
97648
98175
  OvernightParkingRequestSort,
97649
98176
  OvernightParkingRequestStatus,
@@ -97740,6 +98267,7 @@ export {
97740
98267
  attendanceSchema,
97741
98268
  attendanceSettingsSchema,
97742
98269
  buildSelfServiceEmailContext,
98270
+ buildingFromRmf,
97743
98271
  buildingMapBodySchema,
97744
98272
  buildingMapCreateSchema,
97745
98273
  buildingMapFromRobotMaps,
@@ -97781,6 +98309,8 @@ export {
97781
98309
  createDemoAdapter,
97782
98310
  createLiftSimulator,
97783
98311
  createManpowerRemarksDaily,
98312
+ createOpenRmfAdapter,
98313
+ createOpenRmfClient,
97784
98314
  createOunitechAdapter,
97785
98315
  createSseParser,
97786
98316
  customerSchema,
@@ -97803,6 +98333,7 @@ export {
97803
98333
  deviceHttpTimeoutMs,
97804
98334
  deviceProbeTtlSeconds,
97805
98335
  disconnectedState,
98336
+ doorModeOf,
97806
98337
  emitNotificationCreated,
97807
98338
  emptyPersonalEmergencyChain,
97808
98339
  encodeGreyscalePng,
@@ -97819,6 +98350,7 @@ export {
97819
98350
  ffmpegFrameArgs,
97820
98351
  ffmpegPath,
97821
98352
  filterByAccess,
98353
+ floorNoOf,
97822
98354
  formatCapabilityTrace,
97823
98355
  formatDahuaDate,
97824
98356
  getIO,
@@ -97841,6 +98373,7 @@ export {
97841
98373
  isAvailableForWork,
97842
98374
  isCameraEntitled,
97843
98375
  isDispatchable,
98376
+ isDoorPassable,
97844
98377
  isDuplicateMemberError,
97845
98378
  isDuplicateVersionError,
97846
98379
  isLiftAvailable,
@@ -97895,6 +98428,9 @@ export {
97895
98428
  occurrence_book_namespace_collection,
97896
98429
  onBookTimezonesChanged,
97897
98430
  online_forms_namespace_collection,
98431
+ openRmfConfig,
98432
+ openRmfDoorDriver,
98433
+ openRmfLiftDriver,
97898
98434
  orgLevelRoles,
97899
98435
  orgModulesHandlers,
97900
98436
  orgOwnerRepairHandlers,
@@ -97917,6 +98453,7 @@ export {
97917
98453
  planDayFromJsDay,
97918
98454
  planDemoRobots,
97919
98455
  planOrgOwnerRepair,
98456
+ planShareOf,
97920
98457
  platform_terms_namespace_collection,
97921
98458
  playbackRelays,
97922
98459
  playbackWindowRefusal,
@@ -97933,6 +98470,7 @@ export {
97933
98470
  refuseServiceProviderInviteAction,
97934
98471
  registerCameraTransport,
97935
98472
  registerDemoBrand,
98473
+ registerOpenRmfBrand,
97936
98474
  registerOunitechBrand,
97937
98475
  registerRobotBrand,
97938
98476
  registeredRobotBrands,
@@ -98133,6 +98671,7 @@ export {
98133
98671
  site_people_namespace_collection,
98134
98672
  snapshotEndpoint,
98135
98673
  snapshotRefusalReason,
98674
+ splitRobotSn,
98136
98675
  staffMayBypass,
98137
98676
  startDemoTracking,
98138
98677
  startRobotTracking,
@@ -98142,6 +98681,8 @@ export {
98142
98681
  subscriptionPlanSchema,
98143
98682
  summariseBulkCameraPlan,
98144
98683
  supports,
98684
+ taskRequestFor,
98685
+ toAdapterRobot,
98145
98686
  trackingBackoffMs,
98146
98687
  uncontrollableFleetWarning,
98147
98688
  updateRemarksStatusEod,
@@ -98399,6 +98940,7 @@ export {
98399
98940
  visitors_namespace_collection,
98400
98941
  wallConfig,
98401
98942
  wallsFromOccupancyGrid,
98943
+ waypointsFor,
98402
98944
  withLiveLink,
98403
98945
  workOrderSchema,
98404
98946
  work_orders2_namespace_collection,