eas-cli 22.0.0 → 22.3.0

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.
@@ -1304,6 +1304,12 @@ export type App = Project & {
1304
1304
  internalDistributionBuildPrivacy: AppInternalDistributionBuildPrivacy;
1305
1305
  /** iOS app credentials for the project */
1306
1306
  iosAppCredentials: Array<IosAppCredentials>;
1307
+ /**
1308
+ * Tells you if the project can show the Observe promotional notification. This field is part of
1309
+ * the observe-notification experiment.
1310
+ * @deprecated This field is deprecated from its first release. It supplies data for the observe-notification promotion on the project page. It will be removed when the promotion ends. Do not rely on it.
1311
+ */
1312
+ isEligibleForObserveNotice: Scalars['Boolean']['output'];
1307
1313
  lastDeletionAttemptTime?: Maybe<Scalars['DateTime']['output']>;
1308
1314
  /** Time of the last user activity (update, branch, submission). */
1309
1315
  latestActivity: Scalars['DateTime']['output'];
@@ -1877,6 +1883,8 @@ export type AppObserve = {
1877
1883
  navigationRoutes: AppObserveNavigationRoutesConnection;
1878
1884
  /** Active users and sessions for the Overview engagement band, across all versions. */
1879
1885
  overviewEngagement: AppObserveOverviewEngagement;
1886
+ /** Crash-free rates with previous-period comparison for the Overview stability tiles. */
1887
+ overviewStability: AppObserveOverviewStability;
1880
1888
  /** Per-update comparison within one app version: the embedded bundle plus each OTA update. */
1881
1889
  overviewUpdateComparison: AppObserveOverviewUpdateComparison;
1882
1890
  /** Per-version, per-platform metric summaries for the Overview version-comparison matrix. */
@@ -1956,6 +1964,9 @@ export type AppObserveNavigationRoutesArgs = {
1956
1964
  export type AppObserveOverviewEngagementArgs = {
1957
1965
  input: AppObserveOverviewEngagementInput;
1958
1966
  };
1967
+ export type AppObserveOverviewStabilityArgs = {
1968
+ input: AppObserveOverviewStabilityInput;
1969
+ };
1959
1970
  export type AppObserveOverviewUpdateComparisonArgs = {
1960
1971
  input: AppObserveOverviewUpdateComparisonInput;
1961
1972
  };
@@ -2090,6 +2101,8 @@ export type AppObserveCustomEvent = {
2090
2101
  sessionId?: Maybe<Scalars['String']['output']>;
2091
2102
  severityNumber?: Maybe<Scalars['Int']['output']>;
2092
2103
  severityText?: Maybe<Scalars['String']['output']>;
2104
+ /** Build whose uploaded source map symbolicated exceptionStacktrace; null when the stack trace is shown as reported. */
2105
+ symbolicationBuild?: Maybe<Build>;
2093
2106
  timestamp: Scalars['DateTime']['output'];
2094
2107
  };
2095
2108
  export type AppObserveCustomEventCountBucket = {
@@ -2273,6 +2286,23 @@ export declare enum AppObserveErrorGroupsOrderBy {
2273
2286
  MostFrequent = "MOST_FREQUENT",
2274
2287
  MostUsers = "MOST_USERS"
2275
2288
  }
2289
+ /** AppObserveErrorStats for one platform; iOS includes iPadOS and tvOS. */
2290
+ export type AppObserveErrorPlatformStats = {
2291
+ __typename?: 'AppObserveErrorPlatformStats';
2292
+ /** Distinct sessions on this platform that hit any exception. */
2293
+ affectedSessions: Scalars['Int']['output'];
2294
+ /** Distinct users on this platform that hit any exception. */
2295
+ affectedUsers: Scalars['Int']['output'];
2296
+ /** Fraction (0..1) of this platform's active sessions without a fatal error. */
2297
+ crashFreeSessions: Scalars['Float']['output'];
2298
+ /** Fraction (0..1) of this platform's active users without a fatal error. */
2299
+ crashFreeUsers: Scalars['Float']['output'];
2300
+ fatalCount: Scalars['Int']['output'];
2301
+ nonFatalCount: Scalars['Int']['output'];
2302
+ platform: AppObservePlatform;
2303
+ /** Total exception events in range on this platform. */
2304
+ totalErrors: Scalars['Int']['output'];
2305
+ };
2276
2306
  export declare enum AppObserveErrorSeverity {
2277
2307
  Error = "ERROR",
2278
2308
  Fatal = "FATAL"
@@ -2473,7 +2503,7 @@ export type AppObserveNavigationStat = {
2473
2503
  };
2474
2504
  export type AppObserveOverviewAllReleases = {
2475
2505
  __typename?: 'AppObserveOverviewAllReleases';
2476
- /** One entry per (metric, platform) with data in range; iOS includes tvOS and iPadOS. */
2506
+ /** One entry per (metric, platform) with data in range; one entry per exact device platform. */
2477
2507
  metrics: Array<AppObserveOverviewVersionMetric>;
2478
2508
  uniqueUserCount: Scalars['Int']['output'];
2479
2509
  };
@@ -2505,13 +2535,40 @@ export type AppObserveOverviewEngagementStat = {
2505
2535
  };
2506
2536
  export type AppObserveOverviewStability = {
2507
2537
  __typename?: 'AppObserveOverviewStability';
2508
- affectedUsers: Scalars['Int']['output'];
2538
+ /** Fatal exception events in range. */
2539
+ crashCount: Scalars['Int']['output'];
2509
2540
  /** Fraction (0..1) of active sessions without a fatal error. */
2510
2541
  crashFreeSessions: Scalars['Float']['output'];
2511
2542
  /** Fraction (0..1) of active users without a fatal error. */
2512
2543
  crashFreeUsers: Scalars['Float']['output'];
2544
+ /** Distinct users that hit a fatal error in range. */
2545
+ crashedUsers: Scalars['Int']['output'];
2546
+ /** Fatal exception events in the equal-length window before startTime. */
2547
+ previousPeriodCrashCount: Scalars['Int']['output'];
2548
+ /** Same fractions for the equal-length window before startTime; null when it had no activity. */
2549
+ previousPeriodCrashFreeSessions?: Maybe<Scalars['Float']['output']>;
2550
+ previousPeriodCrashFreeUsers?: Maybe<Scalars['Float']['output']>;
2551
+ previousPeriodCrashedUsers: Scalars['Int']['output'];
2552
+ series: Array<AppObserveOverviewStabilityBucket>;
2553
+ /** All exception events in range, for distinguishing quiet apps from crash-free ones. */
2513
2554
  totalErrors: Scalars['Int']['output'];
2514
2555
  };
2556
+ export type AppObserveOverviewStabilityBucket = {
2557
+ __typename?: 'AppObserveOverviewStabilityBucket';
2558
+ /** Approximate unique users that hit any exception in this bucket. Not summable across buckets. */
2559
+ affectedUsers: Scalars['Int']['output'];
2560
+ bucketStart: Scalars['DateTime']['output'];
2561
+ crashCount: Scalars['Int']['output'];
2562
+ };
2563
+ /** Stability-tile filters. No release filters: the tiles always span all versions. */
2564
+ export type AppObserveOverviewStabilityInput = {
2565
+ /** Series bucket size. Defaults to one day. */
2566
+ bucketIntervalMinutes?: InputMaybe<Scalars['Int']['input']>;
2567
+ endTime: Scalars['DateTime']['input'];
2568
+ environment?: InputMaybe<Scalars['String']['input']>;
2569
+ platform?: InputMaybe<AppObservePlatform>;
2570
+ startTime: Scalars['DateTime']['input'];
2571
+ };
2515
2572
  export type AppObserveOverviewUpdate = {
2516
2573
  __typename?: 'AppObserveOverviewUpdate';
2517
2574
  /** Null for the embedded bundle. */
@@ -2529,7 +2586,8 @@ export type AppObserveOverviewUpdate = {
2529
2586
  metrics: Array<AppObserveOverviewUpdateMetric>;
2530
2587
  /** When the update was published; null for the embedded bundle. */
2531
2588
  publishedAt?: Maybe<Scalars['DateTime']['output']>;
2532
- stability: AppObserveOverviewStability;
2589
+ /** Error stats for this update, one entry per platform with activity; iOS includes iPadOS and tvOS. */
2590
+ stability: Array<AppObserveErrorPlatformStats>;
2533
2591
  uniqueUserCount: Scalars['Int']['output'];
2534
2592
  };
2535
2593
  export type AppObserveOverviewUpdateComparison = {
@@ -2562,10 +2620,10 @@ export type AppObserveOverviewVersion = {
2562
2620
  __typename?: 'AppObserveOverviewVersion';
2563
2621
  appVersion: Scalars['String']['output'];
2564
2622
  firstSeenAt: Scalars['DateTime']['output'];
2565
- /** One entry per (metric, platform) with data in range; iOS includes tvOS and iPadOS. */
2623
+ /** One entry per (metric, platform) with data in range; each device OS (iOS, iPadOS, tvOS, macOS, Android) is a separate platform. */
2566
2624
  metrics: Array<AppObserveOverviewVersionMetric>;
2567
- /** Error stats for this version, all platforms combined. */
2568
- stability: AppObserveOverviewStability;
2625
+ /** Error stats for this version, one entry per platform with activity; iOS includes iPadOS and tvOS. */
2626
+ stability: Array<AppObserveErrorPlatformStats>;
2569
2627
  uniqueUserCount: Scalars['Int']['output'];
2570
2628
  };
2571
2629
  export type AppObserveOverviewVersionComparison = {
@@ -2601,7 +2659,10 @@ export type AppObserveOverviewVersionSummary = {
2601
2659
  };
2602
2660
  export declare enum AppObservePlatform {
2603
2661
  Android = "ANDROID",
2604
- Ios = "IOS"
2662
+ Ios = "IOS",
2663
+ Ipados = "IPADOS",
2664
+ Macos = "MACOS",
2665
+ Tvos = "TVOS"
2605
2666
  }
2606
2667
  export declare enum AppObservePropertyType {
2607
2668
  Boolean = "BOOLEAN",
@@ -2960,6 +3021,8 @@ export type AppUsageMetricTotal = {
2960
3021
  planMetrics: Array<EstimatedUsage>;
2961
3022
  /** Total cost of overages, in cents */
2962
3023
  totalCost: Scalars['Float']['output'];
3024
+ /** Services whose estimates could not be computed and are omitted from the other fields. */
3025
+ unavailableServiceUsageMetrics: Array<UnavailableServiceUsageMetric>;
2963
3026
  };
2964
3027
  export type AppUsageMetrics = {
2965
3028
  __typename?: 'AppUsageMetrics';
@@ -3093,6 +3156,18 @@ export type AppWorkflowsInsightsWorkflowsArgs = {
3093
3156
  first: Scalars['Int']['input'];
3094
3157
  timespan: WorkflowsInsightsTimespanInput;
3095
3158
  };
3159
+ export type AppiumRunSessionRemoteConfig = {
3160
+ __typename?: 'AppiumRunSessionRemoteConfig';
3161
+ /** Appium server URL for the remote device. */
3162
+ appiumUrl: Scalars['String']['output'];
3163
+ /** W3C capabilities for the device that backs this session. */
3164
+ capabilities: Scalars['JSONObject']['output'];
3165
+ /**
3166
+ * URL of the web preview surface for the session. Null when web previews are
3167
+ * not available for the platform (e.g. Android).
3168
+ */
3169
+ webPreviewUrl?: Maybe<Scalars['String']['output']>;
3170
+ };
3096
3171
  export type AppleAppIdentifier = {
3097
3172
  __typename?: 'AppleAppIdentifier';
3098
3173
  account: Account;
@@ -4395,18 +4470,36 @@ export type CreateDeviceRunSessionEventLogUploadSessionResult = {
4395
4470
  };
4396
4471
  export type CreateDeviceRunSessionInput = {
4397
4472
  appId: Scalars['ID']['input'];
4473
+ /**
4474
+ * Application archive URL to download, install, and launch before the simulator session
4475
+ * becomes available. Mutually exclusive with buildId.
4476
+ */
4477
+ applicationArchiveUrl?: InputMaybe<Scalars['String']['input']>;
4478
+ /**
4479
+ * EAS Build to install and launch before the simulator session becomes available.
4480
+ * Mutually exclusive with applicationArchiveUrl.
4481
+ */
4482
+ buildId?: InputMaybe<Scalars['ID']['input']>;
4483
+ /**
4484
+ * Identifier of the virtual device to start for the session. On iOS this is a
4485
+ * Simulator device name or UDID (e.g. "iPhone 16 Pro"). On Android this is an
4486
+ * AVD hardware profile id (e.g. "pixel_7"). If omitted, the runner picks a
4487
+ * default device.
4488
+ */
4489
+ deviceIdentifier?: InputMaybe<Scalars['String']['input']>;
4398
4490
  /**
4399
4491
  * Stop the session automatically after this many minutes without observed
4400
4492
  * session activity. Must be positive and smaller than the session's maximum
4401
4493
  * duration (2 hours, or maxRunTimeMinutes when set). Only supported for
4402
- * agent-device and argent sessions. If omitted, the session has no idle
4494
+ * agent-device, argent, and Appium sessions. If omitted, the session has no idle
4403
4495
  * timeout.
4404
4496
  */
4405
4497
  maxIdleTimeMinutes?: InputMaybe<Scalars['Int']['input']>;
4406
4498
  /**
4407
- * Override for the underlying turtle job run's max run time, in minutes. Must
4408
- * be non-negative and smaller than 120 (2 hours). Only customizable on paid
4409
- * plans. If omitted, the default is derived based on the job run's priority.
4499
+ * Maximum usable session duration, in minutes, starting when the remote session
4500
+ * is ready. Must be non-negative and no greater than 40 for normal-priority
4501
+ * accounts or 115 for high-priority accounts. The backing job receives an
4502
+ * additional five minutes for cleanup.
4410
4503
  */
4411
4504
  maxRunTimeMinutes?: InputMaybe<Scalars['Int']['input']>;
4412
4505
  /**
@@ -5146,7 +5239,7 @@ export type DeviceRunSessionQuery = {
5146
5239
  export type DeviceRunSessionQueryByIdArgs = {
5147
5240
  deviceRunSessionId: Scalars['ID']['input'];
5148
5241
  };
5149
- export type DeviceRunSessionRemoteConfig = AgentDeviceRunSessionRemoteConfig | ArgentRunSessionRemoteConfig | ServeSimRunSessionRemoteConfig;
5242
+ export type DeviceRunSessionRemoteConfig = AgentDeviceRunSessionRemoteConfig | AppiumRunSessionRemoteConfig | ArgentRunSessionRemoteConfig | ServeSimRunSessionRemoteConfig;
5150
5243
  export declare enum DeviceRunSessionStatus {
5151
5244
  Errored = "ERRORED",
5152
5245
  InProgress = "IN_PROGRESS",
@@ -5155,6 +5248,7 @@ export declare enum DeviceRunSessionStatus {
5155
5248
  }
5156
5249
  export declare enum DeviceRunSessionType {
5157
5250
  AgentDevice = "AGENT_DEVICE",
5251
+ Appium = "APPIUM",
5158
5252
  Argent = "ARGENT",
5159
5253
  ServeSim = "SERVE_SIM"
5160
5254
  }
@@ -8912,6 +9006,12 @@ export type TurtleSshSessionSettingsInput = {
8912
9006
  export declare enum TurtleSshTransportType {
8913
9007
  UptermV1 = "UPTERM_V1"
8914
9008
  }
9009
+ export type UnavailableServiceUsageMetric = {
9010
+ __typename?: 'UnavailableServiceUsageMetric';
9011
+ /** User-displayable explanation of why the service's estimate is missing. */
9012
+ message: Scalars['String']['output'];
9013
+ service: EasService;
9014
+ };
8915
9015
  export type UniqueUsersOverTimeData = {
8916
9016
  __typename?: 'UniqueUsersOverTimeData';
8917
9017
  data: LineChartData;
@@ -9470,6 +9570,8 @@ export type UsageMetricTotal = {
9470
9570
  planMetrics: Array<EstimatedUsage>;
9471
9571
  /** Total cost of overages, in cents */
9472
9572
  totalCost: Scalars['Float']['output'];
9573
+ /** Services whose estimates could not be computed and are omitted from the other fields. */
9574
+ unavailableServiceUsageMetrics: Array<UnavailableServiceUsageMetric>;
9473
9575
  };
9474
9576
  export declare enum UsageMetricType {
9475
9577
  Bandwidth = "BANDWIDTH",
@@ -18434,6 +18536,11 @@ export type DeviceRunSessionByIdQuery = {
18434
18536
  agentDeviceRemoteSessionUrl: string;
18435
18537
  agentDeviceRemoteSessionToken: string;
18436
18538
  webPreviewUrl?: string | null;
18539
+ } | {
18540
+ __typename: 'AppiumRunSessionRemoteConfig';
18541
+ appiumUrl: string;
18542
+ capabilities: any;
18543
+ webPreviewUrl?: string | null;
18437
18544
  } | {
18438
18545
  __typename: 'ArgentRunSessionRemoteConfig';
18439
18546
  toolsUrl: string;
@@ -125,6 +125,9 @@ var AppObservePlatform;
125
125
  (function (AppObservePlatform) {
126
126
  AppObservePlatform["Android"] = "ANDROID";
127
127
  AppObservePlatform["Ios"] = "IOS";
128
+ AppObservePlatform["Ipados"] = "IPADOS";
129
+ AppObservePlatform["Macos"] = "MACOS";
130
+ AppObservePlatform["Tvos"] = "TVOS";
128
131
  })(AppObservePlatform || (exports.AppObservePlatform = AppObservePlatform = {}));
129
132
  var AppObservePropertyType;
130
133
  (function (AppObservePropertyType) {
@@ -463,6 +466,7 @@ var DeviceRunSessionStatus;
463
466
  var DeviceRunSessionType;
464
467
  (function (DeviceRunSessionType) {
465
468
  DeviceRunSessionType["AgentDevice"] = "AGENT_DEVICE";
469
+ DeviceRunSessionType["Appium"] = "APPIUM";
466
470
  DeviceRunSessionType["Argent"] = "ARGENT";
467
471
  DeviceRunSessionType["ServeSim"] = "SERVE_SIM";
468
472
  })(DeviceRunSessionType || (exports.DeviceRunSessionType = DeviceRunSessionType = {}));
@@ -70,6 +70,11 @@ exports.DeviceRunSessionQuery = {
70
70
  toolsAuthToken
71
71
  webPreviewUrl
72
72
  }
73
+ ... on AppiumRunSessionRemoteConfig {
74
+ appiumUrl
75
+ capabilities
76
+ webPreviewUrl
77
+ }
73
78
  ... on ServeSimRunSessionRemoteConfig {
74
79
  previewUrl
75
80
  }
@@ -0,0 +1 @@
1
+ export declare function detectProjectSdkVersionAsync(projectDir: string): Promise<string | undefined>;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.detectProjectSdkVersionAsync = detectProjectSdkVersionAsync;
4
+ const config_1 = require("@expo/config");
5
+ const expoConfig_1 = require("./expoConfig");
6
+ async function detectProjectSdkVersionAsync(projectDir) {
7
+ const paths = (0, config_1.getConfigFilePaths)(projectDir);
8
+ if (!paths.staticConfigPath && !paths.dynamicConfigPath) {
9
+ return;
10
+ }
11
+ try {
12
+ return (await (0, expoConfig_1.getPrivateExpoConfigAsync)(projectDir)).sdkVersion;
13
+ }
14
+ catch {
15
+ return;
16
+ }
17
+ }
@@ -4,4 +4,4 @@ export declare const SIMULATOR_DOTENV_FILE_HEADER = "# Do not commit this file.\
4
4
  export declare function getSimulatorEnvFilePath(projectDir: string): string;
5
5
  export declare function loadSimulatorEnvAsync(projectDir: string): Promise<void>;
6
6
  export declare function writeSimulatorEnvAsync(projectDir: string, environmentVariables: Record<string, string>): Promise<void>;
7
- export declare function resetSimulatorEnvAsync(projectDir: string): Promise<void>;
7
+ export declare function resetSimulatorEnvAsync(projectDir: string, expectedDeviceRunSessionId: string): Promise<void>;
@@ -7,8 +7,10 @@ exports.writeSimulatorEnvAsync = writeSimulatorEnvAsync;
7
7
  exports.resetSimulatorEnvAsync = resetSimulatorEnvAsync;
8
8
  const tslib_1 = require("tslib");
9
9
  const env_1 = require("@expo/env");
10
+ const dotenv_1 = require("dotenv");
10
11
  const fs = tslib_1.__importStar(require("fs-extra"));
11
12
  const path_1 = tslib_1.__importDefault(require("path"));
13
+ const log_1 = tslib_1.__importDefault(require("../log"));
12
14
  exports.SIMULATOR_DOTENV_FILE_NAME = '.env.eas-simulator';
13
15
  exports.EAS_SIMULATOR_SESSION_ID = 'EAS_SIMULATOR_SESSION_ID';
14
16
  exports.SIMULATOR_DOTENV_FILE_HEADER = '# Do not commit this file.\n# Do not modify these values manually. They are managed by eas-cli.\n# It holds configuration only for the current simulator session.\n\n';
@@ -24,14 +26,22 @@ async function writeSimulatorEnvAsync(projectDir, environmentVariables) {
24
26
  const simulatorDotenvFilePath = getSimulatorEnvFilePath(projectDir);
25
27
  const simulatorDotenvContent = exports.SIMULATOR_DOTENV_FILE_HEADER +
26
28
  Object.entries(environmentVariables)
27
- .map(([key, value]) => `${key}=${JSON.stringify(value)}`)
29
+ .map(([key, value]) => `${key}='${value}'`)
28
30
  .join('\n') +
29
31
  '\n';
30
32
  await fs.writeFile(simulatorDotenvFilePath, simulatorDotenvContent);
31
33
  }
32
- async function resetSimulatorEnvAsync(projectDir) {
34
+ async function resetSimulatorEnvAsync(projectDir, expectedDeviceRunSessionId) {
33
35
  const simulatorDotenvFilePath = getSimulatorEnvFilePath(projectDir);
34
36
  try {
37
+ const currentEnv = (0, dotenv_1.parse)(await fs.readFile(simulatorDotenvFilePath, 'utf8'));
38
+ if (currentEnv[exports.EAS_SIMULATOR_SESSION_ID] !== expectedDeviceRunSessionId) {
39
+ // The file was overwritten by a newer simulator session, so it is no longer
40
+ // ours to reset. This is expected when sessions overlap; log at debug level
41
+ // for troubleshooting without surfacing noise during normal use.
42
+ log_1.default.debug(`Skipping ${exports.SIMULATOR_DOTENV_FILE_NAME} reset: it belongs to simulator session ${currentEnv[exports.EAS_SIMULATOR_SESSION_ID] ?? '(unknown)'}, not ${expectedDeviceRunSessionId}.`);
43
+ return;
44
+ }
35
45
  await fs.writeFile(simulatorDotenvFilePath, exports.SIMULATOR_DOTENV_FILE_HEADER, { flag: 'r+' });
36
46
  await fs.truncate(simulatorDotenvFilePath, Buffer.byteLength(exports.SIMULATOR_DOTENV_FILE_HEADER));
37
47
  }
@@ -0,0 +1,5 @@
1
+ export type ExpoGoPlatform = 'android' | 'ios';
2
+ export declare function resolveExpoGoApplicationArchiveUrlAsync({ platform, projectDir, }: {
3
+ platform: ExpoGoPlatform;
4
+ projectDir: string;
5
+ }): Promise<string>;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveExpoGoApplicationArchiveUrlAsync = resolveExpoGoApplicationArchiveUrlAsync;
4
+ const tslib_1 = require("tslib");
5
+ const util_1 = require("util");
6
+ const spawn_async_1 = tslib_1.__importDefault(require("@expo/spawn-async"));
7
+ const semver_1 = tslib_1.__importDefault(require("semver"));
8
+ const errors_1 = require("../commandUtils/errors");
9
+ const detectProjectSdkVersionAsync_1 = require("../project/detectProjectSdkVersionAsync");
10
+ const EXPO_GO_DOWNLOAD_MESSAGE = 'Download Expo Go from';
11
+ function extractApplicationArchiveUrl(stdout) {
12
+ const output = (0, util_1.stripVTControlCharacters)(stdout);
13
+ const outputLines = output.trim().split(/\r?\n/);
14
+ const downloadMessageLine = outputLines.find(line => line.includes(EXPO_GO_DOWNLOAD_MESSAGE));
15
+ const bareUrlOutput = outputLines.length === 1 ? outputLines[0] : undefined;
16
+ const lineWithUrl = downloadMessageLine ?? bareUrlOutput;
17
+ return lineWithUrl?.match(/https?:\/\/[^\s\])]+/)?.[0];
18
+ }
19
+ async function resolveExpoGoApplicationArchiveUrlAsync({ platform, projectDir, }) {
20
+ const sdkVersion = await (0, detectProjectSdkVersionAsync_1.detectProjectSdkVersionAsync)(projectDir);
21
+ const sdkMajorVersion = semver_1.default.coerce(sdkVersion)?.major;
22
+ if (!sdkMajorVersion) {
23
+ throw new errors_1.EasCommandError("Unable to determine this project's Expo SDK version, so Expo Go could not be selected. " +
24
+ 'Make sure the project has Expo installed and a valid app config, or use --build-id or --application-archive-url instead.');
25
+ }
26
+ const args = ['--yes', 'expo-go', 'url', platform, String(sdkMajorVersion)];
27
+ let stdout;
28
+ try {
29
+ ({ stdout } = await (0, spawn_async_1.default)('npx', args, {
30
+ cwd: projectDir,
31
+ stdio: 'pipe',
32
+ }));
33
+ }
34
+ catch (error) {
35
+ const reason = error instanceof Error ? ` ${error.message}` : '';
36
+ throw new errors_1.EasCommandError(`Failed to resolve the Expo Go download URL for SDK ${sdkMajorVersion} on ${platform}.${reason} ` +
37
+ `Run "npx expo-go url ${platform} ${sdkMajorVersion}" to diagnose the problem, or use --build-id or --application-archive-url instead.`);
38
+ }
39
+ const applicationArchiveUrl = extractApplicationArchiveUrl(stdout);
40
+ try {
41
+ if (!applicationArchiveUrl) {
42
+ throw new Error('Missing URL');
43
+ }
44
+ const parsedUrl = new URL(applicationArchiveUrl);
45
+ if (parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:') {
46
+ throw new Error('Unsupported protocol');
47
+ }
48
+ }
49
+ catch {
50
+ throw new errors_1.EasCommandError(`expo-go returned an invalid download URL for SDK ${sdkMajorVersion} on ${platform}. ` +
51
+ `Run "npx expo-go url ${platform} ${sdkMajorVersion}" to diagnose the problem, or use --build-id or --application-archive-url instead.`);
52
+ }
53
+ return applicationArchiveUrl;
54
+ }
@@ -23,6 +23,7 @@ function formatSimulatorUnavailableMessage(accountName) {
23
23
  // so adding a new enum value in codegen fails the build until it is wired up here.
24
24
  exports.DEVICE_RUN_SESSION_TYPE_FLAG_VALUES = {
25
25
  [generated_1.DeviceRunSessionType.AgentDevice]: 'agent-device',
26
+ [generated_1.DeviceRunSessionType.Appium]: 'appium',
26
27
  [generated_1.DeviceRunSessionType.Argent]: 'argent',
27
28
  [generated_1.DeviceRunSessionType.ServeSim]: 'serve-sim',
28
29
  };
@@ -42,6 +43,11 @@ function getRemoteSessionEnvironmentVariables(remoteConfig) {
42
43
  ARGENT_TOOLS_URL: remoteConfig.toolsUrl,
43
44
  ...(remoteConfig.toolsAuthToken ? { ARGENT_AUTH_TOKEN: remoteConfig.toolsAuthToken } : {}),
44
45
  };
46
+ case 'AppiumRunSessionRemoteConfig':
47
+ return {
48
+ APPIUM_URL: remoteConfig.appiumUrl,
49
+ APPIUM_CAPS: JSON.stringify(remoteConfig.capabilities),
50
+ };
45
51
  case 'ServeSimRunSessionRemoteConfig':
46
52
  return {};
47
53
  }
@@ -96,6 +102,26 @@ function formatRemoteSessionInstructions(remoteConfig, configType) {
96
102
  }
97
103
  return lines.join('\n');
98
104
  }
105
+ case 'AppiumRunSessionRemoteConfig': {
106
+ const environmentVariables = getRemoteSessionEnvironmentVariables(remoteConfig);
107
+ const lines = configType === 'dotenv'
108
+ ? [
109
+ 'Run an Appium client with the simulator session environment:',
110
+ '',
111
+ 'eas simulator:exec <appium-client> [args...]',
112
+ ]
113
+ : [
114
+ 'Run the following in your shell to attach an Appium client to this session:',
115
+ '',
116
+ ...Object.entries(environmentVariables).map(([key, value]) => `export ${key}='${value}'`),
117
+ '',
118
+ '<appium-client> [args...]',
119
+ ];
120
+ if (remoteConfig.webPreviewUrl) {
121
+ lines.push('', 'Open the iOS simulator preview:', '', remoteConfig.webPreviewUrl);
122
+ }
123
+ return lines.join('\n');
124
+ }
99
125
  case 'ServeSimRunSessionRemoteConfig':
100
126
  return [
101
127
  '🌐 Open the following URL in your browser to access the simulator:',
@@ -20,3 +20,8 @@ export declare function uploadAppScopedFileAtPathToGCSAsync(graphqlClient: ExpoG
20
20
  handleProgressEvent?: ProgressHandler;
21
21
  }): Promise<string>;
22
22
  export declare function uploadWithPresignedPostWithRetryAsync(file: string, presignedPost: PresignedPost, onAssetUploadBegin: () => void): Promise<Response>;
23
+ /**
24
+ * Computes the base64-encoded MD5 checksum of a file, the format GCS expects
25
+ * in the `Content-MD5` request header.
26
+ */
27
+ export declare function computeFileMd5Base64Async(file: string): Promise<string>;
package/build/uploads.js CHANGED
@@ -4,7 +4,9 @@ exports.uploadFileAtPathToGCSAsync = uploadFileAtPathToGCSAsync;
4
4
  exports.uploadAccountScopedFileAtPathToGCSAsync = uploadAccountScopedFileAtPathToGCSAsync;
5
5
  exports.uploadAppScopedFileAtPathToGCSAsync = uploadAppScopedFileAtPathToGCSAsync;
6
6
  exports.uploadWithPresignedPostWithRetryAsync = uploadWithPresignedPostWithRetryAsync;
7
+ exports.computeFileMd5Base64Async = computeFileMd5Base64Async;
7
8
  const tslib_1 = require("tslib");
9
+ const node_crypto_1 = tslib_1.__importDefault(require("node:crypto"));
8
10
  const form_data_1 = tslib_1.__importDefault(require("form-data"));
9
11
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
10
12
  const promise_retry_1 = tslib_1.__importDefault(require("promise-retry"));
@@ -78,12 +80,18 @@ async function uploadWithPresignedPostAsync(file, presignedPost) {
78
80
  async function uploadWithSignedUrlWithProgressAsync(file, signedUrl, handleProgressEvent) {
79
81
  const fileStat = await fs_extra_1.default.stat(file);
80
82
  const fileSize = fileStat.size;
83
+ if (fileSize === 0) {
84
+ throw new Error(`Failed to upload ${file}: the file is empty. It may not have been written correctly. Retry the command, and report this issue if it persists.`);
85
+ }
86
+ const contentMd5 = await computeFileMd5Base64Async(file);
81
87
  const readStream = fs_extra_1.default.createReadStream(file);
82
88
  const uploadPromise = (0, fetch_1.default)(signedUrl.url, {
83
89
  method: 'PUT',
84
90
  body: readStream,
85
91
  headers: {
86
92
  ...signedUrl.headers,
93
+ 'Content-Length': String(fileSize), // make GCS reject the request if the file size changes during the upload
94
+ 'Content-MD5': contentMd5, // make GCS reject the request if the uploaded bytes do not match this checksum
87
95
  },
88
96
  });
89
97
  let currentSize = 0;
@@ -99,6 +107,9 @@ async function uploadWithSignedUrlWithProgressAsync(file, signedUrl, handleProgr
99
107
  });
100
108
  try {
101
109
  const response = await uploadPromise;
110
+ if (currentSize !== fileSize) {
111
+ throw new Error(`Failed to upload ${file}: sent ${currentSize} of ${fileSize} bytes. The file may have changed during the upload. Retry the command, and report this issue if it persists.`);
112
+ }
102
113
  handleProgressEvent({ isComplete: true });
103
114
  return response;
104
115
  }
@@ -107,3 +118,14 @@ async function uploadWithSignedUrlWithProgressAsync(file, signedUrl, handleProgr
107
118
  throw error;
108
119
  }
109
120
  }
121
+ /**
122
+ * Computes the base64-encoded MD5 checksum of a file, the format GCS expects
123
+ * in the `Content-MD5` request header.
124
+ */
125
+ async function computeFileMd5Base64Async(file) {
126
+ const hash = node_crypto_1.default.createHash('md5');
127
+ for await (const chunk of fs_extra_1.default.createReadStream(file)) {
128
+ hash.update(chunk);
129
+ }
130
+ return hash.digest('base64');
131
+ }