@firebase/firestore 3.13.0-canary.f2fb56fc0 → 3.13.0-canary.f3067f72d

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 (46) hide show
  1. package/dist/firestore/src/global_index.d.ts +15 -1
  2. package/dist/firestore/src/lite-api/types.d.ts +1 -1
  3. package/dist/firestore/src/util/testing_hooks.d.ts +14 -0
  4. package/dist/firestore/test/integration/util/helpers.d.ts +63 -16
  5. package/dist/firestore/test/integration/util/internal_helpers.d.ts +2 -1
  6. package/dist/firestore/test/integration/util/testing_hooks_util.d.ts +1 -0
  7. package/dist/index.cjs.js +150 -136
  8. package/dist/index.cjs.js.map +1 -1
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.esm2017.js +150 -136
  11. package/dist/index.esm2017.js.map +1 -1
  12. package/dist/index.esm5.js +147 -133
  13. package/dist/index.esm5.js.map +1 -1
  14. package/dist/index.node.cjs.js +27 -21
  15. package/dist/index.node.cjs.js.map +1 -1
  16. package/dist/index.node.mjs +27 -21
  17. package/dist/index.node.mjs.map +1 -1
  18. package/dist/index.rn.js +150 -136
  19. package/dist/index.rn.js.map +1 -1
  20. package/dist/internal.d.ts +15 -1
  21. package/dist/lite/firestore/src/lite-api/types.d.ts +1 -1
  22. package/dist/lite/firestore/src/util/testing_hooks.d.ts +14 -0
  23. package/dist/lite/firestore/test/integration/util/helpers.d.ts +63 -16
  24. package/dist/lite/firestore/test/integration/util/internal_helpers.d.ts +2 -1
  25. package/dist/lite/firestore/test/integration/util/testing_hooks_util.d.ts +1 -0
  26. package/dist/lite/index.browser.esm2017.js +2 -2
  27. package/dist/lite/index.browser.esm5.js +2 -2
  28. package/dist/lite/index.cjs.js +2 -2
  29. package/dist/lite/index.d.ts +1 -1
  30. package/dist/lite/index.node.cjs.js +2 -2
  31. package/dist/lite/index.node.mjs +2 -2
  32. package/dist/lite/index.rn.esm2017.js +2 -2
  33. package/dist/lite/internal.d.ts +1 -1
  34. package/dist/lite/packages/firestore/src/lite-api/types.d.ts +1 -1
  35. package/dist/lite/packages/firestore/src/util/testing_hooks.d.ts +14 -0
  36. package/dist/lite/packages/firestore/test/integration/util/helpers.d.ts +63 -16
  37. package/dist/lite/packages/firestore/test/integration/util/internal_helpers.d.ts +2 -1
  38. package/dist/lite/packages/firestore/test/integration/util/testing_hooks_util.d.ts +1 -0
  39. package/dist/lite/private.d.ts +1 -1
  40. package/dist/packages/firestore/src/lite-api/types.d.ts +1 -1
  41. package/dist/packages/firestore/src/util/testing_hooks.d.ts +14 -0
  42. package/dist/packages/firestore/test/integration/util/helpers.d.ts +63 -16
  43. package/dist/packages/firestore/test/integration/util/internal_helpers.d.ts +2 -1
  44. package/dist/packages/firestore/test/integration/util/testing_hooks_util.d.ts +1 -0
  45. package/dist/private.d.ts +15 -1
  46. package/package.json +9 -9
package/dist/index.d.ts CHANGED
@@ -24,7 +24,7 @@ export declare function addDoc<AppModelType, DbModelType extends DocumentData>(r
24
24
  * to a dot.
25
25
  */
26
26
  export declare type AddPrefixToKeys<Prefix extends string, T extends Record<string, unknown>> = {
27
- [K in keyof T & string as `${Prefix}.${K}`]+?: T[K];
27
+ [K in keyof T & string as `${Prefix}.${K}`]+?: string extends K ? any : T[K];
28
28
  };
29
29
  /**
30
30
  * Represents an aggregation that can be performed by Firestore.
@@ -66,7 +66,7 @@ User.MOCK_USER = new User("mock-user");
66
66
  * See the License for the specific language governing permissions and
67
67
  * limitations under the License.
68
68
  */
69
- let b = "9.23.0-canary.f2fb56fc0";
69
+ let b = "9.23.0-canary.f3067f72d";
70
70
 
71
71
  /**
72
72
  * @license
@@ -5893,7 +5893,7 @@ class BloomFilter {
5893
5893
  Ve(e) {
5894
5894
  return 0 != (this.bitmap[Math.floor(e / 8)] & 1 << e % 8);
5895
5895
  }
5896
- me(e) {
5896
+ mightContain(e) {
5897
5897
  // Empty bitmap should always return false on membership check.
5898
5898
  if (0 === this.de) return !1;
5899
5899
  const t = __PRIVATE_getMd5HashValue(e), [n, r] = __PRIVATE_get64BitUints(t);
@@ -5912,10 +5912,10 @@ class BloomFilter {
5912
5912
  const t = __PRIVATE_getMd5HashValue(e), [n, r] = __PRIVATE_get64BitUints(t);
5913
5913
  for (let e = 0; e < this.hashCount; e++) {
5914
5914
  const t = this.Re(n, r, e);
5915
- this.fe(t);
5915
+ this.me(t);
5916
5916
  }
5917
5917
  }
5918
- fe(e) {
5918
+ me(e) {
5919
5919
  const t = Math.floor(e / 8), n = e % 8;
5920
5920
  this.bitmap[t] |= 1 << n;
5921
5921
  }
@@ -6072,13 +6072,13 @@ class __PRIVATE_BloomFilterError extends Error {
6072
6072
  * document went out of view without the server sending a new document.
6073
6073
  */
6074
6074
  r) {
6075
- this.ge = e, this.removedTargetIds = t, this.key = n, this.pe = r;
6075
+ this.fe = e, this.removedTargetIds = t, this.key = n, this.ge = r;
6076
6076
  }
