Home / Function/ parseReferencePath() — supabase Function Reference

parseReferencePath() — supabase Function Reference

Architecture documentation for the parseReferencePath() function in Reference.utils.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  9e04b292_66c7_6129_dcb5_dfa277f2392b["parseReferencePath()"]
  3209e6f3_8d6d_ac1c_7e61_019ebb7c0ba8["ReferencePage()"]
  3209e6f3_8d6d_ac1c_7e61_019ebb7c0ba8 -->|calls| 9e04b292_66c7_6129_dcb5_dfa277f2392b
  201fe934_d9a7_666d_72d6_d4c613257d3c["generateReferenceMetadata()"]
  201fe934_d9a7_666d_72d6_d4c613257d3c -->|calls| 9e04b292_66c7_6129_dcb5_dfa277f2392b
  style 9e04b292_66c7_6129_dcb5_dfa277f2392b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/features/docs/Reference.utils.ts lines 29–82

export function parseReferencePath(slug: Array<string>) {
  const isClientSdkReference = clientSdkIds.includes(slug[0])
  const isCliReference = slug[0] === 'cli'
  const isApiReference = slug[0] === 'api'
  const isSelfHostingReference = slug[0].startsWith('self-hosting-')

  if (isClientSdkReference) {
    let sdkId: string
    let maybeVersion: string | null
    let maybeCrawlers: string | null
    let path: string[]
    ;[sdkId, maybeVersion, maybeCrawlers, ...path] = slug
    if (!/v\d+/.test(maybeVersion)) {
      maybeVersion = null
      path = [maybeCrawlers, ...path]
      maybeCrawlers = maybeVersion
    }
    if (maybeCrawlers !== 'crawlers') {
      if (typeof maybeCrawlers === 'string') {
        path = [maybeCrawlers, ...path]
      }
      maybeCrawlers = null
    }

    return {
      __type: 'clientSdk' as const,
      sdkId,
      maybeVersion,
      maybeCrawlers,
      path,
    }
  } else if (isCliReference) {
    return {
      __type: 'cli' as const,
      path: slug.slice(1),
    }
  } else if (isApiReference) {
    return {
      __type: 'api' as const,
      path: slug.slice(1),
    }
  } else if (isSelfHostingReference) {
    return {
      __type: 'self-hosting' as const,
      service: slug[0].replace('self-hosting-', ''),
      servicePath: slug[0],
      path: slug.slice(1),
    }
  } else {
    return {
      __type: 'UNIMPLEMENTED' as const,
    }
  }
}

Subdomains

Frequently Asked Questions

What does parseReferencePath() do?
parseReferencePath() is a function in the supabase codebase.
What calls parseReferencePath()?
parseReferencePath() is called by 2 function(s): ReferencePage, generateReferenceMetadata.

Analyze Your Own Codebase

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

Try Supermodel Free