Skip to content

v1.0.0

Compare
Choose a tag to compare
@single9 single9 released this 20 Jan 09:04
· 38 commits to main since this release
v1.0.0
ad4958f

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 of new 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