Expand description
TypeScript target: emit the ergonomic type declarations a programmer writes against, plus the self-describing schema-bytes the peer parses at startup.
The emitted module depends only on @bearcove/phon-schema (the data plane):
the type declarations, a registry built from the schema-bytes, and the
per-root schemaId constants. Encode/decode wrappers (which need the engine)
belong to the RPC layer that imports this, not here.
The type shapes match what decodeTyped produces (r[codegen.emits]):
struct -> interface; enum -> { tag, … } discriminated union; small ints ->
number, 64/128-bit -> bigint; option -> T | null; map -> Map; char,
datetime, uuid, qname -> string.
Functions§
- render
- Render a whole
Moduleto a single TypeScript source file. - render_
registry - Render JUST a named phon
Registryformodule’s schemas (no type declarations, noschemaId). The generated source carries one canonicalSchemaBundleEnvelopeconstant and admits it through the language runtime. Used by RPC codegen, which supplies its own channel-aware declarations. - schema_
bundle_ bytes - Encode the complete schema closure carried by a generated module.