Skip to content

Commit 7676e91

Browse files
authored
Merge 04af931 into f478845
2 parents f478845 + 04af931 commit 7676e91

13 files changed

+955
-23
lines changed

common/api-review/app.api.md

+26
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,23 @@ export interface FirebaseOptions {
7171
storageBucket?: string;
7272
}
7373

74+
// @public
75+
export interface FirebaseServerApp extends FirebaseApp {
76+
appCheckTokenVerified: () => Promise<void>;
77+
authIdTokenVerified: () => Promise<void>;
78+
installationTokenVerified: () => Promise<void>;
79+
name: string;
80+
}
81+
82+
// @public
83+
export interface FirebaseServerAppSettings extends FirebaseAppSettings {
84+
appCheckToken?: string;
85+
authIdToken?: string;
86+
installationsAuthToken?: string;
87+
name?: undefined;
88+
releaseOnDeref?: object;
89+
}
90+
7491
// @internal (undocumented)
7592
export interface _FirebaseService {
7693
// (undocumented)
@@ -96,6 +113,12 @@ export function initializeApp(options: FirebaseOptions, config?: FirebaseAppSett
96113
// @public
97114
export function initializeApp(): FirebaseApp;
98115

116+
// @public
117+
export function initializeServerApp(options: FirebaseOptions | FirebaseApp, config: FirebaseServerAppSettings): FirebaseServerApp;
118+
119+
// @internal (undocumented)
120+
export function _isFirebaseApp(obj: FirebaseApp | FirebaseOptions): obj is FirebaseApp;
121+
99122
// @public
100123
export function onLog(logCallback: LogCallback | null, options?: LogOptions): void;
101124

@@ -111,6 +134,9 @@ export function _removeServiceInstance<T extends Name>(app: FirebaseApp, name: T
111134
// @public
112135
export const SDK_VERSION: string;
113136

137+
// @public (undocumented)
138+
export const _serverApps: Map<string, FirebaseServerApp>;
139+
114140
// @public
115141
export function setLogLevel(logLevel: LogLevelString): void;
116142

config/tsconfig.base.json

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"es2015.core",
1616
"es2017.object",
1717
"es2017.string",
18+
"ESNext.WeakRef",
1819
],
1920
"module": "ES2015",
2021
"moduleResolution": "node",

docs-devsite/app.firebaseserverapp.md

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
Project: /docs/reference/js/_project.yaml
2+
Book: /docs/reference/_book.yaml
3+
page_type: reference
4+
5+
{% comment %}
6+
DO NOT EDIT THIS FILE!
7+
This is generated by the JS SDK team, and any local changes will be
8+
overwritten. Changes should be made in the source code at
9+
https://github.com/firebase/firebase-js-sdk
10+
{% endcomment %}
11+
12+
# FirebaseServerApp interface
13+
A [FirebaseServerApp](./app.firebaseserverapp.md#firebaseserverapp_interface) holds the initialization information for a collection of services running in server enviornments.
14+
15+
Do not call this constructor directly. Instead, use to create an app.
16+
17+
<b>Signature:</b>
18+
19+
```typescript
20+
export interface FirebaseServerApp extends FirebaseApp
21+
```
22+
<b>Extends:</b> [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)
23+
24+
## Properties
25+
26+
| Property | Type | Description |
27+
| --- | --- | --- |
28+
| [appCheckTokenVerified](./app.firebaseserverapp.md#firebaseserverappappchecktokenverified) | () =&gt; Promise&lt;void&gt; | Checks to see if the verification of the appCheckToken provided to has completed. If the optional appCheckToken parameter was omitted then the returned Promise is completed immediately.<!-- -->It is recommend that your application awaits this promise before initializing any Firebase products that use AppCheck. The Firebase SDKs will not use App Check tokens that are determined to be invalid or those that have not yet completed validation.<!-- -->The returned Promise is completed immediately if the optional appCheckToken parameter was omitted from FirebaseServerApp initialization. |
29+
| [authIdTokenVerified](./app.firebaseserverapp.md#firebaseserverappauthidtokenverified) | () =&gt; Promise&lt;void&gt; | Checks to see if the verification of the authIdToken provided to has completed.<!-- -->It is recommend that your application awaits this promise if an authIdToken was provided during FirebaseServerApp initialization before invoking getAuth(). If an instance of Auth is created before the Auth ID Token is validated, then the token will not be used by that instance of the Auth SDK.<!-- -->The returned Promise is completed immediately if the optional authIdToken parameter was omitted from FirebaseServerApp initialization. |
30+
| [installationTokenVerified](./app.firebaseserverapp.md#firebaseserverappinstallationtokenverified) | () =&gt; Promise&lt;void&gt; | Checks to see if the verification of the installationToken provided to has completed.<!-- -->It is recommend that your application awaits this promise before initializing any Firebase products that use Firebase Installations. The Firebase SDKs will not use Installation Auth tokens that are determined to be invalid or those that have not yet completed validation.<!-- -->The returned Promise is completed immediately if the optional appCheckToken parameter was omitted from FirebaseServerApp initialization. |
31+
| [name](./app.firebaseserverapp.md#firebaseserverappname) | string | There is no get for FirebaseServerApp, so the name is not relevant. However, it's declared here so that FirebaseServerApp conforms to the FirebaseApp interface declaration. Internally this string will always be empty for FirebaseServerApp instances. |
32+
33+
## FirebaseServerApp.appCheckTokenVerified
34+
35+
Checks to see if the verification of the appCheckToken provided to has completed. If the optional appCheckToken parameter was omitted then the returned Promise is completed immediately.
36+
37+
It is recommend that your application awaits this promise before initializing any Firebase products that use AppCheck. The Firebase SDKs will not use App Check tokens that are determined to be invalid or those that have not yet completed validation.
38+
39+
The returned Promise is completed immediately if the optional appCheckToken parameter was omitted from FirebaseServerApp initialization.
40+
41+
<b>Signature:</b>
42+
43+
```typescript
44+
appCheckTokenVerified: () => Promise<void>;
45+
```
46+
47+
## FirebaseServerApp.authIdTokenVerified
48+
49+
Checks to see if the verification of the authIdToken provided to has completed.
50+
51+
It is recommend that your application awaits this promise if an authIdToken was provided during FirebaseServerApp initialization before invoking getAuth(). If an instance of Auth is created before the Auth ID Token is validated, then the token will not be used by that instance of the Auth SDK.
52+
53+
The returned Promise is completed immediately if the optional authIdToken parameter was omitted from FirebaseServerApp initialization.
54+
55+
<b>Signature:</b>
56+
57+
```typescript
58+
authIdTokenVerified: () => Promise<void>;
59+
```
60+
61+
## FirebaseServerApp.installationTokenVerified
62+
63+
Checks to see if the verification of the installationToken provided to has completed.
64+
65+
It is recommend that your application awaits this promise before initializing any Firebase products that use Firebase Installations. The Firebase SDKs will not use Installation Auth tokens that are determined to be invalid or those that have not yet completed validation.
66+
67+
The returned Promise is completed immediately if the optional appCheckToken parameter was omitted from FirebaseServerApp initialization.
68+
69+
<b>Signature:</b>
70+
71+
```typescript
72+
installationTokenVerified: () => Promise<void>;
73+
```
74+
75+
## FirebaseServerApp.name
76+
77+
There is no get for FirebaseServerApp, so the name is not relevant. However, it's declared here so that FirebaseServerApp conforms to the FirebaseApp interface declaration. Internally this string will always be empty for FirebaseServerApp instances.
78+
79+
<b>Signature:</b>
80+
81+
```typescript
82+
name: string;
83+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
Project: /docs/reference/js/_project.yaml
2+
Book: /docs/reference/_book.yaml
3+
page_type: reference
4+
5+
{% comment %}
6+
DO NOT EDIT THIS FILE!
7+
This is generated by the JS SDK team, and any local changes will be
8+
overwritten. Changes should be made in the source code at
9+
https://github.com/firebase/firebase-js-sdk
10+
{% endcomment %}
11+
12+
# FirebaseServerAppSettings interface
13+
Configuration options given to [initializeServerApp()](./app.md#initializeserverapp_30ab697)
14+
15+
<b>Signature:</b>
16+
17+
```typescript
18+
export interface FirebaseServerAppSettings extends FirebaseAppSettings
19+
```
20+
<b>Extends:</b> [FirebaseAppSettings](./app.firebaseappsettings.md#firebaseappsettings_interface)
21+
22+
## Properties
23+
24+
| Property | Type | Description |
25+
| --- | --- | --- |
26+
| [appCheckToken](./app.firebaseserverappsettings.md#firebaseserverappsettingsappchecktoken) | string | An optional AppCheck token.<!-- -->If provided, the FirebaseServerApp instance will work to validate the token. The result of the validation can be monitored by invoking the FirebaseServerApp.appCheckTokenVerified(). Awaiting the Promise returned by appCheckTokenVerified is highly recommended if an AppCheck token is provided.<!-- -->If the token has been properly verified then the AppCheck token will be automatically used by Firebase SDKs that support App Check.<!-- -->If the token fails verification then a warning is logged and the token will not be used. |
27+
| [authIdToken](./app.firebaseserverappsettings.md#firebaseserverappsettingsauthidtoken) | string | An optional Auth ID token used to resume a signed in user session from a client runtime environment.<!-- -->If provided, the FirebaseServerApp instance will work to validate the token. The result of the validation can be queried via by the application by invoking the FirebaseServerApp.authIdTokenVerified(). Awaiting the Promise returned by authIdTokenVerified is highly recommended if an Auth ID token is provided.<!-- -->Once the token has been properly verified then invoking getAuth() will attempt to automatically sign in a user with the provided Auth ID Token.<!-- -->If the token fails verification then a warning is logged and Auth SDK will not attempt to sign in a user upon its initalization. |
28+
| [installationsAuthToken](./app.firebaseserverappsettings.md#firebaseserverappsettingsinstallationsauthtoken) | string | An optional Installation Auth token.<!-- -->If provided, the FirebaseServerApp instance will work to validate the token. The result of the validation can be monitored by invoking the FirebaseServerApp.installationTokenVerified(). Awaiting the Promise returned by appCheckTokenVerified is highly recommended before initalization any other Firebase SDKs.<!-- -->If the token has been properly verified then the Installation Auth token will be automatically used by Firebase SDKs that support Firebase Installations.<!-- -->If the token fails verification then a warning is logged and the token will not be used. |
29+
| [name](./app.firebaseserverappsettings.md#firebaseserverappsettingsname) | undefined | There is no get for FirebaseServerApps, so the name is not relevant. however it's always a blank string so that FirebaseServerApp conforms to the FirebaseApp interface declaration. |
30+
| [releaseOnDeref](./app.firebaseserverappsettings.md#firebaseserverappsettingsreleaseonderef) | object | An optional object. If provided, the Firebase SDK will use a FinalizationRegistry object to monitor the Garbage Collection status of the provided object, and the Firebase SDK will release its refrence on the FirebaseServerApp instance when the provided object is collected. or.<!-- -->The intent of this field is to help reduce memory overhead for long-running cloud functions executing SSR fulfillment without the customer's app needing to orchestrate FirebaseServerApp cleanup. Additionally, prexisting FirebaseServerApp instances may reused if they're identical to a previously generated one that has yet to be deleted.<!-- -->If the object is not provided then the application must clean up the FirebaseServerApp instance through the applicationss own standard mechanisms by invoking deleteApp.<!-- -->If the app provides an object in this parameter, but the application is executed in a JavaScript engine that predates the support of FinalizationRegistry (introduced in node v14.6.0, for instance), then the Firebase SDK will not be able to automatically clean up the FirebaseServerApp instance and an error will be thrown. |
31+
32+
## FirebaseServerAppSettings.appCheckToken
33+
34+
An optional AppCheck token.
35+
36+
If provided, the FirebaseServerApp instance will work to validate the token. The result of the validation can be monitored by invoking the FirebaseServerApp.appCheckTokenVerified(). Awaiting the Promise returned by appCheckTokenVerified is highly recommended if an AppCheck token is provided.
37+
38+
If the token has been properly verified then the AppCheck token will be automatically used by Firebase SDKs that support App Check.
39+
40+
If the token fails verification then a warning is logged and the token will not be used.
41+
42+
<b>Signature:</b>
43+
44+
```typescript
45+
appCheckToken?: string;
46+
```
47+
48+
## FirebaseServerAppSettings.authIdToken
49+
50+
An optional Auth ID token used to resume a signed in user session from a client runtime environment.
51+
52+
If provided, the FirebaseServerApp instance will work to validate the token. The result of the validation can be queried via by the application by invoking the FirebaseServerApp.authIdTokenVerified(). Awaiting the Promise returned by authIdTokenVerified is highly recommended if an Auth ID token is provided.
53+
54+
Once the token has been properly verified then invoking getAuth() will attempt to automatically sign in a user with the provided Auth ID Token.
55+
56+
If the token fails verification then a warning is logged and Auth SDK will not attempt to sign in a user upon its initalization.
57+
58+
<b>Signature:</b>
59+
60+
```typescript
61+
authIdToken?: string;
62+
```
63+
64+
## FirebaseServerAppSettings.installationsAuthToken
65+
66+
An optional Installation Auth token.
67+
68+
If provided, the FirebaseServerApp instance will work to validate the token. The result of the validation can be monitored by invoking the FirebaseServerApp.installationTokenVerified(). Awaiting the Promise returned by appCheckTokenVerified is highly recommended before initalization any other Firebase SDKs.
69+
70+
If the token has been properly verified then the Installation Auth token will be automatically used by Firebase SDKs that support Firebase Installations.
71+
72+
If the token fails verification then a warning is logged and the token will not be used.
73+
74+
<b>Signature:</b>
75+
76+
```typescript
77+
installationsAuthToken?: string;
78+
```
79+
80+
## FirebaseServerAppSettings.name
81+
82+
There is no get for FirebaseServerApps, so the name is not relevant. however it's always a blank string so that FirebaseServerApp conforms to the FirebaseApp interface declaration.
83+
84+
<b>Signature:</b>
85+
86+
```typescript
87+
name?: undefined;
88+
```
89+
90+
## FirebaseServerAppSettings.releaseOnDeref
91+
92+
An optional object. If provided, the Firebase SDK will use a FinalizationRegistry object to monitor the Garbage Collection status of the provided object, and the Firebase SDK will release its refrence on the FirebaseServerApp instance when the provided object is collected. or.
93+
94+
The intent of this field is to help reduce memory overhead for long-running cloud functions executing SSR fulfillment without the customer's app needing to orchestrate FirebaseServerApp cleanup. Additionally, prexisting FirebaseServerApp instances may reused if they're identical to a previously generated one that has yet to be deleted.
95+
96+
If the object is not provided then the application must clean up the FirebaseServerApp instance through the applicationss own standard mechanisms by invoking deleteApp.
97+
98+
If the app provides an object in this parameter, but the application is executed in a JavaScript engine that predates the support of FinalizationRegistry (introduced in node v14.6.0, for instance), then the Firebase SDK will not be able to automatically clean up the FirebaseServerApp instance and an error will be thrown.
99+
100+
<b>Signature:</b>
101+
102+
```typescript
103+
releaseOnDeref?: object;
104+
```

0 commit comments

Comments
 (0)