eas-cli 27.4.1 → 27.5.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.
Files changed (57) hide show
  1. package/README.md +369 -198
  2. package/build/build/simulatorsLaunchHint.js +1 -1
  3. package/build/commands/simulator/availability.d.ts +1 -0
  4. package/build/commands/simulator/availability.js +3 -1
  5. package/build/commands/simulator/control/connection.d.ts +19 -0
  6. package/build/commands/simulator/control/connection.js +93 -0
  7. package/build/commands/simulator/control.d.ts +7 -0
  8. package/build/commands/simulator/control.js +249 -110
  9. package/build/commands/simulator/egress.d.ts +1 -0
  10. package/build/commands/simulator/egress.js +3 -1
  11. package/build/commands/simulator/events.d.ts +1 -0
  12. package/build/commands/simulator/events.js +3 -1
  13. package/build/commands/simulator/exec.d.ts +1 -0
  14. package/build/commands/simulator/exec.js +3 -1
  15. package/build/commands/simulator/get.d.ts +1 -0
  16. package/build/commands/simulator/get.js +3 -1
  17. package/build/commands/simulator/index.d.ts +2 -0
  18. package/build/commands/simulator/index.js +286 -76
  19. package/build/commands/simulator/list.d.ts +1 -0
  20. package/build/commands/simulator/list.js +3 -1
  21. package/build/commands/simulator/logs.d.ts +1 -0
  22. package/build/commands/simulator/logs.js +3 -1
  23. package/build/commands/simulator/stop.d.ts +1 -0
  24. package/build/commands/simulator/stop.js +3 -1
  25. package/build/commands/workflow/ssh.d.ts +0 -1
  26. package/build/commands/workflow/ssh.js +0 -1
  27. package/build/graphql/generated.d.ts +8 -0
  28. package/build/graphql/types/Actor.js +3 -0
  29. package/build/help.js +2 -1
  30. package/build/project/accountSelection.js +5 -8
  31. package/build/simulator/commandAliases.d.ts +10 -0
  32. package/build/simulator/commandAliases.js +24 -0
  33. package/build/simulator/controlActions.d.ts +32 -0
  34. package/build/simulator/controlActions.js +128 -0
  35. package/build/simulator/controlConfig.d.ts +43 -0
  36. package/build/simulator/controlConfig.js +156 -0
  37. package/build/simulator/controlConnection.d.ts +28 -0
  38. package/build/simulator/controlConnection.js +337 -0
  39. package/build/simulator/controlConnectionProtocol.d.ts +64 -0
  40. package/build/simulator/controlConnectionProtocol.js +155 -0
  41. package/build/simulator/controlConnectionWorker.d.ts +7 -0
  42. package/build/simulator/controlConnectionWorker.js +278 -0
  43. package/build/simulator/controlSession.d.ts +3 -0
  44. package/build/simulator/controlSession.js +28 -0
  45. package/build/simulator/hostActions.d.ts +22 -3
  46. package/build/simulator/hostActions.js +78 -19
  47. package/build/simulator/sessionConfig.d.ts +16 -0
  48. package/build/simulator/sessionConfig.js +36 -0
  49. package/build/simulator/startConfig.d.ts +7 -0
  50. package/build/simulator/startConfig.js +89 -0
  51. package/build/simulator/startSetup.d.ts +7 -0
  52. package/build/simulator/startSetup.js +17 -0
  53. package/build/user/User.d.ts +9 -1
  54. package/build/user/User.js +25 -3
  55. package/build/user/accountPermissions.js +3 -1
  56. package/oclif.manifest.json +1403 -1212
  57. package/package.json +8 -6
@@ -1,6 +1,7 @@
1
1
  import EasCommand from '../../commandUtils/EasCommand';
