eas-cli 23.2.0 → 24.1.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 (103) hide show
  1. package/README.md +636 -331
  2. package/build/build/utils/url.d.ts +1 -0
  3. package/build/build/utils/url.js +4 -0
  4. package/build/channel/protection.d.ts +4 -0
  5. package/build/channel/protection.js +49 -0
  6. package/build/channel/queries.d.ts +6 -0
  7. package/build/channel/queries.js +5 -1
  8. package/build/commands/channel/protect.d.ts +16 -0
  9. package/build/commands/channel/protect.js +68 -0
  10. package/build/commands/channel/unprotect.d.ts +16 -0
  11. package/build/commands/channel/unprotect.js +78 -0
  12. package/build/commands/observe/errors.d.ts +27 -0
  13. package/build/commands/observe/errors.js +122 -0
  14. package/build/commands/observe/event.d.ts +18 -0
  15. package/build/commands/observe/event.js +149 -0
  16. package/build/commands/observe/events.d.ts +2 -0
  17. package/build/commands/observe/events.js +10 -4
  18. package/build/commands/observe/metrics-summary.d.ts +1 -0
  19. package/build/commands/observe/metrics-summary.js +3 -2
  20. package/build/commands/observe/metrics.d.ts +2 -0
  21. package/build/commands/observe/metrics.js +8 -4
  22. package/build/commands/observe/routes.d.ts +2 -1
  23. package/build/commands/observe/routes.js +5 -5
  24. package/build/commands/observe/session.d.ts +1 -0
  25. package/build/commands/observe/session.js +14 -8
  26. package/build/commands/observe/versions.d.ts +1 -0
  27. package/build/commands/observe/versions.js +3 -2
  28. package/build/commands/project/status.d.ts +16 -0
  29. package/build/commands/project/status.js +47 -0
  30. package/build/commands/simulator/egress.d.ts +13 -0
  31. package/build/commands/simulator/egress.js +60 -0
  32. package/build/commands/simulator/get.js +3 -1
  33. package/build/commands/simulator/index.d.ts +2 -0
  34. package/build/commands/simulator/index.js +81 -11
  35. package/build/credentials/ios/credentials.d.ts +5 -3
  36. package/build/credentials/ios/utils/printCredentials.js +6 -1
  37. package/build/graphql/generated.d.ts +2388 -1092
  38. package/build/graphql/generated.js +64 -17
  39. package/build/graphql/mutations/RealtimeLogsMutation.d.ts +2 -2
  40. package/build/graphql/queries/AppStoreConnectApiKeyQuery.d.ts +1 -1
  41. package/build/graphql/queries/AppStoreConnectApiKeyQuery.js +1 -1
  42. package/build/graphql/queries/ChannelQuery.js +2 -0
  43. package/build/graphql/queries/DeviceRunSessionQuery.js +25 -0
  44. package/build/graphql/queries/ObserveQuery.d.ts +62 -30
  45. package/build/graphql/queries/ObserveQuery.js +276 -121
  46. package/build/graphql/queries/SubmissionQuery.d.ts +6 -1
  47. package/build/graphql/queries/SubmissionQuery.js +41 -0
  48. package/build/graphql/types/Observe.d.ts +5 -3
  49. package/build/graphql/types/Observe.js +80 -21
  50. package/build/graphql/types/UpdateChannelBasicInfo.js +1 -0
  51. package/build/observe/fetchCustomEvents.d.ts +6 -4
  52. package/build/observe/fetchCustomEvents.js +4 -2
  53. package/build/observe/fetchErrors.d.ts +32 -0
  54. package/build/observe/fetchErrors.js +42 -0
  55. package/build/observe/fetchEvents.d.ts +9 -6
  56. package/build/observe/fetchEvents.js +16 -17
  57. package/build/observe/fetchMetrics.d.ts +2 -2
  58. package/build/observe/fetchMetrics.js +9 -9
  59. package/build/observe/fetchNavigationRoutes.d.ts +7 -5
  60. package/build/observe/fetchNavigationRoutes.js +8 -8
  61. package/build/observe/fetchSessions.d.ts +13 -11
  62. package/build/observe/fetchSessions.js +59 -30
  63. package/build/observe/fetchVersions.d.ts +4 -3
  64. package/build/observe/fetchVersions.js +7 -11
  65. package/build/observe/flags.d.ts +6 -0
  66. package/build/observe/flags.js +12 -2
  67. package/build/observe/formatCustomEvents.d.ts +16 -10
  68. package/build/observe/formatCustomEvents.js +61 -28
  69. package/build/observe/formatErrors.d.ts +97 -0
  70. package/build/observe/formatErrors.js +203 -0
  71. package/build/observe/formatEvents.d.ts +11 -5
  72. package/build/observe/formatEvents.js +46 -18
  73. package/build/observe/formatMetrics.d.ts +4 -4
  74. package/build/observe/formatMetrics.js +2 -2
  75. package/build/observe/formatNavigationRoutes.d.ts +4 -4
  76. package/build/observe/formatNavigationRoutes.js +3 -3
  77. package/build/observe/formatSessions.d.ts +3 -3
  78. package/build/observe/formatSessions.js +8 -8
  79. package/build/observe/formatVersions.js +2 -2
  80. package/build/observe/platforms.d.ts +10 -19
  81. package/build/observe/platforms.js +42 -40
  82. package/build/project/projectStatus.d.ts +96 -0
  83. package/build/project/projectStatus.js +314 -0
  84. package/build/simulator/egress.d.ts +121 -0
  85. package/build/simulator/egress.js +865 -0
  86. package/build/simulator/env.d.ts +5 -0
  87. package/build/simulator/env.js +42 -1
  88. package/build/simulator/utils.d.ts +53 -2
  89. package/build/simulator/utils.js +158 -10
  90. package/build/submit/utils/urls.js +2 -3
  91. package/build/utils/centrifuge.d.ts +2 -2
  92. package/oclif.manifest.json +1162 -546
  93. package/package.json +7 -7
  94. package/build/chat/chatClient.d.ts +0 -37
  95. package/build/chat/chatClient.js +0 -359
  96. package/build/chat/detectProject.d.ts +0 -5
  97. package/build/chat/detectProject.js +0 -41
  98. package/build/chat/renderMarkdown.d.ts +0 -7
  99. package/build/chat/renderMarkdown.js +0 -47
  100. package/build/chat/replInput.d.ts +0 -10
  101. package/build/chat/replInput.js +0 -52
  102. package/build/commands/chat.d.ts +0 -18
  103. 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
