MCPcopy Index your code
hub / github.com/simstudioai/sim / mapTrelloCard

Function mapTrelloCard

apps/sim/tools/trello/shared.ts:150–178  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

148}
149
150export function mapTrelloCard(value: unknown): TrelloCard {
151 if (!isRecordLike(value)) {
152 throw new Error('Trello returned an invalid card object')
153 }
154
155 const rawLabels = Array.isArray(value.labels) ? value.labels : []
156 const labels = rawLabels
157 .map((label) => mapTrelloLabel(label))
158 .filter((label): label is TrelloLabel => label !== null)
159 const labelIds = getIdArray(value.idLabels)
160
161 if (labelIds.length === 0) {
162 labelIds.push(...rawLabels.filter((label): label is string => typeof label === 'string'))
163 }
164
165 return {
166 id: getRequiredString(value.id, 'id'),
167 name: getRequiredString(value.name, 'name'),
168 desc: typeof value.desc === 'string' ? value.desc : '',
169 url: getRequiredString(value.url, 'url'),
170 idBoard: getRequiredString(value.idBoard, 'idBoard'),
171 idList: getRequiredString(value.idList, 'idList'),
172 closed: typeof value.closed === 'boolean' ? value.closed : false,
173 labelIds,
174 labels,
175 due: getOptionalString(value.due),
176 dueComplete: getOptionalBoolean(value.dueComplete),
177 }
178}
179
180export function mapTrelloBoard(value: unknown): TrelloBoard {
181 if (!isRecordLike(value)) {

Callers 4

get_card.tsFile · 0.90
update_card.tsFile · 0.90
create_card.tsFile · 0.90
list_cards.tsFile · 0.90

Calls 7

isRecordLikeFunction · 0.90
mapTrelloLabelFunction · 0.85
getIdArrayFunction · 0.85
getRequiredStringFunction · 0.85
getOptionalStringFunction · 0.85
getOptionalBooleanFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected