@things-factory/auth-base 10.1.228 → 10.1.232
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/service/index.d.ts +1 -1
- package/dist-server/service/index.js +2 -1
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/privilege/privilege-directive.d.ts +9 -0
- package/dist-server/service/privilege/privilege-directive.js +36 -14
- package/dist-server/service/privilege/privilege-directive.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/tests/declare-privileges.test.ts +29 -0
- package/tests/open-fields-framework.test.ts +1 -1
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.232",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "dist-client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"passport-jwt": "^4.0.0",
|
|
51
51
|
"passport-local": "^1.0.0"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "9307e1db833f13018e3f0ca9b1050f947cbefd68"
|
|
54
54
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A privilege asked in code only - an issued document kind's rule (ADR-0176) - is declared with `declarePrivileges`, so
|
|
3
|
+
* the sync makes its rows and a role task naming it can be applied. 10.1.81 asked `employee-certificate` with
|
|
4
|
+
* `checkPermission` alone; no row was ever made and the template naming it was refused (2026-10-30).
|
|
5
|
+
*/
|
|
6
|
+
import { loadCompiled } from './compiled'
|
|
7
|
+
|
|
8
|
+
const { declarePrivileges } = loadCompiled('service/privilege/privilege-directive')
|
|
9
|
+
const { undeclaredTaskGrants } = loadCompiled('service/role-template/role-task')
|
|
10
|
+
|
|
11
|
+
describe('declarePrivileges', () => {
|
|
12
|
+
it('declares the pairs, so a task naming them is whole', () => {
|
|
13
|
+
declarePrivileges('test kind', [
|
|
14
|
+
['test-certificate', 'query'],
|
|
15
|
+
['test-certificate', 'mutation']
|
|
16
|
+
])
|
|
17
|
+
expect(process['PRIVILEGES']['test-certificate query']).toEqual(['test-certificate', 'query'])
|
|
18
|
+
expect(undeclaredTaskGrants({ id: 'test.issuing', grants: [{ category: 'test-certificate', axes: ['query', 'mutation'] }] })).toEqual([])
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
it('refuses an axis the installation does not declare, as @privilege does', () => {
|
|
22
|
+
expect(() => declarePrivileges('test kind', [['test-certificate', 'mutaiton']])).toThrow(/axis "mutaiton"/)
|
|
23
|
+
expect(process['PRIVILEGES']['test-certificate mutaiton']).toBeUndefined()
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it('refuses an empty category', () => {
|
|
27
|
+
expect(() => declarePrivileges('test kind', [['', 'query']])).toThrow(/empty/)
|
|
28
|
+
})
|
|
29
|
+
})
|
|
@@ -43,7 +43,7 @@ const PACKAGES = join(__dirname, '..', '..')
|
|
|
43
43
|
* 2026-09-24: auth-base only. The generator below writes the rest; running it for the framework is
|
|
44
44
|
* the next step of §8 step 1 and was held back from the 10.1.38 cut so it could be verified first.
|
|
45
45
|
*/
|
|
46
|
-
const OPTED_IN = ['auth-base']
|
|
46
|
+
const OPTED_IN = ['auth-base', 'pdf']
|
|
47
47
|
|
|
48
48
|
/** Modules that cannot be measured here, and why. Adding one needs its reason. */
|
|
49
49
|
const CANNOT_MEASURE: Record<string, string> = {
|