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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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 @@
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 @@
}

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 @@
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 @@
// target is statics object. GeoPoint - Firestore, CustomProvider - AppCheck
return 'statics';
}
if (target.ServerValue) {
return 'statics';

Check warning on line 590 in packages/app/lib/common/index.js

View check run for this annotation

Codecov / codecov/patch

packages/app/lib/common/index.js#L590

Added line #L590 was not covered by tests
}
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 @@
) {
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