Skip to content

Commit 41bde42

Browse files
committed
Build and test fixes
1 parent 1645cd6 commit 41bde42

File tree

7 files changed

+23
-34
lines changed

7 files changed

+23
-34
lines changed

packages/firestore/lite/pipelines/pipelines.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ export {
116116
neq,
117117
lt,
118118
countIf,
119-
currentContext,
120119
lte,
121120
gt,
122121
gte,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ export function toPipeline(query: Query, db: Firestore): Pipeline {
221221
);
222222
}
223223

224-
pipeline = pipeline.limit(query.limit!, true);
224+
pipeline = pipeline.limit(query.limit!);
225225
pipeline = pipeline.sort(orderings[0], ...orderings.slice(1));
226226
} else {
227227
pipeline = pipeline.sort(orderings[0], ...orderings.slice(1));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2345,7 +2345,7 @@ export function constant(value: string): Constant;
23452345
* @param value The boolean value.
23462346
* @return A new `Constant` instance.
23472347
*/
2348-
export function constant(value: boolean): BooleanExpr;
2348+
export function constant(value: boolean): Constant;
23492349

23502350
/**
23512351
* Creates a `Constant` instance for a null value.

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,13 @@ export class Pipeline implements ProtoSerializable<ProtoPipeline> {
735735
const alias = field(selectable.alias);
736736
this.readUserData('unnest', alias);
737737

738-
return this._addStage(new Unnest(selectable.expr, alias, indexField));
738+
if (indexField) {
739+
return this._addStage(
740+
new Unnest(selectable.expr, alias, field(indexField))
741+
);
742+
} else {
743+
return this._addStage(new Unnest(selectable.expr, alias));
744+
}
739745
}
740746

741747
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ export class Unnest implements Stage {
438438
constructor(
439439
private expr: Expr,
440440
private alias: Field,
441-
private indexField?: string
441+
private indexField?: Field
442442
) {}
443443

444444
_toProto(serializer: JsonProtoSerializer): ProtoStage {
@@ -449,7 +449,7 @@ export class Unnest implements Stage {
449449

450450
if (this.indexField) {
451451
stageProto.options = {
452-
indexField: toStringValue(this.indexField)
452+
index_field: this.indexField._toProto(serializer)
453453
};
454454
}
455455

packages/firestore/test/integration/api/pipeline.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,17 +1140,17 @@ apiDescribe.only('Pipelines', persistence => {
11401140
);
11411141
});
11421142

1143-
it('where with boolean constant', async () => {
1144-
const snapshot = await execute(
1145-
firestore
1146-
.pipeline()
1147-
.collection(randomCol.path)
1148-
.where(constant(true))
1149-
.sort(ascending('__name__'))
1150-
.limit(2)
1151-
);
1152-
expectResults(snapshot, 'book1', 'book10');
1153-
});
1143+
// it('where with boolean constant', async () => {
1144+
// const snapshot = await execute(
1145+
// firestore
1146+
// .pipeline()
1147+
// .collection(randomCol.path)
1148+
// .where(constant(true))
1149+
// .sort(ascending('__name__'))
1150+
// .limit(2)
1151+
// );
1152+
// expectResults(snapshot, 'book1', 'book10');
1153+
// });
11541154
});
11551155

11561156
describe('sort, offset, and limit stages', () => {
@@ -1422,7 +1422,7 @@ apiDescribe.only('Pipelines', persistence => {
14221422
.pipeline()
14231423
.collection(randomCol.path)
14241424
.where(eq('title', "The Hitchhiker's Guide to the Galaxy"))
1425-
.unnest(field('tags').as('tag'))
1425+
.unnest(field('tags').as('tag'), 'tagsIndex')
14261426
.select(
14271427
'title',
14281428
'author',

packages/firestore/test/lite/pipeline.test.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ import {
6161
neq,
6262
lt,
6363
countIf,
64-
currentContext,
6564
lte,
6665
gt,
6766
arrayConcat,
@@ -2361,21 +2360,6 @@ describe('Firestore Pipelines', () => {
23612360
expectResults(snapshot, ...expectedResults);
23622361
});
23632362

2364-
// TODO: current_context tests with are failing because of b/395937453
2365-
itIf(testUnsupportedFeatures)('supports currentContext', async () => {
2366-
const snapshot = await execute(
2367-
firestore
2368-
.pipeline()
2369-
.collection(randomCol.path)
2370-
.sort(field('rating').descending())
2371-
.limit(1)
2372-
.select(currentContext().as('currentContext'))
2373-
);
2374-
expectResults(snapshot, {
2375-
currentContext: 'TODO'
2376-
});
2377-
});
2378-
23792363
it('supports map', async () => {
23802364
const snapshot = await execute(
23812365
firestore

0 commit comments

Comments
 (0)