(accessToken?: string)
| 265 | } |
| 266 | |
| 267 | function getAuthHeaders(accessToken?: string): Record<string, string> { |
| 268 | const headers: Record<string, string> = { |
| 269 | "X-Context7-Source": "cli", |
| 270 | "X-Context7-Client-IDE": "ctx7-cli", |
| 271 | "X-Context7-Client-Version": VERSION, |
| 272 | "X-Context7-Transport": "cli", |
| 273 | }; |
| 274 | const apiKey = process.env.CONTEXT7_API_KEY; |
| 275 | if (apiKey) { |
| 276 | headers["Authorization"] = `Bearer ${apiKey}`; |
| 277 | } else if (accessToken) { |
| 278 | headers["Authorization"] = `Bearer ${accessToken}`; |
| 279 | } |
| 280 | return headers; |
| 281 | } |
| 282 | |
| 283 | export async function resolveLibrary( |
| 284 | libraryName: string, |
no outgoing calls
no test coverage detected