MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / processLinks

Function processLinks

apps/web/services/slack/sync/attachments.ts:67–78  ·  view source on GitHub ↗

* 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
)

Source from the content-addressed store, hash-verified

65 * @returns Object { [key]: value, [fileId]: internalUrl }
66 */
67async 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
80function processLink(
81 token: string,

Callers 1

processAttachmentsFunction · 0.85

Calls 2

processLinkFunction · 0.85
mapMethod · 0.80

Tested by

no test coverage detected