seatsio 67.6.0 → 68.0.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/package.json +5 -5
- package/src/Charts/Category.js +4 -0
- package/src/Charts/Charts.js +8 -0
- package/src/Events/Event.js +19 -17
- package/tests/chartReports/chartReportSummary.test.js +10 -0
- package/tests/charts/manageCategories.test.js +32 -0
- package/tests/eventReports/eventReportSummary.test.js +20 -0
- package/tests/events/createEvent.test.js +1 -0
- package/tests/events/retrieveEvent.test.js +2 -0
- package/tests/sampleChart.json +6 -0
- package/tests/testUtils.js +8 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "seatsio",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "68.0.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"description": "Official JavaScript and Node.JS client library for the Seats.io REST API",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"url": "https://github.com/seatsio/seatsio-js"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"axios": "0.
|
|
17
|
+
"axios": "0.27.2"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"browserify": "latest",
|
|
21
21
|
"eslint": "7.32.0",
|
|
22
22
|
"eslint-config-standard": "16.0.3",
|
|
23
|
-
"eslint-plugin-import": "2.
|
|
23
|
+
"eslint-plugin-import": "2.26.0",
|
|
24
24
|
"eslint-plugin-node": "11.1.0",
|
|
25
25
|
"eslint-plugin-promise": "6.0.0",
|
|
26
26
|
"eslint-plugin-standard": "5.0.0",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"gulp-tap": "latest",
|
|
31
31
|
"gulp-uglify": "latest",
|
|
32
32
|
"gulp-uglify-es": "latest",
|
|
33
|
-
"jest": "
|
|
34
|
-
"jest-cli": "
|
|
33
|
+
"jest": "28.0.3",
|
|
34
|
+
"jest-cli": "28.0.3",
|
|
35
35
|
"uuid": "8.3.2"
|
|
36
36
|
}
|
|
37
37
|
}
|
package/src/Charts/Category.js
CHANGED
package/src/Charts/Charts.js
CHANGED
|
@@ -60,6 +60,14 @@ class Charts {
|
|
|
60
60
|
return this.client.post(`/charts/${key}`, requestParameters)
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
addCategory (key, category) {
|
|
64
|
+
return this.client.post(`/charts/${key}/categories`, category)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
removeCategory (chartKey, categoryKey) {
|
|
68
|
+
return this.client.delete(`/charts/${chartKey}/categories/${categoryKey}`)
|
|
69
|
+
}
|
|
70
|
+
|
|
63
71
|
/**
|
|
64
72
|
* @param {string} key
|
|
65
73
|
* @returns {object}
|
package/src/Events/Event.js
CHANGED
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
const ForSaleConfig = require('./ForSaleConfig.js')
|
|
2
2
|
const Channel = require('./Channel.js')
|
|
3
|
+
const Category = require('../Charts/Category')
|
|
3
4
|
|
|
4
5
|
class Event {
|
|
5
6
|
/**
|
|
6
|
-
* @param {object}
|
|
7
|
+
* @param {object} json
|
|
7
8
|
*/
|
|
8
|
-
constructor (
|
|
9
|
-
this.id =
|
|
10
|
-
this.key =
|
|
11
|
-
this.tableBookingConfig =
|
|
12
|
-
this.supportsBestAvailable =
|
|
13
|
-
this.forSaleConfig =
|
|
14
|
-
this.chartKey =
|
|
15
|
-
this.createdOn =
|
|
16
|
-
this.updatedOn =
|
|
17
|
-
this.channels =
|
|
18
|
-
this.socialDistancingRulesetKey =
|
|
19
|
-
this.topLevelSeasonKey =
|
|
20
|
-
this.isTopLevelSeason =
|
|
21
|
-
this.isPartialSeason =
|
|
22
|
-
this.isEventInSeason =
|
|
23
|
-
this.objectCategories =
|
|
9
|
+
constructor (json) {
|
|
10
|
+
this.id = json.id
|
|
11
|
+
this.key = json.key
|
|
12
|
+
this.tableBookingConfig = json.tableBookingConfig
|
|
13
|
+
this.supportsBestAvailable = json.supportsBestAvailable
|
|
14
|
+
this.forSaleConfig = json.forSaleConfig ? new ForSaleConfig(json.forSaleConfig.forSale, json.forSaleConfig.objects, json.forSaleConfig.categories) : null
|
|
15
|
+
this.chartKey = json.chartKey
|
|
16
|
+
this.createdOn = json.createdOn ? new Date(json.createdOn) : null
|
|
17
|
+
this.updatedOn = json.updatedOn ? new Date(json.updatedOn) : null
|
|
18
|
+
this.channels = json.channels ? json.channels.map(c => new Channel(c)) : null
|
|
19
|
+
this.socialDistancingRulesetKey = json.socialDistancingRulesetKey
|
|
20
|
+
this.topLevelSeasonKey = json.topLevelSeasonKey
|
|
21
|
+
this.isTopLevelSeason = json.isTopLevelSeason
|
|
22
|
+
this.isPartialSeason = json.isPartialSeason
|
|
23
|
+
this.isEventInSeason = json.isEventInSeason
|
|
24
|
+
this.objectCategories = json.objectCategories
|
|
25
|
+
this.categories = json.categories ? json.categories.map(c => Category.fromJson(c)) : null
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
isSeason () {
|
|
@@ -94,6 +94,11 @@ test('summaryByCategoryKey', async () => {
|
|
|
94
94
|
seat: 16
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
|
+
'string11': {
|
|
98
|
+
count: 0,
|
|
99
|
+
bySection: {},
|
|
100
|
+
byObjectType: {}
|
|
101
|
+
},
|
|
97
102
|
NO_CATEGORY: {
|
|
98
103
|
count: 0,
|
|
99
104
|
bySection: {},
|
|
@@ -126,6 +131,11 @@ test('summaryByCategoryLabel', async () => {
|
|
|
126
131
|
seat: 16
|
|
127
132
|
}
|
|
128
133
|
},
|
|
134
|
+
Cat3: {
|
|
135
|
+
count: 0,
|
|
136
|
+
bySection: {},
|
|
137
|
+
byObjectType: {}
|
|
138
|
+
},
|
|
129
139
|
NO_CATEGORY: {
|
|
130
140
|
count: 0,
|
|
131
141
|
bySection: {},
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const testUtils = require('../testUtils.js')
|
|
2
|
+
|
|
3
|
+
test('should add a category', async () => {
|
|
4
|
+
const { client } = await testUtils.createTestUserAndClient()
|
|
5
|
+
const categories = [
|
|
6
|
+
{ key: 1, label: 'Category 1', color: '#aaaaaa', accessible: false }
|
|
7
|
+
]
|
|
8
|
+
const chart = await client.charts.create(null, null, categories)
|
|
9
|
+
|
|
10
|
+
await client.charts.addCategory(chart.key, { key: 2, label: 'Category 2', color: '#bbbbbb', accessible: true })
|
|
11
|
+
|
|
12
|
+
const expectedCategories = [
|
|
13
|
+
{ key: 1, label: 'Category 1', color: '#aaaaaa', accessible: false },
|
|
14
|
+
{ key: 2, label: 'Category 2', color: '#bbbbbb', accessible: true }
|
|
15
|
+
]
|
|
16
|
+
const retrievedChart = await client.charts.retrievePublishedVersion(chart.key)
|
|
17
|
+
expect(retrievedChart.categories.list).toEqual(expectedCategories)
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
test('should remove a category', async () => {
|
|
21
|
+
const { client } = await testUtils.createTestUserAndClient()
|
|
22
|
+
const categories = [
|
|
23
|
+
{ key: 1, label: 'Category 1', color: '#aaaaaa', accessible: false },
|
|
24
|
+
{ key: 'cat2', label: 'Category 2', color: '#bbbbbb', accessible: true }
|
|
25
|
+
]
|
|
26
|
+
const chart = await client.charts.create('aChart', null, categories)
|
|
27
|
+
|
|
28
|
+
await client.charts.removeCategory(chart.key, 'cat2')
|
|
29
|
+
|
|
30
|
+
const retrievedChart = await client.charts.retrievePublishedVersion(chart.key)
|
|
31
|
+
expect(retrievedChart.categories.list).toEqual([{ key: 1, label: 'Category 1', color: '#aaaaaa', accessible: false }])
|
|
32
|
+
})
|
|
@@ -128,6 +128,16 @@ test('summaryByCategoryKey', async () => {
|
|
|
128
128
|
seat: 16
|
|
129
129
|
}
|
|
130
130
|
},
|
|
131
|
+
'string11': {
|
|
132
|
+
count: 0,
|
|
133
|
+
bySection: {},
|
|
134
|
+
bySelectability: {},
|
|
135
|
+
byAvailability: {},
|
|
136
|
+
byAvailabilityReason: { },
|
|
137
|
+
byStatus: {},
|
|
138
|
+
byChannel: {},
|
|
139
|
+
byObjectType: {}
|
|
140
|
+
},
|
|
131
141
|
NO_CATEGORY: {
|
|
132
142
|
count: 0,
|
|
133
143
|
bySection: {},
|
|
@@ -177,6 +187,16 @@ test('summaryByCategoryLabel', async () => {
|
|
|
177
187
|
seat: 16
|
|
178
188
|
}
|
|
179
189
|
},
|
|
190
|
+
Cat3: {
|
|
191
|
+
count: 0,
|
|
192
|
+
bySection: {},
|
|
193
|
+
bySelectability: {},
|
|
194
|
+
byAvailability: {},
|
|
195
|
+
byAvailabilityReason: { },
|
|
196
|
+
byStatus: {},
|
|
197
|
+
byChannel: {},
|
|
198
|
+
byObjectType: {}
|
|
199
|
+
},
|
|
180
200
|
NO_CATEGORY: {
|
|
181
201
|
count: 0,
|
|
182
202
|
bySection: {},
|
|
@@ -17,6 +17,7 @@ test('should check that only chart key is required', async () => {
|
|
|
17
17
|
expect(event.createdOn).toBeInstanceOf(Date)
|
|
18
18
|
expect(event.forSaleConfig).toBeFalsy()
|
|
19
19
|
expect(event.updatedOn).toBeFalsy()
|
|
20
|
+
expect(event.categories).toEqual(testUtils.testChartCategories)
|
|
20
21
|
})
|
|
21
22
|
|
|
22
23
|
test('should pass in event key as a create() param', async () => {
|
|
@@ -21,6 +21,7 @@ test('should retrieve event', async () => {
|
|
|
21
21
|
expect(retrievedEvent.forSaleConfig).toBeFalsy()
|
|
22
22
|
expect(retrievedEvent.updatedOn).toBeNull()
|
|
23
23
|
expect(retrievedEvent.topLevelSeasonKey).toBe(undefined)
|
|
24
|
+
expect(retrievedEvent.categories).toEqual(testUtils.testChartCategories)
|
|
24
25
|
})
|
|
25
26
|
|
|
26
27
|
test('retrieve season', async () => {
|
|
@@ -48,6 +49,7 @@ test('retrieve season', async () => {
|
|
|
48
49
|
expect(retrievedSeason.forSaleConfig).toBeFalsy()
|
|
49
50
|
expect(retrievedSeason.updatedOn).toBeFalsy()
|
|
50
51
|
expect(retrievedSeason.topLevelSeasonKey).toBe(undefined)
|
|
52
|
+
expect(retrievedSeason.categories).toEqual(testUtils.testChartCategories)
|
|
51
53
|
})
|
|
52
54
|
|
|
53
55
|
test('retrieve partial season', async () => {
|
package/tests/sampleChart.json
CHANGED
package/tests/testUtils.js
CHANGED
|
@@ -5,6 +5,7 @@ const { v4: uuidv4 } = require('uuid')
|
|
|
5
5
|
const LabelClasses = require('../src/Common/Labels.js')
|
|
6
6
|
const path = require('path')
|
|
7
7
|
const Region = require('../src/Region')
|
|
8
|
+
const Category = require("../src/Charts/Category");
|
|
8
9
|
|
|
9
10
|
const baseUrl = 'https://api-staging-eu.seatsio.net/'
|
|
10
11
|
|
|
@@ -104,5 +105,11 @@ module.exports = {
|
|
|
104
105
|
reject,
|
|
105
106
|
resolve
|
|
106
107
|
}
|
|
107
|
-
}
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
testChartCategories: [
|
|
111
|
+
new Category(9, 'Cat1', '#87A9CD', false),
|
|
112
|
+
new Category(10, 'Cat2', '#5E42ED', false),
|
|
113
|
+
new Category('string11', 'Cat3', '#5E42BB', false)
|
|
114
|
+
]
|
|
108
115
|
}
|