@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
@@ -33,7 +33,7 @@ var grpc__namespace = /*#__PURE__*/_interopNamespace(grpc);
33
33
  var protoLoader__namespace = /*#__PURE__*/_interopNamespace(protoLoader);
34
34
 
35
35
  const name = "@firebase/firestore";
36
- const version$1 = "3.8.1";
36
+ const version$1 = "3.8.2-20230201003102";
37
37
 
38
38
  /**
39
39
  * @license
@@ -86,7 +86,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
86
86
  User.FIRST_PARTY = new User('first-party-uid');
87
87
  User.MOCK_USER = new User('mock-user');
88
88
 
89
- const version = "9.16.0";
89
+ const version = "9.17.0-20230201003102";
90
90
 
91
91
  /**
92
92
  * @license
@@ -13099,7 +13099,8 @@ class IndexedDbRemoteDocumentCacheImpl {
13099
13099
  }
13100
13100
  });
13101
13101
  }
13102
- getAllFromCollection(transaction, collection, offset) {
13102
+ getDocumentsMatchingQuery(transaction, query, offset, mutatedDocs) {
13103
+ const collection = query.path;
13103
13104
  const startKey = [
13104
13105
  collection.popLast().toArray(),
13105
13106
  collection.lastSegment(),
@@ -13120,7 +13121,11 @@ class IndexedDbRemoteDocumentCacheImpl {
13120
13121
  let results = mutableDocumentMap();
13121
13122
  for (const dbRemoteDoc of dbRemoteDocs) {
13122
13123
  const document = this.maybeDecodeDocument(DocumentKey.fromSegments(dbRemoteDoc.prefixPath.concat(dbRemoteDoc.collectionGroup, dbRemoteDoc.documentId)), dbRemoteDoc);
13123
- results = results.insert(document.key, document);
13124
+ if (document.isFoundDocument() &&
13125
+ (queryMatches(query, document) || mutatedDocs.has(document.key))) {
13126
+ // Either the document matches the given query, or it is mutated.
13127
+ results = results.insert(document.key, document);
13128
+ }
13124
13129
  }
13125
13130
  return results;
13126
13131
  });
@@ -13730,14 +13735,14 @@ class LocalDocumentsView {
13730
13735
  }
13731
13736
  getDocumentsMatchingCollectionQuery(transaction, query, offset) {
13732
13737
  // Query the remote documents and overlay mutations.
13733
- let remoteDocuments;
13734
- return this.remoteDocumentCache
13735
- .getAllFromCollection(transaction, query.path, offset)
13736
- .next(queryResults => {
13737
- remoteDocuments = queryResults;
13738
- return this.documentOverlayCache.getOverlaysForCollection(transaction, query.path, offset.largestBatchId);
13738
+ let overlays;
13739
+ return this.documentOverlayCache
13740
+ .getOverlaysForCollection(transaction, query.path, offset.largestBatchId)
13741
+ .next(result => {
13742
+ overlays = result;
13743
+ return this.remoteDocumentCache.getDocumentsMatchingQuery(transaction, query, offset, overlays);
13739
13744
  })
13740
- .next(overlays => {
13745
+ .next(remoteDocuments => {
13741
13746
  // As documents might match the query because of their overlay we need to
13742
13747
  // include documents for all overlays in the initial document set.
13743
13748
  overlays.forEach((_, overlay) => {
@@ -14337,10 +14342,11 @@ class MemoryRemoteDocumentCacheImpl {
14337
14342
  });
14338
14343
  return PersistencePromise.resolve(results);
14339
14344
  }
14340
- getAllFromCollection(transaction, collectionPath, offset) {
14345
+ getDocumentsMatchingQuery(transaction, query, offset, mutatedDocs) {
14341
14346
  let results = mutableDocumentMap();
14342
14347
  // Documents are ordered by key, so we can use a prefix scan to narrow down
14343
14348
  // the documents we need to match the query against.
14349
+ const collectionPath = query.path;
14344
14350
  const prefix = new DocumentKey(collectionPath.child(''));
14345
14351
  const iterator = this.docs.getIteratorFrom(prefix);
14346
14352
  while (iterator.hasNext()) {
@@ -14356,6 +14362,10 @@ class MemoryRemoteDocumentCacheImpl {
14356
14362
  // The document sorts before the offset.
14357
14363
  continue;
14358
14364
  }
14365
+ if (!mutatedDocs.has(document.key) && !queryMatches(query, document)) {
14366
+ // The document cannot possibly match the query.
14367
+ continue;
14368
+ }
14359
14369
  results = results.insert(document.key, document.mutableCopy());
14360
14370
  }
14361
14371
  return PersistencePromise.resolve(results);