@adminforth/upload 2.15.9 → 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 CHANGED
@@ -12,5 +12,5 @@ custom/preview.vue
12
12
  custom/tsconfig.json
13
13
  custom/uploader.vue
14
14
 
15
- sent 68,635 bytes received 153 bytes 137,576.00 bytes/sec
15
+ sent 68,643 bytes received 153 bytes 137,592.00 bytes/sec
16
16
  total size is 68,081 speedup is 0.99
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
- return { error: "Can't find job id" };
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
- return { error: "Job not found" };
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
- return { error: "Can't find job id" };
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
- return { error: "Job not found" };
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.9",
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.42.0",
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"