import { resetConfigValue } from '../config' ; import * as Types from './types' ; import type { ResetConfigValueAction } from '../config/types' ; export const FETCH_CUSTOM_LABWARE = 'labware:FETCH_CUSTOM_LABWARE' ; export const CUSTOM_LABWARE_LIST = 'labware:CUSTOM_LABWARE_LIST' ; export const CUSTOM_LABWARE_LIST_FAILURE = 'labware:CUSTOM_LABWARE_LIST_FAILURE' ; export const CHANGE_CUSTOM_LABWARE_DIRECTORY = 'labware:CHANGE_CUSTOM_LABWARE_DIRECTORY' ; export const ADD_CUSTOM_LABWARE = 'labware:ADD_CUSTOM_LABWARE' ; export const ADD_CUSTOM_LABWARE_FAILURE = 'labware:ADD_CUSTOM_LABWARE_FAILURE' ; export const CLEAR_ADD_CUSTOM_LABWARE_FAILURE = 'labware:CLEAR_ADD_CUSTOM_LABWARE_FAILURE' ; export const OPEN_CUSTOM_LABWARE_DIRECTORY = 'labware:OPEN_CUSTOM_LABWARE_DIRECTORY' ; export const POLL = 'poll' ; export const INITIAL = 'initial' ; export const ADD_LABWARE = 'addLabware' ; export const OVERWRITE_LABWARE = 'overwriteLabware' ; export const CHANGE_DIRECTORY = 'changeDirectory' ; export const LABWARE_DIRECTORY_CONFIG_PATH = 'labware.directory' ; export const fetchCustomLabware = ( ) : Types . FetchCustomLabwareAction => ( { type : FETCH_CUSTOM_LABWARE , meta : { shell : true } , } ) ; export const customLabwareList = ( payload , source = POLL ) : Types . CustomLabwareListAction => ( { type : CUSTOM_LABWARE_LIST , payload , meta : { source } , } ) ; export const customLabwareListFailure = ( message , source = POLL ) : Types . CustomLabwareListFailureAction => ( { type : CUSTOM_LABWARE_LIST_FAILURE , payload : { message } , meta : { source } , } ) ; export const changeCustomLabwareDirectory = ( ) : Types . ChangeCustomLabwareDirectoryAction => ( { type : CHANGE_CUSTOM_LABWARE_DIRECTORY , meta : { shell : true } , } ) ; export const addCustomLabware = ( overwrite = null ) : Types . AddCustomLabwareAction => ( { type : ADD_CUSTOM_LABWARE , payload : { overwrite } , meta : { shell : true } , } ) ; export const addCustomLabwareFailure = ( labware = null , message = null ) : Types . AddCustomLabwareFailureAction => ( { type : ADD_CUSTOM_LABWARE_FAILURE , payload : { labware , message } , } ) ; export const clearAddCustomLabwareFailure = ( ) : Types . ClearAddCustomLabwareFailureAction => ( { type : CLEAR_ADD_CUSTOM_LABWARE_FAILURE , } ) ; export const openCustomLabwareDirectory = ( ) : Types . OpenCustomLabwareDirectoryAction => ( { type : OPEN_CUSTOM_LABWARE_DIRECTORY , meta : { shell : true } , } ) ; export const resetCustomLabwareDirectory = ( ) : ResetConfigValueAction => { return resetConfigValue ( LABWARE_DIRECTORY_CONFIG_PATH ) ; } ;