@tillhub/schemas 6.451.0 → 6.452.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/lib/v0/analytics/reports/stocks/index.js +21 -3
- package/lib/v0/service_categories/base.js +10 -2
- package/lib/v0/service_categories/create.response.js +4 -2
- package/lib/v0/service_categories/update.response.js +4 -2
- package/lib/v0/services/create.request.js +3 -0
- package/lib/v0/services/create.response.js +4 -1
- package/lib/v0/services/deprecation.js +3 -0
- package/lib/v0/services/update.request.js +3 -0
- package/lib/v0/services/update.response.js +4 -1
- package/lib/v0/vouchers/query.js +15 -14
- package/package.json +1 -1
- package/test/analytics/reports/stocks/stocks.v0.spec.js +51 -0
|
@@ -89,19 +89,37 @@ module.exports.request = {
|
|
|
89
89
|
minLength: 1,
|
|
90
90
|
maxLength: 64
|
|
91
91
|
},
|
|
92
|
+
as_of: {
|
|
93
|
+
type: 'string',
|
|
94
|
+
format: 'date-time',
|
|
95
|
+
example: '2025-12-31T22:59:59.999Z',
|
|
96
|
+
description:
|
|
97
|
+
'ISO 8601 cut-off (inclusive). When set, Quantity Available is the latest stock-book balance at this instant per product × location. Send this or the start/end pair, not both. Omit both modes to return current stock.'
|
|
98
|
+
},
|
|
92
99
|
start: {
|
|
93
100
|
type: 'string',
|
|
94
101
|
format: 'date-time',
|
|
95
102
|
example: '2026-05-07T22:00:00.000Z',
|
|
96
103
|
description:
|
|
97
|
-
'Url-safe ISO 8601 start of the reporting window.
|
|
104
|
+
'Url-safe ISO 8601 start of the reporting window. Use with `end` as a pair to filter current stock rows by `updated_at`. Cannot be combined with `as_of`. Also used as the report `date` when `end` is omitted.'
|
|
98
105
|
},
|
|
99
106
|
end: {
|
|
100
107
|
type: 'string',
|
|
101
108
|
format: 'date-time',
|
|
102
109
|
example: '2026-05-08T21:59:59.999Z',
|
|
103
110
|
description:
|
|
104
|
-
'Url-safe ISO 8601 end of the reporting window.
|
|
111
|
+
'Url-safe ISO 8601 end of the reporting window. Use with `start` as a pair to filter current stock rows by `updated_at`. Cannot be combined with `as_of`. Preferred source for the report `date` column when set.'
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
allOf: [
|
|
115
|
+
{
|
|
116
|
+
description: 'Clients send either as_of or the start/end pair, not both.',
|
|
117
|
+
not: {
|
|
118
|
+
anyOf: [
|
|
119
|
+
{ required: ['as_of', 'start'] },
|
|
120
|
+
{ required: ['as_of', 'end'] }
|
|
121
|
+
]
|
|
122
|
+
}
|
|
105
123
|
}
|
|
106
|
-
|
|
124
|
+
]
|
|
107
125
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
const base = require('../product_groups/base')
|
|
2
2
|
const { oneOf } = require('../../helpers/payload-or-null')
|
|
3
3
|
|
|
4
|
+
const DEPRECATION_NOTICE =
|
|
5
|
+
'Service Categories v0 are deprecated, use v1 schemas instead'
|
|
6
|
+
|
|
4
7
|
const request = {
|
|
5
8
|
...base.request,
|
|
6
9
|
properties: {
|
|
@@ -21,10 +24,13 @@ const request = {
|
|
|
21
24
|
default: false
|
|
22
25
|
}
|
|
23
26
|
},
|
|
24
|
-
required: ['name']
|
|
27
|
+
required: ['name'],
|
|
28
|
+
deprecated: true,
|
|
29
|
+
description: DEPRECATION_NOTICE
|
|
25
30
|
}
|
|
26
31
|
|
|
27
32
|
module.exports = {
|
|
33
|
+
DEPRECATION_NOTICE,
|
|
28
34
|
request,
|
|
29
35
|
response: {
|
|
30
36
|
...request,
|
|
@@ -37,6 +43,8 @@ module.exports = {
|
|
|
37
43
|
example: '05297f58-3408-44d0-8bf4-125d4e86c08a'
|
|
38
44
|
},
|
|
39
45
|
...request.properties
|
|
40
|
-
}
|
|
46
|
+
},
|
|
47
|
+
deprecated: true,
|
|
48
|
+
description: DEPRECATION_NOTICE
|
|
41
49
|
}
|
|
42
50
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
const { response } = require('./base')
|
|
1
|
+
const { response, DEPRECATION_NOTICE } = require('./base')
|
|
2
2
|
const commonResponse = require('../../common/response')
|
|
3
3
|
|
|
4
4
|
module.exports = {
|
|
5
5
|
$id: 'https://schemas.tillhub.com/v0/service_categories.create.response.schema.json',
|
|
6
6
|
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
7
|
-
...commonResponse({ resultItems: response })
|
|
7
|
+
...commonResponse({ resultItems: response }),
|
|
8
|
+
deprecated: true,
|
|
9
|
+
description: DEPRECATION_NOTICE
|
|
8
10
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
const { response } = require('./base')
|
|
1
|
+
const { response, DEPRECATION_NOTICE } = require('./base')
|
|
2
2
|
const commonResponse = require('../../common/response')
|
|
3
3
|
|
|
4
4
|
module.exports = {
|
|
5
5
|
$id: 'https://schemas.tillhub.com/v0/service_categories.update.response.schema.json',
|
|
6
6
|
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
7
|
-
...commonResponse({ resultItems: response })
|
|
7
|
+
...commonResponse({ resultItems: response }),
|
|
8
|
+
deprecated: true,
|
|
9
|
+
description: DEPRECATION_NOTICE
|
|
8
10
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const base = require('../products/create')
|
|
2
|
+
const { DEPRECATION_NOTICE } = require('./deprecation')
|
|
2
3
|
const { oneOf } = require('../../helpers/payload-or-null')
|
|
3
4
|
|
|
4
5
|
module.exports = {
|
|
@@ -44,6 +45,8 @@ module.exports = {
|
|
|
44
45
|
}
|
|
45
46
|
},
|
|
46
47
|
required: ['name', 'duration', 'linked_product'],
|
|
48
|
+
deprecated: true,
|
|
49
|
+
description: DEPRECATION_NOTICE,
|
|
47
50
|
$id: 'https://schemas.tillhub.com/v0/services.create.request.schema.json',
|
|
48
51
|
$schema: 'http://json-schema.org/draft-07/schema#'
|
|
49
52
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const request = require('./create.request')
|
|
2
|
+
const { DEPRECATION_NOTICE } = require('./deprecation')
|
|
2
3
|
const commonResponse = require('../../common/response')
|
|
3
4
|
|
|
4
5
|
const response = {
|
|
@@ -18,5 +19,7 @@ const response = {
|
|
|
18
19
|
module.exports = {
|
|
19
20
|
$id: 'https://schemas.tillhub.com/v0/services.create.response.schema.json',
|
|
20
21
|
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
21
|
-
...commonResponse({ resultItems: response })
|
|
22
|
+
...commonResponse({ resultItems: response }),
|
|
23
|
+
deprecated: true,
|
|
24
|
+
description: DEPRECATION_NOTICE
|
|
22
25
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const base = require('../products/update')
|
|
2
|
+
const { DEPRECATION_NOTICE } = require('./deprecation')
|
|
2
3
|
const { oneOf } = require('../../helpers/payload-or-null')
|
|
3
4
|
|
|
4
5
|
module.exports = {
|
|
@@ -43,6 +44,8 @@ module.exports = {
|
|
|
43
44
|
}
|
|
44
45
|
},
|
|
45
46
|
required: [],
|
|
47
|
+
deprecated: true,
|
|
48
|
+
description: DEPRECATION_NOTICE,
|
|
46
49
|
$id: 'https://schemas.tillhub.com/v0/services.update.request.schema.json',
|
|
47
50
|
$schema: 'http://json-schema.org/draft-07/schema#'
|
|
48
51
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const request = require('./update.request')
|
|
2
|
+
const { DEPRECATION_NOTICE } = require('./deprecation')
|
|
2
3
|
const commonResponse = require('../../common/response')
|
|
3
4
|
|
|
4
5
|
const response = {
|
|
@@ -18,5 +19,7 @@ const response = {
|
|
|
18
19
|
module.exports = {
|
|
19
20
|
$id: 'https://schemas.tillhub.com/v0/services.update.response.schema.json',
|
|
20
21
|
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
21
|
-
...commonResponse({ resultItems: response })
|
|
22
|
+
...commonResponse({ resultItems: response }),
|
|
23
|
+
deprecated: true,
|
|
24
|
+
description: DEPRECATION_NOTICE
|
|
22
25
|
}
|
package/lib/v0/vouchers/query.js
CHANGED
|
@@ -135,20 +135,21 @@ module.exports = {
|
|
|
135
135
|
format: 'date-time'
|
|
136
136
|
},
|
|
137
137
|
system: {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
138
|
+
type: 'string',
|
|
139
|
+
format: 'uuid'
|
|
140
|
+
},
|
|
141
|
+
voucher_system: {
|
|
142
|
+
type: 'string',
|
|
143
|
+
format: 'uuid'
|
|
144
|
+
},
|
|
145
|
+
systems: {
|
|
146
|
+
type: 'array',
|
|
147
|
+
minItems: 1,
|
|
148
|
+
maxItems: 50,
|
|
149
|
+
items: {
|
|
150
|
+
type: 'string',
|
|
151
|
+
format: 'uuid'
|
|
152
|
+
}
|
|
152
153
|
},
|
|
153
154
|
location: {
|
|
154
155
|
oneOf: [
|
package/package.json
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const test = require('tape')
|
|
2
|
+
const Ajv = require('ajv')
|
|
3
|
+
const validate = require('../../../helpers/validate-schema')
|
|
4
|
+
const stocksSchema = require('../../../../lib/v0/analytics/reports/stocks')
|
|
5
|
+
|
|
6
|
+
const ajv = new Ajv()
|
|
7
|
+
const validateRequest = ajv.compile(stocksSchema.request)
|
|
8
|
+
|
|
9
|
+
const AS_OF = '2025-12-31T22:59:59.999Z'
|
|
10
|
+
const START = '2026-05-07T22:00:00.000Z'
|
|
11
|
+
const END = '2026-05-08T21:59:59.999Z'
|
|
12
|
+
|
|
13
|
+
test('analytics:reports:stocks:v0: request schema is valid', function (t) {
|
|
14
|
+
t.plan(2)
|
|
15
|
+
const { valid, error } = validate(stocksSchema.request)
|
|
16
|
+
t.ok(valid, 'request schema is valid')
|
|
17
|
+
t.error(error, 'should not get any error')
|
|
18
|
+
t.end()
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
test('analytics:reports:stocks:v0: accepts as_of without start/end', function (t) {
|
|
22
|
+
t.plan(1)
|
|
23
|
+
t.ok(validateRequest({ as_of: AS_OF }), 'as_of alone is valid')
|
|
24
|
+
t.end()
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
test('analytics:reports:stocks:v0: accepts the start/end pair without as_of', function (t) {
|
|
28
|
+
t.plan(1)
|
|
29
|
+
t.ok(validateRequest({ start: START, end: END }), 'start/end pair is valid')
|
|
30
|
+
t.end()
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
test('analytics:reports:stocks:v0: accepts omitting both date modes', function (t) {
|
|
34
|
+
t.plan(1)
|
|
35
|
+
t.ok(validateRequest({}), 'current stock without as_of or start/end is valid')
|
|
36
|
+
t.end()
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
test('analytics:reports:stocks:v0: rejects as_of combined with start or end', function (t) {
|
|
40
|
+
t.plan(3)
|
|
41
|
+
t.notOk(validateRequest({ as_of: AS_OF, start: START }), 'as_of + start is invalid')
|
|
42
|
+
t.notOk(validateRequest({ as_of: AS_OF, end: END }), 'as_of + end is invalid')
|
|
43
|
+
t.notOk(validateRequest({ as_of: AS_OF, start: START, end: END }), 'as_of + start/end is invalid')
|
|
44
|
+
t.end()
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
test('analytics:reports:stocks:v0: rejects invalid as_of', function (t) {
|
|
48
|
+
t.plan(1)
|
|
49
|
+
t.notOk(validateRequest({ as_of: 'not-a-valid-iso8601' }), 'non-ISO as_of is invalid')
|
|
50
|
+
t.end()
|
|
51
|
+
})
|