@react-native-firebase/database 24.1.1 → 25.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.
Files changed (126) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/module/DatabaseDataSnapshot.js +144 -0
  3. package/dist/module/DatabaseDataSnapshot.js.map +1 -0
  4. package/dist/module/DatabaseOnDisconnect.js +84 -0
  5. package/dist/module/DatabaseOnDisconnect.js.map +1 -0
  6. package/dist/module/DatabaseQuery.js +298 -0
  7. package/dist/module/DatabaseQuery.js.map +1 -0
  8. package/{lib → dist/module}/DatabaseQueryModifiers.js +49 -98
  9. package/dist/module/DatabaseQueryModifiers.js.map +1 -0
  10. package/dist/module/DatabaseReference.js +169 -0
  11. package/dist/module/DatabaseReference.js.map +1 -0
  12. package/dist/module/DatabaseStatics.js +35 -0
  13. package/dist/module/DatabaseStatics.js.map +1 -0
  14. package/{lib → dist/module}/DatabaseSyncTree.js +74 -156
  15. package/dist/module/DatabaseSyncTree.js.map +1 -0
  16. package/{lib → dist/module}/DatabaseThenableReference.js +12 -12
  17. package/dist/module/DatabaseThenableReference.js.map +1 -0
  18. package/{lib → dist/module}/DatabaseTransaction.js +26 -89
  19. package/dist/module/DatabaseTransaction.js.map +1 -0
  20. package/dist/module/index.js +27 -0
  21. package/dist/module/index.js.map +1 -0
  22. package/dist/module/modular/query.js +138 -0
  23. package/dist/module/modular/query.js.map +1 -0
  24. package/dist/module/modular/transaction.js +24 -0
  25. package/dist/module/modular/transaction.js.map +1 -0
  26. package/dist/module/modular.js +76 -0
  27. package/dist/module/modular.js.map +1 -0
  28. package/dist/module/namespaced.js +147 -0
  29. package/dist/module/namespaced.js.map +1 -0
  30. package/dist/module/package.json +1 -0
  31. package/dist/module/types/database.js +21 -0
  32. package/dist/module/types/database.js.map +1 -0
  33. package/dist/module/types/internal.js +4 -0
  34. package/dist/module/types/internal.js.map +1 -0
  35. package/dist/module/types/namespaced.js +67 -0
  36. package/dist/module/types/namespaced.js.map +1 -0
  37. package/dist/module/version.js +5 -0
  38. package/dist/module/version.js.map +1 -0
  39. package/dist/module/web/RNFBDatabaseModule.android.js +6 -0
  40. package/dist/module/web/RNFBDatabaseModule.android.js.map +1 -0
  41. package/dist/module/web/RNFBDatabaseModule.ios.js +6 -0
  42. package/dist/module/web/RNFBDatabaseModule.ios.js.map +1 -0
  43. package/dist/module/web/RNFBDatabaseModule.js +375 -0
  44. package/dist/module/web/RNFBDatabaseModule.js.map +1 -0
  45. package/{lib → dist/module}/web/query.js +19 -24
  46. package/dist/module/web/query.js.map +1 -0
  47. package/dist/typescript/lib/DatabaseDataSnapshot.d.ts +20 -0
  48. package/dist/typescript/lib/DatabaseDataSnapshot.d.ts.map +1 -0
  49. package/dist/typescript/lib/DatabaseOnDisconnect.d.ts +19 -0
  50. package/dist/typescript/lib/DatabaseOnDisconnect.d.ts.map +1 -0
  51. package/dist/typescript/lib/DatabaseQuery.d.ts +32 -0
  52. package/dist/typescript/lib/DatabaseQuery.d.ts.map +1 -0
  53. package/dist/typescript/lib/DatabaseQueryModifiers.d.ts +55 -0
  54. package/dist/typescript/lib/DatabaseQueryModifiers.d.ts.map +1 -0
  55. package/dist/typescript/lib/DatabaseReference.d.ts +21 -0
  56. package/dist/typescript/lib/DatabaseReference.d.ts.map +1 -0
  57. package/dist/typescript/lib/DatabaseStatics.d.ts +10 -0
  58. package/dist/typescript/lib/DatabaseStatics.d.ts.map +1 -0
  59. package/dist/typescript/lib/DatabaseSyncTree.d.ts +72 -0
  60. package/dist/typescript/lib/DatabaseSyncTree.d.ts.map +1 -0
  61. package/dist/typescript/lib/DatabaseThenableReference.d.ts +13 -0
  62. package/dist/typescript/lib/DatabaseThenableReference.d.ts.map +1 -0
  63. package/dist/typescript/lib/DatabaseTransaction.d.ts +15 -0
  64. package/dist/typescript/lib/DatabaseTransaction.d.ts.map +1 -0
  65. package/dist/typescript/lib/index.d.ts +6 -0
  66. package/dist/typescript/lib/index.d.ts.map +1 -0
  67. package/dist/typescript/lib/modular/query.d.ts +41 -0
  68. package/dist/typescript/lib/modular/query.d.ts.map +1 -0
  69. package/dist/typescript/lib/modular/transaction.d.ts +3 -0
  70. package/dist/typescript/lib/modular/transaction.d.ts.map +1 -0
  71. package/dist/typescript/lib/modular.d.ts +24 -0
  72. package/dist/typescript/lib/modular.d.ts.map +1 -0
  73. package/dist/typescript/lib/namespaced.d.ts +13 -0
  74. package/dist/typescript/lib/namespaced.d.ts.map +1 -0
  75. package/dist/typescript/lib/types/database.d.ts +93 -0
  76. package/dist/typescript/lib/types/database.d.ts.map +1 -0
  77. package/dist/typescript/lib/types/internal.d.ts +189 -0
  78. package/dist/typescript/lib/types/internal.d.ts.map +1 -0
  79. package/dist/typescript/lib/types/namespaced.d.ts +1230 -0
  80. package/dist/typescript/lib/types/namespaced.d.ts.map +1 -0
  81. package/dist/typescript/lib/version.d.ts +2 -0
  82. package/dist/typescript/lib/version.d.ts.map +1 -0
  83. package/dist/typescript/lib/web/RNFBDatabaseModule.android.d.ts +3 -0
  84. package/dist/typescript/lib/web/RNFBDatabaseModule.android.d.ts.map +1 -0
  85. package/dist/typescript/lib/web/RNFBDatabaseModule.d.ts +3 -0
  86. package/dist/typescript/lib/web/RNFBDatabaseModule.d.ts.map +1 -0
  87. package/dist/typescript/lib/web/RNFBDatabaseModule.ios.d.ts +3 -0
  88. package/dist/typescript/lib/web/RNFBDatabaseModule.ios.d.ts.map +1 -0
  89. package/dist/typescript/lib/web/query.d.ts +13 -0
  90. package/dist/typescript/lib/web/query.d.ts.map +1 -0
  91. package/dist/typescript/package.json +1 -0
  92. package/lib/{DatabaseDataSnapshot.js → DatabaseDataSnapshot.ts} +62 -88
  93. package/lib/{DatabaseOnDisconnect.js → DatabaseOnDisconnect.ts} +25 -23
  94. package/lib/{DatabaseQuery.js → DatabaseQuery.ts} +130 -144
  95. package/lib/DatabaseQueryModifiers.ts +283 -0
  96. package/lib/{DatabaseReference.js → DatabaseReference.ts} +103 -85
  97. package/lib/{DatabaseStatics.js → DatabaseStatics.ts} +4 -2
  98. package/lib/DatabaseSyncTree.ts +390 -0
  99. package/lib/DatabaseThenableReference.ts +73 -0
  100. package/lib/DatabaseTransaction.ts +172 -0
  101. package/lib/index.ts +25 -0
  102. package/lib/modular/query.ts +410 -0
  103. package/lib/modular/transaction.ts +34 -0
  104. package/lib/modular.ts +134 -0
  105. package/lib/{index.js → namespaced.ts} +91 -90
  106. package/lib/types/database.ts +144 -0
  107. package/lib/types/internal.ts +317 -0
  108. package/lib/{index.d.ts → types/namespaced.ts} +48 -9
  109. package/lib/version.ts +2 -0
  110. package/lib/web/RNFBDatabaseModule.android.ts +4 -0
  111. package/lib/web/RNFBDatabaseModule.ios.ts +4 -0
  112. package/lib/web/RNFBDatabaseModule.ts +534 -0
  113. package/lib/web/query.ts +97 -0
  114. package/package.json +42 -7
  115. package/tsconfig.json +21 -0
  116. package/typedoc.json +3 -3
  117. package/lib/modular/index.d.ts +0 -246
  118. package/lib/modular/index.js +0 -134
  119. package/lib/modular/query.d.ts +0 -972
  120. package/lib/modular/query.js +0 -305
  121. package/lib/modular/transaction.d.ts +0 -54
  122. package/lib/modular/transaction.js +0 -24
  123. package/lib/version.js +0 -2
  124. package/lib/web/RNFBDatabaseModule.android.js +0 -2
  125. package/lib/web/RNFBDatabaseModule.ios.js +0 -2
  126. package/lib/web/RNFBDatabaseModule.js +0 -558
@@ -0,0 +1,317 @@
1
+ /*
2
+ * Copyright (c) 2016-present Invertase Limited & Contributors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this library except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ */
17
+
18
+ import type { ReactNativeFirebase } from '@react-native-firebase/app';
19
+ import type {
20
+ DataSnapshot,
21
+ Database,
22
+ DatabaseReference,
23
+ EventType,
24
+ EmulatorMockTokenOptions,
25
+ ListenOptions,
26
+ OnDisconnect,
27
+ Query,
28
+ QueryConstraint,
29
+ QueryConstraintType,
30
+ ThenableReference,
31
+ TransactionResult,
32
+ } from './database';
33
+ import type { FirebaseDatabaseTypes } from './namespaced';
34
+ import type { DatabaseQueryModifier } from '../DatabaseQueryModifiers';
35
+
36
+ /** Optional final argument passed by modular API wrappers (MODULAR_DEPRECATION_ARG). */
37
+ export type DatabaseModularDeprecationArg = string;
38
+
39
+ /** App instance with database() method (e.g. from getApp() when used for getDatabase()). */
40
+ export interface AppWithDatabaseInternal {
41
+ database(url?: string): Database;
42
+ }
43
+
44
+ /** Public database instance viewed through the modular wrapper methods. */
45
+ export interface DatabaseWithMethodsInternal extends Database {
46
+ useEmulator(
47
+ host: string,
48
+ port: number,
49
+ options?: { mockUserToken?: EmulatorMockTokenOptions | string },
50
+ deprecationArg?: DatabaseModularDeprecationArg,
51
+ ): unknown;
52
+ goOffline(deprecationArg?: DatabaseModularDeprecationArg): unknown;
53
+ goOnline(deprecationArg?: DatabaseModularDeprecationArg): unknown;
54
+ ref(path?: string, deprecationArg?: DatabaseModularDeprecationArg): DatabaseReference;
55
+ refFromURL(url: string, deprecationArg?: DatabaseModularDeprecationArg): DatabaseReference;
56
+ setPersistenceEnabled(enabled: boolean, deprecationArg?: DatabaseModularDeprecationArg): unknown;
57
+ setLoggingEnabled(enabled: boolean, deprecationArg?: DatabaseModularDeprecationArg): unknown;
58
+ setPersistenceCacheSizeBytes(
59
+ bytes: number,
60
+ deprecationArg?: DatabaseModularDeprecationArg,
61
+ ): unknown;
62
+ getServerTime(deprecationArg?: DatabaseModularDeprecationArg): Date;
63
+ }
64
+
65
+ /** Native emitter subscription returned by addListener. */
66
+ export interface DatabaseEmitterSubscriptionInternal {
67
+ remove(): void;
68
+ }
69
+
70
+ /** Serialized database snapshot payload received from native or web fallback modules. */
71
+ export interface DatabaseSnapshotInternal {
72
+ value: unknown;
73
+ key: string | null;
74
+ exists: boolean;
75
+ hasChildren?: boolean;
76
+ childrenCount?: number;
77
+ childKeys: string[];
78
+ priority?: string | number | null;
79
+ childPriorities?: Record<string, string | number | null | undefined>;
80
+ }
81
+
82
+ /** Child-event payload received from native once/on listeners. */
83
+ export interface DatabaseChildSnapshotResultInternal {
84
+ snapshot: DatabaseSnapshotInternal;
85
+ previousChildName?: string | null;
86
+ }
87
+
88
+ /** Query listener registration bookkeeping passed to native. */
89
+ export interface DatabaseListenRegistrationInternal {
90
+ eventRegistrationKey: string;
91
+ key: string;
92
+ registrationCancellationKey?: string;
93
+ }
94
+
95
+ /** Query subscription payload passed to native. */
96
+ export interface DatabaseListenPropsInternal {
97
+ key: string;
98
+ modifiers: DatabaseQueryModifier[];
99
+ path: string;
100
+ eventType: EventType;
101
+ registration: DatabaseListenRegistrationInternal;
102
+ }
103
+
104
+ /** Transaction commit payload sent to native. */
105
+ export interface DatabaseTransactionUpdatesInternal {
106
+ value: unknown;
107
+ abort: boolean;
108
+ }
109
+
110
+ /** Transaction bridge event payload received from native. */
111
+ export interface DatabaseTransactionEventInternal {
112
+ id: number;
113
+ body:
114
+ | {
115
+ type: 'update';
116
+ value?: unknown;
117
+ }
118
+ | {
119
+ type: 'error';
120
+ error?: unknown;
121
+ }
122
+ | {
123
+ type: 'complete';
124
+ committed?: boolean;
125
+ snapshot?: DatabaseSnapshotInternal;
126
+ }
127
+ | {
128
+ type: string;
129
+ [key: string]: unknown;
130
+ };
131
+ }
132
+
133
+ /** Shared emitter shape used by database transaction listeners. */
134
+ export interface DatabaseEventEmitterInternal {
135
+ addListener(
136
+ eventName: string,
137
+ listener: (event: DatabaseTransactionEventInternal) => void,
138
+ ): DatabaseEmitterSubscriptionInternal;
139
+ }
140
+
141
+ /** Wrapped native module interface for database. */
142
+ export interface RNFBDatabaseModule {
143
+ goOnline(): Promise<void>;
144
+ goOffline(): Promise<void>;
145
+ setPersistenceEnabled(enabled: boolean): Promise<void>;
146
+ setLoggingEnabled(enabled: boolean): Promise<void>;
147
+ setPersistenceCacheSizeBytes(bytes: number): Promise<void>;
148
+ useEmulator(host: string, port: number): void | Promise<void>;
149
+ set(path: string, props: { value: unknown }): Promise<void>;
150
+ update(path: string, props: { values: Record<string, unknown> }): Promise<void>;
151
+ setWithPriority(
152
+ path: string,
153
+ props: { value: unknown; priority: string | number | null },
154
+ ): Promise<void>;
155
+ remove(path: string): Promise<void>;
156
+ setPriority(path: string, props: { priority: string | number | null }): Promise<void>;
157
+ once(
158
+ path: string,
159
+ modifiers: DatabaseQueryModifier[],
160
+ eventType: FirebaseDatabaseTypes.EventType,
161
+ ): Promise<DatabaseSnapshotInternal | DatabaseChildSnapshotResultInternal>;
162
+ on(props: DatabaseListenPropsInternal): void;
163
+ off(queryKey: string, eventRegistrationKey: string): void | Promise<void>;
164
+ keepSynced(
165
+ queryKey: string,
166
+ path: string,
167
+ modifiers: DatabaseQueryModifier[],
168
+ value: boolean,
169
+ ): Promise<void>;
170
+ onDisconnectCancel(path: string): Promise<void>;
171
+ onDisconnectRemove(path: string): Promise<void>;
172
+ onDisconnectSet(path: string, props: { value: unknown }): Promise<void>;
173
+ onDisconnectSetWithPriority(
174
+ path: string,
175
+ props: { value: unknown; priority: string | number | null },
176
+ ): Promise<void>;
177
+ onDisconnectUpdate(path: string, props: { values: Record<string, unknown> }): Promise<void>;
178
+ transactionStart(
179
+ path: string,
180
+ id: number,
181
+ applyLocally: boolean,
182
+ userExecutor?: (currentData: unknown) => unknown,
183
+ ): void | Promise<void>;
184
+ transactionTryCommit(
185
+ id: number,
186
+ updates: DatabaseTransactionUpdatesInternal,
187
+ ): void | Promise<void>;
188
+ }
189
+
190
+ declare module '@react-native-firebase/app/dist/module/internal/NativeModules' {
191
+ interface ReactNativeFirebaseNativeModules {
192
+ RNFBDatabaseModule: RNFBDatabaseModule;
193
+ }
194
+ }
195
+
196
+ /** Legacy DatabaseReference shape needed by namespaced/runtime helpers before full TS port. */
197
+ export interface DatabaseReferenceInternal {
198
+ readonly path: string;
199
+ on(
200
+ eventType: FirebaseDatabaseTypes.EventType,
201
+ callback: (data: FirebaseDatabaseTypes.DataSnapshot, previousChildKey?: string | null) => void,
202
+ cancelCallbackOrContext?:
203
+ | ((a: Error) => void)
204
+ | Record<string, any>
205
+ | DatabaseModularDeprecationArg
206
+ | null,
207
+ context?: Record<string, any> | null,
208
+ ): (a: FirebaseDatabaseTypes.DataSnapshot | null, b?: string | null) => void;
209
+ }
210
+
211
+ /** Query instance viewed through the chainable query modifier methods. */
212
+ export type QueryWithModifiersInternal = Query &
213
+ Record<QueryConstraintType, (...args: Array<unknown>) => Query>;
214
+
215
+ /** Query instance viewed through the subscription helpers used by modular wrappers. */
216
+ export interface QueryWithSubscriptionMethodsInternal extends Query {
217
+ on(
218
+ eventType: EventType,
219
+ callback: (snapshot: DataSnapshot, previousChildName?: string | null) => unknown,
220
+ cancelCallbackOrContext?:
221
+ | ((error: Error) => unknown)
222
+ | ListenOptions
223
+ | DatabaseModularDeprecationArg,
224
+ context?: ListenOptions | null,
225
+ deprecationArg?: DatabaseModularDeprecationArg,
226
+ ): unknown;
227
+ off(
228
+ eventType?: EventType,
229
+ callback?: (snapshot: DataSnapshot, previousChildName?: string | null) => unknown,
230
+ context?: null,
231
+ deprecationArg?: DatabaseModularDeprecationArg,
232
+ ): void;
233
+ once(
234
+ eventType: EventType,
235
+ successCallback?: (snapshot: DataSnapshot, previousChildName?: string | null) => unknown,
236
+ failureCallbackContext?: ((error: Error) => void) | null,
237
+ context?: ListenOptions,
238
+ deprecationArg?: DatabaseModularDeprecationArg,
239
+ ): Promise<DataSnapshot>;
240
+ }
241
+
242
+ /** Query constraint instance that can apply itself to a query. */
243
+ export interface QueryConstraintWithApplyInternal extends QueryConstraint {
244
+ _apply(query: Query): Query;
245
+ }
246
+
247
+ /** Database reference viewed through the mutating modular helpers. */
248
+ export interface DatabaseReferenceWithMethodsInternal extends DatabaseReference {
249
+ set(
250
+ value: unknown,
251
+ onComplete?: () => void,
252
+ deprecationArg?: DatabaseModularDeprecationArg,
253
+ ): Promise<void>;
254
+ setPriority(
255
+ priority: string | number | null,
256
+ onComplete?: () => void,
257
+ deprecationArg?: DatabaseModularDeprecationArg,
258
+ ): Promise<void>;
259
+ setWithPriority(
260
+ value: unknown,
261
+ priority: string | number | null,
262
+ onComplete?: () => void,
263
+ deprecationArg?: DatabaseModularDeprecationArg,
264
+ ): Promise<void>;
265
+ child(path: string, deprecationArg?: DatabaseModularDeprecationArg): DatabaseReference;
266
+ onDisconnect(deprecationArg?: DatabaseModularDeprecationArg): OnDisconnect;
267
+ keepSynced(value: boolean, deprecationArg?: DatabaseModularDeprecationArg): Promise<void>;
268
+ push(
269
+ value?: unknown,
270
+ onComplete?: undefined,
271
+ deprecationArg?: DatabaseModularDeprecationArg,
272
+ ): ThenableReference;
273
+ remove(deprecationArg?: DatabaseModularDeprecationArg): Promise<void>;
274
+ update(values: object, deprecationArg?: DatabaseModularDeprecationArg): Promise<void>;
275
+ }
276
+
277
+ /** Minimal transaction handler contract used by DatabaseReference and namespaced module. */
278
+ export interface DatabaseTransactionInternal {
279
+ add(
280
+ reference: DatabaseReferenceInternal,
281
+ transactionUpdater: (currentData: unknown) => unknown,
282
+ onComplete: (error: Error | null, committed: boolean, snapshot: unknown | null) => void,
283
+ applyLocally?: boolean,
284
+ ): void;
285
+ }
286
+
287
+ /** Namespaced database instance with typed native and transaction bridge. */
288
+ export interface DatabaseModuleInternal {
289
+ readonly native: RNFBDatabaseModule;
290
+ readonly emitter: DatabaseEventEmitterInternal;
291
+ readonly app: ReactNativeFirebase.FirebaseApp;
292
+ readonly type: 'database';
293
+ readonly firebaseJson: Record<string, unknown>;
294
+ eventNameForApp(...args: Array<string | number>): string;
295
+ _serverTimeOffset: number;
296
+ _customUrlOrRegion: string | null;
297
+ _transaction: DatabaseTransactionInternal;
298
+ }
299
+
300
+ /** Public database module instance plus internal bridge fields. */
301
+ export interface DatabaseInternal extends Database, DatabaseModuleInternal {}
302
+
303
+ /** Database reference viewed through the transaction modular helper. */
304
+ export interface DatabaseReferenceWithTransactionInternal extends DatabaseReference {
305
+ transaction(
306
+ transactionUpdate: (currentData: any) => unknown,
307
+ onComplete?: undefined,
308
+ applyLocally?: boolean,
309
+ deprecationArg?: DatabaseModularDeprecationArg,
310
+ ): Promise<TransactionResult>;
311
+ }
312
+
313
+ /** Runtime ServerValue object shape used by modular wrappers. */
314
+ export interface ServerValueStaticInternal {
315
+ TIMESTAMP: object;
316
+ increment(delta: number, deprecationArg?: DatabaseModularDeprecationArg): object;
317
+ }
@@ -53,12 +53,20 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
53
53
  *
