@firebase/database 0.12.2-pr5646.2abc5e854 → 0.12.2

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 (109) hide show
  1. package/dist/index.esm2017.js +1 -1
  2. package/dist/index.esm5.js +1 -1
  3. package/dist/index.node.cjs.js +3 -7
  4. package/dist/index.node.cjs.js.map +1 -1
  5. package/dist/index.standalone.js +2 -6
  6. package/dist/index.standalone.js.map +1 -1
  7. package/package.json +6 -16
  8. package/dist/node-esm/index.node.esm.js +0 -13984
  9. package/dist/node-esm/index.node.esm.js.map +0 -1
  10. package/dist/node-esm/package.json +0 -1
  11. package/dist/node-esm/src/api/Database.d.ts +0 -130
  12. package/dist/node-esm/src/api/OnDisconnect.d.ts +0 -110
  13. package/dist/node-esm/src/api/Reference.d.ts +0 -122
  14. package/dist/node-esm/src/api/Reference_impl.d.ts +0 -1093
  15. package/dist/node-esm/src/api/ServerValue.d.ts +0 -30
  16. package/dist/node-esm/src/api/Transaction.d.ts +0 -83
  17. package/dist/node-esm/src/api/test_access.d.ts +0 -31
  18. package/dist/node-esm/src/api.d.ts +0 -18
  19. package/dist/node-esm/src/api.standalone.d.ts +0 -29
  20. package/dist/node-esm/src/core/AppCheckTokenProvider.d.ts +0 -30
  21. package/dist/node-esm/src/core/AuthTokenProvider.d.ts +0 -49
  22. package/dist/node-esm/src/core/CompoundWrite.d.ts +0 -81
  23. package/dist/node-esm/src/core/PersistentConnection.d.ts +0 -135
  24. package/dist/node-esm/src/core/ReadonlyRestClient.d.ts +0 -60
  25. package/dist/node-esm/src/core/Repo.d.ts +0 -143
  26. package/dist/node-esm/src/core/RepoInfo.d.ts +0 -55
  27. package/dist/node-esm/src/core/ServerActions.d.ts +0 -52
  28. package/dist/node-esm/src/core/SnapshotHolder.d.ts +0 -26
  29. package/dist/node-esm/src/core/SparseSnapshotTree.d.ts +0 -64
  30. package/dist/node-esm/src/core/SyncPoint.d.ts +0 -91
  31. package/dist/node-esm/src/core/SyncTree.d.ts +0 -159
  32. package/dist/node-esm/src/core/WriteTree.d.ts +0 -205
  33. package/dist/node-esm/src/core/operation/AckUserWrite.d.ts +0 -36
  34. package/dist/node-esm/src/core/operation/ListenComplete.d.ts +0 -26
  35. package/dist/node-esm/src/core/operation/Merge.d.ts +0 -33
  36. package/dist/node-esm/src/core/operation/Operation.d.ts +0 -45
  37. package/dist/node-esm/src/core/operation/Overwrite.d.ts +0 -28
  38. package/dist/node-esm/src/core/snap/ChildrenNode.d.ts +0 -112
  39. package/dist/node-esm/src/core/snap/IndexMap.d.ts +0 -43
  40. package/dist/node-esm/src/core/snap/LeafNode.d.ts +0 -83
  41. package/dist/node-esm/src/core/snap/Node.d.ts +0 -126
  42. package/dist/node-esm/src/core/snap/childSet.d.ts +0 -32
  43. package/dist/node-esm/src/core/snap/comparators.d.ts +0 -19
  44. package/dist/node-esm/src/core/snap/indexes/Index.d.ts +0 -50
  45. package/dist/node-esm/src/core/snap/indexes/KeyIndex.d.ts +0 -34
  46. package/dist/node-esm/src/core/snap/indexes/PathIndex.d.ts +0 -29
  47. package/dist/node-esm/src/core/snap/indexes/PriorityIndex.d.ts +0 -33
  48. package/dist/node-esm/src/core/snap/indexes/ValueIndex.d.ts +0 -31
  49. package/dist/node-esm/src/core/snap/nodeFromJSON.d.ts +0 -24
  50. package/dist/node-esm/src/core/snap/snap.d.ts +0 -23
  51. package/dist/node-esm/src/core/stats/StatsCollection.d.ts +0 -26
  52. package/dist/node-esm/src/core/stats/StatsListener.d.ts +0 -30
  53. package/dist/node-esm/src/core/stats/StatsManager.d.ts +0 -20
  54. package/dist/node-esm/src/core/stats/StatsReporter.d.ts +0 -28
  55. package/dist/node-esm/src/core/storage/DOMStorageWrapper.d.ts +0 -46
  56. package/dist/node-esm/src/core/storage/MemoryStorage.d.ts +0 -27
  57. package/dist/node-esm/src/core/storage/storage.d.ts +0 -22
  58. package/dist/node-esm/src/core/util/EventEmitter.d.ts +0 -39
  59. package/dist/node-esm/src/core/util/ImmutableTree.d.ts +0 -117
  60. package/dist/node-esm/src/core/util/NextPushId.d.ts +0 -33
  61. package/dist/node-esm/src/core/util/OnlineMonitor.d.ts +0 -31
  62. package/dist/node-esm/src/core/util/Path.d.ts +0 -94
  63. package/dist/node-esm/src/core/util/ServerValues.d.ts +0 -56
  64. package/dist/node-esm/src/core/util/SortedMap.d.ts +0 -324
  65. package/dist/node-esm/src/core/util/Tree.d.ts +0 -105
  66. package/dist/node-esm/src/core/util/VisibilityMonitor.d.ts +0 -23
  67. package/dist/node-esm/src/core/util/libs/parser.d.ts +0 -32
  68. package/dist/node-esm/src/core/util/misc.d.ts +0 -19
  69. package/dist/node-esm/src/core/util/util.d.ts +0 -176
  70. package/dist/node-esm/src/core/util/validation.d.ts +0 -70
  71. package/dist/node-esm/src/core/version.d.ts +0 -23
  72. package/dist/node-esm/src/core/view/CacheNode.d.ts +0 -41
  73. package/dist/node-esm/src/core/view/Change.d.ts +0 -46
  74. package/dist/node-esm/src/core/view/ChildChangeAccumulator.d.ts +0 -22
  75. package/dist/node-esm/src/core/view/CompleteChildSource.d.ts +0 -55
  76. package/dist/node-esm/src/core/view/Event.d.ts +0 -64
  77. package/dist/node-esm/src/core/view/EventGenerator.d.ts +0 -42
  78. package/dist/node-esm/src/core/view/EventQueue.d.ts +0 -67
  79. package/dist/node-esm/src/core/view/EventRegistration.d.ts +0 -87
  80. package/dist/node-esm/src/core/view/QueryParams.d.ts +0 -97
  81. package/dist/node-esm/src/core/view/View.d.ts +0 -59
  82. package/dist/node-esm/src/core/view/ViewCache.d.ts +0 -32
  83. package/dist/node-esm/src/core/view/ViewProcessor.d.ts +0 -32
  84. package/dist/node-esm/src/core/view/filter/IndexedFilter.d.ts +0 -35
  85. package/dist/node-esm/src/core/view/filter/LimitedFilter.d.ts +0 -41
  86. package/dist/node-esm/src/core/view/filter/NodeFilter.d.ts +0 -54
  87. package/dist/node-esm/src/core/view/filter/RangedFilter.d.ts +0 -45
  88. package/dist/node-esm/src/index.d.ts +0 -28
  89. package/dist/node-esm/src/index.node.d.ts +0 -17
  90. package/dist/node-esm/src/index.standalone.d.ts +0 -17
  91. package/dist/node-esm/src/realtime/BrowserPollConnection.d.ts +0 -198
  92. package/dist/node-esm/src/realtime/Connection.d.ts +0 -102
  93. package/dist/node-esm/src/realtime/Constants.d.ts +0 -27
  94. package/dist/node-esm/src/realtime/Transport.d.ts +0 -58
  95. package/dist/node-esm/src/realtime/TransportManager.d.ts +0 -44
  96. package/dist/node-esm/src/realtime/WebSocketConnection.d.ts +0 -127
  97. package/dist/node-esm/src/realtime/polling/PacketReceiver.d.ts +0 -38
  98. package/dist/node-esm/src/register.d.ts +0 -1
  99. package/dist/node-esm/test/compound_write.test.d.ts +0 -17
  100. package/dist/node-esm/test/connection.test.d.ts +0 -17
  101. package/dist/node-esm/test/exp/integration.test.d.ts +0 -17
  102. package/dist/node-esm/test/helpers/EventAccumulator.d.ts +0 -35
  103. package/dist/node-esm/test/helpers/util.d.ts +0 -22
  104. package/dist/node-esm/test/node.test.d.ts +0 -17
  105. package/dist/node-esm/test/path.test.d.ts +0 -17
  106. package/dist/node-esm/test/pushid.test.d.ts +0 -17
  107. package/dist/node-esm/test/repoinfo.test.d.ts +0 -17
  108. package/dist/node-esm/test/sortedmap.test.d.ts +0 -17
  109. package/dist/node-esm/test/sparsesnapshottree.test.d.ts +0 -17
