@firebase/firestore 4.7.7 → 4.7.8

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.
@@ -34,7 +34,7 @@ var grpc__namespace = /*#__PURE__*/_interopNamespace(grpc);
34
34
  var protoLoader__namespace = /*#__PURE__*/_interopNamespace(protoLoader);
35
35
 
36
36
  const name = "@firebase/firestore";
37
- const version$1 = "4.7.7";
37
+ const version$1 = "4.7.8";
38
38
 
39
39
  /**
40
40
  * @license
@@ -87,7 +87,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
87
87
  User.FIRST_PARTY = new User('first-party-uid');
88
88
  User.MOCK_USER = new User('mock-user');
89
89
 
90
- const version = "11.3.0";
90
+ const version = "11.3.1";
91
91
 
92
92
  /**
93
93
  * @license
@@ -845,35 +845,6 @@ function randomBytes(nBytes) {
845
845
  return crypto.randomBytes(nBytes);
846
846
  }
847
847
 
848
- /**
849
- * @license
850
- * Copyright 2023 Google LLC
851
- *
852
- * Licensed under the Apache License, Version 2.0 (the "License");
853
- * you may not use this file except in compliance with the License.
854
- * You may obtain a copy of the License at
855
- *
856
- * http://www.apache.org/licenses/LICENSE-2.0
857
- *
858
- * Unless required by applicable law or agreed to in writing, software
859
- * distributed under the License is distributed on an "AS IS" BASIS,
860
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
861
- * See the License for the specific language governing permissions and
862
- * limitations under the License.
863
- */
864
- /**
865
- * An instance of the Platform's 'TextEncoder' implementation.
866
- */
867
- function newTextEncoder() {
868
- return new util$1.TextEncoder();
869
- }
870
- /**
871
- * An instance of the Platform's 'TextDecoder' implementation.
872
- */
873
- function newTextDecoder() {
874
- return new util$1.TextDecoder('utf-8');
875
- }
876
-
877
848
  /**
878
849
  * @license
879
850
  * Copyright 2017 Google LLC
@@ -926,19 +897,6 @@ function primitiveComparator(left, right) {
926
897
  }
927
898
  return 0;
928
899
  }
929
- /** Compare strings in UTF-8 encoded byte order */
930
- function compareUtf8Strings(left, right) {
931
- // Convert the string to UTF-8 encoded bytes
932
- const encodedLeft = newTextEncoder().encode(left);
933
- const encodedRight = newTextEncoder().encode(right);
934
- for (let i = 0; i < Math.min(encodedLeft.length, encodedRight.length); i++) {
935
- const comparison = primitiveComparator(encodedLeft[i], encodedRight[i]);
936
- if (comparison !== 0) {
937
- return comparison;
938
- }
939
- }
940
- return primitiveComparator(encodedLeft.length, encodedRight.length);
941
- }
942
900
  /** Helper to compare arrays using isEqual(). */
943
901
  function arrayEquals(left, right, comparator) {
944
902
  if (left.length !== right.length) {
@@ -1300,7 +1258,7 @@ class BasePath {
1300
1258
  return comparison;
1301
1259
  }
1302
1260
  }
1303
- return primitiveComparator(p1.length, p2.length);
1261
+ return Math.sign(p1.length - p2.length);
1304
1262
  }
1305
1263
  static compareSegments(lhs, rhs) {
1306
1264
  const isLhsNumeric = BasePath.isNumericId(lhs);
@@ -1319,7 +1277,13 @@ class BasePath {
1319
1277
  }
1320
1278
  else {
1321
1279
  // both non-numeric
1322
- return compareUtf8Strings(lhs, rhs);
1280
+ if (lhs < rhs) {
1281
+ return -1;
1282
+ }
1283
+ if (lhs > rhs) {
1284
+ return 1;
1285
+ }
1286
+ return 0;
1323
1287
  }
1324
1288
  }
1325
1289
  // Checks if a segment is a numeric ID (starts with "__id" and ends with "__").
@@ -4736,7 +4700,7 @@ function valueCompare(left, right) {
4736
4700
  case 4 /* TypeOrder.ServerTimestampValue */:
4737
4701
  return compareTimestamps(getLocalWriteTime(left), getLocalWriteTime(right));
4738
4702
  case 5 /* TypeOrder.StringValue */:
4739
- return compareUtf8Strings(left.stringValue, right.stringValue);
4703
+ return primitiveComparator(left.stringValue, right.stringValue);
4740
4704
  case 6 /* TypeOrder.BlobValue */:
4741
4705
  return compareBlobs(left.bytesValue, right.bytesValue);
4742
4706
  case 7 /* TypeOrder.RefValue */:
@@ -4857,7 +4821,7 @@ function compareMaps(left, right) {
4857
4821
  leftKeys.sort();
4858
4822
  rightKeys.sort();
4859
4823
  for (let i = 0; i < leftKeys.length && i < rightKeys.length; ++i) {
4860
- const keyCompare = compareUtf8Strings(leftKeys[i], rightKeys[i]);
4824
+ const keyCompare = primitiveComparator(leftKeys[i], rightKeys[i]);
4861
4825
  if (keyCompare !== 0) {
4862
4826
  return keyCompare;
4863
4827
  }
@@ -8038,6 +8002,35 @@ function setTestingHooksSpi(instance) {
8038
8002
  testingHooksSpi = instance;
8039
8003
  }
8040
8004
 
8005
+ /**
8006
+ * @license
8007
+ * Copyright 2023 Google LLC
8008
+ *
8009
+ * Licensed under the Apache License, Version 2.0 (the "License");
8010
+ * you may not use this file except in compliance with the License.
8011
+ * You may obtain a copy of the License at
8012
+ *
8013
+ * http://www.apache.org/licenses/LICENSE-2.0
8014
+ *
8015
+ * Unless required by applicable law or agreed to in writing, software
8016
+ * distributed under the License is distributed on an "AS IS" BASIS,
8017
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8018
+ * See the License for the specific language governing permissions and
8019
+ * limitations under the License.
8020
+ */
8021
+ /**
8022
+ * An instance of the Platform's 'TextEncoder' implementation.
8023
+ */
8024
+ function newTextEncoder() {
8025
+ return new util$1.TextEncoder();
8026
+ }
8027
+ /**
8028
+ * An instance of the Platform's 'TextDecoder' implementation.
8029
+ */
8030
+ function newTextDecoder() {
8031
+ return new util$1.TextDecoder('utf-8');
8032
+ }
8033
+
8041
8034
  /**
8042
8035
  * @license
8043
8036
  * Copyright 2022 Google LLC
@@ -14086,10 +14079,6 @@ function dbKeyComparator(l, r) {
14086
14079
  if (cmp) {
14087
14080
  return cmp;
14088
14081
  }
14089
- // TODO(b/329441702): Document IDs should be sorted by UTF-8 encoded byte
14090
- // order, but IndexedDB sorts strings lexicographically. Document ID
14091
- // comparison here still relies on primitive comparison to avoid mismatches
14092
- // observed in snapshot listeners with Unicode characters in documentIds
14093
14082
  return primitiveComparator(left[left.length - 1], right[right.length - 1]);
14094
14083
  }
14095
14084