@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.
- package/dist/firestore/src/global_index.d.ts +15 -1
- package/dist/firestore/src/lite-api/types.d.ts +1 -1
- package/dist/firestore/src/util/testing_hooks.d.ts +14 -0
- package/dist/firestore/test/integration/util/helpers.d.ts +63 -16
- package/dist/firestore/test/integration/util/internal_helpers.d.ts +2 -1
- package/dist/firestore/test/integration/util/testing_hooks_util.d.ts +1 -0
- package/dist/index.cjs.js +150 -136
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm2017.js +150 -136
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +147 -133
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +27 -21
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +27 -21
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +150 -136
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +15 -1
- package/dist/lite/firestore/src/lite-api/types.d.ts +1 -1
- package/dist/lite/firestore/src/util/testing_hooks.d.ts +14 -0
- package/dist/lite/firestore/test/integration/util/helpers.d.ts +63 -16
- package/dist/lite/firestore/test/integration/util/internal_helpers.d.ts +2 -1
- package/dist/lite/firestore/test/integration/util/testing_hooks_util.d.ts +1 -0
- package/dist/lite/index.browser.esm2017.js +2 -2
- package/dist/lite/index.browser.esm5.js +2 -2
- package/dist/lite/index.cjs.js +2 -2
- package/dist/lite/index.d.ts +1 -1
- package/dist/lite/index.node.cjs.js +2 -2
- package/dist/lite/index.node.mjs +2 -2
- package/dist/lite/index.rn.esm2017.js +2 -2
- package/dist/lite/internal.d.ts +1 -1
- package/dist/lite/packages/firestore/src/lite-api/types.d.ts +1 -1
- package/dist/lite/packages/firestore/src/util/testing_hooks.d.ts +14 -0
- package/dist/lite/packages/firestore/test/integration/util/helpers.d.ts +63 -16
- package/dist/lite/packages/firestore/test/integration/util/internal_helpers.d.ts +2 -1
- package/dist/lite/packages/firestore/test/integration/util/testing_hooks_util.d.ts +1 -0
- package/dist/lite/private.d.ts +1 -1
- package/dist/packages/firestore/src/lite-api/types.d.ts +1 -1
- package/dist/packages/firestore/src/util/testing_hooks.d.ts +14 -0
- package/dist/packages/firestore/test/integration/util/helpers.d.ts +63 -16
- package/dist/packages/firestore/test/integration/util/internal_helpers.d.ts +2 -1
- package/dist/packages/firestore/test/integration/util/testing_hooks_util.d.ts +1 -0
- package/dist/private.d.ts +15 -1
- package/package.json +9 -9
package/dist/index.rn.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 v = "9.23.0-canary.
|
|
73
|
+
let v = "9.23.0-canary.f3067f72d";
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* @license
|
|
@@ -5904,7 +5904,7 @@ class BloomFilter {
|
|
|
5904
5904
|
Ve(e) {
|
|
5905
5905
|
return 0 != (this.bitmap[Math.floor(e / 8)] & 1 << e % 8);
|
|
5906
5906
|
}
|
|
5907
|
-
|
|
5907
|
+
mightContain(e) {
|
|
5908
5908
|
// Empty bitmap should always return false on membership check.
|
|
5909
5909
|
if (0 === this.de) return !1;
|
|
5910
5910
|
const t = __PRIVATE_getMd5HashValue(e), [n, r] = __PRIVATE_get64BitUints(t);
|
|
@@ -5923,10 +5923,10 @@ class BloomFilter {
|
|
|
5923
5923
|
const t = __PRIVATE_getMd5HashValue(e), [n, r] = __PRIVATE_get64BitUints(t);
|
|
5924
5924
|
for (let e = 0; e < this.hashCount; e++) {
|
|
5925
5925
|
const t = this.Re(n, r, e);
|
|
5926
|
-
this.
|
|
5926
|
+
this.me(t);
|
|
5927
5927
|
}
|
|
5928
5928
|
}
|
|
5929
|
-
|
|
5929
|
+
me(e) {
|
|
5930
5930
|
const t = Math.floor(e / 8), n = e % 8;
|
|
5931
5931
|
this.bitmap[t] |= 1 << n;
|
|
5932
5932
|
}
|
|
@@ -6083,13 +6083,13 @@ class __PRIVATE_BloomFilterError extends Error {
|
|
|
6083
6083
|
* document went out of view without the server sending a new document.
|
|
6084
6084
|
*/
|
|
6085
6085
|
r) {
|
|
6086
|
-
this.
|
|
6086
|
+
this.fe = e, this.removedTargetIds = t, this.key = n, this.ge = r;
|
|
6087
6087
|
}
|
|
6088
6088
|
}
|
|
6089
6089
|
|
|
6090
6090
|
class __PRIVATE_ExistenceFilterChange {
|
|
6091
6091
|
constructor(e, t) {
|
|
6092
|
-
this.targetId = e, this.
|
|
6092
|
+
this.targetId = e, this.pe = t;
|
|
6093
6093
|
}
|
|
6094
6094
|
}
|
|
6095
6095
|
|
|
@@ -6117,22 +6117,22 @@ class __PRIVATE_WatchTargetChange {
|
|
|
6117
6117
|
* The number of pending responses (adds or removes) that we are waiting on.
|
|
6118
6118
|
* We only consider targets active that have no pending responses.
|
|
6119
6119
|
*/
|
|
6120
|
-
this.
|
|
6120
|
+
this.ye = 0,
|
|
6121
6121
|
/**
|
|
6122
6122
|
* Keeps track of the document changes since the last raised snapshot.
|
|
6123
6123
|
*
|
|
6124
6124
|
* These changes are continuously updated as we receive document updates and
|
|
6125
6125
|
* always reflect the current set of changes against the last issued snapshot.
|
|
6126
6126
|
*/
|
|
6127
|
-
this.
|
|
6127
|
+
this.we = __PRIVATE_snapshotChangesMap(),
|
|
6128
6128
|
/** See public getters for explanations of these fields. */
|
|
6129
|
-
this.
|
|
6129
|
+
this.Se = ByteString.EMPTY_BYTE_STRING, this.be = !1,
|
|
6130
6130
|
/**
|
|
6131
6131
|
* Whether this target state should be included in the next snapshot. We
|
|
6132
6132
|
* initialize to true so that newly-added targets are included in the next
|
|
6133
6133
|
* RemoteEvent.
|
|
6134
6134
|
*/
|
|
6135
|
-
this.
|
|
6135
|
+
this.De = !0;
|
|
6136
6136
|
}
|
|
6137
6137
|
/**
|
|
6138
6138
|
* Whether this target has been marked 'current'.
|
|
@@ -6142,31 +6142,31 @@ class __PRIVATE_WatchTargetChange {
|
|
|
6142
6142
|
* was added and that the target is consistent with the rest of the watch
|
|
6143
6143
|
* stream.
|
|
6144
6144
|
*/ get current() {
|
|
6145
|
-
return this.
|
|
6145
|
+
return this.be;
|
|
6146
6146
|
}
|
|
6147
6147
|
/** The last resume token sent to us for this target. */ get resumeToken() {
|
|
6148
|
-
return this.
|
|
6148
|
+
return this.Se;
|
|
6149
6149
|
}
|
|
6150
|
-
/** Whether this target has pending target adds or target removes. */ get
|
|
6151
|
-
return 0 !== this.
|
|
6150
|
+
/** Whether this target has pending target adds or target removes. */ get ve() {
|
|
6151
|
+
return 0 !== this.ye;
|
|
6152
6152
|
}
|
|
6153
|
-
/** Whether we have modified any state that should trigger a snapshot. */ get
|
|
6154
|
-
return this.
|
|
6153
|
+
/** Whether we have modified any state that should trigger a snapshot. */ get Ce() {
|
|
6154
|
+
return this.De;
|
|
6155
6155
|
}
|
|
6156
6156
|
/**
|
|
6157
6157
|
* Applies the resume token to the TargetChange, but only when it has a new
|
|
6158
6158
|
* value. Empty resumeTokens are discarded.
|
|
6159
|
-
*/
|
|
6160
|
-
e.approximateByteSize() > 0 && (this.
|
|
6159
|
+
*/ Fe(e) {
|
|
6160
|
+
e.approximateByteSize() > 0 && (this.De = !0, this.Se = e);
|
|
6161
6161
|
}
|
|
6162
6162
|
/**
|
|
6163
6163
|
* Creates a target change from the current set of changes.
|
|
6164
6164
|
*
|
|
6165
6165
|
* To reset the document changes after raising this snapshot, call
|
|
6166
6166
|
* `clearPendingChanges()`.
|
|
6167
|
-
*/
|
|
6167
|
+
*/ Me() {
|
|
6168
6168
|
let e = __PRIVATE_documentKeySet(), t = __PRIVATE_documentKeySet(), n = __PRIVATE_documentKeySet();
|
|
6169
|
-
return this.
|
|
6169
|
+
return this.we.forEach(((r, i) => {
|
|
6170
6170
|
switch (i) {
|
|
6171
6171
|
case 0 /* ChangeType.Added */ :
|
|
6172
6172
|
e = e.add(r);
|
|
@@ -6183,27 +6183,27 @@ class __PRIVATE_WatchTargetChange {
|
|
|
6183
6183
|
default:
|
|
6184
6184
|
fail();
|
|
6185
6185
|
}
|
|
6186
|
-
})), new TargetChange(this.
|
|
6186
|
+
})), new TargetChange(this.Se, this.be, e, t, n);
|
|
6187
6187
|
}
|
|
6188
6188
|
/**
|
|
6189
6189
|
* Resets the document changes and sets `hasPendingChanges` to false.
|
|
6190
|
-
*/
|
|
6191
|
-
this.
|
|
6190
|
+
*/ xe() {
|
|
6191
|
+
this.De = !1, this.we = __PRIVATE_snapshotChangesMap();
|
|
6192
|
+
}
|
|
6193
|
+
Oe(e, t) {
|
|
6194
|
+
this.De = !0, this.we = this.we.insert(e, t);
|
|
6192
6195
|
}
|
|
6193
|
-
Ne(e
|
|
6194
|
-
this.
|
|
6196
|
+
Ne(e) {
|
|
6197
|
+
this.De = !0, this.we = this.we.remove(e);
|
|
6195
6198
|
}
|
|
6196
|
-
Be(
|
|
6197
|
-
this.
|
|
6199
|
+
Be() {
|
|
6200
|
+
this.ye += 1;
|
|
6198
6201
|
}
|
|
6199
6202
|
Le() {
|
|
6200
|
-
this.
|
|
6203
|
+
this.ye -= 1;
|
|
6201
6204
|
}
|
|
6202
6205
|
ke() {
|
|
6203
|
-
this.
|
|
6204
|
-
}
|
|
6205
|
-
qe() {
|
|
6206
|
-
this.ve = !0, this.De = !0;
|
|
6206
|
+
this.De = !0, this.be = !0;
|
|
6207
6207
|
}
|
|
6208
6208
|
}
|
|
6209
6209
|
|
|
@@ -6212,42 +6212,42 @@ class __PRIVATE_WatchTargetChange {
|
|
|
6212
6212
|
*/
|
|
6213
6213
|
class __PRIVATE_WatchChangeAggregator {
|
|
6214
6214
|
constructor(e) {
|
|
6215
|
-
this.
|
|
6215
|
+
this.qe = e,
|
|
6216
6216
|
/** The internal state of all tracked targets. */
|
|
6217
|
-
this.
|
|
6217
|
+
this.Qe = new Map,
|
|
6218
6218
|
/** Keeps track of the documents to update since the last raised snapshot. */
|
|
6219
|
-
this
|
|
6219
|
+
this.Ke = __PRIVATE_mutableDocumentMap(),
|
|
6220
6220
|
/** A mapping of document keys to their set of target IDs. */
|
|
6221
|
-
this
|
|
6221
|
+
this.$e = __PRIVATE_documentTargetMap(),
|
|
6222
6222
|
/**
|
|
6223
6223
|
* A map of targets with existence filter mismatches. These targets are
|
|
6224
6224
|
* known to be inconsistent and their listens needs to be re-established by
|
|
6225
6225
|
* RemoteStore.
|
|
6226
6226
|
*/
|
|
6227
|
-
this.
|
|
6227
|
+
this.Ue = new SortedMap(__PRIVATE_primitiveComparator);
|
|
6228
6228
|
}
|
|
6229
6229
|
/**
|
|
6230
6230
|
* Processes and adds the DocumentWatchChange to the current set of changes.
|
|
6231
|
-
*/
|
|
6232
|
-
for (const t of e.
|
|
6233
|
-
for (const t of e.removedTargetIds) this.
|
|
6231
|
+
*/ We(e) {
|
|
6232
|
+
for (const t of e.fe) e.ge && e.ge.isFoundDocument() ? this.Ge(t, e.ge) : this.ze(t, e.key, e.ge);
|
|
6233
|
+
for (const t of e.removedTargetIds) this.ze(t, e.key, e.ge);
|
|
6234
6234
|
}
|
|
6235
|
-
/** Processes and adds the WatchTargetChange to the current set of changes. */
|
|
6235
|
+
/** Processes and adds the WatchTargetChange to the current set of changes. */ je(e) {
|
|
6236
6236
|
this.forEachTarget(e, (t => {
|
|
6237
|
-
const n = this.
|
|
6237
|
+
const n = this.He(t);
|
|
6238
6238
|
switch (e.state) {
|
|
6239
6239
|
case 0 /* WatchTargetChangeState.NoChange */ :
|
|
6240
|
-
this.
|
|
6240
|
+
this.Je(t) && n.Fe(e.resumeToken);
|
|
6241
6241
|
break;
|
|
6242
6242
|
|
|
6243
6243
|
case 1 /* WatchTargetChangeState.Added */ :
|
|
6244
6244
|
// We need to decrement the number of pending acks needed from watch
|
|
6245
6245
|
// for this targetId.
|
|
6246
|
-
n.
|
|
6246
|
+
n.Le(), n.ve ||
|
|
6247
6247
|
// We have a freshly added target, so we need to reset any state
|
|
6248
6248
|
// that we had previously. This can happen e.g. when remove and add
|
|
6249
6249
|
// back a target for existence filter mismatches.
|
|
6250
|
-
n.
|
|
6250
|
+
n.xe(), n.Fe(e.resumeToken);
|
|
6251
6251
|
break;
|
|
6252
6252
|
|
|
6253
6253
|
case 2 /* WatchTargetChangeState.Removed */ :
|
|
@@ -6255,19 +6255,19 @@ class __PRIVATE_WatchChangeAggregator {
|
|
|
6255
6255
|
// remove any target changes.
|
|
6256
6256
|
// We need to decrement the number of pending acks needed from watch
|
|
6257
6257
|
// for this targetId.
|
|
6258
|
-
n.
|
|
6258
|
+
n.Le(), n.ve || this.removeTarget(t);
|
|
6259
6259
|
break;
|
|
6260
6260
|
|
|
6261
6261
|
case 3 /* WatchTargetChangeState.Current */ :
|
|
6262
|
-
this.
|
|
6262
|
+
this.Je(t) && (n.ke(), n.Fe(e.resumeToken));
|
|
6263
6263
|
break;
|
|
6264
6264
|
|
|
6265
6265
|
case 4 /* WatchTargetChangeState.Reset */ :
|
|
6266
|
-
this.
|
|
6266
|
+
this.Je(t) && (
|
|
6267
6267
|
// Reset the target and synthesizes removes for all existing
|
|
6268
6268
|
// documents. The backend will re-add any documents that still
|
|
6269
6269
|
// match the target before it sends the next global snapshot.
|
|
6270
|
-
this.
|
|
6270
|
+
this.Ye(t), n.Fe(e.resumeToken));
|
|
6271
6271
|
break;
|
|
6272
6272
|
|
|
6273
6273
|
default:
|
|
@@ -6280,55 +6280,55 @@ class __PRIVATE_WatchChangeAggregator {
|
|
|
6280
6280
|
* targetIds explicitly listed in the change or the targetIds of all currently
|
|
6281
6281
|
* active targets.
|
|
6282
6282
|
*/ forEachTarget(e, t) {
|
|
6283
|
-
e.targetIds.length > 0 ? e.targetIds.forEach(t) : this.
|
|
6284
|
-
this.
|
|
6283
|
+
e.targetIds.length > 0 ? e.targetIds.forEach(t) : this.Qe.forEach(((e, n) => {
|
|
6284
|
+
this.Je(n) && t(n);
|
|
6285
6285
|
}));
|
|
6286
6286
|
}
|
|
6287
6287
|
/**
|
|
6288
6288
|
* Handles existence filters and synthesizes deletes for filter mismatches.
|
|
6289
6289
|
* Targets that are invalidated by filter mismatches are added to
|
|
6290
6290
|
* `pendingTargetResets`.
|
|
6291
|
-
*/
|
|
6292
|
-
var t;
|
|
6293
|
-
const
|
|
6294
|
-
if (
|
|
6295
|
-
const
|
|
6296
|
-
if (__PRIVATE_targetIsDocumentTarget(
|
|
6291
|
+
*/ Ze(e) {
|
|
6292
|
+
var t, n;
|
|
6293
|
+
const r = e.targetId, i = e.pe.count, s = this.Xe(r);
|
|
6294
|
+
if (s) {
|
|
6295
|
+
const o = s.target;
|
|
6296
|
+
if (__PRIVATE_targetIsDocumentTarget(o)) if (0 === i) {
|
|
6297
6297
|
// The existence filter told us the document does not exist. We deduce
|
|
6298
6298
|
// that this document does not exist and apply a deleted document to
|
|
6299
6299
|
// our updates. Without applying this deleted document there might be
|
|
6300
6300
|
// another query that will raise this document as part of a snapshot
|
|
6301
6301
|
// until it is resolved, essentially exposing inconsistency between
|
|
6302
6302
|
// queries.
|
|
6303
|
-
const e = new DocumentKey(
|
|
6304
|
-
this.
|
|
6305
|
-
} else __PRIVATE_hardAssert(1 ===
|
|
6306
|
-
const
|
|
6303
|
+
const e = new DocumentKey(o.path);
|
|
6304
|
+
this.ze(r, e, MutableDocument.newNoDocument(e, SnapshotVersion.min()));
|
|
6305
|
+
} else __PRIVATE_hardAssert(1 === i); else {
|
|
6306
|
+
const s = this.et(r);
|
|
6307
6307
|
// Existence filter mismatch. Mark the documents as being in limbo, and
|
|
6308
6308
|
// raise a snapshot with `isFromCache:true`.
|
|
6309
|
-
if (
|
|
6309
|
+
if (s !== i) {
|
|
6310
6310
|
// Apply bloom filter to identify and mark removed documents.
|
|
6311
|
-
const
|
|
6312
|
-
if (0 /* BloomFilterApplicationStatus.Success */ !==
|
|
6311
|
+
const i = this.tt(e, s);
|
|
6312
|
+
if (0 /* BloomFilterApplicationStatus.Success */ !== i.status) {
|
|
6313
6313
|
// If bloom filter application fails, we reset the mapping and
|
|
6314
6314
|
// trigger re-run of the query.
|
|
6315
|
-
this.
|
|
6316
|
-
const e = 2 /* BloomFilterApplicationStatus.FalsePositive */ ===
|
|
6317
|
-
this.
|
|
6315
|
+
this.Ye(r);
|
|
6316
|
+
const e = 2 /* BloomFilterApplicationStatus.FalsePositive */ === i.status ? "TargetPurposeExistenceFilterMismatchBloom" /* TargetPurpose.ExistenceFilterMismatchBloom */ : "TargetPurposeExistenceFilterMismatch" /* TargetPurpose.ExistenceFilterMismatch */;
|
|
6317
|
+
this.Ue = this.Ue.insert(r, e);
|
|
6318
6318
|
}
|
|
6319
|
-
null === (t = __PRIVATE_TestingHooks.instance) || void 0 === t || t.notifyOnExistenceFilterMismatch(function __PRIVATE_createExistenceFilterMismatchInfoForTestingHooks(e, t, n) {
|
|
6320
|
-
var
|
|
6321
|
-
const
|
|
6322
|
-
localCacheCount:
|
|
6323
|
-
existenceFilterCount:
|
|
6324
|
-
},
|
|
6325
|
-
|
|
6319
|
+
null === (t = __PRIVATE_TestingHooks.instance) || void 0 === t || t.notifyOnExistenceFilterMismatch(function __PRIVATE_createExistenceFilterMismatchInfoForTestingHooks(e, t, n, r) {
|
|
6320
|
+
var i, s, o, _, a, u;
|
|
6321
|
+
const c = {
|
|
6322
|
+
localCacheCount: n,
|
|
6323
|
+
existenceFilterCount: r.count
|
|
6324
|
+
}, l = r.unchangedNames;
|
|
6325
|
+
l && (c.bloomFilter = {
|
|
6326
6326
|
applied: 0 /* BloomFilterApplicationStatus.Success */ === e,
|
|
6327
|
-
hashCount: null !== (
|
|
6328
|
-
bitmapLength: null !== (
|
|
6329
|
-
padding: null !== (
|
|
6330
|
-
});
|
|
6331
|
-
return
|
|
6327
|
+
hashCount: null !== (i = null == l ? void 0 : l.hashCount) && void 0 !== i ? i : 0,
|
|
6328
|
+
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,
|
|
6329
|
+
padding: null !== (u = null === (a = null == l ? void 0 : l.bits) || void 0 === a ? void 0 : a.padding) && void 0 !== u ? u : 0
|
|
6330
|
+
}, t && (c.bloomFilter.mightContain = t));
|
|
6331
|
+
return c;
|
|
6332
6332
|
}
|
|
6333
6333
|
/**
|
|
6334
6334
|
* @license
|
|
@@ -6345,7 +6345,7 @@ class __PRIVATE_WatchChangeAggregator {
|
|
|
6345
6345
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6346
6346
|
* See the License for the specific language governing permissions and
|
|
6347
6347
|
* limitations under the License.
|
|
6348
|
-
*/ (
|
|
6348
|
+
*/ (i.status, null !== (n = i.nt) && void 0 !== n ? n : null, s, e.pe));
|
|
6349
6349
|
}
|
|
6350
6350
|
}
|
|
6351
6351
|
}
|
|
@@ -6353,16 +6353,20 @@ class __PRIVATE_WatchChangeAggregator {
|
|
|
6353
6353
|
/**
|
|
6354
6354
|
* Apply bloom filter to remove the deleted documents, and return the
|
|
6355
6355
|
* application status.
|
|
6356
|
-
*/
|
|
6357
|
-
const {unchangedNames: n, count: r} = e.
|
|
6358
|
-
if (!n || !n.bits) return
|
|
6356
|
+
*/ tt(e, t) {
|
|
6357
|
+
const {unchangedNames: n, count: r} = e.pe;
|
|
6358
|
+
if (!n || !n.bits) return {
|
|
6359
|
+
status: 1
|
|
6360
|
+
/* BloomFilterApplicationStatus.Skipped */ };
|
|
6359
6361
|
const {bits: {bitmap: i = "", padding: s = 0}, hashCount: o = 0} = n;
|
|
6360
6362
|
let _, a;
|
|
6361
6363
|
try {
|
|
6362
6364
|
_ = __PRIVATE_normalizeByteString(i).toUint8Array();
|
|
6363
6365
|
} catch (e) {
|
|
6364
6366
|
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."),
|
|
6365
|
-
|
|
6367
|
+
{
|
|
6368
|
+
status: 1
|
|
6369
|
+
/* BloomFilterApplicationStatus.Skipped */ };
|
|
6366
6370
|
throw e;
|
|
6367
6371
|
}
|
|
6368
6372
|
try {
|
|
@@ -6370,20 +6374,30 @@ class __PRIVATE_WatchChangeAggregator {
|
|
|
6370
6374
|
a = new BloomFilter(_, s, o);
|
|
6371
6375
|
} catch (e) {
|
|
6372
6376
|
return __PRIVATE_logWarn(e instanceof __PRIVATE_BloomFilterError ? "BloomFilter error: " : "Applying bloom filter failed: ", e),
|
|
6373
|
-
|
|
6377
|
+
{
|
|
6378
|
+
status: 1
|
|
6379
|
+
/* BloomFilterApplicationStatus.Skipped */ };
|
|
6374
6380
|
}
|
|
6375
|
-
|
|
6376
|
-
|
|
6381
|
+
const __PRIVATE_bloomFilterMightContain = e => {
|
|
6382
|
+
const t = this.qe.rt();
|
|
6383
|
+
return a.mightContain(`projects/${t.projectId}/databases/${t.database}/documents/${e}`);
|
|
6384
|
+
};
|
|
6385
|
+
if (0 === a.de) return {
|
|
6386
|
+
status: 1
|
|
6387
|
+
/* BloomFilterApplicationStatus.Skipped */ };
|
|
6388
|
+
return {
|
|
6389
|
+
status: r === t - this.it(e.targetId, __PRIVATE_bloomFilterMightContain) ? 0 /* BloomFilterApplicationStatus.Success */ : 2 /* BloomFilterApplicationStatus.FalsePositive */ ,
|
|
6390
|
+
nt: __PRIVATE_bloomFilterMightContain
|
|
6391
|
+
};
|
|
6377
6392
|
}
|
|
6378
6393
|
/**
|
|
6379
6394
|
* Filter out removed documents based on bloom filter membership result and
|
|
6380
6395
|
* return number of documents removed.
|
|
6381
|
-
*/
|
|
6382
|
-
const n = this.
|
|
6396
|
+
*/ it(e, t) {
|
|
6397
|
+
const n = this.qe.getRemoteKeysForTarget(e);
|
|
6383
6398
|
let r = 0;
|
|
6384
6399
|
return n.forEach((n => {
|
|
6385
|
-
|
|
6386
|
-
t.me(s) || (this.je(e, n, /*updatedDocument=*/ null), r++);
|
|
6400
|
+
t(n.path.canonicalString()) || (this.ze(e, n, /*updatedDocument=*/ null), r++);
|
|
6387
6401
|
})), r;
|
|
6388
6402
|
}
|
|
6389
6403
|
/**
|
|
@@ -6391,8 +6405,8 @@ class __PRIVATE_WatchChangeAggregator {
|
|
|
6391
6405
|
* provided snapshot version. Resets the accumulated changes before returning.
|
|
6392
6406
|
*/ st(e) {
|
|
6393
6407
|
const t = new Map;
|
|
6394
|
-
this.
|
|
6395
|
-
const i = this.
|
|
6408
|
+
this.Qe.forEach(((n, r) => {
|
|
6409
|
+
const i = this.Xe(r);
|
|
6396
6410
|
if (i) {
|
|
6397
6411
|
if (n.current && __PRIVATE_targetIsDocumentTarget(i.target)) {
|
|
6398
6412
|
// Document queries for document that don't exist can produce an empty
|
|
@@ -6404,9 +6418,9 @@ class __PRIVATE_WatchChangeAggregator {
|
|
|
6404
6418
|
// instead resulting in an explicit delete message and we could
|
|
6405
6419
|
// remove this special logic.
|
|
6406
6420
|
const t = new DocumentKey(i.target.path);
|
|
6407
|
-
null !== this
|
|
6421
|
+
null !== this.Ke.get(t) || this.ot(r, t) || this.ze(r, t, MutableDocument.newNoDocument(t, e));
|
|
6408
6422
|
}
|
|
6409
|
-
n.
|
|
6423
|
+
n.Ce && (t.set(r, n.Me()), n.xe());
|
|
6410
6424
|
}
|
|
6411
6425
|
}));
|
|
6412
6426
|
let n = __PRIVATE_documentKeySet();
|
|
@@ -6415,27 +6429,27 @@ class __PRIVATE_WatchChangeAggregator {
|
|
|
6415
6429
|
|
|
6416
6430
|
// TODO(gsoltis): Expand on this comment once GC is available in the JS
|
|
6417
6431
|
// client.
|
|
6418
|
-
this.
|
|
6432
|
+
this.$e.forEach(((e, t) => {
|
|
6419
6433
|
let r = !0;
|
|
6420
6434
|
t.forEachWhile((e => {
|
|
6421
|
-
const t = this.
|
|
6435
|
+
const t = this.Xe(e);
|
|
6422
6436
|
return !t || "TargetPurposeLimboResolution" /* TargetPurpose.LimboResolution */ === t.purpose || (r = !1,
|
|
6423
6437
|
!1);
|
|
6424
6438
|
})), r && (n = n.add(e));
|
|
6425
|
-
})), this
|
|
6426
|
-
const r = new RemoteEvent(e, t, this.
|
|
6427
|
-
return this
|
|
6428
|
-
this.
|
|
6439
|
+
})), this.Ke.forEach(((t, n) => n.setReadTime(e)));
|
|
6440
|
+
const r = new RemoteEvent(e, t, this.Ue, this.Ke, n);
|
|
6441
|
+
return this.Ke = __PRIVATE_mutableDocumentMap(), this.$e = __PRIVATE_documentTargetMap(),
|
|
6442
|
+
this.Ue = new SortedMap(__PRIVATE_primitiveComparator), r;
|
|
6429
6443
|
}
|
|
6430
6444
|
/**
|
|
6431
6445
|
* Adds the provided document to the internal list of document updates and
|
|
6432
6446
|
* its document key to the given target's mapping.
|
|
6433
6447
|
*/
|
|
6434
6448
|
// Visible for testing.
|
|
6435
|
-
|
|
6436
|
-
if (!this.
|
|
6449
|
+
Ge(e, t) {
|
|
6450
|
+
if (!this.Je(e)) return;
|
|
6437
6451
|
const n = this.ot(e, t.key) ? 2 /* ChangeType.Modified */ : 0 /* ChangeType.Added */;
|
|
6438
|
-
this.
|
|
6452
|
+
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));
|
|
6439
6453
|
}
|
|
6440
6454
|
/**
|
|
6441
6455
|
* Removes the provided document from the target mapping. If the
|
|
@@ -6445,71 +6459,71 @@ class __PRIVATE_WatchChangeAggregator {
|
|
|
6445
6459
|
* to update the remote document cache.
|
|
6446
6460
|
*/
|
|
6447
6461
|
// Visible for testing.
|
|
6448
|
-
|
|
6449
|
-
if (!this.
|
|
6450
|
-
const r = this.
|
|
6451
|
-
this.ot(e, t) ? r.
|
|
6462
|
+
ze(e, t, n) {
|
|
6463
|
+
if (!this.Je(e)) return;
|
|
6464
|
+
const r = this.He(e);
|
|
6465
|
+
this.ot(e, t) ? r.Oe(t, 1 /* ChangeType.Removed */) :
|
|
6452
6466
|
// The document may have entered and left the target before we raised a
|
|
6453
6467
|
// snapshot, so we can just ignore the change.
|
|
6454
|
-
r.
|
|
6468
|
+
r.Ne(t), this.$e = this.$e.insert(t, this._t(t).delete(e)), n && (this.Ke = this.Ke.insert(t, n));
|
|
6455
6469
|
}
|
|
6456
6470
|
removeTarget(e) {
|
|
6457
|
-
this.
|
|
6471
|
+
this.Qe.delete(e);
|
|
6458
6472
|
}
|
|
6459
6473
|
/**
|
|
6460
6474
|
* Returns the current count of documents in the target. This includes both
|
|
6461
6475
|
* the number of documents that the LocalStore considers to be part of the
|
|
6462
6476
|
* target as well as any accumulated changes.
|
|
6463
|
-
*/
|
|
6464
|
-
const t = this.
|
|
6465
|
-
return this.
|
|
6477
|
+
*/ et(e) {
|
|
6478
|
+
const t = this.He(e).Me();
|
|
6479
|
+
return this.qe.getRemoteKeysForTarget(e).size + t.addedDocuments.size - t.removedDocuments.size;
|
|
6466
6480
|
}
|
|
6467
6481
|
/**
|
|
6468
6482
|
* Increment the number of acks needed from watch before we can consider the
|
|
6469
6483
|
* server to be 'in-sync' with the client's active targets.
|
|
6470
|
-
*/
|
|
6471
|
-
this.
|
|
6484
|
+
*/ Be(e) {
|
|
6485
|
+
this.He(e).Be();
|
|
6472
6486
|
}
|
|
6473
|
-
|
|
6474
|
-
let t = this.
|
|
6475
|
-
return t || (t = new __PRIVATE_TargetState, this.
|
|
6487
|
+
He(e) {
|
|
6488
|
+
let t = this.Qe.get(e);
|
|
6489
|
+
return t || (t = new __PRIVATE_TargetState, this.Qe.set(e, t)), t;
|
|
6476
6490
|
}
|
|
6477
6491
|
_t(e) {
|
|
6478
|
-
let t = this.
|
|
6479
|
-
return t || (t = new SortedSet(__PRIVATE_primitiveComparator), this
|
|
6492
|
+
let t = this.$e.get(e);
|
|
6493
|
+
return t || (t = new SortedSet(__PRIVATE_primitiveComparator), this.$e = this.$e.insert(e, t)),
|
|
6480
6494
|
t;
|
|
6481
6495
|
}
|
|
6482
6496
|
/**
|
|
6483
6497
|
* Verifies that the user is still interested in this target (by calling
|
|
6484
6498
|
* `getTargetDataForTarget()`) and that we are not waiting for pending ADDs
|
|
6485
6499
|
* from watch.
|
|
6486
|
-
*/
|
|
6487
|
-
const t = null !== this.
|
|
6500
|
+
*/ Je(e) {
|
|
6501
|
+
const t = null !== this.Xe(e);
|
|
6488
6502
|
return t || __PRIVATE_logDebug("WatchChangeAggregator", "Detected inactive target", e),
|
|
6489
6503
|
t;
|
|
6490
6504
|
}
|
|
6491
6505
|
/**
|
|
6492
6506
|
* Returns the TargetData for an active target (i.e. a target that the user
|
|
6493
6507
|
* is still interested in that has no outstanding target change requests).
|
|
6494
|
-
*/
|
|
6495
|
-
const t = this.
|
|
6496
|
-
return t && t.
|
|
6508
|
+
*/ Xe(e) {
|
|
6509
|
+
const t = this.Qe.get(e);
|
|
6510
|
+
return t && t.ve ? null : this.qe.ut(e);
|
|
6497
6511
|
}
|
|
6498
6512
|
/**
|
|
6499
6513
|
* Resets the state of a Watch target to its initial state (e.g. sets
|
|
6500
6514
|
* 'current' to false, clears the resume token and removes its target mapping
|
|
6501
6515
|
* from all documents).
|
|
6502
|
-
*/
|
|
6503
|
-
this.
|
|
6504
|
-
this.
|
|
6505
|
-
this.
|
|
6516
|
+
*/ Ye(e) {
|
|
6517
|
+
this.Qe.set(e, new __PRIVATE_TargetState);
|
|
6518
|
+
this.qe.getRemoteKeysForTarget(e).forEach((t => {
|
|
6519
|
+
this.ze(e, t, /*updatedDocument=*/ null);
|
|
6506
6520
|
}));
|
|
6507
6521
|
}
|
|
6508
6522
|
/**
|
|
6509
6523
|
* Returns whether the LocalStore considers the document to be part of the
|
|
6510
6524
|
* specified target.
|
|
6511
6525
|
*/ ot(e, t) {
|
|
6512
|
-
return this.
|
|
6526
|
+
return this.qe.getRemoteKeysForTarget(e).has(t);
|
|
6513
6527
|
}
|
|
6514
6528
|
}
|
|
6515
6529
|
|
|
@@ -14570,7 +14584,7 @@ function __PRIVATE_remoteStoreListen(e, t) {
|
|
|
14570
14584
|
* We need to increment the the expected number of pending responses we're due
|
|
14571
14585
|
* from watch so we wait for the ack to process any messages from this target.
|
|
14572
14586
|
*/ function __PRIVATE_sendWatchRequest(e, t) {
|
|
14573
|
-
if (e.b_.
|
|
14587
|
+
if (e.b_.Be(t.targetId), t.resumeToken.approximateByteSize() > 0 || t.snapshotVersion.compareTo(SnapshotVersion.min()) > 0) {
|
|
14574
14588
|
const n = e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;
|
|
14575
14589
|
t = t.withExpectedCount(n);
|
|
14576
14590
|
}
|
|
@@ -14582,14 +14596,14 @@ function __PRIVATE_remoteStoreListen(e, t) {
|
|
|
14582
14596
|
* from watch so we wait for the removal on the server before we process any
|
|
14583
14597
|
* messages from this target.
|
|
14584
14598
|
*/ function __PRIVATE_sendUnwatchRequest(e, t) {
|
|
14585
|
-
e.b_.
|
|
14599
|
+
e.b_.Be(t), __PRIVATE_ensureWatchStream(e).i_(t);
|
|
14586
14600
|
}
|
|
14587
14601
|
|
|
14588
14602
|
function __PRIVATE_startWatchStream(e) {
|
|
14589
14603
|
e.b_ = new __PRIVATE_WatchChangeAggregator({
|
|
14590
14604
|
getRemoteKeysForTarget: t => e.remoteSyncer.getRemoteKeysForTarget(t),
|
|
14591
14605
|
ut: t => e.g_.get(t) || null,
|
|
14592
|
-
|
|
14606
|
+
rt: () => e.datastore.serializer.databaseId
|
|
14593
14607
|
}), __PRIVATE_ensureWatchStream(e).start(), e.S_.d_();
|
|
14594
14608
|
}
|
|
14595
14609
|
|
|
@@ -14650,7 +14664,7 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
|
|
|
14650
14664
|
} catch (n) {
|
|
14651
14665
|
__PRIVATE_logDebug("RemoteStore", "Failed to remove targets %s: %s ", t.targetIds.join(","), n),
|
|
14652
14666
|
await __PRIVATE_disableNetworkUntilRecovery(e, n);
|
|
14653
|
-
} else if (t instanceof __PRIVATE_DocumentWatchChange ? e.b_.
|
|
14667
|
+
} else if (t instanceof __PRIVATE_DocumentWatchChange ? e.b_.We(t) : t instanceof __PRIVATE_ExistenceFilterChange ? e.b_.Ze(t) : e.b_.je(t),
|
|
14654
14668
|
!n.isEqual(SnapshotVersion.min())) try {
|
|
14655
14669
|
const t = await __PRIVATE_localStoreGetLastRemoteSnapshotVersion(e.localStore);
|
|
14656
14670
|
n.compareTo(t) >= 0 &&
|
|
@@ -21555,9 +21569,9 @@ function __PRIVATE_tryGetString(e, t) {
|
|
|
21555
21569
|
return r = Object.assign({
|
|
21556
21570
|
useFetchStreams: t
|
|
21557
21571
|
}, r), s._setSettings(r), s;
|
|
21558
|
-
}), "PUBLIC").setMultipleInstances(!0)), r(D, "3.13.0-canary.
|
|
21572
|
+
}), "PUBLIC").setMultipleInstances(!0)), r(D, "3.13.0-canary.f3067f72d", e),
|
|
21559
21573
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
21560
|
-
r(D, "3.13.0-canary.
|
|
21574
|
+
r(D, "3.13.0-canary.f3067f72d", "esm2017");
|
|
21561
21575
|
}("rn", /* useFetchStreams= */ !1);
|
|
21562
21576
|
|
|
21563
21577
|
export { AbstractUserDataWriter, AggregateField, AggregateQuerySnapshot, Bytes, ye 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 };
|