eas-cli 0.34.0 → 0.36.1
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} +2 -2
- package/build/api.js +3 -3
- package/build/build/build.js +18 -27
- package/build/build/context.d.ts +1 -1
- package/build/build/context.js +2 -2
- package/build/build/ios/credentials.js +3 -3
- package/build/build/local.js +18 -27
- package/build/build/types.d.ts +0 -1
- package/build/build/utils/devClient.js +6 -3
- package/build/build/utils/formatBuild.js +1 -9
- package/build/build/utils/url.js +1 -1
- package/build/commandUtils/EasCommand.js +4 -4
- package/build/commands/build/index.js +14 -5
- package/build/commands/secret/delete.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/utils/keystore.js +67 -32
- 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/DistributionCertificateUtils.js +1 -1
- package/build/credentials/ios/actions/PushKeyUtils.js +1 -1
- 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/AppStoreConnectApiKeyQuery.d.ts +4 -0
- package/build/credentials/ios/api/graphql/queries/AppStoreConnectApiKeyQuery.js +33 -0
- 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 +20 -15
- package/build/credentials/manager/Actions.js +20 -15
- package/build/credentials/manager/AndroidActions.js +6 -6
- package/build/credentials/manager/IosActions.d.ts +1 -0
- package/build/credentials/manager/IosActions.js +40 -5
- package/build/credentials/manager/ManageAndroid.js +6 -6
- package/build/credentials/manager/ManageIos.js +56 -17
- package/build/credentials/utils/promptForCredentials.d.ts +2 -1
- package/build/credentials/utils/promptForCredentials.js +3 -2
- package/build/graphql/client.js +1 -1
- package/build/graphql/generated.d.ts +233 -82
- package/build/graphql/mutations/KeystoreGenerationUrlMutation.d.ts +3 -0
- package/build/graphql/mutations/KeystoreGenerationUrlMutation.js +23 -0
- 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/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 +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +6 -6
- package/build/build/utils/analytics.d.ts +0 -22
- package/build/build/utils/analytics.js +0 -28
|
@@ -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;
|
|
@@ -104,7 +104,7 @@ async function provideOrGenerateDistributionCertificateAsync(ctx) {
|
|
|
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 {
|
|
@@ -17,7 +17,7 @@ async function provideOrGeneratePushKeyAsync(ctx) {
|
|
|
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 {
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SetUpAscApiKey = exports.SetupAscApiKeyChoice = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const assert_1 = (0, tslib_1.__importDefault)(require("assert"));
|
|
6
|
+
const nullthrows_1 = (0, tslib_1.__importDefault)(require("nullthrows"));
|
|
7
|
+
const log_1 = (0, tslib_1.__importDefault)(require("../../../log"));
|
|
8
|
+
const prompts_1 = require("../../../prompts");
|
|
9
|
+
const errors_1 = require("../../errors");
|
|
10
|
+
const validateAscApiKey_1 = require("../validators/validateAscApiKey");
|
|
11
|
+
const AscApiKeyUtils_1 = require("./AscApiKeyUtils");
|
|
12
|
+
const AssignAscApiKey_1 = require("./AssignAscApiKey");
|
|
13
|
+
const CreateAscApiKey_1 = require("./CreateAscApiKey");
|
|
14
|
+
var SetupAscApiKeyChoice;
|
|
15
|
+
(function (SetupAscApiKeyChoice) {
|
|
16
|
+
SetupAscApiKeyChoice["GENERATE"] = "GENERATE";
|
|
17
|
+
SetupAscApiKeyChoice["USE_EXISTING"] = "USE_EXISTING";
|
|
18
|
+
})(SetupAscApiKeyChoice = exports.SetupAscApiKeyChoice || (exports.SetupAscApiKeyChoice = {}));
|
|
19
|
+
class SetUpAscApiKey {
|
|
20
|
+
constructor(app, purpose) {
|
|
21
|
+
this.app = app;
|
|
22
|
+
this.purpose = purpose;
|
|
23
|
+
this.choices = [
|
|
24
|
+
{
|
|
25
|
+
title: '[Choose an existing ASC API Key]',
|
|
26
|
+
value: SetupAscApiKeyChoice.USE_EXISTING,
|
|
27
|
+
},
|
|
28
|
+
{ title: '[Add a new ASC API Key]', value: SetupAscApiKeyChoice.GENERATE },
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
async runAsync(ctx) {
|
|
32
|
+
const isKeySetup = await this.isAscApiKeySetupAsync(ctx, this.purpose);
|
|
33
|
+
if (isKeySetup) {
|
|
34
|
+
log_1.default.succeed('App Store Connect API Key already set up.');
|
|
35
|
+
return (0, nullthrows_1.default)(await ctx.ios.getIosAppCredentialsWithCommonFieldsAsync(this.app), 'iosAppCredentials cannot be null if App Store Connect API Key is already set up');
|
|
36
|
+
}
|
|
37
|
+
if (ctx.nonInteractive) {
|
|
38
|
+
throw new errors_1.MissingCredentialsNonInteractiveError('App Store Connect API Keys cannot be set up in --non-interactive mode.');
|
|
39
|
+
}
|
|
40
|
+
const keysForAccount = await (0, AscApiKeyUtils_1.getAscApiKeysFromAccountAsync)(ctx, this.app.account, {
|
|
41
|
+
filterDifferentAppleTeam: true,
|
|
42
|
+
});
|
|
43
|
+
const maybeAutoselectedKey = await this.doBestEffortAutoselectAsync(ctx, keysForAccount);
|
|
44
|
+
if (maybeAutoselectedKey) {
|
|
45
|
+
return await new AssignAscApiKey_1.AssignAscApiKey(this.app).runAsync(ctx, maybeAutoselectedKey, this.purpose);
|
|
46
|
+
}
|
|
47
|
+
const availableChoices = keysForAccount.length === 0
|
|
48
|
+
? this.choices.filter(choice => choice.value !== SetupAscApiKeyChoice.USE_EXISTING)
|
|
49
|
+
: this.choices;
|
|
50
|
+
const ascApiKey = await this.processChoicesAsync(ctx, this.purpose, availableChoices);
|
|
51
|
+
return await new AssignAscApiKey_1.AssignAscApiKey(this.app).runAsync(ctx, ascApiKey, this.purpose);
|
|
52
|
+
}
|
|
53
|
+
async doBestEffortAutoselectAsync(ctx, keysForAccount) {
|
|
54
|
+
if (!ctx.appStore.authCtx) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
if (keysForAccount.length === 0) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
// only provide autoselect if we can find a key that is certainly valid
|
|
61
|
+
const validKeys = await (0, validateAscApiKey_1.getValidAndTrackedAscApiKeysAsync)(ctx, keysForAccount);
|
|
62
|
+
if (validKeys.length === 0) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
const [autoselectedKey] = (0, AscApiKeyUtils_1.sortAscApiKeysByUpdatedAtDesc)(validKeys);
|
|
66
|
+
const useAutoselected = await (0, prompts_1.confirmAsync)({
|
|
67
|
+
message: `Reuse this App Store Connect API Key?\n${(0, AscApiKeyUtils_1.formatAscApiKey)(autoselectedKey)}`,
|
|
68
|
+
});
|
|
69
|
+
if (useAutoselected) {
|
|
70
|
+
log_1.default.log(`Using App Store Connect API Key with ID ${autoselectedKey.keyIdentifier}`);
|
|
71
|
+
return autoselectedKey;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async isAscApiKeySetupAsync(ctx, purpose) {
|
|
78
|
+
const appCredentials = await ctx.ios.getIosAppCredentialsWithCommonFieldsAsync(this.app);
|
|
79
|
+
if (purpose !== AscApiKeyUtils_1.AppStoreApiKeyPurpose.SUBMISSION_SERVICE) {
|
|
80
|
+
throw new Error(`App Store Connect API Key setup is not yet supported for ${purpose}.`);
|
|
81
|
+
}
|
|
82
|
+
return !!(appCredentials === null || appCredentials === void 0 ? void 0 : appCredentials.appStoreConnectApiKeyForSubmissions);
|
|
83
|
+
}
|
|
84
|
+
async processChoicesAsync(ctx, purpose, choices) {
|
|
85
|
+
(0, assert_1.default)(choices.length > 0, 'SetupAscApiKey: There must be at least one choice');
|
|
86
|
+
let choice;
|
|
87
|
+
if (choices.length === 1) {
|
|
88
|
+
choice = choices[0].value;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
const result = await (0, prompts_1.promptAsync)({
|
|
92
|
+
type: 'select',
|
|
93
|
+
name: 'choice',
|
|
94
|
+
message: 'Select what to use for your project:',
|
|
95
|
+
choices,
|
|
96
|
+
});
|
|
97
|
+
choice = result.choice;
|
|
98
|
+
}
|
|
99
|
+
if (choice === SetupAscApiKeyChoice.GENERATE) {
|
|
100
|
+
return await new CreateAscApiKey_1.CreateAscApiKey(this.app.account).runAsync(ctx, purpose);
|
|
101
|
+
}
|
|
102
|
+
else if (choice === SetupAscApiKeyChoice.USE_EXISTING) {
|
|
103
|
+
const selectedAscApiKey = await (0, AscApiKeyUtils_1.selectAscApiKeysFromAccountAsync)(ctx, this.app.account, {
|
|
104
|
+
filterDifferentAppleTeam: true,
|
|
105
|
+
});
|
|
106
|
+
if (!selectedAscApiKey) {
|
|
107
|
+
return await this.processChoicesAsync(ctx, purpose, choices);
|
|
108
|
+
}
|
|
109
|
+
return selectedAscApiKey;
|
|
110
|
+
}
|
|
111
|
+
throw new errors_1.UnsupportedCredentialsChoiceError(`AscApiKey Setup does not support choice:${choice}`, choice);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
exports.SetUpAscApiKey = SetUpAscApiKey;
|
package/build/credentials/ios/actions/{SetupBuildCredentials.d.ts → SetUpBuildCredentials.d.ts}
RENAMED
|
@@ -9,7 +9,7 @@ interface Options {
|
|
|
9
9
|
enterpriseProvisioning?: IosEnterpriseProvisioning;
|
|
10
10
|
iosCapabilitiesOptions?: IosCapabilitiesOptions;
|
|
11
11
|
}
|
|
12
|
-
export declare class
|
|
12
|
+
export declare class SetUpBuildCredentials {
|
|
13
13
|
private options;
|
|
14
14
|
constructor(options: Options);
|
|
15
15
|
runAsync(ctx: CredentialsContext): Promise<IosCredentials>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.SetUpBuildCredentials = 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"));
|
|
7
7
|
const log_1 = (0, tslib_1.__importDefault)(require("../../../log"));
|
|
8
8
|
const printCredentials_1 = require("../utils/printCredentials");
|
|
9
|
-
const
|
|
10
|
-
class
|
|
9
|
+
const SetUpTargetBuildCredentials_1 = require("./SetUpTargetBuildCredentials");
|
|
10
|
+
class SetUpBuildCredentials {
|
|
11
11
|
constructor(options) {
|
|
12
12
|
this.options = options;
|
|
13
13
|
}
|
|
@@ -35,7 +35,7 @@ class SetupBuildCredentials {
|
|
|
35
35
|
else {
|
|
36
36
|
log_1.default.newLine();
|
|
37
37
|
}
|
|
38
|
-
const action = new
|
|
38
|
+
const action = new SetUpTargetBuildCredentials_1.SetUpTargetBuildCredentials({
|
|
39
39
|
...this.options,
|
|
40
40
|
app: {
|
|
41
41
|
...this.options.app,
|
|
@@ -53,7 +53,7 @@ class SetupBuildCredentials {
|
|
|
53
53
|
return toIosCredentials(iosAppBuildCredentialsMap);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
exports.
|
|
56
|
+
exports.SetUpBuildCredentials = SetUpBuildCredentials;
|
|
57
57
|
function toIosCredentials(appBuildCredentialsMap) {
|
|
58
58
|
return Object.entries(appBuildCredentialsMap).reduce((acc, [targetName, appBuildCredentials]) => {
|
|
59
59
|
var _a, _b, _c;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IosDistributionType } from '../../../graphql/generated';
|
|
2
2
|
import { CredentialsContext } from '../../context';
|
|
3
3
|
import { App, Target } from '../types';
|
|
4
|
-
export declare class
|
|
4
|
+
export declare class SetUpBuildCredentialsFromCredentialsJson {
|
|
5
5
|
private app;
|
|
6
6
|
private targets;
|
|
7
7
|
private distributionType;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.SetUpBuildCredentialsFromCredentialsJson = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
|
|
6
6
|
const log_1 = (0, tslib_1.__importDefault)(require("../../../log"));
|
|
7
7
|
const target_1 = require("../../../project/ios/target");
|
|
8
8
|
const read_1 = require("../../credentialsJson/read");
|
|
9
9
|
const utils_1 = require("../../credentialsJson/utils");
|
|
10
|
-
const
|
|
11
|
-
class
|
|
10
|
+
const SetUpTargetBuildCredentialsFromCredentialsJson_1 = require("./SetUpTargetBuildCredentialsFromCredentialsJson");
|
|
11
|
+
class SetUpBuildCredentialsFromCredentialsJson {
|
|
12
12
|
constructor(app, targets, distributionType) {
|
|
13
13
|
this.app = app;
|
|
14
14
|
this.targets = targets;
|
|
@@ -24,7 +24,7 @@ class SetupBuildCredentialsFromCredentialsJson {
|
|
|
24
24
|
log_1.default.log(`Setting up credentials for target ${chalk_1.default.bold(target.targetName)} (${target.bundleIdentifier})`);
|
|
25
25
|
log_1.default.newLine();
|
|
26
26
|
}
|
|
27
|
-
await new
|
|
27
|
+
await new SetUpTargetBuildCredentialsFromCredentialsJson_1.SetUpTargetBuildCredentialsFromCredentialsJson({
|
|
28
28
|
account: this.app.account,
|
|
29
29
|
projectName: this.app.projectName,
|
|
30
30
|
bundleIdentifier: target.bundleIdentifier,
|
|
@@ -43,4 +43,4 @@ class SetupBuildCredentialsFromCredentialsJson {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
exports.
|
|
46
|
+
exports.SetUpBuildCredentialsFromCredentialsJson = SetUpBuildCredentialsFromCredentialsJson;
|