Type Alias: BusWire
type BusWire =
| {
clientId: string;
key: string;
kind: PeerKind;
scope: "state";
type: "patch";
v: 1;
value: unknown;
version: Version;
}
| {
clientId: string;
kind: PeerKind;
scope: "state";
type: "hello";
v: 1;
}
| {
clientId: string;
kind: PeerKind;
scope: "state";
state: Record<string, unknown>;
type: "snapshot";
v: 1;
versions: Record<string, Version>;
}
| {
clientId: string;
kind: PeerKind;
scope: "presence";
type: "hello" | "ping" | "bye";
v: 1;
}
| {
clientId: string;
kind: PeerKind;
scope: "leader";
type: "hello";
v: 1;
}
| {
clientId: string;
kind: PeerKind;
scope: "leader";
term: Version;
type: "claim" | "heartbeat" | "resign";
v: 1;
}
| {
clientId: string;
kind: PeerKind;
msgId: string;
payload: unknown;
scope: "event";
type: string;
v: 1;
};
Everything on the same-origin bus, multiplexed by scope over one BroadcastChannel per name.
Union Members
Type Literal
{
clientId: string;
key: string;
kind: PeerKind;
scope: "state";
type: "patch";
v: 1;
value: unknown;
version: Version;
}
Type Literal
{
clientId: string;
kind: PeerKind;
scope: "state";
type: "hello";
v: 1;
}
Type Literal
{
clientId: string;
kind: PeerKind;
scope: "state";
state: Record<string, unknown>;
type: "snapshot";
v: 1;
versions: Record<string, Version>;
}
Type Literal
{
clientId: string;
kind: PeerKind;
scope: "presence";
type: "hello" | "ping" | "bye";
v: 1;
}
Type Literal
{
clientId: string;
kind: PeerKind;
scope: "leader";
type: "hello";
v: 1;
}
Type Literal
{
clientId: string;
kind: PeerKind;
scope: "leader";
term: Version;
type: "claim" | "heartbeat" | "resign";
v: 1;
}
clientId
clientId: string;
kind
kind: PeerKind;
scope
scope: "leader";
term
term: Version;
The claimant's term. Arbitrated with newer() — the same clock the store uses.
type
type: "claim" | "heartbeat" | "resign";
v
v: 1;
Type Literal
{
clientId: string;
kind: PeerKind;
msgId: string;
payload: unknown;
scope: "event";
type: string;
v: 1;
}