@firebase/data-connect 0.6.0-20260408221811 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -561,6 +561,8 @@ class AbstractDataConnectStreamTransport extends AbstractDataConnectTransport {
561
561
  this.closeTimeout = null;
562
562
  /** has the close timeout finished? */
563
563
  this.closeTimeoutFinished = false;
564
+ /** Flag to ensure we wait for the initial auth state once per connection attempt. */
565
+ this.hasWaitedForInitialAuth = false;
564
566
  /**
565
567
  * Tracks if the next message to be sent is the first message of the stream.
566
568
  */
@@ -701,6 +703,7 @@ class AbstractDataConnectStreamTransport extends AbstractDataConnectTransport {
701
703
  onConnectionReady() {
702
704
  this.isFirstStreamMessage = true;
703
705
  this.lastSentAuthToken = null;
706
+ this.hasWaitedForInitialAuth = false;
704
707
  }
705
708
  /**
706
709
  * Attempt to close the connection. Will only close if there are no active requests preventing it
@@ -781,12 +784,12 @@ class AbstractDataConnectStreamTransport extends AbstractDataConnectTransport {
781
784
  }
782
785
  headers['X-Goog-Api-Client'] = getGoogApiClientValue$1(this._isUsingGen, this._callerSdkType);
783
786
  if (this.shouldIncludeAuth && this._authToken) {
784
- headers.authToken = this._authToken;
787
+ headers['X-Firebase-Auth-Token'] = this._authToken;
785
788
  this.lastSentAuthToken = this._authToken;
786
789
  }
787
790
  if (this.isFirstStreamMessage) {
788
791
  if (this._appCheckToken) {
789
- headers.appCheckToken = this._appCheckToken;
792
+ headers['X-Firebase-App-Check'] = this._appCheckToken;
790
793
  }
791
794
  preparedRequestBody.name = this._connectorResourcePath;
792
795
  }
@@ -794,12 +797,17 @@ class AbstractDataConnectStreamTransport extends AbstractDataConnectTransport {
794
797
  this.isFirstStreamMessage = false;
795
798
  return preparedRequestBody;
796
799
  }
800
+ // TODO(stephenarosaj): just make this async
797
801
  /**
798
802
  * Sends a request message to the server via the concrete implementation.
799
803
  * Ensures the connection is ready and prepares the message before sending.
800
804
  * @returns A promise that resolves when the request message has been sent.
801
805
  */
802
- sendRequestMessage(requestBody) {
806
+ async sendRequestMessage(requestBody) {
807
+ if (!this.hasWaitedForInitialAuth && this.authProvider) {
808
+ await this.getWithAuth();
809
+ this.hasWaitedForInitialAuth = true;
810
+ }
803
811
  if (this.streamIsReady) {
804
812
  const prepared = this.prepareMessage(requestBody);
805
813
  return this.sendMessage(prepared);
@@ -1258,7 +1266,7 @@ class WebSocketTransport extends AbstractDataConnectStreamTransport {
1258
1266
  }
1259
1267
 
1260
1268
  const name = "@firebase/data-connect";
1261
- const version = "0.6.0-20260408221811";
1269
+ const version = "0.6.0";
1262
1270
 
1263
1271
  /**
1264
1272
  * @license