@firebase/firestore 3.8.0 → 3.8.1-canary.27b5e7d70

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 (52) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/firestore/src/api/reference_impl.d.ts +2 -1
  3. package/dist/firestore/src/lite-api/query.d.ts +14 -12
  4. package/dist/firestore/src/local/overlayed_document.d.ts +8 -4
  5. package/dist/firestore/src/local/remote_document_cache.d.ts +5 -5
  6. package/dist/firestore/test/unit/local/counting_query_engine.d.ts +12 -21
  7. package/dist/firestore/test/unit/local/test_remote_document_cache.d.ts +3 -3
  8. package/dist/index.d.ts +2 -1
  9. package/dist/index.esm2017.js +62 -44
  10. package/dist/index.esm2017.js.map +1 -1
  11. package/dist/index.esm5.js +175 -155
  12. package/dist/index.esm5.js.map +1 -1
  13. package/dist/index.node.cjs.js +56 -27
  14. package/dist/index.node.cjs.js.map +1 -1
  15. package/dist/index.node.mjs +56 -27
  16. package/dist/index.node.mjs.map +1 -1
  17. package/dist/index.rn.js +62 -44
  18. package/dist/index.rn.js.map +1 -1
  19. package/dist/internal.d.ts +28 -21
  20. package/dist/lite/firestore/src/api/reference_impl.d.ts +2 -1
  21. package/dist/lite/firestore/src/lite-api/query.d.ts +14 -12
  22. package/dist/lite/firestore/src/local/overlayed_document.d.ts +8 -4
  23. package/dist/lite/firestore/src/local/remote_document_cache.d.ts +5 -5
  24. package/dist/lite/firestore/test/unit/local/counting_query_engine.d.ts +12 -21
  25. package/dist/lite/firestore/test/unit/local/test_remote_document_cache.d.ts +3 -3
  26. package/dist/lite/index.browser.esm2017.js +16 -14
  27. package/dist/lite/index.browser.esm2017.js.map +1 -1
  28. package/dist/lite/index.browser.esm5.js +62 -60
  29. package/dist/lite/index.browser.esm5.js.map +1 -1
  30. package/dist/lite/index.node.cjs.js +16 -14
  31. package/dist/lite/index.node.cjs.js.map +1 -1
  32. package/dist/lite/index.node.mjs +16 -14
  33. package/dist/lite/index.node.mjs.map +1 -1
  34. package/dist/lite/index.rn.esm2017.js +16 -14
  35. package/dist/lite/index.rn.esm2017.js.map +1 -1
  36. package/dist/lite/internal.d.ts +15 -13
  37. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +15 -13
  38. package/dist/lite/packages/firestore/src/api/reference_impl.d.ts +2 -1
  39. package/dist/lite/packages/firestore/src/lite-api/query.d.ts +14 -12
  40. package/dist/lite/packages/firestore/src/local/overlayed_document.d.ts +8 -4
  41. package/dist/lite/packages/firestore/src/local/remote_document_cache.d.ts +5 -5
  42. package/dist/lite/packages/firestore/test/unit/local/counting_query_engine.d.ts +12 -21
  43. package/dist/lite/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +3 -3
  44. package/dist/packages/firestore/dist/index.esm2017.d.ts +17 -14
  45. package/dist/packages/firestore/src/api/reference_impl.d.ts +2 -1
  46. package/dist/packages/firestore/src/lite-api/query.d.ts +14 -12
  47. package/dist/packages/firestore/src/local/overlayed_document.d.ts +8 -4
  48. package/dist/packages/firestore/src/local/remote_document_cache.d.ts +5 -5
  49. package/dist/packages/firestore/test/unit/local/counting_query_engine.d.ts +12 -21
  50. package/dist/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +3 -3
  51. package/dist/private.d.ts +13 -8
  52. package/package.json +9 -9
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @firebase/firestore
2
2
 
