Skip to content

Commit 33f5811

Browse files
committed
Implementing new stages Sample, Union, Unnest, Replace
1 parent e820ee5 commit 33f5811

File tree

7 files changed

+644
-218
lines changed

7 files changed

+644
-218
lines changed

packages/firestore/src/api/pipeline.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ export class Pipeline extends LitePipeline {
4141
db: Firestore,
4242
userDataReader: UserDataReader,
4343
userDataWriter: AbstractUserDataWriter,
44-
stages: Stage[],
45-
converter: unknown = {}
44+
stages: Stage[]
4645
): Pipeline {
4746
return new Pipeline(db, userDataReader, userDataWriter, stages);
4847
}

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

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2105,6 +2105,7 @@ export abstract class Expr implements ProtoSerializable<ProtoValue>, UserData {
21052105
*/
21062106
export abstract class Selectable extends Expr {
21072107
selectable: true = true;
2108+
abstract readonly alias: string;
21082109
}
21092110

21102111
/**
@@ -2245,32 +2246,28 @@ export class Field extends Selectable {
22452246
*/
22462247
static of(name: string): Field;
22472248
static of(path: FieldPath): Field;
2248-
static of(
2249-
pipelineOrName: Pipeline | string | FieldPath,
2250-
name?: string
2251-
): Field {
2252-
if (typeof pipelineOrName === 'string') {
2253-
if (DOCUMENT_KEY_NAME === pipelineOrName) {
2249+
static of(nameOrPath: string | FieldPath): Field {
2250+
if (typeof nameOrPath === 'string') {
2251+
if (DOCUMENT_KEY_NAME === nameOrPath) {
22542252
return new Field(documentId()._internalPath);
22552253
}
2256-
return new Field(fieldPathFromArgument('of', pipelineOrName));
2257-
} else if (pipelineOrName instanceof FieldPath) {
2258-
if (documentId().isEqual(pipelineOrName)) {
2254+
return new Field(fieldPathFromArgument('of', nameOrPath));
2255+
} else {
2256+
if (documentId().isEqual(nameOrPath)) {
22592257
return new Field(documentId()._internalPath);
22602258
}
2261-
return new Field(pipelineOrName._internalPath);
2262-
} else {
2263-
return new Field(
2264-
fieldPathFromArgument('of', name!),
2265-
pipelineOrName as Pipeline
2266-
);
2259+
return new Field(nameOrPath._internalPath);
22672260
}
22682261
}
22692262

22702263
fieldName(): string {
22712264
return this.fieldPath.canonicalString();
22722265
}
22732266

2267+
get alias(): string {
2268+
return this.fieldPath.canonicalString();
2269+
}
2270+
22742271
/**
22752272
* @private
22762273
* @internal

0 commit comments

Comments
 (0)