Skip to content

Commit 844ba80

Browse files
committed
fix: remove useMapField option usage
1 parent 08ef36d commit 844ba80

File tree

2 files changed

+6
-19
lines changed

2 files changed

+6
-19
lines changed

src/client.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,11 @@ export class Client {
1717
metadata: Metadata;
1818
grpcClient: services.IServerReflectionClient;
1919
private fileDescriptorCache: Map<string, IFileDescriptorProto> = new Map();
20-
private reflectionOptions?: {
21-
useExperimentalMapFieldDecoding?: boolean;
22-
};
2320
constructor(
2421
url: string,
2522
credentials: ChannelCredentials,
2623
options?: object,
27-
metadata?: Metadata,
28-
reflectionOptions?: Client['reflectionOptions']
24+
metadata?: Metadata
2925
) {
3026
this.fileDescriptorCache = new Map();
3127
this.metadata = metadata || new Metadata();
@@ -34,7 +30,6 @@ export class Client {
3430
credentials,
3531
options
3632
);
37-
this.reflectionOptions = reflectionOptions;
3833
}
3934

4035
listServices(): Promise<string[]> {
@@ -92,10 +87,7 @@ export class Client {
9287
);
9388
const fileDescriptorSet = FileDescriptorSet.create();
9489
set(fileDescriptorSet, 'file', Array.from(fileDescriptorMap.values()));
95-
return getDescriptorRootFromDescriptorSet(
96-
fileDescriptorSet,
97-
this.reflectionOptions?.useExperimentalMapFieldDecoding
98-
);
90+
return getDescriptorRootFromDescriptorSet(fileDescriptorSet);
9991
}
10092

10193
private async resolveDescriptorRecursive(

src/descriptor.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,25 @@ const set = require('lodash.set');
1111
* Get Protobuf.js Root object from the serialized FileDescriptorProto messages
1212
* that gotten from reflection service.
1313
* @param {Array<Uint8Array|string>|undefined} file_descriptor_protos - Reflection descriptor protos
14-
* @param {boolean} [useMapField=false] - Use experimental map field decoding support of protobufjs
1514
* @return {Root} Protobuf.js Root object
1615
*/
1716
// eslint-disable-next-line node/no-unsupported-features/es-syntax
18-
export function getDescriptorRoot(file_descriptor_protos, useMapField = false) {
17+
export function getDescriptorRoot(file_descriptor_protos) {
1918
const descriptorSet = Descriptor.FileDescriptorSet.create();
2019

2120
file_descriptor_protos.forEach((descriptorByte, i) => {
2221
const descriptor = Descriptor.FileDescriptorProto.decode(descriptorByte);
2322
set(descriptorSet, 'file[' + i + ']', descriptor);
2423
});
25-
return protobuf.Root.fromDescriptor(descriptorSet, {useMapField});
24+
return protobuf.Root.fromDescriptor(descriptorSet);
2625
}
2726

2827
/**
2928
* Get Protobuf.js Root object from FileDescriptorSet
3029
* @param {Message file_descriptor_set - File descriptor set
31-
* @param {boolean} [useMapField=false] - Use experimental map field decoding support of protobufjs
3230
* @return {Root} Protobuf.js Root object
3331
*/
3432
// eslint-disable-next-line node/no-unsupported-features/es-syntax
35-
export function getDescriptorRootFromDescriptorSet(
36-
file_descriptor_set,
37-
useMapField = false
38-
) {
39-
return protobuf.Root.fromDescriptor(file_descriptor_set, {useMapField});
33+
export function getDescriptorRootFromDescriptorSet(file_descriptor_set) {
34+
return protobuf.Root.fromDescriptor(file_descriptor_set);
4035
}

0 commit comments

Comments
 (0)