@firebase/firestore 3.8.0 → 3.8.1-canary.68369740a

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 (44) 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/test/unit/local/counting_query_engine.d.ts +12 -21
  6. package/dist/index.d.ts +2 -1
  7. package/dist/index.esm2017.js +36 -20
  8. package/dist/index.esm2017.js.map +1 -1
  9. package/dist/index.esm5.js +38 -20
  10. package/dist/index.esm5.js.map +1 -1
  11. package/dist/index.node.cjs.js +36 -17
  12. package/dist/index.node.cjs.js.map +1 -1
  13. package/dist/index.node.mjs +36 -17
  14. package/dist/index.node.mjs.map +1 -1
  15. package/dist/index.rn.js +36 -20
  16. package/dist/index.rn.js.map +1 -1
  17. package/dist/internal.d.ts +25 -18
  18. package/dist/lite/firestore/src/api/reference_impl.d.ts +2 -1
  19. package/dist/lite/firestore/src/lite-api/query.d.ts +14 -12
  20. package/dist/lite/firestore/src/local/overlayed_document.d.ts +8 -4
  21. package/dist/lite/firestore/test/unit/local/counting_query_engine.d.ts +12 -21
  22. package/dist/lite/index.browser.esm2017.js +16 -14
  23. package/dist/lite/index.browser.esm2017.js.map +1 -1
  24. package/dist/lite/index.browser.esm5.js +17 -15
  25. package/dist/lite/index.browser.esm5.js.map +1 -1
  26. package/dist/lite/index.node.cjs.js +16 -14
  27. package/dist/lite/index.node.cjs.js.map +1 -1
  28. package/dist/lite/index.node.mjs +16 -14
  29. package/dist/lite/index.node.mjs.map +1 -1
  30. package/dist/lite/index.rn.esm2017.js +16 -14
  31. package/dist/lite/index.rn.esm2017.js.map +1 -1
  32. package/dist/lite/internal.d.ts +15 -13
  33. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +15 -13
  34. package/dist/lite/packages/firestore/src/api/reference_impl.d.ts +2 -1
  35. package/dist/lite/packages/firestore/src/lite-api/query.d.ts +14 -12
  36. package/dist/lite/packages/firestore/src/local/overlayed_document.d.ts +8 -4
  37. package/dist/lite/packages/firestore/test/unit/local/counting_query_engine.d.ts +12 -21
  38. package/dist/packages/firestore/dist/index.esm2017.d.ts +17 -14
  39. package/dist/packages/firestore/src/api/reference_impl.d.ts +2 -1
  40. package/dist/packages/firestore/src/lite-api/query.d.ts +14 -12
  41. package/dist/packages/firestore/src/local/overlayed_document.d.ts +8 -4
  42. package/dist/packages/firestore/test/unit/local/counting_query_engine.d.ts +12 -21
  43. package/dist/private.d.ts +10 -5
  44. 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
  }
@@ -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
  }
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.68369740a";
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(",");
@@ -9769,8 +9777,10 @@ function mo(t, e) {
9769
9777
  class yo {
9770
9778
  constructor(t,
9771
9779
  /**
9772
- * The fields that are locally mutated by patch mutations. If the overlayed
9773
- * document is from set or delete mutations, this returns null.
9780
+ * The fields that are locally mutated by patch mutations.
9781
+ *
9782
+ * If the overlayed document is from set or delete mutations, this is `null`.
9783
+ * If there is no overlay (mutation) for the document, this is an empty `FieldMask`.
9774
9784
  */
9775
9785
  e) {
9776
9786
  this.overlayedDocument = t, this.mutatedFields = e;
@@ -9883,8 +9893,11 @@ class yo {
9883
9893
  // NOTE: we recalculate when `overlay` is undefined as well, because there
9884
9894
  // might be a patch mutation whose precondition does not match before the
9885
9895
  // 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()));
9896
+ 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()),
9897
+ Jn(o.mutation, e, o.mutation.getFieldMask(), nt.now())) :
9898
+ // no overlay exists
9899
+ // Using EMPTY to indicate there is no overlay for the document.
9900
+ r.set(e.key, Je.empty());
9888
9901
  })), this.recalculateAndSaveOverlays(t, i).next((t => (t.forEach(((t, e) => r.set(t, e))),
9889
9902
  e.forEach(((t, e) => {
9890
9903
  var n;
@@ -19040,13 +19053,14 @@ function sl(t, e, ...n) {
19040
19053
  }
19041
19054
 
19042
19055
  /**
19043
- * Creates a {@link QueryCompositeFilterConstraint} that performs a logical OR
19044
- * of all the provided {@link QueryFilterConstraint}s.
19056
+ * Creates a new {@link QueryCompositeFilterConstraint} that is a disjunction of
19057
+ * the given filter constraints. A disjunction filter includes a document if it
19058
+ * satisfies any of the given filters.
19045
19059
  *
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}.
19060
+ * @param queryConstraints - Optional. The list of
19061
+ * {@link QueryFilterConstraint}s to perform a disjunction for. These must be
19062
+ * created with calls to {@link where}, {@link or}, or {@link and}.
19063
+ * @returns The newly created {@link QueryCompositeFilterConstraint}.
19050
19064
  * @internal TODO remove this internal tag with OR Query support in the server
19051
19065
  */ function ul(...t) {
19052
19066
  // Only support QueryFilterConstraints
@@ -19054,13 +19068,14 @@ function sl(t, e, ...n) {
19054
19068
  }
19055
19069
 
19056
19070
  /**
19057
- * Creates a {@link QueryCompositeFilterConstraint} that performs a logical AND
19058
- * of all the provided {@link QueryFilterConstraint}s.
19071
+ * Creates a new {@link QueryCompositeFilterConstraint} that is a conjunction of
19072
+ * the given filter constraints. A conjunction filter includes a document if it
19073
+ * satisfies all of the given filters.
19059
19074
  *
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}.
19075
+ * @param queryConstraints - Optional. The list of
19076
+ * {@link QueryFilterConstraint}s to perform a conjunction for. These must be
19077
+ * created with calls to {@link where}, {@link or}, or {@link and}.
19078
+ * @returns The newly created {@link QueryCompositeFilterConstraint}.
19064
19079
  * @internal TODO remove this internal tag with OR Query support in the server
19065
19080
  */ function cl(...t) {
19066
19081
  // Only support QueryFilterConstraints
@@ -19840,7 +19855,8 @@ class Ml extends Pl {
19840
19855
 
19841
19856
  /**
19842
19857
  * Executes the query and returns the results as a `QuerySnapshot` from cache.
19843
- * Returns an error if the document is not currently cached.
19858
+ * Returns an empty result set if no documents matching the query are currently
19859
+ * cached.
19844
19860
  *
19845
19861
  * @returns A `Promise` that will be resolved with the results of the query.
19846
19862
  */ function Ll(t) {
@@ -20512,9 +20528,9 @@ function lf(t, e) {
20512
20528
  return s = Object.assign({
20513
20529
  useFetchStreams: e
20514
20530
  }, s), r._setSettings(s), r;
20515
- }), "PUBLIC").setMultipleInstances(!0)), registerVersion(b, "3.8.0", t),
20531
+ }), "PUBLIC").setMultipleInstances(!0)), registerVersion(b, "3.8.1-canary.68369740a", t),
20516
20532
  // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
20517
- registerVersion(b, "3.8.0", "esm2017");
20533
+ registerVersion(b, "3.8.1-canary.68369740a", "esm2017");
20518
20534
  }();
20519
20535
 
20520
20536
  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 };