Skip to content

Commit 84524fd

Browse files
Remove makeConstructorPrivate
1 parent 8e0c036 commit 84524fd

File tree

4 files changed

+16
-179
lines changed

4 files changed

+16
-179
lines changed

packages/firestore/src/api/field_value.ts

+4
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ export class NumericIncrementFieldValueImpl extends SerializableFieldValue {
210210
/** The public FieldValue class of the lite API. */
211211
export abstract class FieldValue extends SerializableFieldValue
212212
implements firestore.FieldValue {
213+
protected constructor() {
214+
super();
215+
}
216+
213217
static delete(): firestore.FieldValue {
214218
validateNoArgs('FieldValue.delete', arguments);
215219
return new FieldValueDelegate(

packages/firestore/src/config.ts

+12-50
Original file line numberDiff line numberDiff line change
@@ -21,75 +21,37 @@ import { _FirebaseNamespace } from '@firebase/app-types/private';
2121
import { Component, ComponentType, Provider } from '@firebase/component';
2222
import {
2323
CACHE_SIZE_UNLIMITED,
24-
Firestore,
24+
CollectionReference,
2525
DocumentReference,
2626
DocumentSnapshot,
27-
QueryDocumentSnapshot,
27+
Firestore,
2828
Query,
29+
QueryDocumentSnapshot,
2930
QuerySnapshot,
30-
CollectionReference,
3131
Transaction,
3232
WriteBatch
3333
} from './api/database';
3434
import { Blob } from './api/blob';
3535
import { FieldPath } from './api/field_path';
3636
import { GeoPoint } from './api/geo_point';
3737
import { Timestamp } from './api/timestamp';
38-
import { makeConstructorPrivate } from './util/api';
3938
import { FieldValue } from './api/field_value';
4039

41-
// Public instance that disallows construction at runtime. Note that this still
42-
// allows instanceof checks.
43-
export const PublicFirestore = makeConstructorPrivate(
40+
const firestoreNamespace = {
4441
Firestore,
45-
'Use firebase.firestore() instead.'
46-
);
47-
export const PublicTransaction = makeConstructorPrivate(
42+
GeoPoint,
43+
Timestamp,
44+
Blob,
4845
Transaction,
49-
'Use firebase.firestore().runTransaction() instead.'
50-
);
51-
export const PublicWriteBatch = makeConstructorPrivate(
5246
WriteBatch,
53-
'Use firebase.firestore().batch() instead.'
54-
);
55-
export const PublicDocumentReference = makeConstructorPrivate(
5647
DocumentReference,
57-
'Use firebase.firestore().doc() instead.'
58-
);
59-
export const PublicDocumentSnapshot = makeConstructorPrivate(DocumentSnapshot);
60-
export const PublicQueryDocumentSnapshot = makeConstructorPrivate(
61-
QueryDocumentSnapshot
62-
);
63-
export const PublicQuery = makeConstructorPrivate(Query);
64-
export const PublicQuerySnapshot = makeConstructorPrivate(QuerySnapshot);
65-
export const PublicCollectionReference = makeConstructorPrivate(
48+
DocumentSnapshot,
49+
Query,
50+
QueryDocumentSnapshot,
51+
QuerySnapshot,
6652
CollectionReference,
67-
'Use firebase.firestore().collection() instead.'
68-
);
69-
export const PublicFieldValue = makeConstructorPrivate(
70-
FieldValue,
71-
'Use FieldValue.<field>() instead.'
72-
);
73-
export const PublicBlob = makeConstructorPrivate(
74-
Blob,
75-
'Use Blob.fromUint8Array() or Blob.fromBase64String() instead.'
76-
);
77-
78-
const firestoreNamespace = {
79-
Firestore: PublicFirestore,
80-
GeoPoint,
81-
Timestamp,
82-
Blob: PublicBlob,
83-
Transaction: PublicTransaction,
84-
WriteBatch: PublicWriteBatch,
85-
DocumentReference: PublicDocumentReference,
86-
DocumentSnapshot: PublicDocumentSnapshot,
87-
Query: PublicQuery,
88-
QueryDocumentSnapshot: PublicQueryDocumentSnapshot,
89-
QuerySnapshot: PublicQuerySnapshot,
90-
CollectionReference: PublicCollectionReference,
9153
FieldPath,
92-
FieldValue: PublicFieldValue,
54+
FieldValue,
9355
setLogLevel: Firestore.setLogLevel,
9456
CACHE_SIZE_UNLIMITED
9557
};

packages/firestore/src/util/api.ts

-57
This file was deleted.

packages/firestore/test/unit/util/api.test.ts

-72
This file was deleted.

0 commit comments

Comments
 (0)