@firebase/firestore 3.4.4-canary.2dd99ae2d → 3.4.4-canary.4cec42313

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.
@@ -8,7 +8,7 @@ import { credentials, loadPackageDefinition, Metadata } from '@grpc/grpc-js';
8
8
  import { fromJSON } from '@grpc/proto-loader';
9
9
 
10
10
  const name = "@firebase/firestore";
11
- const version$1 = "3.4.4-canary.2dd99ae2d";
11
+ const version$1 = "3.4.4-canary.4cec42313";
12
12
 
13
13
  /**
14
14
  * @license
@@ -61,7 +61,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
61
61
  User.FIRST_PARTY = new User('first-party-uid');
62
62
  User.MOCK_USER = new User('mock-user');
63
63
 
64
- const version = "9.6.5-canary.2dd99ae2d";
64
+ const version = "9.6.5-canary.4cec42313";
65
65
 
66
66
  /**
67
67
  * @license
@@ -1192,23 +1192,6 @@ function decodeResourcePath(path) {
1192
1192
  }
1193
1193
  return new ResourcePath(segments);
1194
1194
  }
1195
-
1196
- /**
1197
- * @license
1198
- * Copyright 2017 Google LLC
1199
- *
1200
- * Licensed under the Apache License, Version 2.0 (the "License");
1201
- * you may not use this file except in compliance with the License.
1202
- * You may obtain a copy of the License at
1203
- *
1204
- * http://www.apache.org/licenses/LICENSE-2.0
1205
- *
1206
- * Unless required by applicable law or agreed to in writing, software
1207
- * distributed under the License is distributed on an "AS IS" BASIS,
1208
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1209
- * See the License for the specific language governing permissions and
1210
- * limitations under the License.
1211
- */
1212
1195
  /**
1213
1196
  * Schema Version for the Web client:
1214
1197
  * 1. Initial version including Mutation Queue, Query Cache, and Remote
@@ -1227,6 +1210,7 @@ function decodeResourcePath(path) {
1227
1210
  * an auto-incrementing ID. This is required for Index-Free queries.
1228
1211
  * 10. Rewrite the canonical IDs to the explicit Protobuf-based format.
1229
1212
  * 11. Add bundles and named_queries for bundle support.
1213
+ * 12. Add indexing support.
1230
1214
  */
1231
1215
  const SCHEMA_VERSION = 11;
1232
1216
  /**
@@ -1753,9 +1737,7 @@ class DbClientMetadata {
1753
1737
  DbClientMetadata.store = 'clientMetadata';
1754
1738
  /** Keys are automatically assigned via the clientId properties. */
1755
1739
  DbClientMetadata.keyPath = 'clientId';
