@eso-status/forum-message 1.0.13 → 2.0.0-dev.1
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/LICENSE.md +1 -1
- package/README.md +101 -94
- package/lib/connector.d.ts +68 -0
- package/lib/connector.js +122 -0
- package/lib/const.d.ts +9 -0
- package/lib/const.js +12 -0
- package/lib/formatter/date.formatter.d.ts +97 -0
- package/lib/formatter/date.formatter.js +161 -0
- package/lib/identifier/slug.identifier.d.ts +94 -0
- package/lib/identifier/slug.identifier.js +140 -0
- package/lib/identifier/slug.match.d.ts +26 -0
- package/lib/identifier/slug.match.js +35 -0
- package/lib/identifier/status.identifier.d.ts +63 -0
- package/lib/identifier/status.identifier.js +86 -0
- package/lib/index.d.ts +11 -13
- package/lib/index.js +14 -72
- package/lib/raw.d.ts +42 -0
- package/lib/raw.js +58 -0
- package/lib/type/messageType.type.d.ts +4 -0
- package/lib/type/messageType.type.js +3 -0
- package/lib/type/remoteDownRawStatus.type.d.ts +4 -0
- package/lib/type/remoteDownRawStatus.type.js +3 -0
- package/lib/type/remotePlannedRawStatus.type.d.ts +4 -0
- package/lib/type/remotePlannedRawStatus.type.js +3 -0
- package/lib/type/remoteRawSlug.type.d.ts +11 -0
- package/lib/type/remoteRawSlug.type.js +3 -0
- package/lib/type/remoteRawStatus.type.d.ts +7 -0
- package/lib/type/remoteRawStatus.type.js +3 -0
- package/lib/type/remoteServerPcEuRawSlug.type.d.ts +4 -0
- package/lib/type/remoteServerPcEuRawSlug.type.js +3 -0
- package/lib/type/remoteServerPcNaRawSlug.type.d.ts +4 -0
- package/lib/type/remoteServerPcNaRawSlug.type.js +3 -0
- package/lib/type/remoteServerPcPtsRawSlug.type.d.ts +4 -0
- package/lib/type/remoteServerPcPtsRawSlug.type.js +3 -0
- package/lib/type/remoteServerPsEuRawSlug.type.d.ts +4 -0
- package/lib/type/remoteServerPsEuRawSlug.type.js +3 -0
- package/lib/type/remoteServerPsNaRawSlug.type.d.ts +4 -0
- package/lib/type/remoteServerPsNaRawSlug.type.js +3 -0
- package/lib/type/remoteServerXboxEuRawSlug.type.d.ts +4 -0
- package/lib/type/remoteServerXboxEuRawSlug.type.js +3 -0
- package/lib/type/remoteServerXboxNaRawSlug.type.d.ts +4 -0
- package/lib/type/remoteServerXboxNaRawSlug.type.js +3 -0
- package/lib/type/remoteServiceStoreEsoRawSlug.type.d.ts +4 -0
- package/lib/type/remoteServiceStoreEsoRawSlug.type.js +3 -0
- package/lib/type/remoteServiceSystemAccountRawSlug.type.d.ts +4 -0
- package/lib/type/remoteServiceSystemAccountRawSlug.type.js +3 -0
- package/lib/type/remoteServiceWebSiteRawSlug.type.d.ts +4 -0
- package/lib/type/remoteServiceWebSiteRawSlug.type.js +3 -0
- package/lib/type/remoteUpRawStatus.type.d.ts +4 -0
- package/lib/type/remoteUpRawStatus.type.js +3 -0
- package/lib/type/sourceUrl.type.d.ts +4 -0
- package/lib/type/sourceUrl.type.js +3 -0
- package/package.json +110 -37
- package/lib/classes/ForumMessageElement.d.ts +0 -110
- package/lib/classes/ForumMessageElement.js +0 -386
- package/lib/connectors/ForumMessageConnector.d.ts +0 -127
- package/lib/connectors/ForumMessageConnector.js +0 -311
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const moment = require("moment");
|
|
4
|
+
/**
|
|
5
|
+
* Class for identifying and formatting the date contained in an announcement
|
|
6
|
+
*/
|
|
7
|
+
class DateFormatter {
|
|
8
|
+
/**
|
|
9
|
+
* @param raw Raw data of the announcement
|
|
10
|
+
*/
|
|
11
|
+
constructor(raw) {
|
|
12
|
+
this.raw = raw;
|
|
13
|
+
this.checkFormat();
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Method for retrieving the raw date and the list of dates present in the announcement based on its format
|
|
17
|
+
* Case #1: The announcement contains a date with a start and end time (hour/minute)
|
|
18
|
+
* Case #2: The announcement contains the name of the next maintenance day with a start time (hour/minute)
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
21
|
+
checkFormat() {
|
|
22
|
+
let rawDate = this.getRawClassicDate();
|
|
23
|
+
if (rawDate !== '') {
|
|
24
|
+
this.rawDate = rawDate;
|
|
25
|
+
this.dates = this.formatClassic();
|
|
26
|
+
}
|
|
27
|
+
rawDate = this.getRawSpecialDate();
|
|
28
|
+
if (rawDate !== '') {
|
|
29
|
+
this.rawDate = rawDate;
|
|
30
|
+
this.dates = this.formatSpecial();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Method for retrieving the raw date in case #1
|
|
35
|
+
* @private
|
|
36
|
+
*/
|
|
37
|
+
getRawClassicDate() {
|
|
38
|
+
const split = this.raw.split(' – ');
|
|
39
|
+
if (split.length > 2) {
|
|
40
|
+
split.shift();
|
|
41
|
+
return split.join(' – ');
|
|
42
|
+
}
|
|
43
|
+
return split.length === 2 ? split[1] : '';
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Method for retrieving the raw date in case #2
|
|
47
|
+
* @private
|
|
48
|
+
*/
|
|
49
|
+
getRawSpecialDate() {
|
|
50
|
+
const split = this.raw.split('on the PTS on ');
|
|
51
|
+
return split.length === 2 ? split[1] : '';
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Method for generating the list of correctly formatted dates for case #1
|
|
55
|
+
* @private
|
|
56
|
+
*/
|
|
57
|
+
formatClassic() {
|
|
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()),
|
|
61
|
+
];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Method for retrieving the month number for case #1
|
|
65
|
+
* @private
|
|
66
|
+
*/
|
|
67
|
+
getRawClassicMouth() {
|
|
68
|
+
return this.rawDate.split(' ')[0];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Method for retrieving the day number for case #1
|
|
72
|
+
* @private
|
|
73
|
+
*/
|
|
74
|
+
getRawClassicDay() {
|
|
75
|
+
return Number(this.rawDate.split(' ')[1].replace(',', ''));
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Method for retrieving the hour number from a raw date
|
|
79
|
+
* @private
|
|
80
|
+
*/
|
|
81
|
+
getRawHour() {
|
|
82
|
+
return Number(this.rawDate.split('(')[1].split(':')[0]);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Method for retrieving the minute number of the start time for case #1
|
|
86
|
+
* @private
|
|
87
|
+
*/
|
|
88
|
+
getRawClassicMinute1() {
|
|
89
|
+
return Number(this.rawDate.split('(')[1].split(':')[1].split(' ')[0]);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Method for retrieving the end hour number in case #1
|
|
93
|
+
* @private
|
|
94
|
+
*/
|
|
95
|
+
getRawClassicHour2() {
|
|
96
|
+
return Number(this.rawDate.split('(')[2].split(':')[0]);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Method for retrieving the minute number of the end time in case #1
|
|
100
|
+
* @private
|
|
101
|
+
*/
|
|
102
|
+
getRawClassicMinute2() {
|
|
103
|
+
return Number(this.rawDate.split('(')[2].split(':')[1].split(' ')[0]);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Method for generating the correctly formatted date in case #2
|
|
107
|
+
* @private
|
|
108
|
+
*/
|
|
109
|
+
formatSpecial() {
|
|
110
|
+
const date = this.getSpecialDate();
|
|
111
|
+
return [
|
|
112
|
+
DateFormatter.generateMoment(date.get('years'), date.get('months'), date.get('dates'), this.getRawHour(), this.getRawSpecialMinute()),
|
|
113
|
+
];
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Method for retrieving the maintenance date in case #2
|
|
117
|
+
* Case #2 does not provide the month or day (i.e., no day number), only the name of the day (Monday, Tuesday, etc.). Therefore, you need to check if the day has already passed in the current week to determine whether to add a week to the maintenance date.
|
|
118
|
+
* @private
|
|
119
|
+
*/
|
|
120
|
+
getSpecialDate() {
|
|
121
|
+
const current = moment();
|
|
122
|
+
const targetDayIndex = moment()
|
|
123
|
+
.days(this.rawDate.split(' ')[0])
|
|
124
|
+
.get('days');
|
|
125
|
+
current.set('days', targetDayIndex);
|
|
126
|
+
if (moment().get('days') > targetDayIndex) {
|
|
127
|
+
current.add(1, 'week');
|
|
128
|
+
}
|
|
129
|
+
return current;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Method for retrieving the minute number of the time in case #2
|
|
133
|
+
* @private
|
|
134
|
+
*/
|
|
135
|
+
getRawSpecialMinute() {
|
|
136
|
+
return Number(this.rawDate.split(':')[2].split(' ')[0]);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Method for formatting a date correctly
|
|
140
|
+
* @param year
|
|
141
|
+
* @param month
|
|
142
|
+
* @param day
|
|
143
|
+
* @param hour
|
|
144
|
+
* @param minute
|
|
145
|
+
* @private
|
|
146
|
+
*/
|
|
147
|
+
static generateMoment(year, month, day, hour, minute) {
|
|
148
|
+
return moment()
|
|
149
|
+
.utc()
|
|
150
|
+
.set('years', year)
|
|
151
|
+
.set('months', month)
|
|
152
|
+
.set('date', day)
|
|
153
|
+
.set('hours', hour)
|
|
154
|
+
.set('minutes', minute)
|
|
155
|
+
.set('seconds', 0)
|
|
156
|
+
.set('milliseconds', 0)
|
|
157
|
+
.utcOffset(0);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
exports.default = DateFormatter;
|
|
161
|
+
//# sourceMappingURL=date.formatter.js.map
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import SlugMatch from './slug.match';
|
|
2
|
+
/**
|
|
3
|
+
* Class for identifying the list of slugs contained in an announcement
|
|
4
|
+
*/
|
|
5
|
+
export default class SlugIdentifier {
|
|
6
|
+
private readonly raw;
|
|
7
|
+
/**
|
|
8
|
+
* List of slug information found in the announcement
|
|
9
|
+
*/
|
|
10
|
+
slugMatches: SlugMatch[];
|
|
11
|
+
/**
|
|
12
|
+
* List of slugs to check for presence in the announcement
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
private readonly slugList;
|
|
16
|
+
/**
|
|
17
|
+
* List of indicators proving that the announcement pertains to the slug server_pc_eu
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
private readonly ServerPcEuMatchesList;
|
|
21
|
+
/**
|
|
22
|
+
* List of indicators proving that the announcement pertains to the slug server_pc_na
|
|
23
|
+
* @private
|
|
24
|
+
*/
|
|
25
|
+
private readonly ServerPcNaMatchesList;
|
|
26
|
+
/**
|
|
27
|
+
* List of indicators proving that the announcement pertains to the slug server_pc_pts
|
|
28
|
+
* @private
|
|
29
|
+
*/
|
|
30
|
+
private readonly ServerPcPtsMatchesList;
|
|
31
|
+
/**
|
|
32
|
+
* List of indicators proving that the announcement pertains to the slug server_ps_eu
|
|
33
|
+
* @private
|
|
34
|
+
*/
|
|
35
|
+
private readonly ServerPsEuMatchesList;
|
|
36
|
+
/**
|
|
37
|
+
* List of indicators proving that the announcement pertains to the slug server_ps_na
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
40
|
+
private readonly ServerPsNaMatchesList;
|
|
41
|
+
/**
|
|
42
|
+
* List of indicators proving that the announcement pertains to the slug server_xbox_eu
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
private readonly ServerXboxEuMatchesList;
|
|
46
|
+
/**
|
|
47
|
+
* List of indicators proving that the announcement pertains to the slug server_xbox_na
|
|
48
|
+
* @private
|
|
49
|
+
*/
|
|
50
|
+
private readonly ServerXboxNaMatchesList;
|
|
51
|
+
/**
|
|
52
|
+
* List of indicators proving that the announcement pertains to the slug service_store_eso
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
55
|
+
private readonly ServiceStoreEsoMatchesList;
|
|
56
|
+
/**
|
|
57
|
+
* List of indicators proving that the announcement pertains to the slug service_system_account
|
|
58
|
+
* @private
|
|
59
|
+
*/
|
|
60
|
+
private readonly ServiceSystemAccountMatchesList;
|
|
61
|
+
/**
|
|
62
|
+
* List of indicators proving that the announcement pertains to the slug service_web_site
|
|
63
|
+
* @private
|
|
64
|
+
*/
|
|
65
|
+
private readonly ServiceWebSiteMatchesList;
|
|
66
|
+
/**
|
|
67
|
+
* @param raw Raw data of the announcement
|
|
68
|
+
*/
|
|
69
|
+
constructor(raw: string);
|
|
70
|
+
/**
|
|
71
|
+
* Method for retrieving the list of indicators for a slug to test
|
|
72
|
+
* @param slug Slug to test
|
|
73
|
+
* @private
|
|
74
|
+
*/
|
|
75
|
+
private getMatchList;
|
|
76
|
+
/**
|
|
77
|
+
* Method for retrieving the name of the list of indicators for a slug to test
|
|
78
|
+
* @param slug Slug to test
|
|
79
|
+
* @private
|
|
80
|
+
*/
|
|
81
|
+
private static getMatchListName;
|
|
82
|
+
/**
|
|
83
|
+
* Method for retrieving the indicators of a slug present in the announcement
|
|
84
|
+
* @param slug Slug to test
|
|
85
|
+
* @private
|
|
86
|
+
*/
|
|
87
|
+
private getMatches;
|
|
88
|
+
/**
|
|
89
|
+
* Method for testing if the announcement contains indicators of a given slug
|
|
90
|
+
* @param slug Slug to test
|
|
91
|
+
* @private
|
|
92
|
+
*/
|
|
93
|
+
private identify;
|
|
94
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const types_1 = require("@eso-status/types");
|
|
4
|
+
const slug_match_1 = require("./slug.match");
|
|
5
|
+
/**
|
|
6
|
+
* Class for identifying the list of slugs contained in an announcement
|
|
7
|
+
*/
|
|
8
|
+
class SlugIdentifier {
|
|
9
|
+
/**
|
|
10
|
+
* @param raw Raw data of the announcement
|
|
11
|
+
*/
|
|
12
|
+
constructor(raw) {
|
|
13
|
+
this.raw = raw;
|
|
14
|
+
/**
|
|
15
|
+
* List of slugs to check for presence in the announcement
|
|
16
|
+
* @private
|
|
17
|
+
*/
|
|
18
|
+
this.slugList = [
|
|
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,
|
|
29
|
+
];
|
|
30
|
+
/**
|
|
31
|
+
* List of indicators proving that the announcement pertains to the slug server_pc_eu
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
this.ServerPcEuMatchesList = [
|
|
35
|
+
'PC/Mac: EU megaserver for',
|
|
36
|
+
'PC/Mac: NA and EU megaservers for',
|
|
37
|
+
];
|
|
38
|
+
/**
|
|
39
|
+
* List of indicators proving that the announcement pertains to the slug server_pc_na
|
|
40
|
+
* @private
|
|
41
|
+
*/
|
|
42
|
+
this.ServerPcNaMatchesList = [
|
|
43
|
+
'PC/Mac: NA megaserver for',
|
|
44
|
+
'PC/Mac: NA and EU megaservers for',
|
|
45
|
+
];
|
|
46
|
+
/**
|
|
47
|
+
* List of indicators proving that the announcement pertains to the slug server_pc_pts
|
|
48
|
+
* @private
|
|
49
|
+
*/
|
|
50
|
+
this.ServerPcPtsMatchesList = ['PTS'];
|
|
51
|
+
/**
|
|
52
|
+
* List of indicators proving that the announcement pertains to the slug server_ps_eu
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
55
|
+
this.ServerPsEuMatchesList = [
|
|
56
|
+
'PlayStation®: NA and EU megaservers for',
|
|
57
|
+
];
|
|
58
|
+
/**
|
|
59
|
+
* List of indicators proving that the announcement pertains to the slug server_ps_na
|
|
60
|
+
* @private
|
|
61
|
+
*/
|
|
62
|
+
this.ServerPsNaMatchesList = [
|
|
63
|
+
'PlayStation®: NA and EU megaservers for',
|
|
64
|
+
];
|
|
65
|
+
/**
|
|
66
|
+
* List of indicators proving that the announcement pertains to the slug server_xbox_eu
|
|
67
|
+
* @private
|
|
68
|
+
*/
|
|
69
|
+
this.ServerXboxEuMatchesList = [
|
|
70
|
+
'Xbox: NA and EU megaservers for',
|
|
71
|
+
];
|
|
72
|
+
/**
|
|
73
|
+
* List of indicators proving that the announcement pertains to the slug server_xbox_na
|
|
74
|
+
* @private
|
|
75
|
+
*/
|
|
76
|
+
this.ServerXboxNaMatchesList = [
|
|
77
|
+
'Xbox: NA and EU megaservers for',
|
|
78
|
+
];
|
|
79
|
+
/**
|
|
80
|
+
* List of indicators proving that the announcement pertains to the slug service_store_eso
|
|
81
|
+
* @private
|
|
82
|
+
*/
|
|
83
|
+
this.ServiceStoreEsoMatchesList = ['ESO Store and Account System for'];
|
|
84
|
+
/**
|
|
85
|
+
* List of indicators proving that the announcement pertains to the slug service_system_account
|
|
86
|
+
* @private
|
|
87
|
+
*/
|
|
88
|
+
this.ServiceSystemAccountMatchesList = ['ESO Store and Account System for'];
|
|
89
|
+
/**
|
|
90
|
+
* List of indicators proving that the announcement pertains to the slug service_web_site
|
|
91
|
+
* @private
|
|
92
|
+
*/
|
|
93
|
+
this.ServiceWebSiteMatchesList = [
|
|
94
|
+
'ESO Website for',
|
|
95
|
+
];
|
|
96
|
+
this.slugMatches = [];
|
|
97
|
+
this.slugList.forEach((slug) => this.identify(slug));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Method for retrieving the list of indicators for a slug to test
|
|
101
|
+
* @param slug Slug to test
|
|
102
|
+
* @private
|
|
103
|
+
*/
|
|
104
|
+
getMatchList(slug) {
|
|
105
|
+
return this[SlugIdentifier.getMatchListName(slug)];
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Method for retrieving the name of the list of indicators for a slug to test
|
|
109
|
+
* @param slug Slug to test
|
|
110
|
+
* @private
|
|
111
|
+
*/
|
|
112
|
+
static getMatchListName(slug) {
|
|
113
|
+
return `${slug
|
|
114
|
+
.split('_')
|
|
115
|
+
.map((item) => item.charAt(0).toUpperCase() + item.slice(1))
|
|
116
|
+
.join('')}MatchesList`;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Method for retrieving the indicators of a slug present in the announcement
|
|
120
|
+
* @param slug Slug to test
|
|
121
|
+
* @private
|
|
122
|
+
*/
|
|
123
|
+
getMatches(slug) {
|
|
124
|
+
return this.getMatchList(slug).filter((identifier) => this.raw.includes(identifier));
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Method for testing if the announcement contains indicators of a given slug
|
|
128
|
+
* @param slug Slug to test
|
|
129
|
+
* @private
|
|
130
|
+
*/
|
|
131
|
+
identify(slug) {
|
|
132
|
+
const matches = this.getMatches(slug);
|
|
133
|
+
if (!matches.length) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
this.slugMatches.push(new slug_match_1.default(matches[0], slug));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
exports.default = SlugIdentifier;
|
|
140
|
+
//# sourceMappingURL=slug.identifier.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Slug, Support, Type, Zone } from '@eso-status/types';
|
|
2
|
+
import { RemoteRawSlug } from '../type/remoteRawSlug.type';
|
|
3
|
+
/**
|
|
4
|
+
* Class for retrieving information about a slug found in an announcement
|
|
5
|
+
*/
|
|
6
|
+
export default class SlugMatch {
|
|
7
|
+
readonly rawSlug: RemoteRawSlug;
|
|
8
|
+
readonly slug: Slug;
|
|
9
|
+
/**
|
|
10
|
+
* @param rawSlug Data used to identify the presence of the slug in the announcement
|
|
11
|
+
* @param slug Slug found in the announcement
|
|
12
|
+
*/
|
|
13
|
+
constructor(rawSlug: RemoteRawSlug, slug: Slug);
|
|
14
|
+
/**
|
|
15
|
+
* Method for retrieving the type of the slug
|
|
16
|
+
*/
|
|
17
|
+
getType(): Type;
|
|
18
|
+
/**
|
|
19
|
+
* Method for retrieving the support of the slug
|
|
20
|
+
*/
|
|
21
|
+
getSupport(): Support;
|
|
22
|
+
/**
|
|
23
|
+
* Method for retrieving the area of the slug
|
|
24
|
+
*/
|
|
25
|
+
getZone(): Zone;
|
|
26
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Class for retrieving information about a slug found in an announcement
|
|
5
|
+
*/
|
|
6
|
+
class SlugMatch {
|
|
7
|
+
/**
|
|
8
|
+
* @param rawSlug Data used to identify the presence of the slug in the announcement
|
|
9
|
+
* @param slug Slug found in the announcement
|
|
10
|
+
*/
|
|
11
|
+
constructor(rawSlug, slug) {
|
|
12
|
+
this.rawSlug = rawSlug;
|
|
13
|
+
this.slug = slug;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Method for retrieving the type of the slug
|
|
17
|
+
*/
|
|
18
|
+
getType() {
|
|
19
|
+
return this.slug.split('_')[0];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Method for retrieving the support of the slug
|
|
23
|
+
*/
|
|
24
|
+
getSupport() {
|
|
25
|
+
return this.slug.split('_')[1];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Method for retrieving the area of the slug
|
|
29
|
+
*/
|
|
30
|
+
getZone() {
|
|
31
|
+
return this.slug.split('_')[2];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.default = SlugMatch;
|
|
35
|
+
//# sourceMappingURL=slug.match.js.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Status } from '@eso-status/types';
|
|
2
|
+
import { RemoteRawStatus } from '../type/remoteRawStatus.type';
|
|
3
|
+
/**
|
|
4
|
+
* Class for identifying the status contained in an announcement
|
|
5
|
+
*/
|
|
6
|
+
export default class StatusIdentifier {
|
|
7
|
+
private readonly raw;
|
|
8
|
+
/**
|
|
9
|
+
* Data used to identify the presence of the status in the announcement
|
|
10
|
+
*/
|
|
11
|
+
rawStatus: RemoteRawStatus;
|
|
12
|
+
/**
|
|
13
|
+
* Status found in the announcement
|
|
14
|
+
*/
|
|
15
|
+
status: Status;
|
|
16
|
+
/**
|
|
17
|
+
* List of statuses to check for presence in the announcement
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
private readonly statusList;
|
|
21
|
+
/**
|
|
22
|
+
* List of indicators proving that the announcement pertains to the status up
|
|
23
|
+
* @private
|
|
24
|
+
*/
|
|
25
|
+
private readonly upMatchesList;
|
|
26
|
+
/**
|
|
27
|
+
* List of indicators proving that the announcement pertains to the status down
|
|
28
|
+
* @private
|
|
29
|
+
*/
|
|
30
|
+
private readonly downMatchesList;
|
|
31
|
+
/**
|
|
32
|
+
* List of indicators proving that the announcement pertains to the status planned
|
|
33
|
+
* @private
|
|
34
|
+
*/
|
|
35
|
+
private readonly plannedMatchesList;
|
|
36
|
+
/**
|
|
37
|
+
* @param raw Raw data of the announcement
|
|
38
|
+
*/
|
|
39
|
+
constructor(raw: string);
|
|
40
|
+
/**
|
|
41
|
+
* Method for retrieving the list of indicators for a status to test
|
|
42
|
+
* @param status Status to test
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
private getMatchList;
|
|
46
|
+
/**
|
|
47
|
+
* Method for retrieving the indicators of a status present in the announcement
|
|
48
|
+
* @param status Status to test
|
|
49
|
+
* @private
|
|
50
|
+
*/
|
|
51
|
+
private getMatches;
|
|
52
|
+
/**
|
|
53
|
+
* Method for testing if the announcement contains indicators of a given status
|
|
54
|
+
* @param status Status to test
|
|
55
|
+
* @private
|
|
56
|
+
*/
|
|
57
|
+
private identify;
|
|
58
|
+
/**
|
|
59
|
+
* Method for setting the default status to planned in the absence of indicators for other statuses
|
|
60
|
+
* @private
|
|
61
|
+
*/
|
|
62
|
+
private default;
|
|
63
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const types_1 = require("@eso-status/types");
|
|
4
|
+
/**
|
|
5
|
+
* Class for identifying the status contained in an announcement
|
|
6
|
+
*/
|
|
7
|
+
class StatusIdentifier {
|
|
8
|
+
/**
|
|
9
|
+
* @param raw Raw data of the announcement
|
|
10
|
+
*/
|
|
11
|
+
constructor(raw) {
|
|
12
|
+
this.raw = raw;
|
|
13
|
+
/**
|
|
14
|
+
* List of statuses to check for presence in the announcement
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
this.statusList = [types_1.UpStatus, types_1.DownStatus, types_1.PlannedStatus];
|
|
18
|
+
/**
|
|
19
|
+
* List of indicators proving that the announcement pertains to the status up
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
this.upMatchesList = [
|
|
23
|
+
'[COMPLETE]',
|
|
24
|
+
'now available',
|
|
25
|
+
'complete',
|
|
26
|
+
];
|
|
27
|
+
/**
|
|
28
|
+
* List of indicators proving that the announcement pertains to the status down
|
|
29
|
+
* @private
|
|
30
|
+
*/
|
|
31
|
+
this.downMatchesList = [
|
|
32
|
+
'[EXTENDED]',
|
|
33
|
+
'[IN PROGRESS]',
|
|
34
|
+
'unavailable',
|
|
35
|
+
];
|
|
36
|
+
/**
|
|
37
|
+
* List of indicators proving that the announcement pertains to the status planned
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
40
|
+
this.plannedMatchesList = [
|
|
41
|
+
'We will be performing maintenance',
|
|
42
|
+
];
|
|
43
|
+
this.statusList.forEach((status) => this.identify(status));
|
|
44
|
+
this.default();
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Method for retrieving the list of indicators for a status to test
|
|
48
|
+
* @param status Status to test
|
|
49
|
+
* @private
|
|
50
|
+
*/
|
|
51
|
+
getMatchList(status) {
|
|
52
|
+
return this[`${status}MatchesList`];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Method for retrieving the indicators of a status present in the announcement
|
|
56
|
+
* @param status Status to test
|
|
57
|
+
* @private
|
|
58
|
+
*/
|
|
59
|
+
getMatches(status) {
|
|
60
|
+
return this.getMatchList(status).filter((identifier) => this.raw.includes(identifier));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Method for testing if the announcement contains indicators of a given status
|
|
64
|
+
* @param status Status to test
|
|
65
|
+
* @private
|
|
66
|
+
*/
|
|
67
|
+
identify(status) {
|
|
68
|
+
const matches = this.getMatches(status);
|
|
69
|
+
if (!matches.length) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
this.rawStatus = matches.shift();
|
|
73
|
+
this.status = status;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Method for setting the default status to planned in the absence of indicators for other statuses
|
|
77
|
+
* @private
|
|
78
|
+
*/
|
|
79
|
+
default() {
|
|
80
|
+
if (!this.status) {
|
|
81
|
+
this.status = types_1.PlannedStatus;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.default = StatusIdentifier;
|
|
86
|
+
//# sourceMappingURL=status.identifier.js.map
|
package/lib/index.d.ts
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const ForumMessagePTSURL = "https://forums.elderscrollsonline.com/en/categories/pts";
|
|
1
|
+
import { EsoStatusRawData } from '@eso-status/types';
|
|
2
|
+
import { SourceUrl } from './type/sourceUrl.type';
|
|
4
3
|
/**
|
|
5
|
-
* Class
|
|
4
|
+
* Class for retrieving announcement information
|
|
6
5
|
*/
|
|
7
|
-
export
|
|
6
|
+
export default class ForumMessage {
|
|
8
7
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
static getData(url?: string): Promise<RawEsoStatus[]>;
|
|
8
|
+
* Method for retrieving announcement information
|
|
9
|
+
*/
|
|
10
|
+
static getData(): Promise<EsoStatusRawData[]>;
|
|
11
|
+
/**
|
|
12
|
+
* Method for retrieving announcement information from a specific URL
|
|
13
|
+
*/
|
|
14
|
+
static getData(url: SourceUrl): Promise<EsoStatusRawData[]>;
|
|
17
15
|
}
|