3
+ ## 3.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`a7622d49f`](https://github.com/firebase/firebase-js-sdk/commit/a7622d49f8a69bcdfb95b89dd1609a5c495fd529) [#6896](https://github.com/firebase/firebase-js-sdk/pull/6896) - Update canonifyFilter to compute the canonization for flat conjunctions the same as implicit AND queries.
8
+
9
+ - [`1455bfa43`](https://github.com/firebase/firebase-js-sdk/commit/1455bfa4393383ab461de35ccbc2b171f92169df) [#6893](https://github.com/firebase/firebase-js-sdk/pull/6893) - Fix an issue that stops some performance optimization being applied.
10
+
11
+ - [`37f31c57b`](https://github.com/firebase/firebase-js-sdk/commit/37f31c57b62bc6486bc08d9e5c64e2c32d25cb0a) [#6879](https://github.com/firebase/firebase-js-sdk/pull/6879) (fixes [#6851](https://github.com/firebase/firebase-js-sdk/issues/6851)) - Fix documentation for getDocsFromCache.
12
+
13
+ - Updated dependencies [[`d4114a4f7`](https://github.com/firebase/firebase-js-sdk/commit/d4114a4f7da3f469c0c900416ac8beee58885ec3), [`06dc1364d`](https://github.com/firebase/firebase-js-sdk/commit/06dc1364d7560f4c563e1ccc89af9cad4cd91df8)]:
14
+ - @firebase/util@1.9.0
15
+ - @firebase/component@0.6.1
16
+
3
17
  ## 3.8.0
4
18
 
5
19
  ### Minor Changes
@@ -83,7 +83,8 @@ export declare function getDocFromServer<T>(reference: DocumentReference<T>): Pr
83
83
  export declare function getDocs<T>(query: Query<T>): Promise<QuerySnapshot<T>>;
84
84
  /**
85
85
  * Executes the query and returns the results as a `QuerySnapshot` from cache.
86
- * Returns an error if the document is not currently cached.
86
+ * Returns an empty result set if no documents matching the query are currently
87
+ * cached.
87
88
  *
88
89
  * @returns A `Promise` that will be resolved with the results of the query.
89
90
  */
@@ -167,24 +167,26 @@ export declare type QueryNonFilterConstraint = QueryOrderByConstraint | QueryLim
167
167
  */
168
168
  export declare type QueryFilterConstraint = QueryFieldFilterConstraint | QueryCompositeFilterConstraint;
169
169
  /**
170
- * Creates a {@link QueryCompositeFilterConstraint} that performs a logical OR
171
- * of all the provided {@link QueryFilterConstraint}s.
170
+ * Creates a new {@link QueryCompositeFilterConstraint} that is a disjunction of
171
+ * the given filter constraints. A disjunction filter includes a document if it
172
+ * satisfies any of the given filters.
172
173
  *
173
- * @param queryConstraints - Optional. The {@link QueryFilterConstraint}s
174
- * for OR operation. These must be created with calls to {@link where},
175
- * {@link or}, or {@link and}.
176
- * @returns The created {@link QueryCompositeFilterConstraint}.
174
+ * @param queryConstraints - Optional. The list of
175
+ * {@link QueryFilterConstraint}s to perform a disjunction for. These must be
176
+ * created with calls to {@link where}, {@link or}, or {@link and}.
177
+ * @returns The newly created {@link QueryCompositeFilterConstraint}.
177
178
  * @internal TODO remove this internal tag with OR Query support in the server
178
179
  */
179
180
  export declare function or(...queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint;
180
181
  /**
181
- * Creates a {@link QueryCompositeFilterConstraint} that performs a logical AND
182
- * of all the provided {@link QueryFilterConstraint}s.
182
+ * Creates a new {@link QueryCompositeFilterConstraint} that is a conjunction of
183
+ * the given filter constraints. A conjunction filter includes a document if it
184
+ * satisfies all of the given filters.
183
185
  *
184
- * @param queryConstraints - Optional. The {@link QueryFilterConstraint}s
185
- * for AND operation. These must be created with calls to {@link where},
186
- * {@link or}, or {@link and}.
187
- * @returns The created {@link QueryCompositeFilterConstraint}.
186
+ * @param queryConstraints - Optional. The list of
187
+ * {@link QueryFilterConstraint}s to perform a conjunction for. These must be
188
+ * created with calls to {@link where}, {@link or}, or {@link and}.
189
+ * @returns The newly created {@link QueryCompositeFilterConstraint}.
188
190
  * @internal TODO remove this internal tag with OR Query support in the server
189
191
  */
190
192
  export declare function and(...queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint;
@@ -23,14 +23,18 @@ import { FieldMask } from '../model/field_mask';
23
23
  export declare class OverlayedDocument {
24
24
  readonly overlayedDocument: Document;
25
25
  /**
26
- * The fields that are locally mutated by patch mutations. If the overlayed
27
- * document is from set or delete mutations, this returns null.
26
+ * The fields that are locally mutated by patch mutations.
27
+ *
28
+ * If the overlayed document is from set or delete mutations, this is `null`.
29
+ * If there is no overlay (mutation) for the document, this is an empty `FieldMask`.
28
30
  */
29
31
  readonly mutatedFields: FieldMask | null;
30
32
  constructor(overlayedDocument: Document,
31
33
  /**
32
- * The fields that are locally mutated by patch mutations. If the overlayed
33
- * document is from set or delete mutations, this returns null.
34
+ * The fields that are locally mutated by patch mutations.
35
+ *
36
+ * If the overlayed document is from set or delete mutations, this is `null`.
37
+ * If there is no overlay (mutation) for the document, this is an empty `FieldMask`.
34
38
  */
35
39
  mutatedFields: FieldMask | null);
36
40
  }
@@ -14,11 +14,11 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import { DocumentKeySet, MutableDocumentMap } from '../model/collections';
17
+ import { Query } from '../core/query';
18
+ import { DocumentKeySet, MutableDocumentMap, OverlayMap } from '../model/collections';
18
19
  import { MutableDocument } from '../model/document';
19
20
  import { DocumentKey } from '../model/document_key';
20
21
  import { IndexOffset } from '../model/field_index';
21
- import { ResourcePath } from '../model/path';
22
22
  import { IndexManager } from './index_manager';
23
23
  import { PersistencePromise } from './persistence_promise';
24
24
  import { PersistenceTransaction } from './persistence_transaction';
@@ -50,13 +50,13 @@ export interface RemoteDocumentCache {
50
50
  */
51
51
  getEntries(transaction: PersistenceTransaction, documentKeys: DocumentKeySet): PersistencePromise<MutableDocumentMap>;
52
52
  /**
53
- * Returns the documents from the provided collection.
53
+ * Returns the documents matching the given query
54
54
  *
55
- * @param collection - The collection to read.
55
+ * @param query - The query to match documents against.
56
56
  * @param offset - The offset to start the scan at (exclusive).
57
57
  * @returns The set of matching documents.
58
58
  */
59
- getAllFromCollection(transaction: PersistenceTransaction, collection: ResourcePath, offset: IndexOffset): PersistencePromise<MutableDocumentMap>;
59
+ getDocumentsMatchingQuery(transaction: PersistenceTransaction, query: Query, offset: IndexOffset, mutatedDocs: OverlayMap): PersistencePromise<MutableDocumentMap>;
60
60
  /**
61
61
  * Looks up the next `limit` documents for a collection group based on the
62
62
  * provided offset. The ordering is based on the document's read time and key.
@@ -22,27 +22,29 @@ import { PersistencePromise } from '../../../src/local/persistence_promise';
22
22
  import { PersistenceTransaction } from '../../../src/local/persistence_transaction';
23
23
  import { QueryEngine } from '../../../src/local/query_engine';
24
24
  import { DocumentKeySet, DocumentMap } from '../../../src/model/collections';
25
+ import { MutationType } from '../../../src/model/mutation';
25
26
  /**
26
27
  * A test-only query engine that forwards all API calls and exposes the number
27
28
  * of documents and mutations read.
28
29
  */
29
30
  export declare class CountingQueryEngine extends QueryEngine {
30
31
  /**
31
- * The number of mutations returned by the MutationQueue's
32
- * `getAllMutationBatchesAffectingQuery()` API (since the last call to
32
+ * The number of overlays returned by the DocumentOverlayCache's
33
+ * `getOverlaysByCollection(Group)` API (since the last call to
33
34
  * `resetCounts()`)
34
35
  */
35
- mutationsReadByCollection: number;
36
+ overlaysReadByCollection: number;
36
37
  /**
37
- * The number of mutations returned by the MutationQueue's
38
- * `getAllMutationBatchesAffectingDocumentKey()` and
39
- * `getAllMutationBatchesAffectingDocumentKeys()` APIs (since the last call
40
- * to `resetCounts()`)
38
+ * The number of overlays returned by the DocumentOverlayCache's
39
+ * `getOverlay(s)` APIs (since the last call to `resetCounts()`)
41
40
  */
42
- mutationsReadByKey: number;
41
+ overlaysReadByKey: number;
42
+ overlayTypes: {
43
+ [k: string]: MutationType;
44
+ };
43
45
  /**
44
46
  * The number of documents returned by the RemoteDocumentCache's
45
- * `getAll()` API (since the last call to `resetCounts()`)
47
+ * `getAll()` API (since the last call to `resetCounts()`).
46
48
  */
47
49
  documentsReadByCollection: number;
48
50
  /**
@@ -50,20 +52,9 @@ export declare class CountingQueryEngine extends QueryEngine {
50
52
  * and `getEntries()` APIs (since the last call to `resetCounts()`)
51
53
  */
52
54
  documentsReadByKey: number;
53
- /**
54
- * The number of documents returned by the OverlayCache's `getOverlays()`
55
- * API (since the last call to `resetCounts()`)
56
- */
57
- overlaysReadByCollection: number;
58
- /**
59
- * The number of documents returned by the OverlayCache's `getOverlay()`
60
- * APIs (since the last call to `resetCounts()`)
61
- */
62
- overlaysReadByKey: number;
63
55
  resetCounts(): void;
64
56
  getDocumentsMatchingQuery(transaction: PersistenceTransaction, query: Query, lastLimboFreeSnapshotVersion: SnapshotVersion, remoteKeys: DocumentKeySet): PersistencePromise<DocumentMap>;
65
57
  initialize(localDocuments: LocalDocumentsView, indexManager: IndexManager): void;
66
58
  private wrapRemoteDocumentCache;
67
- private wrapMutationQueue;
68
- private wrapDocumentOverlayCache;
59
+ private wrapOverlayCache;
69
60
  }
@@ -14,15 +14,15 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ import { Query } from '../../../src/core/query';
17
18
  import { SnapshotVersion } from '../../../src/core/snapshot_version';
18
19
  import { IndexManager } from '../../../src/local/index_manager';
19
20
  import { Persistence } from '../../../src/local/persistence';
20
21
  import { RemoteDocumentChangeBuffer } from '../../../src/local/remote_document_change_buffer';
21
- import { DocumentKeySet, MutableDocumentMap } from '../../../src/model/collections';
22
+ import { DocumentKeySet, MutableDocumentMap, OverlayMap } from '../../../src/model/collections';
22
23
  import { MutableDocument } from '../../../src/model/document';
23
24
  import { DocumentKey } from '../../../src/model/document_key';
24
25
  import { IndexOffset } from '../../../src/model/field_index';
25
- import { ResourcePath } from '../../../src/model/path';
26
26
  /**
27
27
  * A wrapper around a RemoteDocumentCache that automatically creates a
28
28
  * transaction around every operation to reduce test boilerplate.
@@ -45,7 +45,7 @@ export declare class TestRemoteDocumentCache {
45
45
  removeEntry(documentKey: DocumentKey, version?: SnapshotVersion): Promise<void>;
46
46
  getEntry(documentKey: DocumentKey): Promise<MutableDocument>;
47
47
  getEntries(documentKeys: DocumentKeySet): Promise<MutableDocumentMap>;
48
- getAllFromCollection(collection: ResourcePath, offset: IndexOffset): Promise<MutableDocumentMap>;
48
+ getDocumentsMatchingQuery(query: Query, offset: IndexOffset, mutatedDocs: OverlayMap): Promise<MutableDocumentMap>;
49
49
  getAllFromCollectionGroup(collectionGroup: string, offset: IndexOffset, limit: number): Promise<MutableDocumentMap>;
50
50
  getSize(): Promise<number>;
51
51
  newChangeBuffer(options?: {
package/dist/index.d.ts CHANGED
@@ -974,7 +974,8 @@ export declare function getDocFromServer<T>(reference: DocumentReference<T>): Pr
974
974
  export declare function getDocs<T>(query: Query<T>): Promise<QuerySnapshot<T>>;
975
975
  /**
976
976
  * Executes the query and returns the results as a `QuerySnapshot` from cache.
977
- * Returns an error if the document is not currently cached.
977
+ * Returns an empty result set if no documents matching the query are currently
978
+ * cached.
978
979
  *
979
980
  * @returns A `Promise` that will be resolved with the results of the query.
980
981
  */
@@ -66,7 +66,7 @@ P.MOCK_USER = new P("mock-user");
66
66
  * See the License for the specific language governing permissions and
67
67
  * limitations under the License.
68
68
  */
69
- let v = "9.15.0";
69
+ let v = "9.16.0-canary.27b5e7d70";
70
70
 
71
71
  /**
72
72
  * @license
@@ -2994,6 +2994,14 @@ function De(t) {
2994
2994
  // the same description, such as the int 3 and the string "3". So we should
2995
2995
  // add the types in here somehow, too.
2996
2996
  return t.field.canonicalString() + t.op.toString() + oe(t.value);
2997
+ if (Ve(t))
2998
+ // Older SDK versions use an implicit AND operation between their filters.
2999
+ // In the new SDK versions, the developer may use an explicit AND filter.
3000
+ // To stay consistent with the old usages, we add a special case to ensure
3001
+ // the canonical ID for these two are the same. For example:
3002
+ // `col.whereEquals("a", 1).whereEquals("b", 2)` should have the same
3003
+ // canonical ID as `col.where(and(equals("a",1), equals("b",2)))`.
3004
+ return t.filters.map((t => De(t))).join(",");
2997
3005
  {
2998
3006
  // filter instanceof CompositeFilter
2999
3007
  const e = t.filters.map((t => De(t))).join(",");
@@ -9546,15 +9554,17 @@ function uo(t, e) {
9546
9554
  for (;o; ) n(o, null), o = r.hasNext() ? r.getNext() : null;
9547
9555
  }));
9548
9556
  }
9549
- getAllFromCollection(t, e, n) {
9550
- const s = [ e.popLast().toArray(), e.lastSegment(), Xi(n.readTime), n.documentKey.path.isEmpty() ? "" : n.documentKey.path.lastSegment() ], i = [ e.popLast().toArray(), e.lastSegment(), [ Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER ], "" ];
9551
- return _o(t).W(IDBKeyRange.bound(s, i, !0)).next((t => {
9552
- let e = ds();
9553
- for (const n of t) {
9554
- const t = this.jn(ct.fromSegments(n.prefixPath.concat(n.collectionGroup, n.documentId)), n);
9555
- e = e.insert(t.key, t);
9557
+ getDocumentsMatchingQuery(t, e, n, s) {
9558
+ const i = e.path, r = [ i.popLast().toArray(), i.lastSegment(), Xi(n.readTime), n.documentKey.path.isEmpty() ? "" : n.documentKey.path.lastSegment() ], o = [ i.popLast().toArray(), i.lastSegment(), [ Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER ], "" ];
9559
+ return _o(t).W(IDBKeyRange.bound(r, o, !0)).next((t => {
9560
+ let n = ds();
9561
+ for (const i of t) {
9562
+ const t = this.jn(ct.fromSegments(i.prefixPath.concat(i.collectionGroup, i.documentId)), i);
9563
+ t.isFoundDocument() && (An(e, t) || s.has(t.key)) && (
9564
+ // Either the document matches the given query, or it is mutated.
9565
+ n = n.insert(t.key, t));
9556
9566
  }
9557
- return e;
9567
+ return n;
9558
9568
  }));
9559
9569
  }
9560
9570
  getAllFromCollectionGroup(t, e, n, s) {
@@ -9769,8 +9779,10 @@ function mo(t, e) {
9769
9779
  class yo {
9770
9780
  constructor(t,
9771
9781
  /**
9772
- * The fields that are locally mutated by patch mutations. If the overlayed
9773
- * document is from set or delete mutations, this returns null.
9782
+ * The fields that are locally mutated by patch mutations.
9783
+ *
9784
+ * If the overlayed document is from set or delete mutations, this is `null`.
9785
+ * If there is no overlay (mutation) for the document, this is an empty `FieldMask`.
9774
9786
  */
9775
9787
  e) {
9776
9788
  this.overlayedDocument = t, this.mutatedFields = e;
@@ -9883,8 +9895,11 @@ class yo {
9883
9895
  // NOTE: we recalculate when `overlay` is undefined as well, because there
9884
9896
  // might be a patch mutation whose precondition does not match before the
9885
9897
  // change (hence overlay is undefined), but would now match.
9886
- s.has(e.key) && (void 0 === o || o.mutation instanceof ts) ? i = i.insert(e.key, e) : void 0 !== o && (r.set(e.key, o.mutation.getFieldMask()),
9887
- Jn(o.mutation, e, o.mutation.getFieldMask(), nt.now()));
9898
+ s.has(e.key) && (void 0 === o || o.mutation instanceof ts) ? i = i.insert(e.key, e) : void 0 !== o ? (r.set(e.key, o.mutation.getFieldMask()),
9899
+ Jn(o.mutation, e, o.mutation.getFieldMask(), nt.now())) :
9900
+ // no overlay exists
9901
+ // Using EMPTY to indicate there is no overlay for the document.
9902
+ r.set(e.key, Je.empty());
9888
9903
  })), this.recalculateAndSaveOverlays(t, i).next((t => (t.forEach(((t, e) => r.set(t, e))),
9889
9904
  e.forEach(((t, e) => {
9890
9905
  var n;
@@ -9997,21 +10012,21 @@ class yo {
9997
10012
  getDocumentsMatchingCollectionQuery(t, e, n) {
9998
10013
  // Query the remote documents and overlay mutations.
9999
10014
  let s;
10000
- return this.remoteDocumentCache.getAllFromCollection(t, e.path, n).next((i => (s = i,
10001
- this.documentOverlayCache.getOverlaysForCollection(t, e.path, n.largestBatchId)))).next((t => {
10015
+ return this.documentOverlayCache.getOverlaysForCollection(t, e.path, n.largestBatchId).next((i => (s = i,
10016
+ this.remoteDocumentCache.getDocumentsMatchingQuery(t, e, n, s)))).next((t => {
10002
10017
  // As documents might match the query because of their overlay we need to
10003
10018
  // include documents for all overlays in the initial document set.
10004
- t.forEach(((t, e) => {
10005
- const n = e.getKey();
10006
- null === s.get(n) && (s = s.insert(n, Ze.newInvalidDocument(n)));
10019
+ s.forEach(((e, n) => {
10020
+ const s = n.getKey();
10021
+ null === t.get(s) && (t = t.insert(s, Ze.newInvalidDocument(s)));
10007
10022
  }));
10008
10023
  // Apply the overlays and match against the query.
10009
10024
  let n = ws();
10010
- return s.forEach(((s, i) => {
10011
- const r = t.get(s);
10025
+ return t.forEach(((t, i) => {
10026
+ const r = s.get(t);
10012
10027
  void 0 !== r && Jn(r.mutation, i, Je.empty(), nt.now()),
10013
10028
  // Finally, insert the documents that still match the query
10014
- An(e, i) && (n = n.insert(s, i));
10029
+ An(e, i) && (n = n.insert(t, i));
10015
10030
  })), n;
10016
10031
  }));
10017
10032
  }
@@ -10472,17 +10487,17 @@ class bo {
10472
10487
  n = n.insert(t, e ? e.document.mutableCopy() : Ze.newInvalidDocument(t));
10473
10488
  })), At.resolve(n);
10474
10489
  }
10475
- getAllFromCollection(t, e, n) {
10476
- let s = ds();
10490
+ getDocumentsMatchingQuery(t, e, n, s) {
10491
+ let i = ds();
10477
10492
  // Documents are ordered by key, so we can use a prefix scan to narrow down
10478
10493
  // the documents we need to match the query against.
10479
- const i = new ct(e.child("")), r = this.docs.getIteratorFrom(i);
10480
- for (;r.hasNext(); ) {
10481
- const {key: t, value: {document: i}} = r.getNext();
10482
- if (!e.isPrefixOf(t.path)) break;
10483
- t.path.length > e.length + 1 || (pt(gt(i), n) <= 0 || (s = s.insert(i.key, i.mutableCopy())));
10494
+ const r = e.path, o = new ct(r.child("")), u = this.docs.getIteratorFrom(o);
10495
+ for (;u.hasNext(); ) {
10496
+ const {key: t, value: {document: o}} = u.getNext();
10497
+ if (!r.isPrefixOf(t.path)) break;
10498
+ t.path.length > r.length + 1 || (pt(gt(o), n) <= 0 || (s.has(o.key) || An(e, o)) && (i = i.insert(o.key, o.mutableCopy())));
10484
10499
  }
10485
- return At.resolve(s);
10500
+ return At.resolve(i);
10486
10501
  }
10487
10502
  getAllFromCollectionGroup(t, e, n, s) {
10488
10503
  // This method should only be called from the IndexBackfiller if persistence
@@ -19040,13 +19055,14 @@ function sl(t, e, ...n) {
19040
19055
  }
19041
19056
 
19042
19057
  /**
19043
- * Creates a {@link QueryCompositeFilterConstraint} that performs a logical OR
19044
- * of all the provided {@link QueryFilterConstraint}s.
19058
+ * Creates a new {@link QueryCompositeFilterConstraint} that is a disjunction of
19059
+ * the given filter constraints. A disjunction filter includes a document if it
19060
+ * satisfies any of the given filters.
19045
19061
  *
19046
- * @param queryConstraints - Optional. The {@link QueryFilterConstraint}s
19047
- * for OR operation. These must be created with calls to {@link where},
19048
- * {@link or}, or {@link and}.
19049
- * @returns The created {@link QueryCompositeFilterConstraint}.
19062
+ * @param queryConstraints - Optional. The list of
19063
+ * {@link QueryFilterConstraint}s to perform a disjunction for. These must be
19064
+ * created with calls to {@link where}, {@link or}, or {@link and}.
19065
+ * @returns The newly created {@link QueryCompositeFilterConstraint}.
19050
19066
  * @internal TODO remove this internal tag with OR Query support in the server
19051
19067
  */ function ul(...t) {
19052
19068
  // Only support QueryFilterConstraints
@@ -19054,13 +19070,14 @@ function sl(t, e, ...n) {
19054
19070
  }
19055
19071
 
19056
19072
  /**
19057
- * Creates a {@link QueryCompositeFilterConstraint} that performs a logical AND
19058
- * of all the provided {@link QueryFilterConstraint}s.
19073
+ * Creates a new {@link QueryCompositeFilterConstraint} that is a conjunction of
19074
+ * the given filter constraints. A conjunction filter includes a document if it
19075
+ * satisfies all of the given filters.
19059
19076
  *
19060
- * @param queryConstraints - Optional. The {@link QueryFilterConstraint}s
19061
- * for AND operation. These must be created with calls to {@link where},
19062
- * {@link or}, or {@link and}.
19063
- * @returns The created {@link QueryCompositeFilterConstraint}.
19077
+ * @param queryConstraints - Optional. The list of
19078
+ * {@link QueryFilterConstraint}s to perform a conjunction for. These must be
19079
+ * created with calls to {@link where}, {@link or}, or {@link and}.
19080
+ * @returns The newly created {@link QueryCompositeFilterConstraint}.
19064
19081
  * @internal TODO remove this internal tag with OR Query support in the server
19065
19082
  */ function cl(...t) {
19066
19083
  // Only support QueryFilterConstraints
@@ -19840,7 +19857,8 @@ class Ml extends Pl {
19840
19857
 
19841
19858
  /**
19842
19859
  * Executes the query and returns the results as a `QuerySnapshot` from cache.
19843
- * Returns an error if the document is not currently cached.
19860
+ * Returns an empty result set if no documents matching the query are currently
19861
+ * cached.
19844
19862
  *
19845
19863
  * @returns A `Promise` that will be resolved with the results of the query.
19846
19864
  */ function Ll(t) {
@@ -20512,9 +20530,9 @@ function lf(t, e) {
20512
20530
  return s = Object.assign({
20513
20531
  useFetchStreams: e
20514
20532
  }, s), r._setSettings(s), r;
20515
- }), "PUBLIC").setMultipleInstances(!0)), registerVersion(b, "3.8.0", t),
20533
+ }), "PUBLIC").setMultipleInstances(!0)), registerVersion(b, "3.8.1-canary.27b5e7d70", t),
20516
20534
  // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
20517
- registerVersion(b, "3.8.0", "esm2017");
20535
+ registerVersion(b, "3.8.1-canary.27b5e7d70", "esm2017");
20518
20536
  }();
20519
20537
 
20520
20538
  export { Pl as AbstractUserDataWriter, Sa as AggregateField, Da as AggregateQuerySnapshot, Ih as Bytes, sh as CACHE_SIZE_UNLIMITED, Ia as CollectionReference, ya as DocumentReference, Dl as DocumentSnapshot, Th as FieldPath, Ah as FieldValue, ih as Firestore, L as FirestoreError, Rh as GeoPoint, nh as LoadBundleTask, pa as Query, ol as QueryCompositeFilterConstraint, nl as QueryConstraint, Cl as QueryDocumentSnapshot, gl as QueryEndAtConstraint, il as QueryFieldFilterConstraint, ll as QueryLimitConstraint, al as QueryOrderByConstraint, xl as QuerySnapshot, _l as QueryStartAtConstraint, Sl as SnapshotMetadata, nt as Timestamp, ef as Transaction, Zl as WriteBatch, Ft as _DatabaseId, ct as _DocumentKey, J as _EmptyAppCheckTokenProvider, K as _EmptyAuthCredentialsProvider, ut as _FieldPath, fa as _cast, F as _debugAssert, Gt as _isBase64Available, N as _logWarn, ca as _validateIsNotUsedTogether, Ql as addDoc, Jl as aggregateQuerySnapshotEqual, cl as and, uf as arrayRemove, of as arrayUnion, fh as clearIndexedDbPersistence, Ta as collection, Ea as collectionGroup, ga as connectFirestoreEmulator, Gl as deleteDoc, sf as deleteField, wh as disableNetwork, Aa as doc, Eh as documentId, ah as enableIndexedDbPersistence, hh as enableMultiTabIndexedDbPersistence, _h as enableNetwork, pl as endAt, yl as endBefore, uh as ensureFirestoreConfigured, zl as executeWrite, Yl as getCountFromServer, Ol as getDoc, Fl as getDocFromCache, $l as getDocFromServer, Bl as getDocs, Ll as getDocsFromCache, ql as getDocsFromServer, oh as getFirestore, cf as increment, rh as initializeFirestore, fl as limit, dl as limitToLast, gh as loadBundle, yh as namedQuery, jl as onSnapshot, Wl as onSnapshotsInSync, ul as or, hl as orderBy, sl as query, ba as queryEqual, Ra as refEqual, nf as runTransaction, rf as serverTimestamp, Ul as setDoc, hf as setIndexConfiguration, D as setLogLevel, kl as snapshotEqual, ml as startAfter, wl as startAt, mh as terminate, Kl as updateDoc, dh as waitForPendingWrites, rl as where, af as writeBatch };