@firebase/firestore 4.7.7-canary.4e6a5c670 → 4.7.7-canary.604133f8d

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 (38) hide show
  1. package/dist/firestore/src/global_index.d.ts +9 -2
  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/lite-api/vector_value.d.ts +2 -2
  5. package/dist/firestore/src/util/misc.d.ts +0 -2
  6. package/dist/firestore/test/integration/util/settings.d.ts +1 -0
  7. package/dist/index.cjs.js +245 -243
  8. package/dist/index.cjs.js.map +1 -1
  9. package/dist/index.d.ts +2 -2
  10. package/dist/index.esm2017.js +246 -244
  11. package/dist/index.esm2017.js.map +1 -1
  12. package/dist/index.node.cjs.js +56 -55
  13. package/dist/index.node.cjs.js.map +1 -1
  14. package/dist/index.node.mjs +57 -56
  15. package/dist/index.node.mjs.map +1 -1
  16. package/dist/index.rn.js +198 -196
  17. package/dist/index.rn.js.map +1 -1
  18. package/dist/internal.d.ts +9 -2
  19. package/dist/lite/firestore/src/lite-api/database.d.ts +4 -0
  20. package/dist/lite/firestore/src/lite-api/settings.d.ts +4 -0
  21. package/dist/lite/firestore/src/lite-api/vector_value.d.ts +2 -2
  22. package/dist/lite/firestore/src/util/misc.d.ts +0 -2
  23. package/dist/lite/firestore/test/integration/util/settings.d.ts +1 -0
  24. package/dist/lite/index.browser.esm2017.js +148 -168
  25. package/dist/lite/index.browser.esm2017.js.map +1 -1
  26. package/dist/lite/index.cjs.js +148 -168
  27. package/dist/lite/index.cjs.js.map +1 -1
  28. package/dist/lite/index.d.ts +2 -2
  29. package/dist/lite/index.node.cjs.js +112 -130
  30. package/dist/lite/index.node.cjs.js.map +1 -1
  31. package/dist/lite/index.node.mjs +113 -131
  32. package/dist/lite/index.node.mjs.map +1 -1
  33. package/dist/lite/index.rn.esm2017.js +161 -181
  34. package/dist/lite/index.rn.esm2017.js.map +1 -1
  35. package/dist/lite/internal.d.ts +9 -2
  36. package/dist/lite/private.d.ts +6 -2
  37. package/dist/private.d.ts +6 -2
  38. package/package.json +9 -9
@@ -2,14 +2,14 @@ import { _getProvider, getApp, _removeServiceInstance, _registerComponent, regis
2
2
  import { Component } from '@firebase/component';
3
3
  import { Logger, LogLevel } from '@firebase/logger';
4
4
  import { inspect, TextEncoder, TextDecoder } from 'util';
5
- import { FirebaseError, createMockUserToken, getModularInstance, deepEqual, getDefaultEmulatorHostnameAndPort, isIndexedDBAvailable, getUA, isSafari } from '@firebase/util';
5
+ import { FirebaseError, deepEqual, createMockUserToken, getModularInstance, getDefaultEmulatorHostnameAndPort, isIndexedDBAvailable, getUA, isSafari } from '@firebase/util';
6
6
  import { randomBytes as randomBytes$1 } from 'crypto';
7
7
  import { Integer, Md5 } from '@firebase/webchannel-wrapper/bloom-blob';
8
8
  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-canary.4e6a5c670";
12
+ const version$1 = "4.7.7-canary.604133f8d";
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-canary.4e6a5c670";
65
+ const version = "11.3.0-canary.604133f8d";
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
 
@@ -27825,6 +27814,7 @@ class Firestore$1 {
27825
27814
  this._persistenceKey = '(lite)';
27826
27815
  this._settings = new FirestoreSettingsImpl({});
27827
27816
  this._settingsFrozen = false;
27817
+ this._emulatorOptions = {};
27828
27818
  // A task that is assigned when the terminate() is invoked and resolved when
27829
27819
  // all components have shut down. Otherwise, Firestore is not terminated,
27830
27820
  // which can mean either the FirestoreClient is in the process of starting,
@@ -27855,6 +27845,7 @@ class Firestore$1 {
27855
27845
  'methods on a Firestore object.');
27856
27846
  }
27857
27847
  this._settings = new FirestoreSettingsImpl(settings);
27848
+ this._emulatorOptions = settings.emulatorOptions || {};
27858
27849
  if (settings.credentials !== undefined) {
27859
27850
  this._authCredentials = makeAuthCredentialsProvider(settings.credentials);
27860
27851
  }
@@ -27862,6 +27853,9 @@ class Firestore$1 {
27862
27853
  _getSettings() {
27863
27854
  return this._settings;
27864
27855
  }
27856
+ _getEmulatorOptions() {
27857
+ return this._emulatorOptions;
27858
+ }
27865
27859
  _freezeSettings() {
27866
27860
  this._settingsFrozen = true;
27867
27861
  return this._settings;
@@ -27922,12 +27916,19 @@ function connectFirestoreEmulator(firestore, host, port, options = {}) {
27922
27916
  var _a;
27923
27917
  firestore = cast(firestore, Firestore$1);
27924
27918
  const settings = firestore._getSettings();
27919
+ const existingConfig = Object.assign(Object.assign({}, settings), { emulatorOptions: firestore._getEmulatorOptions() });
27925
27920
  const newHostSetting = `${host}:${port}`;
27926
27921
  if (settings.host !== DEFAULT_HOST && settings.host !== newHostSetting) {
27927
27922
  logWarn('Host has been set in both settings() and connectFirestoreEmulator(), emulator host ' +
27928
27923
  'will be used.');
27929
27924
  }
27930
- firestore._setSettings(Object.assign(Object.assign({}, settings), { host: newHostSetting, ssl: false }));
27925
+ const newConfig = Object.assign(Object.assign({}, settings), { host: newHostSetting, ssl: false, emulatorOptions: options });
27926
+ // No-op if the new configuration matches the current configuration. This supports SSR
27927
+ // enviornments which might call `connectFirestoreEmulator` multiple times as a standard practice.
27928
+ if (deepEqual(newConfig, existingConfig)) {
27929
+ return;
27930
+ }
27931
+ firestore._setSettings(newConfig);
27931
27932
  if (options.mockUserToken) {
27932
27933
  let token;
27933
27934
  let user;
@@ -29310,7 +29311,7 @@ class GeoPoint {
29310
29311
  */
29311
29312
  /**
29312
29313
  * Represents a vector type in Firestore documents.
29313
- * Create an instance with {@link FieldValue.vector}.
29314
+ * Create an instance with <code>{@link vector}</code>.
29314
29315
  *
29315
29316
  * @class VectorValue
29316
29317
  */
@@ -29330,7 +29331,7 @@ class VectorValue {
29330
29331
  return this._values.map(n => n);
29331
29332
  }
29332
29333
  /**
29333
- * Returns `true` if the two VectorValue has the same raw number arrays, returns `false` otherwise.
29334
+ * Returns `true` if the two `VectorValue` values have the same raw number arrays, returns `false` otherwise.
29334
29335
  */
29335
29336
  isEqual(other) {
29336
29337
  return isPrimitiveArrayEqual(this._values, other._values);