eas-cli 0.33.0 → 0.35.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 (170) hide show
  1. package/README.md +27 -27
  2. package/build/analytics.js +3 -9
  3. package/build/api.js +3 -3
  4. package/build/build/android/UpdatesModule.js +4 -15
  5. package/build/build/android/configure.js +2 -2
  6. package/build/build/android/graphql.js +2 -4
  7. package/build/build/android/prepareJob.js +4 -3
  8. package/build/build/build.js +2 -2
  9. package/build/build/configure.js +14 -7
  10. package/build/build/ios/UpdatesModule.js +6 -18
  11. package/build/build/ios/graphql.js +2 -23
  12. package/build/build/ios/prepareJob.js +4 -6
  13. package/build/build/metadata.js +5 -10
  14. package/build/build/utils/devClient.js +8 -5
  15. package/build/build/utils/formatBuild.js +1 -9
  16. package/build/build/utils/repository.js +10 -7
  17. package/build/build/utils/url.js +1 -1
  18. package/build/build/validate.js +4 -4
  19. package/build/commandUtils/EasCommand.d.ts +1 -0
  20. package/build/commandUtils/EasCommand.js +21 -0
  21. package/build/commands/branch/create.js +3 -2
  22. package/build/commands/branch/delete.js +1 -1
  23. package/build/commands/branch/list.js +1 -1
  24. package/build/commands/branch/publish.js +20 -48
  25. package/build/commands/branch/view.js +1 -1
  26. package/build/commands/build/index.js +43 -24
  27. package/build/commands/channel/edit.js +1 -1
  28. package/build/commands/channel/list.js +1 -1
  29. package/build/commands/channel/view.js +1 -1
  30. package/build/commands/diagnostics.js +2 -2
  31. package/build/commands/project/info.js +1 -1
  32. package/build/commands/secret/delete.js +1 -1
  33. package/build/commands/update/view.js +1 -1
  34. package/build/credentials/android/AndroidCredentialsProvider.js +2 -2
  35. package/build/credentials/android/actions/{SetupBuildCredentials.d.ts → SetUpBuildCredentials.d.ts} +1 -1
  36. package/build/credentials/android/actions/{SetupBuildCredentials.js → SetUpBuildCredentials.js} +3 -3
  37. package/build/credentials/android/actions/{SetupBuildCredentialsFromCredentialsJson.d.ts → SetUpBuildCredentialsFromCredentialsJson.d.ts} +1 -1
  38. package/build/credentials/android/actions/{SetupBuildCredentialsFromCredentialsJson.js → SetUpBuildCredentialsFromCredentialsJson.js} +3 -3
  39. package/build/credentials/android/actions/{SetupGoogleServiceAccountKey.d.ts → SetUpGoogleServiceAccountKey.d.ts} +1 -1
  40. package/build/credentials/android/actions/{SetupGoogleServiceAccountKey.js → SetUpGoogleServiceAccountKey.js} +3 -3
  41. package/build/credentials/android/api/graphql/queries/GoogleServiceAccountKeyQuery.js +2 -0
  42. package/build/credentials/credentialsJson/update.js +5 -4
  43. package/build/credentials/errors.d.ts +4 -0
  44. package/build/credentials/errors.js +8 -1
  45. package/build/credentials/ios/IosCredentialsProvider.js +4 -4
  46. package/build/credentials/ios/actions/AscApiKeyUtils.d.ts +17 -1
  47. package/build/credentials/ios/actions/AscApiKeyUtils.js +156 -23
  48. package/build/credentials/ios/actions/AssignAscApiKey.d.ts +9 -0
  49. package/build/credentials/ios/actions/AssignAscApiKey.js +29 -0
  50. package/build/credentials/ios/actions/CreateAscApiKey.d.ts +9 -0
  51. package/build/credentials/ios/actions/CreateAscApiKey.js +21 -0
  52. package/build/credentials/ios/actions/CreateDistributionCertificate.js +1 -1
  53. package/build/credentials/ios/actions/CreatePushKey.js +1 -1
  54. package/build/credentials/ios/actions/DistributionCertificateUtils.d.ts +1 -1
  55. package/build/credentials/ios/actions/DistributionCertificateUtils.js +6 -8
  56. package/build/credentials/ios/actions/PushKeyUtils.d.ts +1 -1
  57. package/build/credentials/ios/actions/PushKeyUtils.js +6 -6
  58. package/build/credentials/ios/actions/RemoveAscApiKey.d.ts +14 -0
  59. package/build/credentials/ios/actions/RemoveAscApiKey.js +55 -0
  60. package/build/credentials/ios/actions/{SetupAdhocProvisioningProfile.d.ts → SetUpAdhocProvisioningProfile.d.ts} +1 -1
  61. package/build/credentials/ios/actions/{SetupAdhocProvisioningProfile.js → SetUpAdhocProvisioningProfile.js} +5 -5
  62. package/build/credentials/ios/actions/SetUpAscApiKey.d.ts +21 -0
  63. package/build/credentials/ios/actions/SetUpAscApiKey.js +114 -0
  64. package/build/credentials/ios/actions/{SetupBuildCredentials.d.ts → SetUpBuildCredentials.d.ts} +1 -1
  65. package/build/credentials/ios/actions/{SetupBuildCredentials.js → SetUpBuildCredentials.js} +5 -5
  66. package/build/credentials/ios/actions/{SetupBuildCredentialsFromCredentialsJson.d.ts → SetUpBuildCredentialsFromCredentialsJson.d.ts} +1 -1
  67. package/build/credentials/ios/actions/{SetupBuildCredentialsFromCredentialsJson.js → SetUpBuildCredentialsFromCredentialsJson.js} +5 -5
  68. package/build/credentials/ios/actions/{SetupDistributionCertificate.d.ts → SetUpDistributionCertificate.d.ts} +1 -1
  69. package/build/credentials/ios/actions/{SetupDistributionCertificate.js → SetUpDistributionCertificate.js} +3 -3
  70. package/build/credentials/ios/actions/{SetupInternalProvisioningProfile.d.ts → SetUpInternalProvisioningProfile.d.ts} +1 -1
  71. package/build/credentials/ios/actions/{SetupInternalProvisioningProfile.js → SetUpInternalProvisioningProfile.js} +7 -7
  72. package/build/credentials/ios/actions/{SetupProvisioningProfile.d.ts → SetUpProvisioningProfile.d.ts} +1 -1
  73. package/build/credentials/ios/actions/{SetupProvisioningProfile.js → SetUpProvisioningProfile.js} +5 -5
  74. package/build/credentials/ios/actions/{SetupPushKey.d.ts → SetUpPushKey.d.ts} +1 -1
  75. package/build/credentials/ios/actions/{SetupPushKey.js → SetUpPushKey.js} +3 -3
  76. package/build/credentials/ios/actions/SetUpSubmissionCredentials.d.ts +10 -0
  77. package/build/credentials/ios/actions/SetUpSubmissionCredentials.js +53 -0
  78. package/build/credentials/ios/actions/{SetupTargetBuildCredentials.d.ts → SetUpTargetBuildCredentials.d.ts} +1 -1
  79. package/build/credentials/ios/actions/{SetupTargetBuildCredentials.js → SetUpTargetBuildCredentials.js} +10 -10
  80. package/build/credentials/ios/actions/{SetupTargetBuildCredentialsFromCredentialsJson.d.ts → SetUpTargetBuildCredentialsFromCredentialsJson.d.ts} +1 -1
  81. package/build/credentials/ios/actions/{SetupTargetBuildCredentialsFromCredentialsJson.js → SetUpTargetBuildCredentialsFromCredentialsJson.js} +3 -3
  82. package/build/credentials/ios/api/GraphqlClient.d.ts +8 -2
  83. package/build/credentials/ios/api/GraphqlClient.js +74 -2
  84. package/build/credentials/ios/api/graphql/mutations/AppStoreConnectApiKeyMutation.d.ts +5 -0
  85. package/build/credentials/ios/api/graphql/mutations/AppStoreConnectApiKeyMutation.js +54 -0
  86. package/build/credentials/ios/api/graphql/mutations/IosAppCredentialsMutation.d.ts +1 -0
  87. package/build/credentials/ios/api/graphql/mutations/IosAppCredentialsMutation.js +25 -0
  88. package/build/credentials/ios/api/graphql/queries/AppQuery.js +3 -1
  89. package/build/credentials/ios/api/graphql/queries/AppStoreConnectApiKeyQuery.d.ts +4 -0
  90. package/build/credentials/ios/api/graphql/queries/AppStoreConnectApiKeyQuery.js +33 -0
  91. package/build/credentials/ios/api/graphql/queries/AppleDeviceQuery.js +6 -2
  92. package/build/credentials/ios/api/graphql/queries/AppleDistributionCertificateQuery.js +7 -1
  93. package/build/credentials/ios/api/graphql/queries/AppleProvisioningProfileQuery.js +5 -1
  94. package/build/credentials/ios/api/graphql/queries/ApplePushKeyQuery.js +2 -0
  95. package/build/credentials/ios/api/graphql/queries/AppleTeamQuery.js +5 -1
  96. package/build/credentials/ios/appstore/AppStoreApi.d.ts +1 -1
  97. package/build/credentials/ios/appstore/Credentials.types.d.ts +1 -0
  98. package/build/credentials/ios/appstore/ascApiKey.d.ts +1 -1
  99. package/build/credentials/ios/appstore/ascApiKey.js +22 -12
  100. package/build/credentials/ios/credentials.d.ts +2 -1
  101. package/build/credentials/ios/credentials.js +8 -3
  102. package/build/credentials/ios/utils/printCredentials.js +30 -1
  103. package/build/credentials/ios/validators/validateAscApiKey.d.ts +5 -0
  104. package/build/credentials/ios/validators/validateAscApiKey.js +21 -0
  105. package/build/credentials/manager/Actions.d.ts +52 -0
  106. package/build/credentials/manager/Actions.js +53 -0
  107. package/build/credentials/manager/AndroidActions.d.ts +6 -0
  108. package/build/credentials/manager/AndroidActions.js +114 -0
  109. package/build/credentials/manager/IosActions.d.ts +7 -0
  110. package/build/credentials/manager/IosActions.js +145 -0
  111. package/build/credentials/manager/ManageAndroid.d.ts +1 -29
  112. package/build/credentials/manager/ManageAndroid.js +30 -163
  113. package/build/credentials/manager/ManageIos.d.ts +1 -29
  114. package/build/credentials/manager/ManageIos.js +78 -166
  115. package/build/credentials/utils/promptForCredentials.d.ts +2 -1
  116. package/build/credentials/utils/promptForCredentials.js +3 -2
  117. package/build/graphql/client.d.ts +8 -2
  118. package/build/graphql/client.js +1 -1
  119. package/build/graphql/generated.d.ts +170 -33
  120. package/build/graphql/generated.js +23 -1
  121. package/build/graphql/queries/BuildQuery.js +4 -1
  122. package/build/graphql/queries/EnvironmentSecretsQuery.js +4 -2
  123. package/build/graphql/queries/ProjectQuery.js +3 -1
  124. package/build/graphql/queries/PublishQuery.js +4 -1
  125. package/build/graphql/queries/SubmissionQuery.js +5 -2
  126. package/build/graphql/queries/UserQuery.js +4 -1
  127. package/build/graphql/queries/WebhookQuery.js +6 -2
  128. package/build/graphql/types/Build.js +1 -6
  129. package/build/graphql/types/credentials/AppStoreConnectApiKey.d.ts +1 -0
  130. package/build/graphql/types/credentials/AppStoreConnectApiKey.js +23 -0
  131. package/build/graphql/types/credentials/IosAppCredentials.js +6 -0
  132. package/build/log.d.ts +0 -2
  133. package/build/log.js +2 -12
  134. package/build/project/projectUtils.js +1 -1
  135. package/build/project/publish.js +2 -2
  136. package/build/project/workflow.js +2 -2
  137. package/build/submit/ArchiveSource.js +6 -5
  138. package/build/submit/android/ServiceAccountSource.js +2 -2
  139. package/build/submit/ios/AppSpecificPasswordSource.d.ts +2 -6
  140. package/build/submit/ios/AppSpecificPasswordSource.js +0 -18
  141. package/build/submit/ios/AscApiKeySource.d.ts +9 -3
  142. package/build/submit/ios/AscApiKeySource.js +10 -10
  143. package/build/submit/ios/CredentialsServiceSource.d.ts +14 -0
  144. package/build/submit/ios/CredentialsServiceSource.js +46 -0
  145. package/build/submit/ios/IosSubmitCommand.js +22 -14
  146. package/build/submit/ios/IosSubmitter.d.ts +3 -0
  147. package/build/submit/ios/IosSubmitter.js +30 -20
  148. package/build/submit/utils/errors.js +2 -0
  149. package/build/user/User.js +1 -0
  150. package/build/utils/easCli.d.ts +1 -0
  151. package/build/utils/easCli.js +5 -0
  152. package/build/utils/{expoCommand.d.ts → expoCli.d.ts} +0 -0
  153. package/build/utils/{expoCommand.js → expoCli.js} +0 -0
  154. package/build/utils/profiles.js +9 -2
  155. package/build/vcs/clients/git.d.ts +26 -0
  156. package/build/vcs/clients/git.js +184 -0
  157. package/build/vcs/clients/gitNoCommit.d.ts +7 -0
  158. package/build/vcs/clients/gitNoCommit.js +27 -0
  159. package/build/vcs/clients/noVcs.d.ts +6 -0
  160. package/build/vcs/clients/noVcs.js +19 -0
  161. package/build/vcs/git.d.ts +10 -17
  162. package/build/vcs/git.js +7 -175
  163. package/build/vcs/index.d.ts +2 -2
  164. package/build/vcs/index.js +15 -6
  165. package/build/vcs/local.d.ts +18 -5
  166. package/build/vcs/local.js +61 -32
  167. package/build/vcs/vcs.d.ts +2 -1
  168. package/build/vcs/vcs.js +8 -4
  169. package/oclif.manifest.json +1 -1
  170. package/package.json +10 -10
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SetupTargetBuildCredentials = void 0;
3
+ exports.SetUpTargetBuildCredentials = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const generated_1 = require("../../../graphql/generated");
6
6
  const log_1 = (0, tslib_1.__importDefault)(require("../../../log"));
