worldstate-emitter 2.2.0 → 2.2.1

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/.babelrc.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "plugins": ["@babel/plugin-transform-class-properties", "@babel/plugin-transform-private-methods"],
3
+ "presets": ["@babel/preset-env"]
4
+ }
@@ -0,0 +1,5 @@
1
+ extends:
2
+ - '@commitlint/config-conventional'
3
+ rules:
4
+ body-max-line-length:
5
+ - 0
package/.eslintignore ADDED
@@ -0,0 +1,4 @@
1
+ .github/**
2
+ docs/**
3
+ resources/**
4
+ types/**
package/.eslintrc.yml ADDED
@@ -0,0 +1,9 @@
1
+ parser: '@babel/eslint-parser'
2
+ parserOptions:
3
+ ecmaFeatures:
4
+ modules: true
5
+ ecmaVersion: 6
6
+ sourceType: module
7
+ extends: '@wfcd/eslint-config/esm'
8
+ rules:
9
+ no-underscore-dangle: 'off'
@@ -0,0 +1,9 @@
1
+ '*.js':
2
+ - eslint --cache --fix
3
+ - npm test
4
+ package*.json:
5
+ - prettier --write
6
+ - npm dedupe
7
+ - npx sort-package-json
8
+ '*.{json,yml,yaml}':
9
+ - prettier --write
package/.mocharc.yml ADDED
@@ -0,0 +1,3 @@
1
+ exit: true
2
+ spec: test/specs/**/*.spec.js
3
+ timeout: 20000
package/.nycrc.yml ADDED
@@ -0,0 +1,4 @@
1
+ reporter:
2
+ - lcov
3
+ - text
4
+ skip-full: true
package/.prettierrc ADDED
@@ -0,0 +1 @@
1
+ "@wfcd/eslint-config/prettier"
package/handlers/RSS.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import RssFeedEmitter from 'rss-feed-emitter';
2
2
 
3
- import feeds from '../resources/rssFeeds.json' assert { type: 'json' };
3
+ import feeds from '../resources/rssFeeds.json' with { type: 'json' };
4
4
  import { logger } from '../utilities/index.js';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import Twitter from 'twitter';
2
2
 
3
- import toWatch from '../resources/tweeters.json' assert { type: 'json' };
3
+ import toWatch from '../resources/tweeters.json' with { type: 'json' };
4
4
  import { logger } from '../utilities/index.js';
5
5
  import { twiClientInfo, TWITTER_TIMEOUT } from '../utilities/env.js';
6
6
 
package/index.js CHANGED
@@ -70,6 +70,14 @@ export default class WorldstateEmitter extends EventEmitter {
70
70
  return this.#worldstate?.get(language);
71
71
  }
72
72
 
