import { DataIngestionClient, DataIngestionConfig, JobStatus } from "@trelent/data-ingestion";
const client = new DataIngestionClient();
async function getProgress(jobId: string) {
const status = await client.getJobStatus(jobId, { includeMarkdown: false });
const total = status.batches.length;
const completedBatches = status.batches.filter(b => b.phase === "completed").length;
const isDone = status.status === JobStatus.Completed;
return {
isDone,
completedBatches,
total,
percent: total ? Math.round((completedBatches / total) * 100) : 0
};
}