Skip to content

parity(storage): expose purgeCache for buckets and single objects [from supabase-js] #271

Description

@grdsdev

Warning

Auto-generated parity issue — may be a false positive.

This issue was created automatically by /sync-sdk-parity from a heuristic
analysis of recent supabase-js commits. The tooling has limited insight
into language-specific idioms and may have:

  • misidentified a JS-only change as cross-language relevant,
  • missed an existing implementation in this SDK under a different name,
  • or proposed an API shape that doesn't fit this language's conventions.

It is the SDK author's responsibility to validate the need before
implementing.
If this change does not apply to this SDK, please close the
issue with a short note explaining why.


SDK Parity: C# implementation needed

A change was made in supabase-js that may need to be implemented in this repository for SDK parity. Please confirm applicability before starting work.

Reference Implementation (supabase-js)

What Changed

Two new CDN cache invalidation methods:

  1. purgeCache(path, options?)DELETE /cdn/{bucket}/{path}
  2. purgeBucketCache(id, options?)DELETE /cdn/{bucket}

Both accept transformations: true to purge only resized/formatted variants. Requires service_role JWT.

Code Reference

await supabase.storage.from('avatars').purgeCache('folder/avatar.png')
await supabase.storage.from('avatars').purgeCache('folder/avatar.png', { transformations: true })
await supabase.storage.purgeBucketCache('avatars')
await supabase.storage.purgeBucketCache('avatars', { transformations: true })

Implementation Guidance

Expected API Surface (C#)

// Single object
await supabase.Storage.From("avatars").PurgeCacheAsync("folder/avatar.png");
await supabase.Storage.From("avatars").PurgeCacheAsync("folder/avatar.png", transformations: true);

// Entire bucket
await supabase.Storage.PurgeBucketCacheAsync("avatars");
await supabase.Storage.PurgeBucketCacheAsync("avatars", transformations: true);

Key Behaviors to Match

  • Object purge: DELETE /cdn/{bucket}/{path}
  • Bucket purge: DELETE /cdn/{bucket}
  • ?transformations=true query param when set
  • Response: { "message": "success" } on success
  • Requires service_role key

Acceptance Criteria

  • PurgeCacheAsync(path, transformations = false) on file client
  • PurgeBucketCacheAsync(bucketId, transformations = false) on bucket client
  • Correct HTTP DELETE + endpoint
  • transformations=true query param when set
  • Unit tests

Context

  • supabase-js version: v2.110.0
  • Parity tracking: Auto-generated by SDK parity analysis
  • Related Linear issues: SDK-1176 (dart), SDK-1177 (py), SDK-1178 (swift)

Generated with Claude Code /sync-sdk-parity

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions