* Fetches the list of board ids the connector should sync. When `boardIds` is * configured, those are used verbatim; otherwise all accessible active boards * are enumerated.
( accessToken: string, sourceConfig: Record<string, unknown> )
| 298 | * are enumerated. |
| 299 | */ |
| 300 | async function resolveBoardIds( |
| 301 | accessToken: string, |
| 302 | sourceConfig: Record<string, unknown> |
| 303 | ): Promise<{ id: string; name: string | null }[]> { |
| 304 | const configured = parseMultiValue(sourceConfig.boardIds) |
| 305 | if (configured.length > 0) { |
| 306 | return configured.map((id) => ({ id, name: null })) |
| 307 | } |
| 308 | |
| 309 | const boards: { id: string; name: string | null }[] = [] |
| 310 | let page = 1 |
| 311 | for (;;) { |
| 312 | const data = await mondayGraphQL<{ boards: { id: string; name: string | null }[] | null }>( |
| 313 | accessToken, |
| 314 | `query ($limit: Int!, $page: Int!) { |
| 315 | boards(limit: $limit, page: $page, state: active) { |
| 316 | id |
| 317 | name |
| 318 | } |
| 319 | }`, |
| 320 | { limit: BOARDS_PAGE_SIZE, page } |
| 321 | ) |
| 322 | const batch = data.boards ?? [] |
| 323 | boards.push(...batch) |
| 324 | if (batch.length < BOARDS_PAGE_SIZE) break |
| 325 | page += 1 |
| 326 | } |
| 327 | return boards |
| 328 | } |
| 329 | |
| 330 | export const mondayConnector: ConnectorConfig = { |
| 331 | ...mondayConnectorMeta, |
no test coverage detected