Provides the threadline_operator_surface/2 macro to mount the
Threadline LiveView interface within a Phoenix router.
This module enforces a secure-by-default mount by requiring either:
- A
pipe_throughdirective in the enclosing router scope. - An explicit
:authorize_fnoption. - An explicit
:adopter_acknowledges_unauthenticatedoption.
Export endpoints (Phase 65+)
When phoenix is available at compile time, the macro also emits a
sibling scope <path>/exports block with three GET routes —
/changes.csv, /changes.json, /changes.ndjson — backed by
Threadline.OperatorSurface.Controllers.ExportController. The export
endpoints are guarded by Threadline.OperatorSurface.ExportAuthPlug
(Conn-shaped twin of Threadline.OperatorSurface.Auth.on_mount/4).
The sibling scope is OUTSIDE the live_session :threadline block
because live_session's on_mount callback does not apply to get/3
routes; the controller scope needs its own auth plug. LiveDashboard
alias: false, as: false hygiene is preserved so the host's alias
namespace is not polluted.
Options (Phase 65+)
:exports(boolean, defaulttrue) — set tofalseto suppress the sibling export-controller scope (rare LV-only adopters).:scope_query_fn((Ecto.Query.t(), scope, %{surface: atom(), params: map()} -> Ecto.Query.t()), optional) — host-owned query transform used when:authorize_fnreturns{:ok, scope}. Threadline treatsscopeas opaque data and calls this function for timeline, actor-history, transaction, and export flows.:export_authorize_fn((Plug.Conn.t() -> :ok | true | {:ok, scope} | _), default delegates to:authorize_fnvia a synthetic%{assigns: conn.assigns}mirror) — Conn-shaped authorize callback for HTTP requests. The v1.17:authorize_fn.(socket)contract is preserved verbatim; this is an additive opt that lets adopters provide a separate callback for the HTTP-side surface if they need one (rare — the synthetic mirror is sufficient for most cases since adopter functions typically only accessassigns.current_useror similar).