Std.Live
Std.Live — server-driven web UI backend (Layer 3 Sky source).
Types
type AppConfig = AppConfig_OPAQUE
Values
api : String -> (Request -> Task Error Response) -> Route
`api path handler` — register a raw JSON/HTTP endpoint alongside the
app : AppConfig model msg -> Task Error ()
Open the HTTP listener and run the TEA loop. Sits at the top of `main`.
bindSessionUser : String -> Task Error ()
`bindSessionUser userId` — bind the CURRENT live session to an application
config : { init : a -> ( model, Cmd msg ) , update : msg -> model -> ( model, Cmd msg ) , view : model -> Html msg , subscriptions : model -> Sub msg , routes : List Route , notFound : page } -> AppConfig model msg
Build the app config from the six required fields. Attach optional
lifecycle : msg -> msg
Tag a message as a lifecycle message (identity at the type level; the
route : String -> page -> Route
`route path page` — register a page route. Put literals before
withAnalytics : { pageViews : Bool } -> AppConfig model msg -> AppConfig model msg
Opt into Sky.Live auto page-view analytics —
withAnalyticsIdentify : (model -> Maybe String) -> AppConfig model msg -> AppConfig model msg
Attribute auto page-views to an already-authenticated session: a resolver
withAuthSliding : { cookie : String , secretEnv : String , sameSite : String , revokedCheck : Maybe (String -> Task Error Bool) } -> AppConfig model msg -> AppConfig model msg
Opt into SLIDING (rolling) auth tokens — the middleware re-issues a
withConsoleAuth : (Request -> Task Error (Maybe a)) -> AppConfig model msg -> AppConfig model msg
Gate the `/_sky/console` mount — `consoleAuth req` returns the
withGuard : (msg -> model -> Result Error ()) -> AppConfig model msg -> AppConfig model msg
Per-Msg guard — `guard msg model` returns `Err` to reject the message
withHead : (model -> List (Html msg)) -> AppConfig model msg -> AppConfig model msg
Per-page `<head>` injection — `head model` returns the extra `<head>`
withIdleEvict : String -> AppConfig model msg -> AppConfig model msg
Tiered-session-cache idle-evict window ("5m" / "0"/"off" to disable).
withInput : String -> AppConfig model msg -> AppConfig model msg
When the JS driver reports an input's value: `"debounce"` (after a typing
withMaxBodyBytes : Int -> AppConfig model msg -> AppConfig model msg
Maximum bytes accepted on a single TEA event request (the channel that
withOnNavigate : (page -> msg) -> AppConfig model msg -> AppConfig model msg
Hook fired on in-app navigation (initial mount, `sky-nav` fetch,
withPort : Int -> AppConfig model msg -> AppConfig model msg
Set the listen port.
withRevocation : Db -> AppConfig model msg -> AppConfig model msg
Opt into PULL-model user revocation + suspension. Hand the runtime the
withStatic : String -> AppConfig model msg -> AppConfig model msg
Serve a static directory at `/static` (override the mount with
withStaticUrl : String -> AppConfig model msg -> AppConfig model msg
Override the static mount path (default `/static`).
withStatus : { reconnecting : String , offline : String } -> AppConfig model msg -> AppConfig model msg
Override the connection-status banner strings —
withStore : String -> AppConfig model msg -> AppConfig model msg
Select the session store kind ("memory" / "sqlite" / "redis" /
withStorePath : String -> AppConfig model msg -> AppConfig model msg
Session store path / URL.
withTtl : String -> AppConfig model msg -> AppConfig model msg
Session TTL ("30m" / "24h" / bare seconds).