@tillhub/schemas 6.396.0 → 6.398.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,17 @@
|
|
|
1
|
+
# [6.398.0](https://github.com/tillhub/schemas/compare/v6.397.0...v6.398.0) (2025-08-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **configurations:** features ([73417f6](https://github.com/tillhub/schemas/commit/73417f6))
|
|
7
|
+
|
|
8
|
+
# [6.397.0](https://github.com/tillhub/schemas/compare/v6.396.0...v6.397.0) (2025-07-24)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **UNTIL-12873:** add stricter validation for user scopes ([#1079](https://github.com/tillhub/schemas/issues/1079)) ([9eb8c77](https://github.com/tillhub/schemas/commit/9eb8c77))
|
|
14
|
+
|
|
1
15
|
# [6.396.0](https://github.com/tillhub/schemas/compare/v6.395.0...v6.396.0) (2025-07-23)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -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
|
{
|
|
@@ -117,6 +117,19 @@ module.exports = oneOf({
|
|
|
117
117
|
'online' // fallback to offline if no results
|
|
118
118
|
],
|
|
119
119
|
default: 'none'
|
|
120
|
+
}),
|
|
121
|
+
coop: oneOf({
|
|
122
|
+
description: 'Coop specific settings',
|
|
123
|
+
type: 'object',
|
|
124
|
+
additionalProperties: false,
|
|
125
|
+
properties: {
|
|
126
|
+
base_url: oneOf({
|
|
127
|
+
description: 'The URL of the cloudfunction to be used for online validation',
|
|
128
|
+
type: 'string',
|
|
129
|
+
format: 'uri',
|
|
130
|
+
example: 'https://europe-west3-unzer-gcp-shared-prod.cloudfunctions.net/tillhub-external-rewards-microservice-prod-api'
|
|
131
|
+
})
|
|
132
|
+
}
|
|
120
133
|
})
|
|
121
134
|
}
|
|
122
135
|
}),
|
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
|
+
})
|