@firebase/app 0.9.29 → 0.10.0-canary.42fcdfe4c

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.
@@ -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, FirebaseAppSettings } from './public-types';
17
+ import { FirebaseApp, FirebaseServerApp, FirebaseOptions, FirebaseAppSettings, FirebaseServerAppSettings } from './public-types';
18
18
  import { LogLevelString, LogCallback, LogOptions } from '@firebase/logger';
19
19
  export { FirebaseError } from '@firebase/util';
20
20
  /**
@@ -83,6 +83,48 @@ export declare function initializeApp(options: FirebaseOptions, config?: Firebas
83
83
  * @public
84
84
  */
85
85
  export declare function initializeApp(): FirebaseApp;
86
+ /**
87
+ * Creates and initializes a {@link @firebase/app#FirebaseServerApp} instance.
88
+ *
89
+ * The `FirebaseServerApp` is similar to `FirebaseApp`, but is intended for execution in
90
+ * server side rendering environments only. Initialization will fail if invoked from a
91
+ * browser environment.
92
+ *
93
+ * See
94
+ * {@link
95
+ * https://firebase.google.com/docs/web/setup#add_firebase_to_your_app
96
+ * | Add Firebase to your app} and
97
+ * {@link
98
+ * https://firebase.google.com/docs/web/setup#multiple-projects
99
+ * | Initialize multiple projects} for detailed documentation.
100
+ *
101
+ * @example
102
+ * ```javascript
103
+ *
104
+ * // Initialize an instance of `FirebaseServerApp`.
105
+ * // Retrieve your own options values by adding a web app on
106
+ * // https://console.firebase.google.com
107
+ * initializeServerApp({
108
+ * apiKey: "AIza....", // Auth / General Use
109
+ * authDomain: "YOUR_APP.firebaseapp.com", // Auth with popup/redirect
110
+ * databaseURL: "https://YOUR_APP.firebaseio.com", // Realtime Database
111
+ * storageBucket: "YOUR_APP.appspot.com", // Storage
112
+ * messagingSenderId: "123456789" // Cloud Messaging
113
+ * },
114
+ * {
115
+ * authIdToken: "Your Auth ID Token"
116
+ * });
117
+ * ```
118
+ *
119
+ * @param options - `Firebase.AppOptions` to configure the app's services, or a
120
+ * a `FirebaseApp` instance which contains the `AppOptions` within.
121
+ * @param config - `FirebaseServerApp` configuration.
122
+ *
123
+ * @returns The initialized `FirebaseServerApp`.
124
+ *
125
+ * @public
126
+ */
127
+ export declare function initializeServerApp(options: FirebaseOptions | FirebaseApp, config: FirebaseServerAppSettings): FirebaseServerApp;
86
128
  /**
87
129
  * Retrieves a {@link @firebase/app#FirebaseApp} instance.
88
130
  *
@@ -20,13 +20,16 @@ export declare const enum AppError {
20
20
  BAD_APP_NAME = "bad-app-name",
21
21
  DUPLICATE_APP = "duplicate-app",
22
22
  APP_DELETED = "app-deleted",
23
+ SERVER_APP_DELETED = "server-app-deleted",
23
24
  NO_OPTIONS = "no-options",
24
25
  INVALID_APP_ARGUMENT = "invalid-app-argument",
25
26
  INVALID_LOG_ARGUMENT = "invalid-log-argument",
26
27
  IDB_OPEN = "idb-open",
27
28
  IDB_GET = "idb-get",
28
29
  IDB_WRITE = "idb-set",
29
- IDB_DELETE = "idb-delete"
30
+ IDB_DELETE = "idb-delete",
31
+ FINALIZATION_REGISTRY_NOT_SUPPORTED = "finalization-registry-not-supported",
32
+ INVALID_SERVER_APP_ENVIRONMENT = "invalid-server-app-environment"
30
33
  }
31
34
  interface ErrorParams {
32
35
  [AppError.NO_APP]: {
@@ -56,6 +59,9 @@ interface ErrorParams {
56
59
  [AppError.IDB_DELETE]: {
57
60
  originalErrorMessage?: string;
58
61
  };
62
+ [AppError.FINALIZATION_REGISTRY_NOT_SUPPORTED]: {
63
+ appName?: string;
64
+ };
59
65
  }
60
66
  export declare const ERROR_FACTORY: ErrorFactory<AppError, ErrorParams>;
61
67
  export {};
@@ -17,8 +17,8 @@
17
17
  import { FirebaseApp, FirebaseOptions, FirebaseAppSettings } from './public-types';
18
18
  import { ComponentContainer } from '@firebase/component';
19
19
  export declare class FirebaseAppImpl implements FirebaseApp {
20
- private readonly _options;
21
- private readonly _name;
20
+ protected readonly _options: FirebaseOptions;
21
+ protected readonly _name: string;
22
22
  /**
23
23
  * Original config values passed in as a constructor parameter.
24
24
  * It is only used to compare with another config object to support idempotent initializeApp().
@@ -27,7 +27,7 @@ export declare class FirebaseAppImpl implements FirebaseApp {
27
27
  */
28
28
  private readonly _config;
29
29
  private _automaticDataCollectionEnabled;
30
- private _isDeleted;
30
+ protected _isDeleted: boolean;
31
31
  private readonly _container;
32
32
  constructor(options: FirebaseOptions, config: Required<FirebaseAppSettings>, container: ComponentContainer);
33
33
  get automaticDataCollectionEnabled(): boolean;
@@ -42,5 +42,5 @@ export declare class FirebaseAppImpl implements FirebaseApp {
42
42
  * This function will throw an Error if the App has already been deleted -
43
43
  * use before performing API actions on the App.
44
44
  */
45
- private checkDestroyed;
45
+ protected checkDestroyed(): void;
46
46
  }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { FirebaseServerApp, FirebaseServerAppSettings, FirebaseOptions } from './public-types';
18
+ import { ComponentContainer } from '@firebase/component';
19
+ import { FirebaseAppImpl } from './firebaseApp';
20
+ export declare class FirebaseServerAppImpl extends FirebaseAppImpl implements FirebaseServerApp {
21
+ private readonly _serverConfig;
22
+ private _finalizationRegistry;
23
+ private _refCount;
24
+ constructor(options: FirebaseOptions | FirebaseAppImpl, serverConfig: FirebaseServerAppSettings, name: string, container: ComponentContainer);
25
+ get refCount(): number;
26
+ incRefCount(obj: object | undefined): void;
27
+ decRefCount(): number;
28
+ private automaticCleanup;
29
+ get settings(): FirebaseServerAppSettings;
30
+ /**
31
+ * This function will throw an Error if the App has already been deleted -
32
+ * use before performing API actions on the App.
33
+ */
34
+ protected checkDestroyed(): void;
35
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import '../test/setup';
@@ -330,6 +330,35 @@ interface FirebaseApp {
330
330
  */
331
331
  automaticDataCollectionEnabled: boolean;
332
332
  }
333
+ /**
334
+ * A {@link @firebase/app#FirebaseServerApp} holds the initialization information
335
+ * for a collection of services running in server environments.
336
+ *
337
+ * Do not call this constructor directly. Instead, use
338
+ * {@link (initializeServerApp:1) | initializeServerApp()} to create
339
+ * an app.
340
+ *
341
+ * @public
342
+ */
343
+ interface FirebaseServerApp extends FirebaseApp {
344
+ /**
345
+ * There is no `getApp()` operation for `FirebaseServerApp`, so the name is not relevant for
346
+ * applications. However, it may be used internally, and is declared here so that
347
+ * `FirebaseServerApp` conforms to the `FirebaseApp` interface.
348
+ */
349
+ name: string;
350
+ /**
351
+ * The (read-only) configuration settings for this server app. These are the original
352
+ * parameters given in {@link (initializeServerApp:1) | initializeServerApp()}.
353
+ *
354
+ * @example
355
+ * ```javascript
356
+ * const app = initializeServerApp(settings);
357
+ * console.log(app.settings.authIdToken === options.authIdToken); // true
358
+ * ```
359
+ */
360
+ readonly settings: FirebaseServerAppSettings;
361
+ }
333
362
  /**
334
363
  * @public
335
364
  *
@@ -396,6 +425,57 @@ interface FirebaseAppSettings {
396
425
  */
397
426
  automaticDataCollectionEnabled?: boolean;
398
427
  }
