eas-cli 21.7.1 → 22.0.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 (90) hide show
  1. package/README.md +258 -153
  2. package/build/build/android/prepareJob.js +1 -0
  3. package/build/build/ios/prepareJob.js +1 -0
  4. package/build/build/metadata.js +0 -1
  5. package/build/build/runBuildAndSubmit.js +1 -1
  6. package/build/build/utils/formatBuild.js +2 -2
  7. package/build/build/utils/url.js +3 -5
  8. package/build/commandUtils/context/contextUtils/getProjectIdAsync.js +10 -3
  9. package/build/commandUtils/new/configs.js +1 -1
  10. package/build/commandUtils/supabase.d.ts +13 -0
  11. package/build/commandUtils/supabase.js +82 -0
  12. package/build/commands/account/view.js +1 -2
  13. package/build/commands/build/cancel.js +3 -3
  14. package/build/commands/build/download.js +1 -1
  15. package/build/commands/go.js +2 -45
  16. package/build/commands/integrations/supabase/connect.d.ts +26 -0
  17. package/build/commands/integrations/supabase/connect.js +404 -0
  18. package/build/commands/integrations/supabase/dashboard.d.ts +14 -0
  19. package/build/commands/integrations/supabase/dashboard.js +69 -0
  20. package/build/commands/integrations/supabase/disconnect.d.ts +15 -0
  21. package/build/commands/integrations/supabase/disconnect.js +87 -0
  22. package/build/commands/project/icon/set.js +4 -40
  23. package/build/commands/project/init.d.ts +1 -0
  24. package/build/commands/project/init.js +13 -0
  25. package/build/commands/submit.d.ts +1 -0
  26. package/build/commands/submit.js +8 -1
  27. package/build/commands/update/index.js +1 -1
  28. package/build/commands/update/revert-update-rollout.js +1 -1
  29. package/build/commands/update/rollback.js +1 -1
  30. package/build/credentials/ios/api/graphql/queries/AppleDeviceQuery.js +20 -13
  31. package/build/credentials/ios/api/graphql/queries/AppleTeamQuery.d.ts +14 -2
  32. package/build/credentials/ios/api/graphql/queries/AppleTeamQuery.js +47 -7
  33. package/build/credentials/ios/appstore/ensureTestFlightGroup.d.ts +3 -1
  34. package/build/credentials/ios/appstore/ensureTestFlightGroup.js +14 -11
  35. package/build/environments/defaults.d.ts +2 -0
  36. package/build/environments/defaults.js +5 -0
  37. package/build/environments/resolve.d.ts +10 -0
  38. package/build/environments/resolve.js +67 -0
  39. package/build/environments/variables.d.ts +18 -0
  40. package/build/environments/variables.js +124 -0
  41. package/build/graphql/client.d.ts +8 -0
  42. package/build/graphql/client.js +15 -0
  43. package/build/graphql/generated.d.ts +824 -948
  44. package/build/graphql/generated.js +12 -2
  45. package/build/graphql/mutations/SupabaseMutation.d.ts +14 -0
  46. package/build/graphql/mutations/SupabaseMutation.js +145 -0
  47. package/build/graphql/queries/ChannelInsightsQuery.js +4 -1
  48. package/build/graphql/queries/SupabaseQuery.d.ts +10 -0
  49. package/build/graphql/queries/SupabaseQuery.js +54 -0
  50. package/build/graphql/types/Account.js +1 -4
  51. package/build/graphql/types/Build.js +13 -8
  52. package/build/graphql/types/Submission.js +0 -1
  53. package/build/graphql/types/SupabaseConnection.d.ts +8 -0
  54. package/build/graphql/types/SupabaseConnection.js +25 -0
  55. package/build/graphql/types/Update.js +4 -1
  56. package/build/integrations/shared/envFile.d.ts +7 -0
  57. package/build/integrations/shared/envFile.js +94 -0
  58. package/build/integrations/shared/sdk.d.ts +24 -0
  59. package/build/integrations/shared/sdk.js +87 -0
  60. package/build/integrations/supabase/env.d.ts +14 -0
  61. package/build/integrations/supabase/env.js +68 -0
  62. package/build/integrations/supabase/provision.d.ts +32 -0
  63. package/build/integrations/supabase/provision.js +245 -0
  64. package/build/project/accountSelection.js +1 -3
  65. package/build/project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync.js +3 -5
  66. package/build/project/projectIcon.d.ts +40 -0
  67. package/build/project/projectIcon.js +132 -0
  68. package/build/project/projectNotConfiguredError.d.ts +17 -0
  69. package/build/project/projectNotConfiguredError.js +24 -0
  70. package/build/submit/ArchiveSource.js +3 -3
  71. package/build/submit/context.d.ts +2 -0
  72. package/build/submit/context.js +1 -0
  73. package/build/submit/ios/AppProduce.js +1 -1
  74. package/build/submit/ios/IosSubmitCommand.js +2 -0
  75. package/build/submit/ios/ensureTestFlightSetup.d.ts +7 -0
  76. package/build/submit/ios/ensureTestFlightSetup.js +81 -0
  77. package/build/submit/status.js +1 -1
  78. package/build/submit/utils/formatSubmission.js +2 -2
  79. package/build/update/queries.js +1 -1
  80. package/build/update/republish.js +3 -3
  81. package/build/update/roll-back-to-embedded.js +1 -1
  82. package/build/update/utils.d.ts +2 -1
  83. package/build/update/utils.js +7 -7
  84. package/build/user/User.js +1 -1
  85. package/build/utils/pollForBackgroundJobReceiptAsync.d.ts +2 -0
  86. package/build/utils/pollForBackgroundJobReceiptAsync.js +11 -2
  87. package/build/utils/prompts.d.ts +0 -1
  88. package/build/utils/prompts.js +6 -17
  89. package/oclif.manifest.json +1725 -1411
  90. package/package.json +6 -6
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EAS_SUPABASE_ENVIRONMENTS = exports.SUPABASE_ENV_LABEL = exports.EAS_SUPABASE_PUBLISHABLE_KEY_ENV_VAR_NAME = exports.EAS_SUPABASE_URL_ENV_VAR_NAME = void 0;
4
+ exports.supabaseMoveConfirmMessage = supabaseMoveConfirmMessage;
5
+ exports.supabaseEnvironmentCancelMessage = supabaseEnvironmentCancelMessage;
6
+ exports.createSupabaseEnvVars = createSupabaseEnvVars;
7
+ exports.confirmOverwriteForAdditionalProjectAsync = confirmOverwriteForAdditionalProjectAsync;
8
+ const environment_1 = require("../../build/utils/environment");
9
+ const variables_1 = require("../../environments/variables");
10
+ const generated_1 = require("../../graphql/generated");
11
+ const prompts_1 = require("../../prompts");
12
+ exports.EAS_SUPABASE_URL_ENV_VAR_NAME = 'EXPO_PUBLIC_SUPABASE_URL';
13
+ exports.EAS_SUPABASE_PUBLISHABLE_KEY_ENV_VAR_NAME = 'EXPO_PUBLIC_SUPABASE_PUBLISHABLE_KEY';
14
+ /** Label passed into shared env helpers for prompts and log lines. */
15
+ exports.SUPABASE_ENV_LABEL = 'Supabase';
16
+ // Production-first, matching the PostHog and Convex integrations.
17
+ exports.EAS_SUPABASE_ENVIRONMENTS = [
18
+ environment_1.DefaultEnvironment.Production,
19
+ environment_1.DefaultEnvironment.Preview,
20
+ environment_1.DefaultEnvironment.Development,
21
+ ];
22
+ function supabaseMoveConfirmMessage(variableName, overlappingEnvironments) {
23
+ return `Move ${variableName} for ${overlappingEnvironments} to the additional Supabase project?`;
24
+ }
25
+ function supabaseEnvironmentCancelMessage(knownEnvironments) {
26
+ return `Canceled. No additional Supabase project was provisioned. Create the environment(s) first, or pass only existing ones (known: ${knownEnvironments}).`;
27
+ }
28
+ function createSupabaseEnvVars(url, publishableKey) {
29
+ return [
30
+ {
31
+ name: exports.EAS_SUPABASE_URL_ENV_VAR_NAME,
32
+ value: url,
33
+ visibility: generated_1.EnvironmentVariableVisibility.Public,
34
+ },
35
+ {
36
+ name: exports.EAS_SUPABASE_PUBLISHABLE_KEY_ENV_VAR_NAME,
37
+ value: publishableKey,
38
+ visibility: generated_1.EnvironmentVariableVisibility.Public,
39
+ },
40
+ ];
41
+ }
42
+ async function confirmOverwriteForAdditionalProjectAsync(graphqlClient, projectId, environments, nonInteractive, overwrite) {
43
+ if (overwrite) {
44
+ return { forceOverwrite: true };
45
+ }
46
+ const names = [exports.EAS_SUPABASE_URL_ENV_VAR_NAME, exports.EAS_SUPABASE_PUBLISHABLE_KEY_ENV_VAR_NAME];
47
+ const targetSet = new Set(environments);
48
+ for (const name of names) {
49
+ const existingVariables = await (0, variables_1.loadProjectScopedEnvVarsAsync)(graphqlClient, projectId, name);
50
+ const hasOverlap = existingVariables.some(variable => (variable.environments ?? []).some(environment => targetSet.has(environment)));
51
+ if (!hasOverlap) {
52
+ continue;
53
+ }
54
+ if (nonInteractive) {
55
+ throw new Error(`EAS already has ${name} for ${environments.join(', ')}. Re-run with --overwrite to replace it before provisioning an additional project.`);
56
+ }
57
+ const proceed = await (0, prompts_1.confirmAsync)({
58
+ message: `EAS already has ${name} covering ${environments.join(', ')}. Continue and move those values to the additional Supabase project?`,
59
+ });
60
+ if (!proceed) {
61
+ throw new Error(`Canceled. No additional Supabase project was provisioned. Pass --overwrite to replace ${name} for ${environments.join(', ')}, or leave those environments on the primary project.`);
62
+ }
63
+ // One confirm covers both vars; stop asking. Force overwrite so the per-var upsert
64
+ // doesn't prompt again and can't return false after we already billed the project.
65
+ return { forceOverwrite: true };
66
+ }
67
+ return { forceOverwrite: false };
68
+ }
@@ -0,0 +1,32 @@
1
+ import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
2
+ import { BackgroundJobReceiptDataFragment } from '../../graphql/generated';
3
+ import { SupabaseConnectionData, SupabaseOrganizationData, SupabaseProjectData } from '../../graphql/types/SupabaseConnection';
4
+ export declare const PROVISION_RECEIPT_MAX_CHECKS = 420;
5
+ export declare const PROVISION_RECEIPT_MAX_CONSECUTIVE_FETCH_ERRORS = 3;
6
+ export declare const SUPABASE_REGION_CHOICES: {
7
+ title: string;
8
+ value: string;
9
+ }[];
10
+ export declare function projectNameSuffixForEnvironments(environments: string[]): string;
11
+ export declare function toProvisionPollError(error: unknown, { hint }: {
12
+ hint: string;
13
+ }): Error;
14
+ /** Fast-forward guidance when additional (--environment) provision fails permanently. */
15
+ export declare function additionalProvisionFailureHint(environments: string[]): string;
16
+ /** Where to find a project for --link (primary connect path). */
17
+ export declare function primaryProvisionFailureHint(): string;
18
+ export declare function pollProvisionReceiptAsync(graphqlClient: ExpoGraphqlClient, receipt: BackgroundJobReceiptDataFragment, { startMessage, waitingMessage, failureMessage, failureHint, }: {
19
+ startMessage: string;
20
+ waitingMessage: string;
21
+ failureMessage: string;
22
+ failureHint: string;
23
+ }): Promise<BackgroundJobReceiptDataFragment>;
24
+ export declare function authorizeViaBrowserAsync(graphqlClient: ExpoGraphqlClient, account: {
25
+ id: string;
26
+ name: string;
27
+ }, nonInteractive: boolean): Promise<SupabaseConnectionData>;
28
+ export declare function loadOrganizationsBestEffortAsync(graphqlClient: ExpoGraphqlClient, accountId: string): Promise<SupabaseOrganizationData[] | null>;
29
+ export declare function pollForConnectionAsync(graphqlClient: ExpoGraphqlClient, accountId: string): Promise<SupabaseConnectionData>;
30
+ export declare function resolvePublishableKeyAsync(graphqlClient: ExpoGraphqlClient, appId: string, project: SupabaseProjectData): Promise<string>;
31
+ export declare function resolveRegionAsync(flagValue: string | undefined, nonInteractive: boolean): Promise<string>;
32
+ export declare function resolveOrganizationAsync(graphqlClient: ExpoGraphqlClient, accountId: string, connection: SupabaseConnectionData, organizationFlag: string | undefined, nonInteractive: boolean, preloadedOrganizations: SupabaseOrganizationData[] | null): Promise<SupabaseConnectionData>;
@@ -0,0 +1,245 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SUPABASE_REGION_CHOICES = exports.PROVISION_RECEIPT_MAX_CONSECUTIVE_FETCH_ERRORS = exports.PROVISION_RECEIPT_MAX_CHECKS = void 0;
4
+ exports.projectNameSuffixForEnvironments = projectNameSuffixForEnvironments;
5
+ exports.toProvisionPollError = toProvisionPollError;
6
+ exports.additionalProvisionFailureHint = additionalProvisionFailureHint;
7
+ exports.primaryProvisionFailureHint = primaryProvisionFailureHint;
8
+ exports.pollProvisionReceiptAsync = pollProvisionReceiptAsync;
9
+ exports.authorizeViaBrowserAsync = authorizeViaBrowserAsync;
10
+ exports.loadOrganizationsBestEffortAsync = loadOrganizationsBestEffortAsync;
11
+ exports.pollForConnectionAsync = pollForConnectionAsync;
12
+ exports.resolvePublishableKeyAsync = resolvePublishableKeyAsync;
13
+ exports.resolveRegionAsync = resolveRegionAsync;
14
+ exports.resolveOrganizationAsync = resolveOrganizationAsync;
15
+ const tslib_1 = require("tslib");
16
+ const better_opn_1 = tslib_1.__importDefault(require("better-opn"));
17
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
18
+ const supabase_1 = require("../../commandUtils/supabase");
19
+ const client_1 = require("../../graphql/client");
20
+ const SupabaseMutation_1 = require("../../graphql/mutations/SupabaseMutation");
21
+ const SupabaseQuery_1 = require("../../graphql/queries/SupabaseQuery");
22
+ const log_1 = tslib_1.__importStar(require("../../log"));
23
+ const ora_1 = require("../../ora");
24
+ const prompts_1 = require("../../prompts");
25
+ const promise_1 = require("../../utils/promise");
26
+ const pollForBackgroundJobReceiptAsync_1 = require("../../utils/pollForBackgroundJobReceiptAsync");
27
+ // The server holds the pending OAuth row for 15 minutes; match that so we don't time out on an
28
+ // approval the user completes within the window.
29
+ const CONNECTION_POLL_INTERVAL_MS = 2_000;
30
+ const CONNECTION_POLL_TIMEOUT_MS = 15 * 60 * 1_000;
31
+ const MAX_CONSECUTIVE_CONNECTION_ERRORS = 10;
32
+ // A freshly provisioned project takes a minute or two to become healthy; the publishable key only
33
+ // resolves once it is.
34
+ const READINESS_POLL_INTERVAL_MS = 3_000;
35
+ const READINESS_POLL_TIMEOUT_MS = 5 * 60 * 1_000;
36
+ // A server fault is worth retrying, but not for the full timeout: once it repeats this many
37
+ // times it isn't a provisioning delay, and the user shouldn't wait five minutes to hear it.
38
+ const MAX_CONSECUTIVE_READINESS_ERRORS = 10;
39
+ // Background job create + publishable-key polling can take 5+ minutes; allow 7 min at 1s interval.
40
+ exports.PROVISION_RECEIPT_MAX_CHECKS = 420;
41
+ exports.PROVISION_RECEIPT_MAX_CONSECUTIVE_FETCH_ERRORS = 3;
42
+ exports.SUPABASE_REGION_CHOICES = [
43
+ { title: 'Americas (US)', value: 'americas' },
44
+ { title: 'Europe / Middle East / Africa', value: 'emea' },
45
+ { title: 'Asia Pacific', value: 'apac' },
46
+ ];
47
+ function projectNameSuffixForEnvironments(environments) {
48
+ return [...environments]
49
+ .sort()
50
+ .join('-')
51
+ .replace(/[^a-zA-Z0-9._-]+/g, '-')
52
+ .slice(0, 32);
53
+ }
54
+ function toProvisionPollError(error, { hint }) {
55
+ if (!(error instanceof pollForBackgroundJobReceiptAsync_1.BackgroundJobReceiptPollError)) {
56
+ return error instanceof Error ? error : new Error(String(error));
57
+ }
58
+ const trimmedHint = hint.trim();
59
+ const join = (message) => trimmedHint ? `${message.trimEnd()}\n\n${trimmedHint}` : message;
60
+ if (error.errorData.errorType === pollForBackgroundJobReceiptAsync_1.BackgroundJobReceiptPollErrorType.JOB_FAILED_NO_WILL_RETRY) {
61
+ return new Error(join(error.errorData.receiptErrorMessage ?? error.message));
62
+ }
63
+ if (error.errorData.errorType === pollForBackgroundJobReceiptAsync_1.BackgroundJobReceiptPollErrorType.TIMEOUT ||
64
+ error.errorData.errorType === pollForBackgroundJobReceiptAsync_1.BackgroundJobReceiptPollErrorType.NULL_RECEIPT) {
65
+ return new Error(join('Timed out or lost contact while waiting for Supabase project provision.'));
66
+ }
67
+ return error;
68
+ }
69
+ /** Fast-forward guidance when additional (--environment) provision fails permanently. */
70
+ function additionalProvisionFailureHint(environments) {
71
+ return [
72
+ 'Free a slot on your Supabase plan (delete, pause, or upgrade a project), then re-run:',
73
+ ` eas integrations:supabase:connect --environment ${environments.join(',')}`,
74
+ 'Or set EXPO_PUBLIC_SUPABASE_URL and EXPO_PUBLIC_SUPABASE_PUBLISHABLE_KEY on those EAS environments to an existing Supabase project.',
75
+ ].join('\n');
76
+ }
77
+ /** Where to find a project for --link (primary connect path). */
78
+ function primaryProvisionFailureHint() {
79
+ return [
80
+ 'If a project already exists in your Supabase dashboard, link it instead of provisioning:',
81
+ ' eas integrations:supabase:connect --link <project-url>',
82
+ ].join('\n');
83
+ }
84
+ async function pollProvisionReceiptAsync(graphqlClient, receipt, { startMessage, waitingMessage, failureMessage, failureHint, }) {
85
+ const spinner = (0, ora_1.ora)(startMessage).start();
86
+ try {
87
+ spinner.text = waitingMessage;
88
+ const finalized = await (0, pollForBackgroundJobReceiptAsync_1.pollForBackgroundJobReceiptAsync)(graphqlClient, receipt, {
89
+ maxChecks: exports.PROVISION_RECEIPT_MAX_CHECKS,
90
+ maxConsecutiveFetchErrors: exports.PROVISION_RECEIPT_MAX_CONSECUTIVE_FETCH_ERRORS,
91
+ });
92
+ if (!finalized) {
93
+ throw new Error('Supabase project provision finished without a receipt.');
94
+ }
95
+ // Stopped, not succeeded: the caller resolves what was provisioned and owns that message.
96
+ spinner.stop();
97
+ return finalized;
98
+ }
99
+ catch (error) {
100
+ spinner.fail(failureMessage);
101
+ throw toProvisionPollError(error, { hint: failureHint });
102
+ }
103
+ }
104
+ async function authorizeViaBrowserAsync(graphqlClient, account, nonInteractive) {
105
+ if (nonInteractive) {
106
+ throw new Error(`Connecting Supabase requires approving access in a browser, which isn't possible in non-interactive mode. Re-run \`eas integrations:supabase:connect\` interactively.`);
107
+ }
108
+ const { url } = await SupabaseMutation_1.SupabaseMutation.beginSupabaseOAuthAsync(graphqlClient, {
109
+ accountId: account.id,
110
+ });
111
+ log_1.default.addNewLineIfNone();
112
+ log_1.default.log(`Authorize Expo to access your Supabase account in the browser. You'll need an existing Supabase account.`);
113
+ log_1.default.log(`If your browser doesn't open automatically, authorize at this link: ${(0, log_1.link)(url)}`);
114
+ void (0, better_opn_1.default)(url).catch(() => false);
115
+ const spinner = (0, ora_1.ora)('Waiting for you to authorize in Supabase (up to 15 minutes; press Ctrl-C to cancel)').start();
116
+ try {
117
+ const connection = await pollForConnectionAsync(graphqlClient, account.id);
118
+ const organizations = await loadOrganizationsBestEffortAsync(graphqlClient, account.id);
119
+ spinner.succeed(`Connected Supabase organization ${chalk_1.default.bold((0, supabase_1.formatSupabaseOrganization)(connection, organizations ?? undefined))}`);
120
+ return connection;
121
+ }
122
+ catch (error) {
123
+ spinner.fail("Couldn't confirm the Supabase connection");
124
+ throw error;
125
+ }
126
+ }
127
+ async function loadOrganizationsBestEffortAsync(graphqlClient, accountId) {
128
+ try {
129
+ return await SupabaseMutation_1.SupabaseMutation.listSupabaseOrganizationsAsync(graphqlClient, accountId);
130
+ }
131
+ catch {
132
+ return null;
133
+ }
134
+ }
135
+ async function pollForConnectionAsync(graphqlClient, accountId) {
136
+ const deadline = Date.now() + CONNECTION_POLL_TIMEOUT_MS;
137
+ let consecutiveErrors = 0;
138
+ for (;;) {
139
+ let connection = null;
140
+ try {
141
+ connection = await SupabaseQuery_1.SupabaseQuery.getSupabaseConnectionByAccountIdAsync(graphqlClient, accountId, { useCache: false });
142
+ consecutiveErrors = 0;
143
+ }
144
+ catch (error) {
145
+ consecutiveErrors += 1;
146
+ log_1.default.debug(`Polling for the Supabase connection failed: ${error}`);
147
+ if ((0, client_1.isPermanentGraphqlError)(error) ||
148
+ consecutiveErrors >= MAX_CONSECUTIVE_CONNECTION_ERRORS) {
149
+ log_1.default.error('Gave up checking whether the Supabase authorization finished. Fix the error below, then re-run `eas integrations:supabase:connect` — an authorization you already approved is still picked up.');
150
+ throw error;
151
+ }
152
+ }
153
+ if (connection) {
154
+ return connection;
155
+ }
156
+ if (Date.now() >= deadline) {
157
+ throw new Error('Timed out waiting for the Supabase connection. If you authorized it in your browser, re-run `eas integrations:supabase:connect` — it will pick up the connection.');
158
+ }
159
+ await (0, promise_1.sleepAsync)(CONNECTION_POLL_INTERVAL_MS);
160
+ }
161
+ }
162
+ async function resolvePublishableKeyAsync(graphqlClient, appId, project) {
163
+ const spinner = (0, ora_1.ora)('Waiting for the Supabase project to finish provisioning').start();
164
+ const deadline = Date.now() + READINESS_POLL_TIMEOUT_MS;
165
+ // The server returns a null key while the project is still provisioning, and throws for a real
166
+ // problem. A rejected request can't succeed on a retry; a server fault might, but not forever.
167
+ let consecutiveErrors = 0;
168
+ for (;;) {
169
+ let key = null;
170
+ try {
171
+ key = await SupabaseMutation_1.SupabaseMutation.fetchSupabasePublishableKeyAsync(graphqlClient, appId);
172
+ consecutiveErrors = 0;
173
+ }
174
+ catch (error) {
175
+ consecutiveErrors += 1;
176
+ log_1.default.debug(`Polling for the Supabase project readiness failed: ${error}`);
177
+ if ((0, client_1.isPermanentGraphqlError)(error) || consecutiveErrors >= MAX_CONSECUTIVE_READINESS_ERRORS) {
178
+ spinner.fail("Couldn't reach the Supabase project");
179
+ log_1.default.error(`The project may exist even though EAS can't read its key. Check it at ${(0, supabase_1.getSupabaseProjectDashboardUrl)(project)} before you re-run \`eas integrations:supabase:connect\`.`);
180
+ throw error;
181
+ }
182
+ }
183
+ if (key) {
184
+ spinner.succeed('Supabase project is ready');
185
+ return key;
186
+ }
187
+ if (Date.now() >= deadline) {
188
+ spinner.fail('Supabase project did not finish provisioning in time');
189
+ throw new Error(`The Supabase project is still provisioning. Once it's healthy (check ${(0, supabase_1.getSupabaseProjectDashboardUrl)(project)}), re-run \`eas integrations:supabase:connect\` to finish writing the environment variables.`);
190
+ }
191
+ await (0, promise_1.sleepAsync)(READINESS_POLL_INTERVAL_MS);
192
+ }
193
+ }
194
+ async function resolveRegionAsync(flagValue, nonInteractive) {
195
+ if (flagValue !== undefined) {
196
+ // The server accepts both the smart-group values (americas | emea | apac) and raw region
197
+ // codes (e.g. us-east-1), so any non-empty value passes through.
198
+ const region = flagValue.trim();
199
+ if (!region) {
200
+ throw new Error('Pass a Supabase region to --region (americas, emea, apac, or a raw code like us-east-1).');
201
+ }
202
+ return region;
203
+ }
204
+ if (nonInteractive) {
205
+ throw new Error('A Supabase region is required in non-interactive mode. Pass --region (americas, emea, or apac). The region is permanent once the project is created.');
206
+ }
207
+ return await (0, prompts_1.selectAsync)('Select a Supabase region (permanent once the project is created)', exports.SUPABASE_REGION_CHOICES);
208
+ }
209
+ async function resolveOrganizationAsync(graphqlClient, accountId, connection, organizationFlag, nonInteractive, preloadedOrganizations) {
210
+ if (organizationFlag) {
211
+ if (organizationFlag === connection.supabaseOrganizationSlug) {
212
+ return connection;
213
+ }
214
+ const organizations = preloadedOrganizations ??
215
+ (await SupabaseMutation_1.SupabaseMutation.listSupabaseOrganizationsAsync(graphqlClient, accountId));
216
+ if (!organizations.some(organization => organization.slug === organizationFlag)) {
217
+ throw new Error(`Supabase organization ${chalk_1.default.bold(organizationFlag)} isn't one of your connected organizations (${organizations
218
+ .map(organization => organization.slug)
219
+ .join(', ')}).`);
220
+ }
221
+ return await SupabaseMutation_1.SupabaseMutation.setSupabaseConnectionOrganizationAsync(graphqlClient, {
222
+ supabaseConnectionId: connection.id,
223
+ organizationSlug: organizationFlag,
224
+ });
225
+ }
226
+ if (nonInteractive) {
227
+ return connection;
228
+ }
229
+ const organizations = preloadedOrganizations ??
230
+ (await SupabaseMutation_1.SupabaseMutation.listSupabaseOrganizationsAsync(graphqlClient, accountId));
231
+ if (organizations.length <= 1) {
232
+ return connection;
233
+ }
234
+ const chosen = await (0, prompts_1.selectAsync)('Select the Supabase organization to use', organizations.map(organization => ({
235
+ title: `${organization.name} (${organization.slug})`,
236
+ value: organization.slug,
237
+ })));
238
+ if (chosen === connection.supabaseOrganizationSlug) {
239
+ return connection;
240
+ }
241
+ return await SupabaseMutation_1.SupabaseMutation.setSupabaseConnectionOrganizationAsync(graphqlClient, {
242
+ supabaseConnectionId: connection.id,
243
+ organizationSlug: chosen,
244
+ });
245
+ }
@@ -4,9 +4,7 @@ exports.getAccountNamesWhereUserHasSufficientPermissionsToCreateApp = getAccount
4
4
  exports.getAccountChoices = getAccountChoices;
