// src/utils/adfComment.js // // Pure ADF comment assembly. Extracted so the poller integration test // can import it without dragging in JiraClient / BotClient / Webex // service-app auth (all of which throw on module load when their env // vars aren't set). Also just cleaner: this function is a stateless // shape helper, not part of the poller's lifecycle. /** * Build a Jira Cloud v3 ADF document with an italic header paragraph * followed by an arbitrary array of ADF body nodes (typically produced * by `markdownToAdfContent`). Preserves clickable links, bold, and * paragraph structure that the previous code-block format flattened * to unformatted text. * * @param {object} args * @param {string} args.headerLine Italic first-paragraph string. * @param {Array} [args.bodyNodes=[]] ADF block nodes. * @returns {object} ADF `{ version:1, type:'doc', content:[...] }`. */ export function buildAdfComment({ headerLine, bodyNodes = [] }) { return { version: 1, type: 'doc', content: [ { type: 'paragraph', content: [{ type: 'text', text: headerLine, marks: [{ type: 'em' }] }], }, ...bodyNodes, ], }; }