@eso-status/service-alerts 2.0.0-dev.7 → 2.0.0-dev.9

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.js CHANGED
@@ -7,24 +7,25 @@ const raw_1 = require("./raw");
7
7
  * Class for retrieving information from announcements
8
8
  */
9
9
  class Connector {
10
+ remoteContent;
11
+ /**
12
+ * List of raw data from announcements
13
+ */
14
+ raw = [];
15
+ /**
16
+ * List of information from announcements
17
+ */
18
+ rawEsoStatus = [];
19
+ /**
20
+ * List of slugs whose data has already been retrieved
21
+ * @private
22
+ */
23
+ alreadyGet = [];
10
24
  /**
11
25
  * @param remoteContent Content of the source retrieved
12
26
  */
13
27
  constructor(remoteContent) {
14
28
  this.remoteContent = remoteContent;
15
- /**
16
- * List of raw data from announcements
17
- */
18
- this.raw = [];
19
- /**
20
- * List of information from announcements
21
- */
22
- this.rawEsoStatus = [];
23
- /**
24
- * List of slugs whose data has already been retrieved
25
- * @private
26
- */
27
- this.alreadyGet = [];
28
29
  if (!this.remoteContent) {
29
30
  return;
30
31
  }
@@ -45,9 +46,7 @@ class Connector {
45
46
  */
46
47
  static async getRemoteContent() {
47
48
  const response = await axios_1.default.get(const_1.default);
48
- return response?.status === 200 && !!response?.data
49
- ? String(response?.data)
50
- : '';
49
+ return response.status === 200 && !!response.data ? response.data : '';
51
50
  }
52
51
  /**
53
52
  * Method for isolating the section containing the list of announcements
@@ -78,7 +77,7 @@ class Connector {
78
77
  this.raw = this.raw.map((raw) => {
79
78
  return raw
80
79
  .replaceAll('<!-- ENTER ESO SERVICE ALERTS BELOW THIS LINE -->', '')
81
- .replaceAll(/\n/g, '')
80
+ .replaceAll('\n', '')
82
81
  .replaceAll(' <p>', '<p>')
83
82
  .replaceAll(' <p>', '<p>')
84
83
  .replaceAll(' <p>', '<p>')
@@ -97,7 +96,9 @@ class Connector {
97
96
  * @private
98
97
  */
99
98
  fetch() {
100
- this.raw.forEach((raw) => this.getEach(raw));
99
+ this.raw.forEach((raw) => {
100
+ this.getEach(raw);
101
+ });
101
102
  }
102
103
  /**
103
104
  * Method for retrieving the information contained in an announcement
@@ -105,7 +106,9 @@ class Connector {
105
106
  * @private
106
107
  */
107
108
  getEach(raw) {
108
- new raw_1.default(raw).matches.forEach((match) => this.populateRawEsoStatus(match));
109
+ new raw_1.default(raw).matches.forEach((match) => {
110
+ this.populateRawEsoStatus(match);
111
+ });
109
112
  }
110
113
  /**
111
114
  * Method for creating the list of announcements while avoiding duplicates
@@ -5,6 +5,15 @@ const moment = require("moment");
5
5
  * Class for identifying and formatting the date contained in an announcement
6
6
  */
7
7
  class DateFormatter {
8
+ raw;
9
+ /**
10
+ * Raw date data contained in the announcement
11
+ */
12
+ rawDate;
13
+ /**
14
+ * List of dates formatted correctly contained in the announcement (ISO 8601)
15
+ */
16
+ dates;
8
17
  /**
9
18
  * @param raw Raw data of the announcement
10
19
  */
@@ -6,97 +6,104 @@ const slug_match_1 = require("./slug.match");
6
6
  * Class for identifying the list of slugs contained in an announcement
7
7
  */
8
8
  class SlugIdentifier {
9
+ raw;
10
+ /**
11
+ * List of slug information found in the announcement
12
+ */
13
+ slugMatches;
14
+ /**
15
+ * List of slugs to check for presence in the announcement
16
+ * @private
17
+ */
18
+ 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
+ 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
+ ServerPsEuMatchesList = [
42
+ 'The European megaservers',
43
+ 'The European PlayStation® megaserver',
44
+ 'PlayStation™ Network',
45
+ ];
46
+ /**
47
+ * List of indicators proving that the announcement pertains to the slug server_xbox_eu
48
+ * @private
49
+ */
50
+ ServerXboxEuMatchesList = [
51
+ 'The European megaservers',
52
+ 'The European Xbox megaserver',
53
+ 'North American and European Xbox megaservers',
54
+ 'Xbox Live™',
55
+ ];
56
+ /**
57
+ * List of indicators proving that the announcement pertains to the slug server_pc_na
58
+ * @private
59
+ */
60
+ ServerPcNaMatchesList = [
61
+ 'The North American megaservers',
62
+ 'North American PC/Mac megaserver',
63
+ ];
64
+ /**
65
+ * List of indicators proving that the announcement pertains to the slug server_ps_na
66
+ * @private
67
+ */
68
+ ServerPsNaMatchesList = [
69
+ 'The North American megaservers',
70
+ 'North American PlayStation® megaserver',
71
+ 'PlayStation™ Network',
72
+ ];
73
+ /**
74
+ * List of indicators proving that the announcement pertains to the slug server_xbox_na
75
+ * @private
76
+ */
77
+ ServerXboxNaMatchesList = [
78
+ 'The North American megaservers',
79
+ 'The North American Xbox megaserver',
80
+ 'North American and European Xbox megaservers',
81
+ 'Xbox Live™',
82
+ ];
83
+ /**
84
+ * List of indicators proving that the announcement pertains to the slug server_pc_pts
85
+ * @private
86
+ */
87
+ ServerPcPtsMatchesList = ['PTS'];
88
+ /**
89
+ * List of indicators proving that the announcement pertains to the slug service_store_eso
90
+ * @private
91
+ */
92
+ ServiceStoreEsoMatchesList = ['ESO store'];
93
+ /**
94
+ * List of indicators proving that the announcement pertains to the slug service_system_account
95
+ * @private
96
+ */
97
+ ServiceSystemAccountMatchesList = ['account system'];
9
98
  /**
10
99
  * @param raw Raw data of the announcement
11
100
  */
12
101
  constructor(raw) {
13
102
  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
- 'PlayStation™ Network',
45
- ];
46
- /**
47
- * List of indicators proving that the announcement pertains to the slug server_xbox_eu
48
- * @private
49
- */
50
- this.ServerXboxEuMatchesList = [
51
- 'The European megaservers',
52
- 'The European Xbox megaserver',
53
- 'North American and European Xbox megaservers',
54
- 'Xbox Live™',
55
- ];
56
- /**
57
- * List of indicators proving that the announcement pertains to the slug server_pc_na
58
- * @private
59
- */
60
- this.ServerPcNaMatchesList = [
61
- 'The North American megaservers',
62
- 'North American PC/Mac megaserver',
63
- ];
64
- /**
65
- * List of indicators proving that the announcement pertains to the slug server_ps_na
66
- * @private
67
- */
68
- this.ServerPsNaMatchesList = [
69
- 'The North American megaservers',
70
- 'North American PlayStation® megaserver',
71
- 'PlayStation™ Network',
72
- ];
73
- /**
74
- * List of indicators proving that the announcement pertains to the slug server_xbox_na
75
- * @private
76
- */
77
- this.ServerXboxNaMatchesList = [
78
- 'The North American megaservers',
79
- 'The North American Xbox megaserver',
80
- 'North American and European Xbox megaservers',
81
- 'Xbox Live™',
82
- ];
83
- /**
84
- * List of indicators proving that the announcement pertains to the slug server_pc_pts
85
- * @private
86
- */
87
- this.ServerPcPtsMatchesList = ['PTS'];
88
- /**
89
- * List of indicators proving that the announcement pertains to the slug service_store_eso
90
- * @private
91
- */
92
- this.ServiceStoreEsoMatchesList = ['ESO store'];
93
- /**
94
- * List of indicators proving that the announcement pertains to the slug service_system_account
95
- * @private
96
- */
97
- this.ServiceSystemAccountMatchesList = ['account system'];
98
103
  this.slugMatches = [];
99
- this.slugList.forEach((slug) => this.identify(slug));
104
+ this.slugList.forEach((slug) => {
105
+ this.identify(slug);
106
+ });
100
107
  }
101
108
  /**
102
109
  * Method for retrieving the list of indicators for a slug to test
@@ -104,7 +111,8 @@ class SlugIdentifier {
104
111
  * @private
105
112
  */
106
113
  getMatchList(slug) {
107
- return this[SlugIdentifier.getMatchListName(slug)];
114
+ const key = SlugIdentifier.getMatchListName(slug);
115
+ return this[key];
108
116
  }
109
117
  /**
110
118
  * Method for retrieving the name of the list of indicators for a slug to test
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  * Class for retrieving information about a slug found in an announcement
5
5
  */
6
6
  class SlugMatch {
7
+ rawSlug;
8
+ slug;
7
9
  /**
8
10
  * @param rawSlug Data used to identify the presence of the slug in the announcement
9
11
  * @param slug Slug found in the announcement
@@ -5,40 +5,51 @@ const types_1 = require("@eso-status/types");
5
5
  * Class for identifying the status contained in an announcement
6
6
  */
7
7
  class StatusIdentifier {
8
+ raw;
9
+ /**
10
+ * Data used to identify the presence of the status in the announcement
11
+ */
12
+ rawStatus;
13
+ /**
14
+ * Status found in the announcement
15
+ */
16
+ status;
17
+ /**
18
+ * List of statuses to check for presence in the announcement
19
+ * @private
20
+ */
21
+ statusList = [types_1.UpStatus, types_1.DownStatus, types_1.IssuesStatus];
22
+ /**
23
+ * List of indicators proving that the announcement pertains to the status up
24
+ * @private
25
+ */
26
+ upMatchesList = [
27
+ 'currently available',
28
+ 'been resolved',
29
+ ];
30
+ /**
31
+ * List of indicators proving that the announcement pertains to the status down
32
+ * @private
33
+ */
34
+ downMatchesList = [
35
+ 'currently unavailable',
36
+ ];
37
+ /**
38
+ * List of indicators proving that the announcement pertains to the status planned
39
+ * @private
40
+ */
41
+ issuesMatchesList = [
42
+ 'currently investigating',
43
+ 'currently experiencing a service interruption',
44
+ ];
8
45
  /**
9
46
  * @param raw Raw data of the announcement
10
47
  */
11
48
  constructor(raw) {
12
49
  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',
39
- 'currently experiencing a service interruption',
40
- ];
41
- this.statusList.forEach((status) => this.identify(status));
50
+ this.statusList.forEach((status) => {
51
+ this.identify(status);
52
+ });
42
53
  }
43
54
  /**
44
55
  * Method for retrieving the list of indicators for a status to test
@@ -46,7 +57,8 @@ class StatusIdentifier {
46
57
  * @private
47
58
  */
48
59
  getMatchList(status) {
49
- return this[`${status}MatchesList`];
60
+ const key = `${status}MatchesList`;
61
+ return this[key];
50
62
  }
51
63
  /**
52
64
  * Method for retrieving the indicators of a status present in the announcement
package/lib/index.js CHANGED
@@ -4,6 +4,7 @@ const connector_1 = require("./connector");
4
4
  /**
5
5
  * Class for retrieving announcement information
6
6
  */
7
+ /* eslint-disable @typescript-eslint/no-extraneous-class */
7
8
  class ServiceAlerts {
8
9
  /**
9
10
  * Method for retrieving announcement information
@@ -13,4 +14,5 @@ class ServiceAlerts {
13
14
  }
14
15
  }
15
16
  exports.default = ServiceAlerts;
17
+ /* eslint-enable @typescript-eslint/no-extraneous-class */
16
18
  //# sourceMappingURL=index.js.map
package/lib/raw.js CHANGED
@@ -8,15 +8,31 @@ const const_1 = require("./const");
8
8
  * Class containing announcement information
9
9
  */
10
10
  class Raw {
11
+ raw;
12
+ /**
13
+ * Status identification class
14
+ * @private
15
+ */
16
+ statusIdentifier;
17
+ /**
18
+ * Class for identifying and formatting the date(s)
19
+ * @private
20
+ */
21
+ dateFormatter;
22
+ /**
23
+ * Class for identifying the list of slugs
24
+ * @private
25
+ */
26
+ slugsIdentifier;
27
+ /**
28
+ * List of information about slugs found in the announcement
29
+ */
30
+ matches = [];
11
31
  /**
12
32
  * @param raw Raw data of the announcement
13
33
  */
14
34
  constructor(raw) {
15
35
  this.raw = raw;
16
- /**
17
- * List of information about slugs found in the announcement
18
- */
19
- this.matches = [];
20
36
  this.statusIdentifier = new status_identifier_1.default(this.raw);
21
37
  this.dateFormatter = new date_formatter_1.default(this.raw);
22
38
  this.slugsIdentifier = new slug_identifier_1.default(this.raw);
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@eso-status/service-alerts",
3
- "version": "2.0.0-dev.7",
3
+ "version": "2.0.0-dev.9",
4
4
  "description": "Library for retrieving and formatting data, available at https://help.elderscrollsonline.com/app/answers/detail/a_id/4320.",
5
- "author": "@dov118 <contact@dov118.dev> (https://dov118.dev)",
5
+ "author": "@dov118 <contact.dov118.dev@gmail.com> (https://dov118.dev)",
6
6
  "main": "lib/index.js",
7
7
  "license": "MIT",
8
8
  "engineStrict": true,
@@ -61,7 +61,7 @@
61
61
  "README.md"
62
62
  ],
63
63
  "engines": {
64
- "node": "^18.12.0 || <23.0.0"
64
+ "node": "^20.19.0 || ^22.13.0 || >=24"
65
65
  },
66
66
  "bugs": {
67
67
  "url": "https://github.com/eso-status/service-alerts/issues"
@@ -78,32 +78,42 @@
78
78
  "build": "rm -R -f lib/* && tsc --project tsconfig.build.json",
79
79
  "dev": "npm run build && node .",
80
80
  "watch": "nodemon --exec npm run dev",
81
- "test": "npm run build && jest --runInBand --setupFiles",
82
- "test:watch": "jest --runInBand --watch --setupFiles",
83
- "test:cov": "jest --runInBand --coverage --setupFiles",
81
+ "test": "npm run build && jest --runInBand",
82
+ "test:watch": "jest --runInBand --watch",
83
+ "test:cov": "jest --runInBand --coverage",
84
84
  "prepare": "husky"
85
85
  },
86
86
  "dependencies": {
87
- "@eso-status/types": "2.0.0-dev.16",
88
- "axios": "1.7.9",
87
+ "@eso-status/types": "2.0.0-dev.17",
88
+ "axios": "1.13.6",
89
89
  "moment": "2.30.1"
90
90
  },
91
+ "lint-staged": {
92
+ "*.ts": [
93
+ "eslint --fix",
94
+ "prettier --write"
95
+ ],
96
+ "*.{json,md,yml,yaml}": [
97
+ "prettier --write"
98
+ ]
99
+ },
91
100
  "devDependencies": {
92
- "@types/jest": "29.5.10",
93
- "eslint": "8.57.1",
94
- "eslint-config-airbnb-base": "15.0.0",
95
- "eslint-config-airbnb-typescript": "18.0.0",
96
- "eslint-config-prettier": "10.0.1",
97
- "eslint-plugin-jest": "28.11.0",
98
- "eslint-plugin-prettier": "5.2.3",
99
- "eslint-plugin-sonarjs": "3.0.1",
100
- "eslint-plugin-unused-imports": "4.1.4",
101
+ "@eslint/js": "10.0.1",
102
+ "@types/jest": "30.0.0",
103
+ "eslint": "10.0.3",
104
+ "eslint-config-prettier": "10.1.8",
105
+ "eslint-plugin-jest": "29.15.0",
106
+ "eslint-plugin-sonarjs": "4.0.2",
107
+ "eslint-plugin-unused-imports": "4.4.1",
108
+ "globals": "17.4.0",
101
109
  "husky": "9.1.7",
102
- "jest": "29.7.0",
103
- "nodemon": "3.1.9",
104
- "prettier": "3.5.0",
105
- "ts-jest": "29.2.5",
106
- "typescript": "5.4.5"
110
+ "jest": "30.3.0",
111
+ "lint-staged": "16.3.3",
112
+ "nodemon": "3.1.14",
113
+ "prettier": "3.8.1",
114
+ "ts-jest": "29.4.6",
115
+ "typescript": "5.9.3",
116
+ "typescript-eslint": "8.57.0"
107
117
  },
108
118
  "jest": {
109
119
  "moduleFileExtensions": [
@@ -121,9 +131,6 @@
121
131
  ],
122
132
  "coverageDirectory": "./coverage",
123
133
  "testEnvironment": "node",
124
- "setupFiles": [
125
- "dotenv/config"
126
- ],
127
134
  "moduleDirectories": [
128
135
  "node_modules",
129
136
  "src"