mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 15:39:13 +00:00
## Problem supabase-swift v3 is in alpha (`3.0.0-alpha.2`). The docs have no reference for it. v3 renames many public APIs, so the v2 reference does not help people who try the alpha. ## Solution Add a v3 reference at `/reference/swift/v3`. v2 stays the default at `/reference/swift`. - **Prerelease flag.** A version in `REFERENCES` can now set `prerelease: 'alpha'` (or another stage). Swift versions are `['v2', 'v3', 'v1']`. `versions[0]` is still the latest stable version, so the existing URL and "latest" logic does not change. Other SDKs can use the same flag. - **Alpha notice.** A prerelease page shows "This version is in alpha" with a link to the stable version. It does not show the "Version out of date" warning. - **Version menu.** Prerelease versions show in a separate "Prereleases" group with a stage badge. - **Spec.** `spec/supabase_swift_v3.yml` ports the v2 spec to the v3 API. The examples were checked against the v3 source at the `v3.0.0-alpha.2` tag. It adds the new v3 APIs: MFA recovery codes, `AuthAdminClient`, admin custom providers, `functions.stream`, and the Realtime streams API. - **Pages.** New introduction, installing (Xcode 26, Swift 6.2), and upgrade guide pages under `docs/ref/swift/v3/`. - **Navigation.** Nav entries for v3. v3 is excluded from the "TypeScript support" section. Not in this PR: - Search indexing for v3. Search still covers v2 only. - In the v2 spec, 7 filter ids use camelCase (for example `containedBy` and `textSearch`). They match no section, so they do not render in the v2 docs today. The v3 spec uses the matching kebab-case ids. The v2 fix can be a separate PR. ## Review instructions 1. Open `/docs/reference/swift/v3` on the preview. See the alpha notice and the v3 sections. 2. Open the version menu. See "Stable releases" (v2.0 with a "Latest" badge, v1.0) and "Prereleases" (v3.0 with an "Alpha" badge). 3. Open `/docs/reference/swift`. See that it still shows v2 with no notice. 4. Read the upgrade guide at `/docs/reference/swift/v3/upgrade-guide`. Typecheck, Prettier, and ESLint pass locally. I did not run the docs unit tests. The Swift examples were not compiled. <img width="318" height="236" alt="Screenshot 2026-11-25 at 10 36 01" src="https://github.com/user-attachments/assets/0f0caf18-7a4a-4835-8f6a-b76df9c66fa9" /> <img width="685" height="417" alt="Screenshot 2026-11-25 at 10 36 10" src="https://github.com/user-attachments/assets/1c55bc44-1fc1-4390-8d8c-48bc55822bd3" /> ## Checklist Check all before review: - [ ] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [ ] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs [style guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
317 lines
6.6 KiB
TypeScript
317 lines
6.6 KiB
TypeScript
import { memo } from 'react'
|
|
|
|
import type { NavMenuSection } from '../Navigation.types'
|
|
import NavigationMenuGuideList from './NavigationMenuGuideList'
|
|
import NavigationMenuRefList from './NavigationMenuRefList'
|
|
|
|
enum MenuId {
|
|
GettingStarted = 'gettingstarted',
|
|
Database = 'database',
|
|
Api = 'api',
|
|
Graphql = 'graphql',
|
|
Auth = 'auth',
|
|
Functions = 'functions',
|
|
Realtime = 'realtime',
|
|
Storage = 'storage',
|
|
Ai = 'ai',
|
|
Cron = 'cron',
|
|
Queues = 'queues',
|
|
Platform = 'platform',
|
|
Deployment = 'deployment',
|
|
Telemetry = 'telemetry',
|
|
Resources = 'resources',
|
|
Security = 'security',
|
|
SelfHosting = 'self_hosting',
|
|
Integrations = 'integrations',
|
|
AiTools = 'ai_tools',
|
|
LocalDevelopment = 'local_development',
|
|
Contributing = 'contributing',
|
|
RefServerV1 = 'reference_server_v1',
|
|
RefMiddlewareV1 = 'reference_middleware_v1',
|
|
RefTanstackDbV1 = 'reference_tanstack_db_v1',
|
|
RefJavaScriptV1 = 'reference_javascript_v1',
|
|
RefJavaScriptV2 = 'reference_javascript_v2',
|
|
RefDartV1 = 'reference_dart_v1',
|
|
RefDartV2 = 'reference_dart_v2',
|
|
RefCSharpV0 = 'reference_csharp_v0',
|
|
RefCSharpV1 = 'reference_csharp_v1',
|
|
RefCSharpV8 = 'reference_csharp_v8',
|
|
RefPythonV2 = 'reference_python_v2',
|
|
RefSwiftV1 = 'reference_swift_v1',
|
|
RefSwiftV2 = 'reference_swift_v2',
|
|
RefSwiftV3 = 'reference_swift_v3',
|
|
RefKotlinV1 = 'reference_kotlin_v1',
|
|
RefKotlinV2 = 'reference_kotlin_v2',
|
|
RefKotlinV3 = 'reference_kotlin_v3',
|
|
RefCli = 'reference_cli',
|
|
RefApi = 'reference_api',
|
|
SelfHostingAuth = 'reference_self_hosting_auth',
|
|
SelfHostingStorage = 'reference_self_hosting_storage',
|
|
SelfHostingRealtime = 'reference_self_hosting_realtime',
|
|
SelfHostingAnalytics = 'reference_self_hosting_analytics',
|
|
SelfHostingFunctions = 'reference_self_hosting_functions',
|
|
}
|
|
|
|
interface BaseMenu {
|
|
id: MenuId
|
|
type: string
|
|
}
|
|
|
|
interface GuideMenu extends BaseMenu {
|
|
type: 'guide'
|
|
}
|
|
|
|
interface ReferenceMenu extends BaseMenu {
|
|
type: 'reference'
|
|
path: string
|
|
commonSectionsFile?: string
|
|
}
|
|
|
|
type Menu = GuideMenu | ReferenceMenu
|
|
|
|
const menus: Menu[] = [
|
|
{
|
|
id: MenuId.GettingStarted,
|
|
type: 'guide',
|
|
},
|
|
{
|
|
id: MenuId.Database,
|
|
type: 'guide',
|
|
},
|
|
{
|
|
id: MenuId.Api,
|
|
type: 'guide',
|
|
},
|
|
{
|
|
id: MenuId.Graphql,
|
|
type: 'guide',
|
|
},
|
|
{
|
|
id: MenuId.Queues,
|
|
type: 'guide',
|
|
},
|
|
{
|
|
id: MenuId.Auth,
|
|
type: 'guide',
|
|
},
|
|
{
|
|
id: MenuId.Functions,
|
|
type: 'guide',
|
|
},
|
|
{
|
|
id: MenuId.Telemetry,
|
|
type: 'guide',
|
|
},
|
|
{
|
|
id: MenuId.Realtime,
|
|
type: 'guide',
|
|
},
|
|
{
|
|
id: MenuId.Storage,
|
|
type: 'guide',
|
|
},
|
|
{
|
|
id: MenuId.Ai,
|
|
type: 'guide',
|
|
},
|
|
{ id: MenuId.Cron, type: 'guide' },
|
|
{
|
|
id: MenuId.Platform,
|
|
type: 'guide',
|
|
},
|
|
{
|
|
id: MenuId.Resources,
|
|
type: 'guide',
|
|
},
|
|
{
|
|
id: MenuId.Security,
|
|
type: 'guide',
|
|
},
|
|
{
|
|
id: MenuId.SelfHosting,
|
|
type: 'guide',
|
|
},
|
|
{
|
|
id: MenuId.Integrations,
|
|
type: 'guide',
|
|
},
|
|
{
|
|
id: MenuId.LocalDevelopment,
|
|
type: 'guide',
|
|
},
|
|
{
|
|
id: MenuId.AiTools,
|
|
type: 'guide',
|
|
},
|
|
{
|
|
id: MenuId.Contributing,
|
|
type: 'guide',
|
|
},
|
|
{
|
|
id: MenuId.Deployment,
|
|
type: 'guide',
|
|
},
|
|
{
|
|
id: MenuId.RefServerV1,
|
|
type: 'reference',
|
|
path: '/reference/server',
|
|
},
|
|
{
|
|
id: MenuId.RefMiddlewareV1,
|
|
type: 'reference',
|
|
path: '/reference/middleware',
|
|
},
|
|
{
|
|
id: MenuId.RefJavaScriptV1,
|
|
type: 'reference',
|
|
path: '/reference/javascript/v1',
|
|
},
|
|
{
|
|
id: MenuId.RefJavaScriptV2,
|
|
type: 'reference',
|
|
path: '/reference/javascript',
|
|
},
|
|
{
|
|
id: MenuId.RefDartV1,
|
|
type: 'reference',
|
|
path: '/reference/dart/v1',
|
|
},
|
|
{
|
|
id: MenuId.RefDartV2,
|
|
type: 'reference',
|
|
path: '/reference/dart',
|
|
},
|
|
{
|
|
id: MenuId.RefCSharpV0,
|
|
type: 'reference',
|
|
path: '/reference/csharp/v0',
|
|
},
|
|
{
|
|
id: MenuId.RefCSharpV1,
|
|
type: 'reference',
|
|
path: '/reference/csharp/v1',
|
|
},
|
|
{
|
|
id: MenuId.RefCSharpV8,
|
|
type: 'reference',
|
|
path: '/reference/csharp',
|
|
},
|
|
{
|
|
id: MenuId.RefPythonV2,
|
|
type: 'reference',
|
|
path: '/reference/python',
|
|
},
|
|
{
|
|
id: MenuId.RefSwiftV1,
|
|
type: 'reference',
|
|
path: '/reference/swift',
|
|
},
|
|
{
|
|
id: MenuId.RefSwiftV2,
|
|
type: 'reference',
|
|
path: '/reference/swift',
|
|
},
|
|
{
|
|
id: MenuId.RefSwiftV3,
|
|
type: 'reference',
|
|
path: '/reference/swift/v3',
|
|
},
|
|
{
|
|
id: MenuId.RefKotlinV1,
|
|
type: 'reference',
|
|
path: '/reference/kotlin/v1',
|
|
},
|
|
{
|
|
id: MenuId.RefKotlinV2,
|
|
type: 'reference',
|
|
path: '/reference/kotlin/v2',
|
|
},
|
|
{
|
|
id: MenuId.RefKotlinV3,
|
|
type: 'reference',
|
|
path: '/reference/kotlin',
|
|
},
|
|
{
|
|
id: MenuId.RefCli,
|
|
type: 'reference',
|
|
path: '/reference/cli',
|
|
commonSectionsFile: 'common-cli-sections.json',
|
|
},
|
|
{
|
|
id: MenuId.RefApi,
|
|
type: 'reference',
|
|
path: '/reference/api',
|
|
commonSectionsFile: 'common-api-sections.json',
|
|
},
|
|
{
|
|
id: MenuId.SelfHostingAuth,
|
|
type: 'reference',
|
|
path: '/reference/self-hosting-auth',
|
|
commonSectionsFile: 'common-self-hosting-auth-sections.json',
|
|
},
|
|
{
|
|
id: MenuId.SelfHostingStorage,
|
|
type: 'reference',
|
|
path: '/reference/self-hosting-storage',
|
|
commonSectionsFile: 'common-self-hosting-storage-sections.json',
|
|
},
|
|
{
|
|
id: MenuId.SelfHostingRealtime,
|
|
type: 'reference',
|
|
path: '/reference/self-hosting-realtime',
|
|
commonSectionsFile: 'common-self-hosting-realtime-sections.json',
|
|
},
|
|
{
|
|
id: MenuId.SelfHostingAnalytics,
|
|
type: 'reference',
|
|
path: '/reference/self-hosting-analytics',
|
|
commonSectionsFile: 'common-self-hosting-analytics-sections.json',
|
|
},
|
|
{
|
|
id: MenuId.SelfHostingFunctions,
|
|
type: 'reference',
|
|
path: '/reference/self-hosting-functions',
|
|
commonSectionsFile: 'common-self-hosting-functions-sections.json',
|
|
},
|
|
]
|
|
|
|
function getMenuById(id: MenuId) {
|
|
return menus.find((menu) => menu.id === id)
|
|
}
|
|
|
|
function getMenuElement(menu: Menu | undefined, props?: any) {
|
|
if (!menu) return null
|
|
|
|
const menuType = menu?.type
|
|
switch (menuType) {
|
|
case 'guide':
|
|
return <NavigationMenuGuideList id={menu.id} {...props} />
|
|
case 'reference':
|
|
return (
|
|
<NavigationMenuRefList
|
|
id={menu.id}
|
|
basePath={menu.path}
|
|
commonSectionsFile={menu.commonSectionsFile || ''}
|
|
/>
|
|
)
|
|
default:
|
|
return null
|
|
}
|
|
}
|
|
|
|
const NavigationMenu = ({
|
|
menuId,
|
|
additionalNavItems,
|
|
}: {
|
|
menuId: MenuId
|
|
additionalNavItems?: Record<string, Partial<NavMenuSection>[]>
|
|
}) => {
|
|
const level = menuId
|
|
const menu = getMenuById(level)
|
|
|
|
return getMenuElement(menu, { additionalNavItems })
|
|
}
|
|
|
|
export { getMenuById, MenuId }
|
|
export default memo(NavigationMenu)
|