@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.cjs.js +12 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +12 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.node.cjs.js +12 -4
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/node-esm/index.node.esm.js +12 -4
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/network/stream/streamTransport.d.ts +2 -0
- package/dist/node-esm/src/network/stream/wire.d.ts +4 -4
- package/dist/src/network/stream/streamTransport.d.ts +2 -0
- package/dist/src/network/stream/wire.d.ts +4 -4
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -8,7 +8,7 @@ var util = require('@firebase/util');
|
|
|
8
8
|
var logger$1 = require('@firebase/logger');
|
|
9
9
|
|
|
10
10
|
const name = "@firebase/data-connect";
|
|
11
|
-
const version = "0.6.0
|
|
11
|
+
const version = "0.6.0";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
|
@@ -1705,6 +1705,8 @@ class AbstractDataConnectStreamTransport extends AbstractDataConnectTransport {
|
|
|
1705
1705
|
this.closeTimeout = null;
|
|
1706
1706
|
/** has the close timeout finished? */
|
|
1707
1707
|
this.closeTimeoutFinished = false;
|
|
1708
|
+
/** Flag to ensure we wait for the initial auth state once per connection attempt. */
|
|
1709
|
+
this.hasWaitedForInitialAuth = false;
|
|
1708
1710
|
/**
|
|
1709
1711
|
* Tracks if the next message to be sent is the first message of the stream.
|
|
1710
1712
|
*/
|
|
@@ -1845,6 +1847,7 @@ class AbstractDataConnectStreamTransport extends AbstractDataConnectTransport {
|
|
|
1845
1847
|
onConnectionReady() {
|
|
1846
1848
|
this.isFirstStreamMessage = true;
|
|
1847
1849
|
this.lastSentAuthToken = null;
|
|
1850
|
+
this.hasWaitedForInitialAuth = false;
|
|
1848
1851
|
}
|
|
1849
1852
|
/**
|
|
1850
1853
|
* Attempt to close the connection. Will only close if there are no active requests preventing it
|
|
@@ -1925,12 +1928,12 @@ class AbstractDataConnectStreamTransport extends AbstractDataConnectTransport {
|
|
|
1925
1928
|
}
|
|
1926
1929
|
headers['X-Goog-Api-Client'] = getGoogApiClientValue$1(this._isUsingGen, this._callerSdkType);
|
|
1927
1930
|
if (this.shouldIncludeAuth && this._authToken) {
|
|
1928
|
-
headers
|
|
1931
|
+
headers['X-Firebase-Auth-Token'] = this._authToken;
|
|
1929
1932
|
this.lastSentAuthToken = this._authToken;
|
|
1930
1933
|
}
|
|
1931
1934
|
if (this.isFirstStreamMessage) {
|
|
1932
1935
|
if (this._appCheckToken) {
|
|
1933
|
-
headers
|
|
1936
|
+
headers['X-Firebase-App-Check'] = this._appCheckToken;
|
|
1934
1937
|
}
|
|
1935
1938
|
preparedRequestBody.name = this._connectorResourcePath;
|
|
1936
1939
|
}
|
|
@@ -1938,12 +1941,17 @@ class AbstractDataConnectStreamTransport extends AbstractDataConnectTransport {
|
|
|
1938
1941
|
this.isFirstStreamMessage = false;
|
|
1939
1942
|
return preparedRequestBody;
|
|
1940
1943
|
}
|
|
1944
|
+
// TODO(stephenarosaj): just make this async
|
|
1941
1945
|
/**
|
|
1942
1946
|
* Sends a request message to the server via the concrete implementation.
|
|
1943
1947
|
* Ensures the connection is ready and prepares the message before sending.
|
|
1944
1948
|
* @returns A promise that resolves when the request message has been sent.
|
|
1945
1949
|
*/
|
|
1946
|
-
sendRequestMessage(requestBody) {
|
|
1950
|
+
async sendRequestMessage(requestBody) {
|
|
1951
|
+
if (!this.hasWaitedForInitialAuth && this.authProvider) {
|
|
1952
|
+
await this.getWithAuth();
|
|
1953
|
+
this.hasWaitedForInitialAuth = true;
|
|
1954
|
+
}
|
|
1947
1955
|
if (this.streamIsReady) {
|
|
1948
1956
|
const prepared = this.prepareMessage(requestBody);
|
|
1949
1957
|
return this.sendMessage(prepared);
|