@firebase/firestore 3.4.1 → 3.4.2-202205224240
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 +13 -0
- package/dist/firestore/src/index/directional_index_byte_encoder.d.ts +24 -0
- package/dist/firestore/src/index/firestore_index_value_writer.d.ts +33 -0
- package/dist/firestore/src/index/index_byte_encoder.d.ts +14 -0
- package/dist/firestore/src/index/ordered_code_writer.d.ts +60 -0
- package/dist/firestore/src/lite-api/reference.d.ts +4 -2
- package/dist/firestore/src/lite-api/reference_impl.d.ts +5 -0
- package/dist/firestore/src/lite-api/transaction.d.ts +4 -0
- package/dist/firestore/src/lite-api/write_batch.d.ts +3 -0
- package/dist/firestore/src/local/indexeddb_remote_document_cache.d.ts +5 -0
- package/dist/firestore/src/model/collections.d.ts +0 -4
- package/dist/firestore/src/model/document.d.ts +3 -1
- package/dist/firestore/src/model/values.d.ts +3 -0
- package/dist/firestore/src/util/byte_string.d.ts +1 -0
- package/dist/firestore/src/util/error.d.ts +2 -3
- package/dist/firestore/test/unit/index/ordered_code_writer.test.d.ts +1 -0
- package/dist/firestore/test/util/helpers.d.ts +1 -0
- package/dist/index.d.ts +13 -21
- package/dist/index.esm2017.js +2649 -2640
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +2640 -2630
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +42 -24
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +43 -25
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +2839 -2830
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +18 -22
- package/dist/lite/firestore/src/index/directional_index_byte_encoder.d.ts +24 -0
- package/dist/lite/firestore/src/index/firestore_index_value_writer.d.ts +33 -0
- package/dist/lite/firestore/src/index/index_byte_encoder.d.ts +14 -0
- package/dist/lite/firestore/src/index/ordered_code_writer.d.ts +60 -0
- package/dist/lite/firestore/src/lite-api/reference.d.ts +4 -2
- package/dist/lite/firestore/src/lite-api/reference_impl.d.ts +5 -0
- package/dist/lite/firestore/src/lite-api/transaction.d.ts +4 -0
- package/dist/lite/firestore/src/lite-api/write_batch.d.ts +3 -0
- package/dist/lite/firestore/src/local/indexeddb_remote_document_cache.d.ts +5 -0
- package/dist/lite/firestore/src/model/collections.d.ts +0 -4
- package/dist/lite/firestore/src/model/document.d.ts +3 -1
- package/dist/lite/firestore/src/model/values.d.ts +3 -0
- package/dist/lite/firestore/src/util/byte_string.d.ts +1 -0
- package/dist/lite/firestore/src/util/error.d.ts +2 -3
- package/dist/lite/firestore/test/unit/index/ordered_code_writer.test.d.ts +1 -0
- package/dist/lite/firestore/test/util/helpers.d.ts +1 -0
- package/dist/lite/index.browser.esm2017.js +1378 -1365
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +842 -828
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.d.ts +18 -21
- package/dist/lite/index.node.cjs.js +25 -7
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +26 -8
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +849 -836
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +86 -21
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +142 -141
- package/dist/lite/packages/firestore/src/index/directional_index_byte_encoder.d.ts +24 -0
- package/dist/lite/packages/firestore/src/index/firestore_index_value_writer.d.ts +33 -0
- package/dist/lite/packages/firestore/src/index/index_byte_encoder.d.ts +14 -0
- package/dist/lite/packages/firestore/src/index/ordered_code_writer.d.ts +60 -0
- package/dist/lite/packages/firestore/src/lite-api/reference.d.ts +4 -2
- package/dist/lite/packages/firestore/src/lite-api/reference_impl.d.ts +5 -0
- package/dist/lite/packages/firestore/src/lite-api/transaction.d.ts +4 -0
- package/dist/lite/packages/firestore/src/lite-api/write_batch.d.ts +3 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +5 -0
- package/dist/lite/packages/firestore/src/model/collections.d.ts +0 -4
- package/dist/lite/packages/firestore/src/model/document.d.ts +3 -1
- package/dist/lite/packages/firestore/src/model/values.d.ts +3 -0
- package/dist/lite/packages/firestore/src/util/byte_string.d.ts +1 -0
- package/dist/lite/packages/firestore/src/util/error.d.ts +2 -3
- package/dist/lite/packages/firestore/test/unit/index/ordered_code_writer.test.d.ts +1 -0
- package/dist/lite/packages/firestore/test/util/helpers.d.ts +1 -0
- package/dist/lite/private.d.ts +85 -21
- package/dist/packages/firestore/dist/index.esm2017.d.ts +152 -152
- package/dist/packages/firestore/src/index/directional_index_byte_encoder.d.ts +24 -0
- package/dist/packages/firestore/src/index/firestore_index_value_writer.d.ts +33 -0
- package/dist/packages/firestore/src/index/index_byte_encoder.d.ts +14 -0
- package/dist/packages/firestore/src/index/ordered_code_writer.d.ts +60 -0
- package/dist/packages/firestore/src/lite-api/reference.d.ts +4 -2
- package/dist/packages/firestore/src/lite-api/reference_impl.d.ts +5 -0
- package/dist/packages/firestore/src/lite-api/transaction.d.ts +4 -0
- package/dist/packages/firestore/src/lite-api/write_batch.d.ts +3 -0
- package/dist/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +5 -0
- package/dist/packages/firestore/src/model/collections.d.ts +0 -4
- package/dist/packages/firestore/src/model/document.d.ts +3 -1
- package/dist/packages/firestore/src/model/values.d.ts +3 -0
- package/dist/packages/firestore/src/util/byte_string.d.ts +1 -0
- package/dist/packages/firestore/src/util/error.d.ts +2 -3
- package/dist/packages/firestore/test/unit/index/ordered_code_writer.test.d.ts +1 -0
- package/dist/packages/firestore/test/util/helpers.d.ts +1 -0
- package/dist/private.d.ts +17 -22
- package/package.json +7 -7
package/dist/lite/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import { FirebaseApp } from '@firebase/app';
|
|
10
10
|
import { LogLevelString as LogLevel } from '@firebase/logger';
|
|
11
11
|
import { EmulatorMockTokenOptions } from '@firebase/util';
|
|
12
|
+
import { FirebaseError } from '@firebase/util';
|
|
12
13
|
|
|
13
14
|
/* Excluded from this release type: AbstractUserDataWriter */
|
|
14
15
|
/**
|
|
@@ -22,6 +23,7 @@ import { EmulatorMockTokenOptions } from '@firebase/util';
|
|
|
22
23
|
*
|
|
23
24
|
* @param reference - A reference to the collection to add this document to.
|
|
24
25
|
* @param data - An Object containing the data for the new document.
|
|
26
|
+
* @throws Error - If the provided input is not a valid Firestore document.
|
|
25
27
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
26
28
|
* newly created document after it has been written to the backend.
|
|
27
29
|
*/
|
|
@@ -552,7 +554,7 @@ export declare interface FirestoreDataConverter<T> {
|
|
|
552
554
|
fromFirestore(snapshot: QueryDocumentSnapshot<DocumentData>): T;
|
|
553
555
|
}
|
|
554
556
|
/** An error returned by a Firestore operation. */
|
|
555
|
-
export declare class FirestoreError extends
|
|
557
|
+
export declare class FirestoreError extends FirebaseError {
|
|
556
558
|
/**
|
|
557
559
|
* The backend error code associated with this error.
|
|
558
560
|
*/
|
|
@@ -561,28 +563,10 @@ export declare class FirestoreError extends Error {
|
|
|
561
563
|
* A custom error description.
|
|
562
564
|
*/
|
|
563
565
|
readonly message: string;
|
|
564
|
-
/** The custom name for all FirestoreErrors. */
|
|
565
|
-
readonly name: string;
|
|
566
566
|
/** The stack of the error. */
|
|
567
567
|
readonly stack?: string;
|
|
568
568
|
private constructor();
|
|
569
569
|
}
|
|
570
|
-
/**
|
|
571
|
-
* @license
|
|
572
|
-
* Copyright 2017 Google LLC
|
|
573
|
-
*
|
|
574
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
575
|
-
* you may not use this file except in compliance with the License.
|
|
576
|
-
* You may obtain a copy of the License at
|
|
577
|
-
*
|
|
578
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
579
|
-
*
|
|
580
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
581
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
582
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
583
|
-
* See the License for the specific language governing permissions and
|
|
584
|
-
* limitations under the License.
|
|
585
|
-
*/
|
|
586
570
|
/**
|
|
587
571
|
* The set of Firestore status codes. The codes are the same at the ones
|
|
588
572
|
* exposed by gRPC here:
|
|
@@ -961,6 +945,7 @@ export declare function serverTimestamp(): FieldValue;
|
|
|
961
945
|
*
|
|
962
946
|
* @param reference - A reference to the document to write.
|
|
963
947
|
* @param data - A map of the fields and values for the document.
|
|
948
|
+
* @throws Error - If the provided input is not a valid Firestore document.
|
|
964
949
|
* @returns A `Promise` resolved once the data has been successfully written
|
|
965
950
|
* to the backend.
|
|
966
951
|
*/
|
|
@@ -978,6 +963,7 @@ export declare function setDoc<T>(reference: DocumentReference<T>, data: WithFie
|
|
|
978
963
|
* @param reference - A reference to the document to write.
|
|
979
964
|
* @param data - A map of the fields and values for the document.
|
|
980
965
|
* @param options - An object to configure the set behavior.
|
|
966
|
+
* @throws Error - If the provided input is not a valid Firestore document.
|
|
981
967
|
* @returns A `Promise` resolved once the data has been successfully written
|
|
982
968
|
* to the backend.
|
|
983
969
|
*/
|
|
@@ -1004,10 +990,12 @@ export declare function setLogLevel(logLevel: LogLevel): void;
|
|
|
1004
990
|
*
|
|
1005
991
|
* @param merge - Changes the behavior of a `setDoc()` call to only replace the
|
|
1006
992
|
* values specified in its data argument. Fields omitted from the `setDoc()`
|
|
1007
|
-
* call remain untouched.
|
|
993
|
+
* call remain untouched. If your input sets any field to an empty map, all
|
|
994
|
+
* nested fields are overwritten.
|
|
1008
995
|
* @param mergeFields - Changes the behavior of `setDoc()` calls to only replace
|
|
1009
996
|
* the specified field paths. Any field path that is not specified is ignored
|
|
1010
|
-
* and remains untouched.
|
|
997
|
+
* and remains untouched. If your input sets any field to an empty map, all
|
|
998
|
+
* nested fields are overwritten.
|
|
1011
999
|
*/
|
|
1012
1000
|
export declare type SetOptions = {
|
|
1013
1001
|
readonly merge?: boolean;
|
|
@@ -1241,6 +1229,7 @@ export declare class Transaction {
|
|
|
1241
1229
|
*
|
|
1242
1230
|
* @param documentRef - A reference to the document to be set.
|
|
1243
1231
|
* @param data - An object of the fields and values for the document.
|
|
1232
|
+
* @throws Error - If the provided input is not a valid Firestore document.
|
|
1244
1233
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
1245
1234
|
*/
|
|
1246
1235
|
set<T>(documentRef: DocumentReference<T>, data: WithFieldValue<T>): this;
|
|
@@ -1253,6 +1242,7 @@ export declare class Transaction {
|
|
|
1253
1242
|
* @param documentRef - A reference to the document to be set.
|
|
1254
1243
|
* @param data - An object of the fields and values for the document.
|
|
1255
1244
|
* @param options - An object to configure the set behavior.
|
|
1245
|
+
* @throws Error - If the provided input is not a valid Firestore document.
|
|
1256
1246
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
1257
1247
|
*/
|
|
1258
1248
|
set<T>(documentRef: DocumentReference<T>, data: PartialWithFieldValue<T>, options: SetOptions): this;
|
|
@@ -1265,6 +1255,7 @@ export declare class Transaction {
|
|
|
1265
1255
|
* @param data - An object containing the fields and values with which to
|
|
1266
1256
|
* update the document. Fields can contain dots to reference nested fields
|
|
1267
1257
|
* within the document.
|
|
1258
|
+
* @throws Error - If the provided input is not valid Firestore data.
|
|
1268
1259
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
1269
1260
|
*/
|
|
1270
1261
|
update<T>(documentRef: DocumentReference<T>, data: UpdateData<T>): this;
|
|
@@ -1280,6 +1271,7 @@ export declare class Transaction {
|
|
|
1280
1271
|
* @param field - The first field to update.
|
|
1281
1272
|
* @param value - The first value.
|
|
1282
1273
|
* @param moreFieldsAndValues - Additional key/value pairs.
|
|
1274
|
+
* @throws Error - If the provided input is not valid Firestore data.
|
|
1283
1275
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
1284
1276
|
*/
|
|
1285
1277
|
update(documentRef: DocumentReference<unknown>, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): this;
|
|
@@ -1325,6 +1317,7 @@ export declare type UpdateData<T> = T extends Primitive ? T : T extends {} ? {
|
|
|
1325
1317
|
* @param data - An object containing the fields and values with which to
|
|
1326
1318
|
* update the document. Fields can contain dots to reference nested fields
|
|
1327
1319
|
* within the document.
|
|
1320
|
+
* @throws Error - If the provided input is not valid Firestore data.
|
|
1328
1321
|
* @returns A `Promise` resolved once the data has been successfully written
|
|
1329
1322
|
* to the backend.
|
|
1330
1323
|
*/
|
|
@@ -1346,6 +1339,7 @@ export declare function updateDoc<T>(reference: DocumentReference<T>, data: Upda
|
|
|
1346
1339
|
* @param field - The first field to update.
|
|
1347
1340
|
* @param value - The first value.
|
|
1348
1341
|
* @param moreFieldsAndValues - Additional key value pairs.
|
|
1342
|
+
* @throws Error - If the provided input is not valid Firestore data.
|
|
1349
1343
|
* @returns A `Promise` resolved once the data has been successfully written
|
|
1350
1344
|
* to the backend.
|
|
1351
1345
|
*/
|
|
@@ -1403,6 +1397,7 @@ export declare class WriteBatch {
|
|
|
1403
1397
|
* @param documentRef - A reference to the document to be set.
|
|
1404
1398
|
* @param data - An object of the fields and values for the document.
|
|
1405
1399
|
* @param options - An object to configure the set behavior.
|
|
1400
|
+
* @throws Error - If the provided input is not a valid Firestore document.
|
|
1406
1401
|
* @returns This `WriteBatch` instance. Used for chaining method calls.
|
|
1407
1402
|
*/
|
|
1408
1403
|
set<T>(documentRef: DocumentReference<T>, data: PartialWithFieldValue<T>, options: SetOptions): WriteBatch;
|
|
@@ -1415,6 +1410,7 @@ export declare class WriteBatch {
|
|
|
1415
1410
|
* @param data - An object containing the fields and values with which to
|
|
1416
1411
|
* update the document. Fields can contain dots to reference nested fields
|
|
1417
1412
|
* within the document.
|
|
1413
|
+
* @throws Error - If the provided input is not valid Firestore data.
|
|
1418
1414
|
* @returns This `WriteBatch` instance. Used for chaining method calls.
|
|
1419
1415
|
*/
|
|
1420
1416
|
update<T>(documentRef: DocumentReference<T>, data: UpdateData<T>): WriteBatch;
|
|
@@ -1430,6 +1426,7 @@ export declare class WriteBatch {
|
|
|
1430
1426
|
* @param field - The first field to update.
|
|
1431
1427
|
* @param value - The first value.
|
|
1432
1428
|
* @param moreFieldsAndValues - Additional key value pairs.
|
|
1429
|
+
* @throws Error - If the provided input is not valid Firestore data.
|
|
1433
1430
|
* @returns This `WriteBatch` instance. Used for chaining method calls.
|
|
1434
1431
|
*/
|
|
1435
1432
|
update(documentRef: DocumentReference<unknown>, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): WriteBatch;
|
|
@@ -14,7 +14,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
14
14
|
|
|
15
15
|
var nodeFetch__default = /*#__PURE__*/_interopDefaultLegacy(nodeFetch);
|
|
16
16
|
|
|
17
|
-
const version$1 = "3.4.
|
|
17
|
+
const version$1 = "3.4.2-202205224240";
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* @license
|
|
@@ -67,7 +67,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
|
|
|
67
67
|
User.FIRST_PARTY = new User('first-party-uid');
|
|
68
68
|
User.MOCK_USER = new User('mock-user');
|
|
69
69
|
|
|
70
|
-
const version = "9.6.
|
|
70
|
+
const version = "9.6.2-202205224240";
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* @license
|
|
@@ -368,7 +368,7 @@ const Code = {
|
|
|
368
368
|
DATA_LOSS: 'data-loss'
|
|
369
369
|
};
|
|
370
370
|
/** An error returned by a Firestore operation. */
|
|
371
|
-
class FirestoreError extends
|
|
371
|
+
class FirestoreError extends util.FirebaseError {
|
|
372
372
|
/** @hideconstructor */
|
|
373
373
|
constructor(
|
|
374
374
|
/**
|
|
@@ -379,11 +379,9 @@ class FirestoreError extends Error {
|
|
|
379
379
|
* A custom error description.
|
|
380
380
|
*/
|
|
381
381
|
message) {
|
|
382
|
-
super(message);
|
|
382
|
+
super(code, message);
|
|
383
383
|
this.code = code;
|
|
384
384
|
this.message = message;
|
|
385
|
-
/** The custom name for all FirestoreErrors. */
|
|
386
|
-
this.name = 'FirebaseError';
|
|
387
385
|
// HACK: We write a toString property directly because Error is not a real
|
|
388
386
|
// class and so inheritance does not work correctly. We could alternatively
|
|
389
387
|
// do the same "back-door inheritance" trick that FirebaseError does.
|
|
@@ -1924,6 +1922,19 @@ class ByteString {
|
|
|
1924
1922
|
const binaryString = binaryStringFromUint8Array(array);
|
|
1925
1923
|
return new ByteString(binaryString);
|
|
1926
1924
|
}
|
|
1925
|
+
[Symbol.iterator]() {
|
|
1926
|
+
let i = 0;
|
|
1927
|
+
return {
|
|
1928
|
+
next: () => {
|
|
1929
|
+
if (i < this.binaryString.length) {
|
|
1930
|
+
return { value: this.binaryString.charCodeAt(i++), done: false };
|
|
1931
|
+
}
|
|
1932
|
+
else {
|
|
1933
|
+
return { value: undefined, done: true };
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
};
|
|
1937
|
+
}
|
|
1927
1938
|
toBase64() {
|
|
1928
1939
|
return encodeBase64(this.binaryString);
|
|
1929
1940
|
}
|
|
@@ -2203,6 +2214,9 @@ function typeOrder(value) {
|
|
|
2203
2214
|
}
|
|
2204
2215
|
/** Tests `left` and `right` for equality based on the backend semantics. */
|
|
2205
2216
|
function valueEquals(left, right) {
|
|
2217
|
+
if (left === right) {
|
|
2218
|
+
return true;
|
|
2219
|
+
}
|
|
2206
2220
|
const leftType = typeOrder(left);
|
|
2207
2221
|
const rightType = typeOrder(right);
|
|
2208
2222
|
if (leftType !== rightType) {
|
|
@@ -2293,6 +2307,9 @@ function arrayValueContains(haystack, needle) {
|
|
|
2293
2307
|
return ((haystack.values || []).find(v => valueEquals(v, needle)) !== undefined);
|
|
2294
2308
|
}
|
|
2295
2309
|
function valueCompare(left, right) {
|
|
2310
|
+
if (left === right) {
|
|
2311
|
+
return 0;
|
|
2312
|
+
}
|
|
2296
2313
|
const leftType = typeOrder(left);
|
|
2297
2314
|
const rightType = typeOrder(right);
|
|
2298
2315
|
if (leftType !== rightType) {
|
|
@@ -2733,7 +2750,7 @@ class MutableDocument {
|
|
|
2733
2750
|
this.documentState === other.documentState &&
|
|
2734
2751
|
this.data.isEqual(other.data));
|
|
2735
2752
|
}
|
|
2736
|
-
|
|
2753
|
+
mutableCopy() {
|
|
2737
2754
|
return new MutableDocument(this.key, this.documentType, this.version, this.data.clone(), this.documentState);
|
|
2738
2755
|
}
|
|
2739
2756
|
toString() {
|
|
@@ -6711,6 +6728,7 @@ function deleteDoc(reference) {
|
|
|
6711
6728
|
*
|
|
6712
6729
|
* @param reference - A reference to the collection to add this document to.
|
|
6713
6730
|
* @param data - An Object containing the data for the new document.
|
|
6731
|
+
* @throws Error - If the provided input is not a valid Firestore document.
|
|
6714
6732
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
6715
6733
|
* newly created document after it has been written to the backend.
|
|
6716
6734
|
*/
|