@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.node.cjs.js
CHANGED
|
@@ -565,6 +565,8 @@ class AbstractDataConnectStreamTransport extends AbstractDataConnectTransport {
|
|
|
565
565
|
this.closeTimeout = null;
|
|
566
566
|
/** has the close timeout finished? */
|
|
567
567
|
this.closeTimeoutFinished = false;
|
|
568
|
+
/** Flag to ensure we wait for the initial auth state once per connection attempt. */
|
|
569
|
+
this.hasWaitedForInitialAuth = false;
|
|
568
570
|
/**
|
|
569
571
|
* Tracks if the next message to be sent is the first message of the stream.
|
|
570
572
|
*/
|
|
@@ -705,6 +707,7 @@ class AbstractDataConnectStreamTransport extends AbstractDataConnectTransport {
|
|
|
705
707
|
onConnectionReady() {
|
|
706
708
|
this.isFirstStreamMessage = true;
|
|
707
709
|
this.lastSentAuthToken = null;
|
|
710
|
+
this.hasWaitedForInitialAuth = false;
|
|
708
711
|
}
|
|
709
712
|
/**
|
|
710
713
|
* Attempt to close the connection. Will only close if there are no active requests preventing it
|
|
@@ -785,12 +788,12 @@ class AbstractDataConnectStreamTransport extends AbstractDataConnectTransport {
|
|
|
785
788
|
}
|
|
786
789
|
headers['X-Goog-Api-Client'] = getGoogApiClientValue$1(this._isUsingGen, this._callerSdkType);
|
|
787
790
|
if (this.shouldIncludeAuth && this._authToken) {
|
|
788
|
-
headers
|
|
791
|
+
headers['X-Firebase-Auth-Token'] = this._authToken;
|
|
789
792
|
this.lastSentAuthToken = this._authToken;
|
|
790
793
|
}
|
|
791
794
|
if (this.isFirstStreamMessage) {
|
|
792
795
|
if (this._appCheckToken) {
|
|
793
|
-
headers
|
|
796
|
+
headers['X-Firebase-App-Check'] = this._appCheckToken;
|
|
794
797
|
}
|
|
795
798
|
preparedRequestBody.name = this._connectorResourcePath;
|
|
796
799
|
}
|
|
@@ -798,12 +801,17 @@ class AbstractDataConnectStreamTransport extends AbstractDataConnectTransport {
|
|
|
798
801
|
this.isFirstStreamMessage = false;
|
|
799
802
|
return preparedRequestBody;
|
|
800
803
|
}
|
|
804
|
+
// TODO(stephenarosaj): just make this async
|
|
801
805
|
/**
|
|
802
806
|
* Sends a request message to the server via the concrete implementation.
|
|
803
807
|
* Ensures the connection is ready and prepares the message before sending.
|
|
804
808
|
* @returns A promise that resolves when the request message has been sent.
|
|
805
809
|
*/
|
|
806
|
-
sendRequestMessage(requestBody) {
|
|
810
|
+
async sendRequestMessage(requestBody) {
|
|
811
|
+
if (!this.hasWaitedForInitialAuth && this.authProvider) {
|
|
812
|
+
await this.getWithAuth();
|
|
813
|
+
this.hasWaitedForInitialAuth = true;
|
|
814
|
+
}
|
|
807
815
|
if (this.streamIsReady) {
|
|
808
816
|
const prepared = this.prepareMessage(requestBody);
|
|
809
817
|
return this.sendMessage(prepared);
|
|
@@ -1262,7 +1270,7 @@ class WebSocketTransport extends AbstractDataConnectStreamTransport {
|
|
|
1262
1270
|
}
|
|
1263
1271
|
|
|
1264
1272
|
const name = "@firebase/data-connect";
|
|
1265
|
-
const version = "0.6.0
|
|
1273
|
+
const version = "0.6.0";
|
|
1266
1274
|
|
|
1267
1275
|
/**
|
|
1268
1276
|
* @license
|