node_modules/@google-cloud/firestore/build/src/index.js
/**
     * A funnel for streaming API requests, assigning a project ID where necessary
     * within the request options.
     *
     * The stream is returned in paused state and needs to be resumed once all
     * listeners are attached.
     *
     * @private
     * @param methodName Name of the streaming Veneer API endpoint that
     * takes a request and GAX options.
     * @param request The Protobuf request to send.
     * @param requestTag A unique client-assigned identifier for this request.
     * @returns A Promise with the resulting read-only stream.
     */
A funnel for streaming API requests, assigning a project ID where necessary
within the request options.

The stream is returned in paused state and needs to be resumed once all
listeners are attached.

@private
@param methodName Name of the streaming Veneer API endpoint that
takes a request and GAX options.
@param request The Protobuf request to send.
@param requestTag A unique client-assigned identifier for this request.
@returns A Promise with the resulting read-only stream.
A funnel for streaming API requests assigning a project ID where necessary within the request options . The stream is returned in paused state and needs to be resumed once all listeners are attached . @private @param methodName Name of the streaming Veneer API endpoint that takes a request and GAX options . @param request The Protobuf request to send . @param requestTag A unique client - assigned identifier for this request . @returns A Promise with the resulting read - only stream .
requestStream(methodName, request, requestTag) {
        const callOptions = this.createCallOptions();
        const bidirectional = methodName === 'listen';
        return this._retry(methodName, requestTag, () => {
            const result = new util_1.Deferred();
            this._clientPool.run(requestTag, async (gapicClient) => {
                logger_1.logger('Firestore.requestStream', requestTag, 'Sending request: %j', request);
                try {
                    const stream = bidirectional
                        ? gapicClient[methodName](callOptions)
                        : gapicClient[methodName](request, callOptions);
                    const logStream = through2.obj(function (chunk, enc, callback) {
                        logger_1.logger('Firestore.requestStream', requestTag, 'Received response: %j', chunk);
                        callback();
                    });
                    stream.pipe(logStream);
                    const lifetime = new util_1.Deferred();
                    const resultStream = await this._initializeStream(stream, lifetime, requestTag, bidirectional ? request : undefined);
                    resultStream.on('end', () => stream.end());
                    result.resolve(resultStream);
                    return lifetime.promise;
                }
                catch (e) {
                    result.reject(e);
                }
            });
            return result.promise;
        });
    }
requestStream ( methodName , request , requestTag ) { const callOptions = this . createCallOptions ( ) ; const bidirectional = methodName === 'listen' ; return this . _retry ( methodName , requestTag , ( ) => { const result = new util_1 . Deferred ( ) ; this . _clientPool . run ( requestTag , async ( gapicClient ) => { logger_1 . logger ( 'Firestore.requestStream' , requestTag , 'Sending request: %j' , request ) ; try { const stream = bidirectional ? gapicClient [ methodName ] ( callOptions ) : gapicClient [ methodName ] ( request , callOptions ) ; const logStream = through2 . obj ( function ( chunk , enc , callback ) { logger_1 . logger ( 'Firestore.requestStream' , requestTag , 'Received response: %j' , chunk ) ; callback ( ) ; } ) ; stream . pipe ( logStream ) ; const lifetime = new util_1 . Deferred ( ) ; const resultStream = await this . _initializeStream ( stream , lifetime , requestTag , bidirectional ? request : undefined ) ; resultStream . on ( 'end' , ( ) => stream . end ( ) ) ; result . resolve ( resultStream ) ; return lifetime . promise ; } catch ( e ) { result . reject ( e ) ; } } ) ; return result . promise ; } ) ; }
A funnel for streaming API requests, assigning a project ID where necessary
 within the request options.
A funnel for streaming API requests assigning a project ID where necessary within the request options .
// While we return the stream to the callee early, we don't want to // release the GAPIC client until the callee has finished processing the // stream.