@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.
@@ -5,15 +5,15 @@
5
5
  },
6
6
  "auditLog": "logs\\.6b77785a74c362881f6fb7e95a7530280abbf9ed-audit.json",
7
7
  "files": [
8
- {
9
- "date": 1789008603082,
10
- "name": "logs\\error-2026-09-10.log",
11
- "hash": "ea96d42a9881c629d5b87fa8ce141575a177edfc9aef559c47d82848cdc5df47"
12
- },
13
8
  {
14
9
  "date": 1790145019990,
15
10
  "name": "logs\\error-2026-09-23.log",
16
11
  "hash": "6e81a0234c7b52f196d78508cf2167c58491140d446371c3a823b62ace1ed770"
12
+ },
13
+ {
14
+ "date": 1790578085876,
15
+ "name": "logs\\error-2026-09-28.log",
16
+ "hash": "090eef778e4a0d0e7343e2752822f247daa6fa85800fcf9f7d2892f296670ee8"
17
17
  }
18
18
  ],
19
19
  "hashType": "sha256"
@@ -5,15 +5,15 @@
5
5
  },
6
6
  "auditLog": "logs\\.ca6dad43b7d35307d69543a741eb24d3ce997028-audit.json",
7
7
  "files": [
8
- {
9
- "date": 1789008603086,
10
- "name": "logs\\combined-2026-09-10.log",
11
- "hash": "055e77a0887051fb145bef3e749b6db5d193493d5332f359c80c3052d0e9dcea"
12
- },
13
8
  {
14
9
  "date": 1790145020005,
15
10
  "name": "logs\\combined-2026-09-23.log",
16
11
  "hash": "769ffe827dc48bd68cf6b2e69179b7178cf1d9ce0f0e8da27ccbef7208437632"
12
+ },
13
+ {
14
+ "date": 1790578085878,
15
+ "name": "logs\\combined-2026-09-28.log",
16
+ "hash": "0fabbf77efacc2e42a7669272c630fa860dacf4b1322d5f0b0a3206427b88004"
17
17
  }
18
18
  ],
19
19
  "hashType": "sha256"
@@ -9,6 +9,11 @@
9
9
  "date": 1789995497468,
10
10
  "name": "logs/dahua/combined-2026-09-21.log",
11
11
  "hash": "e9f559a17482c8db46516a98837d06aefb2c89a9a1cced1984c898aac2211687"
12
+ },
13
+ {
14
+ "date": 1790578089763,
15
+ "name": "logs\\dahua\\combined-2026-09-28.log",
16
+ "hash": "551ad46847a556b3cb3508cbb65b7a2714025bf7f62c41b4027b6e06d4b88ade"
12
17
  }
13
18
  ],
14
19
  "hashType": "sha256"
@@ -9,6 +9,11 @@
9
9
  "date": 1789995497455,
10
10
  "name": "logs/dahua/error-2026-09-21.log",
11
11
  "hash": "d5a28fc0fc6195af7c8ce89e5b17b5b895de405cd4df6ada014a4581ed52eb9a"
12
+ },
13
+ {
14
+ "date": 1790578089761,
15
+ "name": "logs\\dahua\\error-2026-09-28.log",
16
+ "hash": "c59b070720c0b4b117e3a88ba2d9812e1987c939864266afa2127928d80286a6"
12
17
  }
13
18
  ],
14
19
  "hashType": "sha256"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@7365admin1/core",
3
3
  "license": "MIT",
4
- "version": "3.124.1",
4
+ "version": "3.124.2",
5
5
  "author": "7365admin1",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.mjs",
@@ -13,7 +13,7 @@
13
13
  "build": "tsup src/index.ts --format cjs,esm --dts && shx cp -r src/public dist && shx cp -r src/utils/handlebars dist",
14
14
  "release": "yarn run build && changeset publish",
15
15
  "lint": "tsc",
16
- "test": "tsup src/config.ts src/utils/building-map.util.ts src/utils/robot-cloud.util.ts src/utils/robot-adapter.util.ts src/utils/png-encoder.util.ts src/services/demo.adapter.ts src/services/ounitech.adapter.ts src/services/robot-cloud.service.ts src/services/robot-fleet.service.ts src/services/padbot.adapter.ts src/utils/padbot-sign.util.ts src/utils/padbot-mqtt.util.ts src/services/open-rmf.adapter.ts src/utils/robot-credentials.util.ts src/utils/rmf-building.util.ts src/utils/door-contract.util.ts src/utils/robot-fault.util.ts src/utils/robot-tracking.util.ts src/utils/robot-apps.util.ts src/utils/robot-permission.util.ts src/utils/robot-network.util.ts src/utils/lift-contract.util.ts src/models/robot-building-map.model.ts src/utils/anpr-revoke.util.ts src/utils/anpr-plate.util.ts src/utils/vehicle-request.util.ts src/utils/camera-view.util.ts src/utils/camera-bulk-import.util.ts src/utils/dashboard-metrics.util.ts src/utils/camera-capability.util.ts src/utils/camera-playback.util.ts src/services/camera-device-http.service.ts src/utils/camera-alert.util.ts src/utils/dahua-protocol.util.ts src/utils/site-name.util.ts src/utils/site-owner-edit.util.ts src/utils/service-provider-invite.util.ts src/utils/notification-category.util.ts src/utils/notification-kind.util.ts src/utils/notification-email.util.ts src/models/notification.model.ts src/utils/hid-card.util.ts src/utils/hid-json.util.ts src/utils/hid-access.util.ts src/models/customer-site.model.ts src/models/site-camera.model.ts src/models/member.model.ts src/models/subscription.model.ts src/utils/session-id.util.ts src/utils/occurrence-query.util.ts src/utils/occurrence-book-create.util.ts src/utils/update-result.util.ts src/utils/hid-amico-authz.util.ts src/utils/promo-code-currency.util.ts src/utils/console-audit.util.ts src/utils/org-suspension.util.ts src/utils/session-revoke.util.ts src/models/hid-amico.model.ts src/models/patrol-email.model.ts src/utils/patrol-email-pdf.util.ts src/utils/visitor-status.util.ts src/utils/self-service-email.util.ts src/utils/hid-secret.util.ts src/models/visitor-invite.model.ts src/models/guard-invite.model.ts src/utils/site-timezone.util.ts src/utils/bulletin-service-apps.util.ts src/models/bulletin-board.model.ts src/utils/vehicle-import.util.ts src/utils/expired-vehicle-sweep.util.ts src/models/vehicle.model.ts src/controllers/chat.controller.ts src/utils/file-owner.util.ts src/utils/console-permission.util.ts src/utils/role-scope.util.ts src/utils/org-default-roles.util.ts src/utils/org-modules.util.ts src/utils/site-modules.util.ts src/utils/resident-app-modules.util.ts src/utils/resident-default-role.util.ts src/utils/invite-role-scope.util.ts src/models/personal-emergency-chain.model.ts src/utils/self-signup-files.util.ts src/models/person.model.ts src/utils/module-gate.util.ts src/utils/member-lookup.util.ts src/utils/notification-access.util.ts src/utils/module-access.util.ts src/services/module-gate.service.ts src/controllers/site.controller.ts src/controllers/organization.controller.ts src/controllers/member.controller.ts src/utils/org-owner-repair.util.ts src/utils/socket-session.util.ts src/utils/people-create-gate.util.ts src/utils/service-app-type.util.ts src/utils/customer-site-list.util.ts src/utils/org-search.util.ts src/utils/invite-origin.util.ts src/utils/member-role-assign.util.ts src/utils/cross-site-role.util.ts --format esm --out-dir test/.build --no-dts --silent && node --test test/*.test.mjs",
16
+ "test": "tsup src/config.ts src/utils/building-map.util.ts src/utils/robot-cloud.util.ts src/utils/robot-adapter.util.ts src/utils/png-encoder.util.ts src/services/demo.adapter.ts src/services/ounitech.adapter.ts src/services/robot-cloud.service.ts src/services/robot-fleet.service.ts src/services/padbot.adapter.ts src/utils/padbot-sign.util.ts src/utils/padbot-mqtt.util.ts src/services/open-rmf.adapter.ts src/utils/robot-credentials.util.ts src/utils/rmf-building.util.ts src/utils/door-contract.util.ts src/utils/robot-fault.util.ts src/utils/robot-tracking.util.ts src/utils/robot-apps.util.ts src/utils/robot-permission.util.ts src/utils/robot-network.util.ts src/utils/lift-contract.util.ts src/models/robot-building-map.model.ts src/utils/anpr-revoke.util.ts src/utils/anpr-plate.util.ts src/utils/vehicle-request.util.ts src/utils/camera-view.util.ts src/utils/camera-bulk-import.util.ts src/utils/dashboard-metrics.util.ts src/utils/camera-capability.util.ts src/utils/camera-playback.util.ts src/services/camera-device-http.service.ts src/utils/camera-alert.util.ts src/utils/dahua-protocol.util.ts src/utils/site-name.util.ts src/utils/site-owner-edit.util.ts src/utils/service-provider-invite.util.ts src/utils/notification-category.util.ts src/utils/notification-kind.util.ts src/utils/notification-email.util.ts src/models/notification.model.ts src/utils/hid-card.util.ts src/utils/hid-json.util.ts src/utils/hid-access.util.ts src/models/customer-site.model.ts src/models/site-camera.model.ts src/models/site.model.ts src/models/member.model.ts src/models/subscription.model.ts src/utils/session-id.util.ts src/utils/occurrence-query.util.ts src/utils/occurrence-book-create.util.ts src/utils/update-result.util.ts src/utils/hid-amico-authz.util.ts src/utils/promo-code-currency.util.ts src/utils/console-audit.util.ts src/utils/org-suspension.util.ts src/utils/session-revoke.util.ts src/models/hid-amico.model.ts src/models/patrol-email.model.ts src/utils/patrol-email-pdf.util.ts src/utils/visitor-status.util.ts src/utils/self-service-email.util.ts src/utils/hid-secret.util.ts src/models/visitor-invite.model.ts src/models/guard-invite.model.ts src/utils/site-timezone.util.ts src/utils/bulletin-service-apps.util.ts src/models/bulletin-board.model.ts src/utils/vehicle-import.util.ts src/utils/expired-vehicle-sweep.util.ts src/models/vehicle.model.ts src/controllers/chat.controller.ts src/utils/file-owner.util.ts src/utils/console-permission.util.ts src/utils/role-scope.util.ts src/utils/org-default-roles.util.ts src/utils/org-modules.util.ts src/utils/site-modules.util.ts src/utils/resident-app-modules.util.ts src/utils/resident-default-role.util.ts src/utils/invite-role-scope.util.ts src/models/personal-emergency-chain.model.ts src/utils/self-signup-files.util.ts src/models/person.model.ts src/utils/module-gate.util.ts src/utils/member-lookup.util.ts src/utils/notification-access.util.ts src/utils/module-access.util.ts src/services/module-gate.service.ts src/controllers/site.controller.ts src/controllers/organization.controller.ts src/controllers/member.controller.ts src/utils/org-owner-repair.util.ts src/utils/socket-session.util.ts src/utils/people-create-gate.util.ts src/utils/service-app-type.util.ts src/utils/customer-site-list.util.ts src/utils/org-search.util.ts src/utils/invite-origin.util.ts src/utils/member-role-assign.util.ts src/utils/cross-site-role.util.ts --format esm --out-dir test/.build --no-dts --silent && node --test test/*.test.mjs",
17
17
  "test:camera": "yarn test",
