@firebase/database-compat 2.0.11-canary.2d720995d → 2.0.11-canary.f11b55294

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