2
2
  export default class SimulatorEvents extends EasCommand {
3
3
  static aliases: string[];
4
+ static hiddenAliases: string[];
4
5
  static description: string;
5
6
  static flags: {
6
7
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
@@ -11,10 +11,12 @@ const env_1 = require("../../simulator/env");
11
11
  const events_1 = require("../../simulator/events");
12
12
  const json_1 = require("../../utils/json");
13
13
  const promise_1 = require("../../utils/promise");
14
+ const commandAliases_1 = require("../../simulator/commandAliases");
14
15
  const POLL_INTERVAL_MS = 5_000;
15
16
  const POST_STOP_REFRESH_COUNT = 2;
16
17
  class SimulatorEvents extends EasCommand_1.default {
17
- static aliases = ['sim:events'];
18
+ static aliases = (0, commandAliases_1.getSimulatorCommandAliases)('events');
19
+ static hiddenAliases = (0, commandAliases_1.getSimulatorCommandHiddenAliases)('events');
18
20
  static description = '[EXPERIMENTAL] show activity events from a remote simulator session';
19
21
  static flags = {
20
22
  id: core_1.Flags.string({
@@ -1,6 +1,7 @@
1
1
  import EasCommand from '../../commandUtils/EasCommand';
2
2
  export default class SimulatorExec extends EasCommand {
3
3
  static aliases: string[];
4
+ static hiddenAliases: string[];
4
5
  static description: string;
5
6
  static strict: boolean;
6
7
  static contextDefinition: {
@@ -4,8 +4,10 @@ const tslib_1 = require("tslib");
4
4
  const spawn_async_1 = tslib_1.__importDefault(require("@expo/spawn-async"));
5
5
  const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
6
6
  const env_1 = require("../../simulator/env");
7
+ const commandAliases_1 = require("../../simulator/commandAliases");
7
8
  class SimulatorExec extends EasCommand_1.default {
8
- static aliases = ['sim:exec'];
9
+ static aliases = (0, commandAliases_1.getSimulatorCommandAliases)('exec');
10
+ static hiddenAliases = (0, commandAliases_1.getSimulatorCommandHiddenAliases)('exec');
9
11
  static description = `[EXPERIMENTAL] execute a simulator command with ${env_1.SIMULATOR_DOTENV_FILE_NAME} environment loaded`;
10
12
  static strict = false;
11
13
  static contextDefinition = {
@@ -1,6 +1,7 @@
1
1
  import EasCommand from '../../commandUtils/EasCommand';
2
2
  export default class SimulatorGet extends EasCommand {
3
3
  static aliases: string[];
4
+ static hiddenAliases: string[];
4
5
  static description: string;
5
6
  static flags: {
6
7
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
@@ -15,8 +15,10 @@ const utils_1 = require("../../simulator/utils");
15
15
  const files_1 = require("../../utils/files");
16
16
  const formatFields_1 = tslib_1.__importDefault(require("../../utils/formatFields"));
17
17
  const json_1 = require("../../utils/json");
18
+ const commandAliases_1 = require("../../simulator/commandAliases");
18
19
  class SimulatorGet extends EasCommand_1.default {
19
- static aliases = ['sim:get'];
20
+ static aliases = (0, commandAliases_1.getSimulatorCommandAliases)('get');
21
+ static hiddenAliases = (0, commandAliases_1.getSimulatorCommandHiddenAliases)('get');
20
22
  static description = "[EXPERIMENTAL] get info about a remote simulator session on EAS by its simulator session ID. Preview links follow the session's saved sharing preference";
21
23
  static flags = {
22
24
  id: core_1.Flags.string({
@@ -3,9 +3,11 @@ export default class Simulator extends EasCommand {
3
3
  static aliases: string[];
4
4
  static hiddenAliases: string[];
5
5
  static description: string;
6
+ static examples: string[];
6
7
  static flags: {
7
8
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
9
  'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
+ import: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
9
11
  platform: import("@oclif/core/lib/interfaces").OptionFlag<"android" | "ios" | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
10
12
  name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
11
13
  tag: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
@@ -16,6 +16,10 @@ const DeviceRunSessionQuery_1 = require("../../graphql/queries/DeviceRunSessionQ
16
16
  const log_1 = tslib_1.__importStar(require("../../log"));
17
17
  const ora_1 = require("../../ora");
18
18
  const prompts_1 = require("../../prompts");
19
+ const commandAliases_1 = require("../../simulator/commandAliases");
20
+ const controlConfig_1 = require("../../simulator/controlConfig");
21
+ const startConfig_1 = require("../../simulator/startConfig");
22
+ const startSetup_1 = require("../../simulator/startSetup");
19
23
  const egress_1 = require("../../simulator/egress");
20
24
  const frameAncestors_1 = require("../../simulator/frameAncestors");
21
25
  const networkCapture_1 = require("../../simulator/networkCapture");
@@ -26,6 +30,8 @@ const requestAnalytics_1 = require("../../simulator/requestAnalytics");
26
30
  const utils_1 = require("../../simulator/utils");
27
31
  const json_1 = require("../../utils/json");
28
32
  const promise_1 = require("../../utils/promise");
33
+ // Allow the cold-cache client download (up to 60s) and a further minute to connect.
34
+ const EGRESS_SETUP_TIMEOUT_MS = 120_000;
29
35
  const POLL_INTERVAL_MS = 5_000; // 5 seconds
30
36
  const STARTUP_TIMEOUT_MS = 15 * 60 * 1_000; // 15 minutes, excluding time in the queue
31
37
  const OUT_CONFIG_TYPE_VALUES = {
@@ -39,10 +45,35 @@ const APP_PLATFORM_BY_FLAG_VALUE = {
39
45
  ios: generated_1.AppPlatform.Ios,
40
46
  };
41
47
  class Simulator extends EasCommand_1.default {
42
- static aliases = ['simulator:start', 'sim:start'];
43
- static hiddenAliases = ['sim'];
44
- static description = '[EXPERIMENTAL] start a remote simulator session on EAS and get instructions to connect to it. The default browser preview link requires sign-in';
48
+ static aliases = ['simulator:start', ...(0, commandAliases_1.getSimulatorCommandAliases)('start')];
49
+ static hiddenAliases = [
50
+ ...commandAliases_1.SIMULATOR_TOPIC_ALIASES,
51
+ ...commandAliases_1.SIMULATOR_HIDDEN_TOPIC_ALIASES,
52
+ ...(0, commandAliases_1.getSimulatorCommandHiddenAliases)('start'),
53
+ ];
54
+ static description = `[EXPERIMENTAL] start a remote simulator session on EAS
55
+
56
+ Preview links require sign-in by default.
57
+
58
+ Use --import to load saved start options and actions. CLI flags override saved options, including lists:
59
+
60
+ {
61
+ "version": 1,
62
+ "start": {"device": "iPhone 17 Pro", "type": "web-preview-only"},
63
+ "actions": [{"action": "appearance.set", "params": {"value": "dark"}}]
64
+ }
65
+
66
+ The start object uses CLI flag names. Saved actions run after the session is ready. Local action paths are relative to the JSON file. If an action fails, the CLI tries to stop the new session. Android supports saved start options, but not actions yet.
67
+
68
+ With local egress, actions wait for the connection and require interactive mode. In scripts, connect with simulator:egress, then run simulator:control --import separately.`;
69
+ static examples = [
70
+ '$ eas simulator:start --import ./simulator.json',
71
+ '$ eas simulator:start --import ./simulator.json --platform ios --device "iPhone 17 Pro" --json',
72
+ ];
45
73
  static flags = {
74
+ import: core_1.Flags.string({
75
+ description: 'Load start options and actions from a JSON file',
76
+ }),
46
77
  platform: core_1.Flags.option({
47
78
  char: 'p',
48
79
  description: 'Device platform',
@@ -96,6 +127,7 @@ class Simulator extends EasCommand_1.default {
96
127
  description: 'Version of the package backing the simulator session (e.g. "0.1.3-alpha.3"). Defaults to "latest" when omitted.',
97
128
  }),
98
129
  'network-capture': core_1.Flags.boolean({
130
+ allowNo: true,
99
131
  description: 'Record HTTP(S) traffic from apps on the device (iOS only). HTTPS is decrypted, so recordings contain credentials in cleartext and certificate-pinned apps fail to connect.',
100
132
  }),
101
133
  'network-capture-field': core_1.Flags.string({
@@ -144,6 +176,7 @@ class Simulator extends EasCommand_1.default {
144
176
  default: OUT_CONFIG_TYPE_VALUES.Dotenv,
145
177
  })(),
146
178
  'public-link': core_1.Flags.boolean({
179
+ allowNo: true,
147
180
  description: 'Enable the simulator preview Share button and print a shareable link containing an access token. Anyone with the link can control the simulator. With --json, include previewApiUrl and its token for API clients when available.',
148
181
  }),
149
182
  ...flags_1.EasNonInteractiveAndJsonFlags,
@@ -155,11 +188,13 @@ class Simulator extends EasCommand_1.default {
155
188
  ...this.ContextOptions.Analytics,
156
189
  };
157
190
  async runAsync() {
158
- const { flags } = await this.parse(Simulator);
159
- const { json: jsonFlag, nonInteractive } = (0, flags_1.resolveNonInteractiveAndJsonFlags)(flags);
160
- if (jsonFlag) {
191
+ // Import preflight can fail before parsing; keep diagnostics off JSON stdout.
192
+ if (this.argv.includes('--json')) {
161
193
  (0, json_1.enableJsonOutput)();
162
194
  }
195
+ const imported = await (0, startConfig_1.resolveStartConfigAsync)(this.argv, Simulator.flags);
196
+ const { flags } = await this.parse(Simulator, imported.argv);
197
+ const { json: jsonFlag, nonInteractive } = (0, flags_1.resolveNonInteractiveAndJsonFlags)(flags);
163
198
  const { projectId, projectDir, loggedIn: { actor, graphqlClient }, analytics, } = await this.getContextAsync(Simulator, {
164
199
  nonInteractive,
165
200
  });
@@ -210,6 +245,9 @@ class Simulator extends EasCommand_1.default {
210
245
  catch (err) {
211
246
  throw new errors_1.EasCommandError(err instanceof Error ? err.message : String(err));
212
247
  }
248
+ if (networkCaptureFields.length && !flags['network-capture']) {
249
+ throw new errors_1.EasCommandError('--network-capture-field requires --network-capture.');
250
+ }
213
251
  const platform = await resolvePlatformAsync(flags.platform, nonInteractive);
214
252
  const egress = flags.egress === 'local' ? generated_1.DeviceRunSessionEgress.Local : undefined;
215
253
  if (systemImagePackage && platform !== generated_1.AppPlatform.Android) {
@@ -239,6 +277,12 @@ class Simulator extends EasCommand_1.default {
239
277
  if (flags['network-capture'] && platform !== generated_1.AppPlatform.Ios) {
240
278
  throw new errors_1.EasCommandError('Network capture is only supported on iOS simulator sessions. Re-run without --network-capture, or pass --platform ios.');
241
279
  }
280
+ if (platform === generated_1.AppPlatform.Android && imported.config?.actions?.length) {
281
+ throw new errors_1.EasCommandError('Imported control actions are not supported on Android yet. Remove actions to import only start settings, or use --platform ios.');
282
+ }
283
+ if (nonInteractive && egress && imported.config?.actions?.length) {
284
+ throw new errors_1.EasCommandError('Imported actions with local egress require interactive mode. Start without actions, connect eas simulator:egress, then run eas simulator:control --import with the same file.');
285
+ }
242
286
  if (platform === generated_1.AppPlatform.Android) {
243
287
  log_1.default.warn('Android emulator support in EAS Simulator is still in development. Some features available on iOS may not work on Android yet. Full parity with iOS is coming soon.');
244
288
  log_1.default.newLine();
@@ -313,7 +357,9 @@ class Simulator extends EasCommand_1.default {
313
357
  deviceRunSessionUrl = (0, url_1.getDeviceRunSessionUrl)(session.app.ownerAccount.name, session.app.slug, deviceRunSessionId);
314
358
  deviceRunSessionPreviewUrl = (0, url_1.getDeviceRunSessionPreviewUrl)(session.app.ownerAccount.name, session.app.slug, deviceRunSessionId);
315
359
  sessionInterrupt = registerSessionInterrupt(deviceRunSessionId);
316
- const simulatorEnvWritten = !jsonFlag && flags['out-config-type'] === OUT_CONFIG_TYPE_VALUES.Dotenv
360
+ const simulatorEnvWritten = !jsonFlag &&
361
+ !imported.config?.actions?.length &&
362
+ flags['out-config-type'] === OUT_CONFIG_TYPE_VALUES.Dotenv
317
363
  ? await writeSimulatorEnvSafelyAsync(projectDir, {
318
364
  [env_1.EAS_SIMULATOR_SESSION_ID]: deviceRunSessionId,
319
365
  })
@@ -391,77 +437,240 @@ class Simulator extends EasCommand_1.default {
391
437
  sessionInterrupt.dispose();
392
438
  throw new Error(`Timed out after ${Math.round(STARTUP_TIMEOUT_MS / 1000)}s waiting for ${flags.type} session to start (excluding time in the queue). ${(0, log_1.link)(deviceRunSessionUrl)}`);
393
439
  }
394
- if (flags['out-config-type'] === OUT_CONFIG_TYPE_VALUES.Dotenv) {
395
- await writeSimulatorEnvSafelyAsync(projectDir, {
396
- ...(0, utils_1.getRemoteSessionEnvironmentVariables)(remoteConfig, { egressAllow, platform }),
397
- [env_1.EAS_SIMULATOR_SESSION_ID]: deviceRunSessionId,
398
- });
399
- }
400
- if (sessionInterrupt.signal.aborted) {
401
- await stopDeviceRunSessionAfterInterruptAsync({
402
- graphqlClient,
403
- deviceRunSessionId,
404
- projectDir,
405
- spinner: pollSpinner,
406
- sessionInterrupt,
407
- });
408
- return;
409
- }
410
- if (jsonFlag) {
411
- sessionInterrupt.dispose();
412
- (0, json_1.printJsonOnlyOutput)({
413
- id: deviceRunSessionId,
414
- name,
415
- type: flags.type,
416
- deviceRunSessionUrl,
417
- remoteConfig: (0, utils_1.sanitizeRemoteConfigForJson)(remoteConfig, deviceRunSessionPreviewUrl, flags['public-link'], { frameAncestors, corsOrigins }),
418
- });
419
- return;
420
- }
421
- log_1.default.newLine();
422
- log_1.default.log((0, utils_1.formatRemoteSessionInstructions)(remoteConfig, flags['out-config-type'], {
423
- egressAllow,
424
- egressClientRunsInline: !nonInteractive,
425
- sessionUrl: deviceRunSessionUrl,
426
- privatePreviewUrl: deviceRunSessionPreviewUrl,
427
- publicLink: flags['public-link'],
428
- frameAncestors,
429
- corsOrigins,
430
- platform,
431
- }));
432
- log_1.default.newLine();
433
440
  const localEgress = (0, utils_1.getLocalEgressConfig)(remoteConfig, egressAllow, platform);
434
- if (nonInteractive) {
435
- sessionInterrupt.dispose();
436
- // The instructions above already tell the reader to run eas simulator:egress.
437
- log_1.default.log(`When you are done, stop the session with: eas simulator:stop --id ${deviceRunSessionId}`);
438
- return;
439
- }
440
- // In interactive mode the egress client runs right here, for as long as the
441
- // session does. A session with a disconnected tunnel still bills, so Ctrl+C stops both.
442
441
  let egressPromise;
443
442
  let egressError;
444
443
  const egressAbortController = new AbortController();
445
- if (localEgress) {
446
- sessionInterrupt.signal.addEventListener('abort', () => {
447
- egressAbortController.abort();
448
- }, { once: true });
449
- egressPromise = (0, egress_1.runLocalEgressAsync)({
450
- ...localEgress,
451
- signal: egressAbortController.signal,
452
- onConnected: () => {
453
- log_1.default.succeed('Egress tunnel connected.');
454
- },
455
- onDisconnected: () => {
456
- log_1.default.warn('Egress tunnel disconnected; reconnecting. Proxied HTTP(S) requests are unavailable until it reconnects.');
457
- },
458
- }).catch(err => {
459
- egressError = err instanceof Error ? err : new Error(String(err));
460
- log_1.default.error(`${err instanceof Error ? err.message : String(err)} Stopping the simulator session.`);
461
- sessionInterrupt.abort();
462
- });
463
- }
444
+ let markEgressReady;
445
+ const egressReady = new Promise(resolve => {
446
+ markEgressReady = resolve;
447
+ });
448
+ const onSessionAbort = () => {
449
+ egressAbortController.abort();
450
+ };
451
+ const startLocalEgress = () => {
452
+ if (localEgress && !nonInteractive) {
453
+ sessionInterrupt.signal.addEventListener('abort', onSessionAbort, { once: true });
454
+ egressPromise = (0, egress_1.runLocalEgressAsync)({
455
+ ...localEgress,
456
+ signal: egressAbortController.signal,
457
+ onConnected: () => {
458
+ markEgressReady();
459
+ log_1.default.succeed('Egress tunnel connected.');
460
+ },
461
+ onDisconnected: () => {
462
+ log_1.default.warn('Egress tunnel disconnected; reconnecting. Proxied HTTP(S) requests are unavailable until it reconnects.');
463
+ },
464
+ }).catch(err => {
465
+ egressError = err instanceof Error ? err : new Error(String(err));
466
+ log_1.default.error(`${err instanceof Error ? err.message : String(err)} Stopping the simulator session.`);
467
+ sessionInterrupt.abort();
468
+ });
469
+ }
470
+ };
471
+ const writeReadySimulatorEnvAsync = async () => {
472
+ if (flags['out-config-type'] === OUT_CONFIG_TYPE_VALUES.Dotenv) {
473
+ await writeSimulatorEnvSafelyAsync(projectDir, {
474
+ ...(0, utils_1.getRemoteSessionEnvironmentVariables)(remoteConfig, { egressAllow, platform }),
475
+ [env_1.EAS_SIMULATOR_SESSION_ID]: deviceRunSessionId,
476
+ });
477
+ }
478
+ };
464
479
  try {
480
+ if (!jsonFlag && !imported.config?.actions?.length) {
481
+ await writeReadySimulatorEnvAsync();
482
+ }
483
+ if (sessionInterrupt.signal.aborted && !egressError) {
484
+ await stopDeviceRunSessionAfterInterruptAsync({
485
+ graphqlClient,
486
+ deviceRunSessionId,
487
+ projectDir,
488
+ spinner: pollSpinner,
489
+ sessionInterrupt,
490
+ });
491
+ return;
492
+ }
493
+ if (!jsonFlag) {
494
+ log_1.default.newLine();
495
+ log_1.default.log((0, utils_1.formatRemoteSessionInstructions)(remoteConfig, flags['out-config-type'], {
496
+ egressAllow,
497
+ egressClientRunsInline: !nonInteractive,
498
+ sessionUrl: deviceRunSessionUrl,
499
+ privatePreviewUrl: deviceRunSessionPreviewUrl,
500
+ publicLink: flags['public-link'],
501
+ frameAncestors,
502
+ corsOrigins,
503
+ platform,
504
+ }));
505
+ log_1.default.newLine();
506
+ if (nonInteractive) {
507
+ log_1.default.log(`When you are done, stop the session with: eas simulator:stop --id ${deviceRunSessionId}`);
508
+ }
509
+ }
510
+ let setup;
511
+ if (imported.config?.actions?.length) {
512
+ const total = imported.config.actions.length;
513
+ if (!jsonFlag) {
514
+ log_1.default.newLine();
515
+ log_1.default.log(`Importing ${total} action${total === 1 ? '' : 's'} from ${imported.config.path}`);
516
+ }
517
+ startLocalEgress();
518
+ const setupSpinner = (0, ora_1.ora)('Importing simulator configuration').start();
519
+ try {
520
+ if (egress && !localEgress) {
521
+ throw new Error('The ready session did not provide local egress connection settings.');
522
+ }
523
+ if (egressPromise) {
524
+ setupSpinner.text = 'Waiting for local egress before applying configuration';
525
+ let timer;
526
+ try {
527
+ await Promise.race([
528
+ egressReady,
529
+ egressPromise,
530
+ sessionInterrupt.abortPromise,
531
+ new Promise((_resolve, reject) => {
532
+ timer = setTimeout(() => {
533
+ reject(new Error('Local egress did not connect within 120 seconds.'));
534
+ }, EGRESS_SETUP_TIMEOUT_MS);
535
+ timer.unref();
536
+ }),
537
+ ]);
538
+ }
539
+ finally {
540
+ clearTimeout(timer);
541
+ }
542
+ if (egressError) {
543
+ throw egressError;
544
+ }
545
+ sessionInterrupt.signal.throwIfAborted();
546
+ }
547
+ const access = (0, utils_1.getPreviewApiAccess)(remoteConfig);
548
+ if (!access) {
549
+ throw new Error('This session does not expose an authenticated preview API for control actions.');
550
+ }
551
+ const results = await (0, startSetup_1.applyStartConfigAsync)(access, imported.config, {
552
+ signal: sessionInterrupt.signal,
553
+ onProgress: jsonFlag
554
+ ? undefined
555
+ : progress => {
556
+ const label = `[${progress.step}/${progress.total}] ${progress.action}`;
557
+ if (progress.status === 'running') {
558
+ setupSpinner.start(label);
559
+ }
560
+ else {
561
+ setupSpinner.succeed(`${label} completed`);
562
+ if (progress.result.file) {
563
+ log_1.default.log(`Saved ${progress.result.file}`);
564
+ }
565
+ else if (progress.result.output) {
566
+ log_1.default.log(progress.result.output);
567
+ }
568
+ }
569
+ },
570
+ });
571
+ sessionInterrupt.signal.throwIfAborted();
572
+ setup = { config: imported.config.path, results: (0, controlConfig_1.serializeControlConfigResults)(results) };
573
+ setupSpinner.succeed(`Import complete: ${total} action${total === 1 ? '' : 's'} completed`);
574
+ }
575
+ catch (caught) {
576
+ egressAbortController.abort();
577
+ await egressPromise;
578
+ const error = egressError ?? caught;
579
+ if (sessionInterrupt.signal.aborted && !egressError) {
580
+ await stopDeviceRunSessionAfterInterruptAsync({
581
+ graphqlClient,
582
+ deviceRunSessionId,
583
+ projectDir,
584
+ spinner: setupSpinner,
585
+ sessionInterrupt,
586
+ });
587
+ return;
588
+ }
589
+ if (error instanceof controlConfig_1.ControlConfigExecutionError) {
590
+ setupSpinner.fail(`[${error.step}/${total}] ${error.action} failed`);
591
+ if (!jsonFlag) {
592
+ const skipped = total - error.step;
593
+ log_1.default.log(`${error.completed.length} completed · 1 failed · ${skipped} skipped`);
594
+ for (const [index, action] of imported.config.actions.entries()) {
595
+ if (index >= error.step) {
596
+ log_1.default.log(` [${index + 1}/${total}] ${action.action} skipped`);
597
+ }
598
+ }
599
+ }
600
+ }
601
+ else {
602
+ setupSpinner.fail('Simulator configuration import failed');
603
+ }
604
+ const stopped = await ensureDeviceRunSessionStoppedSafelyAsync(graphqlClient, deviceRunSessionId);
605
+ if (stopped) {
606
+ if (!jsonFlag) {
607
+ log_1.default.succeed('Stopped the simulator session after setup failed.');
608
+ }
609
+ await (0, env_1.resetSimulatorEnvAsync)(projectDir, deviceRunSessionId).catch(error => {
610
+ log_1.default.warn(`The session stopped, but ${env_1.SIMULATOR_DOTENV_FILE_NAME} could not be cleaned up: ${error instanceof Error ? error.message : String(error)}`);
611
+ });
612
+ }
613
+ else {
614
+ log_1.default.warn(`Could not confirm cleanup. Run eas simulator:stop --id ${deviceRunSessionId} to stop the session.`);
615
+ }
616
+ sessionInterrupt.dispose();
617
+ if (jsonFlag) {
618
+ (0, json_1.printJsonOnlyOutput)({
619
+ id: deviceRunSessionId,
620
+ deviceRunSessionUrl,
621
+ stopped,
622
+ setup: {
623
+ config: imported.config.path,
624
+ results: error instanceof controlConfig_1.ControlConfigExecutionError
625
+ ? (0, controlConfig_1.serializeControlConfigResults)(error.completed)
626
+ : [],
627
+ error: {
628
+ ...(error instanceof controlConfig_1.ControlConfigExecutionError
629
+ ? { step: error.step, action: error.action }
630
+ : {}),
631
+ message: error instanceof Error ? error.message : String(error),
632
+ },
633
+ },
634
+ });
635
+ process.exitCode = 1;
636
+ return;
637
+ }
638
+ throw error;
639
+ }
640
+ }
641
+ if (jsonFlag || imported.config?.actions?.length) {
642
+ // Keep the previous session's saved credentials until setup succeeds.
643
+ await writeReadySimulatorEnvAsync();
644
+ if (sessionInterrupt.signal.aborted) {
645
+ await stopDeviceRunSessionAfterInterruptAsync({
646
+ graphqlClient,
647
+ deviceRunSessionId,
648
+ projectDir,
649
+ spinner: pollSpinner,
650
+ sessionInterrupt,
651
+ });
652
+ return;
653
+ }
654
+ }
655
+ if (jsonFlag) {
656
+ sessionInterrupt.dispose();
657
+ (0, json_1.printJsonOnlyOutput)({
658
+ id: deviceRunSessionId,
659
+ name,
660
+ type: flags.type,
661
+ deviceRunSessionUrl,
662
+ ...(setup ? { setup } : {}),
663
+ remoteConfig: (0, utils_1.sanitizeRemoteConfigForJson)(remoteConfig, deviceRunSessionPreviewUrl, flags['public-link'], { frameAncestors, corsOrigins }),
664
+ });
665
+ return;
666
+ }
667
+ if (nonInteractive) {
668
+ sessionInterrupt.dispose();
669
+ return;
670
+ }
671
+ if (!imported.config?.actions?.length) {
672
+ startLocalEgress();
673
+ }
465
674
  await waitForSessionEndOrInterruptAsync({
466
675
  graphqlClient,
467
676
  deviceRunSessionId,
@@ -469,14 +678,15 @@ class Simulator extends EasCommand_1.default {
469
678
  projectDir,
470
679
  sessionInterrupt,
471
680
  });
681
+ if (egressError) {
682
+ throw egressError;
683
+ }
472
684
  }
473
685
  finally {
686
+ sessionInterrupt.signal.removeEventListener('abort', onSessionAbort);
474
687
  egressAbortController.abort();
475
688
  await egressPromise;
476
689
  }
477
- if (egressError) {
478
- throw egressError;
479
- }
480
690
  }
481
691
  }
482
692
  exports.default = Simulator;
@@ -1,6 +1,7 @@
1
1
  import EasCommand from '../../commandUtils/EasCommand';
2
2
  export default class SimulatorList extends EasCommand {
3
3
  static aliases: string[];
4
+ static hiddenAliases: string[];
4
5
  static description: string;
5
6
  static flags: {
6
7
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
@@ -14,6 +14,7 @@ const ora_1 = require("../../ora");
14
14
  const utils_1 = require("../../simulator/utils");
15
15
  const date_1 = require("../../utils/date");
16
16
  const json_1 = require("../../utils/json");
17
+ const commandAliases_1 = require("../../simulator/commandAliases");
17
18
  const DEFAULT_LIMIT = 10;
18
19
  const MAX_LIMIT = 100;
19
20
  const STATUS_FLAG_VALUES = {
@@ -34,7 +35,8 @@ const PLATFORM_FLAG_VALUES = {
34
35
  };
35
36
  const PLATFORM_BY_FLAG_VALUE = Object.fromEntries(Object.entries(PLATFORM_FLAG_VALUES).map(([platform, value]) => [value, platform]));
36
37
  class SimulatorList extends EasCommand_1.default {
37
- static aliases = ['sim:list'];
38
+ static aliases = (0, commandAliases_1.getSimulatorCommandAliases)('list');
39
+ static hiddenAliases = (0, commandAliases_1.getSimulatorCommandHiddenAliases)('list');
38
40
  static description = '[EXPERIMENTAL] list remote simulator sessions for the current project';
39
41
  static flags = {
40
42
  status: core_1.Flags.option({
@@ -1,6 +1,7 @@
1
1
  import EasCommand from '../../commandUtils/EasCommand';
2
2
  export default class SimulatorLogs extends EasCommand {
3
3
  static aliases: string[];
4
+ static hiddenAliases: string[];
4
5
  static description: string;
5
6
  static examples: string[];
6
7
  static flags: {
@@ -12,10 +12,12 @@ const env_1 = require("../../simulator/env");
12
12
  const preview_1 = require("../../simulator/preview");
13
13
  const utils_1 = require("../../simulator/utils");
14
14
  const json_1 = require("../../utils/json");
15
+ const commandAliases_1 = require("../../simulator/commandAliases");
15
16
  // serve-sim keeps sending heartbeats while its log source restarts, so the stream alone cannot show a failure.
16
17
  const LOG_SOURCE_HEALTH_CHECK_INTERVAL_MS = 10_000;
17
18
  class SimulatorLogs extends EasCommand_1.default {
18
- static aliases = ['sim:logs'];
19
+ static aliases = (0, commandAliases_1.getSimulatorCommandAliases)('logs');
20
+ static hiddenAliases = (0, commandAliases_1.getSimulatorCommandHiddenAliases)('logs');
19
21
  static description = '[EXPERIMENTAL] show buffered logs from a remote iOS simulator session';
20
22
  static examples = [
21
23
  '<%= config.bin %> simulator:logs --follow',
@@ -1,6 +1,7 @@
1
1
  import EasCommand from '../../commandUtils/EasCommand';
2
2
  export default class SimulatorStop extends EasCommand {
3
3
  static aliases: string[];
4
+ static hiddenAliases: string[];
4
5
  static description: string;
5
6
  static flags: {
6
7
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
@@ -8,8 +8,10 @@ const DeviceRunSessionMutation_1 = require("../../graphql/mutations/DeviceRunSes
8
8
  const ora_1 = require("../../ora");
9
9
  const env_1 = require("../../simulator/env");
10
10
  const json_1 = require("../../utils/json");
11
+ const commandAliases_1 = require("../../simulator/commandAliases");
11
12
  class SimulatorStop extends EasCommand_1.default {
12
- static aliases = ['sim:stop'];
13
+ static aliases = (0, commandAliases_1.getSimulatorCommandAliases)('stop');
14
+ static hiddenAliases = (0, commandAliases_1.getSimulatorCommandHiddenAliases)('stop');
13
15
  static description = '[EXPERIMENTAL] stop a remote simulator session on EAS by its simulator session ID';
14
16
  static flags = {
15
17
  id: core_1.Flags.string({
@@ -16,7 +16,6 @@ export declare function parseSshArgv(rawArgv: readonly string[]): {
16
16
  command: string[];
17
17
  };
18
18
  export default class WorkflowSsh extends EasCommand {
19
- static hidden: boolean;
20
19
  static description: string;
21
20
  static strict: boolean;
22
21
  static flags: {
@@ -78,7 +78,6 @@ function parseSshArgv(rawArgv) {
78
78
  return { showConnect, resourceId, command };
79
79
  }
80
80
  class WorkflowSsh extends EasCommand_1.default {
81
- static hidden = true;
82
81
  static description = '[EXPERIMENTAL] open an ssh session on the worker running a workflow job';
83
82
  static strict = false;
84
83
  static flags = {
@@ -22569,6 +22569,10 @@ export type CurrentUserQuery = {
22569
22569
  username: string;
22570
22570
  featureGates: any;
22571
22571
  isExpoAdmin: boolean;
22572
+ primaryAccount: {
22573
+ __typename?: 'Account';
22574
+ id: string;
22575
+ };
22572
22576
  accounts: Array<{
22573
22577
  __typename?: 'Account';
22574
22578
  id: string;
@@ -23796,6 +23800,10 @@ type MeActorFragment_PartnerActor = {
23796
23800
  id: string;
23797
23801
  featureGates: any;
23798
23802
  isExpoAdmin: boolean;
23803
+ primaryAccount: {
23804
+ __typename?: 'Account';
23805
+ id: string;
23806
+ };
23799
23807
  accounts: Array<{
23800
23808
  __typename?: 'Account';
23801
23809
  id: string;