@tillhub/schemas 6.127.0 → 6.130.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 +23 -0
- package/lib/common/base.js +15 -9
- package/lib/common/images.js +11 -6
- package/lib/v0/branches/base.js +6 -1
- package/lib/v0/customers/base.js +1 -1
- package/lib/v0/reasons/base.js +11 -0
- package/lib/v0/reasons/create.js +5 -2
- package/lib/v0/reasons/index.js +1 -0
- package/lib/v0/reasons/read.js +38 -0
- package/lib/v0/reasons/update.js +5 -2
- package/lib/v1/configurations/items/features.js +43 -0
- package/package.json +1 -1
- package/lib/v0/reasons/default-response.js +0 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
# [6.130.0](https://github.com/tillhub/schemas/compare/v6.129.0...v6.130.0) (2022-03-24)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **configuration:** features ([e15fedd](https://github.com/tillhub/schemas/commit/e15fedd))
|
|
7
|
+
* **configurations:** features ([bfc0bf2](https://github.com/tillhub/schemas/commit/bfc0bf2))
|
|
8
|
+
* **configurations:** features ([66bcd70](https://github.com/tillhub/schemas/commit/66bcd70))
|
|
9
|
+
|
|
10
|
+
# [6.129.0](https://github.com/tillhub/schemas/compare/v6.128.0...v6.129.0) (2022-03-21)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **reasons:** add type "POS price change" #API-1409 ([#683](https://github.com/tillhub/schemas/issues/683)) ([1de76ff](https://github.com/tillhub/schemas/commit/1de76ff)), closes [#API-1409](https://github.com/tillhub/schemas/issues/API-1409) [#API-1409](https://github.com/tillhub/schemas/issues/API-1409)
|
|
16
|
+
|
|
17
|
+
# [6.128.0](https://github.com/tillhub/schemas/compare/v6.127.0...v6.128.0) (2022-03-18)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **branches:** add receipt_footer_image to branches model ([#682](https://github.com/tillhub/schemas/issues/682)) ([132523f](https://github.com/tillhub/schemas/commit/132523f))
|
|
23
|
+
|
|
1
24
|
# [6.127.0](https://github.com/tillhub/schemas/compare/v6.126.0...v6.127.0) (2022-03-15)
|
|
2
25
|
|
|
3
26
|
|
package/lib/common/base.js
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
|
+
const dateObject = require('./date_object')
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Create common base object
|
|
3
5
|
* @param {Object} [options]
|
|
4
6
|
*/
|
|
5
|
-
function baseObject (
|
|
7
|
+
function baseObject ({
|
|
8
|
+
splitDate = false
|
|
9
|
+
} = {}) {
|
|
10
|
+
const dateType = splitDate ? dateObject : {
|
|
11
|
+
type: 'string',
|
|
12
|
+
format: 'date-time',
|
|
13
|
+
example: '2019-03-17T21:12:04.849Z'
|
|
14
|
+
}
|
|
15
|
+
|
|
6
16
|
return {
|
|
7
17
|
id: {
|
|
8
18
|
description: 'Unique entity ID',
|
|
@@ -11,16 +21,12 @@ function baseObject (options = {}) {
|
|
|
11
21
|
example: '936835f7-2d75-41d2-9001-38ed6e458328'
|
|
12
22
|
},
|
|
13
23
|
created_at: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
format: 'date-time',
|
|
17
|
-
example: '2019-03-17T21:12:04.849Z'
|
|
24
|
+
...dateType,
|
|
25
|
+
description: 'The date and time entity was created'
|
|
18
26
|
},
|
|
19
27
|
updated_at: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
format: 'date-time',
|
|
23
|
-
example: '2019-03-17T21:12:04.849Z'
|
|
28
|
+
...dateType,
|
|
29
|
+
description: 'The date and time entity was updated'
|
|
24
30
|
}
|
|
25
31
|
}
|
|
26
32
|
}
|
package/lib/common/images.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const { anyOf } = require('../helpers/payload-or-null')
|
|
2
|
+
|
|
1
3
|
const definedSizes = {
|
|
2
4
|
'1x': {
|
|
3
5
|
description: 'Image transformed to predefined small size',
|
|
@@ -31,7 +33,11 @@ const definedSizes = {
|
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
const getImages = ({
|
|
37
|
+
sizes = ['1x', '2x', '3x', 'avatar'],
|
|
38
|
+
strict = false,
|
|
39
|
+
description = 'Images object with URLs of various types of images'
|
|
40
|
+
}) => {
|
|
35
41
|
const sizesMap = sizes.reduce((memo, size) => {
|
|
36
42
|
if (!definedSizes[size]) {
|
|
37
43
|
throw new ReferenceError(`Size '${size}' is not defined`)
|
|
@@ -42,8 +48,8 @@ function getImages (sizes = ['1x', '2x', '3x', 'avatar'], strict = false) {
|
|
|
42
48
|
}, {})
|
|
43
49
|
|
|
44
50
|
return {
|
|
45
|
-
description
|
|
46
|
-
anyOf
|
|
51
|
+
description,
|
|
52
|
+
...anyOf({
|
|
47
53
|
type: 'object',
|
|
48
54
|
additionalProperties: !strict,
|
|
49
55
|
properties: {
|
|
@@ -54,9 +60,8 @@ function getImages (sizes = ['1x', '2x', '3x', 'avatar'], strict = false) {
|
|
|
54
60
|
type: 'string',
|
|
55
61
|
format: 'uri'
|
|
56
62
|
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
}]
|
|
63
|
+
}
|
|
64
|
+
})
|
|
60
65
|
}
|
|
61
66
|
}
|
|
62
67
|
|
package/lib/v0/branches/base.js
CHANGED
|
@@ -124,7 +124,12 @@ module.exports = {
|
|
|
124
124
|
}
|
|
125
125
|
]
|
|
126
126
|
},
|
|
127
|
-
images: getImages(
|
|
127
|
+
images: getImages({
|
|
128
|
+
description: 'A Tillhub image object with URLs to display images this for this branch.'
|
|
129
|
+
}),
|
|
130
|
+
receipt_footer_images: getImages({
|
|
131
|
+
description: 'A Tillhub image object with URLs to display receipt footer image this for this branch.'
|
|
132
|
+
}),
|
|
128
133
|
image: {
|
|
129
134
|
description: 'DEPRECATED. Omit or set null.',
|
|
130
135
|
anyOf: [
|
package/lib/v0/customers/base.js
CHANGED
|
@@ -154,7 +154,7 @@ module.exports = {
|
|
|
154
154
|
format: 'date-time'
|
|
155
155
|
})
|
|
156
156
|
},
|
|
157
|
-
images: getImages(['1x', '2x', '3x', 'avatar', 'gallery']),
|
|
157
|
+
images: getImages({ sizes: ['1x', '2x', '3x', 'avatar', 'gallery'] }),
|
|
158
158
|
image: {
|
|
159
159
|
description: 'DEPRECATED. Omit or set null.',
|
|
160
160
|
...anyOf({
|
package/lib/v0/reasons/base.js
CHANGED
|
@@ -3,6 +3,8 @@ const { oneOf } = require('../../helpers/payload-or-null')
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
name: {
|
|
5
5
|
...oneOf([{
|
|
6
|
+
description: 'The reason name',
|
|
7
|
+
example: 'Returned goods',
|
|
6
8
|
type: 'string',
|
|
7
9
|
minLength: 1,
|
|
8
10
|
maxLength: 128
|
|
@@ -10,6 +12,8 @@ module.exports = {
|
|
|
10
12
|
},
|
|
11
13
|
description: {
|
|
12
14
|
...oneOf([{
|
|
15
|
+
description: 'The reason description',
|
|
16
|
+
example: 'Goods were returned by the customer',
|
|
13
17
|
type: 'string',
|
|
14
18
|
minLength: 1,
|
|
15
19
|
maxLength: 4096
|
|
@@ -56,26 +60,33 @@ module.exports = {
|
|
|
56
60
|
type: 'boolean'
|
|
57
61
|
},
|
|
58
62
|
active: {
|
|
63
|
+
description: 'The reason is active',
|
|
59
64
|
type: 'boolean'
|
|
60
65
|
},
|
|
61
66
|
type: {
|
|
67
|
+
description: 'The reason type',
|
|
68
|
+
example: 'expense',
|
|
62
69
|
type: 'string',
|
|
63
70
|
enum: [
|
|
64
71
|
'refund',
|
|
72
|
+
'pos_price_change',
|
|
65
73
|
'stock_change',
|
|
66
74
|
'expense',
|
|
67
75
|
'deposit'
|
|
68
76
|
]
|
|
69
77
|
},
|
|
70
78
|
noted_required: {
|
|
79
|
+
description: 'The action must be noted',
|
|
71
80
|
type: 'boolean',
|
|
72
81
|
default: false
|
|
73
82
|
},
|
|
74
83
|
image_required: {
|
|
84
|
+
description: 'The image must be enclosed',
|
|
75
85
|
type: 'boolean',
|
|
76
86
|
default: false
|
|
77
87
|
},
|
|
78
88
|
approval_required: {
|
|
89
|
+
description: 'The action must be approved by supervisor',
|
|
79
90
|
type: 'boolean',
|
|
80
91
|
default: false
|
|
81
92
|
}
|
package/lib/v0/reasons/create.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
const baseObject = require('../../common/base')
|
|
1
2
|
const base = require('./base')
|
|
2
|
-
const defaultResponse = require('./default-response')
|
|
3
3
|
|
|
4
4
|
module.exports.request = {
|
|
5
5
|
$id: 'https://schemas.tillhub.com/v0/reasons.create.request.schema.json',
|
|
@@ -22,5 +22,8 @@ module.exports.response = {
|
|
|
22
22
|
'id',
|
|
23
23
|
'name'
|
|
24
24
|
],
|
|
25
|
-
properties:
|
|
25
|
+
properties: {
|
|
26
|
+
...baseObject(),
|
|
27
|
+
...base
|
|
28
|
+
}
|
|
26
29
|
}
|
package/lib/v0/reasons/index.js
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const baseObject = require('../../common/base')
|
|
2
|
+
const commonResponse = require('../../common/response')
|
|
3
|
+
|
|
4
|
+
const base = require('./base')
|
|
5
|
+
|
|
6
|
+
module.exports.all = {
|
|
7
|
+
response: {
|
|
8
|
+
$id: 'https://schemas.tillhub.com/v0/reasons.read.all.response.schema.json',
|
|
9
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
10
|
+
...commonResponse({
|
|
11
|
+
resultItems: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
additionalProperties: false,
|
|
14
|
+
properties: {
|
|
15
|
+
...baseObject({ splitDate: true }),
|
|
16
|
+
...base
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports.one = {
|
|
24
|
+
response: {
|
|
25
|
+
$id: 'https://schemas.tillhub.com/v0/reasons.read.one.response.schema.json',
|
|
26
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
27
|
+
...commonResponse({
|
|
28
|
+
resultItems: {
|
|
29
|
+
type: 'object',
|
|
30
|
+
additionalProperties: false,
|
|
31
|
+
properties: {
|
|
32
|
+
...baseObject({ splitDate: true }),
|
|
33
|
+
...base
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
}
|
package/lib/v0/reasons/update.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
const baseObject = require('../../common/base')
|
|
1
2
|
const base = require('./base')
|
|
2
|
-
const defaultResponse = require('./default-response')
|
|
3
3
|
|
|
4
4
|
module.exports.request = {
|
|
5
5
|
$id: 'https://schemas.tillhub.com/v0/reasons.update.request.schema.json',
|
|
@@ -18,5 +18,8 @@ module.exports.response = {
|
|
|
18
18
|
required: [
|
|
19
19
|
'id'
|
|
20
20
|
],
|
|
21
|
-
properties:
|
|
21
|
+
properties: {
|
|
22
|
+
...baseObject(),
|
|
23
|
+
...base
|
|
24
|
+
}
|
|
22
25
|
}
|
|
@@ -133,6 +133,49 @@ module.exports = oneOf({
|
|
|
133
133
|
default: 'info'
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
|
+
}),
|
|
137
|
+
manual_reference: oneOf({
|
|
138
|
+
description: 'defines behavior for manually assigning external references to a cart',
|
|
139
|
+
type: 'object',
|
|
140
|
+
additionalProperties: false,
|
|
141
|
+
properties: {
|
|
142
|
+
enabled: {
|
|
143
|
+
description: 'Specifies if - for given conditions - an external reference can be assigned manually to a cart (e.g. via the cart menu).',
|
|
144
|
+
type: 'boolean',
|
|
145
|
+
default: false
|
|
146
|
+
},
|
|
147
|
+
request_on_checkout: {
|
|
148
|
+
description: 'Specifies if - for given conditions - an external reference will be requested on checkout (skippable).',
|
|
149
|
+
type: 'string',
|
|
150
|
+
enum: [
|
|
151
|
+
'never',
|
|
152
|
+
'if_missing',
|
|
153
|
+
'always'
|
|
154
|
+
],
|
|
155
|
+
default: 'if_missing'
|
|
156
|
+
},
|
|
157
|
+
custom_prompt: oneOf({
|
|
158
|
+
description: 'Custom override of the question text before adding this reference manually.',
|
|
159
|
+
type: 'string',
|
|
160
|
+
example: 'There seems to be no order number set. Do you want to add it manually?',
|
|
161
|
+
minLength: 2,
|
|
162
|
+
maxLength: 512
|
|
163
|
+
}),
|
|
164
|
+
number_format: {
|
|
165
|
+
description: 'The format of the reference number that is being validated against the input',
|
|
166
|
+
type: 'string',
|
|
167
|
+
format: 'regex',
|
|
168
|
+
example: '^[_A-Za-z0-9-+]+(\\.[_A-Za-z0-9-+]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*(\\.[A-Za-z]{2,})$',
|
|
169
|
+
default: '^(VAU)?[0-9]{7,11}$'
|
|
170
|
+
},
|
|
171
|
+
number_length_max: {
|
|
172
|
+
description: 'The maxiumum length of the reference number (as a helper for the UI)',
|
|
173
|
+
type: 'integer',
|
|
174
|
+
minimum: 2,
|
|
175
|
+
maximum: 99,
|
|
176
|
+
default: 14
|
|
177
|
+
}
|
|
178
|
+
}
|
|
136
179
|
})
|
|
137
180
|
}
|
|
138
181
|
})
|
package/package.json
CHANGED