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

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.esm.js CHANGED
@@ -5,7 +5,7 @@ import { errorPrefix, validateArgCount, validateCallback, validateContextObject,
5
5
  import { Logger } from '@firebase/logger';
6
6
 
7
7
  const name = "@firebase/database-compat";
8
- const version = "2.0.11-canary.2d720995d";
8
+ const version = "2.0.11-canary.d91169f06";
9
9
 
10
10
  /**
11
11
  * @license
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
11
11
  var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
12
12
 
13
13
  const name = "@firebase/database-compat";
14
- const version = "2.0.11-canary.2d720995d";
14
+ const version = "2.0.11-canary.d91169f06";
15
15
 
16
16
  /**
17
17
  * @license
@@ -3717,7 +3717,7 @@ function isVersionServiceProvider(provider) {
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.d91169f06";
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.d91169f06";
3792
3792
 
3793
3793
  /**
3794
3794
  * @license
@@ -3948,7 +3948,7 @@ function _removeServiceInstance(app, name, instanceIdentifier = DEFAULT_ENTRY_NA
3948
3948
  }
3949
3949
  /**
3950
3950
  *
3951
- * @param obj - an object of type FirebaseApp or FirebaseOptions.
3951
+ * @param obj - an object of type FirebaseApp, FirebaseOptions or FirebaseAppSettings.
3952
3952
  *
3953
3953
  * @returns true if the provide object is of type FirebaseApp.
3954
3954
  *
@@ -3957,6 +3957,23 @@ function _removeServiceInstance(app, name, instanceIdentifier = DEFAULT_ENTRY_NA
3957
3957
  function _isFirebaseApp(obj) {
3958
3958
  return obj.options !== undefined;
3959
3959
  }
3960
+ /**
3961
+ *
3962
+ * @param obj - an object of type FirebaseApp, FirebaseOptions or FirebaseAppSettings.
3963
+ *
3964
+ * @returns true if the provided object is of type FirebaseServerAppImpl.
3965
+ *
3966
+ * @internal
3967
+ */
3968
+ function _isFirebaseServerAppSettings(obj) {
3969
+ if (_isFirebaseApp(obj)) {
3970
+ return false;
3971
+ }
3972
+ return ('authIdToken' in obj ||
3973
+ 'appCheckToken' in obj ||
3974
+ 'releaseOnDeref' in obj ||
3975
+ 'automaticDataCollectionEnabled' in obj);
3976
+ }
3960
3977
  /**
3961
3978
  *
3962
3979
  * @param obj - an object of type FirebaseApp.
@@ -4273,25 +4290,35 @@ function initializeApp(_options, rawConfig = {}) {
4273
4290
  _apps.set(name, newApp);
4274
4291
  return newApp;
4275
4292
  }
4276
- function initializeServerApp(_options, _serverAppConfig) {
4293
+ function initializeServerApp(_options, _serverAppConfig = {}) {
4277
4294
  if (util.isBrowser() && !util.isWebWorker()) {
4278
4295
  // FirebaseServerApp isn't designed to be run in browsers.
4279
4296
  throw ERROR_FACTORY.create("invalid-server-app-environment" /* AppError.INVALID_SERVER_APP_ENVIRONMENT */);
4280
4297
  }
4281
- if (_serverAppConfig.automaticDataCollectionEnabled === undefined) {
4282
- _serverAppConfig.automaticDataCollectionEnabled = true;
4298
+ let firebaseOptions;
4299
+ let serverAppSettings = _serverAppConfig || {};
4300
+ if (_options) {
4301
+ if (_isFirebaseApp(_options)) {
4302
+ firebaseOptions = _options.options;
4303
+ }
4304
+ else if (_isFirebaseServerAppSettings(_options)) {
4305
+ serverAppSettings = _options;
4306
+ }
4307
+ else {
4308
+ firebaseOptions = _options;
4309
+ }
4283
4310
  }
4284
- let appOptions;
4285
- if (_isFirebaseApp(_options)) {
4286
- appOptions = _options.options;
4311
+ if (serverAppSettings.automaticDataCollectionEnabled === undefined) {
4312
+ serverAppSettings.automaticDataCollectionEnabled = true;
4287
4313
  }
4288
- else {
4289
- appOptions = _options;
4314
+ firebaseOptions || (firebaseOptions = util.getDefaultAppConfig());
4315
+ if (!firebaseOptions) {
4316
+ throw ERROR_FACTORY.create("no-options" /* AppError.NO_OPTIONS */);
4290
4317
  }
4291
4318
  // Build an app name based on a hash of the configuration options.
4292
4319
  const nameObj = {
4293
- ..._serverAppConfig,
4294
- ...appOptions
4320
+ ...serverAppSettings,
4321
+ ...firebaseOptions
4295
4322
  };
4296
4323
  // However, Do not mangle the name based on releaseOnDeref, since it will vary between the
4297
4324
  // construction of FirebaseServerApp instances. For example, if the object is the request headers.
@@ -4301,7 +4328,7 @@ function initializeServerApp(_options, _serverAppConfig) {
4301
4328
  const hashCode = (s) => {
4302
4329
  return [...s].reduce((hash, c) => (Math.imul(31, hash) + c.charCodeAt(0)) | 0, 0);
4303
4330
  };
4304
- if (_serverAppConfig.releaseOnDeref !== undefined) {
4331
+ if (serverAppSettings.releaseOnDeref !== undefined) {
4305
4332
  if (typeof FinalizationRegistry === 'undefined') {
4306
4333
  throw ERROR_FACTORY.create("finalization-registry-not-supported" /* AppError.FINALIZATION_REGISTRY_NOT_SUPPORTED */, {});
4307
4334
  }
@@ -4309,14 +4336,14 @@ function initializeServerApp(_options, _serverAppConfig) {
4309
4336
  const nameString = '' + hashCode(JSON.stringify(nameObj));
4310
4337
  const existingApp = _serverApps.get(nameString);
4311
4338
  if (existingApp) {
4312
- existingApp.incRefCount(_serverAppConfig.releaseOnDeref);
4339
+ existingApp.incRefCount(serverAppSettings.releaseOnDeref);
4313
4340
  return existingApp;
4314
4341
  }
4315
4342
  const container = new component.ComponentContainer(nameString);
4316
4343
  for (const component of _components.values()) {
4317
4344
  container.addComponent(component);
4318
4345
  }
4319
- const newApp = new FirebaseServerAppImpl(appOptions, _serverAppConfig, nameString, container);
4346
+ const newApp = new FirebaseServerAppImpl(firebaseOptions, serverAppSettings, nameString, container);
4320
4347
  _serverApps.set(nameString, newApp);
4321
4348
  return newApp;
4322
4349
  }
@@ -4879,6 +4906,7 @@ exports._components = _components;
4879
4906
  exports._getProvider = _getProvider;
4880
4907
  exports._isFirebaseApp = _isFirebaseApp;
4881
4908
  exports._isFirebaseServerApp = _isFirebaseServerApp;
4909
+ exports._isFirebaseServerAppSettings = _isFirebaseServerAppSettings;
4882
4910
  exports._registerComponent = _registerComponent;
4883
4911
  exports._removeServiceInstance = _removeServiceInstance;
4884
4912
  exports._serverApps = _serverApps;