(
response: RpcMessage.FromServerEncoded | RpcMessage.FromClientEncoded,
batches: Map<string, {
readonly size: number
readonly responses: Map<string, RpcMessage.FromServerEncoded>
}>
)
| 297 | } |
| 298 | |
| 299 | function encodeJsonRpcRaw( |
| 300 | response: RpcMessage.FromServerEncoded | RpcMessage.FromClientEncoded, |
| 301 | batches: Map<string, { |
| 302 | readonly size: number |
| 303 | readonly responses: Map<string, RpcMessage.FromServerEncoded> |
| 304 | }> |
| 305 | ) { |
| 306 | if (!("requestId" in response)) { |
| 307 | return encodeJsonRpcMessage(response) |
| 308 | } |
| 309 | const batch = batches.get(response.requestId) |
| 310 | if (batch) { |
| 311 | batches.delete(response.requestId) |
| 312 | batch.responses.set(response.requestId, response as any) |
| 313 | if (batch.size === batch.responses.size) { |
| 314 | return Array.from(batch.responses.values(), encodeJsonRpcMessage) |
| 315 | } |
| 316 | return undefined |
| 317 | } |
| 318 | return encodeJsonRpcMessage(response) |
| 319 | } |
| 320 | |
| 321 | function encodeJsonRpcResponse( |
| 322 | response: |
no test coverage detected