eas-cli 21.3.0 → 21.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 (53) hide show
  1. package/README.md +338 -149
  2. package/build/build/build.js +102 -17
  3. package/build/build/local.js +64 -7
  4. package/build/commandUtils/workflow/compositeFunctions.d.ts +1 -0
  5. package/build/commandUtils/workflow/compositeFunctions.js +64 -0
  6. package/build/commandUtils/workflow/validation.js +3 -0
  7. package/build/commands/account/usage.d.ts +3 -0
  8. package/build/commands/account/usage.js +6 -5
  9. package/build/commands/integrations/posthog/connect.js +1 -1
  10. package/build/commands/observe/events.js +5 -2
  11. package/build/commands/project/new.d.ts +1 -1
  12. package/build/commands/simulator/events.d.ts +16 -0
  13. package/build/commands/simulator/events.js +136 -0
  14. package/build/commands/simulator/get.js +2 -0
  15. package/build/commands/simulator/list.js +2 -0
  16. package/build/commands/simulator/start.d.ts +1 -0
  17. package/build/commands/simulator/start.js +91 -24
  18. package/build/commands/submit/cancel.d.ts +20 -0
  19. package/build/commands/submit/cancel.js +116 -0
  20. package/build/commands/submit/list.d.ts +27 -0
  21. package/build/commands/submit/list.js +100 -0
  22. package/build/commands/submit/retry.d.ts +18 -0
  23. package/build/commands/submit/retry.js +123 -0
  24. package/build/commands/submit/status.d.ts +19 -0
  25. package/build/commands/submit/status.js +116 -0
  26. package/build/commands/submit/view.d.ts +17 -0
  27. package/build/commands/submit/view.js +96 -0
  28. package/build/graphql/generated.d.ts +780 -40
  29. package/build/graphql/generated.js +3 -0
  30. package/build/graphql/mutations/SubmissionMutation.d.ts +3 -1
  31. package/build/graphql/mutations/SubmissionMutation.js +33 -0
  32. package/build/graphql/queries/DeviceRunSessionQuery.d.ts +2 -1
  33. package/build/graphql/queries/DeviceRunSessionQuery.js +22 -0
  34. package/build/graphql/queries/SubmissionQuery.d.ts +3 -2
  35. package/build/graphql/queries/SubmissionQuery.js +19 -2
  36. package/build/graphql/types/SubmissionWithSubmittedBuild.d.ts +1 -0
  37. package/build/graphql/types/SubmissionWithSubmittedBuild.js +25 -0
  38. package/build/simulator/events.d.ts +7 -0
  39. package/build/simulator/events.js +95 -0
  40. package/build/simulator/utils.js +1 -1
  41. package/build/submit/queries.d.ts +34 -0
  42. package/build/submit/queries.js +94 -0
  43. package/build/submit/status.d.ts +31 -0
  44. package/build/submit/status.js +187 -0
  45. package/build/submit/utils/formatSubmission.d.ts +2 -0
  46. package/build/submit/utils/formatSubmission.js +78 -0
  47. package/build/utils/promise.d.ts +3 -2
  48. package/build/utils/promise.js +17 -3
  49. package/build/utils/terminalText.d.ts +1 -0
  50. package/build/utils/terminalText.js +14 -0
  51. package/build/utils/usage/checkForOverages.js +1 -1
  52. package/oclif.manifest.json +3229 -2628
  53. package/package.json +5 -5
@@ -137,11 +137,14 @@ const SERVER_SIDE_DEFINED_ERRORS = {
137
137
  VALIDATION_ERROR: errors_1.RequestValidationError,
138
138
  };