5
5
  const generated_1 = require("../graphql/generated");
6
6
  function getAccountNamesWhereUserHasSufficientPermissionsToCreateApp(actor) {
7
- return new Set(actor.accounts
8
- .filter(a => a.users.find(it => it.actor.id === actor.id)?.role !== generated_1.Role.ViewOnly)
9
- .map(it => it.name));
7
+ return new Set(actor.accounts.filter(a => a.viewerUserPermission.role !== generated_1.Role.ViewOnly).map(it => it.name));
10
8
  }
11
9
  function getAccountChoices(actor, namesWithSufficientPermissions) {
12
10
  const allAccounts = actor.accounts;
@@ -4,6 +4,7 @@ exports.fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync = fetchOrCre
4
4
  exports.findProjectIdByAccountNameAndSlugNullableAsync = findProjectIdByAccountNameAndSlugNullableAsync;
5
5
  const tslib_1 = require("tslib");
6
6
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
+ const projectNotConfiguredError_1 = require("./projectNotConfiguredError");
7
8
  const url_1 = require("../build/utils/url");
8
9
  const generated_1 = require("../graphql/generated");
9
10
  const AppMutation_1 = require("../graphql/mutations/AppMutation");
@@ -11,7 +12,6 @@ const AppQuery_1 = require("../graphql/queries/AppQuery");
11
12
  const log_1 = require("../log");
12
13
  const ora_1 = require("../ora");
13
14
  const prompts_1 = require("../prompts");
14
- const User_1 = require("../user/User");
15
15
  /**
16
16
  * 1. Looks for an existing project on EAS servers. If found, ask the user whether this is the
17
17
  * project they would like to link. If yes, return that. If not, throw.
@@ -22,11 +22,9 @@ async function fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync(graph
22
22
  const { accountName, projectName } = projectInfo;
23
23
  const projectFullName = `@${accountName}/${projectName}`;
24
24
  const allAccounts = actor.accounts;
25
- const accountNamesWhereUserHasSufficientPublishPermissions = new Set(allAccounts
26
- .filter(a => a.users.find(it => it.actor.id === actor.id)?.role !== generated_1.Role.ViewOnly)
27
- .map(it => it.name));
25
+ const accountNamesWhereUserHasSufficientPublishPermissions = new Set(allAccounts.filter(a => a.viewerUserPermission.role !== generated_1.Role.ViewOnly).map(it => it.name));
28
26
  if (options.nonInteractive) {
29
- throw new Error(`EAS project not configured. To configure it non-interactively, choose the account that should own the project and run:\n\n eas init --account <name> --non-interactive\n\nAccounts you have permissions to create projects in: ${(0, User_1.getCreatableAccountNames)(actor).join(', ')}\n\nAlternatively, set the "owner" field in your app config, or run "eas init" to configure it interactively.`);
27
+ throw (0, projectNotConfiguredError_1.getUnconfiguredProjectError)({ actor, accountName });
30
28
  }
31
29
  const account = allAccounts.find(a => a.name === accountName);
32
30
  if (!account) {
@@ -0,0 +1,40 @@
1
+ import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
2
+ /** An icon found in the app config, with the field it came from for display purposes. */
3
+ export interface AppConfigIcon {
4
+ field: string;
5
+ path: string;
6
+ }
7
+ export type SetProjectIconFromAppConfigResult = {
8
+ status: 'set';
9
+ icon: AppConfigIcon;
10
+ } | {
11
+ status: 'skipped';
12
+ reason: 'no-icon-in-app-config' | 'icon-already-set' | 'invalid-icon' | 'upload-failed';
13
+ };
14
+ /**
15
+ * Set the project icon from the app config, but only when the project does not have one yet.
16
+ * Overwriting an icon picked on the dashboard would be surprising, and the app config is not the
17
+ * source of truth for it.
18
+ *
19
+ * Never throws. The project is already created or linked by the time this runs, so a failed icon
20
+ * upload must not fail the command that called it.
21
+ */
22
+ export declare function maybeSetProjectIconFromAppConfigAsync(graphqlClient: ExpoGraphqlClient, { projectId, projectDir }: {
23
+ projectId: string;
24
+ projectDir: string;
25
+ }): Promise<SetProjectIconFromAppConfigResult>;
26
+ /**
27
+ * Find the app icon on disk. Falls through to the platform-specific icons so that a project that
28
+ * only sets `ios.icon` or an Android adaptive icon still gets one.
29
+ */
30
+ export declare function resolveAppConfigIconAsync(projectDir: string): Promise<AppConfigIcon | null>;
31
+ export declare function validateIconAsync(imagePath: string): Promise<void>;
32
+ export declare function uploadProjectIconAsync(graphqlClient: ExpoGraphqlClient, { projectId, imagePath }: {
33
+ projectId: string;
34
+ imagePath: string;
35
+ }): Promise<void>;
36
+ export declare function pollForProfileImageChangeAsync(graphqlClient: ExpoGraphqlClient, { projectId, previousProfileImageUrl, projectDashboardUrl, }: {
37
+ projectId: string;
38
+ previousProfileImageUrl: string | null;
39
+ projectDashboardUrl: string;
40
+ }): Promise<void>;
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.maybeSetProjectIconFromAppConfigAsync = maybeSetProjectIconFromAppConfigAsync;
4
+ exports.resolveAppConfigIconAsync = resolveAppConfigIconAsync;
5
+ exports.validateIconAsync = validateIconAsync;
6
+ exports.uploadProjectIconAsync = uploadProjectIconAsync;
7
+ exports.pollForProfileImageChangeAsync = pollForProfileImageChangeAsync;
8
+ const tslib_1 = require("tslib");
9
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
10
+ const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
11
+ const path_1 = tslib_1.__importDefault(require("path"));
12
+ const expoConfig_1 = require("./expoConfig");
13
+ const generated_1 = require("../graphql/generated");
14
+ const AppQuery_1 = require("../graphql/queries/AppQuery");
15
+ const log_1 = tslib_1.__importDefault(require("../log"));
16
+ const uploads_1 = require("../uploads");
17
+ const promise_1 = require("../utils/promise");
18
+ const ALLOWED_EXTENSIONS = ['.png', '.jpg', '.jpeg'];
19
+ const MAX_IMAGE_SIZE_BYTES = 10 * 1024 * 1024; // matches the upload session's GCS limit
20
+ const POLL_INTERVAL_MS = 2000;
21
+ const POLL_TIMEOUT_MS = 90_000;
22
+ /**
23
+ * Set the project icon from the app config, but only when the project does not have one yet.
24
+ * Overwriting an icon picked on the dashboard would be surprising, and the app config is not the
25
+ * source of truth for it.
26
+ *
27
+ * Never throws. The project is already created or linked by the time this runs, so a failed icon
28
+ * upload must not fail the command that called it.
29
+ */
30
+ async function maybeSetProjectIconFromAppConfigAsync(graphqlClient, { projectId, projectDir }) {
31
+ const icon = await resolveAppConfigIconAsync(projectDir);
32
+ if (!icon) {
33
+ return { status: 'skipped', reason: 'no-icon-in-app-config' };
34
+ }
35
+ try {
36
+ await validateIconAsync(icon.path);
37
+ }
38
+ catch (error) {
39
+ log_1.default.warn(`Did not set the project icon from "${icon.field}": ${error.message}`);
40
+ return { status: 'skipped', reason: 'invalid-icon' };
41
+ }
42
+ const existingIconUrl = await AppQuery_1.AppQuery.byIdProfileImageUrlAsync(graphqlClient, projectId);
43
+ if (existingIconUrl) {
44
+ log_1.default.debug('The project already has an icon, skipping the icon from the app config.');
45
+ return { status: 'skipped', reason: 'icon-already-set' };
46
+ }
47
+ try {
48
+ await uploadProjectIconAsync(graphqlClient, { projectId, imagePath: icon.path });
49
+ }
50
+ catch (error) {
51
+ log_1.default.warn(`Failed to set the project icon from "${icon.field}": ${error.message}`);
52
+ return { status: 'skipped', reason: 'upload-failed' };
53
+ }
54
+ // The server resizes the image and assigns it to the project asynchronously. Callers that need
55
+ // the icon to be visible before they return should poll with pollForProfileImageChangeAsync.
56
+ log_1.default.withTick(`Set the project icon from ${chalk_1.default.bold(icon.field)} in your app config`);
57
+ return { status: 'set', icon };
58
+ }
59
+ /**
60
+ * Find the app icon on disk. Falls through to the platform-specific icons so that a project that
61
+ * only sets `ios.icon` or an Android adaptive icon still gets one.
62
+ */
63
+ async function resolveAppConfigIconAsync(projectDir) {
64
+ let exp;
65
+ try {
66
+ exp = await (0, expoConfig_1.getPrivateExpoConfigAsync)(projectDir);
67
+ }
68
+ catch (error) {
69
+ log_1.default.debug(`Could not read the app config to resolve the project icon: ${error.message}`);
70
+ return null;
71
+ }
72
+ const candidates = [
73
+ ['icon', exp.icon],
74
+ ['ios.icon', exp.ios?.icon],
75
+ ['android.adaptiveIcon.foregroundImage', exp.android?.adaptiveIcon?.foregroundImage],
76
+ ];
77
+ for (const [field, value] of candidates) {
78
+ const iconPath = resolveLocalIconPath(projectDir, value);
79
+ if (iconPath && (await fs_extra_1.default.pathExists(iconPath))) {
80
+ return { field, path: iconPath };
81
+ }
82
+ }
83
+ return null;
84
+ }
85
+ function resolveLocalIconPath(projectDir, value) {
86
+ // SDK 52 and above allow `ios.icon` to be a per-appearance map. The light icon is the one shown
87
+ // in most places, so it is the closest match for a single project icon.
88
+ let rawPath = null;
89
+ if (typeof value === 'string') {
90
+ rawPath = value;
91
+ }
92
+ else if (value && typeof value === 'object' && typeof value.light === 'string') {
93
+ rawPath = value.light;
94
+ }
95
+ // Remote icons (http://, https://, data:) are not files we can upload. The scheme must be at
96
+ // least two characters so that a Windows drive letter is still treated as a path.
97
+ if (!rawPath || /^[a-z][a-z0-9+.-]+:/i.test(rawPath)) {
98
+ return null;
99
+ }
100
+ return path_1.default.resolve(projectDir, rawPath);
101
+ }
102
+ async function validateIconAsync(imagePath) {
103
+ if (!(await fs_extra_1.default.pathExists(imagePath))) {
104
+ throw new Error(`No file found at ${imagePath}`);
105
+ }
106
+ const extension = path_1.default.extname(imagePath).toLowerCase();
107
+ if (!ALLOWED_EXTENSIONS.includes(extension)) {
108
+ throw new Error(`Unsupported image format "${extension}". The icon must be a PNG or JPEG file.`);
109
+ }
110
+ const { size } = await fs_extra_1.default.stat(imagePath);
111
+ if (size > MAX_IMAGE_SIZE_BYTES) {
112
+ throw new Error(`The image is ${(size / 1024 / 1024).toFixed(1)} MB, but the maximum allowed size is 10 MB.`);
113
+ }
114
+ }
115
+ async function uploadProjectIconAsync(graphqlClient, { projectId, imagePath }) {
116
+ await (0, uploads_1.uploadAppScopedFileAtPathToGCSAsync)(graphqlClient, {
117
+ type: generated_1.AppUploadSessionType.ProfileImageUpload,
118
+ appId: projectId,
119
+ path: imagePath,
120
+ });
121
+ }
122
+ async function pollForProfileImageChangeAsync(graphqlClient, { projectId, previousProfileImageUrl, projectDashboardUrl, }) {
123
+ const startTime = Date.now();
124
+ while (Date.now() - startTime < POLL_TIMEOUT_MS) {
125
+ await (0, promise_1.sleepAsync)(POLL_INTERVAL_MS);
126
+ const profileImageUrl = await AppQuery_1.AppQuery.byIdProfileImageUrlAsync(graphqlClient, projectId);
127
+ if (profileImageUrl && profileImageUrl !== previousProfileImageUrl) {
128
+ return;
129
+ }
130
+ }
131
+ throw new Error(`Timed out waiting for the icon to be processed. It may still appear on the project page shortly: ${chalk_1.default.underline(projectDashboardUrl)}`);
132
+ }
@@ -0,0 +1,17 @@
1
+ import { Actor } from '../user/User';
2
+ /**
3
+ * Build the error shown when an EAS project is not configured and the CLI cannot configure it
4
+ * without more input. Lists the exact commands to run, because bare "eas init" also needs
5
+ * interaction and fails in the same situation.
6
+ *
7
+ * @param actor the logged-in actor
8
+ * @param accountName the account that should own the project, when it is already known
9
+ * @param reason why the CLI cannot configure the project here
10
+ * @param additionalFix an extra way to resolve the error, appended at the end
11
+ */
12
+ export declare function getUnconfiguredProjectError({ actor, accountName, reason, additionalFix, }: {
13
+ actor: Actor;
14
+ accountName?: string;
15
+ reason?: string;
16
+ additionalFix?: string;
17
+ }): Error;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getUnconfiguredProjectError = getUnconfiguredProjectError;
4
+ const User_1 = require("../user/User");
5
+ /**
6
+ * Build the error shown when an EAS project is not configured and the CLI cannot configure it
7
+ * without more input. Lists the exact commands to run, because bare "eas init" also needs
8
+ * interaction and fails in the same situation.
9
+ *
10
+ * @param actor the logged-in actor
11
+ * @param accountName the account that should own the project, when it is already known
12
+ * @param reason why the CLI cannot configure the project here
13
+ * @param additionalFix an extra way to resolve the error, appended at the end
14
+ */
15
+ function getUnconfiguredProjectError({ actor, accountName, reason = 'This command cannot configure it in non-interactive mode.', additionalFix, }) {
16
+ return new Error(`EAS project not configured. ${reason} ` +
17
+ `Run one of the following, then re-run this command:\n\n` +
18
+ `To link an existing project:\n\n` +
19
+ ` eas init --id <project-id> --non-interactive\n\n` +
20
+ `To create a new project:\n\n` +
21
+ ` eas init --account ${accountName ?? '<account-name>'} --non-interactive\n\n` +
22
+ `Accounts you can create projects in: ${(0, User_1.getCreatableAccountNames)(actor).join(', ')}` +
23
+ (additionalFix ? `\n\n${additionalFix}` : ''));
24
+ }
@@ -211,7 +211,7 @@ async function handleBuildListSourceAsync(ctx) {
211
211
  }
212
212
  }
