@firebase/database 0.13.0-20220505222723 → 0.13.0-canary.094da9eed

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.
@@ -989,7 +989,7 @@ var WebSocketConnection = /** @class */ (function () {
989
989
  this.bytesReceived = 0;
990
990
  this.log_ = logWrapper(this.connId);
991
991
  this.stats_ = statsManagerGetCollection(repoInfo);
992
- this.connURL = WebSocketConnection.connectionURL_(repoInfo, transportSessionId, lastSessionId, appCheckToken);
992
+ this.connURL = WebSocketConnection.connectionURL_(repoInfo, transportSessionId, lastSessionId, appCheckToken, applicationId);
993
993
  this.nodeAdmin = repoInfo.nodeAdmin;
994
994
  }
995
995
  /**
@@ -999,7 +999,7 @@ var WebSocketConnection = /** @class */ (function () {
999
999
  * @param lastSessionId - Optional lastSessionId if there was a previous connection
1000
1000
  * @returns connection url
1001
1001
  */
1002
- WebSocketConnection.connectionURL_ = function (repoInfo, transportSessionId, lastSessionId, appCheckToken) {
1002
+ WebSocketConnection.connectionURL_ = function (repoInfo, transportSessionId, lastSessionId, appCheckToken, applicationId) {
1003
1003
  var urlParams = {};
1004
1004
  urlParams[VERSION_PARAM] = PROTOCOL_VERSION;
1005
1005
  if (!util.isNodeSdk() &&
@@ -1017,6 +1017,9 @@ var WebSocketConnection = /** @class */ (function () {
1017
1017
  if (appCheckToken) {
1018
1018
  urlParams[APP_CHECK_TOKEN_PARAM] = appCheckToken;
1019
1019
  }
1020
+ if (applicationId) {
1021
+ urlParams[APPLICATION_ID_PARAM] = applicationId;
1022
+ }
1020
1023
  return repoInfoConnectionURL(repoInfo, WEBSOCKET, urlParams);
1021
1024
  };
1022
1025
  /**
@@ -1032,10 +1035,11 @@ var WebSocketConnection = /** @class */ (function () {
1032
1035
  // Assume failure until proven otherwise.
1033
1036
  PersistentStorage.set('previous_websocket_failure', true);
1034
1037
  try {
1038
+ var options = void 0;
1035
1039
  if (util.isNodeSdk()) {
1036
1040
  var device = this.nodeAdmin ? 'AdminNode' : 'Node';
1037
1041
  // UA Format: Firebase/<wire_protocol>/<sdk_version>/<platform>/<device>
1038
- var options = {
1042
+ var options_1 = {
1039
1043
  headers: {
1040
1044
  'User-Agent': "Firebase/" + PROTOCOL_VERSION + "/" + SDK_VERSION + "/" + process.platform + "/" + device,
1041
1045
  'X-Firebase-GMPID': this.applicationId || ''
@@ -1047,10 +1051,10 @@ var WebSocketConnection = /** @class */ (function () {
1047
1051
  // Note that this header is just used to bypass appcheck, and the token should still be sent
1048
1052
  // through the websocket connection once it is established.
1049
1053
  if (this.authToken) {
1050
- options.headers['Authorization'] = "Bearer " + this.authToken;
1054
+ options_1.headers['Authorization'] = "Bearer " + this.authToken;
1051
1055
  }
1052
1056
  if (this.appCheckToken) {
1053
- options.headers['X-Firebase-AppCheck'] = this.appCheckToken;
1057
+ options_1.headers['X-Firebase-AppCheck'] = this.appCheckToken;
1054
1058
  }
1055
1059
  // Plumb appropriate http_proxy environment variable into faye-websocket if it exists.
1056
1060
  var env = process['env'];
@@ -1058,19 +1062,10 @@ var WebSocketConnection = /** @class */ (function () {
1058
1062
  ? env['HTTPS_PROXY'] || env['https_proxy']
1059
1063
  : env['HTTP_PROXY'] || env['http_proxy'];
1060
1064
  if (proxy) {
1061
- options['proxy'] = { origin: proxy };
1065
+ options_1['proxy'] = { origin: proxy };
1062
1066
  }
1063
- this.mySock = new WebSocketImpl(this.connURL, [], options);
1064
- }
1065
- else {
1066
- var options = {
1067
- headers: {
1068
- 'X-Firebase-GMPID': this.applicationId || '',
1069
- 'X-Firebase-AppCheck': this.appCheckToken || ''
1070
- }
1071
- };
1072
- this.mySock = new WebSocketImpl(this.connURL, [], options);
1073
1067
  }
1068
+ this.mySock = new WebSocketImpl(this.connURL, [], options);
1074
1069
  }
1075
1070
  catch (e) {
1076
1071
  this.log_('Error instantiating WebSocket.');
@@ -1294,7 +1289,7 @@ var WebSocketConnection = /** @class */ (function () {
1294
1289
  }());
1295
1290
 
1296
1291
  var name = "@firebase/database";
1297
- var version = "0.13.0-20220505222723";
1292
+ var version = "0.13.0-canary.094da9eed";
1298
1293
 
1299
1294
  /**
1300
1295
  * @license