(rpc: Rpc.AnyWithProps)
| 301 | } else { |
| 302 | entry.resume(exit) |
| 303 | } |
| 304 | } |
| 305 | }) |
| 306 | |
| 307 | const onRequest = (rpc: Rpc.AnyWithProps) => { |
| 308 | const isStream = RpcSchema.isStreamSchema(rpc.successSchema) |
| 309 | const middleware = getRpcClientMiddleware(rpc) |
| 310 | return (payload: any, opts?: { |
| 311 | readonly asQueue?: boolean | undefined |
| 312 | readonly streamBufferSize?: number | undefined |
| 313 | readonly headers?: Headers.Input | undefined |
| 314 | readonly context?: Context.Context<never> | undefined |
| 315 | readonly discard?: boolean | undefined |
| 316 | }) => { |
| 317 | const headers = opts?.headers ? Headers.fromInput(opts.headers) : Headers.empty |
| 318 | const context = opts?.context ?? Context.empty() |
| 319 | if (!isStream) { |
| 320 | const onRequest = (span: Span | undefined) => |
| 321 | onEffectRequest( |
| 322 | rpc, |
| 323 | middleware, |
| 324 | span, |
| 325 | rpc.payloadSchema.make(payload), |
| 326 | headers, |
| 327 | context, |
| 328 | opts?.discard ?? false |
| 329 | ) |
| 330 | return disableTracing ? onRequest(undefined) : Effect.useSpan( |
| 331 | `${spanPrefix}.${rpc._tag}`, |
| 332 | { attributes: options.spanAttributes }, |
| 333 | onRequest |
| 334 | ) |
| 335 | } |
| 336 | const queue = onStreamRequest( |
| 337 | rpc, |
| 338 | middleware, |
| 339 | rpc.payloadSchema.make(payload), |
| 340 | headers, |
| 341 | opts?.streamBufferSize ?? 16, |
| 342 | context |
| 343 | ) |
| 344 | if (opts?.asQueue) return queue |
| 345 | return Stream.unwrap(Effect.map(queue, Stream.fromQueue)) |
| 346 | } |
no test coverage detected
searching dependent graphs…