Skip to content

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

970 B
Raw Blame
import { z } from "zod";

import { BaseSecretSyncSchema } from "@app/components/secret-syncs/forms/schemas/base-secret-sync-schema";
import { SecretSync } from "@app/hooks/api/secretSyncs/enums";

export enum NetlifySyncContext {
  // All = "all", - Netlify doesn't allow "all" as the context when using is_secret: true
  DeployPreview = "deploy-preview",
  Production = "production",
  BranchDeploy = "branch-deploy",
  Dev = "dev",
  Branch = "branch"
}

export const NetlifySyncDestinationSchema = BaseSecretSyncSchema().merge(
  z.object({
    destination: z.literal(SecretSync.Netlify),
    destinationConfig: z.object({
      accountId: z.string(),
      accountName: z.string(),
      siteId: z
        .string()
        .nullish()
        .transform((value) => value || undefined),
      siteName: z.string().optional(),
      context: z
        .nativeEnum(NetlifySyncContext)
        .nullish()
        .transform((value) => value || undefined)
    })
  })
);