6077
6077
  }
6078
6078
 
6079
6079
  class __PRIVATE_ExistenceFilterChange {
6080
6080
  constructor(e, t) {
6081
- this.targetId = e, this.ye = t;
6081
+ this.targetId = e, this.pe = t;
6082
6082
  }
6083
6083
  }
6084
6084
 
@@ -6106,22 +6106,22 @@ class __PRIVATE_WatchTargetChange {
6106
6106
  * The number of pending responses (adds or removes) that we are waiting on.
6107
6107
  * We only consider targets active that have no pending responses.
6108
6108
  */
6109
- this.we = 0,
6109
+ this.ye = 0,
6110
6110
  /**
6111
6111
  * Keeps track of the document changes since the last raised snapshot.
6112
6112
  *
6113
6113
  * These changes are continuously updated as we receive document updates and
6114
6114
  * always reflect the current set of changes against the last issued snapshot.
6115
6115
  */
6116
- this.Se = __PRIVATE_snapshotChangesMap(),
6116
+ this.we = __PRIVATE_snapshotChangesMap(),
6117
6117
  /** See public getters for explanations of these fields. */
6118
- this.be = ByteString.EMPTY_BYTE_STRING, this.De = !1,
6118
+ this.Se = ByteString.EMPTY_BYTE_STRING, this.be = !1,
6119
6119
  /**
6120
6120
  * Whether this target state should be included in the next snapshot. We
6121
6121
  * initialize to true so that newly-added targets are included in the next
6122
6122
  * RemoteEvent.
6123
6123
  */
6124
- this.ve = !0;
6124
+ this.De = !0;
6125
6125
  }
6126
6126
  /**
6127
6127
  * Whether this target has been marked 'current'.
@@ -6131,31 +6131,31 @@ class __PRIVATE_WatchTargetChange {
6131
6131
  * was added and that the target is consistent with the rest of the watch
6132
6132
  * stream.
6133
6133
  */ get current() {
6134
- return this.De;
6134
+ return this.be;
6135
6135
  }
6136
6136
  /** The last resume token sent to us for this target. */ get resumeToken() {
6137
- return this.be;
6137
+ return this.Se;
6138
6138
  }
