@firebase/firestore 3.4.13 → 3.4.14-canary.04dcdbb0f
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 +8 -0
- package/dist/firestore/src/api/credentials.d.ts +13 -3
- package/dist/firestore/src/api/database.d.ts +34 -3
- package/dist/firestore/src/api/index_configuration.d.ts +7 -8
- package/dist/firestore/src/api.d.ts +1 -1
- package/dist/firestore/src/core/database_info.d.ts +4 -0
- package/dist/firestore/src/lite-api/database.d.ts +51 -7
- package/dist/firestore/src/local/indexeddb_schema.d.ts +1 -3
- package/dist/firestore/src/local/local_store_impl.d.ts +2 -0
- package/dist/firestore/src/util/array.d.ts +18 -0
- package/dist/firestore/test/integration/api/provider.test.d.ts +17 -0
- package/dist/firestore/test/integration/util/firebase_export.d.ts +2 -1
- package/dist/firestore/test/integration/util/helpers.d.ts +1 -0
- package/dist/firestore/test/unit/local/counting_query_engine.d.ts +11 -0
- package/dist/firestore/test/unit/local/local_store_indexeddb.test.d.ts +17 -0
- package/dist/firestore/test/unit/specs/index_spec.test.d.ts +17 -0
- package/dist/firestore/test/unit/specs/spec_builder.d.ts +5 -0
- package/dist/firestore/test/unit/specs/spec_test_runner.d.ts +8 -0
- package/dist/firestore/test/unit/util/array.test.d.ts +17 -0
- package/dist/index.d.ts +15 -4
- package/dist/index.esm2017.js +3793 -3646
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +3762 -3648
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +295 -93
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +295 -93
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +3732 -3586
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +53 -19
- package/dist/lite/firestore/src/api/credentials.d.ts +13 -3
- package/dist/lite/firestore/src/api/database.d.ts +34 -3
- package/dist/lite/firestore/src/api/index_configuration.d.ts +7 -8
- package/dist/lite/firestore/src/api.d.ts +1 -1
- package/dist/lite/firestore/src/core/database_info.d.ts +4 -0
- package/dist/lite/firestore/src/lite-api/database.d.ts +51 -7
- package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +1 -3
- package/dist/lite/firestore/src/local/local_store_impl.d.ts +2 -0
- package/dist/lite/firestore/src/util/array.d.ts +18 -0
- package/dist/lite/firestore/test/integration/api/provider.test.d.ts +17 -0
- package/dist/lite/firestore/test/integration/util/firebase_export.d.ts +2 -1
- package/dist/lite/firestore/test/integration/util/helpers.d.ts +1 -0
- package/dist/lite/firestore/test/unit/local/counting_query_engine.d.ts +11 -0
- package/dist/lite/firestore/test/unit/local/local_store_indexeddb.test.d.ts +17 -0
- package/dist/lite/firestore/test/unit/specs/index_spec.test.d.ts +17 -0
- package/dist/lite/firestore/test/unit/specs/spec_builder.d.ts +5 -0
- package/dist/lite/firestore/test/unit/specs/spec_test_runner.d.ts +8 -0
- package/dist/lite/firestore/test/unit/util/array.test.d.ts +17 -0
- package/dist/lite/index.browser.esm2017.js +273 -277
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +506 -493
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.d.ts +15 -4
- package/dist/lite/index.node.cjs.js +71 -61
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +71 -61
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +273 -277
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +58 -7
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +29 -66
- package/dist/lite/packages/firestore/src/api/credentials.d.ts +13 -3
- package/dist/lite/packages/firestore/src/api/database.d.ts +34 -3
- package/dist/lite/packages/firestore/src/api/index_configuration.d.ts +7 -8
- package/dist/lite/packages/firestore/src/api.d.ts +1 -1
- package/dist/lite/packages/firestore/src/core/database_info.d.ts +4 -0
- package/dist/lite/packages/firestore/src/lite-api/database.d.ts +51 -7
- package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +1 -3
- package/dist/lite/packages/firestore/src/local/local_store_impl.d.ts +2 -0
- package/dist/lite/packages/firestore/src/util/array.d.ts +18 -0
- package/dist/lite/packages/firestore/test/integration/api/provider.test.d.ts +17 -0
- package/dist/lite/packages/firestore/test/integration/util/firebase_export.d.ts +2 -1
- package/dist/lite/packages/firestore/test/integration/util/helpers.d.ts +1 -0
- package/dist/lite/packages/firestore/test/unit/local/counting_query_engine.d.ts +11 -0
- package/dist/lite/packages/firestore/test/unit/local/local_store_indexeddb.test.d.ts +17 -0
- package/dist/lite/packages/firestore/test/unit/specs/index_spec.test.d.ts +17 -0
- package/dist/lite/packages/firestore/test/unit/specs/spec_builder.d.ts +5 -0
- package/dist/lite/packages/firestore/test/unit/specs/spec_test_runner.d.ts +8 -0
- package/dist/lite/packages/firestore/test/unit/util/array.test.d.ts +17 -0
- package/dist/lite/private.d.ts +25 -7
- package/dist/packages/firestore/dist/index.esm2017.d.ts +208 -203
- package/dist/packages/firestore/src/api/credentials.d.ts +13 -3
- package/dist/packages/firestore/src/api/database.d.ts +34 -3
- package/dist/packages/firestore/src/api/index_configuration.d.ts +7 -8
- package/dist/packages/firestore/src/api.d.ts +1 -1
- package/dist/packages/firestore/src/core/database_info.d.ts +4 -0
- package/dist/packages/firestore/src/lite-api/database.d.ts +51 -7
- package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +1 -3
- package/dist/packages/firestore/src/local/local_store_impl.d.ts +2 -0
- package/dist/packages/firestore/src/util/array.d.ts +18 -0
- package/dist/packages/firestore/test/integration/api/provider.test.d.ts +17 -0
- package/dist/packages/firestore/test/integration/util/firebase_export.d.ts +2 -1
- package/dist/packages/firestore/test/integration/util/helpers.d.ts +1 -0
- package/dist/packages/firestore/test/unit/local/counting_query_engine.d.ts +11 -0
- package/dist/packages/firestore/test/unit/local/local_store_indexeddb.test.d.ts +17 -0
- package/dist/packages/firestore/test/unit/specs/index_spec.test.d.ts +17 -0
- package/dist/packages/firestore/test/unit/specs/spec_builder.d.ts +5 -0
- package/dist/packages/firestore/test/unit/specs/spec_test_runner.d.ts +8 -0
- package/dist/packages/firestore/test/unit/util/array.test.d.ts +17 -0
- package/dist/private.d.ts +25 -8
- package/package.json +11 -9
|
@@ -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.9.
|
|
66
|
+
let f = "9.9.3-canary.04dcdbb0f";
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* @license
|
|
@@ -347,10 +347,22 @@ e) {
|
|
|
347
347
|
* recover from unauthenticated errors (see b/33147818 for context), but it's
|
|
348
348
|
* safer to keep the implementation as-is.
|
|
349
349
|
*/ class G {
|
|
350
|
-
constructor(t, e, n) {
|
|
351
|
-
this.
|
|
352
|
-
|
|
353
|
-
|
|
350
|
+
constructor(t, e, n, r) {
|
|
351
|
+
this.t = t, this.i = e, this.o = n, this.u = r, this.type = "FirstParty", this.user = l.FIRST_PARTY,
|
|
352
|
+
this.h = new Map;
|
|
353
|
+
}
|
|
354
|
+
/** Gets an authorization token, using a provided factory function, or falling back to First Party GAPI. */ l() {
|
|
355
|
+
return this.u ? this.u() : (
|
|
356
|
+
// Make sure this really is a Gapi client.
|
|
357
|
+
v(!("object" != typeof this.t || null === this.t || !this.t.auth || !this.t.auth.getAuthHeaderValueForFirstParty)),
|
|
358
|
+
this.t.auth.getAuthHeaderValueForFirstParty([]));
|
|
359
|
+
}
|
|
360
|
+
get headers() {
|
|
361
|
+
this.h.set("X-Goog-AuthUser", this.i);
|
|
362
|
+
// Use array notation to prevent minification
|
|
363
|
+
const t = this.l();
|
|
364
|
+
return t && this.h.set("Authorization", t), this.o && this.h.set("X-Goog-Iam-Authorization-Token", this.o),
|
|
365
|
+
this.h;
|
|
354
366
|
}
|
|
355
367
|
}
|
|
356
368
|
|
|
@@ -359,11 +371,11 @@ e) {
|
|
|
359
371
|
* to authenticate the user, using technique that is only available
|
|
360
372
|
* to applications hosted by Google.
|
|
361
373
|
*/ class W {
|
|
362
|
-
constructor(t, e, n) {
|
|
363
|
-
this.t = t, this.i = e, this.o = n;
|
|
374
|
+
constructor(t, e, n, r) {
|
|
375
|
+
this.t = t, this.i = e, this.o = n, this.u = r;
|
|
364
376
|
}
|
|
365
377
|
getToken() {
|
|
366
|
-
return Promise.resolve(new G(this.t, this.i, this.o));
|
|
378
|
+
return Promise.resolve(new G(this.t, this.i, this.o, this.u));
|
|
367
379
|
}
|
|
368
380
|
start(t, e) {
|
|
369
381
|
// Fire with initial uid.
|
|
@@ -381,7 +393,7 @@ class K {
|
|
|
381
393
|
|
|
382
394
|
/** AppCheck token provider for the Lite SDK. */ class Q {
|
|
383
395
|
constructor(t) {
|
|
384
|
-
this.
|
|
396
|
+
this.m = t, this.appCheck = null, t.onInit((t => {
|
|
385
397
|
this.appCheck = t;
|
|
386
398
|
}));
|
|
387
399
|
}
|
|
@@ -458,22 +470,6 @@ class H {
|
|
|
458
470
|
}
|
|
459
471
|
}
|
|
460
472
|
|
|
461
|
-
/**
|
|
462
|
-
* @license
|
|
463
|
-
* Copyright 2017 Google LLC
|
|
464
|
-
*
|
|
465
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
466
|
-
* you may not use this file except in compliance with the License.
|
|
467
|
-
* You may obtain a copy of the License at
|
|
468
|
-
*
|
|
469
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
470
|
-
*
|
|
471
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
472
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
473
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
474
|
-
* See the License for the specific language governing permissions and
|
|
475
|
-
* limitations under the License.
|
|
476
|
-
*/
|
|
477
473
|
/**
|
|
478
474
|
* Path represents an ordered sequence of string segments.
|
|
479
475
|
*/
|
|
@@ -1009,27 +1005,27 @@ class {
|
|
|
1009
1005
|
constructor(t) {
|
|
1010
1006
|
this.databaseInfo = t, this.databaseId = t.databaseId;
|
|
1011
1007
|
const e = t.ssl ? "https" : "http";
|
|
1012
|
-
this.
|
|
1008
|
+
this.p = e + "://" + t.host, this.g = "projects/" + this.databaseId.projectId + "/databases/" + this.databaseId.database + "/documents";
|
|
1013
1009
|
}
|
|
1014
|
-
|
|
1015
|
-
const i = this.
|
|
1010
|
+
v(t, e, n, r, s) {
|
|
1011
|
+
const i = this.T(t, e);
|
|
1016
1012
|
m("RestConnection", "Sending: ", i, n);
|
|
1017
1013
|
const o = {};
|
|
1018
|
-
return this.
|
|
1014
|
+
return this.I(o, r, s), this.A(t, i, o, n).then((t => (m("RestConnection", "Received: ", t),
|
|
1019
1015
|
t)), (e => {
|
|
1020
1016
|
throw y("RestConnection", `${t} failed with error: `, e, "url: ", i, "request:", n),
|
|
1021
1017
|
e;
|
|
1022
1018
|
}));
|
|
1023
1019
|
}
|
|
1024
|
-
|
|
1020
|
+
R(t, e, n, r, s, i) {
|
|
1025
1021
|
// The REST API automatically aggregates all of the streamed results, so we
|
|
1026
1022
|
// can just use the normal invoke() method.
|
|
1027
|
-
return this.
|
|
1023
|
+
return this.v(t, e, n, r, s);
|
|
1028
1024
|
}
|
|
1029
1025
|
/**
|
|
1030
1026
|
* Modifies the headers for a request, adding any authorization token if
|
|
1031
1027
|
* present and any additional headers for the request.
|
|
1032
|
-
*/
|
|
1028
|
+
*/ I(t, e, n) {
|
|
1033
1029
|
t["X-Goog-Api-Client"] = "gl-js/ fire/" + f,
|
|
1034
1030
|
// Content-Type: text/plain will avoid preflight requests which might
|
|
1035
1031
|
// mess with CORS and redirects by proxies. If we add custom headers
|
|
@@ -1038,9 +1034,9 @@ class {
|
|
|
1038
1034
|
t["Content-Type"] = "text/plain", this.databaseInfo.appId && (t["X-Firebase-GMPID"] = this.databaseInfo.appId),
|
|
1039
1035
|
e && e.headers.forEach(((e, n) => t[n] = e)), n && n.headers.forEach(((e, n) => t[n] = e));
|
|
1040
1036
|
}
|
|
1041
|
-
|
|
1037
|
+
T(t, e) {
|
|
1042
1038
|
const n = ht[t];
|
|
1043
|
-
return `${this.
|
|
1039
|
+
return `${this.p}/v1/${e}:${n}`;
|
|
1044
1040
|
}
|
|
1045
1041
|
} {
|
|
1046
1042
|
/**
|
|
@@ -1048,16 +1044,16 @@ class {
|
|
|
1048
1044
|
* @param fetchImpl - `fetch` or a Polyfill that implements the fetch API.
|
|
1049
1045
|
*/
|
|
1050
1046
|
constructor(t, e) {
|
|
1051
|
-
super(t), this.
|
|
1047
|
+
super(t), this.P = e;
|
|
1052
1048
|
}
|
|
1053
|
-
|
|
1049
|
+
V(t, e) {
|
|
1054
1050
|
throw new Error("Not supported by FetchConnection");
|
|
1055
1051
|
}
|
|
1056
|
-
async
|
|
1052
|
+
async A(t, e, n, r) {
|
|
1057
1053
|
const s = JSON.stringify(r);
|
|
1058
1054
|
let i;
|
|
1059
1055
|
try {
|
|
1060
|
-
i = await this.
|
|
1056
|
+
i = await this.P(e, {
|
|
1061
1057
|
method: "POST",
|
|
1062
1058
|
headers: n,
|
|
1063
1059
|
body: s
|
|
@@ -1135,7 +1131,7 @@ function mt(t) {
|
|
|
1135
1131
|
* See the License for the specific language governing permissions and
|
|
1136
1132
|
* limitations under the License.
|
|
1137
1133
|
*/ class pt {
|
|
1138
|
-
static
|
|
1134
|
+
static N() {
|
|
1139
1135
|
// Alphanumeric characters
|
|
1140
1136
|
const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = Math.floor(256 / t.length) * t.length;
|
|
1141
1137
|
// The largest byte value that is a multiple of `char.length`.
|
|
@@ -2604,7 +2600,7 @@ class Yt {
|
|
|
2604
2600
|
class Jt {
|
|
2605
2601
|
constructor(t, e = null, n = [], r = [], s = null, i = null, o = null) {
|
|
2606
2602
|
this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = s,
|
|
2607
|
-
this.startAt = i, this.endAt = o, this.
|
|
2603
|
+
this.startAt = i, this.endAt = o, this.D = null;
|
|
2608
2604
|
}
|
|
2609
2605
|
}
|
|
2610
2606
|
|
|
@@ -2626,18 +2622,18 @@ class Zt extends class {} {
|
|
|
2626
2622
|
/**
|
|
2627
2623
|
* Creates a filter based on the provided arguments.
|
|
2628
2624
|
*/ static create(t, e, n) {
|
|
2629
|
-
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this
|
|
2625
|
+
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.$(t, e, n) : new te(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new se(t, n) : "in" /* IN */ === e ? new ie(t, n) : "not-in" /* NOT_IN */ === e ? new oe(t, n) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new ue(t, n) : new Zt(t, e, n);
|
|
2630
2626
|
}
|
|
2631
|
-
static
|
|
2627
|
+
static $(t, e, n) {
|
|
2632
2628
|
return "in" /* IN */ === e ? new ee(t, n) : new ne(t, n);
|
|
2633
2629
|
}
|
|
2634
2630
|
matches(t) {
|
|
2635
2631
|
const e = t.data.field(this.field);
|
|
2636
2632
|
// Types do not have to match in NOT_EQUAL filters.
|
|
2637
|
-
return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.
|
|
2633
|
+
return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.F(Ut(e, this.value)) : null !== e && Ct(this.value) === Ct(e) && this.F(Ut(e, this.value));
|
|
2638
2634
|
// Only compare types with matching backend order (such as double and int).
|
|
2639
2635
|
}
|
|
2640
|
-
|
|
2636
|
+
F(t) {
|
|
2641
2637
|
switch (this.op) {
|
|
2642
2638
|
case "<" /* LESS_THAN */ :
|
|
2643
2639
|
return t < 0;
|
|
@@ -2661,7 +2657,7 @@ class Zt extends class {} {
|
|
|
2661
2657
|
return g();
|
|
2662
2658
|
}
|
|
2663
2659
|
}
|
|
2664
|
-
|
|
2660
|
+
S() {
|
|
2665
2661
|
return [ "<" /* LESS_THAN */ , "<=" /* LESS_THAN_OR_EQUAL */ , ">" /* GREATER_THAN */ , ">=" /* GREATER_THAN_OR_EQUAL */ , "!=" /* NOT_EQUAL */ , "not-in" /* NOT_IN */ ].indexOf(this.op) >= 0;
|
|
2666
2662
|
}
|
|
2667
2663
|
}
|
|
@@ -2673,7 +2669,7 @@ class te extends Zt {
|
|
|
2673
2669
|
}
|
|
2674
2670
|
matches(t) {
|
|
2675
2671
|
const e = et.comparator(t.key, this.key);
|
|
2676
|
-
return this.
|
|
2672
|
+
return this.F(e);
|
|
2677
2673
|
}
|
|
2678
2674
|
}
|
|
2679
2675
|
|
|
@@ -2813,9 +2809,9 @@ function le(t, e) {
|
|
|
2813
2809
|
*/
|
|
2814
2810
|
constructor(t, e = null, n = [], r = [], s = null, i = "F" /* First */ , o = null, u = null) {
|
|
2815
2811
|
this.path = t, this.collectionGroup = e, this.explicitOrderBy = n, this.filters = r,
|
|
2816
|
-
this.limit = s, this.limitType = i, this.startAt = o, this.endAt = u, this
|
|
2812
|
+
this.limit = s, this.limitType = i, this.startAt = o, this.endAt = u, this.q = null,
|
|
2817
2813
|
// The corresponding `Target` of this `Query` instance.
|
|
2818
|
-
this.
|
|
2814
|
+
this.O = null, this.startAt, this.endAt;
|
|
2819
2815
|
}
|
|
2820
2816
|
}
|
|
2821
2817
|
|
|
@@ -2824,7 +2820,7 @@ function le(t, e) {
|
|
|
2824
2820
|
}
|
|
2825
2821
|
|
|
2826
2822
|
function we(t) {
|
|
2827
|
-
for (const e of t.filters) if (e.
|
|
2823
|
+
for (const e of t.filters) if (e.S()) return e.field;
|
|
2828
2824
|
return null;
|
|
2829
2825
|
}
|
|
2830
2826
|
|
|
@@ -2846,32 +2842,32 @@ function me(t) {
|
|
|
2846
2842
|
* the SDK and backend always orders by `__name__`).
|
|
2847
2843
|
*/ function pe(t) {
|
|
2848
2844
|
const e = b(t);
|
|
2849
|
-
if (null === e
|
|
2850
|
-
e
|
|
2845
|
+
if (null === e.q) {
|
|
2846
|
+
e.q = [];
|
|
2851
2847
|
const t = we(e), n = de(e);
|
|
2852
2848
|
if (null !== t && null === n)
|
|
2853
2849
|
// In order to implicitly add key ordering, we must also add the
|
|
2854
2850
|
// inequality filter field for it to be a valid query.
|
|
2855
2851
|
// Note that the default inequality field and key ordering is ascending.
|
|
2856
|
-
t.isKeyField() || e
|
|
2852
|
+
t.isKeyField() || e.q.push(new ae(t)), e.q.push(new ae(tt.keyField(), "asc" /* ASCENDING */)); else {
|
|
2857
2853
|
let t = !1;
|
|
2858
|
-
for (const n of e.explicitOrderBy) e
|
|
2854
|
+
for (const n of e.explicitOrderBy) e.q.push(n), n.field.isKeyField() && (t = !0);
|
|
2859
2855
|
if (!t) {
|
|
2860
2856
|
// The order of the implicit key ordering always matches the last
|
|
2861
2857
|
// explicit order by
|
|
2862
2858
|
const t = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
|
|
2863
|
-
e
|
|
2859
|
+
e.q.push(new ae(tt.keyField(), t));
|
|
2864
2860
|
}
|
|
2865
2861
|
}
|
|
2866
2862
|
}
|
|
2867
|
-
return e
|
|
2863
|
+
return e.q;
|
|
2868
2864
|
}
|
|
2869
2865
|
|
|
2870
2866
|
/**
|
|
2871
2867
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
2872
2868
|
*/ function ye(t) {
|
|
2873
2869
|
const e = b(t);
|
|
2874
|
-
if (!e.
|
|
2870
|
+
if (!e.O) if ("F" /* First */ === e.limitType) e.O = Xt(e.path, e.collectionGroup, pe(e), e.filters, e.limit, e.startAt, e.endAt); else {
|
|
2875
2871
|
// Flip the orderBy directions since we want the last results
|
|
2876
2872
|
const t = [];
|
|
2877
2873
|
for (const n of pe(e)) {
|
|
@@ -2881,9 +2877,9 @@ function me(t) {
|
|
|
2881
2877
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
2882
2878
|
const n = e.endAt ? new ce(e.endAt.position, e.endAt.inclusive) : null, r = e.startAt ? new ce(e.startAt.position, e.startAt.inclusive) : null;
|
|
2883
2879
|
// Now return as a LimitType.First query.
|
|
2884
|
-
e.
|
|
2880
|
+
e.O = Xt(e.path, e.collectionGroup, t, e.filters, e.limit, n, r);
|
|
2885
2881
|
}
|
|
2886
|
-
return e.
|
|
2882
|
+
return e.O;
|
|
2887
2883
|
}
|
|
2888
2884
|
|
|
2889
2885
|
function _e(t, e) {
|
|
@@ -2936,7 +2932,7 @@ function ge(t, e) {
|
|
|
2936
2932
|
integerValue: "" + t
|
|
2937
2933
|
};
|
|
2938
2934
|
}(e) : function(t, e) {
|
|
2939
|
-
if (t.
|
|
2935
|
+
if (t.k) {
|
|
2940
2936
|
if (isNaN(e)) return {
|
|
2941
2937
|
doubleValue: "NaN"
|
|
2942
2938
|
};
|
|
@@ -2998,7 +2994,7 @@ function ge(t, e) {
|
|
|
2998
2994
|
* arithmetic is used and precision loss can occur for values greater than 2^53.
|
|
2999
2995
|
*/ class Ie extends ve {
|
|
3000
2996
|
constructor(t, e) {
|
|
3001
|
-
super(), this.
|
|
2997
|
+
super(), this.C = t, this.L = e;
|
|
3002
2998
|
}
|
|
3003
2999
|
}
|
|
3004
3000
|
|
|
@@ -3206,7 +3202,7 @@ function ge(t, e) {
|
|
|
3206
3202
|
*/
|
|
3207
3203
|
class Se {
|
|
3208
3204
|
constructor(t, e) {
|
|
3209
|
-
this.databaseId = t, this.
|
|
3205
|
+
this.databaseId = t, this.k = e;
|
|
3210
3206
|
}
|
|
3211
3207
|
}
|
|
3212
3208
|
|
|
@@ -3222,7 +3218,7 @@ class Se {
|
|
|
3222
3218
|
* Returns a value for a Date that's appropriate to put into a proto.
|
|
3223
3219
|
*/
|
|
3224
3220
|
function qe(t, e) {
|
|
3225
|
-
if (t.
|
|
3221
|
+
if (t.k) {
|
|
3226
3222
|
return `${new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "")}.${("000000000" + e.nanoseconds).slice(-9)}Z`;
|
|
3227
3223
|
}
|
|
3228
3224
|
return {
|
|
@@ -3237,7 +3233,7 @@ function qe(t, e) {
|
|
|
3237
3233
|
* Visible for testing.
|
|
3238
3234
|
*/
|
|
3239
3235
|
function Oe(t, e) {
|
|
3240
|
-
return t.
|
|
3236
|
+
return t.k ? e.toBase64() : e.toUint8Array();
|
|
3241
3237
|
}
|
|
3242
3238
|
|
|
3243
3239
|
function ke(t, e) {
|
|
@@ -3338,7 +3334,7 @@ function We(t, e) {
|
|
|
3338
3334
|
};
|
|
3339
3335
|
if (n instanceof Ie) return {
|
|
3340
3336
|
fieldPath: e.field.canonicalString(),
|
|
3341
|
-
increment: n.
|
|
3337
|
+
increment: n.L
|
|
3342
3338
|
};
|
|
3343
3339
|
throw g();
|
|
3344
3340
|
}(0, t)))), e.precondition.isNone || (n.currentDocument = function(t, e) {
|
|
@@ -3423,7 +3419,7 @@ function Ke(t, e) {
|
|
|
3423
3419
|
}(e.orderBy);
|
|
3424
3420
|
i && (n.structuredQuery.orderBy = i);
|
|
3425
3421
|
const o = function(t, e) {
|
|
3426
|
-
return t.
|
|
3422
|
+
return t.k || ct(e) ? e : {
|
|
3427
3423
|
value: e
|
|
3428
3424
|
};
|
|
3429
3425
|
}(t, e.limit);
|
|
@@ -3537,9 +3533,9 @@ class tn {
|
|
|
3537
3533
|
* Note that jitter will still be applied, so the actual delay could be as
|
|
3538
3534
|
* much as 1.5*maxDelayMs.
|
|
3539
3535
|
*/ , s = 6e4) {
|
|
3540
|
-
this.
|
|
3536
|
+
this.M = t, this.timerId = e, this.U = n, this.j = r, this.B = s, this.G = 0, this.W = null,
|
|
3541
3537
|
/** The last backoff attempt, as epoch milliseconds. */
|
|
3542
|
-
this.
|
|
3538
|
+
this.K = Date.now(), this.reset();
|
|
3543
3539
|
}
|
|
3544
3540
|
/**
|
|
3545
3541
|
* Resets the backoff delay.
|
|
@@ -3548,40 +3544,40 @@ class tn {
|
|
|
3548
3544
|
* (i.e. due to an error), initialDelayMs (plus jitter) will be used, and
|
|
3549
3545
|
* subsequent ones will increase according to the backoffFactor.
|
|
3550
3546
|
*/ reset() {
|
|
3551
|
-
this.
|
|
3547
|
+
this.G = 0;
|
|
3552
3548
|
}
|
|
3553
3549
|
/**
|
|
3554
3550
|
* Resets the backoff delay to the maximum delay (e.g. for use after a
|
|
3555
3551
|
* RESOURCE_EXHAUSTED error).
|
|
3556
|
-
*/
|
|
3557
|
-
this.
|
|
3552
|
+
*/ Y() {
|
|
3553
|
+
this.G = this.B;
|
|
3558
3554
|
}
|
|
3559
3555
|
/**
|
|
3560
3556
|
* Returns a promise that resolves after currentDelayMs, and increases the
|
|
3561
3557
|
* delay for any subsequent attempts. If there was a pending backoff operation
|
|
3562
3558
|
* already, it will be canceled.
|
|
3563
|
-
*/
|
|
3559
|
+
*/ H(t) {
|
|
3564
3560
|
// Cancel any pending backoff operation.
|
|
3565
3561
|
this.cancel();
|
|
3566
3562
|
// First schedule using the current base (which may be 0 and should be
|
|
3567
3563
|
// honored as such).
|
|
3568
|
-
const e = Math.floor(this.
|
|
3564
|
+
const e = Math.floor(this.G + this.J()), n = Math.max(0, Date.now() - this.K), r = Math.max(0, e - n);
|
|
3569
3565
|
// Guard against lastAttemptTime being in the future due to a clock change.
|
|
3570
|
-
r > 0 && m("ExponentialBackoff", `Backing off for ${r} ms (base delay: ${this.
|
|
3571
|
-
this.
|
|
3566
|
+
r > 0 && m("ExponentialBackoff", `Backing off for ${r} ms (base delay: ${this.G} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),
|
|
3567
|
+
this.W = this.M.enqueueAfterDelay(this.timerId, r, (() => (this.K = Date.now(),
|
|
3572
3568
|
t()))),
|
|
3573
3569
|
// Apply backoff factor to determine next delay and ensure it is within
|
|
3574
3570
|
// bounds.
|
|
3575
|
-
this.
|
|
3571
|
+
this.G *= this.j, this.G < this.U && (this.G = this.U), this.G > this.B && (this.G = this.B);
|
|
3576
3572
|
}
|
|
3577
|
-
|
|
3578
|
-
null !== this.
|
|
3573
|
+
X() {
|
|
3574
|
+
null !== this.W && (this.W.skipDelay(), this.W = null);
|
|
3579
3575
|
}
|
|
3580
3576
|
cancel() {
|
|
3581
|
-
null !== this.
|
|
3577
|
+
null !== this.W && (this.W.cancel(), this.W = null);
|
|
3582
3578
|
}
|
|
3583
|
-
/** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */
|
|
3584
|
-
return (Math.random() - .5) * this.
|
|
3579
|
+
/** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ J() {
|
|
3580
|
+
return (Math.random() - .5) * this.G;
|
|
3585
3581
|
}
|
|
3586
3582
|
}
|
|
3587
3583
|
|
|
@@ -3612,44 +3608,44 @@ class tn {
|
|
|
3612
3608
|
*/
|
|
3613
3609
|
class en extends class {} {
|
|
3614
3610
|
constructor(t, e, n, r) {
|
|
3615
|
-
super(), this.authCredentials = t, this.appCheckCredentials = e, this.
|
|
3616
|
-
this.
|
|
3611
|
+
super(), this.authCredentials = t, this.appCheckCredentials = e, this.Z = n, this.C = r,
|
|
3612
|
+
this.tt = !1;
|
|
3617
3613
|
}
|
|
3618
|
-
|
|
3619
|
-
if (this.
|
|
3614
|
+
et() {
|
|
3615
|
+
if (this.tt) throw new L(x, "The client has already been terminated.");
|
|
3620
3616
|
}
|
|
3621
|
-
/** Invokes the provided RPC with auth and AppCheck tokens. */
|
|
3622
|
-
return this.
|
|
3617
|
+
/** Invokes the provided RPC with auth and AppCheck tokens. */ v(t, e, n) {
|
|
3618
|
+
return this.et(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.Z.v(t, e, n, r, s))).catch((t => {
|
|
3623
3619
|
throw "FirebaseError" === t.name ? (t.code === D && (this.authCredentials.invalidateToken(),
|
|
3624
3620
|
this.appCheckCredentials.invalidateToken()), t) : new L(I, t.toString());
|
|
3625
3621
|
}));
|
|
3626
3622
|
}
|
|
3627
|
-
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */
|
|
3628
|
-
return this.
|
|
3623
|
+
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ R(t, e, n, r) {
|
|
3624
|
+
return this.et(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([s, i]) => this.Z.R(t, e, n, s, i, r))).catch((t => {
|
|
3629
3625
|
throw "FirebaseError" === t.name ? (t.code === D && (this.authCredentials.invalidateToken(),
|
|
3630
3626
|
this.appCheckCredentials.invalidateToken()), t) : new L(I, t.toString());
|
|
3631
3627
|
}));
|
|
3632
3628
|
}
|
|
3633
3629
|
terminate() {
|
|
3634
|
-
this.
|
|
3630
|
+
this.tt = !0;
|
|
3635
3631
|
}
|
|
3636
3632
|
}
|
|
3637
3633
|
|
|
3638
3634
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
3639
3635
|
// firestore-exp client.
|
|
3640
3636
|
async function nn(t, e) {
|
|
3641
|
-
const n = b(t), r = Be(n.
|
|
3642
|
-
writes: e.map((t => We(n.
|
|
3637
|
+
const n = b(t), r = Be(n.C) + "/documents", s = {
|
|
3638
|
+
writes: e.map((t => We(n.C, t)))
|
|
3643
3639
|
};
|
|
3644
|
-
await n.
|
|
3640
|
+
await n.v("Commit", r, s);
|
|
3645
3641
|
}
|
|
3646
3642
|
|
|
3647
3643
|
async function rn(t, e) {
|
|
3648
|
-
const n = b(t), r = Be(n.
|
|
3649
|
-
documents: e.map((t => Me(n.
|
|
3650
|
-
}, i = await n.
|
|
3644
|
+
const n = b(t), r = Be(n.C) + "/documents", s = {
|
|
3645
|
+
documents: e.map((t => Me(n.C, t)))
|
|
3646
|
+
}, i = await n.R("BatchGetDocuments", r, s, e.length), o = new Map;
|
|
3651
3647
|
i.forEach((t => {
|
|
3652
|
-
const e = Ge(n.
|
|
3648
|
+
const e = Ge(n.C, t);
|
|
3653
3649
|
o.set(e.key.toString(), e);
|
|
3654
3650
|
}));
|
|
3655
3651
|
const u = [];
|
|
@@ -3660,8 +3656,8 @@ async function rn(t, e) {
|
|
|
3660
3656
|
}
|
|
3661
3657
|
|
|
3662
3658
|
async function sn(t, e) {
|
|
3663
|
-
const n = b(t), r = Ke(n.
|
|
3664
|
-
return (await n.
|
|
3659
|
+
const n = b(t), r = Ke(n.C, ye(e));
|
|
3660
|
+
return (await n.R("RunQuery", r.parent, {
|
|
3665
3661
|
structuredQuery: r.structuredQuery
|
|
3666
3662
|
})).filter((t => !!t.document)).map((t => function(t, e, n) {
|
|
3667
3663
|
const r = Ue(t, e.name), s = Ce(e.updateTime), i = new Yt({
|
|
@@ -3670,7 +3666,7 @@ async function sn(t, e) {
|
|
|
3670
3666
|
}
|
|
3671
3667
|
}), o = Ht.newFoundDocument(r, s, i);
|
|
3672
3668
|
return n && o.setHasCommittedMutations(), n ? o.setHasCommittedMutations() : o;
|
|
3673
|
-
}(n.
|
|
3669
|
+
}(n.C, t.document, void 0)));
|
|
3674
3670
|
}
|
|
3675
3671
|
|
|
3676
3672
|
/**
|
|
@@ -3783,28 +3779,14 @@ class cn {
|
|
|
3783
3779
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
3784
3780
|
*/ class an {
|
|
3785
3781
|
/** @hideconstructor */
|
|
3786
|
-
constructor(t, e, n) {
|
|
3787
|
-
this._authCredentials =
|
|
3782
|
+
constructor(t, e, n, r) {
|
|
3783
|
+
this._authCredentials = t, this._appCheckCredentials = e, this._databaseId = n,
|
|
3784
|
+
this._app = r,
|
|
3788
3785
|
/**
|
|
3789
3786
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
3790
3787
|
*/
|
|
3791
3788
|
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new cn({}),
|
|
3792
|
-
this._settingsFrozen = !1
|
|
3793
|
-
this._databaseId = function(t) {
|
|
3794
|
-
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new L(A, '"projectId" not provided in firebase.initializeApp.');
|
|
3795
|
-
return new H(t.options.projectId);
|
|
3796
|
-
}
|
|
3797
|
-
/**
|
|
3798
|
-
* Initializes a new instance of Cloud Firestore with the provided settings.
|
|
3799
|
-
* Can only be called before any other functions, including
|
|
3800
|
-
* {@link getFirestore}. If the custom settings are empty, this function is
|
|
3801
|
-
* equivalent to calling {@link getFirestore}.
|
|
3802
|
-
*
|
|
3803
|
-
* @param app - The {@link @firebase/app#FirebaseApp} with which the `Firestore` instance will
|
|
3804
|
-
* be associated.
|
|
3805
|
-
* @param settings - A settings object to configure the `Firestore` instance.
|
|
3806
|
-
* @returns A newly initialized `Firestore` instance.
|
|
3807
|
-
*/ (t));
|
|
3789
|
+
this._settingsFrozen = !1;
|
|
3808
3790
|
}
|
|
3809
3791
|
/**
|
|
3810
3792
|
* The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
|
|
@@ -3826,9 +3808,7 @@ class cn {
|
|
|
3826
3808
|
switch (t.type) {
|
|
3827
3809
|
case "gapi":
|
|
3828
3810
|
const e = t.client;
|
|
3829
|
-
|
|
3830
|
-
return v(!("object" != typeof e || null === e || !e.auth || !e.auth.getAuthHeaderValueForFirstParty)),
|
|
3831
|
-
new W(e, t.sessionIndex || "0", t.iamToken || null);
|
|
3811
|
+
return new W(e, t.sessionIndex || "0", t.iamToken || null, t.authTokenFactory || null);
|
|
3832
3812
|
|
|
3833
3813
|
case "provider":
|
|
3834
3814
|
return t.client;
|
|
@@ -3868,24 +3848,21 @@ class cn {
|
|
|
3868
3848
|
}
|
|
3869
3849
|
}
|
|
3870
3850
|
|
|
3871
|
-
function hn(t, e) {
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3851
|
+
function hn(t, e, n) {
|
|
3852
|
+
n || (n = "(default)");
|
|
3853
|
+
const r = _getProvider(t, "firestore/lite");
|
|
3854
|
+
if (r.isInitialized(n)) throw new L(x, "Firestore can only be initialized once per app.");
|
|
3855
|
+
return r.initialize({
|
|
3856
|
+
options: e,
|
|
3857
|
+
instanceIdentifier: n
|
|
3876
3858
|
});
|
|
3877
3859
|
}
|
|
3878
3860
|
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
|
|
3885
|
-
* instance is associated with.
|
|
3886
|
-
* @returns The `Firestore` instance of the provided app.
|
|
3887
|
-
*/ function ln(e = getApp()) {
|
|
3888
|
-
return _getProvider(e, "firestore/lite").getImmediate();
|
|
3861
|
+
function ln(e, n) {
|
|
3862
|
+
const r = "object" == typeof e ? e : getApp(), s = "string" == typeof e ? e : n || "(default)";
|
|
3863
|
+
return _getProvider(r, "firestore/lite").getImmediate({
|
|
3864
|
+
identifier: s
|
|
3865
|
+
});
|
|
3889
3866
|
}
|
|
3890
3867
|
|
|
3891
3868
|
/**
|
|
@@ -4110,7 +4087,7 @@ function gn(t, e, ...n) {
|
|
|
4110
4087
|
if (t = getModularInstance(t),
|
|
4111
4088
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
4112
4089
|
// 'undefined' and 'null'.
|
|
4113
|
-
1 === arguments.length && (e = pt.
|
|
4090
|
+
1 === arguments.length && (e = pt.N()), nt("doc", "path", e), t instanceof an) {
|
|
4114
4091
|
const r = X.fromString(e, ...n);
|
|
4115
4092
|
return rt(r), new wn(t,
|
|
4116
4093
|
/* converter= */ null, new et(r));
|
|
@@ -4439,58 +4416,58 @@ function Dn(t) {
|
|
|
4439
4416
|
* compromised).
|
|
4440
4417
|
*/
|
|
4441
4418
|
constructor(t, e, n, r, s, i) {
|
|
4442
|
-
this.settings = t, this.databaseId = e, this.
|
|
4419
|
+
this.settings = t, this.databaseId = e, this.C = n, this.ignoreUndefinedProperties = r,
|
|
4443
4420
|
// Minor hack: If fieldTransforms is undefined, we assume this is an
|
|
4444
4421
|
// external call and we need to validate the entire path.
|
|
4445
|
-
void 0 === s && this.
|
|
4422
|
+
void 0 === s && this.nt(), this.fieldTransforms = s || [], this.fieldMask = i || [];
|
|
4446
4423
|
}
|
|
4447
4424
|
get path() {
|
|
4448
4425
|
return this.settings.path;
|
|
4449
4426
|
}
|
|
4450
|
-
get
|
|
4451
|
-
return this.settings.
|
|
4427
|
+
get rt() {
|
|
4428
|
+
return this.settings.rt;
|
|
4452
4429
|
}
|
|
4453
|
-
/** Returns a new context with the specified settings overwritten. */
|
|
4454
|
-
return new $n(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.
|
|
4430
|
+
/** Returns a new context with the specified settings overwritten. */ st(t) {
|
|
4431
|
+
return new $n(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.C, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
4455
4432
|
}
|
|
4456
|
-
|
|
4433
|
+
it(t) {
|
|
4457
4434
|
var e;
|
|
4458
|
-
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.
|
|
4435
|
+
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.st({
|
|
4459
4436
|
path: n,
|
|
4460
|
-
|
|
4437
|
+
ot: !1
|
|
4461
4438
|
});
|
|
4462
|
-
return r.
|
|
4439
|
+
return r.ut(t), r;
|
|
4463
4440
|
}
|
|
4464
|
-
|
|
4441
|
+
ct(t) {
|
|
4465
4442
|
var e;
|
|
4466
|
-
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.
|
|
4443
|
+
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.st({
|
|
4467
4444
|
path: n,
|
|
4468
|
-
|
|
4445
|
+
ot: !1
|
|
4469
4446
|
});
|
|
4470
|
-
return r.
|
|
4447
|
+
return r.nt(), r;
|
|
4471
4448
|
}
|
|
4472
|
-
|
|
4449
|
+
at(t) {
|
|
4473
4450
|
// TODO(b/34871131): We don't support array paths right now; so make path
|
|
4474
4451
|
// undefined.
|
|
4475
|
-
return this.
|
|
4452
|
+
return this.st({
|
|
4476
4453
|
path: void 0,
|
|
4477
|
-
|
|
4454
|
+
ot: !0
|
|
4478
4455
|
});
|
|
4479
4456
|
}
|
|
4480
|
-
|
|
4481
|
-
return Jn(t, this.settings.methodName, this.settings.
|
|
4457
|
+
ht(t) {
|
|
4458
|
+
return Jn(t, this.settings.methodName, this.settings.lt || !1, this.path, this.settings.ft);
|
|
4482
4459
|
}
|
|
4483
4460
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
4484
4461
|
return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
|
|
4485
4462
|
}
|
|
4486
|
-
|
|
4463
|
+
nt() {
|
|
4487
4464
|
// TODO(b/34871131): Remove null check once we have proper paths for fields
|
|
4488
4465
|
// within arrays.
|
|
4489
|
-
if (this.path) for (let t = 0; t < this.path.length; t++) this.
|
|
4466
|
+
if (this.path) for (let t = 0; t < this.path.length; t++) this.ut(this.path.get(t));
|
|
4490
4467
|
}
|
|
4491
|
-
|
|
4492
|
-
if (0 === t.length) throw this.
|
|
4493
|
-
if (Dn(this.
|
|
4468
|
+
ut(t) {
|
|
4469
|
+
if (0 === t.length) throw this.ht("Document fields must not be empty");
|
|
4470
|
+
if (Dn(this.rt) && Pn.test(t)) throw this.ht('Document fields cannot begin and end with "__"');
|
|
4494
4471
|
}
|
|
4495
4472
|
}
|
|
4496
4473
|
|
|
@@ -4499,17 +4476,17 @@ function Dn(t) {
|
|
|
4499
4476
|
* classes.
|
|
4500
4477
|
*/ class xn {
|
|
4501
4478
|
constructor(t, e, n) {
|
|
4502
|
-
this.databaseId = t, this.ignoreUndefinedProperties = e, this.
|
|
4479
|
+
this.databaseId = t, this.ignoreUndefinedProperties = e, this.C = n || Ze(t);
|
|
4503
4480
|
}
|
|
4504
|
-
/** Creates a new top-level parse context. */
|
|
4481
|
+
/** Creates a new top-level parse context. */ dt(t, e, n, r = !1) {
|
|
4505
4482
|
return new $n({
|
|
4506
|
-
|
|
4483
|
+
rt: t,
|
|
4507
4484
|
methodName: e,
|
|
4508
|
-
|
|
4485
|
+
ft: n,
|
|
4509
4486
|
path: tt.emptyPath(),
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
}, this.databaseId, this.
|
|
4487
|
+
ot: !1,
|
|
4488
|
+
lt: r
|
|
4489
|
+
}, this.databaseId, this.C, this.ignoreUndefinedProperties);
|
|
4513
4490
|
}
|
|
4514
4491
|
}
|
|
4515
4492
|
|
|
@@ -4519,7 +4496,7 @@ function Fn(t) {
|
|
|
4519
4496
|
}
|
|
4520
4497
|
|
|
4521
4498
|
/** Parse document data from a set() call. */ function Sn(t, e, n, r, s, i = {}) {
|
|
4522
|
-
const o = t.
|
|
4499
|
+
const o = t.dt(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, s);
|
|
4523
4500
|
Kn("Data must be an object, but it was:", o, r);
|
|
4524
4501
|
const u = Gn(r, o);
|
|
4525
4502
|
let c, a;
|
|
@@ -4537,7 +4514,7 @@ function Fn(t) {
|
|
|
4537
4514
|
|
|
4538
4515
|
class qn extends An {
|
|
4539
4516
|
_toFieldTransform(t) {
|
|
4540
|
-
if (2 /* MergeSet */ !== t.
|
|
4517
|
+
if (2 /* MergeSet */ !== t.rt) throw 1 /* Update */ === t.rt ? t.ht(`${this._methodName}() can only appear at the top level of your update data`) : t.ht(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
|
|
4541
4518
|
// No transform to add for a delete, but we need to add it to our
|
|
4542
4519
|
// fieldMask so it gets deleted.
|
|
4543
4520
|
return t.fieldMask.push(t.path), null;
|
|
@@ -4564,11 +4541,11 @@ class qn extends An {
|
|
|
4564
4541
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
4565
4542
|
*/ function On(t, e, n) {
|
|
4566
4543
|
return new $n({
|
|
4567
|
-
|
|
4568
|
-
|
|
4544
|
+
rt: 3 /* Argument */ ,
|
|
4545
|
+
ft: e.settings.ft,
|
|
4569
4546
|
methodName: t._methodName,
|
|
4570
|
-
|
|
4571
|
-
}, e.databaseId, e.
|
|
4547
|
+
ot: n
|
|
4548
|
+
}, e.databaseId, e.C, e.ignoreUndefinedProperties);
|
|
4572
4549
|
}
|
|
4573
4550
|
|
|
4574
4551
|
class kn extends An {
|
|
@@ -4582,11 +4559,11 @@ class kn extends An {
|
|
|
4582
4559
|
|
|
4583
4560
|
class Cn extends An {
|
|
4584
4561
|
constructor(t, e) {
|
|
4585
|
-
super(t), this.
|
|
4562
|
+
super(t), this.wt = e;
|
|
4586
4563
|
}
|
|
4587
4564
|
_toFieldTransform(t) {
|
|
4588
4565
|
const e = On(this, t,
|
|
4589
|
-
/*array=*/ !0), n = this.
|
|
4566
|
+
/*array=*/ !0), n = this.wt.map((t => zn(t, e))), r = new Ee(n);
|
|
4590
4567
|
return new Ae(t.path, r);
|
|
4591
4568
|
}
|
|
4592
4569
|
isEqual(t) {
|
|
@@ -4597,11 +4574,11 @@ class Cn extends An {
|
|
|
4597
4574
|
|
|
4598
4575
|
class Ln extends An {
|
|
4599
4576
|
constructor(t, e) {
|
|
4600
|
-
super(t), this.
|
|
4577
|
+
super(t), this.wt = e;
|
|
4601
4578
|
}
|
|
4602
4579
|
_toFieldTransform(t) {
|
|
4603
4580
|
const e = On(this, t,
|
|
4604
|
-
/*array=*/ !0), n = this.
|
|
4581
|
+
/*array=*/ !0), n = this.wt.map((t => zn(t, e))), r = new Te(n);
|
|
4605
4582
|
return new Ae(t.path, r);
|
|
4606
4583
|
}
|
|
4607
4584
|
isEqual(t) {
|
|
@@ -4612,10 +4589,10 @@ class Ln extends An {
|
|
|
4612
4589
|
|
|
4613
4590
|
class Mn extends An {
|
|
4614
4591
|
constructor(t, e) {
|
|
4615
|
-
super(t), this.
|
|
4592
|
+
super(t), this.yt = e;
|
|
4616
4593
|
}
|
|
4617
4594
|
_toFieldTransform(t) {
|
|
4618
|
-
const e = new Ie(t.
|
|
4595
|
+
const e = new Ie(t.C, ge(t.C, this.yt));
|
|
4619
4596
|
return new Ae(t.path, e);
|
|
4620
4597
|
}
|
|
4621
4598
|
isEqual(t) {
|
|
@@ -4625,7 +4602,7 @@ class Mn extends An {
|
|
|
4625
4602
|
}
|
|
4626
4603
|
|
|
4627
4604
|
/** Parse update data from an update() call. */ function Un(t, e, n, r) {
|
|
4628
|
-
const s = t.
|
|
4605
|
+
const s = t.dt(1 /* Update */ , e, n);
|
|
4629
4606
|
Kn("Data must be an object, but it was:", s, r);
|
|
4630
4607
|
const i = [], o = Yt.empty();
|
|
4631
4608
|
Et(r, ((t, r) => {
|
|
@@ -4633,7 +4610,7 @@ class Mn extends An {
|
|
|
4633
4610
|
// For Compat types, we have to "extract" the underlying types before
|
|
4634
4611
|
// performing validation.
|
|
4635
4612
|
r = getModularInstance(r);
|
|
4636
|
-
const c = s.
|
|
4613
|
+
const c = s.ct(u);
|
|
4637
4614
|
if (r instanceof qn)
|
|
4638
4615
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4639
4616
|
i.push(u); else {
|
|
@@ -4646,7 +4623,7 @@ class Mn extends An {
|
|
|
4646
4623
|
}
|
|
4647
4624
|
|
|
4648
4625
|
/** Parse update data from a list of field/value arguments. */ function jn(t, e, n, r, s, i) {
|
|
4649
|
-
const o = t.
|
|
4626
|
+
const o = t.dt(1 /* Update */ , e, n), u = [ Qn(e, r, n) ], c = [ s ];
|
|
4650
4627
|
if (i.length % 2 != 0) throw new L(A, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
4651
4628
|
for (let t = 0; t < i.length; t += 2) u.push(Qn(e, i[t])), c.push(i[t + 1]);
|
|
4652
4629
|
const a = [], l = Yt.empty();
|
|
@@ -4658,7 +4635,7 @@ class Mn extends An {
|
|
|
4658
4635
|
// For Compat types, we have to "extract" the underlying types before
|
|
4659
4636
|
// performing validation.
|
|
4660
4637
|
n = getModularInstance(n);
|
|
4661
|
-
const r = o.
|
|
4638
|
+
const r = o.ct(e);
|
|
4662
4639
|
if (n instanceof qn)
|
|
4663
4640
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4664
4641
|
a.push(e); else {
|
|
@@ -4677,7 +4654,7 @@ class Mn extends An {
|
|
|
4677
4654
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
4678
4655
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
4679
4656
|
*/ function Bn(t, e, n, r = !1) {
|
|
4680
|
-
return zn(n, t.
|
|
4657
|
+
return zn(n, t.dt(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
|
|
4681
4658
|
}
|
|
4682
4659
|
|
|
4683
4660
|
/**
|
|
@@ -4705,8 +4682,8 @@ class Mn extends An {
|
|
|
4705
4682
|
*/
|
|
4706
4683
|
return function(t, e) {
|
|
4707
4684
|
// Sentinels are only supported with writes, and not within arrays.
|
|
4708
|
-
if (!Dn(e.
|
|
4709
|
-
if (!e.path) throw e.
|
|
4685
|
+
if (!Dn(e.rt)) throw e.ht(`${t._methodName}() can only be used with update() and set()`);
|
|
4686
|
+
if (!e.path) throw e.ht(`${t._methodName}() is not currently supported inside arrays`);
|
|
4710
4687
|
const n = t._toFieldTransform(e);
|
|
4711
4688
|
n && e.fieldTransforms.push(n);
|
|
4712
4689
|
}
|
|
@@ -4730,12 +4707,12 @@ class Mn extends An {
|
|
|
4730
4707
|
// the set of values to be included for the IN query) that may directly
|
|
4731
4708
|
// contain additional arrays (each representing an individual field
|
|
4732
4709
|
// value), so we disable this validation.
|
|
4733
|
-
if (e.settings.
|
|
4710
|
+
if (e.settings.ot && 4 /* ArrayArgument */ !== e.rt) throw e.ht("Nested arrays are not supported");
|
|
4734
4711
|
return function(t, e) {
|
|
4735
4712
|
const n = [];
|
|
4736
4713
|
let r = 0;
|
|
4737
4714
|
for (const s of t) {
|
|
4738
|
-
let t = zn(s, e.
|
|
4715
|
+
let t = zn(s, e.at(r));
|
|
4739
4716
|
null == t && (
|
|
4740
4717
|
// Just include nulls in the array for fields being replaced with a
|
|
4741
4718
|
// sentinel.
|
|
@@ -4754,7 +4731,7 @@ class Mn extends An {
|
|
|
4754
4731
|
if (null === (t = getModularInstance(t))) return {
|
|
4755
4732
|
nullValue: "NULL_VALUE"
|
|
4756
4733
|
};
|
|
4757
|
-
if ("number" == typeof t) return ge(e.
|
|
4734
|
+
if ("number" == typeof t) return ge(e.C, t);
|
|
4758
4735
|
if ("boolean" == typeof t) return {
|
|
4759
4736
|
booleanValue: t
|
|
4760
4737
|
};
|
|
@@ -4764,7 +4741,7 @@ class Mn extends An {
|
|
|
4764
4741
|
if (t instanceof Date) {
|
|
4765
4742
|
const n = gt.fromDate(t);
|
|
4766
4743
|
return {
|
|
4767
|
-
timestampValue: qe(e.
|
|
4744
|
+
timestampValue: qe(e.C, n)
|
|
4768
4745
|
};
|
|
4769
4746
|
}
|
|
4770
4747
|
if (t instanceof gt) {
|
|
@@ -4773,7 +4750,7 @@ class Mn extends An {
|
|
|
4773
4750
|
// truncation immediately without waiting for the backend to do that.
|
|
4774
4751
|
const n = new gt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
4775
4752
|
return {
|
|
4776
|
-
timestampValue: qe(e.
|
|
4753
|
+
timestampValue: qe(e.C, n)
|
|
4777
4754
|
};
|
|
4778
4755
|
}
|
|
4779
4756
|
if (t instanceof Rn) return {
|
|
@@ -4783,16 +4760,16 @@ class Mn extends An {
|
|
|
4783
4760
|
}
|
|
4784
4761
|
};
|
|
4785
4762
|
if (t instanceof In) return {
|
|
4786
|
-
bytesValue: Oe(e.
|
|
4763
|
+
bytesValue: Oe(e.C, t._byteString)
|
|
4787
4764
|
};
|
|
4788
4765
|
if (t instanceof wn) {
|
|
4789
4766
|
const n = e.databaseId, r = t.firestore._databaseId;
|
|
4790
|
-
if (!r.isEqual(n)) throw e.
|
|
4767
|
+
if (!r.isEqual(n)) throw e.ht(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);
|
|
4791
4768
|
return {
|
|
4792
4769
|
referenceValue: Le(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
4793
4770
|
};
|
|
4794
4771
|
}
|
|
4795
|
-
throw e.
|
|
4772
|
+
throw e.ht(`Unsupported field value: ${it(t)}`);
|
|
4796
4773
|
}
|
|
4797
4774
|
/**
|
|
4798
4775
|
* Checks whether an object looks like a JSON object that should be converted
|
|
@@ -4809,7 +4786,7 @@ function Gn(t, e) {
|
|
|
4809
4786
|
for (const e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
|
|
4810
4787
|
return !0;
|
|
4811
4788
|
}(t) ? Et(t, ((t, r) => {
|
|
4812
|
-
const s = zn(r, e.
|
|
4789
|
+
const s = zn(r, e.it(t));
|
|
4813
4790
|
null != s && (n[t] = s);
|
|
4814
4791
|
})) :
|
|
4815
4792
|
// If we encounter an empty object, we explicitly add it to the update
|
|
@@ -4830,7 +4807,7 @@ function Kn(t, e, n) {
|
|
|
4830
4807
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
4831
4808
|
}(n)) {
|
|
4832
4809
|
const r = it(n);
|
|
4833
|
-
throw "an object" === r ? e.
|
|
4810
|
+
throw "an object" === r ? e.ht(t + " a custom object") : e.ht(t + " " + r);
|
|
4834
4811
|
}
|
|
4835
4812
|
}
|
|
4836
4813
|
|
|
@@ -5081,7 +5058,7 @@ class sr {}
|
|
|
5081
5058
|
|
|
5082
5059
|
class or extends sr {
|
|
5083
5060
|
constructor(t, e, n) {
|
|
5084
|
-
super(), this.
|
|
5061
|
+
super(), this._t = t, this.gt = e, this.vt = n, this.type = "where";
|
|
5085
5062
|
}
|
|
5086
5063
|
_apply(t) {
|
|
5087
5064
|
const e = Fn(t.firestore), n = function(t, e, n, r, s, i, o) {
|
|
@@ -5103,7 +5080,7 @@ class or extends sr {
|
|
|
5103
5080
|
/* allowArrays= */ "in" /* IN */ === i || "not-in" /* NOT_IN */ === i);
|
|
5104
5081
|
const c = Zt.create(s, i, u);
|
|
5105
5082
|
return function(t, e) {
|
|
5106
|
-
if (e.
|
|
5083
|
+
if (e.S()) {
|
|
5107
5084
|
const n = we(t);
|
|
5108
5085
|
if (null !== n && !n.isEqual(e.field)) throw new L(A, `Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${e.field.toString()}'`);
|
|
5109
5086
|
const r = de(t);
|
|
@@ -5150,7 +5127,7 @@ class or extends sr {
|
|
|
5150
5127
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
5151
5128
|
throw n === e.op ? new L(A, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new L(A, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
5152
5129
|
}(t, c), c;
|
|
5153
|
-
}(t._query, "where", e, t.firestore._databaseId, this.
|
|
5130
|
+
}(t._query, "where", e, t.firestore._databaseId, this._t, this.gt, this.vt);
|
|
5154
5131
|
return new mn(t.firestore, t.converter, function(t, e) {
|
|
5155
5132
|
const n = t.filters.concat([ e ]);
|
|
5156
5133
|
return new fe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
@@ -5175,7 +5152,7 @@ class or extends sr {
|
|
|
5175
5152
|
|
|
5176
5153
|
class cr extends sr {
|
|
5177
5154
|
constructor(t, e) {
|
|
5178
|
-
super(), this.
|
|
5155
|
+
super(), this._t = t, this.bt = e, this.type = "orderBy";
|
|
5179
5156
|
}
|
|
5180
5157
|
_apply(t) {
|
|
5181
5158
|
const e = function(t, e, n) {
|
|
@@ -5200,7 +5177,7 @@ class cr extends sr {
|
|
|
5200
5177
|
* Will throw if the document does not contain all fields of the order by
|
|
5201
5178
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
5202
5179
|
* server timestamp.
|
|
5203
|
-
*/ (t._query, this.
|
|
5180
|
+
*/ (t._query, this._t, this.bt);
|
|
5204
5181
|
return new mn(t.firestore, t.converter, function(t, e) {
|
|
5205
5182
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
5206
5183
|
const n = t.explicitOrderBy.concat([ e ]);
|
|
@@ -5224,12 +5201,12 @@ class cr extends sr {
|
|
|
5224
5201
|
|
|
5225
5202
|
class hr extends sr {
|
|
5226
5203
|
constructor(t, e, n) {
|
|
5227
|
-
super(), this.type = t, this.
|
|
5204
|
+
super(), this.type = t, this.Et = e, this.Tt = n;
|
|
5228
5205
|
}
|
|
5229
5206
|
_apply(t) {
|
|
5230
5207
|
return new mn(t.firestore, t.converter, function(t, e, n) {
|
|
5231
5208
|
return new fe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
5232
|
-
}(t._query, this.
|
|
5209
|
+
}(t._query, this.Et, this.Tt));
|
|
5233
5210
|
}
|
|
5234
5211
|
}
|
|
5235
5212
|
|
|
@@ -5256,10 +5233,10 @@ class hr extends sr {
|
|
|
5256
5233
|
|
|
5257
5234
|
class dr extends sr {
|
|
5258
5235
|
constructor(t, e, n) {
|
|
5259
|
-
super(), this.type = t, this.
|
|
5236
|
+
super(), this.type = t, this.It = e, this.At = n;
|
|
5260
5237
|
}
|
|
5261
5238
|
_apply(t) {
|
|
5262
|
-
const e = gr(t, this.type, this.
|
|
5239
|
+
const e = gr(t, this.type, this.It, this.At);
|
|
5263
5240
|
return new mn(t.firestore, t.converter, function(t, e) {
|
|
5264
5241
|
return new fe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
5265
5242
|
}(t._query, e));
|
|
@@ -5278,10 +5255,10 @@ function mr(...t) {
|
|
|
5278
5255
|
|
|
5279
5256
|
class pr extends sr {
|
|
5280
5257
|
constructor(t, e, n) {
|
|
5281
|
-
super(), this.type = t, this.
|
|
5258
|
+
super(), this.type = t, this.It = e, this.At = n;
|
|
5282
5259
|
}
|
|
5283
5260
|
_apply(t) {
|
|
5284
|
-
const e = gr(t, this.type, this.
|
|
5261
|
+
const e = gr(t, this.type, this.It, this.At);
|
|
5285
5262
|
return new mn(t.firestore, t.converter, function(t, e) {
|
|
5286
5263
|
return new fe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
5287
5264
|
}(t._query, e));
|
|
@@ -5872,7 +5849,7 @@ function kr(t, e) {
|
|
|
5872
5849
|
let e;
|
|
5873
5850
|
if (t.isFoundDocument()) e = t.version; else {
|
|
5874
5851
|
if (!t.isNoDocument()) throw g();
|
|
5875
|
-
//
|
|
5852
|
+
// Represent a deleted doc using SnapshotVersion.min().
|
|
5876
5853
|
e = vt.min();
|
|
5877
5854
|
}
|
|
5878
5855
|
const n = this.readVersions.get(t.key.toString());
|
|
@@ -5887,7 +5864,7 @@ function kr(t, e) {
|
|
|
5887
5864
|
* as a precondition, or no precondition if it was not read.
|
|
5888
5865
|
*/ precondition(t) {
|
|
5889
5866
|
const e = this.readVersions.get(t.toString());
|
|
5890
|
-
return !this.writtenDocs.has(t.toString()) && e ? Re.updateTime(e) : Re.none();
|
|
5867
|
+
return !this.writtenDocs.has(t.toString()) && e ? e.isEqual(vt.min()) ? Re.exists(!1) : Re.updateTime(e) : Re.none();
|
|
5891
5868
|
}
|
|
5892
5869
|
/**
|
|
5893
5870
|
* Returns the precondition for a document if the operation is an update.
|
|
@@ -5962,26 +5939,26 @@ function kr(t, e) {
|
|
|
5962
5939
|
class Ur {
|
|
5963
5940
|
constructor(t, e, n, r, s) {
|
|
5964
5941
|
this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = r,
|
|
5965
|
-
this.deferred = s, this.
|
|
5942
|
+
this.deferred = s, this.Rt = n.maxAttempts, this.Pt = new tn(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
5966
5943
|
}
|
|
5967
5944
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
5968
|
-
this.
|
|
5945
|
+
this.Rt -= 1, this.Vt();
|
|
5969
5946
|
}
|
|
5970
|
-
|
|
5971
|
-
this.
|
|
5972
|
-
const t = new Lr(this.datastore), e = this.
|
|
5947
|
+
Vt() {
|
|
5948
|
+
this.Pt.H((async () => {
|
|
5949
|
+
const t = new Lr(this.datastore), e = this.Nt(t);
|
|
5973
5950
|
e && e.then((e => {
|
|
5974
5951
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
5975
5952
|
this.deferred.resolve(e);
|
|
5976
5953
|
})).catch((t => {
|
|
5977
|
-
this.
|
|
5954
|
+
this.Dt(t);
|
|
5978
5955
|
}))));
|
|
5979
5956
|
})).catch((t => {
|
|
5980
|
-
this.
|
|
5957
|
+
this.Dt(t);
|
|
5981
5958
|
}));
|
|
5982
5959
|
}));
|
|
5983
5960
|
}
|
|
5984
|
-
|
|
5961
|
+
Nt(t) {
|
|
5985
5962
|
try {
|
|
5986
5963
|
const e = this.updateFunction(t);
|
|
5987
5964
|
return !ct(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
|
|
@@ -5991,11 +5968,11 @@ class Ur {
|
|
|
5991
5968
|
return this.deferred.reject(t), null;
|
|
5992
5969
|
}
|
|
5993
5970
|
}
|
|
5994
|
-
|
|
5995
|
-
this.
|
|
5971
|
+
Dt(t) {
|
|
5972
|
+
this.Rt > 0 && this.$t(t) ? (this.Rt -= 1, this.asyncQueue.enqueueAndForget((() => (this.Vt(),
|
|
5996
5973
|
Promise.resolve())))) : this.deferred.reject(t);
|
|
5997
5974
|
}
|
|
5998
|
-
|
|
5975
|
+
$t(t) {
|
|
5999
5976
|
if ("FirebaseError" === t.name) {
|
|
6000
5977
|
// In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and
|
|
6001
5978
|
// non-matching document versions with ABORTED. These errors should be retried.
|
|
@@ -6166,39 +6143,39 @@ class Ur {
|
|
|
6166
6143
|
*/ class zr {
|
|
6167
6144
|
constructor() {
|
|
6168
6145
|
// The last promise in the queue.
|
|
6169
|
-
this.
|
|
6146
|
+
this.xt = Promise.resolve(),
|
|
6170
6147
|
// A list of retryable operations. Retryable operations are run in order and
|
|
6171
6148
|
// retried with backoff.
|
|
6172
|
-
this.
|
|
6149
|
+
this.Ft = [],
|
|
6173
6150
|
// Is this AsyncQueue being shut down? Once it is set to true, it will not
|
|
6174
6151
|
// be changed again.
|
|
6175
|
-
this
|
|
6152
|
+
this.St = !1,
|
|
6176
6153
|
// Operations scheduled to be queued in the future. Operations are
|
|
6177
6154
|
// automatically removed after they are run or canceled.
|
|
6178
|
-
this.
|
|
6155
|
+
this.qt = [],
|
|
6179
6156
|
// visible for testing
|
|
6180
|
-
this.
|
|
6157
|
+
this.Ot = null,
|
|
6181
6158
|
// Flag set while there's an outstanding AsyncQueue operation, used for
|
|
6182
6159
|
// assertion sanity-checks.
|
|
6183
|
-
this.
|
|
6160
|
+
this.kt = !1,
|
|
6184
6161
|
// Enabled during shutdown on Safari to prevent future access to IndexedDB.
|
|
6185
|
-
this.
|
|
6162
|
+
this.Ct = !1,
|
|
6186
6163
|
// List of TimerIds to fast-forward delays for.
|
|
6187
|
-
this.
|
|
6164
|
+
this.Lt = [],
|
|
6188
6165
|
// Backoff timer used to schedule retries for retryable operations
|
|
6189
|
-
this.
|
|
6166
|
+
this.Pt = new tn(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
6190
6167
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
6191
6168
|
// operations. Meant to speed up recovery when we regain file system access
|
|
6192
6169
|
// after page comes into foreground.
|
|
6193
|
-
this.
|
|
6170
|
+
this.Mt = () => {
|
|
6194
6171
|
const t = jr();
|
|
6195
|
-
t && m("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.
|
|
6172
|
+
t && m("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.Pt.X();
|
|
6196
6173
|
};
|
|
6197
6174
|
const t = jr();
|
|
6198
|
-
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.
|
|
6175
|
+
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Mt);
|
|
6199
6176
|
}
|
|
6200
6177
|
get isShuttingDown() {
|
|
6201
|
-
return this
|
|
6178
|
+
return this.St;
|
|
6202
6179
|
}
|
|
6203
6180
|
/**
|
|
6204
6181
|
* Adds a new operation to the queue without waiting for it to complete (i.e.
|
|
@@ -6208,38 +6185,38 @@ class Ur {
|
|
|
6208
6185
|
this.enqueue(t);
|
|
6209
6186
|
}
|
|
6210
6187
|
enqueueAndForgetEvenWhileRestricted(t) {
|
|
6211
|
-
this.
|
|
6188
|
+
this.Ut(),
|
|
6212
6189
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
6213
|
-
this.
|
|
6190
|
+
this.jt(t);
|
|
6214
6191
|
}
|
|
6215
6192
|
enterRestrictedMode(t) {
|
|
6216
|
-
if (!this
|
|
6217
|
-
this
|
|
6193
|
+
if (!this.St) {
|
|
6194
|
+
this.St = !0, this.Ct = t || !1;
|
|
6218
6195
|
const e = jr();
|
|
6219
|
-
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.
|
|
6196
|
+
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Mt);
|
|
6220
6197
|
}
|
|
6221
6198
|
}
|
|
6222
6199
|
enqueue(t) {
|
|
6223
|
-
if (this.
|
|
6200
|
+
if (this.Ut(), this.St)
|
|
6224
6201
|
// Return a Promise which never resolves.
|
|
6225
6202
|
return new Promise((() => {}));
|
|
6226
6203
|
// Create a deferred Promise that we can return to the callee. This
|
|
6227
6204
|
// allows us to return a "hanging Promise" only to the callee and still
|
|
6228
6205
|
// advance the queue even when the operation is not run.
|
|
6229
6206
|
const e = new M;
|
|
6230
|
-
return this.
|
|
6207
|
+
return this.jt((() => this.St && this.Ct ? Promise.resolve() : (t().then(e.resolve, e.reject),
|
|
6231
6208
|
e.promise))).then((() => e.promise));
|
|
6232
6209
|
}
|
|
6233
6210
|
enqueueRetryable(t) {
|
|
6234
|
-
this.enqueueAndForget((() => (this.
|
|
6211
|
+
this.enqueueAndForget((() => (this.Ft.push(t), this.Bt())));
|
|
6235
6212
|
}
|
|
6236
6213
|
/**
|
|
6237
6214
|
* Runs the next operation from the retryable queue. If the operation fails,
|
|
6238
6215
|
* reschedules with backoff.
|
|
6239
|
-
*/ async
|
|
6240
|
-
if (0 !== this.
|
|
6216
|
+
*/ async Bt() {
|
|
6217
|
+
if (0 !== this.Ft.length) {
|
|
6241
6218
|
try {
|
|
6242
|
-
await this.
|
|
6219
|
+
await this.Ft[0](), this.Ft.shift(), this.Pt.reset();
|
|
6243
6220
|
} catch (t) {
|
|
6244
6221
|
if (!
|
|
6245
6222
|
/**
|
|
@@ -6283,7 +6260,7 @@ class Ur {
|
|
|
6283
6260
|
// Failure will be handled by AsyncQueue
|
|
6284
6261
|
m("AsyncQueue", "Operation failed with retryable error: " + t);
|
|
6285
6262
|
}
|
|
6286
|
-
this.
|
|
6263
|
+
this.Ft.length > 0 &&
|
|
6287
6264
|
// If there are additional operations, we re-schedule `retryNextOp()`.
|
|
6288
6265
|
// This is necessary to run retryable operations that failed during
|
|
6289
6266
|
// their initial attempt since we don't know whether they are already
|
|
@@ -6294,12 +6271,12 @@ class Ur {
|
|
|
6294
6271
|
// Since `backoffAndRun()` cancels an existing backoff and schedules a
|
|
6295
6272
|
// new backoff on every call, there is only ever a single additional
|
|
6296
6273
|
// operation in the queue.
|
|
6297
|
-
this.
|
|
6274
|
+
this.Pt.H((() => this.Bt()));
|
|
6298
6275
|
}
|
|
6299
6276
|
}
|
|
6300
|
-
|
|
6301
|
-
const e = this.
|
|
6302
|
-
this.
|
|
6277
|
+
jt(t) {
|
|
6278
|
+
const e = this.xt.then((() => (this.kt = !0, t().catch((t => {
|
|
6279
|
+
this.Ot = t, this.kt = !1;
|
|
6303
6280
|
const e =
|
|
6304
6281
|
/**
|
|
6305
6282
|
* Chrome includes Error.message in Error.stack. Other browsers do not.
|
|
@@ -6340,38 +6317,38 @@ class Ur {
|
|
|
6340
6317
|
// all further attempts to chain (via .then) will just short-circuit
|
|
6341
6318
|
// and return the rejected Promise.
|
|
6342
6319
|
throw p("INTERNAL UNHANDLED ERROR: ", e), t;
|
|
6343
|
-
})).then((t => (this.
|
|
6344
|
-
return this.
|
|
6320
|
+
})).then((t => (this.kt = !1, t))))));
|
|
6321
|
+
return this.xt = e, e;
|
|
6345
6322
|
}
|
|
6346
6323
|
enqueueAfterDelay(t, e, n) {
|
|
6347
|
-
this.
|
|
6324
|
+
this.Ut(),
|
|
6348
6325
|
// Fast-forward delays for timerIds that have been overriden.
|
|
6349
|
-
this.
|
|
6350
|
-
const r = Br.createAndSchedule(this, t, e, n, (t => this.
|
|
6351
|
-
return this.
|
|
6326
|
+
this.Lt.indexOf(t) > -1 && (e = 0);
|
|
6327
|
+
const r = Br.createAndSchedule(this, t, e, n, (t => this.zt(t)));
|
|
6328
|
+
return this.qt.push(r), r;
|
|
6352
6329
|
}
|
|
6353
|
-
|
|
6354
|
-
this.
|
|
6330
|
+
Ut() {
|
|
6331
|
+
this.Ot && g();
|
|
6355
6332
|
}
|
|
6356
6333
|
verifyOperationInProgress() {}
|
|
6357
6334
|
/**
|
|
6358
6335
|
* Waits until all currently queued tasks are finished executing. Delayed
|
|
6359
6336
|
* operations are not run.
|
|
6360
|
-
*/ async
|
|
6337
|
+
*/ async Gt() {
|
|
6361
6338
|
// Operations in the queue prior to draining may have enqueued additional
|
|
6362
6339
|
// operations. Keep draining the queue until the tail is no longer advanced,
|
|
6363
6340
|
// which indicates that no more new operations were enqueued and that all
|
|
6364
6341
|
// operations were executed.
|
|
6365
6342
|
let t;
|
|
6366
6343
|
do {
|
|
6367
|
-
t = this.
|
|
6368
|
-
} while (t !== this.
|
|
6344
|
+
t = this.xt, await t;
|
|
6345
|
+
} while (t !== this.xt);
|
|
6369
6346
|
}
|
|
6370
6347
|
/**
|
|
6371
6348
|
* For Tests: Determine if a delayed operation with a particular TimerId
|
|
6372
6349
|
* exists.
|
|
6373
|
-
*/
|
|
6374
|
-
for (const e of this.
|
|
6350
|
+
*/ Wt(t) {
|
|
6351
|
+
for (const e of this.qt) if (e.timerId === t) return !0;
|
|
6375
6352
|
return !1;
|
|
6376
6353
|
}
|
|
6377
6354
|
/**
|
|
@@ -6380,24 +6357,24 @@ class Ur {
|
|
|
6380
6357
|
* @param lastTimerId - Delayed operations up to and including this TimerId
|
|
6381
6358
|
* will be drained. Pass TimerId.All to run all delayed operations.
|
|
6382
6359
|
* @returns a Promise that resolves once all operations have been run.
|
|
6383
|
-
*/
|
|
6360
|
+
*/ Kt(t) {
|
|
6384
6361
|
// Note that draining may generate more delayed ops, so we do that first.
|
|
6385
|
-
return this.
|
|
6362
|
+
return this.Gt().then((() => {
|
|
6386
6363
|
// Run ops in the same order they'd run if they ran naturally.
|
|
6387
|
-
this.
|
|
6388
|
-
for (const e of this.
|
|
6389
|
-
return this.
|
|
6364
|
+
this.qt.sort(((t, e) => t.targetTimeMs - e.targetTimeMs));
|
|
6365
|
+
for (const e of this.qt) if (e.skipDelay(), "all" /* All */ !== t && e.timerId === t) break;
|
|
6366
|
+
return this.Gt();
|
|
6390
6367
|
}));
|
|
6391
6368
|
}
|
|
6392
6369
|
/**
|
|
6393
6370
|
* For Tests: Skip all subsequent delays for a timer id.
|
|
6394
|
-
*/
|
|
6395
|
-
this.
|
|
6371
|
+
*/ Qt(t) {
|
|
6372
|
+
this.Lt.push(t);
|
|
6396
6373
|
}
|
|
6397
|
-
/** Called once a DelayedOperation is run or canceled. */
|
|
6374
|
+
/** Called once a DelayedOperation is run or canceled. */ zt(t) {
|
|
6398
6375
|
// NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
|
|
6399
|
-
const e = this.
|
|
6400
|
-
this.
|
|
6376
|
+
const e = this.qt.indexOf(t);
|
|
6377
|
+
this.qt.splice(e, 1);
|
|
6401
6378
|
}
|
|
6402
6379
|
}
|
|
6403
6380
|
|
|
@@ -6480,12 +6457,31 @@ class Gr {
|
|
|
6480
6457
|
* @packageDocumentation
|
|
6481
6458
|
*/ !function(t) {
|
|
6482
6459
|
f = t;
|
|
6483
|
-
}(`${SDK_VERSION}_lite`), _registerComponent(new Component("firestore/lite", ((t, {options:
|
|
6484
|
-
const
|
|
6485
|
-
|
|
6486
|
-
|
|
6460
|
+
}(`${SDK_VERSION}_lite`), _registerComponent(new Component("firestore/lite", ((t, {instanceIdentifier: e, options: n}) => {
|
|
6461
|
+
const r = t.getProvider("app").getImmediate(), s = new an(new z(t.getProvider("auth-internal")), new Q(t.getProvider("app-check-internal")), function(t, e) {
|
|
6462
|
+
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new L(A, '"projectId" not provided in firebase.initializeApp.');
|
|
6463
|
+
return new H(t.options.projectId, e);
|
|
6464
|
+
}
|
|
6465
|
+
/**
|
|
6466
|
+
* @license
|
|
6467
|
+
* Copyright 2017 Google LLC
|
|
6468
|
+
*
|
|
6469
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6470
|
+
* you may not use this file except in compliance with the License.
|
|
6471
|
+
* You may obtain a copy of the License at
|
|
6472
|
+
*
|
|
6473
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
6474
|
+
*
|
|
6475
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
6476
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
6477
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6478
|
+
* See the License for the specific language governing permissions and
|
|
6479
|
+
* limitations under the License.
|
|
6480
|
+
*/ (r, e), r);
|
|
6481
|
+
return n && s._setSettings(n), s;
|
|
6482
|
+
}), "PUBLIC").setMultipleInstances(!0)),
|
|
6487
6483
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
6488
|
-
registerVersion("firestore-lite", "3.4.
|
|
6484
|
+
registerVersion("firestore-lite", "3.4.14-canary.04dcdbb0f", ""), registerVersion("firestore-lite", "3.4.14-canary.04dcdbb0f", "esm2017");
|
|
6489
6485
|
|
|
6490
6486
|
export { In as Bytes, pn as CollectionReference, wn as DocumentReference, Zn as DocumentSnapshot, En as FieldPath, An as FieldValue, an as Firestore, L as FirestoreError, Rn as GeoPoint, mn as Query, sr as QueryConstraint, tr as QueryDocumentSnapshot, er as QuerySnapshot, gt as Timestamp, Gr as Transaction, Or as WriteBatch, Dr as addDoc, Sr as arrayRemove, Fr as arrayUnion, yn as collection, _n as collectionGroup, fn as connectFirestoreEmulator, Nr as deleteDoc, $r as deleteField, gn as doc, Tn as documentId, _r as endAt, yr as endBefore, Ar as getDoc, Rr as getDocs, ln as getFirestore, qr as increment, hn as initializeFirestore, lr as limit, fr as limitToLast, ar as orderBy, ir as query, bn as queryEqual, vn as refEqual, Wr as runTransaction, xr as serverTimestamp, Pr as setDoc, w as setLogLevel, nr as snapshotEqual, mr as startAfter, wr as startAt, dn as terminate, Vr as updateDoc, ur as where, Cr as writeBatch };
|
|
6491
6487
|
//# sourceMappingURL=index.browser.esm2017.js.map
|