From cabef9c04e0c8287138e29b52f1773df02684eea Mon Sep 17 00:00:00 2001 From: Gabe Debes Date: Mon, 8 Jun 2026 13:27:30 -0700 Subject: [PATCH] [eas-cli] Add PostHog GraphQL layer and command utils --- packages/eas-cli/graphql.schema.json | 1424 +++++++++++++++-- packages/eas-cli/src/commandUtils/posthog.ts | 21 + packages/eas-cli/src/graphql/generated.ts | 250 ++- .../src/graphql/mutations/PostHogMutation.ts | 117 ++ .../src/graphql/queries/PostHogQuery.ts | 103 ++ .../src/graphql/types/PostHogConnection.ts | 53 + 6 files changed, 1766 insertions(+), 202 deletions(-) create mode 100644 packages/eas-cli/src/commandUtils/posthog.ts create mode 100644 packages/eas-cli/src/graphql/mutations/PostHogMutation.ts create mode 100644 packages/eas-cli/src/graphql/queries/PostHogQuery.ts create mode 100644 packages/eas-cli/src/graphql/types/PostHogConnection.ts diff --git a/packages/eas-cli/graphql.schema.json b/packages/eas-cli/graphql.schema.json index 033e0093c1..cf3825b98d 100644 --- a/packages/eas-cli/graphql.schema.json +++ b/packages/eas-cli/graphql.schema.json @@ -2128,6 +2128,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "posthogOrganizationConnection", + "description": "PostHog organization connection for this account", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PostHogOrganizationConnection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "profileImageUrl", "description": null, @@ -7239,6 +7251,18 @@ "name": "createFcmV1Credential", "description": "Create a GoogleServiceAccountKeyEntity to store credential and\nconnect it with an edge from AndroidAppCredential", "args": [ + { + "name": "accountId", + "description": null, + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "Derived from androidAppCredentialsId" + }, { "name": "androidAppCredentialsId", "description": null, @@ -8557,6 +8581,18 @@ "defaultValue": null, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "robotAccessToken", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "Robot access token is no longer needed as it's generated server-side and injected into the builder environment automatically." } ], "interfaces": null, @@ -8842,6 +8878,18 @@ "defaultValue": null, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "type", + "description": null, + "type": { + "kind": "ENUM", + "name": "AndroidKeystoreType", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "Type will be automatically inferred from keystore content." } ], "interfaces": null, @@ -9245,6 +9293,26 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "filterReleaseChannels", + "description": null, + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "Classic updates are no longer supported" + }, { "name": "filterTypes", "description": " Types of objects to filter ", @@ -10899,6 +10967,18 @@ "isDeprecated": true, "deprecationReason": "Classic updates have been deprecated." }, + { + "name": "posthogProject", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "PostHogProject", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "privacy", "description": null, @@ -13621,6 +13701,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "privacy", + "description": null, + "type": { + "kind": "ENUM", + "name": "AppPrivacy", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "No longer supported" + }, { "name": "projectName", "description": null, @@ -21655,6 +21747,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "privacy", + "description": null, + "type": { + "kind": "ENUM", + "name": "AppPrivacy", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "No longer supported" + }, { "name": "projectName", "description": null, @@ -28771,6 +28875,18 @@ "description": null, "fields": null, "inputFields": [ + { + "name": "cacheDefaultPaths", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "We don't cache anything by default anymore" + }, { "name": "clear", "description": null, @@ -28783,6 +28899,22 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "customPaths", + "description": null, + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "We use paths now since there is no default caching anymore" + }, { "name": "disabled", "description": null, @@ -29431,6 +29563,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "buildMode", + "description": null, + "type": { + "kind": "ENUM", + "name": "BuildMode", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "Use job.mode instead." + }, { "name": "buildProfile", "description": null, @@ -29731,6 +29875,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "selectedImage", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "Unused." + }, { "name": "simulator", "description": null, @@ -34800,6 +34956,49 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "INPUT_OBJECT", + "name": "CreatePostHogAccountRequestInput", + "description": null, + "fields": null, + "inputFields": [ + { + "name": "accountId", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "region", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "PostHogRegion", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, { "kind": "INPUT_OBJECT", "name": "CreateSentryProjectInput", @@ -34897,6 +35096,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "isGlobal", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "Whether the variable is global is now governed by its scope - account / app." + }, { "name": "name", "description": null, @@ -35945,7 +36156,7 @@ { "kind": "SCALAR", "name": "DateTime", - "description": "Date custom scalar type", + "description": null, "fields": null, "inputFields": null, "interfaces": null, @@ -37801,7 +38012,7 @@ { "kind": "SCALAR", "name": "DevDomainName", - "description": "A DevDomainName for a deployed serverless app", + "description": null, "fields": null, "inputFields": null, "interfaces": null, @@ -43941,6 +44152,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "PostHogOrganizationConnectionEntity", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "PostHogProjectEntity", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "UserInvitationEntity", "description": null, @@ -44520,7 +44743,7 @@ { "kind": "SCALAR", "name": "EnvironmentVariableEnvironment", - "description": "A name of an environment variable environment", + "description": null, "fields": null, "inputFields": null, "interfaces": null, @@ -52852,6 +53075,18 @@ "defaultValue": null, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "robotAccessToken", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "Robot access token is no longer needed as it's generated server-side and injected into the builder environment automatically." } ], "interfaces": null, @@ -53163,7 +53398,7 @@ { "kind": "SCALAR", "name": "JSON", - "description": "The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).", + "description": null, "fields": null, "inputFields": null, "interfaces": null, @@ -53173,7 +53408,7 @@ { "kind": "SCALAR", "name": "JSONObject", - "description": "The `JSONObject` scalar type represents JSON objects as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).", + "description": null, "fields": null, "inputFields": null, "interfaces": null, @@ -57279,6 +57514,512 @@ } ] }, + { + "kind": "OBJECT", + "name": "PostHogIntegrationQuery", + "description": null, + "fields": [ + { + "name": "clientIdentifier", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PostHogOrganizationConnection", + "description": null, + "fields": [ + { + "name": "account", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Account", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "posthogOrganizationIdentifier", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "posthogOrganizationName", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "posthogProjects", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PostHogProject", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "posthogRegion", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "PostHogRegion", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PostHogOrganizationConnectionMutation", + "description": null, + "fields": [ + { + "name": "createPostHogAccountRequest", + "description": null, + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "CreatePostHogAccountRequestInput", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PostHogOrganizationConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deletePostHogOrganizationConnection", + "description": "Removes the Expo-side connection only; the PostHog organization is preserved.", + "args": [ + { + "name": "id", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PostHogProject", + "description": null, + "fields": [ + { + "name": "app", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "App", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "posthogHost", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "posthogOrganizationConnection", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PostHogOrganizationConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "posthogProjectIdentifier", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "posthogProjectName", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "posthogProjectToken", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PostHogProjectMutation", + "description": null, + "fields": [ + { + "name": "deletePostHogProject", + "description": "Removes the Expo-side project link only; the PostHog project is preserved.", + "args": [ + { + "name": "id", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "setupPostHogProject", + "description": "Provisions a PostHog project for the app; the project name is derived from the app.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "SetupPostHogProjectInput", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PostHogProject", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "PostHogRegion", + "description": null, + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "EU", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "US", + "description": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, { "kind": "INTERFACE", "name": "Project", @@ -57946,6 +58687,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "runtimeFingerprintSource", + "description": null, + "type": { + "kind": "INPUT_OBJECT", + "name": "FingerprintSourceInput", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "Use fingerprintInfoGroup instead" + }, { "name": "runtimeVersion", "description": null, @@ -60126,6 +60879,38 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "posthogOrganizationConnection", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PostHogOrganizationConnectionMutation", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "posthogProject", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PostHogProjectMutation", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "robot", "description": "Mutations that create, update, and delete Robots", @@ -60190,6 +60975,22 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "tunnels", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "TunnelsMutation", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "turtleBrownfieldArtifacts", "description": null, @@ -61191,6 +61992,22 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "posthogIntegration", + "description": "Top-level query object for querying PostHog Integration information.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PostHogIntegrationQuery", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "project", "description": null, @@ -63213,6 +64030,30 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "githubUsername", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "No longer supported" + }, + { + "name": "industry", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "No longer supported" + }, { "name": "lastName", "description": null, @@ -63224,6 +64065,30 @@ "defaultValue": null, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "location", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "No longer supported" + }, + { + "name": "twitterUsername", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "No longer supported" } ], "interfaces": null, @@ -64154,6 +65019,49 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "INPUT_OBJECT", + "name": "SetupPostHogProjectInput", + "description": null, + "fields": null, + "inputFields": [ + { + "name": "appId", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "posthogOrganizationConnectionId", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, { "kind": "OBJECT", "name": "SizeBreakdownCategory", @@ -66475,43 +67383,264 @@ }, { "kind": "OBJECT", - "name": "TimelineActivityConnection", + "name": "TimelineActivityConnection", + "description": null, + "fields": [ + { + "name": "edges", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "TimelineActivityEdge", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TimelineActivityEdge", + "description": null, + "fields": [ + { + "name": "cursor", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INTERFACE", + "name": "ActivityTimelineProjectActivity", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "TimelineActivityFilterInput", + "description": null, + "fields": null, + "inputFields": [ + { + "name": "channels", + "description": null, + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "platforms", + "description": null, + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "AppPlatform", + "ofType": null + } + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "releaseChannels", + "description": null, + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "types", + "description": null, + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "ActivityTimelineProjectActivityType", + "ofType": null + } + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TunnelSignedUrlResult", + "description": null, + "fields": [ + { + "name": "label", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TunnelsMutation", "description": null, "fields": [ { - "name": "edges", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { + "name": "createSignedTunnelUrl", + "description": "Create a signed tunnel URL for an account", + "args": [ + { + "name": "accountId", + "description": null, + "type": { "kind": "NON_NULL", "name": null, "ofType": { - "kind": "OBJECT", - "name": "TimelineActivityEdge", + "kind": "SCALAR", + "name": "ID", "ofType": null } - } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": null, - "args": [], + ], "type": { "kind": "NON_NULL", "name": null, "ofType": { "kind": "OBJECT", - "name": "PageInfo", + "name": "TunnelSignedUrlResult", "ofType": null } }, @@ -66524,140 +67653,6 @@ "enumValues": null, "possibleTypes": null }, - { - "kind": "OBJECT", - "name": "TimelineActivityEdge", - "description": null, - "fields": [ - { - "name": "cursor", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "ActivityTimelineProjectActivity", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "TimelineActivityFilterInput", - "description": null, - "fields": null, - "inputFields": [ - { - "name": "channels", - "description": null, - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - } - }, - "defaultValue": null, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "platforms", - "description": null, - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "AppPlatform", - "ofType": null - } - } - }, - "defaultValue": null, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "releaseChannels", - "description": null, - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - } - }, - "defaultValue": null, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "types", - "description": null, - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "ActivityTimelineProjectActivityType", - "ofType": null - } - } - }, - "defaultValue": null, - "isDeprecated": false, - "deprecationReason": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, { "kind": "OBJECT", "name": "TurtleBrownfieldArtifactMutation", @@ -69767,6 +70762,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "isGlobal", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "You cannot change whether the variable is global." + }, { "name": "name", "description": null, @@ -70874,6 +71881,26 @@ "defaultValue": null, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "sdkVersions", + "description": null, + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "Use runtimeVersions instead." } ], "interfaces": null, @@ -74575,6 +75602,18 @@ "description": null, "fields": null, "inputFields": [ + { + "name": "appetizeCode", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "No longer supported" + }, { "name": "email", "description": null, @@ -74611,6 +75650,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "githubUsername", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "No longer supported" + }, { "name": "id", "description": null, @@ -74623,6 +75674,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "industry", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "No longer supported" + }, { "name": "lastName", "description": null, @@ -74635,6 +75698,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "location", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "No longer supported" + }, { "name": "profilePhoto", "description": null, @@ -74647,6 +75722,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "twitterUsername", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "No longer supported" + }, { "name": "username", "description": null, @@ -78926,7 +80013,7 @@ { "kind": "SCALAR", "name": "WorkerDeploymentIdentifier", - "description": "A alias name for a serverless deployment", + "description": null, "fields": null, "inputFields": null, "interfaces": null, @@ -79196,7 +80283,7 @@ { "kind": "SCALAR", "name": "WorkerDeploymentRequestID", - "description": "A Worker Deployment Request ID (also known as the CF Ray ID)", + "description": null, "fields": null, "inputFields": null, "interfaces": null, @@ -88637,15 +89724,6 @@ } ] }, - { - "name": "oneOf", - "description": "Indicates exactly one field must be supplied and this field must not be `null`.", - "isRepeatable": false, - "locations": [ - "INPUT_OBJECT" - ], - "args": [] - }, { "name": "skip", "description": "Directs the executor to skip this field or fragment when the `if` argument is true.", diff --git a/packages/eas-cli/src/commandUtils/posthog.ts b/packages/eas-cli/src/commandUtils/posthog.ts new file mode 100644 index 0000000000..8b34fe6da4 --- /dev/null +++ b/packages/eas-cli/src/commandUtils/posthog.ts @@ -0,0 +1,21 @@ +import chalk from 'chalk'; + +import { PostHogProjectData } from '../graphql/types/PostHogConnection'; +import Log, { link } from '../log'; + +export function getPostHogProjectDashboardUrl(project: PostHogProjectData): string { + return `${project.posthogHost}/project/${encodeURIComponent(project.posthogProjectIdentifier)}`; +} + +export function formatPostHogProject(project: PostHogProjectData): string { + return [ + `${chalk.bold('Name')}: ${project.posthogProjectName}`, + `${chalk.bold('Host')}: ${project.posthogHost}`, + `${chalk.bold('Region')}: ${project.posthogOrganizationConnection.posthogRegion}`, + `${chalk.bold('Dashboard')}: ${link(getPostHogProjectDashboardUrl(project), { dim: false })}`, + ].join('\n'); +} + +export function logNoPostHogProject(projectName: string): void { + Log.warn(`No PostHog project is linked to Expo app ${chalk.bold(projectName)} on EAS.`); +} diff --git a/packages/eas-cli/src/graphql/generated.ts b/packages/eas-cli/src/graphql/generated.ts index 09e2619b55..85428b009e 100644 --- a/packages/eas-cli/src/graphql/generated.ts +++ b/packages/eas-cli/src/graphql/generated.ts @@ -168,6 +168,8 @@ export type Account = { /** Owning UserActor of this account if personal account */ ownerUserActor?: Maybe; pendingSentryInstallation?: Maybe; + /** PostHog organization connection for this account */ + posthogOrganizationConnection?: Maybe; profileImageUrl: Scalars['String']['output']; pushSecurityEnabled: Scalars['Boolean']['output']; requireTwoFactor: Scalars['Boolean']['output']; @@ -1192,6 +1194,7 @@ export type AndroidAppCredentialsMutationCreateAndroidAppCredentialsArgs = { export type AndroidAppCredentialsMutationCreateFcmV1CredentialArgs = { + accountId?: InputMaybe; androidAppCredentialsId: Scalars['String']['input']; credential: Scalars['String']['input']; }; @@ -1347,6 +1350,8 @@ export type AndroidJobOverridesInput = { export type AndroidJobSecretsInput = { buildCredentials?: InputMaybe; + /** @deprecated Robot access token is no longer needed as it's generated server-side and injected into the builder environment automatically. */ + robotAccessToken?: InputMaybe; }; export type AndroidJobVersionInput = { @@ -1374,6 +1379,8 @@ export type AndroidKeystoreInput = { keyAlias: Scalars['String']['input']; keyPassword?: InputMaybe; keystorePassword: Scalars['String']['input']; + /** @deprecated Type will be automatically inferred from keystore content. */ + type?: InputMaybe; }; export type AndroidKeystoreMutation = { @@ -1483,7 +1490,7 @@ export type App = Project & { * @deprecated Classic updates have been deprecated. */ icon?: Maybe; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ iconUrl?: Maybe; id: Scalars['ID']['output']; /** App query field for querying EAS Insights about this app */ @@ -1501,7 +1508,7 @@ export type App = Project & { /** @deprecated 'likes' have been deprecated. */ isLikedByMe: Scalars['Boolean']['output']; lastDeletionAttemptTime?: Maybe; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ lastPublishedTime: Scalars['DateTime']['output']; /** Time of the last user activity (update, branch, submission). */ latestActivity: Scalars['DateTime']['output']; @@ -1521,18 +1528,19 @@ export type App = Project & { name: Scalars['String']['output']; observe: AppObserve; ownerAccount: Account; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ packageName: Scalars['String']['output']; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ packageUsername: Scalars['String']['output']; /** * android.playStoreUrl field from most recent classic update manifest * @deprecated Classic updates have been deprecated. */ playStoreUrl?: Maybe; - /** @deprecated No longer supported */ + posthogProject?: Maybe; + /** @deprecated Field no longer supported */ privacy: Scalars['String']['output']; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ privacySetting: AppPrivacy; profileImageUrl?: Maybe; /** @@ -1592,7 +1600,7 @@ export type App = Project & { usageMetrics: AppUsageMetrics; /** @deprecated Use ownerAccount.name instead */ username: Scalars['String']['output']; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ users?: Maybe>>; vexoApp?: Maybe; /** Notification preferences of the viewer for this app */ @@ -1622,6 +1630,7 @@ export type AppActivityTimelineProjectActivitiesArgs = { createdBefore?: InputMaybe; filterChannels?: InputMaybe>; filterPlatforms?: InputMaybe>; + filterReleaseChannels?: InputMaybe>; filterTypes?: InputMaybe>; limit: Scalars['Int']['input']; }; @@ -2081,7 +2090,7 @@ export type AppFingerprintsConnection = { export type AppIcon = { __typename?: 'AppIcon'; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ colorPalette?: Maybe; originalUrl: Scalars['String']['output']; primaryColor?: Maybe; @@ -2095,6 +2104,8 @@ export type AppInfoInput = { export type AppInput = { accountId: Scalars['ID']['input']; appInfo?: InputMaybe; + /** @deprecated Field no longer supported */ + privacy?: InputMaybe; projectName: Scalars['String']['input']; }; @@ -2130,7 +2141,7 @@ export type AppMutation = { __typename?: 'AppMutation'; /** Create an app */ createApp: App; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ grantAccess?: Maybe; /** Remove profile image (icon) for the app. Do nothing if there's no profile image associated. */ removeProfileImage: App; @@ -3137,6 +3148,8 @@ export type AppWithGithubRepositoryInput = { accountId: Scalars['ID']['input']; appInfo?: InputMaybe; installationIdentifier?: InputMaybe; + /** @deprecated Field no longer supported */ + privacy?: InputMaybe; projectName: Scalars['String']['input']; }; @@ -4102,7 +4115,11 @@ export type BuildArtifacts = { }; export type BuildCacheInput = { + /** @deprecated We don't cache anything by default anymore */ + cacheDefaultPaths?: InputMaybe; clear?: InputMaybe; + /** @deprecated We use paths now since there is no default caching anymore */ + customPaths?: InputMaybe>>; disabled?: InputMaybe; key?: InputMaybe; paths?: InputMaybe>; @@ -4174,6 +4191,8 @@ export type BuildMetadataInput = { appIdentifier?: InputMaybe; appName?: InputMaybe; appVersion?: InputMaybe; + /** @deprecated Use job.mode instead. */ + buildMode?: InputMaybe; buildProfile?: InputMaybe; channel?: InputMaybe; cliVersion?: InputMaybe; @@ -4199,6 +4218,8 @@ export type BuildMetadataInput = { runWithNoWaitFlag?: InputMaybe; runtimeVersion?: InputMaybe; sdkVersion?: InputMaybe; + /** @deprecated Unused. */ + selectedImage?: InputMaybe; simulator?: InputMaybe; trackingContext?: InputMaybe; username?: InputMaybe; @@ -4364,7 +4385,7 @@ export enum BuildPhase { StartBuild = 'START_BUILD', Unknown = 'UNKNOWN', UploadApplicationArchive = 'UPLOAD_APPLICATION_ARCHIVE', - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ UploadArtifacts = 'UPLOAD_ARTIFACTS', UploadBuildArtifacts = 'UPLOAD_BUILD_ARTIFACTS' } @@ -4893,6 +4914,11 @@ export type CreateIosSubmissionInput = { submittedBuildId?: InputMaybe; }; +export type CreatePostHogAccountRequestInput = { + accountId: Scalars['ID']['input']; + region: PostHogRegion; +}; + export type CreateSentryProjectInput = { appId: Scalars['ID']['input']; sentryProjectId: Scalars['String']['input']; @@ -4902,6 +4928,8 @@ export type CreateSentryProjectInput = { export type CreateSharedEnvironmentVariableInput = { environments?: InputMaybe>; fileName?: InputMaybe; + /** @deprecated Whether the variable is global is now governed by its scope - account / app. */ + isGlobal?: InputMaybe; name: Scalars['String']['input']; overwrite?: InputMaybe; type?: InputMaybe; @@ -6295,6 +6323,8 @@ export enum EntityTypeName { IosAppCredentialsEntity = 'IosAppCredentialsEntity', LogRocketOrganizationEntity = 'LogRocketOrganizationEntity', LogRocketProjectEntity = 'LogRocketProjectEntity', + PostHogOrganizationConnectionEntity = 'PostHogOrganizationConnectionEntity', + PostHogProjectEntity = 'PostHogProjectEntity', UserInvitationEntity = 'UserInvitationEntity', UserPermissionEntity = 'UserPermissionEntity', VexoAccountConnectionEntity = 'VexoAccountConnectionEntity', @@ -7494,6 +7524,8 @@ export type IosJobOverridesInput = { export type IosJobSecretsInput = { buildCredentials?: InputMaybe>>; + /** @deprecated Robot access token is no longer needed as it's generated server-side and injected into the builder environment automatically. */ + robotAccessToken?: InputMaybe; }; export type IosJobTargetCredentialsInput = { @@ -7540,7 +7572,7 @@ export type JobRun = { __typename?: 'JobRun'; app: App; artifacts: Array; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ childJobRun?: Maybe; createdAt: Scalars['DateTime']['output']; displayName?: Maybe; @@ -8127,10 +8159,80 @@ export type PinnedDashboardView = { export type PlanEnablement = Concurrencies | EasTotalPlanEnablement; +export type PostHogIntegrationQuery = { + __typename?: 'PostHogIntegrationQuery'; + clientIdentifier: Scalars['String']['output']; +}; + +export type PostHogOrganizationConnection = { + __typename?: 'PostHogOrganizationConnection'; + account: Account; + createdAt: Scalars['DateTime']['output']; + id: Scalars['ID']['output']; + posthogOrganizationIdentifier: Scalars['String']['output']; + posthogOrganizationName: Scalars['String']['output']; + posthogProjects: Array; + posthogRegion: PostHogRegion; + updatedAt: Scalars['DateTime']['output']; +}; + +export type PostHogOrganizationConnectionMutation = { + __typename?: 'PostHogOrganizationConnectionMutation'; + createPostHogAccountRequest: PostHogOrganizationConnection; + /** Removes the Expo-side connection only; the PostHog organization is preserved. */ + deletePostHogOrganizationConnection: Scalars['ID']['output']; +}; + + +export type PostHogOrganizationConnectionMutationCreatePostHogAccountRequestArgs = { + input: CreatePostHogAccountRequestInput; +}; + + +export type PostHogOrganizationConnectionMutationDeletePostHogOrganizationConnectionArgs = { + id: Scalars['ID']['input']; +}; + +export type PostHogProject = { + __typename?: 'PostHogProject'; + app: App; + createdAt: Scalars['DateTime']['output']; + id: Scalars['ID']['output']; + posthogHost: Scalars['String']['output']; + posthogOrganizationConnection: PostHogOrganizationConnection; + posthogProjectIdentifier: Scalars['String']['output']; + posthogProjectName: Scalars['String']['output']; + posthogProjectToken: Scalars['String']['output']; + updatedAt: Scalars['DateTime']['output']; +}; + +export type PostHogProjectMutation = { + __typename?: 'PostHogProjectMutation'; + /** Removes the Expo-side project link only; the PostHog project is preserved. */ + deletePostHogProject: Scalars['ID']['output']; + /** Provisions a PostHog project for the app; the project name is derived from the app. */ + setupPostHogProject: PostHogProject; +}; + + +export type PostHogProjectMutationDeletePostHogProjectArgs = { + id: Scalars['ID']['input']; +}; + + +export type PostHogProjectMutationSetupPostHogProjectArgs = { + input: SetupPostHogProjectInput; +}; + +export enum PostHogRegion { + Eu = 'EU', + Us = 'US' +} + export type Project = { description: Scalars['String']['output']; fullName: Scalars['String']['output']; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ iconUrl?: Maybe; id: Scalars['ID']['output']; name: Scalars['String']['output']; @@ -8201,6 +8303,8 @@ export type PublishUpdateGroupInput = { message?: InputMaybe; rollBackToEmbeddedInfoGroup?: InputMaybe; rolloutInfoGroup?: InputMaybe; + /** @deprecated Use fingerprintInfoGroup instead */ + runtimeFingerprintSource?: InputMaybe; runtimeVersion: Scalars['String']['input']; turtleJobRunId?: InputMaybe; updateInfoGroup?: InputMaybe; @@ -8480,6 +8584,8 @@ export type RootMutation = { me: MeMutation; /** Notification preference management */ notificationPreference: NotificationPreferenceMutation; + posthogOrganizationConnection: PostHogOrganizationConnectionMutation; + posthogProject: PostHogProjectMutation; /** Mutations that create, update, and delete Robots */ robot: RobotMutation; /** Mutations for Sentry installations */ @@ -8488,6 +8594,7 @@ export type RootMutation = { sentryProject: SentryProjectMutation; /** Mutations that modify an EAS Submit submission */ submission: SubmissionMutation; + tunnels: TunnelsMutation; turtleBrownfieldArtifacts: TurtleBrownfieldArtifactMutation; update: UpdateMutation; updateBranch: UpdateBranchMutation; @@ -8626,6 +8733,8 @@ export type RootQuery = { * this is the appropriate top-level query object */ meUserActor?: Maybe; + /** Top-level query object for querying PostHog Integration information. */ + posthogIntegration: PostHogIntegrationQuery; /** @deprecated Snacks and apps should be queried separately */ project: ProjectQuery; /** Top-level query object for querying Runtimes. */ @@ -8818,7 +8927,7 @@ export type SsoUser = Actor & UserActor & { /** Coalesced project activity for all apps belonging to all accounts this user belongs to. Only resolves for the viewer. */ activityTimelineProjectActivities: Array; appCount: Scalars['Int']['output']; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ appetizeCode?: Maybe; /** * Apps this user has published. If this user is the viewer, this field returns the apps the user has access to. @@ -8841,16 +8950,16 @@ export type SsoUser = Actor & UserActor & { fullName?: Maybe; /** GitHub account linked to a user */ githubUser?: Maybe; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ githubUsername?: Maybe; id: Scalars['ID']['output']; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ industry?: Maybe; isExpoAdmin: Scalars['Boolean']['output']; isStaffModeEnabled: Scalars['Boolean']['output']; lastDeletionAttemptTime?: Maybe; lastName?: Maybe; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ location?: Maybe; pinnedApps: Array; pinnedDashboardViews: Array; @@ -8862,7 +8971,7 @@ export type SsoUser = Actor & UserActor & { profilePhoto: Scalars['String']['output']; /** Snacks associated with this account */ snacks: Array; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ twitterUsername?: Maybe; username: Scalars['String']['output']; websiteNotificationsPaginated: WebsiteNotificationsConnection; @@ -8908,7 +9017,15 @@ export type SsoUserWebsiteNotificationsPaginatedArgs = { export type SsoUserDataInput = { firstName?: InputMaybe; + /** @deprecated Field no longer supported */ + githubUsername?: InputMaybe; + /** @deprecated Field no longer supported */ + industry?: InputMaybe; lastName?: InputMaybe; + /** @deprecated Field no longer supported */ + location?: InputMaybe; + /** @deprecated Field no longer supported */ + twitterUsername?: InputMaybe; }; export type SecondFactorBooleanResult = { @@ -9043,6 +9160,11 @@ export type SetupConvexProjectResult = { deployKey: Scalars['String']['output']; }; +export type SetupPostHogProjectInput = { + appId: Scalars['ID']['input']; + posthogOrganizationConnectionId: Scalars['ID']['input']; +}; + export type SizeBreakdownCategory = { __typename?: 'SizeBreakdownCategory'; assetCount: Scalars['Int']['output']; @@ -9059,7 +9181,7 @@ export type Snack = Project & { /** Has the Snack been run without errors */ hasBeenRunSuccessfully?: Maybe; hashId: Scalars['String']['output']; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ iconUrl?: Maybe; id: Scalars['ID']['output']; /** Draft status, which is true when the Snack was not saved explicitly, but auto-saved */ @@ -9410,6 +9532,23 @@ export type TimelineActivityFilterInput = { types?: InputMaybe>; }; +export type TunnelSignedUrlResult = { + __typename?: 'TunnelSignedUrlResult'; + label: Scalars['ID']['output']; + url: Scalars['String']['output']; +}; + +export type TunnelsMutation = { + __typename?: 'TunnelsMutation'; + /** Create a signed tunnel URL for an account */ + createSignedTunnelUrl: TunnelSignedUrlResult; +}; + + +export type TunnelsMutationCreateSignedTunnelUrlArgs = { + accountId: Scalars['ID']['input']; +}; + export type TurtleBrownfieldArtifactMutation = { __typename?: 'TurtleBrownfieldArtifactMutation'; createTurtleBrownfieldArtifact: CreateBrownfieldArtifactResult; @@ -9829,6 +9968,8 @@ export type UpdateEnvironmentVariableInput = { environments?: InputMaybe>; fileName?: InputMaybe; id: Scalars['ID']['input']; + /** @deprecated You cannot change whether the variable is global. */ + isGlobal?: InputMaybe; name?: InputMaybe; type?: InputMaybe; value?: InputMaybe; @@ -9978,6 +10119,8 @@ export type UpdateVexoAppInput = { export type UpdatesFilter = { platform?: InputMaybe; runtimeVersions?: InputMaybe>; + /** @deprecated Use runtimeVersions instead. */ + sdkVersions?: InputMaybe>; }; export type UpdatesFilterV2 = { @@ -10092,7 +10235,7 @@ export type User = Actor & UserActor & { /** Coalesced project activity for all apps belonging to all accounts this user belongs to. Only resolves for the viewer. */ activityTimelineProjectActivities: Array; appCount: Scalars['Int']['output']; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ appetizeCode?: Maybe; /** * Apps this user has published @@ -10117,22 +10260,22 @@ export type User = Actor & UserActor & { fullName?: Maybe; /** GitHub account linked to a user */ githubUser?: Maybe; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ githubUsername?: Maybe; hasPassword: Scalars['Boolean']['output']; /** Whether this user has any pending user invitations. Only resolves for the viewer. */ hasPendingUserInvitations: Scalars['Boolean']['output']; id: Scalars['ID']['output']; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ industry?: Maybe; isExpoAdmin: Scalars['Boolean']['output']; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ isLegacy: Scalars['Boolean']['output']; isSecondFactorAuthenticationEnabled: Scalars['Boolean']['output']; isStaffModeEnabled: Scalars['Boolean']['output']; lastDeletionAttemptTime?: Maybe; lastName?: Maybe; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ location?: Maybe; newEmailPendingVerification?: Maybe; oAuthIdentities: Array; @@ -10150,7 +10293,7 @@ export type User = Actor & UserActor & { secondFactorDevices: Array; /** Snacks associated with this account */ snacks: Array; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ twitterUsername?: Maybe; username: Scalars['String']['output']; websiteNotificationsPaginated: WebsiteNotificationsConnection; @@ -10205,7 +10348,7 @@ export type UserActor = { */ activityTimelineProjectActivities: Array; appCount: Scalars['Int']['output']; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ appetizeCode?: Maybe; /** * Apps this user has published @@ -10232,16 +10375,16 @@ export type UserActor = { fullName?: Maybe; /** GitHub account linked to a user */ githubUser?: Maybe; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ githubUsername?: Maybe; id: Scalars['ID']['output']; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ industry?: Maybe; isExpoAdmin: Scalars['Boolean']['output']; isStaffModeEnabled: Scalars['Boolean']['output']; lastDeletionAttemptTime?: Maybe; lastName?: Maybe; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ location?: Maybe; pinnedApps: Array; preferences: UserPreferences; @@ -10252,7 +10395,7 @@ export type UserActor = { profilePhoto: Scalars['String']['output']; /** Snacks associated with this user's personal account */ snacks: Array; - /** @deprecated No longer supported */ + /** @deprecated Field no longer supported */ twitterUsername?: Maybe; username: Scalars['String']['output']; websiteNotificationsPaginated: WebsiteNotificationsConnection; @@ -10498,12 +10641,22 @@ export type UserDashboardViewPinMutationUnpinDashboardViewArgs = { }; export type UserDataInput = { + /** @deprecated Field no longer supported */ + appetizeCode?: InputMaybe; email?: InputMaybe; firstName?: InputMaybe; fullName?: InputMaybe; + /** @deprecated Field no longer supported */ + githubUsername?: InputMaybe; id?: InputMaybe; + /** @deprecated Field no longer supported */ + industry?: InputMaybe; lastName?: InputMaybe; + /** @deprecated Field no longer supported */ + location?: InputMaybe; profilePhoto?: InputMaybe; + /** @deprecated Field no longer supported */ + twitterUsername?: InputMaybe; username?: InputMaybe; }; @@ -12946,6 +13099,27 @@ export type CreateLocalBuildMutationVariables = Exact<{ export type CreateLocalBuildMutation = { __typename?: 'RootMutation', build: { __typename?: 'BuildMutation', createLocalBuild: { __typename?: 'CreateBuildResult', build: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, logFiles: Array, channel?: string | null, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, runtimeVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, initialQueuePosition?: number | null, queuePosition?: number | null, estimatedWaitTimeLeftSeconds?: number | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, fingerprint?: { __typename?: 'Fingerprint', id: string, hash: string } | null, initiatingActor?: { __typename: 'PartnerActor', id: string, displayName: string } | { __typename: 'Robot', id: string, displayName: string } | { __typename: 'SSOUser', id: string, displayName: string } | { __typename: 'User', id: string, displayName: string } | null, project: { __typename: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } } | { __typename: 'Snack', id: string, name: string, slug: string }, metrics?: { __typename?: 'BuildMetrics', buildWaitTime?: number | null, buildQueueTime?: number | null, buildDuration?: number | null } | null } } } }; +export type CreatePostHogAccountRequestMutationVariables = Exact<{ + input: CreatePostHogAccountRequestInput; +}>; + + +export type CreatePostHogAccountRequestMutation = { __typename?: 'RootMutation', posthogOrganizationConnection: { __typename?: 'PostHogOrganizationConnectionMutation', createPostHogAccountRequest: { __typename?: 'PostHogOrganizationConnection', id: string, posthogOrganizationIdentifier: string, posthogOrganizationName: string, posthogRegion: PostHogRegion, createdAt: any, updatedAt: any } } }; + +export type SetupPostHogProjectMutationVariables = Exact<{ + input: SetupPostHogProjectInput; +}>; + + +export type SetupPostHogProjectMutation = { __typename?: 'RootMutation', posthogProject: { __typename?: 'PostHogProjectMutation', setupPostHogProject: { __typename?: 'PostHogProject', id: string, posthogProjectIdentifier: string, posthogProjectName: string, posthogProjectToken: string, posthogHost: string, createdAt: any, updatedAt: any, posthogOrganizationConnection: { __typename?: 'PostHogOrganizationConnection', id: string, posthogOrganizationIdentifier: string, posthogOrganizationName: string, posthogRegion: PostHogRegion, createdAt: any, updatedAt: any } } } }; + +export type DeletePostHogProjectMutationVariables = Exact<{ + id: Scalars['ID']['input']; +}>; + + +export type DeletePostHogProjectMutation = { __typename?: 'RootMutation', posthogProject: { __typename?: 'PostHogProjectMutation', deletePostHogProject: string } }; + export type GetSignedUploadMutationVariables = Exact<{ contentTypes: Array | Scalars['String']['input']; }>; @@ -13511,6 +13685,20 @@ export type AppObserveNavigationRoutesQueryVariables = Exact<{ export type AppObserveNavigationRoutesQuery = { __typename?: 'RootQuery', app: { __typename?: 'AppQuery', byId: { __typename?: 'App', id: string, observe: { __typename?: 'AppObserve', navigationRoutes: { __typename?: 'AppObserveNavigationRoutesConnection', pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean, endCursor?: string | null }, edges: Array<{ __typename?: 'AppObserveNavigationRouteEdge', cursor: string, node: { __typename?: 'AppObserveNavigationRoute', routeName: string, coldTtr: { __typename?: 'AppObserveNavigationStat', count: number, median?: number | null, p90?: number | null }, warmTtr: { __typename?: 'AppObserveNavigationStat', count: number, median?: number | null, p90?: number | null }, tti: { __typename?: 'AppObserveNavigationStat', count: number, median?: number | null, p90?: number | null } } }> } } } } }; +export type PostHogOrganizationConnectionByAccountIdQueryVariables = Exact<{ + accountId: Scalars['String']['input']; +}>; + + +export type PostHogOrganizationConnectionByAccountIdQuery = { __typename?: 'RootQuery', account: { __typename?: 'AccountQuery', byId: { __typename?: 'Account', id: string, posthogOrganizationConnection?: { __typename?: 'PostHogOrganizationConnection', id: string, posthogOrganizationIdentifier: string, posthogOrganizationName: string, posthogRegion: PostHogRegion, createdAt: any, updatedAt: any } | null } } }; + +export type PostHogProjectByAppIdQueryVariables = Exact<{ + appId: Scalars['String']['input']; +}>; + + +export type PostHogProjectByAppIdQuery = { __typename?: 'RootQuery', app: { __typename?: 'AppQuery', byId: { __typename?: 'App', id: string, posthogProject?: { __typename?: 'PostHogProject', id: string, posthogProjectIdentifier: string, posthogProjectName: string, posthogProjectToken: string, posthogHost: string, createdAt: any, updatedAt: any, posthogOrganizationConnection: { __typename?: 'PostHogOrganizationConnection', id: string, posthogOrganizationIdentifier: string, posthogOrganizationName: string, posthogRegion: PostHogRegion, createdAt: any, updatedAt: any } } | null } } }; + export type GetAssetMetadataQueryVariables = Exact<{ storageKeys: Array | Scalars['String']['input']; }>; @@ -13725,6 +13913,10 @@ export type AppObserveEventFragment = { __typename?: 'AppObserveEvent', id: stri export type AppObserveAppVersionFragment = { __typename?: 'AppObserveAppVersion', appVersion: string, firstSeenAt: any, eventCount: number, uniqueUserCount: number, buildNumbers: Array<{ __typename?: 'AppObserveAppBuildNumber', appBuildNumber: string, firstSeenAt: any, eventCount: number, uniqueUserCount: number, easBuilds: Array<{ __typename?: 'AppObserveAppEasBuild', easBuildId: string, firstSeenAt: any, eventCount: number, uniqueUserCount: number }> }>, updates: Array<{ __typename?: 'AppObserveAppUpdate', appUpdateId: string, firstSeenAt: any, eventCount: number, uniqueUserCount: number, easBuilds: Array<{ __typename?: 'AppObserveAppEasBuild', easBuildId: string, firstSeenAt: any, eventCount: number, uniqueUserCount: number }> }>, metrics: Array<{ __typename?: 'AppObserveAppVersionMetric', metricName: string, eventCount: number, statistics: { __typename?: 'AppObserveVersionMarkerStatistics', min?: number | null, max?: number | null, median?: number | null, average?: number | null, p80?: number | null, p90?: number | null, p99?: number | null } }> }; +export type PostHogOrganizationConnectionFragment = { __typename?: 'PostHogOrganizationConnection', id: string, posthogOrganizationIdentifier: string, posthogOrganizationName: string, posthogRegion: PostHogRegion, createdAt: any, updatedAt: any }; + +export type PostHogProjectFragment = { __typename?: 'PostHogProject', id: string, posthogProjectIdentifier: string, posthogProjectName: string, posthogProjectToken: string, posthogHost: string, createdAt: any, updatedAt: any, posthogOrganizationConnection: { __typename?: 'PostHogOrganizationConnection', id: string, posthogOrganizationIdentifier: string, posthogOrganizationName: string, posthogRegion: PostHogRegion, createdAt: any, updatedAt: any } }; + export type RuntimeFragment = { __typename?: 'Runtime', id: string, version: string }; export type StatuspageServiceFragment = { __typename?: 'StatuspageService', id: string, name: StatuspageServiceName, status: StatuspageServiceStatus, incidents: Array<{ __typename?: 'StatuspageIncident', id: string, status: StatuspageIncidentStatus, name: string, impact: StatuspageIncidentImpact, shortlink: string }> }; diff --git a/packages/eas-cli/src/graphql/mutations/PostHogMutation.ts b/packages/eas-cli/src/graphql/mutations/PostHogMutation.ts new file mode 100644 index 0000000000..00543720a0 --- /dev/null +++ b/packages/eas-cli/src/graphql/mutations/PostHogMutation.ts @@ -0,0 +1,117 @@ +import { print } from 'graphql'; +import gql from 'graphql-tag'; + +import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient'; +import { withErrorHandlingAsync } from '../client'; +import { CreatePostHogAccountRequestInput, SetupPostHogProjectInput } from '../generated'; +import { + PostHogOrganizationConnectionData, + PostHogOrganizationConnectionFragmentNode, + PostHogProjectData, + PostHogProjectFragmentNode, +} from '../types/PostHogConnection'; + +type CreatePostHogAccountRequestMutation = { + posthogOrganizationConnection: { + createPostHogAccountRequest: PostHogOrganizationConnectionData; + }; +}; + +type CreatePostHogAccountRequestMutationVariables = { + input: CreatePostHogAccountRequestInput; +}; + +type SetupPostHogProjectMutation = { + posthogProject: { + setupPostHogProject: PostHogProjectData; + }; +}; + +type SetupPostHogProjectMutationVariables = { + input: SetupPostHogProjectInput; +}; + +type DeletePostHogProjectMutation = { + posthogProject: { + deletePostHogProject: string; + }; +}; + +type DeletePostHogProjectMutationVariables = { + id: string; +}; + +export const PostHogMutation = { + async createPostHogAccountRequestAsync( + graphqlClient: ExpoGraphqlClient, + input: CreatePostHogAccountRequestInput + ): Promise { + const data = await withErrorHandlingAsync( + graphqlClient + .mutation< + CreatePostHogAccountRequestMutation, + CreatePostHogAccountRequestMutationVariables + >( + gql` + mutation CreatePostHogAccountRequest($input: CreatePostHogAccountRequestInput!) { + posthogOrganizationConnection { + createPostHogAccountRequest(input: $input) { + id + ...PostHogOrganizationConnectionFragment + } + } + } + ${print(PostHogOrganizationConnectionFragmentNode)} + `, + { input } + ) + .toPromise() + ); + return data.posthogOrganizationConnection.createPostHogAccountRequest; + }, + + async setupPostHogProjectAsync( + graphqlClient: ExpoGraphqlClient, + input: SetupPostHogProjectInput + ): Promise { + const data = await withErrorHandlingAsync( + graphqlClient + .mutation( + gql` + mutation SetupPostHogProject($input: SetupPostHogProjectInput!) { + posthogProject { + setupPostHogProject(input: $input) { + id + ...PostHogProjectFragment + } + } + } + ${print(PostHogOrganizationConnectionFragmentNode)} + ${print(PostHogProjectFragmentNode)} + `, + { input } + ) + .toPromise() + ); + return data.posthogProject.setupPostHogProject; + }, + + async deletePostHogProjectAsync(graphqlClient: ExpoGraphqlClient, id: string): Promise { + const data = await withErrorHandlingAsync( + graphqlClient + .mutation( + gql` + mutation DeletePostHogProject($id: ID!) { + posthogProject { + deletePostHogProject(id: $id) + } + } + `, + { id }, + { additionalTypenames: ['App', 'PostHogProject'] } + ) + .toPromise() + ); + return data.posthogProject.deletePostHogProject; + }, +}; diff --git a/packages/eas-cli/src/graphql/queries/PostHogQuery.ts b/packages/eas-cli/src/graphql/queries/PostHogQuery.ts new file mode 100644 index 0000000000..8dc9f2bf11 --- /dev/null +++ b/packages/eas-cli/src/graphql/queries/PostHogQuery.ts @@ -0,0 +1,103 @@ +import { print } from 'graphql'; +import gql from 'graphql-tag'; + +import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient'; +import { withErrorHandlingAsync } from '../client'; +import { + PostHogOrganizationConnectionData, + PostHogOrganizationConnectionFragmentNode, + PostHogProjectData, + PostHogProjectFragmentNode, +} from '../types/PostHogConnection'; + +type PostHogOrganizationConnectionByAccountIdQuery = { + account: { + byId: { + id: string; + posthogOrganizationConnection?: PostHogOrganizationConnectionData | null; + }; + }; +}; + +type PostHogOrganizationConnectionByAccountIdQueryVariables = { + accountId: string; +}; + +type PostHogProjectByAppIdQuery = { + app: { + byId: { + id: string; + posthogProject?: PostHogProjectData | null; + }; + }; +}; + +type PostHogProjectByAppIdQueryVariables = { + appId: string; +}; + +export const PostHogQuery = { + async getPostHogOrganizationConnectionByAccountIdAsync( + graphqlClient: ExpoGraphqlClient, + accountId: string + ): Promise { + const data = await withErrorHandlingAsync( + graphqlClient + .query< + PostHogOrganizationConnectionByAccountIdQuery, + PostHogOrganizationConnectionByAccountIdQueryVariables + >( + gql` + query PostHogOrganizationConnectionByAccountId($accountId: String!) { + account { + byId(accountId: $accountId) { + id + posthogOrganizationConnection { + id + ...PostHogOrganizationConnectionFragment + } + } + } + } + ${print(PostHogOrganizationConnectionFragmentNode)} + `, + { accountId }, + { additionalTypenames: ['PostHogOrganizationConnection'] } + ) + .toPromise() + ); + + return data.account.byId.posthogOrganizationConnection ?? null; + }, + + async getPostHogProjectByAppIdAsync( + graphqlClient: ExpoGraphqlClient, + appId: string + ): Promise { + const data = await withErrorHandlingAsync( + graphqlClient + .query( + gql` + query PostHogProjectByAppId($appId: String!) { + app { + byId(appId: $appId) { + id + posthogProject { + id + ...PostHogProjectFragment + } + } + } + } + ${print(PostHogOrganizationConnectionFragmentNode)} + ${print(PostHogProjectFragmentNode)} + `, + { appId }, + { additionalTypenames: ['App', 'PostHogProject'] } + ) + .toPromise() + ); + + return data.app.byId.posthogProject ?? null; + }, +}; diff --git a/packages/eas-cli/src/graphql/types/PostHogConnection.ts b/packages/eas-cli/src/graphql/types/PostHogConnection.ts new file mode 100644 index 0000000000..642384b392 --- /dev/null +++ b/packages/eas-cli/src/graphql/types/PostHogConnection.ts @@ -0,0 +1,53 @@ +import gql from 'graphql-tag'; + +import { PostHogOrganizationConnection, PostHogProject } from '../generated'; + +export type PostHogOrganizationConnectionData = Pick< + PostHogOrganizationConnection, + | 'id' + | 'posthogOrganizationIdentifier' + | 'posthogOrganizationName' + | 'posthogRegion' + | 'createdAt' + | 'updatedAt' +>; + +export type PostHogProjectData = Pick< + PostHogProject, + | 'id' + | 'posthogProjectIdentifier' + | 'posthogProjectName' + | 'posthogProjectToken' + | 'posthogHost' + | 'createdAt' + | 'updatedAt' +> & { + posthogOrganizationConnection: PostHogOrganizationConnectionData; +}; + +export const PostHogOrganizationConnectionFragmentNode = gql` + fragment PostHogOrganizationConnectionFragment on PostHogOrganizationConnection { + id + posthogOrganizationIdentifier + posthogOrganizationName + posthogRegion + createdAt + updatedAt + } +`; + +export const PostHogProjectFragmentNode = gql` + fragment PostHogProjectFragment on PostHogProject { + id + posthogProjectIdentifier + posthogProjectName + posthogProjectToken + posthogHost + createdAt + updatedAt + posthogOrganizationConnection { + id + ...PostHogOrganizationConnectionFragment + } + } +`;