eas-cli 0.33.1 → 0.36.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 (195) hide show
  1. package/README.md +27 -27
  2. package/build/analytics/common.d.ts +8 -0
  3. package/build/analytics/common.js +19 -0
  4. package/build/analytics/events.d.ts +43 -0
  5. package/build/analytics/events.js +51 -0
  6. package/build/{analytics.d.ts → analytics/rudderstackClient.d.ts} +0 -0
  7. package/build/{analytics.js → analytics/rudderstackClient.js} +4 -10
  8. package/build/api.js +3 -3
  9. package/build/build/android/configure.js +2 -2
  10. package/build/build/android/graphql.js +2 -4
  11. package/build/build/android/prepareJob.js +4 -3
  12. package/build/build/build.js +20 -29
  13. package/build/build/configure.js +14 -7
  14. package/build/build/context.d.ts +1 -1
  15. package/build/build/context.js +2 -2
  16. package/build/build/ios/UpdatesModule.js +2 -2
  17. package/build/build/ios/credentials.js +3 -3
  18. package/build/build/ios/graphql.js +2 -23
  19. package/build/build/ios/prepareJob.js +4 -6
  20. package/build/build/local.js +18 -27
  21. package/build/build/metadata.js +5 -10
  22. package/build/build/types.d.ts +0 -1
  23. package/build/build/utils/devClient.js +8 -5
  24. package/build/build/utils/formatBuild.js +1 -9
  25. package/build/build/utils/repository.js +10 -7
  26. package/build/build/utils/url.js +1 -1
  27. package/build/build/validate.js +4 -4
  28. package/build/commandUtils/EasCommand.d.ts +1 -0
  29. package/build/commandUtils/EasCommand.js +25 -4
  30. package/build/commands/branch/create.js +3 -2
  31. package/build/commands/branch/delete.js +1 -1
  32. package/build/commands/branch/list.js +1 -1
  33. package/build/commands/branch/publish.js +6 -5
  34. package/build/commands/branch/view.js +1 -1
  35. package/build/commands/build/index.js +44 -25
  36. package/build/commands/channel/edit.js +1 -1
  37. package/build/commands/channel/list.js +1 -1
  38. package/build/commands/channel/view.js +1 -1
  39. package/build/commands/diagnostics.js +2 -2
  40. package/build/commands/project/info.js +1 -1
  41. package/build/commands/secret/delete.js +1 -1
  42. package/build/commands/update/view.js +1 -1
  43. package/build/credentials/android/AndroidCredentialsProvider.js +2 -2
  44. package/build/credentials/android/actions/RemoveFcm.js +4 -4
  45. package/build/credentials/android/actions/{SetupBuildCredentials.d.ts → SetUpBuildCredentials.d.ts} +1 -1
  46. package/build/credentials/android/actions/{SetupBuildCredentials.js → SetUpBuildCredentials.js} +3 -3
  47. package/build/credentials/android/actions/{SetupBuildCredentialsFromCredentialsJson.d.ts → SetUpBuildCredentialsFromCredentialsJson.d.ts} +1 -1
  48. package/build/credentials/android/actions/{SetupBuildCredentialsFromCredentialsJson.js → SetUpBuildCredentialsFromCredentialsJson.js} +3 -3
  49. package/build/credentials/android/actions/{SetupGoogleServiceAccountKey.d.ts → SetUpGoogleServiceAccountKey.d.ts} +1 -1
  50. package/build/credentials/android/actions/{SetupGoogleServiceAccountKey.js → SetUpGoogleServiceAccountKey.js} +3 -3
  51. package/build/credentials/android/api/graphql/queries/GoogleServiceAccountKeyQuery.js +2 -0
  52. package/build/credentials/android/utils/keystore.js +67 -32
  53. package/build/credentials/credentialsJson/update.js +5 -4
  54. package/build/credentials/errors.d.ts +4 -0
  55. package/build/credentials/errors.js +8 -1
  56. package/build/credentials/ios/IosCredentialsProvider.js +4 -4
  57. package/build/credentials/ios/actions/AscApiKeyUtils.d.ts +17 -1
  58. package/build/credentials/ios/actions/AscApiKeyUtils.js +158 -24
  59. package/build/credentials/ios/actions/AssignAscApiKey.d.ts +9 -0
  60. package/build/credentials/ios/actions/AssignAscApiKey.js +29 -0
  61. package/build/credentials/ios/actions/CreateAscApiKey.d.ts +9 -0
  62. package/build/credentials/ios/actions/CreateAscApiKey.js +21 -0
  63. package/build/credentials/ios/actions/CreateDistributionCertificate.js +1 -1
  64. package/build/credentials/ios/actions/CreatePushKey.js +1 -1
  65. package/build/credentials/ios/actions/DistributionCertificateUtils.d.ts +1 -1
  66. package/build/credentials/ios/actions/DistributionCertificateUtils.js +6 -8
  67. package/build/credentials/ios/actions/PushKeyUtils.d.ts +1 -1
  68. package/build/credentials/ios/actions/PushKeyUtils.js +6 -6
  69. package/build/credentials/ios/actions/RemoveAscApiKey.d.ts +14 -0
  70. package/build/credentials/ios/actions/RemoveAscApiKey.js +55 -0
  71. package/build/credentials/ios/actions/{SetupAdhocProvisioningProfile.d.ts → SetUpAdhocProvisioningProfile.d.ts} +1 -1
  72. package/build/credentials/ios/actions/{SetupAdhocProvisioningProfile.js → SetUpAdhocProvisioningProfile.js} +5 -5
  73. package/build/credentials/ios/actions/SetUpAscApiKey.d.ts +21 -0
  74. package/build/credentials/ios/actions/SetUpAscApiKey.js +114 -0
  75. package/build/credentials/ios/actions/{SetupBuildCredentials.d.ts → SetUpBuildCredentials.d.ts} +1 -1
  76. package/build/credentials/ios/actions/{SetupBuildCredentials.js → SetUpBuildCredentials.js} +5 -5
  77. package/build/credentials/ios/actions/{SetupBuildCredentialsFromCredentialsJson.d.ts → SetUpBuildCredentialsFromCredentialsJson.d.ts} +1 -1
  78. package/build/credentials/ios/actions/{SetupBuildCredentialsFromCredentialsJson.js → SetUpBuildCredentialsFromCredentialsJson.js} +5 -5
  79. package/build/credentials/ios/actions/{SetupDistributionCertificate.d.ts → SetUpDistributionCertificate.d.ts} +1 -1
  80. package/build/credentials/ios/actions/{SetupDistributionCertificate.js → SetUpDistributionCertificate.js} +3 -3
  81. package/build/credentials/ios/actions/{SetupInternalProvisioningProfile.d.ts → SetUpInternalProvisioningProfile.d.ts} +1 -1
  82. package/build/credentials/ios/actions/{SetupInternalProvisioningProfile.js → SetUpInternalProvisioningProfile.js} +7 -7
  83. package/build/credentials/ios/actions/{SetupProvisioningProfile.d.ts → SetUpProvisioningProfile.d.ts} +1 -1
  84. package/build/credentials/ios/actions/{SetupProvisioningProfile.js → SetUpProvisioningProfile.js} +5 -5
  85. package/build/credentials/ios/actions/{SetupPushKey.d.ts → SetUpPushKey.d.ts} +1 -1
  86. package/build/credentials/ios/actions/{SetupPushKey.js → SetUpPushKey.js} +3 -3
  87. package/build/credentials/ios/actions/SetUpSubmissionCredentials.d.ts +10 -0
  88. package/build/credentials/ios/actions/SetUpSubmissionCredentials.js +53 -0
  89. package/build/credentials/ios/actions/{SetupTargetBuildCredentials.d.ts → SetUpTargetBuildCredentials.d.ts} +1 -1
  90. package/build/credentials/ios/actions/{SetupTargetBuildCredentials.js → SetUpTargetBuildCredentials.js} +10 -10
  91. package/build/credentials/ios/actions/{SetupTargetBuildCredentialsFromCredentialsJson.d.ts → SetUpTargetBuildCredentialsFromCredentialsJson.d.ts} +1 -1
  92. package/build/credentials/ios/actions/{SetupTargetBuildCredentialsFromCredentialsJson.js → SetUpTargetBuildCredentialsFromCredentialsJson.js} +3 -3
  93. package/build/credentials/ios/api/GraphqlClient.d.ts +8 -2
  94. package/build/credentials/ios/api/GraphqlClient.js +74 -2
  95. package/build/credentials/ios/api/graphql/mutations/AppStoreConnectApiKeyMutation.d.ts +5 -0
  96. package/build/credentials/ios/api/graphql/mutations/AppStoreConnectApiKeyMutation.js +54 -0
  97. package/build/credentials/ios/api/graphql/mutations/IosAppCredentialsMutation.d.ts +1 -0
  98. package/build/credentials/ios/api/graphql/mutations/IosAppCredentialsMutation.js +25 -0
  99. package/build/credentials/ios/api/graphql/queries/AppQuery.js +3 -1
  100. package/build/credentials/ios/api/graphql/queries/AppStoreConnectApiKeyQuery.d.ts +4 -0
  101. package/build/credentials/ios/api/graphql/queries/AppStoreConnectApiKeyQuery.js +33 -0
  102. package/build/credentials/ios/api/graphql/queries/AppleDeviceQuery.js +6 -2
  103. package/build/credentials/ios/api/graphql/queries/AppleDistributionCertificateQuery.js +7 -1
  104. package/build/credentials/ios/api/graphql/queries/AppleProvisioningProfileQuery.js +5 -1
  105. package/build/credentials/ios/api/graphql/queries/ApplePushKeyQuery.js +2 -0
  106. package/build/credentials/ios/api/graphql/queries/AppleTeamQuery.js +5 -1
  107. package/build/credentials/ios/appstore/AppStoreApi.d.ts +1 -1
  108. package/build/credentials/ios/appstore/Credentials.types.d.ts +1 -0
  109. package/build/credentials/ios/appstore/ascApiKey.d.ts +1 -1
  110. package/build/credentials/ios/appstore/ascApiKey.js +11 -1
  111. package/build/credentials/ios/appstore/entitlements.d.ts +2 -2
  112. package/build/credentials/ios/appstore/entitlements.js +20 -10
  113. package/build/credentials/ios/credentials.d.ts +2 -1
  114. package/build/credentials/ios/credentials.js +7 -2
  115. package/build/credentials/ios/utils/printCredentials.js +30 -1
  116. package/build/credentials/ios/validators/validateAscApiKey.d.ts +5 -0
  117. package/build/credentials/ios/validators/validateAscApiKey.js +21 -0
  118. package/build/credentials/manager/Actions.d.ts +52 -0
  119. package/build/credentials/manager/Actions.js +53 -0
  120. package/build/credentials/manager/AndroidActions.d.ts +6 -0
  121. package/build/credentials/manager/AndroidActions.js +114 -0
  122. package/build/credentials/manager/IosActions.d.ts +7 -0
  123. package/build/credentials/manager/IosActions.js +145 -0
  124. package/build/credentials/manager/ManageAndroid.d.ts +1 -29
  125. package/build/credentials/manager/ManageAndroid.js +30 -163
  126. package/build/credentials/manager/ManageIos.d.ts +1 -29
  127. package/build/credentials/manager/ManageIos.js +81 -169
  128. package/build/credentials/utils/promptForCredentials.d.ts +2 -1
  129. package/build/credentials/utils/promptForCredentials.js +3 -2
  130. package/build/graphql/client.d.ts +8 -2
  131. package/build/graphql/client.js +1 -1
  132. package/build/graphql/generated.d.ts +313 -85
  133. package/build/graphql/generated.js +23 -1
  134. package/build/graphql/mutations/KeystoreGenerationUrlMutation.d.ts +3 -0
  135. package/build/graphql/mutations/KeystoreGenerationUrlMutation.js +23 -0
  136. package/build/graphql/queries/BuildQuery.js +4 -1
  137. package/build/graphql/queries/EnvironmentSecretsQuery.js +4 -2
  138. package/build/graphql/queries/ProjectQuery.js +3 -1
  139. package/build/graphql/queries/PublishQuery.js +4 -1
  140. package/build/graphql/queries/SubmissionQuery.js +5 -2
  141. package/build/graphql/queries/UserQuery.js +4 -1
  142. package/build/graphql/queries/WebhookQuery.js +6 -2
  143. package/build/graphql/types/Build.js +1 -6
  144. package/build/graphql/types/credentials/AppStoreConnectApiKey.d.ts +1 -0
  145. package/build/graphql/types/credentials/AppStoreConnectApiKey.js +23 -0
  146. package/build/graphql/types/credentials/IosAppCredentials.js +6 -0
  147. package/build/log.d.ts +0 -2
  148. package/build/log.js +2 -12
  149. package/build/project/projectUtils.js +1 -1
  150. package/build/project/publish.js +2 -2
  151. package/build/project/workflow.js +2 -2
  152. package/build/submit/ArchiveSource.js +2 -1
  153. package/build/submit/BaseSubmitter.d.ts +20 -4
  154. package/build/submit/BaseSubmitter.js +34 -1
  155. package/build/submit/android/AndroidSubmitter.d.ts +12 -6
  156. package/build/submit/android/AndroidSubmitter.js +31 -20
  157. package/build/submit/android/ServiceAccountSource.js +2 -2
  158. package/build/submit/context.d.ts +2 -0
  159. package/build/submit/context.js +14 -0
  160. package/build/submit/ios/AppSpecificPasswordSource.d.ts +9 -6
  161. package/build/submit/ios/AppSpecificPasswordSource.js +42 -20
  162. package/build/submit/ios/AscApiKeySource.d.ts +9 -3
  163. package/build/submit/ios/AscApiKeySource.js +10 -10
  164. package/build/submit/ios/CredentialsServiceSource.d.ts +15 -0
  165. package/build/submit/ios/CredentialsServiceSource.js +52 -0
  166. package/build/submit/ios/IosSubmitCommand.d.ts +1 -2
  167. package/build/submit/ios/IosSubmitCommand.js +24 -53
  168. package/build/submit/ios/IosSubmitter.d.ts +20 -7
  169. package/build/submit/ios/IosSubmitter.js +79 -43
  170. package/build/submit/submit.js +13 -4
  171. package/build/submit/utils/errors.js +2 -0
  172. package/build/user/User.js +2 -1
  173. package/build/utils/easCli.d.ts +1 -0
  174. package/build/utils/easCli.js +5 -0
  175. package/build/utils/{expoCommand.d.ts → expoCli.d.ts} +0 -0
  176. package/build/utils/{expoCommand.js → expoCli.js} +0 -0
  177. package/build/utils/profiles.js +9 -2
  178. package/build/vcs/clients/git.d.ts +26 -0
  179. package/build/vcs/clients/git.js +184 -0
  180. package/build/vcs/clients/gitNoCommit.d.ts +7 -0
  181. package/build/vcs/clients/gitNoCommit.js +27 -0
  182. package/build/vcs/clients/noVcs.d.ts +6 -0
  183. package/build/vcs/clients/noVcs.js +19 -0
  184. package/build/vcs/git.d.ts +10 -17
  185. package/build/vcs/git.js +7 -175
  186. package/build/vcs/index.d.ts +2 -2
  187. package/build/vcs/index.js +15 -6
  188. package/build/vcs/local.d.ts +18 -5
  189. package/build/vcs/local.js +61 -32
  190. package/build/vcs/vcs.d.ts +2 -1
  191. package/build/vcs/vcs.js +8 -4
  192. package/oclif.manifest.json +1 -1
  193. package/package.json +7 -7
  194. package/build/build/utils/analytics.d.ts +0 -22
  195. package/build/build/utils/analytics.js +0 -28
@@ -1,21 +1,34 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createSubmissionContextAsync = void 0;
4
+ const uuid_1 = require("uuid");
5
+ const events_1 = require("../analytics/events");
4
6
  const context_1 = require("../credentials/context");
5
7
  const expoConfig_1 = require("../project/expoConfig");
6
8
  const projectUtils_1 = require("../project/projectUtils");
9
+ const Account_1 = require("../user/Account");
7
10
  const actions_1 = require("../user/actions");
8
11
  async function createSubmissionContextAsync(params) {
12
+ var _a;
9
13
  const { projectDir, nonInteractive } = params;
10
14
  const exp = (0, expoConfig_1.getExpoConfig)(projectDir, { env: params.env });
11
15
  const { env, ...rest } = params;
12
16
  const user = await (0, actions_1.ensureLoggedInAsync)();
13
17
  const projectName = exp.slug;
14
18
  const accountName = (0, projectUtils_1.getProjectAccountName)(exp, user);
19
+ const accountId = (_a = (0, Account_1.findAccountByName)(user.accounts, accountName)) === null || _a === void 0 ? void 0 : _a.id;
15
20
  let credentialsCtx = params.credentialsCtx;
16
21
  if (!credentialsCtx) {
17
22
  credentialsCtx = new context_1.CredentialsContext({ projectDir, user, exp, nonInteractive });
18
23
  }
24
+ const trackingCtx = {
25
+ tracking_id: (0, uuid_1.v4)(),
26
+ platform: params.platform,
27
+ ...(accountId && { account_id: accountId }),
28
+ account_name: accountName,
29
+ project_id: params.projectId,
30
+ };
31
+ events_1.Analytics.logEvent(events_1.SubmissionEvent.SUBMIT_COMMAND, trackingCtx);
19
32
  return {
20
33
  ...rest,
21
34
  accountName,
@@ -23,6 +36,7 @@ async function createSubmissionContextAsync(params) {
23
36
  exp,
24
37
  projectName,
25
38
  user,
39
+ trackingCtx,
26
40
  };
27
41
  }
28
42
  exports.createSubmissionContextAsync = createSubmissionContextAsync;
@@ -1,6 +1,7 @@
1
+ import { Platform } from '@expo/eas-build-job';
2
+ import { SubmissionContext } from '../context';
1
3
  export declare enum AppSpecificPasswordSourceType {
2
- userDefined = 0,
3
- prompt = 1
4
+ userDefined = 0
4
5
  }
5
6
  interface AppSpecificPasswordSourceBase {
6
7
  sourceType: AppSpecificPasswordSourceType;
@@ -9,9 +10,11 @@ interface AppSpecificPasswordUserDefinedSource extends AppSpecificPasswordSource
9
10
  sourceType: AppSpecificPasswordSourceType.userDefined;
10
11
  appSpecificPassword: string;
11
12
  }
12
- interface AppSpecificPasswordPromptSource extends AppSpecificPasswordSourceBase {
13
- sourceType: AppSpecificPasswordSourceType.prompt;
13
+ export interface AppSpecificPasswordCredentials {
14
+ password: string;
15
+ appleIdUsername: string;
14
16
  }
15
- export declare type AppSpecificPasswordSource = AppSpecificPasswordUserDefinedSource | AppSpecificPasswordPromptSource;
16
- export declare function getAppSpecificPasswordAsync(source: AppSpecificPasswordSource): Promise<string>;
17
+ export declare type AppSpecificPasswordSource = AppSpecificPasswordUserDefinedSource;
18
+ export declare function getAppSpecificPasswordLocallyAsync(ctx: SubmissionContext<Platform.IOS>, source: AppSpecificPasswordSource): Promise<AppSpecificPasswordCredentials>;
19
+ export declare function getAppleIdUsernameAsync(ctx: SubmissionContext<Platform.IOS>): Promise<string>;
17
20
  export {};
@@ -1,36 +1,58 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAppSpecificPasswordAsync = exports.AppSpecificPasswordSourceType = void 0;
3
+ exports.getAppleIdUsernameAsync = exports.getAppSpecificPasswordLocallyAsync = exports.AppSpecificPasswordSourceType = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
6
- const wrap_ansi_1 = (0, tslib_1.__importDefault)(require("wrap-ansi"));
7
- const log_1 = (0, tslib_1.__importStar)(require("../../log"));
5
+ const getenv_1 = (0, tslib_1.__importDefault)(require("getenv"));
8
6
  const prompts_1 = require("../../prompts");
7
+ const UserSettings_1 = (0, tslib_1.__importDefault)(require("../../user/UserSettings"));
9
8
  var AppSpecificPasswordSourceType;
10
9
  (function (AppSpecificPasswordSourceType) {
11
10
  AppSpecificPasswordSourceType[AppSpecificPasswordSourceType["userDefined"] = 0] = "userDefined";
12
- AppSpecificPasswordSourceType[AppSpecificPasswordSourceType["prompt"] = 1] = "prompt";
13
11
  })(AppSpecificPasswordSourceType = exports.AppSpecificPasswordSourceType || (exports.AppSpecificPasswordSourceType = {}));
14
- async function getAppSpecificPasswordAsync(source) {
12
+ async function getAppSpecificPasswordLocallyAsync(ctx, source) {
15
13
  var _a;
16
14
  if (source.sourceType === AppSpecificPasswordSourceType.userDefined) {
17
- return source.appSpecificPassword;
18
- }
19
- else if (source.sourceType === AppSpecificPasswordSourceType.prompt) {
20
- log_1.default.addNewLineIfNone();
21
- log_1.default.log((0, wrap_ansi_1.default)(`Please enter your Apple app-specific password. You can also provide it by using the ${chalk_1.default.bold('EXPO_APPLE_APP_SPECIFIC_PASSWORD')} environment variable.`, process.stdout.columns || 80));
22
- log_1.default.log((0, log_1.learnMore)('https://expo.fyi/apple-app-specific-password'));
23
- const { appSpecificPassword } = await (0, prompts_1.promptAsync)({
24
- name: 'appSpecificPassword',
25
- message: 'Your Apple app-specific password:',
26
- type: 'password',
27
- validate: (val) => val !== '' || 'Apple app-specific password cannot be empty!',
28
- });
29
- return appSpecificPassword;
15
+ return {
16
+ password: source.appSpecificPassword,
17
+ appleIdUsername: await getAppleIdUsernameAsync(ctx),
18
+ };
30
19
  }
31
20
  else {
32
21
  // exhaustive -- should never happen
33
22
  throw new Error(`Unknown app specific password source type "${(_a = source) === null || _a === void 0 ? void 0 : _a.sourceType}"`);
34
23
  }
35
24
  }
36
- exports.getAppSpecificPasswordAsync = getAppSpecificPasswordAsync;
25
+ exports.getAppSpecificPasswordLocallyAsync = getAppSpecificPasswordLocallyAsync;
26
+ async function getAppleIdUsernameAsync(ctx) {
27
+ var _a;
28
+ if (ctx.profile.appleId) {
29
+ return ctx.profile.appleId;
30
+ }
31
+ const envAppleId = getenv_1.default.string('EXPO_APPLE_ID', '');
32
+ if (envAppleId) {
33
+ return envAppleId;
34
+ }
35
+ if ((_a = ctx.credentialsCtx.appStore.authCtx) === null || _a === void 0 ? void 0 : _a.appleId) {
36
+ return ctx.credentialsCtx.appStore.authCtx.appleId;
37
+ }
38
+ // Get the email address that was last used and set it as
39
+ // the default value for quicker authentication.
40
+ const lastAppleId = await UserSettings_1.default.getAsync('appleId', null);
41
+ if (ctx.nonInteractive) {
42
+ if (lastAppleId) {
43
+ return lastAppleId;
44
+ }
45
+ else {
46
+ throw new Error('Set appleId in the submit profile (eas.json).');
47
+ }
48
+ }
49
+ const { appleId } = await (0, prompts_1.promptAsync)({
50
+ type: 'text',
51
+ name: 'appleId',
52
+ message: `Enter your Apple ID:`,
53
+ validate: (val) => !!val,
54
+ initial: lastAppleId !== null && lastAppleId !== void 0 ? lastAppleId : undefined,
55
+ });
56
+ return appleId;
57
+ }
58
+ exports.getAppleIdUsernameAsync = getAppleIdUsernameAsync;
@@ -1,4 +1,6 @@
1
+ import { Platform } from '@expo/eas-build-job';
1
2
  import { AscApiKeyPath, MinimalAscApiKey } from '../../credentials/ios/credentials';
3
+ import { SubmissionContext } from '../context';
2
4
  export declare enum AscApiKeySourceType {
3
5
  path = 0,
4
6
  prompt = 1
@@ -18,11 +20,15 @@ declare type AscApiKeySummary = {
18
20
  source: 'local' | 'EAS servers';
19
21
  path?: string;
20
22
  keyId: string;
23
+ name?: string;
24
+ };
25
+ export declare type AscApiKeyFromExpoServers = {
26
+ ascApiKeyId: string;
21
27
  };
22
28
  export declare type AscApiKeyResult = {
23
- result: MinimalAscApiKey;
29
+ result: MinimalAscApiKey | AscApiKeyFromExpoServers;
24
30
  summary: AscApiKeySummary;
25
31
  };
26
- export declare function getAscApiKeyLocallyAsync(source: AscApiKeySource): Promise<AscApiKeyResult>;
27
- export declare function getAscApiKeyPathAsync(source: AscApiKeySource): Promise<AscApiKeyPath>;
32
+ export declare function getAscApiKeyLocallyAsync(ctx: SubmissionContext<Platform.IOS>, source: AscApiKeySource): Promise<AscApiKeyResult>;
33
+ export declare function getAscApiKeyPathAsync(ctx: SubmissionContext<Platform.IOS>, source: AscApiKeySource): Promise<AscApiKeyPath>;
28
34
  export {};
@@ -11,8 +11,8 @@ var AscApiKeySourceType;
11
11
  AscApiKeySourceType[AscApiKeySourceType["path"] = 0] = "path";
12
12
  AscApiKeySourceType[AscApiKeySourceType["prompt"] = 1] = "prompt";
13
13
  })(AscApiKeySourceType = exports.AscApiKeySourceType || (exports.AscApiKeySourceType = {}));
14
- async function getAscApiKeyLocallyAsync(source) {
15
- const ascApiKeyPath = await getAscApiKeyPathAsync(source);
14
+ async function getAscApiKeyLocallyAsync(ctx, source) {
15
+ const ascApiKeyPath = await getAscApiKeyPathAsync(ctx, source);
16
16
  const { keyP8Path, keyId, issuerId } = ascApiKeyPath;
17
17
  const keyP8 = await fs_extra_1.default.readFile(keyP8Path, 'utf-8');
18
18
  return {
@@ -25,26 +25,26 @@ async function getAscApiKeyLocallyAsync(source) {
25
25
  };
26
26
  }
27
27
  exports.getAscApiKeyLocallyAsync = getAscApiKeyLocallyAsync;
28
- async function getAscApiKeyPathAsync(source) {
28
+ async function getAscApiKeyPathAsync(ctx, source) {
29
29
  switch (source.sourceType) {
30
30
  case AscApiKeySourceType.path:
31
- return await handlePathSourceAsync(source);
31
+ return await handlePathSourceAsync(ctx, source);
32
32
  case AscApiKeySourceType.prompt:
33
- return await handlePromptSourceAsync(source);
33
+ return await handlePromptSourceAsync(ctx, source);
34
34
  }
35
35
  }
36
36
  exports.getAscApiKeyPathAsync = getAscApiKeyPathAsync;
37
- async function handlePathSourceAsync(source) {
37
+ async function handlePathSourceAsync(ctx, source) {
38
38
  const { keyP8Path } = source.path;
39
39
  if (!(await (0, files_1.isExistingFileAsync)(keyP8Path))) {
40
40
  log_1.default.warn(`File ${keyP8Path} doesn't exist.`);
41
- return await getAscApiKeyPathAsync({ sourceType: AscApiKeySourceType.prompt });
41
+ return await getAscApiKeyPathAsync(ctx, { sourceType: AscApiKeySourceType.prompt });
42
42
  }
43
43
  return source.path;
44
44
  }
45
- async function handlePromptSourceAsync(_source) {
46
- const ascApiKeyPath = await (0, AscApiKeyUtils_1.promptForAscApiKeyAsync)();
47
- return await getAscApiKeyPathAsync({
45
+ async function handlePromptSourceAsync(ctx, _source) {
46
+ const ascApiKeyPath = await (0, AscApiKeyUtils_1.promptForAscApiKeyPathAsync)(ctx.credentialsCtx);
47
+ return await getAscApiKeyPathAsync(ctx, {
48
48
  sourceType: AscApiKeySourceType.path,
49
49
  path: ascApiKeyPath,
50
50
  });
@@ -0,0 +1,15 @@
1
+ import { Platform } from '@expo/eas-build-job';
2
+ import { SubmissionContext } from '../context';
3
+ import { AppSpecificPasswordCredentials } from './AppSpecificPasswordSource';
4
+ import { AscApiKeyResult } from './AscApiKeySource';
5
+ /**
6
+ * The Credentials Service will either return an ASC API Key or an App Specific Password
7
+ * When we no longer support the App Specific Password user prompt, refactor this into the AscApiKeySource
8
+ */
9
+ export declare const CREDENTIALS_SERVICE_SOURCE = "CREDENTIALS_SERVICE_SOURCE";
10
+ export declare type CredentialsServiceSource = typeof CREDENTIALS_SERVICE_SOURCE;
11
+ export declare function getFromCredentialsServiceAsync(ctx: SubmissionContext<Platform.IOS>): Promise<{
12
+ appSpecificPassword: AppSpecificPasswordCredentials;
13
+ } | {
14
+ ascApiKeyResult: AscApiKeyResult;
15
+ }>;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFromCredentialsServiceAsync = exports.CREDENTIALS_SERVICE_SOURCE = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const nullthrows_1 = (0, tslib_1.__importDefault)(require("nullthrows"));
6
+ const SetUpSubmissionCredentials_1 = require("../../credentials/ios/actions/SetUpSubmissionCredentials");
7
+ const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
8
+ const bundleIdentifier_1 = require("../../project/ios/bundleIdentifier");
9
+ const Account_1 = require("../../user/Account");
10
+ const AppSpecificPasswordSource_1 = require("./AppSpecificPasswordSource");
11
+ /**
12
+ * The Credentials Service will either return an ASC API Key or an App Specific Password
13
+ * When we no longer support the App Specific Password user prompt, refactor this into the AscApiKeySource
14
+ */
15
+ exports.CREDENTIALS_SERVICE_SOURCE = 'CREDENTIALS_SERVICE_SOURCE';
16
+ async function getFromCredentialsServiceAsync(ctx) {
17
+ const bundleIdentifier = await (0, bundleIdentifier_1.getBundleIdentifierAsync)(ctx.projectDir, ctx.exp);
18
+ log_1.default.log(`Looking up credentials configuration for ${bundleIdentifier}...`);
19
+ const appLookupParams = {
20
+ account: (0, nullthrows_1.default)((0, Account_1.findAccountByName)(ctx.user.accounts, ctx.accountName), `You do not have access to account: ${ctx.accountName}`),
21
+ projectName: ctx.projectName,
22
+ bundleIdentifier,
23
+ };
24
+ const setupSubmissionCredentialsAction = new SetUpSubmissionCredentials_1.SetUpSubmissionCredentials(appLookupParams);
25
+ const ascOrAsp = await setupSubmissionCredentialsAction.runAsync(ctx.credentialsCtx);
26
+ const isAppSpecificPassword = typeof ascOrAsp === 'string';
27
+ if (isAppSpecificPassword) {
28
+ return {
29
+ appSpecificPassword: {
30
+ password: ascOrAsp,
31
+ appleIdUsername: await (0, AppSpecificPasswordSource_1.getAppleIdUsernameAsync)(ctx),
32
+ },
33
+ };
34
+ }
35
+ else {
36
+ const ascKeyForSubmissions = (0, nullthrows_1.default)(ascOrAsp.appStoreConnectApiKeyForSubmissions, `An EAS Submit ASC API Key could not be found for ${ascOrAsp.appleAppIdentifier.bundleIdentifier}`);
37
+ const { id, keyIdentifier, name } = ascKeyForSubmissions;
38
+ return {
39
+ ascApiKeyResult: {
40
+ result: {
41
+ ascApiKeyId: id,
42
+ },
43
+ summary: {
44
+ source: 'EAS servers',
45
+ keyId: keyIdentifier,
46
+ name: name !== null && name !== void 0 ? name : undefined,
47
+ },
48
+ },
49
+ };
50
+ }
51
+ }
52
+ exports.getFromCredentialsServiceAsync = getFromCredentialsServiceAsync;
@@ -5,11 +5,10 @@ export default class IosSubmitCommand {
5
5
  private ctx;
6
6
  constructor(ctx: SubmissionContext<Platform.IOS>);
7
7
  runAsync(): Promise<SubmissionFragment>;
8
- private resolveCredentialSubmissionOptionsAsync;
8
+ private resolveCredentialSubmissionOptions;
9
9
  private resolveSubmissionOptionsAsync;
10
10
  private resolveAppSpecificPasswordSource;
11
11
  private resolveAscApiKeySource;
12
12
  private resolveArchiveSource;
13
13
  private resolveAscAppIdentifierAsync;
14
- private resolveAppleIdUsernameAsync;
15
14
  }
@@ -8,12 +8,11 @@ const getenv_1 = (0, tslib_1.__importDefault)(require("getenv"));
8
8
  const wrap_ansi_1 = (0, tslib_1.__importDefault)(require("wrap-ansi"));
9
9
  const errors_1 = require("../../credentials/errors");
10
10
  const log_1 = (0, tslib_1.__importStar)(require("../../log"));
11
- const prompts_1 = require("../../prompts");
12
- const UserSettings_1 = (0, tslib_1.__importDefault)(require("../../user/UserSettings"));
13
11
  const commons_1 = require("../commons");
14
12
  const AppProduce_1 = require("./AppProduce");
15
13
  const AppSpecificPasswordSource_1 = require("./AppSpecificPasswordSource");
16
14
  const AscApiKeySource_1 = require("./AscApiKeySource");
15
+ const CredentialsServiceSource_1 = require("./CredentialsServiceSource");
17
16
  const IosSubmitter_1 = (0, tslib_1.__importDefault)(require("./IosSubmitter"));
18
17
  class IosSubmitCommand {
19
18
  constructor(ctx) {
@@ -25,32 +24,39 @@ class IosSubmitCommand {
25
24
  const submitter = new IosSubmitter_1.default(this.ctx, options);
26
25
  return await submitter.submitAsync();
27
26
  }
28
- async resolveCredentialSubmissionOptionsAsync() {
29
- // Fall back to app specific password if no ascApiKey defined
27
+ resolveCredentialSubmissionOptions() {
30
28
  const ascApiKeySource = this.resolveAscApiKeySource();
31
- const shouldUseAppSpecificPassword = !ascApiKeySource.ok && ascApiKeySource.enforceError() instanceof errors_1.MissingCredentialsError;
32
- if (shouldUseAppSpecificPassword) {
33
- return { appSpecificPasswordSource: this.resolveAppSpecificPasswordSource() };
34
- }
35
- else {
29
+ const shouldSkipAscApiKeySource = !ascApiKeySource.ok && ascApiKeySource.enforceError() instanceof errors_1.MissingCredentialsError;
30
+ if (!shouldSkipAscApiKeySource) {
36
31
  return { ascApiKeySource };
37
32
  }
33
+ const appSpecificPasswordSource = this.resolveAppSpecificPasswordSource();
34
+ const shouldSkipAppSpecificPasswordSource = !appSpecificPasswordSource.ok &&
35
+ appSpecificPasswordSource.enforceError() instanceof errors_1.MissingCredentialsError;
36
+ if (!shouldSkipAppSpecificPasswordSource) {
37
+ return { appSpecificPasswordSource: this.resolveAppSpecificPasswordSource() };
38
+ }
39
+ return {
40
+ credentialsServiceSource: (0, results_1.result)(CredentialsServiceSource_1.CREDENTIALS_SERVICE_SOURCE),
41
+ };
38
42
  }
39
43
  async resolveSubmissionOptionsAsync() {
40
44
  const archiveSource = this.resolveArchiveSource();
41
- const credentialsSource = await this.resolveCredentialSubmissionOptionsAsync();
45
+ const credentialsSource = this.resolveCredentialSubmissionOptions();
42
46
  const maybeAppSpecificPasswordSource = 'appSpecificPasswordSource' in credentialsSource
43
47
  ? credentialsSource.appSpecificPasswordSource
44
48
  : null;
45
49
  const maybeAscApiKeySource = 'ascApiKeySource' in credentialsSource ? credentialsSource.ascApiKeySource : null;
50
+ const maybeCredentialsServiceSource = 'credentialsServiceSource' in credentialsSource
51
+ ? credentialsSource.credentialsServiceSource
52
+ : null;
46
53
  const ascAppIdentifier = await this.resolveAscAppIdentifierAsync();
47
- const appleIdUsername = await this.resolveAppleIdUsernameAsync();
48
54
  const errored = [
49
55
  archiveSource,
50
56
  ...(maybeAppSpecificPasswordSource ? [maybeAppSpecificPasswordSource] : []),
51
57
  ...(maybeAscApiKeySource ? [maybeAscApiKeySource] : []),
58
+ ...(maybeCredentialsServiceSource ? [maybeCredentialsServiceSource] : []),
52
59
  ascAppIdentifier,
53
- appleIdUsername,
54
60
  ].filter(r => !r.ok);
55
61
  if (errored.length > 0) {
56
62
  const message = errored.map(err => { var _a; return (_a = err.reason) === null || _a === void 0 ? void 0 : _a.message; }).join('\n');
@@ -59,7 +65,6 @@ class IosSubmitCommand {
59
65
  }
60
66
  return {
61
67
  projectId: this.ctx.projectId,
62
- appleIdUsername: appleIdUsername.enforceValue(),
63
68
  ascAppIdentifier: ascAppIdentifier.enforceValue(),
64
69
  archiveSource: archiveSource.enforceValue(),
65
70
  ...(maybeAppSpecificPasswordSource
@@ -72,6 +77,11 @@ class IosSubmitCommand {
72
77
  ascApiKeySource: maybeAscApiKeySource.enforceValue(),
73
78
  }
74
79
  : null),
80
+ ...(maybeCredentialsServiceSource
81
+ ? {
82
+ credentialsServiceSource: maybeCredentialsServiceSource.enforceValue(),
83
+ }
84
+ : null),
75
85
  };
76
86
  }
77
87
  resolveAppSpecificPasswordSource() {
@@ -82,14 +92,7 @@ class IosSubmitCommand {
82
92
  appSpecificPassword: envAppSpecificPassword,
83
93
  });
84
94
  }
85
- else if (this.ctx.nonInteractive) {
86
- return (0, results_1.result)(new Error('Set the EXPO_APPLE_APP_SPECIFIC_PASSWORD environment variable.'));
87
- }
88
- else {
89
- return (0, results_1.result)({
90
- sourceType: AppSpecificPasswordSource_1.AppSpecificPasswordSourceType.prompt,
91
- });
92
- }
95
+ return (0, results_1.result)(new errors_1.MissingCredentialsError('The EXPO_APPLE_APP_SPECIFIC_PASSWORD environment variable must be set.'));
93
96
  }
94
97
  resolveAscApiKeySource() {
95
98
  const { ascApiKeyPath, ascApiKeyIssuerId, ascApiKeyId } = this.ctx.profile;
@@ -140,37 +143,5 @@ class IosSubmitCommand {
140
143
  }
141
144
  }
142
145
  }
143
- async resolveAppleIdUsernameAsync() {
144
- var _a;
145
- if (this.ctx.profile.appleId) {
146
- return (0, results_1.result)(this.ctx.profile.appleId);
147
- }
148
- const envAppleId = getenv_1.default.string('EXPO_APPLE_ID', '');
149
- if (envAppleId) {
150
- return (0, results_1.result)(envAppleId);
151
- }
152
- if ((_a = this.ctx.credentialsCtx.appStore.authCtx) === null || _a === void 0 ? void 0 : _a.appleId) {
153
- return (0, results_1.result)(this.ctx.credentialsCtx.appStore.authCtx.appleId);
154
- }
155
- // Get the email address that was last used and set it as
156
- // the default value for quicker authentication.
157
- const lastAppleId = await UserSettings_1.default.getAsync('appleId', null);
158
- if (this.ctx.nonInteractive) {
159
- if (lastAppleId) {
160
- return (0, results_1.result)(lastAppleId);
161
- }
162
- else {
163
- return (0, results_1.result)(new Error('Set appleId in the submit profile (eas.json).'));
164
- }
165
- }
166
- const { appleId } = await (0, prompts_1.promptAsync)({
167
- type: 'text',
168
- name: 'appleId',
169
- message: `Enter your Apple ID:`,
170
- validate: (val) => !!val,
171
- initial: lastAppleId !== null && lastAppleId !== void 0 ? lastAppleId : undefined,
172
- });
173
- return (0, results_1.result)(appleId);
174
- }
175
146
  }
176
147
  exports.default = IosSubmitCommand;
@@ -1,19 +1,32 @@
1
1
  import { Platform } from '@expo/eas-build-job';
2
2
  import { IosSubmissionConfigInput, SubmissionFragment } from '../../graphql/generated';
3
- import { ArchiveSource } from '../ArchiveSource';
3
+ import { Archive, ArchiveSource } from '../ArchiveSource';
4
4
  import BaseSubmitter, { SubmissionInput } from '../BaseSubmitter';
5
- import { AppSpecificPasswordSource } from './AppSpecificPasswordSource';
6
- import { AscApiKeySource } from './AscApiKeySource';
5
+ import { SubmissionContext } from '../context';
6
+ import { AppSpecificPasswordCredentials, AppSpecificPasswordSource } from './AppSpecificPasswordSource';
7
+ import { AscApiKeyResult, AscApiKeySource } from './AscApiKeySource';
8
+ import { CredentialsServiceSource } from './CredentialsServiceSource';
7
9
  export interface IosSubmissionOptions extends Pick<IosSubmissionConfigInput, 'appleIdUsername' | 'ascAppIdentifier'> {
8
10
  projectId: string;
9
11
  archiveSource: ArchiveSource;
10
12
  appSpecificPasswordSource?: AppSpecificPasswordSource;
11
13
  ascApiKeySource?: AscApiKeySource;
14
+ credentialsServiceSource?: CredentialsServiceSource;
12
15
  }
13
- export default class IosSubmitter extends BaseSubmitter<Platform.IOS, IosSubmissionOptions> {
14
- submitAsync(): Promise<SubmissionFragment>;
16
+ interface ResolvedSourceOptions {
17
+ archive: Archive;
18
+ credentials: {
19
+ appSpecificPassword?: AppSpecificPasswordCredentials;
20
+ ascApiKeyResult?: AscApiKeyResult;
21
+ };
22
+ }
23
+ export default class IosSubmitter extends BaseSubmitter<Platform.IOS, ResolvedSourceOptions, IosSubmissionOptions> {
24
+ constructor(ctx: SubmissionContext<Platform.IOS>, options: IosSubmissionOptions);
25
+ createSubmissionInputAsync(resolvedSourceOptions: ResolvedSourceOptions): Promise<SubmissionInput<Platform.IOS>>;
15
26
  protected createPlatformSubmissionAsync({ projectId, submissionConfig, buildId, }: SubmissionInput<Platform.IOS>): Promise<SubmissionFragment>;
16
- private resolveSourceOptionsAsync;
17
- private formatSubmissionConfigAsync;
27
+ private formatSubmissionConfig;
28
+ private formatAppSpecificPassword;
29
+ private formatAscApiKeyResult;
18
30
  private prepareSummaryData;
19
31
  }
32
+ export {};
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
5
+ const events_1 = require("../../analytics/events");
5
6
  const SubmissionMutation_1 = require("../../graphql/mutations/SubmissionMutation");
6
7
  const formatFields_1 = (0, tslib_1.__importDefault)(require("../../utils/formatFields"));
7
8
  const ArchiveSource_1 = require("../ArchiveSource");
@@ -9,17 +10,53 @@ const BaseSubmitter_1 = (0, tslib_1.__importDefault)(require("../BaseSubmitter")
9
10
  const summary_1 = require("../utils/summary");
10
11
  const AppSpecificPasswordSource_1 = require("./AppSpecificPasswordSource");
11
12
  const AscApiKeySource_1 = require("./AscApiKeySource");
13
+ const CredentialsServiceSource_1 = require("./CredentialsServiceSource");
12
14
  class IosSubmitter extends BaseSubmitter_1.default {
13
- async submitAsync() {
15
+ constructor(ctx, options) {
16
+ const sourceOptionsResolver = {
17
+ // eslint-disable-next-line async-protect/async-suffix
18
+ archive: async () => await (0, ArchiveSource_1.getArchiveAsync)(this.options.archiveSource),
19
+ // eslint-disable-next-line async-protect/async-suffix
20
+ credentials: async () => {
21
+ const maybeAppSpecificPassword = this.options.appSpecificPasswordSource
22
+ ? await (0, AppSpecificPasswordSource_1.getAppSpecificPasswordLocallyAsync)(this.ctx, this.options.appSpecificPasswordSource)
23
+ : null;
24
+ const maybeAppStoreConnectApiKey = this.options.ascApiKeySource
25
+ ? await (0, AscApiKeySource_1.getAscApiKeyLocallyAsync)(this.ctx, this.options.ascApiKeySource)
26
+ : null;
27
+ const maybeAscOrAspFromCredentialsService = this.options.credentialsServiceSource
28
+ ? await (0, CredentialsServiceSource_1.getFromCredentialsServiceAsync)(this.ctx)
29
+ : null;
30
+ return {
31
+ ...(maybeAppSpecificPassword ? { appSpecificPassword: maybeAppSpecificPassword } : null),
32
+ ...(maybeAppStoreConnectApiKey ? { ascApiKeyResult: maybeAppStoreConnectApiKey } : null),
33
+ ...(maybeAscOrAspFromCredentialsService ? maybeAscOrAspFromCredentialsService : null),
34
+ };
35
+ },
36
+ };
37
+ const sourceOptionsAnalytics = {
38
+ archive: {
39
+ attemptEvent: events_1.SubmissionEvent.GATHER_ARCHIVE_ATTEMPT,
40
+ successEvent: events_1.SubmissionEvent.GATHER_ARCHIVE_SUCCESS,
41
+ failureEvent: events_1.SubmissionEvent.GATHER_ARCHIVE_FAIL,
42
+ },
43
+ credentials: {
44
+ attemptEvent: events_1.SubmissionEvent.GATHER_CREDENTIALS_ATTEMPT,
45
+ successEvent: events_1.SubmissionEvent.GATHER_CREDENTIALS_SUCCESS,
46
+ failureEvent: events_1.SubmissionEvent.GATHER_CREDENTIALS_FAIL,
47
+ },
48
+ };
49
+ super(ctx, options, sourceOptionsResolver, sourceOptionsAnalytics);
50
+ }
51
+ async createSubmissionInputAsync(resolvedSourceOptions) {
14
52
  var _a;
15
- const resolvedSourceOptions = await this.resolveSourceOptionsAsync();
16
- const submissionConfig = await this.formatSubmissionConfigAsync(this.options, resolvedSourceOptions);
53
+ const submissionConfig = this.formatSubmissionConfig(this.options, resolvedSourceOptions);
17
54
  (0, summary_1.printSummary)(this.prepareSummaryData(this.options, resolvedSourceOptions), SummaryHumanReadableKeys);
18
- return await this.createSubmissionAsync({
55
+ return {
19
56
  projectId: this.options.projectId,
20
57
  submissionConfig,
21
58
  buildId: (_a = resolvedSourceOptions.archive.build) === null || _a === void 0 ? void 0 : _a.id,
22
- });
59
+ };
23
60
  }
24
61
  async createPlatformSubmissionAsync({ projectId, submissionConfig, buildId, }) {
25
62
  return await SubmissionMutation_1.SubmissionMutation.createIosSubmissionAsync({
@@ -28,48 +65,43 @@ class IosSubmitter extends BaseSubmitter_1.default {
28
65
  submittedBuildId: buildId,
29
66
  });
30
67
  }
31
- async resolveSourceOptionsAsync() {
32
- const archive = await (0, ArchiveSource_1.getArchiveAsync)(this.options.archiveSource);
33
- const maybeAppSpecificPassword = this.options.appSpecificPasswordSource
34
- ? await (0, AppSpecificPasswordSource_1.getAppSpecificPasswordAsync)(this.options.appSpecificPasswordSource)
35
- : null;
36
- const maybeAppStoreConnectApiKey = this.options.ascApiKeySource
37
- ? await (0, AscApiKeySource_1.getAscApiKeyLocallyAsync)(this.options.ascApiKeySource)
38
- : null;
39
- return {
40
- archive,
41
- ...(maybeAppSpecificPassword ? { appSpecificPassword: maybeAppSpecificPassword } : null),
42
- ...(maybeAppStoreConnectApiKey ? { ascApiKeyResult: maybeAppStoreConnectApiKey } : null),
43
- };
44
- }
45
- async formatSubmissionConfigAsync(options, { archive, appSpecificPassword, ascApiKeyResult }) {
68
+ formatSubmissionConfig(options, { archive, credentials }) {
69
+ const { appSpecificPassword, ascApiKeyResult } = credentials;
46
70
  const { appleIdUsername, ascAppIdentifier } = options;
47
71
  return {
48
72
  ascAppIdentifier,
49
73
  appleIdUsername,
50
74
  archiveUrl: archive.url,
51
- appleAppSpecificPassword: appSpecificPassword,
52
- ...((ascApiKeyResult === null || ascApiKeyResult === void 0 ? void 0 : ascApiKeyResult.result)
53
- ? {
54
- ascApiKey: {
55
- keyP8: ascApiKeyResult === null || ascApiKeyResult === void 0 ? void 0 : ascApiKeyResult.result.keyP8,
56
- keyIdentifier: ascApiKeyResult === null || ascApiKeyResult === void 0 ? void 0 : ascApiKeyResult.result.keyId,
57
- issuerIdentifier: ascApiKeyResult === null || ascApiKeyResult === void 0 ? void 0 : ascApiKeyResult.result.issuerId,
58
- },
59
- }
60
- : null),
75
+ ...(appSpecificPassword ? this.formatAppSpecificPassword(appSpecificPassword) : null),
76
+ ...((ascApiKeyResult === null || ascApiKeyResult === void 0 ? void 0 : ascApiKeyResult.result) ? this.formatAscApiKeyResult(ascApiKeyResult.result) : null),
77
+ };
78
+ }
79
+ formatAppSpecificPassword(appSpecificPassword) {
80
+ return {
81
+ appleAppSpecificPassword: appSpecificPassword.password,
82
+ appleIdUsername: appSpecificPassword.appleIdUsername,
61
83
  };
62
84
  }
63
- prepareSummaryData(options, { archive, ascApiKeyResult }) {
64
- const { appleIdUsername, ascAppIdentifier, projectId } = options;
85
+ formatAscApiKeyResult(result) {
86
+ return 'ascApiKeyId' in result
87
+ ? { ascApiKeyId: result.ascApiKeyId }
88
+ : {
89
+ ascApiKey: {
90
+ keyP8: result.keyP8,
91
+ keyIdentifier: result.keyId,
92
+ issuerIdentifier: result.issuerId,
93
+ },
94
+ };
95
+ }
96
+ prepareSummaryData(options, { archive, credentials }) {
97
+ const { ascApiKeyResult, appSpecificPassword } = credentials;
98
+ const { ascAppIdentifier, projectId } = options;
65
99
  // structuring order affects table rows order
66
100
  return {
67
101
  ascAppIdentifier,
68
- appleIdUsername,
69
102
  projectId,
70
- ...(ascApiKeyResult
71
- ? { formattedAscApiKey: formatServiceAccountSummary(ascApiKeyResult) }
72
- : null),
103
+ ...(appSpecificPassword ? { appleIdUsername: appSpecificPassword.appleIdUsername } : null),
104
+ ...(ascApiKeyResult ? { formattedAscApiKey: formatAscApiKeySummary(ascApiKeyResult) } : null),
73
105
  ...(0, summary_1.formatArchiveSourceSummary)(archive),
74
106
  };
75
107
  }
@@ -82,11 +114,19 @@ const SummaryHumanReadableKeys = {
82
114
  archiveUrl: 'Archive URL',
83
115
  archivePath: 'Archive Path',
84
116
  formattedBuild: 'Build',
85
- formattedAscApiKey: 'App Store Connect Api Key',
117
+ formattedAscApiKey: 'App Store Connect API Key',
86
118
  };
87
- function formatServiceAccountSummary({ summary }) {
88
- const { source, path, keyId } = summary;
119
+ function formatAscApiKeySummary({ summary }) {
120
+ const { source, path, keyId, name } = summary;
89
121
  const fields = [
122
+ {
123
+ label: 'Key Name',
124
+ value: name,
125
+ },
126
+ {
127
+ label: 'Key ID',
128
+ value: keyId,
129
+ },
90
130
  {
91
131
  label: 'Key Source',
92
132
  value: source,
@@ -95,10 +135,6 @@ function formatServiceAccountSummary({ summary }) {
95
135
  label: 'Key Path',
96
136
  value: path,
97
137
  },
98
- {
99
- label: 'Key ID',
100
- value: keyId,
101
- },
102
138
  ];
103
139
  const filteredFields = fields.filter(({ value }) => value !== undefined && value !== null);
104
140
  return ('\n' +