@7365admin1/core 3.124.1 → 3.124.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -5708,7 +5708,21 @@ function MSite(value) {
5708
5708
  name: value.name ?? "",
5709
5709
  description: value.description ?? "",
5710
5710
  orgId: value.orgId ?? "",
5711
- metadata: value.metadata ?? {},
5711
+ /*
5712
+ * `incidentCounter` is seeded at creation rather than left absent.
5713
+ *
5714
+ * `incident-report.service.ts` increments it for every report, and it used
5715
+ * to spring into existence on the first one — a dotted `$set` creates the
5716
+ * key. Seeding it means a site's shape does not depend on whether anybody
5717
+ * has filed a report yet, so a reader cannot meet the field as `undefined`
5718
+ * on a new site and only as a number on an old one.
5719
+ *
5720
+ * `siteSchema` does not permit `metadata` on creation at all, so the spread
5721
+ * below never fires today — it is there so that a caller supplying its own
5722
+ * metadata would still win if the schema ever allows it, rather than having
5723
+ * its counter silently reset to zero.
5724
+ */
5725
+ metadata: { incidentCounter: 0, ...value.metadata ?? {} },
5712
5726
  status: "active",
5713
5727
  createdAt: /* @__PURE__ */ new Date(),
5714
5728
  address: value.address,
@@ -21733,6 +21747,9 @@ function shouldAlertOnFailure(consecutiveFailures) {
21733
21747
  return false;
21734
21748
  return (consecutiveFailures - CAMERA_ALERT_EVERY_AFTER) % CAMERA_ALERT_EVERY_AFTER === 0;
21735
21749
  }
21750
+ function shouldStoreCameraFault(alertedThisOutage) {
21751
+ return alertedThisOutage === 0;
21752
+ }
21736
21753
 
21737
21754
  // src/utils/dahua-protocol.util.ts
21738
21755
  var DAHUA_AUTH_ATTEMPTS_BEFORE_ALERT = 2;
@@ -22900,6 +22917,7 @@ function useDahuaService() {
22900
22917
  `[${camera?.siteName}-${camera?.direction}] Connection lost or error: ${error.message || error}. Retrying in 10 seconds... (failure ${connectionFailureCount})`
22901
22918
  );
22902
22919
  if (onDetected && shouldAlertOnFailure(connectionFailureCount)) {
22920
+ const storeInInbox = shouldStoreCameraFault(alertedFailureCount);
22903
22921
  alertedFailureCount = connectionFailureCount;
22904
22922
  onDetected({
22905
22923
  site: camera?.site,
@@ -22908,7 +22926,8 @@ function useDahuaService() {
22908
22926
  camera: camera?._id?.toString(),
22909
22927
  message: cameraUnreachableMessage(camera)
22910
22928
  });
22911
- notifyCameraFault(camera, cameraUnreachableMessage(camera));
22929
+ if (storeInInbox)
22930
+ notifyCameraFault(camera, cameraUnreachableMessage(camera));
22912
22931
  }
22913
22932
  }
22914
22933
  } finally {
@@ -90075,7 +90094,7 @@ function useNewDashboardRepo() {
90075
90094
  todayAttentions.push({
90076
90095
  id: pendingIncidentDocs[0]._id.toString(),
90077
90096
  type: "incident",
90078
- title: `${pendingIncidentCount} incident${pendingIncidentCount === 1 ? "" : "s"} pending acknowledge`,
90097
+ title: `${pendingIncidentCount} incident${pendingIncidentCount === 1 ? "" : "s"} waiting to be acknowledged`,
90079
90098
  createdAt: pendingIncidentDocs[0].updatedAt || pendingIncidentDocs[0].createdAt || /* @__PURE__ */ new Date()
90080
90099
  });
90081
90100
  }
@@ -90083,7 +90102,7 @@ function useNewDashboardRepo() {
90083
90102
  todayAttentions.push({
90084
90103
  id: pendingFacilityBookingDocs[0]._id.toString(),
90085
90104
  type: "facility-booking",
90086
- title: `${pendingFacilityBookingCount} facility booking${pendingFacilityBookingCount === 1 ? "" : "s"} need approval`,
90105
+ title: `${pendingFacilityBookingCount} facility booking${pendingFacilityBookingCount === 1 ? "" : "s"} waiting for approval`,
90087
90106
  createdAt: pendingFacilityBookingDocs[0].createdAt || /* @__PURE__ */ new Date()
90088
90107
  });
90089
90108
  }