forked from echo-health/node-grpc-interceptors
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.d.ts
32 lines (27 loc) · 754 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
declare module '@pionerlabs/grpc-interceptors' {
import grpc from '@grpc/grpc-js';
function serverProxy(server: grpc.Server): ServerProxy;
export interface Context {
call: {
request: any;
domain?: string;
metadata: grpc.Metadata;
cancelled: boolean;
};
service: any;
}
export interface Client extends grpc.Server {
interceptors: { (...args: any): any }[];
use: (
middlewareFn: ((
context: Context,
next: (...args: any) => Promise<void>,
error: (error: grpc.ServiceError) => void
) => void)
) => void;
}
export interface ServerProxy extends Client {
intercept: () => IterableIterator<{ fn: (...args: any) => any }>;
}
export { serverProxy };
}