@discordanalytics/core 2.6.0 → 2.6.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/dist/index.js +24 -5
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -10,16 +10,35 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
11
|
o[k2] = m[k];
|
|
12
12
|
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
13
35
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
37
|
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
39
|
exports.CustomEvent = exports.AnalyticsBase = void 0;
|
|
21
40
|
const types_1 = require("./types");
|
|
22
|
-
const node_fetch_1 =
|
|
41
|
+
const node_fetch_1 = __importStar(require("node-fetch"));
|
|
23
42
|
/**
|
|
24
43
|
* DiscordAnalytics Base Class
|
|
25
44
|
* @class AnalyticsBase
|
|
@@ -235,7 +254,7 @@ class CustomEvent {
|
|
|
235
254
|
this._analytics.debug(`[DISCORDANALYTICS] Fetching value for event ${this._event_key}`);
|
|
236
255
|
const url = types_1.ApiEndpoints.EVENT_URL.replace(':id', this._analytics.client_id).replace(':event', this._event_key);
|
|
237
256
|
const res = await this._analytics.api_call_with_retries('GET', url);
|
|
238
|
-
if (res instanceof node_fetch_1.
|
|
257
|
+
if (res instanceof node_fetch_1.Response && this._last_action !== 'set') {
|
|
239
258
|
const data = await res.json();
|
|
240
259
|
this._analytics.stats_data.custom_events[this._event_key] = (this._analytics.stats_data.custom_events[this._event_key] || 0) + (data.today_value || 0);
|
|
241
260
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@discordanalytics/core",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "Core package to work with Discord Analytics",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Discord Analytics",
|
|
@@ -14,11 +14,10 @@
|
|
|
14
14
|
"url": "https://github.com/DiscordAnalytics/node-package/issues"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"node-fetch": "^
|
|
17
|
+
"node-fetch": "^3.0.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@types/node": "*",
|
|
21
|
-
"@types/node-fetch": "2.6.12",
|
|
22
21
|
"typescript": "*"
|
|
23
22
|
},
|
|
24
23
|
"scripts": {
|