(req: DaemonRequest)
| 214 | | { ok: false; message: string }; |
| 215 | |
| 216 | function resolveDispatchCommand(req: DaemonRequest): DispatchCommandResolution { |
| 217 | if ( |
| 218 | req.command === 'pan' || |
| 219 | req.command === 'fling' || |
| 220 | req.command === 'rotate-gesture' || |
| 221 | req.command === 'transform-gesture' |
| 222 | ) { |
| 223 | return { |
| 224 | ok: false, |
| 225 | message: |
| 226 | 'Use gesture pan, gesture fling, gesture swipe, gesture rotate, or gesture transform.', |
| 227 | }; |
| 228 | } |
| 229 | if (req.command !== 'gesture') { |
| 230 | return { |
| 231 | ok: true, |
| 232 | platformCommand: req.command, |
| 233 | dispatchRequest: req, |
| 234 | recordedCommand: req.command, |
| 235 | }; |
| 236 | } |
| 237 | const [subcommand, ...positionals] = req.positionals ?? []; |
| 238 | const platformCommand = subcommand ? GESTURE_PLATFORM_COMMANDS[subcommand] : undefined; |
| 239 | if (!platformCommand) { |
| 240 | return { ok: false, message: GESTURE_SUBCOMMAND_ERROR }; |
| 241 | } |
| 242 | return { |
| 243 | ok: true, |
| 244 | platformCommand, |
| 245 | dispatchRequest: { ...req, command: platformCommand, positionals }, |
| 246 | recordedCommand: req.command, |
| 247 | }; |
| 248 | } |
| 249 | |
| 250 | function resolveScreenshotOutputPlacement(req: DaemonRequest): ScreenshotOutputPlacement { |
| 251 | if (req.command !== 'screenshot') return 'default'; |
no outgoing calls
no test coverage detected