diff --git a/packages/firestore/src/protos/firestore_proto_api.ts b/packages/firestore/src/protos/firestore_proto_api.ts index 6585004078e..9618d71b86a 100644 --- a/packages/firestore/src/protos/firestore_proto_api.ts +++ b/packages/firestore/src/protos/firestore_proto_api.ts @@ -399,7 +399,7 @@ export declare namespace firestoreV1ApiClientInterfaces { readTime?: Timestamp; targetId?: number; once?: boolean; - expectedCount?: number; + expectedCount?: number | { value: number }; } interface TargetChange { targetChangeType?: TargetChangeTargetChangeType; diff --git a/packages/firestore/src/protos/protos.json b/packages/firestore/src/protos/protos.json index 61af4ae5dee..b2c50ccaeeb 100644 --- a/packages/firestore/src/protos/protos.json +++ b/packages/firestore/src/protos/protos.json @@ -928,6 +928,30 @@ } } }, + "BitSequence": { + "fields": { + "bitmap": { + "type": "bytes", + "id": 1 + }, + "padding": { + "type": "int32", + "id": 2 + } + } + }, + "BloomFilter": { + "fields": { + "bits": { + "type": "BitSequence", + "id": 1 + }, + "hashCount": { + "type": "int32", + "id": 2 + } + } + }, "DocumentMask": { "fields": { "fieldPaths": { @@ -2052,6 +2076,10 @@ "once": { "type": "bool", "id": 6 + }, + "expectedCount": { + "type": "google.protobuf.Int32Value", + "id": 12 } }, "nested": { @@ -2660,6 +2688,10 @@ "count": { "type": "int32", "id": 2 + }, + "unchangedNames": { + "type": "BloomFilter", + "id": 3 } } } diff --git a/packages/firestore/src/remote/serializer.ts b/packages/firestore/src/remote/serializer.ts index 43292e1c456..39a787a943d 100644 --- a/packages/firestore/src/remote/serializer.ts +++ b/packages/firestore/src/remote/serializer.ts @@ -1051,7 +1051,10 @@ export function toTarget( if (targetData.resumeToken.approximateByteSize() > 0) { result.resumeToken = toBytes(serializer, targetData.resumeToken); - result.expectedCount = targetData.expectedCount ?? undefined; + const expectedCount = toInt32Proto(serializer, targetData.expectedCount); + if (expectedCount !== null) { + result.expectedCount = expectedCount; + } } else if (targetData.snapshotVersion.compareTo(SnapshotVersion.min()) > 0) { // TODO(wuandy): Consider removing above check because it is most likely true. // Right now, many tests depend on this behaviour though (leaving min() out @@ -1060,7 +1063,10 @@ export function toTarget( serializer, targetData.snapshotVersion.toTimestamp() ); - result.expectedCount = targetData.expectedCount ?? undefined; + const expectedCount = toInt32Proto(serializer, targetData.expectedCount); + if (expectedCount !== null) { + result.expectedCount = expectedCount; + } } return result; diff --git a/packages/firestore/test/unit/remote/serializer.helper.ts b/packages/firestore/test/unit/remote/serializer.helper.ts index a9b22a9555d..79140e73999 100644 --- a/packages/firestore/test/unit/remote/serializer.helper.ts +++ b/packages/firestore/test/unit/remote/serializer.helper.ts @@ -1778,8 +1778,7 @@ export function serializerTest( } }, resumeToken: new Uint8Array([1, 2, 3]), - targetId: 1, - expectedCount: undefined + targetId: 1 }; expect(result).to.deep.equal(expected); });