Home / Function/ writeSelfHostingReferenceSections() — supabase Function Reference

writeSelfHostingReferenceSections() — supabase Function Reference

Architecture documentation for the writeSelfHostingReferenceSections() function in Reference.generated.script.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  f9f2b457_8e93_ce1a_7a61_59c0fd35d747["writeSelfHostingReferenceSections()"]
  35786dbf_245c_1618_e006_4cf71f59bd93["run()"]
  35786dbf_245c_1618_e006_4cf71f59bd93 -->|calls| f9f2b457_8e93_ce1a_7a61_59c0fd35d747
  45f56962_4cb7_83a3_8932_0438eedf9eb9["flatMap()"]
  f9f2b457_8e93_ce1a_7a61_59c0fd35d747 -->|calls| 45f56962_4cb7_83a3_8932_0438eedf9eb9
  5c5e362d_826d_df1a_72f8_d427ad32c0bc["mapEndpointsById()"]
  f9f2b457_8e93_ce1a_7a61_59c0fd35d747 -->|calls| 5c5e362d_826d_df1a_72f8_d427ad32c0bc
  2ba77918_c71f_00b4_2b40_c0b152543573["join()"]
  f9f2b457_8e93_ce1a_7a61_59c0fd35d747 -->|calls| 2ba77918_c71f_00b4_2b40_c0b152543573
  b4ff4c86_43e8_1e69_1acd_bb3653aa9f41["genSelfHostedSectionTree()"]
  f9f2b457_8e93_ce1a_7a61_59c0fd35d747 -->|calls| b4ff4c86_43e8_1e69_1acd_bb3653aa9f41
  86220fce_b7ec_5580_a5d9_938c3ed97a21["flattenCommonClientLibSections()"]
  f9f2b457_8e93_ce1a_7a61_59c0fd35d747 -->|calls| 86220fce_b7ec_5580_a5d9_938c3ed97a21
  style f9f2b457_8e93_ce1a_7a61_59c0fd35d747 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/features/docs/Reference.generated.script.ts lines 288–343

async function writeSelfHostingReferenceSections() {
  let id = 0

  return Promise.all(
    selfHostingSpecs.flatMap((service) => {
      let tasks: Promise<any>[] = []

      let endpointsById: Map<string, IApiEndPoint> = new Map()
      if (service.spec) {
        endpointsById = mapEndpointsById(service.spec, (details) =>
          slugify(details.summary || `dummy-id-${String(id++)}`, {
            lower: true,
            remove: /[^\w\s-]/g,
          })
        )
        tasks.push(
          writeFile(
            join(GENERATED_DIRECTORY, `${service.id}.latest.endpointsById.json`),
            JSON.stringify(Array.from(endpointsById.entries()))
          )
        )
      }

      const selfHostedSectionTree = genSelfHostedSectionTree(service.sections, endpointsById)
      tasks.push(
        writeFile(
          join(GENERATED_DIRECTORY, `${service.id}.latest.sections.json`),
          JSON.stringify(selfHostedSectionTree)
        )
      )

      const flattenedSelfHostedSections = flattenCommonClientLibSections(
        selfHostedSectionTree as AbbrevApiReferenceSection[]
      )
      tasks.push(
        writeFile(
          join(GENERATED_DIRECTORY, `${service.id}.latest.flat.json`),
          JSON.stringify(flattenedSelfHostedSections)
        )
      )

      const selfHostedSectionsBySlug = keyBy(
        flattenedSelfHostedSections.filter(({ slug }) => !!slug),
        (section) => section.slug
      )
      tasks.push(
        writeFile(
          join(GENERATED_DIRECTORY, `${service.id}.latest.bySlug.json`),
          JSON.stringify(selfHostedSectionsBySlug)
        )
      )

      return tasks
    })
  )
}

Subdomains

Called By

Frequently Asked Questions

What does writeSelfHostingReferenceSections() do?
writeSelfHostingReferenceSections() is a function in the supabase codebase.
What does writeSelfHostingReferenceSections() call?
writeSelfHostingReferenceSections() calls 5 function(s): flatMap, flattenCommonClientLibSections, genSelfHostedSectionTree, join, mapEndpointsById.
What calls writeSelfHostingReferenceSections()?
writeSelfHostingReferenceSections() is called by 1 function(s): run.

Analyze Your Own Codebase

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

Try Supermodel Free