@firebase/firestore 3.1.1 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/firestore/src/register.d.ts +1 -1
  3. package/dist/firestore/src/remote/persistent_stream.d.ts +5 -1
  4. package/dist/firestore/src/util/async_queue.d.ts +4 -2
  5. package/dist/index.esm2017.js +1055 -1047
  6. package/dist/index.esm2017.js.map +1 -1
  7. package/dist/index.esm5.js +1483 -1474
  8. package/dist/index.esm5.js.map +1 -1
  9. package/dist/index.node.cjs.js +7049 -9102
  10. package/dist/index.node.cjs.js.map +1 -1
  11. package/dist/{index.node.cjs.esm2017.js → index.node.mjs} +51 -20
  12. package/dist/index.node.mjs.map +1 -0
  13. package/dist/index.rn.js +534 -526
  14. package/dist/index.rn.js.map +1 -1
  15. package/dist/internal.d.ts +4 -2
  16. package/dist/lite/firestore/src/register.d.ts +1 -1
  17. package/dist/lite/firestore/src/remote/persistent_stream.d.ts +5 -1
  18. package/dist/lite/firestore/src/util/async_queue.d.ts +4 -2
  19. package/dist/lite/index.browser.esm2017.js +2 -2
  20. package/dist/lite/index.browser.esm2017.js.map +1 -1
  21. package/dist/lite/index.browser.esm5.js +2 -2
  22. package/dist/lite/index.browser.esm5.js.map +1 -1
  23. package/dist/lite/index.node.cjs.js +1804 -2261
  24. package/dist/lite/index.node.cjs.js.map +1 -1
  25. package/dist/lite/{index.node.esm2017.js → index.node.mjs} +3 -3
  26. package/dist/lite/index.node.mjs.map +1 -0
  27. package/dist/lite/index.rn.esm2017.js +2 -2
  28. package/dist/lite/index.rn.esm2017.js.map +1 -1
  29. package/dist/lite/internal.d.ts +4 -2
  30. package/dist/lite/packages/firestore/src/register.d.ts +1 -1
  31. package/dist/lite/packages/firestore/src/remote/persistent_stream.d.ts +5 -1
  32. package/dist/lite/packages/firestore/src/util/async_queue.d.ts +4 -2
  33. package/dist/lite/private.d.ts +4 -2
  34. package/dist/packages/firestore/dist/index.esm2017.d.ts +102 -102
  35. package/dist/packages/firestore/src/register.d.ts +1 -1
  36. package/dist/packages/firestore/src/remote/persistent_stream.d.ts +5 -1
  37. package/dist/packages/firestore/src/util/async_queue.d.ts +4 -2
  38. package/dist/private.d.ts +4 -2
  39. package/lite/package.json +1 -1
  40. package/package.json +15 -9
  41. package/dist/index.node.cjs.esm2017.js.map +0 -1
  42. package/dist/lite/firestore/dist/lite/index.node.esm2017.d.ts +0 -1195
  43. package/dist/lite/index.node.esm2017.js.map +0 -1
  44. package/dist/packages/firestore/dist/index.node.cjs.esm2017.d.ts +0 -1844
