Skip to content

chore(database): deprecation warnings for v8 API ahead of future major release #8589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 50 additions & 1 deletion packages/app/lib/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,47 @@ const mapOfDeprecationReplacements = {
setCrashlyticsCollectionEnabled: 'setCrashlyticsCollectionEnabled()',
},
},

database: {
default: {
useEmulator: 'connectDatabaseEmulator()',
goOffline: 'goOffline()',
goOnline: 'goOnline()',
ref: 'ref()',
refFromURL: 'refFromURL()',
setPersistenceEnabled: 'setPersistenceEnabled()',
setLoggingEnabled: 'setLoggingEnabled()',
setPersistenceCacheSizeBytes: 'setPersistenceCacheSizeBytes()',
getServerTime: 'getServerTime()',
},
statics: {
ServerValue: 'ServerValue',
},
DatabaseReference: {
child: 'child()',
set: 'set()',
update: 'update()',
setWithPriority: 'setWithPriority()',
remove: 'remove()',
on: 'onValue()',
once: 'get()',
endAt: 'endAt()',
endBefore: 'endBefore()',
startAt: 'startAt()',
startAfter: 'startAfter()',
limitToFirst: 'limitToFirst()',
limitToLast: 'limitToLast()',
orderByChild: 'orderByChild()',
orderByKey: 'orderByKey()',
orderByValue: 'orderByValue()',
equalTo: 'equalTo()',
setPriority: 'setPriority()',
push: 'push()',
onDisconnect: 'onDisconnect()',
keepSynced: 'keepSynced()',
transaction: 'runTransaction()',
},
},
firestore: {
default: {
batch: 'writeBatch()',
Expand Down Expand Up @@ -519,6 +560,9 @@ export function createMessage(
}

function getNamespace(target) {
if (target.constructor.name === 'DatabaseReference') {
return 'database';
}
if (target.GeoPoint || target.CustomProvider) {
// target is statics object. GeoPoint - Firestore, CustomProvider - AppCheck
return 'firestore';
Expand All @@ -529,7 +573,6 @@ function getNamespace(target) {
if (target.constructor.name === 'StorageReference') {
return 'storage';
}

const className = target.name ? target.name : target.constructor.name;
return Object.keys(mapOfDeprecationReplacements).find(key => {
if (mapOfDeprecationReplacements[key][className]) {
Expand All @@ -543,6 +586,9 @@ function getInstanceName(target) {
// target is statics object. GeoPoint - Firestore, CustomProvider - AppCheck
return 'statics';
}
if (target.ServerValue) {
return 'statics';
}
if (target._config) {
// module class instance, we use default to store map of deprecated methods
return 'default';
Expand Down Expand Up @@ -625,6 +671,9 @@ export function createDeprecationProxy(instance) {
) {
deprecationConsoleWarning('messaging', prop, 'statics', false);
}
if (prop === 'ServerValue') {
deprecationConsoleWarning('database', prop, 'statics', false);
}

if (prop !== 'setLogLevel') {
// we want to capture setLogLevel function call which we do below
Expand Down
Loading
Loading