@firebase/database 1.0.9 → 1.0.10

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