Skip to content

feat(data-connect): Add Wire Protocol and Stub Methods for New Transport Implementation#9618

Merged
stephenarosaj merged 15 commits intopasta/mainfrom
pasta/ravioli
Mar 4, 2026
Merged

feat(data-connect): Add Wire Protocol and Stub Methods for New Transport Implementation#9618
stephenarosaj merged 15 commits intopasta/mainfrom
pasta/ravioli

Conversation

@stephenarosaj
Copy link
Copy Markdown
Contributor

@stephenarosaj stephenarosaj commented Mar 3, 2026

Description

✨ This PR establishes the foundation for a new Data Connect transport support. It introduces the core wire protocol interfaces and a new abstract base class that future concrete implementations will extend.

There are no functionality changes for this PR. This is just to get a foundation which we can add functionality on top of.

Changes

  • [NEW] wire.ts: Defines interfaces for requests and responses over the new transport protocol.

  • **[NEW] Introduces a new abstract class which implements DataConnectTransportInterface.

    • Defines abstract methods for concrete transports to implement: openConnection, closeConnection, sendMessage.
    • Stubs invokeQuery, invokeMutation, invokeSubscribe, invokeUnsubscribe to throw DataConnectError (OTHER / Not Implemented) for now.
  • Renames:

    • RestTransport.ts --> restTransport.ts
    • DataConnectTransport.ts --> transport.ts

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 3, 2026

⚠️ No Changeset found

Latest commit: b99ba72

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@gemini-code-assist
Copy link
Copy Markdown
Contributor

gemini-code-assist Bot commented Mar 3, 2026

Summary of Changes

Hello, 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 supporting new Data Connect transport implementations by introducing a robust abstraction layer. It establishes core interfaces and an abstract base class for transports, along with a manager to orchestrate them. Additionally, it defines the wire protocol for a future transport implementation and refactors the existing REST transport for better organization, preparing the system for diverse communication methods.

Highlights

  • New Transport Abstraction Layer: Introduced a new DataConnectTransportInterface and AbstractDataConnectTransport to provide a unified contract and base implementation for all transport types, enhancing extensibility for future transport mechanisms.
  • Transport Manager Implementation: Implemented DataConnectTransportManager as a central entry point for the transport layer, which currently delegates all operations to the existing REST transport, setting the stage for managing multiple transport types.
  • Wire Protocol Definition: Defined wire protocol interfaces for a future transport implementation, outlining the communication structure without implementing the full transport yet.
  • New Abstract Transport Foundation: Added a foundational abstract class for implementing a future transport implementation, with its core methods (invokeQuery, invokeMutation, invokeSubscribe, invokeUnsubscribe) currently stubbed to indicate future development.
  • REST Transport Refactoring: Refactored the existing REST transport implementation by moving RESTTransport and dcFetch into a new network/rest directory, improving modularity and organization.

