@eso-status/forum-message 1.0.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/.npmrc +1 -0
- package/LICENSE.md +21 -0
- package/README.md +144 -0
- package/lib/classes/ForumMessageElement.d.ts +110 -0
- package/lib/classes/ForumMessageElement.js +383 -0
- package/lib/connectors/ForumMessageConnector.d.ts +154 -0
- package/lib/connectors/ForumMessageConnector.js +370 -0
- package/lib/index.d.ts +15 -0
- package/lib/index.js +74 -0
- package/package.json +63 -0
package/.npmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
engine-strict=true
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 dov118
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# eso-status/forum-message
|
|
2
|
+
[](https://www.npmjs.com/package/@eso-status/forum-message)
|
|
3
|
+
[](https://github.com/eso-status/forum-message/blob/master/LICENSE.md)
|
|
4
|
+
<img src="https://img.shields.io/npm/dt/@eso-status/forum-message" alt="Downloads" />
|
|
5
|
+
[](https://lgtm.com/projects/g/eso-status/forum-message/context:javascript)
|
|
6
|
+
<img src="https://img.shields.io/node/v/@eso-status/forum-message" alt="Node version" />
|
|
7
|
+
[](https://github.com/eso-status/forum-message/actions/workflows/CI.yaml)
|
|
8
|
+
[](https://github.com/eso-status/forum-message/actions/workflows/CD.yaml)
|
|
9
|
+
|
|
10
|
+
eso-status/forum-message is a library for getting and formatting data can founded in [https://forums.elderscrollsonline.com/](https://forums.elderscrollsonline.com/) and [https://forums.elderscrollsonline.com/en/categories/pts](https://forums.elderscrollsonline.com/en/categories/pts)
|
|
11
|
+
|
|
12
|
+
## 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-)
|
|
16
|
+
|
|
17
|
+
### How to get it ?
|
|
18
|
+
```shell
|
|
19
|
+
npm i @eso-status/forum-message
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### How to use it ?
|
|
23
|
+
- TypeScript
|
|
24
|
+
```typescript
|
|
25
|
+
import { RawEsoStatus } from '@eso-status/types';
|
|
26
|
+
import { ForumMessage } from "@eso-status/forum-message";
|
|
27
|
+
|
|
28
|
+
ForumMessage.getData().then((data: RawEsoStatus[]): void => {
|
|
29
|
+
|
|
30
|
+
}).catch((error: Error): void => {
|
|
31
|
+
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
- JavaScript
|
|
35
|
+
```javascript
|
|
36
|
+
const { ForumMessage } = require('@eso-status/forum-message');
|
|
37
|
+
|
|
38
|
+
ForumMessage.getData().then(function (data) {
|
|
39
|
+
|
|
40
|
+
}).catch(function (error) {
|
|
41
|
+
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Returned data format ?
|
|
46
|
+
```text
|
|
47
|
+
[
|
|
48
|
+
{
|
|
49
|
+
sources: [
|
|
50
|
+
'https://forums.elderscrollsonline.com/en/categories/pts',
|
|
51
|
+
'https://forums.elderscrollsonline.com/'
|
|
52
|
+
],
|
|
53
|
+
raw: '• PC/Mac: NA and EU megaservers for patch maintenance – July 26, 4:00AM EDT (8:00 UTC) – 8:00AM EDT (12:00 UTC)',
|
|
54
|
+
slugs: [ 'server_pc_na' ],
|
|
55
|
+
rawDate: 'July 26, 4:00AM EDT (8:00 UTC) – 8:00AM EDT (12:00 UTC)',
|
|
56
|
+
date: [ Moment<2021-07-26T06:00:00Z>, Moment<2021-07-26T10:00:00Z> ],
|
|
57
|
+
type: 'server',
|
|
58
|
+
support: 'pc',
|
|
59
|
+
zone: 'na',
|
|
60
|
+
status: 'planned'
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
sources: [
|
|
64
|
+
'https://forums.elderscrollsonline.com/en/categories/pts',
|
|
65
|
+
'https://forums.elderscrollsonline.com/'
|
|
66
|
+
],
|
|
67
|
+
raw: '• PC/Mac: NA and EU megaservers for patch maintenance – July 26, 4:00AM EDT (8:00 UTC) – 8:00AM EDT (12:00 UTC)',
|
|
68
|
+
slugs: [ 'server_pc_eu' ],
|
|
69
|
+
rawDate: 'July 26, 4:00AM EDT (8:00 UTC) – 8:00AM EDT (12:00 UTC)',
|
|
70
|
+
date: [ Moment<2021-07-26T06:00:00Z>, Moment<2021-07-26T10:00:00Z> ],
|
|
71
|
+
type: 'server',
|
|
72
|
+
support: 'pc',
|
|
73
|
+
zone: 'eu',
|
|
74
|
+
status: 'planned'
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
sources: [
|
|
78
|
+
'https://forums.elderscrollsonline.com/en/categories/pts',
|
|
79
|
+
'https://forums.elderscrollsonline.com/'
|
|
80
|
+
],
|
|
81
|
+
raw: '• Xbox: NA and EU megaservers for patch maintenance – July 28, 6:00AM EDT (10:00 UTC) – 10:00AM EDT (14:00 UTC)',
|
|
82
|
+
slugs: [ 'server_xbox_na' ],
|
|
83
|
+
rawDate: 'July 28, 6:00AM EDT (10:00 UTC) – 10:00AM EDT (14:00 UTC)',
|
|
84
|
+
date: [ Moment<2021-07-28T08:00:00Z>, Moment<2021-07-28T12:00:00Z> ],
|
|
85
|
+
type: 'server',
|
|
86
|
+
support: 'xbox',
|
|
87
|
+
zone: 'na',
|
|
88
|
+
status: 'planned'
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
sources: [
|
|
92
|
+
'https://forums.elderscrollsonline.com/en/categories/pts',
|
|
93
|
+
'https://forums.elderscrollsonline.com/'
|
|
94
|
+
],
|
|
95
|
+
raw: '• Xbox: NA and EU megaservers for patch maintenance – July 28, 6:00AM EDT (10:00 UTC) – 10:00AM EDT (14:00 UTC)',
|
|
96
|
+
slugs: [ 'server_xbox_eu' ],
|
|
97
|
+
rawDate: 'July 28, 6:00AM EDT (10:00 UTC) – 10:00AM EDT (14:00 UTC)',
|
|
98
|
+
date: [ Moment<2021-07-28T08:00:00Z>, Moment<2021-07-28T12:00:00Z> ],
|
|
99
|
+
type: 'server',
|
|
100
|
+
support: 'xbox',
|
|
101
|
+
zone: 'eu',
|
|
102
|
+
status: 'planned'
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
sources: [
|
|
106
|
+
'https://forums.elderscrollsonline.com/en/categories/pts',
|
|
107
|
+
'https://forums.elderscrollsonline.com/'
|
|
108
|
+
],
|
|
109
|
+
raw: '• PlayStation®: NA and EU megaservers for patch maintenance – July 28, 6:00AM EDT (10:00 UTC) – 10:00AM EDT (14:00 UTC)',
|
|
110
|
+
slugs: [ 'server_ps_na' ],
|
|
111
|
+
rawDate: 'July 28, 6:00AM EDT (10:00 UTC) – 10:00AM EDT (14:00 UTC)',
|
|
112
|
+
date: [ Moment<2021-07-28T08:00:00Z>, Moment<2021-07-28T12:00:00Z> ],
|
|
113
|
+
type: 'server',
|
|
114
|
+
support: 'ps',
|
|
115
|
+
zone: 'na',
|
|
116
|
+
status: 'planned'
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
sources: [
|
|
120
|
+
'https://forums.elderscrollsonline.com/en/categories/pts',
|
|
121
|
+
'https://forums.elderscrollsonline.com/'
|
|
122
|
+
],
|
|
123
|
+
raw: '• PlayStation®: NA and EU megaservers for patch maintenance – July 28, 6:00AM EDT (10:00 UTC) – 10:00AM EDT (14:00 UTC)',
|
|
124
|
+
slugs: [ 'server_ps_eu' ],
|
|
125
|
+
rawDate: 'July 28, 6:00AM EDT (10:00 UTC) – 10:00AM EDT (14:00 UTC)',
|
|
126
|
+
date: [ Moment<2021-07-28T08:00:00Z>, Moment<2021-07-28T12:00:00Z> ],
|
|
127
|
+
type: 'server',
|
|
128
|
+
support: 'ps',
|
|
129
|
+
zone: 'eu',
|
|
130
|
+
status: 'planned'
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
sources: [ 'https://forums.elderscrollsonline.com/en/categories/pts' ],
|
|
134
|
+
raw: 'We will be performing maintenance for patch 7.1.2 on the PTS on Monday at 2:00AM EDT (06:00 UTC). ',
|
|
135
|
+
slugs: [ 'server_pc_pts' ],
|
|
136
|
+
rawDate: 'Monday at 2:00AM EDT (06:00 UTC). ',
|
|
137
|
+
date: [ Moment<2021-07-24T04:00:00Z> ],
|
|
138
|
+
type: 'server',
|
|
139
|
+
support: 'pc',
|
|
140
|
+
zone: 'pts',
|
|
141
|
+
status: 'planned'
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
```
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Moment } from 'moment';
|
|
2
|
+
import { Support, Slug, Status, Type, Zone } from '@eso-status/types';
|
|
3
|
+
/**
|
|
4
|
+
* Class with methode for ForumMessage element
|
|
5
|
+
*/
|
|
6
|
+
export default class ForumMessageElement {
|
|
7
|
+
/**
|
|
8
|
+
* Methode used to get slugs list of raw content
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
* @static
|
|
12
|
+
*
|
|
13
|
+
* @param rawData string Raw data
|
|
14
|
+
* @return Slug[] List of slug
|
|
15
|
+
*/
|
|
16
|
+
static getSlug(rawData: string): Slug[];
|
|
17
|
+
/**
|
|
18
|
+
* Methode used to determinate service type
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
* @static
|
|
22
|
+
*
|
|
23
|
+
* @param type Type Type to check
|
|
24
|
+
* @param rawData string Raw data
|
|
25
|
+
* @return boolean Check result
|
|
26
|
+
*/
|
|
27
|
+
static isType(type: Type, rawData: string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Methode used to determinate service support
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
* @static
|
|
33
|
+
*
|
|
34
|
+
* @param support Support Support to check
|
|
35
|
+
* @param rawData string Raw data
|
|
36
|
+
* @return boolean Check result
|
|
37
|
+
*/
|
|
38
|
+
static isSupport(support: Support, rawData: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Methode used to determinate service zone
|
|
41
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
* @static
|
|
44
|
+
*
|
|
45
|
+
* @param zone Zone Zone to check
|
|
46
|
+
* @param rawData string Raw data
|
|
47
|
+
* @return boolean Check result
|
|
48
|
+
*/
|
|
49
|
+
static isZone(zone: Zone, rawData: string): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Methode used to get dates of raw date
|
|
52
|
+
*
|
|
53
|
+
* @public
|
|
54
|
+
* @static
|
|
55
|
+
*
|
|
56
|
+
* @param rawDate string Raw date
|
|
57
|
+
* @return Moment[] Dates of raw data
|
|
58
|
+
*/
|
|
59
|
+
static getDate(rawDate: string): Moment[];
|
|
60
|
+
/**
|
|
61
|
+
* Methode used to get type of slug
|
|
62
|
+
*
|
|
63
|
+
* @public
|
|
64
|
+
* @static
|
|
65
|
+
*
|
|
66
|
+
* @param slug Slug Slug
|
|
67
|
+
* @return Type Type of slug
|
|
68
|
+
*/
|
|
69
|
+
static getType(slug: Slug): Type;
|
|
70
|
+
/**
|
|
71
|
+
* Methode used to get support of slug
|
|
72
|
+
*
|
|
73
|
+
* @public
|
|
74
|
+
* @static
|
|
75
|
+
*
|
|
76
|
+
* @param slug Slug Slug
|
|
77
|
+
* @return Support Support of slug
|
|
78
|
+
*/
|
|
79
|
+
static getSupport(slug: Slug): Support;
|
|
80
|
+
/**
|
|
81
|
+
* Methode used to get zone of slug
|
|
82
|
+
*
|
|
83
|
+
* @public
|
|
84
|
+
* @static
|
|
85
|
+
*
|
|
86
|
+
* @param slug Slug Slug
|
|
87
|
+
* @return Zone Zone of slug
|
|
88
|
+
*/
|
|
89
|
+
static getZone(slug: Slug): Zone;
|
|
90
|
+
/**
|
|
91
|
+
* Methode used to get status of raw data
|
|
92
|
+
*
|
|
93
|
+
* @public
|
|
94
|
+
* @static
|
|
95
|
+
*
|
|
96
|
+
* @param rawData string Raw data
|
|
97
|
+
* @return Status Status of raw data
|
|
98
|
+
*/
|
|
99
|
+
static getStatus(rawData: string): Status;
|
|
100
|
+
/**
|
|
101
|
+
* Methode used to get raw date of raw data
|
|
102
|
+
*
|
|
103
|
+
* @public
|
|
104
|
+
* @static
|
|
105
|
+
*
|
|
106
|
+
* @param raw string Raw data
|
|
107
|
+
* @return string Raw date
|
|
108
|
+
*/
|
|
109
|
+
static getRawDate(raw: string): string;
|
|
110
|
+
}
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var moment = require("moment");
|
|
4
|
+
/**
|
|
5
|
+
* Class with methode for ForumMessage element
|
|
6
|
+
*/
|
|
7
|
+
var ForumMessageElement = /** @class */ (function () {
|
|
8
|
+
function ForumMessageElement() {
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Methode used to get slugs list of raw content
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
* @static
|
|
15
|
+
*
|
|
16
|
+
* @param rawData string Raw data
|
|
17
|
+
* @return Slug[] List of slug
|
|
18
|
+
*/
|
|
19
|
+
ForumMessageElement.getSlug = function (rawData) {
|
|
20
|
+
var slugs = [];
|
|
21
|
+
if (ForumMessageElement.isType('server', rawData)
|
|
22
|
+
&& ForumMessageElement.isSupport('pc', rawData)
|
|
23
|
+
&& ForumMessageElement.isZone('na', rawData)) {
|
|
24
|
+
slugs.push('server_pc_na');
|
|
25
|
+
}
|
|
26
|
+
if (ForumMessageElement.isType('server', rawData)
|
|
27
|
+
&& ForumMessageElement.isSupport('pc', rawData)
|
|
28
|
+
&& ForumMessageElement.isZone('eu', rawData)) {
|
|
29
|
+
slugs.push('server_pc_eu');
|
|
30
|
+
}
|
|
31
|
+
if (ForumMessageElement.isType('server', rawData)
|
|
32
|
+
&& ForumMessageElement.isSupport('xbox', rawData)
|
|
33
|
+
&& ForumMessageElement.isZone('na', rawData)) {
|
|
34
|
+
slugs.push('server_xbox_na');
|
|
35
|
+
}
|
|
36
|
+
if (ForumMessageElement.isType('server', rawData)
|
|
37
|
+
&& ForumMessageElement.isSupport('xbox', rawData)
|
|
38
|
+
&& ForumMessageElement.isZone('eu', rawData)) {
|
|
39
|
+
slugs.push('server_xbox_eu');
|
|
40
|
+
}
|
|
41
|
+
if (ForumMessageElement.isType('server', rawData)
|
|
42
|
+
&& ForumMessageElement.isSupport('ps', rawData)
|
|
43
|
+
&& ForumMessageElement.isZone('na', rawData)) {
|
|
44
|
+
slugs.push('server_ps_na');
|
|
45
|
+
}
|
|
46
|
+
if (ForumMessageElement.isType('server', rawData)
|
|
47
|
+
&& ForumMessageElement.isSupport('ps', rawData)
|
|
48
|
+
&& ForumMessageElement.isZone('eu', rawData)) {
|
|
49
|
+
slugs.push('server_ps_eu');
|
|
50
|
+
}
|
|
51
|
+
if (ForumMessageElement.isType('server', rawData)
|
|
52
|
+
&& ForumMessageElement.isSupport('pc', rawData)
|
|
53
|
+
&& ForumMessageElement.isZone('pts', rawData)) {
|
|
54
|
+
slugs.push('server_pc_pts');
|
|
55
|
+
}
|
|
56
|
+
if (ForumMessageElement.isType('service', rawData)
|
|
57
|
+
&& ForumMessageElement.isSupport('web', rawData)
|
|
58
|
+
&& ForumMessageElement.isZone('site', rawData)) {
|
|
59
|
+
slugs.push('service_web_site');
|
|
60
|
+
}
|
|
61
|
+
if (ForumMessageElement.isType('service', rawData)
|
|
62
|
+
&& ForumMessageElement.isSupport('web', rawData)
|
|
63
|
+
&& ForumMessageElement.isZone('forum', rawData)) {
|
|
64
|
+
slugs.push('service_web_forum');
|
|
65
|
+
}
|
|
66
|
+
if (ForumMessageElement.isType('service', rawData)
|
|
67
|
+
&& ForumMessageElement.isSupport('store', rawData)
|
|
68
|
+
&& ForumMessageElement.isZone('crown', rawData)) {
|
|
69
|
+
slugs.push('service_store_crown');
|
|
70
|
+
}
|
|
71
|
+
if (ForumMessageElement.isType('service', rawData)
|
|
72
|
+
&& ForumMessageElement.isSupport('store', rawData)
|
|
73
|
+
&& ForumMessageElement.isZone('eso', rawData)) {
|
|
74
|
+
slugs.push('service_store_eso');
|
|
75
|
+
}
|
|
76
|
+
if (ForumMessageElement.isType('service', rawData)
|
|
77
|
+
&& ForumMessageElement.isSupport('system', rawData)
|
|
78
|
+
&& ForumMessageElement.isZone('account', rawData)) {
|
|
79
|
+
slugs.push('service_system_account');
|
|
80
|
+
}
|
|
81
|
+
return slugs;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Methode used to determinate service type
|
|
85
|
+
*
|
|
86
|
+
* @public
|
|
87
|
+
* @static
|
|
88
|
+
*
|
|
89
|
+
* @param type Type Type to check
|
|
90
|
+
* @param rawData string Raw data
|
|
91
|
+
* @return boolean Check result
|
|
92
|
+
*/
|
|
93
|
+
ForumMessageElement.isType = function (type, rawData) {
|
|
94
|
+
if (type === 'server') {
|
|
95
|
+
return rawData.includes('megaserver')
|
|
96
|
+
|| rawData.includes('the megaservers')
|
|
97
|
+
|| rawData.includes('PTS')
|
|
98
|
+
|| rawData.includes('PlayStation')
|
|
99
|
+
|| rawData.includes('Xbox Live');
|
|
100
|
+
}
|
|
101
|
+
if (type === 'service') {
|
|
102
|
+
return rawData.includes('ESO Store')
|
|
103
|
+
|| rawData.includes('Account System')
|
|
104
|
+
|| rawData.includes('account system');
|
|
105
|
+
}
|
|
106
|
+
return false;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Methode used to determinate service support
|
|
110
|
+
*
|
|
111
|
+
* @public
|
|
112
|
+
* @static
|
|
113
|
+
*
|
|
114
|
+
* @param support Support Support to check
|
|
115
|
+
* @param rawData string Raw data
|
|
116
|
+
* @return boolean Check result
|
|
117
|
+
*/
|
|
118
|
+
ForumMessageElement.isSupport = function (support, rawData) {
|
|
119
|
+
if (support === 'xbox') { // OK
|
|
120
|
+
return rawData.includes('Xbox')
|
|
121
|
+
|| rawData.includes('the megaservers');
|
|
122
|
+
}
|
|
123
|
+
if (support === 'ps') { // OK
|
|
124
|
+
return rawData.includes('PlayStation')
|
|
125
|
+
|| rawData.includes('the megaservers');
|
|
126
|
+
}
|
|
127
|
+
if (support === 'pc') { // OK
|
|
128
|
+
return rawData.includes('PC/Mac')
|
|
129
|
+
|| rawData.includes('PTS')
|
|
130
|
+
|| rawData.includes('the megaservers');
|
|
131
|
+
}
|
|
132
|
+
if (support === 'web') {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
if (support === 'store') { // OK
|
|
136
|
+
return rawData.includes('Crown Store')
|
|
137
|
+
|| rawData.includes('ESO Store')
|
|
138
|
+
|| rawData.includes('ESO store');
|
|
139
|
+
}
|
|
140
|
+
if (support === 'system') { // OK
|
|
141
|
+
return rawData.includes('Account System')
|
|
142
|
+
|| rawData.includes('account system');
|
|
143
|
+
}
|
|
144
|
+
return false;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Methode used to determinate service zone
|
|
148
|
+
*
|
|
149
|
+
* @public
|
|
150
|
+
* @static
|
|
151
|
+
*
|
|
152
|
+
* @param zone Zone Zone to check
|
|
153
|
+
* @param rawData string Raw data
|
|
154
|
+
* @return boolean Check result
|
|
155
|
+
*/
|
|
156
|
+
ForumMessageElement.isZone = function (zone, rawData) {
|
|
157
|
+
if (zone === 'na') { // OK
|
|
158
|
+
return rawData.includes('North American')
|
|
159
|
+
|| rawData.includes('NA')
|
|
160
|
+
|| rawData.includes('PlayStation™ Network')
|
|
161
|
+
|| rawData.includes('Xbox Live')
|
|
162
|
+
|| rawData.includes('the megaservers');
|
|
163
|
+
}
|
|
164
|
+
if (zone === 'eu') { // OK
|
|
165
|
+
return rawData.includes('European')
|
|
166
|
+
|| rawData.includes('EU')
|
|
167
|
+
|| rawData.includes('PlayStation™ Network')
|
|
168
|
+
|| rawData.includes('Xbox Live')
|
|
169
|
+
|| rawData.includes('the megaservers');
|
|
170
|
+
}
|
|
171
|
+
if (zone === 'pts') { // OK
|
|
172
|
+
return rawData.includes('PTS');
|
|
173
|
+
}
|
|
174
|
+
if (zone === 'site') {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
if (zone === 'forum') {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
if (zone === 'crown') {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
if (zone === 'eso') { // OK
|
|
184
|
+
return rawData.includes('ESO Store')
|
|
185
|
+
|| rawData.includes('ESO store');
|
|
186
|
+
}
|
|
187
|
+
if (zone === 'account') { // OK
|
|
188
|
+
return rawData.includes('Account System')
|
|
189
|
+
|| rawData.includes('account system');
|
|
190
|
+
}
|
|
191
|
+
return false;
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* Methode used to get dates of raw date
|
|
195
|
+
*
|
|
196
|
+
* @public
|
|
197
|
+
* @static
|
|
198
|
+
*
|
|
199
|
+
* @param rawDate string Raw date
|
|
200
|
+
* @return Moment[] Dates of raw data
|
|
201
|
+
*/
|
|
202
|
+
ForumMessageElement.getDate = function (rawDate) {
|
|
203
|
+
var list = [];
|
|
204
|
+
if (rawDate === '') {
|
|
205
|
+
return list;
|
|
206
|
+
}
|
|
207
|
+
if (rawDate.includes(' at ') && !rawDate.includes('EDT / ')) {
|
|
208
|
+
var dateTime = /([a-zA-Z]{6,9}) at [0-9]{1,2}:[0-9]{1,2}[a-zA-Z]{1,2} EDT \(([0-9]{1,2}):([0-9]{1,2}) UTC\)/.exec(rawDate);
|
|
209
|
+
var isoWeekDay = Number(moment().day(dateTime && dateTime.length >= 1 ? String(dateTime[1]) : '').format('d'));
|
|
210
|
+
// getDateWithDayIndex
|
|
211
|
+
list.push(moment()
|
|
212
|
+
.utc()
|
|
213
|
+
.set('years', (moment().utc().isoWeekday() > isoWeekDay
|
|
214
|
+
? moment()
|
|
215
|
+
.utc()
|
|
216
|
+
.isoWeekday(isoWeekDay)
|
|
217
|
+
.add(7, 'day')
|
|
218
|
+
.get('years')
|
|
219
|
+
: moment()
|
|
220
|
+
.utc()
|
|
221
|
+
.isoWeekday(isoWeekDay)
|
|
222
|
+
.get('years')))
|
|
223
|
+
.set('months', (moment().utc().isoWeekday() > isoWeekDay
|
|
224
|
+
? moment()
|
|
225
|
+
.utc()
|
|
226
|
+
.isoWeekday(isoWeekDay)
|
|
227
|
+
.add(7, 'day')
|
|
228
|
+
.get('months')
|
|
229
|
+
: moment()
|
|
230
|
+
.utc()
|
|
231
|
+
.isoWeekday(isoWeekDay)
|
|
232
|
+
.get('months')))
|
|
233
|
+
.set('date', (moment().utc().isoWeekday() > isoWeekDay
|
|
234
|
+
? moment()
|
|
235
|
+
.utc()
|
|
236
|
+
.isoWeekday(isoWeekDay)
|
|
237
|
+
.add(7, 'day')
|
|
238
|
+
.get('date')
|
|
239
|
+
: moment()
|
|
240
|
+
.utc()
|
|
241
|
+
.isoWeekday(isoWeekDay)
|
|
242
|
+
.get('date')))
|
|
243
|
+
.set('hours', dateTime && dateTime.length >= 1 ? Number(dateTime[2]) : 0)
|
|
244
|
+
.set('minutes', dateTime && dateTime.length >= 1 ? Number(dateTime[3]) : 0)
|
|
245
|
+
.set('seconds', 0)
|
|
246
|
+
.set('milliseconds', 0)
|
|
247
|
+
.utcOffset(0));
|
|
248
|
+
}
|
|
249
|
+
else if (rawDate.includes('EDT / ')) {
|
|
250
|
+
var dateTime = /EDT \/ ([0-9]{1,2}):([0-9]{1,2}) UTC/.exec(rawDate);
|
|
251
|
+
// getDateWithHours
|
|
252
|
+
list.push(moment()
|
|
253
|
+
.utc()
|
|
254
|
+
.set('years', Number(((moment().utc().get('hours') > (dateTime && dateTime.length >= 1 ? Number(dateTime[1]) : 0)) || (moment().utc().get('hours') === (dateTime && dateTime.length >= 1 ? Number(dateTime[1]) : 0) && (moment().utc().get('minutes') > (dateTime && dateTime.length >= 1 ? Number(dateTime[2]) : 0))) ? moment().utc().add(1, 'day').get('years') : moment().utc().get('years'))))
|
|
255
|
+
.set('months', Number(((moment().utc().get('hours') > (dateTime && dateTime.length >= 1 ? Number(dateTime[1]) : 0)) || (moment().utc().get('hours') === (dateTime && dateTime.length >= 1 ? Number(dateTime[1]) : 0) && (moment().utc().get('minutes') > (dateTime && dateTime.length >= 1 ? Number(dateTime[2]) : 0))) ? moment().utc().add(1, 'day').get('months') : moment().utc().get('months'))))
|
|
256
|
+
.set('date', Number(((moment().utc().get('hours') > (dateTime && dateTime.length >= 1 ? Number(dateTime[1]) : 0)) || (moment().utc().get('hours') === (dateTime && dateTime.length >= 1 ? Number(dateTime[1]) : 0) && (moment().utc().get('minutes') > (dateTime && dateTime.length >= 1 ? Number(dateTime[2]) : 0))) ? moment().utc().add(1, 'day').get('date') : moment().utc().get('date'))))
|
|
257
|
+
.set('hours', dateTime && dateTime.length >= 1 ? Number(dateTime[1]) : 0)
|
|
258
|
+
.set('minutes', dateTime && dateTime.length >= 1 ? Number(dateTime[2]) : 0)
|
|
259
|
+
.set('seconds', 0)
|
|
260
|
+
.set('milliseconds', 0)
|
|
261
|
+
.utcOffset(0));
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
var dateTime = /([a-zA-Z]{3,9}) ([0-9]{1,2}), [0-9]{1,2}:[0-9]{1,2}[a-zA-Z]{1,2} EDT \(([0-9]{1,2}):([0-9]{1,2}) UTC\) [–|-] [0-9]{1,2}:[0-9]{1,2}[a-zA-Z]{1,2} EDT \(([0-9]{1,2}):([0-9]{1,2}) UTC\)/.exec(rawDate);
|
|
265
|
+
var month = Number(moment().month(dateTime && dateTime.length >= 1 ? String(dateTime[1]) : '').format('M')) - 1;
|
|
266
|
+
var day = dateTime && dateTime.length >= 1 ? Number(dateTime[2]) : 0;
|
|
267
|
+
// getDateWithDayNumber
|
|
268
|
+
list.push(moment()
|
|
269
|
+
.utc()
|
|
270
|
+
.set('years', (month < moment().utc().get('months') || day < moment().utc().get('date') ? moment().add(1, 'year').get('years') : moment().get('years')))
|
|
271
|
+
.set('months', month)
|
|
272
|
+
.set('date', day)
|
|
273
|
+
.set('hours', dateTime && dateTime.length >= 1 ? Number(dateTime[3]) : 0)
|
|
274
|
+
.set('minutes', dateTime && dateTime.length >= 1 ? Number(dateTime[4]) : 0)
|
|
275
|
+
.set('seconds', 0)
|
|
276
|
+
.set('milliseconds', 0)
|
|
277
|
+
.utcOffset(0));
|
|
278
|
+
list.push(moment()
|
|
279
|
+
.utc()
|
|
280
|
+
.set('years', (month < moment().utc().get('months') || day < moment().utc().get('date') ? moment().add(1, 'year').get('years') : moment().get('years')))
|
|
281
|
+
.set('months', month)
|
|
282
|
+
.set('date', day)
|
|
283
|
+
.set('hours', dateTime && dateTime.length >= 1 ? Number(dateTime[5]) : 0)
|
|
284
|
+
.set('minutes', dateTime && dateTime.length >= 1 ? Number(dateTime[6]) : 0)
|
|
285
|
+
.set('seconds', 0)
|
|
286
|
+
.set('milliseconds', 0)
|
|
287
|
+
.utcOffset(0));
|
|
288
|
+
}
|
|
289
|
+
return list;
|
|
290
|
+
};
|
|
291
|
+
/**
|
|
292
|
+
* Methode used to get type of slug
|
|
293
|
+
*
|
|
294
|
+
* @public
|
|
295
|
+
* @static
|
|
296
|
+
*
|
|
297
|
+
* @param slug Slug Slug
|
|
298
|
+
* @return Type Type of slug
|
|
299
|
+
*/
|
|
300
|
+
ForumMessageElement.getType = function (slug) {
|
|
301
|
+
return slug.split('_')[0];
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* Methode used to get support of slug
|
|
305
|
+
*
|
|
306
|
+
* @public
|
|
307
|
+
* @static
|
|
308
|
+
*
|
|
309
|
+
* @param slug Slug Slug
|
|
310
|
+
* @return Support Support of slug
|
|
311
|
+
*/
|
|
312
|
+
ForumMessageElement.getSupport = function (slug) {
|
|
313
|
+
return slug.split('_')[1];
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* Methode used to get zone of slug
|
|
317
|
+
*
|
|
318
|
+
* @public
|
|
319
|
+
* @static
|
|
320
|
+
*
|
|
321
|
+
* @param slug Slug Slug
|
|
322
|
+
* @return Zone Zone of slug
|
|
323
|
+
*/
|
|
324
|
+
ForumMessageElement.getZone = function (slug) {
|
|
325
|
+
return slug.split('_')[2];
|
|
326
|
+
};
|
|
327
|
+
/**
|
|
328
|
+
* Methode used to get status of raw data
|
|
329
|
+
*
|
|
330
|
+
* @public
|
|
331
|
+
* @static
|
|
332
|
+
*
|
|
333
|
+
* @param rawData string Raw data
|
|
334
|
+
* @return Status Status of raw data
|
|
335
|
+
*/
|
|
336
|
+
ForumMessageElement.getStatus = function (rawData) {
|
|
337
|
+
if (rawData.includes('unavailable') || rawData.includes('[IN PROGRESS]')) {
|
|
338
|
+
return 'down';
|
|
339
|
+
}
|
|
340
|
+
if (rawData.includes('[COMPLETE]') || rawData.includes('is now available') || rawData.includes('are now available') || rawData.includes('maintenance is complete') || rawData.includes('resolved at this time') || rawData.includes('has been resolved') || rawData.includes('currently available.')) {
|
|
341
|
+
return 'up';
|
|
342
|
+
}
|
|
343
|
+
if (rawData.includes('currently investigating issues') || rawData.includes('service interruption') || rawData.includes('In response to the ongoing issue') || rawData.includes('Due to a hardware issue')) {
|
|
344
|
+
return 'issues';
|
|
345
|
+
}
|
|
346
|
+
if (rawData.includes('UTC')) {
|
|
347
|
+
return 'planned';
|
|
348
|
+
}
|
|
349
|
+
return 'down';
|
|
350
|
+
};
|
|
351
|
+
/**
|
|
352
|
+
* Methode used to get raw date of raw data
|
|
353
|
+
*
|
|
354
|
+
* @public
|
|
355
|
+
* @static
|
|
356
|
+
*
|
|
357
|
+
* @param raw string Raw data
|
|
358
|
+
* @return string Raw date
|
|
359
|
+
*/
|
|
360
|
+
ForumMessageElement.getRawDate = function (raw) {
|
|
361
|
+
if (raw.includes('maintenance – ')) {
|
|
362
|
+
var split = raw.split('maintenance – ');
|
|
363
|
+
if (split.length === 2) {
|
|
364
|
+
return split[1];
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
if (raw.includes('on the PTS on ')) {
|
|
368
|
+
var split = raw.split('on the PTS on ');
|
|
369
|
+
if (split.length === 2) {
|
|
370
|
+
return split[1];
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
if (raw.includes('for maintenance at')) {
|
|
374
|
+
var split = raw.split('for maintenance at ');
|
|
375
|
+
if (split.length === 2) {
|
|
376
|
+
return split[1];
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
return '';
|
|
380
|
+
};
|
|
381
|
+
return ForumMessageElement;
|
|
382
|
+
}());
|
|
383
|
+
exports.default = ForumMessageElement;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { RawEsoStatus } from '@eso-status/types';
|
|
2
|
+
/**
|
|
3
|
+
* Connector used to get data from https://forums.elderscrollsonline.com/ and https://forums.elderscrollsonline.com/en/categories/pts
|
|
4
|
+
*/
|
|
5
|
+
export default class ForumMessageConnector {
|
|
6
|
+
/**
|
|
7
|
+
* URLs to get remote content
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
* @static
|
|
11
|
+
*
|
|
12
|
+
* @return string[] URLs to get remote content
|
|
13
|
+
*/
|
|
14
|
+
static urls: string[];
|
|
15
|
+
/**
|
|
16
|
+
* Methode used to get the list of raw element from remote website
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
* @static
|
|
20
|
+
*
|
|
21
|
+
* @return Promise<RawEsoStatus[]> List of raw element from remote website
|
|
22
|
+
*/
|
|
23
|
+
static getRemoteContent(): Promise<RawEsoStatus[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Methode used to get the list of raw element from remote specific url
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
* @static
|
|
29
|
+
*
|
|
30
|
+
* @param url string Url to use to get list of raw element from remote specific url
|
|
31
|
+
* @return Promise<RawEsoStatus[]> List of raw element from remote specific url
|
|
32
|
+
*/
|
|
33
|
+
static getRemoteContentByUrl(url: string): Promise<RawEsoStatus[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Methode used to get raw content from remote specific url
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
* @static
|
|
39
|
+
*
|
|
40
|
+
* @param url string Url to use to get list of raw element from remote specific url
|
|
41
|
+
* @return Promise<string> Raw content from remote specific url
|
|
42
|
+
*/
|
|
43
|
+
static getRawRemoteContent(url: string): Promise<string>;
|
|
44
|
+
/**
|
|
45
|
+
* Methode used to get raw warning message from raw content
|
|
46
|
+
*
|
|
47
|
+
* @public
|
|
48
|
+
* @static
|
|
49
|
+
*
|
|
50
|
+
* @param rawRemoteContent string Raw content from remote specific url
|
|
51
|
+
* @return string Raw warning message from raw content
|
|
52
|
+
*/
|
|
53
|
+
static getRawWarningMessage(rawRemoteContent: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* Methode used to get raw alert message from raw content
|
|
56
|
+
*
|
|
57
|
+
* @public
|
|
58
|
+
* @static
|
|
59
|
+
*
|
|
60
|
+
* @param rawRemoteContent string Raw content from remote specific url
|
|
61
|
+
* @return string Raw alert message from raw content
|
|
62
|
+
*/
|
|
63
|
+
static getRawAlertMessage(rawRemoteContent: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* Methode used to get merge off all message
|
|
66
|
+
*
|
|
67
|
+
* @public
|
|
68
|
+
* @static
|
|
69
|
+
*
|
|
70
|
+
* @param rawMessages string[] All message
|
|
71
|
+
* @return string Merge off all message
|
|
72
|
+
*/
|
|
73
|
+
static mergeRawMessage(...rawMessages: string[]): string;
|
|
74
|
+
/**
|
|
75
|
+
* Methode used to split raw content
|
|
76
|
+
*
|
|
77
|
+
* @public
|
|
78
|
+
* @static
|
|
79
|
+
*
|
|
80
|
+
* @param mergedRawMessage string All message merged
|
|
81
|
+
* @return string[] Split raw content
|
|
82
|
+
*/
|
|
83
|
+
static splitRawMessage(mergedRawMessage: string): string[];
|
|
84
|
+
/**
|
|
85
|
+
* Methode used to sort raw content list
|
|
86
|
+
*
|
|
87
|
+
* @public
|
|
88
|
+
* @static
|
|
89
|
+
*
|
|
90
|
+
* @param rawMessageSplit string Split raw content
|
|
91
|
+
* @return string[] Sort raw content list
|
|
92
|
+
*/
|
|
93
|
+
static sortRawMessageList(rawMessageSplit: string[]): string[];
|
|
94
|
+
/**
|
|
95
|
+
* Methode used to remove duplicate of raw content
|
|
96
|
+
*
|
|
97
|
+
* @public
|
|
98
|
+
* @static
|
|
99
|
+
*
|
|
100
|
+
* @param remoteContent RawEsoStatus[] List of raw element from remote website
|
|
101
|
+
* @return RawEsoStatus[] Raw content list without duplicate
|
|
102
|
+
*/
|
|
103
|
+
static removeDuplicate(remoteContent: RawEsoStatus[]): RawEsoStatus[];
|
|
104
|
+
/**
|
|
105
|
+
* Methode used to get slug for raw content list
|
|
106
|
+
*
|
|
107
|
+
* @public
|
|
108
|
+
* @static
|
|
109
|
+
*
|
|
110
|
+
* @param remoteContent RawEsoStatus[] Raw content list without duplicate
|
|
111
|
+
* @return RawEsoStatus[] Raw content list with slug list
|
|
112
|
+
*/
|
|
113
|
+
static getRawContentWithSlug(remoteContent: RawEsoStatus[]): RawEsoStatus[];
|
|
114
|
+
/**
|
|
115
|
+
* Methode used to split list by slug
|
|
116
|
+
*
|
|
117
|
+
* @public
|
|
118
|
+
* @static
|
|
119
|
+
*
|
|
120
|
+
* @param slugOfRawContent RawEsoStatus[] Raw content list with slug list
|
|
121
|
+
* @return RawEsoStatus[] Raw content list foreach slug
|
|
122
|
+
*/
|
|
123
|
+
static splitRawContentBySlug(slugOfRawContent: RawEsoStatus[]): RawEsoStatus[];
|
|
124
|
+
/**
|
|
125
|
+
* Methode used to get raw date for raw content list
|
|
126
|
+
*
|
|
127
|
+
* @public
|
|
128
|
+
* @static
|
|
129
|
+
*
|
|
130
|
+
* @param rawContentBySlug RawEsoStatus[] Raw content list foreach slug
|
|
131
|
+
* @return RawEsoStatus[] Raw content list with raw date
|
|
132
|
+
*/
|
|
133
|
+
static getRawContentWithRawDate(rawContentBySlug: RawEsoStatus[]): RawEsoStatus[];
|
|
134
|
+
/**
|
|
135
|
+
* Methode used to get data for each raw element
|
|
136
|
+
*
|
|
137
|
+
* @public
|
|
138
|
+
* @static
|
|
139
|
+
*
|
|
140
|
+
* @param rawContentWithRawDate RawEsoStatus[] Raw content list with raw date
|
|
141
|
+
* @return RawEsoStatus[] Raw content list with data
|
|
142
|
+
*/
|
|
143
|
+
static getData(rawContentWithRawDate: RawEsoStatus[]): RawEsoStatus[];
|
|
144
|
+
/**
|
|
145
|
+
* Methode used to get data sort by status
|
|
146
|
+
*
|
|
147
|
+
* @public
|
|
148
|
+
* @static
|
|
149
|
+
*
|
|
150
|
+
* @param data RawEsoStatus[] Raw content list with data
|
|
151
|
+
* @return RawEsoStatus[] Data sorted by status
|
|
152
|
+
*/
|
|
153
|
+
static sortData(data: RawEsoStatus[]): RawEsoStatus[];
|
|
154
|
+
}
|
|
@@ -0,0 +1,370 @@
|
|
|
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 (_) 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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var axios_1 = require("axios");
|
|
40
|
+
var ForumMessageElement_1 = require("../classes/ForumMessageElement");
|
|
41
|
+
/**
|
|
42
|
+
* Connector used to get data from https://forums.elderscrollsonline.com/ and https://forums.elderscrollsonline.com/en/categories/pts
|
|
43
|
+
*/
|
|
44
|
+
var ForumMessageConnector = /** @class */ (function () {
|
|
45
|
+
function ForumMessageConnector() {
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Methode used to get the list of raw element from remote website
|
|
49
|
+
*
|
|
50
|
+
* @public
|
|
51
|
+
* @static
|
|
52
|
+
*
|
|
53
|
+
* @return Promise<RawEsoStatus[]> List of raw element from remote website
|
|
54
|
+
*/
|
|
55
|
+
ForumMessageConnector.getRemoteContent = function () {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
57
|
+
var list, remoteContent;
|
|
58
|
+
return __generator(this, function (_a) {
|
|
59
|
+
switch (_a.label) {
|
|
60
|
+
case 0:
|
|
61
|
+
list = [];
|
|
62
|
+
return [4 /*yield*/, ForumMessageConnector.getRemoteContentByUrl(ForumMessageConnector.urls[0])];
|
|
63
|
+
case 1:
|
|
64
|
+
remoteContent = _a.sent();
|
|
65
|
+
list.push.apply(list, remoteContent);
|
|
66
|
+
return [4 /*yield*/, ForumMessageConnector.getRemoteContentByUrl(ForumMessageConnector.urls[1])];
|
|
67
|
+
case 2:
|
|
68
|
+
remoteContent = _a.sent();
|
|
69
|
+
list.push.apply(list, remoteContent);
|
|
70
|
+
return [2 /*return*/, ForumMessageConnector.removeDuplicate(list)];
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Methode used to get the list of raw element from remote specific url
|
|
77
|
+
*
|
|
78
|
+
* @public
|
|
79
|
+
* @static
|
|
80
|
+
*
|
|
81
|
+
* @param url string Url to use to get list of raw element from remote specific url
|
|
82
|
+
* @return Promise<RawEsoStatus[]> List of raw element from remote specific url
|
|
83
|
+
*/
|
|
84
|
+
ForumMessageConnector.getRemoteContentByUrl = function (url) {
|
|
85
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
86
|
+
var rawRemoteContent, rawWarningMessage, rawAlertMessage, mergedRawMessage, rawMessageSplit, sortedRawMessageList;
|
|
87
|
+
return __generator(this, function (_a) {
|
|
88
|
+
switch (_a.label) {
|
|
89
|
+
case 0: return [4 /*yield*/, ForumMessageConnector.getRawRemoteContent(url)];
|
|
90
|
+
case 1:
|
|
91
|
+
rawRemoteContent = _a.sent();
|
|
92
|
+
rawWarningMessage = ForumMessageConnector.getRawWarningMessage(rawRemoteContent);
|
|
93
|
+
rawAlertMessage = ForumMessageConnector.getRawAlertMessage(rawRemoteContent);
|
|
94
|
+
mergedRawMessage = ForumMessageConnector.mergeRawMessage(rawWarningMessage, rawAlertMessage);
|
|
95
|
+
rawMessageSplit = ForumMessageConnector.splitRawMessage(mergedRawMessage);
|
|
96
|
+
sortedRawMessageList = ForumMessageConnector.sortRawMessageList(rawMessageSplit);
|
|
97
|
+
return [2 /*return*/, sortedRawMessageList.map(function (item) { return ({
|
|
98
|
+
sources: [url],
|
|
99
|
+
raw: [item],
|
|
100
|
+
slugs: [],
|
|
101
|
+
}); })];
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Methode used to get raw content from remote specific url
|
|
108
|
+
*
|
|
109
|
+
* @public
|
|
110
|
+
* @static
|
|
111
|
+
*
|
|
112
|
+
* @param url string Url to use to get list of raw element from remote specific url
|
|
113
|
+
* @return Promise<string> Raw content from remote specific url
|
|
114
|
+
*/
|
|
115
|
+
ForumMessageConnector.getRawRemoteContent = function (url) {
|
|
116
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
117
|
+
var response;
|
|
118
|
+
return __generator(this, function (_a) {
|
|
119
|
+
switch (_a.label) {
|
|
120
|
+
case 0: return [4 /*yield*/, axios_1.default.get(url)];
|
|
121
|
+
case 1:
|
|
122
|
+
response = _a.sent();
|
|
123
|
+
return [2 /*return*/, (response === null || response === void 0 ? void 0 : response.status) === 200 && !(!(response === null || response === void 0 ? void 0 : response.data)) ? String(response === null || response === void 0 ? void 0 : response.data) : ''];
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Methode used to get raw warning message from raw content
|
|
130
|
+
*
|
|
131
|
+
* @public
|
|
132
|
+
* @static
|
|
133
|
+
*
|
|
134
|
+
* @param rawRemoteContent string Raw content from remote specific url
|
|
135
|
+
* @return string Raw warning message from raw content
|
|
136
|
+
*/
|
|
137
|
+
ForumMessageConnector.getRawWarningMessage = function (rawRemoteContent) {
|
|
138
|
+
return rawRemoteContent.split('<div class="DismissMessage WarningMessage">')
|
|
139
|
+
.filter(function (item, index) { return index !== 0; })
|
|
140
|
+
.map(function (item) {
|
|
141
|
+
var resultRemoveAfter = item.split('</div>');
|
|
142
|
+
if (resultRemoveAfter.length >= 2) {
|
|
143
|
+
return resultRemoveAfter[0];
|
|
144
|
+
}
|
|
145
|
+
return '';
|
|
146
|
+
})
|
|
147
|
+
.join('<br />');
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Methode used to get raw alert message from raw content
|
|
151
|
+
*
|
|
152
|
+
* @public
|
|
153
|
+
* @static
|
|
154
|
+
*
|
|
155
|
+
* @param rawRemoteContent string Raw content from remote specific url
|
|
156
|
+
* @return string Raw alert message from raw content
|
|
157
|
+
*/
|
|
158
|
+
ForumMessageConnector.getRawAlertMessage = function (rawRemoteContent) {
|
|
159
|
+
return rawRemoteContent.split('<div class="DismissMessage AlertMessage">')
|
|
160
|
+
.filter(function (item, index) { return index !== 0; })
|
|
161
|
+
.map(function (item) {
|
|
162
|
+
var resultRemoveAfter = item.split('</div>');
|
|
163
|
+
if (resultRemoveAfter.length >= 2) {
|
|
164
|
+
return resultRemoveAfter[0];
|
|
165
|
+
}
|
|
166
|
+
return '';
|
|
167
|
+
})
|
|
168
|
+
.join('<br />');
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Methode used to get merge off all message
|
|
172
|
+
*
|
|
173
|
+
* @public
|
|
174
|
+
* @static
|
|
175
|
+
*
|
|
176
|
+
* @param rawMessages string[] All message
|
|
177
|
+
* @return string Merge off all message
|
|
178
|
+
*/
|
|
179
|
+
ForumMessageConnector.mergeRawMessage = function () {
|
|
180
|
+
var rawMessages = [];
|
|
181
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
182
|
+
rawMessages[_i] = arguments[_i];
|
|
183
|
+
}
|
|
184
|
+
return rawMessages.join('<br />');
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* Methode used to split raw content
|
|
188
|
+
*
|
|
189
|
+
* @public
|
|
190
|
+
* @static
|
|
191
|
+
*
|
|
192
|
+
* @param mergedRawMessage string All message merged
|
|
193
|
+
* @return string[] Split raw content
|
|
194
|
+
*/
|
|
195
|
+
ForumMessageConnector.splitRawMessage = function (mergedRawMessage) {
|
|
196
|
+
var list = [];
|
|
197
|
+
mergedRawMessage.split('<br />').forEach(function (item) {
|
|
198
|
+
list.push.apply(list, item.split('<br>'));
|
|
199
|
+
});
|
|
200
|
+
return list;
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* Methode used to sort raw content list
|
|
204
|
+
*
|
|
205
|
+
* @public
|
|
206
|
+
* @static
|
|
207
|
+
*
|
|
208
|
+
* @param rawMessageSplit string Split raw content
|
|
209
|
+
* @return string[] Sort raw content list
|
|
210
|
+
*/
|
|
211
|
+
ForumMessageConnector.sortRawMessageList = function (rawMessageSplit) {
|
|
212
|
+
return rawMessageSplit
|
|
213
|
+
.filter(function (item) { return item !== ''
|
|
214
|
+
&& !item.includes('Maintenance for the week')
|
|
215
|
+
&& !item.includes('No maintenance'); })
|
|
216
|
+
.map(function (item) {
|
|
217
|
+
var line = item;
|
|
218
|
+
line = line.replace('\n', '');
|
|
219
|
+
return line;
|
|
220
|
+
})
|
|
221
|
+
.filter(function (item) { return item !== '' && item !== ' '; });
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* Methode used to remove duplicate of raw content
|
|
225
|
+
*
|
|
226
|
+
* @public
|
|
227
|
+
* @static
|
|
228
|
+
*
|
|
229
|
+
* @param remoteContent RawEsoStatus[] List of raw element from remote website
|
|
230
|
+
* @return RawEsoStatus[] Raw content list without duplicate
|
|
231
|
+
*/
|
|
232
|
+
ForumMessageConnector.removeDuplicate = function (remoteContent) {
|
|
233
|
+
var list = [];
|
|
234
|
+
remoteContent.forEach(function (item) {
|
|
235
|
+
if (list[item.raw[0]] === undefined) {
|
|
236
|
+
list[item.raw[0]] = item;
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
list[item.raw[0]].sources.push(item.sources[0]);
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
return Object.values(list);
|
|
243
|
+
};
|
|
244
|
+
/**
|
|
245
|
+
* Methode used to get slug for raw content list
|
|
246
|
+
*
|
|
247
|
+
* @public
|
|
248
|
+
* @static
|
|
249
|
+
*
|
|
250
|
+
* @param remoteContent RawEsoStatus[] Raw content list without duplicate
|
|
251
|
+
* @return RawEsoStatus[] Raw content list with slug list
|
|
252
|
+
*/
|
|
253
|
+
ForumMessageConnector.getRawContentWithSlug = function (remoteContent) {
|
|
254
|
+
return remoteContent.map(function (item) { return ({
|
|
255
|
+
sources: item.sources,
|
|
256
|
+
raw: item.raw,
|
|
257
|
+
slugs: ForumMessageElement_1.default.getSlug(item.raw[0]),
|
|
258
|
+
}); });
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* Methode used to split list by slug
|
|
262
|
+
*
|
|
263
|
+
* @public
|
|
264
|
+
* @static
|
|
265
|
+
*
|
|
266
|
+
* @param slugOfRawContent RawEsoStatus[] Raw content list with slug list
|
|
267
|
+
* @return RawEsoStatus[] Raw content list foreach slug
|
|
268
|
+
*/
|
|
269
|
+
ForumMessageConnector.splitRawContentBySlug = function (slugOfRawContent) {
|
|
270
|
+
var list = [];
|
|
271
|
+
slugOfRawContent.forEach(function (item) {
|
|
272
|
+
var _a;
|
|
273
|
+
(_a = item.slugs) === null || _a === void 0 ? void 0 : _a.forEach(function (slug) {
|
|
274
|
+
list.push({
|
|
275
|
+
sources: item.sources,
|
|
276
|
+
raw: item.raw,
|
|
277
|
+
slugs: [slug],
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
return list;
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* Methode used to get raw date for raw content list
|
|
285
|
+
*
|
|
286
|
+
* @public
|
|
287
|
+
* @static
|
|
288
|
+
*
|
|
289
|
+
* @param rawContentBySlug RawEsoStatus[] Raw content list foreach slug
|
|
290
|
+
* @return RawEsoStatus[] Raw content list with raw date
|
|
291
|
+
*/
|
|
292
|
+
ForumMessageConnector.getRawContentWithRawDate = function (rawContentBySlug) {
|
|
293
|
+
return rawContentBySlug.map(function (item) { return ({
|
|
294
|
+
sources: item.sources,
|
|
295
|
+
raw: item.raw,
|
|
296
|
+
slugs: item.slugs,
|
|
297
|
+
rawDate: ForumMessageElement_1.default.getRawDate(item.raw[0]),
|
|
298
|
+
}); });
|
|
299
|
+
};
|
|
300
|
+
/**
|
|
301
|
+
* Methode used to get data for each raw element
|
|
302
|
+
*
|
|
303
|
+
* @public
|
|
304
|
+
* @static
|
|
305
|
+
*
|
|
306
|
+
* @param rawContentWithRawDate RawEsoStatus[] Raw content list with raw date
|
|
307
|
+
* @return RawEsoStatus[] Raw content list with data
|
|
308
|
+
*/
|
|
309
|
+
ForumMessageConnector.getData = function (rawContentWithRawDate) {
|
|
310
|
+
return rawContentWithRawDate.map(function (item) {
|
|
311
|
+
var _a;
|
|
312
|
+
return ({
|
|
313
|
+
sources: item.sources,
|
|
314
|
+
raw: item.raw,
|
|
315
|
+
slugs: item.slugs,
|
|
316
|
+
rawDate: item.rawDate,
|
|
317
|
+
dates: ForumMessageElement_1.default.getDate((_a = item.rawDate) !== null && _a !== void 0 ? _a : ''),
|
|
318
|
+
type: ForumMessageElement_1.default.getType(item.slugs ? item.slugs[0] : 'undefined'),
|
|
319
|
+
support: ForumMessageElement_1.default.getSupport(item.slugs ? item.slugs[0] : 'undefined'),
|
|
320
|
+
zone: ForumMessageElement_1.default.getZone(item.slugs ? item.slugs[0] : 'undefined'),
|
|
321
|
+
status: ForumMessageElement_1.default.getStatus(item.raw[0]),
|
|
322
|
+
});
|
|
323
|
+
});
|
|
324
|
+
};
|
|
325
|
+
/**
|
|
326
|
+
* Methode used to get data sort by status
|
|
327
|
+
*
|
|
328
|
+
* @public
|
|
329
|
+
* @static
|
|
330
|
+
*
|
|
331
|
+
* @param data RawEsoStatus[] Raw content list with data
|
|
332
|
+
* @return RawEsoStatus[] Data sorted by status
|
|
333
|
+
*/
|
|
334
|
+
ForumMessageConnector.sortData = function (data) {
|
|
335
|
+
return data.filter(function (item) {
|
|
336
|
+
if (data.filter(function (i) { return JSON.stringify(i.slugs) === JSON.stringify(item.slugs); }).length !== 1) {
|
|
337
|
+
if (item.raw.includes('will be taken offline for maintenance') && data.filter(function (i) { return JSON.stringify(i.slugs) === JSON.stringify(item.slugs) && i.raw.includes('is currently unavailable'); }).length !== 0) {
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
if (item.raw.includes('[IN PROGRESS]') && data.filter(function (i) { return JSON.stringify(i.slugs) === JSON.stringify(item.slugs) && i.raw.includes('[COMPLETE]'); }).length !== 0) {
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
if (item.status === 'planned' && data.filter(function (i) { return JSON.stringify(i.slugs) === JSON.stringify(item.slugs) && i.raw.includes('[IN PROGRESS]'); }).length !== 0) {
|
|
344
|
+
return false;
|
|
345
|
+
}
|
|
346
|
+
if (item.raw.includes('resolved at this time') && data.filter(function (i) { return JSON.stringify(i.slugs) === JSON.stringify(item.slugs) && i.raw.includes('[IN PROGRESS]'); }).length !== 0) {
|
|
347
|
+
return false;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
if (item.raw.includes('<a')) {
|
|
351
|
+
return false;
|
|
352
|
+
}
|
|
353
|
+
return true;
|
|
354
|
+
});
|
|
355
|
+
};
|
|
356
|
+
/**
|
|
357
|
+
* URLs to get remote content
|
|
358
|
+
*
|
|
359
|
+
* @public
|
|
360
|
+
* @static
|
|
361
|
+
*
|
|
362
|
+
* @return string[] URLs to get remote content
|
|
363
|
+
*/
|
|
364
|
+
ForumMessageConnector.urls = [
|
|
365
|
+
'https://forums.elderscrollsonline.com/',
|
|
366
|
+
'https://forums.elderscrollsonline.com/en/categories/pts',
|
|
367
|
+
];
|
|
368
|
+
return ForumMessageConnector;
|
|
369
|
+
}());
|
|
370
|
+
exports.default = ForumMessageConnector;
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { RawEsoStatus } from '@eso-status/types';
|
|
2
|
+
/**
|
|
3
|
+
* Class of Forum Message
|
|
4
|
+
*/
|
|
5
|
+
export declare class ForumMessage {
|
|
6
|
+
/**
|
|
7
|
+
* Methode used to get Forum Message data
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
* @static
|
|
11
|
+
*
|
|
12
|
+
* @return Promise<RawEsoStatus[]> Forum Message elements
|
|
13
|
+
*/
|
|
14
|
+
static getData(): Promise<RawEsoStatus[]>;
|
|
15
|
+
}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
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 (_) 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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.ForumMessage = void 0;
|
|
40
|
+
var ForumMessageConnector_1 = require("./connectors/ForumMessageConnector");
|
|
41
|
+
/**
|
|
42
|
+
* Class of Forum Message
|
|
43
|
+
*/
|
|
44
|
+
var ForumMessage = /** @class */ (function () {
|
|
45
|
+
function ForumMessage() {
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Methode used to get Forum Message data
|
|
49
|
+
*
|
|
50
|
+
* @public
|
|
51
|
+
* @static
|
|
52
|
+
*
|
|
53
|
+
* @return Promise<RawEsoStatus[]> Forum Message elements
|
|
54
|
+
*/
|
|
55
|
+
ForumMessage.getData = function () {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
57
|
+
var remoteContent, slugOfRawContent, rawContentBySlug, rawContentWithRawDate, data;
|
|
58
|
+
return __generator(this, function (_a) {
|
|
59
|
+
switch (_a.label) {
|
|
60
|
+
case 0: return [4 /*yield*/, ForumMessageConnector_1.default.getRemoteContent()];
|
|
61
|
+
case 1:
|
|
62
|
+
remoteContent = _a.sent();
|
|
63
|
+
slugOfRawContent = ForumMessageConnector_1.default.getRawContentWithSlug(remoteContent);
|
|
64
|
+
rawContentBySlug = ForumMessageConnector_1.default.splitRawContentBySlug(slugOfRawContent);
|
|
65
|
+
rawContentWithRawDate = ForumMessageConnector_1.default.getRawContentWithRawDate(rawContentBySlug);
|
|
66
|
+
data = ForumMessageConnector_1.default.getData(rawContentWithRawDate);
|
|
67
|
+
return [2 /*return*/, ForumMessageConnector_1.default.sortData(data)];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
return ForumMessage;
|
|
73
|
+
}());
|
|
74
|
+
exports.ForumMessage = ForumMessage;
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@eso-status/forum-message",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Library used to get servers status of The elders scrolls Online game with https://forums.elderscrollsonline.com/ and https://forums.elderscrollsonline.com/en/categories/pts",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"lint": "eslint tests src --ext .ts",
|
|
8
|
+
"lint:fix": "eslint tests src --ext .ts --fix",
|
|
9
|
+
"build": "rm -R -f lib/* && tsc",
|
|
10
|
+
"test": "jest",
|
|
11
|
+
"start": "node .",
|
|
12
|
+
"dev": "npm run lint && npm run build && npm run start",
|
|
13
|
+
"dev:test": "npm run lint && npm run build && npm run test",
|
|
14
|
+
"watch": "nodemon --exec npm run dev",
|
|
15
|
+
"watch:test": "nodemon --exec npm run dev:test"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"lib/classes/ForumMessageElement.d.ts",
|
|
19
|
+
"lib/classes/ForumMessageElement.js",
|
|
20
|
+
"lib/connectors/ForumMessageConnector.d.ts",
|
|
21
|
+
"lib/connectors/ForumMessageConnector.js",
|
|
22
|
+
"lib/index.d.ts",
|
|
23
|
+
"lib/index.js",
|
|
24
|
+
".npmrc",
|
|
25
|
+
"LICENSE.md",
|
|
26
|
+
"package.json",
|
|
27
|
+
"README.md"
|
|
28
|
+
],
|
|
29
|
+
"engineStrict": true,
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": "^10.18.0 || ^12.14.0 || >=14.15.0"
|
|
32
|
+
},
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git@github.com:eso-status/forum-message-dev.git"
|
|
36
|
+
},
|
|
37
|
+
"author": "@dov118 <contact@dov118.dev> (https://dov118.dev)",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/eso-status/forum-message-dev/issues"
|
|
41
|
+
},
|
|
42
|
+
"homepage": "https://github.com/eso-status/forum-message-dev#readme",
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@eso-status/types": "1.0.0",
|
|
45
|
+
"@types/jest": "^27.0.3",
|
|
46
|
+
"@types/node": "16.11.11",
|
|
47
|
+
"@typescript-eslint/eslint-plugin": "5.5.0",
|
|
48
|
+
"@typescript-eslint/parser": "5.5.0",
|
|
49
|
+
"@typescript-eslint/typescript-estree": "5.5.0",
|
|
50
|
+
"eslint": "8.3.0",
|
|
51
|
+
"eslint-config-airbnb-base": "15.0.0",
|
|
52
|
+
"eslint-plugin-import": "2.25.3",
|
|
53
|
+
"eslint-plugin-jest": "25.3.0",
|
|
54
|
+
"jest": "27.4.2",
|
|
55
|
+
"nodemon": "2.0.15",
|
|
56
|
+
"ts-jest": "27.0.7",
|
|
57
|
+
"typescript": "4.5.2"
|
|
58
|
+
},
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"axios": "0.24.0",
|
|
61
|
+
"moment": "2.29.1"
|
|
62
|
+
}
|
|
63
|
+
}
|