eas-cli 0.31.1 → 0.34.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 (128) hide show
  1. package/README.md +29 -28
  2. package/build/analytics.js +3 -9
  3. package/build/build/android/UpdatesModule.js +4 -15
  4. package/build/build/android/configure.js +3 -3
  5. package/build/build/android/graphql.js +2 -4
  6. package/build/build/android/prepareJob.js +4 -3
  7. package/build/build/build.js +2 -2
  8. package/build/build/configure.js +26 -13
  9. package/build/build/ios/UpdatesModule.js +6 -18
  10. package/build/build/ios/configure.js +1 -1
  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/appJson.d.ts +1 -0
  15. package/build/build/utils/appJson.js +13 -4
  16. package/build/build/utils/devClient.d.ts +4 -4
  17. package/build/build/utils/devClient.js +10 -18
  18. package/build/build/utils/repository.js +10 -7
  19. package/build/build/validate.js +4 -4
  20. package/build/commandUtils/EasCommand.d.ts +1 -0
  21. package/build/commandUtils/EasCommand.js +21 -0
  22. package/build/commands/branch/create.js +3 -2
  23. package/build/commands/branch/delete.js +1 -1
  24. package/build/commands/branch/list.js +1 -1
  25. package/build/commands/branch/publish.js +20 -48
  26. package/build/commands/branch/view.js +1 -1
  27. package/build/commands/build/index.d.ts +1 -1
  28. package/build/commands/build/index.js +64 -49
  29. package/build/commands/channel/edit.js +1 -1
  30. package/build/commands/channel/list.js +1 -1
  31. package/build/commands/channel/view.js +1 -1
  32. package/build/commands/diagnostics.js +2 -2
  33. package/build/commands/project/info.js +1 -1
  34. package/build/commands/submit.js +16 -11
  35. package/build/commands/update/view.js +1 -1
  36. package/build/credentials/android/api/graphql/queries/GoogleServiceAccountKeyQuery.js +2 -0
  37. package/build/credentials/context.d.ts +1 -1
  38. package/build/credentials/context.js +5 -5
  39. package/build/credentials/credentialsJson/update.js +5 -4
  40. package/build/credentials/errors.d.ts +3 -0
  41. package/build/credentials/errors.js +7 -1
  42. package/build/credentials/ios/IosCredentialsProvider.js +1 -1
  43. package/build/credentials/ios/actions/AscApiKeyUtils.d.ts +5 -0
  44. package/build/credentials/ios/actions/AscApiKeyUtils.js +63 -0
  45. package/build/credentials/ios/actions/CreateDistributionCertificate.js +1 -1
  46. package/build/credentials/ios/actions/CreatePushKey.js +1 -1
  47. package/build/credentials/ios/actions/DistributionCertificateUtils.d.ts +1 -1
  48. package/build/credentials/ios/actions/DistributionCertificateUtils.js +10 -12
  49. package/build/credentials/ios/actions/PushKeyUtils.d.ts +1 -1
  50. package/build/credentials/ios/actions/PushKeyUtils.js +5 -5
  51. package/build/credentials/ios/actions/SetupTargetBuildCredentials.js +1 -1
  52. package/build/credentials/ios/api/graphql/queries/AppQuery.js +3 -1
  53. package/build/credentials/ios/api/graphql/queries/AppleDeviceQuery.js +6 -2
  54. package/build/credentials/ios/api/graphql/queries/AppleDistributionCertificateQuery.js +7 -1
  55. package/build/credentials/ios/api/graphql/queries/AppleProvisioningProfileQuery.js +5 -1
  56. package/build/credentials/ios/api/graphql/queries/ApplePushKeyQuery.js +2 -0
  57. package/build/credentials/ios/api/graphql/queries/AppleTeamQuery.js +5 -1
  58. package/build/credentials/ios/appstore/AppStoreApi.d.ts +7 -1
  59. package/build/credentials/ios/appstore/AppStoreApi.js +17 -0
  60. package/build/credentials/ios/appstore/Credentials.js +3 -3
  61. package/build/credentials/ios/appstore/Credentials.types.d.ts +13 -0
  62. package/build/credentials/ios/appstore/ascApiKey.d.ts +9 -0
  63. package/build/credentials/ios/appstore/ascApiKey.js +99 -0
  64. package/build/credentials/ios/credentials.d.ts +17 -0
  65. package/build/credentials/ios/credentials.js +16 -1
  66. package/build/credentials/manager/Actions.d.ts +47 -0
  67. package/build/credentials/manager/Actions.js +48 -0
  68. package/build/credentials/manager/AndroidActions.d.ts +6 -0
  69. package/build/credentials/manager/AndroidActions.js +114 -0
  70. package/build/credentials/manager/IosActions.d.ts +6 -0
  71. package/build/credentials/manager/IosActions.js +110 -0
  72. package/build/credentials/manager/ManageAndroid.d.ts +1 -29
  73. package/build/credentials/manager/ManageAndroid.js +26 -159
  74. package/build/credentials/manager/ManageIos.d.ts +1 -29
  75. package/build/credentials/manager/ManageIos.js +28 -155
  76. package/build/graphql/client.d.ts +8 -2
  77. package/build/graphql/generated.d.ts +134 -121
  78. package/build/graphql/generated.js +46 -28
  79. package/build/graphql/queries/BuildQuery.js +4 -1
  80. package/build/graphql/queries/EnvironmentSecretsQuery.js +4 -2
  81. package/build/graphql/queries/ProjectQuery.js +3 -1
  82. package/build/graphql/queries/PublishQuery.js +4 -1
  83. package/build/graphql/queries/SubmissionQuery.js +5 -2
  84. package/build/graphql/queries/UserQuery.js +4 -1
  85. package/build/graphql/queries/WebhookQuery.js +6 -2
  86. package/build/log.d.ts +11 -3
  87. package/build/log.js +23 -22
  88. package/build/project/android/applicationId.d.ts +1 -1
  89. package/build/project/android/applicationId.js +7 -6
  90. package/build/project/ios/bundleIdentifier.d.ts +1 -1
  91. package/build/project/ios/bundleIdentifier.js +7 -6
  92. package/build/project/projectUtils.js +1 -1
  93. package/build/project/publish.js +2 -2
  94. package/build/project/workflow.js +2 -2
  95. package/build/submit/ArchiveSource.d.ts +7 -2
  96. package/build/submit/ArchiveSource.js +94 -11
  97. package/build/submit/ios/AscApiKeySource.d.ts +28 -0
  98. package/build/submit/ios/AscApiKeySource.js +51 -0
  99. package/build/submit/ios/IosSubmitCommand.d.ts +2 -0
  100. package/build/submit/ios/IosSubmitCommand.js +55 -3
  101. package/build/submit/ios/IosSubmitter.d.ts +3 -1
  102. package/build/submit/ios/IosSubmitter.js +49 -5
  103. package/build/submit/submit.js +1 -1
  104. package/build/submit/utils/builds.d.ts +3 -1
  105. package/build/submit/utils/builds.js +6 -6
  106. package/build/user/User.js +1 -0
  107. package/build/utils/easCli.d.ts +1 -0
  108. package/build/utils/easCli.js +5 -0
  109. package/build/utils/{expoCommand.d.ts → expoCli.d.ts} +0 -0
  110. package/build/utils/{expoCommand.js → expoCli.js} +0 -0
  111. package/build/utils/profiles.d.ts +11 -0
  112. package/build/utils/profiles.js +46 -0
  113. package/build/vcs/clients/git.d.ts +26 -0
  114. package/build/vcs/clients/git.js +184 -0
  115. package/build/vcs/clients/gitNoCommit.d.ts +7 -0
  116. package/build/vcs/clients/gitNoCommit.js +27 -0
  117. package/build/vcs/clients/noVcs.d.ts +6 -0
  118. package/build/vcs/clients/noVcs.js +19 -0
  119. package/build/vcs/git.d.ts +10 -17
  120. package/build/vcs/git.js +7 -175
  121. package/build/vcs/index.d.ts +2 -2
  122. package/build/vcs/index.js +15 -6
  123. package/build/vcs/local.d.ts +18 -5
  124. package/build/vcs/local.js +61 -32
  125. package/build/vcs/vcs.d.ts +2 -1
  126. package/build/vcs/vcs.js +8 -4
  127. package/oclif.manifest.json +1 -1
  128. package/package.json +7 -7
