@tillhub/schemas 6.118.0 → 6.121.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/lib/common/address.js +67 -82
  3. package/lib/common/base.js +3 -0
  4. package/lib/common/images.js +63 -0
  5. package/lib/common/query.js +64 -0
  6. package/lib/common/response.js +11 -10
  7. package/lib/v0/audits/index.js +3 -0
  8. package/lib/v0/audits/logs/base.js +81 -0
  9. package/lib/v0/audits/logs/index.js +3 -0
  10. package/lib/v0/audits/logs/read.js +30 -0
  11. package/lib/v0/branches/base.js +55 -63
  12. package/lib/v0/branches/create.js +18 -0
  13. package/lib/v0/branches/index.js +1 -0
  14. package/lib/v0/branches/read.js +119 -0
  15. package/lib/v0/branches/update.js +18 -0
  16. package/lib/v0/category_trees/definitions.js +1 -1
  17. package/lib/v0/customers/base.js +352 -576
  18. package/lib/v0/customers/baseExt.js +35 -0
  19. package/lib/v0/customers/create.js +41 -0
  20. package/lib/v0/customers/ext.js +113 -7
  21. package/lib/v0/customers/index.js +18 -50
  22. package/lib/v0/customers/properties/anaylytics.js +7 -7
  23. package/lib/v0/customers/read.js +42 -0
  24. package/lib/v0/customers/update.js +30 -0
  25. package/lib/v0/deliveries/base.js +3 -3
  26. package/lib/v0/index.js +1 -0
  27. package/lib/v0/orders/create.request.js +3 -3
  28. package/lib/v0/pdfs/templates.deliveries.create.request.js +3 -7
  29. package/lib/v0/pdfs/templates.delivery_notes.create.request.js +3 -7
  30. package/lib/v0/pdfs/templates.full_receipts.create.request.js +3 -7
  31. package/lib/v0/pdfs/templates.invoices.create.request.js +3 -7
  32. package/lib/v0/pdfs/templates.transaction_receipts.create.request.js +3 -7
  33. package/lib/v1/branches/index.js +1 -0
  34. package/lib/v1/branches/read.js +16 -0
  35. package/lib/v1/index.js +6 -5
  36. package/package.json +1 -1
  37. package/test/audits/logs/logs.spec.js +11 -0
  38. package/test/branches/branches.v0.spec.js +50 -11
  39. package/test/branches/branches.v1.spec.js +19 -0
  40. package/test/customers/customers.v0.spec.js +93 -5
  41. package/lib/v0/customers/create.request.js +0 -24
  42. package/lib/v0/customers/update.request.js +0 -14
@@ -1,20 +1,59 @@
1
1
  const test = require('tape')
2
2
  const validate = require('../helpers/validate-schema')
