@7365admin1/core 3.99.1-staging.410 → 3.99.1-staging.412

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.
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@7365admin1/core": patch
3
+ ---
4
+
5
+ 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".
package/dist/index.d.ts CHANGED
@@ -1373,7 +1373,47 @@ declare function MSite(value: TSite): {
1373
1373
  name: string;
1374
1374
  description: string;
1375
1375
  orgId: string | ObjectId;
1376
- metadata: TSiteMetadata;
1376
+ metadata: {
1377
+ /** Tier two of the module cascade — see `site-modules.util.ts`. */
1378
+ modules?: string[] | undefined;
1379
+ block?: number | undefined;
1380
+ guardPosts?: number | undefined;
1381
+ gracePeriod?: number | undefined;
1382
+ incidentCounter: number;
1383
+ incidentLogo?: string | undefined;
1384
+ services?: Record<string, unknown>[] | undefined;
1385
+ residentAppModules?: Partial<Record<"feedback" | "bulletin" | "bulletinVideos" | "inviteVisitors" | "myVisitors" | "billingAndSoa" | "access" | "accessEntryPass" | "accessHid" | "facilityBooking" | "onlineForm" | "emergencyContact", boolean>> | undefined;
1386
+ /** Reminder lead time in days — see `metadataSchema` for the bounds. */
1387
+ documentExpiryNotificationDays?: number | undefined;
1388
+ hidQrCodePass?: {
1389
+ enabled: boolean;
1390
+ onlineMode?: boolean | undefined;
1391
+ readerId: string;
1392
+ qrGatePermissions?: {
1393
+ resident: string[];
1394
+ propertyManagement: string[];
1395
+ } | undefined;
1396
+ qrFormat: "0" | "1" | "2";
1397
+ identificationMethods?: {
1398
+ facial: boolean;
1399
+ card: boolean;
1400
+ qrCode: boolean;
1401
+ idPassword: boolean;
1402
+ pin: boolean;
1403
+ bluetooth: boolean;
1404
+ } | undefined;
1405
+ printer: {
1406
+ vendorId: string;
1407
+ productId: string;
1408
+ };
1409
+ template: {
1410
+ header: string;
1411
+ subtext: string;
1412
+ };
1413
+ validityMinutes: number | null;
1414
+ updatedAt: string;
1415
+ } | undefined;
1416
+ };
1377
1417
  status: string;
1378
1418
  createdAt: Date;
1379
1419
  address: SiteAddress | undefined;
package/dist/index.js CHANGED
@@ -6845,7 +6845,21 @@ function MSite(value) {
6845
6845
  name: value.name ?? "",
6846
6846
  description: value.description ?? "",
6847
6847
  orgId: value.orgId ?? "",
6848
- metadata: value.metadata ?? {},
6848
+ /*
6849
+ * `incidentCounter` is seeded at creation rather than left absent.
6850
+ *
6851
+ * `incident-report.service.ts` increments it for every report, and it used
6852
+ * to spring into existence on the first one — a dotted `$set` creates the
6853
+ * key. Seeding it means a site's shape does not depend on whether anybody
6854
+ * has filed a report yet, so a reader cannot meet the field as `undefined`
6855
+ * on a new site and only as a number on an old one.
6856
+ *
6857
+ * `siteSchema` does not permit `metadata` on creation at all, so the spread
6858
+ * below never fires today — it is there so that a caller supplying its own
6859
+ * metadata would still win if the schema ever allows it, rather than having
6860
+ * its counter silently reset to zero.
6861
+ */
6862
+ metadata: { incidentCounter: 0, ...value.metadata ?? {} },
6849
6863
  status: "active",
6850
6864
  createdAt: /* @__PURE__ */ new Date(),
6851
6865
  address: value.address,
@@ -22991,6 +23005,9 @@ function shouldAlertOnFailure(consecutiveFailures) {
22991
23005
  return false;
22992
23006
  return (consecutiveFailures - CAMERA_ALERT_EVERY_AFTER) % CAMERA_ALERT_EVERY_AFTER === 0;
22993
23007
  }
23008
+ function shouldStoreCameraFault(alertedThisOutage) {
23009
+ return alertedThisOutage === 0;
23010
+ }
22994
23011
 
22995
23012
  // src/utils/dahua-protocol.util.ts
22996
23013
  var DAHUA_AUTH_ATTEMPTS_BEFORE_ALERT = 2;
@@ -24158,6 +24175,7 @@ function useDahuaService() {
24158
24175
  `[${camera?.siteName}-${camera?.direction}] Connection lost or error: ${error.message || error}. Retrying in 10 seconds... (failure ${connectionFailureCount})`
24159
24176
  );
24160
24177
  if (onDetected && shouldAlertOnFailure(connectionFailureCount)) {
24178
+ const storeInInbox = shouldStoreCameraFault(alertedFailureCount);
24161
24179
  alertedFailureCount = connectionFailureCount;
24162
24180
  onDetected({
24163
24181
  site: camera?.site,
@@ -24166,7 +24184,8 @@ function useDahuaService() {
24166
24184
  camera: camera?._id?.toString(),
24167
24185
  message: cameraUnreachableMessage(camera)
24168
24186
  });
24169
- notifyCameraFault(camera, cameraUnreachableMessage(camera));
24187
+ if (storeInInbox)
24188
+ notifyCameraFault(camera, cameraUnreachableMessage(camera));
24170
24189
  }
24171
24190
  }
24172
24191
  } finally {
@@ -92416,7 +92435,7 @@ function useNewDashboardRepo() {
92416
92435
  todayAttentions.push({
92417
92436
  id: pendingIncidentDocs[0]._id.toString(),
92418
92437
  type: "incident",
92419
- title: `${pendingIncidentCount} incident${pendingIncidentCount === 1 ? "" : "s"} pending acknowledge`,
92438
+ title: `${pendingIncidentCount} incident${pendingIncidentCount === 1 ? "" : "s"} waiting to be acknowledged`,
92420
92439
  createdAt: pendingIncidentDocs[0].updatedAt || pendingIncidentDocs[0].createdAt || /* @__PURE__ */ new Date()
92421
92440
  });
92422
92441
  }
@@ -92424,7 +92443,7 @@ function useNewDashboardRepo() {
92424
92443
  todayAttentions.push({
92425
92444
  id: pendingFacilityBookingDocs[0]._id.toString(),
92426
92445
  type: "facility-booking",
92427
- title: `${pendingFacilityBookingCount} facility booking${pendingFacilityBookingCount === 1 ? "" : "s"} need approval`,
92446
+ title: `${pendingFacilityBookingCount} facility booking${pendingFacilityBookingCount === 1 ? "" : "s"} waiting for approval`,
92428
92447
  createdAt: pendingFacilityBookingDocs[0].createdAt || /* @__PURE__ */ new Date()
92429
92448
  });
92430
92449
  }