@firebase/firestore 3.6.0 → 3.7.0-20221010190246

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 (39) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/firestore/src/core/view.d.ts +1 -0
  3. package/dist/firestore/src/core/view_snapshot.d.ts +3 -2
  4. package/dist/firestore/src/remote/remote_event.d.ts +2 -2
  5. package/dist/firestore/test/util/api_helpers.d.ts +1 -1
  6. package/dist/index.esm2017.js +38 -36
  7. package/dist/index.esm2017.js.map +1 -1
  8. package/dist/index.esm5.js +132 -130
  9. package/dist/index.esm5.js.map +1 -1
  10. package/dist/index.node.cjs.js +29 -21
  11. package/dist/index.node.cjs.js.map +1 -1
  12. package/dist/index.node.mjs +29 -21
  13. package/dist/index.node.mjs.map +1 -1
  14. package/dist/index.rn.js +38 -36
  15. package/dist/index.rn.js.map +1 -1
  16. package/dist/internal.d.ts +5 -4
  17. package/dist/lite/firestore/src/core/view.d.ts +1 -0
  18. package/dist/lite/firestore/src/core/view_snapshot.d.ts +3 -2
  19. package/dist/lite/firestore/src/remote/remote_event.d.ts +2 -2
  20. package/dist/lite/firestore/test/util/api_helpers.d.ts +1 -1
  21. package/dist/lite/index.browser.esm2017.js +2 -2
  22. package/dist/lite/index.browser.esm2017.js.map +1 -1
  23. package/dist/lite/index.browser.esm5.js +2 -2
  24. package/dist/lite/index.browser.esm5.js.map +1 -1
  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/core/view.d.ts +1 -0
  31. package/dist/lite/packages/firestore/src/core/view_snapshot.d.ts +3 -2
  32. package/dist/lite/packages/firestore/src/remote/remote_event.d.ts +2 -2
  33. package/dist/lite/packages/firestore/test/util/api_helpers.d.ts +1 -1
  34. package/dist/packages/firestore/src/core/view.d.ts +1 -0
  35. package/dist/packages/firestore/src/core/view_snapshot.d.ts +3 -2
  36. package/dist/packages/firestore/src/remote/remote_event.d.ts +2 -2
  37. package/dist/packages/firestore/test/util/api_helpers.d.ts +1 -1
  38. package/dist/private.d.ts +5 -4
  39. package/package.json +8 -8
package/dist/index.rn.js CHANGED
@@ -70,7 +70,7 @@ v.MOCK_USER = new v("mock-user");
70
70
  * See the License for the specific language governing permissions and
71
71
  * limitations under the License.
72
72
  */
73
- let V = "9.11.0";
73
+ let V = "9.12.0-20221010190246";
74
74
 
75
75
  /**
76
76
  * @license
@@ -5133,9 +5133,9 @@ function ms() {
5133
5133
  * CURRENT status change to a View, for queries executed in a different tab.
5134
5134
  */
5135
5135
  // PORTING NOTE: Multi-tab only
5136
- static createSynthesizedRemoteEventForCurrentChange(t, e) {
5137
- const n = new Map;
5138
- return n.set(t, ys.createSynthesizedTargetChangeForCurrentChange(t, e)), new gs(it.min(), n, ms(), rs(), _s());
5136
+ static createSynthesizedRemoteEventForCurrentChange(t, e, n) {
5137
+ const s = new Map;
5138
+ return s.set(t, ys.createSynthesizedTargetChangeForCurrentChange(t, e, n)), new gs(it.min(), s, ms(), rs(), _s());
5139
5139
  }
5140
5140
  }
5141
5141
 
@@ -5183,8 +5183,8 @@ function ms() {
5183
5183
  * This method is used to create a synthesized TargetChanges that can be used to
5184
5184
  * apply a CURRENT status change to a View (for queries executed in a different
5185
5185
  * tab) or for new queries (to raise snapshots with correct CURRENT status).
5186
- */ static createSynthesizedTargetChangeForCurrentChange(t, e) {
5187
- return new ys(Ht.EMPTY_BYTE_STRING, e, _s(), _s(), _s());
5186
+ */ static createSynthesizedTargetChangeForCurrentChange(t, e, n) {
5187
+ return new ys(n, e, _s(), _s(), _s());
5188
5188
  }
5189
5189
  }
5190
5190
 
@@ -12536,7 +12536,7 @@ class {
12536
12536
  fo(t, e, n, s) {
12537
12537
  return new Promise(((i, r) => {
12538
12538
  const o = new g;
12539
- o.listenOnce(y.COMPLETE, (() => {
12539
+ o.setWithCredentials(!0), o.listenOnce(y.COMPLETE, (() => {
12540
12540
  try {
12541
12541
  switch (o.getLastErrorCode()) {
12542
12542
  case p.NO_ERROR:
@@ -14052,26 +14052,27 @@ class $u {
14052
14052
  }
14053
14053
 
14054
14054
  class qu {
14055
- constructor(t, e, n, s, i, r, o, u) {
14055
+ constructor(t, e, n, s, i, r, o, u, c) {
14056
14056
  this.query = t, this.docs = e, this.oldDocs = n, this.docChanges = s, this.mutatedKeys = i,
14057
- this.fromCache = r, this.syncStateChanged = o, this.excludesMetadataChanges = u;
14057
+ this.fromCache = r, this.syncStateChanged = o, this.excludesMetadataChanges = u,
14058
+ this.hasCachedResults = c;
14058
14059
  }
14059
- /** Returns a view snapshot as if all documents in the snapshot were added. */ static fromInitialDocuments(t, e, n, s) {
14060
- const i = [];
14060
+ /** Returns a view snapshot as if all documents in the snapshot were added. */ static fromInitialDocuments(t, e, n, s, i) {
14061
+ const r = [];
14061
14062
  return e.forEach((t => {
14062
- i.push({
14063
+ r.push({
14063
14064
  type: 0 /* Added */ ,
14064
14065
  doc: t
14065
14066
  });
14066
- })), new qu(t, e, Lu.emptySet(e), i, n, s,
14067
+ })), new qu(t, e, Lu.emptySet(e), r, n, s,
14067
14068
  /* syncStateChanged= */ !0,
14068
- /* excludesMetadataChanges= */ !1);
14069
+ /* excludesMetadataChanges= */ !1, i);
14069
14070
  }
14070
14071
  get hasPendingWrites() {
14071
14072
  return !this.mutatedKeys.isEmpty();
14072
14073
  }
14073
14074
  isEqual(t) {
14074
- if (!(this.fromCache === t.fromCache && this.syncStateChanged === t.syncStateChanged && this.mutatedKeys.isEqual(t.mutatedKeys) && fn(this.query, t.query) && this.docs.isEqual(t.docs) && this.oldDocs.isEqual(t.oldDocs))) return !1;
14075
+ if (!(this.fromCache === t.fromCache && this.hasCachedResults === t.hasCachedResults && this.syncStateChanged === t.syncStateChanged && this.mutatedKeys.isEqual(t.mutatedKeys) && fn(this.query, t.query) && this.docs.isEqual(t.docs) && this.oldDocs.isEqual(t.oldDocs))) return !1;
14075
14076
  const e = this.docChanges, n = t.docChanges;
14076
14077
  if (e.length !== n.length) return !1;
14077
14078
  for (let t = 0; t < e.length; t++) if (e[t].type !== n[t].type || !e[t].doc.isEqual(n[t].doc)) return !1;
@@ -14191,7 +14192,7 @@ function Hu(t) {
14191
14192
  const e = [];
14192
14193
  for (const n of t.docChanges) 3 /* Metadata */ !== n.type && e.push(n);
14193
14194
  t = new qu(t.query, t.docs, t.oldDocs, e, t.mutatedKeys, t.fromCache, t.syncStateChanged,
14194
- /* excludesMetadataChanges= */ !0);
14195
+ /* excludesMetadataChanges= */ !0, t.hasCachedResults);
14195
14196
  }
14196
14197
  let e = !1;
14197
14198
  return this.Su ? this.Cu(t) && (this.Vu.next(t), e = !0) : this.xu(t, this.onlineState) && (this.Nu(t),
@@ -14214,8 +14215,9 @@ function Hu(t) {
14214
14215
  const n = "Offline" /* Offline */ !== e;
14215
14216
  // Don't raise the event if we're online, aren't synced yet (checked
14216
14217
  // above) and are waiting for a sync.
14217
- return (!this.options.ku || !n) && (!t.docs.isEmpty() || "Offline" /* Offline */ === e);
14218
- // Raise data from cache if we have any documents or we are offline
14218
+ return (!this.options.ku || !n) && (!t.docs.isEmpty() || t.hasCachedResults || "Offline" /* Offline */ === e);
14219
+ // Raise data from cache if we have any documents, have cached results before,
14220
+ // or we are offline.
14219
14221
  }
14220
14222
  Cu(t) {
14221
14223
  // We don't need to handle includeDocumentMetadataChanges here because
@@ -14230,8 +14232,8 @@ function Hu(t) {
14230
14232
  // stripped out.
14231
14233
  }
14232
14234
  Nu(t) {
14233
- t = qu.fromInitialDocuments(t.query, t.docs, t.mutatedKeys, t.fromCache), this.Su = !0,
14234
- this.Vu.next(t);
14235
+ t = qu.fromInitialDocuments(t.query, t.docs, t.mutatedKeys, t.fromCache, t.hasCachedResults),
14236
+ this.Su = !0, this.Vu.next(t);
14235
14237
  }
14236
14238
  }
14237
14239
 
@@ -14409,7 +14411,7 @@ class nc {
14409
14411
  constructor(t,
14410
14412
  /** Documents included in the remote target */
14411
14413
  e) {
14412
- this.query = t, this.Uu = e, this.qu = null,
14414
+ this.query = t, this.Uu = e, this.qu = null, this.hasCachedResults = !1,
14413
14415
  /**
14414
14416
  * A flag whether the view is current with the backend. A view is considered
14415
14417
  * current after it has seen the current flag from the backend and did not
@@ -14563,7 +14565,7 @@ class nc {
14563
14565
  if (this.qu = o, 0 !== i.length || u) {
14564
14566
  return {
14565
14567
  snapshot: new qu(this.query, t.Qu, s, i, t.mutatedKeys, 0 /* Local */ === o, u,
14566
- /* excludesMetadataChanges= */ !1),
14568
+ /* excludesMetadataChanges= */ !1, !!n && n.resumeToken.approximateByteSize() > 0),
14567
14569
  Xu: r
14568
14570
  };
14569
14571
  }
@@ -14655,7 +14657,7 @@ class nc {
14655
14657
  */
14656
14658
  // PORTING NOTE: Multi-tab only.
14657
14659
  ec() {
14658
- return qu.fromInitialDocuments(this.query, this.Qu, this.mutatedKeys, 0 /* Local */ === this.qu);
14660
+ return qu.fromInitialDocuments(this.query, this.Qu, this.mutatedKeys, 0 /* Local */ === this.qu, this.hasCachedResults);
14659
14661
  }
14660
14662
  }
14661
14663
 
@@ -14771,7 +14773,7 @@ async function uc(t, e) {
14771
14773
  const t = await Do(n.localStore, hn(e));
14772
14774
  n.isPrimaryClient && fu(n.remoteStore, t);
14773
14775
  const r = n.sharedClientState.addLocalQueryTarget(t.targetId);
14774
- s = t.targetId, i = await cc(n, e, s, "current" === r);
14776
+ s = t.targetId, i = await cc(n, e, s, "current" === r, t.resumeToken);
14775
14777
  }
14776
14778
  return i;
14777
14779
  }
@@ -14779,7 +14781,7 @@ async function uc(t, e) {
14779
14781
  /**
14780
14782
  * Registers a view for a previously unknown query and computes its initial
14781
14783
  * snapshot.
14782
- */ async function cc(t, e, n, s) {
14784
+ */ async function cc(t, e, n, s, i) {
14783
14785
  // PORTING NOTE: On Web only, we inject the code that registers new Limbo
14784
14786
  // targets based on view changes. This allows us to only depend on Limbo
14785
14787
  // changes when user code includes queries.
@@ -14795,12 +14797,12 @@ async function uc(t, e) {
14795
14797
  /* updateLimboDocuments= */ t.isPrimaryClient, r);
14796
14798
  return Tc(t, e.targetId, o.Xu), o.snapshot;
14797
14799
  }(t, e, n, s);
14798
- const i = await xo(t.localStore, e,
14799
- /* usePreviousResults= */ !0), r = new sc(e, i.Hi), o = r.Wu(i.documents), u = ys.createSynthesizedTargetChangeForCurrentChange(n, s && "Offline" /* Offline */ !== t.onlineState), c = r.applyChanges(o,
14800
- /* updateLimboDocuments= */ t.isPrimaryClient, u);
14801
- Tc(t, n, c.Xu);
14802
- const a = new ic(e, n, r);
14803
- return t.ic.set(e, a), t.rc.has(n) ? t.rc.get(n).push(e) : t.rc.set(n, [ e ]), c.snapshot;
14800
+ const r = await xo(t.localStore, e,
14801
+ /* usePreviousResults= */ !0), o = new sc(e, r.Hi), u = o.Wu(r.documents), c = ys.createSynthesizedTargetChangeForCurrentChange(n, s && "Offline" /* Offline */ !== t.onlineState, i), a = o.applyChanges(u,
14802
+ /* updateLimboDocuments= */ t.isPrimaryClient, c);
14803
+ Tc(t, n, a.Xu);
14804
+ const h = new ic(e, n, o);
14805
+ return t.ic.set(e, h), t.rc.has(n) ? t.rc.get(n).push(e) : t.rc.set(n, [ e ]), a.snapshot;
14804
14806
  }
14805
14807
 
14806
14808
  /** Stops listening to the query. */ async function ac(t, e) {
@@ -15304,7 +15306,7 @@ async function Cc(t, e, n) {
15304
15306
  // allocate the target in LocalStore and initialize a new View.
15305
15307
  const n = await No(s.localStore, t);
15306
15308
  e = await Do(s.localStore, n), await cc(s, xc(n), t,
15307
- /*current=*/ !1);
15309
+ /*current=*/ !1, e.resumeToken);
15308
15310
  }
15309
15311
  i.push(e);
15310
15312
  }
@@ -15346,7 +15348,7 @@ async function kc(t, e, n, s) {
15346
15348
  case "current":
15347
15349
  case "not-current":
15348
15350
  {
15349
- const t = await ko(i.localStore, mn(r[0])), s = gs.createSynthesizedRemoteEventForCurrentChange(e, "current" === n);
15351
+ const t = await ko(i.localStore, mn(r[0])), s = gs.createSynthesizedRemoteEventForCurrentChange(e, "current" === n, Ht.EMPTY_BYTE_STRING);
15350
15352
  await Rc(i, t, s);
15351
15353
  break;
15352
15354
  }
@@ -15372,7 +15374,7 @@ async function kc(t, e, n, s) {
15372
15374
  }
15373
15375
  const e = await No(s.localStore, t), n = await Do(s.localStore, e);
15374
15376
  await cc(s, xc(e), n.targetId,
15375
- /*current=*/ !1), fu(s.remoteStore, n);
15377
+ /*current=*/ !1, n.resumeToken), fu(s.remoteStore, n);
15376
15378
  }
15377
15379
  for (const t of n)
15378
15380
  // Check that the target is still active since the target might have been
@@ -19982,9 +19984,9 @@ function Ll(t, e) {
19982
19984
  return s = Object.assign({
19983
19985
  useFetchStreams: e
19984
19986
  }, s), r._setSettings(s), r;
19985
- }), "PUBLIC").setMultipleInstances(!0)), s(P, "3.6.0", t),
19987
+ }), "PUBLIC").setMultipleInstances(!0)), s(P, "3.7.0-20221010190246", t),
19986
19988
  // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
19987
- s(P, "3.6.0", "esm2017");
19989
+ s(P, "3.7.0-20221010190246", "esm2017");
19988
19990
  }("rn", /* useFetchStreams= */ !1);
19989
19991
 
19990
19992
  export { nl as AbstractUserDataWriter, la as AggregateField, fa as AggregateQuerySnapshot, nh as Bytes, Ba as CACHE_SIZE_UNLIMITED, na as CollectionReference, ta as DocumentReference, ol as DocumentSnapshot, sh as FieldPath, rh as FieldValue, La as Firestore, U as FirestoreError, oh as GeoPoint, $a as LoadBundleTask, ea as Query, Fh as QueryConstraint, ul as QueryDocumentSnapshot, cl as QuerySnapshot, rl as SnapshotMetadata, st as Timestamp, Cl as Transaction, Sl as WriteBatch, ie as _DatabaseId, at as _DocumentKey, Y as _EmptyAppCheckTokenProvider, G as _EmptyAuthCredentialsProvider, ct as _FieldPath, zc as _cast, $ as _debugAssert, zt as _isBase64Available, k as _logWarn, Gc as _validateIsNotUsedTogether, Tl as addDoc, Pl as aggregateQuerySnapshotEqual, Ml as arrayRemove, Ol as arrayUnion, za as clearIndexedDbPersistence, sa as collection, ia as collectionGroup, Zc as connectFirestoreEmulator, Il as deleteDoc, Nl as deleteField, Ya as disableNetwork, ra as doc, ih as documentId, Qa as enableIndexedDbPersistence, ja as enableMultiTabIndexedDbPersistence, Ja as enableNetwork, Yh as endAt, Jh as endBefore, Ka as ensureFirestoreConfigured, Rl as executeWrite, vl as getCountFromServer, ll as getDoc, dl as getDocFromCache, _l as getDocFromServer, wl as getDocs, ml as getDocsFromCache, gl as getDocsFromServer, qa as getFirestore, Fl as increment, Ua as initializeFirestore, Gh as limit, Qh as limitToLast, Za as loadBundle, th as namedQuery, El as onSnapshot, Al as onSnapshotsInSync, qh as orderBy, $h as query, ua as queryEqual, oa as refEqual, xl as runTransaction, kl as serverTimestamp, yl as setDoc, Bl as setIndexConfiguration, C as setLogLevel, hl as snapshotEqual, zh as startAfter, Wh as startAt, Xa as terminate, pl as updateDoc, Ha as waitForPendingWrites, Lh as where, $l as writeBatch };