diff --git a/apps/docs/app/guides/[...slug]/page.tsx b/apps/docs/app/guides/[...slug]/page.tsx deleted file mode 100644 index 2bbfc101eea..00000000000 --- a/apps/docs/app/guides/[...slug]/page.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { - getGuidesMarkdown, - genGuideMeta, - genGuidesStaticParams, -} from '~/features/docs/GuidesMdx.utils' -import { GuideTemplate } from '~/features/docs/GuidesMdx.template' - -type Params = { slug: string[] } - -const GuidePage = async ({ params }: { params: Params }) => { - const data = await getGuidesMarkdown(params) - return -} - -const generateStaticParams = genGuidesStaticParams() -const generateMetadata = genGuideMeta(getGuidesMarkdown) - -export default GuidePage -export { generateStaticParams, generateMetadata } diff --git a/apps/docs/app/guides/ai/python/[slug]/page.tsx b/apps/docs/app/guides/ai/python/[slug]/page.tsx deleted file mode 100644 index 1882cf7e20c..00000000000 --- a/apps/docs/app/guides/ai/python/[slug]/page.tsx +++ /dev/null @@ -1,134 +0,0 @@ -import { type SerializeOptions } from 'next-mdx-remote/dist/types' -import { redirect } from 'next/navigation' -import { relative } from 'path' -import rehypeSlug from 'rehype-slug' -import { genGuideMeta } from '~/features/docs/GuidesMdx.utils' -import { GuideTemplate, newEditLink } from '~/features/docs/GuidesMdx.template' -import { fetchRevalidatePerDay } from '~/features/helpers.fetch' -import { notFoundLink } from '~/features/recommendations/NotFound.utils' -import { UrlTransformFunction, linkTransform } from '~/lib/mdx/plugins/rehypeLinkTransform' -import remarkMkDocsAdmonition from '~/lib/mdx/plugins/remarkAdmonition' -import { removeTitle } from '~/lib/mdx/plugins/remarkRemoveTitle' - -// We fetch these docs at build time from an external repo -const org = 'supabase' -const repo = 'vecs' -const branch = 'main' -const docsDir = 'docs' -const externalSite = 'https://supabase.github.io/vecs' - -// Each external docs page is mapped to a local page -const pageMap = [ - { - slug: 'api', - meta: { - title: 'API', - }, - remoteFile: 'api.md', - }, - { - slug: 'collections', - meta: { - title: 'Collections', - }, - remoteFile: 'concepts_collections.md', - }, - { - slug: 'indexes', - meta: { - title: 'Indexes', - }, - remoteFile: 'concepts_indexes.md', - }, - { - slug: 'metadata', - meta: { - title: 'Metadata', - }, - remoteFile: 'concepts_metadata.md', - }, -] - -interface Params { - slug: string -} - -const PythonClientDocs = async ({ params }: { params: Params }) => { - const { meta, ...data } = await getContent(params) - - const options = { - mdxOptions: { - remarkPlugins: [remarkMkDocsAdmonition, [removeTitle, meta.title]], - rehypePlugins: [[linkTransform, urlTransform], rehypeSlug], - }, - } as SerializeOptions - - return -} - -/** - * Fetch markdown from external repo - */ -const getContent = async ({ slug }: Params) => { - const page = pageMap.find(({ slug: validSlug }) => validSlug && validSlug === slug) - - if (!page) { - redirect(notFoundLink(`api/python/${slug}`)) - } - - const { remoteFile, meta } = page - - const editLink = newEditLink(`${org}/${repo}/blob/${branch}/${docsDir}/${remoteFile}`) - - const response = await fetchRevalidatePerDay( - `https://raw.githubusercontent.com/${org}/${repo}/${branch}/${docsDir}/${remoteFile}` - ) - - const content = await response.text() - - return { - pathname: `/guides/ai/python/${slug}` satisfies `/${string}`, - meta, - content, - editLink, - } -} - -const urlTransform: UrlTransformFunction = (url) => { - try { - const externalSiteUrl = new URL(externalSite) - - const placeholderHostname = 'placeholder' - const { hostname, pathname, hash } = new URL(url, `http://${placeholderHostname}`) - - // Don't modify a url with a FQDN or a url that's only a hash - if (hostname !== placeholderHostname || pathname === '/') { - return url - } - - const relativePage = ( - pathname.endsWith('.md') - ? pathname.replace(/\.md$/, '') - : relative(externalSiteUrl.pathname, pathname) - ).replace(/^\//, '') - - const page = pageMap.find(({ remoteFile }) => `${relativePage}.md` === remoteFile) - - // If we have a mapping for this page, use the mapped path - if (page) { - return page.slug + hash - } - - // If we don't have this page in our docs, link to original docs - return `${externalSite}/${relativePage}${hash}` - } catch (err) { - console.error('Error transforming markdown URL', err) - return url - } -} - -const generateStaticParams = () => pageMap.map(({ slug }) => ({ slug })) -const generateMetadata = genGuideMeta(getContent) - -export default PythonClientDocs -export { generateStaticParams, generateMetadata } diff --git a/apps/docs/app/guides/cli/config/page.tsx b/apps/docs/app/guides/cli/config/page.tsx deleted file mode 100644 index 4707208e7e0..00000000000 --- a/apps/docs/app/guides/cli/config/page.tsx +++ /dev/null @@ -1,106 +0,0 @@ -import ReactMarkdown from 'react-markdown' -import { CodeBlock } from 'ui' -import { Heading } from 'ui/src/components/CustomHTMLElements' -import { type TOCHeader } from '~/components/GuidesTableOfContents' -import { genGuideMeta } from '~/features/docs/GuidesMdx.utils' -import { GuideTemplate, newEditLink } from '~/features/docs/GuidesMdx.template' -import type { Parameter } from '~/lib/refGenerator/refTypes' -import specFile from '~/spec/cli_v1_config.yaml' assert { type: 'yml' } - -const meta = { - title: 'Supabase CLI config', -} - -const generateMetadata = genGuideMeta(() => ({ - pathname: '/guides/cli/config', - meta, -})) - -const tocList: TOCHeader[] = [] -const content = specFile.info.tags.map((tag: { id: string; title: string }, id: number) => { - tocList.push({ id: `${id}`, text: tag.title, link: `${tag.id}-config`, level: 2 }) - return ( -
- {tag.title} Config - {specFile.parameters - .filter((param: Parameter) => param.tags && param.tags[0] === tag.id) - .map((parameter: Parameter, id: number) => { - tocList.push({ id: `${id}`, text: parameter.id, link: `#${parameter.id}`, level: 3 }) - return - })} -
- ) -}) - -const Config = () => { - const editLink = newEditLink('supabase/supabase/blob/master/apps/docs/spec/cli_v1_config.yaml') - - return ( - - {specFile.info.description} -
{content}
-
- ) -} - -function Info({ parameter }: { parameter: Parameter }) { - return ( -
-
- - {parameter.title} - - -
-
-
- - - - - - - - - - - - - - - -
NameDefaultRequired
{parameter.id}{parameter.default ? parameter.default.toString() : 'None'}{parameter.required !== undefined && parameter.required.toString()}
-
-
-

Description

- {parameter.description} -
- {parameter.usage && ( -
-

Usage

- - {parameter.usage} - -
- )} - {parameter.links && ( -
-

See also

-
    - {parameter.links.map((link) => ( -
  • - {link.name} -
  • - ))} -
-
- )} -
-
-
-
- ) -} - -export default Config -export { generateMetadata } diff --git a/apps/docs/app/guides/cli/github-action/[slug]/page.tsx b/apps/docs/app/guides/cli/github-action/[slug]/page.tsx deleted file mode 100644 index 5ec1e903952..00000000000 --- a/apps/docs/app/guides/cli/github-action/[slug]/page.tsx +++ /dev/null @@ -1,134 +0,0 @@ -import { type SerializeOptions } from 'next-mdx-remote/dist/types' -import { redirect } from 'next/navigation' -import { relative } from 'node:path' -import rehypeSlug from 'rehype-slug' - -import { genGuideMeta } from '~/features/docs/GuidesMdx.utils' -import { GuideTemplate, newEditLink } from '~/features/docs/GuidesMdx.template' -import { fetchRevalidatePerDay } from '~/features/helpers.fetch' -import { notFoundLink } from '~/features/recommendations/NotFound.utils' -import { UrlTransformFunction, linkTransform } from '~/lib/mdx/plugins/rehypeLinkTransform' -import remarkMkDocsAdmonition from '~/lib/mdx/plugins/remarkAdmonition' -import { removeTitle } from '~/lib/mdx/plugins/remarkRemoveTitle' -import remarkPyMdownTabs from '~/lib/mdx/plugins/remarkTabs' - -// We fetch these docs at build time from an external repo -const org = 'supabase' -const repo = 'setup-cli' -const branch = 'gh-pages' -const docsDir = 'docs' -const externalSite = 'https://supabase.github.io/setup-cli' - -// Each external docs page is mapped to a local page -const pageMap = [ - { - slug: 'generating-types', - meta: { - title: 'Generate types using GitHub Actions', - description: 'End-to-end type safety across client, server, and database.', - subtitle: 'End-to-end type safety across client, server, and database.', - tocVideo: 'VSNgAIObBdw', - }, - remoteFile: 'generating-types.md', - }, - { - slug: 'testing', - meta: { - title: 'Automated testing using GitHub Actions', - description: 'Run your tests when you or your team make changes.', - subtitle: 'Run your tests when you or your team make changes.', - }, - remoteFile: 'testing.md', - }, - { - slug: 'backups', - meta: { - title: 'Automated backups using GitHub Actions', - description: 'Backup your database on a regular basis.', - subtitle: 'Backup your database on a regular basis.', - }, - remoteFile: 'backups.md', - }, -] - -type Params = { slug: string } - -const ActionDocs = async ({ params }: { params: Params }) => { - const { meta, ...data } = await getContent(params) - - const options = { - mdxOptions: { - remarkPlugins: [remarkMkDocsAdmonition, remarkPyMdownTabs, [removeTitle, meta.title]], - rehypePlugins: [[linkTransform, urlTransform], rehypeSlug], - }, - } as SerializeOptions - - return -} - -/** - * Fetch markdown from external repo - */ -const getContent = async ({ slug }: Params) => { - const page = pageMap.find(({ slug: validSlug }) => validSlug && validSlug === slug) - - if (!page) { - redirect(notFoundLink(`cli/github-action/${slug}`)) - } - - const { remoteFile, meta } = page - - const editLink = newEditLink(`${org}/${repo}/blob/${branch}/${docsDir}/${remoteFile}`) - - const response = await fetchRevalidatePerDay( - `https://raw.githubusercontent.com/${org}/${repo}/${branch}/${docsDir}/${remoteFile}` - ) - - const content = await response.text() - - return { - pathname: `/guides/cli/github-action/${slug}` satisfies `/${string}`, - meta, - content, - editLink, - } -} - -const urlTransform: UrlTransformFunction = (url) => { - try { - const externalSiteUrl = new URL(externalSite) - - const placeholderHostname = 'placeholder' - const { hostname, pathname, hash } = new URL(url, `http://${placeholderHostname}`) - - // Don't modify a url with a FQDN or a url that's only a hash - if (hostname !== placeholderHostname || pathname === '/') { - return url - } - - const relativePage = ( - pathname.endsWith('.md') - ? pathname.replace(/\.md$/, '') - : relative(externalSiteUrl.pathname, pathname) - ).replace(/^\//, '') - - const page = pageMap.find(({ remoteFile }) => `${relativePage}.md` === remoteFile) - - // If we have a mapping for this page, use the mapped path - if (page) { - return page.slug + hash - } - - // If we don't have this page in our docs, link to original docs - return `${externalSite}/${relativePage}${hash}` - } catch (err) { - console.error('Error transforming markdown URL', err) - return url - } -} - -const generateStaticParams = () => pageMap.map(({ slug }) => ({ slug })) -const generateMetadata = genGuideMeta(getContent) - -export default ActionDocs -export { generateStaticParams, generateMetadata } diff --git a/apps/docs/app/guides/database/database-advisors/page.tsx b/apps/docs/app/guides/database/database-advisors/page.tsx deleted file mode 100644 index dd4b0816acc..00000000000 --- a/apps/docs/app/guides/database/database-advisors/page.tsx +++ /dev/null @@ -1,161 +0,0 @@ -import { Octokit } from '@octokit/core' -import { capitalize } from 'lodash' -import { type SerializeOptions } from 'next-mdx-remote/dist/types' -import rehypeSlug from 'rehype-slug' - -import { Heading } from 'ui' - -import { genGuideMeta } from '~/features/docs/GuidesMdx.utils' -import { GuideTemplate, MDXRemoteGuides, newEditLink } from '~/features/docs/GuidesMdx.template' -import { fetchRevalidatePerDay } from '~/features/helpers.fetch' -import { Tabs, TabPanel } from '~/features/ui/Tabs' -import { UrlTransformFunction, linkTransform } from '~/lib/mdx/plugins/rehypeLinkTransform' -import remarkMkDocsAdmonition from '~/lib/mdx/plugins/remarkAdmonition' -import { removeTitle } from '~/lib/mdx/plugins/remarkRemoveTitle' -import remarkPyMdownTabs from '~/lib/mdx/plugins/remarkTabs' - -// We fetch these docs at build time from an external repo -const org = 'supabase' -const repo = 'splinter' -const branch = 'main' -const docsDir = 'docs' - -const meta = { - title: 'Performance and Security Advisors', - subtitle: 'Check your database for performance and security issues', -} - -const generateMetadata = genGuideMeta(() => ({ - pathname: '/guides/database/database-linter', - meta, -})) - -const editLink = newEditLink('supabase/splinter/tree/main/docs') - -const markdownIntro = ` -You can use the Database Performance and Security Advisors to check your database for issues such as missing indexes and improperly set-up RLS policies. - -## Using the Advisors - -In the dashboard, navigate to [Security Advisor](https://supabase.com/dashboard/project/_/database/security-advisor) and [Performance Advisor](https://supabase.com/dashboard/project/_/database/performance-advisor) under Database. The advisors run automatically. You can also manually rerun them after you've resolved issues. -`.trim() - -const getBasename = (path: string) => path.split('/').at(-1)!.replace(/\.md$/, '') - -const DatabaseAdvisorDocs = async () => { - const { lints, lintsList } = await getLints() - - const options = { - mdxOptions: { - remarkPlugins: [remarkMkDocsAdmonition, remarkPyMdownTabs, [removeTitle, meta.title]], - rehypePlugins: [[linkTransform, urlTransform(lintsList)], rehypeSlug], - }, - } as SerializeOptions - - return ( - - - Available checks - - {lints.map((lint) => ( - -
- -
-
- ))} -
-
- ) -} - -/** - * The GitHub repo uses relative links, which don't lead to the right locations - * in docs. - * - * @param url The original link, as written in the Markdown file - * @returns The rewritten link - */ -const urlTransform: (lints: Array<{ path: string }>) => UrlTransformFunction = (lints) => (url) => { - try { - const placeholderHostname = 'placeholder' - const { hostname, pathname, hash } = new URL(url, `http://${placeholderHostname}`) - - // Don't modify a url with a FQDN or a url that's only a hash - if (hostname !== placeholderHostname || pathname === '/') { - return url - } - - const relativePath = getBasename(pathname) - const section = lints.find(({ path }) => path === relativePath) - - if (section) { - const url = new URL(window.location.href) - url.searchParams.set('lint', relativePath) - return url.toString() - } - - // If we don't have this page in our docs, link to GitHub repo - return `https://github.com/${org}/${repo}/blob/${branch}${pathname}${hash}` - } catch (err) { - console.error('Error transforming markdown URL', err) - return url - } -} - -/** - * Fetch lint remediation Markdown from external repo - */ -const getLints = async () => { - const octokit = new Octokit({ request: { fetch: fetchRevalidatePerDay } }) - - const response = await octokit.request('GET /repos/{owner}/{repo}/contents/{path}', { - owner: org, - repo: repo, - path: docsDir, - ref: branch, - headers: { - 'X-GitHub-Api-Version': '2022-11-28', - }, - }) - - if (response.status >= 400) { - throw Error(`Could not get contents of repo ${org}/${repo}`) - } - - if (!Array.isArray(response.data)) { - throw Error( - 'Reading a directory, not a file. Should not reach this, solely to appease Typescript.' - ) - } - - const lintsList = response.data.filter(({ path }) => /docs\/\d+.+\.md$/.test(path)) - - const lints = await Promise.all( - lintsList.map(async ({ path }) => { - const fileResponse = await fetchRevalidatePerDay( - `https://raw.githubusercontent.com/${org}/${repo}/${branch}/${path}` - ) - - if (fileResponse.status >= 400) { - throw Error(`Could not get contents of file ${org}/${repo}/${path}`) - } - - const content = await fileResponse.text() - - return { - path: getBasename(path), - content, - } - }) - ) - - return { lints, lintsList } -} - -export default DatabaseAdvisorDocs -export { generateMetadata } diff --git a/apps/docs/app/guides/database/extensions/wrappers/[[...slug]]/page.tsx b/apps/docs/app/guides/database/extensions/wrappers/[[...slug]]/page.tsx deleted file mode 100644 index 836657bce71..00000000000 --- a/apps/docs/app/guides/database/extensions/wrappers/[[...slug]]/page.tsx +++ /dev/null @@ -1,222 +0,0 @@ -import matter from 'gray-matter' -import { type SerializeOptions } from 'next-mdx-remote/dist/types' -import { readFile } from 'node:fs/promises' -import { join, relative } from 'node:path' -import rehypeSlug from 'rehype-slug' -import emoji from 'remark-emoji' - -import { genGuideMeta, genGuidesStaticParams } from '~/features/docs/GuidesMdx.utils' -import { GuideTemplate, newEditLink } from '~/features/docs/GuidesMdx.template' -import { fetchRevalidatePerDay } from '~/features/helpers.fetch' -import { GUIDES_DIRECTORY, isValidGuideFrontmatter } from '~/lib/docs' -import { UrlTransformFunction, linkTransform } from '~/lib/mdx/plugins/rehypeLinkTransform' -import remarkMkDocsAdmonition from '~/lib/mdx/plugins/remarkAdmonition' -import { removeTitle } from '~/lib/mdx/plugins/remarkRemoveTitle' -import remarkPyMdownTabs from '~/lib/mdx/plugins/remarkTabs' - -// We fetch these docs at build time from an external repo -const org = 'supabase' -const repo = 'wrappers' -const branch = 'main' -const docsDir = 'docs' -const externalSite = 'https://supabase.github.io/wrappers' - -// Each external docs page is mapped to a local page -const pageMap = [ - { - slug: 'airtable', - meta: { - title: 'Airtable', - }, - remoteFile: 'airtable.md', - }, - { - slug: 'auth0', - meta: { - title: 'Auth0', - }, - remoteFile: 'auth0.md', - }, - { - slug: 'bigquery', - meta: { - title: 'BigQuery', - }, - remoteFile: 'bigquery.md', - }, - { - slug: 'clickhouse', - meta: { - title: 'ClickHouse', - }, - remoteFile: 'clickhouse.md', - }, - { - slug: 'cognito', - meta: { - title: 'AWS Cognito', - }, - remoteFile: 'cognito.md', - }, - { - slug: 'firebase', - meta: { - title: 'Firebase', - }, - remoteFile: 'firebase.md', - }, - { - slug: 'logflare', - meta: { - title: 'Logflare', - }, - remoteFile: 'logflare.md', - }, - { - slug: 'mssql', - meta: { - title: 'MSSQL', - }, - remoteFile: 'mssql.md', - }, - { - slug: 'redis', - meta: { - title: 'Redis', - }, - remoteFile: 'redis.md', - }, - { - slug: 's3', - meta: { - title: 'AWS S3', - }, - remoteFile: 's3.md', - }, - { - slug: 'stripe', - meta: { - title: 'Stripe', - }, - remoteFile: 'stripe.md', - }, -] - -interface Params { - slug?: string[] -} - -const WrappersDocs = async ({ params }: { params: Params }) => { - const { isExternal, meta, ...data } = await getContent(params) - - const options = isExternal - ? ({ - mdxOptions: { - remarkPlugins: [ - remarkMkDocsAdmonition, - emoji, - remarkPyMdownTabs, - [removeTitle, meta.title], - ], - rehypePlugins: [[linkTransform, urlTransform], rehypeSlug], - }, - } as SerializeOptions) - : undefined - - return -} - -/** - * Fetch markdown from external repo - */ -const getContent = async (params: Params) => { - const federatedPage = pageMap.find( - ({ slug }) => params && slug && params.slug && slug === params.slug.at(0) - ) - - let isExternal: boolean - let meta: any - let content: string - let editLink: string - - if (!federatedPage) { - isExternal = false - editLink = `supabase/supabase/apps/docs/content/guides/database/extensions/wrappers${params.slug?.length ? `/${params.slug.join('/')}` : ''}.mdx` - const rawContent = await readFile( - join( - GUIDES_DIRECTORY, - 'database', - 'extensions', - `wrappers${params.slug?.length ? `/${params.slug.join('/')}` : ''}.mdx` - ), - 'utf-8' - ) - ;({ data: meta, content } = matter(rawContent)) - if (!isValidGuideFrontmatter(meta)) { - throw Error(`Expected valid frontmatter, got ${JSON.stringify(meta, null, 2)}`) - } - } else { - isExternal = true - let remoteFile: string - ;({ remoteFile, meta } = federatedPage) - const repoPath = `${org}/${repo}/${branch}/${docsDir}/${remoteFile}` - editLink = `${org}/${repo}/blob/${branch}/${docsDir}/${remoteFile}` - const response = await fetchRevalidatePerDay(`https://raw.githubusercontent.com/${repoPath}`) - content = await response.text() - } - - return { - pathname: - `/guides/database/extensions/wrappers${params.slug?.length ? `/${params.slug.join('/')}` : ''}` satisfies `/${string}`, - isExternal, - editLink: newEditLink(editLink), - meta, - content, - } -} - -const urlTransform: UrlTransformFunction = (url) => { - try { - const externalSiteUrl = new URL(externalSite) - - const placeholderHostname = 'placeholder' - const { hostname, pathname, hash } = new URL(url, `http://${placeholderHostname}`) - - // Don't modify a url with a FQDN or a url that's only a hash - if (hostname !== placeholderHostname || pathname === '/') { - return url - } - const relativePage = ( - pathname.endsWith('.md') - ? pathname.replace(/\.md$/, '') - : relative(externalSiteUrl.pathname, pathname) - ).replace(/^\//, '') - - const page = pageMap.find(({ remoteFile }) => `${relativePage}.md` === remoteFile) - - // If we have a mapping for this page, use the mapped path - if (page) { - return page.slug + hash - } - - // If we don't have this page in our docs, link to original docs - return `${externalSite}/${relativePage}${hash}` - } catch (err) { - console.error('Error transforming markdown URL', err) - return url - } -} - -const generateStaticParams = async () => { - const mdxPaths = await genGuidesStaticParams('database/extensions/wrappers')() - const federatedPaths = pageMap.map(({ slug }) => ({ - slug: [slug], - })) - - return [...mdxPaths, ...federatedPaths] -} - -const generateMetadata = genGuideMeta(getContent) - -export default WrappersDocs -export { generateStaticParams, generateMetadata } diff --git a/apps/docs/app/guides/graphql/[[...slug]]/page.tsx b/apps/docs/app/guides/graphql/[[...slug]]/page.tsx deleted file mode 100644 index 0034e6beece..00000000000 --- a/apps/docs/app/guides/graphql/[[...slug]]/page.tsx +++ /dev/null @@ -1,194 +0,0 @@ -import { type SerializeOptions } from 'next-mdx-remote/dist/types' -import { redirect } from 'next/navigation' -import { isAbsolute, relative } from 'path' -import rehypeSlug from 'rehype-slug' - -import { genGuideMeta } from '~/features/docs/GuidesMdx.utils' -import { GuideTemplate, newEditLink } from '~/features/docs/GuidesMdx.template' -import { fetchRevalidatePerDay } from '~/features/helpers.fetch' -import { notFoundLink } from '~/features/recommendations/NotFound.utils' -import { UrlTransformFunction, linkTransform } from '~/lib/mdx/plugins/rehypeLinkTransform' -import remarkMkDocsAdmonition from '~/lib/mdx/plugins/remarkAdmonition' -import { removeTitle } from '~/lib/mdx/plugins/remarkRemoveTitle' -import remarkPyMdownTabs from '~/lib/mdx/plugins/remarkTabs' - -// We fetch these docs at build time from an external repo -const org = 'supabase' -const repo = 'pg_graphql' -const branch = 'master' -const docsDir = 'docs' -const externalSite = 'https://supabase.github.io/pg_graphql' - -// Each external docs page is mapped to a local page -const pageMap = [ - { - meta: { - id: 'graphql-overview', - title: 'GraphQL', - subtitle: 'Autogenerated GraphQL APIs with Postgres.', - }, - remoteFile: 'supabase.md', - }, - { - slug: 'api', - meta: { - id: 'graphql-api', - title: 'GraphQL API', - subtitle: 'Understanding the core concepts of the GraphQL API.', - }, - remoteFile: 'api.md', - }, - { - slug: 'views', - meta: { - id: 'graphql-views', - title: 'Views', - subtitle: 'Using Postgres Views with GraphQL.', - }, - remoteFile: 'views.md', - }, - { - slug: 'functions', - meta: { - id: 'graphql-functions', - title: 'Functions', - subtitle: 'Using Postgres Functions with GraphQL.', - }, - remoteFile: 'functions.md', - }, - { - slug: 'computed-fields', - meta: { - id: 'graphql-computed-fields', - title: 'Computed Fields', - subtitle: 'Using Postgres Computed Fields with GraphQL.', - }, - remoteFile: 'computed-fields.md', - }, - { - slug: 'configuration', - meta: { - id: 'graphql-configuration', - title: 'Configuration & Customization', - subtitle: 'Extra configuration options can be set on SQL entities using comment directives.', - }, - remoteFile: 'configuration.md', - }, - { - slug: 'security', - meta: { - id: 'graphql-security', - title: 'Security', - subtitle: 'Securing your GraphQL API.', - }, - remoteFile: 'security.md', - }, - { - slug: 'with-apollo', - meta: { - id: 'graphql-with-apollo', - title: 'With Apollo', - subtitle: 'Using pg_grapqhl with Apollo.', - }, - remoteFile: 'usage_with_apollo.md', - }, - { - slug: 'with-relay', - meta: { - id: 'graphql-with-relay', - title: 'With Relay', - subtitle: 'Using pg_grapqhl with Relay.', - }, - remoteFile: 'usage_with_relay.md', - }, -] - -interface Params { - slug?: string[] -} - -const PGGraphQLDocs = async ({ params }: { params: Params }) => { - const { meta, ...data } = await getContent(params) - - const options = { - mdxOptions: { - remarkPlugins: [remarkMkDocsAdmonition, remarkPyMdownTabs, [removeTitle, meta.title]], - rehypePlugins: [[linkTransform, urlTransform], rehypeSlug], - }, - } as SerializeOptions - - return -} - -/** - * Fetch markdown from external repo and transform links - */ -const getContent = async ({ slug }: Params) => { - const page = pageMap.find((page) => page.slug === slug?.at(0)) - - if (!page) { - redirect(notFoundLink(`graphql/${slug ? slug.join('/') : ''}`)) - } - - const { remoteFile, meta } = page - - const editLink = newEditLink(`${org}/${repo}/blob/${branch}/${docsDir}/${remoteFile}`) - - const response = await fetchRevalidatePerDay( - `https://raw.githubusercontent.com/${org}/${repo}/${branch}/${docsDir}/${remoteFile}` - ) - - const content = await response.text() - - return { - pathname: `/guides/graphql${slug?.length ? `/${slug.join('/')}` : ''}` satisfies `/${string}`, - meta, - content, - editLink, - } -} - -const urlTransform: UrlTransformFunction = (url) => { - try { - const externalSiteUrl = new URL(externalSite) - - const placeholderHostname = 'placeholder' - const { hostname, pathname, hash } = new URL(url, `http://${placeholderHostname}`) - - // Don't modify a url with a FQDN or a url that's only a hash - if (hostname !== placeholderHostname || pathname === '/') { - return url - } - - const getRelativePath = () => { - if (pathname.endsWith('.md')) { - return pathname.replace(/\.md$/, '') - } - if (isAbsolute(url)) { - return relative(externalSiteUrl.pathname, pathname) - } - return pathname - } - - const relativePath = getRelativePath().replace(/^\//, '') - - const page = pageMap.find(({ remoteFile }) => `${relativePath}.md` === remoteFile) - - // If we have a mapping for this page, use the mapped path - if (page) { - return 'graphql/' + page.slug + hash - } - - // If we don't have this page in our docs, link to original docs - return `${externalSite}/${relativePath}${hash}` - } catch (err) { - console.error('Error transforming markdown URL', err) - return url - } -} - -const generateStaticParams = async () => pageMap.map(({ slug }) => ({ slug: slug ? [slug] : [] })) -const generateMetadata = genGuideMeta(getContent) - -export default PGGraphQLDocs -export { generateStaticParams, generateMetadata } diff --git a/apps/docs/app/guides/layout.tsx b/apps/docs/app/guides/layout.tsx deleted file mode 100644 index 1c479c6a6d7..00000000000 --- a/apps/docs/app/guides/layout.tsx +++ /dev/null @@ -1,50 +0,0 @@ -'use client' - -import { usePathname } from 'next/navigation' -import { type PropsWithChildren } from 'react' -import { MenuId } from '~/components/Navigation/NavigationMenu/NavigationMenu' -import Layout from '~/layouts/guides' - -const GuidesLayout = ({ children }: PropsWithChildren) => { - const pathname = usePathname() - const menuId = getMenuId(pathname) - - return {children} -} - -export const getMenuId = (pathname: string | null) => { - pathname = (pathname ??= '').replace(/^\/guides\//, '') - - switch (true) { - case pathname.startsWith('ai'): - return MenuId.Ai - case pathname.startsWith('api'): - return MenuId.Api - case pathname.startsWith('auth'): - return MenuId.Auth - case pathname.startsWith('cli'): - return MenuId.Cli - case pathname.startsWith('database'): - return MenuId.Database - case pathname.startsWith('functions'): - return MenuId.Functions - case pathname.startsWith('getting-started'): - return MenuId.GettingStarted - case pathname.startsWith('graphql'): - return MenuId.Graphql - case pathname.startsWith('platform'): - return MenuId.Platform - case pathname.startsWith('realtime'): - return MenuId.Realtime - case pathname.startsWith('resources'): - return MenuId.Resources - case pathname.startsWith('self-hosting'): - return MenuId.SelfHosting - case pathname.startsWith('storage'): - return MenuId.Storage - default: - return MenuId.GettingStarted - } -} - -export default GuidesLayout diff --git a/apps/docs/app/guides/platform/terraform/[[...slug]]/page.tsx b/apps/docs/app/guides/platform/terraform/[[...slug]]/page.tsx deleted file mode 100644 index f9cbcc62a0c..00000000000 --- a/apps/docs/app/guides/platform/terraform/[[...slug]]/page.tsx +++ /dev/null @@ -1,142 +0,0 @@ -import matter from 'gray-matter' -import { type SerializeOptions } from 'next-mdx-remote/dist/types' -import { redirect } from 'next/navigation' -import rehypeSlug from 'rehype-slug' -import { genGuideMeta } from '~/features/docs/GuidesMdx.utils' -import { GuideTemplate, newEditLink } from '~/features/docs/GuidesMdx.template' -import { fetchRevalidatePerDay } from '~/features/helpers.fetch' -import { notFoundLink } from '~/features/recommendations/NotFound.utils' -import { isValidGuideFrontmatter } from '~/lib/docs' -import { UrlTransformFunction, linkTransform } from '~/lib/mdx/plugins/rehypeLinkTransform' -import remarkMkDocsAdmonition from '~/lib/mdx/plugins/remarkAdmonition' -import { removeTitle } from '~/lib/mdx/plugins/remarkRemoveTitle' -import remarkPyMdownTabs from '~/lib/mdx/plugins/remarkTabs' -import { - terraformDocsBranch, - terraformDocsDocsDir, - terraformDocsOrg, - terraformDocsRepo, -} from '../terraformConstants' - -// Each external docs page is mapped to a local page -const pageMap = [ - { - remoteFile: 'README.md', - meta: { - title: 'Terraform Provider', - }, - useRoot: true, - }, - { - slug: 'tutorial', - remoteFile: 'tutorial.md', - meta: { - title: 'Using the Supabase Terraform Provider', - }, - }, -] - -interface Params { - slug?: string[] -} - -const TerraformDocs = async ({ params }: { params: Params }) => { - const { meta, ...data } = await getContent(params) - - const options = { - mdxOptions: { - remarkPlugins: [remarkMkDocsAdmonition, remarkPyMdownTabs, [removeTitle, meta.title]], - rehypePlugins: [[linkTransform, urlTransform], rehypeSlug], - }, - } as SerializeOptions - - return -} - -/** - * The GitHub repo uses relative links, which don't lead to the right locations - * in docs. - * - * @param url The original link, as written in the Markdown file - * @returns The rewritten link - */ -const urlTransform: UrlTransformFunction = (url: string) => { - try { - const placeholderHostname = 'placeholder' - const { hostname, pathname, hash } = new URL(url, `http://${placeholderHostname}`) - - // Don't modify a url with a FQDN or a url that's only a hash - if (hostname !== placeholderHostname || pathname === '/') { - return url - } - - const getBasename = (pathname: string) => - pathname.endsWith('.md') ? pathname.replace(/\.md$/, '') : pathname - const stripLeadingPrefix = (pathname: string) => pathname.replace(/^\//, '') - const stripLeadingDocs = (pathname: string) => pathname.replace(/^docs\//, '') - - const relativePath = stripLeadingPrefix(getBasename(pathname)) - - const page = pageMap.find( - ({ remoteFile, useRoot }) => - (useRoot && `${relativePath}.md` === remoteFile) || - (!useRoot && `${stripLeadingDocs(relativePath)}.md` === remoteFile) - ) - - if (page) { - return 'terraform' + `/${page.slug}` + hash - } - - // If we don't have this page in our docs, link to GitHub repo - return `https://github.com/${terraformDocsOrg}/${terraformDocsRepo}/blob/${terraformDocsBranch}${pathname}${hash}` - } catch (err) { - console.error('Error transforming markdown URL', err) - return url - } -} - -/** - * Fetch markdown from external repo - */ -const getContent = async ({ slug }: Params) => { - const [requestedSlug] = slug ?? [] - const page = pageMap.find((page) => page.slug === requestedSlug) - - if (!page) { - redirect(notFoundLink('platform/terraform' + (slug?.join('/') ?? ''))) - } - - const { meta, remoteFile, useRoot } = page - - const editLink = newEditLink( - `${terraformDocsOrg}/${terraformDocsRepo}/blob/${terraformDocsBranch}/${useRoot ? '' : `${terraformDocsDocsDir}/`}${remoteFile}` - ) - - let response = await fetchRevalidatePerDay( - `https://raw.githubusercontent.com/${terraformDocsOrg}/${terraformDocsRepo}/${terraformDocsBranch}/${useRoot ? '' : `${terraformDocsDocsDir}/`}${remoteFile}` - ) - - let rawContent = await response.text() - // Strip out HTML comments - rawContent = rawContent.replace(//, '') - const { content, data } = matter(rawContent) - Object.assign(meta, data) - - if (!isValidGuideFrontmatter(meta)) { - throw Error('Guide frontmatter is invalid.') - } - - return { - pathname: - `/guides/platform/terraform${slug?.length ? `/${slug.join('/')}` : ''}` satisfies `/${string}`, - meta, - content, - editLink, - } -} - -const generateStaticParams = async () => pageMap.map(({ slug }) => ({ slug: slug ? [slug] : [] })) -const generateMetadata = genGuideMeta(getContent) - -export default TerraformDocs -export { generateStaticParams, generateMetadata } diff --git a/apps/docs/app/guides/platform/terraform/reference/page.tsx b/apps/docs/app/guides/platform/terraform/reference/page.tsx deleted file mode 100644 index c251d8133ea..00000000000 --- a/apps/docs/app/guides/platform/terraform/reference/page.tsx +++ /dev/null @@ -1,410 +0,0 @@ -import { codeBlock } from 'common-tags' -import { Check, PlusCircle } from 'lucide-react' -import Link from 'next/link' -import ReactMarkdown from 'react-markdown' - -import { - CodeBlock, - Heading, - PopoverContent_Shadcn_, - PopoverTrigger_Shadcn_, - Popover_Shadcn_, -} from 'ui' - -import { genGuideMeta } from '~/features/docs/GuidesMdx.utils' -import { GuideTemplate, newEditLink } from '~/features/docs/GuidesMdx.template' -import { fetchRevalidatePerDay } from '~/features/helpers.fetch' -import { TabPanel, Tabs } from '~/features/ui/Tabs' -import { - terraformDocsBranch, - terraformDocsDocsDir, - terraformDocsOrg, - terraformDocsRepo, -} from '../terraformConstants' - -const meta = { - title: 'Terraform Provider reference', - subtitle: 'Resources and data sources available through the Terraform Provider', -} - -const generateMetadata = genGuideMeta(() => ({ - pathname: '/guides/platform/terraform/reference', - meta, -})) - -function ProviderSettings({ schema }: { schema: any }) { - const attributes = schema.block.attributes - - const example = codeBlock` - provider "supabase" { - ${Object.keys(attributes).map( - (attribute) => - `${attribute} = ${attributes[attribute].type === 'string' ? `""` : ''}` - )} - } - ` - - return ( -
- Provider settings -

- Use these settings to configure your Supabase provider and authenticate to your Supabase - project. -

- Example usage - {example} - Details - {/* extra div because width restriction doesn't work on table itself */} -
- - - - - - - - - - - - {Object.keys(schema.block.attributes).map((attribute) => ( - - - - - - - - ))} - -
AttributeDescriptionTypeOptionalSensitive
{attribute} - {attributes[attribute].description} - {attributes[attribute].type} - {attributes[attribute].optional && ( - <> - - true - - )} - - {attributes[attribute].sensitive && ( - <> - - true - - )} -
-
-
- ) -} - -function Resources({ schema }: { schema: any }) { - return ( -
- Resources -

You can configure these resources using the Supabase Terraform provider:

- - {Object.keys(schema).map((resource) => ( - - Example usage - {codeBlock` - resource "${resource}" " - Details - - - - - - - - - - - - - {Object.keys(schema[resource].block.attributes).map((attribute) => ( - - - - - - - - - ))} - -
AttributeDescriptionTypeRequiredOptionalRead-only
- {attribute} - - - {schema[resource].block.attributes[attribute].description} - - - {schema[resource].block.attributes[attribute].type ?? ( - - - - - -
    - {Object.keys( - schema[resource].block.attributes[attribute].nested_type.attributes - ).map((nestedAttribute) => ( -
  • - {nestedAttribute} -
      -
    • - - { - schema[resource].block.attributes[attribute].nested_type - .attributes[nestedAttribute].description - } - -
    • -
    • - {schema[resource].block.attributes[attribute].nested_type - .attributes[nestedAttribute].type ?? 'nested type'} -
    • - {schema[resource].block.attributes[attribute].nested_type - .attributes[nestedAttribute].required &&
    • Required
    • } - {schema[resource].block.attributes[attribute].nested_type - .attributes[nestedAttribute].optional &&
    • Optional
    • } - {schema[resource].block.attributes[attribute].nested_type - .attributes[nestedAttribute].computed &&
    • Read-only
    • } -
    -
  • - ))} -
-
-
- )} -
- {schema[resource].block.attributes[attribute].required && ( - <> - - true - - )} - - {schema[resource].block.attributes[attribute].optional && ( - <> - - true - - )} - - {schema[resource].block.attributes[attribute].computed && ( - <> - - true - - )} -
-
- ))} -
-
- ) -} - -function DataSources({ schema }: { schema: any }) { - return ( -
- Data sources -

You can read these resources using the Supabase Terraform provider:

- - {Object.keys(schema).map((dataSource) => ( - - Example usage - {codeBlock` - resource "${dataSource}" "all" { - ${Object.keys(schema[dataSource].block.attributes) - .filter( - (attribute) => !schema[dataSource].block.attributes[attribute].computed - ) - .map( - (attribute) => - `${attribute} = ${ - schema[dataSource].block.attributes[attribute].type === 'string' - ? `""` - : '' - }` - )} - } - `} - Details - - - - - - - - - - - - - {Object.keys(schema[dataSource].block.attributes).map((attribute) => ( - - - - - - - - - ))} - -
AttributeDescriptionTypeRequiredOptionalRead-only
- {attribute} - - - {schema[dataSource].block.attributes[attribute].description} - - - {schema[dataSource].block.attributes[attribute].type ?? ( - - - - - - {schema[dataSource].block.attributes[attribute].nested_type - .nesting_mode === 'set' && 'Array of:'} -
    - {Object.keys( - schema[dataSource].block.attributes[attribute].nested_type - .attributes - ).map((nestedAttribute) => ( -
  • - {nestedAttribute} -
      -
    • - - { - schema[dataSource].block.attributes[attribute].nested_type - .attributes[nestedAttribute].description - } - -
    • -
    • - {schema[dataSource].block.attributes[attribute].nested_type - .attributes[nestedAttribute].type ?? 'nested type'} -
    • - {schema[dataSource].block.attributes[attribute].nested_type - .attributes[nestedAttribute].required &&
    • Required
    • } - {schema[dataSource].block.attributes[attribute].nested_type - .attributes[nestedAttribute].optional &&
    • Optional
    • } - {schema[dataSource].block.attributes[attribute].nested_type - .attributes[nestedAttribute].computed &&
    • Read-only
    • } -
    -
  • - ))} -
-
-
- )} -
- {schema[dataSource].block.attributes[attribute].required && ( - <> - - true - - )} - - {schema[dataSource].block.attributes[attribute].optional && ( - <> - - true - - )} - - {schema[dataSource].block.attributes[attribute].computed && ( - <> - - true - - )} -
-
- ))} -
-
- ) -} - -const TerraformReferencePage = async () => { - const { schema } = await getSchema() - - const editLink = newEditLink('supabase/terraform-provider-supabase') - - return ( - - The Terraform Provider provices access to{' '} - - resources - {' '} - and{' '} - - data sources - - . Resources are infrastructure objects, such as a Supabase project, that you can declaratively - configure. Data sources are sources of information about your Supabase instances. - - - - - ) -} - -/** - * Fetch JSON schema from external repo - */ -const getSchema = async () => { - let response = await fetchRevalidatePerDay( - `https://raw.githubusercontent.com/${terraformDocsOrg}/${terraformDocsRepo}/${terraformDocsBranch}/${terraformDocsDocsDir}/schema.json` - ) - if (!response.ok) throw Error('Failed to fetch Terraform JSON schema from GitHub') - - const schema = await response.json() - - return { - schema, - } -} - -export default TerraformReferencePage -export { generateMetadata } diff --git a/apps/docs/app/guides/platform/terraform/terraformConstants.ts b/apps/docs/app/guides/platform/terraform/terraformConstants.ts deleted file mode 100644 index 0cc7ad3125b..00000000000 --- a/apps/docs/app/guides/platform/terraform/terraformConstants.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Information on where to fetch docs content - */ -const terraformDocsOrg = 'supabase' -const terraformDocsRepo = 'terraform-provider-supabase' -const terraformDocsBranch = 'v1.1.3' -const terraformDocsDocsDir = 'docs' - -export { terraformDocsOrg, terraformDocsRepo, terraformDocsBranch, terraformDocsDocsDir } diff --git a/apps/docs/app/guides/self-hosting/analytics/config/page.tsx b/apps/docs/app/guides/self-hosting/analytics/config/page.tsx deleted file mode 100644 index c1b4adc6290..00000000000 --- a/apps/docs/app/guides/self-hosting/analytics/config/page.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import Param from '~/components/Params' -import { genGuideMeta } from '~/features/docs/GuidesMdx.utils' -import { GuideTemplate, MDXRemoteGuides, newEditLink } from '~/features/docs/GuidesMdx.template' -import specAnalyticsV0 from '~/spec/analytics_v0_config.yaml' assert { type: 'yml' } - -const meta = { - title: 'Analytics Self-hosting Config', - description: 'How to configure and deploy Supabase Analytics.', -} - -const generateMetadata = genGuideMeta(() => ({ - pathname: '/guides/self-hosting/analytics/config', - meta, -})) - -const AnalyticsConfigPage = async () => { - const descriptionMdx = specAnalyticsV0.info.description - - return ( - - - -
- {specAnalyticsV0.info.tags.map( - (tag: ReturnType['info']['tags']) => { - return ( - <> -

{tag.title}

-

{tag.description}

-
-
Parameters
-
    - {specAnalyticsV0.parameters - .filter((param: ReturnType['parameters']) => - param.tags.includes(tag.id) - ) - .map((param: ReturnType['parameters']) => { - return ( - - ) - })} -
-
- - ) - } - )} -
-
- ) -} - -export default AnalyticsConfigPage -export { generateMetadata } diff --git a/apps/docs/app/guides/self-hosting/auth/config/page.tsx b/apps/docs/app/guides/self-hosting/auth/config/page.tsx deleted file mode 100644 index c4a2bf5d8a7..00000000000 --- a/apps/docs/app/guides/self-hosting/auth/config/page.tsx +++ /dev/null @@ -1,62 +0,0 @@ -import Param from '~/components/Params' -import { genGuideMeta } from '~/features/docs/GuidesMdx.utils' -import { GuideTemplate, MDXRemoteGuides, newEditLink } from '~/features/docs/GuidesMdx.template' -import specAuthV1 from '~/spec/gotrue_v1_config.yaml' assert { type: 'yml' } - -const meta = { - title: 'Auth Self-hosting Config', - description: 'How to configure and deploy Supabase Auth.', -} - -const generateMetadata = genGuideMeta(() => ({ - pathname: '/guides/self-hosting/auth/config', - meta, -})) - -const AuthConfigPage = async () => { - const descriptionMdx = specAuthV1.info.description - - return ( - - - -
- {specAuthV1.info.tags.map((tag: ReturnType['info']['tags']) => { - return ( - <> -

{tag.title}

-

{tag.description}

-
-
Parameters
-
    - {specAuthV1.parameters - .filter((param: ReturnType['parameters']) => - param.tags.includes(tag.id) - ) - .map((param: ReturnType['parameters']) => { - return ( - - ) - })} -
-
- - ) - })} -
-
- ) -} - -export default AuthConfigPage -export { generateMetadata } diff --git a/apps/docs/app/guides/self-hosting/realtime/config/page.tsx b/apps/docs/app/guides/self-hosting/realtime/config/page.tsx deleted file mode 100644 index 3fd7ba9e09a..00000000000 --- a/apps/docs/app/guides/self-hosting/realtime/config/page.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import Param from '~/components/Params' -import { genGuideMeta } from '~/features/docs/GuidesMdx.utils' -import { GuideTemplate, MDXRemoteGuides, newEditLink } from '~/features/docs/GuidesMdx.template' -import specRealtimeV0 from '~/spec/realtime_v0_config.yaml' assert { type: 'yml' } - -const meta = { - title: 'Realtime Self-hosting Config', - description: 'How to configure and deploy Supabase Realtime.', -} - -const generateMetadata = genGuideMeta(() => ({ - pathname: '/guides/self-hosting/realtime/config', - meta, -})) - -const RealtimeConfigPage = async () => { - const descriptionMdx = specRealtimeV0.info.description - - return ( - - - -
- {specRealtimeV0.info.tags.map( - (tag: ReturnType['info']['tags']) => { - return ( - <> -

{tag.title}

-

{tag.description}

-
-
Parameters
-
    - {specRealtimeV0.parameters - .filter((param: ReturnType['parameters']) => - param.tags.includes(tag.id) - ) - .map((param: ReturnType['parameters']) => { - return ( - - ) - })} -
-
- - ) - } - )} -
-
- ) -} - -export default RealtimeConfigPage -export { generateMetadata } diff --git a/apps/docs/app/guides/self-hosting/storage/config/page.tsx b/apps/docs/app/guides/self-hosting/storage/config/page.tsx deleted file mode 100644 index 47d9c6cf0fb..00000000000 --- a/apps/docs/app/guides/self-hosting/storage/config/page.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import Param from '~/components/Params' -import { genGuideMeta } from '~/features/docs/GuidesMdx.utils' -import { GuideTemplate, MDXRemoteGuides, newEditLink } from '~/features/docs/GuidesMdx.template' -import specStorageV0 from '~/spec/storage_v0_config.yaml' assert { type: 'yml' } - -const meta = { - title: 'Storage Self-hosting Config', - description: 'How to configure and deploy Supabase Storage.', -} - -const generateMetadata = genGuideMeta(() => ({ - pathname: '/guides/self-hosting/storage/config', - meta, -})) - -const StorageConfigPage = async () => { - const descriptionMdx = specStorageV0.info.description - - return ( - - - -
- {specStorageV0.info.tags.map( - (tag: ReturnType['info']['tags']) => { - return ( - <> -

{tag.title}

-

{tag.description}

-
-
Parameters
-
    - {specStorageV0.parameters - .filter((param: ReturnType['parameters']) => - param.tags.includes(tag.id) - ) - .map((param: ReturnType['parameters']) => { - return ( - - ) - })} -
-
- - ) - } - )} -
-
- ) -} - -export default StorageConfigPage -export { generateMetadata } diff --git a/apps/docs/lib/mdx/generateRefMarkdown.tsx b/apps/docs/lib/mdx/generateRefMarkdown.tsx index bda0debbe01..284fd009260 100644 --- a/apps/docs/lib/mdx/generateRefMarkdown.tsx +++ b/apps/docs/lib/mdx/generateRefMarkdown.tsx @@ -33,6 +33,7 @@ async function generateRefMarkdown(sections: ICommonMarkdown[], slug: string) { if (!markdownExists) return null const fileContents = markdownExists ? fs.readFileSync(pathName, 'utf8') : '' + const { data, content } = matter(fileContents) const codeHikeOptions: CodeHikeConfig = { diff --git a/apps/docs/package.json b/apps/docs/package.json index b78bc4b2852..6e6728b2dc5 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -48,7 +48,6 @@ "jsrsasign": "^11.0.0", "katex": "^0.16.10", "lodash": "^4.17.21", - "markdown-toc": "^1.2.0", "mdast": "^3.0.0", "mdast-util-from-markdown": "^1.2.0", "mdast-util-mdx": "^2.0.0", diff --git a/apps/docs/pages/reference/csharp/crawlers/[...slug].tsx b/apps/docs/pages/reference/csharp/crawlers/[...slug].tsx index fb85f51b023..88a3c92b5a9 100644 --- a/apps/docs/pages/reference/csharp/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/csharp/crawlers/[...slug].tsx @@ -1,5 +1,4 @@ import clientLibsCommonSections from '~/spec/common-client-libs-sections.json' -import typeSpec from '~/spec/enrichments/tsdoc_v2/combined.json' import spec from '~/spec/supabase_csharp_v1.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -30,7 +29,6 @@ export default function CSharpReference(props) { menuId={MenuId.RefCSharpV1} sections={filteredSection} spec={spec} - typeSpec={typeSpec as TypeSpec} pageProps={props} type="client-lib" /> diff --git a/apps/docs/pages/reference/csharp/v0/crawlers/[...slug].tsx b/apps/docs/pages/reference/csharp/v0/crawlers/[...slug].tsx index b5b5f35127a..dbe2b37b63d 100644 --- a/apps/docs/pages/reference/csharp/v0/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/csharp/v0/crawlers/[...slug].tsx @@ -1,5 +1,4 @@ import clientLibsCommonSections from '~/spec/common-client-libs-sections.json' -import typeSpec from '~/spec/enrichments/tsdoc_v2/combined.json' import spec from '~/spec/supabase_csharp_v0.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -28,7 +27,6 @@ export default function JSReference(props) { menuId={MenuId.RefCSharpV0} sections={filteredSection} spec={spec} - typeSpec={typeSpec} pageProps={props} type="client-lib" /> diff --git a/apps/docs/pages/reference/dart/crawlers/[...slug].tsx b/apps/docs/pages/reference/dart/crawlers/[...slug].tsx index 0ea7d9bcaed..dbac0378cc2 100644 --- a/apps/docs/pages/reference/dart/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/dart/crawlers/[...slug].tsx @@ -1,5 +1,4 @@ import clientLibsCommonSections from '~/spec/common-client-libs-sections.json' -import typeSpec from '~/spec/enrichments/tsdoc_v2/combined.json' import spec from '~/spec/supabase_dart_v2.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -29,7 +28,6 @@ export default function DartReference(props) { menuId={MenuId.RefDartV2} sections={filteredSection} spec={spec} - typeSpec={typeSpec} pageProps={props} type="client-lib" /> diff --git a/apps/docs/pages/reference/dart/v1/crawlers/[...slug].tsx b/apps/docs/pages/reference/dart/v1/crawlers/[...slug].tsx index 7945563e867..f4cba86e1d0 100644 --- a/apps/docs/pages/reference/dart/v1/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/dart/v1/crawlers/[...slug].tsx @@ -1,5 +1,4 @@ import clientLibsCommonSections from '~/spec/common-client-libs-sections.json' -import typeSpec from '~/spec/enrichments/tsdoc_v2/combined.json' import spec from '~/spec/supabase_dart_v1.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -28,7 +27,6 @@ export default function DartReference(props) { menuId={MenuId.RefDartV1} sections={filteredSection} spec={spec} - typeSpec={typeSpec} pageProps={props} type="client-lib" /> diff --git a/apps/docs/pages/reference/javascript/[...slug].tsx b/apps/docs/pages/reference/javascript/[...slug].tsx index 4344909efbf..d93687da957 100644 --- a/apps/docs/pages/reference/javascript/[...slug].tsx +++ b/apps/docs/pages/reference/javascript/[...slug].tsx @@ -5,7 +5,6 @@ import handleRefGetStaticPaths from '~/lib/mdx/handleRefStaticPaths' import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' import clientLibsCommonSections from '~/spec/common-client-libs-sections.json' assert { type: 'json' } -import typeSpec from '~/spec/enrichments/tsdoc_v2/combined.json' assert { type: 'json' } import spec from '~/spec/supabase_js_v2.yml' assert { type: 'yml' } const sections = flattenSections(clientLibsCommonSections) @@ -17,7 +16,6 @@ export default function JSReference(props) { menuId={MenuId.RefJavaScriptV2} sections={sections} spec={spec} - typeSpec={typeSpec} pageProps={props} type="client-lib" /> diff --git a/apps/docs/pages/reference/javascript/crawlers/[...slug].tsx b/apps/docs/pages/reference/javascript/crawlers/[...slug].tsx index b213488f963..742ac9ff57e 100644 --- a/apps/docs/pages/reference/javascript/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/javascript/crawlers/[...slug].tsx @@ -1,5 +1,4 @@ import clientLibsCommonSections from '~/spec/common-client-libs-sections.json' -import typeSpec from '~/spec/enrichments/tsdoc_v2/combined.json' import spec from '~/spec/supabase_js_v2.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -29,7 +28,6 @@ export default function JSReference(props) { menuId={MenuId.RefJavaScriptV2} sections={filteredSection} spec={spec} - typeSpec={typeSpec} pageProps={props} type="client-lib" /> diff --git a/apps/docs/pages/reference/javascript/v1/[...slug].tsx b/apps/docs/pages/reference/javascript/v1/[...slug].tsx index 1014cb86404..b66583d9fa2 100644 --- a/apps/docs/pages/reference/javascript/v1/[...slug].tsx +++ b/apps/docs/pages/reference/javascript/v1/[...slug].tsx @@ -5,7 +5,6 @@ import handleRefGetStaticPaths from '~/lib/mdx/handleRefStaticPaths' import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' import clientLibsCommonSections from '~/spec/common-client-libs-sections.json' assert { type: 'json' } -import typeSpec from '~/spec/enrichments/tsdoc_v1/combined.json' assert { type: 'json' } import spec from '~/spec/supabase_js_v1.yml' assert { type: 'yml' } const sections = flattenSections(clientLibsCommonSections) @@ -17,7 +16,6 @@ export default function JSReference(props) { menuId={MenuId.RefJavaScriptV1} sections={sections} spec={spec} - typeSpec={typeSpec} pageProps={props} type="client-lib" isOldVersion diff --git a/apps/docs/pages/reference/javascript/v1/crawlers/[...slug].tsx b/apps/docs/pages/reference/javascript/v1/crawlers/[...slug].tsx index d4647642a7f..20bb3971967 100644 --- a/apps/docs/pages/reference/javascript/v1/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/javascript/v1/crawlers/[...slug].tsx @@ -1,5 +1,4 @@ import clientLibsCommonSections from '~/spec/common-client-libs-sections.json' -import typeSpec from '~/spec/enrichments/tsdoc_v2/combined.json' import spec from '~/spec/supabase_js_v1.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -29,7 +28,6 @@ export default function JSReference(props) { menuId={MenuId.RefJavaScriptV1} sections={filteredSection} spec={spec} - typeSpec={typeSpec} pageProps={props} type="client-lib" /> diff --git a/apps/docs/pages/reference/kotlin/[...slug].tsx b/apps/docs/pages/reference/kotlin/[...slug].tsx index b691889c161..5ed21635b2d 100644 --- a/apps/docs/pages/reference/kotlin/[...slug].tsx +++ b/apps/docs/pages/reference/kotlin/[...slug].tsx @@ -22,7 +22,8 @@ export default function KotlinReference(props) { } export async function getStaticProps() { - return handleRefStaticProps(sections, libraryPath) + const a = await handleRefStaticProps(sections, libraryPath) + return a } export async function getStaticPaths() { diff --git a/apps/docs/pages/reference/kotlin/crawlers/[...slug].tsx b/apps/docs/pages/reference/kotlin/crawlers/[...slug].tsx index ec9ba3975f7..984d6e26168 100644 --- a/apps/docs/pages/reference/kotlin/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/kotlin/crawlers/[...slug].tsx @@ -1,5 +1,4 @@ import clientLibsCommonSections from '~/spec/common-client-libs-sections.json' -import typeSpec from '~/spec/enrichments/tsdoc_v2/combined.json' import spec from '~/spec/supabase_kt_v2.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -29,7 +28,6 @@ export default function KotlinReference(props) { menuId={MenuId.RefKotlinV2} sections={filteredSection} spec={spec} - typeSpec={typeSpec} pageProps={props} type="client-lib" /> diff --git a/apps/docs/pages/reference/kotlin/v1/crawlers/[...slug].tsx b/apps/docs/pages/reference/kotlin/v1/crawlers/[...slug].tsx index eccaa115e21..cf1f619d02b 100644 --- a/apps/docs/pages/reference/kotlin/v1/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/kotlin/v1/crawlers/[...slug].tsx @@ -1,5 +1,4 @@ import clientLibsCommonSections from '~/spec/common-client-libs-sections.json' -import typeSpec from '~/spec/enrichments/tsdoc_v2/combined.json' import spec from '~/spec/supabase_kt_v1.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -28,7 +27,6 @@ export default function KotlinReference(props) { menuId={MenuId.RefKotlinV1} sections={filteredSection} spec={spec} - typeSpec={typeSpec} pageProps={props} type="client-lib" /> diff --git a/apps/docs/pages/reference/python/[...slug].tsx b/apps/docs/pages/reference/python/[...slug].tsx index 6cb06b74b6c..2dc649bf144 100644 --- a/apps/docs/pages/reference/python/[...slug].tsx +++ b/apps/docs/pages/reference/python/[...slug].tsx @@ -1,5 +1,4 @@ import clientLibsCommonSections from '~/spec/common-client-libs-sections.json' -import typeSpec from '~/spec/enrichments/tsdoc_v2/combined.json' import spec from '~/spec/supabase_py_v2.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -16,7 +15,6 @@ export default function PyReference(props) { menuId={MenuId.RefPythonV2} sections={sections} spec={spec} - typeSpec={typeSpec} pageProps={props} type="client-lib" /> diff --git a/apps/docs/pages/reference/python/crawlers/[...slug].tsx b/apps/docs/pages/reference/python/crawlers/[...slug].tsx index 8534a8767ae..e530945156e 100644 --- a/apps/docs/pages/reference/python/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/python/crawlers/[...slug].tsx @@ -1,5 +1,4 @@ import clientLibsCommonSections from '~/spec/common-client-libs-sections.json' -import typeSpec from '~/spec/enrichments/tsdoc_v2/combined.json' import spec from '~/spec/supabase_py_v2.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -29,7 +28,6 @@ export default function PyReference(props) { menuId={MenuId.RefPythonV2} sections={filteredSection} spec={spec} - typeSpec={typeSpec} pageProps={props} type="client-lib" /> diff --git a/apps/docs/pages/reference/swift/crawlers/[...slug].tsx b/apps/docs/pages/reference/swift/crawlers/[...slug].tsx index 9763d9c668b..f47cb85ea6e 100644 --- a/apps/docs/pages/reference/swift/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/swift/crawlers/[...slug].tsx @@ -1,5 +1,4 @@ import clientLibsCommonSections from '~/spec/common-client-libs-sections.json' -import typeSpec from '~/spec/enrichments/tsdoc_v2/combined.json' import spec from '~/spec/supabase_swift_v2.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -29,7 +28,6 @@ export default function SwiftReference(props) { menuId={MenuId.RefSwiftV2} sections={filteredSection} spec={spec} - typeSpec={typeSpec} pageProps={props} type="client-lib" /> diff --git a/apps/docs/pages/reference/swift/v1/crawlers/[...slug].tsx b/apps/docs/pages/reference/swift/v1/crawlers/[...slug].tsx index 0156927cbe0..d5838fe8d72 100644 --- a/apps/docs/pages/reference/swift/v1/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/swift/v1/crawlers/[...slug].tsx @@ -1,5 +1,4 @@ import clientLibsCommonSections from '~/spec/common-client-libs-sections.json' -import typeSpec from '~/spec/enrichments/tsdoc_v2/combined.json' import spec from '~/spec/supabase_swift_v2.yml' assert { type: 'yml' } import RefSectionHandler from '~/components/reference/RefSectionHandler' import { flattenSections } from '~/lib/helpers' @@ -28,7 +27,6 @@ export default function SwiftReference(props) { menuId={MenuId.RefSwiftV1} sections={filteredSection} spec={spec} - typeSpec={typeSpec} pageProps={props} type="client-lib" /> diff --git a/package-lock.json b/package-lock.json index 90259065c4c..7153e75ee1a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -956,7 +956,6 @@ "jsrsasign": "^11.0.0", "katex": "^0.16.10", "lodash": "^4.17.21", - "markdown-toc": "^1.2.0", "mdast": "^3.0.0", "mdast-util-from-markdown": "^1.2.0", "mdast-util-mdx": "^2.0.0", diff --git a/packages/ai-commands/src/sql/functions.test.ts b/packages/ai-commands/src/sql/functions.test.ts index da5049d9215..0780ab70d55 100644 --- a/packages/ai-commands/src/sql/functions.test.ts +++ b/packages/ai-commands/src/sql/functions.test.ts @@ -1,6 +1,6 @@ import { describe, expect, test } from '@jest/globals' import { codeBlock } from 'common-tags' -import type OpenAI from 'openai' +import OpenAI from 'openai' import { formatSql } from '../../test/util' import { debugSql, titleSql } from './functions' diff --git a/packages/ai-commands/test/extensions.ts b/packages/ai-commands/test/extensions.ts index 8b9e881485a..b99e4d8c179 100644 --- a/packages/ai-commands/test/extensions.ts +++ b/packages/ai-commands/test/extensions.ts @@ -1,6 +1,6 @@ import { expect } from '@jest/globals' import { codeBlock } from 'common-tags' -import type OpenAI from 'openai' +import OpenAI from 'openai' const openAiKey = process.env.OPENAI_API_KEY const openai = new OpenAI({ apiKey: openAiKey }) diff --git a/packages/ui-patterns/index.tsx b/packages/ui-patterns/index.tsx index 87beac857ac..b8f0b26e43c 100644 --- a/packages/ui-patterns/index.tsx +++ b/packages/ui-patterns/index.tsx @@ -13,9 +13,9 @@ export * from './ThemeToggle' export * from './TweetCard' export * from './InnerSideMenu' export * from './ShimmeringLoader' -export * from './Dialogs/ConfirmDialog' -export * from './Dialogs/ConfirmationModal' +export { default as ConfirmModal } from './Dialogs/ConfirmDialog' +export { default as ConfirmationModal } from './Dialogs/ConfirmationModal' export * from './AssistantChat/AssistantChatForm' export * from './AssistantChat/AssistantCommandsPopover' -export * from './SqlToRest' +export { default as SqlToRest } from './SqlToRest' export * from './admonition'