@firebase/firestore 3.13.0-canary.684bb4e45 → 3.13.0-canary.794441e73

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.
@@ -9154,6 +9154,20 @@ interface ExistenceFilterMismatchInfo {
9154
9154
  bitmapLength: number;
9155
9155
  /** The number of bits of padding in the last byte of the bloom filter. */
9156
9156
  padding: number;
9157
+ /**
9158
+ * Check if the given document path is contained in the bloom filter.
9159
+ *
9160
+ * The "path" of a document can be retrieved from the
9161
+ * `DocumentReference.path` property.
9162
+ *
9163
+ * Note that due to the probabilistic nature of a bloom filter, it is
9164
+ * possible that false positives may occur; that is, this function may
9165
+ * return `true` even though the given string is not in the bloom filter.
9166
+ *
9167
+ * This property is "optional"; if it is undefined then parsing the bloom
9168
+ * filter failed.
9169
+ */
9170
+ mightContain?(documentPath: string): boolean;
9157
9171
  };
9158
9172
  }
9159
9173
  /**
@@ -94,6 +94,20 @@ export interface ExistenceFilterMismatchInfo {
94
94
  bitmapLength: number;
95
95
  /** The number of bits of padding in the last byte of the bloom filter. */
96
96
  padding: number;
97
+ /**
98
+ * Check if the given document path is contained in the bloom filter.
99
+ *
100
+ * The "path" of a document can be retrieved from the
101
+ * `DocumentReference.path` property.
102
+ *
103
+ * Note that due to the probabilistic nature of a bloom filter, it is
104
+ * possible that false positives may occur; that is, this function may
105
+ * return `true` even though the given string is not in the bloom filter.
106
+ *
107
+ * This property is "optional"; if it is undefined then parsing the bloom
108
+ * filter failed.
109
+ */
110
+ mightContain?(documentPath: string): boolean;
97
111
  };
98
112
  }
99
113
  /**
@@ -42,5 +42,6 @@ export interface ExistenceFilterMismatchInfo {
42
42
  hashCount: number;
43
43
  bitmapLength: number;
44
44
  padding: number;
45
+ mightContain?(documentPath: string): boolean;
45
46
  };
46
47
  }
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 b = "9.23.0-canary.684bb4e45";
73
+ let b = "9.23.0-canary.794441e73";
74
74
 
75
75
  /**
76
76
  * @license
@@ -5897,7 +5897,7 @@ class BloomFilter {
5897
5897
  Ve(e) {
5898
5898
  return 0 != (this.bitmap[Math.floor(e / 8)] & 1 << e % 8);
5899
5899
  }
5900
- me(e) {
5900
+ mightContain(e) {
5901
5901
  // Empty bitmap should always return false on membership check.
5902
5902
  if (0 === this.de) return !1;
5903
5903
  const t = __PRIVATE_getMd5HashValue(e), [n, r] = __PRIVATE_get64BitUints(t);
@@ -5916,10 +5916,10 @@ class BloomFilter {
5916
5916
  const t = __PRIVATE_getMd5HashValue(e), [n, r] = __PRIVATE_get64BitUints(t);
5917
5917
  for (let e = 0; e < this.hashCount; e++) {
5918
5918
  const t = this.Re(n, r, e);
5919
- this.fe(t);
5919
+ this.me(t);
5920
5920
  }
5921
5921
  }
5922
- fe(e) {
5922
+ me(e) {
5923
5923
  const t = Math.floor(e / 8), n = e % 8;
5924
5924
  this.bitmap[t] |= 1 << n;
5925
5925
  }
@@ -6076,13 +6076,13 @@ class __PRIVATE_BloomFilterError extends Error {
6076
6076
  * document went out of view without the server sending a new document.
6077
6077
  */
6078
6078
  r) {
6079
- this.ge = e, this.removedTargetIds = t, this.key = n, this.pe = r;
6079
+ this.fe = e, this.removedTargetIds = t, this.key = n, this.ge = r;
6080
6080
  }
6081
6081
  }
6082
6082
 
6083
6083
  class __PRIVATE_ExistenceFilterChange {
6084
6084
  constructor(e, t) {
6085
- this.targetId = e, this.ye = t;
6085
+ this.targetId = e, this.pe = t;
6086
6086
  }
6087
6087
  }
6088
6088
 
