retrace_frontend/replay

Optional replay composition. Application-native types stay inside the artifact.

Types

pub type Error(error) {
  InvalidRange(String)
  InvalidReplay(retrace.Error(error))
}

Constructors

pub type ReplayModule(model, message, error) {
  ReplayModule(
    contract: String,
    decode_model: fn(String) -> Result(model, String),
    decode_event: fn(wire.Event) -> Result(message, String),
    reduce: fn(model, message) -> Result(model, error),
    equal: fn(model, model) -> Bool,
    view: fn(model) -> element.Element(message),
    viewport: fn(model) -> Viewport,
    label: fn(wire.Event) -> String,
  )
}

Constructors

  • ReplayModule(
      contract: String,
      decode_model: fn(String) -> Result(model, String),
      decode_event: fn(wire.Event) -> Result(message, String),
      reduce: fn(model, message) -> Result(model, error),
      equal: fn(model, model) -> Bool,
      view: fn(model) -> element.Element(message),
      viewport: fn(model) -> Viewport,
      label: fn(wire.Event) -> String,
    )
pub type Snapshot(model) {
  Snapshot(
    sequence: Int,
    elapsed_ms: Int,
    kind: String,
    label: String,
    model: model,
  )
}

Constructors

  • Snapshot(
      sequence: Int,
      elapsed_ms: Int,
      kind: String,
      label: String,
      model: model,
    )
pub type Viewport {
  Viewport(width: Int, height: Int)
}

Constructors

  • Viewport(width: Int, height: Int)

Values

pub fn describe(
  app: ReplayModule(model, message, error),
  snapshots: List(Snapshot(model)),
) -> String
pub fn load(
  app: ReplayModule(model, message, error),
  batches: List(wire.Batch),
  build: String,
  max_entries: Int,
) -> Result(List(Snapshot(model)), Error(error))

Loads a checkpoint plus contiguous entries; no effects are executed. A failed load returns no partially validated snapshots.

pub fn mount(
  app: ReplayModule(model, message, error),
  build: String,
  selector: String,
  max_entries: Int,
) -> Result(fn() -> Nil, lustre.Error)

Mount one trusted same-origin frame. Call the returned function to stop it. The host owns element lifetime; effects and live capture never run here.

pub fn mount_with_parent_origin(
  app: ReplayModule(model, message, error),
  build: String,
  selector: String,
  max_entries: Int,
  trusted_parent_origin: String,
) -> Result(fn() -> Nil, String)

Mount an opaque sandbox frame for an explicitly trusted HTTP(S) parent. Parent configuration must come from the trusted artifact assembler, never a recording, query parameter, referrer, or message. The viewer supplies the channel nonce through the iframe name before assigning its srcdoc document.

✨ Search Document