The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat(storage): add object versioning feature flag and feature preview (#49202)
Francesco Sansalvadoreb0601f9ab723
diff --git a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsxindex 739b178761e..66de34d7abb 100644--- a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx+++ b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx@@ -171,6 +171,12 @@ export const useIsExplorerEnabled = () => {return isExplorerEnabled && flags[LOCAL_STORAGE_KEYS.UI_PREVIEW_EXPLORER]}+export const useIsStorageVersioningEnabled = () => {+ const { flags } = useFeaturePreviewContext()+ const isStorageVersioningEnabled = useFlag('storageVersioningPrivateAlpha')+ return isStorageVersioningEnabled && flags[LOCAL_STORAGE_KEYS.UI_PREVIEW_STORAGE_VERSIONING]+}+export const useFeaturePreviewModal = () => {const featurePreviews = useFeaturePreviews()const [featurePreviewModal, setFeaturePreviewModal] = useQueryState('featurePreviewModal')diff --git a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewModal.tsx b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewModal.tsxindex 794d865cd2f..bd8f5ae2a19 100644--- a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewModal.tsx+++ b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewModal.tsx@@ -39,6 +39,7 @@ import { JitDbAccessPreview } from './JitDbAccessPreview'import { PgDeltaDiffPreview } from './PgDeltaDiffPreview'import { PlatformWebhooksPreview } from './PlatformWebhooksPreview'import { SqlEditorManualSavePreview } from './SqlEditorManualSavePreview'+import { StorageVersioningPreview } from './StorageVersioningPreview'import { UnifiedLogsPreview } from './UnifiedLogsPreview'import { FeaturePreview, useFeaturePreviews } from './useFeaturePreviews'import { useBannerStack } from '@/components/ui/BannerStack/BannerStackProvider'@@ -59,6 +60,7 @@ const FEATURE_PREVIEW_KEY_TO_CONTENT: {[LOCAL_STORAGE_KEYS.UI_PREVIEW_MARKETPLACE]: <IntegrationsLayoutPreview />,[LOCAL_STORAGE_KEYS.UI_PREVIEW_DATABASE_CONNECTIONS]: <DatabaseConnectionsPreview />,[LOCAL_STORAGE_KEYS.UI_PREVIEW_EXPLORER]: <ExplorerPreview />,+ [LOCAL_STORAGE_KEYS.UI_PREVIEW_STORAGE_VERSIONING]: <StorageVersioningPreview />,}export const FeaturePreviewModal = () => {diff --git a/apps/studio/components/interfaces/App/FeaturePreview/StorageVersioningPreview.tsx b/apps/studio/components/interfaces/App/FeaturePreview/StorageVersioningPreview.tsxnew file mode 100644index 00000000000..dd526321c90--- /dev/null+++ b/apps/studio/components/interfaces/App/FeaturePreview/StorageVersioningPreview.tsx@@ -0,0 +1,23 @@+export const StorageVersioningPreview = () => {+ return (+ <div className="space-y-4">+ <p className="text-sm text-foreground-light">+ Keep previous copies of a file when it's overwritten or deleted, and set a lifecycle policy+ that expires them automatically.+ </p>+ <div className="space-y-2">+ <p className="text-sm">Enabling this preview will:</p>+ <ul className="list-disc pl-6 text-sm text-foreground-light space-y-1">+ <li>Add object versioning and lifecycle policy settings to the bucket settings</li>+ <li>Show a version history for each file in the file preview panel</li>+ <li>Allow soft-deleting and restoring files</li>+ <li>Break down retained version storage on the organization usage page</li>+ </ul>+ </div>+ <p className="text-sm text-foreground-light">+ Versioning is in <em>Private Alpha</em> and is off for every bucket by default until you+ turn it on.+ </p>+ </div>+ )+}diff --git a/apps/studio/components/interfaces/App/FeaturePreview/useFeaturePreviews.ts b/apps/studio/components/interfaces/App/FeaturePreview/useFeaturePreviews.tsindex 5b3483ac31b..5c8e9d8e8ac 100644--- a/apps/studio/components/interfaces/App/FeaturePreview/useFeaturePreviews.ts+++ b/apps/studio/components/interfaces/App/FeaturePreview/useFeaturePreviews.ts@@ -36,6 +36,7 @@ export const useFeaturePreviews = (): FeaturePreview[] => {const isMarketplaceEnabled = useFlag('marketplaceIntegrations')const isDatabaseConnectionsEnabled = useFlag('topForPostgres')const isExplorerEnabled = useFlag('explorer')+ const isStorageVersioningEnabled = useFlag('storageVersioningPrivateAlpha')const isSqlEditorManualSaveForced = useFlag('sqlEditorManualSaveForced')@@ -150,6 +151,16 @@ export const useFeaturePreviews = (): FeaturePreview[] => {getRoute: (ref?: string) => `/project/${ref}/observability/connections`,bannerId: 'database-connections-banner',},+ {+ key: LOCAL_STORAGE_KEYS.UI_PREVIEW_STORAGE_VERSIONING,+ name: 'Storage versioning',+ discussionsUrl: undefined,+ isNew: true,+ isPlatformOnly: true,+ isDefaultOptIn: true,+ enabled: isStorageVersioningEnabled,+ getRoute: (ref?: string) => `/project/${ref}/storage/files`,+ },]return previews.sort((a, b) => Number(b.isNew) - Number(a.isNew))@@ -160,5 +171,6 @@ export const useFeaturePreviews = (): FeaturePreview[] => {isMarketplaceEnabled,isDatabaseConnectionsEnabled,isExplorerEnabled,+ isStorageVersioningEnabled,])}diff --git a/packages/common/constants/local-storage.ts b/packages/common/constants/local-storage.tsindex f5041ea185c..abb6311eb66 100644--- a/packages/common/constants/local-storage.ts+++ b/packages/common/constants/local-storage.ts@@ -29,6 +29,7 @@ export const LOCAL_STORAGE_KEYS = {UI_PREVIEW_MARKETPLACE: 'supabase-ui-marketplace',UI_PREVIEW_DATABASE_CONNECTIONS: 'preview-database-connections',UI_PREVIEW_EXPLORER: 'preview-explorer',+ UI_PREVIEW_STORAGE_VERSIONING: 'supabase-ui-storage-versioning',AI_ASSISTANT_MCP_OPT_IN: 'ai-assistant-mcp-opt-in',@@ -172,6 +173,7 @@ const LOCAL_STORAGE_KEYS_ALLOWLIST = [LOCAL_STORAGE_KEYS.UI_PREVIEW_SQL_EDITOR_MANUAL_SAVE,LOCAL_STORAGE_KEYS.SQL_EDITOR_MANUAL_SAVE_NOTICE_DISMISSED,LOCAL_STORAGE_KEYS.UI_PREVIEW_MARKETPLACE,+ LOCAL_STORAGE_KEYS.UI_PREVIEW_STORAGE_VERSIONING,LOCAL_STORAGE_KEYS.LAST_SIGN_IN_METHOD,LOCAL_STORAGE_KEYS.HIDE_PROMO_TOAST,LOCAL_STORAGE_KEYS.BLOG_VIEW,