@tillhub/schemas 6.128.0 → 6.131.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,27 @@
1
+ # [6.131.0](https://github.com/tillhub/schemas/compare/v6.130.0...v6.131.0) (2022-03-29)
2
+
3
+
4
+ ### Features
5
+
6
+ * **customers:** Make bare minimum mandatory in customer creation schema ([#684](https://github.com/tillhub/schemas/issues/684)) ([ebc4273](https://github.com/tillhub/schemas/commit/ebc4273))
7
+ * **customers:** Make bare minimum mandatory in customer creation schema ([#685](https://github.com/tillhub/schemas/issues/685)) ([5d95430](https://github.com/tillhub/schemas/commit/5d95430))
8
+
9
+ # [6.130.0](https://github.com/tillhub/schemas/compare/v6.129.0...v6.130.0) (2022-03-24)
10
+
11
+
12
+ ### Features
13
+
14
+ * **configuration:** features ([e15fedd](https://github.com/tillhub/schemas/commit/e15fedd))
15
+ * **configurations:** features ([bfc0bf2](https://github.com/tillhub/schemas/commit/bfc0bf2))
16
+ * **configurations:** features ([66bcd70](https://github.com/tillhub/schemas/commit/66bcd70))
17
+
18
+ # [6.129.0](https://github.com/tillhub/schemas/compare/v6.128.0...v6.129.0) (2022-03-21)
19
+
20
+
21
+ ### Features
22
+
23
+ * **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)
24
+
1
25
  # [6.128.0](https://github.com/tillhub/schemas/compare/v6.127.0...v6.128.0) (2022-03-18)
2
26
 
3
27
 
@@ -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 (options = {}) {
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
- description: 'The date and time entity was created',
15
- type: 'string',
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
- description: 'The date and time entity was updated',
21
- type: 'string',
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
  }
@@ -24,10 +24,8 @@ module.exports = {
24
24
  lastname: {
25
25
  example: 'Fett',
26
26
  description: 'Last name',
27
- ...anyOf({
28
- type: 'string',
29
- maxLength: 128
30
- })
27
+ type: 'string',
28
+ maxLength: 128
31
29
  },
32
30
  middlename: {
33
31
  description: 'Middle name',
@@ -1,4 +1,3 @@
1
- const { anyOf } = require('../../helpers/payload-or-null')
2
1
  const baseObject = require('../../common/base')
3
2
  const commonResponse = require('../../common/response')
4
3
 
@@ -11,17 +10,9 @@ module.exports = {
11
10
  additionalProperties: false,
12
11
  type: 'object',
13
12
  properties: base,
14
- ...anyOf([{
15
- required: [
16
- 'firstname'
17
- ]
18
- }, {
19
- required: [
20
- 'lastname'
21
- ]
22
- }
23
- ]),
24
- required: []
13
+ required: [
14
+ 'lastname'
15
+ ]
25
16
  },
26
17
  response: {
27
18
  $id: 'https://schemas.tillhub.com/v0/customers.create.response.schema.json',
@@ -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
  }
@@ -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: defaultResponse
25
+ properties: {
26
+ ...baseObject(),
27
+ ...base
28
+ }
26
29
  }
@@ -1,2 +1,3 @@
1
1
  module.exports.create = require('./create')
2
+ module.exports.read = require('./read')
2
3
  module.exports.update = require('./update')
@@ -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
+ }
@@ -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: defaultResponse
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tillhub/schemas",
3
- "version": "6.128.0",
3
+ "version": "6.131.0",
4
4
  "private": false,
5
5
  "description": "All Tillhub API OpenAPI 3 compatible JSON Schemas.",
6
6
  "main": "./lib/index.js",
@@ -1,17 +0,0 @@
1
- const base = require('./base')
2
-
3
- module.exports = {
4
- ...base,
5
- id: {
6
- type: 'string',
7
- format: 'uuid'
8
- },
9
- created_at: {
10
- type: 'string',
11
- format: 'date-time'
12
- },
13
- updated_at: {
14
- type: 'string',
15
- format: 'date-time'
16
- }
17
- }