Files
rose-ash/web/io.sx
giles ede05c26f5 IO registry: defio declares platform suspension points
Core SX has zero IO — platforms extend __io-registry via (defio name
:category :data/:code/:effect ...). The server web platform declares 44
operations in web/io.sx. batchable_helpers now derived from registry
(:batchable true) instead of hardcoded list. Startup validation warns if
bound IO ops lack registry entries. Browser gets empty registry, ready
for step 5 (IO suspension).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 23:21:48 +00:00

319 lines
5.3 KiB
Plaintext

(defio
"query"
:category :data
:params (service name &rest kwargs)
:returns "any"
:doc "Fetch data from another service.")
(defio
"action"
:category :effect
:params (service name &rest kwargs)
:returns "any"
:doc "Execute a mutation on another service.")
(defio
"helper"
:category :data
:params (name &rest args)
:returns "any"
:doc "Call a page helper function.")
(defio
"frag"
:category :data
:params (service type &rest kwargs)
:returns "string"
:doc "Fetch HTML fragment from another service.")
(defio
"service"
:category :data
:params (service-or-method &rest args)
:returns "any"
:doc "Call a domain service method.")
(defio
"request-arg"
:category :data
:params (name &optional default)
:returns "any"
:doc "Read a URL query parameter.")
(defio
"request-method"
:category :data
:params ()
:returns "string"
:doc "Current HTTP method.")
(defio
"request-path"
:category :data
:params ()
:returns "string"
:doc "Current request path.")
(defio
"request-form"
:category :data
:params (name &optional default)
:returns "any"
:doc "Read a form field.")
(defio
"request-json"
:category :data
:params ()
:returns "dict?"
:doc "Read JSON body.")
(defio
"request-header"
:category :data
:params (name &optional default)
:returns "string?"
:doc "Read a request header.")
(defio
"request-content-type"
:category :data
:params ()
:returns "string?"
:doc "Content-Type of current request.")
(defio
"request-args-all"
:category :data
:params ()
:returns "dict"
:doc "All query parameters as dict.")
(defio
"request-form-all"
:category :data
:params ()
:returns "dict"
:doc "All form fields as dict.")
(defio
"request-form-list"
:category :data
:params (field)
:returns "list"
:doc "Multi-value form field.")
(defio
"request-headers-all"
:category :data
:params ()
:returns "dict"
:doc "All request headers as dict.")
(defio
"request-file-name"
:category :data
:params (field)
:returns "string?"
:doc "Uploaded file name by field.")
(defio
"request-view-args"
:category :data
:params (key)
:returns "any"
:doc "URL path parameter.")
(defio
"ctx"
:category :data
:params (key)
:returns "any"
:doc "Read from render context.")
(defio
"current-user"
:category :data
:params ()
:returns "dict?"
:doc "Current authenticated user.")
(defio
"htmx-request?"
:category :data
:params ()
:returns "boolean"
:doc "Is this an HTMX request?")
(defio
"csrf-token"
:category :data
:params ()
:returns "string"
:doc "Current CSRF token.")
(defio
"app-rights"
:category :data
:params ()
:returns "dict"
:doc "Current user's rights.")
(defio
"nav-tree"
:category :data
:params ()
:returns "list"
:cacheable true
:doc "Navigation structure.")
(defio
"get-children"
:category :data
:params (&rest kwargs)
:returns "list"
:doc "Child entities.")
(defio
"relations-from"
:category :data
:params (entity-type)
:returns "list"
:cacheable true
:doc "Relation definitions for entity type.")
(defio
"config"
:category :data
:params (key)
:returns "any"
:cacheable true
:doc "Read from host configuration.")
(defio
"jinja-global"
:category :data
:params (key &optional default)
:returns "any"
:doc "Read a Jinja global.")
(defio
"url-for"
:category :data
:params (endpoint &rest kwargs)
:returns "string"
:doc "Generate URL for endpoint.")
(defio
"route-prefix"
:category :data
:params ()
:returns "string"
:doc "Service URL prefix.")
(defio
"app-url"
:category :data
:params (service &optional path)
:returns "string"
:cacheable true
:doc "Full URL for a service.")
(defio
"asset-url"
:category :data
:params (&rest path)
:returns "string"
:cacheable true
:doc "Versioned static asset URL.")
(defio
"set-response-status"
:category :effect
:params (status)
:returns "nil"
:doc "Set HTTP response status code.")
(defio
"set-response-header"
:category :effect
:params (name value)
:returns "nil"
:doc "Set HTTP response header.")
(defio
"abort"
:category :effect
:params (status &optional message)
:returns "nil"
:doc "Raise HTTP error.")
(defio
"state-get"
:category :data
:params (key &optional default)
:returns "any"
:doc "Read ephemeral per-process state.")
(defio
"state-set!"
:category :effect
:params (key value)
:returns "nil"
:doc "Write ephemeral per-process state.")
(defio
"now"
:category :data
:params (&optional fmt)
:returns "string"
:doc "Current timestamp.")
(defio
"sleep"
:category :effect
:params (ms)
:returns "nil"
:doc "Pause execution.")
(defio
"g"
:category :data
:params (key)
:returns "any"
:doc "Read from Quart g object.")
(defio
"json-encode"
:category :code
:params (&rest values)
:returns "string"
:cacheable true
:doc "JSON-serialize values.")
(defio
"into"
:category :code
:params (&rest args)
:returns "any"
:cacheable true
:doc "Template composition.")
(defio
"highlight"
:category :code
:params (code &optional lang)
:returns "sx-source"
:batchable true
:cacheable true
:doc "Syntax-highlight code.")
(defio
"component-source"
:category :code
:params (name)
:returns "string"
:batchable true
:cacheable true
:doc "Pretty-printed component source.")