1756
- /**
1757
- * A object representing a bundle loaded by the SDK.
1758
- */
1740
+ /** An object representing a bundle loaded by the SDK. */
1759
1741
  class DbBundle {
1760
1742
  constructor(
1761
1743
  /** The ID of the loaded bundle. */
@@ -1772,9 +1754,7 @@ class DbBundle {
1772
1754
  /** Name of the IndexedDb object store. */
1773
1755
  DbBundle.store = 'bundles';
1774
1756
  DbBundle.keyPath = 'bundleId';
1775
- /**
1776
- * A object representing a named query loaded by the SDK via a bundle.
1777
- */
1757
+ /** An object representing a named query loaded by the SDK via a bundle. */
1778
1758
  class DbNamedQuery {
1779
1759
  constructor(
1780
1760
  /** The name of the query. */
@@ -1791,6 +1771,93 @@ class DbNamedQuery {
1791
1771
  /** Name of the IndexedDb object store. */
1792
1772
  DbNamedQuery.store = 'namedQueries';
1793
1773
  DbNamedQuery.keyPath = 'name';
1774
+ /** An object representing the global configuration for a field index. */
1775
+ class DbIndexConfiguration {
1776
+ constructor(
1777
+ /** The index id for this entry. */
1778
+ indexId,
1779
+ /** The collection group this index belongs to. */
1780
+ collectionGroup,
1781
+ /** The fields to index for this index. */
1782
+ fields) {
1783
+ this.indexId = indexId;
1784
+ this.collectionGroup = collectionGroup;
1785
+ this.fields = fields;
1786
+ }
1787
+ }
1788
+ /** Name of the IndexedDb object store. */
1789
+ DbIndexConfiguration.store = 'indexConfiguration';
1790
+ DbIndexConfiguration.keyPath = 'indexId';
1791
+ /**
1792
+ * An object describing how up-to-date the index backfill is for each user and
1793
+ * index.
1794
+ */
1795
+ class DbIndexState {
1796
+ constructor(
1797
+ /** The index id for this entry. */
1798
+ indexId,
1799
+ /** The user id for this entry. */
1800
+ uid,
1801
+ /**
1802
+ * A number that indicates when the index was last updated (relative to
1803
+ * other indexes).
1804
+ */
1805
+ sequenceNumber,
1806
+ /**
1807
+ * The latest read time that has been indexed by Firestore for this field
1808
+ * index. Set to `{seconds: 0, nanos: 0}` if no documents have been indexed.
1809
+ */
1810
+ readTime,
1811
+ /**
1812
+ * The last document that has been indexed for this field index. Empty if
1813
+ * no documents have been indexed.
1814
+ */
1815
+ documentKey,
1816
+ /**
1817
+ * The largest mutation batch id that has been processed for this index. -1
1818
+ * if no mutations have been indexed.
1819
+ */
1820
+ largestBatchId) {
1821
+ this.indexId = indexId;
1822
+ this.uid = uid;
1823
+ this.sequenceNumber = sequenceNumber;
1824
+ this.readTime = readTime;
1825
+ this.documentKey = documentKey;
1826
+ this.largestBatchId = largestBatchId;
1827
+ }
1828
+ }
1829
+ /** Name of the IndexedDb object store. */
1830
+ DbIndexState.store = 'indexState';
1831
+ DbIndexState.keyPath = ['indexId', 'uid'];
1832
+ /** An object that stores the encoded entries for all documents and fields. */
1833
+ class DbIndexEntries {
1834
+ constructor(
1835
+ /** The index id for this entry. */
1836
+ indexId,
1837
+ /** The user id for this entry. */
1838
+ uid,
1839
+ /** The encoded array index value for this entry. */
1840
+ arrayValue,
1841
+ /** The encoded directional value for equality and inequality filters. */
1842
+ directionalValue,
1843
+ /** The document key this entry points to. */
1844
+ documentKey) {
1845
+ this.indexId = indexId;
1846
+ this.uid = uid;
1847
+ this.arrayValue = arrayValue;
1848
+ this.directionalValue = directionalValue;
1849
+ this.documentKey = documentKey;
1850
+ }
1851
+ }
1852
+ /** Name of the IndexedDb object store. */
1853
+ DbIndexEntries.store = 'indexEntries';
1854
+ DbIndexEntries.keyPath = [
1855
+ 'indexId',
1856
+ 'uid',
1857
+ 'arrayValue',
1858
+ 'directionalValue',
1859
+ 'documentKey'
1860
+ ];
1794
1861
  // Visible for testing
1795
1862
  const V1_STORES = [
1796
1863
  DbMutationQueue.store,
@@ -1805,7 +1872,6 @@ const V1_STORES = [
1805
1872
  // V2 is no longer usable (see comment at top of file)
1806
1873
  // Visible for testing
1807
1874
  const V3_STORES = V1_STORES;
1808
- // Visible for testing
1809
1875
  // Note: DbRemoteDocumentChanges is no longer used and dropped with v9.
1810
1876
  const V4_STORES = [...V3_STORES, DbClientMetadata.store];
1811
1877
  // V5 does not change the set of stores.
@@ -1815,6 +1881,12 @@ const V8_STORES = [...V6_STORES, DbCollectionParent.store];
1815
1881
  // V9 does not change the set of stores.
1816
1882
  // V10 does not change the set of stores.
1817
1883
  const V11_STORES = [...V8_STORES, DbBundle.store, DbNamedQuery.store];
1884
+ [
1885
+ ...V11_STORES,
1886
+ DbIndexConfiguration.store,
1887
+ DbIndexState.store,
1888
+ DbIndexEntries.store
1889
+ ];
1818
1890
  /**
1819
1891
  * The list of all default IndexedDB stores used throughout the SDK. This is
1820
1892
  * used when creating transactions so that access across all stores is done
@@ -10637,9 +10709,6 @@ class SchemaConverter {
10637
10709
  * and local feature development.
10638
10710
  */
10639
10711
  createOrUpgrade(db, txn, fromVersion, toVersion) {
10640
- hardAssert(fromVersion < toVersion &&
10641
- fromVersion >= 0 &&
10642
- toVersion <= SCHEMA_VERSION);
10643
10712
  const simpleDbTransaction = new SimpleDbTransaction('createOrUpgrade', txn);
10644
10713
  if (fromVersion < 1 && toVersion >= 1) {
10645
10714
  createPrimaryClientStore(db);
@@ -10706,6 +10775,11 @@ class SchemaConverter {
10706
10775
  createNamedQueriesStore(db);
10707
10776
  });
10708
10777
  }
10778
+ if (fromVersion < 12 && toVersion >= 12) {
10779
+ p = p.next(() => {
10780
+ createFieldIndex(db);
10781
+ });
10782
+ }
10709
10783
  return p;
10710
10784
  }
10711
10785
  addDocumentGlobal(txn) {
@@ -10912,6 +10986,17 @@ function createNamedQueriesStore(db) {
10912
10986
  db.createObjectStore(DbNamedQuery.store, {
10913
10987
  keyPath: DbNamedQuery.keyPath
10914
10988
  });
10989
+ }
10990
+ function createFieldIndex(db) {
10991
+ db.createObjectStore(DbIndexConfiguration.store, {
10992
+ keyPath: DbIndexConfiguration.keyPath
10993
+ });
10994
+ db.createObjectStore(DbIndexState.store, {
10995
+ keyPath: DbIndexState.keyPath
10996
+ });
10997
+ db.createObjectStore(DbIndexEntries.store, {
10998
+ keyPath: DbIndexEntries.keyPath
10999
+ });
10915
11000
  }
10916
11001
 
10917
11002
  /**