MCPcopy Index your code
hub / github.com/Linen-dev/linen.dev / createMessageImitation

Function createMessageImitation

packages/serializers/src/message.ts:86–122  ·  view source on GitHub ↗
({
  message,
  files,
  threadId,
  author,
  mentions,
}: {
  message: string;
  files: UploadedFile[];
  threadId: string;
  author: SerializedUser;
  mentions: SerializedUser[];
})

Source from the content-addressed store, hash-verified

84}
85
86export function createMessageImitation({
87 message,
88 files,
89 threadId,
90 author,
91 mentions,
92}: {
93 message: string;
94 files: UploadedFile[];
95 threadId: string;
96 author: SerializedUser;
97 mentions: SerializedUser[];
98}): SerializedMessage {
99 return {
100 id: uuid(),
101 body: message,
102 sentAt: new Date().toISOString(),
103 usersId: author.id,
104 mentions,
105 attachments: files.map((file) => {
106 return { name: file.id, url: file.url };
107 }),
108 reactions: [],
109 threadId,
110 messageFormat: MessageFormat.LINEN,
111 externalId: null,
112 author: {
113 id: author.id,
114 externalUserId: author.externalUserId,
115 username: username(author.displayName),
116 displayName: author.displayName,
117 profileImageUrl: author.profileImageUrl,
118 authsId: null,
119 role: author.role,
120 },
121 };
122}

Callers 1

createMessageWrapperFunction · 0.90

Calls 2

usernameFunction · 0.90
mapMethod · 0.80

Tested by

no test coverage detected