428
+ /**
429
+ * @public
430
+ *
431
+ * Configuration options given to {@link (initializeServerApp:1) | initializeServerApp()}
432
+ */
433
+ interface FirebaseServerAppSettings extends FirebaseAppSettings {
434
+ /**
435
+ * An optional Auth ID token used to resume a signed in user session from a client
436
+ * runtime environment.
437
+ *
438
+ * Invoking `getAuth` with a `FirebaseServerApp` configured with a validated `authIdToken`
439
+ * causes an automatic attempt to sign in the user that the `authIdToken` represents. The token
440
+ * needs to have been recently minted for this operation to succeed.
441
+ *
442
+ * If the token fails local verification, or if the Auth service has failed to validate it when
443
+ * the Auth SDK is initialized, then a warning is logged to the console and the Auth SDK will not
444
+ * sign in a user on initalization.
445
+ *
446
+ * If a user is successfully signed in, then the Auth instance's `onAuthStateChanged` callback
447
+ * is invoked with the `User` object as per standard Auth flows. However, `User` objects
448
+ * created via an `authIdToken` do not have a refresh token. Attempted `refreshToken`
449
+ * operations fail.
450
+ */
451
+ authIdToken?: string;
452
+ /**
453
+ * An optional object. If provided, the Firebase SDK uses a `FinalizationRegistry`
454
+ * object to monitor the garbage collection status of the provided object. The
455
+ * Firebase SDK releases its reference on the `FirebaseServerApp` instance when the
456
+ * provided `releaseOnDeref` object is garbage collected.
457
+ *
458
+ * You can use this field to reduce memory management overhead for your application.
459
+ * If provided, an app running in a SSR pass does not need to perform
460
+ * `FirebaseServerApp` cleanup, so long as the reference object is deleted (by falling out of
461
+ * SSR scope, for instance.)
462
+ *
463
+ * If an object is not provided then the application must clean up the `FirebaseServerApp`
464
+ * instance by invoking `deleteApp`.
465
+ *
466
+ * If the application provides an object in this parameter, but the application is
467
+ * executed in a JavaScript engine that predates the support of `FinalizationRegistry`
468
+ * (introduced in node v14.6.0, for instance), then an error is thrown at `FirebaseServerApp`
469
+ * initialization.
470
+ */
471
+ releaseOnDeref?: object;
472
+ /**
473
+ * There is no `getApp()` operation for `FirebaseServerApp`, so the name is not relevant for
474
+ * applications. However, it may be used internally, and is declared here so that
475
+ * `FirebaseServerApp` conforms to the `FirebaseApp` interface.
476
+ */
477
+ name?: undefined;
478
+ }
399
479
  /**
400
480
  * @internal
401
481
  */
@@ -575,6 +655,48 @@ declare function initializeApp(options: FirebaseOptions, config?: FirebaseAppSet
575
655
  * @public
576
656
  */
577
657
  declare function initializeApp(): FirebaseApp;
658
+ /**
659
+ * Creates and initializes a {@link @firebase/app#FirebaseServerApp} instance.
660
+ *
661
+ * The `FirebaseServerApp` is similar to `FirebaseApp`, but is intended for execution in
662
+ * server side rendering environments only. Initialization will fail if invoked from a
663
+ * browser environment.
664
+ *
665
+ * See
666
+ * {@link
667
+ * https://firebase.google.com/docs/web/setup#add_firebase_to_your_app
668
+ * | Add Firebase to your app} and
669
+ * {@link
670
+ * https://firebase.google.com/docs/web/setup#multiple-projects
671
+ * | Initialize multiple projects} for detailed documentation.
672
+ *
673
+ * @example
674
+ * ```javascript
675
+ *
676
+ * // Initialize an instance of `FirebaseServerApp`.
677
+ * // Retrieve your own options values by adding a web app on
678
+ * // https://console.firebase.google.com
679
+ * initializeServerApp({
680
+ * apiKey: "AIza....", // Auth / General Use
681
+ * authDomain: "YOUR_APP.firebaseapp.com", // Auth with popup/redirect
682
+ * databaseURL: "https://YOUR_APP.firebaseio.com", // Realtime Database
683
+ * storageBucket: "YOUR_APP.appspot.com", // Storage
684
+ * messagingSenderId: "123456789" // Cloud Messaging
685
+ * },
686
+ * {
687
+ * authIdToken: "Your Auth ID Token"
688
+ * });
689
+ * ```
690
+ *
691
+ * @param options - `Firebase.AppOptions` to configure the app's services, or a
692
+ * a `FirebaseApp` instance which contains the `AppOptions` within.
693
+ * @param config - `FirebaseServerApp` configuration.
694
+ *
695
+ * @returns The initialized `FirebaseServerApp`.
696
+ *
697
+ * @public
698
+ */
699
+ declare function initializeServerApp(options: FirebaseOptions | FirebaseApp, config: FirebaseServerAppSettings): FirebaseServerApp;
578
700
  /**
579
701
  * Retrieves a {@link @firebase/app#FirebaseApp} instance.
580
702
  *
@@ -700,6 +822,10 @@ declare const DEFAULT_ENTRY_NAME = "[DEFAULT]";
700
822
  * @internal
701
823
  */
702
824
  declare const _apps: Map<string, FirebaseApp>;
825
+ /**
826
+ * @internal
827
+ */
828
+ declare const _serverApps: Map<string, FirebaseServerApp>;
703
829
  /**
704
830
  * Registered components.
705
831
  *
@@ -744,6 +870,24 @@ declare function _getProvider<T extends Name>(app: FirebaseApp, name: T): Provid
744
870
  * @internal
745
871
  */
746
872
  declare function _removeServiceInstance<T extends Name>(app: FirebaseApp, name: T, instanceIdentifier?: string): void;
873
+ /**
874
+ *
875
+ * @param obj - an object of type FirebaseApp or FirebaseOptions.
876
+ *
877
+ * @returns true if the provide object is of type FirebaseApp.
878
+ *
879
+ * @internal
880
+ */
881
+ declare function _isFirebaseApp(obj: FirebaseApp | FirebaseOptions): obj is FirebaseApp;
882
+ /**
883
+ *
884
+ * @param obj - an object of type FirebaseApp.
885
+ *
886
+ * @returns true if the provided object is of type FirebaseServerAppImpl.
887
+ *
888
+ * @internal
889
+ */
890
+ declare function _isFirebaseServerApp(obj: FirebaseApp | FirebaseServerApp): obj is FirebaseServerApp;
747
891
  /**
748
892
  * Test only
749
893
  *
@@ -751,4 +895,4 @@ declare function _removeServiceInstance<T extends Name>(app: FirebaseApp, name:
751
895
  */
752
896
  declare function _clearComponents(): void;
753
897
 
754
- export { FirebaseApp, FirebaseAppSettings, FirebaseError, FirebaseOptions, SDK_VERSION, DEFAULT_ENTRY_NAME as _DEFAULT_ENTRY_NAME, _FirebaseAppInternal, _FirebaseService, _addComponent, _addOrOverwriteComponent, _apps, _clearComponents, _components, _getProvider, _registerComponent, _removeServiceInstance, deleteApp, getApp, getApps, initializeApp, onLog, registerVersion, setLogLevel };
898
+ 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 };
@@ -14,13 +14,17 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import { FirebaseApp } from './public-types';
17
+ import { FirebaseApp, FirebaseOptions, FirebaseServerApp } from './public-types';
18
18
  import { Component, Provider, Name } from '@firebase/component';
19
19
  import { DEFAULT_ENTRY_NAME } from './constants';
20
20
  /**
21
21
  * @internal
22
22
  */
23
23
  export declare const _apps: Map<string, FirebaseApp>;
24
+ /**
25
+ * @internal
26
+ */
27
+ export declare const _serverApps: Map<string, FirebaseServerApp>;
24
28
  /**
25
29
  * Registered components.
26
30
  *
@@ -65,6 +69,24 @@ export declare function _getProvider<T extends Name>(app: FirebaseApp, name: T):
65
69
  * @internal
66
70
  */
