A2uiSurfaces

The surfaces a transcript amounts to, and how to get a renderer from the last transcript to this one.

a2ui-core refuses to create a surface that exists, and upstream's middleware re-sends createSurface in every cumulative snapshot -- so a renderer fed the transcript's payloads as they came would throw on the second snapshot. This type sits between: it remembers what each carrier last had applied, and when a carrier's payload changes it deletes the surfaces that carrier created and replays the new payload whole. Delete-then-replay rather than a diff, because a snapshot is one document -- the specification's normative reading of replace -- and the cost is a redraw of one surface, which is what a new snapshot means anyway.

Immutable: accept returns the Step to the next value, and the caller that applied the step's messages keeps Step.next. A caller whose renderer rejected a batch keeps rejected instead, so this value never claims a surface the renderer does not hold.

The caller applies Step.deletes first and then each Step.batches entry as one atomic applyAll. A2uiRenderer.applyAll leaves its state untouched when a batch throws, which is why the batches are per carrier rather than one list: a payload one carrier got wrong costs that carrier's surfaces and nobody else's.

Types

Link copied to clipboard
object Companion
Link copied to clipboard
class Step

How to get from this value to next.

Properties

Link copied to clipboard

The surfaces the renderer holds after the last step was applied.

Functions

Link copied to clipboard

The step from this value to the one that reflects carried -- the transcript's payloads, in transcript order, as a2uiPayloads lists them.

Link copied to clipboard

This value with batch recorded as refused: the renderer threw on it and, since applyAll leaves its state alone when it throws, holds none of the batch's surfaces. Call on Step.next.