Decorators
@system-inc/base-foundation · 515c140 · 5 symbols
@InjectRpcClient
Injects an RpcClient bound to the service declared by the given
RpcClientBinding<RpcInterface>. The binding's name matches a client entry
in the worker's rpc.client settings (typically a Cloudflare service
binding), and its generic threads the remote service's type through so
calls are fully typed.
serviceThe binding identifying the remote service.
@Rpc
Marks a method of an @RpcService class as a remote procedure, exposing it
to RPC clients. Arguments are described with @RpcArgument so the
dispatcher can deserialize and validate them.
optionsOptional per-procedure options (e.g. a `visibility` override).
returnTypeOptional return type of the RPC, used to serialize the result.
optionsOptional per-procedure options (e.g. a `visibility` override).
@RpcArgument
Marks an argument of an @Rpc handler so the dispatcher can deserialize it
to the given type — and, for class types, validate it — before invoking the
handler.
typeFuncThe type to deserialize the argument to.
optionsArgument options such as `name`, `optional`, or `defaultValue`.
@RpcService
Marks a class as a remote procedure service, allowing it to expose methods
as RPCs via the @Rpc decorator.
List the class in a module's (or the worker's) services. Visibility
defaults to 'internal' — callable only from bound workers; use
'public' to expose the service on a public route.
optionsService options such as `visibility`.
@WebSocketRpc
Marks a method as a remote procedure callable only over a WebSocket.
WebSocket procedures are fire-and-forget from the caller's perspective —
the return type is constrained to Promise<void>.