Skip to content

Commit 1c8c909

Browse files
committed
Rename AggregateWithAlias to AliasedAggregate
1 parent c008c06 commit 1c8c909

File tree

6 files changed

+23
-25
lines changed

6 files changed

+23
-25
lines changed

packages/firestore/lite/pipelines/pipelines.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ export {
166166
FunctionExpression,
167167
Ordering,
168168
ExpressionType,
169-
AggregateWithAlias,
169+
AliasedAggregate,
170170
Selectable,
171171
BooleanExpression,
172172
AggregateFunction

packages/firestore/src/api_pipelines.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export {
180180

181181
export type {
182182
ExpressionType,
183-
AggregateWithAlias,
183+
AliasedAggregate,
184184
Selectable
185185
} from './lite-api/expressions';
186186

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2260,11 +2260,11 @@ export class AggregateFunction implements ProtoValueSerializable, UserData {
22602260
* ```
22612261
*
22622262
* @param name The alias to assign to this AggregateFunction.
2263-
* @return A new {@link AggregateWithAlias} that wraps this
2263+
* @return A new {@link AliasedAggregate} that wraps this
22642264
* AggregateFunction and associates it with the provided alias.
22652265
*/
2266-
as(name: string): AggregateWithAlias {
2267-
return new AggregateWithAlias(this, name, 'as');
2266+
as(name: string): AliasedAggregate {
2267+
return new AliasedAggregate(this, name, 'as');
22682268
}
22692269

22702270
/**
@@ -2301,7 +2301,7 @@ export class AggregateFunction implements ProtoValueSerializable, UserData {
23012301
*
23022302
* An AggregateFunction with alias.
23032303
*/
2304-
export class AggregateWithAlias implements UserData {
2304+
export class AliasedAggregate implements UserData {
23052305
constructor(
23062306
readonly aggregate: AggregateFunction,
23072307
readonly alias: string,
@@ -7702,8 +7702,8 @@ export function isOrdering(val: unknown): val is Ordering {
77027702
);
77037703
}
77047704

7705-
export function isAliasedAggregate(val: unknown): val is AggregateWithAlias {
7706-
const candidate = val as AggregateWithAlias;
7705+
export function isAliasedAggregate(val: unknown): val is AliasedAggregate {
7706+
const candidate = val as AliasedAggregate;
77077707
return (
77087708
isString(candidate.alias) &&
77097709
candidate.aggregate instanceof AggregateFunction

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { Firestore } from './database';
3333
import {
3434
_mapValue,
3535
AggregateFunction,
36-
AggregateWithAlias,
36+
AliasedAggregate,
3737
BooleanExpression,
3838
_constant,
3939
Expression,
@@ -735,7 +735,7 @@ export class Pipeline implements ProtoSerializable<ProtoPipeline> {
735735
* Performs aggregation operations on the documents from previous stages.
736736
*
737737
* <p>This stage allows you to calculate aggregate values over a set of documents. You define the
738-
* aggregations to perform using {@link AggregateWithAlias} expressions which are typically results of
738+
* aggregations to perform using {@link AliasedAggregate} expressions which are typically results of
739739
* calling {@link Expression#as} on {@link AggregateFunction} instances.
740740
*
741741
* <p>Example:
@@ -749,15 +749,15 @@ export class Pipeline implements ProtoSerializable<ProtoPipeline> {
749749
* );
750750
* ```
751751
*
752-
* @param accumulator The first {@link AggregateWithAlias}, wrapping an {@link AggregateFunction}
752+
* @param accumulator The first {@link AliasedAggregate}, wrapping an {@link AggregateFunction}
753753
* and providing a name for the accumulated results.
754-
* @param additionalAccumulators Optional additional {@link AggregateWithAlias}, each wrapping an {@link AggregateFunction}
754+
* @param additionalAccumulators Optional additional {@link AliasedAggregate}, each wrapping an {@link AggregateFunction}
755755
* and providing a name for the accumulated results.
756756
* @return A new Pipeline object with this stage appended to the stage list.
757757
*/
758758
aggregate(
759-
accumulator: AggregateWithAlias,
760-
...additionalAccumulators: AggregateWithAlias[]
759+
accumulator: AliasedAggregate,
760+
...additionalAccumulators: AliasedAggregate[]
761761
): Pipeline;
762762
/**
763763
* Performs optionally grouped aggregation operations on the documents from previous stages.
@@ -771,7 +771,7 @@ export class Pipeline implements ProtoSerializable<ProtoPipeline> {
771771
* If no grouping fields are provided, a single group containing all documents is used. Not
772772
* specifying groups is the same as putting the entire inputs into one group.</li>
773773
* <li>**Accumulators:** One or more accumulation operations to perform within each group. These
774-
* are defined using {@link AggregateWithAlias} expressions, which are typically created by
774+
* are defined using {@link AliasedAggregate} expressions, which are typically created by
775775
* calling {@link Expression#as} on {@link AggregateFunction} instances. Each aggregation
776776
* calculates a value (e.g., sum, average, count) based on the documents within its group.</li>
777777
* </ul>
@@ -793,14 +793,12 @@ export class Pipeline implements ProtoSerializable<ProtoPipeline> {
793793
*/
794794
aggregate(options: AggregateStageOptions): Pipeline;
795795
aggregate(
796-
targetOrOptions: AggregateWithAlias | AggregateStageOptions,
797-
...rest: AggregateWithAlias[]
796+
targetOrOptions: AliasedAggregate | AggregateStageOptions,
797+
...rest: AliasedAggregate[]
798798
): Pipeline {
799799
// Process argument union(s) from method overloads
800800
const options = isAliasedAggregate(targetOrOptions) ? {} : targetOrOptions;
801-
const accumulators: AggregateWithAlias[] = isAliasedAggregate(
802-
targetOrOptions
803-
)
801+
const accumulators: AliasedAggregate[] = isAliasedAggregate(targetOrOptions)
804802
? [targetOrOptions, ...rest]
805803
: targetOrOptions.accumulators;
806804
const groups: Array<Selectable | string> = isAliasedAggregate(

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { OneOf } from '../util/types';
22

33
import {
4-
AggregateWithAlias,
4+
AliasedAggregate,
55
BooleanExpression,
66
Expression,
77
Field,
@@ -168,7 +168,7 @@ export type AggregateStageOptions = StageOptions & {
168168
* The {@link AliasedAggregate} values specifying aggregate operations to
169169
* perform on the input documents.
170170
*/
171-
accumulators: AggregateWithAlias[];
171+
accumulators: AliasedAggregate[];
172172
/**
173173
* The {@link Selectable} expressions or field names to consider when determining
174174
* distinct value combinations (groups), which will be aggregated over.

packages/firestore/src/util/pipeline_util.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { vector } from '../api';
22
import {
33
_constant,
44
AggregateFunction,
5-
AggregateWithAlias,
5+
AliasedAggregate,
66
array,
77
constant,
88
Expression,
@@ -35,10 +35,10 @@ export function selectablesToMap(
3535
}
3636

3737
export function aliasedAggregateToMap(
38-
aliasedAggregatees: AggregateWithAlias[]
38+
aliasedAggregatees: AliasedAggregate[]
3939
): Map<string, AggregateFunction> {
4040
return aliasedAggregatees.reduce(
41-
(map: Map<string, AggregateFunction>, selectable: AggregateWithAlias) => {
41+
(map: Map<string, AggregateFunction>, selectable: AliasedAggregate) => {
4242
map.set(selectable.alias, selectable.aggregate as AggregateFunction);
4343
return map;
4444
},

0 commit comments

Comments
 (0)