@adminforth/bulk-ai-flow 1.25.0 → 1.25.1

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
@@ -14,5 +14,5 @@ custom/package.json
14
14
  custom/pnpm-lock.yaml
15
15
  custom/tsconfig.json
16
16
 
17
- sent 113,881 bytes received 191 bytes 228,144.00 bytes/sec
17
+ sent 113,871 bytes received 191 bytes 228,124.00 bytes/sec
18
18
  total size is 113,167 speedup is 0.99
package/dist/index.js CHANGED
@@ -989,16 +989,34 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
989
989
  server.endpoint({
990
990
  method: 'POST',
991
991
  path: `/plugin/${this.pluginInstanceId}/get-job-status`,
992
- handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, adminUser, headers }) {
992
+ handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, adminUser, headers, response }) {
993
993
  const jobId = body.jobId;
994
994
  if (!jobId) {
995
- return { error: "Can't find job id" };
995
+ response.setStatus(400);
996
+ return {
997
+ ok: false,
998
+ error: "Can't find job id",
999
+ };
996
1000
  }
997
1001
  const job = jobs.get(jobId);
998
1002
  if (!job) {
999
- return { error: "Job not found" };
1003
+ response.setStatus(404);
1004
+ return {
1005
+ ok: false,
1006
+ error: "Job not found",
1007
+ };
1000
1008
  }
1001
- return { ok: true, job };
1009
+ if (job.status === 'failed') {
1010
+ response.setStatus(500);
1011
+ return {
1012
+ ok: false,
1013
+ error: job.error
1014
+ };
1015
+ }
1016
+ return {
1017
+ ok: true,
1018
+ job,
1019
+ };
1002
1020
  })
1003
1021
  });
1004
1022
  server.endpoint({
package/index.ts CHANGED
@@ -1017,16 +1017,37 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
1017
1017
  server.endpoint({
1018
1018
  method: 'POST',
1019
1019
  path: `/plugin/${this.pluginInstanceId}/get-job-status`,
1020
- handler: async ({ body, adminUser, headers }) => {
1020
+ handler: async ({ body, adminUser, headers, response }) => {
1021
1021
  const jobId = body.jobId;
1022
1022
  if (!jobId) {
1023
- return { error: "Can't find job id" };
1023
+ response.setStatus(400);
1024
+
1025
+ return {
1026
+ ok: false,
1027
+ error: "Can't find job id",
1028
+ };
1024
1029
  }
1025
1030
  const job = jobs.get(jobId);
1026
1031
  if (!job) {
1027
- return { error: "Job not found" };
1032
+ response.setStatus(404);
1033
+
1034
+ return {
1035
+ ok: false,
1036
+ error: "Job not found",
1037
+ };
1028
1038
  }
1029
- return { ok: true, job };
1039
+ if (job.status === 'failed') {
1040
+ response.setStatus(500);
1041
+
1042
+ return {
1043
+ ok: false,
1044
+ error: job.error
1045
+ };
1046
+ }
1047
+ return {
1048
+ ok: true,
1049
+ job,
1050
+ };
1030
1051
  }
1031
1052
  });
1032
1053
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/bulk-ai-flow",
3
- "version": "1.25.0",
3
+ "version": "1.25.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -25,7 +25,7 @@
25
25
  "description": "Bulk AI workflow plugin for AdminForth for batch field generation and image processing",
26
26
  "devDependencies": {
27
27
  "@types/node": "latest",
28
- "adminforth": "^2.42.0",
28
+ "adminforth": "^2.60.2",
29
29
  "semantic-release": "^24.2.1",
30
30
  "semantic-release-slack-bot": "^4.0.2",
31
31
  "typescript": "^5.7.3"