@@ -6110,22 +6110,22 @@ class __PRIVATE_WatchTargetChange {
6110
6110
  * The number of pending responses (adds or removes) that we are waiting on.
6111
6111
  * We only consider targets active that have no pending responses.
6112
6112
  */
6113
- this.we = 0,
6113
+ this.ye = 0,
6114
6114
  /**
6115
6115
  * Keeps track of the document changes since the last raised snapshot.
6116
6116
  *
6117
6117
  * These changes are continuously updated as we receive document updates and
6118
6118
  * always reflect the current set of changes against the last issued snapshot.
6119
6119
  */
6120
- this.Se = __PRIVATE_snapshotChangesMap(),
6120
+ this.we = __PRIVATE_snapshotChangesMap(),
6121
6121
  /** See public getters for explanations of these fields. */
6122
- this.be = ByteString.EMPTY_BYTE_STRING, this.De = !1,
6122
+ this.Se = ByteString.EMPTY_BYTE_STRING, this.be = !1,
6123
6123
  /**
6124
6124
  * Whether this target state should be included in the next snapshot. We
6125
6125
  * initialize to true so that newly-added targets are included in the next
6126
6126
  * RemoteEvent.
6127
6127
  */
6128
- this.ve = !0;
6128
+ this.De = !0;
6129
6129
  }
6130
6130
  /**
6131
6131
  * Whether this target has been marked 'current'.
@@ -6135,31 +6135,31 @@ class __PRIVATE_WatchTargetChange {
6135
6135
  * was added and that the target is consistent with the rest of the watch
6136
6136
  * stream.
6137
6137
  */ get current() {
6138
- return this.De;
6138
+ return this.be;
6139
6139
  }
6140
6140
  /** The last resume token sent to us for this target. */ get resumeToken() {
6141
- return this.be;
6141
+ return this.Se;
6142
6142
  }
