@7365admin1/core 3.131.1 → 3.133.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.d.ts +182 -4
- package/dist/index.js +571 -118
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +559 -118
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/test/e2e/robot-ounitech-company-creds.e2e.test.mjs +3 -1
- package/test/e2e/robot-vendor-errors.e2e.test.mjs +2 -2
- package/test/ounitech-api-2025-10.test.mjs +224 -10
- package/test/robot-vendor-errors.test.mjs +3 -0
package/dist/index.mjs
CHANGED
|
@@ -2237,10 +2237,10 @@ function useOccurrenceEntryRepo() {
|
|
|
2237
2237
|
const cacheKey = makeCacheKey3(namespace_collection3, {
|
|
2238
2238
|
dailyOccurrenceBookId
|
|
2239
2239
|
});
|
|
2240
|
-
const
|
|
2241
|
-
if (
|
|
2240
|
+
const cached4 = await getCache(cacheKey);
|
|
2241
|
+
if (cached4) {
|
|
2242
2242
|
logger5.info(`Cache hit for key: ${cacheKey}`);
|
|
2243
|
-
return
|
|
2243
|
+
return cached4;
|
|
2244
2244
|
}
|
|
2245
2245
|
const bookId = typeof dailyOccurrenceBookId === "string" ? new ObjectId9(dailyOccurrenceBookId) : dailyOccurrenceBookId;
|
|
2246
2246
|
const data = await collection.findOne(
|
|
@@ -17963,13 +17963,13 @@ function useFileRepo() {
|
|
|
17963
17963
|
}
|
|
17964
17964
|
const cacheKey = makeCacheKey14(namespace_collection3, { _id: String(_id) });
|
|
17965
17965
|
try {
|
|
17966
|
-
const
|
|
17967
|
-
if (
|
|
17966
|
+
const cached4 = await getCache(cacheKey);
|
|
17967
|
+
if (cached4) {
|
|
17968
17968
|
logger30.log({
|
|
17969
17969
|
level: "info",
|
|
17970
17970
|
message: `Cache hit for getById file: ${cacheKey}`
|
|
17971
17971
|
});
|
|
17972
|
-
return
|
|
17972
|
+
return cached4;
|
|
17973
17973
|
}
|
|
17974
17974
|
const result = await collection.findOne({
|
|
17975
17975
|
_id
|
|
@@ -22065,9 +22065,9 @@ function useCameraViewService() {
|
|
|
22065
22065
|
async function refreshProbe(target, channel) {
|
|
22066
22066
|
if (!target?.enabled)
|
|
22067
22067
|
return null;
|
|
22068
|
-
const
|
|
22069
|
-
if (
|
|
22070
|
-
return
|
|
22068
|
+
const cached4 = await cachedProbe(target, channel);
|
|
22069
|
+
if (cached4)
|
|
22070
|
+
return cached4;
|
|
22071
22071
|
const probe = await probeDeviceCapabilities({
|
|
22072
22072
|
adapter: createDeviceHttpAdapter({ target, budget: authBudget }),
|
|
22073
22073
|
channel
|
|
@@ -22438,9 +22438,9 @@ function useCameraViewService() {
|
|
|
22438
22438
|
};
|
|
22439
22439
|
}
|
|
22440
22440
|
const cacheKey = `device:${resolved.device.host}:${resolved.device.port}`;
|
|
22441
|
-
const
|
|
22442
|
-
const reachable = typeof
|
|
22443
|
-
if (typeof
|
|
22441
|
+
const cached4 = await getCache(cacheKey);
|
|
22442
|
+
const reachable = typeof cached4 === "boolean" ? cached4 : await probeDevice(resolved.device);
|
|
22443
|
+
if (typeof cached4 !== "boolean") {
|
|
22444
22444
|
setCache(cacheKey, reachable, cacheSeconds).catch(
|
|
22445
22445
|
(error) => logger33.info(`Camera device health cache write failed: ${error?.message}`)
|
|
22446
22446
|
);
|
|
@@ -22473,10 +22473,10 @@ function useCameraViewService() {
|
|
|
22473
22473
|
const subtype = knownNoSubStream ? 0 : wanted;
|
|
22474
22474
|
const fellBackFromCache = subtype !== wanted;
|
|
22475
22475
|
const cacheKey = `snapshot:${params.cameraId}:${subtype}`;
|
|
22476
|
-
const
|
|
22477
|
-
if (
|
|
22476
|
+
const cached4 = await getCache(cacheKey);
|
|
22477
|
+
if (cached4) {
|
|
22478
22478
|
return {
|
|
22479
|
-
buffer: Buffer.from(
|
|
22479
|
+
buffer: Buffer.from(cached4, "base64"),
|
|
22480
22480
|
cached: true,
|
|
22481
22481
|
stream: subtype === 0 ? "main" : "sub",
|
|
22482
22482
|
fellBackToMain: fellBackFromCache
|
|
@@ -22566,9 +22566,9 @@ function useCameraViewService() {
|
|
|
22566
22566
|
};
|
|
22567
22567
|
}
|
|
22568
22568
|
const cacheKey = `device:${resolved.device.host}:${resolved.device.port}`;
|
|
22569
|
-
const
|
|
22570
|
-
const reachable = typeof
|
|
22571
|
-
if (typeof
|
|
22569
|
+
const cached4 = await getCache(cacheKey);
|
|
22570
|
+
const reachable = typeof cached4 === "boolean" ? cached4 : await probeDevice(resolved.device);
|
|
22571
|
+
if (typeof cached4 !== "boolean") {
|
|
22572
22572
|
setCache(cacheKey, reachable, DEVICE_HEALTH_CACHE_SECONDS).catch(
|
|
22573
22573
|
(error) => logger33.info(`Camera device health cache write failed: ${error?.message}`)
|
|
22574
22574
|
);
|
|
@@ -25839,13 +25839,13 @@ function usePersonRepo() {
|
|
|
25839
25839
|
_id: String(_id)
|
|
25840
25840
|
});
|
|
25841
25841
|
try {
|
|
25842
|
-
const
|
|
25843
|
-
if (
|
|
25842
|
+
const cached4 = await getCache(cacheKey);
|
|
25843
|
+
if (cached4) {
|
|
25844
25844
|
logger39.log({
|
|
25845
25845
|
level: "info",
|
|
25846
25846
|
message: `Cache hit for getById person: ${cacheKey}`
|
|
25847
25847
|
});
|
|
25848
|
-
return
|
|
25848
|
+
return cached4;
|
|
25849
25849
|
}
|
|
25850
25850
|
const result = await collection.findOne({
|
|
25851
25851
|
_id
|
|
@@ -26271,13 +26271,13 @@ function usePersonRepo() {
|
|
|
26271
26271
|
user: userId
|
|
26272
26272
|
});
|
|
26273
26273
|
try {
|
|
26274
|
-
const
|
|
26275
|
-
if (
|
|
26274
|
+
const cached4 = await getCache(cacheKey);
|
|
26275
|
+
if (cached4) {
|
|
26276
26276
|
logger39.log({
|
|
26277
26277
|
level: "info",
|
|
26278
26278
|
message: `Cache hit for getByUserId person: ${cacheKey}`
|
|
26279
26279
|
});
|
|
26280
|
-
return
|
|
26280
|
+
return cached4;
|
|
26281
26281
|
}
|
|
26282
26282
|
const result = await collection.findOne({
|
|
26283
26283
|
user
|
|
@@ -36966,13 +36966,13 @@ function useBuildingUnitRepo() {
|
|
|
36966
36966
|
message: `Cache key for getAll building units: ${cacheKey}`
|
|
36967
36967
|
});
|
|
36968
36968
|
try {
|
|
36969
|
-
const
|
|
36970
|
-
if (
|
|
36969
|
+
const cached4 = await getCache(cacheKey);
|
|
36970
|
+
if (cached4) {
|
|
36971
36971
|
logger69.log({
|
|
36972
36972
|
level: "info",
|
|
36973
36973
|
message: `Cache hit for getAll building units: ${cacheKey}`
|
|
36974
36974
|
});
|
|
36975
|
-
return
|
|
36975
|
+
return cached4;
|
|
36976
36976
|
}
|
|
36977
36977
|
const pipeline = [
|
|
36978
36978
|
{ $match: query2 },
|
|
@@ -37107,13 +37107,13 @@ function useBuildingUnitRepo() {
|
|
|
37107
37107
|
message: `Cache key for getAll building units: ${cacheKey}`
|
|
37108
37108
|
});
|
|
37109
37109
|
try {
|
|
37110
|
-
const
|
|
37111
|
-
if (
|
|
37110
|
+
const cached4 = await getCache(cacheKey);
|
|
37111
|
+
if (cached4) {
|
|
37112
37112
|
logger69.log({
|
|
37113
37113
|
level: "info",
|
|
37114
37114
|
message: `Cache hit for getAll building units: ${cacheKey}`
|
|
37115
37115
|
});
|
|
37116
|
-
return
|
|
37116
|
+
return cached4;
|
|
37117
37117
|
}
|
|
37118
37118
|
const items = await collection.aggregate(
|
|
37119
37119
|
[
|
|
@@ -37202,13 +37202,13 @@ function useBuildingUnitRepo() {
|
|
|
37202
37202
|
level: level2
|
|
37203
37203
|
});
|
|
37204
37204
|
try {
|
|
37205
|
-
const
|
|
37206
|
-
if (
|
|
37205
|
+
const cached4 = await getCache(cacheKey);
|
|
37206
|
+
if (cached4) {
|
|
37207
37207
|
logger69.log({
|
|
37208
37208
|
level: "info",
|
|
37209
37209
|
message: `Cache hit for getById building unit: ${cacheKey}`
|
|
37210
37210
|
});
|
|
37211
|
-
return
|
|
37211
|
+
return cached4;
|
|
37212
37212
|
}
|
|
37213
37213
|
const result = await collection.findOne({
|
|
37214
37214
|
building,
|
|
@@ -37275,13 +37275,13 @@ function useBuildingUnitRepo() {
|
|
|
37275
37275
|
building: String(building)
|
|
37276
37276
|
});
|
|
37277
37277
|
try {
|
|
37278
|
-
const
|
|
37279
|
-
if (
|
|
37278
|
+
const cached4 = await getCache(cacheKey);
|
|
37279
|
+
if (cached4) {
|
|
37280
37280
|
logger69.log({
|
|
37281
37281
|
level: "info",
|
|
37282
37282
|
message: `Cache hit for getById building unit: ${cacheKey}`
|
|
37283
37283
|
});
|
|
37284
|
-
return
|
|
37284
|
+
return cached4;
|
|
37285
37285
|
}
|
|
37286
37286
|
const result = await collection.findOne({
|
|
37287
37287
|
building,
|
|
@@ -37487,13 +37487,13 @@ function useBuildingUnitRepo() {
|
|
|
37487
37487
|
cacheOptions
|
|
37488
37488
|
);
|
|
37489
37489
|
try {
|
|
37490
|
-
const
|
|
37491
|
-
if (
|
|
37490
|
+
const cached4 = await getCache(cacheKey);
|
|
37491
|
+
if (cached4) {
|
|
37492
37492
|
logger69.log({
|
|
37493
37493
|
level: "info",
|
|
37494
37494
|
message: `Cache hit for getById building unit: ${cacheKey}`
|
|
37495
37495
|
});
|
|
37496
|
-
return
|
|
37496
|
+
return cached4;
|
|
37497
37497
|
}
|
|
37498
37498
|
const result = await collection.findOne(query2, {
|
|
37499
37499
|
session
|
|
@@ -37533,13 +37533,13 @@ function useBuildingUnitRepo() {
|
|
|
37533
37533
|
level: level2
|
|
37534
37534
|
});
|
|
37535
37535
|
try {
|
|
37536
|
-
const
|
|
37537
|
-
if (
|
|
37536
|
+
const cached4 = await getCache(cacheKey);
|
|
37537
|
+
if (cached4) {
|
|
37538
37538
|
logger69.log({
|
|
37539
37539
|
level: "info",
|
|
37540
37540
|
message: `Cache hit for getById building unit: ${cacheKey}`
|
|
37541
37541
|
});
|
|
37542
|
-
return
|
|
37542
|
+
return cached4;
|
|
37543
37543
|
}
|
|
37544
37544
|
const query2 = {
|
|
37545
37545
|
site,
|
|
@@ -37905,9 +37905,9 @@ function useVehicleService() {
|
|
|
37905
37905
|
const siteZones = /* @__PURE__ */ new Map();
|
|
37906
37906
|
async function siteTimezone(site) {
|
|
37907
37907
|
const key = String(site ?? "");
|
|
37908
|
-
const
|
|
37909
|
-
if (
|
|
37910
|
-
return
|
|
37908
|
+
const cached4 = siteZones.get(key);
|
|
37909
|
+
if (cached4 && Date.now() - cached4.at < 5 * 6e4)
|
|
37910
|
+
return cached4.zone;
|
|
37911
37911
|
let zone = resolveSiteTimezone(null);
|
|
37912
37912
|
if (key) {
|
|
37913
37913
|
try {
|
|
@@ -40801,13 +40801,13 @@ function useBuildingRepo() {
|
|
|
40801
40801
|
message: `Cache key for getAll buildings: ${cacheKey}`
|
|
40802
40802
|
});
|
|
40803
40803
|
try {
|
|
40804
|
-
const
|
|
40805
|
-
if (
|
|
40804
|
+
const cached4 = await getCache(cacheKey);
|
|
40805
|
+
if (cached4) {
|
|
40806
40806
|
logger76.log({
|
|
40807
40807
|
level: "info",
|
|
40808
40808
|
message: `Cache hit for getAll buildings: ${cacheKey}`
|
|
40809
40809
|
});
|
|
40810
|
-
return
|
|
40810
|
+
return cached4;
|
|
40811
40811
|
}
|
|
40812
40812
|
const items = await collection.aggregate(
|
|
40813
40813
|
[
|
|
@@ -40936,13 +40936,13 @@ function useBuildingRepo() {
|
|
|
40936
40936
|
_id: String(_id)
|
|
40937
40937
|
});
|
|
40938
40938
|
try {
|
|
40939
|
-
const
|
|
40940
|
-
if (
|
|
40939
|
+
const cached4 = await getCache(cacheKey);
|
|
40940
|
+
if (cached4) {
|
|
40941
40941
|
logger76.log({
|
|
40942
40942
|
level: "info",
|
|
40943
40943
|
message: `Cache hit for getById building: ${cacheKey}`
|
|
40944
40944
|
});
|
|
40945
|
-
return
|
|
40945
|
+
return cached4;
|
|
40946
40946
|
}
|
|
40947
40947
|
const result = await collection.findOne({
|
|
40948
40948
|
_id
|
|
@@ -41006,13 +41006,13 @@ function useBuildingRepo() {
|
|
|
41006
41006
|
const cacheOptions = { ...query2 };
|
|
41007
41007
|
const cacheKey = makeCacheKey28(buildings_namespace_collection, cacheOptions);
|
|
41008
41008
|
try {
|
|
41009
|
-
const
|
|
41010
|
-
if (
|
|
41009
|
+
const cached4 = await getCache(cacheKey);
|
|
41010
|
+
if (cached4) {
|
|
41011
41011
|
logger76.log({
|
|
41012
41012
|
level: "info",
|
|
41013
41013
|
message: `Cache hit for getById building: ${cacheKey}`
|
|
41014
41014
|
});
|
|
41015
|
-
return
|
|
41015
|
+
return cached4;
|
|
41016
41016
|
}
|
|
41017
41017
|
const result = await collection.findOne(query2);
|
|
41018
41018
|
setCache(cacheKey, result, 300).then(() => {
|
|
@@ -41510,13 +41510,13 @@ function useBuildingLevelRepo() {
|
|
|
41510
41510
|
message: `Cache key for getAll building levels: ${cacheKey}`
|
|
41511
41511
|
});
|
|
41512
41512
|
try {
|
|
41513
|
-
const
|
|
41514
|
-
if (
|
|
41513
|
+
const cached4 = await getCache(cacheKey);
|
|
41514
|
+
if (cached4) {
|
|
41515
41515
|
logger78.log({
|
|
41516
41516
|
level: "info",
|
|
41517
41517
|
message: `Cache hit for getAll building levels: ${cacheKey}`
|
|
41518
41518
|
});
|
|
41519
|
-
return
|
|
41519
|
+
return cached4;
|
|
41520
41520
|
}
|
|
41521
41521
|
const sortStage = Object.keys(sort).length > 0 ? { $sort: sort } : { $sort: { name: 1 } };
|
|
41522
41522
|
const items = await collection.aggregate(
|
|
@@ -41561,13 +41561,13 @@ function useBuildingLevelRepo() {
|
|
|
41561
41561
|
const cacheKey = makeCacheKey29(building_level_namespace_collection, {
|
|
41562
41562
|
_id
|
|
41563
41563
|
});
|
|
41564
|
-
const
|
|
41565
|
-
if (
|
|
41564
|
+
const cached4 = await getCache(cacheKey);
|
|
41565
|
+
if (cached4) {
|
|
41566
41566
|
logger78.log({
|
|
41567
41567
|
level: "info",
|
|
41568
41568
|
message: `Cache hit for getById building level: ${cacheKey}`
|
|
41569
41569
|
});
|
|
41570
|
-
return
|
|
41570
|
+
return cached4;
|
|
41571
41571
|
}
|
|
41572
41572
|
try {
|
|
41573
41573
|
_id = new ObjectId88(_id);
|
|
@@ -45241,7 +45241,7 @@ function useCameraViewController() {
|
|
|
45241
45241
|
}
|
|
45242
45242
|
async function snapshot2(req, res, next) {
|
|
45243
45243
|
try {
|
|
45244
|
-
const { buffer, cached:
|
|
45244
|
+
const { buffer, cached: cached4, stream, fellBackToMain } = await getSnapshot({
|
|
45245
45245
|
cameraId: String(req.params.id ?? ""),
|
|
45246
45246
|
userId: callerId5(req)
|
|
45247
45247
|
});
|
|
@@ -45250,7 +45250,7 @@ function useCameraViewController() {
|
|
|
45250
45250
|
"Cache-Control",
|
|
45251
45251
|
`private, max-age=${CAMERA_SNAPSHOT_CACHE_SECONDS}`
|
|
45252
45252
|
);
|
|
45253
|
-
res.setHeader("X-Camera-Snapshot-Cached",
|
|
45253
|
+
res.setHeader("X-Camera-Snapshot-Cached", cached4 ? "1" : "0");
|
|
45254
45254
|
res.setHeader("X-Camera-Stream", stream);
|
|
45255
45255
|
res.setHeader("X-Camera-Stream-Fallback", fellBackToMain ? "1" : "0");
|
|
45256
45256
|
res.status(200).end(buffer);
|
|
@@ -63272,7 +63272,9 @@ var ROBOT_CAPABILITIES = [
|
|
|
63272
63272
|
*/
|
|
63273
63273
|
"manualDrive",
|
|
63274
63274
|
/** A heat camera: alarm and patrol photos carry a thermal picture and temperatures. Reporting only. */
|
|
63275
|
-
"thermalCamera"
|
|
63275
|
+
"thermalCamera",
|
|
63276
|
+
/** A scrubber's clean/dirty water levels and whether its tanks and covers are fitted. Reporting only. */
|
|
63277
|
+
"waterTanks"
|
|
63276
63278
|
];
|
|
63277
63279
|
var TIER_REQUIREMENTS = {
|
|
63278
63280
|
"full-control": [
|
|
@@ -63566,6 +63568,9 @@ var ROBOT_CLOUD_PATHS = {
|
|
|
63566
63568
|
taskList: "/portal/cleaning/get-task-list",
|
|
63567
63569
|
alertList: "/portal/alert/get-alert-list",
|
|
63568
63570
|
liftList: "/portal/lift/get-lift-list",
|
|
63571
|
+
workHours: "/portal/workhours/get-work-hours",
|
|
63572
|
+
haltPlans: "/portal/halt-plan/get",
|
|
63573
|
+
stationState: "/portal/detailstate/get-station-detail-state",
|
|
63569
63574
|
mapList: "/portal/maps/get-map-list",
|
|
63570
63575
|
fileUrl: "/portal/maps/get-file-url",
|
|
63571
63576
|
tracking: "/portal/robots/tracking",
|
|
@@ -63862,6 +63867,9 @@ var STEP_NAMES = {
|
|
|
63862
63867
|
[ROBOT_CLOUD_PATHS.filePreview]: "the map images",
|
|
63863
63868
|
[ROBOT_CLOUD_PATHS.plansV2]: "the cleaning schedule",
|
|
63864
63869
|
[ROBOT_CLOUD_PATHS.taskList]: "the cleaning records",
|
|
63870
|
+
[ROBOT_CLOUD_PATHS.workHours]: "the consumable hours",
|
|
63871
|
+
[ROBOT_CLOUD_PATHS.haltPlans]: "the power schedule",
|
|
63872
|
+
[ROBOT_CLOUD_PATHS.stationState]: "the base station state",
|
|
63865
63873
|
[ROBOT_CLOUD_PATHS.alertList]: "the alert history",
|
|
63866
63874
|
[ROBOT_CLOUD_PATHS.liftList]: "the lift list"
|
|
63867
63875
|
};
|
|
@@ -64066,6 +64074,23 @@ function useRobotCloudService(credentials, options = {}) {
|
|
|
64066
64074
|
async function getLiftList(sceneId) {
|
|
64067
64075
|
return post(ROBOT_CLOUD_PATHS.liftList, { sceneid: sceneId }, "liftlist");
|
|
64068
64076
|
}
|
|
64077
|
+
async function getWorkHours(robotId) {
|
|
64078
|
+
return post(ROBOT_CLOUD_PATHS.workHours, { robotId }, "unitlist");
|
|
64079
|
+
}
|
|
64080
|
+
async function getHaltPlans(robotId) {
|
|
64081
|
+
return post(
|
|
64082
|
+
ROBOT_CLOUD_PATHS.haltPlans,
|
|
64083
|
+
{ planId: 0, robotId, pageNo: 1, pageSize: 20 },
|
|
64084
|
+
"planList"
|
|
64085
|
+
);
|
|
64086
|
+
}
|
|
64087
|
+
async function getStationState(robotId) {
|
|
64088
|
+
const data = await post(
|
|
64089
|
+
ROBOT_CLOUD_PATHS.stationState,
|
|
64090
|
+
{ robotId, options: "state" }
|
|
64091
|
+
);
|
|
64092
|
+
return data.state ?? null;
|
|
64093
|
+
}
|
|
64069
64094
|
async function getMaps(robotSn) {
|
|
64070
64095
|
const data = await post(
|
|
64071
64096
|
ROBOT_CLOUD_PATHS.mapList,
|
|
@@ -64147,6 +64172,9 @@ function useRobotCloudService(credentials, options = {}) {
|
|
|
64147
64172
|
getPlansV2,
|
|
64148
64173
|
getTaskList,
|
|
64149
64174
|
getAlerts,
|
|
64175
|
+
getWorkHours,
|
|
64176
|
+
getHaltPlans,
|
|
64177
|
+
getStationState,
|
|
64150
64178
|
getLiftList,
|
|
64151
64179
|
getMaps,
|
|
64152
64180
|
getFileUrls,
|
|
@@ -64160,6 +64188,7 @@ function useRobotCloudService(credentials, options = {}) {
|
|
|
64160
64188
|
}
|
|
64161
64189
|
|
|
64162
64190
|
// src/services/ounitech.adapter.ts
|
|
64191
|
+
import axios4 from "axios";
|
|
64163
64192
|
var OUNITECH_BRAND = "ounitech";
|
|
64164
64193
|
var OUNITECH_CAPABILITIES = {
|
|
64165
64194
|
// Pose in the chapter-6 robot list (metres) and the tracking stream.
|
|
@@ -64172,6 +64201,8 @@ var OUNITECH_CAPABILITIES = {
|
|
|
64172
64201
|
battery: true,
|
|
64173
64202
|
// The chapter-6 robot list: `floorNo` (the robot's floor).
|
|
64174
64203
|
floorReporting: true,
|
|
64204
|
+
// robotState readings: clean-water / dirty-water (%), top-cover / tank / dust-box fitted.
|
|
64205
|
+
waterTanks: true,
|
|
64175
64206
|
// FALSE on purpose - each one is a question for the vendor.
|
|
64176
64207
|
navigateToPoint: false,
|
|
64177
64208
|
// app: "Move to Target Point"; API: robot-control actionNo not documented
|
|
@@ -64247,6 +64278,39 @@ function ounitechJobWords(st) {
|
|
|
64247
64278
|
const v = reading(st, "job");
|
|
64248
64279
|
return v ? JOB_WORDS[v] ?? null : null;
|
|
64249
64280
|
}
|
|
64281
|
+
var levelOf = (pct) => pct < 25 ? "low" : pct >= 75 ? "high" : "medium";
|
|
64282
|
+
var LEVEL_WORDS = { \u4F4E: "low", \u4E2D: "medium", \u9AD8: "high" };
|
|
64283
|
+
var PARTS = [
|
|
64284
|
+
["top-cover", "top cover"],
|
|
64285
|
+
["clean-water-tank", "clean-water tank"],
|
|
64286
|
+
["waste-water-tank", "dirty-water tank"],
|
|
64287
|
+
["dust-box", "dust box"]
|
|
64288
|
+
];
|
|
64289
|
+
function ounitechCleaning(st, working, taskPercent) {
|
|
64290
|
+
const water = (pctKey, levelKey) => {
|
|
64291
|
+
const pct2 = num(reading(st, pctKey));
|
|
64292
|
+
if (pct2 !== void 0 && pct2 >= 0 && pct2 <= 100)
|
|
64293
|
+
return { level: levelOf(pct2), percent: Math.round(pct2) };
|
|
64294
|
+
const word = LEVEL_WORDS[reading(st, levelKey) ?? ""];
|
|
64295
|
+
return word ? { level: word, percent: null } : null;
|
|
64296
|
+
};
|
|
64297
|
+
const cleanWater = water("clean-water", "clean-water-level");
|
|
64298
|
+
const dirtyWater = water("dirty-water", "dirty-water-level");
|
|
64299
|
+
const parts = PARTS.flatMap(([key, part]) => {
|
|
64300
|
+
const v = reading(st, key)?.toLowerCase();
|
|
64301
|
+
return v === "true" || v === "1" ? [{ part, ok: true }] : v === "false" || v === "0" ? [{ part, ok: false }] : [];
|
|
64302
|
+
});
|
|
64303
|
+
const area = (k) => {
|
|
64304
|
+
const n = num(reading(st, k));
|
|
64305
|
+
return n !== void 0 && n > 0 ? Math.round(n * 10) / 10 : null;
|
|
64306
|
+
};
|
|
64307
|
+
const pct = num(reading(st, "acc-percent")) ?? (finite(taskPercent) ? taskPercent : void 0);
|
|
64308
|
+
const job = working ? { percent: pct !== void 0 && pct >= 0 && pct <= 100 ? Math.round(pct) : null, areaDone: area("acc-area"), areaPlanned: area("count-area") } : null;
|
|
64309
|
+
const hasJob = !!job && (job.percent !== null || job.areaDone !== null);
|
|
64310
|
+
if (!cleanWater && !dirtyWater && !parts.length && !hasJob)
|
|
64311
|
+
return null;
|
|
64312
|
+
return { cleanWater, dirtyWater, parts, job: hasJob ? job : null };
|
|
64313
|
+
}
|
|
64250
64314
|
function updatedAt(v) {
|
|
64251
64315
|
const n = num(v);
|
|
64252
64316
|
if (n !== void 0)
|
|
@@ -64282,6 +64346,9 @@ function ounitechRobotFromHomeRow(row, live2, now = Date.now()) {
|
|
|
64282
64346
|
floorKnown: Number.isInteger(row.floorNo),
|
|
64283
64347
|
position: online && x !== void 0 && y !== void 0 ? { x, y, theta: num(st.theta) ?? 0 } : null
|
|
64284
64348
|
};
|
|
64349
|
+
if (online) {
|
|
64350
|
+
robot.cleaning = ounitechCleaning(st, mode === "WORKING", task && String(task.statusFlag) === "1" ? task.accPercent : null);
|
|
64351
|
+
}
|
|
64285
64352
|
if (online && (flag === 7 || Array.isArray(st.rtFaultList) && st.rtFaultList.length)) {
|
|
64286
64353
|
robot.fault = ounitechFault(st.rtFaultList);
|
|
64287
64354
|
}
|
|
@@ -64303,12 +64370,319 @@ function ounitechFault(list) {
|
|
|
64303
64370
|
return { code: "error", message: String(list[0]).slice(0, 200) };
|
|
64304
64371
|
return { code: "error", message: "The robot reports an error" };
|
|
64305
64372
|
}
|
|
64373
|
+
function ounitechMapShare(map, x, y) {
|
|
64374
|
+
const w = map?.width, h = map?.height, r = map?.resolution;
|
|
64375
|
+
const wx = num(x), wy = num(y);
|
|
64376
|
+
if (!finite(w) || !finite(h) || !finite(r) || w <= 0 || h <= 0 || r <= 0 || wx === void 0 || wy === void 0)
|
|
64377
|
+
return null;
|
|
64378
|
+
const sx = (wx - (num(map?.originX) ?? 0)) / r / w * 100;
|
|
64379
|
+
const sy = 100 - (wy - (num(map?.originY) ?? 0)) / r / h * 100;
|
|
64380
|
+
if (sx < 0 || sx > 100 || sy < 0 || sy > 100)
|
|
64381
|
+
return null;
|
|
64382
|
+
return { x: Math.round(sx * 100) / 100, y: Math.round(sy * 100) / 100 };
|
|
64383
|
+
}
|
|
64384
|
+
function ounitechMapView(m, imageUrl, partitionImageUrl, size) {
|
|
64385
|
+
const floorNo2 = Number.isInteger(m.floorNo) ? m.floorNo : null;
|
|
64386
|
+
const width = size?.width ?? null;
|
|
64387
|
+
const height = size?.height ?? null;
|
|
64388
|
+
const frame2 = { width, height, resolution: m.resolution, originX: m.originX, originY: m.originY };
|
|
64389
|
+
const areas = (Array.isArray(m.areaList) ? m.areaList : []).filter((a) => typeof a?.areaName === "string" && a.areaName.trim()).map((a) => {
|
|
64390
|
+
const px = num(a.x), py = num(a.y);
|
|
64391
|
+
const at2 = width && height && px !== void 0 && py !== void 0 && (px > 0 || py > 0) && px <= width && py <= height ? { x: Math.round(px / width * 1e4) / 100, y: Math.round(py / height * 1e4) / 100 } : null;
|
|
64392
|
+
return { ...a.areaId != null ? { areaId: a.areaId } : {}, areaName: a.areaName.trim(), rgba: a.rgba, x: a.x, y: a.y, at: at2 };
|
|
64393
|
+
});
|
|
64394
|
+
return {
|
|
64395
|
+
mapId: String(m.mapId ?? `floor-${floorNo2 ?? 0}`),
|
|
64396
|
+
floor: floorNo2,
|
|
64397
|
+
floorNo: floorNo2,
|
|
64398
|
+
mapDisplayName: String(m.mapName ?? "").trim(),
|
|
64399
|
+
mapName: m.mapName,
|
|
64400
|
+
imageUrl,
|
|
64401
|
+
partitionImageUrl,
|
|
64402
|
+
width,
|
|
64403
|
+
height,
|
|
64404
|
+
resolution: m.resolution,
|
|
64405
|
+
originX: m.originX,
|
|
64406
|
+
originY: m.originY,
|
|
64407
|
+
backgroundFileKey: m.backgroundFileKey,
|
|
64408
|
+
partitionFileKey: m.partitionFileKey,
|
|
64409
|
+
totalArea: m.totalArea,
|
|
64410
|
+
baseX: m.baseX,
|
|
64411
|
+
baseY: m.baseY,
|
|
64412
|
+
baseTheta: m.baseTheta,
|
|
64413
|
+
createTime: m.createTime,
|
|
64414
|
+
dock: ounitechMapShare(frame2, m.baseX ?? 0, m.baseY ?? 0),
|
|
64415
|
+
positionApproximate: true,
|
|
64416
|
+
// The raw areas, kept for older screens.
|
|
64417
|
+
areaList: areas.map(({ at: _at, ...a }) => a),
|
|
64418
|
+
areas: areas.map((a) => ({ name: a.areaName, at: a.at }))
|
|
64419
|
+
};
|
|
64420
|
+
}
|
|
64421
|
+
function ounitechCurrentMap(maps, taskMapId, floorNo2) {
|
|
64422
|
+
const byTask = taskMapId != null ? maps.find((m) => m.mapId === String(taskMapId)) : void 0;
|
|
64423
|
+
if (byTask)
|
|
64424
|
+
return byTask;
|
|
64425
|
+
if (Number.isInteger(floorNo2))
|
|
64426
|
+
return maps.find((m) => m.floorNo === floorNo2) ?? null;
|
|
64427
|
+
return maps.length === 1 ? maps[0] : null;
|
|
64428
|
+
}
|
|
64429
|
+
function pngSize(bytes) {
|
|
64430
|
+
if (!bytes || bytes.length < 24)
|
|
64431
|
+
return null;
|
|
64432
|
+
const ihdr = String.fromCharCode(bytes[12], bytes[13], bytes[14], bytes[15]);
|
|
64433
|
+
if (bytes[1] !== 80 || ihdr !== "IHDR")
|
|
64434
|
+
return null;
|
|
64435
|
+
const dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
64436
|
+
const width = dv.getUint32(16), height = dv.getUint32(20);
|
|
64437
|
+
return width > 0 && height > 0 && width < 2e4 && height < 2e4 ? { width, height } : null;
|
|
64438
|
+
}
|
|
64439
|
+
async function fetchPngSize(url2) {
|
|
64440
|
+
try {
|
|
64441
|
+
const res = await axios4.get(url2, { responseType: "arraybuffer", headers: { Range: "bytes=0-63" }, timeout: 8e3 });
|
|
64442
|
+
return pngSize(new Uint8Array(res.data));
|
|
64443
|
+
} catch {
|
|
64444
|
+
return null;
|
|
64445
|
+
}
|
|
64446
|
+
}
|
|
64447
|
+
function ounitechTime(v, tzMinutes = 480) {
|
|
64448
|
+
const m = typeof v === "string" ? /^(\d{4}-\d{2}-\d{2})[ T](\d{2}:\d{2}(?::\d{2})?)/.exec(v.trim()) : null;
|
|
64449
|
+
if (!m)
|
|
64450
|
+
return null;
|
|
64451
|
+
const t = Date.parse(`${m[1]}T${m[2].length === 5 ? `${m[2]}:00` : m[2]}Z`) - tzMinutes * 6e4;
|
|
64452
|
+
return Number.isFinite(t) ? new Date(t).toISOString() : null;
|
|
64453
|
+
}
|
|
64454
|
+
var MODE_WORDS = { \u5438\u5C18: "Vacuum", \u6D17\u5730: "Wash floor", \u5C18\u63A8: "Dust mop", \u62D6\u5730: "Mop" };
|
|
64455
|
+
var TYPE_WORDS = {
|
|
64456
|
+
\u51C6\u5907\u6E05\u6D01: "Getting ready",
|
|
64457
|
+
\u8131\u79BB\u57FA\u7AD9\u4E2D: "Leaving the charger",
|
|
64458
|
+
\u5168\u5C40\u6E05\u626B: "Clean all",
|
|
64459
|
+
\u5206\u533A\u6E05\u626B: "Area clean",
|
|
64460
|
+
\u5B9A\u70B9\u6E05\u626B: "Spot clean",
|
|
64461
|
+
\u56DE\u5145: "Returning to charge",
|
|
64462
|
+
\u6CBF\u8FB9\u6E05\u626B: "Edge clean"
|
|
64463
|
+
};
|
|
64464
|
+
var SOURCE_WORDS = { plan: "Schedule", app: "Ounitech app", btn: "Button on the robot" };
|
|
64465
|
+
var round1 = (v) => v !== void 0 ? Math.round(v * 10) / 10 : null;
|
|
64466
|
+
function ounitechTaskRecord(t, maps = [], tz = 480) {
|
|
64467
|
+
const map = maps.find((m) => m.mapId === String(t.mapId));
|
|
64468
|
+
const kind = String(t.typeName ?? "").trim();
|
|
64469
|
+
const mode = String(t.subTypeName ?? "").trim();
|
|
64470
|
+
const src = String(t.source ?? "").split(",")[0].trim();
|
|
64471
|
+
const mileage = num(t.cleanedMileage);
|
|
64472
|
+
return {
|
|
64473
|
+
id: String(t.taskId ?? ""),
|
|
64474
|
+
start: ounitechTime(t.timeFrom, tz),
|
|
64475
|
+
end: ounitechTime(t.timeTo, tz),
|
|
64476
|
+
durationSec: num(t.durationSeconds) ?? num(t.accTime) ?? null,
|
|
64477
|
+
areaM2: round1(num(t.cleanedArea) ?? num(t.accArea)),
|
|
64478
|
+
plannedM2: round1(num(t.countArea)),
|
|
64479
|
+
percent: num(t.accPercent) ?? null,
|
|
64480
|
+
distanceM: mileage !== void 0 ? Math.round(mileage) : null,
|
|
64481
|
+
result: String(t.statusName ?? "").trim() || null,
|
|
64482
|
+
job: TYPE_WORDS[kind] ?? (kind || null),
|
|
64483
|
+
mode: MODE_WORDS[mode] ?? (mode || null),
|
|
64484
|
+
source: SOURCE_WORDS[src] ?? (src || null),
|
|
64485
|
+
map: map ? map.mapDisplayName || (map.floorNo !== null ? `Floor ${map.floorNo}` : null) : null,
|
|
64486
|
+
floorNo: Number.isInteger(t.floorNo) ? t.floorNo : map?.floorNo ?? null
|
|
64487
|
+
};
|
|
64488
|
+
}
|
|
64489
|
+
var ALERT_WORDS = {
|
|
64490
|
+
"540": "Floor check: cliff sensor switched on",
|
|
64491
|
+
"601": "Left wheel driver reset",
|
|
64492
|
+
"620": "Right wheel driver offline",
|
|
64493
|
+
"621": "Right wheel driver reset",
|
|
64494
|
+
"734": "IMU zero offset too large",
|
|
64495
|
+
"785": "Localisation ready"
|
|
64496
|
+
};
|
|
64497
|
+
var ALERT_LEVEL_WORDS = { \u63D0\u793A: "Notice", \u8B66\u544A: "Warning", \u6545\u969C: "Fault", \u9519\u8BEF: "Error", \u4E25\u91CD: "Critical" };
|
|
64498
|
+
function ounitechAlertRecord(a, tz = 480) {
|
|
64499
|
+
const raw = String(a.errMsg ?? a.errCode ?? "").trim();
|
|
64500
|
+
const m = /^\s*(\d+)\s*-\s*(.*)$/.exec(raw);
|
|
64501
|
+
const code = m?.[1] ?? "";
|
|
64502
|
+
let rest = (m?.[2] ?? raw).trim();
|
|
64503
|
+
const resolved = /\(Resolved\)\s*$/i.test(rest);
|
|
64504
|
+
rest = rest.replace(/\(Resolved\)\s*$/i, "").replace(/\(\s*\d+\s*\)\s*$/, "").trim();
|
|
64505
|
+
const lv = /^\(([^)]*)\)/.exec(rest);
|
|
64506
|
+
if (lv)
|
|
64507
|
+
rest = rest.slice(lv[0].length).trim();
|
|
64508
|
+
return {
|
|
64509
|
+
code,
|
|
64510
|
+
level: lv ? ALERT_LEVEL_WORDS[lv[1].trim()] ?? lv[1].trim() : null,
|
|
64511
|
+
message: ALERT_WORDS[code] ?? (rest || raw),
|
|
64512
|
+
vendorText: rest || raw,
|
|
64513
|
+
resolved,
|
|
64514
|
+
at: ounitechTime(a.createTime, tz)
|
|
64515
|
+
};
|
|
64516
|
+
}
|
|
64517
|
+
var READINGS = {
|
|
64518
|
+
"battery-percent": { group: "Battery", label: "Battery", unit: "%" },
|
|
64519
|
+
"left-battery-percent": { group: "Battery", label: "Left battery", unit: "%" },
|
|
64520
|
+
"right-battery-percent": { group: "Battery", label: "Right battery", unit: "%" },
|
|
64521
|
+
"bat-vol-left": { group: "Battery", label: "Left battery voltage", unit: "V" },
|
|
64522
|
+
"bat-vol-right": { group: "Battery", label: "Right battery voltage", unit: "V" },
|
|
64523
|
+
BatteryOffline: { group: "Battery", label: "Battery disconnected", bad: "true" },
|
|
64524
|
+
BatteryClosed: { group: "Battery", label: "Battery switched off", bad: "true" },
|
|
64525
|
+
"clean-water": { group: "Water", label: "Clean water", unit: "%" },
|
|
64526
|
+
"dirty-water": { group: "Water", label: "Dirty water", unit: "%" },
|
|
64527
|
+
"clean-water-level": { group: "Water", label: "Clean water level" },
|
|
64528
|
+
"dirty-water-level": { group: "Water", label: "Dirty water level" },
|
|
64529
|
+
"ctank-full": { group: "Water", label: "Clean water tank full" },
|
|
64530
|
+
"cmop-pump-low": { group: "Water", label: "Mop water running low", bad: "true" },
|
|
64531
|
+
"top-cover": { group: "Parts in place", label: "Top cover closed", bad: "false" },
|
|
64532
|
+
"hand-push-rod": { group: "Parts in place", label: "Push handle in place", bad: "false" },
|
|
64533
|
+
"clean-water-tank": { group: "Parts in place", label: "Clean water tank fitted", bad: "false" },
|
|
64534
|
+
"waste-water-tank": { group: "Parts in place", label: "Dirty water tank fitted", bad: "false" },
|
|
64535
|
+
"dust-box": { group: "Parts in place", label: "Dust box fitted", bad: "false" },
|
|
64536
|
+
"collision-left": { group: "Sensors", label: "Left bumper pressed", bad: "true" },
|
|
64537
|
+
"collision-right": { group: "Sensors", label: "Right bumper pressed", bad: "true" },
|
|
64538
|
+
"wfan-brake-flag": { group: "Sensors", label: "Water suction fan blocked", bad: "true" },
|
|
64539
|
+
"sfan-brake-flag": { group: "Sensors", label: "Dust suction fan blocked", bad: "true" },
|
|
64540
|
+
"wfan-brake-percent": { group: "Sensors", label: "Water suction fan blockage", unit: "%" },
|
|
64541
|
+
"sfan-brake-percent": { group: "Sensors", label: "Dust suction fan blockage", unit: "%" },
|
|
64542
|
+
job: { group: "Current job", label: "Job" },
|
|
64543
|
+
status: { group: "Current job", label: "Work status" },
|
|
64544
|
+
"acc-percent": { group: "Current job", label: "Job done", unit: "%" },
|
|
64545
|
+
"acc-area": { group: "Current job", label: "Area cleaned", unit: "m\xB2" },
|
|
64546
|
+
"count-area": { group: "Current job", label: "Area planned", unit: "m\xB2" },
|
|
64547
|
+
"acc-mile": { group: "Current job", label: "Distance driven", unit: "m" },
|
|
64548
|
+
"acc-time": { group: "Current job", label: "Cleaning time" },
|
|
64549
|
+
"acc-task": { group: "Current job", label: "Jobs counted" },
|
|
64550
|
+
"avg-speed": { group: "Current job", label: "Average speed", unit: "m\xB2/s" },
|
|
64551
|
+
x: { group: "Position", label: "Position x", unit: "m" },
|
|
64552
|
+
y: { group: "Position", label: "Position y", unit: "m" },
|
|
64553
|
+
theta: { group: "Position", label: "Heading", unit: "rad" },
|
|
64554
|
+
"mcu-state": { group: "Connection", label: "Main board connected", bad: "false" },
|
|
64555
|
+
bslink: { group: "Connection", label: "Linked to the base station" },
|
|
64556
|
+
RouterSignalStrength: { group: "Connection", label: "Mobile signal" },
|
|
64557
|
+
IsOfflineMode: { group: "Connection", label: "Offline mode", bad: "true" },
|
|
64558
|
+
OfflineVersion: { group: "Software", label: "Offline map version" },
|
|
64559
|
+
McuSW: { group: "Software", label: "Main board software" },
|
|
64560
|
+
FaceH7SW: { group: "Software", label: "Front panel software" },
|
|
64561
|
+
SlamType: { group: "Software", label: "Mapping type" },
|
|
64562
|
+
LockType: { group: "Software", label: "Lock type" }
|
|
64563
|
+
};
|
|
64564
|
+
var STATION_READINGS = {
|
|
64565
|
+
"clean-water": { group: "Base station", label: "Station clean water", unit: "L" },
|
|
64566
|
+
"dirty-water": { group: "Base station", label: "Station dirty water", unit: "L" },
|
|
64567
|
+
"clean-percent": { group: "Base station", label: "Station clean water", unit: "%" },
|
|
64568
|
+
"dirty-percent": { group: "Base station", label: "Station dirty water", unit: "%" },
|
|
64569
|
+
temperature: { group: "Base station", label: "Station temperature", unit: "\xB0C" },
|
|
64570
|
+
"bluetooth-err": { group: "Base station", label: "Bluetooth fault", bad: "true" },
|
|
64571
|
+
"charge-err": { group: "Base station", label: "Charging fault", bad: "true" },
|
|
64572
|
+
"clean-box-err": { group: "Base station", label: "Clean water box fault", bad: "true" },
|
|
64573
|
+
"clean-pump-err": { group: "Base station", label: "Clean water pump fault", bad: "true" },
|
|
64574
|
+
"dirty-box-err": { group: "Base station", label: "Dirty water box fault", bad: "true" },
|
|
64575
|
+
"dirty-pump-err": { group: "Base station", label: "Dirty water pump fault", bad: "true" },
|
|
64576
|
+
"dust-box-err": { group: "Base station", label: "Dust box fault", bad: "true" },
|
|
64577
|
+
"dust-fan-err": { group: "Base station", label: "Dust fan fault", bad: "true" },
|
|
64578
|
+
"ir-err": { group: "Base station", label: "Docking sensor fault", bad: "true" },
|
|
64579
|
+
"solenoid-err": { group: "Base station", label: "Water valve fault", bad: "true" },
|
|
64580
|
+
"temperature-err": { group: "Base station", label: "Temperature fault", bad: "true" },
|
|
64581
|
+
"water-sensor-err": { group: "Base station", label: "Water sensor fault", bad: "true" }
|
|
64582
|
+
};
|
|
64583
|
+
var HIDDEN_READINGS = /* @__PURE__ */ new Set(["RobotIP", "RouterIccid"]);
|
|
64584
|
+
var LEVEL_READING = { \u4F4E: "Low", \u4E2D: "Medium", \u9AD8: "High", \u7A7A: "Empty", \u6EE1: "Full" };
|
|
64585
|
+
function ounitechReadings(props, station = false) {
|
|
64586
|
+
const defs = station ? STATION_READINGS : READINGS;
|
|
64587
|
+
const out = [];
|
|
64588
|
+
for (const p of Array.isArray(props) ? props : []) {
|
|
64589
|
+
const key = String(p?.key ?? "").trim();
|
|
64590
|
+
if (!key || HIDDEN_READINGS.has(key))
|
|
64591
|
+
continue;
|
|
64592
|
+
const raw = p?.value == null ? "" : String(p.value).trim();
|
|
64593
|
+
if (raw === "" || raw === "-")
|
|
64594
|
+
continue;
|
|
64595
|
+
const d = defs[key] ?? { group: station ? "Base station" : "Other readings", label: key };
|
|
64596
|
+
let value;
|
|
64597
|
+
if (raw === "true" || raw === "false")
|
|
64598
|
+
value = raw === "true" ? "Yes" : "No";
|
|
64599
|
+
else if (key === "job")
|
|
64600
|
+
value = JOB_WORDS[raw] ?? raw;
|
|
64601
|
+
else if (key === "status")
|
|
64602
|
+
value = ROBOT_STATUS_NAMES[STATUS_CODE_BY_READING[raw] ?? -1] ?? raw;
|
|
64603
|
+
else if (LEVEL_READING[raw])
|
|
64604
|
+
value = LEVEL_READING[raw];
|
|
64605
|
+
else if (key === "acc-time" && num(raw) !== void 0)
|
|
64606
|
+
value = `${Math.round(num(raw) / 60)} min`;
|
|
64607
|
+
else
|
|
64608
|
+
value = d.unit === "%" ? `${raw}%` : d.unit ? `${raw} ${d.unit}` : raw;
|
|
64609
|
+
out.push({ key, group: d.group, label: d.label, value, attention: !!d.bad && raw === d.bad });
|
|
64610
|
+
}
|
|
64611
|
+
return out;
|
|
64612
|
+
}
|
|
64613
|
+
var PART_WORDS = {
|
|
64614
|
+
left_side_brush_plastic: "Left side brush",
|
|
64615
|
+
right_side_brush_plastic: "Right side brush",
|
|
64616
|
+
dust_bag: "Dust bag",
|
|
64617
|
+
single_suction_mouth_rubber: "Suction rubber",
|
|
64618
|
+
floor_brush_double_roller_structure: "Floor brush rollers",
|
|
64619
|
+
floor_mop_double_roller_structure: "Mop rollers"
|
|
64620
|
+
};
|
|
64621
|
+
function ounitechConsumable(u) {
|
|
64622
|
+
const code = String(u.unitcode ?? "").trim();
|
|
64623
|
+
const minutes = num(u.workminutes);
|
|
64624
|
+
return {
|
|
64625
|
+
part: PART_WORDS[code] ?? (code.replace(/_/g, " ") || String(u.unitname ?? "").trim() || "Part"),
|
|
64626
|
+
hours: minutes !== void 0 ? Math.round(minutes / 6) / 10 : null,
|
|
64627
|
+
days: num(u.workdays) ?? null
|
|
64628
|
+
};
|
|
64629
|
+
}
|
|
64630
|
+
function ounitechPowerPlan(p) {
|
|
64631
|
+
return {
|
|
64632
|
+
days: (Array.isArray(p.dateList) ? p.dateList : []).map(Number).filter((d) => d >= 1 && d <= 7),
|
|
64633
|
+
time: String(p.actionTime ?? "").trim(),
|
|
64634
|
+
action: Number(p.actionFlag) === 1 ? "on" : "off",
|
|
64635
|
+
enabled: p.enableFlag !== false
|
|
64636
|
+
};
|
|
64637
|
+
}
|
|
64638
|
+
var MAP_TTL_MS = 10 * 6e4;
|
|
64639
|
+
var RECORDS_TTL_MS = 2 * 6e4;
|
|
64640
|
+
var mapCache = /* @__PURE__ */ new Map();
|
|
64641
|
+
var recordsCache = /* @__PURE__ */ new Map();
|
|
64642
|
+
function cached2(cache3, field, key, ttl, load) {
|
|
64643
|
+
const hit = cache3.get(key);
|
|
64644
|
+
if (hit && Date.now() - hit.at < ttl)
|
|
64645
|
+
return hit[field];
|
|
64646
|
+
const p = load();
|
|
64647
|
+
cache3.set(key, { at: Date.now(), [field]: p });
|
|
64648
|
+
p.catch(() => cache3.delete(key));
|
|
64649
|
+
return p;
|
|
64650
|
+
}
|
|
64651
|
+
function clearOunitechCaches() {
|
|
64652
|
+
mapCache.clear();
|
|
64653
|
+
recordsCache.clear();
|
|
64654
|
+
}
|
|
64306
64655
|
var robotTime = (d) => robotCloudTimestamp(d, "yyyy-MM-dd HH:mm:ss", "Asia/Shanghai");
|
|
64307
64656
|
function createOunitechAdapter(credentials, options) {
|
|
64308
64657
|
const cloud = useRobotCloudService(credentials, options);
|
|
64309
64658
|
async function liveFor(row) {
|
|
64310
64659
|
return needsLiveState(row) ? cloud.getRobotState(row.robotId).catch(() => null) : null;
|
|
64311
64660
|
}
|
|
64661
|
+
function floorMaps(sceneId) {
|
|
64662
|
+
return cached2(mapCache, "maps", `${options?.baseUrl ?? ""}|${credentials.appid}|${sceneId}`, MAP_TTL_MS, async () => {
|
|
64663
|
+
const list = (await cloud.getFloorMaps(sceneId)).filter((m) => m.latestFlag !== false);
|
|
64664
|
+
const keys = list.flatMap((m) => [m.backgroundFileKey, m.partitionFileKey]).filter((k) => typeof k === "string" && !!k);
|
|
64665
|
+
const files = keys.length ? await cloud.previewFiles(keys).catch(() => []) : [];
|
|
64666
|
+
const url2 = (k) => files.find((f) => f.fileKey === k)?.url || null;
|
|
64667
|
+
return Promise.all(
|
|
64668
|
+
list.map(async (m) => {
|
|
64669
|
+
const imageUrl = url2(m.backgroundFileKey);
|
|
64670
|
+
return ounitechMapView(m, imageUrl, url2(m.partitionFileKey), imageUrl ? await fetchPngSize(imageUrl) : null);
|
|
64671
|
+
})
|
|
64672
|
+
);
|
|
64673
|
+
});
|
|
64674
|
+
}
|
|
64675
|
+
async function placed(row, robot) {
|
|
64676
|
+
if (!robot.online || !finite(row.sceneId))
|
|
64677
|
+
return robot;
|
|
64678
|
+
const maps = await floorMaps(row.sceneId).catch(() => []);
|
|
64679
|
+
const map = ounitechCurrentMap(maps, row.taskState?.mapId, robot.floorNo);
|
|
64680
|
+
if (!map)
|
|
64681
|
+
return robot;
|
|
64682
|
+
robot.mapId = map.mapId;
|
|
64683
|
+
robot.planPosition = robot.position ? ounitechMapShare(map, robot.position.x, robot.position.y) : null;
|
|
64684
|
+
return robot;
|
|
64685
|
+
}
|
|
64312
64686
|
async function rowFor(robotSn) {
|
|
64313
64687
|
return (await cloud.getHomeRobots()).find((r) => r.robotSn === robotSn) ?? null;
|
|
64314
64688
|
}
|
|
@@ -64317,7 +64691,9 @@ function createOunitechAdapter(credentials, options) {
|
|
|
64317
64691
|
displayName: "Ounitech (Q3-G / Q3-W)",
|
|
64318
64692
|
capabilities: OUNITECH_CAPABILITIES,
|
|
64319
64693
|
async listRobots() {
|
|
64320
|
-
return Promise.all(
|
|
64694
|
+
return Promise.all(
|
|
64695
|
+
(await cloud.getHomeRobots()).map(async (row) => placed(row, ounitechRobotFromHomeRow(row, await liveFor(row))))
|
|
64696
|
+
);
|
|
64321
64697
|
},
|
|
64322
64698
|
async getRobot(robotSn) {
|
|
64323
64699
|
const row = await rowFor(robotSn);
|
|
@@ -64333,7 +64709,7 @@ function createOunitechAdapter(credentials, options) {
|
|
|
64333
64709
|
position: null
|
|
64334
64710
|
};
|
|
64335
64711
|
}
|
|
64336
|
-
return ounitechRobotFromHomeRow(row, await liveFor(row));
|
|
64712
|
+
return placed(row, ounitechRobotFromHomeRow(row, await liveFor(row)));
|
|
64337
64713
|
},
|
|
64338
64714
|
async sendCommand(robotSn, command) {
|
|
64339
64715
|
const options2 = {
|
|
@@ -64361,31 +64737,16 @@ function createOunitechAdapter(credentials, options) {
|
|
|
64361
64737
|
);
|
|
64362
64738
|
}
|
|
64363
64739
|
},
|
|
64364
|
-
/**
|
|
64740
|
+
/**
|
|
64741
|
+
* Chapter 6 floor maps (walls left out - they are large): the chapter-2
|
|
64742
|
+
* fields plus `mapId`, `imageUrl`, `width` / `height` (from the PNG) and
|
|
64743
|
+
* the areas' centres, so robot detail draws the real map with the robot on it.
|
|
64744
|
+
*/
|
|
64365
64745
|
async getMaps(robotSn) {
|
|
64366
64746
|
const row = await rowFor(robotSn);
|
|
64367
64747
|
if (!row || !finite(row.sceneId))
|
|
64368
64748
|
return [];
|
|
64369
|
-
return (
|
|
64370
|
-
floorNo: m.floorNo,
|
|
64371
|
-
mapName: m.mapName,
|
|
64372
|
-
backgroundFileKey: m.backgroundFileKey,
|
|
64373
|
-
partitionFileKey: m.partitionFileKey,
|
|
64374
|
-
originX: m.originX,
|
|
64375
|
-
originY: m.originY,
|
|
64376
|
-
resolution: m.resolution,
|
|
64377
|
-
totalArea: m.totalArea,
|
|
64378
|
-
baseX: m.baseX,
|
|
64379
|
-
baseY: m.baseY,
|
|
64380
|
-
baseTheta: m.baseTheta,
|
|
64381
|
-
createTime: m.createTime,
|
|
64382
|
-
areaList: (Array.isArray(m.areaList) ? m.areaList : []).map((a) => ({
|
|
64383
|
-
areaName: a.areaName,
|
|
64384
|
-
rgba: a.rgba,
|
|
64385
|
-
x: a.x,
|
|
64386
|
-
y: a.y
|
|
64387
|
-
}))
|
|
64388
|
-
}));
|
|
64749
|
+
return floorMaps(row.sceneId);
|
|
64389
64750
|
},
|
|
64390
64751
|
async getMapImages(_robotSn, fileKeys) {
|
|
64391
64752
|
return cloud.previewFiles(fileKeys);
|
|
@@ -64404,6 +64765,53 @@ function createOunitechAdapter(credentials, options) {
|
|
|
64404
64765
|
jobList: p.cleanList ?? p.jobList ?? []
|
|
64405
64766
|
}));
|
|
64406
64767
|
},
|
|
64768
|
+
/**
|
|
64769
|
+
* Robot detail's records (read-only, cached 2 min - the vendor rate-limits):
|
|
64770
|
+
* cleaning jobs (14 days), alert history (30 days), consumable hours, power
|
|
64771
|
+
* schedule, lifts, every live reading and the base station. Reads run one
|
|
64772
|
+
* after another (gentler on the rate limit); each part carries its own error.
|
|
64773
|
+
*/
|
|
64774
|
+
async getRecords(robotSn) {
|
|
64775
|
+
return cached2(recordsCache, "value", `${options?.baseUrl ?? ""}|${credentials.appid}|${robotSn}`, RECORDS_TTL_MS, async () => {
|
|
64776
|
+
const row = await rowFor(robotSn);
|
|
64777
|
+
if (!row || !finite(row.robotId))
|
|
64778
|
+
return { supported: true, error: `Serial ${robotSn} is not on this Ounitech account.` };
|
|
64779
|
+
const robotId = row.robotId;
|
|
64780
|
+
const tz = finite(row.timezone) ? row.timezone : 480;
|
|
64781
|
+
const now = /* @__PURE__ */ new Date();
|
|
64782
|
+
const since = (days) => robotTime(new Date(now.getTime() - days * 864e5));
|
|
64783
|
+
const part = async (read2) => {
|
|
64784
|
+
try {
|
|
64785
|
+
return { items: await read2() };
|
|
64786
|
+
} catch (e) {
|
|
64787
|
+
return { items: [], error: String(e?.message ?? e).slice(0, 300) };
|
|
64788
|
+
}
|
|
64789
|
+
};
|
|
64790
|
+
const maps = finite(row.sceneId) ? await floorMaps(row.sceneId).catch(() => []) : [];
|
|
64791
|
+
const tasks = await part(
|
|
64792
|
+
async () => ((await cloud.getTaskList(robotId, since(14), robotTime(now))).taskList ?? []).map((t) => ounitechTaskRecord(t, maps, tz)).sort((a, b) => String(b.start ?? "").localeCompare(String(a.start ?? ""))).slice(0, 50)
|
|
64793
|
+
);
|
|
64794
|
+
const alerts = await part(
|
|
64795
|
+
async () => ((await cloud.getAlerts(robotId, since(30), robotTime(now))).alertList ?? []).map((a) => ounitechAlertRecord(a, tz))
|
|
64796
|
+
);
|
|
64797
|
+
const consumables = await part(async () => ((await cloud.getWorkHours(robotId)).unitlist ?? []).map(ounitechConsumable));
|
|
64798
|
+
const power = await part(async () => ((await cloud.getHaltPlans(robotId)).planList ?? []).map(ounitechPowerPlan));
|
|
64799
|
+
const lifts = finite(row.sceneId) ? await part(
|
|
64800
|
+
async () => ((await cloud.getLiftList(row.sceneId)).liftlist ?? []).map((l) => ({
|
|
64801
|
+
name: String(l.liftname ?? "").trim() || `Lift ${l.liftno ?? ""}`.trim(),
|
|
64802
|
+
floorNo: Number.isInteger(l.floorno) ? l.floorno : null,
|
|
64803
|
+
online: Number(l.onlineflag) === 1,
|
|
64804
|
+
enabled: l.enableflag !== false
|
|
64805
|
+
}))
|
|
64806
|
+
) : { items: [] };
|
|
64807
|
+
const readings = await part(async () => ounitechReadings((await cloud.getRobotState(robotId)).properties));
|
|
64808
|
+
const station = await part(async () => {
|
|
64809
|
+
const st = await cloud.getStationState(robotId);
|
|
64810
|
+
return st ? [{ status: String(st.statusName ?? "").trim() || null, readings: ounitechReadings(st.properties, true) }] : [];
|
|
64811
|
+
});
|
|
64812
|
+
return { supported: true, readAt: now.toISOString(), tasks, alerts, consumables, power, lifts, readings, station };
|
|
64813
|
+
});
|
|
64814
|
+
},
|
|
64407
64815
|
/**
|
|
64408
64816
|
* Staff Diagnose: every other read-only chapter-6 call, with the vendor's
|
|
64409
64817
|
* answer (lists cut to 3). Never a command, never the signed envelope.
|
|
@@ -64477,6 +64885,9 @@ function createOunitechAdapter(credentials, options) {
|
|
|
64477
64885
|
const r = await cloud.getAlerts(robotId, window.timeFrom, window.timeTo);
|
|
64478
64886
|
return { total: r.total ?? r.alertList?.length ?? 0, latest: cut(r.alertList ?? []) };
|
|
64479
64887
|
});
|
|
64888
|
+
await run("consumable hours (get-work-hours)", ROBOT_CLOUD_PATHS.workHours, { robotId }, async () => cut((await cloud.getWorkHours(robotId)).unitlist ?? []));
|
|
64889
|
+
await run("power schedule (halt-plan/get)", ROBOT_CLOUD_PATHS.haltPlans, { robotId }, async () => cut((await cloud.getHaltPlans(robotId)).planList ?? []));
|
|
64890
|
+
await run("base station (get-station-detail-state)", ROBOT_CLOUD_PATHS.stationState, { robotId, options: "state" }, async () => cloud.getStationState(robotId));
|
|
64480
64891
|
if (finite(row.sceneId)) {
|
|
64481
64892
|
const sceneId = row.sceneId;
|
|
64482
64893
|
await run("lifts (get-lift-list)", ROBOT_CLOUD_PATHS.liftList, { sceneid: sceneId }, async () => {
|
|
@@ -64510,7 +64921,7 @@ var OUNITECH_BRAND_DEFINITION = {
|
|
|
64510
64921
|
{ name: "Q3-G", codes: ["Q3G", "Q3-G"] },
|
|
64511
64922
|
{ name: "Q3-W", codes: ["Q3W", "Q3-W"] }
|
|
64512
64923
|
],
|
|
64513
|
-
info: { makerApp: "the Ounitech app", makerAppOnly: ["pausing or stopping a job", "cleaning across floors"] },
|
|
64924
|
+
info: { makerApp: "the Ounitech app", makerAppOnly: ["pausing or stopping a job", "cleaning across floors", "changing maps, areas and schedules"] },
|
|
64514
64925
|
create: (credentials) => createOunitechAdapter(credentials)
|
|
64515
64926
|
};
|
|
64516
64927
|
function registerOunitechBrand() {
|
|
@@ -65309,7 +65720,7 @@ function createOpenRmfClient(config2, deps) {
|
|
|
65309
65720
|
throw new OpenRmfError("The fleet server sent a reply that is not JSON.");
|
|
65310
65721
|
}
|
|
65311
65722
|
}
|
|
65312
|
-
function
|
|
65723
|
+
function cached4(key, ttlMs, load) {
|
|
65313
65724
|
const k = `${config2?.baseUrl}|${key}`;
|
|
65314
65725
|
const hit = cache.get(k);
|
|
65315
65726
|
if (hit && now() - hit.at < ttlMs)
|
|
@@ -65321,8 +65732,8 @@ function createOpenRmfClient(config2, deps) {
|
|
|
65321
65732
|
}
|
|
65322
65733
|
const enc2 = encodeURIComponent;
|
|
65323
65734
|
return {
|
|
65324
|
-
fleets: () =>
|
|
65325
|
-
buildingMap: () =>
|
|
65735
|
+
fleets: () => cached4("fleets", 1500, () => call("GET", "/fleets")),
|
|
65736
|
+
buildingMap: () => cached4("building_map", 6e4, () => call("GET", "/building_map")),
|
|
65326
65737
|
doors: () => call("GET", "/doors"),
|
|
65327
65738
|
doorState: (name) => call("GET", `/doors/${enc2(name)}/state`),
|
|
65328
65739
|
doorRequest: (name, mode) => call("POST", `/doors/${enc2(name)}/request`, { mode }),
|
|
@@ -66766,7 +67177,7 @@ function mapSummary(m) {
|
|
|
66766
67177
|
}
|
|
66767
67178
|
var CACHE_TTL_MS = 5 * 6e4;
|
|
66768
67179
|
var cache2 = /* @__PURE__ */ new Map();
|
|
66769
|
-
function
|
|
67180
|
+
function cached3(key, load) {
|
|
66770
67181
|
const hit = cache2.get(key);
|
|
66771
67182
|
if (hit && Date.now() - hit.at < CACHE_TTL_MS)
|
|
66772
67183
|
return hit.value;
|
|
@@ -66852,8 +67263,8 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
66852
67263
|
const ns = `${credentials.appid}@${options.baseUrl ?? padbotBaseUrl()}`;
|
|
66853
67264
|
const account = padbotAccountKey(credentials);
|
|
66854
67265
|
const callRaw = call;
|
|
66855
|
-
const roster = () =>
|
|
66856
|
-
const maps = (sn) =>
|
|
67266
|
+
const roster = () => cached3(`${ns}:robots`, () => call(PADBOT_PATHS.robots, { robotTypes: ["PATROL"] }));
|
|
67267
|
+
const maps = (sn) => cached3(`${ns}:maps:${sn}`, () => call(PADBOT_PATHS.maps, { serialNumber: sn }).then(asList));
|
|
66857
67268
|
const states = async (sn) => {
|
|
66858
67269
|
const list = await call(PADBOT_PATHS.states, { serialNumbers: [sn] });
|
|
66859
67270
|
const entry = (list ?? []).find((e) => e?.serialNumber === sn);
|
|
@@ -67276,6 +67687,7 @@ function fleetStateItem(id, s, lastSeenAt) {
|
|
|
67276
67687
|
fault: s.fault,
|
|
67277
67688
|
capabilities: s.capabilities,
|
|
67278
67689
|
profile: s.profile,
|
|
67690
|
+
cleaning: s.cleaning ?? null,
|
|
67279
67691
|
lastSeenAt: lastSeenAt ? new Date(lastSeenAt) : null
|
|
67280
67692
|
};
|
|
67281
67693
|
}
|
|
@@ -67404,7 +67816,8 @@ function useRobotFleetService(deps) {
|
|
|
67404
67816
|
planPosition: found.planPosition ?? null,
|
|
67405
67817
|
fault,
|
|
67406
67818
|
capabilities: manifest.capabilities,
|
|
67407
|
-
profile: manifest.profile
|
|
67819
|
+
profile: manifest.profile,
|
|
67820
|
+
cleaning: manifest.capabilities.waterTanks === true && found.online ? found.cleaning ?? null : null
|
|
67408
67821
|
};
|
|
67409
67822
|
}
|
|
67410
67823
|
async function getMaps(robot) {
|
|
@@ -67419,6 +67832,12 @@ function useRobotFleetService(deps) {
|
|
|
67419
67832
|
return [];
|
|
67420
67833
|
return adapter.getMapImages(await resolveRobotSn(robot), fileKeys);
|
|
67421
67834
|
}
|
|
67835
|
+
async function getRecords(robot) {
|
|
67836
|
+
const adapter = adapterFor(robot);
|
|
67837
|
+
if (!adapter.getRecords)
|
|
67838
|
+
return null;
|
|
67839
|
+
return adapter.getRecords(await resolveRobotSn(robot));
|
|
67840
|
+
}
|
|
67422
67841
|
async function getPlans(robot) {
|
|
67423
67842
|
const adapter = adapterFor(robot);
|
|
67424
67843
|
if (!adapter.getPlans)
|
|
@@ -67788,6 +68207,7 @@ function useRobotFleetService(deps) {
|
|
|
67788
68207
|
getMaps,
|
|
67789
68208
|
getMapImages,
|
|
67790
68209
|
getPlans,
|
|
68210
|
+
getRecords,
|
|
67791
68211
|
getPatrolRoutes,
|
|
67792
68212
|
dispatch: dispatch2
|
|
67793
68213
|
};
|
|
@@ -70381,9 +70801,9 @@ function rmfSummary(rmf) {
|
|
|
70381
70801
|
}
|
|
70382
70802
|
|
|
70383
70803
|
// src/services/robot-tracking.service.ts
|
|
70384
|
-
import
|
|
70804
|
+
import axios5 from "axios";
|
|
70385
70805
|
async function openWithAxios(url2, body) {
|
|
70386
|
-
const response = await
|
|
70806
|
+
const response = await axios5.post(url2, body, {
|
|
70387
70807
|
responseType: "stream",
|
|
70388
70808
|
// No read timeout: this connection is SUPPOSED to stay open and mostly
|
|
70389
70809
|
// silent. A request timeout here would sever a healthy stream on a quiet
|
|
@@ -70596,6 +71016,14 @@ function useRobotFleetController(deps) {
|
|
|
70596
71016
|
fail(next, error);
|
|
70597
71017
|
}
|
|
70598
71018
|
}
|
|
71019
|
+
async function getRecords(req, res, next) {
|
|
71020
|
+
try {
|
|
71021
|
+
const robot = await entitleRobot(req, req.params.id);
|
|
71022
|
+
res.json(await getFleet2().getRecords(robot) ?? { supported: false });
|
|
71023
|
+
} catch (error) {
|
|
71024
|
+
fail(next, error);
|
|
71025
|
+
}
|
|
71026
|
+
}
|
|
70599
71027
|
async function getPatrolRoutes(req, res, next) {
|
|
70600
71028
|
try {
|
|
70601
71029
|
const robot = await entitleRobot(req, req.params.id);
|
|
@@ -70889,6 +71317,7 @@ function useRobotFleetController(deps) {
|
|
|
70889
71317
|
getMaps,
|
|
70890
71318
|
getMapImages,
|
|
70891
71319
|
getPlans,
|
|
71320
|
+
getRecords,
|
|
70892
71321
|
getPatrolRoutes,
|
|
70893
71322
|
sendCommand: sendCommand2,
|
|
70894
71323
|
trackRobot,
|
|
@@ -79657,13 +80086,13 @@ function useSiteBillingItemRepo() {
|
|
|
79657
80086
|
}
|
|
79658
80087
|
const cacheKey = makeCacheKey44(namespace_collection3, { _id: String(_id) });
|
|
79659
80088
|
try {
|
|
79660
|
-
const
|
|
79661
|
-
if (
|
|
80089
|
+
const cached4 = await getCache(cacheKey);
|
|
80090
|
+
if (cached4) {
|
|
79662
80091
|
logger142.log({
|
|
79663
80092
|
level: "info",
|
|
79664
80093
|
message: `Cache hit for getById site billing items: ${cacheKey}`
|
|
79665
80094
|
});
|
|
79666
|
-
return
|
|
80095
|
+
return cached4;
|
|
79667
80096
|
}
|
|
79668
80097
|
const result = await collection.findOne({
|
|
79669
80098
|
_id
|
|
@@ -80031,13 +80460,13 @@ function useSiteBillingConfigurationRepo() {
|
|
|
80031
80460
|
}
|
|
80032
80461
|
const cacheKey = makeCacheKey45(namespace_collection3, { _id: String(_id) });
|
|
80033
80462
|
try {
|
|
80034
|
-
const
|
|
80035
|
-
if (
|
|
80463
|
+
const cached4 = await getCache(cacheKey);
|
|
80464
|
+
if (cached4) {
|
|
80036
80465
|
logger144.log({
|
|
80037
80466
|
level: "info",
|
|
80038
80467
|
message: `Cache hit for getById site billing configuration: ${cacheKey}`
|
|
80039
80468
|
});
|
|
80040
|
-
return
|
|
80469
|
+
return cached4;
|
|
80041
80470
|
}
|
|
80042
80471
|
const result = await collection.findOne({
|
|
80043
80472
|
_id
|
|
@@ -81708,13 +82137,13 @@ function useSiteUnitBillingRepo() {
|
|
|
81708
82137
|
}
|
|
81709
82138
|
const cacheKey = makeCacheKey47(namespace_collection3, { _id: String(_id) });
|
|
81710
82139
|
try {
|
|
81711
|
-
const
|
|
81712
|
-
if (
|
|
82140
|
+
const cached4 = await getCache(cacheKey);
|
|
82141
|
+
if (cached4) {
|
|
81713
82142
|
logger152.log({
|
|
81714
82143
|
level: "info",
|
|
81715
82144
|
message: `Cache hit for getById site unit billing: ${cacheKey}`
|
|
81716
82145
|
});
|
|
81717
|
-
return
|
|
82146
|
+
return cached4;
|
|
81718
82147
|
}
|
|
81719
82148
|
const result = await collection.findOne({
|
|
81720
82149
|
_id
|
|
@@ -84539,13 +84968,13 @@ function useNfcPatrolRouteRepo() {
|
|
|
84539
84968
|
}
|
|
84540
84969
|
const cacheKey = makeCacheKey49(namespace_collection3, cacheParams);
|
|
84541
84970
|
try {
|
|
84542
|
-
const
|
|
84543
|
-
if (
|
|
84971
|
+
const cached4 = await getCache(cacheKey);
|
|
84972
|
+
if (cached4) {
|
|
84544
84973
|
logger157.log({
|
|
84545
84974
|
level: "info",
|
|
84546
84975
|
message: `Cache hit for getById ${namespace_collection3}: ${cacheKey}`
|
|
84547
84976
|
});
|
|
84548
|
-
return
|
|
84977
|
+
return cached4;
|
|
84549
84978
|
}
|
|
84550
84979
|
let result;
|
|
84551
84980
|
if (isStart === true) {
|
|
@@ -86015,13 +86444,13 @@ function useStatementOfAccountRepo() {
|
|
|
86015
86444
|
}
|
|
86016
86445
|
const cacheKey = makeCacheKey51(namespace_collection3, { _id: String(_id) });
|
|
86017
86446
|
try {
|
|
86018
|
-
const
|
|
86019
|
-
if (
|
|
86447
|
+
const cached4 = await getCache(cacheKey);
|
|
86448
|
+
if (cached4) {
|
|
86020
86449
|
logger163.log({
|
|
86021
86450
|
level: "info",
|
|
86022
86451
|
message: `Cache hit for getById soa: ${cacheKey}`
|
|
86023
86452
|
});
|
|
86024
|
-
return
|
|
86453
|
+
return cached4;
|
|
86025
86454
|
}
|
|
86026
86455
|
const result = await collection.findOne({
|
|
86027
86456
|
_id
|
|
@@ -93195,7 +93624,7 @@ import {
|
|
|
93195
93624
|
} from "@7365admin1/node-server-utils";
|
|
93196
93625
|
|
|
93197
93626
|
// src/utils/hrmlabs-attendance.util.ts
|
|
93198
|
-
import
|
|
93627
|
+
import axios6 from "axios";
|
|
93199
93628
|
import moment8 from "moment-timezone";
|
|
93200
93629
|
var default_early_checkIn = 4;
|
|
93201
93630
|
async function hrmLabsAuthentication({
|
|
@@ -93204,7 +93633,7 @@ async function hrmLabsAuthentication({
|
|
|
93204
93633
|
password,
|
|
93205
93634
|
domain
|
|
93206
93635
|
}) {
|
|
93207
|
-
const res = await
|
|
93636
|
+
const res = await axios6.post(
|
|
93208
93637
|
authUrl,
|
|
93209
93638
|
{
|
|
93210
93639
|
grant_type: "password",
|
|
@@ -93234,7 +93663,7 @@ async function fetchAttendanceData({
|
|
|
93234
93663
|
search
|
|
93235
93664
|
}) {
|
|
93236
93665
|
try {
|
|
93237
|
-
const res = await
|
|
93666
|
+
const res = await axios6.post(
|
|
93238
93667
|
attendanceUrl,
|
|
93239
93668
|
{
|
|
93240
93669
|
start: startDate,
|
|
@@ -93434,7 +93863,7 @@ async function fetchSites({ siteUrl, token }) {
|
|
|
93434
93863
|
do {
|
|
93435
93864
|
try {
|
|
93436
93865
|
attempt++;
|
|
93437
|
-
const res = await
|
|
93866
|
+
const res = await axios6.get(siteUrl, {
|
|
93438
93867
|
headers: { Authorization: `Bearer ${token}` },
|
|
93439
93868
|
timeout: 15e3
|
|
93440
93869
|
});
|
|
@@ -97035,7 +97464,7 @@ async function manpowerEvents(io) {
|
|
|
97035
97464
|
}
|
|
97036
97465
|
|
|
97037
97466
|
// src/services/reddot-payment.service.ts
|
|
97038
|
-
import
|
|
97467
|
+
import axios7 from "axios";
|
|
97039
97468
|
|
|
97040
97469
|
// src/utils/payment-signature.util.ts
|
|
97041
97470
|
import * as crypto11 from "crypto";
|
|
@@ -97677,7 +98106,7 @@ var useRedDotPaymentSvc = () => {
|
|
|
97677
98106
|
);
|
|
97678
98107
|
}
|
|
97679
98108
|
const url2 = process.env.MERCHANT_PAYMENT;
|
|
97680
|
-
const response = await
|
|
98109
|
+
const response = await axios7.post(url2, dataString, { headers });
|
|
97681
98110
|
const result = response.data;
|
|
97682
98111
|
return result;
|
|
97683
98112
|
} catch (error) {
|
|
@@ -97711,7 +98140,7 @@ var useRedDotPaymentSvc = () => {
|
|
|
97711
98140
|
);
|
|
97712
98141
|
}
|
|
97713
98142
|
const url2 = process.env.MERCHANT_ENQUIRY;
|
|
97714
|
-
const response = await
|
|
98143
|
+
const response = await axios7.post(url2, dataString, { headers });
|
|
97715
98144
|
const result = response.data;
|
|
97716
98145
|
const transactionId = result.transaction_id;
|
|
97717
98146
|
const amount = result.request_amount || 0;
|
|
@@ -106990,6 +107419,7 @@ export {
|
|
|
106990
107419
|
claimReadsAsStale,
|
|
106991
107420
|
clampChassis,
|
|
106992
107421
|
clampPtzSpeed,
|
|
107422
|
+
clearOunitechCaches,
|
|
106993
107423
|
clearPadbotCache,
|
|
106994
107424
|
clearRobotBrands,
|
|
106995
107425
|
clockDriftSeconds,
|
|
@@ -107183,9 +107613,19 @@ export {
|
|
|
107183
107613
|
orgQualifiesForOwnerRepair,
|
|
107184
107614
|
orgRoleSets,
|
|
107185
107615
|
orgSchema,
|
|
107616
|
+
ounitechAlertRecord,
|
|
107617
|
+
ounitechCleaning,
|
|
107618
|
+
ounitechConsumable,
|
|
107619
|
+
ounitechCurrentMap,
|
|
107186
107620
|
ounitechFault,
|
|
107187
107621
|
ounitechJobWords,
|
|
107622
|
+
ounitechMapShare,
|
|
107623
|
+
ounitechMapView,
|
|
107624
|
+
ounitechPowerPlan,
|
|
107625
|
+
ounitechReadings,
|
|
107188
107626
|
ounitechRobotFromHomeRow,
|
|
107627
|
+
ounitechTaskRecord,
|
|
107628
|
+
ounitechTime,
|
|
107189
107629
|
overnight_parking_requests_namespace_collection,
|
|
107190
107630
|
padbotAccountKey,
|
|
107191
107631
|
padbotAlarmFault,
|
|
@@ -107238,6 +107678,7 @@ export {
|
|
|
107238
107678
|
platform_terms_namespace_collection,
|
|
107239
107679
|
playbackRelays,
|
|
107240
107680
|
playbackWindowRefusal,
|
|
107681
|
+
pngSize,
|
|
107241
107682
|
promoCodeRefusal,
|
|
107242
107683
|
promoCodeSchema,
|
|
107243
107684
|
promoCodeStatusSchema,
|