@7365admin1/core 3.8.0 → 3.10.0

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,441 @@
1
+ # HID Amico UI Design Scope
2
+
3
+ This document summarizes the product features needed for HID Amico integration UI design.
4
+
5
+ ## Core Product Concept
6
+
7
+ The HID reader recognizes faces locally. iService365 does not perform face recognition.
8
+
9
+ iService365 is responsible for:
10
+
11
+ - Registering and managing HID readers.
12
+ - Testing reader connectivity.
13
+ - Pulling enrolled HID users.
14
+ - Pulling HID access logs.
15
+ - Mapping HID users/cards to iService365 records.
16
+ - Showing access history and unmapped scans.
17
+ - Receiving callback/monitor events when the network supports it.
18
+ - Providing restricted admin tools for low-level HID object operations.
19
+
20
+ ## Recommended Navigation
21
+
22
+ ```text
23
+ Access Management
24
+ - HID Readers
25
+ - HID Users
26
+ - Identity Mapping
27
+ - Access Logs
28
+ - Monitor / Callback
29
+ - Admin Object Tools
30
+ ```
31
+
32
+ ## 1. HID Reader Management
33
+
34
+ Purpose: register and manage HID readers per site.
35
+
36
+ Main screens:
37
+
38
+ - Reader list
39
+ - Add reader
40
+ - Edit reader
41
+ - Reader detail
42
+ - Connection test result
43
+ - Sync/operation history
44
+
45
+ Reader fields:
46
+
47
+ ```text
48
+ Name
49
+ Site
50
+ Base URL / IP address
51
+ Username
52
+ Password
53
+ Device ID
54
+ Monitor path
55
+ Enabled
56
+ Status
57
+ Last seen at
58
+ Last sync at
59
+ Last sync status
60
+ Last sync message
61
+ Password set
62
+ ```
63
+
64
+ Backend APIs:
65
+
66
+ ```text
67
+ GET /api/access-management/hid/readers
68
+ POST /api/access-management/hid/readers
69
+ PATCH /api/access-management/hid/readers/:readerId
70
+ DELETE /api/access-management/hid/readers/:readerId
71
+ POST /api/access-management/hid/readers/:readerId/test
72
+ POST /api/access-management/hid/readers/:readerId/sync
73
+ ```
74
+
75
+ Design notes:
76
+
77
+ - Do not display saved password value.
78
+ - Display `passwordSet` as a simple status.
79
+ - Allow disabling a reader without deleting it.
80
+ - Show a clear status for connection test: success, failed, last tested.
81
+ - Show whether the backend can reach the reader network.
82
+
83
+ ## 2. HID Users
84
+
85
+ Purpose: show users enrolled on the HID reader.
86
+
87
+ HID source object:
88
+
89
+ ```text
90
+ users
91
+ ```
92
+
93
+ Known fields:
94
+
95
+ ```text
96
+ id
97
+ name
98
+ registration
99
+ user_type_id
100
+ image_timestamp
101
+ last_access
102
+ ```
103
+
104
+ Backend API:
105
+
106
+ ```text
107
+ POST /api/access-management/hid/readers/:readerId/objects
108
+ ```
109
+
110
+ Payload:
111
+
112
+ ```json
113
+ {
114
+ "operation": "load",
115
+ "object": "users",
116
+ "limit": 100,
117
+ "offset": 0
118
+ }
119
+ ```
120
+
121
+ Recommended UI:
122
+
123
+ - HID users table
124
+ - Search by name
125
+ - Search by HID user ID
126
+ - Show face/image enrolled status
127
+ - Show last access time
128
+ - Show mapped/unmapped badge
129
+ - Action: create identity mapping
130
+
131
+ Design notes:
132
+
133
+ - HID `users.id` is not the iService365 `user` ObjectId.
134
+ - Some HID users have empty `registration`.
135
+ - Unmapped HID users are expected and should be easy to map.
136
+
137
+ ## 3. Identity Mapping
138
+
139
+ Purpose: connect a HID identity to an iService365 record.
140
+
141
+ Mapping keys:
142
+
143
+ ```text
144
+ hidUserId
145
+ registration
146
+ cardNo
147
+ ```
148
+
149
+ Can map to:
150
+
151
+ ```text
152
+ iService365 user
153
+ Person
154
+ Member
155
+ Visitor
156
+ ```
157
+
158
+ Supported identity types:
159
+
160
+ ```text
161
+ resident
162
+ staff
163
+ contractor
164
+ visitor
165
+ unknown
166
+ ```
167
+
168
+ Backend APIs:
169
+
170
+ ```text
171
+ GET /api/access-management/hid/readers/:readerId/identities
172
+ POST /api/access-management/hid/readers/:readerId/identities
173
+ PATCH /api/access-management/hid/identities/:identityId
174
+ DELETE /api/access-management/hid/identities/:identityId
175
+ ```
176
+
177
+ Recommended UI:
178
+
179
+ - Mapping list
180
+ - Create mapping
181
+ - Edit mapping
182
+ - Delete mapping
183
+ - Search mappings
184
+ - Filter by type/status
185
+ - Badge states: mapped, unmapped, inactive, deleted
186
+
187
+ Design notes:
188
+
189
+ - At least one of `hidUserId`, `registration`, or `cardNo` is required.
190
+ - `user`, `person`, `member`, and `visitor` must be MongoDB ObjectIds.
191
+ - Numeric HID ids should go into `hidUserId`, not `user`.
192
+ - Duplicate active/inactive mappings for the same reader and same HID key are blocked.
193
+
194
+ ## 4. Access Logs / Scan History
195
+
196
+ Purpose: show face/card scan history from the HID reader.
197
+
198
+ HID source object:
199
+
200
+ ```text
201
+ access_logs
202
+ ```
203
+
204
+ Known fields:
205
+
206
+ ```text
207
+ id
208
+ time
209
+ event
210
+ device_id
211
+ identifier_id
212
+ user_id
213
+ portal_id
214
+ identification_rule_id
215
+ card_value
216
+ qrcode_value
217
+ pin_value
218
+ confidence
219
+ mask
220
+ log_type_id
221
+ ```
222
+
223
+ Important:
224
+
225
+ - `time` is Unix time in seconds.
226
+ - For Philippines sites, display using `Asia/Manila`.
227
+ - `access_logs.user_id` maps to HID `users.id`.
228
+ - It does not directly map to iService365 `user`.
229
+
230
+ Backend API:
231
+
232
+ ```text
233
+ POST /api/access-management/hid/readers/:readerId/objects
234
+ ```
235
+
236
+ Payload:
237
+
238
+ ```json
239
+ {
240
+ "operation": "load",
241
+ "object": "access_logs",
242
+ "limit": 50,
243
+ "offset": 0
244
+ }
245
+ ```
246
+
247
+ Filter by HID user:
248
+
249
+ ```json
250
+ {
251
+ "operation": "load",
252
+ "object": "access_logs",
253
+ "where": {
254
+ "access_logs": {
255
+ "user_id": 3
256
+ }
257
+ },
258
+ "limit": 20
259
+ }
260
+ ```
261
+
262
+ Recommended UI:
263
+
264
+ - Access logs table
265
+ - Timeline view
266
+ - Filter by reader
267
+ - Filter by HID user
268
+ - Filter by date range
269
+ - Show mapped user/person/member/visitor when available
270
+ - Show raw HID user id when unmapped
271
+ - Show confidence
272
+ - Show event time in site timezone
273
+
274
+ Design notes:
275
+
276
+ - A scan can appear in the HID web portal before iService365 has pulled it.
277
+ - Unmapped scans should be visible, not hidden.
278
+ - Show an "Unmapped" warning badge and offer a mapping action.
279
+
280
+ ## 5. Backend Event Logs
281
+
282
+ Purpose: show backend-side integration events.
283
+
284
+ Backend API:
285
+
286
+ ```text
287
+ GET /api/access-management/hid/readers/:readerId/logs?page=1&limit=20
288
+ ```
289
+
290
+ Examples:
291
+
292
+ ```text
293
+ test
294
+ sync
295
+ sync_failed
296
+ objects_load
297
+ objects_create
298
+ objects_modify
299
+ objects_destroy
300
+ objects_load_failed
301
+ callback event types
302
+ ```
303
+
304
+ Recommended UI:
305
+
306
+ - Technical event log list
307
+ - Filter by event type
308
+ - Status
309
+ - Created time
310
+ - Payload viewer
311
+ - Error details
312
+ - Matched identity if available
313
+
314
+ Design notes:
315
+
316
+ - This is an admin/debug feature.
317
+ - Collapse raw payload by default.
318
+ - Use this for troubleshooting integration issues.
319
+
320
+ ## 6. Monitor / Callback
321
+
322
+ Purpose: receive push events from HID when a scan or device event occurs.
323
+
324
+ Backend endpoint:
325
+
326
+ ```text
327
+ POST /api/access-management/hid/notifications/:readerId/:type
328
+ ```
329
+
330
+ Potential event types:
331
+
332
+ ```text
333
+ new_user_identified
334
+ access_photo
335
+ door
336
+ card
337
+ pin
338
+ push_result
339
+ ```
340
+
341
+ Recommended UI:
342
+
343
+ - Callback URL display
344
+ - Copy callback URL
345
+ - Last callback received
346
+ - Last callback payload preview
347
+ - Last callback identity resolution status
348
+ - Callback setup status
349
+
350
+ Design notes:
351
+
352
+ - HID must be able to reach the backend URL.
353
+ - `localhost:5001` will not work from the HID reader.
354
+ - For deployed usage, use the deployed API domain.
355
+ - For private-network testing, use VPN/subnet routing.
356
+ - Callback is optional if the system relies on pull-based access logs.
357
+
358
+ ## 7. Door / Relay Actions
359
+
360
+ Purpose: support door/relay actions only if the device firmware supports them.
361
+
362
+ Backend APIs:
363
+
364
+ ```text
365
+ GET /api/access-management/hid/readers/:readerId/door-state
366
+ POST /api/access-management/hid/readers/:readerId/actions
367
+ ```
368
+
369
+ Observed test result:
370
+
371
+ ```json
372
+ {
373
+ "error": "Invalid command: door_state",
374
+ "code": 1
375
+ }
376
+ ```
377
+
378
+ Design notes:
379
+
380
+ - Door state is not guaranteed for all firmware.
381
+ - Open door/open relay should be optional.
382
+ - UI should show "Not supported by this device" when the command fails with invalid command.
383
+
384
+ Possible UI actions:
385
+
386
+ ```text
387
+ Open door
388
+ Open relay
389
+ Check door state
390
+ Check relay state
391
+ ```
392
+
393
+ ## 8. Admin Object Tools
394
+
395
+ Purpose: low-level HID API testing and support.
396
+
397
+ Backend API:
398
+
399
+ ```text
400
+ POST /api/access-management/hid/readers/:readerId/objects
401
+ ```
402
+
403
+ Supported operations:
404
+
405
+ ```text
406
+ load
407
+ create
408
+ modify
409
+ destroy
410
+ ```
411
+
412
+ Known working objects:
413
+
414
+ ```text
415
+ users
416
+ access_logs
417
+ ```
418
+
419
+ Recommended UI:
420
+
421
+ - Object name input/select
422
+ - Operation select
423
+ - JSON payload editor
424
+ - Response viewer
425
+ - Error viewer
426
+
427
+ Design notes:
428
+
429
+ - Restrict this to admin/dev roles.
430
+ - Destructive operations must require confirmation.
431
+ - This is not a normal resident/staff workflow.
432
+
433
+ ## Product Rules
434
+
435
+ - HID is the source of biometric enrollment.
436
+ - HID is the source of raw access logs.
437
+ - iService365 maps HID identities to internal records.
438
+ - iService365 should display unmapped scans.
439
+ - Callback and pull logs are separate integration modes.
440
+ - Door/relay features depend on firmware support.
441
+ - UI should separate normal operations from admin/debug tools.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@7365admin1/core",
3
3
  "license": "MIT",
4
- "version": "3.8.0",
4
+ "version": "3.10.0",
5
5
  "author": "7365admin1",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.mjs",