feat(storage): add cacheNonce parameter for cache invalidation#1578
Merged
Conversation
Adds an optional cacheNonce parameter to getPublicUrl, createSignedUrl, createSignedUrls and download, appending a cacheNonce query parameter to the generated URL to bypass CDN caching for a specific file version. Ref: SDK-875
This was referenced Jul 10, 2026
Vinzent03
approved these changes
Jul 10, 2026
grdsdev
approved these changes
Jul 10, 2026
spydon
added a commit
that referenced
this pull request
Jul 11, 2026
## Summary
Adds `StorageFileApi.listPaginated`, backed by the storage
`object/list-v2/{bucketId}` endpoint, supporting cursor-based pagination
and hierarchical (delimiter) listing.
New API, using descriptive Dart names rather than the supabase-js
`listV2`/`SearchV2*` naming:
- `listPaginated({PaginatedSearchOptions options})` returns
`PaginatedListResult`
- `PaginatedSearchOptions` (limit, prefix, cursor, withDelimiter,
sortBy)
- `PaginatedListResult` (hasNext, folders, objects, nextCursor)
- `PaginatedFile`, `PaginatedFolder`
- `FileSort` (column, order), where `column` and `order` are the enums
`FileSortColumn` and `FileSortOrder`
**Outcome:** implemented
**Reference:** supabase-js `StorageFileApi.listV2` (`object/list-v2`)
**Compliance matrix:** `storage.file_buckets.list_files_paginated` ->
implemented
## Notes
- Idiomatic Dart rather than a transliteration of the JS shape:
descriptive type names (`Paginated*`) instead of the `V2` suffix, and
enhanced enums `FileSortColumn` and `FileSortOrder` for the sort options
instead of raw strings, matching the existing
`BucketSortColumn`/`BucketSortOrder` pattern.
- `withDelimiter` is camelCase on the Dart side and mapped to the
`with_delimiter` wire key; `FileSortColumn` is serialized via
`snakeCase` (for example `createdAt` becomes `created_at`) and
`FileSortOrder` via its `asc`/`desc` value.
- Unit tests cover the paginated result parsing (options body, folders
and objects, cursor) and the empty-body default.
- All new public symbols are registered under the capability.
## Stacking
Second of three stacked PRs. Base: #1578 (cacheNonce). Review and merge
#1578 first.
spydon
added a commit
that referenced
this pull request
Jul 11, 2026
## Summary
Adds `StorageFileApi.downloadStream`, which returns the response body as
a lazy `Stream<Uint8List>` for memory-efficient handling of large files
instead of buffering the whole body into a `Uint8List` (as `download`
does). The request is sent when the stream is listened to, and a
non-success status surfaces as a `StorageException` on the stream before
any bytes are emitted, matching how `File.openRead` behaves.
- `downloadStream(path, {transform, queryParams, cacheNonce})` returns
`Stream<Uint8List>`
- Internal `Fetch.getStream` streaming GET, an `async*` generator marked
`@internal`
- `download` and `downloadStream` share a new private `_downloadUri`
builder (DRY)
**Outcome:** implemented
**Reference:** supabase-js `download(...).asStream()`
(`StreamDownloadBuilder`)
**Compliance matrix:** `storage.file_buckets.download_as_stream` ->
implemented
## Notes
- Idiomatic Dart choices rather than a transliteration of the JS
builder: a bare lazy `Stream<Uint8List>` (not
`Future<Stream<List<int>>>` and not a chained `asStream()` builder),
with errors delivered on the stream. `Uint8List` is used for the byte
chunks, consistent with `download`; because `Stream` is covariant it is
still usable anywhere a `Stream<List<int>>` is expected.
- Unit tests cover the streamed happy path, the transform plus
cacheNonce query, and an error status surfacing on the stream.
## Stacking
Third of three stacked PRs. Base: #1579 (listPaginated). Review and
merge #1578 then #1579 first.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an optional
cacheNonceparameter to the URL-generating storage methods so callers can bypass CDN caching for a specific file version. When set, acacheNoncequery parameter is appended to the generated URL.Methods updated:
getPublicUrlcreateSignedUrlcreateSignedUrls/createSignedUrlsResultdownloadOutcome: implemented
Ticket: SDK-875
Reference: supabase-js PR #2234 (
1ec22ca5)Compliance matrix:
storage.file_buckets.url_cache_nonce→ implementedNotes
getPublicUrl,download,createSignedUrl, andcreateSignedUrlsResultwithcacheNonce(including ordering afterdownload).Stacking
First of three stacked PRs for the remaining Storage file-bucket features. Base:
main.