@eso-status/forum-message 2.0.0-dev.0 → 2.0.0-dev.10

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/README.md CHANGED
@@ -31,122 +31,126 @@ npm i @eso-status/forum-message
31
31
  ### Usage
32
32
  ```javascript
33
33
  import ForumMessage from '@eso-status/forum-message';
34
- import { RawEsoStatus } from '@eso-status/types';
35
- import { ForumMessageURL } from '@eso-status/forum-message/const';
34
+ import { EsoStatusRawData } from '@eso-status/types';
35
+ import { ForumMessagePTSURL } from '@eso-status/forum-message/const';
36
36
 
37
37
  // Homepage data
38
- const rawEsoStatus: RawEsoStatus = await ForumMessage.getData();
38
+ const esoStatusRawDataList: EsoStatusRawData[] = await ForumMessage.getData();
39
39
 
40
40
  // PTS category homepage data
41
- const rawEsoStatus: RawEsoStatus = await ForumMessage.getData(ForumMessageURL);
41
+ const esoStatusRawDataList: EsoStatusRawData[] = await ForumMessage.getData(ForumMessagePTSURL);
42
42
  ```
43
43
  ### Return exemple
44
44
  ```text
45
45
  [
46
- {
47
- source: 'https://forums.elderscrollsonline.com',
48
- raw: '• PC/Mac: NA and EU megaservers for patch maintenance – September 3, 4:00AM EDT (8:00 UTC) – 9:00AM EDT (13:00 UTC)',
49
- slug: 'server_pc_eu',
50
- type: 'server',
51
- support: 'pc',
52
- zone: 'eu',
53
- status: 'planned',
54
- rawSlug: 'PC/Mac: NA and EU megaservers for'
55
- },
56
- {
57
- source: 'https://forums.elderscrollsonline.com',
58
- raw: '• PC/Mac: NA and EU megaservers for patch maintenance – September 3, 4:00AM EDT (8:00 UTC) – 9:00AM EDT (13:00 UTC)',
59
- slug: 'server_pc_na',
60
- type: 'server',
61
- support: 'pc',
62
- zone: 'na',
63
- status: 'planned',
64
- rawSlug: 'PC/Mac: NA and EU megaservers for'
65
- },
66
- {
67
- source: 'https://forums.elderscrollsonline.com',
68
- raw: '• Xbox: NA and EU megaservers for patch maintenance – September 4, 6:00AM EDT (10:00 UTC) - 12:00PM EDT (16:00 UTC)',
69
- slug: 'server_xbox_eu',
70
- type: 'server',
71
- support: 'xbox',
72
- zone: 'eu',
73
- status: 'planned',
74
- rawSlug: 'Xbox: NA and EU megaservers for',
75
- rawDate: 'September 4, 6:00AM EDT (10:00 UTC) - 12:00PM EDT (16:00 UTC)',
76
- dates: [ Moment<2024-09-04T10:00:00Z>, Moment<2024-09-04T16:00:00Z> ]
77
- },
78
- {
79
- source: 'https://forums.elderscrollsonline.com',
80
- raw: '• Xbox: NA and EU megaservers for patch maintenance – September 4, 6:00AM EDT (10:00 UTC) - 12:00PM EDT (16:00 UTC)',
81
- slug: 'server_xbox_na',
82
- type: 'server',
83
- support: 'xbox',
84
- zone: 'na',
85
- status: 'planned',
86
- rawSlug: 'Xbox: NA and EU megaservers for',
87
- rawDate: 'September 4, 6:00AM EDT (10:00 UTC) - 12:00PM EDT (16:00 UTC)',
88
- dates: [ Moment<2024-09-04T10:00:00Z>, Moment<2024-09-04T16:00:00Z> ]
89
- },
90
- {
91
- source: 'https://forums.elderscrollsonline.com',
92
- raw: '• PlayStation®: NA and EU megaservers for patch maintenance – September 4, 6:00AM EDT (10:00 UTC) - 12:00PM EDT (16:00 UTC)',
93
- slug: 'server_ps_eu',
94
- type: 'server',
95
- support: 'ps',
96
- zone: 'eu',
97
- status: 'planned',
98
- rawSlug: 'PlayStation®: NA and EU megaservers for',
99
- rawDate: 'September 4, 6:00AM EDT (10:00 UTC) - 12:00PM EDT (16:00 UTC)',
100
- dates: [ Moment<2024-09-04T10:00:00Z>, Moment<2024-09-04T16:00:00Z> ]
101
- },
102
- {
103
- source: 'https://forums.elderscrollsonline.com',
104
- raw: '• PlayStation®: NA and EU megaservers for patch maintenance – September 4, 6:00AM EDT (10:00 UTC) - 12:00PM EDT (16:00 UTC)',
105
- slug: 'server_ps_na',
106
- type: 'server',
107
- support: 'ps',
108
- zone: 'na',
109
- status: 'planned',
110
- rawSlug: 'PlayStation®: NA and EU megaservers for',
111
- rawDate: 'September 4, 6:00AM EDT (10:00 UTC) - 12:00PM EDT (16:00 UTC)',
112
- dates: [ Moment<2024-09-04T10:00:00Z>, Moment<2024-09-04T16:00:00Z> ]
113
- },
114
- {
115
- source: 'https://forums.elderscrollsonline.com',
116
- raw: '• ESO Store and Account System for maintenance – September 4, 10:00AM EDT (14:00 UTC) - 12:00PM EDT (16:00 UTC)',
117
- slug: 'service_store_eso',
118
- type: 'service',
119
- support: 'store',
120
- zone: 'eso',
121
- status: 'planned',
122
- rawSlug: 'ESO Store and Account System for',
123
- rawDate: 'September 4, 10:00AM EDT (14:00 UTC) - 12:00PM EDT (16:00 UTC)',
124
- dates: [ Moment<2024-09-04T14:00:00Z>, Moment<2024-09-04T16:00:00Z> ]
125
- },
126
- {
127
- source: 'https://forums.elderscrollsonline.com',
128
- raw: '• ESO Store and Account System for maintenance – September 4, 10:00AM EDT (14:00 UTC) - 12:00PM EDT (16:00 UTC)',
129
- slug: 'service_system_account',
130
- type: 'service',
131
- support: 'system',
132
- zone: 'account',
133
- status: 'planned',
134
- rawSlug: 'ESO Store and Account System for',
135
- rawDate: 'September 4, 10:00AM EDT (14:00 UTC) - 12:00PM EDT (16:00 UTC)',
136
- dates: [ Moment<2024-09-04T14:00:00Z>, Moment<2024-09-04T16:00:00Z> ]
137
- },
138
- {
139
- source: 'https://forums.elderscrollsonline.com/en/categories/pts',
140
- raw: 'We will be performing maintenance on the PTS on Thursday at 9:00AM EDT (13:00 UTC).',
141
- slug: 'server_pc_pts',
142
- type: 'server',
143
- support: 'pc',
144
- zone: 'pts',
145
- status: 'planned',
146
- rawSlug: 'PTS',
147
- rawDate: 'Thursday at 9:00AM EDT (13:00 UTC). ',
148
- dates: [ Moment<2024-09-05T13:00:00Z> ],
149
- rawStatus: 'We will be performing maintenance'
150
- }
46
+ {
47
+ source: 'https://forums.elderscrollsonline.com',
48
+ raw: '• PC/Mac: NA and EU megaservers for patch maintenance – September 3, 4:00AM EDT (8:00 UTC) – 9:00AM EDT (13:00 UTC)',
49
+ slug: 'server_pc_eu',
50
+ type: 'server',
51
+ support: 'pc',
52
+ zone: 'eu',
53
+ status: 'planned',
54
+ rawSlug: 'PC/Mac: NA and EU megaservers for',
55
+ rawDate: 'September 3, 4:00AM EDT (8:00 UTC) – 9:00AM EDT (13:00 UTC)',
56
+ dates: [ Moment<2024-09-03T08:00:00Z>, Moment<2024-09-03T13:00:00Z> ]
57
+ },
58
+ {
59
+ source: 'https://forums.elderscrollsonline.com',
60
+ raw: '• PC/Mac: NA and EU megaservers for patch maintenance – September 3, 4:00AM EDT (8:00 UTC) – 9:00AM EDT (13:00 UTC)',
61
+ slug: 'server_pc_na',
62
+ type: 'server',
63
+ support: 'pc',
64
+ zone: 'na',
65
+ status: 'planned',
66
+ rawSlug: 'PC/Mac: NA and EU megaservers for',
67
+ rawDate: 'September 3, 4:00AM EDT (8:00 UTC) – 9:00AM EDT (13:00 UTC)',
68
+ dates: [ Moment<2024-09-03T08:00:00Z>, Moment<2024-09-03T13:00:00Z> ]
69
+ },
70
+ {
71
+ source: 'https://forums.elderscrollsonline.com',
72
+ raw: '• Xbox: NA and EU megaservers for patch maintenance – September 4, 6:00AM EDT (10:00 UTC) - 12:00PM EDT (16:00 UTC)',
73
+ slug: 'server_xbox_eu',
74
+ type: 'server',
75
+ support: 'xbox',
76
+ zone: 'eu',
77
+ status: 'planned',
78
+ rawSlug: 'Xbox: NA and EU megaservers for',
79
+ rawDate: 'September 4, 6:00AM EDT (10:00 UTC) - 12:00PM EDT (16:00 UTC)',
80
+ dates: [ Moment<2024-09-04T10:00:00Z>, Moment<2024-09-04T16:00:00Z> ]
81
+ },
82
+ {
83
+ source: 'https://forums.elderscrollsonline.com',
84
+ raw: '• Xbox: NA and EU megaservers for patch maintenance – September 4, 6:00AM EDT (10:00 UTC) - 12:00PM EDT (16:00 UTC)',
85
+ slug: 'server_xbox_na',
86
+ type: 'server',
87
+ support: 'xbox',
88
+ zone: 'na',
89
+ status: 'planned',
90
+ rawSlug: 'Xbox: NA and EU megaservers for',
91
+ rawDate: 'September 4, 6:00AM EDT (10:00 UTC) - 12:00PM EDT (16:00 UTC)',
92
+ dates: [ Moment<2024-09-04T10:00:00Z>, Moment<2024-09-04T16:00:00Z> ]
93
+ },
94
+ {
95
+ source: 'https://forums.elderscrollsonline.com',
96
+ raw: '• PlayStation®: NA and EU megaservers for patch maintenance – September 4, 6:00AM EDT (10:00 UTC) - 12:00PM EDT (16:00 UTC)',
97
+ slug: 'server_ps_eu',
98
+ type: 'server',
99
+ support: 'ps',
100
+ zone: 'eu',
101
+ status: 'planned',
102
+ rawSlug: 'PlayStation®: NA and EU megaservers for',
103
+ rawDate: 'September 4, 6:00AM EDT (10:00 UTC) - 12:00PM EDT (16:00 UTC)',
104
+ dates: [ Moment<2024-09-04T10:00:00Z>, Moment<2024-09-04T16:00:00Z> ]
105
+ },
106
+ {
107
+ source: 'https://forums.elderscrollsonline.com',
108
+ raw: '• PlayStation®: NA and EU megaservers for patch maintenance – September 4, 6:00AM EDT (10:00 UTC) - 12:00PM EDT (16:00 UTC)',
109
+ slug: 'server_ps_na',
110
+ type: 'server',
111
+ support: 'ps',
112
+ zone: 'na',
113
+ status: 'planned',
114
+ rawSlug: 'PlayStation®: NA and EU megaservers for',
115
+ rawDate: 'September 4, 6:00AM EDT (10:00 UTC) - 12:00PM EDT (16:00 UTC)',
116
+ dates: [ Moment<2024-09-04T10:00:00Z>, Moment<2024-09-04T16:00:00Z> ]
117
+ },
118
+ {
119
+ source: 'https://forums.elderscrollsonline.com',
120
+ raw: '• ESO Store and Account System for maintenance – September 4, 10:00AM EDT (14:00 UTC) - 12:00PM EDT (16:00 UTC)',
121
+ slug: 'service_store_eso',
122
+ type: 'service',
123
+ support: 'store',
124
+ zone: 'eso',
125
+ status: 'planned',
126
+ rawSlug: 'ESO Store and Account System for',
127
+ rawDate: 'September 4, 10:00AM EDT (14:00 UTC) - 12:00PM EDT (16:00 UTC)',
128
+ dates: [ Moment<2024-09-04T14:00:00Z>, Moment<2024-09-04T16:00:00Z> ]
129
+ },
130
+ {
131
+ source: 'https://forums.elderscrollsonline.com',
132
+ raw: '• ESO Store and Account System for maintenance – September 4, 10:00AM EDT (14:00 UTC) - 12:00PM EDT (16:00 UTC)',
133
+ slug: 'service_system_account',
134
+ type: 'service',
135
+ support: 'system',
136
+ zone: 'account',
137
+ status: 'planned',
138
+ rawSlug: 'ESO Store and Account System for',
139
+ rawDate: 'September 4, 10:00AM EDT (14:00 UTC) - 12:00PM EDT (16:00 UTC)',
140
+ dates: [ Moment<2024-09-04T14:00:00Z>, Moment<2024-09-04T16:00:00Z> ]
141
+ },
142
+ {
143
+ source: 'https://forums.elderscrollsonline.com/en/categories/pts',
144
+ raw: 'We will be performing maintenance on the PTS on Thursday at 9:00AM EDT (13:00 UTC).',
145
+ slug: 'server_pc_pts',
146
+ type: 'server',
147
+ support: 'pc',
148
+ zone: 'pts',
149
+ status: 'planned',
150
+ rawSlug: 'PTS',
151
+ rawDate: 'Thursday at 9:00AM EDT (13:00 UTC)',
152
+ rawStatus: 'We will be performing maintenance',
153
+ dates: [ Moment<2024-09-05T13:00:00Z> ]
154
+ }
151
155
  ]
152
156
  ```