@@ -1,1844 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2020 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- /**
18
- * Converts Firestore's internal types to the JavaScript types that we expose
19
- * to the user.
20
- *
21
- * @internal
22
- */
23
- export class AbstractUserDataWriter {
24
- convertValue(value: any, serverTimestampBehavior?: string): any;
25
- convertObject(mapValue: any, serverTimestampBehavior: any): {};
26
- convertGeoPoint(value: any): GeoPoint;
27
- convertArray(arrayValue: any, serverTimestampBehavior: any): any;
28
- convertServerTimestamp(value: any, serverTimestampBehavior: any): any;
29
- convertTimestamp(value: any): Timestamp;
30
- convertDocumentKey(name: any, expectedDatabaseId: any): DocumentKey;
31
- }
32
- /**
33
- * @license
34
- * Copyright 2020 Google LLC
35
- *
36
- * Licensed under the Apache License, Version 2.0 (the "License");
37
- * you may not use this file except in compliance with the License.
38
- * You may obtain a copy of the License at
39
- *
40
- * http://www.apache.org/licenses/LICENSE-2.0
41
- *
42
- * Unless required by applicable law or agreed to in writing, software
43
- * distributed under the License is distributed on an "AS IS" BASIS,
44
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
45
- * See the License for the specific language governing permissions and
46
- * limitations under the License.
47
- */
48
- /**
49
- * An immutable object representing an array of bytes.
50
- */
51
- export class Bytes {
52
- /**
53
- * Creates a new `Bytes` object from the given Base64 string, converting it to
54
- * bytes.
55
- *
56
- * @param base64 - The Base64 string used to create the `Bytes` object.
57
- */
58
- static fromBase64String(base64: any): Bytes;
59
- /**
60
- * Creates a new `Bytes` object from the given Uint8Array.
61
- *
62
- * @param array - The Uint8Array used to create the `Bytes` object.
63
- */
64
- static fromUint8Array(array: any): Bytes;
65
- /** @hideconstructor */
66
- constructor(byteString: any);
67
- _byteString: any;
68
- /**
69
- * Returns the underlying bytes as a Base64-encoded string.
70
- *
71
- * @returns The Base64-encoded string created from the `Bytes` object.
72
- */
73
- toBase64(): any;
74
- /**
75
- * Returns the underlying bytes in a new `Uint8Array`.
76
- *
77
- * @returns The Uint8Array created from the `Bytes` object.
78
- */
79
- toUint8Array(): any;
80
- /**
81
- * Returns a string representation of the `Bytes` object.
82
- *
83
- * @returns A string representation of the `Bytes` object.
84
- */
85
- toString(): string;
86
- /**
87
- * Returns true if this `Bytes` object is equal to the provided one.
88
- *
89
- * @param other - The `Bytes` object to compare against.
90
- * @returns true if this `Bytes` object is equal to the provided one.
91
- */
92
- isEqual(other: any): any;
93
- }
94
- /**
95
- * Constant used to indicate the LRU garbage collection should be disabled.
96
- * Set this value as the `cacheSizeBytes` on the settings passed to the
97
- * {@link Firestore} instance.
98
- */
99
- export const CACHE_SIZE_UNLIMITED: -1;
100
- /**
101
- * A `CollectionReference` object can be used for adding documents, getting
102
- * document references, and querying for documents (using {@link query}).
103
- */
104
- export class CollectionReference extends Query {
105
- _path: any;
106
- /** The collection's identifier. */
107
- get id(): any;
108
- /**
109
- * A string representing the path of the referenced collection (relative
110
- * to the root of the database).
111
- */
112
- get path(): any;
113
- /**
114
- * A reference to the containing `DocumentReference` if this is a
115
- * subcollection. If this isn't a subcollection, the reference is null.
116
- */
117
- get parent(): DocumentReference | null;
118
- }
119
- /**
120
- * @license
121
- * Copyright 2020 Google LLC
122
- *
123
- * Licensed under the Apache License, Version 2.0 (the "License");
124
- * you may not use this file except in compliance with the License.
125
- * You may obtain a copy of the License at
126
- *
127
- * http://www.apache.org/licenses/LICENSE-2.0
128
- *
129
- * Unless required by applicable law or agreed to in writing, software
130
- * distributed under the License is distributed on an "AS IS" BASIS,
131
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
132
- * See the License for the specific language governing permissions and
133
- * limitations under the License.
134
- */
135
- /**
136
- * A `DocumentReference` refers to a document location in a Firestore database
137
- * and can be used to write, read, or listen to the location. The document at
138
- * the referenced location may or may not exist.
139
- */
140
- export class DocumentReference {
141
- /** @hideconstructor */
142
- constructor(firestore: any, converter: any, _key: any);
143
- converter: any;
144
- _key: any;
145
- /** The type of this Firestore reference. */
146
- type: string;
147
- firestore: any;
148
- get _path(): any;
149
- /**
150
- * The document's identifier within its collection.
151
- */
152
- get id(): any;
153
- /**
154
- * A string representing the path of the referenced document (relative
155
- * to the root of the database).
156
- */
157
- get path(): any;
158
- /**
159
- * The collection this `DocumentReference` belongs to.
160
- */
161
- get parent(): CollectionReference;
162
- withConverter(converter: any): DocumentReference;
163
- }
164
- /**
165
- * A `DocumentSnapshot` contains data read from a document in your Firestore
166
- * database. The data can be extracted with `.data()` or `.get(<field>)` to
167
- * get a specific field.
168
- *
169
- * For a `DocumentSnapshot` that points to a non-existing document, any data
170
- * access will return 'undefined'. You can use the `exists()` method to
171
- * explicitly verify a document's existence.
172
- */
173
- export class DocumentSnapshot extends DocumentSnapshot$1 {
174
- /** @hideconstructor protected */
175
- constructor(_firestore: any, userDataWriter: any, key: any, document: any, metadata: any, converter: any);
176
- _firestoreImpl: any;
177
- metadata: any;
178
- }
179
- /**
180
- * @license
181
- * Copyright 2020 Google LLC
182
- *
183
- * Licensed under the Apache License, Version 2.0 (the "License");
184
- * you may not use this file except in compliance with the License.
185
- * You may obtain a copy of the License at
186
- *
187
- * http://www.apache.org/licenses/LICENSE-2.0
188
- *
189
- * Unless required by applicable law or agreed to in writing, software
190
- * distributed under the License is distributed on an "AS IS" BASIS,
191
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
192
- * See the License for the specific language governing permissions and
193
- * limitations under the License.
194
- */
195
- /**
196
- * A `FieldPath` refers to a field in a document. The path may consist of a
197
- * single field name (referring to a top-level field in the document), or a
198
- * list of field names (referring to a nested field in the document).
199
- *
200
- * Create a `FieldPath` by providing field names. If more than one field
201
- * name is provided, the path will point to a nested field in a document.
202
- */
203
- export class FieldPath {
204
- /**
205
- * Creates a `FieldPath` from the provided field names. If more than one field
206
- * name is provided, the path will point to a nested field in a document.
207
- *
208
- * @param fieldNames - A list of field names.
209
- */
210
- constructor(...fieldNames: any[]);
211
- _internalPath: FieldPath$1;
212
- /**
213
- * Returns true if this `FieldPath` is equal to the provided one.
214
- *
215
- * @param other - The `FieldPath` to compare against.
216
- * @returns true if this `FieldPath` is equal to the provided one.
217
- */
218
- isEqual(other: any): boolean;
219
- }
220
- /**
221
- * @license
222
- * Copyright 2020 Google LLC
223
- *
224
- * Licensed under the Apache License, Version 2.0 (the "License");
225
- * you may not use this file except in compliance with the License.
226
- * You may obtain a copy of the License at
227
- *
228
- * http://www.apache.org/licenses/LICENSE-2.0
229
- *
230
- * Unless required by applicable law or agreed to in writing, software
231
- * distributed under the License is distributed on an "AS IS" BASIS,
232
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
233
- * See the License for the specific language governing permissions and
234
- * limitations under the License.
235
- */
236
- /**
237
- * Sentinel values that can be used when writing document fields with `set()`
238
- * or `update()`.
239
- */
240
- export class FieldValue {
241
- /**
242
- * @param _methodName - The public API endpoint that returns this class.
243
- * @hideconstructor
244
- */
245
- constructor(_methodName: any);
246
- _methodName: any;
247
- }
248
- /**
249
- * The Cloud Firestore service interface.
250
- *
251
- * Do not call this constructor directly. Instead, use {@link getFirestore}.
252
- */
253
- export class Firestore extends Firestore$1 {
254
- _queue: AsyncQueueImpl;
255
- }
256
- /** An error returned by a Firestore operation. */
257
- export class FirestoreError extends Error {
258
- /** @hideconstructor */
259
- constructor(code: any, message: any);
260
- code: any;
261
- }
262
- /**
263
- * @license
264
- * Copyright 2017 Google LLC
265
- *
266
- * Licensed under the Apache License, Version 2.0 (the "License");
267
- * you may not use this file except in compliance with the License.
268
- * You may obtain a copy of the License at
269
- *
270
- * http://www.apache.org/licenses/LICENSE-2.0
271
- *
272
- * Unless required by applicable law or agreed to in writing, software
273
- * distributed under the License is distributed on an "AS IS" BASIS,
274
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
275
- * See the License for the specific language governing permissions and
276
- * limitations under the License.
277
- */
278
- /**
279
- * An immutable object representing a geographic location in Firestore. The
280
- * location is represented as latitude/longitude pair.
281
- *
282
- * Latitude values are in the range of [-90, 90].
283
- * Longitude values are in the range of [-180, 180].
284
- */
285
- export class GeoPoint {
286
- /**
287
- * Creates a new immutable `GeoPoint` object with the provided latitude and
288
- * longitude values.
289
- * @param latitude - The latitude as number between -90 and 90.
290
- * @param longitude - The longitude as number between -180 and 180.
291
- */
292
- constructor(latitude: any, longitude: any);
293
- _lat: any;
294
- _long: any;
295
- /**
296
- * The latitude of this `GeoPoint` instance.
297
- */
298
- get latitude(): any;
299
- /**
300
- * The longitude of this `GeoPoint` instance.
301
- */
302
- get longitude(): any;
303
- /**
304
- * Returns true if this `GeoPoint` is equal to the provided one.
305
- *
306
- * @param other - The `GeoPoint` to compare against.
307
- * @returns true if this `GeoPoint` is equal to the provided one.
308
- */
309
- isEqual(other: any): boolean;
310
- /** Returns a JSON-serializable representation of this GeoPoint. */
311
- toJSON(): {
312
- latitude: any;
313
- longitude: any;
314
- };
315
- /**
316
- * Actually private to JS consumers of our API, so this function is prefixed
317
- * with an underscore.
318
- */
319
- _compareTo(other: any): 0 | 1 | -1;
320
- }
321
- /**
322
- * @license
323
- * Copyright 2020 Google LLC
324
- *
325
- * Licensed under the Apache License, Version 2.0 (the "License");
326
- * you may not use this file except in compliance with the License.
327
- * You may obtain a copy of the License at
328
- *
329
- * http://www.apache.org/licenses/LICENSE-2.0
330
- *
331
- * Unless required by applicable law or agreed to in writing, software
332
- * distributed under the License is distributed on an "AS IS" BASIS,
333
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
334
- * See the License for the specific language governing permissions and
335
- * limitations under the License.
336
- */
337
- /**
338
- * Represents the task of loading a Firestore bundle. It provides progress of bundle
339
- * loading, as well as task completion and error events.
340
- *
341
- * The API is compatible with `Promise<LoadBundleTaskProgress>`.
342
- */
343
- export class LoadBundleTask {
344
- _progressObserver: {};
345
- _taskCompletionResolver: Deferred;
346
- _lastProgress: {
347
- taskState: string;
348
- totalBytes: number;
349
- totalDocuments: number;
350
- bytesLoaded: number;
351
- documentsLoaded: number;
352
- };
353
- /**
354
- * Registers functions to listen to bundle loading progress events.
355
- * @param next - Called when there is a progress update from bundle loading. Typically `next` calls occur
356
- * each time a Firestore document is loaded from the bundle.
357
- * @param error - Called when an error occurs during bundle loading. The task aborts after reporting the
358
- * error, and there should be no more updates after this.
359
- * @param complete - Called when the loading task is complete.
360
- */
361
- onProgress(next: any, error: any, complete: any): void;
362
- /**
363
- * Implements the `Promise<LoadBundleTaskProgress>.catch` interface.
364
- *
365
- * @param onRejected - Called when an error occurs during bundle loading.
366
- */
367
- catch(onRejected: any): Promise<any>;
368
- /**
369
- * Implements the `Promise<LoadBundleTaskProgress>.then` interface.
370
- *
371
- * @param onFulfilled - Called on the completion of the loading task with a final `LoadBundleTaskProgress` update.
372
- * The update will always have its `taskState` set to `"Success"`.
373
- * @param onRejected - Called when an error occurs during bundle loading.
374
- */
375
- then(onFulfilled: any, onRejected: any): Promise<any>;
376
- /**
377
- * Notifies all observers that bundle loading has completed, with a provided
378
- * `LoadBundleTaskProgress` object.
379
- *
380
- * @private
381
- */
382
- private _completeWith;
383
- /**
384
- * Notifies all observers that bundle loading has failed, with a provided
385
- * `Error` as the reason.
386
- *
387
- * @private
388
- */
389
- private _failWith;
390
- /**
391
- * Notifies a progress update of loading a bundle.
392
- * @param progress - The new progress.
393
- *
394
- * @private
395
- */
396
- private _updateProgress;
397
- }
398
- /**
399
- * A `Query` refers to a query which you can read or listen to. You can also
400
- * construct refined `Query` objects by adding filters and ordering.
401
- */
402
- export class Query {
403
- /** @hideconstructor protected */
404
- constructor(firestore: any, converter: any, _query: any);
405
- converter: any;
406
- _query: any;
407
- /** The type of this Firestore reference. */
408
- type: string;
409
- firestore: any;
410
- withConverter(converter: any): Query;
411
- }
412
- /**
413
- * A `QueryConstraint` is used to narrow the set of documents returned by a
414
- * Firestore query. `QueryConstraint`s are created by invoking {@link where},
415
- * {@link orderBy}, {@link (startAt:1)}, {@link (startAfter:1)}, {@link
416
- * endBefore:1}, {@link (endAt:1)}, {@link limit} or {@link limitToLast} and
417
- * can then be passed to {@link query} to create a new query instance that
418
- * also contains this `QueryConstraint`.
419
- */
420
- export class QueryConstraint {
421
- }
422
- /**
423
- * A `QueryDocumentSnapshot` contains data read from a document in your
424
- * Firestore database as part of a query. The document is guaranteed to exist
425
- * and its data can be extracted with `.data()` or `.get(<field>)` to get a
426
- * specific field.
427
- *
428
- * A `QueryDocumentSnapshot` offers the same API surface as a
429
- * `DocumentSnapshot`. Since query results contain only existing documents, the
430
- * `exists` property will always be true and `data()` will never return
431
- * 'undefined'.
432
- */
433
- export class QueryDocumentSnapshot extends DocumentSnapshot {
434
- }
435
- /**
436
- * A `QuerySnapshot` contains zero or more `DocumentSnapshot` objects
437
- * representing the results of a query. The documents can be accessed as an
438
- * array via the `docs` property or enumerated using the `forEach` method. The
439
- * number of documents can be determined via the `empty` and `size`
440
- * properties.
441
- */
442
- export class QuerySnapshot {
443
- /** @hideconstructor */
444
- constructor(_firestore: any, _userDataWriter: any, query: any, _snapshot: any);
445
- _firestore: any;
446
- _userDataWriter: any;
447
- _snapshot: any;
448
- metadata: SnapshotMetadata;
449
- query: any;
450
- /** An array of all the documents in the `QuerySnapshot`. */
451
- get docs(): any[];
452
- /** The number of documents in the `QuerySnapshot`. */
453
- get size(): any;
454
- /** True if there are no documents in the `QuerySnapshot`. */
455
- get empty(): boolean;
456
- /**
457
- * Enumerates all of the documents in the `QuerySnapshot`.
458
- *
459
- * @param callback - A callback to be called with a `QueryDocumentSnapshot` for
460
- * each document in the snapshot.
461
- * @param thisArg - The `this` binding for the callback.
462
- */
463
- forEach(callback: any, thisArg: any): void;
464
- /**
465
- * Returns an array of the documents changes since the last snapshot. If this
466
- * is the first snapshot, all documents will be in the list as 'added'
467
- * changes.
468
- *
469
- * @param options - `SnapshotListenOptions` that control whether metadata-only
470
- * changes (i.e. only `DocumentSnapshot.metadata` changed) should trigger
471
- * snapshot events.
472
- */
473
- docChanges(options?: {}): any;
474
- _cachedChanges: any;
475
- _cachedChangesIncludeMetadataChanges: any;
476
- }
477
- /**
478
- * @license
479
- * Copyright 2020 Google LLC
480
- *
481
- * Licensed under the Apache License, Version 2.0 (the "License");
482
- * you may not use this file except in compliance with the License.
483
- * You may obtain a copy of the License at
484
- *
485
- * http://www.apache.org/licenses/LICENSE-2.0
486
- *
487
- * Unless required by applicable law or agreed to in writing, software
488
- * distributed under the License is distributed on an "AS IS" BASIS,
489
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
490
- * See the License for the specific language governing permissions and
491
- * limitations under the License.
492
- */
493
- /**
494
- * Metadata about a snapshot, describing the state of the snapshot.
495
- */
496
- export class SnapshotMetadata {
497
- /** @hideconstructor */
498
- constructor(hasPendingWrites: any, fromCache: any);
499
- hasPendingWrites: any;
500
- fromCache: any;
501
- /**
502
- * Returns true if this `SnapshotMetadata` is equal to the provided one.
503
- *
504
- * @param other - The `SnapshotMetadata` to compare against.
505
- * @returns true if this `SnapshotMetadata` is equal to the provided one.
506
- */
507
- isEqual(other: any): boolean;
508
- }
509
- /**
510
- * A `Timestamp` represents a point in time independent of any time zone or
511
- * calendar, represented as seconds and fractions of seconds at nanosecond
512
- * resolution in UTC Epoch time.
513
- *
514
- * It is encoded using the Proleptic Gregorian Calendar which extends the
515
- * Gregorian calendar backwards to year one. It is encoded assuming all minutes
516
- * are 60 seconds long, i.e. leap seconds are "smeared" so that no leap second
517
- * table is needed for interpretation. Range is from 0001-01-01T00:00:00Z to
518
- * 9999-12-31T23:59:59.999999999Z.
519
- *
520
- * For examples and further specifications, refer to the
521
- * {@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | Timestamp definition}.
522
- */
523
- export class Timestamp {
524
- /**
525
- * Creates a new timestamp with the current date, with millisecond precision.
526
- *
527
- * @returns a new timestamp representing the current date.
528
- */
529
- static now(): Timestamp;
530
- /**
531
- * Creates a new timestamp from the given date.
532
- *
533
- * @param date - The date to initialize the `Timestamp` from.
534
- * @returns A new `Timestamp` representing the same point in time as the given
535
- * date.
536
- */
537
- static fromDate(date: any): Timestamp;
538
- /**
539
- * Creates a new timestamp from the given number of milliseconds.
540
- *
541
- * @param milliseconds - Number of milliseconds since Unix epoch
542
- * 1970-01-01T00:00:00Z.
543
- * @returns A new `Timestamp` representing the same point in time as the given
544
- * number of milliseconds.
545
- */
546
- static fromMillis(milliseconds: any): Timestamp;
547
- /**
548
- * Creates a new timestamp.
549
- *
550
- * @param seconds - The number of seconds of UTC time since Unix epoch
551
- * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
552
- * 9999-12-31T23:59:59Z inclusive.
553
- * @param nanoseconds - The non-negative fractions of a second at nanosecond
554
- * resolution. Negative second values with fractions must still have
555
- * non-negative nanoseconds values that count forward in time. Must be
556
- * from 0 to 999,999,999 inclusive.
557
- */
558
- constructor(seconds: any, nanoseconds: any);
559
- seconds: any;
560
- nanoseconds: any;
561
- /**
562
- * Converts a `Timestamp` to a JavaScript `Date` object. This conversion
563
- * causes a loss of precision since `Date` objects only support millisecond
564
- * precision.
565
- *
566
- * @returns JavaScript `Date` object representing the same point in time as
567
- * this `Timestamp`, with millisecond precision.
568
- */
569
- toDate(): Date;
570
- /**
571
- * Converts a `Timestamp` to a numeric timestamp (in milliseconds since
572
- * epoch). This operation causes a loss of precision.
573
- *
574
- * @returns The point in time corresponding to this timestamp, represented as
575
- * the number of milliseconds since Unix epoch 1970-01-01T00:00:00Z.
576
- */
577
- toMillis(): number;
578
- _compareTo(other: any): 0 | 1 | -1;
579
- /**
580
- * Returns true if this `Timestamp` is equal to the provided one.
581
- *
582
- * @param other - The `Timestamp` to compare against.
583
- * @returns true if this `Timestamp` is equal to the provided one.
584
- */
585
- isEqual(other: any): boolean;
586
- /** Returns a textual representation of this `Timestamp`. */
587
- toString(): string;
588
- /** Returns a JSON-serializable representation of this `Timestamp`. */
589
- toJSON(): {
590
- seconds: any;
591
- nanoseconds: any;
592
- };
593
- /**
594
- * Converts this object to a primitive string, which allows `Timestamp` objects
595
- * to be compared using the `>`, `<=`, `>=` and `>` operators.
596
- */
597
- valueOf(): string;
598
- }
599
- /**
600
- * @license
601
- * Copyright 2020 Google LLC
602
- *
603
- * Licensed under the Apache License, Version 2.0 (the "License");
604
- * you may not use this file except in compliance with the License.
605
- * You may obtain a copy of the License at
606
- *
607
- * http://www.apache.org/licenses/LICENSE-2.0
608
- *
609
- * Unless required by applicable law or agreed to in writing, software
610
- * distributed under the License is distributed on an "AS IS" BASIS,
611
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
612
- * See the License for the specific language governing permissions and
613
- * limitations under the License.
614
- */
615
- /**
616
- * A reference to a transaction.
617
- *
618
- * The `Transaction` object passed to a transaction's `updateFunction` provides
619
- * the methods to read and write data within the transaction context. See
620
- * {@link runTransaction}.
621
- */
622
- export class Transaction extends Transaction$1 {
623
- }
624
- /**
625
- * @license
626
- * Copyright 2020 Google LLC
627
- *
628
- * Licensed under the Apache License, Version 2.0 (the "License");
629
- * you may not use this file except in compliance with the License.
630
- * You may obtain a copy of the License at
631
- *
632
- * http://www.apache.org/licenses/LICENSE-2.0
633
- *
634
- * Unless required by applicable law or agreed to in writing, software
635
- * distributed under the License is distributed on an "AS IS" BASIS,
636
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
637
- * See the License for the specific language governing permissions and
638
- * limitations under the License.
639
- */
640
- /**
641
- * A write batch, used to perform multiple writes as a single atomic unit.
642
- *
643
- * A `WriteBatch` object can be acquired by calling {@link writeBatch}. It
644
- * provides methods for adding writes to the write batch. None of the writes
645
- * will be committed (or visible locally) until {@link WriteBatch.commit} is
646
- * called.
647
- */
648
- export class WriteBatch {
649
- /** @hideconstructor */
650
- constructor(_firestore: any, _commitHandler: any);
651
- _firestore: any;
652
- _commitHandler: any;
653
- _mutations: any[];
654
- _committed: boolean;
655
- _dataReader: UserDataReader;
656
- set(documentRef: any, data: any, options: any): WriteBatch;
657
- update(documentRef: any, fieldOrUpdateData: any, value: any, ...moreFieldsAndValues: any[]): WriteBatch;
658
- /**
659
- * Deletes the document referred to by the provided {@link DocumentReference}.
660
- *
661
- * @param documentRef - A reference to the document to be deleted.
662
- * @returns This `WriteBatch` instance. Used for chaining method calls.
663
- */
664
- delete(documentRef: any): WriteBatch;
665
- /**
666
- * Commits all of the writes in this write batch as a single atomic unit.
667
- *
668
- * The result of these writes will only be reflected in document reads that
669
- * occur after the returned promise resolves. If the client is offline, the
670
- * write fails. If you would like to see local modifications or buffer writes
671
- * until the client is online, use the full Firestore SDK.
672
- *
673
- * @returns A `Promise` resolved once all of the writes in the batch have been
674
- * successfully written to the backend as an atomic unit (note that it won't
675
- * resolve while you're offline).
676
- */
677
- commit(): any;
678
- _verifyNotCommitted(): void;
679
- }
680
- /**
681
- * Represents the database ID a Firestore client is associated with.
682
- * @internal
683
- */
684
- declare class DatabaseId {
685
- constructor(projectId: any, database: any);
686
- projectId: any;
687
- database: any;
688
- get isDefaultDatabase(): boolean;
689
- isEqual(other: any): boolean;
690
- }
691
- /**
692
- * @license
693
- * Copyright 2017 Google LLC
694
- *
695
- * Licensed under the Apache License, Version 2.0 (the "License");
696
- * you may not use this file except in compliance with the License.
697
- * You may obtain a copy of the License at
698
- *
699
- * http://www.apache.org/licenses/LICENSE-2.0
700
- *
701
- * Unless required by applicable law or agreed to in writing, software
702
- * distributed under the License is distributed on an "AS IS" BASIS,
703
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
704
- * See the License for the specific language governing permissions and
705
- * limitations under the License.
706
- */
707
- /**
708
- * @internal
709
- */
710
- declare class DocumentKey {
711
- static fromPath(path: any): DocumentKey;
712
- static fromName(name: any): DocumentKey;
713
- static comparator(k1: any, k2: any): 0 | 1 | -1;
714
- static isDocumentKey(path: any): boolean;
715
- /**
716
- * Creates and returns a new document key with the given segments.
717
- *
718
- * @param segments - The segments of the path to the document
719
- * @returns A new instance of DocumentKey
720
- */
721
- static fromSegments(segments: any): DocumentKey;
722
- constructor(path: any);
723
- path: any;
724
- /** Returns true if the document is in the specified collectionId. */
725
- hasCollectionId(collectionId: any): boolean;
726
- isEqual(other: any): boolean;
727
- toString(): any;
728
- }
729
- /**
730
- * A CredentialsProvider that always yields an empty token.
731
- * @internal
732
- */
733
- declare class EmptyCredentialsProvider {
734
- getToken(): Promise<null>;
735
- invalidateToken(): void;
736
- start(asyncQueue: any, changeListener: any): void;
737
- shutdown(): void;
738
- }
739
- /**
740
- * A dot-separated path for navigating sub-objects within a document.
741
- * @internal
742
- */
743
- declare class FieldPath$1 extends BasePath {
744
- /**
745
- * Returns true if the string could be used as a segment in a field path
746
- * without escaping.
747
- */
748
- static isValidIdentifier(segment: any): boolean;
749
- /**
750
- * The field designating the key of a document.
751
- */
752
- static keyField(): FieldPath$1;
753
- /**
754
- * Parses a field string from the given server-formatted string.
755
- *
756
- * - Splitting the empty string is not allowed (for now at least).
757
- * - Empty segments within the string (e.g. if there are two consecutive
758
- * separators) are not allowed.
759
- *
760
- * TODO(b/37244157): we should make this more strict. Right now, it allows
761
- * non-identifier path components, even if they aren't escaped.
762
- */
763
- static fromServerFormat(path: any): FieldPath$1;
764
- static emptyPath(): FieldPath$1;
765
- construct(segments: any, offset: any, length: any): FieldPath$1;
766
- canonicalString(): any;
767
- toString(): any;
768
- /**
769
- * Returns true if this field references the key of a document.
770
- */
771
- isKeyField(): boolean;
772
- }
773
- /**
774
- * Casts `obj` to `T`, optionally unwrapping Compat types to expose the
775
- * underlying instance. Throws if `obj` is not an instance of `T`.
776
- *
777
- * This cast is used in the Lite and Full SDK to verify instance types for
778
- * arguments passed to the public API.
779
- * @internal
780
- */
781
- declare function cast(obj: any, constructor: any): any;
782
- /**
783
- * Fails if the given assertion condition is false, throwing an Error with the
784
- * given message if it did.
785
- *
786
- * The code of callsites invoking this function are stripped out in production
787
- * builds. Any side-effects of code within the debugAssert() invocation will not
788
- * happen in this case.
789
- *
790
- * @internal
791
- */
792
- declare function debugAssert(assertion: any, message: any): void;
793
- /** True if and only if the Base64 conversion functions are available. */
794
- declare function isBase64Available(): boolean;
795
- /**
796
- * @internal
797
- */
798
- declare function logWarn(msg: any, ...obj: any[]): void;
799
- /**
800
- * Validates that two boolean options are not set at the same time.
801
- * @internal
802
- */
803
- declare function validateIsNotUsedTogether(optionName1: any, argument1: any, optionName2: any, argument2: any): void;
804
- /**
805
- * Add a new document to specified `CollectionReference` with the given data,
806
- * assigning it a document ID automatically.
807
- *
808
- * @param reference - A reference to the collection to add this document to.
809
- * @param data - An Object containing the data for the new document.
810
- * @returns A `Promise` resolved with a `DocumentReference` pointing to the
811
- * newly created document after it has been written to the backend (Note that it
812
- * won't resolve while you're offline).
813
- */
814
- export function addDoc(reference: any, data: any): Promise<DocumentReference>;
815
- /**
816
- * Returns a special value that can be used with {@link (setDoc:1)} or {@link
817
- * updateDoc:1} that tells the server to remove the given elements from any
818
- * array value that already exists on the server. All instances of each element
819
- * specified will be removed from the array. If the field being modified is not
820
- * already an array it will be overwritten with an empty array.
821
- *
822
- * @param elements - The elements to remove from the array.
823
- * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
824
- * `updateDoc()`
825
- */
826
- export function arrayRemove(...elements: any[]): ArrayRemoveFieldValueImpl;
827
- /**
828
- * Returns a special value that can be used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link
829
- * @firebase/firestore/lite#(updateDoc:1)} that tells the server to union the given elements with any array
830
- * value that already exists on the server. Each specified element that doesn't
831
- * already exist in the array will be added to the end. If the field being
832
- * modified is not already an array it will be overwritten with an array
833
- * containing exactly the specified elements.
834
- *
835
- * @param elements - The elements to union into the array.
836
- * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
837
- * `updateDoc()`.
838
- */
839
- export function arrayUnion(...elements: any[]): ArrayUnionFieldValueImpl;
840
- /**
841
- * Clears the persistent storage. This includes pending writes and cached
842
- * documents.
843
- *
844
- * Must be called while the {@link Firestore} instance is not started (after the app is
845
- * terminated or when the app is first initialized). On startup, this function
846
- * must be called before other functions (other than {@link
847
- * initializeFirestore} or {@link getFirestore})). If the {@link Firestore}
848
- * instance is still running, the promise will be rejected with the error code
849
- * of `failed-precondition`.
850
- *
851
- * Note: `clearIndexedDbPersistence()` is primarily intended to help write
852
- * reliable tests that use Cloud Firestore. It uses an efficient mechanism for
853
- * dropping existing data but does not attempt to securely overwrite or
854
- * otherwise make cached data unrecoverable. For applications that are sensitive
855
- * to the disclosure of cached data in between user sessions, we strongly
856
- * recommend not enabling persistence at all.
857
- *
858
- * @param firestore - The {@link Firestore} instance to clear persistence for.
859
- * @returns A `Promise` that is resolved when the persistent storage is
860
- * cleared. Otherwise, the promise is rejected with an error.
861
- */
862
- export function clearIndexedDbPersistence(firestore: any): Promise<any>;
863
- export function collection(parent: any, path: any, ...pathSegments: any[]): CollectionReference;
864
- /**
865
- * Creates and returns a new `Query` instance that includes all documents in the
866
- * database that are contained in a collection or subcollection with the
867
- * given `collectionId`.
868
- *
869
- * @param firestore - A reference to the root `Firestore` instance.
870
- * @param collectionId - Identifies the collections to query over. Every
871
- * collection or subcollection with this ID as the last segment of its path
872
- * will be included. Cannot contain a slash.
873
- * @returns The created `Query`.
874
- */
875
- export function collectionGroup(firestore: any, collectionId: any): Query;
876
- /**
877
- * Modify this instance to communicate with the Cloud Firestore emulator.
878
- *
879
- * Note: This must be called before this instance has been used to do any
880
- * operations.
881
- *
882
- * @param firestore - The `Firestore` instance to configure to connect to the
883
- * emulator.
884
- * @param host - the emulator host (ex: localhost).
885
- * @param port - the emulator port (ex: 9000).
886
- * @param options.mockUserToken - the mock auth token to use for unit testing
887
- * Security Rules.
888
- */
889
- export function connectFirestoreEmulator(firestore: any, host: any, port: any, options?: {}): void;
890
- /**
891
- * Deletes the document referred to by the specified `DocumentReference`.
892
- *
893
- * @param reference - A reference to the document to delete.
894
- * @returns A Promise resolved once the document has been successfully
895
- * deleted from the backend (note that it won't resolve while you're offline).
896
- */
897
- export function deleteDoc(reference: any): Promise<any>;
898
- /**
899
- * @license
900
- * Copyright 2020 Google LLC
901
- *
902
- * Licensed under the Apache License, Version 2.0 (the "License");
903
- * you may not use this file except in compliance with the License.
904
- * You may obtain a copy of the License at
905
- *
906
- * http://www.apache.org/licenses/LICENSE-2.0
907
- *
908
- * Unless required by applicable law or agreed to in writing, software
909
- * distributed under the License is distributed on an "AS IS" BASIS,
910
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
911
- * See the License for the specific language governing permissions and
912
- * limitations under the License.
913
- */
914
- /**
915
- * Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
916
- * {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
917
- */
918
- export function deleteField(): DeleteFieldValueImpl;
919
- /**
920
- * Disables network usage for this instance. It can be re-enabled via {@link
921
- * enableNetwork}. While the network is disabled, any snapshot listeners,
922
- * `getDoc()` or `getDocs()` calls will return results from cache, and any write
923
- * operations will be queued until the network is restored.
924
- *
925
- * @returns A `Promise` that is resolved once the network has been disabled.
926
- */
927
- export function disableNetwork(firestore: any): any;
928
- export function doc(parent: any, path: any, ...pathSegments: any[]): DocumentReference;
929
- /**
930
- * Returns a special sentinel `FieldPath` to refer to the ID of a document.
931
- * It can be used in queries to sort or filter by the document ID.
932
- */
933
- export function documentId(): FieldPath;
934
- /**
935
- * Attempts to enable persistent storage, if possible.
936
- *
937
- * Must be called before any other functions (other than
938
- * {@link initializeFirestore}, {@link getFirestore} or
939
- * {@link clearIndexedDbPersistence}.
940
- *
941
- * If this fails, `enableIndexedDbPersistence()` will reject the promise it
942
- * returns. Note that even after this failure, the {@link Firestore} instance will
943
- * remain usable, however offline persistence will be disabled.
944
- *
945
- * There are several reasons why this can fail, which can be identified by
946
- * the `code` on the error.
947
- *
948
- * * failed-precondition: The app is already open in another browser tab.
949
- * * unimplemented: The browser is incompatible with the offline
950
- * persistence implementation.
951
- *
952
- * @param firestore - The {@link Firestore} instance to enable persistence for.
953
- * @param persistenceSettings - Optional settings object to configure
954
- * persistence.
955
- * @returns A `Promise` that represents successfully enabling persistent storage.
956
- */
957
- export function enableIndexedDbPersistence(firestore: any, persistenceSettings: any): any;
958
- /**
959
- * Attempts to enable multi-tab persistent storage, if possible. If enabled
960
- * across all tabs, all operations share access to local persistence, including
961
- * shared execution of queries and latency-compensated local document updates
962
- * across all connected instances.
963
- *
964
- * If this fails, `enableMultiTabIndexedDbPersistence()` will reject the promise
965
- * it returns. Note that even after this failure, the {@link Firestore} instance will
966
- * remain usable, however offline persistence will be disabled.
967
- *
968
- * There are several reasons why this can fail, which can be identified by
969
- * the `code` on the error.
970
- *
971
- * * failed-precondition: The app is already open in another browser tab and
972
- * multi-tab is not enabled.
973
- * * unimplemented: The browser is incompatible with the offline
974
- * persistence implementation.
975
- *
976
- * @param firestore - The {@link Firestore} instance to enable persistence for.
977
- * @returns A `Promise` that represents successfully enabling persistent
978
- * storage.
979
- */
980
- export function enableMultiTabIndexedDbPersistence(firestore: any): any;
981
- /**
982
- * Re-enables use of the network for this {@link Firestore} instance after a prior
983
- * call to {@link disableNetwork}.
984
- *
985
- * @returns A `Promise` that is resolved once the network has been enabled.
986
- */
987
- export function enableNetwork(firestore: any): any;
988
- export function endAt(...docOrFields: any[]): QueryEndAtConstraint;
989
- export function endBefore(...docOrFields: any[]): QueryEndAtConstraint;
990
- /**
991
- * @internal
992
- */
993
- export function ensureFirestoreConfigured(firestore: any): any;
994
- /**
995
- * Locally writes `mutations` on the async queue.
996
- * @internal
997
- */
998
- export function executeWrite(firestore: any, mutations: any): Promise<any>;
999
- /**
1000
- * @license
1001
- * Copyright 2020 Google LLC
1002
- *
1003
- * Licensed under the Apache License, Version 2.0 (the "License");
1004
- * you may not use this file except in compliance with the License.
1005
- * You may obtain a copy of the License at
1006
- *
1007
- * http://www.apache.org/licenses/LICENSE-2.0
1008
- *
1009
- * Unless required by applicable law or agreed to in writing, software
1010
- * distributed under the License is distributed on an "AS IS" BASIS,
1011
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1012
- * See the License for the specific language governing permissions and
1013
- * limitations under the License.
1014
- */
1015
- /**
1016
- * Reads the document referred to by this `DocumentReference`.
1017
- *
1018
- * Note: `getDoc()` attempts to provide up-to-date data when possible by waiting
1019
- * for data from the server, but it may return cached data or fail if you are
1020
- * offline and the server cannot be reached. To specify this behavior, invoke
1021
- * {@link getDocFromCache} or {@link getDocFromServer}.
1022
- *
1023
- * @param reference - The reference of the document to fetch.
1024
- * @returns A Promise resolved with a `DocumentSnapshot` containing the
1025
- * current document contents.
1026
- */
1027
- export function getDoc(reference: any): Promise<DocumentSnapshot>;
1028
- /**
1029
- * Reads the document referred to by this `DocumentReference` from cache.
1030
- * Returns an error if the document is not currently cached.
1031
- *
1032
- * @returns A `Promise` resolved with a `DocumentSnapshot` containing the
1033
- * current document contents.
1034
- */
1035
- export function getDocFromCache(reference: any): Promise<DocumentSnapshot>;
1036
- /**
1037
- * Reads the document referred to by this `DocumentReference` from the server.
1038
- * Returns an error if the network is not available.
1039
- *
1040
- * @returns A `Promise` resolved with a `DocumentSnapshot` containing the
1041
- * current document contents.
1042
- */
1043
- export function getDocFromServer(reference: any): Promise<DocumentSnapshot>;
1044
- /**
1045
- * Executes the query and returns the results as a `QuerySnapshot`.
1046
- *
1047
- * Note: `getDocs()` attempts to provide up-to-date data when possible by
1048
- * waiting for data from the server, but it may return cached data or fail if
1049
- * you are offline and the server cannot be reached. To specify this behavior,
1050
- * invoke {@link getDocsFromCache} or {@link getDocsFromServer}.
1051
- *
1052
- * @returns A `Promise` that will be resolved with the results of the query.
1053
- */
1054
- export function getDocs(query: any): Promise<QuerySnapshot>;
1055
- /**
1056
- * Executes the query and returns the results as a `QuerySnapshot` from cache.
1057
- * Returns an error if the document is not currently cached.
1058
- *
1059
- * @returns A `Promise` that will be resolved with the results of the query.
1060
- */
1061
- export function getDocsFromCache(query: any): Promise<QuerySnapshot>;
1062
- /**
1063
- * Executes the query and returns the results as a `QuerySnapshot` from the
1064
- * server. Returns an error if the network is not available.
1065
- *
1066
- * @returns A `Promise` that will be resolved with the results of the query.
1067
- */
1068
- export function getDocsFromServer(query: any): Promise<QuerySnapshot>;
1069
- /**
1070
- * Returns the existing {@link Firestore} instance that is associated with the
1071
- * provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
1072
- * instance with default settings.
1073
- *
1074
- * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
1075
- * instance is associated with.
1076
- * @returns The {@link Firestore} instance of the provided app.
1077
- */
1078
- export function getFirestore(app?: import("@firebase/app").FirebaseApp): import("../src").Firestore;
1079
- /**
1080
- * Returns a special value that can be used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link
1081
- * @firebase/firestore/lite#(updateDoc:1)} that tells the server to increment the field's current value by
1082
- * the given value.
1083
- *
1084
- * If either the operand or the current field value uses floating point
1085
- * precision, all arithmetic follows IEEE 754 semantics. If both values are
1086
- * integers, values outside of JavaScript's safe number range
1087
- * (`Number.MIN_SAFE_INTEGER` to `Number.MAX_SAFE_INTEGER`) are also subject to
1088
- * precision loss. Furthermore, once processed by the Firestore backend, all
1089
- * integer operations are capped between -2^63 and 2^63-1.
1090
- *
1091
- * If the current field value is not of type `number`, or if the field does not
1092
- * yet exist, the transformation sets the field to the given value.
1093
- *
1094
- * @param n - The value to increment by.
1095
- * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
1096
- * `updateDoc()`
1097
- */
1098
- export function increment(n: any): NumericIncrementFieldValueImpl;
1099
- /**
1100
- * Initializes a new instance of {@link Firestore} with the provided settings.
1101
- * Can only be called before any other function, including
1102
- * {@link getFirestore}. If the custom settings are empty, this function is
1103
- * equivalent to calling {@link getFirestore}.
1104
- *
1105
- * @param app - The {@link @firebase/app#FirebaseApp} with which the {@link Firestore} instance will
1106
- * be associated.
1107
- * @param settings - A settings object to configure the {@link Firestore} instance.
1108
- * @returns A newly initialized {@link Firestore} instance.
1109
- */
1110
- export function initializeFirestore(app: any, settings: any): import("../src").Firestore;
1111
- /**
1112
- * Creates a {@link QueryConstraint} that only returns the first matching documents.
1113
- *
1114
- * @param limit - The maximum number of items to return.
1115
- * @returns The created {@link Query}.
1116
- */
1117
- export function limit(limit: any): QueryLimitConstraint;
1118
- /**
1119
- * Creates a {@link QueryConstraint} that only returns the last matching documents.
1120
- *
1121
- * You must specify at least one `orderBy` clause for `limitToLast` queries,
1122
- * otherwise an exception will be thrown during execution.
1123
- *
1124
- * @param limit - The maximum number of items to return.
1125
- * @returns The created {@link Query}.
1126
- */
1127
- export function limitToLast(limit: any): QueryLimitConstraint;
1128
- /**
1129
- * Loads a Firestore bundle into the local cache.
1130
- *
1131
- * @param firestore - The {@link Firestore} instance to load bundles for for.
1132
- * @param bundleData - An object representing the bundle to be loaded. Valid objects are
1133
- * `ArrayBuffer`, `ReadableStream<Uint8Array>` or `string`.
1134
- *
1135
- * @returns
1136
- * A `LoadBundleTask` object, which notifies callers with progress updates, and completion
1137
- * or error events. It can be used as a `Promise<LoadBundleTaskProgress>`.
1138
- */
1139
- export function loadBundle(firestore: any, bundleData: any): LoadBundleTask;
1140
- /**
1141
- * Reads a Firestore {@link Query} from local cache, identified by the given name.
1142
- *
1143
- * The named queries are packaged into bundles on the server side (along
1144
- * with resulting documents), and loaded to local cache using `loadBundle`. Once in local
1145
- * cache, use this method to extract a {@link Query} by name.
1146
- */
1147
- export function namedQuery(firestore: any, name: any): any;
1148
- export function onSnapshot(reference: any, ...args: any[]): () => void;
1149
- export function onSnapshotsInSync(firestore: any, arg: any): () => void;
1150
- /**
1151
- * Creates a {@link QueryConstraint} that sorts the query result by the
1152
- * specified field, optionally in descending order instead of ascending.
1153
- *
1154
- * @param fieldPath - The field to sort by.
1155
- * @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
1156
- * not specified, order will be ascending.
1157
- * @returns The created {@link Query}.
1158
- */
1159
- export function orderBy(fieldPath: any, directionStr?: string): QueryOrderByConstraint;
1160
- /**
1161
- * Creates a new immutable instance of {@link Query} that is extended to also include
1162
- * additional query constraints.
1163
- *
1164
- * @param query - The {@link Query} instance to use as a base for the new constraints.
1165
- * @param queryConstraints - The list of {@link QueryConstraint}s to apply.
1166
- * @throws if any of the provided query constraints cannot be combined with the
1167
- * existing or new constraints.
1168
- */
1169
- export function query(query: any, ...queryConstraints: any[]): any;
1170
- /**
1171
- * Returns true if the provided queries point to the same collection and apply
1172
- * the same constraints.
1173
- *
1174
- * @param left - A `Query` to compare.
1175
- * @param right - A `Query` to compare.
1176
- * @returns true if the references point to the same location in the same
1177
- * Firestore database.
1178
- */
1179
- export function queryEqual(left: any, right: any): boolean;
1180
- /**
1181
- * Returns true if the provided references are equal.
1182
- *
1183
- * @param left - A reference to compare.
1184
- * @param right - A reference to compare.
1185
- * @returns true if the references point to the same location in the same
1186
- * Firestore database.
1187
- */
1188
- export function refEqual(left: any, right: any): boolean;
1189
- /**
1190
- * Executes the given `updateFunction` and then attempts to commit the changes
1191
- * applied within the transaction. If any document read within the transaction
1192
- * has changed, Cloud Firestore retries the `updateFunction`. If it fails to
1193
- * commit after 5 attempts, the transaction fails.
1194
- *
1195
- * The maximum number of writes allowed in a single transaction is 500.
1196
- *
1197
- * @param firestore - A reference to the Firestore database to run this
1198
- * transaction against.
1199
- * @param updateFunction - The function to execute within the transaction
1200
- * context.
1201
- * @returns If the transaction completed successfully or was explicitly aborted
1202
- * (the `updateFunction` returned a failed promise), the promise returned by the
1203
- * `updateFunction `is returned here. Otherwise, if the transaction failed, a
1204
- * rejected promise with the corresponding failure error is returned.
1205
- */
1206
- export function runTransaction(firestore: any, updateFunction: any): Promise<any>;
1207
- /**
1208
- * Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
1209
- * include a server-generated timestamp in the written data.
1210
- */
1211
- export function serverTimestamp(): ServerTimestampFieldValueImpl;
1212
- export function setDoc(reference: any, data: any, options: any): Promise<any>;
1213
- /**
1214
- * Sets the verbosity of Cloud Firestore logs (debug, error, or silent).
1215
- *
1216
- * @param logLevel - The verbosity you set for activity and error logging. Can
1217
- * be any of the following values:
1218
- *
1219
- * <ul>
1220
- * <li>`debug` for the most verbose logging level, primarily for
1221
- * debugging.</li>
1222
- * <li>`error` to log errors only.</li>
1223
- * <li><code>`silent` to turn off logging.</li>
1224
- * </ul>
1225
- */
1226
- export function setLogLevel(logLevel: any): void;
1227
- /**
1228
- * Returns true if the provided snapshots are equal.
1229
- *
1230
- * @param left - A snapshot to compare.
1231
- * @param right - A snapshot to compare.
1232
- * @returns true if the snapshots are equal.
1233
- */
1234
- export function snapshotEqual(left: any, right: any): any;
1235
- export function startAfter(...docOrFields: any[]): QueryStartAtConstraint;
1236
- export function startAt(...docOrFields: any[]): QueryStartAtConstraint;
1237
- /**
1238
- * Terminates the provided {@link Firestore} instance.
1239
- *
1240
- * After calling `terminate()` only the `clearIndexedDbPersistence()` function
1241
- * may be used. Any other function will throw a `FirestoreError`.
1242
- *
1243
- * To restart after termination, create a new instance of FirebaseFirestore with
1244
- * {@link getFirestore}.
1245
- *
1246
- * Termination does not cancel any pending writes, and any promises that are
1247
- * awaiting a response from the server will not be resolved. If you have
1248
- * persistence enabled, the next time you start this instance, it will resume
1249
- * sending these writes to the server.
1250
- *
1251
- * Note: Under normal circumstances, calling `terminate()` is not required. This
1252
- * function is useful only when you want to force this instance to release all
1253
- * of its resources or in combination with `clearIndexedDbPersistence()` to
1254
- * ensure that all local state is destroyed between test runs.
1255
- *
1256
- * @returns A `Promise` that is resolved when the instance has been successfully
1257
- * terminated.
1258
- */
1259
- export function terminate(firestore: any): any;
1260
- export function updateDoc(reference: any, fieldOrUpdateData: any, value: any, ...moreFieldsAndValues: any[]): Promise<any>;
1261
- /**
1262
- * Waits until all currently pending writes for the active user have been
1263
- * acknowledged by the backend.
1264
- *
1265
- * The returned promise resolves immediately if there are no outstanding writes.
1266
- * Otherwise, the promise waits for all previously issued writes (including
1267
- * those written in a previous app session), but it does not wait for writes
1268
- * that were added after the function is called. If you want to wait for
1269
- * additional writes, call `waitForPendingWrites()` again.
1270
- *
1271
- * Any outstanding `waitForPendingWrites()` promises are rejected during user
1272
- * changes.
1273
- *
1274
- * @returns A `Promise` which resolves when all currently pending writes have been
1275
- * acknowledged by the backend.
1276
- */
1277
- export function waitForPendingWrites(firestore: any): Promise<any>;
1278
- /**
1279
- * Creates a {@link QueryConstraint} that enforces that documents must contain the
1280
- * specified field and that the value should satisfy the relation constraint
1281
- * provided.
1282
- *
1283
- * @param fieldPath - The path to compare
1284
- * @param opStr - The operation string (e.g "&lt;", "&lt;=", "==", "&lt;",
1285
- * "&lt;=", "!=").
1286
- * @param value - The value for comparison
1287
- * @returns The created {@link Query}.
1288
- */
1289
- export function where(fieldPath: any, opStr: any, value: any): QueryFilterConstraint;
1290
- /**
1291
- * @license
1292
- * Copyright 2020 Google LLC
1293
- *
1294
- * Licensed under the Apache License, Version 2.0 (the "License");
1295
- * you may not use this file except in compliance with the License.
1296
- * You may obtain a copy of the License at
1297
- *
1298
- * http://www.apache.org/licenses/LICENSE-2.0
1299
- *
1300
- * Unless required by applicable law or agreed to in writing, software
1301
- * distributed under the License is distributed on an "AS IS" BASIS,
1302
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1303
- * See the License for the specific language governing permissions and
1304
- * limitations under the License.
1305
- */
1306
- /**
1307
- * Creates a write batch, used for performing multiple writes as a single
1308
- * atomic operation. The maximum number of writes allowed in a single {@link WriteBatch}
1309
- * is 500.
1310
- *
1311
- * Unlike transactions, write batches are persisted offline and therefore are
1312
- * preferable when you don't need to condition your writes on read data.
1313
- *
1314
- * @returns A {@link WriteBatch} that can be used to atomically execute multiple
1315
- * writes.
1316
- */
1317
- export function writeBatch(firestore: any): WriteBatch;
1318
- /**
1319
- * @license
1320
- * Copyright 2020 Google LLC
1321
- *
1322
- * Licensed under the Apache License, Version 2.0 (the "License");
1323
- * you may not use this file except in compliance with the License.
1324
- * You may obtain a copy of the License at
1325
- *
1326
- * http://www.apache.org/licenses/LICENSE-2.0
1327
- *
1328
- * Unless required by applicable law or agreed to in writing, software
1329
- * distributed under the License is distributed on an "AS IS" BASIS,
1330
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1331
- * See the License for the specific language governing permissions and
1332
- * limitations under the License.
1333
- */
1334
- /**
1335
- * A `DocumentSnapshot` contains data read from a document in your Firestore
1336
- * database. The data can be extracted with `.data()` or `.get(<field>)` to
1337
- * get a specific field.
1338
- *
1339
- * For a `DocumentSnapshot` that points to a non-existing document, any data
1340
- * access will return 'undefined'. You can use the `exists()` method to
1341
- * explicitly verify a document's existence.
1342
- */
1343
- declare class DocumentSnapshot$1 {
1344
- /** @hideconstructor protected */
1345
- constructor(_firestore: any, _userDataWriter: any, _key: any, _document: any, _converter: any);
1346
- _firestore: any;
1347
- _userDataWriter: any;
1348
- _key: any;
1349
- _document: any;
1350
- _converter: any;
1351
- /** Property of the `DocumentSnapshot` that provides the document's ID. */
1352
- get id(): any;
1353
- /**
1354
- * The `DocumentReference` for the document included in the `DocumentSnapshot`.
1355
- */
1356
- get ref(): DocumentReference;
1357
- /**
1358
- * Signals whether or not the document at the snapshot's location exists.
1359
- *
1360
- * @returns true if the document exists.
1361
- */
1362
- exists(): boolean;
1363
- /**
1364
- * Retrieves all fields in the document as an `Object`. Returns `undefined` if
1365
- * the document doesn't exist.
1366
- *
1367
- * @returns An `Object` containing all fields in the document or `undefined`
1368
- * if the document doesn't exist.
1369
- */
1370
- data(): any;
1371
- /**
1372
- * Retrieves the field specified by `fieldPath`. Returns `undefined` if the
1373
- * document or field doesn't exist.
1374
- *
1375
- * @param fieldPath - The path (for example 'foo' or 'foo.bar') to a specific
1376
- * field.
1377
- * @returns The data at the specified field location or undefined if no such
1378
- * field exists in the document.
1379
- */
1380
- get(fieldPath: any): any;
1381
- }
1382
- /**
1383
- * @license
1384
- * Copyright 2020 Google LLC
1385
- *
1386
- * Licensed under the Apache License, Version 2.0 (the "License");
1387
- * you may not use this file except in compliance with the License.
1388
- * You may obtain a copy of the License at
1389
- *
1390
- * http://www.apache.org/licenses/LICENSE-2.0
1391
- *
1392
- * Unless required by applicable law or agreed to in writing, software
1393
- * distributed under the License is distributed on an "AS IS" BASIS,
1394
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1395
- * See the License for the specific language governing permissions and
1396
- * limitations under the License.
1397
- */
1398
- /**
1399
- * The Cloud Firestore service interface.
1400
- *
1401
- * Do not call this constructor directly. Instead, use {@link getFirestore}.
1402
- */
1403
- declare class Firestore$1 {
1404
- /** @hideconstructor */
1405
- constructor(databaseIdOrApp: any, _credentials: any);
1406
- _credentials: any;
1407
- /**
1408
- * Whether it's a Firestore or Firestore Lite instance.
1409
- */
1410
- type: string;
1411
- _persistenceKey: string;
1412
- _settings: FirestoreSettingsImpl;
1413
- _settingsFrozen: boolean;
1414
- _databaseId: DatabaseId;
1415
- _app: any;
1416
- /**
1417
- * The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
1418
- * instance.
1419
- */
1420
- get app(): any;
1421
- get _initialized(): boolean;
1422
- get _terminated(): boolean;
1423
- _setSettings(settings: any): void;
1424
- _getSettings(): FirestoreSettingsImpl;
1425
- _freezeSettings(): FirestoreSettingsImpl;
1426
- _delete(): Promise<void>;
1427
- _terminateTask: Promise<void> | undefined;
1428
- /** Returns a JSON-serializable representation of this `Firestore` instance. */
1429
- toJSON(): {
1430
- app: any;
1431
- databaseId: DatabaseId;
1432
- settings: FirestoreSettingsImpl;
1433
- };
1434
- /**
1435
- * Terminates all components used by this client. Subclasses can override
1436
- * this method to clean up their own dependencies, but must also call this
1437
- * method.
1438
- *
1439
- * Only ever called once.
1440
- */
1441
- _terminate(): Promise<void>;
1442
- }
1443
- declare class AsyncQueueImpl {
1444
- tail: Promise<void>;
1445
- retryableOps: any[];
1446
- _isShuttingDown: boolean;
1447
- delayedOperations: any[];
1448
- failure: any;
1449
- operationInProgress: boolean;
1450
- skipNonRestrictedTasks: boolean;
1451
- timerIdsToSkip: any[];
1452
- backoff: ExponentialBackoff;
1453
- visibilityHandler: () => void;
1454
- get isShuttingDown(): boolean;
1455
- /**
1456
- * Adds a new operation to the queue without waiting for it to complete (i.e.
1457
- * we ignore the Promise result).
1458
- */
1459
- enqueueAndForget(op: any): void;
1460
- enqueueAndForgetEvenWhileRestricted(op: any): void;
1461
- enterRestrictedMode(purgeExistingTasks: any): void;
1462
- enqueue(op: any): Promise<any>;
1463
- enqueueRetryable(op: any): void;
1464
- /**
1465
- * Runs the next operation from the retryable queue. If the operation fails,
1466
- * reschedules with backoff.
1467
- */
1468
- retryNextOp(): Promise<void>;
1469
- enqueueInternal(op: any): Promise<any>;
1470
- enqueueAfterDelay(timerId: any, delayMs: any, op: any): DelayedOperation;
1471
- verifyNotFailed(): void;
1472
- verifyOperationInProgress(): void;
1473
- /**
1474
- * Waits until all currently queued tasks are finished executing. Delayed
1475
- * operations are not run.
1476
- */
1477
- drain(): Promise<void>;
1478
- /**
1479
- * For Tests: Determine if a delayed operation with a particular TimerId
1480
- * exists.
1481
- */
1482
- containsDelayedOperation(timerId: any): boolean;
1483
- /**
1484
- * For Tests: Runs some or all delayed operations early.
1485
- *
1486
- * @param lastTimerId - Delayed operations up to and including this TimerId
1487
- * will be drained. Pass TimerId.All to run all delayed operations.
1488
- * @returns a Promise that resolves once all operations have been run.
1489
- */
1490
- runAllDelayedOperationsUntil(lastTimerId: any): Promise<void>;
1491
- /**
1492
- * For Tests: Skip all subsequent delays for a timer id.
1493
- */
1494
- skipDelaysForTimerId(timerId: any): void;
1495
- /** Called once a DelayedOperation is run or canceled. */
1496
- removeDelayedOperation(op: any): void;
1497
- }
1498
- /**
1499
- * @license
1500
- * Copyright 2017 Google LLC
1501
- *
1502
- * Licensed under the Apache License, Version 2.0 (the "License");
1503
- * you may not use this file except in compliance with the License.
1504
- * You may obtain a copy of the License at
1505
- *
1506
- * http://www.apache.org/licenses/LICENSE-2.0
1507
- *
1508
- * Unless required by applicable law or agreed to in writing, software
1509
- * distributed under the License is distributed on an "AS IS" BASIS,
1510
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1511
- * See the License for the specific language governing permissions and
1512
- * limitations under the License.
1513
- */
1514
- declare class Deferred {
1515
- promise: Promise<any>;
1516
- resolve: (value: any) => void;
1517
- reject: (reason?: any) => void;
1518
- }
1519
- /**
1520
- * @license
1521
- * Copyright 2020 Google LLC
1522
- *
1523
- * Licensed under the Apache License, Version 2.0 (the "License");
1524
- * you may not use this file except in compliance with the License.
1525
- * You may obtain a copy of the License at
1526
- *
1527
- * http://www.apache.org/licenses/LICENSE-2.0
1528
- *
1529
- * Unless required by applicable law or agreed to in writing, software
1530
- * distributed under the License is distributed on an "AS IS" BASIS,
1531
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1532
- * See the License for the specific language governing permissions and
1533
- * limitations under the License.
1534
- */
1535
- /**
1536
- * A reference to a transaction.
1537
- *
1538
- * The `Transaction` object passed to a transaction's `updateFunction` provides
1539
- * the methods to read and write data within the transaction context. See
1540
- * {@link runTransaction}.
1541
- */
1542
- declare class Transaction$1 {
1543
- /** @hideconstructor */
1544
- constructor(_firestore: any, _transaction: any);
1545
- _firestore: any;
1546
- _transaction: any;
1547
- _dataReader: UserDataReader;
1548
- /**
1549
- * Reads the document referenced by the provided {@link DocumentReference}.
1550
- *
1551
- * @param documentRef - A reference to the document to be read.
1552
- * @returns A `DocumentSnapshot` with the read data.
1553
- */
1554
- get(documentRef: any): any;
1555
- set(documentRef: any, value: any, options: any): Transaction$1;
1556
- update(documentRef: any, fieldOrUpdateData: any, value: any, ...moreFieldsAndValues: any[]): Transaction$1;
1557
- /**
1558
- * Deletes the document referred to by the provided {@link DocumentReference}.
1559
- *
1560
- * @param documentRef - A reference to the document to be deleted.
1561
- * @returns This `Transaction` instance. Used for chaining method calls.
1562
- */
1563
- delete(documentRef: any): Transaction$1;
1564
- }
1565
- /**
1566
- * Helper for parsing raw user input (provided via the API) into internal model
1567
- * classes.
1568
- */
1569
- declare class UserDataReader {
1570
- constructor(databaseId: any, ignoreUndefinedProperties: any, serializer: any);
1571
- databaseId: any;
1572
- ignoreUndefinedProperties: any;
1573
- serializer: any;
1574
- /** Creates a new top-level parse context. */
1575
- createContext(dataSource: any, methodName: any, targetDoc: any, hasConverter?: boolean): ParseContextImpl;
1576
- }
1577
- /**
1578
- * Path represents an ordered sequence of string segments.
1579
- */
1580
- declare class BasePath {
1581
- static comparator(p1: any, p2: any): 0 | 1 | -1;
1582
- constructor(segments: any, offset: any, length: any);
1583
- segments: any;
1584
- offset: any;
1585
- len: any;
1586
- get length(): any;
1587
- isEqual(other: any): boolean;
1588
- child(nameOrPath: any): any;
1589
- /** The index of one past the last segment of the path. */
1590
- limit(): any;
1591
- popFirst(size: any): any;
1592
- popLast(): any;
1593
- firstSegment(): any;
1594
- lastSegment(): any;
1595
- get(index: any): any;
1596
- isEmpty(): boolean;
1597
- isPrefixOf(other: any): boolean;
1598
- isImmediateParentOf(potentialChild: any): boolean;
1599
- forEach(fn: any): void;
1600
- toArray(): any;
1601
- }
1602
- declare class ArrayRemoveFieldValueImpl extends FieldValue {
1603
- constructor(methodName: any, _elements: any);
1604
- _elements: any;
1605
- _toFieldTransform(context: any): FieldTransform;
1606
- isEqual(other: any): boolean;
1607
- }
1608
- declare class ArrayUnionFieldValueImpl extends FieldValue {
1609
- constructor(methodName: any, _elements: any);
1610
- _elements: any;
1611
- _toFieldTransform(context: any): FieldTransform;
1612
- isEqual(other: any): boolean;
1613
- }
1614
- declare class DeleteFieldValueImpl extends FieldValue {
1615
- _toFieldTransform(context: any): null;
1616
- isEqual(other: any): boolean;
1617
- }
1618
- declare class QueryEndAtConstraint extends QueryConstraint {
1619
- constructor(type: any, _docOrFields: any, _before: any);
1620
- type: any;
1621
- _docOrFields: any;
1622
- _before: any;
1623
- _apply(query: any): Query;
1624
- }
1625
- declare class NumericIncrementFieldValueImpl extends FieldValue {
1626
- constructor(methodName: any, _operand: any);
1627
- _operand: any;
1628
- _toFieldTransform(context: any): FieldTransform;
1629
- isEqual(other: any): boolean;
1630
- }
1631
- declare class QueryLimitConstraint extends QueryConstraint {
1632
- constructor(type: any, _limit: any, _limitType: any);
1633
- type: any;
1634
- _limit: any;
1635
- _limitType: any;
1636
- _apply(query: any): Query;
1637
- }
1638
- declare class QueryOrderByConstraint extends QueryConstraint {
1639
- constructor(_field: any, _direction: any);
1640
- _field: any;
1641
- _direction: any;
1642
- type: string;
1643
- _apply(query: any): Query;
1644
- }
1645
- declare class ServerTimestampFieldValueImpl extends FieldValue {
1646
- _toFieldTransform(context: any): FieldTransform;
1647
- isEqual(other: any): boolean;
1648
- }
1649
- declare class QueryStartAtConstraint extends QueryConstraint {
1650
- constructor(type: any, _docOrFields: any, _before: any);
1651
- type: any;
1652
- _docOrFields: any;
1653
- _before: any;
1654
- _apply(query: any): Query;
1655
- }
1656
- declare class QueryFilterConstraint extends QueryConstraint {
1657
- constructor(_field: any, _op: any, _value: any);
1658
- _field: any;
1659
- _op: any;
1660
- _value: any;
1661
- type: string;
1662
- _apply(query: any): Query;
1663
- }
1664
- /**
1665
- * A concrete type describing all the values that can be applied via a
1666
- * user-supplied `FirestoreSettings` object. This is a separate type so that
1667
- * defaults can be supplied and the value can be checked for equality.
1668
- */
1669
- declare class FirestoreSettingsImpl {
1670
- constructor(settings: any);
1671
- host: any;
1672
- ssl: any;
1673
- credentials: any;
1674
- ignoreUndefinedProperties: boolean;
1675
- cacheSizeBytes: any;
1676
- experimentalForceLongPolling: boolean;
1677
- experimentalAutoDetectLongPolling: boolean;
1678
- useFetchStreams: boolean;
1679
- isEqual(other: any): boolean;
1680
- }
1681
- /**
1682
- * A helper for running delayed tasks following an exponential backoff curve
1683
- * between attempts.
1684
- *
1685
- * Each delay is made up of a "base" delay which follows the exponential
1686
- * backoff curve, and a +/- 50% "jitter" that is calculated and added to the
1687
- * base delay. This prevents clients from accidentally synchronizing their
1688
- * delays causing spikes of load to the backend.
1689
- */
1690
- declare class ExponentialBackoff {
1691
- constructor(queue: any, timerId: any, initialDelayMs?: number, backoffFactor?: number, maxDelayMs?: number);
1692
- queue: any;
1693
- timerId: any;
1694
- initialDelayMs: number;
1695
- backoffFactor: number;
1696
- maxDelayMs: number;
1697
- currentBaseMs: number;
1698
- timerPromise: any;
1699
- /** The last backoff attempt, as epoch milliseconds. */
1700
- lastAttemptTime: number;
1701
- /**
1702
- * Resets the backoff delay.
1703
- *
1704
- * The very next backoffAndWait() will have no delay. If it is called again
1705
- * (i.e. due to an error), initialDelayMs (plus jitter) will be used, and
1706
- * subsequent ones will increase according to the backoffFactor.
1707
- */
1708
- reset(): void;
1709
- /**
1710
- * Resets the backoff delay to the maximum delay (e.g. for use after a
1711
- * RESOURCE_EXHAUSTED error).
1712
- */
1713
- resetToMax(): void;
1714
- /**
1715
- * Returns a promise that resolves after currentDelayMs, and increases the
1716
- * delay for any subsequent attempts. If there was a pending backoff operation
1717
- * already, it will be canceled.
1718
- */
1719
- backoffAndRun(op: any): void;
1720
- skipBackoff(): void;
1721
- cancel(): void;
1722
- /** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */
1723
- jitterDelayMs(): number;
1724
- }
1725
- /**
1726
- * Represents an operation scheduled to be run in the future on an AsyncQueue.
1727
- *
1728
- * It is created via DelayedOperation.createAndSchedule().
1729
- *
1730
- * Supports cancellation (via cancel()) and early execution (via skipDelay()).
1731
- *
1732
- * Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
1733
- * in newer versions of TypeScript defines `finally`, which is not available in
1734
- * IE.
1735
- */
1736
- declare class DelayedOperation {
1737
- /**
1738
- * Creates and returns a DelayedOperation that has been scheduled to be
1739
- * executed on the provided asyncQueue after the provided delayMs.
1740
- *
1741
- * @param asyncQueue - The queue to schedule the operation on.
1742
- * @param id - A Timer ID identifying the type of operation this is.
1743
- * @param delayMs - The delay (ms) before the operation should be scheduled.
1744
- * @param op - The operation to run.
1745
- * @param removalCallback - A callback to be called synchronously once the
1746
- * operation is executed or canceled, notifying the AsyncQueue to remove it
1747
- * from its delayedOperations list.
1748
- * PORTING NOTE: This exists to prevent making removeDelayedOperation() and
1749
- * the DelayedOperation class public.
1750
- */
1751
- static createAndSchedule(asyncQueue: any, timerId: any, delayMs: any, op: any, removalCallback: any): DelayedOperation;
1752
- constructor(asyncQueue: any, timerId: any, targetTimeMs: any, op: any, removalCallback: any);
1753
- asyncQueue: any;
1754
- timerId: any;
1755
- targetTimeMs: any;
1756
- op: any;
1757
- removalCallback: any;
1758
- deferred: Deferred;
1759
- then: <TResult1 = any, TResult2 = never>(onfulfilled?: ((value: any) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>;
1760
- /**
1761
- * Starts the timer. This is called immediately after construction by
1762
- * createAndSchedule().
1763
- */
1764
- start(delayMs: any): void;
1765
- timerHandle: NodeJS.Timeout | null | undefined;
1766
- /**
1767
- * Queues the operation to run immediately (if it hasn't already been run or
1768
- * canceled).
1769
- */
1770
- skipDelay(): void;
1771
- /**
1772
- * Cancels the operation if it hasn't already been executed or canceled. The
1773
- * promise will be rejected.
1774
- *
1775
- * As long as the operation has not yet been run, calling cancel() provides a
1776
- * guarantee that the operation will not be run.
1777
- */
1778
- cancel(reason: any): void;
1779
- handleDelayElapsed(): void;
1780
- clearTimeout(): void;
1781
- }
1782
- /** A "context" object passed around while parsing user data. */
1783
- declare class ParseContextImpl {
1784
- /**
1785
- * Initializes a ParseContext with the given source and path.
1786
- *
1787
- * @param settings - The settings for the parser.
1788
- * @param databaseId - The database ID of the Firestore instance.
1789
- * @param serializer - The serializer to use to generate the Value proto.
1790
- * @param ignoreUndefinedProperties - Whether to ignore undefined properties
1791
- * rather than throw.
1792
- * @param fieldTransforms - A mutable list of field transforms encountered
1793
- * while parsing the data.
1794
- * @param fieldMask - A mutable list of field paths encountered while parsing
1795
- * the data.
1796
- *
1797
- * TODO(b/34871131): We don't support array paths right now, so path can be
1798
- * null to indicate the context represents any location within an array (in
1799
- * which case certain features will not work and errors will be somewhat
1800
- * compromised).
1801
- */
1802
- constructor(settings: any, databaseId: any, serializer: any, ignoreUndefinedProperties: any, fieldTransforms: any, fieldMask: any);
1803
- settings: any;
1804
- databaseId: any;
1805
- serializer: any;
1806
- ignoreUndefinedProperties: any;
1807
- fieldTransforms: any;
1808
- fieldMask: any;
1809
- get path(): any;
1810
- get dataSource(): any;
1811
- /** Returns a new context with the specified settings overwritten. */
1812
- contextWith(configuration: any): ParseContextImpl;
1813
- childContextForField(field: any): ParseContextImpl;
1814
- childContextForFieldPath(field: any): ParseContextImpl;
1815
- childContextForArray(index: any): ParseContextImpl;
1816
- createError(reason: any): FirestoreError;
1817
- /** Returns 'true' if 'fieldPath' was traversed when creating this context. */
1818
- contains(fieldPath: any): boolean;
1819
- validatePath(): void;
1820
- validatePathSegment(segment: any): void;
1821
- }
1822
- /**
1823
- * @license
1824
- * Copyright 2017 Google LLC
1825
- *
1826
- * Licensed under the Apache License, Version 2.0 (the "License");
1827
- * you may not use this file except in compliance with the License.
1828
- * You may obtain a copy of the License at
1829
- *
1830
- * http://www.apache.org/licenses/LICENSE-2.0
1831
- *
1832
- * Unless required by applicable law or agreed to in writing, software
1833
- * distributed under the License is distributed on an "AS IS" BASIS,
1834
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1835
- * See the License for the specific language governing permissions and
1836
- * limitations under the License.
1837
- */
1838
- /** A field path and the TransformOperation to perform upon it. */
1839
- declare class FieldTransform {
1840
- constructor(field: any, transform: any);
1841
- field: any;
1842
- transform: any;
1843
- }
1844
- export { DatabaseId as _DatabaseId, DocumentKey as _DocumentKey, EmptyCredentialsProvider as _EmptyCredentialsProvider, FieldPath$1 as _FieldPath, cast as _cast, debugAssert as _debugAssert, isBase64Available as _isBase64Available, logWarn as _logWarn, validateIsNotUsedTogether as _validateIsNotUsedTogether };