diff --git a/.github/workflows/docs-lint-v2.yml b/.github/workflows/docs-lint-v2.yml index bffb3dd52ae..0581ade35f3 100644 --- a/.github/workflows/docs-lint-v2.yml +++ b/.github/workflows/docs-lint-v2.yml @@ -57,7 +57,7 @@ jobs: git diff --name-only origin/$BASE_REF HEAD \ | { grep -E "^apps/docs/content/" || test $? = 1; } \ | xargs -r supa-mdx-lint --format rdf \ - | reviewdog -f=rdjsonl -reporter=github-pr-review + | reviewdog -f=rdjsonl -reporter=github-pr-review -tee - name: run linter (external) if: steps.filter.outputs.docs == 'true' && github.event.pull_request.head.repo.full_name != github.repository env: diff --git a/apps/docs/app/contributing/content.mdx b/apps/docs/app/contributing/content.mdx index 8bba9d59149..b1bd59c1c29 100644 --- a/apps/docs/app/contributing/content.mdx +++ b/apps/docs/app/contributing/content.mdx @@ -415,10 +415,10 @@ We incorporate content reuse in the docs to avoid duplication. If you find yours > ```mdx - + <$Partial path="database_setup.mdx" /> ``` - + <$Partial path="database_setup.mdx" /> @@ -430,10 +430,10 @@ We incorporate content reuse in the docs to avoid duplication. If you find yours > ```mdx - + <$Partial path="create_client_snippet.mdx" /> ``` - + <$Partial path="create_client_snippet.mdx" /> @@ -442,8 +442,18 @@ We incorporate content reuse in the docs to avoid duplication. If you find yours To make a new partial: -1. Make a new MDX file in `apps/docs/components/MDX`. +1. Make a new MDX file in `apps/docs/content/_partials`. 1. Write your reusable content. -1. Inside `apps/docs/components/MDX/partials.tsx`, import and re-export your partial. -1. Inside `apps/docs/features/docs/mdx.shared.tsx`, import your partial and include it in the `components` object. -1. You can now use your partial inside any other MDX file by using: ``. +1. You can now use your partial inside any other MDX file by using: `<$Partial path="path/from/_partials/directory.mdx" />`. + +If you need compile-time variable replacement, you can define variables that get replaced with strings. + +```mdx +<$Partial path="path/to/file.mdx" variables={{ "substitute": "this" }}> +``` + +```mdx +Here is the partial text to {{ .substitute }}. +``` + +Only string replacements are possible at this time. For more complex use cases, consider making a custom component. diff --git a/apps/docs/app/contributing/page.tsx b/apps/docs/app/contributing/page.tsx index 856247ed444..790d62469cf 100644 --- a/apps/docs/app/contributing/page.tsx +++ b/apps/docs/app/contributing/page.tsx @@ -3,7 +3,6 @@ import { dirname, join } from 'node:path' import { fileURLToPath } from 'node:url' import { ContributingToc } from '~/app/contributing/ContributingToC' -import { MDXProviderGuides } from '~/features/docs/GuidesMdx.client' import { MDXRemoteBase } from '~/features/docs/MdxBase' import { LayoutMainContent } from '~/layouts/DefaultLayout' import { SidebarSkeleton } from '~/layouts/MainSkeleton' @@ -22,9 +21,7 @@ export default async function ContributingPage() { id="contributing" className="prose max-w-none relative transition-all ease-out duration-100" > - - - + diff --git a/apps/docs/components/MDX/partials.tsx b/apps/docs/components/MDX/partials.tsx deleted file mode 100644 index 2ade384d579..00000000000 --- a/apps/docs/components/MDX/partials.tsx +++ /dev/null @@ -1,57 +0,0 @@ -'use client' - -import AuthErrorCodesTable from './auth_error_codes_table.mdx' -import AuthRateLimits from './auth_rate_limits.mdx' -import CreateClientSnippet from './create_client_snippet.mdx' -import DatabaseSetup from './database_setup.mdx' -import GetSessionWarning from './get_session_warning.mdx' -import HuggingFaceDeployment from './ai/quickstart_hf_deployment.mdx' -import KotlinProjectSetup from './kotlin_project_setup.mdx' -import MigrationWarnings from './migration_warnings.mdx' -import OAuthPkceFlow from './oauth_pkce_flow.mdx' -import ProjectSetup from './project_setup.mdx' -import QuickstartDbSetup from './quickstart_db_setup.mdx' -import QuickstartIntro from './quickstart_intro.mdx' -import SocialProviderSettingsSupabase from './social_provider_settings_supabase.mdx' -import SocialProviderSetup from './social_provider_setup.mdx' -import PostgresInstallation from './postgres_installation.mdx' -import PricingMfaPhone from './billing/pricing/pricing_mfa_phone.mdx' -import PricingBranching from './billing/pricing/pricing_branching.mdx' -import PricingEdgeFunctions from './billing/pricing/pricing_edge_functions.mdx' -import PricingMau from './billing/pricing/pricing_mau.mdx' -import PricingMauSso from './billing/pricing/pricing_mau_sso.mdx' -import PricingMauThirdParty from './billing/pricing/pricing_mau_third_party.mdx' -import PricingPitr from './billing/pricing/pricing_pitr.mdx' -import PricingRealtimeMessages from './billing/pricing/pricing_realtime_messages.mdx' -import PricingRealtimeConnections from './billing/pricing/pricing_realtime_connections.mdx' -import PricingStorageImageTransformations from './billing/pricing/pricing_storage_image_transformations.mdx' -import PricingStorageSize from './billing/pricing/pricing_storage_size.mdx' - -export { - AuthErrorCodesTable, - AuthRateLimits, - CreateClientSnippet, - DatabaseSetup, - GetSessionWarning, - HuggingFaceDeployment, - KotlinProjectSetup, - MigrationWarnings, - ProjectSetup, - OAuthPkceFlow, - QuickstartDbSetup, - QuickstartIntro, - SocialProviderSettingsSupabase, - SocialProviderSetup, - PostgresInstallation, - PricingMfaPhone, - PricingBranching, - PricingEdgeFunctions, - PricingMau, - PricingMauSso, - PricingMauThirdParty, - PricingPitr, - PricingRealtimeMessages, - PricingRealtimeConnections, - PricingStorageImageTransformations, - PricingStorageSize, -} diff --git a/apps/docs/components/index.tsx b/apps/docs/components/index.tsx deleted file mode 100644 index 1c724eb4fc3..00000000000 --- a/apps/docs/components/index.tsx +++ /dev/null @@ -1,176 +0,0 @@ -/** - * This entire file could do with a cleanup and better code-splitting, but one thing at a time. - */ - -// Basic UI things -import Link from 'next/link' -import { Accordion, Alert, Button, CodeBlock, Image, markdownComponents } from 'ui' -import { Admonition } from 'ui-patterns/admonition' -import { GlassPanel } from 'ui-patterns/GlassPanel' -import { IconPanel } from 'ui-patterns/IconPanel' -import { TabPanel, Tabs } from '~/features/ui/Tabs' -import InfoTooltip from '~/features/ui/InfoTooltip' - -// Common components -import { CH } from '@code-hike/mdx/components' -import { ArrowDown, Check } from 'lucide-react' -import { Heading } from 'ui' -import StepHikeCompact from '~/components/StepHikeCompact' -import ButtonCard from './ButtonCard' - -// Reference guide specific -// [Charis] I think we can factor these out so they aren't in the bundle for absolutely everything -import CliGlobalFlagsHandler from '~/components/reference/enrichments/cli/CliGlobalFlagsHandler' -import RefSubLayout from '~/layouts/ref/RefSubLayout' -import RefHeaderSection from './reference/RefHeaderSection' - -// Other components -import AuthProviders from '~/components/AuthProviders' -import { CostWarning } from '~/components/AuthSmsProviderConfig/AuthSmsProviderConfig.Warnings' -import Options from '~/components/Options' -import Param from '~/components/Params' -import { ProjectConfigVariables } from '~/components/ProjectConfigVariables' -import Table from '~/components/Table' - -// Data wrappers -import { NavData } from './NavData' -import { SharedData } from './SharedData' - -// Partials -import HuggingFaceDeployment from './MDX/ai/quickstart_hf_deployment.mdx' -import AuthErrorCodesTable from './MDX/auth_error_codes_table.mdx' -import AuthRateLimits from './MDX/auth_rate_limits.mdx' -import DatabaseSetup from './MDX/database_setup.mdx' -import GetSessionWarning from './MDX/get_session_warning.mdx' -import KotlinProjectSetup from './MDX/kotlin_project_setup.mdx' -import MigrationWarnings from './MDX/migration_warnings.mdx' -import OAuthPkceFlow from './MDX/oauth_pkce_flow.mdx' -import ProjectSetup from './MDX/project_setup.mdx' -import QuickstartIntro from './MDX/quickstart_intro.mdx' -import SocialProviderSettingsSupabase from './MDX/social_provider_settings_supabase.mdx' -import SocialProviderSetup from './MDX/social_provider_setup.mdx' -import PostgresInstallation from './MDX/postgres_installation.mdx' - -// Icons -import { - IconMenuApi, - IconMenuAuth, - IconMenuCli, - IconMenuCsharp, - IconMenuDatabase, - IconMenuEdgeFunctions, - IconMenuFlutter, - IconMenuGettingStarted, - IconMenuHome, - IconMenuIntegrations, - IconMenuJavascript, - IconMenuKotlin, - IconMenuPlatform, - IconMenuPython, - IconMenuRealtime, - IconMenuResources, - IconMenuRestApis, - IconMenuSelfHosting, - IconMenuStorage, - IconMenuSwift, -} from './Navigation/NavigationMenu/MenuIcons' - -// Heavy/rare (lazy-loaded) -import SqlToRest from 'ui-patterns/SqlToRest' -import { AppleSecretGenerator } from './AppleSecretGenerator' -import { AuthSmsProviderConfig } from './AuthSmsProviderConfig' -import { Extensions } from './Extensions' -import { JwtGenerator } from './JwtGenerator' -import { RealtimeLimitsEstimator } from './RealtimeLimitsEstimator' - -const components = { - ...markdownComponents, - Accordion, - Admonition, - Alert: (props: any) => ( - - {props.children} - - ), - AppleSecretGenerator, - AuthProviders, - AuthErrorCodesTable, - AuthRateLimits, - AuthSmsProviderConfig, - Button, - ButtonCard, - CH, - CliGlobalFlagsHandler: () => , - CodeBlock, - CostWarning, - DatabaseSetup, - Extensions, - GetSessionWarning, - GlassPanel, - h2: (props: any) => ( - - {props.children} - - ), - h3: (props: any) => ( - - {props.children} - - ), - h4: (props: any) => ( - - {props.children} - - ), - HuggingFaceDeployment, - IconCheck: Check, - IconMenuApi, - IconArrowDown: ArrowDown, - IconMenuAuth, - IconMenuCli, - IconMenuCsharp, - IconMenuDatabase, - IconMenuEdgeFunctions, - IconMenuFlutter, - IconMenuGettingStarted, - IconMenuHome, - IconMenuIntegrations, - IconMenuJavascript, - IconMenuKotlin, - IconMenuPlatform, - IconMenuPython, - IconMenuRealtime, - IconMenuResources, - IconMenuRestApis, - IconMenuSelfHosting, - IconMenuStorage, - IconMenuSwift, - IconPanel, - Image: (props: any) => , - JwtGenerator, - KotlinProjectSetup, - Link, - MigrationWarnings, - NavData, - OAuthPkceFlow, - Options, - Param, - InfoTooltip, - ProjectConfigVariables, - ProjectSetup, - QuickstartIntro, - RealtimeLimitsEstimator, - RefHeaderSection: (props: any) => , - RefSubLayout, - SharedData, - SocialProviderSettingsSupabase, - SocialProviderSetup, - PostgresInstallation, - SqlToRest, - StepHikeCompact, - table: Table, - TabPanel, - Tabs, -} - -export default components diff --git a/apps/docs/content/_partials/_fixtures/nested1.mdx b/apps/docs/content/_partials/_fixtures/nested1.mdx new file mode 100644 index 00000000000..42ad6c4ee2f --- /dev/null +++ b/apps/docs/content/_partials/_fixtures/nested1.mdx @@ -0,0 +1,4 @@ +First level of nesting: + +{/* prettier-ignore */} +<$Partial path='/_fixtures/nested2.mdx' /> diff --git a/apps/docs/content/_partials/_fixtures/nested2.mdx b/apps/docs/content/_partials/_fixtures/nested2.mdx new file mode 100644 index 00000000000..59bb7574641 --- /dev/null +++ b/apps/docs/content/_partials/_fixtures/nested2.mdx @@ -0,0 +1 @@ +Second level of nesting. diff --git a/apps/docs/content/_partials/_fixtures/test.mdx b/apps/docs/content/_partials/_fixtures/test.mdx new file mode 100644 index 00000000000..667ff2df6dc --- /dev/null +++ b/apps/docs/content/_partials/_fixtures/test.mdx @@ -0,0 +1,22 @@ +Here is some content to embed as a partial. + +## A heading + +Some more stuff, including: + +- A list +- With two items + +And some custom components: + + + +Some stuff. + +In two paragraphs. + + + + + +An entire paragraph: It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way... diff --git a/apps/docs/content/_partials/_fixtures/variables.mdx b/apps/docs/content/_partials/_fixtures/variables.mdx new file mode 100644 index 00000000000..48f4ec19677 --- /dev/null +++ b/apps/docs/content/_partials/_fixtures/variables.mdx @@ -0,0 +1 @@ +Here is a partial that takes a {{ .var }}. diff --git a/apps/docs/components/MDX/ai/quickstart_hf_deployment.mdx b/apps/docs/content/_partials/ai/quickstart_hf_deployment.mdx similarity index 100% rename from apps/docs/components/MDX/ai/quickstart_hf_deployment.mdx rename to apps/docs/content/_partials/ai/quickstart_hf_deployment.mdx diff --git a/apps/docs/components/MDX/auth_error_codes_table.mdx b/apps/docs/content/_partials/auth_error_codes_table.mdx similarity index 98% rename from apps/docs/components/MDX/auth_error_codes_table.mdx rename to apps/docs/content/_partials/auth_error_codes_table.mdx index 7fc44588c95..581727a93fa 100644 --- a/apps/docs/components/MDX/auth_error_codes_table.mdx +++ b/apps/docs/content/_partials/auth_error_codes_table.mdx @@ -8,10 +8,10 @@ To supplement HTTP status codes, Supabase Auth returns a string error code which | `bad_jwt` | JWT sent in the `Authorization` header is not valid. | | `bad_oauth_callback` | OAuth callback from provider to Auth does not have all the required attributes (state). Indicates an issue with the OAuth provider or client library implementation. | | `bad_oauth_state` | OAuth state (data echoed back by the OAuth provider to Supabase Auth) is not in the correct format. Indicates an issue with the OAuth provider integration. | -| `captcha_failed` | Captcha challenge could not be verified with the captcha provider. Check your captcha integration. | +| `captcha_failed` | CAPTCHA challenge could not be verified with the CAPTCHA provider. Check your CAPTCHA integration. | | `conflict` | General database conflict, such as concurrent requests on resources that should not be modified concurrently. Can often occur when you have too many session refresh requests firing off at the same time for a user. Check your app for concurrency issues, and if detected, back off exponentially. | -| `email_address_invalid` | Example and test domains are currently not supported. Please use a different email address. | -| `email_address_not_authorized` | Email sending is not allowed for this address as your project is using the default SMTP service. Emails can only be sent to members in your Supabase organization. If you want to send emails to others, please set up a [custom SMTP provider](/docs/guides/auth/auth-smtp). | +| `email_address_invalid` | Example and test domains are currently not supported. Use a different email address. | +| `email_address_not_authorized` | Email sending is not allowed for this address as your project is using the default SMTP service. Emails can only be sent to members in your Supabase organization. If you want to send emails to others, set up a [custom SMTP provider](/docs/guides/auth/auth-smtp). | | `email_conflict_identity_not_deletable` | Unlinking this identity causes the user's account to change to an email address which is already used by another user account. Indicates an issue where the user has two different accounts using different primary email addresses. You may need to migrate user data to one of their accounts in this case. | | `email_exists` | Email address already exists in the system. | | `email_not_confirmed` | Signing in is not allowed for this user as the email address is not confirmed. | @@ -61,7 +61,7 @@ To supplement HTTP status codes, Supabase Auth returns a string error code which | `request_timeout` | Processing the request took too long. Retry the request. | | `same_password` | A user that is updating their password must use a different password than the one currently used. | | `saml_assertion_no_email` | SAML assertion (user information) was received after sign in, but no email address was found in it, which is required. Check the provider's attribute mapping and/or configuration. | -| `saml_assertion_no_user_id` | SAML assertion (user information) was received after sign in, but a user ID (called NameID) was not found in it, which is required. Check the SAML identity provider's configuration. | +| `saml_assertion_no_user_id` | SAML assertion (user information) was received after sign in, but a user ID (called `NameID`) was not found in it, which is required. Check the SAML identity provider's configuration. | | `saml_entity_id_mismatch` | (Admin API.) Updating the SAML metadata for a SAML identity provider is not possible, as the entity ID in the update does not match the entity ID in the database. This is equivalent to creating a new identity provider, and you should do that instead. | | `saml_idp_already_exists` | (Admin API.) Adding a SAML identity provider that is already added. | | `saml_idp_not_found` | SAML identity provider not found. Most often returned after IdP-initiated sign-in with an unregistered SAML identity provider in Supabase Auth. | diff --git a/apps/docs/components/MDX/auth_rate_limits.mdx b/apps/docs/content/_partials/auth_rate_limits.mdx similarity index 98% rename from apps/docs/components/MDX/auth_rate_limits.mdx rename to apps/docs/content/_partials/auth_rate_limits.mdx index 132d0420a17..2b3f19c434a 100644 --- a/apps/docs/components/MDX/auth_rate_limits.mdx +++ b/apps/docs/content/_partials/auth_rate_limits.mdx @@ -2,7 +2,7 @@ | ------------------------------------------------ | -------------------------------------------------------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | All endpoints that send emails | `/auth/v1/signup` `/auth/v1/recover` `/auth/v1/user`[^1] | Sum of combined requests | Defaults to 4 emails per hour as of 14th July 2023. As of 21 Oct 2023, this has been updated to auth.rate_limits.email.inbuilt_smtp_per_hour emails per hour. You can only change this with your own custom SMTP setup. | | All endpoints that send One-Time-Passwords (OTP) | `/auth/v1/otp` | Sum of combined requests | Defaults to auth.rate_limits.otp.requests_per_hour OTPs per hour. Is customizable. | -| Send OTPs or magiclinks | `/auth/v1/otp` | Last request | Defaults to auth.rate_limits.otp.period window before a new request is allowed. Is customizable. | +| Send OTPs or magic links | `/auth/v1/otp` | Last request | Defaults to auth.rate_limits.otp.period window before a new request is allowed. Is customizable. | | Signup confirmation request | `/auth/v1/signup` | Last request | Defaults to auth.rate_limits.signup_confirmation.period window before a new request is allowed. Is customizable. | | Password Reset Request | `/auth/v1/recover` | Last request | Defaults to auth.rate_limits.password_reset.period window before a new request is allowed. Is customizable. | | Verification requests | `/auth/v1/verify` | IP Address | auth.rate_limits.verification.requests_per_hour requests per hour (with bursts up to auth.rate_limits.verification.requests_burst requests) | diff --git a/apps/docs/components/MDX/billing/pricing/pricing_branching.mdx b/apps/docs/content/_partials/billing/pricing/pricing_branching.mdx similarity index 100% rename from apps/docs/components/MDX/billing/pricing/pricing_branching.mdx rename to apps/docs/content/_partials/billing/pricing/pricing_branching.mdx diff --git a/apps/docs/components/MDX/billing/pricing/pricing_edge_functions.mdx b/apps/docs/content/_partials/billing/pricing/pricing_edge_functions.mdx similarity index 100% rename from apps/docs/components/MDX/billing/pricing/pricing_edge_functions.mdx rename to apps/docs/content/_partials/billing/pricing/pricing_edge_functions.mdx diff --git a/apps/docs/components/MDX/billing/pricing/pricing_mau.mdx b/apps/docs/content/_partials/billing/pricing/pricing_mau.mdx similarity index 100% rename from apps/docs/components/MDX/billing/pricing/pricing_mau.mdx rename to apps/docs/content/_partials/billing/pricing/pricing_mau.mdx diff --git a/apps/docs/components/MDX/billing/pricing/pricing_mau_sso.mdx b/apps/docs/content/_partials/billing/pricing/pricing_mau_sso.mdx similarity index 100% rename from apps/docs/components/MDX/billing/pricing/pricing_mau_sso.mdx rename to apps/docs/content/_partials/billing/pricing/pricing_mau_sso.mdx diff --git a/apps/docs/components/MDX/billing/pricing/pricing_mau_third_party.mdx b/apps/docs/content/_partials/billing/pricing/pricing_mau_third_party.mdx similarity index 100% rename from apps/docs/components/MDX/billing/pricing/pricing_mau_third_party.mdx rename to apps/docs/content/_partials/billing/pricing/pricing_mau_third_party.mdx diff --git a/apps/docs/components/MDX/billing/pricing/pricing_mfa_phone.mdx b/apps/docs/content/_partials/billing/pricing/pricing_mfa_phone.mdx similarity index 100% rename from apps/docs/components/MDX/billing/pricing/pricing_mfa_phone.mdx rename to apps/docs/content/_partials/billing/pricing/pricing_mfa_phone.mdx diff --git a/apps/docs/components/MDX/billing/pricing/pricing_pitr.mdx b/apps/docs/content/_partials/billing/pricing/pricing_pitr.mdx similarity index 100% rename from apps/docs/components/MDX/billing/pricing/pricing_pitr.mdx rename to apps/docs/content/_partials/billing/pricing/pricing_pitr.mdx diff --git a/apps/docs/components/MDX/billing/pricing/pricing_realtime_connections.mdx b/apps/docs/content/_partials/billing/pricing/pricing_realtime_connections.mdx similarity index 100% rename from apps/docs/components/MDX/billing/pricing/pricing_realtime_connections.mdx rename to apps/docs/content/_partials/billing/pricing/pricing_realtime_connections.mdx diff --git a/apps/docs/components/MDX/billing/pricing/pricing_realtime_messages.mdx b/apps/docs/content/_partials/billing/pricing/pricing_realtime_messages.mdx similarity index 100% rename from apps/docs/components/MDX/billing/pricing/pricing_realtime_messages.mdx rename to apps/docs/content/_partials/billing/pricing/pricing_realtime_messages.mdx diff --git a/apps/docs/components/MDX/billing/pricing/pricing_storage_image_transformations.mdx b/apps/docs/content/_partials/billing/pricing/pricing_storage_image_transformations.mdx similarity index 100% rename from apps/docs/components/MDX/billing/pricing/pricing_storage_image_transformations.mdx rename to apps/docs/content/_partials/billing/pricing/pricing_storage_image_transformations.mdx diff --git a/apps/docs/components/MDX/billing/pricing/pricing_storage_size.mdx b/apps/docs/content/_partials/billing/pricing/pricing_storage_size.mdx similarity index 100% rename from apps/docs/components/MDX/billing/pricing/pricing_storage_size.mdx rename to apps/docs/content/_partials/billing/pricing/pricing_storage_size.mdx diff --git a/apps/docs/components/MDX/create_client_snippet.mdx b/apps/docs/content/_partials/create_client_snippet.mdx similarity index 100% rename from apps/docs/components/MDX/create_client_snippet.mdx rename to apps/docs/content/_partials/create_client_snippet.mdx diff --git a/apps/docs/components/MDX/database_setup.mdx b/apps/docs/content/_partials/database_setup.mdx similarity index 92% rename from apps/docs/components/MDX/database_setup.mdx rename to apps/docs/content/_partials/database_setup.mdx index c54b9b32f84..6afac0bb025 100644 --- a/apps/docs/components/MDX/database_setup.mdx +++ b/apps/docs/content/_partials/database_setup.mdx @@ -1,6 +1,3 @@ -import { Tabs } from 'ui' -export const TabPanel = Tabs.Panel - ## Project setup Let's create a new Postgres database. This is as simple as starting a new Project in Supabase: diff --git a/apps/docs/components/MDX/get_session_warning.mdx b/apps/docs/content/_partials/get_session_warning.mdx similarity index 100% rename from apps/docs/components/MDX/get_session_warning.mdx rename to apps/docs/content/_partials/get_session_warning.mdx diff --git a/apps/docs/components/MDX/kotlin_project_setup.mdx b/apps/docs/content/_partials/kotlin_project_setup.mdx similarity index 88% rename from apps/docs/components/MDX/kotlin_project_setup.mdx rename to apps/docs/content/_partials/kotlin_project_setup.mdx index 717f5b03892..a01629914df 100644 --- a/apps/docs/components/MDX/kotlin_project_setup.mdx +++ b/apps/docs/content/_partials/kotlin_project_setup.mdx @@ -1,7 +1,3 @@ -import ProductManagementSQLTemplate from './product_management_sql_template.mdx' -import { Tabs } from 'ui' -export const TabPanel = Tabs.Panel - ## Project setup Before we start building we're going to set up our Database and API. This is as simple as starting a new Project in Supabase and then creating a "schema" inside the database. @@ -32,12 +28,12 @@ Now we are going to set up the database schema. You can just copy/paste the SQL */} - +<$Partial path="product_management_sql_template.mdx" /> -### Get the API Keys +### Get the API keys Now that you've created some database tables, you are ready to insert data using the auto-generated API. We just need to get the Project URL and `anon` key from the API settings. @@ -45,7 +41,7 @@ We just need to get the Project URL and `anon` key from the API settings. 1. Go to the [API Settings](https://app.supabase.com/project/_/settings/api) page in the Dashboard. 2. Find your Project `URL`, `anon`, and `service_role` keys on this page. -### Set up Google Authentication +### Set up Google authentication From the [Google Console](https://console.developers.google.com/apis/library), create a new project and add OAuth2 credentials. diff --git a/apps/docs/components/MDX/migration_warnings.mdx b/apps/docs/content/_partials/migration_warnings.mdx similarity index 100% rename from apps/docs/components/MDX/migration_warnings.mdx rename to apps/docs/content/_partials/migration_warnings.mdx diff --git a/apps/docs/components/MDX/oauth_pkce_flow.mdx b/apps/docs/content/_partials/oauth_pkce_flow.mdx similarity index 100% rename from apps/docs/components/MDX/oauth_pkce_flow.mdx rename to apps/docs/content/_partials/oauth_pkce_flow.mdx diff --git a/apps/docs/components/MDX/postgres_installation.mdx b/apps/docs/content/_partials/postgres_installation.mdx similarity index 96% rename from apps/docs/components/MDX/postgres_installation.mdx rename to apps/docs/content/_partials/postgres_installation.mdx index 46f440e9d8b..82e62070161 100644 --- a/apps/docs/components/MDX/postgres_installation.mdx +++ b/apps/docs/content/_partials/postgres_installation.mdx @@ -13,7 +13,7 @@ - Download and run the installation file for the latest version from the [PostgreSQL installer download page](https://www.postgresql.org/download/windows/). + Download and run the installation file for the latest version from the [Postgres installer download page](https://www.postgresql.org/download/windows/). diff --git a/apps/docs/components/MDX/product_management_sql_template.mdx b/apps/docs/content/_partials/product_management_sql_template.mdx similarity index 100% rename from apps/docs/components/MDX/product_management_sql_template.mdx rename to apps/docs/content/_partials/product_management_sql_template.mdx diff --git a/apps/docs/components/MDX/project_setup.mdx b/apps/docs/content/_partials/project_setup.mdx similarity index 80% rename from apps/docs/components/MDX/project_setup.mdx rename to apps/docs/content/_partials/project_setup.mdx index e1ad3a97ba7..3d0d9d43288 100644 --- a/apps/docs/components/MDX/project_setup.mdx +++ b/apps/docs/content/_partials/project_setup.mdx @@ -1,7 +1,3 @@ -import UserManagementSQLTemplate from './user_management_quickstart_sql_template.mdx' -import { Tabs } from 'ui' -export const TabPanel = Tabs.Panel - ## Project setup Before we start building we're going to set up our Database and API. This is as simple as starting a new Project in Supabase and then creating a "schema" inside the database. @@ -31,7 +27,7 @@ Now we are going to set up the database schema. We can use the "User Management -You can easily pull the database schema down to your local project by running the `db pull` command. Read the [local development docs](/docs/guides/cli/local-development#link-your-project) for detailed instructions. +You can pull the database schema down to your local project by running the `db pull` command. Read the [local development docs](/docs/guides/cli/local-development#link-your-project) for detailed instructions. @@ -54,12 +50,12 @@ When working locally you can run the following command to create a new migration supabase migration new user_management_starter ``` - +<$Partial path="user_management_quickstart_sql_template.mdx" /> -### Get the API Keys +### Get the API keys Now that you've created some database tables, you are ready to insert data using the auto-generated API. We just need to get the Project URL and `anon` key from the API settings. diff --git a/apps/docs/components/MDX/quickstart_db_setup.mdx b/apps/docs/content/_partials/quickstart_db_setup.mdx similarity index 100% rename from apps/docs/components/MDX/quickstart_db_setup.mdx rename to apps/docs/content/_partials/quickstart_db_setup.mdx diff --git a/apps/docs/components/MDX/quickstart_intro.mdx b/apps/docs/content/_partials/quickstart_intro.mdx similarity index 100% rename from apps/docs/components/MDX/quickstart_intro.mdx rename to apps/docs/content/_partials/quickstart_intro.mdx diff --git a/apps/docs/components/MDX/social_provider_settings_supabase.mdx b/apps/docs/content/_partials/social_provider_settings_supabase.mdx similarity index 55% rename from apps/docs/components/MDX/social_provider_settings_supabase.mdx rename to apps/docs/content/_partials/social_provider_settings_supabase.mdx index 394673df620..199589d2077 100644 --- a/apps/docs/components/MDX/social_provider_settings_supabase.mdx +++ b/apps/docs/content/_partials/social_provider_settings_supabase.mdx @@ -1,6 +1,6 @@ - Go to your [Supabase Project Dashboard](https://supabase.com/dashboard) - In the left sidebar, click the `Authentication` icon (near the top) - Click on [`Providers`](https://supabase.com/dashboard/project/_/auth/providers) under the Configuration section -- Click on **{props.provider}** from the accordion list to expand and turn **{props.provider} Enabled** to ON -- Enter your **{props.provider} Client ID** and **{props.provider} Client Secret** saved in the previous step +- Click on **{{ .provider }}** from the accordion list to expand and turn **{{ .provider }} Enabled** to ON +- Enter your **{{ .provider }} Client ID** and **{{ .provider }} Client Secret** saved in the previous step - Click `Save` diff --git a/apps/docs/components/MDX/social_provider_setup.mdx b/apps/docs/content/_partials/social_provider_setup.mdx similarity index 57% rename from apps/docs/components/MDX/social_provider_setup.mdx rename to apps/docs/content/_partials/social_provider_setup.mdx index 6e8f01d65cf..ec446552dce 100644 --- a/apps/docs/components/MDX/social_provider_setup.mdx +++ b/apps/docs/content/_partials/social_provider_setup.mdx @@ -3,10 +3,10 @@ The next step requires a callback URL, which looks like this: `https:// -For testing OAuth locally with the Supabase CLI please see the [local development docs](/docs/guides/cli/local-development#use-auth-locally). +For testing OAuth locally with the Supabase CLI see the [local development docs](/docs/guides/cli/local-development#use-auth-locally). diff --git a/apps/docs/components/MDX/user_management_quickstart_sql_template.mdx b/apps/docs/content/_partials/user_management_quickstart_sql_template.mdx similarity index 100% rename from apps/docs/components/MDX/user_management_quickstart_sql_template.mdx rename to apps/docs/content/_partials/user_management_quickstart_sql_template.mdx diff --git a/apps/docs/content/guides/ai/integrations/llamaindex.mdx b/apps/docs/content/guides/ai/integrations/llamaindex.mdx index c5e7b660f01..7d61103c594 100644 --- a/apps/docs/content/guides/ai/integrations/llamaindex.mdx +++ b/apps/docs/content/guides/ai/integrations/llamaindex.mdx @@ -7,7 +7,7 @@ breadcrumb: 'AI Integrations' This guide will walk you through a basic example using the LlamaIndex [`SupabaseVectorStore`](https://github.com/supabase/supabase/blob/master/examples/ai/llamaindex/llamaindex.ipynb). - +<$Partial path="database_setup.mdx" /> ## Launching a notebook diff --git a/apps/docs/content/guides/ai/integrations/roboflow.mdx b/apps/docs/content/guides/ai/integrations/roboflow.mdx index a388b4fbe68..db24a974d01 100644 --- a/apps/docs/content/guides/ai/integrations/roboflow.mdx +++ b/apps/docs/content/guides/ai/integrations/roboflow.mdx @@ -7,7 +7,7 @@ breadcrumb: 'AI Integrations' In this guide, we will walk through two examples of using [Roboflow Inference](https://inference.roboflow.com) to run fine-tuned and foundation models. We will run inference and save predictions using an object detection model and [CLIP](https://github.com/openai/CLIP). - +<$Partial path="database_setup.mdx" /> ## Save computer vision predictions diff --git a/apps/docs/content/guides/ai/quickstarts/face-similarity.mdx b/apps/docs/content/guides/ai/quickstarts/face-similarity.mdx index 496e068c3ee..aae47c4f2b4 100644 --- a/apps/docs/content/guides/ai/quickstarts/face-similarity.mdx +++ b/apps/docs/content/guides/ai/quickstarts/face-similarity.mdx @@ -12,7 +12,7 @@ This guide will walk you through a ["Face Similarity Search"](https://github.com 1. Use the `face_recognition` model to create an embedding for every celebrity photo. 1. Search for similar faces inside the dataset. - +<$Partial path="database_setup.mdx" /> ## Launching a notebook diff --git a/apps/docs/content/guides/ai/quickstarts/hello-world.mdx b/apps/docs/content/guides/ai/quickstarts/hello-world.mdx index d9944a06b01..5fa051216b5 100644 --- a/apps/docs/content/guides/ai/quickstarts/hello-world.mdx +++ b/apps/docs/content/guides/ai/quickstarts/hello-world.mdx @@ -13,7 +13,7 @@ This guide will walk you through a basic ["Hello World"](https://github.com/supa 1. Add data to the collection 1. Query the collection - +<$Partial path="database_setup.mdx" /> ## Launching a notebook diff --git a/apps/docs/content/guides/ai/quickstarts/text-deduplication.mdx b/apps/docs/content/guides/ai/quickstarts/text-deduplication.mdx index e603bafea03..2661d9763d2 100644 --- a/apps/docs/content/guides/ai/quickstarts/text-deduplication.mdx +++ b/apps/docs/content/guides/ai/quickstarts/text-deduplication.mdx @@ -13,7 +13,7 @@ This guide will walk you through a ["Semantic Text Deduplication"](https://githu 1. Use the `sentence-transformers/all-MiniLM-L6-v2` model to create an embedding representing the semantic meaning of each review. 1. Search for all duplicates. - +<$Partial path="database_setup.mdx" /> ## Launching a notebook @@ -63,7 +63,7 @@ You can view the inserted items in the [Table Editor](https://supabase.com/dashb ![Colab documents](/docs/img/ai/google-colab/colab-documents.png) - +<$Partial path="ai/quickstart_hf_deployment.mdx" /> ## Next steps diff --git a/apps/docs/content/guides/auth/auth-helpers/remix.mdx b/apps/docs/content/guides/auth/auth-helpers/remix.mdx index 0e932efa296..da1299d328a 100644 --- a/apps/docs/content/guides/auth/auth-helpers/remix.mdx +++ b/apps/docs/content/guides/auth/auth-helpers/remix.mdx @@ -20,7 +20,7 @@ We generally recommend using the new `@supabase/ssr` package instead of `auth-he size="medium" className="text-foreground-light border-b mt-8 pb-2" > - + +<$Partial path="get_session_warning.mdx" /> ```jsx const user = session?.user diff --git a/apps/docs/content/guides/auth/auth-helpers/sveltekit.mdx b/apps/docs/content/guides/auth/auth-helpers/sveltekit.mdx index ddb5107adb1..25d9724d262 100644 --- a/apps/docs/content/guides/auth/auth-helpers/sveltekit.mdx +++ b/apps/docs/content/guides/auth/auth-helpers/sveltekit.mdx @@ -61,7 +61,7 @@ PUBLIC_SUPABASE_ANON_KEY=your-anon-key Create a new `hooks.server.js` file in the root of your project and populate with the following to retrieve the user session. - +<$Partial path="get_session_warning.mdx" /> ```js src/hooks.server.js // src/hooks.server.js diff --git a/apps/docs/content/guides/auth/auth-mfa/phone.mdx b/apps/docs/content/guides/auth/auth-mfa/phone.mdx index 459ad9fbd7c..35292146ba8 100644 --- a/apps/docs/content/guides/auth/auth-mfa/phone.mdx +++ b/apps/docs/content/guides/auth/auth-mfa/phone.mdx @@ -312,6 +312,6 @@ Be aware that Phone MFA is vulnerable to SIM swap attacks where an attacker will ## Pricing - +<$Partial path="billing/pricing/pricing_mfa_phone.mdx" /> For a detailed breakdown of how charges are calculated, refer to [Manage Advanced MFA Phone usage](/docs/guides/platform/manage-your-usage/advanced-mfa-phone). diff --git a/apps/docs/content/guides/auth/debugging/error-codes.mdx b/apps/docs/content/guides/auth/debugging/error-codes.mdx index 06fca4a0ed3..2dcc5e58bd3 100644 --- a/apps/docs/content/guides/auth/debugging/error-codes.mdx +++ b/apps/docs/content/guides/auth/debugging/error-codes.mdx @@ -105,7 +105,7 @@ Sent out when a feature is not enabled on the Auth server, and you are trying to The following table provides a comprehensive list of error codes you may encounter when working with Supabase Auth. Each error code is associated with a specific issue and includes a description to help you understand and resolve the problem efficiently. - +<$Partial path="auth_error_codes_table.mdx" /> ## Best practices for error handling diff --git a/apps/docs/content/guides/auth/enterprise-sso/auth-sso-saml.mdx b/apps/docs/content/guides/auth/enterprise-sso/auth-sso-saml.mdx index 6c17681e9ce..7a364eb7166 100644 --- a/apps/docs/content/guides/auth/enterprise-sso/auth-sso-saml.mdx +++ b/apps/docs/content/guides/auth/enterprise-sso/auth-sso-saml.mdx @@ -382,7 +382,7 @@ You can use the `-o json` flag to output the information as JSON, should you nee ## Pricing - +<$Partial path="billing/pricing/pricing_mau_sso.mdx" /> For a detailed breakdown of how charges are calculated, refer to [Manage Monthly Active SSO Users usage](/docs/guides/platform/manage-your-usage/monthly-active-users-sso). diff --git a/apps/docs/content/guides/auth/passwords.mdx b/apps/docs/content/guides/auth/passwords.mdx index 7bc44776836..89042a37187 100644 --- a/apps/docs/content/guides/auth/passwords.mdx +++ b/apps/docs/content/guides/auth/passwords.mdx @@ -162,7 +162,7 @@ Your signup email template should contain the following HTML: Create an API endpoint at `/auth/confirm` to handle the token exchange. - +<$Partial path="create_client_snippet.mdx" /> @@ -631,7 +631,7 @@ Your signup email template should contain the following HTML: Create an API endpoint at `/auth/confirm` to handle the token exchange. - +<$Partial path="create_client_snippet.mdx" /> diff --git a/apps/docs/content/guides/auth/rate-limits.mdx b/apps/docs/content/guides/auth/rate-limits.mdx index 849db8ad6d0..6edd22b0df8 100644 --- a/apps/docs/content/guides/auth/rate-limits.mdx +++ b/apps/docs/content/guides/auth/rate-limits.mdx @@ -5,4 +5,4 @@ subtitle: 'Rate limits protect your services from abuse' Supabase Auth enforces rate limits on endpoints to prevent abuse. Some rate limits are [customizable](/dashboard/project/_/auth/rate-limits). - +<$Partial path="auth_rate_limits.mdx" /> diff --git a/apps/docs/content/guides/auth/social-login/auth-apple.mdx b/apps/docs/content/guides/auth/social-login/auth-apple.mdx index 7e583b62fd9..47a8855b53e 100644 --- a/apps/docs/content/guides/auth/social-login/auth-apple.mdx +++ b/apps/docs/content/guides/auth/social-login/auth-apple.mdx @@ -37,7 +37,7 @@ When developing with Expo, you can test Sign in with Apple via the Expo Go app, Behind the scenes, Supabase Auth uses the [REST APIs](https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_rest_api) provided by Apple. - + <$Partial path="create_client_snippet.mdx" /> To initiate sign in, you can use the `signInWithOAuth()` method from the Supabase JavaScript library: @@ -49,7 +49,7 @@ When developing with Expo, you can test Sign in with Apple via the Expo Go app, This call takes the user to Apple's consent screen. Once the flow ends, the user's profile information is exchanged and validated with Supabase Auth before it redirects back to your web application with an access and refresh token representing the user's session. - + <$Partial path="oauth_pkce_flow.mdx" /> ### Configuration [#configuration-web] diff --git a/apps/docs/content/guides/auth/social-login/auth-azure.mdx b/apps/docs/content/guides/auth/social-login/auth-azure.mdx index 0b5dd0137d3..ee2e35a8a0c 100644 --- a/apps/docs/content/guides/auth/social-login/auth-azure.mdx +++ b/apps/docs/content/guides/auth/social-login/auth-azure.mdx @@ -125,7 +125,7 @@ Supabase Auth requires that Azure returns a valid email address. Therefore you m > - +<$Partial path="create_client_snippet.mdx" /> When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/auth-signinwithoauth) with `azure` as the `provider`: @@ -172,7 +172,7 @@ suspend fun signInWithAzure() { - +<$Partial path="oauth_pkce_flow.mdx" /> +<$Partial path="social_provider_setup.mdx" variables={{ "provider": "Bitbucket" }} /> ## Create a Bitbucket OAuth app @@ -42,7 +42,7 @@ Setting up Bitbucket logins for your application consists of 3 parts: ## Add your Bitbucket credentials into your Supabase project - +<$Partial path="social_provider_settings_supabase.mdx" variables={{ "provider": "BitBucket" }} /> ## Add login code to your client app @@ -55,7 +55,7 @@ Setting up Bitbucket logins for your application consists of 3 parts: > - +<$Partial path="create_client_snippet.mdx" /> When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/auth-signinwithoauth) with `bitbucket` as the `provider`: @@ -97,7 +97,7 @@ suspend fun signInWithBitbucket() { - +<$Partial path="oauth_pkce_flow.mdx" /> +<$Partial path="social_provider_setup.mdx" variables={{ "provider": "Discord" }} /> ## Create a Discord application @@ -41,7 +41,7 @@ Setting up Discord logins for your application consists of 3 parts: ## Add your Discord credentials into your Supabase project - +<$Partial path="social_provider_settings_supabase.mdx" variables={{ "provider": "Discord" }} /> ## Add login code to your client app @@ -54,7 +54,7 @@ Setting up Discord logins for your application consists of 3 parts: > - +<$Partial path="create_client_snippet.mdx" /> When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/auth-signinwithoauth) with `discord` as the `provider`: @@ -96,7 +96,7 @@ suspend fun signInWithDiscord() { - +<$Partial path="oauth_pkce_flow.mdx" /> If your user is already signed in, Discord prompts the user again for authorization. diff --git a/apps/docs/content/guides/auth/social-login/auth-facebook.mdx b/apps/docs/content/guides/auth/social-login/auth-facebook.mdx index 419533140e0..4d39e76affa 100644 --- a/apps/docs/content/guides/auth/social-login/auth-facebook.mdx +++ b/apps/docs/content/guides/auth/social-login/auth-facebook.mdx @@ -29,7 +29,7 @@ Setting up Facebook logins for your application consists of 3 parts: - Fill in your app information, then click `Create App`. - This should bring you to the screen: `Add Products to Your App`. (Alternatively you can click on `Add Product` in the left sidebar to get to this screen.) - +<$Partial path="social_provider_setup.mdx" variables={{ "provider": "Facebook" }} /> ## Set up Facebook login for your Facebook app @@ -58,7 +58,7 @@ Under `Build Your App`, click on `Use Cases` screen. From there, do the followin ## Enter your Facebook app ID and secret into your Supabase project - +<$Partial path="social_provider_settings_supabase.mdx" variables={{ "provider": "Facebook" }} /> ## Add login code to your client app @@ -71,7 +71,7 @@ Under `Build Your App`, click on `Use Cases` screen. From there, do the followin > - +<$Partial path="create_client_snippet.mdx" /> When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/auth-signinwithoauth) with `facebook` as the `provider`: @@ -133,7 +133,7 @@ suspend fun signInWithFacebook() { - +<$Partial path="oauth_pkce_flow.mdx" /> +<$Partial path="social_provider_setup.mdx" variables={{ "provider": "Figma" }} /> ## Create a Figma OAuth app @@ -42,7 +42,7 @@ Setting up Figma logins for your application consists of 3 parts: ## Enter your Figma credentials into your Supabase project - +<$Partial path="social_provider_settings_supabase.mdx" variables={{ "provider": "Figma" }} /> ## Add login code to your client app @@ -55,7 +55,7 @@ Setting up Figma logins for your application consists of 3 parts: > - +<$Partial path="create_client_snippet.mdx" /> When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/auth-signinwithoauth) with `figma` as the `provider`: @@ -97,7 +97,7 @@ suspend fun signInWithFigma() { - +<$Partial path="oauth_pkce_flow.mdx" /> +<$Partial path="social_provider_setup.mdx" variables={{ "provider": "GitHub" }} /> ## Register a new OAuth application on GitHub @@ -36,7 +36,7 @@ Copy your new OAuth credentials ## Enter your GitHub credentials into your Supabase project - +<$Partial path="social_provider_settings_supabase.mdx" variables={{ "provider": "GitHub" }} /> ## Add login code to your client app @@ -49,7 +49,7 @@ Copy your new OAuth credentials > - +<$Partial path="create_client_snippet.mdx" /> When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/auth-signinwithoauth) with `github` as the `provider`: @@ -105,7 +105,7 @@ suspend fun signInWithGithub() { - +<$Partial path="oauth_pkce_flow.mdx" /> +<$Partial path="social_provider_setup.mdx" variables={{ "provider": "GitLab" }} /> ## Create your GitLab application @@ -39,7 +39,7 @@ Setting up GitLab logins for your application consists of 3 parts: ## Add your GitLab credentials into your Supabase project - +<$Partial path="social_provider_settings_supabase.mdx" variables={{ "provider": "GitLab" }} /> ## Add login code to your client app @@ -52,7 +52,7 @@ Setting up GitLab logins for your application consists of 3 parts: > - +<$Partial path="create_client_snippet.mdx" /> When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/auth-signinwithoauth) with `gitlab` as the `provider`: @@ -94,7 +94,7 @@ suspend fun signInWithGitLab() { - +<$Partial path="oauth_pkce_flow.mdx" /> +<$Partial path="create_client_snippet.mdx" /> ```js supabase.auth.signInWithOAuth({ @@ -234,7 +234,7 @@ supabase.auth.signInWithOAuth({ For an implicit flow, that's all you need to do. The user will be taken to Google's consent screen, and finally redirected to your app with an access and refresh token pair representing their session. - +<$Partial path="oauth_pkce_flow.mdx" /> After a successful code exchange, the user's session will be saved to cookies. diff --git a/apps/docs/content/guides/auth/social-login/auth-kakao.mdx b/apps/docs/content/guides/auth/social-login/auth-kakao.mdx index 9b678996d95..48593424137 100644 --- a/apps/docs/content/guides/auth/social-login/auth-kakao.mdx +++ b/apps/docs/content/guides/auth/social-login/auth-kakao.mdx @@ -45,8 +45,10 @@ This will serve as the `client_id` when you make API calls to authenticate the u ## Find your callback URL -- To add callback URL on Kakao, go to `Product settings` > -`Kakao Login` > `Redirect URI`. +<$Partial path="social_provider_setup.mdx" variables={{ "provider": "Kakao" }} /> + +- To add callback URL on Kakao, go to `Product settings` > + `Kakao Login` > `Redirect URI`. ## Generate and activate a `client_secret` @@ -64,7 +66,7 @@ This will serve as the `client_id` when you make API calls to authenticate the u ## Add your OAuth credentials to Supabase - +<$Partial path="social_provider_settings_supabase.mdx" variables={{ "provider": "Kakao" }} /> ## Add login code to your client app @@ -77,7 +79,7 @@ This will serve as the `client_id` when you make API calls to authenticate the u > - +<$Partial path="create_client_snippet.mdx" /> When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/auth-signinwithoauth) with `kakao` as the `provider`: @@ -119,7 +121,7 @@ suspend fun signInWithKakao() { - +<$Partial path="oauth_pkce_flow.mdx" /> - +<$Partial path="create_client_snippet.mdx" /> When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/auth-signinwithoauth) with `keycloak` as the `provider`: @@ -117,7 +117,7 @@ suspend fun signInWithKeycloak() { - +<$Partial path="oauth_pkce_flow.mdx" /> +<$Partial path="social_provider_setup.mdx" variables={{ "provider": "LinkedIn" }} /> ## Create a LinkedIn OAuth app @@ -44,7 +44,7 @@ Ensure that the appropriate scopes have been added under OAuth 2.0 Scopes at the ## Enter your LinkedIn (OIDC) credentials into your Supabase project - +<$Partial path="social_provider_settings_supabase.mdx" variables={{ "provider": "LinkedIn (OIDC)" }} /> ## Add login code to your client app @@ -57,7 +57,7 @@ Ensure that the appropriate scopes have been added under OAuth 2.0 Scopes at the > - +<$Partial path="create_client_snippet.mdx" /> When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/auth-signinwithoauth) with `linkedin_oidc` as the `provider`: @@ -99,7 +99,7 @@ suspend fun signInWithKaLinkedIn() { - +<$Partial path="oauth_pkce_flow.mdx" /> +<$Partial path="social_provider_setup.mdx" variables={{ "provider": "Notion" }} /> ## Add your Notion credentials into your Supabase project @@ -42,7 +42,7 @@ Setting up Notion logins for your application consists of 3 parts: ![notion.so](/docs/img/guides/auth-notion/notion-creds.png) - +<$Partial path="social_provider_settings_supabase.mdx" variables={{ "provider": "Notion" }} /> ## Add login code to your client app @@ -55,7 +55,7 @@ Setting up Notion logins for your application consists of 3 parts: > - +<$Partial path="create_client_snippet.mdx" /> When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/auth-signinwithoauth) with `notion` as the `provider`: @@ -97,7 +97,7 @@ suspend fun signInWithNotion() { - +<$Partial path="oauth_pkce_flow.mdx" /> +<$Partial path="social_provider_setup.mdx" variables={{ "provider": "Slack" }} /> ## Create a Slack OAuth app @@ -60,7 +60,7 @@ Under `Scopes`: ## Enter your Slack credentials into your Supabase project - +<$Partial path="social_provider_settings_supabase.mdx" variables={{ "provider": "Slack" }} /> ## Add login code to your client app @@ -73,7 +73,7 @@ Under `Scopes`: > - +<$Partial path="create_client_snippet.mdx" /> When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/auth-signinwithoauth) with `slack_oidc` as the `provider`: @@ -115,7 +115,7 @@ suspend fun signInWithSlack() { - +<$Partial path="oauth_pkce_flow.mdx" /> +<$Partial path="social_provider_setup.mdx" variables={{ "provider": "Spotify" }} /> ## Create a Spotify OAuth app @@ -46,7 +46,7 @@ Under `Redirect URIs`: ## Enter your Spotify credentials into your Supabase project - +<$Partial path="social_provider_settings_supabase.mdx" variables={{ "provider": "Spotify" }} /> ## Add login code to your client app @@ -67,7 +67,7 @@ The following outlines the steps to sign in using Spotify with Supabase Auth. > - +<$Partial path="create_client_snippet.mdx" /> When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/auth-signinwithoauth) with `spotify` as the `provider`: @@ -109,7 +109,7 @@ suspend fun signInWithSpotify() { - +<$Partial path="oauth_pkce_flow.mdx" /> +<$Partial path="social_provider_setup.mdx" variables={{ "provider": "Twitch" }} /> ## Create a Twitch application @@ -57,7 +57,7 @@ Setting up Twitch logins for your application consists of 3 parts: ## Add your Twitch credentials into your Supabase project - +<$Partial path="social_provider_settings_supabase.mdx" variables={{ "provider": "Twitch" }} /> ## Add login code to your client app @@ -70,7 +70,7 @@ Setting up Twitch logins for your application consists of 3 parts: > - +<$Partial path="create_client_snippet.mdx" /> When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/auth-signinwithoauth) with `twitch` as the `provider`: @@ -112,7 +112,7 @@ suspend fun signInWithTwitch() { - +<$Partial path="oauth_pkce_flow.mdx" /> +<$Partial path="social_provider_setup.mdx" variables={{ "provider": "Twitter" }} /> ## Create a Twitter OAuth app @@ -48,7 +48,7 @@ Setting up Twitter logins for your application consists of 3 parts: ## Enter your Twitter credentials into your Supabase project - +<$Partial path="social_provider_settings_supabase.mdx" variables={{ "provider": "Twitter" }} /> ## Add login code to your client app @@ -61,7 +61,7 @@ Setting up Twitter logins for your application consists of 3 parts: > - +<$Partial path="create_client_snippet.mdx" /> When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/auth-signinwithoauth) with `twitter` as the `provider`: @@ -103,7 +103,7 @@ suspend fun signInWithTwitter() { - +<$Partial path="oauth_pkce_flow.mdx" /> +<$Partial path="social_provider_setup.mdx" variables={{ "provider": "Zoom" }} /> ## Create a Zoom OAuth app @@ -55,7 +55,7 @@ Under `Scopes` ## Enter your Zoom credentials into your Supabase project - +<$Partial path="social_provider_settings_supabase.mdx" variables={{ "provider": "Zoom" }} /> ## Add login code to your client app @@ -68,7 +68,7 @@ Under `Scopes` > - +<$Partial path="create_client_snippet.mdx" /> When your user signs in, call [`signInWithOAuth()`](/docs/reference/javascript/auth-signinwithoauth) with `zoom` as the `provider`: @@ -110,7 +110,7 @@ suspend fun signInWithZoom() { - +<$Partial path="oauth_pkce_flow.mdx" /> +<$Partial path="billing/pricing/pricing_mau_third_party.mdx" /> For a detailed breakdown of how charges are calculated, refer to [Manage Monthly Active Third-Party Users usage](/docs/guides/platform/manage-your-usage/monthly-active-users-third-party). diff --git a/apps/docs/content/guides/functions/pricing.mdx b/apps/docs/content/guides/functions/pricing.mdx index 90634c298ed..0ae33b8bdde 100644 --- a/apps/docs/content/guides/functions/pricing.mdx +++ b/apps/docs/content/guides/functions/pricing.mdx @@ -3,6 +3,6 @@ id: 'functions-pricing' title: 'Pricing' --- - +<$Partial path="billing/pricing/pricing_edge_functions.mdx" /> For a detailed explanation of how charges are calculated, refer to [Manage Edge Function Invocations usage](/docs/guides/platform/manage-your-usage/edge-function-invocations). diff --git a/apps/docs/content/guides/getting-started/quickstarts/flutter.mdx b/apps/docs/content/guides/getting-started/quickstarts/flutter.mdx index bc8755d3fd1..aa798d48502 100644 --- a/apps/docs/content/guides/getting-started/quickstarts/flutter.mdx +++ b/apps/docs/content/guides/getting-started/quickstarts/flutter.mdx @@ -9,7 +9,7 @@ hideToc: true - + <$Partial path="quickstart_db_setup.mdx" /> diff --git a/apps/docs/content/guides/getting-started/quickstarts/ios-swiftui.mdx b/apps/docs/content/guides/getting-started/quickstarts/ios-swiftui.mdx index 40b6e910092..fdd5b4ea964 100644 --- a/apps/docs/content/guides/getting-started/quickstarts/ios-swiftui.mdx +++ b/apps/docs/content/guides/getting-started/quickstarts/ios-swiftui.mdx @@ -9,7 +9,7 @@ hideToc: true - + <$Partial path="quickstart_db_setup.mdx" /> diff --git a/apps/docs/content/guides/getting-started/quickstarts/kotlin.mdx b/apps/docs/content/guides/getting-started/quickstarts/kotlin.mdx index fab273e5c00..38c857552c3 100644 --- a/apps/docs/content/guides/getting-started/quickstarts/kotlin.mdx +++ b/apps/docs/content/guides/getting-started/quickstarts/kotlin.mdx @@ -9,7 +9,7 @@ hideToc: true - + <$Partial path="quickstart_db_setup.mdx" /> diff --git a/apps/docs/content/guides/getting-started/quickstarts/nextjs.mdx b/apps/docs/content/guides/getting-started/quickstarts/nextjs.mdx index 48fcf5ef675..c364c23a978 100644 --- a/apps/docs/content/guides/getting-started/quickstarts/nextjs.mdx +++ b/apps/docs/content/guides/getting-started/quickstarts/nextjs.mdx @@ -9,7 +9,7 @@ hideToc: true - + <$Partial path="quickstart_db_setup.mdx" /> diff --git a/apps/docs/content/guides/getting-started/quickstarts/nuxtjs.mdx b/apps/docs/content/guides/getting-started/quickstarts/nuxtjs.mdx index 6e39dff869d..8a6462849e7 100644 --- a/apps/docs/content/guides/getting-started/quickstarts/nuxtjs.mdx +++ b/apps/docs/content/guides/getting-started/quickstarts/nuxtjs.mdx @@ -9,7 +9,7 @@ hideToc: true - + <$Partial path="quickstart_db_setup.mdx" /> diff --git a/apps/docs/content/guides/getting-started/quickstarts/reactjs.mdx b/apps/docs/content/guides/getting-started/quickstarts/reactjs.mdx index 9e430b2786e..05a5eeaccec 100644 --- a/apps/docs/content/guides/getting-started/quickstarts/reactjs.mdx +++ b/apps/docs/content/guides/getting-started/quickstarts/reactjs.mdx @@ -9,7 +9,7 @@ hideToc: true - + <$Partial path="quickstart_db_setup.mdx" /> diff --git a/apps/docs/content/guides/getting-started/quickstarts/refine.mdx b/apps/docs/content/guides/getting-started/quickstarts/refine.mdx index f85b656d936..a6341037381 100644 --- a/apps/docs/content/guides/getting-started/quickstarts/refine.mdx +++ b/apps/docs/content/guides/getting-started/quickstarts/refine.mdx @@ -9,7 +9,7 @@ hideToc: true - + <$Partial path="quickstart_db_setup.mdx" /> diff --git a/apps/docs/content/guides/getting-started/quickstarts/solidjs.mdx b/apps/docs/content/guides/getting-started/quickstarts/solidjs.mdx index 4e5948912a3..3bdc70249e1 100644 --- a/apps/docs/content/guides/getting-started/quickstarts/solidjs.mdx +++ b/apps/docs/content/guides/getting-started/quickstarts/solidjs.mdx @@ -9,7 +9,7 @@ hideToc: true - + <$Partial path="quickstart_db_setup.mdx" /> diff --git a/apps/docs/content/guides/getting-started/quickstarts/sveltekit.mdx b/apps/docs/content/guides/getting-started/quickstarts/sveltekit.mdx index c2d39d35556..300005e3c7d 100644 --- a/apps/docs/content/guides/getting-started/quickstarts/sveltekit.mdx +++ b/apps/docs/content/guides/getting-started/quickstarts/sveltekit.mdx @@ -9,7 +9,7 @@ hideToc: true - + <$Partial path="quickstart_db_setup.mdx" /> diff --git a/apps/docs/content/guides/getting-started/quickstarts/vue.mdx b/apps/docs/content/guides/getting-started/quickstarts/vue.mdx index fdd447e046c..27cc48ce9cd 100644 --- a/apps/docs/content/guides/getting-started/quickstarts/vue.mdx +++ b/apps/docs/content/guides/getting-started/quickstarts/vue.mdx @@ -9,7 +9,7 @@ hideToc: true - + <$Partial path="quickstart_db_setup.mdx" /> diff --git a/apps/docs/content/guides/getting-started/tutorials/with-angular.mdx b/apps/docs/content/guides/getting-started/tutorials/with-angular.mdx index 1fc7ee77539..36d2d5b4f63 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-angular.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-angular.mdx @@ -3,7 +3,7 @@ title: 'Build a User Management App with Angular' description: 'Learn how to use Supabase in your Angular App.' --- - +<$Partial path="quickstart_intro.mdx" /> ![Supabase User Management example](/docs/img/user-management-demo.png) @@ -13,7 +13,7 @@ If you get stuck while working through this guide, refer to the [full example on - +<$Partial path="project_setup.mdx" /> ## Building the app diff --git a/apps/docs/content/guides/getting-started/tutorials/with-expo-react-native.mdx b/apps/docs/content/guides/getting-started/tutorials/with-expo-react-native.mdx index ba1daa96450..f828afed14c 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-expo-react-native.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-expo-react-native.mdx @@ -4,7 +4,7 @@ description: 'Learn how to use Supabase in your React Native App.' tocVideo: 'AE7dKIKMJy4' --- - +<$Partial path="quickstart_intro.mdx" /> ![Supabase User Management example](/docs/img/supabase-flutter-demo.png) @@ -14,7 +14,7 @@ If you get stuck while working through this guide, refer to the [full example on - +<$Partial path="project_setup.mdx" /> ## Building the app diff --git a/apps/docs/content/guides/getting-started/tutorials/with-flutter.mdx b/apps/docs/content/guides/getting-started/tutorials/with-flutter.mdx index 3bedc966dc8..3334b36d7a1 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-flutter.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-flutter.mdx @@ -4,7 +4,7 @@ description: 'Learn how to use Supabase in your Flutter App.' tocVideo: 'r7ysVtZ5Row' --- - +<$Partial path="quickstart_intro.mdx" /> ![Supabase User Management example](/docs/img/supabase-flutter-demo.png) @@ -14,7 +14,7 @@ If you get stuck while working through this guide, refer to the [full example on - +<$Partial path="project_setup.mdx" /> ## Building the app diff --git a/apps/docs/content/guides/getting-started/tutorials/with-ionic-angular.mdx b/apps/docs/content/guides/getting-started/tutorials/with-ionic-angular.mdx index 09c3b87a039..06379df40d8 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-ionic-angular.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-ionic-angular.mdx @@ -3,7 +3,7 @@ title: 'Build a User Management App with Ionic Angular' description: 'Learn how to use Supabase in your Ionic Angular App.' --- - +<$Partial path="quickstart_intro.mdx" /> ![Supabase User Management example](/docs/img/ionic-demos/ionic-angular-account.png) @@ -13,7 +13,7 @@ If you get stuck while working through this guide, refer to the [full example on - +<$Partial path="project_setup.mdx" /> ## Building the app diff --git a/apps/docs/content/guides/getting-started/tutorials/with-ionic-react.mdx b/apps/docs/content/guides/getting-started/tutorials/with-ionic-react.mdx index 5ad2106479f..d4530d110de 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-ionic-react.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-ionic-react.mdx @@ -3,7 +3,7 @@ title: 'Build a User Management App with Ionic React' description: 'Learn how to use Supabase in your Ionic React App.' --- - +<$Partial path="quickstart_intro.mdx" /> ![Supabase User Management example](/docs/img/ionic-demos/ionic-angular-account.png) @@ -13,7 +13,7 @@ If you get stuck while working through this guide, refer to the [full example on - +<$Partial path="project_setup.mdx" /> ## Building the app diff --git a/apps/docs/content/guides/getting-started/tutorials/with-ionic-vue.mdx b/apps/docs/content/guides/getting-started/tutorials/with-ionic-vue.mdx index 58388b7796c..01c398e52c0 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-ionic-vue.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-ionic-vue.mdx @@ -3,7 +3,7 @@ title: 'Build a User Management App with Ionic Vue' description: 'Learn how to use Supabase in your Ionic Vue App.' --- - +<$Partial path="quickstart_intro.mdx" /> ![Supabase User Management example](/docs/img/ionic-demos/ionic-angular-account.png) @@ -13,7 +13,7 @@ If you get stuck while working through this guide, refer to the [full example on - +<$Partial path="project_setup.mdx" /> ## Building the app diff --git a/apps/docs/content/guides/getting-started/tutorials/with-kotlin.mdx b/apps/docs/content/guides/getting-started/tutorials/with-kotlin.mdx index b3f32c1db01..9a54445e2fb 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-kotlin.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-kotlin.mdx @@ -17,7 +17,7 @@ If you get stuck while working through this guide, refer to the [full example on - +<$Partial path="kotlin_project_setup.mdx" /> ## Building the app diff --git a/apps/docs/content/guides/getting-started/tutorials/with-nextjs.mdx b/apps/docs/content/guides/getting-started/tutorials/with-nextjs.mdx index 277a212022f..15d01829eff 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-nextjs.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-nextjs.mdx @@ -3,7 +3,7 @@ title: 'Build a User Management App with Next.js' description: 'Learn how to use Supabase in your Next.js App.' --- - +<$Partial path="quickstart_intro.mdx" /> ![Supabase User Management example](/docs/img/user-management-demo.png) @@ -13,7 +13,7 @@ If you get stuck while working through this guide, refer to the [full example on - +<$Partial path="project_setup.mdx" /> ## Building the app diff --git a/apps/docs/content/guides/getting-started/tutorials/with-nuxt-3.mdx b/apps/docs/content/guides/getting-started/tutorials/with-nuxt-3.mdx index 5a11038af41..8b38dc47783 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-nuxt-3.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-nuxt-3.mdx @@ -3,7 +3,7 @@ title: 'Build a User Management App with Nuxt 3' description: 'Learn how to use Supabase in your Nuxt 3 App.' --- - +<$Partial path="quickstart_intro.mdx" /> ![Supabase User Management example](/docs/img/user-management-demo.png) @@ -13,7 +13,7 @@ If you get stuck while working through this guide, refer to the [full example on - +<$Partial path="project_setup.mdx" /> ## Building the app diff --git a/apps/docs/content/guides/getting-started/tutorials/with-react.mdx b/apps/docs/content/guides/getting-started/tutorials/with-react.mdx index 5088bb5c1b6..5322666e06f 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-react.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-react.mdx @@ -3,7 +3,7 @@ title: 'Build a User Management App with React' description: 'Learn how to use Supabase in your React App.' --- - +<$Partial path="quickstart_intro.mdx" /> ![Supabase User Management example](/docs/img/user-management-demo.png) @@ -13,7 +13,7 @@ If you get stuck while working through this guide, refer to the [full example on - +<$Partial path="project_setup.mdx" /> ## Building the app diff --git a/apps/docs/content/guides/getting-started/tutorials/with-redwoodjs.mdx b/apps/docs/content/guides/getting-started/tutorials/with-redwoodjs.mdx index e0ad2e87af9..ab535b32bae 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-redwoodjs.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-redwoodjs.mdx @@ -3,7 +3,7 @@ title: 'Build a User Management App with RedwoodJS' description: 'Learn how to use Supabase in your RedwoodJS App.' --- - +<$Partial path="quickstart_intro.mdx" /> ![Supabase User Management example](/docs/img/user-management-demo.png) @@ -39,7 +39,7 @@ Instead, we'll rely on the Supabase client to do some of the work on the **`web` That means you will want to refrain from running any `yarn rw prisma migrate` commands and also double check your build commands on deployment to ensure Prisma won't reset your database. Prisma currently doesn't support cross-schema foreign keys, so introspecting the schema fails due to how your Supabase `public` schema references the `auth.users`. - +<$Partial path="project_setup.mdx" /> ## Building the app diff --git a/apps/docs/content/guides/getting-started/tutorials/with-refine.mdx b/apps/docs/content/guides/getting-started/tutorials/with-refine.mdx index f3a901e69a6..0466ffdf151 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-refine.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-refine.mdx @@ -3,7 +3,7 @@ title: 'Build a User Management App with refine' description: 'Learn how to use Supabase in your refine App.' --- - +<$Partial path="quickstart_intro.mdx" /> ![Supabase User Management example](/docs/img/user-management-demo.png) @@ -25,7 +25,7 @@ It is possible to customize the `authProvider` for Supabase and as we'll see bel - +<$Partial path="project_setup.mdx" /> ## Building the app diff --git a/apps/docs/content/guides/getting-started/tutorials/with-solidjs.mdx b/apps/docs/content/guides/getting-started/tutorials/with-solidjs.mdx index 3809040d52e..c006835208a 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-solidjs.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-solidjs.mdx @@ -3,7 +3,7 @@ title: 'Build a User Management App with SolidJS' description: 'Learn how to use Supabase in your SolidJS App.' --- - +<$Partial path="quickstart_intro.mdx" /> ![Supabase User Management example](/docs/img/user-management-demo.png) @@ -13,7 +13,7 @@ If you get stuck while working through this guide, refer to the [full example on - +<$Partial path="project_setup.mdx" /> ## Building the app diff --git a/apps/docs/content/guides/getting-started/tutorials/with-svelte.mdx b/apps/docs/content/guides/getting-started/tutorials/with-svelte.mdx index 2f8df31f98c..bfda75d7a71 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-svelte.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-svelte.mdx @@ -3,7 +3,7 @@ title: 'Build a User Management App with Svelte' description: 'Learn how to use Supabase in your Svelte App.' --- - +<$Partial path="quickstart_intro.mdx" /> ![Supabase User Management example](/docs/img/user-management-demo.png) @@ -13,7 +13,7 @@ If you get stuck while working through this guide, refer to the [full example on - +<$Partial path="project_setup.mdx" /> ## Building the app diff --git a/apps/docs/content/guides/getting-started/tutorials/with-sveltekit.mdx b/apps/docs/content/guides/getting-started/tutorials/with-sveltekit.mdx index 46f5fcd6d49..9df43ff8bbb 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-sveltekit.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-sveltekit.mdx @@ -3,7 +3,7 @@ title: 'Build a User Management App with SvelteKit' description: 'Learn how to use Supabase in your SvelteKit App.' --- - +<$Partial path="quickstart_intro.mdx" /> ![Supabase User Management example](/docs/img/user-management-demo.png) @@ -13,7 +13,7 @@ If you get stuck while working through this guide, refer to the [full example on - +<$Partial path="project_setup.mdx" /> ## Building the app @@ -115,7 +115,7 @@ export const handle: Handle = async ({ event, resolve }) => { } ``` - +<$Partial path="get_session_warning.mdx" /> If you are using TypeScript the compiler might complain about `event.locals.supabase` and `event.locals.safeGetSession`, this can be fixed by updating your `src/app.d.ts` with the content below: diff --git a/apps/docs/content/guides/getting-started/tutorials/with-swift.mdx b/apps/docs/content/guides/getting-started/tutorials/with-swift.mdx index 8277c06943a..45d5e3ba52b 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-swift.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-swift.mdx @@ -3,7 +3,7 @@ title: 'Build a User Management App with Swift and SwiftUI' description: 'Learn how to use Supabase in your SwiftUI App.' --- - +<$Partial path="quickstart_intro.mdx" /> ![Supabase User Management example](/docs/img/supabase-swift-demo.png) @@ -13,7 +13,7 @@ If you get stuck while working through this guide, refer to the [full example on - +<$Partial path="project_setup.mdx" /> ## Building the app diff --git a/apps/docs/content/guides/getting-started/tutorials/with-vue-3.mdx b/apps/docs/content/guides/getting-started/tutorials/with-vue-3.mdx index debd92f2227..55fd2dff662 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-vue-3.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-vue-3.mdx @@ -3,7 +3,7 @@ title: 'Build a User Management App with Vue 3' description: 'Learn how to use Supabase in your Vue 3 App.' --- - +<$Partial path="quickstart_intro.mdx" /> ![Supabase User Management example](/docs/img/user-management-demo.png) @@ -13,7 +13,7 @@ If you get stuck while working through this guide, refer to the [full example on - +<$Partial path="project_setup.mdx" /> ## Building the app diff --git a/apps/docs/content/guides/platform/backups.mdx b/apps/docs/content/guides/platform/backups.mdx index a027860a1c4..aadb728ba21 100644 --- a/apps/docs/content/guides/platform/backups.mdx +++ b/apps/docs/content/guides/platform/backups.mdx @@ -137,7 +137,7 @@ After locking in the desired point in time to recover to, The Dashboard will the ### Pricing - +<$Partial path="billing/pricing/pricing_pitr.mdx" /> For a detailed breakdown of how charges are calculated, refer to [Manage Point-in-Time Recovery usage](/docs/guides/platform/manage-your-usage/point-in-time-recovery). diff --git a/apps/docs/content/guides/platform/manage-your-usage/advanced-mfa-phone.mdx b/apps/docs/content/guides/platform/manage-your-usage/advanced-mfa-phone.mdx index 681e34513d9..018ba7d0cc9 100644 --- a/apps/docs/content/guides/platform/manage-your-usage/advanced-mfa-phone.mdx +++ b/apps/docs/content/guides/platform/manage-your-usage/advanced-mfa-phone.mdx @@ -34,7 +34,7 @@ Usage is shown as "Auth MFA Phone Hours" on your invoice. ## Pricing - +<$Partial path="billing/pricing/pricing_mfa_phone.mdx" /> ## Billing examples diff --git a/apps/docs/content/guides/platform/manage-your-usage/branching.mdx b/apps/docs/content/guides/platform/manage-your-usage/branching.mdx index f7360d95150..8c9d3e1362c 100644 --- a/apps/docs/content/guides/platform/manage-your-usage/branching.mdx +++ b/apps/docs/content/guides/platform/manage-your-usage/branching.mdx @@ -19,7 +19,7 @@ Compute incurred by Preview branches is shown as "Branching Compute Hours" on yo ## Pricing - +<$Partial path="billing/pricing/pricing_branching.mdx" /> ## Billing examples diff --git a/apps/docs/content/guides/platform/manage-your-usage/edge-function-invocations.mdx b/apps/docs/content/guides/platform/manage-your-usage/edge-function-invocations.mdx index a89fbc60202..e16aee3afdd 100644 --- a/apps/docs/content/guides/platform/manage-your-usage/edge-function-invocations.mdx +++ b/apps/docs/content/guides/platform/manage-your-usage/edge-function-invocations.mdx @@ -28,7 +28,7 @@ Usage is shown as "Function Invocations" on your invoice. ## Pricing - +<$Partial path="billing/pricing/pricing_edge_functions.mdx" /> ## Billing examples diff --git a/apps/docs/content/guides/platform/manage-your-usage/monthly-active-users-sso.mdx b/apps/docs/content/guides/platform/manage-your-usage/monthly-active-users-sso.mdx index e74c4faa04d..1750bc78e51 100644 --- a/apps/docs/content/guides/platform/manage-your-usage/monthly-active-users-sso.mdx +++ b/apps/docs/content/guides/platform/manage-your-usage/monthly-active-users-sso.mdx @@ -67,7 +67,7 @@ Usage is shown as "Monthly Active SSO Users" on your invoice. ## Pricing - +<$Partial path="billing/pricing/pricing_mau_sso.mdx" /> diff --git a/apps/docs/content/guides/platform/manage-your-usage/monthly-active-users-third-party.mdx b/apps/docs/content/guides/platform/manage-your-usage/monthly-active-users-third-party.mdx index 231653b5374..b120282ef04 100644 --- a/apps/docs/content/guides/platform/manage-your-usage/monthly-active-users-third-party.mdx +++ b/apps/docs/content/guides/platform/manage-your-usage/monthly-active-users-third-party.mdx @@ -64,7 +64,7 @@ Usage is shown as "Monthly Active Third-Party Users" on your invoice. ## Pricing - +<$Partial path="billing/pricing/pricing_mau_third_party.mdx" /> diff --git a/apps/docs/content/guides/platform/manage-your-usage/monthly-active-users.mdx b/apps/docs/content/guides/platform/manage-your-usage/monthly-active-users.mdx index 409618fee91..bb72b33078c 100644 --- a/apps/docs/content/guides/platform/manage-your-usage/monthly-active-users.mdx +++ b/apps/docs/content/guides/platform/manage-your-usage/monthly-active-users.mdx @@ -59,7 +59,7 @@ Usage is shown as "Monthly Active Users" on your invoice. ## Pricing - +<$Partial path="billing/pricing/pricing_mau.mdx" /> diff --git a/apps/docs/content/guides/platform/manage-your-usage/point-in-time-recovery.mdx b/apps/docs/content/guides/platform/manage-your-usage/point-in-time-recovery.mdx index 93372b3509e..c25a769c030 100644 --- a/apps/docs/content/guides/platform/manage-your-usage/point-in-time-recovery.mdx +++ b/apps/docs/content/guides/platform/manage-your-usage/point-in-time-recovery.mdx @@ -28,7 +28,7 @@ Usage is shown as "Point-in-time recovery Hours" on your invoice. ## Pricing - +<$Partial path="billing/pricing/pricing_pitr.mdx" /> ## Billing examples diff --git a/apps/docs/content/guides/platform/manage-your-usage/realtime-messages.mdx b/apps/docs/content/guides/platform/manage-your-usage/realtime-messages.mdx index 140dbd0bed5..84470627ad0 100644 --- a/apps/docs/content/guides/platform/manage-your-usage/realtime-messages.mdx +++ b/apps/docs/content/guides/platform/manage-your-usage/realtime-messages.mdx @@ -34,7 +34,7 @@ Usage is shown as "Realtime Messages" on your invoice. ## Pricing - +<$Partial path="billing/pricing/pricing_realtime_messages.mdx" /> ## Billing examples diff --git a/apps/docs/content/guides/platform/manage-your-usage/realtime-peak-connections.mdx b/apps/docs/content/guides/platform/manage-your-usage/realtime-peak-connections.mdx index a7627035b07..337f1d47cbb 100644 --- a/apps/docs/content/guides/platform/manage-your-usage/realtime-peak-connections.mdx +++ b/apps/docs/content/guides/platform/manage-your-usage/realtime-peak-connections.mdx @@ -39,7 +39,7 @@ Usage is shown as "Realtime Peak Connections" on your invoice. ## Pricing - +<$Partial path="billing/pricing/pricing_realtime_connections.mdx" /> ## Billing examples diff --git a/apps/docs/content/guides/platform/manage-your-usage/storage-image-transformations.mdx b/apps/docs/content/guides/platform/manage-your-usage/storage-image-transformations.mdx index 7ef6612f103..cc3cfa27db8 100644 --- a/apps/docs/content/guides/platform/manage-your-usage/storage-image-transformations.mdx +++ b/apps/docs/content/guides/platform/manage-your-usage/storage-image-transformations.mdx @@ -68,7 +68,7 @@ Usage is shown as "Storage Image Transformations" on your invoice. ## Pricing - +<$Partial path="billing/pricing/pricing_storage_image_transformations.mdx" /> ## Billing examples diff --git a/apps/docs/content/guides/platform/manage-your-usage/storage-size.mdx b/apps/docs/content/guides/platform/manage-your-usage/storage-size.mdx index 692f49711f0..2bcf87ca199 100644 --- a/apps/docs/content/guides/platform/manage-your-usage/storage-size.mdx +++ b/apps/docs/content/guides/platform/manage-your-usage/storage-size.mdx @@ -18,7 +18,7 @@ Usage is shown as "Storage Size GB-Hrs" on your invoice. ## Pricing - +<$Partial path="billing/pricing/pricing_storage_size.mdx" /> ## Billing examples diff --git a/apps/docs/content/guides/platform/migrating-to-supabase/amazon-rds.mdx b/apps/docs/content/guides/platform/migrating-to-supabase/amazon-rds.mdx index ab2adb8878e..a680e3eaefc 100644 --- a/apps/docs/content/guides/platform/migrating-to-supabase/amazon-rds.mdx +++ b/apps/docs/content/guides/platform/migrating-to-supabase/amazon-rds.mdx @@ -94,7 +94,8 @@ Alternatively, you can use [pgloader](https://github.com/dimitri/pgloader), a fl - +<$Partial path="migration_warnings.mdx" /> + ## Enterprise [Contact us](https://forms.supabase.com/enterprise) if you need more help migrating your project. diff --git a/apps/docs/content/guides/platform/migrating-to-supabase/heroku.mdx b/apps/docs/content/guides/platform/migrating-to-supabase/heroku.mdx index 97ebd32a120..94860a7d034 100644 --- a/apps/docs/content/guides/platform/migrating-to-supabase/heroku.mdx +++ b/apps/docs/content/guides/platform/migrating-to-supabase/heroku.mdx @@ -65,7 +65,7 @@ psql -d "$YOUR_CONNECTION_STRING" -f heroku_dump.sql Run `pg_dump --help` for a full list of options. - +<$Partial path="migration_warnings.mdx" /> ## Enterprise diff --git a/apps/docs/content/guides/platform/migrating-to-supabase/mssql.mdx b/apps/docs/content/guides/platform/migrating-to-supabase/mssql.mdx index bf8663bc3e3..51d7080fb06 100644 --- a/apps/docs/content/guides/platform/migrating-to-supabase/mssql.mdx +++ b/apps/docs/content/guides/platform/migrating-to-supabase/mssql.mdx @@ -73,7 +73,7 @@ Alternatively, you can use [pgloader](https://github.com/dimitri/pgloader), a fl - +<$Partial path="migration_warnings.mdx" /> ## Enterprise diff --git a/apps/docs/content/guides/platform/migrating-to-supabase/mysql.mdx b/apps/docs/content/guides/platform/migrating-to-supabase/mysql.mdx index c39185fd955..9aba64e0d2a 100644 --- a/apps/docs/content/guides/platform/migrating-to-supabase/mysql.mdx +++ b/apps/docs/content/guides/platform/migrating-to-supabase/mysql.mdx @@ -74,7 +74,7 @@ Alternatively, you can use [pgloader](https://github.com/dimitri/pgloader), a fl - +<$Partial path="migration_warnings.mdx" /> ## Enterprise diff --git a/apps/docs/content/guides/platform/migrating-to-supabase/neon.mdx b/apps/docs/content/guides/platform/migrating-to-supabase/neon.mdx index 1ec8b17c298..11cb75c29a1 100644 --- a/apps/docs/content/guides/platform/migrating-to-supabase/neon.mdx +++ b/apps/docs/content/guides/platform/migrating-to-supabase/neon.mdx @@ -83,7 +83,7 @@ Additional options Run `pg_dump --help` for a full list of options. - +<$Partial path="migration_warnings.mdx" /> ## Enterprise diff --git a/apps/docs/content/guides/platform/migrating-to-supabase/postgres.mdx b/apps/docs/content/guides/platform/migrating-to-supabase/postgres.mdx index 37f37de30da..aaf77fc4843 100644 --- a/apps/docs/content/guides/platform/migrating-to-supabase/postgres.mdx +++ b/apps/docs/content/guides/platform/migrating-to-supabase/postgres.mdx @@ -80,7 +80,7 @@ Run `pg_dump --help` for a full list of options. - +<$Partial path="migration_warnings.mdx" /> ## Enterprise diff --git a/apps/docs/content/guides/platform/migrating-to-supabase/render.mdx b/apps/docs/content/guides/platform/migrating-to-supabase/render.mdx index 5413cbe5f66..aea3ca0449c 100644 --- a/apps/docs/content/guides/platform/migrating-to-supabase/render.mdx +++ b/apps/docs/content/guides/platform/migrating-to-supabase/render.mdx @@ -82,7 +82,7 @@ Run `pg_dump --help` for a full list of options. - +<$Partial path="migration_warnings.mdx" /> ## Enterprise diff --git a/apps/docs/content/guides/platform/migrating-to-supabase/vercel-postgres.mdx b/apps/docs/content/guides/platform/migrating-to-supabase/vercel-postgres.mdx index 8a6721fc249..94e8a6bb0fd 100644 --- a/apps/docs/content/guides/platform/migrating-to-supabase/vercel-postgres.mdx +++ b/apps/docs/content/guides/platform/migrating-to-supabase/vercel-postgres.mdx @@ -90,7 +90,7 @@ Additional options Run `pg_dump --help` for a full list of options. - +<$Partial path="migration_warnings.mdx" /> ## Enterprise diff --git a/apps/docs/content/guides/platform/migrating-within-supabase/backup-restore.mdx b/apps/docs/content/guides/platform/migrating-within-supabase/backup-restore.mdx index 773d0ccf140..5331b997d0c 100644 --- a/apps/docs/content/guides/platform/migrating-within-supabase/backup-restore.mdx +++ b/apps/docs/content/guides/platform/migrating-within-supabase/backup-restore.mdx @@ -82,7 +82,7 @@ breadcrumb: 'Migrations' >
- + <$Partial path="postgres_installation.mdx" />
diff --git a/apps/docs/content/guides/platform/migrating-within-supabase/dashboard-restore.mdx b/apps/docs/content/guides/platform/migrating-within-supabase/dashboard-restore.mdx index bef0874c8d8..9501394fb95 100644 --- a/apps/docs/content/guides/platform/migrating-within-supabase/dashboard-restore.mdx +++ b/apps/docs/content/guides/platform/migrating-within-supabase/dashboard-restore.mdx @@ -19,7 +19,7 @@ breadcrumb: 'Migrations' header="Install Postgres and psql" id="install-postgres" > - + <$Partial path="postgres_installation.mdx" />
diff --git a/apps/docs/content/guides/realtime/pricing.mdx b/apps/docs/content/guides/realtime/pricing.mdx index fa877d527cf..735fe83707b 100644 --- a/apps/docs/content/guides/realtime/pricing.mdx +++ b/apps/docs/content/guides/realtime/pricing.mdx @@ -7,12 +7,12 @@ You are charged for the number of Realtime messages and the number of Realtime p ## Messages - +<$Partial path="billing/pricing/pricing_realtime_messages.mdx" /> For a detailed explanation of how charges are calculated, refer to [Manage Realtime Messages usage](/docs/guides/platform/manage-your-usage/realtime-messages). ## Peak connections - +<$Partial path="billing/pricing/pricing_realtime_connections.mdx" /> For a detailed explanation of how charges are calculated, refer to [Manage Realtime Peak Connections usage](/docs/guides/platform/manage-your-usage/realtime-peak-connections). diff --git a/apps/docs/content/guides/storage/management/pricing.mdx b/apps/docs/content/guides/storage/management/pricing.mdx index 82fc8e6d0f9..a881d5cce19 100644 --- a/apps/docs/content/guides/storage/management/pricing.mdx +++ b/apps/docs/content/guides/storage/management/pricing.mdx @@ -5,7 +5,7 @@ title: 'Pricing' You are charged for the total size of all assets in your buckets. - +<$Partial path="billing/pricing/pricing_storage_size.mdx" /> For a detailed explanation of how charges are calculated, refer to [Manage Storage size usage](/docs/guides/platform/manage-your-usage/storage-size). diff --git a/apps/docs/content/guides/storage/serving/image-transformations.mdx b/apps/docs/content/guides/storage/serving/image-transformations.mdx index 5b90187e49f..feebfbb1d72 100644 --- a/apps/docs/content/guides/storage/serving/image-transformations.mdx +++ b/apps/docs/content/guides/storage/serving/image-transformations.mdx @@ -599,7 +599,7 @@ response = supabase.storage.from_('bucket').download( ## Pricing - +<$Partial path="billing/pricing/pricing_storage_image_transformations.mdx" /> For a detailed breakdown of how charges are calculated, refer to [Manage Storage Image Transformations usage](/docs/guides/platform/manage-your-usage/storage-image-transformations). diff --git a/apps/docs/docs/ref/javascript/v1/upgrade-guide.mdx b/apps/docs/docs/ref/javascript/v1/upgrade-guide.mdx index f42d77c827a..7eafa3254d0 100644 --- a/apps/docs/docs/ref/javascript/v1/upgrade-guide.mdx +++ b/apps/docs/docs/ref/javascript/v1/upgrade-guide.mdx @@ -249,12 +249,13 @@ const { error } = await supabase const { data, error } = await supabase .auth .signInWithOtp({ phone }) - + // After receiving a SMS with a OTP. const { data, error } = await supabase - .auth - .verifyOtp({ phone, token }) -``` +.auth +.verifyOtp({ phone, token }) + +```` @@ -283,7 +284,7 @@ const { data, error } = await supabase .auth .api .resetPasswordForEmail(email) -``` +```` @@ -304,7 +305,7 @@ const { data, error } = await supabase #### Get the user's current session - +<$Partial path="get_session_warning.mdx" /> diff --git a/apps/docs/features/directives/CodeSample.ts b/apps/docs/features/directives/CodeSample.ts index ac81693a120..85125a1bb17 100644 --- a/apps/docs/features/directives/CodeSample.ts +++ b/apps/docs/features/directives/CodeSample.ts @@ -30,15 +30,7 @@ import * as acorn from 'acorn' import tsPlugin from 'acorn-typescript' import { type BlockContent, type Code, type Root } from 'mdast' -import type { - MdxJsxAttribute, - MdxJsxAttributeValueExpression, - MdxJsxExpressionAttribute, - MdxJsxFlowElement, - MdxJsxFlowElementHast, - MdxJsxTextElement, - MdxJsxTextElementHast, -} from 'mdast-util-mdx-jsx' +import type { MdxJsxAttributeValueExpression, MdxJsxFlowElement } from 'mdast-util-mdx-jsx' import { readFile } from 'node:fs/promises' import { join } from 'node:path' import { type Parent } from 'unist' @@ -48,6 +40,7 @@ import { z, type SafeParseError } from 'zod' import { fetchWithNextOptions } from '~/features/helpers.fetch' import { IS_PLATFORM } from '~/lib/constants' import { EXAMPLES_DIRECTORY } from '~/lib/docs' +import { getAttributeValue, getAttributeValueExpression } from './utils.server' const ALLOW_LISTED_GITHUB_ORGS = ['supabase', 'supabase-community'] as [string, ...string[]] @@ -229,23 +222,6 @@ async function fetchSourceCodeContent(tree: Root, deps: Dependencies) { return nodeContentMap } -function getAttributeValue( - node: MdxJsxFlowElement | MdxJsxFlowElementHast | MdxJsxTextElement | MdxJsxTextElementHast, - attributeName: string -) { - return ( - node.attributes.find( - (attr: MdxJsxAttribute | MdxJsxExpressionAttribute) => - 'name' in attr && attr.name === attributeName - )?.value ?? undefined - ) -} - -function getAttributeValueExpression(node: MdxJsxAttributeValueExpression | string | undefined) { - if (typeof node === 'string' || node?.type !== 'mdxJsxAttributeValueExpression') return undefined - return node.value -} - function rewriteNodes(contentMap: Map) { for (const [node, [meta, content]] of contentMap) { const lang = matchLang(meta.path.split('.').pop()) diff --git a/apps/docs/features/directives/Partial.test.ts b/apps/docs/features/directives/Partial.test.ts new file mode 100644 index 00000000000..58719aae357 --- /dev/null +++ b/apps/docs/features/directives/Partial.test.ts @@ -0,0 +1,118 @@ +import { describe, it, expect } from 'vitest' + +import { mdxToMarkdown } from 'mdast-util-mdx' +import { toMarkdown } from 'mdast-util-to-markdown' + +import { partialsRemark } from './Partial' +import { fromDocsMarkdown } from './utils.server' + +describe('$Partial', () => { + it('should replace partial marker with partial contents', async () => { + const markdown = ` +# Embed partial + +<$Partial path="/_fixtures/test.mdx" /> + +Some more text. +`.trim() + + const mdast = fromDocsMarkdown(markdown) + const transformed = await partialsRemark()(mdast) + const output = toMarkdown(transformed, { extensions: [mdxToMarkdown()] }) + + const expected = ` +# Embed partial + +Here is some content to embed as a partial. + +## A heading + +Some more stuff, including: + +* A list +* With two items + +And some custom components: + + + Some stuff. + + In two paragraphs. + + + + +An entire paragraph: It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way... + +Some more text. +`.trimStart() + + expect(output).toEqual(expected) + }) + + it('should replace nested partials', async () => { + const markdown = ` +# Embed partial + +<$Partial path="/_fixtures/nested1.mdx" /> + +Some more text. +`.trim() + + const mdast = fromDocsMarkdown(markdown) + const transformed = await partialsRemark()(mdast) + const output = toMarkdown(transformed, { extensions: [mdxToMarkdown()] }) + + const expected = ` +# Embed partial + +First level of nesting: + +{/* prettier-ignore */} + +Second level of nesting. + +Some more text. +`.trimStart() + + expect(output).toEqual(expected) + }) + + it('should substitute variables', async () => { + const markdown = ` +# Embed partial + +<$Partial path="/_fixtures/variables.mdx" variables={{ "var": "string replacement" }} /> + +Some more text. +`.trim() + + const mdast = fromDocsMarkdown(markdown) + const transformed = await partialsRemark()(mdast) + + const output = toMarkdown(transformed, { extensions: [mdxToMarkdown()] }) + + const expected = ` +# Embed partial + +Here is a partial that takes a string replacement. + +Some more text. +`.trimStart() + + expect(output).toEqual(expected) + }) + + it('should error on invalid substitutions', async () => { + const markdown = ` +# Embed partial + +<$Partial path="/_fixtures/variables.mdx" variables={{ "var": [0, 1, 2, 3] }} /> + +Some more text. +`.trim() + + const mdast = fromDocsMarkdown(markdown) + await expect(partialsRemark()(mdast)).rejects.toThrowError(/valid JSON/) + }) +}) diff --git a/apps/docs/features/directives/Partial.ts b/apps/docs/features/directives/Partial.ts new file mode 100644 index 00000000000..eec3b109ebf --- /dev/null +++ b/apps/docs/features/directives/Partial.ts @@ -0,0 +1,142 @@ +/** + * The Partial directive supports inclusion of content from a separate source + * code file within the apps/docs/content/_partials directory. The content is + * directly inlined into the page, and thus supports MDX components that would + * be supported in inline MDX content. + * + * Simple string replacement is supported. The replacement strings are + * specified using the `variables` field. + * + * ## Examples + * + * ### Simple partial + * + * ```mdx + * <$Partial + * path="relative/path/from/partials/directory.mdx" + * /> + * ``` + * + * ### With string replacement + * + * Variables takes a JSON object with string values. + * + * ```mdx + * <$Partial + * path="relative/path/from/partials/directory.mdx" + * variables={{ "product": "Auth" }} + * /> + * ``` + * + * ```mdx + * Here is the partial content, with replacement of variable {{ .product }} + * ``` + */ + +import { type Root } from 'mdast' +import type { MdxJsxFlowElement } from 'mdast-util-mdx-jsx' +import { readFile } from 'node:fs/promises' +import { join } from 'node:path' +import { type Parent } from 'unist' +import { visitParents } from 'unist-util-visit-parents' + +import { PARTIALS_DIRECTORY } from '~/lib/docs' +import { fromDocsMarkdown, getAttributeValue, getAttributeValueExpression } from './utils.server' + +export function partialsRemark() { + return async function transform(tree: Root) { + while (true) { + const contentMap = await fetchPartialsContent(tree) + rewriteNodes(contentMap) + if (contentMap.size === 0) { + break + } + } + return tree + } +} + +function isMdFile(path: string) { + return path.endsWith('.md') || path.endsWith('.mdx') +} + +function toFilePath(node: MdxJsxFlowElement) { + const path = getAttributeValue(node, 'path') + if (typeof path !== 'string' || !isMdFile(path)) { + throw new Error('Invalid $Partial path: path must end with .mdx or .md') + } + const filePath = join(PARTIALS_DIRECTORY, path) + if (!filePath.startsWith(PARTIALS_DIRECTORY)) { + throw new Error(`Invalid $Partial path: Path must be inside ${PARTIALS_DIRECTORY}`) + } + return filePath +} + +function substituteVars(content: string, vars: Record | undefined) { + if (vars === undefined) { + return content + } + + for (const [key, value] of Object.entries(vars)) { + content = content.replace(new RegExp(`(? { + const variables = getAttributeValueExpression(getAttributeValue(node, 'variables')) + if (variables === undefined) { + return + } + + try { + const parsed = JSON.parse(variables) + for (const value of Object.values(parsed)) { + if (typeof value !== 'string') { + throw new Error('Only string values are allowed') + } + } + return parsed + } catch { + throw new Error('Invalid $Partial variables: must be valid JSON containing only string values') + } +} + +async function fetchPartialsContent(tree: Root) { + // INVARIANT: These must be pushed to in the same order because the index is // used to keep track of the relationship. + const partialNodes = [] as [Parent, MdxJsxFlowElement, undefined | Record][] + const pendingFetches = [] as Promise[] + + visitParents(tree, 'mdxJsxFlowElement', (node: MdxJsxFlowElement, ancestors) => { + if (node.name !== '$Partial') return + + const parent = ancestors[ancestors.length - 1] + const filePath = toFilePath(node) + const variables = getVariables(node) + const fetchTask = readFile(filePath, 'utf-8') + + partialNodes.push([parent, node, variables]) + pendingFetches.push(fetchTask) + }) + + const resolvedContent = await Promise.all(pendingFetches) + + const nodeContentMap = new Map< + MdxJsxFlowElement, + [Parent, string, undefined | Record] + >() + partialNodes.forEach(([parent, node, variables], index) => { + nodeContentMap.set(node, [parent, resolvedContent[index], variables]) + }) + return nodeContentMap +} + +function rewriteNodes( + contentMap: Map]> +) { + for (const [node, [parent, rawContent, vars]] of contentMap) { + let content = substituteVars(rawContent.trim(), vars) + const replacementContent = fromDocsMarkdown(content) + parent.children.splice(parent.children.indexOf(node), 1, replacementContent) + } +} diff --git a/apps/docs/features/directives/utils.server.ts b/apps/docs/features/directives/utils.server.ts new file mode 100644 index 00000000000..3b155a0401c --- /dev/null +++ b/apps/docs/features/directives/utils.server.ts @@ -0,0 +1,40 @@ +import { fromMarkdown } from 'mdast-util-from-markdown' +import { gfmFromMarkdown } from 'mdast-util-gfm' +import { mdxFromMarkdown } from 'mdast-util-mdx' +import type { + MdxJsxAttribute, + MdxJsxAttributeValueExpression, + MdxJsxExpressionAttribute, + MdxJsxFlowElement, + MdxJsxFlowElementHast, + MdxJsxTextElement, + MdxJsxTextElementHast, +} from 'mdast-util-mdx-jsx' +import { gfm } from 'micromark-extension-gfm' +import { mdxjs } from 'micromark-extension-mdxjs' + +export function getAttributeValue( + node: MdxJsxFlowElement | MdxJsxFlowElementHast | MdxJsxTextElement | MdxJsxTextElementHast, + attributeName: string +) { + return ( + node.attributes.find( + (attr: MdxJsxAttribute | MdxJsxExpressionAttribute) => + 'name' in attr && attr.name === attributeName + )?.value ?? undefined + ) +} + +export function getAttributeValueExpression( + node: MdxJsxAttributeValueExpression | string | undefined +) { + if (typeof node === 'string' || node?.type !== 'mdxJsxAttributeValueExpression') return undefined + return node.value +} + +export function fromDocsMarkdown(markdown: string) { + return fromMarkdown(markdown, { + mdastExtensions: [mdxFromMarkdown(), gfmFromMarkdown()], + extensions: [mdxjs(), gfm()], + }) +} diff --git a/apps/docs/features/directives/utils.ts b/apps/docs/features/directives/utils.ts index e4b172272e0..598aeff7121 100644 --- a/apps/docs/features/directives/utils.ts +++ b/apps/docs/features/directives/utils.ts @@ -1,24 +1,21 @@ import { type Root } from 'mdast' -import { fromMarkdown } from 'mdast-util-from-markdown' -import { gfmFromMarkdown, gfmToMarkdown } from 'mdast-util-gfm' -import { mdxFromMarkdown, mdxToMarkdown } from 'mdast-util-mdx' +import { gfmToMarkdown } from 'mdast-util-gfm' +import { mdxToMarkdown } from 'mdast-util-mdx' import { toMarkdown } from 'mdast-util-to-markdown' -import { gfm } from 'micromark-extension-gfm' -import { mdxjs } from 'micromark-extension-mdxjs' import remarkMkDocsAdmonition from '~/lib/mdx/plugins/remarkAdmonition' import remarkPyMdownTabs from '~/lib/mdx/plugins/remarkTabs' import { getGitHubFileContentsImmutableOnly } from '~/lib/octokit' import { codeSampleRemark } from './CodeSample' +import { fromDocsMarkdown } from './utils.server' +import { partialsRemark } from './Partial' type Transformer = (ast: Root) => Root | Promise export async function preprocessMdx(mdx: string, transformers: Transformer[]) { - let mdast = fromMarkdown(mdx, { - mdastExtensions: [mdxFromMarkdown(), gfmFromMarkdown()], - extensions: [mdxjs(), gfm()], - }) + if (!mdx) return mdx + let mdast = fromDocsMarkdown(mdx) for (const transform of transformers) { mdast = await transform(mdast) } @@ -34,5 +31,6 @@ export function preprocessMdxWithDefaults(mdx: string) { codeSampleRemark({ fetchFromGitHub: getGitHubFileContentsImmutableOnly, }), + partialsRemark(), ]) } diff --git a/apps/docs/features/docs/GuidesMdx.template.tsx b/apps/docs/features/docs/GuidesMdx.template.tsx index 7b4fcab6d78..f43b2fd172b 100644 --- a/apps/docs/features/docs/GuidesMdx.template.tsx +++ b/apps/docs/features/docs/GuidesMdx.template.tsx @@ -7,7 +7,7 @@ import { cn } from 'ui' import Breadcrumbs from '~/components/Breadcrumbs' import GuidesTableOfContents from '~/components/GuidesTableOfContents' -import { MDXProviderGuides, TocAnchorsProvider } from '~/features/docs/GuidesMdx.client' +import { TocAnchorsProvider } from '~/features/docs/GuidesMdx.client' import { MDXRemoteBase } from '~/features/docs/MdxBase' import type { WithRequired } from '~/features/helpers.types' import { type GuideFrontmatter } from '~/lib/docs' @@ -64,77 +64,73 @@ const GuideTemplate = ({ meta, content, children, editLink, mdxOptions }: GuideT const hideToc = meta?.hideToc || meta?.hide_table_of_contents return ( - - -
-
- -
-

- {meta?.title || 'Supabase Docs'} -

- {meta?.subtitle && ( -

- {meta.subtitle} -

- )} -
- - {content && } - {children} - -
-
- {!hideToc && ( - + +
+
+ +
+

+ {meta?.title || 'Supabase Docs'} +

+ {meta?.subtitle && ( +

+ {meta.subtitle} +

+ )} +
+ + {content && } + {children} + +
- - + {!hideToc && ( + + )} +
+
) } diff --git a/apps/docs/features/docs/MdxBase.shared.tsx b/apps/docs/features/docs/MdxBase.shared.tsx index 1a0b6131efb..93427d9e71d 100644 --- a/apps/docs/features/docs/MdxBase.shared.tsx +++ b/apps/docs/features/docs/MdxBase.shared.tsx @@ -13,34 +13,6 @@ import { CostWarning } from '~/components/AuthSmsProviderConfig/AuthSmsProviderC import ButtonCard from '~/components/ButtonCard' import { Extensions } from '~/components/Extensions' import { JwtGenerator } from '~/components/JwtGenerator' -import { - AuthErrorCodesTable, - AuthRateLimits, - CreateClientSnippet, - DatabaseSetup, - GetSessionWarning, - HuggingFaceDeployment, - KotlinProjectSetup, - MigrationWarnings, - OAuthPkceFlow, - ProjectSetup, - QuickstartDbSetup, - QuickstartIntro, - SocialProviderSettingsSupabase, - SocialProviderSetup, - PostgresInstallation, - PricingMfaPhone, - PricingBranching, - PricingEdgeFunctions, - PricingMau, - PricingMauSso, - PricingMauThirdParty, - PricingPitr, - PricingRealtimeMessages, - PricingRealtimeConnections, - PricingStorageImageTransformations, - PricingStorageSize, -} from '~/components/MDX/partials' import { NavData } from '~/components/NavData' import { ProjectConfigVariables } from '~/components/ProjectConfigVariables' import { RealtimeLimitsEstimator } from '~/components/RealtimeLimitsEstimator' @@ -59,8 +31,6 @@ const components = { AccordionItem, Admonition, // Admonition: (props: AdmonitionProps) => , - AuthErrorCodesTable, - AuthRateLimits, AuthSmsProviderConfig, AppleSecretGenerator, AuthProviders, @@ -70,50 +40,26 @@ const components = { CodeSampleDummy, CodeSampleWrapper, CostWarning, - CreateClientSnippet, - DatabaseSetup, Extensions, - GetSessionWarning, GlassPanel, - HuggingFaceDeployment, IconArrowDown: ArrowDown, IconCheck: Check, IconPanel, IconX: X, Image: (props: any) => , JwtGenerator, - KotlinProjectSetup, Link, - MigrationWarnings, NavData, - OAuthPkceFlow, ProjectConfigVariables, - ProjectSetup, - QuickstartDbSetup, - QuickstartIntro, RealtimeLimitsEstimator, RegionsList, SharedData, ShowUntil, - SocialProviderSettingsSupabase, - SocialProviderSetup, - PostgresInstallation, SqlToRest, StepHikeCompact, Tabs, TabPanel, InfoTooltip, - PricingMfaPhone, - PricingBranching, - PricingEdgeFunctions, - PricingMau, - PricingMauSso, - PricingMauThirdParty, - PricingPitr, - PricingRealtimeMessages, - PricingRealtimeConnections, - PricingStorageImageTransformations, - PricingStorageSize, h2: (props: any) => ( {props.children} diff --git a/apps/docs/features/docs/Reference.mdx.client.tsx b/apps/docs/features/docs/Reference.mdx.client.tsx deleted file mode 100644 index 66ff1c58c12..00000000000 --- a/apps/docs/features/docs/Reference.mdx.client.tsx +++ /dev/null @@ -1,20 +0,0 @@ -'use client' - -/** - * The MDXProvider is necessary so that MDX partials will have access - * to components. - * - * Since the reference pages are so heavy, keep the weight down by only - * including the bare minimum. - */ - -import { MDXProvider } from '@mdx-js/react' -import { type PropsWithChildren } from 'react' - -import { Admonition } from 'ui-patterns/admonition' - -const components = { Admonition } - -export function MDXProviderReference({ children }: PropsWithChildren) { - return {children} -} diff --git a/apps/docs/features/docs/Reference.mdx.tsx b/apps/docs/features/docs/Reference.mdx.tsx index eac8747683a..1024e5771ad 100644 --- a/apps/docs/features/docs/Reference.mdx.tsx +++ b/apps/docs/features/docs/Reference.mdx.tsx @@ -44,7 +44,7 @@ interface MDXRemoteRefsProps { function MDXRemoteRefs({ source }: MDXRemoteRefsProps) { const refComponents = { ...components, RefSubLayout, CliGlobalFlagsHandler } - return x} /> + return } export { getRefMarkdown, MDXRemoteRefs } diff --git a/apps/docs/features/docs/Reference.sections.tsx b/apps/docs/features/docs/Reference.sections.tsx index b68dd1a8938..c96179f5530 100644 --- a/apps/docs/features/docs/Reference.sections.tsx +++ b/apps/docs/features/docs/Reference.sections.tsx @@ -12,7 +12,6 @@ import { import ApiSchema from '~/components/ApiSchema' import { REFERENCES } from '~/content/navigation.references' import { MDXRemoteRefs, getRefMarkdown } from '~/features/docs/Reference.mdx' -import { MDXProviderReference } from '~/features/docs/Reference.mdx.client' import type { MethodTypes } from '~/features/docs/Reference.typeSpec' import { getApiEndpointById, @@ -48,18 +47,16 @@ async function RefSections({ libraryId, version }: RefSectionsProps) { flattenedSections = trimIntro(flattenedSections) return ( - -
- {flattenedSections - .filter((section) => section.type !== 'category') - .map((section, idx) => ( - - - - - ))} -
-
+
+ {flattenedSections + .filter((section) => section.type !== 'category') + .map((section, idx) => ( + + + + + ))} +
) } diff --git a/apps/docs/lib/docs.ts b/apps/docs/lib/docs.ts index bfcaf3772a1..14005b222d0 100644 --- a/apps/docs/lib/docs.ts +++ b/apps/docs/lib/docs.ts @@ -17,6 +17,7 @@ import codeHikeTheme from 'config/code-hike.theme.json' with { type: 'json' } export const DOCS_DIRECTORY = process.cwd() export const EXAMPLES_DIRECTORY = join(DOCS_DIRECTORY, 'examples') export const GUIDES_DIRECTORY = join(DOCS_DIRECTORY, 'content/guides') +export const PARTIALS_DIRECTORY = join(DOCS_DIRECTORY, 'content/_partials') export const REF_DOCS_DIRECTORY = join(DOCS_DIRECTORY, 'docs/ref') export const SPEC_DIRECTORY = join(DOCS_DIRECTORY, 'spec') diff --git a/apps/docs/turbo.json b/apps/docs/turbo.json index 59bfa4d6391..84d28434830 100644 --- a/apps/docs/turbo.json +++ b/apps/docs/turbo.json @@ -27,6 +27,7 @@ "NEXT_PUBLIC_DEV_AUTH_PAGE", "NEXT_PUBLIC_IS_PLATFORM", "NEXT_PUBLIC_VERCEL_ENV", + "NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA", // These envs are used in the packages "NEXT_PUBLIC_STORAGE_KEY", "NEXT_PUBLIC_AUTH_DEBUG_KEY", diff --git a/supa-mdx-lint/Rule003Spelling.toml b/supa-mdx-lint/Rule003Spelling.toml index 4e9d00102b1..b5e1c888acb 100644 --- a/supa-mdx-lint/Rule003Spelling.toml +++ b/supa-mdx-lint/Rule003Spelling.toml @@ -79,6 +79,7 @@ allow_list = [ "[Pp]sycopg", "[Qq]uickstarts?", "[Rr]ealtime", + "[Rr]eauthenticat(e|es|ed|ion)?", "[Rr]ebas(e|ed|es|ing)", "[Rr]eplayability", "[Rr]epos?", @@ -94,8 +95,10 @@ allow_list = [ "[Ss]ubfolders?", "[Ss]ubmodules?", "[Ss]wappiness", + "[Tt]imebox(ed)?", "[Tt]odos?", "[Tt]radeoffs?", + "[Uu]nlink(ing|s|ed)?", "[Uu]pserts?", "[Uu]ptime", "[Ww]aitlists?", @@ -105,6 +108,7 @@ allow_list = [ "AppleAuthentication", "Astro", "AsyncStorage", + "Authn", "Authy", "B-tree", "Basejump", @@ -260,6 +264,7 @@ allow_list = [ "Vonage", "Vue", "Wasm", + "WebAuthn", "WebAssembly", "WebP", "WebSockets?",