actions/action_rpc.ts view source
ActionContext Per-request context provided to RPC action handlers.
Extends RouteContext with auth identity and logger.
auth is RequestContext | null — handlers for authenticated
actions can narrow via the auth middleware guarantee.
auth
The authenticated identity, or null for public routes.
RequestContext | nullrequest_id
The JSON-RPC request ID from the envelope.
db
Transaction-scoped for mutations, pool-level for reads.
background_db
Always pool-level — for fire-and-forget effects that outlive the transaction.
pending_effects
Fire-and-forget side effects — push here for post-response flushing.
Array<Promise<void>>client_ip
Resolved client IP from the trusted-proxy middleware — 'unknown' if the
middleware wasn't in the stack (e.g. WS dispatch) or couldn't resolve.
Thread into audit_log_fire_and_forget as ip: ctx.client_ip for every
user-initiated action so RPC audit rows match the REST convention. Pass
null only for rows written outside a request (e.g. the
permit_offer_expire cleanup sweep in auth/cleanup.ts).
stringlog
Logger instance.
Loggernotify
Send a request-scoped JSON-RPC notification to the originator.
On streaming transports (WebSocket) this routes to the originating
connection only. On the HTTP RPC transport this is a no-op with a
DEV-mode warn — non-streaming transports have no channel for mid-
request notifications. The streams field on an ActionSpec names
the notification method this handler is expected to emit.
(method: string, params: unknown) => voidsignal
AbortSignal that fires when the originating request is cancelled (client disconnect on HTTP, socket close on WebSocket). Streaming handlers should check this for early termination.
AbortSignal