Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
feat: add app connection
adilson04cfef1a79d2
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.tsindex cd6cd952db..2749135b87 100644--- a/backend/src/lib/api-docs/constants.ts+++ b/backend/src/lib/api-docs/constants.ts@@ -2919,6 +2919,9 @@ export const AppConnections = {accessToken: "The Convex deploy key or access token used to authenticate with the Convex API.",instanceUrl: "The Convex API instance URL. Defaults to 'https://api.convex.dev' if not provided."},+ HASURA_CLOUD: {+ accessToken: "The Hasura Cloud access token used to authenticate with the Hasura Cloud GraphQL API."+ },OVH: {privateKey:"The PEM-encoded private key issued by OVH OKMS for client certificate authentication (including the -----BEGIN/END PRIVATE KEY----- markers).",diff --git a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.tsindex 8102bc52ff..4d69888616 100644--- a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts+++ b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts@@ -116,6 +116,10 @@ import {GoDaddyConnectionListItemSchema,SanitizedGoDaddyConnectionSchema} from "@app/services/app-connection/godaddy";+import {+ HasuraCloudConnectionListItemSchema,+ SanitizedHasuraCloudConnectionSchema+} from "@app/services/app-connection/hasura-cloud";import {HCVaultConnectionListItemSchema,SanitizedHCVaultConnectionSchema@@ -242,6 +246,7 @@ const SanitizedAppConnectionSchema = z.union([...SanitizedOracleDBConnectionSchema.options,...SanitizedOnePassConnectionSchema.options,...SanitizedHerokuConnectionSchema.options,+ ...SanitizedHasuraCloudConnectionSchema.options,...SanitizedRenderConnectionSchema.options,...SanitizedFlyioConnectionSchema.options,...SanitizedTriggerDevConnectionSchema.options,@@ -315,6 +320,7 @@ const AppConnectionOptionsSchema = z.discriminatedUnion("app", [OracleDBConnectionListItemSchema,OnePassConnectionListItemSchema,HerokuConnectionListItemSchema,+ HasuraCloudConnectionListItemSchema,RenderConnectionListItemSchema,FlyioConnectionListItemSchema,TriggerDevConnectionListItemSchema,diff --git a/backend/src/server/routes/v1/app-connection-routers/hasura-cloud-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/hasura-cloud-connection-router.tsnew file mode 100644index 0000000000..e70ef39807--- /dev/null+++ b/backend/src/server/routes/v1/app-connection-routers/hasura-cloud-connection-router.ts@@ -0,0 +1,18 @@+import { AppConnection } from "@app/services/app-connection/app-connection-enums";+import {+ CreateHasuraCloudConnectionSchema,+ SanitizedHasuraCloudConnectionSchema,+ UpdateHasuraCloudConnectionSchema+} from "@app/services/app-connection/hasura-cloud";++import { registerAppConnectionEndpoints } from "./app-connection-endpoints";++export const registerHasuraCloudConnectionRouter = async (server: FastifyZodProvider) => {+ registerAppConnectionEndpoints({+ app: AppConnection.HasuraCloud,+ server,+ sanitizedResponseSchema: SanitizedHasuraCloudConnectionSchema,+ createSchema: CreateHasuraCloudConnectionSchema,+ updateSchema: UpdateHasuraCloudConnectionSchema+ });+};diff --git a/backend/src/server/routes/v1/app-connection-routers/index.ts b/backend/src/server/routes/v1/app-connection-routers/index.tsindex 861a892ccb..ac4ceca7ff 100644--- a/backend/src/server/routes/v1/app-connection-routers/index.ts+++ b/backend/src/server/routes/v1/app-connection-routers/index.ts@@ -36,6 +36,7 @@ import { registerGitHubConnectionRouter } from "./github-connection-router";import { registerGitHubRadarConnectionRouter } from "./github-radar-connection-router";import { registerGitLabConnectionRouter } from "./gitlab-connection-router";import { registerGoDaddyConnectionRouter } from "./godaddy-connection-router";+import { registerHasuraCloudConnectionRouter } from "./hasura-cloud-connection-router";import { registerHCVaultConnectionRouter } from "./hc-vault-connection-router";import { registerHerokuConnectionRouter } from "./heroku-connection-router";import { registerHumanitecConnectionRouter } from "./humanitec-connection-router";@@ -144,5 +145,6 @@ export const APP_CONNECTION_REGISTER_ROUTER_MAP: Record<AppConnection, (server:[AppConnection.Snowflake]: registerSnowflakeConnectionRouter,[AppConnection.Datadog]: registerDatadogConnectionRouter,[AppConnection.F5BigIp]: registerF5BigIpConnectionRouter,- [AppConnection.Convex]: registerConvexConnectionRouter+ [AppConnection.Convex]: registerConvexConnectionRouter,+ [AppConnection.HasuraCloud]: registerHasuraCloudConnectionRouter};diff --git a/backend/src/services/app-connection/app-connection-enums.ts b/backend/src/services/app-connection/app-connection-enums.tsindex 2396a9309e..0c23a65668 100644--- a/backend/src/services/app-connection/app-connection-enums.ts+++ b/backend/src/services/app-connection/app-connection-enums.ts@@ -68,7 +68,8 @@ export enum AppConnection {Datadog = "datadog",F5BigIp = "f5-big-ip",GoDaddy = "godaddy",- Convex = "convex"+ Convex = "convex",+ HasuraCloud = "hasura-cloud"}export enum AWSRegion {diff --git a/backend/src/services/app-connection/app-connection-fns.ts b/backend/src/services/app-connection/app-connection-fns.tsindex 6fdb0ede8c..b9d19ea197 100644--- a/backend/src/services/app-connection/app-connection-fns.ts+++ b/backend/src/services/app-connection/app-connection-fns.ts@@ -159,6 +159,11 @@ import {import { GitLabConnectionMethod } from "./gitlab";import { getGitLabConnectionListItem, validateGitLabConnectionCredentials } from "./gitlab/gitlab-connection-fns";import { getGoDaddyConnectionListItem, GoDaddyConnectionMethod, validateGoDaddyConnectionCredentials } from "./godaddy";+import {+ getHasuraCloudConnectionListItem,+ HasuraCloudConnectionMethod,+ validateHasuraCloudConnectionCredentials+} from "./hasura-cloud";import {getHCVaultConnectionListItem,HCVaultConnectionMethod,@@ -320,6 +325,7 @@ export const listAppConnectionOptions = (projectType?: ProjectType) => {getOracleDBConnectionListItem(),getOnePassConnectionListItem(),getHerokuConnectionListItem(),+ getHasuraCloudConnectionListItem(),getRenderConnectionListItem(),getLaravelForgeConnectionListItem(),getOctopusDeployConnectionListItem(),@@ -553,6 +559,7 @@ export const validateAppConnectionCredentials = async ([AppConnection.OracleDB]: validateSqlConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.OnePass]: validateOnePassConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.Heroku]: validateHerokuConnectionCredentials as TAppConnectionCredentialsValidator,+ [AppConnection.HasuraCloud]: validateHasuraCloudConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.Render]: validateRenderConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.LaravelForge]: validateLaravelForgeConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.Flyio]: validateFlyioConnectionCredentials as TAppConnectionCredentialsValidator,@@ -676,6 +683,7 @@ export const getAppConnectionMethodName = (method: TAppConnection["method"]) =>case TeamCityConnectionMethod.AccessToken:case AzureDevOpsConnectionMethod.AccessToken:case FlyioConnectionMethod.AccessToken:+ case HasuraCloudConnectionMethod.AccessToken:return "Access Token";case Auth0ConnectionMethod.ClientCredentials:case SalesforceConnectionMethod.ClientCredentials:@@ -804,6 +812,7 @@ export const TRANSITION_CONNECTION_CREDENTIALS_TO_PLATFORM: Record<[AppConnection.OracleDB]: transferSqlConnectionCredentialsToPlatform as TAppConnectionTransitionCredentialsToPlatform,[AppConnection.OnePass]: platformManagedCredentialsNotSupported,[AppConnection.Heroku]: platformManagedCredentialsNotSupported,+ [AppConnection.HasuraCloud]: platformManagedCredentialsNotSupported,[AppConnection.Render]: platformManagedCredentialsNotSupported,[AppConnection.Flyio]: platformManagedCredentialsNotSupported,[AppConnection.TriggerDev]: platformManagedCredentialsNotSupported,diff --git a/backend/src/services/app-connection/app-connection-maps.ts b/backend/src/services/app-connection/app-connection-maps.tsindex b265cce9c5..02973afdf1 100644--- a/backend/src/services/app-connection/app-connection-maps.ts+++ b/backend/src/services/app-connection/app-connection-maps.ts@@ -70,7 +70,8 @@ export const APP_CONNECTION_NAME_MAP: Record<AppConnection, string> = {[AppConnection.Datadog]: "Datadog",[AppConnection.F5BigIp]: "F5 BIG-IP",[AppConnection.GoDaddy]: "GoDaddy",- [AppConnection.Convex]: "Convex"+ [AppConnection.Convex]: "Convex",+ [AppConnection.HasuraCloud]: "Hasura Cloud"};export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanType> = {@@ -143,5 +144,6 @@ export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanTyp[AppConnection.Datadog]: AppConnectionPlanType.Regular,[AppConnection.F5BigIp]: AppConnectionPlanType.Regular,[AppConnection.GoDaddy]: AppConnectionPlanType.Regular,- [AppConnection.Convex]: AppConnectionPlanType.Regular+ [AppConnection.Convex]: AppConnectionPlanType.Regular,+ [AppConnection.HasuraCloud]: AppConnectionPlanType.Regular};diff --git a/backend/src/services/app-connection/app-connection-service.ts b/backend/src/services/app-connection/app-connection-service.tsindex 310db7fce6..1737214f65 100644--- a/backend/src/services/app-connection/app-connection-service.ts+++ b/backend/src/services/app-connection/app-connection-service.ts@@ -117,6 +117,7 @@ import { githubRadarConnectionService } from "./github-radar/github-radar-connecimport { ValidateGitLabConnectionCredentialsSchema } from "./gitlab";import { gitlabConnectionService } from "./gitlab/gitlab-connection-service";import { ValidateGoDaddyConnectionCredentialsSchema } from "./godaddy/godaddy-connection-schemas";+import { ValidateHasuraCloudConnectionCredentialsSchema } from "./hasura-cloud";import { ValidateHCVaultConnectionCredentialsSchema } from "./hc-vault";import { hcVaultConnectionService } from "./hc-vault/hc-vault-connection-service";import { ValidateHerokuConnectionCredentialsSchema } from "./heroku";@@ -223,6 +224,7 @@ const VALIDATE_APP_CONNECTION_CREDENTIALS_MAP: Record<AppConnection, TValidateAp[AppConnection.OracleDB]: ValidateOracleDBConnectionCredentialsSchema,[AppConnection.OnePass]: ValidateOnePassConnectionCredentialsSchema,[AppConnection.Heroku]: ValidateHerokuConnectionCredentialsSchema,+ [AppConnection.HasuraCloud]: ValidateHasuraCloudConnectionCredentialsSchema,[AppConnection.Render]: ValidateRenderConnectionCredentialsSchema,[AppConnection.LaravelForge]: ValidateLaravelForgeConnectionCredentialsSchema,[AppConnection.Flyio]: ValidateFlyioConnectionCredentialsSchema,diff --git a/backend/src/services/app-connection/app-connection-types.ts b/backend/src/services/app-connection/app-connection-types.tsindex 3fccad5c92..2196605357 100644--- a/backend/src/services/app-connection/app-connection-types.ts+++ b/backend/src/services/app-connection/app-connection-types.ts@@ -220,6 +220,12 @@ import {TGoDaddyConnectionInput,TValidateGoDaddyConnectionCredentialsSchema} from "./godaddy";+import {+ THasuraCloudConnection,+ THasuraCloudConnectionConfig,+ THasuraCloudConnectionInput,+ TValidateHasuraCloudConnectionCredentialsSchema+} from "./hasura-cloud";import {THCVaultConnection,THCVaultConnectionConfig,@@ -487,6 +493,7 @@ export type TAppConnection = { id: string; configuration?: TAppConnectionConfigu| TDatadogConnection| TF5BigIpConnection| TConvexConnection+ | THasuraCloudConnection);export type TAppConnectionRaw = NonNullable<Awaited<ReturnType<TAppConnectionDALFactory["findById"]>>>;@@ -568,6 +575,7 @@ export type TAppConnectionInput = { id: string } & (| TDatadogConnectionInput| TF5BigIpConnectionInput| TConvexConnectionInput+ | THasuraCloudConnectionInput);export type TSqlConnectionInput =@@ -680,7 +688,8 @@ export type TAppConnectionConfig =| TSnowflakeConnectionConfig| TDatadogConnectionConfig| TF5BigIpConnectionConfig- | TConvexConnectionConfig;+ | TConvexConnectionConfig+ | THasuraCloudConnectionConfig;export type TValidateAppConnectionCredentialsSchema =| TValidateAwsConnectionCredentialsSchema@@ -752,7 +761,8 @@ export type TValidateAppConnectionCredentialsSchema =| TValidateSnowflakeConnectionCredentialsSchema| TValidateDatadogConnectionCredentialsSchema| TValidateF5BigIpConnectionCredentialsSchema- | TValidateConvexConnectionCredentialsSchema;+ | TValidateConvexConnectionCredentialsSchema+ | TValidateHasuraCloudConnectionCredentialsSchema;export type TListAwsConnectionKmsKeys = {connectionId: string;diff --git a/backend/src/services/app-connection/hasura-cloud/hasura-cloud-connection-enums.ts b/backend/src/services/app-connection/hasura-cloud/hasura-cloud-connection-enums.tsnew file mode 100644index 0000000000..d873762751--- /dev/null+++ b/backend/src/services/app-connection/hasura-cloud/hasura-cloud-connection-enums.ts@@ -0,0 +1,3 @@+export enum HasuraCloudConnectionMethod {+ AccessToken = "access-token"+}diff --git a/backend/src/services/app-connection/hasura-cloud/hasura-cloud-connection-fns.ts b/backend/src/services/app-connection/hasura-cloud/hasura-cloud-connection-fns.tsnew file mode 100644index 0000000000..7105c33c26--- /dev/null+++ b/backend/src/services/app-connection/hasura-cloud/hasura-cloud-connection-fns.ts@@ -0,0 +1,52 @@+import { request } from "@app/lib/config/request";+import { BadRequestError } from "@app/lib/errors";+import { AppConnection } from "@app/services/app-connection/app-connection-enums";++import { HasuraCloudConnectionMethod } from "./hasura-cloud-connection-enums";+import { THasuraCloudConnectionConfig } from "./hasura-cloud-connection-types";++export const HASURA_CLOUD_API_URL = "https://data.pro.hasura.io/v1/graphql";++export const getHasuraCloudConnectionListItem = () => {+ return {+ name: "Hasura Cloud" as const,+ app: AppConnection.HasuraCloud as const,+ methods: Object.values(HasuraCloudConnectionMethod) as [HasuraCloudConnectionMethod.AccessToken]+ };+};++export const validateHasuraCloudConnectionCredentials = async (config: THasuraCloudConnectionConfig) => {+ const { accessToken } = config.credentials;++ try {+ // Hasura Cloud's GraphQL API returns HTTP 200 even on auth failures, so we must+ // inspect the response body rather than relying on the status code alone.+ const { data } = await request.post<{+ data?: { projects?: unknown[] };+ errors?: { message: string }[];+ }>(+ HASURA_CLOUD_API_URL,+ { query: "query { projects { name tenant { id } } }" },+ {+ headers: {+ Authorization: `pat ${accessToken}`,+ "Content-Type": "application/json"+ }+ }+ );++ if (data.errors?.length || !data.data?.projects) {+ throw new BadRequestError({+ message: "Unable to validate connection: invalid access token"+ });+ }+ } catch (error) {+ if (error instanceof BadRequestError) throw error;++ throw new BadRequestError({+ message: "Unable to validate connection: invalid access token"+ });+ }++ return config.credentials;+};diff --git a/backend/src/services/app-connection/hasura-cloud/hasura-cloud-connection-schemas.ts b/backend/src/services/app-connection/hasura-cloud/hasura-cloud-connection-schemas.tsnew file mode 100644index 0000000000..42085e0bc8--- /dev/null+++ b/backend/src/services/app-connection/hasura-cloud/hasura-cloud-connection-schemas.ts@@ -0,0 +1,65 @@+import z from "zod";++import { AppConnections } from "@app/lib/api-docs";+import { AppConnection } from "@app/services/app-connection/app-connection-enums";+import {+ BaseAppConnectionSchema,+ GenericCreateAppConnectionFieldsSchema,+ GenericUpdateAppConnectionFieldsSchema+} from "@app/services/app-connection/app-connection-schemas";++import { APP_CONNECTION_NAME_MAP } from "../app-connection-maps";+import { HasuraCloudConnectionMethod } from "./hasura-cloud-connection-enums";++export const HasuraCloudConnectionAccessTokenCredentialsSchema = z.object({+ accessToken: z+ .string()+ .trim()+ .min(1, "Access Token required")+ .describe(AppConnections.CREDENTIALS.HASURA_CLOUD.accessToken)+});++const BaseHasuraCloudConnectionSchema = BaseAppConnectionSchema.extend({ app: z.literal(AppConnection.HasuraCloud) });++export const HasuraCloudConnectionSchema = BaseHasuraCloudConnectionSchema.extend({+ method: z.literal(HasuraCloudConnectionMethod.AccessToken),+ credentials: HasuraCloudConnectionAccessTokenCredentialsSchema+});++export const SanitizedHasuraCloudConnectionSchema = z.discriminatedUnion("method", [+ BaseHasuraCloudConnectionSchema.extend({+ method: z.literal(HasuraCloudConnectionMethod.AccessToken),+ credentials: z.object({})+ }).describe(JSON.stringify({ title: `${APP_CONNECTION_NAME_MAP[AppConnection.HasuraCloud]} (Access Token)` }))+]);++export const ValidateHasuraCloudConnectionCredentialsSchema = z.discriminatedUnion("method", [+ z.object({+ method: z+ .literal(HasuraCloudConnectionMethod.AccessToken)+ .describe(AppConnections.CREATE(AppConnection.HasuraCloud).method),+ credentials: HasuraCloudConnectionAccessTokenCredentialsSchema.describe(+ AppConnections.CREATE(AppConnection.HasuraCloud).credentials+ )+ })+]);++export const CreateHasuraCloudConnectionSchema = ValidateHasuraCloudConnectionCredentialsSchema.and(+ GenericCreateAppConnectionFieldsSchema(AppConnection.HasuraCloud)+);++export const UpdateHasuraCloudConnectionSchema = z+ .object({+ credentials: HasuraCloudConnectionAccessTokenCredentialsSchema.optional().describe(+ AppConnections.UPDATE(AppConnection.HasuraCloud).credentials+ )+ })+ .and(GenericUpdateAppConnectionFieldsSchema(AppConnection.HasuraCloud));++export const HasuraCloudConnectionListItemSchema = z+ .object({+ name: z.literal("Hasura Cloud"),+ app: z.literal(AppConnection.HasuraCloud),+ methods: z.nativeEnum(HasuraCloudConnectionMethod).array()+ })+ .describe(JSON.stringify({ title: APP_CONNECTION_NAME_MAP[AppConnection.HasuraCloud] }));diff --git a/backend/src/services/app-connection/hasura-cloud/hasura-cloud-connection-types.ts b/backend/src/services/app-connection/hasura-cloud/hasura-cloud-connection-types.tsnew file mode 100644index 0000000000..6387518eed--- /dev/null+++ b/backend/src/services/app-connection/hasura-cloud/hasura-cloud-connection-types.ts@@ -0,0 +1,25 @@+import z from "zod";++import { DiscriminativePick } from "@app/lib/types";++import { AppConnection } from "../app-connection-enums";+import {+ CreateHasuraCloudConnectionSchema,+ HasuraCloudConnectionSchema,+ ValidateHasuraCloudConnectionCredentialsSchema+} from "./hasura-cloud-connection-schemas";++export type THasuraCloudConnection = z.infer<typeof HasuraCloudConnectionSchema>;++export type THasuraCloudConnectionInput = z.infer<typeof CreateHasuraCloudConnectionSchema> & {+ app: AppConnection.HasuraCloud;+};++export type TValidateHasuraCloudConnectionCredentialsSchema = typeof ValidateHasuraCloudConnectionCredentialsSchema;++export type THasuraCloudConnectionConfig = DiscriminativePick<+ THasuraCloudConnectionInput,+ "method" | "app" | "credentials"+> & {+ orgId: string;+};diff --git a/backend/src/services/app-connection/hasura-cloud/index.ts b/backend/src/services/app-connection/hasura-cloud/index.tsnew file mode 100644index 0000000000..eb01ddb8f0--- /dev/null+++ b/backend/src/services/app-connection/hasura-cloud/index.ts@@ -0,0 +1,4 @@+export * from "./hasura-cloud-connection-enums";+export * from "./hasura-cloud-connection-fns";+export * from "./hasura-cloud-connection-schemas";+export * from "./hasura-cloud-connection-types";diff --git a/frontend/src/helpers/appConnections.ts b/frontend/src/helpers/appConnections.tsindex 509fa0470b..f23c06d261 100644--- a/frontend/src/helpers/appConnections.ts+++ b/frontend/src/helpers/appConnections.ts@@ -65,6 +65,7 @@ import { DopplerConnectionMethod } from "@app/hooks/api/appConnections/types/dopimport { ExternalInfisicalConnectionMethod } from "@app/hooks/api/appConnections/types/external-infisical-connection";import { F5BigIpConnectionMethod } from "@app/hooks/api/appConnections/types/f5-big-ip-connection";import { GoDaddyConnectionMethod } from "@app/hooks/api/appConnections/types/godaddy-connection";+import { HasuraCloudConnectionMethod } from "@app/hooks/api/appConnections/types/hasura-cloud-connection";import { HerokuConnectionMethod } from "@app/hooks/api/appConnections/types/heroku-connection";import { LaravelForgeConnectionMethod } from "@app/hooks/api/appConnections/types/laravel-forge-connection";import { NetlifyConnectionMethod } from "@app/hooks/api/appConnections/types/netlify-connection";@@ -458,6 +459,12 @@ export const APP_CONNECTION_MAP: Record<category: "AI",description: "Manage Anthropic API access."},+ [AppConnection.HasuraCloud]: {+ name: "Hasura Cloud",+ image: "Hasura.svg",+ category: "PLATFORM",+ description: "GraphQL API and data access for Hasura Cloud."+ },[AppConnection.OVH]: {name: "OVH Cloud",image: "OVH.png",@@ -606,6 +613,7 @@ export const getAppConnectionMethodDetails = (method: TAppConnection["method"])case FlyioConnectionMethod.AccessToken:case NetlifyConnectionMethod.AccessToken:case ConvexConnectionMethod.PersonalAccessToken:+ case HasuraCloudConnectionMethod.AccessToken:return { name: "Personal Access Token", icon: faKey };case Auth0ConnectionMethod.ClientCredentials:case SalesforceConnectionMethod.ClientCredentials:diff --git a/frontend/src/hooks/api/appConnections/enums.ts b/frontend/src/hooks/api/appConnections/enums.tsindex 28a77fade9..c566e1d7ee 100644--- a/frontend/src/hooks/api/appConnections/enums.ts+++ b/frontend/src/hooks/api/appConnections/enums.ts@@ -68,5 +68,6 @@ export enum AppConnection {F5BigIp = "f5-big-ip",GoDaddy = "godaddy",Convex = "convex",- TriggerDev = "trigger-dev"+ TriggerDev = "trigger-dev",+ HasuraCloud = "hasura-cloud"}diff --git a/frontend/src/hooks/api/appConnections/types/app-options.ts b/frontend/src/hooks/api/appConnections/types/app-options.tsindex 8538c09801..37db540895 100644--- a/frontend/src/hooks/api/appConnections/types/app-options.ts+++ b/frontend/src/hooks/api/appConnections/types/app-options.ts@@ -294,6 +294,10 @@ export type TTriggerDevConnectionOption = TAppConnectionOptionBase & {app: AppConnection.TriggerDev;};+export type THasuraCloudConnectionOption = TAppConnectionOptionBase & {+ app: AppConnection.HasuraCloud;+};+export type TAppConnectionOption =| TAwsConnectionOption| TGitHubConnectionOption@@ -364,7 +368,8 @@ export type TAppConnectionOption =| TDatadogConnectionOption| TF5BigIpConnectionOption| TConvexConnectionOption- | TTriggerDevConnectionOption;+ | TTriggerDevConnectionOption+ | THasuraCloudConnectionOption;export type TAppConnectionOptionMap = {[AppConnection.AWS]: TAwsConnectionOption;@@ -437,4 +442,5 @@ export type TAppConnectionOptionMap = {[AppConnection.F5BigIp]: TF5BigIpConnectionOption;[AppConnection.Convex]: TConvexConnectionOption;[AppConnection.TriggerDev]: TTriggerDevConnectionOption;+ [AppConnection.HasuraCloud]: THasuraCloudConnectionOption;};diff --git a/frontend/src/hooks/api/appConnections/types/hasura-cloud-connection.ts b/frontend/src/hooks/api/appConnections/types/hasura-cloud-connection.tsnew file mode 100644index 0000000000..4760eab66b--- /dev/null+++ b/frontend/src/hooks/api/appConnections/types/hasura-cloud-connection.ts@@ -0,0 +1,13 @@+import { AppConnection } from "@app/hooks/api/appConnections/enums";+import { TRootAppConnection } from "@app/hooks/api/appConnections/types/root-connection";++export enum HasuraCloudConnectionMethod {+ AccessToken = "access-token"+}++export type THasuraCloudConnection = TRootAppConnection & { app: AppConnection.HasuraCloud } & {+ method: HasuraCloudConnectionMethod.AccessToken;+ credentials: {+ accessToken: string;+ };+};diff --git a/frontend/src/hooks/api/appConnections/types/index.ts b/frontend/src/hooks/api/appConnections/types/index.tsindex 745297a050..6af51801ca 100644--- a/frontend/src/hooks/api/appConnections/types/index.ts+++ b/frontend/src/hooks/api/appConnections/types/index.ts@@ -34,6 +34,7 @@ import { TGitHubConnection } from "./github-connection";import { TGitHubRadarConnection } from "./github-radar-connection";import { TGitLabConnection } from "./gitlab-connection";import { TGoDaddyConnection } from "./godaddy-connection";+import { THasuraCloudConnection } from "./hasura-cloud-connection";import { THCVaultConnection } from "./hc-vault-connection";import { THerokuConnection } from "./heroku-connection";import { THumanitecConnection } from "./humanitec-connection";@@ -102,6 +103,7 @@ export * from "./gcp-connection";export * from "./github-connection";export * from "./github-radar-connection";export * from "./gitlab-connection";+export * from "./hasura-cloud-connection";export * from "./hc-vault-connection";export * from "./heroku-connection";export * from "./humanitec-connection";@@ -209,7 +211,8 @@ export type TAppConnection =| TDatadogConnection| TF5BigIpConnection| TConvexConnection- | TTriggerDevConnection;+ | TTriggerDevConnection+ | THasuraCloudConnection;export type TAvailableAppConnection = Pick<TAppConnection, "name" | "id" | "projectId">;diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsxindex 75b0850194..74cb7e4d72 100644--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx@@ -49,6 +49,7 @@ import { GitHubConnectionForm } from "./GitHubConnectionForm";import { GitHubRadarConnectionForm } from "./GitHubRadarConnectionForm";import { GitLabConnectionForm } from "./GitLabConnectionForm";import { GoDaddyConnectionForm } from "./GoDaddyConnectionForm";+import { HasuraCloudConnectionForm } from "./HasuraCloudConnectionForm";import { HCVaultConnectionForm } from "./HCVaultConnectionForm";import { HerokuConnectionForm } from "./HerokuAppConnectionForm";import { HumanitecConnectionForm } from "./HumanitecConnectionForm";@@ -236,6 +237,8 @@ const CreateForm = ({ app, onComplete, projectId }: CreateFormProps) => {return <OnePassConnectionForm onSubmit={onSubmit} />;case AppConnection.Heroku:return <HerokuConnectionForm onSubmit={onSubmit} projectId={projectId} />;+ case AppConnection.HasuraCloud:+ return <HasuraCloudConnectionForm onSubmit={onSubmit} />;case AppConnection.Render:return <RenderConnectionForm onSubmit={onSubmit} />;case AppConnection.LaravelForge:@@ -481,6 +484,8 @@ const UpdateForm = ({ appConnection, onComplete }: UpdateFormProps) => {projectId={appConnection.projectId}/>);+ case AppConnection.HasuraCloud:+ return <HasuraCloudConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;case AppConnection.Render:return <RenderConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;case AppConnection.LaravelForge:diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/HasuraCloudConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/HasuraCloudConnectionForm.tsxnew file mode 100644index 0000000000..7adb00cac6--- /dev/null+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/HasuraCloudConnectionForm.tsx@@ -0,0 +1,132 @@+import { Controller, FormProvider, useForm } from "react-hook-form";+import { zodResolver } from "@hookform/resolvers/zod";+import { Info } from "lucide-react";+import { z } from "zod";++import {+ Field,+ FieldError,+ FieldLabel,+ SecretInput,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";+import { APP_CONNECTION_MAP, getAppConnectionMethodDetails } from "@app/helpers/appConnections";+import { AppConnection } from "@app/hooks/api/appConnections/enums";+import {+ HasuraCloudConnectionMethod,+ THasuraCloudConnection+} from "@app/hooks/api/appConnections/types/hasura-cloud-connection";++import { AppConnectionFormFooter } from "./AppConnectionFormFooter";+import {+ genericAppConnectionFieldsSchema,+ GenericAppConnectionsFields+} from "./GenericAppConnectionFields";++type Props = {+ appConnection?: THasuraCloudConnection;+ onSubmit: (formData: FormData) => void;+};++const rootSchema = genericAppConnectionFieldsSchema.extend({+ app: z.literal(AppConnection.HasuraCloud)+});++const formSchema = z.discriminatedUnion("method", [+ rootSchema.extend({+ method: z.literal(HasuraCloudConnectionMethod.AccessToken),+ credentials: z.object({+ accessToken: z.string().trim().min(1, "Access Token required")+ })+ })+]);++type FormData = z.infer<typeof formSchema>;++export const HasuraCloudConnectionForm = ({ appConnection, onSubmit }: Props) => {+ const isUpdate = Boolean(appConnection);++ const form = useForm<FormData>({+ resolver: zodResolver(formSchema),+ defaultValues: appConnection ?? {+ app: AppConnection.HasuraCloud,+ method: HasuraCloudConnectionMethod.AccessToken+ }+ });++ const { handleSubmit, control } = form;++ return (+ <FormProvider {...form}>+ <form onSubmit={handleSubmit(onSubmit)}>+ {!isUpdate && <GenericAppConnectionsFields />}+ <Controller+ name="method"+ control={control}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Method+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ {`The method you would like to use to connect with ${+ APP_CONNECTION_MAP[AppConnection.HasuraCloud].name+ }. This field cannot be changed after creation.`}+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Select disabled={isUpdate} value={value} onValueChange={(val) => onChange(val)}>+ <SelectTrigger className="w-full" isError={Boolean(error)}>+ <SelectValue placeholder="Select a method..." />+ </SelectTrigger>+ <SelectContent position="popper">+ {Object.values(HasuraCloudConnectionMethod).map((method) => (+ <SelectItem value={method} key={method}>+ {getAppConnectionMethodDetails(method).name}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <Controller+ name="credentials.accessToken"+ control={control}+ shouldUnregister+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel htmlFor="access-token">+ Access Token+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ The Hasura Cloud access token used to authenticate with the GraphQL API.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <SecretInput value={value} onChange={(e) => onChange(e.target.value)} />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <AppConnectionFormFooter+ submitLabel={isUpdate ? "Update Credentials" : "Connect to Hasura Cloud"}+ />+ </form>+ </FormProvider>+ );+};