+ }
@@ -0,0 +1,121 @@
1
+ import { LocalEgressConfig } from './utils';
2
+ /**
3
+ * Local egress client. Two pieces run on the developer's machine for the life of
4
+ * a simulator session started with `--egress local`:
5
+ *
6
+ * 1. An HTTP proxy on loopback that forwards the requests it receives to the
7
+ * internet from this machine. It supports CONNECT tunnels (HTTPS, WSS), plain
8
+ * HTTP requests with absolute URLs, and HTTP upgrades (WS). It refuses
9
+ * destinations on this machine's local networks: the requests it forwards
10
+ * come from code running in the remote simulator, not from the developer.
11
+ * 2. A chisel client that connects out to the session's tunnel server and asks it
12
+ * to listen on the device host's loopback proxy port, forwarding every
13
+ * connection back to the local proxy. The device host's system proxy points at
14
+ * that port, so requests that honor it (WebKit, URLSession and other CFNetwork
15
+ * clients) arrive here. Requests from libraries that bypass the system proxy
16
+ * never reach this client and exit from the device host instead.
17
+ *
18
+ * `--egress-allow host:port` names destinations on the developer's machine or
19
+ * network that the proxy may connect to despite the local-network refusal, so a
20
+ * dev server on `localhost:3000` is reachable from the remote simulator the way
21
+ * it is from a local one. Entries are exact host and port pairs, never ranges.
22
+ */
23
+ export declare const LOCAL_EGRESS_PROXY_HOST = "127.0.0.1";
24
+ /** Username in the worker's chisel authfile; the session token is its password. */
25
+ export declare const LOCAL_EGRESS_USERNAME = "eas";
26
+ export declare function readLocalEgressConfigFromEnv(env: NodeJS.ProcessEnv): LocalEgressConfig;
27
+ export declare class EgressPolicyError extends Error {
28
+ constructor(host: string, address?: string);
29
+ }
30
+ /** True for any address the egress client must never connect to. */
31
+ export declare function isForbiddenEgressAddress(address: string): boolean;
32
+ export type EgressTargetResolver = (hostname: string, port: number) => Promise<string[]>;
33
+ /**
34
+ * IPv4 first. Developer networks often have broken or slow IPv6, and a hung
35
+ * first attempt would stall the simulator's request for the whole timeout.
36
+ */
37
+ export declare function orderEgressAddresses(addresses: {
38
+ address: string;
39
+ family: number;
40
+ }[]): string[];
41
+ /**
42
+ * Resolve a destination hostname to the addresses the proxy may connect to,
43
+ * refusing anything local. Every address the name resolves to is checked, so a
44
+ * name that mixes public and private records is refused as a whole, and
45
+ * connections are made to the returned addresses rather than by re-resolving.
46
+ */
47
+ export declare const resolveEgressTargetAsync: EgressTargetResolver;
48
+ /**
49
+ * Parse one `--egress-allow` value into its normalized `host:port` form. Only an
50
+ * exact host and port pair is accepted. Web pages and SDKs inside the simulator
51
+ * can use the proxy too, so nothing here opens a range or a wildcard.
52
+ */
53
+ export declare function parseEgressAllowEntry(entry: string): string;
54
+ export declare function parseEgressAllowList(entries: readonly string[]): string[];
55
+ /**
56
+ * Wrap the default destination policy with the `--egress-allow` list. A listed
57
+ * destination connects to this machine's loopback or network exactly as named;
58
+ * every other destination keeps the default refusals. `localhost` maps to the
59
+ * loopback addresses directly and never goes through DNS.
60
+ */
61
+ export declare function createEgressTargetResolver({ allow, onAllowed, }: {
62
+ allow: readonly string[];
63
+ onAllowed?: (destination: string) => void;
64
+ }): EgressTargetResolver;
65
+ export type LocalEgressProxyStats = {
66
+ active: number;
67
+ total: number;
68
+ refused: number;
69
+ };
70
+ export type LocalEgressProxyServer = {
71
+ port: number;
72
+ getStats: () => LocalEgressProxyStats;
73
+ closeAsync: () => Promise<void>;
74
+ };
75
+ export declare function startLocalEgressProxyServerAsync({ host, port, resolveTargetAsync, }: {
76
+ host?: string;
77
+ port: number;
78
+ resolveTargetAsync?: EgressTargetResolver;
79
+ }): Promise<LocalEgressProxyServer>;
80
+ export declare function getChiselAssetName({ platform, arch, }: {
81
+ platform: NodeJS.Platform;
82
+ arch: string;
83
+ }): string;
84
+ export declare function ensureChiselBinaryAsync({ platform, arch, signal, }?: {
85
+ platform?: NodeJS.Platform;
86
+ arch?: string;
87
+ signal?: AbortSignal;
88
+ }): Promise<string>;
89
+ export declare function buildChiselClientArgs({ url, fingerprint, port, localPort, forwardPorts, }: {
90
+ url: string;
91
+ fingerprint: string;
92
+ /** Port the tunnel server listens on, on the device host. */
93
+ port: number;
94
+ /** Port the proxy listens on here; independent of the worker's listening port. */
95
+ localPort?: number;
96
+ /**
97
+ * Loopback ports to forward from the device host to the same port here, one
98
+ * reverse remote each; see getLoopbackForwardPlan.
99
+ */
100
+ forwardPorts?: readonly number[];
101
+ }): string[];
102
+ /**
103
+ * The device host refuses a reverse remote it does not permit, or one whose
104
+ * port is already in use there. chisel then drops the whole connection and
105
+ * retries, so proxied requests stay unavailable until the entry is removed.
106
+ */
107
+ export declare function isChiselRemoteRejectionLine(line: string): boolean;
108
+ export declare function classifyChiselClientLogLine(line: string): 'connected' | 'disconnected' | 'other';
109
+ /**
110
+ * Run the egress client until `signal` aborts. Rejects if the tunnel client exits
111
+ * on its own, which means proxied HTTP(S) requests have lost their tunnel.
112
+ */
113
+ export declare function runLocalEgressAsync({ url, token, fingerprint, port, allow, localPort, signal, onConnected, onDisconnected, }: Omit<LocalEgressConfig, 'allow'> & {
114
+ /** Normalized `--egress-allow` destinations; see createEgressTargetResolver. */
115
+ allow?: readonly string[];
116
+ /** Defaults to an available ephemeral port; the remote worker port stays fixed. */
117
+ localPort?: number;
118
+ signal: AbortSignal;
119
+ onConnected?: () => void;
120
+ onDisconnected?: (line: string) => void;
121
+ }): Promise<void>;