@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.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import * as grpc from '@grpc/grpc-js';
|
|
|
9
9
|
import * as protoLoader from '@grpc/proto-loader';
|
|
10
10
|
|
|
11
11
|
const name = "@firebase/firestore";
|
|
12
|
-
const version$1 = "3.13.0-canary.
|
|
12
|
+
const version$1 = "3.13.0-canary.f3067f72d";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @license
|
|
@@ -62,7 +62,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
|
|
|
62
62
|
User.FIRST_PARTY = new User('first-party-uid');
|
|
63
63
|
User.MOCK_USER = new User('mock-user');
|
|
64
64
|
|
|
65
|
-
const version = "9.23.0-canary.
|
|
65
|
+
const version = "9.23.0-canary.f3067f72d";
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
* @license
|
|
@@ -8478,7 +8478,7 @@ class WatchChangeAggregator {
|
|
|
8478
8478
|
* `pendingTargetResets`.
|
|
8479
8479
|
*/
|
|
8480
8480
|
handleExistenceFilter(watchChange) {
|
|
8481
|
-
var _a;
|
|
8481
|
+
var _a, _b;
|
|
8482
8482
|
const targetId = watchChange.targetId;
|
|
8483
8483
|
const expectedCount = watchChange.existenceFilter.count;
|
|
8484
8484
|
const targetData = this.targetDataForActiveTarget(targetId);
|
|
@@ -8505,17 +8505,17 @@ class WatchChangeAggregator {
|
|
|
8505
8505
|
// raise a snapshot with `isFromCache:true`.
|
|
8506
8506
|
if (currentSize !== expectedCount) {
|
|
8507
8507
|
// Apply bloom filter to identify and mark removed documents.
|
|
8508
|
-
const
|
|
8509
|
-
if (status !== 0 /* BloomFilterApplicationStatus.Success */) {
|
|
8508
|
+
const applyResult = this.applyBloomFilter(watchChange, currentSize);
|
|
8509
|
+
if (applyResult.status !== 0 /* BloomFilterApplicationStatus.Success */) {
|
|
8510
8510
|
// If bloom filter application fails, we reset the mapping and
|
|
8511
8511
|
// trigger re-run of the query.
|
|
8512
8512
|
this.resetTarget(targetId);
|
|
8513
|
-
const purpose = status === 2 /* BloomFilterApplicationStatus.FalsePositive */
|
|
8513
|
+
const purpose = applyResult.status === 2 /* BloomFilterApplicationStatus.FalsePositive */
|
|
8514
8514
|
? "TargetPurposeExistenceFilterMismatchBloom" /* TargetPurpose.ExistenceFilterMismatchBloom */
|
|
8515
8515
|
: "TargetPurposeExistenceFilterMismatch" /* TargetPurpose.ExistenceFilterMismatch */;
|
|
8516
8516
|
this.pendingTargetResets = this.pendingTargetResets.insert(targetId, purpose);
|
|
8517
8517
|
}
|
|
8518
|
-
(_a = TestingHooks.instance) === null || _a === void 0 ? void 0 : _a.notifyOnExistenceFilterMismatch(createExistenceFilterMismatchInfoForTestingHooks(status, currentSize, watchChange.existenceFilter));
|
|
8518
|
+
(_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));
|
|
8519
8519
|
}
|
|
8520
8520
|
}
|
|
8521
8521
|
}
|
|
@@ -8527,7 +8527,7 @@ class WatchChangeAggregator {
|
|
|
8527
8527
|
applyBloomFilter(watchChange, currentCount) {
|
|
8528
8528
|
const { unchangedNames, count: expectedCount } = watchChange.existenceFilter;
|
|
8529
8529
|
if (!unchangedNames || !unchangedNames.bits) {
|
|
8530
|
-
return 1 /* BloomFilterApplicationStatus.Skipped
|
|
8530
|
+
return { status: 1 /* BloomFilterApplicationStatus.Skipped */ };
|
|
8531
8531
|
}
|
|
8532
8532
|
const { bits: { bitmap = '', padding = 0 }, hashCount = 0 } = unchangedNames;
|
|
8533
8533
|
let normalizedBitmap;
|
|
@@ -8539,7 +8539,7 @@ class WatchChangeAggregator {
|
|
|
8539
8539
|
logWarn('Decoding the base64 bloom filter in existence filter failed (' +
|
|
8540
8540
|
err.message +
|
|
8541
8541
|
'); ignoring the bloom filter and falling back to full re-query.');
|
|
8542
|
-
return 1 /* BloomFilterApplicationStatus.Skipped
|
|
8542
|
+
return { status: 1 /* BloomFilterApplicationStatus.Skipped */ };
|
|
8543
8543
|
}
|
|
8544
8544
|
else {
|
|
8545
8545
|
throw err;
|
|
@@ -8557,28 +8557,31 @@ class WatchChangeAggregator {
|
|
|
8557
8557
|
else {
|
|
8558
8558
|
logWarn('Applying bloom filter failed: ', err);
|
|
8559
8559
|
}
|
|
8560
|
-
return 1 /* BloomFilterApplicationStatus.Skipped
|
|
8560
|
+
return { status: 1 /* BloomFilterApplicationStatus.Skipped */ };
|
|
8561
8561
|
}
|
|
8562
|
+
const bloomFilterMightContain = (documentPath) => {
|
|
8563
|
+
const databaseId = this.metadataProvider.getDatabaseId();
|
|
8564
|
+
return bloomFilter.mightContain(`projects/${databaseId.projectId}/databases/${databaseId.database}` +
|
|
8565
|
+
`/documents/${documentPath}`);
|
|
8566
|
+
};
|
|
8562
8567
|
if (bloomFilter.bitCount === 0) {
|
|
8563
|
-
return 1 /* BloomFilterApplicationStatus.Skipped
|
|
8568
|
+
return { status: 1 /* BloomFilterApplicationStatus.Skipped */ };
|
|
8564
8569
|
}
|
|
8565
|
-
const removedDocumentCount = this.filterRemovedDocuments(watchChange.targetId,
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
return
|
|
8570
|
+
const removedDocumentCount = this.filterRemovedDocuments(watchChange.targetId, bloomFilterMightContain);
|
|
8571
|
+
const status = expectedCount === currentCount - removedDocumentCount
|
|
8572
|
+
? 0 /* BloomFilterApplicationStatus.Success */
|
|
8573
|
+
: 2 /* BloomFilterApplicationStatus.FalsePositive */;
|
|
8574
|
+
return { status, bloomFilterMightContain };
|
|
8570
8575
|
}
|
|
8571
8576
|
/**
|
|
8572
8577
|
* Filter out removed documents based on bloom filter membership result and
|
|
8573
8578
|
* return number of documents removed.
|
|
8574
8579
|
*/
|
|
8575
|
-
filterRemovedDocuments(targetId,
|
|
8580
|
+
filterRemovedDocuments(targetId, bloomFilterMightContain) {
|
|
8576
8581
|
const existingKeys = this.metadataProvider.getRemoteKeysForTarget(targetId);
|
|
8577
8582
|
let removalCount = 0;
|
|
8578
8583
|
existingKeys.forEach(key => {
|
|
8579
|
-
|
|
8580
|
-
const documentPath = `projects/${databaseId.projectId}/databases/${databaseId.database}/documents/${key.path.canonicalString()}`;
|
|
8581
|
-
if (!bloomFilter.mightContain(documentPath)) {
|
|
8584
|
+
if (!bloomFilterMightContain(key.path.canonicalString())) {
|
|
8582
8585
|
this.removeDocumentFromTarget(targetId, key, /*updatedDocument=*/ null);
|
|
8583
8586
|
removalCount++;
|
|
8584
8587
|
}
|
|
@@ -8782,7 +8785,7 @@ function documentTargetMap() {
|
|
|
8782
8785
|
function snapshotChangesMap() {
|
|
8783
8786
|
return new SortedMap(DocumentKey.comparator);
|
|
8784
8787
|
}
|
|
8785
|
-
function createExistenceFilterMismatchInfoForTestingHooks(status, localCacheCount, existenceFilter) {
|
|
8788
|
+
function createExistenceFilterMismatchInfoForTestingHooks(status, bloomFilterMightContain, localCacheCount, existenceFilter) {
|
|
8786
8789
|
var _a, _b, _c, _d, _e, _f;
|
|
8787
8790
|
const result = {
|
|
8788
8791
|
localCacheCount,
|
|
@@ -8796,6 +8799,9 @@ function createExistenceFilterMismatchInfoForTestingHooks(status, localCacheCoun
|
|
|
8796
8799
|
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,
|
|
8797
8800
|
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
|
|
8798
8801
|
};
|
|
8802
|
+
if (bloomFilterMightContain) {
|
|
8803
|
+
result.bloomFilter.mightContain = bloomFilterMightContain;
|
|
8804
|
+
}
|
|
8799
8805
|
}
|
|
8800
8806
|
return result;
|
|
8801
8807
|
}
|