@@ -30,13 +30,8 @@ import { setSDKVersion } from './src/core/version';
30
30
import { CONSTANTS , isNodeSdk } from '@firebase/util' ;
31
31
import { setWebSocketImpl } from './src/realtime/WebSocketConnection' ;
32
32
import { Client } from 'faye-websocket' ;
33
- import {
34
- Component ,
35
- ComponentType ,
36
- Provider ,
37
- ComponentContainer
38
- } from '@firebase/component' ;
39
- import { FirebaseAuthInternalName } from '@firebase/auth-interop-types' ;
33
+ import { Component , ComponentType } from '@firebase/component' ;
34
+ import { FirebaseAuthInternal } from '@firebase/auth-interop-types' ;
40
35
41
36
import { name , version } from './package.json' ;
42
37
@@ -46,7 +41,7 @@ const ServerValue = Database.ServerValue;
46
41
47
42
/**
48
43
* A one off register function which returns a database based on the app and
49
- * passed database URL.
44
+ * passed database URL. (Used by the Admin SDK)
50
45
*
51
46
* @param app A valid FirebaseApp-like object
52
47
* @param url A valid Firebase databaseURL
@@ -57,42 +52,16 @@ export function initStandalone(
57
52
app : FirebaseApp ,
58
53
url : string ,
59
54
version : string ,
60
- nodeAdmin : boolean = true
55
+ nodeAdmin = true
61
56
) {
62
- /**
63
- * This should allow the firebase-admin package to provide a custom version
64
- * to the backend
65
- */
66
57
CONSTANTS . NODE_ADMIN = nodeAdmin ;
67
- setSDKVersion ( version ) ;
68
-
69
- /**
70
- * Create a 'auth-internal' component using firebase-admin-node's implementation
71
- * that implements FirebaseAuthInternal.
72
- * ComponentContainer('database-admin') is just a placeholder that doesn't perform
73
- * any actual function.
74
- */
75
- const authProvider = new Provider < FirebaseAuthInternalName > (
76
- 'auth-internal' ,
77
- new ComponentContainer ( 'database-admin' )
78
- ) ;
79
- authProvider . setComponent (
80
- new Component (
81
- 'auth-internal' ,
82
- // firebase-admin-node's app.INTERNAL implements FirebaseAuthInternal interface
83
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
84
- ( ) => ( app as any ) . INTERNAL ,
85
- ComponentType . PRIVATE
86
- )
87
- ) ;
88
-
89
- return {
90
- instance : RepoManager . getInstance ( ) . databaseFromApp (
91
- app ,
92
- authProvider ,
93
- url ,
94
- nodeAdmin
95
- ) as types . Database ,
58
+ return INTERNAL . initStandalone ( {
59
+ app,
60
+ url,
61
+ version,
62
+ // firebase-admin-node's app.INTERNAL implements FirebaseAuthInternal interface
63
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
64
+ customAuthImpl : ( app as any ) . INTERNAL as FirebaseAuthInternal ,
96
65
namespace : {
97
66
Reference,
98
67
Query,
@@ -102,8 +71,9 @@ export function initStandalone(
102
71
INTERNAL ,
103
72
ServerValue,
104
73
TEST_ACCESS
105
- }
106
- } ;
74
+ } ,
75
+ nodeAdmin
76
+ } ) ;
107
77
}
108
78
109
79
export function registerDatabase ( instance : FirebaseNamespace ) {
0 commit comments