export const PROVIDER_SPACER = '::' ; export interface IOMessage { id : string ; content ? : string ; description ? : string ; from ? : string ; to ? : string ; behavior ? : string ; } export const providerFromMessage = ( message ) => { const { provider } = parseIOMessageId ( message ) ; return provider || 'unknown' ; } ; export const parseIOMessageId = ( { id } ) => { const splitted = id . split ( PROVIDER_SPACER ) ; if ( splitted . length === 2 ) { return { locator : splitted [ 1 ] , provider : splitted [ 0 ] , } ; } return { locator : splitted [ 0 ] , } ; } ; export const removeProviderFromId = ( message ) => ( { ... message , id : parseIOMessageId ( message ) . locator , } ) ;