@eso-status/service-alerts 1.0.8 → 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.
Files changed (55) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +108 -204
  3. package/lib/connector.d.ts +65 -0
  4. package/lib/connector.js +122 -0
  5. package/lib/const.d.ts +6 -0
  6. package/lib/const.js +8 -0
  7. package/lib/formatter/date.formatter.d.ts +19 -0
  8. package/lib/formatter/date.formatter.js +32 -0
  9. package/lib/identifier/slug.identifier.d.ts +89 -0
  10. package/lib/identifier/slug.identifier.js +140 -0
  11. package/lib/identifier/slug.match.d.ts +26 -0
  12. package/lib/identifier/slug.match.js +35 -0
  13. package/lib/identifier/status.identifier.d.ts +58 -0
  14. package/lib/identifier/status.identifier.js +74 -0
  15. package/lib/index.d.ts +6 -11
  16. package/lib/index.js +11 -72
  17. package/lib/interface/esoStatusRawData.interface.d.ts +54 -0
  18. package/lib/interface/esoStatusRawData.interface.js +3 -0
  19. package/lib/raw.d.ts +39 -0
  20. package/lib/raw.js +52 -0
  21. package/lib/type/remoteDownRawStatus.type.d.ts +4 -0
  22. package/lib/type/remoteDownRawStatus.type.js +3 -0
  23. package/lib/type/remoteIssuesRawStatus.type.d.ts +4 -0
  24. package/lib/type/remoteIssuesRawStatus.type.js +3 -0
  25. package/lib/type/remoteRawSlug.type.d.ts +13 -0
  26. package/lib/type/remoteRawSlug.type.js +3 -0
  27. package/lib/type/remoteRawStatus.type.d.ts +7 -0
  28. package/lib/type/remoteRawStatus.type.js +3 -0
  29. package/lib/type/remoteServerPcEuRawSlug.type.d.ts +4 -0
  30. package/lib/type/remoteServerPcEuRawSlug.type.js +3 -0
  31. package/lib/type/remoteServerPcNaRawSlug.type.d.ts +4 -0
  32. package/lib/type/remoteServerPcNaRawSlug.type.js +3 -0
  33. package/lib/type/remoteServerPcPtsRawSlug.type.d.ts +4 -0
  34. package/lib/type/remoteServerPcPtsRawSlug.type.js +3 -0
  35. package/lib/type/remoteServerPsEuRawSlug.type.d.ts +4 -0
  36. package/lib/type/remoteServerPsEuRawSlug.type.js +3 -0
  37. package/lib/type/remoteServerPsNaRawSlug.type.d.ts +4 -0
  38. package/lib/type/remoteServerPsNaRawSlug.type.js +3 -0
  39. package/lib/type/remoteServerXboxEuRawSlug.type.d.ts +4 -0
  40. package/lib/type/remoteServerXboxEuRawSlug.type.js +3 -0
  41. package/lib/type/remoteServerXboxNaRawSlug.type.d.ts +4 -0
  42. package/lib/type/remoteServerXboxNaRawSlug.type.js +3 -0
  43. package/lib/type/remoteServiceStoreEsoRawSlug.type.d.ts +4 -0
  44. package/lib/type/remoteServiceStoreEsoRawSlug.type.js +3 -0
  45. package/lib/type/remoteServiceSystemAccountRawSlug.type.d.ts +4 -0
  46. package/lib/type/remoteServiceSystemAccountRawSlug.type.js +3 -0
  47. package/lib/type/remoteUpRawStatus.type.d.ts +4 -0
  48. package/lib/type/remoteUpRawStatus.type.js +3 -0
  49. package/lib/type/sourceUrl.type.d.ts +4 -0
  50. package/lib/type/sourceUrl.type.js +3 -0
  51. package/package.json +107 -36
  52. package/lib/classes/ServiceAlertsElement.d.ts +0 -100
  53. package/lib/classes/ServiceAlertsElement.js +0 -284
  54. package/lib/connectors/ServiceAlertConnector.d.ts +0 -112
  55. package/lib/connectors/ServiceAlertConnector.js +0 -263
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 dov118
3
+ Copyright (c) 2024 dov118
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,254 +1,158 @@
1
1
  # eso-status/service-alerts