67
71
  export declare function _removeServiceInstance<T extends Name>(app: FirebaseApp, name: T, instanceIdentifier?: string): void;
72
+ /**
73
+ *
74
+ * @param obj - an object of type FirebaseApp or FirebaseOptions.
75
+ *
76
+ * @returns true if the provide object is of type FirebaseApp.
77
+ *
78
+ * @internal
79
+ */
80
+ export declare function _isFirebaseApp(obj: FirebaseApp | FirebaseOptions): obj is FirebaseApp;
81
+ /**
82
+ *
83
+ * @param obj - an object of type FirebaseApp.
84
+ *
85
+ * @returns true if the provided object is of type FirebaseServerAppImpl.
86
+ *
87
+ * @internal
88
+ */
89
+ export declare function _isFirebaseServerApp(obj: FirebaseApp | FirebaseServerApp): obj is FirebaseServerApp;
68
90
  /**
69
91
  * Test only
70
92
  *
@@ -62,6 +62,35 @@ export interface FirebaseApp {
62
62
  */
63
63
  automaticDataCollectionEnabled: boolean;
64
64
  }
65
+ /**
66
+ * A {@link @firebase/app#FirebaseServerApp} holds the initialization information
67
+ * for a collection of services running in server environments.
68
+ *
69
+ * Do not call this constructor directly. Instead, use
70
+ * {@link (initializeServerApp:1) | initializeServerApp()} to create
71
+ * an app.
72
+ *
73
+ * @public
74
+ */
75
+ export interface FirebaseServerApp extends FirebaseApp {
76
+ /**
77
+ * There is no `getApp()` operation for `FirebaseServerApp`, so the name is not relevant for
78
+ * applications. However, it may be used internally, and is declared here so that
79
+ * `FirebaseServerApp` conforms to the `FirebaseApp` interface.
80
+ */
81
+ name: string;
82
+ /**
83
+ * The (read-only) configuration settings for this server app. These are the original
84
+ * parameters given in {@link (initializeServerApp:1) | initializeServerApp()}.
85
+ *
86
+ * @example
87
+ * ```javascript
88
+ * const app = initializeServerApp(settings);
89
+ * console.log(app.settings.authIdToken === options.authIdToken); // true
90
+ * ```
91
+ */
92
+ readonly settings: FirebaseServerAppSettings;
93
+ }
65
94
  /**
66
95
  * @public
67
96
  *
@@ -128,6 +157,57 @@ export interface FirebaseAppSettings {
128
157
  */
129
158
  automaticDataCollectionEnabled?: boolean;
130
159
  }
160
+ /**
161
+ * @public
162
+ *
163
+ * Configuration options given to {@link (initializeServerApp:1) | initializeServerApp()}
164
+ */
165
+ export interface FirebaseServerAppSettings extends FirebaseAppSettings {
166
+ /**
167
+ * An optional Auth ID token used to resume a signed in user session from a client
168
+ * runtime environment.
169
+ *
170
+ * Invoking `getAuth` with a `FirebaseServerApp` configured with a validated `authIdToken`
171
+ * causes an automatic attempt to sign in the user that the `authIdToken` represents. The token
172
+ * needs to have been recently minted for this operation to succeed.
173
+ *
174
+ * If the token fails local verification, or if the Auth service has failed to validate it when
175
+ * the Auth SDK is initialized, then a warning is logged to the console and the Auth SDK will not
176
+ * sign in a user on initalization.
177
+ *
178
+ * If a user is successfully signed in, then the Auth instance's `onAuthStateChanged` callback
179
+ * is invoked with the `User` object as per standard Auth flows. However, `User` objects
180
+ * created via an `authIdToken` do not have a refresh token. Attempted `refreshToken`
181
+ * operations fail.
182
+ */
183
+ authIdToken?: string;
184
+ /**
185
+ * An optional object. If provided, the Firebase SDK uses a `FinalizationRegistry`
186
+ * object to monitor the garbage collection status of the provided object. The
187
+ * Firebase SDK releases its reference on the `FirebaseServerApp` instance when the
188
+ * provided `releaseOnDeref` object is garbage collected.
189
+ *
190
+ * You can use this field to reduce memory management overhead for your application.
191
+ * If provided, an app running in a SSR pass does not need to perform
192
+ * `FirebaseServerApp` cleanup, so long as the reference object is deleted (by falling out of
193
+ * SSR scope, for instance.)
194
+ *
195
+ * If an object is not provided then the application must clean up the `FirebaseServerApp`
196
+ * instance by invoking `deleteApp`.
197
+ *
198
+ * If the application provides an object in this parameter, but the application is
199
+ * executed in a JavaScript engine that predates the support of `FinalizationRegistry`
200
+ * (introduced in node v14.6.0, for instance), then an error is thrown at `FirebaseServerApp`
201
+ * initialization.
202
+ */
203
+ releaseOnDeref?: object;
204
+ /**
205
+ * There is no `getApp()` operation for `FirebaseServerApp`, so the name is not relevant for
206
+ * applications. However, it may be used internally, and is declared here so that
207
+ * `FirebaseServerApp` conforms to the `FirebaseApp` interface.
208
+ */
209
+ name?: undefined;
210
+ }
131
211
  /**
132
212
  * @internal
133
213
  */
