@firebase/database 0.14.1 → 0.14.2-20230131204242

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.
@@ -756,16 +756,18 @@ var RepoInfo = /** @class */ (function () {
756
756
  * @param nodeAdmin - Whether this instance uses Admin SDK credentials
757
757
  * @param persistenceKey - Override the default session persistence storage key
758
758
  */
759
- function RepoInfo(host, secure, namespace, webSocketOnly, nodeAdmin, persistenceKey, includeNamespaceInQueryParams) {
759
+ function RepoInfo(host, secure, namespace, webSocketOnly, nodeAdmin, persistenceKey, includeNamespaceInQueryParams, isUsingEmulator) {
760
760
  if (nodeAdmin === void 0) { nodeAdmin = false; }
761
761
  if (persistenceKey === void 0) { persistenceKey = ''; }
762
762
  if (includeNamespaceInQueryParams === void 0) { includeNamespaceInQueryParams = false; }
763
+ if (isUsingEmulator === void 0) { isUsingEmulator = false; }
763
764
  this.secure = secure;
764
765
  this.namespace = namespace;
765
766
  this.webSocketOnly = webSocketOnly;
766
767
  this.nodeAdmin = nodeAdmin;
767
768
  this.persistenceKey = persistenceKey;
768
769
  this.includeNamespaceInQueryParams = includeNamespaceInQueryParams;
770
+ this.isUsingEmulator = isUsingEmulator;
769
771
  this._host = host.toLowerCase();
770
772
  this._domain = this._host.substr(this._host.indexOf('.') + 1);
771
773
  this.internalHost =
@@ -1298,7 +1300,7 @@ var WebSocketConnection = /** @class */ (function () {
1298
1300
  }());
1299
1301
 
1300
1302
  var name = "@firebase/database";
1301
- var version = "0.14.1";
1303
+ var version = "0.14.2-20230131204242";
1302
1304
 
1303
1305
  /**
1304
1306
  * @license
@@ -2573,7 +2575,12 @@ var Connection = /** @class */ (function () {
2573
2575
  if (MESSAGE_DATA in controlData) {
2574
2576
  var payload = controlData[MESSAGE_DATA];
2575
2577
  if (cmd === SERVER_HELLO) {
2576
- this.onHandshake_(payload);
2578
+ var handshakePayload = tslib.__assign({}, payload);
2579
+ if (this.repoInfo_.isUsingEmulator) {
2580
+ // Upon connecting, the emulator will pass the hostname that it's aware of, but we prefer the user's set hostname via `connectDatabaseEmulator` over what the emulator passes.
2581
+ handshakePayload.h = this.repoInfo_.host;
2582
+ }
2583
+ this.onHandshake_(handshakePayload);
2577
2584
  }
2578
2585
  else if (cmd === END_TRANSMISSION) {
2579
2586
  this.log_('recvd end transmission on primary');
@@ -13928,7 +13935,8 @@ var useRestClient = false;
13928
13935
  */
13929
13936
  function repoManagerApplyEmulatorSettings(repo, host, port, tokenProvider) {
13930
13937
  repo.repoInfo_ = new RepoInfo("".concat(host, ":").concat(port),
13931
- /* secure= */ false, repo.repoInfo_.namespace, repo.repoInfo_.webSocketOnly, repo.repoInfo_.nodeAdmin, repo.repoInfo_.persistenceKey, repo.repoInfo_.includeNamespaceInQueryParams);
13938
+ /* secure= */ false, repo.repoInfo_.namespace, repo.repoInfo_.webSocketOnly, repo.repoInfo_.nodeAdmin, repo.repoInfo_.persistenceKey, repo.repoInfo_.includeNamespaceInQueryParams,
13939
+ /*isUsingEmulator=*/ true);
13932
13940
  if (tokenProvider) {
13933
13941
  repo.authTokenProvider_ = tokenProvider;
13934
13942
  }