eas-cli 21.7.0 → 21.7.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.
@@ -13,6 +13,7 @@ const User_1 = require("../user/User");
13
13
  const UserSettings_1 = tslib_1.__importDefault(require("../user/UserSettings"));
14
14
  const easCli_1 = require("../utils/easCli");
15
15
  const agent_1 = require("./agent");
16
+ const sandbox_1 = require("./sandbox");
16
17
  const PLATFORM_TO_ANALYTICS_PLATFORM = {
17
18
  darwin: 'Mac',
18
19
  win32: 'Windows',
@@ -182,10 +183,12 @@ class RudderstackAnalytics {
182
183
  getRudderStackContext() {
183
184
  const platform = PLATFORM_TO_ANALYTICS_PLATFORM[os_1.default.platform()] || os_1.default.platform();
184
185
  const agent = (0, agent_1.getAgentTelemetryContext)();
186
+ const sandboxProvider = (0, sandbox_1.getSandboxTelemetryContext)();
185
187
  return {
186
188
  os: { name: platform, version: os_1.default.release() },
187
189
  device: { type: platform, model: platform },
188
190
  app: { name: 'eas cli', version: easCli_1.easCliVersion ?? undefined },
191
+ ...(sandboxProvider ? { sandbox_provider: sandboxProvider } : {}),
189
192
  ...(agent ? { agent } : {}),
190
193
  };
191
194
  }
@@ -0,0 +1,3 @@
1
+ type SandboxTelemetryContext = string | null;
2
+ export declare function getSandboxTelemetryContext(): SandboxTelemetryContext;
3
+ export {};
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSandboxTelemetryContext = getSandboxTelemetryContext;
4
+ const tslib_1 = require("tslib");
5
+ const sandbox_cli_detector_1 = require("sandbox-cli-detector");
6
+ const log_1 = tslib_1.__importDefault(require("../log"));
7
+ let sandboxTelemetryContext;
8
+ function getSandboxTelemetryContext() {
9
+ if (sandboxTelemetryContext === undefined) {
10
+ sandboxTelemetryContext = resolveSandboxTelemetryContext();
11
+ }
12
+ return sandboxTelemetryContext;
13
+ }
14
+ function resolveSandboxTelemetryContext() {
15
+ try {
16
+ const { detected, sandbox } = (0, sandbox_cli_detector_1.detectSandbox)();
17
+ if (!detected || sandbox == null) {
18
+ return null;
19
+ }
20
+ return sandbox.id;
21
+ }
22
+ catch (error) {
23
+ log_1.default.debug('Failed to detect sandbox:', error?.message ?? error);
24
+ return null;
25
+ }
26
+ }