connect-es

The TypeScript implementation of Connect: Protobuf RPC that works.

APACHE-2.0 License

Downloads
2.3M
Stars
1.3K
Committers
31

Bot releases are hidden (Show)

connect-es - v0.10.0

Published by smaye81 over 1 year ago

What's Changed

KeepAlive

As of this release, Connect-ES offers Basic Keepalive support for HTTP/2 for clients that use one of the transports from @bufbuild/connect-node. Note that this replaces the option keepSessionAlive, which is deprecated with this PR.

In it's most simple form, the following example enables regular PINGs every 5 minutes:

import { createConnectTransport } from "@bufbuild/connect-node";

const transport = createConnectTransport({
  httpVersion: "2",
  baseUrl: "https://demo.connect.build",
  pingIntervalMs: 1000 * 60 * 5,
});

For more information, see https://github.com/bufbuild/connect-es/pull/673

JSON parser ignores unknown fields by default

This release also changes the default behavior of the JSON parser so that unknown fields are ignored rather than rejected. Previously, Connect-ES followed the official guidance of the proto3 language spec and rejected unknown fields by default in parsing. However, this contradicts with the ethos that adding fields to a Protobuf definition should not be a breaking change. Therefore, the default behavior has been changed so any new/unknown fields are simply ignored.

Note that this could be considered a breaking change if consumers were relying on this rejection behavior.

Enhancements

Full Changelog: https://github.com/bufbuild/connect-es/compare/v0.9.1...v0.10.0

connect-es - v0.9.1

Published by timostamm over 1 year ago

What's Changed

Full Changelog: https://github.com/bufbuild/connect-es/compare/v0.9.0...v0.9.1

connect-es - v0.9.0

Published by timostamm over 1 year ago

What's Changed

As of this release, connect-es supports performing idempotent, side-effect free requests using HTTP GETs. This makes it easier to cache responses in the browser, on your CDN, or in proxies and other middleboxes.

Note
This functionality is only supported when using the Connect protocol—using a Connect client with a Connect server. When using any gRPC or gRPC-web client, including createGrpcTransport() and createGrpcWebTransport() from @bufbuild/connect-web or @bufbuild/connect-node, all requests will continue to be HTTP POSTs.

To opt into GET support for a given Protobuf RPC, you must mark it as being side-effect free using the MethodOptions.IdempotencyLevel option:

service ElizaService {
  rpc Say(stream SayRequest) returns (SayResponse) {
    option idempotency_level = NO_SIDE_EFFECTS;
  }
}

With this schema change, handlers will automatically support both GET and POST requests for this RPC. However, clients will continue to use POST requests by default, even when GETs are possible. To make clients use GETs for side effect free RPCs, set the useHttpGet option:

const transport = createConnectTransport({
  // ...
  useHttpGet: true
});

Another noteworthy change is the full support of timeouts, also known as deadlines in gRPC. For example, when a client provides the timeoutMs call option, a header Connect-Timeout-Ms is added to the request. The server parses this timeout, and if it takes longer than the given timeout to process the request, it should give up, and respond with the error code deadline_exceeded.

On a connect-es server, the parsed timeout is available as an AbortSignal on the context:

import type { HandlerContext } from "@bufbuild/connect";

const say = async (req: SayRequest, ctx: HandlerContext) => {

  ctx.signal.aborted; // true if timed out
  ctx.signal.reason; // an error with code deadline_exceed if timed out
  ctx.timeoutMs(); // the remaining time in milliseconds

  // raises an error with code deadline_exceed if timed out
  ctx.signal.throwIfAborted();

  // the AbortSignal can be passed to other functions
  await longRunning(ctx.signal);

  return new SayResponse({sentence: `You said: ${req.sentence}`});
};

Enhancements

Bugfixes

Breaking changes

New Contributors

Full Changelog: https://github.com/bufbuild/connect-es/compare/v0.8.6...v0.9.0

connect-es -

Published by timostamm over 1 year ago

connect-node

connect

Other changes

New Contributors

Full Changelog: https://github.com/bufbuild/connect-es/compare/v0.8.5...v0.8.6

connect-es - v0.8.5

