eas-cli 23.2.0 → 24.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +380 -205
- package/build/build/utils/url.d.ts +1 -0
- package/build/build/utils/url.js +4 -0
- package/build/channel/protection.d.ts +4 -0
- package/build/channel/protection.js +49 -0
- package/build/channel/queries.d.ts +6 -0
- package/build/channel/queries.js +5 -1
- package/build/commands/channel/protect.d.ts +16 -0
- package/build/commands/channel/protect.js +68 -0
- package/build/commands/channel/unprotect.d.ts +16 -0
- package/build/commands/channel/unprotect.js +78 -0
- package/build/commands/observe/errors.d.ts +27 -0
- package/build/commands/observe/errors.js +122 -0
- package/build/commands/observe/event.d.ts +18 -0
- package/build/commands/observe/event.js +149 -0
- package/build/commands/observe/events.d.ts +2 -0
- package/build/commands/observe/events.js +10 -4
- package/build/commands/observe/metrics-summary.d.ts +1 -0
- package/build/commands/observe/metrics-summary.js +3 -2
- package/build/commands/observe/metrics.d.ts +2 -0
- package/build/commands/observe/metrics.js +8 -4
- package/build/commands/observe/routes.d.ts +2 -1
- package/build/commands/observe/routes.js +5 -5
- package/build/commands/observe/session.d.ts +1 -0
- package/build/commands/observe/session.js +14 -8
- package/build/commands/observe/versions.d.ts +1 -0
- package/build/commands/observe/versions.js +3 -2
- package/build/commands/project/status.d.ts +16 -0
- package/build/commands/project/status.js +47 -0
- package/build/commands/simulator/get.js +3 -1
- package/build/commands/simulator/index.js +6 -2
- package/build/credentials/ios/credentials.d.ts +5 -3
- package/build/credentials/ios/utils/printCredentials.js +6 -1
- package/build/graphql/generated.d.ts +2288 -1133
- package/build/graphql/generated.js +48 -17
- package/build/graphql/mutations/RealtimeLogsMutation.d.ts +2 -2
- package/build/graphql/queries/AppStoreConnectApiKeyQuery.d.ts +1 -1
- package/build/graphql/queries/AppStoreConnectApiKeyQuery.js +1 -1
- package/build/graphql/queries/ChannelQuery.js +2 -0
- package/build/graphql/queries/DeviceRunSessionQuery.js +5 -0
- package/build/graphql/queries/ObserveQuery.d.ts +62 -30
- package/build/graphql/queries/ObserveQuery.js +276 -121
- package/build/graphql/queries/SubmissionQuery.d.ts +6 -1
- package/build/graphql/queries/SubmissionQuery.js +41 -0
- package/build/graphql/types/Observe.d.ts +5 -3
- package/build/graphql/types/Observe.js +80 -21
- package/build/graphql/types/UpdateChannelBasicInfo.js +1 -0
- package/build/observe/fetchCustomEvents.d.ts +6 -4
- package/build/observe/fetchCustomEvents.js +4 -2
- package/build/observe/fetchErrors.d.ts +32 -0
- package/build/observe/fetchErrors.js +42 -0
- package/build/observe/fetchEvents.d.ts +9 -6
- package/build/observe/fetchEvents.js +16 -17
- package/build/observe/fetchMetrics.d.ts +2 -2
- package/build/observe/fetchMetrics.js +9 -9
- package/build/observe/fetchNavigationRoutes.d.ts +7 -5
- package/build/observe/fetchNavigationRoutes.js +8 -8
- package/build/observe/fetchSessions.d.ts +13 -11
- package/build/observe/fetchSessions.js +59 -30
- package/build/observe/fetchVersions.d.ts +4 -3
- package/build/observe/fetchVersions.js +7 -11
- package/build/observe/flags.d.ts +6 -0
- package/build/observe/flags.js +12 -2
- package/build/observe/formatCustomEvents.d.ts +16 -10
- package/build/observe/formatCustomEvents.js +61 -28
- package/build/observe/formatErrors.d.ts +97 -0
- package/build/observe/formatErrors.js +203 -0
- package/build/observe/formatEvents.d.ts +11 -5
- package/build/observe/formatEvents.js +46 -18
- package/build/observe/formatMetrics.d.ts +4 -4
- package/build/observe/formatMetrics.js +2 -2
- package/build/observe/formatNavigationRoutes.d.ts +4 -4
- package/build/observe/formatNavigationRoutes.js +3 -3
- package/build/observe/formatSessions.d.ts +3 -3
- package/build/observe/formatSessions.js +8 -8
- package/build/observe/formatVersions.js +2 -2
- package/build/observe/platforms.d.ts +10 -19
- package/build/observe/platforms.js +42 -40
- package/build/project/projectStatus.d.ts +96 -0
- package/build/project/projectStatus.js +314 -0
- package/build/simulator/utils.d.ts +11 -0
- package/build/simulator/utils.js +44 -5
- package/build/submit/utils/urls.js +2 -3
- package/build/utils/centrifuge.d.ts +2 -2
- package/oclif.manifest.json +2502 -1986
- package/package.json +7 -7
- package/build/chat/chatClient.d.ts +0 -37
- package/build/chat/chatClient.js +0 -359
- package/build/chat/detectProject.d.ts +0 -5
- package/build/chat/detectProject.js +0 -41
- package/build/chat/renderMarkdown.d.ts +0 -7
- package/build/chat/renderMarkdown.js +0 -47
- package/build/chat/replInput.d.ts +0 -10
- package/build/chat/replInput.js +0 -52
- package/build/commands/chat.d.ts +0 -18
- package/build/commands/chat.js +0 -221
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
|
2
|
+
import { WorkflowRunResult } from '../commandUtils/workflow/types';
|
|
3
|
+
import { AppPlatform, BuildStatus, DistributionType, SubmissionAndroidReleaseStatus, SubmissionStatus } from '../graphql/generated';
|
|
4
|
+
export declare const PROJECT_STATUS_DEFAULT_LIMIT = 3;
|
|
5
|
+
export interface ProjectStatusSummary {
|
|
6
|
+
generatedAt: string;
|
|
7
|
+
limit: number;
|
|
8
|
+
hasMore: {
|
|
9
|
+
productionBuilds: boolean;
|
|
10
|
+
developmentBuilds: boolean;
|
|
11
|
+
workflowRuns: boolean;
|
|
12
|
+
submissions: boolean;
|
|
13
|
+
updates: boolean;
|
|
14
|
+
};
|
|
15
|
+
project: {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
fullName: string;
|
|
19
|
+
slug: string;
|
|
20
|
+
account: string;
|
|
21
|
+
url: string;
|
|
22
|
+
};
|
|
23
|
+
productionBuilds: BuildStatusSummary[];
|
|
24
|
+
developmentBuilds: BuildStatusSummary[];
|
|
25
|
+
workflowRuns: WorkflowRunStatusSummary[];
|
|
26
|
+
submissions: SubmissionStatusSummary[];
|
|
27
|
+
updates: UpdateStatusSummary[];
|
|
28
|
+
}
|
|
29
|
+
interface ActivityErrorSummary {
|
|
30
|
+
code: string | null;
|
|
31
|
+
message: string | null;
|
|
32
|
+
}
|
|
33
|
+
interface BuildStatusSummary {
|
|
34
|
+
id: string;
|
|
35
|
+
platform: AppPlatform;
|
|
36
|
+
status: BuildStatus;
|
|
37
|
+
distribution: DistributionType | null;
|
|
38
|
+
buildProfile: string | null;
|
|
39
|
+
appVersion: string | null;
|
|
40
|
+
appBuildVersion: string | null;
|
|
41
|
+
runtimeVersion: string | null;
|
|
42
|
+
sdkVersion: string | null;
|
|
43
|
+
channel: string | null;
|
|
44
|
+
gitCommitHash: string | null;
|
|
45
|
+
gitCommitMessage: string | null;
|
|
46
|
+
message: string | null;
|
|
47
|
+
initiatingActor: string | null;
|
|
48
|
+
createdAt: string;
|
|
49
|
+
completedAt: string | null;
|
|
50
|
+
url: string;
|
|
51
|
+
error: (ActivityErrorSummary & {
|
|
52
|
+
docsUrl: string | null;
|
|
53
|
+
}) | null;
|
|
54
|
+
}
|
|
55
|
+
interface SubmissionStatusSummary {
|
|
56
|
+
id: string;
|
|
57
|
+
platform: AppPlatform;
|
|
58
|
+
status: SubmissionStatus;
|
|
59
|
+
appIdentifier: string | null;
|
|
60
|
+
androidTrack: string | null;
|
|
61
|
+
androidReleaseStatus: SubmissionAndroidReleaseStatus | null;
|
|
62
|
+
rollout: number | null;
|
|
63
|
+
buildId: string | null;
|
|
64
|
+
initiatingActor: string | null;
|
|
65
|
+
createdAt: string;
|
|
66
|
+
completedAt: string | null;
|
|
67
|
+
url: string;
|
|
68
|
+
error: ActivityErrorSummary | null;
|
|
69
|
+
}
|
|
70
|
+
interface WorkflowRunStatusSummary extends WorkflowRunResult {
|
|
71
|
+
errors: {
|
|
72
|
+
title: string | null;
|
|
73
|
+
message: string;
|
|
74
|
+
}[];
|
|
75
|
+
url: string;
|
|
76
|
+
}
|
|
77
|
+
interface UpdateStatusSummary {
|
|
78
|
+
group: string;
|
|
79
|
+
branch: string;
|
|
80
|
+
message: string | null;
|
|
81
|
+
runtimeVersion: string;
|
|
82
|
+
platforms: string[];
|
|
83
|
+
isRollBackToEmbedded: boolean;
|
|
84
|
+
gitCommitHash: string | null;
|
|
85
|
+
rolloutPercentage: number | null;
|
|
86
|
+
environment: unknown | null;
|
|
87
|
+
initiatingActor: string | null;
|
|
88
|
+
createdAt: string;
|
|
89
|
+
url: string;
|
|
90
|
+
}
|
|
91
|
+
export declare function getProjectStatusAsync(graphqlClient: ExpoGraphqlClient, { projectId, limit }: {
|
|
92
|
+
projectId: string;
|
|
93
|
+
limit: number;
|
|
94
|
+
}): Promise<ProjectStatusSummary>;
|
|
95
|
+
export declare function printProjectStatusAsText(status: ProjectStatusSummary): void;
|
|
96
|
+
export {};
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PROJECT_STATUS_DEFAULT_LIMIT = void 0;
|
|
4
|
+
exports.getProjectStatusAsync = getProjectStatusAsync;
|
|
5
|
+
exports.printProjectStatusAsText = printProjectStatusAsText;
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
|
+
const url_1 = require("../build/utils/url");
|
|
9
|
+
const utils_1 = require("../commandUtils/workflow/utils");
|
|
10
|
+
const generated_1 = require("../graphql/generated");
|
|
11
|
+
const AppQuery_1 = require("../graphql/queries/AppQuery");
|
|
12
|
+
const BuildQuery_1 = require("../graphql/queries/BuildQuery");
|
|
13
|
+
const SubmissionQuery_1 = require("../graphql/queries/SubmissionQuery");
|
|
14
|
+
const UpdateQuery_1 = require("../graphql/queries/UpdateQuery");
|
|
15
|
+
const log_1 = tslib_1.__importDefault(require("../log"));
|
|
16
|
+
const platform_1 = require("../platform");
|
|
17
|
+
const User_1 = require("../user/User");
|
|
18
|
+
const date_1 = require("../utils/date");
|
|
19
|
+
exports.PROJECT_STATUS_DEFAULT_LIMIT = 3;
|
|
20
|
+
async function getProjectStatusAsync(graphqlClient, { projectId, limit }) {
|
|
21
|
+
const queryLimitForHasMore = limit + 1;
|
|
22
|
+
const [app, productionBuilds, developmentBuilds, workflowRuns, submissions, updateGroups] = await Promise.all([
|
|
23
|
+
AppQuery_1.AppQuery.byIdAsync(graphqlClient, projectId),
|
|
24
|
+
BuildQuery_1.BuildQuery.viewBuildsOnAppAsync(graphqlClient, {
|
|
25
|
+
appId: projectId,
|
|
26
|
+
limit: queryLimitForHasMore,
|
|
27
|
+
offset: 0,
|
|
28
|
+
filter: { developmentClient: false, distribution: generated_1.DistributionType.Store },
|
|
29
|
+
}),
|
|
30
|
+
BuildQuery_1.BuildQuery.viewBuildsOnAppAsync(graphqlClient, {
|
|
31
|
+
appId: projectId,
|
|
32
|
+
limit: queryLimitForHasMore,
|
|
33
|
+
offset: 0,
|
|
34
|
+
filter: { developmentClient: true },
|
|
35
|
+
}),
|
|
36
|
+
AppQuery_1.AppQuery.byIdWorkflowRunsFilteredByStatusAsync(graphqlClient, projectId, undefined, queryLimitForHasMore),
|
|
37
|
+
SubmissionQuery_1.SubmissionQuery.forProjectStatusAsync(graphqlClient, projectId, {
|
|
38
|
+
limit: queryLimitForHasMore,
|
|
39
|
+
offset: 0,
|
|
40
|
+
}),
|
|
41
|
+
UpdateQuery_1.UpdateQuery.viewUpdateGroupsOnAppAsync(graphqlClient, {
|
|
42
|
+
appId: projectId,
|
|
43
|
+
limit: queryLimitForHasMore,
|
|
44
|
+
offset: 0,
|
|
45
|
+
}),
|
|
46
|
+
]);
|
|
47
|
+
const accountName = app.ownerAccount.name;
|
|
48
|
+
const projectName = app.slug;
|
|
49
|
+
const limitedWorkflowRuns = workflowRuns.slice(0, limit);
|
|
50
|
+
return {
|
|
51
|
+
generatedAt: new Date().toISOString(),
|
|
52
|
+
limit,
|
|
53
|
+
hasMore: {
|
|
54
|
+
productionBuilds: productionBuilds.length > limit,
|
|
55
|
+
developmentBuilds: developmentBuilds.length > limit,
|
|
56
|
+
workflowRuns: workflowRuns.length > limit,
|
|
57
|
+
submissions: submissions.length > limit,
|
|
58
|
+
updates: updateGroups.length > limit,
|
|
59
|
+
},
|
|
60
|
+
project: {
|
|
61
|
+
id: app.id,
|
|
62
|
+
name: app.name,
|
|
63
|
+
fullName: app.fullName,
|
|
64
|
+
slug: app.slug,
|
|
65
|
+
account: accountName,
|
|
66
|
+
url: (0, url_1.getProjectDashboardUrl)(accountName, projectName),
|
|
67
|
+
},
|
|
68
|
+
productionBuilds: productionBuilds.slice(0, limit).map(toBuildSummary),
|
|
69
|
+
developmentBuilds: developmentBuilds.slice(0, limit).map(toBuildSummary),
|
|
70
|
+
workflowRuns: (0, utils_1.processWorkflowRuns)(limitedWorkflowRuns).map((run, index) => ({
|
|
71
|
+
...run,
|
|
72
|
+
errors: limitedWorkflowRuns[index].errors.map(error => ({
|
|
73
|
+
title: error.title ?? null,
|
|
74
|
+
message: error.message,
|
|
75
|
+
})),
|
|
76
|
+
url: (0, url_1.getWorkflowRunUrl)(accountName, projectName, run.id),
|
|
77
|
+
})),
|
|
78
|
+
submissions: submissions
|
|
79
|
+
.slice(0, limit)
|
|
80
|
+
.map(submission => toSubmissionSummary(submission, accountName, projectName)),
|
|
81
|
+
updates: updateGroups
|
|
82
|
+
.slice(0, limit)
|
|
83
|
+
.map(updateGroup => toUpdateSummary(updateGroup, accountName, projectName)),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function toBuildSummary(build) {
|
|
87
|
+
return {
|
|
88
|
+
id: build.id,
|
|
89
|
+
platform: build.platform,
|
|
90
|
+
status: build.status,
|
|
91
|
+
distribution: build.distribution ?? null,
|
|
92
|
+
buildProfile: build.buildProfile ?? null,
|
|
93
|
+
appVersion: build.appVersion ?? null,
|
|
94
|
+
appBuildVersion: build.appBuildVersion ?? null,
|
|
95
|
+
runtimeVersion: build.runtime?.version ?? null,
|
|
96
|
+
sdkVersion: build.sdkVersion ?? null,
|
|
97
|
+
channel: build.updateChannel?.name ?? null,
|
|
98
|
+
gitCommitHash: build.gitCommitHash ?? null,
|
|
99
|
+
gitCommitMessage: build.gitCommitMessage?.split('\n')[0] ?? null,
|
|
100
|
+
message: build.message ?? null,
|
|
101
|
+
initiatingActor: build.initiatingActor?.displayName ?? null,
|
|
102
|
+
createdAt: build.createdAt,
|
|
103
|
+
completedAt: build.completedAt ?? null,
|
|
104
|
+
url: (0, url_1.getBuildLogsUrl)(build),
|
|
105
|
+
error: build.error
|
|
106
|
+
? {
|
|
107
|
+
code: build.error.errorCode,
|
|
108
|
+
message: build.error.message,
|
|
109
|
+
docsUrl: build.error.docsUrl ?? null,
|
|
110
|
+
}
|
|
111
|
+
: null,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function toSubmissionSummary(submission, accountName, projectName) {
|
|
115
|
+
return {
|
|
116
|
+
id: submission.id,
|
|
117
|
+
platform: submission.platform,
|
|
118
|
+
status: submission.status,
|
|
119
|
+
appIdentifier: submission.androidConfig?.applicationIdentifier ??
|
|
120
|
+
submission.iosConfig?.ascAppIdentifier ??
|
|
121
|
+
null,
|
|
122
|
+
androidTrack: submission.androidConfig?.track ?? null,
|
|
123
|
+
androidReleaseStatus: submission.androidConfig?.releaseStatus ?? null,
|
|
124
|
+
rollout: submission.androidConfig?.rollout ?? null,
|
|
125
|
+
buildId: submission.submittedBuild?.id ?? null,
|
|
126
|
+
initiatingActor: submission.initiatingActor?.displayName ?? null,
|
|
127
|
+
createdAt: submission.createdAt,
|
|
128
|
+
completedAt: submission.completedAt ?? null,
|
|
129
|
+
url: (0, url_1.getSubmissionUrl)(accountName, projectName, submission.id),
|
|
130
|
+
error: submission.error
|
|
131
|
+
? {
|
|
132
|
+
code: submission.error.errorCode ?? null,
|
|
133
|
+
message: submission.error.message ?? null,
|
|
134
|
+
}
|
|
135
|
+
: null,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function toUpdateSummary(updateGroup, accountName, projectName) {
|
|
139
|
+
const representativeUpdate = updateGroup[0];
|
|
140
|
+
const platforms = [...new Set(updateGroup.map(update => update.platform))].sort();
|
|
141
|
+
return {
|
|
142
|
+
group: representativeUpdate.group,
|
|
143
|
+
branch: representativeUpdate.branch.name,
|
|
144
|
+
message: representativeUpdate.message ?? null,
|
|
145
|
+
runtimeVersion: representativeUpdate.runtime.version,
|
|
146
|
+
platforms,
|
|
147
|
+
isRollBackToEmbedded: representativeUpdate.isRollBackToEmbedded,
|
|
148
|
+
gitCommitHash: representativeUpdate.gitCommitHash ?? null,
|
|
149
|
+
rolloutPercentage: representativeUpdate.rolloutPercentage ?? null,
|
|
150
|
+
environment: representativeUpdate.environment ?? null,
|
|
151
|
+
initiatingActor: representativeUpdate.actor
|
|
152
|
+
? (0, User_1.getActorDisplayName)(representativeUpdate.actor)
|
|
153
|
+
: null,
|
|
154
|
+
createdAt: representativeUpdate.createdAt,
|
|
155
|
+
url: (0, url_1.getUpdateGroupUrl)(accountName, projectName, representativeUpdate.group),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function printProjectStatusAsText(status) {
|
|
159
|
+
log_1.default.addNewLineIfNone();
|
|
160
|
+
log_1.default.log(chalk_1.default.bold(status.project.fullName));
|
|
161
|
+
log_1.default.log(chalk_1.default.dim(status.project.url));
|
|
162
|
+
renderSection('Production builds', status.productionBuilds, renderBuild, status.hasMore.productionBuilds);
|
|
163
|
+
renderSection('Development builds', status.developmentBuilds, renderBuild, status.hasMore.developmentBuilds);
|
|
164
|
+
renderSection('Workflow runs', status.workflowRuns, renderWorkflowRun, status.hasMore.workflowRuns);
|
|
165
|
+
renderSection('Submissions', status.submissions, renderSubmission, status.hasMore.submissions);
|
|
166
|
+
renderSection('Updates', status.updates, renderUpdate, status.hasMore.updates);
|
|
167
|
+
}
|
|
168
|
+
function renderSection(title, items, renderItem, hasMore) {
|
|
169
|
+
log_1.default.newLine();
|
|
170
|
+
log_1.default.log(chalk_1.default.bold(title));
|
|
171
|
+
if (items.length === 0) {
|
|
172
|
+
log_1.default.log(chalk_1.default.dim(' None'));
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
for (const item of items) {
|
|
176
|
+
log_1.default.log(renderItem(item));
|
|
177
|
+
}
|
|
178
|
+
if (hasMore) {
|
|
179
|
+
log_1.default.log(chalk_1.default.dim(' More available; use --limit to show more.'));
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
function renderBuild(build) {
|
|
183
|
+
const lines = [
|
|
184
|
+
` ${joinMeta([
|
|
185
|
+
colorBuildStatus(build.status),
|
|
186
|
+
platform_1.appPlatformDisplayNames[build.platform],
|
|
187
|
+
build.buildProfile,
|
|
188
|
+
timeAgo(build.createdAt),
|
|
189
|
+
])}`,
|
|
190
|
+
];
|
|
191
|
+
const version = build.appVersion
|
|
192
|
+
? `${build.appVersion}${build.appBuildVersion ? ` (${build.appBuildVersion})` : ''}`
|
|
193
|
+
: null;
|
|
194
|
+
if (version) {
|
|
195
|
+
lines.push(` ${chalk_1.default.dim('version')} ${version}`);
|
|
196
|
+
}
|
|
197
|
+
if (build.gitCommitMessage) {
|
|
198
|
+
lines.push(` ${chalk_1.default.dim(shortHash(build.gitCommitHash))} ${build.gitCommitMessage}`);
|
|
199
|
+
}
|
|
200
|
+
if (build.error?.message) {
|
|
201
|
+
lines.push(` ${chalk_1.default.red(build.error.message)}`);
|
|
202
|
+
}
|
|
203
|
+
lines.push(` ${chalk_1.default.dim(build.url)}`);
|
|
204
|
+
return lines.join('\n');
|
|
205
|
+
}
|
|
206
|
+
function renderWorkflowRun(run) {
|
|
207
|
+
const lines = [
|
|
208
|
+
` ${joinMeta([
|
|
209
|
+
colorWorkflowStatus(run.status),
|
|
210
|
+
run.workflowName ?? run.workflowFileName,
|
|
211
|
+
timeAgo(run.startedAt),
|
|
212
|
+
])}`,
|
|
213
|
+
];
|
|
214
|
+
if (run.gitCommitMessage) {
|
|
215
|
+
lines.push(` ${chalk_1.default.dim(shortHash(run.gitCommitHash))} ${run.gitCommitMessage}`);
|
|
216
|
+
}
|
|
217
|
+
for (const error of run.errors) {
|
|
218
|
+
lines.push(` ${chalk_1.default.red(error.message)}`);
|
|
219
|
+
}
|
|
220
|
+
lines.push(` ${chalk_1.default.dim(run.url)}`);
|
|
221
|
+
return lines.join('\n');
|
|
222
|
+
}
|
|
223
|
+
function renderSubmission(submission) {
|
|
224
|
+
const lines = [
|
|
225
|
+
` ${joinMeta([
|
|
226
|
+
colorSubmissionStatus(submission.status),
|
|
227
|
+
platform_1.appPlatformDisplayNames[submission.platform],
|
|
228
|
+
submission.androidTrack ? `track: ${submission.androidTrack}` : null,
|
|
229
|
+
timeAgo(submission.createdAt),
|
|
230
|
+
])}`,
|
|
231
|
+
];
|
|
232
|
+
if (submission.buildId) {
|
|
233
|
+
lines.push(` ${chalk_1.default.dim('build')} ${submission.buildId}`);
|
|
234
|
+
}
|
|
235
|
+
if (submission.error?.message) {
|
|
236
|
+
lines.push(` ${chalk_1.default.red(submission.error.message)}`);
|
|
237
|
+
}
|
|
238
|
+
lines.push(` ${chalk_1.default.dim(submission.url)}`);
|
|
239
|
+
return lines.join('\n');
|
|
240
|
+
}
|
|
241
|
+
function renderUpdate(update) {
|
|
242
|
+
const lines = [
|
|
243
|
+
` ${joinMeta([
|
|
244
|
+
chalk_1.default.cyan(update.branch),
|
|
245
|
+
update.platforms.join(', '),
|
|
246
|
+
`runtime: ${update.runtimeVersion}`,
|
|
247
|
+
timeAgo(update.createdAt),
|
|
248
|
+
])}`,
|
|
249
|
+
];
|
|
250
|
+
const message = update.isRollBackToEmbedded ? 'Roll back to embedded' : update.message;
|
|
251
|
+
if (message) {
|
|
252
|
+
lines.push(` ${chalk_1.default.dim(shortHash(update.gitCommitHash))} ${message}`);
|
|
253
|
+
}
|
|
254
|
+
lines.push(` ${chalk_1.default.dim(update.url)}`);
|
|
255
|
+
return lines.join('\n');
|
|
256
|
+
}
|
|
257
|
+
function joinMeta(parts) {
|
|
258
|
+
return parts.filter((part) => Boolean(part)).join(chalk_1.default.dim(' · '));
|
|
259
|
+
}
|
|
260
|
+
function timeAgo(isoDate) {
|
|
261
|
+
if (!isoDate) {
|
|
262
|
+
return null;
|
|
263
|
+
}
|
|
264
|
+
return `${(0, date_1.fromNow)(new Date(isoDate))} ago`;
|
|
265
|
+
}
|
|
266
|
+
function shortHash(hash) {
|
|
267
|
+
return hash ? hash.slice(0, 7) : '-------';
|
|
268
|
+
}
|
|
269
|
+
function colorBuildStatus(status) {
|
|
270
|
+
switch (status) {
|
|
271
|
+
case generated_1.BuildStatus.Finished:
|
|
272
|
+
return chalk_1.default.green('finished');
|
|
273
|
+
case generated_1.BuildStatus.Errored:
|
|
274
|
+
return chalk_1.default.red('errored');
|
|
275
|
+
case generated_1.BuildStatus.Canceled:
|
|
276
|
+
case generated_1.BuildStatus.PendingCancel:
|
|
277
|
+
return chalk_1.default.gray('canceled');
|
|
278
|
+
case generated_1.BuildStatus.New:
|
|
279
|
+
case generated_1.BuildStatus.InQueue:
|
|
280
|
+
case generated_1.BuildStatus.InProgress:
|
|
281
|
+
return chalk_1.default.blue(status.toLowerCase().replace(/_/g, ' '));
|
|
282
|
+
default:
|
|
283
|
+
return String(status).toLowerCase().replace(/_/g, ' ');
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
function colorSubmissionStatus(status) {
|
|
287
|
+
switch (status) {
|
|
288
|
+
case generated_1.SubmissionStatus.Finished:
|
|
289
|
+
return chalk_1.default.green('finished');
|
|
290
|
+
case generated_1.SubmissionStatus.Errored:
|
|
291
|
+
return chalk_1.default.red('errored');
|
|
292
|
+
case generated_1.SubmissionStatus.Canceled:
|
|
293
|
+
return chalk_1.default.gray('canceled');
|
|
294
|
+
default:
|
|
295
|
+
return chalk_1.default.blue(status.toLowerCase().replace(/_/g, ' '));
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
function colorWorkflowStatus(status) {
|
|
299
|
+
switch (status) {
|
|
300
|
+
case generated_1.WorkflowRunStatus.Success:
|
|
301
|
+
return chalk_1.default.green('success');
|
|
302
|
+
case generated_1.WorkflowRunStatus.Failure:
|
|
303
|
+
return chalk_1.default.red('failure');
|
|
304
|
+
case generated_1.WorkflowRunStatus.Canceled:
|
|
305
|
+
return chalk_1.default.gray('canceled');
|
|
306
|
+
case generated_1.WorkflowRunStatus.ActionRequired:
|
|
307
|
+
return chalk_1.default.yellow('action required');
|
|
308
|
+
case generated_1.WorkflowRunStatus.New:
|
|
309
|
+
case generated_1.WorkflowRunStatus.InProgress:
|
|
310
|
+
return chalk_1.default.blue(status.toLowerCase().replace(/_/g, ' '));
|
|
311
|
+
default:
|
|
312
|
+
return status.toLowerCase().replace(/_/g, ' ');
|
|
313
|
+
}
|
|
314
|
+
}
|
|
@@ -15,5 +15,16 @@ export declare const DEVICE_RUN_SESSION_RESOURCE_CLASS_FLAG_VALUES: Record<Devic
|
|
|
15
15
|
export declare const DEVICE_RUN_SESSION_RESOURCE_CLASS_BY_FLAG_VALUE: Record<string, DeviceRunSessionResourceClass>;
|
|
16
16
|
export declare function getRemoteSessionEnvironmentVariables(remoteConfig: DeviceRunSessionRemoteConfig): Record<string, string>;
|
|
17
17
|
type RemoteSessionInstructionsConfigType = 'env' | 'dotenv';
|
|
18
|
+
/**
|
|
19
|
+
* Preview link for a session. A gated serve-sim needs the session token, and a browser cannot send
|
|
20
|
+
* a header on a page load, so it rides the query. serve-sim swaps it for a cookie on the first load.
|
|
21
|
+
*/
|
|
22
|
+
export declare function formatPreviewUrl(url: string, token: string | null | undefined): string;
|
|
23
|
+
/**
|
|
24
|
+
* Remote config for `--json`. The preview URL carries the token and the standalone token field is
|
|
25
|
+
* dropped, so a consumer gets one URL that works rather than a bare URL that 401s next to a secret
|
|
26
|
+
* it has to know to combine.
|
|
27
|
+
*/
|
|
28
|
+
export declare function sanitizeRemoteConfigForJson(remoteConfig: DeviceRunSessionRemoteConfig): DeviceRunSessionRemoteConfig;
|
|
18
29
|
export declare function formatRemoteSessionInstructions(remoteConfig: DeviceRunSessionRemoteConfig, configType: RemoteSessionInstructionsConfigType): string;
|
|
19
30
|
export {};
|
package/build/simulator/utils.js
CHANGED
|
@@ -4,6 +4,8 @@ exports.DEVICE_RUN_SESSION_RESOURCE_CLASS_BY_FLAG_VALUE = exports.DEVICE_RUN_SES
|
|
|
4
4
|
exports.formatSimulatorUnavailableMessage = formatSimulatorUnavailableMessage;
|
|
5
5
|
exports.deviceRunSessionTypeToFlagValue = deviceRunSessionTypeToFlagValue;
|
|
6
6
|
exports.getRemoteSessionEnvironmentVariables = getRemoteSessionEnvironmentVariables;
|
|
7
|
+
exports.formatPreviewUrl = formatPreviewUrl;
|
|
8
|
+
exports.sanitizeRemoteConfigForJson = sanitizeRemoteConfigForJson;
|
|
7
9
|
exports.formatRemoteSessionInstructions = formatRemoteSessionInstructions;
|
|
8
10
|
const generated_1 = require("../graphql/generated");
|
|
9
11
|
const log_1 = require("../log");
|
|
@@ -59,6 +61,43 @@ function getRemoteSessionEnvironmentVariables(remoteConfig) {
|
|
|
59
61
|
return {};
|
|
60
62
|
}
|
|
61
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Preview link for a session. A gated serve-sim needs the session token, and a browser cannot send
|
|
66
|
+
* a header on a page load, so it rides the query. serve-sim swaps it for a cookie on the first load.
|
|
67
|
+
*/
|
|
68
|
+
function formatPreviewUrl(url, token) {
|
|
69
|
+
if (!token) {
|
|
70
|
+
return url;
|
|
71
|
+
}
|
|
72
|
+
const withToken = new URL(url);
|
|
73
|
+
withToken.searchParams.set('token', token);
|
|
74
|
+
return withToken.toString();
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Remote config for `--json`. The preview URL carries the token and the standalone token field is
|
|
78
|
+
* dropped, so a consumer gets one URL that works rather than a bare URL that 401s next to a secret
|
|
79
|
+
* it has to know to combine.
|
|
80
|
+
*/
|
|
81
|
+
function sanitizeRemoteConfigForJson(remoteConfig) {
|
|
82
|
+
switch (remoteConfig.__typename) {
|
|
83
|
+
case 'ServeSimRunSessionRemoteConfig':
|
|
84
|
+
case 'WebPreviewOnlyRunSessionRemoteConfig': {
|
|
85
|
+
const { previewToken, ...rest } = remoteConfig;
|
|
86
|
+
return { ...rest, previewUrl: formatPreviewUrl(remoteConfig.previewUrl, previewToken) };
|
|
87
|
+
}
|
|
88
|
+
case 'AgentDeviceRunSessionRemoteConfig':
|
|
89
|
+
case 'ArgentRunSessionRemoteConfig':
|
|
90
|
+
case 'AppiumRunSessionRemoteConfig': {
|
|
91
|
+
const { webPreviewToken, ...rest } = remoteConfig;
|
|
92
|
+
return {
|
|
93
|
+
...rest,
|
|
94
|
+
webPreviewUrl: remoteConfig.webPreviewUrl
|
|
95
|
+
? formatPreviewUrl(remoteConfig.webPreviewUrl, webPreviewToken)
|
|
96
|
+
: remoteConfig.webPreviewUrl,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
62
101
|
function formatRemoteSessionInstructions(remoteConfig, configType) {
|
|
63
102
|
switch (remoteConfig.__typename) {
|
|
64
103
|
case 'AgentDeviceRunSessionRemoteConfig': {
|
|
@@ -75,7 +114,7 @@ function formatRemoteSessionInstructions(remoteConfig, configType) {
|
|
|
75
114
|
...Object.entries(environmentVariables).map(([key, value]) => `export ${key}='${value}'`),
|
|
76
115
|
];
|
|
77
116
|
if (remoteConfig.webPreviewUrl) {
|
|
78
|
-
lines.push('', '🌐 Open the following URL in your browser to preview the simulator:', '', remoteConfig.webPreviewUrl);
|
|
117
|
+
lines.push('', '🌐 Open the following URL in your browser to preview the simulator:', '', formatPreviewUrl(remoteConfig.webPreviewUrl, remoteConfig.webPreviewToken));
|
|
79
118
|
}
|
|
80
119
|
return lines.join('\n');
|
|
81
120
|
}
|
|
@@ -105,7 +144,7 @@ function formatRemoteSessionInstructions(remoteConfig, configType) {
|
|
|
105
144
|
...Object.entries(environmentVariables).map(([key, value]) => `export ${key}='${value}'`),
|
|
106
145
|
];
|
|
107
146
|
if (remoteConfig.webPreviewUrl) {
|
|
108
|
-
lines.push('', '🌐 Open the following URL in your browser to preview the simulator:', '', remoteConfig.webPreviewUrl);
|
|
147
|
+
lines.push('', '🌐 Open the following URL in your browser to preview the simulator:', '', formatPreviewUrl(remoteConfig.webPreviewUrl, remoteConfig.webPreviewToken));
|
|
109
148
|
}
|
|
110
149
|
return lines.join('\n');
|
|
111
150
|
}
|
|
@@ -125,7 +164,7 @@ function formatRemoteSessionInstructions(remoteConfig, configType) {
|
|
|
125
164
|
'<appium-client> [args...]',
|
|
126
165
|
];
|
|
127
166
|
if (remoteConfig.webPreviewUrl) {
|
|
128
|
-
lines.push('', 'Open the simulator preview:', '', remoteConfig.webPreviewUrl);
|
|
167
|
+
lines.push('', 'Open the simulator preview:', '', formatPreviewUrl(remoteConfig.webPreviewUrl, remoteConfig.webPreviewToken));
|
|
129
168
|
}
|
|
130
169
|
return lines.join('\n');
|
|
131
170
|
}
|
|
@@ -133,13 +172,13 @@ function formatRemoteSessionInstructions(remoteConfig, configType) {
|
|
|
133
172
|
return [
|
|
134
173
|
'🌐 Open the following URL in your browser to access the simulator:',
|
|
135
174
|
'',
|
|
136
|
-
remoteConfig.previewUrl,
|
|
175
|
+
formatPreviewUrl(remoteConfig.previewUrl, remoteConfig.previewToken),
|
|
137
176
|
].join('\n');
|
|
138
177
|
case 'WebPreviewOnlyRunSessionRemoteConfig':
|
|
139
178
|
return [
|
|
140
179
|
'🌐 Open the following URL in your browser to access the simulator:',
|
|
141
180
|
'',
|
|
142
|
-
remoteConfig.previewUrl,
|
|
181
|
+
formatPreviewUrl(remoteConfig.previewUrl, remoteConfig.previewToken),
|
|
143
182
|
].join('\n');
|
|
144
183
|
}
|
|
145
184
|
}
|
|
@@ -3,8 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.printSubmissionDetailsUrls = printSubmissionDetailsUrls;
|
|
4
4
|
exports.getSubmissionDetailsUrl = getSubmissionDetailsUrl;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
|
-
const url_1 = require("url");
|
|
7
|
-
const api_1 = require("../../api");
|
|
6
|
+
const url_1 = require("../../build/utils/url");
|
|
8
7
|
const log_1 = tslib_1.__importStar(require("../../log"));
|
|
9
8
|
const platform_1 = require("../../platform");
|
|
10
9
|
function printSubmissionDetailsUrls(submissions) {
|
|
@@ -20,5 +19,5 @@ function printSubmissionDetailsUrls(submissions) {
|
|
|
20
19
|
}
|
|
21
20
|
function getSubmissionDetailsUrl(submission) {
|
|
22
21
|
const { id, app } = submission;
|
|
23
|
-
return
|
|
22
|
+
return (0, url_1.getSubmissionUrl)(app.ownerAccount.name, app.slug, id);
|
|
24
23
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
|
2
|
-
import {
|
|
2
|
+
import { RealtimeLogsMutation_GenerateCentrifugoSubscriptionTokenArgs } from '../graphql/generated';
|
|
3
3
|
export type RealtimeLogsSubscription = {
|
|
4
4
|
close: () => void;
|
|
5
5
|
};
|
|
6
6
|
export type RealtimeLogsClient = {
|
|
7
|
-
subscribeAsync: (args:
|
|
7
|
+
subscribeAsync: (args: RealtimeLogsMutation_GenerateCentrifugoSubscriptionTokenArgs, onPublication: (data: unknown) => void) => Promise<RealtimeLogsSubscription | null>;
|
|
8
8
|
close: () => void;
|
|
9
9
|
};
|
|
10
10
|
export declare function createRealtimeLogsClient(graphqlClient: ExpoGraphqlClient): RealtimeLogsClient | null;
|