Skip to main content

HonoOptions

@rotorsoft/act-root


@rotorsoft/act-root / act-http/src/hono / HonoOptions

Type Alias: HonoOptions

HonoOptions = object

Defined in: libs/act-http/src/hono/index.ts:102

Per-call options for hono. The host supplies the four seams the package can't make decisions on:

  • actor โ€” auth resolver. Receives the Hono context, returns the Actor that flows onto c.get("actor") for every generated route (via an internal authenticated).
  • stream โ€” stream-id resolver. Receives the action name, the validated body, and the Hono context; returns the target stream. Singleton aggregates return a constant; per-tenant aggregates pull from headers, path, or body.
  • expectedVersion (optional) โ€” optimistic-concurrency resolver. Hosts typically read it from an If-Match header on the request, or from the client's last-known snapshot. Returning undefined skips the check for that call โ€” handy when only some actions are concurrency-sensitive.
  • idempotency (optional) โ€” when set, the route honors Idempotency-Key via withIdempotency. The host supplies the IdempotencyStore; keyFrom defaults to reading the Idempotency-Key header. On a duplicate claim, the route responds 409 Conflict โ€” the contract intentionally doesn't cache the original handler's result, matching the receiver-side "ack the duplicate" semantics.
  • basePath (optional, default "/api") โ€” Hono basePath the routes mount under.

Propertiesโ€‹

actorโ€‹

readonly actor: ActorExtractor

Defined in: libs/act-http/src/hono/index.ts:103


basePath?โ€‹

readonly optional basePath?: string

Defined in: libs/act-http/src/hono/index.ts:135


expectedVersion?โ€‹

readonly optional expectedVersion?: (action_name, input, c) => number | undefined | Promise<number | undefined>

Defined in: libs/act-http/src/hono/index.ts:109

Parametersโ€‹

action_nameโ€‹

string

inputโ€‹

unknown

cโ€‹

Context

Returnsโ€‹

number | undefined | Promise<number | undefined>


idempotency?โ€‹

readonly optional idempotency?: object

Defined in: libs/act-http/src/hono/index.ts:114

keyFrom?โ€‹

readonly optional keyFrom?: (c) => string | undefined

Parametersโ€‹
cโ€‹

Context

Returnsโ€‹

string | undefined

storeโ€‹

readonly store: IdempotencyStore


sse?โ€‹

readonly optional sse?: SseOptions

Defined in: libs/act-http/src/hono/index.ts:134

Optional SSE wiring. When set, the generator emits one GET <basePath>/sse/<stateName>?stream=<streamId> per unique state name in the registry. The endpoint runs the host actor extractor, looks up the streamId from ?stream=..., opens a text/event-stream, yields the cached state (if any), and forwards every patch published to the shared SseOptions.channel. A heartbeat keeps proxies from idling the connection out; the per-process connection cap returns 503 Service Unavailable (with Retry-After: 1) when full so operators never see silent stalls.

Off by default โ€” most APIs don't expose live state to every client, and opening one is widening both the auth and cost surface.


streamโ€‹

readonly stream: (action_name, input, c) => string | Promise<string>

Defined in: libs/act-http/src/hono/index.ts:104

Parametersโ€‹

action_nameโ€‹

string

inputโ€‹

unknown

cโ€‹

Context

Returnsโ€‹

string | Promise<string>