Skip to content

Commit 4b67f8a

Browse files
committed
Documentation and .d.ts improvements
1 parent 90a5e3c commit 4b67f8a

File tree

8 files changed

+36
-52
lines changed

8 files changed

+36
-52
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,8 @@ export interface FindNearestOptions {
10291029
// @public
10301030
export class Firestore {
10311031
get app(): FirebaseApp;
1032+
// Warning: (ae-incompatible-release-tags) The symbol "pipeline" is marked as @public, but its signature references "PipelineSource" which is marked as @beta
1033+
pipeline(): PipelineSource;
10321034
toJSON(): object;
10331035
type: 'firestore-lite' | 'firestore';
10341036
}
@@ -1619,6 +1621,7 @@ export class Query<AppModelType = DocumentData, DbModelType extends DocumentData
16191621
protected constructor();
16201622
readonly converter: FirestoreDataConverter<AppModelType, DbModelType> | null;
16211623
readonly firestore: Firestore;
1624+
pipeline(): Pipeline;
16221625
readonly type: 'query' | 'collection';
16231626
withConverter(converter: null): Query<DocumentData, DocumentData>;
16241627
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): Query<NewAppModelType, NewDbModelType>;
@@ -2175,8 +2178,8 @@ export function xor(left: FilterExpr, ...right: FilterExpr[]): Xor;
21752178

21762179
// Warnings were encountered during analysis:
21772180
//
2178-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/index.d.ts:9257:9 - (ae-incompatible-release-tags) The symbol "accumulators" is marked as @public, but its signature references "AccumulatorTarget" which is marked as @beta
2179-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/index.d.ts:9258:9 - (ae-incompatible-release-tags) The symbol "groups" is marked as @public, but its signature references "Selectable" which is marked as @beta
2180-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/lite/index.d.ts:9287:9 - (ae-incompatible-release-tags) The symbol "orderings" is marked as @public, but its signature references "Ordering" which is marked as @beta
2181+
// /Users/markduckworth/projects/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+
// /Users/markduckworth/projects/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+
// /Users/markduckworth/projects/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
21812184

21822185
```

common/api-review/firestore.api.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,8 @@ export interface FindNearestOptions {
10731073
// @public
10741074
export class Firestore {
10751075
get app(): FirebaseApp;
1076+
// Warning: (ae-incompatible-release-tags) The symbol "pipeline" is marked as @public, but its signature references "PipelineSource" which is marked as @beta
1077+
pipeline(): PipelineSource;
10761078
toJSON(): object;
10771079
type: 'firestore-lite' | 'firestore';
10781080
}
@@ -1877,6 +1879,7 @@ export class Query<AppModelType = DocumentData, DbModelType extends DocumentData
18771879
protected constructor();
18781880
readonly converter: FirestoreDataConverter<AppModelType, DbModelType> | null;
18791881
readonly firestore: Firestore;
1882+
pipeline(): Pipeline;
18801883
readonly type: 'query' | 'collection';
18811884
withConverter(converter: null): Query<DocumentData, DocumentData>;
18821885
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): Query<NewAppModelType, NewDbModelType>;
@@ -2463,8 +2466,8 @@ export function xor(left: FilterExpr, ...right: FilterExpr[]): Xor;
24632466

24642467
// Warnings were encountered during analysis:
24652468
//
2466-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/index.d.ts:10107:9 - (ae-incompatible-release-tags) The symbol "accumulators" is marked as @public, but its signature references "AccumulatorTarget" which is marked as @beta
2467-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/index.d.ts:10108:9 - (ae-incompatible-release-tags) The symbol "groups" is marked as @public, but its signature references "Selectable" which is marked as @beta
2468-
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/index.d.ts:10137:9 - (ae-incompatible-release-tags) The symbol "orderings" is marked as @public, but its signature references "Ordering" which is marked as @beta
2469+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/index.d.ts:10111:9 - (ae-incompatible-release-tags) The symbol "accumulators" is marked as @public, but its signature references "AccumulatorTarget" which is marked as @beta
2470+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/index.d.ts:10112:9 - (ae-incompatible-release-tags) The symbol "groups" is marked as @public, but its signature references "Selectable" which is marked as @beta
2471+
// /Users/markduckworth/projects/firebase-js-sdk/packages/firestore/dist/index.d.ts:10141:9 - (ae-incompatible-release-tags) The symbol "orderings" is marked as @public, but its signature references "Ordering" which is marked as @beta
24692472

24702473
```

packages/firestore/lite/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export { PipelineResult } from '../src/lite-api/pipeline-result';
3333

3434
export { Pipeline } from '../src/lite-api/pipeline';
3535

36-
export { useFirestorePipelines } from '../src/lite-api/database-augmentation';
36+
export { useFirestorePipelines } from '../src/lite-api/database_augmentation';
3737

