@eso-status/service-alerts 1.0.8 → 1.0.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/lib/classes/ServiceAlertsElement.d.ts +75 -75
- package/lib/classes/ServiceAlertsElement.js +173 -226
- package/lib/connectors/ServiceAlertConnector.d.ts +79 -79
- package/lib/connectors/ServiceAlertConnector.js +149 -198
- package/lib/index.d.ts +7 -7
- package/lib/index.js +24 -68
- package/package.json +27 -20
|
@@ -4,109 +4,109 @@ import { RawEsoStatus } from '@eso-status/types';
|
|
|
4
4
|
*/
|
|
5
5
|
export default class ServiceAlertConnector {
|
|
6
6
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
static url
|
|
7
|
+
* URL to get remote content
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
* @static
|
|
11
|
+
*
|
|
12
|
+
* @return string URL to get remote content
|
|
13
|
+
*/
|
|
14
|
+
static readonly url = "https://help.elderscrollsonline.com/app/answers/detail/a_id/4320";
|
|
15
15
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
* Methode used to get raw content of the remote website
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
* @static
|
|
20
|
+
*
|
|
21
|
+
* @return Promise<string> Raw content of the remote website
|
|
22
|
+
*/
|
|
23
23
|
static getRemoteContent(): Promise<string>;
|
|
24
24
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
* Methode used to select raw content containing eso servers status information
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
* @static
|
|
29
|
+
*
|
|
30
|
+
* @param remoteContent Raw content of the remote website
|
|
31
|
+
* @return string Raw content containing eso servers status information
|
|
32
|
+
*/
|
|
33
33
|
static getFilterContent(remoteContent: string): string;
|
|
34
34
|
/**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
* Methode used to get list of each raw information by date
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
* @static
|
|
39
|
+
*
|
|
40
|
+
* @param filteredContent string Raw content containing eso servers status information
|
|
41
|
+
* @return string[] List of each information by date
|
|
42
|
+
*/
|
|
43
43
|
static changeFilterContentForList(filteredContent: string): string[];
|
|
44
44
|
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
* Methode used to get raw data of content list
|
|
46
|
+
*
|
|
47
|
+
* @public
|
|
48
|
+
* @static
|
|
49
|
+
*
|
|
50
|
+
* @param filteredContentList string[] Raw data of content list
|
|
51
|
+
* @return {raw: string, rawDate: string, rawData: string[]}[] Raw data of content list
|
|
52
|
+
*/
|
|
53
53
|
static getRawData(filteredContentList: string[]): {
|
|
54
54
|
raw: string;
|
|
55
55
|
rawDate: string;
|
|
56
56
|
rawData: string[];
|
|
57
57
|
}[];
|
|
58
58
|
/**
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
* Methode used to get list of split raw data of content list
|
|
60
|
+
*
|
|
61
|
+
* @public
|
|
62
|
+
* @static
|
|
63
|
+
*
|
|
64
|
+
* @param rawData {raw: string, rawDate: string, rawData: string[]}[] Raw data of content list
|
|
65
|
+
* @return RawEsoStatus[] Split raw data of content list
|
|
66
|
+
*/
|
|
67
67
|
static splitRawData(rawData: {
|
|
68
68
|
raw: string;
|
|
69
69
|
rawDate: string;
|
|
70
70
|
rawData: string[];
|
|
71
71
|
}[]): RawEsoStatus[];
|
|
72
72
|
/**
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
73
|
+
* Methode used to get slug of split raw data of content list
|
|
74
|
+
*
|
|
75
|
+
* @public
|
|
76
|
+
* @static
|
|
77
|
+
*
|
|
78
|
+
* @param splitRawData RawEsoStatus[] Split raw data of content list
|
|
79
|
+
* @return RawEsoStatus[] Split raw data of content list with slug
|
|
80
|
+
*/
|
|
81
81
|
static getSlugOfSplitRawData(splitRawData: RawEsoStatus[]): RawEsoStatus[];
|
|
82
82
|
/**
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
83
|
+
* Methode used to get split raw data of content list by slug
|
|
84
|
+
*
|
|
85
|
+
* @public
|
|
86
|
+
* @static
|
|
87
|
+
*
|
|
88
|
+
* @param splitRawDataWithSlug RawEsoStatus[] Split raw data of content list with slug
|
|
89
|
+
* @return RawEsoStatus[] Split raw data of content list by slug
|
|
90
|
+
*/
|
|
91
91
|
static splitRawDataList(splitRawDataWithSlug: RawEsoStatus[]): RawEsoStatus[];
|
|
92
92
|
/**
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
93
|
+
* Methode used to get last element by slug
|
|
94
|
+
*
|
|
95
|
+
* @public
|
|
96
|
+
* @static
|
|
97
|
+
*
|
|
98
|
+
* @param splitRawDataList RawEsoStatus[] Split raw data of content list by slug
|
|
99
|
+
* @return RawEsoStatus[] Raw eso server status list sorted by date
|
|
100
|
+
*/
|
|
101
101
|
static getLastRawData(splitRawDataList: RawEsoStatus[]): RawEsoStatus[];
|
|
102
102
|
/**
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
103
|
+
* Methode used to get last eso status server with data
|
|
104
|
+
*
|
|
105
|
+
* @public
|
|
106
|
+
* @static
|
|
107
|
+
*
|
|
108
|
+
* @param lastRawData RawEsoStatus[] Raw eso server status list sorted by date
|
|
109
|
+
* @return RawEsoStatus[] Last eso status server with data
|
|
110
|
+
*/
|
|
111
111
|
static getData(lastRawData: RawEsoStatus[]): RawEsoStatus[];
|
|
112
112
|
}
|
|
@@ -1,155 +1,112 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
4
|
};
|
|
38
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
|
|
40
|
-
|
|
6
|
+
const axios_1 = __importDefault(require("axios"));
|
|
7
|
+
const ServiceAlertsElement_1 = __importDefault(require("../classes/ServiceAlertsElement"));
|
|
8
|
+
const serviceAlertsStartMarker = '<!-- ENTER ESO SERVICE ALERTS BELOW THIS LINE -->';
|
|
41
9
|
/**
|
|
42
10
|
* Connector used to get data from https://help.elderscrollsonline.com/app/answers/detail/a_id/4320
|
|
43
11
|
*/
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-extraneous-class -- the published 1.x API exposes static methods, called as is by @eso-status/api 1.x
|
|
13
|
+
class ServiceAlertConnector {
|
|
47
14
|
/**
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
throw new Error("Empty response ".concat(response === null || response === void 0 ? void 0 : response.status, " (").concat(response === null || response === void 0 ? void 0 : response.data, ")"));
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.data];
|
|
71
|
-
}
|
|
72
|
-
return [2 /*return*/];
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
};
|
|
15
|
+
* Methode used to get raw content of the remote website
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
* @static
|
|
19
|
+
*
|
|
20
|
+
* @return Promise<string> Raw content of the remote website
|
|
21
|
+
*/
|
|
22
|
+
static async getRemoteContent() {
|
|
23
|
+
const response = await axios_1.default.get(ServiceAlertConnector.url);
|
|
24
|
+
if (response.status !== 200) {
|
|
25
|
+
throw new Error(`Bad response ${String(response.status)} (${response.data})`);
|
|
26
|
+
}
|
|
27
|
+
else if (!response.data) {
|
|
28
|
+
throw new Error(`Empty response ${String(response.status)} (${response.data})`);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
return response.data;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
77
34
|
/**
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
35
|
+
* Methode used to select raw content containing eso servers status information
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
* @static
|
|
39
|
+
*
|
|
40
|
+
* @param remoteContent Raw content of the remote website
|
|
41
|
+
* @return string Raw content containing eso servers status information
|
|
42
|
+
*/
|
|
43
|
+
static getFilterContent(remoteContent) {
|
|
44
|
+
const resultRemoveBefore = remoteContent.split(serviceAlertsStartMarker);
|
|
88
45
|
if (resultRemoveBefore.length >= 2) {
|
|
89
|
-
|
|
46
|
+
const resultRemoveAfter = resultRemoveBefore[1].split('<p> </p>');
|
|
90
47
|
if (resultRemoveAfter.length >= 2) {
|
|
91
|
-
return
|
|
48
|
+
return `${serviceAlertsStartMarker}${resultRemoveAfter[0]}<p> </p>`;
|
|
92
49
|
}
|
|
93
50
|
}
|
|
94
51
|
return '';
|
|
95
|
-
}
|
|
52
|
+
}
|
|
96
53
|
/**
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
54
|
+
* Methode used to get list of each raw information by date
|
|
55
|
+
*
|
|
56
|
+
* @public
|
|
57
|
+
* @static
|
|
58
|
+
*
|
|
59
|
+
* @param filteredContent string Raw content containing eso servers status information
|
|
60
|
+
* @return string[] List of each information by date
|
|
61
|
+
*/
|
|
62
|
+
static changeFilterContentForList(filteredContent) {
|
|
106
63
|
return filteredContent
|
|
107
64
|
.split('<hr')
|
|
108
|
-
.filter(
|
|
109
|
-
}
|
|
65
|
+
.filter((item) => !item.includes(' '));
|
|
66
|
+
}
|
|
110
67
|
/**
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return filteredContentList.map(
|
|
121
|
-
|
|
68
|
+
* Methode used to get raw data of content list
|
|
69
|
+
*
|
|
70
|
+
* @public
|
|
71
|
+
* @static
|
|
72
|
+
*
|
|
73
|
+
* @param filteredContentList string[] Raw data of content list
|
|
74
|
+
* @return {raw: string, rawDate: string, rawData: string[]}[] Raw data of content list
|
|
75
|
+
*/
|
|
76
|
+
static getRawData(filteredContentList) {
|
|
77
|
+
return filteredContentList.map((item) => {
|
|
78
|
+
const list = item
|
|
122
79
|
.split('</p>')
|
|
123
|
-
.map(
|
|
124
|
-
|
|
125
|
-
newLine = newLine
|
|
126
|
-
.replace(
|
|
80
|
+
.map((line) => {
|
|
81
|
+
let newLine = line;
|
|
82
|
+
newLine = newLine
|
|
83
|
+
.replace(/\n/g, '')
|
|
127
84
|
.replace('</p>', '')
|
|
128
|
-
.replace(
|
|
85
|
+
.replace(serviceAlertsStartMarker, '')
|
|
129
86
|
.replace('<p>', '');
|
|
130
87
|
return newLine;
|
|
131
88
|
})
|
|
132
|
-
.filter(
|
|
89
|
+
.filter((line) => line.length > 2);
|
|
133
90
|
return {
|
|
134
91
|
raw: item,
|
|
135
92
|
rawDate: list[0],
|
|
136
93
|
rawData: list.slice(1, list.length),
|
|
137
94
|
};
|
|
138
95
|
});
|
|
139
|
-
}
|
|
96
|
+
}
|
|
140
97
|
/**
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
rawData.forEach(
|
|
152
|
-
item.rawData.forEach(
|
|
98
|
+
* Methode used to get list of split raw data of content list
|
|
99
|
+
*
|
|
100
|
+
* @public
|
|
101
|
+
* @static
|
|
102
|
+
*
|
|
103
|
+
* @param rawData {raw: string, rawDate: string, rawData: string[]}[] Raw data of content list
|
|
104
|
+
* @return RawEsoStatus[] Split raw data of content list
|
|
105
|
+
*/
|
|
106
|
+
static splitRawData(rawData) {
|
|
107
|
+
const list = [];
|
|
108
|
+
rawData.forEach((item) => {
|
|
109
|
+
item.rawData.forEach((line) => {
|
|
153
110
|
list.push({
|
|
154
111
|
sources: [ServiceAlertConnector.url],
|
|
155
112
|
raw: [item.raw],
|
|
@@ -159,42 +116,38 @@ var ServiceAlertConnector = /** @class */ (function () {
|
|
|
159
116
|
});
|
|
160
117
|
});
|
|
161
118
|
return list;
|
|
162
|
-
}
|
|
119
|
+
}
|
|
163
120
|
/**
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
return splitRawData.map(
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
};
|
|
121
|
+
* Methode used to get slug of split raw data of content list
|
|
122
|
+
*
|
|
123
|
+
* @public
|
|
124
|
+
* @static
|
|
125
|
+
*
|
|
126
|
+
* @param splitRawData RawEsoStatus[] Split raw data of content list
|
|
127
|
+
* @return RawEsoStatus[] Split raw data of content list with slug
|
|
128
|
+
*/
|
|
129
|
+
static getSlugOfSplitRawData(splitRawData) {
|
|
130
|
+
return splitRawData.map((item) => ({
|
|
131
|
+
sources: item.sources,
|
|
132
|
+
raw: item.raw,
|
|
133
|
+
rawDate: item.rawDate,
|
|
134
|
+
rawData: item.rawData,
|
|
135
|
+
slugs: ServiceAlertsElement_1.default.getSlug(item.rawData ?? ''),
|
|
136
|
+
}));
|
|
137
|
+
}
|
|
184
138
|
/**
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
splitRawDataWithSlug.forEach(
|
|
196
|
-
|
|
197
|
-
(_a = item.slugs) === null || _a === void 0 ? void 0 : _a.forEach(function (slug) {
|
|
139
|
+
* Methode used to get split raw data of content list by slug
|
|
140
|
+
*
|
|
141
|
+
* @public
|
|
142
|
+
* @static
|
|
143
|
+
*
|
|
144
|
+
* @param splitRawDataWithSlug RawEsoStatus[] Split raw data of content list with slug
|
|
145
|
+
* @return RawEsoStatus[] Split raw data of content list by slug
|
|
146
|
+
*/
|
|
147
|
+
static splitRawDataList(splitRawDataWithSlug) {
|
|
148
|
+
const list = [];
|
|
149
|
+
splitRawDataWithSlug.forEach((item) => {
|
|
150
|
+
item.slugs?.forEach((slug) => {
|
|
198
151
|
list.push({
|
|
199
152
|
sources: item.sources,
|
|
200
153
|
raw: item.raw,
|
|
@@ -205,59 +158,57 @@ var ServiceAlertConnector = /** @class */ (function () {
|
|
|
205
158
|
});
|
|
206
159
|
});
|
|
207
160
|
return list;
|
|
208
|
-
}
|
|
161
|
+
}
|
|
209
162
|
/**
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
splitRawDataList.forEach(
|
|
222
|
-
if (item
|
|
163
|
+
* Methode used to get last element by slug
|
|
164
|
+
*
|
|
165
|
+
* @public
|
|
166
|
+
* @static
|
|
167
|
+
*
|
|
168
|
+
* @param splitRawDataList RawEsoStatus[] Split raw data of content list by slug
|
|
169
|
+
* @return RawEsoStatus[] Raw eso server status list sorted by date
|
|
170
|
+
*/
|
|
171
|
+
static getLastRawData(splitRawDataList) {
|
|
172
|
+
const last = [];
|
|
173
|
+
const list = [];
|
|
174
|
+
splitRawDataList.forEach((item) => {
|
|
175
|
+
if (item.slugs && !last.includes(item.slugs[0])) {
|
|
223
176
|
last.push(item.slugs[0]);
|
|
224
177
|
list.push(item);
|
|
225
178
|
}
|
|
226
179
|
});
|
|
227
180
|
return list;
|
|
228
|
-
}
|
|
181
|
+
}
|
|
229
182
|
/**
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
return lastRawData.map(
|
|
240
|
-
|
|
241
|
-
var newItem = item;
|
|
183
|
+
* Methode used to get last eso status server with data
|
|
184
|
+
*
|
|
185
|
+
* @public
|
|
186
|
+
* @static
|
|
187
|
+
*
|
|
188
|
+
* @param lastRawData RawEsoStatus[] Raw eso server status list sorted by date
|
|
189
|
+
* @return RawEsoStatus[] Last eso status server with data
|
|
190
|
+
*/
|
|
191
|
+
static getData(lastRawData) {
|
|
192
|
+
return lastRawData.map((item) => {
|
|
193
|
+
const newItem = item;
|
|
242
194
|
if (newItem.slugs) {
|
|
243
|
-
newItem.dates = [ServiceAlertsElement_1.default.getDate(
|
|
195
|
+
newItem.dates = [ServiceAlertsElement_1.default.getDate(newItem.rawDate ?? '')];
|
|
244
196
|
newItem.type = ServiceAlertsElement_1.default.getType(newItem.slugs[0]);
|
|
245
197
|
newItem.support = ServiceAlertsElement_1.default.getSupport(newItem.slugs[0]);
|
|
246
198
|
newItem.zone = ServiceAlertsElement_1.default.getZone(newItem.slugs[0]);
|
|
247
|
-
newItem.status = ServiceAlertsElement_1.default.getStatus(
|
|
199
|
+
newItem.status = ServiceAlertsElement_1.default.getStatus(newItem.rawData ?? '');
|
|
248
200
|
}
|
|
249
201
|
return newItem;
|
|
250
202
|
});
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}());
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* URL to get remote content
|
|
207
|
+
*
|
|
208
|
+
* @public
|
|
209
|
+
* @static
|
|
210
|
+
*
|
|
211
|
+
* @return string URL to get remote content
|
|
212
|
+
*/
|
|
213
|
+
ServiceAlertConnector.url = 'https://help.elderscrollsonline.com/app/answers/detail/a_id/4320';
|
|
263
214
|
exports.default = ServiceAlertConnector;
|
package/lib/index.d.ts
CHANGED
|
@@ -4,12 +4,12 @@ import { RawEsoStatus } from '@eso-status/types';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare class ServiceAlerts {
|
|
6
6
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
* Methode used to get Service Alerts data
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
* @static
|
|
11
|
+
*
|
|
12
|
+
* @return Promise<RawEsoStatus[]> Service Alerts elements
|
|
13
|
+
*/
|
|
14
14
|
static getData(): Promise<RawEsoStatus[]>;
|
|
15
15
|
}
|