6139
- /** Whether this target has pending target adds or target removes. */ get Ce() {
6140
- return 0 !== this.we;
6139
+ /** Whether this target has pending target adds or target removes. */ get ve() {
6140
+ return 0 !== this.ye;
6141
6141
  }
6142
- /** Whether we have modified any state that should trigger a snapshot. */ get Fe() {
6143
- return this.ve;
6142
+ /** Whether we have modified any state that should trigger a snapshot. */ get Ce() {
6143
+ return this.De;
6144
6144
  }
6145
6145
  /**
6146
6146
  * Applies the resume token to the TargetChange, but only when it has a new
6147
6147
  * value. Empty resumeTokens are discarded.
6148
- */ Me(e) {
6149
- e.approximateByteSize() > 0 && (this.ve = !0, this.be = e);
6148
+ */ Fe(e) {
6149
+ e.approximateByteSize() > 0 && (this.De = !0, this.Se = e);
6150
6150
  }
6151
6151
  /**
6152
6152
  * Creates a target change from the current set of changes.
6153
6153
  *
6154
6154
  * To reset the document changes after raising this snapshot, call
6155
6155
  * `clearPendingChanges()`.
6156
- */ xe() {
6156
+ */ Me() {
6157
6157
  let e = __PRIVATE_documentKeySet(), t = __PRIVATE_documentKeySet(), n = __PRIVATE_documentKeySet();
6158
- return this.Se.forEach(((r, i) => {
6158
+ return this.we.forEach(((r, i) => {
6159
6159
  switch (i) {
6160
6160
  case 0 /* ChangeType.Added */ :
6161
6161
  e = e.add(r);
@@ -6172,27 +6172,27 @@ class __PRIVATE_WatchTargetChange {
6172
6172
  default:
6173
6173
  fail();
6174
6174
  }
6175
- })), new TargetChange(this.be, this.De, e, t, n);
6175
+ })), new TargetChange(this.Se, this.be, e, t, n);
6176
6176
  }
6177
6177
  /**
6178
6178
  * Resets the document changes and sets `hasPendingChanges` to false.
6179
- */ Oe() {
6180
- this.ve = !1, this.Se = __PRIVATE_snapshotChangesMap();
6179
+ */ xe() {
6180
+ this.De = !1, this.we = __PRIVATE_snapshotChangesMap();
6181
+ }
6182
+ Oe(e, t) {
6183
+ this.De = !0, this.we = this.we.insert(e, t);
6181
6184
  }
6182
- Ne(e, t) {
6183
- this.ve = !0, this.Se = this.Se.insert(e, t);
6185
+ Ne(e) {
6186
+ this.De = !0, this.we = this.we.remove(e);
6184
6187
  }
6185
- Be(e) {
6186
- this.ve = !0, this.Se = this.Se.remove(e);
6188
+ Be() {
6189
+ this.ye += 1;
6187
6190
  }
6188
6191
  Le() {
6189
- this.we += 1;
6192
+ this.ye -= 1;
6190
6193
  }
6191
6194
  ke() {
6192
- this.we -= 1;
6193
- }
6194
- qe() {
6195
- this.ve = !0, this.De = !0;
6195
+ this.De = !0, this.be = !0;
6196
6196
  }
6197
6197
  }
6198
6198
 
@@ -6201,42 +6201,42 @@ class __PRIVATE_WatchTargetChange {
6201
6201
  */
6202
6202
  class __PRIVATE_WatchChangeAggregator {
6203
6203
  constructor(e) {
6204
- this.Qe = e,
6204
+ this.qe = e,
6205
6205
  /** The internal state of all tracked targets. */
6206
- this.Ke = new Map,
6206
+ this.Qe = new Map,
6207
6207
  /** Keeps track of the documents to update since the last raised snapshot. */
6208
- this.$e = __PRIVATE_mutableDocumentMap(),
6208
+ this.Ke = __PRIVATE_mutableDocumentMap(),
6209
6209
  /** A mapping of document keys to their set of target IDs. */
6210
- this.Ue = __PRIVATE_documentTargetMap(),
6210
+ this.$e = __PRIVATE_documentTargetMap(),
6211
6211
  /**
6212
6212
  * A map of targets with existence filter mismatches. These targets are
6213
6213
  * known to be inconsistent and their listens needs to be re-established by
6214
6214
  * RemoteStore.
6215
6215
  */
6216
- this.We = new SortedMap(__PRIVATE_primitiveComparator);
6216
+ this.Ue = new SortedMap(__PRIVATE_primitiveComparator);
6217
6217
  }
6218
6218
  /**
6219
6219
  * Processes and adds the DocumentWatchChange to the current set of changes.
6220
- */ Ge(e) {
6221
- for (const t of e.ge) e.pe && e.pe.isFoundDocument() ? this.ze(t, e.pe) : this.je(t, e.key, e.pe);
6222
- for (const t of e.removedTargetIds) this.je(t, e.key, e.pe);
6220
+ */ We(e) {
6221
+ for (const t of e.fe) e.ge && e.ge.isFoundDocument() ? this.Ge(t, e.ge) : this.ze(t, e.key, e.ge);
6222
+ for (const t of e.removedTargetIds) this.ze(t, e.key, e.ge);
6223
6223
  }
6224
- /** Processes and adds the WatchTargetChange to the current set of changes. */ He(e) {
6224
+ /** Processes and adds the WatchTargetChange to the current set of changes. */ je(e) {
6225
6225
  this.forEachTarget(e, (t => {
6226
- const n = this.Je(t);
6226
+ const n = this.He(t);
6227
6227
  switch (e.state) {
6228
6228
  case 0 /* WatchTargetChangeState.NoChange */ :
6229
- this.Ye(t) && n.Me(e.resumeToken);
6229
+ this.Je(t) && n.Fe(e.resumeToken);
6230
6230
  break;
6231
6231
 
6232
6232
  case 1 /* WatchTargetChangeState.Added */ :
6233
6233
  // We need to decrement the number of pending acks needed from watch
6234
6234
  // for this targetId.
6235
- n.ke(), n.Ce ||
6235
+ n.Le(), n.ve ||
6236
6236
  // We have a freshly added target, so we need to reset any state
6237
6237
  // that we had previously. This can happen e.g. when remove and add
6238
6238
  // back a target for existence filter mismatches.
6239
- n.Oe(), n.Me(e.resumeToken);
6239
+ n.xe(), n.Fe(e.resumeToken);
6240
6240
  break;
6241
6241
 
6242
6242
  case 2 /* WatchTargetChangeState.Removed */ :
@@ -6244,19 +6244,19 @@ class __PRIVATE_WatchChangeAggregator {
6244
6244
  // remove any target changes.
6245
6245
  // We need to decrement the number of pending acks needed from watch
6246
6246
  // for this targetId.
6247
- n.ke(), n.Ce || this.removeTarget(t);
6247
+ n.Le(), n.ve || this.removeTarget(t);
6248
6248
  break;
6249
6249
 
6250
6250
  case 3 /* WatchTargetChangeState.Current */ :
6251
- this.Ye(t) && (n.qe(), n.Me(e.resumeToken));
6251
+ this.Je(t) && (n.ke(), n.Fe(e.resumeToken));
6252
6252
  break;
6253
6253
 
6254
6254
  case 4 /* WatchTargetChangeState.Reset */ :
6255
- this.Ye(t) && (
6255
+ this.Je(t) && (
6256
6256
  // Reset the target and synthesizes removes for all existing
6257
6257
  // documents. The backend will re-add any documents that still
6258
6258
  // match the target before it sends the next global snapshot.
6259
- this.Ze(t), n.Me(e.resumeToken));
6259
+ this.Ye(t), n.Fe(e.resumeToken));
6260
6260
  break;
6261
6261
 
6262
6262
  default:
@@ -6269,55 +6269,55 @@ class __PRIVATE_WatchChangeAggregator {
6269
6269
  * targetIds explicitly listed in the change or the targetIds of all currently
6270
6270
  * active targets.
6271
6271
  */ forEachTarget(e, t) {
6272
- e.targetIds.length > 0 ? e.targetIds.forEach(t) : this.Ke.forEach(((e, n) => {
6273
- this.Ye(n) && t(n);
6272
+ e.targetIds.length > 0 ? e.targetIds.forEach(t) : this.Qe.forEach(((e, n) => {
6273
+ this.Je(n) && t(n);
6274
6274
  }));
6275
6275
  }
6276
6276
  /**
6277
6277
  * Handles existence filters and synthesizes deletes for filter mismatches.
6278
6278
  * Targets that are invalidated by filter mismatches are added to
6279
6279
  * `pendingTargetResets`.
6280
- */ Xe(e) {
6281
- var t;
6282
- const n = e.targetId, r = e.ye.count, i = this.et(n);
6283
- if (i) {
6284
- const s = i.target;
6285
- if (__PRIVATE_targetIsDocumentTarget(s)) if (0 === r) {
6280
+ */ Ze(e) {
6281
+ var t, n;
6282
+ const r = e.targetId, i = e.pe.count, s = this.Xe(r);
6283
+ if (s) {
6284
+ const o = s.target;
6285
+ if (__PRIVATE_targetIsDocumentTarget(o)) if (0 === i) {
6286
6286
  // The existence filter told us the document does not exist. We deduce
6287
6287
  // that this document does not exist and apply a deleted document to
6288
6288
  // our updates. Without applying this deleted document there might be
6289
6289
  // another query that will raise this document as part of a snapshot
6290
6290
  // until it is resolved, essentially exposing inconsistency between
6291
6291
  // queries.
6292
- const e = new DocumentKey(s.path);
6293
- this.je(n, e, MutableDocument.newNoDocument(e, SnapshotVersion.min()));
6294
- } else __PRIVATE_hardAssert(1 === r); else {
6295
- const i = this.tt(n);
6292
+ const e = new DocumentKey(o.path);
6293
+ this.ze(r, e, MutableDocument.newNoDocument(e, SnapshotVersion.min()));
6294
+ } else __PRIVATE_hardAssert(1 === i); else {
6295
+ const s = this.et(r);
6296
6296
  // Existence filter mismatch. Mark the documents as being in limbo, and
6297
6297
  // raise a snapshot with `isFromCache:true`.
6298
- if (i !== r) {
6298
+ if (s !== i) {
6299
6299
  // Apply bloom filter to identify and mark removed documents.
6300
- const r = this.nt(e, i);
6301
- if (0 /* BloomFilterApplicationStatus.Success */ !== r) {
6300
+ const i = this.tt(e, s);
6301
+ if (0 /* BloomFilterApplicationStatus.Success */ !== i.status) {
6302
6302
  // If bloom filter application fails, we reset the mapping and
6303
6303
  // trigger re-run of the query.
6304
- this.Ze(n);
6305
- const e = 2 /* BloomFilterApplicationStatus.FalsePositive */ === r ? "TargetPurposeExistenceFilterMismatchBloom" /* TargetPurpose.ExistenceFilterMismatchBloom */ : "TargetPurposeExistenceFilterMismatch" /* TargetPurpose.ExistenceFilterMismatch */;
6306
- this.We = this.We.insert(n, e);
6304
+ this.Ye(r);
6305
+ const e = 2 /* BloomFilterApplicationStatus.FalsePositive */ === i.status ? "TargetPurposeExistenceFilterMismatchBloom" /* TargetPurpose.ExistenceFilterMismatchBloom */ : "TargetPurposeExistenceFilterMismatch" /* TargetPurpose.ExistenceFilterMismatch */;
6306
+ this.Ue = this.Ue.insert(r, e);
6307
6307
  }
6308
- null === (t = __PRIVATE_TestingHooks.instance) || void 0 === t || t.notifyOnExistenceFilterMismatch(function __PRIVATE_createExistenceFilterMismatchInfoForTestingHooks(e, t, n) {
6309
- var r, i, s, o, _, a;
6310
- const u = {
6311
- localCacheCount: t,
6312
- existenceFilterCount: n.count
6313
- }, c = n.unchangedNames;
6314
- c && (u.bloomFilter = {
6308
+ null === (t = __PRIVATE_TestingHooks.instance) || void 0 === t || t.notifyOnExistenceFilterMismatch(function __PRIVATE_createExistenceFilterMismatchInfoForTestingHooks(e, t, n, r) {
6309
+ var i, s, o, _, a, u;
6310
+ const c = {
6311
+ localCacheCount: n,
6312
+ existenceFilterCount: r.count
6313
+ }, l = r.unchangedNames;
6314
+ l && (c.bloomFilter = {
6315
6315
  applied: 0 /* BloomFilterApplicationStatus.Success */ === e,
6316
- hashCount: null !== (r = null == c ? void 0 : c.hashCount) && void 0 !== r ? r : 0,
6317
- 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,
6318
- padding: null !== (a = null === (_ = null == c ? void 0 : c.bits) || void 0 === _ ? void 0 : _.padding) && void 0 !== a ? a : 0
6319
- });
6320
- return u;
6316
+ hashCount: null !== (i = null == l ? void 0 : l.hashCount) && void 0 !== i ? i : 0,
6317
+ 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,
6318
+ padding: null !== (u = null === (a = null == l ? void 0 : l.bits) || void 0 === a ? void 0 : a.padding) && void 0 !== u ? u : 0
6319
+ }, t && (c.bloomFilter.mightContain = t));
6320
+ return c;
6321
6321
  }
6322
6322
  /**
6323
6323
  * @license
@@ -6334,7 +6334,7 @@ class __PRIVATE_WatchChangeAggregator {
6334
6334
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6335
6335
  * See the License for the specific language governing permissions and
6336
6336
  * limitations under the License.
6337
- */ (r, i, e.ye));
6337
+ */ (i.status, null !== (n = i.nt) && void 0 !== n ? n : null, s, e.pe));
6338
6338
  }
6339
6339
  }
6340
6340
  }
@@ -6342,16 +6342,20 @@ class __PRIVATE_WatchChangeAggregator {
6342
6342
  /**
6343
6343
  * Apply bloom filter to remove the deleted documents, and return the
6344
6344
  * application status.
6345
- */ nt(e, t) {
6346
- const {unchangedNames: n, count: r} = e.ye;
6347
- if (!n || !n.bits) return 1 /* BloomFilterApplicationStatus.Skipped */;
6345
+ */ tt(e, t) {
6346
+ const {unchangedNames: n, count: r} = e.pe;
6347
+ if (!n || !n.bits) return {
6348
+ status: 1
6349
+ /* BloomFilterApplicationStatus.Skipped */ };
6348
6350
  const {bits: {bitmap: i = "", padding: s = 0}, hashCount: o = 0} = n;
6349
6351
  let _, a;
6350
6352
  try {
6351
6353
  _ = __PRIVATE_normalizeByteString(i).toUint8Array();
6352
6354
  } catch (e) {
6353
6355
  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."),
6354
- 1 /* BloomFilterApplicationStatus.Skipped */;
6356
+ {
6357
+ status: 1
6358
+ /* BloomFilterApplicationStatus.Skipped */ };
6355
6359
  throw e;
6356
6360
  }
6357
6361
  try {
@@ -6359,20 +6363,30 @@ class __PRIVATE_WatchChangeAggregator {
6359
6363
  a = new BloomFilter(_, s, o);
6360
6364
  } catch (e) {
6361
6365
  return __PRIVATE_logWarn(e instanceof __PRIVATE_BloomFilterError ? "BloomFilter error: " : "Applying bloom filter failed: ", e),
6362
- 1 /* BloomFilterApplicationStatus.Skipped */;
6366
+ {
6367
+ status: 1
6368
+ /* BloomFilterApplicationStatus.Skipped */ };
6363
6369
  }
6364
- if (0 === a.de) return 1 /* BloomFilterApplicationStatus.Skipped */;
6365
- return r !== t - this.rt(e.targetId, a) ? 2 /* BloomFilterApplicationStatus.FalsePositive */ : 0 /* BloomFilterApplicationStatus.Success */;
6370
+ const __PRIVATE_bloomFilterMightContain = e => {
6371
+ const t = this.qe.rt();
6372
+ return a.mightContain(`projects/${t.projectId}/databases/${t.database}/documents/${e}`);
6373
+ };
6374
+ if (0 === a.de) return {
6375
+ status: 1
6376
+ /* BloomFilterApplicationStatus.Skipped */ };
6377
+ return {
6378
+ status: r === t - this.it(e.targetId, __PRIVATE_bloomFilterMightContain) ? 0 /* BloomFilterApplicationStatus.Success */ : 2 /* BloomFilterApplicationStatus.FalsePositive */ ,
6379
+ nt: __PRIVATE_bloomFilterMightContain
6380
+ };
6366
6381
  }
6367
6382
  /**
6368
6383
  * Filter out removed documents based on bloom filter membership result and
6369
6384
  * return number of documents removed.
6370
- */ rt(e, t) {
6371
- const n = this.Qe.getRemoteKeysForTarget(e);
6385
+ */ it(e, t) {
6386
+ const n = this.qe.getRemoteKeysForTarget(e);
6372
6387
  let r = 0;
6373
6388
  return n.forEach((n => {
6374
- const i = this.Qe.it(), s = `projects/${i.projectId}/databases/${i.database}/documents/${n.path.canonicalString()}`;
6375
- t.me(s) || (this.je(e, n, /*updatedDocument=*/ null), r++);
6389
+ t(n.path.canonicalString()) || (this.ze(e, n, /*updatedDocument=*/ null), r++);
6376
6390
  })), r;
6377
6391
  }
6378
6392
  /**
@@ -6380,8 +6394,8 @@ class __PRIVATE_WatchChangeAggregator {
6380
6394
  * provided snapshot version. Resets the accumulated changes before returning.
6381
6395
  */ st(e) {
6382
6396
  const t = new Map;
6383
- this.Ke.forEach(((n, r) => {
6384
- const i = this.et(r);
6397
+ this.Qe.forEach(((n, r) => {
6398
+ const i = this.Xe(r);
6385
6399
  if (i) {
6386
6400
  if (n.current && __PRIVATE_targetIsDocumentTarget(i.target)) {
6387
6401
  // Document queries for document that don't exist can produce an empty
@@ -6393,9 +6407,9 @@ class __PRIVATE_WatchChangeAggregator {
6393
6407
  // instead resulting in an explicit delete message and we could
6394
6408
  // remove this special logic.
6395
6409
  const t = new DocumentKey(i.target.path);
6396
- null !== this.$e.get(t) || this.ot(r, t) || this.je(r, t, MutableDocument.newNoDocument(t, e));
6410
+ null !== this.Ke.get(t) || this.ot(r, t) || this.ze(r, t, MutableDocument.newNoDocument(t, e));
6397
6411
  }
6398
- n.Fe && (t.set(r, n.xe()), n.Oe());
6412
+ n.Ce && (t.set(r, n.Me()), n.xe());
6399
6413
  }
6400
6414
  }));
6401
6415
  let n = __PRIVATE_documentKeySet();
@@ -6404,27 +6418,27 @@ class __PRIVATE_WatchChangeAggregator {
6404
6418
 
6405
6419
  // TODO(gsoltis): Expand on this comment once GC is available in the JS
6406
6420
  // client.
6407
- this.Ue.forEach(((e, t) => {
6421
+ this.$e.forEach(((e, t) => {
6408
6422
  let r = !0;
6409
6423
  t.forEachWhile((e => {
6410
- const t = this.et(e);
6424
+ const t = this.Xe(e);
6411
6425
  return !t || "TargetPurposeLimboResolution" /* TargetPurpose.LimboResolution */ === t.purpose || (r = !1,
6412
6426
  !1);
6413
6427
  })), r && (n = n.add(e));
6414
- })), this.$e.forEach(((t, n) => n.setReadTime(e)));
6415
- const r = new RemoteEvent(e, t, this.We, this.$e, n);
6416
- return this.$e = __PRIVATE_mutableDocumentMap(), this.Ue = __PRIVATE_documentTargetMap(),
6417
- this.We = new SortedMap(__PRIVATE_primitiveComparator), r;
6428
+ })), this.Ke.forEach(((t, n) => n.setReadTime(e)));
6429
+ const r = new RemoteEvent(e, t, this.Ue, this.Ke, n);
6430
+ return this.Ke = __PRIVATE_mutableDocumentMap(), this.$e = __PRIVATE_documentTargetMap(),
6431
+ this.Ue = new SortedMap(__PRIVATE_primitiveComparator), r;
6418
6432
  }
6419
6433
  /**
6420
6434
  * Adds the provided document to the internal list of document updates and
6421
6435
  * its document key to the given target's mapping.
6422
6436
  */
6423
6437
  // Visible for testing.
6424
- ze(e, t) {
6425
- if (!this.Ye(e)) return;
6438
+ Ge(e, t) {
6439
+ if (!this.Je(e)) return;
6426
6440
  const n = this.ot(e, t.key) ? 2 /* ChangeType.Modified */ : 0 /* ChangeType.Added */;
6427
- 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));
6441
+ 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));
6428
6442
  }
6429
6443
  /**
6430
6444
  * Removes the provided document from the target mapping. If the
@@ -6434,71 +6448,71 @@ class __PRIVATE_WatchChangeAggregator {
6434
6448
  * to update the remote document cache.
6435
6449
  */
6436
6450
  // Visible for testing.
6437
- je(e, t, n) {
6438
- if (!this.Ye(e)) return;
6439
- const r = this.Je(e);
6440
- this.ot(e, t) ? r.Ne(t, 1 /* ChangeType.Removed */) :
6451
+ ze(e, t, n) {
6452
+ if (!this.Je(e)) return;
6453
+ const r = this.He(e);
6454
+ this.ot(e, t) ? r.Oe(t, 1 /* ChangeType.Removed */) :
6441
6455
  // The document may have entered and left the target before we raised a
6442
6456
  // snapshot, so we can just ignore the change.
6443
- r.Be(t), this.Ue = this.Ue.insert(t, this._t(t).delete(e)), n && (this.$e = this.$e.insert(t, n));
6457
+ r.Ne(t), this.$e = this.$e.insert(t, this._t(t).delete(e)), n && (this.Ke = this.Ke.insert(t, n));
6444
6458
  }
6445
6459
  removeTarget(e) {
6446
- this.Ke.delete(e);
6460
+ this.Qe.delete(e);
6447
6461
  }
6448
6462
  /**
6449
6463
  * Returns the current count of documents in the target. This includes both
6450
6464
  * the number of documents that the LocalStore considers to be part of the
6451
6465
  * target as well as any accumulated changes.
6452
- */ tt(e) {
6453
- const t = this.Je(e).xe();
6454
- return this.Qe.getRemoteKeysForTarget(e).size + t.addedDocuments.size - t.removedDocuments.size;
6466
+ */ et(e) {
6467
+ const t = this.He(e).Me();
6468
+ return this.qe.getRemoteKeysForTarget(e).size + t.addedDocuments.size - t.removedDocuments.size;
6455
6469
  }
6456
6470
  /**
6457
6471
  * Increment the number of acks needed from watch before we can consider the
6458
6472
  * server to be 'in-sync' with the client's active targets.
6459
- */ Le(e) {
6460
- this.Je(e).Le();
6473
+ */ Be(e) {
6474
+ this.He(e).Be();
6461
6475
  }
6462
- Je(e) {
6463
- let t = this.Ke.get(e);
6464
- return t || (t = new __PRIVATE_TargetState, this.Ke.set(e, t)), t;
6476
+ He(e) {
6477
+ let t = this.Qe.get(e);
6478
+ return t || (t = new __PRIVATE_TargetState, this.Qe.set(e, t)), t;
6465
6479
  }
6466
6480
  _t(e) {
6467
- let t = this.Ue.get(e);
6468
- return t || (t = new SortedSet(__PRIVATE_primitiveComparator), this.Ue = this.Ue.insert(e, t)),
6481
+ let t = this.$e.get(e);
6482
+ return t || (t = new SortedSet(__PRIVATE_primitiveComparator), this.$e = this.$e.insert(e, t)),
6469
6483
  t;
6470
6484
  }
6471
6485
  /**
6472
6486
  * Verifies that the user is still interested in this target (by calling
6473
6487
  * `getTargetDataForTarget()`) and that we are not waiting for pending ADDs
6474
6488
  * from watch.
6475
- */ Ye(e) {
6476
- const t = null !== this.et(e);
6489
+ */ Je(e) {
6490
+ const t = null !== this.Xe(e);
6477
6491
  return t || __PRIVATE_logDebug("WatchChangeAggregator", "Detected inactive target", e),
6478
6492
  t;
6479
6493
  }
6480
6494
  /**
6481
6495
  * Returns the TargetData for an active target (i.e. a target that the user
6482
6496
  * is still interested in that has no outstanding target change requests).
6483
- */ et(e) {
6484
- const t = this.Ke.get(e);
6485
- return t && t.Ce ? null : this.Qe.ut(e);
6497
+ */ Xe(e) {
6498
+ const t = this.Qe.get(e);
6499
+ return t && t.ve ? null : this.qe.ut(e);
6486
6500
  }
6487
6501
  /**
6488
6502
  * Resets the state of a Watch target to its initial state (e.g. sets
6489
6503
  * 'current' to false, clears the resume token and removes its target mapping
6490
6504
  * from all documents).
6491
- */ Ze(e) {
6492
- this.Ke.set(e, new __PRIVATE_TargetState);
6493
- this.Qe.getRemoteKeysForTarget(e).forEach((t => {
6494
- this.je(e, t, /*updatedDocument=*/ null);
6505
+ */ Ye(e) {
6506
+ this.Qe.set(e, new __PRIVATE_TargetState);
6507
+ this.qe.getRemoteKeysForTarget(e).forEach((t => {
6508
+ this.ze(e, t, /*updatedDocument=*/ null);
6495
6509
  }));
6496
6510
  }
6497
6511
  /**
6498
6512
  * Returns whether the LocalStore considers the document to be part of the
6499
6513
  * specified target.
6500
6514
  */ ot(e, t) {
6501
- return this.Qe.getRemoteKeysForTarget(e).has(t);
6515
+ return this.qe.getRemoteKeysForTarget(e).has(t);
6502
6516
  }
6503
6517
  }
6504
6518
 
@@ -14559,7 +14573,7 @@ function __PRIVATE_remoteStoreListen(e, t) {
14559
14573
  * We need to increment the the expected number of pending responses we're due
14560
14574
  * from watch so we wait for the ack to process any messages from this target.
14561
14575
  */ function __PRIVATE_sendWatchRequest(e, t) {
14562
- if (e.b_.Le(t.targetId), t.resumeToken.approximateByteSize() > 0 || t.snapshotVersion.compareTo(SnapshotVersion.min()) > 0) {
14576
+ if (e.b_.Be(t.targetId), t.resumeToken.approximateByteSize() > 0 || t.snapshotVersion.compareTo(SnapshotVersion.min()) > 0) {
14563
14577
  const n = e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;
14564
14578
  t = t.withExpectedCount(n);
14565
14579
  }
@@ -14571,14 +14585,14 @@ function __PRIVATE_remoteStoreListen(e, t) {
14571
14585
  * from watch so we wait for the removal on the server before we process any
14572
14586
  * messages from this target.
14573
14587
  */ function __PRIVATE_sendUnwatchRequest(e, t) {
14574
- e.b_.Le(t), __PRIVATE_ensureWatchStream(e).i_(t);
14588
+ e.b_.Be(t), __PRIVATE_ensureWatchStream(e).i_(t);
14575
14589
  }
14576
14590
 
14577
14591
  function __PRIVATE_startWatchStream(e) {
14578
14592
  e.b_ = new __PRIVATE_WatchChangeAggregator({
14579
14593
  getRemoteKeysForTarget: t => e.remoteSyncer.getRemoteKeysForTarget(t),
14580
14594
  ut: t => e.g_.get(t) || null,
14581
- it: () => e.datastore.serializer.databaseId
14595
+ rt: () => e.datastore.serializer.databaseId
14582
14596
  }), __PRIVATE_ensureWatchStream(e).start(), e.S_.d_();
14583
14597
  }
14584
14598
 
@@ -14639,7 +14653,7 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
14639
14653
  } catch (n) {
14640
14654
  __PRIVATE_logDebug("RemoteStore", "Failed to remove targets %s: %s ", t.targetIds.join(","), n),
14641
14655
  await __PRIVATE_disableNetworkUntilRecovery(e, n);
14642
- } else if (t instanceof __PRIVATE_DocumentWatchChange ? e.b_.Ge(t) : t instanceof __PRIVATE_ExistenceFilterChange ? e.b_.Xe(t) : e.b_.He(t),
14656
+ } else if (t instanceof __PRIVATE_DocumentWatchChange ? e.b_.We(t) : t instanceof __PRIVATE_ExistenceFilterChange ? e.b_.Ze(t) : e.b_.je(t),
14643
14657
  !n.isEqual(SnapshotVersion.min())) try {
14644
14658
  const t = await __PRIVATE_localStoreGetLastRemoteSnapshotVersion(e.localStore);
14645
14659
  n.compareTo(t) >= 0 &&
@@ -21533,9 +21547,9 @@ function __PRIVATE_tryGetString(e, t) {
21533
21547
  return r = Object.assign({
21534
21548
  useFetchStreams: t
21535
21549
  }, r), s._setSettings(r), s;
21536
- }), "PUBLIC").setMultipleInstances(!0)), registerVersion(S, "3.13.0-canary.f2fb56fc0", e),
21550
+ }), "PUBLIC").setMultipleInstances(!0)), registerVersion(S, "3.13.0-canary.f3067f72d", e),
21537
21551
  // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
21538
- registerVersion(S, "3.13.0-canary.f2fb56fc0", "esm2017");
21552
+ registerVersion(S, "3.13.0-canary.f3067f72d", "esm2017");
21539
21553
  }();
21540
21554
 
21541
21555
  export { AbstractUserDataWriter, AggregateField, AggregateQuerySnapshot, Bytes, ge as CACHE_SIZE_UNLIMITED, CollectionReference, DocumentReference, DocumentSnapshot, FieldPath, FieldValue, Firestore, FirestoreError, GeoPoint, LoadBundleTask, Query, QueryCompositeFilterConstraint, QueryConstraint, QueryDocumentSnapshot, QueryEndAtConstraint, QueryFieldFilterConstraint, QueryLimitConstraint, QueryOrderByConstraint, QuerySnapshot, QueryStartAtConstraint, SnapshotMetadata, Timestamp, Transaction, WriteBatch, DatabaseId as _DatabaseId, DocumentKey as _DocumentKey, __PRIVATE_EmptyAppCheckTokenProvider as _EmptyAppCheckTokenProvider, __PRIVATE_EmptyAuthCredentialsProvider as _EmptyAuthCredentialsProvider, FieldPath$1 as _FieldPath, __PRIVATE_TestingHooks as _TestingHooks, __PRIVATE_cast as _cast, __PRIVATE_debugAssert as _debugAssert, __PRIVATE_isBase64Available as _isBase64Available, __PRIVATE_logWarn as _logWarn, __PRIVATE_validateIsNotUsedTogether as _validateIsNotUsedTogether, addDoc, aggregateFieldEqual, aggregateQuerySnapshotEqual, and, arrayRemove, arrayUnion, average, clearIndexedDbPersistence, collection, collectionGroup, connectFirestoreEmulator, count, deleteDoc, deleteField, disableNetwork, doc, documentId, enableIndexedDbPersistence, enableMultiTabIndexedDbPersistence, enableNetwork, endAt, endBefore, ensureFirestoreConfigured, executeWrite, getAggregateFromServer, getCountFromServer, getDoc, getDocFromCache, getDocFromServer, getDocs, getDocsFromCache, getDocsFromServer, getFirestore, increment, initializeFirestore, limit, limitToLast, loadBundle, memoryEagerGarbageCollector, memoryLocalCache, memoryLruGarbageCollector, namedQuery, onSnapshot, onSnapshotsInSync, or, orderBy, persistentLocalCache, persistentMultipleTabManager, persistentSingleTabManager, query, queryEqual, refEqual, runTransaction, serverTimestamp, setDoc, setIndexConfiguration, setLogLevel, snapshotEqual, startAfter, startAt, sum, terminate, updateDoc, waitForPendingWrites, where, writeBatch };