eas-cli 25.0.0 → 25.1.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.
@@ -8,6 +8,19 @@ export interface UsageMetricDisplay {
8
8
  overageValue: number;
9
9
  overageCost: number;
10
10
  unit?: string;
11
+ maxDecimals?: number;
12
+ }
13
+ export interface SimulatorJobTypeBreakdown {
14
+ workflows: number;
15
+ simulator: number;
16
+ other: number;
17
+ }
18
+ export interface SimulatorUsageDisplay {
19
+ minutes: UsageMetricDisplay;
20
+ iosMinutes: number;
21
+ androidMinutes: number;
22
+ jobTypeBreakdown?: SimulatorJobTypeBreakdown;
23
+ overageCostCents: number;
11
24
  }
12
25
  export interface BuildOverageByWorkerSize {
13
26
  platform: AppPlatform;
@@ -40,6 +53,7 @@ export interface UsageDisplayData {
40
53
  bandwidth: UsageMetricDisplay;
41
54
  overageCostCents: number;
42
55
  };
56
+ simulator?: SimulatorUsageDisplay;
43
57
  totalOverageCostCents: number;
44
58
  estimatedBillCents: number;
45
59
  recurringCents: number | null;
@@ -50,7 +50,7 @@ function calculateBillingPeriodDays(startDate, endDate) {
50
50
  }
51
51
  function extractUsageData(data) {
52
52
  const { name, subscription, billingPeriod, usageMetrics } = data;
53
- const { EAS_BUILD, EAS_UPDATE, MEDIUM_ANDROID_BUILDS, LARGE_ANDROID_BUILDS, MEDIUM_IOS_BUILDS, LARGE_IOS_BUILDS, } = usageMetrics;
53
+ const { EAS_BUILD, EAS_UPDATE, MEDIUM_ANDROID_BUILDS, LARGE_ANDROID_BUILDS, MEDIUM_IOS_BUILDS, LARGE_IOS_BUILDS, EAS_SIMULATOR, IOS_SIMULATOR_MINUTES, ANDROID_SIMULATOR_MINUTES, } = usageMetrics;
54
54
  // Find build metrics
55
55
  const buildMetric = EAS_BUILD.planMetrics.find(m => m.serviceMetric === generated_1.EasServiceMetric.Builds && m.metricType === generated_1.UsageMetricType.Build);
56
56
  // Extract build counts by platform and worker size
@@ -118,9 +118,11 @@ function extractUsageData(data) {
118
118
  const bandwidthPlanValue = bandwidthMetric?.value ?? 0;
119
119
  const bandwidthOverageValue = bandwidthOverage?.value ?? 0;
120
120
  const bandwidthLimit = bandwidthMetric?.limit ?? 0;
121
+ const simulator = extractSimulatorUsage(EAS_SIMULATOR, IOS_SIMULATOR_MINUTES?.[0]?.value ?? 0, ANDROID_SIMULATOR_MINUTES?.[0]?.value ?? 0);
121
122
  const buildOverageCostCents = EAS_BUILD.totalCost;
122
123
  const updateOverageCostCents = EAS_UPDATE.totalCost;
123
- const totalOverageCostCents = buildOverageCostCents + updateOverageCostCents;
124
+ const simulatorOverageCostCents = simulator?.overageCostCents ?? 0;
125
+ const totalOverageCostCents = buildOverageCostCents + updateOverageCostCents + simulatorOverageCostCents;
124
126
  // Calculate total overage count for display
125
127
  const totalOverageBuilds = overagesByWorkerSize.reduce((sum, o) => sum + o.count, 0);
126
128
  return {
@@ -187,11 +189,47 @@ function extractUsageData(data) {
187
189
  },
188
190
  overageCostCents: updateOverageCostCents,
189
191
  },
192
+ simulator,
190
193
  totalOverageCostCents,
191
194
  estimatedBillCents: (subscription?.recurringCents ?? 0) + totalOverageCostCents,
192
195
  recurringCents: subscription?.recurringCents ?? null,
193
196
  };
194
197
  }
198
+ // Accounts without EAS Simulator get no SIMULATOR_USAGE plan metric, so the section is hidden.
199
+ // On the Free plan the metric is the minute pool shared with Workflows, split by jobTypeBreakdown.
200
+ function extractSimulatorUsage(simulatorTotal, iosMinutes, androidMinutes) {
201
+ if (simulatorTotal.unavailableServiceUsageMetrics.some(metric => metric.service === generated_1.EasService.Simulator)) {
202
+ throw new Error('Simulator usage is temporarily unavailable, so the bill cannot be estimated. Try again in a few minutes.');
203
+ }
204
+ const planMetric = simulatorTotal.planMetrics.find(m => m.serviceMetric === generated_1.EasServiceMetric.SimulatorUsage);
205
+ if (!planMetric) {
206
+ return undefined;
207
+ }
208
+ const overage = simulatorTotal.overageMetrics.find(m => m.serviceMetric === generated_1.EasServiceMetric.SimulatorUsage);
209
+ const jobTypeBreakdown = planMetric.jobTypeBreakdown
210
+ ? {
211
+ workflows: planMetric.jobTypeBreakdown.workflows,
212
+ simulator: planMetric.jobTypeBreakdown.simulator,
213
+ other: planMetric.jobTypeBreakdown.other,
214
+ }
215
+ : undefined;
216
+ return {
217
+ minutes: {
218
+ name: jobTypeBreakdown ? 'CI/CD and Simulator minutes' : 'Simulator minutes',
219
+ planValue: planMetric.value,
220
+ limit: planMetric.limit,
221
+ percentUsed: (0, checkForOverages_1.calculatePercentUsed)(planMetric.value, planMetric.limit),
222
+ overageValue: overage?.value ?? 0,
223
+ overageCost: overage?.totalCost ?? 0,
224
+ unit: 'minutes',
225
+ maxDecimals: 1,
226
+ },
227
+ iosMinutes,
228
+ androidMinutes,
229
+ jobTypeBreakdown,
230
+ overageCostCents: simulatorTotal.totalCost,
231
+ };
232
+ }
195
233
  function calculateBillingPeriodInfo(data) {
196
234
  const daysElapsed = calculateDaysElapsed(data.billingPeriod.start);
197
235
  const totalDays = calculateBillingPeriodDays(data.billingPeriod.start, data.billingPeriod.end);
@@ -49,10 +49,17 @@ function displayBandwidthMetric(metric, indent = ' ') {
49
49
  log_1.default.log(`${indent}${metric.name} (additional usage): ${chalk_1.default.red(formatBytesDisplay(metric.overageValue))} (${(0, usageUtils_1.formatCurrency)(metric.overageCost)})`);
50
50
  }
51
51
  }
52
+ function formatMetricValue(value, maxDecimals) {
53
+ return value.toLocaleString(undefined, { maximumFractionDigits: maxDecimals });
54
+ }
55
+ function formatMinutes(minutes) {
56
+ return `${formatMetricValue(minutes, 1)} minutes`;
57
+ }
52
58
  function displayMetric(metric, indent = ' ') {
53
59
  const progressBar = (0, checkForOverages_1.createProgressBar)(metric.percentUsed, 20);
54
60
  const percentStr = `${metric.percentUsed}%`;
55
- const planUsageStr = `${(0, usageUtils_1.formatNumber)(metric.planValue)}/${(0, usageUtils_1.formatNumber)(metric.limit)} ${metric.unit ?? ''}`;
61
+ const maxDecimals = metric.maxDecimals ?? 0;
62
+ const planUsageStr = `${formatMetricValue(metric.planValue, maxDecimals)}/${formatMetricValue(metric.limit, maxDecimals)} ${metric.unit ?? ''}`;
56
63
  let color = chalk_1.default.green;
57
64
  if (metric.percentUsed >= 100) {
58
65
  color = chalk_1.default.red;
@@ -63,7 +70,26 @@ function displayMetric(metric, indent = ' ') {
63
70
  log_1.default.log(`${indent}${metric.name} (plan): ${color(planUsageStr)}`);
64
71
  log_1.default.log(`${indent}${progressBar} ${color(percentStr)}`);
65
72
  if (metric.overageValue > 0) {
66
- log_1.default.log(`${indent}${metric.name} (additional usage): ${chalk_1.default.red(`${(0, usageUtils_1.formatNumber)(metric.overageValue)} ${metric.unit ?? ''}`)} (${(0, usageUtils_1.formatCurrency)(metric.overageCost)})`);
73
+ log_1.default.log(`${indent}${metric.name} (additional usage): ${chalk_1.default.red(`${formatMetricValue(metric.overageValue, maxDecimals)} ${metric.unit ?? ''}`)} (${(0, usageUtils_1.formatCurrency)(metric.overageCost)})`);
74
+ }
75
+ }
76
+ function displaySimulatorUsage(simulator) {
77
+ log_1.default.newLine();
78
+ log_1.default.log(chalk_1.default.bold.underline('EAS Simulator'));
79
+ displayMetric(simulator.minutes);
80
+ if (simulator.jobTypeBreakdown) {
81
+ const { workflows, simulator: simulatorMinutes, other } = simulator.jobTypeBreakdown;
82
+ log_1.default.log(' Breakdown by job type:');
83
+ log_1.default.log(` Workflows: ${formatMinutes(workflows)}`);
84
+ log_1.default.log(` Simulator: ${formatMinutes(simulatorMinutes)}`);
85
+ if (other > 0) {
86
+ log_1.default.log(` Other jobs: ${formatMinutes(other)}`);
87
+ }
88
+ }
89
+ if (simulator.iosMinutes > 0 || simulator.androidMinutes > 0) {
90
+ log_1.default.log(' Simulator minutes by platform:');
91
+ log_1.default.log(` iOS: ${formatMinutes(simulator.iosMinutes)}`);
92
+ log_1.default.log(` Android: ${formatMinutes(simulator.androidMinutes)}`);
67
93
  }
68
94
  }
69
95
  function billingUrl(accountName) {
@@ -101,6 +127,9 @@ function displayUsage(data, usageData) {
101
127
  log_1.default.log(chalk_1.default.bold.underline('EAS Update'));
102
128
  displayMetric(data.updates.mau);
103
129
  displayBandwidthMetric(data.updates.bandwidth);
130
+ if (data.simulator) {
131
+ displaySimulatorUsage(data.simulator);
132
+ }
104
133
  log_1.default.newLine();
105
134
  log_1.default.log(chalk_1.default.bold.underline('Billing'));
106
135
  const upcomingInvoice = subscription?.upcomingInvoice;
@@ -142,6 +171,9 @@ function displayUsage(data, usageData) {
142
171
  if (data.updates.overageCostCents > 0) {
143
172
  log_1.default.log(` Updates: ${(0, usageUtils_1.formatCurrency)(data.updates.overageCostCents)}`);
144
173
  }
174
+ if (data.simulator && data.simulator.overageCostCents > 0) {
175
+ log_1.default.log(` Simulator: ${(0, usageUtils_1.formatCurrency)(data.simulator.overageCostCents)}`);
176
+ }
145
177
  }
146
178
  log_1.default.log(` Estimated bill: ${chalk_1.default.bold((0, usageUtils_1.formatCurrency)(data.estimatedBillCents))}`);
147
179
  }
@@ -302,6 +334,27 @@ class AccountUsage extends EasCommand_1.default {
302
334
  },
303
335
  overageCostCents: displayData.updates.overageCostCents,
304
336
  },
337
+ simulator: displayData.simulator
338
+ ? {
339
+ minutes: {
340
+ plan: {
341
+ used: displayData.simulator.minutes.planValue,
342
+ limit: displayData.simulator.minutes.limit,
343
+ percentUsed: displayData.simulator.minutes.percentUsed,
344
+ },
345
+ overage: {
346
+ count: displayData.simulator.minutes.overageValue,
347
+ costCents: displayData.simulator.minutes.overageCost,
348
+ },
349
+ },
350
+ byPlatform: {
351
+ ios: displayData.simulator.iosMinutes,
352
+ android: displayData.simulator.androidMinutes,
353
+ },
354
+ byJobType: displayData.simulator.jobTypeBreakdown ?? null,
355
+ overageCostCents: displayData.simulator.overageCostCents,
356
+ }
357
+ : null,
305
358
  billing: {
306
359
  addons: subscription?.addons ?? [],
307
360
  upcomingInvoice: subscription?.upcomingInvoice ?? null,
@@ -26,6 +26,8 @@ export default class Simulator extends EasCommand {
26
26
  'resource-class': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
27
27
  egress: import("@oclif/core/lib/interfaces").OptionFlag<"local" | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
28
28
  'egress-allow': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
29
+ 'cors-origin': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
30
+ 'frame-ancestor': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
29
31
  force: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
30
32
  'out-config-type': import("@oclif/core/lib/interfaces").OptionFlag<"env" | "dotenv", import("@oclif/core/lib/interfaces").CustomOptions>;
31
33
  'public-link': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
@@ -17,6 +17,7 @@ const log_1 = tslib_1.__importStar(require("../../log"));
17
17
  const ora_1 = require("../../ora");
18
18
  const prompts_1 = require("../../prompts");
19
19
  const egress_1 = require("../../simulator/egress");
20
+ const frameAncestors_1 = require("../../simulator/frameAncestors");
20
21
  const networkCapture_1 = require("../../simulator/networkCapture");
21
22
  const env_1 = require("../../simulator/env");
22
23
  const expoGo_1 = require("../../simulator/expoGo");
@@ -120,6 +121,14 @@ class Simulator extends EasCommand_1.default {
120
121
  multiple: true,
121
122
  dependsOn: ['egress'],
122
123
  }),
124
+ 'cors-origin': core_1.Flags.string({
125
+ description: 'Origin of a page that may call the simulator preview API cross-origin, for example to render the device with @expo/hub-client, such as https://app.example.com or https://*.example.com. Repeat for multiple origins. Embedding the preview in a frame does not need this; use --frame-ancestor for that. The page still needs the printed preview URL and its token.',
126
+ multiple: true,
127
+ }),
128
+ 'frame-ancestor': core_1.Flags.string({
129
+ description: 'Origin of a page that may embed the simulator preview in a frame, such as https://app.example.com or https://*.example.com. Repeat for multiple origins. The embedding page loads the printed preview URL, which carries the session token, so anyone who can read that page can also control the simulator.',
130
+ multiple: true,
131
+ }),
123
132
  force: core_1.Flags.boolean({
124
133
  description: '[default: true] Create a new simulator session even when an existing simulator session is present in the environment.',
125
134
  default: true,
@@ -205,6 +214,20 @@ class Simulator extends EasCommand_1.default {
205
214
  catch (err) {
206
215
  throw new errors_1.EasCommandError(err instanceof Error ? err.message : String(err));
207
216
  }
217
+ let frameAncestors = [];
218
+ try {
219
+ frameAncestors = (0, frameAncestors_1.parseFrameAncestorList)(flags['frame-ancestor'] ?? []);
220
+ }
221
+ catch (err) {
222
+ throw new errors_1.EasCommandError(err instanceof Error ? err.message : String(err));
223
+ }
224
+ let corsOrigins = [];
225
+ try {
226
+ corsOrigins = (0, frameAncestors_1.parseCorsOriginList)(flags['cors-origin'] ?? []);
227
+ }
228
+ catch (err) {
229
+ throw new errors_1.EasCommandError(err instanceof Error ? err.message : String(err));
230
+ }
208
231
  if (flags['network-capture'] && platform !== generated_1.AppPlatform.Ios) {
209
232
  throw new errors_1.EasCommandError('Network capture is only supported on iOS simulator sessions. Re-run without --network-capture, or pass --platform ios.');
210
233
  }
@@ -263,6 +286,8 @@ class Simulator extends EasCommand_1.default {
263
286
  ...(openUrl ? { openUrl } : {}),
264
287
  ...(resourceClass ? { resourceClass } : {}),
265
288
  ...(egress ? { egress } : {}),
289
+ ...(frameAncestors.length ? { frameAncestors } : {}),
290
+ ...(corsOrigins.length ? { corsOrigins } : {}),
266
291
  requestOrigin: generated_1.DeviceRunSessionRequestOrigin.EasCli,
267
292
  ...agentIdentity,
268
293
  maxRunTimeMinutes: flags['max-duration-minutes'],
@@ -374,7 +399,7 @@ class Simulator extends EasCommand_1.default {
374
399
  name,
375
400
  type: flags.type,
376
401
  deviceRunSessionUrl,
377
- remoteConfig: (0, utils_1.sanitizeRemoteConfigForJson)(remoteConfig, deviceRunSessionPreviewUrl, flags['public-link']),
402
+ remoteConfig: (0, utils_1.sanitizeRemoteConfigForJson)(remoteConfig, deviceRunSessionPreviewUrl, flags['public-link'], { frameAncestors, corsOrigins }),
378
403
  });
379
404
  return;
380
405
  }
@@ -385,6 +410,8 @@ class Simulator extends EasCommand_1.default {
385
410
  sessionUrl: deviceRunSessionUrl,
386
411
  privatePreviewUrl: deviceRunSessionPreviewUrl,
387
412
  publicLink: flags['public-link'],
413
+ frameAncestors,
414
+ corsOrigins,
388
415
  platform,
389
416
  }));
390
417
  log_1.default.newLine();
@@ -5538,6 +5538,14 @@ export type CreateDeviceRunSessionInput = {
5538
5538
  * and applicationArchiveUrl.
5539
5539
  */
5540
5540
  expoGo?: InputMaybe<Scalars['Boolean']['input']>;
5541
+ /**
5542
+ * Origins of pages that may embed the session's preview host in a frame, next to expo.dev.
5543
+ * Each value is an https origin such as https://app.example.com or a subdomain wildcard such
5544
+ * as https://*.example.com; plain http is accepted for localhost only. At most 10. The
5545
+ * embedding page still needs the preview token from remoteConfig, and whoever embeds the
5546
+ * preview can also control the device. If omitted, only expo.dev may embed the preview.
5547
+ */
5548
+ frameAncestors?: InputMaybe<Array<Scalars['String']['input']>>;
5541
5549
  /** iOS Simulator options. Only supported when platform is IOS. */
5542
5550
  ios?: InputMaybe<CreateIosDeviceRunSessionInput>;
5543
5551
  /**
@@ -5667,6 +5675,13 @@ export type CreateGitHubRepositorySettingsInput = {
5667
5675
  baseDirectory: Scalars['String']['input'];
5668
5676
  };
5669
5677
  export type CreateIosDeviceRunSessionInput = {
5678
+ /**
5679
+ * Origins of pages that may call the session's preview host API cross-origin, for example to
5680
+ * render the device with @expo/hub-client. Framing the preview does not need this. Same value
5681
+ * rules as frameAncestors. At most 10. The page still needs the preview token from remoteConfig.
5682
+ * If omitted, only expo.dev may call the preview API cross-origin.
5683
+ */
5684
+ corsOrigins?: InputMaybe<Array<Scalars['String']['input']>>;
5670
5685
  /** Simulator device name or UDID to use for the session (e.g. "iPhone 16 Pro"). */
5671
5686
  deviceIdentifier?: InputMaybe<Scalars['String']['input']>;
5672
5687
  };
@@ -17840,6 +17855,12 @@ export type AccountFullUsageQuery = {
17840
17855
  limit: number;
17841
17856
  };
17842
17857
  } | null;
17858
+ jobTypeBreakdown?: {
17859
+ __typename?: 'EstimatedUsageJobTypeBreakdown';
17860
+ workflows: number;
17861
+ simulator: number;
17862
+ other: number;
17863
+ } | null;
17843
17864
  }>;
17844
17865
  overageMetrics: Array<{
17845
17866
  __typename?: 'EstimatedOverageAndCost';
@@ -17889,6 +17910,12 @@ export type AccountFullUsageQuery = {
17889
17910
  limit: number;
17890
17911
  };
17891
17912
  } | null;
17913
+ jobTypeBreakdown?: {
17914
+ __typename?: 'EstimatedUsageJobTypeBreakdown';
17915
+ workflows: number;
17916
+ simulator: number;
17917
+ other: number;
17918
+ } | null;
17892
17919
  }>;
17893
17920
  overageMetrics: Array<{
17894
17921
  __typename?: 'EstimatedOverageAndCost';
@@ -17906,6 +17933,79 @@ export type AccountFullUsageQuery = {
17906
17933
  } | null;
17907
17934
  }>;
17908
17935
  };
