eas-cli 24.9.0 → 24.10.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.
@@ -19,6 +19,8 @@ export default class Simulator extends EasCommand {
19
19
  'open-url': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
20
20
  type: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
21
21
  'package-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
22
+ 'network-capture': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
23
+ 'network-capture-field': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
22
24
  'max-duration-minutes': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
23
25
  'max-idle-time-minutes': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
24
26
  'resource-class': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
@@ -15,6 +15,7 @@ const log_1 = tslib_1.__importStar(require("../../log"));
15
15
  const ora_1 = require("../../ora");
16
16
  const prompts_1 = require("../../prompts");
17
17
  const egress_1 = require("../../simulator/egress");
18
+ const networkCapture_1 = require("../../simulator/networkCapture");
18
19
  const env_1 = require("../../simulator/env");
19
20
  const expoGo_1 = require("../../simulator/expoGo");
20
21
  const utils_1 = require("../../simulator/utils");
@@ -86,6 +87,14 @@ class Simulator extends EasCommand_1.default {
86
87
  'package-version': core_1.Flags.string({
87
88
  description: 'Version of the package backing the simulator session (e.g. "0.1.3-alpha.3"). Defaults to "latest" when omitted.',
88
89
  }),
90
+ 'network-capture': core_1.Flags.boolean({
91
+ 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.',
92
+ }),
93
+ 'network-capture-field': core_1.Flags.string({
94
+ description: 'What a recording may keep beyond method, URL, status, timing and size: header, query, request-body, response-body. Repeatable or comma-separated. Defaults to none of them, because each can carry credentials.',
95
+ multiple: true,
96
+ dependsOn: ['network-capture'],
97
+ }),
89
98
  'max-duration-minutes': core_1.Flags.integer({
90
99
  description: "Maximum duration of the simulator session in minutes before it is automatically stopped. Defaults to, and cannot exceed, the maximum session duration of the account's plan.",
91
100
  min: 0,
@@ -172,6 +181,14 @@ class Simulator extends EasCommand_1.default {
172
181
  if (existingDeviceRunSessionId && !flags.force) {
173
182
  throw new Error(`Existing simulator session in environment. Use --force to create a new simulator session.`);
174
183
  }
184
+ // Before the platform prompt: a typo here does not depend on the answer.
185
+ let networkCaptureFields = [];
186
+ try {
187
+ networkCaptureFields = (0, networkCapture_1.parseNetworkCaptureFields)(flags['network-capture-field'] ?? []);
188
+ }
189
+ catch (err) {
190
+ throw new errors_1.EasCommandError(err instanceof Error ? err.message : String(err));
191
+ }
175
192
  const platform = await resolvePlatformAsync(flags.platform, nonInteractive);
176
193
  const egress = flags.egress === 'local' ? generated_1.DeviceRunSessionEgress.Local : undefined;
177
194
  let egressAllow = [];
@@ -181,6 +198,9 @@ class Simulator extends EasCommand_1.default {
181
198
  catch (err) {
182
199
  throw new errors_1.EasCommandError(err instanceof Error ? err.message : String(err));
183
200
  }
201
+ if (flags['network-capture'] && platform !== generated_1.AppPlatform.Ios) {
202
+ throw new errors_1.EasCommandError('Network capture is only supported on iOS simulator sessions. Re-run without --network-capture, or pass --platform ios.');
203
+ }
184
204
  if (platform === generated_1.AppPlatform.Android) {
185
205
  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.');
186
206
  log_1.default.newLine();
@@ -206,6 +226,8 @@ class Simulator extends EasCommand_1.default {
206
226
  platform,
207
227
  type: utils_1.DEVICE_RUN_SESSION_TYPE_BY_FLAG_VALUE[flags.type],
208
228
  packageVersion: flags['package-version'],
229
+ networkCapture: flags['network-capture'],
230
+ ...(networkCaptureFields.length ? { networkCaptureFields } : {}),
209
231
  ...(deviceIdentifier
210
232
  ? platform === generated_1.AppPlatform.Ios
211
233
  ? { ios: { deviceIdentifier } }
@@ -234,6 +256,9 @@ class Simulator extends EasCommand_1.default {
234
256
  })
235
257
  : false;
236
258
  createSpinner.succeed(`Simulator session created (id: ${deviceRunSessionId}${simulatorEnvWritten ? `, saved to ${env_1.SIMULATOR_DOTENV_FILE_NAME}` : ''}) ${(0, log_1.link)(deviceRunSessionUrl)}`);
259
+ if (flags['network-capture']) {
260
+ log_1.default.warn('Network capture was requested. HTTPS is decrypted, so recordings contain credentials in cleartext. Relaunch an installed app to record its traffic.');
261
+ }
237
262
  }
238
263
  catch (err) {
239
264
  createSpinner.fail('Failed to create simulator session');
@@ -5563,6 +5563,18 @@ export type CreateDeviceRunSessionInput = {
5563
5563
  * fall back to identifying it by id.
5564
5564
  */
5565
5565
  name?: InputMaybe<Scalars['String']['input']>;
5566
+ /**
5567
+ * Record HTTP(S) traffic from apps on the device for the whole session. iOS only.
5568
+ * HTTPS is decrypted, so recordings contain credentials and cookies in cleartext.
5569
+ * If omitted, no traffic is recorded.
5570
+ */
5571
+ networkCapture?: InputMaybe<Scalars['Boolean']['input']>;
5572
+ /**
5573
+ * What network capture may keep beyond method, URL, status, timing and size: header, query,
5574
+ * request-body, response-body. Each can carry credentials, so nothing here is recorded unless
5575
+ * it is asked for. Requires networkCapture.
5576
+ */
5577
+ networkCaptureFields?: InputMaybe<Array<Scalars['String']['input']>>;
5566
5578
  /**
5567
5579
  * Expo or development-client URL to open after launching the installed application. Requires
5568
5580
  * buildId, applicationArchiveUrl, or expoGo.
@@ -0,0 +1,7 @@
1
+ export declare const NETWORK_CAPTURE_FIELDS: readonly ["header", "query", "request-body", "response-body"];
2
+ export type NetworkCaptureField = (typeof NETWORK_CAPTURE_FIELDS)[number];
3
+ /**
4
+ * Resolve `--network-capture-field` the way serve-sim's own flag does: comma-separated values are
5
+ * accepted, and the name is matched case-insensitively.
6
+ */
7
+ export declare function parseNetworkCaptureFields(entries: readonly string[]): NetworkCaptureField[];
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NETWORK_CAPTURE_FIELDS = void 0;
4
+ exports.parseNetworkCaptureFields = parseNetworkCaptureFields;
5
+ exports.NETWORK_CAPTURE_FIELDS = ['header', 'query', 'request-body', 'response-body'];
6
+ /**
7
+ * Resolve `--network-capture-field` the way serve-sim's own flag does: comma-separated values are
8
+ * accepted, and the name is matched case-insensitively.
9
+ */
10
+ function parseNetworkCaptureFields(entries) {
11
+ const fields = entries
12
+ .flatMap(entry => entry.split(','))
13
+ .map(field => field.trim().toLowerCase());
14
+ if (fields.some(field => field.length === 0)) {
15
+ throw new Error(`Empty network capture field. Choose from: ${exports.NETWORK_CAPTURE_FIELDS.join(', ')}.`);
16
+ }
17
+ const unknown = fields.find(field => !exports.NETWORK_CAPTURE_FIELDS.includes(field));
18
+ if (unknown !== undefined) {
19
+ throw new Error(`Unknown network capture field '${unknown}'. Supported: ${exports.NETWORK_CAPTURE_FIELDS.join(', ')}.`);
20
+ }
21
+ return [...new Set(fields)];
22
+ }