nori_asyncapi/codegen/typescript

TypeScript generator for AsyncAPI.

Emits payload interfaces, a small transport runtime (WebSocket + SSE behind one Transport interface), and one typed class per channel.

Direction is inverted to the client’s point of view: AsyncAPI action is written from the application (server) side, so a server send becomes a client on* subscription and a server receive becomes a client send* publish. Channel address variables become a typed connect parameter.

Values

pub fn generate(spec: ir.AsyncCodegenIR) -> String

Generate the neutral TypeScript client: payload interfaces, the transport runtime, and one typed class per channel. No framework dependency.

pub fn generate_gateway(spec: ir.AsyncCodegenIR) -> String

Generate a single gateway client (payload types + one multiplexing client).

pub fn generate_stores(
  spec: ir.AsyncCodegenIR,
  client_module: String,
) -> String

Generate the neutral store layer: one create*Store observable per subscribe message, shaped for useSyncExternalStore (or any framework’s subscribe/snapshot store). Imports the channel classes and payload types from client_module (e.g. "./client"). Framework-agnostic — imports no UI library.

Search Document