17936
+ EAS_SIMULATOR: {
17937
+ __typename?: 'UsageMetricTotal';
17938
+ id: string;
17939
+ totalCost: number;
17940
+ unavailableServiceUsageMetrics: Array<{
17941
+ __typename?: 'UnavailableServiceUsageMetric';
17942
+ service: EasService;
17943
+ }>;
17944
+ billingPeriod: {
17945
+ __typename?: 'BillingPeriod';
17946
+ id: string;
17947
+ start: any;
17948
+ end: any;
17949
+ anchor: any;
17950
+ };
17951
+ planMetrics: Array<{
17952
+ __typename?: 'EstimatedUsage';
17953
+ id: string;
17954
+ service: EasService;
17955
+ serviceMetric: EasServiceMetric;
17956
+ metricType: UsageMetricType;
17957
+ value: number;
17958
+ limit: number;
17959
+ platformBreakdown?: {
17960
+ __typename?: 'EstimatedUsagePlatformBreakdown';
17961
+ ios: {
17962
+ __typename?: 'EstimatedUsagePlatformDetail';
17963
+ value: number;
17964
+ limit: number;
17965
+ };
17966
+ android: {
17967
+ __typename?: 'EstimatedUsagePlatformDetail';
17968
+ value: number;
17969
+ limit: number;
17970
+ };
17971
+ } | null;
17972
+ jobTypeBreakdown?: {
17973
+ __typename?: 'EstimatedUsageJobTypeBreakdown';
17974
+ workflows: number;
17975
+ simulator: number;
17976
+ other: number;
17977
+ } | null;
17978
+ }>;
17979
+ overageMetrics: Array<{
17980
+ __typename?: 'EstimatedOverageAndCost';
17981
+ id: string;
17982
+ service: EasService;
17983
+ serviceMetric: EasServiceMetric;
17984
+ metricType: UsageMetricType;
17985
+ value: number;
17986
+ limit: number;
17987
+ totalCost: number;
17988
+ metadata?: {
17989
+ __typename?: 'AccountUsageEASBuildMetadata';
17990
+ billingResourceClass?: EasBuildBillingResourceClass | null;
17991
+ platform?: AppPlatform | null;
17992
+ } | null;
17993
+ }>;
17994
+ };
17995
+ IOS_SIMULATOR_MINUTES: Array<{
17996
+ __typename?: 'AccountUsageMetric';
17997
+ id: string;
17998
+ serviceMetric: EasServiceMetric;
17999
+ metricType: UsageMetricType;
18000
+ value: number;
18001
+ }>;
18002
+ ANDROID_SIMULATOR_MINUTES: Array<{
18003
+ __typename?: 'AccountUsageMetric';
18004
+ id: string;
18005
+ serviceMetric: EasServiceMetric;
18006
+ metricType: UsageMetricType;
18007
+ value: number;
18008
+ }>;
17909
18009
  };
