@firebase/database 1.0.12-canary.4e6a5c670 → 1.0.12-canary.604133f8d
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 +7 -7
package/dist/index.node.cjs.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 =
|
|
@@ -1259,7 +1260,7 @@ WebSocketConnection.responsesRequiredToBeHealthy = 2;
|
|
|
1259
1260
|
WebSocketConnection.healthyTimeout = 30000;
|
|
1260
1261
|
|
|
1261
1262
|
const name = "@firebase/database";
|
|
1262
|
-
const version = "1.0.12-canary.
|
|
1263
|
+
const version = "1.0.12-canary.604133f8d";
|
|
1263
1264
|
|
|
1264
1265
|
/**
|
|
1265
1266
|
* @license
|
|
@@ -13498,10 +13499,10 @@ let useRestClient = false;
|
|
|
13498
13499
|
/**
|
|
13499
13500
|
* Update an existing `Repo` in place to point to a new host/port.
|
|
13500
13501
|
*/
|
|
13501
|
-
function repoManagerApplyEmulatorSettings(repo,
|
|
13502
|
-
repo.repoInfo_ = new RepoInfo(
|
|
13502
|
+
function repoManagerApplyEmulatorSettings(repo, hostAndPort, emulatorOptions, tokenProvider) {
|
|
13503
|
+
repo.repoInfo_ = new RepoInfo(hostAndPort,
|
|
13503
13504
|
/* secure= */ false, repo.repoInfo_.namespace, repo.repoInfo_.webSocketOnly, repo.repoInfo_.nodeAdmin, repo.repoInfo_.persistenceKey, repo.repoInfo_.includeNamespaceInQueryParams,
|
|
13504
|
-
/*isUsingEmulator=*/ true);
|
|
13505
|
+
/*isUsingEmulator=*/ true, emulatorOptions);
|
|
13505
13506
|
if (tokenProvider) {
|
|
13506
13507
|
repo.authTokenProvider_ = tokenProvider;
|
|
13507
13508
|
}
|
|
@@ -13686,10 +13687,17 @@ function getDatabase(app$1 = app.getApp(), url) {
|
|
|
13686
13687
|
function connectDatabaseEmulator(db, host, port, options = {}) {
|
|
13687
13688
|
db = util.getModularInstance(db);
|
|
13688
13689
|
db._checkNotDeleted('useEmulator');
|
|
13690
|
+
const hostAndPort = `${host}:${port}`;
|
|
13691
|
+
const repo = db._repoInternal;
|
|
13689
13692
|
if (db._instanceStarted) {
|
|
13690
|
-
|
|
13693
|
+
// If the instance has already been started, then silenty fail if this function is called again
|
|
13694
|
+
// with the same parameters. If the parameters differ then assert.
|
|
13695
|
+
if (hostAndPort === db._repoInternal.repoInfo_.host &&
|
|
13696
|
+
util.deepEqual(options, repo.repoInfo_.emulatorOptions)) {
|
|
13697
|
+
return;
|
|
13698
|
+
}
|
|
13699
|
+
fatal('connectDatabaseEmulator() cannot initialize or alter the emulator configuration after the database instance has started.');
|
|
13691
13700
|
}
|
|
13692
|
-
const repo = db._repoInternal;
|
|
13693
13701
|
let tokenProvider = undefined;
|
|
13694
13702
|
if (repo.repoInfo_.nodeAdmin) {
|
|
13695
13703
|
if (options.mockUserToken) {
|
|
@@ -13704,7 +13712,7 @@ function connectDatabaseEmulator(db, host, port, options = {}) {
|
|
|
13704
13712
|
tokenProvider = new EmulatorTokenProvider(token);
|
|
13705
13713
|
}
|
|
13706
13714
|
// Modify the repo to apply emulator settings
|
|
13707
|
-
repoManagerApplyEmulatorSettings(repo,
|
|
13715
|
+
repoManagerApplyEmulatorSettings(repo, hostAndPort, options, tokenProvider);
|
|
13708
13716
|
}
|
|
13709
13717
|
/**
|
|
13710
13718
|
* Disconnects from the server (all Database operations will be completed
|