eas-cli 24.6.0 → 24.7.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.
@@ -993,6 +993,8 @@ export type AgentDeviceRunSessionRemoteConfig = {
993
993
  */
994
994
  egressUrl?: Maybe<Scalars['String']['output']>;
995
995
  /** Session token gating the web preview. Null when the preview runs ungated. */
996
+ /** URL of the preview server, for reaching its API rather than its page. */
997
+ previewApiUrl?: Maybe<Scalars['String']['output']>;
996
998
  webPreviewToken?: Maybe<Scalars['String']['output']>;
997
999
  /**
998
1000
  * URL of the web preview surface for the session. Null when a web preview is
@@ -4090,6 +4092,8 @@ export type AppiumRunSessionRemoteConfig = {
4090
4092
  */
4091
4093
  egressUrl?: Maybe<Scalars['String']['output']>;
4092
4094
  /** Session token gating the web preview. Null when the preview runs ungated. */
4095
+ /** URL of the preview server, for reaching its API rather than its page. */
4096
+ previewApiUrl?: Maybe<Scalars['String']['output']>;
4093
4097
  webPreviewToken?: Maybe<Scalars['String']['output']>;
4094
4098
  /**
4095
4099
  * URL of the web preview surface for the session. Null when a web preview is
@@ -4436,6 +4440,8 @@ export type ArgentRunSessionRemoteConfig = {
4436
4440
  * session does not use local egress.
4437
4441
  */
4438
4442
  egressUrl?: Maybe<Scalars['String']['output']>;
4443
+ /** URL of the preview server, for reaching its API rather than its page. */
4444
+ previewApiUrl?: Maybe<Scalars['String']['output']>;
4439
4445
  toolsAuthToken?: Maybe<Scalars['String']['output']>;
4440
4446
  toolsUrl: Scalars['String']['output'];
4441
4447
  /** Session token gating the web preview. Null when the preview runs ungated. */
@@ -9559,6 +9565,8 @@ export type ServeSimRunSessionRemoteConfig = {
9559
9565
  */
9560
9566
  egressUrl?: Maybe<Scalars['String']['output']>;
9561
9567
  /** Session token gating the preview. Null when the preview runs ungated. */
9568
+ /** URL of the preview server, for reaching its API rather than its page. */
9569
+ previewApiUrl?: Maybe<Scalars['String']['output']>;
9562
9570
  previewToken?: Maybe<Scalars['String']['output']>;
9563
9571
  previewUrl: Scalars['String']['output'];
9564
9572
  /** @deprecated Use previewUrl instead. */
@@ -11343,6 +11351,8 @@ export type WebPreviewOnlyRunSessionRemoteConfig = {
11343
11351
  */
11344
11352
  egressUrl?: Maybe<Scalars['String']['output']>;
11345
11353
  /** Session token gating the web preview. Null when the preview runs ungated. */
11354
+ /** URL of the preview server, for reaching its API rather than its page. */
11355
+ previewApiUrl?: Maybe<Scalars['String']['output']>;
11346
11356
  webPreviewToken?: Maybe<Scalars['String']['output']>;
11347
11357
  webPreviewUrl: Scalars['String']['output'];
11348
11358
  };
@@ -19858,6 +19868,7 @@ export type DeviceRunSessionByIdQuery = {
19858
19868
  agentDeviceRemoteSessionToken: string;
19859
19869
  webPreviewUrl?: string | null;
19860
19870
  webPreviewToken?: string | null;
19871
+ previewApiUrl?: string | null;
19861
19872
  egressUrl?: string | null;
19862
19873
  egressToken?: string | null;
19863
19874
  egressFingerprint?: string | null;
@@ -19872,6 +19883,7 @@ export type DeviceRunSessionByIdQuery = {
19872
19883
  capabilities: any;
19873
19884
  webPreviewUrl?: string | null;
19874
19885
  webPreviewToken?: string | null;
19886
+ previewApiUrl?: string | null;
19875
19887
  } | {
19876
19888
  __typename: 'ArgentRunSessionRemoteConfig';
19877
19889
  egressUrl?: string | null;
@@ -19882,6 +19894,7 @@ export type DeviceRunSessionByIdQuery = {
19882
19894
  toolsAuthToken?: string | null;
19883
19895
  webPreviewUrl?: string | null;
19884
19896
  webPreviewToken?: string | null;
19897
+ previewApiUrl?: string | null;
19885
19898
  } | {
19886
19899
  __typename: 'ServeSimRunSessionRemoteConfig';
19887
19900
  egressUrl?: string | null;
@@ -19890,12 +19903,14 @@ export type DeviceRunSessionByIdQuery = {
19890
19903
  egressPort?: number | null;
19891
19904
  previewUrl: string;
19892
19905
  previewToken?: string | null;
19906
+ previewApiUrl?: string | null;
19893
19907
  } | {
19894
19908
  __typename: 'WebPreviewOnlyRunSessionRemoteConfig';
19895
19909
  egressUrl?: string | null;
19896
19910
  egressToken?: string | null;
19897
19911
  egressFingerprint?: string | null;
19898
19912
  egressPort?: number | null;
19913
+ previewApiUrl?: string | null;
19899
19914
  previewUrl: string;
19900
19915
  previewToken?: string | null;
19901
19916
  } | null;
@@ -66,6 +66,7 @@ exports.DeviceRunSessionQuery = {
66
66
  agentDeviceRemoteSessionToken
67
67
  webPreviewUrl
68
68
  webPreviewToken
69
+ previewApiUrl
69
70
  egressUrl
70
71
  egressToken
71
72
  egressFingerprint
@@ -80,6 +81,7 @@ exports.DeviceRunSessionQuery = {
80
81
  toolsAuthToken
81
82
  webPreviewUrl
82
83
  webPreviewToken
84
+ previewApiUrl
83
85
  }
84
86
  ... on AppiumRunSessionRemoteConfig {
85
87
  egressUrl
@@ -90,6 +92,7 @@ exports.DeviceRunSessionQuery = {
90
92
  capabilities
91
93
  webPreviewUrl
92
94
  webPreviewToken
95
+ previewApiUrl
93
96
  }
94
97
  ... on ServeSimRunSessionRemoteConfig {
95
98
  egressUrl
@@ -98,6 +101,7 @@ exports.DeviceRunSessionQuery = {
98
101
  egressPort
99
102
  previewUrl
100
103
  previewToken
104
+ previewApiUrl
101
105
  }
102
106
  ... on WebPreviewOnlyRunSessionRemoteConfig {
103
107
  egressUrl
@@ -106,6 +110,7 @@ exports.DeviceRunSessionQuery = {
106
110
  egressPort
107
111
  previewUrl: webPreviewUrl
108
112
  previewToken: webPreviewToken
113
+ previewApiUrl
109
114
  }
110
115
  }
111
116
  turtleJobRun {
@@ -72,14 +72,15 @@ export declare function getLocalEgressEnvironmentVariables(egress: LocalEgressCo
72
72
  export declare function getRemoteSessionEnvironmentVariables(remoteConfig: DeviceRunSessionRemoteConfig, { egressAllow }?: LocalEgressOptions): Record<string, string>;
73
73
  type RemoteSessionInstructionsConfigType = 'env' | 'dotenv';
74
74
  /**
75
- * Preview link for a session. A gated serve-sim needs the session token, and a browser cannot send
76
- * a header on a page load, so it rides the query. serve-sim swaps it for a cookie on the first load.
75
+ * Preview link for a session. A gated preview needs the session token, and a browser cannot send
76
+ * a header on a page load. The expo.dev preview page reads it from the fragment, which no request
77
+ * carries; a preview server reads it from the query and swaps it for a cookie on the first load.
77
78
  */
78
- export declare function formatPreviewUrl(url: string, token: string | null | undefined): string;
79
+ export declare function formatPreviewUrl(remoteConfig: DeviceRunSessionRemoteConfig, url: string, token: string | null | undefined): string;
79
80
  /**
80
- * Remote config for `--json`. The preview URL carries the token and the standalone token field is
81
- * dropped, so a consumer gets one URL that works rather than a bare URL that 401s next to a secret
82
- * it has to know to combine.
81
+ * Remote config for `--json`. Both URLs carry the token and the standalone token field is dropped,
82
+ * so a consumer gets URLs that work rather than bare URLs that 401 next to a secret it has to know
83
+ * to combine.
83
84
  */
84
85
  export declare function sanitizeRemoteConfigForJson(remoteConfig: DeviceRunSessionRemoteConfig): DeviceRunSessionRemoteConfig;
85
86
  export declare function formatRemoteSessionInstructions(remoteConfig: DeviceRunSessionRemoteConfig, configType: RemoteSessionInstructionsConfigType, { egressAllow, egressClientRunsInline, sessionUrl }?: LocalEgressOptions): string;
@@ -142,11 +142,23 @@ function getControllerEnvironmentVariables(remoteConfig) {
142
142
  return {};
143
143
  }
144
144
  }
145
+ function previewUrlIsWebsitePage(remoteConfig) {
146
+ return remoteConfig.previewApiUrl != null;
147
+ }
145
148
  /**
146
- * Preview link for a session. A gated serve-sim needs the session token, and a browser cannot send
147
- * a header on a page load, so it rides the query. serve-sim swaps it for a cookie on the first load.
149
+ * Preview link for a session. A gated preview needs the session token, and a browser cannot send
150
+ * a header on a page load. The expo.dev preview page reads it from the fragment, which no request
151
+ * carries; a preview server reads it from the query and swaps it for a cookie on the first load.
148
152
  */
149
- function formatPreviewUrl(url, token) {
153
+ function formatPreviewUrl(remoteConfig, url, token) {
154
+ if (!token || !previewUrlIsWebsitePage(remoteConfig)) {
155
+ return formatPreviewApiUrl(url, token);
156
+ }
157
+ const withToken = new URL(url);
158
+ withToken.hash = new URLSearchParams({ token }).toString();
159
+ return withToken.toString();
160
+ }
161
+ function formatPreviewApiUrl(url, token) {
150
162
  if (!token) {
151
163
  return url;
152
164
  }
@@ -155,16 +167,22 @@ function formatPreviewUrl(url, token) {
155
167
  return withToken.toString();
156
168
  }
157
169
  /**
158
- * Remote config for `--json`. The preview URL carries the token and the standalone token field is
159
- * dropped, so a consumer gets one URL that works rather than a bare URL that 401s next to a secret
160
- * it has to know to combine.
170
+ * Remote config for `--json`. Both URLs carry the token and the standalone token field is dropped,
171
+ * so a consumer gets URLs that work rather than bare URLs that 401 next to a secret it has to know
172
+ * to combine.
161
173
  */
162
174
  function sanitizeRemoteConfigForJson(remoteConfig) {
163
175
  switch (remoteConfig.__typename) {
164
176
  case 'ServeSimRunSessionRemoteConfig':
165
177
  case 'WebPreviewOnlyRunSessionRemoteConfig': {
166
178
  const { previewToken, ...rest } = remoteConfig;
167
- return { ...rest, previewUrl: formatPreviewUrl(remoteConfig.previewUrl, previewToken) };
179
+ return {
180
+ ...rest,
181
+ previewUrl: formatPreviewUrl(remoteConfig, remoteConfig.previewUrl, previewToken),
182
+ previewApiUrl: remoteConfig.previewApiUrl
183
+ ? formatPreviewApiUrl(remoteConfig.previewApiUrl, previewToken)
184
+ : remoteConfig.previewApiUrl,
185
+ };
168
186
  }
169
187
  case 'AgentDeviceRunSessionRemoteConfig':
170
188
  case 'ArgentRunSessionRemoteConfig':
@@ -173,8 +191,11 @@ function sanitizeRemoteConfigForJson(remoteConfig) {
173
191
  return {
174
192
  ...rest,
175
193
  webPreviewUrl: remoteConfig.webPreviewUrl
176
- ? formatPreviewUrl(remoteConfig.webPreviewUrl, webPreviewToken)
194
+ ? formatPreviewUrl(remoteConfig, remoteConfig.webPreviewUrl, webPreviewToken)
177
195
  : remoteConfig.webPreviewUrl,
196
+ previewApiUrl: remoteConfig.previewApiUrl
197
+ ? formatPreviewApiUrl(remoteConfig.previewApiUrl, webPreviewToken)
198
+ : remoteConfig.previewApiUrl,
178
199
  };
179
200
  }
180
201
  }
@@ -228,7 +249,7 @@ function formatControllerInstructions(remoteConfig, configType) {
228
249
  ...Object.entries(environmentVariables).map(([key, value]) => `export ${key}='${value}'`),
229
250
  ];
230
251
  if (remoteConfig.webPreviewUrl) {
231
- lines.push('', '🌐 Open the following URL in your browser to preview the simulator:', '', formatPreviewUrl(remoteConfig.webPreviewUrl, remoteConfig.webPreviewToken));
252
+ lines.push('', '🌐 Open the following URL in your browser to preview the simulator:', '', formatPreviewUrl(remoteConfig, remoteConfig.webPreviewUrl, remoteConfig.webPreviewToken));
232
253
  }
233
254
  return lines.join('\n');
234
255
  }
@@ -258,7 +279,7 @@ function formatControllerInstructions(remoteConfig, configType) {
258
279
  ...Object.entries(environmentVariables).map(([key, value]) => `export ${key}='${value}'`),
259
280
  ];
260
281
  if (remoteConfig.webPreviewUrl) {
261
- lines.push('', '🌐 Open the following URL in your browser to preview the simulator:', '', formatPreviewUrl(remoteConfig.webPreviewUrl, remoteConfig.webPreviewToken));
282
+ lines.push('', '🌐 Open the following URL in your browser to preview the simulator:', '', formatPreviewUrl(remoteConfig, remoteConfig.webPreviewUrl, remoteConfig.webPreviewToken));
262
283
  }
263
284
  return lines.join('\n');
264
285
  }
@@ -278,7 +299,7 @@ function formatControllerInstructions(remoteConfig, configType) {
278
299
  '<appium-client> [args...]',
279
300
  ];
280
301
  if (remoteConfig.webPreviewUrl) {
281
- lines.push('', 'Open the simulator preview:', '', formatPreviewUrl(remoteConfig.webPreviewUrl, remoteConfig.webPreviewToken));
302
+ lines.push('', 'Open the simulator preview:', '', formatPreviewUrl(remoteConfig, remoteConfig.webPreviewUrl, remoteConfig.webPreviewToken));
282
303
  }
283
304
  return lines.join('\n');
284
305
  }
@@ -286,13 +307,13 @@ function formatControllerInstructions(remoteConfig, configType) {
286
307
  return [
287
308
  '🌐 Open the following URL in your browser to access the simulator:',
288
309
  '',
289
- formatPreviewUrl(remoteConfig.previewUrl, remoteConfig.previewToken),
310
+ formatPreviewUrl(remoteConfig, remoteConfig.previewUrl, remoteConfig.previewToken),
290
311
  ].join('\n');
291
312
  case 'WebPreviewOnlyRunSessionRemoteConfig':
292
313
  return [
293
314
  '🌐 Open the following URL in your browser to access the simulator:',
294
315
  '',
295
- formatPreviewUrl(remoteConfig.previewUrl, remoteConfig.previewToken),
316
+ formatPreviewUrl(remoteConfig, remoteConfig.previewUrl, remoteConfig.previewToken),
296
317
  ].join('\n');
297
318
  }
298
319
  }