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