(
sessionId: string,
file: File | string,
onProgress?: (p: ImportProgress) => void
)
| 212 | } |
| 213 | |
| 214 | async incrementalImport( |
| 215 | sessionId: string, |
| 216 | file: File | string, |
| 217 | onProgress?: (p: ImportProgress) => void |
| 218 | ): Promise<IncrementalImportResult> { |
| 219 | if (typeof file === 'string') { |
| 220 | return { success: false, newMessageCount: 0, error: 'File path not supported in Web mode' } |
| 221 | } |
| 222 | |
| 223 | const form = new FormData() |
| 224 | form.append('file', file) |
| 225 | |
| 226 | const res = await fetchWithAuth(`${getBaseUrl()}/sessions/${sessionId}/import/incremental`, { |
| 227 | method: 'POST', |
| 228 | body: form, |
| 229 | }) |
| 230 | |
| 231 | if (!res.ok) { |
| 232 | const text = await res.text() |
| 233 | return { success: false, newMessageCount: 0, error: `HTTP ${res.status}: ${text}` } |
| 234 | } |
| 235 | |
| 236 | return consumeSseStream<IncrementalImportResult>( |
| 237 | res, |
| 238 | { success: false, newMessageCount: 0, error: 'Unknown error' }, |
| 239 | onProgress |
| 240 | ) |
| 241 | } |
| 242 | |
| 243 | async importDirectory( |
| 244 | source: File[] | string, |
nothing calls this directly
no test coverage detected