@firebase/database 1.0.14-auth-redirect-credentials.82faa0828 → 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.
@@ -1,5 +1,5 @@
1
1
  import Websocket from 'faye-websocket';
2
- import { stringify, jsonEval, contains, assert, isNodeSdk, stringToByteArray, Sha1, base64, deepCopy, base64Encode, isMobileCordova, stringLength, Deferred, safeGet, isAdmin, isValidFormat, isEmpty, isReactNative, assertionError, map, querystring, errorPrefix, getModularInstance, getDefaultEmulatorHostnameAndPort, deepEqual, createMockUserToken } from '@firebase/util';
2
+ import { stringify, jsonEval, contains, assert, isNodeSdk, stringToByteArray, Sha1, base64, deepCopy, base64Encode, isMobileCordova, stringLength, Deferred, safeGet, isAdmin, isValidFormat, isEmpty, isReactNative, assertionError, map, querystring, errorPrefix, getModularInstance, getDefaultEmulatorHostnameAndPort, deepEqual, createMockUserToken, isCloudWorkstation, pingServer } from '@firebase/util';
3
3
  import { Logger, LogLevel } from '@firebase/logger';
4
4
  import { _isFirebaseServerApp, _getProvider, getApp, SDK_VERSION as SDK_VERSION$1, _registerComponent, registerVersion } from '@firebase/app';
5
5
  import { Component, ComponentContainer, Provider } from '@firebase/component';
@@ -1252,7 +1252,7 @@ WebSocketConnection.responsesRequiredToBeHealthy = 2;
1252
1252
  WebSocketConnection.healthyTimeout = 30000;
1253
1253
 
1254
1254
  const name = "@firebase/database";
1255
- const version = "1.0.14-auth-redirect-credentials.82faa0828";
1255
+ const version = "1.0.14-canary.080a90dcc";
1256
1256
 
1257
1257
  /**
1258
1258
  * @license
@@ -13492,18 +13492,11 @@ let useRestClient = false;
13492
13492
  * Update an existing `Repo` in place to point to a new host/port.
13493
13493
  */
13494
13494
  function repoManagerApplyEmulatorSettings(repo, hostAndPort, emulatorOptions, tokenProvider) {
13495
- let ssl = false;
13496
- let host = hostAndPort;
13497
- if (/^https:\/\//.test(host)) {
13498
- ssl = true;
13499
- host = host.substring(8);
13500
- }
13501
- if (/^wss:\/\//.test(host)) {
13502
- ssl = true;
13503
- host = host.substring(6);
13504
- }
13505
- repo.repoInfo_ = new RepoInfo(host,
13506
- /* secure= */ ssl, repo.repoInfo_.namespace, repo.repoInfo_.webSocketOnly, repo.repoInfo_.nodeAdmin, repo.repoInfo_.persistenceKey, repo.repoInfo_.includeNamespaceInQueryParams,
13495
+ const portIndex = hostAndPort.lastIndexOf(':');
13496
+ const host = hostAndPort.substring(0, portIndex);
13497
+ const useSsl = isCloudWorkstation(host);
13498
+ repo.repoInfo_ = new RepoInfo(hostAndPort,
13499
+ /* secure= */ useSsl, repo.repoInfo_.namespace, repo.repoInfo_.webSocketOnly, repo.repoInfo_.nodeAdmin, repo.repoInfo_.persistenceKey, repo.repoInfo_.includeNamespaceInQueryParams,
13507
13500
  /*isUsingEmulator=*/ true, emulatorOptions);
13508
13501
  if (tokenProvider) {
13509
13502
  repo.authTokenProvider_ = tokenProvider;
@@ -13713,6 +13706,10 @@ function connectDatabaseEmulator(db, host, port, options = {}) {
13713
13706
  : createMockUserToken(options.mockUserToken, db.app.options.projectId);
13714
13707
  tokenProvider = new EmulatorTokenProvider(token);
13715
13708
  }
13709
+ // Workaround to get cookies in Firebase Studio
13710
+ if (isCloudWorkstation(host)) {
13711
+ void pingServer(host);
13712
+ }
13716
13713
  // Modify the repo to apply emulator settings
13717
13714
  repoManagerApplyEmulatorSettings(repo, hostAndPort, options, tokenProvider);
13718
13715
  }