@7365admin1/core 3.117.0 → 3.117.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @iservice365/core
2
2
 
3
+ ## 3.117.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 54da233: Robots: a still-open OFFLINE ("Not reporting") record now takes the reason of the latest failed read instead of keeping the first one forever (same record, same `since`, no second alert). Tests prove the Ounitech base URL defaults to https://app.frankfurt.robotcloud.top with OUNITECH_API_BASE / ROBOT_CLOUD_BASE_URL unset or blank, and that an empty base URL is a handled 502.
8
+
3
9
  ## 3.117.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -10484,6 +10484,7 @@ declare function useRobotFaultRepo(): {
10484
10484
  findNotifiedOccurrence: (robotId: unknown, code: string, since: Date | null, after: Date) => Promise<mongodb.WithId<TRobotFaultRecord> | null>;
10485
10485
  markNotified: (id: unknown, at: Date) => Promise<void>;
10486
10486
  clearFault: (id: unknown) => Promise<void>;
10487
+ setFaultMessage: (id: unknown, message: string) => Promise<void>;
10487
10488
  listNetworkFaults: (q: TNetworkFaultQuery) => Promise<{
10488
10489
  items: any;
10489
10490
  page: number;
package/dist/index.js CHANGED
@@ -10929,12 +10929,16 @@ function planFaultChanges(open, reading) {
10929
10929
  want.push({ code: fault.code, message: fault.message || fault.code, since: fault.since });
10930
10930
  const clear = [];
10931
10931
  const toOpen = [];
10932
+ const refresh = [];
10932
10933
  for (const w of want) {
10933
10934
  const existing = byCode.get(w.code);
10934
10935
  if (!existing) {
10935
10936
  toOpen.push(w);
10936
10937
  continue;
10937
10938
  }
10939
+ if (w.code === OFFLINE_FAULT_CODE && typeof existing.message === "string" && existing.message !== w.message) {
10940
+ refresh.push({ id: existing._id, message: w.message });
10941
+ }
10938
10942
  const newOccurrence = typeof w.since === "number" && Math.abs(new Date(existing.since).getTime() - w.since) > SAME_OCCURRENCE_MS;
10939
10943
  if (newOccurrence) {
10940
10944
  clear.push(existing._id);
@@ -10949,7 +10953,7 @@ function planFaultChanges(open, reading) {
10949
10953
  continue;
10950
10954
  clear.push(r._id);
10951
10955
  }
10952
- return { open: toOpen, clear };
10956
+ return { open: toOpen, clear, refresh };
10953
10957
  }
10954
10958
  function robotFaultSweepConfig(env2 = process.env) {
10955
10959
  const num3 = (v, def, min, max) => {
@@ -67257,7 +67261,7 @@ function useRobotFaultRepo() {
67257
67261
  }
67258
67262
  }
67259
67263
  async function getOpenFaults() {
67260
- return collection.find({ clearedAt: null }, { projection: { robotId: 1, code: 1, since: 1 } }).toArray();
67264
+ return collection.find({ clearedAt: null }, { projection: { robotId: 1, code: 1, since: 1, message: 1 } }).toArray();
67261
67265
  }
67262
67266
  async function getOpenFault(robotId, code) {
67263
67267
  return collection.findOne({ robotId: toId3(robotId), code, clearedAt: null });
@@ -67318,6 +67322,9 @@ function useRobotFaultRepo() {
67318
67322
  async function markNotified(id, at2) {
67319
67323
  await collection.updateOne({ _id: toId3(id), notifiedAt: null }, { $set: { notifiedAt: at2 } });
67320
67324
  }
67325
+ async function setFaultMessage(id, message) {
67326
+ await collection.updateOne({ _id: toId3(id), clearedAt: null }, { $set: { message } });
67327
+ }
67321
67328
  async function clearFault(id) {
67322
67329
  await collection.updateOne(
67323
67330
  { _id: toId3(id), clearedAt: null },
@@ -67347,6 +67354,7 @@ function useRobotFaultRepo() {
67347
67354
  findNotifiedOccurrence,
67348
67355
  markNotified,
67349
67356
  clearFault,
67357
+ setFaultMessage,
67350
67358
  listNetworkFaults,
67351
67359
  countNetworkFaults
67352
67360
  };
@@ -67501,6 +67509,8 @@ function useRobotFaultSweep(deps) {
67501
67509
  await repo.clearFault(id);
67502
67510
  out.cleared++;
67503
67511
  }
67512
+ for (const r of plan.refresh)
67513
+ await repo.setFaultMessage(r.id, r.message);
67504
67514
  if (offlineRec) {
67505
67515
  const online = plan.clear.includes(offlineRec._id);
67506
67516
  if (await alertConnection(robot, offlineRec._id, online, cfg.offlineAlertMinutes, deps?.connectionNotifyFn))