Skip to content

Commit 5440b3d

Browse files
committed
Update client compatible version property
1 parent 173c6d9 commit 5440b3d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/client.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ export class Client {
4343
private clientOptions: object | undefined;
4444

4545
grpcClient: ServerReflectionClient | undefined;
46+
compatibleReflectionVersion: string | undefined;
4647
private reflectionResponseCache: ServerReflectionResponse | undefined;
47-
private compatibleProtocol: string | undefined;
4848
private CompatibleServerReflectionRequest:
4949
| (new (
5050
...args: ConstructorParameters<typeof ServerReflectionRequest>
@@ -142,7 +142,7 @@ export class Client {
142142
priority: protocolConfig.priority,
143143
effect: () => {
144144
this.grpcClient = grpcClientForProtocol;
145-
this.compatibleProtocol = version;
145+
this.compatibleReflectionVersion = version;
146146
this.CompatibleServerReflectionRequest =
147147
protocolClient.ServerReflectionRequest;
148148
this.reflectionResponseCache = reflectionResponse;
@@ -186,14 +186,14 @@ export class Client {
186186
successfulReflectionByPriority.effect!();
187187
}
188188

189-
private async initializeReflectionClient() {
190-
if (this.grpcClient || this.compatibleProtocol) return;
189+
async initialize() {
190+
if (this.grpcClient || this.compatibleReflectionVersion) return;
191191

192192
await this.evaluateSupportedServerReflectionProtocol();
193193
}
194194

195195
async listServices(): Promise<string[]> {
196-
await this.initializeReflectionClient();
196+
await this.initialize();
197197

198198
return new Promise((resolve, reject) => {
199199
function dataCallback(response: ServerReflectionResponse) {
@@ -287,7 +287,7 @@ export class Client {
287287
private async getFileContainingSymbol(
288288
symbol: string
289289
): Promise<Array<IFileDescriptorProto> | undefined> {
290-
await this.initializeReflectionClient();
290+
await this.initialize();
291291

292292
const fileDescriptorCache = this.fileDescriptorCache;
293293
return new Promise((resolve, reject) => {
@@ -332,7 +332,7 @@ export class Client {
332332
private async getFilesByFilenames(
333333
symbols: string[]
334334
): Promise<Array<IFileDescriptorProto> | undefined> {
335-
await this.initializeReflectionClient();
335+
await this.initialize();
336336

337337
const result: Array<IFileDescriptorProto> = [];
338338
const fileDescriptorCache = this.fileDescriptorCache;

0 commit comments

Comments
 (0)