( method: string, params: Record<string, unknown>, headers: IncomingHttpHeaders, )
| 399 | } |
| 400 | |
| 401 | function methodToDaemonRequest( |
| 402 | method: string, |
| 403 | params: Record<string, unknown>, |
| 404 | headers: IncomingHttpHeaders, |
| 405 | ): DaemonRequest { |
| 406 | if (COMMAND_RPC_METHODS.has(method)) { |
| 407 | return toDaemonRequest(parseCommandRpcParams(params), headers); |
| 408 | } |
| 409 | if (INSTALL_FROM_SOURCE_RPC_METHODS.has(method)) { |
| 410 | return toInstallFromSourceDaemonRequest(params, headers); |
| 411 | } |
| 412 | if (RELEASE_MATERIALIZED_PATHS_RPC_METHODS.has(method)) { |
| 413 | return toReleaseMaterializedPathsDaemonRequest(params, headers); |
| 414 | } |
| 415 | const leaseCommand = LEASE_RPC_METHOD_TO_COMMAND[method]; |
| 416 | if (leaseCommand) { |
| 417 | return toLeaseDaemonRequest(leaseCommand, params, headers); |
| 418 | } |
| 419 | throw new AppError('INVALID_ARGS', `Method not found: ${method}`); |
| 420 | } |
| 421 | |
| 422 | function isCommandRpcMethod(method: string): boolean { |
| 423 | return COMMAND_RPC_METHODS.has(method); |
no test coverage detected