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
@@ -55,7 +55,7 @@ async function createAppStoreConnectAppAsync(ctx, options) {
55
55
  sku,
56
56
  });
57
57
  try {
58
- await (0, ensureTestFlightGroup_1.ensureTestFlightGroupExistsAsync)(app);
58
+ await (0, ensureTestFlightGroup_1.ensureTestFlightGroupExistsAsync)(app, { nonInteractive: ctx.nonInteractive });
59
59
  }
60
60
  catch (error) {
61
61
  // This process is not critical to the app submission so we shouldn't let it fail the entire process.
@@ -10,6 +10,7 @@ const AppProduce_1 = require("./AppProduce");
10
10
  const AppSpecificPasswordSource_1 = require("./AppSpecificPasswordSource");
11
11
  const AscApiKeySource_1 = require("./AscApiKeySource");
12
12
  const IosSubmitter_1 = tslib_1.__importDefault(require("./IosSubmitter"));
13
+ const ensureTestFlightSetup_1 = require("./ensureTestFlightSetup");
13
14
  const errors_1 = require("../../credentials/errors");
14
15
  const log_1 = tslib_1.__importStar(require("../../log"));
15
16
  const ArchiveSource_1 = require("../ArchiveSource");
@@ -135,6 +136,7 @@ class IosSubmitCommand {
135
136
  async resolveAscAppIdentifierAsync() {
136
137
  const { ascAppId } = this.ctx.profile;
137
138
  if (ascAppId) {
139
+ await (0, ensureTestFlightSetup_1.ensureTestFlightSetupForExistingAppAsync)(this.ctx, ascAppId);
138
140
  return (0, results_1.result)(ascAppId);
139
141
  }
140
142
  else if (this.ctx.nonInteractive) {
@@ -0,0 +1,7 @@
1
+ import { Platform } from '@expo/eas-build-job';
2
+ import { SubmissionContext } from '../context';
3
+ /**
4
+ * Best-effort TestFlight internal group setup for an App Store Connect app
5
+ * that already exists with `ascAppId` provided.
6
+ */
7
+ export declare function ensureTestFlightSetupForExistingAppAsync(ctx: SubmissionContext<Platform.IOS>, ascAppIdentifier: string): Promise<void>;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ensureTestFlightSetupForExistingAppAsync = ensureTestFlightSetupForExistingAppAsync;
4
+ const tslib_1 = require("tslib");
5
+ const apple_utils_1 = require("@expo/apple-utils");
6
+ const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
7
+ const authenticateTypes_1 = require("../../credentials/ios/appstore/authenticateTypes");
8
+ const authenticate_1 = require("../../credentials/ios/appstore/authenticate");
9
+ const ensureTestFlightGroup_1 = require("../../credentials/ios/appstore/ensureTestFlightGroup");
10
+ const resolveCredentials_1 = require("../../credentials/ios/appstore/resolveCredentials");
11
+ const AscApiKeyUtils_1 = require("../../credentials/ios/actions/AscApiKeyUtils");
12
+ const log_1 = tslib_1.__importDefault(require("../../log"));
13
+ const bundleIdentifier_1 = require("../../project/ios/bundleIdentifier");
14
+ /**
15
+ * Best-effort TestFlight internal group setup for an App Store Connect app
16
+ * that already exists with `ascAppId` provided.
17
+ */
18
+ async function ensureTestFlightSetupForExistingAppAsync(ctx, ascAppIdentifier) {
19
+ if (!ctx.autoTestFlightSetup) {
20
+ return;
21
+ }
22
+ try {
23
+ const bundleIdentifier = ctx.applicationIdentifierOverride ??
24
+ ctx.profile.bundleIdentifier ??
25
+ (await (0, bundleIdentifier_1.getBundleIdentifierAsync)(ctx.projectDir, ctx.exp, ctx.vcsClient));
26
+ const appLookupParams = {
27
+ account: (0, nullthrows_1.default)(ctx.user.accounts.find(a => a.name === ctx.accountName), `You do not have access to account: ${ctx.accountName}`),
28
+ projectName: ctx.projectName,
29
+ bundleIdentifier,
30
+ };
31
+ if (!ctx.credentialsCtx.appStore.authCtx) {
32
+ const teamType = (0, resolveCredentials_1.resolveAppleTeamTypeFromEnvironment)() ?? authenticateTypes_1.AppleTeamType.COMPANY_OR_ORGANIZATION;
33
+ if ((0, resolveCredentials_1.hasAscEnvVars)()) {
34
+ const teamId = process.env.EXPO_APPLE_TEAM_ID;
35
+ if (!process.env.EXPO_ASC_API_KEY_PATH ||
36
+ !process.env.EXPO_ASC_KEY_ID ||
37
+ !process.env.EXPO_ASC_ISSUER_ID ||
38
+ !teamId) {
39
+ log_1.default.log('App Store Connect credentials are incomplete, skipping TestFlight setup');
40
+ return;
41
+ }
42
+ await ctx.credentialsCtx.appStore.ensureAuthenticatedAsync({
43
+ mode: authenticateTypes_1.AuthenticationMode.API_KEY,
44
+ teamId,
45
+ teamType,
46
+ });
47
+ }
48
+ else {
49
+ const resolvedKey = await (0, AscApiKeyUtils_1.resolveAscApiKeyForAppCredentialsAsync)({
50
+ graphqlClient: ctx.graphqlClient,
51
+ app: appLookupParams,
52
+ });
53
+ const teamId = resolvedKey?.teamId ?? process.env.EXPO_APPLE_TEAM_ID;
54
+ if (!resolvedKey || !teamId) {
55
+ log_1.default.log('No complete App Store Connect credentials, skipping TestFlight setup');
56
+ return;
57
+ }
58
+ log_1.default.log('Using App Store Connect API Key from EAS credentials service.');
59
+ await ctx.credentialsCtx.appStore.ensureAuthenticatedAsync({
60
+ mode: authenticateTypes_1.AuthenticationMode.API_KEY,
61
+ ascApiKey: resolvedKey.ascApiKey,
62
+ teamId,
63
+ teamName: resolvedKey.teamName,
64
+ teamType,
65
+ });
66
+ }
67
+ }
68
+ const authCtx = ctx.credentialsCtx.appStore.authCtx;
69
+ if (!authCtx) {
70
+ log_1.default.debug('No App Store Connect API key available, skipping TestFlight setup');
71
+ return;
72
+ }
73
+ const app = await apple_utils_1.App.infoAsync((0, authenticate_1.getRequestContext)(authCtx), { id: ascAppIdentifier });
74
+ await (0, ensureTestFlightGroup_1.ensureTestFlightGroupExistsAsync)(app, { nonInteractive: ctx.nonInteractive });
75
+ }
76
+ catch (error) {
77
+ // Group setup is a convenience on top of the submission and must never
78
+ // block it.
79
+ log_1.default.warn('Skipping TestFlight group setup:', error);
80
+ }
81
+ }
@@ -58,7 +58,7 @@ function toEasBuildLinkage(easSubmission) {
58
58
  return {
59
59
  easSubmissionId: easSubmission?.id ?? null,
60
60
  easBuildId: easSubmission?.submittedBuild?.id ?? null,
61
- runtimeVersion: easSubmission?.submittedBuild?.runtimeVersion ?? null,
61
+ runtimeVersion: easSubmission?.submittedBuild?.runtime?.version ?? null,
62
62
  fingerprintHash: easSubmission?.submittedBuild?.fingerprint?.hash ?? null,
63
63
  };
64
64
  }
@@ -45,7 +45,7 @@ function formatGraphQLSubmission(submission) {
45
45
  ? [
46
46
  {
47
47
  label: 'Application Identifier',
48
- value: sanitize(submission.androidConfig?.applicationIdentifier),
48
+ value: sanitize(submittedBuild?.appIdentifier),
49
49
  },
50
50
  { label: 'Track', value: sanitize(submission.androidConfig?.track)?.toLowerCase() },
51
51
  {
@@ -61,7 +61,7 @@ function formatGraphQLSubmission(submission) {
61
61
  label: submission.platform === generated_1.AppPlatform.Android ? 'Version code' : 'Build number',
62
62
  value: sanitize(submittedBuild?.appBuildVersion),
63
63
  },
64
- { label: 'Runtime Version', value: sanitize(submittedBuild?.runtimeVersion) },
64
+ { label: 'Runtime Version', value: sanitize(submittedBuild?.runtime?.version) },
65
65
  { label: 'Fingerprint', value: submittedBuild?.fingerprint?.hash },
66
66
  { label: 'Commit', value: sanitize(submittedBuild?.gitCommitHash) },
67
67
  { label: 'Error Code', value: sanitize(submission.error?.errorCode) },
@@ -134,7 +134,7 @@ async function selectUpdateGroupOnBranchAsync(graphqlClient, { projectId, branch
134
134
  .map(group => {
135
135
  const first = group[0];
136
136
  return first
137
- ? `${first.group} (runtime: ${first.runtimeVersion}, message: ${first.message ?? 'N/A'})`
137
+ ? `${first.group} (runtime: ${first.runtime.version}, message: ${first.message ?? 'N/A'})`
138
138
  : 'unknown';
139
139
  })
140
140
  .join('\n ');
@@ -38,14 +38,14 @@ async function republishAsync({ graphqlClient, app, updatesToPublish, targetBran
38
38
  const isSameGroup = (update) => update.groupId === arbitraryUpdate.groupId &&
39
39
  update.branchId === arbitraryUpdate.branchId &&
40
40
  update.branchName === arbitraryUpdate.branchName &&
41
- update.runtimeVersion === arbitraryUpdate.runtimeVersion &&
41
+ update.runtime.version === arbitraryUpdate.runtime.version &&
42
42
  update.manifestHostOverride === arbitraryUpdate.manifestHostOverride &&
43
43
  update.assetHostOverride === arbitraryUpdate.assetHostOverride;
44
44
  (0, assert_1.default)(updatesToPublish.every(isSameGroup), 'All updates being republished must belong to the same update group');
45
45
  (0, assert_1.default)(updatesToPublish.every(u => u.isRollBackToEmbedded) ||
46
46
  updatesToPublish.every(u => !u.isRollBackToEmbedded), 'All updates must either be roll back to embedded updates or not');
47
47
  (0, assert_1.default)(!updatesToPublish.some(u => !!u.rolloutControlUpdate), 'Cannot republish an update that is being rolled-out. Either complete the update rollout and then republish or publish a new rollout update.');
48
- const { runtimeVersion } = arbitraryUpdate;
48
+ const runtimeVersion = arbitraryUpdate.runtime.version;
49
49
  // If codesigning was created for the original update, we need to add it to the republish.
50
50
  // If one wishes to not sign the republish or sign with a different key, a normal publish should
51
51
  // be performed.
@@ -156,7 +156,7 @@ async function republishAsync({ graphqlClient, app, updatesToPublish, targetBran
156
156
  log_1.default.addNewLineIfNone();
157
157
  log_1.default.log((0, formatFields_1.default)([
158
158
  { label: 'Branch', value: targetBranchName },
159
- { label: 'Runtime version', value: arbitraryRepublishedUpdate.runtimeVersion },
159
+ { label: 'Runtime version', value: arbitraryRepublishedUpdate.runtime.version },
160
160
  { label: 'Platform', value: updatesRepublished.map(update => update.platform).join(', ') },
161
161
  { label: 'Update group ID', value: arbitraryRepublishedUpdate.group },
162
162
  ...(updatesRepublishedByPlatform.android
@@ -47,7 +47,7 @@ async function publishRollBackToEmbeddedUpdateAsync({ graphqlClient, projectId,
47
47
  else {
48
48
  log_1.default.addNewLineIfNone();
49
49
  for (const runtime of (0, uniqBy_1.default)(runtimeToPlatformsAndFingerprintInfoMapping, version => version.runtimeVersion)) {
50
- const newUpdatesForRuntimeVersion = newUpdates.filter(update => update.runtimeVersion === runtime.runtimeVersion);
50
+ const newUpdatesForRuntimeVersion = newUpdates.filter(update => update.runtime.version === runtime.runtimeVersion);
51
51
  if (newUpdatesForRuntimeVersion.length === 0) {
52
52
  throw new Error(`Publish response is missing updates with runtime ${runtime.runtimeVersion}.`);
53
53
  }
@@ -7,7 +7,8 @@ export type FormatUpdateParameter = Pick<Update, 'id' | 'createdAt' | 'message'>
7
7
  };
8
8
  export type UpdateJsonInfo = {
9
9
  branch: string;
10
- } & Pick<UpdateFragment, 'id' | 'createdAt' | 'group' | 'message' | 'runtimeVersion' | 'platform' | 'manifestPermalink' | 'gitCommitHash'>;
10
+ runtimeVersion: string;
11
+ } & Pick<UpdateFragment, 'id' | 'createdAt' | 'group' | 'message' | 'platform' | 'manifestPermalink' | 'gitCommitHash'>;
11
12
  export type UpdateGroupDescription = FormatUpdateParameter & {
12
13
  branch: string;
13
14
  group: string;
@@ -106,7 +106,7 @@ function ensureValidVersions(exp, platform) {
106
106
  }
107
107
  }
108
108
  function formatUpdateTitle(update) {
109
- const { message, createdAt, actor, runtimeVersion } = update;
109
+ const { message, createdAt, actor, runtime } = update;
110
110
  let actorName;
111
111
  switch (actor?.__typename) {
112
112
  case 'User':
@@ -124,7 +124,7 @@ function formatUpdateTitle(update) {
124
124
  actorName = 'unknown';
125
125
  }
126
126
  }
127
- return `[${(0, dateformat_1.default)(createdAt, 'mmm dd HH:MM')} by ${actorName}, runtimeVersion: ${runtimeVersion}] ${message}`;
127
+ return `[${(0, dateformat_1.default)(createdAt, 'mmm dd HH:MM')} by ${actorName}, runtimeVersion: ${runtime.version}] ${message}`;
128
128
  }
129
129
  function getUpdateJsonInfosForUpdates(updates) {
130
130
  return updates.map(update => ({
@@ -133,7 +133,7 @@ function getUpdateJsonInfosForUpdates(updates) {
133
133
  group: update.group,
134
134
  branch: update.branch.name,
135
135
  message: update.message,
136
- runtimeVersion: update.runtimeVersion,
136
+ runtimeVersion: update.runtime.version,
137
137
  platform: update.platform,
138
138
  manifestPermalink: update.manifestPermalink,
139
139
  isRollBackToEmbedded: update.isRollBackToEmbedded,
@@ -143,7 +143,7 @@ function getUpdateJsonInfosForUpdates(updates) {
143
143
  function getUpdateGroupDescriptions(updateGroups) {
144
144
  return updateGroups.map(updateGroup => ({
145
145
  message: formatUpdateMessage(updateGroup[0]),
146
- runtimeVersion: updateGroup[0].runtimeVersion,
146
+ runtimeVersion: updateGroup[0].runtime.version,
147
147
  isRollBackToEmbedded: updateGroup[0].isRollBackToEmbedded,
148
148
  rolloutPercentage: updateGroup[0].rolloutPercentage ?? undefined,
149
149
  codeSigningKey: updateGroup[0].codeSigningInfo?.keyid,
@@ -155,7 +155,7 @@ function getUpdateGroupDescriptionsWithBranch(updateGroups) {
155
155
  return updateGroups.map(updateGroup => ({
156
156
  branch: updateGroup[0].branch.name,
157
157
  message: formatUpdateMessage(updateGroup[0]),
158
- runtimeVersion: updateGroup[0].runtimeVersion,
158
+ runtimeVersion: updateGroup[0].runtime.version,
159
159
  isRollBackToEmbedded: updateGroup[0].isRollBackToEmbedded,
160
160
  rolloutPercentage: updateGroup[0].rolloutPercentage ?? undefined,
161
161
  codeSigningKey: updateGroup[0].codeSigningInfo?.keyid,
@@ -172,7 +172,7 @@ function getBranchDescription(branch) {
172
172
  branch: branch.name,
173
173
  update: {
174
174
  message: formatUpdateMessage(latestUpdate),
175
- runtimeVersion: latestUpdate.runtimeVersion,
175
+ runtimeVersion: latestUpdate.runtime.version,
176
176
  isRollBackToEmbedded: latestUpdate.isRollBackToEmbedded,
177
177
  rolloutPercentage: latestUpdate.rolloutPercentage ?? undefined,
178
178
  codeSigningKey: latestUpdate.codeSigningInfo?.keyid,
@@ -211,7 +211,7 @@ async function prewarmDiffingAsync(graphqlClient, appId, newUpdates) {
211
211
  appId,
212
212
  branchName: update.branch.name,
213
213
  platform: exports.updatePublishPlatformToAppPlatform[updatePublishPlatform],
214
- runtimeVersion: update.runtimeVersion,
214
+ runtimeVersion: update.runtime.version,
215
215
  limit: 2,
216
216
  });
217
217
  if (updateIds.length !== 2) {
@@ -10,7 +10,7 @@ const generated_1 = require("../graphql/generated");
10
10
  * then organization accounts.
11
11
  */
12
12
  function getCreatableAccountNames(actor) {
13
- const creatableAccounts = actor.accounts.filter(a => a.users.find(it => it.actor.id === actor.id)?.role !== generated_1.Role.ViewOnly);
13
+ const creatableAccounts = actor.accounts.filter(a => a.viewerUserPermission.role !== generated_1.Role.ViewOnly);
14
14
  if (actor.__typename === 'Robot') {
15
15
  return creatableAccounts.map(it => it.name);
16
16
  }
@@ -26,4 +26,6 @@ export declare function pollForBackgroundJobReceiptAsync(graphqlClient: ExpoGrap
26
26
  export declare function pollForBackgroundJobReceiptAsync(graphqlClient: ExpoGraphqlClient, backgroundJobReceipt: BackgroundJobReceiptDataFragment, options?: {
27
27
  onBackgroundJobReceiptPollError?: BackgroundJobPollErrorCondition;
28
28
  pollInterval?: number;
29
+ maxChecks?: number;
30
+ maxConsecutiveFetchErrors?: number;
29
31
  }): Promise<BackgroundJobReceiptDataFragment | null>;
@@ -42,8 +42,11 @@ async function fetchBackgroundJobReceiptAsync(graphqlClient, receiptId) {
42
42
  }
43
43
  }
44
44
  async function pollForBackgroundJobReceiptAsync(graphqlClient, backgroundJobReceipt, options) {
45
+ const maxChecks = options?.maxChecks ?? 90;
46
+ const maxConsecutiveFetchErrors = options?.maxConsecutiveFetchErrors ?? 0;
45
47
  return await new Promise((resolve, reject) => {
46
48
  let numChecks = 0;
49
+ let consecutiveFetchErrors = 0;
47
50
  const intervalHandle = (0, set_interval_async_1.setIntervalAsync)(async function pollForDeletionFinishedAsync() {
48
51
  function failBackgroundDeletion(error) {
49
52
  void (0, set_interval_async_1.clearIntervalAsync)(intervalHandle);
@@ -58,12 +61,18 @@ async function pollForBackgroundJobReceiptAsync(graphqlClient, backgroundJobRece
58
61
  resolve(null);
59
62
  return;
60
63
  }
64
+ consecutiveFetchErrors += 1;
65
+ if (consecutiveFetchErrors <= maxConsecutiveFetchErrors) {
66
+ numChecks++;
67
+ return;
68
+ }
61
69
  }
62
70
  failBackgroundDeletion(new BackgroundJobReceiptPollError({
63
71
  errorType: BackgroundJobReceiptPollErrorType.NULL_RECEIPT,
64
72
  }));
65
73
  return;
66
74
  }
75
+ consecutiveFetchErrors = 0;
67
76
  // job failed and will not retry
68
77
  if (receipt.state === generated_1.BackgroundJobState.Failure && !receipt.willRetry) {
69
78
  failBackgroundDeletion(new BackgroundJobReceiptPollError({
@@ -72,10 +81,10 @@ async function pollForBackgroundJobReceiptAsync(graphqlClient, backgroundJobRece
72
81
  }));
73
82
  return;
74
83
  }
75
- // all else fails, stop polling after 90 checks. This should only happen if there's an
84
+ // all else fails, stop polling after maxChecks. This should only happen if there's an
76
85
  // issue with receipts not setting `willRetry` to false when they fail within a reasonable
77
86
  // amount of time.
78
- if (numChecks > 90) {
87
+ if (numChecks > maxChecks) {
79
88
  failBackgroundDeletion(new BackgroundJobReceiptPollError({
80
89
  errorType: BackgroundJobReceiptPollErrorType.TIMEOUT,
81
90
  }));
@@ -1,7 +1,6 @@
1
1
  import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
2
2
  import { EnvironmentSecretType, EnvironmentVariableVisibility } from '../graphql/generated';
3
3
  import { RequestedPlatform } from '../platform';
4
- export declare function getProjectEnvironmentVariableEnvironmentsAsync(graphqlClient: ExpoGraphqlClient, projectId: string): Promise<string[]>;
5
4
  export declare function promptVariableTypeAsync(nonInteractive: boolean, initialType?: EnvironmentSecretType): Promise<EnvironmentSecretType>;
6
5
  export declare function parseVisibility(stringVisibility: 'plaintext' | 'sensitive' | 'secret'): EnvironmentVariableVisibility;
7
6
  export declare function promptVariableVisibilityAsync(nonInteractive: boolean, selectedVisibility?: EnvironmentVariableVisibility | null): Promise<EnvironmentVariableVisibility>;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getProjectEnvironmentVariableEnvironmentsAsync = getProjectEnvironmentVariableEnvironmentsAsync;
4
3
  exports.promptVariableTypeAsync = promptVariableTypeAsync;
5
4
  exports.parseVisibility = parseVisibility;
6
5
  exports.promptVariableVisibilityAsync = promptVariableVisibilityAsync;
@@ -10,21 +9,11 @@ exports.promptVariableNameAsync = promptVariableNameAsync;
10
9
  exports.promptPlatformAsync = promptPlatformAsync;
11
10
  const tslib_1 = require("tslib");
12
11
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
13
- const environment_1 = require("../build/utils/environment");
12
+ const defaults_1 = require("../environments/defaults");
13
+ const variables_1 = require("../environments/variables");
14
14
  const generated_1 = require("../graphql/generated");
15
- const EnvironmentVariablesQuery_1 = require("../graphql/queries/EnvironmentVariablesQuery");
16
15
  const platform_1 = require("../platform");
17
16
  const prompts_1 = require("../prompts");
18
- const DEFAULT_ENVIRONMENTS = Object.values(environment_1.DefaultEnvironment);
19
- async function getProjectEnvironmentVariableEnvironmentsAsync(graphqlClient, projectId) {
20
- try {
21
- const environments = await EnvironmentVariablesQuery_1.EnvironmentVariablesQuery.environmentVariableEnvironmentsAsync(graphqlClient, projectId);
22
- return environments;
23
- }
24
- catch {
25
- throw new Error('Failed to fetch available environments');
26
- }
27
- }
28
17
  const CUSTOM_ENVIRONMENT_VALUE = '~~CUSTOM~~';
29
18
  async function promptVariableTypeAsync(nonInteractive, initialType) {
30
19
  if (nonInteractive) {
@@ -97,12 +86,12 @@ async function promptVariableVisibilityAsync(nonInteractive, selectedVisibility)
97
86
  }
98
87
  async function promptVariableEnvironmentAsync({ nonInteractive, selectedEnvironments, multiple = false, canEnterCustomEnvironment = false, graphqlClient, projectId, }) {
99
88
  if (nonInteractive) {
100
- throw new Error(`The \`--environment\` flag must be set when running in \`--non-interactive\` mode. Default environments: ${DEFAULT_ENVIRONMENTS.join(', ')}.`);
89
+ throw new Error(`The \`--environment\` flag must be set when running in \`--non-interactive\` mode. Default environments: ${defaults_1.DEFAULT_ENVIRONMENTS.join(', ')}.`);
101
90
  }
102
- let allEnvironments = DEFAULT_ENVIRONMENTS;
91
+ let allEnvironments = defaults_1.DEFAULT_ENVIRONMENTS;
103
92
  if (graphqlClient && projectId) {
104
- const projectEnvironments = await getProjectEnvironmentVariableEnvironmentsAsync(graphqlClient, projectId);
105
- allEnvironments = [...new Set([...DEFAULT_ENVIRONMENTS, ...projectEnvironments])];
93
+ const projectEnvironments = await (0, variables_1.getProjectEnvironmentVariableEnvironmentsAsync)(graphqlClient, projectId);
94
+ allEnvironments = [...new Set([...defaults_1.DEFAULT_ENVIRONMENTS, ...projectEnvironments])];
106
95
  }
107
96
  if (!multiple) {
108
97
  const choices = allEnvironments.map(environment => ({