@firebase/firestore 3.4.13 → 3.4.14-canary.6f4ba2525
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/index_configuration.d.ts +7 -8
- package/dist/firestore/src/api.d.ts +1 -1
- 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/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 +1 -1
- package/dist/index.esm2017.js +3737 -3589
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +3721 -3604
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +250 -53
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +250 -53
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +3676 -3529
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +13 -13
- package/dist/lite/firestore/src/api/credentials.d.ts +13 -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/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/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 +232 -222
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +485 -469
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +36 -18
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +36 -18
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +232 -222
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +3 -0
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +23 -23
- package/dist/lite/packages/firestore/src/api/credentials.d.ts +13 -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/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/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 +3 -0
- package/dist/packages/firestore/dist/index.esm2017.d.ts +193 -193
- package/dist/packages/firestore/src/api/credentials.d.ts +13 -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/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/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 +4 -1
- package/package.json +10 -9
|
@@ -66,7 +66,7 @@ f.MOCK_USER = new f("mock-user");
|
|
|
66
66
|
* See the License for the specific language governing permissions and
|
|
67
67
|
* limitations under the License.
|
|
68
68
|
*/
|
|
69
|
-
let d = "9.9.
|
|
69
|
+
let d = "9.9.2-canary.6f4ba2525";
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* @license
|
|
@@ -350,10 +350,22 @@ e) {
|
|
|
350
350
|
* recover from unauthenticated errors (see b/33147818 for context), but it's
|
|
351
351
|
* safer to keep the implementation as-is.
|
|
352
352
|
*/ class G {
|
|
353
|
-
constructor(t, e, n) {
|
|
354
|
-
this.
|
|
355
|
-
|
|
356
|
-
|
|
353
|
+
constructor(t, e, n, r) {
|
|
354
|
+
this.t = t, this.i = e, this.o = n, this.u = r, this.type = "FirstParty", this.user = f.FIRST_PARTY,
|
|
355
|
+
this.h = new Map;
|
|
356
|
+
}
|
|
357
|
+
/** Gets an authorization token, using a provided factory function, or falling back to First Party GAPI. */ l() {
|
|
358
|
+
return this.u ? this.u() : (
|
|
359
|
+
// Make sure this really is a Gapi client.
|
|
360
|
+
b(!("object" != typeof this.t || null === this.t || !this.t.auth || !this.t.auth.getAuthHeaderValueForFirstParty)),
|
|
361
|
+
this.t.auth.getAuthHeaderValueForFirstParty([]));
|
|
362
|
+
}
|
|
363
|
+
get headers() {
|
|
364
|
+
this.h.set("X-Goog-AuthUser", this.i);
|
|
365
|
+
// Use array notation to prevent minification
|
|
366
|
+
const t = this.l();
|
|
367
|
+
return t && this.h.set("Authorization", t), this.o && this.h.set("X-Goog-Iam-Authorization-Token", this.o),
|
|
368
|
+
this.h;
|
|
357
369
|
}
|
|
358
370
|
}
|
|
359
371
|
|
|
@@ -362,11 +374,11 @@ e) {
|
|
|
362
374
|
* to authenticate the user, using technique that is only available
|
|
363
375
|
* to applications hosted by Google.
|
|
364
376
|
*/ class K {
|
|
365
|
-
constructor(t, e, n) {
|
|
366
|
-
this.t = t, this.i = e, this.o = n;
|
|
377
|
+
constructor(t, e, n, r) {
|
|
378
|
+
this.t = t, this.i = e, this.o = n, this.u = r;
|
|
367
379
|
}
|
|
368
380
|
getToken() {
|
|
369
|
-
return Promise.resolve(new G(this.t, this.i, this.o));
|
|
381
|
+
return Promise.resolve(new G(this.t, this.i, this.o, this.u));
|
|
370
382
|
}
|
|
371
383
|
start(t, e) {
|
|
372
384
|
// Fire with initial uid.
|
|
@@ -384,7 +396,7 @@ class Q {
|
|
|
384
396
|
|
|
385
397
|
/** AppCheck token provider for the Lite SDK. */ class Y {
|
|
386
398
|
constructor(t) {
|
|
387
|
-
this.
|
|
399
|
+
this.m = t, this.appCheck = null, t.onInit((t => {
|
|
388
400
|
this.appCheck = t;
|
|
389
401
|
}));
|
|
390
402
|
}
|
|
@@ -1012,27 +1024,27 @@ class {
|
|
|
1012
1024
|
constructor(t) {
|
|
1013
1025
|
this.databaseInfo = t, this.databaseId = t.databaseId;
|
|
1014
1026
|
const e = t.ssl ? "https" : "http";
|
|
1015
|
-
this.
|
|
1027
|
+
this.p = e + "://" + t.host, this.g = "projects/" + this.databaseId.projectId + "/databases/" + this.databaseId.database + "/documents";
|
|
1016
1028
|
}
|
|
1017
|
-
|
|
1018
|
-
const i = this.
|
|
1029
|
+
v(t, e, n, r, s) {
|
|
1030
|
+
const i = this.T(t, e);
|
|
1019
1031
|
p("RestConnection", "Sending: ", i, n);
|
|
1020
1032
|
const o = {};
|
|
1021
|
-
return this.
|
|
1033
|
+
return this.I(o, r, s), this.A(t, i, o, n).then((t => (p("RestConnection", "Received: ", t),
|
|
1022
1034
|
t)), (e => {
|
|
1023
1035
|
throw _("RestConnection", `${t} failed with error: `, e, "url: ", i, "request:", n),
|
|
1024
1036
|
e;
|
|
1025
1037
|
}));
|
|
1026
1038
|
}
|
|
1027
|
-
|
|
1039
|
+
R(t, e, n, r, s, i) {
|
|
1028
1040
|
// The REST API automatically aggregates all of the streamed results, so we
|
|
1029
1041
|
// can just use the normal invoke() method.
|
|
1030
|
-
return this.
|
|
1042
|
+
return this.v(t, e, n, r, s);
|
|
1031
1043
|
}
|
|
1032
1044
|
/**
|
|
1033
1045
|
* Modifies the headers for a request, adding any authorization token if
|
|
1034
1046
|
* present and any additional headers for the request.
|
|
1035
|
-
*/
|
|
1047
|
+
*/ I(t, e, n) {
|
|
1036
1048
|
t["X-Goog-Api-Client"] = "gl-js/ fire/" + d,
|
|
1037
1049
|
// Content-Type: text/plain will avoid preflight requests which might
|
|
1038
1050
|
// mess with CORS and redirects by proxies. If we add custom headers
|
|
@@ -1041,9 +1053,9 @@ class {
|
|
|
1041
1053
|
t["Content-Type"] = "text/plain", this.databaseInfo.appId && (t["X-Firebase-GMPID"] = this.databaseInfo.appId),
|
|
1042
1054
|
e && e.headers.forEach(((e, n) => t[n] = e)), n && n.headers.forEach(((e, n) => t[n] = e));
|
|
1043
1055
|
}
|
|
1044
|
-
|
|
1056
|
+
T(t, e) {
|
|
1045
1057
|
const n = lt[t];
|
|
1046
|
-
return `${this.
|
|
1058
|
+
return `${this.p}/v1/${e}:${n}`;
|
|
1047
1059
|
}
|
|
1048
1060
|
} {
|
|
1049
1061
|
/**
|
|
@@ -1051,16 +1063,16 @@ class {
|
|
|
1051
1063
|
* @param fetchImpl - `fetch` or a Polyfill that implements the fetch API.
|
|
1052
1064
|
*/
|
|
1053
1065
|
constructor(t, e) {
|
|
1054
|
-
super(t), this.
|
|
1066
|
+
super(t), this.P = e;
|
|
1055
1067
|
}
|
|
1056
|
-
|
|
1068
|
+
V(t, e) {
|
|
1057
1069
|
throw new Error("Not supported by FetchConnection");
|
|
1058
1070
|
}
|
|
1059
|
-
async
|
|
1071
|
+
async A(t, e, n, r) {
|
|
1060
1072
|
const s = JSON.stringify(r);
|
|
1061
1073
|
let i;
|
|
1062
1074
|
try {
|
|
1063
|
-
i = await this.
|
|
1075
|
+
i = await this.P(e, {
|
|
1064
1076
|
method: "POST",
|
|
1065
1077
|
headers: n,
|
|
1066
1078
|
body: s
|
|
@@ -1138,7 +1150,7 @@ function pt(t) {
|
|
|
1138
1150
|
* See the License for the specific language governing permissions and
|
|
1139
1151
|
* limitations under the License.
|
|
1140
1152
|
*/ class yt {
|
|
1141
|
-
static
|
|
1153
|
+
static N() {
|
|
1142
1154
|
// Alphanumeric characters
|
|
1143
1155
|
const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = Math.floor(256 / t.length) * t.length;
|
|
1144
1156
|
// The largest byte value that is a multiple of `char.length`.
|
|
@@ -2620,7 +2632,7 @@ class Jt {
|
|
|
2620
2632
|
class Zt {
|
|
2621
2633
|
constructor(t, e = null, n = [], r = [], s = null, i = null, o = null) {
|
|
2622
2634
|
this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = s,
|
|
2623
|
-
this.startAt = i, this.endAt = o, this
|
|
2635
|
+
this.startAt = i, this.endAt = o, this.$ = null;
|
|
2624
2636
|
}
|
|
2625
2637
|
}
|
|
2626
2638
|
|
|
@@ -2642,18 +2654,18 @@ class ee extends class {} {
|
|
|
2642
2654
|
/**
|
|
2643
2655
|
* Creates a filter based on the provided arguments.
|
|
2644
2656
|
*/ static create(t, e, n) {
|
|
2645
|
-
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.
|
|
2657
|
+
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.D(t, e, n) : new ne(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new oe(t, n) : "in" /* IN */ === e ? new ue(t, n) : "not-in" /* NOT_IN */ === e ? new ce(t, n) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new ae(t, n) : new ee(t, e, n);
|
|
2646
2658
|
}
|
|
2647
|
-
static
|
|
2659
|
+
static D(t, e, n) {
|
|
2648
2660
|
return "in" /* IN */ === e ? new re(t, n) : new se(t, n);
|
|
2649
2661
|
}
|
|
2650
2662
|
matches(t) {
|
|
2651
2663
|
const e = t.data.field(this.field);
|
|
2652
2664
|
// Types do not have to match in NOT_EQUAL filters.
|
|
2653
|
-
return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.
|
|
2665
|
+
return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.S(Bt(e, this.value)) : null !== e && Mt(this.value) === Mt(e) && this.S(Bt(e, this.value));
|
|
2654
2666
|
// Only compare types with matching backend order (such as double and int).
|
|
2655
2667
|
}
|
|
2656
|
-
|
|
2668
|
+
S(t) {
|
|
2657
2669
|
switch (this.op) {
|
|
2658
2670
|
case "<" /* LESS_THAN */ :
|
|
2659
2671
|
return t < 0;
|
|
@@ -2677,7 +2689,7 @@ class ee extends class {} {
|
|
|
2677
2689
|
return v();
|
|
2678
2690
|
}
|
|
2679
2691
|
}
|
|
2680
|
-
|
|
2692
|
+
F() {
|
|
2681
2693
|
return [ "<" /* LESS_THAN */ , "<=" /* LESS_THAN_OR_EQUAL */ , ">" /* GREATER_THAN */ , ">=" /* GREATER_THAN_OR_EQUAL */ , "!=" /* NOT_EQUAL */ , "not-in" /* NOT_IN */ ].indexOf(this.op) >= 0;
|
|
2682
2694
|
}
|
|
2683
2695
|
}
|
|
@@ -2689,7 +2701,7 @@ class ne extends ee {
|
|
|
2689
2701
|
}
|
|
2690
2702
|
matches(t) {
|
|
2691
2703
|
const e = nt.comparator(t.key, this.key);
|
|
2692
|
-
return this.
|
|
2704
|
+
return this.S(e);
|
|
2693
2705
|
}
|
|
2694
2706
|
}
|
|
2695
2707
|
|
|
@@ -2829,9 +2841,9 @@ function de(t, e) {
|
|
|
2829
2841
|
*/
|
|
2830
2842
|
constructor(t, e = null, n = [], r = [], s = null, i = "F" /* First */ , o = null, u = null) {
|
|
2831
2843
|
this.path = t, this.collectionGroup = e, this.explicitOrderBy = n, this.filters = r,
|
|
2832
|
-
this.limit = s, this.limitType = i, this.startAt = o, this.endAt = u, this.
|
|
2844
|
+
this.limit = s, this.limitType = i, this.startAt = o, this.endAt = u, this.q = null,
|
|
2833
2845
|
// The corresponding `Target` of this `Query` instance.
|
|
2834
|
-
this.
|
|
2846
|
+
this.O = null, this.startAt, this.endAt;
|
|
2835
2847
|
}
|
|
2836
2848
|
}
|
|
2837
2849
|
|
|
@@ -2840,7 +2852,7 @@ function de(t, e) {
|
|
|
2840
2852
|
}
|
|
2841
2853
|
|
|
2842
2854
|
function pe(t) {
|
|
2843
|
-
for (const e of t.filters) if (e
|
|
2855
|
+
for (const e of t.filters) if (e.F()) return e.field;
|
|
2844
2856
|
return null;
|
|
2845
2857
|
}
|
|
2846
2858
|
|
|
@@ -2862,32 +2874,32 @@ function ye(t) {
|
|
|
2862
2874
|
* the SDK and backend always orders by `__name__`).
|
|
2863
2875
|
*/ function _e(t) {
|
|
2864
2876
|
const e = E(t);
|
|
2865
|
-
if (null === e.
|
|
2866
|
-
e.
|
|
2877
|
+
if (null === e.q) {
|
|
2878
|
+
e.q = [];
|
|
2867
2879
|
const t = pe(e), n = me(e);
|
|
2868
2880
|
if (null !== t && null === n)
|
|
2869
2881
|
// In order to implicitly add key ordering, we must also add the
|
|
2870
2882
|
// inequality filter field for it to be a valid query.
|
|
2871
2883
|
// Note that the default inequality field and key ordering is ascending.
|
|
2872
|
-
t.isKeyField() || e.
|
|
2884
|
+
t.isKeyField() || e.q.push(new le(t)), e.q.push(new le(et.keyField(), "asc" /* ASCENDING */)); else {
|
|
2873
2885
|
let t = !1;
|
|
2874
|
-
for (const n of e.explicitOrderBy) e.
|
|
2886
|
+
for (const n of e.explicitOrderBy) e.q.push(n), n.field.isKeyField() && (t = !0);
|
|
2875
2887
|
if (!t) {
|
|
2876
2888
|
// The order of the implicit key ordering always matches the last
|
|
2877
2889
|
// explicit order by
|
|
2878
2890
|
const t = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
|
|
2879
|
-
e.
|
|
2891
|
+
e.q.push(new le(et.keyField(), t));
|
|
2880
2892
|
}
|
|
2881
2893
|
}
|
|
2882
2894
|
}
|
|
2883
|
-
return e.
|
|
2895
|
+
return e.q;
|
|
2884
2896
|
}
|
|
2885
2897
|
|
|
2886
2898
|
/**
|
|
2887
2899
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
2888
2900
|
*/ function ge(t) {
|
|
2889
2901
|
const e = E(t);
|
|
2890
|
-
if (!e.
|
|
2902
|
+
if (!e.O) if ("F" /* First */ === e.limitType) e.O = te(e.path, e.collectionGroup, _e(e), e.filters, e.limit, e.startAt, e.endAt); else {
|
|
2891
2903
|
// Flip the orderBy directions since we want the last results
|
|
2892
2904
|
const t = [];
|
|
2893
2905
|
for (const n of _e(e)) {
|
|
@@ -2897,9 +2909,9 @@ function ye(t) {
|
|
|
2897
2909
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
2898
2910
|
const n = e.endAt ? new he(e.endAt.position, e.endAt.inclusive) : null, r = e.startAt ? new he(e.startAt.position, e.startAt.inclusive) : null;
|
|
2899
2911
|
// Now return as a LimitType.First query.
|
|
2900
|
-
e.
|
|
2912
|
+
e.O = te(e.path, e.collectionGroup, t, e.filters, e.limit, n, r);
|
|
2901
2913
|
}
|
|
2902
|
-
return e.
|
|
2914
|
+
return e.O;
|
|
2903
2915
|
}
|
|
2904
2916
|
|
|
2905
2917
|
function ve(t, e) {
|
|
@@ -2952,7 +2964,7 @@ function be(t, e) {
|
|
|
2952
2964
|
integerValue: "" + t
|
|
2953
2965
|
};
|
|
2954
2966
|
}(e) : function(t, e) {
|
|
2955
|
-
if (t.
|
|
2967
|
+
if (t.k) {
|
|
2956
2968
|
if (isNaN(e)) return {
|
|
2957
2969
|
doubleValue: "NaN"
|
|
2958
2970
|
};
|
|
@@ -3014,7 +3026,7 @@ function be(t, e) {
|
|
|
3014
3026
|
* arithmetic is used and precision loss can occur for values greater than 2^53.
|
|
3015
3027
|
*/ class Re extends Ee {
|
|
3016
3028
|
constructor(t, e) {
|
|
3017
|
-
super(), this.
|
|
3029
|
+
super(), this.C = t, this.L = e;
|
|
3018
3030
|
}
|
|
3019
3031
|
}
|
|
3020
3032
|
|
|
@@ -3222,7 +3234,7 @@ function be(t, e) {
|
|
|
3222
3234
|
*/
|
|
3223
3235
|
class Oe {
|
|
3224
3236
|
constructor(t, e) {
|
|
3225
|
-
this.databaseId = t, this.
|
|
3237
|
+
this.databaseId = t, this.k = e;
|
|
3226
3238
|
}
|
|
3227
3239
|
}
|
|
3228
3240
|
|
|
@@ -3238,7 +3250,7 @@ class Oe {
|
|
|
3238
3250
|
* Returns a value for a Date that's appropriate to put into a proto.
|
|
3239
3251
|
*/
|
|
3240
3252
|
function ke(t, e) {
|
|
3241
|
-
if (t.
|
|
3253
|
+
if (t.k) {
|
|
3242
3254
|
return `${new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "")}.${("000000000" + e.nanoseconds).slice(-9)}Z`;
|
|
3243
3255
|
}
|
|
3244
3256
|
return {
|
|
@@ -3253,7 +3265,7 @@ function ke(t, e) {
|
|
|
3253
3265
|
* Visible for testing.
|
|
3254
3266
|
*/
|
|
3255
3267
|
function Ce(t, e) {
|
|
3256
|
-
return t.
|
|
3268
|
+
return t.k ? e.toBase64() : e.toUint8Array();
|
|
3257
3269
|
}
|
|
3258
3270
|
|
|
3259
3271
|
function Le(t, e) {
|
|
@@ -3354,7 +3366,7 @@ function Qe(t, e) {
|
|
|
3354
3366
|
};
|
|
3355
3367
|
if (n instanceof Re) return {
|
|
3356
3368
|
fieldPath: e.field.canonicalString(),
|
|
3357
|
-
increment: n.
|
|
3369
|
+
increment: n.L
|
|
3358
3370
|
};
|
|
3359
3371
|
throw v();
|
|
3360
3372
|
}(0, t)))), e.precondition.isNone || (n.currentDocument = function(t, e) {
|
|
@@ -3439,7 +3451,7 @@ function Ye(t, e) {
|
|
|
3439
3451
|
}(e.orderBy);
|
|
3440
3452
|
i && (n.structuredQuery.orderBy = i);
|
|
3441
3453
|
const o = function(t, e) {
|
|
3442
|
-
return t.
|
|
3454
|
+
return t.k || at(e) ? e : {
|
|
3443
3455
|
value: e
|
|
3444
3456
|
};
|
|
3445
3457
|
}(t, e.limit);
|
|
@@ -3553,9 +3565,9 @@ class nn {
|
|
|
3553
3565
|
* Note that jitter will still be applied, so the actual delay could be as
|
|
3554
3566
|
* much as 1.5*maxDelayMs.
|
|
3555
3567
|
*/ , s = 6e4) {
|
|
3556
|
-
this.
|
|
3568
|
+
this.M = t, this.timerId = e, this.U = n, this.j = r, this.B = s, this.W = 0, this.G = null,
|
|
3557
3569
|
/** The last backoff attempt, as epoch milliseconds. */
|
|
3558
|
-
this.
|
|
3570
|
+
this.K = Date.now(), this.reset();
|
|
3559
3571
|
}
|
|
3560
3572
|
/**
|
|
3561
3573
|
* Resets the backoff delay.
|
|
@@ -3564,40 +3576,40 @@ class nn {
|
|
|
3564
3576
|
* (i.e. due to an error), initialDelayMs (plus jitter) will be used, and
|
|
3565
3577
|
* subsequent ones will increase according to the backoffFactor.
|
|
3566
3578
|
*/ reset() {
|
|
3567
|
-
this.
|
|
3579
|
+
this.W = 0;
|
|
3568
3580
|
}
|
|
3569
3581
|
/**
|
|
3570
3582
|
* Resets the backoff delay to the maximum delay (e.g. for use after a
|
|
3571
3583
|
* RESOURCE_EXHAUSTED error).
|
|
3572
|
-
*/
|
|
3573
|
-
this.
|
|
3584
|
+
*/ Y() {
|
|
3585
|
+
this.W = this.B;
|
|
3574
3586
|
}
|
|
3575
3587
|
/**
|
|
3576
3588
|
* Returns a promise that resolves after currentDelayMs, and increases the
|
|
3577
3589
|
* delay for any subsequent attempts. If there was a pending backoff operation
|
|
3578
3590
|
* already, it will be canceled.
|
|
3579
|
-
*/
|
|
3591
|
+
*/ H(t) {
|
|
3580
3592
|
// Cancel any pending backoff operation.
|
|
3581
3593
|
this.cancel();
|
|
3582
3594
|
// First schedule using the current base (which may be 0 and should be
|
|
3583
3595
|
// honored as such).
|
|
3584
|
-
const e = Math.floor(this.
|
|
3596
|
+
const e = Math.floor(this.W + this.J()), n = Math.max(0, Date.now() - this.K), r = Math.max(0, e - n);
|
|
3585
3597
|
// Guard against lastAttemptTime being in the future due to a clock change.
|
|
3586
|
-
r > 0 && p("ExponentialBackoff", `Backing off for ${r} ms (base delay: ${this.
|
|
3587
|
-
this.
|
|
3598
|
+
r > 0 && p("ExponentialBackoff", `Backing off for ${r} ms (base delay: ${this.W} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),
|
|
3599
|
+
this.G = this.M.enqueueAfterDelay(this.timerId, r, (() => (this.K = Date.now(),
|
|
3588
3600
|
t()))),
|
|
3589
3601
|
// Apply backoff factor to determine next delay and ensure it is within
|
|
3590
3602
|
// bounds.
|
|
3591
|
-
this.
|
|
3603
|
+
this.W *= this.j, this.W < this.U && (this.W = this.U), this.W > this.B && (this.W = this.B);
|
|
3592
3604
|
}
|
|
3593
|
-
|
|
3594
|
-
null !== this.
|
|
3605
|
+
X() {
|
|
3606
|
+
null !== this.G && (this.G.skipDelay(), this.G = null);
|
|
3595
3607
|
}
|
|
3596
3608
|
cancel() {
|
|
3597
|
-
null !== this.
|
|
3609
|
+
null !== this.G && (this.G.cancel(), this.G = null);
|
|
3598
3610
|
}
|
|
3599
|
-
/** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */
|
|
3600
|
-
return (Math.random() - .5) * this.
|
|
3611
|
+
/** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ J() {
|
|
3612
|
+
return (Math.random() - .5) * this.W;
|
|
3601
3613
|
}
|
|
3602
3614
|
}
|
|
3603
3615
|
|
|
@@ -3628,44 +3640,44 @@ class nn {
|
|
|
3628
3640
|
*/
|
|
3629
3641
|
class rn extends class {} {
|
|
3630
3642
|
constructor(t, e, n, r) {
|
|
3631
|
-
super(), this.authCredentials = t, this.appCheckCredentials = e, this.
|
|
3632
|
-
this.
|
|
3643
|
+
super(), this.authCredentials = t, this.appCheckCredentials = e, this.Z = n, this.C = r,
|
|
3644
|
+
this.tt = !1;
|
|
3633
3645
|
}
|
|
3634
|
-
|
|
3635
|
-
if (this.
|
|
3646
|
+
et() {
|
|
3647
|
+
if (this.tt) throw new M(S, "The client has already been terminated.");
|
|
3636
3648
|
}
|
|
3637
|
-
/** Invokes the provided RPC with auth and AppCheck tokens. */
|
|
3638
|
-
return this.
|
|
3649
|
+
/** Invokes the provided RPC with auth and AppCheck tokens. */ v(t, e, n) {
|
|
3650
|
+
return this.et(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.Z.v(t, e, n, r, s))).catch((t => {
|
|
3639
3651
|
throw "FirebaseError" === t.name ? (t.code === D && (this.authCredentials.invalidateToken(),
|
|
3640
3652
|
this.appCheckCredentials.invalidateToken()), t) : new M(A, t.toString());
|
|
3641
3653
|
}));
|
|
3642
3654
|
}
|
|
3643
|
-
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */
|
|
3644
|
-
return this.
|
|
3655
|
+
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ R(t, e, n, r) {
|
|
3656
|
+
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 => {
|
|
3645
3657
|
throw "FirebaseError" === t.name ? (t.code === D && (this.authCredentials.invalidateToken(),
|
|
3646
3658
|
this.appCheckCredentials.invalidateToken()), t) : new M(A, t.toString());
|
|
3647
3659
|
}));
|
|
3648
3660
|
}
|
|
3649
3661
|
terminate() {
|
|
3650
|
-
this.
|
|
3662
|
+
this.tt = !0;
|
|
3651
3663
|
}
|
|
3652
3664
|
}
|
|
3653
3665
|
|
|
3654
3666
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
3655
3667
|
// firestore-exp client.
|
|
3656
3668
|
async function sn(t, e) {
|
|
3657
|
-
const n = E(t), r = We(n.
|
|
3658
|
-
writes: e.map((t => Qe(n.
|
|
3669
|
+
const n = E(t), r = We(n.C) + "/documents", s = {
|
|
3670
|
+
writes: e.map((t => Qe(n.C, t)))
|
|
3659
3671
|
};
|
|
3660
|
-
await n.
|
|
3672
|
+
await n.v("Commit", r, s);
|
|
3661
3673
|
}
|
|
3662
3674
|
|
|
3663
3675
|
async function on(t, e) {
|
|
3664
|
-
const n = E(t), r = We(n.
|
|
3665
|
-
documents: e.map((t => je(n.
|
|
3666
|
-
}, i = await n.
|
|
3676
|
+
const n = E(t), r = We(n.C) + "/documents", s = {
|
|
3677
|
+
documents: e.map((t => je(n.C, t)))
|
|
3678
|
+
}, i = await n.R("BatchGetDocuments", r, s, e.length), o = new Map;
|
|
3667
3679
|
i.forEach((t => {
|
|
3668
|
-
const e = Ke(n.
|
|
3680
|
+
const e = Ke(n.C, t);
|
|
3669
3681
|
o.set(e.key.toString(), e);
|
|
3670
3682
|
}));
|
|
3671
3683
|
const u = [];
|
|
@@ -3676,8 +3688,8 @@ async function on(t, e) {
|
|
|
3676
3688
|
}
|
|
3677
3689
|
|
|
3678
3690
|
async function un(t, e) {
|
|
3679
|
-
const n = E(t), r = Ye(n.
|
|
3680
|
-
return (await n.
|
|
3691
|
+
const n = E(t), r = Ye(n.C, ge(e));
|
|
3692
|
+
return (await n.R("RunQuery", r.parent, {
|
|
3681
3693
|
structuredQuery: r.structuredQuery
|
|
3682
3694
|
})).filter((t => !!t.document)).map((t => function(t, e, n) {
|
|
3683
3695
|
const r = Be(t, e.name), s = Me(e.updateTime), i = new Jt({
|
|
@@ -3686,7 +3698,7 @@ async function un(t, e) {
|
|
|
3686
3698
|
}
|
|
3687
3699
|
}), o = Xt.newFoundDocument(r, s, i);
|
|
3688
3700
|
return n && o.setHasCommittedMutations(), n ? o.setHasCommittedMutations() : o;
|
|
3689
|
-
}(n.
|
|
3701
|
+
}(n.C, t.document, void 0)));
|
|
3690
3702
|
}
|
|
3691
3703
|
|
|
3692
3704
|
/**
|
|
@@ -3842,9 +3854,7 @@ class hn {
|
|
|
3842
3854
|
switch (t.type) {
|
|
3843
3855
|
case "gapi":
|
|
3844
3856
|
const e = t.client;
|
|
3845
|
-
|
|
3846
|
-
return b(!("object" != typeof e || null === e || !e.auth || !e.auth.getAuthHeaderValueForFirstParty)),
|
|
3847
|
-
new K(e, t.sessionIndex || "0", t.iamToken || null);
|
|
3857
|
+
return new K(e, t.sessionIndex || "0", t.iamToken || null, t.authTokenFactory || null);
|
|
3848
3858
|
|
|
3849
3859
|
case "provider":
|
|
3850
3860
|
return t.client;
|
|
@@ -4126,7 +4136,7 @@ function bn(t, e, ...n) {
|
|
|
4126
4136
|
if (t = l(t),
|
|
4127
4137
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
4128
4138
|
// 'undefined' and 'null'.
|
|
4129
|
-
1 === arguments.length && (e = yt.
|
|
4139
|
+
1 === arguments.length && (e = yt.N()), rt("doc", "path", e), t instanceof ln) {
|
|
4130
4140
|
const r = Z.fromString(e, ...n);
|
|
4131
4141
|
return st(r), new pn(t,
|
|
4132
4142
|
/* converter= */ null, new nt(r));
|
|
@@ -4455,58 +4465,58 @@ function xn(t) {
|
|
|
4455
4465
|
* compromised).
|
|
4456
4466
|
*/
|
|
4457
4467
|
constructor(t, e, n, r, s, i) {
|
|
4458
|
-
this.settings = t, this.databaseId = e, this.
|
|
4468
|
+
this.settings = t, this.databaseId = e, this.C = n, this.ignoreUndefinedProperties = r,
|
|
4459
4469
|
// Minor hack: If fieldTransforms is undefined, we assume this is an
|
|
4460
4470
|
// external call and we need to validate the entire path.
|
|
4461
|
-
void 0 === s && this.
|
|
4471
|
+
void 0 === s && this.nt(), this.fieldTransforms = s || [], this.fieldMask = i || [];
|
|
4462
4472
|
}
|
|
4463
4473
|
get path() {
|
|
4464
4474
|
return this.settings.path;
|
|
4465
4475
|
}
|
|
4466
|
-
get
|
|
4467
|
-
return this.settings.
|
|
4476
|
+
get rt() {
|
|
4477
|
+
return this.settings.rt;
|
|
4468
4478
|
}
|
|
4469
|
-
/** Returns a new context with the specified settings overwritten. */
|
|
4470
|
-
return new Sn(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.
|
|
4479
|
+
/** Returns a new context with the specified settings overwritten. */ st(t) {
|
|
4480
|
+
return new Sn(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.C, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
4471
4481
|
}
|
|
4472
|
-
|
|
4482
|
+
it(t) {
|
|
4473
4483
|
var e;
|
|
4474
|
-
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.
|
|
4484
|
+
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.st({
|
|
4475
4485
|
path: n,
|
|
4476
|
-
|
|
4486
|
+
ot: !1
|
|
4477
4487
|
});
|
|
4478
|
-
return r.
|
|
4488
|
+
return r.ut(t), r;
|
|
4479
4489
|
}
|
|
4480
|
-
|
|
4490
|
+
ct(t) {
|
|
4481
4491
|
var e;
|
|
4482
|
-
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.
|
|
4492
|
+
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.st({
|
|
4483
4493
|
path: n,
|
|
4484
|
-
|
|
4494
|
+
ot: !1
|
|
4485
4495
|
});
|
|
4486
|
-
return r.
|
|
4496
|
+
return r.nt(), r;
|
|
4487
4497
|
}
|
|
4488
|
-
|
|
4498
|
+
at(t) {
|
|
4489
4499
|
// TODO(b/34871131): We don't support array paths right now; so make path
|
|
4490
4500
|
// undefined.
|
|
4491
|
-
return this.
|
|
4501
|
+
return this.st({
|
|
4492
4502
|
path: void 0,
|
|
4493
|
-
|
|
4503
|
+
ot: !0
|
|
4494
4504
|
});
|
|
4495
4505
|
}
|
|
4496
|
-
|
|
4497
|
-
return Zn(t, this.settings.methodName, this.settings.
|
|
4506
|
+
ht(t) {
|
|
4507
|
+
return Zn(t, this.settings.methodName, this.settings.lt || !1, this.path, this.settings.ft);
|
|
4498
4508
|
}
|
|
4499
4509
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
4500
4510
|
return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
|
|
4501
4511
|
}
|
|
4502
|
-
|
|
4512
|
+
nt() {
|
|
4503
4513
|
// TODO(b/34871131): Remove null check once we have proper paths for fields
|
|
4504
4514
|
// within arrays.
|
|
4505
|
-
if (this.path) for (let t = 0; t < this.path.length; t++) this.
|
|
4515
|
+
if (this.path) for (let t = 0; t < this.path.length; t++) this.ut(this.path.get(t));
|
|
4506
4516
|
}
|
|
4507
|
-
|
|
4508
|
-
if (0 === t.length) throw this.
|
|
4509
|
-
if (xn(this.
|
|
4517
|
+
ut(t) {
|
|
4518
|
+
if (0 === t.length) throw this.ht("Document fields must not be empty");
|
|
4519
|
+
if (xn(this.rt) && Nn.test(t)) throw this.ht('Document fields cannot begin and end with "__"');
|
|
4510
4520
|
}
|
|
4511
4521
|
}
|
|
4512
4522
|
|
|
@@ -4515,17 +4525,17 @@ function xn(t) {
|
|
|
4515
4525
|
* classes.
|
|
4516
4526
|
*/ class Fn {
|
|
4517
4527
|
constructor(t, e, n) {
|
|
4518
|
-
this.databaseId = t, this.ignoreUndefinedProperties = e, this.
|
|
4528
|
+
this.databaseId = t, this.ignoreUndefinedProperties = e, this.C = n || en(t);
|
|
4519
4529
|
}
|
|
4520
|
-
/** Creates a new top-level parse context. */
|
|
4530
|
+
/** Creates a new top-level parse context. */ dt(t, e, n, r = !1) {
|
|
4521
4531
|
return new Sn({
|
|
4522
|
-
|
|
4532
|
+
rt: t,
|
|
4523
4533
|
methodName: e,
|
|
4524
|
-
|
|
4534
|
+
ft: n,
|
|
4525
4535
|
path: et.emptyPath(),
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
}, this.databaseId, this.
|
|
4536
|
+
ot: !1,
|
|
4537
|
+
lt: r
|
|
4538
|
+
}, this.databaseId, this.C, this.ignoreUndefinedProperties);
|
|
4529
4539
|
}
|
|
4530
4540
|
}
|
|
4531
4541
|
|
|
@@ -4535,7 +4545,7 @@ function qn(t) {
|
|
|
4535
4545
|
}
|
|
4536
4546
|
|
|
4537
4547
|
/** Parse document data from a set() call. */ function On(t, e, n, r, s, i = {}) {
|
|
4538
|
-
const o = t.
|
|
4548
|
+
const o = t.dt(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, s);
|
|
4539
4549
|
Yn("Data must be an object, but it was:", o, r);
|
|
4540
4550
|
const u = Kn(r, o);
|
|
4541
4551
|
let c, a;
|
|
@@ -4553,7 +4563,7 @@ function qn(t) {
|
|
|
4553
4563
|
|
|
4554
4564
|
class kn extends Pn {
|
|
4555
4565
|
_toFieldTransform(t) {
|
|
4556
|
-
if (2 /* MergeSet */ !== t.
|
|
4566
|
+
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}`);
|
|
4557
4567
|
// No transform to add for a delete, but we need to add it to our
|
|
4558
4568
|
// fieldMask so it gets deleted.
|
|
4559
4569
|
return t.fieldMask.push(t.path), null;
|
|
@@ -4580,11 +4590,11 @@ class kn extends Pn {
|
|
|
4580
4590
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
4581
4591
|
*/ function Cn(t, e, n) {
|
|
4582
4592
|
return new Sn({
|
|
4583
|
-
|
|
4584
|
-
|
|
4593
|
+
rt: 3 /* Argument */ ,
|
|
4594
|
+
ft: e.settings.ft,
|
|
4585
4595
|
methodName: t._methodName,
|
|
4586
|
-
|
|
4587
|
-
}, e.databaseId, e.
|
|
4596
|
+
ot: n
|
|
4597
|
+
}, e.databaseId, e.C, e.ignoreUndefinedProperties);
|
|
4588
4598
|
}
|
|
4589
4599
|
|
|
4590
4600
|
class Ln extends Pn {
|
|
@@ -4598,11 +4608,11 @@ class Ln extends Pn {
|
|
|
4598
4608
|
|
|
4599
4609
|
class Mn extends Pn {
|
|
4600
4610
|
constructor(t, e) {
|
|
4601
|
-
super(t), this.
|
|
4611
|
+
super(t), this.wt = e;
|
|
4602
4612
|
}
|
|
4603
4613
|
_toFieldTransform(t) {
|
|
4604
4614
|
const e = Cn(this, t,
|
|
4605
|
-
/*array=*/ !0), n = this.
|
|
4615
|
+
/*array=*/ !0), n = this.wt.map((t => Gn(t, e))), r = new Ie(n);
|
|
4606
4616
|
return new Pe(t.path, r);
|
|
4607
4617
|
}
|
|
4608
4618
|
isEqual(t) {
|
|
@@ -4613,11 +4623,11 @@ class Mn extends Pn {
|
|
|
4613
4623
|
|
|
4614
4624
|
class Un extends Pn {
|
|
4615
4625
|
constructor(t, e) {
|
|
4616
|
-
super(t), this.
|
|
4626
|
+
super(t), this.wt = e;
|
|
4617
4627
|
}
|
|
4618
4628
|
_toFieldTransform(t) {
|
|
4619
4629
|
const e = Cn(this, t,
|
|
4620
|
-
/*array=*/ !0), n = this.
|
|
4630
|
+
/*array=*/ !0), n = this.wt.map((t => Gn(t, e))), r = new Ae(n);
|
|
4621
4631
|
return new Pe(t.path, r);
|
|
4622
4632
|
}
|
|
4623
4633
|
isEqual(t) {
|
|
@@ -4628,10 +4638,10 @@ class Un extends Pn {
|
|
|
4628
4638
|
|
|
4629
4639
|
class jn extends Pn {
|
|
4630
4640
|
constructor(t, e) {
|
|
4631
|
-
super(t), this.
|
|
4641
|
+
super(t), this.yt = e;
|
|
4632
4642
|
}
|
|
4633
4643
|
_toFieldTransform(t) {
|
|
4634
|
-
const e = new Re(t.
|
|
4644
|
+
const e = new Re(t.C, be(t.C, this.yt));
|
|
4635
4645
|
return new Pe(t.path, e);
|
|
4636
4646
|
}
|
|
4637
4647
|
isEqual(t) {
|
|
@@ -4641,7 +4651,7 @@ class jn extends Pn {
|
|
|
4641
4651
|
}
|
|
4642
4652
|
|
|
4643
4653
|
/** Parse update data from an update() call. */ function Bn(t, e, n, r) {
|
|
4644
|
-
const s = t.
|
|
4654
|
+
const s = t.dt(1 /* Update */ , e, n);
|
|
4645
4655
|
Yn("Data must be an object, but it was:", s, r);
|
|
4646
4656
|
const i = [], o = Jt.empty();
|
|
4647
4657
|
Tt(r, ((t, r) => {
|
|
@@ -4649,7 +4659,7 @@ class jn extends Pn {
|
|
|
4649
4659
|
// For Compat types, we have to "extract" the underlying types before
|
|
4650
4660
|
// performing validation.
|
|
4651
4661
|
r = l(r);
|
|
4652
|
-
const c = s.
|
|
4662
|
+
const c = s.ct(u);
|
|
4653
4663
|
if (r instanceof kn)
|
|
4654
4664
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4655
4665
|
i.push(u); else {
|
|
@@ -4662,7 +4672,7 @@ class jn extends Pn {
|
|
|
4662
4672
|
}
|
|
4663
4673
|
|
|
4664
4674
|
/** Parse update data from a list of field/value arguments. */ function zn(t, e, n, r, s, i) {
|
|
4665
|
-
const o = t.
|
|
4675
|
+
const o = t.dt(1 /* Update */ , e, n), u = [ Hn(e, r, n) ], c = [ s ];
|
|
4666
4676
|
if (i.length % 2 != 0) throw new M(R, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
4667
4677
|
for (let t = 0; t < i.length; t += 2) u.push(Hn(e, i[t])), c.push(i[t + 1]);
|
|
4668
4678
|
const a = [], h = Jt.empty();
|
|
@@ -4674,7 +4684,7 @@ class jn extends Pn {
|
|
|
4674
4684
|
// For Compat types, we have to "extract" the underlying types before
|
|
4675
4685
|
// performing validation.
|
|
4676
4686
|
n = l(n);
|
|
4677
|
-
const r = o.
|
|
4687
|
+
const r = o.ct(e);
|
|
4678
4688
|
if (n instanceof kn)
|
|
4679
4689
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4680
4690
|
a.push(e); else {
|
|
@@ -4693,7 +4703,7 @@ class jn extends Pn {
|
|
|
4693
4703
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
4694
4704
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
4695
4705
|
*/ function Wn(t, e, n, r = !1) {
|
|
4696
|
-
return Gn(n, t.
|
|
4706
|
+
return Gn(n, t.dt(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
|
|
4697
4707
|
}
|
|
4698
4708
|
|
|
4699
4709
|
/**
|
|
@@ -4721,8 +4731,8 @@ class jn extends Pn {
|
|
|
4721
4731
|
*/
|
|
4722
4732
|
return function(t, e) {
|
|
4723
4733
|
// Sentinels are only supported with writes, and not within arrays.
|
|
4724
|
-
if (!xn(e.
|
|
4725
|
-
if (!e.path) throw e.
|
|
4734
|
+
if (!xn(e.rt)) throw e.ht(`${t._methodName}() can only be used with update() and set()`);
|
|
4735
|
+
if (!e.path) throw e.ht(`${t._methodName}() is not currently supported inside arrays`);
|
|
4726
4736
|
const n = t._toFieldTransform(e);
|
|
4727
4737
|
n && e.fieldTransforms.push(n);
|
|
4728
4738
|
}
|
|
@@ -4746,12 +4756,12 @@ class jn extends Pn {
|
|
|
4746
4756
|
// the set of values to be included for the IN query) that may directly
|
|
4747
4757
|
// contain additional arrays (each representing an individual field
|
|
4748
4758
|
// value), so we disable this validation.
|
|
4749
|
-
if (e.settings.
|
|
4759
|
+
if (e.settings.ot && 4 /* ArrayArgument */ !== e.rt) throw e.ht("Nested arrays are not supported");
|
|
4750
4760
|
return function(t, e) {
|
|
4751
4761
|
const n = [];
|
|
4752
4762
|
let r = 0;
|
|
4753
4763
|
for (const s of t) {
|
|
4754
|
-
let t = Gn(s, e.
|
|
4764
|
+
let t = Gn(s, e.at(r));
|
|
4755
4765
|
null == t && (
|
|
4756
4766
|
// Just include nulls in the array for fields being replaced with a
|
|
4757
4767
|
// sentinel.
|
|
@@ -4770,7 +4780,7 @@ class jn extends Pn {
|
|
|
4770
4780
|
if (null === (t = l(t))) return {
|
|
4771
4781
|
nullValue: "NULL_VALUE"
|
|
4772
4782
|
};
|
|
4773
|
-
if ("number" == typeof t) return be(e.
|
|
4783
|
+
if ("number" == typeof t) return be(e.C, t);
|
|
4774
4784
|
if ("boolean" == typeof t) return {
|
|
4775
4785
|
booleanValue: t
|
|
4776
4786
|
};
|
|
@@ -4780,7 +4790,7 @@ class jn extends Pn {
|
|
|
4780
4790
|
if (t instanceof Date) {
|
|
4781
4791
|
const n = vt.fromDate(t);
|
|
4782
4792
|
return {
|
|
4783
|
-
timestampValue: ke(e.
|
|
4793
|
+
timestampValue: ke(e.C, n)
|
|
4784
4794
|
};
|
|
4785
4795
|
}
|
|
4786
4796
|
if (t instanceof vt) {
|
|
@@ -4789,7 +4799,7 @@ class jn extends Pn {
|
|
|
4789
4799
|
// truncation immediately without waiting for the backend to do that.
|
|
4790
4800
|
const n = new vt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
4791
4801
|
return {
|
|
4792
|
-
timestampValue: ke(e.
|
|
4802
|
+
timestampValue: ke(e.C, n)
|
|
4793
4803
|
};
|
|
4794
4804
|
}
|
|
4795
4805
|
if (t instanceof Vn) return {
|
|
@@ -4799,16 +4809,16 @@ class jn extends Pn {
|
|
|
4799
4809
|
}
|
|
4800
4810
|
};
|
|
4801
4811
|
if (t instanceof Rn) return {
|
|
4802
|
-
bytesValue: Ce(e.
|
|
4812
|
+
bytesValue: Ce(e.C, t._byteString)
|
|
4803
4813
|
};
|
|
4804
4814
|
if (t instanceof pn) {
|
|
4805
4815
|
const n = e.databaseId, r = t.firestore._databaseId;
|
|
4806
|
-
if (!r.isEqual(n)) throw e.
|
|
4816
|
+
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}`);
|
|
4807
4817
|
return {
|
|
4808
4818
|
referenceValue: Ue(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
4809
4819
|
};
|
|
4810
4820
|
}
|
|
4811
|
-
throw e.
|
|
4821
|
+
throw e.ht(`Unsupported field value: ${ot(t)}`);
|
|
4812
4822
|
}
|
|
4813
4823
|
/**
|
|
4814
4824
|
* Checks whether an object looks like a JSON object that should be converted
|
|
@@ -4825,7 +4835,7 @@ function Kn(t, e) {
|
|
|
4825
4835
|
for (const e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
|
|
4826
4836
|
return !0;
|
|
4827
4837
|
}(t) ? Tt(t, ((t, r) => {
|
|
4828
|
-
const s = Gn(r, e.
|
|
4838
|
+
const s = Gn(r, e.it(t));
|
|
4829
4839
|
null != s && (n[t] = s);
|
|
4830
4840
|
})) :
|
|
4831
4841
|
// If we encounter an empty object, we explicitly add it to the update
|
|
@@ -4846,7 +4856,7 @@ function Yn(t, e, n) {
|
|
|
4846
4856
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
4847
4857
|
}(n)) {
|
|
4848
4858
|
const r = ot(n);
|
|
4849
|
-
throw "an object" === r ? e.
|
|
4859
|
+
throw "an object" === r ? e.ht(t + " a custom object") : e.ht(t + " " + r);
|
|
4850
4860
|
}
|
|
4851
4861
|
}
|
|
4852
4862
|
|
|
@@ -5097,7 +5107,7 @@ class or {}
|
|
|
5097
5107
|
|
|
5098
5108
|
class cr extends or {
|
|
5099
5109
|
constructor(t, e, n) {
|
|
5100
|
-
super(), this.
|
|
5110
|
+
super(), this._t = t, this.gt = e, this.vt = n, this.type = "where";
|
|
5101
5111
|
}
|
|
5102
5112
|
_apply(t) {
|
|
5103
5113
|
const e = qn(t.firestore), n = function(t, e, n, r, s, i, o) {
|
|
@@ -5119,7 +5129,7 @@ class cr extends or {
|
|
|
5119
5129
|
/* allowArrays= */ "in" /* IN */ === i || "not-in" /* NOT_IN */ === i);
|
|
5120
5130
|
const c = ee.create(s, i, u);
|
|
5121
5131
|
return function(t, e) {
|
|
5122
|
-
if (e
|
|
5132
|
+
if (e.F()) {
|
|
5123
5133
|
const n = pe(t);
|
|
5124
5134
|
if (null !== n && !n.isEqual(e.field)) throw new M(R, `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()}'`);
|
|
5125
5135
|
const r = me(t);
|
|
@@ -5166,7 +5176,7 @@ class cr extends or {
|
|
|
5166
5176
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
5167
5177
|
throw n === e.op ? new M(R, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new M(R, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
5168
5178
|
}(t, c), c;
|
|
5169
|
-
}(t._query, "where", e, t.firestore._databaseId, this.
|
|
5179
|
+
}(t._query, "where", e, t.firestore._databaseId, this._t, this.gt, this.vt);
|
|
5170
5180
|
return new yn(t.firestore, t.converter, function(t, e) {
|
|
5171
5181
|
const n = t.filters.concat([ e ]);
|
|
5172
5182
|
return new we(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
@@ -5191,7 +5201,7 @@ class cr extends or {
|
|
|
5191
5201
|
|
|
5192
5202
|
class hr extends or {
|
|
5193
5203
|
constructor(t, e) {
|
|
5194
|
-
super(), this.
|
|
5204
|
+
super(), this._t = t, this.bt = e, this.type = "orderBy";
|
|
5195
5205
|
}
|
|
5196
5206
|
_apply(t) {
|
|
5197
5207
|
const e = function(t, e, n) {
|
|
@@ -5216,7 +5226,7 @@ class hr extends or {
|
|
|
5216
5226
|
* Will throw if the document does not contain all fields of the order by
|
|
5217
5227
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
5218
5228
|
* server timestamp.
|
|
5219
|
-
*/ (t._query, this.
|
|
5229
|
+
*/ (t._query, this._t, this.bt);
|
|
5220
5230
|
return new yn(t.firestore, t.converter, function(t, e) {
|
|
5221
5231
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
5222
5232
|
const n = t.explicitOrderBy.concat([ e ]);
|
|
@@ -5240,12 +5250,12 @@ class hr extends or {
|
|
|
5240
5250
|
|
|
5241
5251
|
class fr extends or {
|
|
5242
5252
|
constructor(t, e, n) {
|
|
5243
|
-
super(), this.type = t, this.
|
|
5253
|
+
super(), this.type = t, this.Et = e, this.Tt = n;
|
|
5244
5254
|
}
|
|
5245
5255
|
_apply(t) {
|
|
5246
5256
|
return new yn(t.firestore, t.converter, function(t, e, n) {
|
|
5247
5257
|
return new we(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
5248
|
-
}(t._query, this.
|
|
5258
|
+
}(t._query, this.Et, this.Tt));
|
|
5249
5259
|
}
|
|
5250
5260
|
}
|
|
5251
5261
|
|
|
@@ -5272,10 +5282,10 @@ class fr extends or {
|
|
|
5272
5282
|
|
|
5273
5283
|
class mr extends or {
|
|
5274
5284
|
constructor(t, e, n) {
|
|
5275
|
-
super(), this.type = t, this.
|
|
5285
|
+
super(), this.type = t, this.It = e, this.At = n;
|
|
5276
5286
|
}
|
|
5277
5287
|
_apply(t) {
|
|
5278
|
-
const e = br(t, this.type, this.
|
|
5288
|
+
const e = br(t, this.type, this.It, this.At);
|
|
5279
5289
|
return new yn(t.firestore, t.converter, function(t, e) {
|
|
5280
5290
|
return new we(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
5281
5291
|
}(t._query, e));
|
|
@@ -5294,10 +5304,10 @@ function yr(...t) {
|
|
|
5294
5304
|
|
|
5295
5305
|
class _r extends or {
|
|
5296
5306
|
constructor(t, e, n) {
|
|
5297
|
-
super(), this.type = t, this.
|
|
5307
|
+
super(), this.type = t, this.It = e, this.At = n;
|
|
5298
5308
|
}
|
|
5299
5309
|
_apply(t) {
|
|
5300
|
-
const e = br(t, this.type, this.
|
|
5310
|
+
const e = br(t, this.type, this.It, this.At);
|
|
5301
5311
|
return new yn(t.firestore, t.converter, function(t, e) {
|
|
5302
5312
|
return new we(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
5303
5313
|
}(t._query, e));
|
|
@@ -5978,26 +5988,26 @@ function Lr(t, e) {
|
|
|
5978
5988
|
class Br {
|
|
5979
5989
|
constructor(t, e, n, r, s) {
|
|
5980
5990
|
this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = r,
|
|
5981
|
-
this.deferred = s, this.
|
|
5991
|
+
this.deferred = s, this.Rt = n.maxAttempts, this.Pt = new nn(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
5982
5992
|
}
|
|
5983
5993
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
5984
|
-
this.
|
|
5994
|
+
this.Rt -= 1, this.Vt();
|
|
5985
5995
|
}
|
|
5986
|
-
|
|
5987
|
-
this.
|
|
5988
|
-
const t = new Ur(this.datastore), e = this.
|
|
5996
|
+
Vt() {
|
|
5997
|
+
this.Pt.H((async () => {
|
|
5998
|
+
const t = new Ur(this.datastore), e = this.Nt(t);
|
|
5989
5999
|
e && e.then((e => {
|
|
5990
6000
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
5991
6001
|
this.deferred.resolve(e);
|
|
5992
6002
|
})).catch((t => {
|
|
5993
|
-
this
|
|
6003
|
+
this.$t(t);
|
|
5994
6004
|
}))));
|
|
5995
6005
|
})).catch((t => {
|
|
5996
|
-
this
|
|
6006
|
+
this.$t(t);
|
|
5997
6007
|
}));
|
|
5998
6008
|
}));
|
|
5999
6009
|
}
|
|
6000
|
-
|
|
6010
|
+
Nt(t) {
|
|
6001
6011
|
try {
|
|
6002
6012
|
const e = this.updateFunction(t);
|
|
6003
6013
|
return !at(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
|
|
@@ -6007,11 +6017,11 @@ class Br {
|
|
|
6007
6017
|
return this.deferred.reject(t), null;
|
|
6008
6018
|
}
|
|
6009
6019
|
}
|
|
6010
|
-
|
|
6011
|
-
this.
|
|
6020
|
+
$t(t) {
|
|
6021
|
+
this.Rt > 0 && this.Dt(t) ? (this.Rt -= 1, this.asyncQueue.enqueueAndForget((() => (this.Vt(),
|
|
6012
6022
|
Promise.resolve())))) : this.deferred.reject(t);
|
|
6013
6023
|
}
|
|
6014
|
-
|
|
6024
|
+
Dt(t) {
|
|
6015
6025
|
if ("FirebaseError" === t.name) {
|
|
6016
6026
|
// In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and
|
|
6017
6027
|
// non-matching document versions with ABORTED. These errors should be retried.
|
|
@@ -6182,39 +6192,39 @@ class Br {
|
|
|
6182
6192
|
*/ class Gr {
|
|
6183
6193
|
constructor() {
|
|
6184
6194
|
// The last promise in the queue.
|
|
6185
|
-
this.
|
|
6195
|
+
this.xt = Promise.resolve(),
|
|
6186
6196
|
// A list of retryable operations. Retryable operations are run in order and
|
|
6187
6197
|
// retried with backoff.
|
|
6188
|
-
this
|
|
6198
|
+
this.St = [],
|
|
6189
6199
|
// Is this AsyncQueue being shut down? Once it is set to true, it will not
|
|
6190
6200
|
// be changed again.
|
|
6191
|
-
this.
|
|
6201
|
+
this.Ft = !1,
|
|
6192
6202
|
// Operations scheduled to be queued in the future. Operations are
|
|
6193
6203
|
// automatically removed after they are run or canceled.
|
|
6194
|
-
this.
|
|
6204
|
+
this.qt = [],
|
|
6195
6205
|
// visible for testing
|
|
6196
|
-
this.
|
|
6206
|
+
this.Ot = null,
|
|
6197
6207
|
// Flag set while there's an outstanding AsyncQueue operation, used for
|
|
6198
6208
|
// assertion sanity-checks.
|
|
6199
|
-
this.
|
|
6209
|
+
this.kt = !1,
|
|
6200
6210
|
// Enabled during shutdown on Safari to prevent future access to IndexedDB.
|
|
6201
|
-
this.
|
|
6211
|
+
this.Ct = !1,
|
|
6202
6212
|
// List of TimerIds to fast-forward delays for.
|
|
6203
|
-
this.
|
|
6213
|
+
this.Lt = [],
|
|
6204
6214
|
// Backoff timer used to schedule retries for retryable operations
|
|
6205
|
-
this.
|
|
6215
|
+
this.Pt = new nn(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
6206
6216
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
6207
6217
|
// operations. Meant to speed up recovery when we regain file system access
|
|
6208
6218
|
// after page comes into foreground.
|
|
6209
|
-
this.
|
|
6219
|
+
this.Mt = () => {
|
|
6210
6220
|
const t = zr();
|
|
6211
|
-
t && p("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.
|
|
6221
|
+
t && p("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.Pt.X();
|
|
6212
6222
|
};
|
|
6213
6223
|
const t = zr();
|
|
6214
|
-
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.
|
|
6224
|
+
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Mt);
|
|
6215
6225
|
}
|
|
6216
6226
|
get isShuttingDown() {
|
|
6217
|
-
return this.
|
|
6227
|
+
return this.Ft;
|
|
6218
6228
|
}
|
|
6219
6229
|
/**
|
|
6220
6230
|
* Adds a new operation to the queue without waiting for it to complete (i.e.
|
|
@@ -6224,38 +6234,38 @@ class Br {
|
|
|
6224
6234
|
this.enqueue(t);
|
|
6225
6235
|
}
|
|
6226
6236
|
enqueueAndForgetEvenWhileRestricted(t) {
|
|
6227
|
-
this.
|
|
6237
|
+
this.Ut(),
|
|
6228
6238
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
6229
|
-
this.
|
|
6239
|
+
this.jt(t);
|
|
6230
6240
|
}
|
|
6231
6241
|
enterRestrictedMode(t) {
|
|
6232
|
-
if (!this.
|
|
6233
|
-
this.
|
|
6242
|
+
if (!this.Ft) {
|
|
6243
|
+
this.Ft = !0, this.Ct = t || !1;
|
|
6234
6244
|
const e = zr();
|
|
6235
|
-
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.
|
|
6245
|
+
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Mt);
|
|
6236
6246
|
}
|
|
6237
6247
|
}
|
|
6238
6248
|
enqueue(t) {
|
|
6239
|
-
if (this.
|
|
6249
|
+
if (this.Ut(), this.Ft)
|
|
6240
6250
|
// Return a Promise which never resolves.
|
|
6241
6251
|
return new Promise((() => {}));
|
|
6242
6252
|
// Create a deferred Promise that we can return to the callee. This
|
|
6243
6253
|
// allows us to return a "hanging Promise" only to the callee and still
|
|
6244
6254
|
// advance the queue even when the operation is not run.
|
|
6245
6255
|
const e = new U;
|
|
6246
|
-
return this.
|
|
6256
|
+
return this.jt((() => this.Ft && this.Ct ? Promise.resolve() : (t().then(e.resolve, e.reject),
|
|
6247
6257
|
e.promise))).then((() => e.promise));
|
|
6248
6258
|
}
|
|
6249
6259
|
enqueueRetryable(t) {
|
|
6250
|
-
this.enqueueAndForget((() => (this
|
|
6260
|
+
this.enqueueAndForget((() => (this.St.push(t), this.Bt())));
|
|
6251
6261
|
}
|
|
6252
6262
|
/**
|
|
6253
6263
|
* Runs the next operation from the retryable queue. If the operation fails,
|
|
6254
6264
|
* reschedules with backoff.
|
|
6255
|
-
*/ async
|
|
6256
|
-
if (0 !== this
|
|
6265
|
+
*/ async Bt() {
|
|
6266
|
+
if (0 !== this.St.length) {
|
|
6257
6267
|
try {
|
|
6258
|
-
await this
|
|
6268
|
+
await this.St[0](), this.St.shift(), this.Pt.reset();
|
|
6259
6269
|
} catch (t) {
|
|
6260
6270
|
if (!
|
|
6261
6271
|
/**
|
|
@@ -6299,7 +6309,7 @@ class Br {
|
|
|
6299
6309
|
// Failure will be handled by AsyncQueue
|
|
6300
6310
|
p("AsyncQueue", "Operation failed with retryable error: " + t);
|
|
6301
6311
|
}
|
|
6302
|
-
this
|
|
6312
|
+
this.St.length > 0 &&
|
|
6303
6313
|
// If there are additional operations, we re-schedule `retryNextOp()`.
|
|
6304
6314
|
// This is necessary to run retryable operations that failed during
|
|
6305
6315
|
// their initial attempt since we don't know whether they are already
|
|
@@ -6310,12 +6320,12 @@ class Br {
|
|
|
6310
6320
|
// Since `backoffAndRun()` cancels an existing backoff and schedules a
|
|
6311
6321
|
// new backoff on every call, there is only ever a single additional
|
|
6312
6322
|
// operation in the queue.
|
|
6313
|
-
this.
|
|
6323
|
+
this.Pt.H((() => this.Bt()));
|
|
6314
6324
|
}
|
|
6315
6325
|
}
|
|
6316
|
-
|
|
6317
|
-
const e = this.
|
|
6318
|
-
this.
|
|
6326
|
+
jt(t) {
|
|
6327
|
+
const e = this.xt.then((() => (this.kt = !0, t().catch((t => {
|
|
6328
|
+
this.Ot = t, this.kt = !1;
|
|
6319
6329
|
const e =
|
|
6320
6330
|
/**
|
|
6321
6331
|
* Chrome includes Error.message in Error.stack. Other browsers do not.
|
|
@@ -6356,38 +6366,38 @@ class Br {
|
|
|
6356
6366
|
// all further attempts to chain (via .then) will just short-circuit
|
|
6357
6367
|
// and return the rejected Promise.
|
|
6358
6368
|
throw y("INTERNAL UNHANDLED ERROR: ", e), t;
|
|
6359
|
-
})).then((t => (this.
|
|
6360
|
-
return this.
|
|
6369
|
+
})).then((t => (this.kt = !1, t))))));
|
|
6370
|
+
return this.xt = e, e;
|
|
6361
6371
|
}
|
|
6362
6372
|
enqueueAfterDelay(t, e, n) {
|
|
6363
|
-
this.
|
|
6373
|
+
this.Ut(),
|
|
6364
6374
|
// Fast-forward delays for timerIds that have been overriden.
|
|
6365
|
-
this.
|
|
6366
|
-
const r = Wr.createAndSchedule(this, t, e, n, (t => this.
|
|
6367
|
-
return this.
|
|
6375
|
+
this.Lt.indexOf(t) > -1 && (e = 0);
|
|
6376
|
+
const r = Wr.createAndSchedule(this, t, e, n, (t => this.zt(t)));
|
|
6377
|
+
return this.qt.push(r), r;
|
|
6368
6378
|
}
|
|
6369
|
-
|
|
6370
|
-
this.
|
|
6379
|
+
Ut() {
|
|
6380
|
+
this.Ot && v();
|
|
6371
6381
|
}
|
|
6372
6382
|
verifyOperationInProgress() {}
|
|
6373
6383
|
/**
|
|
6374
6384
|
* Waits until all currently queued tasks are finished executing. Delayed
|
|
6375
6385
|
* operations are not run.
|
|
6376
|
-
*/ async
|
|
6386
|
+
*/ async Wt() {
|
|
6377
6387
|
// Operations in the queue prior to draining may have enqueued additional
|
|
6378
6388
|
// operations. Keep draining the queue until the tail is no longer advanced,
|
|
6379
6389
|
// which indicates that no more new operations were enqueued and that all
|
|
6380
6390
|
// operations were executed.
|
|
6381
6391
|
let t;
|
|
6382
6392
|
do {
|
|
6383
|
-
t = this.
|
|
6384
|
-
} while (t !== this.
|
|
6393
|
+
t = this.xt, await t;
|
|
6394
|
+
} while (t !== this.xt);
|
|
6385
6395
|
}
|
|
6386
6396
|
/**
|
|
6387
6397
|
* For Tests: Determine if a delayed operation with a particular TimerId
|
|
6388
6398
|
* exists.
|
|
6389
|
-
*/
|
|
6390
|
-
for (const e of this.
|
|
6399
|
+
*/ Gt(t) {
|
|
6400
|
+
for (const e of this.qt) if (e.timerId === t) return !0;
|
|
6391
6401
|
return !1;
|
|
6392
6402
|
}
|
|
6393
6403
|
/**
|
|
@@ -6396,24 +6406,24 @@ class Br {
|
|
|
6396
6406
|
* @param lastTimerId - Delayed operations up to and including this TimerId
|
|
6397
6407
|
* will be drained. Pass TimerId.All to run all delayed operations.
|
|
6398
6408
|
* @returns a Promise that resolves once all operations have been run.
|
|
6399
|
-
*/
|
|
6409
|
+
*/ Kt(t) {
|
|
6400
6410
|
// Note that draining may generate more delayed ops, so we do that first.
|
|
6401
|
-
return this.
|
|
6411
|
+
return this.Wt().then((() => {
|
|
6402
6412
|
// Run ops in the same order they'd run if they ran naturally.
|
|
6403
|
-
this.
|
|
6404
|
-
for (const e of this.
|
|
6405
|
-
return this.
|
|
6413
|
+
this.qt.sort(((t, e) => t.targetTimeMs - e.targetTimeMs));
|
|
6414
|
+
for (const e of this.qt) if (e.skipDelay(), "all" /* All */ !== t && e.timerId === t) break;
|
|
6415
|
+
return this.Wt();
|
|
6406
6416
|
}));
|
|
6407
6417
|
}
|
|
6408
6418
|
/**
|
|
6409
6419
|
* For Tests: Skip all subsequent delays for a timer id.
|
|
6410
|
-
*/
|
|
6411
|
-
this.
|
|
6420
|
+
*/ Qt(t) {
|
|
6421
|
+
this.Lt.push(t);
|
|
6412
6422
|
}
|
|
6413
|
-
/** Called once a DelayedOperation is run or canceled. */
|
|
6423
|
+
/** Called once a DelayedOperation is run or canceled. */ zt(t) {
|
|
6414
6424
|
// NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
|
|
6415
|
-
const e = this.
|
|
6416
|
-
this.
|
|
6425
|
+
const e = this.qt.indexOf(t);
|
|
6426
|
+
this.qt.splice(e, 1);
|
|
6417
6427
|
}
|
|
6418
6428
|
}
|
|
6419
6429
|
|
|
@@ -6501,7 +6511,7 @@ class Kr {
|
|
|
6501
6511
|
return e && r._setSettings(e), r;
|
|
6502
6512
|
}), "PUBLIC")),
|
|
6503
6513
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
6504
|
-
r("firestore-lite", "3.4.
|
|
6514
|
+
r("firestore-lite", "3.4.14-canary.6f4ba2525", "rn"), r("firestore-lite", "3.4.14-canary.6f4ba2525", "esm2017");
|
|
6505
6515
|
|
|
6506
6516
|
export { Rn as Bytes, _n as CollectionReference, pn as DocumentReference, er as DocumentSnapshot, In as FieldPath, Pn as FieldValue, ln as Firestore, M as FirestoreError, Vn as GeoPoint, yn as Query, or as QueryConstraint, nr as QueryDocumentSnapshot, rr as QuerySnapshot, vt as Timestamp, Kr as Transaction, Cr as WriteBatch, xr as addDoc, Or as arrayRemove, qr as arrayUnion, gn as collection, vn as collectionGroup, wn as connectFirestoreEmulator, Dr as deleteDoc, Sr as deleteField, bn as doc, An as documentId, vr as endAt, gr as endBefore, Pr as getDoc, Vr as getDocs, dn as getFirestore, kr as increment, fn as initializeFirestore, dr as limit, wr as limitToLast, lr as orderBy, ur as query, Tn as queryEqual, En as refEqual, Qr as runTransaction, Fr as serverTimestamp, Nr as setDoc, m as setLogLevel, sr as snapshotEqual, yr as startAfter, pr as startAt, mn as terminate, $r as updateDoc, ar as where, Mr as writeBatch };
|
|
6507
6517
|
//# sourceMappingURL=index.rn.esm2017.js.map
|