eas-cli 24.6.0 → 24.8.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 (64) hide show
  1. package/README.md +453 -244
  2. package/build/build/createContext.js +1 -2
  3. package/build/build/runBuildAndSubmit.js +4 -1
  4. package/build/commandUtils/supabase.d.ts +6 -1
  5. package/build/commandUtils/supabase.js +53 -0
  6. package/build/commandUtils/workflow/validation.d.ts +1 -0
  7. package/build/commandUtils/workflow/validation.js +8 -3
  8. package/build/commands/account/view.js +12 -0
  9. package/build/commands/integrations/asc/connect.js +3 -0
  10. package/build/commands/integrations/supabase/advisors.d.ts +16 -0
  11. package/build/commands/integrations/supabase/advisors.js +153 -0
  12. package/build/commands/simulator/availability.d.ts +0 -1
  13. package/build/commands/simulator/availability.js +0 -1
  14. package/build/commands/simulator/egress.d.ts +0 -1
  15. package/build/commands/simulator/egress.js +0 -1
  16. package/build/commands/simulator/events.d.ts +0 -1
  17. package/build/commands/simulator/events.js +0 -1
  18. package/build/commands/simulator/exec.d.ts +0 -1
  19. package/build/commands/simulator/exec.js +0 -1
  20. package/build/commands/simulator/get.d.ts +0 -1
  21. package/build/commands/simulator/get.js +0 -1
  22. package/build/commands/simulator/index.d.ts +2 -1
  23. package/build/commands/simulator/index.js +29 -11
  24. package/build/commands/simulator/list.d.ts +0 -1
  25. package/build/commands/simulator/list.js +0 -1
  26. package/build/commands/simulator/stop.d.ts +0 -1
  27. package/build/commands/simulator/stop.js +0 -1
  28. package/build/commands/submit/internal.d.ts +6 -0
  29. package/build/commands/submit/internal.js +6 -2
  30. package/build/credentials/context.js +7 -0
  31. package/build/credentials/ios/actions/AscApiKeyUtils.d.ts +2 -1
  32. package/build/credentials/ios/actions/AscApiKeyUtils.js +43 -4
  33. package/build/credentials/ios/appstore/AppStoreApi.d.ts +5 -0
  34. package/build/credentials/ios/appstore/AppStoreApi.js +18 -9
  35. package/build/credentials/ios/appstore/authenticate.d.ts +6 -0
  36. package/build/credentials/ios/appstore/authenticate.js +22 -1
  37. package/build/credentials/ios/appstore/resolveCredentials.js +16 -4
  38. package/build/devices/actions/create/developerPortalMethod.js +1 -1
  39. package/build/env.d.ts +4 -0
  40. package/build/env.js +4 -0
  41. package/build/fetch.js +2 -2
  42. package/build/graphql/generated.d.ts +178 -3
  43. package/build/graphql/generated.js +14 -2
  44. package/build/graphql/queries/DeviceRunSessionQuery.js +5 -0
  45. package/build/graphql/queries/SupabaseQuery.d.ts +2 -1
  46. package/build/graphql/queries/SupabaseQuery.js +42 -0
  47. package/build/graphql/queries/WorkflowJobSshQuery.d.ts +1 -0
  48. package/build/graphql/queries/WorkflowJobSshQuery.js +43 -0
  49. package/build/graphql/types/SupabaseConnection.d.ts +9 -2
  50. package/build/graphql/types/SupabaseConnection.js +16 -1
  51. package/build/integrations/asc/ascApiKey.js +2 -1
  52. package/build/integrations/shared/envFile.js +5 -3
  53. package/build/integrations/supabase/provision.d.ts +2 -2
  54. package/build/integrations/supabase/provision.js +6 -4
  55. package/build/metadata/auth.js +4 -4
  56. package/build/simulator/utils.d.ts +7 -6
  57. package/build/simulator/utils.js +34 -13
  58. package/build/submit/ios/AscApiKeySource.js +1 -1
  59. package/build/submit/ios/IosSubmitCommand.js +2 -2
  60. package/build/submit/ios/ensureTestFlightSetup.js +1 -4
  61. package/build/worker/upload.js +2 -2
  62. package/oclif.manifest.json +1166 -1062
  63. package/package.json +9 -8
  64. package/build/commandUtils/new/templates/CLAUDE.md +0 -1
