Skip to content

Commit f9e8aa2

Browse files
WIP
1 parent b07f822 commit f9e8aa2

25 files changed

+7072
-2780
lines changed

packages/firestore/exp/index.d.ts

Lines changed: 41 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -273,28 +273,50 @@ export type WhereFilterOp =
273273
export class Query<T = DocumentData> {
274274
protected constructor();
275275
readonly firestore: FirebaseFirestore;
276-
where(
277-
fieldPath: string | FieldPath,
278-
opStr: WhereFilterOp,
279-
value: any
280-
): Query<T>;
281-
orderBy(
282-
fieldPath: string | FieldPath,
283-
directionStr?: OrderByDirection
284-
): Query<T>;
285-
limit(limit: number): Query<T>;
286-
limitToLast(limit: number): Query<T>;
287-
startAt(snapshot: DocumentSnapshot<any>): Query<T>;
288-
startAt(...fieldValues: any[]): Query<T>;
289-
startAfter(snapshot: DocumentSnapshot<any>): Query<T>;
290-
startAfter(...fieldValues: any[]): Query<T>;
291-
endBefore(snapshot: DocumentSnapshot<any>): Query<T>;
292-
endBefore(...fieldValues: any[]): Query<T>;
293-
endAt(snapshot: DocumentSnapshot<any>): Query<T>;
294-
endAt(...fieldValues: any[]): Query<T>;
276+
295277
withConverter<U>(converter: FirestoreDataConverter<U>): Query<U>;
296278
}
297279

280+
export type QueryConstraintType =
281+
| 'where'
282+
| 'orderBy'
283+
| 'limit'
284+
| 'limitToLast'
285+
| 'startAt'
286+
| 'startAfter'
287+
| 'endAt'
288+
| 'endBefore';
289+
290+
export class QueryConstraint {
291+
private constructor();
292+
readonly type: QueryConstraintType;
293+
}
294+
295+
export function query<T>(
296+
query: CollectionReference<T> | Query<T>,
297+
...constraints: QueryConstraint[]
298+
): Query<T>;
299+
300+
export function where(
301+
fieldPath: string | FieldPath,
302+
opStr: WhereFilterOp,
303+
value: any
304+
): QueryConstraint;
305+
export function orderBy(
306+
fieldPath: string | FieldPath,
307+
directionStr?: OrderByDirection
308+
): QueryConstraint;
309+
export function limit(limit: number): QueryConstraint;
310+
export function limitToLast(limit: number): QueryConstraint;
311+
export function startAt(snapshot: DocumentSnapshot<any>): QueryConstraint;
312+
export function startAt(...fieldValues: any[]): QueryConstraint;
313+
export function startAfter(snapshot: DocumentSnapshot<any>): QueryConstraint;
314+
export function startAfter(...fieldValues: any[]): QueryConstraint;
315+
export function endBefore(snapshot: DocumentSnapshot<any>): QueryConstraint;
316+
export function endBefore(...fieldValues: any[]): QueryConstraint;
317+
export function endAt(snapshot: DocumentSnapshot<any>): QueryConstraint;
318+
export function endAt(...fieldValues: any[]): QueryConstraint;
319+
298320
export class QuerySnapshot<T = DocumentData> {
299321
private constructor();
300322
readonly query: Query<T>;

packages/firestore/exp/index.node.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,21 @@ export { SnapshotMetadata } from '../src/api/database';
4747
export {
4848
DocumentReference,
4949
CollectionReference,
50+
QueryConstraint,
5051
Query,
5152
doc,
5253
collection,
5354
collectionGroup,
54-
parent
55+
parent,
56+
startAt,
57+
startAfter,
58+
endAt,
59+
endBefore,
60+
query,
61+
limit,
62+
limitToLast,
63+
where,
64+
orderBy
5565
} from '../lite/src/api/reference';
5666

5767
export { runTransaction, Transaction } from './src/api/transaction';

0 commit comments

Comments
 (0)