@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
|
@@ -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.3-canary.04dcdbb0f";
|
|
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
|
}
|
|
@@ -461,22 +473,6 @@ class J {
|
|
|
461
473
|
}
|
|
462
474
|
}
|
|
463
475
|
|
|
464
|
-
/**
|
|
465
|
-
* @license
|
|
466
|
-
* Copyright 2017 Google LLC
|
|
467
|
-
*
|
|
468
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
469
|
-
* you may not use this file except in compliance with the License.
|
|
470
|
-
* You may obtain a copy of the License at
|
|
471
|
-
*
|
|
472
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
473
|
-
*
|
|
474
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
475
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
476
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
477
|
-
* See the License for the specific language governing permissions and
|
|
478
|
-
* limitations under the License.
|
|
479
|
-
*/
|
|
480
476
|
/**
|
|
481
477
|
* Path represents an ordered sequence of string segments.
|
|
482
478
|
*/
|
|
@@ -1012,27 +1008,27 @@ class {
|
|
|
1012
1008
|
constructor(t) {
|
|
1013
1009
|
this.databaseInfo = t, this.databaseId = t.databaseId;
|
|
1014
1010
|
const e = t.ssl ? "https" : "http";
|
|
1015
|
-
this.
|
|
1011
|
+
this.p = e + "://" + t.host, this.g = "projects/" + this.databaseId.projectId + "/databases/" + this.databaseId.database + "/documents";
|
|
1016
1012
|
}
|
|
1017
|
-
|
|
1018
|
-
const i = this.
|
|
1013
|
+
v(t, e, n, r, s) {
|
|
1014
|
+
const i = this.T(t, e);
|
|
1019
1015
|
p("RestConnection", "Sending: ", i, n);
|
|
1020
1016
|
const o = {};
|
|
1021
|
-
return this.
|
|
1017
|
+
return this.I(o, r, s), this.A(t, i, o, n).then((t => (p("RestConnection", "Received: ", t),
|
|
1022
1018
|
t)), (e => {
|
|
1023
1019
|
throw _("RestConnection", `${t} failed with error: `, e, "url: ", i, "request:", n),
|
|
1024
1020
|
e;
|
|
1025
1021
|
}));
|
|
1026
1022
|
}
|
|
1027
|
-
|
|
1023
|
+
R(t, e, n, r, s, i) {
|
|
1028
1024
|
// The REST API automatically aggregates all of the streamed results, so we
|
|
1029
1025
|
// can just use the normal invoke() method.
|
|
1030
|
-
return this.
|
|
1026
|
+
return this.v(t, e, n, r, s);
|
|
1031
1027
|
}
|
|
1032
1028
|
/**
|
|
1033
1029
|
* Modifies the headers for a request, adding any authorization token if
|
|
1034
1030
|
* present and any additional headers for the request.
|
|
1035
|
-
*/
|
|
1031
|
+
*/ I(t, e, n) {
|
|
1036
1032
|
t["X-Goog-Api-Client"] = "gl-js/ fire/" + d,
|
|
1037
1033
|
// Content-Type: text/plain will avoid preflight requests which might
|
|
1038
1034
|
// mess with CORS and redirects by proxies. If we add custom headers
|
|
@@ -1041,9 +1037,9 @@ class {
|
|
|
1041
1037
|
t["Content-Type"] = "text/plain", this.databaseInfo.appId && (t["X-Firebase-GMPID"] = this.databaseInfo.appId),
|
|
1042
1038
|
e && e.headers.forEach(((e, n) => t[n] = e)), n && n.headers.forEach(((e, n) => t[n] = e));
|
|
1043
1039
|
}
|
|
1044
|
-
|
|
1040
|
+
T(t, e) {
|
|
1045
1041
|
const n = lt[t];
|
|
1046
|
-
return `${this.
|
|
1042
|
+
return `${this.p}/v1/${e}:${n}`;
|
|
1047
1043
|
}
|
|
1048
1044
|
} {
|
|
1049
1045
|
/**
|
|
@@ -1051,16 +1047,16 @@ class {
|
|
|
1051
1047
|
* @param fetchImpl - `fetch` or a Polyfill that implements the fetch API.
|
|
1052
1048
|
*/
|
|
1053
1049
|
constructor(t, e) {
|
|
1054
|
-
super(t), this.
|
|
1050
|
+
super(t), this.P = e;
|
|
1055
1051
|
}
|
|
1056
|
-
|
|
1052
|
+
V(t, e) {
|
|
1057
1053
|
throw new Error("Not supported by FetchConnection");
|
|
1058
1054
|
}
|
|
1059
|
-
async
|
|
1055
|
+
async A(t, e, n, r) {
|
|
1060
1056
|
const s = JSON.stringify(r);
|
|
1061
1057
|
let i;
|
|
1062
1058
|
try {
|
|
1063
|
-
i = await this.
|
|
1059
|
+
i = await this.P(e, {
|
|
1064
1060
|
method: "POST",
|
|
1065
1061
|
headers: n,
|
|
1066
1062
|
body: s
|
|
@@ -1138,7 +1134,7 @@ function pt(t) {
|
|
|
1138
1134
|
* See the License for the specific language governing permissions and
|
|
1139
1135
|
* limitations under the License.
|
|
1140
1136
|
*/ class yt {
|
|
1141
|
-
static
|
|
1137
|
+
static N() {
|
|
1142
1138
|
// Alphanumeric characters
|
|
1143
1139
|
const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = Math.floor(256 / t.length) * t.length;
|
|
1144
1140
|
// The largest byte value that is a multiple of `char.length`.
|
|
@@ -2620,7 +2616,7 @@ class Jt {
|
|
|
2620
2616
|
class Zt {
|
|
2621
2617
|
constructor(t, e = null, n = [], r = [], s = null, i = null, o = null) {
|
|
2622
2618
|
this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = s,
|
|
2623
|
-
this.startAt = i, this.endAt = o, this
|
|
2619
|
+
this.startAt = i, this.endAt = o, this.$ = null;
|
|
2624
2620
|
}
|
|
2625
2621
|
}
|
|
2626
2622
|
|
|
@@ -2642,18 +2638,18 @@ class ee extends class {} {
|
|
|
2642
2638
|
/**
|
|
2643
2639
|
* Creates a filter based on the provided arguments.
|
|
2644
2640
|
*/ static create(t, e, n) {
|
|
2645
|
-
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.
|
|
2641
|
+
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
2642
|
}
|
|
2647
|
-
static
|
|
2643
|
+
static D(t, e, n) {
|
|
2648
2644
|
return "in" /* IN */ === e ? new re(t, n) : new se(t, n);
|
|
2649
2645
|
}
|
|
2650
2646
|
matches(t) {
|
|
2651
2647
|
const e = t.data.field(this.field);
|
|
2652
2648
|
// Types do not have to match in NOT_EQUAL filters.
|
|
2653
|
-
return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.
|
|
2649
|
+
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
2650
|
// Only compare types with matching backend order (such as double and int).
|
|
2655
2651
|
}
|
|
2656
|
-
|
|
2652
|
+
S(t) {
|
|
2657
2653
|
switch (this.op) {
|
|
2658
2654
|
case "<" /* LESS_THAN */ :
|
|
2659
2655
|
return t < 0;
|
|
@@ -2677,7 +2673,7 @@ class ee extends class {} {
|
|
|
2677
2673
|
return v();
|
|
2678
2674
|
}
|
|
2679
2675
|
}
|
|
2680
|
-
|
|
2676
|
+
F() {
|
|
2681
2677
|
return [ "<" /* LESS_THAN */ , "<=" /* LESS_THAN_OR_EQUAL */ , ">" /* GREATER_THAN */ , ">=" /* GREATER_THAN_OR_EQUAL */ , "!=" /* NOT_EQUAL */ , "not-in" /* NOT_IN */ ].indexOf(this.op) >= 0;
|
|
2682
2678
|
}
|
|
2683
2679
|
}
|
|
@@ -2689,7 +2685,7 @@ class ne extends ee {
|
|
|
2689
2685
|
}
|
|
2690
2686
|
matches(t) {
|
|
2691
2687
|
const e = nt.comparator(t.key, this.key);
|
|
2692
|
-
return this.
|
|
2688
|
+
return this.S(e);
|
|
2693
2689
|
}
|
|
2694
2690
|
}
|
|
2695
2691
|
|
|
@@ -2829,9 +2825,9 @@ function de(t, e) {
|
|
|
2829
2825
|
*/
|
|
2830
2826
|
constructor(t, e = null, n = [], r = [], s = null, i = "F" /* First */ , o = null, u = null) {
|
|
2831
2827
|
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.
|
|
2828
|
+
this.limit = s, this.limitType = i, this.startAt = o, this.endAt = u, this.q = null,
|
|
2833
2829
|
// The corresponding `Target` of this `Query` instance.
|
|
2834
|
-
this.
|
|
2830
|
+
this.O = null, this.startAt, this.endAt;
|
|
2835
2831
|
}
|
|
2836
2832
|
}
|
|
2837
2833
|
|
|
@@ -2840,7 +2836,7 @@ function de(t, e) {
|
|
|
2840
2836
|
}
|
|
2841
2837
|
|
|
2842
2838
|
function pe(t) {
|
|
2843
|
-
for (const e of t.filters) if (e
|
|
2839
|
+
for (const e of t.filters) if (e.F()) return e.field;
|
|
2844
2840
|
return null;
|
|
2845
2841
|
}
|
|
2846
2842
|
|
|
@@ -2862,32 +2858,32 @@ function ye(t) {
|
|
|
2862
2858
|
* the SDK and backend always orders by `__name__`).
|
|
2863
2859
|
*/ function _e(t) {
|
|
2864
2860
|
const e = E(t);
|
|
2865
|
-
if (null === e.
|
|
2866
|
-
e.
|
|
2861
|
+
if (null === e.q) {
|
|
2862
|
+
e.q = [];
|
|
2867
2863
|
const t = pe(e), n = me(e);
|
|
2868
2864
|
if (null !== t && null === n)
|
|
2869
2865
|
// In order to implicitly add key ordering, we must also add the
|
|
2870
2866
|
// inequality filter field for it to be a valid query.
|
|
2871
2867
|
// Note that the default inequality field and key ordering is ascending.
|
|
2872
|
-
t.isKeyField() || e.
|
|
2868
|
+
t.isKeyField() || e.q.push(new le(t)), e.q.push(new le(et.keyField(), "asc" /* ASCENDING */)); else {
|
|
2873
2869
|
let t = !1;
|
|
2874
|
-
for (const n of e.explicitOrderBy) e.
|
|
2870
|
+
for (const n of e.explicitOrderBy) e.q.push(n), n.field.isKeyField() && (t = !0);
|
|
2875
2871
|
if (!t) {
|
|
2876
2872
|
// The order of the implicit key ordering always matches the last
|
|
2877
2873
|
// explicit order by
|
|
2878
2874
|
const t = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
|
|
2879
|
-
e.
|
|
2875
|
+
e.q.push(new le(et.keyField(), t));
|
|
2880
2876
|
}
|
|
2881
2877
|
}
|
|
2882
2878
|
}
|
|
2883
|
-
return e.
|
|
2879
|
+
return e.q;
|
|
2884
2880
|
}
|
|
2885
2881
|
|
|
2886
2882
|
/**
|
|
2887
2883
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
2888
2884
|
*/ function ge(t) {
|
|
2889
2885
|
const e = E(t);
|
|
2890
|
-
if (!e.
|
|
2886
|
+
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
2887
|
// Flip the orderBy directions since we want the last results
|
|
2892
2888
|
const t = [];
|
|
2893
2889
|
for (const n of _e(e)) {
|
|
@@ -2897,9 +2893,9 @@ function ye(t) {
|
|
|
2897
2893
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
2898
2894
|
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
2895
|
// Now return as a LimitType.First query.
|
|
2900
|
-
e.
|
|
2896
|
+
e.O = te(e.path, e.collectionGroup, t, e.filters, e.limit, n, r);
|
|
2901
2897
|
}
|
|
2902
|
-
return e.
|
|
2898
|
+
return e.O;
|
|
2903
2899
|
}
|
|
2904
2900
|
|
|
2905
2901
|
function ve(t, e) {
|
|
@@ -2952,7 +2948,7 @@ function be(t, e) {
|
|
|
2952
2948
|
integerValue: "" + t
|
|
2953
2949
|
};
|
|
2954
2950
|
}(e) : function(t, e) {
|
|
2955
|
-
if (t.
|
|
2951
|
+
if (t.k) {
|
|
2956
2952
|
if (isNaN(e)) return {
|
|
2957
2953
|
doubleValue: "NaN"
|
|
2958
2954
|
};
|
|
@@ -3014,7 +3010,7 @@ function be(t, e) {
|
|
|
3014
3010
|
* arithmetic is used and precision loss can occur for values greater than 2^53.
|
|
3015
3011
|
*/ class Re extends Ee {
|
|
3016
3012
|
constructor(t, e) {
|
|
3017
|
-
super(), this.
|
|
3013
|
+
super(), this.C = t, this.L = e;
|
|
3018
3014
|
}
|
|
3019
3015
|
}
|
|
3020
3016
|
|
|
@@ -3222,7 +3218,7 @@ function be(t, e) {
|
|
|
3222
3218
|
*/
|
|
3223
3219
|
class Oe {
|
|
3224
3220
|
constructor(t, e) {
|
|
3225
|
-
this.databaseId = t, this.
|
|
3221
|
+
this.databaseId = t, this.k = e;
|
|
3226
3222
|
}
|
|
3227
3223
|
}
|
|
3228
3224
|
|
|
@@ -3238,7 +3234,7 @@ class Oe {
|
|
|
3238
3234
|
* Returns a value for a Date that's appropriate to put into a proto.
|
|
3239
3235
|
*/
|
|
3240
3236
|
function ke(t, e) {
|
|
3241
|
-
if (t.
|
|
3237
|
+
if (t.k) {
|
|
3242
3238
|
return `${new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "")}.${("000000000" + e.nanoseconds).slice(-9)}Z`;
|
|
3243
3239
|
}
|
|
3244
3240
|
return {
|
|
@@ -3253,7 +3249,7 @@ function ke(t, e) {
|
|
|
3253
3249
|
* Visible for testing.
|
|
3254
3250
|
*/
|
|
3255
3251
|
function Ce(t, e) {
|
|
3256
|
-
return t.
|
|
3252
|
+
return t.k ? e.toBase64() : e.toUint8Array();
|
|
3257
3253
|
}
|
|
3258
3254
|
|
|
3259
3255
|
function Le(t, e) {
|
|
@@ -3354,7 +3350,7 @@ function Qe(t, e) {
|
|
|
3354
3350
|
};
|
|
3355
3351
|
if (n instanceof Re) return {
|
|
3356
3352
|
fieldPath: e.field.canonicalString(),
|
|
3357
|
-
increment: n.
|
|
3353
|
+
increment: n.L
|
|
3358
3354
|
};
|
|
3359
3355
|
throw v();
|
|
3360
3356
|
}(0, t)))), e.precondition.isNone || (n.currentDocument = function(t, e) {
|
|
@@ -3439,7 +3435,7 @@ function Ye(t, e) {
|
|
|
3439
3435
|
}(e.orderBy);
|
|
3440
3436
|
i && (n.structuredQuery.orderBy = i);
|
|
3441
3437
|
const o = function(t, e) {
|
|
3442
|
-
return t.
|
|
3438
|
+
return t.k || at(e) ? e : {
|
|
3443
3439
|
value: e
|
|
3444
3440
|
};
|
|
3445
3441
|
}(t, e.limit);
|
|
@@ -3553,9 +3549,9 @@ class nn {
|
|
|
3553
3549
|
* Note that jitter will still be applied, so the actual delay could be as
|
|
3554
3550
|
* much as 1.5*maxDelayMs.
|
|
3555
3551
|
*/ , s = 6e4) {
|
|
3556
|
-
this.
|
|
3552
|
+
this.M = t, this.timerId = e, this.U = n, this.j = r, this.B = s, this.W = 0, this.G = null,
|
|
3557
3553
|
/** The last backoff attempt, as epoch milliseconds. */
|
|
3558
|
-
this.
|
|
3554
|
+
this.K = Date.now(), this.reset();
|
|
3559
3555
|
}
|
|
3560
3556
|
/**
|
|
3561
3557
|
* Resets the backoff delay.
|
|
@@ -3564,40 +3560,40 @@ class nn {
|
|
|
3564
3560
|
* (i.e. due to an error), initialDelayMs (plus jitter) will be used, and
|
|
3565
3561
|
* subsequent ones will increase according to the backoffFactor.
|
|
3566
3562
|
*/ reset() {
|
|
3567
|
-
this.
|
|
3563
|
+
this.W = 0;
|
|
3568
3564
|
}
|
|
3569
3565
|
/**
|
|
3570
3566
|
* Resets the backoff delay to the maximum delay (e.g. for use after a
|
|
3571
3567
|
* RESOURCE_EXHAUSTED error).
|
|
3572
|
-
*/
|
|
3573
|
-
this.
|
|
3568
|
+
*/ Y() {
|
|
3569
|
+
this.W = this.B;
|
|
3574
3570
|
}
|
|
3575
3571
|
/**
|
|
3576
3572
|
* Returns a promise that resolves after currentDelayMs, and increases the
|
|
3577
3573
|
* delay for any subsequent attempts. If there was a pending backoff operation
|
|
3578
3574
|
* already, it will be canceled.
|
|
3579
|
-
*/
|
|
3575
|
+
*/ H(t) {
|
|
3580
3576
|
// Cancel any pending backoff operation.
|
|
3581
3577
|
this.cancel();
|
|
3582
3578
|
// First schedule using the current base (which may be 0 and should be
|
|
3583
3579
|
// honored as such).
|
|
3584
|
-
const e = Math.floor(this.
|
|
3580
|
+
const e = Math.floor(this.W + this.J()), n = Math.max(0, Date.now() - this.K), r = Math.max(0, e - n);
|
|
3585
3581
|
// 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.
|
|
3582
|
+
r > 0 && p("ExponentialBackoff", `Backing off for ${r} ms (base delay: ${this.W} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),
|
|
3583
|
+
this.G = this.M.enqueueAfterDelay(this.timerId, r, (() => (this.K = Date.now(),
|
|
3588
3584
|
t()))),
|
|
3589
3585
|
// Apply backoff factor to determine next delay and ensure it is within
|
|
3590
3586
|
// bounds.
|
|
3591
|
-
this.
|
|
3587
|
+
this.W *= this.j, this.W < this.U && (this.W = this.U), this.W > this.B && (this.W = this.B);
|
|
3592
3588
|
}
|
|
3593
|
-
|
|
3594
|
-
null !== this.
|
|
3589
|
+
X() {
|
|
3590
|
+
null !== this.G && (this.G.skipDelay(), this.G = null);
|
|
3595
3591
|
}
|
|
3596
3592
|
cancel() {
|
|
3597
|
-
null !== this.
|
|
3593
|
+
null !== this.G && (this.G.cancel(), this.G = null);
|
|
3598
3594
|
}
|
|
3599
|
-
/** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */
|
|
3600
|
-
return (Math.random() - .5) * this.
|
|
3595
|
+
/** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ J() {
|
|
3596
|
+
return (Math.random() - .5) * this.W;
|
|
3601
3597
|
}
|
|
3602
3598
|
}
|
|
3603
3599
|
|
|
@@ -3628,44 +3624,44 @@ class nn {
|
|
|
3628
3624
|
*/
|
|
3629
3625
|
class rn extends class {} {
|
|
3630
3626
|
constructor(t, e, n, r) {
|
|
3631
|
-
super(), this.authCredentials = t, this.appCheckCredentials = e, this.
|
|
3632
|
-
this.
|
|
3627
|
+
super(), this.authCredentials = t, this.appCheckCredentials = e, this.Z = n, this.C = r,
|
|
3628
|
+
this.tt = !1;
|
|
3633
3629
|
}
|
|
3634
|
-
|
|
3635
|
-
if (this.
|
|
3630
|
+
et() {
|
|
3631
|
+
if (this.tt) throw new M(S, "The client has already been terminated.");
|
|
3636
3632
|
}
|
|
3637
|
-
/** Invokes the provided RPC with auth and AppCheck tokens. */
|
|
3638
|
-
return this.
|
|
3633
|
+
/** Invokes the provided RPC with auth and AppCheck tokens. */ v(t, e, n) {
|
|
3634
|
+
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
3635
|
throw "FirebaseError" === t.name ? (t.code === D && (this.authCredentials.invalidateToken(),
|
|
3640
3636
|
this.appCheckCredentials.invalidateToken()), t) : new M(A, t.toString());
|
|
3641
3637
|
}));
|
|
3642
3638
|
}
|
|
3643
|
-
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */
|
|
3644
|
-
return this.
|
|
3639
|
+
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ R(t, e, n, r) {
|
|
3640
|
+
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
3641
|
throw "FirebaseError" === t.name ? (t.code === D && (this.authCredentials.invalidateToken(),
|
|
3646
3642
|
this.appCheckCredentials.invalidateToken()), t) : new M(A, t.toString());
|
|
3647
3643
|
}));
|
|
3648
3644
|
}
|
|
3649
3645
|
terminate() {
|
|
3650
|
-
this.
|
|
3646
|
+
this.tt = !0;
|
|
3651
3647
|
}
|
|
3652
3648
|
}
|
|
3653
3649
|
|
|
3654
3650
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
3655
3651
|
// firestore-exp client.
|
|
3656
3652
|
async function sn(t, e) {
|
|
3657
|
-
const n = E(t), r = We(n.
|
|
3658
|
-
writes: e.map((t => Qe(n.
|
|
3653
|
+
const n = E(t), r = We(n.C) + "/documents", s = {
|
|
3654
|
+
writes: e.map((t => Qe(n.C, t)))
|
|
3659
3655
|
};
|
|
3660
|
-
await n.
|
|
3656
|
+
await n.v("Commit", r, s);
|
|
3661
3657
|
}
|
|
3662
3658
|
|
|
3663
3659
|
async function on(t, e) {
|
|
3664
|
-
const n = E(t), r = We(n.
|
|
3665
|
-
documents: e.map((t => je(n.
|
|
3666
|
-
}, i = await n.
|
|
3660
|
+
const n = E(t), r = We(n.C) + "/documents", s = {
|
|
3661
|
+
documents: e.map((t => je(n.C, t)))
|
|
3662
|
+
}, i = await n.R("BatchGetDocuments", r, s, e.length), o = new Map;
|
|
3667
3663
|
i.forEach((t => {
|
|
3668
|
-
const e = Ke(n.
|
|
3664
|
+
const e = Ke(n.C, t);
|
|
3669
3665
|
o.set(e.key.toString(), e);
|
|
3670
3666
|
}));
|
|
3671
3667
|
const u = [];
|
|
@@ -3676,8 +3672,8 @@ async function on(t, e) {
|
|
|
3676
3672
|
}
|
|
3677
3673
|
|
|
3678
3674
|
async function un(t, e) {
|
|
3679
|
-
const n = E(t), r = Ye(n.
|
|
3680
|
-
return (await n.
|
|
3675
|
+
const n = E(t), r = Ye(n.C, ge(e));
|
|
3676
|
+
return (await n.R("RunQuery", r.parent, {
|
|
3681
3677
|
structuredQuery: r.structuredQuery
|
|
3682
3678
|
})).filter((t => !!t.document)).map((t => function(t, e, n) {
|
|
3683
3679
|
const r = Be(t, e.name), s = Me(e.updateTime), i = new Jt({
|
|
@@ -3686,7 +3682,7 @@ async function un(t, e) {
|
|
|
3686
3682
|
}
|
|
3687
3683
|
}), o = Xt.newFoundDocument(r, s, i);
|
|
3688
3684
|
return n && o.setHasCommittedMutations(), n ? o.setHasCommittedMutations() : o;
|
|
3689
|
-
}(n.
|
|
3685
|
+
}(n.C, t.document, void 0)));
|
|
3690
3686
|
}
|
|
3691
3687
|
|
|
3692
3688
|
/**
|
|
@@ -3799,28 +3795,14 @@ class hn {
|
|
|
3799
3795
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
3800
3796
|
*/ class ln {
|
|
3801
3797
|
/** @hideconstructor */
|
|
3802
|
-
constructor(t, e, n) {
|
|
3803
|
-
this._authCredentials =
|
|
3798
|
+
constructor(t, e, n, r) {
|
|
3799
|
+
this._authCredentials = t, this._appCheckCredentials = e, this._databaseId = n,
|
|
3800
|
+
this._app = r,
|
|
3804
3801
|
/**
|
|
3805
3802
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
3806
3803
|
*/
|
|
3807
3804
|
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new hn({}),
|
|
3808
|
-
this._settingsFrozen = !1
|
|
3809
|
-
this._databaseId = function(t) {
|
|
3810
|
-
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new M(R, '"projectId" not provided in firebase.initializeApp.');
|
|
3811
|
-
return new J(t.options.projectId);
|
|
3812
|
-
}
|
|
3813
|
-
/**
|
|
3814
|
-
* Initializes a new instance of Cloud Firestore with the provided settings.
|
|
3815
|
-
* Can only be called before any other functions, including
|
|
3816
|
-
* {@link getFirestore}. If the custom settings are empty, this function is
|
|
3817
|
-
* equivalent to calling {@link getFirestore}.
|
|
3818
|
-
*
|
|
3819
|
-
* @param app - The {@link @firebase/app#FirebaseApp} with which the `Firestore` instance will
|
|
3820
|
-
* be associated.
|
|
3821
|
-
* @param settings - A settings object to configure the `Firestore` instance.
|
|
3822
|
-
* @returns A newly initialized `Firestore` instance.
|
|
3823
|
-
*/ (t));
|
|
3805
|
+
this._settingsFrozen = !1;
|
|
3824
3806
|
}
|
|
3825
3807
|
/**
|
|
3826
3808
|
* The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
|
|
@@ -3842,9 +3824,7 @@ class hn {
|
|
|
3842
3824
|
switch (t.type) {
|
|
3843
3825
|
case "gapi":
|
|
3844
3826
|
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);
|
|
3827
|
+
return new K(e, t.sessionIndex || "0", t.iamToken || null, t.authTokenFactory || null);
|
|
3848
3828
|
|
|
3849
3829
|
case "provider":
|
|
3850
3830
|
return t.client;
|
|
@@ -3884,24 +3864,21 @@ class hn {
|
|
|
3884
3864
|
}
|
|
3885
3865
|
}
|
|
3886
3866
|
|
|
3887
|
-
function fn(t, e) {
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3867
|
+
function fn(t, e, n) {
|
|
3868
|
+
n || (n = "(default)");
|
|
3869
|
+
const r = _getProvider(t, "firestore/lite");
|
|
3870
|
+
if (r.isInitialized(n)) throw new M(S, "Firestore can only be initialized once per app.");
|
|
3871
|
+
return r.initialize({
|
|
3872
|
+
options: e,
|
|
3873
|
+
instanceIdentifier: n
|
|
3892
3874
|
});
|
|
3893
3875
|
}
|
|
3894
3876
|
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
|
|
3901
|
-
* instance is associated with.
|
|
3902
|
-
* @returns The `Firestore` instance of the provided app.
|
|
3903
|
-
*/ function dn(e = t()) {
|
|
3904
|
-
return _getProvider(e, "firestore/lite").getImmediate();
|
|
3877
|
+
function dn(e, n) {
|
|
3878
|
+
const r = "object" == typeof e ? e : t(), s = "string" == typeof e ? e : n || "(default)";
|
|
3879
|
+
return _getProvider(r, "firestore/lite").getImmediate({
|
|
3880
|
+
identifier: s
|
|
3881
|
+
});
|
|
3905
3882
|
}
|
|
3906
3883
|
|
|
3907
3884
|
/**
|
|
@@ -4126,7 +4103,7 @@ function bn(t, e, ...n) {
|
|
|
4126
4103
|
if (t = l(t),
|
|
4127
4104
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
4128
4105
|
// 'undefined' and 'null'.
|
|
4129
|
-
1 === arguments.length && (e = yt.
|
|
4106
|
+
1 === arguments.length && (e = yt.N()), rt("doc", "path", e), t instanceof ln) {
|
|
4130
4107
|
const r = Z.fromString(e, ...n);
|
|
4131
4108
|
return st(r), new pn(t,
|
|
4132
4109
|
/* converter= */ null, new nt(r));
|
|
@@ -4455,58 +4432,58 @@ function xn(t) {
|
|
|
4455
4432
|
* compromised).
|
|
4456
4433
|
*/
|
|
4457
4434
|
constructor(t, e, n, r, s, i) {
|
|
4458
|
-
this.settings = t, this.databaseId = e, this.
|
|
4435
|
+
this.settings = t, this.databaseId = e, this.C = n, this.ignoreUndefinedProperties = r,
|
|
4459
4436
|
// Minor hack: If fieldTransforms is undefined, we assume this is an
|
|
4460
4437
|
// external call and we need to validate the entire path.
|
|
4461
|
-
void 0 === s && this.
|
|
4438
|
+
void 0 === s && this.nt(), this.fieldTransforms = s || [], this.fieldMask = i || [];
|
|
4462
4439
|
}
|
|
4463
4440
|
get path() {
|
|
4464
4441
|
return this.settings.path;
|
|
4465
4442
|
}
|
|
4466
|
-
get
|
|
4467
|
-
return this.settings.
|
|
4443
|
+
get rt() {
|
|
4444
|
+
return this.settings.rt;
|
|
4468
4445
|
}
|
|
4469
|
-
/** Returns a new context with the specified settings overwritten. */
|
|
4470
|
-
return new Sn(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.
|
|
4446
|
+
/** Returns a new context with the specified settings overwritten. */ st(t) {
|
|
4447
|
+
return new Sn(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.C, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
4471
4448
|
}
|
|
4472
|
-
|
|
4449
|
+
it(t) {
|
|
4473
4450
|
var e;
|
|
4474
|
-
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.
|
|
4451
|
+
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.st({
|
|
4475
4452
|
path: n,
|
|
4476
|
-
|
|
4453
|
+
ot: !1
|
|
4477
4454
|
});
|
|
4478
|
-
return r.
|
|
4455
|
+
return r.ut(t), r;
|
|
4479
4456
|
}
|
|
4480
|
-
|
|
4457
|
+
ct(t) {
|
|
4481
4458
|
var e;
|
|
4482
|
-
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.
|
|
4459
|
+
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.st({
|
|
4483
4460
|
path: n,
|
|
4484
|
-
|
|
4461
|
+
ot: !1
|
|
4485
4462
|
});
|
|
4486
|
-
return r.
|
|
4463
|
+
return r.nt(), r;
|
|
4487
4464
|
}
|
|
4488
|
-
|
|
4465
|
+
at(t) {
|
|
4489
4466
|
// TODO(b/34871131): We don't support array paths right now; so make path
|
|
4490
4467
|
// undefined.
|
|
4491
|
-
return this.
|
|
4468
|
+
return this.st({
|
|
4492
4469
|
path: void 0,
|
|
4493
|
-
|
|
4470
|
+
ot: !0
|
|
4494
4471
|
});
|
|
4495
4472
|
}
|
|
4496
|
-
|
|
4497
|
-
return Zn(t, this.settings.methodName, this.settings.
|
|
4473
|
+
ht(t) {
|
|
4474
|
+
return Zn(t, this.settings.methodName, this.settings.lt || !1, this.path, this.settings.ft);
|
|
4498
4475
|
}
|
|
4499
4476
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
4500
4477
|
return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
|
|
4501
4478
|
}
|
|
4502
|
-
|
|
4479
|
+
nt() {
|
|
4503
4480
|
// TODO(b/34871131): Remove null check once we have proper paths for fields
|
|
4504
4481
|
// within arrays.
|
|
4505
|
-
if (this.path) for (let t = 0; t < this.path.length; t++) this.
|
|
4482
|
+
if (this.path) for (let t = 0; t < this.path.length; t++) this.ut(this.path.get(t));
|
|
4506
4483
|
}
|
|
4507
|
-
|
|
4508
|
-
if (0 === t.length) throw this.
|
|
4509
|
-
if (xn(this.
|
|
4484
|
+
ut(t) {
|
|
4485
|
+
if (0 === t.length) throw this.ht("Document fields must not be empty");
|
|
4486
|
+
if (xn(this.rt) && Nn.test(t)) throw this.ht('Document fields cannot begin and end with "__"');
|
|
4510
4487
|
}
|
|
4511
4488
|
}
|
|
4512
4489
|
|
|
@@ -4515,17 +4492,17 @@ function xn(t) {
|
|
|
4515
4492
|
* classes.
|
|
4516
4493
|
*/ class Fn {
|
|
4517
4494
|
constructor(t, e, n) {
|
|
4518
|
-
this.databaseId = t, this.ignoreUndefinedProperties = e, this.
|
|
4495
|
+
this.databaseId = t, this.ignoreUndefinedProperties = e, this.C = n || en(t);
|
|
4519
4496
|
}
|
|
4520
|
-
/** Creates a new top-level parse context. */
|
|
4497
|
+
/** Creates a new top-level parse context. */ dt(t, e, n, r = !1) {
|
|
4521
4498
|
return new Sn({
|
|
4522
|
-
|
|
4499
|
+
rt: t,
|
|
4523
4500
|
methodName: e,
|
|
4524
|
-
|
|
4501
|
+
ft: n,
|
|
4525
4502
|
path: et.emptyPath(),
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
}, this.databaseId, this.
|
|
4503
|
+
ot: !1,
|
|
4504
|
+
lt: r
|
|
4505
|
+
}, this.databaseId, this.C, this.ignoreUndefinedProperties);
|
|
4529
4506
|
}
|
|
4530
4507
|
}
|
|
4531
4508
|
|
|
@@ -4535,7 +4512,7 @@ function qn(t) {
|
|
|
4535
4512
|
}
|
|
4536
4513
|
|
|
4537
4514
|
/** Parse document data from a set() call. */ function On(t, e, n, r, s, i = {}) {
|
|
4538
|
-
const o = t.
|
|
4515
|
+
const o = t.dt(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, s);
|
|
4539
4516
|
Yn("Data must be an object, but it was:", o, r);
|
|
4540
4517
|
const u = Kn(r, o);
|
|
4541
4518
|
let c, a;
|
|
@@ -4553,7 +4530,7 @@ function qn(t) {
|
|
|
4553
4530
|
|
|
4554
4531
|
class kn extends Pn {
|
|
4555
4532
|
_toFieldTransform(t) {
|
|
4556
|
-
if (2 /* MergeSet */ !== t.
|
|
4533
|
+
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
4534
|
// No transform to add for a delete, but we need to add it to our
|
|
4558
4535
|
// fieldMask so it gets deleted.
|
|
4559
4536
|
return t.fieldMask.push(t.path), null;
|
|
@@ -4580,11 +4557,11 @@ class kn extends Pn {
|
|
|
4580
4557
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
4581
4558
|
*/ function Cn(t, e, n) {
|
|
4582
4559
|
return new Sn({
|
|
4583
|
-
|
|
4584
|
-
|
|
4560
|
+
rt: 3 /* Argument */ ,
|
|
4561
|
+
ft: e.settings.ft,
|
|
4585
4562
|
methodName: t._methodName,
|
|
4586
|
-
|
|
4587
|
-
}, e.databaseId, e.
|
|
4563
|
+
ot: n
|
|
4564
|
+
}, e.databaseId, e.C, e.ignoreUndefinedProperties);
|
|
4588
4565
|
}
|
|
4589
4566
|
|
|
4590
4567
|
class Ln extends Pn {
|
|
@@ -4598,11 +4575,11 @@ class Ln extends Pn {
|
|
|
4598
4575
|
|
|
4599
4576
|
class Mn extends Pn {
|
|
4600
4577
|
constructor(t, e) {
|
|
4601
|
-
super(t), this.
|
|
4578
|
+
super(t), this.wt = e;
|
|
4602
4579
|
}
|
|
4603
4580
|
_toFieldTransform(t) {
|
|
4604
4581
|
const e = Cn(this, t,
|
|
4605
|
-
/*array=*/ !0), n = this.
|
|
4582
|
+
/*array=*/ !0), n = this.wt.map((t => Gn(t, e))), r = new Ie(n);
|
|
4606
4583
|
return new Pe(t.path, r);
|
|
4607
4584
|
}
|
|
4608
4585
|
isEqual(t) {
|
|
@@ -4613,11 +4590,11 @@ class Mn extends Pn {
|
|
|
4613
4590
|
|
|
4614
4591
|
class Un extends Pn {
|
|
4615
4592
|
constructor(t, e) {
|
|
4616
|
-
super(t), this.
|
|
4593
|
+
super(t), this.wt = e;
|
|
4617
4594
|
}
|
|
4618
4595
|
_toFieldTransform(t) {
|
|
4619
4596
|
const e = Cn(this, t,
|
|
4620
|
-
/*array=*/ !0), n = this.
|
|
4597
|
+
/*array=*/ !0), n = this.wt.map((t => Gn(t, e))), r = new Ae(n);
|
|
4621
4598
|
return new Pe(t.path, r);
|
|
4622
4599
|
}
|
|
4623
4600
|
isEqual(t) {
|
|
@@ -4628,10 +4605,10 @@ class Un extends Pn {
|
|
|
4628
4605
|
|
|
4629
4606
|
class jn extends Pn {
|
|
4630
4607
|
constructor(t, e) {
|
|
4631
|
-
super(t), this.
|
|
4608
|
+
super(t), this.yt = e;
|
|
4632
4609
|
}
|
|
4633
4610
|
_toFieldTransform(t) {
|
|
4634
|
-
const e = new Re(t.
|
|
4611
|
+
const e = new Re(t.C, be(t.C, this.yt));
|
|
4635
4612
|
return new Pe(t.path, e);
|
|
4636
4613
|
}
|
|
4637
4614
|
isEqual(t) {
|
|
@@ -4641,7 +4618,7 @@ class jn extends Pn {
|
|
|
4641
4618
|
}
|
|
4642
4619
|
|
|
4643
4620
|
/** Parse update data from an update() call. */ function Bn(t, e, n, r) {
|
|
4644
|
-
const s = t.
|
|
4621
|
+
const s = t.dt(1 /* Update */ , e, n);
|
|
4645
4622
|
Yn("Data must be an object, but it was:", s, r);
|
|
4646
4623
|
const i = [], o = Jt.empty();
|
|
4647
4624
|
Tt(r, ((t, r) => {
|
|
@@ -4649,7 +4626,7 @@ class jn extends Pn {
|
|
|
4649
4626
|
// For Compat types, we have to "extract" the underlying types before
|
|
4650
4627
|
// performing validation.
|
|
4651
4628
|
r = l(r);
|
|
4652
|
-
const c = s.
|
|
4629
|
+
const c = s.ct(u);
|
|
4653
4630
|
if (r instanceof kn)
|
|
4654
4631
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4655
4632
|
i.push(u); else {
|
|
@@ -4662,7 +4639,7 @@ class jn extends Pn {
|
|
|
4662
4639
|
}
|
|
4663
4640
|
|
|
4664
4641
|
/** Parse update data from a list of field/value arguments. */ function zn(t, e, n, r, s, i) {
|
|
4665
|
-
const o = t.
|
|
4642
|
+
const o = t.dt(1 /* Update */ , e, n), u = [ Hn(e, r, n) ], c = [ s ];
|
|
4666
4643
|
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
4644
|
for (let t = 0; t < i.length; t += 2) u.push(Hn(e, i[t])), c.push(i[t + 1]);
|
|
4668
4645
|
const a = [], h = Jt.empty();
|
|
@@ -4674,7 +4651,7 @@ class jn extends Pn {
|
|
|
4674
4651
|
// For Compat types, we have to "extract" the underlying types before
|
|
4675
4652
|
// performing validation.
|
|
4676
4653
|
n = l(n);
|
|
4677
|
-
const r = o.
|
|
4654
|
+
const r = o.ct(e);
|
|
4678
4655
|
if (n instanceof kn)
|
|
4679
4656
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4680
4657
|
a.push(e); else {
|
|
@@ -4693,7 +4670,7 @@ class jn extends Pn {
|
|
|
4693
4670
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
4694
4671
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
4695
4672
|
*/ function Wn(t, e, n, r = !1) {
|
|
4696
|
-
return Gn(n, t.
|
|
4673
|
+
return Gn(n, t.dt(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
|
|
4697
4674
|
}
|
|
4698
4675
|
|
|
4699
4676
|
/**
|
|
@@ -4721,8 +4698,8 @@ class jn extends Pn {
|
|
|
4721
4698
|
*/
|
|
4722
4699
|
return function(t, e) {
|
|
4723
4700
|
// Sentinels are only supported with writes, and not within arrays.
|
|
4724
|
-
if (!xn(e.
|
|
4725
|
-
if (!e.path) throw e.
|
|
4701
|
+
if (!xn(e.rt)) throw e.ht(`${t._methodName}() can only be used with update() and set()`);
|
|
4702
|
+
if (!e.path) throw e.ht(`${t._methodName}() is not currently supported inside arrays`);
|
|
4726
4703
|
const n = t._toFieldTransform(e);
|
|
4727
4704
|
n && e.fieldTransforms.push(n);
|
|
4728
4705
|
}
|
|
@@ -4746,12 +4723,12 @@ class jn extends Pn {
|
|
|
4746
4723
|
// the set of values to be included for the IN query) that may directly
|
|
4747
4724
|
// contain additional arrays (each representing an individual field
|
|
4748
4725
|
// value), so we disable this validation.
|
|
4749
|
-
if (e.settings.
|
|
4726
|
+
if (e.settings.ot && 4 /* ArrayArgument */ !== e.rt) throw e.ht("Nested arrays are not supported");
|
|
4750
4727
|
return function(t, e) {
|
|
4751
4728
|
const n = [];
|
|
4752
4729
|
let r = 0;
|
|
4753
4730
|
for (const s of t) {
|
|
4754
|
-
let t = Gn(s, e.
|
|
4731
|
+
let t = Gn(s, e.at(r));
|
|
4755
4732
|
null == t && (
|
|
4756
4733
|
// Just include nulls in the array for fields being replaced with a
|
|
4757
4734
|
// sentinel.
|
|
@@ -4770,7 +4747,7 @@ class jn extends Pn {
|
|
|
4770
4747
|
if (null === (t = l(t))) return {
|
|
4771
4748
|
nullValue: "NULL_VALUE"
|
|
4772
4749
|
};
|
|
4773
|
-
if ("number" == typeof t) return be(e.
|
|
4750
|
+
if ("number" == typeof t) return be(e.C, t);
|
|
4774
4751
|
if ("boolean" == typeof t) return {
|
|
4775
4752
|
booleanValue: t
|
|
4776
4753
|
};
|
|
@@ -4780,7 +4757,7 @@ class jn extends Pn {
|
|
|
4780
4757
|
if (t instanceof Date) {
|
|
4781
4758
|
const n = vt.fromDate(t);
|
|
4782
4759
|
return {
|
|
4783
|
-
timestampValue: ke(e.
|
|
4760
|
+
timestampValue: ke(e.C, n)
|
|
4784
4761
|
};
|
|
4785
4762
|
}
|
|
4786
4763
|
if (t instanceof vt) {
|
|
@@ -4789,7 +4766,7 @@ class jn extends Pn {
|
|
|
4789
4766
|
// truncation immediately without waiting for the backend to do that.
|
|
4790
4767
|
const n = new vt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
4791
4768
|
return {
|
|
4792
|
-
timestampValue: ke(e.
|
|
4769
|
+
timestampValue: ke(e.C, n)
|
|
4793
4770
|
};
|
|
4794
4771
|
}
|
|
4795
4772
|
if (t instanceof Vn) return {
|
|
@@ -4799,16 +4776,16 @@ class jn extends Pn {
|
|
|
4799
4776
|
}
|
|
4800
4777
|
};
|
|
4801
4778
|
if (t instanceof Rn) return {
|
|
4802
|
-
bytesValue: Ce(e.
|
|
4779
|
+
bytesValue: Ce(e.C, t._byteString)
|
|
4803
4780
|
};
|
|
4804
4781
|
if (t instanceof pn) {
|
|
4805
4782
|
const n = e.databaseId, r = t.firestore._databaseId;
|
|
4806
|
-
if (!r.isEqual(n)) throw e.
|
|
4783
|
+
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
4784
|
return {
|
|
4808
4785
|
referenceValue: Ue(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
4809
4786
|
};
|
|
4810
4787
|
}
|
|
4811
|
-
throw e.
|
|
4788
|
+
throw e.ht(`Unsupported field value: ${ot(t)}`);
|
|
4812
4789
|
}
|
|
4813
4790
|
/**
|
|
4814
4791
|
* Checks whether an object looks like a JSON object that should be converted
|
|
@@ -4825,7 +4802,7 @@ function Kn(t, e) {
|
|
|
4825
4802
|
for (const e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
|
|
4826
4803
|
return !0;
|
|
4827
4804
|
}(t) ? Tt(t, ((t, r) => {
|
|
4828
|
-
const s = Gn(r, e.
|
|
4805
|
+
const s = Gn(r, e.it(t));
|
|
4829
4806
|
null != s && (n[t] = s);
|
|
4830
4807
|
})) :
|
|
4831
4808
|
// If we encounter an empty object, we explicitly add it to the update
|
|
@@ -4846,7 +4823,7 @@ function Yn(t, e, n) {
|
|
|
4846
4823
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
4847
4824
|
}(n)) {
|
|
4848
4825
|
const r = ot(n);
|
|
4849
|
-
throw "an object" === r ? e.
|
|
4826
|
+
throw "an object" === r ? e.ht(t + " a custom object") : e.ht(t + " " + r);
|
|
4850
4827
|
}
|
|
4851
4828
|
}
|
|
4852
4829
|
|
|
@@ -5097,7 +5074,7 @@ class or {}
|
|
|
5097
5074
|
|
|
5098
5075
|
class cr extends or {
|
|
5099
5076
|
constructor(t, e, n) {
|
|
5100
|
-
super(), this.
|
|
5077
|
+
super(), this._t = t, this.gt = e, this.vt = n, this.type = "where";
|
|
5101
5078
|
}
|
|
5102
5079
|
_apply(t) {
|
|
5103
5080
|
const e = qn(t.firestore), n = function(t, e, n, r, s, i, o) {
|
|
@@ -5119,7 +5096,7 @@ class cr extends or {
|
|
|
5119
5096
|
/* allowArrays= */ "in" /* IN */ === i || "not-in" /* NOT_IN */ === i);
|
|
5120
5097
|
const c = ee.create(s, i, u);
|
|
5121
5098
|
return function(t, e) {
|
|
5122
|
-
if (e
|
|
5099
|
+
if (e.F()) {
|
|
5123
5100
|
const n = pe(t);
|
|
5124
5101
|
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
5102
|
const r = me(t);
|
|
@@ -5166,7 +5143,7 @@ class cr extends or {
|
|
|
5166
5143
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
5167
5144
|
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
5145
|
}(t, c), c;
|
|
5169
|
-
}(t._query, "where", e, t.firestore._databaseId, this.
|
|
5146
|
+
}(t._query, "where", e, t.firestore._databaseId, this._t, this.gt, this.vt);
|
|
5170
5147
|
return new yn(t.firestore, t.converter, function(t, e) {
|
|
5171
5148
|
const n = t.filters.concat([ e ]);
|
|
5172
5149
|
return new we(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
@@ -5191,7 +5168,7 @@ class cr extends or {
|
|
|
5191
5168
|
|
|
5192
5169
|
class hr extends or {
|
|
5193
5170
|
constructor(t, e) {
|
|
5194
|
-
super(), this.
|
|
5171
|
+
super(), this._t = t, this.bt = e, this.type = "orderBy";
|
|
5195
5172
|
}
|
|
5196
5173
|
_apply(t) {
|
|
5197
5174
|
const e = function(t, e, n) {
|
|
@@ -5216,7 +5193,7 @@ class hr extends or {
|
|
|
5216
5193
|
* Will throw if the document does not contain all fields of the order by
|
|
5217
5194
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
5218
5195
|
* server timestamp.
|
|
5219
|
-
*/ (t._query, this.
|
|
5196
|
+
*/ (t._query, this._t, this.bt);
|
|
5220
5197
|
return new yn(t.firestore, t.converter, function(t, e) {
|
|
5221
5198
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
5222
5199
|
const n = t.explicitOrderBy.concat([ e ]);
|
|
@@ -5240,12 +5217,12 @@ class hr extends or {
|
|
|
5240
5217
|
|
|
5241
5218
|
class fr extends or {
|
|
5242
5219
|
constructor(t, e, n) {
|
|
5243
|
-
super(), this.type = t, this.
|
|
5220
|
+
super(), this.type = t, this.Et = e, this.Tt = n;
|
|
5244
5221
|
}
|
|
5245
5222
|
_apply(t) {
|
|
5246
5223
|
return new yn(t.firestore, t.converter, function(t, e, n) {
|
|
5247
5224
|
return new we(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
5248
|
-
}(t._query, this.
|
|
5225
|
+
}(t._query, this.Et, this.Tt));
|
|
5249
5226
|
}
|
|
5250
5227
|
}
|
|
5251
5228
|
|
|
@@ -5272,10 +5249,10 @@ class fr extends or {
|
|
|
5272
5249
|
|
|
5273
5250
|
class mr extends or {
|
|
5274
5251
|
constructor(t, e, n) {
|
|
5275
|
-
super(), this.type = t, this.
|
|
5252
|
+
super(), this.type = t, this.It = e, this.At = n;
|
|
5276
5253
|
}
|
|
5277
5254
|
_apply(t) {
|
|
5278
|
-
const e = br(t, this.type, this.
|
|
5255
|
+
const e = br(t, this.type, this.It, this.At);
|
|
5279
5256
|
return new yn(t.firestore, t.converter, function(t, e) {
|
|
5280
5257
|
return new we(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
5281
5258
|
}(t._query, e));
|
|
@@ -5294,10 +5271,10 @@ function yr(...t) {
|
|
|
5294
5271
|
|
|
5295
5272
|
class _r extends or {
|
|
5296
5273
|
constructor(t, e, n) {
|
|
5297
|
-
super(), this.type = t, this.
|
|
5274
|
+
super(), this.type = t, this.It = e, this.At = n;
|
|
5298
5275
|
}
|
|
5299
5276
|
_apply(t) {
|
|
5300
|
-
const e = br(t, this.type, this.
|
|
5277
|
+
const e = br(t, this.type, this.It, this.At);
|
|
5301
5278
|
return new yn(t.firestore, t.converter, function(t, e) {
|
|
5302
5279
|
return new we(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
5303
5280
|
}(t._query, e));
|
|
@@ -5888,7 +5865,7 @@ function Lr(t, e) {
|
|
|
5888
5865
|
let e;
|
|
5889
5866
|
if (t.isFoundDocument()) e = t.version; else {
|
|
5890
5867
|
if (!t.isNoDocument()) throw v();
|
|
5891
|
-
//
|
|
5868
|
+
// Represent a deleted doc using SnapshotVersion.min().
|
|
5892
5869
|
e = bt.min();
|
|
5893
5870
|
}
|
|
5894
5871
|
const n = this.readVersions.get(t.key.toString());
|
|
@@ -5903,7 +5880,7 @@ function Lr(t, e) {
|
|
|
5903
5880
|
* as a precondition, or no precondition if it was not read.
|
|
5904
5881
|
*/ precondition(t) {
|
|
5905
5882
|
const e = this.readVersions.get(t.toString());
|
|
5906
|
-
return !this.writtenDocs.has(t.toString()) && e ? Ve.updateTime(e) : Ve.none();
|
|
5883
|
+
return !this.writtenDocs.has(t.toString()) && e ? e.isEqual(bt.min()) ? Ve.exists(!1) : Ve.updateTime(e) : Ve.none();
|
|
5907
5884
|
}
|
|
5908
5885
|
/**
|
|
5909
5886
|
* Returns the precondition for a document if the operation is an update.
|
|
@@ -5978,26 +5955,26 @@ function Lr(t, e) {
|
|
|
5978
5955
|
class Br {
|
|
5979
5956
|
constructor(t, e, n, r, s) {
|
|
5980
5957
|
this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = r,
|
|
5981
|
-
this.deferred = s, this.
|
|
5958
|
+
this.deferred = s, this.Rt = n.maxAttempts, this.Pt = new nn(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
5982
5959
|
}
|
|
5983
5960
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
5984
|
-
this.
|
|
5961
|
+
this.Rt -= 1, this.Vt();
|
|
5985
5962
|
}
|
|
5986
|
-
|
|
5987
|
-
this.
|
|
5988
|
-
const t = new Ur(this.datastore), e = this.
|
|
5963
|
+
Vt() {
|
|
5964
|
+
this.Pt.H((async () => {
|
|
5965
|
+
const t = new Ur(this.datastore), e = this.Nt(t);
|
|
5989
5966
|
e && e.then((e => {
|
|
5990
5967
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
5991
5968
|
this.deferred.resolve(e);
|
|
5992
5969
|
})).catch((t => {
|
|
5993
|
-
this
|
|
5970
|
+
this.$t(t);
|
|
5994
5971
|
}))));
|
|
5995
5972
|
})).catch((t => {
|
|
5996
|
-
this
|
|
5973
|
+
this.$t(t);
|
|
5997
5974
|
}));
|
|
5998
5975
|
}));
|
|
5999
5976
|
}
|
|
6000
|
-
|
|
5977
|
+
Nt(t) {
|
|
6001
5978
|
try {
|
|
6002
5979
|
const e = this.updateFunction(t);
|
|
6003
5980
|
return !at(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
|
|
@@ -6007,11 +5984,11 @@ class Br {
|
|
|
6007
5984
|
return this.deferred.reject(t), null;
|
|
6008
5985
|
}
|
|
6009
5986
|
}
|
|
6010
|
-
|
|
6011
|
-
this.
|
|
5987
|
+
$t(t) {
|
|
5988
|
+
this.Rt > 0 && this.Dt(t) ? (this.Rt -= 1, this.asyncQueue.enqueueAndForget((() => (this.Vt(),
|
|
6012
5989
|
Promise.resolve())))) : this.deferred.reject(t);
|
|
6013
5990
|
}
|
|
6014
|
-
|
|
5991
|
+
Dt(t) {
|
|
6015
5992
|
if ("FirebaseError" === t.name) {
|
|
6016
5993
|
// In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and
|
|
6017
5994
|
// non-matching document versions with ABORTED. These errors should be retried.
|
|
@@ -6182,39 +6159,39 @@ class Br {
|
|
|
6182
6159
|
*/ class Gr {
|
|
6183
6160
|
constructor() {
|
|
6184
6161
|
// The last promise in the queue.
|
|
6185
|
-
this.
|
|
6162
|
+
this.xt = Promise.resolve(),
|
|
6186
6163
|
// A list of retryable operations. Retryable operations are run in order and
|
|
6187
6164
|
// retried with backoff.
|
|
6188
|
-
this
|
|
6165
|
+
this.St = [],
|
|
6189
6166
|
// Is this AsyncQueue being shut down? Once it is set to true, it will not
|
|
6190
6167
|
// be changed again.
|
|
6191
|
-
this.
|
|
6168
|
+
this.Ft = !1,
|
|
6192
6169
|
// Operations scheduled to be queued in the future. Operations are
|
|
6193
6170
|
// automatically removed after they are run or canceled.
|
|
6194
|
-
this.
|
|
6171
|
+
this.qt = [],
|
|
6195
6172
|
// visible for testing
|
|
6196
|
-
this.
|
|
6173
|
+
this.Ot = null,
|
|
6197
6174
|
// Flag set while there's an outstanding AsyncQueue operation, used for
|
|
6198
6175
|
// assertion sanity-checks.
|
|
6199
|
-
this.
|
|
6176
|
+
this.kt = !1,
|
|
6200
6177
|
// Enabled during shutdown on Safari to prevent future access to IndexedDB.
|
|
6201
|
-
this.
|
|
6178
|
+
this.Ct = !1,
|
|
6202
6179
|
// List of TimerIds to fast-forward delays for.
|
|
6203
|
-
this.
|
|
6180
|
+
this.Lt = [],
|
|
6204
6181
|
// Backoff timer used to schedule retries for retryable operations
|
|
6205
|
-
this.
|
|
6182
|
+
this.Pt = new nn(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
6206
6183
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
6207
6184
|
// operations. Meant to speed up recovery when we regain file system access
|
|
6208
6185
|
// after page comes into foreground.
|
|
6209
|
-
this.
|
|
6186
|
+
this.Mt = () => {
|
|
6210
6187
|
const t = zr();
|
|
6211
|
-
t && p("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.
|
|
6188
|
+
t && p("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.Pt.X();
|
|
6212
6189
|
};
|
|
6213
6190
|
const t = zr();
|
|
6214
|
-
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.
|
|
6191
|
+
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Mt);
|
|
6215
6192
|
}
|
|
6216
6193
|
get isShuttingDown() {
|
|
6217
|
-
return this.
|
|
6194
|
+
return this.Ft;
|
|
6218
6195
|
}
|
|
6219
6196
|
/**
|
|
6220
6197
|
* Adds a new operation to the queue without waiting for it to complete (i.e.
|
|
@@ -6224,38 +6201,38 @@ class Br {
|
|
|
6224
6201
|
this.enqueue(t);
|
|
6225
6202
|
}
|
|
6226
6203
|
enqueueAndForgetEvenWhileRestricted(t) {
|
|
6227
|
-
this.
|
|
6204
|
+
this.Ut(),
|
|
6228
6205
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
6229
|
-
this.
|
|
6206
|
+
this.jt(t);
|
|
6230
6207
|
}
|
|
6231
6208
|
enterRestrictedMode(t) {
|
|
6232
|
-
if (!this.
|
|
6233
|
-
this.
|
|
6209
|
+
if (!this.Ft) {
|
|
6210
|
+
this.Ft = !0, this.Ct = t || !1;
|
|
6234
6211
|
const e = zr();
|
|
6235
|
-
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.
|
|
6212
|
+
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Mt);
|
|
6236
6213
|
}
|
|
6237
6214
|
}
|
|
6238
6215
|
enqueue(t) {
|
|
6239
|
-
if (this.
|
|
6216
|
+
if (this.Ut(), this.Ft)
|
|
6240
6217
|
// Return a Promise which never resolves.
|
|
6241
6218
|
return new Promise((() => {}));
|
|
6242
6219
|
// Create a deferred Promise that we can return to the callee. This
|
|
6243
6220
|
// allows us to return a "hanging Promise" only to the callee and still
|
|
6244
6221
|
// advance the queue even when the operation is not run.
|
|
6245
6222
|
const e = new U;
|
|
6246
|
-
return this.
|
|
6223
|
+
return this.jt((() => this.Ft && this.Ct ? Promise.resolve() : (t().then(e.resolve, e.reject),
|
|
6247
6224
|
e.promise))).then((() => e.promise));
|
|
6248
6225
|
}
|
|
6249
6226
|
enqueueRetryable(t) {
|
|
6250
|
-
this.enqueueAndForget((() => (this
|
|
6227
|
+
this.enqueueAndForget((() => (this.St.push(t), this.Bt())));
|
|
6251
6228
|
}
|
|
6252
6229
|
/**
|
|
6253
6230
|
* Runs the next operation from the retryable queue. If the operation fails,
|
|
6254
6231
|
* reschedules with backoff.
|
|
6255
|
-
*/ async
|
|
6256
|
-
if (0 !== this
|
|
6232
|
+
*/ async Bt() {
|
|
6233
|
+
if (0 !== this.St.length) {
|
|
6257
6234
|
try {
|
|
6258
|
-
await this
|
|
6235
|
+
await this.St[0](), this.St.shift(), this.Pt.reset();
|
|
6259
6236
|
} catch (t) {
|
|
6260
6237
|
if (!
|
|
6261
6238
|
/**
|
|
@@ -6299,7 +6276,7 @@ class Br {
|
|
|
6299
6276
|
// Failure will be handled by AsyncQueue
|
|
6300
6277
|
p("AsyncQueue", "Operation failed with retryable error: " + t);
|
|
6301
6278
|
}
|
|
6302
|
-
this
|
|
6279
|
+
this.St.length > 0 &&
|
|
6303
6280
|
// If there are additional operations, we re-schedule `retryNextOp()`.
|
|
6304
6281
|
// This is necessary to run retryable operations that failed during
|
|
6305
6282
|
// their initial attempt since we don't know whether they are already
|
|
@@ -6310,12 +6287,12 @@ class Br {
|
|
|
6310
6287
|
// Since `backoffAndRun()` cancels an existing backoff and schedules a
|
|
6311
6288
|
// new backoff on every call, there is only ever a single additional
|
|
6312
6289
|
// operation in the queue.
|
|
6313
|
-
this.
|
|
6290
|
+
this.Pt.H((() => this.Bt()));
|
|
6314
6291
|
}
|
|
6315
6292
|
}
|
|
6316
|
-
|
|
6317
|
-
const e = this.
|
|
6318
|
-
this.
|
|
6293
|
+
jt(t) {
|
|
6294
|
+
const e = this.xt.then((() => (this.kt = !0, t().catch((t => {
|
|
6295
|
+
this.Ot = t, this.kt = !1;
|
|
6319
6296
|
const e =
|
|
6320
6297
|
/**
|
|
6321
6298
|
* Chrome includes Error.message in Error.stack. Other browsers do not.
|
|
@@ -6356,38 +6333,38 @@ class Br {
|
|
|
6356
6333
|
// all further attempts to chain (via .then) will just short-circuit
|
|
6357
6334
|
// and return the rejected Promise.
|
|
6358
6335
|
throw y("INTERNAL UNHANDLED ERROR: ", e), t;
|
|
6359
|
-
})).then((t => (this.
|
|
6360
|
-
return this.
|
|
6336
|
+
})).then((t => (this.kt = !1, t))))));
|
|
6337
|
+
return this.xt = e, e;
|
|
6361
6338
|
}
|
|
6362
6339
|
enqueueAfterDelay(t, e, n) {
|
|
6363
|
-
this.
|
|
6340
|
+
this.Ut(),
|
|
6364
6341
|
// 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.
|
|
6342
|
+
this.Lt.indexOf(t) > -1 && (e = 0);
|
|
6343
|
+
const r = Wr.createAndSchedule(this, t, e, n, (t => this.zt(t)));
|
|
6344
|
+
return this.qt.push(r), r;
|
|
6368
6345
|
}
|
|
6369
|
-
|
|
6370
|
-
this.
|
|
6346
|
+
Ut() {
|
|
6347
|
+
this.Ot && v();
|
|
6371
6348
|
}
|
|
6372
6349
|
verifyOperationInProgress() {}
|
|
6373
6350
|
/**
|
|
6374
6351
|
* Waits until all currently queued tasks are finished executing. Delayed
|
|
6375
6352
|
* operations are not run.
|
|
6376
|
-
*/ async
|
|
6353
|
+
*/ async Wt() {
|
|
6377
6354
|
// Operations in the queue prior to draining may have enqueued additional
|
|
6378
6355
|
// operations. Keep draining the queue until the tail is no longer advanced,
|
|
6379
6356
|
// which indicates that no more new operations were enqueued and that all
|
|
6380
6357
|
// operations were executed.
|
|
6381
6358
|
let t;
|
|
6382
6359
|
do {
|
|
6383
|
-
t = this.
|
|
6384
|
-
} while (t !== this.
|
|
6360
|
+
t = this.xt, await t;
|
|
6361
|
+
} while (t !== this.xt);
|
|
6385
6362
|
}
|
|
6386
6363
|
/**
|
|
6387
6364
|
* For Tests: Determine if a delayed operation with a particular TimerId
|
|
6388
6365
|
* exists.
|
|
6389
|
-
*/
|
|
6390
|
-
for (const e of this.
|
|
6366
|
+
*/ Gt(t) {
|
|
6367
|
+
for (const e of this.qt) if (e.timerId === t) return !0;
|
|
6391
6368
|
return !1;
|
|
6392
6369
|
}
|
|
6393
6370
|
/**
|
|
@@ -6396,24 +6373,24 @@ class Br {
|
|
|
6396
6373
|
* @param lastTimerId - Delayed operations up to and including this TimerId
|
|
6397
6374
|
* will be drained. Pass TimerId.All to run all delayed operations.
|
|
6398
6375
|
* @returns a Promise that resolves once all operations have been run.
|
|
6399
|
-
*/
|
|
6376
|
+
*/ Kt(t) {
|
|
6400
6377
|
// Note that draining may generate more delayed ops, so we do that first.
|
|
6401
|
-
return this.
|
|
6378
|
+
return this.Wt().then((() => {
|
|
6402
6379
|
// Run ops in the same order they'd run if they ran naturally.
|
|
6403
|
-
this.
|
|
6404
|
-
for (const e of this.
|
|
6405
|
-
return this.
|
|
6380
|
+
this.qt.sort(((t, e) => t.targetTimeMs - e.targetTimeMs));
|
|
6381
|
+
for (const e of this.qt) if (e.skipDelay(), "all" /* All */ !== t && e.timerId === t) break;
|
|
6382
|
+
return this.Wt();
|
|
6406
6383
|
}));
|
|
6407
6384
|
}
|
|
6408
6385
|
/**
|
|
6409
6386
|
* For Tests: Skip all subsequent delays for a timer id.
|
|
6410
|
-
*/
|
|
6411
|
-
this.
|
|
6387
|
+
*/ Qt(t) {
|
|
6388
|
+
this.Lt.push(t);
|
|
6412
6389
|
}
|
|
6413
|
-
/** Called once a DelayedOperation is run or canceled. */
|
|
6390
|
+
/** Called once a DelayedOperation is run or canceled. */ zt(t) {
|
|
6414
6391
|
// NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
|
|
6415
|
-
const e = this.
|
|
6416
|
-
this.
|
|
6392
|
+
const e = this.qt.indexOf(t);
|
|
6393
|
+
this.qt.splice(e, 1);
|
|
6417
6394
|
}
|
|
6418
6395
|
}
|
|
6419
6396
|
|
|
@@ -6496,12 +6473,31 @@ class Kr {
|
|
|
6496
6473
|
* @packageDocumentation
|
|
6497
6474
|
*/ !function(t) {
|
|
6498
6475
|
d = t;
|
|
6499
|
-
}(`${s}_lite`), n(new i("firestore/lite", ((t, {options:
|
|
6500
|
-
const
|
|
6501
|
-
|
|
6502
|
-
|
|
6476
|
+
}(`${s}_lite`), n(new i("firestore/lite", ((t, {instanceIdentifier: e, options: n}) => {
|
|
6477
|
+
const r = t.getProvider("app").getImmediate(), s = new ln(new W(t.getProvider("auth-internal")), new Y(t.getProvider("app-check-internal")), function(t, e) {
|
|
6478
|
+
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new M(R, '"projectId" not provided in firebase.initializeApp.');
|
|
6479
|
+
return new J(t.options.projectId, e);
|
|
6480
|
+
}
|
|
6481
|
+
/**
|
|
6482
|
+
* @license
|
|
6483
|
+
* Copyright 2017 Google LLC
|
|
6484
|
+
*
|
|
6485
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6486
|
+
* you may not use this file except in compliance with the License.
|
|
6487
|
+
* You may obtain a copy of the License at
|
|
6488
|
+
*
|
|
6489
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
6490
|
+
*
|
|
6491
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
6492
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
6493
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6494
|
+
* See the License for the specific language governing permissions and
|
|
6495
|
+
* limitations under the License.
|
|
6496
|
+
*/ (r, e), r);
|
|
6497
|
+
return n && s._setSettings(n), s;
|
|
6498
|
+
}), "PUBLIC").setMultipleInstances(!0)),
|
|
6503
6499
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
6504
|
-
r("firestore-lite", "3.4.
|
|
6500
|
+
r("firestore-lite", "3.4.14-canary.04dcdbb0f", "rn"), r("firestore-lite", "3.4.14-canary.04dcdbb0f", "esm2017");
|
|
6505
6501
|
|
|
6506
6502
|
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
6503
|
//# sourceMappingURL=index.rn.esm2017.js.map
|