UNPKG

@onereach/channel-transformer

Version:

Convert data model between different channels (Slack, Microsoft Teams, Generic...)

17 lines (13 loc) 469 B
import { IGenericAttachments } from "../../../../generic/types"; import { IRWCMedia, IRWCMessage } from '../../../types'; export const transformAttachments = ({ props }: IGenericAttachments): IRWCMessage => { const atts = props.value.filesValue || props.value.staticValue; const medias: Array<IRWCMedia> = atts.map(item => { return { location: item.text, size: item.size }; }); const result: IRWCMessage = { medias }; return result; };