73
+ get debug() {
74
+ return {
75
+ rss: this.getRss(),
76
+ worldstate: this.#worldstate?.get(),
77
+ twitter: this.#twitter?.clientInfoValid ? this.#twitter.getData() : undefined,
78
+ };
79
+ }
80
+
73
81
  /**
74
82
  * Get Twitter data
75
83
  * @returns {Promise} promised twitter data
package/nodemon.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "delay": 5000,
3
+ "env": {
4
+ "LOG_LEVEL": "debug",
5
+ "CACHE_TIMEOUT": 60000,
6
+ "SEMLAR_TIMEOUT": 300000
7
+ }
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "worldstate-emitter",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "Event emitter for worldstate & other warframe events",
5
5
  "keywords": [
6
6
  "warframe",
@@ -19,6 +19,9 @@
19
19
  "license": "Apache-2.0",
20
20
  "author": "tobiah <tobiah@protonmail.com>",
21
21
  "type": "module",
22
+ "exports": {
23
+ ".": "./index.js"
24
+ },
22
25
  "main": "index.js",
23
26
  "directories": {
24
27
  "test": "test/specs"
@@ -29,92 +32,18 @@
29
32
  "dev": "nodemon test/tester.js",
30
33
  "lint": "eslint .",
31
34
  "lint:fix": "eslint . --fix",
32
- "prepare": "husky && install-peerdeps @wfcd/eslint-config@latest -S",
35
+ "prepare": "husky && npx install-peerdeps @wfcd/eslint-config@latest -S",
33
36
  "report": "c8 report --reporter=text-lcov",
34
37
  "test": "c8 mocha",
35
38
  "validate": "npm ls"
36
39
  },
37
40
  "pre-commit": [
38
41
  "lint",
39
- "test",
40
- "validate"
42
+ "validate",
43
+ "test"
41
44
  ],
42
- "commitlint": {
43
- "extends": [
44
- "@commitlint/config-conventional"
45
- ],
46
- "rules": {
47
- "body-max-line-length": [
48
- 0
49
- ]
50
- }
51
- },
52
- "lint-staged": {
53
- "*.js": [
54
- "eslint --cache --fix",
55
- "npm test"
56
- ],
57
- "package*.json": [
58
- "prettier --write",
59
- "npm dedupe",
60
- "npx sort-package-json"
61
- ],
62
- "*.{json,yml,yaml}": [
63
- "prettier --write"
64
- ]
65
- },
66
- "nodemonConfig": {
67
- "delay": 5000,
68
- "env": {
69
- "LOG_LEVEL": "debug",
70
- "CACHE_TIMEOUT": 60000,
71
- "SEMLAR_TIMEOUT": 300000
72
- }
73
- },
74
- "babel": {
75
- "plugins": [
76
- "@babel/plugin-transform-class-properties",
77
- "@babel/plugin-transform-private-methods"
78
- ],
79
- "presets": [
80
- "@babel/preset-env"
81
- ]
82
- },
83
- "prettier": "@wfcd/eslint-config/prettier",
84
- "eslintConfig": {
85
- "parser": "@babel/eslint-parser",
86
- "parserOptions": {
87
- "ecmaFeatures": {
88
- "modules": true
89
- },
90
- "ecmaVersion": 6,
91
- "sourceType": "module"
92
- },
93
- "extends": "@wfcd/eslint-config/esm",
94
- "rules": {
95
- "no-underscore-dangle": "off"
96
- }
97
- },
98
- "eslintIgnore": [
99
- ".github/**",
100
- "docs/**",
101
- "resources/**",
102
- "types/**"
103
- ],
104
- "mocha": {
105
- "exit": true,
106
- "spec": "test/specs/**/*.spec.js",
107
- "timeout": 20000
108
- },
109
- "c8": {
110
- "reporter": [
111
- "lcov",
112
- "text"
113
- ],
114
- "skip-full": true
115
- },
116
45
  "dependencies": {
117
- "cron": "^3.1.6",
46
+ "cron": "^4.0.0",
118
47
  "rss-feed-emitter": "^3.2.2",
119
48
  "twitter": "^1.7.1"
120
49
  },
@@ -123,12 +52,12 @@
123
52
  "@commitlint/config-conventional": "^19.1.0",
124
53
  "@wfcd/eslint-config": "latest",
125
54
  "c8": "^10.1.2",
126
- "chai": "^4.3.4",
55
+ "chai": "^5.1.2",
127
56
  "coveralls": "^3.1.0",
128
57
  "husky": "^9.0.11",
129
58
  "install-peerdeps": "^3.0.3",
130
59
  "lint-staged": "^15.2.2",
131
- "mocha": "^10.0.0",
60
+ "mocha": "^11.0.1",
132
61
  "nodemon": "^3.0.3",
133
62
  "prettier": "^3.2.5"
134
63
  },
@@ -35,11 +35,23 @@ export default class WSCache {
35
35
  * @returns {Promise<void>}
36
36
  */
37
37
  #update = async (newData) => {
38
- const t = await WorldState.build(newData, {
38
+ const deps = {
39
39
  locale: this.#language,
40
- kuvaData: JSON.parse(await this.#kuvaCache.get()),
41
- sentientData: JSON.parse(await this.#sentientCache.get()),
42
- });
40
+ kuvaData: {},
41
+ sentientData: {},
42
+ };
43
+ try {
44
+ deps.kuvaData = JSON.parse(await this.#kuvaCache.get());
45
+ } catch (err) {
46
+ logger.warn(`Error parsing kuva data for ${this.#language}: ${err}`);
47
+ }
48
+ try {
49
+ deps.sentientData = JSON.parse(await this.#sentientCache.get());
50
+ } catch (err) {
51
+ logger.warn(`Error parsing sentient data for ${this.#language}: ${err}`);
52
+ }
53
+
54
+ const t = await WorldState.build(newData, deps);
43
55
  if (!t.timestamp) return;
44
56
 
45
57
  this.#inner = t;