@firebase/firestore 4.7.7-canary.4d2fc6e82 → 4.7.7-canary.554c7bdc1

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.
Files changed (34) hide show
  1. package/dist/firestore/src/global_index.d.ts +7 -0
  2. package/dist/firestore/src/lite-api/database.d.ts +4 -0
  3. package/dist/firestore/src/lite-api/settings.d.ts +4 -0
  4. package/dist/firestore/src/util/misc.d.ts +0 -2
  5. package/dist/firestore/test/integration/util/settings.d.ts +1 -0
  6. package/dist/index.cjs.js +243 -241
  7. package/dist/index.cjs.js.map +1 -1
  8. package/dist/index.esm2017.js +244 -242
  9. package/dist/index.esm2017.js.map +1 -1
  10. package/dist/index.node.cjs.js +54 -53
  11. package/dist/index.node.cjs.js.map +1 -1
  12. package/dist/index.node.mjs +55 -54
  13. package/dist/index.node.mjs.map +1 -1
  14. package/dist/index.rn.js +196 -194
  15. package/dist/index.rn.js.map +1 -1
  16. package/dist/internal.d.ts +7 -0
  17. package/dist/lite/firestore/src/lite-api/database.d.ts +4 -0
  18. package/dist/lite/firestore/src/lite-api/settings.d.ts +4 -0
  19. package/dist/lite/firestore/src/util/misc.d.ts +0 -2
  20. package/dist/lite/firestore/test/integration/util/settings.d.ts +1 -0
  21. package/dist/lite/index.browser.esm2017.js +146 -166
  22. package/dist/lite/index.browser.esm2017.js.map +1 -1
  23. package/dist/lite/index.cjs.js +146 -166
  24. package/dist/lite/index.cjs.js.map +1 -1
  25. package/dist/lite/index.node.cjs.js +110 -128
  26. package/dist/lite/index.node.cjs.js.map +1 -1
  27. package/dist/lite/index.node.mjs +111 -129
  28. package/dist/lite/index.node.mjs.map +1 -1
  29. package/dist/lite/index.rn.esm2017.js +159 -179
  30. package/dist/lite/index.rn.esm2017.js.map +1 -1
  31. package/dist/lite/internal.d.ts +7 -0
  32. package/dist/lite/private.d.ts +4 -0
  33. package/dist/private.d.ts +4 -0
  34. package/package.json +9 -9
@@ -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-canary.4d2fc6e82";
37
+ const version$1 = "4.7.7-canary.554c7bdc1";
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-canary.4d2fc6e82";
90
+ const version = "11.3.0-canary.554c7bdc1";
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
 
@@ -27850,6 +27839,7 @@ class Firestore$1 {
27850
27839
  this._persistenceKey = '(lite)';
27851
27840
  this._settings = new FirestoreSettingsImpl({});
27852
27841
  this._settingsFrozen = false;
27842
+ this._emulatorOptions = {};
27853
27843
  // A task that is assigned when the terminate() is invoked and resolved when
27854
27844
  // all components have shut down. Otherwise, Firestore is not terminated,
27855
27845
  // which can mean either the FirestoreClient is in the process of starting,
@@ -27880,6 +27870,7 @@ class Firestore$1 {
27880
27870
  'methods on a Firestore object.');
27881
27871
  }
27882
27872
  this._settings = new FirestoreSettingsImpl(settings);
27873
+ this._emulatorOptions = settings.emulatorOptions || {};
27883
27874
  if (settings.credentials !== undefined) {
27884
27875
  this._authCredentials = makeAuthCredentialsProvider(settings.credentials);
27885
27876
  }
@@ -27887,6 +27878,9 @@ class Firestore$1 {
27887
27878
  _getSettings() {
27888
27879
  return this._settings;
27889
27880
  }
27881
+ _getEmulatorOptions() {
27882
+ return this._emulatorOptions;
27883
+ }
27890
27884
  _freezeSettings() {
27891
27885
  this._settingsFrozen = true;
27892
27886
  return this._settings;
@@ -27947,12 +27941,19 @@ function connectFirestoreEmulator(firestore, host, port, options = {}) {
27947
27941
  var _a;
27948
27942
  firestore = cast(firestore, Firestore$1);
27949
27943
  const settings = firestore._getSettings();
27944
+ const existingConfig = Object.assign(Object.assign({}, settings), { emulatorOptions: firestore._getEmulatorOptions() });
27950
27945
  const newHostSetting = `${host}:${port}`;
27951
27946
  if (settings.host !== DEFAULT_HOST && settings.host !== newHostSetting) {
27952
27947
  logWarn('Host has been set in both settings() and connectFirestoreEmulator(), emulator host ' +
27953
27948
  'will be used.');
27954
27949
  }
27955
- firestore._setSettings(Object.assign(Object.assign({}, settings), { host: newHostSetting, ssl: false }));
27950
+ const newConfig = Object.assign(Object.assign({}, settings), { host: newHostSetting, ssl: false, emulatorOptions: options });
27951
+ // No-op if the new configuration matches the current configuration. This supports SSR
27952
+ // enviornments which might call `connectFirestoreEmulator` multiple times as a standard practice.
27953
+ if (util.deepEqual(newConfig, existingConfig)) {
27954
+ return;
27955
+ }
27956
+ firestore._setSettings(newConfig);
27956
27957
  if (options.mockUserToken) {
27957
27958
  let token;
27958
27959
  let user;