@@ -1,5 +1,7 @@
1
1
  import { Platform } from '@expo/eas-build-job';
2
2
  import EasCommand from '../../commandUtils/EasCommand';
3
+ import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
4
+ import { IosSubmissionConfigInput } from '../../graphql/generated';
3
5
  /**
4
6
  * This command will be run on the EAS workers.
5
7
  * This command resolves credentials and other
@@ -22,3 +24,7 @@ export default class SubmitInternal extends EasCommand {
22
24
  };
23
25
  runAsync(): Promise<void>;
24
26
  }
27
+ export declare function getAppStoreConnectApiKeyJsonAsync({ iosConfig, graphqlClient, }: {
28
+ iosConfig: IosSubmissionConfigInput;
29
+ graphqlClient: ExpoGraphqlClient;
30
+ }): Promise<string | null>;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAppStoreConnectApiKeyJsonAsync = getAppStoreConnectApiKeyJsonAsync;
3
4
  const tslib_1 = require("tslib");
4
5
  const eas_build_job_1 = require("@expo/eas-build-job");
5
6
  const eas_json_1 = require("@expo/eas-json");
@@ -142,10 +143,13 @@ async function getGoogleServiceAccountKeyJsonAsync({ androidConfig, graphqlClien
142
143
  return null;
143
144
  }
144
145
  async function getAppStoreConnectApiKeyJsonAsync({ iosConfig, graphqlClient, }) {
146
+ // Individual API keys have no issuer. fastlane detects them by the absence of the issuer_id field.
145
147
  if (iosConfig.ascApiKey) {
146
148
  return JSON.stringify({
147
149
  key_id: iosConfig.ascApiKey.keyIdentifier,
148
- issuer_id: iosConfig.ascApiKey.issuerIdentifier,
150
+ ...(iosConfig.ascApiKey.issuerIdentifier
151
+ ? { issuer_id: iosConfig.ascApiKey.issuerIdentifier }
152
+ : null),
149
153
  key: iosConfig.ascApiKey.keyP8,
150
154
  });
151
155
  }
@@ -153,7 +157,7 @@ async function getAppStoreConnectApiKeyJsonAsync({ iosConfig, graphqlClient, })
153
157
  const key = await AppStoreConnectApiKeyQuery_1.AppStoreConnectApiKeyQuery.getByIdAsync(graphqlClient, iosConfig.ascApiKeyId);
154
158
  return JSON.stringify({
155
159
  key_id: key.keyIdentifier,
156
- issuer_id: key.issuerIdentifier,
160
+ ...(key.issuerIdentifier ? { issuer_id: key.issuerIdentifier } : null),
157
161
  key: key.keyP8,
158
162
  });
159
163
  }
@@ -71,6 +71,13 @@ class CredentialsContext {
71
71
  return;
72
72
  }
73
73
  if (this.appStore.defaultAuthenticationMode === authenticateTypes_1.AuthenticationMode.API_KEY) {
74
+ if (process.env.EXPO_ASC_API_KEY_PATH &&
75
+ process.env.EXPO_ASC_KEY_ID &&
76
+ !process.env.EXPO_ASC_ISSUER_ID) {
77
+ log_1.default.debug(`App Store Connect API key ${process.env.EXPO_ASC_KEY_ID} has no Issuer ID (individual key). Skipping authentication with Apple. Set EXPO_ASC_ISSUER_ID if this is a team key.`);
78
+ this.shouldAskAuthenticateAppStore = false;
79
+ return;
80
+ }
74
81
  await this.appStore.ensureAuthenticatedAsync();
75
82
  return;
76
83
  }
@@ -9,7 +9,7 @@ export declare enum AppStoreApiKeyPurpose {
9
9
  SUBMISSION_SERVICE = "EAS Submit",
10
10
  ASC_APP_CONNECTION = "EAS Connect"
11
11
  }
12
- export declare function promptForAscApiKeyPathAsync(ctx: CredentialsContext): Promise<AscApiKeyPath>;
12
+ export declare function promptForAscApiKeyPathAsync(ctx: CredentialsContext, purpose: AppStoreApiKeyPurpose): Promise<AscApiKeyPath>;
13
13
  export declare function promptForIssuerIdAsync(): Promise<string>;
14
14
  export declare function getMinimalAscApiKeyAsync(ascApiKey: AscApiKey): Promise<MinimalAscApiKey>;
15
15
  export declare function provideOrGenerateAscApiKeyAsync(ctx: CredentialsContext, purpose: AppStoreApiKeyPurpose): Promise<MinimalAscApiKey>;
@@ -20,6 +20,7 @@ export declare function getAscApiKeysFromAccountAsync(ctx: CredentialsContext, a
20
20
  export declare function selectAscApiKeysFromAccountAsync(ctx: CredentialsContext, account: AccountFragment, { filterDifferentAppleTeam }?: {
21
21
  filterDifferentAppleTeam?: boolean;
22
22
  }): Promise<AppStoreConnectApiKeyFragment | null>;
23
+ export declare function filterOutIndividualAscApiKeys(keys: AppStoreConnectApiKeyFragment[]): AppStoreConnectApiKeyFragment[];
23
24
  export declare function sortAscApiKeysByUpdatedAtDesc(keys: AppStoreConnectApiKeyFragment[]): AppStoreConnectApiKeyFragment[];
24
25
  export declare function formatAscApiKey(ascApiKey: AppStoreConnectApiKeyFragment): string;
25
26
  export declare function resolveAscApiKeyForAppCredentialsAsync({ graphqlClient, app, }: {
@@ -8,6 +8,7 @@ exports.provideOrGenerateAscApiKeyAsync = provideOrGenerateAscApiKeyAsync;
8
8
  exports.getAscApiKeyName = getAscApiKeyName;
9
9
  exports.getAscApiKeysFromAccountAsync = getAscApiKeysFromAccountAsync;
10
10
  exports.selectAscApiKeysFromAccountAsync = selectAscApiKeysFromAccountAsync;
11
+ exports.filterOutIndividualAscApiKeys = filterOutIndividualAscApiKeys;
11
12
  exports.sortAscApiKeysByUpdatedAtDesc = sortAscApiKeysByUpdatedAtDesc;
12
13
  exports.formatAscApiKey = formatAscApiKey;
13
14
  exports.resolveAscApiKeyForAppCredentialsAsync = resolveAscApiKeyForAppCredentialsAsync;
@@ -19,6 +20,7 @@ const nanoid_1 = require("nanoid");
19
20
  const path_1 = tslib_1.__importDefault(require("path"));
20
21
  const apple_utils_1 = require("@expo/apple-utils");
21
22
  const AppleTeamFormatting_1 = require("./AppleTeamFormatting");
23
+ const env_1 = tslib_1.__importDefault(require("../../../env"));
22
24
  const AppStoreConnectApiKeyQuery_1 = require("../../../graphql/queries/AppStoreConnectApiKeyQuery");
23
25
  const log_1 = tslib_1.__importStar(require("../../../log"));
24
26
  const prompts_1 = require("../../../prompts");
@@ -34,8 +36,21 @@ var AppStoreApiKeyPurpose;
34
36
  AppStoreApiKeyPurpose["SUBMISSION_SERVICE"] = "EAS Submit";
35
37
  AppStoreApiKeyPurpose["ASC_APP_CONNECTION"] = "EAS Connect";
36
38
  })(AppStoreApiKeyPurpose || (exports.AppStoreApiKeyPurpose = AppStoreApiKeyPurpose = {}));
37
- async function promptForAscApiKeyPathAsync(ctx) {
39
+ async function promptForAscApiKeyPathAsync(ctx, purpose) {
40
+ // Individual keys are valid only as submission keys. Every other purpose
41
+ // requires a team key, so the key type question is not asked there.
42
+ // The option stays behind an env var until every server-side submission
43
+ // path runs a fastlane version that accepts keys without an issuer ID.
44
+ const isIndividualKey = !!env_1.default.enableIndividualAscApiKeys &&
45
+ purpose === AppStoreApiKeyPurpose.SUBMISSION_SERVICE &&
46
+ !ctx.nonInteractive &&
47
+ (await promptForAscApiKeyTypeIsIndividualAsync());
38
48
  const { keyId, keyP8Path } = await promptForKeyP8AndIdAsync();
49
+ if (isIndividualKey) {
50
+ log_1.default.log('Individual API keys can be used for submissions, TestFlight setup, and metadata only. ' +
51
+ 'They cannot manage certificates or provisioning profiles.');
52
+ return { keyId, keyP8Path };
53
+ }
39
54
  const bestEffortIssuerId = await getBestEffortIssuerIdAsync(ctx, keyId);
40
55
  if (bestEffortIssuerId) {
41
56
  log_1.default.log(`Detected Issuer ID: ${bestEffortIssuerId}`);
@@ -44,6 +59,12 @@ async function promptForAscApiKeyPathAsync(ctx) {
44
59
  const issuerId = await promptForIssuerIdAsync();
45
60
  return { keyId, issuerId, keyP8Path };
46
61
  }
62
+ async function promptForAscApiKeyTypeIsIndividualAsync() {
63
+ return await (0, prompts_1.selectAsync)('Which type of App Store Connect API key do you want to use?', [
64
+ { title: 'Team key (recommended)', value: false },
65
+ { title: 'Individual key (submissions only)', value: true },
66
+ ]);
67
+ }
47
68
  async function promptForIssuerIdAsync() {
48
69
  log_1.default.log(chalk_1.default.bold('An App Store Connect Issuer ID is required'));
49
70
  log_1.default.log(`If you're not sure what this is or how to find yours, ${(0, log_1.learnMore)('https://expo.fyi/asc-issuer-id')}`);
@@ -65,7 +86,7 @@ async function provideOrGenerateAscApiKeyAsync(ctx, purpose) {
65
86
  if (ctx.autoAcceptCredentialReuse) {
66
87
  return await generateAscApiKeyAsync(ctx, purpose);
67
88
  }
68
- const userProvided = await promptForAscApiKeyAsync(ctx);
89
+ const userProvided = await promptForAscApiKeyAsync(ctx, purpose);
69
90
  if (!userProvided) {
70
91
  return await generateAscApiKeyAsync(ctx, purpose);
71
92
  }
@@ -110,12 +131,12 @@ function getAscApiKeyName(purpose) {
110
131
  const nameParts = ['[Expo]', purpose, (0, nanoid_1.nanoid)(10)];
111
132
  return nameParts.join(' ');
112
133
  }
113
- async function promptForAscApiKeyAsync(ctx) {
134
+ async function promptForAscApiKeyAsync(ctx, purpose) {
114
135
  const shouldAutoGenerateCredentials = await (0, promptForCredentials_1.shouldAutoGenerateCredentialsAsync)(credentials_1.ascApiKeyIdSchema);
115
136
  if (shouldAutoGenerateCredentials) {
116
137
  return null;
117
138
  }
118
- const ascApiKeyPath = await promptForAscApiKeyPathAsync(ctx);
139
+ const ascApiKeyPath = await promptForAscApiKeyPathAsync(ctx, purpose);
119
140
  const { keyP8Path, keyId, issuerId } = ascApiKeyPath;
120
141
  return { keyP8: await fs_extra_1.default.readFile(keyP8Path, 'utf-8'), keyId, issuerId };
121
142
  }
@@ -200,6 +221,14 @@ function filterKeysFromDifferentAppleTeam(ctx, keys) {
200
221
  const teamId = ctx.appStore.authCtx.team.id;
201
222
  return keys.filter(key => !key.appleTeam || key.appleTeam?.appleTeamIdentifier === teamId);
202
223
  }
224
+ function filterOutIndividualAscApiKeys(keys) {
225
+ const teamKeys = keys.filter(key => !!key.issuerIdentifier);
226
+ const hiddenCount = keys.length - teamKeys.length;
227
+ if (hiddenCount > 0) {
228
+ log_1.default.log(chalk_1.default.gray(`${hiddenCount} individual API ${hiddenCount === 1 ? 'key' : 'keys'} hidden: individual keys are valid only for submissions.`));
229
+ }
230
+ return teamKeys;
231
+ }
203
232
  function sortAscApiKeysByUpdatedAtDesc(keys) {
204
233
  return keys.sort((keyA, keyB) => new Date(keyB.updatedAt).getTime() - new Date(keyA.updatedAt).getTime());
205
234
  }
@@ -246,6 +275,12 @@ async function tryAuthenticateAppStoreWithEasAscApiKeyAsync(ctx, app, teamType)
246
275
  }
247
276
  try {
248
277
  if ((0, resolveCredentials_1.hasAscEnvVars)()) {
278
+ if (process.env.EXPO_ASC_API_KEY_PATH &&
279
+ process.env.EXPO_ASC_KEY_ID &&
280
+ !process.env.EXPO_ASC_ISSUER_ID) {
281
+ log_1.default.debug(`App Store Connect API key ${process.env.EXPO_ASC_KEY_ID} has no Issuer ID (individual key). Skipping authentication with Apple. Set EXPO_ASC_ISSUER_ID if this is a team key.`);
282
+ return false;
283
+ }
249
284
  await ctx.appStore.ensureAuthenticatedAsync({
250
285
  mode: authenticateTypes_1.AuthenticationMode.API_KEY,
251
286
  teamType,
@@ -259,6 +294,10 @@ async function tryAuthenticateAppStoreWithEasAscApiKeyAsync(ctx, app, teamType)
259
294
  if (!resolvedKey) {
260
295
  return false;
261
296
  }
297
+ if (!resolvedKey.ascApiKey.issuerId) {
298
+ log_1.default.debug(`App Store Connect API key ${resolvedKey.ascApiKey.keyId} has no Issuer ID (individual key). Skipping authentication with Apple. Run 'eas credentials' and upload the key again with its Issuer ID if this is a team key.`);
299
+ return false;
300
+ }
262
301
  log_1.default.log('Using App Store Connect API Key from EAS credentials service.');
263
302
  await ctx.appStore.ensureAuthenticatedAsync({
264
303
  mode: authenticateTypes_1.AuthenticationMode.API_KEY,
@@ -13,6 +13,11 @@ export default class AppStoreApi {
13
13
  constructor();
14
14
  ensureUserAuthenticatedAsync(options?: AuthenticateOptions): Promise<UserAuthCtx>;
15
15
  ensureAuthenticatedAsync(options?: AuthenticateOptions): Promise<AuthCtx>;
16
+ /**
17
+ * Use for operations against Apple's Provisioning endpoints (bundle IDs, certificates,
18
+ * profiles, devices).
19
+ */
20
+ ensureProvisioningAuthenticatedAsync(options?: AuthenticateOptions): Promise<AuthCtx>;
16
21
  ensureBundleIdExistsAsync(app: AppLookupParams, options?: IosCapabilitiesOptions): Promise<void>;
