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
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.DashboardViewPin = exports.CustomDomainStatus = exports.CustomDomainDnsRecordType = exports.CrashSampleFor = exports.ContinentCode = exports.BuildWorkflow = exports.BuildTrigger = exports.BuildStatus = exports.BuildRetryDisabledReason = exports.BuildResourceClass = exports.BuildPriority = exports.BuildPhase = exports.BuildMode = exports.BuildLimitThresholdExceededMetadataType = exports.BuildIosEnterpriseProvisioning = exports.BuildCredentialsSource = exports.BuildAnnotationType = exports.BackgroundJobState = exports.BackgroundJobResultType = exports.AuthProviderIdentifier = exports.AuthProtocolType = exports.AuditLogsExportFormat = exports.AssetMetadataStatus = exports.AssetMapSourceType = exports.AppsFilter = exports.AppleTeamType = exports.AppleDeviceClass = exports.AppUploadSessionType = exports.AppStoreConnectUserRole = exports.AppSort = exports.AppProfileImageWidth = exports.AppPrivacy = exports.AppPlatform = exports.AppObserveUpdatesOrderByField = exports.AppObserveUpdatesOrderByDirection = exports.AppObservePropertyType = exports.AppObservePlatform = exports.AppObserveNavigationRoutesOrderByField = exports.AppObserveEventsOrderByField = exports.AppObserveEventsOrderByDirection = exports.AppObserveCustomEventNamesOrderByField = exports.AppObserveCustomEventNamesOrderByDirection = exports.AppInternalDistributionBuildPrivacy = exports.AndroidKeystoreType = exports.AndroidFcmVersion = exports.AndroidBuildType = exports.ActivityTimelineProjectActivityType = exports.AccountUploadSessionType = exports.AccountMemberType = exports.AccountAppsSortByField = void 0;
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
12
|
-
exports.WorkflowsInsightsRunsOverTimeGranularity = exports.WorkflowsInsightsExportFormat = exports.WorkflowRunTriggerEventType = void 0;
|
|
10
|
+
exports.OAuthProvider = exports.NotificationType = exports.NotificationEvent = exports.LocalBuildArchiveSourceType = exports.JobRunStatus = exports.JobRunPriority = exports.IosSchemeBuildConfiguration = exports.IosManagedBuildType = exports.IosDistributionType = exports.IosBuildType = exports.InvoiceDiscountType = exports.InsightsFilterType = exports.GitHubJobRunTriggerType = exports.GitHubJobRunTriggerRunStatus = exports.GitHubJobRunJobType = exports.GitHubBuildTriggerType = exports.GitHubBuildTriggerRunStatus = exports.GitHubBuildTriggerExecutionBehavior = exports.GitHubAppInstallationStatus = exports.GitHubAppInstallationAccountType = exports.GitHubAppEnvironment = exports.FingerprintSourceType = exports.Feature = exports.Experiment = exports.ExitInterviewOutcome = exports.ExitInterviewMessageRole = exports.EnvironmentVariableVisibility = exports.EnvironmentVariableScope = exports.EnvironmentSecretType = exports.EntityTypeName = exports.EchoVersionSource = exports.EchoTurnCompletionStatus = exports.EchoProjectVisibility = exports.EchoProjectUploadSessionType = exports.EchoProjectIconSource = exports.EchoMessageRole = exports.EchoMessagePartType = exports.EchoChatState = exports.EchoChangeType = exports.EchoBuildStatus = exports.EchoAgentType = exports.EasTotalPlanEnablementUnit = exports.EasServiceMetric = exports.EasService = exports.EasBuildWaiverType = exports.EasBuildDeprecationInfoType = exports.EasBuildBillingResourceClass = exports.DistributionType = exports.DeviceRunSessionType = exports.DeviceRunSessionStatus = void 0;
|
|
11
|
+
exports.WorkflowJobStatus = exports.WorkflowJobReviewDecision = exports.WorkflowDeviceTestCaseStatusFilter = exports.WorkflowDeviceTestCaseStatus = exports.WorkflowDeviceTestCaseStatSortField = exports.WorkflowDeviceTestCaseSortDirection = exports.WorkflowDeviceTestCaseInsightsTimeSeriesGranularity = exports.WorkflowArtifactStorageType = exports.WorkerLoggerLevel = exports.WorkerDeploymentLogLevel = exports.WorkerDeploymentCrashKind = exports.WebhookType = exports.UserSpecifiedAccountUsage = exports.UserEntityTypeName = exports.UserAgentPlatform = exports.UserAgentOs = exports.UserAgentBrowser = exports.UsageMetricsGranularity = exports.UsageMetricType = exports.UploadSessionType = exports.UpdateDiffReceiptStateValue = exports.UpdateDiffReceiptOrderByField = exports.UpdateDiffReceiptOrderByDirection = exports.TargetEntityMutationType = exports.SubmissionStatus = exports.SubmissionPriority = exports.SubmissionArchiveSourceType = exports.SubmissionAndroidReleaseStatus = exports.SubmissionAndroidArchiveType = exports.StatuspageServiceStatus = exports.StatuspageServiceName = exports.StatuspageIncidentStatus = exports.StatuspageIncidentImpact = exports.StandardOffer = exports.SecondFactorMethod = exports.Role = exports.ResponseType = exports.ResponseStatusType = exports.ResponseCacheStatus = exports.ResourceClassExperiment = exports.RequestsOrderByField = exports.RequestsOrderByDirection = exports.RequestMethod = exports.ProjectArchiveSourceType = exports.PostHogRegion = exports.Permission = exports.Order = exports.OnboardingEnvironment = exports.OnboardingDeviceType = exports.OfferType = void 0;
|
|
12
|
+
exports.WorkflowsInsightsRunsOverTimeGranularity = exports.WorkflowsInsightsExportFormat = exports.WorkflowRunTriggerEventType = exports.WorkflowRunStatus = exports.WorkflowProjectSourceType = exports.WorkflowJobType = void 0;
|
|
13
13
|
var AccountAppsSortByField;
|
|
14
14
|
(function (AccountAppsSortByField) {
|
|
15
15
|
AccountAppsSortByField["LatestActivityTime"] = "LATEST_ACTIVITY_TIME";
|
|
@@ -311,7 +311,7 @@ var BuildPhase;
|
|
|
311
311
|
BuildPhase["StartBuild"] = "START_BUILD";
|
|
312
312
|
BuildPhase["Unknown"] = "UNKNOWN";
|
|
313
313
|
BuildPhase["UploadApplicationArchive"] = "UPLOAD_APPLICATION_ARCHIVE";
|
|
314
|
-
/** @deprecated
|
|
314
|
+
/** @deprecated Field no longer supported */
|
|
315
315
|
BuildPhase["UploadArtifacts"] = "UPLOAD_ARTIFACTS";
|
|
316
316
|
BuildPhase["UploadBuildArtifacts"] = "UPLOAD_BUILD_ARTIFACTS";
|
|
317
317
|
})(BuildPhase || (exports.BuildPhase = BuildPhase = {}));
|
|
@@ -565,6 +565,8 @@ var EntityTypeName;
|
|
|
565
565
|
EntityTypeName["IosAppCredentialsEntity"] = "IosAppCredentialsEntity";
|
|
566
566
|
EntityTypeName["LogRocketOrganizationEntity"] = "LogRocketOrganizationEntity";
|
|
567
567
|
EntityTypeName["LogRocketProjectEntity"] = "LogRocketProjectEntity";
|
|
568
|
+
EntityTypeName["PostHogOrganizationConnectionEntity"] = "PostHogOrganizationConnectionEntity";
|
|
569
|
+
EntityTypeName["PostHogProjectEntity"] = "PostHogProjectEntity";
|
|
568
570
|
EntityTypeName["UserInvitationEntity"] = "UserInvitationEntity";
|
|
569
571
|
EntityTypeName["UserPermissionEntity"] = "UserPermissionEntity";
|
|
570
572
|
EntityTypeName["VexoAccountConnectionEntity"] = "VexoAccountConnectionEntity";
|
|
@@ -593,6 +595,18 @@ var EnvironmentVariableVisibility;
|
|
|
593
595
|
EnvironmentVariableVisibility["Secret"] = "SECRET";
|
|
594
596
|
EnvironmentVariableVisibility["Sensitive"] = "SENSITIVE";
|
|
595
597
|
})(EnvironmentVariableVisibility || (exports.EnvironmentVariableVisibility = EnvironmentVariableVisibility = {}));
|
|
598
|
+
var ExitInterviewMessageRole;
|
|
599
|
+
(function (ExitInterviewMessageRole) {
|
|
600
|
+
ExitInterviewMessageRole["Assistant"] = "ASSISTANT";
|
|
601
|
+
ExitInterviewMessageRole["User"] = "USER";
|
|
602
|
+
})(ExitInterviewMessageRole || (exports.ExitInterviewMessageRole = ExitInterviewMessageRole = {}));
|
|
603
|
+
var ExitInterviewOutcome;
|
|
604
|
+
(function (ExitInterviewOutcome) {
|
|
605
|
+
ExitInterviewOutcome["CancelledImmediately"] = "CANCELLED_IMMEDIATELY";
|
|
606
|
+
ExitInterviewOutcome["ContinuedToStripe"] = "CONTINUED_TO_STRIPE";
|
|
607
|
+
ExitInterviewOutcome["Dismissed"] = "DISMISSED";
|
|
608
|
+
ExitInterviewOutcome["KeptPlan"] = "KEPT_PLAN";
|
|
609
|
+
})(ExitInterviewOutcome || (exports.ExitInterviewOutcome = ExitInterviewOutcome = {}));
|
|
596
610
|
var Experiment;
|
|
597
611
|
(function (Experiment) {
|
|
598
612
|
Experiment["Orbit"] = "ORBIT";
|
|
@@ -763,6 +777,11 @@ var Permission;
|
|
|
763
777
|
Permission["Publish"] = "PUBLISH";
|
|
764
778
|
Permission["View"] = "VIEW";
|
|
765
779
|
})(Permission || (exports.Permission = Permission = {}));
|
|
780
|
+
var PostHogRegion;
|
|
781
|
+
(function (PostHogRegion) {
|
|
782
|
+
PostHogRegion["Eu"] = "EU";
|
|
783
|
+
PostHogRegion["Us"] = "US";
|
|
784
|
+
})(PostHogRegion || (exports.PostHogRegion = PostHogRegion = {}));
|
|
766
785
|
var ProjectArchiveSourceType;
|
|
767
786
|
(function (ProjectArchiveSourceType) {
|
|
768
787
|
ProjectArchiveSourceType["Gcs"] = "GCS";
|
|
@@ -834,7 +853,10 @@ var SecondFactorMethod;
|
|
|
834
853
|
(function (SecondFactorMethod) {
|
|
835
854
|
/** Google Authenticator (TOTP) */
|
|
836
855
|
SecondFactorMethod["Authenticator"] = "AUTHENTICATOR";
|
|
837
|
-
/**
|
|
856
|
+
/**
|
|
857
|
+
* SMS
|
|
858
|
+
* @deprecated No longer supported
|
|
859
|
+
*/
|
|
838
860
|
SecondFactorMethod["Sms"] = "SMS";
|
|
839
861
|
})(SecondFactorMethod || (exports.SecondFactorMethod = SecondFactorMethod = {}));
|
|
840
862
|
var StandardOffer;
|
|
@@ -1020,6 +1042,7 @@ var UserEntityTypeName;
|
|
|
1020
1042
|
UserEntityTypeName["PasswordEntity"] = "PasswordEntity";
|
|
1021
1043
|
UserEntityTypeName["SsoUserEntity"] = "SSOUserEntity";
|
|
1022
1044
|
UserEntityTypeName["UserEntity"] = "UserEntity";
|
|
1045
|
+
UserEntityTypeName["UserPasskeyCredentialEntity"] = "UserPasskeyCredentialEntity";
|
|
1023
1046
|
UserEntityTypeName["UserPermissionEntity"] = "UserPermissionEntity";
|
|
1024
1047
|
UserEntityTypeName["UserSecondFactorBackupCodesEntity"] = "UserSecondFactorBackupCodesEntity";
|
|
1025
1048
|
UserEntityTypeName["UserSecondFactorDeviceEntity"] = "UserSecondFactorDeviceEntity";
|
|
@@ -1168,6 +1191,7 @@ var WorkflowRunTriggerEventType;
|
|
|
1168
1191
|
WorkflowRunTriggerEventType["GithubPullRequestReopened"] = "GITHUB_PULL_REQUEST_REOPENED";
|
|
1169
1192
|
WorkflowRunTriggerEventType["GithubPullRequestSynchronize"] = "GITHUB_PULL_REQUEST_SYNCHRONIZE";
|
|
1170
1193
|
WorkflowRunTriggerEventType["GithubPush"] = "GITHUB_PUSH";
|
|
1194
|
+
WorkflowRunTriggerEventType["GithubRefDelete"] = "GITHUB_REF_DELETE";
|
|
1171
1195
|
WorkflowRunTriggerEventType["Manual"] = "MANUAL";
|
|
1172
1196
|
WorkflowRunTriggerEventType["RepackExpoGo"] = "REPACK_EXPO_GO";
|
|
1173
1197
|
WorkflowRunTriggerEventType["Schedule"] = "SCHEDULE";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
|
2
|
+
import { CreatePostHogAccountRequestInput, SetupPostHogProjectInput } from '../generated';
|
|
3
|
+
import { PostHogOrganizationConnectionData, PostHogProjectData } from '../types/PostHogConnection';
|
|
4
|
+
export declare const PostHogMutation: {
|
|
5
|
+
createPostHogAccountRequestAsync(graphqlClient: ExpoGraphqlClient, input: CreatePostHogAccountRequestInput): Promise<PostHogOrganizationConnectionData>;
|
|
6
|
+
setupPostHogProjectAsync(graphqlClient: ExpoGraphqlClient, input: SetupPostHogProjectInput): Promise<PostHogProjectData>;
|
|
7
|
+
deletePostHogProjectAsync(graphqlClient: ExpoGraphqlClient, id: string): Promise<string>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PostHogMutation = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const graphql_1 = require("graphql");
|
|
6
|
+
const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
|
|
7
|
+
const client_1 = require("../client");
|
|
8
|
+
const PostHogConnection_1 = require("../types/PostHogConnection");
|
|
9
|
+
exports.PostHogMutation = {
|
|
10
|
+
async createPostHogAccountRequestAsync(graphqlClient, input) {
|
|
11
|
+
const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
|
|
12
|
+
.mutation((0, graphql_tag_1.default) `
|
|
13
|
+
mutation CreatePostHogAccountRequest($input: CreatePostHogAccountRequestInput!) {
|
|
14
|
+
posthogOrganizationConnection {
|
|
15
|
+
createPostHogAccountRequest(input: $input) {
|
|
16
|
+
id
|
|
17
|
+
...PostHogOrganizationConnectionFragment
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
${(0, graphql_1.print)(PostHogConnection_1.PostHogOrganizationConnectionFragmentNode)}
|
|
22
|
+
`, { input })
|
|
23
|
+
.toPromise());
|
|
24
|
+
return data.posthogOrganizationConnection.createPostHogAccountRequest;
|
|
25
|
+
},
|
|
26
|
+
async setupPostHogProjectAsync(graphqlClient, input) {
|
|
27
|
+
const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
|
|
28
|
+
.mutation((0, graphql_tag_1.default) `
|
|
29
|
+
mutation SetupPostHogProject($input: SetupPostHogProjectInput!) {
|
|
30
|
+
posthogProject {
|
|
31
|
+
setupPostHogProject(input: $input) {
|
|
32
|
+
id
|
|
33
|
+
...PostHogProjectFragment
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
${(0, graphql_1.print)(PostHogConnection_1.PostHogOrganizationConnectionFragmentNode)}
|
|
38
|
+
${(0, graphql_1.print)(PostHogConnection_1.PostHogProjectFragmentNode)}
|
|
39
|
+
`, { input })
|
|
40
|
+
.toPromise());
|
|
41
|
+
return data.posthogProject.setupPostHogProject;
|
|
42
|
+
},
|
|
43
|
+
async deletePostHogProjectAsync(graphqlClient, id) {
|
|
44
|
+
const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
|
|
45
|
+
.mutation((0, graphql_tag_1.default) `
|
|
46
|
+
mutation DeletePostHogProject($id: ID!) {
|
|
47
|
+
posthogProject {
|
|
48
|
+
deletePostHogProject(id: $id)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
`, { id }, { additionalTypenames: ['App', 'PostHogProject'] })
|
|
52
|
+
.toPromise());
|
|
53
|
+
return data.posthogProject.deletePostHogProject;
|
|
54
|
+
},
|
|
55
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
|
2
|
+
import { Connection, QueryParams } from '../../utils/relay';
|
|
3
|
+
import { AuditLogFragment } from '../generated';
|
|
4
|
+
export declare const AuditLogQuery: {
|
|
5
|
+
getAllForAccountAsync(graphqlClient: ExpoGraphqlClient, accountId: string, queryParams: QueryParams): Promise<Connection<AuditLogFragment>>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuditLogQuery = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const graphql_1 = require("graphql");
|
|
6
|
+
const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
|
|
7
|
+
const client_1 = require("../client");
|
|
8
|
+
const AuditLog_1 = require("../types/AuditLog");
|
|
9
|
+
exports.AuditLogQuery = {
|
|
10
|
+
async getAllForAccountAsync(graphqlClient, accountId, queryParams) {
|
|
11
|
+
const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
|
|
12
|
+
.query((0, graphql_tag_1.default) `
|
|
13
|
+
query AuditLogsByAccount(
|
|
14
|
+
$accountId: String!
|
|
15
|
+
$first: Int
|
|
16
|
+
$after: String
|
|
17
|
+
$last: Int
|
|
18
|
+
$before: String
|
|
19
|
+
) {
|
|
20
|
+
account {
|
|
21
|
+
byId(accountId: $accountId) {
|
|
22
|
+
id
|
|
23
|
+
auditLogsPaginated(
|
|
24
|
+
first: $first
|
|
25
|
+
after: $after
|
|
26
|
+
last: $last
|
|
27
|
+
before: $before
|
|
28
|
+
) {
|
|
29
|
+
edges {
|
|
30
|
+
cursor
|
|
31
|
+
node {
|
|
32
|
+
id
|
|
33
|
+
...AuditLogFragment
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
pageInfo {
|
|
37
|
+
hasNextPage
|
|
38
|
+
hasPreviousPage
|
|
39
|
+
startCursor
|
|
40
|
+
endCursor
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
${(0, graphql_1.print)(AuditLog_1.AuditLogFragmentNode)}
|
|
47
|
+
`, {
|
|
48
|
+
accountId,
|
|
49
|
+
first: queryParams.first,
|
|
50
|
+
after: queryParams.after,
|
|
51
|
+
last: queryParams.last,
|
|
52
|
+
before: queryParams.before,
|
|
53
|
+
}, { additionalTypenames: ['AuditLog'] })
|
|
54
|
+
.toPromise());
|
|
55
|
+
return data.account.byId.auditLogsPaginated;
|
|
56
|
+
},
|
|
57
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
|
2
|
+
import { PostHogOrganizationConnectionData, PostHogProjectData } from '../types/PostHogConnection';
|
|
3
|
+
export declare const PostHogQuery: {
|
|
4
|
+
getPostHogOrganizationConnectionByAccountIdAsync(graphqlClient: ExpoGraphqlClient, accountId: string): Promise<PostHogOrganizationConnectionData | null>;
|
|
5
|
+
getPostHogProjectByAppIdAsync(graphqlClient: ExpoGraphqlClient, appId: string): Promise<PostHogProjectData | null>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PostHogQuery = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const graphql_1 = require("graphql");
|
|
6
|
+
const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
|
|
7
|
+
const client_1 = require("../client");
|
|
8
|
+
const PostHogConnection_1 = require("../types/PostHogConnection");
|
|
9
|
+
exports.PostHogQuery = {
|
|
10
|
+
async getPostHogOrganizationConnectionByAccountIdAsync(graphqlClient, accountId) {
|
|
11
|
+
const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
|
|
12
|
+
.query((0, graphql_tag_1.default) `
|
|
13
|
+
query PostHogOrganizationConnectionByAccountId($accountId: String!) {
|
|
14
|
+
account {
|
|
15
|
+
byId(accountId: $accountId) {
|
|
16
|
+
id
|
|
17
|
+
posthogOrganizationConnection {
|
|
18
|
+
id
|
|
19
|
+
...PostHogOrganizationConnectionFragment
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
${(0, graphql_1.print)(PostHogConnection_1.PostHogOrganizationConnectionFragmentNode)}
|
|
25
|
+
`, { accountId }, { additionalTypenames: ['PostHogOrganizationConnection'] })
|
|
26
|
+
.toPromise());
|
|
27
|
+
return data.account.byId.posthogOrganizationConnection ?? null;
|
|
28
|
+
},
|
|
29
|
+
async getPostHogProjectByAppIdAsync(graphqlClient, appId) {
|
|
30
|
+
const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
|
|
31
|
+
.query((0, graphql_tag_1.default) `
|
|
32
|
+
query PostHogProjectByAppId($appId: String!) {
|
|
33
|
+
app {
|
|
34
|
+
byId(appId: $appId) {
|
|
35
|
+
id
|
|
36
|
+
posthogProject {
|
|
37
|
+
id
|
|
38
|
+
...PostHogProjectFragment
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
${(0, graphql_1.print)(PostHogConnection_1.PostHogOrganizationConnectionFragmentNode)}
|
|
44
|
+
${(0, graphql_1.print)(PostHogConnection_1.PostHogProjectFragmentNode)}
|
|
45
|
+
`, { appId }, { additionalTypenames: ['App', 'PostHogProject'] })
|
|
46
|
+
.toPromise());
|
|
47
|
+
return data.app.byId.posthogProject ?? null;
|
|
48
|
+
},
|
|
49
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AuditLogFragmentNode: import("graphql").DocumentNode;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuditLogFragmentNode = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
|
|
6
|
+
exports.AuditLogFragmentNode = (0, graphql_tag_1.default) `
|
|
7
|
+
fragment AuditLogFragment on AuditLog {
|
|
8
|
+
id
|
|
9
|
+
createdAt
|
|
10
|
+
websiteMessage
|
|
11
|
+
targetEntityTypePublicName
|
|
12
|
+
targetEntityMutationType
|
|
13
|
+
actor {
|
|
14
|
+
id
|
|
15
|
+
displayName
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PostHogOrganizationConnection, PostHogProject } from '../generated';
|
|
2
|
+
export type PostHogOrganizationConnectionData = Pick<PostHogOrganizationConnection, 'id' | 'posthogOrganizationIdentifier' | 'posthogOrganizationName' | 'posthogRegion' | 'createdAt' | 'updatedAt'>;
|
|
3
|
+
export type PostHogProjectData = Pick<PostHogProject, 'id' | 'posthogProjectIdentifier' | 'posthogProjectName' | 'posthogProjectToken' | 'posthogHost' | 'createdAt' | 'updatedAt'> & {
|
|
4
|
+
posthogOrganizationConnection: PostHogOrganizationConnectionData;
|
|
5
|
+
};
|
|
6
|
+
export declare const PostHogOrganizationConnectionFragmentNode: import("graphql").DocumentNode;
|
|
7
|
+
export declare const PostHogProjectFragmentNode: import("graphql").DocumentNode;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PostHogProjectFragmentNode = exports.PostHogOrganizationConnectionFragmentNode = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
|
|
6
|
+
exports.PostHogOrganizationConnectionFragmentNode = (0, graphql_tag_1.default) `
|
|
7
|
+
fragment PostHogOrganizationConnectionFragment on PostHogOrganizationConnection {
|
|
8
|
+
id
|
|
9
|
+
posthogOrganizationIdentifier
|
|
10
|
+
posthogOrganizationName
|
|
11
|
+
posthogRegion
|
|
12
|
+
createdAt
|
|
13
|
+
updatedAt
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
exports.PostHogProjectFragmentNode = (0, graphql_tag_1.default) `
|
|
17
|
+
fragment PostHogProjectFragment on PostHogProject {
|
|
18
|
+
id
|
|
19
|
+
posthogProjectIdentifier
|
|
20
|
+
posthogProjectName
|
|
21
|
+
posthogProjectToken
|
|
22
|
+
posthogHost
|
|
23
|
+
createdAt
|
|
24
|
+
updatedAt
|
|
25
|
+
posthogOrganizationConnection {
|
|
26
|
+
id
|
|
27
|
+
...PostHogOrganizationConnectionFragment
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
`;
|
package/build/simulator/utils.js
CHANGED
|
@@ -24,6 +24,10 @@ function getRemoteSessionEnvironmentVariables(remoteConfig) {
|
|
|
24
24
|
AGENT_DEVICE_DAEMON_AUTH_TOKEN: remoteConfig.agentDeviceRemoteSessionToken,
|
|
25
25
|
};
|
|
26
26
|
case 'ArgentRunSessionRemoteConfig':
|
|
27
|
+
return {
|
|
28
|
+
ARGENT_TOOLS_URL: remoteConfig.toolsUrl,
|
|
29
|
+
...(remoteConfig.toolsAuthToken ? { ARGENT_AUTH_TOKEN: remoteConfig.toolsAuthToken } : {}),
|
|
30
|
+
};
|
|
27
31
|
case 'ServeSimRunSessionRemoteConfig':
|
|
28
32
|
return {};
|
|
29
33
|
}
|
|
@@ -49,11 +53,30 @@ function formatRemoteSessionInstructions(remoteConfig, configType) {
|
|
|
49
53
|
return lines.join('\n');
|
|
50
54
|
}
|
|
51
55
|
case 'ArgentRunSessionRemoteConfig': {
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
const environmentVariables = getRemoteSessionEnvironmentVariables(remoteConfig);
|
|
57
|
+
const lines = configType === 'dotenv'
|
|
58
|
+
? [
|
|
59
|
+
'🔑 Run the following to link your local Argent client to this simulator session:',
|
|
60
|
+
'',
|
|
61
|
+
[
|
|
62
|
+
'argent',
|
|
63
|
+
'link',
|
|
64
|
+
`'${remoteConfig.toolsUrl}'`,
|
|
65
|
+
remoteConfig.toolsAuthToken
|
|
66
|
+
? `--token '${remoteConfig.toolsAuthToken}'`
|
|
67
|
+
: undefined,
|
|
68
|
+
'--yes',
|
|
69
|
+
]
|
|
70
|
+
.filter(Boolean)
|
|
71
|
+
.join(' '),
|
|
72
|
+
'',
|
|
73
|
+
'Restart your editor after linking so its Argent MCP process uses the remote session.',
|
|
74
|
+
]
|
|
75
|
+
: [
|
|
76
|
+
'🔑 Run the following in your shell to attach Argent to this simulator session:',
|
|
77
|
+
'',
|
|
78
|
+
...Object.entries(environmentVariables).map(([key, value]) => `export ${key}='${value}'`),
|
|
79
|
+
];
|
|
57
80
|
if (remoteConfig.webPreviewUrl) {
|
|
58
81
|
lines.push('', '🌐 Open the following URL in your browser to preview the simulator:', '', remoteConfig.webPreviewUrl);
|
|
59
82
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { AnalyticsWithOrchestration } from '../analytics/AnalyticsManager';
|
|
2
2
|
import { CurrentUserQuery } from '../graphql/generated';
|
|
3
|
-
export declare enum UserSecondFactorDeviceMethod {
|
|
4
|
-
AUTHENTICATOR = "authenticator",
|
|
5
|
-
SMS = "sms"
|
|
6
|
-
}
|
|
7
3
|
export type LoggedInAuthenticationInfo = {
|
|
8
4
|
accessToken: string;
|
|
9
5
|
sessionSecret: null;
|
|
@@ -52,24 +48,7 @@ export default class SessionManager {
|
|
|
52
48
|
*/
|
|
53
49
|
private promptForOTPAsync;
|
|
54
50
|
/**
|
|
55
|
-
*
|
|
56
|
-
* for a new OTP will be sent to that method. Then, prompt for the OTP, and retry the user login.
|
|
57
|
-
*/
|
|
58
|
-
private promptForBackupOTPAsync;
|
|
59
|
-
/**
|
|
60
|
-
* Handle the special case error indicating that a second-factor is required for
|
|
61
|
-
* authentication.
|
|
62
|
-
*
|
|
63
|
-
* There are three cases we need to handle:
|
|
64
|
-
* 1. User's primary second-factor device was SMS, OTP was automatically sent by the server to that
|
|
65
|
-
* device already. In this case we should just prompt for the SMS OTP (or backup code), which the
|
|
66
|
-
* user should be receiving shortly. We should give the user a way to cancel and the prompt and move
|
|
67
|
-
* to case 3 below.
|
|
68
|
-
* 2. User's primary second-factor device is authenticator. In this case we should prompt for authenticator
|
|
69
|
-
* OTP (or backup code) and also give the user a way to cancel and move to case 3 below.
|
|
70
|
-
* 3. User doesn't have a primary device or doesn't have access to their primary device. In this case
|
|
71
|
-
* we should show a picker of the SMS devices that they can have an OTP code sent to, and when
|
|
72
|
-
* the user picks one we show a prompt() for the sent OTP.
|
|
51
|
+
* Handle the special case error indicating that a second-factor is required for authentication.
|
|
73
52
|
*/
|
|
74
53
|
private retryUsernamePasswordAuthWithOTPAsync;
|
|
75
54
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UserSecondFactorDeviceMethod = void 0;
|
|
4
3
|
const tslib_1 = require("tslib");
|
|
5
4
|
const json_file_1 = tslib_1.__importDefault(require("@expo/json-file"));
|
|
6
5
|
const core_1 = require("@oclif/core");
|
|
7
|
-
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
8
6
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
9
7
|
const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
|
|
10
8
|
const fetchSessionSecretAndUser_1 = require("./fetchSessionSecretAndUser");
|
|
@@ -16,11 +14,6 @@ const UserQuery_1 = require("../graphql/queries/UserQuery");
|
|
|
16
14
|
const log_1 = tslib_1.__importStar(require("../log"));
|
|
17
15
|
const prompts_1 = require("../prompts");
|
|
18
16
|
const paths_1 = require("../utils/paths");
|
|
19
|
-
var UserSecondFactorDeviceMethod;
|
|
20
|
-
(function (UserSecondFactorDeviceMethod) {
|
|
21
|
-
UserSecondFactorDeviceMethod["AUTHENTICATOR"] = "authenticator";
|
|
22
|
-
UserSecondFactorDeviceMethod["SMS"] = "sms";
|
|
23
|
-
})(UserSecondFactorDeviceMethod || (exports.UserSecondFactorDeviceMethod = UserSecondFactorDeviceMethod = {}));
|
|
24
17
|
class SessionManager {
|
|
25
18
|
analytics;
|
|
26
19
|
currentActor;
|
|
@@ -145,7 +138,7 @@ class SessionManager {
|
|
|
145
138
|
}
|
|
146
139
|
catch (e) {
|
|
147
140
|
if (e instanceof ApiV2Error_1.ApiV2Error && e.expoApiV2ErrorCode === 'ONE_TIME_PASSWORD_REQUIRED') {
|
|
148
|
-
await this.retryUsernamePasswordAuthWithOTPAsync(username, password
|
|
141
|
+
await this.retryUsernamePasswordAuthWithOTPAsync(username, password);
|
|
149
142
|
}
|
|
150
143
|
else {
|
|
151
144
|
throw e;
|
|
@@ -173,10 +166,8 @@ class SessionManager {
|
|
|
173
166
|
/**
|
|
174
167
|
* Prompt for an OTP with the option to cancel the question by answering empty (pressing return key).
|
|
175
168
|
*/
|
|
176
|
-
async promptForOTPAsync(
|
|
177
|
-
const enterMessage =
|
|
178
|
-
? `press ${chalk_1.default.bold('Enter')} to cancel`
|
|
179
|
-
: `press ${chalk_1.default.bold('Enter')} for more options`;
|
|
169
|
+
async promptForOTPAsync() {
|
|
170
|
+
const enterMessage = `press ${chalk_1.default.bold('Enter')} to cancel`;
|
|
180
171
|
const { otp } = await (0, prompts_1.promptAsync)({
|
|
181
172
|
type: 'text',
|
|
182
173
|
name: 'otp',
|
|
@@ -188,84 +179,11 @@ class SessionManager {
|
|
|
188
179
|
return otp;
|
|
189
180
|
}
|
|
190
181
|
/**
|
|
191
|
-
*
|
|
192
|
-
* for a new OTP will be sent to that method. Then, prompt for the OTP, and retry the user login.
|
|
182
|
+
* Handle the special case error indicating that a second-factor is required for authentication.
|
|
193
183
|
*/
|
|
194
|
-
async
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
throw new Error('No other second-factor devices set up. Ensure you have set up and certified a backup device.');
|
|
198
|
-
}
|
|
199
|
-
const hasAuthenticatorSecondFactorDevice = nonPrimarySecondFactorDevices.find(device => device.method === UserSecondFactorDeviceMethod.AUTHENTICATOR);
|
|
200
|
-
const smsNonPrimarySecondFactorDevices = nonPrimarySecondFactorDevices.filter(device => device.method === UserSecondFactorDeviceMethod.SMS);
|
|
201
|
-
const authenticatorChoiceSentinel = -1;
|
|
202
|
-
const cancelChoiceSentinel = -2;
|
|
203
|
-
const deviceChoices = smsNonPrimarySecondFactorDevices.map((device, idx) => ({
|
|
204
|
-
title: device.sms_phone_number,
|
|
205
|
-
value: idx,
|
|
206
|
-
}));
|
|
207
|
-
if (hasAuthenticatorSecondFactorDevice) {
|
|
208
|
-
deviceChoices.push({
|
|
209
|
-
title: 'Authenticator',
|
|
210
|
-
value: authenticatorChoiceSentinel,
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
deviceChoices.push({
|
|
214
|
-
title: 'Cancel',
|
|
215
|
-
value: cancelChoiceSentinel,
|
|
216
|
-
});
|
|
217
|
-
const selectedValue = await (0, prompts_1.selectAsync)('Select a second-factor device:', deviceChoices);
|
|
218
|
-
if (selectedValue === cancelChoiceSentinel) {
|
|
219
|
-
return null;
|
|
220
|
-
}
|
|
221
|
-
else if (selectedValue === authenticatorChoiceSentinel) {
|
|
222
|
-
return await this.promptForOTPAsync('cancel');
|
|
223
|
-
}
|
|
224
|
-
const device = smsNonPrimarySecondFactorDevices[selectedValue];
|
|
225
|
-
// this is a logged-out endpoint
|
|
226
|
-
const apiV2Client = new api_1.ApiV2Client({ accessToken: null, sessionSecret: null });
|
|
227
|
-
await apiV2Client.postAsync('auth/send-sms-otp', {
|
|
228
|
-
body: {
|
|
229
|
-
username,
|
|
230
|
-
password,
|
|
231
|
-
secondFactorDeviceID: device.id,
|
|
232
|
-
},
|
|
233
|
-
});
|
|
234
|
-
return await this.promptForOTPAsync('cancel');
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Handle the special case error indicating that a second-factor is required for
|
|
238
|
-
* authentication.
|
|
239
|
-
*
|
|
240
|
-
* There are three cases we need to handle:
|
|
241
|
-
* 1. User's primary second-factor device was SMS, OTP was automatically sent by the server to that
|
|
242
|
-
* device already. In this case we should just prompt for the SMS OTP (or backup code), which the
|
|
243
|
-
* user should be receiving shortly. We should give the user a way to cancel and the prompt and move
|
|
244
|
-
* to case 3 below.
|
|
245
|
-
* 2. User's primary second-factor device is authenticator. In this case we should prompt for authenticator
|
|
246
|
-
* OTP (or backup code) and also give the user a way to cancel and move to case 3 below.
|
|
247
|
-
* 3. User doesn't have a primary device or doesn't have access to their primary device. In this case
|
|
248
|
-
* we should show a picker of the SMS devices that they can have an OTP code sent to, and when
|
|
249
|
-
* the user picks one we show a prompt() for the sent OTP.
|
|
250
|
-
*/
|
|
251
|
-
async retryUsernamePasswordAuthWithOTPAsync(username, password, metadata) {
|
|
252
|
-
const { secondFactorDevices, smsAutomaticallySent } = metadata;
|
|
253
|
-
(0, assert_1.default)(secondFactorDevices !== undefined && smsAutomaticallySent !== undefined, `Malformed OTP error metadata: ${metadata}`);
|
|
254
|
-
const primaryDevice = secondFactorDevices.find(device => device.is_primary);
|
|
255
|
-
let otp = null;
|
|
256
|
-
if (smsAutomaticallySent) {
|
|
257
|
-
(0, assert_1.default)(primaryDevice, 'OTP should only automatically be sent when there is a primary device');
|
|
258
|
-
log_1.default.log(`One-time password was sent to the phone number ending in ${primaryDevice.sms_phone_number}.`);
|
|
259
|
-
otp = await this.promptForOTPAsync('menu');
|
|
260
|
-
}
|
|
261
|
-
if (primaryDevice?.method === UserSecondFactorDeviceMethod.AUTHENTICATOR) {
|
|
262
|
-
log_1.default.log('One-time password from authenticator required.');
|
|
263
|
-
otp = await this.promptForOTPAsync('menu');
|
|
264
|
-
}
|
|
265
|
-
// user bailed on case 1 or 2, wants to move to case 3
|
|
266
|
-
if (!otp) {
|
|
267
|
-
otp = await this.promptForBackupOTPAsync(username, password, secondFactorDevices);
|
|
268
|
-
}
|
|
184
|
+
async retryUsernamePasswordAuthWithOTPAsync(username, password) {
|
|
185
|
+
log_1.default.log('One-time password from authenticator required.');
|
|
186
|
+
const otp = await this.promptForOTPAsync();
|
|
269
187
|
if (!otp) {
|
|
270
188
|
throw new Error('Cancelled login');
|
|
271
189
|
}
|