@react-native-firebase/database 22.4.0 → 23.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [23.0.1](https://github.com/invertase/react-native-firebase/compare/v23.0.0...v23.0.1) (2025-08-12)
7
+
8
+ **Note:** Version bump only for package @react-native-firebase/database
9
+
10
+ ## [23.0.0](https://github.com/invertase/react-native-firebase/compare/v22.4.0...v23.0.0) (2025-08-07)
11
+
12
+ **Note:** Version bump only for package @react-native-firebase/database
13
+
6
14
  ## [22.4.0](https://github.com/invertase/react-native-firebase/compare/v22.3.0...v22.4.0) (2025-07-10)
7
15
 
8
16
  **Note:** Version bump only for package @react-native-firebase/database
@@ -24,13 +24,14 @@ import {
24
24
  } from '@react-native-firebase/app/lib/common';
25
25
  import { deepGet } from '@react-native-firebase/app/lib/common/deeps';
26
26
 
27
+ import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/lib/common';
27
28
  export default class DatabaseDataSnapshot {
28
29
  constructor(reference, snapshot) {
29
30
  this._snapshot = snapshot;
30
31
 
31
32
  if (reference.key !== snapshot.key) {
32
33
  // reference is a query?
33
- this._ref = reference.ref.child(snapshot.key);
34
+ this._ref = reference.ref.child.call(reference.ref, snapshot.key, MODULAR_DEPRECATION_ARG);
34
35
  } else {
35
36
  this._ref = reference;
36
37
  }
@@ -65,7 +66,7 @@ export default class DatabaseDataSnapshot {
65
66
  value = null;
66
67
  }
67
68
 
68
- const childRef = this._ref.child(path);
69
+ const childRef = this._ref.child.call(this._ref, path, MODULAR_DEPRECATION_ARG);
69
70
 
70
71
  let childPriority = null;
71
72
  if (this._snapshot.childPriorities) {
@@ -137,7 +138,7 @@ export default class DatabaseDataSnapshot {
137
138
 
138
139
  for (let i = 0; i < this._snapshot.childKeys.length; i++) {
139
140
  const key = this._snapshot.childKeys[i];
140
- const snapshot = this.child(key);
141
+ const snapshot = this.child.call(this, key, MODULAR_DEPRECATION_ARG);
141
142
  const actionReturn = action(snapshot, i);
142
143
 
143
144
  if (actionReturn === true) {
@@ -26,6 +26,8 @@ import {
26
26
  pathIsEmpty,
27
27
  pathToUrlEncodedString,
28
28
  ReferenceBase,
29
+ createDeprecationProxy,
30
+ MODULAR_DEPRECATION_ARG,
29
31
  } from '@react-native-firebase/app/lib/common';
30
32
  import DatabaseDataSnapshot from './DatabaseDataSnapshot';
31
33
  import DatabaseSyncTree from './DatabaseSyncTree';
@@ -52,7 +54,7 @@ export default class DatabaseQuery extends ReferenceBase {
52
54
  * @url https://firebase.google.com/docs/reference/js/firebase.database.Query.html#endat
53
55
  */
54
56
  get ref() {
55
- return new DatabaseReference(this._database, this.path);
57
+ return createDeprecationProxy(new DatabaseReference(this._database, this.path));
56
58
  }
57
59
 
58
60
  /**
@@ -83,7 +85,7 @@ export default class DatabaseQuery extends ReferenceBase {
83
85
  const modifiers = this._modifiers._copy().endAt(value, key);
84
86
  modifiers.validateModifiers('firebase.database().ref().endAt()');
85
87
 
86
- return new DatabaseQuery(this._database, this.path, modifiers);
88
+ return createDeprecationProxy(new DatabaseQuery(this._database, this.path, modifiers));
87
89
  }
88
90
 
89
91
  /**
@@ -117,7 +119,10 @@ export default class DatabaseQuery extends ReferenceBase {
117
119
  );
118
120
  }
119
121
 
120
- return this.startAt(value, key).endAt(value, key);
122
+ // Internal method calls should always use MODULAR_DEPRECATION_ARG to avoid false deprecation warnings
123
+ return this.startAt
124
+ .call(this, value, key, MODULAR_DEPRECATION_ARG)
125
+ .endAt.call(this, value, MODULAR_DEPRECATION_ARG);
121
126
  }
122
127
 
123
128
  /**
@@ -155,10 +160,8 @@ export default class DatabaseQuery extends ReferenceBase {
155
160
  );
156
161
  }
157
162
 
158
- return new DatabaseQuery(
159
- this._database,
160
- this.path,
161
- this._modifiers._copy().limitToFirst(limit),
163
+ return createDeprecationProxy(
164
+ new DatabaseQuery(this._database, this.path, this._modifiers._copy().limitToFirst(limit)),
162
165
  );
163
166
  }
164
167
 
@@ -180,7 +183,9 @@ export default class DatabaseQuery extends ReferenceBase {
180
183
  );
181
184
  }
182
185
 
183
- return new DatabaseQuery(this._database, this.path, this._modifiers._copy().limitToLast(limit));
186
+ return createDeprecationProxy(
187
+ new DatabaseQuery(this._database, this.path, this._modifiers._copy().limitToLast(limit)),
188
+ );
184
189
  }
185
190
 
186
191
  /**
@@ -210,7 +215,7 @@ export default class DatabaseQuery extends ReferenceBase {
210
215
  throw new Error("firebase.database().ref().off(_, *) 'callback' must be a function.");
211
216
  }
212
217
 
213
- if (!isUndefined(context) && !isObject(context)) {
218
+ if (!isUndefined(context) && !isNull(context) && !isObject(context)) {
214
219
  throw new Error("firebase.database().ref().off(_, _, *) 'context' must be an object.");
215
220
  }
216
221
 
@@ -279,7 +284,7 @@ export default class DatabaseQuery extends ReferenceBase {
279
284
  );
280
285
  }
281
286
 
282
- if (!isUndefined(context) && !isObject(context)) {
287
+ if (!isUndefined(context) && !isNull(context) && !isObject(context)) {
283
288
  throw new Error("firebase.database().ref().on(_, _, _, *) 'context' must be an object.");
284
289
  }
285
290
 
@@ -434,7 +439,7 @@ export default class DatabaseQuery extends ReferenceBase {
434
439
  const modifiers = this._modifiers._copy().orderByChild(path);
435
440
  modifiers.validateModifiers('firebase.database().ref().orderByChild()');
436
441
 
437
- return new DatabaseQuery(this._database, this.path, modifiers);
442
+ return createDeprecationProxy(new DatabaseQuery(this._database, this.path, modifiers));
438
443
  }
439
444
 
440
445
  /**
@@ -450,7 +455,7 @@ export default class DatabaseQuery extends ReferenceBase {
450
455
  const modifiers = this._modifiers._copy().orderByKey();
451
456
  modifiers.validateModifiers('firebase.database().ref().orderByKey()');
452
457
 
453
- return new DatabaseQuery(this._database, this.path, modifiers);
458
+ return createDeprecationProxy(new DatabaseQuery(this._database, this.path, modifiers));
454
459
  }
455
460
 
456
461
  /**
@@ -466,7 +471,7 @@ export default class DatabaseQuery extends ReferenceBase {
466
471
  const modifiers = this._modifiers._copy().orderByPriority();
467
472
  modifiers.validateModifiers('firebase.database().ref().orderByPriority()');
468
473
 
469
- return new DatabaseQuery(this._database, this.path, modifiers);
474
+ return createDeprecationProxy(new DatabaseQuery(this._database, this.path, modifiers));
470
475
  }
471
476
 
472
477
  /**
@@ -482,7 +487,7 @@ export default class DatabaseQuery extends ReferenceBase {
482
487
  const modifiers = this._modifiers._copy().orderByValue();
483
488
  modifiers.validateModifiers('firebase.database().ref().orderByValue()');
484
489
 
485
- return new DatabaseQuery(this._database, this.path, modifiers);
490
+ return createDeprecationProxy(new DatabaseQuery(this._database, this.path, modifiers));
486
491
  }
487
492
 
488
493
  startAt(value, key) {
@@ -507,7 +512,7 @@ export default class DatabaseQuery extends ReferenceBase {
507
512
  const modifiers = this._modifiers._copy().startAt(value, key);
508
513
  modifiers.validateModifiers('firebase.database().ref().startAt()');
509
514
 
510
- return new DatabaseQuery(this._database, this.path, modifiers);
515
+ return createDeprecationProxy(new DatabaseQuery(this._database, this.path, modifiers));
511
516
  }
512
517
 
513
518
  toJSON() {
@@ -28,6 +28,7 @@ import {
28
28
  pathChild,
29
29
  pathParent,
30
30
  promiseWithOptionalCallback,
31
+ createDeprecationProxy,
31
32
  } from '@react-native-firebase/app/lib/common';
32
33
  import DatabaseDataSnapshot from './DatabaseDataSnapshot';
33
34
  import DatabaseOnDisconnect from './DatabaseOnDisconnect';
@@ -210,7 +211,11 @@ export default class DatabaseReference extends DatabaseQuery {
210
211
  if (error) {
211
212
  onComplete(error, committed, null);
212
213
  } else {
213
- onComplete(null, committed, new DatabaseDataSnapshot(this, snapshotData));
214
+ onComplete(
215
+ null,
216
+ committed,
217
+ createDeprecationProxy(new DatabaseDataSnapshot(this, snapshotData)),
218
+ );
214
219
  }
215
220
  }
216
221
 
@@ -219,7 +224,7 @@ export default class DatabaseReference extends DatabaseQuery {
219
224
  }
220
225
  return resolve({
221
226
  committed,
222
- snapshot: new DatabaseDataSnapshot(this, snapshotData),
227
+ snapshot: createDeprecationProxy(new DatabaseDataSnapshot(this, snapshotData)),
223
228
  });
224
229
  };
225
230
 
package/lib/index.js CHANGED
@@ -15,7 +15,13 @@
15
15
  *
16
16
  */
17
17
 
18
- import { isAndroid, isBoolean, isNumber, isString } from '@react-native-firebase/app/lib/common';
18
+ import {
19
+ isAndroid,
20
+ isBoolean,
21
+ isNumber,
22
+ isString,
23
+ MODULAR_DEPRECATION_ARG,
24
+ } from '@react-native-firebase/app/lib/common';
19
25
  import {
20
26
  createModuleNamespace,
21
27
  FirebaseModule,
@@ -28,6 +34,8 @@ import DatabaseTransaction from './DatabaseTransaction';
28
34
  import version from './version';
29
35
  import fallBackModule from './web/RNFBDatabaseModule';
30
36
 
37
+ import { createDeprecationProxy } from '@react-native-firebase/app/lib/common';
38
+
31
39
  const namespace = 'database';
32
40
 
33
41
  const nativeModuleName = [
@@ -54,9 +62,13 @@ class FirebaseDatabaseModule extends FirebaseModule {
54
62
  * @private
55
63
  */
56
64
  _syncServerTimeOffset() {
57
- this.ref('.info/serverTimeOffset').on('value', snapshot => {
58
- this._serverTimeOffset = snapshot.val();
59
- });
65
+ this.ref('.info/serverTimeOffset').on(
66
+ 'value',
67
+ snapshot => {
68
+ this._serverTimeOffset = snapshot.val();
69
+ },
70
+ MODULAR_DEPRECATION_ARG,
71
+ );
60
72
  }
61
73
 
62
74
  /**
@@ -84,7 +96,7 @@ class FirebaseDatabaseModule extends FirebaseModule {
84
96
  );
85
97
  }
86
98
 
87
- return new DatabaseReference(this, path);
99
+ return createDeprecationProxy(new DatabaseReference(this, path));
88
100
  }
89
101
 
90
102
  /**
@@ -112,7 +124,7 @@ class FirebaseDatabaseModule extends FirebaseModule {
112
124
  path = path.slice(0, path.indexOf('?'));
113
125
  }
114
126
 
115
- return new DatabaseReference(this, path || '/');
127
+ return createDeprecationProxy(new DatabaseReference(this, path || '/'));
116
128
  }
117
129
 
118
130
  /**
@@ -220,6 +220,20 @@ export function getServerTime(db: Database): Promise<number>;
220
220
  */
221
221
  export function increment(delta: number): object;
222
222
 
223
+ /**
224
+ * Server specific values.
225
+ */
226
+ export const ServerValue: {
227
+ /**
228
+ * A placeholder value for auto-populating the current timestamp.
229
+ */
230
+ TIMESTAMP: object;
231
+ /**
232
+ * Returns a placeholder value that can be used to atomically increment the current database value.
233
+ */
234
+ increment(delta: number): object;
235
+ };
236
+
223
237
  /**
224
238
  * Logs debugging information to the console. Not implemented on native.
225
239
  *
@@ -2,6 +2,7 @@ import { getApp } from '@react-native-firebase/app';
2
2
  import DatabaseStatics from '../DatabaseStatics';
3
3
 
4
4
  const { ServerValue } = DatabaseStatics;
5
+ import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/lib/common';
5
6
 
6
7
  /**
7
8
  * @typedef {import("..").FirebaseApp} FirebaseApp
@@ -28,7 +29,7 @@ export function getDatabase(app, url) {
28
29
  * @returns {void}
29
30
  */
30
31
  export function connectDatabaseEmulator(db, host, port) {
31
- db.useEmulator(host, port);
32
+ db.useEmulator.call(db, host, port, MODULAR_DEPRECATION_ARG);
32
33
  }
33
34
 
34
35
  /**
@@ -36,7 +37,7 @@ export function connectDatabaseEmulator(db, host, port) {
36
37
  * @returns {Promise<void>}
37
38
  */
38
39
  export function goOffline(db) {
39
- return db.goOffline();
40
+ return db.goOffline.call(db, MODULAR_DEPRECATION_ARG);
40
41
  }
41
42
 
42
43
  /**
@@ -44,7 +45,7 @@ export function goOffline(db) {
44
45
  * @returns {Promise<void>}
45
46
  */
46
47
  export function goOnline(db) {
47
- return db.goOnline();
48
+ return db.goOnline.call(db, MODULAR_DEPRECATION_ARG);
48
49
  }
49
50
 
50
51
  /**
@@ -53,7 +54,7 @@ export function goOnline(db) {
53
54
  * @returns {DatabaseReference}
54
55
  */
55
56
  export function ref(db, path) {
56
- return db.ref(path);
57
+ return db.ref.call(db, path, MODULAR_DEPRECATION_ARG);
57
58
  }
58
59
 
59
60
  /**
@@ -62,7 +63,7 @@ export function ref(db, path) {
62
63
  * @returns {DatabaseReference}
63
64
  */
64
65
  export function refFromURL(db, url) {
65
- return db.refFromURL(url);
66
+ return db.refFromURL.call(db, url, MODULAR_DEPRECATION_ARG);
66
67
  }
67
68
 
68
69
  /**
@@ -71,7 +72,7 @@ export function refFromURL(db, url) {
71
72
  * @returns {void}
72
73
  */
73
74
  export function setPersistenceEnabled(db, enabled) {
74
- return db.setPersistenceEnabled(enabled);
75
+ return db.setPersistenceEnabled.call(db, enabled, MODULAR_DEPRECATION_ARG);
75
76
  }
76
77
 
77
78
  /**
@@ -80,7 +81,7 @@ export function setPersistenceEnabled(db, enabled) {
80
81
  * @returns {void}
81
82
  */
82
83
  export function setLoggingEnabled(db, enabled) {
83
- return db.setLoggingEnabled(enabled);
84
+ return db.setLoggingEnabled.call(db, enabled, MODULAR_DEPRECATION_ARG);
84
85
  }
85
86
 
86
87
  /**
@@ -89,7 +90,7 @@ export function setLoggingEnabled(db, enabled) {
89
90
  * @returns {void}
90
91
  */
91
92
  export function setPersistenceCacheSizeBytes(db, bytes) {
92
- return db.setPersistenceCacheSizeBytes(bytes);
93
+ return db.setPersistenceCacheSizeBytes.call(db, bytes, MODULAR_DEPRECATION_ARG);
93
94
  }
94
95
 
95
96
  export function forceLongPolling() {
@@ -105,7 +106,7 @@ export function forceWebSockets() {
105
106
  * @returns {Date}
106
107
  */
107
108
  export function getServerTime(db) {
108
- return db.getServerTime();
109
+ return db.getServerTime.call(db, MODULAR_DEPRECATION_ARG);
109
110
  }
110
111
 
111
112
  /**
@@ -120,9 +121,11 @@ export function serverTimestamp() {
120
121
  * @returns {object}
121
122
  */
122
123
  export function increment(delta) {
123
- return ServerValue.increment(delta);
124
+ return ServerValue.increment.call(ServerValue, delta, MODULAR_DEPRECATION_ARG);
124
125
  }
125
126
 
127
+ export { ServerValue };
128
+
126
129
  export function enableLogging(_enabled, _persistent) {
127
130
  throw new Error('enableLogging() is not implemented');
128
131
  }
@@ -13,6 +13,9 @@
13
13
  /**
14
14
  * @implements {IQueryConstraint}
15
15
  */
16
+
17
+ import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/lib/common';
18
+
16
19
  class QueryConstraint {
17
20
  constructor(type, ...args) {
18
21
  this._type = type;
@@ -20,8 +23,7 @@ class QueryConstraint {
20
23
  }
21
24
 
22
25
  _apply(query) {
23
- // eslint-disable-next-line prefer-spread
24
- return query[this._type].apply(query, this._args);
26
+ return query[this._type].apply(query, [...this._args, MODULAR_DEPRECATION_ARG]);
25
27
  }
26
28
  }
27
29
 
@@ -138,14 +140,14 @@ function addEventListener(query, eventType, callback, cancelCallbackOrListenOpti
138
140
  if (options && options.onlyOnce) {
139
141
  const userCallback = callback;
140
142
  callback = snapshot => {
141
- query.off(eventType, callback);
143
+ query.off.call(query, eventType, callback, null, MODULAR_DEPRECATION_ARG);
142
144
  return userCallback(snapshot);
143
145
  };
144
146
  }
145
147
 
146
- query.on(eventType, callback, cancelCallback);
148
+ query.on.call(query, eventType, callback, cancelCallback, null, MODULAR_DEPRECATION_ARG);
147
149
 
148
- return () => query.off(eventType, callback);
150
+ return () => query.off.call(query, eventType, callback, null, MODULAR_DEPRECATION_ARG);
149
151
  }
150
152
 
151
153
  /**
@@ -209,7 +211,7 @@ export function onChildRemoved(query, callback, cancelCallbackOrListenOptions, o
209
211
  * @returns {Promise<void>}
210
212
  */
211
213
  export function set(ref, value) {
212
- return ref.set(value);
214
+ return ref.set.call(ref, value, () => {}, MODULAR_DEPRECATION_ARG);
213
215
  }
214
216
 
215
217
  /**
@@ -218,7 +220,7 @@ export function set(ref, value) {
218
220
  * @returns {Promise<void>}
219
221
  */
220
222
  export function setPriority(ref, priority) {
221
- return ref.setPriority(priority);
223
+ return ref.setPriority.call(ref, priority, () => {}, MODULAR_DEPRECATION_ARG);
222
224
  }
223
225
 
224
226
  /**
@@ -228,7 +230,7 @@ export function setPriority(ref, priority) {
228
230
  * @returns {Promise<void>}
229
231
  */
230
232
  export function setWithPriority(ref, value, priority) {
231
- return ref.setWithPriority(value, priority);
233
+ return ref.setWithPriority.call(ref, value, priority, () => {}, MODULAR_DEPRECATION_ARG);
232
234
  }
233
235
 
234
236
  /**
@@ -236,7 +238,14 @@ export function setWithPriority(ref, value, priority) {
236
238
  * @returns {DataSnapshot}
237
239
  */
238
240
  export function get(query) {
239
- return query.once('value');
241
+ return query.once.call(
242
+ query,
243
+ 'value',
244
+ () => {},
245
+ () => {},
246
+ {},
247
+ MODULAR_DEPRECATION_ARG,
248
+ );
240
249
  }
241
250
 
242
251
  export function off(_query, _eventType, _callback) {
@@ -249,7 +258,7 @@ export function off(_query, _eventType, _callback) {
249
258
  * @returns {DatabaseReference}
250
259
  */
251
260
  export function child(parent, path) {
252
- return parent.child(path);
261
+ return parent.child.call(parent, path, MODULAR_DEPRECATION_ARG);
253
262
  }
254
263
 
255
264
  /**
@@ -257,7 +266,7 @@ export function child(parent, path) {
257
266
  * @returns {OnDisconnect}
258
267
  */
259
268
  export function onDisconnect(ref) {
260
- return ref.onDisconnect();
269
+ return ref.onDisconnect.call(ref, MODULAR_DEPRECATION_ARG);
261
270
  }
262
271
 
263
272
  /**
@@ -266,7 +275,7 @@ export function onDisconnect(ref) {
266
275
  * @returns {Promise<void>}
267
276
  */
268
277
  export function keepSynced(ref, value) {
269
- return ref.keepSynced(value);
278
+ return ref.keepSynced.call(ref, value, MODULAR_DEPRECATION_ARG);
270
279
  }
271
280
 
272
281
  /**
@@ -275,7 +284,7 @@ export function keepSynced(ref, value) {
275
284
  * @returns {ThenableReference}
276
285
  */
277
286
  export function push(parent, value) {
278
- return parent.push(value);
287
+ return parent.push.call(parent, value, MODULAR_DEPRECATION_ARG);
279
288
  }
280
289
 
281
290
  /**
@@ -283,7 +292,7 @@ export function push(parent, value) {
283
292
  * @returns {Promise<void>}
284
293
  */
285
294
  export function remove(ref) {
286
- return ref.remove();
295
+ return ref.remove.call(ref, MODULAR_DEPRECATION_ARG);
287
296
  }
288
297
 
289
298
  /**
@@ -292,5 +301,5 @@ export function remove(ref) {
292
301
  * @returns {Promise<void>}
293
302
  */
294
303
  export function update(ref, values) {
295
- return ref.update(values);
304
+ return ref.update.call(ref, values, MODULAR_DEPRECATION_ARG);
296
305
  }
@@ -10,6 +10,15 @@
10
10
  * @param {TransactionOptions?} options
11
11
  * @returns {Promise<TransactionResult>}
12
12
  */
13
+
14
+ import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/lib/common';
15
+
13
16
  export function runTransaction(ref, transactionUpdate, options) {
14
- return ref.transaction(transactionUpdate, undefined, options && options.applyLocally);
17
+ return ref.transaction.call(
18
+ ref,
19
+ transactionUpdate,
20
+ undefined,
21
+ options && options.applyLocally,
22
+ MODULAR_DEPRECATION_ARG,
23
+ );
15
24
  }
package/lib/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- module.exports = '22.4.0';
2
+ module.exports = '23.0.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-firebase/database",
3
- "version": "22.4.0",
3
+ "version": "23.0.1",
4
4
  "author": "Invertase <oss@invertase.io> (http://invertase.io)",
5
5
  "description": "React Native Firebase - The Firebase Realtime Database is a cloud-hosted database. Data is stored as JSON and synchronized in realtime to every connected client. React Native Firebase provides native integration with the Android & iOS Firebase SDKs, supporting both realtime data sync and offline capabilities.",
6
6
  "main": "lib/index.js",
@@ -25,11 +25,11 @@
25
25
  "realtome database"
26
26
  ],
27
27
  "peerDependencies": {
28
- "@react-native-firebase/app": "22.4.0"
28
+ "@react-native-firebase/app": "23.0.1"
29
29
  },
30
30
  "publishConfig": {
31
31
  "access": "public",
32
32
  "provenance": true
33
33
  },
34
- "gitHead": "7eaaf185aab15c7e4fc3c218af9be609fe7e0030"
34
+ "gitHead": "bad0f509650c81b7a2961a90a5501d3b9696f1d0"
35
35
  }