@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
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { Moment } from 'moment';
|
|
2
|
-
import { Support, Slug, Status, Type, Zone } from '@eso-status/types';
|
|
3
|
-
/**
|
|
4
|
-
* Class with methode for ForumMessage element
|
|
5
|
-
*/
|
|
6
|
-
export default class ForumMessageElement {
|
|
7
|
-
/**
|
|
8
|
-
* Methode used to get slugs list of raw content
|
|
9
|
-
*
|
|
10
|
-
* @public
|
|
11
|
-
* @static
|
|
12
|
-
*
|
|
13
|
-
* @param rawData string Raw data
|
|
14
|
-
* @return Slug[] List of slug
|
|
15
|
-
*/
|
|
16
|
-
static getSlug(rawData: string): Slug[];
|
|
17
|
-
/**
|
|
18
|
-
* Methode used to determinate service type
|
|
19
|
-
*
|
|
20
|
-
* @public
|
|
21
|
-
* @static
|
|
22
|
-
*
|
|
23
|
-
* @param type Type Type to check
|
|
24
|
-
* @param rawData string Raw data
|
|
25
|
-
* @return boolean Check result
|
|
26
|
-
*/
|
|
27
|
-
static isType(type: Type, rawData: string): boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Methode used to determinate service support
|
|
30
|
-
*
|
|
31
|
-
* @public
|
|
32
|
-
* @static
|
|
33
|
-
*
|
|
34
|
-
* @param support Support Support to check
|
|
35
|
-
* @param rawData string Raw data
|
|
36
|
-
* @return boolean Check result
|
|
37
|
-
*/
|
|
38
|
-
static isSupport(support: Support, rawData: string): boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Methode used to determinate service zone
|
|
41
|
-
*
|
|
42
|
-
* @public
|
|
43
|
-
* @static
|
|
44
|
-
*
|
|
45
|
-
* @param zone Zone Zone to check
|
|
46
|
-
* @param rawData string Raw data
|
|
47
|
-
* @return boolean Check result
|
|
48
|
-
*/
|
|
49
|
-
static isZone(zone: Zone, rawData: string): boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Methode used to get dates of raw date
|
|
52
|
-
*
|
|
53
|
-
* @public
|
|
54
|
-
* @static
|
|
55
|
-
*
|
|
56
|
-
* @param rawDate string Raw date
|
|
57
|
-
* @return Moment[] Dates of raw data
|
|
58
|
-
*/
|
|
59
|
-
static getDate(rawDate: string): Moment[];
|
|
60
|
-
/**
|
|
61
|
-
* Methode used to get type of slug
|
|
62
|
-
*
|
|
63
|
-
* @public
|
|
64
|
-
* @static
|
|
65
|
-
*
|
|
66
|
-
* @param slug Slug Slug
|
|
67
|
-
* @return Type Type of slug
|
|
68
|
-
*/
|
|
69
|
-
static getType(slug: Slug): Type;
|
|
70
|
-
/**
|
|
71
|
-
* Methode used to get support of slug
|
|
72
|
-
*
|
|
73
|
-
* @public
|
|
74
|
-
* @static
|
|
75
|
-
*
|
|
76
|
-
* @param slug Slug Slug
|
|
77
|
-
* @return Support Support of slug
|
|
78
|
-
*/
|
|
79
|
-
static getSupport(slug: Slug): Support;
|
|
80
|
-
/**
|
|
81
|
-
* Methode used to get zone of slug
|
|
82
|
-
*
|
|
83
|
-
* @public
|
|
84
|
-
* @static
|
|
85
|
-
*
|
|
86
|
-
* @param slug Slug Slug
|
|
87
|
-
* @return Zone Zone of slug
|
|
88
|
-
*/
|
|
89
|
-
static getZone(slug: Slug): Zone;
|
|
90
|
-
/**
|
|
91
|
-
* Methode used to get status of raw data
|
|
92
|
-
*
|
|
93
|
-
* @public
|
|
94
|
-
* @static
|
|
95
|
-
*
|
|
96
|
-
* @param rawData string Raw data
|
|
97
|
-
* @return Status Status of raw data
|
|
98
|
-
*/
|
|
99
|
-
static getStatus(rawData: string): Status;
|
|
100
|
-
/**
|
|
101
|
-
* Methode used to get raw date of raw data
|
|
102
|
-
*
|
|
103
|
-
* @public
|
|
104
|
-
* @static
|
|
105
|
-
*
|
|
106
|
-
* @param raw string Raw data
|
|
107
|
-
* @return string Raw date
|
|
108
|
-
*/
|
|
109
|
-
static getRawDate(raw: string): string;
|
|
110
|
-
}
|
|
@@ -1,386 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var moment = require("moment");
|
|
4
|
-
/**
|
|
5
|
-
* Class with methode for ForumMessage element
|
|
6
|
-
*/
|
|
7
|
-
var ForumMessageElement = /** @class */ (function () {
|
|
8
|
-
function ForumMessageElement() {
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Methode used to get slugs list of raw content
|
|
12
|
-
*
|
|
13
|
-
* @public
|
|
14
|
-
* @static
|
|
15
|
-
*
|
|
16
|
-
* @param rawData string Raw data
|
|
17
|
-
* @return Slug[] List of slug
|
|
18
|
-
*/
|
|
19
|
-
ForumMessageElement.getSlug = function (rawData) {
|
|
20
|
-
var slugs = [];
|
|
21
|
-
if (ForumMessageElement.isType('server', rawData)
|
|
22
|
-
&& ForumMessageElement.isSupport('pc', rawData)
|
|
23
|
-
&& ForumMessageElement.isZone('na', rawData)) {
|
|
24
|
-
slugs.push('server_pc_na');
|
|
25
|
-
}
|
|
26
|
-
if (ForumMessageElement.isType('server', rawData)
|
|
27
|
-
&& ForumMessageElement.isSupport('pc', rawData)
|
|
28
|
-
&& ForumMessageElement.isZone('eu', rawData)) {
|
|
29
|
-
slugs.push('server_pc_eu');
|
|
30
|
-
}
|
|
31
|
-
if (ForumMessageElement.isType('server', rawData)
|
|
32
|
-
&& ForumMessageElement.isSupport('xbox', rawData)
|
|
33
|
-
&& ForumMessageElement.isZone('na', rawData)) {
|
|
34
|
-
slugs.push('server_xbox_na');
|
|
35
|
-
}
|
|
36
|
-
if (ForumMessageElement.isType('server', rawData)
|
|
37
|
-
&& ForumMessageElement.isSupport('xbox', rawData)
|
|
38
|
-
&& ForumMessageElement.isZone('eu', rawData)) {
|
|
39
|
-
slugs.push('server_xbox_eu');
|
|
40
|
-
}
|
|
41
|
-
if (ForumMessageElement.isType('server', rawData)
|
|
42
|
-
&& ForumMessageElement.isSupport('ps', rawData)
|
|
43
|
-
&& ForumMessageElement.isZone('na', rawData)) {
|
|
44
|
-
slugs.push('server_ps_na');
|
|
45
|
-
}
|
|
46
|
-
if (ForumMessageElement.isType('server', rawData)
|
|
47
|
-
&& ForumMessageElement.isSupport('ps', rawData)
|
|
48
|
-
&& ForumMessageElement.isZone('eu', rawData)) {
|
|
49
|
-
slugs.push('server_ps_eu');
|
|
50
|
-
}
|
|
51
|
-
if (ForumMessageElement.isType('server', rawData)
|
|
52
|
-
&& ForumMessageElement.isSupport('pc', rawData)
|
|
53
|
-
&& ForumMessageElement.isZone('pts', rawData)) {
|
|
54
|
-
slugs.push('server_pc_pts');
|
|
55
|
-
}
|
|
56
|
-
if (ForumMessageElement.isType('service', rawData)
|
|
57
|
-
&& ForumMessageElement.isSupport('web', rawData)
|
|
58
|
-
&& ForumMessageElement.isZone('site', rawData)) {
|
|
59
|
-
slugs.push('service_web_site');
|
|
60
|
-
}
|
|
61
|
-
if (ForumMessageElement.isType('service', rawData)
|
|
62
|
-
&& ForumMessageElement.isSupport('web', rawData)
|
|
63
|
-
&& ForumMessageElement.isZone('forum', rawData)) {
|
|
64
|
-
slugs.push('service_web_forum');
|
|
65
|
-
}
|
|
66
|
-
if (ForumMessageElement.isType('service', rawData)
|
|
67
|
-
&& ForumMessageElement.isSupport('store', rawData)
|
|
68
|
-
&& ForumMessageElement.isZone('crown', rawData)) {
|
|
69
|
-
slugs.push('service_store_crown');
|
|
70
|
-
}
|
|
71
|
-
if (ForumMessageElement.isType('service', rawData)
|
|
72
|
-
&& ForumMessageElement.isSupport('store', rawData)
|
|
73
|
-
&& ForumMessageElement.isZone('eso', rawData)) {
|
|
74
|
-
slugs.push('service_store_eso');
|
|
75
|
-
}
|
|
76
|
-
if (ForumMessageElement.isType('service', rawData)
|
|
77
|
-
&& ForumMessageElement.isSupport('system', rawData)
|
|
78
|
-
&& ForumMessageElement.isZone('account', rawData)) {
|
|
79
|
-
slugs.push('service_system_account');
|
|
80
|
-
}
|
|
81
|
-
return slugs;
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* Methode used to determinate service type
|
|
85
|
-
*
|
|
86
|
-
* @public
|
|
87
|
-
* @static
|
|
88
|
-
*
|
|
89
|
-
* @param type Type Type to check
|
|
90
|
-
* @param rawData string Raw data
|
|
91
|
-
* @return boolean Check result
|
|
92
|
-
*/
|
|
93
|
-
ForumMessageElement.isType = function (type, rawData) {
|
|
94
|
-
if (type === 'server') {
|
|
95
|
-
return rawData.includes('megaserver')
|
|
96
|
-
|| rawData.includes('NA megaservers')
|
|
97
|
-
|| rawData.includes('EU megaservers')
|
|
98
|
-
|| rawData.includes('the megaservers')
|
|
99
|
-
|| rawData.includes('PTS')
|
|
100
|
-
|| rawData.includes('PlayStation')
|
|
101
|
-
|| rawData.includes('Xbox Live');
|
|
102
|
-
}
|
|
103
|
-
if (type === 'service') {
|
|
104
|
-
return rawData.includes('ESO Store')
|
|
105
|
-
|| rawData.includes('Account System')
|
|
106
|
-
|| rawData.includes('account system')
|
|
107
|
-
|| rawData.includes('ESO Website');
|
|
108
|
-
}
|
|
109
|
-
return false;
|
|
110
|
-
};
|
|
111
|
-
/**
|
|
112
|
-
* Methode used to determinate service support
|
|
113
|
-
*
|
|
114
|
-
* @public
|
|
115
|
-
* @static
|
|
116
|
-
*
|
|
117
|
-
* @param support Support Support to check
|
|
118
|
-
* @param rawData string Raw data
|
|
119
|
-
* @return boolean Check result
|
|
120
|
-
*/
|
|
121
|
-
ForumMessageElement.isSupport = function (support, rawData) {
|
|
122
|
-
if (support === 'xbox') { // OK
|
|
123
|
-
return rawData.includes('Xbox')
|
|
124
|
-
|| rawData.includes('· NA megaservers')
|
|
125
|
-
|| rawData.includes('· EU megaservers')
|
|
126
|
-
|| rawData.includes('the megaservers');
|
|
127
|
-
}
|
|
128
|
-
if (support === 'ps') { // OK
|
|
129
|
-
return rawData.includes('PlayStation')
|
|
130
|
-
|| rawData.includes('· NA megaservers')
|
|
131
|
-
|| rawData.includes('· EU megaservers')
|
|
132
|
-
|| rawData.includes('the megaservers');
|
|
133
|
-
}
|
|
134
|
-
if (support === 'pc') { // OK
|
|
135
|
-
return rawData.includes('PC/Mac')
|
|
136
|
-
|| rawData.includes('PTS')
|
|
137
|
-
|| rawData.includes('· NA megaservers')
|
|
138
|
-
|| rawData.includes('· EU megaservers')
|
|
139
|
-
|| rawData.includes('the megaservers');
|
|
140
|
-
}
|
|
141
|
-
if (support === 'web') {
|
|
142
|
-
return rawData.includes('ESO Website');
|
|
143
|
-
}
|
|
144
|
-
if (support === 'store') { // OK
|
|
145
|
-
return rawData.includes('Crown Store')
|
|
146
|
-
|| rawData.includes('ESO Store')
|
|
147
|
-
|| rawData.includes('ESO store');
|
|
148
|
-
}
|
|
149
|
-
if (support === 'system') { // OK
|
|
150
|
-
return rawData.includes('Account System')
|
|
151
|
-
|| rawData.includes('account system');
|
|
152
|
-
}
|
|
153
|
-
return false;
|
|
154
|
-
};
|
|
155
|
-
/**
|
|
156
|
-
* Methode used to determinate service zone
|
|
157
|
-
*
|
|
158
|
-
* @public
|
|
159
|
-
* @static
|
|
160
|
-
*
|
|
161
|
-
* @param zone Zone Zone to check
|
|
162
|
-
* @param rawData string Raw data
|
|
163
|
-
* @return boolean Check result
|
|
164
|
-
*/
|
|
165
|
-
ForumMessageElement.isZone = function (zone, rawData) {
|
|
166
|
-
if (zone === 'na') { // OK
|
|
167
|
-
return rawData.includes('North American')
|
|
168
|
-
|| rawData.includes('NA')
|
|
169
|
-
|| rawData.includes('PlayStation™ Network')
|
|
170
|
-
|| rawData.includes('Xbox Live')
|
|
171
|
-
|| rawData.includes('the megaservers');
|
|
172
|
-
}
|
|
173
|
-
if (zone === 'eu') { // OK
|
|
174
|
-
return rawData.includes('European')
|
|
175
|
-
|| rawData.includes('EU')
|
|
176
|
-
|| rawData.includes('PlayStation™ Network')
|
|
177
|
-
|| rawData.includes('Xbox Live')
|
|
178
|
-
|| rawData.includes('the megaservers');
|
|
179
|
-
}
|
|
180
|
-
if (zone === 'pts') { // OK
|
|
181
|
-
return rawData.includes('PTS');
|
|
182
|
-
}
|
|
183
|
-
if (zone === 'site') {
|
|
184
|
-
return rawData.includes('ESO Website');
|
|
185
|
-
}
|
|
186
|
-
if (zone === 'forum') {
|
|
187
|
-
return false;
|
|
188
|
-
}
|
|
189
|
-
if (zone === 'crown') {
|
|
190
|
-
return false;
|
|
191
|
-
}
|
|
192
|
-
if (zone === 'eso') { // OK
|
|
193
|
-
return rawData.includes('ESO Store')
|
|
194
|
-
|| rawData.includes('ESO store');
|
|
195
|
-
}
|
|
196
|
-
if (zone === 'account') { // OK
|
|
197
|
-
return rawData.includes('Account System')
|
|
198
|
-
|| rawData.includes('account system');
|
|
199
|
-
}
|
|
200
|
-
return false;
|
|
201
|
-
};
|
|
202
|
-
/**
|
|
203
|
-
* Methode used to get dates of raw date
|
|
204
|
-
*
|
|
205
|
-
* @public
|
|
206
|
-
* @static
|
|
207
|
-
*
|
|
208
|
-
* @param rawDate string Raw date
|
|
209
|
-
* @return Moment[] Dates of raw data
|
|
210
|
-
*/
|
|
211
|
-
ForumMessageElement.getDate = function (rawDate) {
|
|
212
|
-
var list = [];
|
|
213
|
-
if (rawDate === '') {
|
|
214
|
-
return list;
|
|
215
|
-
}
|
|
216
|
-
if (rawDate.includes(' at ') && !rawDate.includes('EDT / ')) {
|
|
217
|
-
var dateTime = /([a-zA-Z]{6,9}) at [0-9]{1,2}:[0-9]{1,2}[a-zA-Z]{1,2} EDT \(([0-9]{1,2}):([0-9]{1,2}) UTC\)/.exec(rawDate);
|
|
218
|
-
var isoWeekDay = Number(moment().day(dateTime && dateTime.length >= 1 ? String(dateTime[1]) : '').format('d'));
|
|
219
|
-
// getDateWithDayIndex
|
|
220
|
-
list.push(moment()
|
|
221
|
-
.utc()
|
|
222
|
-
.set('years', moment().get('years'))
|
|
223
|
-
.set('months', (moment().utc().isoWeekday() > isoWeekDay
|
|
224
|
-
? moment()
|
|
225
|
-
.utc()
|
|
226
|
-
.isoWeekday(isoWeekDay)
|
|
227
|
-
.add(7, 'day')
|
|
228
|
-
.get('months')
|
|
229
|
-
: moment()
|
|
230
|
-
.utc()
|
|
231
|
-
.isoWeekday(isoWeekDay)
|
|
232
|
-
.get('months')))
|
|
233
|
-
.set('date', (moment().utc().isoWeekday() > isoWeekDay
|
|
234
|
-
? moment()
|
|
235
|
-
.utc()
|
|
236
|
-
.isoWeekday(isoWeekDay)
|
|
237
|
-
.add(7, 'day')
|
|
238
|
-
.get('date')
|
|
239
|
-
: moment()
|
|
240
|
-
.utc()
|
|
241
|
-
.isoWeekday(isoWeekDay)
|
|
242
|
-
.get('date')))
|
|
243
|
-
.set('hours', dateTime && dateTime.length >= 1 ? Number(dateTime[2]) : 0)
|
|
244
|
-
.set('minutes', dateTime && dateTime.length >= 1 ? Number(dateTime[3]) : 0)
|
|
245
|
-
.set('seconds', 0)
|
|
246
|
-
.set('milliseconds', 0)
|
|
247
|
-
.utcOffset(0));
|
|
248
|
-
}
|
|
249
|
-
else if (rawDate.includes('EDT / ') || rawDate.includes('EST / ')) {
|
|
250
|
-
var dateTime = /E[D|S]T \/ ([0-9]{1,2}):([0-9]{1,2}) UTC/.exec(rawDate);
|
|
251
|
-
// getDateWithHours
|
|
252
|
-
list.push(moment()
|
|
253
|
-
.utc()
|
|
254
|
-
.set('years', moment().get('years'))
|
|
255
|
-
.set('months', Number(((moment().utc().get('hours') > (dateTime && dateTime.length >= 1 ? Number(dateTime[1]) : 0)) || (moment().utc().get('hours') === (dateTime && dateTime.length >= 1 ? Number(dateTime[1]) : 0) && (moment().utc().get('minutes') > (dateTime && dateTime.length >= 1 ? Number(dateTime[2]) : 0))) ? moment().utc().add(1, 'day').get('months') : moment().utc().get('months'))))
|
|
256
|
-
.set('date', Number(((moment().utc().get('hours') > (dateTime && dateTime.length >= 1 ? Number(dateTime[1]) : 0)) || (moment().utc().get('hours') === (dateTime && dateTime.length >= 1 ? Number(dateTime[1]) : 0) && (moment().utc().get('minutes') > (dateTime && dateTime.length >= 1 ? Number(dateTime[2]) : 0))) ? moment().utc().add(1, 'day').get('date') : moment().utc().get('date'))))
|
|
257
|
-
.set('hours', dateTime && dateTime.length >= 1 ? Number(dateTime[1]) : 0)
|
|
258
|
-
.set('minutes', dateTime && dateTime.length >= 1 ? Number(dateTime[2]) : 0)
|
|
259
|
-
.set('seconds', 0)
|
|
260
|
-
.set('milliseconds', 0)
|
|
261
|
-
.utcOffset(0));
|
|
262
|
-
}
|
|
263
|
-
else {
|
|
264
|
-
var dateTime = /([a-zA-Z]{3,9}) ([0-9]{1,2})[ ]?, [0-9]{1,2}:[0-9]{1,2}[a-zA-Z]{1,2} E[D|S]T \(([0-9]{1,2}):([0-9]{1,2}) UTC\) [–|-] [0-9]{1,2}:[0-9]{1,2}[a-zA-Z]{1,2} E[D|S]T \(([0-9]{1,2}):([0-9]{1,2}) UTC\)/.exec(rawDate);
|
|
265
|
-
if (rawDate.includes('UTC (')) {
|
|
266
|
-
dateTime = /([a-zA-Z]{3,9}) ([0-9]{1,2})[ ]?, ([0-9]{1,2}):([0-9]{1,2}) UTC \([0-9]{1,2}:[0-9]{1,2}[a-zA-Z]{1,2} EDT\) [–|-] ([0-9]{1,2}):([0-9]{1,2}) UTC \([0-9]{1,2}:[0-9]{1,2}[a-zA-Z]{1,2} EDT\)/.exec(rawDate);
|
|
267
|
-
}
|
|
268
|
-
var month = Number(moment().month(dateTime && dateTime.length >= 1 ? String(dateTime[1]) : '').format('M')) - 1;
|
|
269
|
-
var day = dateTime && dateTime.length >= 1 ? Number(dateTime[2]) : 0;
|
|
270
|
-
// getDateWithDayNumber
|
|
271
|
-
list.push(moment()
|
|
272
|
-
.utc()
|
|
273
|
-
.set('years', moment().get('years'))
|
|
274
|
-
.set('months', month)
|
|
275
|
-
.set('date', day)
|
|
276
|
-
.set('hours', dateTime && dateTime.length >= 1 ? Number(dateTime[3]) : 0)
|
|
277
|
-
.set('minutes', dateTime && dateTime.length >= 1 ? Number(dateTime[4]) : 0)
|
|
278
|
-
.set('seconds', 0)
|
|
279
|
-
.set('milliseconds', 0)
|
|
280
|
-
.utcOffset(0));
|
|
281
|
-
list.push(moment()
|
|
282
|
-
.utc()
|
|
283
|
-
.set('years', moment().get('years'))
|
|
284
|
-
.set('months', month)
|
|
285
|
-
.set('date', day)
|
|
286
|
-
.set('hours', dateTime && dateTime.length >= 1 ? Number(dateTime[5]) : 0)
|
|
287
|
-
.set('minutes', dateTime && dateTime.length >= 1 ? Number(dateTime[6]) : 0)
|
|
288
|
-
.set('seconds', 0)
|
|
289
|
-
.set('milliseconds', 0)
|
|
290
|
-
.utcOffset(0));
|
|
291
|
-
}
|
|
292
|
-
return list;
|
|
293
|
-
};
|
|
294
|
-
/**
|
|
295
|
-
* Methode used to get type of slug
|
|
296
|
-
*
|
|
297
|
-
* @public
|
|
298
|
-
* @static
|
|
299
|
-
*
|
|
300
|
-
* @param slug Slug Slug
|
|
301
|
-
* @return Type Type of slug
|
|
302
|
-
*/
|
|
303
|
-
ForumMessageElement.getType = function (slug) {
|
|
304
|
-
return slug.split('_')[0];
|
|
305
|
-
};
|
|
306
|
-
/**
|
|
307
|
-
* Methode used to get support of slug
|
|
308
|
-
*
|
|
309
|
-
* @public
|
|
310
|
-
* @static
|
|
311
|
-
*
|
|
312
|
-
* @param slug Slug Slug
|
|
313
|
-
* @return Support Support of slug
|
|
314
|
-
*/
|
|
315
|
-
ForumMessageElement.getSupport = function (slug) {
|
|
316
|
-
return slug.split('_')[1];
|
|
317
|
-
};
|
|
318
|
-
/**
|
|
319
|
-
* Methode used to get zone of slug
|
|
320
|
-
*
|
|
321
|
-
* @public
|
|
322
|
-
* @static
|
|
323
|
-
*
|
|
324
|
-
* @param slug Slug Slug
|
|
325
|
-
* @return Zone Zone of slug
|
|
326
|
-
*/
|
|
327
|
-
ForumMessageElement.getZone = function (slug) {
|
|
328
|
-
return slug.split('_')[2];
|
|
329
|
-
};
|
|
330
|
-
/**
|
|
331
|
-
* Methode used to get status of raw data
|
|
332
|
-
*
|
|
333
|
-
* @public
|
|
334
|
-
* @static
|
|
335
|
-
*
|
|
336
|
-
* @param rawData string Raw data
|
|
337
|
-
* @return Status Status of raw data
|
|
338
|
-
*/
|
|
339
|
-
ForumMessageElement.getStatus = function (rawData) {
|
|
340
|
-
if (rawData.includes('unavailable') || rawData.includes('[IN PROGRESS]') || rawData.includes('[EXTENDED]')) {
|
|
341
|
-
return 'down';
|
|
342
|
-
}
|
|
343
|
-
if (rawData.includes('[COMPLETE]') || rawData.includes('is now available') || rawData.includes('are now available') || rawData.includes('maintenance is complete') || rawData.includes('resolved at this time') || rawData.includes('has been resolved') || rawData.includes('currently available.')) {
|
|
344
|
-
return 'up';
|
|
345
|
-
}
|
|
346
|
-
if (rawData.includes('currently investigating issues') || rawData.includes('service interruption') || rawData.includes('In response to the ongoing issue') || rawData.includes('Due to a hardware issue')) {
|
|
347
|
-
return 'issues';
|
|
348
|
-
}
|
|
349
|
-
if (rawData.includes('UTC')) {
|
|
350
|
-
return 'planned';
|
|
351
|
-
}
|
|
352
|
-
return 'down';
|
|
353
|
-
};
|
|
354
|
-
/**
|
|
355
|
-
* Methode used to get raw date of raw data
|
|
356
|
-
*
|
|
357
|
-
* @public
|
|
358
|
-
* @static
|
|
359
|
-
*
|
|
360
|
-
* @param raw string Raw data
|
|
361
|
-
* @return string Raw date
|
|
362
|
-
*/
|
|
363
|
-
ForumMessageElement.getRawDate = function (raw) {
|
|
364
|
-
if (raw.includes('maintenance – ')) {
|
|
365
|
-
var split = raw.split('maintenance – ');
|
|
366
|
-
if (split.length === 2) {
|
|
367
|
-
return split[1];
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
if (raw.includes('on the PTS on ')) {
|
|
371
|
-
var split = raw.split('on the PTS on ');
|
|
372
|
-
if (split.length === 2) {
|
|
373
|
-
return split[1];
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
if (raw.includes('for maintenance at')) {
|
|
377
|
-
var split = raw.split('for maintenance at ');
|
|
378
|
-
if (split.length === 2) {
|
|
379
|
-
return split[1];
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
return '';
|
|
383
|
-
};
|
|
384
|
-
return ForumMessageElement;
|
|
385
|
-
}());
|
|
386
|
-
exports.default = ForumMessageElement;
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { RawEsoStatus } from '@eso-status/types';
|
|
2
|
-
/**
|
|
3
|
-
* Connector used to get data from https://forums.elderscrollsonline.com/ and https://forums.elderscrollsonline.com/en/categories/pts
|
|
4
|
-
*/
|
|
5
|
-
export default class ForumMessageConnector {
|
|
6
|
-
/**
|
|
7
|
-
* Methode used to get the list of raw element from remote website
|
|
8
|
-
*
|
|
9
|
-
* @public
|
|
10
|
-
* @static
|
|
11
|
-
*
|
|
12
|
-
* @param url string Url to use to get list of raw element from remote specific url
|
|
13
|
-
*
|
|
14
|
-
* @return Promise<RawEsoStatus[]> List of raw element from remote website
|
|
15
|
-
*/
|
|
16
|
-
static getRemoteContent(url: string): Promise<RawEsoStatus[]>;
|
|
17
|
-
/**
|
|
18
|
-
* Methode used to get raw content from remote specific url
|
|
19
|
-
*
|
|
20
|
-
* @public
|
|
21
|
-
* @static
|
|
22
|
-
*
|
|
23
|
-
* @param url string Url to use to get list of raw element from remote specific url
|
|
24
|
-
* @return Promise<string> Raw content from remote specific url
|
|
25
|
-
*/
|
|
26
|
-
static getRawRemoteContent(url: string): Promise<string>;
|
|
27
|
-
/**
|
|
28
|
-
* Methode used to get raw warning message from raw content
|
|
29
|
-
*
|
|
30
|
-
* @public
|
|
31
|
-
* @static
|
|
32
|
-
*
|
|
33
|
-
* @param rawRemoteContent string Raw content from remote specific url
|
|
34
|
-
* @return string Raw warning message from raw content
|
|
35
|
-
*/
|
|
36
|
-
static getRawWarningMessage(rawRemoteContent: string): string;
|
|
37
|
-
/**
|
|
38
|
-
* Methode used to get raw alert message from raw content
|
|
39
|
-
*
|
|
40
|
-
* @public
|
|
41
|
-
* @static
|
|
42
|
-
*
|
|
43
|
-
* @param rawRemoteContent string Raw content from remote specific url
|
|
44
|
-
* @return string Raw alert message from raw content
|
|
45
|
-
*/
|
|
46
|
-
static getRawAlertMessage(rawRemoteContent: string): string;
|
|
47
|
-
/**
|
|
48
|
-
* Methode used to get merge off all message
|
|
49
|
-
*
|
|
50
|
-
* @public
|
|
51
|
-
* @static
|
|
52
|
-
*
|
|
53
|
-
* @param rawMessages string[] All message
|
|
54
|
-
* @return string Merge off all message
|
|
55
|
-
*/
|
|
56
|
-
static mergeRawMessage(...rawMessages: string[]): string;
|
|
57
|
-
/**
|
|
58
|
-
* Methode used to split raw content
|
|
59
|
-
*
|
|
60
|
-
* @public
|
|
61
|
-
* @static
|
|
62
|
-
*
|
|
63
|
-
* @param mergedRawMessage string All message merged
|
|
64
|
-
* @return string[] Split raw content
|
|
65
|
-
*/
|
|
66
|
-
static splitRawMessage(mergedRawMessage: string): string[];
|
|
67
|
-
/**
|
|
68
|
-
* Methode used to sort raw content list
|
|
69
|
-
*
|
|
70
|
-
* @public
|
|
71
|
-
* @static
|
|
72
|
-
*
|
|
73
|
-
* @param rawMessageSplit string Split raw content
|
|
74
|
-
* @return string[] Sort raw content list
|
|
75
|
-
*/
|
|
76
|
-
static sortRawMessageList(rawMessageSplit: string[]): string[];
|
|
77
|
-
/**
|
|
78
|
-
* Methode used to get slug for raw content list
|
|
79
|
-
*
|
|
80
|
-
* @public
|
|
81
|
-
* @static
|
|
82
|
-
*
|
|
83
|
-
* @param remoteContent RawEsoStatus[] Raw content list without duplicate
|
|
84
|
-
* @return RawEsoStatus[] Raw content list with slug list
|
|
85
|
-
*/
|
|
86
|
-
static getRawContentWithSlug(remoteContent: RawEsoStatus[]): RawEsoStatus[];
|
|
87
|
-
/**
|
|
88
|
-
* Methode used to split list by slug
|
|
89
|
-
*
|
|
90
|
-
* @public
|
|
91
|
-
* @static
|
|
92
|
-
*
|
|
93
|
-
* @param slugOfRawContent RawEsoStatus[] Raw content list with slug list
|
|
94
|
-
* @return RawEsoStatus[] Raw content list foreach slug
|
|
95
|
-
*/
|
|
96
|
-
static splitRawContentBySlug(slugOfRawContent: RawEsoStatus[]): RawEsoStatus[];
|
|
97
|
-
/**
|
|
98
|
-
* Methode used to get raw date for raw content list
|
|
99
|
-
*
|
|
100
|
-
* @public
|
|
101
|
-
* @static
|
|
102
|
-
*
|
|
103
|
-
* @param rawContentBySlug RawEsoStatus[] Raw content list foreach slug
|
|
104
|
-
* @return RawEsoStatus[] Raw content list with raw date
|
|
105
|
-
*/
|
|
106
|
-
static getRawContentWithRawDate(rawContentBySlug: RawEsoStatus[]): RawEsoStatus[];
|
|
107
|
-
/**
|
|
108
|
-
* Methode used to get data for each raw element
|
|
109
|
-
*
|
|
110
|
-
* @public
|
|
111
|
-
* @static
|
|
112
|
-
*
|
|
113
|
-
* @param rawContentWithRawDate RawEsoStatus[] Raw content list with raw date
|
|
114
|
-
* @return RawEsoStatus[] Raw content list with data
|
|
115
|
-
*/
|
|
116
|
-
static getData(rawContentWithRawDate: RawEsoStatus[]): RawEsoStatus[];
|
|
117
|
-
/**
|
|
118
|
-
* Methode used to get data sort by status
|
|
119
|
-
*
|
|
120
|
-
* @public
|
|
121
|
-
* @static
|
|
122
|
-
*
|
|
123
|
-
* @param data RawEsoStatus[] Raw content list with data
|
|
124
|
-
* @return RawEsoStatus[] Data sorted by status
|
|
125
|
-
*/
|
|
126
|
-
static sortData(data: RawEsoStatus[]): RawEsoStatus[];
|
|
127
|
-
}
|