Home / Function/ formatWrapperTables() — supabase Function Reference

formatWrapperTables() — supabase Function Reference

Architecture documentation for the formatWrapperTables() function in Wrappers.utils.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  c8623a94_43a1_47f9_96c7_09ed48ad65f2["formatWrapperTables()"]
  2d7aff71_ad70_13c1_d314_aaa9543be33f["EditWrapperSheet()"]
  2d7aff71_ad70_13c1_d314_aaa9543be33f -->|calls| c8623a94_43a1_47f9_96c7_09ed48ad65f2
  9b0468bc_4215_0f07_09dd_085c8f107257["WrapperRow()"]
  9b0468bc_4215_0f07_09dd_085c8f107257 -->|calls| c8623a94_43a1_47f9_96c7_09ed48ad65f2
  style c8623a94_43a1_47f9_96c7_09ed48ad65f2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/studio/components/interfaces/Integrations/Wrappers/Wrappers.utils.ts lines 64–110

export const formatWrapperTables = (
  wrapper: { handler: string; tables?: FDWTable[] },
  wrapperMeta?: WrapperMeta
): FormattedWrapperTable[] => {
  const tables = wrapper?.tables ?? []

  return tables.map((table) => {
    let index: number = 0
    const options = Object.fromEntries(table.options.map((option: string) => option.split('=')))

    switch (wrapper.handler) {
      case WRAPPER_HANDLERS.STRIPE:
        index =
          wrapperMeta?.tables.findIndex(
            (x) => x.options.find((x) => x.name === 'object')?.defaultValue === options.object
          ) ?? 0
        break
      case WRAPPER_HANDLERS.FIREBASE:
        if (options.object === 'auth/users') {
          index =
            wrapperMeta?.tables.findIndex((x) =>
              x.options.find((x) => x.defaultValue === 'auth/users')
            ) ?? 0
        } else {
          index = wrapperMeta?.tables.findIndex((x) => x.label === 'Firestore Collection') ?? 0
        }
        break
      case WRAPPER_HANDLERS.S3:
      case WRAPPER_HANDLERS.AIRTABLE:
      case WRAPPER_HANDLERS.LOGFLARE:
      case WRAPPER_HANDLERS.BIG_QUERY:
      case WRAPPER_HANDLERS.CLICK_HOUSE:
        break
    }

    return {
      ...options,
      index,
      id: table.id,
      columns: table.columns,
      is_new_schema: false,
      schema: table.schema,
      schema_name: table.schema,
      table_name: table.name,
    }
  })
}

Subdomains

Frequently Asked Questions

What does formatWrapperTables() do?
formatWrapperTables() is a function in the supabase codebase.
What calls formatWrapperTables()?
formatWrapperTables() is called by 2 function(s): EditWrapperSheet, WrapperRow.

Analyze Your Own Codebase

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

Try Supermodel Free