🧠 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
  • packages/data-connect/src/api/DataConnect.ts
    • Updated imports to reflect new transport structure.
    • Changed the type of the internal _transport property to DataConnectTransportInterface.
    • Modified the default _transportClass to DataConnectTransportManager.
  • packages/data-connect/src/api/Mutation.ts
    • Updated import for DataConnectTransportInterface.
    • Changed the constructor parameter type for _transport to DataConnectTransportInterface.
  • packages/data-connect/src/api/query.ts
    • Updated import path for DataConnectExtensionWithMaxAge.
  • packages/data-connect/src/core/query/QueryManager.ts
    • Updated imports to use DataConnectTransportInterface and related types from the new network module.
    • Changed the constructor parameter type for transport to DataConnectTransportInterface.
  • packages/data-connect/src/core/query/queryOptions.ts
    • Removed an unnecessary blank line from a JSDoc comment.
  • packages/data-connect/src/index.node.ts
    • Updated the import path for initializeFetch to the new network/rest location.
  • packages/data-connect/src/network/index.ts
    • Changed export statement from explicit named exports to a wildcard export from ./transport.
  • packages/data-connect/src/network/manager.ts
    • Added DataConnectTransportManager class, which implements DataConnectTransportInterface and delegates all transport operations to an internal RESTTransport instance.
  • packages/data-connect/src/network/rest/fetch.ts
    • Renamed from packages/data-connect/src/network/fetch.ts.
    • Updated import paths to reflect the new network/rest directory structure.
    • Refined generic type parameters in DataConnectFetchBody and dcFetch from T, U to Data, Variables for clarity.
  • packages/data-connect/src/network/rest/index.ts
    • Added new index file to export fetch and restTransport from the network/rest directory.
  • packages/data-connect/src/network/rest/restTransport.ts
    • Added RESTTransport class, which extends AbstractDataConnectTransport and provides the concrete implementation for REST-based communication.
    • Implemented invokeQuery, invokeMutation, invokeSubscribe (throws NOT_SUPPORTED), invokeUnsubscribe (throws NOT_SUPPORTED), and onAuthTokenChanged methods.
    • Stubbed invokeQuery, invokeMutation, invokeSubscribe, and invokeUnsubscribe to throw 'Not yet implemented' errors.
  • packages/data-connect/src/network/transport.ts
    • Added new file consolidating core transport interfaces and abstract classes.
    • Defined CallerSdkType, DataConnectEntityArray, DataConnectSingleEntity, DataConnectExtension, DataConnectMaxAge, DataConnectExtensionWithMaxAge, Extensions, ExtensionsWithMaxAge, DataConnectResponse, DataConnectResponseWithMaxAge, SubscribeNotificationHook, DataConnectTransportInterface, and TransportClass.
    • Introduced AbstractDataConnectTransport as a base class for all transport implementations, handling common logic like URL construction and auth token management.
  • packages/data-connect/src/network/transport/index.ts
    • Removed the old transport index file, as its contents were refactored into packages/data-connect/src/network/transport.ts.
  • packages/data-connect/src/network/transport/rest.ts
    • Removed the old RESTTransport implementation, as it was refactored and moved to packages/data-connect/src/network/rest/restTransport.ts.
  • packages/data-connect/test/unit/caching.test.ts
    • Updated import path for initializeFetch to the new network/rest location.
  • packages/data-connect/test/unit/fetch.test.ts
    • Updated import paths for CallerSdkType, CallerSdkTypeEnum, dcFetch, and initializeFetch to reflect the new network and network/rest locations.
  • packages/data-connect/test/unit/gmpid.test.ts
    • Updated import path for initializeFetch to the new network/rest location.
  • packages/data-connect/test/unit/queries.test.ts
    • Updated import paths for initializeFetch and RESTTransport to the new network/rest location.
  • packages/data-connect/test/unit/transportManager.test.ts
    • Added new test file to verify the delegation behavior of DataConnectTransportManager to RESTTransport for various operations.
  • packages/data-connect/test/unit/userAgent.test.ts
    • Updated import path for initializeFetch to the new network/rest location.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request lays a solid foundation for the new transport implementation by introducing a transport manager, an abstract transport, and the wire protocol. The code is well-structured, but there are a couple of areas for improvement. I've identified a critical type mismatch in the RESTTransport implementation that violates the transport interface contract, which should be addressed. Additionally, there's an opportunity to clean up the DataConnectTransportManager constructor for better maintainability. My detailed feedback is in the comments below.

Comment thread packages/data-connect/src/network/rest/restTransport.ts Outdated
Comment thread packages/data-connect/src/network/manager.ts
@aashishpatil-g aashishpatil-g requested a review from dconeybe March 3, 2026 23:20
@stephenarosaj stephenarosaj changed the base branch from main to pasta/main March 3, 2026 23:29
@stephenarosaj stephenarosaj merged commit 074d204 into pasta/main Mar 4, 2026
33 checks passed
@stephenarosaj stephenarosaj deleted the pasta/ravioli branch March 4, 2026 00:00
@firebase firebase locked and limited conversation to collaborators Apr 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants