eas-cli 21.0.0 → 21.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  import { BuildFragment } from '../../graphql/generated';
2
2
  export declare function getProjectDashboardUrl(accountName: string, projectName: string): string;
3
+ export declare function getProjectPageUrl(accountName: string, projectName: string, page?: string | null): string;
3
4
  export declare function getBuildLogsUrl(build: BuildFragment, hash?: string): string;
4
5
  export declare function getArtifactUrl(artifactId: string): string;
5
6
  export declare function getInternalDistributionInstallUrl(build: BuildFragment): string;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getProjectDashboardUrl = getProjectDashboardUrl;
4
+ exports.getProjectPageUrl = getProjectPageUrl;
4
5
  exports.getBuildLogsUrl = getBuildLogsUrl;
5
6
  exports.getArtifactUrl = getArtifactUrl;
6
7
  exports.getInternalDistributionInstallUrl = getInternalDistributionInstallUrl;
@@ -15,7 +16,11 @@ const assert_1 = tslib_1.__importDefault(require("assert"));
15
16
  const api_1 = require("../../api");
16
17
  const generated_1 = require("../../graphql/generated");
17
18
  function getProjectDashboardUrl(accountName, projectName) {
18
- return new URL(`/accounts/${accountName}/projects/${projectName}`, (0, api_1.getExpoWebsiteBaseUrl)()).toString();
19
+ return getProjectPageUrl(accountName, projectName);
20
+ }
21
+ function getProjectPageUrl(accountName, projectName, page) {
22
+ const projectPath = `/accounts/${encodeURIComponent(accountName)}/projects/${encodeURIComponent(projectName)}`;
23
+ return new URL(page ? `${projectPath}/${page}` : projectPath, (0, api_1.getExpoWebsiteBaseUrl)()).toString();
19
24
  }