213
213
  function formatBuildChoice(build) {
214
- const { id, updatedAt, runtimeVersion, buildProfile, gitCommitHash, gitCommitMessage, channel, message, status, } = build;
214
+ const { id, updatedAt, runtime, buildProfile, gitCommitHash, gitCommitMessage, updateChannel, message, status, } = build;
215
215
  const buildDate = new Date(updatedAt);
216
216
  const splitCommitMessage = gitCommitMessage?.split('\n');
217
217
  const formattedCommitData = gitCommitHash && splitCommitMessage && splitCommitMessage.length > 0
@@ -220,8 +220,8 @@ function formatBuildChoice(build) {
220
220
  const title = `${chalk_1.default.bold(`ID:`)} ${id} (${chalk_1.default.bold(`${(0, date_1.fromNow)(buildDate)} ago`)})`;
221
221
  const descriptionItems = [
222
222
  { name: 'Profile', value: buildProfile ? chalk_1.default.bold(buildProfile) : null },
223
- { name: 'Channel', value: channel ? chalk_1.default.bold(channel) : null },
224
- { name: 'Runtime version', value: runtimeVersion ? chalk_1.default.bold(runtimeVersion) : null },
223
+ { name: 'Channel', value: updateChannel ? chalk_1.default.bold(updateChannel.name) : null },
224
+ { name: 'Runtime version', value: runtime ? chalk_1.default.bold(runtime.version) : null },
225
225
  { name: 'Commit', value: formattedCommitData },
226
226
  {
227
227
  name: 'Message',
@@ -13,6 +13,7 @@ export interface SubmissionContext<T extends Platform> {
13
13
  analyticsEventProperties: AnalyticsEventProperties;
14
14
  exp: ExpoConfig;
15
15
  nonInteractive: boolean;
16
+ autoTestFlightSetup: boolean;
16
17
  isVerboseFastlaneEnabled: boolean;
17
18
  groups: T extends Platform.IOS ? string[] : undefined;
18
19
  platform: T;
@@ -39,6 +40,7 @@ export declare function createSubmissionContextAsync<T extends Platform>(params:
39
40
  credentialsCtx?: CredentialsContext;
40
41
  env?: Env;
41
42
  nonInteractive: boolean;
43
+ autoTestFlightSetup?: boolean;
42
44
  isVerboseFastlaneEnabled: boolean;
43
45
  groups: string[] | undefined;
44
46
  platform: T;
@@ -42,6 +42,7 @@ async function createSubmissionContextAsync(params) {
42
42
  rest.analytics.logEvent(AnalyticsManager_1.SubmissionEvent.SUBMIT_COMMAND, analyticsEventProperties);
43
43
  return {
44
44
  ...rest,
45
+ autoTestFlightSetup: params.autoTestFlightSetup ?? true,
45
46
  accountName: account.name,
46
47
  credentialsCtx,
47
48
  groups,