feat: extend S3 widget with multi-provider support#1760
Conversation
Adds support for AWS, DigitalOcean Spaces, Backblaze B2, Wasabi, and Cloudflare R2 in the S3 widget. The endpoint URL is derived on the backend per provider rules (region-based for most; account_id for R2) so users only pick a provider rather than supplying a raw endpoint. Renames widget DTOs/params to be provider-agnostic; widget_params JSON keys aws_access_key_id_secret_name/aws_secret_access_key_secret_name become access_key_id_secret_name/secret_access_key_secret_name. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR refactors S3 widget support from AWS-only to multi-provider bucket storage. A new ChangesMulti-Provider S3 Widget Refactoring
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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.
Pull request overview
Extends the existing S3 widget to support multiple S3-compatible providers (AWS, DigitalOcean Spaces, Backblaze B2, Wasabi, Cloudflare R2) by introducing a provider field and deriving the correct S3 endpoint on the backend, while renaming widget params/DTOs to be provider-agnostic.
Changes:
- Add
provider(+account_idfor R2) support and backend endpoint resolution logic for S3-compatible providers. - Rename widget params keys to provider-agnostic names (
access_key_id_secret_name,secret_access_key_secret_name) and update frontend/backend DTOs accordingly. - Expand backend E2E coverage to validate provider handling and required params.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/app/services/s3.service.ts | Renames response interfaces to provider-agnostic “Bucket*” types while keeping API usage the same. |
| frontend/src/app/components/ui-components/table-display-fields/s3/s3.component.ts | Updates widget params typing to include provider/account_id and new secret key names. |
| frontend/src/app/components/ui-components/table-display-fields/s3/s3.component.spec.ts | Updates tests to use renamed secret key params. |
| frontend/src/app/components/ui-components/record-view-fields/s3/s3.component.ts | Updates widget params typing to include provider/account_id and new secret key names. |
| frontend/src/app/components/ui-components/record-view-fields/s3/s3.component.spec.ts | Updates tests to use renamed secret key params. |
| frontend/src/app/components/ui-components/record-edit-fields/s3/s3.component.ts | Updates widget params typing / parsing to the new provider-agnostic shape. |
| frontend/src/app/components/ui-components/record-edit-fields/s3/s3.component.spec.ts | Updates tests to include provider and renamed secret key params. |
| frontend/src/app/components/dashboard/db-table-view/db-table-widgets/db-table-widgets.component.ts | Updates the S3 widget settings template/documentation for multi-provider usage. |
| backend/test/ava-tests/non-saas-tests/non-saas-s3-widget-e2e.test.ts | Updates existing S3 widget tests for renamed params and adds provider validation tests. |
| backend/src/entities/widget/utils/validate-create-widgets-ds.ts | Adds validation for new param names, supported providers, and R2 account_id requirement. |
| backend/src/entities/s3-widget/use-cases/s3-use-cases.interface.ts | Renames DS types to provider-agnostic “Bucket*” naming. |
| backend/src/entities/s3-widget/use-cases/get-s3-upload-url.use.case.ts | Uses provider-agnostic params and new S3 client factory signature. |
| backend/src/entities/s3-widget/use-cases/get-s3-file-url.use.case.ts | Uses provider-agnostic params and new S3 client factory signature. |
| backend/src/entities/s3-widget/s3-widget.controller.ts | Updates controller return types to renamed DS classes. |
| backend/src/entities/s3-widget/s3-helper.service.ts | Implements provider-based region/endpoint resolution and config-driven S3 client creation. |
| backend/src/entities/s3-widget/application/data-structures/s3-widget-params.ds.ts | Renames widget params interface and adds provider/account_id. |
| backend/src/entities/s3-widget/application/data-structures/s3-operation.ds.ts | Renames request/response DS classes to “GetBucket*” / “Bucket*Response”. |
| backend/src/entities/s3-widget/application/data-structures/bucket-provider.enum.ts | Introduces the canonical enum of supported bucket providers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const params: BucketWidgetParams = | ||
| typeof widget.widget_params === 'string' ? JSON5.parse(widget.widget_params) : widget.widget_params; | ||
|
|
||
| const accessKeySecret = await this._dbContext.userSecretRepository.findSecretBySlugAndCompanyId( | ||
| params.aws_access_key_id_secret_name, | ||
| params.access_key_id_secret_name, |
| const accessKeySecret = await this._dbContext.userSecretRepository.findSecretBySlugAndCompanyId( | ||
| params.aws_access_key_id_secret_name, | ||
| params.access_key_id_secret_name, | ||
| user.company.id, | ||
| ); | ||
|
|
| if (provider === BucketProviderEnum.CloudflareR2) { | ||
| return 'auto'; | ||
| } | ||
| return 'us-east-1'; |
| // bucket: bucket name (required) | ||
| // prefix: Optional path prefix for uploaded files | ||
| // region: AWS region (default: us-east-1) | ||
| // region: Region for the bucket (default: us-east-1; for cloudflare-r2 use "auto") |
Adds support for AWS, DigitalOcean Spaces, Backblaze B2, Wasabi, and Cloudflare R2 in the S3 widget. The endpoint URL is derived on the backend per provider rules (region-based for most; account_id for R2) so users only pick a provider rather than supplying a raw endpoint. Renames widget DTOs/params to be provider-agnostic; widget_params JSON keys aws_access_key_id_secret_name/aws_secret_access_key_secret_name become access_key_id_secret_name/secret_access_key_secret_name.
Summary by CodeRabbit
New Features
Improvements