Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

app connection

Matheus Nogueiradc916e4b1c34
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index fc4cb18e50..6e93ebdbc1 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -2887,6 +2887,10 @@ export const AppConnections = {
ANTHROPIC: {
apiKey: "The Anthropic API key used to authenticate with the Anthropic API."
},
+ CONVEX: {
+ 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."
+ },
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.ts
index 3a37ed1a1a..7d3345be8d 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
@@ -65,6 +65,10 @@ import {
CircleCIConnectionListItemSchema,
SanitizedCircleCIConnectionSchema
} from "@app/services/app-connection/circleci";
+import {
+ ConvexConnectionListItemSchema,
+ SanitizedConvexConnectionSchema
+} from "@app/services/app-connection/convex";
import {
CloudflareConnectionListItemSchema,
SanitizedCloudflareConnectionSchema
@@ -279,7 +283,8 @@ const SanitizedAppConnectionSchema = z.union([
...SanitizedSalesforceConnectionSchema.options,
...SanitizedSnowflakeConnectionSchema.options,
...SanitizedDatadogConnectionSchema.options,
- ...SanitizedF5BigIpConnectionSchema.options
+ ...SanitizedF5BigIpConnectionSchema.options,
+ ...SanitizedConvexConnectionSchema.options
]);
const AppConnectionOptionsSchema = z.discriminatedUnion("app", [
@@ -350,7 +355,8 @@ const AppConnectionOptionsSchema = z.discriminatedUnion("app", [
SalesforceConnectionListItemSchema,
SnowflakeConnectionListItemSchema,
DatadogConnectionListItemSchema,
- F5BigIpConnectionListItemSchema
+ F5BigIpConnectionListItemSchema,
+ ConvexConnectionListItemSchema
]);
export const registerAppConnectionRouter = async (server: FastifyZodProvider) => {
diff --git a/backend/src/server/routes/v1/app-connection-routers/convex-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/convex-connection-router.ts
new file mode 100644
index 0000000000..9568cae17a
--- /dev/null
+++ b/backend/src/server/routes/v1/app-connection-routers/convex-connection-router.ts
@@ -0,0 +1,18 @@
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+import {
+ CreateConvexConnectionSchema,
+ SanitizedConvexConnectionSchema,
+ UpdateConvexConnectionSchema
+} from "@app/services/app-connection/convex";
+
+import { registerAppConnectionEndpoints } from "./app-connection-endpoints";
+
+export const registerConvexConnectionRouter = async (server: FastifyZodProvider) => {
+ registerAppConnectionEndpoints({
+ app: AppConnection.Convex,
+ server,
+ sanitizedResponseSchema: SanitizedConvexConnectionSchema,
+ createSchema: CreateConvexConnectionSchema,
+ updateSchema: UpdateConvexConnectionSchema
+ });
+};
diff --git a/backend/src/server/routes/v1/app-connection-routers/index.ts b/backend/src/server/routes/v1/app-connection-routers/index.ts
index 75ae8e7bf5..76c7bba9ac 100644
--- a/backend/src/server/routes/v1/app-connection-routers/index.ts
+++ b/backend/src/server/routes/v1/app-connection-routers/index.ts
@@ -19,6 +19,7 @@ import { registerCamundaConnectionRouter } from "./camunda-connection-router";
import { registerChecklyConnectionRouter } from "./checkly-connection-router";
import { registerCircleCIConnectionRouter } from "./circleci-connection-router";
import { registerCloudflareConnectionRouter } from "./cloudflare-connection-router";
+import { registerConvexConnectionRouter } from "./convex-connection-router";
import { registerDatabricksConnectionRouter } from "./databricks-connection-router";
import { registerDatadogConnectionRouter } from "./datadog-connection-router";
import { registerDbtConnectionRouter } from "./dbt-connection-router";
@@ -140,5 +141,6 @@ export const APP_CONNECTION_REGISTER_ROUTER_MAP: Record<AppConnection, (server:
[AppConnection.Salesforce]: registerSalesforceConnectionRouter,
[AppConnection.Snowflake]: registerSnowflakeConnectionRouter,
[AppConnection.Datadog]: registerDatadogConnectionRouter,
- [AppConnection.F5BigIp]: registerF5BigIpConnectionRouter
+ [AppConnection.F5BigIp]: registerF5BigIpConnectionRouter,
+ [AppConnection.Convex]: registerConvexConnectionRouter
};
diff --git a/backend/src/services/app-connection/app-connection-enums.ts b/backend/src/services/app-connection/app-connection-enums.ts
index 7b7bb0f3d1..1f33dac404 100644
--- a/backend/src/services/app-connection/app-connection-enums.ts
+++ b/backend/src/services/app-connection/app-connection-enums.ts
@@ -66,7 +66,8 @@ export enum AppConnection {
Snowflake = "snowflake",
Datadog = "datadog",
F5BigIp = "f5-big-ip",
- GoDaddy = "godaddy"
+ GoDaddy = "godaddy",
+ Convex = "convex"
}
export enum AWSRegion {
diff --git a/backend/src/services/app-connection/app-connection-fns.ts b/backend/src/services/app-connection/app-connection-fns.ts
index 7ecd7d518c..aa0bc80cb9 100644
--- a/backend/src/services/app-connection/app-connection-fns.ts
+++ b/backend/src/services/app-connection/app-connection-fns.ts
@@ -102,6 +102,7 @@ import {
getCloudflareConnectionListItem,
validateCloudflareConnectionCredentials
} from "./cloudflare/cloudflare-connection-fns";
+import { ConvexConnectionMethod, getConvexConnectionListItem, validateConvexConnectionCredentials } from "./convex";
import { AppConnectionCredentialRotationStatus } from "./credential-rotation";
import { decryptRotationMessage } from "./credential-rotation/app-connection-credential-rotation-fns";
import { DatabricksConnectionMethod } from "./databricks";
@@ -347,7 +348,8 @@ export const listAppConnectionOptions = (projectType?: ProjectType) => {
getSalesforceConnectionListItem(),
getSnowflakeConnectionListItem(),
getDatadogConnectionListItem(),
- getF5BigIpConnectionListItem()
+ getF5BigIpConnectionListItem(),
+ getConvexConnectionListItem()
]
.filter((option) => {
switch (projectType) {
@@ -576,7 +578,8 @@ export const validateAppConnectionCredentials = async (
[AppConnection.GoDaddy]: validateGoDaddyConnectionCredentials as TAppConnectionCredentialsValidator,
[AppConnection.Snowflake]: validateSnowflakeConnectionCredentials as TAppConnectionCredentialsValidator,
[AppConnection.Datadog]: validateDatadogConnectionCredentials as TAppConnectionCredentialsValidator,
- [AppConnection.F5BigIp]: validateF5BigIpConnectionCredentials as TAppConnectionCredentialsValidator
+ [AppConnection.F5BigIp]: validateF5BigIpConnectionCredentials as TAppConnectionCredentialsValidator,
+ [AppConnection.Convex]: validateConvexConnectionCredentials as TAppConnectionCredentialsValidator
};
return VALIDATE_APP_CONNECTION_CREDENTIALS_MAP[appConnection.app](appConnection, gatewayService, gatewayV2Service);
@@ -589,6 +592,7 @@ export const getAppConnectionMethodName = (method: TAppConnection["method"]) =>
return "GitHub App";
case GitHubConnectionMethod.Pat:
case OnaConnectionMethod.PersonalAccessToken:
+ case ConvexConnectionMethod.PersonalAccessToken:
return "Personal Access Token";
case AzureKeyVaultConnectionMethod.OAuth:
case AzureAppConfigurationConnectionMethod.OAuth:
@@ -815,7 +819,8 @@ export const TRANSITION_CONNECTION_CREDENTIALS_TO_PLATFORM: Record<
[AppConnection.Snowflake]: platformManagedCredentialsNotSupported,
[AppConnection.Datadog]: platformManagedCredentialsNotSupported,
[AppConnection.F5BigIp]: platformManagedCredentialsNotSupported,
- [AppConnection.GoDaddy]: platformManagedCredentialsNotSupported
+ [AppConnection.GoDaddy]: platformManagedCredentialsNotSupported,
+ [AppConnection.Convex]: platformManagedCredentialsNotSupported
};
export const enterpriseAppCheck = async (
diff --git a/backend/src/services/app-connection/app-connection-maps.ts b/backend/src/services/app-connection/app-connection-maps.ts
index 3ef994a4c9..f06453e529 100644
--- a/backend/src/services/app-connection/app-connection-maps.ts
+++ b/backend/src/services/app-connection/app-connection-maps.ts
@@ -68,7 +68,8 @@ export const APP_CONNECTION_NAME_MAP: Record<AppConnection, string> = {
[AppConnection.Snowflake]: "Snowflake",
[AppConnection.Datadog]: "Datadog",
[AppConnection.F5BigIp]: "F5 BIG-IP",
- [AppConnection.GoDaddy]: "GoDaddy"
+ [AppConnection.GoDaddy]: "GoDaddy",
+ [AppConnection.Convex]: "Convex"
};
export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanType> = {
@@ -139,5 +140,6 @@ export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanTyp
[AppConnection.Snowflake]: AppConnectionPlanType.Regular,
[AppConnection.Datadog]: AppConnectionPlanType.Regular,
[AppConnection.F5BigIp]: AppConnectionPlanType.Regular,
- [AppConnection.GoDaddy]: AppConnectionPlanType.Regular
+ [AppConnection.GoDaddy]: AppConnectionPlanType.Regular,
+ [AppConnection.Convex]: AppConnectionPlanType.Regular
};
diff --git a/backend/src/services/app-connection/app-connection-service.ts b/backend/src/services/app-connection/app-connection-service.ts
index a4d73ad2f7..6b1c35c7b5 100644
--- a/backend/src/services/app-connection/app-connection-service.ts
+++ b/backend/src/services/app-connection/app-connection-service.ts
@@ -44,6 +44,7 @@ import { TProjectDALFactory } from "@app/services/project/project-dal";
import { ValidateOnePassConnectionCredentialsSchema } from "./1password";
import { onePassConnectionService } from "./1password/1password-connection-service";
import { ValidateAnthropicConnectionCredentialsSchema } from "./anthropic";
+import { ValidateConvexConnectionCredentialsSchema } from "./convex";
import { TAppConnectionDALFactory } from "./app-connection-dal";
import { AppConnection } from "./app-connection-enums";
import { APP_CONNECTION_NAME_MAP } from "./app-connection-maps";
@@ -256,7 +257,8 @@ const VALIDATE_APP_CONNECTION_CREDENTIALS_MAP: Record<AppConnection, TValidateAp
[AppConnection.Salesforce]: ValidateSalesforceConnectionCredentialsSchema,
[AppConnection.Snowflake]: ValidateSnowflakeConnectionCredentialsSchema,
[AppConnection.Datadog]: ValidateDatadogConnectionCredentialsSchema,
- [AppConnection.F5BigIp]: ValidateF5BigIpConnectionCredentialsSchema
+ [AppConnection.F5BigIp]: ValidateF5BigIpConnectionCredentialsSchema,
+ [AppConnection.Convex]: ValidateConvexConnectionCredentialsSchema
};
export const appConnectionServiceFactory = ({
diff --git a/backend/src/services/app-connection/app-connection-types.ts b/backend/src/services/app-connection/app-connection-types.ts
index f4f0cad763..5206a1cfbe 100644
--- a/backend/src/services/app-connection/app-connection-types.ts
+++ b/backend/src/services/app-connection/app-connection-types.ts
@@ -118,6 +118,12 @@ import {
TCloudflareConnectionInput,
TValidateCloudflareConnectionCredentialsSchema
} from "./cloudflare/cloudflare-connection-types";
+import {
+ TConvexConnection,
+ TConvexConnectionConfig,
+ TConvexConnectionInput,
+ TValidateConvexConnectionCredentialsSchema
+} from "./convex";
import {
TDatabricksConnection,
TDatabricksConnectionConfig,
@@ -472,7 +478,8 @@ export type TAppConnection = { id: string; configuration?: TAppConnectionConfigu
| TSalesforceConnection
| TSnowflakeConnection
| TDatadogConnection
- | TF5BigIpConnection
+ | TF5BigIpConnection,
+ | TConvexConnection
);
export type TAppConnectionRaw = NonNullable<Awaited<ReturnType<TAppConnectionDALFactory["findById"]>>>;
@@ -551,7 +558,8 @@ export type TAppConnectionInput = { id: string } & (
| TSalesforceConnectionInput
| TSnowflakeConnectionInput
| TDatadogConnectionInput
- | TF5BigIpConnectionInput
+ | TF5BigIpConnectionInput,
+ | TConvexConnectionInput
);
export type TSqlConnectionInput =
@@ -662,7 +670,8 @@ export type TAppConnectionConfig =
| TSalesforceConnectionConfig
| TSnowflakeConnectionConfig
| TDatadogConnectionConfig
- | TF5BigIpConnectionConfig;
+ | TF5BigIpConnectionConfig;,
+ | TConvexConnectionConfig;
export type TValidateAppConnectionCredentialsSchema =
| TValidateAwsConnectionCredentialsSchema
@@ -732,7 +741,8 @@ export type TValidateAppConnectionCredentialsSchema =
| TValidateSalesforceConnectionCredentialsSchema
| TValidateSnowflakeConnectionCredentialsSchema
| TValidateDatadogConnectionCredentialsSchema
- | TValidateF5BigIpConnectionCredentialsSchema;
+ | TValidateF5BigIpConnectionCredentialsSchema;,
+ | TValidateConvexConnectionCredentialsSchema;
export type TListAwsConnectionKmsKeys = {
connectionId: string;
diff --git a/backend/src/services/app-connection/convex/convex-connection-enums.ts b/backend/src/services/app-connection/convex/convex-connection-enums.ts
new file mode 100644
index 0000000000..a3e612dc39
--- /dev/null
+++ b/backend/src/services/app-connection/convex/convex-connection-enums.ts
@@ -0,0 +1,3 @@
+export enum ConvexConnectionMethod {
+ PersonalAccessToken = "personal-access-token"
+}
diff --git a/backend/src/services/app-connection/convex/convex-connection-fns.ts b/backend/src/services/app-connection/convex/convex-connection-fns.ts
new file mode 100644
index 0000000000..920c29d4b8
--- /dev/null
+++ b/backend/src/services/app-connection/convex/convex-connection-fns.ts
@@ -0,0 +1,39 @@
+import { request } from "@app/lib/config/request";
+import { UnauthorizedError } from "@app/lib/errors";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+
+import { ConvexConnectionMethod } from "./convex-connection-enums";
+import { TConvexConnectionConfig } from "./convex-connection-types";
+import { logger } from "@app/lib/logger";
+
+export const CONVEX_API_BASE_URL = "https://api.convex.dev";
+
+export const getConvexConnectionListItem = () => {
+ return {
+ name: "Convex" as const,
+ app: AppConnection.Convex as const,
+ methods: Object.values(ConvexConnectionMethod) as [ConvexConnectionMethod.PersonalAccessToken]
+ };
+};
+
+export const validateConvexConnectionCredentials = async (config: TConvexConnectionConfig) => {
+ const { accessToken, instanceUrl } = config.credentials;
+ const baseUrl = instanceUrl || CONVEX_API_BASE_URL;
+
+ try {
+ await request.get(`${baseUrl}/v1/list_personal_access_tokens`, {
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ "Content-Type": "application/json"
+ },
+ validateStatus: (status) => status === 200
+ });
+ } catch (e) {
+ logger.error(e, "failed to connect")
+ throw new UnauthorizedError({
+ message: "Unable to validate connection: verify that your access token and instance URL are correct"
+ });
+ }
+
+ return config.credentials;
+};
diff --git a/backend/src/services/app-connection/convex/convex-connection-schemas.ts b/backend/src/services/app-connection/convex/convex-connection-schemas.ts
new file mode 100644
index 0000000000..7691690088
--- /dev/null
+++ b/backend/src/services/app-connection/convex/convex-connection-schemas.ts
@@ -0,0 +1,71 @@
+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 { ConvexConnectionMethod } from "./convex-connection-enums";
+
+export const ConvexConnectionAccessTokenCredentialsSchema = z.object({
+ accessToken: z
+ .string()
+ .trim()
+ .min(1, "Access Token required")
+ .describe(AppConnections.CREDENTIALS.CONVEX.accessToken),
+ instanceUrl: z
+ .string()
+ .trim()
+ .url("Invalid Instance URL")
+ .optional()
+ .describe(AppConnections.CREDENTIALS.CONVEX.instanceUrl)
+});
+
+const BaseConvexConnectionSchema = BaseAppConnectionSchema.extend({ app: z.literal(AppConnection.Convex) });
+
+export const ConvexConnectionSchema = BaseConvexConnectionSchema.extend({
+ method: z.literal(ConvexConnectionMethod.PersonalAccessToken),
+ credentials: ConvexConnectionAccessTokenCredentialsSchema
+});
+
+export const SanitizedConvexConnectionSchema = z.discriminatedUnion("method", [
+ BaseConvexConnectionSchema.extend({
+ method: z.literal(ConvexConnectionMethod.PersonalAccessToken),
+ credentials: ConvexConnectionAccessTokenCredentialsSchema.pick({
+ instanceUrl: true
+ })
+ }).describe(JSON.stringify({ title: `${APP_CONNECTION_NAME_MAP[AppConnection.Convex]} (Personal Access Token)` }))
+]);
+
+export const ValidateConvexConnectionCredentialsSchema = z.discriminatedUnion("method", [
+ z.object({
+ method: z.literal(ConvexConnectionMethod.PersonalAccessToken).describe(AppConnections.CREATE(AppConnection.Convex).method),
+ credentials: ConvexConnectionAccessTokenCredentialsSchema.describe(
+ AppConnections.CREATE(AppConnection.Convex).credentials
+ )
+ })
+]);
+
+export const CreateConvexConnectionSchema = ValidateConvexConnectionCredentialsSchema.and(
+ GenericCreateAppConnectionFieldsSchema(AppConnection.Convex)
+);
+
+export const UpdateConvexConnectionSchema = z
+ .object({
+ credentials: ConvexConnectionAccessTokenCredentialsSchema.optional().describe(
+ AppConnections.UPDATE(AppConnection.Convex).credentials
+ )
+ })
+ .and(GenericUpdateAppConnectionFieldsSchema(AppConnection.Convex));
+
+export const ConvexConnectionListItemSchema = z
+ .object({
+ name: z.literal("Convex"),
+ app: z.literal(AppConnection.Convex),
+ methods: z.nativeEnum(ConvexConnectionMethod).array()
+ })
+ .describe(JSON.stringify({ title: APP_CONNECTION_NAME_MAP[AppConnection.Convex] }));
diff --git a/backend/src/services/app-connection/convex/convex-connection-types.ts b/backend/src/services/app-connection/convex/convex-connection-types.ts
new file mode 100644
index 0000000000..645af44f21
--- /dev/null
+++ b/backend/src/services/app-connection/convex/convex-connection-types.ts
@@ -0,0 +1,22 @@
+import z from "zod";
+
+import { DiscriminativePick } from "@app/lib/types";
+
+import { AppConnection } from "../app-connection-enums";
+import {
+ ConvexConnectionSchema,
+ CreateConvexConnectionSchema,
+ ValidateConvexConnectionCredentialsSchema
+} from "./convex-connection-schemas";
+
+export type TConvexConnection = z.infer<typeof ConvexConnectionSchema>;
+
+export type TConvexConnectionInput = z.infer<typeof CreateConvexConnectionSchema> & {
+ app: AppConnection.Convex;
+};
+
+export type TValidateConvexConnectionCredentialsSchema = typeof ValidateConvexConnectionCredentialsSchema;
+
+export type TConvexConnectionConfig = DiscriminativePick<TConvexConnectionInput, "method" | "app" | "credentials"> & {
+ orgId: string;
+};
diff --git a/backend/src/services/app-connection/convex/index.ts b/backend/src/services/app-connection/convex/index.ts
new file mode 100644
index 0000000000..5d9e5df0d5
--- /dev/null
+++ b/backend/src/services/app-connection/convex/index.ts
@@ -0,0 +1,4 @@
+export * from "./convex-connection-enums";
+export * from "./convex-connection-fns";
+export * from "./convex-connection-schemas";
+export * from "./convex-connection-types";
diff --git a/frontend/public/images/integrations/Convex.png b/frontend/public/images/integrations/Convex.png
new file mode 100644
index 0000000000..7a439d80f4
Binary files /dev/null and b/frontend/public/images/integrations/Convex.png differ
diff --git a/frontend/src/helpers/appConnections.ts b/frontend/src/helpers/appConnections.ts
index 2a94127c00..6374126ef6 100644
--- a/frontend/src/helpers/appConnections.ts
+++ b/frontend/src/helpers/appConnections.ts
@@ -56,6 +56,7 @@ import { BitbucketConnectionMethod } from "@app/hooks/api/appConnections/types/b
import { ChecklyConnectionMethod } from "@app/hooks/api/appConnections/types/checkly-connection";
import { ChefConnectionMethod } from "@app/hooks/api/appConnections/types/chef-connection";
import { CircleCIConnectionMethod } from "@app/hooks/api/appConnections/types/circleci-connection";
+import { ConvexConnectionMethod } from "@app/hooks/api/appConnections/types/convex-connection";
import { DatadogConnectionMethod } from "@app/hooks/api/appConnections/types/datadog-connection";
import { DigiCertConnectionMethod } from "@app/hooks/api/appConnections/types/digicert-connection";
import { DigitalOceanConnectionMethod } from "@app/hooks/api/appConnections/types/digital-ocean";
@@ -185,7 +186,8 @@ export const APP_CONNECTION_MAP: Record<
[AppConnection.Salesforce]: { name: "Salesforce", image: "Salesforce.png" },
[AppConnection.Snowflake]: { name: "Snowflake", image: "Snowflake.png" },
[AppConnection.Datadog]: { name: "Datadog", image: "DatadogWhite.png" },
- [AppConnection.F5BigIp]: { name: "F5 BIG-IP", image: "F5 BIG-IP.png" }
+ [AppConnection.F5BigIp]: { name: "F5 BIG-IP", image: "F5 BIG-IP.png" },
+ [AppConnection.Convex]: { name: "Convex", image: "Convex.png" }
};
export const getAppConnectionMethodDetails = (method: TAppConnection["method"]) => {
@@ -250,7 +252,8 @@ export const getAppConnectionMethodDetails = (method: TAppConnection["method"])
case WindmillConnectionMethod.AccessToken:
case FlyioConnectionMethod.AccessToken:
case NetlifyConnectionMethod.AccessToken:
- return { name: "Access Token", icon: faKey };
+ case ConvexConnectionMethod.PersonalAccessToken:
+ return { name: "Personal Access Token", icon: faKey };
case Auth0ConnectionMethod.ClientCredentials:
case SalesforceConnectionMethod.ClientCredentials:
return { name: "Client Credentials", icon: faServer };
diff --git a/frontend/src/hooks/api/appConnections/enums.ts b/frontend/src/hooks/api/appConnections/enums.ts
index 8e5983c2a4..54c7ee0fe5 100644
--- a/frontend/src/hooks/api/appConnections/enums.ts
+++ b/frontend/src/hooks/api/appConnections/enums.ts
@@ -66,5 +66,6 @@ export enum AppConnection {
Snowflake = "snowflake",
Datadog = "datadog",
F5BigIp = "f5-big-ip",
- GoDaddy = "godaddy"
+ GoDaddy = "godaddy",
+ Convex = "convex"
}
diff --git a/frontend/src/hooks/api/appConnections/types/app-options.ts b/frontend/src/hooks/api/appConnections/types/app-options.ts
index 76a7480178..ea8ac77adb 100644
--- a/frontend/src/hooks/api/appConnections/types/app-options.ts
+++ b/frontend/src/hooks/api/appConnections/types/app-options.ts
@@ -283,7 +283,9 @@ export type TDatadogConnectionOption = TAppConnectionOptionBase & {
};
export type TF5BigIpConnectionOption = TAppConnectionOptionBase & {
- app: AppConnection.F5BigIp;
+ app: AppConnection.F5BigIp;,
+export type TConvexConnectionOption = TAppConnectionOptionBase & {
+ app: AppConnection.Convex;
};
export type TAppConnectionOption =
@@ -354,7 +356,8 @@ export type TAppConnectionOption =
| TSalesforceConnectionOption
| TSnowflakeConnectionOption
| TDatadogConnectionOption
- | TF5BigIpConnectionOption;
+ | TF5BigIpConnectionOption;,
+ | TConvexConnectionOption;
export type TAppConnectionOptionMap = {
[AppConnection.AWS]: TAwsConnectionOption;
@@ -424,5 +427,6 @@ export type TAppConnectionOptionMap = {
[AppConnection.Salesforce]: TSalesforceConnectionOption;
[AppConnection.Snowflake]: TSnowflakeConnectionOption;
[AppConnection.Datadog]: TDatadogConnectionOption;
- [AppConnection.F5BigIp]: TF5BigIpConnectionOption;
+ [AppConnection.F5BigIp]: TF5BigIpConnectionOption;,
+ [AppConnection.Convex]: TConvexConnectionOption;
};
diff --git a/frontend/src/hooks/api/appConnections/types/convex-connection.ts b/frontend/src/hooks/api/appConnections/types/convex-connection.ts
new file mode 100644
index 0000000000..cee356a90b
--- /dev/null
+++ b/frontend/src/hooks/api/appConnections/types/convex-connection.ts
@@ -0,0 +1,14 @@
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+import { TRootAppConnection } from "@app/hooks/api/appConnections/types/root-connection";
+
+export enum ConvexConnectionMethod {
+ PersonalAccessToken = "personal-access-token"
+}
+
+export type TConvexConnection = TRootAppConnection & { app: AppConnection.Convex } & {
+ method: ConvexConnectionMethod.PersonalAccessToken;
+ credentials: {
+ accessToken: string;
+ instanceUrl?: string;
+ };
+};
diff --git a/frontend/src/hooks/api/appConnections/types/index.ts b/frontend/src/hooks/api/appConnections/types/index.ts
index cb2dc7b31b..92fc422055 100644
--- a/frontend/src/hooks/api/appConnections/types/index.ts
+++ b/frontend/src/hooks/api/appConnections/types/index.ts
@@ -17,6 +17,7 @@ import { TChecklyConnection } from "./checkly-connection";
import { TChefConnection } from "./chef-connection";
import { TCircleCIConnection } from "./circleci-connection";
import { TCloudflareConnection } from "./cloudflare-connection";
+import { TConvexConnection } from "./convex-connection";
import { TDatabricksConnection } from "./databricks-connection";
import { TDatadogConnection } from "./datadog-connection";
import { TDbtConnection } from "./dbt-connection";
@@ -85,6 +86,7 @@ export * from "./checkly-connection";
export * from "./chef-connection";
export * from "./circleci-connection";
export * from "./cloudflare-connection";
+export * from "./convex-connection";
export * from "./databricks-connection";
export * from "./datadog-connection";
export * from "./dbt-connection";
@@ -203,7 +205,8 @@ export type TAppConnection =
| TSalesforceConnection
| TSnowflakeConnection
| TDatadogConnection
- | TF5BigIpConnection;
+ | TF5BigIpConnection;,
+ | TConvexConnection;
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.tsx
index 489218ea6f..49ab94e6c8 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
@@ -31,6 +31,7 @@ import { ChecklyConnectionForm } from "./ChecklyConnectionForm";
import { ChefConnectionForm } from "./ChefConnectionForm";
import { CircleCIConnectionForm } from "./CircleCIConnectionForm";
import { CloudflareConnectionForm } from "./CloudflareConnectionForm";
+import { ConvexConnectionForm } from "./ConvexConnectionForm";
import { DatabricksConnectionForm } from "./DatabricksConnectionForm";
import { DatadogConnectionForm } from "./DatadogConnectionForm";
import { DbtConnectionForm } from "./DbtConnectionForm";
@@ -312,7 +313,9 @@ const CreateForm = ({ app, onComplete, projectId }: CreateFormProps) => {
case AppConnection.Datadog:
return <DatadogConnectionForm onSubmit={onSubmit} />;
case AppConnection.F5BigIp:
- return <F5BigIpConnectionForm onSubmit={onSubmit} />;
+ return <F5BigIpConnectionForm onSubmit={onSubmit} />;,
+ case AppConnection.Convex:
+ return <ConvexConnectionForm onSubmit={onSubmit} />;
default:
throw new Error(`Unhandled App ${app}`);
}
@@ -545,7 +548,9 @@ const UpdateForm = ({ appConnection, onComplete }: UpdateFormProps) => {
case AppConnection.Datadog:
return <DatadogConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
case AppConnection.F5BigIp:
- return <F5BigIpConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
+ return <F5BigIpConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;,
+ case AppConnection.Convex:
+ return <ConvexConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
case AppConnection.Venafi:
return <VenafiConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
case AppConnection.VenafiTpp:
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/ConvexConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/ConvexConnectionForm.tsx
new file mode 100644
index 0000000000..d80a7883a2
--- /dev/null
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/ConvexConnectionForm.tsx
@@ -0,0 +1,158 @@
+import { Controller, FormProvider, useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { z } from "zod";
+
+import {
+ Button,
+ FormControl,
+ Input,
+ ModalClose,
+ SecretInput,
+ Select,
+ SelectItem
+} from "@app/components/v2";
+import { APP_CONNECTION_MAP, getAppConnectionMethodDetails } from "@app/helpers/appConnections";
+import { ConvexConnectionMethod, TConvexConnection } from "@app/hooks/api/appConnections";
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+
+import {
+ genericAppConnectionFieldsSchema,
+ GenericAppConnectionsFields
+} from "./GenericAppConnectionFields";
+
+type Props = {
+ appConnection?: TConvexConnection;
+ onSubmit: (formData: FormData) => void;
+};
+
+const rootSchema = genericAppConnectionFieldsSchema.extend({
+ app: z.literal(AppConnection.Convex)
+});
+
+const formSchema = z.discriminatedUnion("method", [
+ rootSchema.extend({
+ method: z.literal(ConvexConnectionMethod.PersonalAccessToken),
+ credentials: z.object({
+ accessToken: z.string().trim().min(1, "Access Token required"),
+ instanceUrl: z
+ .string()
+ .trim()
+ .transform((value) => value || undefined)
+ .refine((value) => (!value ? true : z.string().url().safeParse(value).success), {
+ message: "Invalid instance URL"
+ })
+ .optional()
+ })
+ })
+]);
+
+type FormData = z.infer<typeof formSchema>;
+
+export const ConvexConnectionForm = ({ appConnection, onSubmit }: Props) => {
+ const isUpdate = Boolean(appConnection);
+
+ const form = useForm<FormData>({
+ resolver: zodResolver(formSchema),
+ defaultValues: appConnection ?? {
+ app: AppConnection.Convex,
+ method: ConvexConnectionMethod.PersonalAccessToken
+ }
+ });
+
+ const {
+ handleSubmit,
+ control,
+ formState: { isSubmitting, isDirty }
+ } = form;
+
+ return (
+ <FormProvider {...form}>
+ <form onSubmit={handleSubmit(onSubmit)}>
+ {!isUpdate && <GenericAppConnectionsFields />}
+ <Controller
+ name="method"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ tooltipText={`The method you would like to use to connect with ${
+ APP_CONNECTION_MAP[AppConnection.Convex].name
+ }. This field cannot be changed after creation.`}
+ errorText={error?.message}
+ isError={Boolean(error?.message)}
+ label="Method"
+ >
+ <Select
+ isDisabled={isUpdate}
+ value={value}
+ onValueChange={(val) => onChange(val)}
+ className="w-full border border-mineshaft-500"
+ position="popper"
+ dropdownContainerClassName="max-w-none"
+ >
+ {Object.values(ConvexConnectionMethod).map((method) => {
+ return (
+ <SelectItem value={method} key={method}>
+ {getAppConnectionMethodDetails(method).name}{" "}
+ </SelectItem>
+ );
+ })}
+ </Select>
+ </FormControl>
+ )}
+ />
+ <Controller
+ name="credentials.accessToken"
+ control={control}
+ shouldUnregister
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ errorText={error?.message}
+ isError={Boolean(error?.message)}
+ label="Access Token"
+ >
+ <SecretInput
+ containerClassName="text-gray-400 group-focus-within:border-primary-400/50! border border-mineshaft-500 bg-mineshaft-900 px-2.5 py-1.5"
+ value={value}
+ onChange={(e) => onChange(e.target.value)}
+ />
+ </FormControl>
+ )}
+ />
+ <Controller
+ name="credentials.instanceUrl"
+ control={control}
+ shouldUnregister
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ errorText={error?.message}
+ isError={Boolean(error?.message)}
+ label="Instance URL"
+ isOptional
+ tooltipClassName="max-w-sm"
+ tooltipText="Will default to https://api.convex.dev if not specified."
+ >
+ <Input {...field} placeholder="https://api.convex.dev" />
+ </FormControl>
+ )}
+ />
+ <div className="mt-8 flex items-center">
+ <Button
+ className="mr-4"
+ size="sm"
+ type="submit"
+ colorSchema="secondary"
+ isLoading={isSubmitting}
+ isDisabled={isSubmitting || !isDirty}
+ >
+ {isUpdate ? "Update Credentials" : "Connect to Convex"}
+ </Button>
+ <ModalClose asChild>
+ <Button colorSchema="secondary" variant="plain">
+ Cancel
+ </Button>
+ </ModalClose>
+ </div>
+ </form>
+ </FormProvider>
+ );
+};