eas-cli 0.48.2 → 0.51.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 +137 -43
- package/build/build/build.d.ts +6 -2
- package/build/build/build.js +191 -104
- package/build/build/local.js +1 -1
- package/build/build/runBuildAndSubmit.js +5 -1
- package/build/build/utils/printBuildInfo.js +1 -2
- package/build/commands/update/index.d.ts +1 -0
- package/build/commands/update/index.js +27 -3
- package/build/credentials/android/actions/CreateGoogleServiceAccountKey.js +24 -9
- package/build/credentials/context.js +5 -0
- package/build/credentials/ios/actions/AscApiKeyUtils.js +0 -1
- package/build/credentials/ios/actions/ConfigureProvisioningProfile.js +1 -1
- package/build/credentials/ios/actions/CreateProvisioningProfile.js +1 -1
- package/build/credentials/ios/appstore/AppStoreApi.d.ts +5 -1
- package/build/credentials/ios/appstore/AppStoreApi.js +38 -15
- package/build/credentials/ios/appstore/ascApiKey.d.ts +21 -5
- package/build/credentials/ios/appstore/ascApiKey.js +28 -12
- package/build/credentials/ios/appstore/authenticate.d.ts +9 -18
- package/build/credentials/ios/appstore/authenticate.js +43 -3
- package/build/credentials/ios/appstore/authenticateTypes.d.ts +42 -0
- package/build/credentials/ios/appstore/authenticateTypes.js +16 -0
- package/build/credentials/ios/appstore/capabilityIdentifiers.d.ts +2 -0
- package/build/credentials/ios/appstore/capabilityIdentifiers.js +9 -0
- package/build/credentials/ios/appstore/contractMessages.d.ts +3 -0
- package/build/credentials/ios/appstore/contractMessages.js +12 -0
- package/build/credentials/ios/appstore/distributionCertificate.d.ts +1 -1
- package/build/credentials/ios/appstore/ensureAppExists.d.ts +2 -2
- package/build/credentials/ios/appstore/ensureAppExists.js +12 -5
- package/build/credentials/ios/appstore/provisioningProfile.d.ts +1 -1
- package/build/credentials/ios/appstore/provisioningProfile.js +6 -0
- package/build/credentials/ios/appstore/provisioningProfileAdhoc.d.ts +1 -1
- package/build/credentials/ios/appstore/provisioningProfileAdhoc.js +17 -2
- package/build/credentials/ios/appstore/pushKey.d.ts +16 -4
- package/build/credentials/ios/appstore/pushKey.js +20 -8
- package/build/credentials/ios/appstore/resolveCredentials.d.ts +10 -1
- package/build/credentials/ios/appstore/resolveCredentials.js +125 -3
- package/build/credentials/ios/utils/authType.d.ts +4 -0
- package/build/credentials/ios/utils/authType.js +8 -0
- package/build/fetch.d.ts +1 -1
- package/build/fetch.js +10 -7
- package/build/graphql/client.js +1 -1
- package/build/graphql/generated.d.ts +73 -0
- package/build/graphql/generated.js +16 -1
- package/build/graphql/types/Build.js +4 -0
- package/build/project/ios/target.js +37 -0
- package/build/project/publish.js +2 -1
- package/build/submit/android/ServiceAccountSource.js +1 -1
- package/build/submit/ios/AppProduce.d.ts +0 -1
- package/build/submit/ios/AppProduce.js +5 -6
- package/build/submit/ios/AppSpecificPasswordSource.js +2 -2
- package/build/submit/utils/errors.js +6 -2
- package/build/utils/code-signing.d.ts +0 -5
- package/build/utils/code-signing.js +16 -65
- package/oclif.manifest.json +1 -1
- package/package.json +14 -14
|
@@ -1,16 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const log_1 = tslib_1.__importDefault(require("../../../log"));
|
|
3
5
|
const ascApiKey_1 = require("./ascApiKey");
|
|
4
6
|
const authenticate_1 = require("./authenticate");
|
|
7
|
+
const authenticateTypes_1 = require("./authenticateTypes");
|
|
5
8
|
const distributionCertificate_1 = require("./distributionCertificate");
|
|
6
9
|
const ensureAppExists_1 = require("./ensureAppExists");
|
|
7
10
|
const provisioningProfile_1 = require("./provisioningProfile");
|
|
8
11
|
const provisioningProfileAdhoc_1 = require("./provisioningProfileAdhoc");
|
|
9
12
|
const pushKey_1 = require("./pushKey");
|
|
13
|
+
const resolveCredentials_1 = require("./resolveCredentials");
|
|
10
14
|
class AppStoreApi {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.defaultAuthenticationMode = (0, resolveCredentials_1.hasAscEnvVars)()
|
|
17
|
+
? authenticateTypes_1.AuthenticationMode.API_KEY
|
|
18
|
+
: authenticateTypes_1.AuthenticationMode.USER;
|
|
19
|
+
}
|
|
20
|
+
async ensureUserAuthenticatedAsync(options) {
|
|
21
|
+
if (this.authCtx && !(0, authenticate_1.isUserAuthCtx)(this.authCtx)) {
|
|
22
|
+
// already authenticated, but with the wrong type
|
|
23
|
+
log_1.default.log(`Only user authentication is supported. Reauthenticating as user...`);
|
|
24
|
+
this.authCtx = undefined;
|
|
25
|
+
}
|
|
26
|
+
const updatedAuthCtx = await this.ensureAuthenticatedAsync({
|
|
27
|
+
...options,
|
|
28
|
+
mode: authenticateTypes_1.AuthenticationMode.USER,
|
|
29
|
+
});
|
|
30
|
+
return (0, authenticate_1.assertUserAuthCtx)(updatedAuthCtx);
|
|
31
|
+
}
|
|
11
32
|
async ensureAuthenticatedAsync(options) {
|
|
33
|
+
var _a;
|
|
12
34
|
if (!this.authCtx) {
|
|
13
|
-
|
|
35
|
+
const mode = (_a = options === null || options === void 0 ? void 0 : options.mode) !== null && _a !== void 0 ? _a : this.defaultAuthenticationMode;
|
|
36
|
+
this.authCtx = await (0, authenticate_1.authenticateAsync)({ mode, ...options });
|
|
14
37
|
}
|
|
15
38
|
return this.authCtx;
|
|
16
39
|
}
|
|
@@ -31,16 +54,16 @@ class AppStoreApi {
|
|
|
31
54
|
return await (0, distributionCertificate_1.revokeDistributionCertificateAsync)(ctx, ids);
|
|
32
55
|
}
|
|
33
56
|
async listPushKeysAsync() {
|
|
34
|
-
const
|
|
35
|
-
return await (0, pushKey_1.listPushKeysAsync)(
|
|
57
|
+
const userCtx = await this.ensureUserAuthenticatedAsync();
|
|
58
|
+
return await (0, pushKey_1.listPushKeysAsync)(userCtx);
|
|
36
59
|
}
|
|
37
60
|
async createPushKeyAsync(name) {
|
|
38
|
-
const
|
|
39
|
-
return await (0, pushKey_1.createPushKeyAsync)(
|
|
61
|
+
const userCtx = await this.ensureUserAuthenticatedAsync();
|
|
62
|
+
return await (0, pushKey_1.createPushKeyAsync)(userCtx, name);
|
|
40
63
|
}
|
|
41
64
|
async revokePushKeyAsync(ids) {
|
|
42
|
-
const
|
|
43
|
-
return await (0, pushKey_1.revokePushKeyAsync)(
|
|
65
|
+
const userCtx = await this.ensureUserAuthenticatedAsync();
|
|
66
|
+
return await (0, pushKey_1.revokePushKeyAsync)(userCtx, ids);
|
|
44
67
|
}
|
|
45
68
|
async useExistingProvisioningProfileAsync(bundleIdentifier, provisioningProfile, distCert) {
|
|
46
69
|
const ctx = await this.ensureAuthenticatedAsync();
|
|
@@ -63,20 +86,20 @@ class AppStoreApi {
|
|
|
63
86
|
return await (0, provisioningProfileAdhoc_1.createOrReuseAdhocProvisioningProfileAsync)(ctx, udids, bundleIdentifier, distCertSerialNumber);
|
|
64
87
|
}
|
|
65
88
|
async listAscApiKeysAsync() {
|
|
66
|
-
const
|
|
67
|
-
return await (0, ascApiKey_1.listAscApiKeysAsync)(
|
|
89
|
+
const userCtx = await this.ensureUserAuthenticatedAsync();
|
|
90
|
+
return await (0, ascApiKey_1.listAscApiKeysAsync)(userCtx);
|
|
68
91
|
}
|
|
69
92
|
async getAscApiKeyAsync(keyId) {
|
|
70
|
-
const
|
|
71
|
-
return await (0, ascApiKey_1.getAscApiKeyAsync)(
|
|
93
|
+
const userCtx = await this.ensureUserAuthenticatedAsync();
|
|
94
|
+
return await (0, ascApiKey_1.getAscApiKeyAsync)(userCtx, keyId);
|
|
72
95
|
}
|
|
73
96
|
async createAscApiKeyAsync({ nickname }) {
|
|
74
|
-
const
|
|
75
|
-
return await (0, ascApiKey_1.createAscApiKeyAsync)(
|
|
97
|
+
const userCtx = await this.ensureUserAuthenticatedAsync();
|
|
98
|
+
return await (0, ascApiKey_1.createAscApiKeyAsync)(userCtx, { nickname });
|
|
76
99
|
}
|
|
77
100
|
async revokeAscApiKeyAsync(keyId) {
|
|
78
|
-
const
|
|
79
|
-
return await (0, ascApiKey_1.revokeAscApiKeyAsync)(
|
|
101
|
+
const userCtx = await this.ensureUserAuthenticatedAsync();
|
|
102
|
+
return await (0, ascApiKey_1.revokeAscApiKeyAsync)(userCtx, keyId);
|
|
80
103
|
}
|
|
81
104
|
}
|
|
82
105
|
exports.default = AppStoreApi;
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
/// <reference types="@expo/apple-utils/ts-declarations/expo__app-store" />
|
|
2
2
|
import { ApiKey, ApiKeyProps } from '@expo/apple-utils';
|
|
3
3
|
import { AscApiKey, AscApiKeyInfo } from './Credentials.types';
|
|
4
|
-
import { AuthCtx } from './
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import { AuthCtx, UserAuthCtx } from './authenticateTypes';
|
|
5
|
+
/**
|
|
6
|
+
* List App Store Connect API Keys.
|
|
7
|
+
* **Does not support App Store Connect API (CI).**
|
|
8
|
+
*/
|
|
9
|
+
export declare function listAscApiKeysAsync(userAuthCtx: UserAuthCtx): Promise<AscApiKeyInfo[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Get an App Store Connect API Key.
|
|
12
|
+
* **Does not support App Store Connect API (CI).**
|
|
13
|
+
*/
|
|
14
|
+
export declare function getAscApiKeyAsync(userAuthCtx: UserAuthCtx, keyId: string): Promise<AscApiKeyInfo | null>;
|
|
15
|
+
/**
|
|
16
|
+
* Create an App Store Connect API Key.
|
|
17
|
+
* **Does not support App Store Connect API (CI).**
|
|
18
|
+
*/
|
|
19
|
+
export declare function createAscApiKeyAsync(userAuthCtx: UserAuthCtx, { nickname, allAppsVisible, roles, keyType, }: Partial<Pick<ApiKeyProps, 'nickname' | 'roles' | 'allAppsVisible' | 'keyType'>>): Promise<AscApiKey>;
|
|
20
|
+
/**
|
|
21
|
+
* Revoke an App Store Connect API Key.
|
|
22
|
+
* **Does not support App Store Connect API (CI).**
|
|
23
|
+
*/
|
|
24
|
+
export declare function revokeAscApiKeyAsync(userAuthCtx: UserAuthCtx, keyId: string): Promise<AscApiKeyInfo>;
|
|
9
25
|
export declare function getAscApiKeyInfo(apiKey: ApiKey, authCtx: AuthCtx): AscApiKeyInfo;
|
|
@@ -6,13 +6,17 @@ const apple_utils_1 = require("@expo/apple-utils");
|
|
|
6
6
|
const log_1 = tslib_1.__importDefault(require("../../../log"));
|
|
7
7
|
const ora_1 = require("../../../ora");
|
|
8
8
|
const authenticate_1 = require("./authenticate");
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* List App Store Connect API Keys.
|
|
11
|
+
* **Does not support App Store Connect API (CI).**
|
|
12
|
+
*/
|
|
13
|
+
async function listAscApiKeysAsync(userAuthCtx) {
|
|
10
14
|
const spinner = (0, ora_1.ora)(`Fetching App Store Connect API Keys.`).start();
|
|
11
15
|
try {
|
|
12
|
-
const context = (0, authenticate_1.getRequestContext)(
|
|
16
|
+
const context = (0, authenticate_1.getRequestContext)(userAuthCtx);
|
|
13
17
|
const keys = await apple_utils_1.ApiKey.getAsync(context);
|
|
14
18
|
spinner.succeed(`Fetched App Store Connect API Keys.`);
|
|
15
|
-
return keys.map(key => getAscApiKeyInfo(key,
|
|
19
|
+
return keys.map(key => getAscApiKeyInfo(key, userAuthCtx));
|
|
16
20
|
}
|
|
17
21
|
catch (error) {
|
|
18
22
|
spinner.fail(`Failed to fetch App Store Connect API Keys.`);
|
|
@@ -20,14 +24,18 @@ async function listAscApiKeysAsync(authCtx) {
|
|
|
20
24
|
}
|
|
21
25
|
}
|
|
22
26
|
exports.listAscApiKeysAsync = listAscApiKeysAsync;
|
|
23
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Get an App Store Connect API Key.
|
|
29
|
+
* **Does not support App Store Connect API (CI).**
|
|
30
|
+
*/
|
|
31
|
+
async function getAscApiKeyAsync(userAuthCtx, keyId) {
|
|
24
32
|
var _a;
|
|
25
33
|
const spinner = (0, ora_1.ora)(`Fetching App Store Connect API Key.`).start();
|
|
26
34
|
try {
|
|
27
|
-
const context = (0, authenticate_1.getRequestContext)(
|
|
35
|
+
const context = (0, authenticate_1.getRequestContext)(userAuthCtx);
|
|
28
36
|
const apiKey = await apple_utils_1.ApiKey.infoAsync(context, { id: keyId });
|
|
29
37
|
spinner.succeed(`Fetched App Store Connect API Key (ID: ${keyId}).`);
|
|
30
|
-
return getAscApiKeyInfo(apiKey,
|
|
38
|
+
return getAscApiKeyInfo(apiKey, userAuthCtx);
|
|
31
39
|
}
|
|
32
40
|
catch (error) {
|
|
33
41
|
const message = (_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : '';
|
|
@@ -41,10 +49,14 @@ async function getAscApiKeyAsync(authCtx, keyId) {
|
|
|
41
49
|
}
|
|
42
50
|
}
|
|
43
51
|
exports.getAscApiKeyAsync = getAscApiKeyAsync;
|
|
44
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Create an App Store Connect API Key.
|
|
54
|
+
* **Does not support App Store Connect API (CI).**
|
|
55
|
+
*/
|
|
56
|
+
async function createAscApiKeyAsync(userAuthCtx, { nickname, allAppsVisible, roles, keyType, }) {
|
|
45
57
|
const spinner = (0, ora_1.ora)(`Creating App Store Connect API Key.`).start();
|
|
46
58
|
try {
|
|
47
|
-
const context = (0, authenticate_1.getRequestContext)(
|
|
59
|
+
const context = (0, authenticate_1.getRequestContext)(userAuthCtx);
|
|
48
60
|
const key = await apple_utils_1.ApiKey.createAsync(context, {
|
|
49
61
|
nickname: nickname !== null && nickname !== void 0 ? nickname : `[expo] ${new Date().getTime()}`,
|
|
50
62
|
allAppsVisible: allAppsVisible !== null && allAppsVisible !== void 0 ? allAppsVisible : true,
|
|
@@ -68,7 +80,7 @@ async function createAscApiKeyAsync(authCtx, { nickname, allAppsVisible, roles,
|
|
|
68
80
|
const fullKey = await apple_utils_1.ApiKey.infoAsync(context, { id: key.id });
|
|
69
81
|
spinner.succeed(`Created App Store Connect API Key.`);
|
|
70
82
|
return {
|
|
71
|
-
...getAscApiKeyInfo(fullKey,
|
|
83
|
+
...getAscApiKeyInfo(fullKey, userAuthCtx),
|
|
72
84
|
keyP8,
|
|
73
85
|
};
|
|
74
86
|
}
|
|
@@ -78,14 +90,18 @@ async function createAscApiKeyAsync(authCtx, { nickname, allAppsVisible, roles,
|
|
|
78
90
|
}
|
|
79
91
|
}
|
|
80
92
|
exports.createAscApiKeyAsync = createAscApiKeyAsync;
|
|
81
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Revoke an App Store Connect API Key.
|
|
95
|
+
* **Does not support App Store Connect API (CI).**
|
|
96
|
+
*/
|
|
97
|
+
async function revokeAscApiKeyAsync(userAuthCtx, keyId) {
|
|
82
98
|
const spinner = (0, ora_1.ora)(`Revoking App Store Connect API Key.`).start();
|
|
83
99
|
try {
|
|
84
|
-
const context = (0, authenticate_1.getRequestContext)(
|
|
100
|
+
const context = (0, authenticate_1.getRequestContext)(userAuthCtx);
|
|
85
101
|
const apiKey = await apple_utils_1.ApiKey.infoAsync(context, { id: keyId });
|
|
86
102
|
const revokedKey = await apiKey.revokeAsync();
|
|
87
103
|
spinner.succeed(`Revoked App Store Connect API Key.`);
|
|
88
|
-
return getAscApiKeyInfo(revokedKey,
|
|
104
|
+
return getAscApiKeyInfo(revokedKey, userAuthCtx);
|
|
89
105
|
}
|
|
90
106
|
catch (error) {
|
|
91
107
|
log_1.default.error(error);
|
|
@@ -1,30 +1,21 @@
|
|
|
1
1
|
/// <reference types="@expo/apple-utils/ts-declarations/expo__app-store" />
|
|
2
2
|
import { RequestContext, Session } from '@expo/apple-utils';
|
|
3
|
+
import { MinimalAscApiKey } from '../credentials';
|
|
4
|
+
import { AppleTeamType, AuthCtx, AuthenticationMode, UserAuthCtx } from './authenticateTypes';
|
|
3
5
|
export declare type Options = {
|
|
4
6
|
appleId?: string;
|
|
5
7
|
teamId?: string;
|
|
8
|
+
teamName?: string;
|
|
9
|
+
teamType?: AppleTeamType;
|
|
10
|
+
ascApiKey?: MinimalAscApiKey;
|
|
6
11
|
/**
|
|
7
12
|
* Can be used to restore the Apple auth state via apple-utils.
|
|
8
13
|
*/
|
|
9
14
|
cookies?: Session.AuthState['cookies'];
|
|
15
|
+
/** Indicates how Apple network requests will be made. */
|
|
16
|
+
mode?: AuthenticationMode;
|
|
10
17
|
};
|
|
11
|
-
export declare
|
|
12
|
-
|
|
13
|
-
name: string;
|
|
14
|
-
inHouse?: boolean;
|
|
15
|
-
};
|
|
16
|
-
export declare type AuthCtx = {
|
|
17
|
-
appleId: string;
|
|
18
|
-
appleIdPassword?: string;
|
|
19
|
-
team: Team;
|
|
20
|
-
/**
|
|
21
|
-
* Defined when using Fastlane
|
|
22
|
-
*/
|
|
23
|
-
fastlaneSession?: string;
|
|
24
|
-
/**
|
|
25
|
-
* Can be used to restore the Apple auth state via apple-utils.
|
|
26
|
-
*/
|
|
27
|
-
authState?: Session.AuthState;
|
|
28
|
-
};
|
|
18
|
+
export declare function isUserAuthCtx(authCtx: AuthCtx | undefined): authCtx is UserAuthCtx;
|
|
19
|
+
export declare function assertUserAuthCtx(authCtx: AuthCtx | undefined): UserAuthCtx;
|
|
29
20
|
export declare function getRequestContext(authCtx: AuthCtx): RequestContext;
|
|
30
21
|
export declare function authenticateAsync(options?: Options): Promise<AuthCtx>;
|
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.authenticateAsync = exports.getRequestContext = void 0;
|
|
3
|
+
exports.authenticateAsync = exports.getRequestContext = exports.assertUserAuthCtx = exports.isUserAuthCtx = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const apple_utils_1 = require("@expo/apple-utils");
|
|
6
6
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
7
7
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
8
|
const log_1 = tslib_1.__importDefault(require("../../../log"));
|
|
9
9
|
const prompts_1 = require("../../../prompts");
|
|
10
|
+
const authenticateTypes_1 = require("./authenticateTypes");
|
|
10
11
|
const resolveCredentials_1 = require("./resolveCredentials");
|
|
11
12
|
const APPLE_IN_HOUSE_TEAM_TYPE = 'in-house';
|
|
13
|
+
function isUserAuthCtx(authCtx) {
|
|
14
|
+
return !!authCtx && typeof authCtx.appleId === 'string';
|
|
15
|
+
}
|
|
16
|
+
exports.isUserAuthCtx = isUserAuthCtx;
|
|
17
|
+
function assertUserAuthCtx(authCtx) {
|
|
18
|
+
if (isUserAuthCtx(authCtx)) {
|
|
19
|
+
return authCtx;
|
|
20
|
+
}
|
|
21
|
+
throw new Error('Expected user authentication context (login/password).');
|
|
22
|
+
}
|
|
23
|
+
exports.assertUserAuthCtx = assertUserAuthCtx;
|
|
12
24
|
function getRequestContext(authCtx) {
|
|
13
25
|
var _a;
|
|
14
26
|
(0, assert_1.default)((_a = authCtx.authState) === null || _a === void 0 ? void 0 : _a.context, 'Apple request context must be defined');
|
|
@@ -26,7 +38,7 @@ async function loginAsync(userCredentials = {}, options) {
|
|
|
26
38
|
}
|
|
27
39
|
}
|
|
28
40
|
// Resolve the user credentials, optimizing for password-less login.
|
|
29
|
-
const { username, password } = await (0, resolveCredentials_1.
|
|
41
|
+
const { username, password } = await (0, resolveCredentials_1.resolveUserCredentialsAsync)(userCredentials);
|
|
30
42
|
(0, assert_1.default)(username);
|
|
31
43
|
// Clear data
|
|
32
44
|
apple_utils_1.Auth.resetInMemoryData();
|
|
@@ -82,6 +94,35 @@ async function loginWithUserCredentialsAsync({ username, password, teamId, provi
|
|
|
82
94
|
return newSession;
|
|
83
95
|
}
|
|
84
96
|
async function authenticateAsync(options = {}) {
|
|
97
|
+
if (options.mode === authenticateTypes_1.AuthenticationMode.API_KEY) {
|
|
98
|
+
return await authenticateWithApiKeyAsync(options);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
return await authenticateAsUserAsync(options);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.authenticateAsync = authenticateAsync;
|
|
105
|
+
async function authenticateWithApiKeyAsync(options = {}) {
|
|
106
|
+
// Resolve the user credentials, optimizing for password-less login.
|
|
107
|
+
const ascApiKey = await (0, resolveCredentials_1.resolveAscApiKeyAsync)(options.ascApiKey);
|
|
108
|
+
const team = await (0, resolveCredentials_1.resolveAppleTeamAsync)(options);
|
|
109
|
+
const jwtDurationSeconds = 1200; // 20 minutes
|
|
110
|
+
return {
|
|
111
|
+
team,
|
|
112
|
+
authState: {
|
|
113
|
+
context: {
|
|
114
|
+
token: new apple_utils_1.Token({
|
|
115
|
+
key: ascApiKey.keyP8,
|
|
116
|
+
issuerId: ascApiKey.issuerId,
|
|
117
|
+
keyId: ascApiKey.keyId,
|
|
118
|
+
duration: jwtDurationSeconds,
|
|
119
|
+
}),
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
ascApiKey,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
async function authenticateAsUserAsync(options = {}) {
|
|
85
126
|
// help keep apple login visually apart from the other operations.
|
|
86
127
|
log_1.default.addNewLineIfNone();
|
|
87
128
|
try {
|
|
@@ -119,7 +160,6 @@ async function authenticateAsync(options = {}) {
|
|
|
119
160
|
throw error;
|
|
120
161
|
}
|
|
121
162
|
}
|
|
122
|
-
exports.authenticateAsync = authenticateAsync;
|
|
123
163
|
function formatTeam({ teamId, name, type }) {
|
|
124
164
|
return {
|
|
125
165
|
id: teamId,
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/// <reference types="@expo/apple-utils/ts-declarations/expo__app-store" />
|
|
2
|
+
import { Session } from '@expo/apple-utils';
|
|
3
|
+
import { MinimalAscApiKey } from '../credentials';
|
|
4
|
+
export declare enum AuthenticationMode {
|
|
5
|
+
/** App Store API requests will be made using the official API via an API key, used for CI environments where 2FA cannot be performed. */
|
|
6
|
+
API_KEY = 0,
|
|
7
|
+
/** Uses cookies based authentication and the unofficial App Store web API, this provides more functionality than the official API but cannot be reliably used in CI because it requires 2FA. */
|
|
8
|
+
USER = 1
|
|
9
|
+
}
|
|
10
|
+
export declare enum AppleTeamType {
|
|
11
|
+
IN_HOUSE = "IN_HOUSE",
|
|
12
|
+
COMPANY_OR_ORGANIZATION = "COMPANY_OR_ORGANIZATION",
|
|
13
|
+
INDIVIDUAL = "INDIVIDUAL"
|
|
14
|
+
}
|
|
15
|
+
export declare type Team = {
|
|
16
|
+
id: string;
|
|
17
|
+
/** Name of the development team, this is undefined when ASC API keys are used instead of cookies for authentication. */
|
|
18
|
+
name?: string;
|
|
19
|
+
inHouse?: boolean;
|
|
20
|
+
};
|
|
21
|
+
export declare type UserAuthCtx = {
|
|
22
|
+
appleId: string;
|
|
23
|
+
appleIdPassword?: string;
|
|
24
|
+
team: Team;
|
|
25
|
+
/**
|
|
26
|
+
* Defined when using Fastlane
|
|
27
|
+
*/
|
|
28
|
+
fastlaneSession?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Can be used to restore the Apple auth state via apple-utils.
|
|
31
|
+
*/
|
|
32
|
+
authState?: Session.AuthState;
|
|
33
|
+
};
|
|
34
|
+
export declare type ApiKeyAuthCtx = {
|
|
35
|
+
ascApiKey: MinimalAscApiKey;
|
|
36
|
+
team: Team;
|
|
37
|
+
/**
|
|
38
|
+
* Can be used to restore the Apple auth state via apple-utils.
|
|
39
|
+
*/
|
|
40
|
+
authState?: Partial<Session.AuthState>;
|
|
41
|
+
};
|
|
42
|
+
export declare type AuthCtx = UserAuthCtx | ApiKeyAuthCtx;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppleTeamType = exports.AuthenticationMode = void 0;
|
|
4
|
+
var AuthenticationMode;
|
|
5
|
+
(function (AuthenticationMode) {
|
|
6
|
+
/** App Store API requests will be made using the official API via an API key, used for CI environments where 2FA cannot be performed. */
|
|
7
|
+
AuthenticationMode[AuthenticationMode["API_KEY"] = 0] = "API_KEY";
|
|
8
|
+
/** Uses cookies based authentication and the unofficial App Store web API, this provides more functionality than the official API but cannot be reliably used in CI because it requires 2FA. */
|
|
9
|
+
AuthenticationMode[AuthenticationMode["USER"] = 1] = "USER";
|
|
10
|
+
})(AuthenticationMode = exports.AuthenticationMode || (exports.AuthenticationMode = {}));
|
|
11
|
+
var AppleTeamType;
|
|
12
|
+
(function (AppleTeamType) {
|
|
13
|
+
AppleTeamType["IN_HOUSE"] = "IN_HOUSE";
|
|
14
|
+
AppleTeamType["COMPANY_OR_ORGANIZATION"] = "COMPANY_OR_ORGANIZATION";
|
|
15
|
+
AppleTeamType["INDIVIDUAL"] = "INDIVIDUAL";
|
|
16
|
+
})(AppleTeamType = exports.AppleTeamType || (exports.AppleTeamType = {}));
|
|
@@ -6,6 +6,8 @@ import { JSONObject } from '@expo/json-file';
|
|
|
6
6
|
* If a capability identifier is missing, then attempt to create it.
|
|
7
7
|
* Link all of the capability identifiers at the same time after parsing the entitlements file.
|
|
8
8
|
*
|
|
9
|
+
* **Does not support App Store Connect API (CI).**
|
|
10
|
+
*
|
|
9
11
|
* @param bundleId Bundle identifier object.
|
|
10
12
|
* @param entitlements JSON representation of the iOS entitlements plist
|
|
11
13
|
*
|
|
@@ -4,12 +4,15 @@ exports.syncCapabilityIdentifiersForEntitlementsAsync = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const apple_utils_1 = require("@expo/apple-utils");
|
|
6
6
|
const log_1 = tslib_1.__importDefault(require("../../../log"));
|
|
7
|
+
const authType_1 = require("../utils/authType");
|
|
7
8
|
const bundleIdCapabilities_1 = require("./bundleIdCapabilities");
|
|
8
9
|
/**
|
|
9
10
|
* Sync the capability identifiers with the bundle identifier capabilities.
|
|
10
11
|
* If a capability identifier is missing, then attempt to create it.
|
|
11
12
|
* Link all of the capability identifiers at the same time after parsing the entitlements file.
|
|
12
13
|
*
|
|
14
|
+
* **Does not support App Store Connect API (CI).**
|
|
15
|
+
*
|
|
13
16
|
* @param bundleId Bundle identifier object.
|
|
14
17
|
* @param entitlements JSON representation of the iOS entitlements plist
|
|
15
18
|
*
|
|
@@ -19,6 +22,12 @@ async function syncCapabilityIdentifiersForEntitlementsAsync(bundleId, entitleme
|
|
|
19
22
|
if (bundleIdCapabilities_1.EXPO_NO_CAPABILITY_SYNC) {
|
|
20
23
|
return { created: [], linked: [] };
|
|
21
24
|
}
|
|
25
|
+
// App Store Connect token authentication is not currently supported,
|
|
26
|
+
// the team ID is required to create capability identifiers.
|
|
27
|
+
if ((0, authType_1.isAppStoreConnectTokenOnlyContext)(bundleId.context)) {
|
|
28
|
+
log_1.default.warn(`Skipping capability identifier syncing because the current Apple authentication session is not using Cookies (username/password).`);
|
|
29
|
+
return { created: [], linked: [] };
|
|
30
|
+
}
|
|
22
31
|
const createdIds = [];
|
|
23
32
|
const linkedIds = [];
|
|
24
33
|
const CapabilityIdMapping = bundleIdCapabilities_1.CapabilityMapping.filter(capability => capability.capabilityIdModel);
|
|
@@ -2,4 +2,7 @@
|
|
|
2
2
|
import { ITCAgreements, RequestContext } from '@expo/apple-utils';
|
|
3
3
|
import type { Ora } from '../../../ora';
|
|
4
4
|
export declare function formatContractMessage(message: ITCAgreements.ITCContractMessage): string;
|
|
5
|
+
/**
|
|
6
|
+
* **Does not support App Store Connect API (CI).**
|
|
7
|
+
*/
|
|
5
8
|
export declare function assertContractMessagesAsync(context: RequestContext, spinner?: Ora): Promise<void>;
|
|
@@ -6,6 +6,9 @@ const apple_utils_1 = require("@expo/apple-utils");
|
|
|
6
6
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
7
|
const log_1 = tslib_1.__importDefault(require("../../../log"));
|
|
8
8
|
const convertHTMLToASCII_1 = require("../utils/convertHTMLToASCII");
|
|
9
|
+
/**
|
|
10
|
+
* **Does not support App Store Connect API (CI).**
|
|
11
|
+
*/
|
|
9
12
|
async function getContractStatusAsync(context) {
|
|
10
13
|
var _a;
|
|
11
14
|
try {
|
|
@@ -17,6 +20,9 @@ async function getContractStatusAsync(context) {
|
|
|
17
20
|
return null;
|
|
18
21
|
}
|
|
19
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* **Does not support App Store Connect API (CI).**
|
|
25
|
+
*/
|
|
20
26
|
async function getContractMessagesAsync(context) {
|
|
21
27
|
try {
|
|
22
28
|
return await apple_utils_1.ITCAgreements.getContractMessagesAsync(context);
|
|
@@ -26,6 +32,9 @@ async function getContractMessagesAsync(context) {
|
|
|
26
32
|
return null;
|
|
27
33
|
}
|
|
28
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* **Does not support App Store Connect API (CI).**
|
|
37
|
+
*/
|
|
29
38
|
async function getRequiredContractMessagesAsync(context) {
|
|
30
39
|
var _a, _b;
|
|
31
40
|
// This emulates the check that's performed on the ASC website's "apps"
|
|
@@ -65,6 +74,9 @@ function formatContractMessage(message) {
|
|
|
65
74
|
});
|
|
66
75
|
}
|
|
67
76
|
exports.formatContractMessage = formatContractMessage;
|
|
77
|
+
/**
|
|
78
|
+
* **Does not support App Store Connect API (CI).**
|
|
79
|
+
*/
|
|
68
80
|
async function assertContractMessagesAsync(context, spinner) {
|
|
69
81
|
const { messages, isFatal } = await getRequiredContractMessagesAsync(context);
|
|
70
82
|
if (Array.isArray(messages) && messages.length) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="@expo/apple-utils/ts-declarations/expo__app-store" />
|
|
2
2
|
import { Certificate, RequestContext } from '@expo/apple-utils';
|
|
3
3
|
import { DistributionCertificate, DistributionCertificateStoreInfo } from './Credentials.types';
|
|
4
|
-
import { AuthCtx } from './
|
|
4
|
+
import { AuthCtx } from './authenticateTypes';
|
|
5
5
|
export declare class AppleTooManyCertsError extends Error {
|
|
6
6
|
}
|
|
7
7
|
export declare function getCertificateBySerialNumberAsync(context: RequestContext, serialNumber: string): Promise<Certificate>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="@expo/apple-utils/ts-declarations/expo__app-store" />
|
|
2
2
|
import { App, BundleId } from '@expo/apple-utils';
|
|
3
3
|
import { JSONObject } from '@expo/json-file';
|
|
4
|
-
import { AuthCtx } from './
|
|
4
|
+
import { AuthCtx, UserAuthCtx } from './authenticateTypes';
|
|
5
5
|
export interface IosCapabilitiesOptions {
|
|
6
6
|
entitlements: JSONObject;
|
|
7
7
|
}
|
|
@@ -17,7 +17,7 @@ export declare function ensureBundleIdExistsWithNameAsync(authCtx: AuthCtx, { na
|
|
|
17
17
|
}, options?: IosCapabilitiesOptions): Promise<void>;
|
|
18
18
|
export declare function syncCapabilitiesAsync(bundleId: BundleId, { entitlements }: IosCapabilitiesOptions): Promise<void>;
|
|
19
19
|
export declare function syncCapabilityIdentifiersAsync(bundleId: BundleId, { entitlements }: IosCapabilitiesOptions): Promise<void>;
|
|
20
|
-
export declare function ensureAppExistsAsync(
|
|
20
|
+
export declare function ensureAppExistsAsync(userAuthCtx: UserAuthCtx, { name, language, companyName, bundleIdentifier, sku, }: {
|
|
21
21
|
name: string;
|
|
22
22
|
language?: string;
|
|
23
23
|
companyName?: string;
|
|
@@ -44,7 +44,12 @@ async function ensureBundleIdExistsWithNameAsync(authCtx, { name, bundleIdentifi
|
|
|
44
44
|
if (err.message.match(/forbidden for security reasons/) ||
|
|
45
45
|
// Unable to process request - PLA Update available - You currently don't have access to this membership resource. To resolve this issue, agree to the latest Program License Agreement in your developer account.
|
|
46
46
|
err.message.match(/agree/)) {
|
|
47
|
-
|
|
47
|
+
if ((0, authenticate_1.isUserAuthCtx)(authCtx)) {
|
|
48
|
+
await (0, contractMessages_1.assertContractMessagesAsync)(context);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
log_1.default.warn(`You currently don't have access to this membership resource. To resolve this issue, agree to the latest Program License Agreement in your developer account.`);
|
|
52
|
+
}
|
|
48
53
|
}
|
|
49
54
|
}
|
|
50
55
|
throw err;
|
|
@@ -95,9 +100,9 @@ async function syncCapabilityIdentifiersAsync(bundleId, { entitlements }) {
|
|
|
95
100
|
}
|
|
96
101
|
}
|
|
97
102
|
exports.syncCapabilityIdentifiersAsync = syncCapabilityIdentifiersAsync;
|
|
98
|
-
async function ensureAppExistsAsync(
|
|
103
|
+
async function ensureAppExistsAsync(userAuthCtx, { name, language, companyName, bundleIdentifier, sku, }) {
|
|
99
104
|
var _a;
|
|
100
|
-
const context = (0, authenticate_1.getRequestContext)(
|
|
105
|
+
const context = (0, authenticate_1.getRequestContext)(userAuthCtx);
|
|
101
106
|
const spinner = (0, ora_1.ora)(`Linking to App Store Connect ${chalk_1.default.dim(bundleIdentifier)}`).start();
|
|
102
107
|
let app = await apple_utils_1.App.findAsync(context, { bundleId: bundleIdentifier });
|
|
103
108
|
if (!app) {
|
|
@@ -105,6 +110,9 @@ async function ensureAppExistsAsync(authCtx, { name, language, companyName, bund
|
|
|
105
110
|
try {
|
|
106
111
|
// Assert contract errors when the user needs to create an app.
|
|
107
112
|
await (0, contractMessages_1.assertContractMessagesAsync)(context, spinner);
|
|
113
|
+
/**
|
|
114
|
+
* **Does not support App Store Connect API (CI).**
|
|
115
|
+
*/
|
|
108
116
|
app = await apple_utils_1.App.createAsync(context, {
|
|
109
117
|
bundleId: bundleIdentifier,
|
|
110
118
|
name,
|
|
@@ -115,8 +123,7 @@ async function ensureAppExistsAsync(authCtx, { name, language, companyName, bund
|
|
|
115
123
|
}
|
|
116
124
|
catch (error) {
|
|
117
125
|
if (error.message.match(/An App ID with Identifier '(.*)' is not available/)) {
|
|
118
|
-
|
|
119
|
-
throw new Error(`\nThe bundle identifier "${bundleIdentifier}" is not available to provider "${providerName}". Please change it in your app config and try again.\n`);
|
|
126
|
+
throw new Error(`\nThe bundle identifier "${bundleIdentifier}" is not available to provider "${(_a = userAuthCtx.authState) === null || _a === void 0 ? void 0 : _a.session.provider.name}. Please change it in your app config and try again.\n`);
|
|
120
127
|
}
|
|
121
128
|
spinner.fail(`Failed to create App Store app ${chalk_1.default.dim(name)}`);
|
|
122
129
|
error.message +=
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DistributionCertificate, ProvisioningProfile, ProvisioningProfileStoreInfo } from './Credentials.types';
|
|
2
|
-
import { AuthCtx } from './
|
|
2
|
+
import { AuthCtx } from './authenticateTypes';
|
|
3
3
|
export declare enum ProfileClass {
|
|
4
4
|
Adhoc = "ad_hoc",
|
|
5
5
|
General = "general"
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.revokeProvisioningProfileAsync = exports.createProvisioningProfileAsync = exports.listProvisioningProfilesAsync = exports.useExistingProvisioningProfileAsync = exports.ProfileClass = void 0;
|
|
4
4
|
const apple_utils_1 = require("@expo/apple-utils");
|
|
5
5
|
const ora_1 = require("../../../ora");
|
|
6
|
+
const authType_1 = require("../utils/authType");
|
|
6
7
|
const p12Certificate_1 = require("../utils/p12Certificate");
|
|
7
8
|
const authenticate_1 = require("./authenticate");
|
|
8
9
|
const bundleId_1 = require("./bundleId");
|
|
@@ -47,6 +48,11 @@ async function addCertificateToProfileAsync(context, { serialNumber, profileId,
|
|
|
47
48
|
}
|
|
48
49
|
// Assign the new certificate
|
|
49
50
|
profile.attributes.certificates = [cert];
|
|
51
|
+
// Experimentally regenerate the provisioning profile using App Store Connect API.
|
|
52
|
+
if ((0, authType_1.isAppStoreConnectTokenOnlyContext)(profile.context)) {
|
|
53
|
+
return await profile.regenerateManuallyAsync();
|
|
54
|
+
}
|
|
55
|
+
// This method does not support App Store Connect API.
|
|
50
56
|
return await profile.regenerateAsync();
|
|
51
57
|
}
|
|
52
58
|
async function useExistingProvisioningProfileAsync(authCtx, bundleIdentifier, provisioningProfile, distCert) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ProvisioningProfile } from './Credentials.types';
|
|
2
|
-
import { AuthCtx } from './
|
|
2
|
+
import { AuthCtx } from './authenticateTypes';
|
|
3
3
|
export declare function createOrReuseAdhocProvisioningProfileAsync(authCtx: AuthCtx, udids: string[], bundleIdentifier: string, distCertSerialNumber: string): Promise<ProvisioningProfile>;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createOrReuseAdhocProvisioningProfileAsync = void 0;
|
|
4
4
|
const apple_utils_1 = require("@expo/apple-utils");
|
|
5
5
|
const ora_1 = require("../../../ora");
|
|
6
|
+
const authType_1 = require("../utils/authType");
|
|
6
7
|
const authenticate_1 = require("./authenticate");
|
|
7
8
|
const bundleId_1 = require("./bundleId");
|
|
8
9
|
const distributionCertificate_1 = require("./distributionCertificate");
|
|
@@ -56,7 +57,14 @@ async function findProfileByBundleIdAsync(context, bundleId, certSerialNumber) {
|
|
|
56
57
|
}
|
|
57
58
|
const profile = expoProfiles.sort(sortByExpiration)[expoProfiles.length - 1];
|
|
58
59
|
profile.attributes.certificates = [distributionCertificate];
|
|
59
|
-
return {
|
|
60
|
+
return {
|
|
61
|
+
profile: (0, authType_1.isAppStoreConnectTokenOnlyContext)(profile.context)
|
|
62
|
+
? // Experimentally regenerate the provisioning profile using App Store Connect API.
|
|
63
|
+
await profile.regenerateManuallyAsync()
|
|
64
|
+
: // This method does not support App Store Connect API.
|
|
65
|
+
await profile.regenerateAsync(),
|
|
66
|
+
didUpdate: true,
|
|
67
|
+
};
|
|
60
68
|
}
|
|
61
69
|
// there is no valid provisioning profile available
|
|
62
70
|
return { profile: null, didUpdate: false };
|
|
@@ -110,7 +118,14 @@ async function manageAdHocProfilesAsync(context, { udids, bundleId, certSerialNu
|
|
|
110
118
|
}
|
|
111
119
|
// We need to add new devices to the list and create a new provisioning profile.
|
|
112
120
|
existingProfile.attributes.devices = devices;
|
|
113
|
-
|
|
121
|
+
if ((0, authType_1.isAppStoreConnectTokenOnlyContext)(existingProfile.context)) {
|
|
122
|
+
// Experimentally regenerate the provisioning profile using App Store Connect API.
|
|
123
|
+
await existingProfile.regenerateManuallyAsync();
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
// This method does not support App Store Connect API.
|
|
127
|
+
await existingProfile.regenerateAsync();
|
|
128
|
+
}
|
|
114
129
|
const updatedProfile = (await findProfileByBundleIdAsync(context, bundleId, certSerialNumber))
|
|
115
130
|
.profile;
|
|
116
131
|
if (!updatedProfile) {
|