@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/internal.d.ts
CHANGED
|
@@ -2269,22 +2269,6 @@ declare class Repo {
|
|
|
2269
2269
|
toString(): string;
|
|
2270
2270
|
}
|
|
2271
2271
|
|
|
2272
|
-
/**
|
|
2273
|
-
* @license
|
|
2274
|
-
* Copyright 2017 Google LLC
|
|
2275
|
-
*
|
|
2276
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2277
|
-
* you may not use this file except in compliance with the License.
|
|
2278
|
-
* You may obtain a copy of the License at
|
|
2279
|
-
*
|
|
2280
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2281
|
-
*
|
|
2282
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2283
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2284
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2285
|
-
* See the License for the specific language governing permissions and
|
|
2286
|
-
* limitations under the License.
|
|
2287
|
-
*/
|
|
2288
2272
|
/**
|
|
2289
2273
|
* A class that holds metadata about a Repo object
|
|
2290
2274
|
*/
|
|
@@ -2296,6 +2280,7 @@ declare class RepoInfo {
|
|
|
2296
2280
|
readonly persistenceKey: string;
|
|
2297
2281
|
readonly includeNamespaceInQueryParams: boolean;
|
|
2298
2282
|
readonly isUsingEmulator: boolean;
|
|
2283
|
+
readonly emulatorOptions: RepoInfoEmulatorOptions | null;
|
|
2299
2284
|
private _host;
|
|
2300
2285
|
private _domain;
|
|
2301
2286
|
internalHost: string;
|
|
@@ -2307,7 +2292,7 @@ declare class RepoInfo {
|
|
|
2307
2292
|
* @param nodeAdmin - Whether this instance uses Admin SDK credentials
|
|
2308
2293
|
* @param persistenceKey - Override the default session persistence storage key
|
|
2309
2294
|
*/
|
|
2310
|
-
constructor(host: string, secure: boolean, namespace: string, webSocketOnly: boolean, nodeAdmin?: boolean, persistenceKey?: string, includeNamespaceInQueryParams?: boolean, isUsingEmulator?: boolean);
|
|
2295
|
+
constructor(host: string, secure: boolean, namespace: string, webSocketOnly: boolean, nodeAdmin?: boolean, persistenceKey?: string, includeNamespaceInQueryParams?: boolean, isUsingEmulator?: boolean, emulatorOptions?: RepoInfoEmulatorOptions | null);
|
|
2311
2296
|
isCacheableHost(): boolean;
|
|
2312
2297
|
isCustomHost(): boolean;
|
|
2313
2298
|
get host(): string;
|
|
@@ -2316,6 +2301,10 @@ declare class RepoInfo {
|
|
|
2316
2301
|
toURLString(): string;
|
|
2317
2302
|
}
|
|
2318
2303
|
|
|
2304
|
+
declare interface RepoInfoEmulatorOptions {
|
|
2305
|
+
mockUserToken?: string | EmulatorMockTokenOptions;
|
|
2306
|
+
}
|
|
2307
|
+
|
|
2319
2308
|
/**
|
|
2320
2309
|
* This function should only ever be called to CREATE a new database instance.
|
|
2321
2310
|
* @internal
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Websocket from 'faye-websocket';
|
|
2
|
-
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';
|
|
2
|
+
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';
|
|
3
3
|
import { Logger, LogLevel } from '@firebase/logger';
|
|
4
4
|
import { _isFirebaseServerApp, _getProvider, getApp, SDK_VERSION as SDK_VERSION$1, _registerComponent, registerVersion } from '@firebase/app';
|
|
5
5
|
import { Component, ComponentContainer, Provider } from '@firebase/component';
|
|
@@ -721,7 +721,7 @@ class RepoInfo {
|
|
|
721
721
|
* @param nodeAdmin - Whether this instance uses Admin SDK credentials
|
|
722
722
|
* @param persistenceKey - Override the default session persistence storage key
|
|
723
723
|
*/
|
|
724
|
-
constructor(host, secure, namespace, webSocketOnly, nodeAdmin = false, persistenceKey = '', includeNamespaceInQueryParams = false, isUsingEmulator = false) {
|
|
724
|
+
constructor(host, secure, namespace, webSocketOnly, nodeAdmin = false, persistenceKey = '', includeNamespaceInQueryParams = false, isUsingEmulator = false, emulatorOptions = null) {
|
|
725
725
|
this.secure = secure;
|
|
726
726
|
this.namespace = namespace;
|
|
727
727
|
this.webSocketOnly = webSocketOnly;
|
|
@@ -729,6 +729,7 @@ class RepoInfo {
|
|
|
729
729
|
this.persistenceKey = persistenceKey;
|
|
730
730
|
this.includeNamespaceInQueryParams = includeNamespaceInQueryParams;
|
|
731
731
|
this.isUsingEmulator = isUsingEmulator;
|
|
732
|
+
this.emulatorOptions = emulatorOptions;
|
|
732
733
|
this._host = host.toLowerCase();
|
|
733
734
|
this._domain = this._host.substr(this._host.indexOf('.') + 1);
|
|
734
735
|
this.internalHost =
|
|
@@ -1251,7 +1252,7 @@ WebSocketConnection.responsesRequiredToBeHealthy = 2;
|
|
|
1251
1252
|
WebSocketConnection.healthyTimeout = 30000;
|
|
1252
1253
|
|
|
1253
1254
|
const name = "@firebase/database";
|
|
1254
|
-
const version = "1.0.
|
|
1255
|
+
const version = "1.0.13-20250226000544";
|
|
1255
1256
|
|
|
1256
1257
|
/**
|
|
1257
1258
|
* @license
|
|
@@ -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 = getApp(), url) {
|
|
|
13678
13679
|
function connectDatabaseEmulator(db, host, port, options = {}) {
|
|
13679
13680
|
db = 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
|
+
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
|