@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.
- package/CHANGELOG.md +12 -0
- package/dist/firestore/src/register.d.ts +1 -1
- package/dist/firestore/src/remote/persistent_stream.d.ts +5 -1
- package/dist/firestore/src/util/async_queue.d.ts +4 -2
- package/dist/index.esm2017.js +1055 -1047
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +1483 -1474
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +7049 -9102
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/{index.node.cjs.esm2017.js → index.node.mjs} +51 -20
- package/dist/index.node.mjs.map +1 -0
- package/dist/index.rn.js +534 -526
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +4 -2
- package/dist/lite/firestore/src/register.d.ts +1 -1
- package/dist/lite/firestore/src/remote/persistent_stream.d.ts +5 -1
- package/dist/lite/firestore/src/util/async_queue.d.ts +4 -2
- package/dist/lite/index.browser.esm2017.js +2 -2
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +2 -2
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +1804 -2261
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/{index.node.esm2017.js → index.node.mjs} +3 -3
- package/dist/lite/index.node.mjs.map +1 -0
- package/dist/lite/index.rn.esm2017.js +2 -2
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +4 -2
- package/dist/lite/packages/firestore/src/register.d.ts +1 -1
- package/dist/lite/packages/firestore/src/remote/persistent_stream.d.ts +5 -1
- package/dist/lite/packages/firestore/src/util/async_queue.d.ts +4 -2
- package/dist/lite/private.d.ts +4 -2
- package/dist/packages/firestore/dist/index.esm2017.d.ts +102 -102
- package/dist/packages/firestore/src/register.d.ts +1 -1
- package/dist/packages/firestore/src/remote/persistent_stream.d.ts +5 -1
- package/dist/packages/firestore/src/util/async_queue.d.ts +4 -2
- package/dist/private.d.ts +4 -2
- package/lite/package.json +1 -1
- package/package.json +15 -9
- package/dist/index.node.cjs.esm2017.js.map +0 -1
- package/dist/lite/firestore/dist/lite/index.node.esm2017.d.ts +0 -1195
- package/dist/lite/index.node.esm2017.js.map +0 -1
- package/dist/packages/firestore/dist/index.node.cjs.esm2017.d.ts +0 -1844
|
@@ -1,1195 +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
|
-
* An immutable object representing an array of bytes.
|
|
19
|
-
*/
|
|
20
|
-
export class Bytes {
|
|
21
|
-
/**
|
|
22
|
-
* Creates a new `Bytes` object from the given Base64 string, converting it to
|
|
23
|
-
* bytes.
|
|
24
|
-
*
|
|
25
|
-
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
26
|
-
*/
|
|
27
|
-
static fromBase64String(base64: any): Bytes;
|
|
28
|
-
/**
|
|
29
|
-
* Creates a new `Bytes` object from the given Uint8Array.
|
|
30
|
-
*
|
|
31
|
-
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
32
|
-
*/
|
|
33
|
-
static fromUint8Array(array: any): Bytes;
|
|
34
|
-
/** @hideconstructor */
|
|
35
|
-
constructor(byteString: any);
|
|
36
|
-
_byteString: any;
|
|
37
|
-
/**
|
|
38
|
-
* Returns the underlying bytes as a Base64-encoded string.
|
|
39
|
-
*
|
|
40
|
-
* @returns The Base64-encoded string created from the `Bytes` object.
|
|
41
|
-
*/
|
|
42
|
-
toBase64(): any;
|
|
43
|
-
/**
|
|
44
|
-
* Returns the underlying bytes in a new `Uint8Array`.
|
|
45
|
-
*
|
|
46
|
-
* @returns The Uint8Array created from the `Bytes` object.
|
|
47
|
-
*/
|
|
48
|
-
toUint8Array(): any;
|
|
49
|
-
/**
|
|
50
|
-
* Returns a string representation of the `Bytes` object.
|
|
51
|
-
*
|
|
52
|
-
* @returns A string representation of the `Bytes` object.
|
|
53
|
-
*/
|
|
54
|
-
toString(): string;
|
|
55
|
-
/**
|
|
56
|
-
* Returns true if this `Bytes` object is equal to the provided one.
|
|
57
|
-
*
|
|
58
|
-
* @param other - The `Bytes` object to compare against.
|
|
59
|
-
* @returns true if this `Bytes` object is equal to the provided one.
|
|
60
|
-
*/
|
|
61
|
-
isEqual(other: any): any;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* A `CollectionReference` object can be used for adding documents, getting
|
|
65
|
-
* document references, and querying for documents (using {@link query}).
|
|
66
|
-
*/
|
|
67
|
-
export class CollectionReference extends Query {
|
|
68
|
-
_path: any;
|
|
69
|
-
/** The collection's identifier. */
|
|
70
|
-
get id(): any;
|
|
71
|
-
/**
|
|
72
|
-
* A string representing the path of the referenced collection (relative
|
|
73
|
-
* to the root of the database).
|
|
74
|
-
*/
|
|
75
|
-
get path(): any;
|
|
76
|
-
/**
|
|
77
|
-
* A reference to the containing `DocumentReference` if this is a
|
|
78
|
-
* subcollection. If this isn't a subcollection, the reference is null.
|
|
79
|
-
*/
|
|
80
|
-
get parent(): DocumentReference | null;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* @license
|
|
84
|
-
* Copyright 2020 Google LLC
|
|
85
|
-
*
|
|
86
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
87
|
-
* you may not use this file except in compliance with the License.
|
|
88
|
-
* You may obtain a copy of the License at
|
|
89
|
-
*
|
|
90
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
91
|
-
*
|
|
92
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
93
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
94
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
95
|
-
* See the License for the specific language governing permissions and
|
|
96
|
-
* limitations under the License.
|
|
97
|
-
*/
|
|
98
|
-
/**
|
|
99
|
-
* A `DocumentReference` refers to a document location in a Firestore database
|
|
100
|
-
* and can be used to write, read, or listen to the location. The document at
|
|
101
|
-
* the referenced location may or may not exist.
|
|
102
|
-
*/
|
|
103
|
-
export class DocumentReference {
|
|
104
|
-
/** @hideconstructor */
|
|
105
|
-
constructor(firestore: any, converter: any, _key: any);
|
|
106
|
-
converter: any;
|
|
107
|
-
_key: any;
|
|
108
|
-
/** The type of this Firestore reference. */
|
|
109
|
-
type: string;
|
|
110
|
-
firestore: any;
|
|
111
|
-
get _path(): any;
|
|
112
|
-
/**
|
|
113
|
-
* The document's identifier within its collection.
|
|
114
|
-
*/
|
|
115
|
-
get id(): any;
|
|
116
|
-
/**
|
|
117
|
-
* A string representing the path of the referenced document (relative
|
|
118
|
-
* to the root of the database).
|
|
119
|
-
*/
|
|
120
|
-
get path(): any;
|
|
121
|
-
/**
|
|
122
|
-
* The collection this `DocumentReference` belongs to.
|
|
123
|
-
*/
|
|
124
|
-
get parent(): CollectionReference;
|
|
125
|
-
withConverter(converter: any): DocumentReference;
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* @license
|
|
129
|
-
* Copyright 2020 Google LLC
|
|
130
|
-
*
|
|
131
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
132
|
-
* you may not use this file except in compliance with the License.
|
|
133
|
-
* You may obtain a copy of the License at
|
|
134
|
-
*
|
|
135
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
136
|
-
*
|
|
137
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
138
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
139
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
140
|
-
* See the License for the specific language governing permissions and
|
|
141
|
-
* limitations under the License.
|
|
142
|
-
*/
|
|
143
|
-
/**
|
|
144
|
-
* A `DocumentSnapshot` contains data read from a document in your Firestore
|
|
145
|
-
* database. The data can be extracted with `.data()` or `.get(<field>)` to
|
|
146
|
-
* get a specific field.
|
|
147
|
-
*
|
|
148
|
-
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
149
|
-
* access will return 'undefined'. You can use the `exists()` method to
|
|
150
|
-
* explicitly verify a document's existence.
|
|
151
|
-
*/
|
|
152
|
-
export class DocumentSnapshot {
|
|
153
|
-
/** @hideconstructor protected */
|
|
154
|
-
constructor(_firestore: any, _userDataWriter: any, _key: any, _document: any, _converter: any);
|
|
155
|
-
_firestore: any;
|
|
156
|
-
_userDataWriter: any;
|
|
157
|
-
_key: any;
|
|
158
|
-
_document: any;
|
|
159
|
-
_converter: any;
|
|
160
|
-
/** Property of the `DocumentSnapshot` that provides the document's ID. */
|
|
161
|
-
get id(): any;
|
|
162
|
-
/**
|
|
163
|
-
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
164
|
-
*/
|
|
165
|
-
get ref(): DocumentReference;
|
|
166
|
-
/**
|
|
167
|
-
* Signals whether or not the document at the snapshot's location exists.
|
|
168
|
-
*
|
|
169
|
-
* @returns true if the document exists.
|
|
170
|
-
*/
|
|
171
|
-
exists(): boolean;
|
|
172
|
-
/**
|
|
173
|
-
* Retrieves all fields in the document as an `Object`. Returns `undefined` if
|
|
174
|
-
* the document doesn't exist.
|
|
175
|
-
*
|
|
176
|
-
* @returns An `Object` containing all fields in the document or `undefined`
|
|
177
|
-
* if the document doesn't exist.
|
|
178
|
-
*/
|
|
179
|
-
data(): any;
|
|
180
|
-
/**
|
|
181
|
-
* Retrieves the field specified by `fieldPath`. Returns `undefined` if the
|
|
182
|
-
* document or field doesn't exist.
|
|
183
|
-
*
|
|
184
|
-
* @param fieldPath - The path (for example 'foo' or 'foo.bar') to a specific
|
|
185
|
-
* field.
|
|
186
|
-
* @returns The data at the specified field location or undefined if no such
|
|
187
|
-
* field exists in the document.
|
|
188
|
-
*/
|
|
189
|
-
get(fieldPath: any): any;
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* @license
|
|
193
|
-
* Copyright 2020 Google LLC
|
|
194
|
-
*
|
|
195
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
196
|
-
* you may not use this file except in compliance with the License.
|
|
197
|
-
* You may obtain a copy of the License at
|
|
198
|
-
*
|
|
199
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
200
|
-
*
|
|
201
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
202
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
203
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
204
|
-
* See the License for the specific language governing permissions and
|
|
205
|
-
* limitations under the License.
|
|
206
|
-
*/
|
|
207
|
-
/**
|
|
208
|
-
* A `FieldPath` refers to a field in a document. The path may consist of a
|
|
209
|
-
* single field name (referring to a top-level field in the document), or a
|
|
210
|
-
* list of field names (referring to a nested field in the document).
|
|
211
|
-
*
|
|
212
|
-
* Create a `FieldPath` by providing field names. If more than one field
|
|
213
|
-
* name is provided, the path will point to a nested field in a document.
|
|
214
|
-
*/
|
|
215
|
-
export class FieldPath {
|
|
216
|
-
/**
|
|
217
|
-
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
218
|
-
* name is provided, the path will point to a nested field in a document.
|
|
219
|
-
*
|
|
220
|
-
* @param fieldNames - A list of field names.
|
|
221
|
-
*/
|
|
222
|
-
constructor(...fieldNames: any[]);
|
|
223
|
-
_internalPath: FieldPath$1;
|
|
224
|
-
/**
|
|
225
|
-
* Returns true if this `FieldPath` is equal to the provided one.
|
|
226
|
-
*
|
|
227
|
-
* @param other - The `FieldPath` to compare against.
|
|
228
|
-
* @returns true if this `FieldPath` is equal to the provided one.
|
|
229
|
-
*/
|
|
230
|
-
isEqual(other: any): boolean;
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* @license
|
|
234
|
-
* Copyright 2020 Google LLC
|
|
235
|
-
*
|
|
236
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
237
|
-
* you may not use this file except in compliance with the License.
|
|
238
|
-
* You may obtain a copy of the License at
|
|
239
|
-
*
|
|
240
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
241
|
-
*
|
|
242
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
243
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
244
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
245
|
-
* See the License for the specific language governing permissions and
|
|
246
|
-
* limitations under the License.
|
|
247
|
-
*/
|
|
248
|
-
/**
|
|
249
|
-
* Sentinel values that can be used when writing document fields with `set()`
|
|
250
|
-
* or `update()`.
|
|
251
|
-
*/
|
|
252
|
-
export class FieldValue {
|
|
253
|
-
/**
|
|
254
|
-
* @param _methodName - The public API endpoint that returns this class.
|
|
255
|
-
* @hideconstructor
|
|
256
|
-
*/
|
|
257
|
-
constructor(_methodName: any);
|
|
258
|
-
_methodName: any;
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* @license
|
|
262
|
-
* Copyright 2020 Google LLC
|
|
263
|
-
*
|
|
264
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
265
|
-
* you may not use this file except in compliance with the License.
|
|
266
|
-
* You may obtain a copy of the License at
|
|
267
|
-
*
|
|
268
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
269
|
-
*
|
|
270
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
271
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
272
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
273
|
-
* See the License for the specific language governing permissions and
|
|
274
|
-
* limitations under the License.
|
|
275
|
-
*/
|
|
276
|
-
/**
|
|
277
|
-
* The Cloud Firestore service interface.
|
|
278
|
-
*
|
|
279
|
-
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
280
|
-
*/
|
|
281
|
-
export class Firestore {
|
|
282
|
-
/** @hideconstructor */
|
|
283
|
-
constructor(databaseIdOrApp: any, _credentials: any);
|
|
284
|
-
_credentials: any;
|
|
285
|
-
/**
|
|
286
|
-
* Whether it's a Firestore or Firestore Lite instance.
|
|
287
|
-
*/
|
|
288
|
-
type: string;
|
|
289
|
-
_persistenceKey: string;
|
|
290
|
-
_settings: FirestoreSettingsImpl;
|
|
291
|
-
_settingsFrozen: boolean;
|
|
292
|
-
_databaseId: DatabaseId;
|
|
293
|
-
_app: any;
|
|
294
|
-
/**
|
|
295
|
-
* The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
|
|
296
|
-
* instance.
|
|
297
|
-
*/
|
|
298
|
-
get app(): any;
|
|
299
|
-
get _initialized(): boolean;
|
|
300
|
-
get _terminated(): boolean;
|
|
301
|
-
_setSettings(settings: any): void;
|
|
302
|
-
_getSettings(): FirestoreSettingsImpl;
|
|
303
|
-
_freezeSettings(): FirestoreSettingsImpl;
|
|
304
|
-
_delete(): Promise<void>;
|
|
305
|
-
_terminateTask: Promise<void> | undefined;
|
|
306
|
-
/** Returns a JSON-serializable representation of this `Firestore` instance. */
|
|
307
|
-
toJSON(): {
|
|
308
|
-
app: any;
|
|
309
|
-
databaseId: DatabaseId;
|
|
310
|
-
settings: FirestoreSettingsImpl;
|
|
311
|
-
};
|
|
312
|
-
/**
|
|
313
|
-
* Terminates all components used by this client. Subclasses can override
|
|
314
|
-
* this method to clean up their own dependencies, but must also call this
|
|
315
|
-
* method.
|
|
316
|
-
*
|
|
317
|
-
* Only ever called once.
|
|
318
|
-
*/
|
|
319
|
-
_terminate(): Promise<void>;
|
|
320
|
-
}
|
|
321
|
-
/** An error returned by a Firestore operation. */
|
|
322
|
-
export class FirestoreError extends Error {
|
|
323
|
-
/** @hideconstructor */
|
|
324
|
-
constructor(code: any, message: any);
|
|
325
|
-
code: any;
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* @license
|
|
329
|
-
* Copyright 2017 Google LLC
|
|
330
|
-
*
|
|
331
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
332
|
-
* you may not use this file except in compliance with the License.
|
|
333
|
-
* You may obtain a copy of the License at
|
|
334
|
-
*
|
|
335
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
336
|
-
*
|
|
337
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
338
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
339
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
340
|
-
* See the License for the specific language governing permissions and
|
|
341
|
-
* limitations under the License.
|
|
342
|
-
*/
|
|
343
|
-
/**
|
|
344
|
-
* An immutable object representing a geographic location in Firestore. The
|
|
345
|
-
* location is represented as latitude/longitude pair.
|
|
346
|
-
*
|
|
347
|
-
* Latitude values are in the range of [-90, 90].
|
|
348
|
-
* Longitude values are in the range of [-180, 180].
|
|
349
|
-
*/
|
|
350
|
-
export class GeoPoint {
|
|
351
|
-
/**
|
|
352
|
-
* Creates a new immutable `GeoPoint` object with the provided latitude and
|
|
353
|
-
* longitude values.
|
|
354
|
-
* @param latitude - The latitude as number between -90 and 90.
|
|
355
|
-
* @param longitude - The longitude as number between -180 and 180.
|
|
356
|
-
*/
|
|
357
|
-
constructor(latitude: any, longitude: any);
|
|
358
|
-
_lat: any;
|
|
359
|
-
_long: any;
|
|
360
|
-
/**
|
|
361
|
-
* The latitude of this `GeoPoint` instance.
|
|
362
|
-
*/
|
|
363
|
-
get latitude(): any;
|
|
364
|
-
/**
|
|
365
|
-
* The longitude of this `GeoPoint` instance.
|
|
366
|
-
*/
|
|
367
|
-
get longitude(): any;
|
|
368
|
-
/**
|
|
369
|
-
* Returns true if this `GeoPoint` is equal to the provided one.
|
|
370
|
-
*
|
|
371
|
-
* @param other - The `GeoPoint` to compare against.
|
|
372
|
-
* @returns true if this `GeoPoint` is equal to the provided one.
|
|
373
|
-
*/
|
|
374
|
-
isEqual(other: any): boolean;
|
|
375
|
-
/** Returns a JSON-serializable representation of this GeoPoint. */
|
|
376
|
-
toJSON(): {
|
|
377
|
-
latitude: any;
|
|
378
|
-
longitude: any;
|
|
379
|
-
};
|
|
380
|
-
/**
|
|
381
|
-
* Actually private to JS consumers of our API, so this function is prefixed
|
|
382
|
-
* with an underscore.
|
|
383
|
-
*/
|
|
384
|
-
_compareTo(other: any): 0 | 1 | -1;
|
|
385
|
-
}
|
|
386
|
-
/**
|
|
387
|
-
* A `Query` refers to a query which you can read or listen to. You can also
|
|
388
|
-
* construct refined `Query` objects by adding filters and ordering.
|
|
389
|
-
*/
|
|
390
|
-
export class Query {
|
|
391
|
-
/** @hideconstructor protected */
|
|
392
|
-
constructor(firestore: any, converter: any, _query: any);
|
|
393
|
-
converter: any;
|
|
394
|
-
_query: any;
|
|
395
|
-
/** The type of this Firestore reference. */
|
|
396
|
-
type: string;
|
|
397
|
-
firestore: any;
|
|
398
|
-
withConverter(converter: any): Query;
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* A `QueryConstraint` is used to narrow the set of documents returned by a
|
|
402
|
-
* Firestore query. `QueryConstraint`s are created by invoking {@link where},
|
|
403
|
-
* {@link orderBy}, {@link (startAt:1)}, {@link (startAfter:1)}, {@link
|
|
404
|
-
* endBefore:1}, {@link (endAt:1)}, {@link limit} or {@link limitToLast} and
|
|
405
|
-
* can then be passed to {@link query} to create a new query instance that
|
|
406
|
-
* also contains this `QueryConstraint`.
|
|
407
|
-
*/
|
|
408
|
-
export class QueryConstraint {
|
|
409
|
-
}
|
|
410
|
-
/**
|
|
411
|
-
* A `QueryDocumentSnapshot` contains data read from a document in your
|
|
412
|
-
* Firestore database as part of a query. The document is guaranteed to exist
|
|
413
|
-
* and its data can be extracted with `.data()` or `.get(<field>)` to get a
|
|
414
|
-
* specific field.
|
|
415
|
-
*
|
|
416
|
-
* A `QueryDocumentSnapshot` offers the same API surface as a
|
|
417
|
-
* `DocumentSnapshot`. Since query results contain only existing documents, the
|
|
418
|
-
* `exists` property will always be true and `data()` will never return
|
|
419
|
-
* 'undefined'.
|
|
420
|
-
*/
|
|
421
|
-
export class QueryDocumentSnapshot extends DocumentSnapshot {
|
|
422
|
-
}
|
|
423
|
-
/**
|
|
424
|
-
* A `QuerySnapshot` contains zero or more `DocumentSnapshot` objects
|
|
425
|
-
* representing the results of a query. The documents can be accessed as an
|
|
426
|
-
* array via the `docs` property or enumerated using the `forEach` method. The
|
|
427
|
-
* number of documents can be determined via the `empty` and `size`
|
|
428
|
-
* properties.
|
|
429
|
-
*/
|
|
430
|
-
export class QuerySnapshot {
|
|
431
|
-
/** @hideconstructor */
|
|
432
|
-
constructor(_query: any, _docs: any);
|
|
433
|
-
_docs: any;
|
|
434
|
-
query: any;
|
|
435
|
-
/** An array of all the documents in the `QuerySnapshot`. */
|
|
436
|
-
get docs(): any[];
|
|
437
|
-
/** The number of documents in the `QuerySnapshot`. */
|
|
438
|
-
get size(): number;
|
|
439
|
-
/** True if there are no documents in the `QuerySnapshot`. */
|
|
440
|
-
get empty(): boolean;
|
|
441
|
-
/**
|
|
442
|
-
* Enumerates all of the documents in the `QuerySnapshot`.
|
|
443
|
-
*
|
|
444
|
-
* @param callback - A callback to be called with a `QueryDocumentSnapshot` for
|
|
445
|
-
* each document in the snapshot.
|
|
446
|
-
* @param thisArg - The `this` binding for the callback.
|
|
447
|
-
*/
|
|
448
|
-
forEach(callback: any, thisArg: any): void;
|
|
449
|
-
}
|
|
450
|
-
/**
|
|
451
|
-
* A `Timestamp` represents a point in time independent of any time zone or
|
|
452
|
-
* calendar, represented as seconds and fractions of seconds at nanosecond
|
|
453
|
-
* resolution in UTC Epoch time.
|
|
454
|
-
*
|
|
455
|
-
* It is encoded using the Proleptic Gregorian Calendar which extends the
|
|
456
|
-
* Gregorian calendar backwards to year one. It is encoded assuming all minutes
|
|
457
|
-
* are 60 seconds long, i.e. leap seconds are "smeared" so that no leap second
|
|
458
|
-
* table is needed for interpretation. Range is from 0001-01-01T00:00:00Z to
|
|
459
|
-
* 9999-12-31T23:59:59.999999999Z.
|
|
460
|
-
*
|
|
461
|
-
* For examples and further specifications, refer to the
|
|
462
|
-
* {@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | Timestamp definition}.
|
|
463
|
-
*/
|
|
464
|
-
export class Timestamp {
|
|
465
|
-
/**
|
|
466
|
-
* Creates a new timestamp with the current date, with millisecond precision.
|
|
467
|
-
*
|
|
468
|
-
* @returns a new timestamp representing the current date.
|
|
469
|
-
*/
|
|
470
|
-
static now(): Timestamp;
|
|
471
|
-
/**
|
|
472
|
-
* Creates a new timestamp from the given date.
|
|
473
|
-
*
|
|
474
|
-
* @param date - The date to initialize the `Timestamp` from.
|
|
475
|
-
* @returns A new `Timestamp` representing the same point in time as the given
|
|
476
|
-
* date.
|
|
477
|
-
*/
|
|
478
|
-
static fromDate(date: any): Timestamp;
|
|
479
|
-
/**
|
|
480
|
-
* Creates a new timestamp from the given number of milliseconds.
|
|
481
|
-
*
|
|
482
|
-
* @param milliseconds - Number of milliseconds since Unix epoch
|
|
483
|
-
* 1970-01-01T00:00:00Z.
|
|
484
|
-
* @returns A new `Timestamp` representing the same point in time as the given
|
|
485
|
-
* number of milliseconds.
|
|
486
|
-
*/
|
|
487
|
-
static fromMillis(milliseconds: any): Timestamp;
|
|
488
|
-
/**
|
|
489
|
-
* Creates a new timestamp.
|
|
490
|
-
*
|
|
491
|
-
* @param seconds - The number of seconds of UTC time since Unix epoch
|
|
492
|
-
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
|
493
|
-
* 9999-12-31T23:59:59Z inclusive.
|
|
494
|
-
* @param nanoseconds - The non-negative fractions of a second at nanosecond
|
|
495
|
-
* resolution. Negative second values with fractions must still have
|
|
496
|
-
* non-negative nanoseconds values that count forward in time. Must be
|
|
497
|
-
* from 0 to 999,999,999 inclusive.
|
|
498
|
-
*/
|
|
499
|
-
constructor(seconds: any, nanoseconds: any);
|
|
500
|
-
seconds: any;
|
|
501
|
-
nanoseconds: any;
|
|
502
|
-
/**
|
|
503
|
-
* Converts a `Timestamp` to a JavaScript `Date` object. This conversion
|
|
504
|
-
* causes a loss of precision since `Date` objects only support millisecond
|
|
505
|
-
* precision.
|
|
506
|
-
*
|
|
507
|
-
* @returns JavaScript `Date` object representing the same point in time as
|
|
508
|
-
* this `Timestamp`, with millisecond precision.
|
|
509
|
-
*/
|
|
510
|
-
toDate(): Date;
|
|
511
|
-
/**
|
|
512
|
-
* Converts a `Timestamp` to a numeric timestamp (in milliseconds since
|
|
513
|
-
* epoch). This operation causes a loss of precision.
|
|
514
|
-
*
|
|
515
|
-
* @returns The point in time corresponding to this timestamp, represented as
|
|
516
|
-
* the number of milliseconds since Unix epoch 1970-01-01T00:00:00Z.
|
|
517
|
-
*/
|
|
518
|
-
toMillis(): number;
|
|
519
|
-
_compareTo(other: any): 0 | 1 | -1;
|
|
520
|
-
/**
|
|
521
|
-
* Returns true if this `Timestamp` is equal to the provided one.
|
|
522
|
-
*
|
|
523
|
-
* @param other - The `Timestamp` to compare against.
|
|
524
|
-
* @returns true if this `Timestamp` is equal to the provided one.
|
|
525
|
-
*/
|
|
526
|
-
isEqual(other: any): boolean;
|
|
527
|
-
/** Returns a textual representation of this `Timestamp`. */
|
|
528
|
-
toString(): string;
|
|
529
|
-
/** Returns a JSON-serializable representation of this `Timestamp`. */
|
|
530
|
-
toJSON(): {
|
|
531
|
-
seconds: any;
|
|
532
|
-
nanoseconds: any;
|
|
533
|
-
};
|
|
534
|
-
/**
|
|
535
|
-
* Converts this object to a primitive string, which allows `Timestamp` objects
|
|
536
|
-
* to be compared using the `>`, `<=`, `>=` and `>` operators.
|
|
537
|
-
*/
|
|
538
|
-
valueOf(): string;
|
|
539
|
-
}
|
|
540
|
-
/**
|
|
541
|
-
* @license
|
|
542
|
-
* Copyright 2020 Google LLC
|
|
543
|
-
*
|
|
544
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
545
|
-
* you may not use this file except in compliance with the License.
|
|
546
|
-
* You may obtain a copy of the License at
|
|
547
|
-
*
|
|
548
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
549
|
-
*
|
|
550
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
551
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
552
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
553
|
-
* See the License for the specific language governing permissions and
|
|
554
|
-
* limitations under the License.
|
|
555
|
-
*/
|
|
556
|
-
/**
|
|
557
|
-
* A reference to a transaction.
|
|
558
|
-
*
|
|
559
|
-
* The `Transaction` object passed to a transaction's `updateFunction` provides
|
|
560
|
-
* the methods to read and write data within the transaction context. See
|
|
561
|
-
* {@link runTransaction}.
|
|
562
|
-
*/
|
|
563
|
-
export class Transaction {
|
|
564
|
-
/** @hideconstructor */
|
|
565
|
-
constructor(_firestore: any, _transaction: any);
|
|
566
|
-
_firestore: any;
|
|
567
|
-
_transaction: any;
|
|
568
|
-
_dataReader: UserDataReader;
|
|
569
|
-
/**
|
|
570
|
-
* Reads the document referenced by the provided {@link DocumentReference}.
|
|
571
|
-
*
|
|
572
|
-
* @param documentRef - A reference to the document to be read.
|
|
573
|
-
* @returns A `DocumentSnapshot` with the read data.
|
|
574
|
-
*/
|
|
575
|
-
get(documentRef: any): any;
|
|
576
|
-
set(documentRef: any, value: any, options: any): Transaction;
|
|
577
|
-
update(documentRef: any, fieldOrUpdateData: any, value: any, ...moreFieldsAndValues: any[]): Transaction;
|
|
578
|
-
/**
|
|
579
|
-
* Deletes the document referred to by the provided {@link DocumentReference}.
|
|
580
|
-
*
|
|
581
|
-
* @param documentRef - A reference to the document to be deleted.
|
|
582
|
-
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
583
|
-
*/
|
|
584
|
-
delete(documentRef: any): Transaction;
|
|
585
|
-
}
|
|
586
|
-
/**
|
|
587
|
-
* @license
|
|
588
|
-
* Copyright 2020 Google LLC
|
|
589
|
-
*
|
|
590
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
591
|
-
* you may not use this file except in compliance with the License.
|
|
592
|
-
* You may obtain a copy of the License at
|
|
593
|
-
*
|
|
594
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
595
|
-
*
|
|
596
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
597
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
598
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
599
|
-
* See the License for the specific language governing permissions and
|
|
600
|
-
* limitations under the License.
|
|
601
|
-
*/
|
|
602
|
-
/**
|
|
603
|
-
* A write batch, used to perform multiple writes as a single atomic unit.
|
|
604
|
-
*
|
|
605
|
-
* A `WriteBatch` object can be acquired by calling {@link writeBatch}. It
|
|
606
|
-
* provides methods for adding writes to the write batch. None of the writes
|
|
607
|
-
* will be committed (or visible locally) until {@link WriteBatch.commit} is
|
|
608
|
-
* called.
|
|
609
|
-
*/
|
|
610
|
-
export class WriteBatch {
|
|
611
|
-
/** @hideconstructor */
|
|
612
|
-
constructor(_firestore: any, _commitHandler: any);
|
|
613
|
-
_firestore: any;
|
|
614
|
-
_commitHandler: any;
|
|
615
|
-
_mutations: any[];
|
|
616
|
-
_committed: boolean;
|
|
617
|
-
_dataReader: UserDataReader;
|
|
618
|
-
set(documentRef: any, data: any, options: any): WriteBatch;
|
|
619
|
-
update(documentRef: any, fieldOrUpdateData: any, value: any, ...moreFieldsAndValues: any[]): WriteBatch;
|
|
620
|
-
/**
|
|
621
|
-
* Deletes the document referred to by the provided {@link DocumentReference}.
|
|
622
|
-
*
|
|
623
|
-
* @param documentRef - A reference to the document to be deleted.
|
|
624
|
-
* @returns This `WriteBatch` instance. Used for chaining method calls.
|
|
625
|
-
*/
|
|
626
|
-
delete(documentRef: any): WriteBatch;
|
|
627
|
-
/**
|
|
628
|
-
* Commits all of the writes in this write batch as a single atomic unit.
|
|
629
|
-
*
|
|
630
|
-
* The result of these writes will only be reflected in document reads that
|
|
631
|
-
* occur after the returned promise resolves. If the client is offline, the
|
|
632
|
-
* write fails. If you would like to see local modifications or buffer writes
|
|
633
|
-
* until the client is online, use the full Firestore SDK.
|
|
634
|
-
*
|
|
635
|
-
* @returns A `Promise` resolved once all of the writes in the batch have been
|
|
636
|
-
* successfully written to the backend as an atomic unit (note that it won't
|
|
637
|
-
* resolve while you're offline).
|
|
638
|
-
*/
|
|
639
|
-
commit(): any;
|
|
640
|
-
_verifyNotCommitted(): void;
|
|
641
|
-
}
|
|
642
|
-
/**
|
|
643
|
-
* Add a new document to specified `CollectionReference` with the given data,
|
|
644
|
-
* assigning it a document ID automatically.
|
|
645
|
-
*
|
|
646
|
-
* The result of this write will only be reflected in document reads that occur
|
|
647
|
-
* after the returned promise resolves. If the client is offline, the
|
|
648
|
-
* write fails. If you would like to see local modifications or buffer writes
|
|
649
|
-
* until the client is online, use the full Firestore SDK.
|
|
650
|
-
*
|
|
651
|
-
* @param reference - A reference to the collection to add this document to.
|
|
652
|
-
* @param data - An Object containing the data for the new document.
|
|
653
|
-
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
654
|
-
* newly created document after it has been written to the backend.
|
|
655
|
-
*/
|
|
656
|
-
export function addDoc(reference: any, data: any): Promise<DocumentReference>;
|
|
657
|
-
/**
|
|
658
|
-
* Returns a special value that can be used with {@link (setDoc:1)} or {@link
|
|
659
|
-
* updateDoc:1} that tells the server to remove the given elements from any
|
|
660
|
-
* array value that already exists on the server. All instances of each element
|
|
661
|
-
* specified will be removed from the array. If the field being modified is not
|
|
662
|
-
* already an array it will be overwritten with an empty array.
|
|
663
|
-
*
|
|
664
|
-
* @param elements - The elements to remove from the array.
|
|
665
|
-
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
666
|
-
* `updateDoc()`
|
|
667
|
-
*/
|
|
668
|
-
export function arrayRemove(...elements: any[]): ArrayRemoveFieldValueImpl;
|
|
669
|
-
/**
|
|
670
|
-
* Returns a special value that can be used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link
|
|
671
|
-
* @firebase/firestore/lite#(updateDoc:1)} that tells the server to union the given elements with any array
|
|
672
|
-
* value that already exists on the server. Each specified element that doesn't
|
|
673
|
-
* already exist in the array will be added to the end. If the field being
|
|
674
|
-
* modified is not already an array it will be overwritten with an array
|
|
675
|
-
* containing exactly the specified elements.
|
|
676
|
-
*
|
|
677
|
-
* @param elements - The elements to union into the array.
|
|
678
|
-
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
679
|
-
* `updateDoc()`.
|
|
680
|
-
*/
|
|
681
|
-
export function arrayUnion(...elements: any[]): ArrayUnionFieldValueImpl;
|
|
682
|
-
export function collection(parent: any, path: any, ...pathSegments: any[]): CollectionReference;
|
|
683
|
-
/**
|
|
684
|
-
* Creates and returns a new `Query` instance that includes all documents in the
|
|
685
|
-
* database that are contained in a collection or subcollection with the
|
|
686
|
-
* given `collectionId`.
|
|
687
|
-
*
|
|
688
|
-
* @param firestore - A reference to the root `Firestore` instance.
|
|
689
|
-
* @param collectionId - Identifies the collections to query over. Every
|
|
690
|
-
* collection or subcollection with this ID as the last segment of its path
|
|
691
|
-
* will be included. Cannot contain a slash.
|
|
692
|
-
* @returns The created `Query`.
|
|
693
|
-
*/
|
|
694
|
-
export function collectionGroup(firestore: any, collectionId: any): Query;
|
|
695
|
-
/**
|
|
696
|
-
* Modify this instance to communicate with the Cloud Firestore emulator.
|
|
697
|
-
*
|
|
698
|
-
* Note: This must be called before this instance has been used to do any
|
|
699
|
-
* operations.
|
|
700
|
-
*
|
|
701
|
-
* @param firestore - The `Firestore` instance to configure to connect to the
|
|
702
|
-
* emulator.
|
|
703
|
-
* @param host - the emulator host (ex: localhost).
|
|
704
|
-
* @param port - the emulator port (ex: 9000).
|
|
705
|
-
* @param options.mockUserToken - the mock auth token to use for unit testing
|
|
706
|
-
* Security Rules.
|
|
707
|
-
*/
|
|
708
|
-
export function connectFirestoreEmulator(firestore: any, host: any, port: any, options?: {}): void;
|
|
709
|
-
/**
|
|
710
|
-
* Deletes the document referred to by the specified `DocumentReference`.
|
|
711
|
-
*
|
|
712
|
-
* The deletion will only be reflected in document reads that occur after the
|
|
713
|
-
* returned promise resolves. If the client is offline, the
|
|
714
|
-
* delete fails. If you would like to see local modifications or buffer writes
|
|
715
|
-
* until the client is online, use the full Firestore SDK.
|
|
716
|
-
*
|
|
717
|
-
* @param reference - A reference to the document to delete.
|
|
718
|
-
* @returns A `Promise` resolved once the document has been successfully
|
|
719
|
-
* deleted from the backend.
|
|
720
|
-
*/
|
|
721
|
-
export function deleteDoc(reference: any): Promise<void>;
|
|
722
|
-
/**
|
|
723
|
-
* @license
|
|
724
|
-
* Copyright 2020 Google LLC
|
|
725
|
-
*
|
|
726
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
727
|
-
* you may not use this file except in compliance with the License.
|
|
728
|
-
* You may obtain a copy of the License at
|
|
729
|
-
*
|
|
730
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
731
|
-
*
|
|
732
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
733
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
734
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
735
|
-
* See the License for the specific language governing permissions and
|
|
736
|
-
* limitations under the License.
|
|
737
|
-
*/
|
|
738
|
-
/**
|
|
739
|
-
* Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
|
|
740
|
-
* {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
|
|
741
|
-
*/
|
|
742
|
-
export function deleteField(): DeleteFieldValueImpl;
|
|
743
|
-
export function doc(parent: any, path: any, ...pathSegments: any[]): DocumentReference;
|
|
744
|
-
/**
|
|
745
|
-
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
746
|
-
* It can be used in queries to sort or filter by the document ID.
|
|
747
|
-
*/
|
|
748
|
-
export function documentId(): FieldPath;
|
|
749
|
-
export function endAt(...docOrFields: any[]): QueryEndAtConstraint;
|
|
750
|
-
export function endBefore(...docOrFields: any[]): QueryEndAtConstraint;
|
|
751
|
-
/**
|
|
752
|
-
* Reads the document referred to by the specified document reference.
|
|
753
|
-
*
|
|
754
|
-
* All documents are directly fetched from the server, even if the document was
|
|
755
|
-
* previously read or modified. Recent modifications are only reflected in the
|
|
756
|
-
* retrieved `DocumentSnapshot` if they have already been applied by the
|
|
757
|
-
* backend. If the client is offline, the read fails. If you like to use
|
|
758
|
-
* caching or see local modifications, please use the full Firestore SDK.
|
|
759
|
-
*
|
|
760
|
-
* @param reference - The reference of the document to fetch.
|
|
761
|
-
* @returns A Promise resolved with a `DocumentSnapshot` containing the current
|
|
762
|
-
* document contents.
|
|
763
|
-
*/
|
|
764
|
-
export function getDoc(reference: any): Promise<DocumentSnapshot>;
|
|
765
|
-
/**
|
|
766
|
-
* Executes the query and returns the results as a {@link QuerySnapshot}.
|
|
767
|
-
*
|
|
768
|
-
* All queries are executed directly by the server, even if the the query was
|
|
769
|
-
* previously executed. Recent modifications are only reflected in the retrieved
|
|
770
|
-
* results if they have already been applied by the backend. If the client is
|
|
771
|
-
* offline, the operation fails. To see previously cached result and local
|
|
772
|
-
* modifications, use the full Firestore SDK.
|
|
773
|
-
*
|
|
774
|
-
* @param query - The `Query` to execute.
|
|
775
|
-
* @returns A Promise that will be resolved with the results of the query.
|
|
776
|
-
*/
|
|
777
|
-
export function getDocs(query: any): Promise<QuerySnapshot>;
|
|
778
|
-
/**
|
|
779
|
-
* Returns the existing `Firestore` instance that is associated with the
|
|
780
|
-
* provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
|
|
781
|
-
* instance with default settings.
|
|
782
|
-
*
|
|
783
|
-
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
|
|
784
|
-
* instance is associated with.
|
|
785
|
-
* @returns The `Firestore` instance of the provided app.
|
|
786
|
-
*/
|
|
787
|
-
export function getFirestore(app?: import("@firebase/app").FirebaseApp): import("../../lite").Firestore;
|
|
788
|
-
/**
|
|
789
|
-
* Returns a special value that can be used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link
|
|
790
|
-
* @firebase/firestore/lite#(updateDoc:1)} that tells the server to increment the field's current value by
|
|
791
|
-
* the given value.
|
|
792
|
-
*
|
|
793
|
-
* If either the operand or the current field value uses floating point
|
|
794
|
-
* precision, all arithmetic follows IEEE 754 semantics. If both values are
|
|
795
|
-
* integers, values outside of JavaScript's safe number range
|
|
796
|
-
* (`Number.MIN_SAFE_INTEGER` to `Number.MAX_SAFE_INTEGER`) are also subject to
|
|
797
|
-
* precision loss. Furthermore, once processed by the Firestore backend, all
|
|
798
|
-
* integer operations are capped between -2^63 and 2^63-1.
|
|
799
|
-
*
|
|
800
|
-
* If the current field value is not of type `number`, or if the field does not
|
|
801
|
-
* yet exist, the transformation sets the field to the given value.
|
|
802
|
-
*
|
|
803
|
-
* @param n - The value to increment by.
|
|
804
|
-
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
805
|
-
* `updateDoc()`
|
|
806
|
-
*/
|
|
807
|
-
export function increment(n: any): NumericIncrementFieldValueImpl;
|
|
808
|
-
/**
|
|
809
|
-
* Initializes a new instance of Cloud Firestore with the provided settings.
|
|
810
|
-
* Can only be called before any other functions, including
|
|
811
|
-
* {@link getFirestore}. If the custom settings are empty, this function is
|
|
812
|
-
* equivalent to calling {@link getFirestore}.
|
|
813
|
-
*
|
|
814
|
-
* @param app - The {@link @firebase/app#FirebaseApp} with which the `Firestore` instance will
|
|
815
|
-
* be associated.
|
|
816
|
-
* @param settings - A settings object to configure the `Firestore` instance.
|
|
817
|
-
* @returns A newly initialized `Firestore` instance.
|
|
818
|
-
*/
|
|
819
|
-
export function initializeFirestore(app: any, settings: any): import("../../lite").Firestore;
|
|
820
|
-
/**
|
|
821
|
-
* Creates a {@link QueryConstraint} that only returns the first matching documents.
|
|
822
|
-
*
|
|
823
|
-
* @param limit - The maximum number of items to return.
|
|
824
|
-
* @returns The created {@link Query}.
|
|
825
|
-
*/
|
|
826
|
-
export function limit(limit: any): QueryLimitConstraint;
|
|
827
|
-
/**
|
|
828
|
-
* Creates a {@link QueryConstraint} that only returns the last matching documents.
|
|
829
|
-
*
|
|
830
|
-
* You must specify at least one `orderBy` clause for `limitToLast` queries,
|
|
831
|
-
* otherwise an exception will be thrown during execution.
|
|
832
|
-
*
|
|
833
|
-
* @param limit - The maximum number of items to return.
|
|
834
|
-
* @returns The created {@link Query}.
|
|
835
|
-
*/
|
|
836
|
-
export function limitToLast(limit: any): QueryLimitConstraint;
|
|
837
|
-
/**
|
|
838
|
-
* Creates a {@link QueryConstraint} that sorts the query result by the
|
|
839
|
-
* specified field, optionally in descending order instead of ascending.
|
|
840
|
-
*
|
|
841
|
-
* @param fieldPath - The field to sort by.
|
|
842
|
-
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
|
|
843
|
-
* not specified, order will be ascending.
|
|
844
|
-
* @returns The created {@link Query}.
|
|
845
|
-
*/
|
|
846
|
-
export function orderBy(fieldPath: any, directionStr?: string): QueryOrderByConstraint;
|
|
847
|
-
/**
|
|
848
|
-
* Creates a new immutable instance of {@link Query} that is extended to also include
|
|
849
|
-
* additional query constraints.
|
|
850
|
-
*
|
|
851
|
-
* @param query - The {@link Query} instance to use as a base for the new constraints.
|
|
852
|
-
* @param queryConstraints - The list of {@link QueryConstraint}s to apply.
|
|
853
|
-
* @throws if any of the provided query constraints cannot be combined with the
|
|
854
|
-
* existing or new constraints.
|
|
855
|
-
*/
|
|
856
|
-
export function query(query: any, ...queryConstraints: any[]): any;
|
|
857
|
-
/**
|
|
858
|
-
* Returns true if the provided queries point to the same collection and apply
|
|
859
|
-
* the same constraints.
|
|
860
|
-
*
|
|
861
|
-
* @param left - A `Query` to compare.
|
|
862
|
-
* @param right - A `Query` to compare.
|
|
863
|
-
* @returns true if the references point to the same location in the same
|
|
864
|
-
* Firestore database.
|
|
865
|
-
*/
|
|
866
|
-
export function queryEqual(left: any, right: any): boolean;
|
|
867
|
-
/**
|
|
868
|
-
* Returns true if the provided references are equal.
|
|
869
|
-
*
|
|
870
|
-
* @param left - A reference to compare.
|
|
871
|
-
* @param right - A reference to compare.
|
|
872
|
-
* @returns true if the references point to the same location in the same
|
|
873
|
-
* Firestore database.
|
|
874
|
-
*/
|
|
875
|
-
export function refEqual(left: any, right: any): boolean;
|
|
876
|
-
/**
|
|
877
|
-
* Executes the given `updateFunction` and then attempts to commit the changes
|
|
878
|
-
* applied within the transaction. If any document read within the transaction
|
|
879
|
-
* has changed, Cloud Firestore retries the `updateFunction`. If it fails to
|
|
880
|
-
* commit after 5 attempts, the transaction fails.
|
|
881
|
-
*
|
|
882
|
-
* The maximum number of writes allowed in a single transaction is 500.
|
|
883
|
-
*
|
|
884
|
-
* @param firestore - A reference to the Firestore database to run this
|
|
885
|
-
* transaction against.
|
|
886
|
-
* @param updateFunction - The function to execute within the transaction
|
|
887
|
-
* context.
|
|
888
|
-
* @returns If the transaction completed successfully or was explicitly aborted
|
|
889
|
-
* (the `updateFunction` returned a failed promise), the promise returned by the
|
|
890
|
-
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
891
|
-
* rejected promise with the corresponding failure error is returned.
|
|
892
|
-
*/
|
|
893
|
-
export function runTransaction(firestore: any, updateFunction: any): Promise<any>;
|
|
894
|
-
/**
|
|
895
|
-
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
896
|
-
* include a server-generated timestamp in the written data.
|
|
897
|
-
*/
|
|
898
|
-
export function serverTimestamp(): ServerTimestampFieldValueImpl;
|
|
899
|
-
export function setDoc(reference: any, data: any, options: any): Promise<void>;
|
|
900
|
-
/**
|
|
901
|
-
* Sets the verbosity of Cloud Firestore logs (debug, error, or silent).
|
|
902
|
-
*
|
|
903
|
-
* @param logLevel - The verbosity you set for activity and error logging. Can
|
|
904
|
-
* be any of the following values:
|
|
905
|
-
*
|
|
906
|
-
* <ul>
|
|
907
|
-
* <li>`debug` for the most verbose logging level, primarily for
|
|
908
|
-
* debugging.</li>
|
|
909
|
-
* <li>`error` to log errors only.</li>
|
|
910
|
-
* <li><code>`silent` to turn off logging.</li>
|
|
911
|
-
* </ul>
|
|
912
|
-
*/
|
|
913
|
-
export function setLogLevel(logLevel: any): void;
|
|
914
|
-
/**
|
|
915
|
-
* Returns true if the provided snapshots are equal.
|
|
916
|
-
*
|
|
917
|
-
* @param left - A snapshot to compare.
|
|
918
|
-
* @param right - A snapshot to compare.
|
|
919
|
-
* @returns true if the snapshots are equal.
|
|
920
|
-
*/
|
|
921
|
-
export function snapshotEqual(left: any, right: any): any;
|
|
922
|
-
export function startAfter(...docOrFields: any[]): QueryStartAtConstraint;
|
|
923
|
-
export function startAt(...docOrFields: any[]): QueryStartAtConstraint;
|
|
924
|
-
/**
|
|
925
|
-
* Terminates the provided `Firestore` instance.
|
|
926
|
-
*
|
|
927
|
-
* After calling `terminate()` only the `clearIndexedDbPersistence()` functions
|
|
928
|
-
* may be used. Any other function will throw a `FirestoreError`. Termination
|
|
929
|
-
* does not cancel any pending writes, and any promises that are awaiting a
|
|
930
|
-
* response from the server will not be resolved.
|
|
931
|
-
*
|
|
932
|
-
* To restart after termination, create a new instance of `Firestore` with
|
|
933
|
-
* {@link getFirestore}.
|
|
934
|
-
*
|
|
935
|
-
* Note: Under normal circumstances, calling `terminate()` is not required. This
|
|
936
|
-
* function is useful only when you want to force this instance to release all of
|
|
937
|
-
* its resources or in combination with {@link clearIndexedDbPersistence} to
|
|
938
|
-
* ensure that all local state is destroyed between test runs.
|
|
939
|
-
*
|
|
940
|
-
* @param firestore - The `Firestore` instance to terminate.
|
|
941
|
-
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
942
|
-
* terminated.
|
|
943
|
-
*/
|
|
944
|
-
export function terminate(firestore: any): any;
|
|
945
|
-
export function updateDoc(reference: any, fieldOrUpdateData: any, value: any, ...moreFieldsAndValues: any[]): Promise<void>;
|
|
946
|
-
/**
|
|
947
|
-
* Creates a {@link QueryConstraint} that enforces that documents must contain the
|
|
948
|
-
* specified field and that the value should satisfy the relation constraint
|
|
949
|
-
* provided.
|
|
950
|
-
*
|
|
951
|
-
* @param fieldPath - The path to compare
|
|
952
|
-
* @param opStr - The operation string (e.g "<", "<=", "==", "<",
|
|
953
|
-
* "<=", "!=").
|
|
954
|
-
* @param value - The value for comparison
|
|
955
|
-
* @returns The created {@link Query}.
|
|
956
|
-
*/
|
|
957
|
-
export function where(fieldPath: any, opStr: any, value: any): QueryFilterConstraint;
|
|
958
|
-
/**
|
|
959
|
-
* Creates a write batch, used for performing multiple writes as a single
|
|
960
|
-
* atomic operation. The maximum number of writes allowed in a single WriteBatch
|
|
961
|
-
* is 500.
|
|
962
|
-
*
|
|
963
|
-
* The result of these writes will only be reflected in document reads that
|
|
964
|
-
* occur after the returned promise resolves. If the client is offline, the
|
|
965
|
-
* write fails. If you would like to see local modifications or buffer writes
|
|
966
|
-
* until the client is online, use the full Firestore SDK.
|
|
967
|
-
*
|
|
968
|
-
* @returns A `WriteBatch` that can be used to atomically execute multiple
|
|
969
|
-
* writes.
|
|
970
|
-
*/
|
|
971
|
-
export function writeBatch(firestore: any): WriteBatch;
|
|
972
|
-
/**
|
|
973
|
-
* A dot-separated path for navigating sub-objects within a document.
|
|
974
|
-
* @internal
|
|
975
|
-
*/
|
|
976
|
-
declare class FieldPath$1 extends BasePath {
|
|
977
|
-
/**
|
|
978
|
-
* Returns true if the string could be used as a segment in a field path
|
|
979
|
-
* without escaping.
|
|
980
|
-
*/
|
|
981
|
-
static isValidIdentifier(segment: any): boolean;
|
|
982
|
-
/**
|
|
983
|
-
* The field designating the key of a document.
|
|
984
|
-
*/
|
|
985
|
-
static keyField(): FieldPath$1;
|
|
986
|
-
/**
|
|
987
|
-
* Parses a field string from the given server-formatted string.
|
|
988
|
-
*
|
|
989
|
-
* - Splitting the empty string is not allowed (for now at least).
|
|
990
|
-
* - Empty segments within the string (e.g. if there are two consecutive
|
|
991
|
-
* separators) are not allowed.
|
|
992
|
-
*
|
|
993
|
-
* TODO(b/37244157): we should make this more strict. Right now, it allows
|
|
994
|
-
* non-identifier path components, even if they aren't escaped.
|
|
995
|
-
*/
|
|
996
|
-
static fromServerFormat(path: any): FieldPath$1;
|
|
997
|
-
static emptyPath(): FieldPath$1;
|
|
998
|
-
construct(segments: any, offset: any, length: any): FieldPath$1;
|
|
999
|
-
canonicalString(): any;
|
|
1000
|
-
toString(): any;
|
|
1001
|
-
/**
|
|
1002
|
-
* Returns true if this field references the key of a document.
|
|
1003
|
-
*/
|
|
1004
|
-
isKeyField(): boolean;
|
|
1005
|
-
}
|
|
1006
|
-
/**
|
|
1007
|
-
* A concrete type describing all the values that can be applied via a
|
|
1008
|
-
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
1009
|
-
* defaults can be supplied and the value can be checked for equality.
|
|
1010
|
-
*/
|
|
1011
|
-
declare class FirestoreSettingsImpl {
|
|
1012
|
-
constructor(settings: any);
|
|
1013
|
-
host: any;
|
|
1014
|
-
ssl: any;
|
|
1015
|
-
credentials: any;
|
|
1016
|
-
ignoreUndefinedProperties: boolean;
|
|
1017
|
-
cacheSizeBytes: any;
|
|
1018
|
-
experimentalForceLongPolling: boolean;
|
|
1019
|
-
experimentalAutoDetectLongPolling: boolean;
|
|
1020
|
-
useFetchStreams: boolean;
|
|
1021
|
-
isEqual(other: any): boolean;
|
|
1022
|
-
}
|
|
1023
|
-
/**
|
|
1024
|
-
* Represents the database ID a Firestore client is associated with.
|
|
1025
|
-
* @internal
|
|
1026
|
-
*/
|
|
1027
|
-
declare class DatabaseId {
|
|
1028
|
-
constructor(projectId: any, database: any);
|
|
1029
|
-
projectId: any;
|
|
1030
|
-
database: any;
|
|
1031
|
-
get isDefaultDatabase(): boolean;
|
|
1032
|
-
isEqual(other: any): boolean;
|
|
1033
|
-
}
|
|
1034
|
-
/**
|
|
1035
|
-
* Helper for parsing raw user input (provided via the API) into internal model
|
|
1036
|
-
* classes.
|
|
1037
|
-
*/
|
|
1038
|
-
declare class UserDataReader {
|
|
1039
|
-
constructor(databaseId: any, ignoreUndefinedProperties: any, serializer: any);
|
|
1040
|
-
databaseId: any;
|
|
1041
|
-
ignoreUndefinedProperties: any;
|
|
1042
|
-
serializer: any;
|
|
1043
|
-
/** Creates a new top-level parse context. */
|
|
1044
|
-
createContext(dataSource: any, methodName: any, targetDoc: any, hasConverter?: boolean): ParseContextImpl;
|
|
1045
|
-
}
|
|
1046
|
-
declare class ArrayRemoveFieldValueImpl extends FieldValue {
|
|
1047
|
-
constructor(methodName: any, _elements: any);
|
|
1048
|
-
_elements: any;
|
|
1049
|
-
_toFieldTransform(context: any): FieldTransform;
|
|
1050
|
-
isEqual(other: any): boolean;
|
|
1051
|
-
}
|
|
1052
|
-
declare class ArrayUnionFieldValueImpl extends FieldValue {
|
|
1053
|
-
constructor(methodName: any, _elements: any);
|
|
1054
|
-
_elements: any;
|
|
1055
|
-
_toFieldTransform(context: any): FieldTransform;
|
|
1056
|
-
isEqual(other: any): boolean;
|
|
1057
|
-
}
|
|
1058
|
-
declare class DeleteFieldValueImpl extends FieldValue {
|
|
1059
|
-
_toFieldTransform(context: any): null;
|
|
1060
|
-
isEqual(other: any): boolean;
|
|
1061
|
-
}
|
|
1062
|
-
declare class QueryEndAtConstraint extends QueryConstraint {
|
|
1063
|
-
constructor(type: any, _docOrFields: any, _before: any);
|
|
1064
|
-
type: any;
|
|
1065
|
-
_docOrFields: any;
|
|
1066
|
-
_before: any;
|
|
1067
|
-
_apply(query: any): Query;
|
|
1068
|
-
}
|
|
1069
|
-
declare class NumericIncrementFieldValueImpl extends FieldValue {
|
|
1070
|
-
constructor(methodName: any, _operand: any);
|
|
1071
|
-
_operand: any;
|
|
1072
|
-
_toFieldTransform(context: any): FieldTransform;
|
|
1073
|
-
isEqual(other: any): boolean;
|
|
1074
|
-
}
|
|
1075
|
-
declare class QueryLimitConstraint extends QueryConstraint {
|
|
1076
|
-
constructor(type: any, _limit: any, _limitType: any);
|
|
1077
|
-
type: any;
|
|
1078
|
-
_limit: any;
|
|
1079
|
-
_limitType: any;
|
|
1080
|
-
_apply(query: any): Query;
|
|
1081
|
-
}
|
|
1082
|
-
declare class QueryOrderByConstraint extends QueryConstraint {
|
|
1083
|
-
constructor(_field: any, _direction: any);
|
|
1084
|
-
_field: any;
|
|
1085
|
-
_direction: any;
|
|
1086
|
-
type: string;
|
|
1087
|
-
_apply(query: any): Query;
|
|
1088
|
-
}
|
|
1089
|
-
declare class ServerTimestampFieldValueImpl extends FieldValue {
|
|
1090
|
-
_toFieldTransform(context: any): FieldTransform;
|
|
1091
|
-
isEqual(other: any): boolean;
|
|
1092
|
-
}
|
|
1093
|
-
declare class QueryStartAtConstraint extends QueryConstraint {
|
|
1094
|
-
constructor(type: any, _docOrFields: any, _before: any);
|
|
1095
|
-
type: any;
|
|
1096
|
-
_docOrFields: any;
|
|
1097
|
-
_before: any;
|
|
1098
|
-
_apply(query: any): Query;
|
|
1099
|
-
}
|
|
1100
|
-
declare class QueryFilterConstraint extends QueryConstraint {
|
|
1101
|
-
constructor(_field: any, _op: any, _value: any);
|
|
1102
|
-
_field: any;
|
|
1103
|
-
_op: any;
|
|
1104
|
-
_value: any;
|
|
1105
|
-
type: string;
|
|
1106
|
-
_apply(query: any): Query;
|
|
1107
|
-
}
|
|
1108
|
-
/**
|
|
1109
|
-
* Path represents an ordered sequence of string segments.
|
|
1110
|
-
*/
|
|
1111
|
-
declare class BasePath {
|
|
1112
|
-
static comparator(p1: any, p2: any): 0 | 1 | -1;
|
|
1113
|
-
constructor(segments: any, offset: any, length: any);
|
|
1114
|
-
segments: any;
|
|
1115
|
-
offset: any;
|
|
1116
|
-
len: any;
|
|
1117
|
-
get length(): any;
|
|
1118
|
-
isEqual(other: any): boolean;
|
|
1119
|
-
child(nameOrPath: any): any;
|
|
1120
|
-
/** The index of one past the last segment of the path. */
|
|
1121
|
-
limit(): any;
|
|
1122
|
-
popFirst(size: any): any;
|
|
1123
|
-
popLast(): any;
|
|
1124
|
-
firstSegment(): any;
|
|
1125
|
-
lastSegment(): any;
|
|
1126
|
-
get(index: any): any;
|
|
1127
|
-
isEmpty(): boolean;
|
|
1128
|
-
isPrefixOf(other: any): boolean;
|
|
1129
|
-
isImmediateParentOf(potentialChild: any): boolean;
|
|
1130
|
-
forEach(fn: any): void;
|
|
1131
|
-
toArray(): any;
|
|
1132
|
-
}
|
|
1133
|
-
/** A "context" object passed around while parsing user data. */
|
|
1134
|
-
declare class ParseContextImpl {
|
|
1135
|
-
/**
|
|
1136
|
-
* Initializes a ParseContext with the given source and path.
|
|
1137
|
-
*
|
|
1138
|
-
* @param settings - The settings for the parser.
|
|
1139
|
-
* @param databaseId - The database ID of the Firestore instance.
|
|
1140
|
-
* @param serializer - The serializer to use to generate the Value proto.
|
|
1141
|
-
* @param ignoreUndefinedProperties - Whether to ignore undefined properties
|
|
1142
|
-
* rather than throw.
|
|
1143
|
-
* @param fieldTransforms - A mutable list of field transforms encountered
|
|
1144
|
-
* while parsing the data.
|
|
1145
|
-
* @param fieldMask - A mutable list of field paths encountered while parsing
|
|
1146
|
-
* the data.
|
|
1147
|
-
*
|
|
1148
|
-
* TODO(b/34871131): We don't support array paths right now, so path can be
|
|
1149
|
-
* null to indicate the context represents any location within an array (in
|
|
1150
|
-
* which case certain features will not work and errors will be somewhat
|
|
1151
|
-
* compromised).
|
|
1152
|
-
*/
|
|
1153
|
-
constructor(settings: any, databaseId: any, serializer: any, ignoreUndefinedProperties: any, fieldTransforms: any, fieldMask: any);
|
|
1154
|
-
settings: any;
|
|
1155
|
-
databaseId: any;
|
|
1156
|
-
serializer: any;
|
|
1157
|
-
ignoreUndefinedProperties: any;
|
|
1158
|
-
fieldTransforms: any;
|
|
1159
|
-
fieldMask: any;
|
|
1160
|
-
get path(): any;
|
|
1161
|
-
get dataSource(): any;
|
|
1162
|
-
/** Returns a new context with the specified settings overwritten. */
|
|
1163
|
-
contextWith(configuration: any): ParseContextImpl;
|
|
1164
|
-
childContextForField(field: any): ParseContextImpl;
|
|
1165
|
-
childContextForFieldPath(field: any): ParseContextImpl;
|
|
1166
|
-
childContextForArray(index: any): ParseContextImpl;
|
|
1167
|
-
createError(reason: any): FirestoreError;
|
|
1168
|
-
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */
|
|
1169
|
-
contains(fieldPath: any): boolean;
|
|
1170
|
-
validatePath(): void;
|
|
1171
|
-
validatePathSegment(segment: any): void;
|
|
1172
|
-
}
|
|
1173
|
-
/**
|
|
1174
|
-
* @license
|
|
1175
|
-
* Copyright 2017 Google LLC
|
|
1176
|
-
*
|
|
1177
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1178
|
-
* you may not use this file except in compliance with the License.
|
|
1179
|
-
* You may obtain a copy of the License at
|
|
1180
|
-
*
|
|
1181
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1182
|
-
*
|
|
1183
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1184
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1185
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1186
|
-
* See the License for the specific language governing permissions and
|
|
1187
|
-
* limitations under the License.
|
|
1188
|
-
*/
|
|
1189
|
-
/** A field path and the TransformOperation to perform upon it. */
|
|
1190
|
-
declare class FieldTransform {
|
|
1191
|
-
constructor(field: any, transform: any);
|
|
1192
|
-
field: any;
|
|
1193
|
-
transform: any;
|
|
1194
|
-
}
|
|
1195
|
-
export {};
|