Skip to content

Commit a1343cc

Browse files
committed
Included appcheck in initStandalone
1 parent da88cf6 commit a1343cc

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

packages/database-compat/src/api/internal.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ import {
3333
import * as types from '@firebase/database-types';
3434

3535
import { Database } from './Database';
36+
import {
37+
AppCheckInternalComponentName,
38+
FirebaseAppCheckInternal
39+
} from '@firebase/app-check-interop-types';
3640

3741
/**
3842
* Used by console to create a database based on the app,
@@ -48,13 +52,15 @@ export function initStandalone<T>({
4852
url,
4953
version,
5054
customAuthImpl,
55+
customAppCheckImpl,
5156
namespace,
5257
nodeAdmin = false
5358
}: {
5459
app: FirebaseApp;
5560
url: string;
5661
version: string;
5762
customAuthImpl: FirebaseAuthInternal;
63+
customAppCheckImpl?: FirebaseAppCheckInternal;
5864
namespace: T;
5965
nodeAdmin?: boolean;
6066
}): {
@@ -63,24 +69,33 @@ export function initStandalone<T>({
6369
} {
6470
_setSDKVersion(version);
6571

72+
const container = new ComponentContainer('database-standalone');
6673
/**
6774
* ComponentContainer('database-standalone') is just a placeholder that doesn't perform
6875
* any actual function.
6976
*/
7077
const authProvider = new Provider<FirebaseAuthInternalName>(
7178
'auth-internal',
72-
new ComponentContainer('database-standalone')
79+
container
7380
);
7481
authProvider.setComponent(
7582
new Component('auth-internal', () => customAuthImpl, ComponentType.PRIVATE)
7683
);
7784

85+
let appCheckProvider: Provider<AppCheckInternalComponentName> = undefined;
86+
if (customAppCheckImpl) {
87+
appCheckProvider = new Provider<AppCheckInternalComponentName>(
88+
'app-check-internal',
89+
container
90+
);
91+
}
92+
7893
return {
7994
instance: new Database(
8095
_repoManagerDatabaseFromApp(
8196
app,
8297
authProvider,
83-
/* appCheckProvider= */ undefined,
98+
appCheckProvider,
8499
url,
85100
nodeAdmin
86101
),

0 commit comments

Comments
 (0)