Published by smaye81 over 1 year ago

This release contains the following:

connect-node

Fixes

  • Abort HTTP/2 streams with RST_STREAM code CANCEL by @timostamm in #552.

connect

Enhancements

  • Move transport implementations to the @bufbuild/connect package by @timostamm in #546.
  • Add a ConnectRouter based Transport by @srikrsna-buf in #548.

Fixes

  • Fix package definitions for Connect by @smaye81 in #553.
  • Avoid the AbortController constructor during init by @timostamm in #554.

Full Changelog: https://github.com/bufbuild/connect-es/compare/v0.8.4...v0.8.5

connect-es - v0.8.4

Published by smaye81 over 1 year ago

If you are coming from v0.7.0 or earlier, make sure to take a look at the release notes of v0.8.0!

connect-next

We have officially added support for Next.js via the new @bufbuild/connect-next package! See the docs as well as #533 for more information.

connect-node

@bufbuild/connect-node now officially supports Node v19.

Fixes

  • Fix socket connect issue in Node 19 by @smaye81 in #532.
  • Fix unhandledRejection when aborting a server stream using @bufbuild/connect-node by @johynpapin in #530.

connect

Enhancements

  • Export CORS constants for convenience by @timostamm in #526.

Fixes

  • Fix the gRPC User-Agent header name by @timostamm in #525.
  • Add opt-in support for servers for the Connect-Protocol-Version header by @timostamm in #520.

New Contributors

  • @johynpapin made their first contribution in #530.

Full Changelog: https://github.com/bufbuild/connect-es/compare/v0.8.3...v0.8.4

connect-es - v0.8.3

Published by smaye81 over 1 year ago

If you are coming from v0.7.0 or earlier, make sure to take a look at the release notes of v0.8.0!

This release contains the following:

connect-fastify

Fixes

  • Fix response header management in Fastify plugin by @smaye81 in #517.

Full Changelog: https://github.com/bufbuild/connect-es/compare/v0.8.2...v0.8.3

connect-es - v0.8.2

Published by smaye81 over 1 year ago

If you are coming from v0.7.0 or earlier, make sure to take a look at the release notes of v0.8.0!

This release contains the following:

Connect for Node.js

Fixes

  • Remove error from polyfill by @smaye81 in #510.

protoc-gen-connect-es

Fixes

  • Add @bufbuild/protobuf to dependencies by @fubhy in #496.

Full Changelog: https://github.com/bufbuild/connect-es/compare/v0.8.1...v0.8.2

connect-es - v0.8.1

Published by timostamm over 1 year ago

If you are coming from v0.7.0 or earlier, make sure to take a look at the release notes of v0.8.0!

Bugfixes

connect-es - v0.8.0

Published by smaye81 over 1 year ago

This repository now hosts Connect for Web, but also for Node.js. We changed the name to Connect-ES to reflect the universal nature. As part of the reorganization, this release includes new features, but also some breaking changes.

Connect for Web

This is the first release that shares important bits of code between the web and the Node implementation, and comes with some bug fixes and new features:

  • Allow JSON in the gRPC-web transport of @bufbuild/connect-web #334
  • Emit unpadded base64 for binary headers #454
  • Way to recover from errors caused by non-compliant response body #469
  • Switch @bufbuild/connect-web to use @bufbuild/connect #471

If you are using Interceptors, please note the breaking change described in #471.

Otherwise, this release is backwards compatible, but we kindly ask you to install @bufbuild/connect, and import ConnectError and other types from there. In the future, @bufbuild/connect-web will only export the Connect and gRPC-web transports.

Connect for Node.js

The Handlers introduced in the preview are gone! With the new ConnectRouter, we can support more frameworks, and this release adds adapters for Express and Fastify:

  • Rename @bufbuild/connect-core to @bufbuild/connect #473
  • Add support for Express #479
  • Add support for Fastify #474
  • Polyfill headers in connect-node #462

If you have been using Connect for Node, please remove @bufbuild/connect-core, install @bufbuild/connect instead, and update your imports. See here how to use ConnectRouter with a Node.js server.

protoc-gen-connect-web

