Skip to content

Commit

Permalink
Define a generic interface to allow flexibility (#160)
Browse files Browse the repository at this point in the history
* Define a generic interface to allow flexibility

* Add intercepting call

* Remove export

* Use the grpc interface inside the factory

* closer match to design doc
  • Loading branch information
danieljbruce authored Jan 23, 2023
1 parent db52df9 commit 7e12a66
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/grpc_interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export interface GrpcInterface {
Channel: any;
connectivityState: any;
status: any;
InterceptingCall: any;
};
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*
*/
import * as grpcType from '@grpc/grpc-js';
import {GrpcInterface} from './grpc_interface';
import * as util from 'util';

import {ChannelRef} from './channel_ref';
Expand All @@ -30,7 +31,8 @@ import AffinityConfig = protoRoot.grpc.gcp.AffinityConfig;

type GrpcModule = typeof grpcType;

export = (grpc: GrpcModule) => {
export = (grpc: GrpcInterface) => setup(grpc as GrpcModule);
const setup = (grpc: GrpcModule) => {
const GcpChannelFactory = getGcpChannelFactoryClass(grpc);
/**
* Create ApiConfig proto message from config object.
Expand Down

0 comments on commit 7e12a66

Please sign in to comment.