worldstate-emitter 1.0.4 → 1.0.8
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/README.md +6 -6
- package/SECURITY.md +17 -0
- package/handlers/Twitter.js +2 -2
- package/handlers/Worldstate.js +16 -163
- package/handlers/events/arrayLike.js +20 -0
- package/handlers/events/checkOverrides.js +19 -0
- package/handlers/events/cycleLike.js +1 -1
- package/handlers/events/eKeyOverrides.js +28 -0
- package/handlers/events/kuva.js +31 -0
- package/handlers/events/objectLike.js +1 -1
- package/handlers/events/parse.js +72 -0
- package/package.json +63 -20
- package/resources/tweeters.json +3 -3
- package/utilities/WSCache.js +5 -1
- package/.codeclimate.yml +0 -13
- package/.eslintrc.json +0 -33
- package/.github/.stale.yml +0 -13
- package/.github/CODEOWNERS +0 -1
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -27
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -17
- package/.github/update_docs.sh +0 -22
- package/.snyk +0 -8
- package/docs/RSS.html +0 -424
- package/docs/TwitterCache.html +0 -900
- package/docs/WSCache.html +0 -734
- package/docs/Worldstate.html +0 -1294
- package/docs/classes.list.html +0 -344
- package/docs/fonts/glyphicons-halflings-regular.eot +0 -0
- package/docs/fonts/glyphicons-halflings-regular.svg +0 -288
- package/docs/fonts/glyphicons-halflings-regular.ttf +0 -0
- package/docs/fonts/glyphicons-halflings-regular.woff +0 -0
- package/docs/fonts/glyphicons-halflings-regular.woff2 +0 -0
- package/docs/global.html +0 -1882
- package/docs/handlers_RSS.js.html +0 -321
- package/docs/handlers_Twitter.js.html +0 -431
- package/docs/handlers_Worldstate.js.html +0 -559
- package/docs/img/glyphicons-halflings-white.png +0 -0
- package/docs/img/glyphicons-halflings.png +0 -0
- package/docs/index.html +0 -402
- package/docs/quicksearch.html +0 -31
- package/docs/scripts/docstrap.lib.js +0 -11
- package/docs/scripts/fulltext-search-ui.js +0 -89
- package/docs/scripts/fulltext-search.js +0 -36
- package/docs/scripts/lunr.min.js +0 -6
- package/docs/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/docs/scripts/prettify/jquery.min.js +0 -6
- package/docs/scripts/prettify/lang-css.js +0 -21
- package/docs/scripts/prettify/prettify.js +0 -496
- package/docs/scripts/sunlight.js +0 -1157
- package/docs/scripts/toc.js +0 -203
- package/docs/styles/darkstrap.css +0 -960
- package/docs/styles/prettify-tomorrow.css +0 -132
- package/docs/styles/site.cerulean.css +0 -7008
- package/docs/styles/site.cosmo.css +0 -7061
- package/docs/styles/site.cyborg.css +0 -7048
- package/docs/styles/site.darkly.css +0 -7171
- package/docs/styles/site.darkstrap.css +0 -5638
- package/docs/styles/site.dibs-bootstrap.css +0 -5899
- package/docs/styles/site.flatly.css +0 -7147
- package/docs/styles/site.journal.css +0 -6973
- package/docs/styles/site.lumen.css +0 -7298
- package/docs/styles/site.paper.css +0 -7623
- package/docs/styles/site.readable.css +0 -6997
- package/docs/styles/site.sandstone.css +0 -7035
- package/docs/styles/site.simplex.css +0 -7023
- package/docs/styles/site.slate.css +0 -7343
- package/docs/styles/site.spacelab.css +0 -7055
- package/docs/styles/site.superhero.css +0 -7131
- package/docs/styles/site.united.css +0 -6895
- package/docs/styles/site.yeti.css +0 -7195
- package/docs/styles/sunlight.dark.css +0 -345
- package/docs/styles/sunlight.default.css +0 -344
- package/docs/utilities_WSCache.js.html +0 -322
- package/docs/utilities_index.js.html +0 -338
- package/jsdoc-config.json +0 -35
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Worldstate Emitter
|
|
1
|
+
# Worldstate Emitter
|
|
2
2
|
|
|
3
3
|
Suuuper simple emitter for worldstate events.
|
|
4
4
|
|
|
@@ -6,11 +6,11 @@ Very opinionated decisions on what events and event names, as well as
|
|
|
6
6
|
|
|
7
7
|
## Emitter Events
|
|
8
8
|
|
|
9
|
-
Emitter Event | Emit key
|
|
10
|
-
|
|
11
|
-
RSS
|
|
12
|
-
Worldstate
|
|
13
|
-
Tweet
|
|
9
|
+
| Emitter Event | Emit key | description |
|
|
10
|
+
|:--------------|-------------|---------------------------------------------|
|
|
11
|
+
| RSS | `rss` | New forum post from DE |
|
|
12
|
+
| Worldstate | `ws:update` | New Worldstate event |
|
|
13
|
+
| Tweet | `tweet` | New tweet from one of the selected accounts |
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
<details>
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
All versions are supported, but it's recommended to stay on the always current version.
|
|
6
|
+
There may be known vulnerabilities in development dependencies that are avoidable.
|
|
7
|
+
|
|
8
|
+
| Version | Supported |
|
|
9
|
+
| ------- | ------------------ |
|
|
10
|
+
| 1.x+ | :white_check_mark: |
|
|
11
|
+
| < 1.0 | :x:
|
|
12
|
+
|
|
13
|
+
## Reporting a Vulnerability
|
|
14
|
+
|
|
15
|
+
Vulnerabilities from version updates should have automated PRs from dependabot.
|
|
16
|
+
|
|
17
|
+
If there is a vulnerability in the code itself, please submit an issue (or also a PR if you have the solution), mentioning the vulnerability.
|
package/handlers/Twitter.js
CHANGED
|
@@ -123,7 +123,7 @@ class TwitterCache {
|
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
125
|
* Get data able to be parsed from twitter.
|
|
126
|
-
* @returns {Promise.<Array.<Object>>}
|
|
126
|
+
* @returns {Promise.<Array.<Object>>} Tweets
|
|
127
127
|
*/
|
|
128
128
|
async getParseableData() {
|
|
129
129
|
logger.silly('Starting Twitter update...');
|
|
@@ -151,7 +151,7 @@ class TwitterCache {
|
|
|
151
151
|
|
|
152
152
|
/**
|
|
153
153
|
* Handle errors that arise while fetching data from twitter
|
|
154
|
-
* @param {
|
|
154
|
+
* @param {Error} error twitter error
|
|
155
155
|
*/
|
|
156
156
|
onError(error) {
|
|
157
157
|
if (error[0] && error[0].code === 32) {
|
package/handlers/Worldstate.js
CHANGED
|
@@ -5,7 +5,9 @@ const { locales } = require('warframe-worldstate-data');
|
|
|
5
5
|
|
|
6
6
|
const WSCache = require('../utilities/WSCache');
|
|
7
7
|
|
|
8
|
-
const { logger,
|
|
8
|
+
const { logger, lastUpdated } = require('../utilities');
|
|
9
|
+
|
|
10
|
+
const parseNew = require('./events/parse');
|
|
9
11
|
|
|
10
12
|
const wsTimeout = process.env.CACHE_TIMEOUT || 60000;
|
|
11
13
|
const platforms = ['pc', 'ps4', 'xb1', 'swi'];
|
|
@@ -13,161 +15,10 @@ const worldStates = {};
|
|
|
13
15
|
const wsRawCaches = {};
|
|
14
16
|
|
|
15
17
|
const debugEvents = ['arbitration', 'kuva', 'nightwave'];
|
|
16
|
-
|
|
17
18
|
const smTimeout = process.env.SEMLAR_TIMEOUT || 300000;
|
|
18
19
|
const kuvaCache = new Cache('https://10o.io/arbitrations.json', smTimeout, { logger, maxRetry: 0 });
|
|
19
20
|
const sentientCache = new Cache('https://semlar.com/anomaly.json', smTimeout, { logger });
|
|
20
21
|
|
|
21
|
-
const fissureKey = (fissure) => `fissures.t${fissure.tierNum}.${(fissure.missionType || '').toLowerCase()}`;
|
|
22
|
-
const acolyteKey = (acolyte) => ({
|
|
23
|
-
eventKey: `enemies${acolyte.isDiscovered ? '' : '.departed'}`,
|
|
24
|
-
activation: acolyte.lastDiscoveredAt,
|
|
25
|
-
});
|
|
26
|
-
const arbiKey = (arbitration) => {
|
|
27
|
-
if (!(arbitration && arbitration.enemy)) return '';
|
|
28
|
-
|
|
29
|
-
let k;
|
|
30
|
-
try {
|
|
31
|
-
k = `arbitration.${arbitration.enemy.toLowerCase()}.${arbitration.type.replace(/\s/g, '').toLowerCase()}`;
|
|
32
|
-
} catch (e) {
|
|
33
|
-
logger.error(`Unable to parse arbitraion: ${JSON.stringify(arbitration)}\n${e}`);
|
|
34
|
-
}
|
|
35
|
-
return k;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const eKeyOverrides = {
|
|
39
|
-
events: 'operations',
|
|
40
|
-
persistentEnemies: 'enemies',
|
|
41
|
-
fissures: fissureKey,
|
|
42
|
-
enemies: acolyteKey,
|
|
43
|
-
arbitration: arbiKey,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Find overrides for the provided key
|
|
48
|
-
* @param {string} key worldsate field to find overrides
|
|
49
|
-
* @param {Object} data data corresponding to the key from provided worldstate
|
|
50
|
-
* @returns {string} overrided key
|
|
51
|
-
*/
|
|
52
|
-
const checkOverrides = (key, data) => {
|
|
53
|
-
if (typeof eKeyOverrides[key] === 'string') {
|
|
54
|
-
return eKeyOverrides[key];
|
|
55
|
-
}
|
|
56
|
-
if (typeof eKeyOverrides[key] === 'function') {
|
|
57
|
-
return eKeyOverrides[key](data);
|
|
58
|
-
}
|
|
59
|
-
return key;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Process kuva fields
|
|
64
|
-
* @param {Object} deps dependencies for processing
|
|
65
|
-
* @param {Object[]} packets packets to emit
|
|
66
|
-
* @returns {Object|Object[]} object(s) to emit from kuva stuff
|
|
67
|
-
*/
|
|
68
|
-
const kuvaProcessing = (deps, packets) => {
|
|
69
|
-
if (!deps.data) {
|
|
70
|
-
logger.error('no kuva data');
|
|
71
|
-
return undefined;
|
|
72
|
-
}
|
|
73
|
-
const data = groupBy(deps.data, 'type');
|
|
74
|
-
Object.keys(data).forEach((type) => {
|
|
75
|
-
deps = {
|
|
76
|
-
...deps,
|
|
77
|
-
data: data[type],
|
|
78
|
-
id: `kuva.${data[type][0].type.replace(/\s/g, '').toLowerCase()}`,
|
|
79
|
-
activation: data[type][0].activation,
|
|
80
|
-
expiry: data[type][0].expiry,
|
|
81
|
-
};
|
|
82
|
-
const p = require('./events/objectLike')(deps.data, deps);
|
|
83
|
-
if (p) {
|
|
84
|
-
packets.push(p);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
return packets.filter((p) => p);
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* arrayLike are all just arrays of objectLike
|
|
92
|
-
* @param {Object} deps dependencies for processing
|
|
93
|
-
* @param {Object[]} packets packets to emit
|
|
94
|
-
* @returns {Object|Object[]} object(s) to emit from arrayLike processing
|
|
95
|
-
*/
|
|
96
|
-
const arrayLike = (deps, packets) => {
|
|
97
|
-
deps.data.forEach((arrayItem) => {
|
|
98
|
-
const k = checkOverrides(deps.key, arrayItem);
|
|
99
|
-
packets.push(require('./events/objectLike')(arrayItem, {
|
|
100
|
-
...deps,
|
|
101
|
-
id: k,
|
|
102
|
-
}));
|
|
103
|
-
});
|
|
104
|
-
return packets;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Set up current cycle start if it's not been intiated
|
|
109
|
-
* @param {Object} deps dependencies for processing
|
|
110
|
-
*/
|
|
111
|
-
const initCycleStart = (deps) => {
|
|
112
|
-
if (!lastUpdated[deps.platform][deps.language]) {
|
|
113
|
-
lastUpdated[deps.platform][deps.language] = deps.cycleStart;
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Parse new events from the provided worldstate
|
|
119
|
-
* @param {Object} deps dependencies to parse out events
|
|
120
|
-
* @returns {Packet|Packet[]} packet(s) to emit
|
|
121
|
-
*/
|
|
122
|
-
const parseNew = (deps) => {
|
|
123
|
-
initCycleStart(deps);
|
|
124
|
-
|
|
125
|
-
// anything in the eKeyOverrides goes first, then anything uniform
|
|
126
|
-
const packets = [];
|
|
127
|
-
switch (deps.key) {
|
|
128
|
-
case 'kuva':
|
|
129
|
-
return kuvaProcessing(deps, packets);
|
|
130
|
-
case 'events':
|
|
131
|
-
deps = {
|
|
132
|
-
...deps,
|
|
133
|
-
id: eKeyOverrides[deps.key],
|
|
134
|
-
};
|
|
135
|
-
case 'alerts':
|
|
136
|
-
case 'conclaveChallenges':
|
|
137
|
-
case 'dailyDeals':
|
|
138
|
-
case 'flashSales':
|
|
139
|
-
case 'fissures':
|
|
140
|
-
case 'globalUpgrades':
|
|
141
|
-
case 'invasions':
|
|
142
|
-
case 'syndicateMissions':
|
|
143
|
-
case 'weeklyChallenges':
|
|
144
|
-
packets.push(...arrayLike(deps, packets));
|
|
145
|
-
break;
|
|
146
|
-
case 'cetusCycle':
|
|
147
|
-
case 'earthCycle':
|
|
148
|
-
case 'vallisCycle':
|
|
149
|
-
packets.push(require('./events/cycleLike')(deps.data, deps));
|
|
150
|
-
break;
|
|
151
|
-
case 'persistentEnemies':
|
|
152
|
-
deps = {
|
|
153
|
-
...deps,
|
|
154
|
-
...checkOverrides(deps.key, deps.data),
|
|
155
|
-
};
|
|
156
|
-
case 'sortie':
|
|
157
|
-
case 'voidTrader':
|
|
158
|
-
case 'arbitration':
|
|
159
|
-
case 'sentientOutposts':
|
|
160
|
-
deps.id = checkOverrides(deps.key, deps.data);
|
|
161
|
-
packets.push(require('./events/objectLike')(deps.data, deps));
|
|
162
|
-
case 'nightwave':
|
|
163
|
-
packets.push(require('./events/nightwave')(deps.data, deps));
|
|
164
|
-
default:
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
return packets;
|
|
169
|
-
};
|
|
170
|
-
|
|
171
22
|
/**
|
|
172
23
|
* Handler for worldstate data
|
|
173
24
|
*/
|
|
@@ -201,13 +52,13 @@ class Worldstate {
|
|
|
201
52
|
platforms.forEach((p) => {
|
|
202
53
|
if (this.platform && this.platform !== p) return;
|
|
203
54
|
|
|
204
|
-
const url = `
|
|
55
|
+
const url = `https://content${p === 'pc' ? '' : `.${p}`}.warframe.com/dynamic/worldState.php`;
|
|
205
56
|
worldStates[p] = {};
|
|
206
57
|
|
|
207
58
|
locales.forEach(async (locale) => {
|
|
208
59
|
if (!this.locale || this.locale === locale) {
|
|
209
60
|
worldStates[p][locale] = new WSCache({
|
|
210
|
-
platform: p, locale, kuvaCache, sentientCache, eventEmitter: this.emitter,
|
|
61
|
+
platform: p, language: locale, kuvaCache, sentientCache, eventEmitter: this.emitter,
|
|
211
62
|
});
|
|
212
63
|
}
|
|
213
64
|
});
|
|
@@ -255,16 +106,18 @@ class Worldstate {
|
|
|
255
106
|
const cycleStart = Date.now();
|
|
256
107
|
const packets = [];
|
|
257
108
|
Object.keys(worldstate).forEach(async (key) => {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
if (packet
|
|
264
|
-
|
|
109
|
+
if (worldstate && worldstate[key]) {
|
|
110
|
+
const packet = parseNew({
|
|
111
|
+
data: worldstate[key], key, language, platform, cycleStart,
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
if (Array.isArray(packet)) {
|
|
115
|
+
if (packet.length) {
|
|
116
|
+
packets.push(...(packet.filter((p) => p && p !== null)));
|
|
117
|
+
}
|
|
118
|
+
} else if (packet) {
|
|
119
|
+
packets.push(packet);
|
|
265
120
|
}
|
|
266
|
-
} else if (packet) {
|
|
267
|
-
packets.push(packet);
|
|
268
121
|
}
|
|
269
122
|
});
|
|
270
123
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const checkOverrides = require('./checkOverrides');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* arrayLike are all just arrays of objectLike
|
|
7
|
+
* @param {Object} deps dependencies for processing
|
|
8
|
+
* @param {Object[]} packets packets to emit
|
|
9
|
+
* @returns {Object|Object[]} object(s) to emit from arrayLike processing
|
|
10
|
+
*/
|
|
11
|
+
module.exports = (deps, packets) => {
|
|
12
|
+
deps.data.forEach((arrayItem) => {
|
|
13
|
+
const k = checkOverrides(deps.key, arrayItem);
|
|
14
|
+
packets.push(require('./objectLike')(arrayItem, {
|
|
15
|
+
...deps,
|
|
16
|
+
id: k,
|
|
17
|
+
}));
|
|
18
|
+
});
|
|
19
|
+
return packets;
|
|
20
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const eKeyOverrides = require('./eKeyOverrides');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Find overrides for the provided key
|
|
7
|
+
* @param {string} key worldsate field to find overrides
|
|
8
|
+
* @param {Object} data data corresponding to the key from provided worldstate
|
|
9
|
+
* @returns {string} overrided key
|
|
10
|
+
*/
|
|
11
|
+
module.exports = (key, data) => {
|
|
12
|
+
if (typeof eKeyOverrides[key] === 'string') {
|
|
13
|
+
return eKeyOverrides[key];
|
|
14
|
+
}
|
|
15
|
+
if (typeof eKeyOverrides[key] === 'function') {
|
|
16
|
+
return eKeyOverrides[key](data);
|
|
17
|
+
}
|
|
18
|
+
return key;
|
|
19
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { logger } = require('../../utilities');
|
|
4
|
+
|
|
5
|
+
const fissureKey = (fissure) => `fissures.t${fissure.tierNum}.${(fissure.missionType || '').toLowerCase()}`;
|
|
6
|
+
const acolyteKey = (acolyte) => ({
|
|
7
|
+
eventKey: `enemies${acolyte.isDiscovered ? '' : '.departed'}`,
|
|
8
|
+
activation: acolyte.lastDiscoveredAt,
|
|
9
|
+
});
|
|
10
|
+
const arbiKey = (arbitration) => {
|
|
11
|
+
if (!(arbitration && arbitration.enemy)) return '';
|
|
12
|
+
|
|
13
|
+
let k;
|
|
14
|
+
try {
|
|
15
|
+
k = `arbitration.${arbitration.enemy.toLowerCase()}.${arbitration.type.replace(/\s/g, '').toLowerCase()}`;
|
|
16
|
+
} catch (e) {
|
|
17
|
+
logger.error(`Unable to parse arbitraion: ${JSON.stringify(arbitration)}\n${e}`);
|
|
18
|
+
}
|
|
19
|
+
return k;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
module.exports = {
|
|
23
|
+
events: 'operations',
|
|
24
|
+
persistentEnemies: 'enemies',
|
|
25
|
+
fissures: fissureKey,
|
|
26
|
+
enemies: acolyteKey,
|
|
27
|
+
arbitration: arbiKey,
|
|
28
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { logger, groupBy } = require('../../utilities');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Process kuva fields
|
|
7
|
+
* @param {Object} deps dependencies for processing
|
|
8
|
+
* @param {Object[]} packets packets to emit
|
|
9
|
+
* @returns {Object|Object[]} object(s) to emit from kuva stuff
|
|
10
|
+
*/
|
|
11
|
+
module.exports = (deps, packets) => {
|
|
12
|
+
if (!deps.data) {
|
|
13
|
+
logger.error('no kuva data');
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
const data = groupBy(deps.data, 'type');
|
|
17
|
+
Object.keys(data).forEach((type) => {
|
|
18
|
+
deps = {
|
|
19
|
+
...deps,
|
|
20
|
+
data: data[type],
|
|
21
|
+
id: `kuva.${data[type][0].type.replace(/\s/g, '').toLowerCase()}`,
|
|
22
|
+
activation: data[type][0].activation,
|
|
23
|
+
expiry: data[type][0].expiry,
|
|
24
|
+
};
|
|
25
|
+
const p = require('./objectLike')(deps.data, deps);
|
|
26
|
+
if (p) {
|
|
27
|
+
packets.push(p);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
return packets.filter((p) => p);
|
|
31
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const checkOverrides = require('./checkOverrides');
|
|
4
|
+
const kuvaProcessing = require('./kuva');
|
|
5
|
+
const arrayLike = require('./arrayLike');
|
|
6
|
+
const eKeyOverrides = require('./eKeyOverrides');
|
|
7
|
+
|
|
8
|
+
const { lastUpdated } = require('../../utilities');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Set up current cycle start if it's not been intiated
|
|
12
|
+
* @param {Object} deps dependencies for processing
|
|
13
|
+
*/
|
|
14
|
+
const initCycleStart = (deps) => {
|
|
15
|
+
if (!lastUpdated[deps.platform][deps.language]) {
|
|
16
|
+
lastUpdated[deps.platform][deps.language] = deps.cycleStart;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Parse new events from the provided worldstate
|
|
22
|
+
* @param {Object} deps dependencies to parse out events
|
|
23
|
+
* @returns {Packet|Packet[]} packet(s) to emit
|
|
24
|
+
*/
|
|
25
|
+
module.exports = (deps) => {
|
|
26
|
+
initCycleStart(deps);
|
|
27
|
+
|
|
28
|
+
// anything in the eKeyOverrides goes first, then anything uniform
|
|
29
|
+
const packets = [];
|
|
30
|
+
switch (deps.key) {
|
|
31
|
+
case 'kuva':
|
|
32
|
+
return kuvaProcessing(deps, packets);
|
|
33
|
+
case 'events':
|
|
34
|
+
deps = {
|
|
35
|
+
...deps,
|
|
36
|
+
id: eKeyOverrides[deps.key],
|
|
37
|
+
};
|
|
38
|
+
case 'alerts':
|
|
39
|
+
case 'conclaveChallenges':
|
|
40
|
+
case 'dailyDeals':
|
|
41
|
+
case 'flashSales':
|
|
42
|
+
case 'fissures':
|
|
43
|
+
case 'globalUpgrades':
|
|
44
|
+
case 'invasions':
|
|
45
|
+
case 'syndicateMissions':
|
|
46
|
+
case 'weeklyChallenges':
|
|
47
|
+
packets.push(...arrayLike(deps, packets));
|
|
48
|
+
break;
|
|
49
|
+
case 'cetusCycle':
|
|
50
|
+
case 'earthCycle':
|
|
51
|
+
case 'vallisCycle':
|
|
52
|
+
packets.push(require('./cycleLike')(deps.data, deps));
|
|
53
|
+
break;
|
|
54
|
+
case 'persistentEnemies':
|
|
55
|
+
deps = {
|
|
56
|
+
...deps,
|
|
57
|
+
...checkOverrides(deps.key, deps.data),
|
|
58
|
+
};
|
|
59
|
+
case 'sortie':
|
|
60
|
+
case 'voidTrader':
|
|
61
|
+
case 'arbitration':
|
|
62
|
+
case 'sentientOutposts':
|
|
63
|
+
deps.id = checkOverrides(deps.key, deps.data);
|
|
64
|
+
packets.push(require('./objectLike')(deps.data, deps));
|
|
65
|
+
case 'nightwave':
|
|
66
|
+
packets.push(require('./nightwave')(deps.data, deps));
|
|
67
|
+
default:
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return packets;
|
|
72
|
+
};
|
package/package.json
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "worldstate-emitter",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Event emitter for worldstate & other warframe events",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "nyc mocha test/specs --exit",
|
|
7
|
+
"test": "nyc --reporter=lcov mocha test/specs --exit",
|
|
8
8
|
"lint": "eslint index.js handlers/**.js utilities/**.js",
|
|
9
9
|
"lint:fix": "eslint index.js handlers/**.js utilities/**.js --fix",
|
|
10
|
-
"coverage": "npm test && nyc report --reporter=text-lcov |
|
|
11
|
-
"build-docs": "
|
|
12
|
-
"dev": "
|
|
13
|
-
"snyk-protect": "npx snyk protect",
|
|
14
|
-
"prepare": "npm run snyk-protect"
|
|
10
|
+
"coverage": "npm test && nyc report --reporter=text-lcov | coveralls",
|
|
11
|
+
"build-docs": "jsdoc -c jsdoc-config.json -d docs",
|
|
12
|
+
"dev": "nodemon test/tester.js"
|
|
15
13
|
},
|
|
16
14
|
"directories": {
|
|
17
15
|
"test": "test/specs"
|
|
@@ -33,27 +31,73 @@
|
|
|
33
31
|
},
|
|
34
32
|
"homepage": "https://github.com/wfcd/worldstate-emitter#readme",
|
|
35
33
|
"dependencies": {
|
|
36
|
-
"@sentry/node": "^
|
|
34
|
+
"@sentry/node": "^6.9.0",
|
|
37
35
|
"colors": "^1.4.0",
|
|
38
36
|
"json-fetch-cache": "^1.2.6",
|
|
39
|
-
"rss-feed-emitter": "^3.2.
|
|
37
|
+
"rss-feed-emitter": "^3.2.2",
|
|
40
38
|
"twitter": "^1.7.1",
|
|
41
|
-
"warframe-worldstate-data": "^1.
|
|
42
|
-
"warframe-worldstate-parser": "^2.
|
|
39
|
+
"warframe-worldstate-data": "^1.18.15",
|
|
40
|
+
"warframe-worldstate-parser": "^2.19.0",
|
|
43
41
|
"winston": "^3.3.3"
|
|
44
42
|
},
|
|
45
43
|
"devDependencies": {
|
|
46
|
-
"chai": "^4.
|
|
47
|
-
"
|
|
48
|
-
"eslint
|
|
49
|
-
"eslint-
|
|
50
|
-
"
|
|
51
|
-
"mocha": "^
|
|
52
|
-
"
|
|
44
|
+
"chai": "^4.3.4",
|
|
45
|
+
"coveralls": "^3.1.0",
|
|
46
|
+
"eslint": "^8.2.0",
|
|
47
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
48
|
+
"eslint-plugin-import": "^2.22.1",
|
|
49
|
+
"mocha": "^9.0.2",
|
|
50
|
+
"nodemon": "^2.0.7",
|
|
51
|
+
"nyc": "^15.1.0"
|
|
53
52
|
},
|
|
54
53
|
"engines": {
|
|
55
54
|
"node": ">=10.19.0"
|
|
56
55
|
},
|
|
56
|
+
"eslintIgnore": [
|
|
57
|
+
".github/**",
|
|
58
|
+
"docs/**",
|
|
59
|
+
"resources/**",
|
|
60
|
+
"types/**"
|
|
61
|
+
],
|
|
62
|
+
"eslintConfig": {
|
|
63
|
+
"extends": "airbnb-base",
|
|
64
|
+
"parserOptions": {
|
|
65
|
+
"sourceType": "script"
|
|
66
|
+
},
|
|
67
|
+
"rules": {
|
|
68
|
+
"valid-jsdoc": [
|
|
69
|
+
"error",
|
|
70
|
+
{
|
|
71
|
+
"requireReturn": false,
|
|
72
|
+
"requireReturnDescription": false,
|
|
73
|
+
"preferType": {
|
|
74
|
+
"String": "string",
|
|
75
|
+
"Number": "number",
|
|
76
|
+
"Boolean": "boolean",
|
|
77
|
+
"Function": "function",
|
|
78
|
+
"object": "Object",
|
|
79
|
+
"date": "Date",
|
|
80
|
+
"error": "Error"
|
|
81
|
+
},
|
|
82
|
+
"prefer": {
|
|
83
|
+
"return": "returns"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"no-underscore-dangle": "off",
|
|
88
|
+
"strict": [
|
|
89
|
+
"error",
|
|
90
|
+
"safe"
|
|
91
|
+
],
|
|
92
|
+
"linebreak-style": "off",
|
|
93
|
+
"no-restricted-syntax": "off",
|
|
94
|
+
"no-await-in-loop": "off",
|
|
95
|
+
"global-require": "off",
|
|
96
|
+
"no-fallthrough": "off",
|
|
97
|
+
"no-param-reassign": "off",
|
|
98
|
+
"no-case-declarations": "off"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
57
101
|
"nodemonConfig": {
|
|
58
102
|
"delay": 5000,
|
|
59
103
|
"env": {
|
|
@@ -61,6 +105,5 @@
|
|
|
61
105
|
"CACHE_TIMEOUT": 60000,
|
|
62
106
|
"SEMLAR_TIMEOUT": 300000
|
|
63
107
|
}
|
|
64
|
-
}
|
|
65
|
-
"snyk": true
|
|
108
|
+
}
|
|
66
109
|
}
|
package/resources/tweeters.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[
|
|
2
2
|
{ "acc_name": "@playwarframe", "plain": "warframe" },
|
|
3
3
|
{ "acc_name": "@digitalextremes", "plain": "digitalextremes" },
|
|
4
|
-
{ "acc_name": "@
|
|
4
|
+
{ "acc_name": "@PabloMakes", "plain": "pablo" },
|
|
5
5
|
{ "acc_name": "@Cam_Rogers", "plain": "cameron" },
|
|
6
6
|
{ "acc_name": "@rebbford", "plain": "rebecca" },
|
|
7
7
|
{ "acc_name": "@sj_sinclair", "plain": "steve" },
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
{ "acc_name": "@GameSoundDesign", "plain": "george" },
|
|
11
11
|
{ "acc_name": "@msinilo", "plain": "maciej" },
|
|
12
12
|
{ "acc_name": "@sheldoncarter", "plain": "sheldon" },
|
|
13
|
-
{ "acc_name": "@
|
|
13
|
+
{ "acc_name": "@MarcusKretz", "plain": "marcus" },
|
|
14
14
|
{ "acc_name": "@Helen_Heikkila", "plain": "helen" },
|
|
15
15
|
{ "acc_name": "@tobitenno", "plain": "tobiah" },
|
|
16
16
|
{ "acc_name": "@wfdiscord", "plain": "wfdiscord" }
|
|
17
|
-
]
|
|
17
|
+
]
|
package/utilities/WSCache.js
CHANGED
|
@@ -54,7 +54,11 @@ class WSCache {
|
|
|
54
54
|
if (!t.timestamp) return;
|
|
55
55
|
|
|
56
56
|
this.inner = t;
|
|
57
|
-
this.emitter.emit('ws:update:parsed', {
|
|
57
|
+
this.emitter.emit('ws:update:parsed', {
|
|
58
|
+
language: this.language,
|
|
59
|
+
platform: this.platform,
|
|
60
|
+
data: this.inner,
|
|
61
|
+
});
|
|
58
62
|
}, 1000);
|
|
59
63
|
}
|
|
60
64
|
|
package/.codeclimate.yml
DELETED
package/.eslintrc.json
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "airbnb-base",
|
|
3
|
-
"parserOptions": {
|
|
4
|
-
"sourceType": "script"
|
|
5
|
-
},
|
|
6
|
-
"rules": {
|
|
7
|
-
"valid-jsdoc": ["error", {
|
|
8
|
-
"requireReturn": false,
|
|
9
|
-
"requireReturnDescription": false,
|
|
10
|
-
"preferType": {
|
|
11
|
-
"String": "string",
|
|
12
|
-
"Number": "number",
|
|
13
|
-
"Boolean": "boolean",
|
|
14
|
-
"Function": "function",
|
|
15
|
-
"object": "Object",
|
|
16
|
-
"date": "Date",
|
|
17
|
-
"error": "Error"
|
|
18
|
-
},
|
|
19
|
-
"prefer": {
|
|
20
|
-
"return": "returns"
|
|
21
|
-
}
|
|
22
|
-
}],
|
|
23
|
-
"no-underscore-dangle": "off",
|
|
24
|
-
"strict": ["error", "safe"],
|
|
25
|
-
"linebreak-style": "off",
|
|
26
|
-
"no-restricted-syntax": "off",
|
|
27
|
-
"no-await-in-loop": "off",
|
|
28
|
-
"global-require": "off",
|
|
29
|
-
"no-fallthrough": "off",
|
|
30
|
-
"no-param-reassign": "off",
|
|
31
|
-
"no-case-declarations": "off"
|
|
32
|
-
}
|
|
33
|
-
}
|
package/.github/.stale.yml
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
daysUntilStale: 60
|
|
2
|
-
daysUntilClose: 7
|
|
3
|
-
exemptLabels:
|
|
4
|
-
- greenkeeper
|
|
5
|
-
- 'Status: In Progress'
|
|
6
|
-
- 'Status: Accepted'
|
|
7
|
-
- 'Severity1: Critical'
|
|
8
|
-
staleLabel: 'Status: Denied'
|
|
9
|
-
markComment: >
|
|
10
|
-
This issue has been automatically marked as stale because it has not had
|
|
11
|
-
recent activity. It will be closed if no further activity occurs. Thank you
|
|
12
|
-
for your contributions.
|
|
13
|
-
closeComment: false
|