StarView.Events (star_view v0.7.0)

Copy Markdown View Source

Opt-in event contracts derived from actual handle_event/3 clauses.

Enable with checked_events: true on use StarView, StarView.Page or StarView.Component. Each named clause must use a literal event string and a literal HTTP method in its conn pattern. Wildcard clauses are fallbacks, not additional public events. There is no separate event registration list.

Literal local request helpers in ~STAR are checked when the module finishes compiling. Both dispatchers reject unknown events and wrong methods before starting SSE. Input validation and authorization remain the handler's job.

Summary

Functions

Checks a request against an opt-in contract before SSE starts.

Functions

validate_request(conn, module, event)

Checks a request against an opt-in contract before SSE starts.

Unchecked modules retain their existing behavior. Returns :ok or {:error, conn} with a halted HTTP 404/405 response.