@firebase/database 1.0.12 → 1.0.13-20250226000544
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.standalone.js
CHANGED
|
@@ -729,7 +729,7 @@ class RepoInfo {
|
|
|
729
729
|
* @param nodeAdmin - Whether this instance uses Admin SDK credentials
|
|
730
730
|
* @param persistenceKey - Override the default session persistence storage key
|
|
731
731
|
*/
|
|
732
|
-
constructor(host, secure, namespace, webSocketOnly, nodeAdmin = false, persistenceKey = '', includeNamespaceInQueryParams = false, isUsingEmulator = false) {
|
|
732
|
+
constructor(host, secure, namespace, webSocketOnly, nodeAdmin = false, persistenceKey = '', includeNamespaceInQueryParams = false, isUsingEmulator = false, emulatorOptions = null) {
|
|
733
733
|
this.secure = secure;
|
|
734
734
|
this.namespace = namespace;
|
|
735
735
|
this.webSocketOnly = webSocketOnly;
|
|
@@ -737,6 +737,7 @@ class RepoInfo {
|
|
|
737
737
|
this.persistenceKey = persistenceKey;
|
|
738
738
|
this.includeNamespaceInQueryParams = includeNamespaceInQueryParams;
|
|
739
739
|
this.isUsingEmulator = isUsingEmulator;
|
|
740
|
+
this.emulatorOptions = emulatorOptions;
|
|
740
741
|
this._host = host.toLowerCase();
|
|
741
742
|
this._domain = this._host.substr(this._host.indexOf('.') + 1);
|
|
742
743
|
this.internalHost =
|
|
@@ -13495,10 +13496,10 @@ let useRestClient = false;
|
|
|
13495
13496
|
/**
|
|
13496
13497
|
* Update an existing `Repo` in place to point to a new host/port.
|
|
13497
13498
|
*/
|
|
13498
|
-
function repoManagerApplyEmulatorSettings(repo,
|
|
13499
|
-
repo.repoInfo_ = new RepoInfo(
|
|
13499
|
+
function repoManagerApplyEmulatorSettings(repo, hostAndPort, emulatorOptions, tokenProvider) {
|
|
13500
|
+
repo.repoInfo_ = new RepoInfo(hostAndPort,
|
|
13500
13501
|
/* secure= */ false, repo.repoInfo_.namespace, repo.repoInfo_.webSocketOnly, repo.repoInfo_.nodeAdmin, repo.repoInfo_.persistenceKey, repo.repoInfo_.includeNamespaceInQueryParams,
|
|
13501
|
-
/*isUsingEmulator=*/ true);
|
|
13502
|
+
/*isUsingEmulator=*/ true, emulatorOptions);
|
|
13502
13503
|
if (tokenProvider) {
|
|
13503
13504
|
repo.authTokenProvider_ = tokenProvider;
|
|
13504
13505
|
}
|
|
@@ -13660,10 +13661,17 @@ function forceLongPolling() {
|
|
|
13660
13661
|
function connectDatabaseEmulator(db, host, port, options = {}) {
|
|
13661
13662
|
db = util.getModularInstance(db);
|
|
13662
13663
|
db._checkNotDeleted('useEmulator');
|
|
13664
|
+
const hostAndPort = `${host}:${port}`;
|
|
13665
|
+
const repo = db._repoInternal;
|
|
13663
13666
|
if (db._instanceStarted) {
|
|
13664
|
-
|
|
13667
|
+
// If the instance has already been started, then silenty fail if this function is called again
|
|
13668
|
+
// with the same parameters. If the parameters differ then assert.
|
|
13669
|
+
if (hostAndPort === db._repoInternal.repoInfo_.host &&
|
|
13670
|
+
util.deepEqual(options, repo.repoInfo_.emulatorOptions)) {
|
|
13671
|
+
return;
|
|
13672
|
+
}
|
|
13673
|
+
fatal('connectDatabaseEmulator() cannot initialize or alter the emulator configuration after the database instance has started.');
|
|
13665
13674
|
}
|
|
13666
|
-
const repo = db._repoInternal;
|
|
13667
13675
|
let tokenProvider = undefined;
|
|
13668
13676
|
if (repo.repoInfo_.nodeAdmin) {
|
|
13669
13677
|
if (options.mockUserToken) {
|
|
@@ -13678,7 +13686,7 @@ function connectDatabaseEmulator(db, host, port, options = {}) {
|
|
|
13678
13686
|
tokenProvider = new EmulatorTokenProvider(token);
|
|
13679
13687
|
}
|
|
13680
13688
|
// Modify the repo to apply emulator settings
|
|
13681
|
-
repoManagerApplyEmulatorSettings(repo,
|
|
13689
|
+
repoManagerApplyEmulatorSettings(repo, hostAndPort, options, tokenProvider);
|
|
13682
13690
|
}
|
|
13683
13691
|
/**
|
|
13684
13692
|
* Disconnects from the server (all Database operations will be completed
|