@firebase/database 1.0.12 → 1.0.13-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.
- package/dist/index.cjs.js +16 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +17 -9
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.node.cjs.js +16 -8
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.standalone.js +15 -7
- package/dist/index.standalone.js.map +1 -1
- package/dist/internal.d.ts +6 -17
- package/dist/node-esm/index.node.esm.js +17 -9
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/core/RepoInfo.d.ts +6 -1
- package/dist/node-esm/test/helpers/util.d.ts +2 -0
- package/dist/private.d.ts +6 -17
- package/dist/src/core/RepoInfo.d.ts +6 -1
- package/dist/test/helpers/util.d.ts +2 -0
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -8,7 +8,7 @@ var util = require('@firebase/util');
|
|
|
8
8
|
var logger$1 = require('@firebase/logger');
|
|
9
9
|
|
|
10
10
|
const name = "@firebase/database";
|
|
11
|
-
const version = "1.0.
|
|
11
|
+
const version = "1.0.13-20250214170153";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
|
@@ -942,7 +942,7 @@ class RepoInfo {
|
|
|
942
942
|
* @param nodeAdmin - Whether this instance uses Admin SDK credentials
|
|
943
943
|
* @param persistenceKey - Override the default session persistence storage key
|
|
944
944
|
*/
|
|
945
|
-
constructor(host, secure, namespace, webSocketOnly, nodeAdmin = false, persistenceKey = '', includeNamespaceInQueryParams = false, isUsingEmulator = false) {
|
|
945
|
+
constructor(host, secure, namespace, webSocketOnly, nodeAdmin = false, persistenceKey = '', includeNamespaceInQueryParams = false, isUsingEmulator = false, emulatorOptions = null) {
|
|
946
946
|
this.secure = secure;
|
|
947
947
|
this.namespace = namespace;
|
|
948
948
|
this.webSocketOnly = webSocketOnly;
|
|
@@ -950,6 +950,7 @@ class RepoInfo {
|
|
|
950
950
|
this.persistenceKey = persistenceKey;
|
|
951
951
|
this.includeNamespaceInQueryParams = includeNamespaceInQueryParams;
|
|
952
952
|
this.isUsingEmulator = isUsingEmulator;
|
|
953
|
+
this.emulatorOptions = emulatorOptions;
|
|
953
954
|
this._host = host.toLowerCase();
|
|
954
955
|
this._domain = this._host.substr(this._host.indexOf('.') + 1);
|
|
955
956
|
this.internalHost =
|
|
@@ -13490,10 +13491,10 @@ let useRestClient = false;
|
|
|
13490
13491
|
/**
|
|
13491
13492
|
* Update an existing `Repo` in place to point to a new host/port.
|
|
13492
13493
|
*/
|
|
13493
|
-
function repoManagerApplyEmulatorSettings(repo,
|
|
13494
|
-
repo.repoInfo_ = new RepoInfo(
|
|
13494
|
+
function repoManagerApplyEmulatorSettings(repo, hostAndPort, emulatorOptions, tokenProvider) {
|
|
13495
|
+
repo.repoInfo_ = new RepoInfo(hostAndPort,
|
|
13495
13496
|
/* secure= */ false, repo.repoInfo_.namespace, repo.repoInfo_.webSocketOnly, repo.repoInfo_.nodeAdmin, repo.repoInfo_.persistenceKey, repo.repoInfo_.includeNamespaceInQueryParams,
|
|
13496
|
-
/*isUsingEmulator=*/ true);
|
|
13497
|
+
/*isUsingEmulator=*/ true, emulatorOptions);
|
|
13497
13498
|
if (tokenProvider) {
|
|
13498
13499
|
repo.authTokenProvider_ = tokenProvider;
|
|
13499
13500
|
}
|
|
@@ -13678,10 +13679,17 @@ function getDatabase(app$1 = app.getApp(), url) {
|
|
|
13678
13679
|
function connectDatabaseEmulator(db, host, port, options = {}) {
|
|
13679
13680
|
db = util.getModularInstance(db);
|
|
13680
13681
|
db._checkNotDeleted('useEmulator');
|
|
13682
|
+
const hostAndPort = `${host}:${port}`;
|
|
13683
|
+
const repo = db._repoInternal;
|
|
13681
13684
|
if (db._instanceStarted) {
|
|
13682
|
-
|
|
13685
|
+
// If the instance has already been started, then silenty fail if this function is called again
|
|
13686
|
+
// with the same parameters. If the parameters differ then assert.
|
|
13687
|
+
if (hostAndPort === db._repoInternal.repoInfo_.host &&
|
|
13688
|
+
util.deepEqual(options, repo.repoInfo_.emulatorOptions)) {
|
|
13689
|
+
return;
|
|
13690
|
+
}
|
|
13691
|
+
fatal('connectDatabaseEmulator() cannot initialize or alter the emulator configuration after the database instance has started.');
|
|
13683
13692
|
}
|
|
13684
|
-
const repo = db._repoInternal;
|
|
13685
13693
|
let tokenProvider = undefined;
|
|
13686
13694
|
if (repo.repoInfo_.nodeAdmin) {
|
|
13687
13695
|
if (options.mockUserToken) {
|
|
@@ -13696,7 +13704,7 @@ function connectDatabaseEmulator(db, host, port, options = {}) {
|
|
|
13696
13704
|
tokenProvider = new EmulatorTokenProvider(token);
|
|
13697
13705
|
}
|
|
13698
13706
|
// Modify the repo to apply emulator settings
|
|
13699
|
-
repoManagerApplyEmulatorSettings(repo,
|
|
13707
|
+
repoManagerApplyEmulatorSettings(repo, hostAndPort, options, tokenProvider);
|
|
13700
13708
|
}
|
|
13701
13709
|
/**
|
|
13702
13710
|
* Disconnects from the server (all Database operations will be completed
|