@things-factory/auth-base 10.1.269 → 10.1.271
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/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/controllers/access-request.js +16 -21
- package/dist-server/controllers/access-request.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/tests/access-entry-targets-db.test.ts +4 -2
- package/tests/access-request-db.test.ts +9 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/auth-base",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.271",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "dist-client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"@reduxjs/toolkit": "^2.2.5",
|
|
36
36
|
"@simplewebauthn/browser": "^13.0.0",
|
|
37
37
|
"@simplewebauthn/server": "^13.0.0",
|
|
38
|
-
"@things-factory/email-base": "^10.1.
|
|
38
|
+
"@things-factory/email-base": "^10.1.270",
|
|
39
39
|
"@things-factory/env": "^10.1.149",
|
|
40
|
-
"@things-factory/shell": "^10.1.
|
|
41
|
-
"@things-factory/task-lease": "^10.1.
|
|
40
|
+
"@things-factory/shell": "^10.1.270",
|
|
41
|
+
"@things-factory/task-lease": "^10.1.270",
|
|
42
42
|
"@things-factory/utils": "^10.1.179",
|
|
43
43
|
"@types/webappsec-credential-management": "^0.6.9",
|
|
44
44
|
"jsonwebtoken": "^9.0.0",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"passport-jwt": "^4.0.0",
|
|
51
51
|
"passport-local": "^1.0.0"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "843bc2608d8c89348ced871777535966758927db"
|
|
54
54
|
}
|
|
@@ -120,9 +120,11 @@ describe('the card says what the screen says', () => {
|
|
|
120
120
|
it.each(['GRANT', 'DENY'])('a stored AI decision applies %s through the same controller and schedules the result after commit', async decision => {
|
|
121
121
|
const request = await access.requestAccess({ category: 'warehouse', privilege: 'mutation', reason: 'inbound' }, { state: { ...state(kim), afterCommit: [] } } as any)
|
|
122
122
|
const target = targets.accessDecisionEntryTarget()
|
|
123
|
-
|
|
123
|
+
/* notification's `sendNotice` (ADR-0164 amendment 1), seen as who, where and what the notice says */
|
|
124
|
+
const notify = jest.fn()
|
|
125
|
+
const sendNotice = (notice: any) => notify({ receivers: notice.receivers.map((one: any) => one.id), url: notice.address, title: notice.words('ko').subject })
|
|
124
126
|
const afterCommit: any[] = []
|
|
125
|
-
const context = { state: { ...state(park),
|
|
127
|
+
const context = { state: { ...state(park), sendNotice, afterCommit }, t: (key: string) => key }
|
|
126
128
|
const execute = jest.fn(async (document, variables) => {
|
|
127
129
|
expect(document).toBe(target.mutation)
|
|
128
130
|
const decided = await access.decideAccessRequest(variables.decision, context)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Asking, deciding, telling - the access request end to end on the database (ADR-0103).
|
|
3
3
|
*
|
|
4
|
-
* The controller is called with a request state as the doors receive it. `
|
|
4
|
+
* The controller is called with a request state as the doors receive it. `sendNotice` is a spy: the notification
|
|
5
5
|
* module is optional and the row is the record.
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -41,11 +41,17 @@ async function makeUser(name: string, domains: any[], roles: any[] = [], over: a
|
|
|
41
41
|
})
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
/* notification's `sendNotice` (ADR-0164 amendment 1), seen as who, where and what the notice says */
|
|
45
|
+
const noticeSpy = () => {
|
|
46
|
+
const told = jest.fn()
|
|
47
|
+
return { told, sendNotice: (notice: any) => told({ receivers: notice.receivers.map((one: any) => one.id), url: notice.address, title: notice.words('ko').subject }) }
|
|
48
|
+
}
|
|
49
|
+
|
|
44
50
|
function contextOf(user: any, over: any = {}) {
|
|
45
|
-
const notify =
|
|
51
|
+
const { told: notify, sendNotice } = noticeSpy()
|
|
46
52
|
const afterCommit: any[] = []
|
|
47
53
|
return {
|
|
48
|
-
state: { domain, user, afterCommit,
|
|
54
|
+
state: { domain, user, afterCommit, sendNotice, ...over },
|
|
49
55
|
t: (key: string) => key,
|
|
50
56
|
afterCommit,
|
|
51
57
|
notify
|