Skip to content

Commit

Permalink
modify fileContainingSymbol method
Browse files Browse the repository at this point in the history
  • Loading branch information
redhoyasa committed Sep 15, 2020
1 parent 9a57b2d commit 27157da
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
ServerReflectionRequest,
ServerReflectionResponse,
} from './reflection_pb';
import {Root} from 'protobufjs';

export class Client {
grpcClient: services.IServerReflectionClient;
Expand Down Expand Up @@ -46,15 +47,14 @@ export class Client {
});
}

fileContainingSymbol(symbol: string): Promise<grpc.GrpcObject> {
fileContainingSymbol(symbol: string): Promise<Root> {
return new Promise((resolve, reject) => {
function dataCallback(response: ServerReflectionResponse) {
if (response.hasFileDescriptorResponse()) {
const root = getDescriptorRoot(
response.getFileDescriptorResponse()?.getFileDescriptorProtoList()
);
const res = grpc.loadObject(root);
resolve(res);
resolve(root);
} else {
reject(Error());
}
Expand Down

0 comments on commit 27157da

Please sign in to comment.