eas-cli 21.2.0 → 21.4.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 +343 -148
- package/build/build/build.js +102 -17
- package/build/commandUtils/context/contextUtils/getProjectIdAsync.js +31 -16
- package/build/commands/observe/events.js +10 -6
- package/build/commands/observe/metrics-summary.js +2 -1
- package/build/commands/observe/metrics.js +3 -2
- package/build/commands/observe/routes.js +3 -2
- package/build/commands/observe/session.js +8 -2
- package/build/commands/project/icon/set.d.ts +15 -0
- package/build/commands/project/icon/set.js +93 -0
- package/build/commands/project/init.d.ts +3 -0
- package/build/commands/project/init.js +34 -7
- package/build/commands/simulator/events.d.ts +16 -0
- package/build/commands/simulator/events.js +136 -0
- package/build/commands/simulator/get.js +2 -0
- package/build/commands/simulator/list.js +2 -0
- package/build/commands/simulator/start.d.ts +1 -0
- package/build/commands/simulator/start.js +8 -0
- package/build/commands/testflight/crashes.d.ts +23 -0
- package/build/commands/testflight/crashes.js +82 -0
- package/build/commands/testflight/feedback.d.ts +23 -0
- package/build/commands/testflight/feedback.js +82 -0
- package/build/graphql/generated.d.ts +370 -254
- package/build/graphql/generated.js +18 -23
- package/build/graphql/mutations/UploadSessionMutation.d.ts +5 -1
- package/build/graphql/mutations/UploadSessionMutation.js +15 -0
- package/build/graphql/queries/AppQuery.d.ts +1 -0
- package/build/graphql/queries/AppQuery.js +19 -0
- package/build/graphql/queries/DeviceRunSessionQuery.d.ts +2 -1
- package/build/graphql/queries/DeviceRunSessionQuery.js +22 -0
- package/build/observe/fetchEvents.js +7 -1
- package/build/observe/fetchMetrics.js +6 -0
- package/build/observe/fetchNavigationRoutes.js +6 -0
- package/build/observe/fetchSessions.d.ts +7 -0
- package/build/observe/fetchSessions.js +16 -0
- package/build/observe/planGating.d.ts +15 -0
- package/build/observe/planGating.js +48 -0
- package/build/project/accountSelection.d.ts +4 -0
- package/build/project/accountSelection.js +56 -0
- package/build/project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync.js +4 -3
- package/build/project/projectInitialization.d.ts +13 -3
- package/build/project/projectInitialization.js +52 -80
- package/build/simulator/events.d.ts +7 -0
- package/build/simulator/events.js +95 -0
- package/build/simulator/utils.js +1 -1
- package/build/testflight/app.d.ts +18 -0
- package/build/testflight/app.js +124 -0
- package/build/testflight/fetch.d.ts +56 -0
- package/build/testflight/fetch.js +116 -0
- package/build/testflight/format.d.ts +4 -0
- package/build/testflight/format.js +104 -0
- package/build/testflight/queries.d.ts +16 -0
- package/build/testflight/queries.js +123 -0
- package/build/testflight/target.d.ts +15 -0
- package/build/testflight/target.js +32 -0
- package/build/uploads.d.ts +7 -1
- package/build/uploads.js +9 -0
- package/build/user/User.d.ts +6 -0
- package/build/user/User.js +18 -0
- package/oclif.manifest.json +2185 -1728
- package/package.json +8 -5
package/build/build/build.js
CHANGED
|
@@ -137,11 +137,14 @@ const SERVER_SIDE_DEFINED_ERRORS = {
|
|
|
137
137
|
VALIDATION_ERROR: errors_1.RequestValidationError,
|
|
138
138
|
};
|
|
139
139
|
function handleBuildRequestError(error, platform) {
|
|
140
|
-
|
|
141
|
-
const
|
|
142
|
-
|
|
140
|
+
logBuildRequestErrorDebugInfo(error);
|
|
141
|
+
const graphQLErrors = Array.isArray(error?.graphQLErrors)
|
|
142
|
+
? error.graphQLErrors
|
|
143
|
+
: [];
|
|
144
|
+
const graphQLErrorCode = graphQLErrors[0]?.extensions?.errorCode;
|
|
145
|
+
if (graphQLErrorCode && graphQLErrorCode in SERVER_SIDE_DEFINED_ERRORS) {
|
|
143
146
|
const ErrorClass = SERVER_SIDE_DEFINED_ERRORS[graphQLErrorCode];
|
|
144
|
-
throw new ErrorClass(
|
|
147
|
+
throw new ErrorClass(graphQLErrors[0]?.message);
|
|
145
148
|
}
|
|
146
149
|
else if (graphQLErrorCode === 'EAS_BUILD_DOWN_FOR_MAINTENANCE') {
|
|
147
150
|
throw new errors_1.EasBuildDownForMaintenanceError(`EAS Build is down for maintenance. Try again later. Check ${(0, log_1.link)('https://status.expo.dev/')} for updates.`);
|
|
@@ -149,22 +152,104 @@ function handleBuildRequestError(error, platform) {
|
|
|
149
152
|
else if (graphQLErrorCode === 'EAS_BUILD_TOO_MANY_PENDING_BUILDS') {
|
|
150
153
|
throw new errors_1.EasBuildTooManyPendingBuildsError(`You have already reached the maximum number of pending ${platform_1.requestedPlatformDisplayNames[platform]} builds for your account. Try again later.`);
|
|
151
154
|
}
|
|
152
|
-
else if (error?.graphQLErrors) {
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
const requestIdLine = graphQLError?.extensions?.requestId
|
|
156
|
-
? `\nRequest ID: ${graphQLError.extensions.requestId}`
|
|
157
|
-
: '';
|
|
158
|
-
const errorMessageLine = graphQLError?.message
|
|
159
|
-
? `\nError message: ${graphQLError.message}`
|
|
160
|
-
: '';
|
|
161
|
-
return `${requestIdLine}${errorMessageLine}`;
|
|
162
|
-
})
|
|
163
|
-
.join('');
|
|
164
|
-
throw new Error(`Build request failed. Make sure you are using the latest eas-cli version. If the problem persists, report the issue.${errorMessage}`);
|
|
155
|
+
else if (Array.isArray(error?.graphQLErrors)) {
|
|
156
|
+
const errorDetails = formatBuildRequestErrorDetails(error, graphQLErrors);
|
|
157
|
+
throw new Error(`Build request failed. Make sure you are using the latest eas-cli version. If the problem persists, report the issue.${errorDetails}`);
|
|
165
158
|
}
|
|
166
159
|
throw error;
|
|
167
160
|
}
|
|
161
|
+
function formatBuildRequestErrorDetails(error, graphQLErrors) {
|
|
162
|
+
const details = graphQLErrors
|
|
163
|
+
.map((graphQLError) => {
|
|
164
|
+
const requestIdLine = graphQLError?.extensions?.requestId
|
|
165
|
+
? `\nRequest ID: ${graphQLError.extensions.requestId}`
|
|
166
|
+
: '';
|
|
167
|
+
const errorMessageLine = graphQLError?.message
|
|
168
|
+
? `\nError message: ${graphQLError.message}`
|
|
169
|
+
: '';
|
|
170
|
+
return `${requestIdLine}${errorMessageLine}`;
|
|
171
|
+
})
|
|
172
|
+
.filter(Boolean);
|
|
173
|
+
if (error?.networkError?.message) {
|
|
174
|
+
details.push(`\nNetwork error: ${error.networkError.message}`);
|
|
175
|
+
}
|
|
176
|
+
const response = error?.response;
|
|
177
|
+
if (response?.status !== undefined || response?.statusText) {
|
|
178
|
+
const status = [response.status, response.statusText]
|
|
179
|
+
.filter(value => value !== undefined && value !== '')
|
|
180
|
+
.join(' ');
|
|
181
|
+
details.push(`\nResponse status: ${status}`);
|
|
182
|
+
}
|
|
183
|
+
const responseRequestId = getResponseRequestId(response);
|
|
184
|
+
const graphQLRequestIds = new Set(graphQLErrors.map(graphQLError => graphQLError?.extensions?.requestId));
|
|
185
|
+
if (responseRequestId && !graphQLRequestIds.has(responseRequestId)) {
|
|
186
|
+
details.push(`\nRequest ID: ${responseRequestId}`);
|
|
187
|
+
}
|
|
188
|
+
if (details.length === 0 && error?.message) {
|
|
189
|
+
details.push(`\nError message: ${error.message}`);
|
|
190
|
+
}
|
|
191
|
+
return details.join('');
|
|
192
|
+
}
|
|
193
|
+
function getResponseRequestId(response) {
|
|
194
|
+
return (response?.headers?.get?.('expo-request-id') ?? response?.headers?.get?.('x-request-id') ?? null);
|
|
195
|
+
}
|
|
196
|
+
function logBuildRequestErrorDebugInfo(error) {
|
|
197
|
+
const debugInfo = collectBuildRequestErrorDebugInfo(error);
|
|
198
|
+
if (debugInfo) {
|
|
199
|
+
log_1.default.debug(`Build request error details:\n${JSON.stringify(debugInfo, null, 2)}`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function collectBuildRequestErrorDebugInfo(error) {
|
|
203
|
+
if (!Array.isArray(error?.graphQLErrors) && !error?.response && !error?.networkError) {
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
const debugInfo = {};
|
|
207
|
+
if (error?.message) {
|
|
208
|
+
debugInfo.message = error.message;
|
|
209
|
+
}
|
|
210
|
+
if (Array.isArray(error?.graphQLErrors)) {
|
|
211
|
+
debugInfo.graphQLErrors = error.graphQLErrors;
|
|
212
|
+
}
|
|
213
|
+
if (error?.networkError) {
|
|
214
|
+
debugInfo.networkError = collectErrorDebugInfo(error.networkError);
|
|
215
|
+
}
|
|
216
|
+
const response = collectResponseDebugInfo(error?.response);
|
|
217
|
+
if (response) {
|
|
218
|
+
debugInfo.response = response;
|
|
219
|
+
}
|
|
220
|
+
return debugInfo;
|
|
221
|
+
}
|
|
222
|
+
function collectErrorDebugInfo(error) {
|
|
223
|
+
const debugInfo = {};
|
|
224
|
+
for (const property of ['name', 'message', 'code', 'type', 'errno', 'syscall', 'stack']) {
|
|
225
|
+
if (error?.[property]) {
|
|
226
|
+
debugInfo[property] = error[property];
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return debugInfo;
|
|
230
|
+
}
|
|
231
|
+
function collectResponseDebugInfo(response) {
|
|
232
|
+
if (!response) {
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
const debugInfo = {};
|
|
236
|
+
for (const property of ['status', 'statusText', 'url']) {
|
|
237
|
+
if (response[property] !== undefined && response[property] !== '') {
|
|
238
|
+
debugInfo[property] = response[property];
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
const headers = {};
|
|
242
|
+
for (const headerName of ['expo-request-id', 'x-request-id', 'content-type']) {
|
|
243
|
+
const headerValue = response?.headers?.get?.(headerName);
|
|
244
|
+
if (headerValue) {
|
|
245
|
+
headers[headerName] = headerValue;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (Object.keys(headers).length > 0) {
|
|
249
|
+
debugInfo.headers = headers;
|
|
250
|
+
}
|
|
251
|
+
return Object.keys(debugInfo).length > 0 ? debugInfo : null;
|
|
252
|
+
}
|
|
168
253
|
async function uploadProjectAsync(ctx) {
|
|
169
254
|
let projectTarballPath;
|
|
170
255
|
try {
|
|
@@ -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
|
|
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
|
|
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");
|
|
@@ -34,7 +35,7 @@ class ObserveEvents extends EasCommand_1.default {
|
|
|
34
35
|
...flags_2.ObserveAppVersionFlag,
|
|
35
36
|
...flags_2.ObserveUpdateIdFlag,
|
|
36
37
|
'session-id': core_1.Flags.string({
|
|
37
|
-
description: 'Filter by session ID',
|
|
38
|
+
description: 'Filter by session ID. When no event name is given, lists the events in the session instead of the event-name summary.',
|
|
38
39
|
}),
|
|
39
40
|
'all-events': core_1.Flags.boolean({
|
|
40
41
|
description: 'When no event name argument is provided, list all events across all event names instead of a summary of event names + counts.',
|
|
@@ -68,13 +69,16 @@ class ObserveEvents extends EasCommand_1.default {
|
|
|
68
69
|
}
|
|
69
70
|
const { daysBack, startTime, endTime } = (0, startAndEndTime_1.resolveTimeRange)(flags);
|
|
70
71
|
const platform = (0, platforms_1.appObservePlatformFromFlag)(flags.platform);
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
// A session ID narrows to a single session, so show that session's events
|
|
73
|
+
// (like --all-events) instead of the account-wide name+count summary, which
|
|
74
|
+
// has no session filter.
|
|
75
|
+
if (!args.eventName && !flags['all-events'] && !flags['session-id']) {
|
|
76
|
+
const { names, isTruncated } = await (0, planGating_1.withObservePlanGateHandlingAsync)(() => ObserveQuery_1.ObserveQuery.customEventNamesAsync(graphqlClient, {
|
|
73
77
|
appId: projectId,
|
|
74
78
|
startTime,
|
|
75
79
|
endTime,
|
|
76
80
|
platform,
|
|
77
|
-
});
|
|
81
|
+
}));
|
|
78
82
|
if (json) {
|
|
79
83
|
(0, json_1.printJsonOnlyOutput)((0, formatCustomEvents_1.buildObserveCustomEventNamesJson)(names, isTruncated));
|
|
80
84
|
}
|
|
@@ -89,7 +93,7 @@ class ObserveEvents extends EasCommand_1.default {
|
|
|
89
93
|
}
|
|
90
94
|
return;
|
|
91
95
|
}
|
|
92
|
-
const { events, pageInfo } = await (0, fetchCustomEvents_1.fetchObserveCustomEventsAsync)(graphqlClient, projectId, {
|
|
96
|
+
const { events, pageInfo } = await (0, planGating_1.withObservePlanGateHandlingAsync)(() => (0, fetchCustomEvents_1.fetchObserveCustomEventsAsync)(graphqlClient, projectId, {
|
|
93
97
|
eventName: args.eventName,
|
|
94
98
|
limit: flags.limit ?? DEFAULT_EVENTS_LIMIT,
|
|
95
99
|
...(flags.after && { after: flags.after }),
|
|
@@ -99,7 +103,7 @@ class ObserveEvents extends EasCommand_1.default {
|
|
|
99
103
|
appVersion: flags['app-version'],
|
|
100
104
|
updateId: flags['update-id'],
|
|
101
105
|
sessionId: flags['session-id'],
|
|
102
|
-
});
|
|
106
|
+
}));
|
|
103
107
|
if (args.eventName && events.length === 0) {
|
|
104
108
|
const { names, isTruncated } = await ObserveQuery_1.ObserveQuery.customEventNamesAsync(graphqlClient, {
|
|
105
109
|
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.
|
|
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
|
|
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
|
|
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
|
-
|
|
50
|
+
result = { projectId: idArgument, status };
|
|
34
51
|
}
|
|
35
52
|
else {
|
|
36
|
-
|
|
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,
|
|
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,16 @@
|
|
|
1
|
+
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
|
+
export default class SimulatorEvents extends EasCommand {
|
|
3
|
+
static hidden: boolean;
|
|
4
|
+
static description: string;
|
|
5
|
+
static flags: {
|
|
6
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
follow: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
};
|
|
11
|
+
static contextDefinition: {
|
|
12
|
+
projectDir: import("../../commandUtils/context/ProjectDirContextField").default;
|
|
13
|
+
loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
|
|
14
|
+
};
|
|
15
|
+
runAsync(): Promise<void>;
|
|
16
|
+
}
|