retrace_frontend/viewer

Default replay UI with replaceable typed data sources. Browser target only. Mount supplies scoped default styles; override them in your application’s stylesheet to customize presentation. Replay remains application-owned.

Types

pub type Artifact {
  Artifact(build: String, url: String, development: Bool)
}

Constructors

  • Artifact(build: String, url: String, development: Bool)
pub type Config {
  Config(
    source: Source,
    artifacts: fn(wire.Session) -> fn(
      fn(Result(Artifact, String)) -> Nil,
    ) -> fn() -> Nil,
    max_entries: Int,
    label_event: fn(EventLabel) -> String,
  )
}

Constructors

pub type EventLabel {
  EventLabel(
    sequence: Int,
    elapsed_ms: Int,
    kind: String,
    label: String,
  )
}

Constructors

  • EventLabel(
      sequence: Int,
      elapsed_ms: Int,
      kind: String,
      label: String,
    )
pub type Page {
  Page(batches: List(String), next: option.Option(Int))
}

Constructors

pub type Resolver =
  fn(wire.Session) -> fn(fn(Result(Artifact, String)) -> Nil) -> fn(
    ,
  ) -> Nil
pub type Source {
  Source(
    list_sessions: fn(String) -> fn(
      fn(Result(List(Summary), String)) -> Nil,
    ) -> fn() -> Nil,
    read_range: fn(String, Int, Int) -> fn(
      fn(Result(Page, String)) -> Nil,
    ) -> fn() -> Nil,
  )
}

Constructors

  • Source(
      list_sessions: fn(String) -> fn(
        fn(Result(List(Summary), String)) -> Nil,
      ) -> fn() -> Nil,
      read_range: fn(String, Int, Int) -> fn(
        fn(Result(Page, String)) -> Nil,
      ) -> fn() -> Nil,
    )
pub type Summary {
  Summary(session: wire.Session, sequence: Int)
}

Constructors

Start when called; reply once and return cancellation for pending work. Cancellation must release your resources. Late replies are ignored by mount.

pub type Task(value) =
  fn(fn(Result(value, String)) -> Nil) -> fn() -> Nil

Values

pub fn artifacts(
  directory: String,
) -> fn(wire.Session) -> fn(fn(Result(Artifact, String)) -> Nil) -> fn(
  ,
) -> Nil

Resolve //manifest.json under a trusted same-origin directory. Validates api, build and contract. Never substitutes the current build.

pub fn collector(endpoint: String) -> Source

HTTP routes matching retrace_server’s example collector, with a ten-second request deadline. Session search is bounded to the collector’s first page.

pub fn mount(
  config: Config,
  selector: String,
) -> Result(fn() -> Nil, String)

Mount owns DOM, playback clock and requests. Dispose before replacing the host. The disposer is idempotent. Artifacts must share the viewer’s origin.

pub fn new(
  source: Source,
  artifacts: fn(wire.Session) -> fn(
    fn(Result(Artifact, String)) -> Nil,
  ) -> fn() -> Nil,
) -> Config
pub fn with_development(
  resolver: fn(wire.Session) -> fn(
    fn(Result(Artifact, String)) -> Nil,
  ) -> fn() -> Nil,
  build: String,
  contract: String,
  url: String,
) -> fn(wire.Session) -> fn(fn(Result(Artifact, String)) -> Nil) -> fn(
  ,
) -> Nil

Explicit mutable development override; all other builds use the resolver.

✨ Search Document