@eso-status/forum-message 2.0.0-dev.5 → 2.0.0-dev.7
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/connector.d.ts +3 -3
- package/lib/connector.js +34 -10
- package/lib/identifier/slug.identifier.js +2 -0
- package/lib/identifier/status.identifier.d.ts +5 -0
- package/lib/identifier/status.identifier.js +14 -1
- package/lib/raw.d.ts +3 -3
- package/lib/type/remoteRawStatus.type.d.ts +2 -1
- package/lib/type/remoteServerPsEuRawSlug.type.d.ts +1 -1
- package/lib/type/remoteServerPsNaRawSlug.type.d.ts +1 -1
- package/lib/type/remoteUpRawStatus.type.d.ts +1 -1
- package/package.json +7 -7
package/lib/connector.d.ts
CHANGED
|
@@ -60,9 +60,9 @@ export default class Connector {
|
|
|
60
60
|
*/
|
|
61
61
|
private fetch;
|
|
62
62
|
/**
|
|
63
|
-
* Method
|
|
64
|
-
* @param
|
|
63
|
+
* Method to create the return list with all the data contained in the announcements, sorted by importance while avoiding duplicates
|
|
64
|
+
* @param matches List of all the data contained in the announcements
|
|
65
65
|
* @private
|
|
66
66
|
*/
|
|
67
|
-
private
|
|
67
|
+
private fetchAll;
|
|
68
68
|
}
|
package/lib/connector.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const axios_1 = require("axios");
|
|
4
|
+
const types_1 = require("@eso-status/types");
|
|
4
5
|
const raw_1 = require("./raw");
|
|
5
6
|
/**
|
|
6
7
|
* Class for retrieving information from announcements
|
|
@@ -50,7 +51,7 @@ class Connector {
|
|
|
50
51
|
* @private
|
|
51
52
|
*/
|
|
52
53
|
getMessages() {
|
|
53
|
-
['
|
|
54
|
+
['AlertMessage', 'WarningMessage'].forEach((type) => this.getMessagesByType(type));
|
|
54
55
|
}
|
|
55
56
|
/**
|
|
56
57
|
* Method for retrieving raw announcements based on the announcement level
|
|
@@ -73,12 +74,17 @@ class Connector {
|
|
|
73
74
|
replace() {
|
|
74
75
|
this.raw = this.raw.map((raw) => {
|
|
75
76
|
let initialRaw = raw;
|
|
77
|
+
initialRaw = initialRaw.replace(' 。', '');
|
|
76
78
|
initialRaw = initialRaw.replace(/<br\/>\n/g, '<br>');
|
|
77
79
|
initialRaw = initialRaw.replace('. <br>', '.<br>');
|
|
78
|
-
|
|
79
|
-
|
|
80
|
+
initialRaw = initialRaw.replace(' Thank you for your patience.', '');
|
|
81
|
+
if (initialRaw.includes('. Please check here for status updates: <a href')) {
|
|
82
|
+
return initialRaw.split(' Please check here for status updates: <a href')[0];
|
|
80
83
|
}
|
|
81
|
-
|
|
84
|
+
if (initialRaw.includes('. <a href')) {
|
|
85
|
+
return initialRaw.split(' <a href')[0];
|
|
86
|
+
}
|
|
87
|
+
return initialRaw.replace('. ', '.');
|
|
82
88
|
});
|
|
83
89
|
}
|
|
84
90
|
/**
|
|
@@ -109,16 +115,34 @@ class Connector {
|
|
|
109
115
|
* @private
|
|
110
116
|
*/
|
|
111
117
|
fetch() {
|
|
112
|
-
|
|
118
|
+
const matches = [];
|
|
119
|
+
this.raw.forEach((raw) => {
|
|
120
|
+
new raw_1.default(this.url, raw).matches.forEach((match) => {
|
|
121
|
+
matches.push(match);
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
this.fetchAll(matches);
|
|
113
125
|
}
|
|
114
126
|
/**
|
|
115
|
-
* Method
|
|
116
|
-
* @param
|
|
127
|
+
* Method to create the return list with all the data contained in the announcements, sorted by importance while avoiding duplicates
|
|
128
|
+
* @param matches List of all the data contained in the announcements
|
|
117
129
|
* @private
|
|
118
130
|
*/
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
this.rawEsoStatus.
|
|
131
|
+
fetchAll(matches) {
|
|
132
|
+
matches.forEach((match) => {
|
|
133
|
+
const alreadyInList = this.rawEsoStatus.filter((esoStatusRawData) => esoStatusRawData.slug === match.slug).length !== 0;
|
|
134
|
+
const alone = matches.filter((esoStatusRawData) => esoStatusRawData.slug === match.slug).length === 1;
|
|
135
|
+
const slugIsIssues = matches.filter((esoStatusRawData) => esoStatusRawData.status === types_1.IssuesStatus &&
|
|
136
|
+
esoStatusRawData.slug === match.slug).length !== 0;
|
|
137
|
+
const slugIsUp = matches.filter((esoStatusRawData) => esoStatusRawData.status === types_1.UpStatus &&
|
|
138
|
+
esoStatusRawData.slug === match.slug).length !== 0;
|
|
139
|
+
if (!alreadyInList) {
|
|
140
|
+
if (alone ||
|
|
141
|
+
(match.status === types_1.IssuesStatus && slugIsIssues) ||
|
|
142
|
+
(match.status === types_1.UpStatus && slugIsUp)) {
|
|
143
|
+
this.rawEsoStatus.push(match);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
122
146
|
});
|
|
123
147
|
}
|
|
124
148
|
}
|
|
@@ -54,6 +54,7 @@ class SlugIdentifier {
|
|
|
54
54
|
*/
|
|
55
55
|
this.ServerPsEuMatchesList = [
|
|
56
56
|
'PlayStation®: NA and EU megaservers for',
|
|
57
|
+
'The PlayStation™ Network',
|
|
57
58
|
];
|
|
58
59
|
/**
|
|
59
60
|
* List of indicators proving that the announcement pertains to the slug server_ps_na
|
|
@@ -61,6 +62,7 @@ class SlugIdentifier {
|
|
|
61
62
|
*/
|
|
62
63
|
this.ServerPsNaMatchesList = [
|
|
63
64
|
'PlayStation®: NA and EU megaservers for',
|
|
65
|
+
'The PlayStation™ Network',
|
|
64
66
|
];
|
|
65
67
|
/**
|
|
66
68
|
* List of indicators proving that the announcement pertains to the slug server_xbox_eu
|
|
@@ -33,6 +33,11 @@ export default class StatusIdentifier {
|
|
|
33
33
|
* @private
|
|
34
34
|
*/
|
|
35
35
|
private readonly plannedMatchesList;
|
|
36
|
+
/**
|
|
37
|
+
* List of indicators proving that the announcement pertains to the status issues
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
40
|
+
private readonly issuesMatchesList;
|
|
36
41
|
/**
|
|
37
42
|
* @param raw Raw data of the announcement
|
|
38
43
|
*/
|
|
@@ -14,7 +14,12 @@ class StatusIdentifier {
|
|
|
14
14
|
* List of statuses to check for presence in the announcement
|
|
15
15
|
* @private
|
|
16
16
|
*/
|
|
17
|
-
this.statusList = [
|
|
17
|
+
this.statusList = [
|
|
18
|
+
types_1.UpStatus,
|
|
19
|
+
types_1.DownStatus,
|
|
20
|
+
types_1.PlannedStatus,
|
|
21
|
+
types_1.IssuesStatus,
|
|
22
|
+
];
|
|
18
23
|
/**
|
|
19
24
|
* List of indicators proving that the announcement pertains to the status up
|
|
20
25
|
* @private
|
|
@@ -23,6 +28,7 @@ class StatusIdentifier {
|
|
|
23
28
|
'[COMPLETE]',
|
|
24
29
|
'now available',
|
|
25
30
|
'complete',
|
|
31
|
+
'been resolved',
|
|
26
32
|
];
|
|
27
33
|
/**
|
|
28
34
|
* List of indicators proving that the announcement pertains to the status down
|
|
@@ -40,6 +46,13 @@ class StatusIdentifier {
|
|
|
40
46
|
this.plannedMatchesList = [
|
|
41
47
|
'We will be performing maintenance',
|
|
42
48
|
];
|
|
49
|
+
/**
|
|
50
|
+
* List of indicators proving that the announcement pertains to the status issues
|
|
51
|
+
* @private
|
|
52
|
+
*/
|
|
53
|
+
this.issuesMatchesList = [
|
|
54
|
+
'is currently experiencing a service interruption',
|
|
55
|
+
];
|
|
43
56
|
this.statusList.forEach((status) => this.identify(status));
|
|
44
57
|
this.default();
|
|
45
58
|
}
|
package/lib/raw.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { EsoStatusRawData } from './interface/esoStatusRawData.interface';
|
|
|
4
4
|
* Class containing announcement information
|
|
5
5
|
*/
|
|
6
6
|
export default class Raw {
|
|
7
|
-
private url;
|
|
8
|
-
private raw;
|
|
7
|
+
private readonly url;
|
|
8
|
+
private readonly raw;
|
|
9
9
|
/**
|
|
10
10
|
* Status identification class
|
|
11
11
|
* @private
|
|
@@ -20,7 +20,7 @@ export default class Raw {
|
|
|
20
20
|
* Class for identifying the list of slugs
|
|
21
21
|
* @private
|
|
22
22
|
*/
|
|
23
|
-
private slugsIdentifier;
|
|
23
|
+
private readonly slugsIdentifier;
|
|
24
24
|
/**
|
|
25
25
|
* List of information about slugs found in the announcement
|
|
26
26
|
*/
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { RemoteUpRawStatus } from './remoteUpRawStatus.type';
|
|
2
2
|
import { RemoteDownRawStatus } from './remoteDownRawStatus.type';
|
|
3
3
|
import { RemotePlannedRawStatus } from './remotePlannedRawStatus.type';
|
|
4
|
+
import { RemoteIssuesRawStatus } from './remoteIssuesRawStatus.type';
|
|
4
5
|
/**
|
|
5
6
|
* Different statuses of announcements
|
|
6
7
|
*/
|
|
7
|
-
export type RemoteRawStatus = RemoteUpRawStatus | RemoteDownRawStatus | RemotePlannedRawStatus;
|
|
8
|
+
export type RemoteRawStatus = RemoteUpRawStatus | RemoteDownRawStatus | RemotePlannedRawStatus | RemoteIssuesRawStatus;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Different slugs of announcements concerning the European PlayStation® Megaserver
|
|
3
3
|
*/
|
|
4
|
-
export type RemoteServerPsEuRawSlug = 'PlayStation®: NA and EU megaservers for';
|
|
4
|
+
export type RemoteServerPsEuRawSlug = 'PlayStation®: NA and EU megaservers for' | 'The PlayStation™ Network';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Different slugs of announcements concerning the North American PlayStation® Megaserver
|
|
3
3
|
*/
|
|
4
|
-
export type RemoteServerPsNaRawSlug = 'PlayStation®: NA and EU megaservers for';
|
|
4
|
+
export type RemoteServerPsNaRawSlug = 'PlayStation®: NA and EU megaservers for' | 'The PlayStation™ Network';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Different statuses of announcements indicating that the announcement refers to an accessible service/server
|
|
3
3
|
*/
|
|
4
|
-
export type RemoteUpRawStatus = '[COMPLETE]' | 'now available' | 'complete';
|
|
4
|
+
export type RemoteUpRawStatus = '[COMPLETE]' | 'now available' | 'complete' | 'been resolved';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eso-status/forum-message",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.7",
|
|
4
4
|
"description": "Library for retrieving and formatting data, available at https://forums.elderscrollsonline.com or https://forums.elderscrollsonline.com/en/categories/pts",
|
|
5
5
|
"author": "@dov118 <contact@dov118.dev> (https://dov118.dev)",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -91,18 +91,18 @@
|
|
|
91
91
|
"moment": "2.30.1"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
|
-
"@types/jest": "29.5.
|
|
95
|
-
"eslint": "8.57.
|
|
94
|
+
"@types/jest": "29.5.13",
|
|
95
|
+
"eslint": "8.57.1",
|
|
96
96
|
"eslint-config-airbnb-base": "15.0.0",
|
|
97
97
|
"eslint-config-airbnb-typescript": "18.0.0",
|
|
98
98
|
"eslint-config-prettier": "9.1.0",
|
|
99
99
|
"eslint-plugin-jest": "28.8.3",
|
|
100
100
|
"eslint-plugin-prettier": "5.2.1",
|
|
101
|
-
"eslint-plugin-sonarjs": "2.0.
|
|
102
|
-
"eslint-plugin-unused-imports": "4.1.
|
|
103
|
-
"husky": "9.1.
|
|
101
|
+
"eslint-plugin-sonarjs": "2.0.3",
|
|
102
|
+
"eslint-plugin-unused-imports": "4.1.4",
|
|
103
|
+
"husky": "9.1.6",
|
|
104
104
|
"jest": "29.7.0",
|
|
105
|
-
"nodemon": "3.1.
|
|
105
|
+
"nodemon": "3.1.7",
|
|
106
106
|
"prettier": "3.3.3",
|
|
107
107
|
"ts-jest": "29.2.5",
|
|
108
108
|
"typescript": "5.5.4"
|