@7365admin1/core 3.122.0 → 3.122.2
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 +12 -0
- package/dist/index.d.ts +49 -1
- package/dist/index.js +46 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/test/padbot.test.mjs +62 -0
- package/test/robot-model-manifest.test.mjs +3 -4
package/package.json
CHANGED
package/test/padbot.test.mjs
CHANGED
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
padbotPatrolRecord,
|
|
24
24
|
padbotCheckpointVisit,
|
|
25
25
|
padbotPlanShare,
|
|
26
|
+
padbotCurrentMap,
|
|
26
27
|
statesByType,
|
|
27
28
|
} from "./.build/services/padbot.adapter.mjs";
|
|
28
29
|
import { commandSupported, normalisePatrolPlan, robotTier } from "./.build/utils/robot-adapter.util.mjs";
|
|
@@ -578,3 +579,64 @@ test("adapter listRobots: the account's patrol robots with one batched state rea
|
|
|
578
579
|
assert.deepEqual(f.calls.find((c) => c.path === PADBOT_PATHS.states).body.serialNumbers, ["PS0001", "PS0002"]);
|
|
579
580
|
assert.equal(f.calls.filter((c) => c.path === PADBOT_PATHS.states).length, 1);
|
|
580
581
|
});
|
|
582
|
+
|
|
583
|
+
/* ---- real S2 reply shapes (prod Diagnose 2026-09-26, map ids kept, no credentials) ---- */
|
|
584
|
+
|
|
585
|
+
const S2_LVL3 = "40f18c40a12ee2f3c0b20b38dc7a5b0f";
|
|
586
|
+
const S2_MAPS = [
|
|
587
|
+
{ mapId: "24fe9c97e9160548d100dab541f1662a", mapName: "20260528172106098_5ecd8fa9", mapDisplayName: "B1", building: "", floor: 1, isDefault: false, width: 1092, height: 1865, resolution: 0.05, originX: -27.55, originY: -80, mapGroup: "" },
|
|
588
|
+
{ mapId: S2_LVL3, mapName: "772df9dc808b45a5_20260924185244234", mapDisplayName: "Lvl3 Office", building: "", floor: 3, isDefault: true, width: 255, height: 244, resolution: 0.05, originX: -24.7, originY: -2.3, mapGroup: "" },
|
|
589
|
+
];
|
|
590
|
+
const s2States = (mapId = S2_LVL3) => [
|
|
591
|
+
{
|
|
592
|
+
serialNumber: "PS8517",
|
|
593
|
+
states: [
|
|
594
|
+
{ stateType: "1000", data: { updatedAt: fresh } },
|
|
595
|
+
{ stateType: "1001", data: { updatedAt: fresh, batteryPercent: 100 } },
|
|
596
|
+
{ stateType: "1002", data: { updatedAt: fresh, chargingState: 2 } },
|
|
597
|
+
{ stateType: "1003", data: { updatedAt: fresh, mapName: null, nextTargetPointName: null, finalTargetPointName: null, actionType: 0, actionState: 0, message: null } },
|
|
598
|
+
{ stateType: "1007", data: { updatedAt: "2026-09-24T10:52:45.143Z", mapId, floor: 3, mapDisplayName: "Lvl3 Office", width: 255, height: 244 } },
|
|
599
|
+
{ stateType: "1010", data: { updatedAt: fresh, workState: 0, taskType: 0, taskInfo: null } },
|
|
600
|
+
],
|
|
601
|
+
},
|
|
602
|
+
];
|
|
603
|
+
const s2Robot = (location, mapId) => {
|
|
604
|
+
clearPadbotCache();
|
|
605
|
+
const f = fakePadbot({
|
|
606
|
+
[PADBOT_PATHS.states]: () => s2States(mapId),
|
|
607
|
+
[PADBOT_PATHS.robots]: () => [{ serialNumber: "PS8517", robotName: "HERO-OTH-SECURITY", robotType: "PATROL", robotModel: "S2" }],
|
|
608
|
+
[PADBOT_PATHS.location]: () => location,
|
|
609
|
+
[PADBOT_PATHS.maps]: () => S2_MAPS,
|
|
610
|
+
[PADBOT_PATHS.alarms]: () => ({ items: [], totalItems: 0, totalPages: 0 }),
|
|
611
|
+
});
|
|
612
|
+
return createPadbotAdapter(CREDS, { baseUrl: "https://pb.test", fetch: f.fetch, now: f.now }).getRobot("PS8517");
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
test("real S2: coordinates on Lvl3 -> pin on Lvl3, mapId reported", async () => {
|
|
616
|
+
const r = await s2Robot({ mapId: S2_LVL3, worldX: -13.9, worldY: 8.79, yaw: -94 });
|
|
617
|
+
assert.equal(r.mapId, S2_LVL3);
|
|
618
|
+
assert.deepEqual(r.planPosition, padbotPlanShare(S2_MAPS[1], -13.9, 8.79));
|
|
619
|
+
assert.ok(r.planPosition, "inside the Lvl3 image");
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
test("real S2: PadBot's null worldX/worldY -> no pin, but the map is still known", async () => {
|
|
623
|
+
const r = await s2Robot({ mapId: S2_LVL3, worldX: null, worldY: null, yaw: -94 });
|
|
624
|
+
assert.equal(r.position, null);
|
|
625
|
+
assert.equal(r.mapId, S2_LVL3, "the map selector can still say 'Robot is here'");
|
|
626
|
+
assert.match(r.statusName, /Position not reported$/);
|
|
627
|
+
});
|
|
628
|
+
|
|
629
|
+
test("real S2: an unlisted or missing map id falls back to the robot's floor map, the pin is kept", async () => {
|
|
630
|
+
const r = await s2Robot({ worldX: -13.9, worldY: 8.79, yaw: -94 }, "not-in-the-list");
|
|
631
|
+
assert.equal(r.mapId, S2_LVL3);
|
|
632
|
+
assert.ok(r.planPosition);
|
|
633
|
+
assert.equal(padbotCurrentMap(S2_MAPS, [null, "x"], 1).mapId, S2_MAPS[0].mapId);
|
|
634
|
+
assert.equal(padbotCurrentMap([...S2_MAPS, { ...S2_MAPS[1], mapId: "other-l3" }], ["x"], 3), null, "two maps on one floor: no guess");
|
|
635
|
+
});
|
|
636
|
+
|
|
637
|
+
test("/robots/states row carries mapId (the map screens draw the pin only on the robot's map)", async () => {
|
|
638
|
+
const { fleetStateItem } = await import("./.build/services/robot-fleet.service.mjs");
|
|
639
|
+
const row = fleetStateItem("r1", { online: true, mode: "IDLE", statusName: "Standing by", model: "PadBot S2", batteryPercent: 100, floorNo: 3, floorKnown: true, mapId: S2_LVL3, position: null, planPosition: null, fault: null, capabilities: {}, profile: {} });
|
|
640
|
+
assert.equal(row.mapId, S2_LVL3);
|
|
641
|
+
assert.equal(fleetStateItem("r2", { mapId: undefined }).mapId, null);
|
|
642
|
+
});
|
|
@@ -52,7 +52,7 @@ test("Ounitech: no model reported, one manifest for Q3-G and Q3-W; Basic control
|
|
|
52
52
|
assert.deepEqual(profile.alarms, []);
|
|
53
53
|
});
|
|
54
54
|
|
|
55
|
-
test("Demo: models differ - S1 full, CX-1 no point commands
|
|
55
|
+
test("Demo: models differ - S1 and SP-1 full, CX-1 no point commands", () => {
|
|
56
56
|
const s1 = robotManifest("demo", "Demo S1").capabilities;
|
|
57
57
|
const cx = robotManifest("demo", "Demo CX-1");
|
|
58
58
|
const sp = robotManifest("demo", "Demo SP-1").capabilities;
|
|
@@ -62,8 +62,7 @@ test("Demo: models differ - S1 full, CX-1 no point commands, SP-1 no spot clean"
|
|
|
62
62
|
assert.equal(cx.capabilities.navigateToPoint, false);
|
|
63
63
|
assert.equal(commandSupported(cx.capabilities, "relocalize"), false);
|
|
64
64
|
assert.equal(commandSupported(cx.capabilities, "full"), true);
|
|
65
|
-
assert.equal(sp
|
|
66
|
-
assert.equal(sp.navigateToPoint, true);
|
|
65
|
+
assert.equal(robotTier(sp), "full-control", "the demo patroller keeps its Full control badge");
|
|
67
66
|
});
|
|
68
67
|
|
|
69
68
|
test("unknown brand: nothing claimed", () => {
|
|
@@ -80,5 +79,5 @@ test("brand list carries each model's resolved manifest", () => {
|
|
|
80
79
|
assert.equal(padbot.models[0].capabilities.thermalCamera, true);
|
|
81
80
|
assert.equal(padbot.capabilities.thermalCamera, false);
|
|
82
81
|
const demo = registeredRobotBrands().find((b) => b.brand === "demo");
|
|
83
|
-
assert.deepEqual(demo.models.map((m) => m.name), ["Demo CX-1"
|
|
82
|
+
assert.deepEqual(demo.models.map((m) => m.name), ["Demo CX-1"]);
|
|
84
83
|
});
|