Skip to content

Commit 6a2abf3

Browse files
committed
And/or overloads
1 parent 8eb9082 commit 6a2abf3

File tree

8 files changed

+256
-36
lines changed

8 files changed

+256
-36
lines changed

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

Lines changed: 45 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,15 @@ export class And extends FirestoreFunction implements FilterCondition {
100100
filterable: true;
101101
}
102102

103+
// @beta
104+
export function and(left: FilterExpr, ...right: FilterExpr[]): And;
105+
103106
// @public
104107
export function and(...queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint;
105108

106-
// @beta
107-
export function andExpression(left: FilterExpr, ...right: FilterExpr[]): And;
109+
// @public (undocumented)
110+
export namespace and {
111+
}
108112

109113
// @beta (undocumented)
110114
export class ArrayConcat extends FirestoreFunction {
@@ -218,10 +222,10 @@ export class Avg extends FirestoreFunction implements Accumulator {
218222
}
219223

220224
// @beta
221-
export function avg(value: Constant): Avg;
225+
export function avgFunction(value: Constant): Avg;
222226

223227
// @beta
224-
export function avg(value: string): Avg;
228+
export function avgFunction(value: string): Avg;
225229

226230
// @beta (undocumented)
227231
export class ByteLength extends FirestoreFunction {
@@ -450,14 +454,6 @@ export function count(): AggregateField<number>;
450454
// @beta
451455
export function countAll(): Count;
452456

453-
// @beta
454-
export function countExpression(value: Constant): Count;
455-
456-
// Warning: (ae-incompatible-release-tags) The symbol "countExpression" is marked as @public, but its signature references "Count" which is marked as @beta
457-
//
458-
// @public
459-
export function countExpression(value: string): Count;
460-
461457
// @beta (undocumented)
462458
export class DatabaseSource implements Stage {
463459
// (undocumented)
@@ -1531,9 +1527,16 @@ export class Or extends FirestoreFunction implements FilterCondition {
15311527
filterable: true;
15321528
}
15331529

1530+
// @beta
1531+
export function or(left: FilterExpr, ...right: FilterExpr[]): Or;
1532+
15341533
// @public
15351534
export function or(...queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint;
15361535

1536+
// @public (undocumented)
1537+
export namespace or {
1538+
}
1539+
15371540
// @public
15381541
export function orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection): QueryOrderByConstraint;
15391542

@@ -1545,43 +1548,65 @@ export class Ordering {
15451548
constructor(expr: Constant, direction: 'ascending' | 'descending');
15461549
}
15471550

1548-
// @beta
1549-
export function orExpression(left: FilterExpr, ...right: FilterExpr[]): Or;
1550-
15511551
// @public
15521552
export type PartialWithFieldValue<T> = Partial<T> | (T extends Primitive ? T : T extends {} ? {
15531553
[K in keyof T]?: PartialWithFieldValue<T[K]> | FieldValue;
15541554
} : never);
15551555

15561556
// @public
15571557
export class Pipeline<AppModelType = DocumentData> {
1558+
/* Excluded from this release type: _db */
15581559
// Warning: (ae-incompatible-release-tags) The symbol "addFields" is marked as @public, but its signature references "Selectable" which is marked as @beta
15591560
addFields(...fields: Selectable[]): Pipeline<AppModelType>;
1561+
/* Excluded from this release type: userDataWriter */
1562+
/* Excluded from this release type: documentReferenceFactory */
15601563
// Warning: (ae-incompatible-release-tags) The symbol "aggregate" is marked as @public, but its signature references "AccumulatorTarget" which is marked as @beta
15611564
aggregate(...accumulators: AccumulatorTarget[]): Pipeline<AppModelType>;
1565+
/* Excluded from this release type: userDataWriter */
1566+
/* Excluded from this release type: documentReferenceFactory */
15621567
aggregate(options: {
15631568
accumulators: AccumulatorTarget[];
15641569
groups?: Array<string | Selectable>;
15651570
}): Pipeline<AppModelType>;
1571+
/* Excluded from this release type: userDataWriter */
1572+
/* Excluded from this release type: documentReferenceFactory */
15661573
// Warning: (ae-incompatible-release-tags) The symbol "distinct" is marked as @public, but its signature references "Selectable" which is marked as @beta
15671574
distinct(...groups: Array<string | Selectable>): Pipeline<AppModelType>;
1575+
/* Excluded from this release type: userDataWriter */
1576+
/* Excluded from this release type: documentReferenceFactory */
15681577
// Warning: (ae-incompatible-release-tags) The symbol "execute" is marked as @public, but its signature references "PipelineResult" which is marked as @beta
15691578
execute(): Promise<Array<PipelineResult<AppModelType>>>;
1579+
/* Excluded from this release type: userDataWriter */
1580+
/* Excluded from this release type: documentReferenceFactory */
15701581
// Warning: (ae-incompatible-release-tags) The symbol "findNearest" is marked as @public, but its signature references "FindNearestOptions" which is marked as @beta
15711582
//
15721583
// (undocumented)
15731584
findNearest(options: FindNearestOptions): Pipeline<AppModelType>;
1585+
/* Excluded from this release type: userDataWriter */
1586+
/* Excluded from this release type: documentReferenceFactory */
15741587
genericStage(name: string, params: any[]): Pipeline<AppModelType>;
1588+
/* Excluded from this release type: userDataWriter */
1589+
/* Excluded from this release type: documentReferenceFactory */
15751590
limit(limit: number): Pipeline<AppModelType>;
1591+
/* Excluded from this release type: userDataWriter */
1592+
/* Excluded from this release type: documentReferenceFactory */
15761593
offset(offset: number): Pipeline<AppModelType>;
1594+
/* Excluded from this release type: userDataWriter */
1595+
/* Excluded from this release type: documentReferenceFactory */
15771596
// Warning: (ae-incompatible-release-tags) The symbol "select" is marked as @public, but its signature references "Selectable" which is marked as @beta
15781597
select(...selections: Array<Selectable | string>): Pipeline<AppModelType>;
1598+
/* Excluded from this release type: userDataWriter */
1599+
/* Excluded from this release type: documentReferenceFactory */
15791600
// Warning: (ae-incompatible-release-tags) The symbol "sort" is marked as @public, but its signature references "Ordering" which is marked as @beta
15801601
sort(...orderings: Ordering[]): Pipeline<AppModelType>;
1602+
/* Excluded from this release type: userDataWriter */
1603+
/* Excluded from this release type: documentReferenceFactory */
15811604
// (undocumented)
15821605
sort(options: {
15831606
orderings: Ordering[];
15841607
}): Pipeline<AppModelType>;
1608+
/* Excluded from this release type: userDataWriter */
1609+
/* Excluded from this release type: documentReferenceFactory */
15851610
// Warning: (ae-incompatible-release-tags) The symbol "where" is marked as @public, but its signature references "FilterCondition" which is marked as @beta
15861611
// Warning: (ae-incompatible-release-tags) The symbol "where" is marked as @public, but its signature references "Constant" which is marked as @beta
15871612
where(condition: FilterCondition & Constant): Pipeline<AppModelType>;
@@ -1925,10 +1950,10 @@ export class Sum extends FirestoreFunction implements Accumulator {
19251950
export function sum(field: string | FieldPath): AggregateField<number>;
19261951

19271952
// @beta
1928-
export function sumExpression(value: Constant): Sum;
1953+
export function sumFunction(value: Constant): Sum;
19291954

19301955
// @beta
1931-
export function sumExpression(value: string): Sum;
1956+
export function sumFunction(value: string): Sum;
19321957

19331958
// @public
19341959
export function terminate(firestore: Firestore): Promise<void>;
@@ -2178,8 +2203,8 @@ export function xor(left: FilterExpr, ...right: FilterExpr[]): Xor;
21782203

21792204
// Warnings were encountered during analysis:
21802205
//
2181-
// /home/runner/work/firebase-js-sdk/firebase-js-sdk/packages/firestore/dist/lite/index.d.ts:9261:9 - (ae-incompatible-release-tags) The symbol "accumulators" is marked as @public, but its signature references "AccumulatorTarget" which is marked as @beta
2182-
// /home/runner/work/firebase-js-sdk/firebase-js-sdk/packages/firestore/dist/lite/index.d.ts:9262:9 - (ae-incompatible-release-tags) The symbol "groups" is marked as @public, but its signature references "Selectable" which is marked as @beta
2183-
// /home/runner/work/firebase-js-sdk/firebase-js-sdk/packages/firestore/dist/lite/index.d.ts:9291:9 - (ae-incompatible-release-tags) The symbol "orderings" is marked as @public, but its signature references "Ordering" which is marked as @beta
2206+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/index.d.ts:9237:9 - (ae-incompatible-release-tags) The symbol "accumulators" is marked as @public, but its signature references "AccumulatorTarget" which is marked as @beta
2207+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/index.d.ts:9238:9 - (ae-incompatible-release-tags) The symbol "groups" is marked as @public, but its signature references "Selectable" which is marked as @beta
2208+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/index.d.ts:9267:9 - (ae-incompatible-release-tags) The symbol "orderings" is marked as @public, but its signature references "Ordering" which is marked as @beta
21842209

21852210
```

common/api-review/firestore.api.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,33 +1821,58 @@ export type PersistentTabManager = PersistentSingleTabManager | PersistentMultip
18211821

18221822
// @public
18231823
export class Pipeline<AppModelType = DocumentData> {
1824+
/* Excluded from this release type: _db */
18241825
// Warning: (ae-incompatible-release-tags) The symbol "addFields" is marked as @public, but its signature references "Selectable" which is marked as @beta
18251826
addFields(...fields: Selectable[]): Pipeline<AppModelType>;
1827+
/* Excluded from this release type: userDataWriter */
1828+
/* Excluded from this release type: documentReferenceFactory */
18261829
// Warning: (ae-incompatible-release-tags) The symbol "aggregate" is marked as @public, but its signature references "AccumulatorTarget" which is marked as @beta
18271830
aggregate(...accumulators: AccumulatorTarget[]): Pipeline<AppModelType>;
1831+
/* Excluded from this release type: userDataWriter */
1832+
/* Excluded from this release type: documentReferenceFactory */
18281833
aggregate(options: {
18291834
accumulators: AccumulatorTarget[];
18301835
groups?: Array<string | Selectable>;
18311836
}): Pipeline<AppModelType>;
1837+
/* Excluded from this release type: userDataWriter */
1838+
/* Excluded from this release type: documentReferenceFactory */
18321839
// Warning: (ae-incompatible-release-tags) The symbol "distinct" is marked as @public, but its signature references "Selectable" which is marked as @beta
18331840
distinct(...groups: Array<string | Selectable>): Pipeline<AppModelType>;
1841+
/* Excluded from this release type: userDataWriter */
1842+
/* Excluded from this release type: documentReferenceFactory */
18341843
// Warning: (ae-incompatible-release-tags) The symbol "execute" is marked as @public, but its signature references "PipelineResult" which is marked as @beta
18351844
execute(): Promise<Array<PipelineResult<AppModelType>>>;
1845+
/* Excluded from this release type: userDataWriter */
1846+
/* Excluded from this release type: documentReferenceFactory */
18361847
// Warning: (ae-incompatible-release-tags) The symbol "findNearest" is marked as @public, but its signature references "FindNearestOptions" which is marked as @beta
18371848
//
18381849
// (undocumented)
18391850
findNearest(options: FindNearestOptions): Pipeline<AppModelType>;
1851+
/* Excluded from this release type: userDataWriter */
1852+
/* Excluded from this release type: documentReferenceFactory */
18401853
genericStage(name: string, params: any[]): Pipeline<AppModelType>;
1854+
/* Excluded from this release type: userDataWriter */
1855+
/* Excluded from this release type: documentReferenceFactory */
18411856
limit(limit: number): Pipeline<AppModelType>;
1857+
/* Excluded from this release type: userDataWriter */
1858+
/* Excluded from this release type: documentReferenceFactory */
18421859
offset(offset: number): Pipeline<AppModelType>;
1860+
/* Excluded from this release type: userDataWriter */
1861+
/* Excluded from this release type: documentReferenceFactory */
18431862
// Warning: (ae-incompatible-release-tags) The symbol "select" is marked as @public, but its signature references "Selectable" which is marked as @beta
18441863
select(...selections: Array<Selectable | string>): Pipeline<AppModelType>;
1864+
/* Excluded from this release type: userDataWriter */
1865+
/* Excluded from this release type: documentReferenceFactory */
18451866
// Warning: (ae-incompatible-release-tags) The symbol "sort" is marked as @public, but its signature references "Ordering" which is marked as @beta
18461867
sort(...orderings: Ordering[]): Pipeline<AppModelType>;
1868+
/* Excluded from this release type: userDataWriter */
1869+
/* Excluded from this release type: documentReferenceFactory */
18471870
// (undocumented)
18481871
sort(options: {
18491872
orderings: Ordering[];
18501873
}): Pipeline<AppModelType>;
1874+
/* Excluded from this release type: userDataWriter */
1875+
/* Excluded from this release type: documentReferenceFactory */
18511876
// Warning: (ae-incompatible-release-tags) The symbol "where" is marked as @public, but its signature references "FilterCondition" which is marked as @beta
18521877
// Warning: (ae-incompatible-release-tags) The symbol "where" is marked as @public, but its signature references "Constant" which is marked as @beta
18531878
where(condition: FilterCondition & Constant): Pipeline<AppModelType>;
@@ -2474,8 +2499,8 @@ export function xor(left: FilterExpr, ...right: FilterExpr[]): Xor;
24742499

24752500
// Warnings were encountered during analysis:
24762501
//
2477-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/index.d.ts:10115:9 - (ae-incompatible-release-tags) The symbol "accumulators" is marked as @public, but its signature references "AccumulatorTarget" which is marked as @beta
2478-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/index.d.ts:10116:9 - (ae-incompatible-release-tags) The symbol "groups" is marked as @public, but its signature references "Selectable" which is marked as @beta
2479-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/index.d.ts:10145:9 - (ae-incompatible-release-tags) The symbol "orderings" is marked as @public, but its signature references "Ordering" which is marked as @beta
2502+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/index.d.ts:10116:9 - (ae-incompatible-release-tags) The symbol "accumulators" is marked as @public, but its signature references "AccumulatorTarget" which is marked as @beta
2503+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/index.d.ts:10117:9 - (ae-incompatible-release-tags) The symbol "groups" is marked as @public, but its signature references "Selectable" which is marked as @beta
2504+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/index.d.ts:10146:9 - (ae-incompatible-release-tags) The symbol "orderings" is marked as @public, but its signature references "Ordering" which is marked as @beta
24802505

24812506
```

packages/firestore/lite/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ export {
7373
arrayLength,
7474
inAny,
7575
notInAny,
76-
and as andExpression,
77-
or as orExpression,
7876
xor,
7977
ifFunction,
8078
not,
@@ -99,9 +97,6 @@ export {
9997
strConcat,
10098
mapGet,
10199
countAll,
102-
count as countExpression,
103-
sum as sumExpression,
104-
avg,
105100
min,
106101
max,
107102
cosineDistance,
@@ -192,7 +187,9 @@ export {
192187
SelectableExpr,
193188
Selectable,
194189
FilterCondition,
195-
Accumulator
190+
Accumulator,
191+
sum as sumFunction,
192+
avg as avgFunction
196193
} from '../src/lite-api/expressions';
197194

198195
export {
@@ -243,14 +240,17 @@ export {
243240

244241
export {
245242
and,
243+
or,
244+
} from '../src/lite-api/overloads';
245+
246+
export {
246247
endAt,
247248
endBefore,
248249
startAt,
249250
startAfter,
250251
limit,
251252
limitToLast,
252253
where,
253-
or,
254254
orderBy,
255255
query,
256256
QueryConstraint,

packages/firestore/src/api/filter.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@
1616
*/
1717

1818
export {
19-
and,
2019
endAt,
2120
endBefore,
2221
startAfter,
2322
startAt,
2423
limitToLast,
2524
limit,
26-
or,
2725
orderBy,
2826
OrderByDirection,
2927
where,

packages/firestore/src/core/pipeline-util.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@
1313
// limitations under the License.
1414

1515
import {
16-
and,
1716
Constant,
1817
Expr,
1918
Field,
2019
FilterCondition,
2120
not,
22-
or
2321
} from '../lite-api/expressions';
22+
import {
23+
and,
24+
or
25+
} from '../lite-api/overloads';
2426
import { isNanValue, isNullValue } from '../model/values';
2527
import {
2628
ArrayValue as ProtoArrayValue,

0 commit comments

Comments
 (0)