Home / Function/ buildDestinationConfigForValidation() — supabase Function Reference

buildDestinationConfigForValidation() — supabase Function Reference

Architecture documentation for the buildDestinationConfigForValidation() function in DestinationForm.utils.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  2fe82f23_0649_59a7_6fad_27f69700fe7e["buildDestinationConfigForValidation()"]
  fffb5bea_3c71_7ec5_e4c1_4bf313a4a834["DestinationForm()"]
  fffb5bea_3c71_7ec5_e4c1_4bf313a4a834 -->|calls| 2fe82f23_0649_59a7_6fad_27f69700fe7e
  style 2fe82f23_0649_59a7_6fad_27f69700fe7e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationForm.utils.ts lines 8–56

export const buildDestinationConfigForValidation = ({
  projectRef,
  selectedType,
  data,
}: {
  projectRef?: string
  selectedType: DestinationType
  data: z.infer<typeof DestinationPanelFormSchema>
}) => {
  if (!projectRef) throw new Error('Project ref is required')

  if (selectedType === 'BigQuery') {
    return {
      bigQuery: {
        projectId: data.projectId ?? '',
        datasetId: data.datasetId ?? '',
        serviceAccountKey: data.serviceAccountKey ?? '',
        ...(data.maxStalenessMins !== undefined ? { maxStalenessMins: data.maxStalenessMins } : {}),
      },
    }
  } else if (selectedType === 'Analytics Bucket') {
    // For validation, use the namespace as-is (even if it's CREATE_NEW_NAMESPACE)
    // The actual creation will happen later in submitPipeline
    const validationNamespace =
      data.namespace === CREATE_NEW_NAMESPACE ? data.newNamespaceName : data.namespace

    // For validation purposes, if CREATE_NEW_KEY is selected, we skip S3 key validation
    // The actual key creation will happen later in submitPipeline
    // We'll use placeholder values for validation
    const s3Keys =
      data.s3AccessKeyId === CREATE_NEW_KEY
        ? { accessKey: 'placeholder', secretKey: 'placeholder' }
        : { accessKey: data.s3AccessKeyId ?? '', secretKey: data.s3SecretAccessKey ?? '' }

    return {
      iceberg: {
        projectRef,
        warehouseName: data.warehouseName ?? '',
        namespace: validationNamespace,
        catalogToken: data.catalogToken ?? '',
        s3AccessKeyId: s3Keys.accessKey,
        s3SecretAccessKey: s3Keys.secretKey,
        s3Region: data.s3Region ?? '',
      },
    }
  } else {
    throw new Error('Invalid destination type')
  }
}

Subdomains

Called By

Frequently Asked Questions

What does buildDestinationConfigForValidation() do?
buildDestinationConfigForValidation() is a function in the supabase codebase.
What calls buildDestinationConfigForValidation()?
buildDestinationConfigForValidation() is called by 1 function(s): DestinationForm.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free