@onereach/channel-transformer
Version:
Convert data model between different channels (Slack, Microsoft Teams, Generic...)
33 lines (30 loc) • 999 B
text/typescript
import { getKeyValue } from '../../../helpers/get-key-value';
import { getErrorObject } from '../../../helpers/get-error-object';
import {
transformInputText,
transformOutputText,
transformBoolean,
transformPicker,
transformOutputCard,
transformOutputImage,
transformOutputLink,
transformFileUpload,
transformGroupedPartControl,
transformOutputHtml,
} from './items';
const methods: { [key: string]: Function } = {
InputText: transformInputText,
OutputText: transformOutputText,
Picker: transformPicker,
Boolean: transformBoolean,
TopicPickerControl: transformPicker,
OutputCard: transformOutputCard,
FileUpload: transformFileUpload,
OutputLink: transformOutputLink,
OutputImage: transformOutputImage,
OutputHtml: transformOutputHtml,
GroupedPartsOutputControl: transformGroupedPartControl,
};
export const getMethods = (type: string): Function => {
return getKeyValue(methods)(type) || getErrorObject({ type, message: 'Service Now to Generic' });
};