@@ -268,6 +268,47 @@ const mapOfDeprecationReplacements = {
268268 setCrashlyticsCollectionEnabled : 'setCrashlyticsCollectionEnabled()' ,
269269 } ,
270270 } ,
271+
272+ database : {
273+ default : {
274+ useEmulator : 'connectDatabaseEmulator()' ,
275+ goOffline : 'goOffline()' ,
276+ goOnline : 'goOnline()' ,
277+ ref : 'ref()' ,
278+ refFromURL : 'refFromURL()' ,
279+ setPersistenceEnabled : 'setPersistenceEnabled()' ,
280+ setLoggingEnabled : 'setLoggingEnabled()' ,
281+ setPersistenceCacheSizeBytes : 'setPersistenceCacheSizeBytes()' ,
282+ getServerTime : 'getServerTime()' ,
283+ } ,
284+ statics : {
285+ ServerValue : 'ServerValue' ,
286+ } ,
287+ DatabaseReference : {
288+ child : 'child()' ,
289+ set : 'set()' ,
290+ update : 'update()' ,
291+ setWithPriority : 'setWithPriority()' ,
292+ remove : 'remove()' ,
293+ on : 'onValue()' ,
294+ once : 'get()' ,
295+ endAt : 'endAt()' ,
296+ endBefore : 'endBefore()' ,
297+ startAt : 'startAt()' ,
298+ startAfter : 'startAfter()' ,
299+ limitToFirst : 'limitToFirst()' ,
300+ limitToLast : 'limitToLast()' ,
301+ orderByChild : 'orderByChild()' ,
302+ orderByKey : 'orderByKey()' ,
303+ orderByValue : 'orderByValue()' ,
304+ equalTo : 'equalTo()' ,
305+ setPriority : 'setPriority()' ,
306+ push : 'push()' ,
307+ onDisconnect : 'onDisconnect()' ,
308+ keepSynced : 'keepSynced()' ,
309+ transaction : 'runTransaction()' ,
310+ } ,
311+ } ,
271312 firestore : {
272313 default : {
273314 batch : 'writeBatch()' ,
@@ -519,6 +560,9 @@ export function createMessage(
519560}
520561
521562function getNamespace ( target ) {
563+ if ( target . constructor . name === 'DatabaseReference' ) {
564+ return 'database' ;
565+ }
522566 if ( target . GeoPoint || target . CustomProvider ) {
523567 // target is statics object. GeoPoint - Firestore, CustomProvider - AppCheck
524568 return 'firestore' ;
@@ -529,7 +573,6 @@ function getNamespace(target) {
529573 if ( target . constructor . name === 'StorageReference' ) {
530574 return 'storage' ;
531575 }
532-
533576 const className = target . name ? target . name : target . constructor . name ;
534577 return Object . keys ( mapOfDeprecationReplacements ) . find ( key => {
535578 if ( mapOfDeprecationReplacements [ key ] [ className ] ) {
@@ -543,6 +586,9 @@ function getInstanceName(target) {
543586 // target is statics object. GeoPoint - Firestore, CustomProvider - AppCheck
544587 return 'statics' ;
545588 }
589+ if ( target . ServerValue ) {
590+ return 'statics' ;
591+ }
546592 if ( target . _config ) {
547593 // module class instance, we use default to store map of deprecated methods
548594 return 'default' ;
@@ -625,6 +671,9 @@ export function createDeprecationProxy(instance) {
625671 ) {
626672 deprecationConsoleWarning ( 'messaging' , prop , 'statics' , false ) ;
627673 }
674+ if ( prop === 'ServerValue' ) {
675+ deprecationConsoleWarning ( 'database' , prop , 'statics' , false ) ;
676+ }
628677
629678 if ( prop !== 'setLogLevel' ) {
630679 // we want to capture setLogLevel function call which we do below
0 commit comments