import values from 'lodash/values' ; import { getPrimaryPipetteId } from './utils/getPrimaryPipetteId' ; import { getPipetteWorkflow } from './utils/getPipetteWorkflow' ; import { getOnePipettePositionCheckSteps } from './utils/getOnePipettePositionCheckSteps' ; import { getTwoPipettePositionCheckSteps } from './utils/getTwoPipettePositionCheckSteps' ; import type { Command , ProtocolFile , } from '@opentrons/shared-data/protocol/types/schemaV6' ; import type { LabwarePositionCheckStep } from './types' ; export const getLabwarePositionCheckSteps = ( protocolData ) : LabwarePositionCheckStep [ ] => { if ( protocolData != null && 'pipettes' in protocolData ) { const pipettesById = protocolData . pipettes ; const pipettes = values ( pipettesById ) ; const pipetteNames = pipettes . map ( ( { name } ) => name ) ; const labware = protocolData . labware ; const modules = protocolData . modules ; const labwareDefinitions = protocolData . labwareDefinitions ; const commands = protocolData . commands ; const primaryPipetteId = getPrimaryPipetteId ( pipettesById , commands ) ; const pipetteWorkflow = getPipetteWorkflow ( { pipetteNames , primaryPipetteId , labware , labwareDefinitions , commands , } ) ; if ( pipetteWorkflow === 1 ) { return getOnePipettePositionCheckSteps ( { primaryPipetteId , labware , labwareDefinitions , modules , commands , } ) ; } else { const secondaryPipetteId = Object . keys ( pipettesById ) . find ( pipetteId => pipetteId !== primaryPipetteId ) as string ; return getTwoPipettePositionCheckSteps ( { primaryPipetteId , secondaryPipetteId , labware , labwareDefinitions , modules , commands , } ) ; } } console . error ( 'expected pipettes to be in protocol data' ) ; return [ ] ; } ;