Home / Function/ getAllTroubleshootingEntriesInternal() — supabase Function Reference

getAllTroubleshootingEntriesInternal() — supabase Function Reference

Architecture documentation for the getAllTroubleshootingEntriesInternal() function in Troubleshooting.utils.common.mjs from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  50eeb80f_dca1_8401_910a_cf001d7af30b["getAllTroubleshootingEntriesInternal()"]
  65c7f9d2_cb35_8108_ddde_d25ed9c0f48a["getAllTroubleshootingEntriesTyped()"]
  65c7f9d2_cb35_8108_ddde_d25ed9c0f48a -->|calls| 50eeb80f_dca1_8401_910a_cf001d7af30b
  ec384afb_35d9_864b_8a92_fb6a0f2cd694["validateTroubleshootingMetadata()"]
  50eeb80f_dca1_8401_910a_cf001d7af30b -->|calls| ec384afb_35d9_864b_8a92_fb6a0f2cd694
  98f7f36d_ad97_5156_d856_bd0706f53232["canonicalizeUrl()"]
  50eeb80f_dca1_8401_910a_cf001d7af30b -->|calls| 98f7f36d_ad97_5156_d856_bd0706f53232
  style 50eeb80f_dca1_8401_910a_cf001d7af30b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/features/docs/Troubleshooting.utils.common.mjs lines 110–180

export async function getAllTroubleshootingEntriesInternal() {
  const troubleshootingDirectoryContents = await readdir(TROUBLESHOOTING_DIRECTORY, {
    recursive: true,
  })
  const troubleshootingFiles = troubleshootingDirectoryContents.map(async (entry) => {
    const isHidden = entry.startsWith('_')
    if (isHidden) return null

    const filePath = join(TROUBLESHOOTING_DIRECTORY, entry)

    const isFile = (await stat(filePath)).isFile()
    if (!isFile) return null

    const fileContents = await readFile(filePath, 'utf-8')
    const { content, data: frontmatter } = matter(fileContents, {
      language: 'toml',
      engines: { toml: parse },
    })

    const parseResult = validateTroubleshootingMetadata(frontmatter)
    if ('error' in parseResult) {
      console.error(
        `Error validating troubleshooting metadata\nEntry:%O\nError:%O`,
        frontmatter,
        parseResult.error
      )
      return null
    }

    const mdxTree = fromMarkdown(content, {
      extensions: [gfm(), mdxjs()],
      mdastExtensions: [gfmFromMarkdown(), mdxFromMarkdown()],
    })
    visit(mdxTree, (node) => {
      if ('children' in node) {
        node.children = node.children.filter(
          (child) =>
            ![
              'mdxJsxFlowExpression',
              'mdxJsxTextExpression',
              'mdxFlowExpression',
              'mdxTextExpression',
              'mdxJsxFlowElement',
              'mdxJsxTextElement',
              'mdxJsxExpressionAttribute',
              'mdxJsxAttribute',
              'mdxJsxAttributeValueExpression',
              'mdxjsEsm',
            ].includes(child.type)
        )
      }

      if (node.type === 'link' || node.type === 'image') {
        canonicalizeUrl(node)
      }
    })

    const contentWithoutJsx = toMarkdown(mdxTree, {
      extensions: [gfmToMarkdown()],
    })

    return {
      filePath,
      content,
      contentWithoutJsx,
      data: parseResult.data,
    }
  })

  return (await Promise.all(troubleshootingFiles)).filter((x) => x != null)
}

Subdomains

Frequently Asked Questions

What does getAllTroubleshootingEntriesInternal() do?
getAllTroubleshootingEntriesInternal() is a function in the supabase codebase.
What does getAllTroubleshootingEntriesInternal() call?
getAllTroubleshootingEntriesInternal() calls 2 function(s): canonicalizeUrl, validateTroubleshootingMetadata.
What calls getAllTroubleshootingEntriesInternal()?
getAllTroubleshootingEntriesInternal() is called by 1 function(s): getAllTroubleshootingEntriesTyped.

Analyze Your Own Codebase

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

Try Supermodel Free