Skip to content

Commit ba1e940

Browse files
Hide converter from Public API
The converter property is currently not part of our public API, and as such it should be prefixed with an underscore
1 parent 80e4219 commit ba1e940

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

packages/firestore/exp/src/api/reference.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,15 +317,18 @@ export function addDoc<T>(
317317
firestore._verifyNotTerminated();
318318

319319
const docRef = doc(reference);
320-
const convertedValue = applyFirestoreDataConverter(reference.converter, data);
320+
const convertedValue = applyFirestoreDataConverter(
321+
reference._converter,
322+
data
323+
);
321324

322325
const dataReader = newUserDataReader(reference.firestore);
323326
const parsed = parseSetData(
324327
dataReader,
325328
'addDoc',
326329
docRef._key,
327330
convertedValue,
328-
reference.converter !== null,
331+
reference._converter !== null,
329332
{}
330333
);
331334

packages/firestore/exp/src/api/snapshot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ export class QuerySnapshot<T = DocumentData> {
232232
doc.key,
233233
doc,
234234
new SnapshotMetadata(hasPendingWrites, fromCache),
235-
this.query.converter
235+
this.query._converter
236236
);
237237
}
238238
}

packages/firestore/lite/src/api/reference.ts

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ export class DocumentReference<T = DocumentData> extends _DocumentKeyReference<
108108

109109
constructor(
110110
readonly firestore: FirebaseFirestore,
111-
readonly converter: FirestoreDataConverter<T> | null,
111+
_converter: FirestoreDataConverter<T> | null,
112112
readonly _path: ResourcePath
113113
) {
114-
super(firestore._databaseId, new DocumentKey(_path), converter);
114+
super(firestore._databaseId, new DocumentKey(_path), _converter);
115115
}
116116

117117
get id(): string {
@@ -154,7 +154,7 @@ export class Query<T = DocumentData> {
154154
// This is the lite version of the Query class in the main SDK.
155155
constructor(
156156
readonly firestore: FirebaseFirestore,
157-
readonly converter: FirestoreDataConverter<T> | null,
157+
readonly _converter: FirestoreDataConverter<T> | null,
158158
readonly _query: InternalQuery
159159
) {}
160160

@@ -217,7 +217,7 @@ class QueryFilterConstraint extends QueryConstraint {
217217
);
218218
return new Query(
219219
query.firestore,
220-
query.converter,
220+
query._converter,
221221
queryWithAddedFilter(query._query, filter)
222222
);
223223
}
@@ -259,7 +259,7 @@ class QueryOrderByConstraint extends QueryConstraint {
259259
const orderBy = newQueryOrderBy(query._query, this._field, this._direction);
260260
return new Query(
261261
query.firestore,
262-
query.converter,
262+
query._converter,
263263
queryWithAddedOrderBy(query._query, orderBy)
264264
);
265265
}
@@ -290,7 +290,7 @@ class QueryLimitConstraint extends QueryConstraint {
290290
_apply<T>(query: Query<T>): Query<T> {
291291
return new Query(
292292
query.firestore,
293-
query.converter,
293+
query._converter,
294294
queryWithLimit(query._query, this._limit, this._limitType)
295295
);
296296
}
@@ -324,7 +324,7 @@ class QueryStartAtConstraint extends QueryConstraint {
324324
);
325325
return new Query(
326326
query.firestore,
327-
query.converter,
327+
query._converter,
328328
queryWithStartAt(query._query, bound)
329329
);
330330
}
@@ -364,7 +364,7 @@ class QueryEndAtConstraint extends QueryConstraint {
364364
);
365365
return new Query(
366366
query.firestore,
367-
query.converter,
367+
query._converter,
368368
queryWithEndAt(query._query, bound)
369369
);
370370
}
@@ -452,7 +452,7 @@ export class CollectionReference<T = DocumentData> extends Query<T> {
452452
validateNonEmptyArgument('CollectionReference.doc', 'path', path);
453453
const absolutePath = this._path.child(ResourcePath.fromString(path!));
454454
validateDocumentPath(absolutePath);
455-
return new DocumentReference(this.firestore, this.converter, absolutePath);
455+
return new DocumentReference(this.firestore, this._converter, absolutePath);
456456
}
457457

458458
withConverter<U>(
@@ -578,7 +578,7 @@ export function doc<T>(
578578
validateDocumentPath(absolutePath);
579579
return new DocumentReference(
580580
parent.firestore,
581-
parent instanceof CollectionReference ? parent.converter : null,
581+
parent instanceof CollectionReference ? parent._converter : null,
582582
absolutePath
583583
);
584584
}
@@ -613,7 +613,7 @@ export function getDocs<T>(query: Query<T>): Promise<QuerySnapshot<T>> {
613613
query.firestore,
614614
doc.key,
615615
doc,
616-
query.converter
616+
query._converter
617617
)
618618
);
619619

@@ -724,7 +724,10 @@ export function addDoc<T>(
724724
): Promise<DocumentReference<T>> {
725725
const docRef = doc(reference);
726726

727-
const convertedValue = applyFirestoreDataConverter(reference.converter, data);
727+
const convertedValue = applyFirestoreDataConverter(
728+
reference._converter,
729+
data
730+
);
728731

729732
const dataReader = newUserDataReader(reference.firestore);
730733
const parsed = parseSetData(
@@ -755,7 +758,7 @@ export function refEqual<T>(
755758
return (
756759
left.firestore === right.firestore &&
757760
left.path === right.path &&
758-
left.converter === right.converter
761+
left._converter === right._converter
759762
);
760763
}
761764
return false;
@@ -766,7 +769,7 @@ export function queryEqual<T>(left: Query<T>, right: Query<T>): boolean {
766769
return (
767770
left.firestore === right.firestore &&
768771
queryEquals(left._query, right._query) &&
769-
left.converter === right.converter
772+
left._converter === right._converter
770773
);
771774
}
772775
return false;

0 commit comments

Comments
 (0)