Files
supabase/apps/studio/data/storage/keys.ts
T
Claude b1184b3a99 feat(studio): Storage Snapshots & Versioning demo (mock data)
Implements the five Claude Design mockups as real Studio components behind a
single prototype flag (STORAGE_PROTECTION_ENABLED), wired to an in-memory mock
data layer since no platform API exists yet:

- Data protection section in create/edit bucket modals (versioning + snapshots
  toggles + lifecycle policies)
- Snapshots: new bucket-scoped nav page with Pre-backup/Manual triggers, take
  snapshot, and restore-with-diff
- Versions tab in the storage explorer preview pane (restore an older version)
- Storage size retention breakdown on the org usage page (live / versions /
  snapshots, retained-data callout, per-bucket table)
- Trash: new bucket-scoped nav page for soft-deletes with held-by-snapshot state

Adds mock query/mutation hooks under data/storage/protection, Snapshots + Trash
nav items, and new pages/routes (+ TANSTACK_MIGRATION entries).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TiUEvmC84bRsteqsWXHY2p
2026-07-25 00:37:12 +00:00

90 lines
3.2 KiB
TypeScript

export const storageKeys = {
bucket: (projectRef: string | undefined, bucketId: string | undefined) =>
['projects', projectRef, 'buckets', bucketId] as const,
buckets: (projectRef: string | undefined) => ['projects', projectRef, 'buckets'] as const,
bucketsList: (
projectRef: string | undefined,
params: {
limit?: number
search?: string
sortColumn?: string
sortOrder?: string
} = {}
) =>
[
'projects',
projectRef,
'buckets',
'list',
{
limit: params.limit,
search: params.search,
sortColumn: params.sortColumn,
sortOrder: params.sortOrder,
},
] as const,
analyticsBuckets: (projectRef: string | undefined) =>
['projects', projectRef, 'analytics-buckets'] as const,
vectorBuckets: (projectRef: string | undefined) =>
['projects', projectRef, 'vector-buckets'] as const,
vectorBucket: (projectRef: string | undefined, vectorbucketName: string | undefined) =>
['projects', projectRef, 'vector-bucket', vectorbucketName] as const,
vectorBucketsIndexes: (projectRef: string | undefined, vectorBucketName: string | undefined) =>
['projects', projectRef, 'vector-buckets', vectorBucketName, 'indexes'] as const,
archive: (projectRef: string | undefined) => ['projects', projectRef, 'archive'] as const,
publicBucketsWithSelectPolicies: (projectRef: string | undefined, bucketId: string | undefined) =>
['projects', projectRef, 'public-buckets-with-select-policies', bucketId] as const,
objects: (
projectRef: string | undefined,
bucketId: string | undefined,
path: string,
params: {
limit?: number
search?: string
sortColumn?: string
sortOrder?: string
} = {}
) =>
[
'projects',
projectRef,
'buckets',
bucketId,
'objects',
...(path ? [path] : []),
...(params ? [params] : []),
] as const,
// Snapshots & Versioning (prototype)
objectVersions: (
projectRef: string | undefined,
bucketId: string | undefined,
objectName: string | undefined
) => ['projects', projectRef, 'buckets', bucketId, 'object-versions', objectName] as const,
snapshots: (projectRef: string | undefined, bucketId: string | undefined) =>
['projects', projectRef, 'buckets', bucketId, 'snapshots'] as const,
trash: (projectRef: string | undefined, bucketId: string | undefined) =>
['projects', projectRef, 'buckets', bucketId, 'trash'] as const,
retentionUsage: (projectRef: string | undefined) =>
['projects', projectRef, 'storage-retention-usage'] as const,
icebergNamespaces: ({ projectRef, warehouse }: { projectRef?: string; warehouse?: string }) =>
[projectRef, 'warehouse', warehouse, 'namespaces'] as const,
icebergNamespace: ({
projectRef,
warehouse,
namespace,
}: {
projectRef?: string
warehouse: string
namespace: string
}) => [projectRef, 'warehouse', warehouse, 'namespaces', namespace] as const,
icebergNamespaceTables: ({
projectRef,
warehouse,
namespace,
}: {
projectRef?: string
warehouse?: string
namespace?: string
}) => [projectRef, 'warehouse', warehouse, 'namespaces', namespace, 'tables'] as const,
}