Skip to content

Commit

Permalink
Merge pull request #4 from leandrosimoes/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
leandrosimoes authored Aug 6, 2023
2 parents a7941ba + 36932da commit 874032e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ async function addJob(
}

const report: Report = {}
const results: DownloadResult[] = []

async function reportProgress(file: string, status: JobStatus) {
try {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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')
Expand All @@ -327,8 +329,6 @@ export function processFolder({
onLog,
onError,
}: ProcessFolderOptions): Promise<DownloadResult[]> {
const results: DownloadResult[] = []

if (onProgress) onProgressInternal = onProgress
if (onLog) onLogInternal = onLog
if (onError) onErrorInternal = onError
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 874032e

Please sign in to comment.