seatsio 67.5.0 → 67.8.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seatsio",
3
- "version": "67.5.0",
3
+ "version": "67.8.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,7 +14,7 @@
14
14
  "url": "https://github.com/seatsio/seatsio-js"
15
15
  },
16
16
  "dependencies": {
17
- "axios": "0.25.0"
17
+ "axios": "0.26.0"
18
18
  },
19
19
  "devDependencies": {
20
20
  "browserify": "latest",
@@ -30,8 +30,8 @@
30
30
  "gulp-tap": "latest",
31
31
  "gulp-uglify": "latest",
32
32
  "gulp-uglify-es": "latest",
33
- "jest": "27.4.7",
34
- "jest-cli": "27.4.7",
33
+ "jest": "27.5.1",
34
+ "jest-cli": "27.5.1",
35
35
  "uuid": "8.3.2"
36
36
  }
37
37
  }
@@ -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}
@@ -21,6 +21,7 @@ class Event {
21
21
  this.isPartialSeason = event.isPartialSeason
22
22
  this.isEventInSeason = event.isEventInSeason
23
23
  this.objectCategories = event.objectCategories
24
+ this.categories = event.categories
24
25
  }
25
26
 
26
27
  isSeason () {
@@ -1,4 +1,5 @@
1
1
  const Season = require('./Season')
2
+ const EventDeserializer = require('../Events/EventDeserializer')
2
3
 
3
4
  class Seasons {
4
5
  /**
@@ -84,7 +85,7 @@ class Seasons {
84
85
  }
85
86
 
86
87
  return this.client.post(`/seasons/${encodeURIComponent(key)}/actions/create-events`, requestParameters)
87
- .then((res) => new Season(res.data))
88
+ .then((res) => res.data.events.map(e => new EventDeserializer().fromJson(e)))
88
89
  }
89
90
 
90
91
  /**
@@ -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: {},
@@ -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.length).toBe(3)
24
25
  })
25
26
 
26
27
  test('retrieve season', async () => {
@@ -15,6 +15,12 @@
15
15
  "color": "#5E42ED",
16
16
  "accessible": false,
17
17
  "key": 10
18
+ },
19
+ {
20
+ "label": "Cat3",
21
+ "color": "#5E42BB",
22
+ "accessible": false,
23
+ "key": "string11"
18
24
  }
19
25
  ],
20
26
  "maxCategoryKey": 10
@@ -5,9 +5,9 @@ test('create events in season by event keys', async () => {
5
5
  const chart = await client.charts.create()
6
6
  const season = await client.seasons.create(chart.key)
7
7
 
8
- const updatedSeason = await client.seasons.createEvents(season.key, null, ['event1', 'event2'])
8
+ const events = await client.seasons.createEvents(season.key, null, ['event1', 'event2'])
9
9
 
10
- expect(updatedSeason.events.map(e => e.key)).toEqual(['event1', 'event2'])
10
+ expect(events.map(e => e.key)).toEqual(['event2', 'event1'])
11
11
  })
12
12
 
13
13
  test('create events in season by number of events', async () => {
@@ -15,7 +15,7 @@ test('create events in season by number of events', async () => {
15
15
  const chart = await client.charts.create()
16
16
  const season = await client.seasons.create(chart.key)
17
17
 
18
- const updatedSeason = await client.seasons.createEvents(season.key, 2)
18
+ const events = await client.seasons.createEvents(season.key, 2)
19
19
 
20
- expect(updatedSeason.events.length).toBe(2)
20
+ expect(events.length).toBe(2)
21
21
  })