Skip to content

Code generation

A conforming generator MUST produce:

  • Types for every named type. i64/u64 map to bigint; timestamp to Date; bytes to Uint8Array; any to the runtime’s item type (CborItem in the reference client).
  • A typed proxy per service for server methods:
    • unary → (args..., opts?) => Promise<R>
    • server stream → AsyncIterable<Y>
    • client stream → accepts an AsyncIterable<A> and returns Promise<R>
    • bidi → accepts an AsyncIterable<A> and returns AsyncIterable<Y>
    • notify → (args...) => void
    • options include signal: AbortSignal (→ CANCEL), deadline, meta.
  • A typed registration surface for client methods (handlers for calls and notifications).
  • Typed channel subscriptions exposing the snapshot (§10.2), publications, presence and the recovery position.
  • Typed datagram send/receive per topic.
  • Typed errors: ERROR frames surface as an error class carrying the status code, message and typed detail.
  • The manifest fingerprint embedded in the generated code and sent in HELLO.

From the specification: §12.4.