@eso-status/forum-message 1.0.10 → 1.0.12
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.
|
@@ -3,34 +3,17 @@ import { RawEsoStatus } from '@eso-status/types';
|
|
|
3
3
|
* Connector used to get data from https://forums.elderscrollsonline.com/ and https://forums.elderscrollsonline.com/en/categories/pts
|
|
4
4
|
*/
|
|
5
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
6
|
/**
|
|
16
7
|
* Methode used to get the list of raw element from remote website
|
|
17
8
|
*
|
|
18
9
|
* @public
|
|
19
10
|
* @static
|
|
20
11
|
*
|
|
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
12
|
* @param url string Url to use to get list of raw element from remote specific url
|
|
31
|
-
*
|
|
13
|
+
*
|
|
14
|
+
* @return Promise<RawEsoStatus[]> List of raw element from remote website
|
|
32
15
|
*/
|
|
33
|
-
static
|
|
16
|
+
static getRemoteContent(url: string): Promise<RawEsoStatus[]>;
|
|
34
17
|
/**
|
|
35
18
|
* Methode used to get raw content from remote specific url
|
|
36
19
|
*
|
|
@@ -91,16 +74,6 @@ export default class ForumMessageConnector {
|
|
|
91
74
|
* @return string[] Sort raw content list
|
|
92
75
|
*/
|
|
93
76
|
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
77
|
/**
|
|
105
78
|
* Methode used to get slug for raw content list
|
|
106
79
|
*
|
|
@@ -50,38 +50,11 @@ var ForumMessageConnector = /** @class */ (function () {
|
|
|
50
50
|
* @public
|
|
51
51
|
* @static
|
|
52
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
53
|
* @param url string Url to use to get list of raw element from remote specific url
|
|
82
|
-
*
|
|
54
|
+
*
|
|
55
|
+
* @return Promise<RawEsoStatus[]> List of raw element from remote website
|
|
83
56
|
*/
|
|
84
|
-
ForumMessageConnector.
|
|
57
|
+
ForumMessageConnector.getRemoteContent = function (url) {
|
|
85
58
|
return __awaiter(this, void 0, void 0, function () {
|
|
86
59
|
var rawRemoteContent, rawWarningMessage, rawAlertMessage, mergedRawMessage, rawMessageSplit, sortedRawMessageList;
|
|
87
60
|
return __generator(this, function (_a) {
|
|
@@ -221,27 +194,6 @@ var ForumMessageConnector = /** @class */ (function () {
|
|
|
221
194
|
})
|
|
222
195
|
.filter(function (item) { return item !== '' && item !== ' '; });
|
|
223
196
|
};
|
|
224
|
-
/**
|
|
225
|
-
* Methode used to remove duplicate of raw content
|
|
226
|
-
*
|
|
227
|
-
* @public
|
|
228
|
-
* @static
|
|
229
|
-
*
|
|
230
|
-
* @param remoteContent RawEsoStatus[] List of raw element from remote website
|
|
231
|
-
* @return RawEsoStatus[] Raw content list without duplicate
|
|
232
|
-
*/
|
|
233
|
-
ForumMessageConnector.removeDuplicate = function (remoteContent) {
|
|
234
|
-
var list = [];
|
|
235
|
-
remoteContent.forEach(function (item) {
|
|
236
|
-
if (list[item.raw[0]] === undefined) {
|
|
237
|
-
list[item.raw[0]] = item;
|
|
238
|
-
}
|
|
239
|
-
else {
|
|
240
|
-
list[item.raw[0]].sources.push(item.sources[0]);
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
return Object.values(list);
|
|
244
|
-
};
|
|
245
197
|
/**
|
|
246
198
|
* Methode used to get slug for raw content list
|
|
247
199
|
*
|
|
@@ -354,18 +306,6 @@ var ForumMessageConnector = /** @class */ (function () {
|
|
|
354
306
|
return true;
|
|
355
307
|
});
|
|
356
308
|
};
|
|
357
|
-
/**
|
|
358
|
-
* URLs to get remote content
|
|
359
|
-
*
|
|
360
|
-
* @public
|
|
361
|
-
* @static
|
|
362
|
-
*
|
|
363
|
-
* @return string[] URLs to get remote content
|
|
364
|
-
*/
|
|
365
|
-
ForumMessageConnector.urls = [
|
|
366
|
-
'https://forums.elderscrollsonline.com/',
|
|
367
|
-
'https://forums.elderscrollsonline.com/en/categories/pts',
|
|
368
|
-
];
|
|
369
309
|
return ForumMessageConnector;
|
|
370
310
|
}());
|
|
371
311
|
exports.default = ForumMessageConnector;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { RawEsoStatus } from '@eso-status/types';
|
|
2
|
+
export declare const ForumMessageURL = "https://forums.elderscrollsonline.com/";
|
|
3
|
+
export declare const ForumMessagePTSURL = "https://forums.elderscrollsonline.com/en/categories/pts";
|
|
2
4
|
/**
|
|
3
5
|
* Class of Forum Message
|
|
4
6
|
*/
|
|
@@ -11,5 +13,5 @@ export declare class ForumMessage {
|
|
|
11
13
|
*
|
|
12
14
|
* @return Promise<RawEsoStatus[]> Forum Message elements
|
|
13
15
|
*/
|
|
14
|
-
static getData(): Promise<RawEsoStatus[]>;
|
|
16
|
+
static getData(url?: string): Promise<RawEsoStatus[]>;
|
|
15
17
|
}
|
package/lib/index.js
CHANGED
|
@@ -36,8 +36,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.ForumMessage = void 0;
|
|
39
|
+
exports.ForumMessage = exports.ForumMessagePTSURL = exports.ForumMessageURL = void 0;
|
|
40
40
|
var ForumMessageConnector_1 = require("./connectors/ForumMessageConnector");
|
|
41
|
+
exports.ForumMessageURL = 'https://forums.elderscrollsonline.com/';
|
|
42
|
+
exports.ForumMessagePTSURL = 'https://forums.elderscrollsonline.com/en/categories/pts';
|
|
41
43
|
/**
|
|
42
44
|
* Class of Forum Message
|
|
43
45
|
*/
|
|
@@ -53,11 +55,12 @@ var ForumMessage = /** @class */ (function () {
|
|
|
53
55
|
* @return Promise<RawEsoStatus[]> Forum Message elements
|
|
54
56
|
*/
|
|
55
57
|
ForumMessage.getData = function () {
|
|
56
|
-
return __awaiter(this,
|
|
58
|
+
return __awaiter(this, arguments, void 0, function (url) {
|
|
57
59
|
var remoteContent, slugOfRawContent, rawContentBySlug, rawContentWithRawDate, data;
|
|
60
|
+
if (url === void 0) { url = exports.ForumMessageURL; }
|
|
58
61
|
return __generator(this, function (_a) {
|
|
59
62
|
switch (_a.label) {
|
|
60
|
-
case 0: return [4 /*yield*/, ForumMessageConnector_1.default.getRemoteContent()];
|
|
63
|
+
case 0: return [4 /*yield*/, ForumMessageConnector_1.default.getRemoteContent(url)];
|
|
61
64
|
case 1:
|
|
62
65
|
remoteContent = _a.sent();
|
|
63
66
|
slugOfRawContent = ForumMessageConnector_1.default.getRawContentWithSlug(remoteContent);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eso-status/forum-message",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
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
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -42,24 +42,23 @@
|
|
|
42
42
|
},
|
|
43
43
|
"homepage": "https://github.com/eso-status/forum-message-dev#readme",
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@eso-status/types": "1.0.
|
|
45
|
+
"@eso-status/types": "1.0.7",
|
|
46
46
|
"@types/jest": "29.5.12",
|
|
47
|
-
"@types/node": "
|
|
48
|
-
"@typescript-eslint/eslint-plugin": "7.
|
|
49
|
-
"@typescript-eslint/parser": "7.
|
|
50
|
-
"@typescript-eslint/typescript-estree": "7.
|
|
47
|
+
"@types/node": "22.5.1",
|
|
48
|
+
"@typescript-eslint/eslint-plugin": "7.18.0",
|
|
49
|
+
"@typescript-eslint/parser": "7.18.0",
|
|
50
|
+
"@typescript-eslint/typescript-estree": "7.18.0",
|
|
51
51
|
"eslint": "8.57.0",
|
|
52
52
|
"eslint-config-airbnb-base": "15.0.0",
|
|
53
53
|
"eslint-plugin-import": "2.29.1",
|
|
54
|
-
"eslint-plugin-jest": "28.
|
|
54
|
+
"eslint-plugin-jest": "28.8.0",
|
|
55
55
|
"jest": "29.7.0",
|
|
56
|
-
"nodemon": "3.1.
|
|
57
|
-
"ts-jest": "29.
|
|
58
|
-
"typescript": "5.4
|
|
56
|
+
"nodemon": "3.1.4",
|
|
57
|
+
"ts-jest": "29.2.5",
|
|
58
|
+
"typescript": "5.5.4"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"axios": "1.
|
|
62
|
-
"fs": "^0.0.1-security",
|
|
61
|
+
"axios": "1.7.5",
|
|
63
62
|
"moment": "2.30.1"
|
|
64
63
|
}
|
|
65
64
|
}
|