@adminforth/upload 2.15.8 → 2.15.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build.log +2 -2
- package/custom/imageGenerator.vue +6 -5
- package/dist/custom/imageGenerator.vue +6 -5
- package/dist/index.js +12 -3
- package/index.ts +13 -3
- package/package.json +2 -2
package/build.log
CHANGED
|
@@ -12,5 +12,5 @@ custom/preview.vue
|
|
|
12
12
|
custom/tsconfig.json
|
|
13
13
|
custom/uploader.vue
|
|
14
14
|
|
|
15
|
-
sent 68,
|
|
16
|
-
total size is 68,
|
|
15
|
+
sent 68,643 bytes received 153 bytes 137,592.00 bytes/sec
|
|
16
|
+
total size is 68,081 speedup is 0.99
|
|
@@ -404,11 +404,12 @@ async function generateImages() {
|
|
|
404
404
|
break;
|
|
405
405
|
};
|
|
406
406
|
jobStatus = jobResponse?.job?.status;
|
|
407
|
-
if (
|
|
408
|
-
error = jobResponse
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
|
|
407
|
+
if (jobResponse?.job?.error) {
|
|
408
|
+
error = jobResponse.job.error;
|
|
409
|
+
} else if (jobStatus === 'failed') {
|
|
410
|
+
error = $t('Image generation job failed');
|
|
411
|
+
} else if (jobStatus === 'timeout') {
|
|
412
|
+
error = $t('Image generation job timeout');
|
|
412
413
|
}
|
|
413
414
|
}
|
|
414
415
|
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
@@ -404,11 +404,12 @@ async function generateImages() {
|
|
|
404
404
|
break;
|
|
405
405
|
};
|
|
406
406
|
jobStatus = jobResponse?.job?.status;
|
|
407
|
-
if (
|
|
408
|
-
error = jobResponse
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
|
|
407
|
+
if (jobResponse?.job?.error) {
|
|
408
|
+
error = jobResponse.job.error;
|
|
409
|
+
} else if (jobStatus === 'failed') {
|
|
410
|
+
error = $t('Image generation job failed');
|
|
411
|
+
} else if (jobStatus === 'timeout') {
|
|
412
|
+
error = $t('Image generation job timeout');
|
|
412
413
|
}
|
|
413
414
|
}
|
|
414
415
|
await new Promise((resolve) => setTimeout(resolve, 2000));
|
package/dist/index.js
CHANGED
|
@@ -414,14 +414,23 @@ export default class UploadPlugin extends AdminForthPlugin {
|
|
|
414
414
|
server.endpoint({
|
|
415
415
|
method: 'POST',
|
|
416
416
|
path: `/plugin/${this.pluginInstanceId}/get-image-generation-job-status`,
|
|
417
|
-
handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, adminUser, headers }) {
|
|
417
|
+
handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, adminUser, headers, response }) {
|
|
418
418
|
const jobId = body.jobId;
|
|
419
419
|
if (!jobId) {
|
|
420
|
-
|
|
420
|
+
response.setStatus(400);
|
|
421
|
+
return { ok: false, error: "Can't find job id" };
|
|
421
422
|
}
|
|
422
423
|
const job = jobs.get(jobId);
|
|
423
424
|
if (!job) {
|
|
424
|
-
|
|
425
|
+
response.setStatus(404);
|
|
426
|
+
return { ok: false, error: "Job not found" };
|
|
427
|
+
}
|
|
428
|
+
if (job.status === 'failed' || job.error) {
|
|
429
|
+
response.setStatus(500);
|
|
430
|
+
return {
|
|
431
|
+
ok: false,
|
|
432
|
+
job,
|
|
433
|
+
};
|
|
425
434
|
}
|
|
426
435
|
return { ok: true, job };
|
|
427
436
|
})
|
package/index.ts
CHANGED
|
@@ -472,14 +472,24 @@ export default class UploadPlugin extends AdminForthPlugin {
|
|
|
472
472
|
server.endpoint({
|
|
473
473
|
method: 'POST',
|
|
474
474
|
path: `/plugin/${this.pluginInstanceId}/get-image-generation-job-status`,
|
|
475
|
-
handler: async ({ body, adminUser, headers }) => {
|
|
475
|
+
handler: async ({ body, adminUser, headers, response }) => {
|
|
476
476
|
const jobId = body.jobId;
|
|
477
477
|
if (!jobId) {
|
|
478
|
-
|
|
478
|
+
response.setStatus(400);
|
|
479
|
+
return { ok: false, error: "Can't find job id" };
|
|
479
480
|
}
|
|
480
481
|
const job = jobs.get(jobId);
|
|
481
482
|
if (!job) {
|
|
482
|
-
|
|
483
|
+
response.setStatus(404);
|
|
484
|
+
return { ok: false, error: "Job not found" };
|
|
485
|
+
}
|
|
486
|
+
if (job.status === 'failed' || job.error) {
|
|
487
|
+
response.setStatus(500);
|
|
488
|
+
|
|
489
|
+
return {
|
|
490
|
+
ok: false,
|
|
491
|
+
job,
|
|
492
|
+
};
|
|
483
493
|
}
|
|
484
494
|
return { ok: true, job };
|
|
485
495
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adminforth/upload",
|
|
3
|
-
"version": "2.15.
|
|
3
|
+
"version": "2.15.10",
|
|
4
4
|
"description": "Plugin for uploading files for adminforth",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/node": "^22.10.7",
|
|
63
|
-
"adminforth": "^2.
|
|
63
|
+
"adminforth": "^2.66.0",
|
|
64
64
|
"semantic-release": "^24.2.1",
|
|
65
65
|
"semantic-release-slack-bot": "^4.0.2",
|
|
66
66
|
"typescript": "^5.7.3"
|