( tag: Context.Tag<Id, S>, service: RpcMiddlewareClient<R> | Effect.Effect<RpcMiddlewareClient<R>, EX, RX> )
| 285 | * @category client |
| 286 | */ |
| 287 | export const layerClient = <Id, S, R, EX = never, RX = never>( |
| 288 | tag: Context.Tag<Id, S>, |
| 289 | service: RpcMiddlewareClient<R> | Effect.Effect<RpcMiddlewareClient<R>, EX, RX> |
| 290 | ): Layer.Layer<ForClient<Id>, EX, R | Exclude<RX, Scope>> => |
| 291 | Layer.scopedContext(Effect.gen(function*() { |
| 292 | const context = (yield* Effect.context<R | Scope>()).pipe( |
| 293 | Context.omit(Scope) |
| 294 | ) as Context.Context<R> |
| 295 | const middleware = Effect.isEffect(service) ? yield* service : service |
| 296 | return Context.unsafeMake( |
| 297 | new Map([[ |
| 298 | `${tag.key}/Client`, |
| 299 | (options: any) => |
| 300 | Effect.mapInputContext( |
| 301 | middleware(options), |
| 302 | (requestContext) => Context.merge(context, requestContext) |
| 303 | ) |
| 304 | ]]) |
| 305 | ) |
| 306 | })) |
nothing calls this directly
no test coverage detected