@firebase/database-compat 2.0.11-20250626140224 → 2.0.11-canary.2d720995d
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.esm2017.js → index.esm.js} +3 -4
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/index.standalone.js +44 -36
- package/dist/index.standalone.js.map +1 -1
- package/dist/node-esm/index.js +2 -3
- package/dist/node-esm/index.js.map +1 -1
- package/package.json +11 -11
- package/dist/index.esm2017.js.map +0 -1
package/dist/index.standalone.js
CHANGED
@@ -3713,11 +3713,11 @@ class PlatformLoggerServiceImpl {
|
|
3713
3713
|
*/
|
3714
3714
|
function isVersionServiceProvider(provider) {
|
3715
3715
|
const component = provider.getComponent();
|
3716
|
-
return
|
3716
|
+
return component?.type === "VERSION" /* ComponentType.VERSION */;
|
3717
3717
|
}
|
3718
3718
|
|
3719
3719
|
const name$q = "@firebase/app";
|
3720
|
-
const version$1 = "0.13.2-
|
3720
|
+
const version$1 = "0.13.2-canary.2d720995d";
|
3721
3721
|
|
3722
3722
|
/**
|
3723
3723
|
* @license
|
@@ -3788,7 +3788,7 @@ const name$2 = "@firebase/ai";
|
|
3788
3788
|
const name$1 = "@firebase/firestore-compat";
|
3789
3789
|
|
3790
3790
|
const name = "firebase";
|
3791
|
-
const version = "11.10.0-
|
3791
|
+
const version = "11.10.0-canary.2d720995d";
|
3792
3792
|
|
3793
3793
|
/**
|
3794
3794
|
* @license
|
@@ -4035,8 +4035,8 @@ const ERROR_FACTORY = new util.ErrorFactory('app', 'Firebase', ERRORS);
|
|
4035
4035
|
class FirebaseAppImpl {
|
4036
4036
|
constructor(options, config, container) {
|
4037
4037
|
this._isDeleted = false;
|
4038
|
-
this._options =
|
4039
|
-
this._config =
|
4038
|
+
this._options = { ...options };
|
4039
|
+
this._config = { ...config };
|
4040
4040
|
this._name = config.name;
|
4041
4041
|
this._automaticDataCollectionEnabled =
|
4042
4042
|
config.automaticDataCollectionEnabled;
|
@@ -4140,7 +4140,10 @@ class FirebaseServerAppImpl extends FirebaseAppImpl {
|
|
4140
4140
|
super(appImpl.options, config, container);
|
4141
4141
|
}
|
4142
4142
|
// Now construct the data for the FirebaseServerAppImpl.
|
4143
|
-
this._serverConfig =
|
4143
|
+
this._serverConfig = {
|
4144
|
+
automaticDataCollectionEnabled,
|
4145
|
+
...serverConfig
|
4146
|
+
};
|
4144
4147
|
// Ensure that the current time is within the `authIdtoken` window of validity.
|
4145
4148
|
if (this._serverConfig.authIdToken) {
|
4146
4149
|
validateTokenTTL(this._serverConfig.authIdToken, 'authIdToken');
|
@@ -4236,7 +4239,11 @@ function initializeApp(_options, rawConfig = {}) {
|
|
4236
4239
|
const name = rawConfig;
|
4237
4240
|
rawConfig = { name };
|
4238
4241
|
}
|
4239
|
-
const config =
|
4242
|
+
const config = {
|
4243
|
+
name: DEFAULT_ENTRY_NAME,
|
4244
|
+
automaticDataCollectionEnabled: true,
|
4245
|
+
...rawConfig
|
4246
|
+
};
|
4240
4247
|
const name = config.name;
|
4241
4248
|
if (typeof name !== 'string' || !name) {
|
4242
4249
|
throw ERROR_FACTORY.create("bad-app-name" /* AppError.BAD_APP_NAME */, {
|
@@ -4282,7 +4289,10 @@ function initializeServerApp(_options, _serverAppConfig) {
|
|
4282
4289
|
appOptions = _options;
|
4283
4290
|
}
|
4284
4291
|
// Build an app name based on a hash of the configuration options.
|
4285
|
-
const nameObj =
|
4292
|
+
const nameObj = {
|
4293
|
+
..._serverAppConfig,
|
4294
|
+
...appOptions
|
4295
|
+
};
|
4286
4296
|
// However, Do not mangle the name based on releaseOnDeref, since it will vary between the
|
4287
4297
|
// construction of FirebaseServerApp instances. For example, if the object is the request headers.
|
4288
4298
|
if (nameObj.releaseOnDeref !== undefined) {
|
@@ -4403,10 +4413,9 @@ async function deleteApp(app) {
|
|
4403
4413
|
* @public
|
4404
4414
|
*/
|
4405
4415
|
function registerVersion(libraryKeyOrName, version, variant) {
|
4406
|
-
var _a;
|
4407
4416
|
// TODO: We can use this check to whitelist strings when/if we set up
|
4408
4417
|
// a good whitelist system.
|
4409
|
-
let library =
|
4418
|
+
let library = PLATFORM_LOG_STRING[libraryKeyOrName] ?? libraryKeyOrName;
|
4410
4419
|
if (variant) {
|
4411
4420
|
library += `-${variant}`;
|
4412
4421
|
}
|
@@ -4522,7 +4531,7 @@ async function readHeartbeatsFromIndexedDB(app) {
|
|
4522
4531
|
}
|
4523
4532
|
else {
|
4524
4533
|
const idbGetError = ERROR_FACTORY.create("idb-get" /* AppError.IDB_GET */, {
|
4525
|
-
originalErrorMessage: e
|
4534
|
+
originalErrorMessage: e?.message
|
4526
4535
|
});
|
4527
4536
|
logger.warn(idbGetError.message);
|
4528
4537
|
}
|
@@ -4542,7 +4551,7 @@ async function writeHeartbeatsToIndexedDB(app, heartbeatObject) {
|
|
4542
4551
|
}
|
4543
4552
|
else {
|
4544
4553
|
const idbGetError = ERROR_FACTORY.create("idb-set" /* AppError.IDB_WRITE */, {
|
4545
|
-
originalErrorMessage: e
|
4554
|
+
originalErrorMessage: e?.message
|
4546
4555
|
});
|
4547
4556
|
logger.warn(idbGetError.message);
|
4548
4557
|
}
|
@@ -4598,7 +4607,6 @@ class HeartbeatServiceImpl {
|
|
4598
4607
|
* already logged, subsequent calls to this function in the same day will be ignored.
|
4599
4608
|
*/
|
4600
4609
|
async triggerHeartbeat() {
|
4601
|
-
var _a, _b;
|
4602
4610
|
try {
|
4603
4611
|
const platformLogger = this.container
|
4604
4612
|
.getProvider('platform-logger')
|
@@ -4607,10 +4615,10 @@ class HeartbeatServiceImpl {
|
|
4607
4615
|
// service, not the browser user agent.
|
4608
4616
|
const agent = platformLogger.getPlatformInfoString();
|
4609
4617
|
const date = getUTCDateString();
|
4610
|
-
if (
|
4618
|
+
if (this._heartbeatsCache?.heartbeats == null) {
|
4611
4619
|
this._heartbeatsCache = await this._heartbeatsCachePromise;
|
4612
4620
|
// If we failed to construct a heartbeats cache, then return immediately.
|
4613
|
-
if (
|
4621
|
+
if (this._heartbeatsCache?.heartbeats == null) {
|
4614
4622
|
return;
|
4615
4623
|
}
|
4616
4624
|
}
|
@@ -4644,13 +4652,12 @@ class HeartbeatServiceImpl {
|
|
4644
4652
|
* returns an empty string.
|
4645
4653
|
*/
|
4646
4654
|
async getHeartbeatsHeader() {
|
4647
|
-
var _a;
|
4648
4655
|
try {
|
4649
4656
|
if (this._heartbeatsCache === null) {
|
4650
4657
|
await this._heartbeatsCachePromise;
|
4651
4658
|
}
|
4652
4659
|
// If it's still null or the array is empty, there is no data to send.
|
4653
|
-
if (
|
4660
|
+
if (this._heartbeatsCache?.heartbeats == null ||
|
4654
4661
|
this._heartbeatsCache.heartbeats.length === 0) {
|
4655
4662
|
return '';
|
4656
4663
|
}
|
@@ -4751,7 +4758,7 @@ class HeartbeatStorageImpl {
|
|
4751
4758
|
}
|
4752
4759
|
else {
|
4753
4760
|
const idbHeartbeatObject = await readHeartbeatsFromIndexedDB(this.app);
|
4754
|
-
if (idbHeartbeatObject
|
4761
|
+
if (idbHeartbeatObject?.heartbeats) {
|
4755
4762
|
return idbHeartbeatObject;
|
4756
4763
|
}
|
4757
4764
|
else {
|
@@ -4761,7 +4768,6 @@ class HeartbeatStorageImpl {
|
|
4761
4768
|
}
|
4762
4769
|
// overwrite the storage with the provided heartbeats
|
4763
4770
|
async overwrite(heartbeatsObject) {
|
4764
|
-
var _a;
|
4765
4771
|
const canUseIndexedDB = await this._canUseIndexedDBPromise;
|
4766
4772
|
if (!canUseIndexedDB) {
|
4767
4773
|
return;
|
@@ -4769,14 +4775,14 @@ class HeartbeatStorageImpl {
|
|
4769
4775
|
else {
|
4770
4776
|
const existingHeartbeatsObject = await this.read();
|
4771
4777
|
return writeHeartbeatsToIndexedDB(this.app, {
|
4772
|
-
lastSentHeartbeatDate:
|
4778
|
+
lastSentHeartbeatDate: heartbeatsObject.lastSentHeartbeatDate ??
|
4779
|
+
existingHeartbeatsObject.lastSentHeartbeatDate,
|
4773
4780
|
heartbeats: heartbeatsObject.heartbeats
|
4774
4781
|
});
|
4775
4782
|
}
|
4776
4783
|
}
|
4777
4784
|
// add heartbeats
|
4778
4785
|
async add(heartbeatsObject) {
|
4779
|
-
var _a;
|
4780
4786
|
const canUseIndexedDB = await this._canUseIndexedDBPromise;
|
4781
4787
|
if (!canUseIndexedDB) {
|
4782
4788
|
return;
|
@@ -4784,7 +4790,8 @@ class HeartbeatStorageImpl {
|
|
4784
4790
|
else {
|
4785
4791
|
const existingHeartbeatsObject = await this.read();
|
4786
4792
|
return writeHeartbeatsToIndexedDB(this.app, {
|
4787
|
-
lastSentHeartbeatDate:
|
4793
|
+
lastSentHeartbeatDate: heartbeatsObject.lastSentHeartbeatDate ??
|
4794
|
+
existingHeartbeatsObject.lastSentHeartbeatDate,
|
4788
4795
|
heartbeats: [
|
4789
4796
|
...existingHeartbeatsObject.heartbeats,
|
4790
4797
|
...heartbeatsObject.heartbeats
|
@@ -4844,8 +4851,8 @@ function registerCoreComponents(variant) {
|
|
4844
4851
|
_registerComponent(new component.Component('heartbeat', container => new HeartbeatServiceImpl(container), "PRIVATE" /* ComponentType.PRIVATE */));
|
4845
4852
|
// Register `app` package.
|
4846
4853
|
registerVersion(name$q, version$1, variant);
|
4847
|
-
// BUILD_TARGET will be replaced by values like
|
4848
|
-
registerVersion(name$q, version$1, '
|
4854
|
+
// BUILD_TARGET will be replaced by values like esm, cjs, etc during the compilation
|
4855
|
+
registerVersion(name$q, version$1, 'cjs2020');
|
4849
4856
|
// Register platform SDK identifier (no version).
|
4850
4857
|
registerVersion('fire-js', '');
|
4851
4858
|
}
|
@@ -6171,9 +6178,9 @@ class AppCheckTokenProvider {
|
|
6171
6178
|
if (app._isFirebaseServerApp(app$1) && app$1.settings.appCheckToken) {
|
6172
6179
|
this.serverAppAppCheckToken = app$1.settings.appCheckToken;
|
6173
6180
|
}
|
6174
|
-
this.appCheck = appCheckProvider
|
6181
|
+
this.appCheck = appCheckProvider?.getImmediate({ optional: true });
|
6175
6182
|
if (!this.appCheck) {
|
6176
|
-
appCheckProvider
|
6183
|
+
appCheckProvider?.get().then(appCheck => (this.appCheck = appCheck));
|
6177
6184
|
}
|
6178
6185
|
}
|
6179
6186
|
getToken(forceRefresh) {
|
@@ -6202,8 +6209,9 @@ class AppCheckTokenProvider {
|
|
6202
6209
|
return this.appCheck.getToken(forceRefresh);
|
6203
6210
|
}
|
6204
6211
|
addTokenChangeListener(listener) {
|
6205
|
-
|
6206
|
-
|
6212
|
+
this.appCheckProvider
|
6213
|
+
?.get()
|
6214
|
+
.then(appCheck => appCheck.addTokenListener(listener));
|
6207
6215
|
}
|
6208
6216
|
notifyForInvalidToken() {
|
6209
6217
|
warn$1(`Provided AppCheck credentials for the app named "${this.appName}" ` +
|
@@ -7371,7 +7379,9 @@ class Connection {
|
|
7371
7379
|
if (MESSAGE_DATA in controlData) {
|
7372
7380
|
const payload = controlData[MESSAGE_DATA];
|
7373
7381
|
if (cmd === SERVER_HELLO) {
|
7374
|
-
const handshakePayload =
|
7382
|
+
const handshakePayload = {
|
7383
|
+
...payload
|
7384
|
+
};
|
7375
7385
|
if (this.repoInfo_.isUsingEmulator) {
|
7376
7386
|
// Upon connecting, the emulator will pass the hostname that it's aware of, but we prefer the user's set hostname via `connectDatabaseEmulator` over what the emulator passes.
|
7377
7387
|
handshakePayload.h = this.repoInfo_.host;
|
@@ -10187,9 +10197,9 @@ class IndexMap {
|
|
10187
10197
|
newIndex = fallbackObject;
|
10188
10198
|
}
|
10189
10199
|
const indexName = indexDefinition.toString();
|
10190
|
-
const newIndexSet =
|
10200
|
+
const newIndexSet = { ...this.indexSet_ };
|
10191
10201
|
newIndexSet[indexName] = indexDefinition;
|
10192
|
-
const newIndexes =
|
10202
|
+
const newIndexes = { ...this.indexes_ };
|
10193
10203
|
newIndexes[indexName] = newIndex;
|
10194
10204
|
return new IndexMap(newIndexes, newIndexSet);
|
10195
10205
|
}
|
@@ -11993,7 +12003,7 @@ class StatsListener {
|
|
11993
12003
|
}
|
11994
12004
|
get() {
|
11995
12005
|
const newStats = this.collection_.get();
|
11996
|
-
const delta =
|
12006
|
+
const delta = { ...newStats };
|
11997
12007
|
if (this.last_) {
|
11998
12008
|
each(this.last_, (stat, value) => {
|
11999
12009
|
delta[stat] = delta[stat] - value;
|
@@ -18744,13 +18754,12 @@ class TransactionResult$1 {
|
|
18744
18754
|
function runTransaction(ref,
|
18745
18755
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
18746
18756
|
transactionUpdate, options) {
|
18747
|
-
var _a;
|
18748
18757
|
ref = util.getModularInstance(ref);
|
18749
18758
|
validateWritablePath('Reference.transaction', ref._path);
|
18750
18759
|
if (ref.key === '.length' || ref.key === '.keys') {
|
18751
18760
|
throw ('Reference.transaction failed: ' + ref.key + ' is a read-only object.');
|
18752
18761
|
}
|
18753
|
-
const applyLocally =
|
18762
|
+
const applyLocally = options?.applyLocally ?? true;
|
18754
18763
|
const deferred = new util.Deferred();
|
18755
18764
|
const promiseComplete = (error, committed, node) => {
|
18756
18765
|
let dataSnapshot = null;
|
@@ -19234,7 +19243,6 @@ class Query {
|
|
19234
19243
|
this._delegate = _delegate;
|
19235
19244
|
}
|
19236
19245
|
on(eventType, callback, cancelCallbackOrContext, context) {
|
19237
|
-
var _a;
|
19238
19246
|
require$$2$3.validateArgCount('Query.on', 2, 4, arguments.length);
|
19239
19247
|
require$$2$3.validateCallback('Query.on', 'callback', callback, false);
|
19240
19248
|
const ret = Query.getCancelAndContextArgs_('Query.on', cancelCallbackOrContext, context);
|
@@ -19243,7 +19251,7 @@ class Query {
|
|
19243
19251
|
};
|
19244
19252
|
valueCallback.userCallback = callback;
|
19245
19253
|
valueCallback.context = ret.context;
|
19246
|
-
const cancelCallback =
|
19254
|
+
const cancelCallback = ret.cancel?.bind(ret.context);
|
19247
19255
|
switch (eventType) {
|
19248
19256
|
case 'value':
|
19249
19257
|
onValue_1(this._delegate, valueCallback, cancelCallback);
|