@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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @iservice365/core
2
2
 
3
+ ## 3.124.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 0a081f9: Camera fault notifications: the inbox (bell, unread badge, phone feed) now gets one "Camera fault" row per outage instead of one for every paced toast. A flapping ANPR camera had left two identical rows 30 seconds apart for every drop, filling 156 of a property manager's 200 newest notifications. The live toast pacing is unchanged. Dashboard "Needs Attention" lines now read "waiting to be acknowledged" / "waiting for approval".
8
+
3
9
  ## 3.124.1
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1356,7 +1356,45 @@ declare function MSite(value: TSite): {
1356
1356
  name: string;
1357
1357
  description: string;
1358
1358
  orgId: string | ObjectId;
1359
- metadata: TSiteMetadata;
1359
+ metadata: {
1360
+ /** Tier two of the module cascade — see `site-modules.util.ts`. */
1361
+ modules?: string[] | undefined;
1362
+ block?: number | undefined;
1363
+ guardPosts?: number | undefined;
1364
+ gracePeriod?: number | undefined;
1365
+ incidentCounter: number;
1366
+ incidentLogo?: string | undefined;
1367
+ services?: Record<string, unknown>[] | undefined;
1368
+ residentAppModules?: Partial<Record<"feedback" | "bulletin" | "bulletinVideos" | "inviteVisitors" | "myVisitors" | "billingAndSoa" | "access" | "facilityBooking" | "onlineForm" | "emergencyContact", boolean>> | undefined;
1369
+ hidQrCodePass?: {
1370
+ enabled: boolean;
1371
+ onlineMode?: boolean | undefined;
1372
+ readerId: string;
1373
+ qrGatePermissions?: {
1374
+ resident: string[];
1375
+ propertyManagement: string[];
1376
+ } | undefined;
1377
+ qrFormat: "0" | "1" | "2";
1378
+ identificationMethods?: {
1379
+ facial: boolean;
1380
+ card: boolean;
1381
+ qrCode: boolean;
1382
+ idPassword: boolean;
1383
+ pin: boolean;
1384
+ bluetooth: boolean;
1385
+ } | undefined;
1386
+ printer: {
1387
+ vendorId: string;
1388
+ productId: string;
1389
+ };
1390
+ template: {
1391
+ header: string;
1392
+ subtext: string;
1393
+ };
1394
+ validityMinutes: number | null;
1395
+ updatedAt: string;
1396
+ } | undefined;
1397
+ };
1360
1398
  status: string;
1361
1399
  createdAt: Date;
1362
1400
  address: SiteAddress | undefined;
package/dist/index.js CHANGED
@@ -6794,7 +6794,21 @@ function MSite(value) {
6794
6794
  name: value.name ?? "",
6795
6795
  description: value.description ?? "",
6796
6796
  orgId: value.orgId ?? "",
6797
- metadata: value.metadata ?? {},
6797
+ /*
6798
+ * `incidentCounter` is seeded at creation rather than left absent.
6799
+ *
6800
+ * `incident-report.service.ts` increments it for every report, and it used
6801
+ * to spring into existence on the first one — a dotted `$set` creates the
6802
+ * key. Seeding it means a site's shape does not depend on whether anybody
6803
+ * has filed a report yet, so a reader cannot meet the field as `undefined`
6804
+ * on a new site and only as a number on an old one.
6805
+ *
6806
+ * `siteSchema` does not permit `metadata` on creation at all, so the spread
6807
+ * below never fires today — it is there so that a caller supplying its own
6808
+ * metadata would still win if the schema ever allows it, rather than having
6809
+ * its counter silently reset to zero.
6810
+ */
6811
+ metadata: { incidentCounter: 0, ...value.metadata ?? {} },
6798
6812
  status: "active",
6799
6813
  createdAt: /* @__PURE__ */ new Date(),
6800
6814
  address: value.address,
@@ -22661,6 +22675,9 @@ function shouldAlertOnFailure(consecutiveFailures) {
22661
22675
  return false;
22662
22676
  return (consecutiveFailures - CAMERA_ALERT_EVERY_AFTER) % CAMERA_ALERT_EVERY_AFTER === 0;
22663
22677
  }
22678
+ function shouldStoreCameraFault(alertedThisOutage) {
22679
+ return alertedThisOutage === 0;
22680
+ }
22664
22681
 
22665
22682
  // src/utils/dahua-protocol.util.ts
22666
22683
  var DAHUA_AUTH_ATTEMPTS_BEFORE_ALERT = 2;
@@ -23828,6 +23845,7 @@ function useDahuaService() {
23828
23845
  `[${camera?.siteName}-${camera?.direction}] Connection lost or error: ${error.message || error}. Retrying in 10 seconds... (failure ${connectionFailureCount})`
23829
23846
  );
23830
23847
  if (onDetected && shouldAlertOnFailure(connectionFailureCount)) {
23848
+ const storeInInbox = shouldStoreCameraFault(alertedFailureCount);
23831
23849
  alertedFailureCount = connectionFailureCount;
23832
23850
  onDetected({
23833
23851
  site: camera?.site,
@@ -23836,7 +23854,8 @@ function useDahuaService() {
23836
23854
  camera: camera?._id?.toString(),
23837
23855
  message: cameraUnreachableMessage(camera)
23838
23856
  });
23839
- notifyCameraFault(camera, cameraUnreachableMessage(camera));
23857
+ if (storeInInbox)
23858
+ notifyCameraFault(camera, cameraUnreachableMessage(camera));
23840
23859
  }
23841
23860
  }
23842
23861
  } finally {
@@ -90432,7 +90451,7 @@ function useNewDashboardRepo() {
90432
90451
  todayAttentions.push({
90433
90452
  id: pendingIncidentDocs[0]._id.toString(),
90434
90453
  type: "incident",
90435
- title: `${pendingIncidentCount} incident${pendingIncidentCount === 1 ? "" : "s"} pending acknowledge`,
90454
+ title: `${pendingIncidentCount} incident${pendingIncidentCount === 1 ? "" : "s"} waiting to be acknowledged`,
90436
90455
  createdAt: pendingIncidentDocs[0].updatedAt || pendingIncidentDocs[0].createdAt || /* @__PURE__ */ new Date()
90437
90456
  });
90438
90457
  }
@@ -90440,7 +90459,7 @@ function useNewDashboardRepo() {
90440
90459
  todayAttentions.push({
90441
90460
  id: pendingFacilityBookingDocs[0]._id.toString(),
90442
90461
  type: "facility-booking",
90443
- title: `${pendingFacilityBookingCount} facility booking${pendingFacilityBookingCount === 1 ? "" : "s"} need approval`,
90462
+ title: `${pendingFacilityBookingCount} facility booking${pendingFacilityBookingCount === 1 ? "" : "s"} waiting for approval`,
90444
90463
  createdAt: pendingFacilityBookingDocs[0].createdAt || /* @__PURE__ */ new Date()
90445
90464
  });
90446
90465
  }