eas-cli 21.2.0 → 21.3.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.
Files changed (49) hide show
  1. package/README.md +243 -115
  2. package/build/commandUtils/context/contextUtils/getProjectIdAsync.js +31 -16
  3. package/build/commands/observe/events.js +5 -4
  4. package/build/commands/observe/metrics-summary.js +2 -1
  5. package/build/commands/observe/metrics.js +3 -2
  6. package/build/commands/observe/routes.js +3 -2
  7. package/build/commands/observe/session.js +8 -2
  8. package/build/commands/project/icon/set.d.ts +15 -0
  9. package/build/commands/project/icon/set.js +93 -0
  10. package/build/commands/project/init.d.ts +3 -0
  11. package/build/commands/project/init.js +34 -7
  12. package/build/commands/testflight/crashes.d.ts +23 -0
  13. package/build/commands/testflight/crashes.js +82 -0
  14. package/build/commands/testflight/feedback.d.ts +23 -0
  15. package/build/commands/testflight/feedback.js +82 -0
  16. package/build/graphql/generated.d.ts +206 -254
  17. package/build/graphql/generated.js +18 -23
  18. package/build/graphql/mutations/UploadSessionMutation.d.ts +5 -1
  19. package/build/graphql/mutations/UploadSessionMutation.js +15 -0
  20. package/build/graphql/queries/AppQuery.d.ts +1 -0
  21. package/build/graphql/queries/AppQuery.js +19 -0
  22. package/build/observe/fetchEvents.js +7 -1
  23. package/build/observe/fetchMetrics.js +6 -0
  24. package/build/observe/fetchNavigationRoutes.js +6 -0
  25. package/build/observe/fetchSessions.d.ts +7 -0
  26. package/build/observe/fetchSessions.js +16 -0
  27. package/build/observe/planGating.d.ts +15 -0
  28. package/build/observe/planGating.js +48 -0
  29. package/build/project/accountSelection.d.ts +4 -0
  30. package/build/project/accountSelection.js +56 -0
  31. package/build/project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync.js +4 -3
  32. package/build/project/projectInitialization.d.ts +13 -3
  33. package/build/project/projectInitialization.js +52 -80
  34. package/build/testflight/app.d.ts +18 -0
  35. package/build/testflight/app.js +124 -0
  36. package/build/testflight/fetch.d.ts +56 -0
  37. package/build/testflight/fetch.js +116 -0
  38. package/build/testflight/format.d.ts +4 -0
  39. package/build/testflight/format.js +104 -0
  40. package/build/testflight/queries.d.ts +16 -0
  41. package/build/testflight/queries.js +123 -0
  42. package/build/testflight/target.d.ts +15 -0
  43. package/build/testflight/target.js +32 -0
  44. package/build/uploads.d.ts +7 -1
  45. package/build/uploads.js +9 -0
  46. package/build/user/User.d.ts +6 -0
  47. package/build/user/User.js +18 -0
  48. package/oclif.manifest.json +1494 -1138
  49. package/package.json +8 -5
@@ -12,8 +12,10 @@ const findProjectDirAndVerifyProjectSetupAsync_1 = require("./findProjectDirAndV
12
12
  const AppQuery_1 = require("../../../graphql/queries/AppQuery");
13
13
  const log_1 = tslib_1.__importStar(require("../../../log"));
14
14
  const ora_1 = require("../../../ora");
15
+ const accountSelection_1 = require("../../../project/accountSelection");
15
16
  const expoConfig_1 = require("../../../project/expoConfig");
16
17
  const fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync_1 = require("../../../project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync");
18
+ const prompts_1 = require("../../../prompts");
17
19
  const User_1 = require("../../../user/User");
18
20
  /**
19
21
  * Save an EAS project ID to the appropriate field in the app config.
@@ -105,23 +107,9 @@ async function validateOrSetProjectIdAsync({ exp, graphqlClient, actor, options,
105
107
  throw new Error('This command must be run inside a project directory.');
106
108
  }
107
109
  log_1.default.warn('EAS project not configured.');
108
- const getDefaultAccountNameForEASProject = (exp, user) => {
109
- if (exp.owner) {
110
- return exp.owner;
111
- }
112
- switch (user.__typename) {
113
- case 'User':
114
- return user.username;
115
- case 'SSOUser':
116
- return user.username;
117
- case 'PartnerActor':
118
- return user.username;
119
- case 'Robot':
120
- throw new Error('Must configure EAS project by running "eas init" before using a robot user to manage the project.');
121
- }
122
- };
110
+ const accountName = await chooseAccountNameForEASProjectAsync(exp, actor, options);
123
111
  const projectId = await (0, fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync_1.fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync)(graphqlClient, {
124
- accountName: getDefaultAccountNameForEASProject(exp, actor),
112
+ accountName,
125
113
  projectName: exp.slug,
126
114
  }, {
127
115
  nonInteractive: options.nonInteractive,
@@ -137,3 +125,30 @@ async function validateOrSetProjectIdAsync({ exp, graphqlClient, actor, options,
137
125
  }
138
126
  return projectId;
139
127
  }
128
+ /**
129
+ * Choose the account that should own a not-yet-configured EAS project. Uses the "owner" field
130
+ * from the app config when set. Otherwise, when the actor has access to multiple accounts,
131
+ * prompts for the account to use.
132
+ */
133
+ async function chooseAccountNameForEASProjectAsync(exp, actor, options) {
134
+ if (exp.owner) {
135
+ return exp.owner;
136
+ }
137
+ if (actor.__typename === 'Robot') {
138
+ throw new Error(`Project is not configured. When using a robot access token, run "eas init --account <name> --non-interactive" or set the "owner" field in your app config before managing the project. Accounts this token can create projects in: ${(0, User_1.getCreatableAccountNames)(actor).join(', ')}`);
139
+ }
140
+ const allAccounts = actor.accounts;
141
+ if (allAccounts.length === 1) {
142
+ return allAccounts[0].name;
143
+ }
144
+ if (options.nonInteractive) {
145
+ throw new Error(`Must configure EAS project by running 'eas init' before this command can be run in non-interactive mode.`);
146
+ }
147
+ const choices = (0, accountSelection_1.getAccountChoices)(actor, (0, accountSelection_1.getAccountNamesWhereUserHasSufficientPermissionsToCreateApp)(actor));
148
+ return (await (0, prompts_1.promptAsync)({
149
+ type: 'select',
150
+ name: 'account',
151
+ message: 'Which account should own this project?',
152
+ choices,
153
+ })).account.name;
154
+ }
@@ -10,6 +10,7 @@ const ObserveQuery_1 = require("../../graphql/queries/ObserveQuery");
10
10
  const fetchCustomEvents_1 = require("../../observe/fetchCustomEvents");
11
11
  const flags_2 = require("../../observe/flags");
12
12
  const formatCustomEvents_1 = require("../../observe/formatCustomEvents");
13
+ const planGating_1 = require("../../observe/planGating");
13
14
  const platforms_1 = require("../../observe/platforms");
14
15
  const resolveProjectContext_1 = require("../../observe/resolveProjectContext");
15
16
  const startAndEndTime_1 = require("../../observe/startAndEndTime");
@@ -69,12 +70,12 @@ class ObserveEvents extends EasCommand_1.default {
69
70
  const { daysBack, startTime, endTime } = (0, startAndEndTime_1.resolveTimeRange)(flags);
70
71
  const platform = (0, platforms_1.appObservePlatformFromFlag)(flags.platform);
71
72
  if (!args.eventName && !flags['all-events']) {
72
- const { names, isTruncated } = await ObserveQuery_1.ObserveQuery.customEventNamesAsync(graphqlClient, {
73
+ const { names, isTruncated } = await (0, planGating_1.withObservePlanGateHandlingAsync)(() => ObserveQuery_1.ObserveQuery.customEventNamesAsync(graphqlClient, {
73
74
  appId: projectId,
74
75
  startTime,
75
76
  endTime,
76
77
  platform,
77
- });
78
+ }));
78
79
  if (json) {
79
80
  (0, json_1.printJsonOnlyOutput)((0, formatCustomEvents_1.buildObserveCustomEventNamesJson)(names, isTruncated));
80
81
  }
@@ -89,7 +90,7 @@ class ObserveEvents extends EasCommand_1.default {
89
90
  }
90
91
  return;
91
92
  }
92
- const { events, pageInfo } = await (0, fetchCustomEvents_1.fetchObserveCustomEventsAsync)(graphqlClient, projectId, {
93
+ const { events, pageInfo } = await (0, planGating_1.withObservePlanGateHandlingAsync)(() => (0, fetchCustomEvents_1.fetchObserveCustomEventsAsync)(graphqlClient, projectId, {
93
94
  eventName: args.eventName,
94
95
  limit: flags.limit ?? DEFAULT_EVENTS_LIMIT,
95
96
  ...(flags.after && { after: flags.after }),
@@ -99,7 +100,7 @@ class ObserveEvents extends EasCommand_1.default {
99
100
  appVersion: flags['app-version'],
100
101
  updateId: flags['update-id'],
101
102
  sessionId: flags['session-id'],
102
- });
103
+ }));
103
104
  if (args.eventName && events.length === 0) {
104
105
  const { names, isTruncated } = await ObserveQuery_1.ObserveQuery.customEventNamesAsync(graphqlClient, {
105
106
  appId: projectId,
@@ -9,6 +9,7 @@ const fetchMetrics_1 = require("../../observe/fetchMetrics");
9
9
  const flags_2 = require("../../observe/flags");
10
10
  const formatMetrics_1 = require("../../observe/formatMetrics");
11
11
  const metricNames_1 = require("../../observe/metricNames");
12
+ const planGating_1 = require("../../observe/planGating");
12
13
  const platforms_1 = require("../../observe/platforms");
13
14
  const resolveProjectContext_1 = require("../../observe/resolveProjectContext");
14
15
  const startAndEndTime_1 = require("../../observe/startAndEndTime");
@@ -74,7 +75,7 @@ class ObserveMetricsSummary extends EasCommand_1.default {
74
75
  : DEFAULT_METRICS;
75
76
  const { daysBack, startTime, endTime } = (0, startAndEndTime_1.resolveTimeRange)(flags);
76
77
  const platforms = (0, platforms_1.appPlatformsFromFlag)(flags.platform);
77
- const { metricsMap, buildNumbersMap, updateIdsMap, totalEventCounts } = await (0, fetchMetrics_1.fetchObserveMetricsAsync)(graphqlClient, projectId, metricNames, platforms, startTime, endTime);
78
+ const { metricsMap, buildNumbersMap, updateIdsMap, totalEventCounts } = await (0, planGating_1.withObservePlanGateHandlingAsync)(() => (0, fetchMetrics_1.fetchObserveMetricsAsync)(graphqlClient, projectId, metricNames, platforms, startTime, endTime));
78
79
  const argumentsStat = flags.stat?.length
79
80
  ? Array.from(new Set(flags.stat.map(formatMetrics_1.resolveStatKey)))
80
81
  : undefined;
@@ -10,6 +10,7 @@ const log_1 = tslib_1.__importDefault(require("../../log"));
10
10
  const fetchEvents_1 = require("../../observe/fetchEvents");
11
11
  const flags_2 = require("../../observe/flags");
12
12
  const metricNames_1 = require("../../observe/metricNames");
13
+ const planGating_1 = require("../../observe/planGating");
13
14
  const formatEvents_1 = require("../../observe/formatEvents");
14
15
  const platforms_1 = require("../../observe/platforms");
15
16
  const resolveProjectContext_1 = require("../../observe/resolveProjectContext");
@@ -84,7 +85,7 @@ class ObserveMetrics extends EasCommand_1.default {
84
85
  const { daysBack, startTime, endTime } = (0, startAndEndTime_1.resolveTimeRange)(flags);
85
86
  const platform = (0, platforms_1.appObservePlatformFromFlag)(flags.platform);
86
87
  const platforms = (0, platforms_1.appPlatformsFromFlag)(flags.platform);
87
- const [{ events, pageInfo }, totalEventCount] = await Promise.all([
88
+ const [{ events, pageInfo }, totalEventCount] = await (0, planGating_1.withObservePlanGateHandlingAsync)(() => Promise.all([
88
89
  (0, fetchEvents_1.fetchObserveEventsAsync)(graphqlClient, projectId, {
89
90
  metricName,
90
91
  orderBy,
@@ -97,7 +98,7 @@ class ObserveMetrics extends EasCommand_1.default {
97
98
  updateId: flags['update-id'],
98
99
  }),
99
100
  (0, fetchEvents_1.fetchTotalEventCountAsync)(graphqlClient, projectId, metricName, platforms, startTime, endTime),
100
- ]);
101
+ ]));
101
102
  if (json) {
102
103
  (0, json_1.printJsonOnlyOutput)((0, formatEvents_1.buildObserveEventsJson)(events, pageInfo));
103
104
  }
@@ -10,6 +10,7 @@ const fetchNavigationRoutes_1 = require("../../observe/fetchNavigationRoutes");
10
10
  const flags_2 = require("../../observe/flags");
11
11
  const formatNavigationRoutes_1 = require("../../observe/formatNavigationRoutes");
12
12
  const metricNames_1 = require("../../observe/metricNames");
13
+ const planGating_1 = require("../../observe/planGating");
13
14
  const platforms_1 = require("../../observe/platforms");
14
15
  const resolveProjectContext_1 = require("../../observe/resolveProjectContext");
15
16
  const startAndEndTime_1 = require("../../observe/startAndEndTime");
@@ -81,7 +82,7 @@ class ObserveRoutes extends EasCommand_1.default {
81
82
  : undefined;
82
83
  const { daysBack, startTime, endTime } = (0, startAndEndTime_1.resolveTimeRange)(flags);
83
84
  const platforms = (0, platforms_1.appPlatformsFromFlag)(flags.platform);
84
- const { routes, pageInfoByPlatform } = await (0, fetchNavigationRoutes_1.fetchObserveNavigationRoutesAsync)(graphqlClient, projectId, {
85
+ const { routes, pageInfoByPlatform } = await (0, planGating_1.withObservePlanGateHandlingAsync)(() => (0, fetchNavigationRoutes_1.fetchObserveNavigationRoutesAsync)(graphqlClient, projectId, {
85
86
  startTime,
86
87
  endTime,
87
88
  platforms,
@@ -91,7 +92,7 @@ class ObserveRoutes extends EasCommand_1.default {
91
92
  updateId: flags['update-id'],
92
93
  buildNumber: flags['build-number'],
93
94
  routeNames,
94
- });
95
+ }));
95
96
  if (json) {
96
97
  const stats = argumentsStat ?? DEFAULT_STATS_JSON;
97
98
  (0, json_1.printJsonOnlyOutput)((0, formatNavigationRoutes_1.buildObserveNavigationRoutesJson)(routes, metricNames, stats, pageInfoByPlatform));
@@ -10,6 +10,7 @@ const ObserveQuery_1 = require("../../graphql/queries/ObserveQuery");
10
10
  const fetchEvents_1 = require("../../observe/fetchEvents");
11
11
  const fetchSessions_1 = require("../../observe/fetchSessions");
12
12
  const flags_2 = require("../../observe/flags");
13
+ const planGating_1 = require("../../observe/planGating");
13
14
  const formatSessions_1 = require("../../observe/formatSessions");
14
15
  const metricNames_1 = require("../../observe/metricNames");
15
16
  const resolveProjectContext_1 = require("../../observe/resolveProjectContext");
@@ -80,6 +81,11 @@ class ObserveSession extends EasCommand_1.default {
80
81
  throw new errors_1.EasCommandError('A session ID argument is required in non-interactive mode. In interactive mode, you can omit the session ID to pick one from a list of events.');
81
82
  }
82
83
  else {
84
+ // Session timelines are a paid feature. Verify access before walking the
85
+ // user through the interactive picker so a blocked plan gets the upgrade
86
+ // prompt immediately, rather than after selecting an event (or a
87
+ // misleading "No events found" when there are no candidates).
88
+ await (0, planGating_1.withObservePlanGateHandlingAsync)(() => (0, fetchSessions_1.verifyObserveSessionAccessAsync)(graphqlClient, projectId));
83
89
  sessionId = await pickSessionIdInteractivelyAsync({
84
90
  graphqlClient,
85
91
  projectId,
@@ -88,10 +94,10 @@ class ObserveSession extends EasCommand_1.default {
88
94
  timeRangeFlags: { days: flags.days, start: flags.start, end: flags.end },
89
95
  });
90
96
  }
91
- const { entries, metadata, hasMoreMetricEvents, hasMoreLogEvents } = await (0, fetchSessions_1.fetchObserveSessionEventsAsync)(graphqlClient, projectId, {
97
+ const { entries, metadata, hasMoreMetricEvents, hasMoreLogEvents } = await (0, planGating_1.withObservePlanGateHandlingAsync)(() => (0, fetchSessions_1.fetchObserveSessionEventsAsync)(graphqlClient, projectId, {
92
98
  sessionId,
93
99
  limit: SESSION_PAGE_SIZE,
94
- });
100
+ }));
95
101
  if (json) {
96
102
  (0, json_1.printJsonOnlyOutput)((0, formatSessions_1.buildObserveSessionEventsJson)(entries, sessionId, metadata, hasMoreMetricEvents, hasMoreLogEvents));
97
103
  }
@@ -0,0 +1,15 @@
1
+ import EasCommand from '../../../commandUtils/EasCommand';
2
+ export default class ProjectIconSet extends EasCommand {
3
+ static description: string;
4
+ static args: {
5
+ path: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static flags: {
8
+ 'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
+ };
10
+ static contextDefinition: {
11
+ loggedIn: import("../../../commandUtils/context/LoggedInContextField").default;
12
+ projectId: import("../../../commandUtils/context/ProjectIdContextField").ProjectIdContextField;
13
+ };
14
+ runAsync(): Promise<void>;
15
+ }
@@ -0,0 +1,93 @@
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 chalk_1 = tslib_1.__importDefault(require("chalk"));
6
+ const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
7
+ const path_1 = tslib_1.__importDefault(require("path"));
8
+ const url_1 = require("../../../build/utils/url");
9
+ const EasCommand_1 = tslib_1.__importDefault(require("../../../commandUtils/EasCommand"));
10
+ const flags_1 = require("../../../commandUtils/flags");
11
+ const generated_1 = require("../../../graphql/generated");
12
+ const AppQuery_1 = require("../../../graphql/queries/AppQuery");
13
+ const log_1 = tslib_1.__importStar(require("../../../log"));
14
+ const ora_1 = require("../../../ora");
15
+ const uploads_1 = require("../../../uploads");
16
+ const promise_1 = require("../../../utils/promise");
17
+ const ALLOWED_EXTENSIONS = ['.png', '.jpg', '.jpeg'];
18
+ const MAX_IMAGE_SIZE_BYTES = 10 * 1024 * 1024; // matches the upload session's GCS limit
19
+ const POLL_INTERVAL_MS = 2000;
20
+ const POLL_TIMEOUT_MS = 90_000;
21
+ class ProjectIconSet extends EasCommand_1.default {
22
+ static description = 'set the project icon displayed on the EAS dashboard';
23
+ static args = {
24
+ path: core_1.Args.string({
25
+ required: true,
26
+ description: 'Path to the icon image (PNG or JPEG, at most 10 MB). Non-square images are center-cropped to a square.',
27
+ }),
28
+ };
29
+ static flags = {
30
+ ...flags_1.EASNonInteractiveFlag,
31
+ };
32
+ static contextDefinition = {
33
+ ...this.ContextOptions.ProjectId,
34
+ ...this.ContextOptions.LoggedIn,
35
+ };
36
+ async runAsync() {
37
+ const { args: { path: imagePath }, flags, } = await this.parse(ProjectIconSet);
38
+ const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(ProjectIconSet, {
39
+ nonInteractive: flags['non-interactive'],
40
+ });
41
+ await validateImageAsync(imagePath);
42
+ const app = await AppQuery_1.AppQuery.byIdAsync(graphqlClient, projectId);
43
+ const projectDashboardUrl = (0, url_1.getProjectDashboardUrl)(app.ownerAccount.name, app.slug);
44
+ const previousProfileImageUrl = await AppQuery_1.AppQuery.byIdProfileImageUrlAsync(graphqlClient, projectId);
45
+ const spinner = (0, ora_1.ora)('Uploading project icon').start();
46
+ try {
47
+ await (0, uploads_1.uploadAppScopedFileAtPathToGCSAsync)(graphqlClient, {
48
+ type: generated_1.AppUploadSessionType.ProfileImageUpload,
49
+ appId: projectId,
50
+ path: imagePath,
51
+ });
52
+ // The icon is processed asynchronously (resized and assigned to the
53
+ // project by the server), so poll until the icon URL changes.
54
+ spinner.text = 'Processing project icon';
55
+ await pollForProfileImageChangeAsync(graphqlClient, {
56
+ projectId,
57
+ previousProfileImageUrl,
58
+ projectDashboardUrl,
59
+ });
60
+ spinner.succeed(`Set icon for ${chalk_1.default.bold(app.fullName)}`);
61
+ log_1.default.withTick(`View it on the project page: ${(0, log_1.link)(projectDashboardUrl)}`);
62
+ }
63
+ catch (error) {
64
+ spinner.fail('Failed to set project icon');
65
+ throw error;
66
+ }
67
+ }
68
+ }
69
+ exports.default = ProjectIconSet;
70
+ async function validateImageAsync(imagePath) {
71
+ if (!(await fs_extra_1.default.pathExists(imagePath))) {
72
+ throw new Error(`No file found at ${imagePath}`);
73
+ }
74
+ const extension = path_1.default.extname(imagePath).toLowerCase();
75
+ if (!ALLOWED_EXTENSIONS.includes(extension)) {
76
+ throw new Error(`Unsupported image format "${extension}". The icon must be a PNG or JPEG file.`);
77
+ }
78
+ const { size } = await fs_extra_1.default.stat(imagePath);
79
+ if (size > MAX_IMAGE_SIZE_BYTES) {
80
+ throw new Error(`The image is ${(size / 1024 / 1024).toFixed(1)} MB, but the maximum allowed size is 10 MB.`);
81
+ }
82
+ }
83
+ async function pollForProfileImageChangeAsync(graphqlClient, { projectId, previousProfileImageUrl, projectDashboardUrl, }) {
84
+ const startTime = Date.now();
85
+ while (Date.now() - startTime < POLL_TIMEOUT_MS) {
86
+ await (0, promise_1.sleepAsync)(POLL_INTERVAL_MS);
87
+ const profileImageUrl = await AppQuery_1.AppQuery.byIdProfileImageUrlAsync(graphqlClient, projectId);
88
+ if (profileImageUrl && profileImageUrl !== previousProfileImageUrl) {
89
+ return;
90
+ }
91
+ }
92
+ throw new Error(`Timed out waiting for the icon to be processed. It may still appear on the project page shortly: ${chalk_1.default.underline(projectDashboardUrl)}`);
93
+ }
@@ -2,9 +2,12 @@ import EasCommand from '../../commandUtils/EasCommand';
2
2
  export default class ProjectInit extends EasCommand {
3
3
  static description: string;
4
4
  static aliases: string[];
5
+ static examples: string[];
5
6
  static flags: {
7
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
6
8
  'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
9
  id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
10
+ account: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
8
11
  force: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
12
  };
10
13
  static contextDefinition: {
@@ -2,46 +2,73 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const core_1 = require("@oclif/core");
5
+ const url_1 = require("../../build/utils/url");
5
6
  const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
6
7
  const flags_1 = require("../../commandUtils/flags");
7
8
  const projectInitialization_1 = require("../../project/projectInitialization");
9
+ const json_1 = require("../../utils/json");
8
10
  class ProjectInit extends EasCommand_1.default {
9
11
  static description = 'create or link an EAS project';
10
12
  static aliases = ['init'];
13
+ static examples = [
14
+ '$ eas init \t # Create or link a project interactively',
15
+ '$ eas init --id <project-id> \t # Link to the project with the given ID',
16
+ '$ eas init --account my-account --non-interactive \t # Create or link @my-account/<slug> without prompts',
17
+ '$ eas init --account my-account --json --non-interactive \t # Same, and print the result as JSON to stdout',
18
+ ];
11
19
  static flags = {
12
20
  id: core_1.Flags.string({
13
21
  description: 'ID of the EAS project to link',
14
22
  }),
23
+ account: core_1.Flags.string({
24
+ description: 'Name of the account that will own the project',
25
+ exclusive: ['id'],
26
+ }),
15
27
  force: core_1.Flags.boolean({
16
28
  description: 'Whether to create a new project/link an existing project without additional prompts or overwrite any existing project ID when running with --id flag',
17
29
  }),
18
- ...flags_1.EASNonInteractiveFlag,
30
+ ...flags_1.EasNonInteractiveAndJsonFlags,
19
31
  };
20
32
  static contextDefinition = {
21
33
  ...this.ContextOptions.LoggedIn,
22
34
  ...this.ContextOptions.ProjectDir,
23
35
  };
24
36
  async runAsync() {
25
- const { flags: { id: idArgument, force, 'non-interactive': nonInteractive }, } = await this.parse(ProjectInit);
37
+ const { flags } = await this.parse(ProjectInit);
38
+ const { id: idArgument, account: accountArgument, force } = flags;
39
+ const { json: jsonFlag, nonInteractive } = (0, flags_1.resolveNonInteractiveAndJsonFlags)(flags);
40
+ if (jsonFlag) {
41
+ (0, json_1.enableJsonOutput)();
42
+ }
26
43
  const { loggedIn: { actor, graphqlClient }, projectDir, } = await this.getContextAsync(ProjectInit, { nonInteractive });
27
- let idForConsistency;
44
+ let result;
28
45
  if (idArgument) {
29
- await (0, projectInitialization_1.initializeWithExplicitIDAsync)(idArgument, projectDir, {
46
+ const status = await (0, projectInitialization_1.initializeWithExplicitIDAsync)(idArgument, projectDir, {
30
47
  force,
31
48
  nonInteractive,
32
49
  });
33
- idForConsistency = idArgument;
50
+ result = { projectId: idArgument, status };
34
51
  }
35
52
  else {
36
- idForConsistency = await (0, projectInitialization_1.initializeWithoutExplicitIDAsync)(graphqlClient, actor, projectDir, {
53
+ result = await (0, projectInitialization_1.initializeWithoutExplicitIDAsync)(graphqlClient, actor, projectDir, {
37
54
  force,
38
55
  nonInteractive,
56
+ accountName: accountArgument,
39
57
  });
40
58
  }
41
- await (0, projectInitialization_1.ensureOwnerSlugConsistencyAsync)(graphqlClient, idForConsistency, projectDir, {
59
+ const { owner, slug } = await (0, projectInitialization_1.ensureOwnerSlugConsistencyAsync)(graphqlClient, result.projectId, projectDir, {
42
60
  force,
43
61
  nonInteractive,
44
62
  });
63
+ if (jsonFlag) {
64
+ (0, json_1.printJsonOnlyOutput)({
65
+ status: result.status,
66
+ projectId: result.projectId,
67
+ owner,
68
+ slug,
69
+ dashboardUrl: (0, url_1.getProjectDashboardUrl)(owner, slug),
70
+ });
71
+ }
45
72
  }
46
73
  }
47
74
  exports.default = ProjectInit;
@@ -0,0 +1,23 @@
1
+ import EasCommand from '../../commandUtils/EasCommand';
2
+ export default class TestFlightCrashes extends EasCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static args: {
6
+ id: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
7
+ };
8
+ static flags: {
9
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
+ 'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
11
+ limit: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
12
+ offset: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
13
+ type: import("@oclif/core/lib/interfaces").OptionFlag<"crash" | "screenshot" | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
14
+ profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
15
+ };
16
+ static contextDefinition: {
17
+ vcsClient: import("../../commandUtils/context/VcsClientContextField").default;
18
+ analytics: import("../../commandUtils/context/AnalyticsContextField").default;
19
+ loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
20
+ privateProjectConfig: import("../../commandUtils/context/PrivateProjectConfigContextField").PrivateProjectConfigContextField;
21
+ };
22
+ runAsync(): Promise<void>;
23
+ }
@@ -0,0 +1,82 @@
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 EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
6
+ const flags_1 = require("../../commandUtils/flags");
7
+ const pagination_1 = require("../../commandUtils/pagination");
8
+ const app_1 = require("../../testflight/app");
9
+ const queries_1 = require("../../testflight/queries");
10
+ const target_1 = require("../../testflight/target");
11
+ const json_1 = require("../../utils/json");
12
+ class TestFlightCrashes extends EasCommand_1.default {
13
+ static description = 'display crashes reported by TestFlight testers, or the full crash log of a single crash';
14
+ static examples = [
15
+ '$ eas testflight:crashes \t # Show the most recent crashes',
16
+ '$ eas testflight:crashes --limit 50 --offset 20 \t # Page through crashes',
17
+ '$ eas testflight:crashes AAo2eIIfGzcb1BzuUv3xrh4 \t # Show the full crash log for one crash',
18
+ '$ eas testflight:crashes --json \t # Print a page of crashes, with paging metadata, as JSON',
19
+ '$ eas testflight:crashes ${{ app_store_connect.beta_feedback.url }} --json \t # Look up whatever an EAS workflow trigger reported',
20
+ ];
21
+ static args = {
22
+ id: core_1.Args.string({
23
+ description: 'ID or App Store Connect API URL of a single submission to show. Accepts ${{ app_store_connect.beta_feedback.id }} or ${{ app_store_connect.beta_feedback.url }} from an EAS workflow trigger.',
24
+ required: false,
25
+ }),
26
+ };
27
+ static flags = {
28
+ type: core_1.Flags.option({
29
+ description: 'Kind of feedback the ID refers to. Only needed when passing a bare ID for screenshot feedback; a URL already encodes it.',
30
+ options: ['crash', 'screenshot'],
31
+ })(),
32
+ profile: core_1.Flags.string({
33
+ char: 'e',
34
+ description: 'Name of the submit profile from eas.json used to resolve the bundle identifier and App Store Connect API key. Defaults to "production".',
35
+ }),
36
+ ...pagination_1.EasPaginatedQueryFlags,
37
+ limit: (0, pagination_1.getLimitFlagWithCustomValues)({ defaultTo: queries_1.TESTFLIGHT_PAGE_SIZE, limit: 200 }),
38
+ ...flags_1.EasNonInteractiveAndJsonFlags,
39
+ };
40
+ static contextDefinition = {
41
+ ...this.ContextOptions.ProjectConfig,
42
+ ...this.ContextOptions.LoggedIn,
43
+ ...this.ContextOptions.Analytics,
44
+ ...this.ContextOptions.Vcs,
45
+ };
46
+ async runAsync() {
47
+ const { args, flags } = await this.parse(TestFlightCrashes);
48
+ const paginatedQueryOptions = (0, pagination_1.getPaginatedQueryOptions)(flags);
49
+ const { json, nonInteractive } = paginatedQueryOptions;
50
+ if (json) {
51
+ (0, json_1.enableJsonOutput)();
52
+ }
53
+ if (flags.type && !args.id) {
54
+ throw new Error('--type only applies when looking up a single submission by ID or URL.');
55
+ }
56
+ // Resolved before authenticating so a malformed ID or URL fails fast.
57
+ const target = args.id
58
+ ? (0, target_1.resolveBetaFeedbackTarget)({ idOrUrl: args.id, type: flags.type, defaultType: 'crash' })
59
+ : null;
60
+ const { loggedIn: { actor, graphqlClient }, privateProjectConfig: { exp, projectId, projectDir }, analytics, vcsClient, } = await this.getContextAsync(TestFlightCrashes, {
61
+ nonInteractive,
62
+ withServerSideEnvironment: null,
63
+ });
64
+ const app = await (0, app_1.resolveTestFlightAppAsync)({
65
+ actor,
66
+ analytics,
67
+ exp,
68
+ graphqlClient,
69
+ nonInteractive,
70
+ profileName: flags.profile,
71
+ projectDir,
72
+ projectId,
73
+ vcsClient,
74
+ });
75
+ if (target) {
76
+ await (0, queries_1.viewAndRenderBetaFeedbackAsync)(app, target, { json });
77
+ return;
78
+ }
79
+ await (0, queries_1.listAndRenderTestFlightCrashesAsync)(app, paginatedQueryOptions);
80
+ }
81
+ }
82
+ exports.default = TestFlightCrashes;
@@ -0,0 +1,23 @@
1
+ import EasCommand from '../../commandUtils/EasCommand';
2
+ export default class TestFlightFeedback extends EasCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static args: {
6
+ id: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
7
+ };
8
+ static flags: {
9
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
+ 'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
11
+ limit: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
12
+ offset: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
13
+ type: import("@oclif/core/lib/interfaces").OptionFlag<"crash" | "screenshot" | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
14
+ profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
15
+ };
16
+ static contextDefinition: {
17
+ vcsClient: import("../../commandUtils/context/VcsClientContextField").default;
18
+ analytics: import("../../commandUtils/context/AnalyticsContextField").default;
19
+ loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
20
+ privateProjectConfig: import("../../commandUtils/context/PrivateProjectConfigContextField").PrivateProjectConfigContextField;
21
+ };
22
+ runAsync(): Promise<void>;
23
+ }
@@ -0,0 +1,82 @@
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 EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
6
+ const flags_1 = require("../../commandUtils/flags");
7
+ const pagination_1 = require("../../commandUtils/pagination");
8
+ const app_1 = require("../../testflight/app");
9
+ const queries_1 = require("../../testflight/queries");
10
+ const target_1 = require("../../testflight/target");
11
+ const json_1 = require("../../utils/json");
12
+ class TestFlightFeedback extends EasCommand_1.default {
13
+ static description = 'display screenshot feedback submitted by TestFlight testers, including their comments, device information, and screenshot URLs';
14
+ static examples = [
15
+ '$ eas testflight:feedback \t # Show the most recent feedback submissions',
16
+ '$ eas testflight:feedback --limit 50 --offset 20 \t # Page through submissions',
17
+ '$ eas testflight:feedback --json \t # Print a page of feedback, with paging metadata, as JSON',
18
+ '$ eas testflight:feedback AD8JvKbr0BK0Cj9OnM6WO6I \t # Show a single submission by ID',
19
+ '$ eas testflight:feedback ${{ app_store_connect.beta_feedback.url }} --json \t # Look up whatever an EAS workflow trigger reported',
20
+ ];
21
+ static args = {
22
+ id: core_1.Args.string({
23
+ description: 'ID or App Store Connect API URL of a single submission to show. Accepts ${{ app_store_connect.beta_feedback.id }} or ${{ app_store_connect.beta_feedback.url }} from an EAS workflow trigger.',
24
+ required: false,
25
+ }),
26
+ };
27
+ static flags = {
28
+ type: core_1.Flags.option({
29
+ description: 'Kind of feedback the ID refers to. Only needed when passing a bare ID for a crash; a URL already encodes it.',
30
+ options: ['crash', 'screenshot'],
31
+ })(),
32
+ profile: core_1.Flags.string({
33
+ char: 'e',
34
+ description: 'Name of the submit profile from eas.json used to resolve the bundle identifier and App Store Connect API key. Defaults to "production".',
35
+ }),
36
+ ...pagination_1.EasPaginatedQueryFlags,
37
+ limit: (0, pagination_1.getLimitFlagWithCustomValues)({ defaultTo: queries_1.TESTFLIGHT_PAGE_SIZE, limit: 200 }),
38
+ ...flags_1.EasNonInteractiveAndJsonFlags,
39
+ };
40
+ static contextDefinition = {
41
+ ...this.ContextOptions.ProjectConfig,
42
+ ...this.ContextOptions.LoggedIn,
43
+ ...this.ContextOptions.Analytics,
44
+ ...this.ContextOptions.Vcs,
45
+ };
46
+ async runAsync() {
47
+ const { args, flags } = await this.parse(TestFlightFeedback);
48
+ const paginatedQueryOptions = (0, pagination_1.getPaginatedQueryOptions)(flags);
49
+ const { json, nonInteractive } = paginatedQueryOptions;
50
+ if (json) {
51
+ (0, json_1.enableJsonOutput)();
52
+ }
53
+ if (flags.type && !args.id) {
54
+ throw new Error('--type only applies when looking up a single submission by ID or URL.');
55
+ }
56
+ // Resolved before authenticating so a malformed ID or URL fails fast.
57
+ const target = args.id
58
+ ? (0, target_1.resolveBetaFeedbackTarget)({ idOrUrl: args.id, type: flags.type, defaultType: 'screenshot' })
59
+ : null;
60
+ const { loggedIn: { actor, graphqlClient }, privateProjectConfig: { exp, projectId, projectDir }, analytics, vcsClient, } = await this.getContextAsync(TestFlightFeedback, {
61
+ nonInteractive,
62
+ withServerSideEnvironment: null,
63
+ });
64
+ const app = await (0, app_1.resolveTestFlightAppAsync)({
65
+ actor,
66
+ analytics,
67
+ exp,
68
+ graphqlClient,
69
+ nonInteractive,
70
+ profileName: flags.profile,
71
+ projectDir,
72
+ projectId,
73
+ vcsClient,
74
+ });
75
+ if (target) {
76
+ await (0, queries_1.viewAndRenderBetaFeedbackAsync)(app, target, { json });
77
+ return;
78
+ }
79
+ await (0, queries_1.listAndRenderTestFlightFeedbackAsync)(app, paginatedQueryOptions);
80
+ }
81
+ }
82
+ exports.default = TestFlightFeedback;