@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.
@@ -5,7 +5,7 @@ import { __spreadArray, __read, __values, __extends, __awaiter, __generator, __a
5
5
  import { Logger, LogLevel } from '@firebase/logger';
6
6
 
7
7
  var name = "@firebase/database";
8
- var version = "0.13.0-20220505222723";
8
+ var version = "0.13.0-canary.094da9eed";
9
9
 
10
10
  /**
11
11
  * @license
@@ -1873,7 +1873,7 @@ var WebSocketConnection = /** @class */ (function () {
1873
1873
  this.bytesReceived = 0;
1874
1874
  this.log_ = logWrapper(this.connId);
1875
1875
  this.stats_ = statsManagerGetCollection(repoInfo);
1876
- this.connURL = WebSocketConnection.connectionURL_(repoInfo, transportSessionId, lastSessionId, appCheckToken);
1876
+ this.connURL = WebSocketConnection.connectionURL_(repoInfo, transportSessionId, lastSessionId, appCheckToken, applicationId);
1877
1877
  this.nodeAdmin = repoInfo.nodeAdmin;
1878
1878
  }
1879
1879
  /**
@@ -1883,7 +1883,7 @@ var WebSocketConnection = /** @class */ (function () {
1883
1883
  * @param lastSessionId - Optional lastSessionId if there was a previous connection
1884
1884
  * @returns connection url
1885
1885
  */
1886
- WebSocketConnection.connectionURL_ = function (repoInfo, transportSessionId, lastSessionId, appCheckToken) {
1886
+ WebSocketConnection.connectionURL_ = function (repoInfo, transportSessionId, lastSessionId, appCheckToken, applicationId) {
1887
1887
  var urlParams = {};
1888
1888
  urlParams[VERSION_PARAM] = PROTOCOL_VERSION;
1889
1889
  if (!isNodeSdk() &&
@@ -1901,6 +1901,9 @@ var WebSocketConnection = /** @class */ (function () {
1901
1901
  if (appCheckToken) {
1902
1902
  urlParams[APP_CHECK_TOKEN_PARAM] = appCheckToken;
1903
1903
  }
1904
+ if (applicationId) {
1905
+ urlParams[APPLICATION_ID_PARAM] = applicationId;
1906
+ }
1904
1907
  return repoInfoConnectionURL(repoInfo, WEBSOCKET, urlParams);
1905
1908
  };
1906
1909
  /**
@@ -1916,10 +1919,11 @@ var WebSocketConnection = /** @class */ (function () {
1916
1919
  // Assume failure until proven otherwise.
1917
1920
  PersistentStorage.set('previous_websocket_failure', true);
1918
1921
  try {
1922
+ var options = void 0;
1919
1923
  if (isNodeSdk()) {
1920
1924
  var device = this.nodeAdmin ? 'AdminNode' : 'Node';
1921
1925
  // UA Format: Firebase/<wire_protocol>/<sdk_version>/<platform>/<device>
1922
- var options = {
1926
+ var options_1 = {
1923
1927
  headers: {
1924
1928
  'User-Agent': "Firebase/" + PROTOCOL_VERSION + "/" + SDK_VERSION + "/" + process.platform + "/" + device,
1925
1929
  'X-Firebase-GMPID': this.applicationId || ''
@@ -1931,10 +1935,10 @@ var WebSocketConnection = /** @class */ (function () {
1931
1935
  // Note that this header is just used to bypass appcheck, and the token should still be sent
1932
1936
  // through the websocket connection once it is established.
1933
1937
  if (this.authToken) {
1934
- options.headers['Authorization'] = "Bearer " + this.authToken;
1938
+ options_1.headers['Authorization'] = "Bearer " + this.authToken;
1935
1939
  }
1936
1940
  if (this.appCheckToken) {
1937
- options.headers['X-Firebase-AppCheck'] = this.appCheckToken;
1941
+ options_1.headers['X-Firebase-AppCheck'] = this.appCheckToken;
1938
1942
  }
1939
1943
  // Plumb appropriate http_proxy environment variable into faye-websocket if it exists.
1940
1944
  var env = process['env'];
@@ -1942,19 +1946,10 @@ var WebSocketConnection = /** @class */ (function () {
1942
1946
  ? env['HTTPS_PROXY'] || env['https_proxy']
1943
1947
  : env['HTTP_PROXY'] || env['http_proxy'];
1944
1948
  if (proxy) {
1945
- options['proxy'] = { origin: proxy };
1949
+ options_1['proxy'] = { origin: proxy };
1946
1950
  }
1947
- this.mySock = new WebSocketImpl(this.connURL, [], options);
1948
- }
1949
- else {
1950
- var options = {
1951
- headers: {
1952
- 'X-Firebase-GMPID': this.applicationId || '',
1953
- 'X-Firebase-AppCheck': this.appCheckToken || ''
1954
- }
1955
- };
1956
- this.mySock = new WebSocketImpl(this.connURL, [], options);
1957
1951
  }
1952
+ this.mySock = new WebSocketImpl(this.connURL, [], options);
1958
1953
  }
1959
1954
  catch (e) {
1960
1955
  this.log_('Error instantiating WebSocket.');