Skip to main content
Version: Current

HonoOptions

@rotorsoft/act-root


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

Type Alias: HonoOptions<TApp>

HonoOptions<TApp> = object

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

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 leaves the call to the version the action loads; a number pins it, and a pinned conflict is never retried.
  • idempotency (optional) — when set, the route honors Idempotency-Key via withIdempotency. The host supplies the IdempotencyStore; keyFrom defaults to reading the Idempotency-Key header. A duplicate of a key that already succeeded gets 409 Conflict — the contract intentionally doesn't cache the original handler's result. A duplicate that arrives while the original is still running gets a retryable 503 + Retry-After instead, because the original may yet fail and release the key, and a client told "already used" would never retry.
  • basePath (optional, default "/api") — Hono basePath the routes mount under.

Type Parameters​

TApp​

TApp = ActSurface

Properties​

actor​

readonly actor: ActorExtractor<Context>

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


basePath?​

readonly optional basePath?: string

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


expectedVersion?​

readonly optional expectedVersion?: (...args) => number | undefined | Promise<number | undefined>

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

Parameters​

args​

...ResolverArgs<TApp, Context>

Returns​

number | undefined | Promise<number | undefined>


idempotency?​

readonly optional idempotency?: object

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

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:144

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: (...args) => string | Promise<string>

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

Parameters​

args​

...ResolverArgs<TApp, Context>

Returns​

string | Promise<string>