eas-cli 27.5.0 → 27.6.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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
|
+
import { AppObserveUserEventPropertyFilter } from '../../graphql/generated';
|
|
2
3
|
export default class ObserveEvents extends EasCommand {
|
|
3
4
|
static description: string;
|
|
4
5
|
static args: {
|
|
@@ -9,6 +10,7 @@ export default class ObserveEvents extends EasCommand {
|
|
|
9
10
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
11
|
'project-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
12
|
'session-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
property: import("@oclif/core/lib/interfaces").OptionFlag<AppObserveUserEventPropertyFilter[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
14
|
'all-events': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
15
|
environment: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
16
|
'update-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
@@ -15,6 +15,7 @@ const platforms_1 = require("../../observe/platforms");
|
|
|
15
15
|
const startAndEndTime_1 = require("../../observe/startAndEndTime");
|
|
16
16
|
const json_1 = require("../../utils/json");
|
|
17
17
|
const DEFAULT_EVENTS_LIMIT = 10;
|
|
18
|
+
const MAX_PROPERTY_FILTERS = 5;
|
|
18
19
|
class ObserveEvents extends EasCommand_1.default {
|
|
19
20
|
static description = 'display individual events emitted by the app via `logEvent`, filtered by the event name in the argument. With no arguments, a list of the available event names and associated event counts is returned';
|
|
20
21
|
static args = {
|
|
@@ -38,6 +39,11 @@ class ObserveEvents extends EasCommand_1.default {
|
|
|
38
39
|
'session-id': core_1.Flags.string({
|
|
39
40
|
description: 'Filter by session ID. When no event name is given, lists the events in the session instead of the event-name summary.',
|
|
40
41
|
}),
|
|
42
|
+
property: core_1.Flags.custom({
|
|
43
|
+
description: `Filter by event property (key=value, exact match). Repeat up to ${MAX_PROPERTY_FILTERS} times to require all (each key may be used once). Without an event name, lists matching events.`,
|
|
44
|
+
multiple: true,
|
|
45
|
+
parse: parsePropertyFilterAsync,
|
|
46
|
+
})(),
|
|
41
47
|
'all-events': core_1.Flags.boolean({
|
|
42
48
|
description: 'When no event name argument is provided, list all events across all event names instead of a summary of event names + counts.',
|
|
43
49
|
default: false,
|
|
@@ -55,6 +61,16 @@ class ObserveEvents extends EasCommand_1.default {
|
|
|
55
61
|
if (args.eventName && flags['all-events']) {
|
|
56
62
|
throw new Error('--all-events cannot be combined with an event name argument. Pass an event name to filter by it, or pass --all-events to list all events across all event names.');
|
|
57
63
|
}
|
|
64
|
+
if (flags.property) {
|
|
65
|
+
if (flags.property.length > MAX_PROPERTY_FILTERS) {
|
|
66
|
+
throw new Error(`--property can be used up to ${MAX_PROPERTY_FILTERS} times, but got ${flags.property.length}.`);
|
|
67
|
+
}
|
|
68
|
+
const keys = flags.property.map(filter => filter.key);
|
|
69
|
+
const repeatedKey = keys.find((key, index) => keys.indexOf(key) !== index);
|
|
70
|
+
if (repeatedKey) {
|
|
71
|
+
throw new Error(`--property key "${repeatedKey}" is used more than once. Each key can be filtered by only one value.`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
58
74
|
const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(ObserveEvents, {
|
|
59
75
|
nonInteractive,
|
|
60
76
|
projectIdOverride: flags['project-id'],
|
|
@@ -64,10 +80,10 @@ class ObserveEvents extends EasCommand_1.default {
|
|
|
64
80
|
}
|
|
65
81
|
const { daysBack, startTime, endTime } = (0, startAndEndTime_1.resolveTimeRange)(flags);
|
|
66
82
|
const platforms = (0, platforms_1.observePlatformsFromFlag)(flags.platform);
|
|
67
|
-
// A session ID
|
|
83
|
+
// A session ID or property filter narrows the events, so show them
|
|
68
84
|
// (like --all-events) instead of the account-wide name+count summary, which
|
|
69
|
-
//
|
|
70
|
-
if (!args.eventName && !flags['all-events'] && !flags['session-id']) {
|
|
85
|
+
// supports neither filter.
|
|
86
|
+
if (!args.eventName && !flags['all-events'] && !flags['session-id'] && !flags.property) {
|
|
71
87
|
const { names, isTruncated } = await (0, planGating_1.withObservePlanGateHandlingAsync)(() => ObserveQuery_1.ObserveQuery.customEventNamesAsync(graphqlClient, {
|
|
72
88
|
appId: projectId,
|
|
73
89
|
startTime,
|
|
@@ -101,8 +117,18 @@ class ObserveEvents extends EasCommand_1.default {
|
|
|
101
117
|
updateId: flags['update-id'],
|
|
102
118
|
sessionId: flags['session-id'],
|
|
103
119
|
environment: flags.environment,
|
|
120
|
+
propertyFilters: flags.property,
|
|
104
121
|
}));
|
|
105
|
-
|
|
122
|
+
// A session, app version, build number, update ID, or property may not
|
|
123
|
+
// contain the event even when the name is valid, so only suggest other names
|
|
124
|
+
// when the event name is the sole narrowing filter.
|
|
125
|
+
if (args.eventName &&
|
|
126
|
+
events.length === 0 &&
|
|
127
|
+
!flags['session-id'] &&
|
|
128
|
+
!flags['app-version'] &&
|
|
129
|
+
!flags['build-number'] &&
|
|
130
|
+
!flags['update-id'] &&
|
|
131
|
+
!flags.property) {
|
|
106
132
|
const { names, isTruncated } = await ObserveQuery_1.ObserveQuery.customEventNamesAsync(graphqlClient, {
|
|
107
133
|
appId: projectId,
|
|
108
134
|
startTime,
|
|
@@ -139,3 +165,15 @@ class ObserveEvents extends EasCommand_1.default {
|
|
|
139
165
|
}
|
|
140
166
|
}
|
|
141
167
|
exports.default = ObserveEvents;
|
|
168
|
+
// Split on the first "=" so values may contain "=".
|
|
169
|
+
async function parsePropertyFilterAsync(input) {
|
|
170
|
+
const separatorIndex = input.indexOf('=');
|
|
171
|
+
if (separatorIndex <= 0) {
|
|
172
|
+
throw new Error(`Invalid property filter "${input}". Expected key=value format.`);
|
|
173
|
+
}
|
|
174
|
+
const value = input.slice(separatorIndex + 1);
|
|
175
|
+
if (!value) {
|
|
176
|
+
throw new Error(`Invalid property filter "${input}". The value cannot be empty.`);
|
|
177
|
+
}
|
|
178
|
+
return { key: input.slice(0, separatorIndex), value };
|
|
179
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
|
2
|
-
import { AppObservePlatform, AppObserveUserEvent, AppObserveUserEventListOrderBy, PageInfo } from '../graphql/generated';
|
|
2
|
+
import { AppObservePlatform, AppObserveUserEvent, AppObserveUserEventListOrderBy, AppObserveUserEventPropertyFilter, PageInfo } from '../graphql/generated';
|
|
3
3
|
interface FetchCustomEventsOptions {
|
|
4
4
|
eventName?: string;
|
|
5
5
|
limit: number;
|
|
@@ -12,6 +12,7 @@ interface FetchCustomEventsOptions {
|
|
|
12
12
|
updateId?: string;
|
|
13
13
|
sessionId?: string;
|
|
14
14
|
environment?: string;
|
|
15
|
+
propertyFilters?: AppObserveUserEventPropertyFilter[];
|
|
15
16
|
orderBy?: AppObserveUserEventListOrderBy;
|
|
16
17
|
}
|
|
17
18
|
interface FetchCustomEventsResult {
|
|
@@ -13,6 +13,7 @@ async function fetchObserveCustomEventsAsync(graphqlClient, appId, options) {
|
|
|
13
13
|
...(options.updateId && { appUpdateId: options.updateId }),
|
|
14
14
|
...(options.sessionId && { sessionId: options.sessionId }),
|
|
15
15
|
...(options.environment && { environment: options.environment }),
|
|
16
|
+
...(options.propertyFilters?.length && { propertyFilters: options.propertyFilters }),
|
|
16
17
|
};
|
|
17
18
|
return await ObserveQuery_1.ObserveQuery.customEventListAsync(graphqlClient, {
|
|
18
19
|
appId,
|