(
sessionId: string,
opts?: {
baseUrl?: string
getAccessToken?: () => string | undefined
timeoutMs?: number
},
)
| 261 | * cleanup; call sites wrap with .catch(). |
| 262 | */ |
| 263 | export async function archiveBridgeSession( |
| 264 | sessionId: string, |
| 265 | opts?: { |
| 266 | baseUrl?: string |
| 267 | getAccessToken?: () => string | undefined |
| 268 | timeoutMs?: number |
| 269 | }, |
| 270 | ): Promise<void> { |
| 271 | const { default: axios } = await import('axios') |
| 272 | |
| 273 | const headers = await resolveBridgeSessionHeaders({ |
| 274 | accessTokenOverride: opts?.getAccessToken?.(), |
| 275 | operation: 'session archive', |
| 276 | }) |
| 277 | if (!headers) { |
| 278 | return |
| 279 | } |
| 280 | |
| 281 | const url = `${opts?.baseUrl ?? getNoumenaPlatformBaseUrl()}/v1/sessions/${sessionId}/archive` |
| 282 | logForDebugging(`[bridge] Archiving session ${sessionId}`) |
| 283 | |
| 284 | const response = await axios.post( |
| 285 | url, |
| 286 | {}, |
| 287 | { |
| 288 | headers, |
| 289 | timeout: opts?.timeoutMs ?? 10_000, |
| 290 | validateStatus: s => s < 500, |
| 291 | }, |
| 292 | ) |
| 293 | |
| 294 | if (response.status === 200) { |
| 295 | logForDebugging(`[bridge] Session ${sessionId} archived successfully`) |
| 296 | } else { |
| 297 | const detail = extractErrorDetail(response.data) |
| 298 | logForDebugging( |
| 299 | `[bridge] Session archive failed with status ${response.status}${detail ? `: ${detail}` : ''}`, |
| 300 | ) |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | /** |
| 305 | * Update the title of a bridge session via PATCH /v1/sessions/{id}. |
no test coverage detected