Skip to content

Commit dafecbb

Browse files
authored
Merge 8ae6f1d into 8a5faad
2 parents 8a5faad + 8ae6f1d commit dafecbb

File tree

4 files changed

+42
-5
lines changed

4 files changed

+42
-5
lines changed

packages/firestore/src/protos/firestore_proto_api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ export declare namespace firestoreV1ApiClientInterfaces {
399399
readTime?: Timestamp;
400400
targetId?: number;
401401
once?: boolean;
402-
expectedCount?: number;
402+
expectedCount?: number | { value: number };
403403
}
404404
interface TargetChange {
405405
targetChangeType?: TargetChangeTargetChangeType;

packages/firestore/src/protos/protos.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,30 @@
928928
}
929929
}
930930
},
931+
"BitSequence": {
932+
"fields": {
933+
"bitmap": {
934+
"type": "bytes",
935+
"id": 1
936+
},
937+
"padding": {
938+
"type": "int32",
939+
"id": 2
940+
}
941+
}
942+
},
943+
"BloomFilter": {
944+
"fields": {
945+
"bits": {
946+
"type": "BitSequence",
947+
"id": 1
948+
},
949+
"hashCount": {
950+
"type": "int32",
951+
"id": 2
952+
}
953+
}
954+
},
931955
"DocumentMask": {
932956
"fields": {
933957
"fieldPaths": {
@@ -2052,6 +2076,10 @@
20522076
"once": {
20532077
"type": "bool",
20542078
"id": 6
2079+
},
2080+
"expectedCount": {
2081+
"type": "google.protobuf.Int32Value",
2082+
"id": 12
20552083
}
20562084
},
20572085
"nested": {
@@ -2660,6 +2688,10 @@
26602688
"count": {
26612689
"type": "int32",
26622690
"id": 2
2691+
},
2692+
"unchangedNames": {
2693+
"type": "BloomFilter",
2694+
"id": 3
26632695
}
26642696
}
26652697
}

packages/firestore/src/remote/serializer.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,10 @@ export function toTarget(
10511051

10521052
if (targetData.resumeToken.approximateByteSize() > 0) {
10531053
result.resumeToken = toBytes(serializer, targetData.resumeToken);
1054-
result.expectedCount = targetData.expectedCount ?? undefined;
1054+
const expectedCount = toInt32Proto(serializer, targetData.expectedCount);
1055+
if (expectedCount !== null) {
1056+
result.expectedCount = expectedCount;
1057+
}
10551058
} else if (targetData.snapshotVersion.compareTo(SnapshotVersion.min()) > 0) {
10561059
// TODO(wuandy): Consider removing above check because it is most likely true.
10571060
// Right now, many tests depend on this behaviour though (leaving min() out
@@ -1060,7 +1063,10 @@ export function toTarget(
10601063
serializer,
10611064
targetData.snapshotVersion.toTimestamp()
10621065
);
1063-
result.expectedCount = targetData.expectedCount ?? undefined;
1066+
const expectedCount = toInt32Proto(serializer, targetData.expectedCount);
1067+
if (expectedCount !== null) {
1068+
result.expectedCount = expectedCount;
1069+
}
10641070
}
10651071

10661072
return result;

packages/firestore/test/unit/remote/serializer.helper.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,8 +1778,7 @@ export function serializerTest(
17781778
}
17791779
},
17801780
resumeToken: new Uint8Array([1, 2, 3]),
1781-
targetId: 1,
1782-
expectedCount: undefined
1781+
targetId: 1
17831782
};
17841783
expect(result).to.deep.equal(expected);
17851784
});

0 commit comments

Comments
 (0)