1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | import { Duplex, DuplexOptions, Readable, Stream, Writable } from 'stream';
|
18 | import { APICallback, CancellableStream, GRPCCallResult, SimpleCallbackFunction } from '../apitypes';
|
19 | import { RetryRequestOptions } from '../gax';
|
20 | declare const duplexify: DuplexifyConstructor;
|
21 | export interface DuplexifyOptions extends DuplexOptions {
|
22 | autoDestroy?: boolean;
|
23 | end?: boolean;
|
24 | }
|
25 | export interface Duplexify extends Duplex {
|
26 | readonly destroyed: boolean;
|
27 | setWritable(writable: Writable | false | null): void;
|
28 | setReadable(readable: Readable | false | null): void;
|
29 | }
|
30 | export interface DuplexifyConstructor {
|
31 | obj(writable?: Writable | false | null, readable?: Readable | false | null, options?: DuplexifyOptions): Duplexify;
|
32 | new (writable?: Writable | false | null, readable?: Readable | false | null, options?: DuplexifyOptions): Duplexify;
|
33 | (writable?: Writable | false | null, readable?: Readable | false | null, options?: DuplexifyOptions): Duplexify;
|
34 | }
|
35 |
|
36 |
|
37 |
|
38 |
|
39 | export declare enum StreamType {
|
40 |
|
41 | SERVER_STREAMING = 1,
|
42 |
|
43 | CLIENT_STREAMING = 2,
|
44 |
|
45 | BIDI_STREAMING = 3
|
46 | }
|
47 | export declare class StreamProxy extends duplexify implements GRPCCallResult {
|
48 | type: StreamType;
|
49 | private _callback;
|
50 | private _isCancelCalled;
|
51 | stream?: CancellableStream;
|
52 | |
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 | constructor(type: StreamType, callback: APICallback);
|
61 | cancel(): void;
|
62 | /**
|
63 | * Forward events from an API request stream to the user's stream.
|
64 | * @param {Stream} stream - The API request stream.
|
65 | */
|
66 | forwardEvents(stream: Stream): void;
|
67 | |
68 |
|
69 |
|
70 |
|
71 |
|
72 | setStream(apiCall: SimpleCallbackFunction, argument: {}, retryRequestOptions?: RetryRequestOptions): void;
|
73 | }
|
74 | export {};
|