TrpcOptions
@rotorsoft/act-root / act-http/src/trpc / TrpcOptions
Type Alias: TrpcOptions<Ctx, TApp>
TrpcOptions<
Ctx,TApp> =object
Defined in: libs/act-http/src/trpc/index.ts:121
Per-call options for trpc. The host supplies the three seams the package can't make decisions on:
actor— auth resolver. Receives the tRPC context, returns theActorthat flows ontoctx.actorfor every generated procedure (via an internal authenticated).stream— stream-id resolver. Receives the action name, the validated action input, and the original tRPC context; returns the target stream. Singleton aggregates return a constant; per-tenant aggregates pull from input or context.expectedVersion(optional) — optimistic-concurrency resolver. When set, the procedure threads the resolved value throughtarget.expectedVersionsoapp.dorefuses to commit if the stream has moved. Hosts typically read it from anIf-Matchheader on the underlying HTTP request, or pull it from the client's last-known snapshot. Returningundefinedleaves the call to the version the action loads; a number pins it, and a pinned conflict is never retried.idempotency(optional) — when set, the procedure honorsIdempotency-Keyvia the shared withIdempotency helper. The host supplies theIdempotencyStoreand akeyFromextractor that reads the key out of the tRPC context (typically a header). A duplicate of a key that already succeeded throws aCONFLICTTRPCError— the receiver-side convention of "ack the duplicate" doesn't carry over because the contract intentionally does not cache the original handler's result. A duplicate that arrives while the original is still running throws a retryableSERVICE_UNAVAILABLE(503) instead: the original may yet fail and release the key, and a client told "already used" would never retry.
Type Parameters
Ctx
Ctx
The host's tRPC context shape. Flows end-to-end —
procedures see this exact context type (plus actor) at
runtime.
TApp
TApp = ActSurface
Properties
actor
readonlyactor:ActorExtractor<Ctx>
Defined in: libs/act-http/src/trpc/index.ts:122
expectedVersion?
readonlyoptionalexpectedVersion?: (...args) =>number|undefined|Promise<number|undefined>
Defined in: libs/act-http/src/trpc/index.ts:126
Parameters
args
...ResolverArgs<TApp, NoInfer<Ctx>>
Returns
number | undefined | Promise<number | undefined>
idempotency?
readonlyoptionalidempotency?:object
Defined in: libs/act-http/src/trpc/index.ts:129
keyFrom
readonlykeyFrom: (ctx) =>string|undefined
Parameters
ctx
Ctx
Returns
string | undefined
store
readonlystore:IdempotencyStore
sse?
readonlyoptionalsse?:SseOptions
Defined in: libs/act-http/src/trpc/index.ts:148
Optional SSE wiring. When set, the generator emits one
subscription per unique state name in the registry, grouped on
the returned router as
router.subscribe.<stateName>.useSubscription({ stream }).
Each subscription yields { kind: "state", data } once with
the cached state (when present) and then { kind: "patch", data } for every patch the shared
SseOptions.channel publishes. The per-process
connection cap surfaces as a TOO_MANY_REQUESTS TRPCError.
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
readonlystream: (...args) =>string|Promise<string>
Defined in: libs/act-http/src/trpc/index.ts:123
Parameters
args
...ResolverArgs<TApp, NoInfer<Ctx>>
Returns
string | Promise<string>