eas-cli 20.3.0 → 20.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +136 -113
- package/build/commandUtils/new/templates/AGENTS.md +25 -146
- package/build/commandUtils/new/templates/CLAUDE.md +1 -9
- package/build/commands/observe/session.d.ts +18 -0
- package/build/commands/observe/session.js +65 -0
- package/build/graphql/generated.d.ts +51 -74
- package/build/graphql/generated.js +1 -1
- package/build/graphql/types/Observe.js +1 -0
- package/build/observe/fetchCustomEvents.d.ts +2 -2
- package/build/observe/fetchCustomEvents.js +2 -2
- package/build/observe/fetchEvents.d.ts +4 -3
- package/build/observe/fetchEvents.js +4 -3
- package/build/observe/fetchSessions.d.ts +51 -0
- package/build/observe/fetchSessions.js +86 -0
- package/build/observe/formatEvents.d.ts +1 -0
- package/build/observe/formatEvents.js +1 -0
- package/build/observe/formatSessions.d.ts +15 -0
- package/build/observe/formatSessions.js +100 -0
- package/build/update/getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync.js +23 -26
- package/oclif.manifest.json +1438 -1343
- package/package.json +4 -3
|
@@ -65,6 +65,7 @@ function buildObserveEventsJson(events, pageInfo) {
|
|
|
65
65
|
easClientId: event.easClientId,
|
|
66
66
|
timestamp: event.timestamp,
|
|
67
67
|
customParams: resolveCustomParams(event),
|
|
68
|
+
routeName: event.routeName ?? null,
|
|
68
69
|
})),
|
|
69
70
|
pageInfo: {
|
|
70
71
|
hasNextPage: pageInfo.hasNextPage,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SessionEventEntry, SessionMetadata } from './fetchSessions';
|
|
2
|
+
export interface BuildSessionEventsOptions {
|
|
3
|
+
metadata?: SessionMetadata | null;
|
|
4
|
+
hasMoreMetricEvents?: boolean;
|
|
5
|
+
hasMoreLogEvents?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function buildObserveSessionEventsTable(entries: SessionEventEntry[], options?: BuildSessionEventsOptions): string;
|
|
8
|
+
export interface ObserveSessionEventsJson {
|
|
9
|
+
sessionId: string;
|
|
10
|
+
metadata: SessionMetadata | null;
|
|
11
|
+
entries: SessionEventEntry[];
|
|
12
|
+
hasMoreMetricEvents: boolean;
|
|
13
|
+
hasMoreLogEvents: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function buildObserveSessionEventsJson(entries: SessionEventEntry[], sessionId: string, metadata: SessionMetadata | null, hasMoreMetricEvents: boolean, hasMoreLogEvents: boolean): ObserveSessionEventsJson;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildObserveSessionEventsTable = buildObserveSessionEventsTable;
|
|
4
|
+
exports.buildObserveSessionEventsJson = buildObserveSessionEventsJson;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
|
+
const formatUtils_1 = require("./formatUtils");
|
|
8
|
+
const metricNames_1 = require("./metricNames");
|
|
9
|
+
const renderTextTable_1 = tslib_1.__importDefault(require("../utils/renderTextTable"));
|
|
10
|
+
function formatEntryName(entry) {
|
|
11
|
+
if (entry.source === 'metric' && entry.metricName) {
|
|
12
|
+
const name = (0, metricNames_1.getMetricDisplayName)(entry.metricName);
|
|
13
|
+
return entry.routeName ? `${name} · ${entry.routeName}` : name;
|
|
14
|
+
}
|
|
15
|
+
return entry.eventName ?? '-';
|
|
16
|
+
}
|
|
17
|
+
function formatMetricEntryValue(entry) {
|
|
18
|
+
if (typeof entry.metricValue === 'number') {
|
|
19
|
+
return `${entry.metricValue.toFixed(2)}s`;
|
|
20
|
+
}
|
|
21
|
+
return '-';
|
|
22
|
+
}
|
|
23
|
+
function formatEntrySeverity(entry) {
|
|
24
|
+
if (entry.source !== 'log') {
|
|
25
|
+
return '-';
|
|
26
|
+
}
|
|
27
|
+
if (entry.severityText) {
|
|
28
|
+
return entry.severityText;
|
|
29
|
+
}
|
|
30
|
+
if (entry.severityNumber != null) {
|
|
31
|
+
return String(entry.severityNumber);
|
|
32
|
+
}
|
|
33
|
+
return '-';
|
|
34
|
+
}
|
|
35
|
+
function primitivePropertyLines(entry) {
|
|
36
|
+
if (entry.source !== 'log' || !entry.properties) {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
return entry.properties
|
|
40
|
+
.filter(p => p.type === 'STRING' || p.type === 'NUMBER' || p.type === 'BOOLEAN')
|
|
41
|
+
.map(p => `${p.key}=${p.value}`);
|
|
42
|
+
}
|
|
43
|
+
function formatOffsetSeconds(startIso, currentIso) {
|
|
44
|
+
const offsetMs = new Date(currentIso).getTime() - new Date(startIso).getTime();
|
|
45
|
+
return `${(offsetMs / 1000).toFixed(2)}s`;
|
|
46
|
+
}
|
|
47
|
+
function buildObserveSessionEventsTable(entries, options) {
|
|
48
|
+
const lines = [];
|
|
49
|
+
if (options?.metadata) {
|
|
50
|
+
const { metadata } = options;
|
|
51
|
+
lines.push(`App version: ${metadata.appVersion} (${metadata.appBuildNumber})`, `Device: ${metadata.deviceModel} · ${metadata.deviceOs} ${metadata.deviceOsVersion}`, `First seen: ${(0, formatUtils_1.formatLogTimestamp)(metadata.firstSeenAt)}`, `Last seen: ${(0, formatUtils_1.formatLogTimestamp)(metadata.lastSeenAt)}`, '');
|
|
52
|
+
}
|
|
53
|
+
if (entries.length === 0) {
|
|
54
|
+
lines.push(chalk_1.default.yellow('No events found for this session.'));
|
|
55
|
+
return lines.join('\n');
|
|
56
|
+
}
|
|
57
|
+
const startIso = entries[0].timestamp;
|
|
58
|
+
const headers = ['Offset', 'Type', 'Name', 'Value', 'Properties', 'Severity'];
|
|
59
|
+
const rows = [];
|
|
60
|
+
for (const entry of entries) {
|
|
61
|
+
const offset = formatOffsetSeconds(startIso, entry.timestamp);
|
|
62
|
+
const type = entry.source === 'metric' ? 'metric' : 'log';
|
|
63
|
+
const name = formatEntryName(entry);
|
|
64
|
+
const severity = formatEntrySeverity(entry);
|
|
65
|
+
if (entry.source === 'metric') {
|
|
66
|
+
rows.push([offset, type, name, formatMetricEntryValue(entry), '-', severity]);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
const propLines = primitivePropertyLines(entry);
|
|
70
|
+
if (propLines.length === 0) {
|
|
71
|
+
rows.push([offset, type, name, '-', '-', severity]);
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
rows.push([offset, type, name, '-', propLines[0], severity]);
|
|
75
|
+
for (let i = 1; i < propLines.length; i++) {
|
|
76
|
+
rows.push(['', '', '', '', propLines[i], '']);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
lines.push((0, renderTextTable_1.default)(headers, rows));
|
|
80
|
+
if (options?.hasMoreMetricEvents || options?.hasMoreLogEvents) {
|
|
81
|
+
const sources = [];
|
|
82
|
+
if (options.hasMoreMetricEvents) {
|
|
83
|
+
sources.push('metric events');
|
|
84
|
+
}
|
|
85
|
+
if (options.hasMoreLogEvents) {
|
|
86
|
+
sources.push('log events');
|
|
87
|
+
}
|
|
88
|
+
lines.push('', chalk_1.default.yellow(`More ${sources.join(' and ')} are available for this session; only the first 100 of each are shown.`));
|
|
89
|
+
}
|
|
90
|
+
return lines.join('\n');
|
|
91
|
+
}
|
|
92
|
+
function buildObserveSessionEventsJson(entries, sessionId, metadata, hasMoreMetricEvents, hasMoreLogEvents) {
|
|
93
|
+
return {
|
|
94
|
+
sessionId,
|
|
95
|
+
metadata,
|
|
96
|
+
entries,
|
|
97
|
+
hasMoreMetricEvents,
|
|
98
|
+
hasMoreLogEvents,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
@@ -6,40 +6,37 @@ const errors_1 = require("../channel/errors");
|
|
|
6
6
|
const queries_2 = require("../channel/queries");
|
|
7
7
|
const ChannelQuery_1 = require("../graphql/queries/ChannelQuery");
|
|
8
8
|
async function getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync(graphqlClient, projectId, channelName) {
|
|
9
|
-
let
|
|
9
|
+
let channel;
|
|
10
10
|
try {
|
|
11
|
-
|
|
11
|
+
channel = await ChannelQuery_1.ChannelQuery.viewUpdateChannelAsync(graphqlClient, {
|
|
12
12
|
appId: projectId,
|
|
13
13
|
channelName,
|
|
14
14
|
});
|
|
15
|
-
if (channel.updateBranches.length === 1) {
|
|
16
|
-
const branch = channel.updateBranches[0];
|
|
17
|
-
branchInfo = { branchId: branch.id, branchName: branch.name };
|
|
18
|
-
}
|
|
19
|
-
else if (channel.updateBranches.length === 0) {
|
|
20
|
-
throw new Error("Channel has no branches associated with it. Run 'eas channel:edit' to map a branch");
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
throw new Error(`Channel has multiple branches associated with it. Instead, use '--branch' instead of '--channel'`);
|
|
24
|
-
}
|
|
25
15
|
}
|
|
26
16
|
catch (error) {
|
|
27
17
|
if (!(error instanceof errors_1.ChannelNotFoundError)) {
|
|
28
18
|
throw error;
|
|
29
19
|
}
|
|
30
|
-
|
|
31
|
-
appId: projectId,
|
|
32
|
-
branchName: channelName,
|
|
33
|
-
});
|
|
34
|
-
const { updateChannel: { createUpdateChannelForApp: newChannel }, } = await (0, queries_2.createChannelOnAppAsync)(graphqlClient, {
|
|
35
|
-
appId: projectId,
|
|
36
|
-
channelName,
|
|
37
|
-
branchId: branch.id,
|
|
38
|
-
});
|
|
39
|
-
if (!newChannel) {
|
|
40
|
-
throw new Error(`Could not create channel with name ${channelName} on project with id ${projectId}`);
|
|
41
|
-
}
|
|
42
|
-
branchInfo = { branchId: branch.id, branchName: channelName };
|
|
20
|
+
return await createAndLinkBranchToChannelAsync(graphqlClient, projectId, channelName);
|
|
43
21
|
}
|
|
44
|
-
|
|
22
|
+
if (channel.updateBranches.length === 1) {
|
|
23
|
+
const branch = channel.updateBranches[0];
|
|
24
|
+
return { branchId: branch.id, branchName: branch.name };
|
|
25
|
+
}
|
|
26
|
+
if (channel.updateBranches.length === 0) {
|
|
27
|
+
return await createAndLinkBranchToChannelAsync(graphqlClient, projectId, channelName);
|
|
28
|
+
}
|
|
29
|
+
throw new Error(`Channel has multiple branches associated with it. Instead, use '--branch' instead of '--channel'`);
|
|
30
|
+
}
|
|
31
|
+
async function createAndLinkBranchToChannelAsync(graphqlClient, projectId, channelName) {
|
|
32
|
+
const { branch } = await (0, queries_1.ensureBranchExistsAsync)(graphqlClient, {
|
|
33
|
+
appId: projectId,
|
|
34
|
+
branchName: channelName,
|
|
35
|
+
});
|
|
36
|
+
await (0, queries_2.createChannelOnAppAsync)(graphqlClient, {
|
|
37
|
+
appId: projectId,
|
|
38
|
+
channelName,
|
|
39
|
+
branchId: branch.id,
|
|
40
|
+
});
|
|
41
|
+
return { branchId: branch.id, branchName: channelName };
|
|
45
42
|
}
|