18
18
// eslint-disable-next-line import/no-extraneous-dependencies
19
19
import { _FirebaseService , _getProvider , FirebaseApp } from '@firebase/app-exp' ;
20
20
import { Reference } from '../api/Reference' ;
21
- import { repoManagerDatabaseFromApp } from '../core/RepoManager' ;
22
21
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types' ;
23
- import { Database } from '../api/Database' ;
24
22
import { Provider } from '@firebase/component' ;
25
23
26
24
/**
27
25
* Class representing a Firebase Realtime Database.
28
26
*/
29
27
export class FirebaseDatabase implements _FirebaseService {
30
- static readonly ServerValue = Database . ServerValue ;
31
-
32
- private _delegate : Database ;
28
+ readonly 'type' = 'database' ;
33
29
34
30
constructor (
35
31
readonly app : FirebaseApp ,
36
32
authProvider : Provider < FirebaseAuthInternalName > ,
37
33
databaseUrl ?: string
38
- ) {
39
- this . _delegate = repoManagerDatabaseFromApp (
40
- this . app ,
41
- authProvider ,
42
- databaseUrl ,
43
- undefined
44
- ) ;
45
- }
46
-
47
- /**
48
- * Modify this instance to communicate with the Realtime Database emulator.
49
- *
50
- * <p>Note: This method must be called before performing any other operation.
51
- *
52
- * @param host - the emulator host (ex: localhost)
53
- * @param port - the emulator port (ex: 8080)
54
- */
55
- useEmulator ( host : string , port : number ) : void {
56
- this . _delegate . useEmulator ( host , port ) ;
57
- }
58
-
59
- /**
60
- * Returns a reference to the root or to the path specified in the provided
61
- * argument.
62
- *
63
- * @param path - The relative string path or an existing Reference to a
64
- * database location.
65
- * @throws If a Reference is provided, throws if it does not belong to the
66
- * same project.
67
- * @returns Firebase reference.
68
- */
69
- ref ( path ?: string ) : Reference ;
70
- ref ( path ?: Reference ) : Reference ;
71
- ref ( path ?: string | Reference ) : Reference {
72
- return typeof path === 'string'
73
- ? this . _delegate . ref ( path )
74
- : this . _delegate . ref ( path ) ;
75
- }
76
-
77
- /**
78
- * Returns a reference to the root or the path specified in url.
79
- * We throw a exception if the url is not in the same domain as the
80
- * current repo.
81
- * @param url - A URL that refers to a database location.
82
- * @returns A Firebase reference.
83
- */
84
- refFromURL ( url : string ) : Reference {
85
- return this . _delegate . refFromURL ( url ) ;
86
- }
87
-
88
- goOffline ( ) : void {
89
- this . _delegate . goOffline ( ) ;
90
- }
91
-
92
- goOnline ( ) : void {
93
- this . _delegate . goOnline ( ) ;
94
- }
34
+ ) { }
95
35
96
36
_delete ( ) : Promise < void > {
97
- return this . _delegate . INTERNAL . delete ( ) ;
37
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
+ return { } as any ;
98
39
}
99
-
100
- _setDatabaseUrl ( url : string ) { }
101
40
}
102
41
103
- const ServerValue = Database . ServerValue ;
104
- export { ServerValue } ;
105
-
106
42
/**
107
43
* Returns the instance of the Realtime Database SDK that is associated
108
44
* with the provided {@link FirebaseApp}. Initializes a new instance with
@@ -120,3 +56,43 @@ export function getDatabase(app: FirebaseApp, url?: string): FirebaseDatabase {
120
56
identifier : url
121
57
} ) as FirebaseDatabase ;
122
58
}
59
+
60
+ export function useDatabaseEmulator (
61
+ db : FirebaseDatabase ,
62
+ host : string ,
63
+ port : number
64
+ ) : void {
65
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
66
+ return { } as any ;
67
+ }
68
+
69
+ export function goOffline ( db : FirebaseDatabase ) : void {
70
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
71
+ return { } as any ;
72
+ }
73
+
74
+ export function goOnline ( db : FirebaseDatabase ) : void {
75
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
+ return { } as any ;
77
+ }
78
+
79
+ export function ref (
80
+ db : FirebaseDatabase ,
81
+ path ?: string | Reference
82
+ ) : Reference {
83
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
84
+ return { } as any ;
85
+ }
86
+
87
+ export function refFromURL ( db : FirebaseDatabase , url : string ) : Reference {
88
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
89
+ return { } as any ;
90
+ }
91
+
92
+ export function enableLogging (
93
+ logger ?: boolean | ( ( message : string ) => unknown ) ,
94
+ persistent ?: boolean
95
+ ) : void {
96
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
97
+ return { } as any ;
98
+ }
0 commit comments