MCPcopy Create free account
hub / github.com/simstudioai/sim / formatItemContent

Function formatItemContent

apps/sim/connectors/monday/monday.ts:262–293  ·  view source on GitHub ↗

* Formats an item's column values and updates into a plain-text document. The * resolved board is passed in so listing (which has a board fallback) and * single-item fetches produce identical content.

(item: MondayItem, board: { id: string; name: string })

Source from the content-addressed store, hash-verified

260 * single-item fetches produce identical content.
261 */
262function formatItemContent(item: MondayItem, board: { id: string; name: string }): string {
263 const parts: string[] = []
264
265 if (board.name) parts.push(`Board: ${board.name}`)
266 parts.push(`Item: ${item.name?.trim() || 'Untitled Item'}`)
267 if (item.group?.title) parts.push(`Group: ${item.group.title}`)
268 if (item.creator?.name) parts.push(`Created by: ${item.creator.name}`)
269 if (item.created_at) parts.push(`Created: ${item.created_at}`)
270 if (item.updated_at) parts.push(`Updated: ${item.updated_at}`)
271
272 const columns = item.column_values.filter((cv) => cv.text?.trim())
273 if (columns.length > 0) {
274 parts.push('')
275 parts.push('--- Fields ---')
276 for (const cv of columns) {
277 const title = cv.column?.title?.trim() || cv.id
278 parts.push(`${title}: ${cv.text}`)
279 }
280 }
281
282 const updates = item.updates.filter((u) => u.text_body?.trim())
283 if (updates.length > 0) {
284 parts.push('')
285 parts.push('--- Updates ---')
286 for (const update of updates) {
287 const author = update.creator?.name?.trim() || 'Unknown'
288 parts.push(`Update by ${author}: ${update.text_body}`)
289 }
290 }
291
292 return parts.join('\n')
293}
294
295/**
296 * Fetches the list of board ids the connector should sync. When `boardIds` is

Callers 1

itemToDocumentFunction · 0.85

Calls 2

joinMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected