@firebase/database-compat 2.0.0-canary.a75082f06 → 2.0.0-canary.e577a408c

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 (53) hide show
  1. package/dist/database-compat/src/api/Database.d.ts +74 -74
  2. package/dist/database-compat/src/api/Reference.d.ts +207 -207
  3. package/dist/database-compat/src/api/TransactionResult.d.ts +26 -26
  4. package/dist/database-compat/src/api/internal.d.ts +41 -41
  5. package/dist/database-compat/src/api/onDisconnect.d.ts +27 -27
  6. package/dist/database-compat/src/index.d.ts +783 -65
  7. package/dist/database-compat/src/index.node.d.ts +30 -30
  8. package/dist/database-compat/src/index.standalone.d.ts +52 -52
  9. package/dist/database-compat/src/util/util.d.ts +17 -17
  10. package/dist/database-compat/src/util/validation.d.ts +18 -18
  11. package/dist/database-compat/test/browser/crawler_support.test.d.ts +17 -17
  12. package/dist/database-compat/test/database.test.d.ts +17 -17
  13. package/dist/database-compat/test/datasnapshot.test.d.ts +17 -17
  14. package/dist/database-compat/test/helpers/events.d.ts +34 -34
  15. package/dist/database-compat/test/helpers/util.d.ts +42 -42
  16. package/dist/database-compat/test/info.test.d.ts +17 -17
  17. package/dist/database-compat/test/order.test.d.ts +17 -17
  18. package/dist/database-compat/test/order_by.test.d.ts +17 -17
  19. package/dist/database-compat/test/promise.test.d.ts +17 -17
  20. package/dist/database-compat/test/query.test.d.ts +17 -17
  21. package/dist/database-compat/test/servervalues.test.d.ts +17 -17
  22. package/dist/database-compat/test/transaction.test.d.ts +17 -17
  23. package/dist/index.esm2017.js +830 -830
  24. package/dist/index.esm2017.js.map +1 -1
  25. package/dist/index.js +830 -830
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.standalone.js +14762 -14762
  28. package/dist/index.standalone.js.map +1 -1
  29. package/dist/node-esm/database-compat/src/api/Database.d.ts +74 -74
  30. package/dist/node-esm/database-compat/src/api/Reference.d.ts +207 -207
  31. package/dist/node-esm/database-compat/src/api/TransactionResult.d.ts +26 -26
  32. package/dist/node-esm/database-compat/src/api/internal.d.ts +41 -41
  33. package/dist/node-esm/database-compat/src/api/onDisconnect.d.ts +27 -27
  34. package/dist/node-esm/database-compat/src/index.d.ts +32 -32
  35. package/dist/node-esm/database-compat/src/index.node.d.ts +30 -30
  36. package/dist/node-esm/database-compat/src/index.standalone.d.ts +52 -52
  37. package/dist/node-esm/database-compat/src/util/util.d.ts +17 -17
  38. package/dist/node-esm/database-compat/src/util/validation.d.ts +18 -18
  39. package/dist/node-esm/database-compat/test/browser/crawler_support.test.d.ts +17 -17
  40. package/dist/node-esm/database-compat/test/database.test.d.ts +17 -17
  41. package/dist/node-esm/database-compat/test/datasnapshot.test.d.ts +17 -17
  42. package/dist/node-esm/database-compat/test/helpers/events.d.ts +34 -34
  43. package/dist/node-esm/database-compat/test/helpers/util.d.ts +42 -42
  44. package/dist/node-esm/database-compat/test/info.test.d.ts +17 -17
  45. package/dist/node-esm/database-compat/test/order.test.d.ts +17 -17
  46. package/dist/node-esm/database-compat/test/order_by.test.d.ts +17 -17
  47. package/dist/node-esm/database-compat/test/promise.test.d.ts +17 -17
  48. package/dist/node-esm/database-compat/test/query.test.d.ts +17 -17
  49. package/dist/node-esm/database-compat/test/servervalues.test.d.ts +17 -17
  50. package/dist/node-esm/database-compat/test/transaction.test.d.ts +17 -17
  51. package/dist/node-esm/index.js +830 -830
  52. package/dist/node-esm/index.js.map +1 -1
  53. package/package.json +8 -8
@@ -1,72 +1,790 @@
1
- /**
2
- * @license
3
- * Copyright 2021 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- import { FirebaseNamespace } from '@firebase/app-compat';
18
- import * as types from '@firebase/database-types';
19
- export declare function registerDatabase(instance: FirebaseNamespace): void;
20
- declare module '@firebase/app-compat' {
21
- interface FirebaseNamespace {
22
- database?: {
23
- (app?: FirebaseApp): types.FirebaseDatabase;
24
- enableLogging: typeof types.enableLogging;
25
- ServerValue: types.ServerValue;
26
- Database: typeof types.FirebaseDatabase;
27
- };
28
- }
29
- interface FirebaseApp {
30
- database?(databaseURL?: string): types.FirebaseDatabase;
31
- }
32
- }
1
+ /**
2
+ * @license
3
+ * Copyright 2021 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { FirebaseNamespace } from '@firebase/app-compat';
18
+ import * as types from '@firebase/database-types';
19
+ export declare function registerDatabase(instance: FirebaseNamespace): void;
20
+ declare module '@firebase/app-compat' {
21
+ interface FirebaseNamespace {
22
+ database?: {
23
+ (app?: FirebaseApp): types.FirebaseDatabase;
24
+ enableLogging: typeof types.enableLogging;
25
+ ServerValue: types.ServerValue;
26
+ Database: typeof types.FirebaseDatabase;
27
+ };
28
+ }
29
+ interface FirebaseApp {
30
+ database?(databaseURL?: string): types.FirebaseDatabase;
31
+ }
32
+ }
33
33
 
34
34
  import { FirebaseApp as FirebaseAppCompat } from "@firebase/app-compat";
35
35
  import { type DatabaseReference, type EmulatorMockTokenOptions, type DataSnapshot, type Database, type EventType, type Unsubscribe, type ListenOptions, type OnDisconnect, type ThenableReference, type QueryConstraint, type Query, type TransactionOptions, type TransactionResult } from "@firebase/database";
36
36
  declare module "@firebase/database" {
37
- function child(parent: types.Reference, path: string): DatabaseReference;
38
- function connectDatabaseEmulator(db: types.FirebaseDatabase, host: string, port: number, options?: {
37
+ /**
38
+ * Gets a `Reference` for the location at the specified relative path.
39
+ *
40
+ * The relative path can either be a simple child name (for example, "ada") or
41
+ * a deeper slash-separated path (for example, "ada/name/first").
42
+ *
43
+ * @param parent - The parent location.
44
+ * @param path - A relative path from this location to the desired child
45
+ * location.
46
+ * @returns The specified child location.
47
+ */
48
+ export declare function child(parent: types.Reference, path: string): DatabaseReference;
49
+ /**
50
+ * Modify the provided instance to communicate with the Realtime Database
51
+ * emulator.
52
+ *
53
+ * <p>Note: This method must be called before performing any other operation.
54
+ *
55
+ * @param db - The instance to modify.
56
+ * @param host - The emulator host (ex: localhost)
57
+ * @param port - The emulator port (ex: 8080)
58
+ * @param options.mockUserToken - the mock auth token to use for unit testing Security Rules
59
+ */
60
+ export declare function connectDatabaseEmulator(db: types.FirebaseDatabase, host: string, port: number, options?: {
39
61
  mockUserToken?: EmulatorMockTokenOptions | string;
40
62
  }): void;
41
- function get(query: types.Query): Promise<DataSnapshot>;
42
- function getDatabase(app?: FirebaseAppCompat, url?: string): Database;
43
- function goOffline(db: types.FirebaseDatabase): void;
44
- function goOnline(db: types.FirebaseDatabase): void;
45
- function off(query: types.Query, eventType?: EventType, callback?: (snapshot: DataSnapshot, previousChildName?: string | null) => unknown): void;
46
- function onChildAdded(query: types.Query, callback: (snapshot: DataSnapshot, previousChildName?: string | null) => unknown, cancelCallback?: (error: Error) => unknown): Unsubscribe;
47
- function onChildAdded(query: types.Query, callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown, options: ListenOptions): Unsubscribe;
48
- function onChildAdded(query: types.Query, callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown, cancelCallback: (error: Error) => unknown, options: ListenOptions): Unsubscribe;
49
- function onChildChanged(query: types.Query, callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown, cancelCallback?: (error: Error) => unknown): Unsubscribe;
50
- function onChildChanged(query: types.Query, callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown, options: ListenOptions): Unsubscribe;
51
- function onChildChanged(query: types.Query, callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown, cancelCallback: (error: Error) => unknown, options: ListenOptions): Unsubscribe;
52
- function onChildMoved(query: types.Query, callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown, cancelCallback?: (error: Error) => unknown): Unsubscribe;
53
- function onChildMoved(query: types.Query, callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown, options: ListenOptions): Unsubscribe;
54
- function onChildMoved(query: types.Query, callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown, cancelCallback: (error: Error) => unknown, options: ListenOptions): Unsubscribe;
55
- function onChildRemoved(query: types.Query, callback: (snapshot: DataSnapshot) => unknown, cancelCallback?: (error: Error) => unknown): Unsubscribe;
56
- function onChildRemoved(query: types.Query, callback: (snapshot: DataSnapshot) => unknown, options: ListenOptions): Unsubscribe;
57
- function onChildRemoved(query: types.Query, callback: (snapshot: DataSnapshot) => unknown, cancelCallback: (error: Error) => unknown, options: ListenOptions): Unsubscribe;
58
- function onDisconnect(ref: types.Reference): OnDisconnect;
59
- function onValue(query: types.Query, callback: (snapshot: DataSnapshot) => unknown, cancelCallback?: (error: Error) => unknown): Unsubscribe;
60
- function onValue(query: types.Query, callback: (snapshot: DataSnapshot) => unknown, options: ListenOptions): Unsubscribe;
61
- function onValue(query: types.Query, callback: (snapshot: DataSnapshot) => unknown, cancelCallback: (error: Error) => unknown, options: ListenOptions): Unsubscribe;
62
- function push(parent: types.Reference, value?: unknown): ThenableReference;
63
- function query(query: types.Query, ...queryConstraints: QueryConstraint[]): Query;
64
- function ref(db: types.FirebaseDatabase, path?: string): DatabaseReference;
65
- function refFromURL(db: types.FirebaseDatabase, url: string): DatabaseReference;
66
- function remove(ref: types.Reference): Promise<void>;
67
- function runTransaction(ref: types.Reference, transactionUpdate: (currentData: any) => unknown, options?: TransactionOptions): Promise<TransactionResult>;
68
- function set(ref: types.Reference, value: unknown): Promise<void>;
69
- function setPriority(ref: types.Reference, priority: string | number | null): Promise<void>;
70
- function setWithPriority(ref: types.Reference, value: unknown, priority: string | number | null): Promise<void>;
71
- function update(ref: types.Reference, values: object): Promise<void>;
63
+ /**
64
+ * Gets the most up-to-date result for this query.
65
+ *
66
+ * @param query - The query to run.
67
+ * @returns A `Promise` which resolves to the resulting DataSnapshot if a value is
68
+ * available, or rejects if the client is unable to return a value (e.g., if the
69
+ * server is unreachable and there is nothing cached).
70
+ */
71
+ export declare function get(query: types.Query): Promise<DataSnapshot>;
72
+ /**
73
+ * Returns the instance of the Realtime Database SDK that is associated with the provided
74
+ * {@link @firebase/app#FirebaseApp}. Initializes a new instance with default settings if
75
+ * no instance exists or if the existing instance uses a custom database URL.
76
+ *
77
+ * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned Realtime
78
+ * Database instance is associated with.
79
+ * @param url - The URL of the Realtime Database instance to connect to. If not
80
+ * provided, the SDK connects to the default instance of the Firebase App.
81
+ * @returns The `Database` instance of the provided app.
82
+ */
83
+ export declare function getDatabase(app?: FirebaseAppCompat, url?: string): Database;
84
+ /**
85
+ * Disconnects from the server (all Database operations will be completed
86
+ * offline).
87
+ *
88
+ * The client automatically maintains a persistent connection to the Database
89
+ * server, which will remain active indefinitely and reconnect when
90
+ * disconnected. However, the `goOffline()` and `goOnline()` methods may be used
91
+ * to control the client connection in cases where a persistent connection is
92
+ * undesirable.
93
+ *
94
+ * While offline, the client will no longer receive data updates from the
95
+ * Database. However, all Database operations performed locally will continue to
96
+ * immediately fire events, allowing your application to continue behaving
97
+ * normally. Additionally, each operation performed locally will automatically
98
+ * be queued and retried upon reconnection to the Database server.
99
+ *
100
+ * To reconnect to the Database and begin receiving remote events, see
101
+ * `goOnline()`.
102
+ *
103
+ * @param db - The instance to disconnect.
104
+ */
105
+ export declare function goOffline(db: types.FirebaseDatabase): void;
106
+ /**
107
+ * Reconnects to the server and synchronizes the offline Database state
108
+ * with the server state.
109
+ *
110
+ * This method should be used after disabling the active connection with
111
+ * `goOffline()`. Once reconnected, the client will transmit the proper data
112
+ * and fire the appropriate events so that your client "catches up"
113
+ * automatically.
114
+ *
115
+ * @param db - The instance to reconnect.
116
+ */
117
+ export declare function goOnline(db: types.FirebaseDatabase): void;
118
+ /**
119
+ * Detaches a callback previously attached with the corresponding `on*()` (`onValue`, `onChildAdded`) listener.
120
+ * Note: This is not the recommended way to remove a listener. Instead, please use the returned callback function from
121
+ * the respective `on*` callbacks.
122
+ *
123
+ * Detach a callback previously attached with `on*()`. Calling `off()` on a parent listener
124
+ * will not automatically remove listeners registered on child nodes, `off()`
125
+ * must also be called on any child listeners to remove the callback.
126
+ *
127
+ * If a callback is not specified, all callbacks for the specified eventType
128
+ * will be removed. Similarly, if no eventType is specified, all callbacks
129
+ * for the `Reference` will be removed.
130
+ *
131
+ * Individual listeners can also be removed by invoking their unsubscribe
132
+ * callbacks.
133
+ *
134
+ * @param query - The query that the listener was registered with.
135
+ * @param eventType - One of the following strings: "value", "child_added",
136
+ * "child_changed", "child_removed", or "child_moved." If omitted, all callbacks
137
+ * for the `Reference` will be removed.
138
+ * @param callback - The callback function that was passed to `on()` or
139
+ * `undefined` to remove all callbacks.
140
+ */
141
+ export declare function off(query: types.Query, eventType?: EventType, callback?: (snapshot: DataSnapshot, previousChildName?: string | null) => unknown): void;
142
+ /**
143
+ * Listens for data changes at a particular location.
144
+ *
145
+ * This is the primary way to read data from a Database. Your callback
146
+ * will be triggered for the initial data and again whenever the data changes.
147
+ * Invoke the returned unsubscribe callback to stop receiving updates. See
148
+ * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
149
+ * for more details.
150
+ *
151
+ * An `onChildAdded` event will be triggered once for each initial child at this
152
+ * location, and it will be triggered again every time a new child is added. The
153
+ * `DataSnapshot` passed into the callback will reflect the data for the
154
+ * relevant child. For ordering purposes, it is passed a second argument which
155
+ * is a string containing the key of the previous sibling child by sort order,
156
+ * or `null` if it is the first child.
157
+ *
158
+ * @param query - The query to run.
159
+ * @param callback - A callback that fires when the specified event occurs.
160
+ * The callback will be passed a DataSnapshot and a string containing the key of
161
+ * the previous child, by sort order, or `null` if it is the first child.
162
+ * @param cancelCallback - An optional callback that will be notified if your
163
+ * event subscription is ever canceled because your client does not have
164
+ * permission to read this data (or it had permission but has now lost it).
165
+ * This callback will be passed an `Error` object indicating why the failure
166
+ * occurred.
167
+ * @returns A function that can be invoked to remove the listener.
168
+ */
169
+ export declare function onChildAdded(query: types.Query, callback: (snapshot: DataSnapshot, previousChildName?: string | null) => unknown, cancelCallback?: (error: Error) => unknown): Unsubscribe;
170
+ /**
171
+ * Listens for data changes at a particular location.
172
+ *
173
+ * This is the primary way to read data from a Database. Your callback
174
+ * will be triggered for the initial data and again whenever the data changes.
175
+ * Invoke the returned unsubscribe callback to stop receiving updates. See
176
+ * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
177
+ * for more details.
178
+ *
179
+ * An `onChildAdded` event will be triggered once for each initial child at this
180
+ * location, and it will be triggered again every time a new child is added. The
181
+ * `DataSnapshot` passed into the callback will reflect the data for the
182
+ * relevant child. For ordering purposes, it is passed a second argument which
183
+ * is a string containing the key of the previous sibling child by sort order,
184
+ * or `null` if it is the first child.
185
+ *
186
+ * @param query - The query to run.
187
+ * @param callback - A callback that fires when the specified event occurs.
188
+ * The callback will be passed a DataSnapshot and a string containing the key of
189
+ * the previous child, by sort order, or `null` if it is the first child.
190
+ * @param options - An object that can be used to configure `onlyOnce`, which
191
+ * then removes the listener after its first invocation.
192
+ * @returns A function that can be invoked to remove the listener.
193
+ */
194
+ export declare function onChildAdded(query: types.Query, callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown, options: ListenOptions): Unsubscribe;
195
+ /**
196
+ * Listens for data changes at a particular location.
197
+ *
198
+ * This is the primary way to read data from a Database. Your callback
199
+ * will be triggered for the initial data and again whenever the data changes.
200
+ * Invoke the returned unsubscribe callback to stop receiving updates. See
201
+ * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
202
+ * for more details.
203
+ *
204
+ * An `onChildAdded` event will be triggered once for each initial child at this
205
+ * location, and it will be triggered again every time a new child is added. The
206
+ * `DataSnapshot` passed into the callback will reflect the data for the
207
+ * relevant child. For ordering purposes, it is passed a second argument which
208
+ * is a string containing the key of the previous sibling child by sort order,
209
+ * or `null` if it is the first child.
210
+ *
211
+ * @param query - The query to run.
212
+ * @param callback - A callback that fires when the specified event occurs.
213
+ * The callback will be passed a DataSnapshot and a string containing the key of
214
+ * the previous child, by sort order, or `null` if it is the first child.
215
+ * @param cancelCallback - An optional callback that will be notified if your
216
+ * event subscription is ever canceled because your client does not have
217
+ * permission to read this data (or it had permission but has now lost it).
218
+ * This callback will be passed an `Error` object indicating why the failure
219
+ * occurred.
220
+ * @param options - An object that can be used to configure `onlyOnce`, which
221
+ * then removes the listener after its first invocation.
222
+ * @returns A function that can be invoked to remove the listener.
223
+ */
224
+ export declare function onChildAdded(query: types.Query, callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown, cancelCallback: (error: Error) => unknown, options: ListenOptions): Unsubscribe;
225
+ /**
226
+ * Listens for data changes at a particular location.
227
+ *
228
+ * This is the primary way to read data from a Database. Your callback
229
+ * will be triggered for the initial data and again whenever the data changes.
230
+ * Invoke the returned unsubscribe callback to stop receiving updates. See
231
+ * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
232
+ * for more details.
233
+ *
234
+ * An `onChildChanged` event will be triggered when the data stored in a child
235
+ * (or any of its descendants) changes. Note that a single `child_changed` event
236
+ * may represent multiple changes to the child. The `DataSnapshot` passed to the
237
+ * callback will contain the new child contents. For ordering purposes, the
238
+ * callback is also passed a second argument which is a string containing the
239
+ * key of the previous sibling child by sort order, or `null` if it is the first
240
+ * child.
241
+ *
242
+ * @param query - The query to run.
243
+ * @param callback - A callback that fires when the specified event occurs.
244
+ * The callback will be passed a DataSnapshot and a string containing the key of
245
+ * the previous child, by sort order, or `null` if it is the first child.
246
+ * @param cancelCallback - An optional callback that will be notified if your
247
+ * event subscription is ever canceled because your client does not have
248
+ * permission to read this data (or it had permission but has now lost it).
249
+ * This callback will be passed an `Error` object indicating why the failure
250
+ * occurred.
251
+ * @returns A function that can be invoked to remove the listener.
252
+ */
253
+ export declare function onChildChanged(query: types.Query, callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown, cancelCallback?: (error: Error) => unknown): Unsubscribe;
254
+ /**
255
+ * Listens for data changes at a particular location.
256
+ *
257
+ * This is the primary way to read data from a Database. Your callback
258
+ * will be triggered for the initial data and again whenever the data changes.
259
+ * Invoke the returned unsubscribe callback to stop receiving updates. See
260
+ * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
261
+ * for more details.
262
+ *
263
+ * An `onChildChanged` event will be triggered when the data stored in a child
264
+ * (or any of its descendants) changes. Note that a single `child_changed` event
265
+ * may represent multiple changes to the child. The `DataSnapshot` passed to the
266
+ * callback will contain the new child contents. For ordering purposes, the
267
+ * callback is also passed a second argument which is a string containing the
268
+ * key of the previous sibling child by sort order, or `null` if it is the first
269
+ * child.
270
+ *
271
+ * @param query - The query to run.
272
+ * @param callback - A callback that fires when the specified event occurs.
273
+ * The callback will be passed a DataSnapshot and a string containing the key of
274
+ * the previous child, by sort order, or `null` if it is the first child.
275
+ * @param options - An object that can be used to configure `onlyOnce`, which
276
+ * then removes the listener after its first invocation.
277
+ * @returns A function that can be invoked to remove the listener.
278
+ */
279
+ export declare function onChildChanged(query: types.Query, callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown, options: ListenOptions): Unsubscribe;
280
+ /**
281
+ * Listens for data changes at a particular location.
282
+ *
283
+ * This is the primary way to read data from a Database. Your callback
284
+ * will be triggered for the initial data and again whenever the data changes.
285
+ * Invoke the returned unsubscribe callback to stop receiving updates. See
286
+ * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
287
+ * for more details.
288
+ *
289
+ * An `onChildChanged` event will be triggered when the data stored in a child
290
+ * (or any of its descendants) changes. Note that a single `child_changed` event
291
+ * may represent multiple changes to the child. The `DataSnapshot` passed to the
292
+ * callback will contain the new child contents. For ordering purposes, the
293
+ * callback is also passed a second argument which is a string containing the
294
+ * key of the previous sibling child by sort order, or `null` if it is the first
295
+ * child.
296
+ *
297
+ * @param query - The query to run.
298
+ * @param callback - A callback that fires when the specified event occurs.
299
+ * The callback will be passed a DataSnapshot and a string containing the key of
300
+ * the previous child, by sort order, or `null` if it is the first child.
301
+ * @param cancelCallback - An optional callback that will be notified if your
302
+ * event subscription is ever canceled because your client does not have
303
+ * permission to read this data (or it had permission but has now lost it).
304
+ * This callback will be passed an `Error` object indicating why the failure
305
+ * occurred.
306
+ * @param options - An object that can be used to configure `onlyOnce`, which
307
+ * then removes the listener after its first invocation.
308
+ * @returns A function that can be invoked to remove the listener.
309
+ */
310
+ export declare function onChildChanged(query: types.Query, callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown, cancelCallback: (error: Error) => unknown, options: ListenOptions): Unsubscribe;
311
+ /**
312
+ * Listens for data changes at a particular location.
313
+ *
314
+ * This is the primary way to read data from a Database. Your callback
315
+ * will be triggered for the initial data and again whenever the data changes.
316
+ * Invoke the returned unsubscribe callback to stop receiving updates. See
317
+ * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
318
+ * for more details.
319
+ *
320
+ * An `onChildMoved` event will be triggered when a child's sort order changes
321
+ * such that its position relative to its siblings changes. The `DataSnapshot`
322
+ * passed to the callback will be for the data of the child that has moved. It
323
+ * is also passed a second argument which is a string containing the key of the
324
+ * previous sibling child by sort order, or `null` if it is the first child.
325
+ *
326
+ * @param query - The query to run.
327
+ * @param callback - A callback that fires when the specified event occurs.
328
+ * The callback will be passed a DataSnapshot and a string containing the key of
329
+ * the previous child, by sort order, or `null` if it is the first child.
330
+ * @param cancelCallback - An optional callback that will be notified if your
331
+ * event subscription is ever canceled because your client does not have
332
+ * permission to read this data (or it had permission but has now lost it).
333
+ * This callback will be passed an `Error` object indicating why the failure
334
+ * occurred.
335
+ * @returns A function that can be invoked to remove the listener.
336
+ */
337
+ export declare function onChildMoved(query: types.Query, callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown, cancelCallback?: (error: Error) => unknown): Unsubscribe;
338
+ /**
339
+ * Listens for data changes at a particular location.
340
+ *
341
+ * This is the primary way to read data from a Database. Your callback
342
+ * will be triggered for the initial data and again whenever the data changes.
343
+ * Invoke the returned unsubscribe callback to stop receiving updates. See
344
+ * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
345
+ * for more details.
346
+ *
347
+ * An `onChildMoved` event will be triggered when a child's sort order changes
348
+ * such that its position relative to its siblings changes. The `DataSnapshot`
349
+ * passed to the callback will be for the data of the child that has moved. It
350
+ * is also passed a second argument which is a string containing the key of the
351
+ * previous sibling child by sort order, or `null` if it is the first child.
352
+ *
353
+ * @param query - The query to run.
354
+ * @param callback - A callback that fires when the specified event occurs.
355
+ * The callback will be passed a DataSnapshot and a string containing the key of
356
+ * the previous child, by sort order, or `null` if it is the first child.
357
+ * @param options - An object that can be used to configure `onlyOnce`, which
358
+ * then removes the listener after its first invocation.
359
+ * @returns A function that can be invoked to remove the listener.
360
+ */
361
+ export declare function onChildMoved(query: types.Query, callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown, options: ListenOptions): Unsubscribe;
362
+ /**
363
+ * Listens for data changes at a particular location.
364
+ *
365
+ * This is the primary way to read data from a Database. Your callback
366
+ * will be triggered for the initial data and again whenever the data changes.
367
+ * Invoke the returned unsubscribe callback to stop receiving updates. See
368
+ * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
369
+ * for more details.
370
+ *
371
+ * An `onChildMoved` event will be triggered when a child's sort order changes
372
+ * such that its position relative to its siblings changes. The `DataSnapshot`
373
+ * passed to the callback will be for the data of the child that has moved. It
374
+ * is also passed a second argument which is a string containing the key of the
375
+ * previous sibling child by sort order, or `null` if it is the first child.
376
+ *
377
+ * @param query - The query to run.
378
+ * @param callback - A callback that fires when the specified event occurs.
379
+ * The callback will be passed a DataSnapshot and a string containing the key of
380
+ * the previous child, by sort order, or `null` if it is the first child.
381
+ * @param cancelCallback - An optional callback that will be notified if your
382
+ * event subscription is ever canceled because your client does not have
383
+ * permission to read this data (or it had permission but has now lost it).
384
+ * This callback will be passed an `Error` object indicating why the failure
385
+ * occurred.
386
+ * @param options - An object that can be used to configure `onlyOnce`, which
387
+ * then removes the listener after its first invocation.
388
+ * @returns A function that can be invoked to remove the listener.
389
+ */
390
+ export declare function onChildMoved(query: types.Query, callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown, cancelCallback: (error: Error) => unknown, options: ListenOptions): Unsubscribe;
391
+ /**
392
+ * Listens for data changes at a particular location.
393
+ *
394
+ * This is the primary way to read data from a Database. Your callback
395
+ * will be triggered for the initial data and again whenever the data changes.
396
+ * Invoke the returned unsubscribe callback to stop receiving updates. See
397
+ * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
398
+ * for more details.
399
+ *
400
+ * An `onChildRemoved` event will be triggered once every time a child is
401
+ * removed. The `DataSnapshot` passed into the callback will be the old data for
402
+ * the child that was removed. A child will get removed when either:
403
+ *
404
+ * - a client explicitly calls `remove()` on that child or one of its ancestors
405
+ * - a client calls `set(null)` on that child or one of its ancestors
406
+ * - that child has all of its children removed
407
+ * - there is a query in effect which now filters out the child (because it's
408
+ * sort order changed or the max limit was hit)
409
+ *
410
+ * @param query - The query to run.
411
+ * @param callback - A callback that fires when the specified event occurs.
412
+ * The callback will be passed a DataSnapshot and a string containing the key of
413
+ * the previous child, by sort order, or `null` if it is the first child.
414
+ * @param cancelCallback - An optional callback that will be notified if your
415
+ * event subscription is ever canceled because your client does not have
416
+ * permission to read this data (or it had permission but has now lost it).
417
+ * This callback will be passed an `Error` object indicating why the failure
418
+ * occurred.
419
+ * @returns A function that can be invoked to remove the listener.
420
+ */
421
+ export declare function onChildRemoved(query: types.Query, callback: (snapshot: DataSnapshot) => unknown, cancelCallback?: (error: Error) => unknown): Unsubscribe;
422
+ /**
423
+ * Listens for data changes at a particular location.
424
+ *
425
+ * This is the primary way to read data from a Database. Your callback
426
+ * will be triggered for the initial data and again whenever the data changes.
427
+ * Invoke the returned unsubscribe callback to stop receiving updates. See
428
+ * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
429
+ * for more details.
430
+ *
431
+ * An `onChildRemoved` event will be triggered once every time a child is
432
+ * removed. The `DataSnapshot` passed into the callback will be the old data for
433
+ * the child that was removed. A child will get removed when either:
434
+ *
435
+ * - a client explicitly calls `remove()` on that child or one of its ancestors
436
+ * - a client calls `set(null)` on that child or one of its ancestors
437
+ * - that child has all of its children removed
438
+ * - there is a query in effect which now filters out the child (because it's
439
+ * sort order changed or the max limit was hit)
440
+ *
441
+ * @param query - The query to run.
442
+ * @param callback - A callback that fires when the specified event occurs.
443
+ * The callback will be passed a DataSnapshot and a string containing the key of
444
+ * the previous child, by sort order, or `null` if it is the first child.
445
+ * @param options - An object that can be used to configure `onlyOnce`, which
446
+ * then removes the listener after its first invocation.
447
+ * @returns A function that can be invoked to remove the listener.
448
+ */
449
+ export declare function onChildRemoved(query: types.Query, callback: (snapshot: DataSnapshot) => unknown, options: ListenOptions): Unsubscribe;
450
+ /**
451
+ * Listens for data changes at a particular location.
452
+ *
453
+ * This is the primary way to read data from a Database. Your callback
454
+ * will be triggered for the initial data and again whenever the data changes.
455
+ * Invoke the returned unsubscribe callback to stop receiving updates. See
456
+ * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
457
+ * for more details.
458
+ *
459
+ * An `onChildRemoved` event will be triggered once every time a child is
460
+ * removed. The `DataSnapshot` passed into the callback will be the old data for
461
+ * the child that was removed. A child will get removed when either:
462
+ *
463
+ * - a client explicitly calls `remove()` on that child or one of its ancestors
464
+ * - a client calls `set(null)` on that child or one of its ancestors
465
+ * - that child has all of its children removed
466
+ * - there is a query in effect which now filters out the child (because it's
467
+ * sort order changed or the max limit was hit)
468
+ *
469
+ * @param query - The query to run.
470
+ * @param callback - A callback that fires when the specified event occurs.
471
+ * The callback will be passed a DataSnapshot and a string containing the key of
472
+ * the previous child, by sort order, or `null` if it is the first child.
473
+ * @param cancelCallback - An optional callback that will be notified if your
474
+ * event subscription is ever canceled because your client does not have
475
+ * permission to read this data (or it had permission but has now lost it).
476
+ * This callback will be passed an `Error` object indicating why the failure
477
+ * occurred.
478
+ * @param options - An object that can be used to configure `onlyOnce`, which
479
+ * then removes the listener after its first invocation.
480
+ * @returns A function that can be invoked to remove the listener.
481
+ */
482
+ export declare function onChildRemoved(query: types.Query, callback: (snapshot: DataSnapshot) => unknown, cancelCallback: (error: Error) => unknown, options: ListenOptions): Unsubscribe;
483
+ /**
484
+ * Returns an `OnDisconnect` object - see
485
+ * {@link https://firebase.google.com/docs/database/web/offline-capabilities | Enabling Offline Capabilities in JavaScript}
486
+ * for more information on how to use it.
487
+ *
488
+ * @param ref - The reference to add OnDisconnect triggers for.
489
+ */
490
+ export declare function onDisconnect(ref: types.Reference): OnDisconnect;
491
+ /**
492
+ * Listens for data changes at a particular location.
493
+ *
494
+ * This is the primary way to read data from a Database. Your callback
495
+ * will be triggered for the initial data and again whenever the data changes.
496
+ * Invoke the returned unsubscribe callback to stop receiving updates. See
497
+ * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
498
+ * for more details.
499
+ *
500
+ * An `onValue` event will trigger once with the initial data stored at this
501
+ * location, and then trigger again each time the data changes. The
502
+ * `DataSnapshot` passed to the callback will be for the location at which
503
+ * `on()` was called. It won't trigger until the entire contents has been
504
+ * synchronized. If the location has no data, it will be triggered with an empty
505
+ * `DataSnapshot` (`val()` will return `null`).
506
+ *
507
+ * @param query - The query to run.
508
+ * @param callback - A callback that fires when the specified event occurs. The
509
+ * callback will be passed a DataSnapshot.
510
+ * @param cancelCallback - An optional callback that will be notified if your
511
+ * event subscription is ever canceled because your client does not have
512
+ * permission to read this data (or it had permission but has now lost it).
513
+ * This callback will be passed an `Error` object indicating why the failure
514
+ * occurred.
515
+ * @returns A function that can be invoked to remove the listener.
516
+ */
517
+ export declare function onValue(query: types.Query, callback: (snapshot: DataSnapshot) => unknown, cancelCallback?: (error: Error) => unknown): Unsubscribe;
518
+ /**
519
+ * Listens for data changes at a particular location.
520
+ *
521
+ * This is the primary way to read data from a Database. Your callback
522
+ * will be triggered for the initial data and again whenever the data changes.
523
+ * Invoke the returned unsubscribe callback to stop receiving updates. See
524
+ * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
525
+ * for more details.
526
+ *
527
+ * An `onValue` event will trigger once with the initial data stored at this
528
+ * location, and then trigger again each time the data changes. The
529
+ * `DataSnapshot` passed to the callback will be for the location at which
530
+ * `on()` was called. It won't trigger until the entire contents has been
531
+ * synchronized. If the location has no data, it will be triggered with an empty
532
+ * `DataSnapshot` (`val()` will return `null`).
533
+ *
534
+ * @param query - The query to run.
535
+ * @param callback - A callback that fires when the specified event occurs. The
536
+ * callback will be passed a DataSnapshot.
537
+ * @param options - An object that can be used to configure `onlyOnce`, which
538
+ * then removes the listener after its first invocation.
539
+ * @returns A function that can be invoked to remove the listener.
540
+ */
541
+ export declare function onValue(query: types.Query, callback: (snapshot: DataSnapshot) => unknown, options: ListenOptions): Unsubscribe;
542
+ /**
543
+ * Listens for data changes at a particular location.
544
+ *
545
+ * This is the primary way to read data from a Database. Your callback
546
+ * will be triggered for the initial data and again whenever the data changes.
547
+ * Invoke the returned unsubscribe callback to stop receiving updates. See
548
+ * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
549
+ * for more details.
550
+ *
551
+ * An `onValue` event will trigger once with the initial data stored at this
552
+ * location, and then trigger again each time the data changes. The
553
+ * `DataSnapshot` passed to the callback will be for the location at which
554
+ * `on()` was called. It won't trigger until the entire contents has been
555
+ * synchronized. If the location has no data, it will be triggered with an empty
556
+ * `DataSnapshot` (`val()` will return `null`).
557
+ *
558
+ * @param query - The query to run.
559
+ * @param callback - A callback that fires when the specified event occurs. The
560
+ * callback will be passed a DataSnapshot.
561
+ * @param cancelCallback - An optional callback that will be notified if your
562
+ * event subscription is ever canceled because your client does not have
563
+ * permission to read this data (or it had permission but has now lost it).
564
+ * This callback will be passed an `Error` object indicating why the failure
565
+ * occurred.
566
+ * @param options - An object that can be used to configure `onlyOnce`, which
567
+ * then removes the listener after its first invocation.
568
+ * @returns A function that can be invoked to remove the listener.
569
+ */
570
+ export declare function onValue(query: types.Query, callback: (snapshot: DataSnapshot) => unknown, cancelCallback: (error: Error) => unknown, options: ListenOptions): Unsubscribe;
571
+ /**
572
+ * Generates a new child location using a unique key and returns its
573
+ * `Reference`.
574
+ *
575
+ * This is the most common pattern for adding data to a collection of items.
576
+ *
577
+ * If you provide a value to `push()`, the value is written to the
578
+ * generated location. If you don't pass a value, nothing is written to the
579
+ * database and the child remains empty (but you can use the `Reference`
580
+ * elsewhere).
581
+ *
582
+ * The unique keys generated by `push()` are ordered by the current time, so the
583
+ * resulting list of items is chronologically sorted. The keys are also
584
+ * designed to be unguessable (they contain 72 random bits of entropy).
585
+ *
586
+ * See {@link https://firebase.google.com/docs/database/web/lists-of-data#append_to_a_list_of_data | Append to a list of data}.
587
+ * See {@link https://firebase.googleblog.com/2015/02/the-2120-ways-to-ensure-unique_68.html | The 2^120 Ways to Ensure Unique Identifiers}.
588
+ *
589
+ * @param parent - The parent location.
590
+ * @param value - Optional value to be written at the generated location.
591
+ * @returns Combined `Promise` and `Reference`; resolves when write is complete,
592
+ * but can be used immediately as the `Reference` to the child location.
593
+ */
594
+ export declare function push(parent: types.Reference, value?: unknown): ThenableReference;
595
+ /**
596
+ * Creates a new immutable instance of `Query` that is extended to also include
597
+ * additional query constraints.
598
+ *
599
+ * @param query - The Query instance to use as a base for the new constraints.
600
+ * @param queryConstraints - The list of `QueryConstraint`s to apply.
601
+ * @throws if any of the provided query constraints cannot be combined with the
602
+ * existing or new constraints.
603
+ */
604
+ export declare function query(query: types.Query, ...queryConstraints: QueryConstraint[]): Query;
605
+ /* Excluded from this release type: _QueryImpl */
606
+ /* Excluded from this release type: _QueryParams */
607
+ /**
608
+ *
609
+ * Returns a `Reference` representing the location in the Database
610
+ * corresponding to the provided path. If no path is provided, the `Reference`
611
+ * will point to the root of the Database.
612
+ *
613
+ * @param db - The database instance to obtain a reference for.
614
+ * @param path - Optional path representing the location the returned
615
+ * `Reference` will point. If not provided, the returned `Reference` will
616
+ * point to the root of the Database.
617
+ * @returns If a path is provided, a `Reference`
618
+ * pointing to the provided path. Otherwise, a `Reference` pointing to the
619
+ * root of the Database.
620
+ */
621
+ export declare function ref(db: types.FirebaseDatabase, path?: string): DatabaseReference;
622
+ /* Excluded from this release type: _ReferenceImpl */
623
+ /**
624
+ * Returns a `Reference` representing the location in the Database
625
+ * corresponding to the provided Firebase URL.
626
+ *
627
+ * An exception is thrown if the URL is not a valid Firebase Database URL or it
628
+ * has a different domain than the current `Database` instance.
629
+ *
630
+ * Note that all query parameters (`orderBy`, `limitToLast`, etc.) are ignored
631
+ * and are not applied to the returned `Reference`.
632
+ *
633
+ * @param db - The database instance to obtain a reference for.
634
+ * @param url - The Firebase URL at which the returned `Reference` will
635
+ * point.
636
+ * @returns A `Reference` pointing to the provided
637
+ * Firebase URL.
638
+ */
639
+ export declare function refFromURL(db: types.FirebaseDatabase, url: string): DatabaseReference;
640
+ /**
641
+ * Removes the data at this Database location.
642
+ *
643
+ * Any data at child locations will also be deleted.
644
+ *
645
+ * The effect of the remove will be visible immediately and the corresponding
646
+ * event 'value' will be triggered. Synchronization of the remove to the
647
+ * Firebase servers will also be started, and the returned Promise will resolve
648
+ * when complete. If provided, the onComplete callback will be called
649
+ * asynchronously after synchronization has finished.
650
+ *
651
+ * @param ref - The location to remove.
652
+ * @returns Resolves when remove on server is complete.
653
+ */
654
+ export declare function remove(ref: types.Reference): Promise<void>;
655
+ /* Excluded from this release type: _repoManagerDatabaseFromApp */
656
+ /**
657
+ * Atomically modifies the data at this location.
658
+ *
659
+ * Atomically modify the data at this location. Unlike a normal `set()`, which
660
+ * just overwrites the data regardless of its previous value, `runTransaction()` is
661
+ * used to modify the existing value to a new value, ensuring there are no
662
+ * conflicts with other clients writing to the same location at the same time.
663
+ *
664
+ * To accomplish this, you pass `runTransaction()` an update function which is
665
+ * used to transform the current value into a new value. If another client
666
+ * writes to the location before your new value is successfully written, your
667
+ * update function will be called again with the new current value, and the
668
+ * write will be retried. This will happen repeatedly until your write succeeds
669
+ * without conflict or you abort the transaction by not returning a value from
670
+ * your update function.
671
+ *
672
+ * Note: Modifying data with `set()` will cancel any pending transactions at
673
+ * that location, so extreme care should be taken if mixing `set()` and
674
+ * `runTransaction()` to update the same data.
675
+ *
676
+ * Note: When using transactions with Security and Firebase Rules in place, be
677
+ * aware that a client needs `.read` access in addition to `.write` access in
678
+ * order to perform a transaction. This is because the client-side nature of
679
+ * transactions requires the client to read the data in order to transactionally
680
+ * update it.
681
+ *
682
+ * @param ref - The location to atomically modify.
683
+ * @param transactionUpdate - A developer-supplied function which will be passed
684
+ * the current data stored at this location (as a JavaScript object). The
685
+ * function should return the new value it would like written (as a JavaScript
686
+ * object). If `undefined` is returned (i.e. you return with no arguments) the
687
+ * transaction will be aborted and the data at this location will not be
688
+ * modified.
689
+ * @param options - An options object to configure transactions.
690
+ * @returns A `Promise` that can optionally be used instead of the `onComplete`
691
+ * callback to handle success and failure.
692
+ */
693
+ export declare function runTransaction(ref: types.Reference, transactionUpdate: (currentData: any) => unknown, options?: TransactionOptions): Promise<TransactionResult>;
694
+ /**
695
+ * Writes data to this Database location.
696
+ *
697
+ * This will overwrite any data at this location and all child locations.
698
+ *
699
+ * The effect of the write will be visible immediately, and the corresponding
700
+ * events ("value", "child_added", etc.) will be triggered. Synchronization of
701
+ * the data to the Firebase servers will also be started, and the returned
702
+ * Promise will resolve when complete. If provided, the `onComplete` callback
703
+ * will be called asynchronously after synchronization has finished.
704
+ *
705
+ * Passing `null` for the new value is equivalent to calling `remove()`; namely,
706
+ * all data at this location and all child locations will be deleted.
707
+ *
708
+ * `set()` will remove any priority stored at this location, so if priority is
709
+ * meant to be preserved, you need to use `setWithPriority()` instead.
710
+ *
711
+ * Note that modifying data with `set()` will cancel any pending transactions
712
+ * at that location, so extreme care should be taken if mixing `set()` and
713
+ * `transaction()` to modify the same data.
714
+ *
715
+ * A single `set()` will generate a single "value" event at the location where
716
+ * the `set()` was performed.
717
+ *
718
+ * @param ref - The location to write to.
719
+ * @param value - The value to be written (string, number, boolean, object,
720
+ * array, or null).
721
+ * @returns Resolves when write to server is complete.
722
+ */
723
+ export declare function set(ref: types.Reference, value: unknown): Promise<void>;
724
+ /**
725
+ * Sets a priority for the data at this Database location.
726
+ *
727
+ * Applications need not use priority but can order collections by
728
+ * ordinary properties (see
729
+ * {@link https://firebase.google.com/docs/database/web/lists-of-data#sorting_and_filtering_data | Sorting and filtering data}
730
+ * ).
731
+ *
732
+ * @param ref - The location to write to.
733
+ * @param priority - The priority to be written (string, number, or null).
734
+ * @returns Resolves when write to server is complete.
735
+ */
736
+ export declare function setPriority(ref: types.Reference, priority: string | number | null): Promise<void>;
737
+ /* Excluded from this release type: _setSDKVersion */
738
+ /**
739
+ * Writes data the Database location. Like `set()` but also specifies the
740
+ * priority for that data.
741
+ *
742
+ * Applications need not use priority but can order collections by
743
+ * ordinary properties (see
744
+ * {@link https://firebase.google.com/docs/database/web/lists-of-data#sorting_and_filtering_data | Sorting and filtering data}
745
+ * ).
746
+ *
747
+ * @param ref - The location to write to.
748
+ * @param value - The value to be written (string, number, boolean, object,
749
+ * array, or null).
750
+ * @param priority - The priority to be written (string, number, or null).
751
+ * @returns Resolves when write to server is complete.
752
+ */
753
+ export declare function setWithPriority(ref: types.Reference, value: unknown, priority: string | number | null): Promise<void>;
754
+ /**
755
+ * Writes multiple values to the Database at once.
756
+ *
757
+ * The `values` argument contains multiple property-value pairs that will be
758
+ * written to the Database together. Each child property can either be a simple
759
+ * property (for example, "name") or a relative path (for example,
760
+ * "name/first") from the current location to the data to update.
761
+ *
762
+ * As opposed to the `set()` method, `update()` can be use to selectively update
763
+ * only the referenced properties at the current location (instead of replacing
764
+ * all the child properties at the current location).
765
+ *
766
+ * The effect of the write will be visible immediately, and the corresponding
767
+ * events ('value', 'child_added', etc.) will be triggered. Synchronization of
768
+ * the data to the Firebase servers will also be started, and the returned
769
+ * Promise will resolve when complete. If provided, the `onComplete` callback
770
+ * will be called asynchronously after synchronization has finished.
771
+ *
772
+ * A single `update()` will generate a single "value" event at the location
773
+ * where the `update()` was performed, regardless of how many children were
774
+ * modified.
775
+ *
776
+ * Note that modifying data with `update()` will cancel any pending
777
+ * transactions at that location, so extreme care should be taken if mixing
778
+ * `update()` and `transaction()` to modify the same data.
779
+ *
780
+ * Passing `null` to `update()` will remove the data at this location.
781
+ *
782
+ * See
783
+ * {@link https://firebase.googleblog.com/2015/09/introducing-multi-location-updates-and_86.html | Introducing multi-location updates and more}.
784
+ *
785
+ * @param ref - The location to write to.
786
+ * @param values - Object containing multiple values.
787
+ * @returns Resolves when update on server is complete.
788
+ */
789
+ export declare function update(ref: types.Reference, values: object): Promise<void>;
72
790
  }