Skip to content

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

Merge branch 'main' into feat/vercelSecretSyncIntegration

carlosmonastyrski6dc085b970fd
diff --cc backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts
index 0052bb1e51,2cb5d6db9d..adfce8c860
--- 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
@@@ -22,7 -22,11 +22,12 @@@ import
HumanitecConnectionListItemSchema,
SanitizedHumanitecConnectionSchema
} from "@app/services/app-connection/humanitec";
+ import { MsSqlConnectionListItemSchema, SanitizedMsSqlConnectionSchema } from "@app/services/app-connection/mssql";
+ import {
+ PostgresConnectionListItemSchema,
+ SanitizedPostgresConnectionSchema
+ } from "@app/services/app-connection/postgres";
+import { SanitizedVercelConnectionSchema, VercelConnectionListItemSchema } from "@app/services/app-connection/vercel";
import { AuthMode } from "@app/services/auth/auth-type";
// can't use discriminated due to multiple schemas for certain apps
@@@ -34,7 -38,8 +39,9 @@@ const SanitizedAppConnectionSchema = z.
...SanitizedAzureAppConfigurationConnectionSchema.options,
...SanitizedDatabricksConnectionSchema.options,
...SanitizedHumanitecConnectionSchema.options,
- ...SanitizedVercelConnectionSchema.options
++ ...SanitizedVercelConnectionSchema.options,
+ ...SanitizedPostgresConnectionSchema.options,
+ ...SanitizedMsSqlConnectionSchema.options
]);
const AppConnectionOptionsSchema = z.discriminatedUnion("app", [
@@@ -45,7 -50,8 +52,9 @@@
AzureAppConfigurationConnectionListItemSchema,
DatabricksConnectionListItemSchema,
HumanitecConnectionListItemSchema,
- VercelConnectionListItemSchema
++ VercelConnectionListItemSchema,
+ PostgresConnectionListItemSchema,
+ MsSqlConnectionListItemSchema
]);
export const registerAppConnectionRouter = async (server: FastifyZodProvider) => {
diff --cc backend/src/server/routes/v1/app-connection-routers/index.ts
index e0d7325cab,906ffaee9b..fe9fbe5e3f
--- a/backend/src/server/routes/v1/app-connection-routers/index.ts
+++ b/backend/src/server/routes/v1/app-connection-routers/index.ts
@@@ -7,7 -7,8 +7,9 @@@ import { registerDatabricksConnectionRo
import { registerGcpConnectionRouter } from "./gcp-connection-router";
import { registerGitHubConnectionRouter } from "./github-connection-router";
import { registerHumanitecConnectionRouter } from "./humanitec-connection-router";
+ import { registerMsSqlConnectionRouter } from "./mssql-connection-router";
+ import { registerPostgresConnectionRouter } from "./postgres-connection-router";
+import { registerVercelConnectionRouter } from "./vercel-connection-router";
export * from "./app-connection-router";
@@@ -20,5 -21,6 +22,7 @@@ export const APP_CONNECTION_REGISTER_RO
[AppConnection.AzureAppConfiguration]: registerAzureAppConfigurationConnectionRouter,
[AppConnection.Databricks]: registerDatabricksConnectionRouter,
[AppConnection.Humanitec]: registerHumanitecConnectionRouter,
- [AppConnection.Vercel]: registerVercelConnectionRouter
++ [AppConnection.Vercel]: registerVercelConnectionRouter,
+ [AppConnection.Postgres]: registerPostgresConnectionRouter,
+ [AppConnection.MsSql]: registerMsSqlConnectionRouter
};
diff --cc backend/src/services/app-connection/app-connection-enums.ts
index cd8f2be698,f5f921c4ee..b5bd9eaa26
--- a/backend/src/services/app-connection/app-connection-enums.ts
+++ b/backend/src/services/app-connection/app-connection-enums.ts
@@@ -6,7 -6,8 +6,9 @@@ export enum AppConnection
AzureKeyVault = "azure-key-vault",
AzureAppConfiguration = "azure-app-configuration",
Humanitec = "humanitec",
- Vercel = "vercel"
++ Vercel = "vercel",
+ Postgres = "postgres",
+ MsSql = "mssql"
}
export enum AWSRegion {
diff --cc backend/src/services/app-connection/app-connection-fns.ts
index 4effa836f1,b2d45e71fc..ddba0662db
--- a/backend/src/services/app-connection/app-connection-fns.ts
+++ b/backend/src/services/app-connection/app-connection-fns.ts
@@@ -40,8 -39,8 +39,10 @@@ import
HumanitecConnectionMethod,
validateHumanitecConnectionCredentials
} from "./humanitec";
+ import { getMsSqlConnectionListItem, MsSqlConnectionMethod } from "./mssql";
+ import { getPostgresConnectionListItem, PostgresConnectionMethod } from "./postgres";
+import { VercelConnectionMethod } from "./vercel";
+import { getVercelConnectionListItem, validateVercelConnectionCredentials } from "./vercel/vercel-connection-fns";
export const listAppConnectionOptions = () => {
return [
@@@ -52,7 -51,8 +53,9 @@@
getAzureAppConfigurationConnectionListItem(),
getDatabricksConnectionListItem(),
getHumanitecConnectionListItem(),
- getVercelConnectionListItem()
++ getVercelConnectionListItem(),
+ getPostgresConnectionListItem(),
+ getMsSqlConnectionListItem()
].sort((a, b) => a.name.localeCompare(b.name));
};
@@@ -98,32 -98,22 +101,23 @@@ export const decryptAppConnectionCreden
return JSON.parse(decryptedPlainTextBlob.toString()) as TAppConnection["credentials"];
};
+ const VALIDATE_APP_CONNECTION_CREDENTIALS_MAP: Record<AppConnection, TAppConnectionCredentialsValidator> = {
+ [AppConnection.AWS]: validateAwsConnectionCredentials as TAppConnectionCredentialsValidator,
+ [AppConnection.Databricks]: validateDatabricksConnectionCredentials as TAppConnectionCredentialsValidator,
+ [AppConnection.GitHub]: validateGitHubConnectionCredentials as TAppConnectionCredentialsValidator,
+ [AppConnection.GCP]: validateGcpConnectionCredentials as TAppConnectionCredentialsValidator,
+ [AppConnection.AzureKeyVault]: validateAzureKeyVaultConnectionCredentials as TAppConnectionCredentialsValidator,
+ [AppConnection.AzureAppConfiguration]:
+ validateAzureAppConfigurationConnectionCredentials as TAppConnectionCredentialsValidator,
+ [AppConnection.Humanitec]: validateHumanitecConnectionCredentials as TAppConnectionCredentialsValidator,
+ [AppConnection.Postgres]: validateSqlConnectionCredentials as TAppConnectionCredentialsValidator,
- [AppConnection.MsSql]: validateSqlConnectionCredentials as TAppConnectionCredentialsValidator
++ [AppConnection.MsSql]: validateSqlConnectionCredentials as TAppConnectionCredentialsValidator,
++ [AppConnection.Vercel]: validateVercelConnectionCredentials as TAppConnectionCredentialsValidator
+ };
+
export const validateAppConnectionCredentials = async (
appConnection: TAppConnectionConfig
- ): Promise<TAppConnection["credentials"]> => {
- const { app } = appConnection;
- switch (app) {
- case AppConnection.AWS:
- return validateAwsConnectionCredentials(appConnection);
- case AppConnection.Databricks:
- return validateDatabricksConnectionCredentials(appConnection);
- case AppConnection.GitHub:
- return validateGitHubConnectionCredentials(appConnection);
- case AppConnection.GCP:
- return validateGcpConnectionCredentials(appConnection);
- case AppConnection.AzureKeyVault:
- return validateAzureKeyVaultConnectionCredentials(appConnection);
- case AppConnection.AzureAppConfiguration:
- return validateAzureAppConfigurationConnectionCredentials(appConnection);
- case AppConnection.Humanitec:
- return validateHumanitecConnectionCredentials(appConnection);
- case AppConnection.Vercel:
- return validateVercelConnectionCredentials(appConnection);
- default:
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
- throw new Error(`Unhandled App Connection ${app}`);
- }
- };
+ ): Promise<TAppConnection["credentials"]> => VALIDATE_APP_CONNECTION_CREDENTIALS_MAP[appConnection.app](appConnection);
export const getAppConnectionMethodName = (method: TAppConnection["method"]) => {
switch (method) {
@@@ -141,10 -131,11 +135,13 @@@
return "Service Account Impersonation";
case DatabricksConnectionMethod.ServicePrincipal:
return "Service Principal";
- case HumanitecConnectionMethod.API_TOKEN:
+ case HumanitecConnectionMethod.ApiToken:
return "API Token";
- case VercelConnectionMethod.API_TOKEN:
++ case VercelConnectionMethod.ApiToken:
+ return "API Token";
+ case PostgresConnectionMethod.UsernameAndPassword:
+ case MsSqlConnectionMethod.UsernameAndPassword:
+ return "Username & Password";
default:
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
throw new Error(`Unhandled App Connection Method: ${method}`);
@@@ -165,3 -156,24 +162,25 @@@ export const decryptAppConnection = asy
credentialsHash: generateHash(appConnection.encryptedCredentials)
} as TAppConnection;
};
+
+ const platformManagedCredentialsNotSupported: TAppConnectionTransitionCredentialsToPlatform = ({ app }) => {
+ throw new BadRequestError({
+ message: `${APP_CONNECTION_NAME_MAP[app]} Connections do not support platform managed credentials.`
+ });
+ };
+
+ export const TRANSITION_CONNECTION_CREDENTIALS_TO_PLATFORM: Record<
+ AppConnection,
+ TAppConnectionTransitionCredentialsToPlatform
+ > = {
+ [AppConnection.AWS]: platformManagedCredentialsNotSupported,
+ [AppConnection.Databricks]: platformManagedCredentialsNotSupported,
+ [AppConnection.GitHub]: platformManagedCredentialsNotSupported,
+ [AppConnection.GCP]: platformManagedCredentialsNotSupported,
+ [AppConnection.AzureKeyVault]: platformManagedCredentialsNotSupported,
+ [AppConnection.AzureAppConfiguration]: platformManagedCredentialsNotSupported,
+ [AppConnection.Humanitec]: platformManagedCredentialsNotSupported,
+ [AppConnection.Postgres]: transferSqlConnectionCredentialsToPlatform as TAppConnectionTransitionCredentialsToPlatform,
- [AppConnection.MsSql]: transferSqlConnectionCredentialsToPlatform as TAppConnectionTransitionCredentialsToPlatform
++ [AppConnection.MsSql]: transferSqlConnectionCredentialsToPlatform as TAppConnectionTransitionCredentialsToPlatform,
++ [AppConnection.Vercel]: platformManagedCredentialsNotSupported
+ };
diff --cc backend/src/services/app-connection/app-connection-maps.ts
index cc0f31b4bc,eb28070d58..a39b3d1eb9
--- a/backend/src/services/app-connection/app-connection-maps.ts
+++ b/backend/src/services/app-connection/app-connection-maps.ts
@@@ -8,5 -8,6 +8,7 @@@ export const APP_CONNECTION_NAME_MAP: R
[AppConnection.AzureAppConfiguration]: "Azure App Configuration",
[AppConnection.Databricks]: "Databricks",
[AppConnection.Humanitec]: "Humanitec",
- [AppConnection.Vercel]: "Vercel"
++ [AppConnection.Vercel]: "Vercel",
+ [AppConnection.Postgres]: "PostgreSQL",
+ [AppConnection.MsSql]: "Microsoft SQL Server"
};
diff --cc backend/src/services/app-connection/app-connection-service.ts
index 0d940d0f98,978f3bfd7f..1803d71270
--- a/backend/src/services/app-connection/app-connection-service.ts
+++ b/backend/src/services/app-connection/app-connection-service.ts
@@@ -37,8 -39,8 +39,10 @@@ import { ValidateGitHubConnectionCreden
import { githubConnectionService } from "./github/github-connection-service";
import { ValidateHumanitecConnectionCredentialsSchema } from "./humanitec";
import { humanitecConnectionService } from "./humanitec/humanitec-connection-service";
+ import { ValidateMsSqlConnectionCredentialsSchema } from "./mssql";
+ import { ValidatePostgresConnectionCredentialsSchema } from "./postgres";
+import { ValidateVercelConnectionCredentialsSchema } from "./vercel";
+import { vercelConnectionService } from "./vercel/vercel-connection-service";
export type TAppConnectionServiceFactoryDep = {
appConnectionDAL: TAppConnectionDALFactory;
@@@ -56,7 -58,8 +60,9 @@@ const VALIDATE_APP_CONNECTION_CREDENTIA
[AppConnection.AzureAppConfiguration]: ValidateAzureAppConfigurationConnectionCredentialsSchema,
[AppConnection.Databricks]: ValidateDatabricksConnectionCredentialsSchema,
[AppConnection.Humanitec]: ValidateHumanitecConnectionCredentialsSchema,
- [AppConnection.Vercel]: ValidateVercelConnectionCredentialsSchema
++ [AppConnection.Vercel]: ValidateVercelConnectionCredentialsSchema,
+ [AppConnection.Postgres]: ValidatePostgresConnectionCredentialsSchema,
+ [AppConnection.MsSql]: ValidateMsSqlConnectionCredentialsSchema
};
export const appConnectionServiceFactory = ({
diff --cc backend/src/services/app-connection/app-connection-types.ts
index 2537d19d77,be276d6069..61845eb864
--- a/backend/src/services/app-connection/app-connection-types.ts
+++ b/backend/src/services/app-connection/app-connection-types.ts
@@@ -36,14 -43,14 +43,20 @@@ import
THumanitecConnection,
THumanitecConnectionConfig,
THumanitecConnectionInput,
- TValidateHumanitecConnectionCredentials
+ TValidateHumanitecConnectionCredentialsSchema
} from "./humanitec";
+ import { TMsSqlConnection, TMsSqlConnectionInput, TValidateMsSqlConnectionCredentialsSchema } from "./mssql";
+ import {
+ TPostgresConnection,
+ TPostgresConnectionInput,
+ TValidatePostgresConnectionCredentialsSchema
+ } from "./postgres";
+import {
- TValidateVercelConnectionCredentials,
++ TValidateVercelConnectionCredentialsSchema,
+ TVercelConnection,
+ TVercelConnectionConfig,
+ TVercelConnectionInput
+} from "./vercel";
export type TAppConnection = { id: string } & (
| TAwsConnection
@@@ -53,9 -60,14 +66,15 @@@
| TAzureAppConfigurationConnection
| TDatabricksConnection
| THumanitecConnection
+ | TVercelConnection
+ | TPostgresConnection
+ | TMsSqlConnection
);
+ export type TAppConnectionRaw = NonNullable<Awaited<ReturnType<TAppConnectionDALFactory["findById"]>>>;
+
+ export type TSqlConnection = TPostgresConnection | TMsSqlConnection;
+
export type TAppConnectionInput = { id: string } & (
| TAwsConnectionInput
| TGitHubConnectionInput
@@@ -64,12 -76,15 +83,16 @@@
| TAzureAppConfigurationConnectionInput
| TDatabricksConnectionInput
| THumanitecConnectionInput
+ | TVercelConnectionInput
+ | TPostgresConnectionInput
+ | TMsSqlConnectionInput
);
+ export type TSqlConnectionInput = TPostgresConnectionInput | TMsSqlConnectionInput;
+
export type TCreateAppConnectionDTO = Pick<
TAppConnectionInput,
- "credentials" | "method" | "name" | "app" | "description"
+ "credentials" | "method" | "name" | "app" | "description" | "isPlatformManagedCredentials"
>;
export type TUpdateAppConnectionDTO = Partial<Omit<TCreateAppConnectionDTO, "method" | "app">> & {
@@@ -84,17 -99,18 +107,20 @@@ export type TAppConnectionConfig
| TAzureAppConfigurationConnectionConfig
| TDatabricksConnectionConfig
| THumanitecConnectionConfig
- | TVercelConnectionConfig;
++ | TVercelConnectionConfig
+ | TSqlConnectionConfig;
- export type TValidateAppConnectionCredentials =
- | TValidateAwsConnectionCredentials
- | TValidateGitHubConnectionCredentials
- | TValidateGcpConnectionCredentials
- | TValidateAzureKeyVaultConnectionCredentials
- | TValidateAzureAppConfigurationConnectionCredentials
- | TValidateDatabricksConnectionCredentials
- | TValidateHumanitecConnectionCredentials
- | TValidateVercelConnectionCredentials;
+ export type TValidateAppConnectionCredentialsSchema =
+ | TValidateAwsConnectionCredentialsSchema
+ | TValidateGitHubConnectionCredentialsSchema
+ | TValidateGcpConnectionCredentialsSchema
+ | TValidateAzureKeyVaultConnectionCredentialsSchema
+ | TValidateAzureAppConfigurationConnectionCredentialsSchema
+ | TValidateDatabricksConnectionCredentialsSchema
+ | TValidateHumanitecConnectionCredentialsSchema
+ | TValidatePostgresConnectionCredentialsSchema
- | TValidateMsSqlConnectionCredentialsSchema;
++ | TValidateMsSqlConnectionCredentialsSchema
++ | TValidateVercelConnectionCredentialsSchema;
export type TListAwsConnectionKmsKeys = {
connectionId: string;
diff --cc backend/src/services/app-connection/vercel/vercel-connection-enums.ts
index d674aa417a,0000000000..1bff0eb57a
mode 100644,000000..100644
--- a/backend/src/services/app-connection/vercel/vercel-connection-enums.ts
+++ b/backend/src/services/app-connection/vercel/vercel-connection-enums.ts
@@@ -1,3 -1,0 +1,3 @@@
+export enum VercelConnectionMethod {
- API_TOKEN = "api-token"
++ ApiToken = "api-token"
+}
diff --cc backend/src/services/app-connection/vercel/vercel-connection-fns.ts
index d3adb87adb,0000000000..4fd5e9ff4a
mode 100644,000000..100644
--- a/backend/src/services/app-connection/vercel/vercel-connection-fns.ts
+++ b/backend/src/services/app-connection/vercel/vercel-connection-fns.ts
@@@ -1,261 -1,0 +1,261 @@@
+/* eslint-disable no-await-in-loop */
+import { AxiosError, AxiosResponse } from "axios";
+
+import { request } from "@app/lib/config/request";
+import { BadRequestError, InternalServerError } from "@app/lib/errors";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+import { TVercelBranches } from "@app/services/integration-auth/integration-auth-types";
+import { IntegrationUrls } from "@app/services/integration-auth/integration-list";
+
+import { VercelConnectionMethod } from "./vercel-connection-enums";
+import {
+ TVercelConnectionConfig,
+ TVercelConnectionInput,
+ VercelApp,
+ VercelEnvironment,
+ VercelOrgWithApps
+} from "./vercel-connection-types";
+
+export const getVercelConnectionListItem = () => {
+ return {
+ name: "Vercel" as const,
+ app: AppConnection.Vercel as const,
- methods: Object.values(VercelConnectionMethod) as [VercelConnectionMethod.API_TOKEN]
++ methods: Object.values(VercelConnectionMethod) as [VercelConnectionMethod.ApiToken]
+ };
+};
+
+export const validateVercelConnectionCredentials = async (config: TVercelConnectionConfig) => {
+ const { credentials: inputCredentials } = config;
+
+ let response: AxiosResponse<VercelApp[]> | null = null;
+
+ try {
+ response = await request.get<VercelApp[]>(`${IntegrationUrls.VERCEL_API_URL}/v9/projects`, {
+ headers: {
+ Authorization: `Bearer ${inputCredentials.apiToken}`
+ }
+ });
+ } catch (error: unknown) {
+ if (error instanceof AxiosError) {
+ throw new BadRequestError({
+ message: `Failed to validate credentials: ${error.message || "Unknown error"}`
+ });
+ }
+ throw new BadRequestError({
+ message: "Unable to validate connection - verify credentials"
+ });
+ }
+
+ if (!response?.data) {
+ throw new InternalServerError({
+ message: "Failed to get organizations: Response was empty"
+ });
+ }
+
+ return inputCredentials;
+};
+
+interface ApiResponse<T> {
+ pagination?: {
+ count: number;
+ next: number;
+ };
+ data: T[];
+ [key: string]: unknown;
+}
+
+async function fetchAllPages<T>(
+ apiUrl: string,
+ apiToken: string,
+ initialParams: Record<string, string | number> = {},
+ dataPath?: string
+): Promise<T[]> {
+ const allItems: T[] = [];
+ let hasMoreItems = true;
+ let params: Record<string, string | number> = { ...initialParams, limit: 100 };
+
+ while (hasMoreItems) {
+ try {
+ const response = await request.get<ApiResponse<T>>(apiUrl, {
+ params,
+ headers: {
+ Authorization: `Bearer ${apiToken}`,
+ "Accept-Encoding": "application/json"
+ }
+ });
+
+ if (!response?.data) {
+ throw new InternalServerError({
+ message: `Failed to fetch data from ${apiUrl}: Response was empty or malformed`
+ });
+ }
+
+ let itemsData: T[];
+
+ if (dataPath && dataPath in response.data) {
+ itemsData = response.data[dataPath] as T[];
+ } else {
+ itemsData = response.data.data;
+ }
+
+ if (!Array.isArray(itemsData)) {
+ throw new InternalServerError({
+ message: `Failed to fetch data from ${apiUrl}: Expected array but got ${typeof itemsData}`
+ });
+ }
+
+ allItems.push(...itemsData);
+
+ if (response.data.pagination?.next) {
+ params = { ...params, since: response.data.pagination.next };
+ } else {
+ hasMoreItems = false;
+ }
+ } catch (error) {
+ if (error instanceof AxiosError) {
+ throw new BadRequestError({
+ message: `Failed to fetch data from ${apiUrl}: ${error.message || "Unknown error"}`
+ });
+ }
+ throw error;
+ }
+ }
+
+ return allItems;
+}
+
+async function fetchOrgProjects(orgId: string, apiToken: string): Promise<VercelApp[]> {
+ return fetchAllPages<VercelApp>(
+ `${IntegrationUrls.VERCEL_API_URL}/v9/projects`,
+ apiToken,
+ { teamId: orgId },
+ "projects"
+ );
+}
+
+async function fetchProjectEnvironments(projectId: string, apiToken: string): Promise<VercelEnvironment[]> {
+ return fetchAllPages<VercelEnvironment>(
+ `${IntegrationUrls.VERCEL_API_URL}/v9/projects/${projectId}/custom-environments`,
+ apiToken,
+ {},
+ "environments"
+ );
+}
+
+async function fetchPreviewBranches(projectId: string, apiToken: string): Promise<string[]> {
+ const { data } = await request.get<TVercelBranches[]>(
+ `${IntegrationUrls.VERCEL_API_URL}/v1/integrations/git-branches`,
+ {
+ params: {
+ projectId
+ },
+ headers: {
+ Authorization: `Bearer ${apiToken}`,
+ "Accept-Encoding": "application/json"
+ }
+ }
+ );
+ return data.filter((b) => b.ref !== "main").map((b) => b.ref);
+}
+
+type VercelTeam = {
+ id: string;
+ name: string;
+ slug: string;
+};
+
+type VercelUserResponse = {
+ user: {
+ id: string;
+ name: string;
+ username: string;
+ };
+};
+
+export const listProjects = async (appConnection: TVercelConnectionInput): Promise<VercelOrgWithApps[]> => {
+ const { credentials } = appConnection;
+ const { apiToken } = credentials;
+
+ const orgs = await fetchAllPages<VercelTeam>(`${IntegrationUrls.VERCEL_API_URL}/v2/teams`, apiToken, {}, "teams");
+
+ const personalAccountResponse = await request.get<VercelUserResponse>(`${IntegrationUrls.VERCEL_API_URL}/v2/user`, {
+ headers: {
+ Authorization: `Bearer ${apiToken}`,
+ "Accept-Encoding": "application/json"
+ }
+ });
+
+ if (personalAccountResponse?.data?.user) {
+ const { user } = personalAccountResponse.data;
+ orgs.push({
+ id: user.id,
+ name: user.name || "Personal Account",
+ slug: user.username || "personal"
+ });
+ }
+
+ const orgsWithApps: VercelOrgWithApps[] = [];
+
+ const orgPromises = orgs.map(async (org) => {
+ try {
+ const projects = await fetchOrgProjects(org.id, apiToken);
+
+ const enhancedProjectsPromises = projects.map(async (project) => {
+ try {
+ const [environments, previewBranches] = await Promise.all([
+ fetchProjectEnvironments(project.id, apiToken),
+ fetchPreviewBranches(project.id, apiToken)
+ ]);
+
+ return {
+ name: project.name,
+ id: project.id,
+ envs: environments,
+ previewBranches
+ };
+ } catch (error) {
+ return {
+ name: project.name,
+ id: project.id,
+ envs: [],
+ previewBranches: []
+ };
+ }
+ });
+
+ const enhancedProjects = await Promise.all(enhancedProjectsPromises);
+
+ return {
+ ...org,
+ apps: enhancedProjects
+ };
+ } catch (error) {
+ return null;
+ }
+ });
+
+ const results = await Promise.all(orgPromises);
+
+ results.forEach((result) => {
+ if (result !== null) {
+ orgsWithApps.push(result);
+ }
+ });
+
+ return orgsWithApps;
+};
+
+export const getProjectEnvironmentVariables = (project: VercelApp): Record<string, string> => {
+ const envVars: Record<string, string> = {};
+
+ if (!project.envs) return envVars;
+
+ project.envs.forEach((env) => {
+ if (env.value && env.type !== "gitBranch") {
+ const { key, value } = env;
+ envVars[key] = value;
+ }
+ });
+
+ return envVars;
+};
diff --cc backend/src/services/app-connection/vercel/vercel-connection-schemas.ts
index 1e0b1b4106,0000000000..12d730da88
mode 100644,000000..100644
--- a/backend/src/services/app-connection/vercel/vercel-connection-schemas.ts
+++ b/backend/src/services/app-connection/vercel/vercel-connection-schemas.ts
@@@ -1,56 -1,0 +1,59 @@@
+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 { VercelConnectionMethod } from "./vercel-connection-enums";
+
+export const VercelConnectionAccessTokenCredentialsSchema = z.object({
+ apiToken: z.string().trim().min(1, "API Token required")
+});
+
- const BaseVercelConnectionSchema = BaseAppConnectionSchema.extend({ app: z.literal(AppConnection.Vercel) });
++const BaseVercelConnectionSchema = BaseAppConnectionSchema.extend({
++ app: z.literal(AppConnection.Vercel),
++ isPlatformManagedCredentials: z.boolean().optional()
++});
+
+export const VercelConnectionSchema = BaseVercelConnectionSchema.extend({
- method: z.literal(VercelConnectionMethod.API_TOKEN),
++ method: z.literal(VercelConnectionMethod.ApiToken),
+ credentials: VercelConnectionAccessTokenCredentialsSchema
+});
+
+export const SanitizedVercelConnectionSchema = z.discriminatedUnion("method", [
+ BaseVercelConnectionSchema.extend({
- method: z.literal(VercelConnectionMethod.API_TOKEN),
++ method: z.literal(VercelConnectionMethod.ApiToken),
+ credentials: VercelConnectionAccessTokenCredentialsSchema.pick({})
+ })
+]);
+
+export const ValidateVercelConnectionCredentialsSchema = z.discriminatedUnion("method", [
+ z.object({
- method: z.literal(VercelConnectionMethod.API_TOKEN).describe(AppConnections?.CREATE(AppConnection.Vercel).method),
++ method: z.literal(VercelConnectionMethod.ApiToken).describe(AppConnections.CREATE(AppConnection.Vercel).method),
+ credentials: VercelConnectionAccessTokenCredentialsSchema.describe(
+ AppConnections.CREATE(AppConnection.Vercel).credentials
+ )
+ })
+]);
+
+export const CreateVercelConnectionSchema = ValidateVercelConnectionCredentialsSchema.and(
+ GenericCreateAppConnectionFieldsSchema(AppConnection.Vercel)
+);
+
+export const UpdateVercelConnectionSchema = z
+ .object({
+ credentials: VercelConnectionAccessTokenCredentialsSchema.optional().describe(
+ AppConnections.UPDATE(AppConnection.Vercel).credentials
+ )
+ })
+ .and(GenericUpdateAppConnectionFieldsSchema(AppConnection.Vercel));
+
+export const VercelConnectionListItemSchema = z.object({
+ name: z.literal("Vercel"),
+ app: z.literal(AppConnection.Vercel),
+ methods: z.nativeEnum(VercelConnectionMethod).array()
+});
diff --cc backend/src/services/app-connection/vercel/vercel-connection-types.ts
index 1711ab2752,0000000000..528917b3ad
mode 100644,000000..100644
--- a/backend/src/services/app-connection/vercel/vercel-connection-types.ts
+++ b/backend/src/services/app-connection/vercel/vercel-connection-types.ts
@@@ -1,73 -1,0 +1,73 @@@
+import z from "zod";
+
+import { DiscriminativePick } from "@app/lib/types";
+
+import { AppConnection } from "../app-connection-enums";
+import {
+ CreateVercelConnectionSchema,
+ ValidateVercelConnectionCredentialsSchema,
+ VercelConnectionSchema
+} from "./vercel-connection-schemas";
+
+export type TVercelConnection = z.infer<typeof VercelConnectionSchema>;
+
+export type TVercelConnectionInput = z.infer<typeof CreateVercelConnectionSchema> & {
+ app: AppConnection.Vercel;
+};
+
- export type TValidateVercelConnectionCredentials = typeof ValidateVercelConnectionCredentialsSchema;
++export type TValidateVercelConnectionCredentialsSchema = typeof ValidateVercelConnectionCredentialsSchema;
+
+export type TVercelConnectionConfig = DiscriminativePick<TVercelConnectionInput, "method" | "app" | "credentials"> & {
+ orgId: string;
+};
+
+export type VercelTeam = {
+ id: string;
+ name: string;
+ slug: string;
+};
+
+export type VercelEnvironment = {
+ key: string;
+ value: string;
+ type: string;
+ target?: string[];
+ gitBranch?: string;
+ createdAt?: number;
+ updatedAt?: number;
+};
+
+export type VercelAppMeta = {
+ githubCommitRef?: string;
+ githubCommitSha?: string;
+ githubCommitMessage?: string;
+ githubCommitAuthorName?: string;
+};
+
+export type VercelDeployment = {
+ id: string;
+ name: string;
+ url: string;
+ created: number;
+ meta?: VercelAppMeta;
+ target?: "production" | "preview" | "development";
+};
+
+export type VercelApp = {
+ name: string;
+ id: string;
+ envs?: VercelEnvironment[];
+ previewBranches?: string[];
+};
+
+export type VercelOrgWithApps = VercelTeam & {
+ apps: VercelApp[];
+};
+
+export type VercelUserResponse = {
+ user: {
+ id: string;
+ name: string;
+ username: string;
+ };
+};
diff --cc docs/mint.json
index 5aeb4e53b4,f94a05e180..da2c1997e0
--- a/docs/mint.json
+++ b/docs/mint.json
@@@ -420,7 -421,8 +421,9 @@@
"integrations/app-connections/gcp",
"integrations/app-connections/github",
"integrations/app-connections/humanitec",
- "integrations/app-connections/vercel"
++ "integrations/app-connections/vercel",
+ "integrations/app-connections/mssql",
+ "integrations/app-connections/postgres"
]
}
]
@@@ -925,17 -959,29 +961,41 @@@
"api-reference/endpoints/app-connections/humanitec/delete"
]
},
+ {
+ "group": "Vercel",
+ "pages": [
+ "api-reference/endpoints/app-connections/vercel/list",
+ "api-reference/endpoints/app-connections/vercel/available",
+ "api-reference/endpoints/app-connections/vercel/get-by-id",
+ "api-reference/endpoints/app-connections/vercel/get-by-name",
+ "api-reference/endpoints/app-connections/vercel/create",
+ "api-reference/endpoints/app-connections/vercel/update",
+ "api-reference/endpoints/app-connections/vercel/delete"
+ ]
++ },
+ {
+ "group": "Microsoft SQL Server",
+ "pages": [
+ "api-reference/endpoints/app-connections/mssql/list",
+ "api-reference/endpoints/app-connections/mssql/available",
+ "api-reference/endpoints/app-connections/mssql/get-by-id",
+ "api-reference/endpoints/app-connections/mssql/get-by-name",
+ "api-reference/endpoints/app-connections/mssql/create",
+ "api-reference/endpoints/app-connections/mssql/update",
+ "api-reference/endpoints/app-connections/mssql/delete"
+ ]
+ },
+ {
+ "group": "PostgreSQL",
+ "pages": [
+ "api-reference/endpoints/app-connections/postgres/list",
+ "api-reference/endpoints/app-connections/postgres/available",
+ "api-reference/endpoints/app-connections/postgres/get-by-id",
+ "api-reference/endpoints/app-connections/postgres/get-by-name",
+ "api-reference/endpoints/app-connections/postgres/create",
+ "api-reference/endpoints/app-connections/postgres/update",
+ "api-reference/endpoints/app-connections/postgres/delete"
+ ]
}
]
},
diff --cc frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/VercelSyncReviewFields.tsx
index 24db07906c,0000000000..43e83cf964
mode 100644,000000..100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/VercelSyncReviewFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/VercelSyncReviewFields.tsx
@@@ -1,23 -1,0 +1,23 @@@
+import { useFormContext } from "react-hook-form";
+
- import { SecretSyncLabel } from "@app/components/secret-syncs";
+import { TSecretSyncForm } from "@app/components/secret-syncs/forms/schemas";
++import { GenericFieldLabel } from "@app/components/v2";
+import { SecretSync } from "@app/hooks/api/secretSyncs";
+import { VercelEnvironmentType } from "@app/hooks/api/secretSyncs/types/vercel-sync";
+
+export const VercelSyncReviewFields = () => {
+ const { watch } = useFormContext<TSecretSyncForm & { destination: SecretSync.Vercel }>();
+ const envId = watch("destinationConfig.env");
+ const branchId = watch("destinationConfig.branch");
+ const appName = watch("destinationConfig.appName");
+
+ return (
+ <>
- <SecretSyncLabel label="Vercel App">{appName}</SecretSyncLabel>
- <SecretSyncLabel label="Environment">{envId}</SecretSyncLabel>
++ <GenericFieldLabel label="Vercel App">{appName}</GenericFieldLabel>
++ <GenericFieldLabel label="Environment">{envId}</GenericFieldLabel>
+ {envId === VercelEnvironmentType.Preview && branchId && (
- <SecretSyncLabel label="Preview Branch">{branchId}</SecretSyncLabel>
++ <GenericFieldLabel label="Preview Branch">{branchId}</GenericFieldLabel>
+ )}
+ </>
+ );
+};
diff --cc frontend/src/helpers/appConnections.ts
index c546100337,d75b426b7b..4dadf2b7d5
--- a/frontend/src/helpers/appConnections.ts
+++ b/frontend/src/helpers/appConnections.ts
@@@ -6,13 -6,14 +6,15 @@@ import
AwsConnectionMethod,
AzureAppConfigurationConnectionMethod,
AzureKeyVaultConnectionMethod,
+ DatabricksConnectionMethod,
GcpConnectionMethod,
GitHubConnectionMethod,
- TAppConnection
+ HumanitecConnectionMethod,
+ MsSqlConnectionMethod,
+ PostgresConnectionMethod,
- TAppConnection
++ TAppConnection,
++ VercelConnectionMethod
} from "@app/hooks/api/appConnections/types";
- import { DatabricksConnectionMethod } from "@app/hooks/api/appConnections/types/databricks-connection";
- import { HumanitecConnectionMethod } from "@app/hooks/api/appConnections/types/humanitec-connection";
- import { VercelConnectionMethod } from "@app/hooks/api/appConnections/types/vercel-connection";
export const APP_CONNECTION_MAP: Record<AppConnection, { name: string; image: string }> = {
[AppConnection.AWS]: { name: "AWS", image: "Amazon Web Services.png" },
@@@ -28,7 -29,8 +30,9 @@@
},
[AppConnection.Databricks]: { name: "Databricks", image: "Databricks.png" },
[AppConnection.Humanitec]: { name: "Humanitec", image: "Humanitec.png" },
- [AppConnection.Vercel]: { name: "Vercel", image: "Vercel.png" }
++ [AppConnection.Vercel]: { name: "Vercel", image: "Vercel.png" },
+ [AppConnection.Postgres]: { name: "PostgreSQL", image: "Postgres.png" },
+ [AppConnection.MsSql]: { name: "Microsoft SQL Server", image: "MsSql.png" }
};
export const getAppConnectionMethodDetails = (method: TAppConnection["method"]) => {
@@@ -47,10 -49,11 +51,13 @@@
return { name: "Service Account Impersonation", icon: faUser };
case DatabricksConnectionMethod.ServicePrincipal:
return { name: "Service Principal", icon: faUser };
- case HumanitecConnectionMethod.API_TOKEN:
+ case HumanitecConnectionMethod.ApiToken:
return { name: "API Token", icon: faKey };
- case VercelConnectionMethod.API_TOKEN:
++ case VercelConnectionMethod.ApiToken:
+ return { name: "Service API Token", icon: faKey };
+ case PostgresConnectionMethod.UsernameAndPassword:
+ case MsSqlConnectionMethod.UsernameAndPassword:
+ return { name: "Username & Password", icon: faLock };
default:
throw new Error(`Unhandled App Connection Method: ${method}`);
}
diff --cc frontend/src/hooks/api/appConnections/enums.ts
index b4e9d4812c,6891e7e2c3..4a9a8be7aa
--- a/frontend/src/hooks/api/appConnections/enums.ts
+++ b/frontend/src/hooks/api/appConnections/enums.ts
@@@ -6,5 -6,6 +6,7 @@@ export enum AppConnection
AzureAppConfiguration = "azure-app-configuration",
Databricks = "databricks",
Humanitec = "humanitec",
- Vercel = "vercel"
++ Vercel = "vercel",
+ Postgres = "postgres",
+ MsSql = "mssql"
}
diff --cc frontend/src/hooks/api/appConnections/types/app-options.ts
index 0c76298a2c,d3d376e6eb..f389bf230f
--- a/frontend/src/hooks/api/appConnections/types/app-options.ts
+++ b/frontend/src/hooks/api/appConnections/types/app-options.ts
@@@ -38,10 -39,14 +39,18 @@@ export type THumanitecConnectionOption
app: AppConnection.Humanitec;
};
+export type TVercelConnectionOption = TAppConnectionOptionBase & {
+ app: AppConnection.Vercel;
+};
+
+ export type TPostgresConnectionOption = TAppConnectionOptionBase & {
+ app: AppConnection.Postgres;
+ };
+
+ export type TMsSqlConnectionOption = TAppConnectionOptionBase & {
+ app: AppConnection.MsSql;
+ };
+
export type TAppConnectionOption =
| TAwsConnectionOption
| TGitHubConnectionOption
@@@ -50,7 -55,8 +59,9 @@@
| TAzureKeyVaultConnectionOption
| TDatabricksConnectionOption
| THumanitecConnectionOption
- | TVercelConnectionOption;
++ | TVercelConnectionOption
+ | TPostgresConnectionOption
+ | TMsSqlConnectionOption;
export type TAppConnectionOptionMap = {
[AppConnection.AWS]: TAwsConnectionOption;
@@@ -60,5 -66,6 +71,7 @@@
[AppConnection.AzureAppConfiguration]: TAzureAppConfigurationConnectionOption;
[AppConnection.Databricks]: TDatabricksConnectionOption;
[AppConnection.Humanitec]: THumanitecConnectionOption;
+ [AppConnection.Vercel]: TVercelConnectionOption;
+ [AppConnection.Postgres]: TPostgresConnectionOption;
+ [AppConnection.MsSql]: TMsSqlConnectionOption;
};
diff --cc frontend/src/hooks/api/appConnections/types/index.ts
index 1aa6bb9ec6,a241e21a11..15c2e96918
--- a/frontend/src/hooks/api/appConnections/types/index.ts
+++ b/frontend/src/hooks/api/appConnections/types/index.ts
@@@ -1,14 -1,14 +1,15 @@@
- import { AppConnection } from "@app/hooks/api/appConnections/enums";
- import { TAppConnectionOption } from "@app/hooks/api/appConnections/types/app-options";
- import { TAwsConnection } from "@app/hooks/api/appConnections/types/aws-connection";
- import { TDatabricksConnection } from "@app/hooks/api/appConnections/types/databricks-connection";
- import { TGitHubConnection } from "@app/hooks/api/appConnections/types/github-connection";
- import { THumanitecConnection } from "@app/hooks/api/appConnections/types/humanitec-connection";
-
+ import { AppConnection } from "../enums";
+ import { TAppConnectionOption } from "./app-options";
+ import { TAwsConnection } from "./aws-connection";
import { TAzureAppConfigurationConnection } from "./azure-app-configuration-connection";
import { TAzureKeyVaultConnection } from "./azure-key-vault-connection";
+ import { TDatabricksConnection } from "./databricks-connection";
import { TGcpConnection } from "./gcp-connection";
+ import { TGitHubConnection } from "./github-connection";
+ import { THumanitecConnection } from "./humanitec-connection";
+ import { TMsSqlConnection } from "./mssql-connection";
+ import { TPostgresConnection } from "./postgres-connection";
+import { TVercelConnection } from "./vercel-connection";
export * from "./aws-connection";
export * from "./azure-app-configuration-connection";
@@@ -16,6 -17,8 +18,9 @@@ export * from "./databricks-connection"
export * from "./gcp-connection";
export * from "./github-connection";
export * from "./humanitec-connection";
+ export * from "./mssql-connection";
+ export * from "./postgres-connection";
++export * from "./vercel-connection";
export type TAppConnection =
| TAwsConnection
@@@ -25,7 -28,8 +30,9 @@@
| TAzureAppConfigurationConnection
| TDatabricksConnection
| THumanitecConnection
- | TVercelConnection;
++ | TVercelConnection
+ | TPostgresConnection
+ | TMsSqlConnection;
export type TAvailableAppConnection = Pick<TAppConnection, "name" | "id">;
@@@ -60,5 -64,6 +67,7 @@@ export type TAppConnectionMap =
[AppConnection.AzureAppConfiguration]: TAzureAppConfigurationConnection;
[AppConnection.Databricks]: TDatabricksConnection;
[AppConnection.Humanitec]: THumanitecConnection;
+ [AppConnection.Vercel]: TVercelConnection;
+ [AppConnection.Postgres]: TPostgresConnection;
+ [AppConnection.MsSql]: TMsSqlConnection;
};
diff --cc frontend/src/hooks/api/appConnections/types/vercel-connection.ts
index 886f0e767d,0000000000..d733639ab2
mode 100644,000000..100644
--- a/frontend/src/hooks/api/appConnections/types/vercel-connection.ts
+++ b/frontend/src/hooks/api/appConnections/types/vercel-connection.ts
@@@ -1,13 -1,0 +1,13 @@@
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+import { TRootAppConnection } from "@app/hooks/api/appConnections/types/root-connection";
+
+export enum VercelConnectionMethod {
- API_TOKEN = "api-token"
++ ApiToken = "api-token"
+}
+
+export type TVercelConnection = TRootAppConnection & { app: AppConnection.Vercel } & {
- method: VercelConnectionMethod.API_TOKEN;
++ method: VercelConnectionMethod.ApiToken;
+ credentials: {
+ apiToken: string;
+ };
+};
diff --cc frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
index 3b6ea208d5,6a57bef5a8..b4b6159388
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
@@@ -16,7 -16,8 +16,9 @@@ import { DatabricksConnectionForm } fro
import { GcpConnectionForm } from "./GcpConnectionForm";
import { GitHubConnectionForm } from "./GitHubConnectionForm";
import { HumanitecConnectionForm } from "./HumanitecConnectionForm";
+ import { MsSqlConnectionForm } from "./MsSqlConnectionForm";
+ import { PostgresConnectionForm } from "./PostgresConnectionForm";
+import { VercelConnectionForm } from "./VercelConnectionForm";
type FormProps = {
onComplete: (appConnection: TAppConnection) => void;
@@@ -66,8 -70,10 +71,12 @@@ const CreateForm = ({ app, onComplete }
return <DatabricksConnectionForm onSubmit={onSubmit} />;
case AppConnection.Humanitec:
return <HumanitecConnectionForm onSubmit={onSubmit} />;
+ case AppConnection.Vercel:
+ return <VercelConnectionForm onSubmit={onSubmit} />;
+ case AppConnection.Postgres:
+ return <PostgresConnectionForm onSubmit={onSubmit} />;
+ case AppConnection.MsSql:
+ return <MsSqlConnectionForm onSubmit={onSubmit} />;
default:
throw new Error(`Unhandled App ${app}`);
}
@@@ -115,8 -124,10 +127,12 @@@ const UpdateForm = ({ appConnection, on
return <DatabricksConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
case AppConnection.Humanitec:
return <HumanitecConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
+ case AppConnection.Vercel:
+ return <VercelConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
+ case AppConnection.Postgres:
+ return <PostgresConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
+ case AppConnection.MsSql:
+ return <MsSqlConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
default:
throw new Error(`Unhandled App ${(appConnection as TAppConnection).app}`);
}
diff --cc frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/VercelConnectionForm.tsx
index e47d50fd07,0000000000..88c3c2d8fe
mode 100644,000000..100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/VercelConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/VercelConnectionForm.tsx
@@@ -1,135 -1,0 +1,135 @@@
+import { Controller, FormProvider, useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { z } from "zod";
+
+import {
+ Button,
+ FormControl,
+ ModalClose,
+ SecretInput,
+ Select,
+ SelectItem
+} from "@app/components/v2";
+import { APP_CONNECTION_MAP, getAppConnectionMethodDetails } from "@app/helpers/appConnections";
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+import {
+ TVercelConnection,
+ VercelConnectionMethod
+} from "@app/hooks/api/appConnections/types/vercel-connection";
+
+import {
+ genericAppConnectionFieldsSchema,
+ GenericAppConnectionsFields
+} from "./GenericAppConnectionFields";
+
+type Props = {
+ appConnection?: TVercelConnection;
+ onSubmit: (formData: FormData) => void;
+};
+
+const rootSchema = genericAppConnectionFieldsSchema.extend({
+ app: z.literal(AppConnection.Vercel)
+});
+
+const formSchema = z.discriminatedUnion("method", [
+ rootSchema.extend({
- method: z.literal(VercelConnectionMethod.API_TOKEN),
++ method: z.literal(VercelConnectionMethod.ApiToken),
+ credentials: z.object({
+ apiToken: z.string().trim().min(1, "Service API Token required")
+ })
+ })
+]);
+
+type FormData = z.infer<typeof formSchema>;
+
+export const VercelConnectionForm = ({ appConnection, onSubmit }: Props) => {
+ const isUpdate = Boolean(appConnection);
+
+ const form = useForm<FormData>({
+ resolver: zodResolver(formSchema),
+ defaultValues: appConnection ?? {
+ app: AppConnection.Vercel,
- method: VercelConnectionMethod.API_TOKEN
++ method: VercelConnectionMethod.ApiToken
+ }
+ });
+
+ 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.Vercel].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(VercelConnectionMethod).map((method) => {
+ return (
+ <SelectItem value={method} key={method}>
+ {getAppConnectionMethodDetails(method).name}{" "}
+ </SelectItem>
+ );
+ })}
+ </Select>
+ </FormControl>
+ )}
+ />
+ <Controller
+ name="credentials.apiToken"
+ control={control}
+ shouldUnregister
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ errorText={error?.message}
+ isError={Boolean(error?.message)}
+ label="Service API 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>
+ )}
+ />
+ <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 Vercel"}
+ </Button>
+ <ModalClose asChild>
+ <Button colorSchema="secondary" variant="plain">
+ Cancel
+ </Button>
+ </ModalClose>
+ </div>
+ </form>
+ </FormProvider>
+ );
+};
diff --cc frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/VercelSyncDestinationSection.tsx
index 3b204a8284,0000000000..c3400b3a26
mode 100644,000000..100644
--- a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/VercelSyncDestinationSection.tsx
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/VercelSyncDestinationSection.tsx
@@@ -1,32 -1,0 +1,32 @@@
+import { ReactNode } from "react";
+
- import { SecretSyncLabel } from "@app/components/secret-syncs";
++import { GenericFieldLabel } from "@app/components/secret-syncs";
+import { TVercelSync, VercelEnvironmentType } from "@app/hooks/api/secretSyncs/types/vercel-sync";
+
+type Props = {
+ secretSync: TVercelSync;
+};
+
+export const VercelSyncDestinationSection = ({ secretSync }: Props) => {
+ const { destinationConfig } = secretSync;
+
+ let Components: ReactNode;
+ if (destinationConfig.env === VercelEnvironmentType.Preview && destinationConfig.branch) {
+ Components = (
+ <>
- <SecretSyncLabel label="Vercel App">{destinationConfig.app}</SecretSyncLabel>
- <SecretSyncLabel label="Environment">{destinationConfig.env}</SecretSyncLabel>
- <SecretSyncLabel label="Preview Branch">{destinationConfig.branch}</SecretSyncLabel>
++ <GenericFieldLabel label="Vercel App">{destinationConfig.app}</GenericFieldLabel>
++ <GenericFieldLabel label="Environment">{destinationConfig.env}</GenericFieldLabel>
++ <GenericFieldLabel label="Preview Branch">{destinationConfig.branch}</GenericFieldLabel>
+ </>
+ );
+ } else {
+ Components = (
+ <>
- <SecretSyncLabel label="Vercel App">{destinationConfig.app}</SecretSyncLabel>
- <SecretSyncLabel label="Environment">{destinationConfig.env}</SecretSyncLabel>
++ <GenericFieldLabel label="Vercel App">{destinationConfig.app}</GenericFieldLabel>
++ <GenericFieldLabel label="Environment">{destinationConfig.env}</GenericFieldLabel>
+ </>
+ );
+ }
+
+ return Components;
+};