17
22
  listDistributionCertificatesAsync(): Promise<DistributionCertificateStoreInfo[]>;
18
23
  createDistributionCertificateAsync(): Promise<DistributionCertificate>;
@@ -38,20 +38,29 @@ class AppStoreApi {
38
38
  }
39
39
  return this.authCtx;
40
40
  }
41
+ /**
42
+ * Use for operations against Apple's Provisioning endpoints (bundle IDs, certificates,
43
+ * profiles, devices).
44
+ */
45
+ async ensureProvisioningAuthenticatedAsync(options) {
46
+ const authCtx = await this.ensureAuthenticatedAsync(options);
47
+ (0, authenticate_1.assertProvisioningAuthCtx)(authCtx);
48
+ return authCtx;
49
+ }
41
50
  async ensureBundleIdExistsAsync(app, options) {
42
- const ctx = await this.ensureAuthenticatedAsync();
51
+ const ctx = await this.ensureProvisioningAuthenticatedAsync();
43
52
  await (0, ensureAppExists_1.ensureBundleIdExistsAsync)(ctx, app, options);
44
53
  }
45
54
  async listDistributionCertificatesAsync() {
46
- const ctx = await this.ensureAuthenticatedAsync();
55
+ const ctx = await this.ensureProvisioningAuthenticatedAsync();
47
56
  return await (0, distributionCertificate_1.listDistributionCertificatesAsync)(ctx);
48
57
  }
