@firebase/firestore 3.4.3 → 3.4.4-canary.aaeab08ac
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 +10 -0
- package/dist/firestore/src/api/database.d.ts +14 -9
- package/dist/firestore/src/api/index_configuration.d.ts +117 -0
- package/dist/firestore/src/api.d.ts +1 -0
- package/dist/firestore/src/core/firestore_client.d.ts +2 -0
- package/dist/firestore/src/local/local_serializer.d.ts +1 -1
- package/dist/firestore/src/local/remote_document_change_buffer.d.ts +3 -12
- package/dist/firestore/src/model/document.d.ts +7 -0
- package/dist/firestore/src/model/document_key.d.ts +1 -0
- package/dist/firestore/src/model/field_index.d.ts +152 -0
- package/dist/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
- package/dist/firestore/test/unit/local/test_remote_document_cache.d.ts +1 -1
- package/dist/firestore/test/unit/model/field_index.test.d.ts +17 -0
- package/dist/firestore/test/util/helpers.d.ts +6 -0
- package/dist/index.d.ts +15 -9
- package/dist/index.esm2017.js +1204 -1052
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +1862 -1720
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +308 -75
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +308 -76
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +1204 -1052
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +131 -21
- package/dist/lite/firestore/src/api/database.d.ts +14 -9
- package/dist/lite/firestore/src/api/index_configuration.d.ts +117 -0
- package/dist/lite/firestore/src/api.d.ts +1 -0
- package/dist/lite/firestore/src/core/firestore_client.d.ts +2 -0
- package/dist/lite/firestore/src/local/local_serializer.d.ts +1 -1
- package/dist/lite/firestore/src/local/remote_document_change_buffer.d.ts +3 -12
- package/dist/lite/firestore/src/model/document.d.ts +7 -0
- package/dist/lite/firestore/src/model/document_key.d.ts +1 -0
- package/dist/lite/firestore/src/model/field_index.d.ts +152 -0
- package/dist/lite/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
- package/dist/lite/firestore/test/unit/local/test_remote_document_cache.d.ts +1 -1
- package/dist/lite/firestore/test/unit/model/field_index.test.d.ts +17 -0
- package/dist/lite/firestore/test/util/helpers.d.ts +6 -0
- package/dist/lite/index.browser.esm2017.js +76 -69
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +52 -47
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +16 -8
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +16 -8
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +95 -88
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +8 -0
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +19 -19
- package/dist/lite/packages/firestore/src/api/database.d.ts +14 -9
- package/dist/lite/packages/firestore/src/api/index_configuration.d.ts +117 -0
- package/dist/lite/packages/firestore/src/api.d.ts +1 -0
- package/dist/lite/packages/firestore/src/core/firestore_client.d.ts +2 -0
- package/dist/lite/packages/firestore/src/local/local_serializer.d.ts +1 -1
- package/dist/lite/packages/firestore/src/local/remote_document_change_buffer.d.ts +3 -12
- package/dist/lite/packages/firestore/src/model/document.d.ts +7 -0
- package/dist/lite/packages/firestore/src/model/document_key.d.ts +1 -0
- package/dist/lite/packages/firestore/src/model/field_index.d.ts +152 -0
- package/dist/lite/packages/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
- package/dist/lite/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +1 -1
- package/dist/lite/packages/firestore/test/unit/model/field_index.test.d.ts +17 -0
- package/dist/lite/packages/firestore/test/util/helpers.d.ts +6 -0
- package/dist/lite/private.d.ts +7 -0
- package/dist/packages/firestore/dist/index.esm2017.d.ts +34 -12
- package/dist/packages/firestore/src/api/database.d.ts +14 -9
- package/dist/packages/firestore/src/api/index_configuration.d.ts +117 -0
- package/dist/packages/firestore/src/api.d.ts +1 -0
- package/dist/packages/firestore/src/core/firestore_client.d.ts +2 -0
- package/dist/packages/firestore/src/local/local_serializer.d.ts +1 -1
- package/dist/packages/firestore/src/local/remote_document_change_buffer.d.ts +3 -12
- package/dist/packages/firestore/src/model/document.d.ts +7 -0
- package/dist/packages/firestore/src/model/document_key.d.ts +1 -0
- package/dist/packages/firestore/src/model/field_index.d.ts +152 -0
- package/dist/packages/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
- package/dist/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +1 -1
- package/dist/packages/firestore/test/unit/model/field_index.test.d.ts +17 -0
- package/dist/packages/firestore/test/util/helpers.d.ts +6 -0
- package/dist/private.d.ts +34 -21
- package/package.json +10 -10
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 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
|
+
export {};
|
|
@@ -33,7 +33,7 @@ export declare class TestRemoteDocumentCache {
|
|
|
33
33
|
* Reads all of the documents first so we can safely add them and keep the size calculation in
|
|
34
34
|
* sync.
|
|
35
35
|
*/
|
|
36
|
-
addEntries(documents: MutableDocument[]
|
|
36
|
+
addEntries(documents: MutableDocument[]): Promise<void>;
|
|
37
37
|
/**
|
|
38
38
|
* Adds a single document using the document's version as its read time.
|
|
39
39
|
* Reads the document first to track the document size internally.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 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
|
+
export {};
|
|
@@ -30,6 +30,7 @@ import { Document, MutableDocument } from '../../src/model/document';
|
|
|
30
30
|
import { DocumentComparator } from '../../src/model/document_comparator';
|
|
31
31
|
import { DocumentKey } from '../../src/model/document_key';
|
|
32
32
|
import { DocumentSet } from '../../src/model/document_set';
|
|
33
|
+
import { FieldIndex, IndexKind, IndexOffset } from '../../src/model/field_index';
|
|
33
34
|
import { FieldMask } from '../../src/model/field_mask';
|
|
34
35
|
import { DeleteMutation, MutationResult, PatchMutation, Precondition, SetMutation } from '../../src/model/mutation';
|
|
35
36
|
import { JsonObject, ObjectValue } from '../../src/model/object_value';
|
|
@@ -58,6 +59,11 @@ export declare function key(path: string): DocumentKey;
|
|
|
58
59
|
export declare function keys(...documents: Array<Document | string>): DocumentKeySet;
|
|
59
60
|
export declare function path(path: string, offset?: number): ResourcePath;
|
|
60
61
|
export declare function field(path: string): FieldPath;
|
|
62
|
+
export declare function fieldIndex(collectionGroup: string, options?: {
|
|
63
|
+
id?: number;
|
|
64
|
+
fields?: Array<[field: string, kind: IndexKind]>;
|
|
65
|
+
offset?: IndexOffset;
|
|
66
|
+
}): FieldIndex;
|
|
61
67
|
export declare function mask(...paths: string[]): FieldMask;
|
|
62
68
|
export declare function blob(...bytes: number[]): Bytes;
|
|
63
69
|
export declare function filter(path: string, op: string, value: unknown): FieldFilter;
|
|
@@ -63,7 +63,7 @@ l.MOCK_USER = new l("mock-user");
|
|
|
63
63
|
* See the License for the specific language governing permissions and
|
|
64
64
|
* limitations under the License.
|
|
65
65
|
*/
|
|
66
|
-
let f = "9.6.
|
|
66
|
+
let f = "9.6.5-canary.aaeab08ac";
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* @license
|
|
@@ -190,14 +190,14 @@ function p(t, ...n) {
|
|
|
190
190
|
* given message if it did.
|
|
191
191
|
*
|
|
192
192
|
* Messages are stripped in production builds.
|
|
193
|
-
*/ function
|
|
193
|
+
*/ function b(t, n) {
|
|
194
194
|
t || g();
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
/**
|
|
198
198
|
* Casts `obj` to `T`. In non-production builds, verifies that `obj` is an
|
|
199
199
|
* instance of `T` before casting.
|
|
200
|
-
*/ function
|
|
200
|
+
*/ function v(t,
|
|
201
201
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
202
202
|
n) {
|
|
203
203
|
return t;
|
|
@@ -332,7 +332,7 @@ n) {
|
|
|
332
332
|
}));
|
|
333
333
|
}
|
|
334
334
|
getToken() {
|
|
335
|
-
return this.auth ? this.auth.getToken().then((t => t ? (
|
|
335
|
+
return this.auth ? this.auth.getToken().then((t => t ? (b("string" == typeof t.accessToken),
|
|
336
336
|
new j(t.accessToken, new l(this.auth.getUid()))) : null)) : Promise.resolve(null);
|
|
337
337
|
}
|
|
338
338
|
invalidateToken() {}
|
|
@@ -386,7 +386,7 @@ class W {
|
|
|
386
386
|
}));
|
|
387
387
|
}
|
|
388
388
|
getToken() {
|
|
389
|
-
return this.appCheck ? this.appCheck.getToken().then((t => t ? (
|
|
389
|
+
return this.appCheck ? this.appCheck.getToken().then((t => t ? (b("string" == typeof t.token),
|
|
390
390
|
new W(t.token)) : null)) : Promise.resolve(null);
|
|
391
391
|
}
|
|
392
392
|
invalidateToken() {}
|
|
@@ -672,6 +672,9 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
672
672
|
static fromName(t) {
|
|
673
673
|
return new nt(X.fromString(t).popFirst(5));
|
|
674
674
|
}
|
|
675
|
+
static empty() {
|
|
676
|
+
return new nt(X.emptyPath());
|
|
677
|
+
}
|
|
675
678
|
/** Returns true if the document is in the specified collectionId. */ hasCollectionId(t) {
|
|
676
679
|
return this.path.length >= 2 && this.path.get(this.path.length - 2) === t;
|
|
677
680
|
}
|
|
@@ -1305,15 +1308,15 @@ class gt {
|
|
|
1305
1308
|
/**
|
|
1306
1309
|
* A version of a document in Firestore. This corresponds to the version
|
|
1307
1310
|
* timestamp, such as update_time or read_time.
|
|
1308
|
-
*/ class
|
|
1311
|
+
*/ class bt {
|
|
1309
1312
|
constructor(t) {
|
|
1310
1313
|
this.timestamp = t;
|
|
1311
1314
|
}
|
|
1312
1315
|
static fromTimestamp(t) {
|
|
1313
|
-
return new
|
|
1316
|
+
return new bt(t);
|
|
1314
1317
|
}
|
|
1315
1318
|
static min() {
|
|
1316
|
-
return new
|
|
1319
|
+
return new bt(new gt(0, 0));
|
|
1317
1320
|
}
|
|
1318
1321
|
compareTo(t) {
|
|
1319
1322
|
return this.timestamp._compareTo(t.timestamp);
|
|
@@ -1348,7 +1351,7 @@ class gt {
|
|
|
1348
1351
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1349
1352
|
* See the License for the specific language governing permissions and
|
|
1350
1353
|
* limitations under the License.
|
|
1351
|
-
*/ function
|
|
1354
|
+
*/ function vt(t) {
|
|
1352
1355
|
let n = 0;
|
|
1353
1356
|
for (const e in t) Object.prototype.hasOwnProperty.call(t, e) && n++;
|
|
1354
1357
|
return n;
|
|
@@ -1534,13 +1537,13 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1534
1537
|
// The json interface (for the browser) will return an iso timestamp string,
|
|
1535
1538
|
// while the proto js library (for node) will return a
|
|
1536
1539
|
// google.protobuf.Timestamp instance.
|
|
1537
|
-
if (
|
|
1540
|
+
if (b(!!t), "string" == typeof t) {
|
|
1538
1541
|
// The date string can have higher precision (nanos) than the Date class
|
|
1539
1542
|
// (millis), so we do some custom parsing here.
|
|
1540
1543
|
// Parse the nanos right out of the string.
|
|
1541
1544
|
let n = 0;
|
|
1542
1545
|
const e = At.exec(t);
|
|
1543
|
-
if (
|
|
1546
|
+
if (b(!!e), e[1]) {
|
|
1544
1547
|
// Pad the fraction out to 9 digits (nanos).
|
|
1545
1548
|
let t = e[1];
|
|
1546
1549
|
t = (t + "000000000").substr(0, 9), n = Number(t);
|
|
@@ -1700,7 +1703,7 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1700
1703
|
case 10 /* ObjectValue */ :
|
|
1701
1704
|
return function(t, n) {
|
|
1702
1705
|
const e = t.mapValue.fields || {}, r = n.mapValue.fields || {};
|
|
1703
|
-
if (
|
|
1706
|
+
if (vt(e) !== vt(r)) return !1;
|
|
1704
1707
|
for (const t in e) if (e.hasOwnProperty(t) && (void 0 === r[t] || !Ft(e[t], r[t]))) return !1;
|
|
1705
1708
|
return !0;
|
|
1706
1709
|
}
|
|
@@ -1989,30 +1992,31 @@ function Ct(t, n) {
|
|
|
1989
1992
|
* applied, `isValidDocument()` returns false and the document should be removed
|
|
1990
1993
|
* from all views.
|
|
1991
1994
|
*/ class zt {
|
|
1992
|
-
constructor(t, n, e, r, s) {
|
|
1993
|
-
this.key = t, this.documentType = n, this.version = e, this.
|
|
1995
|
+
constructor(t, n, e, r, s, i) {
|
|
1996
|
+
this.key = t, this.documentType = n, this.version = e, this.readTime = r, this.data = s,
|
|
1997
|
+
this.documentState = i;
|
|
1994
1998
|
}
|
|
1995
1999
|
/**
|
|
1996
2000
|
* Creates a document with no known version or data, but which can serve as
|
|
1997
2001
|
* base document for mutations.
|
|
1998
2002
|
*/ static newInvalidDocument(t) {
|
|
1999
|
-
return new zt(t, 0 /* INVALID */ ,
|
|
2003
|
+
return new zt(t, 0 /* INVALID */ , bt.min(), bt.min(), Bt.empty(), 0 /* SYNCED */);
|
|
2000
2004
|
}
|
|
2001
2005
|
/**
|
|
2002
2006
|
* Creates a new document that is known to exist with the given data at the
|
|
2003
2007
|
* given version.
|
|
2004
2008
|
*/ static newFoundDocument(t, n, e) {
|
|
2005
|
-
return new zt(t, 1 /* FOUND_DOCUMENT */ , n, e, 0 /* SYNCED */);
|
|
2009
|
+
return new zt(t, 1 /* FOUND_DOCUMENT */ , n, bt.min(), e, 0 /* SYNCED */);
|
|
2006
2010
|
}
|
|
2007
2011
|
/** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, n) {
|
|
2008
|
-
return new zt(t, 2 /* NO_DOCUMENT */ , n, Bt.empty(), 0 /* SYNCED */);
|
|
2012
|
+
return new zt(t, 2 /* NO_DOCUMENT */ , n, bt.min(), Bt.empty(), 0 /* SYNCED */);
|
|
2009
2013
|
}
|
|
2010
2014
|
/**
|
|
2011
2015
|
* Creates a new document that is known to exist at the given version but
|
|
2012
2016
|
* whose data is not known (e.g. a document that was updated without a known
|
|
2013
2017
|
* base document).
|
|
2014
2018
|
*/ static newUnknownDocument(t, n) {
|
|
2015
|
-
return new zt(t, 3 /* UNKNOWN_DOCUMENT */ , n, Bt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
2019
|
+
return new zt(t, 3 /* UNKNOWN_DOCUMENT */ , n, bt.min(), Bt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
2016
2020
|
}
|
|
2017
2021
|
/**
|
|
2018
2022
|
* Changes the document type to indicate that it exists and that its version
|
|
@@ -2042,6 +2046,9 @@ function Ct(t, n) {
|
|
|
2042
2046
|
setHasLocalMutations() {
|
|
2043
2047
|
return this.documentState = 1 /* HAS_LOCAL_MUTATIONS */ , this;
|
|
2044
2048
|
}
|
|
2049
|
+
setReadTime(t) {
|
|
2050
|
+
return this.readTime = t, this;
|
|
2051
|
+
}
|
|
2045
2052
|
get hasLocalMutations() {
|
|
2046
2053
|
return 1 /* HAS_LOCAL_MUTATIONS */ === this.documentState;
|
|
2047
2054
|
}
|
|
@@ -2067,7 +2074,7 @@ function Ct(t, n) {
|
|
|
2067
2074
|
return t instanceof zt && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data);
|
|
2068
2075
|
}
|
|
2069
2076
|
mutableCopy() {
|
|
2070
|
-
return new zt(this.key, this.documentType, this.version, this.data.clone(), this.documentState);
|
|
2077
|
+
return new zt(this.key, this.documentType, this.version, this.readTime, this.data.clone(), this.documentState);
|
|
2071
2078
|
}
|
|
2072
2079
|
toString() {
|
|
2073
2080
|
return `Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`;
|
|
@@ -2339,7 +2346,7 @@ function ln(t) {
|
|
|
2339
2346
|
* which can be different from the order by constraints the user provided (e.g.
|
|
2340
2347
|
* the SDK and backend always orders by `__name__`).
|
|
2341
2348
|
*/ function fn(t) {
|
|
2342
|
-
const n =
|
|
2349
|
+
const n = v(t);
|
|
2343
2350
|
if (null === n.$) {
|
|
2344
2351
|
n.$ = [];
|
|
2345
2352
|
const t = hn(n), e = an(n);
|
|
@@ -2364,7 +2371,7 @@ function ln(t) {
|
|
|
2364
2371
|
/**
|
|
2365
2372
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
2366
2373
|
*/ function dn(t) {
|
|
2367
|
-
const n =
|
|
2374
|
+
const n = v(t);
|
|
2368
2375
|
if (!n.S) if ("F" /* First */ === n.limitType) n.S = Qt(n.path, n.collectionGroup, fn(n), n.filters, n.limit, n.startAt, n.endAt); else {
|
|
2369
2376
|
// Flip the orderBy directions since we want the last results
|
|
2370
2377
|
const t = [];
|
|
@@ -2490,7 +2497,7 @@ function mn(t, n) {
|
|
|
2490
2497
|
* transforms. Converts all field values to integers or doubles, but unlike the
|
|
2491
2498
|
* backend does not cap integer values at 2^63. Instead, JavaScript number
|
|
2492
2499
|
* arithmetic is used and precision loss can occur for values greater than 2^53.
|
|
2493
|
-
*/ class
|
|
2500
|
+
*/ class bn extends pn {
|
|
2494
2501
|
constructor(t, n) {
|
|
2495
2502
|
super(), this.q = t, this.O = n;
|
|
2496
2503
|
}
|
|
@@ -2512,7 +2519,7 @@ function mn(t, n) {
|
|
|
2512
2519
|
* See the License for the specific language governing permissions and
|
|
2513
2520
|
* limitations under the License.
|
|
2514
2521
|
*/
|
|
2515
|
-
/** A field path and the TransformOperation to perform upon it. */ class
|
|
2522
|
+
/** A field path and the TransformOperation to perform upon it. */ class vn {
|
|
2516
2523
|
constructor(t, n) {
|
|
2517
2524
|
this.field = t, this.transform = n;
|
|
2518
2525
|
}
|
|
@@ -2727,7 +2734,7 @@ function Fn(t, n) {
|
|
|
2727
2734
|
}
|
|
2728
2735
|
|
|
2729
2736
|
function xn(t) {
|
|
2730
|
-
return
|
|
2737
|
+
return b(!!t), bt.fromTimestamp(function(t) {
|
|
2731
2738
|
const n = Rt(t);
|
|
2732
2739
|
return new gt(n.seconds, n.nanos);
|
|
2733
2740
|
}(t));
|
|
@@ -2746,11 +2753,11 @@ function On(t, n) {
|
|
|
2746
2753
|
function Cn(t, n) {
|
|
2747
2754
|
const e = function(t) {
|
|
2748
2755
|
const n = X.fromString(t);
|
|
2749
|
-
return
|
|
2756
|
+
return b(Hn(n)), n;
|
|
2750
2757
|
}(n);
|
|
2751
2758
|
if (e.get(1) !== t.databaseId.projectId) throw new U(A, "Tried to deserialize key from different project: " + e.get(1) + " vs " + t.databaseId.projectId);
|
|
2752
2759
|
if (e.get(3) !== t.databaseId.database) throw new U(A, "Tried to deserialize key from different database: " + e.get(3) + " vs " + t.databaseId.database);
|
|
2753
|
-
return new nt((
|
|
2760
|
+
return new nt((b((r = e).length > 4 && "documents" === r.get(4)), r.popFirst(5)));
|
|
2754
2761
|
var r;
|
|
2755
2762
|
/** Creates a Document proto from key and fields (but no create/update time) */}
|
|
2756
2763
|
|
|
@@ -2771,7 +2778,7 @@ function kn(t, n, e) {
|
|
|
2771
2778
|
|
|
2772
2779
|
function jn(t, n) {
|
|
2773
2780
|
return "found" in n ? function(t, n) {
|
|
2774
|
-
|
|
2781
|
+
b(!!n.found), n.found.name, n.found.updateTime;
|
|
2775
2782
|
const e = Cn(t, n.found.name), r = xn(n.found.updateTime), s = new Bt({
|
|
2776
2783
|
mapValue: {
|
|
2777
2784
|
fields: n.found.fields
|
|
@@ -2779,7 +2786,7 @@ function jn(t, n) {
|
|
|
2779
2786
|
});
|
|
2780
2787
|
return zt.newFoundDocument(e, r, s);
|
|
2781
2788
|
}(t, n) : "missing" in n ? function(t, n) {
|
|
2782
|
-
|
|
2789
|
+
b(!!n.missing), b(!!n.readTime);
|
|
2783
2790
|
const e = Cn(t, n.missing), r = xn(n.readTime);
|
|
2784
2791
|
return zt.newNoDocument(e, r);
|
|
2785
2792
|
}(t, n) : g();
|
|
@@ -2818,7 +2825,7 @@ function Mn(t, n) {
|
|
|
2818
2825
|
values: e.elements
|
|
2819
2826
|
}
|
|
2820
2827
|
};
|
|
2821
|
-
if (e instanceof
|
|
2828
|
+
if (e instanceof bn) return {
|
|
2822
2829
|
fieldPath: n.field.canonicalString(),
|
|
2823
2830
|
increment: e.O
|
|
2824
2831
|
};
|
|
@@ -3118,14 +3125,14 @@ class Xn extends class {} {
|
|
|
3118
3125
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
3119
3126
|
// firestore-exp client.
|
|
3120
3127
|
async function Zn(t, n) {
|
|
3121
|
-
const e =
|
|
3128
|
+
const e = v(t), r = Un(e.q) + "/documents", s = {
|
|
3122
3129
|
writes: n.map((t => Mn(e.q, t)))
|
|
3123
3130
|
};
|
|
3124
3131
|
await e.m("Commit", r, s);
|
|
3125
3132
|
}
|
|
3126
3133
|
|
|
3127
3134
|
async function te(t, n) {
|
|
3128
|
-
const e =
|
|
3135
|
+
const e = v(t), r = Un(e.q) + "/documents", s = {
|
|
3129
3136
|
documents: n.map((t => On(e.q, t)))
|
|
3130
3137
|
}, i = await e.T("BatchGetDocuments", r, s), o = new Map;
|
|
3131
3138
|
i.forEach((t => {
|
|
@@ -3135,12 +3142,12 @@ async function te(t, n) {
|
|
|
3135
3142
|
const u = [];
|
|
3136
3143
|
return n.forEach((t => {
|
|
3137
3144
|
const n = o.get(t.toString());
|
|
3138
|
-
|
|
3145
|
+
b(!!n), u.push(n);
|
|
3139
3146
|
})), u;
|
|
3140
3147
|
}
|
|
3141
3148
|
|
|
3142
3149
|
async function ne(t, n) {
|
|
3143
|
-
const e =
|
|
3150
|
+
const e = v(t), r = Bn(e.q, dn(n));
|
|
3144
3151
|
return (await e.T("RunQuery", r.parent, {
|
|
3145
3152
|
structuredQuery: r.structuredQuery
|
|
3146
3153
|
})).filter((t => !!t.document)).map((t => function(t, n, e) {
|
|
@@ -3307,7 +3314,7 @@ class se {
|
|
|
3307
3314
|
case "gapi":
|
|
3308
3315
|
const n = t.client;
|
|
3309
3316
|
// Make sure this really is a Gapi client.
|
|
3310
|
-
return
|
|
3317
|
+
return b(!("object" != typeof n || null === n || !n.auth || !n.auth.getAuthHeaderValueForFirstParty)),
|
|
3311
3318
|
new Q(n, t.sessionIndex || "0", t.iamToken || null);
|
|
3312
3319
|
|
|
3313
3320
|
case "provider":
|
|
@@ -3694,7 +3701,7 @@ function me(t, n, ...e) {
|
|
|
3694
3701
|
*/
|
|
3695
3702
|
/**
|
|
3696
3703
|
* An immutable object representing an array of bytes.
|
|
3697
|
-
*/ class
|
|
3704
|
+
*/ class be {
|
|
3698
3705
|
/** @hideconstructor */
|
|
3699
3706
|
constructor(t) {
|
|
3700
3707
|
this._byteString = t;
|
|
@@ -3706,7 +3713,7 @@ function me(t, n, ...e) {
|
|
|
3706
3713
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
3707
3714
|
*/ static fromBase64String(t) {
|
|
3708
3715
|
try {
|
|
3709
|
-
return new
|
|
3716
|
+
return new be(It.fromBase64String(t));
|
|
3710
3717
|
} catch (t) {
|
|
3711
3718
|
throw new U(A, "Failed to construct data from Base64 string: " + t);
|
|
3712
3719
|
}
|
|
@@ -3716,7 +3723,7 @@ function me(t, n, ...e) {
|
|
|
3716
3723
|
*
|
|
3717
3724
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
3718
3725
|
*/ static fromUint8Array(t) {
|
|
3719
|
-
return new
|
|
3726
|
+
return new be(It.fromUint8Array(t));
|
|
3720
3727
|
}
|
|
3721
3728
|
/**
|
|
3722
3729
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -3768,7 +3775,7 @@ function me(t, n, ...e) {
|
|
|
3768
3775
|
/**
|
|
3769
3776
|
* Sentinel values that can be used when writing document fields with `set()`
|
|
3770
3777
|
* or `update()`.
|
|
3771
|
-
*/ class
|
|
3778
|
+
*/ class ve {
|
|
3772
3779
|
/**
|
|
3773
3780
|
* @param _methodName - The public API endpoint that returns this class.
|
|
3774
3781
|
* @hideconstructor
|
|
@@ -4015,7 +4022,7 @@ function De(t) {
|
|
|
4015
4022
|
return new Ie(new Bt(u), c, a);
|
|
4016
4023
|
}
|
|
4017
4024
|
|
|
4018
|
-
class $e extends
|
|
4025
|
+
class $e extends ve {
|
|
4019
4026
|
_toFieldTransform(t) {
|
|
4020
4027
|
if (2 /* MergeSet */ !== t.tt) throw 1 /* Update */ === t.tt ? t.ut(`${this._methodName}() can only appear at the top level of your update data`) : t.ut(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
|
|
4021
4028
|
// No transform to add for a delete, but we need to add it to our
|
|
@@ -4051,23 +4058,23 @@ class $e extends be {
|
|
|
4051
4058
|
}, n.databaseId, n.q, n.ignoreUndefinedProperties);
|
|
4052
4059
|
}
|
|
4053
4060
|
|
|
4054
|
-
class Fe extends
|
|
4061
|
+
class Fe extends ve {
|
|
4055
4062
|
_toFieldTransform(t) {
|
|
4056
|
-
return new
|
|
4063
|
+
return new vn(t.path, new yn);
|
|
4057
4064
|
}
|
|
4058
4065
|
isEqual(t) {
|
|
4059
4066
|
return t instanceof Fe;
|
|
4060
4067
|
}
|
|
4061
4068
|
}
|
|
4062
4069
|
|
|
4063
|
-
class xe extends
|
|
4070
|
+
class xe extends ve {
|
|
4064
4071
|
constructor(t, n) {
|
|
4065
4072
|
super(t), this.lt = n;
|
|
4066
4073
|
}
|
|
4067
4074
|
_toFieldTransform(t) {
|
|
4068
4075
|
const n = Se(this, t,
|
|
4069
4076
|
/*array=*/ !0), e = this.lt.map((t => ke(t, n))), r = new _n(e);
|
|
4070
|
-
return new
|
|
4077
|
+
return new vn(t.path, r);
|
|
4071
4078
|
}
|
|
4072
4079
|
isEqual(t) {
|
|
4073
4080
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4075,14 +4082,14 @@ class xe extends be {
|
|
|
4075
4082
|
}
|
|
4076
4083
|
}
|
|
4077
4084
|
|
|
4078
|
-
class qe extends
|
|
4085
|
+
class qe extends ve {
|
|
4079
4086
|
constructor(t, n) {
|
|
4080
4087
|
super(t), this.lt = n;
|
|
4081
4088
|
}
|
|
4082
4089
|
_toFieldTransform(t) {
|
|
4083
4090
|
const n = Se(this, t,
|
|
4084
4091
|
/*array=*/ !0), e = this.lt.map((t => ke(t, n))), r = new gn(e);
|
|
4085
|
-
return new
|
|
4092
|
+
return new vn(t.path, r);
|
|
4086
4093
|
}
|
|
4087
4094
|
isEqual(t) {
|
|
4088
4095
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4090,13 +4097,13 @@ class qe extends be {
|
|
|
4090
4097
|
}
|
|
4091
4098
|
}
|
|
4092
4099
|
|
|
4093
|
-
class Oe extends
|
|
4100
|
+
class Oe extends ve {
|
|
4094
4101
|
constructor(t, n) {
|
|
4095
4102
|
super(t), this.ft = n;
|
|
4096
4103
|
}
|
|
4097
4104
|
_toFieldTransform(t) {
|
|
4098
|
-
const n = new
|
|
4099
|
-
return new
|
|
4105
|
+
const n = new bn(t.q, mn(t.q, this.ft));
|
|
4106
|
+
return new vn(t.path, n);
|
|
4100
4107
|
}
|
|
4101
4108
|
isEqual(t) {
|
|
4102
4109
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4173,7 +4180,7 @@ class Oe extends be {
|
|
|
4173
4180
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
4174
4181
|
// from firestore-exp.
|
|
4175
4182
|
t = getModularInstance(t))) return Be("Unsupported field value:", n, t), je(t, n);
|
|
4176
|
-
if (t instanceof
|
|
4183
|
+
if (t instanceof ve)
|
|
4177
4184
|
// FieldValues usually parse into transforms (except deleteField())
|
|
4178
4185
|
// in which case we do not want to include this field in our parsed data
|
|
4179
4186
|
// (as doing so will overwrite the field directly prior to the transform
|
|
@@ -4262,7 +4269,7 @@ class Oe extends be {
|
|
|
4262
4269
|
longitude: t.longitude
|
|
4263
4270
|
}
|
|
4264
4271
|
};
|
|
4265
|
-
if (t instanceof
|
|
4272
|
+
if (t instanceof be) return {
|
|
4266
4273
|
bytesValue: Sn(n.q, t._byteString)
|
|
4267
4274
|
};
|
|
4268
4275
|
if (t instanceof he) {
|
|
@@ -4302,7 +4309,7 @@ function je(t, n) {
|
|
|
4302
4309
|
}
|
|
4303
4310
|
|
|
4304
4311
|
function Me(t) {
|
|
4305
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof gt || t instanceof Ee || t instanceof
|
|
4312
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof gt || t instanceof Ee || t instanceof be || t instanceof he || t instanceof ve);
|
|
4306
4313
|
}
|
|
4307
4314
|
|
|
4308
4315
|
function Be(t, n, e) {
|
|
@@ -4704,12 +4711,12 @@ class sr extends tr {
|
|
|
4704
4711
|
|
|
4705
4712
|
class or extends tr {
|
|
4706
4713
|
constructor(t, n, e) {
|
|
4707
|
-
super(), this.type = t, this.gt = n, this.
|
|
4714
|
+
super(), this.type = t, this.gt = n, this.bt = e;
|
|
4708
4715
|
}
|
|
4709
4716
|
_apply(t) {
|
|
4710
4717
|
return new le(t.firestore, t.converter, function(t, n, e) {
|
|
4711
4718
|
return new un(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), n, e, t.startAt, t.endAt);
|
|
4712
|
-
}(t._query, this.gt, this.
|
|
4719
|
+
}(t._query, this.gt, this.bt));
|
|
4713
4720
|
}
|
|
4714
4721
|
}
|
|
4715
4722
|
|
|
@@ -4736,10 +4743,10 @@ class or extends tr {
|
|
|
4736
4743
|
|
|
4737
4744
|
class ar extends tr {
|
|
4738
4745
|
constructor(t, n, e) {
|
|
4739
|
-
super(), this.type = t, this.
|
|
4746
|
+
super(), this.type = t, this.vt = n, this.Et = e;
|
|
4740
4747
|
}
|
|
4741
4748
|
_apply(t) {
|
|
4742
|
-
const n = mr(t, this.type, this.
|
|
4749
|
+
const n = mr(t, this.type, this.vt, this.Et);
|
|
4743
4750
|
return new le(t.firestore, t.converter, function(t, n) {
|
|
4744
4751
|
return new un(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, n, t.endAt);
|
|
4745
4752
|
}(t._query, n));
|
|
@@ -4757,10 +4764,10 @@ function lr(...t) {
|
|
|
4757
4764
|
|
|
4758
4765
|
class fr extends tr {
|
|
4759
4766
|
constructor(t, n, e) {
|
|
4760
|
-
super(), this.type = t, this.
|
|
4767
|
+
super(), this.type = t, this.vt = n, this.Et = e;
|
|
4761
4768
|
}
|
|
4762
4769
|
_apply(t) {
|
|
4763
|
-
const n = mr(t, this.type, this.
|
|
4770
|
+
const n = mr(t, this.type, this.vt, this.Et);
|
|
4764
4771
|
return new le(t.firestore, t.converter, function(t, n) {
|
|
4765
4772
|
return new un(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, n);
|
|
4766
4773
|
}(t._query, n));
|
|
@@ -4911,7 +4918,7 @@ function gr(t, n, e) {
|
|
|
4911
4918
|
r;
|
|
4912
4919
|
}
|
|
4913
4920
|
|
|
4914
|
-
class
|
|
4921
|
+
class br extends class {
|
|
4915
4922
|
convertValue(t, n = "none") {
|
|
4916
4923
|
switch (St(t)) {
|
|
4917
4924
|
case 0 /* NullValue */ :
|
|
@@ -4982,7 +4989,7 @@ class vr extends class {
|
|
|
4982
4989
|
}
|
|
4983
4990
|
convertDocumentKey(t, n) {
|
|
4984
4991
|
const e = X.fromString(t);
|
|
4985
|
-
|
|
4992
|
+
b(Hn(e));
|
|
4986
4993
|
const r = new K(e.get(1), e.get(3)), s = new nt(e.popFirst(5));
|
|
4987
4994
|
return r.isEqual(n) ||
|
|
4988
4995
|
// TODO(b/64130202): Somehow support foreign references.
|
|
@@ -4994,7 +5001,7 @@ class vr extends class {
|
|
|
4994
5001
|
super(), this.firestore = t;
|
|
4995
5002
|
}
|
|
4996
5003
|
convertBytes(t) {
|
|
4997
|
-
return new
|
|
5004
|
+
return new be(t);
|
|
4998
5005
|
}
|
|
4999
5006
|
convertReference(t) {
|
|
5000
5007
|
const n = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
@@ -5014,10 +5021,10 @@ class vr extends class {
|
|
|
5014
5021
|
* @param reference - The reference of the document to fetch.
|
|
5015
5022
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the current
|
|
5016
5023
|
* document contents.
|
|
5017
|
-
*/ function
|
|
5018
|
-
const n = re((t = ot(t, he)).firestore), e = new
|
|
5024
|
+
*/ function vr(t) {
|
|
5025
|
+
const n = re((t = ot(t, he)).firestore), e = new br(t.firestore);
|
|
5019
5026
|
return te(n, [ t._key ]).then((n => {
|
|
5020
|
-
|
|
5027
|
+
b(1 === n.length);
|
|
5021
5028
|
const r = n[0];
|
|
5022
5029
|
return new He(t.firestore, e, t._key, r.isFoundDocument() ? r : null, t.converter);
|
|
5023
5030
|
}));
|
|
@@ -5038,7 +5045,7 @@ class vr extends class {
|
|
|
5038
5045
|
!function(t) {
|
|
5039
5046
|
if (cn(t) && 0 === t.explicitOrderBy.length) throw new U(q, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
5040
5047
|
}((t = ot(t, le))._query);
|
|
5041
|
-
const n = re(t.firestore), e = new
|
|
5048
|
+
const n = re(t.firestore), e = new br(t.firestore);
|
|
5042
5049
|
return ne(n, t._query).then((n => {
|
|
5043
5050
|
const r = n.map((n => new Ke(t.firestore, e, n.key, n, t.converter)));
|
|
5044
5051
|
return cn(t._query) &&
|
|
@@ -5351,7 +5358,7 @@ function Fr(t, n) {
|
|
|
5351
5358
|
if (t.isFoundDocument()) n = t.version; else {
|
|
5352
5359
|
if (!t.isNoDocument()) throw g();
|
|
5353
5360
|
// For deleted docs, we must use baseVersion 0 when we overwrite them.
|
|
5354
|
-
n =
|
|
5361
|
+
n = bt.min();
|
|
5355
5362
|
}
|
|
5356
5363
|
const e = this.readVersions.get(t.key.toString());
|
|
5357
5364
|
if (e) {
|
|
@@ -5374,7 +5381,7 @@ function Fr(t, n) {
|
|
|
5374
5381
|
// The first time a document is written, we want to take into account the
|
|
5375
5382
|
// read time and existence
|
|
5376
5383
|
if (!this.writtenDocs.has(t.toString()) && n) {
|
|
5377
|
-
if (n.isEqual(
|
|
5384
|
+
if (n.isEqual(bt.min()))
|
|
5378
5385
|
// The document doesn't exist, so fail the transaction.
|
|
5379
5386
|
// This has to be validated locally because you can't send a
|
|
5380
5387
|
// precondition that a document does not exist without changing the
|
|
@@ -5871,7 +5878,7 @@ class kr {
|
|
|
5871
5878
|
* @param documentRef - A reference to the document to be read.
|
|
5872
5879
|
* @returns A `DocumentSnapshot` with the read data.
|
|
5873
5880
|
*/ get(t) {
|
|
5874
|
-
const n = Fr(t, this._firestore), e = new
|
|
5881
|
+
const n = Fr(t, this._firestore), e = new br(this._firestore);
|
|
5875
5882
|
return this._transaction.lookup([ n._key ]).then((t => {
|
|
5876
5883
|
if (!t || 1 !== t.length) return g();
|
|
5877
5884
|
const r = t[0];
|
|
@@ -5938,7 +5945,7 @@ class kr {
|
|
|
5938
5945
|
return n && r._setSettings(n), r;
|
|
5939
5946
|
}), "PUBLIC")),
|
|
5940
5947
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
5941
|
-
registerVersion("firestore-lite", "3.4.
|
|
5948
|
+
registerVersion("firestore-lite", "3.4.4-canary.aaeab08ac", ""), registerVersion("firestore-lite", "3.4.4-canary.aaeab08ac", "esm2017");
|
|
5942
5949
|
|
|
5943
|
-
export {
|
|
5950
|
+
export { be as Bytes, fe as CollectionReference, he as DocumentReference, He as DocumentSnapshot, _e as FieldPath, ve as FieldValue, ie as Firestore, U as FirestoreError, Ee as GeoPoint, le as Query, tr as QueryConstraint, Ke as QueryDocumentSnapshot, Je as QuerySnapshot, gt as Timestamp, kr as Transaction, Sr as WriteBatch, Rr as addDoc, Nr as arrayRemove, Dr as arrayUnion, de as collection, we as collectionGroup, ce as connectFirestoreEmulator, Ar as deleteDoc, Pr as deleteField, me as doc, ge as documentId, wr as endAt, dr as endBefore, vr as getDoc, Er as getDocs, ue as getFirestore, $r as increment, oe as initializeFirestore, ur as limit, cr as limitToLast, ir as orderBy, nr as query, ye as queryEqual, pe as refEqual, jr as runTransaction, Vr as serverTimestamp, Tr as setDoc, w as setLogLevel, Xe as snapshotEqual, lr as startAfter, hr as startAt, ae as terminate, Ir as updateDoc, rr as where, xr as writeBatch };
|
|
5944
5951
|
//# sourceMappingURL=index.browser.esm2017.js.map
|