Skip to content

feat(storage): add StorageTransferTask, MultipartUploadEngine, and upload API#991

Open
grdsdev wants to merge 4 commits into
refactor/storage-http-clientfrom
stacked/pr1-multipart
Open

feat(storage): add StorageTransferTask, MultipartUploadEngine, and upload API#991
grdsdev wants to merge 4 commits into
refactor/storage-http-clientfrom
stacked/pr1-multipart

Conversation

@grdsdev
Copy link
Copy Markdown
Contributor

@grdsdev grdsdev commented May 7, 2026

Summary

  • Adds StorageTransferTask<Success> — a unified handle with AsyncStream<TransferEvent<Success>> progress events and an async value property
  • Adds MultipartUploadEngine actor for standard multipart POST uploads with URLSessionTaskDelegate progress events and temp-file streaming for large files
  • Merges FileUpload and UploadSource into a single UploadSource type
  • Updates upload() and update() to return StorageUploadTask instead of Void

API changes

// upload now returns StorageUploadTask (was Void)
func upload(_ path: String, data: Data, options: FileOptions = .init()) -> StorageUploadTask
func upload(_ path: String, fileURL: URL, options: FileOptions = .init()) -> StorageUploadTask
func update(_ path: String, data: Data, options: FileOptions = .init()) -> StorageUploadTask
func update(_ path: String, fileURL: URL, options: FileOptions = .init()) -> StorageUploadTask

Test plan

  • StorageTransferTaskTests — all pass
  • MultipartUploadEngineTests — all pass
  • StorageFileAPITests — all pass
  • UploadProgressTests — all pass

🤖 Generated with Claude Code

…load API

- Add StorageTransferTask<Success> with AsyncStream progress events and async value property
- Add MultipartUploadEngine actor for standard multipart POST uploads
- Add UploadSource type for abstracting Data vs file URL uploads
- Update upload() and update() methods to return StorageUploadTask instead of Void
- Remove old incompatible integration tests (replaced in later PR)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
grdsdev added 3 commits May 7, 2026 06:53
update() was delegating to upload() with upsert: true, which sent a
POST + x-upsert header. The correct behaviour (matching supabase-js)
is a PUT request with no x-upsert header. TUS does not have an update
concept, so the method: parameter is removed from both update overloads.

- MultipartUploadEngine.makeTask now accepts httpMethod (default .post)
- update(data:) and update(fileURL:) call multipart with httpMethod: .put
- Tests updated: POST mocks → PUT mocks, upsert assertions removed,
  new assertion verifies PUT method and absence of x-upsert header
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant