-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor of Supabase.Fetcher #54
Merged
Merged
Conversation
This file contains 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
…e test coverage for client initialisation
refactor/51
zoedsoupe
added a commit
that referenced
this pull request
Jan 10, 2025
## Problem 1. Limited Extensibility for HTTP Requests: The existing Supabase.Fetcher lacked robust support for custom decoders, error parsers, and HTTP client backends, leading to potential limitations when integrating advanced use cases. 2. Missing Configurability for Supabase Services: Service-specific URLs and configurations were not seamlessly integrated into the Supabase.Fetcher.Request builder, potentially leading to inconsistent setups for applications. 3. Inconsistent Error Handling: The lack of a centralized error management system meant error messages could be fragmented and harder to debug. 4. Absence of Detailed Test Coverage: Existing tests did not fully validate the behavior of streaming, file uploads, and custom configurations. ## Solution 1. Enhanced HTTP Request Builder: - Introduced a fully extensible request builder API in Supabase.Fetcher.Request that allows chaining methods for custom headers, body decoders, error parsers, and HTTP clients. - Added support for service-specific URL handlers (with_<service>_url/2) to standardize endpoint configurations for services like auth, storage, and database. 2. Improved Error Handling: - Centralized error management via the Supabase.Error module, defining a unified structure for error codes, messages, metadata, and service-specific origins. - Implemented error parsers in Supabase.ErrorParser for handling transport and HTTP errors seamlessly. 3. Streaming and File Upload Support: - Added robust support for streaming large files and consuming streamed responses using Finch.stream/5 in Supabase.Fetcher.Adapter.Finch. - Introduced file upload utilities that handle file streams, content-length headers, and MIME type detection automatically. 4. Tests for Comprehensive Coverage: - Enhanced test coverage with unit tests for request building, service-specific configurations, custom decoders, and error parsers. - Included tests for file upload, streaming, and error handling scenarios, ensuring edge cases are well-tested. 5. Documentation and Clarity: - Updated module and function documentation to describe key features and example use cases, making it easier for developers to adopt the changes. - Added clear examples for implementing custom decoders and error parsers, and using the enhanced request builder API. ## Rationale 1. Developer Productivity: The improved request builder and service-specific configurations reduce boilerplate code and improve consistency across integrations. 2. Error Debugging: Centralized error handling and detailed metadata in error messages enhance troubleshooting and debugging workflows. 3. Future-Proof Design: By introducing behaviors and allowing custom implementations for HTTP clients, body decoders, and error parsers, the library becomes extensible for future needs. 4. Reliability: The expanded test coverage ensures that core features like streaming, file uploads, and error management work as expected across a variety of scenarios. 5. Alignment with Supabase Ecosystem: These changes make the library a more powerful and idiomatic choice for Elixir developers integrating with Supabase, aligning well with Supabase’s flexibility and developer-first approach.
zoedsoupe
added a commit
that referenced
this pull request
Jan 10, 2025
## Problem 1. Limited Extensibility for HTTP Requests: The existing Supabase.Fetcher lacked robust support for custom decoders, error parsers, and HTTP client backends, leading to potential limitations when integrating advanced use cases. 2. Missing Configurability for Supabase Services: Service-specific URLs and configurations were not seamlessly integrated into the Supabase.Fetcher.Request builder, potentially leading to inconsistent setups for applications. 3. Inconsistent Error Handling: The lack of a centralized error management system meant error messages could be fragmented and harder to debug. 4. Absence of Detailed Test Coverage: Existing tests did not fully validate the behavior of streaming, file uploads, and custom configurations. ## Solution 1. Enhanced HTTP Request Builder: - Introduced a fully extensible request builder API in Supabase.Fetcher.Request that allows chaining methods for custom headers, body decoders, error parsers, and HTTP clients. - Added support for service-specific URL handlers (with_<service>_url/2) to standardize endpoint configurations for services like auth, storage, and database. 2. Improved Error Handling: - Centralized error management via the Supabase.Error module, defining a unified structure for error codes, messages, metadata, and service-specific origins. - Implemented error parsers in Supabase.ErrorParser for handling transport and HTTP errors seamlessly. 3. Streaming and File Upload Support: - Added robust support for streaming large files and consuming streamed responses using Finch.stream/5 in Supabase.Fetcher.Adapter.Finch. - Introduced file upload utilities that handle file streams, content-length headers, and MIME type detection automatically. 4. Tests for Comprehensive Coverage: - Enhanced test coverage with unit tests for request building, service-specific configurations, custom decoders, and error parsers. - Included tests for file upload, streaming, and error handling scenarios, ensuring edge cases are well-tested. 5. Documentation and Clarity: - Updated module and function documentation to describe key features and example use cases, making it easier for developers to adopt the changes. - Added clear examples for implementing custom decoders and error parsers, and using the enhanced request builder API. ## Rationale 1. Developer Productivity: The improved request builder and service-specific configurations reduce boilerplate code and improve consistency across integrations. 2. Error Debugging: Centralized error handling and detailed metadata in error messages enhance troubleshooting and debugging workflows. 3. Future-Proof Design: By introducing behaviors and allowing custom implementations for HTTP clients, body decoders, and error parsers, the library becomes extensible for future needs. 4. Reliability: The expanded test coverage ensures that core features like streaming, file uploads, and error management work as expected across a variety of scenarios. 5. Alignment with Supabase Ecosystem: These changes make the library a more powerful and idiomatic choice for Elixir developers integrating with Supabase, aligning well with Supabase’s flexibility and developer-first approach.
zoedsoupe
added a commit
that referenced
this pull request
Jan 10, 2025
## Problem 1. Limited Extensibility for HTTP Requests: The existing Supabase.Fetcher lacked robust support for custom decoders, error parsers, and HTTP client backends, leading to potential limitations when integrating advanced use cases. 2. Missing Configurability for Supabase Services: Service-specific URLs and configurations were not seamlessly integrated into the Supabase.Fetcher.Request builder, potentially leading to inconsistent setups for applications. 3. Inconsistent Error Handling: The lack of a centralized error management system meant error messages could be fragmented and harder to debug. 4. Absence of Detailed Test Coverage: Existing tests did not fully validate the behavior of streaming, file uploads, and custom configurations. ## Solution 1. Enhanced HTTP Request Builder: - Introduced a fully extensible request builder API in Supabase.Fetcher.Request that allows chaining methods for custom headers, body decoders, error parsers, and HTTP clients. - Added support for service-specific URL handlers (with_<service>_url/2) to standardize endpoint configurations for services like auth, storage, and database. 2. Improved Error Handling: - Centralized error management via the Supabase.Error module, defining a unified structure for error codes, messages, metadata, and service-specific origins. - Implemented error parsers in Supabase.ErrorParser for handling transport and HTTP errors seamlessly. 3. Streaming and File Upload Support: - Added robust support for streaming large files and consuming streamed responses using Finch.stream/5 in Supabase.Fetcher.Adapter.Finch. - Introduced file upload utilities that handle file streams, content-length headers, and MIME type detection automatically. 4. Tests for Comprehensive Coverage: - Enhanced test coverage with unit tests for request building, service-specific configurations, custom decoders, and error parsers. - Included tests for file upload, streaming, and error handling scenarios, ensuring edge cases are well-tested. 5. Documentation and Clarity: - Updated module and function documentation to describe key features and example use cases, making it easier for developers to adopt the changes. - Added clear examples for implementing custom decoders and error parsers, and using the enhanced request builder API. ## Rationale 1. Developer Productivity: The improved request builder and service-specific configurations reduce boilerplate code and improve consistency across integrations. 2. Error Debugging: Centralized error handling and detailed metadata in error messages enhance troubleshooting and debugging workflows. 3. Future-Proof Design: By introducing behaviors and allowing custom implementations for HTTP clients, body decoders, and error parsers, the library becomes extensible for future needs. 4. Reliability: The expanded test coverage ensures that core features like streaming, file uploads, and error management work as expected across a variety of scenarios. 5. Alignment with Supabase Ecosystem: These changes make the library a more powerful and idiomatic choice for Elixir developers integrating with Supabase, aligning well with Supabase’s flexibility and developer-first approach.
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.
Problem
Solution
Rationale