RpcRouter overview
Added in v1.0.0
Table of contents
combinators
toHandler
Signature
export declare const toHandler: {
(options?: {
readonly spanPrefix?: string
}): <R extends RpcRouter<any, any>>(
self: R
) => (u: unknown) => Stream.Stream<RpcRouter.Response, ParseError, RpcRouter.Context<R>>
<R extends RpcRouter<any, any>>(
self: R,
options?: { readonly spanPrefix?: string }
): (u: unknown) => Stream.Stream<RpcRouter.Response, ParseError, RpcRouter.Context<R>>
}
Added in v1.0.0
toHandlerNoStream
Signature
export declare const toHandlerNoStream: {
(options?: {
readonly spanPrefix?: string
}): <R extends RpcRouter<any, any>>(
self: R
) => (u: unknown) => Effect.Effect<RpcRouter.ResponseEffect, ParseError, RpcRouter.Context<R>>
<R extends RpcRouter<any, any>>(
self: R,
options?: { readonly spanPrefix?: string }
): (u: unknown) => Effect.Effect<RpcRouter.ResponseEffect, ParseError, RpcRouter.Context<R>>
}
Added in v1.0.0
toHandlerRaw
Signature
export declare const toHandlerRaw: <R extends RpcRouter<any, any>>(
router: R
) => <Req extends RpcRouter.Request<R>>(request: Req) => Rpc.Rpc.Result<Req, RpcRouter.ContextRaw<R>>
Added in v1.0.0
toHandlerUndecoded
Signature
export declare const toHandlerUndecoded: <R extends RpcRouter<any, any>>(
router: R
) => <Req extends RpcRouter.Request<R>>(request: Req) => Rpc.Rpc.ResultUndecoded<Req, RpcRouter.Context<R>>
Added in v1.0.0
constructors
make
Signature
export declare const make: <Rpcs extends ReadonlyArray<Rpc.Rpc<any, any> | RpcRouter<any, any>>>(
...rpcs: Rpcs
) => RpcRouter<
| Rpc.Rpc.Request<Extract<Rpcs[number], { readonly [Rpc.TypeId]: Rpc.TypeId }>>
| RpcRouter.Request<Extract<Rpcs[number], { readonly [TypeId]: TypeId }>>,
| Rpc.Rpc.Context<Extract<Rpcs[number], { readonly [Rpc.TypeId]: Rpc.TypeId }>>
| RpcRouter.Context<Extract<Rpcs[number], { readonly [TypeId]: TypeId }>>
>
Added in v1.0.0
context
provideService
Signature
export declare const provideService: {
<I, S>(
tag: Context.Tag<I, S>,
service: S
): <Reqs extends Schema.TaggedRequest.All, R>(self: RpcRouter<Reqs, R>) => RpcRouter<Reqs, Exclude<R, I>>
<Reqs extends Schema.TaggedRequest.All, R, I, S>(
self: RpcRouter<Reqs, R>,
tag: Context.Tag<I, S>,
service: S
): RpcRouter<Reqs, Exclude<R, I>>
}
Added in v1.0.0
provideServiceEffect
Signature
export declare const provideServiceEffect: {
<I, S, E, R2>(
tag: Context.Tag<I, S>,
effect: Effect.Effect<S, E, R2>
): <Reqs extends Schema.TaggedRequest.All, R>(self: RpcRouter<Reqs, R>) => RpcRouter<Reqs, Exclude<R, I> | R2>
<Reqs extends Schema.TaggedRequest.All, R, I, S, E, R2>(
self: RpcRouter<Reqs, R>,
tag: Context.Tag<I, S>,
effect: Effect.Effect<S, E, R2>
): RpcRouter<Reqs, Exclude<R, I> | R2>
}
Added in v1.0.0
models
RpcRouter (interface)
Signature
export interface RpcRouter<Reqs extends Schema.TaggedRequest.All, R> extends Pipeable {
readonly [TypeId]: TypeId
readonly rpcs: ReadonlySet<Rpc.Rpc<Reqs, R>>
}
Added in v1.0.0
RpcRouter (namespace)
Added in v1.0.0
Context (type alias)
Signature
export type Context<A extends RpcRouter<any, any>> =
A extends RpcRouter<infer Req, infer R> ? R | Serializable.SerializableWithResult.Context<Req> : never
Added in v1.0.0
ContextRaw (type alias)
Signature
export type ContextRaw<A extends RpcRouter<any, any>> =
A extends RpcRouter<infer Req, infer R> ? R | Serializable.Serializable.Context<Req> : never
Added in v1.0.0
Request (type alias)
Signature
export type Request<A extends RpcRouter<any, any>> = A extends RpcRouter<infer Req, infer _R> ? Req : never
Added in v1.0.0
Response (type alias)
Signature
export type Response = [
index: number,
response: Schema.ExitEncoded<any, any, unknown> | ReadonlyArray<Schema.ExitEncoded<any, any, unknown>>
]
Added in v1.0.0
ResponseEffect (type alias)
Signature
export type ResponseEffect =
| Schema.ExitEncoded<any, any, unknown>
| ReadonlyArray<Schema.ExitEncoded<any, any, unknown>>
Added in v1.0.0
refinements
isRpcRouter
Signature
export declare const isRpcRouter: (u: unknown) => u is RpcRouter<any, any>
Added in v1.0.0
type ids
TypeId
Signature
export declare const TypeId: typeof TypeId
Added in v1.0.0
TypeId (type alias)
Signature
export type TypeId = typeof TypeId
Added in v1.0.0