@eso-status/forum-message 2.0.0-dev.18 → 2.0.0-dev.19

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
@@ -6,6 +6,16 @@ const raw_1 = require("./raw");
6
6
  * Class for retrieving information from announcements
7
7
  */
8
8
  class Connector {
9
+ url;
10
+ remoteContent;
11
+ /**
12
+ * List of raw data from announcements
13
+ */
14
+ raw = [];
15
+ /**
16
+ * List of information from announcements
17
+ */
18
+ rawEsoStatus = [];
9
19
  /**
10
20
  * @param url URL used as the source to retrieve announcements
11
21
  * @param remoteContent Content of the source retrieved via URL
@@ -13,14 +23,6 @@ class Connector {
13
23
  constructor(url, remoteContent) {
14
24
  this.url = url;
15
25
  this.remoteContent = remoteContent;
16
- /**
17
- * List of raw data from announcements
18
- */
19
- this.raw = [];
20
- /**
21
- * List of information from announcements
22
- */
23
- this.rawEsoStatus = [];
24
26
  this.getMessages();
25
27
  this.replace();
26
28
  this.split();
@@ -41,16 +43,16 @@ class Connector {
41
43
  */
42
44
  static async getRemoteContent(url) {
43
45
  const response = await axios_1.default.get(url);
44
- return response?.status === 200 && !!response?.data
45
- ? String(response?.data)
46
- : '';
46
+ return response.status === 200 && !!response.data ? response.data : '';
47
47
  }
48
48
  /**
49
49
  * Method for retrieving raw announcements for all announcement levels
50
50
  * @private
51
51
  */
52
52
  getMessages() {
53
- ['AlertMessage', 'WarningMessage'].forEach((type) => this.getMessagesByType(type));
53
+ ['AlertMessage', 'WarningMessage'].forEach((type) => {
54
+ this.getMessagesByType(type);
55
+ });
54
56
  }
55
57
  /**
56
58
  * Method for retrieving raw announcements based on the announcement level
@@ -141,7 +143,9 @@ class Connector {
141
143
  * @private
142
144
  */
143
145
  fetch() {
144
- this.raw.forEach((raw) => this.fetchEach(raw));
146
+ this.raw.forEach((raw) => {
147
+ this.fetchEach(raw);
148
+ });
145
149
  }
146
150
  /**
147
151
  * Method for retrieving the information contained in an announcement
@@ -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,114 +6,121 @@ 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.ServerPcNaSlug,
21
+ types_1.ServerPcPtsSlug,
22
+ types_1.ServerPsEuSlug,
23
+ types_1.ServerPsNaSlug,
24
+ types_1.ServerXboxEuSlug,
25
+ types_1.ServerXboxNaSlug,
26
+ types_1.ServiceStoreEsoSlug,
27
+ types_1.ServiceSystemAccountSlug,
28
+ types_1.ServiceWebSiteSlug,
29
+ ];
30
+ /**
31
+ * List of indicators proving that the announcement pertains to the slug server_pc_eu
32
+ * @private
33
+ */
34
+ ServerPcEuMatchesList = [
35
+ 'PC/Mac: EU megaserver for',
36
+ 'PC/Mac: NA and EU megaservers for',
37
+ '] EU megaservers for',
38
+ '• EU megaservers for',
39
+ ];
40
+ /**
41
+ * List of indicators proving that the announcement pertains to the slug server_pc_na
42
+ * @private
43
+ */
44
+ ServerPcNaMatchesList = [
45
+ 'PC/Mac: NA megaserver for',
46
+ 'PC/Mac: NA and EU megaservers for',
47
+ '] NA megaservers for',
48
+ '• NA megaservers for',
49
+ 'North American PC/Mac megaserver',
50
+ ];
51
+ /**
52
+ * List of indicators proving that the announcement pertains to the slug server_pc_pts
53
+ * @private
54
+ */
55
+ ServerPcPtsMatchesList = ['PTS'];
56
+ /**
57
+ * List of indicators proving that the announcement pertains to the slug server_ps_eu
58
+ * @private
59
+ */
60
+ ServerPsEuMatchesList = [
61
+ 'PlayStation®: NA and EU megaservers for',
62
+ 'The PlayStation™ Network',
63
+ '] EU megaservers for',
64
+ '• EU megaservers for',
65
+ ];
66
+ /**
67
+ * List of indicators proving that the announcement pertains to the slug server_ps_na
68
+ * @private
69
+ */
70
+ ServerPsNaMatchesList = [
71
+ 'PlayStation®: NA and EU megaservers for',
72
+ 'The PlayStation™ Network',
73
+ '] NA megaservers for',
74
+ '• NA megaservers for',
75
+ 'North American PlayStation® megaserver',
76
+ ];
77
+ /**
78
+ * List of indicators proving that the announcement pertains to the slug server_xbox_eu
79
+ * @private
80
+ */
81
+ ServerXboxEuMatchesList = [
82
+ 'Xbox: NA and EU megaservers for',
83
+ 'Xbox: EU megaserver for',
84
+ '] EU megaservers for',
85
+ '• EU megaservers for',
86
+ 'Xbox Live™',
87
+ ];
88
+ /**
89
+ * List of indicators proving that the announcement pertains to the slug server_xbox_na
90
+ * @private
91
+ */
92
+ ServerXboxNaMatchesList = [
93
+ 'Xbox: NA and EU megaservers for',
94
+ '] NA megaservers for',
95
+ '• NA megaservers for',
96
+ 'Xbox Live™',
97
+ ];
98
+ /**
99
+ * List of indicators proving that the announcement pertains to the slug service_store_eso
100
+ * @private
101
+ */
102
+ ServiceStoreEsoMatchesList = ['ESO Store and Account System for'];
103
+ /**
104
+ * List of indicators proving that the announcement pertains to the slug service_system_account
105
+ * @private
106
+ */
107
+ ServiceSystemAccountMatchesList = ['ESO Store and Account System for'];
108
+ /**
109
+ * List of indicators proving that the announcement pertains to the slug service_web_site
110
+ * @private
111
+ */
112
+ ServiceWebSiteMatchesList = [
113
+ 'ESO Website for',
114
+ ];
9
115
  /**
10
116
  * @param raw Raw data of the announcement
11
117
  */
12
118
  constructor(raw) {
13
119
  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.ServerPcNaSlug,
21
- types_1.ServerPcPtsSlug,
22
- types_1.ServerPsEuSlug,
23
- types_1.ServerPsNaSlug,
24
- types_1.ServerXboxEuSlug,
25
- types_1.ServerXboxNaSlug,
26
- types_1.ServiceStoreEsoSlug,
27
- types_1.ServiceSystemAccountSlug,
28
- types_1.ServiceWebSiteSlug,
29
- ];
30
- /**
31
- * List of indicators proving that the announcement pertains to the slug server_pc_eu
32
- * @private
33
- */
34
- this.ServerPcEuMatchesList = [
35
- 'PC/Mac: EU megaserver for',
36
- 'PC/Mac: NA and EU megaservers for',
37
- '] EU megaservers for',
38
- '• EU megaservers for',
39
- ];
40
- /**
41
- * List of indicators proving that the announcement pertains to the slug server_pc_na
42
- * @private
43
- */
44
- this.ServerPcNaMatchesList = [
45
- 'PC/Mac: NA megaserver for',
46
- 'PC/Mac: NA and EU megaservers for',
47
- '] NA megaservers for',
48
- '• NA megaservers for',
49
- 'North American PC/Mac megaserver',
50
- ];
51
- /**
52
- * List of indicators proving that the announcement pertains to the slug server_pc_pts
53
- * @private
54
- */
55
- this.ServerPcPtsMatchesList = ['PTS'];
56
- /**
57
- * List of indicators proving that the announcement pertains to the slug server_ps_eu
58
- * @private
59
- */
60
- this.ServerPsEuMatchesList = [
61
- 'PlayStation®: NA and EU megaservers for',
62
- 'The PlayStation™ Network',
63
- '] EU megaservers for',
64
- '• EU megaservers for',
65
- ];
66
- /**
67
- * List of indicators proving that the announcement pertains to the slug server_ps_na
68
- * @private
69
- */
70
- this.ServerPsNaMatchesList = [
71
- 'PlayStation®: NA and EU megaservers for',
72
- 'The PlayStation™ Network',
73
- '] NA megaservers for',
74
- '• NA megaservers for',
75
- 'North American PlayStation® megaserver',
76
- ];
77
- /**
78
- * List of indicators proving that the announcement pertains to the slug server_xbox_eu
79
- * @private
80
- */
81
- this.ServerXboxEuMatchesList = [
82
- 'Xbox: NA and EU megaservers for',
83
- 'Xbox: EU megaserver for',
84
- '] EU megaservers for',
85
- '• EU megaservers for',
86
- 'Xbox Live™',
87
- ];
88
- /**
89
- * List of indicators proving that the announcement pertains to the slug server_xbox_na
90
- * @private
91
- */
92
- this.ServerXboxNaMatchesList = [
93
- 'Xbox: NA and EU megaservers for',
94
- '] NA megaservers for',
95
- '• NA megaservers for',
96
- 'Xbox Live™',
97
- ];
98
- /**
99
- * List of indicators proving that the announcement pertains to the slug service_store_eso
100
- * @private
101
- */
102
- this.ServiceStoreEsoMatchesList = ['ESO Store and Account System for'];
103
- /**
104
- * List of indicators proving that the announcement pertains to the slug service_system_account
105
- * @private
106
- */
107
- this.ServiceSystemAccountMatchesList = ['ESO Store and Account System for'];
108
- /**
109
- * List of indicators proving that the announcement pertains to the slug service_web_site
110
- * @private
111
- */
112
- this.ServiceWebSiteMatchesList = [
113
- 'ESO Website for',
114
- ];
115
120
  this.slugMatches = [];
116
- this.slugList.forEach((slug) => this.identify(slug));
121
+ this.slugList.forEach((slug) => {
122
+ this.identify(slug);
123
+ });
117
124
  }
118
125
  /**
119
126
  * Method for retrieving the list of indicators for a slug to test
@@ -121,7 +128,8 @@ class SlugIdentifier {
121
128
  * @private
122
129
  */
123
130
  getMatchList(slug) {
124
- return this[SlugIdentifier.getMatchListName(slug)];
131
+ const key = SlugIdentifier.getMatchListName(slug);
132
+ return this[key];
125
133
  }
126
134
  /**
127
135
  * 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
@@ -8,11 +8,11 @@ export default class StatusIdentifier {
8
8
  /**
9
9
  * Data used to identify the presence of the status in the announcement
10
10
  */
11
- rawStatus: RemoteRawStatus;
11
+ rawStatus: RemoteRawStatus | null;
12
12
  /**
13
13
  * Status found in the announcement
14
14
  */
15
- status: Status;
15
+ status: Status | null;
16
16
  /**
17
17
  * List of statuses to check for presence in the announcement
18
18
  * @private
@@ -5,57 +5,68 @@ 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 = [
22
+ types_1.UpStatus,
23
+ types_1.DownStatus,
24
+ types_1.PlannedStatus,
25
+ types_1.IssuesStatus,
26
+ ];
27
+ /**
28
+ * List of indicators proving that the announcement pertains to the status up
29
+ * @private
30
+ */
31
+ upMatchesList = [
32
+ '[COMPLETE]',
33
+ 'now available',
34
+ 'complete',
35
+ 'been resolved',
36
+ ];
37
+ /**
38
+ * List of indicators proving that the announcement pertains to the status down
39
+ * @private
40
+ */
41
+ downMatchesList = [
42
+ '[EXTENDED]',
43
+ '[IN PROGRESS]',
44
+ 'unavailable',
45
+ ];
46
+ /**
47
+ * List of indicators proving that the announcement pertains to the status planned
48
+ * @private
49
+ */
50
+ plannedMatchesList = [
51
+ 'We will be performing maintenance',
52
+ 'will be taken offline for maintenance',
53
+ ];
54
+ /**
55
+ * List of indicators proving that the announcement pertains to the status issues
56
+ * @private
57
+ */
58
+ issuesMatchesList = [
59
+ 'is currently experiencing a service interruption',
60
+ 'currently investigating',
61
+ ];
8
62
  /**
9
63
  * @param raw Raw data of the announcement
10
64
  */
11
65
  constructor(raw) {
12
66
  this.raw = raw;
13
- /**
14
- * List of statuses to check for presence in the announcement
15
- * @private
16
- */
17
- this.statusList = [
18
- types_1.UpStatus,
19
- types_1.DownStatus,
20
- types_1.PlannedStatus,
21
- types_1.IssuesStatus,
22
- ];
23
- /**
24
- * List of indicators proving that the announcement pertains to the status up
25
- * @private
26
- */
27
- this.upMatchesList = [
28
- '[COMPLETE]',
29
- 'now available',
30
- 'complete',
31
- 'been resolved',
32
- ];
33
- /**
34
- * List of indicators proving that the announcement pertains to the status down
35
- * @private
36
- */
37
- this.downMatchesList = [
38
- '[EXTENDED]',
39
- '[IN PROGRESS]',
40
- 'unavailable',
41
- ];
42
- /**
43
- * List of indicators proving that the announcement pertains to the status planned
44
- * @private
45
- */
46
- this.plannedMatchesList = [
47
- 'We will be performing maintenance',
48
- 'will be taken offline for maintenance',
49
- ];
50
- /**
51
- * List of indicators proving that the announcement pertains to the status issues
52
- * @private
53
- */
54
- this.issuesMatchesList = [
55
- 'is currently experiencing a service interruption',
56
- 'currently investigating',
57
- ];
58
- this.statusList.forEach((status) => this.identify(status));
67
+ this.statusList.forEach((status) => {
68
+ this.identify(status);
69
+ });
59
70
  this.default();
60
71
  }
61
72
  /**
@@ -92,9 +103,7 @@ class StatusIdentifier {
92
103
  * @private
93
104
  */
94
105
  default() {
95
- if (!this.status) {
96
- this.status = types_1.PlannedStatus;
97
- }
106
+ this.status ??= types_1.PlannedStatus;
98
107
  }
99
108
  }
