@firebase/firestore 3.4.8-canary.aa41fd662 → 3.4.8-canary.adb9aaa34
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/target.d.ts +4 -4
- 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/firestore/src/local/indexeddb_index_manager.d.ts +0 -5
- package/dist/firestore/src/model/values.d.ts +14 -2
- package/dist/index.d.ts +24 -1
- package/dist/index.esm2017.js +1368 -1327
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +2335 -2296
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +80 -62
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +80 -62
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +1396 -1355
- 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/target.d.ts +4 -4
- 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/firestore/src/local/indexeddb_index_manager.d.ts +0 -5
- package/dist/lite/firestore/src/model/values.d.ts +14 -2
- package/dist/lite/index.browser.esm2017.js +613 -580
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +580 -568
- 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 +53 -10
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +53 -10
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +1275 -1242
- 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 +94 -94
- 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/target.d.ts +4 -4
- 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/packages/firestore/src/local/indexeddb_index_manager.d.ts +0 -5
- package/dist/lite/packages/firestore/src/model/values.d.ts +14 -2
- package/dist/lite/private.d.ts +25 -1
- package/dist/packages/firestore/dist/index.esm2017.d.ts +76 -75
- 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/target.d.ts +4 -4
- 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/packages/firestore/src/local/indexeddb_index_manager.d.ts +0 -5
- package/dist/packages/firestore/src/model/values.d.ts +14 -2
- package/dist/private.d.ts +25 -1
- package/package.json +10 -10
|
@@ -67,7 +67,7 @@ m.MOCK_USER = new m("mock-user");
|
|
|
67
67
|
* See the License for the specific language governing permissions and
|
|
68
68
|
* limitations under the License.
|
|
69
69
|
*/
|
|
70
|
-
var y = "9.
|
|
70
|
+
var y = "9.7.0-canary.adb9aaa34", v = new l("@firebase/firestore");
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* @license
|
|
@@ -204,7 +204,7 @@ function E(t, e) {
|
|
|
204
204
|
/**
|
|
205
205
|
* Casts `obj` to `T`. In non-production builds, verifies that `obj` is an
|
|
206
206
|
* instance of `T` before casting.
|
|
207
|
-
*/ function
|
|
207
|
+
*/ function A(t,
|
|
208
208
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
209
209
|
e) {
|
|
210
210
|
return t;
|
|
@@ -225,7 +225,7 @@ e) {
|
|
|
225
225
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
226
226
|
* See the License for the specific language governing permissions and
|
|
227
227
|
* limitations under the License.
|
|
228
|
-
*/ var
|
|
228
|
+
*/ var I = "cancelled", k = "unknown", V = "invalid-argument", D = "deadline-exceeded", P = "not-found", N = "permission-denied", q = "unauthenticated", F = "resource-exhausted", O = "failed-precondition", C = "aborted", j = "out-of-range", L = "unimplemented", R = "internal", x = "unavailable", M = /** @class */ function(e) {
|
|
229
229
|
/** @hideconstructor */
|
|
230
230
|
function n(
|
|
231
231
|
/**
|
|
@@ -446,7 +446,7 @@ function(t, e, n, r, i, o, a, s) {
|
|
|
446
446
|
// for legacy reasons and should not be used frequently).
|
|
447
447
|
for (var r = [], i = 0, o = t; i < o.length; i++) {
|
|
448
448
|
var a = o[i];
|
|
449
|
-
if (a.indexOf("//") >= 0) throw new
|
|
449
|
+
if (a.indexOf("//") >= 0) throw new M(V, "Invalid segment (" + a + "). Paths must not contain // in them.");
|
|
450
450
|
// Strip leading and traling slashed.
|
|
451
451
|
r.push.apply(r, a.split("/").filter((function(t) {
|
|
452
452
|
return t.length > 0;
|
|
@@ -501,18 +501,18 @@ function(t, e, n, r, i, o, a, s) {
|
|
|
501
501
|
*/
|
|
502
502
|
n.fromServerFormat = function(t) {
|
|
503
503
|
for (var e = [], r = "", i = 0, o = function() {
|
|
504
|
-
if (0 === r.length) throw new
|
|
504
|
+
if (0 === r.length) throw new M(V, "Invalid field path (" + t + "). Paths must not be empty, begin with '.', end with '.', or contain '..'");
|
|
505
505
|
e.push(r), r = "";
|
|
506
506
|
}, a = !1; i < t.length; ) {
|
|
507
507
|
var s = t[i];
|
|
508
508
|
if ("\\" === s) {
|
|
509
|
-
if (i + 1 === t.length) throw new
|
|
509
|
+
if (i + 1 === t.length) throw new M(V, "Path has trailing escape character: " + t);
|
|
510
510
|
var u = t[i + 1];
|
|
511
|
-
if ("\\" !== u && "." !== u && "`" !== u) throw new
|
|
511
|
+
if ("\\" !== u && "." !== u && "`" !== u) throw new M(V, "Path has invalid escape sequence: " + t);
|
|
512
512
|
r += u, i += 2;
|
|
513
513
|
} else "`" === s ? (a = !a, i++) : "." !== s || a ? (r += s, i++) : (o(), i++);
|
|
514
514
|
}
|
|
515
|
-
if (o(), a) throw new
|
|
515
|
+
if (o(), a) throw new M(V, "Unterminated ` in path: " + t);
|
|
516
516
|
return new n(e);
|
|
517
517
|
}, n.emptyPath = function() {
|
|
518
518
|
return new n([]);
|
|
@@ -580,7 +580,7 @@ function(t, e, n, r, i, o, a, s) {
|
|
|
580
580
|
* limitations under the License.
|
|
581
581
|
*/
|
|
582
582
|
function rt(t, e, n) {
|
|
583
|
-
if (!n) throw new
|
|
583
|
+
if (!n) throw new M(V, "Function " + t + "() cannot be called with an empty " + e + ".");
|
|
584
584
|
}
|
|
585
585
|
|
|
586
586
|
/**
|
|
@@ -591,14 +591,14 @@ function rt(t, e, n) {
|
|
|
591
591
|
* Validates that `path` refers to a document (indicated by the fact it contains
|
|
592
592
|
* an even numbers of segments).
|
|
593
593
|
*/ function it(t) {
|
|
594
|
-
if (!nt.isDocumentKey(t)) throw new
|
|
594
|
+
if (!nt.isDocumentKey(t)) throw new M(V, "Invalid document reference. Document references must have an even number of segments, but " + t + " has " + t.length + ".");
|
|
595
595
|
}
|
|
596
596
|
|
|
597
597
|
/**
|
|
598
598
|
* Validates that `path` refers to a collection (indicated by the fact it
|
|
599
599
|
* contains an odd numbers of segments).
|
|
600
600
|
*/ function ot(t) {
|
|
601
|
-
if (nt.isDocumentKey(t)) throw new
|
|
601
|
+
if (nt.isDocumentKey(t)) throw new M(V, "Invalid collection reference. Collection references must have an odd number of segments, but " + t + " has " + t.length + ".");
|
|
602
602
|
}
|
|
603
603
|
|
|
604
604
|
/**
|
|
@@ -630,15 +630,15 @@ e) {
|
|
|
630
630
|
// Unwrap Compat types
|
|
631
631
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
632
632
|
t = t._delegate), !(t instanceof e)) {
|
|
633
|
-
if (e.name === t.constructor.name) throw new
|
|
633
|
+
if (e.name === t.constructor.name) throw new M(V, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
|
|
634
634
|
var n = at(t);
|
|
635
|
-
throw new
|
|
635
|
+
throw new M(V, "Expected type '" + e.name + "', but it was: " + n);
|
|
636
636
|
}
|
|
637
637
|
return t;
|
|
638
638
|
}
|
|
639
639
|
|
|
640
640
|
function ut(t, e) {
|
|
641
|
-
if (e <= 0) throw new
|
|
641
|
+
if (e <= 0) throw new M(V, "Function " + t + "() requires a positive number, but it was: " + e + ".");
|
|
642
642
|
}
|
|
643
643
|
|
|
644
644
|
/**
|
|
@@ -771,7 +771,7 @@ function dt(t) {
|
|
|
771
771
|
// return Code.ALREADY_EXISTS;
|
|
772
772
|
case 416:
|
|
773
773
|
// Range Not Satisfiable
|
|
774
|
-
return
|
|
774
|
+
return j;
|
|
775
775
|
|
|
776
776
|
case 429:
|
|
777
777
|
// Too Many Requests
|
|
@@ -779,7 +779,7 @@ function dt(t) {
|
|
|
779
779
|
|
|
780
780
|
case 499:
|
|
781
781
|
// Client Closed Request
|
|
782
|
-
return
|
|
782
|
+
return I;
|
|
783
783
|
|
|
784
784
|
case 500:
|
|
785
785
|
// Internal Server Error
|
|
@@ -790,11 +790,11 @@ function dt(t) {
|
|
|
790
790
|
// return Code.DATA_LOSS;
|
|
791
791
|
case 501:
|
|
792
792
|
// Unimplemented
|
|
793
|
-
return
|
|
793
|
+
return L;
|
|
794
794
|
|
|
795
795
|
case 503:
|
|
796
796
|
// Service Unavailable
|
|
797
|
-
return
|
|
797
|
+
return x;
|
|
798
798
|
|
|
799
799
|
case 504:
|
|
800
800
|
// Gateway Timeout
|
|
@@ -840,13 +840,13 @@ var mt = /** @class */ function(r) {
|
|
|
840
840
|
*/
|
|
841
841
|
function i(t, e) {
|
|
842
842
|
var n = this;
|
|
843
|
-
return (n = r.call(this, t) || this).
|
|
843
|
+
return (n = r.call(this, t) || this).A = e, n;
|
|
844
844
|
}
|
|
845
845
|
/**
|
|
846
846
|
* Base class for all Rest-based connections to the backend (WebChannel and
|
|
847
847
|
* HTTP).
|
|
848
848
|
*/
|
|
849
|
-
return t(i, r), i.prototype.
|
|
849
|
+
return t(i, r), i.prototype.I = function(t, e) {
|
|
850
850
|
throw new Error("Not supported by FetchConnection");
|
|
851
851
|
}, i.prototype.v = function(t, r, i, o) {
|
|
852
852
|
return e(this, void 0, void 0, (function() {
|
|
@@ -857,7 +857,7 @@ var mt = /** @class */ function(r) {
|
|
|
857
857
|
t = JSON.stringify(o), n.label = 1;
|
|
858
858
|
|
|
859
859
|
case 1:
|
|
860
|
-
return n.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , this.
|
|
860
|
+
return n.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , this.A(r, {
|
|
861
861
|
method: "POST",
|
|
862
862
|
headers: i,
|
|
863
863
|
body: t
|
|
@@ -867,10 +867,10 @@ var mt = /** @class */ function(r) {
|
|
|
867
867
|
return e = n.sent(), [ 3 /*break*/ , 4 ];
|
|
868
868
|
|
|
869
869
|
case 3:
|
|
870
|
-
throw a = n.sent(), new
|
|
870
|
+
throw a = n.sent(), new M(dt(a.status), "Request failed with error: " + a.statusText);
|
|
871
871
|
|
|
872
872
|
case 4:
|
|
873
|
-
if (!e.ok) throw new
|
|
873
|
+
if (!e.ok) throw new M(dt(e.status), "Request failed with error: " + e.statusText);
|
|
874
874
|
return [ 2 /*return*/ , e.json() ];
|
|
875
875
|
}
|
|
876
876
|
}));
|
|
@@ -1058,11 +1058,11 @@ function gt(t, e) {
|
|
|
1058
1058
|
* The fractions of a second at nanosecond resolution.*
|
|
1059
1059
|
*/
|
|
1060
1060
|
e) {
|
|
1061
|
-
if (this.seconds = t, this.nanoseconds = e, e < 0) throw new
|
|
1062
|
-
if (e >= 1e9) throw new
|
|
1063
|
-
if (t < -62135596800) throw new
|
|
1061
|
+
if (this.seconds = t, this.nanoseconds = e, e < 0) throw new M(V, "Timestamp nanoseconds out of range: " + e);
|
|
1062
|
+
if (e >= 1e9) throw new M(V, "Timestamp nanoseconds out of range: " + e);
|
|
1063
|
+
if (t < -62135596800) throw new M(V, "Timestamp seconds out of range: " + t);
|
|
1064
1064
|
// This will break in the year 10,000.
|
|
1065
|
-
if (t >= 253402300800) throw new
|
|
1065
|
+
if (t >= 253402300800) throw new M(V, "Timestamp seconds out of range: " + t);
|
|
1066
1066
|
}
|
|
1067
1067
|
/**
|
|
1068
1068
|
* Creates a new timestamp with the current date, with millisecond precision.
|
|
@@ -1270,7 +1270,7 @@ function St(t, e) {
|
|
|
1270
1270
|
return t.isEqual(e);
|
|
1271
1271
|
}));
|
|
1272
1272
|
}, t;
|
|
1273
|
-
}(),
|
|
1273
|
+
}(), At = /** @class */ function() {
|
|
1274
1274
|
function t(t) {
|
|
1275
1275
|
this.binaryString = t;
|
|
1276
1276
|
}
|
|
@@ -1359,9 +1359,9 @@ function St(t, e) {
|
|
|
1359
1359
|
* the proto byte string in a common class that must be converted into a string
|
|
1360
1360
|
* before being sent as a proto.
|
|
1361
1361
|
* @internal
|
|
1362
|
-
*/
|
|
1362
|
+
*/ At.EMPTY_BYTE_STRING = new At("");
|
|
1363
1363
|
|
|
1364
|
-
var
|
|
1364
|
+
var It = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
1365
1365
|
|
|
1366
1366
|
/**
|
|
1367
1367
|
* Converts the possible Proto values for a timestamp value into a "seconds and
|
|
@@ -1374,7 +1374,7 @@ var At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1374
1374
|
// The date string can have higher precision (nanos) than the Date class
|
|
1375
1375
|
// (millis), so we do some custom parsing here.
|
|
1376
1376
|
// Parse the nanos right out of the string.
|
|
1377
|
-
var e = 0, n =
|
|
1377
|
+
var e = 0, n = It.exec(t);
|
|
1378
1378
|
if (E(!!n), n[1]) {
|
|
1379
1379
|
// Pad the fraction out to 9 digits (nanos).
|
|
1380
1380
|
var r = n[1];
|
|
@@ -1402,7 +1402,7 @@ var At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1402
1402
|
}
|
|
1403
1403
|
|
|
1404
1404
|
/** Converts the possible Proto types for Blobs into a ByteString. */ function Dt(t) {
|
|
1405
|
-
return "string" == typeof t ?
|
|
1405
|
+
return "string" == typeof t ? At.fromBase64String(t) : At.fromUint8Array(t);
|
|
1406
1406
|
}
|
|
1407
1407
|
|
|
1408
1408
|
/**
|
|
@@ -1475,19 +1475,26 @@ var At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1475
1475
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1476
1476
|
* See the License for the specific language governing permissions and
|
|
1477
1477
|
* limitations under the License.
|
|
1478
|
-
*/
|
|
1479
|
-
|
|
1478
|
+
*/ var Ft = {
|
|
1479
|
+
fields: {
|
|
1480
|
+
__type__: {
|
|
1481
|
+
stringValue: "__max__"
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
};
|
|
1485
|
+
|
|
1486
|
+
/** Extracts the backend's type order for the provided value. */ function Ot(t) {
|
|
1480
1487
|
return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ? Pt(t) ? 4 /* ServerTimestampValue */ :
|
|
1481
1488
|
/** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */
|
|
1482
1489
|
function(t) {
|
|
1483
1490
|
return "__max__" === (((t.mapValue || {}).fields || {}).__type__ || {}).stringValue;
|
|
1484
|
-
}(t) ?
|
|
1491
|
+
}(t) ? 9007199254740991 /* MaxValue */ : 10 /* ObjectValue */ : S();
|
|
1485
1492
|
}
|
|
1486
1493
|
|
|
1487
|
-
/** Tests `left` and `right` for equality based on the backend semantics. */ function
|
|
1494
|
+
/** Tests `left` and `right` for equality based on the backend semantics. */ function Ct(t, e) {
|
|
1488
1495
|
if (t === e) return !0;
|
|
1489
|
-
var n =
|
|
1490
|
-
if (n !==
|
|
1496
|
+
var n = Ot(t);
|
|
1497
|
+
if (n !== Ot(e)) return !1;
|
|
1491
1498
|
switch (n) {
|
|
1492
1499
|
case 0 /* NullValue */ :
|
|
1493
1500
|
case 9007199254740991 /* MaxValue */ :
|
|
@@ -1535,13 +1542,13 @@ var At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1535
1542
|
}(t, e);
|
|
1536
1543
|
|
|
1537
1544
|
case 9 /* ArrayValue */ :
|
|
1538
|
-
return wt(t.arrayValue.values || [], e.arrayValue.values || [],
|
|
1545
|
+
return wt(t.arrayValue.values || [], e.arrayValue.values || [], Ct);
|
|
1539
1546
|
|
|
1540
1547
|
case 10 /* ObjectValue */ :
|
|
1541
1548
|
return function(t, e) {
|
|
1542
1549
|
var n = t.mapValue.fields || {}, r = e.mapValue.fields || {};
|
|
1543
1550
|
if (Tt(n) !== Tt(r)) return !1;
|
|
1544
|
-
for (var i in n) if (n.hasOwnProperty(i) && (void 0 === r[i] || !
|
|
1551
|
+
for (var i in n) if (n.hasOwnProperty(i) && (void 0 === r[i] || !Ct(n[i], r[i]))) return !1;
|
|
1545
1552
|
return !0;
|
|
1546
1553
|
}(t, e);
|
|
1547
1554
|
|
|
@@ -1550,15 +1557,15 @@ var At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1550
1557
|
}
|
|
1551
1558
|
}
|
|
1552
1559
|
|
|
1553
|
-
function
|
|
1560
|
+
function jt(t, e) {
|
|
1554
1561
|
return void 0 !== (t.values || []).find((function(t) {
|
|
1555
|
-
return
|
|
1562
|
+
return Ct(t, e);
|
|
1556
1563
|
}));
|
|
1557
1564
|
}
|
|
1558
1565
|
|
|
1559
1566
|
function Lt(t, e) {
|
|
1560
1567
|
if (t === e) return 0;
|
|
1561
|
-
var n =
|
|
1568
|
+
var n = Ot(t), r = Ot(e);
|
|
1562
1569
|
if (n !== r) return gt(n, r);
|
|
1563
1570
|
switch (n) {
|
|
1564
1571
|
case 0 /* NullValue */ :
|
|
@@ -1577,10 +1584,10 @@ function Lt(t, e) {
|
|
|
1577
1584
|
}(t, e);
|
|
1578
1585
|
|
|
1579
1586
|
case 3 /* TimestampValue */ :
|
|
1580
|
-
return
|
|
1587
|
+
return Rt(t.timestampValue, e.timestampValue);
|
|
1581
1588
|
|
|
1582
1589
|
case 4 /* ServerTimestampValue */ :
|
|
1583
|
-
return
|
|
1590
|
+
return Rt(qt(t), qt(e));
|
|
1584
1591
|
|
|
1585
1592
|
case 5 /* StringValue */ :
|
|
1586
1593
|
return gt(t.stringValue, e.stringValue);
|
|
@@ -1617,6 +1624,9 @@ function Lt(t, e) {
|
|
|
1617
1624
|
|
|
1618
1625
|
case 10 /* ObjectValue */ :
|
|
1619
1626
|
return function(t, e) {
|
|
1627
|
+
if (t === Ft && e === Ft) return 0;
|
|
1628
|
+
if (t === Ft) return 1;
|
|
1629
|
+
if (e === Ft) return -1;
|
|
1620
1630
|
var n = t.fields || {}, r = Object.keys(n), i = e.fields || {}, o = Object.keys(i);
|
|
1621
1631
|
// Even though MapValues are likely sorted correctly based on their insertion
|
|
1622
1632
|
// order (e.g. when received from the backend), local modifications can bring
|
|
@@ -1637,13 +1647,13 @@ function Lt(t, e) {
|
|
|
1637
1647
|
}
|
|
1638
1648
|
}
|
|
1639
1649
|
|
|
1640
|
-
function
|
|
1650
|
+
function Rt(t, e) {
|
|
1641
1651
|
if ("string" == typeof t && "string" == typeof e && t.length === e.length) return gt(t, e);
|
|
1642
1652
|
var n = kt(t), r = kt(e), i = gt(n.seconds, r.seconds);
|
|
1643
1653
|
return 0 !== i ? i : gt(n.nanos, r.nanos);
|
|
1644
1654
|
}
|
|
1645
1655
|
|
|
1646
|
-
function
|
|
1656
|
+
function xt(t, e) {
|
|
1647
1657
|
return {
|
|
1648
1658
|
referenceValue: "projects/" + t.projectId + "/databases/" + t.database + "/documents/" + e.path.canonicalString()
|
|
1649
1659
|
};
|
|
@@ -1653,19 +1663,19 @@ function Rt(t, e) {
|
|
|
1653
1663
|
return !!t && "arrayValue" in t;
|
|
1654
1664
|
}
|
|
1655
1665
|
|
|
1656
|
-
/** Returns true if `value` is a NullValue. */ function
|
|
1666
|
+
/** Returns true if `value` is a NullValue. */ function Ut(t) {
|
|
1657
1667
|
return !!t && "nullValue" in t;
|
|
1658
1668
|
}
|
|
1659
1669
|
|
|
1660
|
-
/** Returns true if `value` is NaN. */ function
|
|
1670
|
+
/** Returns true if `value` is NaN. */ function Bt(t) {
|
|
1661
1671
|
return !!t && "doubleValue" in t && isNaN(Number(t.doubleValue));
|
|
1662
1672
|
}
|
|
1663
1673
|
|
|
1664
|
-
/** Returns true if `value` is a MapValue. */ function
|
|
1674
|
+
/** Returns true if `value` is a MapValue. */ function Gt(t) {
|
|
1665
1675
|
return !!t && "mapValue" in t;
|
|
1666
1676
|
}
|
|
1667
1677
|
|
|
1668
|
-
/** Creates a deep copy of `source`. */ function
|
|
1678
|
+
/** Creates a deep copy of `source`. */ function zt(t) {
|
|
1669
1679
|
if (t.geoPointValue) return {
|
|
1670
1680
|
geoPointValue: Object.assign({}, t.geoPointValue)
|
|
1671
1681
|
};
|
|
@@ -1679,7 +1689,7 @@ function Rt(t, e) {
|
|
|
1679
1689
|
}
|
|
1680
1690
|
};
|
|
1681
1691
|
return St(t.mapValue.fields, (function(t, n) {
|
|
1682
|
-
return e.mapValue.fields[t] =
|
|
1692
|
+
return e.mapValue.fields[t] = zt(n);
|
|
1683
1693
|
})), e;
|
|
1684
1694
|
}
|
|
1685
1695
|
if (t.arrayValue) {
|
|
@@ -1687,13 +1697,13 @@ function Rt(t, e) {
|
|
|
1687
1697
|
arrayValue: {
|
|
1688
1698
|
values: []
|
|
1689
1699
|
}
|
|
1690
|
-
}, r = 0; r < (t.arrayValue.values || []).length; ++r) n.arrayValue.values[r] =
|
|
1700
|
+
}, r = 0; r < (t.arrayValue.values || []).length; ++r) n.arrayValue.values[r] = zt(t.arrayValue.values[r]);
|
|
1691
1701
|
return n;
|
|
1692
1702
|
}
|
|
1693
1703
|
return Object.assign({}, t);
|
|
1694
1704
|
}
|
|
1695
1705
|
|
|
1696
|
-
var
|
|
1706
|
+
var Qt = /** @class */ function() {
|
|
1697
1707
|
function t(t) {
|
|
1698
1708
|
this.value = t;
|
|
1699
1709
|
}
|
|
@@ -1710,7 +1720,7 @@ var zt = /** @class */ function() {
|
|
|
1710
1720
|
*/
|
|
1711
1721
|
t.prototype.field = function(t) {
|
|
1712
1722
|
if (t.isEmpty()) return this.value;
|
|
1713
|
-
for (var e = this.value, n = 0; n < t.length - 1; ++n) if (!
|
|
1723
|
+
for (var e = this.value, n = 0; n < t.length - 1; ++n) if (!Gt(e = (e.mapValue.fields || {})[t.get(n)])) return null;
|
|
1714
1724
|
return (e = (e.mapValue.fields || {})[t.lastSegment()]) || null;
|
|
1715
1725
|
},
|
|
1716
1726
|
/**
|
|
@@ -1720,7 +1730,7 @@ var zt = /** @class */ function() {
|
|
|
1720
1730
|
* @param value - The value to set.
|
|
1721
1731
|
*/
|
|
1722
1732
|
t.prototype.set = function(t, e) {
|
|
1723
|
-
this.getFieldsMap(t.popLast())[t.lastSegment()] =
|
|
1733
|
+
this.getFieldsMap(t.popLast())[t.lastSegment()] = zt(e);
|
|
1724
1734
|
},
|
|
1725
1735
|
/**
|
|
1726
1736
|
* Sets the provided fields to the provided values.
|
|
@@ -1735,7 +1745,7 @@ var zt = /** @class */ function() {
|
|
|
1735
1745
|
var a = e.getFieldsMap(n);
|
|
1736
1746
|
e.applyChanges(a, r, i), r = {}, i = [], n = o.popLast();
|
|
1737
1747
|
}
|
|
1738
|
-
t ? r[o.lastSegment()] =
|
|
1748
|
+
t ? r[o.lastSegment()] = zt(t) : i.push(o.lastSegment());
|
|
1739
1749
|
}));
|
|
1740
1750
|
var o = this.getFieldsMap(n);
|
|
1741
1751
|
this.applyChanges(o, r, i);
|
|
@@ -1748,9 +1758,9 @@ var zt = /** @class */ function() {
|
|
|
1748
1758
|
*/
|
|
1749
1759
|
t.prototype.delete = function(t) {
|
|
1750
1760
|
var e = this.field(t.popLast());
|
|
1751
|
-
|
|
1761
|
+
Gt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
|
|
1752
1762
|
}, t.prototype.isEqual = function(t) {
|
|
1753
|
-
return
|
|
1763
|
+
return Ct(this.value, t.value);
|
|
1754
1764
|
},
|
|
1755
1765
|
/**
|
|
1756
1766
|
* Returns the map that contains the leaf element of `path`. If the parent
|
|
@@ -1763,7 +1773,7 @@ var zt = /** @class */ function() {
|
|
|
1763
1773
|
});
|
|
1764
1774
|
for (var n = 0; n < t.length; ++n) {
|
|
1765
1775
|
var r = e.mapValue.fields[t.get(n)];
|
|
1766
|
-
|
|
1776
|
+
Gt(r) && r.mapValue.fields || (r = {
|
|
1767
1777
|
mapValue: {
|
|
1768
1778
|
fields: {}
|
|
1769
1779
|
}
|
|
@@ -1784,9 +1794,9 @@ var zt = /** @class */ function() {
|
|
|
1784
1794
|
delete t[o];
|
|
1785
1795
|
}
|
|
1786
1796
|
}, t.prototype.clone = function() {
|
|
1787
|
-
return new t(
|
|
1797
|
+
return new t(zt(this.value));
|
|
1788
1798
|
}, t;
|
|
1789
|
-
}(),
|
|
1799
|
+
}(), Kt = /** @class */ function() {
|
|
1790
1800
|
function t(t, e, n, r, i, o) {
|
|
1791
1801
|
this.key = t, this.documentType = e, this.version = n, this.readTime = r, this.data = i,
|
|
1792
1802
|
this.documentState = o
|
|
@@ -1796,7 +1806,7 @@ var zt = /** @class */ function() {
|
|
|
1796
1806
|
*/;
|
|
1797
1807
|
}
|
|
1798
1808
|
return t.newInvalidDocument = function(e) {
|
|
1799
|
-
return new t(e, 0 /* INVALID */ , _t.min(), _t.min(),
|
|
1809
|
+
return new t(e, 0 /* INVALID */ , _t.min(), _t.min(), Qt.empty(), 0 /* SYNCED */);
|
|
1800
1810
|
},
|
|
1801
1811
|
/**
|
|
1802
1812
|
* Creates a new document that is known to exist with the given data at the
|
|
@@ -1806,7 +1816,7 @@ var zt = /** @class */ function() {
|
|
|
1806
1816
|
return new t(e, 1 /* FOUND_DOCUMENT */ , n, _t.min(), r, 0 /* SYNCED */);
|
|
1807
1817
|
},
|
|
1808
1818
|
/** Creates a new document that is known to not exist at the given version. */ t.newNoDocument = function(e, n) {
|
|
1809
|
-
return new t(e, 2 /* NO_DOCUMENT */ , n, _t.min(),
|
|
1819
|
+
return new t(e, 2 /* NO_DOCUMENT */ , n, _t.min(), Qt.empty(), 0 /* SYNCED */);
|
|
1810
1820
|
},
|
|
1811
1821
|
/**
|
|
1812
1822
|
* Creates a new document that is known to exist at the given version but
|
|
@@ -1814,7 +1824,7 @@ var zt = /** @class */ function() {
|
|
|
1814
1824
|
* base document).
|
|
1815
1825
|
*/
|
|
1816
1826
|
t.newUnknownDocument = function(e, n) {
|
|
1817
|
-
return new t(e, 3 /* UNKNOWN_DOCUMENT */ , n, _t.min(),
|
|
1827
|
+
return new t(e, 3 /* UNKNOWN_DOCUMENT */ , n, _t.min(), Qt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
1818
1828
|
},
|
|
1819
1829
|
/**
|
|
1820
1830
|
* Changes the document type to indicate that it exists and that its version
|
|
@@ -1829,7 +1839,7 @@ var zt = /** @class */ function() {
|
|
|
1829
1839
|
* version.
|
|
1830
1840
|
*/
|
|
1831
1841
|
t.prototype.convertToNoDocument = function(t) {
|
|
1832
|
-
return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data =
|
|
1842
|
+
return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data = Qt.empty(),
|
|
1833
1843
|
this.documentState = 0 /* SYNCED */ , this;
|
|
1834
1844
|
},
|
|
1835
1845
|
/**
|
|
@@ -1838,7 +1848,7 @@ var zt = /** @class */ function() {
|
|
|
1838
1848
|
* base document).
|
|
1839
1849
|
*/
|
|
1840
1850
|
t.prototype.convertToUnknownDocument = function(t) {
|
|
1841
|
-
return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data =
|
|
1851
|
+
return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data = Qt.empty(),
|
|
1842
1852
|
this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
|
|
1843
1853
|
}, t.prototype.setHasCommittedMutations = function() {
|
|
1844
1854
|
return this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
|
|
@@ -1879,7 +1889,7 @@ var zt = /** @class */ function() {
|
|
|
1879
1889
|
}, t.prototype.toString = function() {
|
|
1880
1890
|
return "Document(" + this.key + ", " + this.version + ", " + JSON.stringify(this.data.value) + ", {documentType: " + this.documentType + "}), {documentState: " + this.documentState + "})";
|
|
1881
1891
|
}, t;
|
|
1882
|
-
}(),
|
|
1892
|
+
}(), Ht = function(t, e, n, r, i, o, a) {
|
|
1883
1893
|
void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []),
|
|
1884
1894
|
void 0 === i && (i = null), void 0 === o && (o = null), void 0 === a && (a = null),
|
|
1885
1895
|
this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = i,
|
|
@@ -1920,13 +1930,13 @@ var zt = /** @class */ function() {
|
|
|
1920
1930
|
* using this factory method, because `Query` provides an implicit `orderBy`
|
|
1921
1931
|
* property.
|
|
1922
1932
|
*/
|
|
1923
|
-
function
|
|
1933
|
+
function Wt(t, e, n, r, i, o, a) {
|
|
1924
1934
|
return void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []),
|
|
1925
1935
|
void 0 === i && (i = null), void 0 === o && (o = null), void 0 === a && (a = null),
|
|
1926
|
-
new
|
|
1936
|
+
new Ht(t, e, n, r, i, o, a);
|
|
1927
1937
|
}
|
|
1928
1938
|
|
|
1929
|
-
var
|
|
1939
|
+
var Yt = /** @class */ function(e) {
|
|
1930
1940
|
function n(t, n, r) {
|
|
1931
1941
|
var i = this;
|
|
1932
1942
|
return (i = e.call(this) || this).field = t, i.op = n, i.value = r, i;
|
|
@@ -1934,13 +1944,13 @@ var Wt = /** @class */ function(e) {
|
|
|
1934
1944
|
/**
|
|
1935
1945
|
* Creates a filter based on the provided arguments.
|
|
1936
1946
|
*/ return t(n, e), n.create = function(t, e, r) {
|
|
1937
|
-
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.V(t, e, r) : new
|
|
1947
|
+
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.V(t, e, r) : new $t(t, e, r) : "array-contains" /* ARRAY_CONTAINS */ === e ? new te(t, r) : "in" /* IN */ === e ? new ee(t, r) : "not-in" /* NOT_IN */ === e ? new ne(t, r) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new re(t, r) : new n(t, e, r);
|
|
1938
1948
|
}, n.V = function(t, e, n) {
|
|
1939
|
-
return "in" /* IN */ === e ? new
|
|
1949
|
+
return "in" /* IN */ === e ? new Xt(t, n) : new Jt(t, n);
|
|
1940
1950
|
}, n.prototype.matches = function(t) {
|
|
1941
1951
|
var e = t.data.field(this.field);
|
|
1942
1952
|
// Types do not have to match in NOT_EQUAL filters.
|
|
1943
|
-
return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.D(Lt(e, this.value)) : null !== e &&
|
|
1953
|
+
return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.D(Lt(e, this.value)) : null !== e && Ot(this.value) === Ot(e) && this.D(Lt(e, this.value));
|
|
1944
1954
|
// Only compare types with matching backend order (such as double and int).
|
|
1945
1955
|
}, n.prototype.D = function(t) {
|
|
1946
1956
|
switch (this.op) {
|
|
@@ -1968,7 +1978,7 @@ var Wt = /** @class */ function(e) {
|
|
|
1968
1978
|
}, n.prototype.N = function() {
|
|
1969
1979
|
return [ "<" /* LESS_THAN */ , "<=" /* LESS_THAN_OR_EQUAL */ , ">" /* GREATER_THAN */ , ">=" /* GREATER_THAN_OR_EQUAL */ , "!=" /* NOT_EQUAL */ , "not-in" /* NOT_IN */ ].indexOf(this.op) >= 0;
|
|
1970
1980
|
}, n;
|
|
1971
|
-
}((function() {})),
|
|
1981
|
+
}((function() {})), $t = /** @class */ function(e) {
|
|
1972
1982
|
function n(t, n, r) {
|
|
1973
1983
|
var i = this;
|
|
1974
1984
|
return (i = e.call(this, t, n, r) || this).key = nt.fromName(r.referenceValue),
|
|
@@ -1978,10 +1988,10 @@ var Wt = /** @class */ function(e) {
|
|
|
1978
1988
|
var e = nt.comparator(t.key, this.key);
|
|
1979
1989
|
return this.D(e);
|
|
1980
1990
|
}, n;
|
|
1981
|
-
}(
|
|
1991
|
+
}(Yt), Xt = /** @class */ function(e) {
|
|
1982
1992
|
function n(t, n) {
|
|
1983
1993
|
var r = this;
|
|
1984
|
-
return (r = e.call(this, t, "in" /* IN */ , n) || this).keys =
|
|
1994
|
+
return (r = e.call(this, t, "in" /* IN */ , n) || this).keys = Zt("in" /* IN */ , n),
|
|
1985
1995
|
r;
|
|
1986
1996
|
}
|
|
1987
1997
|
return t(n, e), n.prototype.matches = function(t) {
|
|
@@ -1989,10 +1999,10 @@ var Wt = /** @class */ function(e) {
|
|
|
1989
1999
|
return e.isEqual(t.key);
|
|
1990
2000
|
}));
|
|
1991
2001
|
}, n;
|
|
1992
|
-
}(
|
|
2002
|
+
}(Yt), Jt = /** @class */ function(e) {
|
|
1993
2003
|
function n(t, n) {
|
|
1994
2004
|
var r = this;
|
|
1995
|
-
return (r = e.call(this, t, "not-in" /* NOT_IN */ , n) || this).keys =
|
|
2005
|
+
return (r = e.call(this, t, "not-in" /* NOT_IN */ , n) || this).keys = Zt("not-in" /* NOT_IN */ , n),
|
|
1996
2006
|
r;
|
|
1997
2007
|
}
|
|
1998
2008
|
return t(n, e), n.prototype.matches = function(t) {
|
|
@@ -2000,67 +2010,67 @@ var Wt = /** @class */ function(e) {
|
|
|
2000
2010
|
return e.isEqual(t.key);
|
|
2001
2011
|
}));
|
|
2002
2012
|
}, n;
|
|
2003
|
-
}(
|
|
2013
|
+
}(Yt);
|
|
2004
2014
|
|
|
2005
|
-
/** Filter that matches on key fields (i.e. '__name__'). */ function
|
|
2015
|
+
/** Filter that matches on key fields (i.e. '__name__'). */ function Zt(t, e) {
|
|
2006
2016
|
var n;
|
|
2007
2017
|
return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((function(t) {
|
|
2008
2018
|
return nt.fromName(t.referenceValue);
|
|
2009
2019
|
}));
|
|
2010
2020
|
}
|
|
2011
2021
|
|
|
2012
|
-
/** A Filter that implements the array-contains operator. */ var
|
|
2022
|
+
/** A Filter that implements the array-contains operator. */ var te = /** @class */ function(e) {
|
|
2013
2023
|
function n(t, n) {
|
|
2014
2024
|
return e.call(this, t, "array-contains" /* ARRAY_CONTAINS */ , n) || this;
|
|
2015
2025
|
}
|
|
2016
2026
|
return t(n, e), n.prototype.matches = function(t) {
|
|
2017
2027
|
var e = t.data.field(this.field);
|
|
2018
|
-
return Mt(e) &&
|
|
2028
|
+
return Mt(e) && jt(e.arrayValue, this.value);
|
|
2019
2029
|
}, n;
|
|
2020
|
-
}(
|
|
2030
|
+
}(Yt), ee = /** @class */ function(e) {
|
|
2021
2031
|
function n(t, n) {
|
|
2022
2032
|
return e.call(this, t, "in" /* IN */ , n) || this;
|
|
2023
2033
|
}
|
|
2024
2034
|
return t(n, e), n.prototype.matches = function(t) {
|
|
2025
2035
|
var e = t.data.field(this.field);
|
|
2026
|
-
return null !== e &&
|
|
2036
|
+
return null !== e && jt(this.value.arrayValue, e);
|
|
2027
2037
|
}, n;
|
|
2028
|
-
}(
|
|
2038
|
+
}(Yt), ne = /** @class */ function(e) {
|
|
2029
2039
|
function n(t, n) {
|
|
2030
2040
|
return e.call(this, t, "not-in" /* NOT_IN */ , n) || this;
|
|
2031
2041
|
}
|
|
2032
2042
|
return t(n, e), n.prototype.matches = function(t) {
|
|
2033
|
-
if (
|
|
2043
|
+
if (jt(this.value.arrayValue, {
|
|
2034
2044
|
nullValue: "NULL_VALUE"
|
|
2035
2045
|
})) return !1;
|
|
2036
2046
|
var e = t.data.field(this.field);
|
|
2037
|
-
return null !== e && !
|
|
2047
|
+
return null !== e && !jt(this.value.arrayValue, e);
|
|
2038
2048
|
}, n;
|
|
2039
|
-
}(
|
|
2049
|
+
}(Yt), re = /** @class */ function(e) {
|
|
2040
2050
|
function n(t, n) {
|
|
2041
2051
|
return e.call(this, t, "array-contains-any" /* ARRAY_CONTAINS_ANY */ , n) || this;
|
|
2042
2052
|
}
|
|
2043
2053
|
return t(n, e), n.prototype.matches = function(t) {
|
|
2044
2054
|
var e = this, n = t.data.field(this.field);
|
|
2045
2055
|
return !(!Mt(n) || !n.arrayValue.values) && n.arrayValue.values.some((function(t) {
|
|
2046
|
-
return
|
|
2056
|
+
return jt(e.value.arrayValue, t);
|
|
2047
2057
|
}));
|
|
2048
2058
|
}, n;
|
|
2049
|
-
}(
|
|
2059
|
+
}(Yt), ie = function(t, e) {
|
|
2050
2060
|
this.position = t, this.inclusive = e;
|
|
2051
|
-
},
|
|
2061
|
+
}, oe = function(t, e /* ASCENDING */) {
|
|
2052
2062
|
void 0 === e && (e = "asc"), this.field = t, this.dir = e;
|
|
2053
2063
|
};
|
|
2054
2064
|
|
|
2055
|
-
/** A Filter that implements the IN operator. */ function
|
|
2065
|
+
/** A Filter that implements the IN operator. */ function ae(t, e) {
|
|
2056
2066
|
return t.dir === e.dir && t.field.isEqual(e.field);
|
|
2057
2067
|
}
|
|
2058
2068
|
|
|
2059
|
-
function
|
|
2069
|
+
function se(t, e) {
|
|
2060
2070
|
if (null === t) return null === e;
|
|
2061
2071
|
if (null === e) return !1;
|
|
2062
2072
|
if (t.inclusive !== e.inclusive || t.position.length !== e.position.length) return !1;
|
|
2063
|
-
for (var n = 0; n < t.position.length; n++) if (!
|
|
2073
|
+
for (var n = 0; n < t.position.length; n++) if (!Ct(t.position[n], e.position[n])) return !1;
|
|
2064
2074
|
return !0;
|
|
2065
2075
|
}
|
|
2066
2076
|
|
|
@@ -2086,7 +2096,7 @@ function ae(t, e) {
|
|
|
2086
2096
|
* query the RemoteStore results.
|
|
2087
2097
|
*
|
|
2088
2098
|
* Visible for testing.
|
|
2089
|
-
*/ var
|
|
2099
|
+
*/ var ue =
|
|
2090
2100
|
/**
|
|
2091
2101
|
* Initializes a Query with a path and optional additional query constraints.
|
|
2092
2102
|
* Path must currently be empty if this is a collection group query.
|
|
@@ -2101,11 +2111,11 @@ function(t, e, n, r, i, o /* First */ , a, s) {
|
|
|
2101
2111
|
this.S = null, this.startAt, this.endAt;
|
|
2102
2112
|
};
|
|
2103
2113
|
|
|
2104
|
-
/** Creates a new Query for a query that matches all documents at `path` */ function
|
|
2114
|
+
/** Creates a new Query for a query that matches all documents at `path` */ function ce(t) {
|
|
2105
2115
|
return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
|
|
2106
2116
|
}
|
|
2107
2117
|
|
|
2108
|
-
function
|
|
2118
|
+
function le(t) {
|
|
2109
2119
|
for (var e = 0, n = t.filters; e < n.length; e++) {
|
|
2110
2120
|
var r = n[e];
|
|
2111
2121
|
if (r.N()) return r.field;
|
|
@@ -2120,7 +2130,7 @@ function ce(t) {
|
|
|
2120
2130
|
/**
|
|
2121
2131
|
* Returns whether the query matches a collection group rather than a specific
|
|
2122
2132
|
* collection.
|
|
2123
|
-
*/ function
|
|
2133
|
+
*/ function fe(t) {
|
|
2124
2134
|
return null !== t.collectionGroup;
|
|
2125
2135
|
}
|
|
2126
2136
|
|
|
@@ -2128,16 +2138,16 @@ function ce(t) {
|
|
|
2128
2138
|
* Returns the implicit order by constraint that is used to execute the Query,
|
|
2129
2139
|
* which can be different from the order by constraints the user provided (e.g.
|
|
2130
2140
|
* the SDK and backend always orders by `__name__`).
|
|
2131
|
-
*/ function
|
|
2132
|
-
var e =
|
|
2141
|
+
*/ function he(t) {
|
|
2142
|
+
var e = A(t);
|
|
2133
2143
|
if (null === e.$) {
|
|
2134
2144
|
e.$ = [];
|
|
2135
|
-
var n =
|
|
2145
|
+
var n = le(e), r = ce(e);
|
|
2136
2146
|
if (null !== n && null === r)
|
|
2137
2147
|
// In order to implicitly add key ordering, we must also add the
|
|
2138
2148
|
// inequality filter field for it to be a valid query.
|
|
2139
2149
|
// Note that the default inequality field and key ordering is ascending.
|
|
2140
|
-
n.isKeyField() || e.$.push(new
|
|
2150
|
+
n.isKeyField() || e.$.push(new oe(n)), e.$.push(new oe(et.keyField(), "asc" /* ASCENDING */)); else {
|
|
2141
2151
|
for (var i = !1, o = 0, a = e.explicitOrderBy; o < a.length; o++) {
|
|
2142
2152
|
var s = a[o];
|
|
2143
2153
|
e.$.push(s), s.field.isKeyField() && (i = !0);
|
|
@@ -2146,7 +2156,7 @@ function ce(t) {
|
|
|
2146
2156
|
// The order of the implicit key ordering always matches the last
|
|
2147
2157
|
// explicit order by
|
|
2148
2158
|
var u = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
|
|
2149
|
-
e.$.push(new
|
|
2159
|
+
e.$.push(new oe(et.keyField(), u));
|
|
2150
2160
|
}
|
|
2151
2161
|
}
|
|
2152
2162
|
}
|
|
@@ -2155,19 +2165,19 @@ function ce(t) {
|
|
|
2155
2165
|
|
|
2156
2166
|
/**
|
|
2157
2167
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
2158
|
-
*/ function
|
|
2159
|
-
var e =
|
|
2160
|
-
if (!e.S) if ("F" /* First */ === e.limitType) e.S =
|
|
2168
|
+
*/ function pe(t) {
|
|
2169
|
+
var e = A(t);
|
|
2170
|
+
if (!e.S) if ("F" /* First */ === e.limitType) e.S = Wt(e.path, e.collectionGroup, he(e), e.filters, e.limit, e.startAt, e.endAt); else {
|
|
2161
2171
|
for (
|
|
2162
2172
|
// Flip the orderBy directions since we want the last results
|
|
2163
|
-
var n = [], r = 0, i =
|
|
2173
|
+
var n = [], r = 0, i = he(e); r < i.length; r++) {
|
|
2164
2174
|
var o = i[r], a = "desc" /* DESCENDING */ === o.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
|
|
2165
|
-
n.push(new
|
|
2175
|
+
n.push(new oe(o.field, a));
|
|
2166
2176
|
}
|
|
2167
2177
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
2168
|
-
var s = e.endAt ? new
|
|
2178
|
+
var s = e.endAt ? new ie(e.endAt.position, e.endAt.inclusive) : null, u = e.startAt ? new ie(e.startAt.position, e.startAt.inclusive) : null;
|
|
2169
2179
|
// Now return as a LimitType.First query.
|
|
2170
|
-
e.S =
|
|
2180
|
+
e.S = Wt(e.path, e.collectionGroup, n, e.filters, e.limit, s, u);
|
|
2171
2181
|
}
|
|
2172
2182
|
return e.S;
|
|
2173
2183
|
}
|
|
@@ -2197,7 +2207,7 @@ function ce(t) {
|
|
|
2197
2207
|
* The return value is an IntegerValue if it can safely represent the value,
|
|
2198
2208
|
* otherwise a DoubleValue is returned.
|
|
2199
2209
|
*/
|
|
2200
|
-
function
|
|
2210
|
+
function de(t, e) {
|
|
2201
2211
|
return function(t) {
|
|
2202
2212
|
return "number" == typeof t && Number.isInteger(t) && !lt(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
|
|
2203
2213
|
}(e) ?
|
|
@@ -2242,36 +2252,36 @@ function pe(t, e) {
|
|
|
2242
2252
|
* See the License for the specific language governing permissions and
|
|
2243
2253
|
* limitations under the License.
|
|
2244
2254
|
*/
|
|
2245
|
-
/** Used to represent a field transform on a mutation. */ var
|
|
2255
|
+
/** Used to represent a field transform on a mutation. */ var me = function() {
|
|
2246
2256
|
// Make sure that the structural type of `TransformOperation` is unique.
|
|
2247
2257
|
// See https://github.com/microsoft/TypeScript/issues/5451
|
|
2248
2258
|
this._ = void 0;
|
|
2249
|
-
},
|
|
2259
|
+
}, ye = /** @class */ function(e) {
|
|
2250
2260
|
function n() {
|
|
2251
2261
|
return null !== e && e.apply(this, arguments) || this;
|
|
2252
2262
|
}
|
|
2253
2263
|
return t(n, e), n;
|
|
2254
|
-
}(
|
|
2264
|
+
}(me), ve = /** @class */ function(e) {
|
|
2255
2265
|
function n(t) {
|
|
2256
2266
|
var n = this;
|
|
2257
2267
|
return (n = e.call(this) || this).elements = t, n;
|
|
2258
2268
|
}
|
|
2259
2269
|
return t(n, e), n;
|
|
2260
|
-
}(
|
|
2270
|
+
}(me), ge = /** @class */ function(e) {
|
|
2261
2271
|
function n(t) {
|
|
2262
2272
|
var n = this;
|
|
2263
2273
|
return (n = e.call(this) || this).elements = t, n;
|
|
2264
2274
|
}
|
|
2265
2275
|
return t(n, e), n;
|
|
2266
|
-
}(
|
|
2276
|
+
}(me), we = /** @class */ function(e) {
|
|
2267
2277
|
function n(t, n) {
|
|
2268
2278
|
var r = this;
|
|
2269
2279
|
return (r = e.call(this) || this).q = t, r.O = n, r;
|
|
2270
2280
|
}
|
|
2271
2281
|
return t(n, e), n;
|
|
2272
|
-
}(
|
|
2282
|
+
}(me), be = function(t, e) {
|
|
2273
2283
|
this.field = t, this.transform = e;
|
|
2274
|
-
},
|
|
2284
|
+
}, _e = /** @class */ function() {
|
|
2275
2285
|
function t(t, e) {
|
|
2276
2286
|
this.updateTime = t, this.exists = e
|
|
2277
2287
|
/** Creates a new empty Precondition. */;
|
|
@@ -2293,7 +2303,7 @@ function pe(t, e) {
|
|
|
2293
2303
|
}), t.prototype.isEqual = function(t) {
|
|
2294
2304
|
return this.exists === t.exists && (this.updateTime ? !!t.updateTime && this.updateTime.isEqual(t.updateTime) : !t.updateTime);
|
|
2295
2305
|
}, t;
|
|
2296
|
-
}(),
|
|
2306
|
+
}(), Te = function() {}, Se = /** @class */ function(e) {
|
|
2297
2307
|
function n(t, n, r, i) {
|
|
2298
2308
|
void 0 === i && (i = []);
|
|
2299
2309
|
var o = this;
|
|
@@ -2301,7 +2311,7 @@ function pe(t, e) {
|
|
|
2301
2311
|
o.type = 0 /* Set */ , o;
|
|
2302
2312
|
}
|
|
2303
2313
|
return t(n, e), n;
|
|
2304
|
-
}(
|
|
2314
|
+
}(Te), Ee = /** @class */ function(e) {
|
|
2305
2315
|
function n(t, n, r, i, o) {
|
|
2306
2316
|
void 0 === o && (o = []);
|
|
2307
2317
|
var a = this;
|
|
@@ -2309,24 +2319,24 @@ function pe(t, e) {
|
|
|
2309
2319
|
a.fieldTransforms = o, a.type = 1 /* Patch */ , a;
|
|
2310
2320
|
}
|
|
2311
2321
|
return t(n, e), n;
|
|
2312
|
-
}(
|
|
2322
|
+
}(Te), Ae = /** @class */ function(e) {
|
|
2313
2323
|
function n(t, n) {
|
|
2314
2324
|
var r = this;
|
|
2315
2325
|
return (r = e.call(this) || this).key = t, r.precondition = n, r.type = 2 /* Delete */ ,
|
|
2316
2326
|
r.fieldTransforms = [], r;
|
|
2317
2327
|
}
|
|
2318
2328
|
return t(n, e), n;
|
|
2319
|
-
}(
|
|
2329
|
+
}(Te), Ie = /** @class */ function(e) {
|
|
2320
2330
|
function n(t, n) {
|
|
2321
2331
|
var r = this;
|
|
2322
2332
|
return (r = e.call(this) || this).key = t, r.precondition = n, r.type = 3 /* Verify */ ,
|
|
2323
2333
|
r.fieldTransforms = [], r;
|
|
2324
2334
|
}
|
|
2325
2335
|
return t(n, e), n;
|
|
2326
|
-
}(
|
|
2336
|
+
}(Te), ke = {
|
|
2327
2337
|
asc: "ASCENDING",
|
|
2328
2338
|
desc: "DESCENDING"
|
|
2329
|
-
},
|
|
2339
|
+
}, Ve = {
|
|
2330
2340
|
"<": "LESS_THAN",
|
|
2331
2341
|
"<=": "LESS_THAN_OR_EQUAL",
|
|
2332
2342
|
">": "GREATER_THAN",
|
|
@@ -2337,7 +2347,7 @@ function pe(t, e) {
|
|
|
2337
2347
|
in: "IN",
|
|
2338
2348
|
"not-in": "NOT_IN",
|
|
2339
2349
|
"array-contains-any": "ARRAY_CONTAINS_ANY"
|
|
2340
|
-
},
|
|
2350
|
+
}, De = function(t, e) {
|
|
2341
2351
|
this.databaseId = t, this.F = e;
|
|
2342
2352
|
};
|
|
2343
2353
|
|
|
@@ -2353,7 +2363,7 @@ function pe(t, e) {
|
|
|
2353
2363
|
/**
|
|
2354
2364
|
* Returns a value for a Date that's appropriate to put into a proto.
|
|
2355
2365
|
*/
|
|
2356
|
-
function
|
|
2366
|
+
function Pe(t, e) {
|
|
2357
2367
|
return t.F ? new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "") + "." + ("000000000" + e.nanoseconds).slice(-9) + "Z" : {
|
|
2358
2368
|
seconds: "" + e.seconds,
|
|
2359
2369
|
nanos: e.nanoseconds
|
|
@@ -2364,72 +2374,72 @@ function De(t, e) {
|
|
|
2364
2374
|
* Returns a value for bytes that's appropriate to put in a proto.
|
|
2365
2375
|
*
|
|
2366
2376
|
* Visible for testing.
|
|
2367
|
-
*/ function
|
|
2377
|
+
*/ function Ne(t, e) {
|
|
2368
2378
|
return t.F ? e.toBase64() : e.toUint8Array();
|
|
2369
2379
|
}
|
|
2370
2380
|
|
|
2371
|
-
function
|
|
2372
|
-
return
|
|
2381
|
+
function qe(t, e) {
|
|
2382
|
+
return Pe(t, e.toTimestamp());
|
|
2373
2383
|
}
|
|
2374
2384
|
|
|
2375
|
-
function
|
|
2385
|
+
function Fe(t) {
|
|
2376
2386
|
return E(!!t), _t.fromTimestamp(function(t) {
|
|
2377
2387
|
var e = kt(t);
|
|
2378
2388
|
return new bt(e.seconds, e.nanos);
|
|
2379
2389
|
}(t));
|
|
2380
2390
|
}
|
|
2381
2391
|
|
|
2382
|
-
function
|
|
2392
|
+
function Oe(t, e) {
|
|
2383
2393
|
return function(t) {
|
|
2384
2394
|
return new Z([ "projects", t.projectId, "databases", t.database ]);
|
|
2385
2395
|
}(t).child("documents").child(e).canonicalString();
|
|
2386
2396
|
}
|
|
2387
2397
|
|
|
2388
|
-
function
|
|
2389
|
-
return
|
|
2398
|
+
function Ce(t, e) {
|
|
2399
|
+
return Oe(t.databaseId, e.path);
|
|
2390
2400
|
}
|
|
2391
2401
|
|
|
2392
|
-
function
|
|
2402
|
+
function je(t, e) {
|
|
2393
2403
|
var n, r = function(t) {
|
|
2394
2404
|
var e = Z.fromString(t);
|
|
2395
|
-
return E(
|
|
2405
|
+
return E(ze(e)), e;
|
|
2396
2406
|
}(e);
|
|
2397
|
-
if (r.get(1) !== t.databaseId.projectId) throw new
|
|
2398
|
-
if (r.get(3) !== t.databaseId.database) throw new
|
|
2407
|
+
if (r.get(1) !== t.databaseId.projectId) throw new M(V, "Tried to deserialize key from different project: " + r.get(1) + " vs " + t.databaseId.projectId);
|
|
2408
|
+
if (r.get(3) !== t.databaseId.database) throw new M(V, "Tried to deserialize key from different database: " + r.get(3) + " vs " + t.databaseId.database);
|
|
2399
2409
|
return new nt((E((n = r).length > 4 && "documents" === n.get(4)), n.popFirst(5)));
|
|
2400
2410
|
}
|
|
2401
2411
|
|
|
2402
2412
|
function Le(t, e) {
|
|
2403
|
-
return
|
|
2413
|
+
return Oe(t.databaseId, e);
|
|
2404
2414
|
}
|
|
2405
2415
|
|
|
2406
|
-
function
|
|
2416
|
+
function Re(t) {
|
|
2407
2417
|
return new Z([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
|
|
2408
2418
|
}
|
|
2409
2419
|
|
|
2410
|
-
function
|
|
2420
|
+
function xe(t, e, n) {
|
|
2411
2421
|
return {
|
|
2412
|
-
name:
|
|
2422
|
+
name: Ce(t, e),
|
|
2413
2423
|
fields: n.value.mapValue.fields
|
|
2414
2424
|
};
|
|
2415
2425
|
}
|
|
2416
2426
|
|
|
2417
2427
|
function Me(t) {
|
|
2418
|
-
return
|
|
2428
|
+
return ke[t];
|
|
2419
2429
|
}
|
|
2420
2430
|
|
|
2421
2431
|
// visible for testing
|
|
2422
|
-
function
|
|
2423
|
-
return
|
|
2432
|
+
function Ue(t) {
|
|
2433
|
+
return Ve[t];
|
|
2424
2434
|
}
|
|
2425
2435
|
|
|
2426
|
-
function
|
|
2436
|
+
function Be(t) {
|
|
2427
2437
|
return {
|
|
2428
2438
|
fieldPath: t.canonicalString()
|
|
2429
2439
|
};
|
|
2430
2440
|
}
|
|
2431
2441
|
|
|
2432
|
-
function
|
|
2442
|
+
function Ge(t) {
|
|
2433
2443
|
var e = [];
|
|
2434
2444
|
return t.fields.forEach((function(t) {
|
|
2435
2445
|
return e.push(t.canonicalString());
|
|
@@ -2438,7 +2448,7 @@ function Be(t) {
|
|
|
2438
2448
|
};
|
|
2439
2449
|
}
|
|
2440
2450
|
|
|
2441
|
-
function
|
|
2451
|
+
function ze(t) {
|
|
2442
2452
|
// Resource names have at least 4 components (project ID, database ID)
|
|
2443
2453
|
return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
|
|
2444
2454
|
}
|
|
@@ -2458,8 +2468,8 @@ function Ge(t) {
|
|
|
2458
2468
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2459
2469
|
* See the License for the specific language governing permissions and
|
|
2460
2470
|
* limitations under the License.
|
|
2461
|
-
*/ function
|
|
2462
|
-
return new
|
|
2471
|
+
*/ function Qe(t) {
|
|
2472
|
+
return new De(t, /* useProto3Json= */ !0);
|
|
2463
2473
|
}
|
|
2464
2474
|
|
|
2465
2475
|
/**
|
|
@@ -2486,7 +2496,7 @@ function Ge(t) {
|
|
|
2486
2496
|
* backoff curve, and a +/- 50% "jitter" that is calculated and added to the
|
|
2487
2497
|
* base delay. This prevents clients from accidentally synchronizing their
|
|
2488
2498
|
* delays causing spikes of load to the backend.
|
|
2489
|
-
*/ var
|
|
2499
|
+
*/ var Ke = /** @class */ function() {
|
|
2490
2500
|
function t(
|
|
2491
2501
|
/**
|
|
2492
2502
|
* The AsyncQueue to run backoff operations on.
|
|
@@ -2560,14 +2570,14 @@ function Ge(t) {
|
|
|
2560
2570
|
/** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ t.prototype.Y = function() {
|
|
2561
2571
|
return (Math.random() - .5) * this.j;
|
|
2562
2572
|
}, t;
|
|
2563
|
-
}(),
|
|
2573
|
+
}(), He = /** @class */ function(e) {
|
|
2564
2574
|
function n(t, n, r, i) {
|
|
2565
2575
|
var o = this;
|
|
2566
2576
|
return (o = e.call(this) || this).authCredentials = t, o.appCheckCredentials = n,
|
|
2567
2577
|
o.K = r, o.q = i, o.J = !1, o;
|
|
2568
2578
|
}
|
|
2569
2579
|
return t(n, e), n.prototype.X = function() {
|
|
2570
|
-
if (this.J) throw new
|
|
2580
|
+
if (this.J) throw new M(O, "The client has already been terminated.");
|
|
2571
2581
|
},
|
|
2572
2582
|
/** Invokes the provided RPC with auth and AppCheck tokens. */ n.prototype.m = function(t, e, n) {
|
|
2573
2583
|
var r = this;
|
|
@@ -2576,7 +2586,7 @@ function Ge(t) {
|
|
|
2576
2586
|
return r.K.m(t, e, n, o, a);
|
|
2577
2587
|
})).catch((function(t) {
|
|
2578
2588
|
throw "FirebaseError" === t.name ? (t.code === q && (r.authCredentials.invalidateToken(),
|
|
2579
|
-
r.appCheckCredentials.invalidateToken()), t) : new
|
|
2589
|
+
r.appCheckCredentials.invalidateToken()), t) : new M(k, t.toString());
|
|
2580
2590
|
}));
|
|
2581
2591
|
},
|
|
2582
2592
|
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ n.prototype.T = function(t, e, n) {
|
|
@@ -2586,7 +2596,7 @@ function Ge(t) {
|
|
|
2586
2596
|
return r.K.T(t, e, n, o, a);
|
|
2587
2597
|
})).catch((function(t) {
|
|
2588
2598
|
throw "FirebaseError" === t.name ? (t.code === q && (r.authCredentials.invalidateToken(),
|
|
2589
|
-
r.appCheckCredentials.invalidateToken()), t) : new
|
|
2599
|
+
r.appCheckCredentials.invalidateToken()), t) : new M(k, t.toString());
|
|
2590
2600
|
}));
|
|
2591
2601
|
}, n.prototype.terminate = function() {
|
|
2592
2602
|
this.J = !0;
|
|
@@ -2620,49 +2630,49 @@ function Ge(t) {
|
|
|
2620
2630
|
*/
|
|
2621
2631
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
2622
2632
|
// firestore-exp client.
|
|
2623
|
-
function
|
|
2633
|
+
function We(t, r) {
|
|
2624
2634
|
return e(this, void 0, void 0, (function() {
|
|
2625
2635
|
var e, i, o;
|
|
2626
2636
|
return n(this, (function(n) {
|
|
2627
2637
|
switch (n.label) {
|
|
2628
2638
|
case 0:
|
|
2629
|
-
return e =
|
|
2639
|
+
return e = A(t), i = Re(e.q) + "/documents", o = {
|
|
2630
2640
|
writes: r.map((function(t) {
|
|
2631
2641
|
return function(t, e) {
|
|
2632
2642
|
var n;
|
|
2633
|
-
if (e instanceof
|
|
2634
|
-
update:
|
|
2643
|
+
if (e instanceof Se) n = {
|
|
2644
|
+
update: xe(t, e.key, e.value)
|
|
2645
|
+
}; else if (e instanceof Ae) n = {
|
|
2646
|
+
delete: Ce(t, e.key)
|
|
2635
2647
|
}; else if (e instanceof Ee) n = {
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
update: Re(t, e.key, e.data),
|
|
2639
|
-
updateMask: Be(e.fieldMask)
|
|
2648
|
+
update: xe(t, e.key, e.data),
|
|
2649
|
+
updateMask: Ge(e.fieldMask)
|
|
2640
2650
|
}; else {
|
|
2641
2651
|
if (!(e instanceof Ie)) return S();
|
|
2642
2652
|
n = {
|
|
2643
|
-
verify:
|
|
2653
|
+
verify: Ce(t, e.key)
|
|
2644
2654
|
};
|
|
2645
2655
|
}
|
|
2646
2656
|
return e.fieldTransforms.length > 0 && (n.updateTransforms = e.fieldTransforms.map((function(t) {
|
|
2647
2657
|
return function(t, e) {
|
|
2648
2658
|
var n = e.transform;
|
|
2649
|
-
if (n instanceof
|
|
2659
|
+
if (n instanceof ye) return {
|
|
2650
2660
|
fieldPath: e.field.canonicalString(),
|
|
2651
2661
|
setToServerValue: "REQUEST_TIME"
|
|
2652
2662
|
};
|
|
2653
|
-
if (n instanceof
|
|
2663
|
+
if (n instanceof ve) return {
|
|
2654
2664
|
fieldPath: e.field.canonicalString(),
|
|
2655
2665
|
appendMissingElements: {
|
|
2656
2666
|
values: n.elements
|
|
2657
2667
|
}
|
|
2658
2668
|
};
|
|
2659
|
-
if (n instanceof
|
|
2669
|
+
if (n instanceof ge) return {
|
|
2660
2670
|
fieldPath: e.field.canonicalString(),
|
|
2661
2671
|
removeAllFromArray: {
|
|
2662
2672
|
values: n.elements
|
|
2663
2673
|
}
|
|
2664
2674
|
};
|
|
2665
|
-
if (n instanceof
|
|
2675
|
+
if (n instanceof we) return {
|
|
2666
2676
|
fieldPath: e.field.canonicalString(),
|
|
2667
2677
|
increment: n.O
|
|
2668
2678
|
};
|
|
@@ -2670,7 +2680,7 @@ function He(t, r) {
|
|
|
2670
2680
|
}(0, t);
|
|
2671
2681
|
}))), e.precondition.isNone || (n.currentDocument = function(t, e) {
|
|
2672
2682
|
return void 0 !== e.updateTime ? {
|
|
2673
|
-
updateTime:
|
|
2683
|
+
updateTime: qe(t, e.updateTime)
|
|
2674
2684
|
} : void 0 !== e.exists ? {
|
|
2675
2685
|
exists: e.exists
|
|
2676
2686
|
} : S();
|
|
@@ -2686,15 +2696,15 @@ function He(t, r) {
|
|
|
2686
2696
|
}));
|
|
2687
2697
|
}
|
|
2688
2698
|
|
|
2689
|
-
function
|
|
2699
|
+
function Ye(t, r) {
|
|
2690
2700
|
return e(this, void 0, void 0, (function() {
|
|
2691
2701
|
var e, i, o, a, s, u;
|
|
2692
2702
|
return n(this, (function(n) {
|
|
2693
2703
|
switch (n.label) {
|
|
2694
2704
|
case 0:
|
|
2695
|
-
return e =
|
|
2705
|
+
return e = A(t), i = Re(e.q) + "/documents", o = {
|
|
2696
2706
|
documents: r.map((function(t) {
|
|
2697
|
-
return
|
|
2707
|
+
return Ce(e.q, t);
|
|
2698
2708
|
}))
|
|
2699
2709
|
}, [ 4 /*yield*/ , e.T("BatchGetDocuments", i, o) ];
|
|
2700
2710
|
|
|
@@ -2703,16 +2713,16 @@ function We(t, r) {
|
|
|
2703
2713
|
var n = function(t, e) {
|
|
2704
2714
|
return "found" in e ? function(t, e) {
|
|
2705
2715
|
E(!!e.found), e.found.name, e.found.updateTime;
|
|
2706
|
-
var n =
|
|
2716
|
+
var n = je(t, e.found.name), r = Fe(e.found.updateTime), i = new Qt({
|
|
2707
2717
|
mapValue: {
|
|
2708
2718
|
fields: e.found.fields
|
|
2709
2719
|
}
|
|
2710
2720
|
});
|
|
2711
|
-
return
|
|
2721
|
+
return Kt.newFoundDocument(n, r, i);
|
|
2712
2722
|
}(t, e) : "missing" in e ? function(t, e) {
|
|
2713
2723
|
E(!!e.missing), E(!!e.readTime);
|
|
2714
|
-
var n =
|
|
2715
|
-
return
|
|
2724
|
+
var n = je(t, e.missing), r = Fe(e.readTime);
|
|
2725
|
+
return Kt.newNoDocument(n, r);
|
|
2716
2726
|
}(t, e) : S();
|
|
2717
2727
|
}(e.q, t);
|
|
2718
2728
|
s.set(n.key.toString(), n);
|
|
@@ -2725,13 +2735,13 @@ function We(t, r) {
|
|
|
2725
2735
|
}));
|
|
2726
2736
|
}
|
|
2727
2737
|
|
|
2728
|
-
function
|
|
2738
|
+
function $e(t, r) {
|
|
2729
2739
|
return e(this, void 0, void 0, (function() {
|
|
2730
2740
|
var e, i;
|
|
2731
2741
|
return n(this, (function(n) {
|
|
2732
2742
|
switch (n.label) {
|
|
2733
2743
|
case 0:
|
|
2734
|
-
return e =
|
|
2744
|
+
return e = A(t), i = function(t, e) {
|
|
2735
2745
|
// Dissect the path into parent, collectionId, and optional key filter.
|
|
2736
2746
|
var n = {
|
|
2737
2747
|
structuredQuery: {}
|
|
@@ -2748,36 +2758,36 @@ function Ye(t, r) {
|
|
|
2748
2758
|
// visible for testing
|
|
2749
2759
|
return function(t) {
|
|
2750
2760
|
if ("==" /* EQUAL */ === t.op) {
|
|
2751
|
-
if (
|
|
2761
|
+
if (Bt(t.value)) return {
|
|
2752
2762
|
unaryFilter: {
|
|
2753
|
-
field:
|
|
2763
|
+
field: Be(t.field),
|
|
2754
2764
|
op: "IS_NAN"
|
|
2755
2765
|
}
|
|
2756
2766
|
};
|
|
2757
|
-
if (
|
|
2767
|
+
if (Ut(t.value)) return {
|
|
2758
2768
|
unaryFilter: {
|
|
2759
|
-
field:
|
|
2769
|
+
field: Be(t.field),
|
|
2760
2770
|
op: "IS_NULL"
|
|
2761
2771
|
}
|
|
2762
2772
|
};
|
|
2763
2773
|
} else if ("!=" /* NOT_EQUAL */ === t.op) {
|
|
2764
|
-
if (
|
|
2774
|
+
if (Bt(t.value)) return {
|
|
2765
2775
|
unaryFilter: {
|
|
2766
|
-
field:
|
|
2776
|
+
field: Be(t.field),
|
|
2767
2777
|
op: "IS_NOT_NAN"
|
|
2768
2778
|
}
|
|
2769
2779
|
};
|
|
2770
|
-
if (
|
|
2780
|
+
if (Ut(t.value)) return {
|
|
2771
2781
|
unaryFilter: {
|
|
2772
|
-
field:
|
|
2782
|
+
field: Be(t.field),
|
|
2773
2783
|
op: "IS_NOT_NULL"
|
|
2774
2784
|
}
|
|
2775
2785
|
};
|
|
2776
2786
|
}
|
|
2777
2787
|
return {
|
|
2778
2788
|
fieldFilter: {
|
|
2779
|
-
field:
|
|
2780
|
-
op:
|
|
2789
|
+
field: Be(t.field),
|
|
2790
|
+
op: Ue(t.op),
|
|
2781
2791
|
value: t.value
|
|
2782
2792
|
}
|
|
2783
2793
|
};
|
|
@@ -2797,7 +2807,7 @@ function Ye(t, r) {
|
|
|
2797
2807
|
// visible for testing
|
|
2798
2808
|
return function(t) {
|
|
2799
2809
|
return {
|
|
2800
|
-
field:
|
|
2810
|
+
field: Be(t.field),
|
|
2801
2811
|
direction: Me(t.dir)
|
|
2802
2812
|
};
|
|
2803
2813
|
}(t);
|
|
@@ -2818,7 +2828,7 @@ function Ye(t, r) {
|
|
|
2818
2828
|
values: t.position
|
|
2819
2829
|
};
|
|
2820
2830
|
}(e.endAt)), n;
|
|
2821
|
-
}(e.q,
|
|
2831
|
+
}(e.q, pe(r)), [ 4 /*yield*/ , e.T("RunQuery", i.parent, {
|
|
2822
2832
|
structuredQuery: i.structuredQuery
|
|
2823
2833
|
}) ];
|
|
2824
2834
|
|
|
@@ -2827,11 +2837,11 @@ function Ye(t, r) {
|
|
|
2827
2837
|
return !!t.document;
|
|
2828
2838
|
})).map((function(t) {
|
|
2829
2839
|
return function(t, e, n) {
|
|
2830
|
-
var r =
|
|
2840
|
+
var r = je(t, e.name), i = Fe(e.updateTime), o = new Qt({
|
|
2831
2841
|
mapValue: {
|
|
2832
2842
|
fields: e.fields
|
|
2833
2843
|
}
|
|
2834
|
-
}), a =
|
|
2844
|
+
}), a = Kt.newFoundDocument(r, i, o);
|
|
2835
2845
|
return a;
|
|
2836
2846
|
}(e.q, t.document);
|
|
2837
2847
|
})) ];
|
|
@@ -2855,7 +2865,7 @@ function Ye(t, r) {
|
|
|
2855
2865
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2856
2866
|
* See the License for the specific language governing permissions and
|
|
2857
2867
|
* limitations under the License.
|
|
2858
|
-
*/ var
|
|
2868
|
+
*/ var Xe = new Map;
|
|
2859
2869
|
|
|
2860
2870
|
/**
|
|
2861
2871
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -2865,17 +2875,17 @@ function Ye(t, r) {
|
|
|
2865
2875
|
* Returns an initialized and started Datastore for the given Firestore
|
|
2866
2876
|
* instance. Callers must invoke removeComponents() when the Firestore
|
|
2867
2877
|
* instance is terminated.
|
|
2868
|
-
*/ function
|
|
2869
|
-
if (t._terminated) throw new
|
|
2870
|
-
if (
|
|
2878
|
+
*/ function Je(t) {
|
|
2879
|
+
if (t._terminated) throw new M(O, "The client has already been terminated.");
|
|
2880
|
+
if (!Xe.has(t)) {
|
|
2871
2881
|
w("ComponentProvider", "Initializing Datastore");
|
|
2872
2882
|
var e = function(t) {
|
|
2873
2883
|
return new mt(t, fetch.bind(null));
|
|
2874
2884
|
}((i = t._databaseId, o = t.app.options.appId || "", a = t._persistenceKey, s = t._freezeSettings(),
|
|
2875
|
-
new $(i, o, a, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), n =
|
|
2876
|
-
return new
|
|
2885
|
+
new $(i, o, a, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), n = Qe(t._databaseId), r = function(t, e, n, r) {
|
|
2886
|
+
return new He(t, e, n, r);
|
|
2877
2887
|
}(t._authCredentials, t._appCheckCredentials, e, n);
|
|
2878
|
-
|
|
2888
|
+
Xe.set(t, r);
|
|
2879
2889
|
}
|
|
2880
2890
|
var i, o, a, s;
|
|
2881
2891
|
/**
|
|
@@ -2893,7 +2903,7 @@ function Ye(t, r) {
|
|
|
2893
2903
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2894
2904
|
* See the License for the specific language governing permissions and
|
|
2895
2905
|
* limitations under the License.
|
|
2896
|
-
*/ return
|
|
2906
|
+
*/ return Xe.get(t);
|
|
2897
2907
|
}
|
|
2898
2908
|
|
|
2899
2909
|
/**
|
|
@@ -2904,37 +2914,37 @@ function Ye(t, r) {
|
|
|
2904
2914
|
* A concrete type describing all the values that can be applied via a
|
|
2905
2915
|
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
2906
2916
|
* defaults can be supplied and the value can be checked for equality.
|
|
2907
|
-
*/ var
|
|
2917
|
+
*/ var Ze = /** @class */ function() {
|
|
2908
2918
|
function t(t) {
|
|
2909
2919
|
var e;
|
|
2910
2920
|
if (void 0 === t.host) {
|
|
2911
|
-
if (void 0 !== t.ssl) throw new
|
|
2921
|
+
if (void 0 !== t.ssl) throw new M(V, "Can't provide ssl option if host option is not set");
|
|
2912
2922
|
this.host = "firestore.googleapis.com", this.ssl = !0;
|
|
2913
2923
|
} else this.host = t.host, this.ssl = null === (e = t.ssl) || void 0 === e || e;
|
|
2914
2924
|
if (this.credentials = t.credentials, this.ignoreUndefinedProperties = !!t.ignoreUndefinedProperties,
|
|
2915
2925
|
void 0 === t.cacheSizeBytes) this.cacheSizeBytes = 41943040; else {
|
|
2916
|
-
if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new
|
|
2926
|
+
if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new M(V, "cacheSizeBytes must be at least 1048576");
|
|
2917
2927
|
this.cacheSizeBytes = t.cacheSizeBytes;
|
|
2918
2928
|
}
|
|
2919
2929
|
this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
|
|
2920
2930
|
this.useFetchStreams = !!t.useFetchStreams, function(t, e, n, r) {
|
|
2921
|
-
if (!0 === e && !0 === r) throw new
|
|
2931
|
+
if (!0 === e && !0 === r) throw new M(V, "experimentalForceLongPolling and experimentalAutoDetectLongPolling cannot be used together.");
|
|
2922
2932
|
}(0, t.experimentalForceLongPolling, 0, t.experimentalAutoDetectLongPolling);
|
|
2923
2933
|
}
|
|
2924
2934
|
return t.prototype.isEqual = function(t) {
|
|
2925
2935
|
return this.host === t.host && this.ssl === t.ssl && this.credentials === t.credentials && this.cacheSizeBytes === t.cacheSizeBytes && this.experimentalForceLongPolling === t.experimentalForceLongPolling && this.experimentalAutoDetectLongPolling === t.experimentalAutoDetectLongPolling && this.ignoreUndefinedProperties === t.ignoreUndefinedProperties && this.useFetchStreams === t.useFetchStreams;
|
|
2926
2936
|
}, t;
|
|
2927
|
-
}(),
|
|
2937
|
+
}(), tn = /** @class */ function() {
|
|
2928
2938
|
/** @hideconstructor */
|
|
2929
2939
|
function t(t, e, n) {
|
|
2930
2940
|
this._authCredentials = e, this._appCheckCredentials = n,
|
|
2931
2941
|
/**
|
|
2932
2942
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
2933
2943
|
*/
|
|
2934
|
-
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new
|
|
2944
|
+
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new Ze({}),
|
|
2935
2945
|
this._settingsFrozen = !1, t instanceof X ? this._databaseId = t : (this._app = t,
|
|
2936
2946
|
this._databaseId = function(t) {
|
|
2937
|
-
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new
|
|
2947
|
+
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new M(V, '"projectId" not provided in firebase.initializeApp.');
|
|
2938
2948
|
return new X(t.options.projectId);
|
|
2939
2949
|
}(t));
|
|
2940
2950
|
}
|
|
@@ -2944,7 +2954,7 @@ function Ye(t, r) {
|
|
|
2944
2954
|
* instance.
|
|
2945
2955
|
*/
|
|
2946
2956
|
get: function() {
|
|
2947
|
-
if (!this._app) throw new
|
|
2957
|
+
if (!this._app) throw new M(O, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
|
|
2948
2958
|
return this._app;
|
|
2949
2959
|
},
|
|
2950
2960
|
enumerable: !1,
|
|
@@ -2962,8 +2972,8 @@ function Ye(t, r) {
|
|
|
2962
2972
|
enumerable: !1,
|
|
2963
2973
|
configurable: !0
|
|
2964
2974
|
}), t.prototype._setSettings = function(t) {
|
|
2965
|
-
if (this._settingsFrozen) throw new
|
|
2966
|
-
this._settings = new
|
|
2975
|
+
if (this._settingsFrozen) throw new M(O, "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.");
|
|
2976
|
+
this._settings = new Ze(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
2967
2977
|
if (!t) return new G;
|
|
2968
2978
|
switch (t.type) {
|
|
2969
2979
|
case "gapi":
|
|
@@ -2976,7 +2986,7 @@ function Ye(t, r) {
|
|
|
2976
2986
|
return t.client;
|
|
2977
2987
|
|
|
2978
2988
|
default:
|
|
2979
|
-
throw new
|
|
2989
|
+
throw new M(V, "makeAuthCredentialsProvider failed due to invalid credential type");
|
|
2980
2990
|
}
|
|
2981
2991
|
}(t.credentials));
|
|
2982
2992
|
}, t.prototype._getSettings = function() {
|
|
@@ -3001,8 +3011,8 @@ function Ye(t, r) {
|
|
|
3001
3011
|
* Only ever called once.
|
|
3002
3012
|
*/
|
|
3003
3013
|
t.prototype._terminate = function() {
|
|
3004
|
-
return t = this, (e =
|
|
3005
|
-
|
|
3014
|
+
return t = this, (e = Xe.get(t)) && (w("ComponentProvider", "Removing Datastore"),
|
|
3015
|
+
Xe.delete(t), e.terminate()), Promise.resolve();
|
|
3006
3016
|
var t, e;
|
|
3007
3017
|
}, t;
|
|
3008
3018
|
}();
|
|
@@ -3027,9 +3037,9 @@ function Ye(t, r) {
|
|
|
3027
3037
|
* The Cloud Firestore service interface.
|
|
3028
3038
|
*
|
|
3029
3039
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
3030
|
-
*/ function
|
|
3040
|
+
*/ function en(t, e) {
|
|
3031
3041
|
var n = _getProvider(t, "firestore/lite");
|
|
3032
|
-
if (n.isInitialized()) throw new
|
|
3042
|
+
if (n.isInitialized()) throw new M(O, "Firestore can only be initialized once per app.");
|
|
3033
3043
|
return n.initialize({
|
|
3034
3044
|
options: e
|
|
3035
3045
|
});
|
|
@@ -3043,7 +3053,7 @@ function Ye(t, r) {
|
|
|
3043
3053
|
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
|
|
3044
3054
|
* instance is associated with.
|
|
3045
3055
|
* @returns The `Firestore` instance of the provided app.
|
|
3046
|
-
*/ function
|
|
3056
|
+
*/ function nn(t) {
|
|
3047
3057
|
return void 0 === t && (t = s()), _getProvider(t, "firestore/lite").getImmediate();
|
|
3048
3058
|
}
|
|
3049
3059
|
|
|
@@ -3059,10 +3069,10 @@ function Ye(t, r) {
|
|
|
3059
3069
|
* @param port - the emulator port (ex: 9000).
|
|
3060
3070
|
* @param options.mockUserToken - the mock auth token to use for unit testing
|
|
3061
3071
|
* Security Rules.
|
|
3062
|
-
*/ function
|
|
3072
|
+
*/ function rn(t, e, n, r) {
|
|
3063
3073
|
var i;
|
|
3064
3074
|
void 0 === r && (r = {});
|
|
3065
|
-
var o = (t = st(t,
|
|
3075
|
+
var o = (t = st(t, tn))._getSettings();
|
|
3066
3076
|
if ("firestore.googleapis.com" !== o.host && o.host !== e && _("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
3067
3077
|
t._setSettings(Object.assign(Object.assign({}, o), {
|
|
3068
3078
|
host: e + ":" + n,
|
|
@@ -3074,7 +3084,7 @@ function Ye(t, r) {
|
|
|
3074
3084
|
// invalid field "uid" and missing field "sub" / "user_id".)
|
|
3075
3085
|
a = d(r.mockUserToken, null === (i = t._app) || void 0 === i ? void 0 : i.options.projectId);
|
|
3076
3086
|
var u = r.mockUserToken.sub || r.mockUserToken.user_id;
|
|
3077
|
-
if (!u) throw new
|
|
3087
|
+
if (!u) throw new M(V, "mockUserToken must contain 'sub' or 'user_id' field!");
|
|
3078
3088
|
s = new m(u);
|
|
3079
3089
|
}
|
|
3080
3090
|
t._authCredentials = new z(new B(a, s));
|
|
@@ -3100,8 +3110,8 @@ function Ye(t, r) {
|
|
|
3100
3110
|
* @param firestore - The `Firestore` instance to terminate.
|
|
3101
3111
|
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
3102
3112
|
* terminated.
|
|
3103
|
-
*/ function
|
|
3104
|
-
return t = st(t,
|
|
3113
|
+
*/ function on(t) {
|
|
3114
|
+
return t = st(t, tn), u(t.app, "firestore/lite"), t._delete()
|
|
3105
3115
|
/**
|
|
3106
3116
|
* @license
|
|
3107
3117
|
* Copyright 2020 Google LLC
|
|
@@ -3141,7 +3151,7 @@ function Ye(t, r) {
|
|
|
3141
3151
|
*/;
|
|
3142
3152
|
}
|
|
3143
3153
|
|
|
3144
|
-
var
|
|
3154
|
+
var an = /** @class */ function() {
|
|
3145
3155
|
/** @hideconstructor */
|
|
3146
3156
|
function t(t,
|
|
3147
3157
|
/**
|
|
@@ -3182,14 +3192,14 @@ var on = /** @class */ function() {
|
|
|
3182
3192
|
* The collection this `DocumentReference` belongs to.
|
|
3183
3193
|
*/
|
|
3184
3194
|
get: function() {
|
|
3185
|
-
return new
|
|
3195
|
+
return new un(this.firestore, this.converter, this._key.path.popLast());
|
|
3186
3196
|
},
|
|
3187
3197
|
enumerable: !1,
|
|
3188
3198
|
configurable: !0
|
|
3189
3199
|
}), t.prototype.withConverter = function(e) {
|
|
3190
3200
|
return new t(this.firestore, e, this._key);
|
|
3191
3201
|
}, t;
|
|
3192
|
-
}(),
|
|
3202
|
+
}(), sn = /** @class */ function() {
|
|
3193
3203
|
// This is the lite version of the Query class in the main SDK.
|
|
3194
3204
|
/** @hideconstructor protected */
|
|
3195
3205
|
function t(t,
|
|
@@ -3204,11 +3214,11 @@ var on = /** @class */ function() {
|
|
|
3204
3214
|
return t.prototype.withConverter = function(e) {
|
|
3205
3215
|
return new t(this.firestore, e, this._query);
|
|
3206
3216
|
}, t;
|
|
3207
|
-
}(),
|
|
3217
|
+
}(), un = /** @class */ function(e) {
|
|
3208
3218
|
/** @hideconstructor */
|
|
3209
3219
|
function n(t, n, r) {
|
|
3210
3220
|
var i = this;
|
|
3211
|
-
return (i = e.call(this, t, n, new
|
|
3221
|
+
return (i = e.call(this, t, n, new ue(r)) || this)._path = r,
|
|
3212
3222
|
/** The type of this Firestore reference. */
|
|
3213
3223
|
i.type = "collection", i;
|
|
3214
3224
|
}
|
|
@@ -3235,7 +3245,7 @@ var on = /** @class */ function() {
|
|
|
3235
3245
|
*/
|
|
3236
3246
|
get: function() {
|
|
3237
3247
|
var t = this._path.popLast();
|
|
3238
|
-
return t.isEmpty() ? null : new
|
|
3248
|
+
return t.isEmpty() ? null : new an(this.firestore,
|
|
3239
3249
|
/* converter= */ null, new nt(t));
|
|
3240
3250
|
},
|
|
3241
3251
|
enumerable: !1,
|
|
@@ -3243,20 +3253,20 @@ var on = /** @class */ function() {
|
|
|
3243
3253
|
}), n.prototype.withConverter = function(t) {
|
|
3244
3254
|
return new n(this.firestore, t, this._path);
|
|
3245
3255
|
}, n;
|
|
3246
|
-
}(
|
|
3256
|
+
}(sn);
|
|
3247
3257
|
|
|
3248
3258
|
/**
|
|
3249
3259
|
* A `Query` refers to a query which you can read or listen to. You can also
|
|
3250
3260
|
* construct refined `Query` objects by adding filters and ordering.
|
|
3251
|
-
*/ function
|
|
3261
|
+
*/ function cn(t, e) {
|
|
3252
3262
|
for (var n = [], i = 2; i < arguments.length; i++) n[i - 2] = arguments[i];
|
|
3253
|
-
if (t = p(t), rt("collection", "path", e), t instanceof
|
|
3263
|
+
if (t = p(t), rt("collection", "path", e), t instanceof tn) {
|
|
3254
3264
|
var o = Z.fromString.apply(Z, r([ e ], n));
|
|
3255
|
-
return ot(o), new
|
|
3265
|
+
return ot(o), new un(t, /* converter= */ null, o);
|
|
3256
3266
|
}
|
|
3257
|
-
if (!(t instanceof
|
|
3267
|
+
if (!(t instanceof an || t instanceof un)) throw new M(V, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3258
3268
|
var a = t._path.child(Z.fromString.apply(Z, r([ e ], n)));
|
|
3259
|
-
return ot(a), new
|
|
3269
|
+
return ot(a), new un(t.firestore,
|
|
3260
3270
|
/* converter= */ null, a);
|
|
3261
3271
|
}
|
|
3262
3272
|
|
|
@@ -3272,32 +3282,32 @@ var on = /** @class */ function() {
|
|
|
3272
3282
|
* collection or subcollection with this ID as the last segment of its path
|
|
3273
3283
|
* will be included. Cannot contain a slash.
|
|
3274
3284
|
* @returns The created `Query`.
|
|
3275
|
-
*/ function
|
|
3276
|
-
if (t = st(t,
|
|
3277
|
-
return new
|
|
3285
|
+
*/ function ln(t, e) {
|
|
3286
|
+
if (t = st(t, tn), rt("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new M(V, "Invalid collection ID '" + e + "' passed to function collectionGroup(). Collection IDs must not contain '/'.");
|
|
3287
|
+
return new sn(t,
|
|
3278
3288
|
/* converter= */ null,
|
|
3279
3289
|
/**
|
|
3280
3290
|
* Creates a new Query for a collection group query that matches all documents
|
|
3281
3291
|
* within the provided collection group.
|
|
3282
3292
|
*/
|
|
3283
3293
|
function(t) {
|
|
3284
|
-
return new
|
|
3294
|
+
return new ue(Z.emptyPath(), t);
|
|
3285
3295
|
}(e));
|
|
3286
3296
|
}
|
|
3287
3297
|
|
|
3288
|
-
function
|
|
3298
|
+
function fn(t, e) {
|
|
3289
3299
|
for (var n = [], i = 2; i < arguments.length; i++) n[i - 2] = arguments[i];
|
|
3290
3300
|
if (t = p(t),
|
|
3291
3301
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
3292
3302
|
// 'undefined' and 'null'.
|
|
3293
|
-
1 === arguments.length && (e = vt.R()), rt("doc", "path", e), t instanceof
|
|
3303
|
+
1 === arguments.length && (e = vt.R()), rt("doc", "path", e), t instanceof tn) {
|
|
3294
3304
|
var o = Z.fromString.apply(Z, r([ e ], n));
|
|
3295
|
-
return it(o), new
|
|
3305
|
+
return it(o), new an(t,
|
|
3296
3306
|
/* converter= */ null, new nt(o));
|
|
3297
3307
|
}
|
|
3298
|
-
if (!(t instanceof
|
|
3308
|
+
if (!(t instanceof an || t instanceof un)) throw new M(V, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3299
3309
|
var a = t._path.child(Z.fromString.apply(Z, r([ e ], n)));
|
|
3300
|
-
return it(a), new
|
|
3310
|
+
return it(a), new an(t.firestore, t instanceof un ? t.converter : null, new nt(a));
|
|
3301
3311
|
}
|
|
3302
3312
|
|
|
3303
3313
|
/**
|
|
@@ -3307,8 +3317,8 @@ function ln(t, e) {
|
|
|
3307
3317
|
* @param right - A reference to compare.
|
|
3308
3318
|
* @returns true if the references point to the same location in the same
|
|
3309
3319
|
* Firestore database.
|
|
3310
|
-
*/ function
|
|
3311
|
-
return t = p(t), e = p(e), (t instanceof
|
|
3320
|
+
*/ function hn(t, e) {
|
|
3321
|
+
return t = p(t), e = p(e), (t instanceof an || t instanceof un) && (e instanceof an || e instanceof un) && t.firestore === e.firestore && t.path === e.path && t.converter === e.converter
|
|
3312
3322
|
/**
|
|
3313
3323
|
* Returns true if the provided queries point to the same collection and apply
|
|
3314
3324
|
* the same constraints.
|
|
@@ -3320,18 +3330,18 @@ function ln(t, e) {
|
|
|
3320
3330
|
*/;
|
|
3321
3331
|
}
|
|
3322
3332
|
|
|
3323
|
-
function
|
|
3324
|
-
return t = p(t), e = p(e), t instanceof
|
|
3333
|
+
function pn(t, e) {
|
|
3334
|
+
return t = p(t), e = p(e), t instanceof sn && e instanceof sn && t.firestore === e.firestore && function(t, e) {
|
|
3325
3335
|
return function(t, e) {
|
|
3326
3336
|
if (t.limit !== e.limit) return !1;
|
|
3327
3337
|
if (t.orderBy.length !== e.orderBy.length) return !1;
|
|
3328
|
-
for (var n = 0; n < t.orderBy.length; n++) if (!
|
|
3338
|
+
for (var n = 0; n < t.orderBy.length; n++) if (!ae(t.orderBy[n], e.orderBy[n])) return !1;
|
|
3329
3339
|
if (t.filters.length !== e.filters.length) return !1;
|
|
3330
3340
|
for (var r = 0; r < t.filters.length; r++) if (i = t.filters[r], o = e.filters[r],
|
|
3331
|
-
i.op !== o.op || !i.field.isEqual(o.field) || !
|
|
3341
|
+
i.op !== o.op || !i.field.isEqual(o.field) || !Ct(i.value, o.value)) return !1;
|
|
3332
3342
|
var i, o;
|
|
3333
|
-
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!
|
|
3334
|
-
}(
|
|
3343
|
+
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!se(t.startAt, e.startAt) && se(t.endAt, e.endAt);
|
|
3344
|
+
}(pe(t), pe(e)) && t.limitType === e.limitType;
|
|
3335
3345
|
}(t._query, e._query) && t.converter === e.converter
|
|
3336
3346
|
/**
|
|
3337
3347
|
* @license
|
|
@@ -3359,7 +3369,7 @@ function hn(t, e) {
|
|
|
3359
3369
|
*/;
|
|
3360
3370
|
}
|
|
3361
3371
|
|
|
3362
|
-
var
|
|
3372
|
+
var dn = /** @class */ function() {
|
|
3363
3373
|
/**
|
|
3364
3374
|
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
3365
3375
|
* name is provided, the path will point to a nested field in a document.
|
|
@@ -3368,7 +3378,7 @@ var pn = /** @class */ function() {
|
|
|
3368
3378
|
*/
|
|
3369
3379
|
function t() {
|
|
3370
3380
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
3371
|
-
for (var n = 0; n < t.length; ++n) if (0 === t[n].length) throw new
|
|
3381
|
+
for (var n = 0; n < t.length; ++n) if (0 === t[n].length) throw new M(V, "Invalid field name at argument $(i + 1). Field names must not be empty.");
|
|
3372
3382
|
this._internalPath = new et(t);
|
|
3373
3383
|
}
|
|
3374
3384
|
/**
|
|
@@ -3384,8 +3394,8 @@ var pn = /** @class */ function() {
|
|
|
3384
3394
|
/**
|
|
3385
3395
|
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
3386
3396
|
* It can be used in queries to sort or filter by the document ID.
|
|
3387
|
-
*/ function
|
|
3388
|
-
return new
|
|
3397
|
+
*/ function mn() {
|
|
3398
|
+
return new dn("__name__");
|
|
3389
3399
|
}
|
|
3390
3400
|
|
|
3391
3401
|
/**
|
|
@@ -3406,7 +3416,7 @@ var pn = /** @class */ function() {
|
|
|
3406
3416
|
*/
|
|
3407
3417
|
/**
|
|
3408
3418
|
* An immutable object representing an array of bytes.
|
|
3409
|
-
*/ var
|
|
3419
|
+
*/ var yn = /** @class */ function() {
|
|
3410
3420
|
/** @hideconstructor */
|
|
3411
3421
|
function t(t) {
|
|
3412
3422
|
this._byteString = t;
|
|
@@ -3418,9 +3428,9 @@ var pn = /** @class */ function() {
|
|
|
3418
3428
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
3419
3429
|
*/ return t.fromBase64String = function(e) {
|
|
3420
3430
|
try {
|
|
3421
|
-
return new t(
|
|
3431
|
+
return new t(At.fromBase64String(e));
|
|
3422
3432
|
} catch (e) {
|
|
3423
|
-
throw new
|
|
3433
|
+
throw new M(V, "Failed to construct data from Base64 string: " + e);
|
|
3424
3434
|
}
|
|
3425
3435
|
},
|
|
3426
3436
|
/**
|
|
@@ -3429,7 +3439,7 @@ var pn = /** @class */ function() {
|
|
|
3429
3439
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
3430
3440
|
*/
|
|
3431
3441
|
t.fromUint8Array = function(e) {
|
|
3432
|
-
return new t(
|
|
3442
|
+
return new t(At.fromUint8Array(e));
|
|
3433
3443
|
},
|
|
3434
3444
|
/**
|
|
3435
3445
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -3464,14 +3474,14 @@ var pn = /** @class */ function() {
|
|
|
3464
3474
|
t.prototype.isEqual = function(t) {
|
|
3465
3475
|
return this._byteString.isEqual(t._byteString);
|
|
3466
3476
|
}, t;
|
|
3467
|
-
}(),
|
|
3477
|
+
}(), vn =
|
|
3468
3478
|
/**
|
|
3469
3479
|
* @param _methodName - The public API endpoint that returns this class.
|
|
3470
3480
|
* @hideconstructor
|
|
3471
3481
|
*/
|
|
3472
3482
|
function(t) {
|
|
3473
3483
|
this._methodName = t;
|
|
3474
|
-
},
|
|
3484
|
+
}, gn = /** @class */ function() {
|
|
3475
3485
|
/**
|
|
3476
3486
|
* Creates a new immutable `GeoPoint` object with the provided latitude and
|
|
3477
3487
|
* longitude values.
|
|
@@ -3479,8 +3489,8 @@ function(t) {
|
|
|
3479
3489
|
* @param longitude - The longitude as number between -180 and 180.
|
|
3480
3490
|
*/
|
|
3481
3491
|
function t(t, e) {
|
|
3482
|
-
if (!isFinite(t) || t < -90 || t > 90) throw new
|
|
3483
|
-
if (!isFinite(e) || e < -180 || e > 180) throw new
|
|
3492
|
+
if (!isFinite(t) || t < -90 || t > 90) throw new M(V, "Latitude must be a number between -90 and 90, but was: " + t);
|
|
3493
|
+
if (!isFinite(e) || e < -180 || e > 180) throw new M(V, "Longitude must be a number between -180 and 180, but was: " + e);
|
|
3484
3494
|
this._lat = t, this._long = e;
|
|
3485
3495
|
}
|
|
3486
3496
|
return Object.defineProperty(t.prototype, "latitude", {
|
|
@@ -3524,21 +3534,21 @@ function(t) {
|
|
|
3524
3534
|
t.prototype._compareTo = function(t) {
|
|
3525
3535
|
return gt(this._lat, t._lat) || gt(this._long, t._long);
|
|
3526
3536
|
}, t;
|
|
3527
|
-
}(),
|
|
3537
|
+
}(), wn = /^__.*__$/, bn = /** @class */ function() {
|
|
3528
3538
|
function t(t, e, n) {
|
|
3529
3539
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
3530
3540
|
}
|
|
3531
3541
|
return t.prototype.toMutation = function(t, e) {
|
|
3532
|
-
return null !== this.fieldMask ? new
|
|
3542
|
+
return null !== this.fieldMask ? new Ee(t, this.data, this.fieldMask, e, this.fieldTransforms) : new Se(t, this.data, e, this.fieldTransforms);
|
|
3533
3543
|
}, t;
|
|
3534
|
-
}(),
|
|
3544
|
+
}(), _n = /** @class */ function() {
|
|
3535
3545
|
function t(t,
|
|
3536
3546
|
// The fieldMask does not include document transforms.
|
|
3537
3547
|
e, n) {
|
|
3538
3548
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
3539
3549
|
}
|
|
3540
3550
|
return t.prototype.toMutation = function(t, e) {
|
|
3541
|
-
return new
|
|
3551
|
+
return new Ee(t, this.data, this.fieldMask, e, this.fieldTransforms);
|
|
3542
3552
|
}, t;
|
|
3543
3553
|
}();
|
|
3544
3554
|
|
|
@@ -3561,7 +3571,7 @@ function(t) {
|
|
|
3561
3571
|
/**
|
|
3562
3572
|
* Sentinel values that can be used when writing document fields with `set()`
|
|
3563
3573
|
* or `update()`.
|
|
3564
|
-
*/ function
|
|
3574
|
+
*/ function Tn(t) {
|
|
3565
3575
|
switch (t) {
|
|
3566
3576
|
case 0 /* Set */ :
|
|
3567
3577
|
// fall through
|
|
@@ -3579,7 +3589,7 @@ function(t) {
|
|
|
3579
3589
|
}
|
|
3580
3590
|
}
|
|
3581
3591
|
|
|
3582
|
-
/** A "context" object passed around while parsing user data. */ var
|
|
3592
|
+
/** A "context" object passed around while parsing user data. */ var Sn = /** @class */ function() {
|
|
3583
3593
|
/**
|
|
3584
3594
|
* Initializes a ParseContext with the given source and path.
|
|
3585
3595
|
*
|
|
@@ -3639,7 +3649,7 @@ function(t) {
|
|
|
3639
3649
|
rt: !0
|
|
3640
3650
|
});
|
|
3641
3651
|
}, t.prototype.ut = function(t) {
|
|
3642
|
-
return
|
|
3652
|
+
return Gn(t, this.settings.methodName, this.settings.at || !1, this.path, this.settings.ct);
|
|
3643
3653
|
},
|
|
3644
3654
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ t.prototype.contains = function(t) {
|
|
3645
3655
|
return void 0 !== this.fieldMask.find((function(e) {
|
|
@@ -3653,21 +3663,21 @@ function(t) {
|
|
|
3653
3663
|
if (this.path) for (var t = 0; t < this.path.length; t++) this.st(this.path.get(t));
|
|
3654
3664
|
}, t.prototype.st = function(t) {
|
|
3655
3665
|
if (0 === t.length) throw this.ut("Document fields must not be empty");
|
|
3656
|
-
if (
|
|
3666
|
+
if (Tn(this.tt) && wn.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
|
|
3657
3667
|
}, t;
|
|
3658
|
-
}(),
|
|
3668
|
+
}(), En = /** @class */ function() {
|
|
3659
3669
|
function t(t, e, n) {
|
|
3660
|
-
this.databaseId = t, this.ignoreUndefinedProperties = e, this.q = n ||
|
|
3670
|
+
this.databaseId = t, this.ignoreUndefinedProperties = e, this.q = n || Qe(t)
|
|
3661
3671
|
/** Creates a new top-level parse context. */;
|
|
3662
3672
|
}
|
|
3663
3673
|
return t.prototype.ht = function(t, e, n, r) {
|
|
3664
|
-
return void 0 === r && (r = !1), new
|
|
3674
|
+
return void 0 === r && (r = !1), new Sn({
|
|
3665
3675
|
tt: t,
|
|
3666
3676
|
methodName: e,
|
|
3667
|
-
|
|
3677
|
+
ct: n,
|
|
3668
3678
|
path: et.emptyPath(),
|
|
3669
3679
|
rt: !1,
|
|
3670
|
-
|
|
3680
|
+
at: r
|
|
3671
3681
|
}, this.databaseId, this.q, this.ignoreUndefinedProperties);
|
|
3672
3682
|
}, t;
|
|
3673
3683
|
}();
|
|
@@ -3675,30 +3685,30 @@ function(t) {
|
|
|
3675
3685
|
/**
|
|
3676
3686
|
* Helper for parsing raw user input (provided via the API) into internal model
|
|
3677
3687
|
* classes.
|
|
3678
|
-
*/ function
|
|
3679
|
-
var e = t._freezeSettings(), n =
|
|
3680
|
-
return new
|
|
3688
|
+
*/ function An(t) {
|
|
3689
|
+
var e = t._freezeSettings(), n = Qe(t._databaseId);
|
|
3690
|
+
return new En(t._databaseId, !!e.ignoreUndefinedProperties, n);
|
|
3681
3691
|
}
|
|
3682
3692
|
|
|
3683
3693
|
/** Parse document data from a set() call. */ function In(t, e, n, r, i, o) {
|
|
3684
3694
|
void 0 === o && (o = {});
|
|
3685
3695
|
var a = t.ht(o.merge || o.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, i);
|
|
3686
|
-
|
|
3696
|
+
xn("Data must be an object, but it was:", a, r);
|
|
3687
3697
|
var s, u, c = Ln(r, a);
|
|
3688
3698
|
if (o.merge) s = new Et(a.fieldMask), u = a.fieldTransforms; else if (o.mergeFields) {
|
|
3689
3699
|
for (var l = [], f = 0, h = o.mergeFields; f < h.length; f++) {
|
|
3690
3700
|
var p = Mn(e, h[f], n);
|
|
3691
|
-
if (!a.contains(p)) throw new
|
|
3692
|
-
|
|
3701
|
+
if (!a.contains(p)) throw new M(V, "Field '" + p + "' is specified in your field mask but missing from your input data.");
|
|
3702
|
+
zn(l, p) || l.push(p);
|
|
3693
3703
|
}
|
|
3694
3704
|
s = new Et(l), u = a.fieldTransforms.filter((function(t) {
|
|
3695
3705
|
return s.covers(t.field);
|
|
3696
3706
|
}));
|
|
3697
3707
|
} else s = null, u = a.fieldTransforms;
|
|
3698
|
-
return new
|
|
3708
|
+
return new bn(new Qt(c), s, u);
|
|
3699
3709
|
}
|
|
3700
3710
|
|
|
3701
|
-
var
|
|
3711
|
+
var kn = /** @class */ function(e) {
|
|
3702
3712
|
function n() {
|
|
3703
3713
|
return null !== e && e.apply(this, arguments) || this;
|
|
3704
3714
|
}
|
|
@@ -3710,7 +3720,7 @@ var An = /** @class */ function(e) {
|
|
|
3710
3720
|
}, n.prototype.isEqual = function(t) {
|
|
3711
3721
|
return t instanceof n;
|
|
3712
3722
|
}, n;
|
|
3713
|
-
}(
|
|
3723
|
+
}(vn);
|
|
3714
3724
|
|
|
3715
3725
|
/**
|
|
3716
3726
|
* Creates a child context for parsing SerializableFieldValues.
|
|
@@ -3727,110 +3737,110 @@ var An = /** @class */ function(e) {
|
|
|
3727
3737
|
* context.
|
|
3728
3738
|
* @param context - The parent context.
|
|
3729
3739
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
3730
|
-
*/ function
|
|
3731
|
-
return new
|
|
3740
|
+
*/ function Vn(t, e, n) {
|
|
3741
|
+
return new Sn({
|
|
3732
3742
|
tt: 3 /* Argument */ ,
|
|
3733
|
-
|
|
3743
|
+
ct: e.settings.ct,
|
|
3734
3744
|
methodName: t._methodName,
|
|
3735
3745
|
rt: n
|
|
3736
3746
|
}, e.databaseId, e.q, e.ignoreUndefinedProperties);
|
|
3737
3747
|
}
|
|
3738
3748
|
|
|
3739
|
-
var
|
|
3749
|
+
var Dn = /** @class */ function(e) {
|
|
3740
3750
|
function n() {
|
|
3741
3751
|
return null !== e && e.apply(this, arguments) || this;
|
|
3742
3752
|
}
|
|
3743
3753
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
3744
|
-
return new
|
|
3754
|
+
return new be(t.path, new ye);
|
|
3745
3755
|
}, n.prototype.isEqual = function(t) {
|
|
3746
3756
|
return t instanceof n;
|
|
3747
3757
|
}, n;
|
|
3748
|
-
}(
|
|
3758
|
+
}(vn), Pn = /** @class */ function(e) {
|
|
3749
3759
|
function n(t, n) {
|
|
3750
3760
|
var r = this;
|
|
3751
3761
|
return (r = e.call(this, t) || this).lt = n, r;
|
|
3752
3762
|
}
|
|
3753
3763
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
3754
|
-
var e =
|
|
3764
|
+
var e = Vn(this, t,
|
|
3755
3765
|
/*array=*/ !0), n = this.lt.map((function(t) {
|
|
3756
|
-
return
|
|
3757
|
-
})), r = new
|
|
3758
|
-
return new
|
|
3766
|
+
return jn(t, e);
|
|
3767
|
+
})), r = new ve(n);
|
|
3768
|
+
return new be(t.path, r);
|
|
3759
3769
|
}, n.prototype.isEqual = function(t) {
|
|
3760
3770
|
// TODO(mrschmidt): Implement isEquals
|
|
3761
3771
|
return this === t;
|
|
3762
3772
|
}, n;
|
|
3763
|
-
}(
|
|
3773
|
+
}(vn), Nn = /** @class */ function(e) {
|
|
3764
3774
|
function n(t, n) {
|
|
3765
3775
|
var r = this;
|
|
3766
3776
|
return (r = e.call(this, t) || this).lt = n, r;
|
|
3767
3777
|
}
|
|
3768
3778
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
3769
|
-
var e =
|
|
3779
|
+
var e = Vn(this, t,
|
|
3770
3780
|
/*array=*/ !0), n = this.lt.map((function(t) {
|
|
3771
|
-
return
|
|
3772
|
-
})), r = new
|
|
3773
|
-
return new
|
|
3781
|
+
return jn(t, e);
|
|
3782
|
+
})), r = new ge(n);
|
|
3783
|
+
return new be(t.path, r);
|
|
3774
3784
|
}, n.prototype.isEqual = function(t) {
|
|
3775
3785
|
// TODO(mrschmidt): Implement isEquals
|
|
3776
3786
|
return this === t;
|
|
3777
3787
|
}, n;
|
|
3778
|
-
}(
|
|
3788
|
+
}(vn), qn = /** @class */ function(e) {
|
|
3779
3789
|
function n(t, n) {
|
|
3780
3790
|
var r = this;
|
|
3781
3791
|
return (r = e.call(this, t) || this).ft = n, r;
|
|
3782
3792
|
}
|
|
3783
3793
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
3784
|
-
var e = new
|
|
3785
|
-
return new
|
|
3794
|
+
var e = new we(t.q, de(t.q, this.ft));
|
|
3795
|
+
return new be(t.path, e);
|
|
3786
3796
|
}, n.prototype.isEqual = function(t) {
|
|
3787
3797
|
// TODO(mrschmidt): Implement isEquals
|
|
3788
3798
|
return this === t;
|
|
3789
3799
|
}, n;
|
|
3790
|
-
}(
|
|
3800
|
+
}(vn);
|
|
3791
3801
|
|
|
3792
|
-
/** Parse update data from an update() call. */ function
|
|
3802
|
+
/** Parse update data from an update() call. */ function Fn(t, e, n, r) {
|
|
3793
3803
|
var i = t.ht(1 /* Update */ , e, n);
|
|
3794
|
-
|
|
3795
|
-
var o = [], a =
|
|
3804
|
+
xn("Data must be an object, but it was:", i, r);
|
|
3805
|
+
var o = [], a = Qt.empty();
|
|
3796
3806
|
St(r, (function(t, r) {
|
|
3797
|
-
var s =
|
|
3807
|
+
var s = Bn(e, t, n);
|
|
3798
3808
|
// For Compat types, we have to "extract" the underlying types before
|
|
3799
3809
|
// performing validation.
|
|
3800
3810
|
r = p(r);
|
|
3801
3811
|
var u = i.it(s);
|
|
3802
|
-
if (r instanceof
|
|
3812
|
+
if (r instanceof kn)
|
|
3803
3813
|
// Add it to the field mask, but don't add anything to updateData.
|
|
3804
3814
|
o.push(s); else {
|
|
3805
|
-
var c =
|
|
3815
|
+
var c = jn(r, u);
|
|
3806
3816
|
null != c && (o.push(s), a.set(s, c));
|
|
3807
3817
|
}
|
|
3808
3818
|
}));
|
|
3809
3819
|
var s = new Et(o);
|
|
3810
|
-
return new
|
|
3820
|
+
return new _n(a, s, i.fieldTransforms);
|
|
3811
3821
|
}
|
|
3812
3822
|
|
|
3813
|
-
/** Parse update data from a list of field/value arguments. */ function
|
|
3823
|
+
/** Parse update data from a list of field/value arguments. */ function On(t, e, n, r, i, o) {
|
|
3814
3824
|
var a = t.ht(1 /* Update */ , e, n), s = [ Mn(e, r, n) ], u = [ i ];
|
|
3815
|
-
if (o.length % 2 != 0) throw new
|
|
3825
|
+
if (o.length % 2 != 0) throw new M(V, "Function " + e + "() needs to be called with an even number of arguments that alternate between field names and values.");
|
|
3816
3826
|
for (var c = 0; c < o.length; c += 2) s.push(Mn(e, o[c])), u.push(o[c + 1]);
|
|
3817
3827
|
// We iterate in reverse order to pick the last value for a field if the
|
|
3818
3828
|
// user specified the field multiple times.
|
|
3819
|
-
for (var l = [], f =
|
|
3829
|
+
for (var l = [], f = Qt.empty(), h = s.length - 1; h >= 0; --h) if (!zn(l, s[h])) {
|
|
3820
3830
|
var d = s[h], m = u[h];
|
|
3821
3831
|
// For Compat types, we have to "extract" the underlying types before
|
|
3822
3832
|
// performing validation.
|
|
3823
3833
|
m = p(m);
|
|
3824
3834
|
var y = a.it(d);
|
|
3825
|
-
if (m instanceof
|
|
3835
|
+
if (m instanceof kn)
|
|
3826
3836
|
// Add it to the field mask, but don't add anything to updateData.
|
|
3827
3837
|
l.push(d); else {
|
|
3828
|
-
var v =
|
|
3838
|
+
var v = jn(m, y);
|
|
3829
3839
|
null != v && (l.push(d), f.set(d, v));
|
|
3830
3840
|
}
|
|
3831
3841
|
}
|
|
3832
3842
|
var g = new Et(l);
|
|
3833
|
-
return new
|
|
3843
|
+
return new _n(f, g, a.fieldTransforms);
|
|
3834
3844
|
}
|
|
3835
3845
|
|
|
3836
3846
|
/**
|
|
@@ -3839,8 +3849,8 @@ var Vn = /** @class */ function(e) {
|
|
|
3839
3849
|
*
|
|
3840
3850
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
3841
3851
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
3842
|
-
*/ function
|
|
3843
|
-
return void 0 === r && (r = !1),
|
|
3852
|
+
*/ function Cn(t, e, n, r) {
|
|
3853
|
+
return void 0 === r && (r = !1), jn(n, t.ht(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
|
|
3844
3854
|
}
|
|
3845
3855
|
|
|
3846
3856
|
/**
|
|
@@ -3851,12 +3861,12 @@ var Vn = /** @class */ function(e) {
|
|
|
3851
3861
|
* the source of the data being parsed, etc.
|
|
3852
3862
|
* @returns The parsed value, or null if the value was a FieldValue sentinel
|
|
3853
3863
|
* that should not be included in the resulting parsed data.
|
|
3854
|
-
*/ function
|
|
3855
|
-
if (
|
|
3864
|
+
*/ function jn(t, e) {
|
|
3865
|
+
if (Rn(
|
|
3856
3866
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
3857
3867
|
// from firestore-exp.
|
|
3858
|
-
t = p(t))) return
|
|
3859
|
-
if (t instanceof
|
|
3868
|
+
t = p(t))) return xn("Unsupported field value:", e, t), Ln(t, e);
|
|
3869
|
+
if (t instanceof vn)
|
|
3860
3870
|
// FieldValues usually parse into transforms (except deleteField())
|
|
3861
3871
|
// in which case we do not want to include this field in our parsed data
|
|
3862
3872
|
// (as doing so will overwrite the field directly prior to the transform
|
|
@@ -3868,7 +3878,7 @@ var Vn = /** @class */ function(e) {
|
|
|
3868
3878
|
*/
|
|
3869
3879
|
return function(t, e) {
|
|
3870
3880
|
// Sentinels are only supported with writes, and not within arrays.
|
|
3871
|
-
if (!
|
|
3881
|
+
if (!Tn(e.tt)) throw e.ut(t._methodName + "() can only be used with update() and set()");
|
|
3872
3882
|
if (!e.path) throw e.ut(t._methodName + "() is not currently supported inside arrays");
|
|
3873
3883
|
var n = t._toFieldTransform(e);
|
|
3874
3884
|
n && e.fieldTransforms.push(n);
|
|
@@ -3891,7 +3901,7 @@ var Vn = /** @class */ function(e) {
|
|
|
3891
3901
|
if (e.settings.rt && 4 /* ArrayArgument */ !== e.tt) throw e.ut("Nested arrays are not supported");
|
|
3892
3902
|
return function(t, e) {
|
|
3893
3903
|
for (var n = [], r = 0, i = 0, o = t; i < o.length; i++) {
|
|
3894
|
-
var a =
|
|
3904
|
+
var a = jn(o[i], e.ot(r));
|
|
3895
3905
|
null == a && (
|
|
3896
3906
|
// Just include nulls in the array for fields being replaced with a
|
|
3897
3907
|
// sentinel.
|
|
@@ -3910,7 +3920,7 @@ var Vn = /** @class */ function(e) {
|
|
|
3910
3920
|
if (null === (t = p(t))) return {
|
|
3911
3921
|
nullValue: "NULL_VALUE"
|
|
3912
3922
|
};
|
|
3913
|
-
if ("number" == typeof t) return
|
|
3923
|
+
if ("number" == typeof t) return de(e.q, t);
|
|
3914
3924
|
if ("boolean" == typeof t) return {
|
|
3915
3925
|
booleanValue: t
|
|
3916
3926
|
};
|
|
@@ -3920,7 +3930,7 @@ var Vn = /** @class */ function(e) {
|
|
|
3920
3930
|
if (t instanceof Date) {
|
|
3921
3931
|
var n = bt.fromDate(t);
|
|
3922
3932
|
return {
|
|
3923
|
-
timestampValue:
|
|
3933
|
+
timestampValue: Pe(e.q, n)
|
|
3924
3934
|
};
|
|
3925
3935
|
}
|
|
3926
3936
|
if (t instanceof bt) {
|
|
@@ -3929,23 +3939,23 @@ var Vn = /** @class */ function(e) {
|
|
|
3929
3939
|
// truncation immediately without waiting for the backend to do that.
|
|
3930
3940
|
var r = new bt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
3931
3941
|
return {
|
|
3932
|
-
timestampValue:
|
|
3942
|
+
timestampValue: Pe(e.q, r)
|
|
3933
3943
|
};
|
|
3934
3944
|
}
|
|
3935
|
-
if (t instanceof
|
|
3945
|
+
if (t instanceof gn) return {
|
|
3936
3946
|
geoPointValue: {
|
|
3937
3947
|
latitude: t.latitude,
|
|
3938
3948
|
longitude: t.longitude
|
|
3939
3949
|
}
|
|
3940
3950
|
};
|
|
3941
|
-
if (t instanceof
|
|
3942
|
-
bytesValue:
|
|
3951
|
+
if (t instanceof yn) return {
|
|
3952
|
+
bytesValue: Ne(e.q, t._byteString)
|
|
3943
3953
|
};
|
|
3944
|
-
if (t instanceof
|
|
3954
|
+
if (t instanceof an) {
|
|
3945
3955
|
var i = e.databaseId, o = t.firestore._databaseId;
|
|
3946
3956
|
if (!o.isEqual(i)) throw e.ut("Document reference is for database " + o.projectId + "/" + o.database + " but should be for database " + i.projectId + "/" + i.database);
|
|
3947
3957
|
return {
|
|
3948
|
-
referenceValue:
|
|
3958
|
+
referenceValue: Oe(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
3949
3959
|
};
|
|
3950
3960
|
}
|
|
3951
3961
|
throw e.ut("Unsupported field value: " + at(t));
|
|
@@ -3961,7 +3971,7 @@ function Ln(t, e) {
|
|
|
3961
3971
|
// If we encounter an empty object, we explicitly add it to the update
|
|
3962
3972
|
// mask to ensure that the server creates a map entry.
|
|
3963
3973
|
e.path && e.path.length > 0 && e.fieldMask.push(e.path) : St(t, (function(t, r) {
|
|
3964
|
-
var i =
|
|
3974
|
+
var i = jn(r, e.nt(t));
|
|
3965
3975
|
null != i && (n[t] = i);
|
|
3966
3976
|
})), {
|
|
3967
3977
|
mapValue: {
|
|
@@ -3970,12 +3980,12 @@ function Ln(t, e) {
|
|
|
3970
3980
|
};
|
|
3971
3981
|
}
|
|
3972
3982
|
|
|
3973
|
-
function
|
|
3974
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof bt || t instanceof
|
|
3983
|
+
function Rn(t) {
|
|
3984
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof bt || t instanceof gn || t instanceof yn || t instanceof an || t instanceof vn);
|
|
3975
3985
|
}
|
|
3976
3986
|
|
|
3977
|
-
function
|
|
3978
|
-
if (!
|
|
3987
|
+
function xn(t, e, n) {
|
|
3988
|
+
if (!Rn(n) || !function(t) {
|
|
3979
3989
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
3980
3990
|
}(n)) {
|
|
3981
3991
|
var r = at(n);
|
|
@@ -3989,16 +3999,16 @@ function Rn(t, e, n) {
|
|
|
3989
3999
|
if (
|
|
3990
4000
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
3991
4001
|
// FieldPath.
|
|
3992
|
-
(e = p(e)) instanceof
|
|
3993
|
-
if ("string" == typeof e) return
|
|
3994
|
-
throw
|
|
4002
|
+
(e = p(e)) instanceof dn) return e._internalPath;
|
|
4003
|
+
if ("string" == typeof e) return Bn(t, e);
|
|
4004
|
+
throw Gn("Field path arguments must be of type string or ", t,
|
|
3995
4005
|
/* hasConverter= */ !1,
|
|
3996
4006
|
/* path= */ void 0, n);
|
|
3997
4007
|
}
|
|
3998
4008
|
|
|
3999
4009
|
/**
|
|
4000
4010
|
* Matches any characters in a field path string that are reserved.
|
|
4001
|
-
*/ var
|
|
4011
|
+
*/ var Un = new RegExp("[~\\*/\\[\\]]");
|
|
4002
4012
|
|
|
4003
4013
|
/**
|
|
4004
4014
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -4008,29 +4018,29 @@ function Rn(t, e, n) {
|
|
|
4008
4018
|
* split on dots.
|
|
4009
4019
|
* @param targetDoc - The document against which the field path will be
|
|
4010
4020
|
* evaluated.
|
|
4011
|
-
*/ function
|
|
4012
|
-
if (e.search(
|
|
4021
|
+
*/ function Bn(t, e, n) {
|
|
4022
|
+
if (e.search(Un) >= 0) throw Gn("Invalid field path (" + e + "). Paths must not contain '~', '*', '/', '[', or ']'", t,
|
|
4013
4023
|
/* hasConverter= */ !1,
|
|
4014
4024
|
/* path= */ void 0, n);
|
|
4015
4025
|
try {
|
|
4016
|
-
return (new (
|
|
4026
|
+
return (new (dn.bind.apply(dn, r([ void 0 ], e.split(".")))))._internalPath;
|
|
4017
4027
|
} catch (r) {
|
|
4018
|
-
throw
|
|
4028
|
+
throw Gn("Invalid field path (" + e + "). Paths must not be empty, begin with '.', end with '.', or contain '..'", t,
|
|
4019
4029
|
/* hasConverter= */ !1,
|
|
4020
4030
|
/* path= */ void 0, n);
|
|
4021
4031
|
}
|
|
4022
4032
|
}
|
|
4023
4033
|
|
|
4024
|
-
function
|
|
4034
|
+
function Gn(t, e, n, r, i) {
|
|
4025
4035
|
var o = r && !r.isEmpty(), a = void 0 !== i, s = "Function " + e + "() called with invalid data";
|
|
4026
4036
|
n && (s += " (via `toFirestore()`)");
|
|
4027
4037
|
var u = "";
|
|
4028
4038
|
return (o || a) && (u += " (found", o && (u += " in field " + r), a && (u += " in document " + i),
|
|
4029
|
-
u += ")"), new
|
|
4039
|
+
u += ")"), new M(V, (s += ". ") + t + u)
|
|
4030
4040
|
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */;
|
|
4031
4041
|
}
|
|
4032
4042
|
|
|
4033
|
-
function
|
|
4043
|
+
function zn(t, e) {
|
|
4034
4044
|
return t.some((function(t) {
|
|
4035
4045
|
return t.isEqual(e);
|
|
4036
4046
|
}));
|
|
@@ -4060,7 +4070,7 @@ function Gn(t, e) {
|
|
|
4060
4070
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
4061
4071
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
4062
4072
|
* explicitly verify a document's existence.
|
|
4063
|
-
*/ var
|
|
4073
|
+
*/ var Qn = /** @class */ function() {
|
|
4064
4074
|
// Note: This class is stripped down version of the DocumentSnapshot in
|
|
4065
4075
|
// the legacy SDK. The changes are:
|
|
4066
4076
|
// - No support for SnapshotMetadata.
|
|
@@ -4081,7 +4091,7 @@ function Gn(t, e) {
|
|
|
4081
4091
|
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
4082
4092
|
*/
|
|
4083
4093
|
get: function() {
|
|
4084
|
-
return new
|
|
4094
|
+
return new an(this._firestore, this._converter, this._key);
|
|
4085
4095
|
},
|
|
4086
4096
|
enumerable: !1,
|
|
4087
4097
|
configurable: !0
|
|
@@ -4106,7 +4116,7 @@ function Gn(t, e) {
|
|
|
4106
4116
|
if (this._converter) {
|
|
4107
4117
|
// We only want to use the converter and create a new DocumentSnapshot
|
|
4108
4118
|
// if a converter has been provided.
|
|
4109
|
-
var t = new
|
|
4119
|
+
var t = new Kn(this._firestore, this._userDataWriter, this._key, this._document,
|
|
4110
4120
|
/* converter= */ null);
|
|
4111
4121
|
return this._converter.fromFirestore(t);
|
|
4112
4122
|
}
|
|
@@ -4126,11 +4136,11 @@ function Gn(t, e) {
|
|
|
4126
4136
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4127
4137
|
t.prototype.get = function(t) {
|
|
4128
4138
|
if (this._document) {
|
|
4129
|
-
var e = this._document.data.field(
|
|
4139
|
+
var e = this._document.data.field(Yn("DocumentSnapshot.get", t));
|
|
4130
4140
|
if (null !== e) return this._userDataWriter.convertValue(e);
|
|
4131
4141
|
}
|
|
4132
4142
|
}, t;
|
|
4133
|
-
}(),
|
|
4143
|
+
}(), Kn = /** @class */ function(e) {
|
|
4134
4144
|
function n() {
|
|
4135
4145
|
return null !== e && e.apply(this, arguments) || this;
|
|
4136
4146
|
}
|
|
@@ -4142,7 +4152,7 @@ function Gn(t, e) {
|
|
|
4142
4152
|
*/ return t(n, e), n.prototype.data = function() {
|
|
4143
4153
|
return e.prototype.data.call(this);
|
|
4144
4154
|
}, n;
|
|
4145
|
-
}(
|
|
4155
|
+
}(Qn), Hn = /** @class */ function() {
|
|
4146
4156
|
/** @hideconstructor */
|
|
4147
4157
|
function t(t, e) {
|
|
4148
4158
|
this._docs = e, this.query = t;
|
|
@@ -4196,15 +4206,15 @@ function Gn(t, e) {
|
|
|
4196
4206
|
* @param right - A snapshot to compare.
|
|
4197
4207
|
* @returns true if the snapshots are equal.
|
|
4198
4208
|
*/
|
|
4199
|
-
function
|
|
4200
|
-
return t = p(t), e = p(e), t instanceof
|
|
4209
|
+
function Wn(t, e) {
|
|
4210
|
+
return t = p(t), e = p(e), t instanceof Qn && e instanceof Qn ? t._firestore === e._firestore && t._key.isEqual(e._key) && (null === t._document ? null === e._document : t._document.isEqual(e._document)) && t._converter === e._converter : t instanceof Hn && e instanceof Hn && pn(t.query, e.query) && wt(t.docs, e.docs, Wn)
|
|
4201
4211
|
/**
|
|
4202
4212
|
* Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
|
|
4203
4213
|
*/;
|
|
4204
4214
|
}
|
|
4205
4215
|
|
|
4206
|
-
function
|
|
4207
|
-
return "string" == typeof e ?
|
|
4216
|
+
function Yn(t, e) {
|
|
4217
|
+
return "string" == typeof e ? Bn(t, e) : e instanceof dn ? e._internalPath : e._delegate._internalPath;
|
|
4208
4218
|
}
|
|
4209
4219
|
|
|
4210
4220
|
/**
|
|
@@ -4230,7 +4240,7 @@ function Wn(t, e) {
|
|
|
4230
4240
|
* endBefore:1}, {@link (endAt:1)}, {@link limit} or {@link limitToLast} and
|
|
4231
4241
|
* can then be passed to {@link query} to create a new query instance that
|
|
4232
4242
|
* also contains this `QueryConstraint`.
|
|
4233
|
-
*/ var
|
|
4243
|
+
*/ var $n = function() {};
|
|
4234
4244
|
|
|
4235
4245
|
/**
|
|
4236
4246
|
* Creates a new immutable instance of {@link Query} that is extended to also include
|
|
@@ -4240,7 +4250,7 @@ function Wn(t, e) {
|
|
|
4240
4250
|
* @param queryConstraints - The list of {@link QueryConstraint}s to apply.
|
|
4241
4251
|
* @throws if any of the provided query constraints cannot be combined with the
|
|
4242
4252
|
* existing or new constraints.
|
|
4243
|
-
*/ function
|
|
4253
|
+
*/ function Xn(t) {
|
|
4244
4254
|
for (var e = [], n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];
|
|
4245
4255
|
for (var r = 0, i = e; r < i.length; r++) {
|
|
4246
4256
|
var o = i[r];
|
|
@@ -4249,39 +4259,39 @@ function Wn(t, e) {
|
|
|
4249
4259
|
return t;
|
|
4250
4260
|
}
|
|
4251
4261
|
|
|
4252
|
-
var
|
|
4262
|
+
var Jn = /** @class */ function(e) {
|
|
4253
4263
|
function n(t, n, r) {
|
|
4254
4264
|
var i = this;
|
|
4255
4265
|
return (i = e.call(this) || this).dt = t, i.wt = n, i.yt = r, i.type = "where",
|
|
4256
4266
|
i;
|
|
4257
4267
|
}
|
|
4258
4268
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4259
|
-
var e =
|
|
4269
|
+
var e = An(t.firestore), n = function(t, e, n, r, i, o, a) {
|
|
4260
4270
|
var s;
|
|
4261
4271
|
if (i.isKeyField()) {
|
|
4262
|
-
if ("array-contains" /* ARRAY_CONTAINS */ === o || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === o) throw new
|
|
4272
|
+
if ("array-contains" /* ARRAY_CONTAINS */ === o || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === o) throw new M(V, "Invalid Query. You can't perform '" + o + "' queries on documentId().");
|
|
4263
4273
|
if ("in" /* IN */ === o || "not-in" /* NOT_IN */ === o) {
|
|
4264
|
-
|
|
4274
|
+
pr(a, o);
|
|
4265
4275
|
for (var u = [], c = 0, l = a; c < l.length; c++) {
|
|
4266
4276
|
var f = l[c];
|
|
4267
|
-
u.push(
|
|
4277
|
+
u.push(hr(r, t, f));
|
|
4268
4278
|
}
|
|
4269
4279
|
s = {
|
|
4270
4280
|
arrayValue: {
|
|
4271
4281
|
values: u
|
|
4272
4282
|
}
|
|
4273
4283
|
};
|
|
4274
|
-
} else s =
|
|
4275
|
-
} else "in" /* IN */ !== o && "not-in" /* NOT_IN */ !== o && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== o ||
|
|
4276
|
-
s =
|
|
4284
|
+
} else s = hr(r, t, a);
|
|
4285
|
+
} else "in" /* IN */ !== o && "not-in" /* NOT_IN */ !== o && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== o || pr(a, o),
|
|
4286
|
+
s = Cn(n, "where", a,
|
|
4277
4287
|
/* allowArrays= */ "in" /* IN */ === o || "not-in" /* NOT_IN */ === o);
|
|
4278
|
-
var h =
|
|
4288
|
+
var h = Yt.create(i, o, s);
|
|
4279
4289
|
return function(t, e) {
|
|
4280
4290
|
if (e.N()) {
|
|
4281
|
-
var n =
|
|
4282
|
-
if (null !== n && !n.isEqual(e.field)) throw new
|
|
4283
|
-
var r =
|
|
4284
|
-
null !== r &&
|
|
4291
|
+
var n = le(t);
|
|
4292
|
+
if (null !== n && !n.isEqual(e.field)) throw new M(V, "Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '" + n.toString() + "' and '" + e.field.toString() + "'");
|
|
4293
|
+
var r = ce(t);
|
|
4294
|
+
null !== r && dr(t, e.field, r);
|
|
4285
4295
|
}
|
|
4286
4296
|
var i = function(t, e) {
|
|
4287
4297
|
for (var n = 0, r = t.filters; n < r.length; n++) {
|
|
@@ -4325,15 +4335,15 @@ var Xn = /** @class */ function(e) {
|
|
|
4325
4335
|
}(e.op));
|
|
4326
4336
|
if (null !== i)
|
|
4327
4337
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
4328
|
-
throw i === e.op ? new
|
|
4338
|
+
throw i === e.op ? new M(V, "Invalid query. You cannot use more than one '" + e.op.toString() + "' filter.") : new M(V, "Invalid query. You cannot use '" + e.op.toString() + "' filters with '" + i.toString() + "' filters.");
|
|
4329
4339
|
}(t, h), h;
|
|
4330
4340
|
}(t._query, 0, e, t.firestore._databaseId, this.dt, this.wt, this.yt);
|
|
4331
|
-
return new
|
|
4341
|
+
return new sn(t.firestore, t.converter, function(t, e) {
|
|
4332
4342
|
var n = t.filters.concat([ e ]);
|
|
4333
|
-
return new
|
|
4343
|
+
return new ue(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
4334
4344
|
}(t._query, n));
|
|
4335
4345
|
}, n;
|
|
4336
|
-
}(
|
|
4346
|
+
}($n);
|
|
4337
4347
|
|
|
4338
4348
|
/**
|
|
4339
4349
|
* Creates a {@link QueryConstraint} that enforces that documents must contain the
|
|
@@ -4345,36 +4355,36 @@ var Xn = /** @class */ function(e) {
|
|
|
4345
4355
|
* "<=", "!=").
|
|
4346
4356
|
* @param value - The value for comparison
|
|
4347
4357
|
* @returns The created {@link Query}.
|
|
4348
|
-
*/ function
|
|
4349
|
-
var r = e, i =
|
|
4350
|
-
return new
|
|
4358
|
+
*/ function Zn(t, e, n) {
|
|
4359
|
+
var r = e, i = Yn("where", t);
|
|
4360
|
+
return new Jn(i, r, n);
|
|
4351
4361
|
}
|
|
4352
4362
|
|
|
4353
|
-
var
|
|
4363
|
+
var tr = /** @class */ function(e) {
|
|
4354
4364
|
function n(t, n) {
|
|
4355
4365
|
var r = this;
|
|
4356
4366
|
return (r = e.call(this) || this).dt = t, r._t = n, r.type = "orderBy", r;
|
|
4357
4367
|
}
|
|
4358
4368
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4359
4369
|
var e = function(t, e, n) {
|
|
4360
|
-
if (null !== t.startAt) throw new
|
|
4361
|
-
if (null !== t.endAt) throw new
|
|
4362
|
-
var r = new
|
|
4370
|
+
if (null !== t.startAt) throw new M(V, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
|
|
4371
|
+
if (null !== t.endAt) throw new M(V, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
4372
|
+
var r = new oe(e, n);
|
|
4363
4373
|
return function(t, e) {
|
|
4364
|
-
if (null ===
|
|
4374
|
+
if (null === ce(t)) {
|
|
4365
4375
|
// This is the first order by. It must match any inequality.
|
|
4366
|
-
var n =
|
|
4367
|
-
null !== n &&
|
|
4376
|
+
var n = le(t);
|
|
4377
|
+
null !== n && dr(t, n, e.field);
|
|
4368
4378
|
}
|
|
4369
4379
|
}(t, r), r;
|
|
4370
4380
|
}(t._query, this.dt, this._t);
|
|
4371
|
-
return new
|
|
4381
|
+
return new sn(t.firestore, t.converter, function(t, e) {
|
|
4372
4382
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
4373
4383
|
var n = t.explicitOrderBy.concat([ e ]);
|
|
4374
|
-
return new
|
|
4384
|
+
return new ue(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
4375
4385
|
}(t._query, e));
|
|
4376
4386
|
}, n;
|
|
4377
|
-
}(
|
|
4387
|
+
}($n);
|
|
4378
4388
|
|
|
4379
4389
|
/**
|
|
4380
4390
|
* Creates a {@link QueryConstraint} that sorts the query result by the
|
|
@@ -4384,31 +4394,31 @@ var Zn = /** @class */ function(e) {
|
|
|
4384
4394
|
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
|
|
4385
4395
|
* not specified, order will be ascending.
|
|
4386
4396
|
* @returns The created {@link Query}.
|
|
4387
|
-
*/ function
|
|
4397
|
+
*/ function er(t, e) {
|
|
4388
4398
|
void 0 === e && (e = "asc");
|
|
4389
|
-
var n = e, r =
|
|
4390
|
-
return new
|
|
4399
|
+
var n = e, r = Yn("orderBy", t);
|
|
4400
|
+
return new tr(r, n);
|
|
4391
4401
|
}
|
|
4392
4402
|
|
|
4393
|
-
var
|
|
4403
|
+
var nr = /** @class */ function(e) {
|
|
4394
4404
|
function n(t, n, r) {
|
|
4395
4405
|
var i = this;
|
|
4396
|
-
return (i = e.call(this) || this).type = t, i.gt = n, i.
|
|
4406
|
+
return (i = e.call(this) || this).type = t, i.gt = n, i.bt = r, i;
|
|
4397
4407
|
}
|
|
4398
4408
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4399
|
-
return new
|
|
4400
|
-
return new
|
|
4401
|
-
}(t._query, this.gt, this.
|
|
4409
|
+
return new sn(t.firestore, t.converter, function(t, e, n) {
|
|
4410
|
+
return new ue(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
4411
|
+
}(t._query, this.gt, this.bt));
|
|
4402
4412
|
}, n;
|
|
4403
|
-
}(
|
|
4413
|
+
}($n);
|
|
4404
4414
|
|
|
4405
4415
|
/**
|
|
4406
4416
|
* Creates a {@link QueryConstraint} that only returns the first matching documents.
|
|
4407
4417
|
*
|
|
4408
4418
|
* @param limit - The maximum number of items to return.
|
|
4409
4419
|
* @returns The created {@link Query}.
|
|
4410
|
-
*/ function
|
|
4411
|
-
return ut("limit", t), new
|
|
4420
|
+
*/ function rr(t) {
|
|
4421
|
+
return ut("limit", t), new nr("limit", t, "F" /* First */)
|
|
4412
4422
|
/**
|
|
4413
4423
|
* Creates a {@link QueryConstraint} that only returns the last matching documents.
|
|
4414
4424
|
*
|
|
@@ -4420,62 +4430,62 @@ var er = /** @class */ function(e) {
|
|
|
4420
4430
|
*/;
|
|
4421
4431
|
}
|
|
4422
4432
|
|
|
4423
|
-
function
|
|
4424
|
-
return ut("limitToLast", t), new
|
|
4433
|
+
function ir(t) {
|
|
4434
|
+
return ut("limitToLast", t), new nr("limitToLast", t, "L" /* Last */);
|
|
4425
4435
|
}
|
|
4426
4436
|
|
|
4427
|
-
var
|
|
4437
|
+
var or = /** @class */ function(e) {
|
|
4428
4438
|
function n(t, n, r) {
|
|
4429
4439
|
var i = this;
|
|
4430
|
-
return (i = e.call(this) || this).type = t, i.
|
|
4440
|
+
return (i = e.call(this) || this).type = t, i.vt = n, i.Et = r, i;
|
|
4431
4441
|
}
|
|
4432
4442
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4433
|
-
var e =
|
|
4434
|
-
return new
|
|
4435
|
-
return new
|
|
4443
|
+
var e = fr(t, this.type, this.vt, this.Et);
|
|
4444
|
+
return new sn(t.firestore, t.converter, function(t, e) {
|
|
4445
|
+
return new ue(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
4436
4446
|
}(t._query, e));
|
|
4437
4447
|
}, n;
|
|
4438
|
-
}(
|
|
4448
|
+
}($n);
|
|
4439
4449
|
|
|
4440
|
-
function
|
|
4450
|
+
function ar() {
|
|
4441
4451
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
4442
|
-
return new
|
|
4452
|
+
return new or("startAt", t,
|
|
4443
4453
|
/*inclusive=*/ !0);
|
|
4444
4454
|
}
|
|
4445
4455
|
|
|
4446
|
-
function
|
|
4456
|
+
function sr() {
|
|
4447
4457
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
4448
|
-
return new
|
|
4458
|
+
return new or("startAfter", t,
|
|
4449
4459
|
/*inclusive=*/ !1);
|
|
4450
4460
|
}
|
|
4451
4461
|
|
|
4452
|
-
var
|
|
4462
|
+
var ur = /** @class */ function(e) {
|
|
4453
4463
|
function n(t, n, r) {
|
|
4454
4464
|
var i = this;
|
|
4455
|
-
return (i = e.call(this) || this).type = t, i.
|
|
4465
|
+
return (i = e.call(this) || this).type = t, i.vt = n, i.Et = r, i;
|
|
4456
4466
|
}
|
|
4457
4467
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4458
|
-
var e =
|
|
4459
|
-
return new
|
|
4460
|
-
return new
|
|
4468
|
+
var e = fr(t, this.type, this.vt, this.Et);
|
|
4469
|
+
return new sn(t.firestore, t.converter, function(t, e) {
|
|
4470
|
+
return new ue(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
4461
4471
|
}(t._query, e));
|
|
4462
4472
|
}, n;
|
|
4463
|
-
}(
|
|
4473
|
+
}($n);
|
|
4464
4474
|
|
|
4465
|
-
function
|
|
4475
|
+
function cr() {
|
|
4466
4476
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
4467
|
-
return new
|
|
4477
|
+
return new ur("endBefore", t,
|
|
4468
4478
|
/*inclusive=*/ !1);
|
|
4469
4479
|
}
|
|
4470
4480
|
|
|
4471
|
-
function
|
|
4481
|
+
function lr() {
|
|
4472
4482
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
4473
|
-
return new
|
|
4483
|
+
return new ur("endAt", t, /*inclusive=*/ !0);
|
|
4474
4484
|
}
|
|
4475
4485
|
|
|
4476
|
-
/** Helper function to create a bound from a document or fields */ function
|
|
4477
|
-
if (n[0] = p(n[0]), n[0] instanceof
|
|
4478
|
-
if (!r) throw new
|
|
4486
|
+
/** Helper function to create a bound from a document or fields */ function fr(t, e, n, r) {
|
|
4487
|
+
if (n[0] = p(n[0]), n[0] instanceof Qn) return function(t, e, n, r, i) {
|
|
4488
|
+
if (!r) throw new M(P, "Can't use a DocumentSnapshot that doesn't exist for " + n + "().");
|
|
4479
4489
|
// Because people expect to continue/end a query at the exact document
|
|
4480
4490
|
// provided, we need to use the implicit sort order rather than the explicit
|
|
4481
4491
|
// sort order, because it's guaranteed to contain the document key. That way
|
|
@@ -4483,65 +4493,65 @@ function cr() {
|
|
|
4483
4493
|
// the provided document. Without the key (by using the explicit sort
|
|
4484
4494
|
// orders), multiple documents could match the position, yielding duplicate
|
|
4485
4495
|
// results.
|
|
4486
|
-
for (var o = [], a = 0, s =
|
|
4496
|
+
for (var o = [], a = 0, s = he(t); a < s.length; a++) {
|
|
4487
4497
|
var u = s[a];
|
|
4488
|
-
if (u.field.isKeyField()) o.push(
|
|
4498
|
+
if (u.field.isKeyField()) o.push(xt(e, r.key)); else {
|
|
4489
4499
|
var c = r.data.field(u.field);
|
|
4490
|
-
if (Pt(c)) throw new
|
|
4500
|
+
if (Pt(c)) throw new M(V, 'Invalid query. You are trying to start or end a query using a document for which the field "' + u.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
|
|
4491
4501
|
if (null === c) {
|
|
4492
4502
|
var l = u.field.canonicalString();
|
|
4493
|
-
throw new
|
|
4503
|
+
throw new M(V, "Invalid query. You are trying to start or end a query using a document for which the field '" + l + "' (used as the orderBy) does not exist.");
|
|
4494
4504
|
}
|
|
4495
4505
|
o.push(c);
|
|
4496
4506
|
}
|
|
4497
4507
|
}
|
|
4498
|
-
return new
|
|
4508
|
+
return new ie(o, i);
|
|
4499
4509
|
}(t._query, t.firestore._databaseId, e, n[0]._document, r);
|
|
4500
|
-
var i =
|
|
4510
|
+
var i = An(t.firestore);
|
|
4501
4511
|
return function(t, e, n, r, i, o) {
|
|
4502
4512
|
// Use explicit order by's because it has to match the query the user made
|
|
4503
4513
|
var a = t.explicitOrderBy;
|
|
4504
|
-
if (i.length > a.length) throw new
|
|
4514
|
+
if (i.length > a.length) throw new M(V, "Too many arguments provided to " + r + "(). The number of arguments must be less than or equal to the number of orderBy() clauses");
|
|
4505
4515
|
for (var s = [], u = 0; u < i.length; u++) {
|
|
4506
4516
|
var c = i[u];
|
|
4507
4517
|
if (a[u].field.isKeyField()) {
|
|
4508
|
-
if ("string" != typeof c) throw new
|
|
4509
|
-
if (!
|
|
4518
|
+
if ("string" != typeof c) throw new M(V, "Invalid query. Expected a string for document ID in " + r + "(), but got a " + typeof c);
|
|
4519
|
+
if (!fe(t) && -1 !== c.indexOf("/")) throw new M(V, "Invalid query. When querying a collection and ordering by documentId(), the value passed to " + r + "() must be a plain document ID, but '" + c + "' contains a slash.");
|
|
4510
4520
|
var l = t.path.child(Z.fromString(c));
|
|
4511
|
-
if (!nt.isDocumentKey(l)) throw new
|
|
4521
|
+
if (!nt.isDocumentKey(l)) throw new M(V, "Invalid query. When querying a collection group and ordering by documentId(), the value passed to " + r + "() must result in a valid document path, but '" + l + "' is not because it contains an odd number of segments.");
|
|
4512
4522
|
var f = new nt(l);
|
|
4513
|
-
s.push(
|
|
4523
|
+
s.push(xt(e, f));
|
|
4514
4524
|
} else {
|
|
4515
|
-
var h =
|
|
4525
|
+
var h = Cn(n, r, c);
|
|
4516
4526
|
s.push(h);
|
|
4517
4527
|
}
|
|
4518
4528
|
}
|
|
4519
|
-
return new
|
|
4529
|
+
return new ie(s, o);
|
|
4520
4530
|
}(t._query, t.firestore._databaseId, i, e, n, r);
|
|
4521
4531
|
}
|
|
4522
4532
|
|
|
4523
|
-
function
|
|
4533
|
+
function hr(t, e, n) {
|
|
4524
4534
|
if ("string" == typeof (n = p(n))) {
|
|
4525
|
-
if ("" === n) throw new
|
|
4526
|
-
if (!
|
|
4535
|
+
if ("" === n) throw new M(V, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
4536
|
+
if (!fe(e) && -1 !== n.indexOf("/")) throw new M(V, "Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '" + n + "' contains a '/' character.");
|
|
4527
4537
|
var r = e.path.child(Z.fromString(n));
|
|
4528
|
-
if (!nt.isDocumentKey(r)) throw new
|
|
4529
|
-
return
|
|
4538
|
+
if (!nt.isDocumentKey(r)) throw new M(V, "Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '" + r + "' is not because it has an odd number of segments (" + r.length + ").");
|
|
4539
|
+
return xt(t, new nt(r));
|
|
4530
4540
|
}
|
|
4531
|
-
if (n instanceof
|
|
4532
|
-
throw new
|
|
4541
|
+
if (n instanceof an) return xt(t, n._key);
|
|
4542
|
+
throw new M(V, "Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: " + at(n) + ".");
|
|
4533
4543
|
}
|
|
4534
4544
|
|
|
4535
4545
|
/**
|
|
4536
4546
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
4537
4547
|
* array requirements.
|
|
4538
|
-
*/ function
|
|
4539
|
-
if (!Array.isArray(t) || 0 === t.length) throw new
|
|
4540
|
-
if (t.length > 10) throw new
|
|
4548
|
+
*/ function pr(t, e) {
|
|
4549
|
+
if (!Array.isArray(t) || 0 === t.length) throw new M(V, "Invalid Query. A non-empty array is required for '" + e.toString() + "' filters.");
|
|
4550
|
+
if (t.length > 10) throw new M(V, "Invalid Query. '" + e.toString() + "' filters support a maximum of 10 elements in the value array.");
|
|
4541
4551
|
}
|
|
4542
4552
|
|
|
4543
|
-
function
|
|
4544
|
-
if (!n.isEqual(e)) throw new
|
|
4553
|
+
function dr(t, e, n) {
|
|
4554
|
+
if (!n.isEqual(e)) throw new M(V, "Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '" + e.toString() + "' and so you must also use '" + e.toString() + "' as your first argument to orderBy(), but your first orderBy() is on field '" + n.toString() + "' instead.");
|
|
4545
4555
|
}
|
|
4546
4556
|
|
|
4547
4557
|
/**
|
|
@@ -4590,28 +4600,28 @@ function pr(t, e, n) {
|
|
|
4590
4600
|
* because we want to provide the user with a more specific error message if
|
|
4591
4601
|
* their `set()` or fails due to invalid data originating from a `toFirestore()`
|
|
4592
4602
|
* call.
|
|
4593
|
-
*/ function
|
|
4603
|
+
*/ function mr(t, e, n) {
|
|
4594
4604
|
// Cast to `any` in order to satisfy the union type constraint on
|
|
4595
4605
|
// toFirestore().
|
|
4596
4606
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4597
4607
|
return t ? n && (n.merge || n.mergeFields) ? t.toFirestore(e, n) : t.toFirestore(e) : e;
|
|
4598
4608
|
}
|
|
4599
4609
|
|
|
4600
|
-
var
|
|
4610
|
+
var yr = /** @class */ function(e) {
|
|
4601
4611
|
function n(t) {
|
|
4602
4612
|
var n = this;
|
|
4603
4613
|
return (n = e.call(this) || this).firestore = t, n;
|
|
4604
4614
|
}
|
|
4605
4615
|
return t(n, e), n.prototype.convertBytes = function(t) {
|
|
4606
|
-
return new
|
|
4616
|
+
return new yn(t);
|
|
4607
4617
|
}, n.prototype.convertReference = function(t) {
|
|
4608
4618
|
var e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
4609
|
-
return new
|
|
4619
|
+
return new an(this.firestore, /* converter= */ null, e);
|
|
4610
4620
|
}, n;
|
|
4611
4621
|
}(/** @class */ function() {
|
|
4612
4622
|
function t() {}
|
|
4613
4623
|
return t.prototype.convertValue = function(t, e) {
|
|
4614
|
-
switch (void 0 === e && (e = "none"),
|
|
4624
|
+
switch (void 0 === e && (e = "none"), Ot(t)) {
|
|
4615
4625
|
case 0 /* NullValue */ :
|
|
4616
4626
|
return null;
|
|
4617
4627
|
|
|
@@ -4654,7 +4664,7 @@ var mr = /** @class */ function(e) {
|
|
|
4654
4664
|
r[t] = n.convertValue(i, e);
|
|
4655
4665
|
})), r;
|
|
4656
4666
|
}, t.prototype.convertGeoPoint = function(t) {
|
|
4657
|
-
return new
|
|
4667
|
+
return new gn(Vt(t.latitude), Vt(t.longitude));
|
|
4658
4668
|
}, t.prototype.convertArray = function(t, e) {
|
|
4659
4669
|
var n = this;
|
|
4660
4670
|
return (t.values || []).map((function(t) {
|
|
@@ -4677,7 +4687,7 @@ var mr = /** @class */ function(e) {
|
|
|
4677
4687
|
return new bt(e.seconds, e.nanos);
|
|
4678
4688
|
}, t.prototype.convertDocumentKey = function(t, e) {
|
|
4679
4689
|
var n = Z.fromString(t);
|
|
4680
|
-
E(
|
|
4690
|
+
E(ze(n));
|
|
4681
4691
|
var r = new X(n.get(1), n.get(3)), i = new nt(n.popFirst(5));
|
|
4682
4692
|
return r.isEqual(e) ||
|
|
4683
4693
|
// TODO(b/64130202): Somehow support foreign references.
|
|
@@ -4698,12 +4708,12 @@ var mr = /** @class */ function(e) {
|
|
|
4698
4708
|
* @param reference - The reference of the document to fetch.
|
|
4699
4709
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the current
|
|
4700
4710
|
* document contents.
|
|
4701
|
-
*/ function
|
|
4702
|
-
var e =
|
|
4703
|
-
return
|
|
4711
|
+
*/ function vr(t) {
|
|
4712
|
+
var e = Je((t = st(t, an)).firestore), n = new yr(t.firestore);
|
|
4713
|
+
return Ye(e, [ t._key ]).then((function(e) {
|
|
4704
4714
|
E(1 === e.length);
|
|
4705
4715
|
var r = e[0];
|
|
4706
|
-
return new
|
|
4716
|
+
return new Qn(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
|
|
4707
4717
|
}));
|
|
4708
4718
|
}
|
|
4709
4719
|
|
|
@@ -4718,35 +4728,35 @@ var mr = /** @class */ function(e) {
|
|
|
4718
4728
|
*
|
|
4719
4729
|
* @param query - The `Query` to execute.
|
|
4720
4730
|
* @returns A Promise that will be resolved with the results of the query.
|
|
4721
|
-
*/ function
|
|
4731
|
+
*/ function gr(t) {
|
|
4722
4732
|
!function(t) {
|
|
4723
|
-
if ("L" /* Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new
|
|
4724
|
-
}((t = st(t,
|
|
4725
|
-
var e =
|
|
4726
|
-
return
|
|
4733
|
+
if ("L" /* Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new M(L, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
4734
|
+
}((t = st(t, sn))._query);
|
|
4735
|
+
var e = Je(t.firestore), n = new yr(t.firestore);
|
|
4736
|
+
return $e(e, t._query).then((function(e) {
|
|
4727
4737
|
var r = e.map((function(e) {
|
|
4728
|
-
return new
|
|
4738
|
+
return new Kn(t.firestore, n, e.key, e, t.converter);
|
|
4729
4739
|
}));
|
|
4730
4740
|
return "L" /* Last */ === t._query.limitType &&
|
|
4731
4741
|
// Limit to last queries reverse the orderBy constraint that was
|
|
4732
4742
|
// specified by the user. As such, we need to reverse the order of the
|
|
4733
4743
|
// results to return the documents in the expected order.
|
|
4734
|
-
r.reverse(), new
|
|
4744
|
+
r.reverse(), new Hn(t, r);
|
|
4735
4745
|
}));
|
|
4736
4746
|
}
|
|
4737
4747
|
|
|
4738
|
-
function
|
|
4739
|
-
var r =
|
|
4740
|
-
return
|
|
4748
|
+
function wr(t, e, n) {
|
|
4749
|
+
var r = mr((t = st(t, an)).converter, e, n), i = In(An(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
|
|
4750
|
+
return We(Je(t.firestore), [ i.toMutation(t._key, _e.none()) ]);
|
|
4741
4751
|
}
|
|
4742
4752
|
|
|
4743
|
-
function
|
|
4753
|
+
function br(t, e, n) {
|
|
4744
4754
|
for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
|
|
4745
|
-
var o, a =
|
|
4755
|
+
var o, a = An((t = st(t, an)).firestore);
|
|
4746
4756
|
// For Compat types, we have to "extract" the underlying types before
|
|
4747
4757
|
// performing validation.
|
|
4748
|
-
return o = "string" == typeof (e = p(e)) || e instanceof
|
|
4749
|
-
|
|
4758
|
+
return o = "string" == typeof (e = p(e)) || e instanceof dn ? On(a, "updateDoc", t._key, e, n, r) : Fn(a, "updateDoc", t._key, e),
|
|
4759
|
+
We(Je(t.firestore), [ o.toMutation(t._key, _e.exists(!0)) ]);
|
|
4750
4760
|
}
|
|
4751
4761
|
|
|
4752
4762
|
/**
|
|
@@ -4760,8 +4770,8 @@ function wr(t, e, n) {
|
|
|
4760
4770
|
* @param reference - A reference to the document to delete.
|
|
4761
4771
|
* @returns A `Promise` resolved once the document has been successfully
|
|
4762
4772
|
* deleted from the backend.
|
|
4763
|
-
*/ function
|
|
4764
|
-
return
|
|
4773
|
+
*/ function _r(t) {
|
|
4774
|
+
return We(Je((t = st(t, an)).firestore), [ new Ae(t._key, _e.none()) ]);
|
|
4765
4775
|
}
|
|
4766
4776
|
|
|
4767
4777
|
/**
|
|
@@ -4778,9 +4788,9 @@ function wr(t, e, n) {
|
|
|
4778
4788
|
* @throws Error - If the provided input is not a valid Firestore document.
|
|
4779
4789
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
4780
4790
|
* newly created document after it has been written to the backend.
|
|
4781
|
-
*/ function
|
|
4782
|
-
var n =
|
|
4783
|
-
return
|
|
4791
|
+
*/ function Tr(t, e) {
|
|
4792
|
+
var n = fn(t = st(t, un)), r = mr(t.converter, e), i = In(An(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
|
|
4793
|
+
return We(Je(t.firestore), [ i.toMutation(n._key, _e.exists(!1)) ]).then((function() {
|
|
4784
4794
|
return n;
|
|
4785
4795
|
}));
|
|
4786
4796
|
}
|
|
@@ -4804,15 +4814,15 @@ function wr(t, e, n) {
|
|
|
4804
4814
|
/**
|
|
4805
4815
|
* Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
|
|
4806
4816
|
* {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
|
|
4807
|
-
*/ function
|
|
4808
|
-
return new
|
|
4817
|
+
*/ function Sr() {
|
|
4818
|
+
return new kn("deleteField");
|
|
4809
4819
|
}
|
|
4810
4820
|
|
|
4811
4821
|
/**
|
|
4812
4822
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
4813
4823
|
* include a server-generated timestamp in the written data.
|
|
4814
|
-
*/ function
|
|
4815
|
-
return new
|
|
4824
|
+
*/ function Er() {
|
|
4825
|
+
return new Dn("serverTimestamp");
|
|
4816
4826
|
}
|
|
4817
4827
|
|
|
4818
4828
|
/**
|
|
@@ -4826,11 +4836,11 @@ function wr(t, e, n) {
|
|
|
4826
4836
|
* @param elements - The elements to union into the array.
|
|
4827
4837
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
4828
4838
|
* `updateDoc()`.
|
|
4829
|
-
*/ function
|
|
4839
|
+
*/ function Ar() {
|
|
4830
4840
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
4831
4841
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
4832
4842
|
// update() since we'd need the Firestore instance to do this.
|
|
4833
|
-
return new
|
|
4843
|
+
return new Pn("arrayUnion", t);
|
|
4834
4844
|
}
|
|
4835
4845
|
|
|
4836
4846
|
/**
|
|
@@ -4847,7 +4857,7 @@ function wr(t, e, n) {
|
|
|
4847
4857
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
4848
4858
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
4849
4859
|
// update() since we'd need the Firestore instance to do this.
|
|
4850
|
-
return new
|
|
4860
|
+
return new Nn("arrayRemove", t);
|
|
4851
4861
|
}
|
|
4852
4862
|
|
|
4853
4863
|
/**
|
|
@@ -4868,8 +4878,8 @@ function wr(t, e, n) {
|
|
|
4868
4878
|
* @param n - The value to increment by.
|
|
4869
4879
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
4870
4880
|
* `updateDoc()`
|
|
4871
|
-
*/ function
|
|
4872
|
-
return new
|
|
4881
|
+
*/ function kr(t) {
|
|
4882
|
+
return new qn("increment", t);
|
|
4873
4883
|
}
|
|
4874
4884
|
|
|
4875
4885
|
/**
|
|
@@ -4895,24 +4905,24 @@ function wr(t, e, n) {
|
|
|
4895
4905
|
* provides methods for adding writes to the write batch. None of the writes
|
|
4896
4906
|
* will be committed (or visible locally) until {@link WriteBatch.commit} is
|
|
4897
4907
|
* called.
|
|
4898
|
-
*/ var
|
|
4908
|
+
*/ var Vr = /** @class */ function() {
|
|
4899
4909
|
/** @hideconstructor */
|
|
4900
4910
|
function t(t, e) {
|
|
4901
4911
|
this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
|
|
4902
|
-
this._dataReader =
|
|
4912
|
+
this._dataReader = An(t);
|
|
4903
4913
|
}
|
|
4904
4914
|
return t.prototype.set = function(t, e, n) {
|
|
4905
4915
|
this._verifyNotCommitted();
|
|
4906
|
-
var r =
|
|
4907
|
-
return this._mutations.push(o.toMutation(r._key,
|
|
4916
|
+
var r = Dr(t, this._firestore), i = mr(r.converter, e, n), o = In(this._dataReader, "WriteBatch.set", r._key, i, null !== r.converter, n);
|
|
4917
|
+
return this._mutations.push(o.toMutation(r._key, _e.none())), this;
|
|
4908
4918
|
}, t.prototype.update = function(t, e, n) {
|
|
4909
4919
|
for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
|
|
4910
4920
|
this._verifyNotCommitted();
|
|
4911
|
-
var o, a =
|
|
4921
|
+
var o, a = Dr(t, this._firestore);
|
|
4912
4922
|
// For Compat types, we have to "extract" the underlying types before
|
|
4913
4923
|
// performing validation.
|
|
4914
|
-
return o = "string" == typeof (e = p(e)) || e instanceof
|
|
4915
|
-
this._mutations.push(o.toMutation(a._key,
|
|
4924
|
+
return o = "string" == typeof (e = p(e)) || e instanceof dn ? On(this._dataReader, "WriteBatch.update", a._key, e, n, r) : Fn(this._dataReader, "WriteBatch.update", a._key, e),
|
|
4925
|
+
this._mutations.push(o.toMutation(a._key, _e.exists(!0))), this;
|
|
4916
4926
|
},
|
|
4917
4927
|
/**
|
|
4918
4928
|
* Deletes the document referred to by the provided {@link DocumentReference}.
|
|
@@ -4922,8 +4932,8 @@ function wr(t, e, n) {
|
|
|
4922
4932
|
*/
|
|
4923
4933
|
t.prototype.delete = function(t) {
|
|
4924
4934
|
this._verifyNotCommitted();
|
|
4925
|
-
var e =
|
|
4926
|
-
return this._mutations = this._mutations.concat(new
|
|
4935
|
+
var e = Dr(t, this._firestore);
|
|
4936
|
+
return this._mutations = this._mutations.concat(new Ae(e._key, _e.none())), this;
|
|
4927
4937
|
},
|
|
4928
4938
|
/**
|
|
4929
4939
|
* Commits all of the writes in this write batch as a single atomic unit.
|
|
@@ -4940,12 +4950,12 @@ function wr(t, e, n) {
|
|
|
4940
4950
|
t.prototype.commit = function() {
|
|
4941
4951
|
return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve();
|
|
4942
4952
|
}, t.prototype._verifyNotCommitted = function() {
|
|
4943
|
-
if (this._committed) throw new
|
|
4953
|
+
if (this._committed) throw new M(O, "A write batch can no longer be used after commit() has been called.");
|
|
4944
4954
|
}, t;
|
|
4945
4955
|
}();
|
|
4946
4956
|
|
|
4947
|
-
function
|
|
4948
|
-
if ((t = p(t)).firestore !== e) throw new
|
|
4957
|
+
function Dr(t, e) {
|
|
4958
|
+
if ((t = p(t)).firestore !== e) throw new M(V, "Provided document reference is from a different Firestore instance.");
|
|
4949
4959
|
return t;
|
|
4950
4960
|
}
|
|
4951
4961
|
|
|
@@ -4961,10 +4971,10 @@ function Vr(t, e) {
|
|
|
4961
4971
|
*
|
|
4962
4972
|
* @returns A `WriteBatch` that can be used to atomically execute multiple
|
|
4963
4973
|
* writes.
|
|
4964
|
-
*/ function
|
|
4965
|
-
var e =
|
|
4966
|
-
return new
|
|
4967
|
-
return
|
|
4974
|
+
*/ function Pr(t) {
|
|
4975
|
+
var e = Je(t = st(t, tn));
|
|
4976
|
+
return new Vr(t, (function(t) {
|
|
4977
|
+
return We(e, t);
|
|
4968
4978
|
}));
|
|
4969
4979
|
}
|
|
4970
4980
|
|
|
@@ -4987,7 +4997,7 @@ function Vr(t, e) {
|
|
|
4987
4997
|
/**
|
|
4988
4998
|
* Internal transaction object responsible for accumulating the mutations to
|
|
4989
4999
|
* perform and the base versions for any documents read.
|
|
4990
|
-
*/ var
|
|
5000
|
+
*/ var Nr = /** @class */ function() {
|
|
4991
5001
|
function t(t) {
|
|
4992
5002
|
this.datastore = t,
|
|
4993
5003
|
// The version of each document that was read during this transaction.
|
|
@@ -5011,8 +5021,8 @@ function Vr(t, e) {
|
|
|
5011
5021
|
return n(this, (function(n) {
|
|
5012
5022
|
switch (n.label) {
|
|
5013
5023
|
case 0:
|
|
5014
|
-
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new
|
|
5015
|
-
return [ 4 /*yield*/ ,
|
|
5024
|
+
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new M(V, "Firestore transactions require all reads to be executed before all writes.");
|
|
5025
|
+
return [ 4 /*yield*/ , Ye(this.datastore, t) ];
|
|
5016
5026
|
|
|
5017
5027
|
case 1:
|
|
5018
5028
|
return [ 2 /*return*/ , ((e = n.sent()).forEach((function(t) {
|
|
@@ -5031,7 +5041,7 @@ function Vr(t, e) {
|
|
|
5031
5041
|
}
|
|
5032
5042
|
this.writtenDocs.add(t.toString());
|
|
5033
5043
|
}, t.prototype.delete = function(t) {
|
|
5034
|
-
this.write(new
|
|
5044
|
+
this.write(new Ae(t, this.precondition(t))), this.writtenDocs.add(t.toString());
|
|
5035
5045
|
}, t.prototype.commit = function() {
|
|
5036
5046
|
return e(this, void 0, void 0, (function() {
|
|
5037
5047
|
var t, e = this;
|
|
@@ -5049,7 +5059,7 @@ function Vr(t, e) {
|
|
|
5049
5059
|
t.forEach((function(t, n) {
|
|
5050
5060
|
var r = nt.fromPath(n);
|
|
5051
5061
|
e.mutations.push(new Ie(r, e.precondition(r)));
|
|
5052
|
-
})), [ 4 /*yield*/ ,
|
|
5062
|
+
})), [ 4 /*yield*/ , We(this.datastore, this.mutations) ];
|
|
5053
5063
|
|
|
5054
5064
|
case 1:
|
|
5055
5065
|
// For each mutation, note that the doc was written.
|
|
@@ -5068,7 +5078,7 @@ function Vr(t, e) {
|
|
|
5068
5078
|
if (n) {
|
|
5069
5079
|
if (!e.isEqual(n))
|
|
5070
5080
|
// This transaction will fail no matter what.
|
|
5071
|
-
throw new
|
|
5081
|
+
throw new M(C, "Document version changed between two reads.");
|
|
5072
5082
|
} else this.readVersions.set(t.key.toString(), e);
|
|
5073
5083
|
},
|
|
5074
5084
|
/**
|
|
@@ -5077,7 +5087,7 @@ function Vr(t, e) {
|
|
|
5077
5087
|
*/
|
|
5078
5088
|
t.prototype.precondition = function(t) {
|
|
5079
5089
|
var e = this.readVersions.get(t.toString());
|
|
5080
|
-
return !this.writtenDocs.has(t.toString()) && e ?
|
|
5090
|
+
return !this.writtenDocs.has(t.toString()) && e ? _e.updateTime(e) : _e.none();
|
|
5081
5091
|
},
|
|
5082
5092
|
/**
|
|
5083
5093
|
* Returns the precondition for a document if the operation is an update.
|
|
@@ -5097,31 +5107,33 @@ function Vr(t, e) {
|
|
|
5097
5107
|
// express that to the backend, we have to validate locally.
|
|
5098
5108
|
// Note: this can change once we can send separate verify writes in the
|
|
5099
5109
|
// transaction.
|
|
5100
|
-
throw new
|
|
5110
|
+
throw new M(V, "Can't update a document that doesn't exist.");
|
|
5101
5111
|
// Document exists, base precondition on document update time.
|
|
5102
|
-
return
|
|
5112
|
+
return _e.updateTime(e);
|
|
5103
5113
|
}
|
|
5104
5114
|
// Document was not read, so we just use the preconditions for a blind
|
|
5105
5115
|
// update.
|
|
5106
|
-
return
|
|
5116
|
+
return _e.exists(!0);
|
|
5107
5117
|
}, t.prototype.write = function(t) {
|
|
5108
5118
|
this.ensureCommitNotCalled(), this.mutations.push(t);
|
|
5109
5119
|
}, t.prototype.ensureCommitNotCalled = function() {}, t;
|
|
5110
|
-
}(),
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5120
|
+
}(), qr = {
|
|
5121
|
+
maxAttempts: 5
|
|
5122
|
+
}, Fr = /** @class */ function() {
|
|
5123
|
+
function t(t, e, n, r, i) {
|
|
5124
|
+
this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = r,
|
|
5125
|
+
this.deferred = i, this.Tt = n.maxAttempts, this.At = new Ke(this.asyncQueue, "transaction_retry" /* TransactionRetry */)
|
|
5114
5126
|
/** Runs the transaction and sets the result on deferred. */;
|
|
5115
5127
|
}
|
|
5116
5128
|
return t.prototype.run = function() {
|
|
5117
|
-
this.Tt -= 1, this.
|
|
5118
|
-
}, t.prototype.
|
|
5129
|
+
this.Tt -= 1, this.It();
|
|
5130
|
+
}, t.prototype.It = function() {
|
|
5119
5131
|
var t = this;
|
|
5120
|
-
this.
|
|
5132
|
+
this.At.W((function() {
|
|
5121
5133
|
return e(t, void 0, void 0, (function() {
|
|
5122
5134
|
var t, e, r = this;
|
|
5123
5135
|
return n(this, (function(n) {
|
|
5124
|
-
return t = new
|
|
5136
|
+
return t = new Nr(this.datastore), (e = this.Rt(t)) && e.then((function(e) {
|
|
5125
5137
|
r.asyncQueue.enqueueAndForget((function() {
|
|
5126
5138
|
return t.commit().then((function() {
|
|
5127
5139
|
r.deferred.resolve(e);
|
|
@@ -5147,7 +5159,7 @@ function Vr(t, e) {
|
|
|
5147
5159
|
}, t.prototype.Pt = function(t) {
|
|
5148
5160
|
var e = this;
|
|
5149
5161
|
this.Tt > 0 && this.Vt(t) ? (this.Tt -= 1, this.asyncQueue.enqueueAndForget((function() {
|
|
5150
|
-
return e.
|
|
5162
|
+
return e.It(), Promise.resolve();
|
|
5151
5163
|
}))) : this.deferred.reject(t);
|
|
5152
5164
|
}, t.prototype.Vt = function(t) {
|
|
5153
5165
|
if ("FirebaseError" === t.name) {
|
|
@@ -5166,12 +5178,12 @@ function Vr(t, e) {
|
|
|
5166
5178
|
default:
|
|
5167
5179
|
return S();
|
|
5168
5180
|
|
|
5169
|
-
case
|
|
5181
|
+
case I:
|
|
5170
5182
|
case k:
|
|
5171
5183
|
case D:
|
|
5172
5184
|
case F:
|
|
5173
5185
|
case R:
|
|
5174
|
-
case
|
|
5186
|
+
case x:
|
|
5175
5187
|
// Unauthenticated means something went wrong with our token and we need
|
|
5176
5188
|
// to retry with new credentials which will happen automatically.
|
|
5177
5189
|
case q:
|
|
@@ -5186,8 +5198,8 @@ function Vr(t, e) {
|
|
|
5186
5198
|
// the context and should handled individually by the calling code.
|
|
5187
5199
|
// See https://cloud.google.com/apis/design/errors.
|
|
5188
5200
|
case C:
|
|
5189
|
-
case L:
|
|
5190
5201
|
case j:
|
|
5202
|
+
case L:
|
|
5191
5203
|
case "data-loss":
|
|
5192
5204
|
return !0;
|
|
5193
5205
|
}
|
|
@@ -5199,7 +5211,7 @@ function Vr(t, e) {
|
|
|
5199
5211
|
|
|
5200
5212
|
/**
|
|
5201
5213
|
* @license
|
|
5202
|
-
* Copyright
|
|
5214
|
+
* Copyright 2022 Google LLC
|
|
5203
5215
|
*
|
|
5204
5216
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5205
5217
|
* you may not use this file except in compliance with the License.
|
|
@@ -5213,10 +5225,6 @@ function Vr(t, e) {
|
|
|
5213
5225
|
* See the License for the specific language governing permissions and
|
|
5214
5226
|
* limitations under the License.
|
|
5215
5227
|
*/
|
|
5216
|
-
/**
|
|
5217
|
-
* TransactionRunner encapsulates the logic needed to run and retry transactions
|
|
5218
|
-
* with backoff.
|
|
5219
|
-
*/
|
|
5220
5228
|
/**
|
|
5221
5229
|
* @license
|
|
5222
5230
|
* Copyright 2020 Google LLC
|
|
@@ -5233,7 +5241,7 @@ function Vr(t, e) {
|
|
|
5233
5241
|
* See the License for the specific language governing permissions and
|
|
5234
5242
|
* limitations under the License.
|
|
5235
5243
|
*/
|
|
5236
|
-
/** The Platform's 'document' implementation or null if not available. */ function
|
|
5244
|
+
/** The Platform's 'document' implementation or null if not available. */ function Or() {
|
|
5237
5245
|
// `document` is not always available, e.g. in ReactNative and WebWorkers.
|
|
5238
5246
|
// eslint-disable-next-line no-restricted-globals
|
|
5239
5247
|
return "undefined" != typeof document ? document : null;
|
|
@@ -5265,7 +5273,7 @@ function Vr(t, e) {
|
|
|
5265
5273
|
* Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
|
|
5266
5274
|
* in newer versions of TypeScript defines `finally`, which is not available in
|
|
5267
5275
|
* IE.
|
|
5268
|
-
*/ var
|
|
5276
|
+
*/ var Cr = /** @class */ function() {
|
|
5269
5277
|
function t(t, e, n, r, i) {
|
|
5270
5278
|
this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = r, this.removalCallback = i,
|
|
5271
5279
|
this.deferred = new U, this.then = this.deferred.promise.then.bind(this.deferred.promise),
|
|
@@ -5317,7 +5325,7 @@ function Vr(t, e) {
|
|
|
5317
5325
|
* guarantee that the operation will not be run.
|
|
5318
5326
|
*/
|
|
5319
5327
|
t.prototype.cancel = function(t) {
|
|
5320
|
-
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new
|
|
5328
|
+
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new M(I, "Operation cancelled" + (t ? ": " + t : ""))));
|
|
5321
5329
|
}, t.prototype.handleDelayElapsed = function() {
|
|
5322
5330
|
var t = this;
|
|
5323
5331
|
this.asyncQueue.enqueueAndForget((function() {
|
|
@@ -5329,7 +5337,7 @@ function Vr(t, e) {
|
|
|
5329
5337
|
null !== this.timerHandle && (this.removalCallback(this), clearTimeout(this.timerHandle),
|
|
5330
5338
|
this.timerHandle = null);
|
|
5331
5339
|
}, t;
|
|
5332
|
-
}(),
|
|
5340
|
+
}(), jr = /** @class */ function() {
|
|
5333
5341
|
function t() {
|
|
5334
5342
|
var t = this;
|
|
5335
5343
|
// The last promise in the queue.
|
|
@@ -5344,24 +5352,24 @@ function Vr(t, e) {
|
|
|
5344
5352
|
// automatically removed after they are run or canceled.
|
|
5345
5353
|
this.St = [],
|
|
5346
5354
|
// visible for testing
|
|
5347
|
-
this.
|
|
5355
|
+
this.xt = null,
|
|
5348
5356
|
// Flag set while there's an outstanding AsyncQueue operation, used for
|
|
5349
5357
|
// assertion sanity-checks.
|
|
5350
|
-
this.
|
|
5358
|
+
this.Ft = !1,
|
|
5351
5359
|
// Enabled during shutdown on Safari to prevent future access to IndexedDB.
|
|
5352
5360
|
this.qt = !1,
|
|
5353
5361
|
// List of TimerIds to fast-forward delays for.
|
|
5354
5362
|
this.Ot = [],
|
|
5355
5363
|
// Backoff timer used to schedule retries for retryable operations
|
|
5356
|
-
this.
|
|
5364
|
+
this.At = new Ke(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
5357
5365
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
5358
5366
|
// operations. Meant to speed up recovery when we regain file system access
|
|
5359
5367
|
// after page comes into foreground.
|
|
5360
5368
|
this.Ct = function() {
|
|
5361
|
-
var e =
|
|
5362
|
-
e && w("AsyncQueue", "Visibility state changed to " + e.visibilityState), t.
|
|
5369
|
+
var e = Or();
|
|
5370
|
+
e && w("AsyncQueue", "Visibility state changed to " + e.visibilityState), t.At.H();
|
|
5363
5371
|
};
|
|
5364
|
-
var e =
|
|
5372
|
+
var e = Or();
|
|
5365
5373
|
e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.Ct);
|
|
5366
5374
|
}
|
|
5367
5375
|
return Object.defineProperty(t.prototype, "isShuttingDown", {
|
|
@@ -5385,7 +5393,7 @@ function Vr(t, e) {
|
|
|
5385
5393
|
}, t.prototype.enterRestrictedMode = function(t) {
|
|
5386
5394
|
if (!this.$t) {
|
|
5387
5395
|
this.$t = !0, this.qt = t || !1;
|
|
5388
|
-
var e =
|
|
5396
|
+
var e = Or();
|
|
5389
5397
|
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Ct);
|
|
5390
5398
|
}
|
|
5391
5399
|
}, t.prototype.enqueue = function(t) {
|
|
@@ -5425,7 +5433,7 @@ function Vr(t, e) {
|
|
|
5425
5433
|
return n.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , this.Nt[0]() ];
|
|
5426
5434
|
|
|
5427
5435
|
case 2:
|
|
5428
|
-
return n.sent(), this.Nt.shift(), this.
|
|
5436
|
+
return n.sent(), this.Nt.shift(), this.At.reset(), [ 3 /*break*/ , 4 ];
|
|
5429
5437
|
|
|
5430
5438
|
case 3:
|
|
5431
5439
|
if (t = n.sent(), "IndexedDbTransactionError" !== t.name) throw t;
|
|
@@ -5445,7 +5453,7 @@ function Vr(t, e) {
|
|
|
5445
5453
|
// Since `backoffAndRun()` cancels an existing backoff and schedules a
|
|
5446
5454
|
// new backoff on every call, there is only ever a single additional
|
|
5447
5455
|
// operation in the queue.
|
|
5448
|
-
this.
|
|
5456
|
+
this.At.W((function() {
|
|
5449
5457
|
return e.kt();
|
|
5450
5458
|
})), n.label = 5;
|
|
5451
5459
|
|
|
@@ -5456,8 +5464,8 @@ function Vr(t, e) {
|
|
|
5456
5464
|
}));
|
|
5457
5465
|
}, t.prototype.Ut = function(t) {
|
|
5458
5466
|
var e = this, n = this.Dt.then((function() {
|
|
5459
|
-
return e.
|
|
5460
|
-
e.
|
|
5467
|
+
return e.Ft = !0, t().catch((function(t) {
|
|
5468
|
+
e.xt = t, e.Ft = !1;
|
|
5461
5469
|
var n =
|
|
5462
5470
|
/**
|
|
5463
5471
|
* Chrome includes Error.message in Error.stack. Other browsers do not.
|
|
@@ -5474,7 +5482,7 @@ function Vr(t, e) {
|
|
|
5474
5482
|
// and return the rejected Promise.
|
|
5475
5483
|
throw b("INTERNAL UNHANDLED ERROR: ", n), t;
|
|
5476
5484
|
})).then((function(t) {
|
|
5477
|
-
return e.
|
|
5485
|
+
return e.Ft = !1, t;
|
|
5478
5486
|
}));
|
|
5479
5487
|
}));
|
|
5480
5488
|
return this.Dt = n, n;
|
|
@@ -5483,12 +5491,12 @@ function Vr(t, e) {
|
|
|
5483
5491
|
this.Lt(),
|
|
5484
5492
|
// Fast-forward delays for timerIds that have been overriden.
|
|
5485
5493
|
this.Ot.indexOf(t) > -1 && (e = 0);
|
|
5486
|
-
var i =
|
|
5494
|
+
var i = Cr.createAndSchedule(this, t, e, n, (function(t) {
|
|
5487
5495
|
return r.jt(t);
|
|
5488
5496
|
}));
|
|
5489
5497
|
return this.St.push(i), i;
|
|
5490
5498
|
}, t.prototype.Lt = function() {
|
|
5491
|
-
this.
|
|
5499
|
+
this.xt && S();
|
|
5492
5500
|
}, t.prototype.verifyOperationInProgress = function() {},
|
|
5493
5501
|
/**
|
|
5494
5502
|
* Waits until all currently queued tasks are finished executing. Delayed
|
|
@@ -5558,10 +5566,10 @@ function Vr(t, e) {
|
|
|
5558
5566
|
var e = this.St.indexOf(t);
|
|
5559
5567
|
this.St.splice(e, 1);
|
|
5560
5568
|
}, t;
|
|
5561
|
-
}(),
|
|
5569
|
+
}(), Lr = /** @class */ function() {
|
|
5562
5570
|
/** @hideconstructor */
|
|
5563
5571
|
function t(t, e) {
|
|
5564
|
-
this._firestore = t, this._transaction = e, this._dataReader =
|
|
5572
|
+
this._firestore = t, this._transaction = e, this._dataReader = An(t)
|
|
5565
5573
|
/**
|
|
5566
5574
|
* Reads the document referenced by the provided {@link DocumentReference}.
|
|
5567
5575
|
*
|
|
@@ -5570,23 +5578,23 @@ function Vr(t, e) {
|
|
|
5570
5578
|
*/;
|
|
5571
5579
|
}
|
|
5572
5580
|
return t.prototype.get = function(t) {
|
|
5573
|
-
var e = this, n =
|
|
5581
|
+
var e = this, n = Dr(t, this._firestore), r = new yr(this._firestore);
|
|
5574
5582
|
return this._transaction.lookup([ n._key ]).then((function(t) {
|
|
5575
5583
|
if (!t || 1 !== t.length) return S();
|
|
5576
5584
|
var i = t[0];
|
|
5577
|
-
if (i.isFoundDocument()) return new
|
|
5578
|
-
if (i.isNoDocument()) return new
|
|
5585
|
+
if (i.isFoundDocument()) return new Qn(e._firestore, r, i.key, i, n.converter);
|
|
5586
|
+
if (i.isNoDocument()) return new Qn(e._firestore, r, n._key, null, n.converter);
|
|
5579
5587
|
throw S();
|
|
5580
5588
|
}));
|
|
5581
5589
|
}, t.prototype.set = function(t, e, n) {
|
|
5582
|
-
var r =
|
|
5590
|
+
var r = Dr(t, this._firestore), i = mr(r.converter, e, n), o = In(this._dataReader, "Transaction.set", r._key, i, null !== r.converter, n);
|
|
5583
5591
|
return this._transaction.set(r._key, o), this;
|
|
5584
5592
|
}, t.prototype.update = function(t, e, n) {
|
|
5585
5593
|
for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
|
|
5586
|
-
var o, a =
|
|
5594
|
+
var o, a = Dr(t, this._firestore);
|
|
5587
5595
|
// For Compat types, we have to "extract" the underlying types before
|
|
5588
5596
|
// performing validation.
|
|
5589
|
-
return o = "string" == typeof (e = p(e)) || e instanceof
|
|
5597
|
+
return o = "string" == typeof (e = p(e)) || e instanceof dn ? On(this._dataReader, "Transaction.update", a._key, e, n, r) : Fn(this._dataReader, "Transaction.update", a._key, e),
|
|
5590
5598
|
this._transaction.update(a._key, o), this;
|
|
5591
5599
|
},
|
|
5592
5600
|
/**
|
|
@@ -5596,7 +5604,7 @@ function Vr(t, e) {
|
|
|
5596
5604
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
5597
5605
|
*/
|
|
5598
5606
|
t.prototype.delete = function(t) {
|
|
5599
|
-
var e =
|
|
5607
|
+
var e = Dr(t, this._firestore);
|
|
5600
5608
|
return this._transaction.delete(e._key), this;
|
|
5601
5609
|
}, t;
|
|
5602
5610
|
}();
|
|
@@ -5634,11 +5642,15 @@ function Vr(t, e) {
|
|
|
5634
5642
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
5635
5643
|
* rejected promise with the corresponding failure error is returned.
|
|
5636
5644
|
*/
|
|
5637
|
-
function
|
|
5638
|
-
var
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
}
|
|
5645
|
+
function Rr(t, e, n) {
|
|
5646
|
+
var r = Je(t = st(t, tn)), i = Object.assign(Object.assign({}, qr), n);
|
|
5647
|
+
!function(t) {
|
|
5648
|
+
if (t.maxAttempts < 1) throw new M(V, "Max attempts must be at least 1");
|
|
5649
|
+
}(i);
|
|
5650
|
+
var o = new U;
|
|
5651
|
+
return new Fr(new jr, r, i, (function(n) {
|
|
5652
|
+
return e(new Lr(t, n));
|
|
5653
|
+
}), o).run(), o.promise
|
|
5642
5654
|
/**
|
|
5643
5655
|
* Firestore Lite
|
|
5644
5656
|
*
|
|
@@ -5650,11 +5662,11 @@ function Lr(t, e) {
|
|
|
5650
5662
|
}
|
|
5651
5663
|
|
|
5652
5664
|
y = i + "_lite", o(new c("firestore/lite", (function(t, e) {
|
|
5653
|
-
var n = e.options, r = t.getProvider("app").getImmediate(), i = new
|
|
5665
|
+
var n = e.options, r = t.getProvider("app").getImmediate(), i = new tn(r, new Q(t.getProvider("auth-internal")), new Y(t.getProvider("app-check-internal")));
|
|
5654
5666
|
return n && i._setSettings(n), i;
|
|
5655
5667
|
}), "PUBLIC")),
|
|
5656
5668
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
5657
|
-
a("firestore-lite", "3.4.8-canary.
|
|
5669
|
+
a("firestore-lite", "3.4.8-canary.adb9aaa34", ""), a("firestore-lite", "3.4.8-canary.adb9aaa34", "esm5");
|
|
5658
5670
|
|
|
5659
|
-
export {
|
|
5671
|
+
export { yn as Bytes, un as CollectionReference, an as DocumentReference, Qn as DocumentSnapshot, dn as FieldPath, vn as FieldValue, tn as Firestore, M as FirestoreError, gn as GeoPoint, sn as Query, $n as QueryConstraint, Kn as QueryDocumentSnapshot, Hn as QuerySnapshot, bt as Timestamp, Lr as Transaction, Vr as WriteBatch, Tr as addDoc, Ir as arrayRemove, Ar as arrayUnion, cn as collection, ln as collectionGroup, rn as connectFirestoreEmulator, _r as deleteDoc, Sr as deleteField, fn as doc, mn as documentId, lr as endAt, cr as endBefore, vr as getDoc, gr as getDocs, nn as getFirestore, kr as increment, en as initializeFirestore, rr as limit, ir as limitToLast, er as orderBy, Xn as query, pn as queryEqual, hn as refEqual, Rr as runTransaction, Er as serverTimestamp, wr as setDoc, g as setLogLevel, Wn as snapshotEqual, sr as startAfter, ar as startAt, on as terminate, br as updateDoc, Zn as where, Pr as writeBatch };
|
|
5660
5672
|
//# sourceMappingURL=index.browser.esm5.js.map
|