@@ -87,31 +87,16 @@ declare module './database' {
8787 * @param pipeline The pipeline to execute.
8888 * @return A Promise representing the asynchronous pipeline execution.
8989 */
90- export function execute ( pipeline : LitePipeline ) : Promise < PipelineSnapshot > ;
91- export function execute (
92- pipeline : RealtimePipeline
93- ) : Promise < RealtimePipelineSnapshot > ;
94- export function execute (
95- pipeline : LitePipeline | RealtimePipeline
96- ) : Promise < PipelineSnapshot | RealtimePipelineSnapshot > {
90+ export function execute ( pipeline : LitePipeline ) : Promise < PipelineSnapshot > {
9791 const firestore = cast ( pipeline . _db , Firestore ) ;
9892 const client = ensureFirestoreConfigured ( firestore ) ;
9993
100- if ( pipeline instanceof RealtimePipeline ) {
101- return firestoreClientGetDocumentsViaSnapshotListener (
102- client ,
103- pipeline
104- ) . then (
105- snapshot =>
106- new RealtimePipelineSnapshot ( pipeline as RealtimePipeline , snapshot )
107- ) ;
108- } else {
109- return firestoreClientExecutePipeline ( client , pipeline ) . then ( result => {
110- // Get the execution time from the first result.
111- // firestoreClientExecutePipeline returns at least one PipelineStreamElement
112- // even if the returned document set is empty.
113- const executionTime =
114- result . length > 0 ? result [ 0 ] . executionTime ?. toTimestamp ( ) : undefined ;
94+ return firestoreClientExecutePipeline ( client , pipeline ) . then ( result => {
95+ // Get the execution time from the first result.
96+ // firestoreClientExecutePipeline returns at least one PipelineStreamElement
97+ // even if the returned document set is empty.
98+ const executionTime =
99+ result . length > 0 ? result [ 0 ] . executionTime ?. toTimestamp ( ) : undefined ;
115100
116101 const docs = result
117102 // Currently ignore any response from ExecutePipeline that does
@@ -131,9 +116,8 @@ export function execute(
131116 )
132117 ) ;
133118
134- return new PipelineSnapshot ( pipeline , docs , executionTime ) ;
135- } ) ;
136- }
119+ return new PipelineSnapshot ( pipeline , docs , executionTime ) ;
120+ } ) ;
137121}
138122
139123// Augment the Firestore class with the pipeline() factory method
0 commit comments