@eso-status/service-alerts 1.0.7 → 2.0.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/README.md +108 -204
- package/lib/connector.d.ts +65 -0
- package/lib/connector.js +122 -0
- package/lib/const.d.ts +6 -0
- package/lib/const.js +8 -0
- package/lib/formatter/date.formatter.d.ts +19 -0
- package/lib/formatter/date.formatter.js +32 -0
- package/lib/identifier/slug.identifier.d.ts +89 -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 +58 -0
- package/lib/identifier/status.identifier.js +74 -0
- package/lib/index.d.ts +6 -11
- package/lib/index.js +11 -72
- package/lib/interface/esoStatusRawData.interface.d.ts +54 -0
- package/lib/interface/esoStatusRawData.interface.js +3 -0
- package/lib/raw.d.ts +39 -0
- package/lib/raw.js +52 -0
- package/lib/type/remoteDownRawStatus.type.d.ts +4 -0
- package/lib/type/remoteDownRawStatus.type.js +3 -0
- package/lib/type/remoteIssuesRawStatus.type.d.ts +4 -0
- package/lib/type/remoteIssuesRawStatus.type.js +3 -0
- package/lib/type/remoteRawSlug.type.d.ts +13 -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/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 +109 -38
- package/lib/classes/ServiceAlertsElement.d.ts +0 -100
- package/lib/classes/ServiceAlertsElement.js +0 -284
- package/lib/connectors/ServiceAlertConnector.d.ts +0 -112
- package/lib/connectors/ServiceAlertConnector.js +0 -263
|
@@ -0,0 +1,89 @@
|
|
|
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_ps_eu
|
|
23
|
+
* @private
|
|
24
|
+
*/
|
|
25
|
+
private readonly ServerPsEuMatchesList;
|
|
26
|
+
/**
|
|
27
|
+
* List of indicators proving that the announcement pertains to the slug server_xbox_eu
|
|
28
|
+
* @private
|
|
29
|
+
*/
|
|
30
|
+
private readonly ServerXboxEuMatchesList;
|
|
31
|
+
/**
|
|
32
|
+
* List of indicators proving that the announcement pertains to the slug server_pc_na
|
|
33
|
+
* @private
|
|
34
|
+
*/
|
|
35
|
+
private readonly ServerPcNaMatchesList;
|
|
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_na
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
private readonly ServerXboxNaMatchesList;
|
|
46
|
+
/**
|
|
47
|
+
* List of indicators proving that the announcement pertains to the slug server_pc_pts
|
|
48
|
+
* @private
|
|
49
|
+
*/
|
|
50
|
+
private readonly ServerPcPtsMatchesList;
|
|
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
|
+
* @param raw Raw data of the announcement
|
|
63
|
+
*/
|
|
64
|
+
constructor(raw: string);
|
|
65
|
+
/**
|
|
66
|
+
* Method for retrieving the list of indicators for a slug to test
|
|
67
|
+
* @param slug Slug to test
|
|
68
|
+
* @private
|
|
69
|
+
*/
|
|
70
|
+
private getMatchList;
|
|
71
|
+
/**
|
|
72
|
+
* Method for retrieving the name of the list of indicators for a slug to test
|
|
73
|
+
* @param slug Slug to test
|
|
74
|
+
* @private
|
|
75
|
+
*/
|
|
76
|
+
private static getMatchListName;
|
|
77
|
+
/**
|
|
78
|
+
* Method for retrieving the indicators of a slug present in the announcement
|
|
79
|
+
* @param slug Slug to test
|
|
80
|
+
* @private
|
|
81
|
+
*/
|
|
82
|
+
private getMatches;
|
|
83
|
+
/**
|
|
84
|
+
* Method for testing if the announcement contains indicators of a given slug
|
|
85
|
+
* @param slug Slug to test
|
|
86
|
+
* @private
|
|
87
|
+
*/
|
|
88
|
+
private identify;
|
|
89
|
+
}
|
|
@@ -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.ServerPsEuSlug,
|
|
21
|
+
types_1.ServerXboxEuSlug,
|
|
22
|
+
types_1.ServerPcNaSlug,
|
|
23
|
+
types_1.ServerPsNaSlug,
|
|
24
|
+
types_1.ServerXboxNaSlug,
|
|
25
|
+
types_1.ServerPcPtsSlug,
|
|
26
|
+
types_1.ServiceStoreEsoSlug,
|
|
27
|
+
types_1.ServiceSystemAccountSlug,
|
|
28
|
+
];
|
|
29
|
+
/**
|
|
30
|
+
* List of indicators proving that the announcement pertains to the slug server_pc_eu
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
33
|
+
this.ServerPcEuMatchesList = [
|
|
34
|
+
'The European megaservers',
|
|
35
|
+
'The European PC/Mac megaserver',
|
|
36
|
+
];
|
|
37
|
+
/**
|
|
38
|
+
* List of indicators proving that the announcement pertains to the slug server_ps_eu
|
|
39
|
+
* @private
|
|
40
|
+
*/
|
|
41
|
+
this.ServerPsEuMatchesList = [
|
|
42
|
+
'The European megaservers',
|
|
43
|
+
'The European PlayStation® megaserver',
|
|
44
|
+
];
|
|
45
|
+
/**
|
|
46
|
+
* List of indicators proving that the announcement pertains to the slug server_xbox_eu
|
|
47
|
+
* @private
|
|
48
|
+
*/
|
|
49
|
+
this.ServerXboxEuMatchesList = [
|
|
50
|
+
'The European megaservers',
|
|
51
|
+
'The European Xbox megaserver',
|
|
52
|
+
'North American and European Xbox megaservers',
|
|
53
|
+
'Xbox Live™',
|
|
54
|
+
];
|
|
55
|
+
/**
|
|
56
|
+
* List of indicators proving that the announcement pertains to the slug server_pc_na
|
|
57
|
+
* @private
|
|
58
|
+
*/
|
|
59
|
+
this.ServerPcNaMatchesList = [
|
|
60
|
+
'The North American megaservers',
|
|
61
|
+
'The North American PC/Mac megaserver',
|
|
62
|
+
];
|
|
63
|
+
/**
|
|
64
|
+
* List of indicators proving that the announcement pertains to the slug server_ps_na
|
|
65
|
+
* @private
|
|
66
|
+
*/
|
|
67
|
+
this.ServerPsNaMatchesList = [
|
|
68
|
+
'The North American megaservers',
|
|
69
|
+
'North American PlayStation® megaserver',
|
|
70
|
+
];
|
|
71
|
+
/**
|
|
72
|
+
* List of indicators proving that the announcement pertains to the slug server_xbox_na
|
|
73
|
+
* @private
|
|
74
|
+
*/
|
|
75
|
+
this.ServerXboxNaMatchesList = [
|
|
76
|
+
'The North American megaservers',
|
|
77
|
+
'The North American Xbox megaserver',
|
|
78
|
+
'North American and European Xbox megaservers',
|
|
79
|
+
'Xbox Live™',
|
|
80
|
+
];
|
|
81
|
+
/**
|
|
82
|
+
* List of indicators proving that the announcement pertains to the slug server_pc_pts
|
|
83
|
+
* @private
|
|
84
|
+
*/
|
|
85
|
+
this.ServerPcPtsMatchesList = ['PTS'];
|
|
86
|
+
/**
|
|
87
|
+
* List of indicators proving that the announcement pertains to the slug service_store_eso
|
|
88
|
+
* @private
|
|
89
|
+
*/
|
|
90
|
+
this.ServiceStoreEsoMatchesList = ['ESO store'];
|
|
91
|
+
/**
|
|
92
|
+
* List of indicators proving that the announcement pertains to the slug service_system_account
|
|
93
|
+
* @private
|
|
94
|
+
*/
|
|
95
|
+
this.ServiceSystemAccountMatchesList = ['account system'];
|
|
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,58 @@
|
|
|
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 issuesMatchesList;
|
|
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
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
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.IssuesStatus];
|
|
18
|
+
/**
|
|
19
|
+
* List of indicators proving that the announcement pertains to the status up
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
this.upMatchesList = [
|
|
23
|
+
'currently available',
|
|
24
|
+
'been resolved',
|
|
25
|
+
];
|
|
26
|
+
/**
|
|
27
|
+
* List of indicators proving that the announcement pertains to the status down
|
|
28
|
+
* @private
|
|
29
|
+
*/
|
|
30
|
+
this.downMatchesList = [
|
|
31
|
+
'currently unavailable',
|
|
32
|
+
];
|
|
33
|
+
/**
|
|
34
|
+
* List of indicators proving that the announcement pertains to the status planned
|
|
35
|
+
* @private
|
|
36
|
+
*/
|
|
37
|
+
this.issuesMatchesList = [
|
|
38
|
+
'currently investigating issues',
|
|
39
|
+
'currently experiencing a service interruption',
|
|
40
|
+
];
|
|
41
|
+
this.statusList.forEach((status) => this.identify(status));
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Method for retrieving the list of indicators for a status to test
|
|
45
|
+
* @param status Status to test
|
|
46
|
+
* @private
|
|
47
|
+
*/
|
|
48
|
+
getMatchList(status) {
|
|
49
|
+
return this[`${status}MatchesList`];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Method for retrieving the indicators of a status present in the announcement
|
|
53
|
+
* @param status Status to test
|
|
54
|
+
* @private
|
|
55
|
+
*/
|
|
56
|
+
getMatches(status) {
|
|
57
|
+
return this.getMatchList(status).filter((identifier) => this.raw.includes(identifier));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Method for testing if the announcement contains indicators of a given status
|
|
61
|
+
* @param status Status to test
|
|
62
|
+
* @private
|
|
63
|
+
*/
|
|
64
|
+
identify(status) {
|
|
65
|
+
const matches = this.getMatches(status);
|
|
66
|
+
if (!matches.length) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
this.rawStatus = matches.shift();
|
|
70
|
+
this.status = status;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.default = StatusIdentifier;
|
|
74
|
+
//# sourceMappingURL=status.identifier.js.map
|
package/lib/index.d.ts
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EsoStatusRawData } from '@eso-status/types';
|
|
2
2
|
/**
|
|
3
|
-
* Class
|
|
3
|
+
* Class for retrieving announcement information
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export default class ServiceAlerts {
|
|
6
6
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* @static
|
|
11
|
-
*
|
|
12
|
-
* @return Promise<RawEsoStatus[]> Service Alerts elements
|
|
13
|
-
*/
|
|
14
|
-
static getData(): Promise<RawEsoStatus[]>;
|
|
7
|
+
* Method for retrieving announcement information
|
|
8
|
+
*/
|
|
9
|
+
static getData(): Promise<EsoStatusRawData[]>;
|
|
15
10
|
}
|
package/lib/index.js
CHANGED
|
@@ -1,77 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
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
|
-
}
|
|
37
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
|
|
40
|
-
var ServiceAlertConnector_1 = require("./connectors/ServiceAlertConnector");
|
|
3
|
+
const connector_1 = require("./connector");
|
|
41
4
|
/**
|
|
42
|
-
* Class
|
|
5
|
+
* Class for retrieving announcement information
|
|
43
6
|
*/
|
|
44
|
-
|
|
45
|
-
function ServiceAlerts() {
|
|
46
|
-
}
|
|
7
|
+
class ServiceAlerts {
|
|
47
8
|
/**
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
57
|
-
var remoteContent, filteredContent, filteredContentList, rawData, splitRawData, splitRawDataWithSlug, splitRawDataList, lastRawData;
|
|
58
|
-
return __generator(this, function (_a) {
|
|
59
|
-
switch (_a.label) {
|
|
60
|
-
case 0: return [4 /*yield*/, ServiceAlertConnector_1.default.getRemoteContent()];
|
|
61
|
-
case 1:
|
|
62
|
-
remoteContent = _a.sent();
|
|
63
|
-
filteredContent = ServiceAlertConnector_1.default.getFilterContent(remoteContent);
|
|
64
|
-
filteredContentList = ServiceAlertConnector_1.default.changeFilterContentForList(filteredContent);
|
|
65
|
-
rawData = ServiceAlertConnector_1.default.getRawData(filteredContentList);
|
|
66
|
-
splitRawData = ServiceAlertConnector_1.default.splitRawData(rawData);
|
|
67
|
-
splitRawDataWithSlug = ServiceAlertConnector_1.default.getSlugOfSplitRawData(splitRawData);
|
|
68
|
-
splitRawDataList = ServiceAlertConnector_1.default.splitRawDataList(splitRawDataWithSlug);
|
|
69
|
-
lastRawData = ServiceAlertConnector_1.default.getLastRawData(splitRawDataList);
|
|
70
|
-
return [2 /*return*/, ServiceAlertConnector_1.default.getData(lastRawData)];
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
return ServiceAlerts;
|
|
76
|
-
}());
|
|
77
|
-
exports.ServiceAlerts = ServiceAlerts;
|
|
9
|
+
* Method for retrieving announcement information
|
|
10
|
+
*/
|
|
11
|
+
static async getData() {
|
|
12
|
+
return (await connector_1.default.init()).rawEsoStatus;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.default = ServiceAlerts;
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Moment } from 'moment/moment';
|
|
2
|
+
import { Slug, Status, Support, Type, Zone } from '@eso-status/types';
|
|
3
|
+
import { RemoteRawSlug } from '../type/remoteRawSlug.type';
|
|
4
|
+
import { RemoteRawStatus } from '../type/remoteRawStatus.type';
|
|
5
|
+
import { SourceUrl } from '../type/sourceUrl.type';
|
|
6
|
+
/**
|
|
7
|
+
* Donnée brute du status d'un server/service ESO
|
|
8
|
+
*/
|
|
9
|
+
export interface EsoStatusRawData {
|
|
10
|
+
/**
|
|
11
|
+
* URL de la source de la donnée
|
|
12
|
+
*/
|
|
13
|
+
source: SourceUrl;
|
|
14
|
+
/**
|
|
15
|
+
* Donnée brute permettant d'identifier le server/service et son status
|
|
16
|
+
*/
|
|
17
|
+
raw: string;
|
|
18
|
+
/**
|
|
19
|
+
* Status du server/service
|
|
20
|
+
*/
|
|
21
|
+
status: Status;
|
|
22
|
+
/**
|
|
23
|
+
* Donnée brute ayant permis d'identifier le status
|
|
24
|
+
*/
|
|
25
|
+
rawStatus: RemoteRawStatus;
|
|
26
|
+
/**
|
|
27
|
+
* Slug du server/service
|
|
28
|
+
*/
|
|
29
|
+
slug: Slug;
|
|
30
|
+
/**
|
|
31
|
+
* Donnée brute ayant permis d'identifier le slug
|
|
32
|
+
*/
|
|
33
|
+
rawSlug: RemoteRawSlug;
|
|
34
|
+
/**
|
|
35
|
+
* Type du server/service
|
|
36
|
+
*/
|
|
37
|
+
type: Type;
|
|
38
|
+
/**
|
|
39
|
+
* Support du server/service
|
|
40
|
+
*/
|
|
41
|
+
support: Support;
|
|
42
|
+
/**
|
|
43
|
+
* Zone du server/service
|
|
44
|
+
*/
|
|
45
|
+
zone: Zone;
|
|
46
|
+
/**
|
|
47
|
+
* Liste des dates contenue dans l'annonce
|
|
48
|
+
*/
|
|
49
|
+
dates: Moment[];
|
|
50
|
+
/**
|
|
51
|
+
* Donnée brute de la date contenue dans l'annonce
|
|
52
|
+
*/
|
|
53
|
+
rawDate: string;
|
|
54
|
+
}
|
package/lib/raw.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { EsoStatusRawData } from './interface/esoStatusRawData.interface';
|
|
2
|
+
/**
|
|
3
|
+
* Class containing announcement information
|
|
4
|
+
*/
|
|
5
|
+
export default class Raw {
|
|
6
|
+
private raw;
|
|
7
|
+
/**
|
|
8
|
+
* Status identification class
|
|
9
|
+
* @private
|
|
10
|
+
*/
|
|
11
|
+
private readonly statusIdentifier;
|
|
12
|
+
/**
|
|
13
|
+
* Class for identifying and formatting the date(s)
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
16
|
+
private readonly dateFormatter;
|
|
17
|
+
/**
|
|
18
|
+
* Class for identifying the list of slugs
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
21
|
+
private slugsIdentifier;
|
|
22
|
+
/**
|
|
23
|
+
* List of information about slugs found in the announcement
|
|
24
|
+
*/
|
|
25
|
+
matches: EsoStatusRawData[];
|
|
26
|
+
/**
|
|
27
|
+
* @param raw Raw data of the announcement
|
|
28
|
+
*/
|
|
29
|
+
constructor(raw: string);
|
|
30
|
+
/**
|
|
31
|
+
* Method for formatting each slug found in the announcement to RawEsoStatus
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
private split;
|
|
35
|
+
/**
|
|
36
|
+
* Method for generating the RawEsoStatus object
|
|
37
|
+
*/
|
|
38
|
+
private getRawEsoStatus;
|
|
39
|
+
}
|
package/lib/raw.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const status_identifier_1 = require("./identifier/status.identifier");
|
|
4
|
+
const date_formatter_1 = require("./formatter/date.formatter");
|
|
5
|
+
const slug_identifier_1 = require("./identifier/slug.identifier");
|
|
6
|
+
const const_1 = require("./const");
|
|
7
|
+
/**
|
|
8
|
+
* Class containing announcement information
|
|
9
|
+
*/
|
|
10
|
+
class Raw {
|
|
11
|
+
/**
|
|
12
|
+
* @param raw Raw data of the announcement
|
|
13
|
+
*/
|
|
14
|
+
constructor(raw) {
|
|
15
|
+
this.raw = raw;
|
|
16
|
+
/**
|
|
17
|
+
* List of information about slugs found in the announcement
|
|
18
|
+
*/
|
|
19
|
+
this.matches = [];
|
|
20
|
+
this.statusIdentifier = new status_identifier_1.default(this.raw);
|
|
21
|
+
this.dateFormatter = new date_formatter_1.default(this.raw);
|
|
22
|
+
this.slugsIdentifier = new slug_identifier_1.default(this.raw);
|
|
23
|
+
this.split();
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Method for formatting each slug found in the announcement to RawEsoStatus
|
|
27
|
+
* @private
|
|
28
|
+
*/
|
|
29
|
+
split() {
|
|
30
|
+
this.matches = this.slugsIdentifier.slugMatches.map((slugMatch) => this.getRawEsoStatus(slugMatch));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Method for generating the RawEsoStatus object
|
|
34
|
+
*/
|
|
35
|
+
getRawEsoStatus(slugMatch) {
|
|
36
|
+
return {
|
|
37
|
+
source: const_1.default,
|
|
38
|
+
raw: this.raw,
|
|
39
|
+
slug: slugMatch.slug,
|
|
40
|
+
type: slugMatch.getType(),
|
|
41
|
+
support: slugMatch.getSupport(),
|
|
42
|
+
zone: slugMatch.getZone(),
|
|
43
|
+
status: this.statusIdentifier.status,
|
|
44
|
+
rawStatus: this.statusIdentifier.rawStatus,
|
|
45
|
+
rawSlug: slugMatch.rawSlug,
|
|
46
|
+
rawDate: this.dateFormatter.rawDate,
|
|
47
|
+
dates: this.dateFormatter.dates,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.default = Raw;
|
|
52
|
+
//# sourceMappingURL=raw.js.map
|