7
- const SetupAdhocProvisioningProfile_1 = require("./SetupAdhocProvisioningProfile");
8
- const SetupInternalProvisioningProfile_1 = require("./SetupInternalProvisioningProfile");
9
- const SetupProvisioningProfile_1 = require("./SetupProvisioningProfile");
10
- class SetupTargetBuildCredentials {
7
+ const SetUpAdhocProvisioningProfile_1 = require("./SetUpAdhocProvisioningProfile");
8
+ const SetUpInternalProvisioningProfile_1 = require("./SetUpInternalProvisioningProfile");
9
+ const SetUpProvisioningProfile_1 = require("./SetUpProvisioningProfile");
10
+ class SetUpTargetBuildCredentials {
11
11
  constructor(options) {
12
12
  this.options = options;
13
13
  }
@@ -33,18 +33,18 @@ class SetupTargetBuildCredentials {
33
33
  const { app, distribution, enterpriseProvisioning } = this.options;
34
34
  if (distribution === 'internal') {
35
35
  if (enterpriseProvisioning === 'adhoc') {
36
- return await new SetupAdhocProvisioningProfile_1.SetupAdhocProvisioningProfile(app).runAsync(ctx);
36
+ return await new SetUpAdhocProvisioningProfile_1.SetUpAdhocProvisioningProfile(app).runAsync(ctx);
37
37
  }
38
38
  else if (enterpriseProvisioning === 'universal') {
39
- return await new SetupProvisioningProfile_1.SetupProvisioningProfile(app, generated_1.IosDistributionType.Enterprise).runAsync(ctx);
39
+ return await new SetUpProvisioningProfile_1.SetUpProvisioningProfile(app, generated_1.IosDistributionType.Enterprise).runAsync(ctx);
40
40
  }
41
41
  else {
42
- return await new SetupInternalProvisioningProfile_1.SetupInternalProvisioningProfile(app).runAsync(ctx);
42
+ return await new SetUpInternalProvisioningProfile_1.SetUpInternalProvisioningProfile(app).runAsync(ctx);
43
43
  }
44
44
  }
45
45
  else {
46
- return await new SetupProvisioningProfile_1.SetupProvisioningProfile(app, generated_1.IosDistributionType.AppStore).runAsync(ctx);
46
+ return await new SetUpProvisioningProfile_1.SetUpProvisioningProfile(app, generated_1.IosDistributionType.AppStore).runAsync(ctx);
47
47
  }
48
48
  }
49
49
  }
50
- exports.SetupTargetBuildCredentials = SetupTargetBuildCredentials;
50
+ exports.SetUpTargetBuildCredentials = SetUpTargetBuildCredentials;
@@ -2,7 +2,7 @@ import { AppleDistributionCertificateFragment, AppleProvisioningProfileFragment,
2
2
  import { CredentialsContext } from '../../context';
3
3
  import { IosTargetCredentials } from '../../credentialsJson/types';
4
4
  import { AppLookupParams } from '../api/GraphqlClient';
5
- export declare class SetupTargetBuildCredentialsFromCredentialsJson {
5
+ export declare class SetUpTargetBuildCredentialsFromCredentialsJson {
6
6
  private app;
7
7
  private distributionType;
8
8
  private targetCredentials;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SetupTargetBuildCredentialsFromCredentialsJson = void 0;
3
+ exports.SetUpTargetBuildCredentialsFromCredentialsJson = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
6
6
  const nullthrows_1 = (0, tslib_1.__importDefault)(require("nullthrows"));
@@ -9,7 +9,7 @@ const prompts_1 = require("../../../prompts");
9
9
  const printCredentials_1 = require("../utils/printCredentials");
10
10
  const provisioningProfile_1 = require("../utils/provisioningProfile");
11
11
  const BuildCredentialsUtils_1 = require("./BuildCredentialsUtils");
12
- class SetupTargetBuildCredentialsFromCredentialsJson {
12
+ class SetUpTargetBuildCredentialsFromCredentialsJson {
13
13
  constructor(app, distributionType, targetCredentials) {
14
14
  this.app = app;
15
15
  this.distributionType = distributionType;
@@ -101,7 +101,7 @@ class SetupTargetBuildCredentialsFromCredentialsJson {
101
101
  });
102
102
  }
103
103
  }
104
- exports.SetupTargetBuildCredentialsFromCredentialsJson = SetupTargetBuildCredentialsFromCredentialsJson;
104
+ exports.SetUpTargetBuildCredentialsFromCredentialsJson = SetUpTargetBuildCredentialsFromCredentialsJson;
105
105
  function displaySingleTargetProjectCredentials(app, buildCredentials) {
106
106
  const targetName = app.projectName;
107
107
  (0, printCredentials_1.displayProjectCredentials)(app, { [targetName]: buildCredentials }, [
@@ -1,6 +1,7 @@
1
- import { AppleAppIdentifierFragment, AppleDeviceFragment, AppleDistributionCertificateFragment, ApplePushKeyFragment, AppleTeamFragment, CommonIosAppCredentialsFragment, IosAppBuildCredentialsFragment, IosDistributionType } from '../../../graphql/generated';
1
+ import { AppStoreConnectApiKeyFragment, AppleAppIdentifierFragment, AppleDeviceFragment, AppleDistributionCertificateFragment, ApplePushKeyFragment, AppleTeamFragment, CommonIosAppCredentialsFragment, IosAppBuildCredentialsFragment, IosDistributionType } from '../../../graphql/generated';
2
2
  import { Account } from '../../../user/Account';
3
3
  import { DistributionCertificate, PushKey } from '../appstore/Credentials.types';
4
+ import { MinimalAscApiKey } from '../credentials';
4
5
  import { AppleDistributionCertificateMutationResult } from './graphql/mutations/AppleDistributionCertificateMutation';
5
6
  import { AppleProvisioningProfileMutationResult } from './graphql/mutations/AppleProvisioningProfileMutation';
6
7
  import { AppleProvisioningProfileQueryResult } from './graphql/queries/AppleProvisioningProfileQuery';
@@ -24,8 +25,9 @@ export declare function getIosAppCredentialsWithCommonFieldsAsync(appLookupParam
24
25
  export declare function createOrGetIosAppCredentialsWithCommonFieldsAsync(appLookupParams: AppLookupParams, { appleTeam, }: {
25
26
  appleTeam?: AppleTeamFragment;
26
27
  }): Promise<CommonIosAppCredentialsFragment>;
27
- export declare function updateIosAppCredentialsAsync(appCredentials: CommonIosAppCredentialsFragment, { applePushKeyId, }: {
28
+ export declare function updateIosAppCredentialsAsync(appCredentials: CommonIosAppCredentialsFragment, { applePushKeyId, ascApiKeyIdForSubmissions, }: {
28
29
  applePushKeyId?: string;
30
+ ascApiKeyIdForSubmissions?: string;
29
31
  }): Promise<CommonIosAppCredentialsFragment>;
30
32
  export declare function createOrGetExistingAppleTeamAsync(account: Account, { appleTeamIdentifier, appleTeamName }: {
31
33
  appleTeamIdentifier: string;
@@ -57,3 +59,7 @@ export declare function createPushKeyAsync(account: Account, pushKey: PushKey):
57
59
  export declare function getPushKeysForAccountAsync(account: Account): Promise<ApplePushKeyFragment[]>;
58
60
  export declare function getPushKeyForAppAsync(appLookupParams: AppLookupParams): Promise<ApplePushKeyFragment | null>;
59
61
  export declare function deletePushKeyAsync(pushKeyId: string): Promise<void>;
62
+ export declare function createAscApiKeyAsync(account: Account, ascApiKey: MinimalAscApiKey): Promise<AppStoreConnectApiKeyFragment>;
63
+ export declare function getAscApiKeysForAccountAsync(account: Account): Promise<AppStoreConnectApiKeyFragment[]>;
64
+ export declare function getAscApiKeyForAppSubmissionsAsync(appLookupParams: AppLookupParams): Promise<AppStoreConnectApiKeyFragment | null>;
65
+ export declare function deleteAscApiKeyAsync(ascApiKeyId: string): Promise<void>;
@@ -1,10 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deletePushKeyAsync = exports.getPushKeyForAppAsync = exports.getPushKeysForAccountAsync = exports.createPushKeyAsync = exports.deleteDistributionCertificateAsync = exports.createDistributionCertificateAsync = exports.getDistributionCertificatesForAccountAsync = exports.getDistributionCertificateForAppAsync = exports.deleteProvisioningProfilesAsync = exports.updateProvisioningProfileAsync = exports.getProvisioningProfileAsync = exports.createProvisioningProfileAsync = exports.getDevicesForAppleTeamAsync = exports.createOrGetExistingAppleAppIdentifierAsync = exports.createOrGetExistingAppleTeamAsync = exports.updateIosAppCredentialsAsync = exports.createOrGetIosAppCredentialsWithCommonFieldsAsync = exports.getIosAppCredentialsWithCommonFieldsAsync = exports.getIosAppCredentialsWithBuildCredentialsAsync = exports.createOrUpdateIosAppBuildCredentialsAsync = void 0;
3
+ exports.deleteAscApiKeyAsync = exports.getAscApiKeyForAppSubmissionsAsync = exports.getAscApiKeysForAccountAsync = exports.createAscApiKeyAsync = exports.deletePushKeyAsync = exports.getPushKeyForAppAsync = exports.getPushKeysForAccountAsync = exports.createPushKeyAsync = exports.deleteDistributionCertificateAsync = exports.createDistributionCertificateAsync = exports.getDistributionCertificatesForAccountAsync = exports.getDistributionCertificateForAppAsync = exports.deleteProvisioningProfilesAsync = exports.updateProvisioningProfileAsync = exports.getProvisioningProfileAsync = exports.createProvisioningProfileAsync = exports.getDevicesForAppleTeamAsync = exports.createOrGetExistingAppleAppIdentifierAsync = exports.createOrGetExistingAppleTeamAsync = exports.updateIosAppCredentialsAsync = exports.createOrGetIosAppCredentialsWithCommonFieldsAsync = exports.getIosAppCredentialsWithCommonFieldsAsync = exports.getIosAppCredentialsWithBuildCredentialsAsync = exports.createOrUpdateIosAppBuildCredentialsAsync = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ const apple_utils_1 = require("@expo/apple-utils");
5
6
  const nullthrows_1 = (0, tslib_1.__importDefault)(require("nullthrows"));
7
+ const generated_1 = require("../../../graphql/generated");
6
8
  const bundleIdentifier_1 = require("../../../project/ios/bundleIdentifier");
7
9
  const errors_1 = require("../errors");
10
+ const AppStoreConnectApiKeyMutation_1 = require("./graphql/mutations/AppStoreConnectApiKeyMutation");
8
11
  const AppleAppIdentifierMutation_1 = require("./graphql/mutations/AppleAppIdentifierMutation");
9
12
  const AppleDistributionCertificateMutation_1 = require("./graphql/mutations/AppleDistributionCertificateMutation");
10
13
  const AppleProvisioningProfileMutation_1 = require("./graphql/mutations/AppleProvisioningProfileMutation");
@@ -13,6 +16,7 @@ const AppleTeamMutation_1 = require("./graphql/mutations/AppleTeamMutation");
13
16
  const IosAppBuildCredentialsMutation_1 = require("./graphql/mutations/IosAppBuildCredentialsMutation");
14
17
  const IosAppCredentialsMutation_1 = require("./graphql/mutations/IosAppCredentialsMutation");
15
18
  const AppQuery_1 = require("./graphql/queries/AppQuery");
19
+ const AppStoreConnectApiKeyQuery_1 = require("./graphql/queries/AppStoreConnectApiKeyQuery");
16
20
  const AppleAppIdentifierQuery_1 = require("./graphql/queries/AppleAppIdentifierQuery");
17
21
  const AppleDeviceQuery_1 = require("./graphql/queries/AppleDeviceQuery");
18
22
  const AppleDistributionCertificateQuery_1 = require("./graphql/queries/AppleDistributionCertificateQuery");
@@ -82,11 +86,15 @@ async function createOrGetIosAppCredentialsWithCommonFieldsAsync(appLookupParams
82
86
  return await IosAppCredentialsMutation_1.IosAppCredentialsMutation.createIosAppCredentialsAsync({ appleTeamId: appleTeam === null || appleTeam === void 0 ? void 0 : appleTeam.id }, app.id, appleAppIdentifier.id);
83
87
  }
84
88
  exports.createOrGetIosAppCredentialsWithCommonFieldsAsync = createOrGetIosAppCredentialsWithCommonFieldsAsync;
85
- async function updateIosAppCredentialsAsync(appCredentials, { applePushKeyId, }) {
89
+ async function updateIosAppCredentialsAsync(appCredentials, { applePushKeyId, ascApiKeyIdForSubmissions, }) {
86
90
  let updatedAppCredentials = appCredentials;
87
91
  if (applePushKeyId) {
88
92
  updatedAppCredentials = await IosAppCredentialsMutation_1.IosAppCredentialsMutation.setPushKeyAsync(updatedAppCredentials.id, applePushKeyId);
89
93
  }
94
+ if (ascApiKeyIdForSubmissions) {
95
+ updatedAppCredentials =
96
+ await IosAppCredentialsMutation_1.IosAppCredentialsMutation.setAppStoreConnectApiKeyForSubmissionsAsync(updatedAppCredentials.id, ascApiKeyIdForSubmissions);
97
+ }
90
98
  return updatedAppCredentials;
91
99
  }
92
100
  exports.updateIosAppCredentialsAsync = updateIosAppCredentialsAsync;
@@ -224,4 +232,68 @@ async function deletePushKeyAsync(pushKeyId) {
224
232
  return await ApplePushKeyMutation_1.ApplePushKeyMutation.deleteApplePushKeyAsync(pushKeyId);
225
233
  }
226
234
  exports.deletePushKeyAsync = deletePushKeyAsync;
235
+ async function createAscApiKeyAsync(account, ascApiKey) {
236
+ var _a, _b, _c;
237
+ const maybeAppleTeam = ascApiKey.teamId
238
+ ? await createOrGetExistingAppleTeamAsync(account, {
239
+ appleTeamIdentifier: ascApiKey.teamId,
240
+ appleTeamName: ascApiKey.teamName,
241
+ })
242
+ : null;
243
+ return await AppStoreConnectApiKeyMutation_1.AppStoreConnectApiKeyMutation.createAppStoreConnectApiKeyAsync({
244
+ issuerIdentifier: ascApiKey.issuerId,
245
+ keyIdentifier: ascApiKey.keyId,
246
+ keyP8: ascApiKey.keyP8,
247
+ name: (_a = ascApiKey.name) !== null && _a !== void 0 ? _a : null,
248
+ roles: (_c = (_b = ascApiKey.roles) === null || _b === void 0 ? void 0 : _b.map(role => convertUserRoleToGraphqlType(role))) !== null && _c !== void 0 ? _c : null,
249
+ appleTeamId: maybeAppleTeam ? maybeAppleTeam.id : null,
250
+ }, account.id);
251
+ }
252
+ exports.createAscApiKeyAsync = createAscApiKeyAsync;
253
+ async function getAscApiKeysForAccountAsync(account) {
254
+ return await AppStoreConnectApiKeyQuery_1.AppStoreConnectApiKeyQuery.getAllForAccountAsync(account.name);
255
+ }
256
+ exports.getAscApiKeysForAccountAsync = getAscApiKeysForAccountAsync;
257
+ async function getAscApiKeyForAppSubmissionsAsync(appLookupParams) {
258
+ var _a;
259
+ const maybeIosAppCredentials = await getIosAppCredentialsWithCommonFieldsAsync(appLookupParams);
260
+ return (_a = maybeIosAppCredentials === null || maybeIosAppCredentials === void 0 ? void 0 : maybeIosAppCredentials.appStoreConnectApiKeyForSubmissions) !== null && _a !== void 0 ? _a : null;
261
+ }
262
+ exports.getAscApiKeyForAppSubmissionsAsync = getAscApiKeyForAppSubmissionsAsync;
263
+ async function deleteAscApiKeyAsync(ascApiKeyId) {
264
+ return await AppStoreConnectApiKeyMutation_1.AppStoreConnectApiKeyMutation.deleteAppStoreConnectApiKeyAsync(ascApiKeyId);
265
+ }
266
+ exports.deleteAscApiKeyAsync = deleteAscApiKeyAsync;
267
+ function convertUserRoleToGraphqlType(userRole) {
268
+ switch (userRole) {
269
+ case apple_utils_1.UserRole.ADMIN:
270
+ return generated_1.AppStoreConnectUserRole.Admin;
271
+ case apple_utils_1.UserRole.ACCESS_TO_REPORTS:
272
+ return generated_1.AppStoreConnectUserRole.AccessToReports;
273
+ case apple_utils_1.UserRole.ACCOUNT_HOLDER:
274
+ return generated_1.AppStoreConnectUserRole.AccountHolder;
275
+ case apple_utils_1.UserRole.APP_MANAGER:
276
+ return generated_1.AppStoreConnectUserRole.AppManager;
277
+ case apple_utils_1.UserRole.CLOUD_MANAGED_APP_DISTRIBUTION:
278
+ return generated_1.AppStoreConnectUserRole.CloudManagedAppDistribution;
279
+ case apple_utils_1.UserRole.CLOUD_MANAGED_DEVELOPER_ID:
280
+ return generated_1.AppStoreConnectUserRole.CloudManagedDeveloperId;
281
+ case apple_utils_1.UserRole.CREATE_APPS:
282
+ return generated_1.AppStoreConnectUserRole.CreateApps;
283
+ case apple_utils_1.UserRole.CUSTOMER_SUPPORT:
284
+ return generated_1.AppStoreConnectUserRole.CustomerSupport;
285
+ case apple_utils_1.UserRole.DEVELOPER:
286
+ return generated_1.AppStoreConnectUserRole.Developer;
287
+ case apple_utils_1.UserRole.FINANCE:
288
+ return generated_1.AppStoreConnectUserRole.Finance;
289
+ case apple_utils_1.UserRole.MARKETING:
290
+ return generated_1.AppStoreConnectUserRole.Marketing;
291
+ case apple_utils_1.UserRole.READ_ONLY:
292
+ return generated_1.AppStoreConnectUserRole.ReadOnly;
293
+ case apple_utils_1.UserRole.SALES:
294
+ return generated_1.AppStoreConnectUserRole.Sales;
295
+ case apple_utils_1.UserRole.TECHNICAL:
296
+ return generated_1.AppStoreConnectUserRole.Technical;
297
+ }
298
+ }
227
299
  const formatProjectFullName = ({ account, projectName }) => `@${account.name}/${projectName}`;
@@ -0,0 +1,5 @@
1
+ import { AppStoreConnectApiKeyFragment, AppStoreConnectApiKeyInput } from '../../../../../graphql/generated';
2
+ export declare const AppStoreConnectApiKeyMutation: {
3
+ createAppStoreConnectApiKeyAsync(appStoreConnectApiKeyInput: AppStoreConnectApiKeyInput, accountId: string): Promise<AppStoreConnectApiKeyFragment>;
4
+ deleteAppStoreConnectApiKeyAsync(appStoreConnectApiKeyId: string): Promise<void>;
5
+ };
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppStoreConnectApiKeyMutation = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const assert_1 = (0, tslib_1.__importDefault)(require("assert"));
6
+ const graphql_1 = require("graphql");
7
+ const graphql_tag_1 = (0, tslib_1.__importDefault)(require("graphql-tag"));
8
+ const client_1 = require("../../../../../graphql/client");
9
+ const AppStoreConnectApiKey_1 = require("../../../../../graphql/types/credentials/AppStoreConnectApiKey");
10
+ exports.AppStoreConnectApiKeyMutation = {
11
+ async createAppStoreConnectApiKeyAsync(appStoreConnectApiKeyInput, accountId) {
12
+ const data = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
13
+ .mutation((0, graphql_tag_1.default) `
14
+ mutation CreateAppStoreConnectApiKeyMutation(
15
+ $appStoreConnectApiKeyInput: AppStoreConnectApiKeyInput!
16
+ $accountId: ID!
17
+ ) {
18
+ appStoreConnectApiKey {
19
+ createAppStoreConnectApiKey(
20
+ appStoreConnectApiKeyInput: $appStoreConnectApiKeyInput
21
+ accountId: $accountId
22
+ ) {
23
+ id
24
+ ...AppStoreConnectApiKeyFragment
25
+ }
26
+ }
27
+ }
28
+ ${(0, graphql_1.print)(AppStoreConnectApiKey_1.AppStoreConnectApiKeyFragmentNode)}
29
+ `, {
30
+ appStoreConnectApiKeyInput,
31
+ accountId,
32
+ })
33
+ .toPromise());
34
+ (0, assert_1.default)(data.appStoreConnectApiKey.createAppStoreConnectApiKey, 'GraphQL: `createAppStoreConnectApiKey` not defined in server response');
35
+ return data.appStoreConnectApiKey.createAppStoreConnectApiKey;
36
+ },
37
+ async deleteAppStoreConnectApiKeyAsync(appStoreConnectApiKeyId) {
38
+ await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
39
+ .mutation((0, graphql_tag_1.default) `
40
+ mutation DeleteAppStoreConnectApiKeyMutation($appStoreConnectApiKeyId: ID!) {
41
+ appStoreConnectApiKey {
42
+ deleteAppStoreConnectApiKey(id: $appStoreConnectApiKeyId) {
43
+ id
44
+ }
45
+ }
46
+ }
47
+ `, {
48
+ appStoreConnectApiKeyId,
49
+ }, {
50
+ additionalTypenames: ['AppStoreConnectApiKey', 'IosAppCredentials'],
51
+ })
52
+ .toPromise());
53
+ },
54
+ };
@@ -2,4 +2,5 @@ import { CommonIosAppCredentialsFragment, IosAppCredentialsInput } from '../../.
2
2
  export declare const IosAppCredentialsMutation: {
3
3
  createIosAppCredentialsAsync(iosAppCredentialsInput: IosAppCredentialsInput, appId: string, appleAppIdentifierId: string): Promise<CommonIosAppCredentialsFragment>;
4
4
  setPushKeyAsync(iosAppCredentialsId: string, pushKeyId: string): Promise<CommonIosAppCredentialsFragment>;
5
+ setAppStoreConnectApiKeyForSubmissionsAsync(iosAppCredentialsId: string, ascApiKeyId: string): Promise<CommonIosAppCredentialsFragment>;
5
6
  };
@@ -56,4 +56,29 @@ exports.IosAppCredentialsMutation = {
56
56
  .toPromise());
57
57
  return data.iosAppCredentials.setPushKey;
58
58
  },
59
+ async setAppStoreConnectApiKeyForSubmissionsAsync(iosAppCredentialsId, ascApiKeyId) {
60
+ const data = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
61
+ .mutation((0, graphql_tag_1.default) `
62
+ mutation SetAppStoreConnectApiKeyForSubmissionsMutation(
63
+ $iosAppCredentialsId: ID!
64
+ $ascApiKeyId: ID!
65
+ ) {
66
+ iosAppCredentials {
67
+ setAppStoreConnectApiKeyForSubmissions(
68
+ id: $iosAppCredentialsId
69
+ ascApiKeyId: $ascApiKeyId
70
+ ) {
71
+ id
72
+ ...CommonIosAppCredentialsFragment
73
+ }
74
+ }
75
+ }
76
+ ${(0, graphql_1.print)(IosAppCredentials_1.CommonIosAppCredentialsFragmentNode)}
77
+ `, {
78
+ iosAppCredentialsId,
79
+ ascApiKeyId,
80
+ })
81
+ .toPromise());
82
+ return data.iosAppCredentials.setAppStoreConnectApiKeyForSubmissions;
83
+ },
59
84
  };
@@ -20,7 +20,9 @@ exports.AppQuery = {
20
20
  }
21
21
  }
22
22
  ${(0, graphql_1.print)(App_1.AppFragmentNode)}
23
- `, { fullName })
23
+ `, { fullName }, {
24
+ additionalTypenames: ['App'],
25
+ })
24
26
  .toPromise());
25
27
  (0, assert_1.default)(data.app, 'GraphQL: `app` not defined in server response');
26
28
  return data.app.byFullName;
@@ -0,0 +1,4 @@
1
+ import { AppStoreConnectApiKeyFragment } from '../../../../../graphql/generated';
2
+ export declare const AppStoreConnectApiKeyQuery: {
3
+ getAllForAccountAsync(accountName: string): Promise<AppStoreConnectApiKeyFragment[]>;
4
+ };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppStoreConnectApiKeyQuery = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const graphql_1 = require("graphql");
6
+ const graphql_tag_1 = (0, tslib_1.__importDefault)(require("graphql-tag"));
7
+ const client_1 = require("../../../../../graphql/client");
8
+ const AppStoreConnectApiKey_1 = require("../../../../../graphql/types/credentials/AppStoreConnectApiKey");
9
+ exports.AppStoreConnectApiKeyQuery = {
10
+ async getAllForAccountAsync(accountName) {
11
+ const data = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
12
+ .query((0, graphql_tag_1.default) `
13
+ query AppStoreConnectApiKeyByAccountQuery($accountName: String!) {
14
+ account {
15
+ byName(accountName: $accountName) {
16
+ id
17
+ appStoreConnectApiKeys {
18
+ id
19
+ ...AppStoreConnectApiKeyFragment
20
+ }
21
+ }
22
+ }
23
+ }
24
+ ${(0, graphql_1.print)(AppStoreConnectApiKey_1.AppStoreConnectApiKeyFragmentNode)}
25
+ `, {
26
+ accountName,
27
+ }, {
28
+ additionalTypenames: ['AppStoreConnectApiKey'],
29
+ })
30
+ .toPromise());
31
+ return data.account.byName.appStoreConnectApiKeys;
32
+ },
33
+ };
@@ -68,7 +68,9 @@ exports.AppleDeviceQuery = {
68
68
  }
69
69
  }
70
70
  }
71
- `, { accountName, appleTeamIdentifier })
71
+ `, { accountName, appleTeamIdentifier }, {
72
+ additionalTypenames: ['AppleDevice', 'AppleTeam'],
73
+ })
72
74
  .toPromise());
