@@ -33,6 +33,10 @@ import {
33
33
import * as types from '@firebase/database-types' ;
34
34
35
35
import { Database } from './Database' ;
36
+ import {
37
+ AppCheckInternalComponentName ,
38
+ FirebaseAppCheckInternal
39
+ } from '@firebase/app-check-interop-types' ;
36
40
37
41
/**
38
42
* Used by console to create a database based on the app,
@@ -48,13 +52,15 @@ export function initStandalone<T>({
48
52
url,
49
53
version,
50
54
customAuthImpl,
55
+ customAppCheckImpl,
51
56
namespace,
52
57
nodeAdmin = false
53
58
} : {
54
59
app : FirebaseApp ;
55
60
url : string ;
56
61
version : string ;
57
62
customAuthImpl : FirebaseAuthInternal ;
63
+ customAppCheckImpl ?: FirebaseAppCheckInternal ;
58
64
namespace : T ;
59
65
nodeAdmin ?: boolean ;
60
66
} ) : {
@@ -63,24 +69,33 @@ export function initStandalone<T>({
63
69
} {
64
70
_setSDKVersion ( version ) ;
65
71
72
+ const container = new ComponentContainer ( 'database-standalone' ) ;
66
73
/**
67
74
* ComponentContainer('database-standalone') is just a placeholder that doesn't perform
68
75
* any actual function.
69
76
*/
70
77
const authProvider = new Provider < FirebaseAuthInternalName > (
71
78
'auth-internal' ,
72
- new ComponentContainer ( 'database-standalone' )
79
+ container
73
80
) ;
74
81
authProvider . setComponent (
75
82
new Component ( 'auth-internal' , ( ) => customAuthImpl , ComponentType . PRIVATE )
76
83
) ;
77
84
85
+ let appCheckProvider : Provider < AppCheckInternalComponentName > = undefined ;
86
+ if ( customAppCheckImpl ) {
87
+ appCheckProvider = new Provider < AppCheckInternalComponentName > (
88
+ 'app-check-internal' ,
89
+ container
90
+ ) ;
91
+ }
92
+
78
93
return {
79
94
instance : new Database (
80
95
_repoManagerDatabaseFromApp (
81
96
app ,
82
97
authProvider ,
83
- /* appCheckProvider= */ undefined ,
98
+ appCheckProvider ,
84
99
url ,
85
100
nodeAdmin
86
101
) ,
0 commit comments