100
109
  exports.default = StatusIdentifier;
package/lib/index.js CHANGED
@@ -5,6 +5,8 @@ const connector_1 = require("./connector");
5
5
  /**
6
6
  * Class for retrieving announcement information
7
7
  */
8
+ /* eslint-disable @typescript-eslint/no-extraneous-class */
9
+ /* eslint-disable @typescript-eslint/unified-signatures */
8
10
  class ForumMessage {
9
11
  /**
10
12
  * Method for retrieving announcement information
@@ -16,4 +18,6 @@ class ForumMessage {
16
18
  }
17
19
  }
18
20
  exports.default = ForumMessage;
21
+ /* eslint-enable @typescript-eslint/no-extraneous-class */
22
+ /* eslint-enable @typescript-eslint/unified-signatures */
19
23
  //# sourceMappingURL=index.js.map
package/lib/raw.js CHANGED
@@ -7,6 +7,27 @@ const slug_identifier_1 = require("./identifier/slug.identifier");
7
7
  * Class containing announcement information
8
8
  */
9
9
  class Raw {
10
+ url;
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 = [];
10
31
  /**
11
32
  * @param url URL used as the source to retrieve announcements
12
33
  * @param raw Raw data of the announcement
@@ -14,10 +35,6 @@ class Raw {
14
35
  constructor(url, raw) {
15
36
  this.url = url;
16
37
  this.raw = raw;
17
- /**
18
- * List of information about slugs found in the announcement
19
- */
20
- this.matches = [];
21
38
  this.statusIdentifier = new status_identifier_1.default(this.raw);
22
39
  this.dateFormatter = new date_formatter_1.default(this.raw);
23
40
  this.slugsIdentifier = new slug_identifier_1.default(this.raw);
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@eso-status/forum-message",
3
- "version": "2.0.0-dev.18",
3
+ "version": "2.0.0-dev.19",
4
4
  "description": "Library for retrieving and formatting data, available at https://forums.elderscrollsonline.com or https://forums.elderscrollsonline.com/en/categories/pts",
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,
@@ -65,7 +65,7 @@
65
65
  "README.md"
66
66
  ],
67
67
  "engines": {
68
- "node": "^18.12.0 || <23.0.0"
68
+ "node": "^20.19.0 || ^22.13.0 || >=24"
69
69
  },
70
70
  "bugs": {
71
71
  "url": "https://github.com/eso-status/forum-message/issues"
@@ -82,32 +82,42 @@
82
82
  "build": "rm -R -f lib/* && tsc --project tsconfig.build.json",
83
83
  "dev": "npm run build && node .",
84
84
  "watch": "nodemon --exec npm run dev",
85
- "test": "npm run build && jest --runInBand --setupFiles",
86
- "test:watch": "jest --runInBand --watch --setupFiles",
87
- "test:cov": "jest --runInBand --coverage --setupFiles",
85
+ "test": "npm run build && jest --runInBand",
86
+ "test:watch": "jest --runInBand --watch",
87
+ "test:cov": "jest --runInBand --coverage",
88
88
  "prepare": "husky"
89
89
  },
90
90
  "dependencies": {
91
- "@eso-status/types": "2.0.0-dev.16",
92
- "axios": "1.7.9",
91
+ "@eso-status/types": "2.0.0-dev.17",
92
+ "axios": "1.13.6",
93
93
  "moment": "2.30.1"
94
94
  },
95
+ "lint-staged": {
96
+ "*.ts": [
97
+ "eslint --fix",
98
+ "prettier --write"
99
+ ],
100
+ "*.{json,md,yml,yaml}": [
101
+ "prettier --write"
102
+ ]
103
+ },
95
104
  "devDependencies": {
96
- "@types/jest": "29.5.10",
97
- "eslint": "8.57.1",
98
- "eslint-config-airbnb-base": "15.0.0",
99
- "eslint-config-airbnb-typescript": "18.0.0",
100
- "eslint-config-prettier": "10.0.1",
101
- "eslint-plugin-jest": "28.11.0",
102
- "eslint-plugin-prettier": "5.2.3",
103
- "eslint-plugin-sonarjs": "3.0.1",
104
- "eslint-plugin-unused-imports": "4.1.4",
105
+ "@eslint/js": "10.0.1",
106
+ "@types/jest": "30.0.0",
107
+ "eslint": "10.0.3",
108
+ "eslint-config-prettier": "10.1.8",
109
+ "eslint-plugin-jest": "29.15.0",
110
+ "eslint-plugin-sonarjs": "4.0.2",
111
+ "eslint-plugin-unused-imports": "4.4.1",
112
+ "globals": "17.4.0",
105
113
  "husky": "9.1.7",
106
- "jest": "29.7.0",
107
- "nodemon": "3.1.9",
108
- "prettier": "3.5.0",
109
- "ts-jest": "29.2.5",
110
- "typescript": "5.4.5"
114
+ "jest": "30.3.0",
115
+ "lint-staged": "16.3.3",
116
+ "nodemon": "3.1.14",
117
+ "prettier": "3.8.1",
118
+ "ts-jest": "29.4.6",
119
+ "typescript": "5.9.3",
120
+ "typescript-eslint": "8.57.0"
111
121
  },
112
122
  "jest": {
113
123
  "moduleFileExtensions": [
@@ -125,9 +135,6 @@
125
135
  ],
126
136
  "coverageDirectory": "./coverage",
127
137
  "testEnvironment": "node",
128
- "setupFiles": [
129
- "dotenv/config"
130
- ],
131
138
  "moduleDirectories": [
132
139
  "node_modules",
133
140
  "src"