@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.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.
|
package/dist/index.esm2017.js
CHANGED
|
@@ -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.
|
|
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
|
-
|
|
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.
|
|
5915
|
+
this.me(t);
|
|
5916
5916
|
}
|
|
5917
5917
|
}
|
|
5918
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
6116
|
+
this.we = __PRIVATE_snapshotChangesMap(),
|
|
6117
6117
|
/** See public getters for explanations of these fields. */
|
|
6118
|
-
this.
|
|
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.
|
|
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.
|
|
6134
|
+
return this.be;
|
|
6135
6135
|
}
|
|
6136
6136
|
/** The last resume token sent to us for this target. */ get resumeToken() {
|
|
6137
|
-
return this.
|
|
6137
|
+
return this.Se;
|
|
6138
6138
|
}
|
|
6139
|
-
/** Whether this target has pending target adds or target removes. */ get
|
|
6140
|
-
return 0 !== this.
|
|
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
|
|
6143
|
-
return this.
|
|
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
|
-
*/
|
|
6149
|
-
e.approximateByteSize() > 0 && (this.
|
|
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
|
-
*/
|
|
6156
|
+
*/ Me() {
|
|
6157
6157
|
let e = __PRIVATE_documentKeySet(), t = __PRIVATE_documentKeySet(), n = __PRIVATE_documentKeySet();
|
|
6158
|
-
return this.
|
|
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.
|
|
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
|
-
*/
|
|
6180
|
-
this.
|
|
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
|
|
6183
|
-
this.
|
|
6185
|
+
Ne(e) {
|
|
6186
|
+
this.De = !0, this.we = this.we.remove(e);
|
|
6184
6187
|
}
|
|
6185
|
-
Be(
|
|
6186
|
-
this.
|
|
6188
|
+
Be() {
|
|
6189
|
+
this.ye += 1;
|
|
6187
6190
|
}
|
|
6188
6191
|
Le() {
|
|
6189
|
-
this.
|
|
6192
|
+
this.ye -= 1;
|
|
6190
6193
|
}
|
|
6191
6194
|
ke() {
|
|
6192
|
-
this.
|
|
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.
|
|
6204
|
+
this.qe = e,
|
|
6205
6205
|
/** The internal state of all tracked targets. */
|
|
6206
|
-
this.
|
|
6206
|
+
this.Qe = new Map,
|
|
6207
6207
|
/** Keeps track of the documents to update since the last raised snapshot. */
|
|
6208
|
-
this
|
|
6208
|
+
this.Ke = __PRIVATE_mutableDocumentMap(),
|
|
6209
6209
|
/** A mapping of document keys to their set of target IDs. */
|
|
6210
|
-
this
|
|
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.
|
|
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
|
-
*/
|
|
6221
|
-
for (const t of e.
|
|
6222
|
-
for (const t of e.removedTargetIds) this.
|
|
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. */
|
|
6224
|
+
/** Processes and adds the WatchTargetChange to the current set of changes. */ je(e) {
|
|
6225
6225
|
this.forEachTarget(e, (t => {
|
|
6226
|
-
const n = this.
|
|
6226
|
+
const n = this.He(t);
|
|
6227
6227
|
switch (e.state) {
|
|
6228
6228
|
case 0 /* WatchTargetChangeState.NoChange */ :
|
|
6229
|
-
this.
|
|
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.
|
|
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.
|
|
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.
|
|
6247
|
+
n.Le(), n.ve || this.removeTarget(t);
|
|
6248
6248
|
break;
|
|
6249
6249
|
|
|
6250
6250
|
case 3 /* WatchTargetChangeState.Current */ :
|
|
6251
|
-
this.
|
|
6251
|
+
this.Je(t) && (n.ke(), n.Fe(e.resumeToken));
|
|
6252
6252
|
break;
|
|
6253
6253
|
|
|
6254
6254
|
case 4 /* WatchTargetChangeState.Reset */ :
|
|
6255
|
-
this.
|
|
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.
|
|
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.
|
|
6273
|
-
this.
|
|
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
|
-
*/
|
|
6281
|
-
var t;
|
|
6282
|
-
const
|
|
6283
|
-
if (
|
|
6284
|
-
const
|
|
6285
|
-
if (__PRIVATE_targetIsDocumentTarget(
|
|
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(
|
|
6293
|
-
this.
|
|
6294
|
-
} else __PRIVATE_hardAssert(1 ===
|
|
6295
|
-
const
|
|
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 (
|
|
6298
|
+
if (s !== i) {
|
|
6299
6299
|
// Apply bloom filter to identify and mark removed documents.
|
|
6300
|
-
const
|
|
6301
|
-
if (0 /* BloomFilterApplicationStatus.Success */ !==
|
|
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.
|
|
6305
|
-
const e = 2 /* BloomFilterApplicationStatus.FalsePositive */ ===
|
|
6306
|
-
this.
|
|
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
|
|
6310
|
-
const
|
|
6311
|
-
localCacheCount:
|
|
6312
|
-
existenceFilterCount:
|
|
6313
|
-
},
|
|
6314
|
-
|
|
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 !== (
|
|
6317
|
-
bitmapLength: null !== (
|
|
6318
|
-
padding: null !== (
|
|
6319
|
-
});
|
|
6320
|
-
return
|
|
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
|
-
*/ (
|
|
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
|
-
*/
|
|
6346
|
-
const {unchangedNames: n, count: r} = e.
|
|
6347
|
-
if (!n || !n.bits) return
|
|
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
|
-
|
|
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
|
-
|
|
6366
|
+
{
|
|
6367
|
+
status: 1
|
|
6368
|
+
/* BloomFilterApplicationStatus.Skipped */ };
|
|
6363
6369
|
}
|
|
6364
|
-
|
|
6365
|
-
|
|
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
|
-
*/
|
|
6371
|
-
const n = this.
|
|
6385
|
+
*/ it(e, t) {
|
|
6386
|
+
const n = this.qe.getRemoteKeysForTarget(e);
|
|
6372
6387
|
let r = 0;
|
|
6373
6388
|
return n.forEach((n => {
|
|
6374
|
-
|
|
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.
|
|
6384
|
-
const i = this.
|
|
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
|
|
6410
|
+
null !== this.Ke.get(t) || this.ot(r, t) || this.ze(r, t, MutableDocument.newNoDocument(t, e));
|
|
6397
6411
|
}
|
|
6398
|
-
n.
|
|
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.
|
|
6421
|
+
this.$e.forEach(((e, t) => {
|
|
6408
6422
|
let r = !0;
|
|
6409
6423
|
t.forEachWhile((e => {
|
|
6410
|
-
const t = this.
|
|
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
|
|
6415
|
-
const r = new RemoteEvent(e, t, this.
|
|
6416
|
-
return this
|
|
6417
|
-
this.
|
|
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
|
-
|
|
6425
|
-
if (!this.
|
|
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.
|
|
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
|
-
|
|
6438
|
-
if (!this.
|
|
6439
|
-
const r = this.
|
|
6440
|
-
this.ot(e, t) ? r.
|
|
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.
|
|
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.
|
|
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
|
-
*/
|
|
6453
|
-
const t = this.
|
|
6454
|
-
return this.
|
|
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
|
-
*/
|
|
6460
|
-
this.
|
|
6473
|
+
*/ Be(e) {
|
|
6474
|
+
this.He(e).Be();
|
|
6461
6475
|
}
|
|
6462
|
-
|
|
6463
|
-
let t = this.
|
|
6464
|
-
return t || (t = new __PRIVATE_TargetState, this.
|
|
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.
|
|
6468
|
-
return t || (t = new SortedSet(__PRIVATE_primitiveComparator), this
|
|
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
|
-
*/
|
|
6476
|
-
const t = null !== this.
|
|
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
|
-
*/
|
|
6484
|
-
const t = this.
|
|
6485
|
-
return t && t.
|
|
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
|
-
*/
|
|
6492
|
-
this.
|
|
6493
|
-
this.
|
|
6494
|
-
this.
|
|
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.
|
|
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_.
|
|
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_.
|
|
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
|
-
|
|
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_.
|
|
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.
|
|
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.
|
|
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 };
|