eas-cli 24.13.0 → 25.0.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 +185 -166
- package/build/billing/resolveAccount.js +38 -14
- package/build/build/utils/url.d.ts +1 -0
- package/build/build/utils/url.js +4 -0
- package/build/commandUtils/EasCommand.js +11 -5
- package/build/commandUtils/context/contextUtils/getProjectIdAsync.js +1 -1
- package/build/commandUtils/new/configs.d.ts +2 -2
- package/build/commandUtils/new/configs.js +8 -20
- package/build/commands/account/view.d.ts +6 -1
- package/build/commands/account/view.js +38 -8
- package/build/commands/channel/protect.js +1 -1
- package/build/commands/channel/unprotect.js +1 -1
- package/build/commands/simulator/get.js +5 -2
- package/build/commands/simulator/index.d.ts +1 -0
- package/build/commands/simulator/index.js +10 -2
- package/build/commands/workflow/insights/maestro.d.ts +2 -0
- package/build/commands/workflow/insights/maestro.js +6 -0
- package/build/easSelect.d.ts +30 -0
- package/build/easSelect.js +57 -0
- package/build/graphql/generated.d.ts +344 -949
- package/build/graphql/generated.js +5 -74
- package/build/graphql/queries/AccountQuery.js +2 -1
- package/build/graphql/queries/DeviceRunSessionQuery.js +1 -0
- package/build/graphql/queries/WorkflowDeviceTestCaseInsightsQuery.js +11 -0
- package/build/graphql/types/Account.js +3 -2
- package/build/project/accountSelection.d.ts +2 -3
- package/build/project/accountSelection.js +12 -15
- package/build/project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync.js +4 -4
- package/build/project/projectInitialization.js +7 -6
- package/build/prompts.d.ts +2 -1
- package/build/prompts.js +2 -0
- package/build/simulator/utils.d.ts +8 -5
- package/build/simulator/utils.js +56 -20
- package/build/user/User.d.ts +17 -1
- package/build/user/User.js +37 -2
- package/build/user/roles.d.ts +6 -0
- package/build/user/roles.js +35 -0
- package/build/workflow/insights/formatMaestroInsights.d.ts +9 -2
- package/build/workflow/insights/formatMaestroInsights.js +24 -0
- package/build/workflow/insights/maestroFilters.d.ts +5 -3
- package/build/workflow/insights/maestroFilters.js +5 -0
- package/oclif.manifest.json +439 -422
- package/package.json +6 -6
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveBillingAccountAsync = resolveBillingAccountAsync;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
4
6
|
const generated_1 = require("../graphql/generated");
|
|
5
7
|
const AccountQuery_1 = require("../graphql/queries/AccountQuery");
|
|
6
8
|
const plans_1 = require("./plans");
|
|
@@ -8,12 +10,36 @@ const prompts_1 = require("../prompts");
|
|
|
8
10
|
function billingPermissionError(accountName) {
|
|
9
11
|
return new Error(`You must be an Owner or Admin of account "${accountName}" to manage billing.`);
|
|
10
12
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* @param accounts which accounts the viewer is an Owner or Admin of, e.g. `account "name"`
|
|
15
|
+
*/
|
|
16
|
+
function scopedCredentialBillingPermissionError(accounts) {
|
|
17
|
+
return new Error(`You are an Owner or Admin of ${accounts}, but the permissions granted during authentication do not allow you to manage billing. Run ${chalk_1.default.bold('eas whoami')} to check your permission grant, and ${chalk_1.default.bold('eas login')} to change it.`);
|
|
18
|
+
}
|
|
19
|
+
function hasBillingPermission(permissions) {
|
|
20
|
+
return permissions.includes(generated_1.Permission.Admin) || permissions.includes(generated_1.Permission.Own);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Whether the viewer can manage billing on the account with the credential used for this command.
|
|
24
|
+
* The scopes of a scoped credential cap `effectivePermissions`.
|
|
25
|
+
*/
|
|
26
|
+
function canManageBilling(account) {
|
|
27
|
+
return hasBillingPermission(account.viewerUserPermission2.effectivePermissions);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Whether the viewer's role on the account allows billing, regardless of the scopes of the
|
|
31
|
+
* credential used for this command.
|
|
32
|
+
*/
|
|
33
|
+
function hasBillingRole(account) {
|
|
34
|
+
return hasBillingPermission(account.viewerUserPermission2.permissions);
|
|
35
|
+
}
|
|
36
|
+
function assertCanManageBilling(account) {
|
|
37
|
+
if (canManageBilling(account)) {
|
|
38
|
+
return;
|
|
14
39
|
}
|
|
15
|
-
|
|
16
|
-
|
|
40
|
+
throw hasBillingRole(account)
|
|
41
|
+
? scopedCredentialBillingPermissionError(`account "${account.name}"`)
|
|
42
|
+
: billingPermissionError(account.name);
|
|
17
43
|
}
|
|
18
44
|
async function getAccountWithSubscriptionAsync(graphqlClient, account) {
|
|
19
45
|
const subscription = await AccountQuery_1.AccountQuery.getSubscriptionAsync(graphqlClient, account.id);
|
|
@@ -31,23 +57,18 @@ function toAccountChoice(account, disabled) {
|
|
|
31
57
|
async function resolveNamedAccountAsync(graphqlClient, actor, accountName) {
|
|
32
58
|
const ownAccount = actor.accounts.find(account => account.name === accountName);
|
|
33
59
|
if (ownAccount) {
|
|
34
|
-
|
|
35
|
-
throw billingPermissionError(ownAccount.name);
|
|
36
|
-
}
|
|
60
|
+
assertCanManageBilling(ownAccount);
|
|
37
61
|
return ownAccount;
|
|
38
62
|
}
|
|
39
63
|
const account = await AccountQuery_1.AccountQuery.getByNameAsync(graphqlClient, accountName).catch(() => null);
|
|
40
64
|
if (!account) {
|
|
41
65
|
const availableAccounts = actor.accounts
|
|
42
|
-
.filter(
|
|
66
|
+
.filter(canManageBilling)
|
|
43
67
|
.map(candidate => candidate.name)
|
|
44
68
|
.join(', ');
|
|
45
69
|
throw new Error(`Account "${accountName}" not found or you don't have access. Available accounts: ${availableAccounts}`);
|
|
46
70
|
}
|
|
47
|
-
|
|
48
|
-
if (!permissions.includes(generated_1.Permission.Admin) && !permissions.includes(generated_1.Permission.Own)) {
|
|
49
|
-
throw billingPermissionError(account.name);
|
|
50
|
-
}
|
|
71
|
+
assertCanManageBilling(account);
|
|
51
72
|
return account;
|
|
52
73
|
}
|
|
53
74
|
async function resolveBillingAccountAsync({ graphqlClient, actor, accountName, nonInteractive, subscriptionFilter, }) {
|
|
@@ -59,8 +80,11 @@ async function resolveBillingAccountAsync({ graphqlClient, actor, accountName, n
|
|
|
59
80
|
}
|
|
60
81
|
return account;
|
|
61
82
|
}
|
|
62
|
-
const billingAccounts = actor.accounts.filter(
|
|
83
|
+
const billingAccounts = actor.accounts.filter(canManageBilling);
|
|
63
84
|
if (billingAccounts.length === 0) {
|
|
85
|
+
if (actor.accounts.some(hasBillingRole)) {
|
|
86
|
+
throw scopedCredentialBillingPermissionError('at least one account');
|
|
87
|
+
}
|
|
64
88
|
throw new Error('You must be an Owner or Admin of at least one account to manage billing.');
|
|
65
89
|
}
|
|
66
90
|
const accounts = await Promise.all(billingAccounts.map(account => getAccountWithSubscriptionAsync(graphqlClient, account)));
|
|
@@ -8,6 +8,7 @@ export declare function getUpdateGroupUrl(accountName: string, projectName: stri
|
|
|
8
8
|
export declare function getSubmissionUrl(accountName: string, projectName: string, submissionId: string): string;
|
|
9
9
|
export declare function getWorkflowRunUrl(accountName: string, projectName: string, workflowRunId: string): string;
|
|
10
10
|
export declare function getDeviceRunSessionUrl(accountName: string, projectName: string, deviceRunSessionId: string): string;
|
|
11
|
+
export declare function getDeviceRunSessionPreviewUrl(accountName: string, projectName: string, deviceRunSessionId: string): string;
|
|
11
12
|
/**
|
|
12
13
|
* @deprecated Links to the raw job-run page; prefer a higher-level URL (e.g. the workflow run
|
|
13
14
|
* or the feature-specific dashboard) that gives users more context. Use this only for internal
|
package/build/build/utils/url.js
CHANGED
|
@@ -9,6 +9,7 @@ exports.getUpdateGroupUrl = getUpdateGroupUrl;
|
|
|
9
9
|
exports.getSubmissionUrl = getSubmissionUrl;
|
|
10
10
|
exports.getWorkflowRunUrl = getWorkflowRunUrl;
|
|
11
11
|
exports.getDeviceRunSessionUrl = getDeviceRunSessionUrl;
|
|
12
|
+
exports.getDeviceRunSessionPreviewUrl = getDeviceRunSessionPreviewUrl;
|
|
12
13
|
exports.getBareJobRunUrl = getBareJobRunUrl;
|
|
13
14
|
exports.getProjectGitHubSettingsUrl = getProjectGitHubSettingsUrl;
|
|
14
15
|
exports.getHostingDeploymentsUrl = getHostingDeploymentsUrl;
|
|
@@ -50,6 +51,9 @@ function getWorkflowRunUrl(accountName, projectName, workflowRunId) {
|
|
|
50
51
|
function getDeviceRunSessionUrl(accountName, projectName, deviceRunSessionId) {
|
|
51
52
|
return new URL(`/accounts/${encodeURIComponent(accountName)}/projects/${encodeURIComponent(projectName)}/simulator-sessions/${encodeURIComponent(deviceRunSessionId)}`, (0, api_1.getExpoWebsiteBaseUrl)()).toString();
|
|
52
53
|
}
|
|
54
|
+
function getDeviceRunSessionPreviewUrl(accountName, projectName, deviceRunSessionId) {
|
|
55
|
+
return `${getDeviceRunSessionUrl(accountName, projectName, deviceRunSessionId)}/preview`;
|
|
56
|
+
}
|
|
53
57
|
/**
|
|
54
58
|
* @deprecated Links to the raw job-run page; prefer a higher-level URL (e.g. the workflow run
|
|
55
59
|
* or the feature-specific dashboard) that gives users more context. Use this only for internal
|
|
@@ -197,12 +197,18 @@ class EasCommand extends core_1.Command {
|
|
|
197
197
|
: '';
|
|
198
198
|
const defaultMsg = `${messageLine}${requestIdLine}`;
|
|
199
199
|
if (graphQLError.extensions?.errorCode === 'UNAUTHORIZED_ERROR') {
|
|
200
|
-
if (defaultMsg.includes('ScopedAccountActorViewerContext')
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
200
|
+
if (defaultMsg.includes('ScopedAccountActorViewerContext')) {
|
|
201
|
+
if (process.env.EAS_BUILD) {
|
|
202
|
+
// We're within an EAS job, authenticated with our minted scoped account actor access token.
|
|
203
|
+
// There's a chance that this operation should be allowed, so we want to provide a way for the user to report this to us.
|
|
204
|
+
return `${chalk_1.default.bold(`You don't have the required permissions to perform this operation.`)}\n\nWe are in the process of migrating EAS to a more granular permissioning system. If you believe what you're doing is a legitimate operation you should be able to perform, report this to us at ${(0, log_1.link)('https://expo.dev/contact')}\n\nOriginal error message: ${defaultMsg}`;
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
// We're not in EAS, authenticated with a scoped account actor access token.
|
|
208
|
+
return `${chalk_1.default.bold(`You don't have the required permissions to perform this operation.`)}\n\nThis can sometimes happen if you are logged in as incorrect user or if the permissions granted during authentication are insufficient to perform the operation.\nRun ${chalk_1.default.bold('eas whoami')} to check the user you are logged in as and your permission grant.\nRun ${chalk_1.default.bold('eas login')} to change the user or permission grant.\n\nOriginal error message: ${defaultMsg}`;
|
|
209
|
+
}
|
|
204
210
|
}
|
|
205
|
-
return `${chalk_1.default.bold(`You don't have the required permissions to perform this operation.`)}\n\nThis can sometimes happen if you are logged in as incorrect user.\nRun ${chalk_1.default.bold('eas whoami')} to check the
|
|
211
|
+
return `${chalk_1.default.bold(`You don't have the required permissions to perform this operation.`)}\n\nThis can sometimes happen if you are logged in as incorrect user.\nRun ${chalk_1.default.bold('eas whoami')} to check the user you are logged in as.\nRun ${chalk_1.default.bold('eas login')} to change users.\n\nOriginal error message: ${defaultMsg}`;
|
|
206
212
|
}
|
|
207
213
|
return defaultMsg;
|
|
208
214
|
})
|
|
@@ -151,7 +151,7 @@ async function chooseAccountNameForEASProjectAsync(exp, actor, options) {
|
|
|
151
151
|
if (options.nonInteractive) {
|
|
152
152
|
throw (0, projectNotConfiguredError_1.getUnconfiguredProjectError)({ actor });
|
|
153
153
|
}
|
|
154
|
-
const choices = (0, accountSelection_1.getAccountChoices)(actor
|
|
154
|
+
const choices = (0, accountSelection_1.getAccountChoices)(actor);
|
|
155
155
|
return (await (0, prompts_1.promptAsync)({
|
|
156
156
|
type: 'select',
|
|
157
157
|
name: 'account',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SelectChoice } from '../../prompts';
|
|
2
2
|
import { Actor } from '../../user/User';
|
|
3
3
|
import { ExpoGraphqlClient } from '../context/contextUtils/createGraphqlClient';
|
|
4
4
|
export declare function generateProjectConfigAsync(pathArg: string | undefined, options: {
|
|
@@ -9,7 +9,7 @@ export declare function generateProjectConfigAsync(pathArg: string | undefined,
|
|
|
9
9
|
projectDirectory: string;
|
|
10
10
|
}>;
|
|
11
11
|
export declare function promptForProjectAccountAsync(actor: Actor): Promise<string>;
|
|
12
|
-
export declare function getAccountChoices(actor: Actor
|
|
12
|
+
export declare function getAccountChoices(actor: Actor): SelectChoice[];
|
|
13
13
|
/**
|
|
14
14
|
* Finds an available project name that doesn't conflict with either:
|
|
15
15
|
* Local filesystem (directory already exists)
|
|
@@ -9,10 +9,10 @@ const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
|
9
9
|
const nanoid_1 = require("nanoid");
|
|
10
10
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
11
11
|
const utils_1 = require("./utils");
|
|
12
|
-
const generated_1 = require("../../graphql/generated");
|
|
13
12
|
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
14
13
|
const fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync_1 = require("../../project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync");
|
|
15
14
|
const prompts_1 = require("../../prompts");
|
|
15
|
+
const User_1 = require("../../user/User");
|
|
16
16
|
function validateProjectPath(resolvedPath) {
|
|
17
17
|
const normalizedPath = path_1.default.normalize(resolvedPath);
|
|
18
18
|
// Check for path traversal attempts
|
|
@@ -52,34 +52,25 @@ async function generateProjectConfigAsync(pathArg, options) {
|
|
|
52
52
|
projectDirectory,
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
function getAccountPermissionsMap(actor) {
|
|
56
|
-
const permissionsMap = new Map();
|
|
57
|
-
for (const account of actor.accounts) {
|
|
58
|
-
const hasPermission = account.viewerUserPermission.role !== generated_1.Role.ViewOnly;
|
|
59
|
-
permissionsMap.set(account.name, hasPermission);
|
|
60
|
-
}
|
|
61
|
-
return permissionsMap;
|
|
62
|
-
}
|
|
63
55
|
async function promptForProjectAccountAsync(actor) {
|
|
64
|
-
const permissionsMap = getAccountPermissionsMap(actor);
|
|
65
56
|
// If only one account, use it (if has permissions)
|
|
66
57
|
if (actor.accounts.length === 1) {
|
|
67
58
|
const account = actor.accounts[0];
|
|
68
|
-
|
|
59
|
+
const reason = (0, User_1.getCannotCreateProjectsOnAccountReason)(account);
|
|
60
|
+
if (!reason) {
|
|
69
61
|
return account.name;
|
|
70
62
|
}
|
|
71
|
-
throw new Error(`You
|
|
63
|
+
throw new Error(`You can't create projects on your only available account (${account.name}). ${reason}`);
|
|
72
64
|
}
|
|
73
65
|
// Multiple accounts - prompt user to select one with permissions
|
|
74
66
|
return (await (0, prompts_1.promptAsync)({
|
|
75
67
|
type: 'select',
|
|
76
68
|
name: 'account',
|
|
77
69
|
message: 'Which account should own this project?',
|
|
78
|
-
choices: getAccountChoices(actor
|
|
70
|
+
choices: getAccountChoices(actor),
|
|
79
71
|
})).account.name;
|
|
80
72
|
}
|
|
81
|
-
function getAccountChoices(actor
|
|
82
|
-
const permissions = permissionsMap ?? getAccountPermissionsMap(actor);
|
|
73
|
+
function getAccountChoices(actor) {
|
|
83
74
|
const sortedAccounts = [...actor.accounts].sort((a, _b) => (a.ownerUserActor ? 1 : -1));
|
|
84
75
|
return sortedAccounts.map(account => {
|
|
85
76
|
const isPersonalAccount = !!account.ownerUserActor && account.ownerUserActor.id === actor.id;
|
|
@@ -89,14 +80,11 @@ function getAccountChoices(actor, permissionsMap) {
|
|
|
89
80
|
: isTeamAccount
|
|
90
81
|
? `${account.name} (Limited - Team Account)`
|
|
91
82
|
: account.name;
|
|
92
|
-
const
|
|
83
|
+
const disabledReason = (0, User_1.getCannotCreateProjectsOnAccountReason)(account);
|
|
93
84
|
return {
|
|
94
85
|
title: accountDisplayName,
|
|
95
86
|
value: { name: account.name },
|
|
96
|
-
...(
|
|
97
|
-
disabled: true,
|
|
98
|
-
description: 'You do not have the required permissions to create projects on this account.',
|
|
99
|
-
}),
|
|
87
|
+
...(disabledReason && { disabled: true, disabledReason }),
|
|
100
88
|
};
|
|
101
89
|
});
|
|
102
90
|
}
|
|
@@ -6,6 +6,11 @@ export default class AccountView extends EasCommand {
|
|
|
6
6
|
maybeLoggedIn: import("../../commandUtils/context/MaybeLoggedInContextField").default;
|
|
7
7
|
};
|
|
8
8
|
runAsync(): Promise<void>;
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Whether the scopes of the credential used for this command remove any of the permissions that
|
|
11
|
+
* the viewer's role grants on the account.
|
|
12
|
+
*/
|
|
13
|
+
private static isLimitedByCredentials;
|
|
14
|
+
private static getLabelForPermissions;
|
|
10
15
|
private static getLabelForRole;
|
|
11
16
|
}
|
|
@@ -6,6 +6,7 @@ const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasComm
|
|
|
6
6
|
const generated_1 = require("../../graphql/generated");
|
|
7
7
|
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
8
8
|
const User_1 = require("../../user/User");
|
|
9
|
+
const roles_1 = require("../../user/roles");
|
|
9
10
|
class AccountView extends EasCommand_1.default {
|
|
10
11
|
static description = 'show the username you are logged in as';
|
|
11
12
|
static aliases = ['whoami'];
|
|
@@ -24,15 +25,28 @@ class AccountView extends EasCommand_1.default {
|
|
|
24
25
|
log_1.default.log(actor.email);
|
|
25
26
|
}
|
|
26
27
|
// personal account is included, only show if more accounts that personal account
|
|
27
|
-
// but do show personal account in list if there are more
|
|
28
|
+
// but do show personal account in list if there are more, or if the credentials used for
|
|
29
|
+
// this command limit the permissions on it
|
|
28
30
|
const accountExcludingPersonalAccount = actor.accounts.filter(account => !('username' in actor) || account.name !== actor.username);
|
|
29
|
-
|
|
31
|
+
const hasLimitedAccount = actor.accounts.some(AccountView.isLimitedByCredentials);
|
|
32
|
+
if (accountExcludingPersonalAccount.length > 0 || hasLimitedAccount) {
|
|
30
33
|
log_1.default.newLine();
|
|
31
34
|
log_1.default.log('Accounts:');
|
|
32
35
|
actor.accounts.forEach(account => {
|
|
33
|
-
const
|
|
34
|
-
|
|
36
|
+
const { permissions, effectivePermissions } = account.viewerUserPermission2;
|
|
37
|
+
const roleLabel = AccountView.getLabelForPermissions(permissions);
|
|
38
|
+
if (AccountView.isLimitedByCredentials(account)) {
|
|
39
|
+
const effectiveRoleLabel = AccountView.getLabelForPermissions(effectivePermissions);
|
|
40
|
+
log_1.default.log(`• ${account.name} (Role: ${roleLabel}, ${chalk_1.default.yellow(`limited to ${effectiveRoleLabel} by the current credentials`)})`);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
log_1.default.log(`• ${account.name} (Role: ${roleLabel})`);
|
|
44
|
+
}
|
|
35
45
|
});
|
|
46
|
+
if (hasLimitedAccount) {
|
|
47
|
+
log_1.default.newLine();
|
|
48
|
+
log_1.default.log(`The permissions granted during authentication limit your access to some accounts. Run ${chalk_1.default.bold('eas login')} to change the permission grant.`);
|
|
49
|
+
}
|
|
36
50
|
}
|
|
37
51
|
}
|
|
38
52
|
else {
|
|
@@ -40,11 +54,25 @@ class AccountView extends EasCommand_1.default {
|
|
|
40
54
|
process.exit(1);
|
|
41
55
|
}
|
|
42
56
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Whether the scopes of the credential used for this command remove any of the permissions that
|
|
59
|
+
* the viewer's role grants on the account.
|
|
60
|
+
*/
|
|
61
|
+
static isLimitedByCredentials(account) {
|
|
62
|
+
const { permissions, effectivePermissions } = account.viewerUserPermission2;
|
|
63
|
+
return permissions.some(permission => !effectivePermissions.includes(permission));
|
|
64
|
+
}
|
|
65
|
+
static getLabelForPermissions(permissions) {
|
|
66
|
+
const role = (0, roles_1.getRoleForPermissions)(permissions);
|
|
67
|
+
if (role !== generated_1.Role.Custom) {
|
|
68
|
+
return AccountView.getLabelForRole(role);
|
|
69
|
+
}
|
|
70
|
+
if (permissions.length === 0) {
|
|
71
|
+
return 'No permissions';
|
|
46
72
|
}
|
|
47
|
-
return
|
|
73
|
+
return `Custom: ${permissions
|
|
74
|
+
.map(permission => permission.toLowerCase().replaceAll('_', ' '))
|
|
75
|
+
.join(', ')}`;
|
|
48
76
|
}
|
|
49
77
|
static getLabelForRole(role) {
|
|
50
78
|
switch (role) {
|
|
@@ -56,6 +84,8 @@ class AccountView extends EasCommand_1.default {
|
|
|
56
84
|
return 'Developer';
|
|
57
85
|
case generated_1.Role.ReleaseManager:
|
|
58
86
|
return 'Release Manager';
|
|
87
|
+
case generated_1.Role.Runner:
|
|
88
|
+
return 'Runner';
|
|
59
89
|
case generated_1.Role.ViewOnly:
|
|
60
90
|
return 'Viewer';
|
|
61
91
|
case generated_1.Role.Custom:
|
|
@@ -11,7 +11,7 @@ const ChannelQuery_1 = require("../../graphql/queries/ChannelQuery");
|
|
|
11
11
|
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
12
12
|
const json_1 = require("../../utils/json");
|
|
13
13
|
class ChannelProtect extends EasCommand_1.default {
|
|
14
|
-
static description = 'protect a channel so only
|
|
14
|
+
static description = 'protect a channel so only Release Managers, Admins, and Owners can publish to it';
|
|
15
15
|
static args = {
|
|
16
16
|
name: core_1.Args.string({
|
|
17
17
|
required: false,
|
|
@@ -12,7 +12,7 @@ const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
|
12
12
|
const prompts_1 = require("../../prompts");
|
|
13
13
|
const json_1 = require("../../utils/json");
|
|
14
14
|
class ChannelUnprotect extends EasCommand_1.default {
|
|
15
|
-
static description = "remove a channel's
|
|
15
|
+
static description = "remove a channel's protected publishing restriction";
|
|
16
16
|
static args = {
|
|
17
17
|
name: core_1.Args.string({
|
|
18
18
|
required: false,
|
|
@@ -16,7 +16,7 @@ const formatFields_1 = tslib_1.__importDefault(require("../../utils/formatFields
|
|
|
16
16
|
const json_1 = require("../../utils/json");
|
|
17
17
|
class SimulatorGet extends EasCommand_1.default {
|
|
18
18
|
static aliases = ['sim:get'];
|
|
19
|
-
static description =
|
|
19
|
+
static description = "[EXPERIMENTAL] get info about a remote simulator session on EAS by its simulator session ID. Preview links follow the session's saved sharing preference.";
|
|
20
20
|
static flags = {
|
|
21
21
|
id: core_1.Flags.string({
|
|
22
22
|
description: `Simulator session ID. Defaults to ${env_1.SIMULATOR_DOTENV_FILE_NAME}.`,
|
|
@@ -52,6 +52,7 @@ class SimulatorGet extends EasCommand_1.default {
|
|
|
52
52
|
throw err;
|
|
53
53
|
}
|
|
54
54
|
const deviceRunSessionUrl = (0, url_1.getDeviceRunSessionUrl)(session.app.ownerAccount.name, session.app.slug, session.id);
|
|
55
|
+
const deviceRunSessionPreviewUrl = (0, url_1.getDeviceRunSessionPreviewUrl)(session.app.ownerAccount.name, session.app.slug, session.id);
|
|
55
56
|
if (jsonFlag) {
|
|
56
57
|
(0, json_1.printJsonOnlyOutput)({
|
|
57
58
|
id: session.id,
|
|
@@ -66,7 +67,7 @@ class SimulatorGet extends EasCommand_1.default {
|
|
|
66
67
|
updatedAt: session.updatedAt,
|
|
67
68
|
deviceRunSessionUrl,
|
|
68
69
|
remoteConfig: session.remoteConfig
|
|
69
|
-
? (0, utils_1.sanitizeRemoteConfigForJson)(session.remoteConfig)
|
|
70
|
+
? (0, utils_1.sanitizeRemoteConfigForJson)(session.remoteConfig, deviceRunSessionPreviewUrl, session.publicPreview)
|
|
70
71
|
: session.remoteConfig,
|
|
71
72
|
artifacts: session.artifacts,
|
|
72
73
|
});
|
|
@@ -79,6 +80,8 @@ class SimulatorGet extends EasCommand_1.default {
|
|
|
79
80
|
if (session.remoteConfig) {
|
|
80
81
|
log_1.default.log((0, utils_1.formatRemoteSessionInstructions)(session.remoteConfig, 'env', {
|
|
81
82
|
sessionUrl: deviceRunSessionUrl,
|
|
83
|
+
privatePreviewUrl: deviceRunSessionPreviewUrl,
|
|
84
|
+
publicLink: session.publicPreview,
|
|
82
85
|
platform: session.platform,
|
|
83
86
|
}));
|
|
84
87
|
}
|
|
@@ -28,6 +28,7 @@ export default class Simulator extends EasCommand {
|
|
|
28
28
|
'egress-allow': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
29
29
|
force: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
30
30
|
'out-config-type': import("@oclif/core/lib/interfaces").OptionFlag<"env" | "dotenv", import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
31
|
+
'public-link': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
31
32
|
};
|
|
32
33
|
static contextDefinition: {
|
|
33
34
|
analytics: import("../../commandUtils/context/AnalyticsContextField").default;
|
|
@@ -39,7 +39,7 @@ const APP_PLATFORM_BY_FLAG_VALUE = {
|
|
|
39
39
|
class Simulator extends EasCommand_1.default {
|
|
40
40
|
static aliases = ['simulator:start', 'sim:start'];
|
|
41
41
|
static hiddenAliases = ['sim'];
|
|
42
|
-
static description = '[EXPERIMENTAL] start a remote simulator session on EAS and get instructions to connect to it';
|
|
42
|
+
static description = '[EXPERIMENTAL] start a remote simulator session on EAS and get instructions to connect to it. The default browser preview link requires sign-in.';
|
|
43
43
|
static flags = {
|
|
44
44
|
platform: core_1.Flags.option({
|
|
45
45
|
char: 'p',
|
|
@@ -130,6 +130,9 @@ class Simulator extends EasCommand_1.default {
|
|
|
130
130
|
options: Object.values(OUT_CONFIG_TYPE_VALUES),
|
|
131
131
|
default: OUT_CONFIG_TYPE_VALUES.Dotenv,
|
|
132
132
|
})(),
|
|
133
|
+
'public-link': core_1.Flags.boolean({
|
|
134
|
+
description: 'Enable the simulator preview Share button and print a shareable link containing an access token. Anyone with the link can control the simulator. With --json, include previewApiUrl and its token for API clients when available.',
|
|
135
|
+
}),
|
|
133
136
|
...flags_1.EasNonInteractiveAndJsonFlags,
|
|
134
137
|
};
|
|
135
138
|
static contextDefinition = {
|
|
@@ -221,6 +224,7 @@ class Simulator extends EasCommand_1.default {
|
|
|
221
224
|
const createSpinner = (0, ora_1.ora)('🚀 Creating simulator session').start();
|
|
222
225
|
let deviceRunSessionId;
|
|
223
226
|
let deviceRunSessionUrl;
|
|
227
|
+
let deviceRunSessionPreviewUrl;
|
|
224
228
|
let sessionInterrupt;
|
|
225
229
|
try {
|
|
226
230
|
const agentIdentity = await agentIdentityInputAsync();
|
|
@@ -240,6 +244,7 @@ class Simulator extends EasCommand_1.default {
|
|
|
240
244
|
...(tags?.length ? { tags } : {}),
|
|
241
245
|
platform,
|
|
242
246
|
type: utils_1.DEVICE_RUN_SESSION_TYPE_BY_FLAG_VALUE[flags.type],
|
|
247
|
+
publicPreview: flags['public-link'] ?? false,
|
|
243
248
|
packageVersion: flags['package-version'],
|
|
244
249
|
networkCapture: flags['network-capture'],
|
|
245
250
|
...(networkCaptureFields.length ? { networkCaptureFields } : {}),
|
|
@@ -266,6 +271,7 @@ class Simulator extends EasCommand_1.default {
|
|
|
266
271
|
deviceRunSessionId = session.id;
|
|
267
272
|
(0, nullthrows_1.default)(session.turtleJobRun?.id, 'Expected simulator session to start');
|
|
268
273
|
deviceRunSessionUrl = (0, url_1.getDeviceRunSessionUrl)(session.app.ownerAccount.name, session.app.slug, deviceRunSessionId);
|
|
274
|
+
deviceRunSessionPreviewUrl = (0, url_1.getDeviceRunSessionPreviewUrl)(session.app.ownerAccount.name, session.app.slug, deviceRunSessionId);
|
|
269
275
|
sessionInterrupt = registerSessionInterrupt(deviceRunSessionId);
|
|
270
276
|
const simulatorEnvWritten = !jsonFlag && flags['out-config-type'] === OUT_CONFIG_TYPE_VALUES.Dotenv
|
|
271
277
|
? await writeSimulatorEnvSafelyAsync(projectDir, {
|
|
@@ -368,7 +374,7 @@ class Simulator extends EasCommand_1.default {
|
|
|
368
374
|
name,
|
|
369
375
|
type: flags.type,
|
|
370
376
|
deviceRunSessionUrl,
|
|
371
|
-
remoteConfig: (0, utils_1.sanitizeRemoteConfigForJson)(remoteConfig),
|
|
377
|
+
remoteConfig: (0, utils_1.sanitizeRemoteConfigForJson)(remoteConfig, deviceRunSessionPreviewUrl, flags['public-link']),
|
|
372
378
|
});
|
|
373
379
|
return;
|
|
374
380
|
}
|
|
@@ -377,6 +383,8 @@ class Simulator extends EasCommand_1.default {
|
|
|
377
383
|
egressAllow,
|
|
378
384
|
egressClientRunsInline: !nonInteractive,
|
|
379
385
|
sessionUrl: deviceRunSessionUrl,
|
|
386
|
+
privatePreviewUrl: deviceRunSessionPreviewUrl,
|
|
387
|
+
publicLink: flags['public-link'],
|
|
380
388
|
platform,
|
|
381
389
|
}));
|
|
382
390
|
log_1.default.newLine();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Platform } from '@expo/eas-build-job';
|
|
1
2
|
import EasCommand from '../../../commandUtils/EasCommand';
|
|
2
3
|
export default class WorkflowInsightsMaestro extends EasCommand {
|
|
3
4
|
static description: string;
|
|
@@ -9,6 +10,7 @@ export default class WorkflowInsightsMaestro extends EasCommand {
|
|
|
9
10
|
days: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
11
|
start: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
12
|
end: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
platform: import("@oclif/core/lib/interfaces").OptionFlag<Platform[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
14
|
status: import("@oclif/core/lib/interfaces").OptionFlag<("FAILED" | "PASSED" | "FLAKY")[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
15
|
tag: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
16
|
search: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
+
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
4
5
|
const core_1 = require("@oclif/core");
|
|
5
6
|
const EasCommand_1 = tslib_1.__importDefault(require("../../../commandUtils/EasCommand"));
|
|
6
7
|
const flags_1 = require("../../../commandUtils/flags");
|
|
@@ -24,6 +25,11 @@ class WorkflowInsightsMaestro extends EasCommand_1.default {
|
|
|
24
25
|
static description = "display Maestro test insights for a time range: pass and flake rates, per-flow stats, and a single flow's history";
|
|
25
26
|
static flags = {
|
|
26
27
|
...filters_1.WorkflowsInsightsSharedFilterFlags,
|
|
28
|
+
platform: core_1.Flags.option({
|
|
29
|
+
description: 'Only include flow runs on this platform (can be specified multiple times).',
|
|
30
|
+
options: [eas_build_job_1.Platform.IOS, eas_build_job_1.Platform.ANDROID],
|
|
31
|
+
multiple: true,
|
|
32
|
+
})(),
|
|
27
33
|
status: core_1.Flags.option({
|
|
28
34
|
description: 'Only include flow runs with this status (can be specified multiple times). PASSED means passed on the first attempt.',
|
|
29
35
|
options: maestroFilters_1.MAESTRO_STATUS_OPTIONS,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Choice, PromptObject } from 'prompts';
|
|
2
|
+
import { SelectPrompt } from 'prompts/lib/elements';
|
|
3
|
+
export type SelectChoice = Choice & {
|
|
4
|
+
/**
|
|
5
|
+
* Shown next to the prompt message while this choice is highlighted and disabled, in place of the
|
|
6
|
+
* prompt's `warn`. prompts never shows the description of a disabled choice.
|
|
7
|
+
*/
|
|
8
|
+
disabledReason?: string;
|
|
9
|
+
};
|
|
10
|
+
type SelectQuestion = Omit<PromptObject, 'choices'> & {
|
|
11
|
+
choices: SelectChoice[];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Customized select prompt.
|
|
15
|
+
*
|
|
16
|
+
* Additional parameters:
|
|
17
|
+
*
|
|
18
|
+
* @param choices[].disabledReason
|
|
19
|
+
* Why the choice is disabled. Use it when the reason differs per choice, because `warn` is the
|
|
20
|
+
* same for every choice.
|
|
21
|
+
**/
|
|
22
|
+
export default class EasSelect extends SelectPrompt {
|
|
23
|
+
private readonly disabledReasons;
|
|
24
|
+
private defaultWarn;
|
|
25
|
+
constructor(opts: SelectQuestion);
|
|
26
|
+
get warn(): string | undefined;
|
|
27
|
+
set warn(value: string | undefined);
|
|
28
|
+
}
|
|
29
|
+
export declare const easSelect: (args: PromptObject) => Promise<any>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.easSelect = void 0;
|
|
4
|
+
const elements_1 = require("prompts/lib/elements");
|
|
5
|
+
/**
|
|
6
|
+
* Customized select prompt.
|
|
7
|
+
*
|
|
8
|
+
* Additional parameters:
|
|
9
|
+
*
|
|
10
|
+
* @param choices[].disabledReason
|
|
11
|
+
* Why the choice is disabled. Use it when the reason differs per choice, because `warn` is the
|
|
12
|
+
* same for every choice.
|
|
13
|
+
**/
|
|
14
|
+
class EasSelect extends elements_1.SelectPrompt {
|
|
15
|
+
disabledReasons;
|
|
16
|
+
constructor(opts) {
|
|
17
|
+
super(opts);
|
|
18
|
+
this.disabledReasons = opts.choices.map(choice => choice.disabledReason);
|
|
19
|
+
// Start on an enabled choice when the initial one is disabled.
|
|
20
|
+
if (this.choices[this.cursor]?.disabled) {
|
|
21
|
+
const firstEnabledIndex = this.choices.findIndex(choice => !choice.disabled);
|
|
22
|
+
if (firstEnabledIndex !== -1) {
|
|
23
|
+
this.moveCursor(firstEnabledIndex);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
// SelectPrompt renders at the end of its constructor, before `disabledReasons` is set, so render
|
|
27
|
+
// again to show the reason of the highlighted choice.
|
|
28
|
+
this.render();
|
|
29
|
+
}
|
|
30
|
+
// SelectPrompt assigns `warn` in its constructor and reads it in render() when the highlighted
|
|
31
|
+
// choice is disabled.
|
|
32
|
+
get warn() {
|
|
33
|
+
const reason = this.disabledReasons?.[this.cursor];
|
|
34
|
+
return this.choices[this.cursor]?.disabled && reason ? `- ${reason}` : this.defaultWarn;
|
|
35
|
+
}
|
|
36
|
+
set warn(value) {
|
|
37
|
+
this.defaultWarn = value;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.default = EasSelect;
|
|
41
|
+
// prompts enables j/k navigation only when `constructor.name` is SelectPrompt or MultiselectPrompt.
|
|
42
|
+
Object.defineProperty(EasSelect, 'name', { value: 'SelectPrompt' });
|
|
43
|
+
const easSelect = (args) => {
|
|
44
|
+
return new Promise((res, rej) => {
|
|
45
|
+
const p = new EasSelect(args);
|
|
46
|
+
p.on('submit', x => {
|
|
47
|
+
res(x);
|
|
48
|
+
});
|
|
49
|
+
p.on('exit', x => {
|
|
50
|
+
res(x);
|
|
51
|
+
});
|
|
52
|
+
p.on('abort', x => {
|
|
53
|
+
rej(x);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
exports.easSelect = easSelect;
|