diff --git a/index.ts b/index.ts index e28d0ab..6bc8214 100644 --- a/index.ts +++ b/index.ts @@ -202,6 +202,7 @@ async function addJob( } const report: Report = {} +const results: DownloadResult[] = [] async function reportProgress(file: string, status: JobStatus) { try { @@ -238,12 +239,11 @@ async function queueListener( jobMonitorInterval: number ) { try { - const fileName = path.basename(file).split('.').shift() await processFile({ apiKey, workflowId: workflowId, filePath: file, - outputFolder: `${outputFolder}/${fileName}`, + outputFolder: outputFolder, jobMonitorInterval, }) } catch (error: any) { @@ -308,6 +308,8 @@ export async function processFile({ ) const result = await downloadJobResults(apiKey, jobData, outputFolder) + results.push(result) + await deleteJob(apiKey, jobId) await reportProgress(filePath, 'SUCCEEDED') @@ -327,8 +329,6 @@ export function processFolder({ onLog, onError, }: ProcessFolderOptions): Promise { - const results: DownloadResult[] = [] - if (onProgress) onProgressInternal = onProgress if (onLog) onLogInternal = onLog if (onError) onErrorInternal = onError diff --git a/package.json b/package.json index aa9ac1d..6bfcdd2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "moises-node", - "version": "1.0.4", + "version": "1.0.5", "description": "Non-official Moises AI (https://developer.moises.ai/) API wrapper package with Typescript support", "main": "dist/index.js", "typings": "dist/index.d.ts",