@firebase/firestore 3.7.3-canary.3bd031691 → 3.7.3-canary.734fdcd91

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 (42) hide show
  1. package/dist/firestore/src/local/local_documents_view.d.ts +0 -2
  2. package/dist/firestore/src/model/document.d.ts +8 -1
  3. package/dist/firestore/test/unit/specs/spec_test_runner.d.ts +1 -0
  4. package/dist/firestore/test/util/helpers.d.ts +1 -1
  5. package/dist/index.esm2017.js +45 -29
  6. package/dist/index.esm2017.js.map +1 -1
  7. package/dist/index.esm5.js +242 -226
  8. package/dist/index.esm5.js.map +1 -1
  9. package/dist/index.node.cjs.js +54 -21
  10. package/dist/index.node.cjs.js.map +1 -1
  11. package/dist/index.node.mjs +54 -21
  12. package/dist/index.node.mjs.map +1 -1
  13. package/dist/index.rn.js +45 -29
  14. package/dist/index.rn.js.map +1 -1
  15. package/dist/internal.d.ts +8 -3
  16. package/dist/lite/firestore/src/local/local_documents_view.d.ts +0 -2
  17. package/dist/lite/firestore/src/model/document.d.ts +8 -1
  18. package/dist/lite/firestore/test/unit/specs/spec_test_runner.d.ts +1 -0
  19. package/dist/lite/firestore/test/util/helpers.d.ts +1 -1
  20. package/dist/lite/index.browser.esm2017.js +116 -98
  21. package/dist/lite/index.browser.esm2017.js.map +1 -1
  22. package/dist/lite/index.browser.esm5.js +104 -86
  23. package/dist/lite/index.browser.esm5.js.map +1 -1
  24. package/dist/lite/index.node.cjs.js +44 -11
  25. package/dist/lite/index.node.cjs.js.map +1 -1
  26. package/dist/lite/index.node.mjs +44 -11
  27. package/dist/lite/index.node.mjs.map +1 -1
  28. package/dist/lite/index.rn.esm2017.js +109 -91
  29. package/dist/lite/index.rn.esm2017.js.map +1 -1
  30. package/dist/lite/internal.d.ts +8 -1
  31. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +17 -17
  32. package/dist/lite/packages/firestore/src/local/local_documents_view.d.ts +0 -2
  33. package/dist/lite/packages/firestore/src/model/document.d.ts +8 -1
  34. package/dist/lite/packages/firestore/test/unit/specs/spec_test_runner.d.ts +1 -0
  35. package/dist/lite/packages/firestore/test/util/helpers.d.ts +1 -1
  36. package/dist/lite/private.d.ts +8 -1
  37. package/dist/packages/firestore/src/local/local_documents_view.d.ts +0 -2
  38. package/dist/packages/firestore/src/model/document.d.ts +8 -1
  39. package/dist/packages/firestore/test/unit/specs/spec_test_runner.d.ts +1 -0
  40. package/dist/packages/firestore/test/util/helpers.d.ts +1 -1
  41. package/dist/private.d.ts +8 -3
  42. package/package.json +9 -9
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.14.0-canary.3bd031691";
73
+ let V = "9.14.0-canary.734fdcd91";
74
74
 
75
75
  /**
76
76
  * @license
@@ -3845,38 +3845,56 @@ function Ye(t) {
3845
3845
  * applied, `isValidDocument()` returns false and the document should be removed
3846
3846
  * from all views.
3847
3847
  */ class en {
3848
- constructor(t, e, n, s, i, r) {
3849
- this.key = t, this.documentType = e, this.version = n, this.readTime = s, this.data = i,
3850
- this.documentState = r;
3848
+ constructor(t, e, n, s, i, r, o) {
3849
+ this.key = t, this.documentType = e, this.version = n, this.readTime = s, this.createTime = i,
3850
+ this.data = r, this.documentState = o;
3851
3851
  }
3852
3852
  /**
3853
3853
  * Creates a document with no known version or data, but which can serve as
3854
3854
  * base document for mutations.
3855
3855
  */ static newInvalidDocument(t) {
3856
- return new en(t, 0 /* DocumentType.INVALID */ , it.min(), it.min(), Ze.empty(), 0 /* DocumentState.SYNCED */);
3856
+ return new en(t, 0 /* DocumentType.INVALID */ ,
3857
+ /* version */ it.min(),
3858
+ /* readTime */ it.min(),
3859
+ /* createTime */ it.min(), Ze.empty(), 0 /* DocumentState.SYNCED */);
3857
3860
  }
3858
3861
  /**
3859
3862
  * Creates a new document that is known to exist with the given data at the
3860
3863
  * given version.
3861
- */ static newFoundDocument(t, e, n) {
3862
- return new en(t, 1 /* DocumentType.FOUND_DOCUMENT */ , e, it.min(), n, 0 /* DocumentState.SYNCED */);
3864
+ */ static newFoundDocument(t, e, n, s) {
3865
+ return new en(t, 1 /* DocumentType.FOUND_DOCUMENT */ ,
3866
+ /* version */ e,
3867
+ /* readTime */ it.min(),
3868
+ /* createTime */ n, s, 0 /* DocumentState.SYNCED */);
3863
3869
  }
3864
3870
  /** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, e) {
3865
- return new en(t, 2 /* DocumentType.NO_DOCUMENT */ , e, it.min(), Ze.empty(), 0 /* DocumentState.SYNCED */);
3871
+ return new en(t, 2 /* DocumentType.NO_DOCUMENT */ ,
3872
+ /* version */ e,
3873
+ /* readTime */ it.min(),
3874
+ /* createTime */ it.min(), Ze.empty(), 0 /* DocumentState.SYNCED */);
3866
3875
  }
3867
3876
  /**
3868
3877
  * Creates a new document that is known to exist at the given version but
3869
3878
  * whose data is not known (e.g. a document that was updated without a known
3870
3879
  * base document).
3871
3880
  */ static newUnknownDocument(t, e) {
3872
- return new en(t, 3 /* DocumentType.UNKNOWN_DOCUMENT */ , e, it.min(), Ze.empty(), 2 /* DocumentState.HAS_COMMITTED_MUTATIONS */);
3881
+ return new en(t, 3 /* DocumentType.UNKNOWN_DOCUMENT */ ,
3882
+ /* version */ e,
3883
+ /* readTime */ it.min(),
3884
+ /* createTime */ it.min(), Ze.empty(), 2 /* DocumentState.HAS_COMMITTED_MUTATIONS */);
3873
3885
  }
3874
3886
  /**
3875
3887
  * Changes the document type to indicate that it exists and that its version
3876
3888
  * and data are known.
3877
3889
  */ convertToFoundDocument(t, e) {
3878
- return this.version = t, this.documentType = 1 /* DocumentType.FOUND_DOCUMENT */ ,
3879
- this.data = e, this.documentState = 0 /* DocumentState.SYNCED */ , this;
3890
+ // If a document is switching state from being an invalid or deleted
3891
+ // document to a valid (FOUND_DOCUMENT) document, either due to receiving an
3892
+ // update from Watch or due to applying a local set mutation on top
3893
+ // of a deleted document, our best guess about its createTime would be the
3894
+ // version at which the document transitioned to a FOUND_DOCUMENT.
3895
+ return !this.createTime.isEqual(it.min()) || 2 /* DocumentType.NO_DOCUMENT */ !== this.documentType && 0 /* DocumentType.INVALID */ !== this.documentType || (this.createTime = t),
3896
+ this.version = t, this.documentType = 1 /* DocumentType.FOUND_DOCUMENT */ , this.data = e,
3897
+ this.documentState = 0 /* DocumentState.SYNCED */ , this;
3880
3898
  }
3881
3899
  /**
3882
3900
  * Changes the document type to indicate that it doesn't exist at the given
@@ -3929,10 +3947,10 @@ function Ye(t) {
3929
3947
  return t instanceof en && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data);
3930
3948
  }
3931
3949
  mutableCopy() {
3932
- return new en(this.key, this.documentType, this.version, this.readTime, this.data.clone(), this.documentState);
3950
+ return new en(this.key, this.documentType, this.version, this.readTime, this.createTime, this.data.clone(), this.documentState);
3933
3951
  }
3934
3952
  toString() {
3935
- return `Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`;
3953
+ return `Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`;
3936
3954
  }
3937
3955
  }
3938
3956
 
@@ -5910,23 +5928,23 @@ function Ys(t) {
5910
5928
  }
5911
5929
 
5912
5930
  function Zs(t, e, n) {
5913
- const s = Ws(t, e.name), i = Ks(e.updateTime), r = new Ze({
5931
+ const s = Ws(t, e.name), i = Ks(e.updateTime), r = e.createTime ? Ks(e.createTime) : it.min(), o = new Ze({
5914
5932
  mapValue: {
5915
5933
  fields: e.fields
5916
5934
  }
5917
- }), o = en.newFoundDocument(s, i, r);
5918
- return n && o.setHasCommittedMutations(), n ? o.setHasCommittedMutations() : o;
5935
+ }), u = en.newFoundDocument(s, i, r, o);
5936
+ return n && u.setHasCommittedMutations(), n ? u.setHasCommittedMutations() : u;
5919
5937
  }
5920
5938
 
5921
5939
  function ti(t, e) {
5922
5940
  return "found" in e ? function(t, e) {
5923
5941
  F(!!e.found), e.found.name, e.found.updateTime;
5924
- const n = Ws(t, e.found.name), s = Ks(e.found.updateTime), i = new Ze({
5942
+ const n = Ws(t, e.found.name), s = Ks(e.found.updateTime), i = e.found.createTime ? Ks(e.found.createTime) : it.min(), r = new Ze({
5925
5943
  mapValue: {
5926
5944
  fields: e.found.fields
5927
5945
  }
5928
5946
  });
5929
- return en.newFoundDocument(n, s, i);
5947
+ return en.newFoundDocument(n, s, i, r);
5930
5948
  }(t, e) : "missing" in e ? function(t, e) {
5931
5949
  F(!!e.missing), F(!!e.readTime);
5932
5950
  const n = Ws(t, e.missing), s = Ks(e.readTime);
@@ -5962,12 +5980,12 @@ function ei(t, e) {
5962
5980
  e.documentChange;
5963
5981
  const s = e.documentChange;
5964
5982
  s.document, s.document.name, s.document.updateTime;
5965
- const i = Ws(t, s.document.name), r = Ks(s.document.updateTime), o = new Ze({
5983
+ const i = Ws(t, s.document.name), r = Ks(s.document.updateTime), o = s.document.createTime ? Ks(s.document.createTime) : it.min(), u = new Ze({
5966
5984
  mapValue: {
5967
5985
  fields: s.document.fields
5968
5986
  }
5969
- }), u = en.newFoundDocument(i, r, o), c = s.targetIds || [], a = s.removedTargetIds || [];
5970
- n = new Ss(c, a, u.key, u);
5987
+ }), c = en.newFoundDocument(i, r, o, u), a = s.targetIds || [], h = s.removedTargetIds || [];
5988
+ n = new Ss(a, h, c.key, c);
5971
5989
  } else if ("documentDelete" in e) {
5972
5990
  e.documentDelete;
5973
5991
  const s = e.documentDelete;
@@ -6846,7 +6864,8 @@ function ji(t, e) {
6846
6864
  return {
6847
6865
  name: js(t, e.key),
6848
6866
  fields: e.data.value.mapValue.fields,
6849
- updateTime: Ls(t, e.version.toTimestamp())
6867
+ updateTime: Ls(t, e.version.toTimestamp()),
6868
+ createTime: Ls(t, e.createTime.toTimestamp())
6850
6869
  };
6851
6870
  }(t.ie, e); else if (e.isNoDocument()) s.noDocument = {
6852
6871
  path: n.path.toArray(),
@@ -9808,7 +9827,7 @@ class Io {
9808
9827
  * state for it.
9809
9828
  */ getDocument(t, e) {
9810
9829
  let n = null;
9811
- return this.documentOverlayCache.getOverlay(t, e).next((s => (n = s, this.getBaseDocument(t, e, n)))).next((t => (null !== n && Xn(n.mutation, t, Xe.empty(), st.now()),
9830
+ return this.documentOverlayCache.getOverlay(t, e).next((s => (n = s, this.remoteDocumentCache.getEntry(t, e)))).next((t => (null !== n && Xn(n.mutation, t, Xe.empty(), st.now()),
9812
9831
  t)));
9813
9832
  }
9814
9833
  /**
@@ -9962,7 +9981,7 @@ class Io {
9962
9981
  // the batch id.
9963
9982
  let o = -1, u = i;
9964
9983
  return r.next((e => Rt.forEach(e, ((e, n) => (o < n.largestBatchId && (o = n.largestBatchId),
9965
- i.get(e) ? Rt.resolve() : this.getBaseDocument(t, e, n).next((t => {
9984
+ i.get(e) ? Rt.resolve() : this.remoteDocumentCache.getEntry(t, e).next((t => {
9966
9985
  u = u.insert(e, t);
9967
9986
  }))))).next((() => this.populateOverlays(t, e, i))).next((() => this.computeViews(t, u, e, Rs()))).next((t => ({
9968
9987
  batchId: o,
@@ -10013,9 +10032,6 @@ class Io {
10013
10032
  })), n;
10014
10033
  }));
10015
10034
  }
10016
- /** Returns a base document that can be used to apply `overlay`. */ getBaseDocument(t, e, n) {
10017
- return null === n || 1 /* MutationType.Patch */ === n.mutation.type ? this.remoteDocumentCache.getEntry(t, e) : Rt.resolve(en.newInvalidDocument(e));
10018
- }
10019
10035
  }
10020
10036
 
10021
10037
  /**
@@ -20524,9 +20540,9 @@ function df(t, e) {
20524
20540
  return s = Object.assign({
20525
20541
  useFetchStreams: e
20526
20542
  }, s), r._setSettings(s), r;
20527
- }), "PUBLIC").setMultipleInstances(!0)), s(P, "3.7.3-canary.3bd031691", t),
20543
+ }), "PUBLIC").setMultipleInstances(!0)), s(P, "3.7.3-canary.734fdcd91", t),
20528
20544
  // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
20529
- s(P, "3.7.3-canary.3bd031691", "esm2017");
20545
+ s(P, "3.7.3-canary.734fdcd91", "esm2017");
20530
20546
  }("rn", /* useFetchStreams= */ !1);
20531
20547
 
20532
20548
  export { Vl as AbstractUserDataWriter, Ca as AggregateField, xa as AggregateQuerySnapshot, Eh as Bytes, rh as CACHE_SIZE_UNLIMITED, Ea as CollectionReference, Ia as DocumentReference, xl as DocumentSnapshot, Ah as FieldPath, bh as FieldValue, oh as Firestore, q as FirestoreError, Ph as GeoPoint, ih as LoadBundleTask, Ta as Query, cl as QueryCompositeFilterConstraint, il as QueryConstraint, Nl as QueryDocumentSnapshot, pl as QueryEndAtConstraint, ol as QueryFieldFilterConstraint, dl as QueryLimitConstraint, ll as QueryOrderByConstraint, kl as QuerySnapshot, ml as QueryStartAtConstraint, Cl as SnapshotMetadata, st as Timestamp, sf as Transaction, ef as WriteBatch, $t as _DatabaseId, at as _DocumentKey, Y as _EmptyAppCheckTokenProvider, G as _EmptyAuthCredentialsProvider, ct as _FieldPath, _a as _cast, $ as _debugAssert, jt as _isBase64Available, k as _logWarn, ha as _validateIsNotUsedTogether, Wl as addDoc, Xl as aggregateQuerySnapshotEqual, hl as and, af as arrayRemove, cf as arrayUnion, _h as clearIndexedDbPersistence, Aa as collection, Ra as collectionGroup, pa as connectFirestoreEmulator, jl as deleteDoc, of as deleteField, gh as disableNetwork, ba as doc, Rh as documentId, lh as enableIndexedDbPersistence, fh as enableMultiTabIndexedDbPersistence, mh as enableNetwork, Tl as endAt, Il as endBefore, ah as ensureFirestoreConfigured, Jl as executeWrite, Zl as getCountFromServer, Fl as getDoc, Bl as getDocFromCache, Ll as getDocFromServer, ql as getDocs, Ul as getDocsFromCache, Kl as getDocsFromServer, ch as getFirestore, hf as increment, uh as initializeFirestore, _l as limit, wl as limitToLast, ph as loadBundle, Ih as namedQuery, zl as onSnapshot, Hl as onSnapshotsInSync, al as or, fl as orderBy, rl as query, va as queryEqual, Pa as refEqual, rf as runTransaction, uf as serverTimestamp, Gl as setDoc, ff as setIndexConfiguration, C as setLogLevel, Ml as snapshotEqual, yl as startAfter, gl as startAt, yh as terminate, Ql as updateDoc, wh as waitForPendingWrites, ul as where, lf as writeBatch };