@firebase/firestore 3.8.0 → 3.8.1-canary.0bab0b7a7

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 (56) 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.cjs.js +20635 -0
  9. package/dist/index.cjs.js.map +1 -0
  10. package/dist/index.d.ts +2 -1
  11. package/dist/index.esm2017.js +62 -44
  12. package/dist/index.esm2017.js.map +1 -1
  13. package/dist/index.esm5.js +175 -155
  14. package/dist/index.esm5.js.map +1 -1
  15. package/dist/index.node.cjs.js +56 -27
  16. package/dist/index.node.cjs.js.map +1 -1
  17. package/dist/index.node.mjs +56 -27
  18. package/dist/index.node.mjs.map +1 -1
  19. package/dist/index.rn.js +62 -44
  20. package/dist/index.rn.js.map +1 -1
  21. package/dist/internal.d.ts +28 -21
  22. package/dist/lite/firestore/src/api/reference_impl.d.ts +2 -1
  23. package/dist/lite/firestore/src/lite-api/query.d.ts +14 -12
  24. package/dist/lite/firestore/src/local/overlayed_document.d.ts +8 -4
  25. package/dist/lite/firestore/src/local/remote_document_cache.d.ts +5 -5
  26. package/dist/lite/firestore/test/unit/local/counting_query_engine.d.ts +12 -21
  27. package/dist/lite/firestore/test/unit/local/test_remote_document_cache.d.ts +3 -3
  28. package/dist/lite/index.browser.esm2017.js +16 -14
  29. package/dist/lite/index.browser.esm2017.js.map +1 -1
  30. package/dist/lite/index.browser.esm5.js +62 -60
  31. package/dist/lite/index.browser.esm5.js.map +1 -1
  32. package/dist/lite/index.cjs.js +6954 -0
  33. package/dist/lite/index.cjs.js.map +1 -0
  34. package/dist/lite/index.node.cjs.js +16 -14
  35. package/dist/lite/index.node.cjs.js.map +1 -1
  36. package/dist/lite/index.node.mjs +16 -14
  37. package/dist/lite/index.node.mjs.map +1 -1
  38. package/dist/lite/index.rn.esm2017.js +16 -14
  39. package/dist/lite/index.rn.esm2017.js.map +1 -1
  40. package/dist/lite/internal.d.ts +15 -13
  41. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +15 -13
  42. package/dist/lite/packages/firestore/src/api/reference_impl.d.ts +2 -1
  43. package/dist/lite/packages/firestore/src/lite-api/query.d.ts +14 -12
  44. package/dist/lite/packages/firestore/src/local/overlayed_document.d.ts +8 -4
  45. package/dist/lite/packages/firestore/src/local/remote_document_cache.d.ts +5 -5
  46. package/dist/lite/packages/firestore/test/unit/local/counting_query_engine.d.ts +12 -21
  47. package/dist/lite/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +3 -3
  48. package/dist/packages/firestore/dist/index.esm2017.d.ts +17 -14
  49. package/dist/packages/firestore/src/api/reference_impl.d.ts +2 -1
  50. package/dist/packages/firestore/src/lite-api/query.d.ts +14 -12
  51. package/dist/packages/firestore/src/local/overlayed_document.d.ts +8 -4
  52. package/dist/packages/firestore/src/local/remote_document_cache.d.ts +5 -5
  53. package/dist/packages/firestore/test/unit/local/counting_query_engine.d.ts +12 -21
  54. package/dist/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +3 -3
  55. package/dist/private.d.ts +13 -8
  56. package/package.json +19 -11
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?: {