@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.node.cjs.js
CHANGED
|
@@ -34,7 +34,7 @@ var grpc__namespace = /*#__PURE__*/_interopNamespace(grpc);
|
|
|
34
34
|
var protoLoader__namespace = /*#__PURE__*/_interopNamespace(protoLoader);
|
|
35
35
|
|
|
36
36
|
const name = "@firebase/firestore";
|
|
37
|
-
const version$1 = "3.13.0-canary.
|
|
37
|
+
const version$1 = "3.13.0-canary.f3067f72d";
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* @license
|
|
@@ -87,7 +87,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
|
|
|
87
87
|
User.FIRST_PARTY = new User('first-party-uid');
|
|
88
88
|
User.MOCK_USER = new User('mock-user');
|
|
89
89
|
|
|
90
|
-
const version = "9.23.0-canary.
|
|
90
|
+
const version = "9.23.0-canary.f3067f72d";
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
93
|
* @license
|
|
@@ -8503,7 +8503,7 @@ class WatchChangeAggregator {
|
|
|
8503
8503
|
* `pendingTargetResets`.
|
|
8504
8504
|
*/
|
|
8505
8505
|
handleExistenceFilter(watchChange) {
|
|
8506
|
-
var _a;
|
|
8506
|
+
var _a, _b;
|
|
8507
8507
|
const targetId = watchChange.targetId;
|
|
8508
8508
|
const expectedCount = watchChange.existenceFilter.count;
|
|
8509
8509
|
const targetData = this.targetDataForActiveTarget(targetId);
|
|
@@ -8530,17 +8530,17 @@ class WatchChangeAggregator {
|
|
|
8530
8530
|
// raise a snapshot with `isFromCache:true`.
|
|
8531
8531
|
if (currentSize !== expectedCount) {
|
|
8532
8532
|
// Apply bloom filter to identify and mark removed documents.
|
|
8533
|
-
const
|
|
8534
|
-
if (status !== 0 /* BloomFilterApplicationStatus.Success */) {
|
|
8533
|
+
const applyResult = this.applyBloomFilter(watchChange, currentSize);
|
|
8534
|
+
if (applyResult.status !== 0 /* BloomFilterApplicationStatus.Success */) {
|
|
8535
8535
|
// If bloom filter application fails, we reset the mapping and
|
|
8536
8536
|
// trigger re-run of the query.
|
|
8537
8537
|
this.resetTarget(targetId);
|
|
8538
|
-
const purpose = status === 2 /* BloomFilterApplicationStatus.FalsePositive */
|
|
8538
|
+
const purpose = applyResult.status === 2 /* BloomFilterApplicationStatus.FalsePositive */
|
|
8539
8539
|
? "TargetPurposeExistenceFilterMismatchBloom" /* TargetPurpose.ExistenceFilterMismatchBloom */
|
|
8540
8540
|
: "TargetPurposeExistenceFilterMismatch" /* TargetPurpose.ExistenceFilterMismatch */;
|
|
8541
8541
|
this.pendingTargetResets = this.pendingTargetResets.insert(targetId, purpose);
|
|
8542
8542
|
}
|
|
8543
|
-
(_a = TestingHooks.instance) === null || _a === void 0 ? void 0 : _a.notifyOnExistenceFilterMismatch(createExistenceFilterMismatchInfoForTestingHooks(status, currentSize, watchChange.existenceFilter));
|
|
8543
|
+
(_a = TestingHooks.instance) === null || _a === void 0 ? void 0 : _a.notifyOnExistenceFilterMismatch(createExistenceFilterMismatchInfoForTestingHooks(applyResult.status, (_b = applyResult.bloomFilterMightContain) !== null && _b !== void 0 ? _b : null, currentSize, watchChange.existenceFilter));
|
|
8544
8544
|
}
|
|
8545
8545
|
}
|
|
8546
8546
|
}
|
|
@@ -8552,7 +8552,7 @@ class WatchChangeAggregator {
|
|
|
8552
8552
|
applyBloomFilter(watchChange, currentCount) {
|
|
8553
8553
|
const { unchangedNames, count: expectedCount } = watchChange.existenceFilter;
|
|
8554
8554
|
if (!unchangedNames || !unchangedNames.bits) {
|
|
8555
|
-
return 1 /* BloomFilterApplicationStatus.Skipped
|
|
8555
|
+
return { status: 1 /* BloomFilterApplicationStatus.Skipped */ };
|
|
8556
8556
|
}
|
|
8557
8557
|
const { bits: { bitmap = '', padding = 0 }, hashCount = 0 } = unchangedNames;
|
|
8558
8558
|
let normalizedBitmap;
|
|
@@ -8564,7 +8564,7 @@ class WatchChangeAggregator {
|
|
|
8564
8564
|
logWarn('Decoding the base64 bloom filter in existence filter failed (' +
|
|
8565
8565
|
err.message +
|
|
8566
8566
|
'); ignoring the bloom filter and falling back to full re-query.');
|
|
8567
|
-
return 1 /* BloomFilterApplicationStatus.Skipped
|
|
8567
|
+
return { status: 1 /* BloomFilterApplicationStatus.Skipped */ };
|
|
8568
8568
|
}
|
|
8569
8569
|
else {
|
|
8570
8570
|
throw err;
|
|
@@ -8582,28 +8582,31 @@ class WatchChangeAggregator {
|
|
|
8582
8582
|
else {
|
|
8583
8583
|
logWarn('Applying bloom filter failed: ', err);
|
|
8584
8584
|
}
|
|
8585
|
-
return 1 /* BloomFilterApplicationStatus.Skipped
|
|
8585
|
+
return { status: 1 /* BloomFilterApplicationStatus.Skipped */ };
|
|
8586
8586
|
}
|
|
8587
|
+
const bloomFilterMightContain = (documentPath) => {
|
|
8588
|
+
const databaseId = this.metadataProvider.getDatabaseId();
|
|
8589
|
+
return bloomFilter.mightContain(`projects/${databaseId.projectId}/databases/${databaseId.database}` +
|
|
8590
|
+
`/documents/${documentPath}`);
|
|
8591
|
+
};
|
|
8587
8592
|
if (bloomFilter.bitCount === 0) {
|
|
8588
|
-
return 1 /* BloomFilterApplicationStatus.Skipped
|
|
8593
|
+
return { status: 1 /* BloomFilterApplicationStatus.Skipped */ };
|
|
8589
8594
|
}
|
|
8590
|
-
const removedDocumentCount = this.filterRemovedDocuments(watchChange.targetId,
|
|
8591
|
-
|
|
8592
|
-
|
|
8593
|
-
|
|
8594
|
-
return
|
|
8595
|
+
const removedDocumentCount = this.filterRemovedDocuments(watchChange.targetId, bloomFilterMightContain);
|
|
8596
|
+
const status = expectedCount === currentCount - removedDocumentCount
|
|
8597
|
+
? 0 /* BloomFilterApplicationStatus.Success */
|
|
8598
|
+
: 2 /* BloomFilterApplicationStatus.FalsePositive */;
|
|
8599
|
+
return { status, bloomFilterMightContain };
|
|
8595
8600
|
}
|
|
8596
8601
|
/**
|
|
8597
8602
|
* Filter out removed documents based on bloom filter membership result and
|
|
8598
8603
|
* return number of documents removed.
|
|
8599
8604
|
*/
|
|
8600
|
-
filterRemovedDocuments(targetId,
|
|
8605
|
+
filterRemovedDocuments(targetId, bloomFilterMightContain) {
|
|
8601
8606
|
const existingKeys = this.metadataProvider.getRemoteKeysForTarget(targetId);
|
|
8602
8607
|
let removalCount = 0;
|
|
8603
8608
|
existingKeys.forEach(key => {
|
|
8604
|
-
|
|
8605
|
-
const documentPath = `projects/${databaseId.projectId}/databases/${databaseId.database}/documents/${key.path.canonicalString()}`;
|
|
8606
|
-
if (!bloomFilter.mightContain(documentPath)) {
|
|
8609
|
+
if (!bloomFilterMightContain(key.path.canonicalString())) {
|
|
8607
8610
|
this.removeDocumentFromTarget(targetId, key, /*updatedDocument=*/ null);
|
|
8608
8611
|
removalCount++;
|
|
8609
8612
|
}
|
|
@@ -8807,7 +8810,7 @@ function documentTargetMap() {
|
|
|
8807
8810
|
function snapshotChangesMap() {
|
|
8808
8811
|
return new SortedMap(DocumentKey.comparator);
|
|
8809
8812
|
}
|
|
8810
|
-
function createExistenceFilterMismatchInfoForTestingHooks(status, localCacheCount, existenceFilter) {
|
|
8813
|
+
function createExistenceFilterMismatchInfoForTestingHooks(status, bloomFilterMightContain, localCacheCount, existenceFilter) {
|
|
8811
8814
|
var _a, _b, _c, _d, _e, _f;
|
|
8812
8815
|
const result = {
|
|
8813
8816
|
localCacheCount,
|
|
@@ -8821,6 +8824,9 @@ function createExistenceFilterMismatchInfoForTestingHooks(status, localCacheCoun
|
|
|
8821
8824
|
bitmapLength: (_d = (_c = (_b = unchangedNames === null || unchangedNames === void 0 ? void 0 : unchangedNames.bits) === null || _b === void 0 ? void 0 : _b.bitmap) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0,
|
|
8822
8825
|
padding: (_f = (_e = unchangedNames === null || unchangedNames === void 0 ? void 0 : unchangedNames.bits) === null || _e === void 0 ? void 0 : _e.padding) !== null && _f !== void 0 ? _f : 0
|
|
8823
8826
|
};
|
|
8827
|
+
if (bloomFilterMightContain) {
|
|
8828
|
+
result.bloomFilter.mightContain = bloomFilterMightContain;
|
|
8829
|
+
}
|
|
8824
8830
|
}
|
|
8825
8831
|
return result;
|
|
8826
8832
|
}
|