1 | import { Metadata } from './metadata';
|
2 | import { Listener, MetadataListener, MessageListener, StatusListener, InterceptingListener, MessageContext } from './call-interface';
|
3 | import { Status } from './constants';
|
4 | import { Channel } from './channel';
|
5 | import { CallOptions } from './client';
|
6 | import { ClientMethodDefinition } from './make-client';
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | export declare class InterceptorConfigurationError extends Error {
|
12 | constructor(message: string);
|
13 | }
|
14 | export interface MetadataRequester {
|
15 | (metadata: Metadata, listener: InterceptingListener, next: (metadata: Metadata, listener: InterceptingListener | Listener) => void): void;
|
16 | }
|
17 | export interface MessageRequester {
|
18 | (message: any, next: (message: any) => void): void;
|
19 | }
|
20 | export interface CloseRequester {
|
21 | (next: () => void): void;
|
22 | }
|
23 | export interface CancelRequester {
|
24 | (next: () => void): void;
|
25 | }
|
26 |
|
27 |
|
28 |
|
29 | export interface FullRequester {
|
30 | start: MetadataRequester;
|
31 | sendMessage: MessageRequester;
|
32 | halfClose: CloseRequester;
|
33 | cancel: CancelRequester;
|
34 | }
|
35 | export type Requester = Partial<FullRequester>;
|
36 | export declare class ListenerBuilder {
|
37 | private metadata;
|
38 | private message;
|
39 | private status;
|
40 | withOnReceiveMetadata(onReceiveMetadata: MetadataListener): this;
|
41 | withOnReceiveMessage(onReceiveMessage: MessageListener): this;
|
42 | withOnReceiveStatus(onReceiveStatus: StatusListener): this;
|
43 | build(): Listener;
|
44 | }
|
45 | export declare class RequesterBuilder {
|
46 | private start;
|
47 | private message;
|
48 | private halfClose;
|
49 | private cancel;
|
50 | withStart(start: MetadataRequester): this;
|
51 | withSendMessage(sendMessage: MessageRequester): this;
|
52 | withHalfClose(halfClose: CloseRequester): this;
|
53 | withCancel(cancel: CancelRequester): this;
|
54 | build(): Requester;
|
55 | }
|
56 | export interface InterceptorOptions extends CallOptions {
|
57 | method_definition: ClientMethodDefinition<any, any>;
|
58 | }
|
59 | export interface InterceptingCallInterface {
|
60 | cancelWithStatus(status: Status, details: string): void;
|
61 | getPeer(): string;
|
62 | start(metadata: Metadata, listener?: Partial<InterceptingListener>): void;
|
63 | sendMessageWithContext(context: MessageContext, message: any): void;
|
64 | sendMessage(message: any): void;
|
65 | startRead(): void;
|
66 | halfClose(): void;
|
67 | }
|
68 | export declare class InterceptingCall implements InterceptingCallInterface {
|
69 | private nextCall;
|
70 | |
71 |
|
72 |
|
73 | private requester;
|
74 | |
75 |
|
76 |
|
77 |
|
78 | private processingMetadata;
|
79 | |
80 |
|
81 |
|
82 | private pendingMessageContext;
|
83 | private pendingMessage;
|
84 | |
85 |
|
86 |
|
87 |
|
88 | private processingMessage;
|
89 | |
90 |
|
91 |
|
92 |
|
93 | private pendingHalfClose;
|
94 | constructor(nextCall: InterceptingCallInterface, requester?: Requester);
|
95 | cancelWithStatus(status: Status, details: string): void;
|
96 | getPeer(): string;
|
97 | private processPendingMessage;
|
98 | private processPendingHalfClose;
|
99 | start(metadata: Metadata, interceptingListener?: Partial<InterceptingListener>): void;
|
100 | sendMessageWithContext(context: MessageContext, message: any): void;
|
101 | sendMessage(message: any): void;
|
102 | startRead(): void;
|
103 | halfClose(): void;
|
104 | }
|
105 | export interface NextCall {
|
106 | (options: InterceptorOptions): InterceptingCallInterface;
|
107 | }
|
108 | export interface Interceptor {
|
109 | (options: InterceptorOptions, nextCall: NextCall): InterceptingCall;
|
110 | }
|
111 | export interface InterceptorProvider {
|
112 | (methodDefinition: ClientMethodDefinition<any, any>): Interceptor;
|
113 | }
|
114 | export interface InterceptorArguments {
|
115 | clientInterceptors: Interceptor[];
|
116 | clientInterceptorProviders: InterceptorProvider[];
|
117 | callInterceptors: Interceptor[];
|
118 | callInterceptorProviders: InterceptorProvider[];
|
119 | }
|
120 | export declare function getInterceptingCall(interceptorArgs: InterceptorArguments, methodDefinition: ClientMethodDefinition<any, any>, options: CallOptions, channel: Channel): InterceptingCallInterface;
|