@7365admin1/core 3.121.0 → 3.122.1
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 +13 -0
- package/dist/index.d.ts +126 -15
- package/dist/index.js +213 -49
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +204 -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 +83 -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,21 @@ 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
|
+
// A simulated model, so a demo fleet shows a mixed fleet's controls: the
|
|
63243
|
+
// compact CX-1 takes jobs but no point commands. (No SP-1 profile: the
|
|
63244
|
+
// capability badge counts spot clean, so removing it would drop the demo
|
|
63245
|
+
// patrollers from Full to Basic control for a control they never show.)
|
|
63246
|
+
models: [{ name: "Demo CX-1", codes: ["CX-1"], capabilities: { spotClean: false, navigateToPoint: false, relocalize: false } }],
|
|
63247
|
+
create: () => createDemoAdapter()
|
|
63248
|
+
};
|
|
63181
63249
|
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
|
-
});
|
|
63250
|
+
registerRobotBrand(DEMO_BRAND_DEFINITION);
|
|
63190
63251
|
}
|
|
63191
63252
|
registerDemoBrand();
|
|
63192
63253
|
|
|
@@ -64452,11 +64513,44 @@ var PADBOT_CAPABILITIES = {
|
|
|
64452
64513
|
// §6.7 / §6.8
|
|
64453
64514
|
resolveAlerts: true,
|
|
64454
64515
|
// §6.6
|
|
64455
|
-
//
|
|
64456
|
-
|
|
64457
|
-
|
|
64458
|
-
|
|
64516
|
+
// Model-specific (see PADBOT_MODELS): the drive limits are the S2's head range,
|
|
64517
|
+
// and a heat camera is the S2's - another PadBot patrol model gets neither.
|
|
64518
|
+
manualDrive: false,
|
|
64519
|
+
thermalCamera: false
|
|
64459
64520
|
};
|
|
64521
|
+
var PADBOT_ALARMS = [
|
|
64522
|
+
"person",
|
|
64523
|
+
"high temperature",
|
|
64524
|
+
"smoke",
|
|
64525
|
+
"debris",
|
|
64526
|
+
"noise",
|
|
64527
|
+
"water on the floor",
|
|
64528
|
+
"person falling",
|
|
64529
|
+
"door open",
|
|
64530
|
+
"window open",
|
|
64531
|
+
"fire-fighting equipment"
|
|
64532
|
+
];
|
|
64533
|
+
var PADBOT_MAKER_APP_ONLY = [
|
|
64534
|
+
"patrol schedules",
|
|
64535
|
+
"maps, points and routes",
|
|
64536
|
+
"alarm thresholds and AI recognition",
|
|
64537
|
+
"lights and voice announcements",
|
|
64538
|
+
"recorded video"
|
|
64539
|
+
];
|
|
64540
|
+
var PADBOT_MODELS = [
|
|
64541
|
+
{
|
|
64542
|
+
name: "PadBot S2",
|
|
64543
|
+
codes: ["S2"],
|
|
64544
|
+
makerAppOnly: [...PADBOT_MAKER_APP_ONLY, "live thermal view"],
|
|
64545
|
+
capabilities: {
|
|
64546
|
+
thermalCamera: true,
|
|
64547
|
+
// §8.1 over MQTT, behind the server's drive watchdog; only with PADBOT_MANUAL_DRIVE=on.
|
|
64548
|
+
get manualDrive() {
|
|
64549
|
+
return padbotManualDriveEnabled();
|
|
64550
|
+
}
|
|
64551
|
+
}
|
|
64552
|
+
}
|
|
64553
|
+
];
|
|
64460
64554
|
var PADBOT_PATHS = {
|
|
64461
64555
|
robots: "/api/v1/robots/list",
|
|
64462
64556
|
states: "/api/v1/robots/states/list",
|
|
@@ -65076,18 +65170,26 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
65076
65170
|
}
|
|
65077
65171
|
};
|
|
65078
65172
|
}
|
|
65173
|
+
var PADBOT_BRAND_DEFINITION = {
|
|
65174
|
+
brand: PADBOT_BRAND,
|
|
65175
|
+
displayName: PADBOT_DISPLAY_NAME,
|
|
65176
|
+
capabilities: PADBOT_CAPABILITIES,
|
|
65177
|
+
types: ["security"],
|
|
65178
|
+
info: { alarms: [...PADBOT_ALARMS], makerApp: "the PadBot app", makerAppOnly: [...PADBOT_MAKER_APP_ONLY] },
|
|
65179
|
+
models: PADBOT_MODELS,
|
|
65180
|
+
create: (credentials) => createPadbotAdapter(credentials)
|
|
65181
|
+
};
|
|
65079
65182
|
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
|
-
});
|
|
65183
|
+
registerRobotBrand(PADBOT_BRAND_DEFINITION);
|
|
65087
65184
|
}
|
|
65088
65185
|
registerPadbotBrand();
|
|
65089
65186
|
|
|
65090
65187
|
// src/services/robot-fleet.service.ts
|
|
65188
|
+
var OUNITECH_REGION_BASE_URLS = [
|
|
65189
|
+
"https://app.frankfurt.robotcloud.top",
|
|
65190
|
+
"https://app.singapore.robotcloud.top",
|
|
65191
|
+
"https://app.robotcloud.top"
|
|
65192
|
+
];
|
|
65091
65193
|
var TIMESTAMP_OFFSET_CANDIDATES = [
|
|
65092
65194
|
{ offsetMinutes: 120, label: "UTC+2 (Frankfurt summer time)" },
|
|
65093
65195
|
{ offsetMinutes: 60, label: "UTC+1 (Frankfurt winter time)" },
|
|
@@ -65174,7 +65276,7 @@ function useRobotFleetService(deps) {
|
|
|
65174
65276
|
position: null,
|
|
65175
65277
|
planPosition: null,
|
|
65176
65278
|
fault: null,
|
|
65177
|
-
|
|
65279
|
+
...robotManifest(brand)
|
|
65178
65280
|
};
|
|
65179
65281
|
}
|
|
65180
65282
|
const fault = found.fault?.code ? found.fault : null;
|
|
@@ -65185,6 +65287,7 @@ function useRobotFleetService(deps) {
|
|
|
65185
65287
|
}
|
|
65186
65288
|
}
|
|
65187
65289
|
const free = found.mode === "IDLE" || found.mode === "CHARGED";
|
|
65290
|
+
const manifest = robotManifest(brand, found.model);
|
|
65188
65291
|
return {
|
|
65189
65292
|
id,
|
|
65190
65293
|
name: robot.name,
|
|
@@ -65197,7 +65300,7 @@ function useRobotFleetService(deps) {
|
|
|
65197
65300
|
dispatchable: (
|
|
65198
65301
|
// A faulted robot is not given a job however idle its mode reads. An
|
|
65199
65302
|
// alarm (smoke seen, door open) is not a machine fault: the patrol goes on.
|
|
65200
|
-
found.online && free && (!fault || fault.alarm === true) && commandSupported(
|
|
65303
|
+
found.online && free && (!fault || fault.alarm === true) && commandSupported(manifest.capabilities, "full")
|
|
65201
65304
|
),
|
|
65202
65305
|
batteryPercent: found.batteryPercent ?? null,
|
|
65203
65306
|
floorNo: found.floorNo ?? null,
|
|
@@ -65206,7 +65309,8 @@ function useRobotFleetService(deps) {
|
|
|
65206
65309
|
position: found.position ?? null,
|
|
65207
65310
|
planPosition: found.planPosition ?? null,
|
|
65208
65311
|
fault,
|
|
65209
|
-
capabilities:
|
|
65312
|
+
capabilities: manifest.capabilities,
|
|
65313
|
+
profile: manifest.profile
|
|
65210
65314
|
};
|
|
65211
65315
|
}
|
|
65212
65316
|
async function getMaps(robot) {
|
|
@@ -65256,6 +65360,9 @@ function useRobotFleetService(deps) {
|
|
|
65256
65360
|
return adapter.sendCommand(robotSn, command);
|
|
65257
65361
|
}
|
|
65258
65362
|
const state = await getFleetRobot(robot);
|
|
65363
|
+
if (!commandSupported(state.capabilities, command.kind)) {
|
|
65364
|
+
throw new BadRequestError136(`${state.profile.model || adapter.displayName} does not support "${command.kind}" through its API.`);
|
|
65365
|
+
}
|
|
65259
65366
|
if (command.kind === "pause" || command.kind === "resume" || command.kind === "cancel" || command.kind === "relocalize" || command.kind === "patrol-resume") {
|
|
65260
65367
|
const need = command.kind === "pause" ? "WORKING" : command.kind === "resume" ? "PAUSED" : null;
|
|
65261
65368
|
if (!state.online || need && state.mode !== need) {
|
|
@@ -65462,6 +65569,43 @@ function useRobotFleetService(deps) {
|
|
|
65462
65569
|
lastTimestampProbe.set(key, Date.now());
|
|
65463
65570
|
return { id, pair };
|
|
65464
65571
|
}
|
|
65572
|
+
async function probeRegions(robot) {
|
|
65573
|
+
const { id, pair } = probeGate(robot, "region");
|
|
65574
|
+
const hosts = [];
|
|
65575
|
+
for (const baseUrl of deps?.regionBaseUrls ?? OUNITECH_REGION_BASE_URLS) {
|
|
65576
|
+
try {
|
|
65577
|
+
const reply = await useRobotCloudService(pair, { ...deps?.cloudOptions, baseUrl }).getRobotListReply();
|
|
65578
|
+
const replyShape = {};
|
|
65579
|
+
for (const [k, v] of Object.entries(reply)) {
|
|
65580
|
+
replyShape[k] = Array.isArray(v) ? `list of ${v.length}` : v === null ? "null" : typeof v;
|
|
65581
|
+
}
|
|
65582
|
+
const list = Array.isArray(reply.robotList) ? reply.robotList : [];
|
|
65583
|
+
const robots = list.map((r) => ({
|
|
65584
|
+
robotSn: String(r?.robotSn ?? ""),
|
|
65585
|
+
robotName: String(r?.robotName ?? ""),
|
|
65586
|
+
online: r?.onlineFlag === true,
|
|
65587
|
+
statusName: String(r?.statusName ?? "")
|
|
65588
|
+
}));
|
|
65589
|
+
hosts.push({
|
|
65590
|
+
host: cloudHost(baseUrl),
|
|
65591
|
+
ok: true,
|
|
65592
|
+
detail: `Signed in. Lists ${robots.length} robot${robots.length === 1 ? "" : "s"}.`,
|
|
65593
|
+
replyShape,
|
|
65594
|
+
robots
|
|
65595
|
+
});
|
|
65596
|
+
} catch (e) {
|
|
65597
|
+
hosts.push({ host: cloudHost(baseUrl), ok: false, ...describeFailure(e) });
|
|
65598
|
+
}
|
|
65599
|
+
}
|
|
65600
|
+
const withRobots = hosts.filter((h) => h.robots?.length);
|
|
65601
|
+
return {
|
|
65602
|
+
robotId: id,
|
|
65603
|
+
configuredHost: cloudHost(deps?.cloudOptions?.baseUrl ?? ROBOT_CLOUD_BASE_URL),
|
|
65604
|
+
hosts,
|
|
65605
|
+
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.",
|
|
65606
|
+
checkedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
65607
|
+
};
|
|
65608
|
+
}
|
|
65465
65609
|
async function probeTimestampOffset(robot) {
|
|
65466
65610
|
const { id, pair } = probeGate(robot, "offset");
|
|
65467
65611
|
const baseUrl = deps?.cloudOptions?.baseUrl ?? ROBOT_CLOUD_BASE_URL;
|
|
@@ -65475,9 +65619,9 @@ function useRobotFleetService(deps) {
|
|
|
65475
65619
|
let accepted = null;
|
|
65476
65620
|
for (const c of [{ offsetMinutes: 0, label: "UTC (current)" }, ...TIMESTAMP_OFFSET_CANDIDATES]) {
|
|
65477
65621
|
const now = () => new Date(Date.now() + (skewMs ?? 0) + c.offsetMinutes * 6e4);
|
|
65478
|
-
const sent = robotCloudTimestamp(now(), "yyyyMMddHHmmss");
|
|
65622
|
+
const sent = robotCloudTimestamp(now(), "yyyyMMddHHmmss", "UTC");
|
|
65479
65623
|
try {
|
|
65480
|
-
const robots = await useRobotCloudService(pair, { ...deps?.cloudOptions, timestampFormat: "yyyyMMddHHmmss", now, onReply }).getRobots();
|
|
65624
|
+
const robots = await useRobotCloudService(pair, { ...deps?.cloudOptions, timestampFormat: "yyyyMMddHHmmss", timestampZone: "UTC", now, onReply }).getRobots();
|
|
65481
65625
|
attempts.push({ ...c, sent, ok: true, detail: `Accepted. The account lists ${robots.length} robot${robots.length === 1 ? "" : "s"}.` });
|
|
65482
65626
|
accepted = c.offsetMinutes;
|
|
65483
65627
|
break;
|
|
@@ -65531,6 +65675,7 @@ function useRobotFleetService(deps) {
|
|
|
65531
65675
|
diagnose,
|
|
65532
65676
|
probeTimestampFormat,
|
|
65533
65677
|
probeTimestampOffset,
|
|
65678
|
+
probeRegions,
|
|
65534
65679
|
getLiveVideo,
|
|
65535
65680
|
resolveAlerts,
|
|
65536
65681
|
getPatrolHistory,
|
|
@@ -68592,14 +68737,14 @@ function useRobotFleetController(deps) {
|
|
|
68592
68737
|
try {
|
|
68593
68738
|
await requirePlatformStaff(req, CROSS_CLIENT_GRANT);
|
|
68594
68739
|
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"
|
|
68740
|
+
if (probe !== void 0 && probe !== "timestamp" && probe !== "timestamp-offset" && probe !== "region") {
|
|
68741
|
+
return fail(next, new BadRequestError139('probe must be "timestamp", "timestamp-offset" or "region".'));
|
|
68597
68742
|
}
|
|
68598
68743
|
const robot = await entitleRobot(req, req.params.id);
|
|
68599
68744
|
res.set("Cache-Control", "no-store");
|
|
68600
68745
|
const fleet2 = getFleet2();
|
|
68601
68746
|
res.json(
|
|
68602
|
-
probe === "timestamp" ? await fleet2.probeTimestampFormat(robot) : probe === "timestamp-offset" ? await fleet2.probeTimestampOffset(robot) : await fleet2.diagnose(robot)
|
|
68747
|
+
probe === "timestamp" ? await fleet2.probeTimestampFormat(robot) : probe === "timestamp-offset" ? await fleet2.probeTimestampOffset(robot) : probe === "region" ? await fleet2.probeRegions(robot) : await fleet2.diagnose(robot)
|
|
68603
68748
|
);
|
|
68604
68749
|
} catch (error) {
|
|
68605
68750
|
fail(next, error);
|
|
@@ -69857,6 +70002,7 @@ async function readLiveItems(robots) {
|
|
|
69857
70002
|
planPosition: s.planPosition,
|
|
69858
70003
|
fault: s.fault,
|
|
69859
70004
|
capabilities: s.capabilities,
|
|
70005
|
+
profile: s.profile,
|
|
69860
70006
|
lastSeenAt: seen2 ? new Date(seen2) : null
|
|
69861
70007
|
});
|
|
69862
70008
|
} catch (e) {
|
|
@@ -104362,6 +104508,7 @@ export {
|
|
|
104362
104508
|
DEFAULT_SITE_TIMEZONE,
|
|
104363
104509
|
DEMO_ADD_MAX,
|
|
104364
104510
|
DEMO_BRAND,
|
|
104511
|
+
DEMO_BRAND_DEFINITION,
|
|
104365
104512
|
DEMO_CAPABILITIES,
|
|
104366
104513
|
DEMO_FAULT_ROBOT,
|
|
104367
104514
|
DEMO_ROUTES,
|
|
@@ -104527,20 +104674,27 @@ export {
|
|
|
104527
104674
|
ORG_OWNER_REPAIR_DEFAULT,
|
|
104528
104675
|
ORG_OWNER_REPAIR_OFF_REASON,
|
|
104529
104676
|
OUNITECH_BRAND,
|
|
104677
|
+
OUNITECH_BRAND_DEFINITION,
|
|
104530
104678
|
OUNITECH_CAPABILITIES,
|
|
104531
104679
|
OUNITECH_PENDING_COMMANDS,
|
|
104680
|
+
OUNITECH_REGION_BASE_URLS,
|
|
104532
104681
|
OUNITECH_TIMESTAMP_FORMAT,
|
|
104682
|
+
OUNITECH_TIMESTAMP_ZONE,
|
|
104533
104683
|
OpenRmfError,
|
|
104534
104684
|
OrgNature,
|
|
104535
104685
|
OvernightParkingRequestSort,
|
|
104536
104686
|
OvernightParkingRequestStatus,
|
|
104537
104687
|
PADBOT_ACTION_TEXT,
|
|
104688
|
+
PADBOT_ALARMS,
|
|
104538
104689
|
PADBOT_ALARM_POLL_MS,
|
|
104539
104690
|
PADBOT_ALARM_TEXT,
|
|
104540
104691
|
PADBOT_BRAND,
|
|
104692
|
+
PADBOT_BRAND_DEFINITION,
|
|
104541
104693
|
PADBOT_CAPABILITIES,
|
|
104542
104694
|
PADBOT_DISPLAY_NAME,
|
|
104543
104695
|
PADBOT_LIVE_POSE_MS,
|
|
104696
|
+
PADBOT_MAKER_APP_ONLY,
|
|
104697
|
+
PADBOT_MODELS,
|
|
104544
104698
|
PADBOT_MOTION,
|
|
104545
104699
|
PADBOT_MQTT_SYNC_MS,
|
|
104546
104700
|
PADBOT_ONLINE_WINDOW_MS,
|
|
@@ -104970,6 +105124,7 @@ export {
|
|
|
104970
105124
|
robotCloudTimestamp,
|
|
104971
105125
|
robotCredentialsKey,
|
|
104972
105126
|
robotFaultSweepConfig,
|
|
105127
|
+
robotManifest,
|
|
104973
105128
|
robotMode,
|
|
104974
105129
|
robotModeFromList,
|
|
104975
105130
|
robotSchema,
|