17910
18010
  };
17911
18011
  };
@@ -22922,6 +23022,12 @@ export type EstimatedUsageFragment = {
22922
23022
  limit: number;
22923
23023
  };
22924
23024
  } | null;
23025
+ jobTypeBreakdown?: {
23026
+ __typename?: 'EstimatedUsageJobTypeBreakdown';
23027
+ workflows: number;
23028
+ simulator: number;
23029
+ other: number;
23030
+ } | null;
22925
23031
  };
22926
23032
  export type EstimatedOverageAndCostFragment = {
22927
23033
  __typename?: 'EstimatedOverageAndCost';
@@ -22970,6 +23076,12 @@ export type UsageMetricTotalFragment = {
22970
23076
  limit: number;
22971
23077
  };
22972
23078
  } | null;
23079
+ jobTypeBreakdown?: {
23080
+ __typename?: 'EstimatedUsageJobTypeBreakdown';
23081
+ workflows: number;
23082
+ simulator: number;
23083
+ other: number;
23084
+ } | null;
22973
23085
  }>;
22974
23086
  overageMetrics: Array<{
22975
23087
  __typename?: 'EstimatedOverageAndCost';
@@ -109,6 +109,31 @@ exports.AccountQuery = {
109
109
  id
110
110
  ...UsageMetricTotalFragment
111
111
  }
112
+ EAS_SIMULATOR: byBillingPeriod(date: $currentDate, service: SIMULATOR) {
113
+ unavailableServiceUsageMetrics {
114
+ service
115
+ }
116
+ id
117
+ ...UsageMetricTotalFragment
118
+ }
119
+ IOS_SIMULATOR_MINUTES: metricsForServiceMetric(
120
+ serviceMetric: SIMULATOR_USAGE
121
+ granularity: TOTAL
122
+ timespan: { start: $startDate, end: $endDate }
123
+ filterParams: { platform: "ios" }
124
+ ) {
125
+ id
126
+ ...AccountUsageMetricFragment
127
+ }
128
+ ANDROID_SIMULATOR_MINUTES: metricsForServiceMetric(
129
+ serviceMetric: SIMULATOR_USAGE
130
+ granularity: TOTAL
131
+ timespan: { start: $startDate, end: $endDate }
132
+ filterParams: { platform: "android" }
133
+ ) {
134
+ id
135
+ ...AccountUsageMetricFragment
136
+ }
112
137
  }
