Skip to main content

Module wire

Module wire 

Source
Expand description

Canonical live wire form of a Card for language-binding APIs.

CardWire is the single, core-owned translation between a Card and the flat { kind, payloadItems, … } shape that the WASM and Python bindings exchange with JS/Python. Bindings serialize/deserialize this type instead of hand-rolling their own per-card conversion, so the field/comment/$-entry mapping lives in exactly one place.

§Why this is separate from the storage DTO

The versioned storage DTO (document::dto, e.g. CardV0_82_0) is frozen per schema version so persisted documents keep loading forever. CardWire is the current API shape and is free to evolve with the bindings. They are structurally similar today, but coupling the live API to a frozen storage schema would chain one to the other’s change cadence — so they are deliberately distinct, both built on the live Card/Payload model.

§Shape

The $ system entries are hoisted to named fields (kind, quill, id, ext); payload_items carries only user fields and comments, in order. Field/$ext nested comments are not represented here — they survive the Markdown and storage round-trips, not this editable projection.

Structs§

CardWire
Canonical live wire form of a Card. See the module docs.

Enums§

PathStepWire
One step in a nested fill path: an object key or an array index. Serializes untagged — a key as a JSON string, an index as a JSON number — so a path is a plain JS array like ["addr", "street"] or ["recipients", 0, "name"].
PayloadItemWire
One entry in a CardWire’s payload_items: a user field or a comment. The $ system entries are hoisted onto CardWire itself, never here.
WireError
Failure converting a CardWire back into a Card.