Commit 46eb0ab
authored
feat(storage): add purgeBucketCache to invalidate CDN cache for a whole 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-13321 parent 3ad736b commit 46eb0ab
3 files changed
Lines changed: 62 additions & 0 deletions
File tree
- packages/storage_client
- lib/src
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
137 | 166 | | |
138 | 167 | | |
139 | 168 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
157 | 186 | | |
158 | 187 | | |
159 | 188 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
442 | 442 | | |
443 | 443 | | |
444 | 444 | | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
445 | 449 | | |
446 | 450 | | |
447 | 451 | | |
| |||
0 commit comments