@@ -163,6 +163,88 @@ export declare interface FirebaseOptions {
163
163
  measurementId?: string;
164
164
  }
165
165
 
166
+ /**
167
+ * A {@link @firebase/app#FirebaseServerApp} holds the initialization information
168
+ * for a collection of services running in server environments.
169
+ *
170
+ * Do not call this constructor directly. Instead, use
171
+ * {@link (initializeServerApp:1) | initializeServerApp()} to create
172
+ * an app.
173
+ *
174
+ * @public
175
+ */
176
+ export declare interface FirebaseServerApp extends FirebaseApp {
177
+ /**
178
+ * There is no `getApp()` operation for `FirebaseServerApp`, so the name is not relevant for
179
+ * applications. However, it may be used internally, and is declared here so that
180
+ * `FirebaseServerApp` conforms to the `FirebaseApp` interface.
181
+ */
182
+ name: string;
183
+ /**
184
+ * The (read-only) configuration settings for this server app. These are the original
185
+ * parameters given in {@link (initializeServerApp:1) | initializeServerApp()}.
186
+ *
187
+ * @example
188
+ * ```javascript
189
+ * const app = initializeServerApp(settings);
190
+ * console.log(app.settings.authIdToken === options.authIdToken); // true
191
+ * ```
192
+ */
193
+ readonly settings: FirebaseServerAppSettings;
194
+ }
195
+
196
+ /**
197
+ * @public
198
+ *
199
+ * Configuration options given to {@link (initializeServerApp:1) | initializeServerApp()}
200
+ */
201
+ export declare interface FirebaseServerAppSettings extends FirebaseAppSettings {
202
+ /**
203
+ * An optional Auth ID token used to resume a signed in user session from a client
204
+ * runtime environment.
205
+ *
206
+ * Invoking `getAuth` with a `FirebaseServerApp` configured with a validated `authIdToken`
207
+ * causes an automatic attempt to sign in the user that the `authIdToken` represents. The token
208
+ * needs to have been recently minted for this operation to succeed.
209
+ *
210
+ * If the token fails local verification, or if the Auth service has failed to validate it when
211
+ * the Auth SDK is initialized, then a warning is logged to the console and the Auth SDK will not
212
+ * sign in a user on initalization.
213
+ *
214
+ * If a user is successfully signed in, then the Auth instance's `onAuthStateChanged` callback
215
+ * is invoked with the `User` object as per standard Auth flows. However, `User` objects
216
+ * created via an `authIdToken` do not have a refresh token. Attempted `refreshToken`
217
+ * operations fail.
218
+ */
219
+ authIdToken?: string;
220
+ /**
221
+ * An optional object. If provided, the Firebase SDK uses a `FinalizationRegistry`
222
+ * object to monitor the garbage collection status of the provided object. The
223
+ * Firebase SDK releases its reference on the `FirebaseServerApp` instance when the
224
+ * provided `releaseOnDeref` object is garbage collected.
225
+ *
226
+ * You can use this field to reduce memory management overhead for your application.
227
+ * If provided, an app running in a SSR pass does not need to perform
228
+ * `FirebaseServerApp` cleanup, so long as the reference object is deleted (by falling out of
229
+ * SSR scope, for instance.)
230
+ *
231
+ * If an object is not provided then the application must clean up the `FirebaseServerApp`
232
+ * instance by invoking `deleteApp`.
233
+ *
234
+ * If the application provides an object in this parameter, but the application is
235
+ * executed in a JavaScript engine that predates the support of `FinalizationRegistry`
236
+ * (introduced in node v14.6.0, for instance), then an error is thrown at `FirebaseServerApp`
237
+ * initialization.
238
+ */
239
+ releaseOnDeref?: object;
240
+ /**
241
+ * There is no `getApp()` operation for `FirebaseServerApp`, so the name is not relevant for
242
+ * applications. However, it may be used internally, and is declared here so that
243
+ * `FirebaseServerApp` conforms to the `FirebaseApp` interface.
244
+ */
245
+ name?: undefined;
246
+ }
247
+
166
248
  /* Excluded from this release type: _FirebaseService */