139
139
  function handleBuildRequestError(error, platform) {
140
- log_1.default.debug(JSON.stringify(error.graphQLErrors, null, 2));
141
- const graphQLErrorCode = error?.graphQLErrors?.[0]?.extensions?.errorCode;
142
- if (graphQLErrorCode in SERVER_SIDE_DEFINED_ERRORS) {
140
+ logBuildRequestErrorDebugInfo(error);
141
+ const graphQLErrors = Array.isArray(error?.graphQLErrors)
142
+ ? error.graphQLErrors
143
+ : [];
144
+ const graphQLErrorCode = graphQLErrors[0]?.extensions?.errorCode;
145
+ if (graphQLErrorCode && graphQLErrorCode in SERVER_SIDE_DEFINED_ERRORS) {
143
146
  const ErrorClass = SERVER_SIDE_DEFINED_ERRORS[graphQLErrorCode];
144
- throw new ErrorClass(error?.graphQLErrors?.[0]?.message);
147
+ throw new ErrorClass(graphQLErrors[0]?.message);
145
148
  }
146
149
  else if (graphQLErrorCode === 'EAS_BUILD_DOWN_FOR_MAINTENANCE') {
147
150
  throw new errors_1.EasBuildDownForMaintenanceError(`EAS Build is down for maintenance. Try again later. Check ${(0, log_1.link)('https://status.expo.dev/')} for updates.`);
@@ -149,22 +152,104 @@ function handleBuildRequestError(error, platform) {
149
152
  else if (graphQLErrorCode === 'EAS_BUILD_TOO_MANY_PENDING_BUILDS') {
150
153
  throw new errors_1.EasBuildTooManyPendingBuildsError(`You have already reached the maximum number of pending ${platform_1.requestedPlatformDisplayNames[platform]} builds for your account. Try again later.`);
151
154
  }
152
- else if (error?.graphQLErrors) {
153
- const errorMessage = error.graphQLErrors
154
- .map((graphQLError) => {
155
- const requestIdLine = graphQLError?.extensions?.requestId
156
- ? `\nRequest ID: ${graphQLError.extensions.requestId}`
157
- : '';
158
- const errorMessageLine = graphQLError?.message
159
- ? `\nError message: ${graphQLError.message}`
160
- : '';
161
- return `${requestIdLine}${errorMessageLine}`;
162
- })
163
- .join('');
164
- throw new Error(`Build request failed. Make sure you are using the latest eas-cli version. If the problem persists, report the issue.${errorMessage}`);
155
+ else if (Array.isArray(error?.graphQLErrors)) {
156
+ const errorDetails = formatBuildRequestErrorDetails(error, graphQLErrors);
157
+ throw new Error(`Build request failed. Make sure you are using the latest eas-cli version. If the problem persists, report the issue.${errorDetails}`);
165
158
  }
166
159
  throw error;
167
160
  }
161
+ function formatBuildRequestErrorDetails(error, graphQLErrors) {
162
+ const details = graphQLErrors
163
+ .map((graphQLError) => {
164
+ const requestIdLine = graphQLError?.extensions?.requestId
165
+ ? `\nRequest ID: ${graphQLError.extensions.requestId}`
166
+ : '';
167
+ const errorMessageLine = graphQLError?.message
168
+ ? `\nError message: ${graphQLError.message}`
169
+ : '';
170
+ return `${requestIdLine}${errorMessageLine}`;
171
+ })
172
+ .filter(Boolean);
173
+ if (error?.networkError?.message) {
174
+ details.push(`\nNetwork error: ${error.networkError.message}`);
175
+ }
176
+ const response = error?.response;
177
+ if (response?.status !== undefined || response?.statusText) {
178
+ const status = [response.status, response.statusText]
179
+ .filter(value => value !== undefined && value !== '')
180
+ .join(' ');
181
+ details.push(`\nResponse status: ${status}`);
182
+ }
183
+ const responseRequestId = getResponseRequestId(response);
184
+ const graphQLRequestIds = new Set(graphQLErrors.map(graphQLError => graphQLError?.extensions?.requestId));
185
+ if (responseRequestId && !graphQLRequestIds.has(responseRequestId)) {
186
+ details.push(`\nRequest ID: ${responseRequestId}`);
187
+ }
188
+ if (details.length === 0 && error?.message) {
189
+ details.push(`\nError message: ${error.message}`);
190
+ }
191
+ return details.join('');
192
+ }
193
+ function getResponseRequestId(response) {
194
+ return (response?.headers?.get?.('expo-request-id') ?? response?.headers?.get?.('x-request-id') ?? null);
195
+ }
196
+ function logBuildRequestErrorDebugInfo(error) {
197
+ const debugInfo = collectBuildRequestErrorDebugInfo(error);
198
+ if (debugInfo) {
199
+ log_1.default.debug(`Build request error details:\n${JSON.stringify(debugInfo, null, 2)}`);
200
+ }
201
+ }
202
+ function collectBuildRequestErrorDebugInfo(error) {
203
+ if (!Array.isArray(error?.graphQLErrors) && !error?.response && !error?.networkError) {
204
+ return null;
205
+ }
206
+ const debugInfo = {};
207
+ if (error?.message) {
208
+ debugInfo.message = error.message;
209
+ }
210
+ if (Array.isArray(error?.graphQLErrors)) {
211
+ debugInfo.graphQLErrors = error.graphQLErrors;
212
+ }
213
+ if (error?.networkError) {
214
+ debugInfo.networkError = collectErrorDebugInfo(error.networkError);
215
+ }
216
+ const response = collectResponseDebugInfo(error?.response);
217
+ if (response) {
218
+ debugInfo.response = response;
219
+ }
220
+ return debugInfo;
221
+ }
222
+ function collectErrorDebugInfo(error) {
223
+ const debugInfo = {};
224
+ for (const property of ['name', 'message', 'code', 'type', 'errno', 'syscall', 'stack']) {
225
+ if (error?.[property]) {
226
+ debugInfo[property] = error[property];
227
+ }
228
+ }
229
+ return debugInfo;
230
+ }
231
+ function collectResponseDebugInfo(response) {
232
+ if (!response) {
233
+ return null;
234
+ }
235
+ const debugInfo = {};
236
+ for (const property of ['status', 'statusText', 'url']) {
237
+ if (response[property] !== undefined && response[property] !== '') {
238
+ debugInfo[property] = response[property];
239
+ }
240
+ }
241
+ const headers = {};
242
+ for (const headerName of ['expo-request-id', 'x-request-id', 'content-type']) {
243
+ const headerValue = response?.headers?.get?.(headerName);
244
+ if (headerValue) {
245
+ headers[headerName] = headerValue;
246
+ }
247
+ }
248
+ if (Object.keys(headers).length > 0) {
249
+ debugInfo.headers = headers;
250
+ }
251
+ return Object.keys(debugInfo).length > 0 ? debugInfo : null;
252
+ }
168
253
  async function uploadProjectAsync(ctx) {
169
254
  let projectTarballPath;
170
255
  try {
@@ -5,6 +5,7 @@ exports.runLocalBuildAsync = runLocalBuildAsync;
5
5
  const tslib_1 = require("tslib");
6
6
  const eas_build_job_1 = require("@expo/eas-build-job");
7
7
  const spawn_async_1 = tslib_1.__importDefault(require("@expo/spawn-async"));
8
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
8
9
  const semver_1 = tslib_1.__importDefault(require("semver"));
9
10
  const api_1 = require("../api");
10
11
  const log_1 = tslib_1.__importDefault(require("../log"));
@@ -30,7 +31,12 @@ var LocalBuildMode;
30
31
  LocalBuildMode["INTERNAL"] = "internal";
31
32
  })(LocalBuildMode || (exports.LocalBuildMode = LocalBuildMode = {}));
32
33
  async function runLocalBuildAsync(job, metadata, options, env) {
33
- const { command, args } = await getCommandAndArgsAsync(job, metadata);
34
+ const { command, args } = await getCommandAndArgsAsync();
35
+ // The job carries build credentials, so it is passed to the plugin via an
36
+ // environment variable rather than a command-line argument. Otherwise it
37
+ // would be exposed in the process list and, on failure, in the spawn error
38
+ // message (which includes the command line) printed to stderr.
39
+ const pluginInput = Buffer.from(JSON.stringify({ job, metadata })).toString('base64');
34
40
  let spinner;
35
41
  if (!options.verbose) {
36
42
  spinner = (0, ora_1.ora)().start(options.skipNativeBuild ? 'Preparing project' : 'Building project');
@@ -46,6 +52,7 @@ async function runLocalBuildAsync(job, metadata, options, env) {
46
52
  const mergedEnv = {
47
53
  ...env,
48
54
  ...process.env,
55
+ EAS_LOCAL_BUILD_PLUGIN_INPUT: pluginInput,
49
56
  EAS_LOCAL_BUILD_WORKINGDIR: options.workingdir ?? process.env.EAS_LOCAL_BUILD_WORKINGDIR,
50
57
  __API_SERVER_URL: (0, api_1.getExpoApiBaseUrl)(),
51
58
  ...(options.skipCleanup || options.skipNativeBuild
@@ -55,11 +62,12 @@ async function runLocalBuildAsync(job, metadata, options, env) {
55
62
  ...(options.artifactsDir ? { EAS_LOCAL_BUILD_ARTIFACTS_DIR: options.artifactsDir } : {}),
56
63
  ...(options.artifactPath ? { EAS_LOCAL_BUILD_ARTIFACT_PATH: options.artifactPath } : {}),
57
64
  };
58
- // log command execution to assist in debugging local builds
65
+ // log command execution to assist in debugging local builds; redact the job
66
+ // input since it contains build credentials.
59
67
  log_1.default.debug('Running local build, using local-build-plugin', {
60
68
  command,
61
69
  args,
62
- env: mergedEnv,
70
+ env: { ...mergedEnv, EAS_LOCAL_BUILD_PLUGIN_INPUT: '[redacted]' },
63
71
  });
64
72
  const spawnPromise = (0, spawn_async_1.default)(command, args, {
65
73
  stdio: options.verbose ? 'inherit' : 'pipe',
@@ -68,21 +76,70 @@ async function runLocalBuildAsync(job, metadata, options, env) {
68
76
  childProcess = spawnPromise.child;
69
77
  await spawnPromise;
70
78
  }
79
+ catch (error) {
80
+ // The plugin's build output is already streamed to the terminal; add a
81
+ // concise context summary to help debug the failure. Never dump the raw
82
+ // job/metadata, which contains build credentials.
83
+ spinner?.stop();
84
+ logLocalBuildDebugInfo(job, metadata);
85
+ throw error;
86
+ }
71
87
  finally {
72
88
  process.removeListener('SIGINT', interruptHandler);
73
89
  spinner?.stop();
74
90
  }
75
91
  }
76
- async function getCommandAndArgsAsync(job, metadata) {
77
- const jobAndMetadataBase64 = Buffer.from(JSON.stringify({ job, metadata })).toString('base64');
92
+ /**
93
+ * Logs an allowlisted, non-secret summary of the build's job/metadata to help
94
+ * a user debug a failed local build. Only known-safe fields are included —
95
+ * never the raw job/metadata (which carries credentials and other secrets).
96
+ */
97
+ function logLocalBuildDebugInfo(job, metadata) {
98
+ // `platform` and `projectRootDirectory` live on the platform-specific job
99
+ // variants; read them defensively since this is best-effort logging.
100
+ const jobFields = job;
101
+ const trackingContext = metadata.trackingContext ?? {};
102
+ const fields = [
103
+ ['Platform', jobFields.platform],
104
+ ['Build profile', metadata.buildProfile],
105
+ ['Workflow', metadata.workflow],
106
+ ['Distribution', metadata.distribution],
107
+ ['Credentials source', metadata.credentialsSource],
108
+ ['Project root directory', jobFields.projectRootDirectory],
109
+ ['Required package manager', metadata.requiredPackageManager],
110
+ ['eas-cli version', metadata.cliVersion],
111
+ ['SDK version', metadata.sdkVersion],
112
+ ['Runtime version', metadata.runtimeVersion],
113
+ ['React Native version', metadata.reactNativeVersion],
114
+ ['Expo package version', metadata.expoPackageVersion],
115
+ ['App version', metadata.appVersion],
116
+ ['Fingerprint hash', metadata.fingerprintHash],
117
+ ['Git commit', metadata.gitCommitHash],
118
+ ['Git working tree dirty', metadata.isGitWorkingTreeDirty],
119
+ ['Build tracking ID', trackingContext.tracking_id],
120
+ ['Project ID', trackingContext.project_id],
121
+ ];
122
+ const lines = fields
123
+ .filter(([, value]) => value !== undefined && value !== null && value !== '')
124
+ .map(([label, value]) => ` ${label}: ${String(value)}`);
125
+ if (lines.length === 0) {
126
+ return;
127
+ }
128
+ log_1.default.newLine();
129
+ log_1.default.log(chalk_1.default.bold('Build context (for debugging this failed local build):'));
130
+ log_1.default.log(chalk_1.default.dim(lines.join('\n')));
131
+ }
132
+ async function getCommandAndArgsAsync() {
133
+ // The job/metadata payload is passed to the plugin via the
134
+ // EAS_LOCAL_BUILD_PLUGIN_INPUT environment variable, not as an argument.
78
135
  if (process.env.EAS_LOCAL_BUILD_PLUGIN_PATH) {
79
136
  return {
80
137
  command: process.env.EAS_LOCAL_BUILD_PLUGIN_PATH,
81
- args: [jobAndMetadataBase64],
138
+ args: [],
82
139
  };
83
140
  }
84
141
  else {
85
- const args = [`${PLUGIN_PACKAGE_NAME}@${PLUGIN_PACKAGE_VERSION}`, jobAndMetadataBase64];
142
+ const args = [`${PLUGIN_PACKAGE_NAME}@${PLUGIN_PACKAGE_VERSION}`];
86
143
  if (await isAtLeastNpm7Async()) {
87
144
  // npx shipped with npm >= 7.0.0 requires the "-y" flag to run commands without
88
145
  // prompting the user to install a package that is used for the first time
@@ -0,0 +1 @@
1
+ export declare function validateWorkflowLocalCompositeFunctionsAsync(parsedYaml: any, projectDir: string): Promise<void>;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateWorkflowLocalCompositeFunctionsAsync = validateWorkflowLocalCompositeFunctionsAsync;
4
+ const tslib_1 = require("tslib");
5
+ const eas_build_job_1 = require("@expo/eas-build-job");
6
+ const steps_1 = require("@expo/steps");
7
+ const fs_1 = require("fs");
8
+ const path_1 = tslib_1.__importDefault(require("path"));
9
+ const YAML = tslib_1.__importStar(require("yaml"));
10
+ const zod_1 = require("zod");
11
+ const log_1 = tslib_1.__importDefault(require("../../log"));
12
+ const COMPOSITE_FUNCTION_FILE_EXTENSIONS = ['yml', 'yaml'];
13
+ async function validateWorkflowLocalCompositeFunctionsAsync(parsedYaml, projectDir) {
14
+ await (0, steps_1.buildCompositeFunctionCatalogFromStepsAsync)({
15
+ rootSteps: stepsFromWorkflow(parsedYaml),
16
+ loadCompositeFunction: compositeFunctionPath => loadLocalCompositeFunctionConfigAsync(projectDir, compositeFunctionPath),
17
+ });
18
+ }
19
+ async function loadLocalCompositeFunctionConfigAsync(projectDir, compositeFunctionPath) {
20
+ const resolvedPath = (0, steps_1.resolveLocalCompositeFunctionPath)(projectDir, compositeFunctionPath);
21
+ for (const ext of COMPOSITE_FUNCTION_FILE_EXTENSIONS) {
22
+ const config = await readCompositeFunctionConfigFileAsync(compositeFunctionPath, path_1.default.join(resolvedPath, `function.${ext}`));
23
+ if (config) {
24
+ log_1.default.debug(`Validated local composite function "${compositeFunctionPath}"`);
25
+ return config;
26
+ }
27
+ }
28
+ throw new Error(`Local composite function "${compositeFunctionPath}" was referenced by a step but no such composite function exists. A local composite function is resolved from a "function.yml" (or "function.yaml") file at the referenced path relative to the EAS project root (e.g. "uses: ${compositeFunctionPath}" resolves "${compositeFunctionPath}/function.yml"). The recommended convention is to keep composite functions under ".eas/functions/<name>".`);
29
+ }
30
+ async function readCompositeFunctionConfigFileAsync(compositeFunctionPath, absolutePath) {
31
+ let rawContents;
32
+ try {
33
+ rawContents = await fs_1.promises.readFile(absolutePath, 'utf-8');
34
+ }
35
+ catch (err) {
36
+ if (err?.code === 'ENOENT') {
37
+ return null;
38
+ }
39
+ throw new Error(`Failed to read local composite function "${compositeFunctionPath}" from ${absolutePath}`, {
40
+ cause: err,
41
+ });
42
+ }
43
+ let parsed;
44
+ try {
45
+ parsed = YAML.parse(rawContents);
46
+ }
47
+ catch (err) {
48
+ throw new Error(`Failed to parse local composite function "${compositeFunctionPath}" YAML at ${absolutePath}`, {
49
+ cause: err,
50
+ });
51
+ }
52
+ const result = eas_build_job_1.CompositeFunctionConfigZ.safeParse(parsed);
53
+ if (!result.success) {
54
+ throw new Error(`Invalid composite function "${compositeFunctionPath}": ${zod_1.z.prettifyError(result.error)}`);
55
+ }
56
+ return result.data;
57
+ }
58
+ function stepsFromWorkflow(parsedYaml) {
59
+ const jobs = parsedYaml?.jobs;
60
+ if (!jobs || typeof jobs !== 'object') {
61
+ return [];
62
+ }
63
+ return Object.values(jobs).flatMap((job) => (Array.isArray(job?.steps) ? job.steps : []));
64
+ }
@@ -9,6 +9,7 @@ const core_1 = require("@urql/core");
9
9
  const fs_1 = require("fs");
10
10
  const path_1 = tslib_1.__importDefault(require("path"));
11
11
  const YAML = tslib_1.__importStar(require("yaml"));
12
+ const compositeFunctions_1 = require("./compositeFunctions");
12
13
  const buildProfileUtils_1 = require("./buildProfileUtils");
13
14
  const api_1 = require("../../api");
14
15
  const WorkflowRevisionMutation_1 = require("../../graphql/mutations/WorkflowRevisionMutation");
@@ -36,6 +37,8 @@ async function validateWorkflowFileAsync(workflowFileContents, projectDir, graph
36
37
  // Check that result passes validation against workflow schema
37
38
  log_1.default.debug(`Validating workflow structure...`);
38
39
  validateWorkflowStructure(parsedYaml, workflowSchema);
40
+ log_1.default.debug(`Validating workflow local composite functions...`);
41
+ await (0, compositeFunctions_1.validateWorkflowLocalCompositeFunctionsAsync)(parsedYaml, projectDir);
39
42
  // Check for other errors using the server-side validation
40
43
  log_1.default.debug(`Validating workflow on server...`);
41
44
  await validateWorkflowOnServerAsync(graphqlClient, projectId, workflowFileContents);
@@ -1,4 +1,7 @@
1
1
  import EasCommand from '../../commandUtils/EasCommand';
2
+ import { UsageDisplayData } from '../../commandUtils/usageUtils';
3
+ import { AccountFullUsageData } from '../../graphql/queries/AccountQuery';
4
+ export declare function displayUsage(data: UsageDisplayData, usageData: AccountFullUsageData): void;
2
5
  export default class AccountUsage extends EasCommand {
3
6
  static description: string;
4
7
  static args: {
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.displayUsage = displayUsage;
3
4
  const tslib_1 = require("tslib");
4
5
  const core_1 = require("@oclif/core");
5
6
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
@@ -45,7 +46,7 @@ function displayBandwidthMetric(metric, indent = ' ') {
45
46
  log_1.default.log(`${indent}${metric.name} (plan): ${color(planUsageStr)}`);
46
47
  log_1.default.log(`${indent}${progressBar} ${color(percentStr)}`);
47
48
  if (metric.overageValue > 0) {
48
- log_1.default.log(`${indent}${metric.name} (overage): ${chalk_1.default.red(formatBytesDisplay(metric.overageValue))} (${(0, usageUtils_1.formatCurrency)(metric.overageCost)})`);
49
+ log_1.default.log(`${indent}${metric.name} (additional usage): ${chalk_1.default.red(formatBytesDisplay(metric.overageValue))} (${(0, usageUtils_1.formatCurrency)(metric.overageCost)})`);
49
50
  }
50
51
  }
51
52
  function displayMetric(metric, indent = ' ') {
@@ -62,7 +63,7 @@ function displayMetric(metric, indent = ' ') {
62
63
  log_1.default.log(`${indent}${metric.name} (plan): ${color(planUsageStr)}`);
63
64
  log_1.default.log(`${indent}${progressBar} ${color(percentStr)}`);
64
65
  if (metric.overageValue > 0) {
65
- log_1.default.log(`${indent}${metric.name} (overage): ${chalk_1.default.red(`${(0, usageUtils_1.formatNumber)(metric.overageValue)} ${metric.unit ?? ''}`)} (${(0, usageUtils_1.formatCurrency)(metric.overageCost)})`);
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)})`);
66
67
  }
67
68
  }
68
69
  function billingUrl(accountName) {
@@ -128,9 +129,9 @@ function displayUsage(data, usageData) {
128
129
  log_1.default.log(` Base subscription: ${(0, usageUtils_1.formatCurrency)(data.recurringCents)}`);
129
130
  }
130
131
  if (data.totalOverageCostCents > 0) {
131
- log_1.default.log(` Current overages: ${chalk_1.default.yellow((0, usageUtils_1.formatCurrency)(data.totalOverageCostCents))}`);
132
+ log_1.default.log(` Additional usage: ${chalk_1.default.yellow((0, usageUtils_1.formatCurrency)(data.totalOverageCostCents))}`);
132
133
  if (data.builds.overageCostCents > 0) {
133
- log_1.default.log(` Build overages: ${(0, usageUtils_1.formatCurrency)(data.builds.overageCostCents)}`);
134
+ log_1.default.log(` Builds: ${(0, usageUtils_1.formatCurrency)(data.builds.overageCostCents)}`);
134
135
  // Show breakdown by worker size
135
136
  for (const overage of data.builds.overagesByWorkerSize) {
136
137
  const platformName = overage.platform === generated_1.AppPlatform.Ios ? 'iOS' : 'Android';
@@ -139,7 +140,7 @@ function displayUsage(data, usageData) {
139
140
  }
140
141
  }
141
142
  if (data.updates.overageCostCents > 0) {
142
- log_1.default.log(` Update overages: ${(0, usageUtils_1.formatCurrency)(data.updates.overageCostCents)}`);
143
+ log_1.default.log(` Updates: ${(0, usageUtils_1.formatCurrency)(data.updates.overageCostCents)}`);
143
144
  }
144
145
  }
145
146
  log_1.default.log(` Estimated bill: ${chalk_1.default.bold((0, usageUtils_1.formatCurrency)(data.estimatedBillCents))}`);
@@ -39,7 +39,7 @@ const SDK_PACKAGES = [
39
39
  'expo-device',
40
40
  'expo-localization',
41
41
  ];
42
- const SESSION_REPLAY_PACKAGE = 'posthog-react-native-session-replay';
42
+ const SESSION_REPLAY_PACKAGE = '@posthog/react-native-plugin';
43
43
  const CONFIG_PLUGIN = 'posthog-react-native/expo';
44
44
  const EAS_POSTHOG_API_KEY_ENV_VAR_NAME = 'EXPO_PUBLIC_POSTHOG_API_KEY';
45
45
  const EAS_POSTHOG_HOST_ENV_VAR_NAME = 'EXPO_PUBLIC_POSTHOG_HOST';
@@ -35,7 +35,7 @@ class ObserveEvents extends EasCommand_1.default {
35
35
  ...flags_2.ObserveAppVersionFlag,
36
36
  ...flags_2.ObserveUpdateIdFlag,
37
37
  'session-id': core_1.Flags.string({
38
- description: 'Filter by session ID',
38
+ description: 'Filter by session ID. When no event name is given, lists the events in the session instead of the event-name summary.',
39
39
  }),
40
40
  'all-events': core_1.Flags.boolean({
41
41
  description: 'When no event name argument is provided, list all events across all event names instead of a summary of event names + counts.',
@@ -69,7 +69,10 @@ class ObserveEvents extends EasCommand_1.default {
69
69
  }
70
70
  const { daysBack, startTime, endTime } = (0, startAndEndTime_1.resolveTimeRange)(flags);
71
71
  const platform = (0, platforms_1.appObservePlatformFromFlag)(flags.platform);
72
- if (!args.eventName && !flags['all-events']) {
72
+ // A session ID narrows to a single session, so show that session's events
73
+ // (like --all-events) instead of the account-wide name+count summary, which
74
+ // has no session filter.
75
+ if (!args.eventName && !flags['all-events'] && !flags['session-id']) {
73
76
  const { names, isTruncated } = await (0, planGating_1.withObservePlanGateHandlingAsync)(() => ObserveQuery_1.ObserveQuery.customEventNamesAsync(graphqlClient, {
74
77
  appId: projectId,
75
78
  startTime,
@@ -25,7 +25,7 @@ export default class New extends EasCommand {
25
25
  path: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
26
26
  };
27
27
  static flags: {
28
- 'package-manager': import("@oclif/core/lib/interfaces").OptionFlag<"npm" | "pnpm" | "bun" | "yarn", import("@oclif/core/lib/interfaces").CustomOptions>;
28
+ 'package-manager': import("@oclif/core/lib/interfaces").OptionFlag<"npm" | "pnpm" | "yarn" | "bun", import("@oclif/core/lib/interfaces").CustomOptions>;
29
29
  };
30
30
  static contextDefinition: {
31
31
  loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
@@ -0,0 +1,16 @@
1
+ import EasCommand from '../../commandUtils/EasCommand';
2
+ export default class SimulatorEvents extends EasCommand {
3
+ static hidden: boolean;
4
+ static description: string;
5
+ static flags: {
6
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
+ 'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
+ id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
9
+ follow: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
+ };
11
+ static contextDefinition: {
12
+ projectDir: import("../../commandUtils/context/ProjectDirContextField").default;
13
+ loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
14
+ };
15
+ runAsync(): Promise<void>;
16
+ }
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const core_1 = require("@oclif/core");
5
+ const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
6
+ const flags_1 = require("../../commandUtils/flags");
7
+ const generated_1 = require("../../graphql/generated");
8
+ const DeviceRunSessionQuery_1 = require("../../graphql/queries/DeviceRunSessionQuery");
9
+ const log_1 = tslib_1.__importDefault(require("../../log"));
10
+ const env_1 = require("../../simulator/env");
11
+ const events_1 = require("../../simulator/events");
12
+ const json_1 = require("../../utils/json");
13
+ const promise_1 = require("../../utils/promise");
14
+ const POLL_INTERVAL_MS = 5_000;
15
+ const POST_STOP_REFRESH_COUNT = 2;
16
+ class SimulatorEvents extends EasCommand_1.default {
17
+ static hidden = true;
18
+ static description = '[EXPERIMENTAL] show activity events from a remote simulator session';
19
+ static flags = {
20
+ id: core_1.Flags.string({
21
+ description: `Simulator session ID. Defaults to ${env_1.SIMULATOR_DOTENV_FILE_NAME}.`,
22
+ }),
23
+ follow: core_1.Flags.boolean({
24
+ char: 'f',
25
+ description: 'Keep watching for new events until the session ends.',
26
+ }),
27
+ ...flags_1.EasNonInteractiveAndJsonFlags,
28
+ };
29
+ static contextDefinition = {
30
+ ...this.ContextOptions.LoggedIn,
31
+ ...this.ContextOptions.ProjectDir,
32
+ };
33
+ async runAsync() {
34
+ const { flags } = await this.parse(SimulatorEvents);
35
+ const { json: jsonFlag, nonInteractive } = (0, flags_1.resolveNonInteractiveAndJsonFlags)(flags);
36
+ if (jsonFlag && flags.follow) {
37
+ throw new Error('Use either --json or --follow, not both.');
38
+ }
39
+ if (jsonFlag) {
40
+ (0, json_1.enableJsonOutput)();
41
+ }
42
+ const { projectDir, loggedIn: { graphqlClient }, } = await this.getContextAsync(SimulatorEvents, { nonInteractive });
43
+ await (0, env_1.loadSimulatorEnvAsync)(projectDir);
44
+ const deviceRunSessionId = flags.id ?? process.env[env_1.EAS_SIMULATOR_SESSION_ID];
45
+ if (!deviceRunSessionId) {
46
+ throw new Error(`No simulator session ID provided. Pass --id, or run \`eas simulator:start\` first to write ${env_1.SIMULATOR_DOTENV_FILE_NAME}.`);
47
+ }
48
+ const printedEventIds = new Set();
49
+ let observedRunningSession = false;
50
+ let remainingPostStopRefreshes = 0;
51
+ let latestEvents = [];
52
+ const abortController = new AbortController();
53
+ const { signal } = abortController;
54
+ const abortPromise = new Promise(resolve => {
55
+ signal.addEventListener('abort', () => {
56
+ resolve();
57
+ }, { once: true });
58
+ });
59
+ const interruptHandler = () => {
60
+ if (signal.aborted) {
61
+ process.exit(130);
62
+ }
63
+ abortController.abort();
64
+ };
65
+ if (flags.follow) {
66
+ process.on('SIGINT', interruptHandler);
67
+ }
68
+ try {
69
+ while (!signal.aborted) {
70
+ let session;
71
+ let events;
72
+ try {
73
+ session = await DeviceRunSessionQuery_1.DeviceRunSessionQuery.eventsByIdAsync(graphqlClient, deviceRunSessionId);
74
+ const eventArtifact = session.artifacts.find(artifact => artifact.metadata?.__eas_type === 'session-events');
75
+ events = eventArtifact
76
+ ? await (0, events_1.downloadDeviceRunSessionEventsAsync)(eventArtifact.downloadUrl)
77
+ : [];
78
+ }
79
+ catch (err) {
80
+ if (!flags.follow) {
81
+ throw err;
82
+ }
83
+ log_1.default.debug(`Failed to poll simulator session events: ${err instanceof Error ? err.message : String(err)}`);
84
+ await Promise.race([(0, promise_1.sleepAsync)(POLL_INTERVAL_MS), abortPromise]);
85
+ continue;
86
+ }
87
+ latestEvents = events;
88
+ if (jsonFlag) {
89
+ (0, json_1.printJsonOnlyOutput)({ deviceRunSessionId, events });
90
+ return;
91
+ }
92
+ const isRunning = session.status === generated_1.DeviceRunSessionStatus.New ||
93
+ session.status === generated_1.DeviceRunSessionStatus.InProgress;
94
+ if (isRunning) {
95
+ observedRunningSession = true;
96
+ remainingPostStopRefreshes = 0;
97
+ }
98
+ else if (observedRunningSession) {
99
+ observedRunningSession = false;
100
+ remainingPostStopRefreshes = POST_STOP_REFRESH_COUNT;
101
+ }
102
+ const shouldRefreshAgain = flags.follow && !signal.aborted && (isRunning || remainingPostStopRefreshes > 0);
103
+ printNewEvents(events, printedEventIds, !shouldRefreshAgain);
104
+ if (!shouldRefreshAgain) {
105
+ if (events.length === 0) {
106
+ log_1.default.log('No simulator session activity has been recorded.');
107
+ }
108
+ return;
109
+ }
110
+ if (!isRunning) {
111
+ remainingPostStopRefreshes -= 1;
112
+ }
113
+ await Promise.race([(0, promise_1.sleepAsync)(POLL_INTERVAL_MS), abortPromise]);
114
+ }
115
+ printNewEvents(latestEvents, printedEventIds, true);
116
+ }
117
+ finally {
118
+ if (flags.follow) {
119
+ process.removeListener('SIGINT', interruptHandler);
120
+ }
121
+ }
122
+ }
123
+ }
124
+ exports.default = SimulatorEvents;
125
+ function printNewEvents(events, printedEventIds, includeIncompleteOperations) {
126
+ const displayEvents = (0, events_1.projectDeviceRunSessionEventsForDisplay)(events, {
127
+ includeIncompleteOperations,
128
+ });
129
+ for (const event of displayEvents) {
130
+ if (printedEventIds.has(event.eventId)) {
131
+ continue;
132
+ }
133
+ log_1.default.log((0, events_1.formatDeviceRunSessionEvent)(event));
134
+ printedEventIds.add(event.eventId);
135
+ }
136
+ }
@@ -55,6 +55,7 @@ class SimulatorGet extends EasCommand_1.default {
55
55
  if (jsonFlag) {
56
56
  (0, json_1.printJsonOnlyOutput)({
57
57
  id: session.id,
58
+ name: session.name ?? undefined,
58
59
  type: (0, utils_1.deviceRunSessionTypeToFlagValue)(session.type),
59
60
  status: session.status,
60
61
  platform: session.platform,
@@ -86,6 +87,7 @@ exports.default = SimulatorGet;
86
87
  function formatSessionFields(session, deviceRunSessionUrl) {
87
88
  return (0, formatFields_1.default)([
88
89
  { label: 'ID', value: session.id },
90
+ { label: 'Name', value: formatNullable(session.name) },
89
91
  { label: 'Type', value: session.type },
90
92
  { label: 'Status', value: session.status },
91
93
  { label: 'Platform', value: session.platform },
@@ -100,6 +100,7 @@ class SimulatorList extends EasCommand_1.default {
100
100
  (0, json_1.printJsonOnlyOutput)({
101
101
  sessions: sessions.map(session => ({
102
102
  id: session.id,
103
+ name: session.name ?? undefined,
103
104
  type: (0, utils_1.deviceRunSessionTypeToFlagValue)(session.type),
104
105
  status: session.status,
105
106
  platform: session.platform,
@@ -122,6 +123,7 @@ class SimulatorList extends EasCommand_1.default {
122
123
  const deviceRunSessionUrl = (0, url_1.getDeviceRunSessionUrl)(session.app.ownerAccount.name, session.app.slug, session.id);
123
124
  const lines = [
124
125
  `ID: ${session.id}`,
126
+ `Name: ${session.name ?? 'null'}`,
125
127
  `Type: ${session.type}`,
126
128
  `Status: ${session.status}`,
127
129
  `Platform: ${session.platform}`,
@@ -7,6 +7,7 @@ export default class SimulatorStart extends EasCommand {
7
7
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
8
  'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
9
  platform: import("@oclif/core/lib/interfaces").OptionFlag<"android" | "ios" | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
10
+ name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
10
11
  type: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
11
12
  'package-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
12
13
  'max-duration-minutes': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;