@tillhub/schemas 6.396.0 → 6.397.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.
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [6.397.0](https://github.com/tillhub/schemas/compare/v6.396.0...v6.397.0) (2025-07-24)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **UNTIL-12873:** add stricter validation for user scopes ([#1079](https://github.com/tillhub/schemas/issues/1079)) ([9eb8c77](https://github.com/tillhub/schemas/commit/9eb8c77))
|
|
7
|
+
|
|
1
8
|
# [6.396.0](https://github.com/tillhub/schemas/compare/v6.395.0...v6.396.0) (2025-07-23)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -9,8 +9,15 @@ module.exports = {
|
|
|
9
9
|
type: 'array',
|
|
10
10
|
uniqueItems: true,
|
|
11
11
|
items: {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
oneOf: [
|
|
13
|
+
{
|
|
14
|
+
type: 'string',
|
|
15
|
+
enum: require('../../common/permissions').staff.items.enum
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
type: 'string'
|
|
19
|
+
}
|
|
20
|
+
]
|
|
14
21
|
}
|
|
15
22
|
},
|
|
16
23
|
{
|
package/package.json
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
const test = require('tape')
|
|
3
2
|
const validate = require('../../helpers/validate-schema')
|
|
4
3
|
|
|
@@ -19,3 +18,33 @@ test('User Permission Templates V0: update schema validation', function (t) {
|
|
|
19
18
|
t.error(error, 'should not get any error')
|
|
20
19
|
t.end()
|
|
21
20
|
})
|
|
21
|
+
|
|
22
|
+
test('User Permission Templates V0: scopes validation - valid enum', function (t) {
|
|
23
|
+
const createRequest = require('../../../lib/v0/user_permission_templates').create.request
|
|
24
|
+
const validate = require('../../helpers/validate-schema')
|
|
25
|
+
const validPayload = {
|
|
26
|
+
name: 'Test Template',
|
|
27
|
+
scopes: [require('../../../lib/common/permissions').staff.items.enum[0]],
|
|
28
|
+
active: true,
|
|
29
|
+
deleted: false
|
|
30
|
+
}
|
|
31
|
+
const { valid, error } = validate(createRequest, validPayload)
|
|
32
|
+
t.ok(valid, 'should accept valid enum value in scopes')
|
|
33
|
+
t.error(error, 'should not get any error')
|
|
34
|
+
t.end()
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
test('User Permission Templates V0: scopes validation - arbitrary string (backward compatible)', function (t) {
|
|
38
|
+
const createRequest = require('../../../lib/v0/user_permission_templates').create.request
|
|
39
|
+
const validate = require('../../helpers/validate-schema')
|
|
40
|
+
const validPayload = {
|
|
41
|
+
name: 'Test Template',
|
|
42
|
+
scopes: ['some:custom:permission'],
|
|
43
|
+
active: true,
|
|
44
|
+
deleted: false
|
|
45
|
+
}
|
|
46
|
+
const { valid, error } = validate(createRequest, validPayload)
|
|
47
|
+
t.ok(valid, 'should accept arbitrary string in scopes for backward compatibility')
|
|
48
|
+
t.error(error, 'should not get any error')
|
|
49
|
+
t.end()
|
|
50
|
+
})
|