eas-cli 20.2.0 → 20.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 +202 -110
- package/build/commandUtils/posthog.d.ts +4 -0
- package/build/commandUtils/posthog.js +23 -0
- package/build/commands/account/audit.d.ts +17 -0
- package/build/commands/account/audit.js +112 -0
- package/build/commands/integrations/posthog/connect.d.ts +27 -0
- package/build/commands/integrations/posthog/connect.js +432 -0
- package/build/commands/integrations/posthog/dashboard.d.ts +13 -0
- package/build/commands/integrations/posthog/dashboard.js +66 -0
- package/build/commands/integrations/posthog/disconnect.d.ts +14 -0
- package/build/commands/integrations/posthog/disconnect.js +80 -0
- package/build/commands/update/view.d.ts +7 -0
- package/build/commands/update/view.js +30 -3
- package/build/graphql/generated.d.ts +519 -30
- package/build/graphql/generated.js +29 -5
- package/build/graphql/mutations/PostHogMutation.d.ts +8 -0
- package/build/graphql/mutations/PostHogMutation.js +55 -0
- package/build/graphql/queries/AuditLogQuery.d.ts +6 -0
- package/build/graphql/queries/AuditLogQuery.js +57 -0
- package/build/graphql/queries/DeviceRunSessionQuery.js +1 -0
- package/build/graphql/queries/PostHogQuery.d.ts +6 -0
- package/build/graphql/queries/PostHogQuery.js +49 -0
- package/build/graphql/types/AuditLog.d.ts +1 -0
- package/build/graphql/types/AuditLog.js +18 -0
- package/build/graphql/types/PostHogConnection.d.ts +7 -0
- package/build/graphql/types/PostHogConnection.js +30 -0
- package/build/simulator/utils.js +28 -5
- package/build/user/SessionManager.d.ts +1 -22
- package/build/user/SessionManager.js +7 -89
- package/oclif.manifest.json +566 -186
- package/package.json +5 -2
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const better_opn_1 = tslib_1.__importDefault(require("better-opn"));
|
|
5
|
+
const EasCommand_1 = tslib_1.__importDefault(require("../../../commandUtils/EasCommand"));
|
|
6
|
+
const flags_1 = require("../../../commandUtils/flags");
|
|
7
|
+
const posthog_1 = require("../../../commandUtils/posthog");
|
|
8
|
+
const PostHogQuery_1 = require("../../../graphql/queries/PostHogQuery");
|
|
9
|
+
const log_1 = tslib_1.__importDefault(require("../../../log"));
|
|
10
|
+
const ora_1 = require("../../../ora");
|
|
11
|
+
const json_1 = require("../../../utils/json");
|
|
12
|
+
class IntegrationsPostHogDashboard extends EasCommand_1.default {
|
|
13
|
+
static description = 'open the PostHog dashboard for the linked PostHog project';
|
|
14
|
+
static flags = {
|
|
15
|
+
...flags_1.EasNonInteractiveAndJsonFlags,
|
|
16
|
+
};
|
|
17
|
+
static contextDefinition = {
|
|
18
|
+
...this.ContextOptions.ProjectConfig,
|
|
19
|
+
};
|
|
20
|
+
async runAsync() {
|
|
21
|
+
const { flags } = await this.parse(IntegrationsPostHogDashboard);
|
|
22
|
+
const { json: jsonFlag, nonInteractive } = (0, flags_1.resolveNonInteractiveAndJsonFlags)(flags);
|
|
23
|
+
if (jsonFlag) {
|
|
24
|
+
(0, json_1.enableJsonOutput)();
|
|
25
|
+
}
|
|
26
|
+
const { privateProjectConfig: { projectId, exp }, loggedIn: { graphqlClient }, } = await this.getContextAsync(IntegrationsPostHogDashboard, {
|
|
27
|
+
nonInteractive,
|
|
28
|
+
withServerSideEnvironment: null,
|
|
29
|
+
});
|
|
30
|
+
const posthogProject = await PostHogQuery_1.PostHogQuery.getPostHogProjectByAppIdAsync(graphqlClient, projectId);
|
|
31
|
+
if (!posthogProject) {
|
|
32
|
+
if (jsonFlag) {
|
|
33
|
+
(0, json_1.printJsonOnlyOutput)({ dashboardUrl: null });
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
(0, posthog_1.logNoPostHogProject)(exp.slug);
|
|
37
|
+
}
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const dashboardUrl = (0, posthog_1.getPostHogProjectDashboardUrl)(posthogProject);
|
|
41
|
+
if (jsonFlag) {
|
|
42
|
+
(0, json_1.printJsonOnlyOutput)({ dashboardUrl });
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (nonInteractive) {
|
|
46
|
+
log_1.default.log(dashboardUrl);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const failedMessage = `Unable to open a web browser. PostHog dashboard is available at: ${dashboardUrl}`;
|
|
50
|
+
const spinner = (0, ora_1.ora)(`Opening ${dashboardUrl}`).start();
|
|
51
|
+
try {
|
|
52
|
+
const opened = await (0, better_opn_1.default)(dashboardUrl);
|
|
53
|
+
if (opened) {
|
|
54
|
+
spinner.succeed(`Opened ${dashboardUrl}`);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
spinner.fail(failedMessage);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
spinner.fail(failedMessage);
|
|
62
|
+
throw error;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.default = IntegrationsPostHogDashboard;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import EasCommand from '../../../commandUtils/EasCommand';
|
|
2
|
+
export default class IntegrationsPostHogDisconnect extends EasCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
yes: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
6
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
};
|
|
9
|
+
static contextDefinition: {
|
|
10
|
+
loggedIn: import("../../../commandUtils/context/LoggedInContextField").default;
|
|
11
|
+
privateProjectConfig: import("../../../commandUtils/context/PrivateProjectConfigContextField").PrivateProjectConfigContextField;
|
|
12
|
+
};
|
|
13
|
+
runAsync(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
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 EasCommand_1 = tslib_1.__importDefault(require("../../../commandUtils/EasCommand"));
|
|
7
|
+
const flags_1 = require("../../../commandUtils/flags");
|
|
8
|
+
const posthog_1 = require("../../../commandUtils/posthog");
|
|
9
|
+
const PostHogMutation_1 = require("../../../graphql/mutations/PostHogMutation");
|
|
10
|
+
const PostHogQuery_1 = require("../../../graphql/queries/PostHogQuery");
|
|
11
|
+
const log_1 = tslib_1.__importDefault(require("../../../log"));
|
|
12
|
+
const ora_1 = require("../../../ora");
|
|
13
|
+
const prompts_1 = require("../../../prompts");
|
|
14
|
+
const json_1 = require("../../../utils/json");
|
|
15
|
+
class IntegrationsPostHogDisconnect extends EasCommand_1.default {
|
|
16
|
+
static description = 'remove the PostHog project link for the current Expo app from EAS servers';
|
|
17
|
+
static flags = {
|
|
18
|
+
...flags_1.EasNonInteractiveAndJsonFlags,
|
|
19
|
+
yes: core_1.Flags.boolean({
|
|
20
|
+
char: 'y',
|
|
21
|
+
description: 'Skip confirmation prompt',
|
|
22
|
+
default: false,
|
|
23
|
+
}),
|
|
24
|
+
};
|
|
25
|
+
static contextDefinition = {
|
|
26
|
+
...this.ContextOptions.ProjectConfig,
|
|
27
|
+
};
|
|
28
|
+
async runAsync() {
|
|
29
|
+
const { flags } = await this.parse(IntegrationsPostHogDisconnect);
|
|
30
|
+
const { yes } = flags;
|
|
31
|
+
const { json: jsonFlag, nonInteractive } = (0, flags_1.resolveNonInteractiveAndJsonFlags)(flags);
|
|
32
|
+
if (jsonFlag) {
|
|
33
|
+
(0, json_1.enableJsonOutput)();
|
|
34
|
+
}
|
|
35
|
+
const { privateProjectConfig: { projectId, exp }, loggedIn: { graphqlClient }, } = await this.getContextAsync(IntegrationsPostHogDisconnect, {
|
|
36
|
+
nonInteractive,
|
|
37
|
+
withServerSideEnvironment: null,
|
|
38
|
+
});
|
|
39
|
+
const posthogProject = await PostHogQuery_1.PostHogQuery.getPostHogProjectByAppIdAsync(graphqlClient, projectId);
|
|
40
|
+
if (!posthogProject) {
|
|
41
|
+
if (jsonFlag) {
|
|
42
|
+
(0, json_1.printJsonOnlyOutput)({ id: null });
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
(0, posthog_1.logNoPostHogProject)(exp.slug);
|
|
46
|
+
}
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (!jsonFlag) {
|
|
50
|
+
log_1.default.addNewLineIfNone();
|
|
51
|
+
log_1.default.log((0, posthog_1.formatPostHogProject)(posthogProject));
|
|
52
|
+
log_1.default.newLine();
|
|
53
|
+
}
|
|
54
|
+
if (!nonInteractive && !yes) {
|
|
55
|
+
const confirmed = await (0, prompts_1.confirmAsync)({
|
|
56
|
+
message: 'Remove this PostHog project link from EAS servers? This does not delete the project on PostHog.',
|
|
57
|
+
});
|
|
58
|
+
if (!confirmed) {
|
|
59
|
+
log_1.default.warn('Canceled removal of the PostHog project link.');
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else if (!jsonFlag) {
|
|
64
|
+
log_1.default.warn('Removing the PostHog project link from EAS servers. This does not delete the project on PostHog.');
|
|
65
|
+
}
|
|
66
|
+
const spinner = jsonFlag ? null : (0, ora_1.ora)('Removing PostHog project link').start();
|
|
67
|
+
try {
|
|
68
|
+
await PostHogMutation_1.PostHogMutation.deletePostHogProjectAsync(graphqlClient, posthogProject.id);
|
|
69
|
+
spinner?.succeed(`Removed PostHog project ${chalk_1.default.bold(posthogProject.posthogProjectName)} from EAS servers`);
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
spinner?.fail('Failed to remove PostHog project link');
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
if (jsonFlag) {
|
|
76
|
+
(0, json_1.printJsonOnlyOutput)({ id: posthogProject.id, name: posthogProject.posthogProjectName });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.default = IntegrationsPostHogDisconnect;
|
|
@@ -15,4 +15,11 @@ export default class UpdateView extends EasCommand {
|
|
|
15
15
|
loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
|
|
16
16
|
};
|
|
17
17
|
runAsync(): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Resolves the provided ID into an update group and its updates. The ID may be either an
|
|
20
|
+
* update group ID or the ID of a single platform-specific update. We first try to look it up
|
|
21
|
+
* as a group; if no updates are found, we fall back to resolving it as a platform-specific
|
|
22
|
+
* update and then fetch the group that update belongs to.
|
|
23
|
+
*/
|
|
24
|
+
private static resolveUpdateGroupAsync;
|
|
18
25
|
}
|
|
@@ -17,7 +17,7 @@ class UpdateView extends EasCommand_1.default {
|
|
|
17
17
|
static args = {
|
|
18
18
|
groupId: core_1.Args.string({
|
|
19
19
|
required: true,
|
|
20
|
-
description: 'The ID of an update group.',
|
|
20
|
+
description: 'The ID of an update group, or the ID of a platform-specific update.',
|
|
21
21
|
}),
|
|
22
22
|
};
|
|
23
23
|
static flags = {
|
|
@@ -44,7 +44,7 @@ class UpdateView extends EasCommand_1.default {
|
|
|
44
44
|
...this.ContextOptions.LoggedIn,
|
|
45
45
|
};
|
|
46
46
|
async runAsync() {
|
|
47
|
-
const { args: { groupId }, flags: { json: jsonFlag, insights: insightsFlag, days, start, end }, } = await this.parse(UpdateView);
|
|
47
|
+
const { args: { groupId: idArg }, flags: { json: jsonFlag, insights: insightsFlag, days, start, end }, } = await this.parse(UpdateView);
|
|
48
48
|
if (!insightsFlag && (days !== undefined || start !== undefined || end !== undefined)) {
|
|
49
49
|
throw new Error('--days, --start, and --end can only be used with --insights.');
|
|
50
50
|
}
|
|
@@ -52,7 +52,7 @@ class UpdateView extends EasCommand_1.default {
|
|
|
52
52
|
if (jsonFlag) {
|
|
53
53
|
(0, json_1.enableJsonOutput)();
|
|
54
54
|
}
|
|
55
|
-
const updatesByGroup = await
|
|
55
|
+
const { groupId, updatesByGroup } = await UpdateView.resolveUpdateGroupAsync(graphqlClient, idArg);
|
|
56
56
|
let insightsSummary = null;
|
|
57
57
|
if (insightsFlag) {
|
|
58
58
|
const { daysBack, startTime, endTime } = (0, timeRange_1.resolveInsightsTimeRange)({ days, start, end });
|
|
@@ -84,5 +84,32 @@ class UpdateView extends EasCommand_1.default {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Resolves the provided ID into an update group and its updates. The ID may be either an
|
|
89
|
+
* update group ID or the ID of a single platform-specific update. We first try to look it up
|
|
90
|
+
* as a group; if no updates are found, we fall back to resolving it as a platform-specific
|
|
91
|
+
* update and then fetch the group that update belongs to.
|
|
92
|
+
*/
|
|
93
|
+
static async resolveUpdateGroupAsync(graphqlClient, id) {
|
|
94
|
+
try {
|
|
95
|
+
const updatesByGroup = await UpdateQuery_1.UpdateQuery.viewUpdateGroupAsync(graphqlClient, { groupId: id });
|
|
96
|
+
return { groupId: id, updatesByGroup };
|
|
97
|
+
}
|
|
98
|
+
catch (groupError) {
|
|
99
|
+
let update;
|
|
100
|
+
try {
|
|
101
|
+
update = await UpdateQuery_1.UpdateQuery.viewByUpdateAsync(graphqlClient, { updateId: id });
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
// The ID is neither a valid update group nor a valid platform-specific update; surface
|
|
105
|
+
// the original group lookup error since the group ID is the primary input.
|
|
106
|
+
throw groupError;
|
|
107
|
+
}
|
|
108
|
+
const updatesByGroup = await UpdateQuery_1.UpdateQuery.viewUpdateGroupAsync(graphqlClient, {
|
|
109
|
+
groupId: update.group,
|
|
110
|
+
});
|
|
111
|
+
return { groupId: update.group, updatesByGroup };
|
|
112
|
+
}
|
|
113
|
+
}
|
|
87
114
|
}
|
|
88
115
|
exports.default = UpdateView;
|