2
+
3
+ [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=eso-status_service-alerts&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=eso-status_service-alerts)
4
+ [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=eso-status_service-alerts&metric=bugs)](https://sonarcloud.io/summary/new_code?id=eso-status_service-alerts)
5
+ [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=eso-status_service-alerts&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=eso-status_service-alerts)
6
+ [![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=eso-status_service-alerts&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=eso-status_service-alerts)
7
+ [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=eso-status_service-alerts&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=eso-status_service-alerts)
8
+ [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=eso-status_service-alerts&metric=coverage)](https://sonarcloud.io/summary/new_code?id=eso-status_service-alerts)
9
+ [![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=eso-status_service-alerts&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=eso-status_service-alerts)
10
+
2
11
  [![npm](https://img.shields.io/npm/v/@eso-status/service-alerts)](https://www.npmjs.com/package/@eso-status/service-alerts)
3
12
  [![license](https://img.shields.io/npm/l/@eso-status/service-alerts)](https://github.com/eso-status/service-alerts/blob/master/LICENSE.md)
4
13
  <img src="https://img.shields.io/npm/dt/@eso-status/service-alerts" alt="Downloads" />
5
- [![LGTM Grade](https://img.shields.io/lgtm/grade/javascript/github/eso-status/service-alerts)](https://lgtm.com/projects/g/eso-status/service-alerts/context:javascript)
6
14
  <img src="https://img.shields.io/node/v/@eso-status/service-alerts" alt="Node version" />
15
+
7
16
  [![Build Status](https://github.com/eso-status/service-alerts/workflows/CI/badge.svg)](https://github.com/eso-status/service-alerts/actions/workflows/CI.yaml)
8
- [![Delivery Status](https://github.com/eso-status/service-alerts/workflows/CD/badge.svg)](https://github.com/eso-status/service-alerts/actions/workflows/CD.yaml)
17
+ [![Build Status](https://github.com/eso-status/service-alerts/workflows/CD/badge.svg)](https://github.com/eso-status/service-alerts/actions/workflows/CD.yaml)
9
18
 
10
- eso-status/service-alerts is a library for getting and formatting data can founded in [https://help.elderscrollsonline.com/app/answers/detail/a_id/4320](https://help.elderscrollsonline.com/app/answers/detail/a_id/4320)
19
+ eso-status/service-alerts is a library for retrieving and formatting data, which can be found at [https://help.elderscrollsonline.com/app/answers/detail/a_id/4320](https://help.elderscrollsonline.com/app/answers/detail/a_id/4320).
11
20
 
12
21
  ## Table of Contents
13
- - [How to get it ?](#how-to-get-it-)
14
- - [How to use it ?](#how-to-use-it-)
15
- - [Returned data format](#returned-data-format-)
22
+ - [Install](#install)
23
+ - [Usage](#usage)
24
+ - [Return exemple](#return-exemple)
16
25
 
17
- ### How to get it ?
26
+ ### Install
18
27
  ```shell
19
28
  npm i @eso-status/service-alerts
20
29
  ```
21
30
 
22
- ### How to use it ?
23
- - TypeScript
24
- ```typescript
25
- import { RawEsoStatus } from '@eso-status/types';
26
- import { ServiceAlerts } from "@eso-status/service-alerts";
27
-
28
- ServiceAlerts.getData().then((data: RawEsoStatus[]): void => {
29
-
30
- }).catch((error: Error): void => {
31
-
32
- });
33
- ```
34
- - JavaScript
31
+ ### Usage
35
32
  ```javascript
36
- const { ServiceAlerts } = require('@eso-status/service-alerts');
33
+ import ServiceAlerts from '@eso-status/service-alerts';
37
34
 
38
- ServiceAlerts.getData().then(function (data) {
39
-
40
- }).catch(function (error) {
41
-
42
- });
35
+ const esoStatusRawDataList: EsoStatusRawData[] = await ServiceAlerts.getData();
43
36
  ```
44
-
45
- ### Returned data format ?
37
+ ### Return exemple
46
38
  ```text
47
39
  [
48
40
  {
49
- sources: [
50
- 'https://help.elderscrollsonline.com/app/answers/detail/a_id/4320'
51
- ],
52
- raw: [
53
- '<div><!-- ENTER ESO SERVICE ALERTS BELOW THIS LINE -->\n' +
54
- '<p>2021.08.25 - 12:00 UTC (8:00 EDT)</p>\n' +
55
- '<p>The North American Xbox megaserver is currently available.</p>\n' +
56
- '<p>The European Xbox megaserver is currently available.</p>\n' +
57
- '<p>The North American PlayStation® megaserver is currently available.</p>\n' +
58
- '<p>The European PlayStation® megaserver is currently available.</p>\n'
59
- ],
60
- rawDate: '2021.08.25 - 12:00 UTC (8:00 EDT)',
61
- rawData: 'The North American Xbox megaserver is currently available.',
62
- slugs: [ 'server_xbox_na' ],
63
- dates: [ Moment<2021-09-25T12:00:00Z> ],
41
+ source: 'https://help.elderscrollsonline.com/app/answers/detail/a_id/4320',
42
+ raw: '2024.09.04 - 14:00 UTC (10:00 EDT) The ESO store and account system are currently unavailable while we perform maintenance.',
43
+ slug: 'service_store_eso',
44
+ type: 'service',
45
+ support: 'store',
46
+ zone: 'eso',
47
+ status: 'down',
48
+ rawStatus: 'currently unavailable',
49
+ rawSlug: 'ESO store',
50
+ rawDate: '2024.09.04 - 14:00 UTC (10:00 EDT)',
51
+ dates: [ Moment<2024-09-04T14:00:00Z> ]
52
+ },
53
+ {
54
+ source: 'https://help.elderscrollsonline.com/app/answers/detail/a_id/4320',
55
+ raw: '2024.09.04 - 14:00 UTC (10:00 EDT) The ESO store and account system are currently unavailable while we perform maintenance.',
56
+ slug: 'service_system_account',
57
+ type: 'service',
58
+ support: 'system',
59
+ zone: 'account',
60
+ status: 'down',
61
+ rawStatus: 'currently unavailable',
62
+ rawSlug: 'account system',
63
+ rawDate: '2024.09.04 - 14:00 UTC (10:00 EDT)',
64
+ dates: [ Moment<2024-09-04T14:00:00Z> ]
65
+ },
66
+ {
67
+ source: 'https://help.elderscrollsonline.com/app/answers/detail/a_id/4320',
68
+ raw: '2024.09.04 - 10:00 UTC (6:00 EDT) The North American Xbox megaserver is currently unavailable while we perform maintenance. The European Xbox megaserver is currently unavailable while we perform maintenance. The North American PlayStation® megaserver is currently unavailable while we perform maintenance. The European PlayStation® megaserver is currently unavailable while we perform maintenance.',
69
+ slug: 'server_ps_eu',
64
70
  type: 'server',
65
- support: 'xbox',
66
- zone: 'na',
67
- status: 'up'
71
+ support: 'ps',
72
+ zone: 'eu',
73
+ status: 'down',
74
+ rawStatus: 'currently unavailable',
75
+ rawSlug: 'The European PlayStation® megaserver',
76
+ rawDate: '2024.09.04 - 10:00 UTC (6:00 EDT)',
77
+ dates: [ Moment<2024-09-04T10:00:00Z> ]
68
78
  },
69
79
  {
70
- sources: [
71
- 'https://help.elderscrollsonline.com/app/answers/detail/a_id/4320'
72
- ],
73
- raw: [
74
- '<div><!-- ENTER ESO SERVICE ALERTS BELOW THIS LINE -->\n' +
75
- '<p>2021.08.25 - 12:00 UTC (8:00 EDT)</p>\n' +
76
- '<p>The North American Xbox megaserver is currently available.</p>\n' +
77
- '<p>The European Xbox megaserver is currently available.</p>\n' +
78
- '<p>The North American PlayStation® megaserver is currently available.</p>\n' +
79
- '<p>The European PlayStation® megaserver is currently available.</p>\n'
80
- ],
81
- rawDate: '2021.08.25 - 12:00 UTC (8:00 EDT)',
82
- rawData: 'The European Xbox megaserver is currently available.',
83
- slugs: [ 'server_xbox_eu' ],
84
- dates: [ Moment<2021-09-25T12:00:00Z> ],
80
+ source: 'https://help.elderscrollsonline.com/app/answers/detail/a_id/4320',
81
+ raw: '2024.09.04 - 10:00 UTC (6:00 EDT) The North American Xbox megaserver is currently unavailable while we perform maintenance. The European Xbox megaserver is currently unavailable while we perform maintenance. The North American PlayStation® megaserver is currently unavailable while we perform maintenance. The European PlayStation® megaserver is currently unavailable while we perform maintenance.',
82
+ slug: 'server_xbox_eu',
85
83
  type: 'server',
86
84
  support: 'xbox',
87
85
  zone: 'eu',
88
- status: 'up'
86
+ status: 'down',
87
+ rawStatus: 'currently unavailable',
88
+ rawSlug: 'The European Xbox megaserver',
89
+ rawDate: '2024.09.04 - 10:00 UTC (6:00 EDT)',
90
+ dates: [ Moment<2024-09-04T10:00:00Z> ]
89
91
  },
90
92
  {
91
- sources: [
92
- 'https://help.elderscrollsonline.com/app/answers/detail/a_id/4320'
93
- ],
94
- raw: [
95
- '<div><!-- ENTER ESO SERVICE ALERTS BELOW THIS LINE -->\n' +
96
- '<p>2021.08.25 - 12:00 UTC (8:00 EDT)</p>\n' +
97
- '<p>The North American Xbox megaserver is currently available.</p>\n' +
98
- '<p>The European Xbox megaserver is currently available.</p>\n' +
99
- '<p>The North American PlayStation® megaserver is currently available.</p>\n' +
100
- '<p>The European PlayStation® megaserver is currently available.</p>\n'
101
- ],
102
- rawDate: '2021.08.25 - 12:00 UTC (8:00 EDT)',
103
- rawData: 'The North American PlayStation® megaserver is currently available.',
104
- slugs: [ 'server_ps_na' ],
105
- dates: [ Moment<2021-09-25T12:00:00Z> ],
93
+ source: 'https://help.elderscrollsonline.com/app/answers/detail/a_id/4320',
94
+ raw: '2024.09.04 - 10:00 UTC (6:00 EDT) The North American Xbox megaserver is currently unavailable while we perform maintenance. The European Xbox megaserver is currently unavailable while we perform maintenance. The North American PlayStation® megaserver is currently unavailable while we perform maintenance. The European PlayStation® megaserver is currently unavailable while we perform maintenance.',
95
+ slug: 'server_ps_na',
106
96
  type: 'server',
107
97
  support: 'ps',
108
98
  zone: 'na',
109
- status: 'up'
99
+ status: 'down',
100
+ rawStatus: 'currently unavailable',
101
+ rawSlug: 'North American PlayStation® megaserver',
102
+ rawDate: '2024.09.04 - 10:00 UTC (6:00 EDT)',
103
+ dates: [ Moment<2024-09-04T10:00:00Z> ]
110
104
  },
111
105
  {
112
- sources: [
113
- 'https://help.elderscrollsonline.com/app/answers/detail/a_id/4320'
114
- ],
115
- raw: [
116
- '<div><!-- ENTER ESO SERVICE ALERTS BELOW THIS LINE -->\n' +
117
- '<p>2021.08.25 - 12:00 UTC (8:00 EDT)</p>\n' +
118
- '<p>The North American Xbox megaserver is currently available.</p>\n' +
119
- '<p>The European Xbox megaserver is currently available.</p>\n' +
120
- '<p>The North American PlayStation® megaserver is currently available.</p>\n' +
121
- '<p>The European PlayStation® megaserver is currently available.</p>\n'
122
- ],
123
- rawDate: '2021.08.25 - 12:00 UTC (8:00 EDT)',
124
- rawData: 'The European PlayStation® megaserver is currently available.',
125
- slugs: [ 'server_ps_eu' ],
126
- dates: [ Moment<2021-09-25T12:00:00Z> ],
106
+ source: 'https://help.elderscrollsonline.com/app/answers/detail/a_id/4320',
107
+ raw: '2024.09.04 - 10:00 UTC (6:00 EDT) The North American Xbox megaserver is currently unavailable while we perform maintenance. The European Xbox megaserver is currently unavailable while we perform maintenance. The North American PlayStation® megaserver is currently unavailable while we perform maintenance. The European PlayStation® megaserver is currently unavailable while we perform maintenance.',
108
+ slug: 'server_xbox_na',
127
109
  type: 'server',
128
- support: 'ps',
129
- zone: 'eu',
130
- status: 'up'
110
+ support: 'xbox',
111
+ zone: 'na',
112
+ status: 'down',
113
+ rawStatus: 'currently unavailable',
114
+ rawSlug: 'The North American Xbox megaserver',
115
+ rawDate: '2024.09.04 - 10:00 UTC (6:00 EDT)',
116
+ dates: [ Moment<2024-09-04T10:00:00Z> ]
131
117
  },
132
118
  {
133
- sources: [
134
- 'https://help.elderscrollsonline.com/app/answers/detail/a_id/4320'
135
- ],
136
- raw: [
137
- '\n' +
138
- '\n' +
139
- '<p>2021.08.24 - 9:45 UTC (5:45 EDT)</p>\n' +
140
- '<p>The North American PC/Mac megaserver is currently available.</p>\n' +
141
- '<p>The European PC/Mac megaserver is currently available.</p>\n'
142
- ],
143
- rawDate: '2021.08.24 - 9:45 UTC (5:45 EDT)',
144
- rawData: 'The North American PC/Mac megaserver is currently available.',
145
- slugs: [ 'server_pc_na' ],
146
- dates: [ Moment<2021-09-24T09:45:00Z> ],
119
+ source: 'https://help.elderscrollsonline.com/app/answers/detail/a_id/4320',
120
+ raw: '2024.09.03 - 10:55 UTC (6:55 EDT) The North American PC/Mac megaserver is currently available. The European PC/Mac megaserver is currently available.',
121
+ slug: 'server_pc_eu',
147
122
  type: 'server',
148
123
  support: 'pc',
149
- zone: 'na',
150
- status: 'up'
124
+ zone: 'eu',
125
+ status: 'up',
126
+ rawStatus: 'currently available',
127
+ rawSlug: 'The European PC/Mac megaserver',
128
+ rawDate: '2024.09.03 - 10:55 UTC (6:55 EDT)',
129
+ dates: [ Moment<2024-09-03T10:55:00Z> ]
151
130
  },
152
131
  {
153
- sources: [
154
- 'https://help.elderscrollsonline.com/app/answers/detail/a_id/4320'
155
- ],
156
- raw: [
157
- '\n' +
158
- '\n' +
159
- '<p>2021.08.24 - 9:45 UTC (5:45 EDT)</p>\n' +
160
- '<p>The North American PC/Mac megaserver is currently available.</p>\n' +
161
- '<p>The European PC/Mac megaserver is currently available.</p>\n'
162
- ],
163
- rawDate: '2021.08.24 - 9:45 UTC (5:45 EDT)',
164
- rawData: 'The European PC/Mac megaserver is currently available.',
165
- slugs: [ 'server_pc_eu' ],
166
- dates: [ Moment<2021-09-24T09:45:00Z> ],
132
+ source: 'https://help.elderscrollsonline.com/app/answers/detail/a_id/4320',
133
+ raw: '2024.09.03 - 10:55 UTC (6:55 EDT) The North American PC/Mac megaserver is currently available. The European PC/Mac megaserver is currently available.',
134
+ slug: 'server_pc_na',
167
135
  type: 'server',
168
136
  support: 'pc',
169
- zone: 'eu',
170
- status: 'up'
137
+ zone: 'na',
138
+ status: 'up',
139
+ rawStatus: 'currently available',
140
+ rawSlug: 'The North American PC/Mac megaserver',
141
+ rawDate: '2024.09.03 - 10:55 UTC (6:55 EDT)',
142
+ dates: [ Moment<2024-09-03T10:55:00Z> ]
171
143
  },
172
144
  {
173
- sources: [
174
- 'https://help.elderscrollsonline.com/app/answers/detail/a_id/4320'
175
- ],
176
- raw: [
177
- '\n' +
178
- '\n' +
179
- '<p>2021.08.16 - 21:00 UTC (17:00 EDT)</p>\n' +
180
- '<p>The PTS is currently available.</p>\n'
181
- ],
182
- rawDate: '2021.08.16 - 21:00 UTC (17:00 EDT)',
183
- rawData: 'The PTS is currently available.',
184
- slugs: [ 'server_pc_pts' ],
185
- dates: [ Moment<2021-09-16T21:00:00Z> ],
145
+ source: 'https://help.elderscrollsonline.com/app/answers/detail/a_id/4320',
146
+ raw: ' 2024.08.27 - 14:40 UTC (10:40 EDT) The PTS is currently available.',
147
+ slug: 'server_pc_pts',
186
148
  type: 'server',
187
149
  support: 'pc',
188
150
  zone: 'pts',
189
- status: 'up'
190
- },
191
- {
192
- sources: [
193
- 'https://help.elderscrollsonline.com/app/answers/detail/a_id/4320'
194
- ],
195
- raw: [
196
- '\n' +
197
- ' \n' +
198
- '<p>2021.08.12 - 14:45 UTC (10:45 EDT)</p>\n' +
199
- '\n' +
200
- '<p>The ESO store and account system are currently available.</p>\n' +
201
- '\n'
202
- ],
203
- rawDate: ' 2021.08.12 - 14:45 UTC (10:45 EDT)',
204
- rawData: 'The ESO store and account system are currently available.',
205
- slugs: [ 'service_store_eso' ],
206
- dates: [ Moment<2021-09-12T14:45:00Z> ],
207
- type: 'service',
208
- support: 'store',
209
- zone: 'eso',
210
- status: 'up'
211
- },
212
- {
213
- sources: [
214
- 'https://help.elderscrollsonline.com/app/answers/detail/a_id/4320'
215
- ],
216
- raw: [
217
- '\n' +
218
- ' \n' +
219
- '<p>2021.08.12 - 14:45 UTC (10:45 EDT)</p>\n' +
220
- '\n' +
221
- '<p>The ESO store and account system are currently available.</p>\n' +
222
- '\n'
223
- ],
224
- rawDate: ' 2021.08.12 - 14:45 UTC (10:45 EDT)',
225
- rawData: 'The ESO store and account system are currently available.',
226
- slugs: [ 'service_system_account' ],
227
- dates: [ Moment<2021-09-12T14:45:00Z> ],
228
- type: 'service',
229
- support: 'system',
230
- zone: 'account',
231
- status: 'up'
232
- },
233
- {
234
- sources: [
235
- 'https://help.elderscrollsonline.com/app/answers/detail/a_id/4320'
236
- ],
237
- raw: [
238
- '\n' +
239
- '<p>2021.01.14 - 14:45 UTC (9:45 EST)</p>\n' +
240
- '\n' +
241
- '<p>The ESO Website is currently online.</p>\n' +
242
- '\n'
243
- ],
244
- rawDate: '2021.01.14 - 14:45 UTC (9:45 EST)',
245
- rawData: 'The ESO Website is currently online.',
246
- slugs: [ 'service_web_site' ],
247
- dates: [ Moment<2021-02-14T14:45:00Z> ],
248
- type: 'service',
249
- support: 'web',
250
- zone: 'site',
251
- status: 'up'
151
+ status: 'up',
152
+ rawStatus: 'currently available',
153
+ rawSlug: 'PTS',
154
+ rawDate: ' 2024.08.27 - 14:40 UTC (10:40 EDT)',
155
+ dates: [ Moment<Invalid date> ]
252
156
  }
253
157
  ]
254
158
  ```
@@ -0,0 +1,65 @@
1
+ import { EsoStatusRawData } from './interface/esoStatusRawData.interface';
2
+ /**
3
+ * Class for retrieving information from announcements
4
+ */
5
+ export default class Connector {
6
+ private readonly remoteContent;
7
+ /**
8
+ * List of raw data from announcements
9
+ */
10
+ raw: string[];
11
+ /**
12
+ * List of information from announcements
13
+ */
14
+ rawEsoStatus: EsoStatusRawData[];
15
+ /**
16
+ * List of slugs whose data has already been retrieved
17
+ * @private
18
+ */
19
+ private alreadyGet;
20
+ /**
21
+ * @param remoteContent Content of the source retrieved
22
+ */
23
+ constructor(remoteContent: string);
24
+ /**
25
+ * Method for creating an instance of the connector
26
+ */
27
+ static init(): Promise<Connector>;
28
+ /**
29
+ * Method for retrieving remote content
30
+ * @private
31
+ */
32
+ private static getRemoteContent;
33
+ /**
34
+ * Method for isolating the section containing the list of announcements
35
+ * @private
36
+ */
37
+ private isolate;
38
+ /**
39
+ * Method for separating announcement blocks
40
+ * @private
41
+ */
42
+ private split;
43
+ /**
44
+ * Method for removing unwanted elements/characters from an announcement
45
+ * @private
46
+ */
47
+ private clean;
48
+ /**
49
+ * Method for analyzing each announcement
50
+ * @private
51
+ */
52
+ private fetch;
53
+ /**
54
+ * Method for retrieving the information contained in an announcement
55
+ * @param raw Raw data of the announcement
56
+ * @private
57
+ */
58
+ private getEach;
59
+ /**
60
+ * Method for creating the list of announcements while avoiding duplicates
61
+ * @param match Object containing the information of a slug found in an announcement
62
+ * @private
63
+ */
64
+ private populateRawEsoStatus;
65
+ }
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const axios_1 = require("axios");
4
+ const const_1 = require("./const");
5
+ const raw_1 = require("./raw");
6
+ /**
7
+ * Class for retrieving information from announcements
8
+ */
9
+ class Connector {
10
+ /**
11
+ * @param remoteContent Content of the source retrieved
12
+ */
13
+ constructor(remoteContent) {
14
+ 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
+ if (!this.remoteContent) {
29
+ return;
30
+ }
31
+ this.isolate();
32
+ this.split();
33
+ this.clean();
34
+ this.fetch();
35
+ }
36
+ /**
37
+ * Method for creating an instance of the connector
38
+ */
39
+ static async init() {
40
+ return new Connector(await Connector.getRemoteContent());
41
+ }
42
+ /**
43
+ * Method for retrieving remote content
44
+ * @private
45
+ */
46
+ static async getRemoteContent() {
47
+ const response = await axios_1.default.get(const_1.default);
48
+ return response?.status === 200 && !!response?.data
49
+ ? String(response?.data)
50
+ : '';
51
+ }
52
+ /**
53
+ * Method for isolating the section containing the list of announcements
54
+ * @private
55
+ */
56
+ isolate() {
57
+ return this.remoteContent
58
+ .split('<!-- ENTER ESO SERVICE ALERTS BELOW THIS LINE -->')[1]
59
+ .split('</div>')
60
+ .shift();
61
+ }
62
+ /**
63
+ * Method for separating announcement blocks
64
+ * @private
65
+ */
66
+ split() {
67
+ this.isolate()
68
+ .split('<hr />')
69
+ .forEach((raw) => {
70
+ this.raw.push(raw);
71
+ });
72
+ }
73
+ /**
74
+ * Method for removing unwanted elements/characters from an announcement
75
+ * @private
76
+ */
77
+ clean() {
78
+ this.raw = this.raw.map((raw) => {
79
+ return raw
80
+ .replaceAll(/\n/g, '')
81
+ .replaceAll(' </p><p>', '</p><p>')
82
+ .replaceAll(' <p>', '<p>')
83
+ .replaceAll(' </p>', '</p>')
84
+ .replaceAll(' <p>', '<p>')
85
+ .replaceAll('</p><p>', ' ')
86
+ .replaceAll('. &nbsp;', '.')
87
+ .replaceAll('<p>', '')
88
+ .replaceAll('</p>', '')
89
+ .replaceAll('&nbsp;', '')
90
+ .replaceAll('<div>', '');
91
+ });
92
+ }
93
+ /**
94
+ * Method for analyzing each announcement
95
+ * @private
96
+ */
97
+ fetch() {
98
+ this.raw.forEach((raw) => this.getEach(raw));
99
+ }
100
+ /**
101
+ * Method for retrieving the information contained in an announcement
102
+ * @param raw Raw data of the announcement
103
+ * @private
104
+ */
105
+ getEach(raw) {
106
+ new raw_1.default(raw).matches.forEach((match) => this.populateRawEsoStatus(match));
107
+ }
108
+ /**
109
+ * Method for creating the list of announcements while avoiding duplicates
110
+ * @param match Object containing the information of a slug found in an announcement
111
+ * @private
112
+ */
113
+ populateRawEsoStatus(match) {
114
+ if (this.alreadyGet.includes(match.slug)) {
115
+ return;
116
+ }
117
+ this.rawEsoStatus.push(match);
118
+ this.alreadyGet.push(match.slug);
119
+ }
120
+ }
121
+ exports.default = Connector;
122
+ //# sourceMappingURL=connector.js.map
package/lib/const.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { SourceUrl } from './type/sourceUrl.type';
2
+ /**
3
+ * Official website URL with announcements
4
+ */
5
+ declare const ServiceAlertsUrl: SourceUrl;
6
+ export default ServiceAlertsUrl;
package/lib/const.js ADDED
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Official website URL with announcements
5
+ */
6
+ const ServiceAlertsUrl = 'https://help.elderscrollsonline.com/app/answers/detail/a_id/4320';
7
+ exports.default = ServiceAlertsUrl;
8
+ //# sourceMappingURL=const.js.map
@@ -0,0 +1,19 @@
1
+ import { Moment } from 'moment';
2
+ /**
3
+ * Class for identifying and formatting the date contained in an announcement
4
+ */
5
+ export default class DateFormatter {
6
+ private readonly raw;
7
+ /**
8
+ * Raw date data contained in the announcement
9
+ */
10
+ rawDate: string;
11
+ /**
12
+ * List of dates formatted correctly contained in the announcement
13
+ */
14
+ dates: Moment[];
15
+ /**
16
+ * @param raw Raw data of the announcement
17
+ */
18
+ constructor(raw: string);
19
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const moment = require("moment");
4
+ /**
5
+ * Class for identifying and formatting the date contained in an announcement
6
+ */
7
+ class DateFormatter {
8
+ /**
9
+ * @param raw Raw data of the announcement
10
+ */
11
+ constructor(raw) {
12
+ this.raw = raw;
13
+ this.rawDate = `${this.raw.split(')')[0]})`;
14
+ const split = raw.split(' ');
15
+ const dateData = split[0];
16
+ const hourData = split[2];
17
+ this.dates = [
18
+ moment()
19
+ .utc()
20
+ .set('years', Number(dateData.split('.')[0]))
21
+ .set('months', Number(dateData.split('.')[1]) - 1)
22
+ .set('date', Number(dateData.split('.')[2]))
23
+ .set('hours', Number(hourData.split(':')[0]))
24
+ .set('minutes', Number(hourData.split(':')[1]))
25
+ .set('seconds', 0)
26
+ .set('milliseconds', 0)
27
+ .utcOffset(0),
28
+ ];
29
+ }
30
+ }
31
+ exports.default = DateFormatter;
32
+ //# sourceMappingURL=date.formatter.js.map