@firebase/firestore 4.4.0-20231120214520 → 4.4.0-20231122201901

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.
@@ -98,13 +98,16 @@ export declare class View {
98
98
  * Updates the view with the given ViewDocumentChanges and optionally updates
99
99
  * limbo docs and sync state from the provided target change.
100
100
  * @param docChanges - The set of changes to make to the view's docs.
101
- * @param updateLimboDocuments - Whether to update limbo documents based on
101
+ * @param limboResolutionEnabled - Whether to update limbo documents based on
102
102
  * this change.
103
103
  * @param targetChange - A target change to apply for computing limbo docs and
104
104
  * sync state.
105
+ * @param targetIsPendingReset - Whether the target is pending to reset due to
106
+ * existence filter mismatch. If not explicitly specified, it is treated
107
+ * equivalently to `false`.
105
108
  * @returns A new ViewChange with the given docs, changes, and sync state.
106
109
  */
107
- applyChanges(docChanges: ViewDocumentChanges, updateLimboDocuments: boolean, targetChange?: TargetChange): ViewChange;
110
+ applyChanges(docChanges: ViewDocumentChanges, limboResolutionEnabled: boolean, targetChange?: TargetChange, targetIsPendingReset?: boolean): ViewChange;
108
111
  /**
109
112
  * Applies an OnlineState change to the view, potentially generating a
110
113
  * ViewChange if the view's syncState changes as a result.
package/dist/index.cjs.js CHANGED
@@ -70,7 +70,7 @@ User.MOCK_USER = new User("mock-user");
70
70
  * See the License for the specific language governing permissions and
71
71
  * limitations under the License.
72
72
  */
73
- let S = "10.7.0-20231120214520";
73
+ let S = "10.7.0-20231122201901";
74
74
 
75
75
  /**
76
76
  * @license
@@ -15715,19 +15715,22 @@ class __PRIVATE_RemovedLimboDocument {
15715
15715
  * Updates the view with the given ViewDocumentChanges and optionally updates
15716
15716
  * limbo docs and sync state from the provided target change.
15717
15717
  * @param docChanges - The set of changes to make to the view's docs.
15718
- * @param updateLimboDocuments - Whether to update limbo documents based on
15718
+ * @param limboResolutionEnabled - Whether to update limbo documents based on
15719
15719
  * this change.
15720
15720
  * @param targetChange - A target change to apply for computing limbo docs and
15721
15721
  * sync state.
15722
+ * @param targetIsPendingReset - Whether the target is pending to reset due to
15723
+ * existence filter mismatch. If not explicitly specified, it is treated
15724
+ * equivalently to `false`.
15722
15725
  * @returns A new ViewChange with the given docs, changes, and sync state.
15723
15726
  */
15724
15727
  // PORTING NOTE: The iOS/Android clients always compute limbo document changes.
15725
- applyChanges(e, t, n) {
15726
- const r = this.aa;
15728
+ applyChanges(e, t, n, r) {
15729
+ const i = this.aa;
15727
15730
  this.aa = e.aa, this.mutatedKeys = e.mutatedKeys;
15728
15731
  // Sort changes based on type and query comparator
15729
- const i = e.la.L_();
15730
- i.sort(((e, t) => function __PRIVATE_compareChangeType(e, t) {
15732
+ const s = e.la.L_();
15733
+ s.sort(((e, t) => function __PRIVATE_compareChangeType(e, t) {
15731
15734
  const order = e => {
15732
15735
  switch (e) {
15733
15736
  case 0 /* ChangeType.Added */ :
@@ -15764,18 +15767,20 @@ class __PRIVATE_RemovedLimboDocument {
15764
15767
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15765
15768
  * See the License for the specific language governing permissions and
15766
15769
  * limitations under the License.
15767
- */ (e.type, t.type) || this._a(e.doc, t.doc))), this.Pa(n);
15768
- const s = t ? this.Ia() : [], o = 0 === this.oa.size && this.current ? 1 /* SyncState.Synced */ : 0 /* SyncState.Local */ , _ = o !== this.sa;
15769
- if (this.sa = o, 0 !== i.length || _) {
15770
+ */ (e.type, t.type) || this._a(e.doc, t.doc))), this.Pa(n), r = null != r && r;
15771
+ const o = t && !r ? this.Ia() : [], _ = 0 === this.oa.size && this.current && !r ? 1 /* SyncState.Synced */ : 0 /* SyncState.Local */ , a = _ !== this.sa;
15772
+ // We are at synced state if there is no limbo docs are waiting to be resolved, view is current
15773
+ // with the backend, and the query is not pending to reset due to existence filter mismatch.
15774
+ if (this.sa = _, 0 !== s.length || a) {
15770
15775
  return {
15771
- snapshot: new ViewSnapshot(this.query, e.aa, r, i, e.mutatedKeys, 0 /* SyncState.Local */ === o, _,
15776
+ snapshot: new ViewSnapshot(this.query, e.aa, i, s, e.mutatedKeys, 0 /* SyncState.Local */ === _, a,
15772
15777
  /* excludesMetadataChanges= */ !1, !!n && n.resumeToken.approximateByteSize() > 0),
15773
- Ta: s
15778
+ Ta: o
15774
15779
  };
15775
15780
  }
15776
15781
  // no changes
15777
15782
  return {
15778
- Ta: s
15783
+ Ta: o
15779
15784
  };
15780
15785
  }
15781
15786
  /**
@@ -15793,7 +15798,7 @@ class __PRIVATE_RemovedLimboDocument {
15793
15798
  mutatedKeys: this.mutatedKeys,
15794
15799
  Zi: !1
15795
15800
  },
15796
- /* updateLimboDocuments= */ !1)) : {
15801
+ /* limboResolutionEnabled= */ !1)) : {
15797
15802
  Ta: []
15798
15803
  };
15799
15804
  }
@@ -15852,7 +15857,7 @@ class __PRIVATE_RemovedLimboDocument {
15852
15857
  da(e) {
15853
15858
  this.ia = e.ls, this.oa = __PRIVATE_documentKeySet();
15854
15859
  const t = this.ca(e.documents);
15855
- return this.applyChanges(t, /*updateLimboDocuments=*/ !0);
15860
+ return this.applyChanges(t, /* limboResolutionEnabled= */ !0);
15856
15861
  }
15857
15862
  /**
15858
15863
  * Returns a view snapshot as if this query was just listened to. Contains
@@ -15996,13 +16001,13 @@ async function __PRIVATE_syncEngineListen(e, t) {
15996
16001
  // didn't lose any good docs that had been past the limit.
15997
16002
  i = await __PRIVATE_localStoreExecuteQuery(e.localStore, t.query,
15998
16003
  /* usePreviousResults= */ !1).then((({documents: e}) => t.view.ca(e, i))));
15999
- const s = r && r.targetChanges.get(t.targetId), o = t.view.applyChanges(i,
16000
- /* updateLimboDocuments= */ e.isPrimaryClient, s);
16001
- return __PRIVATE_updateTrackedLimbos(e, t.targetId, o.Ta), o.snapshot;
16004
+ const s = r && r.targetChanges.get(t.targetId), o = r && null != r.targetMismatches.get(t.targetId), _ = t.view.applyChanges(i,
16005
+ /* limboResolutionEnabled= */ e.isPrimaryClient, s, o);
16006
+ return __PRIVATE_updateTrackedLimbos(e, t.targetId, _.Ta), _.snapshot;
16002
16007
  }(e, t, n, r);
16003
16008
  const s = await __PRIVATE_localStoreExecuteQuery(e.localStore, t,
16004
16009
  /* usePreviousResults= */ !0), o = new __PRIVATE_View(t, s.ls), _ = o.ca(s.documents), a = TargetChange.createSynthesizedTargetChangeForCurrentChange(n, r && "Offline" /* OnlineState.Offline */ !== e.onlineState, i), u = o.applyChanges(_,
16005
- /* updateLimboDocuments= */ e.isPrimaryClient, a);
16010
+ /* limboResolutionEnabled= */ e.isPrimaryClient, a);
16006
16011
  __PRIVATE_updateTrackedLimbos(e, n, u.Ta);
16007
16012
  const c = new __PRIVATE_QueryView(t, n, o);
16008
16013
  return e.ma.set(t, c), e.fa.has(n) ? e.fa.get(n).push(t) : e.fa.set(n, [ t ]), u.snapshot;
@@ -17558,7 +17563,7 @@ function __PRIVATE_firestoreClientGetDocumentsFromLocalCache(e, t) {
17558
17563
  try {
17559
17564
  const r = await __PRIVATE_localStoreExecuteQuery(e, t,
17560
17565
  /* usePreviousResults= */ !0), i = new __PRIVATE_View(t, r.ls), s = i.ca(r.documents), o = i.applyChanges(s,
17561
- /* updateLimboDocuments= */ !1);
17566
+ /* limboResolutionEnabled= */ !1);
17562
17567
  n.resolve(o.snapshot);
17563
17568
  } catch (e) {
17564
17569
  const r = __PRIVATE_wrapInUserErrorIfRecoverable(e, `Failed to execute query '${t} against cache`);
@@ -21791,9 +21796,9 @@ let Se = null;
21791
21796
  return r = Object.assign({
21792
21797
  useFetchStreams: t
21793
21798
  }, r), s._setSettings(r), s;
21794
- }), "PUBLIC").setMultipleInstances(!0)), app.registerVersion(w, "4.4.0-20231120214520", e),
21799
+ }), "PUBLIC").setMultipleInstances(!0)), app.registerVersion(w, "4.4.0-20231122201901", e),
21795
21800
  // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
21796
- app.registerVersion(w, "4.4.0-20231120214520", "cjs2017");
21801
+ app.registerVersion(w, "4.4.0-20231122201901", "cjs2017");
21797
21802
  }();
21798
21803
 
21799
21804
  exports.AbstractUserDataWriter = AbstractUserDataWriter;