feat(storage): add purgeCache to invalidate CDN cache for a single object#1607
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds Sequence Diagram(s)sequenceDiagram
participant Caller
participant StorageBucketApi
participant StorageFileApi
participant CDN
Caller->>StorageBucketApi: purgeBucketCache(id, transformations)
StorageBucketApi->>CDN: DELETE bucket CDN purge URL
CDN-->>StorageBucketApi: response message
StorageBucketApi-->>Caller: return message
Caller->>StorageFileApi: purgeCache(path, transformations)
StorageFileApi->>CDN: DELETE object CDN purge URL
CDN-->>StorageFileApi: response message
StorageFileApi-->>Caller: return message
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…le bucket (#1608) ## Summary Adds `StorageBucketApi.purgeBucketCache(id, {transformations})` to invalidate the CDN cache for every object in a bucket. Issues `DELETE /cdn/{bucket}` against the storage base URL and returns the server's success message. When `transformations` is `true`, only the resized/formatted variants are purged, leaving the original cached objects intact; otherwise the bucket cache is purged. Requires the service-role key and the tenant `purgeCache` feature enabled on the storage server. > Stacked on top of #1607 (`SDK-1331`, object-level purge). Base this PR against `main` once #1607 merges. **Outcome:** implemented **Reference:** supabase-js PR [#2429](supabase/supabase-js#2429) (`storage.file_buckets.purge_bucket_cache`) ## Compliance matrix - `storage.file_buckets.purge_bucket_cache` → `implemented` (symbol `StorageBucketApi.purgeBucketCache`) ## Tests Added unit tests in `packages/storage_client/test/basic_test.dart` covering the DELETE endpoint/URL and the `transformations` query parameter. SDK-1332
|
The following capabilities are marked
These may have been renamed, removed, or never registered. Please update the capability matrix. |
Summary
Adds
StorageFileApi.purgeCache(path, {transformations})to invalidate the CDN cache for a single object in a bucket. IssuesDELETE /cdn/{bucket}/{path}against the storage base URL and returns the server's success message. Whentransformationsistrue, only the resized/formatted variants are purged, leaving the original cached object intact; otherwise the object cache is purged.Requires the service-role key and the tenant
purgeCachefeature enabled on the storage server.Outcome: implemented
Reference: supabase-js PR #2429 (
storage.file_buckets.purge_cache)Compliance matrix
storage.file_buckets.purge_cache→implemented(symbolStorageFileApi.purgeCache)Tests
Added unit tests in
packages/storage_client/test/basic_test.dartcovering the DELETE endpoint/URL and thetransformationsquery parameter.SDK-1331