@firebase/app 0.13.2-canary.2d720995d → 0.13.2-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.
@@ -65,6 +65,10 @@ export declare const SDK_VERSION: string;
65
65
  *
66
66
  * @returns The initialized app.
67
67
  *
68
+ * @throws If the optional `name` parameter is malformed or empty.
69
+ *
70
+ * @throws If a `FirebaseApp` already exists with the same name but with a different configuration.
71
+ *
68
72
  * @public
69
73
  */
70
74
  export declare function initializeApp(options: FirebaseOptions, name?: string): FirebaseApp;
@@ -74,6 +78,9 @@ export declare function initializeApp(options: FirebaseOptions, name?: string):
74
78
  * @param options - Options to configure the app's services.
75
79
  * @param config - FirebaseApp Configuration
76
80
  *
81
+ * @throws If {@link FirebaseAppSettings.name} is defined but the value is malformed or empty.
82
+ *
83
+ * @throws If a `FirebaseApp` already exists with the same name but with a different configuration.
77
84
  * @public
78
85
  */
79
86
  export declare function initializeApp(options: FirebaseOptions, config?: FirebaseAppSettings): FirebaseApp;
@@ -118,13 +125,34 @@ export declare function initializeApp(): FirebaseApp;
118
125
  *
119
126
  * @param options - `Firebase.AppOptions` to configure the app's services, or a
120
127
  * a `FirebaseApp` instance which contains the `AppOptions` within.
121
- * @param config - `FirebaseServerApp` configuration.
128
+ * @param config - Optional `FirebaseServerApp` settings.
129
+ *
130
+ * @returns The initialized `FirebaseServerApp`.
131
+ *
132
+ * @throws If invoked in an unsupported non-server environment such as a browser.
133
+ *
134
+ * @throws If {@link FirebaseServerAppSettings.releaseOnDeref} is defined but the runtime doesn't
135
+ * provide Finalization Registry support.
136
+ *
137
+ * @public
138
+ */
139
+ export declare function initializeServerApp(options: FirebaseOptions | FirebaseApp, config?: FirebaseServerAppSettings): FirebaseServerApp;
140
+ /**
141
+ * Creates and initializes a {@link @firebase/app#FirebaseServerApp} instance.
142
+ *
143
+ * @param config - Optional `FirebaseServerApp` settings.
122
144
  *
123
145
  * @returns The initialized `FirebaseServerApp`.
124
146
  *
147
+ * @throws If invoked in an unsupported non-server environment such as a browser.
148
+ * @throws If {@link FirebaseServerAppSettings.releaseOnDeref} is defined but the runtime doesn't
149
+ * provide Finalization Registry support.
150
+ * @throws If the `FIREBASE_OPTIONS` enviornment variable does not contain a valid project
151
+ * configuration required for auto-initialization.
152
+ *
125
153
  * @public
126
154
  */
127
- export declare function initializeServerApp(options: FirebaseOptions | FirebaseApp, config: FirebaseServerAppSettings): FirebaseServerApp;
155
+ export declare function initializeServerApp(config?: FirebaseServerAppSettings): FirebaseServerApp;
128
156
  /**
129
157
  * Retrieves a {@link @firebase/app#FirebaseApp} instance.
130
158
  *
@@ -641,6 +641,10 @@ declare const SDK_VERSION: string;
641
641
  *
642
642
  * @returns The initialized app.
643
643
  *
644
+ * @throws If the optional `name` parameter is malformed or empty.
645
+ *
646
+ * @throws If a `FirebaseApp` already exists with the same name but with a different configuration.
647
+ *
644
648
  * @public
645
649
  */
646
650
  declare function initializeApp(options: FirebaseOptions, name?: string): FirebaseApp;
@@ -650,6 +654,9 @@ declare function initializeApp(options: FirebaseOptions, name?: string): Firebas
650
654
  * @param options - Options to configure the app's services.
651
655
  * @param config - FirebaseApp Configuration
652
656
  *
657
+ * @throws If {@link FirebaseAppSettings.name} is defined but the value is malformed or empty.
658
+ *
659
+ * @throws If a `FirebaseApp` already exists with the same name but with a different configuration.
653
660
  * @public
654
661
  */
655
662
  declare function initializeApp(options: FirebaseOptions, config?: FirebaseAppSettings): FirebaseApp;
@@ -694,13 +701,34 @@ declare function initializeApp(): FirebaseApp;
694
701
  *
695
702
  * @param options - `Firebase.AppOptions` to configure the app's services, or a
696
703
  * a `FirebaseApp` instance which contains the `AppOptions` within.
697
- * @param config - `FirebaseServerApp` configuration.
704
+ * @param config - Optional `FirebaseServerApp` settings.
698
705
  *
699
706
  * @returns The initialized `FirebaseServerApp`.
700
707
  *
708
+ * @throws If invoked in an unsupported non-server environment such as a browser.
709
+ *
710
+ * @throws If {@link FirebaseServerAppSettings.releaseOnDeref} is defined but the runtime doesn't
711
+ * provide Finalization Registry support.
712
+ *
701
713
  * @public
702
714
  */
703
- declare function initializeServerApp(options: FirebaseOptions | FirebaseApp, config: FirebaseServerAppSettings): FirebaseServerApp;
715
+ declare function initializeServerApp(options: FirebaseOptions | FirebaseApp, config?: FirebaseServerAppSettings): FirebaseServerApp;
716
+ /**
717
+ * Creates and initializes a {@link @firebase/app#FirebaseServerApp} instance.
718
+ *
719
+ * @param config - Optional `FirebaseServerApp` settings.
720
+ *
721
+ * @returns The initialized `FirebaseServerApp`.
722
+ *
723
+ * @throws If invoked in an unsupported non-server environment such as a browser.
724
+ * @throws If {@link FirebaseServerAppSettings.releaseOnDeref} is defined but the runtime doesn't
725
+ * provide Finalization Registry support.
726
+ * @throws If the `FIREBASE_OPTIONS` enviornment variable does not contain a valid project
727
+ * configuration required for auto-initialization.
728
+ *
729
+ * @public
730
+ */
731
+ declare function initializeServerApp(config?: FirebaseServerAppSettings): FirebaseServerApp;
704
732
  /**
705
733
  * Retrieves a {@link @firebase/app#FirebaseApp} instance.
706
734
  *
@@ -876,13 +904,22 @@ declare function _getProvider<T extends Name>(app: FirebaseApp, name: T): Provid
876
904
  declare function _removeServiceInstance<T extends Name>(app: FirebaseApp, name: T, instanceIdentifier?: string): void;
877
905
  /**
878
906
  *
879
- * @param obj - an object of type FirebaseApp or FirebaseOptions.
907
+ * @param obj - an object of type FirebaseApp, FirebaseOptions or FirebaseAppSettings.
880
908
  *
881
909
  * @returns true if the provide object is of type FirebaseApp.
882
910
  *
883
911
  * @internal
884
912
  */
885
- declare function _isFirebaseApp(obj: FirebaseApp | FirebaseOptions): obj is FirebaseApp;
913
+ declare function _isFirebaseApp(obj: FirebaseApp | FirebaseOptions | FirebaseAppSettings): obj is FirebaseApp;
914
+ /**
915
+ *
916
+ * @param obj - an object of type FirebaseApp, FirebaseOptions or FirebaseAppSettings.
917
+ *
918
+ * @returns true if the provided object is of type FirebaseServerAppImpl.
919
+ *
920
+ * @internal
921
+ */
922
+ declare function _isFirebaseServerAppSettings(obj: FirebaseApp | FirebaseOptions | FirebaseAppSettings): obj is FirebaseServerAppSettings;
886
923
  /**
887
924
  *
888
925
  * @param obj - an object of type FirebaseApp.
@@ -899,4 +936,4 @@ declare function _isFirebaseServerApp(obj: FirebaseApp | FirebaseServerApp | nul
899
936
  */
900
937
  declare function _clearComponents(): void;
901
938
 
902
- export { FirebaseApp, FirebaseAppSettings, FirebaseError, FirebaseOptions, FirebaseServerApp, FirebaseServerAppSettings, SDK_VERSION, DEFAULT_ENTRY_NAME as _DEFAULT_ENTRY_NAME, _FirebaseAppInternal, _FirebaseService, _addComponent, _addOrOverwriteComponent, _apps, _clearComponents, _components, _getProvider, _isFirebaseApp, _isFirebaseServerApp, _registerComponent, _removeServiceInstance, _serverApps, deleteApp, getApp, getApps, initializeApp, initializeServerApp, onLog, registerVersion, setLogLevel };
939
+ export { FirebaseApp, FirebaseAppSettings, FirebaseError, FirebaseOptions, FirebaseServerApp, FirebaseServerAppSettings, SDK_VERSION, DEFAULT_ENTRY_NAME as _DEFAULT_ENTRY_NAME, _FirebaseAppInternal, _FirebaseService, _addComponent, _addOrOverwriteComponent, _apps, _clearComponents, _components, _getProvider, _isFirebaseApp, _isFirebaseServerApp, _isFirebaseServerAppSettings, _registerComponent, _removeServiceInstance, _serverApps, deleteApp, getApp, getApps, initializeApp, initializeServerApp, onLog, registerVersion, setLogLevel };
@@ -14,7 +14,7 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import { FirebaseApp, FirebaseOptions, FirebaseServerApp } from './public-types';
17
+ import { FirebaseApp, FirebaseAppSettings, FirebaseServerAppSettings, FirebaseOptions, FirebaseServerApp } from './public-types';
18
18
  import { Component, Provider, Name } from '@firebase/component';
19
19
  import { DEFAULT_ENTRY_NAME } from './constants';
20
20
  /**
@@ -71,13 +71,22 @@ export declare function _getProvider<T extends Name>(app: FirebaseApp, name: T):
71
71
  export declare function _removeServiceInstance<T extends Name>(app: FirebaseApp, name: T, instanceIdentifier?: string): void;
72
72
  /**
73
73
  *
74
- * @param obj - an object of type FirebaseApp or FirebaseOptions.
74
+ * @param obj - an object of type FirebaseApp, FirebaseOptions or FirebaseAppSettings.
75
75
  *
76
76
  * @returns true if the provide object is of type FirebaseApp.
77
77
  *
78
78
  * @internal
79
79
  */
80
- export declare function _isFirebaseApp(obj: FirebaseApp | FirebaseOptions): obj is FirebaseApp;
80
+ export declare function _isFirebaseApp(obj: FirebaseApp | FirebaseOptions | FirebaseAppSettings): obj is FirebaseApp;
81
+ /**
82
+ *
83
+ * @param obj - an object of type FirebaseApp, FirebaseOptions or FirebaseAppSettings.
84
+ *
85
+ * @returns true if the provided object is of type FirebaseServerAppImpl.
86
+ *
87
+ * @internal
88
+ */
89
+ export declare function _isFirebaseServerAppSettings(obj: FirebaseApp | FirebaseOptions | FirebaseAppSettings): obj is FirebaseServerAppSettings;
81
90
  /**
82
91
  *
83
92
  * @param obj - an object of type FirebaseApp.
@@ -332,6 +332,10 @@ export declare function getApps(): FirebaseApp[];
332
332
  *
333
333
  * @returns The initialized app.
334
334
  *
335
+ * @throws If the optional `name` parameter is malformed or empty.
336
+ *
337
+ * @throws If a `FirebaseApp` already exists with the same name but with a different configuration.
338
+ *
335
339
  * @public
336
340
  */
337
341
  export declare function initializeApp(options: FirebaseOptions, name?: string): FirebaseApp;
@@ -342,6 +346,9 @@ export declare function initializeApp(options: FirebaseOptions, name?: string):
342
346
  * @param options - Options to configure the app's services.
343
347
  * @param config - FirebaseApp Configuration
344
348
  *
349
+ * @throws If {@link FirebaseAppSettings.name} is defined but the value is malformed or empty.
350
+ *
351
+ * @throws If a `FirebaseApp` already exists with the same name but with a different configuration.
345
352
  * @public
346
353
  */
347
354
  export declare function initializeApp(options: FirebaseOptions, config?: FirebaseAppSettings): FirebaseApp;
@@ -388,18 +395,42 @@ export declare function initializeApp(): FirebaseApp;
388
395
  *
389
396
  * @param options - `Firebase.AppOptions` to configure the app's services, or a
390
397
  * a `FirebaseApp` instance which contains the `AppOptions` within.
391
- * @param config - `FirebaseServerApp` configuration.
398
+ * @param config - Optional `FirebaseServerApp` settings.
399
+ *
400
+ * @returns The initialized `FirebaseServerApp`.
401
+ *
402
+ * @throws If invoked in an unsupported non-server environment such as a browser.
403
+ *
404
+ * @throws If {@link FirebaseServerAppSettings.releaseOnDeref} is defined but the runtime doesn't
405
+ * provide Finalization Registry support.
406
+ *
407
+ * @public
408
+ */
409
+ export declare function initializeServerApp(options: FirebaseOptions | FirebaseApp, config?: FirebaseServerAppSettings): FirebaseServerApp;
410
+
411
+ /**
412
+ * Creates and initializes a {@link @firebase/app#FirebaseServerApp} instance.
413
+ *
414
+ * @param config - Optional `FirebaseServerApp` settings.
392
415
  *
393
416
  * @returns The initialized `FirebaseServerApp`.
394
417
  *
418
+ * @throws If invoked in an unsupported non-server environment such as a browser.
419
+ * @throws If {@link FirebaseServerAppSettings.releaseOnDeref} is defined but the runtime doesn't
420
+ * provide Finalization Registry support.
421
+ * @throws If the `FIREBASE_OPTIONS` enviornment variable does not contain a valid project
422
+ * configuration required for auto-initialization.
423
+ *
395
424
  * @public
396
425
  */
397
- export declare function initializeServerApp(options: FirebaseOptions | FirebaseApp, config: FirebaseServerAppSettings): FirebaseServerApp;
426
+ export declare function initializeServerApp(config?: FirebaseServerAppSettings): FirebaseServerApp;
398
427
 
399
428
  /* Excluded from this release type: _isFirebaseApp */
400
429
 
401
430
  /* Excluded from this release type: _isFirebaseServerApp */
402
431
 
432
+ /* Excluded from this release type: _isFirebaseServerAppSettings */
433
+
403
434
  /**
404
435
  * Sets log handler for all Firebase SDKs.
405
436
  * @param logCallback - An optional custom log handler that executes user code whenever
package/dist/app.d.ts CHANGED
@@ -385,6 +385,10 @@ export declare function _getProvider<T extends Name>(app: FirebaseApp, name: T):
385
385
  *
386
386
  * @returns The initialized app.
387
387
  *
388
+ * @throws If the optional `name` parameter is malformed or empty.
389
+ *
390
+ * @throws If a `FirebaseApp` already exists with the same name but with a different configuration.
391
+ *
388
392
  * @public
389
393
  */
390
394
  export declare function initializeApp(options: FirebaseOptions, name?: string): FirebaseApp;
@@ -395,6 +399,9 @@ export declare function initializeApp(options: FirebaseOptions, name?: string):
395
399
  * @param options - Options to configure the app's services.
396
400
  * @param config - FirebaseApp Configuration
397
401
  *
402
+ * @throws If {@link FirebaseAppSettings.name} is defined but the value is malformed or empty.
403
+ *
404
+ * @throws If a `FirebaseApp` already exists with the same name but with a different configuration.
398
405
  * @public
399
406
  */
400
407
  export declare function initializeApp(options: FirebaseOptions, config?: FirebaseAppSettings): FirebaseApp;
@@ -441,23 +448,45 @@ export declare function initializeApp(): FirebaseApp;
441
448
  *
442
449
  * @param options - `Firebase.AppOptions` to configure the app's services, or a
443
450
  * a `FirebaseApp` instance which contains the `AppOptions` within.
444
- * @param config - `FirebaseServerApp` configuration.
451
+ * @param config - Optional `FirebaseServerApp` settings.
445
452
  *
446
453
  * @returns The initialized `FirebaseServerApp`.
447
454
  *
455
+ * @throws If invoked in an unsupported non-server environment such as a browser.
456
+ *
457
+ * @throws If {@link FirebaseServerAppSettings.releaseOnDeref} is defined but the runtime doesn't
458
+ * provide Finalization Registry support.
459
+ *
448
460
  * @public
449
461
  */
450
- export declare function initializeServerApp(options: FirebaseOptions | FirebaseApp, config: FirebaseServerAppSettings): FirebaseServerApp;
462
+ export declare function initializeServerApp(options: FirebaseOptions | FirebaseApp, config?: FirebaseServerAppSettings): FirebaseServerApp;
451
463
 
452
464
  /**
465
+ * Creates and initializes a {@link @firebase/app#FirebaseServerApp} instance.
453
466
  *
454
- * @param obj - an object of type FirebaseApp or FirebaseOptions.
467
+ * @param config - Optional `FirebaseServerApp` settings.
468
+ *
469
+ * @returns The initialized `FirebaseServerApp`.
470
+ *
471
+ * @throws If invoked in an unsupported non-server environment such as a browser.
472
+ * @throws If {@link FirebaseServerAppSettings.releaseOnDeref} is defined but the runtime doesn't
473
+ * provide Finalization Registry support.
474
+ * @throws If the `FIREBASE_OPTIONS` enviornment variable does not contain a valid project
475
+ * configuration required for auto-initialization.
476
+ *
477
+ * @public
478
+ */
479
+ export declare function initializeServerApp(config?: FirebaseServerAppSettings): FirebaseServerApp;
480
+
481
+ /**
482
+ *
483
+ * @param obj - an object of type FirebaseApp, FirebaseOptions or FirebaseAppSettings.
455
484
  *
456
485
  * @returns true if the provide object is of type FirebaseApp.
457
486
  *
458
487
  * @internal
459
488
  */
460
- export declare function _isFirebaseApp(obj: FirebaseApp | FirebaseOptions): obj is FirebaseApp;
489
+ export declare function _isFirebaseApp(obj: FirebaseApp | FirebaseOptions | FirebaseAppSettings): obj is FirebaseApp;
461
490
 
462
491
  /**
463
492
  *
@@ -469,6 +498,16 @@ export declare function _isFirebaseApp(obj: FirebaseApp | FirebaseOptions): obj
469
498
  */
470
499
  export declare function _isFirebaseServerApp(obj: FirebaseApp | FirebaseServerApp | null | undefined): obj is FirebaseServerApp;
471
500
 
501
+ /**
502
+ *
503
+ * @param obj - an object of type FirebaseApp, FirebaseOptions or FirebaseAppSettings.
504
+ *
505
+ * @returns true if the provided object is of type FirebaseServerAppImpl.
506
+ *
507
+ * @internal
508
+ */
509
+ export declare function _isFirebaseServerAppSettings(obj: FirebaseApp | FirebaseOptions | FirebaseAppSettings): obj is FirebaseServerAppSettings;
510
+
472
511
  /**
473
512
  * Sets log handler for all Firebase SDKs.
474
513
  * @param logCallback - An optional custom log handler that executes user code whenever
@@ -65,6 +65,10 @@ export declare const SDK_VERSION: string;
65
65
  *
66
66
  * @returns The initialized app.
67
67
  *
68
+ * @throws If the optional `name` parameter is malformed or empty.
69
+ *
70
+ * @throws If a `FirebaseApp` already exists with the same name but with a different configuration.
71
+ *
68
72
  * @public
69
73
  */
70
74
  export declare function initializeApp(options: FirebaseOptions, name?: string): FirebaseApp;
@@ -74,6 +78,9 @@ export declare function initializeApp(options: FirebaseOptions, name?: string):
74
78
  * @param options - Options to configure the app's services.
75
79
  * @param config - FirebaseApp Configuration
76
80
  *
81
+ * @throws If {@link FirebaseAppSettings.name} is defined but the value is malformed or empty.
82
+ *
83
+ * @throws If a `FirebaseApp` already exists with the same name but with a different configuration.
77
84
  * @public
78
85
  */
79
86
  export declare function initializeApp(options: FirebaseOptions, config?: FirebaseAppSettings): FirebaseApp;
@@ -118,13 +125,34 @@ export declare function initializeApp(): FirebaseApp;
118
125
  *
119
126
  * @param options - `Firebase.AppOptions` to configure the app's services, or a
120
127
  * a `FirebaseApp` instance which contains the `AppOptions` within.
121
- * @param config - `FirebaseServerApp` configuration.
128
+ * @param config - Optional `FirebaseServerApp` settings.
129
+ *
130
+ * @returns The initialized `FirebaseServerApp`.
131
+ *
132
+ * @throws If invoked in an unsupported non-server environment such as a browser.
133
+ *
134
+ * @throws If {@link FirebaseServerAppSettings.releaseOnDeref} is defined but the runtime doesn't
135
+ * provide Finalization Registry support.
136
+ *
137
+ * @public
138
+ */
139
+ export declare function initializeServerApp(options: FirebaseOptions | FirebaseApp, config?: FirebaseServerAppSettings): FirebaseServerApp;
140
+ /**
141
+ * Creates and initializes a {@link @firebase/app#FirebaseServerApp} instance.
142
+ *
143
+ * @param config - Optional `FirebaseServerApp` settings.
122
144
  *
123
145
  * @returns The initialized `FirebaseServerApp`.
124
146
  *
147
+ * @throws If invoked in an unsupported non-server environment such as a browser.
148
+ * @throws If {@link FirebaseServerAppSettings.releaseOnDeref} is defined but the runtime doesn't
149
+ * provide Finalization Registry support.
150
+ * @throws If the `FIREBASE_OPTIONS` enviornment variable does not contain a valid project
151
+ * configuration required for auto-initialization.
152
+ *
125
153
  * @public
126
154
  */
127
- export declare function initializeServerApp(options: FirebaseOptions | FirebaseApp, config: FirebaseServerAppSettings): FirebaseServerApp;
155
+ export declare function initializeServerApp(config?: FirebaseServerAppSettings): FirebaseServerApp;
128
156
  /**
129
157
  * Retrieves a {@link @firebase/app#FirebaseApp} instance.
130
158
  *
@@ -14,7 +14,7 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import { FirebaseApp, FirebaseOptions, FirebaseServerApp } from './public-types';
17
+ import { FirebaseApp, FirebaseAppSettings, FirebaseServerAppSettings, FirebaseOptions, FirebaseServerApp } from './public-types';
18
18
  import { Component, Provider, Name } from '@firebase/component';
19
19
  import { DEFAULT_ENTRY_NAME } from './constants';
20
20
  /**
@@ -71,13 +71,22 @@ export declare function _getProvider<T extends Name>(app: FirebaseApp, name: T):
71
71
  export declare function _removeServiceInstance<T extends Name>(app: FirebaseApp, name: T, instanceIdentifier?: string): void;
72
72
  /**
73
73
  *
74
- * @param obj - an object of type FirebaseApp or FirebaseOptions.
74
+ * @param obj - an object of type FirebaseApp, FirebaseOptions or FirebaseAppSettings.
75
75
  *
76
76
  * @returns true if the provide object is of type FirebaseApp.
77
77
  *
78
78
  * @internal
79
79
  */
80
- export declare function _isFirebaseApp(obj: FirebaseApp | FirebaseOptions): obj is FirebaseApp;
80
+ export declare function _isFirebaseApp(obj: FirebaseApp | FirebaseOptions | FirebaseAppSettings): obj is FirebaseApp;
81
+ /**
82
+ *
83
+ * @param obj - an object of type FirebaseApp, FirebaseOptions or FirebaseAppSettings.
84
+ *
85
+ * @returns true if the provided object is of type FirebaseServerAppImpl.
86
+ *
87
+ * @internal
88
+ */
89
+ export declare function _isFirebaseServerAppSettings(obj: FirebaseApp | FirebaseOptions | FirebaseAppSettings): obj is FirebaseServerAppSettings;
81
90
  /**
82
91
  *
83
92
  * @param obj - an object of type FirebaseApp.
@@ -58,7 +58,7 @@ function isVersionServiceProvider(provider) {
58
58
  }
59
59
 
60
60
  const name$q = "@firebase/app";
61
- const version$1 = "0.13.2-canary.2d720995d";
61
+ const version$1 = "0.13.2-canary.d91169f06";
62
62
 
63
63
  /**
64
64
  * @license
@@ -129,7 +129,7 @@ const name$2 = "@firebase/ai";
129
129
  const name$1 = "@firebase/firestore-compat";
130
130
 
131
131
  const name = "firebase";
132
- const version = "11.10.0-canary.2d720995d";
132
+ const version = "11.10.0-canary.d91169f06";
133
133
 
134
134
  /**
135
135
  * @license
@@ -289,7 +289,7 @@ function _removeServiceInstance(app, name, instanceIdentifier = DEFAULT_ENTRY_NA
289
289
  }
290
290
  /**
291
291
  *
292
- * @param obj - an object of type FirebaseApp or FirebaseOptions.
292
+ * @param obj - an object of type FirebaseApp, FirebaseOptions or FirebaseAppSettings.
293
293
  *
294
294
  * @returns true if the provide object is of type FirebaseApp.
295
295
  *
@@ -298,6 +298,23 @@ function _removeServiceInstance(app, name, instanceIdentifier = DEFAULT_ENTRY_NA
298
298
  function _isFirebaseApp(obj) {
299
299
  return obj.options !== undefined;
300
300
  }
301
+ /**
302
+ *
303
+ * @param obj - an object of type FirebaseApp, FirebaseOptions or FirebaseAppSettings.
304
+ *
305
+ * @returns true if the provided object is of type FirebaseServerAppImpl.
306
+ *
307
+ * @internal
308
+ */
309
+ function _isFirebaseServerAppSettings(obj) {
310
+ if (_isFirebaseApp(obj)) {
311
+ return false;
312
+ }
313
+ return ('authIdToken' in obj ||
314
+ 'appCheckToken' in obj ||
315
+ 'releaseOnDeref' in obj ||
316
+ 'automaticDataCollectionEnabled' in obj);
317
+ }
301
318
  /**
302
319
  *
303
320
  * @param obj - an object of type FirebaseApp.
@@ -614,25 +631,35 @@ function initializeApp(_options, rawConfig = {}) {
614
631
  _apps.set(name, newApp);
615
632
  return newApp;
616
633
  }
617
- function initializeServerApp(_options, _serverAppConfig) {
634
+ function initializeServerApp(_options, _serverAppConfig = {}) {
618
635
  if (isBrowser() && !isWebWorker()) {
619
636
  // FirebaseServerApp isn't designed to be run in browsers.
620
637
  throw ERROR_FACTORY.create("invalid-server-app-environment" /* AppError.INVALID_SERVER_APP_ENVIRONMENT */);
621
638
  }