20
25
  function getBuildLogsUrl(build, hash) {
21
26
  const { project } = build;
@@ -0,0 +1,17 @@
1
+ import EasCommand from '../commandUtils/EasCommand';
2
+ export default class Browse extends EasCommand {
3
+ static description: string;
4
+ static args: {
5
+ page: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
6
+ };
7
+ static flags: {
8
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
+ 'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
+ 'no-browser': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
11
+ };
12
+ static contextDefinition: {
13
+ loggedIn: import("../commandUtils/context/LoggedInContextField").default;
14
+ privateProjectConfig: import("../commandUtils/context/PrivateProjectConfigContextField").PrivateProjectConfigContextField;
15
+ };
16
+ runAsync(): Promise<void>;
17
+ }
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const core_1 = require("@oclif/core");
5
+ const better_opn_1 = tslib_1.__importDefault(require("better-opn"));
6
+ const url_1 = require("../build/utils/url");
7
+ const EasCommand_1 = tslib_1.__importDefault(require("../commandUtils/EasCommand"));
8
+ const flags_1 = require("../commandUtils/flags");
9
+ const log_1 = tslib_1.__importDefault(require("../log"));
10
+ const ora_1 = require("../ora");
11
+ const projectUtils_1 = require("../project/projectUtils");
12
+ const json_1 = require("../utils/json");
13
+ const PROJECT_PAGES = {
14
+ build: 'builds',
15
+ builds: 'builds',
16
+ submit: 'submissions',
17
+ submissions: 'submissions',
18
+ update: 'updates',
19
+ updates: 'updates',
20
+ workflow: 'workflows',
21
+ workflows: 'workflows',
22
+ cicd: 'workflows',
23
+ hosting: 'hosting',
24
+ deployments: 'hosting/deployments',
25
+ credentials: 'credentials',
26
+ env: 'environment-variables',
27
+ insights: 'insights',
28
+ observe: 'observe',
29
+ settings: 'settings',
30
+ };
31
+ class Browse extends EasCommand_1.default {
32
+ static description = 'Transition from the terminal to the web browser to view and interact with your project on https://expo.dev';
33
+ static args = {
34
+ page: core_1.Args.string({
35
+ description: 'Project subpage to open. Defaults to the project dashboard.',
36
+ required: false,
37
+ options: Object.keys(PROJECT_PAGES),
38
+ }),
39
+ };
40
+ static flags = {
41
+ 'no-browser': core_1.Flags.boolean({
42
+ char: 'n',
43
+ description: 'Print the URL instead of opening it in a web browser',
44
+ default: false,
45
+ }),
46
+ ...flags_1.EasNonInteractiveAndJsonFlags,
47
+ };
48
+ static contextDefinition = {
49
+ ...this.ContextOptions.ProjectConfig,
50
+ ...this.ContextOptions.LoggedIn,
51
+ };
52
+ async runAsync() {
53
+ const { args, flags } = await this.parse(Browse);
54
+ const page = args.page ? PROJECT_PAGES[args.page] : null;
55
+ const { json: jsonFlag, nonInteractive } = (0, flags_1.resolveNonInteractiveAndJsonFlags)(flags);
56
+ if (jsonFlag) {
57
+ (0, json_1.enableJsonOutput)();
58
+ }
59
+ const { privateProjectConfig: { projectId, exp }, loggedIn: { graphqlClient }, } = await this.getContextAsync(Browse, {
60
+ nonInteractive,
61
+ withServerSideEnvironment: null,
62
+ });
63
+ const account = await (0, projectUtils_1.getOwnerAccountForProjectIdAsync)(graphqlClient, projectId);
64
+ const url = (0, url_1.getProjectPageUrl)(account.name, exp.slug, page);
65
+ if (jsonFlag) {
66
+ (0, json_1.printJsonOnlyOutput)({ url });
67
+ return;
68
+ }
69
+ if (flags['no-browser']) {
70
+ log_1.default.log(url);
71
+ return;
72
+ }
73
+ const failedMessage = `Unable to open a web browser. Project page is available at: ${url}`;
74
+ const spinner = (0, ora_1.ora)(`Opening ${url}`).start();
75
+ try {
76
+ const opened = await (0, better_opn_1.default)(url);
77
+ if (opened) {
78
+ spinner.succeed(`Opened ${url}`);
79
+ }
80
+ else {
81
+ spinner.fail(failedMessage);
82
+ }
83
+ }
84
+ catch (error) {
85
+ spinner.fail(failedMessage);
86
+ throw error;
87
+ }
88
+ }
89
+ }
90
+ exports.default = Browse;
@@ -11,6 +11,7 @@ export default class WorkerDeploy extends EasCommand {
11
11
  prod: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
12
12
  alias: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
13
13
  id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
14
+ 'dev-domain': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
14
15
  'export-dir': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
15
16
  'dry-run': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
16
17
  'source-maps': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
@@ -26,7 +26,11 @@ const isDirectory = (directoryPath) => node_fs_1.default.promises
26
26
  class WorkerDeploy extends EasCommand_1.default {
27
27
  static description = 'deploy your Expo Router web build and API Routes';
28
28
  static aliases = ['worker:deploy'];
29
- static usage = [(0, chalk_1.default) `deploy {dim [options]}`, `deploy --prod`];
29
+ static usage = [
30
+ (0, chalk_1.default) `deploy {dim [options]}`,
31
+ `deploy --prod`,
32
+ `deploy --non-interactive --dev-domain my-app`,
33
+ ];
30
34
  static state = 'preview';
31
35
  static flags = {
32
36
  prod: core_1.Flags.boolean({
@@ -42,6 +46,10 @@ class WorkerDeploy extends EasCommand_1.default {
42
46
  description: 'Custom unique identifier for the new deployment.',
43
47
  helpValue: 'xyz123',
44
48
  }),
49
+ 'dev-domain': core_1.Flags.string({
50
+ description: `Custom preview URL subdomain to assign to the project on its first deployment, e.g. "my-app" for my-app.${logs_1.EXPO_BASE_DOMAIN}.app. Required with --non-interactive if you want to customize the preview URL.`,
51
+ helpValue: 'name',
52
+ }),
45
53
  'export-dir': core_1.Flags.string({
46
54
  description: 'Directory where the Expo project was exported.',
47
55
  helpValue: 'dir',
@@ -217,6 +225,7 @@ class WorkerDeploy extends EasCommand_1.default {
217
225
  const uploadUrl = await (0, deployment_1.getSignedDeploymentUrlAsync)(graphqlClient, {
218
226
  appId: projectId,
219
227
  deploymentIdentifier: flags.deploymentIdentifier,
228
+ devDomainName: flags.devDomainName,
220
229
  // NOTE(cedric): this function might ask the user for a dev-domain name,
221
230
  // when that happens, no ora spinner should be running.
222
231
  onSetupDevDomain: () => progress.stop(),
@@ -336,12 +345,17 @@ class WorkerDeploy extends EasCommand_1.default {
336
345
  }
337
346
  sanitizeFlags(flags) {
338
347
  const { json, nonInteractive } = (0, flags_1.resolveNonInteractiveAndJsonFlags)(flags);
348
+ const devDomainName = flags['dev-domain']?.trim().toLowerCase();
349
+ if (devDomainName !== undefined) {
350
+ (0, deployment_1.assertValidDevDomainName)(devDomainName);
351
+ }
339
352
  return {
340
353
  nonInteractive,
341
354
  json,
342
355
  isProduction: !!flags.prod,
343
356
  aliasName: flags.alias?.trim().toLowerCase(),
344
357
  deploymentIdentifier: flags.id?.trim(),
358
+ devDomainName,
345
359
  exportDir: flags['export-dir'],
346
360
  environment: flags['environment'],
347
361
  dryRun: flags['dry-run'],
@@ -1,9 +1,6 @@
1
1
  import EasCommand from '../commandUtils/EasCommand';
2
2
  export default class Open extends EasCommand {
3
3
  static description: string;
4
- static contextDefinition: {
5
- loggedIn: import("../commandUtils/context/LoggedInContextField").default;
6
- privateProjectConfig: import("../commandUtils/context/PrivateProjectConfigContextField").PrivateProjectConfigContextField;
7
- };
4
+ static hidden: boolean;
8
5
  runAsync(): Promise<void>;
9
6
  }
@@ -1,41 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const better_opn_1 = tslib_1.__importDefault(require("better-opn"));
5
- const url_1 = require("../build/utils/url");
6
4
  const EasCommand_1 = tslib_1.__importDefault(require("../commandUtils/EasCommand"));
7
- const ora_1 = require("../ora");
8
- const projectUtils_1 = require("../project/projectUtils");
5
+ const browse_1 = tslib_1.__importDefault(require("./browse"));
9
6
  class Open extends EasCommand_1.default {
10
- static description = 'open the project page in a web browser';
11
- static contextDefinition = {
12
- ...this.ContextOptions.ProjectConfig,
13
- ...this.ContextOptions.LoggedIn,
14
- };
7
+ static description = 'open the project page in a web browser (alias of `eas browse`)';
8
+ static hidden = true;
15
9
  async runAsync() {
16
- // this command is interactive by nature (only really run by humans in a terminal)
17
- const { privateProjectConfig: { projectId, exp }, loggedIn: { graphqlClient }, } = await this.getContextAsync(Open, {
18
- nonInteractive: false,
19
- withServerSideEnvironment: null,
20
- });
21
- const account = await (0, projectUtils_1.getOwnerAccountForProjectIdAsync)(graphqlClient, projectId);
22
- const projectName = exp.slug;
23
- const projectDashboardUrl = (0, url_1.getProjectDashboardUrl)(account.name, projectName);
24
- const failedMessage = `Unable to open a web browser. Project page is available at: ${projectDashboardUrl}`;
25
- const spinner = (0, ora_1.ora)(`Opening ${projectDashboardUrl}`).start();
26
- try {
27
- const opened = await (0, better_opn_1.default)(projectDashboardUrl);
28
- if (opened) {
29
- spinner.succeed(`Opened ${projectDashboardUrl}`);
30
- }
31
- else {
32
- spinner.fail(failedMessage);
33
- }
34
- }
35
- catch (error) {
36
- spinner.fail(failedMessage);
37
- throw error;
38
- }
10
+ await browse_1.default.run([]);
39
11
  }
40
12
  }
41
13
  exports.default = Open;
@@ -0,0 +1,16 @@
1
+ import EasCommand from '../../commandUtils/EasCommand';
2
+ export default class ProjectDelete extends EasCommand {
3
+ static description: string;
4
+ static args: {
5
+ name: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
6
+ };
7
+ static flags: {
8
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
+ 'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
+ 'dangerously-confirm-deletion': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
11
+ };
12
+ static contextDefinition: {
13
+ loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
14
+ };
15
+ runAsync(): Promise<void>;
16
+ }
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const config_1 = require("@expo/config");
5
+ const core_1 = require("@oclif/core");
6
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
+ const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
8
+ const findProjectDirAndVerifyProjectSetupAsync_1 = require("../../commandUtils/context/contextUtils/findProjectDirAndVerifyProjectSetupAsync");
9
+ const flags_1 = require("../../commandUtils/flags");
10
+ const AppMutation_1 = require("../../graphql/mutations/AppMutation");
11
+ const AppQuery_1 = require("../../graphql/queries/AppQuery");
12
+ const log_1 = tslib_1.__importDefault(require("../../log"));
13
+ const ora_1 = require("../../ora");
14
+ const expoConfig_1 = require("../../project/expoConfig");
15
+ const prompts_1 = require("../../prompts");
16
+ const sudo_1 = require("../../user/sudo");
17
+ const json_1 = require("../../utils/json");
18
+ const pollForBackgroundJobReceiptAsync_1 = require("../../utils/pollForBackgroundJobReceiptAsync");
19
+ const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
20
+ class ProjectDelete extends EasCommand_1.default {
21
+ static description = 'delete a project';
22
+ static args = {
23
+ name: core_1.Args.string({
24
+ required: false,
25
+ description: 'Full name (@account/slug) or ID of the project to delete. Defaults to the project in the current directory.',
26
+ }),
27
+ };
28
+ static flags = {
29
+ 'dangerously-confirm-deletion': core_1.Flags.string({
30
+ description: "The project's full name (@account/slug), to confirm deletion. Required in non-interactive mode.",
31
+ }),
32
+ ...flags_1.EasNonInteractiveAndJsonFlags,
33
+ };
34
+ static contextDefinition = {
35
+ ...this.ContextOptions.LoggedIn,
36
+ };
37
+ async runAsync() {
38
+ const { args: { name }, flags, } = await this.parse(ProjectDelete);
39
+ const { json: jsonFlag, nonInteractive } = (0, flags_1.resolveNonInteractiveAndJsonFlags)(flags);
40
+ if (jsonFlag) {
41
+ (0, json_1.enableJsonOutput)();
42
+ }
43
+ const { loggedIn: { graphqlClient, authenticationInfo }, } = await this.getContextAsync(ProjectDelete, { nonInteractive });
44
+ let app;
45
+ if (name) {
46
+ app = UUID_REGEX.test(name)
47
+ ? await AppQuery_1.AppQuery.byIdAsync(graphqlClient, name)
48
+ : await AppQuery_1.AppQuery.byFullNameAsync(graphqlClient, name);
49
+ }
50
+ else {
51
+ let projectDir = null;
52
+ try {
53
+ projectDir = await (0, findProjectDirAndVerifyProjectSetupAsync_1.findProjectRootAsync)();
54
+ }
55
+ catch {
56
+ // Not inside a project directory — handled by the error below.
57
+ }
58
+ let projectId;
59
+ if (projectDir) {
60
+ // Only read the config when one already exists: getPrivateExpoConfigAsync creates a
61
+ // fresh app.json as a side effect when the directory has none. Config errors (broken
62
+ // app.config.js, invalid app.json) propagate so they are not masked by the error below.
63
+ const configPaths = (0, config_1.getConfigFilePaths)(projectDir);
64
+ if (configPaths.staticConfigPath ?? configPaths.dynamicConfigPath) {
65
+ const exp = await (0, expoConfig_1.getPrivateExpoConfigAsync)(projectDir);
66
+ projectId = exp.extra?.eas?.projectId;
67
+ }
68
+ }
69
+ if (!projectId) {
70
+ throw new Error("No EAS project found in the current directory. Pass the project's full name (@account/slug) or ID as an argument.");
71
+ }
72
+ app = await AppQuery_1.AppQuery.byIdAsync(graphqlClient, projectId);
73
+ }
74
+ const confirmedFullName = flags['dangerously-confirm-deletion'];
75
+ if (confirmedFullName) {
76
+ if (confirmedFullName !== app.fullName) {
77
+ throw new Error(`The value of --dangerously-confirm-deletion ("${confirmedFullName}") did not match the project's full name ("${app.fullName}"). Cancelled deletion.`);
78
+ }
79
+ }
80
+ else if (nonInteractive) {
81
+ throw new Error(`Deleting a project in non-interactive mode requires passing --dangerously-confirm-deletion with the project's full name ("${app.fullName}").`);
82
+ }
83
+ else {
84
+ log_1.default.addNewLineIfNone();
85
+ log_1.default.warn(`You are about to permanently delete project ${chalk_1.default.bold(app.fullName)}.` +
86
+ `\nThis will delete everything associated with it, including builds, submissions, update branches, published updates, and environment variables.` +
87
+ `\nThis action is irreversible.`);
88
+ log_1.default.newLine();
89
+ const { confirmedName } = await (0, prompts_1.promptAsync)({
90
+ type: 'text',
91
+ name: 'confirmedName',
92
+ message: `Type the project's full name (${app.fullName}) to confirm deletion:`,
93
+ });
94
+ if (confirmedName !== app.fullName) {
95
+ log_1.default.error(`The input did not match the project's full name. Cancelled deletion.`);
96
+ process.exit(1);
97
+ }
98
+ }
99
+ const spinner = (0, ora_1.ora)(`Deleting project ${app.fullName}`).start();
100
+ try {
101
+ let receipt;
102
+ try {
103
+ receipt = await AppMutation_1.AppMutation.scheduleAppDeletionAsync(graphqlClient, app.id);
104
+ }
105
+ catch (error) {
106
+ if (!(0, sudo_1.isSudoModeRequiredError)(error)) {
107
+ throw error;
108
+ }
109
+ if (nonInteractive) {
110
+ throw new Error('Deleting a project requires a session in sudo mode. Run this command interactively to confirm your password, then retry in non-interactive mode while sudo mode is active.');
111
+ }
112
+ spinner.stop();
113
+ await (0, sudo_1.promptForSudoModeUpgradeAsync)(authenticationInfo);
114
+ spinner.start();
115
+ receipt = await AppMutation_1.AppMutation.scheduleAppDeletionAsync(graphqlClient, app.id);
116
+ }
117
+ await (0, pollForBackgroundJobReceiptAsync_1.pollForBackgroundJobReceiptAsync)(graphqlClient, receipt);
118
+ spinner.succeed(`Deleted project ${chalk_1.default.bold(app.fullName)}`);
119
+ }
120
+ catch (error) {
121
+ spinner.fail(`Failed to delete project ${chalk_1.default.bold(app.fullName)}`);
122
+ throw error;
123
+ }
124
+ if (jsonFlag) {
125
+ (0, json_1.printJsonOnlyOutput)({ id: app.id, fullName: app.fullName });
126
+ }
127
+ }
128
+ }
129
+ exports.default = ProjectDelete;
@@ -26,6 +26,7 @@ class SimulatorStart extends EasCommand_1.default {
26
26
  static description = '[EXPERIMENTAL] start a remote simulator session on EAS and get instructions to connect to it';
27
27
  static flags = {
28
28
  platform: core_1.Flags.option({
29
+ char: 'p',
29
30
  description: 'Device platform',
30
31
  options: ['android', 'ios'],
31
32
  required: true,
@@ -6942,8 +6942,9 @@ export type MeMutation = {
6942
6942
  /** Schedule deletion of a SSO user. Actor must be an owner on the SSO user's SSO account. */
6943
6943
  scheduleSSOUserDeletionAsSSOAccountOwner: BackgroundJobReceipt;
6944
6944
  /**
6945
- * Sets user preferences. This is a key-value store for user-specific settings. Provided values are
6946
- * key-level merged with existing values.
6945
+ * Legacy user preferences are no longer stored; this mutation accepts and discards
6946
+ * its input. Use userPreference.set instead.
6947
+ * @deprecated No longer stored; this mutation has no effect. Use userPreference.set instead.
6947
6948
  */
6948
6949
  setPreferences: UserPreferences;
6949
6950
  /** Set the user's primary second factor device */
@@ -7948,6 +7949,7 @@ export type SsoUser = Actor & UserActor & {
7948
7949
  lastName?: Maybe<Scalars['String']['output']>;
7949
7950
  pinnedApps: Array<App>;
7950
7951
  pinnedDashboardViews: Array<PinnedDashboardView>;
7952
+ /** @deprecated No longer stored. Use userPreference instead. */
7951
7953
  preferences: UserPreferences;
7952
7954
  /** Associated accounts */
7953
7955
  primaryAccount: Account;
@@ -9077,6 +9079,7 @@ export type User = Actor & UserActor & {
9077
9079
  pendingUserInvitations: Array<UserInvitation>;
9078
9080
  pinnedApps: Array<App>;
9079
9081
  pinnedDashboardViews: Array<PinnedDashboardView>;
9082
+ /** @deprecated No longer stored. Use userPreference instead. */
9080
9083
  preferences: UserPreferences;
9081
9084
  /** Associated accounts */
9082
9085
  primaryAccount: Account;
@@ -9160,6 +9163,7 @@ export type UserActor = {
9160
9163
  lastDeletionAttemptTime?: Maybe<Scalars['DateTime']['output']>;
9161
9164
  lastName?: Maybe<Scalars['String']['output']>;
9162
9165
  pinnedApps: Array<App>;
9166
+ /** @deprecated No longer stored. Use userPreference instead. */
9163
9167
  preferences: UserPreferences;
9164
9168
  /** Associated accounts */
9165
9169
  primaryAccount: Account;
@@ -9526,9 +9530,8 @@ export type UserPreferenceQueryGetArgs = {
9526
9530
  };
9527
9531
  export type UserPreferences = {
9528
9532
  __typename?: 'UserPreferences';
9533
+ /** @deprecated No longer stored; always null. */
9529
9534
  onboarding?: Maybe<UserPreferencesOnboarding>;
9530
- /** @deprecated Use userPreference.get(key: "selected-account-id") instead. */
9531
- selectedAccountName?: Maybe<Scalars['String']['output']>;
9532
9535
  };
9533
9536
  export type UserPreferencesInput = {
9534
9537
  onboarding?: InputMaybe<UserPreferencesOnboardingInput>;
@@ -9540,18 +9543,10 @@ export type UserPreferencesInput = {
9540
9543
  export type UserPreferencesOnboarding = {
9541
9544
  __typename?: 'UserPreferencesOnboarding';
9542
9545
  appId: Scalars['ID']['output'];
9543
- /** Can be null if the user has not selected one yet. */
9544
9546
  deviceType?: Maybe<OnboardingDeviceType>;
9545
- /** Can be null if the user has not selected one yet. */
9546
9547
  environment?: Maybe<OnboardingEnvironment>;
9547
- /**
9548
- * Set by CLI when the user has completed that phase. Used by the website to determine when
9549
- * the next step can be shown.
9550
- */
9551
9548
  isCLIDone?: Maybe<Scalars['Boolean']['output']>;
9552
- /** The last time when this object was updated. */
9553
9549
  lastUsed: Scalars['String']['output'];
9554
- /** User selects a platform for which they want to build the app. CLI uses this information to start the build. */
9555
9550
  platform?: Maybe<AppPlatform>;
9556
9551
  };
9557
9552
  export type UserPreferencesOnboardingInput = {
@@ -10479,7 +10474,9 @@ export type WorkflowJobApproval = {
10479
10474
  createdAt: Scalars['DateTime']['output'];
10480
10475
  decision: WorkflowJobReviewDecision;
10481
10476
  id: Scalars['ID']['output'];
10477
+ reviewingActor?: Maybe<Actor>;
10482
10478
  updatedAt: Scalars['DateTime']['output'];
10479
+ /** @deprecated Use reviewingActor instead */
10483
10480
  userActor?: Maybe<UserActor>;
10484
10481
  workflowJob: WorkflowJob;
10485
10482
  };
@@ -14752,6 +14749,29 @@ export type CreateAppMutation = {
14752
14749
  };
14753
14750
  } | null;
14754
14751
  };
14752
+ export type ScheduleAppDeletionMutationVariables = Exact<{
14753
+ appId: Scalars['ID']['input'];
14754
+ }>;
14755
+ export type ScheduleAppDeletionMutation = {
14756
+ __typename?: 'RootMutation';
14757
+ app?: {
14758
+ __typename?: 'AppMutation';
14759
+ scheduleAppDeletion: {
14760
+ __typename?: 'BackgroundJobReceipt';
14761
+ id: string;
14762
+ state: BackgroundJobState;
14763
+ tries: number;
14764
+ willRetry: boolean;
14765
+ resultId?: string | null;
14766
+ resultType: BackgroundJobResultType;
14767
+ resultData?: any | null;
14768
+ errorCode?: string | null;
14769
+ errorMessage?: string | null;
14770
+ createdAt: any;
14771
+ updatedAt: any;
14772
+ };
14773
+ } | null;
14774
+ };
14755
14775
  export type CreateAppVersionMutationVariables = Exact<{
14756
14776
  appVersionInput: AppVersionInput;
14757
14777
  }>;
@@ -22487,6 +22507,24 @@ export type SuggestedDevDomainNameQuery = {
22487
22507
  };
22488
22508
  };
22489
22509
  };
22510
+ export type DevDomainNameByAppIdQueryVariables = Exact<{
22511
+ appId: Scalars['String']['input'];
22512
+ }>;
22513
+ export type DevDomainNameByAppIdQuery = {
22514
+ __typename?: 'RootQuery';
22515
+ app: {
22516
+ __typename?: 'AppQuery';
22517
+ byId: {
22518
+ __typename?: 'App';
22519
+ id: string;
22520
+ devDomainName?: {
22521
+ __typename?: 'AppDevDomainName';
22522
+ id: string;
22523
+ name: any;
22524
+ } | null;
22525
+ };
22526
+ };
22527
+ };
22490
22528
  export type PaginatedWorkerDeploymentAliasesQueryVariables = Exact<{
22491
22529
  appId: Scalars['String']['input'];
22492
22530
  first?: InputMaybe<Scalars['Int']['input']>;
@@ -1,7 +1,9 @@
1
1
  import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
2
+ import { BackgroundJobReceiptDataFragment } from '../generated';
2
3
  export declare const AppMutation: {
3
4
  createAppAsync(graphqlClient: ExpoGraphqlClient, appInput: {
4
5
  accountId: string;
5
6
  projectName: string;
6
7
  }): Promise<string>;
8
+ scheduleAppDeletionAsync(graphqlClient: ExpoGraphqlClient, appId: string): Promise<BackgroundJobReceiptDataFragment>;
7
9
  };
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const assert_1 = tslib_1.__importDefault(require("assert"));
6
6
  const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
7
7
  const client_1 = require("../client");
8
+ const BackgroundJobReceipt_1 = require("../types/BackgroundJobReceipt");
8
9
  exports.AppMutation = {
9
10
  async createAppAsync(graphqlClient, appInput) {
10
11
  const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
@@ -24,4 +25,22 @@ exports.AppMutation = {
24
25
  (0, assert_1.default)(appId, 'App ID must be defined');
25
26
  return appId;
26
27
  },
28
+ async scheduleAppDeletionAsync(graphqlClient, appId) {
29
+ const result = await (0, client_1.withErrorHandlingAsync)(graphqlClient
30
+ .mutation((0, graphql_tag_1.default) `
31
+ mutation ScheduleAppDeletion($appId: ID!) {
32
+ app {
33
+ scheduleAppDeletion(appId: $appId) {
34
+ id
35
+ ...BackgroundJobReceiptData
36
+ }
37
+ }
38
+ }
39
+ ${BackgroundJobReceipt_1.BackgroundJobReceiptNode}
40
+ `, { appId })
41
+ .toPromise());
42
+ const receipt = result.app?.scheduleAppDeletion;
43
+ (0, assert_1.default)(receipt, 'Background job receipt must be defined');
44
+ return receipt;
45
+ },
27
46
  };
@@ -0,0 +1,14 @@
1
+ import { LoggedInAuthenticationInfo } from './SessionManager';
2
+ export declare const SUDO_MODE_REQUIRED_ERROR_CODE = "SUDO_MODE_REQUIRED";
3
+ /**
4
+ * Whether the error is the server signaling that the current session must be upgraded
5
+ * to sudo mode before performing this operation.
6
+ */
7
+ export declare function isSudoModeRequiredError(error: unknown): boolean;
8
+ /**
9
+ * Upgrade the current session to sudo mode by re-confirming the user's password
10
+ * (and OTP if two-factor authentication is enabled). Sudo mode is required for
11
+ * destructive operations like project deletion, and expires server-side after a
12
+ * few minutes.
13
+ */
14
+ export declare function promptForSudoModeUpgradeAsync(authenticationInfo: LoggedInAuthenticationInfo): Promise<void>;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SUDO_MODE_REQUIRED_ERROR_CODE = void 0;
4
+ exports.isSudoModeRequiredError = isSudoModeRequiredError;
5
+ exports.promptForSudoModeUpgradeAsync = promptForSudoModeUpgradeAsync;
6
+ const tslib_1 = require("tslib");
7
+ const ApiV2Error_1 = require("../ApiV2Error");
8
+ const api_1 = require("../api");
9
+ const client_1 = require("../graphql/client");
10
+ const log_1 = tslib_1.__importDefault(require("../log"));
11
+ const prompts_1 = require("../prompts");
12
+ exports.SUDO_MODE_REQUIRED_ERROR_CODE = 'SUDO_MODE_REQUIRED';
13
+ /**
14
+ * Whether the error is the server signaling that the current session must be upgraded
15
+ * to sudo mode before performing this operation.
16
+ */
17
+ function isSudoModeRequiredError(error) {
18
+ return (error instanceof client_1.GraphqlError &&
19
+ error.graphQLErrors.some(e => e?.extensions?.errorCode === exports.SUDO_MODE_REQUIRED_ERROR_CODE));
20
+ }
21
+ /**
22
+ * Upgrade the current session to sudo mode by re-confirming the user's password
23
+ * (and OTP if two-factor authentication is enabled). Sudo mode is required for
24
+ * destructive operations like project deletion, and expires server-side after a
25
+ * few minutes.
26
+ */
27
+ async function promptForSudoModeUpgradeAsync(authenticationInfo) {
28
+ if (!authenticationInfo.sessionSecret) {
29
+ throw new Error('This action requires sudo mode, which is only available for user sessions. ' +
30
+ 'Access tokens (EXPO_TOKEN) cannot be upgraded to sudo mode; log in with `eas login` instead.');
31
+ }
32
+ log_1.default.log('This action requires sudo mode. Confirm your password to continue.');
33
+ const { password } = await (0, prompts_1.promptAsync)({
34
+ type: 'password',
35
+ name: 'password',
36
+ message: 'Password:',
37
+ });
38
+ if (!password) {
39
+ throw new Error('Password is required for sudo mode.');
40
+ }
41
+ const apiV2Client = new api_1.ApiV2Client(authenticationInfo);
42
+ try {
43
+ await apiV2Client.postAsync('auth/upgradeSudo', { body: { password } });
44
+ }
45
+ catch (error) {
46
+ if (error instanceof ApiV2Error_1.ApiV2Error && error.expoApiV2ErrorCode === 'ONE_TIME_PASSWORD_REQUIRED') {
47
+ log_1.default.log('One-time password from authenticator required.');
48
+ const { otp } = await (0, prompts_1.promptAsync)({
49
+ type: 'text',
50
+ name: 'otp',
51
+ message: 'One-time password or backup code:',
52
+ });
53
+ if (!otp) {
54
+ throw new Error('Cancelled sudo mode upgrade.');
55
+ }
56
+ await apiV2Client.postAsync('auth/upgradeSudo', { body: { password, otp } });
57
+ }
58
+ else {
59
+ throw error;
60
+ }
61
+ }
62
+ }