Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add package definition loader function to native package #196

Merged
merged 2 commits into from
Feb 27, 2018

Conversation

murgatroid99
Copy link
Member

@kjin This is the implementation in the existing native library of the function to load the "package definition" from the protobuf library. As you can see, it calls makeClientConstructor, which is the other function that is not currently implemented in the pure JavaScript implementation.

The result type for this looks something like

type GrpcPackage = {
  [name: string]: GrpcPackage | typeof Client
}

for (const serviceFqn in packageDef) {
const service = packageDef[serviceFqn];
const nameComponents = serviceFqn.split('.');
const serviceName = nameComponents[-1];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean nameComponents.slice(-1)[0]?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, something like that. I forgot that wasn't a thing in JavaScript.

@murgatroid99 murgatroid99 merged commit 01ce272 into grpc:master Feb 27, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants