@mablhq/mabl-cli 2.31.41 → 2.31.44

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mablhq/mabl-cli",
3
- "version": "2.31.41",
3
+ "version": "2.31.44",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "The official mabl command line interface tool",
6
6
  "main": "index.js",
package/util/analytics.js CHANGED
@@ -26,15 +26,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.trackMablTestsRunnerEvent = exports.trackCliEvent = void 0;
27
27
  const env_1 = require("../env/env");
28
28
  const cliConfigProvider_1 = require("../providers/cliConfigProvider");
29
+ const axiosProxyConfig_1 = require("../http/axiosProxyConfig");
29
30
  const pureUtil_1 = require("./pureUtil");
30
31
  const os = __importStar(require("os"));
31
32
  const types_1 = require("../api/types");
32
33
  const loggingProvider_1 = require("../providers/logging/loggingProvider");
33
34
  const Analytics = require('analytics-node');
34
- const analytics = new Analytics('ghbAXZbk8fqWROgMscPdkQMoqEjwsKRa', {
35
- flushAt: 1,
36
- flushInterval: 1,
37
- });
38
35
  async function getTrackingInfo() {
39
36
  var _a, _b, _c;
40
37
  const config = await cliConfigProvider_1.CliConfigProvider.getCliConfig();
@@ -65,7 +62,7 @@ async function trackCliEvent(commands, argumentCountMap) {
65
62
  environment: env_1.ENV,
66
63
  argumentCountMap,
67
64
  };
68
- trackEvent(event, trackingInfo.userId, properties);
65
+ await trackEvent(event, trackingInfo.userId, properties);
69
66
  }
70
67
  catch (error) {
71
68
  if (env_1.ENV === 'local' || env_1.ENV === 'dev') {
@@ -85,7 +82,7 @@ async function trackMablTestsRunnerEvent(eventName, resultsMap) {
85
82
  environment: env_1.ENV,
86
83
  resultsMap,
87
84
  };
88
- trackEvent(eventName, trackingInfo.userId, properties);
85
+ await trackEvent(eventName, trackingInfo.userId, properties);
89
86
  }
90
87
  catch (error) {
91
88
  if (env_1.ENV === 'local' || env_1.ENV === 'dev') {
@@ -94,10 +91,10 @@ async function trackMablTestsRunnerEvent(eventName, resultsMap) {
94
91
  }
95
92
  }
96
93
  exports.trackMablTestsRunnerEvent = trackMablTestsRunnerEvent;
97
- function trackEvent(event, userId, properties) {
94
+ async function trackEvent(event, userId, properties) {
98
95
  var _a, _b, _c;
99
96
  const cpuInfo = (_a = os.cpus()) !== null && _a !== void 0 ? _a : [];
100
- analytics.track({
97
+ (await getAnalytics()).track({
101
98
  userId,
102
99
  event,
103
100
  context: {
@@ -124,6 +121,18 @@ function trackEvent(event, userId, properties) {
124
121
  properties,
125
122
  });
126
123
  }
124
+ async function getAnalytics() {
125
+ return new Analytics('ghbAXZbk8fqWROgMscPdkQMoqEjwsKRa', {
126
+ axiosConfig: await (0, axiosProxyConfig_1.currentProxyConfig)(),
127
+ errorHandler: (error) => {
128
+ if (env_1.ENV === 'local' || env_1.ENV === 'dev') {
129
+ loggingProvider_1.logger.error('Error with Segment event', error);
130
+ }
131
+ },
132
+ flushAt: 1,
133
+ flushInterval: 1,
134
+ });
135
+ }
127
136
  function getUserAgent() {
128
137
  var _a, _b;
129
138
  const nodeName = (_b = (_a = process === null || process === void 0 ? void 0 : process.release) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : 'node';