@firebase/firestore 3.4.8-canary.69baecadd → 3.4.8-canary.6ceff4db0
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/dist/firestore/lite/index.d.ts +1 -0
- package/dist/firestore/src/api/transaction.d.ts +2 -1
- package/dist/firestore/src/api/transaction_options.d.ts +17 -0
- package/dist/firestore/src/api.d.ts +1 -0
- package/dist/firestore/src/core/firestore_client.d.ts +2 -1
- package/dist/firestore/src/core/transaction_options.d.ts +25 -0
- package/dist/firestore/src/core/transaction_runner.d.ts +3 -2
- package/dist/firestore/src/lite-api/transaction.d.ts +2 -1
- package/dist/firestore/src/lite-api/transaction_options.d.ts +23 -0
- package/dist/index.d.ts +24 -1
- package/dist/index.esm2017.js +95 -71
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +105 -82
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +36 -9
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +36 -9
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +241 -217
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +25 -1
- package/dist/lite/firestore/lite/index.d.ts +1 -0
- package/dist/lite/firestore/src/api/transaction.d.ts +2 -1
- package/dist/lite/firestore/src/api/transaction_options.d.ts +17 -0
- package/dist/lite/firestore/src/api.d.ts +1 -0
- package/dist/lite/firestore/src/core/firestore_client.d.ts +2 -1
- package/dist/lite/firestore/src/core/transaction_options.d.ts +25 -0
- package/dist/lite/firestore/src/core/transaction_runner.d.ts +3 -2
- package/dist/lite/firestore/src/lite-api/transaction.d.ts +2 -1
- package/dist/lite/firestore/src/lite-api/transaction_options.d.ts +23 -0
- package/dist/lite/index.browser.esm2017.js +180 -157
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +112 -110
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.d.ts +24 -1
- package/dist/lite/index.node.cjs.js +34 -7
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +34 -7
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +204 -181
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +25 -1
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +13 -13
- package/dist/lite/packages/firestore/lite/index.d.ts +1 -0
- package/dist/lite/packages/firestore/src/api/transaction.d.ts +2 -1
- package/dist/lite/packages/firestore/src/api/transaction_options.d.ts +17 -0
- package/dist/lite/packages/firestore/src/api.d.ts +1 -0
- package/dist/lite/packages/firestore/src/core/firestore_client.d.ts +2 -1
- package/dist/lite/packages/firestore/src/core/transaction_options.d.ts +25 -0
- package/dist/lite/packages/firestore/src/core/transaction_runner.d.ts +3 -2
- package/dist/lite/packages/firestore/src/lite-api/transaction.d.ts +2 -1
- package/dist/lite/packages/firestore/src/lite-api/transaction_options.d.ts +23 -0
- package/dist/lite/private.d.ts +25 -1
- package/dist/packages/firestore/dist/index.esm2017.d.ts +30 -29
- package/dist/packages/firestore/lite/index.d.ts +1 -0
- package/dist/packages/firestore/src/api/transaction.d.ts +2 -1
- package/dist/packages/firestore/src/api/transaction_options.d.ts +17 -0
- package/dist/packages/firestore/src/api.d.ts +1 -0
- package/dist/packages/firestore/src/core/firestore_client.d.ts +2 -1
- package/dist/packages/firestore/src/core/transaction_options.d.ts +25 -0
- package/dist/packages/firestore/src/core/transaction_runner.d.ts +3 -2
- package/dist/packages/firestore/src/lite-api/transaction.d.ts +2 -1
- package/dist/packages/firestore/src/lite-api/transaction_options.d.ts +23 -0
- package/dist/private.d.ts +25 -1
- package/package.json +10 -10
|
@@ -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.7.0-canary.
|
|
69
|
+
let d = "9.7.0-canary.6ceff4db0";
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* @license
|
|
@@ -178,7 +178,7 @@ function y(t, ...e) {
|
|
|
178
178
|
* Returns `never` and can be used in expressions:
|
|
179
179
|
* @example
|
|
180
180
|
* let futureVar = fail('not implemented yet');
|
|
181
|
-
*/ function
|
|
181
|
+
*/ function b(t = "Unexpected state") {
|
|
182
182
|
// Log the failure in addition to throw an exception, just in case the
|
|
183
183
|
// exception is swallowed.
|
|
184
184
|
const e = `FIRESTORE (${d}) INTERNAL ASSERTION FAILED: ` + t;
|
|
@@ -193,8 +193,8 @@ function y(t, ...e) {
|
|
|
193
193
|
* given message if it did.
|
|
194
194
|
*
|
|
195
195
|
* Messages are stripped in production builds.
|
|
196
|
-
*/ function
|
|
197
|
-
t ||
|
|
196
|
+
*/ function v(t, e) {
|
|
197
|
+
t || b();
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
/**
|
|
@@ -221,7 +221,7 @@ e) {
|
|
|
221
221
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
222
222
|
* See the License for the specific language governing permissions and
|
|
223
223
|
* limitations under the License.
|
|
224
|
-
*/ const T = "ok",
|
|
224
|
+
*/ const T = "ok", A = "cancelled", I = "unknown", R = "invalid-argument", P = "deadline-exceeded", V = "not-found", N = "already-exists", D = "permission-denied", $ = "unauthenticated", S = "resource-exhausted", x = "failed-precondition", F = "aborted", q = "out-of-range", O = "unimplemented", C = "internal", L = "unavailable", k = "data-loss";
|
|
225
225
|
|
|
226
226
|
/** An error returned by a Firestore operation. */ class U extends c {
|
|
227
227
|
/** @hideconstructor */
|
|
@@ -335,7 +335,7 @@ e) {
|
|
|
335
335
|
}));
|
|
336
336
|
}
|
|
337
337
|
getToken() {
|
|
338
|
-
return this.auth ? this.auth.getToken().then((t => t ? (
|
|
338
|
+
return this.auth ? this.auth.getToken().then((t => t ? (v("string" == typeof t.accessToken),
|
|
339
339
|
new M(t.accessToken, new f(this.auth.getUid()))) : null)) : Promise.resolve(null);
|
|
340
340
|
}
|
|
341
341
|
invalidateToken() {}
|
|
@@ -389,7 +389,7 @@ class Y {
|
|
|
389
389
|
}));
|
|
390
390
|
}
|
|
391
391
|
getToken() {
|
|
392
|
-
return this.appCheck ? this.appCheck.getToken().then((t => t ? (
|
|
392
|
+
return this.appCheck ? this.appCheck.getToken().then((t => t ? (v("string" == typeof t.token),
|
|
393
393
|
new Y(t.token)) : null)) : Promise.resolve(null);
|
|
394
394
|
}
|
|
395
395
|
invalidateToken() {}
|
|
@@ -482,7 +482,7 @@ class J {
|
|
|
482
482
|
*/
|
|
483
483
|
class X {
|
|
484
484
|
constructor(t, e, n) {
|
|
485
|
-
void 0 === e ? e = 0 : e > t.length &&
|
|
485
|
+
void 0 === e ? e = 0 : e > t.length && b(), void 0 === n ? n = t.length - e : n > t.length - e && b(),
|
|
486
486
|
this.segments = t, this.offset = e, this.len = n;
|
|
487
487
|
}
|
|
488
488
|
get length() {
|
|
@@ -784,7 +784,7 @@ function ot(t) {
|
|
|
784
784
|
return e ? `a custom ${e} object` : "an object";
|
|
785
785
|
}
|
|
786
786
|
}
|
|
787
|
-
return "function" == typeof t ? "a function" :
|
|
787
|
+
return "function" == typeof t ? "a function" : b();
|
|
788
788
|
}
|
|
789
789
|
|
|
790
790
|
function ut(t,
|
|
@@ -902,7 +902,7 @@ var ft, dt;
|
|
|
902
902
|
* Code.UNKNOWN.
|
|
903
903
|
*/
|
|
904
904
|
function wt(t) {
|
|
905
|
-
if (void 0 === t) return y("RPC_ERROR", "HTTP error has no status"),
|
|
905
|
+
if (void 0 === t) return y("RPC_ERROR", "HTTP error has no status"), I;
|
|
906
906
|
// The canonical error codes for Google APIs [1] specify mapping onto HTTP
|
|
907
907
|
// status codes but the mapping is not bijective. In each case of ambiguity
|
|
908
908
|
// this function chooses a primary error.
|
|
@@ -916,7 +916,7 @@ function wt(t) {
|
|
|
916
916
|
|
|
917
917
|
case 400:
|
|
918
918
|
// Bad Request
|
|
919
|
-
return
|
|
919
|
+
return x;
|
|
920
920
|
|
|
921
921
|
// Other possibilities based on the forward mapping
|
|
922
922
|
// return Code.INVALID_ARGUMENT;
|
|
@@ -935,7 +935,7 @@ function wt(t) {
|
|
|
935
935
|
|
|
936
936
|
case 409:
|
|
937
937
|
// Conflict
|
|
938
|
-
return
|
|
938
|
+
return F;
|
|
939
939
|
|
|
940
940
|
// Other possibilities:
|
|
941
941
|
// return Code.ALREADY_EXISTS;
|
|
@@ -949,11 +949,11 @@ function wt(t) {
|
|
|
949
949
|
|
|
950
950
|
case 499:
|
|
951
951
|
// Client Closed Request
|
|
952
|
-
return
|
|
952
|
+
return A;
|
|
953
953
|
|
|
954
954
|
case 500:
|
|
955
955
|
// Internal Server Error
|
|
956
|
-
return
|
|
956
|
+
return I;
|
|
957
957
|
|
|
958
958
|
// Other possibilities:
|
|
959
959
|
// return Code.INTERNAL;
|
|
@@ -971,7 +971,7 @@ function wt(t) {
|
|
|
971
971
|
return P;
|
|
972
972
|
|
|
973
973
|
default:
|
|
974
|
-
return t >= 200 && t < 300 ? T : t >= 400 && t < 500 ?
|
|
974
|
+
return t >= 200 && t < 300 ? T : t >= 400 && t < 500 ? x : t >= 500 && t < 600 ? C : I;
|
|
975
975
|
}
|
|
976
976
|
}
|
|
977
977
|
|
|
@@ -1051,16 +1051,16 @@ class {
|
|
|
1051
1051
|
* @param fetchImpl - `fetch` or a Polyfill that implements the fetch API.
|
|
1052
1052
|
*/
|
|
1053
1053
|
constructor(t, e) {
|
|
1054
|
-
super(t), this.
|
|
1054
|
+
super(t), this.A = e;
|
|
1055
1055
|
}
|
|
1056
|
-
|
|
1056
|
+
I(t, e) {
|
|
1057
1057
|
throw new Error("Not supported by FetchConnection");
|
|
1058
1058
|
}
|
|
1059
1059
|
async v(t, e, n, r) {
|
|
1060
1060
|
const s = JSON.stringify(r);
|
|
1061
1061
|
let i;
|
|
1062
1062
|
try {
|
|
1063
|
-
i = await this.
|
|
1063
|
+
i = await this.A(e, {
|
|
1064
1064
|
method: "POST",
|
|
1065
1065
|
headers: n,
|
|
1066
1066
|
body: s
|
|
@@ -1193,7 +1193,7 @@ function _t(t, e) {
|
|
|
1193
1193
|
* For examples and further specifications, refer to the
|
|
1194
1194
|
* {@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | Timestamp definition}.
|
|
1195
1195
|
*/
|
|
1196
|
-
class
|
|
1196
|
+
class bt {
|
|
1197
1197
|
/**
|
|
1198
1198
|
* Creates a new timestamp.
|
|
1199
1199
|
*
|
|
@@ -1225,7 +1225,7 @@ class vt {
|
|
|
1225
1225
|
*
|
|
1226
1226
|
* @returns a new timestamp representing the current date.
|
|
1227
1227
|
*/ static now() {
|
|
1228
|
-
return
|
|
1228
|
+
return bt.fromMillis(Date.now());
|
|
1229
1229
|
}
|
|
1230
1230
|
/**
|
|
1231
1231
|
* Creates a new timestamp from the given date.
|
|
@@ -1234,7 +1234,7 @@ class vt {
|
|
|
1234
1234
|
* @returns A new `Timestamp` representing the same point in time as the given
|
|
1235
1235
|
* date.
|
|
1236
1236
|
*/ static fromDate(t) {
|
|
1237
|
-
return
|
|
1237
|
+
return bt.fromMillis(t.getTime());
|
|
1238
1238
|
}
|
|
1239
1239
|
/**
|
|
1240
1240
|
* Creates a new timestamp from the given number of milliseconds.
|
|
@@ -1245,7 +1245,7 @@ class vt {
|
|
|
1245
1245
|
* number of milliseconds.
|
|
1246
1246
|
*/ static fromMillis(t) {
|
|
1247
1247
|
const e = Math.floor(t / 1e3), n = Math.floor(1e6 * (t - 1e3 * e));
|
|
1248
|
-
return new
|
|
1248
|
+
return new bt(e, n);
|
|
1249
1249
|
}
|
|
1250
1250
|
/**
|
|
1251
1251
|
* Converts a `Timestamp` to a JavaScript `Date` object. This conversion
|
|
@@ -1323,18 +1323,18 @@ class vt {
|
|
|
1323
1323
|
/**
|
|
1324
1324
|
* A version of a document in Firestore. This corresponds to the version
|
|
1325
1325
|
* timestamp, such as update_time or read_time.
|
|
1326
|
-
*/ class
|
|
1326
|
+
*/ class vt {
|
|
1327
1327
|
constructor(t) {
|
|
1328
1328
|
this.timestamp = t;
|
|
1329
1329
|
}
|
|
1330
1330
|
static fromTimestamp(t) {
|
|
1331
|
-
return new
|
|
1331
|
+
return new vt(t);
|
|
1332
1332
|
}
|
|
1333
1333
|
static min() {
|
|
1334
|
-
return new
|
|
1334
|
+
return new vt(new bt(0, 0));
|
|
1335
1335
|
}
|
|
1336
1336
|
static max() {
|
|
1337
|
-
return new
|
|
1337
|
+
return new vt(new bt(253402300799, 999999999));
|
|
1338
1338
|
}
|
|
1339
1339
|
compareTo(t) {
|
|
1340
1340
|
return this.timestamp._compareTo(t.timestamp);
|
|
@@ -1405,7 +1405,7 @@ function Tt(t, e) {
|
|
|
1405
1405
|
* If foo is not an object, foo is replaced with an object
|
|
1406
1406
|
* containing foo
|
|
1407
1407
|
*/
|
|
1408
|
-
class
|
|
1408
|
+
class At {
|
|
1409
1409
|
constructor(t) {
|
|
1410
1410
|
this.fields = t,
|
|
1411
1411
|
// TODO(dimond): validation of FieldMask
|
|
@@ -1445,7 +1445,7 @@ class It {
|
|
|
1445
1445
|
// WebSafe uses a different URL-encoding safe alphabet that doesn't match
|
|
1446
1446
|
// the encoding used on the backend.
|
|
1447
1447
|
/** Converts a Base64 encoded string to a binary string. */
|
|
1448
|
-
function
|
|
1448
|
+
function It(t) {
|
|
1449
1449
|
return String.fromCharCode.apply(null,
|
|
1450
1450
|
// We use `decodeStringToByteArray()` instead of `decodeString()` since
|
|
1451
1451
|
// `decodeString()` returns Unicode strings, which doesn't match the values
|
|
@@ -1484,7 +1484,7 @@ class Rt {
|
|
|
1484
1484
|
this.binaryString = t;
|
|
1485
1485
|
}
|
|
1486
1486
|
static fromBase64String(t) {
|
|
1487
|
-
const e =
|
|
1487
|
+
const e = It(t);
|
|
1488
1488
|
return new Rt(e);
|
|
1489
1489
|
}
|
|
1490
1490
|
static fromUint8Array(t) {
|
|
@@ -1570,13 +1570,13 @@ const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1570
1570
|
// The json interface (for the browser) will return an iso timestamp string,
|
|
1571
1571
|
// while the proto js library (for node) will return a
|
|
1572
1572
|
// google.protobuf.Timestamp instance.
|
|
1573
|
-
if (
|
|
1573
|
+
if (v(!!t), "string" == typeof t) {
|
|
1574
1574
|
// The date string can have higher precision (nanos) than the Date class
|
|
1575
1575
|
// (millis), so we do some custom parsing here.
|
|
1576
1576
|
// Parse the nanos right out of the string.
|
|
1577
1577
|
let e = 0;
|
|
1578
1578
|
const n = Pt.exec(t);
|
|
1579
|
-
if (
|
|
1579
|
+
if (v(!!n), n[1]) {
|
|
1580
1580
|
// Pad the fraction out to 9 digits (nanos).
|
|
1581
1581
|
let t = n[1];
|
|
1582
1582
|
t = (t + "000000000").substr(0, 9), e = Number(t);
|
|
@@ -1656,9 +1656,9 @@ const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1656
1656
|
|
|
1657
1657
|
/**
|
|
1658
1658
|
* Returns the local time at which this timestamp was first set.
|
|
1659
|
-
*/ function
|
|
1659
|
+
*/ function xt(t) {
|
|
1660
1660
|
const e = Vt(t.mapValue.fields.__local_write_time__.timestampValue);
|
|
1661
|
-
return new
|
|
1661
|
+
return new bt(e.seconds, e.nanos);
|
|
1662
1662
|
}
|
|
1663
1663
|
|
|
1664
1664
|
/**
|
|
@@ -1676,7 +1676,7 @@ const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1676
1676
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1677
1677
|
* See the License for the specific language governing permissions and
|
|
1678
1678
|
* limitations under the License.
|
|
1679
|
-
*/ const
|
|
1679
|
+
*/ const Ft = {
|
|
1680
1680
|
fields: {
|
|
1681
1681
|
__type__: {
|
|
1682
1682
|
stringValue: "__max__"
|
|
@@ -1710,7 +1710,7 @@ function qt(t) {
|
|
|
1710
1710
|
/**
|
|
1711
1711
|
* An ObjectValue represents a MapValue in the Firestore Proto and offers the
|
|
1712
1712
|
* ability to add and remove fields (via the ObjectValueBuilder).
|
|
1713
|
-
*/ (t) ? 9007199254740991 /* MaxValue */ : 10 /* ObjectValue */ :
|
|
1713
|
+
*/ (t) ? 9007199254740991 /* MaxValue */ : 10 /* ObjectValue */ : b();
|
|
1714
1714
|
}
|
|
1715
1715
|
|
|
1716
1716
|
/** Tests `left` and `right` for equality based on the backend semantics. */ function Ot(t, e) {
|
|
@@ -1726,7 +1726,7 @@ function qt(t) {
|
|
|
1726
1726
|
return t.booleanValue === e.booleanValue;
|
|
1727
1727
|
|
|
1728
1728
|
case 4 /* ServerTimestampValue */ :
|
|
1729
|
-
return
|
|
1729
|
+
return xt(t).isEqual(xt(e));
|
|
1730
1730
|
|
|
1731
1731
|
case 3 /* TimestampValue */ :
|
|
1732
1732
|
return function(t, e) {
|
|
@@ -1776,7 +1776,7 @@ function qt(t) {
|
|
|
1776
1776
|
/** Returns true if the ArrayValue contains the specified element. */ (t, e);
|
|
1777
1777
|
|
|
1778
1778
|
default:
|
|
1779
|
-
return
|
|
1779
|
+
return b();
|
|
1780
1780
|
}
|
|
1781
1781
|
}
|
|
1782
1782
|
|
|
@@ -1808,7 +1808,7 @@ function Lt(t, e) {
|
|
|
1808
1808
|
return kt(t.timestampValue, e.timestampValue);
|
|
1809
1809
|
|
|
1810
1810
|
case 4 /* ServerTimestampValue */ :
|
|
1811
|
-
return kt(
|
|
1811
|
+
return kt(xt(t), xt(e));
|
|
1812
1812
|
|
|
1813
1813
|
case 5 /* StringValue */ :
|
|
1814
1814
|
return _t(t.stringValue, e.stringValue);
|
|
@@ -1848,9 +1848,9 @@ function Lt(t, e) {
|
|
|
1848
1848
|
|
|
1849
1849
|
case 10 /* ObjectValue */ :
|
|
1850
1850
|
return function(t, e) {
|
|
1851
|
-
if (t ===
|
|
1852
|
-
if (t ===
|
|
1853
|
-
if (e ===
|
|
1851
|
+
if (t === Ft && e === Ft) return 0;
|
|
1852
|
+
if (t === Ft) return 1;
|
|
1853
|
+
if (e === Ft) return -1;
|
|
1854
1854
|
const n = t.fields || {}, r = Object.keys(n), s = e.fields || {}, i = Object.keys(s);
|
|
1855
1855
|
// Even though MapValues are likely sorted correctly based on their insertion
|
|
1856
1856
|
// order (e.g. when received from the backend), local modifications can bring
|
|
@@ -1868,7 +1868,7 @@ function Lt(t, e) {
|
|
|
1868
1868
|
/** Returns a reference value for the provided database and key. */ (t.mapValue, e.mapValue);
|
|
1869
1869
|
|
|
1870
1870
|
default:
|
|
1871
|
-
throw
|
|
1871
|
+
throw b();
|
|
1872
1872
|
}
|
|
1873
1873
|
}
|
|
1874
1874
|
|
|
@@ -2051,23 +2051,23 @@ class Qt {
|
|
|
2051
2051
|
* Creates a document with no known version or data, but which can serve as
|
|
2052
2052
|
* base document for mutations.
|
|
2053
2053
|
*/ static newInvalidDocument(t) {
|
|
2054
|
-
return new Wt(t, 0 /* INVALID */ ,
|
|
2054
|
+
return new Wt(t, 0 /* INVALID */ , vt.min(), vt.min(), Qt.empty(), 0 /* SYNCED */);
|
|
2055
2055
|
}
|
|
2056
2056
|
/**
|
|
2057
2057
|
* Creates a new document that is known to exist with the given data at the
|
|
2058
2058
|
* given version.
|
|
2059
2059
|
*/ static newFoundDocument(t, e, n) {
|
|
2060
|
-
return new Wt(t, 1 /* FOUND_DOCUMENT */ , e,
|
|
2060
|
+
return new Wt(t, 1 /* FOUND_DOCUMENT */ , e, vt.min(), n, 0 /* SYNCED */);
|
|
2061
2061
|
}
|
|
2062
2062
|
/** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, e) {
|
|
2063
|
-
return new Wt(t, 2 /* NO_DOCUMENT */ , e,
|
|
2063
|
+
return new Wt(t, 2 /* NO_DOCUMENT */ , e, vt.min(), Qt.empty(), 0 /* SYNCED */);
|
|
2064
2064
|
}
|
|
2065
2065
|
/**
|
|
2066
2066
|
* Creates a new document that is known to exist at the given version but
|
|
2067
2067
|
* whose data is not known (e.g. a document that was updated without a known
|
|
2068
2068
|
* base document).
|
|
2069
2069
|
*/ static newUnknownDocument(t, e) {
|
|
2070
|
-
return new Wt(t, 3 /* UNKNOWN_DOCUMENT */ , e,
|
|
2070
|
+
return new Wt(t, 3 /* UNKNOWN_DOCUMENT */ , e, vt.min(), Qt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
2071
2071
|
}
|
|
2072
2072
|
/**
|
|
2073
2073
|
* Changes the document type to indicate that it exists and that its version
|
|
@@ -2206,7 +2206,7 @@ class Kt extends class {} {
|
|
|
2206
2206
|
return t >= 0;
|
|
2207
2207
|
|
|
2208
2208
|
default:
|
|
2209
|
-
return
|
|
2209
|
+
return b();
|
|
2210
2210
|
}
|
|
2211
2211
|
}
|
|
2212
2212
|
D() {
|
|
@@ -2533,7 +2533,7 @@ function pe(t, e) {
|
|
|
2533
2533
|
}
|
|
2534
2534
|
}
|
|
2535
2535
|
|
|
2536
|
-
/** Transforms an array value via a remove operation. */ class
|
|
2536
|
+
/** Transforms an array value via a remove operation. */ class be extends ye {
|
|
2537
2537
|
constructor(t) {
|
|
2538
2538
|
super(), this.elements = t;
|
|
2539
2539
|
}
|
|
@@ -2544,7 +2544,7 @@ function pe(t, e) {
|
|
|
2544
2544
|
* transforms. Converts all field values to integers or doubles, but unlike the
|
|
2545
2545
|
* backend does not cap integer values at 2^63. Instead, JavaScript number
|
|
2546
2546
|
* arithmetic is used and precision loss can occur for values greater than 2^53.
|
|
2547
|
-
*/ class
|
|
2547
|
+
*/ class ve extends ye {
|
|
2548
2548
|
constructor(t, e) {
|
|
2549
2549
|
super(), this.q = t, this.O = e;
|
|
2550
2550
|
}
|
|
@@ -2640,12 +2640,12 @@ function pe(t, e) {
|
|
|
2640
2640
|
* applyToLocalView() to implement the actual behavior of applying the mutation
|
|
2641
2641
|
* to some source document (see `setMutationApplyToRemoteDocument()` for an
|
|
2642
2642
|
* example).
|
|
2643
|
-
*/ class
|
|
2643
|
+
*/ class Ae {}
|
|
2644
2644
|
|
|
2645
2645
|
/**
|
|
2646
2646
|
* A mutation that creates or replaces the document at the given key with the
|
|
2647
2647
|
* object value contents.
|
|
2648
|
-
*/ class
|
|
2648
|
+
*/ class Ie extends Ae {
|
|
2649
2649
|
constructor(t, e, n, r = []) {
|
|
2650
2650
|
super(), this.key = t, this.value = e, this.precondition = n, this.fieldTransforms = r,
|
|
2651
2651
|
this.type = 0 /* Set */;
|
|
@@ -2664,14 +2664,14 @@ function pe(t, e) {
|
|
|
2664
2664
|
* is deleted.
|
|
2665
2665
|
* * When a field is not in the mask but is in the values, the values map is
|
|
2666
2666
|
* ignored.
|
|
2667
|
-
*/ class Re extends
|
|
2667
|
+
*/ class Re extends Ae {
|
|
2668
2668
|
constructor(t, e, n, r, s = []) {
|
|
2669
2669
|
super(), this.key = t, this.data = e, this.fieldMask = n, this.precondition = r,
|
|
2670
2670
|
this.fieldTransforms = s, this.type = 1 /* Patch */;
|
|
2671
2671
|
}
|
|
2672
2672
|
}
|
|
2673
2673
|
|
|
2674
|
-
/** A mutation that deletes the document at the given key. */ class Pe extends
|
|
2674
|
+
/** A mutation that deletes the document at the given key. */ class Pe extends Ae {
|
|
2675
2675
|
constructor(t, e) {
|
|
2676
2676
|
super(), this.key = t, this.precondition = e, this.type = 2 /* Delete */ , this.fieldTransforms = [];
|
|
2677
2677
|
}
|
|
@@ -2683,7 +2683,7 @@ function pe(t, e) {
|
|
|
2683
2683
|
*
|
|
2684
2684
|
* The `verify` operation is only used in Transactions, and this class serves
|
|
2685
2685
|
* primarily to facilitate serialization into protos.
|
|
2686
|
-
*/ class Ve extends
|
|
2686
|
+
*/ class Ve extends Ae {
|
|
2687
2687
|
constructor(t, e) {
|
|
2688
2688
|
super(), this.key = t, this.precondition = e, this.type = 3 /* Verify */ , this.fieldTransforms = [];
|
|
2689
2689
|
}
|
|
@@ -2772,18 +2772,18 @@ function Se(t, e) {
|
|
|
2772
2772
|
*
|
|
2773
2773
|
* Visible for testing.
|
|
2774
2774
|
*/
|
|
2775
|
-
function
|
|
2775
|
+
function xe(t, e) {
|
|
2776
2776
|
return t.F ? e.toBase64() : e.toUint8Array();
|
|
2777
2777
|
}
|
|
2778
2778
|
|
|
2779
|
-
function
|
|
2779
|
+
function Fe(t, e) {
|
|
2780
2780
|
return Se(t, e.toTimestamp());
|
|
2781
2781
|
}
|
|
2782
2782
|
|
|
2783
2783
|
function qe(t) {
|
|
2784
|
-
return
|
|
2784
|
+
return v(!!t), vt.fromTimestamp(function(t) {
|
|
2785
2785
|
const e = Vt(t);
|
|
2786
|
-
return new
|
|
2786
|
+
return new bt(e.seconds, e.nanos);
|
|
2787
2787
|
}(t));
|
|
2788
2788
|
}
|
|
2789
2789
|
|
|
@@ -2800,11 +2800,11 @@ function Ce(t, e) {
|
|
|
2800
2800
|
function Le(t, e) {
|
|
2801
2801
|
const n = function(t) {
|
|
2802
2802
|
const e = Z.fromString(t);
|
|
2803
|
-
return
|
|
2803
|
+
return v(He(e)), e;
|
|
2804
2804
|
}(e);
|
|
2805
2805
|
if (n.get(1) !== t.databaseId.projectId) throw new U(R, "Tried to deserialize key from different project: " + n.get(1) + " vs " + t.databaseId.projectId);
|
|
2806
2806
|
if (n.get(3) !== t.databaseId.database) throw new U(R, "Tried to deserialize key from different database: " + n.get(3) + " vs " + t.databaseId.database);
|
|
2807
|
-
return new nt((
|
|
2807
|
+
return new nt((v((r = n).length > 4 && "documents" === r.get(4)), r.popFirst(5)));
|
|
2808
2808
|
var r;
|
|
2809
2809
|
/** Creates a Document proto from key and fields (but no create/update time) */}
|
|
2810
2810
|
|
|
@@ -2825,7 +2825,7 @@ function je(t, e, n) {
|
|
|
2825
2825
|
|
|
2826
2826
|
function Me(t, e) {
|
|
2827
2827
|
return "found" in e ? function(t, e) {
|
|
2828
|
-
|
|
2828
|
+
v(!!e.found), e.found.name, e.found.updateTime;
|
|
2829
2829
|
const n = Le(t, e.found.name), r = qe(e.found.updateTime), s = new Qt({
|
|
2830
2830
|
mapValue: {
|
|
2831
2831
|
fields: e.found.fields
|
|
@@ -2833,15 +2833,15 @@ function Me(t, e) {
|
|
|
2833
2833
|
});
|
|
2834
2834
|
return Wt.newFoundDocument(n, r, s);
|
|
2835
2835
|
}(t, e) : "missing" in e ? function(t, e) {
|
|
2836
|
-
|
|
2836
|
+
v(!!e.missing), v(!!e.readTime);
|
|
2837
2837
|
const n = Le(t, e.missing), r = qe(e.readTime);
|
|
2838
2838
|
return Wt.newNoDocument(n, r);
|
|
2839
|
-
}(t, e) :
|
|
2839
|
+
}(t, e) : b();
|
|
2840
2840
|
}
|
|
2841
2841
|
|
|
2842
2842
|
function Be(t, e) {
|
|
2843
2843
|
let n;
|
|
2844
|
-
if (e instanceof
|
|
2844
|
+
if (e instanceof Ie) n = {
|
|
2845
2845
|
update: je(t, e.key, e.value)
|
|
2846
2846
|
}; else if (e instanceof Pe) n = {
|
|
2847
2847
|
delete: Ce(t, e.key)
|
|
@@ -2849,7 +2849,7 @@ function Be(t, e) {
|
|
|
2849
2849
|
update: je(t, e.key, e.data),
|
|
2850
2850
|
updateMask: Ye(e.fieldMask)
|
|
2851
2851
|
}; else {
|
|
2852
|
-
if (!(e instanceof Ve)) return
|
|
2852
|
+
if (!(e instanceof Ve)) return b();
|
|
2853
2853
|
n = {
|
|
2854
2854
|
verify: Ce(t, e.key)
|
|
2855
2855
|
};
|
|
@@ -2866,23 +2866,23 @@ function Be(t, e) {
|
|
|
2866
2866
|
values: n.elements
|
|
2867
2867
|
}
|
|
2868
2868
|
};
|
|
2869
|
-
if (n instanceof
|
|
2869
|
+
if (n instanceof be) return {
|
|
2870
2870
|
fieldPath: e.field.canonicalString(),
|
|
2871
2871
|
removeAllFromArray: {
|
|
2872
2872
|
values: n.elements
|
|
2873
2873
|
}
|
|
2874
2874
|
};
|
|
2875
|
-
if (n instanceof
|
|
2875
|
+
if (n instanceof ve) return {
|
|
2876
2876
|
fieldPath: e.field.canonicalString(),
|
|
2877
2877
|
increment: n.O
|
|
2878
2878
|
};
|
|
2879
|
-
throw
|
|
2879
|
+
throw b();
|
|
2880
2880
|
}(0, t)))), e.precondition.isNone || (n.currentDocument = function(t, e) {
|
|
2881
2881
|
return void 0 !== e.updateTime ? {
|
|
2882
|
-
updateTime:
|
|
2882
|
+
updateTime: Fe(t, e.updateTime)
|
|
2883
2883
|
} : void 0 !== e.exists ? {
|
|
2884
2884
|
exists: e.exists
|
|
2885
|
-
} :
|
|
2885
|
+
} : b();
|
|
2886
2886
|
}(t, e.precondition)), n;
|
|
2887
2887
|
}
|
|
2888
2888
|
|
|
@@ -3152,18 +3152,18 @@ class Xe extends class {} {
|
|
|
3152
3152
|
this.J = !1;
|
|
3153
3153
|
}
|
|
3154
3154
|
X() {
|
|
3155
|
-
if (this.J) throw new U(
|
|
3155
|
+
if (this.J) throw new U(x, "The client has already been terminated.");
|
|
3156
3156
|
}
|
|
3157
3157
|
/** Invokes the provided RPC with auth and AppCheck tokens. */ m(t, e, n) {
|
|
3158
3158
|
return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.K.m(t, e, n, r, s))).catch((t => {
|
|
3159
3159
|
throw "FirebaseError" === t.name ? (t.code === $ && (this.authCredentials.invalidateToken(),
|
|
3160
|
-
this.appCheckCredentials.invalidateToken()), t) : new U(
|
|
3160
|
+
this.appCheckCredentials.invalidateToken()), t) : new U(I, t.toString());
|
|
3161
3161
|
}));
|
|
3162
3162
|
}
|
|
3163
3163
|
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ T(t, e, n) {
|
|
3164
3164
|
return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.K.T(t, e, n, r, s))).catch((t => {
|
|
3165
3165
|
throw "FirebaseError" === t.name ? (t.code === $ && (this.authCredentials.invalidateToken(),
|
|
3166
|
-
this.appCheckCredentials.invalidateToken()), t) : new U(
|
|
3166
|
+
this.appCheckCredentials.invalidateToken()), t) : new U(I, t.toString());
|
|
3167
3167
|
}));
|
|
3168
3168
|
}
|
|
3169
3169
|
terminate() {
|
|
@@ -3191,7 +3191,7 @@ async function tn(t, e) {
|
|
|
3191
3191
|
const u = [];
|
|
3192
3192
|
return e.forEach((t => {
|
|
3193
3193
|
const e = o.get(t.toString());
|
|
3194
|
-
|
|
3194
|
+
v(!!e), u.push(e);
|
|
3195
3195
|
})), u;
|
|
3196
3196
|
}
|
|
3197
3197
|
|
|
@@ -3236,7 +3236,7 @@ async function en(t, e) {
|
|
|
3236
3236
|
* instance is terminated.
|
|
3237
3237
|
*/
|
|
3238
3238
|
function rn(t) {
|
|
3239
|
-
if (t._terminated) throw new U(
|
|
3239
|
+
if (t._terminated) throw new U(x, "The client has already been terminated.");
|
|
3240
3240
|
if (!nn.has(t)) {
|
|
3241
3241
|
p("ComponentProvider", "Initializing Datastore");
|
|
3242
3242
|
const i = function(t) {
|
|
@@ -3346,7 +3346,7 @@ class sn {
|
|
|
3346
3346
|
* The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
|
|
3347
3347
|
* instance.
|
|
3348
3348
|
*/ get app() {
|
|
3349
|
-
if (!this._app) throw new U(
|
|
3349
|
+
if (!this._app) throw new U(x, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
|
|
3350
3350
|
return this._app;
|
|
3351
3351
|
}
|
|
3352
3352
|
get _initialized() {
|
|
@@ -3356,14 +3356,14 @@ class sn {
|
|
|
3356
3356
|
return void 0 !== this._terminateTask;
|
|
3357
3357
|
}
|
|
3358
3358
|
_setSettings(t) {
|
|
3359
|
-
if (this._settingsFrozen) throw new U(
|
|
3359
|
+
if (this._settingsFrozen) throw new U(x, "Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");
|
|
3360
3360
|
this._settings = new sn(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
3361
3361
|
if (!t) return new B;
|
|
3362
3362
|
switch (t.type) {
|
|
3363
3363
|
case "gapi":
|
|
3364
3364
|
const e = t.client;
|
|
3365
3365
|
// Make sure this really is a Gapi client.
|
|
3366
|
-
return
|
|
3366
|
+
return v(!("object" != typeof e || null === e || !e.auth || !e.auth.getAuthHeaderValueForFirstParty)),
|
|
3367
3367
|
new W(e, t.sessionIndex || "0", t.iamToken || null);
|
|
3368
3368
|
|
|
3369
3369
|
case "provider":
|
|
@@ -3406,7 +3406,7 @@ class sn {
|
|
|
3406
3406
|
|
|
3407
3407
|
function un(t, e) {
|
|
3408
3408
|
const n = _getProvider(t, "firestore/lite");
|
|
3409
|
-
if (n.isInitialized()) throw new U(
|
|
3409
|
+
if (n.isInitialized()) throw new U(x, "Firestore can only be initialized once per app.");
|
|
3410
3410
|
return n.initialize({
|
|
3411
3411
|
options: e
|
|
3412
3412
|
});
|
|
@@ -3728,7 +3728,7 @@ function pn(t, e, ...n) {
|
|
|
3728
3728
|
/**
|
|
3729
3729
|
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
3730
3730
|
* It can be used in queries to sort or filter by the document ID.
|
|
3731
|
-
*/ function
|
|
3731
|
+
*/ function bn() {
|
|
3732
3732
|
return new gn("__name__");
|
|
3733
3733
|
}
|
|
3734
3734
|
|
|
@@ -3750,7 +3750,7 @@ function pn(t, e, ...n) {
|
|
|
3750
3750
|
*/
|
|
3751
3751
|
/**
|
|
3752
3752
|
* An immutable object representing an array of bytes.
|
|
3753
|
-
*/ class
|
|
3753
|
+
*/ class vn {
|
|
3754
3754
|
/** @hideconstructor */
|
|
3755
3755
|
constructor(t) {
|
|
3756
3756
|
this._byteString = t;
|
|
@@ -3762,7 +3762,7 @@ function pn(t, e, ...n) {
|
|
|
3762
3762
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
3763
3763
|
*/ static fromBase64String(t) {
|
|
3764
3764
|
try {
|
|
3765
|
-
return new
|
|
3765
|
+
return new vn(Rt.fromBase64String(t));
|
|
3766
3766
|
} catch (t) {
|
|
3767
3767
|
throw new U(R, "Failed to construct data from Base64 string: " + t);
|
|
3768
3768
|
}
|
|
@@ -3772,7 +3772,7 @@ function pn(t, e, ...n) {
|
|
|
3772
3772
|
*
|
|
3773
3773
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
3774
3774
|
*/ static fromUint8Array(t) {
|
|
3775
|
-
return new
|
|
3775
|
+
return new vn(Rt.fromUint8Array(t));
|
|
3776
3776
|
}
|
|
3777
3777
|
/**
|
|
3778
3778
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -3915,14 +3915,14 @@ function pn(t, e, ...n) {
|
|
|
3915
3915
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3916
3916
|
* See the License for the specific language governing permissions and
|
|
3917
3917
|
* limitations under the License.
|
|
3918
|
-
*/ const
|
|
3918
|
+
*/ const An = /^__.*__$/;
|
|
3919
3919
|
|
|
3920
|
-
/** The result of parsing document data (e.g. for a setData call). */ class
|
|
3920
|
+
/** The result of parsing document data (e.g. for a setData call). */ class In {
|
|
3921
3921
|
constructor(t, e, n) {
|
|
3922
3922
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
3923
3923
|
}
|
|
3924
3924
|
toMutation(t, e) {
|
|
3925
|
-
return null !== this.fieldMask ? new Re(t, this.data, this.fieldMask, e, this.fieldTransforms) : new
|
|
3925
|
+
return null !== this.fieldMask ? new Re(t, this.data, this.fieldMask, e, this.fieldTransforms) : new Ie(t, this.data, e, this.fieldTransforms);
|
|
3926
3926
|
}
|
|
3927
3927
|
}
|
|
3928
3928
|
|
|
@@ -3951,7 +3951,7 @@ function Pn(t) {
|
|
|
3951
3951
|
return !1;
|
|
3952
3952
|
|
|
3953
3953
|
default:
|
|
3954
|
-
throw
|
|
3954
|
+
throw b();
|
|
3955
3955
|
}
|
|
3956
3956
|
}
|
|
3957
3957
|
|
|
@@ -4026,7 +4026,7 @@ function Pn(t) {
|
|
|
4026
4026
|
}
|
|
4027
4027
|
st(t) {
|
|
4028
4028
|
if (0 === t.length) throw this.ut("Document fields must not be empty");
|
|
4029
|
-
if (Pn(this.tt) &&
|
|
4029
|
+
if (Pn(this.tt) && An.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
|
|
4030
4030
|
}
|
|
4031
4031
|
}
|
|
4032
4032
|
|
|
@@ -4059,16 +4059,16 @@ function Dn(t) {
|
|
|
4059
4059
|
zn("Data must be an object, but it was:", o, r);
|
|
4060
4060
|
const u = Mn(r, o);
|
|
4061
4061
|
let c, a;
|
|
4062
|
-
if (i.merge) c = new
|
|
4062
|
+
if (i.merge) c = new At(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
|
|
4063
4063
|
const t = [];
|
|
4064
4064
|
for (const r of i.mergeFields) {
|
|
4065
4065
|
const s = Gn(e, r, n);
|
|
4066
4066
|
if (!o.contains(s)) throw new U(R, `Field '${s}' is specified in your field mask but missing from your input data.`);
|
|
4067
4067
|
Hn(t, s) || t.push(s);
|
|
4068
4068
|
}
|
|
4069
|
-
c = new
|
|
4069
|
+
c = new At(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
|
|
4070
4070
|
} else c = null, a = o.fieldTransforms;
|
|
4071
|
-
return new
|
|
4071
|
+
return new In(new Qt(u), c, a);
|
|
4072
4072
|
}
|
|
4073
4073
|
|
|
4074
4074
|
class Sn extends En {
|
|
@@ -4098,7 +4098,7 @@ class Sn extends En {
|
|
|
4098
4098
|
* context.
|
|
4099
4099
|
* @param context - The parent context.
|
|
4100
4100
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
4101
|
-
*/ function
|
|
4101
|
+
*/ function xn(t, e, n) {
|
|
4102
4102
|
return new Vn({
|
|
4103
4103
|
tt: 3 /* Argument */ ,
|
|
4104
4104
|
at: e.settings.at,
|
|
@@ -4107,12 +4107,12 @@ class Sn extends En {
|
|
|
4107
4107
|
}, e.databaseId, e.q, e.ignoreUndefinedProperties);
|
|
4108
4108
|
}
|
|
4109
4109
|
|
|
4110
|
-
class
|
|
4110
|
+
class Fn extends En {
|
|
4111
4111
|
_toFieldTransform(t) {
|
|
4112
4112
|
return new Ee(t.path, new _e);
|
|
4113
4113
|
}
|
|
4114
4114
|
isEqual(t) {
|
|
4115
|
-
return t instanceof
|
|
4115
|
+
return t instanceof Fn;
|
|
4116
4116
|
}
|
|
4117
4117
|
}
|
|
4118
4118
|
|
|
@@ -4121,7 +4121,7 @@ class qn extends En {
|
|
|
4121
4121
|
super(t), this.lt = e;
|
|
4122
4122
|
}
|
|
4123
4123
|
_toFieldTransform(t) {
|
|
4124
|
-
const e =
|
|
4124
|
+
const e = xn(this, t,
|
|
4125
4125
|
/*array=*/ !0), n = this.lt.map((t => jn(t, e))), r = new ge(n);
|
|
4126
4126
|
return new Ee(t.path, r);
|
|
4127
4127
|
}
|
|
@@ -4136,8 +4136,8 @@ class On extends En {
|
|
|
4136
4136
|
super(t), this.lt = e;
|
|
4137
4137
|
}
|
|
4138
4138
|
_toFieldTransform(t) {
|
|
4139
|
-
const e =
|
|
4140
|
-
/*array=*/ !0), n = this.lt.map((t => jn(t, e))), r = new
|
|
4139
|
+
const e = xn(this, t,
|
|
4140
|
+
/*array=*/ !0), n = this.lt.map((t => jn(t, e))), r = new be(n);
|
|
4141
4141
|
return new Ee(t.path, r);
|
|
4142
4142
|
}
|
|
4143
4143
|
isEqual(t) {
|
|
@@ -4151,7 +4151,7 @@ class Cn extends En {
|
|
|
4151
4151
|
super(t), this.ft = e;
|
|
4152
4152
|
}
|
|
4153
4153
|
_toFieldTransform(t) {
|
|
4154
|
-
const e = new
|
|
4154
|
+
const e = new ve(t.q, pe(t.q, this.ft));
|
|
4155
4155
|
return new Ee(t.path, e);
|
|
4156
4156
|
}
|
|
4157
4157
|
isEqual(t) {
|
|
@@ -4177,7 +4177,7 @@ class Cn extends En {
|
|
|
4177
4177
|
null != t && (i.push(u), o.set(u, t));
|
|
4178
4178
|
}
|
|
4179
4179
|
}));
|
|
4180
|
-
const u = new
|
|
4180
|
+
const u = new At(i);
|
|
4181
4181
|
return new Rn(o, u, s.fieldTransforms);
|
|
4182
4182
|
}
|
|
4183
4183
|
|
|
@@ -4202,7 +4202,7 @@ class Cn extends En {
|
|
|
4202
4202
|
null != t && (a.push(e), h.set(e, t));
|
|
4203
4203
|
}
|
|
4204
4204
|
}
|
|
4205
|
-
const f = new
|
|
4205
|
+
const f = new At(a);
|
|
4206
4206
|
return new Rn(h, f, o.fieldTransforms);
|
|
4207
4207
|
}
|
|
4208
4208
|
|
|
@@ -4298,16 +4298,16 @@ class Cn extends En {
|
|
|
4298
4298
|
stringValue: t
|
|
4299
4299
|
};
|
|
4300
4300
|
if (t instanceof Date) {
|
|
4301
|
-
const n =
|
|
4301
|
+
const n = bt.fromDate(t);
|
|
4302
4302
|
return {
|
|
4303
4303
|
timestampValue: Se(e.q, n)
|
|
4304
4304
|
};
|
|
4305
4305
|
}
|
|
4306
|
-
if (t instanceof
|
|
4306
|
+
if (t instanceof bt) {
|
|
4307
4307
|
// Firestore backend truncates precision down to microseconds. To ensure
|
|
4308
4308
|
// offline mode works the same with regards to truncation, perform the
|
|
4309
4309
|
// truncation immediately without waiting for the backend to do that.
|
|
4310
|
-
const n = new
|
|
4310
|
+
const n = new bt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
4311
4311
|
return {
|
|
4312
4312
|
timestampValue: Se(e.q, n)
|
|
4313
4313
|
};
|
|
@@ -4318,8 +4318,8 @@ class Cn extends En {
|
|
|
4318
4318
|
longitude: t.longitude
|
|
4319
4319
|
}
|
|
4320
4320
|
};
|
|
4321
|
-
if (t instanceof
|
|
4322
|
-
bytesValue:
|
|
4321
|
+
if (t instanceof vn) return {
|
|
4322
|
+
bytesValue: xe(e.q, t._byteString)
|
|
4323
4323
|
};
|
|
4324
4324
|
if (t instanceof ln) {
|
|
4325
4325
|
const n = e.databaseId, r = t.firestore._databaseId;
|
|
@@ -4358,7 +4358,7 @@ function Mn(t, e) {
|
|
|
4358
4358
|
}
|
|
4359
4359
|
|
|
4360
4360
|
function Bn(t) {
|
|
4361
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof
|
|
4361
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof bt || t instanceof Tn || t instanceof vn || t instanceof ln || t instanceof En);
|
|
4362
4362
|
}
|
|
4363
4363
|
|
|
4364
4364
|
function zn(t, e, n) {
|
|
@@ -4760,12 +4760,12 @@ class ir extends er {
|
|
|
4760
4760
|
|
|
4761
4761
|
class ur extends er {
|
|
4762
4762
|
constructor(t, e, n) {
|
|
4763
|
-
super(), this.type = t, this.gt = e, this.
|
|
4763
|
+
super(), this.type = t, this.gt = e, this.bt = n;
|
|
4764
4764
|
}
|
|
4765
4765
|
_apply(t) {
|
|
4766
4766
|
return new fn(t.firestore, t.converter, function(t, e, n) {
|
|
4767
4767
|
return new ae(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
4768
|
-
}(t._query, this.gt, this.
|
|
4768
|
+
}(t._query, this.gt, this.bt));
|
|
4769
4769
|
}
|
|
4770
4770
|
}
|
|
4771
4771
|
|
|
@@ -4792,10 +4792,10 @@ class ur extends er {
|
|
|
4792
4792
|
|
|
4793
4793
|
class hr extends er {
|
|
4794
4794
|
constructor(t, e, n) {
|
|
4795
|
-
super(), this.type = t, this.
|
|
4795
|
+
super(), this.type = t, this.vt = e, this.Et = n;
|
|
4796
4796
|
}
|
|
4797
4797
|
_apply(t) {
|
|
4798
|
-
const e = pr(t, this.type, this.
|
|
4798
|
+
const e = pr(t, this.type, this.vt, this.Et);
|
|
4799
4799
|
return new fn(t.firestore, t.converter, function(t, e) {
|
|
4800
4800
|
return new ae(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
4801
4801
|
}(t._query, e));
|
|
@@ -4814,10 +4814,10 @@ function fr(...t) {
|
|
|
4814
4814
|
|
|
4815
4815
|
class dr extends er {
|
|
4816
4816
|
constructor(t, e, n) {
|
|
4817
|
-
super(), this.type = t, this.
|
|
4817
|
+
super(), this.type = t, this.vt = e, this.Et = n;
|
|
4818
4818
|
}
|
|
4819
4819
|
_apply(t) {
|
|
4820
|
-
const e = pr(t, this.type, this.
|
|
4820
|
+
const e = pr(t, this.type, this.vt, this.Et);
|
|
4821
4821
|
return new fn(t.firestore, t.converter, function(t, e) {
|
|
4822
4822
|
return new ae(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
4823
4823
|
}(t._query, e));
|
|
@@ -4960,7 +4960,7 @@ function gr(t, e, n) {
|
|
|
4960
4960
|
* their `set()` or fails due to invalid data originating from a `toFirestore()`
|
|
4961
4961
|
* call.
|
|
4962
4962
|
*/
|
|
4963
|
-
function
|
|
4963
|
+
function br(t, e, n) {
|
|
4964
4964
|
let r;
|
|
4965
4965
|
// Cast to `any` in order to satisfy the union type constraint on
|
|
4966
4966
|
// toFirestore().
|
|
@@ -4969,7 +4969,7 @@ function vr(t, e, n) {
|
|
|
4969
4969
|
r;
|
|
4970
4970
|
}
|
|
4971
4971
|
|
|
4972
|
-
class
|
|
4972
|
+
class vr extends class {
|
|
4973
4973
|
convertValue(t, e = "none") {
|
|
4974
4974
|
switch (qt(t)) {
|
|
4975
4975
|
case 0 /* NullValue */ :
|
|
@@ -5006,7 +5006,7 @@ class br extends class {
|
|
|
5006
5006
|
return this.convertObject(t.mapValue, e);
|
|
5007
5007
|
|
|
5008
5008
|
default:
|
|
5009
|
-
throw
|
|
5009
|
+
throw b();
|
|
5010
5010
|
}
|
|
5011
5011
|
}
|
|
5012
5012
|
convertObject(t, e) {
|
|
@@ -5028,7 +5028,7 @@ class br extends class {
|
|
|
5028
5028
|
return null == n ? null : this.convertValue(n, e);
|
|
5029
5029
|
|
|
5030
5030
|
case "estimate":
|
|
5031
|
-
return this.convertTimestamp(
|
|
5031
|
+
return this.convertTimestamp(xt(t));
|
|
5032
5032
|
|
|
5033
5033
|
default:
|
|
5034
5034
|
return null;
|
|
@@ -5036,11 +5036,11 @@ class br extends class {
|
|
|
5036
5036
|
}
|
|
5037
5037
|
convertTimestamp(t) {
|
|
5038
5038
|
const e = Vt(t);
|
|
5039
|
-
return new
|
|
5039
|
+
return new bt(e.seconds, e.nanos);
|
|
5040
5040
|
}
|
|
5041
5041
|
convertDocumentKey(t, e) {
|
|
5042
5042
|
const n = Z.fromString(t);
|
|
5043
|
-
|
|
5043
|
+
v(He(n));
|
|
5044
5044
|
const r = new J(n.get(1), n.get(3)), s = new nt(n.popFirst(5));
|
|
5045
5045
|
return r.isEqual(e) ||
|
|
5046
5046
|
// TODO(b/64130202): Somehow support foreign references.
|
|
@@ -5052,7 +5052,7 @@ class br extends class {
|
|
|
5052
5052
|
super(), this.firestore = t;
|
|
5053
5053
|
}
|
|
5054
5054
|
convertBytes(t) {
|
|
5055
|
-
return new
|
|
5055
|
+
return new vn(t);
|
|
5056
5056
|
}
|
|
5057
5057
|
convertReference(t) {
|
|
5058
5058
|
const e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
@@ -5073,9 +5073,9 @@ class br extends class {
|
|
|
5073
5073
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the current
|
|
5074
5074
|
* document contents.
|
|
5075
5075
|
*/ function Er(t) {
|
|
5076
|
-
const e = rn((t = ut(t, ln)).firestore), n = new
|
|
5076
|
+
const e = rn((t = ut(t, ln)).firestore), n = new vr(t.firestore);
|
|
5077
5077
|
return tn(e, [ t._key ]).then((e => {
|
|
5078
|
-
|
|
5078
|
+
v(1 === e.length);
|
|
5079
5079
|
const r = e[0];
|
|
5080
5080
|
return new Kn(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
|
|
5081
5081
|
}));
|
|
@@ -5096,7 +5096,7 @@ class br extends class {
|
|
|
5096
5096
|
!function(t) {
|
|
5097
5097
|
if ("L" /* Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new U(O, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
5098
5098
|
}((t = ut(t, fn))._query);
|
|
5099
|
-
const e = rn(t.firestore), n = new
|
|
5099
|
+
const e = rn(t.firestore), n = new vr(t.firestore);
|
|
5100
5100
|
return en(e, t._query).then((e => {
|
|
5101
5101
|
const r = e.map((e => new Jn(t.firestore, n, e.key, e, t.converter)));
|
|
5102
5102
|
return "L" /* Last */ === t._query.limitType &&
|
|
@@ -5107,12 +5107,12 @@ class br extends class {
|
|
|
5107
5107
|
}));
|
|
5108
5108
|
}
|
|
5109
5109
|
|
|
5110
|
-
function
|
|
5111
|
-
const r =
|
|
5110
|
+
function Ar(t, e, n) {
|
|
5111
|
+
const r = br((t = ut(t, ln)).converter, e, n), s = $n(Dn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
|
|
5112
5112
|
return Ze(rn(t.firestore), [ s.toMutation(t._key, Te.none()) ]);
|
|
5113
5113
|
}
|
|
5114
5114
|
|
|
5115
|
-
function
|
|
5115
|
+
function Ir(t, e, n, ...r) {
|
|
5116
5116
|
const s = Dn((t = ut(t, ln)).firestore);
|
|
5117
5117
|
// For Compat types, we have to "extract" the underlying types before
|
|
5118
5118
|
// performing validation.
|
|
@@ -5151,7 +5151,7 @@ function Ar(t, e, n, ...r) {
|
|
|
5151
5151
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
5152
5152
|
* newly created document after it has been written to the backend.
|
|
5153
5153
|
*/ function Pr(t, e) {
|
|
5154
|
-
const n = pn(t = ut(t, dn)), r =
|
|
5154
|
+
const n = pn(t = ut(t, dn)), r = br(t.converter, e), s = $n(Dn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
|
|
5155
5155
|
return Ze(rn(t.firestore), [ s.toMutation(n._key, Te.exists(!1)) ]).then((() => n));
|
|
5156
5156
|
}
|
|
5157
5157
|
|
|
@@ -5182,7 +5182,7 @@ function Ar(t, e, n, ...r) {
|
|
|
5182
5182
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
5183
5183
|
* include a server-generated timestamp in the written data.
|
|
5184
5184
|
*/ function Nr() {
|
|
5185
|
-
return new
|
|
5185
|
+
return new Fn("serverTimestamp");
|
|
5186
5186
|
}
|
|
5187
5187
|
|
|
5188
5188
|
/**
|
|
@@ -5263,7 +5263,7 @@ function Ar(t, e, n, ...r) {
|
|
|
5263
5263
|
* provides methods for adding writes to the write batch. None of the writes
|
|
5264
5264
|
* will be committed (or visible locally) until {@link WriteBatch.commit} is
|
|
5265
5265
|
* called.
|
|
5266
|
-
*/ class
|
|
5266
|
+
*/ class xr {
|
|
5267
5267
|
/** @hideconstructor */
|
|
5268
5268
|
constructor(t, e) {
|
|
5269
5269
|
this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
|
|
@@ -5271,12 +5271,12 @@ function Ar(t, e, n, ...r) {
|
|
|
5271
5271
|
}
|
|
5272
5272
|
set(t, e, n) {
|
|
5273
5273
|
this._verifyNotCommitted();
|
|
5274
|
-
const r =
|
|
5274
|
+
const r = Fr(t, this._firestore), s = br(r.converter, e, n), i = $n(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, n);
|
|
5275
5275
|
return this._mutations.push(i.toMutation(r._key, Te.none())), this;
|
|
5276
5276
|
}
|
|
5277
5277
|
update(t, e, n, ...r) {
|
|
5278
5278
|
this._verifyNotCommitted();
|
|
5279
|
-
const s =
|
|
5279
|
+
const s = Fr(t, this._firestore);
|
|
5280
5280
|
// For Compat types, we have to "extract" the underlying types before
|
|
5281
5281
|
// performing validation.
|
|
5282
5282
|
let i;
|
|
@@ -5290,7 +5290,7 @@ function Ar(t, e, n, ...r) {
|
|
|
5290
5290
|
* @returns This `WriteBatch` instance. Used for chaining method calls.
|
|
5291
5291
|
*/ delete(t) {
|
|
5292
5292
|
this._verifyNotCommitted();
|
|
5293
|
-
const e =
|
|
5293
|
+
const e = Fr(t, this._firestore);
|
|
5294
5294
|
return this._mutations = this._mutations.concat(new Pe(e._key, Te.none())), this;
|
|
5295
5295
|
}
|
|
5296
5296
|
/**
|
|
@@ -5308,11 +5308,11 @@ function Ar(t, e, n, ...r) {
|
|
|
5308
5308
|
return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve();
|
|
5309
5309
|
}
|
|
5310
5310
|
_verifyNotCommitted() {
|
|
5311
|
-
if (this._committed) throw new U(
|
|
5311
|
+
if (this._committed) throw new U(x, "A write batch can no longer be used after commit() has been called.");
|
|
5312
5312
|
}
|
|
5313
5313
|
}
|
|
5314
5314
|
|
|
5315
|
-
function
|
|
5315
|
+
function Fr(t, e) {
|
|
5316
5316
|
if ((t = l(t)).firestore !== e) throw new U(R, "Provided document reference is from a different Firestore instance.");
|
|
5317
5317
|
return t;
|
|
5318
5318
|
}
|
|
@@ -5331,7 +5331,7 @@ function xr(t, e) {
|
|
|
5331
5331
|
* writes.
|
|
5332
5332
|
*/ function qr(t) {
|
|
5333
5333
|
const e = rn(t = ut(t, on));
|
|
5334
|
-
return new
|
|
5334
|
+
return new xr(t, (t => Ze(e, t)));
|
|
5335
5335
|
}
|
|
5336
5336
|
|
|
5337
5337
|
/**
|
|
@@ -5407,15 +5407,15 @@ function xr(t, e) {
|
|
|
5407
5407
|
recordVersion(t) {
|
|
5408
5408
|
let e;
|
|
5409
5409
|
if (t.isFoundDocument()) e = t.version; else {
|
|
5410
|
-
if (!t.isNoDocument()) throw
|
|
5410
|
+
if (!t.isNoDocument()) throw b();
|
|
5411
5411
|
// For deleted docs, we must use baseVersion 0 when we overwrite them.
|
|
5412
|
-
e =
|
|
5412
|
+
e = vt.min();
|
|
5413
5413
|
}
|
|
5414
5414
|
const n = this.readVersions.get(t.key.toString());
|
|
5415
5415
|
if (n) {
|
|
5416
5416
|
if (!e.isEqual(n))
|
|
5417
5417
|
// This transaction will fail no matter what.
|
|
5418
|
-
throw new U(
|
|
5418
|
+
throw new U(F, "Document version changed between two reads.");
|
|
5419
5419
|
} else this.readVersions.set(t.key.toString(), e);
|
|
5420
5420
|
}
|
|
5421
5421
|
/**
|
|
@@ -5432,7 +5432,7 @@ function xr(t, e) {
|
|
|
5432
5432
|
// The first time a document is written, we want to take into account the
|
|
5433
5433
|
// read time and existence
|
|
5434
5434
|
if (!this.writtenDocs.has(t.toString()) && e) {
|
|
5435
|
-
if (e.isEqual(
|
|
5435
|
+
if (e.isEqual(vt.min()))
|
|
5436
5436
|
// The document doesn't exist, so fail the transaction.
|
|
5437
5437
|
// This has to be validated locally because you can't send a
|
|
5438
5438
|
// precondition that a document does not exist without changing the
|
|
@@ -5456,6 +5456,25 @@ function xr(t, e) {
|
|
|
5456
5456
|
ensureCommitNotCalled() {}
|
|
5457
5457
|
}
|
|
5458
5458
|
|
|
5459
|
+
/**
|
|
5460
|
+
* @license
|
|
5461
|
+
* Copyright 2022 Google LLC
|
|
5462
|
+
*
|
|
5463
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5464
|
+
* you may not use this file except in compliance with the License.
|
|
5465
|
+
* You may obtain a copy of the License at
|
|
5466
|
+
*
|
|
5467
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5468
|
+
*
|
|
5469
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5470
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5471
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5472
|
+
* See the License for the specific language governing permissions and
|
|
5473
|
+
* limitations under the License.
|
|
5474
|
+
*/ const Cr = {
|
|
5475
|
+
maxAttempts: 5
|
|
5476
|
+
};
|
|
5477
|
+
|
|
5459
5478
|
/**
|
|
5460
5479
|
* @license
|
|
5461
5480
|
* Copyright 2019 Google LLC
|
|
@@ -5476,16 +5495,16 @@ function xr(t, e) {
|
|
|
5476
5495
|
* TransactionRunner encapsulates the logic needed to run and retry transactions
|
|
5477
5496
|
* with backoff.
|
|
5478
5497
|
*/
|
|
5479
|
-
class
|
|
5480
|
-
constructor(t, e, n, r) {
|
|
5481
|
-
this.asyncQueue = t, this.datastore = e, this.
|
|
5482
|
-
this.Tt =
|
|
5498
|
+
class Lr {
|
|
5499
|
+
constructor(t, e, n, r, s) {
|
|
5500
|
+
this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = r,
|
|
5501
|
+
this.deferred = s, this.Tt = n.maxAttempts, this.At = new Je(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
5483
5502
|
}
|
|
5484
5503
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
5485
|
-
this.Tt -= 1, this.
|
|
5504
|
+
this.Tt -= 1, this.It();
|
|
5486
5505
|
}
|
|
5487
|
-
|
|
5488
|
-
this.
|
|
5506
|
+
It() {
|
|
5507
|
+
this.At.W((async () => {
|
|
5489
5508
|
const t = new Or(this.datastore), e = this.Rt(t);
|
|
5490
5509
|
e && e.then((e => {
|
|
5491
5510
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
@@ -5509,7 +5528,7 @@ class Cr {
|
|
|
5509
5528
|
}
|
|
5510
5529
|
}
|
|
5511
5530
|
Pt(t) {
|
|
5512
|
-
this.Tt > 0 && this.Vt(t) ? (this.Tt -= 1, this.asyncQueue.enqueueAndForget((() => (this.
|
|
5531
|
+
this.Tt > 0 && this.Vt(t) ? (this.Tt -= 1, this.asyncQueue.enqueueAndForget((() => (this.It(),
|
|
5513
5532
|
Promise.resolve())))) : this.deferred.reject(t);
|
|
5514
5533
|
}
|
|
5515
5534
|
Vt(t) {
|
|
@@ -5527,10 +5546,10 @@ class Cr {
|
|
|
5527
5546
|
function(t) {
|
|
5528
5547
|
switch (t) {
|
|
5529
5548
|
default:
|
|
5530
|
-
return
|
|
5549
|
+
return b();
|
|
5531
5550
|
|
|
5532
|
-
case I:
|
|
5533
5551
|
case A:
|
|
5552
|
+
case I:
|
|
5534
5553
|
case P:
|
|
5535
5554
|
case S:
|
|
5536
5555
|
case C:
|
|
@@ -5544,11 +5563,11 @@ class Cr {
|
|
|
5544
5563
|
case V:
|
|
5545
5564
|
case N:
|
|
5546
5565
|
case D:
|
|
5547
|
-
case
|
|
5566
|
+
case x:
|
|
5548
5567
|
// Aborted might be retried in some scenarios, but that is dependant on
|
|
5549
5568
|
// the context and should handled individually by the calling code.
|
|
5550
5569
|
// See https://cloud.google.com/apis/design/errors.
|
|
5551
|
-
case
|
|
5570
|
+
case F:
|
|
5552
5571
|
case q:
|
|
5553
5572
|
case O:
|
|
5554
5573
|
case k:
|
|
@@ -5576,7 +5595,7 @@ class Cr {
|
|
|
5576
5595
|
* See the License for the specific language governing permissions and
|
|
5577
5596
|
* limitations under the License.
|
|
5578
5597
|
*/
|
|
5579
|
-
/** The Platform's 'document' implementation or null if not available. */ function
|
|
5598
|
+
/** The Platform's 'document' implementation or null if not available. */ function kr() {
|
|
5580
5599
|
// `document` is not always available, e.g. in ReactNative and WebWorkers.
|
|
5581
5600
|
// eslint-disable-next-line no-restricted-globals
|
|
5582
5601
|
return "undefined" != typeof document ? document : null;
|
|
@@ -5608,7 +5627,7 @@ class Cr {
|
|
|
5608
5627
|
* Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
|
|
5609
5628
|
* in newer versions of TypeScript defines `finally`, which is not available in
|
|
5610
5629
|
* IE.
|
|
5611
|
-
*/ class
|
|
5630
|
+
*/ class Ur {
|
|
5612
5631
|
constructor(t, e, n, r, s) {
|
|
5613
5632
|
this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = r, this.removalCallback = s,
|
|
5614
5633
|
this.deferred = new j, this.then = this.deferred.promise.then.bind(this.deferred.promise),
|
|
@@ -5631,7 +5650,7 @@ class Cr {
|
|
|
5631
5650
|
* PORTING NOTE: This exists to prevent making removeDelayedOperation() and
|
|
5632
5651
|
* the DelayedOperation class public.
|
|
5633
5652
|
*/ static createAndSchedule(t, e, n, r, s) {
|
|
5634
|
-
const i = Date.now() + n, o = new
|
|
5653
|
+
const i = Date.now() + n, o = new Ur(t, e, i, r, s);
|
|
5635
5654
|
return o.start(n), o;
|
|
5636
5655
|
}
|
|
5637
5656
|
/**
|
|
@@ -5653,7 +5672,7 @@ class Cr {
|
|
|
5653
5672
|
* As long as the operation has not yet been run, calling cancel() provides a
|
|
5654
5673
|
* guarantee that the operation will not be run.
|
|
5655
5674
|
*/ cancel(t) {
|
|
5656
|
-
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new U(
|
|
5675
|
+
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new U(A, "Operation cancelled" + (t ? ": " + t : ""))));
|
|
5657
5676
|
}
|
|
5658
5677
|
handleDelayElapsed() {
|
|
5659
5678
|
this.asyncQueue.enqueueAndForget((() => null !== this.timerHandle ? (this.clearTimeout(),
|
|
@@ -5680,7 +5699,7 @@ class Cr {
|
|
|
5680
5699
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5681
5700
|
* See the License for the specific language governing permissions and
|
|
5682
5701
|
* limitations under the License.
|
|
5683
|
-
*/ class
|
|
5702
|
+
*/ class jr {
|
|
5684
5703
|
constructor() {
|
|
5685
5704
|
// The last promise in the queue.
|
|
5686
5705
|
this.Nt = Promise.resolve(),
|
|
@@ -5694,24 +5713,24 @@ class Cr {
|
|
|
5694
5713
|
// automatically removed after they are run or canceled.
|
|
5695
5714
|
this.St = [],
|
|
5696
5715
|
// visible for testing
|
|
5697
|
-
this.
|
|
5716
|
+
this.xt = null,
|
|
5698
5717
|
// Flag set while there's an outstanding AsyncQueue operation, used for
|
|
5699
5718
|
// assertion sanity-checks.
|
|
5700
|
-
this.
|
|
5719
|
+
this.Ft = !1,
|
|
5701
5720
|
// Enabled during shutdown on Safari to prevent future access to IndexedDB.
|
|
5702
5721
|
this.qt = !1,
|
|
5703
5722
|
// List of TimerIds to fast-forward delays for.
|
|
5704
5723
|
this.Ot = [],
|
|
5705
5724
|
// Backoff timer used to schedule retries for retryable operations
|
|
5706
|
-
this.
|
|
5725
|
+
this.At = new Je(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
5707
5726
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
5708
5727
|
// operations. Meant to speed up recovery when we regain file system access
|
|
5709
5728
|
// after page comes into foreground.
|
|
5710
5729
|
this.Ct = () => {
|
|
5711
|
-
const t =
|
|
5712
|
-
t && p("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.
|
|
5730
|
+
const t = kr();
|
|
5731
|
+
t && p("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.At.H();
|
|
5713
5732
|
};
|
|
5714
|
-
const t =
|
|
5733
|
+
const t = kr();
|
|
5715
5734
|
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Ct);
|
|
5716
5735
|
}
|
|
5717
5736
|
get isShuttingDown() {
|
|
@@ -5732,7 +5751,7 @@ class Cr {
|
|
|
5732
5751
|
enterRestrictedMode(t) {
|
|
5733
5752
|
if (!this.$t) {
|
|
5734
5753
|
this.$t = !0, this.qt = t || !1;
|
|
5735
|
-
const e =
|
|
5754
|
+
const e = kr();
|
|
5736
5755
|
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Ct);
|
|
5737
5756
|
}
|
|
5738
5757
|
}
|
|
@@ -5756,7 +5775,7 @@ class Cr {
|
|
|
5756
5775
|
*/ async Ut() {
|
|
5757
5776
|
if (0 !== this.Dt.length) {
|
|
5758
5777
|
try {
|
|
5759
|
-
await this.Dt[0](), this.Dt.shift(), this.
|
|
5778
|
+
await this.Dt[0](), this.Dt.shift(), this.At.reset();
|
|
5760
5779
|
} catch (t) {
|
|
5761
5780
|
if (!
|
|
5762
5781
|
/**
|
|
@@ -5811,12 +5830,12 @@ class Cr {
|
|
|
5811
5830
|
// Since `backoffAndRun()` cancels an existing backoff and schedules a
|
|
5812
5831
|
// new backoff on every call, there is only ever a single additional
|
|
5813
5832
|
// operation in the queue.
|
|
5814
|
-
this.
|
|
5833
|
+
this.At.W((() => this.Ut()));
|
|
5815
5834
|
}
|
|
5816
5835
|
}
|
|
5817
5836
|
kt(t) {
|
|
5818
|
-
const e = this.Nt.then((() => (this.
|
|
5819
|
-
this.
|
|
5837
|
+
const e = this.Nt.then((() => (this.Ft = !0, t().catch((t => {
|
|
5838
|
+
this.xt = t, this.Ft = !1;
|
|
5820
5839
|
const e =
|
|
5821
5840
|
/**
|
|
5822
5841
|
* Chrome includes Error.message in Error.stack. Other browsers do not.
|
|
@@ -5857,18 +5876,18 @@ class Cr {
|
|
|
5857
5876
|
// all further attempts to chain (via .then) will just short-circuit
|
|
5858
5877
|
// and return the rejected Promise.
|
|
5859
5878
|
throw y("INTERNAL UNHANDLED ERROR: ", e), t;
|
|
5860
|
-
})).then((t => (this.
|
|
5879
|
+
})).then((t => (this.Ft = !1, t))))));
|
|
5861
5880
|
return this.Nt = e, e;
|
|
5862
5881
|
}
|
|
5863
5882
|
enqueueAfterDelay(t, e, n) {
|
|
5864
5883
|
this.Lt(),
|
|
5865
5884
|
// Fast-forward delays for timerIds that have been overriden.
|
|
5866
5885
|
this.Ot.indexOf(t) > -1 && (e = 0);
|
|
5867
|
-
const r =
|
|
5886
|
+
const r = Ur.createAndSchedule(this, t, e, n, (t => this.jt(t)));
|
|
5868
5887
|
return this.St.push(r), r;
|
|
5869
5888
|
}
|
|
5870
5889
|
Lt() {
|
|
5871
|
-
this.
|
|
5890
|
+
this.xt && b();
|
|
5872
5891
|
}
|
|
5873
5892
|
verifyOperationInProgress() {}
|
|
5874
5893
|
/**
|
|
@@ -5918,7 +5937,7 @@ class Cr {
|
|
|
5918
5937
|
}
|
|
5919
5938
|
}
|
|
5920
5939
|
|
|
5921
|
-
class
|
|
5940
|
+
class Mr {
|
|
5922
5941
|
/** @hideconstructor */
|
|
5923
5942
|
constructor(t, e) {
|
|
5924
5943
|
this._firestore = t, this._transaction = e, this._dataReader = Dn(t);
|
|
@@ -5929,21 +5948,21 @@ class jr {
|
|
|
5929
5948
|
* @param documentRef - A reference to the document to be read.
|
|
5930
5949
|
* @returns A `DocumentSnapshot` with the read data.
|
|
5931
5950
|
*/ get(t) {
|
|
5932
|
-
const e =
|
|
5951
|
+
const e = Fr(t, this._firestore), n = new vr(this._firestore);
|
|
5933
5952
|
return this._transaction.lookup([ e._key ]).then((t => {
|
|
5934
|
-
if (!t || 1 !== t.length) return
|
|
5953
|
+
if (!t || 1 !== t.length) return b();
|
|
5935
5954
|
const r = t[0];
|
|
5936
5955
|
if (r.isFoundDocument()) return new Kn(this._firestore, n, r.key, r, e.converter);
|
|
5937
5956
|
if (r.isNoDocument()) return new Kn(this._firestore, n, e._key, null, e.converter);
|
|
5938
|
-
throw
|
|
5957
|
+
throw b();
|
|
5939
5958
|
}));
|
|
5940
5959
|
}
|
|
5941
5960
|
set(t, e, n) {
|
|
5942
|
-
const r =
|
|
5961
|
+
const r = Fr(t, this._firestore), s = br(r.converter, e, n), i = $n(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, n);
|
|
5943
5962
|
return this._transaction.set(r._key, i), this;
|
|
5944
5963
|
}
|
|
5945
5964
|
update(t, e, n, ...r) {
|
|
5946
|
-
const s =
|
|
5965
|
+
const s = Fr(t, this._firestore);
|
|
5947
5966
|
// For Compat types, we have to "extract" the underlying types before
|
|
5948
5967
|
// performing validation.
|
|
5949
5968
|
let i;
|
|
@@ -5956,7 +5975,7 @@ class jr {
|
|
|
5956
5975
|
* @param documentRef - A reference to the document to be deleted.
|
|
5957
5976
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
5958
5977
|
*/ delete(t) {
|
|
5959
|
-
const e =
|
|
5978
|
+
const e = Fr(t, this._firestore);
|
|
5960
5979
|
return this._transaction.delete(e._key), this;
|
|
5961
5980
|
}
|
|
5962
5981
|
}
|
|
@@ -5977,9 +5996,13 @@ class jr {
|
|
|
5977
5996
|
* (the `updateFunction` returned a failed promise), the promise returned by the
|
|
5978
5997
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
5979
5998
|
* rejected promise with the corresponding failure error is returned.
|
|
5980
|
-
*/ function
|
|
5981
|
-
const
|
|
5982
|
-
|
|
5999
|
+
*/ function Br(t, e, n) {
|
|
6000
|
+
const r = rn(t = ut(t, on)), s = Object.assign(Object.assign({}, Cr), n);
|
|
6001
|
+
!function(t) {
|
|
6002
|
+
if (t.maxAttempts < 1) throw new U(R, "Max attempts must be at least 1");
|
|
6003
|
+
}(s);
|
|
6004
|
+
const i = new j;
|
|
6005
|
+
return new Lr(new jr, r, s, (n => e(new Mr(t, n))), i).run(), i.promise;
|
|
5983
6006
|
}
|
|
5984
6007
|
|
|
5985
6008
|
/**
|
|
@@ -5996,7 +6019,7 @@ class jr {
|
|
|
5996
6019
|
return e && r._setSettings(e), r;
|
|
5997
6020
|
}), "PUBLIC")),
|
|
5998
6021
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
5999
|
-
r("firestore-lite", "3.4.8-canary.
|
|
6022
|
+
r("firestore-lite", "3.4.8-canary.6ceff4db0", "rn"), r("firestore-lite", "3.4.8-canary.6ceff4db0", "esm2017");
|
|
6000
6023
|
|
|
6001
|
-
export {
|
|
6024
|
+
export { vn as Bytes, dn as CollectionReference, ln as DocumentReference, Kn as DocumentSnapshot, gn as FieldPath, En as FieldValue, on as Firestore, U as FirestoreError, Tn as GeoPoint, fn as Query, er as QueryConstraint, Jn as QueryDocumentSnapshot, Xn as QuerySnapshot, bt as Timestamp, Mr as Transaction, xr as WriteBatch, Pr as addDoc, $r as arrayRemove, Dr as arrayUnion, wn as collection, mn as collectionGroup, an as connectFirestoreEmulator, Rr as deleteDoc, Vr as deleteField, pn as doc, bn as documentId, mr as endAt, wr as endBefore, Er as getDoc, Tr as getDocs, cn as getFirestore, Sr as increment, un as initializeFirestore, cr as limit, ar as limitToLast, or as orderBy, nr as query, _n as queryEqual, yn as refEqual, Br as runTransaction, Nr as serverTimestamp, Ar as setDoc, m as setLogLevel, Zn as snapshotEqual, fr as startAfter, lr as startAt, hn as terminate, Ir as updateDoc, sr as where, qr as writeBatch };
|
|
6002
6025
|
//# sourceMappingURL=index.rn.esm2017.js.map
|