Insider.Observability.MockEvent (Insider v0.1.0)

Copy Markdown View Source

A canonical, provider-shaped mock event derived from an observability export.

Mock events are inert local values. mock is always true, delivery is always not_attempted, and the handoff metadata assigns any asynchronous handling to the host application. This module has no transport operation and mapping a value is not evidence that a provider accepted it.

Summary

Functions

Maps an exact capsule-bound export to a provider-shaped mock value.

Recomputes the entire mapping from the referenced capsule and compares it.

Types

t()

@type t() :: %Insider.Observability.MockEvent{
  body: term(),
  delivery_status: term(),
  export: term(),
  handoff: term(),
  id: term(),
  idempotency_key: term(),
  mock: term(),
  provider: term(),
  schema: term()
}

Functions

canonical_binary(event)

@spec canonical_binary(term()) ::
  {:ok, binary()} | {:error, Insider.Protocol.Error.t()}

decode(binary)

@spec decode(binary()) :: {:ok, t()} | {:error, Insider.Protocol.Error.t()}

decode_map(wire)

@spec decode_map(term()) :: {:ok, t()} | {:error, Insider.Protocol.Error.t()}

new(export, capsule, expected_provider)

Maps an exact capsule-bound export to a provider-shaped mock value.

expected_provider prevents a provider-specific adapter from accepting an export addressed to the other provider.

to_wire_map(event)

@spec to_wire_map(t()) :: map()

validate(event)

@spec validate(term()) :: {:ok, t()} | {:error, Insider.Protocol.Error.t()}

validate_against_capsule(event, capsule)

@spec validate_against_capsule(term(), term()) ::
  {:ok, t()} | {:error, Insider.Protocol.Error.t()}

Recomputes the entire mapping from the referenced capsule and compares it.