@firebase/firestore 3.7.1 → 3.7.2-canary.457fc2eeb
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 +12 -0
- package/dist/index.esm2017.js +249 -243
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +637 -633
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +38 -36
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +5 -3
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +249 -243
- package/dist/index.rn.js.map +1 -1
- package/dist/lite/index.browser.esm2017.js +186 -180
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +350 -344
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +10 -3
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +10 -3
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +192 -186
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +26 -26
- package/dist/packages/firestore/dist/index.esm2017.d.ts +1 -1
- package/package.json +11 -11
- package/dist/firestore/test/integration/api_internal/aggregation.test.d.ts +0 -17
- package/dist/lite/firestore/test/integration/api_internal/aggregation.test.d.ts +0 -17
- package/dist/lite/packages/firestore/test/integration/api_internal/aggregation.test.d.ts +0 -17
- package/dist/packages/firestore/test/integration/api_internal/aggregation.test.d.ts +0 -17
|
@@ -63,7 +63,7 @@ d.MOCK_USER = new d("mock-user");
|
|
|
63
63
|
* See the License for the specific language governing permissions and
|
|
64
64
|
* limitations under the License.
|
|
65
65
|
*/
|
|
66
|
-
let w = "9.
|
|
66
|
+
let w = "9.13.0-canary.457fc2eeb";
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* @license
|
|
@@ -218,7 +218,7 @@ e) {
|
|
|
218
218
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
219
219
|
* See the License for the specific language governing permissions and
|
|
220
220
|
* limitations under the License.
|
|
221
|
-
*/ const T = "ok", A = "cancelled", R = "unknown", P = "invalid-argument", V = "deadline-exceeded", N = "not-found",
|
|
221
|
+
*/ const T = "ok", A = "cancelled", R = "unknown", P = "invalid-argument", V = "deadline-exceeded", N = "not-found", $ = "already-exists", D = "permission-denied", x = "unauthenticated", F = "resource-exhausted", S = "failed-precondition", q = "aborted", O = "out-of-range", k = "unimplemented", C = "internal", L = "unavailable", M = "data-loss";
|
|
222
222
|
|
|
223
223
|
/** An error returned by a Firestore operation. */ class U extends FirebaseError {
|
|
224
224
|
/** @hideconstructor */
|
|
@@ -921,7 +921,7 @@ function mt(t) {
|
|
|
921
921
|
|
|
922
922
|
case 403:
|
|
923
923
|
// Forbidden
|
|
924
|
-
return
|
|
924
|
+
return D;
|
|
925
925
|
|
|
926
926
|
case 404:
|
|
927
927
|
// Not Found
|
|
@@ -1056,19 +1056,25 @@ class {
|
|
|
1056
1056
|
throw new Error("Not supported by FetchConnection");
|
|
1057
1057
|
}
|
|
1058
1058
|
async R(t, e, n, r) {
|
|
1059
|
-
|
|
1060
|
-
|
|
1059
|
+
var s;
|
|
1060
|
+
const i = JSON.stringify(r);
|
|
1061
|
+
let o;
|
|
1061
1062
|
try {
|
|
1062
|
-
|
|
1063
|
+
o = await this.V(e, {
|
|
1063
1064
|
method: "POST",
|
|
1064
1065
|
headers: n,
|
|
1065
|
-
body:
|
|
1066
|
+
body: i
|
|
1066
1067
|
});
|
|
1067
1068
|
} catch (t) {
|
|
1068
1069
|
throw new U(mt(t.status), "Request failed with error: " + t.statusText);
|
|
1069
1070
|
}
|
|
1070
|
-
if (!
|
|
1071
|
-
|
|
1071
|
+
if (!o.ok) {
|
|
1072
|
+
let t = await o.json();
|
|
1073
|
+
Array.isArray(t) && (t = t[0]);
|
|
1074
|
+
const e = null === (s = null == t ? void 0 : t.error) || void 0 === s ? void 0 : s.message;
|
|
1075
|
+
throw new U(mt(o.status), `Request failed with error: ${null != e ? e : o.statusText}`);
|
|
1076
|
+
}
|
|
1077
|
+
return o.json();
|
|
1072
1078
|
}
|
|
1073
1079
|
}
|
|
1074
1080
|
|
|
@@ -1137,7 +1143,7 @@ function yt(t) {
|
|
|
1137
1143
|
* See the License for the specific language governing permissions and
|
|
1138
1144
|
* limitations under the License.
|
|
1139
1145
|
*/ class _t {
|
|
1140
|
-
static
|
|
1146
|
+
static $() {
|
|
1141
1147
|
// Alphanumeric characters
|
|
1142
1148
|
const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = Math.floor(256 / t.length) * t.length;
|
|
1143
1149
|
// The largest byte value that is a multiple of `char.length`.
|
|
@@ -1859,7 +1865,7 @@ class Nt {
|
|
|
1859
1865
|
* foo.bar - Overwrites only the field bar of the object foo.
|
|
1860
1866
|
* If foo is not an object, foo is replaced with an object
|
|
1861
1867
|
* containing foo
|
|
1862
|
-
*/ class
|
|
1868
|
+
*/ class $t {
|
|
1863
1869
|
constructor(t) {
|
|
1864
1870
|
this.fields = t,
|
|
1865
1871
|
// TODO(dimond): validation of FieldMask
|
|
@@ -1867,7 +1873,7 @@ class Nt {
|
|
|
1867
1873
|
t.sort(nt.comparator);
|
|
1868
1874
|
}
|
|
1869
1875
|
static empty() {
|
|
1870
|
-
return new
|
|
1876
|
+
return new $t([]);
|
|
1871
1877
|
}
|
|
1872
1878
|
/**
|
|
1873
1879
|
* Returns a new FieldMask object that is the result of adding all the given
|
|
@@ -1876,7 +1882,7 @@ class Nt {
|
|
|
1876
1882
|
let e = new Vt(nt.comparator);
|
|
1877
1883
|
for (const t of this.fields) e = e.add(t);
|
|
1878
1884
|
for (const n of t) e = e.add(n);
|
|
1879
|
-
return new
|
|
1885
|
+
return new $t(e.toArray());
|
|
1880
1886
|
}
|
|
1881
1887
|
/**
|
|
1882
1888
|
* Verifies that `fieldPath` is included by at least one field in this field
|
|
@@ -1934,13 +1940,13 @@ class Nt {
|
|
|
1934
1940
|
* before being sent as a proto.
|
|
1935
1941
|
* @internal
|
|
1936
1942
|
*/
|
|
1937
|
-
class
|
|
1943
|
+
class Dt {
|
|
1938
1944
|
constructor(t) {
|
|
1939
1945
|
this.binaryString = t;
|
|
1940
1946
|
}
|
|
1941
1947
|
static fromBase64String(t) {
|
|
1942
1948
|
const e = atob(t);
|
|
1943
|
-
return new
|
|
1949
|
+
return new Dt(e);
|
|
1944
1950
|
}
|
|
1945
1951
|
static fromUint8Array(t) {
|
|
1946
1952
|
// TODO(indexing); Remove the copy of the byte string here as this method
|
|
@@ -1957,7 +1963,7 @@ class $t {
|
|
|
1957
1963
|
/**
|
|
1958
1964
|
* Helper function to convert a binary string to an Uint8Array.
|
|
1959
1965
|
*/ (t);
|
|
1960
|
-
return new
|
|
1966
|
+
return new Dt(e);
|
|
1961
1967
|
}
|
|
1962
1968
|
[Symbol.iterator]() {
|
|
1963
1969
|
let t = 0;
|
|
@@ -2012,7 +2018,7 @@ class $t {
|
|
|
2012
2018
|
}
|
|
2013
2019
|
}
|
|
2014
2020
|
|
|
2015
|
-
|
|
2021
|
+
Dt.EMPTY_BYTE_STRING = new Dt("");
|
|
2016
2022
|
|
|
2017
2023
|
const xt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
2018
2024
|
|
|
@@ -2056,7 +2062,7 @@ const xt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
2056
2062
|
}
|
|
2057
2063
|
|
|
2058
2064
|
/** Converts the possible Proto types for Blobs into a ByteString. */ function qt(t) {
|
|
2059
|
-
return "string" == typeof t ?
|
|
2065
|
+
return "string" == typeof t ? Dt.fromBase64String(t) : Dt.fromUint8Array(t);
|
|
2060
2066
|
}
|
|
2061
2067
|
|
|
2062
2068
|
/**
|
|
@@ -2606,7 +2612,7 @@ class Jt {
|
|
|
2606
2612
|
class Zt {
|
|
2607
2613
|
constructor(t, e = null, n = [], r = [], s = null, i = null, o = null) {
|
|
2608
2614
|
this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = s,
|
|
2609
|
-
this.startAt = i, this.endAt = o, this
|
|
2615
|
+
this.startAt = i, this.endAt = o, this.D = null;
|
|
2610
2616
|
}
|
|
2611
2617
|
}
|
|
2612
2618
|
|
|
@@ -3099,7 +3105,7 @@ function be(t, e) {
|
|
|
3099
3105
|
/**
|
|
3100
3106
|
* A mutation that creates or replaces the document at the given key with the
|
|
3101
3107
|
* object value contents.
|
|
3102
|
-
*/ class
|
|
3108
|
+
*/ class $e extends Ne {
|
|
3103
3109
|
constructor(t, e, n, r = []) {
|
|
3104
3110
|
super(), this.key = t, this.value = e, this.precondition = n, this.fieldTransforms = r,
|
|
3105
3111
|
this.type = 0 /* Set */;
|
|
@@ -3121,7 +3127,7 @@ function be(t, e) {
|
|
|
3121
3127
|
* is deleted.
|
|
3122
3128
|
* * When a field is not in the mask but is in the values, the values map is
|
|
3123
3129
|
* ignored.
|
|
3124
|
-
*/ class
|
|
3130
|
+
*/ class De extends Ne {
|
|
3125
3131
|
constructor(t, e, n, r, s = []) {
|
|
3126
3132
|
super(), this.key = t, this.data = e, this.fieldMask = n, this.precondition = r,
|
|
3127
3133
|
this.fieldTransforms = s, this.type = 1 /* Patch */;
|
|
@@ -3307,11 +3313,11 @@ function We(t, e) {
|
|
|
3307
3313
|
|
|
3308
3314
|
function Ke(t, e) {
|
|
3309
3315
|
let n;
|
|
3310
|
-
if (e instanceof
|
|
3316
|
+
if (e instanceof $e) n = {
|
|
3311
3317
|
update: Ge(t, e.key, e.value)
|
|
3312
3318
|
}; else if (e instanceof xe) n = {
|
|
3313
3319
|
delete: je(t, e.key)
|
|
3314
|
-
}; else if (e instanceof
|
|
3320
|
+
}; else if (e instanceof De) n = {
|
|
3315
3321
|
update: Ge(t, e.key, e.data),
|
|
3316
3322
|
updateMask: Ze(e.fieldMask)
|
|
3317
3323
|
}; else {
|
|
@@ -3614,26 +3620,26 @@ class nn {
|
|
|
3614
3620
|
*/
|
|
3615
3621
|
class rn extends class {} {
|
|
3616
3622
|
constructor(t, e, n, r) {
|
|
3617
|
-
super(), this.authCredentials = t, this.appCheckCredentials = e, this.
|
|
3618
|
-
this.
|
|
3623
|
+
super(), this.authCredentials = t, this.appCheckCredentials = e, this.connection = n,
|
|
3624
|
+
this.L = r, this.tt = !1;
|
|
3619
3625
|
}
|
|
3620
|
-
|
|
3621
|
-
if (this.
|
|
3626
|
+
et() {
|
|
3627
|
+
if (this.tt) throw new U(S, "The client has already been terminated.");
|
|
3622
3628
|
}
|
|
3623
3629
|
/** Invokes the provided RPC with auth and AppCheck tokens. */ I(t, e, n) {
|
|
3624
|
-
return this.
|
|
3630
|
+
return this.et(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.connection.I(t, e, n, r, s))).catch((t => {
|
|
3625
3631
|
throw "FirebaseError" === t.name ? (t.code === x && (this.authCredentials.invalidateToken(),
|
|
3626
3632
|
this.appCheckCredentials.invalidateToken()), t) : new U(R, t.toString());
|
|
3627
3633
|
}));
|
|
3628
3634
|
}
|
|
3629
3635
|
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ P(t, e, n, r) {
|
|
3630
|
-
return this.
|
|
3636
|
+
return this.et(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([s, i]) => this.connection.P(t, e, n, s, i, r))).catch((t => {
|
|
3631
3637
|
throw "FirebaseError" === t.name ? (t.code === x && (this.authCredentials.invalidateToken(),
|
|
3632
3638
|
this.appCheckCredentials.invalidateToken()), t) : new U(R, t.toString());
|
|
3633
3639
|
}));
|
|
3634
3640
|
}
|
|
3635
3641
|
terminate() {
|
|
3636
|
-
this.
|
|
3642
|
+
this.tt = !0;
|
|
3637
3643
|
}
|
|
3638
3644
|
}
|
|
3639
3645
|
|
|
@@ -3689,7 +3695,7 @@ async function cn(t, e) {
|
|
|
3689
3695
|
parent: n.parent
|
|
3690
3696
|
};
|
|
3691
3697
|
}(n.L, ge(e)), s = r.parent;
|
|
3692
|
-
n.
|
|
3698
|
+
n.connection.v || delete r.parent;
|
|
3693
3699
|
return (await n.P("RunAggregationQuery", s, r, /*expectedResponseCount=*/ 1)).filter((t => !!t.result)).map((t => t.result.aggregateFields));
|
|
3694
3700
|
}
|
|
3695
3701
|
|
|
@@ -4199,7 +4205,7 @@ function An(t, e, ...n) {
|
|
|
4199
4205
|
if (t = getModularInstance(t),
|
|
4200
4206
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
4201
4207
|
// 'undefined' and 'null'.
|
|
4202
|
-
1 === arguments.length && (e = _t
|
|
4208
|
+
1 === arguments.length && (e = _t.$()), st("doc", "path", e), t instanceof fn) {
|
|
4203
4209
|
const r = tt.fromString(e, ...n);
|
|
4204
4210
|
return it(r), new vn(t,
|
|
4205
4211
|
/* converter= */ null, new rt(r));
|
|
@@ -4264,7 +4270,7 @@ function An(t, e, ...n) {
|
|
|
4264
4270
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
4265
4271
|
*/ static fromBase64String(t) {
|
|
4266
4272
|
try {
|
|
4267
|
-
return new Vn(
|
|
4273
|
+
return new Vn(Dt.fromBase64String(t));
|
|
4268
4274
|
} catch (t) {
|
|
4269
4275
|
throw new U(P, "Failed to construct data from Base64 string: " + t);
|
|
4270
4276
|
}
|
|
@@ -4274,7 +4280,7 @@ function An(t, e, ...n) {
|
|
|
4274
4280
|
*
|
|
4275
4281
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
4276
4282
|
*/ static fromUint8Array(t) {
|
|
4277
|
-
return new Vn(
|
|
4283
|
+
return new Vn(Dt.fromUint8Array(t));
|
|
4278
4284
|
}
|
|
4279
4285
|
/**
|
|
4280
4286
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -4354,7 +4360,7 @@ function An(t, e, ...n) {
|
|
|
4354
4360
|
/**
|
|
4355
4361
|
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
4356
4362
|
* It can be used in queries to sort or filter by the document ID.
|
|
4357
|
-
*/ function
|
|
4363
|
+
*/ function $n() {
|
|
4358
4364
|
return new Nn("__name__");
|
|
4359
4365
|
}
|
|
4360
4366
|
|
|
@@ -4377,7 +4383,7 @@ function An(t, e, ...n) {
|
|
|
4377
4383
|
/**
|
|
4378
4384
|
* Sentinel values that can be used when writing document fields with `set()`
|
|
4379
4385
|
* or `update()`.
|
|
4380
|
-
*/ class
|
|
4386
|
+
*/ class Dn {
|
|
4381
4387
|
/**
|
|
4382
4388
|
* @param _methodName - The public API endpoint that returns this class.
|
|
4383
4389
|
* @hideconstructor
|
|
@@ -4475,7 +4481,7 @@ function An(t, e, ...n) {
|
|
|
4475
4481
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
4476
4482
|
}
|
|
4477
4483
|
toMutation(t, e) {
|
|
4478
|
-
return null !== this.fieldMask ? new
|
|
4484
|
+
return null !== this.fieldMask ? new De(t, this.data, this.fieldMask, e, this.fieldTransforms) : new $e(t, this.data, e, this.fieldTransforms);
|
|
4479
4485
|
}
|
|
4480
4486
|
}
|
|
4481
4487
|
|
|
@@ -4486,7 +4492,7 @@ function An(t, e, ...n) {
|
|
|
4486
4492
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
4487
4493
|
}
|
|
4488
4494
|
toMutation(t, e) {
|
|
4489
|
-
return new
|
|
4495
|
+
return new De(t, this.data, this.fieldMask, e, this.fieldTransforms);
|
|
4490
4496
|
}
|
|
4491
4497
|
}
|
|
4492
4498
|
|
|
@@ -4531,55 +4537,55 @@ function On(t) {
|
|
|
4531
4537
|
this.settings = t, this.databaseId = e, this.L = n, this.ignoreUndefinedProperties = r,
|
|
4532
4538
|
// Minor hack: If fieldTransforms is undefined, we assume this is an
|
|
4533
4539
|
// external call and we need to validate the entire path.
|
|
4534
|
-
void 0 === s && this.
|
|
4540
|
+
void 0 === s && this.nt(), this.fieldTransforms = s || [], this.fieldMask = i || [];
|
|
4535
4541
|
}
|
|
4536
4542
|
get path() {
|
|
4537
4543
|
return this.settings.path;
|
|
4538
4544
|
}
|
|
4539
|
-
get
|
|
4540
|
-
return this.settings.
|
|
4545
|
+
get rt() {
|
|
4546
|
+
return this.settings.rt;
|
|
4541
4547
|
}
|
|
4542
|
-
/** Returns a new context with the specified settings overwritten. */
|
|
4548
|
+
/** Returns a new context with the specified settings overwritten. */ st(t) {
|
|
4543
4549
|
return new kn(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.L, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
4544
4550
|
}
|
|
4545
|
-
|
|
4551
|
+
it(t) {
|
|
4546
4552
|
var e;
|
|
4547
|
-
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.
|
|
4553
|
+
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.st({
|
|
4548
4554
|
path: n,
|
|
4549
|
-
|
|
4555
|
+
ot: !1
|
|
4550
4556
|
});
|
|
4551
|
-
return r.
|
|
4557
|
+
return r.ut(t), r;
|
|
4552
4558
|
}
|
|
4553
|
-
|
|
4559
|
+
ct(t) {
|
|
4554
4560
|
var e;
|
|
4555
|
-
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.
|
|
4561
|
+
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.st({
|
|
4556
4562
|
path: n,
|
|
4557
|
-
|
|
4563
|
+
ot: !1
|
|
4558
4564
|
});
|
|
4559
|
-
return r.
|
|
4565
|
+
return r.nt(), r;
|
|
4560
4566
|
}
|
|
4561
|
-
|
|
4567
|
+
at(t) {
|
|
4562
4568
|
// TODO(b/34871131): We don't support array paths right now; so make path
|
|
4563
4569
|
// undefined.
|
|
4564
|
-
return this.
|
|
4570
|
+
return this.st({
|
|
4565
4571
|
path: void 0,
|
|
4566
|
-
|
|
4572
|
+
ot: !0
|
|
4567
4573
|
});
|
|
4568
4574
|
}
|
|
4569
|
-
|
|
4570
|
-
return rr(t, this.settings.methodName, this.settings.
|
|
4575
|
+
ht(t) {
|
|
4576
|
+
return rr(t, this.settings.methodName, this.settings.lt || !1, this.path, this.settings.ft);
|
|
4571
4577
|
}
|
|
4572
4578
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
4573
4579
|
return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
|
|
4574
4580
|
}
|
|
4575
|
-
|
|
4581
|
+
nt() {
|
|
4576
4582
|
// TODO(b/34871131): Remove null check once we have proper paths for fields
|
|
4577
4583
|
// within arrays.
|
|
4578
|
-
if (this.path) for (let t = 0; t < this.path.length; t++) this.
|
|
4584
|
+
if (this.path) for (let t = 0; t < this.path.length; t++) this.ut(this.path.get(t));
|
|
4579
4585
|
}
|
|
4580
|
-
|
|
4581
|
-
if (0 === t.length) throw this.
|
|
4582
|
-
if (On(this.
|
|
4586
|
+
ut(t) {
|
|
4587
|
+
if (0 === t.length) throw this.ht("Document fields must not be empty");
|
|
4588
|
+
if (On(this.rt) && Fn.test(t)) throw this.ht('Document fields cannot begin and end with "__"');
|
|
4583
4589
|
}
|
|
4584
4590
|
}
|
|
4585
4591
|
|
|
@@ -4590,14 +4596,14 @@ function On(t) {
|
|
|
4590
4596
|
constructor(t, e, n) {
|
|
4591
4597
|
this.databaseId = t, this.ignoreUndefinedProperties = e, this.L = n || en(t);
|
|
4592
4598
|
}
|
|
4593
|
-
/** Creates a new top-level parse context. */
|
|
4599
|
+
/** Creates a new top-level parse context. */ dt(t, e, n, r = !1) {
|
|
4594
4600
|
return new kn({
|
|
4595
|
-
|
|
4601
|
+
rt: t,
|
|
4596
4602
|
methodName: e,
|
|
4597
|
-
|
|
4603
|
+
ft: n,
|
|
4598
4604
|
path: nt.emptyPath(),
|
|
4599
|
-
|
|
4600
|
-
|
|
4605
|
+
ot: !1,
|
|
4606
|
+
lt: r
|
|
4601
4607
|
}, this.databaseId, this.L, this.ignoreUndefinedProperties);
|
|
4602
4608
|
}
|
|
4603
4609
|
}
|
|
@@ -4608,25 +4614,25 @@ function Ln(t) {
|
|
|
4608
4614
|
}
|
|
4609
4615
|
|
|
4610
4616
|
/** Parse document data from a set() call. */ function Mn(t, e, n, r, s, i = {}) {
|
|
4611
|
-
const o = t.
|
|
4617
|
+
const o = t.dt(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, s);
|
|
4612
4618
|
Zn("Data must be an object, but it was:", o, r);
|
|
4613
4619
|
const u = Jn(r, o);
|
|
4614
4620
|
let c, a;
|
|
4615
|
-
if (i.merge) c = new
|
|
4621
|
+
if (i.merge) c = new $t(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
|
|
4616
4622
|
const t = [];
|
|
4617
4623
|
for (const r of i.mergeFields) {
|
|
4618
4624
|
const s = tr(e, r, n);
|
|
4619
4625
|
if (!o.contains(s)) throw new U(P, `Field '${s}' is specified in your field mask but missing from your input data.`);
|
|
4620
4626
|
sr(t, s) || t.push(s);
|
|
4621
4627
|
}
|
|
4622
|
-
c = new
|
|
4628
|
+
c = new $t(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
|
|
4623
4629
|
} else c = null, a = o.fieldTransforms;
|
|
4624
4630
|
return new Sn(new Jt(u), c, a);
|
|
4625
4631
|
}
|
|
4626
4632
|
|
|
4627
|
-
class Un extends
|
|
4633
|
+
class Un extends Dn {
|
|
4628
4634
|
_toFieldTransform(t) {
|
|
4629
|
-
if (2 /* MergeSet */ !== t.
|
|
4635
|
+
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}`);
|
|
4630
4636
|
// No transform to add for a delete, but we need to add it to our
|
|
4631
4637
|
// fieldMask so it gets deleted.
|
|
4632
4638
|
return t.fieldMask.push(t.path), null;
|
|
@@ -4653,14 +4659,14 @@ class Un extends $n {
|
|
|
4653
4659
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
4654
4660
|
*/ function jn(t, e, n) {
|
|
4655
4661
|
return new kn({
|
|
4656
|
-
|
|
4657
|
-
|
|
4662
|
+
rt: 3 /* Argument */ ,
|
|
4663
|
+
ft: e.settings.ft,
|
|
4658
4664
|
methodName: t._methodName,
|
|
4659
|
-
|
|
4665
|
+
ot: n
|
|
4660
4666
|
}, e.databaseId, e.L, e.ignoreUndefinedProperties);
|
|
4661
4667
|
}
|
|
4662
4668
|
|
|
4663
|
-
class Bn extends
|
|
4669
|
+
class Bn extends Dn {
|
|
4664
4670
|
_toFieldTransform(t) {
|
|
4665
4671
|
return new Pe(t.path, new Ie);
|
|
4666
4672
|
}
|
|
@@ -4669,13 +4675,13 @@ class Bn extends $n {
|
|
|
4669
4675
|
}
|
|
4670
4676
|
}
|
|
4671
4677
|
|
|
4672
|
-
class Qn extends
|
|
4678
|
+
class Qn extends Dn {
|
|
4673
4679
|
constructor(t, e) {
|
|
4674
|
-
super(t), this.
|
|
4680
|
+
super(t), this.wt = e;
|
|
4675
4681
|
}
|
|
4676
4682
|
_toFieldTransform(t) {
|
|
4677
4683
|
const e = jn(this, t,
|
|
4678
|
-
/*array=*/ !0), n = this.
|
|
4684
|
+
/*array=*/ !0), n = this.wt.map((t => Hn(t, e))), r = new Te(n);
|
|
4679
4685
|
return new Pe(t.path, r);
|
|
4680
4686
|
}
|
|
4681
4687
|
isEqual(t) {
|
|
@@ -4684,13 +4690,13 @@ class Qn extends $n {
|
|
|
4684
4690
|
}
|
|
4685
4691
|
}
|
|
4686
4692
|
|
|
4687
|
-
class zn extends
|
|
4693
|
+
class zn extends Dn {
|
|
4688
4694
|
constructor(t, e) {
|
|
4689
|
-
super(t), this.
|
|
4695
|
+
super(t), this.wt = e;
|
|
4690
4696
|
}
|
|
4691
4697
|
_toFieldTransform(t) {
|
|
4692
4698
|
const e = jn(this, t,
|
|
4693
|
-
/*array=*/ !0), n = this.
|
|
4699
|
+
/*array=*/ !0), n = this.wt.map((t => Hn(t, e))), r = new Ae(n);
|
|
4694
4700
|
return new Pe(t.path, r);
|
|
4695
4701
|
}
|
|
4696
4702
|
isEqual(t) {
|
|
@@ -4699,12 +4705,12 @@ class zn extends $n {
|
|
|
4699
4705
|
}
|
|
4700
4706
|
}
|
|
4701
4707
|
|
|
4702
|
-
class Gn extends
|
|
4708
|
+
class Gn extends Dn {
|
|
4703
4709
|
constructor(t, e) {
|
|
4704
|
-
super(t), this.
|
|
4710
|
+
super(t), this.yt = e;
|
|
4705
4711
|
}
|
|
4706
4712
|
_toFieldTransform(t) {
|
|
4707
|
-
const e = new Re(t.L, be(t.L, this.
|
|
4713
|
+
const e = new Re(t.L, be(t.L, this.yt));
|
|
4708
4714
|
return new Pe(t.path, e);
|
|
4709
4715
|
}
|
|
4710
4716
|
isEqual(t) {
|
|
@@ -4714,7 +4720,7 @@ class Gn extends $n {
|
|
|
4714
4720
|
}
|
|
4715
4721
|
|
|
4716
4722
|
/** Parse update data from an update() call. */ function Wn(t, e, n, r) {
|
|
4717
|
-
const s = t.
|
|
4723
|
+
const s = t.dt(1 /* Update */ , e, n);
|
|
4718
4724
|
Zn("Data must be an object, but it was:", s, r);
|
|
4719
4725
|
const i = [], o = Jt.empty();
|
|
4720
4726
|
Tt(r, ((t, r) => {
|
|
@@ -4722,7 +4728,7 @@ class Gn extends $n {
|
|
|
4722
4728
|
// For Compat types, we have to "extract" the underlying types before
|
|
4723
4729
|
// performing validation.
|
|
4724
4730
|
r = getModularInstance(r);
|
|
4725
|
-
const c = s.
|
|
4731
|
+
const c = s.ct(u);
|
|
4726
4732
|
if (r instanceof Un)
|
|
4727
4733
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4728
4734
|
i.push(u); else {
|
|
@@ -4730,12 +4736,12 @@ class Gn extends $n {
|
|
|
4730
4736
|
null != t && (i.push(u), o.set(u, t));
|
|
4731
4737
|
}
|
|
4732
4738
|
}));
|
|
4733
|
-
const u = new
|
|
4739
|
+
const u = new $t(i);
|
|
4734
4740
|
return new qn(o, u, s.fieldTransforms);
|
|
4735
4741
|
}
|
|
4736
4742
|
|
|
4737
4743
|
/** Parse update data from a list of field/value arguments. */ function Kn(t, e, n, r, s, i) {
|
|
4738
|
-
const o = t.
|
|
4744
|
+
const o = t.dt(1 /* Update */ , e, n), u = [ tr(e, r, n) ], c = [ s ];
|
|
4739
4745
|
if (i.length % 2 != 0) throw new U(P, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
4740
4746
|
for (let t = 0; t < i.length; t += 2) u.push(tr(e, i[t])), c.push(i[t + 1]);
|
|
4741
4747
|
const a = [], h = Jt.empty();
|
|
@@ -4747,7 +4753,7 @@ class Gn extends $n {
|
|
|
4747
4753
|
// For Compat types, we have to "extract" the underlying types before
|
|
4748
4754
|
// performing validation.
|
|
4749
4755
|
n = getModularInstance(n);
|
|
4750
|
-
const r = o.
|
|
4756
|
+
const r = o.ct(e);
|
|
4751
4757
|
if (n instanceof Un)
|
|
4752
4758
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4753
4759
|
a.push(e); else {
|
|
@@ -4755,7 +4761,7 @@ class Gn extends $n {
|
|
|
4755
4761
|
null != t && (a.push(e), h.set(e, t));
|
|
4756
4762
|
}
|
|
4757
4763
|
}
|
|
4758
|
-
const f = new
|
|
4764
|
+
const f = new $t(a);
|
|
4759
4765
|
return new qn(h, f, o.fieldTransforms);
|
|
4760
4766
|
}
|
|
4761
4767
|
|
|
@@ -4766,7 +4772,7 @@ class Gn extends $n {
|
|
|
4766
4772
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
4767
4773
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
4768
4774
|
*/ function Yn(t, e, n, r = !1) {
|
|
4769
|
-
return Hn(n, t.
|
|
4775
|
+
return Hn(n, t.dt(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
|
|
4770
4776
|
}
|
|
4771
4777
|
|
|
4772
4778
|
/**
|
|
@@ -4782,7 +4788,7 @@ class Gn extends $n {
|
|
|
4782
4788
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
4783
4789
|
// from firestore-exp.
|
|
4784
4790
|
t = getModularInstance(t))) return Zn("Unsupported field value:", e, t), Jn(t, e);
|
|
4785
|
-
if (t instanceof
|
|
4791
|
+
if (t instanceof Dn)
|
|
4786
4792
|
// FieldValues usually parse into transforms (except deleteField())
|
|
4787
4793
|
// in which case we do not want to include this field in our parsed data
|
|
4788
4794
|
// (as doing so will overwrite the field directly prior to the transform
|
|
@@ -4794,8 +4800,8 @@ class Gn extends $n {
|
|
|
4794
4800
|
*/
|
|
4795
4801
|
return function(t, e) {
|
|
4796
4802
|
// Sentinels are only supported with writes, and not within arrays.
|
|
4797
|
-
if (!On(e.
|
|
4798
|
-
if (!e.path) throw e.
|
|
4803
|
+
if (!On(e.rt)) throw e.ht(`${t._methodName}() can only be used with update() and set()`);
|
|
4804
|
+
if (!e.path) throw e.ht(`${t._methodName}() is not currently supported inside arrays`);
|
|
4799
4805
|
const n = t._toFieldTransform(e);
|
|
4800
4806
|
n && e.fieldTransforms.push(n);
|
|
4801
4807
|
}
|
|
@@ -4819,12 +4825,12 @@ class Gn extends $n {
|
|
|
4819
4825
|
// the set of values to be included for the IN query) that may directly
|
|
4820
4826
|
// contain additional arrays (each representing an individual field
|
|
4821
4827
|
// value), so we disable this validation.
|
|
4822
|
-
if (e.settings.
|
|
4828
|
+
if (e.settings.ot && 4 /* ArrayArgument */ !== e.rt) throw e.ht("Nested arrays are not supported");
|
|
4823
4829
|
return function(t, e) {
|
|
4824
4830
|
const n = [];
|
|
4825
4831
|
let r = 0;
|
|
4826
4832
|
for (const s of t) {
|
|
4827
|
-
let t = Hn(s, e.
|
|
4833
|
+
let t = Hn(s, e.at(r));
|
|
4828
4834
|
null == t && (
|
|
4829
4835
|
// Just include nulls in the array for fields being replaced with a
|
|
4830
4836
|
// sentinel.
|
|
@@ -4876,12 +4882,12 @@ class Gn extends $n {
|
|
|
4876
4882
|
};
|
|
4877
4883
|
if (t instanceof vn) {
|
|
4878
4884
|
const n = e.databaseId, r = t.firestore._databaseId;
|
|
4879
|
-
if (!r.isEqual(n)) throw e.
|
|
4885
|
+
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}`);
|
|
4880
4886
|
return {
|
|
4881
4887
|
referenceValue: Ue(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
4882
4888
|
};
|
|
4883
4889
|
}
|
|
4884
|
-
throw e.
|
|
4890
|
+
throw e.ht(`Unsupported field value: ${ut(t)}`);
|
|
4885
4891
|
}
|
|
4886
4892
|
/**
|
|
4887
4893
|
* Checks whether an object looks like a JSON object that should be converted
|
|
@@ -4898,7 +4904,7 @@ function Jn(t, e) {
|
|
|
4898
4904
|
for (const e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
|
|
4899
4905
|
return !0;
|
|
4900
4906
|
}(t) ? Tt(t, ((t, r) => {
|
|
4901
|
-
const s = Hn(r, e.
|
|
4907
|
+
const s = Hn(r, e.it(t));
|
|
4902
4908
|
null != s && (n[t] = s);
|
|
4903
4909
|
})) :
|
|
4904
4910
|
// If we encounter an empty object, we explicitly add it to the update
|
|
@@ -4911,7 +4917,7 @@ function Jn(t, e) {
|
|
|
4911
4917
|
}
|
|
4912
4918
|
|
|
4913
4919
|
function Xn(t) {
|
|
4914
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof bt || t instanceof xn || t instanceof Vn || t instanceof vn || t instanceof
|
|
4920
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof bt || t instanceof xn || t instanceof Vn || t instanceof vn || t instanceof Dn);
|
|
4915
4921
|
}
|
|
4916
4922
|
|
|
4917
4923
|
function Zn(t, e, n) {
|
|
@@ -4919,7 +4925,7 @@ function Zn(t, e, n) {
|
|
|
4919
4925
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
4920
4926
|
}(n)) {
|
|
4921
4927
|
const r = ut(n);
|
|
4922
|
-
throw "an object" === r ? e.
|
|
4928
|
+
throw "an object" === r ? e.ht(t + " a custom object") : e.ht(t + " " + r);
|
|
4923
4929
|
}
|
|
4924
4930
|
}
|
|
4925
4931
|
|
|
@@ -5170,7 +5176,7 @@ class hr {}
|
|
|
5170
5176
|
|
|
5171
5177
|
class fr extends hr {
|
|
5172
5178
|
constructor(t, e, n) {
|
|
5173
|
-
super(), this.
|
|
5179
|
+
super(), this._t = t, this.gt = e, this.vt = n, this.type = "where";
|
|
5174
5180
|
}
|
|
5175
5181
|
_apply(t) {
|
|
5176
5182
|
const e = Ln(t.firestore), n = function(t, e, n, r, s, i, o) {
|
|
@@ -5239,7 +5245,7 @@ class fr extends hr {
|
|
|
5239
5245
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
5240
5246
|
throw n === e.op ? new U(P, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new U(P, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
5241
5247
|
}(t, c), c;
|
|
5242
|
-
}(t._query, "where", e, t.firestore._databaseId, this.
|
|
5248
|
+
}(t._query, "where", e, t.firestore._databaseId, this._t, this.gt, this.vt);
|
|
5243
5249
|
return new bn(t.firestore, t.converter, function(t, e) {
|
|
5244
5250
|
const n = t.filters.concat([ e ]);
|
|
5245
5251
|
return new we(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
@@ -5264,7 +5270,7 @@ class fr extends hr {
|
|
|
5264
5270
|
|
|
5265
5271
|
class wr extends hr {
|
|
5266
5272
|
constructor(t, e) {
|
|
5267
|
-
super(), this.
|
|
5273
|
+
super(), this._t = t, this.bt = e, this.type = "orderBy";
|
|
5268
5274
|
}
|
|
5269
5275
|
_apply(t) {
|
|
5270
5276
|
const e = function(t, e, n) {
|
|
@@ -5289,7 +5295,7 @@ class wr extends hr {
|
|
|
5289
5295
|
* Will throw if the document does not contain all fields of the order by
|
|
5290
5296
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
5291
5297
|
* server timestamp.
|
|
5292
|
-
*/ (t._query, this.
|
|
5298
|
+
*/ (t._query, this._t, this.bt);
|
|
5293
5299
|
return new bn(t.firestore, t.converter, function(t, e) {
|
|
5294
5300
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
5295
5301
|
const n = t.explicitOrderBy.concat([ e ]);
|
|
@@ -5313,12 +5319,12 @@ class wr extends hr {
|
|
|
5313
5319
|
|
|
5314
5320
|
class pr extends hr {
|
|
5315
5321
|
constructor(t, e, n) {
|
|
5316
|
-
super(), this.type = t, this.
|
|
5322
|
+
super(), this.type = t, this.Et = e, this.It = n;
|
|
5317
5323
|
}
|
|
5318
5324
|
_apply(t) {
|
|
5319
5325
|
return new bn(t.firestore, t.converter, function(t, e, n) {
|
|
5320
5326
|
return new we(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
5321
|
-
}(t._query, this.
|
|
5327
|
+
}(t._query, this.Et, this.It));
|
|
5322
5328
|
}
|
|
5323
5329
|
}
|
|
5324
5330
|
|
|
@@ -5345,10 +5351,10 @@ class pr extends hr {
|
|
|
5345
5351
|
|
|
5346
5352
|
class gr extends hr {
|
|
5347
5353
|
constructor(t, e, n) {
|
|
5348
|
-
super(), this.type = t, this.
|
|
5354
|
+
super(), this.type = t, this.Tt = e, this.At = n;
|
|
5349
5355
|
}
|
|
5350
5356
|
_apply(t) {
|
|
5351
|
-
const e = Ar(t, this.type, this.
|
|
5357
|
+
const e = Ar(t, this.type, this.Tt, this.At);
|
|
5352
5358
|
return new bn(t.firestore, t.converter, function(t, e) {
|
|
5353
5359
|
return new we(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
5354
5360
|
}(t._query, e));
|
|
@@ -5367,10 +5373,10 @@ function br(...t) {
|
|
|
5367
5373
|
|
|
5368
5374
|
class Er extends hr {
|
|
5369
5375
|
constructor(t, e, n) {
|
|
5370
|
-
super(), this.type = t, this.
|
|
5376
|
+
super(), this.type = t, this.Tt = e, this.At = n;
|
|
5371
5377
|
}
|
|
5372
5378
|
_apply(t) {
|
|
5373
|
-
const e = Ar(t, this.type, this.
|
|
5379
|
+
const e = Ar(t, this.type, this.Tt, this.At);
|
|
5374
5380
|
return new bn(t.firestore, t.converter, function(t, e) {
|
|
5375
5381
|
return new we(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
5376
5382
|
}(t._query, e));
|
|
@@ -5522,7 +5528,7 @@ function Nr(t, e, n) {
|
|
|
5522
5528
|
r;
|
|
5523
5529
|
}
|
|
5524
5530
|
|
|
5525
|
-
class
|
|
5531
|
+
class $r extends class {
|
|
5526
5532
|
convertValue(t, e = "none") {
|
|
5527
5533
|
switch (Mt(t)) {
|
|
5528
5534
|
case 0 /* NullValue */ :
|
|
@@ -5625,8 +5631,8 @@ class Dr extends class {
|
|
|
5625
5631
|
* @param reference - The reference of the document to fetch.
|
|
5626
5632
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the current
|
|
5627
5633
|
* document contents.
|
|
5628
|
-
*/ function
|
|
5629
|
-
const e = hn((t = ct(t, vn)).firestore), n = new
|
|
5634
|
+
*/ function Dr(t) {
|
|
5635
|
+
const e = hn((t = ct(t, vn)).firestore), n = new $r(t.firestore);
|
|
5630
5636
|
return on(e, [ t._key ]).then((e => {
|
|
5631
5637
|
E(1 === e.length);
|
|
5632
5638
|
const r = e[0];
|
|
@@ -5649,7 +5655,7 @@ class Dr extends class {
|
|
|
5649
5655
|
!function(t) {
|
|
5650
5656
|
if ("L" /* Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new U(k, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
5651
5657
|
}((t = ct(t, bn))._query);
|
|
5652
|
-
const e = hn(t.firestore), n = new
|
|
5658
|
+
const e = hn(t.firestore), n = new $r(t.firestore);
|
|
5653
5659
|
return un(e, t._query).then((e => {
|
|
5654
5660
|
const r = e.map((e => new or(t.firestore, n, e.key, e, t.converter)));
|
|
5655
5661
|
return "L" /* Last */ === t._query.limitType &&
|
|
@@ -5738,7 +5744,7 @@ function Sr(t, e, n, ...r) {
|
|
|
5738
5744
|
* retrieved from `snapshot.data().count`, where `snapshot` is the
|
|
5739
5745
|
* `AggregateQuerySnapshot` to which the returned Promise resolves.
|
|
5740
5746
|
*/ function kr(t) {
|
|
5741
|
-
const e = ct(t.firestore, fn), n = hn(e), r = new
|
|
5747
|
+
const e = ct(t.firestore, fn), n = hn(e), r = new $r(e);
|
|
5742
5748
|
return new gn(t, n, r).run();
|
|
5743
5749
|
}
|
|
5744
5750
|
|
|
@@ -6100,14 +6106,14 @@ function zr(t, e) {
|
|
|
6100
6106
|
class Yr {
|
|
6101
6107
|
constructor(t, e, n, r, s) {
|
|
6102
6108
|
this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = r,
|
|
6103
|
-
this.deferred = s, this.
|
|
6109
|
+
this.deferred = s, this.Rt = n.maxAttempts, this.Pt = new nn(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
6104
6110
|
}
|
|
6105
6111
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
6106
|
-
this.
|
|
6112
|
+
this.Rt -= 1, this.Vt();
|
|
6107
6113
|
}
|
|
6108
|
-
|
|
6109
|
-
this.
|
|
6110
|
-
const t = new Wr(this.datastore), e = this.
|
|
6114
|
+
Vt() {
|
|
6115
|
+
this.Pt.J((async () => {
|
|
6116
|
+
const t = new Wr(this.datastore), e = this.Nt(t);
|
|
6111
6117
|
e && e.then((e => {
|
|
6112
6118
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
6113
6119
|
this.deferred.resolve(e);
|
|
@@ -6119,7 +6125,7 @@ class Yr {
|
|
|
6119
6125
|
}));
|
|
6120
6126
|
}));
|
|
6121
6127
|
}
|
|
6122
|
-
|
|
6128
|
+
Nt(t) {
|
|
6123
6129
|
try {
|
|
6124
6130
|
const e = this.updateFunction(t);
|
|
6125
6131
|
return !ht(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
|
|
@@ -6130,15 +6136,15 @@ class Yr {
|
|
|
6130
6136
|
}
|
|
6131
6137
|
}
|
|
6132
6138
|
$t(t) {
|
|
6133
|
-
this.
|
|
6139
|
+
this.Rt > 0 && this.Dt(t) ? (this.Rt -= 1, this.asyncQueue.enqueueAndForget((() => (this.Vt(),
|
|
6134
6140
|
Promise.resolve())))) : this.deferred.reject(t);
|
|
6135
6141
|
}
|
|
6136
|
-
|
|
6142
|
+
Dt(t) {
|
|
6137
6143
|
if ("FirebaseError" === t.name) {
|
|
6138
6144
|
// In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and
|
|
6139
6145
|
// non-matching document versions with ABORTED. These errors should be retried.
|
|
6140
6146
|
const e = t.code;
|
|
6141
|
-
return "aborted" === e || "failed-precondition" === e || !
|
|
6147
|
+
return "aborted" === e || "failed-precondition" === e || "already-exists" === e || !
|
|
6142
6148
|
/**
|
|
6143
6149
|
* Determines whether an error code represents a permanent error when received
|
|
6144
6150
|
* in response to a non-write operation.
|
|
@@ -6163,8 +6169,8 @@ class Yr {
|
|
|
6163
6169
|
|
|
6164
6170
|
case P:
|
|
6165
6171
|
case N:
|
|
6166
|
-
case D:
|
|
6167
6172
|
case $:
|
|
6173
|
+
case D:
|
|
6168
6174
|
case S:
|
|
6169
6175
|
// Aborted might be retried in some scenarios, but that is dependant on
|
|
6170
6176
|
// the context and should handled individually by the calling code.
|
|
@@ -6304,39 +6310,39 @@ class Yr {
|
|
|
6304
6310
|
*/ class Xr {
|
|
6305
6311
|
constructor() {
|
|
6306
6312
|
// The last promise in the queue.
|
|
6307
|
-
this.
|
|
6313
|
+
this.xt = Promise.resolve(),
|
|
6308
6314
|
// A list of retryable operations. Retryable operations are run in order and
|
|
6309
6315
|
// retried with backoff.
|
|
6310
|
-
this.
|
|
6316
|
+
this.Ft = [],
|
|
6311
6317
|
// Is this AsyncQueue being shut down? Once it is set to true, it will not
|
|
6312
6318
|
// be changed again.
|
|
6313
|
-
this.
|
|
6319
|
+
this.St = !1,
|
|
6314
6320
|
// Operations scheduled to be queued in the future. Operations are
|
|
6315
6321
|
// automatically removed after they are run or canceled.
|
|
6316
|
-
this.
|
|
6322
|
+
this.qt = [],
|
|
6317
6323
|
// visible for testing
|
|
6318
|
-
this.
|
|
6324
|
+
this.Ot = null,
|
|
6319
6325
|
// Flag set while there's an outstanding AsyncQueue operation, used for
|
|
6320
6326
|
// assertion sanity-checks.
|
|
6321
|
-
this.
|
|
6327
|
+
this.kt = !1,
|
|
6322
6328
|
// Enabled during shutdown on Safari to prevent future access to IndexedDB.
|
|
6323
|
-
this.
|
|
6329
|
+
this.Ct = !1,
|
|
6324
6330
|
// List of TimerIds to fast-forward delays for.
|
|
6325
|
-
this.
|
|
6331
|
+
this.Lt = [],
|
|
6326
6332
|
// Backoff timer used to schedule retries for retryable operations
|
|
6327
|
-
this.
|
|
6333
|
+
this.Pt = new nn(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
6328
6334
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
6329
6335
|
// operations. Meant to speed up recovery when we regain file system access
|
|
6330
6336
|
// after page comes into foreground.
|
|
6331
|
-
this.
|
|
6337
|
+
this.Mt = () => {
|
|
6332
6338
|
const t = Hr();
|
|
6333
|
-
t && y("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.
|
|
6339
|
+
t && y("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.Pt.Z();
|
|
6334
6340
|
};
|
|
6335
6341
|
const t = Hr();
|
|
6336
|
-
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.
|
|
6342
|
+
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Mt);
|
|
6337
6343
|
}
|
|
6338
6344
|
get isShuttingDown() {
|
|
6339
|
-
return this.
|
|
6345
|
+
return this.St;
|
|
6340
6346
|
}
|
|
6341
6347
|
/**
|
|
6342
6348
|
* Adds a new operation to the queue without waiting for it to complete (i.e.
|
|
@@ -6346,38 +6352,38 @@ class Yr {
|
|
|
6346
6352
|
this.enqueue(t);
|
|
6347
6353
|
}
|
|
6348
6354
|
enqueueAndForgetEvenWhileRestricted(t) {
|
|
6349
|
-
this.
|
|
6355
|
+
this.Ut(),
|
|
6350
6356
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
6351
|
-
this.
|
|
6357
|
+
this.jt(t);
|
|
6352
6358
|
}
|
|
6353
6359
|
enterRestrictedMode(t) {
|
|
6354
|
-
if (!this.
|
|
6355
|
-
this.
|
|
6360
|
+
if (!this.St) {
|
|
6361
|
+
this.St = !0, this.Ct = t || !1;
|
|
6356
6362
|
const e = Hr();
|
|
6357
|
-
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.
|
|
6363
|
+
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Mt);
|
|
6358
6364
|
}
|
|
6359
6365
|
}
|
|
6360
6366
|
enqueue(t) {
|
|
6361
|
-
if (this.
|
|
6367
|
+
if (this.Ut(), this.St)
|
|
6362
6368
|
// Return a Promise which never resolves.
|
|
6363
6369
|
return new Promise((() => {}));
|
|
6364
6370
|
// Create a deferred Promise that we can return to the callee. This
|
|
6365
6371
|
// allows us to return a "hanging Promise" only to the callee and still
|
|
6366
6372
|
// advance the queue even when the operation is not run.
|
|
6367
6373
|
const e = new j;
|
|
6368
|
-
return this.
|
|
6374
|
+
return this.jt((() => this.St && this.Ct ? Promise.resolve() : (t().then(e.resolve, e.reject),
|
|
6369
6375
|
e.promise))).then((() => e.promise));
|
|
6370
6376
|
}
|
|
6371
6377
|
enqueueRetryable(t) {
|
|
6372
|
-
this.enqueueAndForget((() => (this.
|
|
6378
|
+
this.enqueueAndForget((() => (this.Ft.push(t), this.Bt())));
|
|
6373
6379
|
}
|
|
6374
6380
|
/**
|
|
6375
6381
|
* Runs the next operation from the retryable queue. If the operation fails,
|
|
6376
6382
|
* reschedules with backoff.
|
|
6377
|
-
*/ async
|
|
6378
|
-
if (0 !== this.
|
|
6383
|
+
*/ async Bt() {
|
|
6384
|
+
if (0 !== this.Ft.length) {
|
|
6379
6385
|
try {
|
|
6380
|
-
await this.
|
|
6386
|
+
await this.Ft[0](), this.Ft.shift(), this.Pt.reset();
|
|
6381
6387
|
} catch (t) {
|
|
6382
6388
|
if (!
|
|
6383
6389
|
/**
|
|
@@ -6421,7 +6427,7 @@ class Yr {
|
|
|
6421
6427
|
// Failure will be handled by AsyncQueue
|
|
6422
6428
|
y("AsyncQueue", "Operation failed with retryable error: " + t);
|
|
6423
6429
|
}
|
|
6424
|
-
this.
|
|
6430
|
+
this.Ft.length > 0 &&
|
|
6425
6431
|
// If there are additional operations, we re-schedule `retryNextOp()`.
|
|
6426
6432
|
// This is necessary to run retryable operations that failed during
|
|
6427
6433
|
// their initial attempt since we don't know whether they are already
|
|
@@ -6432,12 +6438,12 @@ class Yr {
|
|
|
6432
6438
|
// Since `backoffAndRun()` cancels an existing backoff and schedules a
|
|
6433
6439
|
// new backoff on every call, there is only ever a single additional
|
|
6434
6440
|
// operation in the queue.
|
|
6435
|
-
this.
|
|
6441
|
+
this.Pt.J((() => this.Bt()));
|
|
6436
6442
|
}
|
|
6437
6443
|
}
|
|
6438
|
-
|
|
6439
|
-
const e = this.
|
|
6440
|
-
this.
|
|
6444
|
+
jt(t) {
|
|
6445
|
+
const e = this.xt.then((() => (this.kt = !0, t().catch((t => {
|
|
6446
|
+
this.Ot = t, this.kt = !1;
|
|
6441
6447
|
const e =
|
|
6442
6448
|
/**
|
|
6443
6449
|
* Chrome includes Error.message in Error.stack. Other browsers do not.
|
|
@@ -6478,38 +6484,38 @@ class Yr {
|
|
|
6478
6484
|
// all further attempts to chain (via .then) will just short-circuit
|
|
6479
6485
|
// and return the rejected Promise.
|
|
6480
6486
|
throw _("INTERNAL UNHANDLED ERROR: ", e), t;
|
|
6481
|
-
})).then((t => (this.
|
|
6482
|
-
return this.
|
|
6487
|
+
})).then((t => (this.kt = !1, t))))));
|
|
6488
|
+
return this.xt = e, e;
|
|
6483
6489
|
}
|
|
6484
6490
|
enqueueAfterDelay(t, e, n) {
|
|
6485
|
-
this.
|
|
6491
|
+
this.Ut(),
|
|
6486
6492
|
// Fast-forward delays for timerIds that have been overriden.
|
|
6487
|
-
this.
|
|
6488
|
-
const r = Jr.createAndSchedule(this, t, e, n, (t => this.
|
|
6489
|
-
return this.
|
|
6493
|
+
this.Lt.indexOf(t) > -1 && (e = 0);
|
|
6494
|
+
const r = Jr.createAndSchedule(this, t, e, n, (t => this.Qt(t)));
|
|
6495
|
+
return this.qt.push(r), r;
|
|
6490
6496
|
}
|
|
6491
|
-
|
|
6492
|
-
this.
|
|
6497
|
+
Ut() {
|
|
6498
|
+
this.Ot && b();
|
|
6493
6499
|
}
|
|
6494
6500
|
verifyOperationInProgress() {}
|
|
6495
6501
|
/**
|
|
6496
6502
|
* Waits until all currently queued tasks are finished executing. Delayed
|
|
6497
6503
|
* operations are not run.
|
|
6498
|
-
*/ async
|
|
6504
|
+
*/ async zt() {
|
|
6499
6505
|
// Operations in the queue prior to draining may have enqueued additional
|
|
6500
6506
|
// operations. Keep draining the queue until the tail is no longer advanced,
|
|
6501
6507
|
// which indicates that no more new operations were enqueued and that all
|
|
6502
6508
|
// operations were executed.
|
|
6503
6509
|
let t;
|
|
6504
6510
|
do {
|
|
6505
|
-
t = this.
|
|
6506
|
-
} while (t !== this.
|
|
6511
|
+
t = this.xt, await t;
|
|
6512
|
+
} while (t !== this.xt);
|
|
6507
6513
|
}
|
|
6508
6514
|
/**
|
|
6509
6515
|
* For Tests: Determine if a delayed operation with a particular TimerId
|
|
6510
6516
|
* exists.
|
|
6511
|
-
*/
|
|
6512
|
-
for (const e of this.
|
|
6517
|
+
*/ Gt(t) {
|
|
6518
|
+
for (const e of this.qt) if (e.timerId === t) return !0;
|
|
6513
6519
|
return !1;
|
|
6514
6520
|
}
|
|
6515
6521
|
/**
|
|
@@ -6518,24 +6524,24 @@ class Yr {
|
|
|
6518
6524
|
* @param lastTimerId - Delayed operations up to and including this TimerId
|
|
6519
6525
|
* will be drained. Pass TimerId.All to run all delayed operations.
|
|
6520
6526
|
* @returns a Promise that resolves once all operations have been run.
|
|
6521
|
-
*/
|
|
6527
|
+
*/ Wt(t) {
|
|
6522
6528
|
// Note that draining may generate more delayed ops, so we do that first.
|
|
6523
|
-
return this.
|
|
6529
|
+
return this.zt().then((() => {
|
|
6524
6530
|
// Run ops in the same order they'd run if they ran naturally.
|
|
6525
|
-
this.
|
|
6526
|
-
for (const e of this.
|
|
6527
|
-
return this.
|
|
6531
|
+
this.qt.sort(((t, e) => t.targetTimeMs - e.targetTimeMs));
|
|
6532
|
+
for (const e of this.qt) if (e.skipDelay(), "all" /* All */ !== t && e.timerId === t) break;
|
|
6533
|
+
return this.zt();
|
|
6528
6534
|
}));
|
|
6529
6535
|
}
|
|
6530
6536
|
/**
|
|
6531
6537
|
* For Tests: Skip all subsequent delays for a timer id.
|
|
6532
|
-
*/
|
|
6533
|
-
this.
|
|
6538
|
+
*/ Kt(t) {
|
|
6539
|
+
this.Lt.push(t);
|
|
6534
6540
|
}
|
|
6535
|
-
/** Called once a DelayedOperation is run or canceled. */
|
|
6541
|
+
/** Called once a DelayedOperation is run or canceled. */ Qt(t) {
|
|
6536
6542
|
// NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
|
|
6537
|
-
const e = this.
|
|
6538
|
-
this.
|
|
6543
|
+
const e = this.qt.indexOf(t);
|
|
6544
|
+
this.qt.splice(e, 1);
|
|
6539
6545
|
}
|
|
6540
6546
|
}
|
|
6541
6547
|
|
|
@@ -6550,7 +6556,7 @@ class Zr {
|
|
|
6550
6556
|
* @param documentRef - A reference to the document to be read.
|
|
6551
6557
|
* @returns A `DocumentSnapshot` with the read data.
|
|
6552
6558
|
*/ get(t) {
|
|
6553
|
-
const e = zr(t, this._firestore), n = new
|
|
6559
|
+
const e = zr(t, this._firestore), n = new $r(this._firestore);
|
|
6554
6560
|
return this._transaction.lookup([ e._key ]).then((t => {
|
|
6555
6561
|
if (!t || 1 !== t.length) return b();
|
|
6556
6562
|
const r = t[0];
|
|
@@ -6642,7 +6648,7 @@ class Zr {
|
|
|
6642
6648
|
return n && s._setSettings(n), s;
|
|
6643
6649
|
}), "PUBLIC").setMultipleInstances(!0)),
|
|
6644
6650
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
6645
|
-
registerVersion("firestore-lite", "3.7.
|
|
6651
|
+
registerVersion("firestore-lite", "3.7.2-canary.457fc2eeb", ""), registerVersion("firestore-lite", "3.7.2-canary.457fc2eeb", "esm2017");
|
|
6646
6652
|
|
|
6647
|
-
export { yn as AggregateField, _n as AggregateQuerySnapshot, Vn as Bytes, En as CollectionReference, vn as DocumentReference, ir as DocumentSnapshot, Nn as FieldPath,
|
|
6653
|
+
export { yn as AggregateField, _n as AggregateQuerySnapshot, Vn as Bytes, En as CollectionReference, vn as DocumentReference, ir as DocumentSnapshot, Nn as FieldPath, Dn as FieldValue, fn as Firestore, U as FirestoreError, xn as GeoPoint, bn as Query, hr as QueryConstraint, or as QueryDocumentSnapshot, ur as QuerySnapshot, bt as Timestamp, Zr as Transaction, Qr as WriteBatch, Or as addDoc, Cr as aggregateQuerySnapshotEqual, jr as arrayRemove, Ur as arrayUnion, In as collection, Tn as collectionGroup, mn as connectFirestoreEmulator, qr as deleteDoc, Lr as deleteField, An as doc, $n as documentId, Tr as endAt, Ir as endBefore, kr as getCount, Dr as getDoc, xr as getDocs, wn as getFirestore, Br as increment, dn as initializeFirestore, yr as limit, _r as limitToLast, mr as orderBy, lr as query, Pn as queryEqual, Rn as refEqual, ts as runTransaction, Mr as serverTimestamp, Fr as setDoc, p as setLogLevel, cr as snapshotEqual, br as startAfter, vr as startAt, pn as terminate, Sr as updateDoc, dr as where, Gr as writeBatch };
|
|
6648
6654
|
//# sourceMappingURL=index.browser.esm2017.js.map
|