@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
@@ -1,972 +0,0 @@
1
- import { FirebaseDatabaseTypes } from '../..';
2
-
3
- export type Query = FirebaseDatabaseTypes.Query;
4
- export type DataSnapshot = FirebaseDatabaseTypes.DataSnapshot;
5
- export type DatabaseReference = FirebaseDatabaseTypes.Reference;
6
- export type OnDisconnect = FirebaseDatabaseTypes.OnDisconnect;
7
-
8
- /**
9
- * A `Promise` that can also act as a `DatabaseReference` when returned by
10
- * {@link push}. The reference is available immediately and the `Promise` resolves
11
- * as the write to the backend completes.
12
- */
13
- export interface ThenableReference
14
- extends DatabaseReference, Pick<Promise<DatabaseReference>, 'then' | 'catch'> {}
15
-
16
- export type Unsubscribe = () => void;
17
-
18
- export interface ListenOptions {
19
- readonly onlyOnce?: boolean;
20
- }
21
-
22
- /** Describes the different query constraints available in this SDK. */
23
- export type QueryConstraintType =
24
- | 'endAt'
25
- | 'endBefore'
26
- | 'startAt'
27
- | 'startAfter'
28
- | 'limitToFirst'
29
- | 'limitToLast'
30
- | 'orderByChild'
31
- | 'orderByKey'
32
- | 'orderByPriority'
33
- | 'orderByValue'
34
- | 'equalTo';
35
-
36
- /**
37
- * A `QueryConstraint` is used to narrow the set of documents returned by a
38
- * Database query. `QueryConstraint`s are created by invoking {@link endAt},
39
- * {@link endBefore}, {@link startAt}, {@link startAfter}, {@link
40
- * limitToFirst}, {@link limitToLast}, {@link orderByChild},
41
- * {@link orderByChild}, {@link orderByKey} , {@link orderByPriority} ,
42
- * {@link orderByValue} or {@link equalTo} and
43
- * can then be passed to {@link query} to create a new query instance that
44
- * also contains this `QueryConstraint`.
45
- */
46
- export interface QueryConstraint {
47
- /** The type of this query constraints */
48
- readonly _type: QueryConstraintType;
49
-
50
- _apply(query: Query): Query;
51
- }
52
-
53
- /**
54
- * Creates a `QueryConstraint` with the specified ending point.
55
- *
56
- * Using `startAt()`, `startAfter()`, `endBefore()`, `endAt()` and `equalTo()`
57
- * allows you to choose arbitrary starting and ending points for your queries.
58
- *
59
- * The ending point is inclusive, so children with exactly the specified value
60
- * will be included in the query. The optional key argument can be used to
61
- * further limit the range of the query. If it is specified, then children that
62
- * have exactly the specified value must also have a key name less than or equal
63
- * to the specified key.
64
- *
65
- * @param value - The value to end at. The argument type depends on which
66
- * `orderBy*()` function was used in this query. Specify a value that matches
67
- * the `orderBy*()` type. When used in combination with `orderByKey()`, the
68
- * value must be a string.
69
- * @param key - The child key to end at, among the children with the previously
70
- * specified priority. This argument is only allowed if ordering by child,
71
- * value, or priority.
72
- */
73
- export declare function endAt(
74
- value: number | string | boolean | null,
75
- key?: string,
76
- ): QueryConstraint;
77
-
78
- /**
79
- * Creates a QueryConstraint with the specified ending point (exclusive).
80
- *
81
- * Using `startAt()`, `startAfter()`, `endBefore()`, `endAt()` and `equalTo()` allows you to
82
- * choose arbitrary starting and ending points for your queries.
83
- *
84
- * The ending point is exclusive. If only a value is provided, children with a
85
- * value less than the specified value will be included in the query. If a key
86
- * is specified, then children must have a value less than or equal to the
87
- * specified value and a key name less than the specified key.
88
- *
89
- * @param value - The value to end before. The argument type depends on which
90
- * `orderBy*()` function was used in this query. Specify a value that matches
91
- * the `orderBy*()` type. When used in combination with `orderByKey()`, the
92
- * value must be a string.
93
- * @param key - The child key to end before, among the children with the
94
- * previously specified priority. This argument is only allowed if ordering by
95
- * child, value, or priority.
96
- */
97
- export declare function endBefore(
98
- value: number | string | boolean | null,
99
- key?: string,
100
- ): QueryConstraint;
101
-
102
- /**
103
- * Creates a QueryConstraint that includes children that match the specified value.
104
- *
105
- * Using `startAt()`, `startAfter()`, `endBefore()`, `endAt()` and `equalTo()` allows
106
- * you to choose arbitrary starting and ending points for your queries.
107
- *
108
- * The optional key argument can be used to further limit the range of the
109
- * query. If it is specified, then children that have exactly the specified
110
- * value must also have exactly the specified key as their key name. This
111
- * can be used to filter result sets with many matches for the same value.
112
- *
113
- * @param value - The value to match for. The argument type depends on which
114
- * `orderBy*()` function was used in this query. Specify a value that matches
115
- * the `orderBy*()` type. When used in combination with `orderByKey()`, the
116
- * value must be a string.
117
- * @param key - The child key to start at, among the children with the
118
- * previously specified priority. This argument is only allowed if ordering by
119
- * child, value, or priority.
120
- */
121
- export declare function equalTo(
122
- value: number | string | boolean | null,
123
- key?: string,
124
- ): QueryConstraint;
125
-
126
- /**
127
- * Creates a QueryConstraint with the specified starting point.
128
- *
129
- * Using `startAt()`, `startAfter()`, `endBefore()`, `endAt()` and `equalTo()`
130
- * allows you to choose arbitrary starting and ending points for your queries.
131
- *
132
- * The starting point is inclusive, so children with exactly the specified
133
- * value will be included in the query. The optional key argument can be used
134
- * to further limit the range of the query. If it is specified, then children
135
- * that have exactly the specified value must also have a key name greater than
136
- * or equal to the specified key.
137
- *
138
- * @param value - The value to start at. The argument type depends on which
139
- * `orderBy*()` function was used in this query. Specify a value that matches
140
- * the `orderBy*()` type. When used in combination with `orderByKey()`, the
141
- * value must be a string.
142
- * @param key - The child key to start at. This argument is only allowed if
143
- * ordering by child, value, or priority.
144
- */
145
- export declare function startAt(
146
- value?: number | string | boolean | null,
147
- key?: string,
148
- ): QueryConstraint;
149
-
150
- /**
151
- * Creates a `QueryConstraint` with the specified starting point (exclusive).
152
- *
153
- * Using `startAt()`, `startAfter()`, `endBefore()`, `endAt()` and `equalTo()`
154
- * allows you to choose arbitrary starting and ending points for your queries.
155
- *
156
- * The starting point is exclusive. If only a value is provided, children
157
- * with a value greater than the specified value will be included in the query.
158
- * If a key is specified, then children must have a value greater than or equal
159
- * to the specified value and a a key name greater than the specified key.
160
- *
161
- * @param value - The value to start after. The argument type depends on which
162
- * `orderBy*()` function was used in this query. Specify a value that matches
163
- * the `orderBy*()` type. When used in combination with `orderByKey()`, the
164
- * value must be a string.
165
- * @param key - The child key to start after. This argument is only allowed if
166
- * ordering by child, value, or priority.
167
- */
168
- export function startAfter(value: number | string | boolean | null, key?: string): QueryConstraint;
169
-
170
- /**
171
- * Creates a new `QueryConstraint` that if limited to the first specific number
172
- * of children.
173
- *
174
- * The `limitToFirst()` method is used to set a maximum number of children to be
175
- * synced for a given callback. If we set a limit of 100, we will initially only
176
- * receive up to 100 `child_added` events. If we have fewer than 100 messages
177
- * stored in our Database, a `child_added` event will fire for each message.
178
- * However, if we have over 100 messages, we will only receive a `child_added`
179
- * event for the first 100 ordered messages. As items change, we will receive
180
- * `child_removed` events for each item that drops out of the active list so
181
- * that the total number stays at 100.
182
- *
183
- * @param limit - The maximum number of nodes to include in this query.
184
- */
185
- export function limitToFirst(limit: number): QueryConstraint;
186
-
187
- /**
188
- * Creates a new `QueryConstraint` that is limited to return only the last
189
- * specified number of children.
190
- *
191
- * The `limitToLast()` method is used to set a maximum number of children to be
192
- * synced for a given callback. If we set a limit of 100, we will initially only
193
- * receive up to 100 `child_added` events. If we have fewer than 100 messages
194
- * stored in our Database, a `child_added` event will fire for each message.
195
- * However, if we have over 100 messages, we will only receive a `child_added`
196
- * event for the last 100 ordered messages. As items change, we will receive
197
- * `child_removed` events for each item that drops out of the active list so
198
- * that the total number stays at 100.
199
- *
200
- * @param limit - The maximum number of nodes to include in this query.
201
- */
202
- export function limitToLast(limit: number): QueryConstraint;
203
-
204
- /**
205
- * Creates a new `QueryConstraint` that orders by the specified child key.
206
- *
207
- * Queries can only order by one key at a time. Calling `orderByChild()`
208
- * multiple times on the same query is an error.
209
- *
210
- * Firebase queries allow you to order your data by any child key on the fly.
211
- * However, if you know in advance what your indexes will be, you can define
212
- * them via the .indexOn rule in your Security Rules for better performance.
213
- *
214
- * @param path - The path to order by.
215
- */
216
- export function orderByChild(path: string): QueryConstraint;
217
-
218
- /**
219
- * Creates a new `QueryConstraint` that orders by the key.
220
- *
221
- * Sorts the results of a query by their (ascending) key values.
222
- */
223
- export function orderByKey(): QueryConstraint;
224
-
225
- /**
226
- * Creates a new `QueryConstraint` that orders by priority.
227
- *
228
- * Applications need not use priority but can order collections by
229
- * ordinary properties
230
- */
231
- export function orderByPriority(): QueryConstraint;
232
-
233
- /**
234
- * Creates a new `QueryConstraint` that orders by value.
235
- *
236
- * If the children of a query are all scalar values (string, number, or
237
- * boolean), you can order the results by their (ascending) values.
238
- */
239
- export function orderByValue(): QueryConstraint;
240
-
241
- /**
242
- * Creates a new immutable instance of `Query` that is extended to also include
243
- * additional query constraints.
244
- *
245
- * @param query - The Query instance to use as a base for the new constraints.
246
- * @param queryConstraints - The list of `QueryConstraint`s to apply.
247
- * @throws if any of the provided query constraints cannot be combined with the
248
- * existing or new constraints.
249
- */
250
- export function query(query: Query, ...queryConstraints: QueryConstraint[]): Query;
251
-
252
- /**
253
- * Listens for data changes at a particular location.
254
- *
255
- * This is the primary way to read data from a Database. Your callback
256
- * will be triggered for the initial data and again whenever the data changes.
257
- * Invoke the returned unsubscribe callback to stop receiving updates.
258
- *
259
- * An `onValue` event will trigger once with the initial data stored at this
260
- * location, and then trigger again each time the data changes. The
261
- * `DataSnapshot` passed to the callback will be for the location at which
262
- * `on()` was called. It won't trigger until the entire contents has been
263
- * synchronized. If the location has no data, it will be triggered with an empty
264
- * `DataSnapshot` (`val()` will return `null`).
265
- *
266
- * @param query - The query to run.
267
- * @param callback - A callback that fires when the specified event occurs. The
268
- * callback will be passed a DataSnapshot.
269
- * @param cancelCallback - An optional callback that will be notified if your
270
- * event subscription is ever canceled because your client does not have
271
- * permission to read this data (or it had permission but has now lost it).
272
- * This callback will be passed an `Error` object indicating why the failure
273
- * occurred.
274
- * @returns A function that can be invoked to remove the listener.
275
- */
276
- export function onValue(
277
- query: Query,
278
- callback: (snapshot: DataSnapshot) => unknown,
279
- cancelCallback?: (error: Error) => unknown,
280
- ): Unsubscribe;
281
-
282
- /**
283
- * Listens for data changes at a particular location.
284
- *
285
- * This is the primary way to read data from a Database. Your callback
286
- * will be triggered for the initial data and again whenever the data changes.
287
- * Invoke the returned unsubscribe callback to stop receiving updates.
288
- *
289
- * An `onValue` event will trigger once with the initial data stored at this
290
- * location, and then trigger again each time the data changes. The
291
- * `DataSnapshot` passed to the callback will be for the location at which
292
- * `on()` was called. It won't trigger until the entire contents has been
293
- * synchronized. If the location has no data, it will be triggered with an empty
294
- * `DataSnapshot` (`val()` will return `null`).
295
- *
296
- * @param query - The query to run.
297
- * @param callback - A callback that fires when the specified event occurs. The
298
- * callback will be passed a DataSnapshot.
299
- * @param options - An object that can be used to configure `onlyOnce`, which
300
- * then removes the listener after its first invocation.
301
- * @returns A function that can be invoked to remove the listener.
302
- */
303
- export function onValue(
304
- query: Query,
305
- callback: (snapshot: DataSnapshot) => unknown,
306
- options: ListenOptions,
307
- ): Unsubscribe;
308
-
309
- /**
310
- * Listens for data changes at a particular location.
311
- *
312
- * This is the primary way to read data from a Database. Your callback
313
- * will be triggered for the initial data and again whenever the data changes.
314
- * Invoke the returned unsubscribe callback to stop receiving updates.
315
- *
316
- * An `onValue` event will trigger once with the initial data stored at this
317
- * location, and then trigger again each time the data changes. The
318
- * `DataSnapshot` passed to the callback will be for the location at which
319
- * `on()` was called. It won't trigger until the entire contents has been
320
- * synchronized. If the location has no data, it will be triggered with an empty
321
- * `DataSnapshot` (`val()` will return `null`).
322
- *
323
- * @param query - The query to run.
324
- * @param callback - A callback that fires when the specified event occurs. The
325
- * callback will be passed a DataSnapshot.
326
- * @param cancelCallback - An optional callback that will be notified if your
327
- * event subscription is ever canceled because your client does not have
328
- * permission to read this data (or it had permission but has now lost it).
329
- * This callback will be passed an `Error` object indicating why the failure
330
- * occurred.
331
- * @param options - An object that can be used to configure `onlyOnce`, which
332
- * then removes the listener after its first invocation.
333
- * @returns A function that can be invoked to remove the listener.
334
- */
335
- export function onValue(
336
- query: Query,
337
- callback: (snapshot: DataSnapshot) => unknown,
338
- cancelCallback: (error: Error) => unknown,
339
- options: ListenOptions,
340
- ): Unsubscribe;
341
-
342
- export function onValue(
343
- query: Query,
344
- callback: (snapshot: DataSnapshot) => unknown,
345
- cancelCallbackOrListenOptions?: ((error: Error) => unknown) | ListenOptions,
346
- options?: ListenOptions,
347
- ): Unsubscribe;
348
-
349
- /**
350
- * Listens for data changes at a particular location.
351
- *
352
- * This is the primary way to read data from a Database. Your callback
353
- * will be triggered for the initial data and again whenever the data changes.
354
- * Invoke the returned unsubscribe callback to stop receiving updates.
355
- *
356
- * An `onChildAdded` event will be triggered once for each initial child at this
357
- * location, and it will be triggered again every time a new child is added. The
358
- * `DataSnapshot` passed into the callback will reflect the data for the
359
- * relevant child. For ordering purposes, it is passed a second argument which
360
- * is a string containing the key of the previous sibling child by sort order,
361
- * or `null` if it is the first child.
362
- *
363
- * @param query - The query to run.
364
- * @param callback - A callback that fires when the specified event occurs.
365
- * The callback will be passed a DataSnapshot and a string containing the key of
366
- * the previous child, by sort order, or `null` if it is the first child.
367
- * @param cancelCallback - An optional callback that will be notified if your
368
- * event subscription is ever canceled because your client does not have
369
- * permission to read this data (or it had permission but has now lost it).
370
- * This callback will be passed an `Error` object indicating why the failure
371
- * occurred.
372
- * @returns A function that can be invoked to remove the listener.
373
- */
374
- export function onChildAdded(
375
- query: Query,
376
- callback: (snapshot: DataSnapshot, previousChildName?: string | null) => unknown,
377
- cancelCallback?: (error: Error) => unknown,
378
- ): Unsubscribe;
379
-
380
- /**
381
- * Listens for data changes at a particular location.
382
- *
383
- * This is the primary way to read data from a Database. Your callback
384
- * will be triggered for the initial data and again whenever the data changes.
385
- * Invoke the returned unsubscribe callback to stop receiving updates.
386
- *
387
- * An `onChildAdded` event will be triggered once for each initial child at this
388
- * location, and it will be triggered again every time a new child is added. The
389
- * `DataSnapshot` passed into the callback will reflect the data for the
390
- * relevant child. For ordering purposes, it is passed a second argument which
391
- * is a string containing the key of the previous sibling child by sort order,
392
- * or `null` if it is the first child.
393
- *
394
- * @param query - The query to run.
395
- * @param callback - A callback that fires when the specified event occurs.
396
- * The callback will be passed a DataSnapshot and a string containing the key of
397
- * the previous child, by sort order, or `null` if it is the first child.
398
- * @param options - An object that can be used to configure `onlyOnce`, which
399
- * then removes the listener after its first invocation.
400
- * @returns A function that can be invoked to remove the listener.
401
- */
402
- export function onChildAdded(
403
- query: Query,
404
- callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown,
405
- options: ListenOptions,
406
- ): Unsubscribe;
407
-
408
- /**
409
- * Listens for data changes at a particular location.
410
- *
411
- * This is the primary way to read data from a Database. Your callback
412
- * will be triggered for the initial data and again whenever the data changes.
413
- * Invoke the returned unsubscribe callback to stop receiving updates.
414
- *
415
- * An `onChildAdded` event will be triggered once for each initial child at this
416
- * location, and it will be triggered again every time a new child is added. The
417
- * `DataSnapshot` passed into the callback will reflect the data for the
418
- * relevant child. For ordering purposes, it is passed a second argument which
419
- * is a string containing the key of the previous sibling child by sort order,
420
- * or `null` if it is the first child.
421
- *
422
- * @param query - The query to run.
423
- * @param callback - A callback that fires when the specified event occurs.
424
- * The callback will be passed a DataSnapshot and a string containing the key of
425
- * the previous child, by sort order, or `null` if it is the first child.
426
- * @param cancelCallback - An optional callback that will be notified if your
427
- * event subscription is ever canceled because your client does not have
428
- * permission to read this data (or it had permission but has now lost it).
429
- * This callback will be passed an `Error` object indicating why the failure
430
- * occurred.
431
- * @param options - An object that can be used to configure `onlyOnce`, which
432
- * then removes the listener after its first invocation.
433
- * @returns A function that can be invoked to remove the listener.
434
- */
435
- export function onChildAdded(
436
- query: Query,
437
- callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown,
438
- cancelCallback: (error: Error) => unknown,
439
- options: ListenOptions,
440
- ): Unsubscribe;
441
-
442
- export function onChildAdded(
443
- query: Query,
444
- callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown,
445
- cancelCallbackOrListenOptions?: ((error: Error) => unknown) | ListenOptions,
446
- options?: ListenOptions,
447
- ): Unsubscribe;
448
-
449
- /**
450
- * Listens for data changes at a particular location.
451
- *
452
- * This is the primary way to read data from a Database. Your callback
453
- * will be triggered for the initial data and again whenever the data changes.
454
- * Invoke the returned unsubscribe callback to stop receiving updates.
455
- *
456
- * An `onChildChanged` event will be triggered when the data stored in a child
457
- * (or any of its descendants) changes. Note that a single `child_changed` event
458
- * may represent multiple changes to the child. The `DataSnapshot` passed to the
459
- * callback will contain the new child contents. For ordering purposes, the
460
- * callback is also passed a second argument which is a string containing the
461
- * key of the previous sibling child by sort order, or `null` if it is the first
462
- * child.
463
- *
464
- * @param query - The query to run.
465
- * @param callback - A callback that fires when the specified event occurs.
466
- * The callback will be passed a DataSnapshot and a string containing the key of
467
- * the previous child, by sort order, or `null` if it is the first child.
468
- * @param cancelCallback - An optional callback that will be notified if your
469
- * event subscription is ever canceled because your client does not have
470
- * permission to read this data (or it had permission but has now lost it).
471
- * This callback will be passed an `Error` object indicating why the failure
472
- * occurred.
473
- * @returns A function that can be invoked to remove the listener.
474
- */
475
- export function onChildChanged(
476
- query: Query,
477
- callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown,
478
- cancelCallback?: (error: Error) => unknown,
479
- ): Unsubscribe;
480
-
481
- /**
482
- * Listens for data changes at a particular location.
483
- *
484
- * This is the primary way to read data from a Database. Your callback
485
- * will be triggered for the initial data and again whenever the data changes.
486
- * Invoke the returned unsubscribe callback to stop receiving updates.
487
- *
488
- * An `onChildChanged` event will be triggered when the data stored in a child
489
- * (or any of its descendants) changes. Note that a single `child_changed` event
490
- * may represent multiple changes to the child. The `DataSnapshot` passed to the
491
- * callback will contain the new child contents. For ordering purposes, the
492
- * callback is also passed a second argument which is a string containing the
493
- * key of the previous sibling child by sort order, or `null` if it is the first
494
- * child.
495
- *
496
- * @param query - The query to run.
497
- * @param callback - A callback that fires when the specified event occurs.
498
- * The callback will be passed a DataSnapshot and a string containing the key of
499
- * the previous child, by sort order, or `null` if it is the first child.
500
- * @param options - An object that can be used to configure `onlyOnce`, which
501
- * then removes the listener after its first invocation.
502
- * @returns A function that can be invoked to remove the listener.
503
- */
504
- export function onChildChanged(
505
- query: Query,
506
- callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown,
507
- options: ListenOptions,
508
- ): Unsubscribe;
509
-
510
- /**
511
- * Listens for data changes at a particular location.
512
- *
513
- * This is the primary way to read data from a Database. Your callback
514
- * will be triggered for the initial data and again whenever the data changes.
515
- * Invoke the returned unsubscribe callback to stop receiving updates.
516
- *
517
- * An `onChildChanged` event will be triggered when the data stored in a child
518
- * (or any of its descendants) changes. Note that a single `child_changed` event
519
- * may represent multiple changes to the child. The `DataSnapshot` passed to the
520
- * callback will contain the new child contents. For ordering purposes, the
521
- * callback is also passed a second argument which is a string containing the
522
- * key of the previous sibling child by sort order, or `null` if it is the first
523
- * child.
524
- *
525
- * @param query - The query to run.
526
- * @param callback - A callback that fires when the specified event occurs.
527
- * The callback will be passed a DataSnapshot and a string containing the key of
528
- * the previous child, by sort order, or `null` if it is the first child.
529
- * @param cancelCallback - An optional callback that will be notified if your
530
- * event subscription is ever canceled because your client does not have
531
- * permission to read this data (or it had permission but has now lost it).
532
- * This callback will be passed an `Error` object indicating why the failure
533
- * occurred.
534
- * @param options - An object that can be used to configure `onlyOnce`, which
535
- * then removes the listener after its first invocation.
536
- * @returns A function that can be invoked to remove the listener.
537
- */
538
- export function onChildChanged(
539
- query: Query,
540
- callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown,
541
- cancelCallback: (error: Error) => unknown,
542
- options: ListenOptions,
543
- ): Unsubscribe;
544
-
545
- export function onChildChanged(
546
- query: Query,
547
- callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown,
548
- cancelCallbackOrListenOptions?: ((error: Error) => unknown) | ListenOptions,
549
- options?: ListenOptions,
550
- ): Unsubscribe;
551
-
552
- /**
553
- * Listens for data changes at a particular location.
554
- *
555
- * This is the primary way to read data from a Database. Your callback
556
- * will be triggered for the initial data and again whenever the data changes.
557
- * Invoke the returned unsubscribe callback to stop receiving updates.
558
- *
559
- * An `onChildMoved` event will be triggered when a child's sort order changes
560
- * such that its position relative to its siblings changes. The `DataSnapshot`
561
- * passed to the callback will be for the data of the child that has moved. It
562
- * is also passed a second argument which is a string containing the key of the
563
- * previous sibling child by sort order, or `null` if it is the first child.
564
- *
565
- * @param query - The query to run.
566
- * @param callback - A callback that fires when the specified event occurs.
567
- * The callback will be passed a DataSnapshot and a string containing the key of
568
- * the previous child, by sort order, or `null` if it is the first child.
569
- * @param cancelCallback - An optional callback that will be notified if your
570
- * event subscription is ever canceled because your client does not have
571
- * permission to read this data (or it had permission but has now lost it).
572
- * This callback will be passed an `Error` object indicating why the failure
573
- * occurred.
574
- * @returns A function that can be invoked to remove the listener.
575
- */
576
- export function onChildMoved(
577
- query: Query,
578
- callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown,
579
- cancelCallback?: (error: Error) => unknown,
580
- ): Unsubscribe;
581
-
582
- /**
583
- * Listens for data changes at a particular location.
584
- *
585
- * This is the primary way to read data from a Database. Your callback
586
- * will be triggered for the initial data and again whenever the data changes.
587
- * Invoke the returned unsubscribe callback to stop receiving updates.
588
- *
589
- * An `onChildMoved` event will be triggered when a child's sort order changes
590
- * such that its position relative to its siblings changes. The `DataSnapshot`
591
- * passed to the callback will be for the data of the child that has moved. It
592
- * is also passed a second argument which is a string containing the key of the
593
- * previous sibling child by sort order, or `null` if it is the first child.
594
- *
595
- * @param query - The query to run.
596
- * @param callback - A callback that fires when the specified event occurs.
597
- * The callback will be passed a DataSnapshot and a string containing the key of
598
- * the previous child, by sort order, or `null` if it is the first child.
599
- * @param options - An object that can be used to configure `onlyOnce`, which
600
- * then removes the listener after its first invocation.
601
- * @returns A function that can be invoked to remove the listener.
602
- */
603
- export function onChildMoved(
604
- query: Query,
605
- callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown,
606
- options: ListenOptions,
607
- ): Unsubscribe;
608
-
609
- /**
610
- * Listens for data changes at a particular location.
611
- *
612
- * This is the primary way to read data from a Database. Your callback
613
- * will be triggered for the initial data and again whenever the data changes.
614
- * Invoke the returned unsubscribe callback to stop receiving updates.
615
- *
616
- * An `onChildMoved` event will be triggered when a child's sort order changes
617
- * such that its position relative to its siblings changes. The `DataSnapshot`
618
- * passed to the callback will be for the data of the child that has moved. It
619
- * is also passed a second argument which is a string containing the key of the
620
- * previous sibling child by sort order, or `null` if it is the first child.
621
- *
622
- * @param query - The query to run.
623
- * @param callback - A callback that fires when the specified event occurs.
624
- * The callback will be passed a DataSnapshot and a string containing the key of
625
- * the previous child, by sort order, or `null` if it is the first child.
626
- * @param cancelCallback - An optional callback that will be notified if your
627
- * event subscription is ever canceled because your client does not have
628
- * permission to read this data (or it had permission but has now lost it).
629
- * This callback will be passed an `Error` object indicating why the failure
630
- * occurred.
631
- * @param options - An object that can be used to configure `onlyOnce`, which
632
- * then removes the listener after its first invocation.
633
- * @returns A function that can be invoked to remove the listener.
634
- */
635
- export function onChildMoved(
636
- query: Query,
637
- callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown,
638
- cancelCallback: (error: Error) => unknown,
639
- options: ListenOptions,
640
- ): Unsubscribe;
641
-
642
- export function onChildMoved(
643
- query: Query,
644
- callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown,
645
- cancelCallbackOrListenOptions?: ((error: Error) => unknown) | ListenOptions,
646
- options?: ListenOptions,
647
- ): Unsubscribe;
648
-
649
- /**
650
- * Listens for data changes at a particular location.
651
- *
652
- * This is the primary way to read data from a Database. Your callback
653
- * will be triggered for the initial data and again whenever the data changes.
654
- * Invoke the returned unsubscribe callback to stop receiving updates. See
655
- * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
656
- * for more details.
657
- *
658
- * An `onChildRemoved` event will be triggered once every time a child is
659
- * removed. The `DataSnapshot` passed into the callback will be the old data for
660
- * the child that was removed. A child will get removed when either:
661
- *
662
- * - a client explicitly calls `remove()` on that child or one of its ancestors
663
- * - a client calls `set(null)` on that child or one of its ancestors
664
- * - that child has all of its children removed
665
- * - there is a query in effect which now filters out the child (because it's
666
- * sort order changed or the max limit was hit)
667
- *
668
- * @param query - The query to run.
669
- * @param callback - A callback that fires when the specified event occurs.
670
- * The callback will be passed a DataSnapshot and a string containing the key of
671
- * the previous child, by sort order, or `null` if it is the first child.
672
- * @param cancelCallback - An optional callback that will be notified if your
673
- * event subscription is ever canceled because your client does not have
674
- * permission to read this data (or it had permission but has now lost it).
675
- * This callback will be passed an `Error` object indicating why the failure
676
- * occurred.
677
- * @returns A function that can be invoked to remove the listener.
678
- */
679
- export function onChildRemoved(
680
- query: Query,
681
- callback: (snapshot: DataSnapshot) => unknown,
682
- cancelCallback?: (error: Error) => unknown,
683
- ): Unsubscribe;
684
-
685
- /**
686
- * Listens for data changes at a particular location.
687
- *
688
- * This is the primary way to read data from a Database. Your callback
689
- * will be triggered for the initial data and again whenever the data changes.
690
- * Invoke the returned unsubscribe callback to stop receiving updates. See
691
- * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
692
- * for more details.
693
- *
694
- * An `onChildRemoved` event will be triggered once every time a child is
695
- * removed. The `DataSnapshot` passed into the callback will be the old data for
696
- * the child that was removed. A child will get removed when either:
697
- *
698
- * - a client explicitly calls `remove()` on that child or one of its ancestors
699
- * - a client calls `set(null)` on that child or one of its ancestors
700
- * - that child has all of its children removed
701
- * - there is a query in effect which now filters out the child (because it's
702
- * sort order changed or the max limit was hit)
703
- *
704
- * @param query - The query to run.
705
- * @param callback - A callback that fires when the specified event occurs.
706
- * The callback will be passed a DataSnapshot and a string containing the key of
707
- * the previous child, by sort order, or `null` if it is the first child.
708
- * @param options - An object that can be used to configure `onlyOnce`, which
709
- * then removes the listener after its first invocation.
710
- * @returns A function that can be invoked to remove the listener.
711
- */
712
- export function onChildRemoved(
713
- query: Query,
714
- callback: (snapshot: DataSnapshot) => unknown,
715
- options: ListenOptions,
716
- ): Unsubscribe;
717
-
718
- /**
719
- * Listens for data changes at a particular location.
720
- *
721
- * This is the primary way to read data from a Database. Your callback
722
- * will be triggered for the initial data and again whenever the data changes.
723
- * Invoke the returned unsubscribe callback to stop receiving updates. See
724
- * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
725
- * for more details.
726
- *
727
- * An `onChildRemoved` event will be triggered once every time a child is
728
- * removed. The `DataSnapshot` passed into the callback will be the old data for
729
- * the child that was removed. A child will get removed when either:
730
- *
731
- * - a client explicitly calls `remove()` on that child or one of its ancestors
732
- * - a client calls `set(null)` on that child or one of its ancestors
733
- * - that child has all of its children removed
734
- * - there is a query in effect which now filters out the child (because it's
735
- * sort order changed or the max limit was hit)
736
- *
737
- * @param query - The query to run.
738
- * @param callback - A callback that fires when the specified event occurs.
739
- * The callback will be passed a DataSnapshot and a string containing the key of
740
- * the previous child, by sort order, or `null` if it is the first child.
741
- * @param cancelCallback - An optional callback that will be notified if your
742
- * event subscription is ever canceled because your client does not have
743
- * permission to read this data (or it had permission but has now lost it).
744
- * This callback will be passed an `Error` object indicating why the failure
745
- * occurred.
746
- * @param options - An object that can be used to configure `onlyOnce`, which
747
- * then removes the listener after its first invocation.
748
- * @returns A function that can be invoked to remove the listener.
749
- */
750
- export function onChildRemoved(
751
- query: Query,
752
- callback: (snapshot: DataSnapshot) => unknown,
753
- cancelCallback: (error: Error) => unknown,
754
- options: ListenOptions,
755
- ): Unsubscribe;
756
-
757
- export function onChildRemoved(
758
- query: Query,
759
- callback: (snapshot: DataSnapshot) => unknown,
760
- cancelCallbackOrListenOptions?: ((error: Error) => unknown) | ListenOptions,
761
- options?: ListenOptions,
762
- ): Unsubscribe;
763
-
764
- /**
765
- * Writes data to this Database location.
766
- *
767
- * This will overwrite any data at this location and all child locations.
768
- *
769
- * The effect of the write will be visible immediately, and the corresponding
770
- * events ("value", "child_added", etc.) will be triggered. Synchronization of
771
- * the data to the Firebase servers will also be started, and the returned
772
- * Promise will resolve when complete. If provided, the `onComplete` callback
773
- * will be called asynchronously after synchronization has finished.
774
- *
775
- * Passing `null` for the new value is equivalent to calling `remove()`; namely,
776
- * all data at this location and all child locations will be deleted.
777
- *
778
- * `set()` will remove any priority stored at this location, so if priority is
779
- * meant to be preserved, you need to use `setWithPriority()` instead.
780
- *
781
- * Note that modifying data with `set()` will cancel any pending transactions
782
- * at that location, so extreme care should be taken if mixing `set()` and
783
- * `transaction()` to modify the same data.
784
- *
785
- * A single `set()` will generate a single "value" event at the location where
786
- * the `set()` was performed.
787
- *
788
- * @param ref - The location to write to.
789
- * @param value - The value to be written (string, number, boolean, object,
790
- * array, or null).
791
- * @returns Resolves when write to server is complete.
792
- */
793
- export function set(ref: DatabaseReference, value: unknown): Promise<void>;
794
-
795
- /**
796
- * Sets a priority for the data at this Database location.
797
- *
798
- * Applications need not use priority but can order collections by
799
- * ordinary properties
800
- *
801
- * @param ref - The location to write to.
802
- * @param priority - The priority to be written (string, number, or null).
803
- * @returns Resolves when write to server is complete.
804
- */
805
- export function setPriority(
806
- ref: DatabaseReference,
807
- priority: string | number | null,
808
- ): Promise<void>;
809
-
810
- /**
811
- * Writes data the Database location. Like `set()` but also specifies the
812
- * priority for that data.
813
- *
814
- * Applications need not use priority but can order collections by
815
- * ordinary properties
816
- *
817
- * @param ref - The location to write to.
818
- * @param value - The value to be written (string, number, boolean, object,
819
- * array, or null).
820
- * @param priority - The priority to be written (string, number, or null).
821
- * @returns Resolves when write to server is complete.
822
- */
823
- export function setWithPriority(
824
- ref: DatabaseReference,
825
- value: unknown,
826
- priority: string | number | null,
827
- ): Promise<void>;
828
-
829
- /**
830
- * Gets the most up-to-date result for this query.
831
- *
832
- * @param query - The query to run.
833
- * @returns A `Promise` which resolves to the resulting DataSnapshot if a value is
834
- * available, or rejects if the client is unable to return a value (e.g., if the
835
- * server is unreachable and there is nothing cached).
836
- */
837
- export function get(query: Query): Promise<DataSnapshot>;
838
-
839
- /**
840
- * Detaches a callback previously attached with the corresponding on*() (onValue, onChildAdded) listener.
841
- * Note: This is not the recommended way to remove a listener. Instead, please use the returned callback function from the respective on* callbacks.
842
- * Detach a callback previously attached with on*(). Calling off() on a parent listener will not automatically remove listeners registered on child nodes, off() must also be called on any child listeners to remove the callback.
843
- * If a callback is not specified, all callbacks for the specified eventType will be removed.
844
- * Similarly, if no eventType is specified, all callbacks for the Reference will be removed.
845
- * Individual listeners can also be removed by invoking their unsubscribe callbacks.
846
- * Note: Not implemented on native
847
- *
848
- * @param query - The query to run
849
- * @param eventType One of the following strings: "value", "child_added", "child_changed", "child_removed", or "child_moved.
850
- * @param callback
851
- */
852
- export declare function off(
853
- query: Query,
854
- eventType?: EventType,
855
- callback?: (snapshot: DataSnapshot, previousChildName?: string | null) => unknown,
856
- ): void;
857
-
858
- /**
859
- * Gets a `Reference` for the location at the specified relative path.
860
- *
861
- * The relative path can either be a simple child name (for example, "ada") or
862
- * a deeper slash-separated path (for example, "ada/name/first").
863
- *
864
- * @param parent - The parent location.
865
- * @param path - A relative path from this location to the desired child
866
- * location.
867
- * @returns The specified child location.
868
- */
869
- export function child(parent: DatabaseReference, path: string): DatabaseReference;
870
-
871
- /**
872
- * Returns an `OnDisconnect` object - see
873
- * {@link https://firebase.google.com/docs/database/web/offline-capabilities | Enabling Offline Capabilities in JavaScript}
874
- * for more information on how to use it.
875
- *
876
- * @param ref - The reference to add OnDisconnect triggers for.
877
- */
878
- export function onDisconnect(ref: DatabaseReference): OnDisconnect;
879
-
880
- /**
881
- * By calling `keepSynced(true)` on a location, the data for that location will automatically
882
- * be downloaded and kept in sync, even when no listeners are attached for that location.
883
- *
884
- * #### Example
885
- *
886
- * ```js
887
- * const dbRef = ref(getDatabase(), 'users');
888
- * await keepSynced(dbRef, true);
889
- * ```
890
- *
891
- * @param ref A location to keep synchronized.
892
- * @param bool Pass `true` to keep this location synchronized, pass `false` to stop synchronization.
893
- */
894
- export function keepSynced(ref: DatabaseReference, bool: boolean): Promise<void>;
895
-
896
- /**
897
- * Generates a new child location using a unique key and returns its
898
- * `Reference`.
899
- *
900
- * This is the most common pattern for adding data to a collection of items.
901
- *
902
- * If you provide a value to `push()`, the value is written to the
903
- * generated location. If you don't pass a value, nothing is written to the
904
- * database and the child remains empty (but you can use the `Reference`
905
- * elsewhere).
906
- *
907
- * The unique keys generated by `push()` are ordered by the current time, so the
908
- * resulting list of items is chronologically sorted. The keys are also
909
- * designed to be unguessable (they contain 72 random bits of entropy).
910
- *
911
- * See {@link https://firebase.google.com/docs/database/web/lists-of-data#append_to_a_list_of_data | Append to a list of data}.
912
- * See {@link https://firebase.googleblog.com/2015/02/the-2120-ways-to-ensure-unique_68.html | The 2^120 Ways to Ensure Unique Identifiers}.
913
- *
914
- * @param parent - The parent location.
915
- * @param value - Optional value to be written at the generated location.
916
- * @returns Combined `Promise` and `Reference`; resolves when write is complete,
917
- * but can be used immediately as the `Reference` to the child location.
918
- */
919
- export function push(parent: DatabaseReference, value?: unknown): ThenableReference;
920
-
921
- /**
922
- * Removes the data at this Database location.
923
- *
924
- * Any data at child locations will also be deleted.
925
- *
926
- * The effect of the remove will be visible immediately and the corresponding
927
- * event 'value' will be triggered. Synchronization of the remove to the
928
- * Firebase servers will also be started, and the returned Promise will resolve
929
- * when complete. If provided, the onComplete callback will be called
930
- * asynchronously after synchronization has finished.
931
- *
932
- * @param ref - The location to remove.
933
- * @returns Resolves when remove on server is complete.
934
- */
935
- export function remove(ref: DatabaseReference): Promise<void>;
936
-
937
- /**
938
- * Writes multiple values to the Database at once.
939
- *
940
- * The `values` argument contains multiple property-value pairs that will be
941
- * written to the Database together. Each child property can either be a simple
942
- * property (for example, "name") or a relative path (for example,
943
- * "name/first") from the current location to the data to update.
944
- *
945
- * As opposed to the `set()` method, `update()` can be use to selectively update
946
- * only the referenced properties at the current location (instead of replacing
947
- * all the child properties at the current location).
948
- *
949
- * The effect of the write will be visible immediately, and the corresponding
950
- * events ('value', 'child_added', etc.) will be triggered. Synchronization of
951
- * the data to the Firebase servers will also be started, and the returned
952
- * Promise will resolve when complete. If provided, the `onComplete` callback
953
- * will be called asynchronously after synchronization has finished.
954
- *
955
- * A single `update()` will generate a single "value" event at the location
956
- * where the `update()` was performed, regardless of how many children were
957
- * modified.
958
- *
959
- * Note that modifying data with `update()` will cancel any pending
960
- * transactions at that location, so extreme care should be taken if mixing
961
- * `update()` and `transaction()` to modify the same data.
962
- *
963
- * Passing `null` to `update()` will remove the data at this location.
964
- *
965
- * See
966
- * {@link https://firebase.googleblog.com/2015/09/introducing-multi-location-updates-and_86.html | Introducing multi-location updates and more}.
967
- *
968
- * @param ref - The location to write to.
969
- * @param values - Object containing multiple values.
970
- * @returns Resolves when update on server is complete.
971
- */
972
- export function update(ref: DatabaseReference, values: object): Promise<void>;