3
+ const branchesSchema = require('../../lib/v0/branches')
4
+
5
+ test('Branches:v0: create schema validation', function (t) {
6
+ {
7
+ const { valid, error } = validate(branchesSchema.create.request)
8
+ t.ok(valid, 'create request schema is valid')
9
+ t.error(error, 'should not get any error')
10
+ }
11
+
12
+ {
13
+ const { valid, error } = validate(branchesSchema.create.response)
14
+ t.ok(valid, 'create response schema is valid')
15
+ t.error(error, 'should not get any error')
16
+ }
17
+
18
+ t.end()
19
+ })
20
+
21
+ test('Branches:v0: read.all schema validation', function (t) {
22
+ {
23
+ const { valid, error } = validate(branchesSchema.read.all.query)
24
+ t.ok(valid, 'read query schema is valid')
25
+ t.error(error, 'should not get any error')
26
+ }
27
+
28
+ {
29
+ const { valid, error } = validate(branchesSchema.read.all.response)
30
+ t.ok(valid, 'read response schema is valid')
31
+ t.error(error, 'should not get any error')
32
+ }
3
33
 
4
- test('Branches: create schema validation', function (t) {
5
- t.plan(2)
6
- const createRequest = require('../../lib/v0/branches').create.request
7
- const { valid, error } = validate(createRequest)
8
- t.ok(valid, 'create schema is valid')
9
- t.error(error, 'should not get any error')
10
34
  t.end()
11
35
  })
12
36
 
13
- test('Branches: update schema validation', function (t) {
14
- t.plan(2)
15
- const updateRequest = require('../../lib/v0/branches').update.request
16
- const { valid, error } = validate(updateRequest)
17
- t.ok(valid, 'update schema is valid')
37
+ test('Branches:v0: read.one schema validation', function (t) {
38
+ const { valid, error } = validate(branchesSchema.read.one.response)
39
+ t.ok(valid, 'read query schema is valid')
18
40
  t.error(error, 'should not get any error')
41
+
42
+ t.end()
43
+ })
44
+
45
+ test('Branches:v0: update schema validation', function (t) {
46
+ {
47
+ const { valid, error } = validate(branchesSchema.update.request)
48
+ t.ok(valid, 'update request schema is valid')
49
+ t.error(error, 'should not get any error')
50
+ }
51
+
52
+ {
53
+ const { valid, error } = validate(branchesSchema.update.response)
54
+ t.ok(valid, 'update response schema is valid')
55
+ t.error(error, 'should not get any error')
56
+ }
57
+
19
58
  t.end()
20
59
  })
@@ -0,0 +1,19 @@
1
+ const test = require('tape')
2
+ const validate = require('../helpers/validate-schema')
3
+ const branchesSchema = require('../../lib/v1/branches')
4
+
5
+ test('Branches:v1: read.all schema validation', function (t) {
6
+ {
7
+ const { valid, error } = validate(branchesSchema.read.all.query)
8
+ t.ok(valid, 'read query schema is valid')
9
+ t.error(error, 'should not get any error')
10
+ }
11
+
12
+ {
13
+ const { valid, error } = validate(branchesSchema.read.all.response)
14
+ t.ok(valid, 'read response schema is valid')
15
+ t.error(error, 'should not get any error')
16
+ }
17
+
18
+ t.end()
19
+ })
@@ -1,11 +1,99 @@
1
1
  const test = require('tape')
2
2
  const validate = require('../helpers/validate-schema')
3
+ const customers = require('../../lib/v0/customers')
3
4
 
4
- test('Customers: create schema validation', function (t) {
5
- t.plan(2)
6
- const createRequest = require('../../lib/v0/customers').create.request
7
- const { valid, error } = validate(createRequest)
8
- t.ok(valid, 'create schema is valid')
5
+ test('Customers:v0: create schema validation', function (t) {
6
+ {
7
+ const { valid, error } = validate(customers.create.request)
8
+ t.ok(valid, 'create request schema is valid')
9
+ t.error(error, 'should not get any error')
10
+ }
11
+
12
+ {
13
+ const { valid, error } = validate(customers.create.response)
14
+ t.ok(valid, 'create response schema is valid')
15
+ t.error(error, 'should not get any error')
16
+ }
17
+
18
+ t.end()
19
+ })
20
+
21
+ test('Customers:v0: update schema validation', function (t) {
22
+ {
23
+ const { valid, error } = validate(customers.update.request)
24
+ t.ok(valid, 'update request schema is valid')
25
+ t.error(error, 'should not get any error')
26
+ }
27
+
28
+ {
29
+ const { valid, error } = validate(customers.update.response)
30
+ t.ok(valid, 'update response schema is valid')
31
+ t.error(error, 'should not get any error')
32
+ }
33
+
34
+ t.end()
35
+ })
36
+
37
+ test('Customers:v0: create ext schema validation', function (t) {
38
+ {
39
+ const { valid, error } = validate(customers.ext.create.request)
40
+ t.ok(valid, 'create ext request schema is valid')
41
+ t.error(error, 'should not get any error')
42
+ }
43
+
44
+ {
45
+ const { valid, error } = validate(customers.ext.create.response)
46
+ t.ok(valid, 'create ext response schema is valid')
47
+ t.error(error, 'should not get any error')
48
+ }
49
+
50
+ t.end()
51
+ })
52
+
53
+ test('Customers:v0: read ext schema validation', function (t) {
54
+ {
55
+ const { valid, error } = validate(customers.ext.read.all.response)
56
+ t.ok(valid, 'read.all ext request schema is valid')
57
+ t.error(error, 'should not get any error')
58
+ }
59
+
60
+ {
61
+ const { valid, error } = validate(customers.ext.read.one.response)
62
+ t.ok(valid, 'read.one ext response schema is valid')
63
+ t.error(error, 'should not get any error')
64
+ }
65
+
66
+ t.end()
67
+ })
68
+
69
+ test('Customers:v0: update ext schema validation', function (t) {
70
+ {
71
+ const { valid, error } = validate(customers.ext.update.request)
72
+ t.ok(valid, 'update ext request schema is valid')
73
+ t.error(error, 'should not get any error')
74
+ }
75
+
76
+ {
77
+ const { valid, error } = validate(customers.ext.update.response)
78
+ t.ok(valid, 'update ext response schema is valid')
79
+ t.error(error, 'should not get any error')
80
+ }
81
+
82
+ t.end()
83
+ })
84
+
85
+ test('Customers:v0: read.all schema validation', function (t) {
86
+ const { valid, error } = validate(customers.read.all.response)
87
+ t.ok(valid, 'update response schema is valid')
9
88
  t.error(error, 'should not get any error')
89
+
90
+ t.end()
91
+ })
92
+
93
+ test('Customers:v0: read.one schema validation', function (t) {
94
+ const { valid, error } = validate(customers.read.one.response)
95
+ t.ok(valid, 'update response schema is valid')
96
+ t.error(error, 'should not get any error')
97
+
10
98
  t.end()
11
99
  })
@@ -1,24 +0,0 @@
1
- const base = require('./base')
2
-
3
- module.exports = {
4
- $id: 'https://schemas.tillhub.com/v0/customers.create.request.schema.json',
5
- $schema: 'http://json-schema.org/draft-07/schema#',
6
- additionalProperties: false,
7
- type: 'object',
8
- properties: {
9
- ...base
10
- },
11
- anyOf: [
12
- {
13
- required: [
14
- 'firstname'
15
- ]
16
- },
17
- {
18
- required: [
19
- 'lastname'
20
- ]
21
- }
22
- ],
23
- required: []
24
- }
@@ -1,14 +0,0 @@
1
- const base = require('./base')
2
-
3
- module.exports = {
4
- $id: 'https://schemas.tillhub.com/v0/customers.update.request.schema.json',
5
- $schema: 'http://json-schema.org/draft-07/schema#',
6
- additionalProperties: false,
7
- type: 'object',
8
- properties: {
9
- ...base
10
- },
11
- required: [
12
-
13
- ]
14
- }