@firebase/database 1.0.14 → 1.0.15-20250507150015

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.
@@ -13497,8 +13497,11 @@ let useRestClient = false;
13497
13497
  * Update an existing `Repo` in place to point to a new host/port.
13498
13498
  */
13499
13499
  function repoManagerApplyEmulatorSettings(repo, hostAndPort, emulatorOptions, tokenProvider) {
13500
+ const portIndex = hostAndPort.lastIndexOf(':');
13501
+ const host = hostAndPort.substring(0, portIndex);
13502
+ const useSsl = util.isCloudWorkstation(host);
13500
13503
  repo.repoInfo_ = new RepoInfo(hostAndPort,
13501
- /* secure= */ false, repo.repoInfo_.namespace, repo.repoInfo_.webSocketOnly, repo.repoInfo_.nodeAdmin, repo.repoInfo_.persistenceKey, repo.repoInfo_.includeNamespaceInQueryParams,
13504
+ /* secure= */ useSsl, repo.repoInfo_.namespace, repo.repoInfo_.webSocketOnly, repo.repoInfo_.nodeAdmin, repo.repoInfo_.persistenceKey, repo.repoInfo_.includeNamespaceInQueryParams,
13502
13505
  /*isUsingEmulator=*/ true, emulatorOptions);
13503
13506
  if (tokenProvider) {
13504
13507
  repo.authTokenProvider_ = tokenProvider;
@@ -13685,6 +13688,10 @@ function connectDatabaseEmulator(db, host, port, options = {}) {
13685
13688
  : util.createMockUserToken(options.mockUserToken, db.app.options.projectId);
13686
13689
  tokenProvider = new EmulatorTokenProvider(token);
13687
13690
  }
13691
+ // Workaround to get cookies in Firebase Studio
13692
+ if (util.isCloudWorkstation(host)) {
13693
+ void util.pingServer(host);
13694
+ }
13688
13695
  // Modify the repo to apply emulator settings
13689
13696
  repoManagerApplyEmulatorSettings(repo, hostAndPort, options, tokenProvider);
13690
13697
  }