Skip to content

Commit e4cdd2e

Browse files
committed
fixed private constructor on aggregatefunction
1 parent f9c4cde commit e4cdd2e

File tree

3 files changed

+49
-47
lines changed

3 files changed

+49
-47
lines changed

common/api-review/firestore-lite-pipelines.api.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,18 +1344,18 @@ export function xor(first: BooleanExpression, second: BooleanExpression, ...addi
13441344
// Warnings were encountered during analysis:
13451345
//
13461346
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/pipelines.d.ts:71:5 - (ae-incompatible-release-tags) The symbol "fields" is marked as @public, but its signature references "Selectable" which is marked as @beta
1347-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/pipelines.d.ts:109:5 - (ae-incompatible-release-tags) The symbol "accumulators" is marked as @public, but its signature references "AliasedAggregate" which is marked as @beta
1348-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/pipelines.d.ts:114:5 - (ae-incompatible-release-tags) The symbol "groups" is marked as @public, but its signature references "Selectable" which is marked as @beta
1349-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/pipelines.d.ts:771:5 - (ae-forgotten-export) The symbol "Query" needs to be exported by the entry point pipelines.d.ts
1350-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/pipelines.d.ts:1089:5 - (ae-incompatible-release-tags) The symbol "groups" is marked as @public, but its signature references "Selectable" which is marked as @beta
1351-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/pipelines.d.ts:3253:5 - (ae-incompatible-release-tags) The symbol "field" is marked as @public, but its signature references "Field" which is marked as @beta
1352-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/pipelines.d.ts:5773:5 - (ae-incompatible-release-tags) The symbol "fields" is marked as @public, but its signature references "Field" which is marked as @beta
1353-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/pipelines.d.ts:5783:5 - (ae-incompatible-release-tags) The symbol "map" is marked as @public, but its signature references "Expression" which is marked as @beta
1354-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/pipelines.d.ts:5907:5 - (ae-incompatible-release-tags) The symbol "selections" is marked as @public, but its signature references "Selectable" which is marked as @beta
1355-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/pipelines.d.ts:5917:5 - (ae-incompatible-release-tags) The symbol "orderings" is marked as @public, but its signature references "Ordering" which is marked as @beta
1356-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/pipelines.d.ts:6714:5 - (ae-incompatible-release-tags) The symbol "other" is marked as @public, but its signature references "Pipeline" which is marked as @beta
1357-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/pipelines.d.ts:6814:5 - (ae-incompatible-release-tags) The symbol "selectable" is marked as @public, but its signature references "Selectable" which is marked as @beta
1358-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/pipelines.d.ts:6856:5 - (ae-incompatible-release-tags) The symbol "condition" is marked as @public, but its signature references "BooleanExpression" which is marked as @beta
1347+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/pipelines.d.ts:110:5 - (ae-incompatible-release-tags) The symbol "accumulators" is marked as @public, but its signature references "AliasedAggregate" which is marked as @beta
1348+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/pipelines.d.ts:115:5 - (ae-incompatible-release-tags) The symbol "groups" is marked as @public, but its signature references "Selectable" which is marked as @beta
1349+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/pipelines.d.ts:772:5 - (ae-forgotten-export) The symbol "Query" needs to be exported by the entry point pipelines.d.ts
1350+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/pipelines.d.ts:1090:5 - (ae-incompatible-release-tags) The symbol "groups" is marked as @public, but its signature references "Selectable" which is marked as @beta
1351+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/pipelines.d.ts:3254:5 - (ae-incompatible-release-tags) The symbol "field" is marked as @public, but its signature references "Field" which is marked as @beta
1352+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/pipelines.d.ts:5774:5 - (ae-incompatible-release-tags) The symbol "fields" is marked as @public, but its signature references "Field" which is marked as @beta
1353+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/pipelines.d.ts:5784:5 - (ae-incompatible-release-tags) The symbol "map" is marked as @public, but its signature references "Expression" which is marked as @beta
1354+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/pipelines.d.ts:5908:5 - (ae-incompatible-release-tags) The symbol "selections" is marked as @public, but its signature references "Selectable" which is marked as @beta
1355+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/pipelines.d.ts:5918:5 - (ae-incompatible-release-tags) The symbol "orderings" is marked as @public, but its signature references "Ordering" which is marked as @beta
1356+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/pipelines.d.ts:6715:5 - (ae-incompatible-release-tags) The symbol "other" is marked as @public, but its signature references "Pipeline" which is marked as @beta
1357+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/pipelines.d.ts:6815:5 - (ae-incompatible-release-tags) The symbol "selectable" is marked as @public, but its signature references "Selectable" which is marked as @beta
1358+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/pipelines.d.ts:6857:5 - (ae-incompatible-release-tags) The symbol "condition" is marked as @public, but its signature references "BooleanExpression" which is marked as @beta
13591359

13601360
// (No @packageDocumentation comment for this package)
13611361

common/api-review/firestore-pipelines.api.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,18 +1383,18 @@ export function xor(first: BooleanExpression, second: BooleanExpression, ...addi
13831383
// Warnings were encountered during analysis:
13841384
//
13851385
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/pipelines.d.ts:68:5 - (ae-incompatible-release-tags) The symbol "fields" is marked as @public, but its signature references "Selectable" which is marked as @beta
1386-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/pipelines.d.ts:106:5 - (ae-incompatible-release-tags) The symbol "accumulators" is marked as @public, but its signature references "AliasedAggregate" which is marked as @beta
1387-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/pipelines.d.ts:111:5 - (ae-incompatible-release-tags) The symbol "groups" is marked as @public, but its signature references "Selectable" which is marked as @beta
1388-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/pipelines.d.ts:768:5 - (ae-forgotten-export) The symbol "Query" needs to be exported by the entry point pipelines.d.ts
1389-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/pipelines.d.ts:1085:5 - (ae-incompatible-release-tags) The symbol "groups" is marked as @public, but its signature references "Selectable" which is marked as @beta
1390-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/pipelines.d.ts:3250:5 - (ae-incompatible-release-tags) The symbol "field" is marked as @public, but its signature references "Field" which is marked as @beta
1391-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/pipelines.d.ts:4565:59 - (ae-incompatible-release-tags) The symbol "__index" is marked as @public, but its signature references "Expression" which is marked as @beta
1392-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/pipelines.d.ts:5011:5 - (ae-incompatible-release-tags) The symbol "fields" is marked as @public, but its signature references "Field" which is marked as @beta
1393-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/pipelines.d.ts:5021:5 - (ae-incompatible-release-tags) The symbol "map" is marked as @public, but its signature references "Expression" which is marked as @beta
1394-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/pipelines.d.ts:5145:5 - (ae-incompatible-release-tags) The symbol "selections" is marked as @public, but its signature references "Selectable" which is marked as @beta
1395-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/pipelines.d.ts:5155:5 - (ae-incompatible-release-tags) The symbol "orderings" is marked as @public, but its signature references "Ordering" which is marked as @beta
1396-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/pipelines.d.ts:6052:5 - (ae-incompatible-release-tags) The symbol "selectable" is marked as @public, but its signature references "Selectable" which is marked as @beta
1397-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/pipelines.d.ts:6094:5 - (ae-incompatible-release-tags) The symbol "condition" is marked as @public, but its signature references "BooleanExpression" which is marked as @beta
1386+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/pipelines.d.ts:107:5 - (ae-incompatible-release-tags) The symbol "accumulators" is marked as @public, but its signature references "AliasedAggregate" which is marked as @beta
1387+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/pipelines.d.ts:112:5 - (ae-incompatible-release-tags) The symbol "groups" is marked as @public, but its signature references "Selectable" which is marked as @beta
1388+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/pipelines.d.ts:769:5 - (ae-forgotten-export) The symbol "Query" needs to be exported by the entry point pipelines.d.ts
1389+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/pipelines.d.ts:1086:5 - (ae-incompatible-release-tags) The symbol "groups" is marked as @public, but its signature references "Selectable" which is marked as @beta
1390+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/pipelines.d.ts:3251:5 - (ae-incompatible-release-tags) The symbol "field" is marked as @public, but its signature references "Field" which is marked as @beta
1391+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/pipelines.d.ts:4566:59 - (ae-incompatible-release-tags) The symbol "__index" is marked as @public, but its signature references "Expression" which is marked as @beta
1392+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/pipelines.d.ts:5012:5 - (ae-incompatible-release-tags) The symbol "fields" is marked as @public, but its signature references "Field" which is marked as @beta
1393+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/pipelines.d.ts:5022:5 - (ae-incompatible-release-tags) The symbol "map" is marked as @public, but its signature references "Expression" which is marked as @beta
1394+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/pipelines.d.ts:5146:5 - (ae-incompatible-release-tags) The symbol "selections" is marked as @public, but its signature references "Selectable" which is marked as @beta
1395+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/pipelines.d.ts:5156:5 - (ae-incompatible-release-tags) The symbol "orderings" is marked as @public, but its signature references "Ordering" which is marked as @beta
1396+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/pipelines.d.ts:6053:5 - (ae-incompatible-release-tags) The symbol "selectable" is marked as @public, but its signature references "Selectable" which is marked as @beta
1397+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/pipelines.d.ts:6095:5 - (ae-incompatible-release-tags) The symbol "condition" is marked as @public, but its signature references "BooleanExpression" which is marked as @beta
13981398

13991399
// (No @packageDocumentation comment for this package)
14001400

packages/firestore/src/lite-api/expressions.ts

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,7 @@ export abstract class Expression implements ProtoValueSerializable, UserData {
12211221
* @return A new `AggregateFunction` representing the 'count' aggregation.
12221222
*/
12231223
count(): AggregateFunction {
1224-
return new AggregateFunction('count', [this], 'count');
1224+
return AggregateFunction._create('count', [this], 'count');
12251225
}
12261226

12271227
/**
@@ -1236,7 +1236,7 @@ export abstract class Expression implements ProtoValueSerializable, UserData {
12361236
* @return A new `AggregateFunction` representing the 'sum' aggregation.
12371237
*/
12381238
sum(): AggregateFunction {
1239-
return new AggregateFunction('sum', [this], 'sum');
1239+
return AggregateFunction._create('sum', [this], 'sum');
12401240
}
12411241

12421242
/**
@@ -1252,7 +1252,7 @@ export abstract class Expression implements ProtoValueSerializable, UserData {
12521252
* @return A new `AggregateFunction` representing the 'average' aggregation.
12531253
*/
12541254
average(): AggregateFunction {
1255-
return new AggregateFunction('average', [this], 'average');
1255+
return AggregateFunction._create('average', [this], 'average');
12561256
}
12571257

12581258
/**
@@ -1267,7 +1267,7 @@ export abstract class Expression implements ProtoValueSerializable, UserData {
12671267
* @return A new `AggregateFunction` representing the 'minimum' aggregation.
12681268
*/
12691269
minimum(): AggregateFunction {
1270-
return new AggregateFunction('minimum', [this], 'minimum');
1270+
return AggregateFunction._create('minimum', [this], 'minimum');
12711271
}
12721272

12731273
/**
@@ -1282,7 +1282,7 @@ export abstract class Expression implements ProtoValueSerializable, UserData {
12821282
* @return A new `AggregateFunction` representing the 'maximum' aggregation.
12831283
*/
12841284
maximum(): AggregateFunction {
1285-
return new AggregateFunction('maximum', [this], 'maximum');
1285+
return AggregateFunction._create('maximum', [this], 'maximum');
12861286
}
12871287

12881288
/**
@@ -1297,7 +1297,7 @@ export abstract class Expression implements ProtoValueSerializable, UserData {
12971297
* @return A new `AggregateFunction` representing the 'count_distinct' aggregation.
12981298
*/
12991299
countDistinct(): AggregateFunction {
1300-
return new AggregateFunction('count_distinct', [this], 'countDistinct');
1300+
return AggregateFunction._create('count_distinct', [this], 'countDistinct');
13011301
}
13021302

13031303
/**
@@ -2405,25 +2405,27 @@ export interface Selectable {
24052405
export class AggregateFunction implements ProtoValueSerializable, UserData {
24062406
exprType: ExpressionType = 'AggregateFunction';
24072407

2408-
constructor(name: string, params: Expression[]);
24092408
/**
2410-
* @beta
2411-
* INTERNAL Constructor with method name for validation.
2412-
* @hideconstructor
2413-
* @param name
2414-
* @param params
2415-
* @param _methodName
2409+
* @internal
24162410
*/
2417-
constructor(
2411+
_methodName?: string;
2412+
2413+
constructor(private name: string, private params: Expression[]) {}
2414+
2415+
/**
2416+
* @internal
2417+
* @private
2418+
*/
2419+
static _create(
24182420
name: string,
24192421
params: Expression[],
2420-
_methodName: string | undefined
2421-
);
2422-
constructor(
2423-
private name: string,
2424-
private params: Expression[],
2425-
readonly _methodName?: string
2426-
) {}
2422+
methodName: string
2423+
): AggregateFunction {
2424+
const af = new AggregateFunction(name, params);
2425+
af._methodName = methodName;
2426+
2427+
return af;
2428+
}
24272429

24282430
/**
24292431
* @beta
@@ -2948,7 +2950,7 @@ export class BooleanExpression extends FunctionExpression {
29482950
* @return A new `AggregateFunction` representing the 'countIf' aggregation.
29492951
*/
29502952
countIf(): AggregateFunction {
2951-
return new AggregateFunction('count_if', [this], 'countIf');
2953+
return AggregateFunction._create('count_if', [this], 'countIf');
29522954
}
29532955

29542956
/**
@@ -6114,7 +6116,7 @@ export function mapGet(
61146116
* @return A new {@code AggregateFunction} representing the 'countAll' aggregation.
61156117
*/
61166118
export function countAll(): AggregateFunction {
6117-
return new AggregateFunction('count', [], 'count');
6119+
return AggregateFunction._create('count', [], 'count');
61186120
}
61196121

61206122
/**

0 commit comments

Comments
 (0)