@firebase/firestore 3.8.1 → 3.8.2-20230201003102

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 (35) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/firestore/src/local/remote_document_cache.d.ts +5 -5
  3. package/dist/firestore/test/unit/local/test_remote_document_cache.d.ts +3 -3
  4. package/dist/index.cjs.js +20635 -0
  5. package/dist/index.cjs.js.map +1 -0
  6. package/dist/index.esm2017.js +29 -27
  7. package/dist/index.esm2017.js.map +1 -1
  8. package/dist/index.esm5.js +140 -138
  9. package/dist/index.esm5.js.map +1 -1
  10. package/dist/index.node.cjs.js +22 -12
  11. package/dist/index.node.cjs.js.map +1 -1
  12. package/dist/index.node.mjs +22 -12
  13. package/dist/index.node.mjs.map +1 -1
  14. package/dist/index.rn.js +29 -27
  15. package/dist/index.rn.js.map +1 -1
  16. package/dist/internal.d.ts +3 -3
  17. package/dist/lite/firestore/src/local/remote_document_cache.d.ts +5 -5
  18. package/dist/lite/firestore/test/unit/local/test_remote_document_cache.d.ts +3 -3
  19. package/dist/lite/index.browser.esm2017.js +2 -2
  20. package/dist/lite/index.browser.esm2017.js.map +1 -1
  21. package/dist/lite/index.browser.esm5.js +2 -2
  22. package/dist/lite/index.browser.esm5.js.map +1 -1
  23. package/dist/lite/index.cjs.js +6954 -0
  24. package/dist/lite/index.cjs.js.map +1 -0
  25. package/dist/lite/index.node.cjs.js +2 -2
  26. package/dist/lite/index.node.mjs +2 -2
  27. package/dist/lite/index.node.mjs.map +1 -1
  28. package/dist/lite/index.rn.esm2017.js +2 -2
  29. package/dist/lite/index.rn.esm2017.js.map +1 -1
  30. package/dist/lite/packages/firestore/src/local/remote_document_cache.d.ts +5 -5
  31. package/dist/lite/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +3 -3
  32. package/dist/packages/firestore/src/local/remote_document_cache.d.ts +5 -5
  33. package/dist/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +3 -3
  34. package/dist/private.d.ts +3 -3
  35. package/package.json +17 -9
@@ -8,7 +8,7 @@ import * as grpc from '@grpc/grpc-js';
8
8
  import * as protoLoader from '@grpc/proto-loader';
9
9
 
10
10
  const name = "@firebase/firestore";
11
- const version$1 = "3.8.1";
11
+ const version$1 = "3.8.2-20230201003102";
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.16.0";
64
+ const version = "9.17.0-20230201003102";
65
65
 
66
66
  /**
67
67
  * @license
@@ -13074,7 +13074,8 @@ class IndexedDbRemoteDocumentCacheImpl {
13074
13074
  }
13075
13075
  });
13076
13076
  }
13077
- getAllFromCollection(transaction, collection, offset) {
13077
+ getDocumentsMatchingQuery(transaction, query, offset, mutatedDocs) {
13078
+ const collection = query.path;
13078
13079
  const startKey = [
13079
13080
  collection.popLast().toArray(),
13080
13081
  collection.lastSegment(),
@@ -13095,7 +13096,11 @@ class IndexedDbRemoteDocumentCacheImpl {
13095
13096
  let results = mutableDocumentMap();
13096
13097
  for (const dbRemoteDoc of dbRemoteDocs) {
13097
13098
  const document = this.maybeDecodeDocument(DocumentKey.fromSegments(dbRemoteDoc.prefixPath.concat(dbRemoteDoc.collectionGroup, dbRemoteDoc.documentId)), dbRemoteDoc);
13098
- results = results.insert(document.key, document);
13099
+ if (document.isFoundDocument() &&
13100
+ (queryMatches(query, document) || mutatedDocs.has(document.key))) {
13101
+ // Either the document matches the given query, or it is mutated.
13102
+ results = results.insert(document.key, document);
13103
+ }
13099
13104
  }
13100
13105
  return results;
13101
13106
  });
@@ -13705,14 +13710,14 @@ class LocalDocumentsView {
13705
13710
  }
13706
13711
  getDocumentsMatchingCollectionQuery(transaction, query, offset) {
13707
13712
  // Query the remote documents and overlay mutations.
13708
- let remoteDocuments;
13709
- return this.remoteDocumentCache
13710
- .getAllFromCollection(transaction, query.path, offset)
13711
- .next(queryResults => {
13712
- remoteDocuments = queryResults;
13713
- return this.documentOverlayCache.getOverlaysForCollection(transaction, query.path, offset.largestBatchId);
13713
+ let overlays;
13714
+ return this.documentOverlayCache
13715
+ .getOverlaysForCollection(transaction, query.path, offset.largestBatchId)
13716
+ .next(result => {
13717
+ overlays = result;
13718
+ return this.remoteDocumentCache.getDocumentsMatchingQuery(transaction, query, offset, overlays);
13714
13719
  })
13715
- .next(overlays => {
13720
+ .next(remoteDocuments => {
13716
13721
  // As documents might match the query because of their overlay we need to
13717
13722
  // include documents for all overlays in the initial document set.
13718
13723
  overlays.forEach((_, overlay) => {
@@ -14312,10 +14317,11 @@ class MemoryRemoteDocumentCacheImpl {
14312
14317
  });
14313
14318
  return PersistencePromise.resolve(results);
14314
14319
  }
14315
- getAllFromCollection(transaction, collectionPath, offset) {
14320
+ getDocumentsMatchingQuery(transaction, query, offset, mutatedDocs) {
14316
14321
  let results = mutableDocumentMap();
14317
14322
  // Documents are ordered by key, so we can use a prefix scan to narrow down
14318
14323
  // the documents we need to match the query against.
14324
+ const collectionPath = query.path;
14319
14325
  const prefix = new DocumentKey(collectionPath.child(''));
14320
14326
  const iterator = this.docs.getIteratorFrom(prefix);
14321
14327
  while (iterator.hasNext()) {
@@ -14331,6 +14337,10 @@ class MemoryRemoteDocumentCacheImpl {
14331
14337
  // The document sorts before the offset.
14332
14338
  continue;
14333
14339
  }
14340
+ if (!mutatedDocs.has(document.key) && !queryMatches(query, document)) {
14341
+ // The document cannot possibly match the query.
14342
+ continue;
14343
+ }
14334
14344
  results = results.insert(document.key, document.mutableCopy());
14335
14345
  }
14336
14346
  return PersistencePromise.resolve(results);