@@ -19,11 +19,15 @@ export type AddPrefixToKeys<Prefix extends string, T extends Record<string, unkn
1919
2020// @public
2121export class AggregateField <T > {
22+ readonly aggregateType: AggregateType ;
2223 readonly type = " AggregateField" ;
2324}
2425
2526// @public
26- export type AggregateFieldType = AggregateField <number | null >;
27+ export function aggregateFieldEqual(left : AggregateField <unknown >, right : AggregateField <unknown >): boolean ;
28+
29+ // @public
30+ export type AggregateFieldType = ReturnType <typeof sum > | ReturnType <typeof average > | ReturnType <typeof count >;
2731
2832// @public
2933export class AggregateQuerySnapshot <AggregateSpecType extends AggregateSpec , AppModelType = DocumentData , DbModelType extends DocumentData = DocumentData > {
@@ -46,6 +50,9 @@ export type AggregateSpecData<T extends AggregateSpec> = {
4650 [P in keyof T ]: T [P ] extends AggregateField <infer U > ? U : never ;
4751};
4852
53+ // @public
54+ export type AggregateType = ' count' | ' avg' | ' sum' ;
55+
4956// @public
5057export function and(... queryConstraints : QueryFilterConstraint []): QueryCompositeFilterConstraint ;
5158
@@ -55,6 +62,9 @@ export function arrayRemove(...elements: unknown[]): FieldValue;
5562// @public
5663export function arrayUnion(... elements : unknown []): FieldValue ;
5764
65+ // @public
66+ export function average(field : string | FieldPath ): AggregateField <number | null >;
67+
5868// @public
5969export class Bytes {
6070 static fromBase64String(base64 : string ): Bytes ;
@@ -95,6 +105,9 @@ export function connectFirestoreEmulator(firestore: Firestore, host: string, por
95105 mockUserToken? : EmulatorMockTokenOptions | string ;
96106}): void ;
97107
108+ // @public
109+ export function count(): AggregateField <number >;
110+
98111// @public
99112export function deleteDoc<AppModelType , DbModelType extends DocumentData >(reference : DocumentReference <AppModelType , DbModelType >): Promise <void >;
100113
@@ -201,6 +214,9 @@ export class GeoPoint {
201214 };
202215}
203216
217+ // @public
218+ export function getAggregate<AggregateSpecType extends AggregateSpec , AppModelType , DbModelType extends DocumentData >(query : Query <AppModelType , DbModelType >, aggregateSpec : AggregateSpecType ): Promise <AggregateQuerySnapshot <AggregateSpecType , AppModelType , DbModelType >>;
219+
204220// @public
205221export function getCount<AppModelType , DbModelType extends DocumentData >(query : Query <AppModelType , DbModelType >): Promise <AggregateQuerySnapshot <{
206222 count: AggregateField <number >;
@@ -388,6 +404,9 @@ export function startAt<AppModelType, DbModelType extends DocumentData>(snapshot
388404// @public
389405export function startAt(... fieldValues : unknown []): QueryStartAtConstraint ;
390406
407+ // @public
408+ export function sum(field : string | FieldPath ): AggregateField <number >;
409+
391410// @public
392411export function terminate(firestore : Firestore ): Promise <void >;
393412
0 commit comments