Skip to content

Commit

Permalink
chore(grpc): lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
waitingsong committed Nov 6, 2024
1 parent ebe2279 commit 0063436
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions packages/grpc/src/comsumer/clients.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as assert from 'assert';
import * as assert from 'assert';
import {
Config,
Init,
Expand Down Expand Up @@ -60,8 +60,13 @@ export class GRPCClients extends Map {

for (const methodName of Object.keys(packageDefinition[definition])) {
const originMethod = connectionService[methodName];
assert(originMethod, 'No method found in proto file, path:'
+ options.protoPath + ` method: ${methodName}, definition: ${definition}, serviceName: ${serviceName}`);
const msg: string[] = [
`No method found in proto file, path: ${options.protoPath}`,
`method: ${methodName}`,
`definition: ${definition}`,
`serviceName: ${serviceName}`,
];
assert(originMethod, msg.join(', '));

connectionService[methodName] = (
clientOptions: IClientOptions = {}
Expand Down Expand Up @@ -136,8 +141,10 @@ export const createGRPCConsumer = async <T>(

await clients.initService();
if (typeof options.service === 'string' && options.service) {
const pkg = clients.grpcConfig.services[0].package
const name = options.service.startsWith(`${pkg}.`) ? options.service : `${pkg}.${options.service}`
const pkg = clients.grpcConfig.services[0].package;
const name = options.service.startsWith(`${pkg}.`)
? options.service
: `${pkg}.${options.service}`;
return clients.getService(name);
}
return Array.from(clients.values())[0];
Expand Down

0 comments on commit 0063436

Please sign in to comment.