3838
export {
3939
Stage,

packages/firestore/src/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export { PipelineResult } from './lite-api/pipeline-result';
2121

2222
export { Pipeline } from './lite-api/pipeline';
2323

24-
export { useFirestorePipelines } from './api/database-augmentation';
24+
export { useFirestorePipelines } from './api/database_augmentation';
2525

2626
export {
2727
Stage,

packages/firestore/src/api/database-augmentation.ts renamed to packages/firestore/src/api/database_augmentation.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,6 @@ import { Firestore } from './database';
77
import { DocumentReference, Query } from './reference';
88
import { ExpUserDataWriter } from './user_data_writer';
99

10-
declare module './database' {
11-
interface Firestore {
12-
pipeline(): PipelineSource;
13-
}
14-
}
15-
16-
declare module './reference' {
17-
interface Query {
18-
pipeline(): Pipeline;
19-
}
20-
}
21-
2210
export function useFirestorePipelines(): void {
2311
Firestore.prototype.pipeline = function (): PipelineSource {
2412
const firestore = this;

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

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,15 @@ import { cast } from '../util/input_validation';
4141
import { logWarn } from '../util/log';
4242

4343
import { FirestoreService, removeComponents } from './components';
44+
import type { PipelineSource } from './pipeline-source';
4445
import {
4546
DEFAULT_HOST,
4647
FirestoreSettingsImpl,
4748
PrivateSettings,
4849
FirestoreSettings
4950
} from './settings';
51+
// `import type` to avoid bundling the source for
52+
// pipelines if `useFirestorePipelines()` is not called
5053

5154
export { EmulatorMockTokenOptions } from '@firebase/util';
5255

@@ -173,17 +176,16 @@ export class Firestore implements FirestoreService {
173176
removeComponents(this);
174177
return Promise.resolve();
175178
}
176-
}
177179

178-
// Undocumented method of Firestore. This is only
179-
// in place to give developers a runtime error suggesting
180-
// how to correctly initialize Firestore for use with Pipelines.
181-
// @ts-ignore
182-
Firestore.prototype.pipeline = function (): unknown {
183-
throw new Error(
184-
'Pipelines not initialized. Your application must call `useFirestorePipelines()` before using Firestore Pipeline features.'
185-
);
186-
};
180+
/**
181+
* Pipeline query.
182+
*/
183+
pipeline(): PipelineSource {
184+
throw new Error(
185+
'Pipelines not initialized. Your application must call `useFirestorePipelines()` before using Firestore Pipeline features.'
186+
);
187+
}
188+
}
187189

188190
/**
189191
* Initializes a new instance of Cloud Firestore with the provided settings.

packages/firestore/src/lite-api/database-augmentation.ts renamed to packages/firestore/src/lite-api/database_augmentation.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,6 @@ import { DocumentReference, Query } from './reference';
77
import { LiteUserDataWriter } from './reference_impl';
88
import { newUserDataReader } from './user_data_reader';
99

10-
declare module './database' {
11-
interface Firestore {
12-
pipeline(): PipelineSource;
13-
}
14-
}
15-
16-
declare module './reference' {
17-
interface Query {
18-
pipeline(): Pipeline;
19-
}
20-
}
21-
2210
export function useFirestorePipelines(): void {
2311
Firestore.prototype.pipeline = function (): PipelineSource {
2412
const userDataWriter = new LiteUserDataWriter(this);

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import { AutoId } from '../util/misc';
3737
import { Firestore } from './database';
3838
import { FieldPath } from './field_path';
3939
import { FieldValue } from './field_value';
40+
import type { Pipeline } from './pipeline';
4041
import { FirestoreDataConverter } from './snapshot';
4142
import { NestedUpdateFields, Primitive } from './types';
4243

@@ -177,17 +178,16 @@ export class Query<
177178
this._query
178179
);
179180
}
180-
}
181181

182-
// Undocumented method of Query. This is only
183-
// in place to give developers a runtime error suggesting
184-
// how to correctly initialize Firestore for use with Pipelines.
185-
// @ts-ignore
186-
Query.prototype.pipeline = function () {
187-
throw new Error(
188-
'Pipelines not initialized. Your application must call `useFirestorePipelines()` before using Firestore Pipeline features.'
189-
);
190-
};
182+
/**
183+
* Pipeline query.
184+
*/
185+
pipeline(): Pipeline {
186+
throw new Error(
187+
'Pipelines not initialized. Your application must call `useFirestorePipelines()` before using Firestore Pipeline features.'
188+
);
189+
}
190+
}
191191

192192
/**
193193
* A `DocumentReference` refers to a document location in a Firestore database

0 commit comments

Comments
 (0)