@@ -37,7 +37,7 @@ function formatDistributionCertificate(distributionCertificate, validSerialNumbe
37
37
  return line;
38
38
  }
39
39
  exports.formatDistributionCertificate = formatDistributionCertificate;
40
- async function _selectDistributionCertificateAsync(distCerts, validDistributionCertificates) {
40
+ async function selectDistributionCertificateAsync(distCerts, validDistributionCertificates) {
41
41
  const validDistCertSerialNumbers = validDistributionCertificates === null || validDistributionCertificates === void 0 ? void 0 : validDistributionCertificates.map(distCert => distCert.serialNumber);
42
42
  const { chosenDistCert } = await (0, prompts_1.promptAsync)({
43
43
  type: 'select',
@@ -60,12 +60,12 @@ async function selectDistributionCertificateWithDependenciesAsync(ctx, account)
60
60
  return null;
61
61
  }
62
62
  if (!ctx.appStore.authCtx) {
63
- return _selectDistributionCertificateAsync(distCertsForAccount);
63
+ return selectDistributionCertificateAsync(distCertsForAccount);
64
64
  }
65
65
  // get valid certs on the developer portal
66
66
  const certInfoFromApple = await ctx.appStore.listDistributionCertificatesAsync();
67
67
  const validDistCerts = await (0, CredentialsUtils_1.filterRevokedDistributionCertsFromEasServers)(distCertsForAccount, certInfoFromApple);
68
- return _selectDistributionCertificateAsync(distCertsForAccount, validDistCerts);
68
+ return selectDistributionCertificateAsync(distCertsForAccount, validDistCerts);
69
69
  }
70
70
  exports.selectDistributionCertificateWithDependenciesAsync = selectDistributionCertificateWithDependenciesAsync;
71
71
  /**
@@ -79,7 +79,7 @@ async function selectValidDistributionCertificateAsync(ctx, appLookupParams) {
79
79
  return null;
80
80
  }
81
81
  if (!ctx.appStore.authCtx) {
82
- return _selectDistributionCertificateAsync(distCertsForAccount);
82
+ return selectDistributionCertificateAsync(distCertsForAccount);
83
83
  }
84
84
  // filter by apple team
85
85
  (0, assert_1.default)(ctx.appStore.authCtx, 'authentication to the Apple App Store is required');
@@ -91,7 +91,7 @@ async function selectValidDistributionCertificateAsync(ctx, appLookupParams) {
91
91
  const certInfoFromApple = await ctx.appStore.listDistributionCertificatesAsync();
92
92
  const validDistCerts = (0, CredentialsUtils_1.filterRevokedDistributionCertsFromEasServers)(distCertsForAppleTeam, certInfoFromApple);
93
93
  log_1.default.log(`${validDistCerts.length}/${distCertsForAccount.length} Distribution Certificates are currently valid for Apple Team ${(_a = ctx.appStore.authCtx) === null || _a === void 0 ? void 0 : _a.team.id}.`);
94
- return _selectDistributionCertificateAsync(validDistCerts);
94
+ return selectDistributionCertificateAsync(validDistCerts);
95
95
  }
96
96
  exports.selectValidDistributionCertificateAsync = selectValidDistributionCertificateAsync;
97
97
  const APPLE_DIST_CERTS_TOO_MANY_GENERATED_ERROR = `
@@ -99,7 +99,7 @@ You can have only ${chalk_1.default.underline('three')} Apple Distribution Certi
99
99
  Please revoke the old ones or reuse existing from your other apps.
100
100
  Please remember that Apple Distribution Certificates are not application specific!
101
101
  `;
102
- async function provideOrGenerateDistributionCertificateAsync(ctx, accountName) {
102
+ async function provideOrGenerateDistributionCertificateAsync(ctx) {
103
103
  if (!ctx.nonInteractive) {
104
104
  const userProvided = await promptForDistCertAsync(ctx);
105
105
  if (userProvided) {
@@ -112,13 +112,11 @@ async function provideOrGenerateDistributionCertificateAsync(ctx, accountName) {
112
112
  if (!isValid) {
113
113
  log_1.default.warn("Provided Distribution Certificate is no longer valid on Apple's server");
114
114
  }
115
- return isValid
116
- ? userProvided
117
- : await provideOrGenerateDistributionCertificateAsync(ctx, accountName);
115
+ return isValid ? userProvided : await provideOrGenerateDistributionCertificateAsync(ctx);
118
116
  }
119
117
  }
120
118
  }
121
- return await generateDistributionCertificateAsync(ctx, accountName);
119
+ return await generateDistributionCertificateAsync(ctx);
122
120
  }
123
121
  exports.provideOrGenerateDistributionCertificateAsync = provideOrGenerateDistributionCertificateAsync;
124
122
  async function promptForDistCertAsync(ctx) {
@@ -140,7 +138,7 @@ async function promptForDistCertAsync(ctx) {
140
138
  }
141
139
  return userProvided;
142
140
  }
143
- async function generateDistributionCertificateAsync(ctx, accountName) {
141
+ async function generateDistributionCertificateAsync(ctx) {
144
142
  await ctx.appStore.ensureAuthenticatedAsync();
145
143
  try {
146
144
  return await ctx.appStore.createDistributionCertificateAsync();
@@ -176,7 +174,7 @@ async function generateDistributionCertificateAsync(ctx, accountName) {
176
174
  throw e;
177
175
  }
178
176
  }
179
- return await generateDistributionCertificateAsync(ctx, accountName);
177
+ return await generateDistributionCertificateAsync(ctx);
180
178
  }
181
179
  function formatDistributionCertificateFromApple(appleInfo) {
182
180
  const { name, status, id, expires, created, ownerName, serialNumber } = appleInfo;
@@ -2,7 +2,7 @@ import { ApplePushKeyFragment } from '../../../graphql/generated';
2
2
  import { Account } from '../../../user/Account';
3
3
  import { CredentialsContext } from '../../context';
4
4
  import { PushKey } from '../appstore/Credentials.types';
5
- export declare function provideOrGeneratePushKeyAsync(ctx: CredentialsContext, accountName: string): Promise<PushKey>;
5
+ export declare function provideOrGeneratePushKeyAsync(ctx: CredentialsContext): Promise<PushKey>;
6
6
  /**
7
7
  * select a push key from an account (validity status shown on a best effort basis)
8
8
  * */
@@ -12,7 +12,7 @@ const pushKey_1 = require("../appstore/pushKey");
12
12
  const credentials_1 = require("../credentials");
13
13
  const validatePushKey_1 = require("../validators/validatePushKey");
14
14
  const AppleTeamUtils_1 = require("./AppleTeamUtils");
15
- async function provideOrGeneratePushKeyAsync(ctx, accountName) {
15
+ async function provideOrGeneratePushKeyAsync(ctx) {
16
16
  if (!ctx.nonInteractive) {
17
17
  const userProvided = await promptForPushKeyAsync(ctx);
18
18
  if (userProvided) {
@@ -32,11 +32,11 @@ async function provideOrGeneratePushKeyAsync(ctx, accountName) {
32
32
  if (useUserProvided) {
33
33
  return userProvided;
34
34
  }
35
- return await provideOrGeneratePushKeyAsync(ctx, accountName);
35
+ return await provideOrGeneratePushKeyAsync(ctx);
36
36
  }
37
37
  }
38
38
  }
39
- return await generatePushKeyAsync(ctx, accountName);
39
+ return await generatePushKeyAsync(ctx);
40
40
  }
41
41
  exports.provideOrGeneratePushKeyAsync = provideOrGeneratePushKeyAsync;
42
42
  async function promptForPushKeyAsync(ctx) {
@@ -58,7 +58,7 @@ async function promptForPushKeyAsync(ctx) {
58
58
  }
59
59
  return userProvided;
60
60
  }
61
- async function generatePushKeyAsync(ctx, accountName) {
61
+ async function generatePushKeyAsync(ctx) {
62
62
  await ctx.appStore.ensureAuthenticatedAsync();
63
63
  try {
64
64
  return await ctx.appStore.createPushKeyAsync();
@@ -94,7 +94,7 @@ async function generatePushKeyAsync(ctx, accountName) {
94
94
  throw e;
95
95
  }
96
96
  }
97
- return await generatePushKeyAsync(ctx, accountName);
97
+ return await generatePushKeyAsync(ctx);
98
98
  }
99
99
  function formatPushKeyFromApple(pushKey) {
100
100
  const { name, id } = pushKey;
@@ -25,7 +25,7 @@ class SetupTargetBuildCredentials {
25
25
  return await this.setupBuildCredentialsAsync(ctx);
26
26
  }
27
27
  catch (error) {
28
- log_1.default.error('Failed to setup credentials.');
28
+ log_1.default.error('Failed to set up credentials.');
29
29
  throw error;
30
30
  }
31
31
  }
@@ -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;
@@ -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;
@@ -1,4 +1,4 @@
1
- import { DistributionCertificate, DistributionCertificateStoreInfo, ProvisioningProfile, ProvisioningProfileStoreInfo, PushKey, PushKeyStoreInfo } from './Credentials.types';
1
+ import { AscApiKey, AscApiKeyInfo, DistributionCertificate, DistributionCertificateStoreInfo, ProvisioningProfile, ProvisioningProfileStoreInfo, PushKey, PushKeyStoreInfo } from './Credentials.types';
2
2
  import { AuthCtx, Options as AuthenticateOptions } from './authenticate';
3
3
  import { AppLookupParams, IosCapabilitiesOptions } from './ensureAppExists';
4
4
  import { ProfileClass } from './provisioningProfile';
@@ -17,4 +17,10 @@ export default class AppStoreApi {
17
17
  createProvisioningProfileAsync(bundleIdentifier: string, distCert: DistributionCertificate, profileName: string, profileClass?: ProfileClass): Promise<ProvisioningProfile>;
18
18
  revokeProvisioningProfileAsync(bundleIdentifier: string, profileClass?: ProfileClass): Promise<void>;
19
19
  createOrReuseAdhocProvisioningProfileAsync(udids: string[], bundleIdentifier: string, distCertSerialNumber: string): Promise<ProvisioningProfile>;
20
+ listAscApiKeysAsync(): Promise<AscApiKeyInfo[]>;
21
+ getAscApiKeyAsync(keyId: string): Promise<AscApiKeyInfo>;
22
+ createAscApiKeyAsync({ nickname }: {
23
+ nickname: string;
24
+ }): Promise<AscApiKey>;
25
+ revokeAscApiKeyAsync(keyId: string): Promise<AscApiKeyInfo>;
20
26
  }
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ascApiKey_1 = require("./ascApiKey");
3
4
  const authenticate_1 = require("./authenticate");
4
5
  const distributionCertificate_1 = require("./distributionCertificate");
5
6
  const ensureAppExists_1 = require("./ensureAppExists");
@@ -61,5 +62,21 @@ class AppStoreApi {
61
62
  const ctx = await this.ensureAuthenticatedAsync();
62
63
  return await (0, provisioningProfileAdhoc_1.createOrReuseAdhocProvisioningProfileAsync)(ctx, udids, bundleIdentifier, distCertSerialNumber);
63
64
  }
65
+ async listAscApiKeysAsync() {
66
+ const ctx = await this.ensureAuthenticatedAsync();
67
+ return await (0, ascApiKey_1.listAscApiKeysAsync)(ctx);
68
+ }
69
+ async getAscApiKeyAsync(keyId) {
70
+ const ctx = await this.ensureAuthenticatedAsync();
71
+ return await (0, ascApiKey_1.getAscApiKeyAsync)(ctx, keyId);
72
+ }
73
+ async createAscApiKeyAsync({ nickname }) {
74
+ const ctx = await this.ensureAuthenticatedAsync();
75
+ return await (0, ascApiKey_1.createAscApiKeyAsync)(ctx, { nickname });
76
+ }
77
+ async revokeAscApiKeyAsync(keyId) {
78
+ const ctx = await this.ensureAuthenticatedAsync();
79
+ return await (0, ascApiKey_1.revokeAscApiKeyAsync)(ctx, keyId);
80
+ }
64
81
  }
65
82
  exports.default = AppStoreApi;
@@ -4,8 +4,8 @@ exports.isPushKey = exports.formatPushKey = exports.isDistributionCertificate =
4
4
  const tslib_1 = require("tslib");
5
5
  const dateformat_1 = (0, tslib_1.__importDefault)(require("dateformat"));
6
6
  function formatDistributionCertificate({ name, id, status, expires, created, ownerName, }) {
7
- const expiresDate = _formatTimestamp(expires);
8
- const createdDate = _formatTimestamp(created);
7
+ const expiresDate = formatTimestamp(expires);
8
+ const createdDate = formatTimestamp(created);
9
9
  return `${name} (${status}) - ID: ${id} - expires: ${expiresDate} (created: ${createdDate}) - owner: ${ownerName}`;
10
10
  }
11
11
  exports.formatDistributionCertificate = formatDistributionCertificate;
@@ -31,6 +31,6 @@ function isPushKey(obj) {
31
31
  typeof obj.teamId === 'string');
32
32
  }
33
33
  exports.isPushKey = isPushKey;
34
- function _formatTimestamp(timestamp) {
34
+ function formatTimestamp(timestamp) {
35
35
  return (0, dateformat_1.default)(new Date(timestamp * 1000));
36
36
  }
@@ -1,3 +1,5 @@
1
+ /// <reference types="@expo/apple-utils/ts-declarations/expo__app-store" />
2
+ import { UserRole } from '@expo/apple-utils';
1
3
  export interface Device {
2
4
  id: string;
3
5
  teamId: string;
@@ -59,3 +61,14 @@ export interface PushKey {
59
61
  teamId: string;
60
62
  teamName?: string;
61
63
  }
64
+ export declare type AscApiKeyInfo = {
65
+ keyId: string;
66
+ issuerId?: string;
67
+ teamId: string;
68
+ name: string;
69
+ teamName?: string;
70
+ roles: UserRole[];
71
+ };
72
+ export declare type AscApiKey = AscApiKeyInfo & {
73
+ keyP8: string;
74
+ };
@@ -0,0 +1,9 @@
1
+ /// <reference types="@expo/apple-utils/ts-declarations/expo__app-store" />
2
+ import { ApiKey, ApiKeyProps } from '@expo/apple-utils';
3
+ import { AscApiKey, AscApiKeyInfo } from './Credentials.types';
4
+ import { AuthCtx } from './authenticate';
5
+ export declare function listAscApiKeysAsync(authCtx: AuthCtx): Promise<AscApiKeyInfo[]>;
6
+ export declare function getAscApiKeyAsync(authCtx: AuthCtx, keyId: string): Promise<AscApiKeyInfo>;
7
+ export declare function createAscApiKeyAsync(authCtx: AuthCtx, { nickname, allAppsVisible, roles, keyType, }: Partial<Pick<ApiKeyProps, 'nickname' | 'roles' | 'allAppsVisible' | 'keyType'>>): Promise<AscApiKey>;
8
+ export declare function revokeAscApiKeyAsync(authCtx: AuthCtx, keyId: string): Promise<AscApiKeyInfo>;
9
+ export declare function getAscApiKeyInfo(apiKey: ApiKey, authCtx: AuthCtx): AscApiKeyInfo;
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAscApiKeyInfo = exports.revokeAscApiKeyAsync = exports.createAscApiKeyAsync = exports.getAscApiKeyAsync = exports.listAscApiKeysAsync = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const apple_utils_1 = require("@expo/apple-utils");
6
+ const log_1 = (0, tslib_1.__importDefault)(require("../../../log"));
7
+ const ora_1 = require("../../../ora");
8
+ const authenticate_1 = require("./authenticate");
9
+ async function listAscApiKeysAsync(authCtx) {
10
+ const spinner = (0, ora_1.ora)(`Fetching App Store Connect API Keys.`).start();
11
+ try {
12
+ const context = (0, authenticate_1.getRequestContext)(authCtx);
13
+ const keys = await apple_utils_1.ApiKey.getAsync(context);
14
+ spinner.succeed(`Fetched App Store Connect API Keys.`);
15
+ return keys.map(key => getAscApiKeyInfo(key, authCtx));
16
+ }
17
+ catch (error) {
18
+ spinner.fail(`Failed to fetch App Store Connect API Keys.`);
19
+ throw error;
20
+ }
21
+ }
22
+ exports.listAscApiKeysAsync = listAscApiKeysAsync;
23
+ async function getAscApiKeyAsync(authCtx, keyId) {
24
+ const spinner = (0, ora_1.ora)(`Fetching App Store Connect API Key.`).start();
25
+ try {
26
+ const context = (0, authenticate_1.getRequestContext)(authCtx);
27
+ const apiKey = await apple_utils_1.ApiKey.infoAsync(context, { id: keyId });
28
+ spinner.succeed(`Fetched App Store Connect API Key (ID: ${keyId}).`);
29
+ return getAscApiKeyInfo(apiKey, authCtx);
30
+ }
31
+ catch (error) {
32
+ log_1.default.error(error);
33
+ spinner.fail(`Failed to fetch App Store Connect API Key.`);
34
+ throw error;
35
+ }
36
+ }
37
+ exports.getAscApiKeyAsync = getAscApiKeyAsync;
38
+ async function createAscApiKeyAsync(authCtx, { nickname, allAppsVisible, roles, keyType, }) {
39
+ const spinner = (0, ora_1.ora)(`Creating App Store Connect API Key.`).start();
40
+ try {
41
+ const context = (0, authenticate_1.getRequestContext)(authCtx);
42
+ const key = await apple_utils_1.ApiKey.createAsync(context, {
43
+ nickname: nickname !== null && nickname !== void 0 ? nickname : `[expo] ${new Date().getTime()}`,
44
+ allAppsVisible: allAppsVisible !== null && allAppsVisible !== void 0 ? allAppsVisible : true,
45
+ roles: roles !== null && roles !== void 0 ? roles : [apple_utils_1.UserRole.ADMIN],
46
+ keyType: keyType !== null && keyType !== void 0 ? keyType : apple_utils_1.ApiKeyType.PUBLIC_API,
47
+ });
48
+ const keyP8 = await key.downloadAsync();
49
+ if (!keyP8) {
50
+ const { nickname, roles } = key.attributes;
51
+ const humanReadableKey = `App Store Connect Key '${nickname}' (${key.id}) with roles {${roles.join(',')}}`;
52
+ if (!key.attributes.canDownload) {
53
+ // this case would be unexpected because we just created the key
54
+ throw new Error(`${humanReadableKey} is not available for download from Apple.`);
55
+ }
56
+ else if (!key.attributes.isActive) {
57
+ throw new Error(`${humanReadableKey} is inactive and could not be downloaded.`);
58
+ }
59
+ throw new Error(`Failed to download .p8 file of ${humanReadableKey}.`);
60
+ }
61
+ return {
62
+ ...getAscApiKeyInfo(key, authCtx),
63
+ keyP8,
64
+ };
65
+ }
66
+ catch (err) {
67
+ spinner.fail('Failed to create App Store Connect API Key.');
68
+ throw err;
69
+ }
70
+ }
71
+ exports.createAscApiKeyAsync = createAscApiKeyAsync;
72
+ async function revokeAscApiKeyAsync(authCtx, keyId) {
73
+ const spinner = (0, ora_1.ora)(`Revoking App Store Connect API Key.`).start();
74
+ try {
75
+ const context = (0, authenticate_1.getRequestContext)(authCtx);
76
+ const apiKey = await apple_utils_1.ApiKey.infoAsync(context, { id: keyId });
77
+ const revokedKey = await apiKey.revokeAsync();
78
+ spinner.succeed(`Revoked App Store Connect API Key.`);
79
+ return getAscApiKeyInfo(revokedKey, authCtx);
80
+ }
81
+ catch (error) {
82
+ log_1.default.error(error);
83
+ spinner.fail(`Failed to revoke App Store Connect API Key.`);
84
+ throw error;
85
+ }
86
+ }
87
+ exports.revokeAscApiKeyAsync = revokeAscApiKeyAsync;
88
+ function getAscApiKeyInfo(apiKey, authCtx) {
89
+ var _a;
90
+ return {
91
+ name: apiKey.attributes.nickname,
92
+ keyId: apiKey.id,
93
+ issuerId: (_a = apiKey.attributes.provider) === null || _a === void 0 ? void 0 : _a.id,
94
+ teamId: authCtx.team.id,
95
+ teamName: authCtx.team.name,
96
+ roles: apiKey.attributes.roles,
97
+ };
98
+ }
99
+ exports.getAscApiKeyInfo = getAscApiKeyInfo;
@@ -1,3 +1,5 @@
1
+ /// <reference types="@expo/apple-utils/ts-declarations/expo__app-store" />
2
+ import { UserRole } from '@expo/apple-utils';
1
3
  import { AppleDevice } from '../../graphql/generated';
2
4
  import { CredentialSchema } from '../utils/promptForCredentials';
3
5
  import { DistributionCertificate, ProvisioningProfile, PushKey } from './appstore/Credentials.types';
@@ -36,5 +38,20 @@ export interface IosDistCredentials extends DistributionCertificate {
36
38
  type: 'dist-cert';
37
39
  }
38
40
  export declare const distributionCertificateSchema: CredentialSchema<DistributionCertificate>;
41
+ export declare type MinimalAscApiKey = {
42
+ keyP8: string;
43
+ keyId: string;
44
+ issuerId: string;
45
+ teamId?: string;
46
+ teamName?: string;
47
+ roles?: UserRole[];
48
+ name?: string;
49
+ };
50
+ export interface AscApiKeyPath {
51
+ keyP8Path: string;
52
+ keyId: string;
53
+ issuerId: string;
54
+ }
55
+ export declare const ascApiKeyMetadataSchema: CredentialSchema<Omit<MinimalAscApiKey, 'keyP8'>>;
39
56
  export declare const pushKeySchema: CredentialSchema<PushKey>;
40
57
  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.distributionCertificateSchema = exports.getAppLookupParams = void 0;
3
+ exports.provisioningProfileSchema = exports.pushKeySchema = exports.ascApiKeyMetadataSchema = 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,6 +50,21 @@ exports.distributionCertificateSchema = {
50
50
  return answers;
51
51
  },
52
52
  };
53
+ exports.ascApiKeyMetadataSchema = {
54
+ name: 'App Store Connect API Key',
55
+ questions: [
56
+ {
57
+ field: 'keyId',
58
+ type: 'string',
59
+ question: 'Key ID:',
60
+ },
61
+ {
62
+ field: 'issuerId',
63
+ type: 'string',
64
+ question: 'Issuer ID:',
65
+ },
66
+ ],
67
+ };
53
68
  exports.pushKeySchema = {
54
69
  name: 'Apple Push Notifications service key',
55
70
  questions: [
@@ -0,0 +1,47 @@
1
+ export declare type ActionInfo = {
2
+ value: AndroidActionType | IosActionType;
3
+ title: string;
4
+ scope: Scope;
5
+ };
6
+ export declare enum Scope {
7
+ Project = 0,
8
+ Manager = 1,
9
+ Account = 2
10
+ }
11
+ export declare enum AndroidActionType {
12
+ ManageBuildCredentials = 0,
13
+ ManageFcm = 1,
14
+ ManageGoogleServiceAccountKey = 2,
15
+ ManageCredentialsJson = 3,
16
+ GoBackToCaller = 4,
17
+ GoBackToHighLevelActions = 5,
18
+ CreateKeystore = 6,
19
+ DownloadKeystore = 7,
20
+ RemoveKeystore = 8,
21
+ CreateFcm = 9,
22
+ RemoveFcm = 10,
23
+ CreateGsaKey = 11,
24
+ UseExistingGsaKey = 12,
25
+ RemoveGsaKey = 13,
26
+ SetupGsaKey = 14,
27
+ UpdateCredentialsJson = 15,
28
+ SetupBuildCredentialsFromCredentialsJson = 16
29
+ }
30
+ export declare enum IosActionType {
31
+ ManageCredentialsJson = 0,
32
+ ManageBuildCredentials = 1,
33
+ ManagePushKey = 2,
34
+ GoBackToCaller = 3,
35
+ GoBackToHighLevelActions = 4,
36
+ SetupBuildCredentials = 5,
37
+ SetupBuildCredentialsFromCredentialsJson = 6,
38
+ UpdateCredentialsJson = 7,
39
+ UseExistingDistributionCertificate = 8,
40
+ RemoveProvisioningProfile = 9,
41
+ CreateDistributionCertificate = 10,
42
+ RemoveDistributionCertificate = 11,
43
+ SetupPushKey = 12,
44
+ CreatePushKey = 13,
45
+ UseExistingPushKey = 14,
46
+ RemovePushKey = 15
47
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IosActionType = exports.AndroidActionType = exports.Scope = void 0;
4
+ var Scope;
5
+ (function (Scope) {
6
+ Scope[Scope["Project"] = 0] = "Project";
7
+ Scope[Scope["Manager"] = 1] = "Manager";
8
+ Scope[Scope["Account"] = 2] = "Account";
9
+ })(Scope = exports.Scope || (exports.Scope = {}));
10
+ var AndroidActionType;
11
+ (function (AndroidActionType) {
12
+ AndroidActionType[AndroidActionType["ManageBuildCredentials"] = 0] = "ManageBuildCredentials";
13
+ AndroidActionType[AndroidActionType["ManageFcm"] = 1] = "ManageFcm";
14
+ AndroidActionType[AndroidActionType["ManageGoogleServiceAccountKey"] = 2] = "ManageGoogleServiceAccountKey";
15
+ AndroidActionType[AndroidActionType["ManageCredentialsJson"] = 3] = "ManageCredentialsJson";
16
+ AndroidActionType[AndroidActionType["GoBackToCaller"] = 4] = "GoBackToCaller";
17
+ AndroidActionType[AndroidActionType["GoBackToHighLevelActions"] = 5] = "GoBackToHighLevelActions";
18
+ AndroidActionType[AndroidActionType["CreateKeystore"] = 6] = "CreateKeystore";
19
+ AndroidActionType[AndroidActionType["DownloadKeystore"] = 7] = "DownloadKeystore";
20
+ AndroidActionType[AndroidActionType["RemoveKeystore"] = 8] = "RemoveKeystore";
21
+ AndroidActionType[AndroidActionType["CreateFcm"] = 9] = "CreateFcm";
22
+ AndroidActionType[AndroidActionType["RemoveFcm"] = 10] = "RemoveFcm";
23
+ AndroidActionType[AndroidActionType["CreateGsaKey"] = 11] = "CreateGsaKey";
24
+ AndroidActionType[AndroidActionType["UseExistingGsaKey"] = 12] = "UseExistingGsaKey";
25
+ AndroidActionType[AndroidActionType["RemoveGsaKey"] = 13] = "RemoveGsaKey";
26
+ AndroidActionType[AndroidActionType["SetupGsaKey"] = 14] = "SetupGsaKey";
27
+ AndroidActionType[AndroidActionType["UpdateCredentialsJson"] = 15] = "UpdateCredentialsJson";
28
+ AndroidActionType[AndroidActionType["SetupBuildCredentialsFromCredentialsJson"] = 16] = "SetupBuildCredentialsFromCredentialsJson";
29
+ })(AndroidActionType = exports.AndroidActionType || (exports.AndroidActionType = {}));
30
+ var IosActionType;
31
+ (function (IosActionType) {
32
+ IosActionType[IosActionType["ManageCredentialsJson"] = 0] = "ManageCredentialsJson";
33
+ IosActionType[IosActionType["ManageBuildCredentials"] = 1] = "ManageBuildCredentials";
34
+ IosActionType[IosActionType["ManagePushKey"] = 2] = "ManagePushKey";
35
+ IosActionType[IosActionType["GoBackToCaller"] = 3] = "GoBackToCaller";
36
+ IosActionType[IosActionType["GoBackToHighLevelActions"] = 4] = "GoBackToHighLevelActions";
37
+ IosActionType[IosActionType["SetupBuildCredentials"] = 5] = "SetupBuildCredentials";
38
+ IosActionType[IosActionType["SetupBuildCredentialsFromCredentialsJson"] = 6] = "SetupBuildCredentialsFromCredentialsJson";
39
+ IosActionType[IosActionType["UpdateCredentialsJson"] = 7] = "UpdateCredentialsJson";
40
+ IosActionType[IosActionType["UseExistingDistributionCertificate"] = 8] = "UseExistingDistributionCertificate";
41
+ IosActionType[IosActionType["RemoveProvisioningProfile"] = 9] = "RemoveProvisioningProfile";
42
+ IosActionType[IosActionType["CreateDistributionCertificate"] = 10] = "CreateDistributionCertificate";
43
+ IosActionType[IosActionType["RemoveDistributionCertificate"] = 11] = "RemoveDistributionCertificate";
44
+ IosActionType[IosActionType["SetupPushKey"] = 12] = "SetupPushKey";
45
+ IosActionType[IosActionType["CreatePushKey"] = 13] = "CreatePushKey";
46
+ IosActionType[IosActionType["UseExistingPushKey"] = 14] = "UseExistingPushKey";
47
+ IosActionType[IosActionType["RemovePushKey"] = 15] = "RemovePushKey";
48
+ })(IosActionType = exports.IosActionType || (exports.IosActionType = {}));
@@ -0,0 +1,6 @@
1
+ import { ActionInfo } from './Actions';
2
+ export declare const highLevelActions: ActionInfo[];
3
+ export declare const credentialsJsonActions: ActionInfo[];
4
+ export declare const buildCredentialsActions: ActionInfo[];
5
+ export declare const fcmActions: ActionInfo[];
6
+ export declare const gsaKeyActions: ActionInfo[];