@replit/river-codegen
v0.0.31
Published
codegenning river from grpc
Downloads
13,304
Maintainers
Keywords
Readme
@replit/river-codegen
River (the name we're giving the protocol by which the Workspace and pid2 communicate) is heavily inspired by and is a superset of gRPC. River also supports something called "stream with initialization message" to avoid a case of a client-side stream being forced to be a union of an initialization message and a stream message (make invalid states unrepresentable and all that).
This codebase is a way to have some interoperability between gRPC and River's wire format. That way services can be declared using mostly stock gRPC and implemented in another language / binary (e.g. Python) and then their River declarations exported as an npm package and consumed as a client in another codebase. This means that a service can have a single gRPC declaration and implementation with one adapter that can allow it to have a WebSockets River server.
Usage
pnpm add @replit/river-codegen
pnpm exec river-codegen --include-path proto proto/service.proto
This will codegen the service.proto
types that can be npm-packed and imported from repl-it-web.