-
-
Notifications
You must be signed in to change notification settings - Fork 173
RFC: Migrate HTTP networking from URLSession to Alamofire #781
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
Draft
grdsdev
wants to merge
36
commits into
main
Choose a base branch
from
alamofire
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+5,052
−3,609
Conversation
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
BREAKING CHANGE: This begins the migration from custom HTTP client to Alamofire. Added Alamofire 5.9+ as a dependency to the Helpers module. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
BREAKING CHANGE: Replace URLSession with Alamofire.Session in GlobalOptions. - Updated SupabaseClientOptions.GlobalOptions to use Alamofire.Session instead of URLSession - Modified SupabaseClient networking methods to use Alamofire request/response handling - Added SupabaseNetworkingConfig and SupabaseAuthenticator for future extensibility - Fixed Session type ambiguity by using fully qualified types (Auth.Session vs Alamofire.Session) This is part of Phase 2 of the Alamofire migration. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
BREAKING CHANGE: Replace StorageHTTPSession with direct Alamofire.Session usage. - Updated StorageClientConfiguration to use Alamofire.Session instead of StorageHTTPSession - Refactored StorageApi.execute() method to use Alamofire request/response handling - Removed StorageHTTPClient.swift as it's no longer needed - Updated deprecated storage methods to use Alamofire.Session - Maintained existing multipart form data functionality This is part of Phase 3 of the Alamofire migration. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
BREAKING CHANGE: Replace FetchHandler with direct Alamofire.Session usage. - Updated AuthClient.Configuration to use Alamofire.Session instead of FetchHandler - Refactored APIClient.execute() method to use Alamofire request/response handling - Updated Dependencies structure to use Alamofire.Session - Fixed deprecated auth methods to use Alamofire.Session - Removed custom HTTPClient usage from Auth module This is part of Phase 4 of the Alamofire migration. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
BREAKING CHANGE: Replace FetchHandler with direct Alamofire.Session usage. Functions Module: - Replaced FetchHandler with Alamofire.Session in FunctionsClient - Updated rawInvoke() to use Alamofire request/response handling - Simplified streaming functionality to use default configuration - Removed sessionConfiguration dependencies PostgREST Module: - Updated PostgrestClient.Configuration to use Alamofire.Session - Refactored PostgrestBuilder to use Alamofire directly - Updated deprecated methods to use Alamofire.Session - Removed custom HTTPClient usage This is part of Phase 5 of the Alamofire migration. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
BREAKING CHANGE: Replace fetch handler with Alamofire.Session for HTTP operations. - Updated RealtimeClientOptions to use Alamofire.Session instead of fetch handler - Modified RealtimeClientV2 protocol and implementation to use session property - Updated RealtimeChannelV2 broadcast functionality to use Alamofire for HTTP requests - WebSocket functionality remains unchanged (URLSessionWebSocket) - Fixed async/await patterns in broadcast acknowledgment handling Note: Deprecated RealtimeClient still uses custom HTTP implementation for backward compatibility. This is part of Phase 6 of the Alamofire migration. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
… Realtime - Removed custom HTTPClient, LoggerInterceptor, and RetryRequestInterceptor files - Fixed deprecated RealtimeClient to use Alamofire.Session instead of HTTPClientType - Updated deprecated RealtimeChannel broadcast functionality to use Alamofire - Maintained backward compatibility for deprecated classes - All modules now successfully build with Alamofire This completes the removal of custom HTTP client implementation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Fixed SupabaseClient initialization to use 'session' parameter instead of deprecated 'fetch' - Removed HTTPClientMock test helper as it's no longer compatible with Alamofire - All modules now build successfully without compilation errors - Only deprecation warnings remain, which are expected This completes the Alamofire migration with a fully building project. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…async/await methods
…ync/await methods
…async/await methods
…re async/await methods
…ofire async/await methods
…ent with Alamofire
…ire streaming API
…o invokeWithStreamedResponse
- Replace HTTPTypes import with Alamofire - Update HTTPFields to HTTPHeaders - Change header access patterns to use string keys - Update HTTPRequest.Method to HTTPMethod - Modify header merging logic for Alamofire compatibility - Update tests across all modules to use Alamofire types
- Update AuthAdmin, AuthClient, and AuthMFA for Alamofire compatibility - Refactor APIClient and SessionManager internal implementations - Improve error handling and request formatting
- Update FunctionsClient for Alamofire compatibility - Refactor FunctionInvokeOptionsTests and FunctionsClientTests - Improve error handling and request formatting in Functions module
- Update PostgREST builders and client for Alamofire compatibility - Refactor HTTP fields and Foundation extensions - Improve query building and filtering with Alamofire - Streamline request formatting and error handling
- Refine PostgREST builders and client implementation - Update HTTP request handling and Foundation extensions - Improve test coverage for Alamofire integration - Streamline query building and filtering logic
- Update StorageApi and StorageFileApi for Alamofire compatibility - Refactor StorageBucketAPITests and StorageFileAPITests - Improve file upload and storage operations with Alamofire - Streamline multipart form data handling
- Completely refactor AuthClient with Alamofire implementation - Update AuthAdmin and AuthMFA for Alamofire compatibility - Refactor APIClient and SessionManager internal components - Enhance HTTP fields handling for Alamofire - Streamline authentication flow and error handling
- Add better status code validation for Alamofire responses - Enhance error handling for non-2xx HTTP responses - Improve request validation and response processing
- Update signOut, verifyOTP, resend, and reauthenticate methods to use throws(AuthError) - Wrap API calls with wrappingError to ensure proper error type conversion - Add explicit self references in closures where required - Ensure consistent error handling across all public methods - Update _verifyOTP private method to also use throws(AuthError) This ensures all public methods that can throw errors properly specify AuthError type, making the API more predictable and type-safe for developers.
- Update AuthMFA methods to use throws(AuthError) for consistent error handling - Update AuthAdmin methods to use throws(AuthError) for consistent error handling - Wrap API calls with wrappingError to ensure proper error type conversion - Add explicit self references in closures where required - Update Types.swift with any necessary type changes for error handling This extends the typed error handling improvements to the MFA and Admin authentication modules, ensuring all authentication-related methods have consistent AuthError typing.
… migration guide - Refactor AuthClient session initialization to use explicit adapters array - Add comprehensive Alamofire migration guide documenting breaking changes - Improve code readability and maintainability
- Add new WrappingError.swift helper with generic error wrapping functions - Refactor Auth module to use generic wrappingError(or: mapToAuthError) - Refactor Functions module to use proper error types and wrapping - Rename mapError to mapToAuthError for better clarity - Update FunctionsClient to throw FunctionsError instead of generic errors - Add comprehensive tests for new error handling in Functions module
- Add extensive test coverage for Auth client functionality - Test password reset, email resend, phone resend operations - Test admin user management (get, update, create, delete users) - Test MFA operations (enroll, challenge, verify, unenroll, list factors) - Test SSO sign-in with domain and provider ID - Test user identity unlinking and reauthentication - Test authenticator assurance level functionality - Fix status codes in existing tests (200 -> 204 for appropriate endpoints) - Add proper test mocks and assertions for all new test cases
…ents - Add SessionManagerTests (11 tests) covering session lifecycle, refresh, auto-refresh, and concurrent operations - Add SessionStorageTests (16 tests) covering CRUD operations, persistence, and edge cases - Add EventEmitterTests (12 tests) covering event system and listener management - Add APIClientTests (10 tests) covering HTTP request handling and error scenarios - Improve existing test files with better mocking and edge case coverage - Integrate Mocker library for HTTP request testing - Add comprehensive concurrency testing and error handling - Achieve 95% test success rate (115/121 tests passing) This significantly improves the reliability and maintainability of the Auth module by providing robust test coverage for critical internal components.
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
This PR proposes migrating the Supabase Swift SDK's HTTP networking layer from URLSession to Alamofire. This is a proposal/RFC and not the final implementation.
Key Changes
- Testing: Updated all test suites to work with the new networking approachModules Updated
Benefits of This Migration
Breaking Changes
Session
instance instead of fetch handlers during initializationWhile we aim to maintain backward compatibility where possible, users may need to update their initialization code when adopting this version.
Test Plan
Next Steps
This PR is intended for review and discussion. Before merging:
🤖 Generated with Claude Code