@@ -60,9 +60,9 @@ export default class Connector {
60
60
  */
61
61
  private fetch;
62
62
  /**
63
- * Method for retrieving the information contained in an announcement
64
- * @param raw Raw data of the announcement
63
+ * Method to create the return list with all the data contained in the announcements, sorted by importance while avoiding duplicates
64
+ * @param matches List of all the data contained in the announcements
65
65
  * @private
66
66
  */
67
- private fetchEach;
67
+ private fetchAll;
68
68
  }
package/lib/connector.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const axios_1 = require("axios");
4
+ const types_1 = require("@eso-status/types");
4
5
  const raw_1 = require("./raw");
5
6
  /**
6
7
  * Class for retrieving information from announcements
@@ -50,7 +51,7 @@ class Connector {
50
51
  * @private
51
52
  */
52
53
  getMessages() {
53
- ['WarningMessage', 'AlertMessage'].forEach((type) => this.getMessagesByType(type));
54
+ ['AlertMessage', 'WarningMessage'].forEach((type) => this.getMessagesByType(type));
54
55
  }
55
56
  /**
56
57
  * Method for retrieving raw announcements based on the announcement level
@@ -73,7 +74,16 @@ class Connector {
73
74
  replace() {
74
75
  this.raw = this.raw.map((raw) => {
75
76
  let initialRaw = raw;
77
+ initialRaw = initialRaw.replace(' 。', '');
76
78
  initialRaw = initialRaw.replace(/<br\/>\n/g, '<br>');
79
+ initialRaw = initialRaw.replace('. <br>', '.<br>');
80
+ initialRaw = initialRaw.replace(' Thank you for your patience.', '');
81
+ if (initialRaw.includes('. Please check here for status updates: <a href')) {
82
+ return initialRaw.split(' Please check here for status updates: <a href')[0];
83
+ }
84
+ if (initialRaw.includes('. <a href')) {
85
+ return initialRaw.split(' <a href')[0];
86
+ }
77
87
  return initialRaw.replace('. ', '.');
78
88
  });
79
89
  }
@@ -105,16 +115,34 @@ class Connector {
105
115
  * @private
106
116
  */
