Files
supabase/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.ts
T
Alaister YoungandJoshen Lim 29e107af4a [FE-1712] chore: use /available-regions endpoint for project creation (#37371)
* chore: use /available-regions endpoint for project creation

* fix types

* make postgres version selection work

* Small nit refactors

* Feature flag changes + fix icons for flags in various places

* Fix creating projects when selecting a smart region

* Fix sending region selection to create project endpoint

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-08-19 16:36:59 +08:00

25 lines
718 B
TypeScript

import type { CloudProvider, Region } from 'shared-data'
import { AWS_REGIONS, FLY_REGIONS } from 'shared-data'
const smartRegionToExactRegionMap = new Map([
['Americas', 'East US (North Virginia)'],
['Europe', 'Central EU (Frankfurt)'],
['APAC', 'Southeast Asia (Singapore)'],
])
export function smartRegionToExactRegion(smartOrExactRegion: string) {
return smartRegionToExactRegionMap.get(smartOrExactRegion) ?? smartOrExactRegion
}
export function getAvailableRegions(cloudProvider: CloudProvider): Region {
switch (cloudProvider) {
case 'AWS':
case 'AWS_K8S':
return AWS_REGIONS
case 'FLY':
return FLY_REGIONS
default:
throw new Error('Invalid cloud provider')
}
}