622
- if (_serverAppConfig.automaticDataCollectionEnabled === undefined) {
623
- _serverAppConfig.automaticDataCollectionEnabled = true;
639
+ let firebaseOptions;
640
+ let serverAppSettings = _serverAppConfig || {};
641
+ if (_options) {
642
+ if (_isFirebaseApp(_options)) {
643
+ firebaseOptions = _options.options;
644
+ }
645
+ else if (_isFirebaseServerAppSettings(_options)) {
646
+ serverAppSettings = _options;
647
+ }
648
+ else {
649
+ firebaseOptions = _options;
650
+ }
624
651
  }
625
- let appOptions;
626
- if (_isFirebaseApp(_options)) {
627
- appOptions = _options.options;
652
+ if (serverAppSettings.automaticDataCollectionEnabled === undefined) {
653
+ serverAppSettings.automaticDataCollectionEnabled = true;
628
654
  }
629
- else {
630
- appOptions = _options;
655
+ firebaseOptions || (firebaseOptions = getDefaultAppConfig());
656
+ if (!firebaseOptions) {
657
+ throw ERROR_FACTORY.create("no-options" /* AppError.NO_OPTIONS */);
631
658
  }
632
659
  // Build an app name based on a hash of the configuration options.
633
660
  const nameObj = {
634
- ..._serverAppConfig,
635
- ...appOptions
661
+ ...serverAppSettings,
662
+ ...firebaseOptions
636
663
  };
637
664
  // However, Do not mangle the name based on releaseOnDeref, since it will vary between the
638
665
  // construction of FirebaseServerApp instances. For example, if the object is the request headers.
@@ -642,7 +669,7 @@ function initializeServerApp(_options, _serverAppConfig) {
642
669
  const hashCode = (s) => {
643
670
  return [...s].reduce((hash, c) => (Math.imul(31, hash) + c.charCodeAt(0)) | 0, 0);
644
671
  };
645
- if (_serverAppConfig.releaseOnDeref !== undefined) {
672
+ if (serverAppSettings.releaseOnDeref !== undefined) {
646
673
  if (typeof FinalizationRegistry === 'undefined') {
647
674
  throw ERROR_FACTORY.create("finalization-registry-not-supported" /* AppError.FINALIZATION_REGISTRY_NOT_SUPPORTED */, {});
648
675
  }
@@ -650,14 +677,14 @@ function initializeServerApp(_options, _serverAppConfig) {
650
677
  const nameString = '' + hashCode(JSON.stringify(nameObj));
651
678
  const existingApp = _serverApps.get(nameString);
652
679
  if (existingApp) {
653
- existingApp.incRefCount(_serverAppConfig.releaseOnDeref);
680
+ existingApp.incRefCount(serverAppSettings.releaseOnDeref);
654
681
  return existingApp;
655
682
  }
656
683
  const container = new ComponentContainer(nameString);
657
684
  for (const component of _components.values()) {
658
685
  container.addComponent(component);
659
686
  }
660
- const newApp = new FirebaseServerAppImpl(appOptions, _serverAppConfig, nameString, container);
687
+ const newApp = new FirebaseServerAppImpl(firebaseOptions, serverAppSettings, nameString, container);
661
688
  _serverApps.set(nameString, newApp);
662
689
  return newApp;
663
690
  }
@@ -1206,5 +1233,5 @@ function registerCoreComponents(variant) {
1206
1233
  */
1207
1234
  registerCoreComponents('');
1208
1235
 
1209
- export { SDK_VERSION, DEFAULT_ENTRY_NAME as _DEFAULT_ENTRY_NAME, _addComponent, _addOrOverwriteComponent, _apps, _clearComponents, _components, _getProvider, _isFirebaseApp, _isFirebaseServerApp, _registerComponent, _removeServiceInstance, _serverApps, deleteApp, getApp, getApps, initializeApp, initializeServerApp, onLog, registerVersion, setLogLevel };
1236
+ export { SDK_VERSION, DEFAULT_ENTRY_NAME as _DEFAULT_ENTRY_NAME, _addComponent, _addOrOverwriteComponent, _apps, _clearComponents, _components, _getProvider, _isFirebaseApp, _isFirebaseServerApp, _isFirebaseServerAppSettings, _registerComponent, _removeServiceInstance, _serverApps, deleteApp, getApp, getApps, initializeApp, initializeServerApp, onLog, registerVersion, setLogLevel };
1210
1237
  //# sourceMappingURL=index.esm.js.map