18
18
  "test:e2e": "yarn build && node --test --test-concurrency=1 --test-timeout=600000 \"test/e2e/*.test.mjs\""
19
19
  },
@@ -119,3 +119,23 @@ test("nothing is reported while the camera is connected", () => {
119
119
  assert.equal(shouldAlertOnFailure(-1), false);
120
120
  assert.equal(shouldAlertOnFailure(1.5), false);
121
121
  });
122
+
123
+ import { shouldStoreCameraFault } from "./.build/utils/camera-alert.util.mjs";
124
+
125
+ test("one inbox row per outage, not one per paced toast", () => {
126
+ // Replay the reconnect loop: failures 1..100, alerts where shouldAlertOnFailure says.
127
+ let alerted = 0;
128
+ let stored = 0;
129
+ let toasts = 0;
130
+ for (let failure = 1; failure <= 100; failure++) {
131
+ if (!shouldAlertOnFailure(failure)) continue;
132
+ toasts++;
133
+ if (shouldStoreCameraFault(alerted)) stored++;
134
+ alerted = failure;
135
+ }
136
+ assert.ok(toasts >= 4, "the live toast keeps its pacing");
137
+ assert.equal(stored, 1, "the inbox gets exactly one row for this outage");
138
+ // Reconnect resets the count, so the next outage is stored again.
139
+ alerted = 0;
140
+ assert.equal(shouldStoreCameraFault(alerted), true);
141
+ });
@@ -0,0 +1,70 @@
1
+ import test from "node:test";
2
+ import assert from "node:assert/strict";
3
+
4
+ import { MSite } from "./.build/models/site.model.mjs";
5
+
6
+ /**
7
+ * A new site's incident counter.
8
+ *
9
+ * `incident-report.service.ts` increments `metadata.incidentCounter` for every
10
+ * report filed. The key used to appear only on the first report — a dotted
11
+ * `$set` creates it — so a site's shape depended on whether anybody had filed
12
+ * one yet: absent on a new site, a number on an old one.
13
+ *
14
+ * Seeded at creation, every site has the same shape from the start. Every
15
+ * creation path funnels through `MSite`, so one default covers all three.
16
+ */
17
+
18
+ /** The minimum `siteSchema` accepts — every field below is required by it. */
19
+ const VALID = {
20
+ name: "Seventh Condominium",
21
+ orgId: "692132394150ca6a69b9f298",
22
+ address: {
23
+ line1: "1 Example Road",
24
+ city: "Singapore",
25
+ postalCode: "123456",
26
+ country: "Singapore",
27
+ },
28
+ };
29
+
30
+ test("a new site starts with a zero incident counter", () => {
31
+ const site = MSite({ ...VALID });
32
+ assert.equal(site.metadata.incidentCounter, 0);
33
+ });
34
+
35
+ /*
36
+ * Zero, not one. The service reads the current value and adds one, so the first
37
+ * report must produce 1 — seeding 1 would make it 2 and skip a number.
38
+ */
39
+ test("the seed is zero, so the first report is number one", () => {
40
+ const site = MSite({ ...VALID });
41
+ const firstReport = (site.metadata?.incidentCounter || 0) + 1;
42
+ assert.equal(firstReport, 1);
43
+ });
44
+
45
+ /*
46
+ * `siteSchema` refuses `metadata` on creation, so the counter cannot be
47
+ * supplied by a caller and the seeded value is the only one a new site can
48
+ * have. Documented here because it is the reason the default is unconditional.
49
+ */
50
+ test("metadata cannot be supplied at creation at all", () => {
51
+ assert.throws(
52
+ () => MSite({ ...VALID, metadata: { incidentCounter: 42 } }),
53
+ /metadata.*not allowed/,
54
+ );
55
+ });
56
+
57
+ /*
58
+ * The old behaviour for everything else: metadata held nothing when none was
59
+ * given, and the counter is still all a new site carries.
60
+ */
61
+ test("nothing else is invented in metadata", () => {
62
+ const site = MSite({ ...VALID });
63
+ assert.deepEqual(Object.keys(site.metadata), ["incidentCounter"]);
64
+ });
65
+ /* Optional fields left out entirely must not disturb the default. */
66
+ test("a site created with only the required fields still gets the counter", () => {
67
+ const site = MSite({ ...VALID });
68
+ assert.equal(site.metadata.incidentCounter, 0);
69
+ assert.equal(site.status, "active");
70
+ });
File without changes
File without changes