73
75
  return data.account.byName.appleTeams[0];
74
76
  },
@@ -95,7 +97,9 @@ exports.AppleDeviceQuery = {
95
97
  }
96
98
  }
97
99
  }
98
- `, { accountName, identifier })
100
+ `, { accountName, identifier }, {
101
+ additionalTypenames: ['AppleDevice', 'AppleTeam'],
102
+ })
99
103
  .toPromise());
100
104
  return (_a = data.account.byName.appleDevices[0]) !== null && _a !== void 0 ? _a : null;
101
105
  },
@@ -47,7 +47,11 @@ exports.AppleDistributionCertificateQuery = {
47
47
  appleAppIdentifierId,
48
48
  iosDistributionType,
49
49
  }, {
50
- additionalTypenames: ['IosAppCredentials', 'IosAppBuildCredentials'],
50
+ additionalTypenames: [
51
+ 'AppleDistributionCertificate',
52
+ 'IosAppCredentials',
53
+ 'IosAppBuildCredentials',
54
+ ],
51
55
  })
52
56
  .toPromise());
53
57
  (0, assert_1.default)(data.app, 'GraphQL: `app` not defined in server response');
@@ -70,6 +74,8 @@ exports.AppleDistributionCertificateQuery = {
70
74
  ${(0, graphql_1.print)(AppleDistributionCertificate_1.AppleDistributionCertificateFragmentNode)}
71
75
  `, {
72
76
  accountName,
77
+ }, {
78
+ additionalTypenames: ['AppleDistributionCertificate'],
73
79
  })
74
80
  .toPromise());
75
81
  return data.account.byName.appleDistributionCertificates;
@@ -59,7 +59,11 @@ exports.AppleProvisioningProfileQuery = {
59
59
  appleAppIdentifierId,
60
60
  iosDistributionType,
61
61
  }, {
62
- additionalTypenames: ['IosAppCredentials', 'IosAppBuildCredentials'],
62
+ additionalTypenames: [
63
+ 'AppleProvisioningProfile',
64
+ 'IosAppCredentials',
65
+ 'IosAppBuildCredentials',
66
+ ],
63
67
  })
64
68
  .toPromise());
65
69
  (0, assert_1.default)(data.app, 'GraphQL: `app` not defined in server response');
@@ -24,6 +24,8 @@ exports.ApplePushKeyQuery = {
24
24
  ${(0, graphql_1.print)(ApplePushKey_1.ApplePushKeyFragmentNode)}
25
25
  `, {
26
26
  accountName,
27
+ }, {
28
+ additionalTypenames: ['ApplePushKey'],
27
29
  })
