@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.esm2017.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { _isFirebaseServerApp, _getProvider, getApp, SDK_VERSION as SDK_VERSION$1, _registerComponent, registerVersion } from '@firebase/app';
|
|
2
2
|
import { Component, ComponentContainer, Provider } from '@firebase/component';
|
|
3
|
-
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, createMockUserToken } from '@firebase/util';
|
|
3
|
+
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';
|
|
4
4
|
import { Logger, LogLevel } from '@firebase/logger';
|
|
5
5
|
|
|
6
6
|
const name = "@firebase/database";
|
|
7
|
-
const version = "1.0.
|
|
7
|
+
const version = "1.0.13-20250226000544";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @license
|
|
@@ -938,7 +938,7 @@ class RepoInfo {
|
|
|
938
938
|
* @param nodeAdmin - Whether this instance uses Admin SDK credentials
|
|
939
939
|
* @param persistenceKey - Override the default session persistence storage key
|
|
940
940
|
*/
|
|
941
|
-
constructor(host, secure, namespace, webSocketOnly, nodeAdmin = false, persistenceKey = '', includeNamespaceInQueryParams = false, isUsingEmulator = false) {
|
|
941
|
+
constructor(host, secure, namespace, webSocketOnly, nodeAdmin = false, persistenceKey = '', includeNamespaceInQueryParams = false, isUsingEmulator = false, emulatorOptions = null) {
|
|
942
942
|
this.secure = secure;
|
|
943
943
|
this.namespace = namespace;
|
|
944
944
|
this.webSocketOnly = webSocketOnly;
|
|
@@ -946,6 +946,7 @@ class RepoInfo {
|
|
|
946
946
|
this.persistenceKey = persistenceKey;
|
|
947
947
|
this.includeNamespaceInQueryParams = includeNamespaceInQueryParams;
|
|
948
948
|
this.isUsingEmulator = isUsingEmulator;
|
|
949
|
+
this.emulatorOptions = emulatorOptions;
|
|
949
950
|
this._host = host.toLowerCase();
|
|
950
951
|
this._domain = this._host.substr(this._host.indexOf('.') + 1);
|
|
951
952
|
this.internalHost =
|
|
@@ -13486,10 +13487,10 @@ let useRestClient = false;
|
|
|
13486
13487
|
/**
|
|
13487
13488
|
* Update an existing `Repo` in place to point to a new host/port.
|
|
13488
13489
|
*/
|
|
13489
|
-
function repoManagerApplyEmulatorSettings(repo,
|
|
13490
|
-
repo.repoInfo_ = new RepoInfo(
|
|
13490
|
+
function repoManagerApplyEmulatorSettings(repo, hostAndPort, emulatorOptions, tokenProvider) {
|
|
13491
|
+
repo.repoInfo_ = new RepoInfo(hostAndPort,
|
|
13491
13492
|
/* secure= */ false, repo.repoInfo_.namespace, repo.repoInfo_.webSocketOnly, repo.repoInfo_.nodeAdmin, repo.repoInfo_.persistenceKey, repo.repoInfo_.includeNamespaceInQueryParams,
|
|
13492
|
-
/*isUsingEmulator=*/ true);
|
|
13493
|
+
/*isUsingEmulator=*/ true, emulatorOptions);
|
|
13493
13494
|
if (tokenProvider) {
|
|
13494
13495
|
repo.authTokenProvider_ = tokenProvider;
|
|
13495
13496
|
}
|
|
@@ -13674,10 +13675,17 @@ function getDatabase(app = getApp(), url) {
|
|
|
13674
13675
|
function connectDatabaseEmulator(db, host, port, options = {}) {
|
|
13675
13676
|
db = getModularInstance(db);
|
|
13676
13677
|
db._checkNotDeleted('useEmulator');
|
|
13678
|
+
const hostAndPort = `${host}:${port}`;
|
|
13679
|
+
const repo = db._repoInternal;
|
|
13677
13680
|
if (db._instanceStarted) {
|
|
13678
|
-
|
|
13681
|
+
// If the instance has already been started, then silenty fail if this function is called again
|
|
13682
|
+
// with the same parameters. If the parameters differ then assert.
|
|
13683
|
+
if (hostAndPort === db._repoInternal.repoInfo_.host &&
|
|
13684
|
+
deepEqual(options, repo.repoInfo_.emulatorOptions)) {
|
|
13685
|
+
return;
|
|
13686
|
+
}
|
|
13687
|
+
fatal('connectDatabaseEmulator() cannot initialize or alter the emulator configuration after the database instance has started.');
|
|
13679
13688
|
}
|
|
13680
|
-
const repo = db._repoInternal;
|
|
13681
13689
|
let tokenProvider = undefined;
|
|
13682
13690
|
if (repo.repoInfo_.nodeAdmin) {
|
|
13683
13691
|
if (options.mockUserToken) {
|
|
@@ -13692,7 +13700,7 @@ function connectDatabaseEmulator(db, host, port, options = {}) {
|
|
|
13692
13700
|
tokenProvider = new EmulatorTokenProvider(token);
|
|
13693
13701
|
}
|
|
13694
13702
|
// Modify the repo to apply emulator settings
|
|
13695
|
-
repoManagerApplyEmulatorSettings(repo,
|
|
13703
|
+
repoManagerApplyEmulatorSettings(repo, hostAndPort, options, tokenProvider);
|
|
13696
13704
|
}
|
|
13697
13705
|
/**
|
|
13698
13706
|
* Disconnects from the server (all Database operations will be completed
|