v2.0.0-alpha.1
Pre-release
Pre-release
srikrsna-buf
released this
01 Jul 14:48
·
106 commits
to v2
since this release
What's new in version 2
To support protobuf editions, @bufbuild/protobuf
had to make breaking changes, more on this here. Upgrading to v2
of @bufbuild/protobuf
will be breaking change for connect users.
The most notable change is that v2 doesn't require a separate plugin anymore! we only need protoc-gen-es
. For most users this will be a simple change of just removing the connect plugin and changing the import path to point to the protobuf generated types:
import { createPromiseClient } from "@connectrpc/connect";
import { createConnectTransport } from "@connectrpc/connect-node";
// Before this was import { ElizaService } from "./gen/eliza_connect.js"
import { ElizaService } from "./gen/eliza_pb.js";
// Alternatively, use createGrpcTransport or createGrpcWebTransport here
// to use one of the other supported protocols.
const transport = createConnectTransport({
httpVersion: "2",
baseUrl: "https://localhost:8443",
nodeOptions: { rejectUnauthorized },
});
const client = createPromiseClient(ElizaService, transport);
const res = await client.say({ sentence });
Please note that this is an alpha release, and APIs might still change. We're also missing documentation yet. But if you want to try it out, we welcome your feedback!
This release is published with the alpha
tag. To upgrade, you can run:
npm remove @connectrpc/protoc-gen-connect-es
npm install @connectrpc/connect@alpha @connectrpc/connect-node@alpha @bufbuild/protobuf@latest @bufbuild/protoc-gen-es@latest