28
30
  .toPromise());
29
31
  return data.account.byName.applePushKeys;
@@ -22,7 +22,9 @@ exports.AppleTeamQuery = {
22
22
  }
23
23
  }
24
24
  }
25
- `, { accountName })
25
+ `, { accountName }, {
26
+ additionalTypenames: ['AppleTeam'],
27
+ })
26
28
  .toPromise());
27
29
  return data.account.byName.appleTeams;
28
30
  },
@@ -42,6 +44,8 @@ exports.AppleTeamQuery = {
42
44
  `, {
43
45
  accountId,
44
46
  appleTeamIdentifier,
47
+ }, {
48
+ additionalTypenames: ['AppleTeam'],
45
49
  })
46
50
  .toPromise());
47
51
  return (_a = data.appleTeam.byAppleTeamIdentifier) !== null && _a !== void 0 ? _a : null;
@@ -18,7 +18,7 @@ export default class AppStoreApi {
18
18
  revokeProvisioningProfileAsync(bundleIdentifier: string, profileClass?: ProfileClass): Promise<void>;
19
19
  createOrReuseAdhocProvisioningProfileAsync(udids: string[], bundleIdentifier: string, distCertSerialNumber: string): Promise<ProvisioningProfile>;
20
20
  listAscApiKeysAsync(): Promise<AscApiKeyInfo[]>;
21
- getAscApiKeyAsync(keyId: string): Promise<AscApiKeyInfo>;
21
+ getAscApiKeyAsync(keyId: string): Promise<AscApiKeyInfo | null>;
22
22
  createAscApiKeyAsync({ nickname }: {
23
23
  nickname: string;
24
24
  }): Promise<AscApiKey>;
@@ -68,6 +68,7 @@ export declare type AscApiKeyInfo = {
68
68
  name: string;
69
69
  teamName?: string;
70
70
  roles: UserRole[];
71
+ isRevoked: boolean;
71
72
  };
72
73
  export declare type AscApiKey = AscApiKeyInfo & {
73
74
  keyP8: string;
@@ -3,7 +3,7 @@ import { ApiKey, ApiKeyProps } from '@expo/apple-utils';
3
3
  import { AscApiKey, AscApiKeyInfo } from './Credentials.types';
4
4
  import { AuthCtx } from './authenticate';
5
5
  export declare function listAscApiKeysAsync(authCtx: AuthCtx): Promise<AscApiKeyInfo[]>;
6
- export declare function getAscApiKeyAsync(authCtx: AuthCtx, keyId: string): Promise<AscApiKeyInfo>;
6
+ export declare function getAscApiKeyAsync(authCtx: AuthCtx, keyId: string): Promise<AscApiKeyInfo | null>;
7
7
  export declare function createAscApiKeyAsync(authCtx: AuthCtx, { nickname, allAppsVisible, roles, keyType, }: Partial<Pick<ApiKeyProps, 'nickname' | 'roles' | 'allAppsVisible' | 'keyType'>>): Promise<AscApiKey>;
8
8
  export declare function revokeAscApiKeyAsync(authCtx: AuthCtx, keyId: string): Promise<AscApiKeyInfo>;
9
9
  export declare function getAscApiKeyInfo(apiKey: ApiKey, authCtx: AuthCtx): AscApiKeyInfo;
@@ -7,36 +7,42 @@ const log_1 = (0, tslib_1.__importDefault)(require("../../../log"));
7
7
  const ora_1 = require("../../../ora");
8
8
  const authenticate_1 = require("./authenticate");
9
9
  async function listAscApiKeysAsync(authCtx) {
10
- const spinner = (0, ora_1.ora)(`Fetching App Store Connect API Keys.`).start();
10
+ const spinner = (0, ora_1.ora)(`Fetching App Store Connect Api Keys.`).start();
11
11
  try {
12
12
  const context = (0, authenticate_1.getRequestContext)(authCtx);
13
13
  const keys = await apple_utils_1.ApiKey.getAsync(context);
14
- spinner.succeed(`Fetched App Store Connect API Keys.`);
14
+ spinner.succeed(`Fetched App Store Connect Api Keys.`);
15
15
  return keys.map(key => getAscApiKeyInfo(key, authCtx));
16
16
  }
17
17
  catch (error) {
18
- spinner.fail(`Failed to fetch App Store Connect API Keys.`);
18
+ spinner.fail(`Failed to fetch App Store Connect Api Keys.`);
19
19
  throw error;
20
20
  }
21
21
  }
22
22
  exports.listAscApiKeysAsync = listAscApiKeysAsync;
23
23
  async function getAscApiKeyAsync(authCtx, keyId) {
24
- const spinner = (0, ora_1.ora)(`Fetching App Store Connect API Key.`).start();
24
+ var _a;
25
+ const spinner = (0, ora_1.ora)(`Fetching App Store Connect Api Key.`).start();
25
26
  try {
26
27
  const context = (0, authenticate_1.getRequestContext)(authCtx);
27
28
  const apiKey = await apple_utils_1.ApiKey.infoAsync(context, { id: keyId });
28
- spinner.succeed(`Fetched App Store Connect API Key (ID: ${keyId}).`);
29
+ spinner.succeed(`Fetched App Store Connect Api Key (ID: ${keyId}).`);
29
30
  return getAscApiKeyInfo(apiKey, authCtx);
30
31
  }
31
32
  catch (error) {
33
+ const message = (_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : '';
34
+ if (message.includes("There is no resource of type 'apiKeys' with id")) {
35
+ spinner.stop();
36
+ return null;
37
+ }
32
38
  log_1.default.error(error);
33
- spinner.fail(`Failed to fetch App Store Connect API Key.`);
39
+ spinner.fail(`Failed to fetch App Store Connect Api Key.`);
34
40
  throw error;
35
41
  }
36
42
  }
37
43
  exports.getAscApiKeyAsync = getAscApiKeyAsync;
38
44
  async function createAscApiKeyAsync(authCtx, { nickname, allAppsVisible, roles, keyType, }) {
39
- const spinner = (0, ora_1.ora)(`Creating App Store Connect API Key.`).start();
45
+ const spinner = (0, ora_1.ora)(`Creating App Store Connect Api Key.`).start();
40
46
  try {
41
47
  const context = (0, authenticate_1.getRequestContext)(authCtx);
42
48
  const key = await apple_utils_1.ApiKey.createAsync(context, {
@@ -58,29 +64,32 @@ async function createAscApiKeyAsync(authCtx, { nickname, allAppsVisible, roles,
58
64
  }
59
65
  throw new Error(`Failed to download .p8 file of ${humanReadableKey}.`);
60
66
  }
67
+ // this object has more optional parameters populated
68
+ const fullKey = await apple_utils_1.ApiKey.infoAsync(context, { id: key.id });
69
+ spinner.succeed(`Created App Store Connect Api Key.`);
61
70
  return {
62
- ...getAscApiKeyInfo(key, authCtx),
71
+ ...getAscApiKeyInfo(fullKey, authCtx),
63
72
  keyP8,
64
73
  };
65
74
  }
66
75
  catch (err) {
67
- spinner.fail('Failed to create App Store Connect API Key.');
76
+ spinner.fail('Failed to create App Store Connect Api Key.');
68
77
  throw err;
69
78
  }
70
79
  }
71
80
  exports.createAscApiKeyAsync = createAscApiKeyAsync;
72
81
  async function revokeAscApiKeyAsync(authCtx, keyId) {
73
- const spinner = (0, ora_1.ora)(`Revoking App Store Connect API Key.`).start();
82
+ const spinner = (0, ora_1.ora)(`Revoking App Store Connect Api Key.`).start();
74
83
  try {
75
84
  const context = (0, authenticate_1.getRequestContext)(authCtx);
76
85
  const apiKey = await apple_utils_1.ApiKey.infoAsync(context, { id: keyId });
77
86
  const revokedKey = await apiKey.revokeAsync();
78
- spinner.succeed(`Revoked App Store Connect API Key.`);
87
+ spinner.succeed(`Revoked App Store Connect Api Key.`);
79
88
  return getAscApiKeyInfo(revokedKey, authCtx);
80
89
  }
81
90
  catch (error) {
82
91
  log_1.default.error(error);
83
- spinner.fail(`Failed to revoke App Store Connect API Key.`);
92
+ spinner.fail(`Failed to revoke App Store Connect Api Key.`);
84
93
  throw error;
85
94
  }
86
95
  }
@@ -94,6 +103,7 @@ function getAscApiKeyInfo(apiKey, authCtx) {
94
103
  teamId: authCtx.team.id,
95
104
  teamName: authCtx.team.name,
96
105
  roles: apiKey.attributes.roles,
106
+ isRevoked: !!apiKey.attributes.revokingDate,
97
107
  };
98
108
  }
99
109
  exports.getAscApiKeyInfo = getAscApiKeyInfo;
@@ -52,6 +52,7 @@ export interface AscApiKeyPath {
52
52
  keyId: string;
53
53
  issuerId: string;
54
54
  }
55
- export declare const ascApiKeyMetadataSchema: CredentialSchema<Omit<MinimalAscApiKey, 'keyP8'>>;
55
+ export declare const ascApiKeyIdSchema: CredentialSchema<Pick<MinimalAscApiKey, 'keyId'>>;
56
+ export declare const ascApiKeyIssuerIdSchema: CredentialSchema<Pick<MinimalAscApiKey, 'issuerId'>>;
56
57
  export declare const pushKeySchema: CredentialSchema<PushKey>;
57
58
  export declare const provisioningProfileSchema: CredentialSchema<ProvisioningProfile>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.provisioningProfileSchema = exports.pushKeySchema = exports.ascApiKeyMetadataSchema = exports.distributionCertificateSchema = exports.getAppLookupParams = void 0;
3
+ exports.provisioningProfileSchema = exports.pushKeySchema = exports.ascApiKeyIssuerIdSchema = exports.ascApiKeyIdSchema = exports.distributionCertificateSchema = exports.getAppLookupParams = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
6
6
  const p12Certificate_1 = require("./utils/p12Certificate");
@@ -50,14 +50,19 @@ exports.distributionCertificateSchema = {
50
50
  return answers;
51
51
  },
52
52
  };
53
- exports.ascApiKeyMetadataSchema = {
54
- name: 'App Store Connect API Key',
53
+ exports.ascApiKeyIdSchema = {
54
+ name: 'App Store Connect Api Key',
55
55
  questions: [
56
56
  {
57
57
  field: 'keyId',
58
58
  type: 'string',
59
59
  question: 'Key ID:',
60
60
  },
61
+ ],
62
+ };
63
+ exports.ascApiKeyIssuerIdSchema = {
64
+ name: 'App Store Connect Api Key',
65
+ questions: [
61
66
  {
62
67
  field: 'issuerId',
63
68
  type: 'string',