@tillhub/schemas 6.140.0 → 6.143.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 +21 -0
- package/lib/common/response.js +63 -25
- package/lib/v1/configurations/items/receipts.js +8 -0
- package/lib/v1/configurations/items/settings.js +1 -25
- package/lib/v1/customers/index.js +5 -0
- package/lib/v1/customers/read.js +23 -0
- package/lib/v1/index.js +1 -0
- package/package.json +1 -1
- package/test/customers/customers.v1.spec.js +11 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
# [6.143.0](https://github.com/tillhub/schemas/compare/v6.142.0...v6.143.0) (2022-06-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **customers:** support customers v1 'read.all' ([470149f](https://github.com/tillhub/schemas/commit/470149f))
|
|
7
|
+
|
|
8
|
+
# [6.142.0](https://github.com/tillhub/schemas/compare/v6.141.0...v6.142.0) (2022-06-01)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **dashboard:** dashboard configuration ([d9613ce](https://github.com/tillhub/schemas/commit/d9613ce))
|
|
14
|
+
|
|
15
|
+
# [6.141.0](https://github.com/tillhub/schemas/compare/v6.140.0...v6.141.0) (2022-05-30)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **configurations:** order_receipts ([f9d5f14](https://github.com/tillhub/schemas/commit/f9d5f14))
|
|
21
|
+
|
|
1
22
|
# [6.140.0](https://github.com/tillhub/schemas/compare/v6.139.0...v6.140.0) (2022-05-20)
|
|
2
23
|
|
|
3
24
|
|
package/lib/common/response.js
CHANGED
|
@@ -1,26 +1,48 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
const cursors = {
|
|
2
|
+
'first-self': {
|
|
3
|
+
type: 'object',
|
|
4
|
+
description: 'Optional cursor in paginated API calls. The cursor next field must be called as fully quantifiable URI in order to hit the next if available.',
|
|
5
|
+
additionalProperties: false,
|
|
6
|
+
required: ['self'],
|
|
7
|
+
properties: {
|
|
8
|
+
next: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
format: 'uri',
|
|
11
|
+
description: 'The URI pointing to the next page.',
|
|
12
|
+
example: 'https://api.tillhub.com/api/v1/products/061f91a3-eba2-40b8-9a76-115189d6741e?cursor=2018-07-02T21%3A47%3A44.382Z&size=10&cursor_field=updated_at'
|
|
13
|
+
},
|
|
14
|
+
first: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
format: 'uri',
|
|
17
|
+
description: 'The URI pointing to the the first page.',
|
|
18
|
+
example: 'https://api.tillhub.com/api/v1/products/061f91a3-eba2-40b8-9a76-115189d6741e?cursor=2018-07-02T21%3A47%3A44.382Z&size=10&cursor_field=updated_at'
|
|
19
|
+
},
|
|
20
|
+
self: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
format: 'uri',
|
|
23
|
+
description: 'The URI pointing to this page.',
|
|
24
|
+
example: 'https://api.tillhub.com/api/v1/products/061f91a3-eba2-40b8-9a76-115189d6741e?cursor=2018-07-02T21%3A47%3A44.382Z&size=10&cursor_field=updated_at'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
'current-next': {
|
|
29
|
+
type: 'object',
|
|
30
|
+
description: 'Optional cursor in paginated API calls. The cursor provides URIs in order to get near pages if available.',
|
|
31
|
+
additionalProperties: false,
|
|
32
|
+
required: ['current'],
|
|
33
|
+
properties: {
|
|
34
|
+
current: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
format: 'uri',
|
|
37
|
+
description: 'The URI pointing to current page.',
|
|
38
|
+
example: 'https://api.tillhub.com/api/v1/products/061f91a3-eba2-40b8-9a76-115189d6741e?size=10&cursor=5694834'
|
|
39
|
+
},
|
|
40
|
+
next: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
format: 'uri',
|
|
43
|
+
description: 'The URI pointing to the next page.',
|
|
44
|
+
example: 'https://api.tillhub.com/api/v1/products/061f91a3-eba2-40b8-9a76-115189d6741e?size=10&cursor=5694847'
|
|
45
|
+
}
|
|
24
46
|
}
|
|
25
47
|
}
|
|
26
48
|
}
|
|
@@ -30,7 +52,14 @@ const cursor = {
|
|
|
30
52
|
* @param {Object} payload
|
|
31
53
|
* @param {Object} options
|
|
32
54
|
*/
|
|
33
|
-
function commonResponse ({
|
|
55
|
+
function commonResponse ({
|
|
56
|
+
resultItems,
|
|
57
|
+
results,
|
|
58
|
+
additionals
|
|
59
|
+
} = {}, {
|
|
60
|
+
hasCursor = false,
|
|
61
|
+
cursorType = ''
|
|
62
|
+
} = {}) {
|
|
34
63
|
if (!resultItems) throw new TypeError('common response requires result items to be set')
|
|
35
64
|
|
|
36
65
|
if (!results) {
|
|
@@ -85,7 +114,16 @@ function commonResponse ({ resultItems, results, additionals } = {}, { hasCursor
|
|
|
85
114
|
}
|
|
86
115
|
}
|
|
87
116
|
|
|
88
|
-
if (hasCursor
|
|
117
|
+
if (hasCursor && !cursorType) {
|
|
118
|
+
cursorType = 'first-self'
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (cursorType) {
|
|
122
|
+
if (!cursors[cursorType]) {
|
|
123
|
+
throw new Error(`Unknown cursor type '${cursorType}'`)
|
|
124
|
+
}
|
|
125
|
+
response.properties.cursor = cursors[cursorType]
|
|
126
|
+
}
|
|
89
127
|
|
|
90
128
|
return response
|
|
91
129
|
}
|
|
@@ -369,6 +369,14 @@ module.exports = oneOf({
|
|
|
369
369
|
type: 'boolean',
|
|
370
370
|
default: true
|
|
371
371
|
},
|
|
372
|
+
size_type: oneOf({
|
|
373
|
+
type: 'string',
|
|
374
|
+
enum: [
|
|
375
|
+
'regular',
|
|
376
|
+
'large'
|
|
377
|
+
],
|
|
378
|
+
default: 'large'
|
|
379
|
+
}),
|
|
372
380
|
triggers: oneOf({
|
|
373
381
|
type: 'object',
|
|
374
382
|
additionalProperties: false,
|
|
@@ -615,34 +615,10 @@ module.exports = {
|
|
|
615
615
|
type: 'object',
|
|
616
616
|
additionalProperties: false,
|
|
617
617
|
properties: {
|
|
618
|
-
availability: {
|
|
619
|
-
type: 'string',
|
|
620
|
-
'enum': [
|
|
621
|
-
'legacy', // only the legacy dashboard (url) is available
|
|
622
|
-
'new', // only the new dashboard (url_new) is available
|
|
623
|
-
'both' // both dashboards are available and the user is prompted for selection
|
|
624
|
-
],
|
|
625
|
-
default: 'legacy'
|
|
626
|
-
},
|
|
627
618
|
url: {
|
|
628
|
-
description: 'URL of this account\'s
|
|
629
|
-
type: 'string' // client default kDashboardUrlLegacy is 'https://dashboard.tillhub.de' or 'https://awsxstaging.tillhub.de'
|
|
630
|
-
},
|
|
631
|
-
url_new: {
|
|
632
|
-
description: 'URL of this account\'s perferred NEW dashboard',
|
|
619
|
+
description: 'URL of this account\'s dashboard',
|
|
633
620
|
type: 'string' // client default kDashboardUrl is 'https://dashboard.tillhub.com' or 'https://staging-dashboard.tillhub.com'
|
|
634
621
|
},
|
|
635
|
-
auth: {
|
|
636
|
-
description: ' -- client reads but does not use this, please provide a proper description --',
|
|
637
|
-
oneOf: [
|
|
638
|
-
{
|
|
639
|
-
type: 'string'
|
|
640
|
-
},
|
|
641
|
-
{
|
|
642
|
-
type: 'null'
|
|
643
|
-
}
|
|
644
|
-
]
|
|
645
|
-
},
|
|
646
622
|
navigation_after_creation: oneOf({
|
|
647
623
|
type: 'string',
|
|
648
624
|
enum: [
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const baseObject = require('../../common/base')
|
|
2
|
+
const commonResponse = require('../../common/response')
|
|
3
|
+
const base = require('../../v0/customers/base')
|
|
4
|
+
const baseExtended = require('../../v0/customers/baseExt')
|
|
5
|
+
|
|
6
|
+
module.exports.all = {
|
|
7
|
+
response: {
|
|
8
|
+
$id: 'https://schemas.tillhub.com/v1/customers.read.all.response.schema.json',
|
|
9
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
10
|
+
additionalProperties: false,
|
|
11
|
+
...commonResponse({
|
|
12
|
+
resultItems: {
|
|
13
|
+
type: 'object',
|
|
14
|
+
additionalProperties: false,
|
|
15
|
+
properties: {
|
|
16
|
+
...baseObject(),
|
|
17
|
+
...base,
|
|
18
|
+
...baseExtended
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}, { cursorType: 'current-next' })
|
|
22
|
+
}
|
|
23
|
+
}
|
package/lib/v1/index.js
CHANGED
|
@@ -2,6 +2,7 @@ module.exports.balances = require('./balances')
|
|
|
2
2
|
module.exports.branches = require('./branches')
|
|
3
3
|
module.exports.carts = require('./carts')
|
|
4
4
|
module.exports.configurations = require('./configurations')
|
|
5
|
+
module.exports.customers = require('./customers')
|
|
5
6
|
module.exports.delivery_notes = require('./delivery_notes')
|
|
6
7
|
module.exports.discounts = require('./discounts')
|
|
7
8
|
module.exports.gastro_orders = require('./gastro_orders')
|
package/package.json
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const test = require('tape')
|
|
2
|
+
const validate = require('../helpers/validate-schema')
|
|
3
|
+
const customers = require('../../lib/v1/customers')
|
|
4
|
+
|
|
5
|
+
test('Customers:v0: read.all schema validation', function (t) {
|
|
6
|
+
const { valid, error } = validate(customers.read.all.response)
|
|
7
|
+
t.ok(valid, 'update response schema is valid')
|
|
8
|
+
t.error(error, 'should not get any error')
|
|
9
|
+
|
|
10
|
+
t.end()
|
|
11
|
+
})
|