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
@@ -0,0 +1,187 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getIosStoreStatusAsync = getIosStoreStatusAsync;
4
+ exports.renderIosStoreStatus = renderIosStoreStatus;
5
+ const tslib_1 = require("tslib");
6
+ const apple_utils_1 = require("@expo/apple-utils");
7
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
8
+ const urls_1 = require("./utils/urls");
9
+ const log_1 = tslib_1.__importStar(require("../log"));
10
+ const date_1 = require("../utils/date");
11
+ const formatFields_1 = tslib_1.__importDefault(require("../utils/formatFields"));
12
+ const terminalText_1 = require("../utils/terminalText");
13
+ const TESTFLIGHT_BUILDS_LIMIT = 5;
14
+ async function getIosStoreStatusAsync(app, easSubmissions) {
15
+ const [live, inReview, pendingRelease, builds] = await Promise.all([
16
+ app.getLiveAppStoreVersionAsync({ platform: apple_utils_1.Platform.IOS }),
17
+ app.getInReviewAppStoreVersionAsync({ platform: apple_utils_1.Platform.IOS }),
18
+ app.getPendingReleaseAppStoreVersionAsync({ platform: apple_utils_1.Platform.IOS }),
19
+ apple_utils_1.Build.getAsync(app.context, {
20
+ query: {
21
+ filter: { app: app.id },
22
+ sort: '-uploadedDate',
23
+ limit: TESTFLIGHT_BUILDS_LIMIT,
24
+ includes: ['buildBetaDetail', 'preReleaseVersion'],
25
+ },
26
+ }),
27
+ ]);
28
+ return {
29
+ ascAppIdentifier: app.id,
30
+ live: await toStoreVersionStatusAsync(live, easSubmissions),
31
+ inReview: await toStoreVersionStatusAsync(inReview, easSubmissions),
32
+ pendingRelease: await toStoreVersionStatusAsync(pendingRelease, easSubmissions),
33
+ // The ASC limit param only caps the page size and the client auto-paginates, so cap here too.
34
+ testFlightBuilds: builds
35
+ .slice(0, TESTFLIGHT_BUILDS_LIMIT)
36
+ .map(build => toTestFlightBuildStatus(build, easSubmissions)),
37
+ };
38
+ }
39
+ async function toStoreVersionStatusAsync(version, easSubmissions) {
40
+ if (!version) {
41
+ return null;
42
+ }
43
+ const build = await version.getBuildAsync();
44
+ const buildNumber = build?.attributes.version ?? null;
45
+ const easSubmission = buildNumber
46
+ ? findEasSubmissionByBuildNumber(easSubmissions, buildNumber, version.attributes.versionString)
47
+ : null;
48
+ // Values stay raw here so --json reports exactly what the APIs returned; the render
49
+ // functions sanitize at print time.
50
+ return {
51
+ versionString: version.attributes.versionString,
52
+ buildNumber,
53
+ state: version.attributes.appVersionState ?? version.attributes.appStoreState ?? null,
54
+ ...toEasBuildLinkage(easSubmission),
55
+ };
56
+ }
57
+ function toEasBuildLinkage(easSubmission) {
58
+ return {
59
+ easSubmissionId: easSubmission?.id ?? null,
60
+ easBuildId: easSubmission?.submittedBuild?.id ?? null,
61
+ runtimeVersion: easSubmission?.submittedBuild?.runtimeVersion ?? null,
62
+ fingerprintHash: easSubmission?.submittedBuild?.fingerprint?.hash ?? null,
63
+ };
64
+ }
65
+ function toTestFlightBuildStatus(build, easSubmissions) {
66
+ const buildNumber = build.attributes.version;
67
+ const appVersion = build.attributes.preReleaseVersion?.attributes.version ?? null;
68
+ const easSubmission = findEasSubmissionByBuildNumber(easSubmissions, buildNumber, appVersion);
69
+ return {
70
+ appVersion,
71
+ buildNumber,
72
+ processingState: build.attributes.processingState,
73
+ internalState: build.attributes.buildBetaDetail?.attributes.internalBuildState ?? null,
74
+ externalState: build.attributes.buildBetaDetail?.attributes.externalBuildState ?? null,
75
+ uploadedDate: build.attributes.uploadedDate,
76
+ expired: build.attributes.expired,
77
+ ...toEasBuildLinkage(easSubmission),
78
+ };
79
+ }
80
+ function findEasSubmissionByBuildNumber(easSubmissions, buildNumber, appVersion) {
81
+ return (easSubmissions.find(submission => submission.submittedBuild?.appBuildVersion === buildNumber &&
82
+ (!appVersion || submission.submittedBuild?.appVersion === appVersion)) ?? null);
83
+ }
84
+ function renderIosStoreStatus(status, easSubmissions) {
85
+ log_1.default.addNewLineIfNone();
86
+ log_1.default.log(chalk_1.default.bold('iOS — App Store Connect'));
87
+ log_1.default.newLine();
88
+ log_1.default.log(chalk_1.default.bold('App Store'));
89
+ renderStoreVersion('Live', status.live, easSubmissions);
90
+ renderStoreVersion('In review', status.inReview, easSubmissions);
91
+ renderStoreVersion('Pending release', status.pendingRelease, easSubmissions);
92
+ log_1.default.newLine();
93
+ log_1.default.log(chalk_1.default.bold('TestFlight (latest uploads)'));
94
+ if (status.testFlightBuilds.length === 0) {
95
+ log_1.default.log(chalk_1.default.dim(' No builds found.'));
96
+ return;
97
+ }
98
+ for (const build of status.testFlightBuilds) {
99
+ const version = (0, terminalText_1.sanitizeTerminalText)(`${build.appVersion ?? '?'} (${build.buildNumber})`);
100
+ const states = [];
101
+ if (build.expired) {
102
+ states.push(chalk_1.default.gray('expired'));
103
+ }
104
+ else if (build.processingState !== 'VALID') {
105
+ states.push(chalk_1.default.yellow(build.processingState.toLowerCase()));
106
+ }
107
+ else {
108
+ if (build.internalState) {
109
+ states.push(`internal: ${formatBetaState(build.internalState)}`);
110
+ }
111
+ if (build.externalState) {
112
+ states.push(`external: ${formatBetaState(build.externalState)}`);
113
+ }
114
+ }
115
+ const uploaded = `uploaded ${(0, date_1.fromNow)(new Date(build.uploadedDate))} ago`;
116
+ log_1.default.log(` ${chalk_1.default.bold(version)} — ${states.join(', ')} — ${uploaded}`);
117
+ logEasLinkage(build, easSubmissions);
118
+ }
119
+ }
120
+ function renderStoreVersion(label, version, easSubmissions) {
121
+ if (!version) {
122
+ log_1.default.log(` ${chalk_1.default.dim(`${label}: none`)}`);
123
+ return;
124
+ }
125
+ const versionText = (0, terminalText_1.sanitizeTerminalText)(version.buildNumber
126
+ ? `${version.versionString} (${version.buildNumber})`
127
+ : version.versionString);
128
+ const state = version.state ? formatStoreState(version.state) : '';
129
+ log_1.default.log(` ${label}: ${chalk_1.default.bold(versionText)}${state ? ` — ${state}` : ''}`);
130
+ logEasLinkage(version, easSubmissions);
131
+ }
132
+ function logEasLinkage(linkage, easSubmissions) {
133
+ if (!linkage.easSubmissionId) {
134
+ return;
135
+ }
136
+ const submission = easSubmissions.find(s => s.id === linkage.easSubmissionId);
137
+ const fields = [
138
+ {
139
+ label: 'EAS Submission',
140
+ value: submission ? (0, log_1.link)((0, urls_1.getSubmissionDetailsUrl)(submission)) : linkage.easSubmissionId,
141
+ },
142
+ ];
143
+ if (linkage.easBuildId) {
144
+ fields.push({ label: 'EAS Build ID', value: linkage.easBuildId });
145
+ }
146
+ if (linkage.runtimeVersion) {
147
+ fields.push({ label: 'Runtime Version', value: (0, terminalText_1.sanitizeTerminalText)(linkage.runtimeVersion) });
148
+ }
149
+ if (linkage.fingerprintHash) {
150
+ fields.push({ label: 'Fingerprint', value: linkage.fingerprintHash });
151
+ }
152
+ log_1.default.log((0, formatFields_1.default)(fields)
153
+ .split('\n')
154
+ .map(line => ` ${line}`)
155
+ .join('\n'));
156
+ }
157
+ function formatStoreState(state) {
158
+ const lower = state.toLowerCase().replace(/_/g, ' ');
159
+ switch (state) {
160
+ case 'READY_FOR_SALE':
161
+ case 'READY_FOR_DISTRIBUTION':
162
+ return chalk_1.default.green(lower);
163
+ case 'REJECTED':
164
+ case 'METADATA_REJECTED':
165
+ case 'DEVELOPER_REJECTED':
166
+ case 'INVALID_BINARY':
167
+ return chalk_1.default.red(lower);
168
+ default:
169
+ return chalk_1.default.blue(lower);
170
+ }
171
+ }
172
+ function formatBetaState(state) {
173
+ const lower = state.toLowerCase().replace(/_/g, ' ');
174
+ switch (state) {
175
+ case 'IN_BETA_TESTING':
176
+ case 'BETA_APPROVED':
177
+ return chalk_1.default.green(lower);
178
+ case 'BETA_REJECTED':
179
+ case 'PROCESSING_EXCEPTION':
180
+ case 'MISSING_EXPORT_COMPLIANCE':
181
+ return chalk_1.default.red(lower);
182
+ case 'EXPIRED':
183
+ return chalk_1.default.gray(lower);
184
+ default:
185
+ return chalk_1.default.blue(lower);
186
+ }
187
+ }
@@ -0,0 +1,2 @@
1
+ import { SubmissionWithSubmittedBuildFragment } from '../../graphql/generated';
2
+ export declare function formatGraphQLSubmission(submission: SubmissionWithSubmittedBuildFragment): string;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatGraphQLSubmission = formatGraphQLSubmission;
4
+ const tslib_1 = require("tslib");
5
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
+ const urls_1 = require("./urls");
7
+ const generated_1 = require("../../graphql/generated");
8
+ const log_1 = require("../../log");
9
+ const platform_1 = require("../../platform");
10
+ const formatFields_1 = tslib_1.__importDefault(require("../../utils/formatFields"));
11
+ const terminalText_1 = require("../../utils/terminalText");
12
+ // Submission and build fields carry project-controlled text (versions, profiles, error
13
+ // messages); strip control characters so a crafted value cannot spoof terminal output.
14
+ const sanitize = (value) => value == null ? value : (0, terminalText_1.sanitizeTerminalText)(value);
15
+ function formatGraphQLSubmission(submission) {
16
+ const { submittedBuild } = submission;
17
+ const fields = [
18
+ { label: 'ID', value: submission.id },
19
+ {
20
+ label: 'Platform',
21
+ value: platform_1.appPlatformDisplayNames[submission.platform],
22
+ },
23
+ {
24
+ label: 'Status',
25
+ get value() {
26
+ switch (submission.status) {
27
+ case generated_1.SubmissionStatus.AwaitingBuild:
28
+ return chalk_1.default.blue('awaiting build');
29
+ case generated_1.SubmissionStatus.InQueue:
30
+ return chalk_1.default.blue('in queue');
31
+ case generated_1.SubmissionStatus.InProgress:
32
+ return chalk_1.default.blue('in progress');
33
+ case generated_1.SubmissionStatus.Finished:
34
+ return chalk_1.default.green('finished');
35
+ case generated_1.SubmissionStatus.Errored:
36
+ return chalk_1.default.red('errored');
37
+ case generated_1.SubmissionStatus.Canceled:
38
+ return chalk_1.default.gray('canceled');
39
+ default:
40
+ return 'unknown';
41
+ }
42
+ },
43
+ },
44
+ ...(submission.platform === generated_1.AppPlatform.Android
45
+ ? [
46
+ {
47
+ label: 'Application Identifier',
48
+ value: sanitize(submission.androidConfig?.applicationIdentifier),
49
+ },
50
+ { label: 'Track', value: sanitize(submission.androidConfig?.track)?.toLowerCase() },
51
+ {
52
+ label: 'Release Status',
53
+ value: submission.androidConfig?.releaseStatus?.toLowerCase(),
54
+ },
55
+ ]
56
+ : [{ label: 'ASC App ID', value: sanitize(submission.iosConfig?.ascAppIdentifier) }]),
57
+ { label: 'Build ID', value: submittedBuild?.id },
58
+ { label: 'Build Profile', value: sanitize(submittedBuild?.buildProfile) },
59
+ { label: 'App Version', value: sanitize(submittedBuild?.appVersion) },
60
+ {
61
+ label: submission.platform === generated_1.AppPlatform.Android ? 'Version code' : 'Build number',
62
+ value: sanitize(submittedBuild?.appBuildVersion),
63
+ },
64
+ { label: 'Runtime Version', value: sanitize(submittedBuild?.runtimeVersion) },
65
+ { label: 'Fingerprint', value: submittedBuild?.fingerprint?.hash },
66
+ { label: 'Commit', value: sanitize(submittedBuild?.gitCommitHash) },
67
+ { label: 'Error Code', value: sanitize(submission.error?.errorCode) },
68
+ { label: 'Error Message', value: sanitize(submission.error?.message) },
69
+ { label: 'Started at', value: new Date(submission.createdAt).toLocaleString() },
70
+ {
71
+ label: 'Finished at',
72
+ value: submission.completedAt ? new Date(submission.completedAt).toLocaleString() : null,
73
+ },
74
+ { label: 'Submission Details', value: (0, log_1.link)((0, urls_1.getSubmissionDetailsUrl)(submission)) },
75
+ ];
76
+ const filteredFields = fields.filter(({ value }) => value !== undefined && value !== null);
77
+ return (0, formatFields_1.default)(filteredFields);
78
+ }
@@ -2,6 +2,7 @@
2
2
  * Returns a promise that will be resolved after given ms milliseconds.
