@7365admin1/core 3.121.0 → 3.122.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/CHANGELOG.md +7 -0
- package/dist/index.d.ts +126 -15
- package/dist/index.js +214 -49
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +205 -49
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/test/e2e/robot-faults.e2e.test.mjs +3 -0
- package/test/e2e/robot-ounitech-company-creds.e2e.test.mjs +5 -4
- package/test/ounitech-part1.test.mjs +8 -7
- package/test/ounitech-timestamp-probe.test.mjs +64 -4
- package/test/padbot-mqtt.test.mjs +7 -3
- package/test/robot-cloud.test.mjs +4 -3
- package/test/robot-model-manifest.test.mjs +84 -0
package/dist/index.mjs
CHANGED
|
@@ -61815,7 +61815,9 @@ var ROBOT_CAPABILITIES = [
|
|
|
61815
61815
|
* watchdog. Lit only where the brand offers it AND the server switched it on
|
|
61816
61816
|
* (`PADBOT_MANUAL_DRIVE=on`); Manager-only (update-robot).
|
|
61817
61817
|
*/
|
|
61818
|
-
"manualDrive"
|
|
61818
|
+
"manualDrive",
|
|
61819
|
+
/** A heat camera: alarm and patrol photos carry a thermal picture and temperatures. Reporting only. */
|
|
61820
|
+
"thermalCamera"
|
|
61819
61821
|
];
|
|
61820
61822
|
var TIER_REQUIREMENTS = {
|
|
61821
61823
|
"full-control": [
|
|
@@ -61944,6 +61946,28 @@ function commandSupported(capabilities, kind) {
|
|
|
61944
61946
|
return false;
|
|
61945
61947
|
return supports(capabilities, needed);
|
|
61946
61948
|
}
|
|
61949
|
+
var modelKey = (v) => typeof v === "string" ? v.toLowerCase().replace(/[^a-z0-9]/g, "") : "";
|
|
61950
|
+
function robotManifest(brand, reportedModel) {
|
|
61951
|
+
const b = robotBrandFor(brand);
|
|
61952
|
+
const reported = typeof reportedModel === "string" ? reportedModel.trim().slice(0, 60) : "";
|
|
61953
|
+
if (!b)
|
|
61954
|
+
return { capabilities: {}, profile: { model: reported, modelKnown: false, alarms: [], makerApp: "", makerAppOnly: [] } };
|
|
61955
|
+
const prefix = modelKey(b.brand);
|
|
61956
|
+
let key = modelKey(reported);
|
|
61957
|
+
if (prefix && key.startsWith(prefix) && key !== prefix)
|
|
61958
|
+
key = key.slice(prefix.length);
|
|
61959
|
+
const m = key ? b.models?.find((x) => x.codes.some((c) => modelKey(c) === key)) : void 0;
|
|
61960
|
+
return {
|
|
61961
|
+
capabilities: { ...b.capabilities, ...m?.capabilities ?? {} },
|
|
61962
|
+
profile: {
|
|
61963
|
+
model: m?.name ?? reported,
|
|
61964
|
+
modelKnown: Boolean(m),
|
|
61965
|
+
alarms: [...m?.alarms ?? b.info?.alarms ?? []],
|
|
61966
|
+
makerApp: m?.makerApp ?? b.info?.makerApp ?? "",
|
|
61967
|
+
makerAppOnly: [...m?.makerAppOnly ?? b.info?.makerAppOnly ?? []]
|
|
61968
|
+
}
|
|
61969
|
+
};
|
|
61970
|
+
}
|
|
61947
61971
|
var brands = /* @__PURE__ */ new Map();
|
|
61948
61972
|
function registerRobotBrand(brand) {
|
|
61949
61973
|
if (!brand?.brand)
|
|
@@ -61983,7 +62007,8 @@ function registeredRobotBrands() {
|
|
|
61983
62007
|
// brand can do ("Basic control - no battery, floor or spot clean"). The
|
|
61984
62008
|
// manifest is a property of this build, not of any client.
|
|
61985
62009
|
types: [...b.types ?? ["cleaning"]],
|
|
61986
|
-
capabilities: { ...b.capabilities }
|
|
62010
|
+
capabilities: { ...b.capabilities },
|
|
62011
|
+
models: (b.models ?? []).map((m) => ({ name: m.name, capabilities: robotManifest(b.brand, m.codes[0]).capabilities }))
|
|
61987
62012
|
}));
|
|
61988
62013
|
}
|
|
61989
62014
|
function clearRobotBrands() {
|
|
@@ -62012,10 +62037,25 @@ var ROBOT_CLOUD_TIMESTAMP_FORMATS = [
|
|
|
62012
62037
|
"unix-ms-number"
|
|
62013
62038
|
];
|
|
62014
62039
|
var OUNITECH_TIMESTAMP_FORMAT = "yyyyMMddHHmmss";
|
|
62015
|
-
|
|
62016
|
-
|
|
62017
|
-
const
|
|
62018
|
-
|
|
62040
|
+
var OUNITECH_TIMESTAMP_ZONE = "Asia/Shanghai";
|
|
62041
|
+
function zonedDateTime(now, zone) {
|
|
62042
|
+
const parts = new Intl.DateTimeFormat("en-GB", {
|
|
62043
|
+
timeZone: zone,
|
|
62044
|
+
year: "numeric",
|
|
62045
|
+
month: "2-digit",
|
|
62046
|
+
day: "2-digit",
|
|
62047
|
+
hour: "2-digit",
|
|
62048
|
+
minute: "2-digit",
|
|
62049
|
+
second: "2-digit",
|
|
62050
|
+
hourCycle: "h23"
|
|
62051
|
+
}).formatToParts(now);
|
|
62052
|
+
const get = (type) => parts.find((p) => p.type === type)?.value ?? "";
|
|
62053
|
+
return {
|
|
62054
|
+
date: `${get("year")}-${get("month")}-${get("day")}`,
|
|
62055
|
+
time: `${get("hour")}:${get("minute")}:${get("second")}`
|
|
62056
|
+
};
|
|
62057
|
+
}
|
|
62058
|
+
function robotCloudTimestamp(now = /* @__PURE__ */ new Date(), format2 = OUNITECH_TIMESTAMP_FORMAT, zone = OUNITECH_TIMESTAMP_ZONE) {
|
|
62019
62059
|
switch (format2) {
|
|
62020
62060
|
case "unix-s":
|
|
62021
62061
|
case "unix-s-number":
|
|
@@ -62023,12 +62063,18 @@ function robotCloudTimestamp(now = /* @__PURE__ */ new Date(), format2 = OUNITEC
|
|
|
62023
62063
|
case "unix-ms":
|
|
62024
62064
|
case "unix-ms-number":
|
|
62025
62065
|
return String(now.getTime());
|
|
62026
|
-
case "
|
|
62027
|
-
|
|
62028
|
-
case "iso8601":
|
|
62066
|
+
case "iso8601": {
|
|
62067
|
+
const { date, time } = zonedDateTime(now, "UTC");
|
|
62029
62068
|
return `${date}T${time}Z`;
|
|
62030
|
-
|
|
62069
|
+
}
|
|
62070
|
+
case "yyyy-MM-dd HH:mm:ss": {
|
|
62071
|
+
const { date, time } = zonedDateTime(now, zone);
|
|
62072
|
+
return `${date} ${time}`;
|
|
62073
|
+
}
|
|
62074
|
+
case "yyyyMMddHHmmss": {
|
|
62075
|
+
const { date, time } = zonedDateTime(now, zone);
|
|
62031
62076
|
return `${date}${time}`.replace(/[-:]/g, "");
|
|
62077
|
+
}
|
|
62032
62078
|
default:
|
|
62033
62079
|
throw new Error(`Robot cloud: unknown timestamp format "${format2}".`);
|
|
62034
62080
|
}
|
|
@@ -62043,8 +62089,8 @@ function robotCloudSign(appid, timestamp, path5, secret) {
|
|
|
62043
62089
|
}
|
|
62044
62090
|
return crypto10.createHash("sha1").update(robotCloudSigningString(appid, timestamp, path5, secret)).digest("hex");
|
|
62045
62091
|
}
|
|
62046
|
-
function robotCloudBody(appid, secret, path5, params = {}, now, format2 = OUNITECH_TIMESTAMP_FORMAT) {
|
|
62047
|
-
const timestamp = robotCloudTimestamp(now, format2);
|
|
62092
|
+
function robotCloudBody(appid, secret, path5, params = {}, now, format2 = OUNITECH_TIMESTAMP_FORMAT, zone = OUNITECH_TIMESTAMP_ZONE) {
|
|
62093
|
+
const timestamp = robotCloudTimestamp(now, format2, zone);
|
|
62048
62094
|
return {
|
|
62049
62095
|
appid,
|
|
62050
62096
|
timestamp: format2.endsWith("-number") ? Number(timestamp) : timestamp,
|
|
@@ -62176,9 +62222,9 @@ function planDayFromJsDay(jsDay) {
|
|
|
62176
62222
|
var ROBOT_CLOUD_DOC_CONFIRMATIONS = [
|
|
62177
62223
|
// ANSWERED 2026-09-26 (Ounitech Part 1): base URL, one appid/secret per
|
|
62178
62224
|
// company, sign = the formula with url = each endpoint's own path (the doc's
|
|
62179
|
-
// examples were a copy-paste), timestamp
|
|
62225
|
+
// examples were a copy-paste), timestamp zone proven Asia/Shanghai (UTC+8) in production. Removed from this list.
|
|
62180
62226
|
// Still open: the accepted clock-skew window.
|
|
62181
|
-
"Accepted clock-skew window for `timestamp` (UTC+
|
|
62227
|
+
"Accepted clock-skew window for `timestamp` (zone proven UTC+8 by probe; the window is not stated).",
|
|
62182
62228
|
// pixelToMetres assumes the image y-origin is top-left.
|
|
62183
62229
|
"Pixel y-origin: top-left (assumed) or bottom-left.",
|
|
62184
62230
|
// The doc labels modeFlag "1 vacuum / 2 washing / 3 dry dust mop" on the
|
|
@@ -62406,7 +62452,8 @@ function useRobotCloudService(credentials, options = {}) {
|
|
|
62406
62452
|
path5,
|
|
62407
62453
|
params,
|
|
62408
62454
|
options.now?.(),
|
|
62409
|
-
options.timestampFormat
|
|
62455
|
+
options.timestampFormat,
|
|
62456
|
+
options.timestampZone
|
|
62410
62457
|
);
|
|
62411
62458
|
const step = robotCloudStepName(path5);
|
|
62412
62459
|
let data;
|
|
@@ -62486,6 +62533,9 @@ function useRobotCloudService(credentials, options = {}) {
|
|
|
62486
62533
|
);
|
|
62487
62534
|
return data.robotList ?? [];
|
|
62488
62535
|
}
|
|
62536
|
+
async function getRobotListReply() {
|
|
62537
|
+
return post(ROBOT_CLOUD_PATHS.robotList, {}, "robotList");
|
|
62538
|
+
}
|
|
62489
62539
|
async function getMaps(robotSn) {
|
|
62490
62540
|
const data = await post(
|
|
62491
62541
|
ROBOT_CLOUD_PATHS.mapList,
|
|
@@ -62558,6 +62608,7 @@ function useRobotCloudService(credentials, options = {}) {
|
|
|
62558
62608
|
}
|
|
62559
62609
|
return {
|
|
62560
62610
|
getRobots,
|
|
62611
|
+
getRobotListReply,
|
|
62561
62612
|
getMaps,
|
|
62562
62613
|
getFileUrls,
|
|
62563
62614
|
getPlans,
|
|
@@ -62689,14 +62740,18 @@ function createOunitechAdapter(credentials, options) {
|
|
|
62689
62740
|
}
|
|
62690
62741
|
};
|
|
62691
62742
|
}
|
|
62743
|
+
var OUNITECH_BRAND_DEFINITION = {
|
|
62744
|
+
brand: OUNITECH_BRAND,
|
|
62745
|
+
displayName: "Ounitech (Q3-G / Q3-W)",
|
|
62746
|
+
capabilities: OUNITECH_CAPABILITIES,
|
|
62747
|
+
pendingCommands: OUNITECH_PENDING_COMMANDS,
|
|
62748
|
+
// The robot list carries no model, so Q3-G and Q3-W share these defaults
|
|
62749
|
+
// (their API is the same); add `models` when Ounitech reports one.
|
|
62750
|
+
info: { makerApp: "the Ounitech app", makerAppOnly: ["pausing or stopping a job", "cleaning across floors"] },
|
|
62751
|
+
create: (credentials) => createOunitechAdapter(credentials)
|
|
62752
|
+
};
|
|
62692
62753
|
function registerOunitechBrand() {
|
|
62693
|
-
registerRobotBrand(
|
|
62694
|
-
brand: OUNITECH_BRAND,
|
|
62695
|
-
displayName: "Ounitech (Q3-G / Q3-W)",
|
|
62696
|
-
capabilities: OUNITECH_CAPABILITIES,
|
|
62697
|
-
pendingCommands: OUNITECH_PENDING_COMMANDS,
|
|
62698
|
-
create: (credentials) => createOunitechAdapter(credentials)
|
|
62699
|
-
});
|
|
62754
|
+
registerRobotBrand(OUNITECH_BRAND_DEFINITION);
|
|
62700
62755
|
}
|
|
62701
62756
|
registerOunitechBrand();
|
|
62702
62757
|
|
|
@@ -63178,15 +63233,22 @@ function startDemoTracking(adapter, robotSn, onEvent, everyMs = 1200, skip) {
|
|
|
63178
63233
|
}
|
|
63179
63234
|
};
|
|
63180
63235
|
}
|
|
63236
|
+
var DEMO_BRAND_DEFINITION = {
|
|
63237
|
+
brand: DEMO_BRAND,
|
|
63238
|
+
displayName: "Demo robots (simulated)",
|
|
63239
|
+
capabilities: DEMO_CAPABILITIES,
|
|
63240
|
+
// Serial-derived demo robots are cleaning (DEMO-C-###) AND security (DEMO-S-###).
|
|
63241
|
+
types: ["cleaning", "security"],
|
|
63242
|
+
// Simulated models, so a demo fleet shows a mixed fleet's controls: the
|
|
63243
|
+
// compact CX-1 takes jobs but no point commands; the SP-1 patroller cleans nothing.
|
|
63244
|
+
models: [
|
|
63245
|
+
{ name: "Demo CX-1", codes: ["CX-1"], capabilities: { spotClean: false, navigateToPoint: false, relocalize: false } },
|
|
63246
|
+
{ name: "Demo SP-1", codes: ["SP-1"], capabilities: { spotClean: false } }
|
|
63247
|
+
],
|
|
63248
|
+
create: () => createDemoAdapter()
|
|
63249
|
+
};
|
|
63181
63250
|
function registerDemoBrand() {
|
|
63182
|
-
registerRobotBrand(
|
|
63183
|
-
brand: DEMO_BRAND,
|
|
63184
|
-
displayName: "Demo robots (simulated)",
|
|
63185
|
-
capabilities: DEMO_CAPABILITIES,
|
|
63186
|
-
// Serial-derived demo robots are cleaning (DEMO-C-###) AND security (DEMO-S-###).
|
|
63187
|
-
types: ["cleaning", "security"],
|
|
63188
|
-
create: () => createDemoAdapter()
|
|
63189
|
-
});
|
|
63251
|
+
registerRobotBrand(DEMO_BRAND_DEFINITION);
|
|
63190
63252
|
}
|
|
63191
63253
|
registerDemoBrand();
|
|
63192
63254
|
|
|
@@ -64452,11 +64514,44 @@ var PADBOT_CAPABILITIES = {
|
|
|
64452
64514
|
// §6.7 / §6.8
|
|
64453
64515
|
resolveAlerts: true,
|
|
64454
64516
|
// §6.6
|
|
64455
|
-
//
|
|
64456
|
-
|
|
64457
|
-
|
|
64458
|
-
|
|
64517
|
+
// Model-specific (see PADBOT_MODELS): the drive limits are the S2's head range,
|
|
64518
|
+
// and a heat camera is the S2's - another PadBot patrol model gets neither.
|
|
64519
|
+
manualDrive: false,
|
|
64520
|
+
thermalCamera: false
|
|
64459
64521
|
};
|
|
64522
|
+
var PADBOT_ALARMS = [
|
|
64523
|
+
"person",
|
|
64524
|
+
"high temperature",
|
|
64525
|
+
"smoke",
|
|
64526
|
+
"debris",
|
|
64527
|
+
"noise",
|
|
64528
|
+
"water on the floor",
|
|
64529
|
+
"person falling",
|
|
64530
|
+
"door open",
|
|
64531
|
+
"window open",
|
|
64532
|
+
"fire-fighting equipment"
|
|
64533
|
+
];
|
|
64534
|
+
var PADBOT_MAKER_APP_ONLY = [
|
|
64535
|
+
"patrol schedules",
|
|
64536
|
+
"maps, points and routes",
|
|
64537
|
+
"alarm thresholds and AI recognition",
|
|
64538
|
+
"lights and voice announcements",
|
|
64539
|
+
"recorded video"
|
|
64540
|
+
];
|
|
64541
|
+
var PADBOT_MODELS = [
|
|
64542
|
+
{
|
|
64543
|
+
name: "PadBot S2",
|
|
64544
|
+
codes: ["S2"],
|
|
64545
|
+
makerAppOnly: [...PADBOT_MAKER_APP_ONLY, "live thermal view"],
|
|
64546
|
+
capabilities: {
|
|
64547
|
+
thermalCamera: true,
|
|
64548
|
+
// §8.1 over MQTT, behind the server's drive watchdog; only with PADBOT_MANUAL_DRIVE=on.
|
|
64549
|
+
get manualDrive() {
|
|
64550
|
+
return padbotManualDriveEnabled();
|
|
64551
|
+
}
|
|
64552
|
+
}
|
|
64553
|
+
}
|
|
64554
|
+
];
|
|
64460
64555
|
var PADBOT_PATHS = {
|
|
64461
64556
|
robots: "/api/v1/robots/list",
|
|
64462
64557
|
states: "/api/v1/robots/states/list",
|
|
@@ -65076,18 +65171,26 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
65076
65171
|
}
|
|
65077
65172
|
};
|
|
65078
65173
|
}
|
|
65174
|
+
var PADBOT_BRAND_DEFINITION = {
|
|
65175
|
+
brand: PADBOT_BRAND,
|
|
65176
|
+
displayName: PADBOT_DISPLAY_NAME,
|
|
65177
|
+
capabilities: PADBOT_CAPABILITIES,
|
|
65178
|
+
types: ["security"],
|
|
65179
|
+
info: { alarms: [...PADBOT_ALARMS], makerApp: "the PadBot app", makerAppOnly: [...PADBOT_MAKER_APP_ONLY] },
|
|
65180
|
+
models: PADBOT_MODELS,
|
|
65181
|
+
create: (credentials) => createPadbotAdapter(credentials)
|
|
65182
|
+
};
|
|
65079
65183
|
function registerPadbotBrand() {
|
|
65080
|
-
registerRobotBrand(
|
|
65081
|
-
brand: PADBOT_BRAND,
|
|
65082
|
-
displayName: PADBOT_DISPLAY_NAME,
|
|
65083
|
-
capabilities: PADBOT_CAPABILITIES,
|
|
65084
|
-
types: ["security"],
|
|
65085
|
-
create: (credentials) => createPadbotAdapter(credentials)
|
|
65086
|
-
});
|
|
65184
|
+
registerRobotBrand(PADBOT_BRAND_DEFINITION);
|
|
65087
65185
|
}
|
|
65088
65186
|
registerPadbotBrand();
|
|
65089
65187
|
|
|
65090
65188
|
// src/services/robot-fleet.service.ts
|
|
65189
|
+
var OUNITECH_REGION_BASE_URLS = [
|
|
65190
|
+
"https://app.frankfurt.robotcloud.top",
|
|
65191
|
+
"https://app.singapore.robotcloud.top",
|
|
65192
|
+
"https://app.robotcloud.top"
|
|
65193
|
+
];
|
|
65091
65194
|
var TIMESTAMP_OFFSET_CANDIDATES = [
|
|
65092
65195
|
{ offsetMinutes: 120, label: "UTC+2 (Frankfurt summer time)" },
|
|
65093
65196
|
{ offsetMinutes: 60, label: "UTC+1 (Frankfurt winter time)" },
|
|
@@ -65174,7 +65277,7 @@ function useRobotFleetService(deps) {
|
|
|
65174
65277
|
position: null,
|
|
65175
65278
|
planPosition: null,
|
|
65176
65279
|
fault: null,
|
|
65177
|
-
|
|
65280
|
+
...robotManifest(brand)
|
|
65178
65281
|
};
|
|
65179
65282
|
}
|
|
65180
65283
|
const fault = found.fault?.code ? found.fault : null;
|
|
@@ -65185,6 +65288,7 @@ function useRobotFleetService(deps) {
|
|
|
65185
65288
|
}
|
|
65186
65289
|
}
|
|
65187
65290
|
const free = found.mode === "IDLE" || found.mode === "CHARGED";
|
|
65291
|
+
const manifest = robotManifest(brand, found.model);
|
|
65188
65292
|
return {
|
|
65189
65293
|
id,
|
|
65190
65294
|
name: robot.name,
|
|
@@ -65197,7 +65301,7 @@ function useRobotFleetService(deps) {
|
|
|
65197
65301
|
dispatchable: (
|
|
65198
65302
|
// A faulted robot is not given a job however idle its mode reads. An
|
|
65199
65303
|
// alarm (smoke seen, door open) is not a machine fault: the patrol goes on.
|
|
65200
|
-
found.online && free && (!fault || fault.alarm === true) && commandSupported(
|
|
65304
|
+
found.online && free && (!fault || fault.alarm === true) && commandSupported(manifest.capabilities, "full")
|
|
65201
65305
|
),
|
|
65202
65306
|
batteryPercent: found.batteryPercent ?? null,
|
|
65203
65307
|
floorNo: found.floorNo ?? null,
|
|
@@ -65206,7 +65310,8 @@ function useRobotFleetService(deps) {
|
|
|
65206
65310
|
position: found.position ?? null,
|
|
65207
65311
|
planPosition: found.planPosition ?? null,
|
|
65208
65312
|
fault,
|
|
65209
|
-
capabilities:
|
|
65313
|
+
capabilities: manifest.capabilities,
|
|
65314
|
+
profile: manifest.profile
|
|
65210
65315
|
};
|
|
65211
65316
|
}
|
|
65212
65317
|
async function getMaps(robot) {
|
|
@@ -65256,6 +65361,9 @@ function useRobotFleetService(deps) {
|
|
|
65256
65361
|
return adapter.sendCommand(robotSn, command);
|
|
65257
65362
|
}
|
|
65258
65363
|
const state = await getFleetRobot(robot);
|
|
65364
|
+
if (!commandSupported(state.capabilities, command.kind)) {
|
|
65365
|
+
throw new BadRequestError136(`${state.profile.model || adapter.displayName} does not support "${command.kind}" through its API.`);
|
|
65366
|
+
}
|
|
65259
65367
|
if (command.kind === "pause" || command.kind === "resume" || command.kind === "cancel" || command.kind === "relocalize" || command.kind === "patrol-resume") {
|
|
65260
65368
|
const need = command.kind === "pause" ? "WORKING" : command.kind === "resume" ? "PAUSED" : null;
|
|
65261
65369
|
if (!state.online || need && state.mode !== need) {
|
|
@@ -65462,6 +65570,43 @@ function useRobotFleetService(deps) {
|
|
|
65462
65570
|
lastTimestampProbe.set(key, Date.now());
|
|
65463
65571
|
return { id, pair };
|
|
65464
65572
|
}
|
|
65573
|
+
async function probeRegions(robot) {
|
|
65574
|
+
const { id, pair } = probeGate(robot, "region");
|
|
65575
|
+
const hosts = [];
|
|
65576
|
+
for (const baseUrl of deps?.regionBaseUrls ?? OUNITECH_REGION_BASE_URLS) {
|
|
65577
|
+
try {
|
|
65578
|
+
const reply = await useRobotCloudService(pair, { ...deps?.cloudOptions, baseUrl }).getRobotListReply();
|
|
65579
|
+
const replyShape = {};
|
|
65580
|
+
for (const [k, v] of Object.entries(reply)) {
|
|
65581
|
+
replyShape[k] = Array.isArray(v) ? `list of ${v.length}` : v === null ? "null" : typeof v;
|
|
65582
|
+
}
|
|
65583
|
+
const list = Array.isArray(reply.robotList) ? reply.robotList : [];
|
|
65584
|
+
const robots = list.map((r) => ({
|
|
65585
|
+
robotSn: String(r?.robotSn ?? ""),
|
|
65586
|
+
robotName: String(r?.robotName ?? ""),
|
|
65587
|
+
online: r?.onlineFlag === true,
|
|
65588
|
+
statusName: String(r?.statusName ?? "")
|
|
65589
|
+
}));
|
|
65590
|
+
hosts.push({
|
|
65591
|
+
host: cloudHost(baseUrl),
|
|
65592
|
+
ok: true,
|
|
65593
|
+
detail: `Signed in. Lists ${robots.length} robot${robots.length === 1 ? "" : "s"}.`,
|
|
65594
|
+
replyShape,
|
|
65595
|
+
robots
|
|
65596
|
+
});
|
|
65597
|
+
} catch (e) {
|
|
65598
|
+
hosts.push({ host: cloudHost(baseUrl), ok: false, ...describeFailure(e) });
|
|
65599
|
+
}
|
|
65600
|
+
}
|
|
65601
|
+
const withRobots = hosts.filter((h) => h.robots?.length);
|
|
65602
|
+
return {
|
|
65603
|
+
robotId: id,
|
|
65604
|
+
configuredHost: cloudHost(deps?.cloudOptions?.baseUrl ?? ROBOT_CLOUD_BASE_URL),
|
|
65605
|
+
hosts,
|
|
65606
|
+
summary: withRobots.length ? `Robots found on ${withRobots.map((h) => `${h.host} (${h.robots.length})`).join(", ")}.` : hosts.some((h) => h.ok) ? "Signed in, but no region lists a robot for this AppID - Ounitech must bind the robot to this AppID's account." : "No region accepted this AppID.",
|
|
65607
|
+
checkedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
65608
|
+
};
|
|
65609
|
+
}
|
|
65465
65610
|
async function probeTimestampOffset(robot) {
|
|
65466
65611
|
const { id, pair } = probeGate(robot, "offset");
|
|
65467
65612
|
const baseUrl = deps?.cloudOptions?.baseUrl ?? ROBOT_CLOUD_BASE_URL;
|
|
@@ -65475,9 +65620,9 @@ function useRobotFleetService(deps) {
|
|
|
65475
65620
|
let accepted = null;
|
|
65476
65621
|
for (const c of [{ offsetMinutes: 0, label: "UTC (current)" }, ...TIMESTAMP_OFFSET_CANDIDATES]) {
|
|
65477
65622
|
const now = () => new Date(Date.now() + (skewMs ?? 0) + c.offsetMinutes * 6e4);
|
|
65478
|
-
const sent = robotCloudTimestamp(now(), "yyyyMMddHHmmss");
|
|
65623
|
+
const sent = robotCloudTimestamp(now(), "yyyyMMddHHmmss", "UTC");
|
|
65479
65624
|
try {
|
|
65480
|
-
const robots = await useRobotCloudService(pair, { ...deps?.cloudOptions, timestampFormat: "yyyyMMddHHmmss", now, onReply }).getRobots();
|
|
65625
|
+
const robots = await useRobotCloudService(pair, { ...deps?.cloudOptions, timestampFormat: "yyyyMMddHHmmss", timestampZone: "UTC", now, onReply }).getRobots();
|
|
65481
65626
|
attempts.push({ ...c, sent, ok: true, detail: `Accepted. The account lists ${robots.length} robot${robots.length === 1 ? "" : "s"}.` });
|
|
65482
65627
|
accepted = c.offsetMinutes;
|
|
65483
65628
|
break;
|
|
@@ -65531,6 +65676,7 @@ function useRobotFleetService(deps) {
|
|
|
65531
65676
|
diagnose,
|
|
65532
65677
|
probeTimestampFormat,
|
|
65533
65678
|
probeTimestampOffset,
|
|
65679
|
+
probeRegions,
|
|
65534
65680
|
getLiveVideo,
|
|
65535
65681
|
resolveAlerts,
|
|
65536
65682
|
getPatrolHistory,
|
|
@@ -68592,14 +68738,14 @@ function useRobotFleetController(deps) {
|
|
|
68592
68738
|
try {
|
|
68593
68739
|
await requirePlatformStaff(req, CROSS_CLIENT_GRANT);
|
|
68594
68740
|
const probe = req.query.probe;
|
|
68595
|
-
if (probe !== void 0 && probe !== "timestamp" && probe !== "timestamp-offset") {
|
|
68596
|
-
return fail(next, new BadRequestError139('probe must be "timestamp"
|
|
68741
|
+
if (probe !== void 0 && probe !== "timestamp" && probe !== "timestamp-offset" && probe !== "region") {
|
|
68742
|
+
return fail(next, new BadRequestError139('probe must be "timestamp", "timestamp-offset" or "region".'));
|
|
68597
68743
|
}
|
|
68598
68744
|
const robot = await entitleRobot(req, req.params.id);
|
|
68599
68745
|
res.set("Cache-Control", "no-store");
|
|
68600
68746
|
const fleet2 = getFleet2();
|
|
68601
68747
|
res.json(
|
|
68602
|
-
probe === "timestamp" ? await fleet2.probeTimestampFormat(robot) : probe === "timestamp-offset" ? await fleet2.probeTimestampOffset(robot) : await fleet2.diagnose(robot)
|
|
68748
|
+
probe === "timestamp" ? await fleet2.probeTimestampFormat(robot) : probe === "timestamp-offset" ? await fleet2.probeTimestampOffset(robot) : probe === "region" ? await fleet2.probeRegions(robot) : await fleet2.diagnose(robot)
|
|
68603
68749
|
);
|
|
68604
68750
|
} catch (error) {
|
|
68605
68751
|
fail(next, error);
|
|
@@ -69857,6 +70003,7 @@ async function readLiveItems(robots) {
|
|
|
69857
70003
|
planPosition: s.planPosition,
|
|
69858
70004
|
fault: s.fault,
|
|
69859
70005
|
capabilities: s.capabilities,
|
|
70006
|
+
profile: s.profile,
|
|
69860
70007
|
lastSeenAt: seen2 ? new Date(seen2) : null
|
|
69861
70008
|
});
|
|
69862
70009
|
} catch (e) {
|
|
@@ -104362,6 +104509,7 @@ export {
|
|
|
104362
104509
|
DEFAULT_SITE_TIMEZONE,
|
|
104363
104510
|
DEMO_ADD_MAX,
|
|
104364
104511
|
DEMO_BRAND,
|
|
104512
|
+
DEMO_BRAND_DEFINITION,
|
|
104365
104513
|
DEMO_CAPABILITIES,
|
|
104366
104514
|
DEMO_FAULT_ROBOT,
|
|
104367
104515
|
DEMO_ROUTES,
|
|
@@ -104527,20 +104675,27 @@ export {
|
|
|
104527
104675
|
ORG_OWNER_REPAIR_DEFAULT,
|
|
104528
104676
|
ORG_OWNER_REPAIR_OFF_REASON,
|
|
104529
104677
|
OUNITECH_BRAND,
|
|
104678
|
+
OUNITECH_BRAND_DEFINITION,
|
|
104530
104679
|
OUNITECH_CAPABILITIES,
|
|
104531
104680
|
OUNITECH_PENDING_COMMANDS,
|
|
104681
|
+
OUNITECH_REGION_BASE_URLS,
|
|
104532
104682
|
OUNITECH_TIMESTAMP_FORMAT,
|
|
104683
|
+
OUNITECH_TIMESTAMP_ZONE,
|
|
104533
104684
|
OpenRmfError,
|
|
104534
104685
|
OrgNature,
|
|
104535
104686
|
OvernightParkingRequestSort,
|
|
104536
104687
|
OvernightParkingRequestStatus,
|
|
104537
104688
|
PADBOT_ACTION_TEXT,
|
|
104689
|
+
PADBOT_ALARMS,
|
|
104538
104690
|
PADBOT_ALARM_POLL_MS,
|
|
104539
104691
|
PADBOT_ALARM_TEXT,
|
|
104540
104692
|
PADBOT_BRAND,
|
|
104693
|
+
PADBOT_BRAND_DEFINITION,
|
|
104541
104694
|
PADBOT_CAPABILITIES,
|
|
104542
104695
|
PADBOT_DISPLAY_NAME,
|
|
104543
104696
|
PADBOT_LIVE_POSE_MS,
|
|
104697
|
+
PADBOT_MAKER_APP_ONLY,
|
|
104698
|
+
PADBOT_MODELS,
|
|
104544
104699
|
PADBOT_MOTION,
|
|
104545
104700
|
PADBOT_MQTT_SYNC_MS,
|
|
104546
104701
|
PADBOT_ONLINE_WINDOW_MS,
|
|
@@ -104970,6 +105125,7 @@ export {
|
|
|
104970
105125
|
robotCloudTimestamp,
|
|
104971
105126
|
robotCredentialsKey,
|
|
104972
105127
|
robotFaultSweepConfig,
|
|
105128
|
+
robotManifest,
|
|
104973
105129
|
robotMode,
|
|
104974
105130
|
robotModeFromList,
|
|
104975
105131
|
robotSchema,
|