v1.0.0
Hi guys,
In this version, the major change is all source code is move from native JavaScript to TypeScript. Now, you can see more details in your IDE which have code intelligence.
BTW, I also use yarn instead of npm!
Changes:
- Move to TypeScript
- Add
initRPCClient
to instead ofnew RPCClient
- Add tests
- Fix bugs
- Improve types
Migration
The RPCClient
is no longer return the gRPC clitents after created. This is because of limitation of TypeScript[1]. So I add another function, initRPCClient
, to create clients.
Just replace new RPCClient
with initRPCClient
and your program will work like before.
const { RPCClient } = require("grpc-graphql-server");
- const rpcClient = new RPCClient({
+ const rpcClient = initRPCClient({
// protoFile: __dirname + '/protos', // Set this if your protobuf file doesn't located in the default directory.
packages: [
{
name: "helloworld",
services: [
{
name: "Greeter",
// port: 50052, // Uncomment this to set gRPC client port to 50052
},
],
},
],
});
[1]: Return type of constructor signature must be assignable to the instance type of the class.ts(2409)
Full Changelog: v0.6.2...v1.0.0