import type { State } from '../types' ; import type { RobotSettings , PerRobotRobotSettingsState } from './types' ; const robotState = ( state , name ) : PerRobotRobotSettingsState | null => name != null ? state . robotSettings [ name ] ?? null : null ; export function getRobotSettings ( state , robotName ) { return robotState ( state , robotName ) ?. settings || [ ] ; } export function getRobotRestartPath ( state , robotName ) { return robotState ( state , robotName ) ?. restartPath || null ; } export function getRobotRestartRequired ( state , robotName ) { return getRobotRestartPath ( state , robotName ) !== null ; } export function getAllRestartRequiredRobots ( state ) { return Object . keys ( state . robotSettings ) . filter ( ( name ) => { return getRobotRestartRequired ( state , name ) ; } ) ; }