@7365admin1/core 3.52.2-staging.235 → 3.52.2-staging.237
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/.changeset/vehicle-anpr-revoke-safety.md +11 -0
- package/.changeset/vehicle-create-fail-closed.md +10 -0
- package/dist/index.d.ts +48 -6
- package/dist/index.js +3332 -3068
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3332 -3068
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/test/anpr-revoke.test.mjs +81 -0
- package/test/vehicle-create-and-delete-safety.test.mjs +156 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@7365admin1/core": patch
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Vehicle management: make deleting and editing a vehicle safe against the ANPR cameras.
|
|
6
|
+
|
|
7
|
+
Deleting a vehicle no longer reports success when the plate is still on a camera. `bypass` now defaults to false, `removePlateNumber` returns an explicit per-camera outcome instead of swallowing its error, and a delete that cannot be confirmed on every camera holding the plate is refused with the record left intact so it can be retried. A site with no ANPR camera has nothing to revoke and now deletes successfully instead of failing with "No site cameras found."
|
|
8
|
+
|
|
9
|
+
Each camera is asked for its own record id before the removal, because a Dahua `recNo` is a per-device sequence number and the one stored on the vehicle only matches whichever camera was written last. Editing only the vehicle's name now removes the old whitelist record before inserting the new one, instead of leaving the previous entry on the camera for good.
|
|
10
|
+
|
|
11
|
+
Also: `pullVehicleByRecNo` is scoped to the person or site the plate belongs to (it matched on the record id alone, which is not unique across devices), the paginated camera lookups no longer skip their last page, and editing or deleting a vehicle now requires `vehicle-mgmt:update-vehicle` / `vehicle-mgmt:delete-vehicle` on the server, matching the gate the apps already apply in the browser.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@7365admin1/core": patch
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Vehicle ANPR: create now fails closed, an unregistered vehicle can be deleted, and camera errors are readable
|
|
6
|
+
|
|
7
|
+
- `add()` no longer reports "added to whitelist successfully" when nothing was written to a camera. Camera failures are collected per camera, any plate already written is taken back off, and the whole create is refused. A site with no active ANPR camera saves the vehicle but says plainly that the barrier does not know about it.
|
|
8
|
+
- Deleting a vehicle with a blank or missing `recno` is no longer rejected by request validation. The per-camera revoke guarantee is unchanged.
|
|
9
|
+
- Dahua's own reply (`Invalid Authority!`, `{"ErrorCode":...}`) is logged server-side and no longer put into the message the operator sees, on create, approve and edit.
|
|
10
|
+
- Editing a vehicle restores the previous plate on the camera if the re-insert fails, instead of leaving the resident locked out by a change the database then rolls back.
|
package/dist/index.d.ts
CHANGED
|
@@ -2505,6 +2505,31 @@ declare function useBuildingUnitController(): {
|
|
|
2505
2505
|
getAllLevelsWithUnits: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
2506
2506
|
};
|
|
2507
2507
|
|
|
2508
|
+
/**
|
|
2509
|
+
* "Was this plate actually taken off the camera?" — the one place that answers
|
|
2510
|
+
* it, for the three paths that revoke an ANPR whitelist/blocklist record:
|
|
2511
|
+
* deleting a vehicle, and the two branches of editing one.
|
|
2512
|
+
*
|
|
2513
|
+
* The reason this file exists: `removePlateNumber` used to `catch`, log, and
|
|
2514
|
+
* return `undefined`, so a device that refused, timed out or was unreachable
|
|
2515
|
+
* came back looking exactly like one that had removed the record. The delete
|
|
2516
|
+
* path then reported "Vehicle deleted successfully." while the plate was still
|
|
2517
|
+
* on the barrier — the vehicle could keep driving in after the record was gone
|
|
2518
|
+
* from the system, and there was nothing on screen to say so.
|
|
2519
|
+
*
|
|
2520
|
+
* Nothing here talks to a device or to the database, so it is testable on its
|
|
2521
|
+
* own — see `test/anpr-revoke.test.mjs`.
|
|
2522
|
+
*/
|
|
2523
|
+
/** One camera's answer to "remove this record". */
|
|
2524
|
+
type AnprRevokeOutcome = {
|
|
2525
|
+
/** True ONLY when the device confirmed the removal, or held nothing to remove. */
|
|
2526
|
+
ok: boolean;
|
|
2527
|
+
/** HTTP status the device answered with, when it answered at all. */
|
|
2528
|
+
statusCode?: number;
|
|
2529
|
+
/** Why it failed, in words an operator can act on. Empty when `ok`. */
|
|
2530
|
+
reason: string;
|
|
2531
|
+
};
|
|
2532
|
+
|
|
2508
2533
|
declare enum CameraType {
|
|
2509
2534
|
IP = "ip",
|
|
2510
2535
|
ANPR = "anpr"
|
|
@@ -2573,7 +2598,7 @@ declare function useDahuaService(): {
|
|
|
2573
2598
|
password: string;
|
|
2574
2599
|
mode: string;
|
|
2575
2600
|
recno: string;
|
|
2576
|
-
}) => Promise<
|
|
2601
|
+
}) => Promise<AnprRevokeOutcome>;
|
|
2577
2602
|
updatePlateNumber: (value: {
|
|
2578
2603
|
host: string;
|
|
2579
2604
|
username: string;
|
|
@@ -2592,6 +2617,18 @@ declare function useDahuaService(): {
|
|
|
2592
2617
|
password: string;
|
|
2593
2618
|
mode: string;
|
|
2594
2619
|
plateNumber: string;
|
|
2620
|
+
/**
|
|
2621
|
+
* Treat a device that did not answer 200 as an error rather than as "the
|
|
2622
|
+
* plate is not on this camera".
|
|
2623
|
+
*
|
|
2624
|
+
* `useDahuaDigest` does not throw on a bad status, so a 401 or a 500 comes
|
|
2625
|
+
* back as an empty body, which `parseDahuaFind` reads as `found=0`. For the
|
|
2626
|
+
* visitor check-in callers that has always meant "not blocklisted" and is
|
|
2627
|
+
* left exactly as it is — a camera fault must not stop a visitor at the
|
|
2628
|
+
* gate. For the vehicle revoke paths it would mean "nothing to remove", and
|
|
2629
|
+
* they must not conclude that from a camera that never answered.
|
|
2630
|
+
*/
|
|
2631
|
+
requireOk?: boolean;
|
|
2595
2632
|
}) => Promise<any>;
|
|
2596
2633
|
bulkInsertPlateNumber: (value: {
|
|
2597
2634
|
host: string;
|
|
@@ -4109,7 +4146,7 @@ declare function useCameraViewService(): {
|
|
|
4109
4146
|
userId?: string;
|
|
4110
4147
|
}) => Promise<{
|
|
4111
4148
|
reason: string;
|
|
4112
|
-
verified: "recorder-video-port"
|
|
4149
|
+
verified: "nothing" | "recorder-video-port";
|
|
4113
4150
|
verifiedDescription: string;
|
|
4114
4151
|
cameraVerified: null;
|
|
4115
4152
|
relayVerified: null;
|
|
@@ -4123,7 +4160,7 @@ declare function useCameraViewService(): {
|
|
|
4123
4160
|
driftSeconds: null;
|
|
4124
4161
|
detailUnavailableReason: string | null;
|
|
4125
4162
|
} | {
|
|
4126
|
-
verified: "recorder-video-port"
|
|
4163
|
+
verified: "nothing" | "recorder-video-port";
|
|
4127
4164
|
verifiedDescription: string;
|
|
4128
4165
|
cameraVerified: null;
|
|
4129
4166
|
relayVerified: null;
|
|
@@ -4166,7 +4203,7 @@ declare function useCameraViewService(): {
|
|
|
4166
4203
|
}) => Promise<{
|
|
4167
4204
|
cameras: ({
|
|
4168
4205
|
reason: string;
|
|
4169
|
-
verified: "recorder-video-port"
|
|
4206
|
+
verified: "nothing" | "recorder-video-port";
|
|
4170
4207
|
verifiedDescription: string;
|
|
4171
4208
|
cameraVerified: null;
|
|
4172
4209
|
relayVerified: null;
|
|
@@ -4180,7 +4217,7 @@ declare function useCameraViewService(): {
|
|
|
4180
4217
|
lastFrameAt: string | null;
|
|
4181
4218
|
unavailableReason: string | null;
|
|
4182
4219
|
} | {
|
|
4183
|
-
verified: "recorder-video-port"
|
|
4220
|
+
verified: "nothing" | "recorder-video-port";
|
|
4184
4221
|
verifiedDescription: string;
|
|
4185
4222
|
cameraVerified: null;
|
|
4186
4223
|
relayVerified: null;
|
|
@@ -5011,7 +5048,12 @@ declare function usePersonRepo(): {
|
|
|
5011
5048
|
plateNumber: string;
|
|
5012
5049
|
recNo: string;
|
|
5013
5050
|
}, session?: ClientSession) => Promise<void>;
|
|
5014
|
-
pullVehicleByRecNo: (recNo: string,
|
|
5051
|
+
pullVehicleByRecNo: (recNo: string, scope: {
|
|
5052
|
+
peopleId?: string | ObjectId;
|
|
5053
|
+
site?: string | ObjectId;
|
|
5054
|
+
/** Used INSTEAD of `recNo` when the vehicle never got a record id. */
|
|
5055
|
+
plateNumber?: string;
|
|
5056
|
+
}, session?: ClientSession) => Promise<void>;
|
|
5015
5057
|
getByUserId: (userId: string | ObjectId) => Promise<TPerson | null>;
|
|
5016
5058
|
reviewResidentPerson: (_id: ObjectId | string, value: Partial<TPerson>, session?: ClientSession) => Promise<mongodb.UpdateResult<TPerson>>;
|
|
5017
5059
|
addFromVisitor: (value: visitorPersonRepo, session?: ClientSession) => Promise<mongodb.InsertOneResult<TPerson>>;
|