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.
- package/README.md +27 -27
- package/build/analytics/common.d.ts +8 -0
- package/build/analytics/common.js +19 -0
- package/build/analytics/events.d.ts +43 -0
- package/build/analytics/events.js +51 -0
- package/build/{analytics.d.ts → analytics/rudderstackClient.d.ts} +0 -0
- package/build/{analytics.js → analytics/rudderstackClient.js} +4 -10
- package/build/api.js +3 -3
- package/build/build/android/configure.js +2 -2
- package/build/build/android/graphql.js +2 -4
- package/build/build/android/prepareJob.js +4 -3
- package/build/build/build.js +20 -29
- package/build/build/configure.js +14 -7
- package/build/build/context.d.ts +1 -1
- package/build/build/context.js +2 -2
- package/build/build/ios/UpdatesModule.js +2 -2
- package/build/build/ios/credentials.js +3 -3
- package/build/build/ios/graphql.js +2 -23
- package/build/build/ios/prepareJob.js +4 -6
- package/build/build/local.js +18 -27
- package/build/build/metadata.js +5 -10
- package/build/build/types.d.ts +0 -1
- package/build/build/utils/devClient.js +8 -5
- package/build/build/utils/formatBuild.js +1 -9
- package/build/build/utils/repository.js +10 -7
- package/build/build/utils/url.js +1 -1
- package/build/build/validate.js +4 -4
- package/build/commandUtils/EasCommand.d.ts +1 -0
- package/build/commandUtils/EasCommand.js +25 -4
- package/build/commands/branch/create.js +3 -2
- package/build/commands/branch/delete.js +1 -1
- package/build/commands/branch/list.js +1 -1
- package/build/commands/branch/publish.js +6 -5
- package/build/commands/branch/view.js +1 -1
- package/build/commands/build/index.js +44 -25
- package/build/commands/channel/edit.js +1 -1
- package/build/commands/channel/list.js +1 -1
- package/build/commands/channel/view.js +1 -1
- package/build/commands/diagnostics.js +2 -2
- package/build/commands/project/info.js +1 -1
- package/build/commands/secret/delete.js +1 -1
- package/build/commands/update/view.js +1 -1
- package/build/credentials/android/AndroidCredentialsProvider.js +2 -2
- package/build/credentials/android/actions/RemoveFcm.js +4 -4
- package/build/credentials/android/actions/{SetupBuildCredentials.d.ts → SetUpBuildCredentials.d.ts} +1 -1
- package/build/credentials/android/actions/{SetupBuildCredentials.js → SetUpBuildCredentials.js} +3 -3
- package/build/credentials/android/actions/{SetupBuildCredentialsFromCredentialsJson.d.ts → SetUpBuildCredentialsFromCredentialsJson.d.ts} +1 -1
- package/build/credentials/android/actions/{SetupBuildCredentialsFromCredentialsJson.js → SetUpBuildCredentialsFromCredentialsJson.js} +3 -3
- package/build/credentials/android/actions/{SetupGoogleServiceAccountKey.d.ts → SetUpGoogleServiceAccountKey.d.ts} +1 -1
- package/build/credentials/android/actions/{SetupGoogleServiceAccountKey.js → SetUpGoogleServiceAccountKey.js} +3 -3
- package/build/credentials/android/api/graphql/queries/GoogleServiceAccountKeyQuery.js +2 -0
- package/build/credentials/android/utils/keystore.js +67 -32
- package/build/credentials/credentialsJson/update.js +5 -4
- package/build/credentials/errors.d.ts +4 -0
- package/build/credentials/errors.js +8 -1
- package/build/credentials/ios/IosCredentialsProvider.js +4 -4
- package/build/credentials/ios/actions/AscApiKeyUtils.d.ts +17 -1
- package/build/credentials/ios/actions/AscApiKeyUtils.js +158 -24
- package/build/credentials/ios/actions/AssignAscApiKey.d.ts +9 -0
- package/build/credentials/ios/actions/AssignAscApiKey.js +29 -0
- package/build/credentials/ios/actions/CreateAscApiKey.d.ts +9 -0
- package/build/credentials/ios/actions/CreateAscApiKey.js +21 -0
- package/build/credentials/ios/actions/CreateDistributionCertificate.js +1 -1
- package/build/credentials/ios/actions/CreatePushKey.js +1 -1
- package/build/credentials/ios/actions/DistributionCertificateUtils.d.ts +1 -1
- package/build/credentials/ios/actions/DistributionCertificateUtils.js +6 -8
- package/build/credentials/ios/actions/PushKeyUtils.d.ts +1 -1
- package/build/credentials/ios/actions/PushKeyUtils.js +6 -6
- package/build/credentials/ios/actions/RemoveAscApiKey.d.ts +14 -0
- package/build/credentials/ios/actions/RemoveAscApiKey.js +55 -0
- package/build/credentials/ios/actions/{SetupAdhocProvisioningProfile.d.ts → SetUpAdhocProvisioningProfile.d.ts} +1 -1
- package/build/credentials/ios/actions/{SetupAdhocProvisioningProfile.js → SetUpAdhocProvisioningProfile.js} +5 -5
- package/build/credentials/ios/actions/SetUpAscApiKey.d.ts +21 -0
- package/build/credentials/ios/actions/SetUpAscApiKey.js +114 -0
- package/build/credentials/ios/actions/{SetupBuildCredentials.d.ts → SetUpBuildCredentials.d.ts} +1 -1
- package/build/credentials/ios/actions/{SetupBuildCredentials.js → SetUpBuildCredentials.js} +5 -5
- package/build/credentials/ios/actions/{SetupBuildCredentialsFromCredentialsJson.d.ts → SetUpBuildCredentialsFromCredentialsJson.d.ts} +1 -1
- package/build/credentials/ios/actions/{SetupBuildCredentialsFromCredentialsJson.js → SetUpBuildCredentialsFromCredentialsJson.js} +5 -5
- package/build/credentials/ios/actions/{SetupDistributionCertificate.d.ts → SetUpDistributionCertificate.d.ts} +1 -1
- package/build/credentials/ios/actions/{SetupDistributionCertificate.js → SetUpDistributionCertificate.js} +3 -3
- package/build/credentials/ios/actions/{SetupInternalProvisioningProfile.d.ts → SetUpInternalProvisioningProfile.d.ts} +1 -1
- package/build/credentials/ios/actions/{SetupInternalProvisioningProfile.js → SetUpInternalProvisioningProfile.js} +7 -7
- package/build/credentials/ios/actions/{SetupProvisioningProfile.d.ts → SetUpProvisioningProfile.d.ts} +1 -1
- package/build/credentials/ios/actions/{SetupProvisioningProfile.js → SetUpProvisioningProfile.js} +5 -5
- package/build/credentials/ios/actions/{SetupPushKey.d.ts → SetUpPushKey.d.ts} +1 -1
- package/build/credentials/ios/actions/{SetupPushKey.js → SetUpPushKey.js} +3 -3
- package/build/credentials/ios/actions/SetUpSubmissionCredentials.d.ts +10 -0
- package/build/credentials/ios/actions/SetUpSubmissionCredentials.js +53 -0
- package/build/credentials/ios/actions/{SetupTargetBuildCredentials.d.ts → SetUpTargetBuildCredentials.d.ts} +1 -1
- package/build/credentials/ios/actions/{SetupTargetBuildCredentials.js → SetUpTargetBuildCredentials.js} +10 -10
- package/build/credentials/ios/actions/{SetupTargetBuildCredentialsFromCredentialsJson.d.ts → SetUpTargetBuildCredentialsFromCredentialsJson.d.ts} +1 -1
- package/build/credentials/ios/actions/{SetupTargetBuildCredentialsFromCredentialsJson.js → SetUpTargetBuildCredentialsFromCredentialsJson.js} +3 -3
- package/build/credentials/ios/api/GraphqlClient.d.ts +8 -2
- package/build/credentials/ios/api/GraphqlClient.js +74 -2
- package/build/credentials/ios/api/graphql/mutations/AppStoreConnectApiKeyMutation.d.ts +5 -0
- package/build/credentials/ios/api/graphql/mutations/AppStoreConnectApiKeyMutation.js +54 -0
- package/build/credentials/ios/api/graphql/mutations/IosAppCredentialsMutation.d.ts +1 -0
- package/build/credentials/ios/api/graphql/mutations/IosAppCredentialsMutation.js +25 -0
- package/build/credentials/ios/api/graphql/queries/AppQuery.js +3 -1
- package/build/credentials/ios/api/graphql/queries/AppStoreConnectApiKeyQuery.d.ts +4 -0
- package/build/credentials/ios/api/graphql/queries/AppStoreConnectApiKeyQuery.js +33 -0
- package/build/credentials/ios/api/graphql/queries/AppleDeviceQuery.js +6 -2
- package/build/credentials/ios/api/graphql/queries/AppleDistributionCertificateQuery.js +7 -1
- package/build/credentials/ios/api/graphql/queries/AppleProvisioningProfileQuery.js +5 -1
- package/build/credentials/ios/api/graphql/queries/ApplePushKeyQuery.js +2 -0
- package/build/credentials/ios/api/graphql/queries/AppleTeamQuery.js +5 -1
- package/build/credentials/ios/appstore/AppStoreApi.d.ts +1 -1
- package/build/credentials/ios/appstore/Credentials.types.d.ts +1 -0
- package/build/credentials/ios/appstore/ascApiKey.d.ts +1 -1
- package/build/credentials/ios/appstore/ascApiKey.js +11 -1
- package/build/credentials/ios/appstore/entitlements.d.ts +2 -2
- package/build/credentials/ios/appstore/entitlements.js +20 -10
- package/build/credentials/ios/credentials.d.ts +2 -1
- package/build/credentials/ios/credentials.js +7 -2
- package/build/credentials/ios/utils/printCredentials.js +30 -1
- package/build/credentials/ios/validators/validateAscApiKey.d.ts +5 -0
- package/build/credentials/ios/validators/validateAscApiKey.js +21 -0
- package/build/credentials/manager/Actions.d.ts +52 -0
- package/build/credentials/manager/Actions.js +53 -0
- package/build/credentials/manager/AndroidActions.d.ts +6 -0
- package/build/credentials/manager/AndroidActions.js +114 -0
- package/build/credentials/manager/IosActions.d.ts +7 -0
- package/build/credentials/manager/IosActions.js +145 -0
- package/build/credentials/manager/ManageAndroid.d.ts +1 -29
- package/build/credentials/manager/ManageAndroid.js +30 -163
- package/build/credentials/manager/ManageIos.d.ts +1 -29
- package/build/credentials/manager/ManageIos.js +81 -169
- package/build/credentials/utils/promptForCredentials.d.ts +2 -1
- package/build/credentials/utils/promptForCredentials.js +3 -2
- package/build/graphql/client.d.ts +8 -2
- package/build/graphql/client.js +1 -1
- package/build/graphql/generated.d.ts +313 -85
- package/build/graphql/generated.js +23 -1
- package/build/graphql/mutations/KeystoreGenerationUrlMutation.d.ts +3 -0
- package/build/graphql/mutations/KeystoreGenerationUrlMutation.js +23 -0
- package/build/graphql/queries/BuildQuery.js +4 -1
- package/build/graphql/queries/EnvironmentSecretsQuery.js +4 -2
- package/build/graphql/queries/ProjectQuery.js +3 -1
- package/build/graphql/queries/PublishQuery.js +4 -1
- package/build/graphql/queries/SubmissionQuery.js +5 -2
- package/build/graphql/queries/UserQuery.js +4 -1
- package/build/graphql/queries/WebhookQuery.js +6 -2
- package/build/graphql/types/Build.js +1 -6
- package/build/graphql/types/credentials/AppStoreConnectApiKey.d.ts +1 -0
- package/build/graphql/types/credentials/AppStoreConnectApiKey.js +23 -0
- package/build/graphql/types/credentials/IosAppCredentials.js +6 -0
- package/build/log.d.ts +0 -2
- package/build/log.js +2 -12
- package/build/project/projectUtils.js +1 -1
- package/build/project/publish.js +2 -2
- package/build/project/workflow.js +2 -2
- package/build/submit/ArchiveSource.js +2 -1
- package/build/submit/BaseSubmitter.d.ts +20 -4
- package/build/submit/BaseSubmitter.js +34 -1
- package/build/submit/android/AndroidSubmitter.d.ts +12 -6
- package/build/submit/android/AndroidSubmitter.js +31 -20
- package/build/submit/android/ServiceAccountSource.js +2 -2
- package/build/submit/context.d.ts +2 -0
- package/build/submit/context.js +14 -0
- package/build/submit/ios/AppSpecificPasswordSource.d.ts +9 -6
- package/build/submit/ios/AppSpecificPasswordSource.js +42 -20
- package/build/submit/ios/AscApiKeySource.d.ts +9 -3
- package/build/submit/ios/AscApiKeySource.js +10 -10
- package/build/submit/ios/CredentialsServiceSource.d.ts +15 -0
- package/build/submit/ios/CredentialsServiceSource.js +52 -0
- package/build/submit/ios/IosSubmitCommand.d.ts +1 -2
- package/build/submit/ios/IosSubmitCommand.js +24 -53
- package/build/submit/ios/IosSubmitter.d.ts +20 -7
- package/build/submit/ios/IosSubmitter.js +79 -43
- package/build/submit/submit.js +13 -4
- package/build/submit/utils/errors.js +2 -0
- package/build/user/User.js +2 -1
- package/build/utils/easCli.d.ts +1 -0
- package/build/utils/easCli.js +5 -0
- package/build/utils/{expoCommand.d.ts → expoCli.d.ts} +0 -0
- package/build/utils/{expoCommand.js → expoCli.js} +0 -0
- package/build/utils/profiles.js +9 -2
- package/build/vcs/clients/git.d.ts +26 -0
- package/build/vcs/clients/git.js +184 -0
- package/build/vcs/clients/gitNoCommit.d.ts +7 -0
- package/build/vcs/clients/gitNoCommit.js +27 -0
- package/build/vcs/clients/noVcs.d.ts +6 -0
- package/build/vcs/clients/noVcs.js +19 -0
- package/build/vcs/git.d.ts +10 -17
- package/build/vcs/git.js +7 -175
- package/build/vcs/index.d.ts +2 -2
- package/build/vcs/index.js +15 -6
- package/build/vcs/local.d.ts +18 -5
- package/build/vcs/local.js +61 -32
- package/build/vcs/vcs.d.ts +2 -1
- package/build/vcs/vcs.js +8 -4
- package/oclif.manifest.json +1 -1
- package/package.json +7 -7
- package/build/build/utils/analytics.d.ts +0 -22
- package/build/build/utils/analytics.js +0 -28
|
@@ -9,8 +9,8 @@ const prompts_1 = require("../../prompts");
|
|
|
9
9
|
const credentialsJsonReader = (0, tslib_1.__importStar)(require("../credentialsJson/read"));
|
|
10
10
|
const utils_1 = require("../credentialsJson/utils");
|
|
11
11
|
const BuildCredentialsUtils_1 = require("./actions/BuildCredentialsUtils");
|
|
12
|
-
const
|
|
13
|
-
const
|
|
12
|
+
const SetUpBuildCredentials_1 = require("./actions/SetUpBuildCredentials");
|
|
13
|
+
const SetUpPushKey_1 = require("./actions/SetUpPushKey");
|
|
14
14
|
const provisioningProfile_1 = require("./utils/provisioningProfile");
|
|
15
15
|
class IosCredentialsProvider {
|
|
16
16
|
constructor(ctx, options) {
|
|
@@ -39,7 +39,7 @@ class IosCredentialsProvider {
|
|
|
39
39
|
return iosCredentials;
|
|
40
40
|
}
|
|
41
41
|
async getRemoteAsync() {
|
|
42
|
-
return await new
|
|
42
|
+
return await new SetUpBuildCredentials_1.SetUpBuildCredentials({
|
|
43
43
|
app: this.options.app,
|
|
44
44
|
targets: this.options.targets,
|
|
45
45
|
distribution: this.options.distribution,
|
|
@@ -58,7 +58,7 @@ class IosCredentialsProvider {
|
|
|
58
58
|
bundleIdentifier: applicationTarget.bundleIdentifier,
|
|
59
59
|
parentBundleIdentifier: applicationTarget.parentBundleIdentifier,
|
|
60
60
|
};
|
|
61
|
-
const setupPushKeyAction = new
|
|
61
|
+
const setupPushKeyAction = new SetUpPushKey_1.SetUpPushKey(appLookupParams);
|
|
62
62
|
const isPushKeySetup = await setupPushKeyAction.isPushKeySetupAsync(ctx);
|
|
63
63
|
if (isPushKeySetup) {
|
|
64
64
|
log_1.default.succeed(`Push Notifications setup for ${app.projectName}: ${applicationTarget.bundleIdentifier}`);
|
|
@@ -1,5 +1,21 @@
|
|
|
1
|
+
import { AppStoreConnectApiKeyFragment } from '../../../graphql/generated';
|
|
2
|
+
import { Account } from '../../../user/Account';
|
|
3
|
+
import { CredentialsContext } from '../../context';
|
|
1
4
|
import { AscApiKey } from '../appstore/Credentials.types';
|
|
2
5
|
import { AscApiKeyPath, MinimalAscApiKey } from '../credentials';
|
|
3
|
-
export declare
|
|
6
|
+
export declare enum AppStoreApiKeyPurpose {
|
|
7
|
+
SUBMISSION_SERVICE = "EAS Submit"
|
|
8
|
+
}
|
|
9
|
+
export declare function promptForAscApiKeyPathAsync(ctx: CredentialsContext): Promise<AscApiKeyPath>;
|
|
4
10
|
export declare function promptForIssuerIdAsync(): Promise<string>;
|
|
5
11
|
export declare function getMinimalAscApiKeyAsync(ascApiKey: AscApiKey): Promise<MinimalAscApiKey>;
|
|
12
|
+
export declare function provideOrGenerateAscApiKeyAsync(ctx: CredentialsContext, purpose: AppStoreApiKeyPurpose): Promise<MinimalAscApiKey>;
|
|
13
|
+
export declare function getAscApiKeyName(purpose: AppStoreApiKeyPurpose): string;
|
|
14
|
+
export declare function getAscApiKeysFromAccountAsync(ctx: CredentialsContext, account: Account, { filterDifferentAppleTeam }?: {
|
|
15
|
+
filterDifferentAppleTeam?: boolean;
|
|
16
|
+
}): Promise<AppStoreConnectApiKeyFragment[]>;
|
|
17
|
+
export declare function selectAscApiKeysFromAccountAsync(ctx: CredentialsContext, account: Account, { filterDifferentAppleTeam }?: {
|
|
18
|
+
filterDifferentAppleTeam?: boolean;
|
|
19
|
+
}): Promise<AppStoreConnectApiKeyFragment | null>;
|
|
20
|
+
export declare function sortAscApiKeysByUpdatedAtDesc(keys: AppStoreConnectApiKeyFragment[]): AppStoreConnectApiKeyFragment[];
|
|
21
|
+
export declare function formatAscApiKey(ascApiKey: AppStoreConnectApiKeyFragment): string;
|
|
@@ -1,23 +1,104 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getMinimalAscApiKeyAsync = exports.promptForIssuerIdAsync = exports.
|
|
3
|
+
exports.formatAscApiKey = exports.sortAscApiKeysByUpdatedAtDesc = exports.selectAscApiKeysFromAccountAsync = exports.getAscApiKeysFromAccountAsync = exports.getAscApiKeyName = exports.provideOrGenerateAscApiKeyAsync = exports.getMinimalAscApiKeyAsync = exports.promptForIssuerIdAsync = exports.promptForAscApiKeyPathAsync = exports.AppStoreApiKeyPurpose = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
|
|
6
6
|
const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
|
|
7
|
+
const nanoid_1 = require("nanoid");
|
|
7
8
|
const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
8
|
-
const uuid = (0, tslib_1.__importStar)(require("uuid"));
|
|
9
9
|
const log_1 = (0, tslib_1.__importStar)(require("../../../log"));
|
|
10
10
|
const prompts_1 = require("../../../prompts");
|
|
11
|
+
const date_1 = require("../../../utils/date");
|
|
11
12
|
const promptForCredentials_1 = require("../../utils/promptForCredentials");
|
|
12
13
|
const credentials_1 = require("../credentials");
|
|
13
|
-
|
|
14
|
+
const validateAscApiKey_1 = require("../validators/validateAscApiKey");
|
|
15
|
+
const AppleTeamUtils_1 = require("./AppleTeamUtils");
|
|
16
|
+
var AppStoreApiKeyPurpose;
|
|
17
|
+
(function (AppStoreApiKeyPurpose) {
|
|
18
|
+
AppStoreApiKeyPurpose["SUBMISSION_SERVICE"] = "EAS Submit";
|
|
19
|
+
})(AppStoreApiKeyPurpose = exports.AppStoreApiKeyPurpose || (exports.AppStoreApiKeyPurpose = {}));
|
|
20
|
+
async function promptForAscApiKeyPathAsync(ctx) {
|
|
21
|
+
const { keyId, keyP8Path } = await promptForKeyP8AndIdAsync();
|
|
22
|
+
const bestEffortIssuerId = await getBestEffortIssuerIdAsync(ctx, keyId);
|
|
23
|
+
if (bestEffortIssuerId) {
|
|
24
|
+
log_1.default.log(`Detected Issuer ID: ${bestEffortIssuerId}`);
|
|
25
|
+
return { keyId, issuerId: bestEffortIssuerId, keyP8Path };
|
|
26
|
+
}
|
|
27
|
+
const issuerId = await promptForIssuerIdAsync();
|
|
28
|
+
return { keyId, issuerId, keyP8Path };
|
|
29
|
+
}
|
|
30
|
+
exports.promptForAscApiKeyPathAsync = promptForAscApiKeyPathAsync;
|
|
31
|
+
async function promptForIssuerIdAsync() {
|
|
32
|
+
log_1.default.log(chalk_1.default.bold('An App Store Connect Issuer ID is required'));
|
|
33
|
+
log_1.default.log(`If you're not sure what this is or how to find yours, ${(0, log_1.learnMore)('https://expo.fyi/asc-issuer-id')}`);
|
|
34
|
+
// Do not perform uuid validation - Apple's issuerIds are not RFC4122 compliant
|
|
35
|
+
const { issuerId } = await (0, promptForCredentials_1.getCredentialsFromUserAsync)(credentials_1.ascApiKeyIssuerIdSchema);
|
|
36
|
+
return issuerId;
|
|
37
|
+
}
|
|
38
|
+
exports.promptForIssuerIdAsync = promptForIssuerIdAsync;
|
|
39
|
+
async function getMinimalAscApiKeyAsync(ascApiKey) {
|
|
40
|
+
var _a;
|
|
41
|
+
return {
|
|
42
|
+
...ascApiKey,
|
|
43
|
+
issuerId: (_a = ascApiKey.issuerId) !== null && _a !== void 0 ? _a : (await promptForIssuerIdAsync()),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
exports.getMinimalAscApiKeyAsync = getMinimalAscApiKeyAsync;
|
|
47
|
+
async function provideOrGenerateAscApiKeyAsync(ctx, purpose) {
|
|
48
|
+
if (ctx.nonInteractive) {
|
|
49
|
+
throw new Error(`A new App Store Connect API Key cannot be created in non-interactive mode.`);
|
|
50
|
+
}
|
|
51
|
+
const userProvided = await promptForAscApiKeyAsync(ctx);
|
|
52
|
+
if (!userProvided) {
|
|
53
|
+
return await generateAscApiKeyAsync(ctx, purpose);
|
|
54
|
+
}
|
|
55
|
+
if (!ctx.appStore.authCtx) {
|
|
56
|
+
log_1.default.warn('Unable to validate App Store Connect API Key, you are not authenticated with Apple.');
|
|
57
|
+
return userProvided;
|
|
58
|
+
}
|
|
59
|
+
const isValidAndTracked = await (0, validateAscApiKey_1.isAscApiKeyValidAndTrackedAsync)(ctx, userProvided);
|
|
60
|
+
if (isValidAndTracked) {
|
|
61
|
+
return userProvided;
|
|
62
|
+
}
|
|
63
|
+
const useUserProvided = await (0, prompts_1.confirmAsync)({
|
|
64
|
+
message: `App Store Connect API Key with ID ${userProvided.keyId} is not valid on Apple's servers. Proceed anyway?`,
|
|
65
|
+
});
|
|
66
|
+
if (useUserProvided) {
|
|
67
|
+
return userProvided;
|
|
68
|
+
}
|
|
69
|
+
return await provideOrGenerateAscApiKeyAsync(ctx, purpose);
|
|
70
|
+
}
|
|
71
|
+
exports.provideOrGenerateAscApiKeyAsync = provideOrGenerateAscApiKeyAsync;
|
|
72
|
+
async function generateAscApiKeyAsync(ctx, purpose) {
|
|
73
|
+
//console.log('debug');
|
|
74
|
+
await ctx.appStore.ensureAuthenticatedAsync();
|
|
75
|
+
const ascApiKey = await ctx.appStore.createAscApiKeyAsync({
|
|
76
|
+
nickname: getAscApiKeyName(purpose),
|
|
77
|
+
});
|
|
78
|
+
return await getMinimalAscApiKeyAsync(ascApiKey);
|
|
79
|
+
}
|
|
80
|
+
function getAscApiKeyName(purpose) {
|
|
81
|
+
const nameParts = ['[Expo]', purpose, (0, nanoid_1.nanoid)(10)];
|
|
82
|
+
return nameParts.join(' ');
|
|
83
|
+
}
|
|
84
|
+
exports.getAscApiKeyName = getAscApiKeyName;
|
|
85
|
+
async function promptForAscApiKeyAsync(ctx) {
|
|
86
|
+
const shouldAutoGenerateCredentials = await (0, promptForCredentials_1.shouldAutoGenerateCredentialsAsync)(credentials_1.ascApiKeyIdSchema);
|
|
87
|
+
if (shouldAutoGenerateCredentials) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
const ascApiKeyPath = await promptForAscApiKeyPathAsync(ctx);
|
|
91
|
+
const { keyP8Path, keyId, issuerId } = ascApiKeyPath;
|
|
92
|
+
return { keyP8: await fs_extra_1.default.readFile(keyP8Path, 'utf-8'), keyId, issuerId };
|
|
93
|
+
}
|
|
94
|
+
async function promptForKeyP8AndIdAsync() {
|
|
14
95
|
var _a, _b;
|
|
15
96
|
log_1.default.log(chalk_1.default.bold('An App Store Connect Api key is required to upload your app to the Apple App Store'));
|
|
16
97
|
log_1.default.log(`If you're not sure what this is or how to create one, ${(0, log_1.learnMore)('https://expo.fyi/creating-asc-api-key')}`);
|
|
17
98
|
const { keyP8Path } = await (0, prompts_1.promptAsync)({
|
|
18
99
|
type: 'text',
|
|
19
100
|
name: 'keyP8Path',
|
|
20
|
-
message: 'Path to App Store Connect
|
|
101
|
+
message: 'Path to App Store Connect API Key:',
|
|
21
102
|
initial: 'AuthKey_ABCD.p8',
|
|
22
103
|
// eslint-disable-next-line async-protect/async-suffix
|
|
23
104
|
validate: async (filePath) => {
|
|
@@ -35,29 +116,82 @@ async function promptForAscApiKeyAsync() {
|
|
|
35
116
|
});
|
|
36
117
|
const regex = /^AuthKey_(?<keyId>\w+)\.p8$/; // Common ASC Api file name downloaded from Apple
|
|
37
118
|
const bestEffortKeyId = (_b = (_a = path_1.default.basename(keyP8Path).match(regex)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b.keyId;
|
|
38
|
-
const
|
|
119
|
+
const { keyId } = await (0, promptForCredentials_1.getCredentialsFromUserAsync)(credentials_1.ascApiKeyIdSchema, {
|
|
39
120
|
keyId: bestEffortKeyId,
|
|
40
121
|
});
|
|
41
|
-
return {
|
|
122
|
+
return { keyId, keyP8Path };
|
|
42
123
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
message: 'App Store Connect Issuer ID:',
|
|
51
|
-
validate: (input) => uuid.validate(input),
|
|
52
|
-
});
|
|
53
|
-
return issuerId;
|
|
124
|
+
async function getBestEffortIssuerIdAsync(ctx, ascApiKeyId) {
|
|
125
|
+
var _a;
|
|
126
|
+
if (!ctx.appStore.authCtx) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
const ascApiKeyInfo = await ctx.appStore.getAscApiKeyAsync(ascApiKeyId);
|
|
130
|
+
return (_a = ascApiKeyInfo === null || ascApiKeyInfo === void 0 ? void 0 : ascApiKeyInfo.issuerId) !== null && _a !== void 0 ? _a : null;
|
|
54
131
|
}
|
|
55
|
-
|
|
56
|
-
|
|
132
|
+
async function getAscApiKeysFromAccountAsync(ctx, account, { filterDifferentAppleTeam } = {}) {
|
|
133
|
+
const ascApiKeysForAccount = await ctx.ios.getAscApiKeysForAccountAsync(account);
|
|
134
|
+
if (!filterDifferentAppleTeam) {
|
|
135
|
+
return ascApiKeysForAccount;
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
return filterKeysFromDifferentAppleTeam(ctx, ascApiKeysForAccount);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
exports.getAscApiKeysFromAccountAsync = getAscApiKeysFromAccountAsync;
|
|
142
|
+
async function selectAscApiKeysFromAccountAsync(ctx, account, { filterDifferentAppleTeam } = {}) {
|
|
57
143
|
var _a;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
144
|
+
const ascApiKeysForAccount = await getAscApiKeysFromAccountAsync(ctx, account, {
|
|
145
|
+
filterDifferentAppleTeam,
|
|
146
|
+
});
|
|
147
|
+
if (ascApiKeysForAccount.length === 0) {
|
|
148
|
+
if (filterDifferentAppleTeam) {
|
|
149
|
+
const maybeAppleTeamId = (_a = ctx.appStore.authCtx) === null || _a === void 0 ? void 0 : _a.team.id;
|
|
150
|
+
log_1.default.warn(`There are no App Store Connect API Keys in your EAS account${maybeAppleTeamId ? ` matching Apple Team ID: ${maybeAppleTeamId}.` : '.'}`);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
log_1.default.warn(`There are no App Store Connect API Keys available in your EAS account.`);
|
|
154
|
+
}
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
return selectAscApiKeysAsync(ascApiKeysForAccount);
|
|
62
158
|
}
|
|
63
|
-
exports.
|
|
159
|
+
exports.selectAscApiKeysFromAccountAsync = selectAscApiKeysFromAccountAsync;
|
|
160
|
+
async function selectAscApiKeysAsync(ascApiKeys) {
|
|
161
|
+
const sortedAscApiKeys = sortAscApiKeysByUpdatedAtDesc(ascApiKeys);
|
|
162
|
+
const { chosenAscApiKey } = await (0, prompts_1.promptAsync)({
|
|
163
|
+
type: 'select',
|
|
164
|
+
name: 'chosenAscApiKey',
|
|
165
|
+
message: 'Select an API Key from the list:',
|
|
166
|
+
choices: sortedAscApiKeys.map(ascApiKey => ({
|
|
167
|
+
title: formatAscApiKey(ascApiKey),
|
|
168
|
+
value: ascApiKey,
|
|
169
|
+
})),
|
|
170
|
+
});
|
|
171
|
+
return chosenAscApiKey;
|
|
172
|
+
}
|
|
173
|
+
function filterKeysFromDifferentAppleTeam(ctx, keys) {
|
|
174
|
+
if (!ctx.appStore.authCtx) {
|
|
175
|
+
return keys;
|
|
176
|
+
}
|
|
177
|
+
const teamId = ctx.appStore.authCtx.team.id;
|
|
178
|
+
return keys.filter(key => { var _a; return !key.appleTeam || ((_a = key.appleTeam) === null || _a === void 0 ? void 0 : _a.appleTeamIdentifier) === teamId; });
|
|
179
|
+
}
|
|
180
|
+
function sortAscApiKeysByUpdatedAtDesc(keys) {
|
|
181
|
+
return keys.sort((keyA, keyB) => new Date(keyB.updatedAt).getTime() - new Date(keyA.updatedAt).getTime());
|
|
182
|
+
}
|
|
183
|
+
exports.sortAscApiKeysByUpdatedAtDesc = sortAscApiKeysByUpdatedAtDesc;
|
|
184
|
+
function formatAscApiKey(ascApiKey) {
|
|
185
|
+
const { keyIdentifier, appleTeam, name, updatedAt } = ascApiKey;
|
|
186
|
+
let line = '';
|
|
187
|
+
line += `Key ID: ${keyIdentifier}`;
|
|
188
|
+
if (name) {
|
|
189
|
+
line += chalk_1.default.gray(`\n Name: ${name}`);
|
|
190
|
+
}
|
|
191
|
+
if (appleTeam) {
|
|
192
|
+
line += chalk_1.default.gray(`\n ${(0, AppleTeamUtils_1.formatAppleTeam)(appleTeam)}`);
|
|
193
|
+
}
|
|
194
|
+
line += chalk_1.default.gray(`\n Updated: ${(0, date_1.fromNow)(new Date(updatedAt))} ago`);
|
|
195
|
+
return line;
|
|
196
|
+
}
|
|
197
|
+
exports.formatAscApiKey = formatAscApiKey;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AppStoreConnectApiKeyFragment, CommonIosAppCredentialsFragment } from '../../../graphql/generated';
|
|
2
|
+
import { CredentialsContext } from '../../context';
|
|
3
|
+
import { AppLookupParams } from '../api/GraphqlClient';
|
|
4
|
+
import { AppStoreApiKeyPurpose } from './AscApiKeyUtils';
|
|
5
|
+
export declare class AssignAscApiKey {
|
|
6
|
+
private app;
|
|
7
|
+
constructor(app: AppLookupParams);
|
|
8
|
+
runAsync(ctx: CredentialsContext, ascApiKey: AppStoreConnectApiKeyFragment, purpose: AppStoreApiKeyPurpose): Promise<CommonIosAppCredentialsFragment>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AssignAscApiKey = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const log_1 = (0, tslib_1.__importDefault)(require("../../../log"));
|
|
6
|
+
const AppleTeamUtils_1 = require("./AppleTeamUtils");
|
|
7
|
+
const AscApiKeyUtils_1 = require("./AscApiKeyUtils");
|
|
8
|
+
class AssignAscApiKey {
|
|
9
|
+
constructor(app) {
|
|
10
|
+
this.app = app;
|
|
11
|
+
}
|
|
12
|
+
async runAsync(ctx, ascApiKey, purpose) {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
const appleTeam = (_b = (_a = (await (0, AppleTeamUtils_1.resolveAppleTeamIfAuthenticatedAsync)(ctx, this.app))) !== null && _a !== void 0 ? _a : ascApiKey.appleTeam) !== null && _b !== void 0 ? _b : null;
|
|
15
|
+
const appCredentials = await ctx.ios.createOrGetIosAppCredentialsWithCommonFieldsAsync(this.app, { appleTeam: appleTeam !== null && appleTeam !== void 0 ? appleTeam : undefined });
|
|
16
|
+
let updatedAppCredentials;
|
|
17
|
+
if (purpose === AscApiKeyUtils_1.AppStoreApiKeyPurpose.SUBMISSION_SERVICE) {
|
|
18
|
+
updatedAppCredentials = await ctx.ios.updateIosAppCredentialsAsync(appCredentials, {
|
|
19
|
+
ascApiKeyIdForSubmissions: ascApiKey.id,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
throw new Error(`${purpose} is not yet supported.`);
|
|
24
|
+
}
|
|
25
|
+
log_1.default.succeed(`App Store Connect API Key assigned to ${this.app.projectName}: ${this.app.bundleIdentifier} for ${purpose}.`);
|
|
26
|
+
return updatedAppCredentials;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.AssignAscApiKey = AssignAscApiKey;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AppStoreConnectApiKeyFragment } from '../../../graphql/generated';
|
|
2
|
+
import { Account } from '../../../user/Account';
|
|
3
|
+
import { CredentialsContext } from '../../context';
|
|
4
|
+
import { AppStoreApiKeyPurpose } from './AscApiKeyUtils';
|
|
5
|
+
export declare class CreateAscApiKey {
|
|
6
|
+
private account;
|
|
7
|
+
constructor(account: Account);
|
|
8
|
+
runAsync(ctx: CredentialsContext, purpose: AppStoreApiKeyPurpose): Promise<AppStoreConnectApiKeyFragment>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateAscApiKey = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const log_1 = (0, tslib_1.__importDefault)(require("../../../log"));
|
|
6
|
+
const AscApiKeyUtils_1 = require("./AscApiKeyUtils");
|
|
7
|
+
class CreateAscApiKey {
|
|
8
|
+
constructor(account) {
|
|
9
|
+
this.account = account;
|
|
10
|
+
}
|
|
11
|
+
async runAsync(ctx, purpose) {
|
|
12
|
+
if (ctx.nonInteractive) {
|
|
13
|
+
throw new Error(`A new App Store Connect API Key cannot be created in non-interactive mode.`);
|
|
14
|
+
}
|
|
15
|
+
const ascApiKey = await (0, AscApiKeyUtils_1.provideOrGenerateAscApiKeyAsync)(ctx, purpose);
|
|
16
|
+
const result = await ctx.ios.createAscApiKeyAsync(this.account, ascApiKey);
|
|
17
|
+
log_1.default.succeed('Created App Store Connect API Key');
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.CreateAscApiKey = CreateAscApiKey;
|
|
@@ -9,7 +9,7 @@ class CreateDistributionCertificate {
|
|
|
9
9
|
this.account = account;
|
|
10
10
|
}
|
|
11
11
|
async runAsync(ctx) {
|
|
12
|
-
const distCert = await (0, DistributionCertificateUtils_1.provideOrGenerateDistributionCertificateAsync)(ctx
|
|
12
|
+
const distCert = await (0, DistributionCertificateUtils_1.provideOrGenerateDistributionCertificateAsync)(ctx);
|
|
13
13
|
const result = await ctx.ios.createDistributionCertificateAsync(this.account, distCert);
|
|
14
14
|
log_1.default.succeed('Created distribution certificate');
|
|
15
15
|
return result;
|
|
@@ -12,7 +12,7 @@ class CreatePushKey {
|
|
|
12
12
|
if (ctx.nonInteractive) {
|
|
13
13
|
throw new Error(`A new push key cannot be created in non-interactive mode.`);
|
|
14
14
|
}
|
|
15
|
-
const pushKey = await (0, PushKeyUtils_1.provideOrGeneratePushKeyAsync)(ctx
|
|
15
|
+
const pushKey = await (0, PushKeyUtils_1.provideOrGeneratePushKeyAsync)(ctx);
|
|
16
16
|
const result = await ctx.ios.createPushKeyAsync(this.account, pushKey);
|
|
17
17
|
log_1.default.succeed('Created push key');
|
|
18
18
|
return result;
|
|
@@ -12,4 +12,4 @@ export declare function selectDistributionCertificateWithDependenciesAsync(ctx:
|
|
|
12
12
|
* select a distribution certificate from a valid set (curated on a best effort basis)
|
|
13
13
|
* */
|
|
14
14
|
export declare function selectValidDistributionCertificateAsync(ctx: CredentialsContext, appLookupParams: AppLookupParams): Promise<AppleDistributionCertificateFragment | null>;
|
|
15
|
-
export declare function provideOrGenerateDistributionCertificateAsync(ctx: CredentialsContext
|
|
15
|
+
export declare function provideOrGenerateDistributionCertificateAsync(ctx: CredentialsContext): Promise<DistributionCertificate>;
|
|
@@ -99,12 +99,12 @@ 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
|
|
102
|
+
async function provideOrGenerateDistributionCertificateAsync(ctx) {
|
|
103
103
|
if (!ctx.nonInteractive) {
|
|
104
104
|
const userProvided = await promptForDistCertAsync(ctx);
|
|
105
105
|
if (userProvided) {
|
|
106
106
|
if (!ctx.appStore.authCtx) {
|
|
107
|
-
log_1.default.warn('Unable to validate distribution certificate
|
|
107
|
+
log_1.default.warn('Unable to validate distribution certificate, you are not authenticated with Apple.');
|
|
108
108
|
return userProvided;
|
|
109
109
|
}
|
|
110
110
|
else {
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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,12 +12,12 @@ 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
|
|
15
|
+
async function provideOrGeneratePushKeyAsync(ctx) {
|
|
16
16
|
if (!ctx.nonInteractive) {
|
|
17
17
|
const userProvided = await promptForPushKeyAsync(ctx);
|
|
18
18
|
if (userProvided) {
|
|
19
19
|
if (!ctx.appStore.authCtx) {
|
|
20
|
-
log_1.default.warn('Unable to validate push key
|
|
20
|
+
log_1.default.warn('Unable to validate push key, you are not authenticated with Apple.');
|
|
21
21
|
return userProvided;
|
|
22
22
|
}
|
|
23
23
|
else {
|
|
@@ -32,11 +32,11 @@ async function provideOrGeneratePushKeyAsync(ctx, accountName) {
|
|
|
32
32
|
if (useUserProvided) {
|
|
33
33
|
return userProvided;
|
|
34
34
|
}
|
|
35
|
-
return await provideOrGeneratePushKeyAsync(ctx
|
|
35
|
+
return await provideOrGeneratePushKeyAsync(ctx);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
return await generatePushKeyAsync(ctx
|
|
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
|
|
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
|
|
97
|
+
return await generatePushKeyAsync(ctx);
|
|
98
98
|
}
|
|
99
99
|
function formatPushKeyFromApple(pushKey) {
|
|
100
100
|
const { name, id } = pushKey;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AppStoreConnectApiKeyFragment } from '../../../graphql/generated';
|
|
2
|
+
import { Account } from '../../../user/Account';
|
|
3
|
+
import { CredentialsContext } from '../../context';
|
|
4
|
+
export declare class SelectAndRemoveAscApiKey {
|
|
5
|
+
private account;
|
|
6
|
+
constructor(account: Account);
|
|
7
|
+
runAsync(ctx: CredentialsContext): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export declare class RemoveAscApiKey {
|
|
10
|
+
private account;
|
|
11
|
+
private ascApiKey;
|
|
12
|
+
constructor(account: Account, ascApiKey: AppStoreConnectApiKeyFragment);
|
|
13
|
+
runAsync(ctx: CredentialsContext): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RemoveAscApiKey = exports.SelectAndRemoveAscApiKey = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const log_1 = (0, tslib_1.__importDefault)(require("../../../log"));
|
|
6
|
+
const prompts_1 = require("../../../prompts");
|
|
7
|
+
const AscApiKeyUtils_1 = require("./AscApiKeyUtils");
|
|
8
|
+
class SelectAndRemoveAscApiKey {
|
|
9
|
+
constructor(account) {
|
|
10
|
+
this.account = account;
|
|
11
|
+
}
|
|
12
|
+
async runAsync(ctx) {
|
|
13
|
+
const selected = await (0, AscApiKeyUtils_1.selectAscApiKeysFromAccountAsync)(ctx, this.account);
|
|
14
|
+
if (selected) {
|
|
15
|
+
await new RemoveAscApiKey(this.account, selected).runAsync(ctx);
|
|
16
|
+
log_1.default.succeed('Removed App Store Connect API Key');
|
|
17
|
+
log_1.default.newLine();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.SelectAndRemoveAscApiKey = SelectAndRemoveAscApiKey;
|
|
22
|
+
class RemoveAscApiKey {
|
|
23
|
+
constructor(account, ascApiKey) {
|
|
24
|
+
this.account = account;
|
|
25
|
+
this.ascApiKey = ascApiKey;
|
|
26
|
+
}
|
|
27
|
+
async runAsync(ctx) {
|
|
28
|
+
if (ctx.nonInteractive) {
|
|
29
|
+
throw new Error(`Cannot remove App Store Connect API Keys in non-interactive mode.`);
|
|
30
|
+
}
|
|
31
|
+
// TODO(quin): add an extra edge on AppStoreConnectApiKey to find the apps using it
|
|
32
|
+
const confirm = await (0, prompts_1.confirmAsync)({
|
|
33
|
+
message: `Deleting this API Key may affect your projects that rely on it. Do you want to continue?`,
|
|
34
|
+
});
|
|
35
|
+
if (!confirm) {
|
|
36
|
+
log_1.default.log('Aborting');
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
log_1.default.log('Removing API Key');
|
|
40
|
+
await ctx.ios.deleteAscApiKeyAsync(this.ascApiKey.id);
|
|
41
|
+
let shouldRevoke = false;
|
|
42
|
+
if (!ctx.nonInteractive) {
|
|
43
|
+
shouldRevoke = await (0, prompts_1.confirmAsync)({
|
|
44
|
+
message: `Do you also want to revoke this API Key on the Apple Developer Portal?`,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
else if (ctx.nonInteractive) {
|
|
48
|
+
log_1.default.log('Skipping API Key revocation on the Apple Developer Portal.');
|
|
49
|
+
}
|
|
50
|
+
if (shouldRevoke) {
|
|
51
|
+
await ctx.appStore.revokeAscApiKeyAsync(this.ascApiKey.keyIdentifier);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.RemoveAscApiKey = RemoveAscApiKey;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AppleDistributionCertificateFragment, IosAppBuildCredentialsFragment } from '../../../graphql/generated';
|
|
2
2
|
import { CredentialsContext } from '../../context';
|
|
3
3
|
import { AppLookupParams } from '../api/GraphqlClient';
|
|
4
|
-
export declare class
|
|
4
|
+
export declare class SetUpAdhocProvisioningProfile {
|
|
5
5
|
private app;
|
|
6
6
|
constructor(app: AppLookupParams);
|
|
7
7
|
runAsync(ctx: CredentialsContext): Promise<IosAppBuildCredentialsFragment>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.doUDIDsMatch = exports.
|
|
3
|
+
exports.doUDIDsMatch = exports.SetUpAdhocProvisioningProfile = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const assert_1 = (0, tslib_1.__importDefault)(require("assert"));
|
|
6
6
|
const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
|
|
@@ -15,19 +15,19 @@ const validateProvisioningProfile_1 = require("../validators/validateProvisionin
|
|
|
15
15
|
const AppleTeamUtils_1 = require("./AppleTeamUtils");
|
|
16
16
|
const BuildCredentialsUtils_1 = require("./BuildCredentialsUtils");
|
|
17
17
|
const DeviceUtils_1 = require("./DeviceUtils");
|
|
18
|
-
const
|
|
18
|
+
const SetUpDistributionCertificate_1 = require("./SetUpDistributionCertificate");
|
|
19
19
|
var ReuseAction;
|
|
20
20
|
(function (ReuseAction) {
|
|
21
21
|
ReuseAction[ReuseAction["Yes"] = 0] = "Yes";
|
|
22
22
|
ReuseAction[ReuseAction["ShowDevices"] = 1] = "ShowDevices";
|
|
23
23
|
ReuseAction[ReuseAction["No"] = 2] = "No";
|
|
24
24
|
})(ReuseAction || (ReuseAction = {}));
|
|
25
|
-
class
|
|
25
|
+
class SetUpAdhocProvisioningProfile {
|
|
26
26
|
constructor(app) {
|
|
27
27
|
this.app = app;
|
|
28
28
|
}
|
|
29
29
|
async runAsync(ctx) {
|
|
30
|
-
const distCert = await new
|
|
30
|
+
const distCert = await new SetUpDistributionCertificate_1.SetUpDistributionCertificate(this.app, generated_1.IosDistributionType.AdHoc).runAsync(ctx);
|
|
31
31
|
const areBuildCredentialsSetup = await this.areBuildCredentialsSetupAsync(ctx);
|
|
32
32
|
if (ctx.nonInteractive) {
|
|
33
33
|
if (areBuildCredentialsSetup) {
|
|
@@ -195,7 +195,7 @@ class SetupAdhocProvisioningProfile {
|
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
|
-
exports.
|
|
198
|
+
exports.SetUpAdhocProvisioningProfile = SetUpAdhocProvisioningProfile;
|
|
199
199
|
function doUDIDsMatch(udidsA, udidsB) {
|
|
200
200
|
const setA = new Set(udidsA);
|
|
201
201
|
const setB = new Set(udidsB);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CommonIosAppCredentialsFragment } from '../../../graphql/generated';
|
|
2
|
+
import { CredentialsContext } from '../../context';
|
|
3
|
+
import { AppLookupParams } from '../api/GraphqlClient';
|
|
4
|
+
import { AppStoreApiKeyPurpose } from './AscApiKeyUtils';
|
|
5
|
+
export declare enum SetupAscApiKeyChoice {
|
|
6
|
+
GENERATE = "GENERATE",
|
|
7
|
+
USE_EXISTING = "USE_EXISTING"
|
|
8
|
+
}
|
|
9
|
+
export declare class SetUpAscApiKey {
|
|
10
|
+
private app;
|
|
11
|
+
private purpose;
|
|
12
|
+
choices: {
|
|
13
|
+
title: string;
|
|
14
|
+
value: string;
|
|
15
|
+
}[];
|
|
16
|
+
constructor(app: AppLookupParams, purpose: AppStoreApiKeyPurpose);
|
|
17
|
+
runAsync(ctx: CredentialsContext): Promise<CommonIosAppCredentialsFragment>;
|
|
18
|
+
private doBestEffortAutoselectAsync;
|
|
19
|
+
private isAscApiKeySetupAsync;
|
|
20
|
+
private processChoicesAsync;
|
|
21
|
+
}
|