* Executes a GraphQL query against the Fireflies API.
(
accessToken: string,
query: string,
variables: Record<string, unknown> = {},
retryOptions?: Parameters<typeof fetchWithRetry>[2]
)
| 33 | * Executes a GraphQL query against the Fireflies API. |
| 34 | */ |
| 35 | async function firefliesGraphQL( |
| 36 | accessToken: string, |
| 37 | query: string, |
| 38 | variables: Record<string, unknown> = {}, |
| 39 | retryOptions?: Parameters<typeof fetchWithRetry>[2] |
| 40 | ): Promise<Record<string, unknown>> { |
| 41 | const response = await fetchWithRetry( |
| 42 | FIREFLIES_GRAPHQL_URL, |
| 43 | { |
| 44 | method: 'POST', |
| 45 | headers: { |
| 46 | 'Content-Type': 'application/json', |
| 47 | Authorization: `Bearer ${accessToken}`, |
| 48 | }, |
| 49 | body: JSON.stringify({ query, variables }), |
| 50 | }, |
| 51 | retryOptions |
| 52 | ) |
| 53 | |
| 54 | if (!response.ok) { |
| 55 | throw new Error(`Fireflies API HTTP error: ${response.status}`) |
| 56 | } |
| 57 | |
| 58 | const data = await response.json() |
| 59 | |
| 60 | if (data.errors) { |
| 61 | const message = (data.errors as { message: string }[])[0]?.message || 'Unknown GraphQL error' |
| 62 | throw new Error(`Fireflies API error: ${message}`) |
| 63 | } |
| 64 | |
| 65 | return data.data as Record<string, unknown> |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Formats transcript sentences into plain text content. |
no test coverage detected