eas-cli 24.1.2 → 24.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +237 -131
- package/build/channel/insights/formatInsights.js +1 -5
- package/build/commandUtils/EasCommand.d.ts +2 -1
- package/build/commandUtils/EasCommand.js +2 -1
- package/build/commandUtils/context/ContextField.d.ts +2 -0
- package/build/commandUtils/context/ProjectIdContextField.d.ts +1 -1
- package/build/commandUtils/context/ProjectIdContextField.js +4 -1
- package/build/commandUtils/flags.d.ts +3 -0
- package/build/commandUtils/flags.js +6 -1
- package/build/commandUtils/pagination.js +2 -2
- package/build/commandUtils/planGating.d.ts +2 -0
- package/build/commandUtils/planGating.js +10 -0
- package/build/commands/channel/insights.d.ts +2 -2
- package/build/commands/channel/insights.js +1 -13
- package/build/commands/observe/errors.d.ts +0 -1
- package/build/commands/observe/errors.js +3 -10
- package/build/commands/observe/event.d.ts +0 -1
- package/build/commands/observe/event.js +3 -11
- package/build/commands/observe/events.d.ts +0 -1
- package/build/commands/observe/events.js +3 -10
- package/build/commands/observe/metrics-summary.d.ts +0 -1
- package/build/commands/observe/metrics-summary.js +3 -10
- package/build/commands/observe/metrics.d.ts +0 -1
- package/build/commands/observe/metrics.js +3 -10
- package/build/commands/observe/routes.d.ts +0 -1
- package/build/commands/observe/routes.js +3 -10
- package/build/commands/observe/session.d.ts +0 -1
- package/build/commands/observe/session.js +3 -10
- package/build/commands/observe/versions.d.ts +0 -1
- package/build/commands/observe/versions.js +3 -10
- package/build/commands/update/insights.d.ts +1 -1
- package/build/commands/update/insights.js +1 -13
- package/build/commands/workflow/insights/index.d.ts +23 -0
- package/build/commands/workflow/insights/index.js +80 -0
- package/build/commands/workflow/insights/maestro.d.ts +26 -0
- package/build/commands/workflow/insights/maestro.js +140 -0
- package/build/graphql/generated.d.ts +261 -0
- package/build/graphql/generated.js +2 -0
- package/build/graphql/queries/AppQuery.d.ts +4 -0
- package/build/graphql/queries/AppQuery.js +19 -0
- package/build/graphql/queries/WorkflowDeviceTestCaseInsightsQuery.d.ts +27 -0
- package/build/graphql/queries/WorkflowDeviceTestCaseInsightsQuery.js +173 -0
- package/build/graphql/queries/WorkflowsInsightsQuery.d.ts +13 -0
- package/build/graphql/queries/WorkflowsInsightsQuery.js +84 -0
- package/build/insights/formatFilters.d.ts +2 -0
- package/build/insights/formatFilters.js +10 -0
- package/build/insights/formatRunsOverTime.d.ts +13 -0
- package/build/insights/formatRunsOverTime.js +49 -0
- package/build/insights/formatTimespan.d.ts +5 -1
- package/build/insights/formatTimespan.js +12 -0
- package/build/insights/metrics.d.ts +22 -0
- package/build/insights/metrics.js +48 -0
- package/build/insights/timeRange.d.ts +5 -0
- package/build/insights/timeRange.js +17 -1
- package/build/observe/flags.d.ts +0 -3
- package/build/observe/flags.js +1 -6
- package/build/observe/formatErrors.js +3 -5
- package/build/observe/planGating.js +2 -5
- package/build/observe/startAndEndTime.js +9 -0
- package/build/update/insights/formatInsights.js +1 -5
- package/build/utils/terminalText.d.ts +1 -0
- package/build/utils/terminalText.js +4 -0
- package/build/workflow/insights/filters.d.ts +30 -0
- package/build/workflow/insights/filters.js +79 -0
- package/build/workflow/insights/formatInsights.d.ts +44 -0
- package/build/workflow/insights/formatInsights.js +155 -0
- package/build/workflow/insights/formatMaestroInsights.d.ts +105 -0
- package/build/workflow/insights/formatMaestroInsights.js +298 -0
- package/build/workflow/insights/granularity.d.ts +27 -0
- package/build/workflow/insights/granularity.js +79 -0
- package/build/workflow/insights/maestroFilters.d.ts +23 -0
- package/build/workflow/insights/maestroFilters.js +47 -0
- package/build/workflow/insights/maestroSort.d.ts +7 -0
- package/build/workflow/insights/maestroSort.js +27 -0
- package/build/workflow/insights/planGating.d.ts +6 -0
- package/build/workflow/insights/planGating.js +33 -0
- package/oclif.manifest.json +2341 -1961
- package/package.json +5 -5
- package/build/observe/resolveProjectContext.d.ts +0 -22
- package/build/observe/resolveProjectContext.js +0 -21
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WorkflowDeviceTestCaseInsightsQuery = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
|
|
6
|
+
const client_1 = require("../client");
|
|
7
|
+
const FEATURE_NAME = 'EAS Maestro insights';
|
|
8
|
+
exports.WorkflowDeviceTestCaseInsightsQuery = {
|
|
9
|
+
async insightsByAppIdAsync(graphqlClient, { appId, startTime, endTime, filters, granularity, sortField, sortDirection, search, first, }) {
|
|
10
|
+
const data = await (0, client_1.withUpgradeRequiredErrorHandlingAsync)(graphqlClient
|
|
11
|
+
.query((0, graphql_tag_1.default) `
|
|
12
|
+
query WorkflowDeviceTestCaseInsightsByAppId(
|
|
13
|
+
$appId: String!
|
|
14
|
+
$timespan: WorkflowDeviceTestCaseInsightsTimespanInput!
|
|
15
|
+
$filters: WorkflowDeviceTestCaseInsightsFiltersInput
|
|
16
|
+
$granularity: WorkflowDeviceTestCaseInsightsTimeSeriesGranularity!
|
|
17
|
+
$sortField: WorkflowDeviceTestCaseStatSortField
|
|
18
|
+
$sortDirection: WorkflowDeviceTestCaseSortDirection
|
|
19
|
+
$search: String
|
|
20
|
+
$first: Int!
|
|
21
|
+
) {
|
|
22
|
+
app {
|
|
23
|
+
byId(appId: $appId) {
|
|
24
|
+
id
|
|
25
|
+
fullName
|
|
26
|
+
workflowDeviceTestCaseInsights(timespan: $timespan, filters: $filters) {
|
|
27
|
+
totals {
|
|
28
|
+
totalRuns {
|
|
29
|
+
currentValue
|
|
30
|
+
previousValue
|
|
31
|
+
}
|
|
32
|
+
passedCleanCount {
|
|
33
|
+
currentValue
|
|
34
|
+
previousValue
|
|
35
|
+
}
|
|
36
|
+
flakyCount {
|
|
37
|
+
currentValue
|
|
38
|
+
previousValue
|
|
39
|
+
}
|
|
40
|
+
distinctFlakyTestCount {
|
|
41
|
+
currentValue
|
|
42
|
+
previousValue
|
|
43
|
+
}
|
|
44
|
+
avgDurationMs {
|
|
45
|
+
currentValue
|
|
46
|
+
previousValue
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
timeSeries(granularity: $granularity) {
|
|
50
|
+
bucketStartAt
|
|
51
|
+
passedClean
|
|
52
|
+
flaky
|
|
53
|
+
failed
|
|
54
|
+
}
|
|
55
|
+
tests(
|
|
56
|
+
sortField: $sortField
|
|
57
|
+
sortDirection: $sortDirection
|
|
58
|
+
search: $search
|
|
59
|
+
first: $first
|
|
60
|
+
) {
|
|
61
|
+
edges {
|
|
62
|
+
node {
|
|
63
|
+
path
|
|
64
|
+
name
|
|
65
|
+
totalRuns
|
|
66
|
+
passedCleanCount
|
|
67
|
+
flakyCount
|
|
68
|
+
failedCount
|
|
69
|
+
p90DurationMs
|
|
70
|
+
lastRunAt
|
|
71
|
+
lastRunStatus
|
|
72
|
+
lastRunIsFlaky
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
pageInfo {
|
|
76
|
+
hasNextPage
|
|
77
|
+
}
|
|
78
|
+
totalCount
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
`, {
|
|
85
|
+
appId,
|
|
86
|
+
timespan: { start: startTime, end: endTime },
|
|
87
|
+
filters,
|
|
88
|
+
granularity,
|
|
89
|
+
sortField,
|
|
90
|
+
sortDirection,
|
|
91
|
+
search,
|
|
92
|
+
first,
|
|
93
|
+
}, { additionalTypenames: ['App', 'WorkflowDeviceTestCaseInsights'] })
|
|
94
|
+
.toPromise(), { featureName: FEATURE_NAME });
|
|
95
|
+
return data.app.byId;
|
|
96
|
+
},
|
|
97
|
+
async historyByAppIdAsync(graphqlClient, { appId, path, startTime, endTime, filters, granularity, errorPatternsFirst, recentRunsFirst, }) {
|
|
98
|
+
const data = await (0, client_1.withUpgradeRequiredErrorHandlingAsync)(graphqlClient
|
|
99
|
+
.query((0, graphql_tag_1.default) `
|
|
100
|
+
query WorkflowDeviceTestCaseHistoryByAppId(
|
|
101
|
+
$appId: String!
|
|
102
|
+
$path: String!
|
|
103
|
+
$timespan: WorkflowDeviceTestCaseInsightsTimespanInput!
|
|
104
|
+
$filters: WorkflowDeviceTestCaseHistoryFiltersInput
|
|
105
|
+
$granularity: WorkflowDeviceTestCaseInsightsTimeSeriesGranularity!
|
|
106
|
+
$errorPatternsFirst: Int!
|
|
107
|
+
$recentRunsFirst: Int!
|
|
108
|
+
) {
|
|
109
|
+
app {
|
|
110
|
+
byId(appId: $appId) {
|
|
111
|
+
id
|
|
112
|
+
fullName
|
|
113
|
+
workflowDeviceTestCaseHistory(path: $path, timespan: $timespan, filters: $filters) {
|
|
114
|
+
totals {
|
|
115
|
+
totalRuns {
|
|
116
|
+
currentValue
|
|
117
|
+
}
|
|
118
|
+
passedCleanCount {
|
|
119
|
+
currentValue
|
|
120
|
+
}
|
|
121
|
+
flakyCount {
|
|
122
|
+
currentValue
|
|
123
|
+
}
|
|
124
|
+
p90DurationMs {
|
|
125
|
+
currentValue
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
timeSeries(granularity: $granularity) {
|
|
129
|
+
bucketStartAt
|
|
130
|
+
passedClean
|
|
131
|
+
flaky
|
|
132
|
+
failed
|
|
133
|
+
}
|
|
134
|
+
errorPatterns(first: $errorPatternsFirst) {
|
|
135
|
+
sampleMessage
|
|
136
|
+
count
|
|
137
|
+
}
|
|
138
|
+
recentRuns(first: $recentRunsFirst) {
|
|
139
|
+
edges {
|
|
140
|
+
node {
|
|
141
|
+
id
|
|
142
|
+
status
|
|
143
|
+
durationMs
|
|
144
|
+
isFlaky
|
|
145
|
+
createdAt
|
|
146
|
+
workflowRunId
|
|
147
|
+
workflowRunName
|
|
148
|
+
gitRef
|
|
149
|
+
commitSha
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
pageInfo {
|
|
153
|
+
hasNextPage
|
|
154
|
+
}
|
|
155
|
+
totalCount
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
`, {
|
|
162
|
+
appId,
|
|
163
|
+
path,
|
|
164
|
+
timespan: { start: startTime, end: endTime },
|
|
165
|
+
filters,
|
|
166
|
+
granularity,
|
|
167
|
+
errorPatternsFirst,
|
|
168
|
+
recentRunsFirst,
|
|
169
|
+
}, { additionalTypenames: ['App', 'WorkflowDeviceTestCaseHistory'] })
|
|
170
|
+
.toPromise(), { featureName: FEATURE_NAME });
|
|
171
|
+
return data.app.byId;
|
|
172
|
+
},
|
|
173
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
|
2
|
+
import { WorkflowsInsightsByAppIdQuery, WorkflowsInsightsFiltersInput, WorkflowsInsightsRunsOverTimeGranularity } from '../generated';
|
|
3
|
+
export type AppWithWorkflowsInsightsObject = WorkflowsInsightsByAppIdQuery['app']['byId'];
|
|
4
|
+
export declare const WorkflowsInsightsQuery: {
|
|
5
|
+
byAppIdAsync(graphqlClient: ExpoGraphqlClient, { appId, startTime, endTime, filters, granularity, first, }: {
|
|
6
|
+
appId: string;
|
|
7
|
+
startTime: string;
|
|
8
|
+
endTime: string;
|
|
9
|
+
filters?: WorkflowsInsightsFiltersInput;
|
|
10
|
+
granularity: WorkflowsInsightsRunsOverTimeGranularity;
|
|
11
|
+
first: number;
|
|
12
|
+
}): Promise<AppWithWorkflowsInsightsObject>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WorkflowsInsightsQuery = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
|
|
6
|
+
const client_1 = require("../client");
|
|
7
|
+
exports.WorkflowsInsightsQuery = {
|
|
8
|
+
async byAppIdAsync(graphqlClient, { appId, startTime, endTime, filters, granularity, first, }) {
|
|
9
|
+
const data = await (0, client_1.withUpgradeRequiredErrorHandlingAsync)(graphqlClient
|
|
10
|
+
.query((0, graphql_tag_1.default) `
|
|
11
|
+
query WorkflowsInsightsByAppId(
|
|
12
|
+
$appId: String!
|
|
13
|
+
$timespan: WorkflowsInsightsTimespanInput!
|
|
14
|
+
$filters: WorkflowsInsightsFiltersInput
|
|
15
|
+
$granularity: WorkflowsInsightsRunsOverTimeGranularity!
|
|
16
|
+
$first: Int!
|
|
17
|
+
) {
|
|
18
|
+
app {
|
|
19
|
+
byId(appId: $appId) {
|
|
20
|
+
id
|
|
21
|
+
fullName
|
|
22
|
+
workflows {
|
|
23
|
+
id
|
|
24
|
+
fileName
|
|
25
|
+
}
|
|
26
|
+
workflowsInsights {
|
|
27
|
+
overviewMetrics(timespan: $timespan, filters: $filters) {
|
|
28
|
+
totalRuns {
|
|
29
|
+
currentValue
|
|
30
|
+
previousValue
|
|
31
|
+
}
|
|
32
|
+
successfulRuns {
|
|
33
|
+
currentValue
|
|
34
|
+
previousValue
|
|
35
|
+
}
|
|
36
|
+
failedRuns {
|
|
37
|
+
currentValue
|
|
38
|
+
previousValue
|
|
39
|
+
}
|
|
40
|
+
activeWorkflows {
|
|
41
|
+
currentValue
|
|
42
|
+
previousValue
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
runsOverTime(timespan: $timespan, filters: $filters, granularity: $granularity) {
|
|
46
|
+
lineChart {
|
|
47
|
+
labels
|
|
48
|
+
datasets {
|
|
49
|
+
id
|
|
50
|
+
data
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
workflows(timespan: $timespan, filters: $filters, first: $first) {
|
|
55
|
+
edges {
|
|
56
|
+
node {
|
|
57
|
+
workflowId
|
|
58
|
+
name
|
|
59
|
+
totalRuns
|
|
60
|
+
successfulRuns
|
|
61
|
+
failedRuns
|
|
62
|
+
canceledRuns
|
|
63
|
+
lastRunAt
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
pageInfo {
|
|
67
|
+
hasNextPage
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
`, {
|
|
75
|
+
appId,
|
|
76
|
+
timespan: { start: startTime, end: endTime },
|
|
77
|
+
filters,
|
|
78
|
+
granularity,
|
|
79
|
+
first,
|
|
80
|
+
}, { additionalTypenames: ['App', 'AppWorkflowsInsights', 'Workflow'] })
|
|
81
|
+
.toPromise(), { featureName: 'EAS Workflows insights' });
|
|
82
|
+
return data.app.byId;
|
|
83
|
+
},
|
|
84
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatAppliedFilters = formatAppliedFilters;
|
|
4
|
+
/** Entries render in the order the caller lists them. */
|
|
5
|
+
function formatAppliedFilters(entries) {
|
|
6
|
+
return entries
|
|
7
|
+
.filter(([, value]) => (Array.isArray(value) ? value.length > 0 : Boolean(value)))
|
|
8
|
+
.map(([label, value]) => `${label}: ${Array.isArray(value) ? value.join(', ') : value}`)
|
|
9
|
+
.join('; ');
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Each insights surface has its own generated enum with these values. */
|
|
2
|
+
export type InsightsGranularityValue = 'MINUTE' | 'HOUR' | 'DAY';
|
|
3
|
+
/**
|
|
4
|
+
* The server fills the whole window with buckets, so a quiet project would print one zero row
|
|
5
|
+
* per period. Only the table omits them; the JSON output keeps every bucket.
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildRunsOverTimeSection<Bucket extends {
|
|
8
|
+
start: string;
|
|
9
|
+
}>(buckets: Bucket[], granularity: InsightsGranularityValue, { runs, columns, toRow, }: {
|
|
10
|
+
runs: (bucket: Bucket) => number;
|
|
11
|
+
columns: string[];
|
|
12
|
+
toRow: (bucket: Bucket) => string[];
|
|
13
|
+
}): string[];
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildRunsOverTimeSection = buildRunsOverTimeSection;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
+
const indent_string_1 = tslib_1.__importDefault(require("indent-string"));
|
|
7
|
+
const formatTimespan_1 = require("./formatTimespan");
|
|
8
|
+
const renderTextTable_1 = tslib_1.__importDefault(require("../utils/renderTextTable"));
|
|
9
|
+
const INSIGHTS_GRANULARITY_PRESENTATION = {
|
|
10
|
+
MINUTE: {
|
|
11
|
+
label: 'per minute, UTC',
|
|
12
|
+
unitPlural: 'minutes',
|
|
13
|
+
columnHeader: 'Time',
|
|
14
|
+
formatBucketStart: formatTimespan_1.toDateTime,
|
|
15
|
+
},
|
|
16
|
+
HOUR: {
|
|
17
|
+
label: 'hourly, UTC',
|
|
18
|
+
unitPlural: 'hours',
|
|
19
|
+
columnHeader: 'Time',
|
|
20
|
+
formatBucketStart: formatTimespan_1.toDateTime,
|
|
21
|
+
},
|
|
22
|
+
DAY: {
|
|
23
|
+
label: 'daily, UTC',
|
|
24
|
+
unitPlural: 'days',
|
|
25
|
+
columnHeader: 'Date',
|
|
26
|
+
formatBucketStart: formatTimespan_1.toDateOnly,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* The server fills the whole window with buckets, so a quiet project would print one zero row
|
|
31
|
+
* per period. Only the table omits them; the JSON output keeps every bucket.
|
|
32
|
+
*/
|
|
33
|
+
function buildRunsOverTimeSection(buckets, granularity, { runs, columns, toRow, }) {
|
|
34
|
+
const bucketsWithRuns = buckets.filter(bucket => runs(bucket) > 0);
|
|
35
|
+
if (bucketsWithRuns.length === 0) {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
const presentation = INSIGHTS_GRANULARITY_PRESENTATION[granularity];
|
|
39
|
+
const omittedNote = bucketsWithRuns.length < buckets.length
|
|
40
|
+
? `; ${presentation.unitPlural} with no runs omitted`
|
|
41
|
+
: '';
|
|
42
|
+
const table = (0, renderTextTable_1.default)([presentation.columnHeader, ...columns], bucketsWithRuns.map(bucket => [presentation.formatBucketStart(bucket.start), ...toRow(bucket)]));
|
|
43
|
+
return [
|
|
44
|
+
'',
|
|
45
|
+
chalk_1.default.bold(`Runs over time (${presentation.label}${omittedNote}):`),
|
|
46
|
+
'',
|
|
47
|
+
(0, indent_string_1.default)(table, 2),
|
|
48
|
+
];
|
|
49
|
+
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface InsightsTimespanBounds {
|
|
2
2
|
startTime: string;
|
|
3
3
|
endTime: string;
|
|
4
|
+
}
|
|
5
|
+
export interface InsightsTimespanFields extends InsightsTimespanBounds {
|
|
4
6
|
daysBack?: number;
|
|
5
7
|
}
|
|
6
8
|
export declare function formatTimespan(timespan: InsightsTimespanFields): string;
|
|
9
|
+
export declare function toTimespanJson(timespan: InsightsTimespanFields): object;
|
|
7
10
|
export declare function toDateOnly(isoTimestamp: string): string;
|
|
11
|
+
export declare function toDateTime(isoTimestamp: string): string;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.formatTimespan = formatTimespan;
|
|
4
|
+
exports.toTimespanJson = toTimespanJson;
|
|
4
5
|
exports.toDateOnly = toDateOnly;
|
|
6
|
+
exports.toDateTime = toDateTime;
|
|
5
7
|
const tslib_1 = require("tslib");
|
|
6
8
|
const dateformat_1 = tslib_1.__importDefault(require("dateformat"));
|
|
7
9
|
function formatTimespan(timespan) {
|
|
@@ -10,6 +12,16 @@ function formatTimespan(timespan) {
|
|
|
10
12
|
}
|
|
11
13
|
return `${toDateOnly(timespan.startTime)} to ${toDateOnly(timespan.endTime)}`;
|
|
12
14
|
}
|
|
15
|
+
function toTimespanJson(timespan) {
|
|
16
|
+
return {
|
|
17
|
+
start: timespan.startTime,
|
|
18
|
+
end: timespan.endTime,
|
|
19
|
+
...(timespan.daysBack !== undefined ? { daysBack: timespan.daysBack } : {}),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
13
22
|
function toDateOnly(isoTimestamp) {
|
|
14
23
|
return (0, dateformat_1.default)(new Date(isoTimestamp), 'UTC:yyyy-mm-dd');
|
|
15
24
|
}
|
|
25
|
+
function toDateTime(isoTimestamp) {
|
|
26
|
+
return (0, dateformat_1.default)(new Date(isoTimestamp), 'UTC:yyyy-mm-dd HH:MM');
|
|
27
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** A metric for the selected window and for the window of equal length right before it. */
|
|
2
|
+
export interface InsightsMetricSummary {
|
|
3
|
+
current: number;
|
|
4
|
+
previous: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function toMetricSummary(metric: {
|
|
7
|
+
currentValue: number;
|
|
8
|
+
previousValue: number;
|
|
9
|
+
}): InsightsMetricSummary;
|
|
10
|
+
export declare function ratePercent(part: number, total: number): number;
|
|
11
|
+
export declare function formatPercent(value: number): string;
|
|
12
|
+
export declare function formatCountWithTrend(metric: InsightsMetricSummary, options?: {
|
|
13
|
+
lowerIsBetter?: boolean;
|
|
14
|
+
}): string;
|
|
15
|
+
/** A rate with its change in percentage points. */
|
|
16
|
+
export declare function formatRateWithDelta(rate: InsightsMetricSummary, totalRuns: InsightsMetricSummary, { lowerIsBetter }?: {
|
|
17
|
+
lowerIsBetter?: boolean;
|
|
18
|
+
}): string;
|
|
19
|
+
/** A change from zero has no meaningful percentage. */
|
|
20
|
+
export declare function formatTrend(metric: InsightsMetricSummary, { lowerIsBetter }?: {
|
|
21
|
+
lowerIsBetter?: boolean;
|
|
22
|
+
}): string;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toMetricSummary = toMetricSummary;
|
|
4
|
+
exports.ratePercent = ratePercent;
|
|
5
|
+
exports.formatPercent = formatPercent;
|
|
6
|
+
exports.formatCountWithTrend = formatCountWithTrend;
|
|
7
|
+
exports.formatRateWithDelta = formatRateWithDelta;
|
|
8
|
+
exports.formatTrend = formatTrend;
|
|
9
|
+
const tslib_1 = require("tslib");
|
|
10
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
11
|
+
function toMetricSummary(metric) {
|
|
12
|
+
return { current: metric.currentValue, previous: metric.previousValue };
|
|
13
|
+
}
|
|
14
|
+
function ratePercent(part, total) {
|
|
15
|
+
return total === 0 ? 0 : (part / total) * 100;
|
|
16
|
+
}
|
|
17
|
+
function formatPercent(value) {
|
|
18
|
+
return `${value.toFixed(1)}%`;
|
|
19
|
+
}
|
|
20
|
+
function formatCountWithTrend(metric, options) {
|
|
21
|
+
return `${metric.current.toLocaleString()} (${formatTrend(metric, options)})`;
|
|
22
|
+
}
|
|
23
|
+
/** A rate with its change in percentage points. */
|
|
24
|
+
function formatRateWithDelta(rate, totalRuns, { lowerIsBetter = false } = {}) {
|
|
25
|
+
if (totalRuns.current === 0) {
|
|
26
|
+
return chalk_1.default.dim('n/a');
|
|
27
|
+
}
|
|
28
|
+
if (totalRuns.previous === 0) {
|
|
29
|
+
return `${formatPercent(rate.current)} (${chalk_1.default.dim('n/a')})`;
|
|
30
|
+
}
|
|
31
|
+
const delta = rate.current - rate.previous;
|
|
32
|
+
return `${formatPercent(rate.current)} (${formatSignedChange(delta, ' pts', lowerIsBetter ? delta < 0 : delta > 0)})`;
|
|
33
|
+
}
|
|
34
|
+
/** A change from zero has no meaningful percentage. */
|
|
35
|
+
function formatTrend(metric, { lowerIsBetter = false } = {}) {
|
|
36
|
+
if (metric.previous === 0) {
|
|
37
|
+
return chalk_1.default.dim('n/a');
|
|
38
|
+
}
|
|
39
|
+
const pct = ((metric.current - metric.previous) / metric.previous) * 100;
|
|
40
|
+
return formatSignedChange(pct, '%', lowerIsBetter ? pct < 0 : pct > 0);
|
|
41
|
+
}
|
|
42
|
+
function formatSignedChange(value, unit, isImprovement) {
|
|
43
|
+
if (value === 0) {
|
|
44
|
+
return chalk_1.default.dim(`0.0${unit}`);
|
|
45
|
+
}
|
|
46
|
+
const text = `${value > 0 ? '+' : '-'}${Math.abs(value).toFixed(1)}${unit}`;
|
|
47
|
+
return isImprovement ? chalk_1.default.green(text) : chalk_1.default.red(text);
|
|
48
|
+
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
export declare const INSIGHTS_DEFAULT_DAYS_BACK = 7;
|
|
2
|
+
export declare const InsightsTimeRangeFlags: {
|
|
3
|
+
days: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
4
|
+
start: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
5
|
+
end: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
6
|
+
};
|
|
2
7
|
export declare function resolveInsightsTimeRange(flags: {
|
|
3
8
|
days?: number;
|
|
4
9
|
start?: string;
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.INSIGHTS_DEFAULT_DAYS_BACK = void 0;
|
|
3
|
+
exports.InsightsTimeRangeFlags = exports.INSIGHTS_DEFAULT_DAYS_BACK = void 0;
|
|
4
4
|
exports.resolveInsightsTimeRange = resolveInsightsTimeRange;
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
5
6
|
const startAndEndTime_1 = require("../observe/startAndEndTime");
|
|
6
7
|
exports.INSIGHTS_DEFAULT_DAYS_BACK = 7;
|
|
8
|
+
exports.InsightsTimeRangeFlags = {
|
|
9
|
+
days: core_1.Flags.integer({
|
|
10
|
+
description: `Show insights from the last N days (default ${exports.INSIGHTS_DEFAULT_DAYS_BACK}, mutually exclusive with --start/--end).`,
|
|
11
|
+
min: 1,
|
|
12
|
+
exclusive: ['start', 'end'],
|
|
13
|
+
}),
|
|
14
|
+
start: core_1.Flags.string({
|
|
15
|
+
description: 'Start of insights time range (ISO date).',
|
|
16
|
+
exclusive: ['days'],
|
|
17
|
+
}),
|
|
18
|
+
end: core_1.Flags.string({
|
|
19
|
+
description: 'End of insights time range (ISO date).',
|
|
20
|
+
exclusive: ['days'],
|
|
21
|
+
}),
|
|
22
|
+
};
|
|
7
23
|
function resolveInsightsTimeRange(flags) {
|
|
8
24
|
const days = flags.days ?? (flags.start ? undefined : exports.INSIGHTS_DEFAULT_DAYS_BACK);
|
|
9
25
|
return (0, startAndEndTime_1.resolveTimeRange)({ ...flags, days });
|
package/build/observe/flags.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export declare const ObserveProjectIdFlag: {
|
|
2
|
-
'project-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
3
|
-
};
|
|
4
1
|
export declare const ObservePlatformFlag: {
|
|
5
2
|
platform: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
6
3
|
};
|
package/build/observe/flags.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObserveBuildNumberFlag = exports.ObserveUpdateIdFlag = exports.ObserveAppVersionFlag = exports.ObserveAfterFlag = exports.ObserveTimeRangeFlags = exports.ObserveEnvironmentFlag = exports.ObservePlatformFlag =
|
|
3
|
+
exports.ObserveBuildNumberFlag = exports.ObserveUpdateIdFlag = exports.ObserveAppVersionFlag = exports.ObserveAfterFlag = exports.ObserveTimeRangeFlags = exports.ObserveEnvironmentFlag = exports.ObservePlatformFlag = void 0;
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
5
|
const platforms_1 = require("./platforms");
|
|
6
|
-
exports.ObserveProjectIdFlag = {
|
|
7
|
-
'project-id': core_1.Flags.string({
|
|
8
|
-
description: 'EAS project ID (defaults to the project ID of the current directory)',
|
|
9
|
-
}),
|
|
10
|
-
};
|
|
11
6
|
exports.ObservePlatformFlag = {
|
|
12
7
|
platform: core_1.Flags.option({
|
|
13
8
|
description: 'Filter by platform ("apple" covers iOS, iPadOS, tvOS, and macOS)',
|
|
@@ -10,6 +10,7 @@ exports.buildObserveErrorOccurrencesTable = buildObserveErrorOccurrencesTable;
|
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
12
12
|
const renderTextTable_1 = tslib_1.__importDefault(require("../utils/renderTextTable"));
|
|
13
|
+
const terminalText_1 = require("../utils/terminalText");
|
|
13
14
|
const formatUtils_1 = require("./formatUtils");
|
|
14
15
|
function buildObserveErrorJson(event) {
|
|
15
16
|
return {
|
|
@@ -62,9 +63,6 @@ function buildObserveErrorDetail(event) {
|
|
|
62
63
|
];
|
|
63
64
|
return [chalk_1.default.bold('Error event'), '', (0, renderTextTable_1.default)(['Field', 'Value'], rows)].join('\n');
|
|
64
65
|
}
|
|
65
|
-
function truncate(value, maxLength) {
|
|
66
|
-
return value.length > maxLength ? `${value.slice(0, maxLength - 1)}…` : value;
|
|
67
|
-
}
|
|
68
66
|
function buildObserveErrorGroupsTable(groups, options) {
|
|
69
67
|
if (groups.length === 0) {
|
|
70
68
|
return chalk_1.default.yellow('No errors found.');
|
|
@@ -81,8 +79,8 @@ function buildObserveErrorGroupsTable(groups, options) {
|
|
|
81
79
|
];
|
|
82
80
|
const rows = groups.map(group => [
|
|
83
81
|
group.fingerprint,
|
|
84
|
-
truncate(group.exceptionType ?? '-', 40),
|
|
85
|
-
truncate(group.exceptionMessage ?? '-', 60),
|
|
82
|
+
(0, terminalText_1.truncate)(group.exceptionType ?? '-', 40),
|
|
83
|
+
(0, terminalText_1.truncate)(group.exceptionMessage ?? '-', 60),
|
|
86
84
|
group.isFatal ? 'fatal' : (group.severity ?? '-').toString().toLowerCase(),
|
|
87
85
|
(group.eventCount ?? 0).toLocaleString(),
|
|
88
86
|
(group.uniqueUserCount ?? 0).toLocaleString(),
|
|
@@ -4,7 +4,7 @@ exports.EAS_OBSERVE_FEATURE_NOT_AVAILABLE_IN_FREE_TIER_ERROR_CODE = exports.EAS_
|
|
|
4
4
|
exports.isObservePlanGateError = isObservePlanGateError;
|
|
5
5
|
exports.withObservePlanGateHandlingAsync = withObservePlanGateHandlingAsync;
|
|
6
6
|
const errors_1 = require("../commandUtils/errors");
|
|
7
|
-
const
|
|
7
|
+
const planGating_1 = require("../commandUtils/planGating");
|
|
8
8
|
// Must match the server's Observe plan-gate error codes (`ExpoErrorCode`). Both
|
|
9
9
|
// signal "this Observe feature is not available on the account's current plan";
|
|
10
10
|
// they differ only in which plans are blocked, which is decided server-side.
|
|
@@ -15,10 +15,7 @@ const OBSERVE_PLAN_GATE_ERROR_CODES = new Set([
|
|
|
15
15
|
exports.EAS_OBSERVE_FEATURE_NOT_AVAILABLE_IN_FREE_TIER_ERROR_CODE,
|
|
16
16
|
]);
|
|
17
17
|
function findObservePlanGateMessage(error) {
|
|
18
|
-
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
21
|
-
return error.graphQLErrors.find(e => OBSERVE_PLAN_GATE_ERROR_CODES.has(e?.extensions?.errorCode))?.message;
|
|
18
|
+
return (0, planGating_1.findPlanGateError)(error, OBSERVE_PLAN_GATE_ERROR_CODES)?.message;
|
|
22
19
|
}
|
|
23
20
|
/**
|
|
24
21
|
* Whether an error is a server Observe plan-gate rejection. Useful where a
|
|
@@ -4,6 +4,7 @@ exports.DEFAULT_DAYS_BACK = void 0;
|
|
|
4
4
|
exports.startAndEndTime = startAndEndTime;
|
|
5
5
|
exports.resolveTimeRange = resolveTimeRange;
|
|
6
6
|
const fetchMetrics_1 = require("./fetchMetrics");
|
|
7
|
+
const errors_1 = require("../commandUtils/errors");
|
|
7
8
|
exports.DEFAULT_DAYS_BACK = 60;
|
|
8
9
|
function startAndEndTime({ daysBack, start, end, }) {
|
|
9
10
|
let startTime;
|
|
@@ -26,11 +27,19 @@ function resolveTimeRange(flags) {
|
|
|
26
27
|
if (flags.end) {
|
|
27
28
|
(0, fetchMetrics_1.validateDateFlag)(flags.end, '--end');
|
|
28
29
|
}
|
|
30
|
+
if (flags.end && !flags.start) {
|
|
31
|
+
throw new errors_1.EasCommandError('--end requires --start. Pass both, or use --days instead.');
|
|
32
|
+
}
|
|
29
33
|
const daysBack = flags.days ?? (flags.start ? undefined : exports.DEFAULT_DAYS_BACK);
|
|
30
34
|
const { startTime, endTime } = startAndEndTime({
|
|
31
35
|
daysBack,
|
|
32
36
|
start: flags.start,
|
|
33
37
|
end: flags.end,
|
|
34
38
|
});
|
|
39
|
+
// Reachable by swapping --start and --end, or by passing a --start in the future, since --end
|
|
40
|
+
// defaults to now.
|
|
41
|
+
if (new Date(startTime) >= new Date(endTime)) {
|
|
42
|
+
throw new errors_1.EasCommandError(`The requested time range is empty: --start (${startTime}) must be earlier than the end of the range (${endTime}). Pass a --start earlier than the end, or use --days instead.`);
|
|
43
|
+
}
|
|
35
44
|
return { daysBack, startTime, endTime };
|
|
36
45
|
}
|
|
@@ -48,11 +48,7 @@ function toPlatformSummary(update) {
|
|
|
48
48
|
function buildUpdateInsightsJson(summary) {
|
|
49
49
|
return {
|
|
50
50
|
groupId: summary.groupId,
|
|
51
|
-
timespan:
|
|
52
|
-
start: summary.startTime,
|
|
53
|
-
end: summary.endTime,
|
|
54
|
-
...(summary.daysBack !== undefined ? { daysBack: summary.daysBack } : {}),
|
|
55
|
-
},
|
|
51
|
+
timespan: (0, formatTimespan_1.toTimespanJson)(summary),
|
|
56
52
|
platforms: summary.platforms.map(p => ({
|
|
57
53
|
platform: p.platform,
|
|
58
54
|
updateId: p.updateId,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sanitizeTerminalText = sanitizeTerminalText;
|
|
4
|
+
exports.truncate = truncate;
|
|
4
5
|
/**
|
|
5
6
|
* Sanitize externally-influenced text for printing as a single-line field value. Escape
|
|
6
7
|
* sequences in a crafted value could clear the screen or spoof output, and embedded newlines
|
|
@@ -12,3 +13,6 @@ const CONTROL_CHARACTERS = /[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F
|
|
|
12
13
|
function sanitizeTerminalText(value) {
|
|
13
14
|
return value.replace(CONTROL_CHARACTERS, '').replace(/\s+/g, ' ').trim();
|
|
14
15
|
}
|
|
16
|
+
function truncate(value, maxLength) {
|
|
17
|
+
return value.length > maxLength ? `${value.slice(0, maxLength - 1)}…` : value;
|
|
18
|
+
}
|