@discordanalytics/core 2.6.0 → 2.6.2

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.
Files changed (2) hide show
  1. package/dist/index.js +2 -2
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -231,11 +231,11 @@ class CustomEvent {
231
231
  this.ensure();
232
232
  }
233
233
  async ensure() {
234
- if (typeof this._analytics.stats_data.custom_events[this._event_key] !== 'number') {
234
+ if (typeof this._analytics.stats_data.custom_events[this._event_key] !== 'number' && process.env.NODE_ENV === 'production') {
235
235
  this._analytics.debug(`[DISCORDANALYTICS] Fetching value for event ${this._event_key}`);
236
236
  const url = types_1.ApiEndpoints.EVENT_URL.replace(':id', this._analytics.client_id).replace(':event', this._event_key);
237
237
  const res = await this._analytics.api_call_with_retries('GET', url);
238
- if (res instanceof node_fetch_1.default.Response && this._last_action !== 'set') {
238
+ if (res instanceof Response && this._last_action !== 'set') {
239
239
  const data = await res.json();
240
240
  this._analytics.stats_data.custom_events[this._event_key] = (this._analytics.stats_data.custom_events[this._event_key] || 0) + (data.today_value || 0);
241
241
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@discordanalytics/core",
3
- "version": "2.6.0",
3
+ "version": "2.6.2",
4
4
  "description": "Core package to work with Discord Analytics",
5
5
  "main": "dist/index.js",
6
6
  "author": "Discord Analytics",
@@ -14,11 +14,11 @@
14
14
  "url": "https://github.com/DiscordAnalytics/node-package/issues"
15
15
  },
16
16
  "dependencies": {
17
+ "@types/node-fetch": "^2.6.13",
17
18
  "node-fetch": "^2.7.0"
18
19
  },
19
20
  "devDependencies": {
20
21
  "@types/node": "*",
21
- "@types/node-fetch": "2.6.12",
22
22
  "typescript": "*"
23
23
  },
24
24
  "scripts": {