seatsio 67.0.0 → 67.3.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.0.0",
3
+ "version": "67.3.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",
@@ -16,6 +16,10 @@ class Event {
16
16
  this.updatedOn = event.updatedOn ? new Date(event.updatedOn) : null
17
17
  this.channels = event.channels ? event.channels.map(c => new Channel(c)) : null
18
18
  this.socialDistancingRulesetKey = event.socialDistancingRulesetKey
19
+ this.topLevelSeasonKey = event.topLevelSeasonKey
20
+ this.isTopLevelSeason = event.isTopLevelSeason
21
+ this.isPartialSeason = event.isPartialSeason
22
+ this.isEventInSeason = event.isEventInSeason
19
23
  }
20
24
 
21
25
  isSeason () {
@@ -1,9 +1,11 @@
1
1
  class StatusChangesParams {
2
2
  /**
3
3
  * @param {?string} filter
4
+ * @param {?string} filterType
4
5
  */
5
- constructor (filter = null) {
6
+ constructor (filter = null, filterType = 'CONTAINS') {
6
7
  this.filter = filter
8
+ this.filterType = filterType
7
9
  this.sortField = null
8
10
  this.sortDirection = null
9
11
  }
@@ -50,10 +52,12 @@ class StatusChangesParams {
50
52
 
51
53
  /**
52
54
  * @param {string} filter
55
+ * @param {?string} filterType: CONTAINS, MATCHES, BEGINS_WITH or ENDS_WITH
53
56
  * @returns {StatusChangesParams}
54
57
  */
55
- withFilter (filter) {
58
+ withFilter (filter, filterType = 'CONTAINS') {
56
59
  this.filter = filter
60
+ this.filterType = filterType
57
61
  return this
58
62
  }
59
63
 
@@ -69,6 +73,7 @@ class StatusChangesParams {
69
73
 
70
74
  return {
71
75
  filter: this.filter,
76
+ filterType: this.filterType,
72
77
  sort: sort
73
78
  }
74
79
  }
@@ -1,6 +1,6 @@
1
1
  const testUtils = require('../testUtils.js')
2
2
  const TableBookingConfig = require('../../src/Events/TableBookingConfig')
3
- const SeasonParams = require("../../src/Seasons/SeasonParams");
3
+ const SeasonParams = require('../../src/Seasons/SeasonParams')
4
4
 
5
5
  test('should retrieve event', async () => {
6
6
  const { client, user } = await testUtils.createTestUserAndClient()
@@ -20,6 +20,7 @@ test('should retrieve event', async () => {
20
20
  expect(retrievedEvent.createdOn.getTime()).toBeLessThanOrEqual(now.getTime() + 5000)
21
21
  expect(retrievedEvent.forSaleConfig).toBeFalsy()
22
22
  expect(retrievedEvent.updatedOn).toBeNull()
23
+ expect(retrievedEvent.topLevelSeasonKey).toBe(undefined)
23
24
  })
24
25
 
25
26
  test('retrieve season', async () => {
@@ -32,6 +33,10 @@ test('retrieve season', async () => {
32
33
 
33
34
  const retrievedSeason = await client.events.retrieve(season.key)
34
35
 
36
+ expect(retrievedSeason.isSeason()).toBe(true)
37
+ expect(retrievedSeason.isTopLevelSeason).toBe(true)
38
+ expect(retrievedSeason.isPartialSeason).toBe(false)
39
+ expect(retrievedSeason.isEventInSeason).toBe(false)
35
40
  expect(retrievedSeason.key).toBeTruthy()
36
41
  expect(retrievedSeason.id).toBeTruthy()
37
42
  expect(retrievedSeason.partialSeasonKeys).toEqual([partialSeason1.key, partialSeason2.key])
@@ -42,4 +47,47 @@ test('retrieve season', async () => {
42
47
  expect(retrievedSeason.createdOn).toBeInstanceOf(Date)
43
48
  expect(retrievedSeason.forSaleConfig).toBeFalsy()
44
49
  expect(retrievedSeason.updatedOn).toBeFalsy()
50
+ expect(retrievedSeason.topLevelSeasonKey).toBe(undefined)
51
+ })
52
+
53
+ test('retrieve partial season', async () => {
54
+ const { client, user } = await testUtils.createTestUserAndClient()
55
+ const chartKey = testUtils.getChartKey()
56
+ await testUtils.createTestChart(chartKey, user.secretKey)
57
+ const season = await client.seasons.create(chartKey, new SeasonParams().eventKeys(['event1', 'event2']))
58
+ const partialSeason1 = await client.seasons.createPartialSeason(season.key, null, ['event1', 'event2'])
59
+ const partialSeason2 = await client.seasons.createPartialSeason(season.key)
60
+
61
+ const retrievedSeason = await client.events.retrieve(partialSeason1.key)
62
+
63
+ expect(retrievedSeason.isSeason()).toBe(true)
64
+ expect(retrievedSeason.isTopLevelSeason).toBe(false)
65
+ expect(retrievedSeason.isPartialSeason).toBe(true)
66
+ expect(retrievedSeason.isEventInSeason).toBe(false)
67
+ expect(retrievedSeason.key).toBeTruthy()
68
+ expect(retrievedSeason.id).toBeTruthy()
69
+ expect(retrievedSeason.partialSeasonKeys).toBe(undefined)
70
+ expect(retrievedSeason.events.map(e => e.key)).toEqual(['event1', 'event2'])
71
+ expect(retrievedSeason.chartKey).toBe(chartKey)
72
+ expect(retrievedSeason.tableBookingConfig).toEqual(TableBookingConfig.inherit())
73
+ expect(retrievedSeason.supportsBestAvailable).toBe(true)
74
+ expect(retrievedSeason.createdOn).toBeInstanceOf(Date)
75
+ expect(retrievedSeason.forSaleConfig).toBeFalsy()
76
+ expect(retrievedSeason.updatedOn).toBeFalsy()
77
+ expect(retrievedSeason.topLevelSeasonKey).toBe(season.key)
78
+ })
79
+
80
+ test('retrieve event in season', async () => {
81
+ const { client, user } = await testUtils.createTestUserAndClient()
82
+ const chartKey = testUtils.getChartKey()
83
+ await testUtils.createTestChart(chartKey, user.secretKey)
84
+ const season = await client.seasons.create(chartKey, new SeasonParams().eventKeys(['event1', 'event2']))
85
+
86
+ const retrievedEvent = await client.events.retrieve('event1')
87
+
88
+ expect(retrievedEvent.isSeason()).toBe(false)
89
+ expect(retrievedEvent.isTopLevelSeason).toBe(false)
90
+ expect(retrievedEvent.isPartialSeason).toBe(false)
91
+ expect(retrievedEvent.isEventInSeason).toBe(true)
92
+ expect(retrievedEvent.topLevelSeasonKey).toBe(season.key)
45
93
  })