113
138
  }
114
139
  }
@@ -112,6 +112,11 @@ exports.EstimatedUsageFragmentNode = (0, graphql_tag_1.default) `
112
112
  platformBreakdown {
113
113
  ...EstimatedUsagePlatformBreakdownFragment
114
114
  }
115
+ jobTypeBreakdown {
116
+ workflows
117
+ simulator
118
+ other
119
+ }
115
120
  }
116
121
  `;
117
122
  exports.EstimatedOverageAndCostFragmentNode = (0, graphql_tag_1.default) `
@@ -0,0 +1,9 @@
1
+ /**
2
+ * `--frame-ancestor` and `--cors-origin` values: origins of pages that may embed the simulator
3
+ * preview host in a frame, or call its API cross-origin. The server applies the same rules;
4
+ * checking here gives a fast, local error.
5
+ */
6
+ export declare const MAX_FRAME_ANCESTORS = 10;
7
+ export declare const MAX_CORS_ORIGINS = 10;
8
+ export declare function parseFrameAncestorList(entries: readonly string[]): string[];
9
+ export declare function parseCorsOriginList(entries: readonly string[]): string[];
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ /**
3
+ * `--frame-ancestor` and `--cors-origin` values: origins of pages that may embed the simulator
4
+ * preview host in a frame, or call its API cross-origin. The server applies the same rules;
5
+ * checking here gives a fast, local error.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.MAX_CORS_ORIGINS = exports.MAX_FRAME_ANCESTORS = void 0;
9
+ exports.parseFrameAncestorList = parseFrameAncestorList;
10
+ exports.parseCorsOriginList = parseCorsOriginList;
11
+ exports.MAX_FRAME_ANCESTORS = 10;
12
+ exports.MAX_CORS_ORIGINS = 10;
13
+ // The shapes serve-sim and expo-device-hub accept: a host, an IPv6 literal, or a subdomain
14
+ // wildcard with at least two labels after the star.
15
+ const FRAMEABLE_HOSTNAME_PATTERN = /^(?:\[[0-9a-f:.]+\]|[a-z0-9.-]+|\*\.[a-z0-9-]+(?:\.[a-z0-9-]+)+)$/i;
16
+ const LOOPBACK_HOSTNAMES = new Set(['localhost', '127.0.0.1', '[::1]']);
17
+ function parseFrameAncestorList(entries) {
18
+ return parseOriginList(entries, {
19
+ flag: '--frame-ancestor',
20
+ maxCount: exports.MAX_FRAME_ANCESTORS,
21
+ purpose: 'embeds the preview',
22
+ });
23
+ }
24
+ function parseCorsOriginList(entries) {
25
+ return parseOriginList(entries, {
26
+ flag: '--cors-origin',
27
+ maxCount: exports.MAX_CORS_ORIGINS,
28
+ purpose: 'calls the preview API',
29
+ });
30
+ }
31
+ function parseOriginList(entries, { flag, maxCount, purpose }) {
32
+ if (entries.length > maxCount) {
33
+ throw new Error(`${flag} accepts at most ${maxCount} origins; received ${entries.length}. ` +
34
+ `Keep only the origins of pages that ${purpose}.`);
35
+ }
36
+ return [...new Set(entries.map(entry => parseOrigin(entry, flag, purpose)))];
37
+ }
38
+ function parseOrigin(entry, flag, purpose) {
39
+ const value = entry.trim();
40
+ let url;
41
+ try {
42
+ url = new URL(value);
43
+ }
44
+ catch {
45
+ throw new Error(`${flag} ${entry} is not a URL. Pass the origin of the page that ${purpose}, ` +
46
+ 'such as https://app.example.com, or a subdomain wildcard such as https://*.example.com.');
47
+ }
48
+ if (url.pathname !== '/' ||
49
+ url.search !== '' ||
50
+ url.hash !== '' ||
51
+ url.username !== '' ||
52
+ url.password !== '') {
53
+ throw new Error(`${flag} ${entry} must be an origin only. Browsers match origins by scheme, host and port, ` +
54
+ `so drop the path, query, hash and credentials: ${url.origin}.`);
55
+ }
56
+ const isLoopback = LOOPBACK_HOSTNAMES.has(url.hostname);
57
+ if (url.protocol !== 'https:' && !(url.protocol === 'http:' && isLoopback)) {
58
+ throw new Error(`${flag} ${entry} must use https. The preview is served over https, and browsers do not ` +
59
+ 'let an http page use it. Plain http is accepted for localhost only.');
60
+ }
61
+ if (!FRAMEABLE_HOSTNAME_PATTERN.test(url.hostname)) {
62
+ throw new Error(`${flag} ${entry} has a host the preview host cannot allow. Use a hostname, an IPv6 ` +
63
+ 'literal, or a subdomain wildcard with at least two labels after the star, such as https://*.example.com.');
64
+ }
65
+ return url.origin;
66
+ }
@@ -84,7 +84,12 @@ type RemoteSessionInstructionsConfigType = 'env' | 'dotenv';
84
84
  type PreviewLinkOptions = {
85
85
  privatePreviewUrl?: string;
86
86
  publicLink?: boolean;
87
+ /** Origins the session allows to embed the preview host; the embed URL is printed for them. */
88
+ frameAncestors?: readonly string[];
89
+ /** Origins the session allows to call the preview host API; the embed URL is printed for them. */
90
+ corsOrigins?: readonly string[];
87
91
  };
92
+ export type PreviewAccessOrigins = Pick<PreviewLinkOptions, 'frameAncestors' | 'corsOrigins'>;
88
93
  /**
89
94
  * Preview link for a session. A gated preview needs the session token, and a browser cannot send
90
95
  * a header on a page load. The expo.dev preview page reads it from the fragment, which no request
@@ -94,7 +99,14 @@ export declare function formatPreviewUrl(remoteConfig: DeviceRunSessionRemoteCon
94
99
  /**
95
100
  * Remote config for `--json`. Private sessions omit the direct preview API address and preview
96
101
  * tokens. Public sessions include bearer preview links while preserving controller credentials.
102
+ * A session with frame ancestors or CORS origins also includes the preview API address, since
103
+ * the page on those origins needs it.
97
104
  */
98
- export declare function sanitizeRemoteConfigForJson(remoteConfig: DeviceRunSessionRemoteConfig, privatePreviewUrl: string, publicLink?: boolean): DeviceRunSessionRemoteConfig;
99
- export declare function formatRemoteSessionInstructions(remoteConfig: DeviceRunSessionRemoteConfig, configType: RemoteSessionInstructionsConfigType, { egressAllow, egressClientRunsInline, sessionUrl, platform, privatePreviewUrl, publicLink, }?: LocalEgressOptions & PreviewLinkOptions): string;
105
+ export declare function sanitizeRemoteConfigForJson(remoteConfig: DeviceRunSessionRemoteConfig, privatePreviewUrl: string, publicLink?: boolean, { frameAncestors, corsOrigins }?: PreviewAccessOrigins): DeviceRunSessionRemoteConfig;
106
+ /**
107
+ * The preview host address with the session token, which an embedding page loads directly. The
108
+ * expo.dev preview page cannot be framed by other sites. Null until the worker reports the host.
109
+ */
110
+ export declare function formatEmbedPreviewUrl(remoteConfig: DeviceRunSessionRemoteConfig): string | null;
111
+ export declare function formatRemoteSessionInstructions(remoteConfig: DeviceRunSessionRemoteConfig, configType: RemoteSessionInstructionsConfigType, { egressAllow, egressClientRunsInline, sessionUrl, platform, privatePreviewUrl, publicLink, frameAncestors, corsOrigins, }?: LocalEgressOptions & PreviewLinkOptions): string;
100
112
  export {};