Files
supabase/apps/studio/data/storage/keys.ts
T
Claude 2b5a4f4a3e require typed confirmation to disable versioning; show retained-data usage
- Disabling object versioning on a bucket that already has it enabled now
  requires typing the bucket name in a destructive TextConfirmModal,
  warning that every noncurrent version and soft-deleted file will be
  permanently deleted once saved. New buckets (never had versioning) skip
  this since there's nothing to lose. An inline Admonition also reflects
  the staged, not-yet-saved change in the form.
- Resume a (snapshot-free, adapted for this branch's object-level-only
  scope) version of the org Usage page's Storage Size breakdown: a
  Live objects vs Object versions split, a "retained recovery data"
  warning, and a per-bucket breakdown of retained bytes. Backed by a new
  mock retention-usage query (data/storage/protection/storage-retention-usage-query.ts),
  rendered via the Storage Size category's additionalInfo slot in
  /org/[slug]/usage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TiUEvmC84bRsteqsWXHY2p
2026-08-06 10:14:11 +00:00

87 lines
3.0 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,
objectVersions: (
projectRef: string | undefined,
bucketId: string | undefined,
objectName: string | undefined
) => ['projects', projectRef, 'buckets', bucketId, 'object-versions', objectName] 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,
}