@firebase/database 1.0.14-auth-redirect-credentials.b424e5897 → 1.0.14-canary.080a90dcc

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,18 +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
- let ssl = false;
13501
- let host = hostAndPort;
13502
- if (/^https:\/\//.test(host)) {
13503
- ssl = true;
13504
- host = host.substring(8);
13505
- }
13506
- if (/^wss:\/\//.test(host)) {
13507
- ssl = true;
13508
- host = host.substring(6);
13509
- }
13510
- repo.repoInfo_ = new RepoInfo(host,
13511
- /* secure= */ ssl, repo.repoInfo_.namespace, repo.repoInfo_.webSocketOnly, repo.repoInfo_.nodeAdmin, repo.repoInfo_.persistenceKey, repo.repoInfo_.includeNamespaceInQueryParams,
13500
+ const portIndex = hostAndPort.lastIndexOf(':');
13501
+ const host = hostAndPort.substring(0, portIndex);
13502
+ const useSsl = util.isCloudWorkstation(host);
13503
+ repo.repoInfo_ = new RepoInfo(hostAndPort,
13504
+ /* secure= */ useSsl, repo.repoInfo_.namespace, repo.repoInfo_.webSocketOnly, repo.repoInfo_.nodeAdmin, repo.repoInfo_.persistenceKey, repo.repoInfo_.includeNamespaceInQueryParams,
13512
13505
  /*isUsingEmulator=*/ true, emulatorOptions);
13513
13506
  if (tokenProvider) {
13514
13507
  repo.authTokenProvider_ = tokenProvider;
@@ -13695,6 +13688,10 @@ function connectDatabaseEmulator(db, host, port, options = {}) {
13695
13688
  : util.createMockUserToken(options.mockUserToken, db.app.options.projectId);
13696
13689
  tokenProvider = new EmulatorTokenProvider(token);
13697
13690
  }
13691
+ // Workaround to get cookies in Firebase Studio
13692
+ if (util.isCloudWorkstation(host)) {
13693
+ void util.pingServer(host);
13694
+ }
13698
13695
  // Modify the repo to apply emulator settings
13699
13696
  repoManagerApplyEmulatorSettings(repo, hostAndPort, options, tokenProvider);
13700
13697
  }