@firebase/firestore 3.4.7-canary.e9e5f6b3c → 3.4.8
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/local/indexeddb_remote_document_cache.d.ts +9 -0
- package/dist/firestore/src/local/simple_db.d.ts +2 -0
- package/dist/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
- package/dist/index.esm2017.js +153 -146
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +69 -65
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +26 -9
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +26 -9
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +14 -7
- package/dist/index.rn.js.map +1 -1
- package/dist/lite/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
- package/dist/lite/firestore/src/local/simple_db.d.ts +2 -0
- package/dist/lite/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
- package/dist/lite/index.browser.esm2017.js +73 -73
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +8 -8
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +2 -2
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +2 -2
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +1112 -1112
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +18 -18
- package/dist/lite/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
- package/dist/lite/packages/firestore/src/local/simple_db.d.ts +2 -0
- package/dist/lite/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
- package/dist/packages/firestore/dist/index.esm2017.d.ts +8 -8
- package/dist/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
- package/dist/packages/firestore/src/local/simple_db.d.ts +2 -0
- package/dist/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
- package/package.json +9 -9
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import { MutableDocument } from '../model/document';
|
|
18
|
+
import { DocumentKey } from '../model/document_key';
|
|
18
19
|
import { LocalSerializer } from './local_serializer';
|
|
19
20
|
import { RemoteDocumentCache } from './remote_document_cache';
|
|
20
21
|
export interface DocumentSizeEntry {
|
|
@@ -25,3 +26,11 @@ export interface IndexedDbRemoteDocumentCache extends RemoteDocumentCache {
|
|
|
25
26
|
}
|
|
26
27
|
/** Creates a new IndexedDbRemoteDocumentCache. */
|
|
27
28
|
export declare function newIndexedDbRemoteDocumentCache(serializer: LocalSerializer): IndexedDbRemoteDocumentCache;
|
|
29
|
+
/**
|
|
30
|
+
* Comparator that compares document keys according to the primary key sorting
|
|
31
|
+
* used by the `DbRemoteDocumentDocument` store (by prefix path, collection id
|
|
32
|
+
* and then document ID).
|
|
33
|
+
*
|
|
34
|
+
* Visible for testing.
|
|
35
|
+
*/
|
|
36
|
+
export declare function dbKeyComparator(l: DocumentKey, r: DocumentKey): number;
|
|
@@ -186,6 +186,8 @@ export declare class SimpleDbStore<KeyType extends IDBValidKey, ValueType extend
|
|
|
186
186
|
loadAll(): PersistencePromise<ValueType[]>;
|
|
187
187
|
/** Loads all elements for the index range from the object store. */
|
|
188
188
|
loadAll(range: IDBKeyRange): PersistencePromise<ValueType[]>;
|
|
189
|
+
/** Loads all elements ordered by the given index. */
|
|
190
|
+
loadAll(index: string): PersistencePromise<ValueType[]>;
|
|
189
191
|
/**
|
|
190
192
|
* Loads all elements from the object store that fall into the provided in the
|
|
191
193
|
* index range for the given index.
|
|
@@ -47,10 +47,6 @@ export declare class TestRemoteDocumentCache {
|
|
|
47
47
|
getEntries(documentKeys: DocumentKeySet): Promise<MutableDocumentMap>;
|
|
48
48
|
getAllFromCollection(collection: ResourcePath, offset: IndexOffset): Promise<MutableDocumentMap>;
|
|
49
49
|
getAllFromCollectionGroup(collectionGroup: string, offset: IndexOffset, limit: number): Promise<MutableDocumentMap>;
|
|
50
|
-
getNewDocumentChanges(sinceReadTime: SnapshotVersion): Promise<{
|
|
51
|
-
changedDocs: MutableDocumentMap;
|
|
52
|
-
readTime: SnapshotVersion;
|
|
53
|
-
}>;
|
|
54
50
|
getSize(): Promise<number>;
|
|
55
51
|
newChangeBuffer(options?: {
|
|
56
52
|
trackRemovals: boolean;
|
|
@@ -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.11";
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* @license
|
|
@@ -190,14 +190,14 @@ function p(t, ...e) {
|
|
|
190
190
|
* given message if it did.
|
|
191
191
|
*
|
|
192
192
|
* Messages are stripped in production builds.
|
|
193
|
-
*/ function
|
|
193
|
+
*/ function v(t, e) {
|
|
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 b(t,
|
|
201
201
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
202
202
|
e) {
|
|
203
203
|
return t;
|
|
@@ -332,7 +332,7 @@ e) {
|
|
|
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 ? (v("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 ? (v("string" == typeof t.token),
|
|
390
390
|
new W(t.token)) : null)) : Promise.resolve(null);
|
|
391
391
|
}
|
|
392
392
|
invalidateToken() {}
|
|
@@ -1320,18 +1320,18 @@ class gt {
|
|
|
1320
1320
|
/**
|
|
1321
1321
|
* A version of a document in Firestore. This corresponds to the version
|
|
1322
1322
|
* timestamp, such as update_time or read_time.
|
|
1323
|
-
*/ class
|
|
1323
|
+
*/ class vt {
|
|
1324
1324
|
constructor(t) {
|
|
1325
1325
|
this.timestamp = t;
|
|
1326
1326
|
}
|
|
1327
1327
|
static fromTimestamp(t) {
|
|
1328
|
-
return new
|
|
1328
|
+
return new vt(t);
|
|
1329
1329
|
}
|
|
1330
1330
|
static min() {
|
|
1331
|
-
return new
|
|
1331
|
+
return new vt(new gt(0, 0));
|
|
1332
1332
|
}
|
|
1333
1333
|
static max() {
|
|
1334
|
-
return new
|
|
1334
|
+
return new vt(new gt(253402300799, 999999999));
|
|
1335
1335
|
}
|
|
1336
1336
|
compareTo(t) {
|
|
1337
1337
|
return this.timestamp._compareTo(t.timestamp);
|
|
@@ -1366,7 +1366,7 @@ class gt {
|
|
|
1366
1366
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1367
1367
|
* See the License for the specific language governing permissions and
|
|
1368
1368
|
* limitations under the License.
|
|
1369
|
-
*/ function
|
|
1369
|
+
*/ function bt(t) {
|
|
1370
1370
|
let e = 0;
|
|
1371
1371
|
for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e++;
|
|
1372
1372
|
return e;
|
|
@@ -1554,13 +1554,13 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1554
1554
|
// The json interface (for the browser) will return an iso timestamp string,
|
|
1555
1555
|
// while the proto js library (for node) will return a
|
|
1556
1556
|
// google.protobuf.Timestamp instance.
|
|
1557
|
-
if (
|
|
1557
|
+
if (v(!!t), "string" == typeof t) {
|
|
1558
1558
|
// The date string can have higher precision (nanos) than the Date class
|
|
1559
1559
|
// (millis), so we do some custom parsing here.
|
|
1560
1560
|
// Parse the nanos right out of the string.
|
|
1561
1561
|
let e = 0;
|
|
1562
1562
|
const n = At.exec(t);
|
|
1563
|
-
if (
|
|
1563
|
+
if (v(!!n), n[1]) {
|
|
1564
1564
|
// Pad the fraction out to 9 digits (nanos).
|
|
1565
1565
|
let t = n[1];
|
|
1566
1566
|
t = (t + "000000000").substr(0, 9), e = Number(t);
|
|
@@ -1746,7 +1746,7 @@ function St(t) {
|
|
|
1746
1746
|
case 10 /* ObjectValue */ :
|
|
1747
1747
|
return function(t, e) {
|
|
1748
1748
|
const n = t.mapValue.fields || {}, r = e.mapValue.fields || {};
|
|
1749
|
-
if (
|
|
1749
|
+
if (bt(n) !== bt(r)) return !1;
|
|
1750
1750
|
for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !Ft(n[t], r[t]))) return !1;
|
|
1751
1751
|
return !0;
|
|
1752
1752
|
}
|
|
@@ -2025,23 +2025,23 @@ class Bt {
|
|
|
2025
2025
|
* Creates a document with no known version or data, but which can serve as
|
|
2026
2026
|
* base document for mutations.
|
|
2027
2027
|
*/ static newInvalidDocument(t) {
|
|
2028
|
-
return new zt(t, 0 /* INVALID */ ,
|
|
2028
|
+
return new zt(t, 0 /* INVALID */ , vt.min(), vt.min(), Bt.empty(), 0 /* SYNCED */);
|
|
2029
2029
|
}
|
|
2030
2030
|
/**
|
|
2031
2031
|
* Creates a new document that is known to exist with the given data at the
|
|
2032
2032
|
* given version.
|
|
2033
2033
|
*/ static newFoundDocument(t, e, n) {
|
|
2034
|
-
return new zt(t, 1 /* FOUND_DOCUMENT */ , e,
|
|
2034
|
+
return new zt(t, 1 /* FOUND_DOCUMENT */ , e, vt.min(), n, 0 /* SYNCED */);
|
|
2035
2035
|
}
|
|
2036
2036
|
/** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, e) {
|
|
2037
|
-
return new zt(t, 2 /* NO_DOCUMENT */ , e,
|
|
2037
|
+
return new zt(t, 2 /* NO_DOCUMENT */ , e, vt.min(), Bt.empty(), 0 /* SYNCED */);
|
|
2038
2038
|
}
|
|
2039
2039
|
/**
|
|
2040
2040
|
* Creates a new document that is known to exist at the given version but
|
|
2041
2041
|
* whose data is not known (e.g. a document that was updated without a known
|
|
2042
2042
|
* base document).
|
|
2043
2043
|
*/ static newUnknownDocument(t, e) {
|
|
2044
|
-
return new zt(t, 3 /* UNKNOWN_DOCUMENT */ , e,
|
|
2044
|
+
return new zt(t, 3 /* UNKNOWN_DOCUMENT */ , e, vt.min(), Bt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
2045
2045
|
}
|
|
2046
2046
|
/**
|
|
2047
2047
|
* Changes the document type to indicate that it exists and that its version
|
|
@@ -2371,7 +2371,7 @@ function he(t) {
|
|
|
2371
2371
|
* which can be different from the order by constraints the user provided (e.g.
|
|
2372
2372
|
* the SDK and backend always orders by `__name__`).
|
|
2373
2373
|
*/ function le(t) {
|
|
2374
|
-
const e =
|
|
2374
|
+
const e = b(t);
|
|
2375
2375
|
if (null === e.$) {
|
|
2376
2376
|
e.$ = [];
|
|
2377
2377
|
const t = ae(e), n = ce(e);
|
|
@@ -2396,7 +2396,7 @@ function he(t) {
|
|
|
2396
2396
|
/**
|
|
2397
2397
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
2398
2398
|
*/ function fe(t) {
|
|
2399
|
-
const e =
|
|
2399
|
+
const e = b(t);
|
|
2400
2400
|
if (!e.S) if ("F" /* First */ === e.limitType) e.S = Qt(e.path, e.collectionGroup, le(e), e.filters, e.limit, e.startAt, e.endAt); else {
|
|
2401
2401
|
// Flip the orderBy directions since we want the last results
|
|
2402
2402
|
const t = [];
|
|
@@ -2544,7 +2544,7 @@ function we(t, e) {
|
|
|
2544
2544
|
* See the License for the specific language governing permissions and
|
|
2545
2545
|
* limitations under the License.
|
|
2546
2546
|
*/
|
|
2547
|
-
/** A field path and the TransformOperation to perform upon it. */ class
|
|
2547
|
+
/** A field path and the TransformOperation to perform upon it. */ class ve {
|
|
2548
2548
|
constructor(t, e) {
|
|
2549
2549
|
this.field = t, this.transform = e;
|
|
2550
2550
|
}
|
|
@@ -2554,18 +2554,18 @@ function we(t, e) {
|
|
|
2554
2554
|
* Encodes a precondition for a mutation. This follows the model that the
|
|
2555
2555
|
* backend accepts with the special case of an explicit "empty" precondition
|
|
2556
2556
|
* (meaning no precondition).
|
|
2557
|
-
*/ class
|
|
2557
|
+
*/ class be {
|
|
2558
2558
|
constructor(t, e) {
|
|
2559
2559
|
this.updateTime = t, this.exists = e;
|
|
2560
2560
|
}
|
|
2561
2561
|
/** Creates a new empty Precondition. */ static none() {
|
|
2562
|
-
return new
|
|
2562
|
+
return new be;
|
|
2563
2563
|
}
|
|
2564
2564
|
/** Creates a new Precondition with an exists flag. */ static exists(t) {
|
|
2565
|
-
return new
|
|
2565
|
+
return new be(void 0, t);
|
|
2566
2566
|
}
|
|
2567
2567
|
/** Creates a new Precondition based on a version a document exists at. */ static updateTime(t) {
|
|
2568
|
-
return new
|
|
2568
|
+
return new be(t);
|
|
2569
2569
|
}
|
|
2570
2570
|
/** Returns whether this Precondition is empty. */ get isNone() {
|
|
2571
2571
|
return void 0 === this.updateTime && void 0 === this.exists;
|
|
@@ -2759,7 +2759,7 @@ function Se(t, e) {
|
|
|
2759
2759
|
}
|
|
2760
2760
|
|
|
2761
2761
|
function Fe(t) {
|
|
2762
|
-
return
|
|
2762
|
+
return v(!!t), vt.fromTimestamp(function(t) {
|
|
2763
2763
|
const e = Rt(t);
|
|
2764
2764
|
return new gt(e.seconds, e.nanos);
|
|
2765
2765
|
}(t));
|
|
@@ -2778,11 +2778,11 @@ function qe(t, e) {
|
|
|
2778
2778
|
function Oe(t, e) {
|
|
2779
2779
|
const n = function(t) {
|
|
2780
2780
|
const e = X.fromString(t);
|
|
2781
|
-
return
|
|
2781
|
+
return v(We(e)), e;
|
|
2782
2782
|
}(e);
|
|
2783
2783
|
if (n.get(1) !== t.databaseId.projectId) throw new U(A, "Tried to deserialize key from different project: " + n.get(1) + " vs " + t.databaseId.projectId);
|
|
2784
2784
|
if (n.get(3) !== t.databaseId.database) throw new U(A, "Tried to deserialize key from different database: " + n.get(3) + " vs " + t.databaseId.database);
|
|
2785
|
-
return new et((
|
|
2785
|
+
return new et((v((r = n).length > 4 && "documents" === r.get(4)), r.popFirst(5)));
|
|
2786
2786
|
var r;
|
|
2787
2787
|
/** Creates a Document proto from key and fields (but no create/update time) */}
|
|
2788
2788
|
|
|
@@ -2803,7 +2803,7 @@ function Ue(t, e, n) {
|
|
|
2803
2803
|
|
|
2804
2804
|
function ke(t, e) {
|
|
2805
2805
|
return "found" in e ? function(t, e) {
|
|
2806
|
-
|
|
2806
|
+
v(!!e.found), e.found.name, e.found.updateTime;
|
|
2807
2807
|
const n = Oe(t, e.found.name), r = Fe(e.found.updateTime), s = new Bt({
|
|
2808
2808
|
mapValue: {
|
|
2809
2809
|
fields: e.found.fields
|
|
@@ -2811,7 +2811,7 @@ function ke(t, e) {
|
|
|
2811
2811
|
});
|
|
2812
2812
|
return zt.newFoundDocument(n, r, s);
|
|
2813
2813
|
}(t, e) : "missing" in e ? function(t, e) {
|
|
2814
|
-
|
|
2814
|
+
v(!!e.missing), v(!!e.readTime);
|
|
2815
2815
|
const n = Oe(t, e.missing), r = Fe(e.readTime);
|
|
2816
2816
|
return zt.newNoDocument(n, r);
|
|
2817
2817
|
}(t, e) : g();
|
|
@@ -3152,14 +3152,14 @@ class Ke extends class {} {
|
|
|
3152
3152
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
3153
3153
|
// firestore-exp client.
|
|
3154
3154
|
async function Je(t, e) {
|
|
3155
|
-
const n =
|
|
3155
|
+
const n = b(t), r = Le(n.q) + "/documents", s = {
|
|
3156
3156
|
writes: e.map((t => je(n.q, t)))
|
|
3157
3157
|
};
|
|
3158
3158
|
await n.m("Commit", r, s);
|
|
3159
3159
|
}
|
|
3160
3160
|
|
|
3161
3161
|
async function Xe(t, e) {
|
|
3162
|
-
const n =
|
|
3162
|
+
const n = b(t), r = Le(n.q) + "/documents", s = {
|
|
3163
3163
|
documents: e.map((t => qe(n.q, t)))
|
|
3164
3164
|
}, i = await n.T("BatchGetDocuments", r, s), o = new Map;
|
|
3165
3165
|
i.forEach((t => {
|
|
@@ -3169,12 +3169,12 @@ async function Xe(t, e) {
|
|
|
3169
3169
|
const u = [];
|
|
3170
3170
|
return e.forEach((t => {
|
|
3171
3171
|
const e = o.get(t.toString());
|
|
3172
|
-
|
|
3172
|
+
v(!!e), u.push(e);
|
|
3173
3173
|
})), u;
|
|
3174
3174
|
}
|
|
3175
3175
|
|
|
3176
3176
|
async function Ze(t, e) {
|
|
3177
|
-
const n =
|
|
3177
|
+
const n = b(t), r = Me(n.q, fe(e));
|
|
3178
3178
|
return (await n.T("RunQuery", r.parent, {
|
|
3179
3179
|
structuredQuery: r.structuredQuery
|
|
3180
3180
|
})).filter((t => !!t.document)).map((t => function(t, e, n) {
|
|
@@ -3341,7 +3341,7 @@ class nn {
|
|
|
3341
3341
|
case "gapi":
|
|
3342
3342
|
const e = t.client;
|
|
3343
3343
|
// Make sure this really is a Gapi client.
|
|
3344
|
-
return
|
|
3344
|
+
return v(!("object" != typeof e || null === e || !e.auth || !e.auth.getAuthHeaderValueForFirstParty)),
|
|
3345
3345
|
new Q(e, t.sessionIndex || "0", t.iamToken || null);
|
|
3346
3346
|
|
|
3347
3347
|
case "provider":
|
|
@@ -3802,7 +3802,7 @@ function wn(t, e, ...n) {
|
|
|
3802
3802
|
/**
|
|
3803
3803
|
* Sentinel values that can be used when writing document fields with `set()`
|
|
3804
3804
|
* or `update()`.
|
|
3805
|
-
*/ class
|
|
3805
|
+
*/ class vn {
|
|
3806
3806
|
/**
|
|
3807
3807
|
* @param _methodName - The public API endpoint that returns this class.
|
|
3808
3808
|
* @hideconstructor
|
|
@@ -3834,7 +3834,7 @@ function wn(t, e, ...n) {
|
|
|
3834
3834
|
*
|
|
3835
3835
|
* Latitude values are in the range of [-90, 90].
|
|
3836
3836
|
* Longitude values are in the range of [-180, 180].
|
|
3837
|
-
*/ class
|
|
3837
|
+
*/ class bn {
|
|
3838
3838
|
/**
|
|
3839
3839
|
* Creates a new immutable `GeoPoint` object with the provided latitude and
|
|
3840
3840
|
* longitude values.
|
|
@@ -4049,7 +4049,7 @@ function Vn(t) {
|
|
|
4049
4049
|
return new Tn(new Bt(u), c, a);
|
|
4050
4050
|
}
|
|
4051
4051
|
|
|
4052
|
-
class Nn extends
|
|
4052
|
+
class Nn extends vn {
|
|
4053
4053
|
_toFieldTransform(t) {
|
|
4054
4054
|
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}`);
|
|
4055
4055
|
// No transform to add for a delete, but we need to add it to our
|
|
@@ -4085,23 +4085,23 @@ class Nn extends bn {
|
|
|
4085
4085
|
}, e.databaseId, e.q, e.ignoreUndefinedProperties);
|
|
4086
4086
|
}
|
|
4087
4087
|
|
|
4088
|
-
class Sn extends
|
|
4088
|
+
class Sn extends vn {
|
|
4089
4089
|
_toFieldTransform(t) {
|
|
4090
|
-
return new
|
|
4090
|
+
return new ve(t.path, new pe);
|
|
4091
4091
|
}
|
|
4092
4092
|
isEqual(t) {
|
|
4093
4093
|
return t instanceof Sn;
|
|
4094
4094
|
}
|
|
4095
4095
|
}
|
|
4096
4096
|
|
|
4097
|
-
class Fn extends
|
|
4097
|
+
class Fn extends vn {
|
|
4098
4098
|
constructor(t, e) {
|
|
4099
4099
|
super(t), this.lt = e;
|
|
4100
4100
|
}
|
|
4101
4101
|
_toFieldTransform(t) {
|
|
4102
4102
|
const e = $n(this, t,
|
|
4103
4103
|
/*array=*/ !0), n = this.lt.map((t => Un(t, e))), r = new ye(n);
|
|
4104
|
-
return new
|
|
4104
|
+
return new ve(t.path, r);
|
|
4105
4105
|
}
|
|
4106
4106
|
isEqual(t) {
|
|
4107
4107
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4109,14 +4109,14 @@ class Fn extends bn {
|
|
|
4109
4109
|
}
|
|
4110
4110
|
}
|
|
4111
4111
|
|
|
4112
|
-
class xn extends
|
|
4112
|
+
class xn extends vn {
|
|
4113
4113
|
constructor(t, e) {
|
|
4114
4114
|
super(t), this.lt = e;
|
|
4115
4115
|
}
|
|
4116
4116
|
_toFieldTransform(t) {
|
|
4117
4117
|
const e = $n(this, t,
|
|
4118
4118
|
/*array=*/ !0), n = this.lt.map((t => Un(t, e))), r = new _e(n);
|
|
4119
|
-
return new
|
|
4119
|
+
return new ve(t.path, r);
|
|
4120
4120
|
}
|
|
4121
4121
|
isEqual(t) {
|
|
4122
4122
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4124,13 +4124,13 @@ class xn extends bn {
|
|
|
4124
4124
|
}
|
|
4125
4125
|
}
|
|
4126
4126
|
|
|
4127
|
-
class qn extends
|
|
4127
|
+
class qn extends vn {
|
|
4128
4128
|
constructor(t, e) {
|
|
4129
4129
|
super(t), this.ft = e;
|
|
4130
4130
|
}
|
|
4131
4131
|
_toFieldTransform(t) {
|
|
4132
4132
|
const e = new ge(t.q, we(t.q, this.ft));
|
|
4133
|
-
return new
|
|
4133
|
+
return new ve(t.path, e);
|
|
4134
4134
|
}
|
|
4135
4135
|
isEqual(t) {
|
|
4136
4136
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4207,7 +4207,7 @@ class qn extends bn {
|
|
|
4207
4207
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
4208
4208
|
// from firestore-exp.
|
|
4209
4209
|
t = getModularInstance(t))) return Mn("Unsupported field value:", e, t), kn(t, e);
|
|
4210
|
-
if (t instanceof
|
|
4210
|
+
if (t instanceof vn)
|
|
4211
4211
|
// FieldValues usually parse into transforms (except deleteField())
|
|
4212
4212
|
// in which case we do not want to include this field in our parsed data
|
|
4213
4213
|
// (as doing so will overwrite the field directly prior to the transform
|
|
@@ -4290,7 +4290,7 @@ class qn extends bn {
|
|
|
4290
4290
|
timestampValue: Ne(e.q, n)
|
|
4291
4291
|
};
|
|
4292
4292
|
}
|
|
4293
|
-
if (t instanceof
|
|
4293
|
+
if (t instanceof bn) return {
|
|
4294
4294
|
geoPointValue: {
|
|
4295
4295
|
latitude: t.latitude,
|
|
4296
4296
|
longitude: t.longitude
|
|
@@ -4336,7 +4336,7 @@ function kn(t, e) {
|
|
|
4336
4336
|
}
|
|
4337
4337
|
|
|
4338
4338
|
function jn(t) {
|
|
4339
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof gt || t instanceof
|
|
4339
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof gt || t instanceof bn || t instanceof gn || t instanceof an || t instanceof vn);
|
|
4340
4340
|
}
|
|
4341
4341
|
|
|
4342
4342
|
function Mn(t, e, n) {
|
|
@@ -4738,12 +4738,12 @@ class rr extends Zn {
|
|
|
4738
4738
|
|
|
4739
4739
|
class ir extends Zn {
|
|
4740
4740
|
constructor(t, e, n) {
|
|
4741
|
-
super(), this.type = t, this.gt = e, this.
|
|
4741
|
+
super(), this.type = t, this.gt = e, this.vt = n;
|
|
4742
4742
|
}
|
|
4743
4743
|
_apply(t) {
|
|
4744
4744
|
return new hn(t.firestore, t.converter, function(t, e, n) {
|
|
4745
4745
|
return new oe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
4746
|
-
}(t._query, this.gt, this.
|
|
4746
|
+
}(t._query, this.gt, this.vt));
|
|
4747
4747
|
}
|
|
4748
4748
|
}
|
|
4749
4749
|
|
|
@@ -4770,10 +4770,10 @@ class ir extends Zn {
|
|
|
4770
4770
|
|
|
4771
4771
|
class cr extends Zn {
|
|
4772
4772
|
constructor(t, e, n) {
|
|
4773
|
-
super(), this.type = t, this.
|
|
4773
|
+
super(), this.type = t, this.bt = e, this.Et = n;
|
|
4774
4774
|
}
|
|
4775
4775
|
_apply(t) {
|
|
4776
|
-
const e = wr(t, this.type, this.
|
|
4776
|
+
const e = wr(t, this.type, this.bt, this.Et);
|
|
4777
4777
|
return new hn(t.firestore, t.converter, function(t, e) {
|
|
4778
4778
|
return new oe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
4779
4779
|
}(t._query, e));
|
|
@@ -4792,10 +4792,10 @@ function hr(...t) {
|
|
|
4792
4792
|
|
|
4793
4793
|
class lr extends Zn {
|
|
4794
4794
|
constructor(t, e, n) {
|
|
4795
|
-
super(), this.type = t, this.
|
|
4795
|
+
super(), this.type = t, this.bt = e, this.Et = n;
|
|
4796
4796
|
}
|
|
4797
4797
|
_apply(t) {
|
|
4798
|
-
const e = wr(t, this.type, this.
|
|
4798
|
+
const e = wr(t, this.type, this.bt, this.Et);
|
|
4799
4799
|
return new hn(t.firestore, t.converter, function(t, e) {
|
|
4800
4800
|
return new oe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
4801
4801
|
}(t._query, e));
|
|
@@ -4994,7 +4994,7 @@ class gr extends class {
|
|
|
4994
4994
|
})), n;
|
|
4995
4995
|
}
|
|
4996
4996
|
convertGeoPoint(t) {
|
|
4997
|
-
return new
|
|
4997
|
+
return new bn(Pt(t.latitude), Pt(t.longitude));
|
|
4998
4998
|
}
|
|
4999
4999
|
convertArray(t, e) {
|
|
5000
5000
|
return (t.values || []).map((t => this.convertValue(t, e)));
|
|
@@ -5018,7 +5018,7 @@ class gr extends class {
|
|
|
5018
5018
|
}
|
|
5019
5019
|
convertDocumentKey(t, e) {
|
|
5020
5020
|
const n = X.fromString(t);
|
|
5021
|
-
|
|
5021
|
+
v(We(n));
|
|
5022
5022
|
const r = new K(n.get(1), n.get(3)), s = new et(n.popFirst(5));
|
|
5023
5023
|
return r.isEqual(e) ||
|
|
5024
5024
|
// TODO(b/64130202): Somehow support foreign references.
|
|
@@ -5050,10 +5050,10 @@ class gr extends class {
|
|
|
5050
5050
|
* @param reference - The reference of the document to fetch.
|
|
5051
5051
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the current
|
|
5052
5052
|
* document contents.
|
|
5053
|
-
*/ function
|
|
5053
|
+
*/ function vr(t) {
|
|
5054
5054
|
const e = en((t = ot(t, an)).firestore), n = new gr(t.firestore);
|
|
5055
5055
|
return Xe(e, [ t._key ]).then((e => {
|
|
5056
|
-
|
|
5056
|
+
v(1 === e.length);
|
|
5057
5057
|
const r = e[0];
|
|
5058
5058
|
return new Yn(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
|
|
5059
5059
|
}));
|
|
@@ -5070,7 +5070,7 @@ class gr extends class {
|
|
|
5070
5070
|
*
|
|
5071
5071
|
* @param query - The `Query` to execute.
|
|
5072
5072
|
* @returns A Promise that will be resolved with the results of the query.
|
|
5073
|
-
*/ function
|
|
5073
|
+
*/ function br(t) {
|
|
5074
5074
|
!function(t) {
|
|
5075
5075
|
if (ue(t) && 0 === t.explicitOrderBy.length) throw new U(q, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
5076
5076
|
}((t = ot(t, hn))._query);
|
|
@@ -5087,7 +5087,7 @@ class gr extends class {
|
|
|
5087
5087
|
|
|
5088
5088
|
function Er(t, e, n) {
|
|
5089
5089
|
const r = _r((t = ot(t, an)).converter, e, n), s = Dn(Vn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
|
|
5090
|
-
return Je(en(t.firestore), [ s.toMutation(t._key,
|
|
5090
|
+
return Je(en(t.firestore), [ s.toMutation(t._key, be.none()) ]);
|
|
5091
5091
|
}
|
|
5092
5092
|
|
|
5093
5093
|
function Tr(t, e, n, ...r) {
|
|
@@ -5096,7 +5096,7 @@ function Tr(t, e, n, ...r) {
|
|
|
5096
5096
|
// performing validation.
|
|
5097
5097
|
let i;
|
|
5098
5098
|
i = "string" == typeof (e = getModularInstance(e)) || e instanceof yn ? Cn(s, "updateDoc", t._key, e, n, r) : On(s, "updateDoc", t._key, e);
|
|
5099
|
-
return Je(en(t.firestore), [ i.toMutation(t._key,
|
|
5099
|
+
return Je(en(t.firestore), [ i.toMutation(t._key, be.exists(!0)) ]);
|
|
5100
5100
|
}
|
|
5101
5101
|
|
|
5102
5102
|
/**
|
|
@@ -5111,7 +5111,7 @@ function Tr(t, e, n, ...r) {
|
|
|
5111
5111
|
* @returns A `Promise` resolved once the document has been successfully
|
|
5112
5112
|
* deleted from the backend.
|
|
5113
5113
|
*/ function Ir(t) {
|
|
5114
|
-
return Je(en((t = ot(t, an)).firestore), [ new Ae(t._key,
|
|
5114
|
+
return Je(en((t = ot(t, an)).firestore), [ new Ae(t._key, be.none()) ]);
|
|
5115
5115
|
}
|
|
5116
5116
|
|
|
5117
5117
|
/**
|
|
@@ -5130,7 +5130,7 @@ function Tr(t, e, n, ...r) {
|
|
|
5130
5130
|
* newly created document after it has been written to the backend.
|
|
5131
5131
|
*/ function Ar(t, e) {
|
|
5132
5132
|
const n = wn(t = ot(t, ln)), r = _r(t.converter, e), s = Dn(Vn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
|
|
5133
|
-
return Je(en(t.firestore), [ s.toMutation(n._key,
|
|
5133
|
+
return Je(en(t.firestore), [ s.toMutation(n._key, be.exists(!1)) ]).then((() => n));
|
|
5134
5134
|
}
|
|
5135
5135
|
|
|
5136
5136
|
/**
|
|
@@ -5250,7 +5250,7 @@ function Tr(t, e, n, ...r) {
|
|
|
5250
5250
|
set(t, e, n) {
|
|
5251
5251
|
this._verifyNotCommitted();
|
|
5252
5252
|
const r = Sr(t, this._firestore), s = _r(r.converter, e, n), i = Dn(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, n);
|
|
5253
|
-
return this._mutations.push(i.toMutation(r._key,
|
|
5253
|
+
return this._mutations.push(i.toMutation(r._key, be.none())), this;
|
|
5254
5254
|
}
|
|
5255
5255
|
update(t, e, n, ...r) {
|
|
5256
5256
|
this._verifyNotCommitted();
|
|
@@ -5259,7 +5259,7 @@ function Tr(t, e, n, ...r) {
|
|
|
5259
5259
|
// performing validation.
|
|
5260
5260
|
let i;
|
|
5261
5261
|
return i = "string" == typeof (e = getModularInstance(e)) || e instanceof yn ? Cn(this._dataReader, "WriteBatch.update", s._key, e, n, r) : On(this._dataReader, "WriteBatch.update", s._key, e),
|
|
5262
|
-
this._mutations.push(i.toMutation(s._key,
|
|
5262
|
+
this._mutations.push(i.toMutation(s._key, be.exists(!0))), this;
|
|
5263
5263
|
}
|
|
5264
5264
|
/**
|
|
5265
5265
|
* Deletes the document referred to by the provided {@link DocumentReference}.
|
|
@@ -5269,7 +5269,7 @@ function Tr(t, e, n, ...r) {
|
|
|
5269
5269
|
*/ delete(t) {
|
|
5270
5270
|
this._verifyNotCommitted();
|
|
5271
5271
|
const e = Sr(t, this._firestore);
|
|
5272
|
-
return this._mutations = this._mutations.concat(new Ae(e._key,
|
|
5272
|
+
return this._mutations = this._mutations.concat(new Ae(e._key, be.none())), this;
|
|
5273
5273
|
}
|
|
5274
5274
|
/**
|
|
5275
5275
|
* Commits all of the writes in this write batch as a single atomic unit.
|
|
@@ -5387,7 +5387,7 @@ function Sr(t, e) {
|
|
|
5387
5387
|
if (t.isFoundDocument()) e = t.version; else {
|
|
5388
5388
|
if (!t.isNoDocument()) throw g();
|
|
5389
5389
|
// For deleted docs, we must use baseVersion 0 when we overwrite them.
|
|
5390
|
-
e =
|
|
5390
|
+
e = vt.min();
|
|
5391
5391
|
}
|
|
5392
5392
|
const n = this.readVersions.get(t.key.toString());
|
|
5393
5393
|
if (n) {
|
|
@@ -5401,7 +5401,7 @@ function Sr(t, e) {
|
|
|
5401
5401
|
* as a precondition, or no precondition if it was not read.
|
|
5402
5402
|
*/ precondition(t) {
|
|
5403
5403
|
const e = this.readVersions.get(t.toString());
|
|
5404
|
-
return !this.writtenDocs.has(t.toString()) && e ?
|
|
5404
|
+
return !this.writtenDocs.has(t.toString()) && e ? be.updateTime(e) : be.none();
|
|
5405
5405
|
}
|
|
5406
5406
|
/**
|
|
5407
5407
|
* Returns the precondition for a document if the operation is an update.
|
|
@@ -5410,7 +5410,7 @@ function Sr(t, e) {
|
|
|
5410
5410
|
// The first time a document is written, we want to take into account the
|
|
5411
5411
|
// read time and existence
|
|
5412
5412
|
if (!this.writtenDocs.has(t.toString()) && e) {
|
|
5413
|
-
if (e.isEqual(
|
|
5413
|
+
if (e.isEqual(vt.min()))
|
|
5414
5414
|
// The document doesn't exist, so fail the transaction.
|
|
5415
5415
|
// This has to be validated locally because you can't send a
|
|
5416
5416
|
// precondition that a document does not exist without changing the
|
|
@@ -5422,11 +5422,11 @@ function Sr(t, e) {
|
|
|
5422
5422
|
// transaction.
|
|
5423
5423
|
throw new U(A, "Can't update a document that doesn't exist.");
|
|
5424
5424
|
// Document exists, base precondition on document update time.
|
|
5425
|
-
return
|
|
5425
|
+
return be.updateTime(e);
|
|
5426
5426
|
}
|
|
5427
5427
|
// Document was not read, so we just use the preconditions for a blind
|
|
5428
5428
|
// update.
|
|
5429
|
-
return
|
|
5429
|
+
return be.exists(!0);
|
|
5430
5430
|
}
|
|
5431
5431
|
write(t) {
|
|
5432
5432
|
this.ensureCommitNotCalled(), this.mutations.push(t);
|
|
@@ -5974,7 +5974,7 @@ class Ur {
|
|
|
5974
5974
|
return e && r._setSettings(e), r;
|
|
5975
5975
|
}), "PUBLIC")),
|
|
5976
5976
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
5977
|
-
registerVersion("firestore-lite", "3.4.
|
|
5977
|
+
registerVersion("firestore-lite", "3.4.8", ""), registerVersion("firestore-lite", "3.4.8", "esm2017");
|
|
5978
5978
|
|
|
5979
|
-
export { gn as Bytes, ln as CollectionReference, an as DocumentReference, Yn as DocumentSnapshot, yn as FieldPath,
|
|
5979
|
+
export { gn as Bytes, ln as CollectionReference, an as DocumentReference, Yn as DocumentSnapshot, yn as FieldPath, vn as FieldValue, rn as Firestore, U as FirestoreError, bn as GeoPoint, hn as Query, Zn as QueryConstraint, Hn as QueryDocumentSnapshot, Kn as QuerySnapshot, gt as Timestamp, Ur as Transaction, $r as WriteBatch, Ar as addDoc, Dr as arrayRemove, Vr as arrayUnion, fn as collection, dn as collectionGroup, un as connectFirestoreEmulator, Ir as deleteDoc, Rr as deleteField, wn as doc, _n as documentId, dr as endAt, fr as endBefore, vr as getDoc, br as getDocs, on as getFirestore, Nr as increment, sn as initializeFirestore, or as limit, ur as limitToLast, sr as orderBy, tr as query, pn as queryEqual, mn as refEqual, kr as runTransaction, Pr as serverTimestamp, Er as setDoc, w as setLogLevel, Jn as snapshotEqual, hr as startAfter, ar as startAt, cn as terminate, Tr as updateDoc, nr as where, Fr as writeBatch };
|
|
5980
5980
|
//# sourceMappingURL=index.browser.esm2017.js.map
|