TrpcOptions
@rotorsoft/act-root / act-http/src/trpc / TrpcOptions
Type Alias: TrpcOptions<Ctx>
TrpcOptions<
Ctx> =object
Defined in: libs/act-http/src/trpc/index.ts:111
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. Returningundefinedskips the check for that call โ handy when only some actions are concurrency-sensitive.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.
Propertiesโ
actorโ
readonlyactor:ActorExtractor
Defined in: libs/act-http/src/trpc/index.ts:112
expectedVersion?โ
readonlyoptionalexpectedVersion?: (action_name,input,ctx) =>number|undefined|Promise<number|undefined>
Defined in: libs/act-http/src/trpc/index.ts:118
Parametersโ
action_nameโ
string
inputโ
unknown
ctxโ
Ctx
Returnsโ
number | undefined | Promise<number | undefined>
idempotency?โ
readonlyoptionalidempotency?:object
Defined in: libs/act-http/src/trpc/index.ts:123
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:142
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: (action_name,input,ctx) =>string|Promise<string>
Defined in: libs/act-http/src/trpc/index.ts:113
Parametersโ
action_nameโ
string
inputโ
unknown
ctxโ
Ctx
Returnsโ
string | Promise<string>