feat(dataconnect): Introduce TransportManager and Transport Abstraction#9609
feat(dataconnect): Introduce TransportManager and Transport Abstraction#9609stephenarosaj merged 10 commits intopasta/mainfrom
Conversation
|
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request lays the groundwork for a more flexible and extensible network transport layer within the Data Connect SDK. It establishes a clear separation of concerns by introducing a central manager for routing requests and an abstract base class to consolidate shared functionalities. This architectural change will facilitate the integration of diverse transport mechanisms in the future, while also improving code maintainability and consistency. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a transport abstraction layer to support multiple transport implementations in the future. It refactors the existing RESTTransport to use a new DataConnectTransportClass base class, which encapsulates common logic. The changes are well-structured and improve the architecture for future extensions.
My review includes several suggestions to improve code clarity, correctness, and type safety. I've pointed out a logic issue in getWithAuth and proposed a cleaner implementation using async/await. I've also highlighted some unsafe type casts in RESTTransport that could hide potential bugs, and suggested refactoring opportunities for better readability in other areas. Additionally, there are minor suggestions for API consistency and documentation.
dconeybe
left a comment
There was a problem hiding this comment.
LGTM with one minor comment
Overview
✨ This PR adds a
TransportManagerin between the concreteRESTTransportimplementation and the query layer. It also abstracts common transport logic to a baseDataConnectTransportclass to share common logic across different transport types - now, REST transport only handles REST / fetch specific functionality.Key Changes
DataConnectTransportManagerto act as the entry point for network operations. It currently routes all requests to the REST transport.DataConnectTransportClass, an abstract base class that encapsulates shared logic such as authentication management, emulator configuration, and URL construction.RESTTransportto extendDataConnectTransportClass, allowing REST Transport to focus only on REST-related functionality.DataConnectTransportinterface to includeinvokeSubscribeandinvokeUnsubscribemethods. These are unsupported inRESTTransport.Data,Variables) and authentication property naming (authTokenandonAuthTokenChange) for improved readability and consistency.Testing
DataConnectTransportManagerto verify initialization and delegation logic. These will be updated / expanded later to test management of different transport implementations.