* this function will upload files to s3 and return the fileId and internalUrl (cdn or s3 url) * of each as attributes of a key-value object * @param files * @param token * @returns Object { [key]: value, [fileId]: internalUrl }
( files: MessageFile[], token: string, channelId: string, logger: Logger )
| 65 | * @returns Object { [key]: value, [fileId]: internalUrl } |
| 66 | */ |
| 67 | async function processLinks( |
| 68 | files: MessageFile[], |
| 69 | token: string, |
| 70 | channelId: string, |
| 71 | logger: Logger |
| 72 | ): Promise<Record<string, string>> { |
| 73 | if (!files || !files.length) return {}; |
| 74 | |
| 75 | return ( |
| 76 | await Promise.all(files.map(processLink(token, channelId, logger))) |
| 77 | ).reduce(arrayToMap, {}); |
| 78 | } |
| 79 | |
| 80 | function processLink( |
| 81 | token: string, |
no test coverage detected