SquidSonar.Router (squid_sonar v0.2.0)

Copy Markdown View Source

Router helpers for mounting SquidSonar inside a Phoenix application.

The host owns its endpoint, authentication, layout, and deployment topology. SquidSonar contributes only the LiveView routes under the requested path.

Summary

Functions

Normalizes mount options for the generated SquidSonar route block.

Builds the LiveView session with the default manual-control actor.

Builds the LiveView session and resolves the configured manual-control actor.

Builds the LiveView session and resolves host-provided runtime spec options.

Builds the LiveView session and resolves host-provided runtime spec catalog options.

Returns the default manual-control actor used when the host does not provide one.

Mounts SquidSonar under the given path.

Functions

__options__(prefix, opts)

@spec __options__(
  String.t(),
  keyword()
) :: {atom(), keyword(), keyword()}

Normalizes mount options for the generated SquidSonar route block.

__session__(conn, prefix, live_path, live_transport)

@spec __session__(Plug.Conn.t() | map(), String.t(), String.t(), String.t()) :: map()

Builds the LiveView session with the default manual-control actor.

__session__(conn, prefix, live_path, live_transport, control_actor)

@spec __session__(Plug.Conn.t() | map(), String.t(), String.t(), String.t(), term()) ::
  map()

Builds the LiveView session and resolves the configured manual-control actor.

__session__(conn, prefix, live_path, live_transport, control_actor, runtime_spec, action_registry)

@spec __session__(
  Plug.Conn.t() | map(),
  String.t(),
  String.t(),
  String.t(),
  term(),
  term(),
  term()
) :: map()

Builds the LiveView session and resolves host-provided runtime spec options.

__session__(conn, prefix, live_path, live_transport, control_actor, runtime_spec, action_registry, runtime_options)

@spec __session__(
  Plug.Conn.t() | map(),
  String.t(),
  String.t(),
  String.t(),
  term(),
  term(),
  term(),
  term()
) :: map()

Builds the LiveView session and resolves host-provided runtime spec catalog options.

default_control_actor()

@spec default_control_actor() :: map()

Returns the default manual-control actor used when the host does not provide one.

squid_sonar(path, opts \\ [])

(macro)

Mounts SquidSonar under the given path.

scope "/" do
  pipe_through [:browser]

  squid_sonar "/sonar"
end

Supported options:

  • :as - route helper name for the mounted LiveView session.
  • :socket_path - LiveView socket path used by the host application. Defaults to "/live".
  • :transport - LiveView client transport. Use "websocket" or "longpoll". Defaults to "websocket".
  • :control_actor - actor persisted with Squidie manual approval and resume actions. Pass a non-empty binary, a non-empty map, or an MFA tuple {module, function, args}. MFA callbacks receive the current conn as their first argument.
  • :runtime_specs - host-approved workflow catalog used by the dashboard start drawer. Pass a keyword list or map of stable keys to workflow modules or runtime specs, or an MFA tuple {module, function, args}. Workflow module entries start through Squidie.start/3; runtime spec entries start through Squidie.start_spec/3.
  • :runtime_spec - single runtime-authored workflow spec used by the dashboard start drawer. Prefer :runtime_specs for new integrations. Pass a map/struct or an MFA tuple {module, function, args}.
  • :action_registry - host-owned action registry passed to Squidie.start_spec/3 for runtime spec entries. Pass a map, keyword list, or MFA tuple.
  • :saved_specs - host-owned saved workflow spec records surfaced by SquidSonar. Pass a keyword list or map of stable keys to saved-spec metadata, or an MFA tuple {module, function, args}. The host owns persistence, approval, action registry policy, and activation decisions.