18 lines
609 B
TypeScript
18 lines
609 B
TypeScript
export type ImportResultSummary = {
|
|
importedCount: number;
|
|
duplicateCount: number;
|
|
errorCount: number;
|
|
};
|
|
|
|
/** Extrait le résultat final affiché par les services d'import. */
|
|
export function parseImportResultSummary(progress: string | null | undefined): ImportResultSummary | null {
|
|
if (!progress) return null;
|
|
const match = progress.match(/Termin[ée]\s*:\s*(\d+)\s+importée\(s\),\s*(\d+)\s+doublon\(s\)(?:,\s*(\d+)\s+erreur\(s\))?/i);
|
|
if (!match) return null;
|
|
return {
|
|
importedCount: Number(match[1]),
|
|
duplicateCount: Number(match[2]),
|
|
errorCount: Number(match[3] ?? 0),
|
|
};
|
|
}
|