107
117
  fetch() {
108
- this.raw.forEach((raw) => this.fetchEach(raw));
118
+ const matches = [];
119
+ this.raw.forEach((raw) => {
120
+ new raw_1.default(this.url, raw).matches.forEach((match) => {
121
+ matches.push(match);
122
+ });
123
+ });
124
+ this.fetchAll(matches);
109
125
  }
110
126
  /**
111
- * Method for retrieving the information contained in an announcement
112
- * @param raw Raw data of the announcement
127
+ * Method to create the return list with all the data contained in the announcements, sorted by importance while avoiding duplicates
128
+ * @param matches List of all the data contained in the announcements
113
129
  * @private
114
130
  */
115
- fetchEach(raw) {
116
- new raw_1.default(this.url, raw).matches.forEach((match) => {
117
- this.rawEsoStatus.push(match);
131
+ fetchAll(matches) {
132
+ matches.forEach((match) => {
133
+ const alreadyInList = this.rawEsoStatus.filter((esoStatusRawData) => esoStatusRawData.slug === match.slug).length !== 0;
134
+ const alone = matches.filter((esoStatusRawData) => esoStatusRawData.slug === match.slug).length === 1;
135
+ const slugIsIssues = matches.filter((esoStatusRawData) => esoStatusRawData.status === types_1.IssuesStatus &&
136
+ esoStatusRawData.slug === match.slug).length !== 0;
137
+ const slugIsUp = matches.filter((esoStatusRawData) => esoStatusRawData.status === types_1.UpStatus &&
138
+ esoStatusRawData.slug === match.slug).length !== 0;
139
+ if (!alreadyInList) {
140
+ if (alone ||
141
+ (match.status === types_1.IssuesStatus && slugIsIssues) ||
142
+ (match.status === types_1.UpStatus && slugIsUp)) {
143
+ this.rawEsoStatus.push(match);
144
+ }
145
+ }
118
146
  });
119
147
  }
120
148
  }
@@ -1,4 +1,3 @@
1
- import { Moment } from 'moment';
2
1
  /**
3
2
  * Class for identifying and formatting the date contained in an announcement
4
3
  */
@@ -9,9 +8,9 @@ export default class DateFormatter {
9
8
  */
10
9
  rawDate: string;
11
10
  /**
12
- * List of dates formatted correctly contained in the announcement
11
+ * List of dates formatted correctly contained in the announcement (ISO 8601)
13
12
  */
14
- dates: Moment[];
13
+ dates: string[];
15
14
  /**
16
15
  * @param raw Raw data of the announcement
17
16
  */
@@ -34,7 +33,7 @@ export default class DateFormatter {
34
33
  */
35
34
  private getRawSpecialDate;
36
35
  /**
37
- * Method for generating the list of correctly formatted dates for case #1
36
+ * Method for generating the list of correctly formatted dates for case #1 (ISO 8601)
38
37
  * @private
39
38
  */
40
39
  private formatClassic;
@@ -69,7 +68,7 @@ export default class DateFormatter {
69
68
  */
70
69
  private getRawClassicMinute2;
71
70
  /**
72
- * Method for generating the correctly formatted date in case #2
71
+ * Method for generating the correctly formatted date in case #2 (ISO 8601)
73
72
  * @private
74
73
  */
75
74
  private formatSpecial;
@@ -85,7 +84,7 @@ export default class DateFormatter {
85
84
  */
86
85
  private getRawSpecialMinute;
87
86
  /**
88
- * Method for formatting a date correctly
87
+ * Method for formatting a date correctly (ISO 8601)
89
88
  * @param year
90
89
  * @param month
91
90
  * @param day
@@ -93,5 +92,5 @@ export default class DateFormatter {
93
92
  * @param minute
94
93
  * @private
95
94
  */
96
- private static generateMoment;
95
+ private static generateDate;
97
96
  }
@@ -48,16 +48,16 @@ class DateFormatter {
48
48
  */
49
49
  getRawSpecialDate() {
50
50
  const split = this.raw.split('on the PTS on ');
51
- return split.length === 2 ? split[1] : '';
51
+ return split.length === 2 ? split[1].split('.')[0] : '';
52
52
  }
53
53
  /**
54
- * Method for generating the list of correctly formatted dates for case #1
54
+ * Method for generating the list of correctly formatted dates for case #1 (ISO 8601)
55
55
  * @private
56
56
  */
57
57
  formatClassic() {
58
58
  return [
59
- DateFormatter.generateMoment(moment().get('years'), moment().month(this.getRawClassicMouth()).get('months'), this.getRawClassicDay(), this.getRawHour(), this.getRawClassicMinute1()),
60
- DateFormatter.generateMoment(moment().get('years'), moment().month(this.getRawClassicMouth()).get('months'), this.getRawClassicDay(), this.getRawClassicHour2(), this.getRawClassicMinute2()),
59
+ DateFormatter.generateDate(moment().get('years'), moment().month(this.getRawClassicMouth()).get('months'), this.getRawClassicDay(), this.getRawHour(), this.getRawClassicMinute1()),
60
+ DateFormatter.generateDate(moment().get('years'), moment().month(this.getRawClassicMouth()).get('months'), this.getRawClassicDay(), this.getRawClassicHour2(), this.getRawClassicMinute2()),
61
61
  ];
62
62
  }
63
63
  /**
@@ -79,37 +79,47 @@ class DateFormatter {
79
79
  * @private
80
80
  */
81
81
  getRawHour() {
82
- return Number(this.rawDate.split('(')[1].split(':')[0]);
82
+ return Number(this.rawDate
83
+ .split(' UTC')[0]
84
+ .split(' ')
85
+ .pop()
86
+ .split(':')[0]
87
+ .replace('(', ''));
83
88
  }
84
89
  /**
85
90
  * Method for retrieving the minute number of the start time for case #1
86
91
  * @private
87
92
  */
88
93
  getRawClassicMinute1() {
89
- return Number(this.rawDate.split('(')[1].split(':')[1].split(' ')[0]);
94
+ return Number(this.rawDate.split(' UTC')[0].split(':').pop());
90
95
  }
91
96
  /**
92
97
  * Method for retrieving the end hour number in case #1
93
98
  * @private
94
99
  */
95
100
  getRawClassicHour2() {
96
- return Number(this.rawDate.split('(')[2].split(':')[0]);
101
+ return Number(this.rawDate
102
+ .split(' UTC')[1]
103
+ .split(' ')
104
+ .pop()
105
+ .split(':')[0]
106
+ .replace('(', ''));
97
107
  }
98
108
  /**
99
109
  * Method for retrieving the minute number of the end time in case #1
100
110
  * @private
101
111
  */
102
112
  getRawClassicMinute2() {
103
- return Number(this.rawDate.split('(')[2].split(':')[1].split(' ')[0]);
113
+ return Number(this.rawDate.split(' UTC')[1].split(':').pop());
104
114
  }
105
115
  /**
106
- * Method for generating the correctly formatted date in case #2
116
+ * Method for generating the correctly formatted date in case #2 (ISO 8601)
107
117
  * @private
108
118
  */
109
119
  formatSpecial() {
110
120
  const date = this.getSpecialDate();
111
121
  return [
112
- DateFormatter.generateMoment(date.get('years'), date.get('months'), date.get('dates'), this.getRawHour(), this.getRawSpecialMinute()),
122
+ DateFormatter.generateDate(date.get('years'), date.get('months'), date.get('dates'), this.getRawHour(), this.getRawSpecialMinute()),
113
123
  ];
114
124
  }
115
125
  /**
@@ -136,7 +146,7 @@ class DateFormatter {
136
146
  return Number(this.rawDate.split(':')[2].split(' ')[0]);
137
147
  }
138
148
  /**
139
- * Method for formatting a date correctly
149
+ * Method for formatting a date correctly (ISO 8601)
140
150
  * @param year
141
151
  * @param month
142
152
  * @param day
@@ -144,7 +154,7 @@ class DateFormatter {
144
154
  * @param minute
145
155
  * @private
146
156
  */
147
- static generateMoment(year, month, day, hour, minute) {
157
+ static generateDate(year, month, day, hour, minute) {
148
158
  return moment()
149
159
  .utc()
150
160
  .set('years', year)
@@ -154,7 +164,8 @@ class DateFormatter {
154
164
  .set('minutes', minute)
155
165
  .set('seconds', 0)
156
166
  .set('milliseconds', 0)
157
- .utcOffset(0);
167
+ .utcOffset(0)
168
+ .toISOString();
158
169
  }
159
170
  }
160
171
  exports.default = DateFormatter;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const types_1 = require("@eso-status/types");
3
4
  const slug_match_1 = require("./slug.match");
4
5
  /**
5
6
  * Class for identifying the list of slugs contained in an announcement
@@ -15,16 +16,16 @@ class SlugIdentifier {
15
16
  * @private
16
17
  */
17
18
  this.slugList = [
18
- 'server_pc_eu',
19
- 'server_pc_na',
20
- 'server_pc_pts',
21
- 'server_ps_eu',
22
- 'server_ps_na',
23
- 'server_xbox_eu',
24
- 'server_xbox_na',
25
- 'service_store_eso',
26
- 'service_system_account',
27
- 'service_web_site',
19
+ types_1.ServerPcEuSlug,
20
+ types_1.ServerPcNaSlug,
21
+ types_1.ServerPcPtsSlug,
22
+ types_1.ServerPsEuSlug,
23
+ types_1.ServerPsNaSlug,
24
+ types_1.ServerXboxEuSlug,
25
+ types_1.ServerXboxNaSlug,
26
+ types_1.ServiceStoreEsoSlug,
27
+ types_1.ServiceSystemAccountSlug,
28
+ types_1.ServiceWebSiteSlug,
28
29
  ];
29
30
  /**
30
31
  * List of indicators proving that the announcement pertains to the slug server_pc_eu
@@ -53,6 +54,7 @@ class SlugIdentifier {
53
54
  */
54
55
  this.ServerPsEuMatchesList = [
55
56
  'PlayStation®: NA and EU megaservers for',
57
+ 'The PlayStation™ Network',
56
58
  ];
57
59
  /**
58
60
  * List of indicators proving that the announcement pertains to the slug server_ps_na
@@ -60,6 +62,7 @@ class SlugIdentifier {
60
62
  */
61
63
  this.ServerPsNaMatchesList = [
62
64
  'PlayStation®: NA and EU megaservers for',
65
+ 'The PlayStation™ Network',
63
66
  ];
64
67
  /**
65
68
  * List of indicators proving that the announcement pertains to the slug server_xbox_eu
@@ -67,6 +70,7 @@ class SlugIdentifier {
67
70
  */
68
71
  this.ServerXboxEuMatchesList = [
69
72
  'Xbox: NA and EU megaservers for',
73
+ 'Xbox: EU megaserver for',
70
74
  ];
71
75
  /**
72
76
  * List of indicators proving that the announcement pertains to the slug server_xbox_na
@@ -33,6 +33,11 @@ export default class StatusIdentifier {
33
33
  * @private
34
34
  */
35
35
  private readonly plannedMatchesList;
36
+ /**
37
+ * List of indicators proving that the announcement pertains to the status issues
38
+ * @private
39
+ */
40
+ private readonly issuesMatchesList;
36
41
  /**
37
42
  * @param raw Raw data of the announcement
38
43
  */
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const types_1 = require("@eso-status/types");
3
4
  /**
4
5
  * Class for identifying the status contained in an announcement
5
6
  */
@@ -13,7 +14,12 @@ class StatusIdentifier {
13
14
  * List of statuses to check for presence in the announcement
14
15
  * @private
15
16
  */
16
- this.statusList = ['up', 'down', 'planned'];
17
+ this.statusList = [
18
+ types_1.UpStatus,
19
+ types_1.DownStatus,
20
+ types_1.PlannedStatus,
21
+ types_1.IssuesStatus,
22
+ ];
17
23
  /**
18
24
  * List of indicators proving that the announcement pertains to the status up
19
25
  * @private
@@ -22,6 +28,7 @@ class StatusIdentifier {
22
28
  '[COMPLETE]',
23
29
  'now available',
24
30
  'complete',
31
+ 'been resolved',
25
32
  ];
26
33
  /**
27
34
  * List of indicators proving that the announcement pertains to the status down
@@ -39,6 +46,13 @@ class StatusIdentifier {
39
46
  this.plannedMatchesList = [
40
47
  'We will be performing maintenance',
41
48
  ];
49
+ /**
50
+ * List of indicators proving that the announcement pertains to the status issues
51
+ * @private
52
+ */
53
+ this.issuesMatchesList = [
54
+ 'is currently experiencing a service interruption',
55
+ ];
42
56
  this.statusList.forEach((status) => this.identify(status));
43
57
  this.default();
44
58
  }
@@ -77,7 +91,7 @@ class StatusIdentifier {
77
91
  */
78
92
  default() {
79
93
  if (!this.status) {
80
- this.status = 'planned';
94
+ this.status = types_1.PlannedStatus;
81
95
  }
82
96
  }
83
97
  }
package/lib/raw.d.ts CHANGED
@@ -4,8 +4,8 @@ import { EsoStatusRawData } from './interface/esoStatusRawData.interface';
4
4
  * Class containing announcement information
5
5
  */
6
6
  export default class Raw {
7
- private url;
8
- private raw;
7
+ private readonly url;
8
+ private readonly raw;
9
9
  /**
10
10
  * Status identification class
11
11
  * @private
@@ -20,7 +20,7 @@ export default class Raw {
20
20
  * Class for identifying the list of slugs
21
21
  * @private
22
22
  */
23
- private slugsIdentifier;
23
+ private readonly slugsIdentifier;
24
24
  /**
25
25
  * List of information about slugs found in the announcement
26
26
  */
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Different statuses of announcements indicating that the announcement refers to a service/server that is not functioning properly
3
+ */
4
+ export type RemoteIssuesRawStatus = 'is currently experiencing a service interruption';
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=remoteIssuesRawStatus.type.js.map
@@ -5,7 +5,8 @@ import { RemoteServerPsEuRawSlug } from './remoteServerPsEuRawSlug.type';
5
5
  import { RemoteServerXboxEuRawSlug } from './remoteServerXboxEuRawSlug.type';
6
6
  import { RemoteServiceStoreEsoRawSlug } from './remoteServiceStoreEsoRawSlug.type';
7
7
  import { RemoteServiceWebSiteRawSlug } from './remoteServiceWebSiteRawSlug.type';
8
+ import { RemoteServerXboxNaRawSlug } from './remoteServerXboxNaRawSlug.type';
8
9
  /**
9
10
  * Different slugs of announcements
10
11
  */
11
- export type RemoteRawSlug = RemoteServerPcEuRawSlug | RemoteServerPcNaRawSlug | RemoteServerPcPtsRawSlug | RemoteServerPsEuRawSlug | RemoteServerXboxEuRawSlug | RemoteServiceStoreEsoRawSlug | RemoteServiceWebSiteRawSlug;
12
+ export type RemoteRawSlug = RemoteServerPcEuRawSlug | RemoteServerPcNaRawSlug | RemoteServerPcPtsRawSlug | RemoteServerPsEuRawSlug | RemoteServerXboxEuRawSlug | RemoteServerXboxNaRawSlug | RemoteServiceStoreEsoRawSlug | RemoteServiceWebSiteRawSlug;
@@ -1,7 +1,8 @@
1
1
  import { RemoteUpRawStatus } from './remoteUpRawStatus.type';
2
2
  import { RemoteDownRawStatus } from './remoteDownRawStatus.type';
3
3
  import { RemotePlannedRawStatus } from './remotePlannedRawStatus.type';
4
+ import { RemoteIssuesRawStatus } from './remoteIssuesRawStatus.type';
4
5
  /**
5
6
  * Different statuses of announcements
6
7
  */
7
- export type RemoteRawStatus = RemoteUpRawStatus | RemoteDownRawStatus | RemotePlannedRawStatus;
8
+ export type RemoteRawStatus = RemoteUpRawStatus | RemoteDownRawStatus | RemotePlannedRawStatus | RemoteIssuesRawStatus;
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Different slugs of announcements concerning the European PlayStation® Megaserver
3
3
  */
4
- export type RemoteServerPsEuRawSlug = 'PlayStation®: NA and EU megaservers for';
4
+ export type RemoteServerPsEuRawSlug = 'PlayStation®: NA and EU megaservers for' | 'The PlayStation™ Network';
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Different slugs of announcements concerning the North American PlayStation® Megaserver
3
3
  */
4
- export type RemoteServerPsNaRawSlug = 'PlayStation®: NA and EU megaservers for';
4
+ export type RemoteServerPsNaRawSlug = 'PlayStation®: NA and EU megaservers for' | 'The PlayStation™ Network';
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Different slugs of announcements concerning the European Xbox Megaserver
3
3
  */
4
- export type RemoteServerXboxEuRawSlug = 'Xbox: NA and EU megaservers for';
4
+ export type RemoteServerXboxEuRawSlug = 'Xbox: NA and EU megaservers for' | 'Xbox: EU megaserver for';
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Different statuses of announcements indicating that the announcement refers to an accessible service/server
3
3
  */
4
- export type RemoteUpRawStatus = '[COMPLETE]' | 'now available' | 'complete';
4
+ export type RemoteUpRawStatus = '[COMPLETE]' | 'now available' | 'complete' | 'been resolved';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eso-status/forum-message",
3
- "version": "2.0.0-dev.0",
3
+ "version": "2.0.0-dev.10",
4
4
  "description": "Library for retrieving and formatting data, available at https://forums.elderscrollsonline.com or https://forums.elderscrollsonline.com/en/categories/pts",
5
5
  "author": "@dov118 <contact@dov118.dev> (https://dov118.dev)",
6
6
  "main": "lib/index.js",
@@ -19,6 +19,8 @@
19
19
  "lib/type/messageType.type.js",
20
20
  "lib/type/remoteDownRawStatus.type.d.ts",
21
21
  "lib/type/remoteDownRawStatus.type.js",
22
+ "lib/type/remoteIssuesRawStatus.type.d.ts",
23
+ "lib/type/remoteIssuesRawStatus.type.js",
22
24
  "lib/type/remotePlannedRawStatus.type.d.ts",
23
25
  "lib/type/remotePlannedRawStatus.type.js",
24
26
  "lib/type/remoteRawSlug.type.d.ts",
@@ -63,7 +65,7 @@
63
65
  "README.md"
64
66
  ],
65
67
  "engines": {
66
- "node": ">=16.10.0 || >=18.12.0 || >=20.0.0"
68
+ "node": "^18.18.0 || ^20.0.0"
67
69
  },
68
70
  "bugs": {
69
71
  "url": "https://github.com/eso-status/forum-message/issues"
@@ -86,23 +88,23 @@
86
88
  "prepare": "husky"
87
89
  },
88
90
  "dependencies": {
89
- "@eso-status/types": "2.0.0-dev.4",
91
+ "@eso-status/types": "2.0.0-dev.13",
90
92
  "axios": "1.7.7",
91
93
  "moment": "2.30.1"
92
94
  },
93
95
  "devDependencies": {
94
- "@types/jest": "29.5.12",
95
- "eslint": "8.57.0",
96
+ "@types/jest": "29.5.13",
97
+ "eslint": "8.57.1",
96
98
  "eslint-config-airbnb-base": "15.0.0",
97
99
  "eslint-config-airbnb-typescript": "18.0.0",
98
100
  "eslint-config-prettier": "9.1.0",
99
101
  "eslint-plugin-jest": "28.8.3",
100
102
  "eslint-plugin-prettier": "5.2.1",
101
- "eslint-plugin-sonarjs": "2.0.2",
102
- "eslint-plugin-unused-imports": "4.1.3",
103
- "husky": "9.1.5",
103
+ "eslint-plugin-sonarjs": "2.0.3",
104
+ "eslint-plugin-unused-imports": "4.1.4",
105
+ "husky": "9.1.6",
104
106
  "jest": "29.7.0",
105
- "nodemon": "3.1.4",
107
+ "nodemon": "3.1.7",
106
108
  "prettier": "3.3.3",
107
109
  "ts-jest": "29.2.5",
108
110
  "typescript": "5.5.4"