eas-cli 23.1.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 +424 -226
- package/build/api.d.ts +1 -0
- package/build/api.js +12 -0
- 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/commandUtils/workflow/logs/fetchLogs.d.ts +5 -0
- package/build/commandUtils/workflow/logs/fetchLogs.js +24 -0
- package/build/commandUtils/workflow/logs/parseLogs.d.ts +14 -0
- package/build/commandUtils/workflow/logs/parseLogs.js +69 -0
- package/build/commandUtils/workflow/logs/watcher.d.ts +32 -0
- package/build/commandUtils/workflow/logs/watcher.js +162 -0
- package/build/commandUtils/workflow/stateMachine.js +2 -1
- package/build/commandUtils/workflow/types.d.ts +12 -5
- package/build/commandUtils/workflow/utils.d.ts +9 -5
- package/build/commandUtils/workflow/utils.js +144 -146
- 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 +5 -1
- package/build/commands/simulator/index.d.ts +1 -0
- package/build/commands/simulator/index.js +16 -2
- package/build/commands/simulator/list.d.ts +1 -0
- package/build/commands/simulator/list.js +9 -0
- package/build/commands/workflow/run.d.ts +8 -0
- package/build/commands/workflow/run.js +27 -0
- package/build/commands/workflow/ssh.d.ts +31 -0
- package/build/commands/workflow/ssh.js +190 -0
- package/build/credentials/ios/credentials.d.ts +5 -3
- package/build/credentials/ios/utils/printCredentials.js +6 -1
- package/build/graphql/generated.d.ts +2474 -1079
- package/build/graphql/generated.js +71 -16
- package/build/graphql/mutations/RealtimeLogsMutation.d.ts +6 -0
- package/build/graphql/mutations/RealtimeLogsMutation.js +40 -0
- package/build/graphql/mutations/WorkflowRunMutation.d.ts +3 -2
- package/build/graphql/mutations/WorkflowRunMutation.js +4 -1
- 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 +10 -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/queries/WorkflowJobSshQuery.d.ts +20 -0
- package/build/graphql/queries/WorkflowJobSshQuery.js +133 -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/ora.d.ts +7 -0
- package/build/ora.js +12 -0
- 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 +51 -4
- package/build/submit/utils/urls.js +2 -3
- package/build/utils/centrifuge.d.ts +10 -0
- package/build/utils/centrifuge.js +89 -0
- package/build/utils/expodash/uniqBy.js +3 -2
- package/oclif.manifest.json +2947 -2328
- package/package.json +10 -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/commandUtils/workflow/fetchLogs.d.ts +0 -6
- package/build/commandUtils/workflow/fetchLogs.js +0 -44
- package/build/commands/chat.d.ts +0 -18
- package/build/commands/chat.js +0 -221
|
@@ -6,23 +6,26 @@ exports.choiceFromWorkflowRun = choiceFromWorkflowRun;
|
|
|
6
6
|
exports.choiceFromWorkflowJob = choiceFromWorkflowJob;
|
|
7
7
|
exports.choicesFromWorkflowLogs = choicesFromWorkflowLogs;
|
|
8
8
|
exports.processWorkflowRuns = processWorkflowRuns;
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
9
|
+
exports.logsForFailedWorkflowRunAsync = logsForFailedWorkflowRunAsync;
|
|
10
|
+
exports.formatActiveWorkflowRun = formatActiveWorkflowRun;
|
|
11
|
+
exports.formatFailedWorkflowRun = formatFailedWorkflowRun;
|
|
12
12
|
exports.fileExistsAsync = fileExistsAsync;
|
|
13
13
|
exports.maybeReadStdinAsync = maybeReadStdinAsync;
|
|
14
14
|
exports.showWorkflowStatusAsync = showWorkflowStatusAsync;
|
|
15
15
|
const tslib_1 = require("tslib");
|
|
16
16
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
17
17
|
const fs = tslib_1.__importStar(require("node:fs"));
|
|
18
|
-
const
|
|
18
|
+
const parseLogs_1 = require("./logs/parseLogs");
|
|
19
19
|
const types_1 = require("./types");
|
|
20
20
|
const generated_1 = require("../../graphql/generated");
|
|
21
|
+
const watcher_1 = require("./logs/watcher");
|
|
21
22
|
const WorkflowRunQuery_1 = require("../../graphql/queries/WorkflowRunQuery");
|
|
22
23
|
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
23
24
|
const ora_1 = require("../../ora");
|
|
24
25
|
const formatFields_1 = tslib_1.__importDefault(require("../../utils/formatFields"));
|
|
26
|
+
const centrifuge_1 = require("../../utils/centrifuge");
|
|
25
27
|
const promise_1 = require("../../utils/promise");
|
|
28
|
+
const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
|
|
26
29
|
function computeTriggerInfoForWorkflowRun(run) {
|
|
27
30
|
let triggerType = types_1.WorkflowTriggerType.OTHER;
|
|
28
31
|
let trigger = '';
|
|
@@ -75,16 +78,13 @@ function choiceFromWorkflowJob(job, index) {
|
|
|
75
78
|
}
|
|
76
79
|
function choicesFromWorkflowLogs(logs) {
|
|
77
80
|
return Array.from(logs.values())
|
|
78
|
-
.map(({ key, label, logLines }) => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
logLines,
|
|
86
|
-
};
|
|
87
|
-
})
|
|
81
|
+
.map(({ key, label, result, logLines }) => ({
|
|
82
|
+
title: `${label} - ${result ?? ''}`,
|
|
83
|
+
name: label,
|
|
84
|
+
status: result ?? '',
|
|
85
|
+
value: key,
|
|
86
|
+
logLines,
|
|
87
|
+
}))
|
|
88
88
|
.filter(step => step.status !== 'skipped');
|
|
89
89
|
}
|
|
90
90
|
function processWorkflowRuns(runs) {
|
|
@@ -106,48 +106,6 @@ function processWorkflowRuns(runs) {
|
|
|
106
106
|
};
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
|
-
async function fetchAndProcessLogsFromJobAsync(state, job) {
|
|
110
|
-
let rawLogs;
|
|
111
|
-
switch (job.type) {
|
|
112
|
-
case generated_1.WorkflowJobType.Build:
|
|
113
|
-
case generated_1.WorkflowJobType.Repack:
|
|
114
|
-
rawLogs = await (0, fetchLogs_1.fetchRawLogsForBuildJobAsync)(state, job);
|
|
115
|
-
break;
|
|
116
|
-
default:
|
|
117
|
-
rawLogs = await (0, fetchLogs_1.fetchRawLogsForCustomJobAsync)(job);
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
120
|
-
if (!rawLogs) {
|
|
121
|
-
return null;
|
|
122
|
-
}
|
|
123
|
-
log_1.default.debug(`rawLogs = ${JSON.stringify(rawLogs, null, 2)}`);
|
|
124
|
-
const logs = new Map();
|
|
125
|
-
rawLogs.split('\n').forEach((line, index) => {
|
|
126
|
-
log_1.default.debug(`line ${index} = ${JSON.stringify(line, null, 2)}`);
|
|
127
|
-
try {
|
|
128
|
-
const parsedLine = JSON.parse(line);
|
|
129
|
-
const { buildStepDisplayName, buildStepId, phase, time, msg, result, marker, err } = parsedLine;
|
|
130
|
-
const stepKey = buildStepId ?? buildStepDisplayName ?? phase;
|
|
131
|
-
const stepLabel = buildStepDisplayName ?? buildStepId ?? phase;
|
|
132
|
-
if (stepKey && stepLabel) {
|
|
133
|
-
if (!logs.has(stepKey)) {
|
|
134
|
-
logs.set(stepKey, {
|
|
135
|
-
key: stepKey,
|
|
136
|
-
label: stepLabel,
|
|
137
|
-
logLines: [],
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
const logGroup = logs.get(stepKey);
|
|
141
|
-
if (buildStepDisplayName) {
|
|
142
|
-
logGroup.label = buildStepDisplayName;
|
|
143
|
-
}
|
|
144
|
-
logGroup.logLines.push({ time, msg, result, marker, err });
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
catch { }
|
|
148
|
-
});
|
|
149
|
-
return logs;
|
|
150
|
-
}
|
|
151
109
|
function descriptionForJobStatus(status) {
|
|
152
110
|
switch (status) {
|
|
153
111
|
case generated_1.WorkflowJobStatus.New:
|
|
@@ -168,73 +126,78 @@ function descriptionForJobStatus(status) {
|
|
|
168
126
|
return 'Pending cancel';
|
|
169
127
|
}
|
|
170
128
|
}
|
|
171
|
-
|
|
129
|
+
function isJobCompleted(status) {
|
|
130
|
+
switch (status) {
|
|
131
|
+
case generated_1.WorkflowJobStatus.Success:
|
|
132
|
+
case generated_1.WorkflowJobStatus.Failure:
|
|
133
|
+
case generated_1.WorkflowJobStatus.Canceled:
|
|
134
|
+
case generated_1.WorkflowJobStatus.Skipped:
|
|
135
|
+
return true;
|
|
136
|
+
case generated_1.WorkflowJobStatus.New:
|
|
137
|
+
case generated_1.WorkflowJobStatus.InProgress:
|
|
138
|
+
case generated_1.WorkflowJobStatus.ActionRequired:
|
|
139
|
+
case generated_1.WorkflowJobStatus.PendingCancel:
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function stepLogTail(step, maxLogLines // -1 means no limit
|
|
144
|
+
) {
|
|
145
|
+
const logLines = step.logLines ?? [];
|
|
146
|
+
const tail = maxLogLines === -1 ? logLines : logLines.slice(-maxLogLines);
|
|
147
|
+
return tail.map(line => line.msg);
|
|
148
|
+
}
|
|
149
|
+
async function logsForFailedWorkflowRunAsync(graphqlClient, workflowRun) {
|
|
150
|
+
const jobs = workflowRun.jobs.filter(job => job.status === generated_1.WorkflowJobStatus.Failure);
|
|
151
|
+
return await Promise.all(jobs.map(async (job) => {
|
|
152
|
+
const maybeLogs = await (0, parseLogs_1.fetchAndProcessLogsFromJobAsync)({ graphqlClient }, job);
|
|
153
|
+
return { job, logs: maybeLogs ?? new Map() };
|
|
154
|
+
}));
|
|
155
|
+
}
|
|
156
|
+
function formatActiveWorkflowRun(jobLogs, maxLogLines = 5 // -1 means no limit
|
|
172
157
|
) {
|
|
173
|
-
const statusLines = [];
|
|
174
158
|
const statusValues = [];
|
|
175
|
-
for (const job of
|
|
159
|
+
for (const { job, logs } of jobLogs) {
|
|
176
160
|
statusValues.push({ label: '', value: '' });
|
|
177
161
|
statusValues.push({ label: ' Job', value: job.name });
|
|
178
162
|
statusValues.push({ label: ' Status', value: descriptionForJobStatus(job.status) });
|
|
179
163
|
if (job.status !== generated_1.WorkflowJobStatus.InProgress) {
|
|
180
164
|
continue;
|
|
181
165
|
}
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
if (maxLogLines === -1) {
|
|
193
|
-
return true;
|
|
194
|
-
}
|
|
195
|
-
return index > (currentStep.logLines?.length ?? 0) - maxLogLines;
|
|
196
|
-
}) ?? [];
|
|
197
|
-
for (const log of currentLogs) {
|
|
198
|
-
statusValues.push({ label: '', value: log });
|
|
199
|
-
}
|
|
166
|
+
const steps = choicesFromWorkflowLogs(logs);
|
|
167
|
+
if (steps.length === 0) {
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
const currentStep = steps[steps.length - 1];
|
|
171
|
+
statusValues.push({ label: ' Current step', value: currentStep.name });
|
|
172
|
+
if (currentStep.logLines?.length) {
|
|
173
|
+
statusValues.push({ label: ' Current logs', value: '' });
|
|
174
|
+
for (const log of stepLogTail(currentStep, maxLogLines)) {
|
|
175
|
+
statusValues.push({ label: '', value: log });
|
|
200
176
|
}
|
|
201
177
|
}
|
|
202
178
|
}
|
|
203
179
|
statusValues.push({ label: '', value: '' });
|
|
204
|
-
|
|
205
|
-
return statusLines.join('\n');
|
|
180
|
+
return (0, formatFields_1.default)(statusValues);
|
|
206
181
|
}
|
|
207
|
-
|
|
182
|
+
function formatFailedWorkflowRun(jobLogs, maxLogLines = -1 // -1 means no limit
|
|
208
183
|
) {
|
|
209
|
-
const statusLines = [];
|
|
210
184
|
const statusValues = [];
|
|
211
|
-
const
|
|
212
|
-
for (const job of workflowRun.jobs) {
|
|
213
|
-
if (job.status !== generated_1.WorkflowJobStatus.Failure) {
|
|
214
|
-
continue;
|
|
215
|
-
}
|
|
216
|
-
const logs = await fetchAndProcessLogsFromJobAsync({ graphqlClient }, job);
|
|
217
|
-
const steps = logs ? choicesFromWorkflowLogs(logs) : [];
|
|
185
|
+
for (const { job, logs } of jobLogs) {
|
|
218
186
|
statusValues.push({ label: '', value: '' });
|
|
219
187
|
statusValues.push({ label: ' Failed job', value: job.name });
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
for (const log of logs) {
|
|
230
|
-
statusValues.push({ label: '', value: log });
|
|
231
|
-
}
|
|
232
|
-
}
|
|
188
|
+
const steps = choicesFromWorkflowLogs(logs);
|
|
189
|
+
const failedStep = steps.find(step => step.status === 'fail' || step.status === 'failed');
|
|
190
|
+
if (!failedStep) {
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
statusValues.push({ label: ' Failed step', value: failedStep.name });
|
|
194
|
+
statusValues.push({ label: ' Logs for failed step', value: '' });
|
|
195
|
+
for (const log of stepLogTail(failedStep, maxLogLines)) {
|
|
196
|
+
statusValues.push({ label: '', value: log });
|
|
233
197
|
}
|
|
234
198
|
}
|
|
235
199
|
statusValues.push({ label: '', value: '' });
|
|
236
|
-
|
|
237
|
-
return statusLines.join('\n');
|
|
200
|
+
return (0, formatFields_1.default)(statusValues);
|
|
238
201
|
}
|
|
239
202
|
async function fileExistsAsync(filePath) {
|
|
240
203
|
return await fs.promises
|
|
@@ -271,57 +234,92 @@ async function showWorkflowStatusAsync(graphqlClient, { workflowRunId, spinnerUs
|
|
|
271
234
|
stream: spinnerUsesStdErr ? process.stderr : process.stdout,
|
|
272
235
|
text: '',
|
|
273
236
|
}).start();
|
|
274
|
-
|
|
237
|
+
(0, ora_1.updateSpinnerText)(spinner, {
|
|
238
|
+
prefixText: (0, chalk_1.default) `{bold.yellow Workflow run is waiting to start:}`,
|
|
239
|
+
});
|
|
240
|
+
const watcher = new watcher_1.WorkflowRunLogsWatcher(graphqlClient, () => (0, centrifuge_1.createRealtimeLogsClient)(graphqlClient), () => {
|
|
241
|
+
renderActiveWorkflowRun();
|
|
242
|
+
});
|
|
275
243
|
let failedFetchesCount = 0;
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
244
|
+
let renderActiveWorkflowRun = () => { };
|
|
245
|
+
try {
|
|
246
|
+
while (true) {
|
|
247
|
+
try {
|
|
248
|
+
const workflowRun = await WorkflowRunQuery_1.WorkflowRunQuery.withJobsByIdAsync(graphqlClient, workflowRunId, {
|
|
249
|
+
useCache: false,
|
|
250
|
+
});
|
|
251
|
+
failedFetchesCount = 0;
|
|
252
|
+
switch (workflowRun.status) {
|
|
253
|
+
case generated_1.WorkflowRunStatus.New:
|
|
254
|
+
break;
|
|
255
|
+
case generated_1.WorkflowRunStatus.InProgress: {
|
|
256
|
+
(0, ora_1.updateSpinnerText)(spinner, {
|
|
257
|
+
prefixText: (0, chalk_1.default) `{bold.green Workflow run is in progress:}`,
|
|
258
|
+
});
|
|
259
|
+
const logsStates = await watcher.syncJobsAsync(workflowRun.jobs);
|
|
260
|
+
for (const job of workflowRun.jobs) {
|
|
261
|
+
if (isJobCompleted(job.status)) {
|
|
262
|
+
(0, nullthrows_1.default)(logsStates.get(job.id), 'syncJobsAsync must have been called before markCompleted').markCompleted();
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
renderActiveWorkflowRun = () => {
|
|
266
|
+
const text = formatActiveWorkflowRun(workflowRun.jobs.map(job => ({
|
|
267
|
+
job,
|
|
268
|
+
logs: (0, nullthrows_1.default)(logsStates.get(job.id), 'syncJobsAsync must have been called before getLogs').getLogs(),
|
|
269
|
+
})));
|
|
270
|
+
(0, ora_1.updateSpinnerText)(spinner, { text });
|
|
271
|
+
};
|
|
272
|
+
renderActiveWorkflowRun();
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
case generated_1.WorkflowRunStatus.ActionRequired:
|
|
276
|
+
(0, ora_1.updateSpinnerText)(spinner, {
|
|
277
|
+
prefixText: (0, chalk_1.default) `{bold.yellow Workflow run is waiting for action:}`,
|
|
278
|
+
});
|
|
279
|
+
break;
|
|
280
|
+
case generated_1.WorkflowRunStatus.Canceled:
|
|
281
|
+
(0, ora_1.updateSpinnerText)(spinner, {
|
|
282
|
+
prefixText: (0, chalk_1.default) `{bold.yellow Workflow has been canceled.}`,
|
|
283
|
+
});
|
|
284
|
+
spinner.stopAndPersist();
|
|
285
|
+
return workflowRun;
|
|
286
|
+
case generated_1.WorkflowRunStatus.Failure: {
|
|
287
|
+
(0, ora_1.updateSpinnerText)(spinner, {
|
|
288
|
+
prefixText: (0, chalk_1.default) `{bold.red Workflow has failed.}`,
|
|
289
|
+
});
|
|
290
|
+
const jobLogs = await logsForFailedWorkflowRunAsync(graphqlClient, workflowRun);
|
|
291
|
+
spinner.fail(formatFailedWorkflowRun(jobLogs, 30));
|
|
292
|
+
return workflowRun;
|
|
293
|
+
}
|
|
294
|
+
case generated_1.WorkflowRunStatus.Success:
|
|
295
|
+
(0, ora_1.updateSpinnerText)(spinner, {
|
|
296
|
+
prefixText: (0, chalk_1.default) `{bold.green Workflow has completed successfully.}`,
|
|
297
|
+
});
|
|
298
|
+
spinner.succeed('');
|
|
299
|
+
return workflowRun;
|
|
289
300
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
spinner.prefixText = (0, chalk_1.default) `{bold.yellow Workflow has been canceled.}`;
|
|
295
|
-
spinner.stopAndPersist();
|
|
296
|
-
return workflowRun;
|
|
297
|
-
case generated_1.WorkflowRunStatus.Failure: {
|
|
298
|
-
spinner.prefixText = (0, chalk_1.default) `{bold.red Workflow has failed.}`;
|
|
299
|
-
const failedInfo = await infoForFailedWorkflowRunAsync(graphqlClient, workflowRun, 30);
|
|
300
|
-
spinner.fail(failedInfo);
|
|
301
|
+
if (!waitForCompletion) {
|
|
302
|
+
if (spinner.isSpinning) {
|
|
303
|
+
spinner.stopAndPersist();
|
|
304
|
+
}
|
|
301
305
|
return workflowRun;
|
|
302
306
|
}
|
|
303
|
-
case generated_1.WorkflowRunStatus.Success:
|
|
304
|
-
spinner.prefixText = (0, chalk_1.default) `{bold.green Workflow has completed successfully.}`;
|
|
305
|
-
spinner.text = '';
|
|
306
|
-
spinner.succeed('');
|
|
307
|
-
return workflowRun;
|
|
308
307
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
308
|
+
catch {
|
|
309
|
+
(0, ora_1.updateSpinnerText)(spinner, {
|
|
310
|
+
text: '⚠ Failed to fetch the workflow run status. Check your network connection.',
|
|
311
|
+
});
|
|
312
|
+
failedFetchesCount += 1;
|
|
313
|
+
if (failedFetchesCount > 6) {
|
|
314
|
+
spinner.fail('Failed to fetch the workflow run status 6 times in a row. Aborting wait.');
|
|
315
|
+
process.exit(exports.workflowRunExitCodes.WAIT_ABORTED);
|
|
312
316
|
}
|
|
313
|
-
return workflowRun;
|
|
314
317
|
}
|
|
318
|
+
await (0, promise_1.sleepAsync)(10 /* seconds */ * 1000 /* milliseconds */);
|
|
315
319
|
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
if (failedFetchesCount > 6) {
|
|
320
|
-
spinner.fail('Failed to fetch the workflow run status 6 times in a row. Aborting wait.');
|
|
321
|
-
process.exit(exports.workflowRunExitCodes.WAIT_ABORTED);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
await (0, promise_1.sleepAsync)(10 /* seconds */ * 1000 /* milliseconds */);
|
|
320
|
+
}
|
|
321
|
+
finally {
|
|
322
|
+
watcher.close();
|
|
325
323
|
}
|
|
326
324
|
}
|
|
327
325
|
exports.workflowRunExitCodes = {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
|
+
export default class ChannelProtect extends EasCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
name: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static flags: {
|
|
8
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
};
|
|
11
|
+
static contextDefinition: {
|
|
12
|
+
loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
|
|
13
|
+
projectId: import("../../commandUtils/context/ProjectIdContextField").ProjectIdContextField;
|
|
14
|
+
};
|
|
15
|
+
runAsync(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
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 protection_1 = require("../../channel/protection");
|
|
7
|
+
const queries_1 = require("../../channel/queries");
|
|
8
|
+
const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
|
|
9
|
+
const flags_1 = require("../../commandUtils/flags");
|
|
10
|
+
const ChannelQuery_1 = require("../../graphql/queries/ChannelQuery");
|
|
11
|
+
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
12
|
+
const json_1 = require("../../utils/json");
|
|
13
|
+
class ChannelProtect extends EasCommand_1.default {
|
|
14
|
+
static description = 'protect a channel so only account admins can publish to it';
|
|
15
|
+
static args = {
|
|
16
|
+
name: core_1.Args.string({
|
|
17
|
+
required: false,
|
|
18
|
+
description: 'Name of the channel to protect',
|
|
19
|
+
}),
|
|
20
|
+
};
|
|
21
|
+
static flags = {
|
|
22
|
+
...flags_1.EasNonInteractiveAndJsonFlags,
|
|
23
|
+
};
|
|
24
|
+
static contextDefinition = {
|
|
25
|
+
...this.ContextOptions.ProjectId,
|
|
26
|
+
...this.ContextOptions.LoggedIn,
|
|
27
|
+
};
|
|
28
|
+
async runAsync() {
|
|
29
|
+
const { args, flags } = await this.parse(ChannelProtect);
|
|
30
|
+
const { json, nonInteractive } = (0, flags_1.resolveNonInteractiveAndJsonFlags)(flags);
|
|
31
|
+
if (json) {
|
|
32
|
+
(0, json_1.enableJsonOutput)();
|
|
33
|
+
}
|
|
34
|
+
if (!args.name && nonInteractive) {
|
|
35
|
+
throw new Error('Channel name must be set when running in non-interactive mode');
|
|
36
|
+
}
|
|
37
|
+
const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(ChannelProtect, { nonInteractive });
|
|
38
|
+
const existingChannel = args.name
|
|
39
|
+
? await ChannelQuery_1.ChannelQuery.viewUpdateChannelBasicInfoAsync(graphqlClient, {
|
|
40
|
+
appId: projectId,
|
|
41
|
+
channelName: args.name,
|
|
42
|
+
})
|
|
43
|
+
: await (0, queries_1.selectChannelOnAppAsync)(graphqlClient, {
|
|
44
|
+
projectId,
|
|
45
|
+
selectionPromptTitle: 'Select a channel to protect',
|
|
46
|
+
paginatedQueryOptions: { json, nonInteractive, offset: 0 },
|
|
47
|
+
});
|
|
48
|
+
if (existingChannel.isProtected) {
|
|
49
|
+
if (json) {
|
|
50
|
+
(0, json_1.printJsonOnlyOutput)(existingChannel);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
log_1.default.log((0, chalk_1.default) `Channel {bold ${existingChannel.name}} is already protected.`);
|
|
54
|
+
}
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const channel = await (0, protection_1.protectUpdateChannelAsync)(graphqlClient, {
|
|
58
|
+
channelId: existingChannel.id,
|
|
59
|
+
});
|
|
60
|
+
if (json) {
|
|
61
|
+
(0, json_1.printJsonOnlyOutput)(channel);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
log_1.default.withTick((0, chalk_1.default) `Channel {bold ${channel.name}} is now protected.`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.default = ChannelProtect;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
|
+
export default class ChannelUnprotect extends EasCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
name: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static flags: {
|
|
8
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
};
|
|
11
|
+
static contextDefinition: {
|
|
12
|
+
loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
|
|
13
|
+
projectId: import("../../commandUtils/context/ProjectIdContextField").ProjectIdContextField;
|
|
14
|
+
};
|
|
15
|
+
runAsync(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
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 protection_1 = require("../../channel/protection");
|
|
7
|
+
const queries_1 = require("../../channel/queries");
|
|
8
|
+
const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
|
|
9
|
+
const flags_1 = require("../../commandUtils/flags");
|
|
10
|
+
const ChannelQuery_1 = require("../../graphql/queries/ChannelQuery");
|
|
11
|
+
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
12
|
+
const prompts_1 = require("../../prompts");
|
|
13
|
+
const json_1 = require("../../utils/json");
|
|
14
|
+
class ChannelUnprotect extends EasCommand_1.default {
|
|
15
|
+
static description = "remove a channel's admin-only publishing restriction";
|
|
16
|
+
static args = {
|
|
17
|
+
name: core_1.Args.string({
|
|
18
|
+
required: false,
|
|
19
|
+
description: 'Name of the channel to unprotect',
|
|
20
|
+
}),
|
|
21
|
+
};
|
|
22
|
+
static flags = {
|
|
23
|
+
...flags_1.EasNonInteractiveAndJsonFlags,
|
|
24
|
+
};
|
|
25
|
+
static contextDefinition = {
|
|
26
|
+
...this.ContextOptions.ProjectId,
|
|
27
|
+
...this.ContextOptions.LoggedIn,
|
|
28
|
+
};
|
|
29
|
+
async runAsync() {
|
|
30
|
+
const { args, flags } = await this.parse(ChannelUnprotect);
|
|
31
|
+
const { json, nonInteractive } = (0, flags_1.resolveNonInteractiveAndJsonFlags)(flags);
|
|
32
|
+
if (json) {
|
|
33
|
+
(0, json_1.enableJsonOutput)();
|
|
34
|
+
}
|
|
35
|
+
if (!args.name && nonInteractive) {
|
|
36
|
+
throw new Error('Channel name must be set when running in non-interactive mode');
|
|
37
|
+
}
|
|
38
|
+
const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(ChannelUnprotect, { nonInteractive });
|
|
39
|
+
const existingChannel = args.name
|
|
40
|
+
? await ChannelQuery_1.ChannelQuery.viewUpdateChannelBasicInfoAsync(graphqlClient, {
|
|
41
|
+
appId: projectId,
|
|
42
|
+
channelName: args.name,
|
|
43
|
+
})
|
|
44
|
+
: await (0, queries_1.selectChannelOnAppAsync)(graphqlClient, {
|
|
45
|
+
projectId,
|
|
46
|
+
selectionPromptTitle: 'Select a channel to unprotect',
|
|
47
|
+
paginatedQueryOptions: { json, nonInteractive, offset: 0 },
|
|
48
|
+
});
|
|
49
|
+
if (!existingChannel.isProtected) {
|
|
50
|
+
if (json) {
|
|
51
|
+
(0, json_1.printJsonOnlyOutput)(existingChannel);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
log_1.default.log((0, chalk_1.default) `Channel {bold ${existingChannel.name}} is already unprotected.`);
|
|
55
|
+
}
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (!nonInteractive) {
|
|
59
|
+
const confirmed = await (0, prompts_1.toggleConfirmAsync)({
|
|
60
|
+
message: (0, chalk_1.default) `Remove protection from channel {bold ${existingChannel.name}}?`,
|
|
61
|
+
});
|
|
62
|
+
if (!confirmed) {
|
|
63
|
+
log_1.default.error((0, chalk_1.default) `Canceled removing protection from channel {bold ${existingChannel.name}}.`);
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const channel = await (0, protection_1.unprotectUpdateChannelAsync)(graphqlClient, {
|
|
68
|
+
channelId: existingChannel.id,
|
|
69
|
+
});
|
|
70
|
+
if (json) {
|
|
71
|
+
(0, json_1.printJsonOnlyOutput)(channel);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
log_1.default.withTick((0, chalk_1.default) `Channel {bold ${channel.name}} is no longer protected.`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.default = ChannelUnprotect;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
|
+
export default class ObserveErrors extends EasCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
6
|
+
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
'project-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
environment: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
'update-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
'build-number': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
'app-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
start: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
end: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
|
+
days: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
|
+
limit: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
|
|
16
|
+
after: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
17
|
+
fingerprint: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
18
|
+
severity: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
19
|
+
platform: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
20
|
+
};
|
|
21
|
+
static contextDefinition: {
|
|
22
|
+
loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
|
|
23
|
+
projectId: import("../../commandUtils/context/ProjectIdContextField").ProjectIdContextField;
|
|
24
|
+
};
|
|
25
|
+
private static loggedInOnlyContextDefinition;
|
|
26
|
+
runAsync(): Promise<void>;
|
|
27
|
+
}
|