@7365admin1/core 3.42.0 → 3.42.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 +87 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +3687 -3402
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3715 -3430
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -2
- package/test/camera-alert.util.test.mjs +109 -0
- package/test/dahua-protocol.util.test.mjs +217 -0
- package/test/e2e/harness.mjs +426 -0
- package/test/e2e/service-provider-invite.e2e.test.mjs +471 -0
- package/test/service-provider-invite.test.mjs +198 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,92 @@
|
|
|
1
1
|
# @iservice365/core
|
|
2
2
|
|
|
3
|
+
## 3.42.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7078e6f: Make ANPR "Connection Lost" alerts readable, paced, and self-clearing
|
|
8
|
+
|
|
9
|
+
The alert an operator actually saw was `Camera [Seventh Condominium-both]
|
|
10
|
+
Connection Lost. Retrying in 10 seconds. Check the camera if this issue
|
|
11
|
+
persists, Or set the camera to Inactive to stop this notification.` Three
|
|
12
|
+
things were wrong with it:
|
|
13
|
+
|
|
14
|
+
- `[<site>-<direction>]` glued a database enum onto the site name and showed it
|
|
15
|
+
as if it were a place. "both" is the camera's direction setting, not
|
|
16
|
+
somewhere you can go. The camera is now named the way the setup form names
|
|
17
|
+
it — by its own name where it has one, otherwise "the entry and exit ANPR
|
|
18
|
+
camera at <site>".
|
|
19
|
+
- It told the operator to set the camera Inactive to stop the alert. On a
|
|
20
|
+
camera driving a barrier, that is advice to switch off plate reading in order
|
|
21
|
+
to silence the warning that plate reading is off. Removed.
|
|
22
|
+
- It was emitted on every reconnect attempt — once every 10 seconds with no
|
|
23
|
+
ceiling — into a snackbar with a 20-second timeout, so a camera that stayed
|
|
24
|
+
down held a red toast on screen permanently, on every page. One hour of
|
|
25
|
+
downtime produced 360 alerts.
|
|
26
|
+
|
|
27
|
+
Alerts are now paced: the first failure, then roughly 1, 5 and 15 minutes, then
|
|
28
|
+
every 15 minutes for as long as it stays down. When the camera answers again,
|
|
29
|
+
an operator who was told it was down is told it is back; if they were never
|
|
30
|
+
alerted, nothing is sent.
|
|
31
|
+
|
|
32
|
+
**The reconnect loop itself is unchanged and still retries every 10 seconds** —
|
|
33
|
+
only the alerting is paced. A barrier camera has to come back the moment it can.
|
|
34
|
+
|
|
35
|
+
Recovery and fault alerts also carry `event` and `camera` fields so a client can
|
|
36
|
+
group or clear alerts per camera rather than matching on message text. Existing
|
|
37
|
+
clients ignore them and render `message` as they always have.
|
|
38
|
+
|
|
39
|
+
- a5d2b88: Stop logging camera and mailer credentials
|
|
40
|
+
|
|
41
|
+
Six places wrote a secret or a resident's details to stdout on an ordinary code
|
|
42
|
+
path. `getTrafficJunction` dumped the whole `TSiteCamera` object — including the
|
|
43
|
+
camera's `username` and plaintext `password` — on every reconnect, and
|
|
44
|
+
`addPlateNumber` logged its argument, which carries the same password plus a
|
|
45
|
+
resident's plate number and owner name. `checkOutBySiteAndPlate` logged the
|
|
46
|
+
matched visitor transaction. `siteCameraRepo.updateById` logged the re-read
|
|
47
|
+
camera document, and `vehicleService.add` logged the whole array of a site's
|
|
48
|
+
cameras, both with credentials in them. `sendEmail` printed `MAILER_PASSWORD`
|
|
49
|
+
itself on every message sent.
|
|
50
|
+
|
|
51
|
+
All now log identifiers, counts and outcomes only, through the module's logger
|
|
52
|
+
rather than `console.log`; the mailer line is removed outright because it
|
|
53
|
+
carried nothing but the secret.
|
|
54
|
+
|
|
55
|
+
- b472360: Fix three Dahua HTTP API defects found by checking our integration against the
|
|
56
|
+
vendor specification (V3.37):
|
|
57
|
+
|
|
58
|
+
- The ANPR reconnect loop retried authentication ten times at one-second
|
|
59
|
+
intervals. The device locks the account for 1800 seconds after three failed
|
|
60
|
+
logins in thirty, so our own recovery could take ANPR down at a site for half
|
|
61
|
+
an hour. Authentication now backs off well past the device's counting window,
|
|
62
|
+
and a network fault is distinguished from an authentication failure.
|
|
63
|
+
- 401 and 403 were handled backwards. Per spec §3.4, 401 is the digest
|
|
64
|
+
challenge (retry) and 403 is a credentials rejection (stop). We treated 403 as
|
|
65
|
+
an account lock and killed the listener, and counted 401s toward a "wrong
|
|
66
|
+
password" warning.
|
|
67
|
+
- `updatePlateNumber`, `bulkInsertPlateNumber` and `removePlateNumber`
|
|
68
|
+
interpolated values into the CGI query string unencoded, against the spec's
|
|
69
|
+
stated RFC 3986 requirement. A plate or owner name containing a space or "&"
|
|
70
|
+
broke the request or appended extra parameters to it.
|
|
71
|
+
|
|
72
|
+
## 3.42.1
|
|
73
|
+
|
|
74
|
+
### Patch Changes
|
|
75
|
+
|
|
76
|
+
- 87c073f: Make the "an invitation is already waiting" check actually find the invitation
|
|
77
|
+
|
|
78
|
+
The duplicate-invitation guard added with the existing-provider invite fix never
|
|
79
|
+
fired. Invitations are written with `metadata.siteId` as an ObjectId, but the
|
|
80
|
+
lookup searched for the site id as the plain string it arrived as on the request,
|
|
81
|
+
and MongoDB does not treat the two as equal. The query therefore always came back
|
|
82
|
+
empty: a property manager could send the same service provider a second, third
|
|
83
|
+
and fourth invitation for the same site while the first was still valid, and each
|
|
84
|
+
one produced another email and another pending row for them to chase.
|
|
85
|
+
|
|
86
|
+
The lookup now matches either form, so older records that hold the string are
|
|
87
|
+
still found. Nothing else changes: the refusal message and the status code are
|
|
88
|
+
the ones already shipped.
|
|
89
|
+
|
|
3
90
|
## 3.42.0
|
|
4
91
|
|
|
5
92
|
### Minor Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1613,7 +1613,7 @@ declare function useServiceProviderRepo(): {
|
|
|
1613
1613
|
siteId?: string | ObjectId | undefined;
|
|
1614
1614
|
orgId?: string | ObjectId | undefined;
|
|
1615
1615
|
serviceProviderOrgId?: string | ObjectId | undefined;
|
|
1616
|
-
}) => Promise<{}
|
|
1616
|
+
}) => Promise<{}>;
|
|
1617
1617
|
updateStatusById: (_id: string | ObjectId, status: string) => Promise<mongodb.UpdateResult<bson.Document>>;
|
|
1618
1618
|
};
|
|
1619
1619
|
|
|
@@ -1621,6 +1621,7 @@ declare function useServiceProviderController(): {
|
|
|
1621
1621
|
createServiceProvider: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
1622
1622
|
getServiceProviders: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
1623
1623
|
getByProviderOrg: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
1624
|
+
getByEmail: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
1624
1625
|
getServiceProviderNames: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
1625
1626
|
getServiceProviderTypes: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
1626
1627
|
getServiceProviderById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
@@ -2605,6 +2606,7 @@ declare function useCustomerSiteRepo(): {
|
|
|
2605
2606
|
name: string;
|
|
2606
2607
|
org: string | ObjectId;
|
|
2607
2608
|
}) => Promise<TCustomerSite[]>;
|
|
2609
|
+
countActiveByOrgAndSite: (org: string | ObjectId, site: string | ObjectId) => Promise<number>;
|
|
2608
2610
|
getBySiteAsServiceProvider: (site: string | ObjectId) => Promise<{} | undefined>;
|
|
2609
2611
|
getById: (id: string | ObjectId) => Promise<mongodb.WithId<bson.Document>>;
|
|
2610
2612
|
updateCustomerSiteById: (id: string | ObjectId, payload: Partial<TCustomerSite>, session?: ClientSession) => Promise<mongodb.WithId<bson.Document>>;
|
|
@@ -2613,7 +2615,7 @@ declare function useCustomerSiteRepo(): {
|
|
|
2613
2615
|
|
|
2614
2616
|
declare function useCustomerSiteService(): {
|
|
2615
2617
|
add: (value: TCustomerSite) => Promise<string>;
|
|
2616
|
-
addViaInvite: (invite: string) => Promise<
|
|
2618
|
+
addViaInvite: (invite: string) => Promise<"This site is already on your list." | "Invite accepted, successfully added site.">;
|
|
2617
2619
|
updateCusSiteById: (customerSiteId: string, payload: Partial<TCustomerSite>) => Promise<mongodb.WithId<bson.Document>>;
|
|
2618
2620
|
};
|
|
2619
2621
|
|
|
@@ -7079,6 +7081,7 @@ declare function useVerificationRepoV2(): {
|
|
|
7079
7081
|
updateStatusById: (_id: string | ObjectId, status: string, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
|
|
7080
7082
|
countPendingOrgInvites: (orgId: string | ObjectId) => Promise<number>;
|
|
7081
7083
|
getPendingVerificationByEmail: (email: string) => Promise<TVerificationV2 | null>;
|
|
7084
|
+
getPendingServiceProviderInvite: (email: string, siteId: string) => Promise<TVerificationV2 | null>;
|
|
7082
7085
|
updateVerificationCodeById: (_id: string | ObjectId, verificationCode: string, expireAt: string, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
|
|
7083
7086
|
completePendingInvites: ({ email, orgId, siteId, app, session, }: {
|
|
7084
7087
|
email: string;
|