@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.
@@ -9,7 +9,7 @@ import * as grpc from '@grpc/grpc-js';
9
9
  import * as protoLoader from '@grpc/proto-loader';
10
10
 
11
11
  const name = "@firebase/firestore";
12
- const version$1 = "4.7.7";
12
+ const version$1 = "4.7.8";
13
13
 
14
14
  /**
15
15
  * @license
@@ -62,7 +62,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
62
62
  User.FIRST_PARTY = new User('first-party-uid');
63
63
  User.MOCK_USER = new User('mock-user');
64
64
 
65
- const version = "11.3.0";
65
+ const version = "11.3.1";
66
66
 
67
67
  /**
68
68
  * @license
@@ -820,35 +820,6 @@ function randomBytes(nBytes) {
820
820
  return randomBytes$1(nBytes);
821
821
  }
822
822
 
823
- /**
824
- * @license
825
- * Copyright 2023 Google LLC
826
- *
827
- * Licensed under the Apache License, Version 2.0 (the "License");
828
- * you may not use this file except in compliance with the License.
829
- * You may obtain a copy of the License at
830
- *
831
- * http://www.apache.org/licenses/LICENSE-2.0
832
- *
833
- * Unless required by applicable law or agreed to in writing, software
834
- * distributed under the License is distributed on an "AS IS" BASIS,
835
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
836
- * See the License for the specific language governing permissions and
837
- * limitations under the License.
838
- */
839
- /**
840
- * An instance of the Platform's 'TextEncoder' implementation.
841
- */
842
- function newTextEncoder() {
843
- return new TextEncoder();
844
- }
845
- /**
846
- * An instance of the Platform's 'TextDecoder' implementation.
847
- */
848
- function newTextDecoder() {
849
- return new TextDecoder('utf-8');
850
- }
851
-
852
823
  /**
853
824
  * @license
854
825
  * Copyright 2017 Google LLC
@@ -901,19 +872,6 @@ function primitiveComparator(left, right) {
901
872
  }
902
873
  return 0;
903
874
  }
904
- /** Compare strings in UTF-8 encoded byte order */
905
- function compareUtf8Strings(left, right) {
906
- // Convert the string to UTF-8 encoded bytes
907
- const encodedLeft = newTextEncoder().encode(left);
908
- const encodedRight = newTextEncoder().encode(right);
909
- for (let i = 0; i < Math.min(encodedLeft.length, encodedRight.length); i++) {
910
- const comparison = primitiveComparator(encodedLeft[i], encodedRight[i]);
911
- if (comparison !== 0) {
912
- return comparison;
913
- }
914
- }
915
- return primitiveComparator(encodedLeft.length, encodedRight.length);
916
- }
917
875
  /** Helper to compare arrays using isEqual(). */
918
876
  function arrayEquals(left, right, comparator) {
919
877
  if (left.length !== right.length) {
@@ -1275,7 +1233,7 @@ class BasePath {
1275
1233
  return comparison;
1276
1234
  }
1277
1235
  }
1278
- return primitiveComparator(p1.length, p2.length);
1236
+ return Math.sign(p1.length - p2.length);
1279
1237
  }
1280
1238
  static compareSegments(lhs, rhs) {
1281
1239
  const isLhsNumeric = BasePath.isNumericId(lhs);
@@ -1294,7 +1252,13 @@ class BasePath {
1294
1252
  }
1295
1253
  else {
1296
1254
  // both non-numeric
1297
- return compareUtf8Strings(lhs, rhs);
1255
+ if (lhs < rhs) {
1256
+ return -1;
1257
+ }
1258
+ if (lhs > rhs) {
1259
+ return 1;
1260
+ }
1261
+ return 0;
1298
1262
  }
1299
1263
  }
1300
1264
  // Checks if a segment is a numeric ID (starts with "__id" and ends with "__").
@@ -4711,7 +4675,7 @@ function valueCompare(left, right) {
4711
4675
  case 4 /* TypeOrder.ServerTimestampValue */:
4712
4676
  return compareTimestamps(getLocalWriteTime(left), getLocalWriteTime(right));
4713
4677
  case 5 /* TypeOrder.StringValue */:
4714
- return compareUtf8Strings(left.stringValue, right.stringValue);
4678
+ return primitiveComparator(left.stringValue, right.stringValue);
4715
4679
  case 6 /* TypeOrder.BlobValue */:
4716
4680
  return compareBlobs(left.bytesValue, right.bytesValue);
4717
4681
  case 7 /* TypeOrder.RefValue */:
@@ -4832,7 +4796,7 @@ function compareMaps(left, right) {
4832
4796
  leftKeys.sort();
4833
4797
  rightKeys.sort();
4834
4798
  for (let i = 0; i < leftKeys.length && i < rightKeys.length; ++i) {
4835
- const keyCompare = compareUtf8Strings(leftKeys[i], rightKeys[i]);
4799
+ const keyCompare = primitiveComparator(leftKeys[i], rightKeys[i]);
4836
4800
  if (keyCompare !== 0) {
4837
4801
  return keyCompare;
4838
4802
  }
@@ -8013,6 +7977,35 @@ function setTestingHooksSpi(instance) {
8013
7977
  testingHooksSpi = instance;
8014
7978
  }
8015
7979
 
7980
+ /**
7981
+ * @license
7982
+ * Copyright 2023 Google LLC
7983
+ *
7984
+ * Licensed under the Apache License, Version 2.0 (the "License");
7985
+ * you may not use this file except in compliance with the License.
7986
+ * You may obtain a copy of the License at
7987
+ *
7988
+ * http://www.apache.org/licenses/LICENSE-2.0
7989
+ *
7990
+ * Unless required by applicable law or agreed to in writing, software
7991
+ * distributed under the License is distributed on an "AS IS" BASIS,
7992
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7993
+ * See the License for the specific language governing permissions and
7994
+ * limitations under the License.
7995
+ */
7996
+ /**
7997
+ * An instance of the Platform's 'TextEncoder' implementation.
7998
+ */
7999
+ function newTextEncoder() {
8000
+ return new TextEncoder();
8001
+ }
8002
+ /**
8003
+ * An instance of the Platform's 'TextDecoder' implementation.
8004
+ */
8005
+ function newTextDecoder() {
8006
+ return new TextDecoder('utf-8');
8007
+ }
8008
+
8016
8009
  /**
8017
8010
  * @license
8018
8011
  * Copyright 2022 Google LLC
@@ -14061,10 +14054,6 @@ function dbKeyComparator(l, r) {
14061
14054
  if (cmp) {
14062
14055
  return cmp;
14063
14056
  }
14064
- // TODO(b/329441702): Document IDs should be sorted by UTF-8 encoded byte
14065
- // order, but IndexedDB sorts strings lexicographically. Document ID
14066
- // comparison here still relies on primitive comparison to avoid mismatches
14067
- // observed in snapshot listeners with Unicode characters in documentIds
14068
14057
  return primitiveComparator(left[left.length - 1], right[right.length - 1]);
14069
14058
  }
14070
14059