@firebase/database-compat 2.0.3 → 2.0.4-20250214170153

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 { errorPrefix, validateArgCount, validateCallback, validateContextObject,
5
5
  import { Logger } from '@firebase/logger';
6
6
 
7
7
  const name = "@firebase/database-compat";
8
- const version = "2.0.3";
8
+ const version = "2.0.4-20250214170153";
9
9
 
10
10
  /**
11
11
  * @license
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
11
11
  var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
12
12
 
13
13
  const name = "@firebase/database-compat";
14
- const version = "2.0.3";
14
+ const version = "2.0.4-20250214170153";
15
15
 
16
16
  /**
17
17
  * @license
@@ -3717,7 +3717,7 @@ function isVersionServiceProvider(provider) {
3717
3717
  }
3718
3718
 
3719
3719
  const name$q = "@firebase/app";
3720
- const version$1 = "0.11.0";
3720
+ const version$1 = "0.11.1";
3721
3721
 
3722
3722
  /**
3723
3723
  * @license
@@ -3788,7 +3788,7 @@ const name$2 = "@firebase/vertexai";
3788
3788
  const name$1 = "@firebase/firestore-compat";
3789
3789
 
3790
3790
  const name = "firebase";
3791
- const version = "11.3.0";
3791
+ const version = "11.4.0-20250214170153";
3792
3792
 
3793
3793
  /**
3794
3794
  * @license
@@ -5615,7 +5615,7 @@ class RepoInfo {
5615
5615
  * @param nodeAdmin - Whether this instance uses Admin SDK credentials
5616
5616
  * @param persistenceKey - Override the default session persistence storage key
5617
5617
  */
5618
- constructor(host, secure, namespace, webSocketOnly, nodeAdmin = false, persistenceKey = '', includeNamespaceInQueryParams = false, isUsingEmulator = false) {
5618
+ constructor(host, secure, namespace, webSocketOnly, nodeAdmin = false, persistenceKey = '', includeNamespaceInQueryParams = false, isUsingEmulator = false, emulatorOptions = null) {
5619
5619
  this.secure = secure;
5620
5620
  this.namespace = namespace;
5621
5621
  this.webSocketOnly = webSocketOnly;
@@ -5623,6 +5623,7 @@ class RepoInfo {
5623
5623
  this.persistenceKey = persistenceKey;
5624
5624
  this.includeNamespaceInQueryParams = includeNamespaceInQueryParams;
5625
5625
  this.isUsingEmulator = isUsingEmulator;
5626
+ this.emulatorOptions = emulatorOptions;
5626
5627
  this._host = host.toLowerCase();
5627
5628
  this._domain = this._host.substr(this._host.indexOf('.') + 1);
5628
5629
  this.internalHost =
@@ -18381,10 +18382,10 @@ let useRestClient = false;
18381
18382
  /**
18382
18383
  * Update an existing `Repo` in place to point to a new host/port.
18383
18384
  */
18384
- function repoManagerApplyEmulatorSettings(repo, host, port, tokenProvider) {
18385
- repo.repoInfo_ = new RepoInfo(`${host}:${port}`,
18385
+ function repoManagerApplyEmulatorSettings(repo, hostAndPort, emulatorOptions, tokenProvider) {
18386
+ repo.repoInfo_ = new RepoInfo(hostAndPort,
18386
18387
  /* secure= */ false, repo.repoInfo_.namespace, repo.repoInfo_.webSocketOnly, repo.repoInfo_.nodeAdmin, repo.repoInfo_.persistenceKey, repo.repoInfo_.includeNamespaceInQueryParams,
18387
- /*isUsingEmulator=*/ true);
18388
+ /*isUsingEmulator=*/ true, emulatorOptions);
18388
18389
  if (tokenProvider) {
18389
18390
  repo.authTokenProvider_ = tokenProvider;
18390
18391
  }
@@ -18546,10 +18547,17 @@ function forceLongPolling() {
18546
18547
  function connectDatabaseEmulator(db, host, port, options = {}) {
18547
18548
  db = util.getModularInstance(db);
18548
18549
  db._checkNotDeleted('useEmulator');
18550
+ const hostAndPort = `${host}:${port}`;
18551
+ const repo = db._repoInternal;
18549
18552
  if (db._instanceStarted) {
18550
- fatal('Cannot call useEmulator() after instance has already been initialized.');
18553
+ // If the instance has already been started, then silenty fail if this function is called again
18554
+ // with the same parameters. If the parameters differ then assert.
18555
+ if (hostAndPort === db._repoInternal.repoInfo_.host &&
18556
+ util.deepEqual(options, repo.repoInfo_.emulatorOptions)) {
18557
+ return;
18558
+ }
18559
+ fatal('connectDatabaseEmulator() cannot initialize or alter the emulator configuration after the database instance has started.');
18551
18560
  }
18552
- const repo = db._repoInternal;
18553
18561
  let tokenProvider = undefined;
18554
18562
  if (repo.repoInfo_.nodeAdmin) {
18555
18563
  if (options.mockUserToken) {
@@ -18564,7 +18572,7 @@ function connectDatabaseEmulator(db, host, port, options = {}) {
18564
18572
  tokenProvider = new EmulatorTokenProvider(token);
18565
18573
  }
18566
18574
  // Modify the repo to apply emulator settings
18567
- repoManagerApplyEmulatorSettings(repo, host, port, tokenProvider);
18575
+ repoManagerApplyEmulatorSettings(repo, hostAndPort, options, tokenProvider);
18568
18576
  }
18569
18577
  /**
18570
18578
  * Disconnects from the server (all Database operations will be completed