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,124 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getProjectEnvironmentVariableEnvironmentsAsync = getProjectEnvironmentVariableEnvironmentsAsync;
4
+ exports.loadProjectScopedEnvVarsAsync = loadProjectScopedEnvVarsAsync;
5
+ exports.upsertEnvVarAsync = upsertEnvVarAsync;
6
+ exports.upsertEnvVarsSequentiallyAsync = upsertEnvVarsSequentiallyAsync;
7
+ const tslib_1 = require("tslib");
8
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
9
+ const generated_1 = require("../graphql/generated");
10
+ const EnvironmentVariableMutation_1 = require("../graphql/mutations/EnvironmentVariableMutation");
11
+ const EnvironmentVariablesQuery_1 = require("../graphql/queries/EnvironmentVariablesQuery");
12
+ const log_1 = tslib_1.__importDefault(require("../log"));
13
+ const prompts_1 = require("../prompts");
14
+ function coversExactly(environments, target) {
15
+ return environments.length === target.size && environments.every(e => target.has(e));
16
+ }
17
+ async function getProjectEnvironmentVariableEnvironmentsAsync(graphqlClient, projectId) {
18
+ try {
19
+ const environments = await EnvironmentVariablesQuery_1.EnvironmentVariablesQuery.environmentVariableEnvironmentsAsync(graphqlClient, projectId);
20
+ return environments;
21
+ }
22
+ catch (error) {
23
+ throw new Error('Failed to fetch available environments', { cause: error });
24
+ }
25
+ }
26
+ async function loadProjectScopedEnvVarsAsync(graphqlClient, projectId, name) {
27
+ return (await EnvironmentVariablesQuery_1.EnvironmentVariablesQuery.byAppIdAsync(graphqlClient, {
28
+ appId: projectId,
29
+ filterNames: [name],
30
+ })).filter(variable => variable.scope === generated_1.EnvironmentVariableScope.Project);
31
+ }
32
+ async function upsertEnvVarAsync(graphqlClient, projectId, envVar, environments, nonInteractive, overwrite, { mode, moveConfirmMessage, }) {
33
+ const target = new Set(environments);
34
+ const replacingAll = mode === 'replaceOtherEnvironments';
35
+ const existingRows = await loadProjectScopedEnvVarsAsync(graphqlClient, projectId, envVar.name);
36
+ const coveredRows = [];
37
+ const rowsToShrink = [];
38
+ const takenOverEnvironments = new Set();
39
+ for (const row of existingRows) {
40
+ const rowEnvironments = row.environments ?? [];
41
+ const handedOver = replacingAll
42
+ ? rowEnvironments
43
+ : rowEnvironments.filter(environment => target.has(environment));
44
+ const kept = replacingAll
45
+ ? []
46
+ : rowEnvironments.filter(environment => !target.has(environment));
47
+ if (!replacingAll && handedOver.length === 0) {
48
+ continue;
49
+ }
50
+ handedOver.forEach(environment => takenOverEnvironments.add(environment));
51
+ if (kept.length === 0) {
52
+ coveredRows.push({
53
+ id: row.id,
54
+ value: row.value ?? '',
55
+ environments: rowEnvironments,
56
+ visibility: row.visibility ?? null,
57
+ });
58
+ }
59
+ else {
60
+ rowsToShrink.push({ id: row.id, keptEnvironments: kept });
61
+ }
62
+ }
63
+ // Reuse the first fully covered row so the variable keeps its id; the rest are redundant. Typed
64
+ // explicitly because tsconfig has no noUncheckedIndexedAccess, so index 0 looks always-present.
65
+ const rowToReuse = coveredRows[0];
66
+ const redundantRows = coveredRows.slice(1);
67
+ const takenOver = [...takenOverEnvironments].join(', ') || 'other environments';
68
+ // 2. Get consent. Overwriting is always explicit — --overwrite, or a yes — and only a write that
69
+ // changes nothing at all is exempt. Visibility counts: writing the same value as Public over a
70
+ // Sensitive row would expose it, so that is a change like any other.
71
+ const reusedRowIsIdentical = rowToReuse?.value === envVar.value &&
72
+ rowToReuse.visibility === envVar.visibility &&
73
+ coversExactly(rowToReuse.environments, target);
74
+ const touchesExistingRows = coveredRows.length > 0 || rowsToShrink.length > 0;
75
+ const changesNothing = reusedRowIsIdentical && redundantRows.length === 0 && rowsToShrink.length === 0;
76
+ if (touchesExistingRows && !overwrite && !changesNothing) {
77
+ let message;
78
+ if (rowsToShrink.length > 0 && moveConfirmMessage) {
79
+ message = moveConfirmMessage(envVar.name, takenOver);
80
+ }
81
+ else if (redundantRows.length > 0) {
82
+ message = `EAS has multiple ${envVar.name} variables for this project (including ${takenOver}). Replace them with one value for ${environments.join(', ')}?`;
83
+ }
84
+ else {
85
+ message = `EAS already has ${envVar.name} for ${takenOver}. Overwrite it?`;
86
+ }
87
+ if (nonInteractive || !(await (0, prompts_1.confirmAsync)({ message }))) {
88
+ log_1.default.warn(`Skipped updating EAS environment variable ${chalk_1.default.bold(envVar.name)}${nonInteractive ? ' (pass --overwrite to replace it)' : ''}.`);
89
+ return false;
90
+ }
91
+ }
92
+ // 3. Apply: hand environments over, drop redundant rows, then land the value.
93
+ for (const { id, keptEnvironments } of rowsToShrink) {
94
+ await EnvironmentVariableMutation_1.EnvironmentVariableMutation.updateAsync(graphqlClient, {
95
+ id,
96
+ environments: keptEnvironments,
97
+ });
98
+ }
99
+ for (const { id } of redundantRows) {
100
+ await EnvironmentVariableMutation_1.EnvironmentVariableMutation.deleteAsync(graphqlClient, id);
101
+ }
102
+ const fields = {
103
+ name: envVar.name,
104
+ value: envVar.value,
105
+ environments,
106
+ visibility: envVar.visibility,
107
+ type: generated_1.EnvironmentSecretType.String,
108
+ };
109
+ if (rowToReuse) {
110
+ await EnvironmentVariableMutation_1.EnvironmentVariableMutation.updateAsync(graphqlClient, { id: rowToReuse.id, ...fields });
111
+ }
112
+ else {
113
+ await EnvironmentVariableMutation_1.EnvironmentVariableMutation.createForAppAsync(graphqlClient, fields, projectId);
114
+ }
115
+ log_1.default.withTick(`${rowToReuse ? 'Updated' : 'Created'} EAS environment variable ${chalk_1.default.bold(envVar.name)} for ${environments.join(', ')}`);
116
+ return true;
117
+ }
118
+ async function upsertEnvVarsSequentiallyAsync(envVars, upsert) {
119
+ const written = [];
120
+ for (const envVar of envVars) {
121
+ written.push(await upsert(envVar));
122
+ }
123
+ return written;
124
+ }
@@ -13,4 +13,12 @@ export declare function withErrorHandlingAsync<T>(promise: Promise<OperationResu
13
13
  export declare function withUpgradeRequiredErrorHandlingAsync<T>(promise: Promise<OperationResult<T>>, { featureName }: {
14
14
  featureName: string;
15
15
  }): Promise<T>;
16
+ /**
17
+ * Whether a failed request will keep failing the same way. True only when the server attributes
18
+ * every error to the caller (`errorType: USER`): a rejected input, a missing permission, a
19
+ * resource this account can't see. Server faults, network errors, and anything we can't classify
20
+ * stay retriable, since giving up on those turns a blip into a failed command. Polling loops use
21
+ * this to stop early instead of waiting out their deadline.
22
+ */
23
+ export declare function isPermanentGraphqlError(error: unknown): boolean;
16
24
  export { GraphqlError };
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GraphqlError = exports.EAS_CLI_UPGRADE_REQUIRED_ERROR_CODE = void 0;
4
4
  exports.withErrorHandlingAsync = withErrorHandlingAsync;
5
5
  exports.withUpgradeRequiredErrorHandlingAsync = withUpgradeRequiredErrorHandlingAsync;
6
+ exports.isPermanentGraphqlError = isPermanentGraphqlError;
6
7
  const tslib_1 = require("tslib");
7
8
  const core_1 = require("@urql/core");
8
9
  Object.defineProperty(exports, "GraphqlError", { enumerable: true, get: function () { return core_1.CombinedError; } });
@@ -50,6 +51,20 @@ async function withUpgradeRequiredErrorHandlingAsync(promise, { featureName }) {
50
51
  throw error;
51
52
  }
52
53
  }
54
+ /**
55
+ * Whether a failed request will keep failing the same way. True only when the server attributes
56
+ * every error to the caller (`errorType: USER`): a rejected input, a missing permission, a
57
+ * resource this account can't see. Server faults, network errors, and anything we can't classify
58
+ * stay retriable, since giving up on those turns a blip into a failed command. Polling loops use
59
+ * this to stop early instead of waiting out their deadline.
60
+ */
61
+ function isPermanentGraphqlError(error) {
62
+ if (!(error instanceof core_1.CombinedError) || error.networkError) {
63
+ return false;
64
+ }
65
+ return (error.graphQLErrors.length > 0 &&
66
+ error.graphQLErrors.every(e => e?.extensions?.errorType === 'USER' && !e?.extensions?.isTransient));
67
+ }
53
68
  function isUpgradeRequiredError(error) {
54
69
  if (!(error instanceof core_1.CombinedError)) {
55
70
  return false;