worldstate-emitter 2.2.11 → 2.2.13

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/.mocharc.yml CHANGED
@@ -1,3 +1,3 @@
1
1
  exit: true
2
2
  spec: test/specs/**/*.spec.js
3
- timeout: 200000
3
+ timeout: 250000
package/.releaserc.yml ADDED
@@ -0,0 +1 @@
1
+ branches: master
package/index.js CHANGED
@@ -12,9 +12,9 @@ export default class WorldstateEmitter extends EventEmitter {
12
12
  #twitter;
13
13
  #rss;
14
14
 
15
- static async make({ locale } = { locale: undefined }) {
15
+ static async make({ locale, features } = { locale: undefined, features: [] }) {
16
16
  const emitter = new WorldstateEmitter({ locale });
17
- await emitter.#init();
17
+ await emitter.#init(features?.length ? features : FEATURES);
18
18
  return emitter;
19
19
  }
20
20
 
@@ -24,19 +24,18 @@ export default class WorldstateEmitter extends EventEmitter {
24
24
  */
25
25
  constructor({ locale } = { locale: undefined }) {
26
26
  super();
27
-
28
27
  this.#locale = locale;
29
28
  }
30
29
 
31
- async #init() {
32
- if (FEATURES.includes('rss')) {
30
+ async #init(/** @type {string[]} */ features) {
31
+ if (features.includes('rss')) {
33
32
  this.#rss = new RSS(this);
34
33
  }
35
- if (FEATURES.includes('worldstate')) {
34
+ if (features.includes('worldstate')) {
36
35
  this.#worldstate = new Worldstate(this, this.#locale);
37
36
  await this.#worldstate.init();
38
37
  }
39
- if (FEATURES.includes('twitter')) {
38
+ if (features.includes('twitter')) {
40
39
  this.#twitter = new Twitter(this);
41
40
  }
42
41
 
package/nodemon.json CHANGED
@@ -3,6 +3,7 @@
3
3
  "env": {
4
4
  "LOG_LEVEL": "debug",
5
5
  "CACHE_TIMEOUT": 60000,
6
- "SEMLAR_TIMEOUT": 300000
6
+ "SEMLAR_TIMEOUT": 300000,
7
+ "FEATURES": "worldstate"
7
8
  }
8
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "worldstate-emitter",
3
- "version": "2.2.11",
3
+ "version": "2.2.13",
4
4
  "description": "Event emitter for worldstate & other warframe events",
5
5
  "keywords": [
6
6
  "warframe",
@@ -38,29 +38,29 @@
38
38
  "test": "c8 mocha"
39
39
  },
40
40
  "dependencies": {
41
- "cron": "^4.3.3",
42
- "rss-feed-emitter": "^3.2.3",
41
+ "cron": "^4.3.4",
42
+ "rss-feed-emitter": "^3.2.4",
43
43
  "twitter": "^1.7.1"
44
44
  },
45
45
  "devDependencies": {
46
- "@commitlint/cli": "^20.0.0",
46
+ "@commitlint/cli": "^20.1.0",
47
47
  "@commitlint/config-conventional": "^20.0.0",
48
48
  "@wfcd/eslint-config": "latest",
49
49
  "c8": "^10.1.3",
50
- "chai": "^6.0.1",
50
+ "chai": "^6.2.1",
51
51
  "husky": "^9.1.7",
52
52
  "install-peerdeps": "^3.0.7",
53
- "lint-staged": "^16.1.5",
54
- "mocha": "^11.7.1",
55
- "nodemon": "^3.1.10",
56
- "prettier": "^3.6.2"
53
+ "lint-staged": "^16.2.7",
54
+ "mocha": "^11.7.5",
55
+ "nodemon": "^3.1.11",
56
+ "prettier": "^3.7.2"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "warframe-worldstate-data": "^3.x",
60
60
  "warframe-worldstate-parser": "^5.x"
61
61
  },
62
62
  "optionalDependencies": {
63
- "winston": "^3.17.0"
63
+ "winston": "^3.18.3"
64
64
  },
65
65
  "engines": {
66
66
  "node": ">= 18.19.0"
@@ -5,6 +5,4 @@ export const sentientUrl = process.env.SENTIENT_URL ?? 'https://semlar.com/anoma
5
5
  export const worldstateCron = process.env.WORLDSTATE_CRON ?? '25 */5 * * * *';
6
6
  export const externalCron = process.env.WS_EXTERNAL_CRON ?? '0 */10 * * * *';
7
7
 
8
- export const FEATURES = process.env.WS_EMITTER_FEATURES
9
- ? process.env.WS_EMITTER_FEATURES.split(',')
10
- : ['rss', 'twitter', 'worldstate'];
8
+ export const FEATURES = process.env.WS_EMITTER_FEATURES ? process.env.WS_EMITTER_FEATURES.split(',') : [];
@@ -29,12 +29,20 @@ export default class CronCache extends EventEmitter {
29
29
  async #update() {
30
30
  this.#updating = this.#fetch();
31
31
  this.#logger.debug(`update starting for ${this.#url}`);
32
+ let error;
32
33
  try {
33
34
  this.#data = await this.#updating;
34
35
  return this.#updating;
36
+ } catch (e) {
37
+ this.#data = undefined;
38
+ error = e;
35
39
  } finally {
36
- this.emit('update', this.#data);
37
- this.#logger.debug(`update done for ${this.#url}`);
40
+ if (this.#data) {
41
+ this.emit('update', this.#data);
42
+ this.#logger.debug(`update done for ${this.#url}`);
43
+ } else {
44
+ this.#logger.debug(`update failed for ${this.#url} : ${error}`);
45
+ }
38
46
  this.#updating = undefined;
39
47
  }
40
48
  }