mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 18:05:11 +03:00
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Introduced a new library called Superbase/Server. To help developers using third party API frameworks, we want to make it easier than ever to install and use as needed. - One click copy - Custom prompt to get started - Validated API key permissions to ensure we don't leak secrets to other users in your org/project <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## New Features - Added a **Server** connection mode end-to-end, including mode-specific prompting and steps for installing **`@supabase/server`** and setting required variables. - Added a server **.env** panel with per-variable copy, **“Copy all variables”**, and permission-aware secret reveal/copy. ## Improvements - Updated connection UI layouts (mode selector grid and conditional config section). - Improved prompt copying to use mode-specific prompt text when available. ## Tests - Added UI tests for server env rendering, secret reveal/copy, **copy-all** behavior, and permission-restricted scenarios. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
28 lines
1006 B
TypeScript
28 lines
1006 B
TypeScript
import { useMemo } from 'react'
|
|
|
|
import type { ConnectMode } from './Connect.types'
|
|
import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
|
|
|
|
export function useAvailableConnectModes(): ConnectMode[] {
|
|
const {
|
|
projectConnectionShowAppFrameworks: showAppFrameworks,
|
|
projectConnectionShowMobileFrameworks: showMobileFrameworks,
|
|
projectConnectionShowOrms: showOrms,
|
|
} = useIsFeatureEnabled([
|
|
'project_connection:show_app_frameworks',
|
|
'project_connection:show_mobile_frameworks',
|
|
'project_connection:show_orms',
|
|
])
|
|
|
|
return useMemo(() => {
|
|
const allModes: { id: ConnectMode; enabled: boolean }[] = [
|
|
{ id: 'framework', enabled: showAppFrameworks || showMobileFrameworks },
|
|
{ id: 'server', enabled: true },
|
|
{ id: 'direct', enabled: true },
|
|
{ id: 'orm', enabled: showOrms },
|
|
{ id: 'mcp', enabled: true },
|
|
]
|
|
return allModes.filter((m) => m.enabled).map((m) => m.id)
|
|
}, [showAppFrameworks, showMobileFrameworks, showOrms])
|
|
}
|