@firebase/database 1.1.4 → 1.1.5
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/node-esm/index.node.esm.js +1 -1
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/public.d.ts +541 -297
- 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,119 @@ 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
|
}
|
|
201
214
|
export { EmulatorMockTokenOptions };
|
|
215
|
+
|
|
202
216
|
/**
|
|
203
217
|
* Logs debugging information to the console.
|
|
204
218
|
*
|
|
@@ -206,13 +220,20 @@ export { EmulatorMockTokenOptions };
|
|
|
206
220
|
* @param persistent - Remembers the logging state between page refreshes if
|
|
207
221
|
* `true`.
|
|
208
222
|
*/
|
|
209
|
-
export declare function enableLogging(
|
|
223
|
+
export declare function enableLogging(
|
|
224
|
+
enabled: boolean,
|
|
225
|
+
persistent?: boolean
|
|
226
|
+
): any;
|
|
227
|
+
|
|
210
228
|
/**
|
|
211
229
|
* Logs debugging information to the console.
|
|
212
230
|
*
|
|
213
231
|
* @param logger - A custom logger function to control how things get logged.
|
|
214
232
|
*/
|
|
215
|
-
export declare function enableLogging(
|
|
233
|
+
export declare function enableLogging(
|
|
234
|
+
logger: (message: string) => unknown
|
|
235
|
+
): any;
|
|
236
|
+
|
|
216
237
|
/**
|
|
217
238
|
* Creates a `QueryConstraint` with the specified ending point.
|
|
218
239
|
*
|
|
@@ -236,7 +257,11 @@ export declare function enableLogging(logger: (message: string) => unknown): any
|
|
|
236
257
|
* specified priority. This argument is only allowed if ordering by child,
|
|
237
258
|
* value, or priority.
|
|
238
259
|
*/
|
|
239
|
-
export declare function endAt(
|
|
260
|
+
export declare function endAt(
|
|
261
|
+
value: number | string | boolean | null,
|
|
262
|
+
key?: string
|
|
263
|
+
): QueryConstraint;
|
|
264
|
+
|
|
240
265
|
/**
|
|
241
266
|
* Creates a `QueryConstraint` with the specified ending point (exclusive).
|
|
242
267
|
*
|
|
@@ -256,7 +281,11 @@ export declare function endAt(value: number | string | boolean | null, key?: str
|
|
|
256
281
|
* previously specified priority. This argument is only allowed if ordering by
|
|
257
282
|
* child, value, or priority.
|
|
258
283
|
*/
|
|
259
|
-
export declare function endBefore(
|
|
284
|
+
export declare function endBefore(
|
|
285
|
+
value: number | string | boolean | null,
|
|
286
|
+
key?: string
|
|
287
|
+
): QueryConstraint;
|
|
288
|
+
|
|
260
289
|
/**
|
|
261
290
|
* Creates a `QueryConstraint` that includes children that match the specified
|
|
262
291
|
* value.
|
|
@@ -280,21 +309,33 @@ export declare function endBefore(value: number | string | boolean | null, key?:
|
|
|
280
309
|
* previously specified priority. This argument is only allowed if ordering by
|
|
281
310
|
* child, value, or priority.
|
|
282
311
|
*/
|
|
283
|
-
export declare function equalTo(
|
|
312
|
+
export declare function equalTo(
|
|
313
|
+
value: number | string | boolean | null,
|
|
314
|
+
key?: string
|
|
315
|
+
): QueryConstraint;
|
|
284
316
|
/**
|
|
285
317
|
* One of the following strings: "value", "child_added", "child_changed",
|
|
286
318
|
* "child_removed", or "child_moved."
|
|
287
319
|
*/
|
|
288
|
-
export declare type EventType =
|
|
320
|
+
export declare type EventType =
|
|
321
|
+
| 'value'
|
|
322
|
+
| 'child_added'
|
|
323
|
+
| 'child_changed'
|
|
324
|
+
| 'child_moved'
|
|
325
|
+
| 'child_removed';
|
|
326
|
+
|
|
289
327
|
/* Excluded from this release type: _FirebaseService */
|
|
328
|
+
|
|
290
329
|
/**
|
|
291
330
|
* Force the use of longPolling instead of websockets. This will be ignored if websocket protocol is used in databaseURL.
|
|
292
331
|
*/
|
|
293
332
|
export declare function forceLongPolling(): void;
|
|
333
|
+
|
|
294
334
|
/**
|
|
295
335
|
* Force the use of websockets instead of longPolling.
|
|
296
336
|
*/
|
|
297
337
|
export declare function forceWebSockets(): void;
|
|
338
|
+
|
|
298
339
|
/**
|
|
299
340
|
* Gets the most up-to-date result for this query.
|
|
300
341
|
*
|
|
@@ -304,6 +345,7 @@ export declare function forceWebSockets(): void;
|
|
|
304
345
|
* server is unreachable and there is nothing cached).
|
|
305
346
|
*/
|
|
306
347
|
export declare function get(query: Query): Promise<DataSnapshot>;
|
|
348
|
+
|
|
307
349
|
/**
|
|
308
350
|
* Returns the instance of the Realtime Database SDK that is associated with the provided
|
|
309
351
|
* {@link @firebase/app#FirebaseApp}. Initializes a new instance with default settings if
|
|
@@ -316,6 +358,7 @@ export declare function get(query: Query): Promise<DataSnapshot>;
|
|
|
316
358
|
* @returns The `Database` instance of the provided app.
|
|
317
359
|
*/
|
|
318
360
|
export declare function getDatabase(app?: FirebaseApp, url?: string): Database;
|
|
361
|
+
|
|
319
362
|
/**
|
|
320
363
|
* Disconnects from the server (all Database operations will be completed
|
|
321
364
|
* offline).
|
|
@@ -338,6 +381,7 @@ export declare function getDatabase(app?: FirebaseApp, url?: string): Database;
|
|
|
338
381
|
* @param db - The instance to disconnect.
|
|
339
382
|
*/
|
|
340
383
|
export declare function goOffline(db: Database): void;
|
|
384
|
+
|
|
341
385
|
/**
|
|
342
386
|
* Reconnects to the server and synchronizes the offline Database state
|
|
343
387
|
* with the server state.
|
|
@@ -359,12 +403,14 @@ export declare function goOnline(db: Database): void;
|
|
|
359
403
|
*/
|
|
360
404
|
export declare function increment(delta: number): object;
|
|
361
405
|
/* Excluded from this release type: _initStandalone */
|
|
406
|
+
|
|
362
407
|
/**
|
|
363
408
|
* Represents a child snapshot of a `Reference` that is being iterated over. The key will never be undefined.
|
|
364
409
|
*/
|
|
365
410
|
export declare interface IteratedDataSnapshot extends DataSnapshot {
|
|
366
|
-
|
|
411
|
+
key: string;
|
|
367
412
|
}
|
|
413
|
+
|
|
368
414
|
/**
|
|
369
415
|
* Creates a new `QueryConstraint` that if limited to the first specific number
|
|
370
416
|
* of children.
|
|
@@ -384,6 +430,7 @@ export declare interface IteratedDataSnapshot extends DataSnapshot {
|
|
|
384
430
|
* @param limit - The maximum number of nodes to include in this query.
|
|
385
431
|
*/
|
|
386
432
|
export declare function limitToFirst(limit: number): QueryConstraint;
|
|
433
|
+
|
|
387
434
|
/**
|
|
388
435
|
* Creates a new `QueryConstraint` that is limited to return only the last
|
|
389
436
|
* specified number of children.
|
|
@@ -403,11 +450,13 @@ export declare function limitToFirst(limit: number): QueryConstraint;
|
|
|
403
450
|
* @param limit - The maximum number of nodes to include in this query.
|
|
404
451
|
*/
|
|
405
452
|
export declare function limitToLast(limit: number): QueryConstraint;
|
|
453
|
+
|
|
406
454
|
/** An options objects that can be used to customize a listener. */
|
|
407
455
|
export declare interface ListenOptions {
|
|
408
|
-
|
|
409
|
-
|
|
456
|
+
/** Whether to remove the listener after its first invocation. */
|
|
457
|
+
readonly onlyOnce?: boolean;
|
|
410
458
|
}
|
|
459
|
+
|
|
411
460
|
/**
|
|
412
461
|
* Detaches a callback previously attached with the corresponding `on*()` (`onValue`, `onChildAdded`) listener.
|
|
413
462
|
* Note: This is not the recommended way to remove a listener. Instead, please use the returned callback function from
|
|
@@ -431,7 +480,15 @@ export declare interface ListenOptions {
|
|
|
431
480
|
* @param callback - The callback function that was passed to `on()` or
|
|
432
481
|
* `undefined` to remove all callbacks.
|
|
433
482
|
*/
|
|
434
|
-
export declare function off(
|
|
483
|
+
export declare function off(
|
|
484
|
+
query: Query,
|
|
485
|
+
eventType?: EventType,
|
|
486
|
+
callback?: (
|
|
487
|
+
snapshot: DataSnapshot,
|
|
488
|
+
previousChildName?: string | null
|
|
489
|
+
) => unknown
|
|
490
|
+
): void;
|
|
491
|
+
|
|
435
492
|
/**
|
|
436
493
|
* Listens for data changes at a particular location.
|
|
437
494
|
*
|
|
@@ -459,7 +516,15 @@ export declare function off(query: Query, eventType?: EventType, callback?: (sna
|
|
|
459
516
|
* occurred.
|
|
460
517
|
* @returns A function that can be invoked to remove the listener.
|
|
461
518
|
*/
|
|
462
|
-
export declare function onChildAdded(
|
|
519
|
+
export declare function onChildAdded(
|
|
520
|
+
query: Query,
|
|
521
|
+
callback: (
|
|
522
|
+
snapshot: DataSnapshot,
|
|
523
|
+
previousChildName?: string | null
|
|
524
|
+
) => unknown,
|
|
525
|
+
cancelCallback?: (error: Error) => unknown
|
|
526
|
+
): Unsubscribe;
|
|
527
|
+
|
|
463
528
|
/**
|
|
464
529
|
* Listens for data changes at a particular location.
|
|
465
530
|
*
|
|
@@ -484,7 +549,15 @@ export declare function onChildAdded(query: Query, callback: (snapshot: DataSnap
|
|
|
484
549
|
* then removes the listener after its first invocation.
|
|
485
550
|
* @returns A function that can be invoked to remove the listener.
|
|
486
551
|
*/
|
|
487
|
-
export declare function onChildAdded(
|
|
552
|
+
export declare function onChildAdded(
|
|
553
|
+
query: Query,
|
|
554
|
+
callback: (
|
|
555
|
+
snapshot: DataSnapshot,
|
|
556
|
+
previousChildName: string | null
|
|
557
|
+
) => unknown,
|
|
558
|
+
options: ListenOptions
|
|
559
|
+
): Unsubscribe;
|
|
560
|
+
|
|
488
561
|
/**
|
|
489
562
|
* Listens for data changes at a particular location.
|
|
490
563
|
*
|
|
@@ -514,7 +587,16 @@ export declare function onChildAdded(query: Query, callback: (snapshot: DataSnap
|
|
|
514
587
|
* then removes the listener after its first invocation.
|
|
515
588
|
* @returns A function that can be invoked to remove the listener.
|
|
516
589
|
*/
|
|
517
|
-
export declare function onChildAdded(
|
|
590
|
+
export declare function onChildAdded(
|
|
591
|
+
query: Query,
|
|
592
|
+
callback: (
|
|
593
|
+
snapshot: DataSnapshot,
|
|
594
|
+
previousChildName: string | null
|
|
595
|
+
) => unknown,
|
|
596
|
+
cancelCallback: (error: Error) => unknown,
|
|
597
|
+
options: ListenOptions
|
|
598
|
+
): Unsubscribe;
|
|
599
|
+
|
|
518
600
|
/**
|
|
519
601
|
* Listens for data changes at a particular location.
|
|
520
602
|
*
|
|
@@ -543,7 +625,15 @@ export declare function onChildAdded(query: Query, callback: (snapshot: DataSnap
|
|
|
543
625
|
* occurred.
|
|
544
626
|
* @returns A function that can be invoked to remove the listener.
|
|
545
627
|
*/
|
|
546
|
-
export declare function onChildChanged(
|
|
628
|
+
export declare function onChildChanged(
|
|
629
|
+
query: Query,
|
|
630
|
+
callback: (
|
|
631
|
+
snapshot: DataSnapshot,
|
|
632
|
+
previousChildName: string | null
|
|
633
|
+
) => unknown,
|
|
634
|
+
cancelCallback?: (error: Error) => unknown
|
|
635
|
+
): Unsubscribe;
|
|
636
|
+
|
|
547
637
|
/**
|
|
548
638
|
* Listens for data changes at a particular location.
|
|
549
639
|
*
|
|
@@ -569,7 +659,15 @@ export declare function onChildChanged(query: Query, callback: (snapshot: DataSn
|
|
|
569
659
|
* then removes the listener after its first invocation.
|
|
570
660
|
* @returns A function that can be invoked to remove the listener.
|
|
571
661
|
*/
|
|
572
|
-
export declare function onChildChanged(
|
|
662
|
+
export declare function onChildChanged(
|
|
663
|
+
query: Query,
|
|
664
|
+
callback: (
|
|
665
|
+
snapshot: DataSnapshot,
|
|
666
|
+
previousChildName: string | null
|
|
667
|
+
) => unknown,
|
|
668
|
+
options: ListenOptions
|
|
669
|
+
): Unsubscribe;
|
|
670
|
+
|
|
573
671
|
/**
|
|
574
672
|
* Listens for data changes at a particular location.
|
|
575
673
|
*
|
|
@@ -600,7 +698,16 @@ export declare function onChildChanged(query: Query, callback: (snapshot: DataSn
|
|
|
600
698
|
* then removes the listener after its first invocation.
|
|
601
699
|
* @returns A function that can be invoked to remove the listener.
|
|
602
700
|
*/
|
|
603
|
-
export declare function onChildChanged(
|
|
701
|
+
export declare function onChildChanged(
|
|
702
|
+
query: Query,
|
|
703
|
+
callback: (
|
|
704
|
+
snapshot: DataSnapshot,
|
|
705
|
+
previousChildName: string | null
|
|
706
|
+
) => unknown,
|
|
707
|
+
cancelCallback: (error: Error) => unknown,
|
|
708
|
+
options: ListenOptions
|
|
709
|
+
): Unsubscribe;
|
|
710
|
+
|
|
604
711
|
/**
|
|
605
712
|
* Listens for data changes at a particular location.
|
|
606
713
|
*
|
|
@@ -627,7 +734,15 @@ export declare function onChildChanged(query: Query, callback: (snapshot: DataSn
|
|
|
627
734
|
* occurred.
|
|
628
735
|
* @returns A function that can be invoked to remove the listener.
|
|
629
736
|
*/
|
|
630
|
-
export declare function onChildMoved(
|
|
737
|
+
export declare function onChildMoved(
|
|
738
|
+
query: Query,
|
|
739
|
+
callback: (
|
|
740
|
+
snapshot: DataSnapshot,
|
|
741
|
+
previousChildName: string | null
|
|
742
|
+
) => unknown,
|
|
743
|
+
cancelCallback?: (error: Error) => unknown
|
|
744
|
+
): Unsubscribe;
|
|
745
|
+
|
|
631
746
|
/**
|
|
632
747
|
* Listens for data changes at a particular location.
|
|
633
748
|
*
|
|
@@ -651,7 +766,15 @@ export declare function onChildMoved(query: Query, callback: (snapshot: DataSnap
|
|
|
651
766
|
* then removes the listener after its first invocation.
|
|
652
767
|
* @returns A function that can be invoked to remove the listener.
|
|
653
768
|
*/
|
|
654
|
-
export declare function onChildMoved(
|
|
769
|
+
export declare function onChildMoved(
|
|
770
|
+
query: Query,
|
|
771
|
+
callback: (
|
|
772
|
+
snapshot: DataSnapshot,
|
|
773
|
+
previousChildName: string | null
|
|
774
|
+
) => unknown,
|
|
775
|
+
options: ListenOptions
|
|
776
|
+
): Unsubscribe;
|
|
777
|
+
|
|
655
778
|
/**
|
|
656
779
|
* Listens for data changes at a particular location.
|
|
657
780
|
*
|
|
@@ -680,7 +803,16 @@ export declare function onChildMoved(query: Query, callback: (snapshot: DataSnap
|
|
|
680
803
|
* then removes the listener after its first invocation.
|
|
681
804
|
* @returns A function that can be invoked to remove the listener.
|
|
682
805
|
*/
|
|
683
|
-
export declare function onChildMoved(
|
|
806
|
+
export declare function onChildMoved(
|
|
807
|
+
query: Query,
|
|
808
|
+
callback: (
|
|
809
|
+
snapshot: DataSnapshot,
|
|
810
|
+
previousChildName: string | null
|
|
811
|
+
) => unknown,
|
|
812
|
+
cancelCallback: (error: Error) => unknown,
|
|
813
|
+
options: ListenOptions
|
|
814
|
+
): Unsubscribe;
|
|
815
|
+
|
|
684
816
|
/**
|
|
685
817
|
* Listens for data changes at a particular location.
|
|
686
818
|
*
|
|
@@ -711,7 +843,12 @@ export declare function onChildMoved(query: Query, callback: (snapshot: DataSnap
|
|
|
711
843
|
* occurred.
|
|
712
844
|
* @returns A function that can be invoked to remove the listener.
|
|
713
845
|
*/
|
|
714
|
-
export declare function onChildRemoved(
|
|
846
|
+
export declare function onChildRemoved(
|
|
847
|
+
query: Query,
|
|
848
|
+
callback: (snapshot: DataSnapshot) => unknown,
|
|
849
|
+
cancelCallback?: (error: Error) => unknown
|
|
850
|
+
): Unsubscribe;
|
|
851
|
+
|
|
715
852
|
/**
|
|
716
853
|
* Listens for data changes at a particular location.
|
|
717
854
|
*
|
|
@@ -739,7 +876,12 @@ export declare function onChildRemoved(query: Query, callback: (snapshot: DataSn
|
|
|
739
876
|
* then removes the listener after its first invocation.
|
|
740
877
|
* @returns A function that can be invoked to remove the listener.
|
|
741
878
|
*/
|
|
742
|
-
export declare function onChildRemoved(
|
|
879
|
+
export declare function onChildRemoved(
|
|
880
|
+
query: Query,
|
|
881
|
+
callback: (snapshot: DataSnapshot) => unknown,
|
|
882
|
+
options: ListenOptions
|
|
883
|
+
): Unsubscribe;
|
|
884
|
+
|
|
743
885
|
/**
|
|
744
886
|
* Listens for data changes at a particular location.
|
|
745
887
|
*
|
|
@@ -772,7 +914,13 @@ export declare function onChildRemoved(query: Query, callback: (snapshot: DataSn
|
|
|
772
914
|
* then removes the listener after its first invocation.
|
|
773
915
|
* @returns A function that can be invoked to remove the listener.
|
|
774
916
|
*/
|
|
775
|
-
export declare function onChildRemoved(
|
|
917
|
+
export declare function onChildRemoved(
|
|
918
|
+
query: Query,
|
|
919
|
+
callback: (snapshot: DataSnapshot) => unknown,
|
|
920
|
+
cancelCallback: (error: Error) => unknown,
|
|
921
|
+
options: ListenOptions
|
|
922
|
+
): Unsubscribe;
|
|
923
|
+
|
|
776
924
|
/**
|
|
777
925
|
* The `onDisconnect` class allows you to write or clear data when your client
|
|
778
926
|
* disconnects from the Database server. These updates occur whether your
|
|
@@ -794,74 +942,78 @@ export declare function onChildRemoved(query: Query, callback: (snapshot: DataSn
|
|
|
794
942
|
* the `onDisconnect` operations each time you reconnect.
|
|
795
943
|
*/
|
|
796
944
|
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
|
-
|
|
945
|
+
/**
|
|
946
|
+
* Cancels all previously queued `onDisconnect()` set or update events for this
|
|
947
|
+
* location and all children.
|
|
948
|
+
*
|
|
949
|
+
* If a write has been queued for this location via a `set()` or `update()` at a
|
|
950
|
+
* parent location, the write at this location will be canceled, though writes
|
|
951
|
+
* to sibling locations will still occur.
|
|
952
|
+
*
|
|
953
|
+
* @returns Resolves when synchronization to the server is complete.
|
|
954
|
+
*/
|
|
955
|
+
cancel(): Promise<void>;
|
|
956
|
+
/**
|
|
957
|
+
* Ensures the data at this location is deleted when the client is disconnected
|
|
958
|
+
* (due to closing the browser, navigating to a new page, or network issues).
|
|
959
|
+
*
|
|
960
|
+
* @returns Resolves when synchronization to the server is complete.
|
|
961
|
+
*/
|
|
962
|
+
remove(): Promise<void>;
|
|
963
|
+
/**
|
|
964
|
+
* Ensures the data at this location is set to the specified value when the
|
|
965
|
+
* client is disconnected (due to closing the browser, navigating to a new page,
|
|
966
|
+
* or network issues).
|
|
967
|
+
*
|
|
968
|
+
* `set()` is especially useful for implementing "presence" systems, where a
|
|
969
|
+
* value should be changed or cleared when a user disconnects so that they
|
|
970
|
+
* appear "offline" to other users. See
|
|
971
|
+
* {@link https://firebase.google.com/docs/database/web/offline-capabilities | Enabling Offline Capabilities in JavaScript}
|
|
972
|
+
* for more information.
|
|
973
|
+
*
|
|
974
|
+
* Note that `onDisconnect` operations are only triggered once. If you want an
|
|
975
|
+
* operation to occur each time a disconnect occurs, you'll need to re-establish
|
|
976
|
+
* the `onDisconnect` operations each time.
|
|
977
|
+
*
|
|
978
|
+
* @param value - The value to be written to this location on disconnect (can
|
|
979
|
+
* be an object, array, string, number, boolean, or null).
|
|
980
|
+
* @returns Resolves when synchronization to the Database is complete.
|
|
981
|
+
*/
|
|
982
|
+
set(value: unknown): Promise<void>;
|
|
983
|
+
/**
|
|
984
|
+
* Ensures the data at this location is set to the specified value and priority
|
|
985
|
+
* when the client is disconnected (due to closing the browser, navigating to a
|
|
986
|
+
* new page, or network issues).
|
|
987
|
+
*
|
|
988
|
+
* @param value - The value to be written to this location on disconnect (can
|
|
989
|
+
* be an object, array, string, number, boolean, or null).
|
|
990
|
+
* @param priority - The priority to be written (string, number, or null).
|
|
991
|
+
* @returns Resolves when synchronization to the Database is complete.
|
|
992
|
+
*/
|
|
993
|
+
setWithPriority(
|
|
994
|
+
value: unknown,
|
|
995
|
+
priority: number | string | null
|
|
996
|
+
): Promise<void>;
|
|
997
|
+
/**
|
|
998
|
+
* Writes multiple values at this location when the client is disconnected (due
|
|
999
|
+
* to closing the browser, navigating to a new page, or network issues).
|
|
1000
|
+
*
|
|
1001
|
+
* The `values` argument contains multiple property-value pairs that will be
|
|
1002
|
+
* written to the Database together. Each child property can either be a simple
|
|
1003
|
+
* property (for example, "name") or a relative path (for example, "name/first")
|
|
1004
|
+
* from the current location to the data to update.
|
|
1005
|
+
*
|
|
1006
|
+
* As opposed to the `set()` method, `update()` can be use to selectively update
|
|
1007
|
+
* only the referenced properties at the current location (instead of replacing
|
|
1008
|
+
* all the child properties at the current location).
|
|
1009
|
+
*
|
|
1010
|
+
* @param values - Object containing multiple values.
|
|
1011
|
+
* @returns Resolves when synchronization to the Database is complete.
|
|
1012
|
+
*/
|
|
1013
|
+
update(values: object): Promise<void>;
|
|
1014
|
+
private constructor();
|
|
864
1015
|
}
|
|
1016
|
+
|
|
865
1017
|
/**
|
|
866
1018
|
* Returns an `OnDisconnect` object - see
|
|
867
1019
|
* {@link https://firebase.google.com/docs/database/web/offline-capabilities | Enabling Offline Capabilities in JavaScript}
|
|
@@ -870,6 +1022,7 @@ export declare class OnDisconnect {
|
|
|
870
1022
|
* @param ref - The reference to add OnDisconnect triggers for.
|
|
871
1023
|
*/
|
|
872
1024
|
export declare function onDisconnect(ref: DatabaseReference): OnDisconnect;
|
|
1025
|
+
|
|
873
1026
|
/**
|
|
874
1027
|
* Listens for data changes at a particular location.
|
|
875
1028
|
*
|
|
@@ -896,7 +1049,12 @@ export declare function onDisconnect(ref: DatabaseReference): OnDisconnect;
|
|
|
896
1049
|
* occurred.
|
|
897
1050
|
* @returns A function that can be invoked to remove the listener.
|
|
898
1051
|
*/
|
|
899
|
-
export declare function onValue(
|
|
1052
|
+
export declare function onValue(
|
|
1053
|
+
query: Query,
|
|
1054
|
+
callback: (snapshot: DataSnapshot) => unknown,
|
|
1055
|
+
cancelCallback?: (error: Error) => unknown
|
|
1056
|
+
): Unsubscribe;
|
|
1057
|
+
|
|
900
1058
|
/**
|
|
901
1059
|
* Listens for data changes at a particular location.
|
|
902
1060
|
*
|
|
@@ -920,7 +1078,12 @@ export declare function onValue(query: Query, callback: (snapshot: DataSnapshot)
|
|
|
920
1078
|
* then removes the listener after its first invocation.
|
|
921
1079
|
* @returns A function that can be invoked to remove the listener.
|
|
922
1080
|
*/
|
|
923
|
-
export declare function onValue(
|
|
1081
|
+
export declare function onValue(
|
|
1082
|
+
query: Query,
|
|
1083
|
+
callback: (snapshot: DataSnapshot) => unknown,
|
|
1084
|
+
options: ListenOptions
|
|
1085
|
+
): Unsubscribe;
|
|
1086
|
+
|
|
924
1087
|
/**
|
|
925
1088
|
* Listens for data changes at a particular location.
|
|
926
1089
|
*
|
|
@@ -949,7 +1112,13 @@ export declare function onValue(query: Query, callback: (snapshot: DataSnapshot)
|
|
|
949
1112
|
* then removes the listener after its first invocation.
|
|
950
1113
|
* @returns A function that can be invoked to remove the listener.
|
|
951
1114
|
*/
|
|
952
|
-
export declare function onValue(
|
|
1115
|
+
export declare function onValue(
|
|
1116
|
+
query: Query,
|
|
1117
|
+
callback: (snapshot: DataSnapshot) => unknown,
|
|
1118
|
+
cancelCallback: (error: Error) => unknown,
|
|
1119
|
+
options: ListenOptions
|
|
1120
|
+
): Unsubscribe;
|
|
1121
|
+
|
|
953
1122
|
/**
|
|
954
1123
|
* Creates a new `QueryConstraint` that orders by the specified child key.
|
|
955
1124
|
*
|
|
@@ -968,6 +1137,7 @@ export declare function onValue(query: Query, callback: (snapshot: DataSnapshot)
|
|
|
968
1137
|
* @param path - The path to order by.
|
|
969
1138
|
*/
|
|
970
1139
|
export declare function orderByChild(path: string): QueryConstraint;
|
|
1140
|
+
|
|
971
1141
|
/**
|
|
972
1142
|
* Creates a new `QueryConstraint` that orders by the key.
|
|
973
1143
|
*
|
|
@@ -977,6 +1147,7 @@ export declare function orderByChild(path: string): QueryConstraint;
|
|
|
977
1147
|
* {@link https://firebase.google.com/docs/database/web/lists-of-data#sort_data | Sort data}.
|
|
978
1148
|
*/
|
|
979
1149
|
export declare function orderByKey(): QueryConstraint;
|
|
1150
|
+
|
|
980
1151
|
/**
|
|
981
1152
|
* Creates a new `QueryConstraint` that orders by priority.
|
|
982
1153
|
*
|
|
@@ -986,6 +1157,7 @@ export declare function orderByKey(): QueryConstraint;
|
|
|
986
1157
|
* for alternatives to priority.
|
|
987
1158
|
*/
|
|
988
1159
|
export declare function orderByPriority(): QueryConstraint;
|
|
1160
|
+
|
|
989
1161
|
/**
|
|
990
1162
|
* Creates a new `QueryConstraint` that orders by value.
|
|
991
1163
|
*
|
|
@@ -1019,7 +1191,11 @@ export declare function orderByValue(): QueryConstraint;
|
|
|
1019
1191
|
* @returns Combined `Promise` and `Reference`; resolves when write is complete,
|
|
1020
1192
|
* but can be used immediately as the `Reference` to the child location.
|
|
1021
1193
|
*/
|
|
1022
|
-
export declare function push(
|
|
1194
|
+
export declare function push(
|
|
1195
|
+
parent: DatabaseReference,
|
|
1196
|
+
value?: unknown
|
|
1197
|
+
): ThenableReference;
|
|
1198
|
+
|
|
1023
1199
|
/**
|
|
1024
1200
|
* @license
|
|
1025
1201
|
* Copyright 2021 Google LLC
|
|
@@ -1052,46 +1228,47 @@ export declare function push(parent: DatabaseReference, value?: unknown): Thenab
|
|
|
1052
1228
|
* for more information.
|
|
1053
1229
|
*/
|
|
1054
1230
|
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
|
-
|
|
1231
|
+
/** The `DatabaseReference` for the `Query`'s location. */
|
|
1232
|
+
readonly ref: DatabaseReference;
|
|
1233
|
+
/**
|
|
1234
|
+
* Returns whether or not the current and provided queries represent the same
|
|
1235
|
+
* location, have the same query parameters, and are from the same instance of
|
|
1236
|
+
* `FirebaseApp`.
|
|
1237
|
+
*
|
|
1238
|
+
* Two `DatabaseReference` objects are equivalent if they represent the same location
|
|
1239
|
+
* and are from the same instance of `FirebaseApp`.
|
|
1240
|
+
*
|
|
1241
|
+
* Two `Query` objects are equivalent if they represent the same location,
|
|
1242
|
+
* have the same query parameters, and are from the same instance of
|
|
1243
|
+
* `FirebaseApp`. Equivalent queries share the same sort order, limits, and
|
|
1244
|
+
* starting and ending points.
|
|
1245
|
+
*
|
|
1246
|
+
* @param other - The query to compare against.
|
|
1247
|
+
* @returns Whether or not the current and provided queries are equivalent.
|
|
1248
|
+
*/
|
|
1249
|
+
isEqual(other: Query | null): boolean;
|
|
1250
|
+
/**
|
|
1251
|
+
* Returns a JSON-serializable representation of this object.
|
|
1252
|
+
*
|
|
1253
|
+
* @returns A JSON-serializable representation of this object.
|
|
1254
|
+
*/
|
|
1255
|
+
toJSON(): string;
|
|
1256
|
+
/**
|
|
1257
|
+
* Gets the absolute URL for this location.
|
|
1258
|
+
*
|
|
1259
|
+
* The `toString()` method returns a URL that is ready to be put into a
|
|
1260
|
+
* browser, curl command, or a `refFromURL()` call. Since all of those expect
|
|
1261
|
+
* the URL to be url-encoded, `toString()` returns an encoded URL.
|
|
1262
|
+
*
|
|
1263
|
+
* Append '.json' to the returned URL when typed into a browser to download
|
|
1264
|
+
* JSON-formatted data. If the location is secured (that is, not publicly
|
|
1265
|
+
* readable), you will get a permission-denied error.
|
|
1266
|
+
*
|
|
1267
|
+
* @returns The absolute URL for this location.
|
|
1268
|
+
*/
|
|
1269
|
+
toString(): string;
|
|
1094
1270
|
}
|
|
1271
|
+
|
|
1095
1272
|
/**
|
|
1096
1273
|
* Creates a new immutable instance of `Query` that is extended to also include
|
|
1097
1274
|
* additional query constraints.
|
|
@@ -1101,7 +1278,11 @@ export declare interface Query {
|
|
|
1101
1278
|
* @throws if any of the provided query constraints cannot be combined with the
|
|
1102
1279
|
* existing or new constraints.
|
|
1103
1280
|
*/
|
|
1104
|
-
export declare function query(
|
|
1281
|
+
export declare function query(
|
|
1282
|
+
query: Query,
|
|
1283
|
+
...queryConstraints: QueryConstraint[]
|
|
1284
|
+
): Query;
|
|
1285
|
+
|
|
1105
1286
|
/**
|
|
1106
1287
|
* A `QueryConstraint` is used to narrow the set of documents returned by a
|
|
1107
1288
|
* Database query. `QueryConstraint`s are created by invoking {@link endAt},
|
|
@@ -1113,13 +1294,27 @@ export declare function query(query: Query, ...queryConstraints: QueryConstraint
|
|
|
1113
1294
|
* also contains this `QueryConstraint`.
|
|
1114
1295
|
*/
|
|
1115
1296
|
export declare abstract class QueryConstraint {
|
|
1116
|
-
|
|
1117
|
-
|
|
1297
|
+
/** The type of this query constraints */
|
|
1298
|
+
abstract readonly type: QueryConstraintType;
|
|
1118
1299
|
}
|
|
1300
|
+
|
|
1119
1301
|
/** Describes the different query constraints available in this SDK. */
|
|
1120
|
-
export declare type QueryConstraintType =
|
|
1302
|
+
export declare type QueryConstraintType =
|
|
1303
|
+
| 'endAt'
|
|
1304
|
+
| 'endBefore'
|
|
1305
|
+
| 'startAt'
|
|
1306
|
+
| 'startAfter'
|
|
1307
|
+
| 'limitToFirst'
|
|
1308
|
+
| 'limitToLast'
|
|
1309
|
+
| 'orderByChild'
|
|
1310
|
+
| 'orderByKey'
|
|
1311
|
+
| 'orderByPriority'
|
|
1312
|
+
| 'orderByValue'
|
|
1313
|
+
| 'equalTo';
|
|
1121
1314
|
/* Excluded from this release type: _QueryImpl */
|
|
1315
|
+
|
|
1122
1316
|
/* Excluded from this release type: _QueryParams */
|
|
1317
|
+
|
|
1123
1318
|
/**
|
|
1124
1319
|
*
|
|
1125
1320
|
* Returns a `Reference` representing the location in the Database
|
|
@@ -1135,7 +1330,9 @@ export declare type QueryConstraintType = 'endAt' | 'endBefore' | 'startAt' | 's
|
|
|
1135
1330
|
* root of the Database.
|
|
1136
1331
|
*/
|
|
1137
1332
|
export declare function ref(db: Database, path?: string): DatabaseReference;
|
|
1333
|
+
|
|
1138
1334
|
/* Excluded from this release type: _ReferenceImpl */
|
|
1335
|
+
|
|
1139
1336
|
/**
|
|
1140
1337
|
* Returns a `Reference` representing the location in the Database
|
|
1141
1338
|
* corresponding to the provided Firebase URL.
|
|
@@ -1152,7 +1349,11 @@ export declare function ref(db: Database, path?: string): DatabaseReference;
|
|
|
1152
1349
|
* @returns A `Reference` pointing to the provided
|
|
1153
1350
|
* Firebase URL.
|
|
1154
1351
|
*/
|
|
1155
|
-
export declare function refFromURL(
|
|
1352
|
+
export declare function refFromURL(
|
|
1353
|
+
db: Database,
|
|
1354
|
+
url: string
|
|
1355
|
+
): DatabaseReference;
|
|
1356
|
+
|
|
1156
1357
|
/**
|
|
1157
1358
|
* Removes the data at this Database location.
|
|
1158
1359
|
*
|
|
@@ -1169,6 +1370,7 @@ export declare function refFromURL(db: Database, url: string): DatabaseReference
|
|
|
1169
1370
|
*/
|
|
1170
1371
|
export declare function remove(ref: DatabaseReference): Promise<void>;
|
|
1171
1372
|
/* Excluded from this release type: _repoManagerDatabaseFromApp */
|
|
1373
|
+
|
|
1172
1374
|
/**
|
|
1173
1375
|
* Atomically modifies the data at this location.
|
|
1174
1376
|
*
|
|
@@ -1206,7 +1408,11 @@ export declare function remove(ref: DatabaseReference): Promise<void>;
|
|
|
1206
1408
|
* @returns A `Promise` that can optionally be used instead of the `onComplete`
|
|
1207
1409
|
* callback to handle success and failure.
|
|
1208
1410
|
*/
|
|
1209
|
-
export declare function runTransaction(
|
|
1411
|
+
export declare function runTransaction(
|
|
1412
|
+
ref: DatabaseReference,
|
|
1413
|
+
transactionUpdate: (currentData: any) => unknown,
|
|
1414
|
+
options?: TransactionOptions
|
|
1415
|
+
): Promise<TransactionResult>;
|
|
1210
1416
|
/**
|
|
1211
1417
|
* @license
|
|
1212
1418
|
* Copyright 2020 Google LLC
|
|
@@ -1229,6 +1435,7 @@ export declare function runTransaction(ref: DatabaseReference, transactionUpdate
|
|
|
1229
1435
|
* servers.
|
|
1230
1436
|
*/
|
|
1231
1437
|
export declare function serverTimestamp(): object;
|
|
1438
|
+
|
|
1232
1439
|
/**
|
|
1233
1440
|
* Writes data to this Database location.
|
|
1234
1441
|
*
|
|
@@ -1258,7 +1465,11 @@ export declare function serverTimestamp(): object;
|
|
|
1258
1465
|
* array, or null).
|
|
1259
1466
|
* @returns Resolves when write to server is complete.
|
|
1260
1467
|
*/
|
|
1261
|
-
export declare function set(
|
|
1468
|
+
export declare function set(
|
|
1469
|
+
ref: DatabaseReference,
|
|
1470
|
+
value: unknown
|
|
1471
|
+
): Promise<void>;
|
|
1472
|
+
|
|
1262
1473
|
/**
|
|
1263
1474
|
* Sets a priority for the data at this Database location.
|
|
1264
1475
|
*
|
|
@@ -1271,8 +1482,13 @@ export declare function set(ref: DatabaseReference, value: unknown): Promise<voi
|
|
|
1271
1482
|
* @param priority - The priority to be written (string, number, or null).
|
|
1272
1483
|
* @returns Resolves when write to server is complete.
|
|
1273
1484
|
*/
|
|
1274
|
-
export declare function setPriority(
|
|
1485
|
+
export declare function setPriority(
|
|
1486
|
+
ref: DatabaseReference,
|
|
1487
|
+
priority: string | number | null
|
|
1488
|
+
): Promise<void>;
|
|
1489
|
+
|
|
1275
1490
|
/* Excluded from this release type: _setSDKVersion */
|
|
1491
|
+
|
|
1276
1492
|
/**
|
|
1277
1493
|
* Writes data the Database location. Like `set()` but also specifies the
|
|
1278
1494
|
* priority for that data.
|
|
@@ -1288,7 +1504,11 @@ export declare function setPriority(ref: DatabaseReference, priority: string | n
|
|
|
1288
1504
|
* @param priority - The priority to be written (string, number, or null).
|
|
1289
1505
|
* @returns Resolves when write to server is complete.
|
|
1290
1506
|
*/
|
|
1291
|
-
export declare function setWithPriority(
|
|
1507
|
+
export declare function setWithPriority(
|
|
1508
|
+
ref: DatabaseReference,
|
|
1509
|
+
value: unknown,
|
|
1510
|
+
priority: string | number | null
|
|
1511
|
+
): Promise<void>;
|
|
1292
1512
|
/**
|
|
1293
1513
|
* Creates a `QueryConstraint` with the specified starting point (exclusive).
|
|
1294
1514
|
*
|
|
@@ -1307,7 +1527,11 @@ export declare function setWithPriority(ref: DatabaseReference, value: unknown,
|
|
|
1307
1527
|
* @param key - The child key to start after. This argument is only allowed if
|
|
1308
1528
|
* ordering by child, value, or priority.
|
|
1309
1529
|
*/
|
|
1310
|
-
export declare function startAfter(
|
|
1530
|
+
export declare function startAfter(
|
|
1531
|
+
value: number | string | boolean | null,
|
|
1532
|
+
key?: string
|
|
1533
|
+
): QueryConstraint;
|
|
1534
|
+
|
|
1311
1535
|
/**
|
|
1312
1536
|
* Creates a `QueryConstraint` with the specified starting point.
|
|
1313
1537
|
*
|
|
@@ -1330,42 +1554,53 @@ export declare function startAfter(value: number | string | boolean | null, key?
|
|
|
1330
1554
|
* @param key - The child key to start at. This argument is only allowed if
|
|
1331
1555
|
* ordering by child, value, or priority.
|
|
1332
1556
|
*/
|
|
1333
|
-
export declare function startAt(
|
|
1557
|
+
export declare function startAt(
|
|
1558
|
+
value?: number | string | boolean | null,
|
|
1559
|
+
key?: string
|
|
1560
|
+
): QueryConstraint;
|
|
1334
1561
|
/* Excluded from this release type: _TEST_ACCESS_forceRestClient */
|
|
1562
|
+
|
|
1335
1563
|
/* Excluded from this release type: _TEST_ACCESS_hijackHash */
|
|
1564
|
+
|
|
1336
1565
|
/**
|
|
1337
1566
|
* A `Promise` that can also act as a `DatabaseReference` when returned by
|
|
1338
1567
|
* {@link push}. The reference is available immediately and the `Promise` resolves
|
|
1339
1568
|
* as the write to the backend completes.
|
|
1340
1569
|
*/
|
|
1341
|
-
export declare interface ThenableReference
|
|
1342
|
-
|
|
1343
|
-
|
|
1570
|
+
export declare interface ThenableReference
|
|
1571
|
+
extends DatabaseReference,
|
|
1572
|
+
Pick<Promise<DatabaseReference>, 'then' | 'catch'> {
|
|
1573
|
+
key: string;
|
|
1574
|
+
parent: DatabaseReference;
|
|
1344
1575
|
}
|
|
1576
|
+
|
|
1345
1577
|
/** An options object to configure transactions. */
|
|
1346
1578
|
export declare interface TransactionOptions {
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1579
|
+
/**
|
|
1580
|
+
* By default, events are raised each time the transaction update function
|
|
1581
|
+
* runs. So if it is run multiple times, you may see intermediate states. You
|
|
1582
|
+
* can set this to false to suppress these intermediate states and instead
|
|
1583
|
+
* wait until the transaction has completed before events are raised.
|
|
1584
|
+
*/
|
|
1585
|
+
readonly applyLocally?: boolean;
|
|
1354
1586
|
}
|
|
1587
|
+
|
|
1355
1588
|
/**
|
|
1356
1589
|
* A type for the resolve value of {@link runTransaction}.
|
|
1357
1590
|
*/
|
|
1358
1591
|
export declare class TransactionResult {
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1592
|
+
/** Whether the transaction was successfully committed. */
|
|
1593
|
+
readonly committed: boolean;
|
|
1594
|
+
/** The resulting data snapshot. */
|
|
1595
|
+
readonly snapshot: DataSnapshot;
|
|
1596
|
+
/** Returns a JSON-serializable representation of this object. */
|
|
1597
|
+
toJSON(): object;
|
|
1598
|
+
private constructor();
|
|
1366
1599
|
}
|
|
1600
|
+
|
|
1367
1601
|
/** A callback that can invoked to remove a listener. */
|
|
1368
1602
|
export declare type Unsubscribe = () => void;
|
|
1603
|
+
|
|
1369
1604
|
/**
|
|
1370
1605
|
* Writes multiple values to the Database at once.
|
|
1371
1606
|
*
|
|
@@ -1401,5 +1636,14 @@ export declare type Unsubscribe = () => void;
|
|
|
1401
1636
|
* @param values - Object containing multiple values.
|
|
1402
1637
|
* @returns Resolves when update on server is complete.
|
|
1403
1638
|
*/
|
|
1404
|
-
export declare function update(
|
|
1639
|
+
export declare function update(
|
|
1640
|
+
ref: DatabaseReference,
|
|
1641
|
+
values: object
|
|
1642
|
+
): Promise<void>;
|
|
1643
|
+
|
|
1644
|
+
/* Excluded from this release type: _UserCallback */
|
|
1645
|
+
|
|
1646
|
+
/* Excluded from this release type: _validatePathString */
|
|
1647
|
+
|
|
1648
|
+
/* Excluded from this release type: _validateWritablePath */
|
|
1405
1649
|
export {};
|