49
58
  async createDistributionCertificateAsync() {
50
- const ctx = await this.ensureAuthenticatedAsync();
59
+ const ctx = await this.ensureProvisioningAuthenticatedAsync();
51
60
  return await (0, distributionCertificate_1.createDistributionCertificateAsync)(ctx);
52
61
  }
53
62
  async revokeDistributionCertificateAsync(ids) {
54
- const ctx = await this.ensureAuthenticatedAsync();
63
+ const ctx = await this.ensureProvisioningAuthenticatedAsync();
55
64
  await (0, distributionCertificate_1.revokeDistributionCertificateAsync)(ctx, ids);
56
65
  }
57
66
  async listPushKeysAsync() {
@@ -67,23 +76,23 @@ class AppStoreApi {
67
76
  await (0, pushKey_1.revokePushKeyAsync)(userCtx, ids);
68
77
  }
69
78
  async useExistingProvisioningProfileAsync(bundleIdentifier, provisioningProfile, distCert) {
70
- const ctx = await this.ensureAuthenticatedAsync();
79
+ const ctx = await this.ensureProvisioningAuthenticatedAsync();
71
80
  return await (0, provisioningProfile_1.useExistingProvisioningProfileAsync)(ctx, bundleIdentifier, provisioningProfile, distCert);
72
81
  }
73
82
  async listProvisioningProfilesAsync(bundleIdentifier, applePlatform, profileClass) {
74
- const ctx = await this.ensureAuthenticatedAsync();
83
+ const ctx = await this.ensureProvisioningAuthenticatedAsync();
75
84
  return await (0, provisioningProfile_1.listProvisioningProfilesAsync)(ctx, bundleIdentifier, applePlatform, profileClass);
76
85
  }
77
86
  async createProvisioningProfileAsync(bundleIdentifier, distCert, profileName, applePlatform, profileClass) {
78
- const ctx = await this.ensureAuthenticatedAsync();
87
+ const ctx = await this.ensureProvisioningAuthenticatedAsync();
79
88
  return await (0, provisioningProfile_1.createProvisioningProfileAsync)(ctx, bundleIdentifier, distCert, profileName, applePlatform, profileClass);
80
89
  }
81
90
  async revokeProvisioningProfileAsync(bundleIdentifier, applePlatform, profileClass) {
82
- const ctx = await this.ensureAuthenticatedAsync();
91
+ const ctx = await this.ensureProvisioningAuthenticatedAsync();
83
92
  await (0, provisioningProfile_1.revokeProvisioningProfileAsync)(ctx, bundleIdentifier, applePlatform, profileClass);
84
93
  }
85
94
  async createOrReuseAdhocProvisioningProfileAsync(udids, bundleIdentifier, distCertSerialNumber, profileType) {
86
- const ctx = await this.ensureAuthenticatedAsync();
95
+ const ctx = await this.ensureProvisioningAuthenticatedAsync();
87
96
  return await (0, provisioningProfileAdhoc_1.createOrReuseAdhocProvisioningProfileAsync)(ctx, udids, bundleIdentifier, distCertSerialNumber, profileType);
88
97
  }
89
98
  async listAscApiKeysAsync() {
@@ -16,5 +16,11 @@ export type Options = {
16
16
  };
17
17
  export declare function isUserAuthCtx(authCtx: AuthCtx | undefined): authCtx is UserAuthCtx;
18
18
  export declare function assertUserAuthCtx(authCtx: AuthCtx | undefined): UserAuthCtx;
19
+ export declare function isIndividualAscApiKeyAuthCtx(authCtx: AuthCtx | undefined): boolean;
20
+ /**
21
+ * Apple blocks individual (issuer-less) ASC API keys from the Provisioning endpoints
22
+ * (certificates, profiles, bundle IDs, devices).
23
+ */
24
+ export declare function assertProvisioningAuthCtx(authCtx: AuthCtx): void;
19
25
  export declare function getRequestContext(authCtx: AuthCtx): RequestContext;
20
26
  export declare function authenticateAsync(options?: Options): Promise<AuthCtx>;
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isUserAuthCtx = isUserAuthCtx;
4
4
  exports.assertUserAuthCtx = assertUserAuthCtx;
5
+ exports.isIndividualAscApiKeyAuthCtx = isIndividualAscApiKeyAuthCtx;
6
+ exports.assertProvisioningAuthCtx = assertProvisioningAuthCtx;
5
7
  exports.getRequestContext = getRequestContext;
6
8
  exports.authenticateAsync = authenticateAsync;
7
9
  const tslib_1 = require("tslib");
@@ -11,7 +13,7 @@ const chalk_1 = tslib_1.__importDefault(require("chalk"));
11
13
  const getenv = tslib_1.__importStar(require("getenv"));
12
14
  const authenticateTypes_1 = require("./authenticateTypes");
13
15
  const resolveCredentials_1 = require("./resolveCredentials");
14
- const log_1 = tslib_1.__importDefault(require("../../../log"));
16
+ const log_1 = tslib_1.__importStar(require("../../../log"));
15
17
  const prompts_1 = require("../../../prompts");
16
18
  const APPLE_IN_HOUSE_TEAM_TYPE = 'in-house';
17
19
  function isUserAuthCtx(authCtx) {
@@ -23,6 +25,25 @@ function assertUserAuthCtx(authCtx) {
23
25
  }
24
26
  throw new Error('Expected user authentication context (login/password).');
25
27
  }
28
+ function isIndividualAscApiKeyAuthCtx(authCtx) {
29
+ return !!authCtx && 'ascApiKey' in authCtx && !!authCtx.ascApiKey && !authCtx.ascApiKey.issuerId;
30
+ }
31
+ /**
32
+ * Apple blocks individual (issuer-less) ASC API keys from the Provisioning endpoints
33
+ * (certificates, profiles, bundle IDs, devices).
34
+ */
35
+ function assertProvisioningAuthCtx(authCtx) {
36
+ if (!isIndividualAscApiKeyAuthCtx(authCtx)) {
37
+ return;
38
+ }
39
+ throw new Error('The App Store Connect API key in use has no Issuer ID, so it is an individual API key. ' +
40
+ 'Apple blocks individual API keys from managing certificates, provisioning profiles, and devices (Provisioning endpoints). ' +
41
+ 'If this is a team key, provide its Issuer ID: set EXPO_ASC_ISSUER_ID when the key comes from environment variables, ' +
42
+ "or run 'eas credentials' and upload the key again with its Issuer ID when it is stored on EAS.\n" +
43
+ 'To continue, do one of the following:\n' +
44
+ ` - Use a team API key (one with an Issuer ID). Run 'eas credentials' to set one up, or set EXPO_ASC_API_KEY_PATH, EXPO_ASC_KEY_ID and EXPO_ASC_ISSUER_ID. ${(0, log_1.learnMore)('https://expo.fyi/creating-asc-api-key')}\n` +
45
+ ` - Provide a distribution certificate and provisioning profile via credentials.json. ${(0, log_1.learnMore)('https://docs.expo.dev/app-signing/local-credentials/')}`);
46
+ }
26
47
  function getRequestContext(authCtx) {
27
48
  (0, assert_1.default)(authCtx.authState?.context, 'Apple request context must be defined');
28
49
  return authCtx.authState.context;
@@ -76,17 +76,29 @@ async function getAscKeyIdFromEnvironmentOrOptionsAsync(ascApiKey) {
76
76
  }
77
77
  async function getAscIssuerIdFromEnvironmentOrOptionsAsync(ascApiKey) {
78
78
  if (ascApiKey?.issuerId) {
79
- return ascApiKey?.issuerId;
79
+ return ascApiKey.issuerId;
80
80
  }
81
- else if (process.env.EXPO_ASC_ISSUER_ID) {
81
+ if (process.env.EXPO_ASC_ISSUER_ID) {
82
+ if (ascApiKey?.keyId) {
83
+ log_1.default.warn(`App Store Connect API key ${ascApiKey.keyId} was configured without an Issuer ID, so EXPO_ASC_ISSUER_ID is used for it instead. App Store Connect rejects requests when the Issuer ID belongs to a different key. Unset EXPO_ASC_ISSUER_ID if ${ascApiKey.keyId} is an individual API key, or configure the Issuer ID that belongs to it.`);
84
+ }
82
85
  return process.env.EXPO_ASC_ISSUER_ID;
83
86
  }
87
+ const keyId = ascApiKey?.keyId ?? process.env.EXPO_ASC_KEY_ID;
88
+ const keyP8IsResolvable = !!ascApiKey?.keyP8 || !!process.env.EXPO_ASC_API_KEY_PATH;
89
+ if (keyId && keyP8IsResolvable) {
90
+ log_1.default.debug(`App Store Connect API key ${keyId} has no Issuer ID, treating it as an individual API key.`);
91
+ return undefined;
92
+ }
84
93
  const { ascIssuerId } = await (0, prompts_1.promptAsync)({
85
94
  type: 'text',
86
95
  name: 'ascIssuerId',
87
- message: `ASC Issuer ID:`,
88
- validate: (val) => val !== '',
96
+ message: `ASC Issuer ID (leave empty for an individual API key):`,
89
97
  });
98
+ if (!ascIssuerId) {
99
+ log_1.default.debug('No Issuer ID provided, treating the App Store Connect API key as an individual API key.');
100
+ return undefined;
101
+ }
90
102
  return ascIssuerId;
91
103
  }
92
104
  function isAppleTeamType(maybeTeamType) {
@@ -19,7 +19,7 @@ const DEVICE_CLASS_TO_GRAPHQL_TYPE = {
19
19
  [apple_utils_1.DeviceClass.MAC]: generated_1.AppleDeviceClass.Mac,
20
20
  };
21
21
  async function runDeveloperPortalMethodAsync(graphqlClient, appStoreApi, account, appleTeam) {
22
- const appleAuthCtx = await appStoreApi.ensureAuthenticatedAsync();
22
+ const appleAuthCtx = await appStoreApi.ensureProvisioningAuthenticatedAsync();
23
23
  const unregisteredPortalDevices = await findUnregisteredPortalDevicesAsync(graphqlClient, appleAuthCtx, account.name, appleTeam);
24
24
  if (unregisteredPortalDevices.length === 0) {
25
25
  log_1.default.log('All your devices registered on Apple Developer Portal are already imported to EAS.');
package/build/env.d.ts CHANGED
@@ -20,5 +20,9 @@ declare const _default: {
20
20
  * Comma separated list of feature gate keys of feature gates to evaluate override to false.
21
21
  */
22
22
  featureGateDisable: string | undefined;
23
+ /**
24
+ * Enables the individual App Store Connect API key option in the interactive submission key prompt.
25
+ */
26
+ enableIndividualAscApiKeys: string | undefined;
23
27
  };
24
28
  export default _default;
package/build/env.js CHANGED
@@ -22,4 +22,8 @@ exports.default = {
22
22
  * Comma separated list of feature gate keys of feature gates to evaluate override to false.
23
23
  */
24
24
  featureGateDisable: process.env.EAS_FG_DISABLE,
25
+ /**
26
+ * Enables the individual App Store Connect API key option in the interactive submission key prompt.
27
+ */
28
+ enableIndividualAscApiKeys: process.env.EAS_ENABLE_INDIVIDUAL_ASC_API_KEYS,
25
29
  };
package/build/fetch.js CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.httpsProxyAgent = exports.RequestError = exports.Response = exports.Headers = void 0;
4
4
  exports.default = default_1;
5
5
  const tslib_1 = require("tslib");
6
- const https_proxy_agent_1 = tslib_1.__importDefault(require("https-proxy-agent"));
6
+ const https_proxy_agent_1 = require("https-proxy-agent");
7
7
  const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
8
8
  var node_fetch_2 = require("node-fetch");
9
9
  Object.defineProperty(exports, "Headers", { enumerable: true, get: function () { return node_fetch_2.Headers; } });
@@ -21,7 +21,7 @@ function createHttpsAgent() {
21
21
  if (!httpsProxyUrl) {
22
22
  return null;
23
23
  }
24
- return (0, https_proxy_agent_1.default)(httpsProxyUrl);
24
+ return new https_proxy_agent_1.HttpsProxyAgent(httpsProxyUrl);
25
25
  }
26
26
  exports.httpsProxyAgent = createHttpsAgent();
27
27
  async function default_1(url, init) {