167
249
 
168
250
  /**
@@ -267,6 +349,53 @@ export declare function initializeApp(options: FirebaseOptions, config?: Firebas
267
349
  */
268
350
  export declare function initializeApp(): FirebaseApp;
269
351
 
352
+ /**
353
+ * Creates and initializes a {@link @firebase/app#FirebaseServerApp} instance.
354
+ *
355
+ * The `FirebaseServerApp` is similar to `FirebaseApp`, but is intended for execution in
356
+ * server side rendering environments only. Initialization will fail if invoked from a
357
+ * browser environment.
358
+ *
359
+ * See
360
+ * {@link
361
+ * https://firebase.google.com/docs/web/setup#add_firebase_to_your_app
362
+ * | Add Firebase to your app} and
363
+ * {@link
364
+ * https://firebase.google.com/docs/web/setup#multiple-projects
365
+ * | Initialize multiple projects} for detailed documentation.
366
+ *
367
+ * @example
368
+ * ```javascript
369
+ *
370
+ * // Initialize an instance of `FirebaseServerApp`.
371
+ * // Retrieve your own options values by adding a web app on
372
+ * // https://console.firebase.google.com
373
+ * initializeServerApp({
374
+ * apiKey: "AIza....", // Auth / General Use
375
+ * authDomain: "YOUR_APP.firebaseapp.com", // Auth with popup/redirect
376
+ * databaseURL: "https://YOUR_APP.firebaseio.com", // Realtime Database
377
+ * storageBucket: "YOUR_APP.appspot.com", // Storage
378
+ * messagingSenderId: "123456789" // Cloud Messaging
379
+ * },
380
+ * {
381
+ * authIdToken: "Your Auth ID Token"
382
+ * });
383
+ * ```
384
+ *
385
+ * @param options - `Firebase.AppOptions` to configure the app's services, or a
386
+ * a `FirebaseApp` instance which contains the `AppOptions` within.
387
+ * @param config - `FirebaseServerApp` configuration.
388
+ *
389
+ * @returns The initialized `FirebaseServerApp`.
390
+ *
391
+ * @public
392
+ */
393
+ export declare function initializeServerApp(options: FirebaseOptions | FirebaseApp, config: FirebaseServerAppSettings): FirebaseServerApp;
394
+
395
+ /* Excluded from this release type: _isFirebaseApp */
396
+
397
+ /* Excluded from this release type: _isFirebaseServerApp */
398
+
270
399
  /**
271
400
  * Sets log handler for all Firebase SDKs.
272
401
  * @param logCallback - An optional custom log handler that executes user code whenever
@@ -297,6 +426,8 @@ export declare function registerVersion(libraryKeyOrName: string, version: strin
297
426
  */
298
427
  export declare const SDK_VERSION: string;
299
428
 
429
+ /* Excluded from this release type: _serverApps */
430
+
300
431
  /**
301
432
  * Sets log level for all Firebase SDKs.
302
433
  *