Reference · SDK

eventState(data, picked?)

functiontechne-sdk/versionsIn React, useEvent

One record as its versions. It turns a commons.getVersions answer into what a screen shows: each field's value, the version it is from, and how many ranked versions disagree on it.

The platform's commons.getVersions answers the curated record and every version. eventState ranks and groups them with the curator's own Rust, run as WebAssembly, so your screen and the curator cannot disagree. Read the answer with techne.platform, then pass it in.

Parameters

NameTypeWhat it is
datarequiredgetVersions outputWhat commons.getVersions answered for the record.
pickedstring | nullA version's URI to show instead of the default composition. null (the default) shows the composition.

Returns EventState

NameTypeWhat it is
fields{ [field]: FieldState }Each field shown, as { value, from, conflicts }. conflicts is there when 2 or more ranked versions give different values.
bylineVersionRefWhose version speaks first: the composition's byline, or the version picked.
versionsVersionEntry[]Every version, grouped sources, verified and others, each with the fields where it differs from what is shown.
pickedstring | nullThe version picked, or null.
leftOutnumberVersions the platform left out for a verdict (spam, obscene).

Ranks are 1 for a source the commons root endorses, 2 for a verified account or a member of an endorsed collective, and 3 for everyone else. A rank 3 version never raises a conflict. versionPill(state) and fieldConflict(state, field) give the pill and the field badge.

One park as its versions
In React

useEvent reads with your load, holds the version the person picked (pick), and answers the same state.

Reads commons.getVersions; computes in the browser