54
54
  * @firebase database
55
55
  */
56
+ /**
57
+ * @deprecated Use the exported types directly instead.
58
+ * FirebaseDatabaseTypes namespace is kept for backwards compatibility.
59
+ */
60
+ // eslint-disable-next-line @typescript-eslint/no-namespace
56
61
  export namespace FirebaseDatabaseTypes {
57
62
  import FirebaseModule = ReactNativeFirebase.FirebaseModule;
58
63
 
59
64
  /**
60
65
  * The ServerValue interface provides access to Firebase server values.
61
66
  */
67
+ /**
68
+ * @deprecated Use the exported `ServerValue` type instead.
69
+ */
62
70
  export interface ServerValue {
63
71
  /**
64
72
  * A placeholder value for auto-populating the current timestamp (time since the Unix epoch,
@@ -99,6 +107,9 @@ export namespace FirebaseDatabaseTypes {
99
107
  * firebase.database;
100
108
  * ```
101
109
  */
110
+ /**
111
+ * @deprecated Use the exported runtime/statics directly instead.
112
+ */
102
113
  export interface Statics {
103
114
  /**
104
115
  * Returns server specific values, such as the server timestamp.
@@ -113,6 +124,9 @@ export namespace FirebaseDatabaseTypes {
113
124
  SDK_VERSION: string;
114
125
  }
115
126
 
127
+ /**
128
+ * @deprecated Use the exported `TransactionResult` type instead.
129
+ */
116
130
  export interface TransactionResult {
117
131
  committed: boolean;
118
132
  snapshot: DataSnapshot;
@@ -125,6 +139,9 @@ export namespace FirebaseDatabaseTypes {
125
139
  * You can reference the root or child location in your Database by calling `firebase.database().ref()`
126
140
  * or `firebase.database().ref("child/path")`.
127
141
  */
142
+ /**
143
+ * @deprecated Use the exported `DatabaseReference` type instead.
144
+ */
128
145
  export interface Reference extends Query {
129
146
  /**
130
147
  * The parent location of a Reference. The parent of a root Reference is `null`.
@@ -379,7 +396,11 @@ export namespace FirebaseDatabaseTypes {
379
396
  */
380
397
  transaction(
381
398
  transactionUpdate: (currentData: any) => any | undefined,
382
- onComplete?: (error: Error | null, committed: boolean, finalResult: DataSnapshot) => void,
399
+ onComplete?: (
400
+ error: Error | null,
401
+ committed: boolean,
402
+ finalResult: DataSnapshot | null,
403
+ ) => void,
383
404
  applyLocally?: boolean,
384
405
  ): Promise<TransactionResult>;
385
406
 
@@ -410,7 +431,7 @@ export namespace FirebaseDatabaseTypes {
410
431
  * @param value Optional value to be written at the generated location.
411
432
  * @param onComplete Callback called when write to server is complete.
412
433
  */
413
- push(value?: any, onComplete?: () => void): ThenableReference;
434
+ push(value?: any, onComplete?: (error: Error | null) => void): ThenableReference;
414
435
 
415
436
  /**
416
437
  * Returns an {@link OnDisconnect} instance.
@@ -426,7 +447,11 @@ export namespace FirebaseDatabaseTypes {
426
447
  onDisconnect(): OnDisconnect;
427
448
  }
428
449
 
429
- export type ThenableReference = Reference;
450
+ /**
451
+ * @deprecated Use the exported `ThenableReference` type instead.
452
+ */
453
+ export interface ThenableReference
454
+ extends Reference, Pick<Promise<Reference>, 'then' | 'catch'> {}
430
455
 
431
456
  /**
432
457
  * A Query sorts and filters the data at a Database location so only a subset of the child data
@@ -438,6 +463,9 @@ export namespace FirebaseDatabaseTypes {
438
463
  * Just as with a `Reference`, you can receive data from a Query by using the on() method. You will
439
464
  * only receive events and `DataSnapshot`s for the subset of the data that matches your query.
440
465
  */
466
+ /**
467
+ * @deprecated Use the exported `Query` type instead.
468
+ */
441
469
  export interface Query {
442
470
  /**
443
471
  * Returns a Reference to the Query's location.
@@ -783,7 +811,7 @@ export namespace FirebaseDatabaseTypes {
783
811
  /**
784
812
  * Returns a JSON-serializable representation of this object.
785
813
  */
786
- toJSON(): object;
814
+ toJSON(): string;
787
815
 
788
816
  /**
789
817
  * Gets the absolute URL for this location.
@@ -837,6 +865,9 @@ export namespace FirebaseDatabaseTypes {
837
865
  * Note that `onDisconnect` operations are only triggered once. If you want an operation to occur each time a
838
866
  * disconnect occurs, you'll need to re-establish the `onDisconnect` operations each time you reconnect.
839
867
  */
868
+ /**
869
+ * @deprecated Use the exported `OnDisconnect` type instead.
870
+ */
840
871
  export interface OnDisconnect {
841
872
  /**
842
873
  * Cancels all previously queued `onDisconnect()` set or update events for this location and all children.
@@ -932,6 +963,9 @@ export namespace FirebaseDatabaseTypes {
932
963
  ): Promise<void>;
933
964
  }
934
965
 
966
+ /**
967
+ * @deprecated Use the exported `EventType` type instead.
968
+ */
935
969
  export type EventType =
936
970
  | 'value'
937
971
  | 'child_added'
@@ -947,6 +981,9 @@ export namespace FirebaseDatabaseTypes {
947
981
  * of the snapshot as a JavaScript object by calling the val() method. Alternatively, you can traverse
948
982
  * into the snapshot by calling `child()` to return child snapshots (which you could then call `val()` on).
949
983
  */
984
+ /**
985
+ * @deprecated Use the exported `DataSnapshot` type instead.
986
+ */
950
987
  export interface DataSnapshot {
951
988
  /**
952
989
  * The key (last part of the path) of the location of this `DataSnapshot`.
@@ -1026,7 +1063,7 @@ export namespace FirebaseDatabaseTypes {
1026
1063
  *
1027
1064
  * @param action A function that will be called for each child DataSnapshot. The callback can return true to cancel further enumeration.
1028
1065
  */
1029
- forEach(action: (child: DataSnapshot) => true | undefined): boolean;
1066
+ forEach(action: (child: DataSnapshot) => boolean | void): boolean;
1030
1067
 
1031
1068
  /**
1032
1069
  * Gets the priority value of the data in this DataSnapshot.
@@ -1113,7 +1150,10 @@ export namespace FirebaseDatabaseTypes {
1113
1150
  * ```
1114
1151
  *
1115
1152
  */
1116
- export class Module extends FirebaseModule {
1153
+ /**
1154
+ * @deprecated Use the exported `Database` type and modular API instead.
1155
+ */
1156
+ export declare class Module extends FirebaseModule {
1117
1157
  /**
1118
1158
  * The current `FirebaseApp` instance for this Firebase service.
1119
1159
  */
@@ -1296,21 +1336,20 @@ type DatabaseNamespace = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<
1296
1336
 
1297
1337
  declare const defaultExport: DatabaseNamespace;
1298
1338
 
1299
- export const firebase: ReactNativeFirebase.Module & {
1339
+ export declare const firebase: ReactNativeFirebase.Module & {
1300
1340
  database: typeof defaultExport;
1301
1341
  app(
1302
1342
  name?: string,
1303
1343
  ): ReactNativeFirebase.FirebaseApp & { database(): FirebaseDatabaseTypes.Module };
1304
1344
  };
1305
1345
 
1306
- export * from './modular';
1307
-
1308
1346
  export default defaultExport;
1309
1347
 
1310
1348
  /**
1311
1349
  * Attach namespace to `firebase.` and `FirebaseApp.`.
1312
1350
  */
1313
1351
  declare module '@react-native-firebase/app' {
1352
+ // eslint-disable-next-line @typescript-eslint/no-namespace -- module augmentation uses namespace
1314
1353
  namespace ReactNativeFirebase {
1315
1354
  import FirebaseModuleWithStaticsAndApp = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp;
1316
1355
  interface Module {
package/lib/version.ts ADDED
@@ -0,0 +1,2 @@
1
+ // Generated by genversion.
2
+ export const version = '25.0.1';
@@ -0,0 +1,4 @@
1
+ // No-op for android.
2
+ const databaseAndroidFallbackModule: Record<string, never> = {};
3
+
4
+ export default databaseAndroidFallbackModule;
@@ -0,0 +1,4 @@
1
+ // No-op for ios.
2
+ const databaseIosFallbackModule: Record<string, never> = {};
3
+
4
+ export default databaseIosFallbackModule;