@7365admin1/core 3.118.0 → 3.119.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 +6 -0
- package/dist/index.d.ts +53 -11
- package/dist/index.js +88 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +137 -58
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/test/ounitech-timestamp-probe.test.mjs +112 -0
package/dist/index.mjs
CHANGED
|
@@ -61990,7 +61990,7 @@ function clearRobotBrands() {
|
|
|
61990
61990
|
}
|
|
61991
61991
|
|
|
61992
61992
|
// src/services/robot-fleet.service.ts
|
|
61993
|
-
import { BadRequestError as BadRequestError136, NotFoundError as NotFoundError43 } from "@7365admin1/node-server-utils";
|
|
61993
|
+
import { AppError as AppError25, BadRequestError as BadRequestError136, NotFoundError as NotFoundError43 } from "@7365admin1/node-server-utils";
|
|
61994
61994
|
|
|
61995
61995
|
// src/services/robot-cloud.service.ts
|
|
61996
61996
|
import axios3 from "axios";
|
|
@@ -62001,9 +62001,36 @@ import * as crypto10 from "crypto";
|
|
|
62001
62001
|
function robotCloudSigningString(appid, timestamp, path5, secret) {
|
|
62002
62002
|
return `appid=${appid},timestamp=${timestamp},url=${path5},secret=${secret}`;
|
|
62003
62003
|
}
|
|
62004
|
-
|
|
62004
|
+
var ROBOT_CLOUD_TIMESTAMP_FORMATS = [
|
|
62005
|
+
"yyyyMMddHHmmss",
|
|
62006
|
+
"unix-s",
|
|
62007
|
+
"unix-ms",
|
|
62008
|
+
"yyyy-MM-dd HH:mm:ss",
|
|
62009
|
+
"iso8601",
|
|
62010
|
+
"unix-s-number",
|
|
62011
|
+
"unix-ms-number"
|
|
62012
|
+
];
|
|
62013
|
+
var OUNITECH_TIMESTAMP_FORMAT = "yyyyMMddHHmmss";
|
|
62014
|
+
function robotCloudTimestamp(now = /* @__PURE__ */ new Date(), format2 = OUNITECH_TIMESTAMP_FORMAT) {
|
|
62005
62015
|
const p = (n, w = 2) => String(n).padStart(w, "0");
|
|
62006
|
-
|
|
62016
|
+
const date = `${p(now.getUTCFullYear(), 4)}-${p(now.getUTCMonth() + 1)}-${p(now.getUTCDate())}`;
|
|
62017
|
+
const time = `${p(now.getUTCHours())}:${p(now.getUTCMinutes())}:${p(now.getUTCSeconds())}`;
|
|
62018
|
+
switch (format2) {
|
|
62019
|
+
case "unix-s":
|
|
62020
|
+
case "unix-s-number":
|
|
62021
|
+
return String(Math.floor(now.getTime() / 1e3));
|
|
62022
|
+
case "unix-ms":
|
|
62023
|
+
case "unix-ms-number":
|
|
62024
|
+
return String(now.getTime());
|
|
62025
|
+
case "yyyy-MM-dd HH:mm:ss":
|
|
62026
|
+
return `${date} ${time}`;
|
|
62027
|
+
case "iso8601":
|
|
62028
|
+
return `${date}T${time}Z`;
|
|
62029
|
+
case "yyyyMMddHHmmss":
|
|
62030
|
+
return `${date}${time}`.replace(/[-:]/g, "");
|
|
62031
|
+
default:
|
|
62032
|
+
throw new Error(`Robot cloud: unknown timestamp format "${format2}".`);
|
|
62033
|
+
}
|
|
62007
62034
|
}
|
|
62008
62035
|
function robotCloudSign(appid, timestamp, path5, secret) {
|
|
62009
62036
|
if (!appid)
|
|
@@ -62015,11 +62042,11 @@ function robotCloudSign(appid, timestamp, path5, secret) {
|
|
|
62015
62042
|
}
|
|
62016
62043
|
return crypto10.createHash("sha1").update(robotCloudSigningString(appid, timestamp, path5, secret)).digest("hex");
|
|
62017
62044
|
}
|
|
62018
|
-
function robotCloudBody(appid, secret, path5, params = {}, now) {
|
|
62019
|
-
const timestamp = robotCloudTimestamp(now);
|
|
62045
|
+
function robotCloudBody(appid, secret, path5, params = {}, now, format2 = OUNITECH_TIMESTAMP_FORMAT) {
|
|
62046
|
+
const timestamp = robotCloudTimestamp(now, format2);
|
|
62020
62047
|
return {
|
|
62021
62048
|
appid,
|
|
62022
|
-
timestamp,
|
|
62049
|
+
timestamp: format2.endsWith("-number") ? Number(timestamp) : timestamp,
|
|
62023
62050
|
sign: robotCloudSign(appid, timestamp, path5, secret),
|
|
62024
62051
|
...params
|
|
62025
62052
|
};
|
|
@@ -62376,7 +62403,9 @@ function useRobotCloudService(credentials, options = {}) {
|
|
|
62376
62403
|
credentials.appid,
|
|
62377
62404
|
credentials.secret,
|
|
62378
62405
|
path5,
|
|
62379
|
-
params
|
|
62406
|
+
params,
|
|
62407
|
+
void 0,
|
|
62408
|
+
options.timestampFormat
|
|
62380
62409
|
);
|
|
62381
62410
|
const step = robotCloudStepName(path5);
|
|
62382
62411
|
let data;
|
|
@@ -65040,6 +65069,8 @@ function registerPadbotBrand() {
|
|
|
65040
65069
|
registerPadbotBrand();
|
|
65041
65070
|
|
|
65042
65071
|
// src/services/robot-fleet.service.ts
|
|
65072
|
+
var lastTimestampProbe = /* @__PURE__ */ new Map();
|
|
65073
|
+
var TIMESTAMP_PROBE_INTERVAL_MS = 6e4;
|
|
65043
65074
|
function cloudHost(baseUrl) {
|
|
65044
65075
|
try {
|
|
65045
65076
|
return new URL(baseUrl).host;
|
|
@@ -65383,8 +65414,50 @@ function useRobotFleetService(deps) {
|
|
|
65383
65414
|
}
|
|
65384
65415
|
return out(null, "Every step worked.");
|
|
65385
65416
|
}
|
|
65417
|
+
async function probeTimestampFormat(robot) {
|
|
65418
|
+
if (String(robot.brand ?? "").trim() !== OUNITECH_BRAND) {
|
|
65419
|
+
throw new BadRequestError136("The timestamp probe is for Ounitech robots only.");
|
|
65420
|
+
}
|
|
65421
|
+
const id = robot._id ? String(robot._id) : "";
|
|
65422
|
+
const last = lastTimestampProbe.get(id);
|
|
65423
|
+
if (last && Date.now() - last < TIMESTAMP_PROBE_INTERVAL_MS) {
|
|
65424
|
+
const wait = Math.ceil((TIMESTAMP_PROBE_INTERVAL_MS - (Date.now() - last)) / 1e3);
|
|
65425
|
+
throw new AppError25(`The timestamp probe ran for this robot less than a minute ago - try again in ${wait} s.`, 429);
|
|
65426
|
+
}
|
|
65427
|
+
const pair = robotCloudCredentials(robot);
|
|
65428
|
+
if (!pair.appid || !pair.secret) {
|
|
65429
|
+
throw new BadRequestError136("No AppID and Secret saved on this robot - run Diagnose first.");
|
|
65430
|
+
}
|
|
65431
|
+
lastTimestampProbe.set(id, Date.now());
|
|
65432
|
+
const baseUrl = deps?.cloudOptions?.baseUrl ?? ROBOT_CLOUD_BASE_URL;
|
|
65433
|
+
const attempts = [];
|
|
65434
|
+
let accepted = null;
|
|
65435
|
+
for (const format2 of ROBOT_CLOUD_TIMESTAMP_FORMATS) {
|
|
65436
|
+
const sent = robotCloudTimestamp(/* @__PURE__ */ new Date(), format2);
|
|
65437
|
+
try {
|
|
65438
|
+
const robots = await useRobotCloudService(pair, { ...deps?.cloudOptions, timestampFormat: format2 }).getRobots();
|
|
65439
|
+
attempts.push({ format: format2, sent, ok: true, detail: `Accepted. The account lists ${robots.length} robot${robots.length === 1 ? "" : "s"}.` });
|
|
65440
|
+
accepted = format2;
|
|
65441
|
+
break;
|
|
65442
|
+
} catch (e) {
|
|
65443
|
+
attempts.push({ format: format2, sent, ok: false, ...describeFailure(e) });
|
|
65444
|
+
if (e instanceof RobotCloudError && (e.kind === "unreachable" || e.kind === "timeout"))
|
|
65445
|
+
break;
|
|
65446
|
+
}
|
|
65447
|
+
}
|
|
65448
|
+
return {
|
|
65449
|
+
robotId: id,
|
|
65450
|
+
cloudHost: cloudHost(baseUrl),
|
|
65451
|
+
currentFormat: OUNITECH_TIMESTAMP_FORMAT,
|
|
65452
|
+
accepted,
|
|
65453
|
+
attempts,
|
|
65454
|
+
summary: accepted ? accepted === OUNITECH_TIMESTAMP_FORMAT ? `Ounitech accepts "${accepted}", the format already in use - the refusal is not the timestamp format.` : `Ounitech accepts "${accepted}". Switch OUNITECH_TIMESTAMP_FORMAT to it.` : "Ounitech accepted none of the formats tried - ask Ounitech for the exact format with an example.",
|
|
65455
|
+
checkedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
65456
|
+
};
|
|
65457
|
+
}
|
|
65386
65458
|
return {
|
|
65387
65459
|
diagnose,
|
|
65460
|
+
probeTimestampFormat,
|
|
65388
65461
|
getLiveVideo,
|
|
65389
65462
|
resolveAlerts,
|
|
65390
65463
|
getPatrolHistory,
|
|
@@ -66763,7 +66836,7 @@ function startPadbotLiveFeed(deps = {}) {
|
|
|
66763
66836
|
|
|
66764
66837
|
// src/services/padbot-drive.service.ts
|
|
66765
66838
|
import { randomBytes as randomBytes3, randomUUID as randomUUID2 } from "crypto";
|
|
66766
|
-
import { AppError as
|
|
66839
|
+
import { AppError as AppError26, BadRequestError as BadRequestError138, logger as logger111 } from "@7365admin1/node-server-utils";
|
|
66767
66840
|
var sessions = /* @__PURE__ */ new Map();
|
|
66768
66841
|
var byRobot = /* @__PURE__ */ new Map();
|
|
66769
66842
|
var endedWhy = /* @__PURE__ */ new Map();
|
|
@@ -66804,7 +66877,7 @@ async function startPadbotDrive(robot, userId, deps = {}) {
|
|
|
66804
66877
|
if (current) {
|
|
66805
66878
|
const s = sessions.get(current);
|
|
66806
66879
|
if (s && s.userId !== userId)
|
|
66807
|
-
throw new
|
|
66880
|
+
throw new AppError26("Someone else is controlling this robot right now.", 409);
|
|
66808
66881
|
s?.watchdog.end("replaced");
|
|
66809
66882
|
}
|
|
66810
66883
|
if (!(deps.linkUp ?? padbotLinkUp)(robotId)) {
|
|
@@ -66881,7 +66954,7 @@ function padbotDriveSignal(robotId, sessionId, userId, signal) {
|
|
|
66881
66954
|
const s = sessions.get(sessionId);
|
|
66882
66955
|
if (!s || s.robotId !== robotId || s.userId !== userId) {
|
|
66883
66956
|
const why = endedWhy.get(sessionId);
|
|
66884
|
-
throw new
|
|
66957
|
+
throw new AppError26(DRIVE_END_TEXT[why?.reason ?? ""] ?? "Manual control has ended.", 410);
|
|
66885
66958
|
}
|
|
66886
66959
|
if (signal.seq <= s.seq)
|
|
66887
66960
|
return { ok: true, moving: s.watchdog.moving };
|
|
@@ -66905,7 +66978,7 @@ function padbotDriveSignal(robotId, sessionId, userId, signal) {
|
|
|
66905
66978
|
}
|
|
66906
66979
|
if (s.watchdog.ended) {
|
|
66907
66980
|
const why = endedWhy.get(sessionId);
|
|
66908
|
-
throw new
|
|
66981
|
+
throw new AppError26(DRIVE_END_TEXT[why?.reason ?? ""] ?? "Manual control has ended.", 410);
|
|
66909
66982
|
}
|
|
66910
66983
|
return { ok: true, moving: s.watchdog.moving };
|
|
66911
66984
|
}
|
|
@@ -68129,7 +68202,7 @@ function startRobotTracking(options) {
|
|
|
68129
68202
|
|
|
68130
68203
|
// src/controllers/robot-fleet.controller.ts
|
|
68131
68204
|
import Joi76 from "joi";
|
|
68132
|
-
import { AppError as
|
|
68205
|
+
import { AppError as AppError27, BadRequestError as BadRequestError139, logger as logger112 } from "@7365admin1/node-server-utils";
|
|
68133
68206
|
function useRobotFleetController(deps) {
|
|
68134
68207
|
let repo = null;
|
|
68135
68208
|
const getRepo = () => repo ?? (repo = useRobotRepo());
|
|
@@ -68159,7 +68232,7 @@ function useRobotFleetController(deps) {
|
|
|
68159
68232
|
if (error?.isOperational)
|
|
68160
68233
|
return next(error);
|
|
68161
68234
|
next(
|
|
68162
|
-
new
|
|
68235
|
+
new AppError27(
|
|
68163
68236
|
"Couldn't read this robot from its cloud (unexpected error). Seven365 staff can run Diagnose on the robot to see the failing step.",
|
|
68164
68237
|
502
|
|
68165
68238
|
)
|
|
@@ -68445,9 +68518,13 @@ function useRobotFleetController(deps) {
|
|
|
68445
68518
|
async function diagnoseRobot(req, res, next) {
|
|
68446
68519
|
try {
|
|
68447
68520
|
await requirePlatformStaff(req, CROSS_CLIENT_GRANT);
|
|
68521
|
+
const probe = req.query.probe;
|
|
68522
|
+
if (probe !== void 0 && probe !== "timestamp") {
|
|
68523
|
+
return fail(next, new BadRequestError139('probe must be "timestamp".'));
|
|
68524
|
+
}
|
|
68448
68525
|
const robot = await entitleRobot(req, req.params.id);
|
|
68449
68526
|
res.set("Cache-Control", "no-store");
|
|
68450
|
-
res.json(await getFleet2().diagnose(robot));
|
|
68527
|
+
res.json(probe === "timestamp" ? await getFleet2().probeTimestampFormat(robot) : await getFleet2().diagnose(robot));
|
|
68451
68528
|
} catch (error) {
|
|
68452
68529
|
fail(next, error);
|
|
68453
68530
|
}
|
|
@@ -68722,7 +68799,7 @@ import {
|
|
|
68722
68799
|
paginate as paginate35,
|
|
68723
68800
|
BadRequestError as BadRequestError140,
|
|
68724
68801
|
NotFoundError as NotFoundError44,
|
|
68725
|
-
AppError as
|
|
68802
|
+
AppError as AppError28
|
|
68726
68803
|
} from "@7365admin1/node-server-utils";
|
|
68727
68804
|
var NOT_DELETED2 = { deletedAt: { $in: ["", null] } };
|
|
68728
68805
|
function toObjectId16(id, what) {
|
|
@@ -68863,7 +68940,7 @@ function useRobotBuildingMapRepo() {
|
|
|
68863
68940
|
}
|
|
68864
68941
|
);
|
|
68865
68942
|
if (!res.matchedCount) {
|
|
68866
|
-
throw new
|
|
68943
|
+
throw new AppError28(
|
|
68867
68944
|
"This map was changed by someone else since you opened it. Reload it and make your change again.",
|
|
68868
68945
|
409
|
|
68869
68946
|
);
|
|
@@ -68891,7 +68968,7 @@ function useRobotBuildingMapRepo() {
|
|
|
68891
68968
|
const exists = await collection.countDocuments({ _id: id, ...NOT_DELETED2, "floorPlans.floorNo": floorNo2 });
|
|
68892
68969
|
if (!exists)
|
|
68893
68970
|
throw new NotFoundError44("This floor has no plan.");
|
|
68894
|
-
throw new
|
|
68971
|
+
throw new AppError28("This map was changed by someone else since you opened it. Reload it and make your change again.", 409);
|
|
68895
68972
|
}
|
|
68896
68973
|
return version + 1;
|
|
68897
68974
|
}
|
|
@@ -68912,7 +68989,7 @@ function useRobotBuildingMapRepo() {
|
|
|
68912
68989
|
}
|
|
68913
68990
|
);
|
|
68914
68991
|
if (!res.matchedCount) {
|
|
68915
|
-
throw new
|
|
68992
|
+
throw new AppError28(
|
|
68916
68993
|
"This map was changed by someone else since you opened it. Reload it and make your change again.",
|
|
68917
68994
|
409
|
|
68918
68995
|
);
|
|
@@ -69033,7 +69110,7 @@ function useRobotLiftSessionRepo() {
|
|
|
69033
69110
|
insertedId = res.insertedId;
|
|
69034
69111
|
} catch (error) {
|
|
69035
69112
|
if (isDuplicateKey(error)) {
|
|
69036
|
-
throw new
|
|
69113
|
+
throw new AppError28("This robot already has a lift request open. Release it first.", 409);
|
|
69037
69114
|
}
|
|
69038
69115
|
throw error;
|
|
69039
69116
|
}
|
|
@@ -69071,7 +69148,7 @@ function useRobotLiftSessionRepo() {
|
|
|
69071
69148
|
{ $set: { expiresAt: new Date(now.getTime() + LIFT_LEASE_MS), updatedAt: now } }
|
|
69072
69149
|
);
|
|
69073
69150
|
if (!res.matchedCount) {
|
|
69074
|
-
throw new
|
|
69151
|
+
throw new AppError28("This lift session is no longer active.", 409);
|
|
69075
69152
|
}
|
|
69076
69153
|
}
|
|
69077
69154
|
async function release(session, reason = "released") {
|
|
@@ -69129,7 +69206,7 @@ function useRobotLiftSessionRepo() {
|
|
|
69129
69206
|
|
|
69130
69207
|
// src/controllers/robot-map.controller.ts
|
|
69131
69208
|
import Joi78 from "joi";
|
|
69132
|
-
import { AppError as
|
|
69209
|
+
import { AppError as AppError29, BadRequestError as BadRequestError141, NotFoundError as NotFoundError45, logger as logger113 } from "@7365admin1/node-server-utils";
|
|
69133
69210
|
import { load as loadYaml, CORE_SCHEMA as YAML_CORE_SCHEMA } from "js-yaml";
|
|
69134
69211
|
function useRobotMapController(deps) {
|
|
69135
69212
|
const now = () => deps?.now?.() ?? Date.now();
|
|
@@ -69577,7 +69654,7 @@ function useRobotMapController(deps) {
|
|
|
69577
69654
|
try {
|
|
69578
69655
|
const session = await entitleSession(req);
|
|
69579
69656
|
if (!session.open)
|
|
69580
|
-
throw new
|
|
69657
|
+
throw new AppError29("This lift session is already closed.", 409);
|
|
69581
69658
|
await lifts().release(session);
|
|
69582
69659
|
await audit2(
|
|
69583
69660
|
req,
|
|
@@ -69643,7 +69720,7 @@ function useRobotMapController(deps) {
|
|
|
69643
69720
|
liftStates: liftStates.filter(Boolean)
|
|
69644
69721
|
});
|
|
69645
69722
|
} catch (e) {
|
|
69646
|
-
fail(next, e instanceof OpenRmfError ? new
|
|
69723
|
+
fail(next, e instanceof OpenRmfError ? new AppError29(e.message, 502) : e);
|
|
69647
69724
|
}
|
|
69648
69725
|
}
|
|
69649
69726
|
return {
|
|
@@ -70136,7 +70213,7 @@ function MPatrolQuestion(value) {
|
|
|
70136
70213
|
|
|
70137
70214
|
// src/repositories/patrol-question.repo.ts
|
|
70138
70215
|
import {
|
|
70139
|
-
AppError as
|
|
70216
|
+
AppError as AppError30,
|
|
70140
70217
|
BadRequestError as BadRequestError145,
|
|
70141
70218
|
InternalServerError as InternalServerError52,
|
|
70142
70219
|
logger as logger117,
|
|
@@ -70200,7 +70277,7 @@ function usePatrolQuestionRepo() {
|
|
|
70200
70277
|
if (isDuplicated) {
|
|
70201
70278
|
throw new BadRequestError145("Question already exist.");
|
|
70202
70279
|
}
|
|
70203
|
-
if (error instanceof
|
|
70280
|
+
if (error instanceof AppError30) {
|
|
70204
70281
|
throw error;
|
|
70205
70282
|
} else {
|
|
70206
70283
|
throw new Error("Failed to create Patrol Question.");
|
|
@@ -70601,7 +70678,7 @@ function MPatrolRoute(value) {
|
|
|
70601
70678
|
|
|
70602
70679
|
// src/repositories/patrol-route.repo.ts
|
|
70603
70680
|
import {
|
|
70604
|
-
AppError as
|
|
70681
|
+
AppError as AppError31,
|
|
70605
70682
|
BadRequestError as BadRequestError148,
|
|
70606
70683
|
InternalServerError as InternalServerError53,
|
|
70607
70684
|
logger as logger120,
|
|
@@ -70679,7 +70756,7 @@ function usePatrolRouteRepo() {
|
|
|
70679
70756
|
if (isDuplicated) {
|
|
70680
70757
|
throw new BadRequestError148("Route already exist.");
|
|
70681
70758
|
}
|
|
70682
|
-
if (error instanceof
|
|
70759
|
+
if (error instanceof AppError31) {
|
|
70683
70760
|
throw error;
|
|
70684
70761
|
} else {
|
|
70685
70762
|
throw new Error("Failed to create Patrol Route.");
|
|
@@ -71381,7 +71458,7 @@ function MPatrolLog(value) {
|
|
|
71381
71458
|
|
|
71382
71459
|
// src/repositories/patrol-log.repo.ts
|
|
71383
71460
|
import {
|
|
71384
|
-
AppError as
|
|
71461
|
+
AppError as AppError32,
|
|
71385
71462
|
BadRequestError as BadRequestError151,
|
|
71386
71463
|
InternalServerError as InternalServerError54,
|
|
71387
71464
|
logger as logger123,
|
|
@@ -71447,7 +71524,7 @@ function usePatrolLogRepo() {
|
|
|
71447
71524
|
if (isDuplicated) {
|
|
71448
71525
|
throw new BadRequestError151("Log already exist.");
|
|
71449
71526
|
}
|
|
71450
|
-
if (error instanceof
|
|
71527
|
+
if (error instanceof AppError32) {
|
|
71451
71528
|
throw error;
|
|
71452
71529
|
} else {
|
|
71453
71530
|
throw new Error("Failed to create Patrol Log.");
|
|
@@ -72179,7 +72256,7 @@ function MPatrolEmail(value) {
|
|
|
72179
72256
|
|
|
72180
72257
|
// src/repositories/patrol-email.repo.ts
|
|
72181
72258
|
import {
|
|
72182
|
-
AppError as
|
|
72259
|
+
AppError as AppError33,
|
|
72183
72260
|
BadRequestError as BadRequestError155,
|
|
72184
72261
|
InternalServerError as InternalServerError55,
|
|
72185
72262
|
logger as logger126,
|
|
@@ -72232,7 +72309,7 @@ function usePatrolEmailRepo() {
|
|
|
72232
72309
|
return { ...document2, _id: res.insertedId };
|
|
72233
72310
|
} catch (error) {
|
|
72234
72311
|
logger126.log({ level: "error", message: error.message });
|
|
72235
|
-
if (error instanceof
|
|
72312
|
+
if (error instanceof AppError33) {
|
|
72236
72313
|
throw error;
|
|
72237
72314
|
}
|
|
72238
72315
|
throw new InternalServerError55("Failed to record the patrol email.");
|
|
@@ -72392,7 +72469,7 @@ function usePatrolEmailRepo() {
|
|
|
72392
72469
|
}
|
|
72393
72470
|
return result;
|
|
72394
72471
|
} catch (error) {
|
|
72395
|
-
if (error instanceof
|
|
72472
|
+
if (error instanceof AppError33) {
|
|
72396
72473
|
throw error;
|
|
72397
72474
|
}
|
|
72398
72475
|
logger126.log({ level: "error", message: error.message });
|
|
@@ -77139,7 +77216,7 @@ function MBillingItem(value) {
|
|
|
77139
77216
|
|
|
77140
77217
|
// src/repositories/site-billing-item.repo.ts
|
|
77141
77218
|
import {
|
|
77142
|
-
AppError as
|
|
77219
|
+
AppError as AppError34,
|
|
77143
77220
|
BadRequestError as BadRequestError172,
|
|
77144
77221
|
InternalServerError as InternalServerError61,
|
|
77145
77222
|
logger as logger142,
|
|
@@ -77195,7 +77272,7 @@ function useSiteBillingItemRepo() {
|
|
|
77195
77272
|
if (isDuplicated) {
|
|
77196
77273
|
throw new BadRequestError172("Site Billing Item already exist.");
|
|
77197
77274
|
}
|
|
77198
|
-
if (error instanceof
|
|
77275
|
+
if (error instanceof AppError34) {
|
|
77199
77276
|
throw error;
|
|
77200
77277
|
} else {
|
|
77201
77278
|
throw new Error("Failed to create Site Site Billing Item.");
|
|
@@ -77298,7 +77375,7 @@ function useSiteBillingItemRepo() {
|
|
|
77298
77375
|
});
|
|
77299
77376
|
return result;
|
|
77300
77377
|
} catch (error) {
|
|
77301
|
-
if (error instanceof
|
|
77378
|
+
if (error instanceof AppError34) {
|
|
77302
77379
|
throw error;
|
|
77303
77380
|
} else {
|
|
77304
77381
|
throw new InternalServerError61("Failed to get site billing item by id.");
|
|
@@ -77400,7 +77477,7 @@ import {
|
|
|
77400
77477
|
|
|
77401
77478
|
// src/repositories/site-billing-configuration.repo.ts
|
|
77402
77479
|
import {
|
|
77403
|
-
AppError as
|
|
77480
|
+
AppError as AppError35,
|
|
77404
77481
|
BadRequestError as BadRequestError174,
|
|
77405
77482
|
InternalServerError as InternalServerError62,
|
|
77406
77483
|
logger as logger144,
|
|
@@ -77583,7 +77660,7 @@ function useSiteBillingConfigurationRepo() {
|
|
|
77583
77660
|
if (isDuplicated) {
|
|
77584
77661
|
throw new BadRequestError174("Site Billing Configuration already exist.");
|
|
77585
77662
|
}
|
|
77586
|
-
if (error instanceof
|
|
77663
|
+
if (error instanceof AppError35) {
|
|
77587
77664
|
throw error;
|
|
77588
77665
|
} else {
|
|
77589
77666
|
throw new Error("Failed to create Site Site Billing Configuration.");
|
|
@@ -77672,7 +77749,7 @@ function useSiteBillingConfigurationRepo() {
|
|
|
77672
77749
|
});
|
|
77673
77750
|
return result;
|
|
77674
77751
|
} catch (error) {
|
|
77675
|
-
if (error instanceof
|
|
77752
|
+
if (error instanceof AppError35) {
|
|
77676
77753
|
throw error;
|
|
77677
77754
|
} else {
|
|
77678
77755
|
throw new InternalServerError62(
|
|
@@ -79116,7 +79193,7 @@ function MUnitBilling(value) {
|
|
|
79116
79193
|
|
|
79117
79194
|
// src/repositories/site-unit-billing.repo.ts
|
|
79118
79195
|
import {
|
|
79119
|
-
AppError as
|
|
79196
|
+
AppError as AppError36,
|
|
79120
79197
|
BadRequestError as BadRequestError182,
|
|
79121
79198
|
InternalServerError as InternalServerError64,
|
|
79122
79199
|
logger as logger152,
|
|
@@ -79193,7 +79270,7 @@ function useSiteUnitBillingRepo() {
|
|
|
79193
79270
|
if (isDuplicated) {
|
|
79194
79271
|
throw new BadRequestError182("Site Unit Billing already exist.");
|
|
79195
79272
|
}
|
|
79196
|
-
if (error instanceof
|
|
79273
|
+
if (error instanceof AppError36) {
|
|
79197
79274
|
throw error;
|
|
79198
79275
|
} else {
|
|
79199
79276
|
throw new Error("Failed to create Site Unit Billing");
|
|
@@ -79349,7 +79426,7 @@ function useSiteUnitBillingRepo() {
|
|
|
79349
79426
|
});
|
|
79350
79427
|
return result;
|
|
79351
79428
|
} catch (error) {
|
|
79352
|
-
if (error instanceof
|
|
79429
|
+
if (error instanceof AppError36) {
|
|
79353
79430
|
throw error;
|
|
79354
79431
|
} else {
|
|
79355
79432
|
throw new InternalServerError64("Failed to get site unit billing by id.");
|
|
@@ -83116,7 +83193,7 @@ function MStatementOfAccount(value) {
|
|
|
83116
83193
|
|
|
83117
83194
|
// src/repositories/site-soa.repo.ts
|
|
83118
83195
|
import {
|
|
83119
|
-
AppError as
|
|
83196
|
+
AppError as AppError37,
|
|
83120
83197
|
BadRequestError as BadRequestError194,
|
|
83121
83198
|
InternalServerError as InternalServerError67,
|
|
83122
83199
|
logger as logger162,
|
|
@@ -83179,7 +83256,7 @@ function useStatementOfAccountRepo() {
|
|
|
83179
83256
|
if (isDuplicated) {
|
|
83180
83257
|
throw new BadRequestError194("Site SOA already exist.");
|
|
83181
83258
|
}
|
|
83182
|
-
if (error instanceof
|
|
83259
|
+
if (error instanceof AppError37) {
|
|
83183
83260
|
throw error;
|
|
83184
83261
|
} else {
|
|
83185
83262
|
throw new Error("Failed to create Site SOA");
|
|
@@ -83303,7 +83380,7 @@ function useStatementOfAccountRepo() {
|
|
|
83303
83380
|
});
|
|
83304
83381
|
return result;
|
|
83305
83382
|
} catch (error) {
|
|
83306
|
-
if (error instanceof
|
|
83383
|
+
if (error instanceof AppError37) {
|
|
83307
83384
|
throw error;
|
|
83308
83385
|
} else {
|
|
83309
83386
|
throw new InternalServerError67("Failed to get soa by id.");
|
|
@@ -84892,7 +84969,7 @@ function MNfcPatrolRoute(value) {
|
|
|
84892
84969
|
|
|
84893
84970
|
// src/repositories/nfc-patrol-route.repository.ts
|
|
84894
84971
|
import {
|
|
84895
|
-
AppError as
|
|
84972
|
+
AppError as AppError38,
|
|
84896
84973
|
BadRequestError as BadRequestError202,
|
|
84897
84974
|
InternalServerError as InternalServerError70,
|
|
84898
84975
|
logger as logger171,
|
|
@@ -85113,7 +85190,7 @@ function useNfcPatrolRouteRepo() {
|
|
|
85113
85190
|
});
|
|
85114
85191
|
return result;
|
|
85115
85192
|
} catch (error) {
|
|
85116
|
-
if (error instanceof
|
|
85193
|
+
if (error instanceof AppError38) {
|
|
85117
85194
|
throw error;
|
|
85118
85195
|
} else {
|
|
85119
85196
|
throw new InternalServerError70(
|
|
@@ -85166,7 +85243,7 @@ function useNfcPatrolRouteRepo() {
|
|
|
85166
85243
|
if (isDuplicated) {
|
|
85167
85244
|
throw new BadRequestError202("NFC Patrol Route already exists.");
|
|
85168
85245
|
}
|
|
85169
|
-
if (error2 instanceof
|
|
85246
|
+
if (error2 instanceof AppError38) {
|
|
85170
85247
|
throw error2;
|
|
85171
85248
|
} else {
|
|
85172
85249
|
throw new Error("Failed to update NFC Patrol Route.");
|
|
@@ -94783,7 +94860,7 @@ import {
|
|
|
94783
94860
|
logger as logger209,
|
|
94784
94861
|
BadRequestError as BadRequestError238,
|
|
94785
94862
|
NotFoundError as NotFoundError85,
|
|
94786
|
-
AppError as
|
|
94863
|
+
AppError as AppError44,
|
|
94787
94864
|
paginate as paginate67
|
|
94788
94865
|
} from "@7365admin1/node-server-utils";
|
|
94789
94866
|
var useRedDotPaymentRepo = () => {
|
|
@@ -94844,7 +94921,7 @@ var useRedDotPaymentRepo = () => {
|
|
|
94844
94921
|
}
|
|
94845
94922
|
return payment;
|
|
94846
94923
|
} catch (error) {
|
|
94847
|
-
if (error instanceof
|
|
94924
|
+
if (error instanceof AppError44) {
|
|
94848
94925
|
throw error;
|
|
94849
94926
|
}
|
|
94850
94927
|
logger209.log({
|
|
@@ -94869,7 +94946,7 @@ var useRedDotPaymentRepo = () => {
|
|
|
94869
94946
|
if (isDuplicated) {
|
|
94870
94947
|
throw new BadRequestError238("Payment already exist.");
|
|
94871
94948
|
}
|
|
94872
|
-
if (error instanceof
|
|
94949
|
+
if (error instanceof AppError44) {
|
|
94873
94950
|
throw error;
|
|
94874
94951
|
} else {
|
|
94875
94952
|
throw new Error("Failed to create Payment.");
|
|
@@ -94898,7 +94975,7 @@ var useRedDotPaymentRepo = () => {
|
|
|
94898
94975
|
if (isDuplicated) {
|
|
94899
94976
|
throw new BadRequestError238("payment already exist.");
|
|
94900
94977
|
}
|
|
94901
|
-
if (error instanceof
|
|
94978
|
+
if (error instanceof AppError44) {
|
|
94902
94979
|
throw error;
|
|
94903
94980
|
} else {
|
|
94904
94981
|
throw new Error("Failed to create payment");
|
|
@@ -94966,7 +95043,7 @@ var useRedDotPaymentRepo = () => {
|
|
|
94966
95043
|
const data = paginate67(items, page2, limit, totalCount);
|
|
94967
95044
|
return data;
|
|
94968
95045
|
} catch (error) {
|
|
94969
|
-
if (error instanceof
|
|
95046
|
+
if (error instanceof AppError44) {
|
|
94970
95047
|
throw error;
|
|
94971
95048
|
}
|
|
94972
95049
|
logger209.log({
|
|
@@ -95178,7 +95255,7 @@ var useRedDotPaymentRepo = () => {
|
|
|
95178
95255
|
}
|
|
95179
95256
|
return res;
|
|
95180
95257
|
} catch (error) {
|
|
95181
|
-
if (error instanceof
|
|
95258
|
+
if (error instanceof AppError44) {
|
|
95182
95259
|
throw error;
|
|
95183
95260
|
}
|
|
95184
95261
|
throw new InternalServerError83("Failed to update payment status.");
|
|
@@ -95532,7 +95609,7 @@ import {
|
|
|
95532
95609
|
BadRequestError as BadRequestError240,
|
|
95533
95610
|
paginate as paginate68,
|
|
95534
95611
|
NotFoundError as NotFoundError86,
|
|
95535
|
-
AppError as
|
|
95612
|
+
AppError as AppError45,
|
|
95536
95613
|
useCache as useCache72,
|
|
95537
95614
|
makeCacheKey as makeCacheKey65,
|
|
95538
95615
|
toObjectId as toObjectId23
|
|
@@ -95670,7 +95747,7 @@ function useUserRepoV2() {
|
|
|
95670
95747
|
);
|
|
95671
95748
|
return data;
|
|
95672
95749
|
} catch (error) {
|
|
95673
|
-
if (error instanceof
|
|
95750
|
+
if (error instanceof AppError45)
|
|
95674
95751
|
throw error;
|
|
95675
95752
|
throw new InternalServerError85("Failed to get user by id.");
|
|
95676
95753
|
}
|
|
@@ -104016,7 +104093,7 @@ function emptyPersonalEmergencyChain(user) {
|
|
|
104016
104093
|
// src/repositories/personal-emergency-chain.repo.ts
|
|
104017
104094
|
import { ObjectId as ObjectId200 } from "mongodb";
|
|
104018
104095
|
import {
|
|
104019
|
-
AppError as
|
|
104096
|
+
AppError as AppError46,
|
|
104020
104097
|
BadRequestError as BadRequestError274,
|
|
104021
104098
|
InternalServerError as InternalServerError102,
|
|
104022
104099
|
logger as logger236,
|
|
@@ -104053,7 +104130,7 @@ function usePersonalEmergencyChainRepo() {
|
|
|
104053
104130
|
const doc = await collection().findOne({ user: new ObjectId200(user) });
|
|
104054
104131
|
return doc ?? emptyPersonalEmergencyChain(user);
|
|
104055
104132
|
} catch (error) {
|
|
104056
|
-
if (error instanceof
|
|
104133
|
+
if (error instanceof AppError46)
|
|
104057
104134
|
throw error;
|
|
104058
104135
|
logger236.log({ level: "error", message: error.message });
|
|
104059
104136
|
throw new InternalServerError102("Failed to retrieve emergency contacts.");
|
|
@@ -104079,7 +104156,7 @@ function usePersonalEmergencyChainRepo() {
|
|
|
104079
104156
|
);
|
|
104080
104157
|
return doc;
|
|
104081
104158
|
} catch (error) {
|
|
104082
|
-
if (error instanceof
|
|
104159
|
+
if (error instanceof AppError46)
|
|
104083
104160
|
throw error;
|
|
104084
104161
|
logger236.log({ level: "error", message: error.message });
|
|
104085
104162
|
throw new InternalServerError102("Failed to save emergency contacts.");
|
|
@@ -104376,6 +104453,7 @@ export {
|
|
|
104376
104453
|
OUNITECH_BRAND,
|
|
104377
104454
|
OUNITECH_CAPABILITIES,
|
|
104378
104455
|
OUNITECH_PENDING_COMMANDS,
|
|
104456
|
+
OUNITECH_TIMESTAMP_FORMAT,
|
|
104379
104457
|
OpenRmfError,
|
|
104380
104458
|
OrgNature,
|
|
104381
104459
|
OvernightParkingRequestSort,
|
|
@@ -104423,6 +104501,7 @@ export {
|
|
|
104423
104501
|
ROBOT_CLOUD_DOC_CONFIRMATIONS,
|
|
104424
104502
|
ROBOT_CLOUD_PATHS,
|
|
104425
104503
|
ROBOT_CLOUD_TIMEOUT_MS,
|
|
104504
|
+
ROBOT_CLOUD_TIMESTAMP_FORMATS,
|
|
104426
104505
|
ROBOT_CREDENTIALS_ENV,
|
|
104427
104506
|
ROBOT_MODULE,
|
|
104428
104507
|
ROBOT_PERMISSIONS,
|