eas-cli 24.5.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.
Files changed (45) hide show
  1. package/README.md +133 -133
  2. package/build/build/build.js +71 -17
  3. package/build/build/logs.d.ts +10 -0
  4. package/build/build/logs.js +91 -0
  5. package/build/commandUtils/logs/format.d.ts +10 -0
  6. package/build/commandUtils/logs/format.js +21 -0
  7. package/build/commandUtils/logs/parseLogs.d.ts +7 -0
  8. package/build/commandUtils/{workflow/logs → logs}/parseLogs.js +1 -21
  9. package/build/commandUtils/logs/state.d.ts +14 -0
  10. package/build/commandUtils/logs/state.js +71 -0
  11. package/build/commandUtils/logs/types.d.ts +19 -0
  12. package/build/commandUtils/logs/types.js +2 -0
  13. package/build/commandUtils/logs/watcher.d.ts +23 -0
  14. package/build/commandUtils/logs/watcher.js +80 -0
  15. package/build/commandUtils/workflow/{logs/fetchLogs.d.ts → fetchLogs.d.ts} +2 -2
  16. package/build/commandUtils/workflow/{logs/fetchLogs.js → fetchLogs.js} +1 -1
  17. package/build/commandUtils/workflow/logs.d.ts +8 -0
  18. package/build/commandUtils/workflow/logs.js +43 -0
  19. package/build/commandUtils/workflow/stateMachine.d.ts +4 -3
  20. package/build/commandUtils/workflow/stateMachine.js +4 -3
  21. package/build/commandUtils/workflow/types.d.ts +0 -19
  22. package/build/commandUtils/workflow/utils.d.ts +3 -7
  23. package/build/commandUtils/workflow/utils.js +12 -29
  24. package/build/commands/go.js +15 -16
  25. package/build/credentials/manager/ManageIos.js +2 -2
  26. package/build/credentials/manager/SetUpIosBuildCredentials.js +2 -2
  27. package/build/graphql/generated.d.ts +221 -17
  28. package/build/graphql/generated.js +22 -2
  29. package/build/graphql/queries/DeviceRunSessionQuery.js +5 -0
  30. package/build/graphql/queries/UserQuery.d.ts +2 -1
  31. package/build/graphql/queries/UserQuery.js +39 -23
  32. package/build/graphql/types/Actor.d.ts +1 -0
  33. package/build/graphql/types/Actor.js +34 -0
  34. package/build/ora.d.ts +1 -0
  35. package/build/ora.js +5 -1
  36. package/build/simulator/utils.d.ts +7 -6
  37. package/build/simulator/utils.js +34 -13
  38. package/build/utils/centrifuge.js +2 -0
  39. package/oclif.manifest.json +645 -645
  40. package/package.json +2 -2
  41. package/build/commandUtils/workflow/logs/parseLogs.d.ts +0 -14
  42. package/build/commandUtils/workflow/logs/watcher.d.ts +0 -32
  43. package/build/commandUtils/workflow/logs/watcher.js +0 -162
  44. package/build/user/actions.d.ts +0 -3
  45. package/build/user/actions.js +0 -9
package/build/ora.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isSpinnerEnabled = isSpinnerEnabled;
3
4
  exports.ora = ora;
4
5
  exports.updateSpinnerText = updateSpinnerText;
5
6
  const tslib_1 = require("tslib");
@@ -16,6 +17,9 @@ const warnReal = console.warn;
16
17
  // eslint-disable-next-line no-console
17
18
  const errorReal = console.error;
18
19
  const isCi = (0, getenv_1.boolish)('CI', false);
20
+ function isSpinnerEnabled() {
21
+ return !(log_1.default.isDebug || !process.stdin.isTTY || isCi);
22
+ }
19
23
  /**
20
24
  * A custom ora spinner that sends the stream to stdout in CI, or non-TTY, instead of stderr (the default).
21
25
  *
@@ -24,7 +28,7 @@ const isCi = (0, getenv_1.boolish)('CI', false);
24
28
  */
25
29
  function ora(options) {
26
30
  const inputOptions = typeof options === 'string' ? { text: options } : (options ?? {});
27
- const disabled = log_1.default.isDebug || !process.stdin.isTTY || isCi;
31
+ const disabled = !isSpinnerEnabled();
28
32
  const spinner = (0, ora_1.default)({
29
33
  // Ensure our non-interactive mode emulates CI mode.
30
34
  isEnabled: !disabled,
@@ -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
  }
@@ -18,6 +18,7 @@ function createProxiedWebSocketConstructor(agent) {
18
18
  function createWebSocketConstructor() {
19
19
  return fetch_1.httpsProxyAgent ? createProxiedWebSocketConstructor(fetch_1.httpsProxyAgent) : ws_1.default;
20
20
  }
21
+ const LOGS_WEBSOCKET_TIMEOUT_MS = 5_000;
21
22
  function createRealtimeLogsClient(graphqlClient) {
22
23
  const getTokenAsync = async () => {
23
24
  const { token } = await RealtimeLogsMutation_1.RealtimeLogsMutation.generateCentrifugoConnectionTokenAsync(graphqlClient);
@@ -28,6 +29,7 @@ function createRealtimeLogsClient(graphqlClient) {
28
29
  client = new centrifuge_1.Centrifuge((0, api_1.getEASLogsWebsocketUrl)(), {
29
30
  websocket: createWebSocketConstructor(),
30
31
  getToken: getTokenAsync,
32
+ timeout: LOGS_WEBSOCKET_TIMEOUT_MS,
31
33
  });
32
34
  client.on('error', ({ error }) => {
33
35
  log_1.default.debug(`Realtime logs connection error: ${error.message}`);