@firebase/database 1.1.4 → 1.1.5-crashlytics2.142b40983
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.
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.node.cjs.js +1 -1
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.standalone.js.map +1 -1
- package/dist/internal.d.ts +1 -0
- package/dist/node-esm/index.node.esm.js +1 -1
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/private.d.ts +2 -0
- package/dist/public.d.ts +542 -297
- package/dist/{src/tsdoc-metadata.json → tsdoc-metadata.json} +1 -1
- package/package.json +7 -7
package/dist/public.d.ts
CHANGED
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
import { EmulatorMockTokenOptions } from '@firebase/util';
|
|
8
8
|
|
|
9
|
+
import { FirebaseApp } from '@firebase/app';
|
|
10
|
+
|
|
9
11
|
/**
|
|
10
12
|
* Gets a `Reference` for the location at the specified relative path.
|
|
11
13
|
*
|
|
@@ -17,7 +19,10 @@ import { EmulatorMockTokenOptions } from '@firebase/util';
|
|
|
17
19
|
* location.
|
|
18
20
|
* @returns The specified child location.
|
|
19
21
|
*/
|
|
20
|
-
export declare function child(
|
|
22
|
+
export declare function child(
|
|
23
|
+
parent: DatabaseReference,
|
|
24
|
+
path: string
|
|
25
|
+
): DatabaseReference;
|
|
21
26
|
/**
|
|
22
27
|
* Modify the provided instance to communicate with the Realtime Database
|
|
23
28
|
* emulator.
|
|
@@ -29,19 +34,26 @@ export declare function child(parent: DatabaseReference, path: string): Database
|
|
|
29
34
|
* @param port - The emulator port (ex: 8080)
|
|
30
35
|
* @param options.mockUserToken - the mock auth token to use for unit testing Security Rules
|
|
31
36
|
*/
|
|
32
|
-
export declare function connectDatabaseEmulator(
|
|
37
|
+
export declare function connectDatabaseEmulator(
|
|
38
|
+
db: Database,
|
|
39
|
+
host: string,
|
|
40
|
+
port: number,
|
|
41
|
+
options?: {
|
|
33
42
|
mockUserToken?: EmulatorMockTokenOptions | string;
|
|
34
|
-
}
|
|
43
|
+
}
|
|
44
|
+
): void;
|
|
45
|
+
|
|
35
46
|
/**
|
|
36
47
|
* Class representing a Firebase Realtime Database.
|
|
37
48
|
*/
|
|
38
49
|
export declare class Database {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
50
|
+
/** The {@link @firebase/app#FirebaseApp} associated with this Realtime Database instance. */
|
|
51
|
+
readonly app: FirebaseApp;
|
|
52
|
+
/** Represents a `Database` instance. */
|
|
53
|
+
readonly 'type' = 'database';
|
|
54
|
+
private constructor();
|
|
44
55
|
}
|
|
56
|
+
|
|
45
57
|
/**
|
|
46
58
|
* A `DatabaseReference` represents a specific location in your Database and can be used
|
|
47
59
|
* for reading or writing data to that Database location.
|
|
@@ -54,24 +66,25 @@ export declare class Database {
|
|
|
54
66
|
* https://firebase.google.com/docs/database/web/read-and-write}
|
|
55
67
|
*/
|
|
56
68
|
export declare interface DatabaseReference extends Query {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
/**
|
|
70
|
+
* The last part of the `DatabaseReference`'s path.
|
|
71
|
+
*
|
|
72
|
+
* For example, `"ada"` is the key for
|
|
73
|
+
* `https://<DATABASE_NAME>.firebaseio.com/users/ada`.
|
|
74
|
+
*
|
|
75
|
+
* The key of a root `DatabaseReference` is `null`.
|
|
76
|
+
*/
|
|
77
|
+
readonly key: string | null;
|
|
78
|
+
/**
|
|
79
|
+
* The parent location of a `DatabaseReference`.
|
|
80
|
+
*
|
|
81
|
+
* The parent of a root `DatabaseReference` is `null`.
|
|
82
|
+
*/
|
|
83
|
+
readonly parent: DatabaseReference | null;
|
|
84
|
+
/** The root `DatabaseReference` of the Database. */
|
|
85
|
+
readonly root: DatabaseReference;
|
|
74
86
|
}
|
|
87
|
+
|
|
75
88
|
/**
|
|
76
89
|
* A `DataSnapshot` contains data from a Database location.
|
|
77
90
|
*
|
|
@@ -87,118 +100,120 @@ export declare interface DatabaseReference extends Query {
|
|
|
87
100
|
* data, you always call the `set()` method on a `Reference` directly).
|
|
88
101
|
*/
|
|
89
102
|
export declare class DataSnapshot {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
103
|
+
/**
|
|
104
|
+
* The location of this DataSnapshot.
|
|
105
|
+
*/
|
|
106
|
+
readonly ref: DatabaseReference;
|
|
107
|
+
/**
|
|
108
|
+
* Gets the priority value of the data in this `DataSnapshot`.
|
|
109
|
+
*
|
|
110
|
+
* Applications need not use priority but can order collections by
|
|
111
|
+
* ordinary properties (see
|
|
112
|
+
* {@link https://firebase.google.com/docs/database/web/lists-of-data#sorting_and_filtering_data |Sorting and filtering data}
|
|
113
|
+
* ).
|
|
114
|
+
*/
|
|
115
|
+
get priority(): string | number | null;
|
|
116
|
+
/**
|
|
117
|
+
* The key (last part of the path) of the location of this `DataSnapshot`.
|
|
118
|
+
*
|
|
119
|
+
* The last token in a Database location is considered its key. For example,
|
|
120
|
+
* "ada" is the key for the /users/ada/ node. Accessing the key on any
|
|
121
|
+
* `DataSnapshot` will return the key for the location that generated it.
|
|
122
|
+
* However, accessing the key on the root URL of a Database will return
|
|
123
|
+
* `null`.
|
|
124
|
+
*/
|
|
125
|
+
get key(): string | null;
|
|
126
|
+
/** Returns the number of child properties of this `DataSnapshot`. */
|
|
127
|
+
get size(): number;
|
|
128
|
+
/**
|
|
129
|
+
* Gets another `DataSnapshot` for the location at the specified relative path.
|
|
130
|
+
*
|
|
131
|
+
* Passing a relative path to the `child()` method of a DataSnapshot returns
|
|
132
|
+
* another `DataSnapshot` for the location at the specified relative path. The
|
|
133
|
+
* relative path can either be a simple child name (for example, "ada") or a
|
|
134
|
+
* deeper, slash-separated path (for example, "ada/name/first"). If the child
|
|
135
|
+
* location has no data, an empty `DataSnapshot` (that is, a `DataSnapshot`
|
|
136
|
+
* whose value is `null`) is returned.
|
|
137
|
+
*
|
|
138
|
+
* @param path - A relative path to the location of child data.
|
|
139
|
+
*/
|
|
140
|
+
child(path: string): DataSnapshot;
|
|
141
|
+
/**
|
|
142
|
+
* Returns true if this `DataSnapshot` contains any data. It is slightly more
|
|
143
|
+
* efficient than using `snapshot.val() !== null`.
|
|
144
|
+
*/
|
|
145
|
+
exists(): boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Exports the entire contents of the DataSnapshot as a JavaScript object.
|
|
148
|
+
*
|
|
149
|
+
* The `exportVal()` method is similar to `val()`, except priority information
|
|
150
|
+
* is included (if available), making it suitable for backing up your data.
|
|
151
|
+
*
|
|
152
|
+
* @returns The DataSnapshot's contents as a JavaScript value (Object,
|
|
153
|
+
* Array, string, number, boolean, or `null`).
|
|
154
|
+
*/
|
|
155
|
+
exportVal(): any;
|
|
156
|
+
/**
|
|
157
|
+
* Enumerates the top-level children in the `IteratedDataSnapshot`.
|
|
158
|
+
*
|
|
159
|
+
* Because of the way JavaScript objects work, the ordering of data in the
|
|
160
|
+
* JavaScript object returned by `val()` is not guaranteed to match the
|
|
161
|
+
* ordering on the server nor the ordering of `onChildAdded()` events. That is
|
|
162
|
+
* where `forEach()` comes in handy. It guarantees the children of a
|
|
163
|
+
* `DataSnapshot` will be iterated in their query order.
|
|
164
|
+
*
|
|
165
|
+
* If no explicit `orderBy*()` method is used, results are returned
|
|
166
|
+
* ordered by key (unless priorities are used, in which case, results are
|
|
167
|
+
* returned by priority).
|
|
168
|
+
*
|
|
169
|
+
* @param action - A function that will be called for each child DataSnapshot.
|
|
170
|
+
* The callback can return true to cancel further enumeration.
|
|
171
|
+
* @returns true if enumeration was canceled due to your callback returning
|
|
172
|
+
* true.
|
|
173
|
+
*/
|
|
174
|
+
forEach(action: (child: IteratedDataSnapshot) => boolean | void): boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Returns true if the specified child path has (non-null) data.
|
|
177
|
+
*
|
|
178
|
+
* @param path - A relative path to the location of a potential child.
|
|
179
|
+
* @returns `true` if data exists at the specified child path; else
|
|
180
|
+
* `false`.
|
|
181
|
+
*/
|
|
182
|
+
hasChild(path: string): boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Returns whether or not the `DataSnapshot` has any non-`null` child
|
|
185
|
+
* properties.
|
|
186
|
+
*
|
|
187
|
+
* You can use `hasChildren()` to determine if a `DataSnapshot` has any
|
|
188
|
+
* children. If it does, you can enumerate them using `forEach()`. If it
|
|
189
|
+
* doesn't, then either this snapshot contains a primitive value (which can be
|
|
190
|
+
* retrieved with `val()`) or it is empty (in which case, `val()` will return
|
|
191
|
+
* `null`).
|
|
192
|
+
*
|
|
193
|
+
* @returns true if this snapshot has any children; else false.
|
|
194
|
+
*/
|
|
195
|
+
hasChildren(): boolean;
|
|
196
|
+
/**
|
|
197
|
+
* Returns a JSON-serializable representation of this object.
|
|
198
|
+
*/
|
|
199
|
+
toJSON(): object | null;
|
|
200
|
+
/**
|
|
201
|
+
* Extracts a JavaScript value from a `DataSnapshot`.
|
|
202
|
+
*
|
|
203
|
+
* Depending on the data in a `DataSnapshot`, the `val()` method may return a
|
|
204
|
+
* scalar type (string, number, or boolean), an array, or an object. It may
|
|
205
|
+
* also return null, indicating that the `DataSnapshot` is empty (contains no
|
|
206
|
+
* data).
|
|
207
|
+
*
|
|
208
|
+
* @returns The DataSnapshot's contents as a JavaScript value (Object,
|
|
209
|
+
* Array, string, number, boolean, or `null`).
|
|
210
|
+
*/
|
|
211
|
+
val(): any;
|
|
212
|
+
private constructor();
|
|
200
213
|
}
|
|
214
|
+
|
|
201
215
|
export { EmulatorMockTokenOptions };
|
|
216
|
+
|
|
202
217
|
/**
|
|
203
218
|
* Logs debugging information to the console.
|
|
204
219
|
*
|
|
@@ -206,13 +221,20 @@ export { EmulatorMockTokenOptions };
|
|
|
206
221
|
* @param persistent - Remembers the logging state between page refreshes if
|
|
207
222
|
* `true`.
|
|
208
223
|
*/
|
|
209
|
-
export declare function enableLogging(
|
|
224
|
+
export declare function enableLogging(
|
|
225
|
+
enabled: boolean,
|
|
226
|
+
persistent?: boolean
|
|
227
|
+
): any;
|
|
228
|
+
|
|
210
229
|
/**
|
|
211
230
|
* Logs debugging information to the console.
|
|
212
231
|
*
|
|
213
232
|
* @param logger - A custom logger function to control how things get logged.
|
|
214
233
|
*/
|
|
215
|
-
export declare function enableLogging(
|
|
234
|
+
export declare function enableLogging(
|
|
235
|
+
logger: (message: string) => unknown
|
|
236
|
+
): any;
|
|
237
|
+
|
|
216
238
|
/**
|
|
217
239
|
* Creates a `QueryConstraint` with the specified ending point.
|
|
218
240
|
*
|
|
@@ -236,7 +258,11 @@ export declare function enableLogging(logger: (message: string) => unknown): any
|
|
|
236
258
|
* specified priority. This argument is only allowed if ordering by child,
|
|
237
259
|
* value, or priority.
|
|
238
260
|
*/
|
|
239
|
-
export declare function endAt(
|
|
261
|
+
export declare function endAt(
|
|
262
|
+
value: number | string | boolean | null,
|
|
263
|
+
key?: string
|
|
264
|
+
): QueryConstraint;
|
|
265
|
+
|
|
240
266
|
/**
|
|
241
267
|
* Creates a `QueryConstraint` with the specified ending point (exclusive).
|
|
242
268
|
*
|
|
@@ -256,7 +282,11 @@ export declare function endAt(value: number | string | boolean | null, key?: str
|
|
|
256
282
|
* previously specified priority. This argument is only allowed if ordering by
|
|
257
283
|
* child, value, or priority.
|
|
258
284
|
*/
|
|
259
|
-
export declare function endBefore(
|
|
285
|
+
export declare function endBefore(
|
|
286
|
+
value: number | string | boolean | null,
|
|
287
|
+
key?: string
|
|
288
|
+
): QueryConstraint;
|
|
289
|
+
|
|
260
290
|
/**
|
|
261
291
|
* Creates a `QueryConstraint` that includes children that match the specified
|
|
262
292
|
* value.
|
|
@@ -280,21 +310,33 @@ export declare function endBefore(value: number | string | boolean | null, key?:
|
|
|
280
310
|
* previously specified priority. This argument is only allowed if ordering by
|
|
281
311
|
* child, value, or priority.
|
|
282
312
|
*/
|
|
283
|
-
export declare function equalTo(
|
|
313
|
+
export declare function equalTo(
|
|
314
|
+
value: number | string | boolean | null,
|
|
315
|
+
key?: string
|
|
316
|
+
): QueryConstraint;
|
|
284
317
|
/**
|
|
285
318
|
* One of the following strings: "value", "child_added", "child_changed",
|
|
286
319
|
* "child_removed", or "child_moved."
|
|
287
320
|
*/
|
|
288
|
-
export declare type EventType =
|
|
321
|
+
export declare type EventType =
|
|
322
|
+
| 'value'
|
|
323
|
+
| 'child_added'
|
|
324
|
+
| 'child_changed'
|
|
325
|
+
| 'child_moved'
|
|
326
|
+
| 'child_removed';
|
|
327
|
+
|
|
289
328
|
/* Excluded from this release type: _FirebaseService */
|
|
329
|
+
|
|
290
330
|
/**
|
|
291
331
|
* Force the use of longPolling instead of websockets. This will be ignored if websocket protocol is used in databaseURL.
|
|
292
332
|
*/
|
|
293
333
|
export declare function forceLongPolling(): void;
|
|
334
|
+
|
|
294
335
|
/**
|
|
295
336
|
* Force the use of websockets instead of longPolling.
|
|
296
337
|
*/
|
|
297
338
|
export declare function forceWebSockets(): void;
|
|
339
|
+
|
|
298
340
|
/**
|
|
299
341
|
* Gets the most up-to-date result for this query.
|
|
300
342
|
*
|
|
@@ -304,6 +346,7 @@ export declare function forceWebSockets(): void;
|
|
|
304
346
|
* server is unreachable and there is nothing cached).
|
|
305
347
|
*/
|
|
306
348
|
export declare function get(query: Query): Promise<DataSnapshot>;
|
|
349
|
+
|
|
307
350
|
/**
|
|
308
351
|
* Returns the instance of the Realtime Database SDK that is associated with the provided
|
|
309
352
|
* {@link @firebase/app#FirebaseApp}. Initializes a new instance with default settings if
|
|
@@ -316,6 +359,7 @@ export declare function get(query: Query): Promise<DataSnapshot>;
|
|
|
316
359
|
* @returns The `Database` instance of the provided app.
|
|
317
360
|
*/
|
|
318
361
|
export declare function getDatabase(app?: FirebaseApp, url?: string): Database;
|
|
362
|
+
|
|
319
363
|
/**
|
|
320
364
|
* Disconnects from the server (all Database operations will be completed
|
|
321
365
|
* offline).
|
|
@@ -338,6 +382,7 @@ export declare function getDatabase(app?: FirebaseApp, url?: string): Database;
|
|
|
338
382
|
* @param db - The instance to disconnect.
|
|
339
383
|
*/
|
|
340
384
|
export declare function goOffline(db: Database): void;
|
|
385
|
+
|
|
341
386
|
/**
|
|
342
387
|
* Reconnects to the server and synchronizes the offline Database state
|
|
343
388
|
* with the server state.
|
|
@@ -359,12 +404,14 @@ export declare function goOnline(db: Database): void;
|
|
|
359
404
|
*/
|
|
360
405
|
export declare function increment(delta: number): object;
|
|
361
406
|
/* Excluded from this release type: _initStandalone */
|
|
407
|
+
|
|
362
408
|
/**
|
|
363
409
|
* Represents a child snapshot of a `Reference` that is being iterated over. The key will never be undefined.
|
|
364
410
|
*/
|
|
365
411
|
export declare interface IteratedDataSnapshot extends DataSnapshot {
|
|
366
|
-
|
|
412
|
+
key: string;
|
|
367
413
|
}
|
|
414
|
+
|
|
368
415
|
/**
|
|
369
416
|
* Creates a new `QueryConstraint` that if limited to the first specific number
|
|
370
417
|
* of children.
|
|
@@ -384,6 +431,7 @@ export declare interface IteratedDataSnapshot extends DataSnapshot {
|
|
|
384
431
|
* @param limit - The maximum number of nodes to include in this query.
|
|
385
432
|
*/
|
|
386
433
|
export declare function limitToFirst(limit: number): QueryConstraint;
|
|
434
|
+
|
|
387
435
|
/**
|
|
388
436
|
* Creates a new `QueryConstraint` that is limited to return only the last
|
|
389
437
|
* specified number of children.
|
|
@@ -403,11 +451,13 @@ export declare function limitToFirst(limit: number): QueryConstraint;
|
|
|
403
451
|
* @param limit - The maximum number of nodes to include in this query.
|
|
404
452
|
*/
|
|
405
453
|
export declare function limitToLast(limit: number): QueryConstraint;
|
|
454
|
+
|
|
406
455
|
/** An options objects that can be used to customize a listener. */
|
|
407
456
|
export declare interface ListenOptions {
|
|
408
|
-
|
|
409
|
-
|
|
457
|
+
/** Whether to remove the listener after its first invocation. */
|
|
458
|
+
readonly onlyOnce?: boolean;
|
|
410
459
|
}
|
|
460
|
+
|
|
411
461
|
/**
|
|
412
462
|
* Detaches a callback previously attached with the corresponding `on*()` (`onValue`, `onChildAdded`) listener.
|
|
413
463
|
* Note: This is not the recommended way to remove a listener. Instead, please use the returned callback function from
|
|
@@ -431,7 +481,15 @@ export declare interface ListenOptions {
|
|
|
431
481
|
* @param callback - The callback function that was passed to `on()` or
|
|
432
482
|
* `undefined` to remove all callbacks.
|
|
433
483
|
*/
|
|
434
|
-
export declare function off(
|
|
484
|
+
export declare function off(
|
|
485
|
+
query: Query,
|
|
486
|
+
eventType?: EventType,
|
|
487
|
+
callback?: (
|
|
488
|
+
snapshot: DataSnapshot,
|
|
489
|
+
previousChildName?: string | null
|
|
490
|
+
) => unknown
|
|
491
|
+
): void;
|
|
492
|
+
|
|
435
493
|
/**
|
|
436
494
|
* Listens for data changes at a particular location.
|
|
437
495
|
*
|
|
@@ -459,7 +517,15 @@ export declare function off(query: Query, eventType?: EventType, callback?: (sna
|
|
|
459
517
|
* occurred.
|
|
460
518
|
* @returns A function that can be invoked to remove the listener.
|
|
461
519
|
*/
|
|
462
|
-
export declare function onChildAdded(
|
|
520
|
+
export declare function onChildAdded(
|
|
521
|
+
query: Query,
|
|
522
|
+
callback: (
|
|
523
|
+
snapshot: DataSnapshot,
|
|
524
|
+
previousChildName?: string | null
|
|
525
|
+
) => unknown,
|
|
526
|
+
cancelCallback?: (error: Error) => unknown
|
|
527
|
+
): Unsubscribe;
|
|
528
|
+
|
|
463
529
|
/**
|
|
464
530
|
* Listens for data changes at a particular location.
|
|
465
531
|
*
|
|
@@ -484,7 +550,15 @@ export declare function onChildAdded(query: Query, callback: (snapshot: DataSnap
|
|
|
484
550
|
* then removes the listener after its first invocation.
|
|
485
551
|
* @returns A function that can be invoked to remove the listener.
|
|
486
552
|
*/
|
|
487
|
-
export declare function onChildAdded(
|
|
553
|
+
export declare function onChildAdded(
|
|
554
|
+
query: Query,
|
|
555
|
+
callback: (
|
|
556
|
+
snapshot: DataSnapshot,
|
|
557
|
+
previousChildName: string | null
|
|
558
|
+
) => unknown,
|
|
559
|
+
options: ListenOptions
|
|
560
|
+
): Unsubscribe;
|
|
561
|
+
|
|
488
562
|
/**
|
|
489
563
|
* Listens for data changes at a particular location.
|
|
490
564
|
*
|
|
@@ -514,7 +588,16 @@ export declare function onChildAdded(query: Query, callback: (snapshot: DataSnap
|
|
|
514
588
|
* then removes the listener after its first invocation.
|
|
515
589
|
* @returns A function that can be invoked to remove the listener.
|
|
516
590
|
*/
|
|
517
|
-
export declare function onChildAdded(
|
|
591
|
+
export declare function onChildAdded(
|
|
592
|
+
query: Query,
|
|
593
|
+
callback: (
|
|
594
|
+
snapshot: DataSnapshot,
|
|
595
|
+
previousChildName: string | null
|
|
596
|
+
) => unknown,
|
|
597
|
+
cancelCallback: (error: Error) => unknown,
|
|
598
|
+
options: ListenOptions
|
|
599
|
+
): Unsubscribe;
|
|
600
|
+
|
|
518
601
|
/**
|
|
519
602
|
* Listens for data changes at a particular location.
|
|
520
603
|
*
|
|
@@ -543,7 +626,15 @@ export declare function onChildAdded(query: Query, callback: (snapshot: DataSnap
|
|
|
543
626
|
* occurred.
|
|
544
627
|
* @returns A function that can be invoked to remove the listener.
|
|
545
628
|
*/
|
|
546
|
-
export declare function onChildChanged(
|
|
629
|
+
export declare function onChildChanged(
|
|
630
|
+
query: Query,
|
|
631
|
+
callback: (
|
|
632
|
+
snapshot: DataSnapshot,
|
|
633
|
+
previousChildName: string | null
|
|
634
|
+
) => unknown,
|
|
635
|
+
cancelCallback?: (error: Error) => unknown
|
|
636
|
+
): Unsubscribe;
|
|
637
|
+
|
|
547
638
|
/**
|
|
548
639
|
* Listens for data changes at a particular location.
|
|
549
640
|
*
|
|
@@ -569,7 +660,15 @@ export declare function onChildChanged(query: Query, callback: (snapshot: DataSn
|
|
|
569
660
|
* then removes the listener after its first invocation.
|
|
570
661
|
* @returns A function that can be invoked to remove the listener.
|
|
571
662
|
*/
|
|
572
|
-
export declare function onChildChanged(
|
|
663
|
+
export declare function onChildChanged(
|
|
664
|
+
query: Query,
|
|
665
|
+
callback: (
|
|
666
|
+
snapshot: DataSnapshot,
|
|
667
|
+
previousChildName: string | null
|
|
668
|
+
) => unknown,
|
|
669
|
+
options: ListenOptions
|
|
670
|
+
): Unsubscribe;
|
|
671
|
+
|
|
573
672
|
/**
|
|
574
673
|
* Listens for data changes at a particular location.
|
|
575
674
|
*
|
|
@@ -600,7 +699,16 @@ export declare function onChildChanged(query: Query, callback: (snapshot: DataSn
|
|
|
600
699
|
* then removes the listener after its first invocation.
|
|
601
700
|
* @returns A function that can be invoked to remove the listener.
|
|
602
701
|
*/
|
|
603
|
-
export declare function onChildChanged(
|
|
702
|
+
export declare function onChildChanged(
|
|
703
|
+
query: Query,
|
|
704
|
+
callback: (
|
|
705
|
+
snapshot: DataSnapshot,
|
|
706
|
+
previousChildName: string | null
|
|
707
|
+
) => unknown,
|
|
708
|
+
cancelCallback: (error: Error) => unknown,
|
|
709
|
+
options: ListenOptions
|
|
710
|
+
): Unsubscribe;
|
|
711
|
+
|
|
604
712
|
/**
|
|
605
713
|
* Listens for data changes at a particular location.
|
|
606
714
|
*
|
|
@@ -627,7 +735,15 @@ export declare function onChildChanged(query: Query, callback: (snapshot: DataSn
|
|
|
627
735
|
* occurred.
|
|
628
736
|
* @returns A function that can be invoked to remove the listener.
|
|
629
737
|
*/
|
|
630
|
-
export declare function onChildMoved(
|
|
738
|
+
export declare function onChildMoved(
|
|
739
|
+
query: Query,
|
|
740
|
+
callback: (
|
|
741
|
+
snapshot: DataSnapshot,
|
|
742
|
+
previousChildName: string | null
|
|
743
|
+
) => unknown,
|
|
744
|
+
cancelCallback?: (error: Error) => unknown
|
|
745
|
+
): Unsubscribe;
|
|
746
|
+
|
|
631
747
|
/**
|
|
632
748
|
* Listens for data changes at a particular location.
|
|
633
749
|
*
|
|
@@ -651,7 +767,15 @@ export declare function onChildMoved(query: Query, callback: (snapshot: DataSnap
|
|
|
651
767
|
* then removes the listener after its first invocation.
|
|
652
768
|
* @returns A function that can be invoked to remove the listener.
|
|
653
769
|
*/
|
|
654
|
-
export declare function onChildMoved(
|
|
770
|
+
export declare function onChildMoved(
|
|
771
|
+
query: Query,
|
|
772
|
+
callback: (
|
|
773
|
+
snapshot: DataSnapshot,
|
|
774
|
+
previousChildName: string | null
|
|
775
|
+
) => unknown,
|
|
776
|
+
options: ListenOptions
|
|
777
|
+
): Unsubscribe;
|
|
778
|
+
|
|
655
779
|
/**
|
|
656
780
|
* Listens for data changes at a particular location.
|
|
657
781
|
*
|
|
@@ -680,7 +804,16 @@ export declare function onChildMoved(query: Query, callback: (snapshot: DataSnap
|
|
|
680
804
|
* then removes the listener after its first invocation.
|
|
681
805
|
* @returns A function that can be invoked to remove the listener.
|
|
682
806
|
*/
|
|
683
|
-
export declare function onChildMoved(
|
|
807
|
+
export declare function onChildMoved(
|
|
808
|
+
query: Query,
|
|
809
|
+
callback: (
|
|
810
|
+
snapshot: DataSnapshot,
|
|
811
|
+
previousChildName: string | null
|
|
812
|
+
) => unknown,
|
|
813
|
+
cancelCallback: (error: Error) => unknown,
|
|
814
|
+
options: ListenOptions
|
|
815
|
+
): Unsubscribe;
|
|
816
|
+
|
|
684
817
|
/**
|
|
685
818
|
* Listens for data changes at a particular location.
|
|
686
819
|
*
|
|
@@ -711,7 +844,12 @@ export declare function onChildMoved(query: Query, callback: (snapshot: DataSnap
|
|
|
711
844
|
* occurred.
|
|
712
845
|
* @returns A function that can be invoked to remove the listener.
|
|
713
846
|
*/
|
|
714
|
-
export declare function onChildRemoved(
|
|
847
|
+
export declare function onChildRemoved(
|
|
848
|
+
query: Query,
|
|
849
|
+
callback: (snapshot: DataSnapshot) => unknown,
|
|
850
|
+
cancelCallback?: (error: Error) => unknown
|
|
851
|
+
): Unsubscribe;
|
|
852
|
+
|
|
715
853
|
/**
|
|
716
854
|
* Listens for data changes at a particular location.
|
|
717
855
|
*
|
|
@@ -739,7 +877,12 @@ export declare function onChildRemoved(query: Query, callback: (snapshot: DataSn
|
|
|
739
877
|
* then removes the listener after its first invocation.
|
|
740
878
|
* @returns A function that can be invoked to remove the listener.
|
|
741
879
|
*/
|
|
742
|
-
export declare function onChildRemoved(
|
|
880
|
+
export declare function onChildRemoved(
|
|
881
|
+
query: Query,
|
|
882
|
+
callback: (snapshot: DataSnapshot) => unknown,
|
|
883
|
+
options: ListenOptions
|
|
884
|
+
): Unsubscribe;
|
|
885
|
+
|
|
743
886
|
/**
|
|
744
887
|
* Listens for data changes at a particular location.
|
|
745
888
|
*
|
|
@@ -772,7 +915,13 @@ export declare function onChildRemoved(query: Query, callback: (snapshot: DataSn
|
|
|
772
915
|
* then removes the listener after its first invocation.
|
|
773
916
|
* @returns A function that can be invoked to remove the listener.
|
|
774
917
|
*/
|
|
775
|
-
export declare function onChildRemoved(
|
|
918
|
+
export declare function onChildRemoved(
|
|
919
|
+
query: Query,
|
|
920
|
+
callback: (snapshot: DataSnapshot) => unknown,
|
|
921
|
+
cancelCallback: (error: Error) => unknown,
|
|
922
|
+
options: ListenOptions
|
|
923
|
+
): Unsubscribe;
|
|
924
|
+
|
|
776
925
|
/**
|
|
777
926
|
* The `onDisconnect` class allows you to write or clear data when your client
|
|
778
927
|
* disconnects from the Database server. These updates occur whether your
|
|
@@ -794,74 +943,78 @@ export declare function onChildRemoved(query: Query, callback: (snapshot: DataSn
|
|
|
794
943
|
* the `onDisconnect` operations each time you reconnect.
|
|
795
944
|
*/
|
|
796
945
|
export declare class OnDisconnect {
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
946
|
+
/**
|
|
947
|
+
* Cancels all previously queued `onDisconnect()` set or update events for this
|
|
948
|
+
* location and all children.
|
|
949
|
+
*
|
|
950
|
+
* If a write has been queued for this location via a `set()` or `update()` at a
|
|
951
|
+
* parent location, the write at this location will be canceled, though writes
|
|
952
|
+
* to sibling locations will still occur.
|
|
953
|
+
*
|
|
954
|
+
* @returns Resolves when synchronization to the server is complete.
|
|
955
|
+
*/
|
|
956
|
+
cancel(): Promise<void>;
|
|
957
|
+
/**
|
|
958
|
+
* Ensures the data at this location is deleted when the client is disconnected
|
|
959
|
+
* (due to closing the browser, navigating to a new page, or network issues).
|
|
960
|
+
*
|
|
961
|
+
* @returns Resolves when synchronization to the server is complete.
|
|
962
|
+
*/
|
|
963
|
+
remove(): Promise<void>;
|
|
964
|
+
/**
|
|
965
|
+
* Ensures the data at this location is set to the specified value when the
|
|
966
|
+
* client is disconnected (due to closing the browser, navigating to a new page,
|
|
967
|
+
* or network issues).
|
|
968
|
+
*
|
|
969
|
+
* `set()` is especially useful for implementing "presence" systems, where a
|
|
970
|
+
* value should be changed or cleared when a user disconnects so that they
|
|
971
|
+
* appear "offline" to other users. See
|
|
972
|
+
* {@link https://firebase.google.com/docs/database/web/offline-capabilities | Enabling Offline Capabilities in JavaScript}
|
|
973
|
+
* for more information.
|
|
974
|
+
*
|
|
975
|
+
* Note that `onDisconnect` operations are only triggered once. If you want an
|
|
976
|
+
* operation to occur each time a disconnect occurs, you'll need to re-establish
|
|
977
|
+
* the `onDisconnect` operations each time.
|
|
978
|
+
*
|
|
979
|
+
* @param value - The value to be written to this location on disconnect (can
|
|
980
|
+
* be an object, array, string, number, boolean, or null).
|
|
981
|
+
* @returns Resolves when synchronization to the Database is complete.
|
|
982
|
+
*/
|
|
983
|
+
set(value: unknown): Promise<void>;
|
|
984
|
+
/**
|
|
985
|
+
* Ensures the data at this location is set to the specified value and priority
|
|
986
|
+
* when the client is disconnected (due to closing the browser, navigating to a
|
|
987
|
+
* new page, or network issues).
|
|
988
|
+
*
|
|
989
|
+
* @param value - The value to be written to this location on disconnect (can
|
|
990
|
+
* be an object, array, string, number, boolean, or null).
|
|
991
|
+
* @param priority - The priority to be written (string, number, or null).
|
|
992
|
+
* @returns Resolves when synchronization to the Database is complete.
|
|
993
|
+
*/
|
|
994
|
+
setWithPriority(
|
|
995
|
+
value: unknown,
|
|
996
|
+
priority: number | string | null
|
|
997
|
+
): Promise<void>;
|
|
998
|
+
/**
|
|
999
|
+
* Writes multiple values at this location when the client is disconnected (due
|
|
1000
|
+
* to closing the browser, navigating to a new page, or network issues).
|
|
1001
|
+
*
|
|
1002
|
+
* The `values` argument contains multiple property-value pairs that will be
|
|
1003
|
+
* written to the Database together. Each child property can either be a simple
|
|
1004
|
+
* property (for example, "name") or a relative path (for example, "name/first")
|
|
1005
|
+
* from the current location to the data to update.
|
|
1006
|
+
*
|
|
1007
|
+
* As opposed to the `set()` method, `update()` can be use to selectively update
|
|
1008
|
+
* only the referenced properties at the current location (instead of replacing
|
|
1009
|
+
* all the child properties at the current location).
|
|
1010
|
+
*
|
|
1011
|
+
* @param values - Object containing multiple values.
|
|
1012
|
+
* @returns Resolves when synchronization to the Database is complete.
|
|
1013
|
+
*/
|
|
1014
|
+
update(values: object): Promise<void>;
|
|
1015
|
+
private constructor();
|
|
864
1016
|
}
|
|
1017
|
+
|
|
865
1018
|
/**
|
|
866
1019
|
* Returns an `OnDisconnect` object - see
|
|
867
1020
|
* {@link https://firebase.google.com/docs/database/web/offline-capabilities | Enabling Offline Capabilities in JavaScript}
|
|
@@ -870,6 +1023,7 @@ export declare class OnDisconnect {
|
|
|
870
1023
|
* @param ref - The reference to add OnDisconnect triggers for.
|
|
871
1024
|
*/
|
|
872
1025
|
export declare function onDisconnect(ref: DatabaseReference): OnDisconnect;
|
|
1026
|
+
|
|
873
1027
|
/**
|
|
874
1028
|
* Listens for data changes at a particular location.
|
|
875
1029
|
*
|
|
@@ -896,7 +1050,12 @@ export declare function onDisconnect(ref: DatabaseReference): OnDisconnect;
|
|
|
896
1050
|
* occurred.
|
|
897
1051
|
* @returns A function that can be invoked to remove the listener.
|
|
898
1052
|
*/
|
|
899
|
-
export declare function onValue(
|
|
1053
|
+
export declare function onValue(
|
|
1054
|
+
query: Query,
|
|
1055
|
+
callback: (snapshot: DataSnapshot) => unknown,
|
|
1056
|
+
cancelCallback?: (error: Error) => unknown
|
|
1057
|
+
): Unsubscribe;
|
|
1058
|
+
|
|
900
1059
|
/**
|
|
901
1060
|
* Listens for data changes at a particular location.
|
|
902
1061
|
*
|
|
@@ -920,7 +1079,12 @@ export declare function onValue(query: Query, callback: (snapshot: DataSnapshot)
|
|
|
920
1079
|
* then removes the listener after its first invocation.
|
|
921
1080
|
* @returns A function that can be invoked to remove the listener.
|
|
922
1081
|
*/
|
|
923
|
-
export declare function onValue(
|
|
1082
|
+
export declare function onValue(
|
|
1083
|
+
query: Query,
|
|
1084
|
+
callback: (snapshot: DataSnapshot) => unknown,
|
|
1085
|
+
options: ListenOptions
|
|
1086
|
+
): Unsubscribe;
|
|
1087
|
+
|
|
924
1088
|
/**
|
|
925
1089
|
* Listens for data changes at a particular location.
|
|
926
1090
|
*
|
|
@@ -949,7 +1113,13 @@ export declare function onValue(query: Query, callback: (snapshot: DataSnapshot)
|
|
|
949
1113
|
* then removes the listener after its first invocation.
|
|
950
1114
|
* @returns A function that can be invoked to remove the listener.
|
|
951
1115
|
*/
|
|
952
|
-
export declare function onValue(
|
|
1116
|
+
export declare function onValue(
|
|
1117
|
+
query: Query,
|
|
1118
|
+
callback: (snapshot: DataSnapshot) => unknown,
|
|
1119
|
+
cancelCallback: (error: Error) => unknown,
|
|
1120
|
+
options: ListenOptions
|
|
1121
|
+
): Unsubscribe;
|
|
1122
|
+
|
|
953
1123
|
/**
|
|
954
1124
|
* Creates a new `QueryConstraint` that orders by the specified child key.
|
|
955
1125
|
*
|
|
@@ -968,6 +1138,7 @@ export declare function onValue(query: Query, callback: (snapshot: DataSnapshot)
|
|
|
968
1138
|
* @param path - The path to order by.
|
|
969
1139
|
*/
|
|
970
1140
|
export declare function orderByChild(path: string): QueryConstraint;
|
|
1141
|
+
|
|
971
1142
|
/**
|
|
972
1143
|
* Creates a new `QueryConstraint` that orders by the key.
|
|
973
1144
|
*
|
|
@@ -977,6 +1148,7 @@ export declare function orderByChild(path: string): QueryConstraint;
|
|
|
977
1148
|
* {@link https://firebase.google.com/docs/database/web/lists-of-data#sort_data | Sort data}.
|
|
978
1149
|
*/
|
|
979
1150
|
export declare function orderByKey(): QueryConstraint;
|
|
1151
|
+
|
|
980
1152
|
/**
|
|
981
1153
|
* Creates a new `QueryConstraint` that orders by priority.
|
|
982
1154
|
*
|
|
@@ -986,6 +1158,7 @@ export declare function orderByKey(): QueryConstraint;
|
|
|
986
1158
|
* for alternatives to priority.
|
|
987
1159
|
*/
|
|
988
1160
|
export declare function orderByPriority(): QueryConstraint;
|
|
1161
|
+
|
|
989
1162
|
/**
|
|
990
1163
|
* Creates a new `QueryConstraint` that orders by value.
|
|
991
1164
|
*
|
|
@@ -1019,7 +1192,11 @@ export declare function orderByValue(): QueryConstraint;
|
|
|
1019
1192
|
* @returns Combined `Promise` and `Reference`; resolves when write is complete,
|
|
1020
1193
|
* but can be used immediately as the `Reference` to the child location.
|
|
1021
1194
|
*/
|
|
1022
|
-
export declare function push(
|
|
1195
|
+
export declare function push(
|
|
1196
|
+
parent: DatabaseReference,
|
|
1197
|
+
value?: unknown
|
|
1198
|
+
): ThenableReference;
|
|
1199
|
+
|
|
1023
1200
|
/**
|
|
1024
1201
|
* @license
|
|
1025
1202
|
* Copyright 2021 Google LLC
|
|
@@ -1052,46 +1229,47 @@ export declare function push(parent: DatabaseReference, value?: unknown): Thenab
|
|
|
1052
1229
|
* for more information.
|
|
1053
1230
|
*/
|
|
1054
1231
|
export declare interface Query {
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1232
|
+
/** The `DatabaseReference` for the `Query`'s location. */
|
|
1233
|
+
readonly ref: DatabaseReference;
|
|
1234
|
+
/**
|
|
1235
|
+
* Returns whether or not the current and provided queries represent the same
|
|
1236
|
+
* location, have the same query parameters, and are from the same instance of
|
|
1237
|
+
* `FirebaseApp`.
|
|
1238
|
+
*
|
|
1239
|
+
* Two `DatabaseReference` objects are equivalent if they represent the same location
|
|
1240
|
+
* and are from the same instance of `FirebaseApp`.
|
|
1241
|
+
*
|
|
1242
|
+
* Two `Query` objects are equivalent if they represent the same location,
|
|
1243
|
+
* have the same query parameters, and are from the same instance of
|
|
1244
|
+
* `FirebaseApp`. Equivalent queries share the same sort order, limits, and
|
|
1245
|
+
* starting and ending points.
|
|
1246
|
+
*
|
|
1247
|
+
* @param other - The query to compare against.
|
|
1248
|
+
* @returns Whether or not the current and provided queries are equivalent.
|
|
1249
|
+
*/
|
|
1250
|
+
isEqual(other: Query | null): boolean;
|
|
1251
|
+
/**
|
|
1252
|
+
* Returns a JSON-serializable representation of this object.
|
|
1253
|
+
*
|
|
1254
|
+
* @returns A JSON-serializable representation of this object.
|
|
1255
|
+
*/
|
|
1256
|
+
toJSON(): string;
|
|
1257
|
+
/**
|
|
1258
|
+
* Gets the absolute URL for this location.
|
|
1259
|
+
*
|
|
1260
|
+
* The `toString()` method returns a URL that is ready to be put into a
|
|
1261
|
+
* browser, curl command, or a `refFromURL()` call. Since all of those expect
|
|
1262
|
+
* the URL to be url-encoded, `toString()` returns an encoded URL.
|
|
1263
|
+
*
|
|
1264
|
+
* Append '.json' to the returned URL when typed into a browser to download
|
|
1265
|
+
* JSON-formatted data. If the location is secured (that is, not publicly
|
|
1266
|
+
* readable), you will get a permission-denied error.
|
|
1267
|
+
*
|
|
1268
|
+
* @returns The absolute URL for this location.
|
|
1269
|
+
*/
|
|
1270
|
+
toString(): string;
|
|
1094
1271
|
}
|
|
1272
|
+
|
|
1095
1273
|
/**
|
|
1096
1274
|
* Creates a new immutable instance of `Query` that is extended to also include
|
|
1097
1275
|
* additional query constraints.
|
|
@@ -1101,7 +1279,11 @@ export declare interface Query {
|
|
|
1101
1279
|
* @throws if any of the provided query constraints cannot be combined with the
|
|
1102
1280
|
* existing or new constraints.
|
|
1103
1281
|
*/
|
|
1104
|
-
export declare function query(
|
|
1282
|
+
export declare function query(
|
|
1283
|
+
query: Query,
|
|
1284
|
+
...queryConstraints: QueryConstraint[]
|
|
1285
|
+
): Query;
|
|
1286
|
+
|
|
1105
1287
|
/**
|
|
1106
1288
|
* A `QueryConstraint` is used to narrow the set of documents returned by a
|
|
1107
1289
|
* Database query. `QueryConstraint`s are created by invoking {@link endAt},
|
|
@@ -1113,13 +1295,27 @@ export declare function query(query: Query, ...queryConstraints: QueryConstraint
|
|
|
1113
1295
|
* also contains this `QueryConstraint`.
|
|
1114
1296
|
*/
|
|
1115
1297
|
export declare abstract class QueryConstraint {
|
|
1116
|
-
|
|
1117
|
-
|
|
1298
|
+
/** The type of this query constraints */
|
|
1299
|
+
abstract readonly type: QueryConstraintType;
|
|
1118
1300
|
}
|
|
1301
|
+
|
|
1119
1302
|
/** Describes the different query constraints available in this SDK. */
|
|
1120
|
-
export declare type QueryConstraintType =
|
|
1303
|
+
export declare type QueryConstraintType =
|
|
1304
|
+
| 'endAt'
|
|
1305
|
+
| 'endBefore'
|
|
1306
|
+
| 'startAt'
|
|
1307
|
+
| 'startAfter'
|
|
1308
|
+
| 'limitToFirst'
|
|
1309
|
+
| 'limitToLast'
|
|
1310
|
+
| 'orderByChild'
|
|
1311
|
+
| 'orderByKey'
|
|
1312
|
+
| 'orderByPriority'
|
|
1313
|
+
| 'orderByValue'
|
|
1314
|
+
| 'equalTo';
|
|
1121
1315
|
/* Excluded from this release type: _QueryImpl */
|
|
1316
|
+
|
|
1122
1317
|
/* Excluded from this release type: _QueryParams */
|
|
1318
|
+
|
|
1123
1319
|
/**
|
|
1124
1320
|
*
|
|
1125
1321
|
* Returns a `Reference` representing the location in the Database
|
|
@@ -1135,7 +1331,9 @@ export declare type QueryConstraintType = 'endAt' | 'endBefore' | 'startAt' | 's
|
|
|
1135
1331
|
* root of the Database.
|
|
1136
1332
|
*/
|
|
1137
1333
|
export declare function ref(db: Database, path?: string): DatabaseReference;
|
|
1334
|
+
|
|
1138
1335
|
/* Excluded from this release type: _ReferenceImpl */
|
|
1336
|
+
|
|
1139
1337
|
/**
|
|
1140
1338
|
* Returns a `Reference` representing the location in the Database
|
|
1141
1339
|
* corresponding to the provided Firebase URL.
|
|
@@ -1152,7 +1350,11 @@ export declare function ref(db: Database, path?: string): DatabaseReference;
|
|
|
1152
1350
|
* @returns A `Reference` pointing to the provided
|
|
1153
1351
|
* Firebase URL.
|
|
1154
1352
|
*/
|
|
1155
|
-
export declare function refFromURL(
|
|
1353
|
+
export declare function refFromURL(
|
|
1354
|
+
db: Database,
|
|
1355
|
+
url: string
|
|
1356
|
+
): DatabaseReference;
|
|
1357
|
+
|
|
1156
1358
|
/**
|
|
1157
1359
|
* Removes the data at this Database location.
|
|
1158
1360
|
*
|
|
@@ -1169,6 +1371,7 @@ export declare function refFromURL(db: Database, url: string): DatabaseReference
|
|
|
1169
1371
|
*/
|
|
1170
1372
|
export declare function remove(ref: DatabaseReference): Promise<void>;
|
|
1171
1373
|
/* Excluded from this release type: _repoManagerDatabaseFromApp */
|
|
1374
|
+
|
|
1172
1375
|
/**
|
|
1173
1376
|
* Atomically modifies the data at this location.
|
|
1174
1377
|
*
|
|
@@ -1206,7 +1409,11 @@ export declare function remove(ref: DatabaseReference): Promise<void>;
|
|
|
1206
1409
|
* @returns A `Promise` that can optionally be used instead of the `onComplete`
|
|
1207
1410
|
* callback to handle success and failure.
|
|
1208
1411
|
*/
|
|
1209
|
-
export declare function runTransaction(
|
|
1412
|
+
export declare function runTransaction(
|
|
1413
|
+
ref: DatabaseReference,
|
|
1414
|
+
transactionUpdate: (currentData: any) => unknown,
|
|
1415
|
+
options?: TransactionOptions
|
|
1416
|
+
): Promise<TransactionResult>;
|
|
1210
1417
|
/**
|
|
1211
1418
|
* @license
|
|
1212
1419
|
* Copyright 2020 Google LLC
|
|
@@ -1229,6 +1436,7 @@ export declare function runTransaction(ref: DatabaseReference, transactionUpdate
|
|
|
1229
1436
|
* servers.
|
|
1230
1437
|
*/
|
|
1231
1438
|
export declare function serverTimestamp(): object;
|
|
1439
|
+
|
|
1232
1440
|
/**
|
|
1233
1441
|
* Writes data to this Database location.
|
|
1234
1442
|
*
|
|
@@ -1258,7 +1466,11 @@ export declare function serverTimestamp(): object;
|
|
|
1258
1466
|
* array, or null).
|
|
1259
1467
|
* @returns Resolves when write to server is complete.
|
|
1260
1468
|
*/
|
|
1261
|
-
export declare function set(
|
|
1469
|
+
export declare function set(
|
|
1470
|
+
ref: DatabaseReference,
|
|
1471
|
+
value: unknown
|
|
1472
|
+
): Promise<void>;
|
|
1473
|
+
|
|
1262
1474
|
/**
|
|
1263
1475
|
* Sets a priority for the data at this Database location.
|
|
1264
1476
|
*
|
|
@@ -1271,8 +1483,13 @@ export declare function set(ref: DatabaseReference, value: unknown): Promise<voi
|
|
|
1271
1483
|
* @param priority - The priority to be written (string, number, or null).
|
|
1272
1484
|
* @returns Resolves when write to server is complete.
|
|
1273
1485
|
*/
|
|
1274
|
-
export declare function setPriority(
|
|
1486
|
+
export declare function setPriority(
|
|
1487
|
+
ref: DatabaseReference,
|
|
1488
|
+
priority: string | number | null
|
|
1489
|
+
): Promise<void>;
|
|
1490
|
+
|
|
1275
1491
|
/* Excluded from this release type: _setSDKVersion */
|
|
1492
|
+
|
|
1276
1493
|
/**
|
|
1277
1494
|
* Writes data the Database location. Like `set()` but also specifies the
|
|
1278
1495
|
* priority for that data.
|
|
@@ -1288,7 +1505,11 @@ export declare function setPriority(ref: DatabaseReference, priority: string | n
|
|
|
1288
1505
|
* @param priority - The priority to be written (string, number, or null).
|
|
1289
1506
|
* @returns Resolves when write to server is complete.
|
|
1290
1507
|
*/
|
|
1291
|
-
export declare function setWithPriority(
|
|
1508
|
+
export declare function setWithPriority(
|
|
1509
|
+
ref: DatabaseReference,
|
|
1510
|
+
value: unknown,
|
|
1511
|
+
priority: string | number | null
|
|
1512
|
+
): Promise<void>;
|
|
1292
1513
|
/**
|
|
1293
1514
|
* Creates a `QueryConstraint` with the specified starting point (exclusive).
|
|
1294
1515
|
*
|
|
@@ -1307,7 +1528,11 @@ export declare function setWithPriority(ref: DatabaseReference, value: unknown,
|
|
|
1307
1528
|
* @param key - The child key to start after. This argument is only allowed if
|
|
1308
1529
|
* ordering by child, value, or priority.
|
|
1309
1530
|
*/
|
|
1310
|
-
export declare function startAfter(
|
|
1531
|
+
export declare function startAfter(
|
|
1532
|
+
value: number | string | boolean | null,
|
|
1533
|
+
key?: string
|
|
1534
|
+
): QueryConstraint;
|
|
1535
|
+
|
|
1311
1536
|
/**
|
|
1312
1537
|
* Creates a `QueryConstraint` with the specified starting point.
|
|
1313
1538
|
*
|
|
@@ -1330,42 +1555,53 @@ export declare function startAfter(value: number | string | boolean | null, key?
|
|
|
1330
1555
|
* @param key - The child key to start at. This argument is only allowed if
|
|
1331
1556
|
* ordering by child, value, or priority.
|
|
1332
1557
|
*/
|
|
1333
|
-
export declare function startAt(
|
|
1558
|
+
export declare function startAt(
|
|
1559
|
+
value?: number | string | boolean | null,
|
|
1560
|
+
key?: string
|
|
1561
|
+
): QueryConstraint;
|
|
1334
1562
|
/* Excluded from this release type: _TEST_ACCESS_forceRestClient */
|
|
1563
|
+
|
|
1335
1564
|
/* Excluded from this release type: _TEST_ACCESS_hijackHash */
|
|
1565
|
+
|
|
1336
1566
|
/**
|
|
1337
1567
|
* A `Promise` that can also act as a `DatabaseReference` when returned by
|
|
1338
1568
|
* {@link push}. The reference is available immediately and the `Promise` resolves
|
|
1339
1569
|
* as the write to the backend completes.
|
|
1340
1570
|
*/
|
|
1341
|
-
export declare interface ThenableReference
|
|
1342
|
-
|
|
1343
|
-
|
|
1571
|
+
export declare interface ThenableReference
|
|
1572
|
+
extends DatabaseReference,
|
|
1573
|
+
Pick<Promise<DatabaseReference>, 'then' | 'catch'> {
|
|
1574
|
+
key: string;
|
|
1575
|
+
parent: DatabaseReference;
|
|
1344
1576
|
}
|
|
1577
|
+
|
|
1345
1578
|
/** An options object to configure transactions. */
|
|
1346
1579
|
export declare interface TransactionOptions {
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1580
|
+
/**
|
|
1581
|
+
* By default, events are raised each time the transaction update function
|
|
1582
|
+
* runs. So if it is run multiple times, you may see intermediate states. You
|
|
1583
|
+
* can set this to false to suppress these intermediate states and instead
|
|
1584
|
+
* wait until the transaction has completed before events are raised.
|
|
1585
|
+
*/
|
|
1586
|
+
readonly applyLocally?: boolean;
|
|
1354
1587
|
}
|
|
1588
|
+
|
|
1355
1589
|
/**
|
|
1356
1590
|
* A type for the resolve value of {@link runTransaction}.
|
|
1357
1591
|
*/
|
|
1358
1592
|
export declare class TransactionResult {
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1593
|
+
/** Whether the transaction was successfully committed. */
|
|
1594
|
+
readonly committed: boolean;
|
|
1595
|
+
/** The resulting data snapshot. */
|
|
1596
|
+
readonly snapshot: DataSnapshot;
|
|
1597
|
+
/** Returns a JSON-serializable representation of this object. */
|
|
1598
|
+
toJSON(): object;
|
|
1599
|
+
private constructor();
|
|
1366
1600
|
}
|
|
1601
|
+
|
|
1367
1602
|
/** A callback that can invoked to remove a listener. */
|
|
1368
1603
|
export declare type Unsubscribe = () => void;
|
|
1604
|
+
|
|
1369
1605
|
/**
|
|
1370
1606
|
* Writes multiple values to the Database at once.
|
|
1371
1607
|
*
|
|
@@ -1401,5 +1637,14 @@ export declare type Unsubscribe = () => void;
|
|
|
1401
1637
|
* @param values - Object containing multiple values.
|
|
1402
1638
|
* @returns Resolves when update on server is complete.
|
|
1403
1639
|
*/
|
|
1404
|
-
export declare function update(
|
|
1640
|
+
export declare function update(
|
|
1641
|
+
ref: DatabaseReference,
|
|
1642
|
+
values: object
|
|
1643
|
+
): Promise<void>;
|
|
1644
|
+
|
|
1645
|
+
/* Excluded from this release type: _UserCallback */
|
|
1646
|
+
|
|
1647
|
+
/* Excluded from this release type: _validatePathString */
|
|
1648
|
+
|
|
1649
|
+
/* Excluded from this release type: _validateWritablePath */
|
|
1405
1650
|
export {};
|