@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.
package/dist/index.esm.js CHANGED
@@ -4,7 +4,7 @@ import { FirebaseError, generateSHA256Hash, isCloudWorkstation, pingServer } fro
4
4
  import { Logger } from '@firebase/logger';
5
5
 
6
6
  const name = "@firebase/data-connect";
7
- const version = "0.6.0-20260408221811";
7
+ const version = "0.6.0";
8
8
 
9
9
  /**
10
10
  * @license
@@ -1701,6 +1701,8 @@ class AbstractDataConnectStreamTransport extends AbstractDataConnectTransport {
1701
1701
  this.closeTimeout = null;
1702
1702
  /** has the close timeout finished? */
1703
1703
  this.closeTimeoutFinished = false;
1704
+ /** Flag to ensure we wait for the initial auth state once per connection attempt. */
1705
+ this.hasWaitedForInitialAuth = false;
1704
1706
  /**
1705
1707
  * Tracks if the next message to be sent is the first message of the stream.
1706
1708
  */
@@ -1841,6 +1843,7 @@ class AbstractDataConnectStreamTransport extends AbstractDataConnectTransport {
1841
1843
  onConnectionReady() {
1842
1844
  this.isFirstStreamMessage = true;
1843
1845
  this.lastSentAuthToken = null;
1846
+ this.hasWaitedForInitialAuth = false;
1844
1847
  }
1845
1848
  /**
1846
1849
  * Attempt to close the connection. Will only close if there are no active requests preventing it
@@ -1921,12 +1924,12 @@ class AbstractDataConnectStreamTransport extends AbstractDataConnectTransport {
1921
1924
  }
1922
1925
  headers['X-Goog-Api-Client'] = getGoogApiClientValue$1(this._isUsingGen, this._callerSdkType);
1923
1926
  if (this.shouldIncludeAuth && this._authToken) {
1924
- headers.authToken = this._authToken;
1927
+ headers['X-Firebase-Auth-Token'] = this._authToken;
1925
1928
  this.lastSentAuthToken = this._authToken;
1926
1929
  }
1927
1930
  if (this.isFirstStreamMessage) {
1928
1931
  if (this._appCheckToken) {
1929
- headers.appCheckToken = this._appCheckToken;
1932
+ headers['X-Firebase-App-Check'] = this._appCheckToken;
1930
1933
  }
1931
1934
  preparedRequestBody.name = this._connectorResourcePath;
1932
1935
  }
@@ -1934,12 +1937,17 @@ class AbstractDataConnectStreamTransport extends AbstractDataConnectTransport {
1934
1937
  this.isFirstStreamMessage = false;
1935
1938
  return preparedRequestBody;
1936
1939
  }
1940
+ // TODO(stephenarosaj): just make this async
1937
1941
  /**
1938
1942
  * Sends a request message to the server via the concrete implementation.
1939
1943
  * Ensures the connection is ready and prepares the message before sending.
1940
1944
  * @returns A promise that resolves when the request message has been sent.
1941
1945
  */
1942
- sendRequestMessage(requestBody) {
1946
+ async sendRequestMessage(requestBody) {
1947
+ if (!this.hasWaitedForInitialAuth && this.authProvider) {
1948
+ await this.getWithAuth();
1949
+ this.hasWaitedForInitialAuth = true;
1950
+ }
1943
1951
  if (this.streamIsReady) {
1944
1952
  const prepared = this.prepareMessage(requestBody);
1945
1953
  return this.sendMessage(prepared);