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
package/build/submit/context.js
CHANGED
|
@@ -1,21 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createSubmissionContextAsync = void 0;
|
|
4
|
+
const uuid_1 = require("uuid");
|
|
5
|
+
const events_1 = require("../analytics/events");
|
|
4
6
|
const context_1 = require("../credentials/context");
|
|
5
7
|
const expoConfig_1 = require("../project/expoConfig");
|
|
6
8
|
const projectUtils_1 = require("../project/projectUtils");
|
|
9
|
+
const Account_1 = require("../user/Account");
|
|
7
10
|
const actions_1 = require("../user/actions");
|
|
8
11
|
async function createSubmissionContextAsync(params) {
|
|
12
|
+
var _a;
|
|
9
13
|
const { projectDir, nonInteractive } = params;
|
|
10
14
|
const exp = (0, expoConfig_1.getExpoConfig)(projectDir, { env: params.env });
|
|
11
15
|
const { env, ...rest } = params;
|
|
12
16
|
const user = await (0, actions_1.ensureLoggedInAsync)();
|
|
13
17
|
const projectName = exp.slug;
|
|
14
18
|
const accountName = (0, projectUtils_1.getProjectAccountName)(exp, user);
|
|
19
|
+
const accountId = (_a = (0, Account_1.findAccountByName)(user.accounts, accountName)) === null || _a === void 0 ? void 0 : _a.id;
|
|
15
20
|
let credentialsCtx = params.credentialsCtx;
|
|
16
21
|
if (!credentialsCtx) {
|
|
17
22
|
credentialsCtx = new context_1.CredentialsContext({ projectDir, user, exp, nonInteractive });
|
|
18
23
|
}
|
|
24
|
+
const trackingCtx = {
|
|
25
|
+
tracking_id: (0, uuid_1.v4)(),
|
|
26
|
+
platform: params.platform,
|
|
27
|
+
...(accountId && { account_id: accountId }),
|
|
28
|
+
account_name: accountName,
|
|
29
|
+
project_id: params.projectId,
|
|
30
|
+
};
|
|
31
|
+
events_1.Analytics.logEvent(events_1.SubmissionEvent.SUBMIT_COMMAND, trackingCtx);
|
|
19
32
|
return {
|
|
20
33
|
...rest,
|
|
21
34
|
accountName,
|
|
@@ -23,6 +36,7 @@ async function createSubmissionContextAsync(params) {
|
|
|
23
36
|
exp,
|
|
24
37
|
projectName,
|
|
25
38
|
user,
|
|
39
|
+
trackingCtx,
|
|
26
40
|
};
|
|
27
41
|
}
|
|
28
42
|
exports.createSubmissionContextAsync = createSubmissionContextAsync;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { Platform } from '@expo/eas-build-job';
|
|
2
|
+
import { SubmissionContext } from '../context';
|
|
1
3
|
export declare enum AppSpecificPasswordSourceType {
|
|
2
|
-
userDefined = 0
|
|
3
|
-
prompt = 1
|
|
4
|
+
userDefined = 0
|
|
4
5
|
}
|
|
5
6
|
interface AppSpecificPasswordSourceBase {
|
|
6
7
|
sourceType: AppSpecificPasswordSourceType;
|
|
@@ -9,9 +10,11 @@ interface AppSpecificPasswordUserDefinedSource extends AppSpecificPasswordSource
|
|
|
9
10
|
sourceType: AppSpecificPasswordSourceType.userDefined;
|
|
10
11
|
appSpecificPassword: string;
|
|
11
12
|
}
|
|
12
|
-
interface
|
|
13
|
-
|
|
13
|
+
export interface AppSpecificPasswordCredentials {
|
|
14
|
+
password: string;
|
|
15
|
+
appleIdUsername: string;
|
|
14
16
|
}
|
|
15
|
-
export declare type AppSpecificPasswordSource = AppSpecificPasswordUserDefinedSource
|
|
16
|
-
export declare function
|
|
17
|
+
export declare type AppSpecificPasswordSource = AppSpecificPasswordUserDefinedSource;
|
|
18
|
+
export declare function getAppSpecificPasswordLocallyAsync(ctx: SubmissionContext<Platform.IOS>, source: AppSpecificPasswordSource): Promise<AppSpecificPasswordCredentials>;
|
|
19
|
+
export declare function getAppleIdUsernameAsync(ctx: SubmissionContext<Platform.IOS>): Promise<string>;
|
|
17
20
|
export {};
|
|
@@ -1,36 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getAppleIdUsernameAsync = exports.getAppSpecificPasswordLocallyAsync = exports.AppSpecificPasswordSourceType = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
6
|
-
const wrap_ansi_1 = (0, tslib_1.__importDefault)(require("wrap-ansi"));
|
|
7
|
-
const log_1 = (0, tslib_1.__importStar)(require("../../log"));
|
|
5
|
+
const getenv_1 = (0, tslib_1.__importDefault)(require("getenv"));
|
|
8
6
|
const prompts_1 = require("../../prompts");
|
|
7
|
+
const UserSettings_1 = (0, tslib_1.__importDefault)(require("../../user/UserSettings"));
|
|
9
8
|
var AppSpecificPasswordSourceType;
|
|
10
9
|
(function (AppSpecificPasswordSourceType) {
|
|
11
10
|
AppSpecificPasswordSourceType[AppSpecificPasswordSourceType["userDefined"] = 0] = "userDefined";
|
|
12
|
-
AppSpecificPasswordSourceType[AppSpecificPasswordSourceType["prompt"] = 1] = "prompt";
|
|
13
11
|
})(AppSpecificPasswordSourceType = exports.AppSpecificPasswordSourceType || (exports.AppSpecificPasswordSourceType = {}));
|
|
14
|
-
async function
|
|
12
|
+
async function getAppSpecificPasswordLocallyAsync(ctx, source) {
|
|
15
13
|
var _a;
|
|
16
14
|
if (source.sourceType === AppSpecificPasswordSourceType.userDefined) {
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
log_1.default.log((0, wrap_ansi_1.default)(`Please enter your Apple app-specific password. You can also provide it by using the ${chalk_1.default.bold('EXPO_APPLE_APP_SPECIFIC_PASSWORD')} environment variable.`, process.stdout.columns || 80));
|
|
22
|
-
log_1.default.log((0, log_1.learnMore)('https://expo.fyi/apple-app-specific-password'));
|
|
23
|
-
const { appSpecificPassword } = await (0, prompts_1.promptAsync)({
|
|
24
|
-
name: 'appSpecificPassword',
|
|
25
|
-
message: 'Your Apple app-specific password:',
|
|
26
|
-
type: 'password',
|
|
27
|
-
validate: (val) => val !== '' || 'Apple app-specific password cannot be empty!',
|
|
28
|
-
});
|
|
29
|
-
return appSpecificPassword;
|
|
15
|
+
return {
|
|
16
|
+
password: source.appSpecificPassword,
|
|
17
|
+
appleIdUsername: await getAppleIdUsernameAsync(ctx),
|
|
18
|
+
};
|
|
30
19
|
}
|
|
31
20
|
else {
|
|
32
21
|
// exhaustive -- should never happen
|
|
33
22
|
throw new Error(`Unknown app specific password source type "${(_a = source) === null || _a === void 0 ? void 0 : _a.sourceType}"`);
|
|
34
23
|
}
|
|
35
24
|
}
|
|
36
|
-
exports.
|
|
25
|
+
exports.getAppSpecificPasswordLocallyAsync = getAppSpecificPasswordLocallyAsync;
|
|
26
|
+
async function getAppleIdUsernameAsync(ctx) {
|
|
27
|
+
var _a;
|
|
28
|
+
if (ctx.profile.appleId) {
|
|
29
|
+
return ctx.profile.appleId;
|
|
30
|
+
}
|
|
31
|
+
const envAppleId = getenv_1.default.string('EXPO_APPLE_ID', '');
|
|
32
|
+
if (envAppleId) {
|
|
33
|
+
return envAppleId;
|
|
34
|
+
}
|
|
35
|
+
if ((_a = ctx.credentialsCtx.appStore.authCtx) === null || _a === void 0 ? void 0 : _a.appleId) {
|
|
36
|
+
return ctx.credentialsCtx.appStore.authCtx.appleId;
|
|
37
|
+
}
|
|
38
|
+
// Get the email address that was last used and set it as
|
|
39
|
+
// the default value for quicker authentication.
|
|
40
|
+
const lastAppleId = await UserSettings_1.default.getAsync('appleId', null);
|
|
41
|
+
if (ctx.nonInteractive) {
|
|
42
|
+
if (lastAppleId) {
|
|
43
|
+
return lastAppleId;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
throw new Error('Set appleId in the submit profile (eas.json).');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const { appleId } = await (0, prompts_1.promptAsync)({
|
|
50
|
+
type: 'text',
|
|
51
|
+
name: 'appleId',
|
|
52
|
+
message: `Enter your Apple ID:`,
|
|
53
|
+
validate: (val) => !!val,
|
|
54
|
+
initial: lastAppleId !== null && lastAppleId !== void 0 ? lastAppleId : undefined,
|
|
55
|
+
});
|
|
56
|
+
return appleId;
|
|
57
|
+
}
|
|
58
|
+
exports.getAppleIdUsernameAsync = getAppleIdUsernameAsync;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { Platform } from '@expo/eas-build-job';
|
|
1
2
|
import { AscApiKeyPath, MinimalAscApiKey } from '../../credentials/ios/credentials';
|
|
3
|
+
import { SubmissionContext } from '../context';
|
|
2
4
|
export declare enum AscApiKeySourceType {
|
|
3
5
|
path = 0,
|
|
4
6
|
prompt = 1
|
|
@@ -18,11 +20,15 @@ declare type AscApiKeySummary = {
|
|
|
18
20
|
source: 'local' | 'EAS servers';
|
|
19
21
|
path?: string;
|
|
20
22
|
keyId: string;
|
|
23
|
+
name?: string;
|
|
24
|
+
};
|
|
25
|
+
export declare type AscApiKeyFromExpoServers = {
|
|
26
|
+
ascApiKeyId: string;
|
|
21
27
|
};
|
|
22
28
|
export declare type AscApiKeyResult = {
|
|
23
|
-
result: MinimalAscApiKey;
|
|
29
|
+
result: MinimalAscApiKey | AscApiKeyFromExpoServers;
|
|
24
30
|
summary: AscApiKeySummary;
|
|
25
31
|
};
|
|
26
|
-
export declare function getAscApiKeyLocallyAsync(source: AscApiKeySource): Promise<AscApiKeyResult>;
|
|
27
|
-
export declare function getAscApiKeyPathAsync(source: AscApiKeySource): Promise<AscApiKeyPath>;
|
|
32
|
+
export declare function getAscApiKeyLocallyAsync(ctx: SubmissionContext<Platform.IOS>, source: AscApiKeySource): Promise<AscApiKeyResult>;
|
|
33
|
+
export declare function getAscApiKeyPathAsync(ctx: SubmissionContext<Platform.IOS>, source: AscApiKeySource): Promise<AscApiKeyPath>;
|
|
28
34
|
export {};
|
|
@@ -11,8 +11,8 @@ var AscApiKeySourceType;
|
|
|
11
11
|
AscApiKeySourceType[AscApiKeySourceType["path"] = 0] = "path";
|
|
12
12
|
AscApiKeySourceType[AscApiKeySourceType["prompt"] = 1] = "prompt";
|
|
13
13
|
})(AscApiKeySourceType = exports.AscApiKeySourceType || (exports.AscApiKeySourceType = {}));
|
|
14
|
-
async function getAscApiKeyLocallyAsync(source) {
|
|
15
|
-
const ascApiKeyPath = await getAscApiKeyPathAsync(source);
|
|
14
|
+
async function getAscApiKeyLocallyAsync(ctx, source) {
|
|
15
|
+
const ascApiKeyPath = await getAscApiKeyPathAsync(ctx, source);
|
|
16
16
|
const { keyP8Path, keyId, issuerId } = ascApiKeyPath;
|
|
17
17
|
const keyP8 = await fs_extra_1.default.readFile(keyP8Path, 'utf-8');
|
|
18
18
|
return {
|
|
@@ -25,26 +25,26 @@ async function getAscApiKeyLocallyAsync(source) {
|
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
exports.getAscApiKeyLocallyAsync = getAscApiKeyLocallyAsync;
|
|
28
|
-
async function getAscApiKeyPathAsync(source) {
|
|
28
|
+
async function getAscApiKeyPathAsync(ctx, source) {
|
|
29
29
|
switch (source.sourceType) {
|
|
30
30
|
case AscApiKeySourceType.path:
|
|
31
|
-
return await handlePathSourceAsync(source);
|
|
31
|
+
return await handlePathSourceAsync(ctx, source);
|
|
32
32
|
case AscApiKeySourceType.prompt:
|
|
33
|
-
return await handlePromptSourceAsync(source);
|
|
33
|
+
return await handlePromptSourceAsync(ctx, source);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
exports.getAscApiKeyPathAsync = getAscApiKeyPathAsync;
|
|
37
|
-
async function handlePathSourceAsync(source) {
|
|
37
|
+
async function handlePathSourceAsync(ctx, source) {
|
|
38
38
|
const { keyP8Path } = source.path;
|
|
39
39
|
if (!(await (0, files_1.isExistingFileAsync)(keyP8Path))) {
|
|
40
40
|
log_1.default.warn(`File ${keyP8Path} doesn't exist.`);
|
|
41
|
-
return await getAscApiKeyPathAsync({ sourceType: AscApiKeySourceType.prompt });
|
|
41
|
+
return await getAscApiKeyPathAsync(ctx, { sourceType: AscApiKeySourceType.prompt });
|
|
42
42
|
}
|
|
43
43
|
return source.path;
|
|
44
44
|
}
|
|
45
|
-
async function handlePromptSourceAsync(_source) {
|
|
46
|
-
const ascApiKeyPath = await (0, AscApiKeyUtils_1.
|
|
47
|
-
return await getAscApiKeyPathAsync({
|
|
45
|
+
async function handlePromptSourceAsync(ctx, _source) {
|
|
46
|
+
const ascApiKeyPath = await (0, AscApiKeyUtils_1.promptForAscApiKeyPathAsync)(ctx.credentialsCtx);
|
|
47
|
+
return await getAscApiKeyPathAsync(ctx, {
|
|
48
48
|
sourceType: AscApiKeySourceType.path,
|
|
49
49
|
path: ascApiKeyPath,
|
|
50
50
|
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Platform } from '@expo/eas-build-job';
|
|
2
|
+
import { SubmissionContext } from '../context';
|
|
3
|
+
import { AppSpecificPasswordCredentials } from './AppSpecificPasswordSource';
|
|
4
|
+
import { AscApiKeyResult } from './AscApiKeySource';
|
|
5
|
+
/**
|
|
6
|
+
* The Credentials Service will either return an ASC API Key or an App Specific Password
|
|
7
|
+
* When we no longer support the App Specific Password user prompt, refactor this into the AscApiKeySource
|
|
8
|
+
*/
|
|
9
|
+
export declare const CREDENTIALS_SERVICE_SOURCE = "CREDENTIALS_SERVICE_SOURCE";
|
|
10
|
+
export declare type CredentialsServiceSource = typeof CREDENTIALS_SERVICE_SOURCE;
|
|
11
|
+
export declare function getFromCredentialsServiceAsync(ctx: SubmissionContext<Platform.IOS>): Promise<{
|
|
12
|
+
appSpecificPassword: AppSpecificPasswordCredentials;
|
|
13
|
+
} | {
|
|
14
|
+
ascApiKeyResult: AscApiKeyResult;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFromCredentialsServiceAsync = exports.CREDENTIALS_SERVICE_SOURCE = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const nullthrows_1 = (0, tslib_1.__importDefault)(require("nullthrows"));
|
|
6
|
+
const SetUpSubmissionCredentials_1 = require("../../credentials/ios/actions/SetUpSubmissionCredentials");
|
|
7
|
+
const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
|
|
8
|
+
const bundleIdentifier_1 = require("../../project/ios/bundleIdentifier");
|
|
9
|
+
const Account_1 = require("../../user/Account");
|
|
10
|
+
const AppSpecificPasswordSource_1 = require("./AppSpecificPasswordSource");
|
|
11
|
+
/**
|
|
12
|
+
* The Credentials Service will either return an ASC API Key or an App Specific Password
|
|
13
|
+
* When we no longer support the App Specific Password user prompt, refactor this into the AscApiKeySource
|
|
14
|
+
*/
|
|
15
|
+
exports.CREDENTIALS_SERVICE_SOURCE = 'CREDENTIALS_SERVICE_SOURCE';
|
|
16
|
+
async function getFromCredentialsServiceAsync(ctx) {
|
|
17
|
+
const bundleIdentifier = await (0, bundleIdentifier_1.getBundleIdentifierAsync)(ctx.projectDir, ctx.exp);
|
|
18
|
+
log_1.default.log(`Looking up credentials configuration for ${bundleIdentifier}...`);
|
|
19
|
+
const appLookupParams = {
|
|
20
|
+
account: (0, nullthrows_1.default)((0, Account_1.findAccountByName)(ctx.user.accounts, ctx.accountName), `You do not have access to account: ${ctx.accountName}`),
|
|
21
|
+
projectName: ctx.projectName,
|
|
22
|
+
bundleIdentifier,
|
|
23
|
+
};
|
|
24
|
+
const setupSubmissionCredentialsAction = new SetUpSubmissionCredentials_1.SetUpSubmissionCredentials(appLookupParams);
|
|
25
|
+
const ascOrAsp = await setupSubmissionCredentialsAction.runAsync(ctx.credentialsCtx);
|
|
26
|
+
const isAppSpecificPassword = typeof ascOrAsp === 'string';
|
|
27
|
+
if (isAppSpecificPassword) {
|
|
28
|
+
return {
|
|
29
|
+
appSpecificPassword: {
|
|
30
|
+
password: ascOrAsp,
|
|
31
|
+
appleIdUsername: await (0, AppSpecificPasswordSource_1.getAppleIdUsernameAsync)(ctx),
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
const ascKeyForSubmissions = (0, nullthrows_1.default)(ascOrAsp.appStoreConnectApiKeyForSubmissions, `An EAS Submit ASC API Key could not be found for ${ascOrAsp.appleAppIdentifier.bundleIdentifier}`);
|
|
37
|
+
const { id, keyIdentifier, name } = ascKeyForSubmissions;
|
|
38
|
+
return {
|
|
39
|
+
ascApiKeyResult: {
|
|
40
|
+
result: {
|
|
41
|
+
ascApiKeyId: id,
|
|
42
|
+
},
|
|
43
|
+
summary: {
|
|
44
|
+
source: 'EAS servers',
|
|
45
|
+
keyId: keyIdentifier,
|
|
46
|
+
name: name !== null && name !== void 0 ? name : undefined,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.getFromCredentialsServiceAsync = getFromCredentialsServiceAsync;
|
|
@@ -5,11 +5,10 @@ export default class IosSubmitCommand {
|
|
|
5
5
|
private ctx;
|
|
6
6
|
constructor(ctx: SubmissionContext<Platform.IOS>);
|
|
7
7
|
runAsync(): Promise<SubmissionFragment>;
|
|
8
|
-
private
|
|
8
|
+
private resolveCredentialSubmissionOptions;
|
|
9
9
|
private resolveSubmissionOptionsAsync;
|
|
10
10
|
private resolveAppSpecificPasswordSource;
|
|
11
11
|
private resolveAscApiKeySource;
|
|
12
12
|
private resolveArchiveSource;
|
|
13
13
|
private resolveAscAppIdentifierAsync;
|
|
14
|
-
private resolveAppleIdUsernameAsync;
|
|
15
14
|
}
|
|
@@ -8,12 +8,11 @@ const getenv_1 = (0, tslib_1.__importDefault)(require("getenv"));
|
|
|
8
8
|
const wrap_ansi_1 = (0, tslib_1.__importDefault)(require("wrap-ansi"));
|
|
9
9
|
const errors_1 = require("../../credentials/errors");
|
|
10
10
|
const log_1 = (0, tslib_1.__importStar)(require("../../log"));
|
|
11
|
-
const prompts_1 = require("../../prompts");
|
|
12
|
-
const UserSettings_1 = (0, tslib_1.__importDefault)(require("../../user/UserSettings"));
|
|
13
11
|
const commons_1 = require("../commons");
|
|
14
12
|
const AppProduce_1 = require("./AppProduce");
|
|
15
13
|
const AppSpecificPasswordSource_1 = require("./AppSpecificPasswordSource");
|
|
16
14
|
const AscApiKeySource_1 = require("./AscApiKeySource");
|
|
15
|
+
const CredentialsServiceSource_1 = require("./CredentialsServiceSource");
|
|
17
16
|
const IosSubmitter_1 = (0, tslib_1.__importDefault)(require("./IosSubmitter"));
|
|
18
17
|
class IosSubmitCommand {
|
|
19
18
|
constructor(ctx) {
|
|
@@ -25,32 +24,39 @@ class IosSubmitCommand {
|
|
|
25
24
|
const submitter = new IosSubmitter_1.default(this.ctx, options);
|
|
26
25
|
return await submitter.submitAsync();
|
|
27
26
|
}
|
|
28
|
-
|
|
29
|
-
// Fall back to app specific password if no ascApiKey defined
|
|
27
|
+
resolveCredentialSubmissionOptions() {
|
|
30
28
|
const ascApiKeySource = this.resolveAscApiKeySource();
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
return { appSpecificPasswordSource: this.resolveAppSpecificPasswordSource() };
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
29
|
+
const shouldSkipAscApiKeySource = !ascApiKeySource.ok && ascApiKeySource.enforceError() instanceof errors_1.MissingCredentialsError;
|
|
30
|
+
if (!shouldSkipAscApiKeySource) {
|
|
36
31
|
return { ascApiKeySource };
|
|
37
32
|
}
|
|
33
|
+
const appSpecificPasswordSource = this.resolveAppSpecificPasswordSource();
|
|
34
|
+
const shouldSkipAppSpecificPasswordSource = !appSpecificPasswordSource.ok &&
|
|
35
|
+
appSpecificPasswordSource.enforceError() instanceof errors_1.MissingCredentialsError;
|
|
36
|
+
if (!shouldSkipAppSpecificPasswordSource) {
|
|
37
|
+
return { appSpecificPasswordSource: this.resolveAppSpecificPasswordSource() };
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
credentialsServiceSource: (0, results_1.result)(CredentialsServiceSource_1.CREDENTIALS_SERVICE_SOURCE),
|
|
41
|
+
};
|
|
38
42
|
}
|
|
39
43
|
async resolveSubmissionOptionsAsync() {
|
|
40
44
|
const archiveSource = this.resolveArchiveSource();
|
|
41
|
-
const credentialsSource =
|
|
45
|
+
const credentialsSource = this.resolveCredentialSubmissionOptions();
|
|
42
46
|
const maybeAppSpecificPasswordSource = 'appSpecificPasswordSource' in credentialsSource
|
|
43
47
|
? credentialsSource.appSpecificPasswordSource
|
|
44
48
|
: null;
|
|
45
49
|
const maybeAscApiKeySource = 'ascApiKeySource' in credentialsSource ? credentialsSource.ascApiKeySource : null;
|
|
50
|
+
const maybeCredentialsServiceSource = 'credentialsServiceSource' in credentialsSource
|
|
51
|
+
? credentialsSource.credentialsServiceSource
|
|
52
|
+
: null;
|
|
46
53
|
const ascAppIdentifier = await this.resolveAscAppIdentifierAsync();
|
|
47
|
-
const appleIdUsername = await this.resolveAppleIdUsernameAsync();
|
|
48
54
|
const errored = [
|
|
49
55
|
archiveSource,
|
|
50
56
|
...(maybeAppSpecificPasswordSource ? [maybeAppSpecificPasswordSource] : []),
|
|
51
57
|
...(maybeAscApiKeySource ? [maybeAscApiKeySource] : []),
|
|
58
|
+
...(maybeCredentialsServiceSource ? [maybeCredentialsServiceSource] : []),
|
|
52
59
|
ascAppIdentifier,
|
|
53
|
-
appleIdUsername,
|
|
54
60
|
].filter(r => !r.ok);
|
|
55
61
|
if (errored.length > 0) {
|
|
56
62
|
const message = errored.map(err => { var _a; return (_a = err.reason) === null || _a === void 0 ? void 0 : _a.message; }).join('\n');
|
|
@@ -59,7 +65,6 @@ class IosSubmitCommand {
|
|
|
59
65
|
}
|
|
60
66
|
return {
|
|
61
67
|
projectId: this.ctx.projectId,
|
|
62
|
-
appleIdUsername: appleIdUsername.enforceValue(),
|
|
63
68
|
ascAppIdentifier: ascAppIdentifier.enforceValue(),
|
|
64
69
|
archiveSource: archiveSource.enforceValue(),
|
|
65
70
|
...(maybeAppSpecificPasswordSource
|
|
@@ -72,6 +77,11 @@ class IosSubmitCommand {
|
|
|
72
77
|
ascApiKeySource: maybeAscApiKeySource.enforceValue(),
|
|
73
78
|
}
|
|
74
79
|
: null),
|
|
80
|
+
...(maybeCredentialsServiceSource
|
|
81
|
+
? {
|
|
82
|
+
credentialsServiceSource: maybeCredentialsServiceSource.enforceValue(),
|
|
83
|
+
}
|
|
84
|
+
: null),
|
|
75
85
|
};
|
|
76
86
|
}
|
|
77
87
|
resolveAppSpecificPasswordSource() {
|
|
@@ -82,14 +92,7 @@ class IosSubmitCommand {
|
|
|
82
92
|
appSpecificPassword: envAppSpecificPassword,
|
|
83
93
|
});
|
|
84
94
|
}
|
|
85
|
-
|
|
86
|
-
return (0, results_1.result)(new Error('Set the EXPO_APPLE_APP_SPECIFIC_PASSWORD environment variable.'));
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
return (0, results_1.result)({
|
|
90
|
-
sourceType: AppSpecificPasswordSource_1.AppSpecificPasswordSourceType.prompt,
|
|
91
|
-
});
|
|
92
|
-
}
|
|
95
|
+
return (0, results_1.result)(new errors_1.MissingCredentialsError('The EXPO_APPLE_APP_SPECIFIC_PASSWORD environment variable must be set.'));
|
|
93
96
|
}
|
|
94
97
|
resolveAscApiKeySource() {
|
|
95
98
|
const { ascApiKeyPath, ascApiKeyIssuerId, ascApiKeyId } = this.ctx.profile;
|
|
@@ -140,37 +143,5 @@ class IosSubmitCommand {
|
|
|
140
143
|
}
|
|
141
144
|
}
|
|
142
145
|
}
|
|
143
|
-
async resolveAppleIdUsernameAsync() {
|
|
144
|
-
var _a;
|
|
145
|
-
if (this.ctx.profile.appleId) {
|
|
146
|
-
return (0, results_1.result)(this.ctx.profile.appleId);
|
|
147
|
-
}
|
|
148
|
-
const envAppleId = getenv_1.default.string('EXPO_APPLE_ID', '');
|
|
149
|
-
if (envAppleId) {
|
|
150
|
-
return (0, results_1.result)(envAppleId);
|
|
151
|
-
}
|
|
152
|
-
if ((_a = this.ctx.credentialsCtx.appStore.authCtx) === null || _a === void 0 ? void 0 : _a.appleId) {
|
|
153
|
-
return (0, results_1.result)(this.ctx.credentialsCtx.appStore.authCtx.appleId);
|
|
154
|
-
}
|
|
155
|
-
// Get the email address that was last used and set it as
|
|
156
|
-
// the default value for quicker authentication.
|
|
157
|
-
const lastAppleId = await UserSettings_1.default.getAsync('appleId', null);
|
|
158
|
-
if (this.ctx.nonInteractive) {
|
|
159
|
-
if (lastAppleId) {
|
|
160
|
-
return (0, results_1.result)(lastAppleId);
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
return (0, results_1.result)(new Error('Set appleId in the submit profile (eas.json).'));
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
const { appleId } = await (0, prompts_1.promptAsync)({
|
|
167
|
-
type: 'text',
|
|
168
|
-
name: 'appleId',
|
|
169
|
-
message: `Enter your Apple ID:`,
|
|
170
|
-
validate: (val) => !!val,
|
|
171
|
-
initial: lastAppleId !== null && lastAppleId !== void 0 ? lastAppleId : undefined,
|
|
172
|
-
});
|
|
173
|
-
return (0, results_1.result)(appleId);
|
|
174
|
-
}
|
|
175
146
|
}
|
|
176
147
|
exports.default = IosSubmitCommand;
|
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
import { Platform } from '@expo/eas-build-job';
|
|
2
2
|
import { IosSubmissionConfigInput, SubmissionFragment } from '../../graphql/generated';
|
|
3
|
-
import { ArchiveSource } from '../ArchiveSource';
|
|
3
|
+
import { Archive, ArchiveSource } from '../ArchiveSource';
|
|
4
4
|
import BaseSubmitter, { SubmissionInput } from '../BaseSubmitter';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { SubmissionContext } from '../context';
|
|
6
|
+
import { AppSpecificPasswordCredentials, AppSpecificPasswordSource } from './AppSpecificPasswordSource';
|
|
7
|
+
import { AscApiKeyResult, AscApiKeySource } from './AscApiKeySource';
|
|
8
|
+
import { CredentialsServiceSource } from './CredentialsServiceSource';
|
|
7
9
|
export interface IosSubmissionOptions extends Pick<IosSubmissionConfigInput, 'appleIdUsername' | 'ascAppIdentifier'> {
|
|
8
10
|
projectId: string;
|
|
9
11
|
archiveSource: ArchiveSource;
|
|
10
12
|
appSpecificPasswordSource?: AppSpecificPasswordSource;
|
|
11
13
|
ascApiKeySource?: AscApiKeySource;
|
|
14
|
+
credentialsServiceSource?: CredentialsServiceSource;
|
|
12
15
|
}
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
interface ResolvedSourceOptions {
|
|
17
|
+
archive: Archive;
|
|
18
|
+
credentials: {
|
|
19
|
+
appSpecificPassword?: AppSpecificPasswordCredentials;
|
|
20
|
+
ascApiKeyResult?: AscApiKeyResult;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export default class IosSubmitter extends BaseSubmitter<Platform.IOS, ResolvedSourceOptions, IosSubmissionOptions> {
|
|
24
|
+
constructor(ctx: SubmissionContext<Platform.IOS>, options: IosSubmissionOptions);
|
|
25
|
+
createSubmissionInputAsync(resolvedSourceOptions: ResolvedSourceOptions): Promise<SubmissionInput<Platform.IOS>>;
|
|
15
26
|
protected createPlatformSubmissionAsync({ projectId, submissionConfig, buildId, }: SubmissionInput<Platform.IOS>): Promise<SubmissionFragment>;
|
|
16
|
-
private
|
|
17
|
-
private
|
|
27
|
+
private formatSubmissionConfig;
|
|
28
|
+
private formatAppSpecificPassword;
|
|
29
|
+
private formatAscApiKeyResult;
|
|
18
30
|
private prepareSummaryData;
|
|
19
31
|
}
|
|
32
|
+
export {};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
|
|
5
|
+
const events_1 = require("../../analytics/events");
|
|
5
6
|
const SubmissionMutation_1 = require("../../graphql/mutations/SubmissionMutation");
|
|
6
7
|
const formatFields_1 = (0, tslib_1.__importDefault)(require("../../utils/formatFields"));
|
|
7
8
|
const ArchiveSource_1 = require("../ArchiveSource");
|
|
@@ -9,17 +10,53 @@ const BaseSubmitter_1 = (0, tslib_1.__importDefault)(require("../BaseSubmitter")
|
|
|
9
10
|
const summary_1 = require("../utils/summary");
|
|
10
11
|
const AppSpecificPasswordSource_1 = require("./AppSpecificPasswordSource");
|
|
11
12
|
const AscApiKeySource_1 = require("./AscApiKeySource");
|
|
13
|
+
const CredentialsServiceSource_1 = require("./CredentialsServiceSource");
|
|
12
14
|
class IosSubmitter extends BaseSubmitter_1.default {
|
|
13
|
-
|
|
15
|
+
constructor(ctx, options) {
|
|
16
|
+
const sourceOptionsResolver = {
|
|
17
|
+
// eslint-disable-next-line async-protect/async-suffix
|
|
18
|
+
archive: async () => await (0, ArchiveSource_1.getArchiveAsync)(this.options.archiveSource),
|
|
19
|
+
// eslint-disable-next-line async-protect/async-suffix
|
|
20
|
+
credentials: async () => {
|
|
21
|
+
const maybeAppSpecificPassword = this.options.appSpecificPasswordSource
|
|
22
|
+
? await (0, AppSpecificPasswordSource_1.getAppSpecificPasswordLocallyAsync)(this.ctx, this.options.appSpecificPasswordSource)
|
|
23
|
+
: null;
|
|
24
|
+
const maybeAppStoreConnectApiKey = this.options.ascApiKeySource
|
|
25
|
+
? await (0, AscApiKeySource_1.getAscApiKeyLocallyAsync)(this.ctx, this.options.ascApiKeySource)
|
|
26
|
+
: null;
|
|
27
|
+
const maybeAscOrAspFromCredentialsService = this.options.credentialsServiceSource
|
|
28
|
+
? await (0, CredentialsServiceSource_1.getFromCredentialsServiceAsync)(this.ctx)
|
|
29
|
+
: null;
|
|
30
|
+
return {
|
|
31
|
+
...(maybeAppSpecificPassword ? { appSpecificPassword: maybeAppSpecificPassword } : null),
|
|
32
|
+
...(maybeAppStoreConnectApiKey ? { ascApiKeyResult: maybeAppStoreConnectApiKey } : null),
|
|
33
|
+
...(maybeAscOrAspFromCredentialsService ? maybeAscOrAspFromCredentialsService : null),
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
const sourceOptionsAnalytics = {
|
|
38
|
+
archive: {
|
|
39
|
+
attemptEvent: events_1.SubmissionEvent.GATHER_ARCHIVE_ATTEMPT,
|
|
40
|
+
successEvent: events_1.SubmissionEvent.GATHER_ARCHIVE_SUCCESS,
|
|
41
|
+
failureEvent: events_1.SubmissionEvent.GATHER_ARCHIVE_FAIL,
|
|
42
|
+
},
|
|
43
|
+
credentials: {
|
|
44
|
+
attemptEvent: events_1.SubmissionEvent.GATHER_CREDENTIALS_ATTEMPT,
|
|
45
|
+
successEvent: events_1.SubmissionEvent.GATHER_CREDENTIALS_SUCCESS,
|
|
46
|
+
failureEvent: events_1.SubmissionEvent.GATHER_CREDENTIALS_FAIL,
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
super(ctx, options, sourceOptionsResolver, sourceOptionsAnalytics);
|
|
50
|
+
}
|
|
51
|
+
async createSubmissionInputAsync(resolvedSourceOptions) {
|
|
14
52
|
var _a;
|
|
15
|
-
const
|
|
16
|
-
const submissionConfig = await this.formatSubmissionConfigAsync(this.options, resolvedSourceOptions);
|
|
53
|
+
const submissionConfig = this.formatSubmissionConfig(this.options, resolvedSourceOptions);
|
|
17
54
|
(0, summary_1.printSummary)(this.prepareSummaryData(this.options, resolvedSourceOptions), SummaryHumanReadableKeys);
|
|
18
|
-
return
|
|
55
|
+
return {
|
|
19
56
|
projectId: this.options.projectId,
|
|
20
57
|
submissionConfig,
|
|
21
58
|
buildId: (_a = resolvedSourceOptions.archive.build) === null || _a === void 0 ? void 0 : _a.id,
|
|
22
|
-
}
|
|
59
|
+
};
|
|
23
60
|
}
|
|
24
61
|
async createPlatformSubmissionAsync({ projectId, submissionConfig, buildId, }) {
|
|
25
62
|
return await SubmissionMutation_1.SubmissionMutation.createIosSubmissionAsync({
|
|
@@ -28,48 +65,43 @@ class IosSubmitter extends BaseSubmitter_1.default {
|
|
|
28
65
|
submittedBuildId: buildId,
|
|
29
66
|
});
|
|
30
67
|
}
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
const maybeAppSpecificPassword = this.options.appSpecificPasswordSource
|
|
34
|
-
? await (0, AppSpecificPasswordSource_1.getAppSpecificPasswordAsync)(this.options.appSpecificPasswordSource)
|
|
35
|
-
: null;
|
|
36
|
-
const maybeAppStoreConnectApiKey = this.options.ascApiKeySource
|
|
37
|
-
? await (0, AscApiKeySource_1.getAscApiKeyLocallyAsync)(this.options.ascApiKeySource)
|
|
38
|
-
: null;
|
|
39
|
-
return {
|
|
40
|
-
archive,
|
|
41
|
-
...(maybeAppSpecificPassword ? { appSpecificPassword: maybeAppSpecificPassword } : null),
|
|
42
|
-
...(maybeAppStoreConnectApiKey ? { ascApiKeyResult: maybeAppStoreConnectApiKey } : null),
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
async formatSubmissionConfigAsync(options, { archive, appSpecificPassword, ascApiKeyResult }) {
|
|
68
|
+
formatSubmissionConfig(options, { archive, credentials }) {
|
|
69
|
+
const { appSpecificPassword, ascApiKeyResult } = credentials;
|
|
46
70
|
const { appleIdUsername, ascAppIdentifier } = options;
|
|
47
71
|
return {
|
|
48
72
|
ascAppIdentifier,
|
|
49
73
|
appleIdUsername,
|
|
50
74
|
archiveUrl: archive.url,
|
|
51
|
-
|
|
52
|
-
...((ascApiKeyResult === null || ascApiKeyResult === void 0 ? void 0 : ascApiKeyResult.result)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
: null),
|
|
75
|
+
...(appSpecificPassword ? this.formatAppSpecificPassword(appSpecificPassword) : null),
|
|
76
|
+
...((ascApiKeyResult === null || ascApiKeyResult === void 0 ? void 0 : ascApiKeyResult.result) ? this.formatAscApiKeyResult(ascApiKeyResult.result) : null),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
formatAppSpecificPassword(appSpecificPassword) {
|
|
80
|
+
return {
|
|
81
|
+
appleAppSpecificPassword: appSpecificPassword.password,
|
|
82
|
+
appleIdUsername: appSpecificPassword.appleIdUsername,
|
|
61
83
|
};
|
|
62
84
|
}
|
|
63
|
-
|
|
64
|
-
|
|
85
|
+
formatAscApiKeyResult(result) {
|
|
86
|
+
return 'ascApiKeyId' in result
|
|
87
|
+
? { ascApiKeyId: result.ascApiKeyId }
|
|
88
|
+
: {
|
|
89
|
+
ascApiKey: {
|
|
90
|
+
keyP8: result.keyP8,
|
|
91
|
+
keyIdentifier: result.keyId,
|
|
92
|
+
issuerIdentifier: result.issuerId,
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
prepareSummaryData(options, { archive, credentials }) {
|
|
97
|
+
const { ascApiKeyResult, appSpecificPassword } = credentials;
|
|
98
|
+
const { ascAppIdentifier, projectId } = options;
|
|
65
99
|
// structuring order affects table rows order
|
|
66
100
|
return {
|
|
67
101
|
ascAppIdentifier,
|
|
68
|
-
appleIdUsername,
|
|
69
102
|
projectId,
|
|
70
|
-
...(
|
|
71
|
-
|
|
72
|
-
: null),
|
|
103
|
+
...(appSpecificPassword ? { appleIdUsername: appSpecificPassword.appleIdUsername } : null),
|
|
104
|
+
...(ascApiKeyResult ? { formattedAscApiKey: formatAscApiKeySummary(ascApiKeyResult) } : null),
|
|
73
105
|
...(0, summary_1.formatArchiveSourceSummary)(archive),
|
|
74
106
|
};
|
|
75
107
|
}
|
|
@@ -82,11 +114,19 @@ const SummaryHumanReadableKeys = {
|
|
|
82
114
|
archiveUrl: 'Archive URL',
|
|
83
115
|
archivePath: 'Archive Path',
|
|
84
116
|
formattedBuild: 'Build',
|
|
85
|
-
formattedAscApiKey: 'App Store Connect
|
|
117
|
+
formattedAscApiKey: 'App Store Connect API Key',
|
|
86
118
|
};
|
|
87
|
-
function
|
|
88
|
-
const { source, path, keyId } = summary;
|
|
119
|
+
function formatAscApiKeySummary({ summary }) {
|
|
120
|
+
const { source, path, keyId, name } = summary;
|
|
89
121
|
const fields = [
|
|
122
|
+
{
|
|
123
|
+
label: 'Key Name',
|
|
124
|
+
value: name,
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
label: 'Key ID',
|
|
128
|
+
value: keyId,
|
|
129
|
+
},
|
|
90
130
|
{
|
|
91
131
|
label: 'Key Source',
|
|
92
132
|
value: source,
|
|
@@ -95,10 +135,6 @@ function formatServiceAccountSummary({ summary }) {
|
|
|
95
135
|
label: 'Key Path',
|
|
96
136
|
value: path,
|
|
97
137
|
},
|
|
98
|
-
{
|
|
99
|
-
label: 'Key ID',
|
|
100
|
-
value: keyId,
|
|
101
|
-
},
|
|
102
138
|
];
|
|
103
139
|
const filteredFields = fields.filter(({ value }) => value !== undefined && value !== null);
|
|
104
140
|
return ('\n' +
|