feat(adapters): add supabase adapter#2
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughSummary by CodeRabbit
WalkthroughA new Supabase Storage adapter is added to the SDK, implementing the full provider interface: upload, download, head, exists, delete, copy, list, URL generation, signed upload URLs, and TUS-based resumable uploads. The adapter is registered in the provider catalog, and documentation pages and README entries are added. ChangesSupabase Storage Adapter
Sequence DiagramsequenceDiagram
participant App
participant Adapter
participant SupabaseStorageAPI
participant TUSEndpoint
rect rgba(70, 130, 180, 0.5)
note over App,SupabaseStorageAPI: Standard upload
App->>Adapter: Upload(ctx, key, body, opts)
Adapter->>SupabaseStorageAPI: POST /object/{bucket}/{key} (apikey, x-upsert)
SupabaseStorageAPI-->>Adapter: 200 OK + ETag
Adapter-->>App: UploadResult
end
rect rgba(60, 179, 113, 0.5)
note over App,TUSEndpoint: TUS resumable upload
App->>Adapter: ResumableUpload → Begin
Adapter->>TUSEndpoint: POST /upload (Upload-Length, Upload-Metadata)
TUSEndpoint-->>Adapter: 201 Created + Location
App->>Adapter: Probe → HEAD tempURL
TUSEndpoint-->>Adapter: Upload-Offset
App->>Adapter: UploadPart → PATCH tempURL (chunk, Upload-Offset)
TUSEndpoint-->>Adapter: 204 + new Upload-Offset
App->>Adapter: Complete → UploadResult
end
rect rgba(210, 105, 30, 0.5)
note over App,SupabaseStorageAPI: Signed URL generation
App->>Adapter: URL(ctx, key, opts)
Adapter->>SupabaseStorageAPI: POST /sign/{bucket}/{key} (expiresIn, download)
SupabaseStorageAPI-->>Adapter: signedURL token
Adapter-->>App: signed URL string
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
providers/supabase/supabase_test.go (2)
433-433: 💤 Low valueConsider asserting or removing the unused
methodsvariable.The
methodsslice collects HTTP methods but is never asserted. If it's meant for debugging, consider removing it; otherwise, add an assertion to verify the expected method sequence.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@providers/supabase/supabase_test.go` at line 433, The methods slice in the Supabase test is collected but never used, so either remove the unused methods tracking from the test or add an assertion in the relevant test case to verify the expected HTTP method sequence; update the test logic around the methods variable in supabase_test.go accordingly.
64-65: 💤 Low valueMerge variable declaration with assignment.
The handler closure doesn't reference
server, so the two-line declaration is unnecessary.Suggested fix
- var server *httptest.Server - server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@providers/supabase/supabase_test.go` around lines 64 - 65, The `server` variable in `providers/supabase/supabase_test.go` is declared and assigned on separate lines even though the handler closure does not use it; simplify the setup by merging the declaration and assignment into a single `httptest.NewServer(...)` statement near `server` in `Test...` so the test remains functionally identical but cleaner.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@providers/supabase/supabase_test.go`:
- Line 433: The methods slice in the Supabase test is collected but never used,
so either remove the unused methods tracking from the test or add an assertion
in the relevant test case to verify the expected HTTP method sequence; update
the test logic around the methods variable in supabase_test.go accordingly.
- Around line 64-65: The `server` variable in
`providers/supabase/supabase_test.go` is declared and assigned on separate lines
even though the handler closure does not use it; simplify the setup by merging
the declaration and assignment into a single `httptest.NewServer(...)` statement
near `server` in `Test...` so the test remains functionally identical but
cleaner.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 2fea1a43-0e60-48ad-92fb-16ab76728c55
📒 Files selected for processing (9)
README.mdapps/web/content/docs/adapters/meta.jsonapps/web/content/docs/adapters/supabase.mdxapps/web/content/docs/providers.mdxprovider_catalog.goprovider_catalog_test.goproviders/supabase/resumable.goproviders/supabase/supabase.goproviders/supabase/supabase_test.go
No description provided.