6143
- /** Whether this target has pending target adds or target removes. */ get Ce() {
6144
- return 0 !== this.we;
6143
+ /** Whether this target has pending target adds or target removes. */ get ve() {
6144
+ return 0 !== this.ye;
6145
6145
  }
6146
- /** Whether we have modified any state that should trigger a snapshot. */ get Fe() {
6147
- return this.ve;
6146
+ /** Whether we have modified any state that should trigger a snapshot. */ get Ce() {
6147
+ return this.De;
6148
6148
  }
6149
6149
  /**
6150
6150
  * Applies the resume token to the TargetChange, but only when it has a new
6151
6151
  * value. Empty resumeTokens are discarded.
6152
- */ Me(e) {
6153
- e.approximateByteSize() > 0 && (this.ve = !0, this.be = e);
6152
+ */ Fe(e) {
6153
+ e.approximateByteSize() > 0 && (this.De = !0, this.Se = e);
6154
6154
  }
6155
6155
  /**
6156
6156
  * Creates a target change from the current set of changes.
6157
6157
  *
6158
6158
  * To reset the document changes after raising this snapshot, call
6159
6159
  * `clearPendingChanges()`.
6160
- */ xe() {
6160
+ */ Me() {
6161
6161
  let e = __PRIVATE_documentKeySet(), t = __PRIVATE_documentKeySet(), n = __PRIVATE_documentKeySet();
6162
- return this.Se.forEach(((r, i) => {
6162
+ return this.we.forEach(((r, i) => {
6163
6163
  switch (i) {
6164
6164
  case 0 /* ChangeType.Added */ :
6165
6165
  e = e.add(r);
@@ -6176,27 +6176,27 @@ class __PRIVATE_WatchTargetChange {
6176
6176
  default:
6177
6177
  fail();
6178
6178
  }
6179
- })), new TargetChange(this.be, this.De, e, t, n);
6179
+ })), new TargetChange(this.Se, this.be, e, t, n);
6180
6180
  }
6181
6181
  /**
6182
6182
  * Resets the document changes and sets `hasPendingChanges` to false.
6183
- */ Oe() {
6184
- this.ve = !1, this.Se = __PRIVATE_snapshotChangesMap();
6183
+ */ xe() {
6184
+ this.De = !1, this.we = __PRIVATE_snapshotChangesMap();
6185
+ }
6186
+ Oe(e, t) {
6187
+ this.De = !0, this.we = this.we.insert(e, t);
6185
6188
  }
6186
- Ne(e, t) {
6187
- this.ve = !0, this.Se = this.Se.insert(e, t);
6189
+ Ne(e) {
6190
+ this.De = !0, this.we = this.we.remove(e);
6188
6191
  }
6189
- Be(e) {
6190
- this.ve = !0, this.Se = this.Se.remove(e);
6192
+ Be() {
6193
+ this.ye += 1;
6191
6194
  }
6192
6195
  Le() {
6193
- this.we += 1;
6196
+ this.ye -= 1;
6194
6197
  }
6195
6198
  ke() {
6196
- this.we -= 1;
6197
- }
6198
- qe() {
6199
- this.ve = !0, this.De = !0;
6199
+ this.De = !0, this.be = !0;
6200
6200
  }
6201
6201
  }
6202
6202
 
@@ -6205,42 +6205,42 @@ class __PRIVATE_WatchTargetChange {
6205
6205
  */
6206
6206
  class __PRIVATE_WatchChangeAggregator {
6207
6207
  constructor(e) {
6208
- this.Qe = e,
6208
+ this.qe = e,
6209
6209
  /** The internal state of all tracked targets. */
6210
- this.Ke = new Map,
6210
+ this.Qe = new Map,
6211
6211
  /** Keeps track of the documents to update since the last raised snapshot. */
6212
- this.$e = __PRIVATE_mutableDocumentMap(),
6212
+ this.Ke = __PRIVATE_mutableDocumentMap(),
6213
6213
  /** A mapping of document keys to their set of target IDs. */
6214
- this.Ue = __PRIVATE_documentTargetMap(),
6214
+ this.$e = __PRIVATE_documentTargetMap(),
6215
6215
  /**
6216
6216
  * A map of targets with existence filter mismatches. These targets are
6217
6217
  * known to be inconsistent and their listens needs to be re-established by
6218
6218
  * RemoteStore.
6219
6219
  */
6220
- this.We = new SortedMap(__PRIVATE_primitiveComparator);
6220
+ this.Ue = new SortedMap(__PRIVATE_primitiveComparator);
6221
6221
  }
6222
6222
  /**
6223
6223
  * Processes and adds the DocumentWatchChange to the current set of changes.
6224
- */ Ge(e) {
6225
- for (const t of e.ge) e.pe && e.pe.isFoundDocument() ? this.ze(t, e.pe) : this.je(t, e.key, e.pe);
6226
- for (const t of e.removedTargetIds) this.je(t, e.key, e.pe);
6224
+ */ We(e) {
6225
+ for (const t of e.fe) e.ge && e.ge.isFoundDocument() ? this.Ge(t, e.ge) : this.ze(t, e.key, e.ge);
6226
+ for (const t of e.removedTargetIds) this.ze(t, e.key, e.ge);
6227
6227
  }
6228
- /** Processes and adds the WatchTargetChange to the current set of changes. */ He(e) {
6228
+ /** Processes and adds the WatchTargetChange to the current set of changes. */ je(e) {
6229
6229
  this.forEachTarget(e, (t => {
6230
- const n = this.Je(t);
6230
+ const n = this.He(t);
6231
6231
  switch (e.state) {
6232
6232
  case 0 /* WatchTargetChangeState.NoChange */ :
6233
- this.Ye(t) && n.Me(e.resumeToken);
6233
+ this.Je(t) && n.Fe(e.resumeToken);
6234
6234
  break;
6235
6235
 
6236
6236
  case 1 /* WatchTargetChangeState.Added */ :
6237
6237
  // We need to decrement the number of pending acks needed from watch
6238
6238
  // for this targetId.
6239
- n.ke(), n.Ce ||
6239
+ n.Le(), n.ve ||
6240
6240
  // We have a freshly added target, so we need to reset any state
6241
6241
  // that we had previously. This can happen e.g. when remove and add
6242
6242
  // back a target for existence filter mismatches.
6243
- n.Oe(), n.Me(e.resumeToken);
6243
+ n.xe(), n.Fe(e.resumeToken);
6244
6244
  break;
6245
6245
 
6246
6246
  case 2 /* WatchTargetChangeState.Removed */ :
@@ -6248,19 +6248,19 @@ class __PRIVATE_WatchChangeAggregator {
6248
6248
  // remove any target changes.
6249
6249
  // We need to decrement the number of pending acks needed from watch
6250
6250
  // for this targetId.
6251
- n.ke(), n.Ce || this.removeTarget(t);
6251
+ n.Le(), n.ve || this.removeTarget(t);
6252
6252
  break;
6253
6253
 
6254
6254
  case 3 /* WatchTargetChangeState.Current */ :
6255
- this.Ye(t) && (n.qe(), n.Me(e.resumeToken));
6255
+ this.Je(t) && (n.ke(), n.Fe(e.resumeToken));
6256
6256
  break;
6257
6257
 
6258
6258
  case 4 /* WatchTargetChangeState.Reset */ :
6259
- this.Ye(t) && (
6259
+ this.Je(t) && (
6260
6260
  // Reset the target and synthesizes removes for all existing
6261
6261
  // documents. The backend will re-add any documents that still
6262
6262
  // match the target before it sends the next global snapshot.
6263
- this.Ze(t), n.Me(e.resumeToken));
6263
+ this.Ye(t), n.Fe(e.resumeToken));
6264
6264
  break;
6265
6265
 
6266
6266
  default:
@@ -6273,55 +6273,55 @@ class __PRIVATE_WatchChangeAggregator {
6273
6273
  * targetIds explicitly listed in the change or the targetIds of all currently
6274
6274
  * active targets.
6275
6275
  */ forEachTarget(e, t) {
6276
- e.targetIds.length > 0 ? e.targetIds.forEach(t) : this.Ke.forEach(((e, n) => {
6277
- this.Ye(n) && t(n);
6276
+ e.targetIds.length > 0 ? e.targetIds.forEach(t) : this.Qe.forEach(((e, n) => {
6277
+ this.Je(n) && t(n);
6278
6278
  }));
6279
6279
  }
6280
6280
  /**
6281
6281
  * Handles existence filters and synthesizes deletes for filter mismatches.
6282
6282
  * Targets that are invalidated by filter mismatches are added to
6283
6283
  * `pendingTargetResets`.
6284
- */ Xe(e) {
6285
- var t;
6286
- const n = e.targetId, r = e.ye.count, i = this.et(n);
6287
- if (i) {
6288
- const s = i.target;
6289
- if (__PRIVATE_targetIsDocumentTarget(s)) if (0 === r) {
6284
+ */ Ze(e) {
6285
+ var t, n;
6286
+ const r = e.targetId, i = e.pe.count, s = this.Xe(r);
6287
+ if (s) {
6288
+ const o = s.target;
6289
+ if (__PRIVATE_targetIsDocumentTarget(o)) if (0 === i) {
6290
6290
  // The existence filter told us the document does not exist. We deduce
6291
6291
  // that this document does not exist and apply a deleted document to
6292
6292
  // our updates. Without applying this deleted document there might be
6293
6293
  // another query that will raise this document as part of a snapshot
6294
6294
  // until it is resolved, essentially exposing inconsistency between
6295
6295
  // queries.
6296
- const e = new DocumentKey(s.path);
6297
- this.je(n, e, MutableDocument.newNoDocument(e, SnapshotVersion.min()));
6298
- } else __PRIVATE_hardAssert(1 === r); else {
6299
- const i = this.tt(n);
6296
+ const e = new DocumentKey(o.path);
6297
+ this.ze(r, e, MutableDocument.newNoDocument(e, SnapshotVersion.min()));
6298
+ } else __PRIVATE_hardAssert(1 === i); else {
6299
+ const s = this.et(r);
6300
6300
  // Existence filter mismatch. Mark the documents as being in limbo, and
6301
6301
  // raise a snapshot with `isFromCache:true`.
6302
- if (i !== r) {
6302
+ if (s !== i) {
6303
6303
  // Apply bloom filter to identify and mark removed documents.
6304
- const r = this.nt(e, i);
6305
- if (0 /* BloomFilterApplicationStatus.Success */ !== r) {
6304
+ const i = this.tt(e, s);
6305
+ if (0 /* BloomFilterApplicationStatus.Success */ !== i.status) {
6306
6306
  // If bloom filter application fails, we reset the mapping and
6307
6307
  // trigger re-run of the query.
6308
- this.Ze(n);
6309
- const e = 2 /* BloomFilterApplicationStatus.FalsePositive */ === r ? "TargetPurposeExistenceFilterMismatchBloom" /* TargetPurpose.ExistenceFilterMismatchBloom */ : "TargetPurposeExistenceFilterMismatch" /* TargetPurpose.ExistenceFilterMismatch */;
6310
- this.We = this.We.insert(n, e);
6308
+ this.Ye(r);
6309
+ const e = 2 /* BloomFilterApplicationStatus.FalsePositive */ === i.status ? "TargetPurposeExistenceFilterMismatchBloom" /* TargetPurpose.ExistenceFilterMismatchBloom */ : "TargetPurposeExistenceFilterMismatch" /* TargetPurpose.ExistenceFilterMismatch */;
6310
+ this.Ue = this.Ue.insert(r, e);
6311
6311
  }
6312
- null === (t = __PRIVATE_TestingHooks.instance) || void 0 === t || t.notifyOnExistenceFilterMismatch(function __PRIVATE_createExistenceFilterMismatchInfoForTestingHooks(e, t, n) {
6313
- var r, i, s, o, _, a;
6314
- const u = {
6315
- localCacheCount: t,
6316
- existenceFilterCount: n.count
6317
- }, c = n.unchangedNames;
6318
- c && (u.bloomFilter = {
6312
+ null === (t = __PRIVATE_TestingHooks.instance) || void 0 === t || t.notifyOnExistenceFilterMismatch(function __PRIVATE_createExistenceFilterMismatchInfoForTestingHooks(e, t, n, r) {
6313
+ var i, s, o, _, a, u;
6314
+ const c = {
6315
+ localCacheCount: n,
6316
+ existenceFilterCount: r.count
6317
+ }, l = r.unchangedNames;
6318
+ l && (c.bloomFilter = {
6319
6319
  applied: 0 /* BloomFilterApplicationStatus.Success */ === e,
6320
- hashCount: null !== (r = null == c ? void 0 : c.hashCount) && void 0 !== r ? r : 0,
6321
- bitmapLength: null !== (o = null === (s = null === (i = null == c ? void 0 : c.bits) || void 0 === i ? void 0 : i.bitmap) || void 0 === s ? void 0 : s.length) && void 0 !== o ? o : 0,
6322
- padding: null !== (a = null === (_ = null == c ? void 0 : c.bits) || void 0 === _ ? void 0 : _.padding) && void 0 !== a ? a : 0
6323
- });
6324
- return u;
6320
+ hashCount: null !== (i = null == l ? void 0 : l.hashCount) && void 0 !== i ? i : 0,
6321
+ bitmapLength: null !== (_ = null === (o = null === (s = null == l ? void 0 : l.bits) || void 0 === s ? void 0 : s.bitmap) || void 0 === o ? void 0 : o.length) && void 0 !== _ ? _ : 0,
6322
+ padding: null !== (u = null === (a = null == l ? void 0 : l.bits) || void 0 === a ? void 0 : a.padding) && void 0 !== u ? u : 0
6323
+ }, t && (c.bloomFilter.mightContain = t));
6324
+ return c;
6325
6325
  }
6326
6326
  /**
6327
6327
  * @license
@@ -6338,7 +6338,7 @@ class __PRIVATE_WatchChangeAggregator {
6338
6338
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6339
6339
  * See the License for the specific language governing permissions and
6340
6340
  * limitations under the License.
6341
- */ (r, i, e.ye));
6341
+ */ (i.status, null !== (n = i.nt) && void 0 !== n ? n : null, s, e.pe));
6342
6342
  }
6343
6343
  }
6344
6344
  }
@@ -6346,16 +6346,20 @@ class __PRIVATE_WatchChangeAggregator {
6346
6346
  /**
6347
6347
  * Apply bloom filter to remove the deleted documents, and return the
6348
6348
  * application status.
6349
- */ nt(e, t) {
6350
- const {unchangedNames: n, count: r} = e.ye;
6351
- if (!n || !n.bits) return 1 /* BloomFilterApplicationStatus.Skipped */;
6349
+ */ tt(e, t) {
6350
+ const {unchangedNames: n, count: r} = e.pe;
6351
+ if (!n || !n.bits) return {
6352
+ status: 1
6353
+ /* BloomFilterApplicationStatus.Skipped */ };
6352
6354
  const {bits: {bitmap: i = "", padding: s = 0}, hashCount: o = 0} = n;
6353
6355
  let _, a;
6354
6356
  try {
6355
6357
  _ = __PRIVATE_normalizeByteString(i).toUint8Array();
6356
6358
  } catch (e) {
6357
6359
  if (e instanceof __PRIVATE_Base64DecodeError) return __PRIVATE_logWarn("Decoding the base64 bloom filter in existence filter failed (" + e.message + "); ignoring the bloom filter and falling back to full re-query."),
6358
- 1 /* BloomFilterApplicationStatus.Skipped */;
6360
+ {
6361
+ status: 1
6362
+ /* BloomFilterApplicationStatus.Skipped */ };
6359
6363
  throw e;
6360
6364
  }
6361
6365
  try {
@@ -6363,20 +6367,30 @@ class __PRIVATE_WatchChangeAggregator {
6363
6367
  a = new BloomFilter(_, s, o);
6364
6368
  } catch (e) {
6365
6369
  return __PRIVATE_logWarn(e instanceof __PRIVATE_BloomFilterError ? "BloomFilter error: " : "Applying bloom filter failed: ", e),
6366
- 1 /* BloomFilterApplicationStatus.Skipped */;
6370
+ {
6371
+ status: 1
6372
+ /* BloomFilterApplicationStatus.Skipped */ };
6367
6373
  }
6368
- if (0 === a.de) return 1 /* BloomFilterApplicationStatus.Skipped */;
6369
- return r !== t - this.rt(e.targetId, a) ? 2 /* BloomFilterApplicationStatus.FalsePositive */ : 0 /* BloomFilterApplicationStatus.Success */;
6374
+ const __PRIVATE_bloomFilterMightContain = e => {
6375
+ const t = this.qe.rt();
6376
+ return a.mightContain(`projects/${t.projectId}/databases/${t.database}/documents/${e}`);
6377
+ };
6378
+ if (0 === a.de) return {
6379
+ status: 1
6380
+ /* BloomFilterApplicationStatus.Skipped */ };
6381
+ return {
6382
+ status: r === t - this.it(e.targetId, __PRIVATE_bloomFilterMightContain) ? 0 /* BloomFilterApplicationStatus.Success */ : 2 /* BloomFilterApplicationStatus.FalsePositive */ ,
6383
+ nt: __PRIVATE_bloomFilterMightContain
6384
+ };
6370
6385
  }
6371
6386
  /**
6372
6387
  * Filter out removed documents based on bloom filter membership result and
6373
6388
  * return number of documents removed.
6374
- */ rt(e, t) {
6375
- const n = this.Qe.getRemoteKeysForTarget(e);
6389
+ */ it(e, t) {
6390
+ const n = this.qe.getRemoteKeysForTarget(e);
6376
6391
  let r = 0;
6377
6392
  return n.forEach((n => {
6378
- const i = this.Qe.it(), s = `projects/${i.projectId}/databases/${i.database}/documents/${n.path.canonicalString()}`;
6379
- t.me(s) || (this.je(e, n, /*updatedDocument=*/ null), r++);
6393
+ t(n.path.canonicalString()) || (this.ze(e, n, /*updatedDocument=*/ null), r++);
6380
6394
  })), r;
6381
6395
  }
6382
6396
  /**
@@ -6384,8 +6398,8 @@ class __PRIVATE_WatchChangeAggregator {
6384
6398
  * provided snapshot version. Resets the accumulated changes before returning.
6385
6399
  */ st(e) {
6386
6400
  const t = new Map;
6387
- this.Ke.forEach(((n, r) => {
6388
- const i = this.et(r);
6401
+ this.Qe.forEach(((n, r) => {
6402
+ const i = this.Xe(r);
6389
6403
  if (i) {
6390
6404
  if (n.current && __PRIVATE_targetIsDocumentTarget(i.target)) {
6391
6405
  // Document queries for document that don't exist can produce an empty
@@ -6397,9 +6411,9 @@ class __PRIVATE_WatchChangeAggregator {
6397
6411
  // instead resulting in an explicit delete message and we could
6398
6412
  // remove this special logic.
6399
6413
  const t = new DocumentKey(i.target.path);
6400
- null !== this.$e.get(t) || this.ot(r, t) || this.je(r, t, MutableDocument.newNoDocument(t, e));
6414
+ null !== this.Ke.get(t) || this.ot(r, t) || this.ze(r, t, MutableDocument.newNoDocument(t, e));
6401
6415
  }
6402
- n.Fe && (t.set(r, n.xe()), n.Oe());
6416
+ n.Ce && (t.set(r, n.Me()), n.xe());
6403
6417
  }
6404
6418
  }));
6405
6419
  let n = __PRIVATE_documentKeySet();
@@ -6408,27 +6422,27 @@ class __PRIVATE_WatchChangeAggregator {
6408
6422
 
6409
6423
  // TODO(gsoltis): Expand on this comment once GC is available in the JS
6410
6424
  // client.
6411
- this.Ue.forEach(((e, t) => {
6425
+ this.$e.forEach(((e, t) => {
6412
6426
  let r = !0;
6413
6427
  t.forEachWhile((e => {
6414
- const t = this.et(e);
6428
+ const t = this.Xe(e);
6415
6429
  return !t || "TargetPurposeLimboResolution" /* TargetPurpose.LimboResolution */ === t.purpose || (r = !1,
6416
6430
  !1);
6417
6431
  })), r && (n = n.add(e));
6418
- })), this.$e.forEach(((t, n) => n.setReadTime(e)));
6419
- const r = new RemoteEvent(e, t, this.We, this.$e, n);
6420
- return this.$e = __PRIVATE_mutableDocumentMap(), this.Ue = __PRIVATE_documentTargetMap(),
6421
- this.We = new SortedMap(__PRIVATE_primitiveComparator), r;
6432
+ })), this.Ke.forEach(((t, n) => n.setReadTime(e)));
6433
+ const r = new RemoteEvent(e, t, this.Ue, this.Ke, n);
6434
+ return this.Ke = __PRIVATE_mutableDocumentMap(), this.$e = __PRIVATE_documentTargetMap(),
6435
+ this.Ue = new SortedMap(__PRIVATE_primitiveComparator), r;
6422
6436
  }
6423
6437
  /**
6424
6438
  * Adds the provided document to the internal list of document updates and
6425
6439
  * its document key to the given target's mapping.
6426
6440
  */
6427
6441
  // Visible for testing.
6428
- ze(e, t) {
6429
- if (!this.Ye(e)) return;
6442
+ Ge(e, t) {
6443
+ if (!this.Je(e)) return;
6430
6444
  const n = this.ot(e, t.key) ? 2 /* ChangeType.Modified */ : 0 /* ChangeType.Added */;
6431
- this.Je(e).Ne(t.key, n), this.$e = this.$e.insert(t.key, t), this.Ue = this.Ue.insert(t.key, this._t(t.key).add(e));
6445
+ this.He(e).Oe(t.key, n), this.Ke = this.Ke.insert(t.key, t), this.$e = this.$e.insert(t.key, this._t(t.key).add(e));
6432
6446
  }
6433
6447
  /**
6434
6448
  * Removes the provided document from the target mapping. If the
@@ -6438,71 +6452,71 @@ class __PRIVATE_WatchChangeAggregator {
6438
6452
  * to update the remote document cache.
6439
6453
  */
6440
6454
  // Visible for testing.
6441
- je(e, t, n) {
6442
- if (!this.Ye(e)) return;
6443
- const r = this.Je(e);
6444
- this.ot(e, t) ? r.Ne(t, 1 /* ChangeType.Removed */) :
6455
+ ze(e, t, n) {
6456
+ if (!this.Je(e)) return;
6457
+ const r = this.He(e);
6458
+ this.ot(e, t) ? r.Oe(t, 1 /* ChangeType.Removed */) :
6445
6459
  // The document may have entered and left the target before we raised a
6446
6460
  // snapshot, so we can just ignore the change.
6447
- r.Be(t), this.Ue = this.Ue.insert(t, this._t(t).delete(e)), n && (this.$e = this.$e.insert(t, n));
6461
+ r.Ne(t), this.$e = this.$e.insert(t, this._t(t).delete(e)), n && (this.Ke = this.Ke.insert(t, n));
6448
6462
  }
6449
6463
  removeTarget(e) {
6450
- this.Ke.delete(e);
6464
+ this.Qe.delete(e);
6451
6465
  }
6452
6466
  /**
6453
6467
  * Returns the current count of documents in the target. This includes both
6454
6468
  * the number of documents that the LocalStore considers to be part of the
6455
6469
  * target as well as any accumulated changes.
6456
- */ tt(e) {
6457
- const t = this.Je(e).xe();
6458
- return this.Qe.getRemoteKeysForTarget(e).size + t.addedDocuments.size - t.removedDocuments.size;
6470
+ */ et(e) {
6471
+ const t = this.He(e).Me();
6472
+ return this.qe.getRemoteKeysForTarget(e).size + t.addedDocuments.size - t.removedDocuments.size;
6459
6473
  }
6460
6474
  /**
6461
6475
  * Increment the number of acks needed from watch before we can consider the
6462
6476
  * server to be 'in-sync' with the client's active targets.
6463
- */ Le(e) {
6464
- this.Je(e).Le();
6477
+ */ Be(e) {
6478
+ this.He(e).Be();
6465
6479
  }
6466
- Je(e) {
6467
- let t = this.Ke.get(e);
6468
- return t || (t = new __PRIVATE_TargetState, this.Ke.set(e, t)), t;
6480
+ He(e) {
6481
+ let t = this.Qe.get(e);
6482
+ return t || (t = new __PRIVATE_TargetState, this.Qe.set(e, t)), t;
6469
6483
  }
6470
6484
  _t(e) {
6471
- let t = this.Ue.get(e);
6472
- return t || (t = new SortedSet(__PRIVATE_primitiveComparator), this.Ue = this.Ue.insert(e, t)),
6485
+ let t = this.$e.get(e);
6486
+ return t || (t = new SortedSet(__PRIVATE_primitiveComparator), this.$e = this.$e.insert(e, t)),
6473
6487
  t;
6474
6488
  }
6475
6489
  /**
6476
6490
  * Verifies that the user is still interested in this target (by calling
6477
6491
  * `getTargetDataForTarget()`) and that we are not waiting for pending ADDs
6478
6492
  * from watch.
6479
- */ Ye(e) {
6480
- const t = null !== this.et(e);
6493
+ */ Je(e) {
6494
+ const t = null !== this.Xe(e);
6481
6495
  return t || __PRIVATE_logDebug("WatchChangeAggregator", "Detected inactive target", e),
6482
6496
  t;
6483
6497
  }
6484
6498
  /**
6485
6499
  * Returns the TargetData for an active target (i.e. a target that the user
6486
6500
  * is still interested in that has no outstanding target change requests).
6487
- */ et(e) {
6488
- const t = this.Ke.get(e);
6489
- return t && t.Ce ? null : this.Qe.ut(e);
6501
+ */ Xe(e) {
6502
+ const t = this.Qe.get(e);
6503
+ return t && t.ve ? null : this.qe.ut(e);
6490
6504
  }
6491
6505
  /**
6492
6506
  * Resets the state of a Watch target to its initial state (e.g. sets
6493
6507
  * 'current' to false, clears the resume token and removes its target mapping
6494
6508
  * from all documents).
6495
- */ Ze(e) {
6496
- this.Ke.set(e, new __PRIVATE_TargetState);
6497
- this.Qe.getRemoteKeysForTarget(e).forEach((t => {
6498
- this.je(e, t, /*updatedDocument=*/ null);
6509
+ */ Ye(e) {
6510
+ this.Qe.set(e, new __PRIVATE_TargetState);
6511
+ this.qe.getRemoteKeysForTarget(e).forEach((t => {
6512
+ this.ze(e, t, /*updatedDocument=*/ null);
6499
6513
  }));
6500
6514
  }
6501
6515
  /**
6502
6516
  * Returns whether the LocalStore considers the document to be part of the
6503
6517
  * specified target.
6504
6518
  */ ot(e, t) {
6505
- return this.Qe.getRemoteKeysForTarget(e).has(t);
6519
+ return this.qe.getRemoteKeysForTarget(e).has(t);
6506
6520
  }
6507
6521
  }
6508
6522
 
@@ -14563,7 +14577,7 @@ function __PRIVATE_remoteStoreListen(e, t) {
14563
14577
  * We need to increment the the expected number of pending responses we're due
14564
14578
  * from watch so we wait for the ack to process any messages from this target.
14565
14579
  */ function __PRIVATE_sendWatchRequest(e, t) {
14566
- if (e.b_.Le(t.targetId), t.resumeToken.approximateByteSize() > 0 || t.snapshotVersion.compareTo(SnapshotVersion.min()) > 0) {
14580
+ if (e.b_.Be(t.targetId), t.resumeToken.approximateByteSize() > 0 || t.snapshotVersion.compareTo(SnapshotVersion.min()) > 0) {
14567
14581
  const n = e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;
14568
14582
  t = t.withExpectedCount(n);
14569
14583
  }
@@ -14575,14 +14589,14 @@ function __PRIVATE_remoteStoreListen(e, t) {
14575
14589
  * from watch so we wait for the removal on the server before we process any
14576
14590
  * messages from this target.
14577
14591
  */ function __PRIVATE_sendUnwatchRequest(e, t) {
14578
- e.b_.Le(t), __PRIVATE_ensureWatchStream(e).i_(t);
14592
+ e.b_.Be(t), __PRIVATE_ensureWatchStream(e).i_(t);
14579
14593
  }
14580
14594
 
14581
14595
  function __PRIVATE_startWatchStream(e) {
14582
14596
  e.b_ = new __PRIVATE_WatchChangeAggregator({
14583
14597
  getRemoteKeysForTarget: t => e.remoteSyncer.getRemoteKeysForTarget(t),
14584
14598
  ut: t => e.g_.get(t) || null,
14585
- it: () => e.datastore.serializer.databaseId
14599
+ rt: () => e.datastore.serializer.databaseId
14586
14600
  }), __PRIVATE_ensureWatchStream(e).start(), e.S_.d_();
14587
14601
  }
14588
14602
 
@@ -14643,7 +14657,7 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
14643
14657
  } catch (n) {
14644
14658
  __PRIVATE_logDebug("RemoteStore", "Failed to remove targets %s: %s ", t.targetIds.join(","), n),
14645
14659
  await __PRIVATE_disableNetworkUntilRecovery(e, n);
14646
- } else if (t instanceof __PRIVATE_DocumentWatchChange ? e.b_.Ge(t) : t instanceof __PRIVATE_ExistenceFilterChange ? e.b_.Xe(t) : e.b_.He(t),
14660
+ } else if (t instanceof __PRIVATE_DocumentWatchChange ? e.b_.We(t) : t instanceof __PRIVATE_ExistenceFilterChange ? e.b_.Ze(t) : e.b_.je(t),
14647
14661
  !n.isEqual(SnapshotVersion.min())) try {
14648
14662
  const t = await __PRIVATE_localStoreGetLastRemoteSnapshotVersion(e.localStore);
14649
14663
  n.compareTo(t) >= 0 &&
@@ -21537,9 +21551,9 @@ function __PRIVATE_tryGetString(e, t) {
21537
21551
  return r = Object.assign({
21538
21552
  useFetchStreams: t
21539
21553
  }, r), s._setSettings(r), s;
21540
- }), "PUBLIC").setMultipleInstances(!0)), app.registerVersion(S, "3.13.0-canary.684bb4e45", e),
21554
+ }), "PUBLIC").setMultipleInstances(!0)), app.registerVersion(S, "3.13.0-canary.794441e73", e),
21541
21555
  // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
21542
- app.registerVersion(S, "3.13.0-canary.684bb4e45", "cjs2017");
21556
+ app.registerVersion(S, "3.13.0-canary.794441e73", "cjs2017");
21543
21557
  }();
21544
21558
 
21545
21559
  exports.AbstractUserDataWriter = AbstractUserDataWriter;