3
3
  *
4
4
  * @param ms A number of milliseconds to sleep.
5
- * @returns A promise that resolves after the provided number of milliseconds.
5
+ * @param signal An optional signal that resolves the sleep early when aborted.
6
+ * @returns A promise that resolves after the provided number of milliseconds or when aborted.
6
7
  */
7
- export declare function sleepAsync(ms: number): Promise<void>;
8
+ export declare function sleepAsync(ms: number, signal?: AbortSignal): Promise<void>;
@@ -5,8 +5,22 @@ exports.sleepAsync = sleepAsync;
5
5
  * Returns a promise that will be resolved after given ms milliseconds.
6
6
  *
7
7
  * @param ms A number of milliseconds to sleep.
8
- * @returns A promise that resolves after the provided number of milliseconds.
8
+ * @param signal An optional signal that resolves the sleep early when aborted.
9
+ * @returns A promise that resolves after the provided number of milliseconds or when aborted.
9
10
  */
10
- async function sleepAsync(ms) {
11
- await new Promise(res => setTimeout(res, ms));
11
+ async function sleepAsync(ms, signal) {
12
+ if (signal?.aborted) {
13
+ return;
14
+ }
15
+ await new Promise(resolve => {
16
+ const onAbort = () => {
17
+ clearTimeout(timeoutId);
18
+ resolve();
19
+ };
20
+ const timeoutId = setTimeout(() => {
21
+ signal?.removeEventListener('abort', onAbort);
22
+ resolve();
23
+ }, ms);
24
+ signal?.addEventListener('abort', onAbort, { once: true });
25
+ });
12
26
  }
@@ -0,0 +1 @@
1
+ export declare function sanitizeTerminalText(value: string): string;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sanitizeTerminalText = sanitizeTerminalText;
4
+ /**
5
+ * Sanitize externally-influenced text for printing as a single-line field value. Escape
6
+ * sequences in a crafted value could clear the screen or spoof output, and embedded newlines
7
+ * could fake extra output lines, so control characters are stripped and whitespace runs
8
+ * collapse to one space.
9
+ */
10
+ // eslint-disable-next-line no-control-regex
11
+ const CONTROL_CHARACTERS = /[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F]/g;
12
+ function sanitizeTerminalText(value) {
13
+ return value.replace(CONTROL_CHARACTERS, '').replace(/\s+/g, ' ').trim();
14
+ }
@@ -117,7 +117,7 @@ function displayOverageWarning({ tier, name, hasFreePlan, planValue, limit, over
117
117
  return;
118
118
  }
119
119
  // tier === 'over' && paid plan
120
- log_1.default.warn(chalk_1.default.bold(`You've used ${overageCount} build${overageCount === 1 ? '' : 's'} beyond your included credits this billing period (${formatCents(overageCostCents)} in overages so far).`));
120
+ log_1.default.warn(chalk_1.default.bold(`You've used ${overageCount} build${overageCount === 1 ? '' : 's'} beyond your included credits this billing period (${formatCents(overageCostCents)} in additional usage so far).`));
121
121
  log_1.default.warn('Additional builds continue at pay-as-you-go rates. ' +
122
122
  (0, log_1.link)(billingUrl, { text: 'See usage in billing.', dim: false }));
123
123
  }