@@ -23,11 +23,12 @@ import { enableLogging } from '@firebase/database';
23
23
import * as types from '@firebase/database-types' ;
24
24
25
25
import { name , version } from '../package.json' ;
26
- import { Database } from '../src/api/Database' ;
26
+ import { Database as DatabaseCompat } from '../src/api/Database' ;
27
27
import * as INTERNAL from '../src/api/internal' ;
28
- import { DataSnapshot , Query , Reference } from '../src/api/Reference' ;
28
+ // rename the imports to avoid conflicts with imports that will be added by "yarn add-compat-overloads" during a release build
29
+ import { DataSnapshot as DataSnapshotCompat , Query as QueryCompat , Reference } from '../src/api/Reference' ;
29
30
30
- const ServerValue = Database . ServerValue ;
31
+ const ServerValue = DatabaseCompat . ServerValue ;
31
32
32
33
export function registerDatabase ( instance : FirebaseNamespace ) {
33
34
// Register the Database Service with the 'firebase' namespace.
@@ -43,17 +44,17 @@ export function registerDatabase(instance: FirebaseNamespace) {
43
44
const databaseExp = container
44
45
. getProvider ( 'database' )
45
46
. getImmediate ( { identifier : url } ) ;
46
- return new Database ( databaseExp , app ) ;
47
+ return new DatabaseCompat ( databaseExp , app ) ;
47
48
} ,
48
49
ComponentType . PUBLIC
49
50
)
50
51
. setServiceProps (
51
52
// firebase.database namespace properties
52
53
{
53
54
Reference,
54
- Query,
55
- Database,
56
- DataSnapshot,
55
+ Query : QueryCompat ,
56
+ Database : DatabaseCompat ,
57
+ DataSnapshot : DataSnapshotCompat ,
57
58
enableLogging,
58
59
INTERNAL ,
59
60
ServerValue
@@ -69,7 +70,7 @@ registerDatabase(firebase);
69
70
70
71
// Types to export for the admin SDK. They are exported here in the browser entry point only for types
71
72
// The same symbol should be exported from the node entry point so their values can be accessed at runtime by admin SDK
72
- export { Database , Query , Reference , enableLogging , ServerValue , DataSnapshot } ;
73
+ export { DatabaseCompat as Database , QueryCompat as Query , Reference , enableLogging , ServerValue , DataSnapshotCompat as DataSnapshot } ;
73
74
export { OnDisconnect } from '@firebase/database' ;
74
75
75
76
declare module '@firebase/app-compat' {
0 commit comments