@firebase/firestore 3.4.2 → 3.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/firestore/src/api/snapshot.d.ts +6 -6
- package/dist/firestore/src/lite-api/snapshot.d.ts +2 -2
- package/dist/firestore/test/integration/bootstrap.d.ts +0 -1
- package/dist/firestore/test/integration/util/events_accumulator.d.ts +2 -2
- package/dist/firestore/test/integration/util/firebase_export.d.ts +6 -14
- package/dist/firestore/test/integration/util/helpers.d.ts +18 -18
- package/dist/firestore/test/integration/util/internal_helpers.d.ts +3 -3
- package/dist/firestore/test/integration/util/settings.d.ts +2 -2
- package/dist/firestore/test/unit/api/{blob.test.d.ts → bytes.test.d.ts} +0 -0
- package/dist/firestore/test/util/api_helpers.d.ts +1 -1
- package/dist/firestore/test/util/helpers.d.ts +4 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.esm2017.js +869 -869
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +1257 -1257
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +2674 -24
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +2675 -25
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +1068 -1068
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +8 -8
- package/dist/lite/firestore/src/api/snapshot.d.ts +6 -6
- package/dist/lite/firestore/src/lite-api/snapshot.d.ts +2 -2
- package/dist/lite/firestore/test/integration/bootstrap.d.ts +0 -1
- package/dist/lite/firestore/test/integration/util/events_accumulator.d.ts +2 -2
- package/dist/lite/firestore/test/integration/util/firebase_export.d.ts +6 -14
- package/dist/lite/firestore/test/integration/util/helpers.d.ts +18 -18
- package/dist/lite/firestore/test/integration/util/internal_helpers.d.ts +3 -3
- package/dist/lite/firestore/test/integration/util/settings.d.ts +2 -2
- package/dist/lite/firestore/test/unit/api/{blob.test.d.ts → bytes.test.d.ts} +0 -0
- package/dist/lite/firestore/test/util/api_helpers.d.ts +1 -1
- package/dist/lite/firestore/test/util/helpers.d.ts +4 -6
- package/dist/lite/index.browser.esm2017.js +1136 -1136
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +105 -105
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.d.ts +2 -2
- package/dist/lite/index.node.cjs.js +11 -12
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +11 -12
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +148 -148
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +2 -2
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +107 -107
- package/dist/lite/packages/firestore/src/api/snapshot.d.ts +6 -6
- package/dist/lite/packages/firestore/src/lite-api/snapshot.d.ts +2 -2
- package/dist/lite/packages/firestore/test/integration/bootstrap.d.ts +0 -1
- package/dist/lite/packages/firestore/test/integration/util/events_accumulator.d.ts +2 -2
- package/dist/lite/packages/firestore/test/integration/util/firebase_export.d.ts +6 -14
- package/dist/lite/packages/firestore/test/integration/util/helpers.d.ts +18 -18
- package/dist/lite/packages/firestore/test/integration/util/internal_helpers.d.ts +3 -3
- package/dist/lite/packages/firestore/test/integration/util/settings.d.ts +2 -2
- package/dist/lite/packages/firestore/test/unit/api/{blob.test.d.ts → bytes.test.d.ts} +0 -0
- package/dist/lite/packages/firestore/test/util/api_helpers.d.ts +1 -1
- package/dist/lite/packages/firestore/test/util/helpers.d.ts +4 -6
- package/dist/lite/private.d.ts +2 -2
- package/dist/packages/firestore/dist/index.esm2017.d.ts +105 -105
- package/dist/packages/firestore/src/api/snapshot.d.ts +6 -6
- package/dist/packages/firestore/src/lite-api/snapshot.d.ts +2 -2
- package/dist/packages/firestore/test/integration/bootstrap.d.ts +0 -1
- package/dist/packages/firestore/test/integration/util/events_accumulator.d.ts +2 -2
- package/dist/packages/firestore/test/integration/util/firebase_export.d.ts +6 -14
- package/dist/packages/firestore/test/integration/util/helpers.d.ts +18 -18
- package/dist/packages/firestore/test/integration/util/internal_helpers.d.ts +3 -3
- package/dist/packages/firestore/test/integration/util/settings.d.ts +2 -2
- package/dist/packages/firestore/test/unit/api/{blob.test.d.ts → bytes.test.d.ts} +0 -0
- package/dist/packages/firestore/test/util/api_helpers.d.ts +1 -1
- package/dist/packages/firestore/test/util/helpers.d.ts +4 -6
- package/dist/private.d.ts +8 -8
- package/package.json +4 -7
- package/dist/firestore/compat/api/blob.d.ts +0 -29
- package/dist/firestore/compat/api/database.d.ts +0 -228
- package/dist/firestore/compat/api/field_path.d.ts +0 -36
- package/dist/firestore/compat/api/field_value.d.ts +0 -29
- package/dist/firestore/compat/api/geo_point.d.ts +0 -17
- package/dist/firestore/compat/api/observer.d.ts +0 -29
- package/dist/firestore/compat/api/timestamp.d.ts +0 -17
- package/dist/firestore/compat/config.d.ts +0 -28
- package/dist/firestore/compat/index.console.d.ts +0 -42
- package/dist/firestore/compat/index.d.ts +0 -49
- package/dist/firestore/compat/index.node.d.ts +0 -22
- package/dist/firestore/compat/index.rn.d.ts +0 -22
- package/dist/firestore/compat/register-module.d.ts +0 -42
- package/dist/firestore/compat/util/input_validation.d.ts +0 -18
- package/dist/lite/firestore/compat/api/blob.d.ts +0 -29
- package/dist/lite/firestore/compat/api/database.d.ts +0 -228
- package/dist/lite/firestore/compat/api/field_path.d.ts +0 -36
- package/dist/lite/firestore/compat/api/field_value.d.ts +0 -29
- package/dist/lite/firestore/compat/api/geo_point.d.ts +0 -17
- package/dist/lite/firestore/compat/api/observer.d.ts +0 -29
- package/dist/lite/firestore/compat/api/timestamp.d.ts +0 -17
- package/dist/lite/firestore/compat/config.d.ts +0 -28
- package/dist/lite/firestore/compat/index.console.d.ts +0 -42
- package/dist/lite/firestore/compat/index.d.ts +0 -49
- package/dist/lite/firestore/compat/index.node.d.ts +0 -22
- package/dist/lite/firestore/compat/index.rn.d.ts +0 -22
- package/dist/lite/firestore/compat/register-module.d.ts +0 -42
- package/dist/lite/firestore/compat/util/input_validation.d.ts +0 -18
- package/dist/lite/packages/firestore/compat/api/blob.d.ts +0 -29
- package/dist/lite/packages/firestore/compat/api/database.d.ts +0 -228
- package/dist/lite/packages/firestore/compat/api/field_path.d.ts +0 -36
- package/dist/lite/packages/firestore/compat/api/field_value.d.ts +0 -29
- package/dist/lite/packages/firestore/compat/api/geo_point.d.ts +0 -17
- package/dist/lite/packages/firestore/compat/api/observer.d.ts +0 -29
- package/dist/lite/packages/firestore/compat/api/timestamp.d.ts +0 -17
- package/dist/lite/packages/firestore/compat/config.d.ts +0 -28
- package/dist/lite/packages/firestore/compat/index.console.d.ts +0 -42
- package/dist/lite/packages/firestore/compat/index.d.ts +0 -49
- package/dist/lite/packages/firestore/compat/index.node.d.ts +0 -22
- package/dist/lite/packages/firestore/compat/index.rn.d.ts +0 -22
- package/dist/lite/packages/firestore/compat/register-module.d.ts +0 -42
- package/dist/lite/packages/firestore/compat/util/input_validation.d.ts +0 -18
- package/dist/lite/src/protos/README.md +0 -2
- package/dist/lite/src/protos/firestore/bundle.proto +0 -121
- package/dist/lite/src/protos/firestore_bundle_proto.ts +0 -93
- package/dist/lite/src/protos/firestore_proto_api.ts +0 -1259
- package/dist/lite/src/protos/google/api/annotations.proto +0 -31
- package/dist/lite/src/protos/google/api/http.proto +0 -370
- package/dist/lite/src/protos/google/firestore/v1/common.proto +0 -84
- package/dist/lite/src/protos/google/firestore/v1/document.proto +0 -151
- package/dist/lite/src/protos/google/firestore/v1/firestore.proto +0 -761
- package/dist/lite/src/protos/google/firestore/v1/query.proto +0 -302
- package/dist/lite/src/protos/google/firestore/v1/write.proto +0 -264
- package/dist/lite/src/protos/google/protobuf/any.proto +0 -155
- package/dist/lite/src/protos/google/protobuf/descriptor.proto +0 -882
- package/dist/lite/src/protos/google/protobuf/empty.proto +0 -52
- package/dist/lite/src/protos/google/protobuf/struct.proto +0 -96
- package/dist/lite/src/protos/google/protobuf/timestamp.proto +0 -137
- package/dist/lite/src/protos/google/protobuf/wrappers.proto +0 -123
- package/dist/lite/src/protos/google/rpc/status.proto +0 -92
- package/dist/lite/src/protos/google/type/latlng.proto +0 -71
- package/dist/lite/src/protos/update.sh +0 -61
- package/dist/packages/firestore/compat/api/blob.d.ts +0 -29
- package/dist/packages/firestore/compat/api/database.d.ts +0 -228
- package/dist/packages/firestore/compat/api/field_path.d.ts +0 -36
- package/dist/packages/firestore/compat/api/field_value.d.ts +0 -29
- package/dist/packages/firestore/compat/api/geo_point.d.ts +0 -17
- package/dist/packages/firestore/compat/api/observer.d.ts +0 -29
- package/dist/packages/firestore/compat/api/timestamp.d.ts +0 -17
- package/dist/packages/firestore/compat/config.d.ts +0 -28
- package/dist/packages/firestore/compat/index.console.d.ts +0 -42
- package/dist/packages/firestore/compat/index.d.ts +0 -49
- package/dist/packages/firestore/compat/index.node.d.ts +0 -22
- package/dist/packages/firestore/compat/index.rn.d.ts +0 -22
- package/dist/packages/firestore/compat/register-module.d.ts +0 -42
- package/dist/packages/firestore/compat/util/input_validation.d.ts +0 -18
- package/dist/src/protos/README.md +0 -2
- package/dist/src/protos/firestore/bundle.proto +0 -121
- package/dist/src/protos/firestore_bundle_proto.ts +0 -93
- package/dist/src/protos/firestore_proto_api.ts +0 -1259
- package/dist/src/protos/google/api/annotations.proto +0 -31
- package/dist/src/protos/google/api/http.proto +0 -370
- package/dist/src/protos/google/firestore/v1/common.proto +0 -84
- package/dist/src/protos/google/firestore/v1/document.proto +0 -151
- package/dist/src/protos/google/firestore/v1/firestore.proto +0 -761
- package/dist/src/protos/google/firestore/v1/query.proto +0 -302
- package/dist/src/protos/google/firestore/v1/write.proto +0 -264
- package/dist/src/protos/google/protobuf/any.proto +0 -155
- package/dist/src/protos/google/protobuf/descriptor.proto +0 -882
- package/dist/src/protos/google/protobuf/empty.proto +0 -52
- package/dist/src/protos/google/protobuf/struct.proto +0 -96
- package/dist/src/protos/google/protobuf/timestamp.proto +0 -137
- package/dist/src/protos/google/protobuf/wrappers.proto +0 -123
- package/dist/src/protos/google/rpc/status.proto +0 -92
- package/dist/src/protos/google/type/latlng.proto +0 -71
- package/dist/src/protos/update.sh +0 -61
|
@@ -66,7 +66,7 @@ f.MOCK_USER = new f("mock-user");
|
|
|
66
66
|
* See the License for the specific language governing permissions and
|
|
67
67
|
* limitations under the License.
|
|
68
68
|
*/
|
|
69
|
-
let d = "9.6.
|
|
69
|
+
let d = "9.6.3";
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* @license
|
|
@@ -221,7 +221,7 @@ n) {
|
|
|
221
221
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
222
222
|
* See the License for the specific language governing permissions and
|
|
223
223
|
* limitations under the License.
|
|
224
|
-
*/ const T = "ok", I = "cancelled", A = "unknown",
|
|
224
|
+
*/ const T = "ok", I = "cancelled", A = "unknown", R = "invalid-argument", P = "deadline-exceeded", V = "not-found", N = "already-exists", D = "permission-denied", $ = "unauthenticated", S = "resource-exhausted", F = "failed-precondition", x = "aborted", q = "out-of-range", O = "unimplemented", C = "internal", L = "unavailable", k = "data-loss";
|
|
225
225
|
|
|
226
226
|
/** An error returned by a Firestore operation. */ class U extends c {
|
|
227
227
|
/** @hideconstructor */
|
|
@@ -570,7 +570,7 @@ class X {
|
|
|
570
570
|
// for legacy reasons and should not be used frequently).
|
|
571
571
|
const n = [];
|
|
572
572
|
for (const e of t) {
|
|
573
|
-
if (e.indexOf("//") >= 0) throw new U(
|
|
573
|
+
if (e.indexOf("//") >= 0) throw new U(R, `Invalid segment (${e}). Paths must not contain // in them.`);
|
|
574
574
|
// Strip leading and traling slashed.
|
|
575
575
|
n.push(...e.split("/").filter((t => t.length > 0)));
|
|
576
576
|
}
|
|
@@ -626,20 +626,20 @@ const tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
626
626
|
const n = [];
|
|
627
627
|
let e = "", r = 0;
|
|
628
628
|
const s = () => {
|
|
629
|
-
if (0 === e.length) throw new U(
|
|
629
|
+
if (0 === e.length) throw new U(R, `Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);
|
|
630
630
|
n.push(e), e = "";
|
|
631
631
|
};
|
|
632
632
|
let i = !1;
|
|
633
633
|
for (;r < t.length; ) {
|
|
634
634
|
const n = t[r];
|
|
635
635
|
if ("\\" === n) {
|
|
636
|
-
if (r + 1 === t.length) throw new U(
|
|
636
|
+
if (r + 1 === t.length) throw new U(R, "Path has trailing escape character: " + t);
|
|
637
637
|
const n = t[r + 1];
|
|
638
|
-
if ("\\" !== n && "." !== n && "`" !== n) throw new U(
|
|
638
|
+
if ("\\" !== n && "." !== n && "`" !== n) throw new U(R, "Path has invalid escape sequence: " + t);
|
|
639
639
|
e += n, r += 2;
|
|
640
640
|
} else "`" === n ? (i = !i, r++) : "." !== n || i ? (e += n, r++) : (s(), r++);
|
|
641
641
|
}
|
|
642
|
-
if (s(), i) throw new U(
|
|
642
|
+
if (s(), i) throw new U(R, "Unterminated ` in path: " + t);
|
|
643
643
|
return new nt(n);
|
|
644
644
|
}
|
|
645
645
|
static emptyPath() {
|
|
@@ -716,7 +716,7 @@ const tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
716
716
|
* See the License for the specific language governing permissions and
|
|
717
717
|
* limitations under the License.
|
|
718
718
|
*/ function rt(t, n, e) {
|
|
719
|
-
if (!e) throw new U(
|
|
719
|
+
if (!e) throw new U(R, `Function ${t}() cannot be called with an empty ${n}.`);
|
|
720
720
|
}
|
|
721
721
|
|
|
722
722
|
/**
|
|
@@ -728,14 +728,14 @@ const tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
728
728
|
* an even numbers of segments).
|
|
729
729
|
*/
|
|
730
730
|
function st(t) {
|
|
731
|
-
if (!et.isDocumentKey(t)) throw new U(
|
|
731
|
+
if (!et.isDocumentKey(t)) throw new U(R, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
|
|
732
732
|
}
|
|
733
733
|
|
|
734
734
|
/**
|
|
735
735
|
* Validates that `path` refers to a collection (indicated by the fact it
|
|
736
736
|
* contains an odd numbers of segments).
|
|
737
737
|
*/ function it(t) {
|
|
738
|
-
if (et.isDocumentKey(t)) throw new U(
|
|
738
|
+
if (et.isDocumentKey(t)) throw new U(R, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
|
|
739
739
|
}
|
|
740
740
|
|
|
741
741
|
/**
|
|
@@ -779,17 +779,17 @@ n) {
|
|
|
779
779
|
// Unwrap Compat types
|
|
780
780
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
781
781
|
t = t._delegate), !(t instanceof n)) {
|
|
782
|
-
if (n.name === t.constructor.name) throw new U(
|
|
782
|
+
if (n.name === t.constructor.name) throw new U(R, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
|
|
783
783
|
{
|
|
784
784
|
const e = ot(t);
|
|
785
|
-
throw new U(
|
|
785
|
+
throw new U(R, `Expected type '${n.name}', but it was: ${e}`);
|
|
786
786
|
}
|
|
787
787
|
}
|
|
788
788
|
return t;
|
|
789
789
|
}
|
|
790
790
|
|
|
791
791
|
function ct(t, n) {
|
|
792
|
-
if (n <= 0) throw new U(
|
|
792
|
+
if (n <= 0) throw new U(R, `Function ${t}() requires a positive number, but it was: ${n}.`);
|
|
793
793
|
}
|
|
794
794
|
|
|
795
795
|
/**
|
|
@@ -901,7 +901,7 @@ function wt(t) {
|
|
|
901
901
|
|
|
902
902
|
case 400:
|
|
903
903
|
// Bad Request
|
|
904
|
-
return
|
|
904
|
+
return F;
|
|
905
905
|
|
|
906
906
|
// Other possibilities based on the forward mapping
|
|
907
907
|
// return Code.INVALID_ARGUMENT;
|
|
@@ -930,7 +930,7 @@ function wt(t) {
|
|
|
930
930
|
|
|
931
931
|
case 429:
|
|
932
932
|
// Too Many Requests
|
|
933
|
-
return
|
|
933
|
+
return S;
|
|
934
934
|
|
|
935
935
|
case 499:
|
|
936
936
|
// Client Closed Request
|
|
@@ -953,10 +953,10 @@ function wt(t) {
|
|
|
953
953
|
|
|
954
954
|
case 504:
|
|
955
955
|
// Gateway Timeout
|
|
956
|
-
return
|
|
956
|
+
return P;
|
|
957
957
|
|
|
958
958
|
default:
|
|
959
|
-
return t >= 200 && t < 300 ? T : t >= 400 && t < 500 ?
|
|
959
|
+
return t >= 200 && t < 300 ? T : t >= 400 && t < 500 ? F : t >= 500 && t < 600 ? C : A;
|
|
960
960
|
}
|
|
961
961
|
}
|
|
962
962
|
|
|
@@ -1123,7 +1123,7 @@ function pt(t) {
|
|
|
1123
1123
|
* See the License for the specific language governing permissions and
|
|
1124
1124
|
* limitations under the License.
|
|
1125
1125
|
*/ class yt {
|
|
1126
|
-
static
|
|
1126
|
+
static R() {
|
|
1127
1127
|
// Alphanumeric characters
|
|
1128
1128
|
const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", n = Math.floor(256 / t.length) * t.length;
|
|
1129
1129
|
// The largest byte value that is a multiple of `char.length`.
|
|
@@ -1199,11 +1199,11 @@ class vt {
|
|
|
1199
1199
|
* The fractions of a second at nanosecond resolution.*
|
|
1200
1200
|
*/
|
|
1201
1201
|
n) {
|
|
1202
|
-
if (this.seconds = t, this.nanoseconds = n, n < 0) throw new U(
|
|
1203
|
-
if (n >= 1e9) throw new U(
|
|
1204
|
-
if (t < -62135596800) throw new U(
|
|
1202
|
+
if (this.seconds = t, this.nanoseconds = n, n < 0) throw new U(R, "Timestamp nanoseconds out of range: " + n);
|
|
1203
|
+
if (n >= 1e9) throw new U(R, "Timestamp nanoseconds out of range: " + n);
|
|
1204
|
+
if (t < -62135596800) throw new U(R, "Timestamp seconds out of range: " + t);
|
|
1205
1205
|
// This will break in the year 10,000.
|
|
1206
|
-
if (t >= 253402300800) throw new U(
|
|
1206
|
+
if (t >= 253402300800) throw new U(R, "Timestamp seconds out of range: " + t);
|
|
1207
1207
|
}
|
|
1208
1208
|
/**
|
|
1209
1209
|
* Creates a new timestamp with the current date, with millisecond precision.
|
|
@@ -1461,13 +1461,13 @@ function At(t) {
|
|
|
1461
1461
|
* before being sent as a proto.
|
|
1462
1462
|
* @internal
|
|
1463
1463
|
*/
|
|
1464
|
-
class
|
|
1464
|
+
class Rt {
|
|
1465
1465
|
constructor(t) {
|
|
1466
1466
|
this.binaryString = t;
|
|
1467
1467
|
}
|
|
1468
1468
|
static fromBase64String(t) {
|
|
1469
1469
|
const n = At(t);
|
|
1470
|
-
return new
|
|
1470
|
+
return new Rt(n);
|
|
1471
1471
|
}
|
|
1472
1472
|
static fromUint8Array(t) {
|
|
1473
1473
|
const n =
|
|
@@ -1482,7 +1482,7 @@ class Pt {
|
|
|
1482
1482
|
/**
|
|
1483
1483
|
* Helper function to convert a binary string to an Uint8Array.
|
|
1484
1484
|
*/ (t);
|
|
1485
|
-
return new
|
|
1485
|
+
return new Rt(n);
|
|
1486
1486
|
}
|
|
1487
1487
|
[Symbol.iterator]() {
|
|
1488
1488
|
let t = 0;
|
|
@@ -1539,9 +1539,9 @@ class Pt {
|
|
|
1539
1539
|
}
|
|
1540
1540
|
}
|
|
1541
1541
|
|
|
1542
|
-
|
|
1542
|
+
Rt.EMPTY_BYTE_STRING = new Rt("");
|
|
1543
1543
|
|
|
1544
|
-
const
|
|
1544
|
+
const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
1545
1545
|
|
|
1546
1546
|
/**
|
|
1547
1547
|
* Converts the possible Proto values for a timestamp value into a "seconds and
|
|
@@ -1555,7 +1555,7 @@ const Rt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1555
1555
|
// (millis), so we do some custom parsing here.
|
|
1556
1556
|
// Parse the nanos right out of the string.
|
|
1557
1557
|
let n = 0;
|
|
1558
|
-
const e =
|
|
1558
|
+
const e = Pt.exec(t);
|
|
1559
1559
|
if (b(!!e), e[1]) {
|
|
1560
1560
|
// Pad the fraction out to 9 digits (nanos).
|
|
1561
1561
|
let t = e[1];
|
|
@@ -1583,7 +1583,7 @@ const Rt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1583
1583
|
}
|
|
1584
1584
|
|
|
1585
1585
|
/** Converts the possible Proto types for Blobs into a ByteString. */ function Dt(t) {
|
|
1586
|
-
return "string" == typeof t ?
|
|
1586
|
+
return "string" == typeof t ? Rt.fromBase64String(t) : Rt.fromUint8Array(t);
|
|
1587
1587
|
}
|
|
1588
1588
|
|
|
1589
1589
|
/**
|
|
@@ -1629,14 +1629,14 @@ const Rt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1629
1629
|
*
|
|
1630
1630
|
* Preserving the previous values allows the user to display the last resoled
|
|
1631
1631
|
* value until the backend responds with the timestamp.
|
|
1632
|
-
*/ function
|
|
1632
|
+
*/ function St(t) {
|
|
1633
1633
|
const n = t.mapValue.fields.__previous_value__;
|
|
1634
|
-
return $t(n) ?
|
|
1634
|
+
return $t(n) ? St(n) : n;
|
|
1635
1635
|
}
|
|
1636
1636
|
|
|
1637
1637
|
/**
|
|
1638
1638
|
* Returns the local time at which this timestamp was first set.
|
|
1639
|
-
*/ function
|
|
1639
|
+
*/ function Ft(t) {
|
|
1640
1640
|
const n = Vt(t.mapValue.fields.__local_write_time__.timestampValue);
|
|
1641
1641
|
return new vt(n.seconds, n.nanos);
|
|
1642
1642
|
}
|
|
@@ -1673,7 +1673,7 @@ const Rt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1673
1673
|
return t.booleanValue === n.booleanValue;
|
|
1674
1674
|
|
|
1675
1675
|
case 4 /* ServerTimestampValue */ :
|
|
1676
|
-
return
|
|
1676
|
+
return Ft(t).isEqual(Ft(n));
|
|
1677
1677
|
|
|
1678
1678
|
case 3 /* TimestampValue */ :
|
|
1679
1679
|
return function(t, n) {
|
|
@@ -1754,7 +1754,7 @@ function Ct(t, n) {
|
|
|
1754
1754
|
return Lt(t.timestampValue, n.timestampValue);
|
|
1755
1755
|
|
|
1756
1756
|
case 4 /* ServerTimestampValue */ :
|
|
1757
|
-
return Lt(
|
|
1757
|
+
return Lt(Ft(t), Ft(n));
|
|
1758
1758
|
|
|
1759
1759
|
case 5 /* StringValue */ :
|
|
1760
1760
|
return _t(t.stringValue, n.stringValue);
|
|
@@ -2110,7 +2110,7 @@ function kt(t, n) {
|
|
|
2110
2110
|
class Wt {
|
|
2111
2111
|
constructor(t, n = null, e = [], r = [], s = null, i = null, o = null) {
|
|
2112
2112
|
this.path = t, this.collectionGroup = n, this.orderBy = e, this.filters = r, this.limit = s,
|
|
2113
|
-
this.startAt = i, this.endAt = o, this.
|
|
2113
|
+
this.startAt = i, this.endAt = o, this.P = null;
|
|
2114
2114
|
}
|
|
2115
2115
|
}
|
|
2116
2116
|
|
|
@@ -2321,7 +2321,7 @@ function cn(t, n) {
|
|
|
2321
2321
|
this.path = t, this.collectionGroup = n, this.explicitOrderBy = e, this.filters = r,
|
|
2322
2322
|
this.limit = s, this.limitType = i, this.startAt = o, this.endAt = u, this.$ = null,
|
|
2323
2323
|
// The corresponding `Target` of this `Query` instance.
|
|
2324
|
-
this.
|
|
2324
|
+
this.S = null, this.startAt, this.endAt;
|
|
2325
2325
|
}
|
|
2326
2326
|
}
|
|
2327
2327
|
|
|
@@ -2381,7 +2381,7 @@ function dn(t) {
|
|
|
2381
2381
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
2382
2382
|
*/ function mn(t) {
|
|
2383
2383
|
const n = E(t);
|
|
2384
|
-
if (!n.
|
|
2384
|
+
if (!n.S) if ("F" /* First */ === n.limitType) n.S = Yt(n.path, n.collectionGroup, wn(n), n.filters, n.limit, n.startAt, n.endAt); else {
|
|
2385
2385
|
// Flip the orderBy directions since we want the last results
|
|
2386
2386
|
const t = [];
|
|
2387
2387
|
for (const e of wn(n)) {
|
|
@@ -2391,9 +2391,9 @@ function dn(t) {
|
|
|
2391
2391
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
2392
2392
|
const e = n.endAt ? new sn(n.endAt.position, !n.endAt.before) : null, r = n.startAt ? new sn(n.startAt.position, !n.startAt.before) : null;
|
|
2393
2393
|
// Now return as a LimitType.First query.
|
|
2394
|
-
n.
|
|
2394
|
+
n.S = Yt(n.path, n.collectionGroup, t, n.filters, n.limit, e, r);
|
|
2395
2395
|
}
|
|
2396
|
-
return n.
|
|
2396
|
+
return n.S;
|
|
2397
2397
|
}
|
|
2398
2398
|
|
|
2399
2399
|
function pn(t, n) {
|
|
@@ -2446,7 +2446,7 @@ function yn(t, n) {
|
|
|
2446
2446
|
integerValue: "" + t
|
|
2447
2447
|
};
|
|
2448
2448
|
}(n) : function(t, n) {
|
|
2449
|
-
if (t.
|
|
2449
|
+
if (t.F) {
|
|
2450
2450
|
if (isNaN(n)) return {
|
|
2451
2451
|
doubleValue: "NaN"
|
|
2452
2452
|
};
|
|
@@ -2607,7 +2607,7 @@ function yn(t, n) {
|
|
|
2607
2607
|
/**
|
|
2608
2608
|
* A mutation that creates or replaces the document at the given key with the
|
|
2609
2609
|
* object value contents.
|
|
2610
|
-
*/ class
|
|
2610
|
+
*/ class Rn extends An {
|
|
2611
2611
|
constructor(t, n, e, r = []) {
|
|
2612
2612
|
super(), this.key = t, this.value = n, this.precondition = e, this.fieldTransforms = r,
|
|
2613
2613
|
this.type = 0 /* Set */;
|
|
@@ -2626,7 +2626,7 @@ function yn(t, n) {
|
|
|
2626
2626
|
* is deleted.
|
|
2627
2627
|
* * When a field is not in the mask but is in the values, the values map is
|
|
2628
2628
|
* ignored.
|
|
2629
|
-
*/ class
|
|
2629
|
+
*/ class Pn extends An {
|
|
2630
2630
|
constructor(t, n, e, r, s = []) {
|
|
2631
2631
|
super(), this.key = t, this.data = n, this.fieldMask = e, this.precondition = r,
|
|
2632
2632
|
this.fieldTransforms = s, this.type = 1 /* Patch */;
|
|
@@ -2702,9 +2702,9 @@ function yn(t, n) {
|
|
|
2702
2702
|
* TODO(klimt): We can remove the databaseId argument if we keep the full
|
|
2703
2703
|
* resource name in documents.
|
|
2704
2704
|
*/
|
|
2705
|
-
class
|
|
2705
|
+
class Sn {
|
|
2706
2706
|
constructor(t, n) {
|
|
2707
|
-
this.databaseId = t, this.
|
|
2707
|
+
this.databaseId = t, this.F = n;
|
|
2708
2708
|
}
|
|
2709
2709
|
}
|
|
2710
2710
|
|
|
@@ -2719,8 +2719,8 @@ class Fn {
|
|
|
2719
2719
|
/**
|
|
2720
2720
|
* Returns a value for a Date that's appropriate to put into a proto.
|
|
2721
2721
|
*/
|
|
2722
|
-
function
|
|
2723
|
-
if (t.
|
|
2722
|
+
function Fn(t, n) {
|
|
2723
|
+
if (t.F) {
|
|
2724
2724
|
return `${new Date(1e3 * n.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "")}.${("000000000" + n.nanoseconds).slice(-9)}Z`;
|
|
2725
2725
|
}
|
|
2726
2726
|
return {
|
|
@@ -2735,11 +2735,11 @@ function Sn(t, n) {
|
|
|
2735
2735
|
* Visible for testing.
|
|
2736
2736
|
*/
|
|
2737
2737
|
function xn(t, n) {
|
|
2738
|
-
return t.
|
|
2738
|
+
return t.F ? n.toBase64() : n.toUint8Array();
|
|
2739
2739
|
}
|
|
2740
2740
|
|
|
2741
2741
|
function qn(t, n) {
|
|
2742
|
-
return
|
|
2742
|
+
return Fn(t, n.toTimestamp());
|
|
2743
2743
|
}
|
|
2744
2744
|
|
|
2745
2745
|
function On(t) {
|
|
@@ -2764,8 +2764,8 @@ function kn(t, n) {
|
|
|
2764
2764
|
const n = Z.fromString(t);
|
|
2765
2765
|
return b(Jn(n)), n;
|
|
2766
2766
|
}(n);
|
|
2767
|
-
if (e.get(1) !== t.databaseId.projectId) throw new U(
|
|
2768
|
-
if (e.get(3) !== t.databaseId.database) throw new U(
|
|
2767
|
+
if (e.get(1) !== t.databaseId.projectId) throw new U(R, "Tried to deserialize key from different project: " + e.get(1) + " vs " + t.databaseId.projectId);
|
|
2768
|
+
if (e.get(3) !== t.databaseId.database) throw new U(R, "Tried to deserialize key from different database: " + e.get(3) + " vs " + t.databaseId.database);
|
|
2769
2769
|
return new et((b((r = e).length > 4 && "documents" === r.get(4)), r.popFirst(5)));
|
|
2770
2770
|
var r;
|
|
2771
2771
|
/** Creates a Document proto from key and fields (but no create/update time) */}
|
|
@@ -2803,11 +2803,11 @@ function Bn(t, n) {
|
|
|
2803
2803
|
|
|
2804
2804
|
function zn(t, n) {
|
|
2805
2805
|
let e;
|
|
2806
|
-
if (n instanceof
|
|
2806
|
+
if (n instanceof Rn) e = {
|
|
2807
2807
|
update: Mn(t, n.key, n.value)
|
|
2808
2808
|
}; else if (n instanceof Vn) e = {
|
|
2809
2809
|
delete: Ln(t, n.key)
|
|
2810
|
-
}; else if (n instanceof
|
|
2810
|
+
}; else if (n instanceof Pn) e = {
|
|
2811
2811
|
update: Mn(t, n.key, n.data),
|
|
2812
2812
|
updateMask: Kn(n.fieldMask)
|
|
2813
2813
|
}; else {
|
|
@@ -2921,7 +2921,7 @@ function Qn(t, n) {
|
|
|
2921
2921
|
}(n.orderBy);
|
|
2922
2922
|
i && (e.structuredQuery.orderBy = i);
|
|
2923
2923
|
const o = function(t, n) {
|
|
2924
|
-
return t.
|
|
2924
|
+
return t.F || at(n) ? n : {
|
|
2925
2925
|
value: n
|
|
2926
2926
|
};
|
|
2927
2927
|
}(t, n.limit);
|
|
@@ -2980,7 +2980,7 @@ function Jn(t) {
|
|
|
2980
2980
|
* See the License for the specific language governing permissions and
|
|
2981
2981
|
* limitations under the License.
|
|
2982
2982
|
*/ function Xn(t) {
|
|
2983
|
-
return new
|
|
2983
|
+
return new Sn(t, /* useProto3Json= */ !0);
|
|
2984
2984
|
}
|
|
2985
2985
|
|
|
2986
2986
|
/**
|
|
@@ -3112,7 +3112,7 @@ class te extends class {} {
|
|
|
3112
3112
|
this.J = !1;
|
|
3113
3113
|
}
|
|
3114
3114
|
X() {
|
|
3115
|
-
if (this.J) throw new U(
|
|
3115
|
+
if (this.J) throw new U(F, "The client has already been terminated.");
|
|
3116
3116
|
}
|
|
3117
3117
|
/** Invokes the provided RPC with auth and AppCheck tokens. */ m(t, n, e) {
|
|
3118
3118
|
return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.K.m(t, n, e, r, s))).catch((t => {
|
|
@@ -3196,7 +3196,7 @@ async function re(t, n) {
|
|
|
3196
3196
|
* instance is terminated.
|
|
3197
3197
|
*/
|
|
3198
3198
|
function ie(t) {
|
|
3199
|
-
if (t._terminated) throw new U(
|
|
3199
|
+
if (t._terminated) throw new U(F, "The client has already been terminated.");
|
|
3200
3200
|
if (!se.has(t)) {
|
|
3201
3201
|
p("ComponentProvider", "Initializing Datastore");
|
|
3202
3202
|
const i = function(t) {
|
|
@@ -3239,17 +3239,17 @@ class oe {
|
|
|
3239
3239
|
constructor(t) {
|
|
3240
3240
|
var n;
|
|
3241
3241
|
if (void 0 === t.host) {
|
|
3242
|
-
if (void 0 !== t.ssl) throw new U(
|
|
3242
|
+
if (void 0 !== t.ssl) throw new U(R, "Can't provide ssl option if host option is not set");
|
|
3243
3243
|
this.host = "firestore.googleapis.com", this.ssl = true;
|
|
3244
3244
|
} else this.host = t.host, this.ssl = null === (n = t.ssl) || void 0 === n || n;
|
|
3245
3245
|
if (this.credentials = t.credentials, this.ignoreUndefinedProperties = !!t.ignoreUndefinedProperties,
|
|
3246
3246
|
void 0 === t.cacheSizeBytes) this.cacheSizeBytes = 41943040; else {
|
|
3247
|
-
if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new U(
|
|
3247
|
+
if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new U(R, "cacheSizeBytes must be at least 1048576");
|
|
3248
3248
|
this.cacheSizeBytes = t.cacheSizeBytes;
|
|
3249
3249
|
}
|
|
3250
3250
|
this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
|
|
3251
3251
|
this.useFetchStreams = !!t.useFetchStreams, function(t, n, e, r) {
|
|
3252
|
-
if (!0 === n && !0 === r) throw new U(
|
|
3252
|
+
if (!0 === n && !0 === r) throw new U(R, `${t} and ${e} cannot be used together.`);
|
|
3253
3253
|
}("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling);
|
|
3254
3254
|
}
|
|
3255
3255
|
isEqual(t) {
|
|
@@ -3287,7 +3287,7 @@ class oe {
|
|
|
3287
3287
|
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new oe({}),
|
|
3288
3288
|
this._settingsFrozen = !1, t instanceof J ? this._databaseId = t : (this._app = t,
|
|
3289
3289
|
this._databaseId = function(t) {
|
|
3290
|
-
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new U(
|
|
3290
|
+
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new U(R, '"projectId" not provided in firebase.initializeApp.');
|
|
3291
3291
|
return new J(t.options.projectId);
|
|
3292
3292
|
}
|
|
3293
3293
|
/**
|
|
@@ -3306,7 +3306,7 @@ class oe {
|
|
|
3306
3306
|
* The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
|
|
3307
3307
|
* instance.
|
|
3308
3308
|
*/ get app() {
|
|
3309
|
-
if (!this._app) throw new U(
|
|
3309
|
+
if (!this._app) throw new U(F, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
|
|
3310
3310
|
return this._app;
|
|
3311
3311
|
}
|
|
3312
3312
|
get _initialized() {
|
|
@@ -3316,7 +3316,7 @@ class oe {
|
|
|
3316
3316
|
return void 0 !== this._terminateTask;
|
|
3317
3317
|
}
|
|
3318
3318
|
_setSettings(t) {
|
|
3319
|
-
if (this._settingsFrozen) throw new U(
|
|
3319
|
+
if (this._settingsFrozen) throw new U(F, "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.");
|
|
3320
3320
|
this._settings = new oe(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
3321
3321
|
if (!t) return new B;
|
|
3322
3322
|
switch (t.type) {
|
|
@@ -3330,7 +3330,7 @@ class oe {
|
|
|
3330
3330
|
return t.client;
|
|
3331
3331
|
|
|
3332
3332
|
default:
|
|
3333
|
-
throw new U(
|
|
3333
|
+
throw new U(R, "makeAuthCredentialsProvider failed due to invalid credential type");
|
|
3334
3334
|
}
|
|
3335
3335
|
}(t.credentials));
|
|
3336
3336
|
}
|
|
@@ -3366,7 +3366,7 @@ class oe {
|
|
|
3366
3366
|
|
|
3367
3367
|
function ce(t, n) {
|
|
3368
3368
|
const e = _getProvider(t, "firestore/lite");
|
|
3369
|
-
if (e.isInitialized()) throw new U(
|
|
3369
|
+
if (e.isInitialized()) throw new U(F, "Firestore can only be initialized once per app.");
|
|
3370
3370
|
return e.initialize({
|
|
3371
3371
|
options: n
|
|
3372
3372
|
});
|
|
@@ -3410,7 +3410,7 @@ function ce(t, n) {
|
|
|
3410
3410
|
// invalid field "uid" and missing field "sub" / "user_id".)
|
|
3411
3411
|
n = h(r.mockUserToken, null === (s = t._app) || void 0 === s ? void 0 : s.options.projectId);
|
|
3412
3412
|
const i = r.mockUserToken.sub || r.mockUserToken.user_id;
|
|
3413
|
-
if (!i) throw new U(
|
|
3413
|
+
if (!i) throw new U(R, "mockUserToken must contain 'sub' or 'user_id' field!");
|
|
3414
3414
|
e = new f(i);
|
|
3415
3415
|
}
|
|
3416
3416
|
t._authCredentials = new z(new M(n, e));
|
|
@@ -3570,7 +3570,7 @@ function me(t, n, ...e) {
|
|
|
3570
3570
|
return it(r), new we(t, /* converter= */ null, r);
|
|
3571
3571
|
}
|
|
3572
3572
|
{
|
|
3573
|
-
if (!(t instanceof fe || t instanceof we)) throw new U(
|
|
3573
|
+
if (!(t instanceof fe || t instanceof we)) throw new U(R, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3574
3574
|
const r = t._path.child(Z.fromString(n, ...e));
|
|
3575
3575
|
return it(r), new we(t.firestore,
|
|
3576
3576
|
/* converter= */ null, r);
|
|
@@ -3590,7 +3590,7 @@ function me(t, n, ...e) {
|
|
|
3590
3590
|
* will be included. Cannot contain a slash.
|
|
3591
3591
|
* @returns The created `Query`.
|
|
3592
3592
|
*/ function pe(t, n) {
|
|
3593
|
-
if (t = ut(t, ue), rt("collectionGroup", "collection id", n), n.indexOf("/") >= 0) throw new U(
|
|
3593
|
+
if (t = ut(t, ue), rt("collectionGroup", "collection id", n), n.indexOf("/") >= 0) throw new U(R, `Invalid collection ID '${n}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
3594
3594
|
return new de(t,
|
|
3595
3595
|
/* converter= */ null,
|
|
3596
3596
|
/**
|
|
@@ -3606,13 +3606,13 @@ function ye(t, n, ...e) {
|
|
|
3606
3606
|
if (t = l(t),
|
|
3607
3607
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
3608
3608
|
// 'undefined' and 'null'.
|
|
3609
|
-
1 === arguments.length && (n = yt.
|
|
3609
|
+
1 === arguments.length && (n = yt.R()), rt("doc", "path", n), t instanceof ue) {
|
|
3610
3610
|
const r = Z.fromString(n, ...e);
|
|
3611
3611
|
return st(r), new fe(t,
|
|
3612
3612
|
/* converter= */ null, new et(r));
|
|
3613
3613
|
}
|
|
3614
3614
|
{
|
|
3615
|
-
if (!(t instanceof fe || t instanceof we)) throw new U(
|
|
3615
|
+
if (!(t instanceof fe || t instanceof we)) throw new U(R, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3616
3616
|
const r = t._path.child(Z.fromString(n, ...e));
|
|
3617
3617
|
return st(r), new fe(t.firestore, t instanceof we ? t.converter : null, new et(r));
|
|
3618
3618
|
}
|
|
@@ -3672,7 +3672,7 @@ function ye(t, n, ...e) {
|
|
|
3672
3672
|
* @param fieldNames - A list of field names.
|
|
3673
3673
|
*/
|
|
3674
3674
|
constructor(...t) {
|
|
3675
|
-
for (let n = 0; n < t.length; ++n) if (0 === t[n].length) throw new U(
|
|
3675
|
+
for (let n = 0; n < t.length; ++n) if (0 === t[n].length) throw new U(R, "Invalid field name at argument $(i + 1). Field names must not be empty.");
|
|
3676
3676
|
this._internalPath = new nt(t);
|
|
3677
3677
|
}
|
|
3678
3678
|
/**
|
|
@@ -3722,9 +3722,9 @@ function ye(t, n, ...e) {
|
|
|
3722
3722
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
3723
3723
|
*/ static fromBase64String(t) {
|
|
3724
3724
|
try {
|
|
3725
|
-
return new Ee(
|
|
3725
|
+
return new Ee(Rt.fromBase64String(t));
|
|
3726
3726
|
} catch (t) {
|
|
3727
|
-
throw new U(
|
|
3727
|
+
throw new U(R, "Failed to construct data from Base64 string: " + t);
|
|
3728
3728
|
}
|
|
3729
3729
|
}
|
|
3730
3730
|
/**
|
|
@@ -3732,7 +3732,7 @@ function ye(t, n, ...e) {
|
|
|
3732
3732
|
*
|
|
3733
3733
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
3734
3734
|
*/ static fromUint8Array(t) {
|
|
3735
|
-
return new Ee(
|
|
3735
|
+
return new Ee(Rt.fromUint8Array(t));
|
|
3736
3736
|
}
|
|
3737
3737
|
/**
|
|
3738
3738
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -3824,8 +3824,8 @@ function ye(t, n, ...e) {
|
|
|
3824
3824
|
* @param longitude - The longitude as number between -180 and 180.
|
|
3825
3825
|
*/
|
|
3826
3826
|
constructor(t, n) {
|
|
3827
|
-
if (!isFinite(t) || t < -90 || t > 90) throw new U(
|
|
3828
|
-
if (!isFinite(n) || n < -180 || n > 180) throw new U(
|
|
3827
|
+
if (!isFinite(t) || t < -90 || t > 90) throw new U(R, "Latitude must be a number between -90 and 90, but was: " + t);
|
|
3828
|
+
if (!isFinite(n) || n < -180 || n > 180) throw new U(R, "Longitude must be a number between -180 and 180, but was: " + n);
|
|
3829
3829
|
this._lat = t, this._long = n;
|
|
3830
3830
|
}
|
|
3831
3831
|
/**
|
|
@@ -3877,23 +3877,23 @@ function ye(t, n, ...e) {
|
|
|
3877
3877
|
* limitations under the License.
|
|
3878
3878
|
*/ const Ae = /^__.*__$/;
|
|
3879
3879
|
|
|
3880
|
-
/** The result of parsing document data (e.g. for a setData call). */ class
|
|
3880
|
+
/** The result of parsing document data (e.g. for a setData call). */ class Re {
|
|
3881
3881
|
constructor(t, n, e) {
|
|
3882
3882
|
this.data = t, this.fieldMask = n, this.fieldTransforms = e;
|
|
3883
3883
|
}
|
|
3884
3884
|
toMutation(t, n) {
|
|
3885
|
-
return null !== this.fieldMask ? new
|
|
3885
|
+
return null !== this.fieldMask ? new Pn(t, this.data, this.fieldMask, n, this.fieldTransforms) : new Rn(t, this.data, n, this.fieldTransforms);
|
|
3886
3886
|
}
|
|
3887
3887
|
}
|
|
3888
3888
|
|
|
3889
|
-
/** The result of parsing "update" data (i.e. for an updateData call). */ class
|
|
3889
|
+
/** The result of parsing "update" data (i.e. for an updateData call). */ class Pe {
|
|
3890
3890
|
constructor(t,
|
|
3891
3891
|
// The fieldMask does not include document transforms.
|
|
3892
3892
|
n, e) {
|
|
3893
3893
|
this.data = t, this.fieldMask = n, this.fieldTransforms = e;
|
|
3894
3894
|
}
|
|
3895
3895
|
toMutation(t, n) {
|
|
3896
|
-
return new
|
|
3896
|
+
return new Pn(t, this.data, this.fieldMask, n, this.fieldTransforms);
|
|
3897
3897
|
}
|
|
3898
3898
|
}
|
|
3899
3899
|
|
|
@@ -4014,7 +4014,7 @@ function $e(t) {
|
|
|
4014
4014
|
return new De(t._databaseId, !!n.ignoreUndefinedProperties, e);
|
|
4015
4015
|
}
|
|
4016
4016
|
|
|
4017
|
-
/** Parse document data from a set() call. */ function
|
|
4017
|
+
/** Parse document data from a set() call. */ function Se(t, n, e, r, s, i = {}) {
|
|
4018
4018
|
const o = t.ht(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , n, e, s);
|
|
4019
4019
|
Qe("Data must be an object, but it was:", o, r);
|
|
4020
4020
|
const u = Be(r, o);
|
|
@@ -4023,15 +4023,15 @@ function $e(t) {
|
|
|
4023
4023
|
const t = [];
|
|
4024
4024
|
for (const r of i.mergeFields) {
|
|
4025
4025
|
const s = Ge(n, r, e);
|
|
4026
|
-
if (!o.contains(s)) throw new U(
|
|
4026
|
+
if (!o.contains(s)) throw new U(R, `Field '${s}' is specified in your field mask but missing from your input data.`);
|
|
4027
4027
|
Ke(t, s) || t.push(s);
|
|
4028
4028
|
}
|
|
4029
4029
|
c = new It(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
|
|
4030
4030
|
} else c = null, a = o.fieldTransforms;
|
|
4031
|
-
return new
|
|
4031
|
+
return new Re(new Qt(u), c, a);
|
|
4032
4032
|
}
|
|
4033
4033
|
|
|
4034
|
-
class
|
|
4034
|
+
class Fe extends Te {
|
|
4035
4035
|
_toFieldTransform(t) {
|
|
4036
4036
|
if (2 /* MergeSet */ !== t.tt) throw 1 /* Update */ === t.tt ? t.ut(`${this._methodName}() can only appear at the top level of your update data`) : t.ut(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
|
|
4037
4037
|
// No transform to add for a delete, but we need to add it to our
|
|
@@ -4039,7 +4039,7 @@ class Se extends Te {
|
|
|
4039
4039
|
return t.fieldMask.push(t.path), null;
|
|
4040
4040
|
}
|
|
4041
4041
|
isEqual(t) {
|
|
4042
|
-
return t instanceof
|
|
4042
|
+
return t instanceof Fe;
|
|
4043
4043
|
}
|
|
4044
4044
|
}
|
|
4045
4045
|
|
|
@@ -4130,7 +4130,7 @@ class Le extends Te {
|
|
|
4130
4130
|
// performing validation.
|
|
4131
4131
|
r = l(r);
|
|
4132
4132
|
const c = s.it(u);
|
|
4133
|
-
if (r instanceof
|
|
4133
|
+
if (r instanceof Fe)
|
|
4134
4134
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4135
4135
|
i.push(u); else {
|
|
4136
4136
|
const t = Me(r, c);
|
|
@@ -4138,12 +4138,12 @@ class Le extends Te {
|
|
|
4138
4138
|
}
|
|
4139
4139
|
}));
|
|
4140
4140
|
const u = new It(i);
|
|
4141
|
-
return new
|
|
4141
|
+
return new Pe(o, u, s.fieldTransforms);
|
|
4142
4142
|
}
|
|
4143
4143
|
|
|
4144
4144
|
/** Parse update data from a list of field/value arguments. */ function Ue(t, n, e, r, s, i) {
|
|
4145
4145
|
const o = t.ht(1 /* Update */ , n, e), u = [ Ge(n, r, e) ], c = [ s ];
|
|
4146
|
-
if (i.length % 2 != 0) throw new U(
|
|
4146
|
+
if (i.length % 2 != 0) throw new U(R, `Function ${n}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
4147
4147
|
for (let t = 0; t < i.length; t += 2) u.push(Ge(n, i[t])), c.push(i[t + 1]);
|
|
4148
4148
|
const a = [], h = Qt.empty();
|
|
4149
4149
|
// We iterate in reverse order to pick the last value for a field if the
|
|
@@ -4155,7 +4155,7 @@ class Le extends Te {
|
|
|
4155
4155
|
// performing validation.
|
|
4156
4156
|
e = l(e);
|
|
4157
4157
|
const r = o.it(n);
|
|
4158
|
-
if (e instanceof
|
|
4158
|
+
if (e instanceof Fe)
|
|
4159
4159
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4160
4160
|
a.push(n); else {
|
|
4161
4161
|
const t = Me(e, r);
|
|
@@ -4163,7 +4163,7 @@ class Le extends Te {
|
|
|
4163
4163
|
}
|
|
4164
4164
|
}
|
|
4165
4165
|
const f = new It(a);
|
|
4166
|
-
return new
|
|
4166
|
+
return new Pe(h, f, o.fieldTransforms);
|
|
4167
4167
|
}
|
|
4168
4168
|
|
|
4169
4169
|
/**
|
|
@@ -4190,7 +4190,7 @@ class Le extends Te {
|
|
|
4190
4190
|
// from firestore-exp.
|
|
4191
4191
|
t = l(t))) return Qe("Unsupported field value:", n, t), Be(t, n);
|
|
4192
4192
|
if (t instanceof Te)
|
|
4193
|
-
// FieldValues usually parse into transforms (except
|
|
4193
|
+
// FieldValues usually parse into transforms (except deleteField())
|
|
4194
4194
|
// in which case we do not want to include this field in our parsed data
|
|
4195
4195
|
// (as doing so will overwrite the field directly prior to the transform
|
|
4196
4196
|
// trying to transform it). So we don't add this location to
|
|
@@ -4260,7 +4260,7 @@ class Le extends Te {
|
|
|
4260
4260
|
if (t instanceof Date) {
|
|
4261
4261
|
const e = vt.fromDate(t);
|
|
4262
4262
|
return {
|
|
4263
|
-
timestampValue:
|
|
4263
|
+
timestampValue: Fn(n.q, e)
|
|
4264
4264
|
};
|
|
4265
4265
|
}
|
|
4266
4266
|
if (t instanceof vt) {
|
|
@@ -4269,7 +4269,7 @@ class Le extends Te {
|
|
|
4269
4269
|
// truncation immediately without waiting for the backend to do that.
|
|
4270
4270
|
const e = new vt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
4271
4271
|
return {
|
|
4272
|
-
timestampValue:
|
|
4272
|
+
timestampValue: Fn(n.q, e)
|
|
4273
4273
|
};
|
|
4274
4274
|
}
|
|
4275
4275
|
if (t instanceof Ie) return {
|
|
@@ -4338,7 +4338,7 @@ function Qe(t, n, e) {
|
|
|
4338
4338
|
// FieldPath.
|
|
4339
4339
|
n = l(n)) instanceof ve) return n._internalPath;
|
|
4340
4340
|
if ("string" == typeof n) return Ye(t, n);
|
|
4341
|
-
throw He("Field path arguments must be of type string or
|
|
4341
|
+
throw He("Field path arguments must be of type string or ", t,
|
|
4342
4342
|
/* hasConverter= */ !1,
|
|
4343
4343
|
/* path= */ void 0, e);
|
|
4344
4344
|
}
|
|
@@ -4374,7 +4374,7 @@ function He(t, n, e, r, s) {
|
|
|
4374
4374
|
e && (u += " (via `toFirestore()`)"), u += ". ";
|
|
4375
4375
|
let c = "";
|
|
4376
4376
|
return (i || o) && (c += " (found", i && (c += ` in field ${r}`), o && (c += ` in document ${s}`),
|
|
4377
|
-
c += ")"), new U(
|
|
4377
|
+
c += ")"), new U(R, u + t + c);
|
|
4378
4378
|
}
|
|
4379
4379
|
|
|
4380
4380
|
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function Ke(t, n) {
|
|
@@ -4583,7 +4583,7 @@ class sr extends er {
|
|
|
4583
4583
|
const n = $e(t.firestore), e = function(t, n, e, r, s, i, o) {
|
|
4584
4584
|
let u;
|
|
4585
4585
|
if (s.isKeyField()) {
|
|
4586
|
-
if ("array-contains" /* ARRAY_CONTAINS */ === i || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === i) throw new U(
|
|
4586
|
+
if ("array-contains" /* ARRAY_CONTAINS */ === i || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === i) throw new U(R, `Invalid Query. You can't perform '${i}' queries on documentId().`);
|
|
4587
4587
|
if ("in" /* IN */ === i || "not-in" /* NOT_IN */ === i) {
|
|
4588
4588
|
gr(o, i);
|
|
4589
4589
|
const n = [];
|
|
@@ -4601,7 +4601,7 @@ class sr extends er {
|
|
|
4601
4601
|
return function(t, n) {
|
|
4602
4602
|
if (n.D()) {
|
|
4603
4603
|
const e = fn(t);
|
|
4604
|
-
if (null !== e && !e.isEqual(n.field)) throw new U(
|
|
4604
|
+
if (null !== e && !e.isEqual(n.field)) throw new U(R, `Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${e.toString()}' and '${n.field.toString()}'`);
|
|
4605
4605
|
const r = ln(t);
|
|
4606
4606
|
null !== r && vr(t, n.field, r);
|
|
4607
4607
|
}
|
|
@@ -4644,7 +4644,7 @@ class sr extends er {
|
|
|
4644
4644
|
}(n.op));
|
|
4645
4645
|
if (null !== e)
|
|
4646
4646
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
4647
|
-
throw e === n.op ? new U(
|
|
4647
|
+
throw e === n.op ? new U(R, `Invalid query. You cannot use more than one '${n.op.toString()}' filter.`) : new U(R, `Invalid query. You cannot use '${n.op.toString()}' filters with '${e.toString()}' filters.`);
|
|
4648
4648
|
}(t, c), c;
|
|
4649
4649
|
}(t._query, "where", n, t.firestore._databaseId, this.dt, this.wt, this.yt);
|
|
4650
4650
|
return new de(t.firestore, t.converter, function(t, n) {
|
|
@@ -4675,8 +4675,8 @@ class or extends er {
|
|
|
4675
4675
|
}
|
|
4676
4676
|
_apply(t) {
|
|
4677
4677
|
const n = function(t, n, e) {
|
|
4678
|
-
if (null !== t.startAt) throw new U(
|
|
4679
|
-
if (null !== t.endAt) throw new U(
|
|
4678
|
+
if (null !== t.startAt) throw new U(R, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
|
|
4679
|
+
if (null !== t.endAt) throw new U(R, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
4680
4680
|
const r = new on(n, e);
|
|
4681
4681
|
return function(t, n) {
|
|
4682
4682
|
if (null === ln(t)) {
|
|
@@ -4804,10 +4804,10 @@ function pr(...t) {
|
|
|
4804
4804
|
// results.
|
|
4805
4805
|
for (const e of wn(t)) if (e.field.isKeyField()) i.push(kt(n, r.key)); else {
|
|
4806
4806
|
const t = r.data.field(e.field);
|
|
4807
|
-
if ($t(t)) throw new U(
|
|
4807
|
+
if ($t(t)) throw new U(R, 'Invalid query. You are trying to start or end a query using a document for which the field "' + e.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
|
|
4808
4808
|
if (null === t) {
|
|
4809
4809
|
const t = e.field.canonicalString();
|
|
4810
|
-
throw new U(
|
|
4810
|
+
throw new U(R, `Invalid query. You are trying to start or end a query using a document for which the field '${t}' (used as the orderBy) does not exist.`);
|
|
4811
4811
|
}
|
|
4812
4812
|
i.push(t);
|
|
4813
4813
|
}
|
|
@@ -4821,15 +4821,15 @@ function pr(...t) {
|
|
|
4821
4821
|
return function(t, n, e, r, s, i) {
|
|
4822
4822
|
// Use explicit order by's because it has to match the query the user made
|
|
4823
4823
|
const o = t.explicitOrderBy;
|
|
4824
|
-
if (s.length > o.length) throw new U(
|
|
4824
|
+
if (s.length > o.length) throw new U(R, `Too many arguments provided to ${r}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
|
|
4825
4825
|
const u = [];
|
|
4826
4826
|
for (let i = 0; i < s.length; i++) {
|
|
4827
4827
|
const c = s[i];
|
|
4828
4828
|
if (o[i].field.isKeyField()) {
|
|
4829
|
-
if ("string" != typeof c) throw new U(
|
|
4830
|
-
if (!dn(t) && -1 !== c.indexOf("/")) throw new U(
|
|
4829
|
+
if ("string" != typeof c) throw new U(R, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof c}`);
|
|
4830
|
+
if (!dn(t) && -1 !== c.indexOf("/")) throw new U(R, `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.`);
|
|
4831
4831
|
const e = t.path.child(Z.fromString(c));
|
|
4832
|
-
if (!et.isDocumentKey(e)) throw new U(
|
|
4832
|
+
if (!et.isDocumentKey(e)) throw new U(R, `Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${r}() must result in a valid document path, but '${e}' is not because it contains an odd number of segments.`);
|
|
4833
4833
|
const s = new et(e);
|
|
4834
4834
|
u.push(kt(n, s));
|
|
4835
4835
|
} else {
|
|
@@ -4849,26 +4849,26 @@ function pr(...t) {
|
|
|
4849
4849
|
|
|
4850
4850
|
function _r(t, n, e) {
|
|
4851
4851
|
if ("string" == typeof (e = l(e))) {
|
|
4852
|
-
if ("" === e) throw new U(
|
|
4853
|
-
if (!dn(n) && -1 !== e.indexOf("/")) throw new U(
|
|
4852
|
+
if ("" === e) throw new U(R, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
4853
|
+
if (!dn(n) && -1 !== e.indexOf("/")) throw new U(R, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${e}' contains a '/' character.`);
|
|
4854
4854
|
const r = n.path.child(Z.fromString(e));
|
|
4855
|
-
if (!et.isDocumentKey(r)) throw new U(
|
|
4855
|
+
if (!et.isDocumentKey(r)) throw new U(R, `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}).`);
|
|
4856
4856
|
return kt(t, new et(r));
|
|
4857
4857
|
}
|
|
4858
4858
|
if (e instanceof fe) return kt(t, e._key);
|
|
4859
|
-
throw new U(
|
|
4859
|
+
throw new U(R, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${ot(e)}.`);
|
|
4860
4860
|
}
|
|
4861
4861
|
|
|
4862
4862
|
/**
|
|
4863
4863
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
4864
4864
|
* array requirements.
|
|
4865
4865
|
*/ function gr(t, n) {
|
|
4866
|
-
if (!Array.isArray(t) || 0 === t.length) throw new U(
|
|
4867
|
-
if (t.length > 10) throw new U(
|
|
4866
|
+
if (!Array.isArray(t) || 0 === t.length) throw new U(R, `Invalid Query. A non-empty array is required for '${n.toString()}' filters.`);
|
|
4867
|
+
if (t.length > 10) throw new U(R, `Invalid Query. '${n.toString()}' filters support a maximum of 10 elements in the value array.`);
|
|
4868
4868
|
}
|
|
4869
4869
|
|
|
4870
4870
|
function vr(t, n, e) {
|
|
4871
|
-
if (!e.isEqual(n)) throw new U(
|
|
4871
|
+
if (!e.isEqual(n)) throw new U(R, `Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${n.toString()}' and so you must also use '${n.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${e.toString()}' instead.`);
|
|
4872
4872
|
}
|
|
4873
4873
|
|
|
4874
4874
|
/**
|
|
@@ -4982,11 +4982,11 @@ class Er extends class {
|
|
|
4982
4982
|
convertServerTimestamp(t, n) {
|
|
4983
4983
|
switch (n) {
|
|
4984
4984
|
case "previous":
|
|
4985
|
-
const e =
|
|
4985
|
+
const e = St(t);
|
|
4986
4986
|
return null == e ? null : this.convertValue(e, n);
|
|
4987
4987
|
|
|
4988
4988
|
case "estimate":
|
|
4989
|
-
return this.convertTimestamp(
|
|
4989
|
+
return this.convertTimestamp(Ft(t));
|
|
4990
4990
|
|
|
4991
4991
|
default:
|
|
4992
4992
|
return null;
|
|
@@ -5066,11 +5066,11 @@ class Er extends class {
|
|
|
5066
5066
|
}
|
|
5067
5067
|
|
|
5068
5068
|
function Ar(t, n, e) {
|
|
5069
|
-
const r = br((t = ut(t, fe)).converter, n, e), s =
|
|
5069
|
+
const r = br((t = ut(t, fe)).converter, n, e), s = Se($e(t.firestore), "setDoc", t._key, r, null !== t.converter, e);
|
|
5070
5070
|
return ne(ie(t.firestore), [ s.toMutation(t._key, In.none()) ]);
|
|
5071
5071
|
}
|
|
5072
5072
|
|
|
5073
|
-
function
|
|
5073
|
+
function Rr(t, n, e, ...r) {
|
|
5074
5074
|
const s = $e((t = ut(t, fe)).firestore);
|
|
5075
5075
|
// For Compat types, we have to "extract" the underlying types before
|
|
5076
5076
|
// performing validation.
|
|
@@ -5090,7 +5090,7 @@ function Pr(t, n, e, ...r) {
|
|
|
5090
5090
|
* @param reference - A reference to the document to delete.
|
|
5091
5091
|
* @returns A `Promise` resolved once the document has been successfully
|
|
5092
5092
|
* deleted from the backend.
|
|
5093
|
-
*/ function
|
|
5093
|
+
*/ function Pr(t) {
|
|
5094
5094
|
return ne(ie((t = ut(t, fe)).firestore), [ new Vn(t._key, In.none()) ]);
|
|
5095
5095
|
}
|
|
5096
5096
|
|
|
@@ -5109,7 +5109,7 @@ function Pr(t, n, e, ...r) {
|
|
|
5109
5109
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
5110
5110
|
* newly created document after it has been written to the backend.
|
|
5111
5111
|
*/ function Vr(t, n) {
|
|
5112
|
-
const e = ye(t = ut(t, we)), r = br(t.converter, n), s =
|
|
5112
|
+
const e = ye(t = ut(t, we)), r = br(t.converter, n), s = Se($e(t.firestore), "addDoc", e._key, r, null !== e.converter, {});
|
|
5113
5113
|
return ne(ie(t.firestore), [ s.toMutation(e._key, In.exists(!1)) ]).then((() => e));
|
|
5114
5114
|
}
|
|
5115
5115
|
|
|
@@ -5133,7 +5133,7 @@ function Pr(t, n, e, ...r) {
|
|
|
5133
5133
|
* Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
|
|
5134
5134
|
* {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
|
|
5135
5135
|
*/ function Nr() {
|
|
5136
|
-
return new
|
|
5136
|
+
return new Fe("deleteField");
|
|
5137
5137
|
}
|
|
5138
5138
|
|
|
5139
5139
|
/**
|
|
@@ -5170,7 +5170,7 @@ function Pr(t, n, e, ...r) {
|
|
|
5170
5170
|
* @param elements - The elements to remove from the array.
|
|
5171
5171
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5172
5172
|
* `updateDoc()`
|
|
5173
|
-
*/ function
|
|
5173
|
+
*/ function Sr(...t) {
|
|
5174
5174
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5175
5175
|
// update() since we'd need the Firestore instance to do this.
|
|
5176
5176
|
return new Ce("arrayRemove", t);
|
|
@@ -5194,7 +5194,7 @@ function Pr(t, n, e, ...r) {
|
|
|
5194
5194
|
* @param n - The value to increment by.
|
|
5195
5195
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5196
5196
|
* `updateDoc()`
|
|
5197
|
-
*/ function
|
|
5197
|
+
*/ function Fr(t) {
|
|
5198
5198
|
return new Le("increment", t);
|
|
5199
5199
|
}
|
|
5200
5200
|
|
|
@@ -5229,7 +5229,7 @@ function Pr(t, n, e, ...r) {
|
|
|
5229
5229
|
}
|
|
5230
5230
|
set(t, n, e) {
|
|
5231
5231
|
this._verifyNotCommitted();
|
|
5232
|
-
const r = qr(t, this._firestore), s = br(r.converter, n, e), i =
|
|
5232
|
+
const r = qr(t, this._firestore), s = br(r.converter, n, e), i = Se(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, e);
|
|
5233
5233
|
return this._mutations.push(i.toMutation(r._key, In.none())), this;
|
|
5234
5234
|
}
|
|
5235
5235
|
update(t, n, e, ...r) {
|
|
@@ -5266,12 +5266,12 @@ function Pr(t, n, e, ...r) {
|
|
|
5266
5266
|
return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve();
|
|
5267
5267
|
}
|
|
5268
5268
|
_verifyNotCommitted() {
|
|
5269
|
-
if (this._committed) throw new U(
|
|
5269
|
+
if (this._committed) throw new U(F, "A write batch can no longer be used after commit() has been called.");
|
|
5270
5270
|
}
|
|
5271
5271
|
}
|
|
5272
5272
|
|
|
5273
5273
|
function qr(t, n) {
|
|
5274
|
-
if ((t = l(t)).firestore !== n) throw new U(
|
|
5274
|
+
if ((t = l(t)).firestore !== n) throw new U(R, "Provided document reference is from a different Firestore instance.");
|
|
5275
5275
|
return t;
|
|
5276
5276
|
}
|
|
5277
5277
|
|
|
@@ -5330,7 +5330,7 @@ function qr(t, n) {
|
|
|
5330
5330
|
this.writtenDocs = new Set;
|
|
5331
5331
|
}
|
|
5332
5332
|
async lookup(t) {
|
|
5333
|
-
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new U(
|
|
5333
|
+
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new U(R, "Firestore transactions require all reads to be executed before all writes.");
|
|
5334
5334
|
const n = await ee(this.datastore, t);
|
|
5335
5335
|
return n.forEach((t => this.recordVersion(t))), n;
|
|
5336
5336
|
}
|
|
@@ -5400,7 +5400,7 @@ function qr(t, n) {
|
|
|
5400
5400
|
// express that to the backend, we have to validate locally.
|
|
5401
5401
|
// Note: this can change once we can send separate verify writes in the
|
|
5402
5402
|
// transaction.
|
|
5403
|
-
throw new U(
|
|
5403
|
+
throw new U(R, "Can't update a document that doesn't exist.");
|
|
5404
5404
|
// Document exists, base precondition on document update time.
|
|
5405
5405
|
return In.updateTime(n);
|
|
5406
5406
|
}
|
|
@@ -5444,19 +5444,19 @@ class Lr {
|
|
|
5444
5444
|
}
|
|
5445
5445
|
At() {
|
|
5446
5446
|
this.It.W((async () => {
|
|
5447
|
-
const t = new Cr(this.datastore), n = this.
|
|
5447
|
+
const t = new Cr(this.datastore), n = this.Rt(t);
|
|
5448
5448
|
n && n.then((n => {
|
|
5449
5449
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
5450
5450
|
this.deferred.resolve(n);
|
|
5451
5451
|
})).catch((t => {
|
|
5452
|
-
this.
|
|
5452
|
+
this.Pt(t);
|
|
5453
5453
|
}))));
|
|
5454
5454
|
})).catch((t => {
|
|
5455
|
-
this.
|
|
5455
|
+
this.Pt(t);
|
|
5456
5456
|
}));
|
|
5457
5457
|
}));
|
|
5458
5458
|
}
|
|
5459
|
-
|
|
5459
|
+
Rt(t) {
|
|
5460
5460
|
try {
|
|
5461
5461
|
const n = this.updateFunction(t);
|
|
5462
5462
|
return !at(n) && n.catch && n.then ? n : (this.deferred.reject(Error("Transaction callback must return a Promise")),
|
|
@@ -5466,7 +5466,7 @@ class Lr {
|
|
|
5466
5466
|
return this.deferred.reject(t), null;
|
|
5467
5467
|
}
|
|
5468
5468
|
}
|
|
5469
|
-
|
|
5469
|
+
Pt(t) {
|
|
5470
5470
|
this.Tt > 0 && this.Vt(t) ? (this.Tt -= 1, this.asyncQueue.enqueueAndForget((() => (this.At(),
|
|
5471
5471
|
Promise.resolve())))) : this.deferred.reject(t);
|
|
5472
5472
|
}
|
|
@@ -5489,8 +5489,8 @@ class Lr {
|
|
|
5489
5489
|
|
|
5490
5490
|
case I:
|
|
5491
5491
|
case A:
|
|
5492
|
-
case
|
|
5493
|
-
case
|
|
5492
|
+
case P:
|
|
5493
|
+
case S:
|
|
5494
5494
|
case C:
|
|
5495
5495
|
case L:
|
|
5496
5496
|
// Unauthenticated means something went wrong with our token and we need
|
|
@@ -5498,11 +5498,11 @@ class Lr {
|
|
|
5498
5498
|
case $:
|
|
5499
5499
|
return !1;
|
|
5500
5500
|
|
|
5501
|
-
case
|
|
5501
|
+
case R:
|
|
5502
5502
|
case V:
|
|
5503
5503
|
case N:
|
|
5504
5504
|
case D:
|
|
5505
|
-
case
|
|
5505
|
+
case F:
|
|
5506
5506
|
// Aborted might be retried in some scenarios, but that is dependant on
|
|
5507
5507
|
// the context and should handled individually by the calling code.
|
|
5508
5508
|
// See https://cloud.google.com/apis/design/errors.
|
|
@@ -5650,9 +5650,9 @@ class Lr {
|
|
|
5650
5650
|
this.$t = !1,
|
|
5651
5651
|
// Operations scheduled to be queued in the future. Operations are
|
|
5652
5652
|
// automatically removed after they are run or canceled.
|
|
5653
|
-
this.
|
|
5653
|
+
this.St = [],
|
|
5654
5654
|
// visible for testing
|
|
5655
|
-
this.
|
|
5655
|
+
this.Ft = null,
|
|
5656
5656
|
// Flag set while there's an outstanding AsyncQueue operation, used for
|
|
5657
5657
|
// assertion sanity-checks.
|
|
5658
5658
|
this.xt = !1,
|
|
@@ -5774,7 +5774,7 @@ class Lr {
|
|
|
5774
5774
|
}
|
|
5775
5775
|
kt(t) {
|
|
5776
5776
|
const n = this.Nt.then((() => (this.xt = !0, t().catch((t => {
|
|
5777
|
-
this.
|
|
5777
|
+
this.Ft = t, this.xt = !1;
|
|
5778
5778
|
const n =
|
|
5779
5779
|
/**
|
|
5780
5780
|
* Chrome includes Error.message in Error.stack. Other browsers do not.
|
|
@@ -5823,10 +5823,10 @@ class Lr {
|
|
|
5823
5823
|
// Fast-forward delays for timerIds that have been overriden.
|
|
5824
5824
|
this.Ot.indexOf(t) > -1 && (n = 0);
|
|
5825
5825
|
const r = Ur.createAndSchedule(this, t, n, e, (t => this.jt(t)));
|
|
5826
|
-
return this.
|
|
5826
|
+
return this.St.push(r), r;
|
|
5827
5827
|
}
|
|
5828
5828
|
Lt() {
|
|
5829
|
-
this.
|
|
5829
|
+
this.Ft && v();
|
|
5830
5830
|
}
|
|
5831
5831
|
verifyOperationInProgress() {}
|
|
5832
5832
|
/**
|
|
@@ -5846,7 +5846,7 @@ class Lr {
|
|
|
5846
5846
|
* For Tests: Determine if a delayed operation with a particular TimerId
|
|
5847
5847
|
* exists.
|
|
5848
5848
|
*/ Bt(t) {
|
|
5849
|
-
for (const n of this.
|
|
5849
|
+
for (const n of this.St) if (n.timerId === t) return !0;
|
|
5850
5850
|
return !1;
|
|
5851
5851
|
}
|
|
5852
5852
|
/**
|
|
@@ -5859,8 +5859,8 @@ class Lr {
|
|
|
5859
5859
|
// Note that draining may generate more delayed ops, so we do that first.
|
|
5860
5860
|
return this.Mt().then((() => {
|
|
5861
5861
|
// Run ops in the same order they'd run if they ran naturally.
|
|
5862
|
-
this.
|
|
5863
|
-
for (const n of this.
|
|
5862
|
+
this.St.sort(((t, n) => t.targetTimeMs - n.targetTimeMs));
|
|
5863
|
+
for (const n of this.St) if (n.skipDelay(), "all" /* All */ !== t && n.timerId === t) break;
|
|
5864
5864
|
return this.Mt();
|
|
5865
5865
|
}));
|
|
5866
5866
|
}
|
|
@@ -5871,8 +5871,8 @@ class Lr {
|
|
|
5871
5871
|
}
|
|
5872
5872
|
/** Called once a DelayedOperation is run or canceled. */ jt(t) {
|
|
5873
5873
|
// NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
|
|
5874
|
-
const n = this.
|
|
5875
|
-
this.
|
|
5874
|
+
const n = this.St.indexOf(t);
|
|
5875
|
+
this.St.splice(n, 1);
|
|
5876
5876
|
}
|
|
5877
5877
|
}
|
|
5878
5878
|
|
|
@@ -5897,7 +5897,7 @@ class Mr {
|
|
|
5897
5897
|
}));
|
|
5898
5898
|
}
|
|
5899
5899
|
set(t, n, e) {
|
|
5900
|
-
const r = qr(t, this._firestore), s = br(r.converter, n, e), i =
|
|
5900
|
+
const r = qr(t, this._firestore), s = br(r.converter, n, e), i = Se(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, e);
|
|
5901
5901
|
return this._transaction.set(r._key, i), this;
|
|
5902
5902
|
}
|
|
5903
5903
|
update(t, n, e, ...r) {
|
|
@@ -5954,7 +5954,7 @@ class Mr {
|
|
|
5954
5954
|
return n && r._setSettings(n), r;
|
|
5955
5955
|
}), "PUBLIC")),
|
|
5956
5956
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
5957
|
-
r("firestore-lite", "3.4.
|
|
5957
|
+
r("firestore-lite", "3.4.3", "rn"), r("firestore-lite", "3.4.3", "esm2017");
|
|
5958
5958
|
|
|
5959
|
-
export { Ee as Bytes, we as CollectionReference, fe as DocumentReference, Je as DocumentSnapshot, ve as FieldPath, Te as FieldValue, ue as Firestore, U as FirestoreError, Ie as GeoPoint, de as Query, er as QueryConstraint, Xe as QueryDocumentSnapshot, Ze as QuerySnapshot, vt as Timestamp, Mr as Transaction, xr as WriteBatch, Vr as addDoc,
|
|
5959
|
+
export { Ee as Bytes, we as CollectionReference, fe as DocumentReference, Je as DocumentSnapshot, ve as FieldPath, Te as FieldValue, ue as Firestore, U as FirestoreError, Ie as GeoPoint, de as Query, er as QueryConstraint, Xe as QueryDocumentSnapshot, Ze as QuerySnapshot, vt as Timestamp, Mr as Transaction, xr as WriteBatch, Vr as addDoc, Sr as arrayRemove, $r as arrayUnion, me as collection, pe as collectionGroup, he as connectFirestoreEmulator, Pr as deleteDoc, Nr as deleteField, ye as doc, be as documentId, pr as endAt, mr as endBefore, Tr as getDoc, Ir as getDocs, ae as getFirestore, Fr as increment, ce as initializeFirestore, ar as limit, hr as limitToLast, ur as orderBy, rr as query, ge as queryEqual, _e as refEqual, Br as runTransaction, Dr as serverTimestamp, Ar as setDoc, m as setLogLevel, tr as snapshotEqual, dr as startAfter, fr as startAt, le as terminate, Rr as updateDoc, ir as where, Or as writeBatch };
|
|
5960
5960
|
//# sourceMappingURL=index.rn.esm2017.js.map
|