(
req: DaemonRequest,
options: { includeTokenParam: boolean },
)
| 94 | } |
| 95 | |
| 96 | export function buildHttpRpcPayload( |
| 97 | req: DaemonRequest, |
| 98 | options: { includeTokenParam: boolean }, |
| 99 | ): { |
| 100 | jsonrpc: '2.0'; |
| 101 | id: string; |
| 102 | method: string; |
| 103 | params: DaemonRequest | Record<string, unknown>; |
| 104 | } { |
| 105 | const id = req.meta?.requestId ?? createRequestId(); |
| 106 | if (!isLeaseRpcCommand(req.command)) { |
| 107 | return { |
| 108 | jsonrpc: '2.0', |
| 109 | id, |
| 110 | method: 'agent_device.command', |
| 111 | params: req, |
| 112 | }; |
| 113 | } |
| 114 | return { |
| 115 | jsonrpc: '2.0', |
| 116 | id, |
| 117 | method: leaseRpcMethodForCommand(req.command), |
| 118 | params: buildLeaseRpcParams(req, req.command, options), |
| 119 | }; |
| 120 | } |
| 121 | |
| 122 | function isLeaseRpcCommand(command: string): command is LeaseRpcCommand { |
| 123 | return ( |
no test coverage detected