Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Joshenlim/fe 4674 expose auto region selection in dashboard (#52062)

Joshen Limd364c3a8e679
diff --git a/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.test.ts b/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.test.ts
index 1e545af9412..c6e8e5d850e 100644
--- a/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.test.ts
+++ b/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.test.ts
@@ -8,6 +8,7 @@ import {
} from './ProjectCreation.constants'
import type { AvailableRegions } from './ProjectCreation.utils'
import {
+ AUTO_REGION_VALUE,
extractPostgresVersionDetails,
filterHighAvailabilityRegions,
getAvailableRegions,
@@ -16,9 +17,20 @@ import {
getRegionSelectionType,
resolveDefaultDbRegion,
resolvePostgresVersion,
+ smartRegionToExactRegion,
} from './ProjectCreation.utils'
import type { PostgresEngine, ReleaseChannel } from '@/data/projects/new-project.constants'
+describe('smartRegionToExactRegion', () => {
+ it('maps the Auto option to the auto region code', () => {
+ expect(smartRegionToExactRegion(AUTO_REGION_VALUE)).toBe('auto')
+ })
+
+ it('passes through values that are not smart regions', () => {
+ expect(smartRegionToExactRegion('us-east-1')).toBe('us-east-1')
+ })
+})
+
describe('resolveDefaultDbRegion', () => {
const base = {
cloudProvider: 'AWS_NIMBUS',
@@ -54,6 +66,42 @@ describe('resolveDefaultDbRegion', () => {
).toBe('Americas')
})
+ it('falls back to the first available smart region when there is no recommendation', () => {
+ expect(
+ resolveDefaultDbRegion({
+ ...base,
+ cloudProvider: 'AWS',
+ isSmartRegionEnabled: true,
+ recommendedSmartRegion: undefined,
+ firstAvailableSmartRegion: 'Americas',
+ })
+ ).toBe('Americas')
+ })
+
+ it('prefers the Auto option over the recommended smart region when it is available', () => {
+ expect(
+ resolveDefaultDbRegion({
+ ...base,
+ cloudProvider: 'AWS',
+ isSmartRegionEnabled: true,
+ isAutoRegionAvailable: true,
+ recommendedSmartRegion: 'Americas',
+ })
+ ).toBe(AUTO_REGION_VALUE)
+ })
+
+ it('still prefers the high availability region over Auto when restricted', () => {
+ expect(
+ resolveDefaultDbRegion({
+ ...base,
+ isHighAvailabilityRestricted: true,
+ highAvailabilityRegionName: AWS_REGIONS.EAST_US.displayName,
+ isSmartRegionEnabled: true,
+ isAutoRegionAvailable: true,
+ })
+ ).toBe(AWS_REGIONS.EAST_US.displayName)
+ })
+
it('uses the geolocated region when the provider offers it', () => {
expect(
resolveDefaultDbRegion({
@@ -191,6 +239,24 @@ describe('getRegionSelectionType', () => {
expect(getRegionSelectionType({ dbRegion: 'Nonexistent', availableRegions })).toBeUndefined()
})
+ it('classifies the Auto option as auto when it is available', () => {
+ expect(
+ getRegionSelectionType({
+ dbRegion: AUTO_REGION_VALUE,
+ availableRegions: {
+ ...availableRegions,
+ auto: { code: 'auto', name: 'Auto', type: 'auto' },
+ },
+ })
+ ).toBe('auto')
+ })
+
+ it('returns undefined for the Auto option when it is not available', () => {
+ expect(
+ getRegionSelectionType({ dbRegion: AUTO_REGION_VALUE, availableRegions })
+ ).toBeUndefined()
+ })
+
it('returns undefined when dbRegion is undefined', () => {
expect(getRegionSelectionType({ dbRegion: undefined, availableRegions })).toBeUndefined()
})
diff --git a/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.ts b/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.ts
index dbb556aacbf..0d984745a22 100644
--- a/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.ts
+++ b/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.ts
@@ -10,7 +10,11 @@ import {
ReleaseChannel,
} from '@/data/projects/new-project.constants'
+/** Form value of the "Auto" option in the region selector, which maps to `{ code: 'auto', type: 'auto' }` */
+export const AUTO_REGION_VALUE = 'best_available'
+
export function smartRegionToExactRegion(smartOrExactRegion: string) {
+ if (smartOrExactRegion === AUTO_REGION_VALUE) return 'auto'
return SMART_REGION_TO_EXACT_REGION_MAP.get(smartOrExactRegion) ?? smartOrExactRegion
}
@@ -44,7 +48,11 @@ type ResolveDefaultDbRegionArgs = {
isHighAvailabilityRestricted: boolean
highAvailabilityRegionName: string | undefined
isSmartRegionEnabled: boolean
+ /** Whether the Auto option is offered, in which case it is preferred over the recommended region */
+ isAutoRegionAvailable?: boolean
recommendedSmartRegion: string | undefined
+ /** Used when there's no recommended smart region */
+ firstAvailableSmartRegion?: string
autoDefaultRegion: string | undefined
fixedDefaultRegion: string
environment?: string
@@ -55,13 +63,16 @@ export function resolveDefaultDbRegion({
isHighAvailabilityRestricted,
highAvailabilityRegionName,
isSmartRegionEnabled,
+ isAutoRegionAvailable = false,
recommendedSmartRegion,
+ firstAvailableSmartRegion,
autoDefaultRegion,
fixedDefaultRegion,
environment = process.env.NEXT_PUBLIC_ENVIRONMENT,
}: ResolveDefaultDbRegionArgs): string | undefined {
if (isHighAvailabilityRestricted) return highAvailabilityRegionName
- if (isSmartRegionEnabled) return recommendedSmartRegion
+ if (isSmartRegionEnabled && isAutoRegionAvailable) return AUTO_REGION_VALUE
+ if (isSmartRegionEnabled) return recommendedSmartRegion ?? firstAvailableSmartRegion
// The geolocated default is only usable if the provider actually offers that region
// (e.g. AWS_NIMBUS is restricted to a single region)
@@ -148,8 +159,8 @@ type GetRegionSelectionTypeArgs = {
/**
* How the submitted region was arrived at: the auto-assigned default left untouched ('auto'),
* a smart group region picked by the user (e.g. Americas, 'general'), or an exact region picked
- * by the user (e.g. us-east-1, 'specific'). Returns undefined if dbRegion matches neither list,
- * regardless of whether the field was touched.
+ * by the user (e.g. us-east-1, 'specific'). Explicitly picking the Auto option is also 'auto'.
+ * Returns undefined if dbRegion matches neither list, regardless of whether the field was touched.
*/
export function getRegionSelectionType({
dbRegion,
@@ -157,6 +168,8 @@ export function getRegionSelectionType({
isDbRegionDirty = true,
}: GetRegionSelectionTypeArgs): 'general' | 'auto' | 'specific' | undefined {
if (!dbRegion || !availableRegions) return undefined
+ if (dbRegion === AUTO_REGION_VALUE)
+ return availableRegions.auto !== undefined ? 'auto' : undefined
const isGeneral = availableRegions.smartGroup.some((region) => region.name === dbRegion)
const isSpecific = availableRegions.specific.some((region) => region.name === dbRegion)
if (!isGeneral && !isSpecific) return undefined
diff --git a/apps/studio/components/interfaces/ProjectCreation/ProjectCreationForm.tsx b/apps/studio/components/interfaces/ProjectCreation/ProjectCreationForm.tsx
index 4d04f00b608..1f0dd68f79a 100644
--- a/apps/studio/components/interfaces/ProjectCreation/ProjectCreationForm.tsx
+++ b/apps/studio/components/interfaces/ProjectCreation/ProjectCreationForm.tsx
@@ -28,6 +28,7 @@ import {
} from './ProjectCreation.constants'
import { FormSchema } from './ProjectCreation.schema'
import {
+ AUTO_REGION_VALUE,
getAvailableRegions,
getFreeTierGeneralRegionExperimentVariant,
getHighAvailabilityRegionCode,
@@ -316,9 +317,15 @@ export const ProjectCreationForm = ({
)
: undefined
const recommendedSmartRegion = smartRegionEnabled
- ? availableRegionsData?.recommendations.smartGroup.name
+ ? availableRegionsData?.recommendations.smartGroup?.name
: ''
+ const firstAvailableSmartRegion = highAvailability
+ ? undefined
+ : availableRegionsData?.all.smartGroup[0]?.name
+ const isAutoRegionAvailable =
+ smartRegionEnabled && !highAvailability && availableRegionsData?.all.auto !== undefined
+
const fixedDefaultRegion = PROVIDERS[selectedCloudProvider].default_region.displayName
const regionError = smartRegionEnabled ? availableRegionsError : defaultRegionError
const defaultRegion = resolveDefaultDbRegion({
@@ -327,7 +334,9 @@ export const ProjectCreationForm = ({
highAvailability === true && highAvailabilityRegionCode !== undefined,
highAvailabilityRegionName: highAvailabilityRegion?.name,
isSmartRegionEnabled: smartRegionEnabled,
+ isAutoRegionAvailable,
recommendedSmartRegion,
+ firstAvailableSmartRegion,
autoDefaultRegion,
fixedDefaultRegion,
})
@@ -511,10 +520,11 @@ export const ProjectCreationForm = ({
availableOrioleVersion,
})
- const { smartGroup = [], specific = [] } = availableRegionsData?.all ?? {}
- const selectedRegion = smartRegionEnabled
- ? (smartGroup.find((x) => x.name === dbRegion) ?? specific.find((x) => x.name === dbRegion))
- : undefined
+ const { auto, smartGroup = [], specific = [] } = availableRegionsData?.all ?? {}
+ const selectedExplicitRegion =
+ smartGroup.find((x) => x.name === dbRegion) ?? specific.find((x) => x.name === dbRegion)
+ const selectedSmartRegion = dbRegion === AUTO_REGION_VALUE ? auto : selectedExplicitRegion
+ const selectedRegion = smartRegionEnabled ? selectedSmartRegion : undefined
if (highAvailability && highAvailabilityRegionCode !== undefined && !selectedRegion) {
return toast.error(
diff --git a/apps/studio/components/interfaces/ProjectCreation/RegionSelector.tsx b/apps/studio/components/interfaces/ProjectCreation/RegionSelector.tsx
index 42df1981f74..0d728591107 100644
--- a/apps/studio/components/interfaces/ProjectCreation/RegionSelector.tsx
+++ b/apps/studio/components/interfaces/ProjectCreation/RegionSelector.tsx
@@ -1,5 +1,5 @@
import { useFeatureFlags, useParams } from 'common'
-import { Loader2Icon } from 'lucide-react'
+import { EarthIcon, Loader2Icon } from 'lucide-react'
import { useEffect, useRef, useState } from 'react'
import { UseFormReturn } from 'react-hook-form'
import type { CloudProvider } from 'shared-data'
@@ -26,6 +26,7 @@ import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
import { CreateProjectForm } from './ProjectCreation.schema'
import {
+ AUTO_REGION_VALUE,
filterHighAvailabilityRegions,
getAvailableRegions,
getHighAvailabilityRegionCode,
@@ -69,6 +70,12 @@ const getDisplayNameForSmartRegion = (name: string): string => {
const isLocal = process.env.NEXT_PUBLIC_ENVIRONMENT === 'local'
+const BestAvailableRegionIcon = () => (
+ <div className="w-5 h-4 border border-brand-500 rounded-xs bg-brand-300 flex items-center justify-center">
+ <EarthIcon size={10} className="text-brand" />
+ </div>
+)
+
export const RegionSelector = ({
form,
hasSelectedOrganization,
@@ -116,12 +123,21 @@ export const RegionSelector = ({
highAvailability && !isLocal && highAvailabilityRegionCode !== undefined
const smartRegions = highAvailability ? [] : allSmartRegions
+ const hasAutoOption = !highAvailability && availableRegionsData?.all.auto !== undefined
+ const isAutoRecommended =
+ hasAutoOption && availableRegionsData?.recommendations.auto !== undefined
+
+ // Auto takes precedence, so the other recommendations are ignored while it's recommended
const recommendedSmartRegions = new Set(
- [availableRegionsData?.recommendations.smartGroup.code].filter(Boolean)
+ isAutoRecommended
+ ? []
+ : [availableRegionsData?.recommendations.smartGroup?.code].filter(Boolean)
)
const recommendedSpecificRegions = new Set(
- availableRegionsData?.recommendations.specific.map((region) => region.code)
+ isAutoRecommended
+ ? []
+ : availableRegionsData?.recommendations.specific?.map((region) => region.code)
)
const availableRegions = getAvailableRegions(cloudProvider)
@@ -151,32 +167,6 @@ export const RegionSelector = ({
const allSelectableRegions = [...smartRegions, ...regionOptions]
- // react-hook-form intermittently drops this field's value when its Controller
- // remounts (e.g. a sibling section mounting/unmounting in the same update, such as
- // toggling high availability), so a one-shot effect isn't enough. Instead this effect
- // re-asserts off the watched value: a region present in the current list is kept (and
- // remembered in lastValidRegionRef), and when it's missing or cleared out from under us
- // it restores the last valid region. allSelectableRegions is intentionally omitted from
- // deps — it's a new array every render, and comparing it by reference would defeat the
- // point of reacting to genuine content changes on every render where they occur.
- const lastValidRegionRef = useRef<string | undefined>(undefined)
- useEffect(() => {
- if (allSelectableRegions.length === 0) return
- const isRegionAvailable = (name: string | undefined) =>
- !!name && allSelectableRegions.some((region) => region.name === name)
-
- if (isRegionAvailable(dbRegion)) {
- lastValidRegionRef.current = dbRegion
- return
- }
-
- const lastValidRegion = lastValidRegionRef.current
- if (lastValidRegion !== undefined && isRegionAvailable(lastValidRegion)) {
- form.setValue('dbRegion', lastValidRegion)
- }
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [dbRegion, form])
-
const hasGeneralRegions = smartRegionEnabled && !highAvailability
const isSpecificRegionSelected = regionOptions.some((region) => region.name === dbRegion)
const [isOpen, setIsOpen] = useState(false)
@@ -194,6 +184,26 @@ export const RegionSelector = ({
setIsOpen(true)
}
+ const lastValidRegionRef = useRef<string | undefined>(undefined)
+ useEffect(() => {
+ if (allSelectableRegions.length === 0) return
+ const isRegionAvailable = (name: string | undefined) =>
+ !!name &&
+ ((hasAutoOption && name === AUTO_REGION_VALUE) ||
+ allSelectableRegions.some((region) => region.name === name))
+
+ if (isRegionAvailable(dbRegion)) {
+ lastValidRegionRef.current = dbRegion
+ return
+ }
+
+ const lastValidRegion = lastValidRegionRef.current
+ if (lastValidRegion !== undefined && isRegionAvailable(lastValidRegion)) {
+ form.setValue('dbRegion', lastValidRegion)
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [dbRegion, form])
+
if (isErrorAvailableRegions) {
return <AlertError subject="Error loading available regions" error={errorAvailableRegions} />
}
@@ -208,9 +218,11 @@ export const RegionSelector = ({
return !!region.name && region.name === dbRegion
})
- const selectedRegionLabel = selectedRegion?.name
+ const isAutoSelected = hasAutoOption && dbRegion === AUTO_REGION_VALUE
+ const selectedRegionName = selectedRegion?.name
? getDisplayNameForSmartRegion(selectedRegion.name)
: dbRegion
+ const selectedRegionLabel = isAutoSelected ? 'Auto' : selectedRegionName
const selectedRestriction = regionOptionsWithRestriction.find(
(region) => region.name === dbRegion
)?.restriction
@@ -276,6 +288,7 @@ export const RegionSelector = ({
{!!dbRegion && (
<div className="flex items-center gap-x-3">
{isLoading && <Loader2Icon size={14} className="animate-spin" />}
+ {isAutoSelected && <BestAvailableRegionIcon />}
{selectedRegion?.code && (
<RegionFlag className="w-5" region={selectedRegion.code} />
)}
@@ -285,6 +298,30 @@ export const RegionSelector = ({
</SelectValue>
</SelectTrigger>
<SelectContent>
+ {hasAutoOption && (
+ <>
+ <SelectGroup>
+ <SelectLabel>Recommendation</SelectLabel>
+ <SelectItem
+ value={AUTO_REGION_VALUE}
+ className="w-full [&>:nth-child(2)]:w-full"
+ >
+ <div className="flex flex-row items-center justify-between w-full">
+ <div className="flex items-center gap-x-3">
+ <BestAvailableRegionIcon />
+ <span className="text-foreground">Auto</span>
+ </div>
+ {isAutoRecommended && (
+ <Badge variant="success" className="mr-1">
+ Recommended
+ </Badge>
+ )}
+ </div>
+ </SelectItem>
+ </SelectGroup>
+ <SelectSeparator />
+ </>
+ )}
{hasGeneralRegions && (
<>
<SelectGroup>
@@ -374,25 +411,28 @@ export const RegionSelector = ({
)}
{hideSpecificRegions && (
- <div
- className="border-t px-3 py-2.5 text-xs text-foreground-light"
- onPointerDown={(e) => e.stopPropagation()}
- >
- <InlineLink
- href={`/org/${slug ?? '_'}/billing?panel=subscriptionPlan&source=freeTierGeneralRegionSelector`}
- onClick={() => track('free_tier_general_region_upgrade_clicked')}
- >
- Upgrade to Pro
- </InlineLink>{' '}
- to choose a{' '}
- <InlineLink
- href={`${DOCS_URL}/guides/platform/regions`}
- onClick={() => track('free_tier_general_region_docs_link_clicked')}
+ <>
+ <SelectSeparator />
+ <div
+ className="px-3 py-2.5 text-xs text-foreground-light"
+ onPointerDown={(e) => e.stopPropagation()}
>
- specific region
- </InlineLink>
- .
- </div>
+ <InlineLink
+ href={`/org/${slug ?? '_'}/billing?panel=subscriptionPlan&source=freeTierGeneralRegionSelector`}
+ onClick={() => track('free_tier_general_region_upgrade_clicked')}
+ >
+ Upgrade to Pro
+ </InlineLink>{' '}
+ to choose a{' '}
+ <InlineLink
+ href={`${DOCS_URL}/guides/platform/regions`}
+ onClick={() => track('free_tier_general_region_docs_link_clicked')}
+ >
+ specific region
+ </InlineLink>
+ .
+ </div>
+ </>
)}
</SelectContent>
</Select>
diff --git a/apps/studio/tests/pages/new/[slug].test.tsx b/apps/studio/tests/pages/new/[slug].test.tsx
index 419487919f0..b70d0c03c83 100644
--- a/apps/studio/tests/pages/new/[slug].test.tsx
+++ b/apps/studio/tests/pages/new/[slug].test.tsx
@@ -19,7 +19,7 @@ type OrganizationResponse = components['schemas']['OrganizationResponse_Output']
type PermissionsV2Response = components['schemas']['UserPermissionsResponse_Output']
type CreateProjectBody = components['schemas']['CreateProjectBody']
type CreateProjectResponse = components['schemas']['CreateProjectResponse_Output']
-type RegionsInfo = components['schemas']['RegionsInfo_Output']
+type RegionsInfo = components['schemas']['RegionsInfoPlatform_Output']
type MemberWithFreeProjectLimit = components['schemas']['MemberWithFreeProjectLimit_Output']
type OverdueInvoiceCount = components['schemas']['OverdueInvoiceCount_Output']
type OrganizationProjectsResponse = components['schemas']['OrganizationProjectsResponse_Output']
@@ -108,6 +108,18 @@ const DEFAULT_AVAILABLE_REGIONS: RegionsInfo = {
const FRANKFURT = 'Central EU (Frankfurt)'
const SAO_PAULO = 'South America (São Paulo)'
+const AVAILABLE_REGIONS_WITH_AUTO: RegionsInfo = {
+ ...DEFAULT_AVAILABLE_REGIONS,
+ all: {
+ ...DEFAULT_AVAILABLE_REGIONS.all,
+ auto: { code: 'auto', name: 'Auto', type: 'auto' },
+ },
+ recommendations: {
+ ...DEFAULT_AVAILABLE_REGIONS.recommendations,
+ auto: { code: 'auto', name: 'Auto', type: 'auto' },
+ },
+}
+
const availableRegionsWithSaoPaulo = (status?: 'capacity' | 'other'): RegionsInfo => ({
...DEFAULT_AVAILABLE_REGIONS,
all: {
@@ -551,6 +563,55 @@ describe('project creation wizard', () => {
expect(onRequest.mock.calls[0][0].region_selection).toMatchObject({ name: 'Americas' })
})
+ test('defaults to the Auto option when it is available', async () => {
+ mockWizardEndpoints({ availableRegions: AVAILABLE_REGIONS_WITH_AUTO })
+
+ await renderWizard()
+
+ await waitFor(() => expect(getSelectTriggerByLabel('Region')).toHaveTextContent('Auto'))
+ })
+
+ test('hides the smart and specific region badges while Auto is recommended', async () => {
+ mockWizardEndpoints({ availableRegions: AVAILABLE_REGIONS_WITH_AUTO })
+
+ await renderWizard()
+
+ await screen.findByPlaceholderText('Project name')
+ await user.click(getSelectTriggerByLabel('Region'))
+
+ const autoOption = await screen.findByRole('option', { name: /Auto/ })
+ expect(within(autoOption).getByText('Recommended')).toBeInTheDocument()
+ const americasOption = screen.getByRole('option', { name: /Americas/ })
+ expect(within(americasOption).queryByText('Recommended')).not.toBeInTheDocument()
+ })
+
+ test('defaults to the first general region when there is no recommendation', async () => {
+ mockWizardEndpoints({
+ availableRegions: { ...DEFAULT_AVAILABLE_REGIONS, recommendations: {} },
+ })
+
+ await renderWizard()
+
+ await waitFor(() => expect(getSelectTriggerByLabel('Region')).toHaveTextContent('Americas'))
+ })
+
+ test('keeps the Auto option selected and submits it as an auto region selection', async () => {
+ mockWizardEndpoints({ availableRegions: AVAILABLE_REGIONS_WITH_AUTO })
+ const onRequest = vi.fn()
+ mockCreateProject(onRequest)
+
+ await renderWizard()
+
+ await fillProjectName('Auto Region Project')
+ await generateAndWaitForStrongPassword()
+ await selectRegion(/Auto/)
+
+ await waitFor(() => expect(getSelectTriggerByLabel('Region')).toHaveTextContent('Auto'))
+
+ const regionSelection = await submitAndReadRegionSelection(onRequest)
+ expect(regionSelection).toMatchObject({ code: 'auto', type: 'auto' })
+ })
+
describe('specific regions behind a link', () => {
const FREE_PLAN_ORG = [mockOrg({ plan: { id: 'free', name: 'Free' } })]
diff --git a/packages/api-types/types/api-v1.d.ts b/packages/api-types/types/api-v1.d.ts
index 6ca5d56a6b2..766f8b83a49 100644
--- a/packages/api-types/types/api-v1.d.ts
+++ b/packages/api-types/types/api-v1.d.ts
@@ -4253,7 +4253,7 @@ export interface components {
/** @description Disables the Realtime service for this project when true. Set to false to re-enable it. */
suspend: boolean | null
}
- RegionsInfo_Output: {
+ RegionsInfoV1_Output: {
all: {
smartGroup: {
/** @enum {string} */
@@ -5860,12 +5860,44 @@ export interface components {
*/
schedule_for: string
}
+ /**
+ * Format: binary
+ * @description Raw Brotli-compressed ESZIP binary file.
+ *
+ * **Validation requirements** - The file must start with the four magic bytes `EZBR` (hex: `45 5A 42 52`).
+ * - The `ezbr_sha256` query parameter must contain the SHA-256 hash of the uploaded ESZIP payload.
+ *
+ * **Example**
+ * ```javascript
+ * import { readFile } from 'node:fs/promises';
+ * import { brotliCompress } from 'node:zlib';
+ * import { promisify } from 'node:util';
+ * import { createHash } from 'node:crypto';
+ *
+ * const compress = promisify(brotliCompress);
+ * const marker = Buffer.from('EZBR', 'ascii');
+ *
+ * const file = await readFile('./function.eszip');
+ * const compressed = await compress(file);
+ *
+ * const payload = Buffer.concat([marker, compressed]);
+ *
+ * const ezbr_sha256 = createHash('sha256')
+ * .update(payload)
+ * .digest('hex');
+ *
+ * console.log(ezbr_sha256);
+ * ```
+ *
+ *
+ */
+ V1UpdateFunctionBodyEszip: string
/** @example {
* "name": "Hello World",
* "body": "Deno.serve(() => new Response('Hello again!'))",
* "verify_jwt": true
* } */
- V1UpdateFunctionBody: {
+ V1UpdateFunctionBodyJson: {
body?: string
name?: string
verify_jwt?: boolean
@@ -12342,8 +12374,8 @@ export interface operations {
}
requestBody: {
content: {
- 'application/json': components['schemas']['V1UpdateFunctionBody']
- 'application/vnd.denoland.eszip': string
+ 'application/json': components['schemas']['V1UpdateFunctionBodyJson']
+ 'application/vnd.denoland.eszip': components['schemas']['V1UpdateFunctionBodyEszip']
}
}
responses: {
@@ -14425,7 +14457,7 @@ export interface operations {
[name: string]: unknown
}
content: {
- 'application/json': components['schemas']['RegionsInfo_Output']
+ 'application/json': components['schemas']['RegionsInfoV1_Output']
}
}
}
diff --git a/packages/api-types/types/platform.d.ts b/packages/api-types/types/platform.d.ts
index 635c696b898..e91339edc53 100644
--- a/packages/api-types/types/platform.d.ts
+++ b/packages/api-types/types/platform.d.ts
@@ -5055,6 +5055,26 @@ export interface paths {
patch?: never
trace?: never
}
+ '/platform/support/csat': {
+ parameters: {
+ query?: never
+ header?: never
+ path?: never
+ cookie?: never
+ }
+ get?: never
+ put?: never
+ /**
+ * Submit a support CSAT survey response
+ * @description Called by the Supabase dashboard when a customer answers the satisfaction survey linked from a resolved support ticket. Records the answer on the Front conversation as custom fields and a tag. One answer per conversation.
+ */
+ post: operations['CsatController_submit']
+ delete?: never
+ options?: never
+ head?: never
+ patch?: never
+ trace?: never
+ }
'/platform/support/verify-email': {
parameters: {
query?: never
@@ -7068,6 +7088,12 @@ export interface components {
/** @enum {string} */
type: 'smartGroup'
}
+ | {
+ /** @enum {string} */
+ code: 'auto'
+ /** @enum {string} */
+ type: 'auto'
+ }
/**
* @description Release channel. If not provided, GA will be used.
* @enum {string}
@@ -8004,6 +8030,15 @@ export interface components {
| 'requires_payment_method'
| 'succeeded'
}
+ CsatBody: {
+ comment?: string
+ conversation_id: string
+ satisfied: boolean
+ }
+ CsatResponse_Output: {
+ /** @enum {string} */
+ result: 'success'
+ }
CustomerResponse_Output: {
additional_emails: string[] | null
address?: {
@@ -10894,10 +10929,10 @@ export interface components {
*/
active: boolean
/**
- * @description Bytes between the current WAL location and the confirmed flush LSN.
+ * @description Flushed WAL on a primary, or replayed WAL on a standby, minus the slot's confirmed flush position. Includes feedback delay after ETL's local progress. Null when unavailable, including lost slots.
* @example 2048
*/
- confirmed_flush_lsn_bytes: number
+ confirmed_flush_lsn_bytes?: number | null
/**
* @description Flush lag expressed in milliseconds.
* @example 1200
@@ -10909,10 +10944,10 @@ export interface components {
*/
reply_time_lag?: number | null
/**
- * @description Bytes between the current WAL location and the slot restart LSN.
+ * @description WAL retained for the slot, measured from the primary WAL write position. Null on standbys, for lost slots, or without a restart position.
* @example 1024
*/
- restart_lsn_bytes: number
+ restart_lsn_bytes?: number | null
/**
* @description How many bytes of WAL are still safe to build up before the limit of the slot is reached. `null` means Postgres reports unlimited slot WAL retention.
* @example 8192
@@ -11014,10 +11049,10 @@ export interface components {
*/
active: boolean
/**
- * @description Bytes between the current WAL location and the confirmed flush LSN.
+ * @description Flushed WAL on a primary, or replayed WAL on a standby, minus the slot's confirmed flush position. Includes feedback delay after ETL's local progress. Null when unavailable, including lost slots.
* @example 2048
*/
- confirmed_flush_lsn_bytes: number
+ confirmed_flush_lsn_bytes?: number | null
/**
* @description Flush lag expressed in milliseconds.
* @example 1200
@@ -11029,10 +11064,10 @@ export interface components {
*/
reply_time_lag?: number | null
/**
- * @description Bytes between the current WAL location and the slot restart LSN.
+ * @description WAL retained for the slot, measured from the primary WAL write position. Null on standbys, for lost slots, or without a restart position.
* @example 1024
*/
- restart_lsn_bytes: number
+ restart_lsn_bytes?: number | null
/**
* @description How many bytes of WAL are still safe to build up before the limit of the slot is reached. `null` means Postgres reports unlimited slot WAL retention.
* @example 8192
@@ -12438,8 +12473,15 @@ export interface components {
/** @description Disables the Realtime service for this project when true. Set to false to re-enable it. */
suspend?: boolean | null
}
- RegionsInfo_Output: {
+ RegionsInfoPlatform_Output: {
all: {
+ auto?: {
+ /** @enum {string} */
+ code: 'auto'
+ name: string
+ /** @enum {string} */
+ type: 'auto'
+ }
smartGroup: {
/** @enum {string} */
code: 'americas' | 'emea' | 'apac'
@@ -12478,14 +12520,21 @@ export interface components {
}[]
}
recommendations: {
- smartGroup: {
+ auto?: {
+ /** @enum {string} */
+ code: 'auto'
+ name: string
+ /** @enum {string} */
+ type: 'auto'
+ }
+ smartGroup?: {
/** @enum {string} */
code: 'americas' | 'emea' | 'apac'
name: string
/** @enum {string} */
type: 'smartGroup'
}
- specific: {
+ specific?: {
/** @enum {string} */
code:
| 'us-east-1'
@@ -16262,6 +16311,11 @@ export interface components {
type: 'table'
}
)[]
+ /**
+ * @description Optional Warehouse compute region, independent of the source and catalog regions. Defaults to the existing assignment, or ap-southeast-1 in staging and eu-west-1 in production for a new assignment. DNS routing requires a registered cluster in that environment. Unsupported regions and changes to an existing assignment are rejected. Ignored when targets is empty.
+ * @example ap-southeast-1
+ */
+ warehouse_region?: string
}
WarehouseSetupResponse_Output: {
/**
@@ -16313,6 +16367,13 @@ export interface components {
WarehouseSetupStatusResponse_Output: {
/** @description Whether the current disable request deletes DuckLake data. */
delete_data?: boolean
+ /** @description Warehouse DNS delivery status. Ready means the DNS API accepted the route; client DNS caches may still be updating. */
+ dns?: {
+ hostname: string
+ region: string
+ /** @enum {string} */
+ status: 'pending' | 'ready' | 'error' | 'removed'
+ }
/** @description Warehouse cleanup failure, when present. */
error?: string
/** @description Project database FDW setup markers; null during or after teardown, when setup inspection is inapplicable. */
@@ -23282,7 +23343,7 @@ export interface operations {
limit?: number
/** @description Number of projects to skip */
offset?: number
- /** @description Search projects by name */
+ /** @description Search projects by name, or by exact project ref */
search?: string
/** @description Sort order for projects */
sort?: 'name_asc' | 'name_desc' | 'created_asc' | 'created_desc'
@@ -30145,7 +30206,7 @@ export interface operations {
[name: string]: unknown
}
content: {
- 'application/json': components['schemas']['RegionsInfo_Output']
+ 'application/json': components['schemas']['RegionsInfoPlatform_Output']
}
}
}
@@ -35141,6 +35202,30 @@ export interface operations {
}
}
}
+ CsatController_submit: {
+ parameters: {
+ query?: never
+ header?: never
+ path?: never
+ cookie?: never
+ }
+ requestBody: {
+ content: {
+ 'application/json': components['schemas']['CsatBody']
+ }
+ }
+ responses: {
+ /** @description Survey response recorded */
+ 200: {
+ headers: {
+ [name: string]: unknown
+ }
+ content: {
+ 'application/json': components['schemas']['CsatResponse_Output']
+ }
+ }
+ }
+ }
VerifyEmailController_verifyEmail: {
parameters: {
query?: never