The code generator plugin has been renamed to @bufbuild/protoc-gen-connect-es. The old one is still available, so you don't have to update right away. See here how to update.

Other changes

  • NodeNext module resolution by @fubhy in #485
connect-es - v0.7.0

Published by timostamm over 1 year ago

This is the first release of Connect for Node.js - clients and servers for Node.js, with support for the gRPC, gRPC-web and Connect's own protocol: @bufbuild/connect-node

Connect-Node is still in preview, so we want your feedback! We’d love to learn about your use cases and what you’d like to do with Connect-Node. For example, do you plan to use it with React, Remix, or on the edge with Vercel’s Edge Runtime? You can reach us either through the Buf Slack or by filing a GitHub issue and we’d be more than happy to chat!

This release does not make any changes to @bufbuild/connect-web or the code generator protoc-gen-connect-web.

connect-es - v0.6.0

Published by gilwong00 almost 2 years ago

This release includes the following:

🚨 Breaking Changes 🚨

  • #370 - The Connect protocol now specifies that a header be set specifying the version of Connect in use. The header name is Connect-Protocol-Version and Connect-Web has been updated to send this header in its requests. As a result, users will need to make sure their CORS settings allowlist this new header, or all Connect requests will fail with this release.

    For more information, see this PR: https://github.com/bufbuild/connect-go/pull/416

Enhancements

  • Add Connect Protocol Version Header by @gilwong00 in #370
connect-es - v0.5.0

Published by smaye81 almost 2 years ago

This release includes the following:

Enhancements

  • Upgrade to protobuf-es ^1.0.0 by @smaye81 in #377
connect-es - v0.4.0

Published by smaye81 almost 2 years ago

This release includes the following:

Enhancements

  • Upgrade to protobuf-es v0.5.0 by @smaye81 in #373
connect-es - v0.3.3

Published by smaye81 almost 2 years ago

This release includes the following:

Enhancements

  • Upgrade to protobuf-es v0.4.0 by @smaye81 #361
connect-es - v0.3.2

Published by smaye81 almost 2 years ago

This release includes the following:

Enhancements

  • Upgrade to protobuf-es v0.3.0 by @smaye81 #337
connect-es - v0.3.1

Published by smaye81 almost 2 years ago

Enhancements

  • Upgrade to protobuf-es v0.2.1 by @smaye81 #309
connect-es - v0.3.0

Published by smaye81 almost 2 years ago

Enhancements

  • Upgrade to protobuf-es v0.2.0 by @smaye81 #292
  • Respect binary encoding options in the connect transport by @timostamm #274
  • Deprecate ConnectError constructor by @timostamm #272

Bugfixes

  • Fix await res.json() in package README by @timostamm #269
  • Fix await res.json() in top-level README by @nguyenyou #268
  • Fix: raise a ConnectError with Code.Canceled from StreamResponse.read() by @timostamm #267

New Contributors

@nguyenyou made their first contributions in #268

connect-es - v0.2.1

Published by smaye81 about 2 years ago

Documentation

  • Fix protoc option in protoc-gen-connect-web/README.md by @ymmt2005 in #258

Bug Fixes

  • Fixes type prop in conditional exports by @smaye81 in #248. This adds support for TypeScript compiler option of moduleResolution: "NodeNext".

New Contributors

@ymmt2005 made their first contribution in #258.

connect-es - v0.2.0

Published by smaye81 about 2 years ago

Enhancements

  • Add automated browser tests and BrowserStack integration by @timostamm in #243.
  • Updates dependencies for protobuf-es packages by @smaye81 in #242. Note that this includes important bugfixes in protobuf-es 0.1.0. See the release there for more details.
  • Point to CommonJS in entrypoint by @smaye81 in #237.
  • Add example project to show usage of connect-web by @timostamm in #215.
  • Add code generation examples to protoc-gen-connect-web README.md by @timostamm in #240.
  • Switch from deprecated TypeRegistry to createRegistry() by @timostamm in #225.

Bug Fixes

  • Fix streams lagging behind by @timostamm in #235. Special thanks to @aslatemts for catching the bug and suggesting a fix.

New Contributors

@vipero07 made their first contribution in #232