Skip to content

Commit dd533d3

Browse files
Review
1 parent 9c4663a commit dd533d3

File tree

3 files changed

+15
-25
lines changed

3 files changed

+15
-25
lines changed

packages/firestore/src/local/local_serializer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,9 @@ export class LocalSerializer {
192192

193193
let target: Target;
194194
if (isDocumentQuery(dbTarget.query)) {
195-
target = fromDocumentsTarget(this.remoteSerializer, dbTarget.query);
195+
target = fromDocumentsTarget(dbTarget.query);
196196
} else {
197-
target = fromQueryTarget(this.remoteSerializer, dbTarget.query);
197+
target = fromQueryTarget(dbTarget.query);
198198
}
199199
return new TargetData(
200200
target,

packages/firestore/src/remote/serializer.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ function toInt32Proto(
153153
* Returns a number (or null) from a google.protobuf.Int32Value proto.
154154
*/
155155
function fromInt32Proto(
156-
serializer: JsonProtoSerializer,
157156
val: number | { value: number } | undefined
158157
): number | null {
159158
let result;
@@ -629,7 +628,7 @@ export function fromMutation(
629628
proto: api.Write
630629
): Mutation {
631630
const precondition = proto.currentDocument
632-
? fromPrecondition(serializer, proto.currentDocument)
631+
? fromPrecondition(proto.currentDocument)
633632
: Precondition.none();
634633

635634
if (proto.update) {
@@ -681,10 +680,7 @@ function toPrecondition(
681680
}
682681
}
683682

684-
function fromPrecondition(
685-
serializer: JsonProtoSerializer,
686-
precondition: api.Precondition
687-
): Precondition {
683+
function fromPrecondition(precondition: api.Precondition): Precondition {
688684
if (precondition.updateTime !== undefined) {
689685
return Precondition.updateTime(fromVersion(precondition.updateTime));
690686
} else if (precondition.exists !== undefined) {
@@ -805,7 +801,6 @@ export function toDocumentsTarget(
805801
}
806802

807803
export function fromDocumentsTarget(
808-
serializer: JsonProtoSerializer,
809804
documentsTarget: api.DocumentsTarget
810805
): Target {
811806
const count = documentsTarget.documents!.length;
@@ -870,10 +865,7 @@ export function toQueryTarget(
870865
return result;
871866
}
872867

873-
export function fromQueryTarget(
874-
serializer: JsonProtoSerializer,
875-
target: api.QueryTarget
876-
): Target {
868+
export function fromQueryTarget(target: api.QueryTarget): Target {
877869
let path = fromQueryPath(target.parent!);
878870

879871
const query = target.structuredQuery!;
@@ -904,7 +896,7 @@ export function fromQueryTarget(
904896

905897
let limit: number | null = null;
906898
if (query.limit) {
907-
limit = fromInt32Proto(serializer, query.limit);
899+
limit = fromInt32Proto(query.limit);
908900
}
909901

910902
let startAt: Bound | null = null;

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

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -973,9 +973,7 @@ export function serializerTest(
973973
documents: { documents: ['projects/p/databases/d/documents/docs/1'] },
974974
targetId: 1
975975
});
976-
expect(fromDocumentsTarget(s, toDocumentsTarget(s, q))).to.deep.equal(
977-
q
978-
);
976+
expect(fromDocumentsTarget(toDocumentsTarget(s, q))).to.deep.equal(q);
979977
});
980978

981979
it('converts first-level ancestor queries', () => {
@@ -996,7 +994,7 @@ export function serializerTest(
996994
},
997995
targetId: 1
998996
});
999-
expect(fromQueryTarget(s, toQueryTarget(s, q))).to.deep.equal(q);
997+
expect(fromQueryTarget(toQueryTarget(s, q))).to.deep.equal(q);
1000998
});
1001999

10021000
it('converts nested ancestor queries', () => {
@@ -1020,7 +1018,7 @@ export function serializerTest(
10201018
targetId: 1
10211019
};
10221020
expect(result).to.deep.equal(expected);
1023-
expect(fromQueryTarget(s, toQueryTarget(s, q))).to.deep.equal(q);
1021+
expect(fromQueryTarget(toQueryTarget(s, q))).to.deep.equal(q);
10241022
});
10251023

10261024
it('converts single filters at first-level collections', () => {
@@ -1055,7 +1053,7 @@ export function serializerTest(
10551053
targetId: 1
10561054
};
10571055
expect(result).to.deep.equal(expected);
1058-
expect(fromQueryTarget(s, toQueryTarget(s, q))).to.deep.equal(q);
1056+
expect(fromQueryTarget(toQueryTarget(s, q))).to.deep.equal(q);
10591057
});
10601058

10611059
it('converts multiple filters at first-level collections', () => {
@@ -1127,7 +1125,7 @@ export function serializerTest(
11271125
targetId: 1
11281126
};
11291127
expect(result).to.deep.equal(expected);
1130-
expect(fromQueryTarget(s, toQueryTarget(s, q))).to.deep.equal(q);
1128+
expect(fromQueryTarget(toQueryTarget(s, q))).to.deep.equal(q);
11311129
});
11321130

11331131
it('converts single filters on deeper collections', () => {
@@ -1162,7 +1160,7 @@ export function serializerTest(
11621160
targetId: 1
11631161
};
11641162
expect(result).to.deep.equal(expected);
1165-
expect(fromQueryTarget(s, toQueryTarget(s, q))).to.deep.equal(q);
1163+
expect(fromQueryTarget(toQueryTarget(s, q))).to.deep.equal(q);
11661164
});
11671165

11681166
it('converts order bys', () => {
@@ -1190,7 +1188,7 @@ export function serializerTest(
11901188
targetId: 1
11911189
};
11921190
expect(result).to.deep.equal(expected);
1193-
expect(fromQueryTarget(s, toQueryTarget(s, q))).to.deep.equal(q);
1191+
expect(fromQueryTarget(toQueryTarget(s, q))).to.deep.equal(q);
11941192
});
11951193

11961194
it('converts limits', () => {
@@ -1215,7 +1213,7 @@ export function serializerTest(
12151213
targetId: 1
12161214
};
12171215
expect(result).to.deep.equal(expected);
1218-
expect(fromQueryTarget(s, toQueryTarget(s, q))).to.deep.equal(q);
1216+
expect(fromQueryTarget(toQueryTarget(s, q))).to.deep.equal(q);
12191217
});
12201218

12211219
it('converts startAt/endAt', () => {
@@ -1268,7 +1266,7 @@ export function serializerTest(
12681266
targetId: 1
12691267
};
12701268
expect(result).to.deep.equal(expected);
1271-
expect(fromQueryTarget(s, toQueryTarget(s, q))).to.deep.equal(q);
1269+
expect(fromQueryTarget(toQueryTarget(s, q))).to.deep.equal(q);
12721270
});
12731271

12741272
it('converts resume tokens', () => {

0 commit comments

Comments
 (0)