@@ -1,1093 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2020 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 { Repo } from '../core/Repo';
18
- import { Index } from '../core/snap/indexes/Index';
19
- import { Node } from '../core/snap/Node';
20
- import { Path } from '../core/util/Path';
21
- import { Change } from '../core/view/Change';
22
- import { CancelEvent, DataEvent, EventType } from '../core/view/Event';
23
- import { CallbackContext, EventRegistration, QueryContext } from '../core/view/EventRegistration';
24
- import { QueryParams } from '../core/view/QueryParams';
25
- import { Database } from './Database';
26
- import { OnDisconnect } from './OnDisconnect';
27
- import { ListenOptions, Query as Query, DatabaseReference, Unsubscribe, ThenableReference } from './Reference';
28
- /**
29
- * @internal
30
- */
31
- export declare class QueryImpl implements Query, QueryContext {
32
- readonly _repo: Repo;
33
- readonly _path: Path;
34
- readonly _queryParams: QueryParams;
35
- readonly _orderByCalled: boolean;
36
- /**
37
- * @hideconstructor
38
- */
39
- constructor(_repo: Repo, _path: Path, _queryParams: QueryParams, _orderByCalled: boolean);
40
- get key(): string | null;
41
- get ref(): DatabaseReference;
42
- get _queryIdentifier(): string;
43
- /**
44
- * An object representation of the query parameters used by this Query.
45
- */
46
- get _queryObject(): object;
47
- isEqual(other: QueryImpl | null): boolean;
48
- toJSON(): string;
49
- toString(): string;
50
- }
51
- /**
52
- * @internal
53
- */
54
- export declare class ReferenceImpl extends QueryImpl implements DatabaseReference {
55
- /** @hideconstructor */
56
- constructor(repo: Repo, path: Path);
57
- get parent(): ReferenceImpl | null;
58
- get root(): ReferenceImpl;
59
- }
60
- /**
61
- * A `DataSnapshot` contains data from a Database location.
62
- *
63
- * Any time you read data from the Database, you receive the data as a
64
- * `DataSnapshot`. A `DataSnapshot` is passed to the event callbacks you attach
65
- * with `on()` or `once()`. You can extract the contents of the snapshot as a
66
- * JavaScript object by calling the `val()` method. Alternatively, you can
67
- * traverse into the snapshot by calling `child()` to return child snapshots
68
- * (which you could then call `val()` on).
69
- *
70
- * A `DataSnapshot` is an efficiently generated, immutable copy of the data at
71
- * a Database location. It cannot be modified and will never change (to modify
72
- * data, you always call the `set()` method on a `Reference` directly).
73
- */
74
- export declare class DataSnapshot {
75
- readonly _node: Node;
76
- /**
77
- * The location of this DataSnapshot.
78
- */
79
- readonly ref: DatabaseReference;
80
- readonly _index: Index;
81
- /**
82
- * @param _node - A SnapshotNode to wrap.
83
- * @param ref - The location this snapshot came from.
84
- * @param _index - The iteration order for this snapshot
85
- * @hideconstructor
86
- */
87
- constructor(_node: Node,
88
- /**
89
- * The location of this DataSnapshot.
90
- */
91
- ref: DatabaseReference, _index: Index);
92
- /**
93
- * Gets the priority value of the data in this `DataSnapshot`.
94
- *
95
- * Applications need not use priority but can order collections by
96
- * ordinary properties (see
97
- * {@link https://firebase.google.com/docs/database/web/lists-of-data#sorting_and_filtering_data |Sorting and filtering data}
98
- * ).
99
- */
100
- get priority(): string | number | null;
101
- /**
102
- * The key (last part of the path) of the location of this `DataSnapshot`.
103
- *
104
- * The last token in a Database location is considered its key. For example,
105
- * "ada" is the key for the /users/ada/ node. Accessing the key on any
106
- * `DataSnapshot` will return the key for the location that generated it.
107
- * However, accessing the key on the root URL of a Database will return
108
- * `null`.
109
- */
110
- get key(): string | null;
111
- /** Returns the number of child properties of this `DataSnapshot`. */
112
- get size(): number;
113
- /**
114
- * Gets another `DataSnapshot` for the location at the specified relative path.
115
- *
116
- * Passing a relative path to the `child()` method of a DataSnapshot returns
117
- * another `DataSnapshot` for the location at the specified relative path. The
118
- * relative path can either be a simple child name (for example, "ada") or a
119
- * deeper, slash-separated path (for example, "ada/name/first"). If the child
120
- * location has no data, an empty `DataSnapshot` (that is, a `DataSnapshot`
121
- * whose value is `null`) is returned.
122
- *
123
- * @param path - A relative path to the location of child data.
124
- */
125
- child(path: string): DataSnapshot;
126
- /**
127
- * Returns true if this `DataSnapshot` contains any data. It is slightly more
128
- * efficient than using `snapshot.val() !== null`.
129
- */
130
- exists(): boolean;
131
- /**
132
- * Exports the entire contents of the DataSnapshot as a JavaScript object.
133
- *
134
- * The `exportVal()` method is similar to `val()`, except priority information
135
- * is included (if available), making it suitable for backing up your data.
136
- *
137
- * @returns The DataSnapshot's contents as a JavaScript value (Object,
138
- * Array, string, number, boolean, or `null`).
139
- */
140
- exportVal(): any;
141
- /**
142
- * Enumerates the top-level children in the `DataSnapshot`.
143
- *
144
- * Because of the way JavaScript objects work, the ordering of data in the
145
- * JavaScript object returned by `val()` is not guaranteed to match the
146
- * ordering on the server nor the ordering of `onChildAdded()` events. That is
147
- * where `forEach()` comes in handy. It guarantees the children of a
148
- * `DataSnapshot` will be iterated in their query order.
149
- *
150
- * If no explicit `orderBy*()` method is used, results are returned
151
- * ordered by key (unless priorities are used, in which case, results are
152
- * returned by priority).
153
- *
154
- * @param action - A function that will be called for each child DataSnapshot.
155
- * The callback can return true to cancel further enumeration.
156
- * @returns true if enumeration was canceled due to your callback returning
157
- * true.
158
- */
159
- forEach(action: (child: DataSnapshot) => boolean | void): boolean;
160
- /**
161
- * Returns true if the specified child path has (non-null) data.
162
- *
163
- * @param path - A relative path to the location of a potential child.
164
- * @returns `true` if data exists at the specified child path; else
165
- * `false`.
166
- */
167
- hasChild(path: string): boolean;
168
- /**
169
- * Returns whether or not the `DataSnapshot` has any non-`null` child
170
- * properties.
171
- *
172
- * You can use `hasChildren()` to determine if a `DataSnapshot` has any
173
- * children. If it does, you can enumerate them using `forEach()`. If it
174
- * doesn't, then either this snapshot contains a primitive value (which can be
175
- * retrieved with `val()`) or it is empty (in which case, `val()` will return
176
- * `null`).
177
- *
178
- * @returns true if this snapshot has any children; else false.
179
- */
180
- hasChildren(): boolean;
181
- /**
182
- * Returns a JSON-serializable representation of this object.
183
- */
184
- toJSON(): object | null;
185
- /**
186
- * Extracts a JavaScript value from a `DataSnapshot`.
187
- *
188
- * Depending on the data in a `DataSnapshot`, the `val()` method may return a
189
- * scalar type (string, number, or boolean), an array, or an object. It may
190
- * also return null, indicating that the `DataSnapshot` is empty (contains no
191
- * data).
192
- *
193
- * @returns The DataSnapshot's contents as a JavaScript value (Object,
194
- * Array, string, number, boolean, or `null`).
195
- */
196
- val(): any;
197
- }
198
- /**
199
- *
200
- * Returns a `Reference` representing the location in the Database
201
- * corresponding to the provided path. If no path is provided, the `Reference`
202
- * will point to the root of the Database.
203
- *
204
- * @param db - The database instance to obtain a reference for.
205
- * @param path - Optional path representing the location the returned
206
- * `Reference` will point. If not provided, the returned `Reference` will
207
- * point to the root of the Database.
208
- * @returns If a path is provided, a `Reference`
209
- * pointing to the provided path. Otherwise, a `Reference` pointing to the
210
- * root of the Database.
211
- */
212
- export declare function ref(db: Database, path?: string): DatabaseReference;
213
- /**
214
- * Returns a `Reference` representing the location in the Database
215
- * corresponding to the provided Firebase URL.
216
- *
217
- * An exception is thrown if the URL is not a valid Firebase Database URL or it
218
- * has a different domain than the current `Database` instance.
219
- *
220
- * Note that all query parameters (`orderBy`, `limitToLast`, etc.) are ignored
221
- * and are not applied to the returned `Reference`.
222
- *
223
- * @param db - The database instance to obtain a reference for.
224
- * @param url - The Firebase URL at which the returned `Reference` will
225
- * point.
226
- * @returns A `Reference` pointing to the provided
227
- * Firebase URL.
228
- */
229
- export declare function refFromURL(db: Database, url: string): DatabaseReference;
230
- /**
231
- * Gets a `Reference` for the location at the specified relative path.
232
- *
233
- * The relative path can either be a simple child name (for example, "ada") or
234
- * a deeper slash-separated path (for example, "ada/name/first").
235
- *
236
- * @param parent - The parent location.
237
- * @param path - A relative path from this location to the desired child
238
- * location.
239
- * @returns The specified child location.
240
- */
241
- export declare function child(parent: DatabaseReference, path: string): DatabaseReference;
242
- /**
243
- * Returns an `OnDisconnect` object - see
244
- * {@link https://firebase.google.com/docs/database/web/offline-capabilities | Enabling Offline Capabilities in JavaScript}
245
- * for more information on how to use it.
246
- *
247
- * @param ref - The reference to add OnDisconnect triggers for.
248
- */
249
- export declare function onDisconnect(ref: DatabaseReference): OnDisconnect;
250
- export interface ThenableReferenceImpl extends ReferenceImpl, Pick<Promise<ReferenceImpl>, 'then' | 'catch'> {
251
- }
252
- /**
253
- * Generates a new child location using a unique key and returns its
254
- * `Reference`.
255
- *
256
- * This is the most common pattern for adding data to a collection of items.
257
- *
258
- * If you provide a value to `push()`, the value is written to the
259
- * generated location. If you don't pass a value, nothing is written to the
260
- * database and the child remains empty (but you can use the `Reference`
261
- * elsewhere).
262
- *
263
- * The unique keys generated by `push()` are ordered by the current time, so the
264
- * resulting list of items is chronologically sorted. The keys are also
265
- * designed to be unguessable (they contain 72 random bits of entropy).
266
- *
267
- * See {@link https://firebase.google.com/docs/database/web/lists-of-data#append_to_a_list_of_data | Append to a list of data}
268
- * </br>See {@link ttps://firebase.googleblog.com/2015/02/the-2120-ways-to-ensure-unique_68.html | The 2^120 Ways to Ensure Unique Identifiers}
269
- *
270
- * @param parent - The parent location.
271
- * @param value - Optional value to be written at the generated location.
272
- * @returns Combined `Promise` and `Reference`; resolves when write is complete,
273
- * but can be used immediately as the `Reference` to the child location.
274
- */
275
- export declare function push(parent: DatabaseReference, value?: unknown): ThenableReference;
276
- /**
277
- * Removes the data at this Database location.
278
- *
279
- * Any data at child locations will also be deleted.
280
- *
281
- * The effect of the remove will be visible immediately and the corresponding
282
- * event 'value' will be triggered. Synchronization of the remove to the
283
- * Firebase servers will also be started, and the returned Promise will resolve
284
- * when complete. If provided, the onComplete callback will be called
285
- * asynchronously after synchronization has finished.
286
- *
287
- * @param ref - The location to remove.
288
- * @returns Resolves when remove on server is complete.
289
- */
290
- export declare function remove(ref: DatabaseReference): Promise<void>;
291
- /**
292
- * Writes data to this Database location.
293
- *
294
- * This will overwrite any data at this location and all child locations.
295
- *
296
- * The effect of the write will be visible immediately, and the corresponding
297
- * events ("value", "child_added", etc.) will be triggered. Synchronization of
298
- * the data to the Firebase servers will also be started, and the returned
299
- * Promise will resolve when complete. If provided, the `onComplete` callback
300
- * will be called asynchronously after synchronization has finished.
301
- *
302
- * Passing `null` for the new value is equivalent to calling `remove()`; namely,
303
- * all data at this location and all child locations will be deleted.
304
- *
305
- * `set()` will remove any priority stored at this location, so if priority is
306
- * meant to be preserved, you need to use `setWithPriority()` instead.
307
- *
308
- * Note that modifying data with `set()` will cancel any pending transactions
309
- * at that location, so extreme care should be taken if mixing `set()` and
310
- * `transaction()` to modify the same data.
311
- *
312
- * A single `set()` will generate a single "value" event at the location where
313
- * the `set()` was performed.
314
- *
315
- * @param ref - The location to write to.
316
- * @param value - The value to be written (string, number, boolean, object,
317
- * array, or null).
318
- * @returns Resolves when write to server is complete.
319
- */
320
- export declare function set(ref: DatabaseReference, value: unknown): Promise<void>;
321
- /**
322
- * Sets a priority for the data at this Database location.
323
- *
324
- * Applications need not use priority but can order collections by
325
- * ordinary properties (see
326
- * {@link https://firebase.google.com/docs/database/web/lists-of-data#sorting_and_filtering_data | Sorting and filtering data}
327
- * ).
328
- *
329
- * @param ref - The location to write to.
330
- * @param priority - The priority to be written (string, number, or null).
331
- * @returns Resolves when write to server is complete.
332
- */
333
- export declare function setPriority(ref: DatabaseReference, priority: string | number | null): Promise<void>;
334
- /**
335
- * Writes data the Database location. Like `set()` but also specifies the
336
- * priority for that data.
337
- *
338
- * Applications need not use priority but can order collections by
339
- * ordinary properties (see
340
- * {@link https://firebase.google.com/docs/database/web/lists-of-data#sorting_and_filtering_data | Sorting and filtering data}
341
- * ).
342
- *
343
- * @param ref - The location to write to.
344
- * @param value - The value to be written (string, number, boolean, object,
345
- * array, or null).
346
- * @param priority - The priority to be written (string, number, or null).
347
- * @returns Resolves when write to server is complete.
348
- */
349
- export declare function setWithPriority(ref: DatabaseReference, value: unknown, priority: string | number | null): Promise<void>;
350
- /**
351
- * Writes multiple values to the Database at once.
352
- *
353
- * The `values` argument contains multiple property-value pairs that will be
354
- * written to the Database together. Each child property can either be a simple
355
- * property (for example, "name") or a relative path (for example,
356
- * "name/first") from the current location to the data to update.
357
- *
358
- * As opposed to the `set()` method, `update()` can be use to selectively update
359
- * only the referenced properties at the current location (instead of replacing
360
- * all the child properties at the current location).
361
- *
362
- * The effect of the write will be visible immediately, and the corresponding
363
- * events ('value', 'child_added', etc.) will be triggered. Synchronization of
364
- * the data to the Firebase servers will also be started, and the returned
365
- * Promise will resolve when complete. If provided, the `onComplete` callback
366
- * will be called asynchronously after synchronization has finished.
367
- *
368
- * A single `update()` will generate a single "value" event at the location
369
- * where the `update()` was performed, regardless of how many children were
370
- * modified.
371
- *
372
- * Note that modifying data with `update()` will cancel any pending
373
- * transactions at that location, so extreme care should be taken if mixing
374
- * `update()` and `transaction()` to modify the same data.
375
- *
376
- * Passing `null` to `update()` will remove the data at this location.
377
- *
378
- * See
379
- * {@link https://firebase.googleblog.com/2015/09/introducing-multi-location-updates-and_86.html | Introducing multi-location updates and more}.
380
- *
381
- * @param ref - The location to write to.
382
- * @param values - Object containing multiple values.
383
- * @returns Resolves when update on server is complete.
384
- */
385
- export declare function update(ref: DatabaseReference, values: object): Promise<void>;
386
- /**
387
- * Gets the most up-to-date result for this query.
388
- *
389
- * @param query - The query to run.
390
- * @returns A `Promise` which resolves to the resulting DataSnapshot if a value is
391
- * available, or rejects if the client is unable to return a value (e.g., if the
392
- * server is unreachable and there is nothing cached).
393
- */
394
- export declare function get(query: Query): Promise<DataSnapshot>;
395
- /**
396
- * Represents registration for 'value' events.
397
- */
398
- export declare class ValueEventRegistration implements EventRegistration {
399
- private callbackContext;
400
- constructor(callbackContext: CallbackContext);
401
- respondsTo(eventType: string): boolean;
402
- createEvent(change: Change, query: QueryContext): DataEvent;
403
- getEventRunner(eventData: CancelEvent | DataEvent): () => void;
404
- createCancelEvent(error: Error, path: Path): CancelEvent | null;
405
- matches(other: EventRegistration): boolean;
406
- hasAnyCallback(): boolean;
407
- }
408
- /**
409
- * Represents the registration of a child_x event.
410
- */
411
- export declare class ChildEventRegistration implements EventRegistration {
412
- private eventType;
413
- private callbackContext;
414
- constructor(eventType: string, callbackContext: CallbackContext | null);
415
- respondsTo(eventType: string): boolean;
416
- createCancelEvent(error: Error, path: Path): CancelEvent | null;
417
- createEvent(change: Change, query: QueryContext): DataEvent;
418
- getEventRunner(eventData: CancelEvent | DataEvent): () => void;
419
- matches(other: EventRegistration): boolean;
420
- hasAnyCallback(): boolean;
421
- }
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 `onValue` event will trigger once with the initial data stored at this
432
- * location, and then trigger again each time the data changes. The
433
- * `DataSnapshot` passed to the callback will be for the location at which
434
- * `on()` was called. It won't trigger until the entire contents has been
435
- * synchronized. If the location has no data, it will be triggered with an empty
436
- * `DataSnapshot` (`val()` will return `null`).
437
- *
438
- * @param query - The query to run.
439
- * @param callback - A callback that fires when the specified event occurs. The
440
- * callback will be passed a DataSnapshot.
441
- * @param cancelCallback - An optional callback that will be notified if your
442
- * event subscription is ever canceled because your client does not have
443
- * permission to read this data (or it had permission but has now lost it).
444
- * This callback will be passed an `Error` object indicating why the failure
445
- * occurred.
446
- * @returns A function that can be invoked to remove the listener.
447
- */
448
- export declare function onValue(query: Query, callback: (snapshot: DataSnapshot) => unknown, cancelCallback?: (error: Error) => unknown): Unsubscribe;
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. See
455
- * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
456
- * for more details.
457
- *
458
- * An `onValue` event will trigger once with the initial data stored at this
459
- * location, and then trigger again each time the data changes. The
460
- * `DataSnapshot` passed to the callback will be for the location at which
461
- * `on()` was called. It won't trigger until the entire contents has been
462
- * synchronized. If the location has no data, it will be triggered with an empty
463
- * `DataSnapshot` (`val()` will return `null`).
464
- *
465
- * @param query - The query to run.
466
- * @param callback - A callback that fires when the specified event occurs. The
467
- * callback will be passed a DataSnapshot.
468
- * @param options - An object that can be used to configure `onlyOnce`, which
469
- * then removes the listener after its first invocation.
470
- * @returns A function that can be invoked to remove the listener.
471
- */
472
- export declare function onValue(query: Query, callback: (snapshot: DataSnapshot) => unknown, options: ListenOptions): Unsubscribe;
473
- /**
474
- * Listens for data changes at a particular location.
475
- *
476
- * This is the primary way to read data from a Database. Your callback
477
- * will be triggered for the initial data and again whenever the data changes.
478
- * Invoke the returned unsubscribe callback to stop receiving updates. See
479
- * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
480
- * for more details.
481
- *
482
- * An `onValue` event will trigger once with the initial data stored at this
483
- * location, and then trigger again each time the data changes. The
484
- * `DataSnapshot` passed to the callback will be for the location at which
485
- * `on()` was called. It won't trigger until the entire contents has been
486
- * synchronized. If the location has no data, it will be triggered with an empty
487
- * `DataSnapshot` (`val()` will return `null`).
488
- *
489
- * @param query - The query to run.
490
- * @param callback - A callback that fires when the specified event occurs. The
491
- * callback will be passed a DataSnapshot.
492
- * @param cancelCallback - An optional callback that will be notified if your
493
- * event subscription is ever canceled because your client does not have
494
- * permission to read this data (or it had permission but has now lost it).
495
- * This callback will be passed an `Error` object indicating why the failure
496
- * occurred.
497
- * @param options - An object that can be used to configure `onlyOnce`, which
498
- * then removes the listener after its first invocation.
499
- * @returns A function that can be invoked to remove the listener.
500
- */
501
- export declare function onValue(query: Query, callback: (snapshot: DataSnapshot) => unknown, cancelCallback: (error: Error) => unknown, options: ListenOptions): Unsubscribe;
502
- /**
503
- * Listens for data changes at a particular location.
504
- *
505
- * This is the primary way to read data from a Database. Your callback
506
- * will be triggered for the initial data and again whenever the data changes.
507
- * Invoke the returned unsubscribe callback to stop receiving updates. See
508
- * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
509
- * for more details.
510
- *
511
- * An `onChildAdded` event will be triggered once for each initial child at this
512
- * location, and it will be triggered again every time a new child is added. The
513
- * `DataSnapshot` passed into the callback will reflect the data for the
514
- * relevant child. For ordering purposes, it is passed a second argument which
515
- * is a string containing the key of the previous sibling child by sort order,
516
- * or `null` if it is the first child.
517
- *
518
- * @param query - The query to run.
519
- * @param callback - A callback that fires when the specified event occurs.
520
- * The callback will be passed a DataSnapshot and a string containing the key of
521
- * the previous child, by sort order, or `null` if it is the first child.
522
- * @param cancelCallback - An optional callback that will be notified if your
523
- * event subscription is ever canceled because your client does not have
524
- * permission to read this data (or it had permission but has now lost it).
525
- * This callback will be passed an `Error` object indicating why the failure
526
- * occurred.
527
- * @returns A function that can be invoked to remove the listener.
528
- */
529
- export declare function onChildAdded(query: Query, callback: (snapshot: DataSnapshot, previousChildName?: string | null) => unknown, cancelCallback?: (error: Error) => unknown): Unsubscribe;
530
- /**
531
- * Listens for data changes at a particular location.
532
- *
533
- * This is the primary way to read data from a Database. Your callback
534
- * will be triggered for the initial data and again whenever the data changes.
535
- * Invoke the returned unsubscribe callback to stop receiving updates. See
536
- * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
537
- * for more details.
538
- *
539
- * An `onChildAdded` event will be triggered once for each initial child at this
540
- * location, and it will be triggered again every time a new child is added. The
541
- * `DataSnapshot` passed into the callback will reflect the data for the
542
- * relevant child. For ordering purposes, it is passed a second argument which
543
- * is a string containing the key of the previous sibling child by sort order,
544
- * or `null` if it is the first child.
545
- *
546
- * @param query - The query to run.
547
- * @param callback - A callback that fires when the specified event occurs.
548
- * The callback will be passed a DataSnapshot and a string containing the key of
549
- * the previous child, by sort order, or `null` if it is the first child.
550
- * @param options - An object that can be used to configure `onlyOnce`, which
551
- * then removes the listener after its first invocation.
552
- * @returns A function that can be invoked to remove the listener.
553
- */
554
- export declare function onChildAdded(query: Query, callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown, options: ListenOptions): Unsubscribe;
555
- /**
556
- * Listens for data changes at a particular location.
557
- *
558
- * This is the primary way to read data from a Database. Your callback
559
- * will be triggered for the initial data and again whenever the data changes.
560
- * Invoke the returned unsubscribe callback to stop receiving updates. See
561
- * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
562
- * for more details.
563
- *
564
- * An `onChildAdded` event will be triggered once for each initial child at this
565
- * location, and it will be triggered again every time a new child is added. The
566
- * `DataSnapshot` passed into the callback will reflect the data for the
567
- * relevant child. For ordering purposes, it is passed a second argument which
568
- * is a string containing the key of the previous sibling child by sort order,
569
- * or `null` if it is the first child.
570
- *
571
- * @param query - The query to run.
572
- * @param callback - A callback that fires when the specified event occurs.
573
- * The callback will be passed a DataSnapshot and a string containing the key of
574
- * the previous child, by sort order, or `null` if it is the first child.
575
- * @param cancelCallback - An optional callback that will be notified if your
576
- * event subscription is ever canceled because your client does not have
577
- * permission to read this data (or it had permission but has now lost it).
578
- * This callback will be passed an `Error` object indicating why the failure
579
- * occurred.
580
- * @param options - An object that can be used to configure `onlyOnce`, which
581
- * then removes the listener after its first invocation.
582
- * @returns A function that can be invoked to remove the listener.
583
- */
584
- export declare function onChildAdded(query: Query, callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown, cancelCallback: (error: Error) => unknown, options: ListenOptions): Unsubscribe;
585
- /**
586
- * Listens for data changes at a particular location.
587
- *
588
- * This is the primary way to read data from a Database. Your callback
589
- * will be triggered for the initial data and again whenever the data changes.
590
- * Invoke the returned unsubscribe callback to stop receiving updates. See
591
- * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
592
- * for more details.
593
- *
594
- * An `onChildChanged` event will be triggered when the data stored in a child
595
- * (or any of its descendants) changes. Note that a single `child_changed` event
596
- * may represent multiple changes to the child. The `DataSnapshot` passed to the
597
- * callback will contain the new child contents. For ordering purposes, the
598
- * callback is also passed a second argument which is a string containing the
599
- * key of the previous sibling child by sort order, or `null` if it is the first
600
- * child.
601
- *
602
- * @param query - The query to run.
603
- * @param callback - A callback that fires when the specified event occurs.
604
- * The callback will be passed a DataSnapshot and a string containing the key of
605
- * the previous child, by sort order, or `null` if it is the first child.
606
- * @param cancelCallback - An optional callback that will be notified if your
607
- * event subscription is ever canceled because your client does not have
608
- * permission to read this data (or it had permission but has now lost it).
609
- * This callback will be passed an `Error` object indicating why the failure
610
- * occurred.
611
- * @returns A function that can be invoked to remove the listener.
612
- */
613
- export declare function onChildChanged(query: Query, callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown, cancelCallback?: (error: Error) => unknown): Unsubscribe;
614
- /**
615
- * Listens for data changes at a particular location.
616
- *
617
- * This is the primary way to read data from a Database. Your callback
618
- * will be triggered for the initial data and again whenever the data changes.
619
- * Invoke the returned unsubscribe callback to stop receiving updates. See
620
- * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
621
- * for more details.
622
- *
623
- * An `onChildChanged` event will be triggered when the data stored in a child
624
- * (or any of its descendants) changes. Note that a single `child_changed` event
625
- * may represent multiple changes to the child. The `DataSnapshot` passed to the
626
- * callback will contain the new child contents. For ordering purposes, the
627
- * callback is also passed a second argument which is a string containing the
628
- * key of the previous sibling child by sort order, or `null` if it is the first
629
- * child.
630
- *
631
- * @param query - The query to run.
632
- * @param callback - A callback that fires when the specified event occurs.
633
- * The callback will be passed a DataSnapshot and a string containing the key of
634
- * the previous child, by sort order, or `null` if it is the first child.
635
- * @param options - An object that can be used to configure `onlyOnce`, which
636
- * then removes the listener after its first invocation.
637
- * @returns A function that can be invoked to remove the listener.
638
- */
639
- export declare function onChildChanged(query: Query, callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown, options: ListenOptions): Unsubscribe;
640
- /**
641
- * Listens for data changes at a particular location.
642
- *
643
- * This is the primary way to read data from a Database. Your callback
644
- * will be triggered for the initial data and again whenever the data changes.
645
- * Invoke the returned unsubscribe callback to stop receiving updates. See
646
- * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
647
- * for more details.
648
- *
649
- * An `onChildChanged` event will be triggered when the data stored in a child
650
- * (or any of its descendants) changes. Note that a single `child_changed` event
651
- * may represent multiple changes to the child. The `DataSnapshot` passed to the
652
- * callback will contain the new child contents. For ordering purposes, the
653
- * callback is also passed a second argument which is a string containing the
654
- * key of the previous sibling child by sort order, or `null` if it is the first
655
- * child.
656
- *
657
- * @param query - The query to run.
658
- * @param callback - A callback that fires when the specified event occurs.
659
- * The callback will be passed a DataSnapshot and a string containing the key of
660
- * the previous child, by sort order, or `null` if it is the first child.
661
- * @param cancelCallback - An optional callback that will be notified if your
662
- * event subscription is ever canceled because your client does not have
663
- * permission to read this data (or it had permission but has now lost it).
664
- * This callback will be passed an `Error` object indicating why the failure
665
- * occurred.
666
- * @param options - An object that can be used to configure `onlyOnce`, which
667
- * then removes the listener after its first invocation.
668
- * @returns A function that can be invoked to remove the listener.
669
- */
670
- export declare function onChildChanged(query: Query, callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown, cancelCallback: (error: Error) => unknown, options: ListenOptions): Unsubscribe;
671
- /**
672
- * Listens for data changes at a particular location.
673
- *
674
- * This is the primary way to read data from a Database. Your callback
675
- * will be triggered for the initial data and again whenever the data changes.
676
- * Invoke the returned unsubscribe callback to stop receiving updates. See
677
- * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
678
- * for more details.
679
- *
680
- * An `onChildMoved` event will be triggered when a child's sort order changes
681
- * such that its position relative to its siblings changes. The `DataSnapshot`
682
- * passed to the callback will be for the data of the child that has moved. It
683
- * is also passed a second argument which is a string containing the key of the
684
- * previous sibling child by sort order, or `null` if it is the first child.
685
- *
686
- * @param query - The query to run.
687
- * @param callback - A callback that fires when the specified event occurs.
688
- * The callback will be passed a DataSnapshot and a string containing the key of
689
- * the previous child, by sort order, or `null` if it is the first child.
690
- * @param cancelCallback - An optional callback that will be notified if your
691
- * event subscription is ever canceled because your client does not have
692
- * permission to read this data (or it had permission but has now lost it).
693
- * This callback will be passed an `Error` object indicating why the failure
694
- * occurred.
695
- * @returns A function that can be invoked to remove the listener.
696
- */
697
- export declare function onChildMoved(query: Query, callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown, cancelCallback?: (error: Error) => unknown): Unsubscribe;
698
- /**
699
- * Listens for data changes at a particular location.
700
- *
701
- * This is the primary way to read data from a Database. Your callback
702
- * will be triggered for the initial data and again whenever the data changes.
703
- * Invoke the returned unsubscribe callback to stop receiving updates. See
704
- * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
705
- * for more details.
706
- *
707
- * An `onChildMoved` event will be triggered when a child's sort order changes
708
- * such that its position relative to its siblings changes. The `DataSnapshot`
709
- * passed to the callback will be for the data of the child that has moved. It
710
- * is also passed a second argument which is a string containing the key of the
711
- * previous sibling child by sort order, or `null` if it is the first child.
712
- *
713
- * @param query - The query to run.
714
- * @param callback - A callback that fires when the specified event occurs.
715
- * The callback will be passed a DataSnapshot and a string containing the key of
716
- * the previous child, by sort order, or `null` if it is the first child.
717
- * @param options - An object that can be used to configure `onlyOnce`, which
718
- * then removes the listener after its first invocation.
719
- * @returns A function that can be invoked to remove the listener.
720
- */
721
- export declare function onChildMoved(query: Query, callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown, options: ListenOptions): Unsubscribe;
722
- /**
723
- * Listens for data changes at a particular location.
724
- *
725
- * This is the primary way to read data from a Database. Your callback
726
- * will be triggered for the initial data and again whenever the data changes.
727
- * Invoke the returned unsubscribe callback to stop receiving updates. See
728
- * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
729
- * for more details.
730
- *
731
- * An `onChildMoved` event will be triggered when a child's sort order changes
732
- * such that its position relative to its siblings changes. The `DataSnapshot`
733
- * passed to the callback will be for the data of the child that has moved. It
734
- * is also passed a second argument which is a string containing the key of the
735
- * previous sibling child by sort order, or `null` if it is the first child.
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 declare function onChildMoved(query: Query, callback: (snapshot: DataSnapshot, previousChildName: string | null) => unknown, cancelCallback: (error: Error) => unknown, options: ListenOptions): Unsubscribe;
751
- /**
752
- * Listens for data changes at a particular location.
753
- *
754
- * This is the primary way to read data from a Database. Your callback
755
- * will be triggered for the initial data and again whenever the data changes.
756
- * Invoke the returned unsubscribe callback to stop receiving updates. See
757
- * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
758
- * for more details.
759
- *
760
- * An `onChildRemoved` event will be triggered once every time a child is
761
- * removed. The `DataSnapshot` passed into the callback will be the old data for
762
- * the child that was removed. A child will get removed when either:
763
- *
764
- * - a client explicitly calls `remove()` on that child or one of its ancestors
765
- * - a client calls `set(null)` on that child or one of its ancestors
766
- * - that child has all of its children removed
767
- * - there is a query in effect which now filters out the child (because it's
768
- * sort order changed or the max limit was hit)
769
- *
770
- * @param query - The query to run.
771
- * @param callback - A callback that fires when the specified event occurs.
772
- * The callback will be passed a DataSnapshot and a string containing the key of
773
- * the previous child, by sort order, or `null` if it is the first child.
774
- * @param cancelCallback - An optional callback that will be notified if your
775
- * event subscription is ever canceled because your client does not have
776
- * permission to read this data (or it had permission but has now lost it).
777
- * This callback will be passed an `Error` object indicating why the failure
778
- * occurred.
779
- * @returns A function that can be invoked to remove the listener.
780
- */
781
- export declare function onChildRemoved(query: Query, callback: (snapshot: DataSnapshot) => unknown, cancelCallback?: (error: Error) => unknown): Unsubscribe;
782
- /**
783
- * Listens for data changes at a particular location.
784
- *
785
- * This is the primary way to read data from a Database. Your callback
786
- * will be triggered for the initial data and again whenever the data changes.
787
- * Invoke the returned unsubscribe callback to stop receiving updates. See
788
- * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
789
- * for more details.
790
- *
791
- * An `onChildRemoved` event will be triggered once every time a child is
792
- * removed. The `DataSnapshot` passed into the callback will be the old data for
793
- * the child that was removed. A child will get removed when either:
794
- *
795
- * - a client explicitly calls `remove()` on that child or one of its ancestors
796
- * - a client calls `set(null)` on that child or one of its ancestors
797
- * - that child has all of its children removed
798
- * - there is a query in effect which now filters out the child (because it's
799
- * sort order changed or the max limit was hit)
800
- *
801
- * @param query - The query to run.
802
- * @param callback - A callback that fires when the specified event occurs.
803
- * The callback will be passed a DataSnapshot and a string containing the key of
804
- * the previous child, by sort order, or `null` if it is the first child.
805
- * @param options - An object that can be used to configure `onlyOnce`, which
806
- * then removes the listener after its first invocation.
807
- * @returns A function that can be invoked to remove the listener.
808
- */
809
- export declare function onChildRemoved(query: Query, callback: (snapshot: DataSnapshot) => unknown, options: ListenOptions): Unsubscribe;
810
- /**
811
- * Listens for data changes at a particular location.
812
- *
813
- * This is the primary way to read data from a Database. Your callback
814
- * will be triggered for the initial data and again whenever the data changes.
815
- * Invoke the returned unsubscribe callback to stop receiving updates. See
816
- * {@link https://firebase.google.com/docs/database/web/retrieve-data | Retrieve Data on the Web}
817
- * for more details.
818
- *
819
- * An `onChildRemoved` event will be triggered once every time a child is
820
- * removed. The `DataSnapshot` passed into the callback will be the old data for
821
- * the child that was removed. A child will get removed when either:
822
- *
823
- * - a client explicitly calls `remove()` on that child or one of its ancestors
824
- * - a client calls `set(null)` on that child or one of its ancestors
825
- * - that child has all of its children removed
826
- * - there is a query in effect which now filters out the child (because it's
827
- * sort order changed or the max limit was hit)
828
- *
829
- * @param query - The query to run.
830
- * @param callback - A callback that fires when the specified event occurs.
831
- * The callback will be passed a DataSnapshot and a string containing the key of
832
- * the previous child, by sort order, or `null` if it is the first child.
833
- * @param cancelCallback - An optional callback that will be notified if your
834
- * event subscription is ever canceled because your client does not have
835
- * permission to read this data (or it had permission but has now lost it).
836
- * This callback will be passed an `Error` object indicating why the failure
837
- * occurred.
838
- * @param options - An object that can be used to configure `onlyOnce`, which
839
- * then removes the listener after its first invocation.
840
- * @returns A function that can be invoked to remove the listener.
841
- */
842
- export declare function onChildRemoved(query: Query, callback: (snapshot: DataSnapshot) => unknown, cancelCallback: (error: Error) => unknown, options: ListenOptions): Unsubscribe;
843
- export { EventType };
844
- /**
845
- * Detaches a callback previously attached with `on()`.
846
- *
847
- * Detach a callback previously attached with `on()`. Note that if `on()` was
848
- * called multiple times with the same eventType and callback, the callback
849
- * will be called multiple times for each event, and `off()` must be called
850
- * multiple times to remove the callback. Calling `off()` on a parent listener
851
- * will not automatically remove listeners registered on child nodes, `off()`
852
- * must also be called on any child listeners to remove the callback.
853
- *
854
- * If a callback is not specified, all callbacks for the specified eventType
855
- * will be removed. Similarly, if no eventType is specified, all callbacks
856
- * for the `Reference` will be removed.
857
- *
858
- * Individual listeners can also be removed by invoking their unsubscribe
859
- * callbacks.
860
- *
861
- * @param query - The query that the listener was registered with.
862
- * @param eventType - One of the following strings: "value", "child_added",
863
- * "child_changed", "child_removed", or "child_moved." If omitted, all callbacks
864
- * for the `Reference` will be removed.
865
- * @param callback - The callback function that was passed to `on()` or
866
- * `undefined` to remove all callbacks.
867
- */
868
- export declare function off(query: Query, eventType?: EventType, callback?: (snapshot: DataSnapshot, previousChildName?: string | null) => unknown): void;
869
- /** Describes the different query constraints available in this SDK. */
870
- export declare type QueryConstraintType = 'endAt' | 'endBefore' | 'startAt' | 'startAfter' | 'limitToFirst' | 'limitToLast' | 'orderByChild' | 'orderByKey' | 'orderByPriority' | 'orderByValue' | 'equalTo';
871
- /**
872
- * A `QueryConstraint` is used to narrow the set of documents returned by a
873
- * Database query. `QueryConstraint`s are created by invoking {@link endAt},
874
- * {@link endBefore}, {@link startAt}, {@link startAfter}, {@link
875
- * limitToFirst}, {@link limitToLast}, {@link orderByChild},
876
- * {@link orderByChild}, {@link orderByKey} , {@link orderByPriority} ,
877
- * {@link orderByValue} or {@link equalTo} and
878
- * can then be passed to {@link query} to create a new query instance that
879
- * also contains this `QueryConstraint`.
880
- */
881
- export declare abstract class QueryConstraint {
882
- /** The type of this query constraints */
883
- abstract readonly type: QueryConstraintType;
884
- /**
885
- * Takes the provided `Query` and returns a copy of the `Query` with this
886
- * `QueryConstraint` applied.
887
- */
888
- abstract _apply<T>(query: QueryImpl): QueryImpl;
889
- }
890
- /**
891
- * Creates a `QueryConstraint` with the specified ending point.
892
- *
893
- * Using `startAt()`, `startAfter()`, `endBefore()`, `endAt()` and `equalTo()`
894
- * allows you to choose arbitrary starting and ending points for your queries.
895
- *
896
- * The ending point is inclusive, so children with exactly the specified value
897
- * will be included in the query. The optional key argument can be used to
898
- * further limit the range of the query. If it is specified, then children that
899
- * have exactly the specified value must also have a key name less than or equal
900
- * to the specified key.
901
- *
902
- * You can read more about `endAt()` in
903
- * {@link https://firebase.google.com/docs/database/web/lists-of-data#filtering_data | Filtering data}.
904
- *
905
- * @param value - The value to end at. The argument type depends on which
906
- * `orderBy*()` function was used in this query. Specify a value that matches
907
- * the `orderBy*()` type. When used in combination with `orderByKey()`, the
908
- * value must be a string.
909
- * @param key - The child key to end at, among the children with the previously
910
- * specified priority. This argument is only allowed if ordering by child,
911
- * value, or priority.
912
- */
913
- export declare function endAt(value: number | string | boolean | null, key?: string): QueryConstraint;
914
- /**
915
- * Creates a `QueryConstraint` with the specified ending point (exclusive).
916
- *
917
- * Using `startAt()`, `startAfter()`, `endBefore()`, `endAt()` and `equalTo()`
918
- * allows you to choose arbitrary starting and ending points for your queries.
919
- *
920
- * The ending point is exclusive. If only a value is provided, children
921
- * with a value less than the specified value will be included in the query.
922
- * If a key is specified, then children must have a value lesss than or equal
923
- * to the specified value and a a key name less than the specified key.
924
- *
925
- * @param value - The value to end before. The argument type depends on which
926
- * `orderBy*()` function was used in this query. Specify a value that matches
927
- * the `orderBy*()` type. When used in combination with `orderByKey()`, the
928
- * value must be a string.
929
- * @param key - The child key to end before, among the children with the
930
- * previously specified priority. This argument is only allowed if ordering by
931
- * child, value, or priority.
932
- */
933
- export declare function endBefore(value: number | string | boolean | null, key?: string): QueryConstraint;
934
- /**
935
- * Creates a `QueryConstraint` with the specified starting point.
936
- *
937
- * Using `startAt()`, `startAfter()`, `endBefore()`, `endAt()` and `equalTo()`
938
- * allows you to choose arbitrary starting and ending points for your queries.
939
- *
940
- * The starting point is inclusive, so children with exactly the specified value
941
- * will be included in the query. The optional key argument can be used to
942
- * further limit the range of the query. If it is specified, then children that
943
- * have exactly the specified value must also have a key name greater than or
944
- * equal to the specified key.
945
- *
946
- * You can read more about `startAt()` in
947
- * {@link https://firebase.google.com/docs/database/web/lists-of-data#filtering_data | Filtering data}.
948
- *
949
- * @param value - The value to start at. The argument type depends on which
950
- * `orderBy*()` function was used in this query. Specify a value that matches
951
- * the `orderBy*()` type. When used in combination with `orderByKey()`, the
952
- * value must be a string.
953
- * @param key - The child key to start at. This argument is only allowed if
954
- * ordering by child, value, or priority.
955
- */
956
- export declare function startAt(value?: number | string | boolean | null, key?: string): QueryConstraint;
957
- /**
958
- * Creates a `QueryConstraint` with the specified starting point (exclusive).
959
- *
960
- * Using `startAt()`, `startAfter()`, `endBefore()`, `endAt()` and `equalTo()`
961
- * allows you to choose arbitrary starting and ending points for your queries.
962
- *
963
- * The starting point is exclusive. If only a value is provided, children
964
- * with a value greater than the specified value will be included in the query.
965
- * If a key is specified, then children must have a value greater than or equal
966
- * to the specified value and a a key name greater than the specified key.
967
- *
968
- * @param value - The value to start after. The argument type depends on which
969
- * `orderBy*()` function was used in this query. Specify a value that matches
970
- * the `orderBy*()` type. When used in combination with `orderByKey()`, the
971
- * value must be a string.
972
- * @param key - The child key to start after. This argument is only allowed if
973
- * ordering by child, value, or priority.
974
- */
975
- export declare function startAfter(value: number | string | boolean | null, key?: string): QueryConstraint;
976
- /**
977
- * Creates a new `QueryConstraint` that if limited to the first specific number
978
- * of children.
979
- *
980
- * The `limitToFirst()` method is used to set a maximum number of children to be
981
- * synced for a given callback. If we set a limit of 100, we will initially only
982
- * receive up to 100 `child_added` events. If we have fewer than 100 messages
983
- * stored in our Database, a `child_added` event will fire for each message.
984
- * However, if we have over 100 messages, we will only receive a `child_added`
985
- * event for the first 100 ordered messages. As items change, we will receive
986
- * `child_removed` events for each item that drops out of the active list so
987
- * that the total number stays at 100.
988
- *
989
- * You can read more about `limitToFirst()` in
990
- * {@link https://firebase.google.com/docs/database/web/lists-of-data#filtering_data | Filtering data}.
991
- *
992
- * @param limit - The maximum number of nodes to include in this query.
993
- */
994
- export declare function limitToFirst(limit: number): QueryConstraint;
995
- /**
996
- * Creates a new `QueryConstraint` that is limited to return only the last
997
- * specified number of children.
998
- *
999
- * The `limitToLast()` method is used to set a maximum number of children to be
1000
- * synced for a given callback. If we set a limit of 100, we will initially only
1001
- * receive up to 100 `child_added` events. If we have fewer than 100 messages
1002
- * stored in our Database, a `child_added` event will fire for each message.
1003
- * However, if we have over 100 messages, we will only receive a `child_added`
1004
- * event for the last 100 ordered messages. As items change, we will receive
1005
- * `child_removed` events for each item that drops out of the active list so
1006
- * that the total number stays at 100.
1007
- *
1008
- * You can read more about `limitToLast()` in
1009
- * {@link https://firebase.google.com/docs/database/web/lists-of-data#filtering_data | Filtering data}.
1010
- *
1011
- * @param limit - The maximum number of nodes to include in this query.
1012
- */
1013
- export declare function limitToLast(limit: number): QueryConstraint;
1014
- /**
1015
- * Creates a new `QueryConstraint` that orders by the specified child key.
1016
- *
1017
- * Queries can only order by one key at a time. Calling `orderByChild()`
1018
- * multiple times on the same query is an error.
1019
- *
1020
- * Firebase queries allow you to order your data by any child key on the fly.
1021
- * However, if you know in advance what your indexes will be, you can define
1022
- * them via the .indexOn rule in your Security Rules for better performance. See
1023
- * the{@link https://firebase.google.com/docs/database/security/indexing-data}
1024
- * rule for more information.
1025
- *
1026
- * You can read more about `orderByChild()` in
1027
- * {@link https://firebase.google.com/docs/database/web/lists-of-data#sort_data | Sort data}.
1028
- *
1029
- * @param path - The path to order by.
1030
- */
1031
- export declare function orderByChild(path: string): QueryConstraint;
1032
- /**
1033
- * Creates a new `QueryConstraint` that orders by the key.
1034
- *
1035
- * Sorts the results of a query by their (ascending) key values.
1036
- *
1037
- * You can read more about `orderByKey()` in
1038
- * {@link https://firebase.google.com/docs/database/web/lists-of-data#sort_data | Sort data}.
1039
- */
1040
- export declare function orderByKey(): QueryConstraint;
1041
- /**
1042
- * Creates a new `QueryConstraint` that orders by priority.
1043
- *
1044
- * Applications need not use priority but can order collections by
1045
- * ordinary properties (see
1046
- * {@link https://firebase.google.com/docs/database/web/lists-of-data#sort_data | Sort data}
1047
- * for alternatives to priority.
1048
- */
1049
- export declare function orderByPriority(): QueryConstraint;
1050
- /**
1051
- * Creates a new `QueryConstraint` that orders by value.
1052
- *
1053
- * If the children of a query are all scalar values (string, number, or
1054
- * boolean), you can order the results by their (ascending) values.
1055
- *
1056
- * You can read more about `orderByValue()` in
1057
- * {@link https://firebase.google.com/docs/database/web/lists-of-data#sort_data | Sort data}.
1058
- */
1059
- export declare function orderByValue(): QueryConstraint;
1060
- /**
1061
- * Creates a `QueryConstraint` that includes children that match the specified
1062
- * value.
1063
- *
1064
- * Using `startAt()`, `startAfter()`, `endBefore()`, `endAt()` and `equalTo()`
1065
- * allows you to choose arbitrary starting and ending points for your queries.
1066
- *
1067
- * The optional key argument can be used to further limit the range of the
1068
- * query. If it is specified, then children that have exactly the specified
1069
- * value must also have exactly the specified key as their key name. This can be
1070
- * used to filter result sets with many matches for the same value.
1071
- *
1072
- * You can read more about `equalTo()` in
1073
- * {@link https://firebase.google.com/docs/database/web/lists-of-data#filtering_data | Filtering data}.
1074
- *
1075
- * @param value - The value to match for. The argument type depends on which
1076
- * `orderBy*()` function was used in this query. Specify a value that matches
1077
- * the `orderBy*()` type. When used in combination with `orderByKey()`, the
1078
- * value must be a string.
1079
- * @param key - The child key to start at, among the children with the
1080
- * previously specified priority. This argument is only allowed if ordering by
1081
- * child, value, or priority.
1082
- */
1083
- export declare function equalTo(value: number | string | boolean | null, key?: string): QueryConstraint;
1084
- /**
1085
- * Creates a new immutable instance of `Query` that is extended to also include
1086
- * additional query constraints.
1087
- *
1088
- * @param query - The Query instance to use as a base for the new constraints.
1089
- * @param queryConstraints - The list of `QueryConstraint`s to apply.
1090
- * @throws if any of the provided query constraints cannot be combined with the
1091
- * existing or new constraints.
1092
- */
1093
- export declare function query(query: Query, ...queryConstraints: QueryConstraint[]): Query;