@adminforth/bulk-ai-flow 1.23.0 → 1.23.2

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
@@ -13,5 +13,5 @@ custom/package-lock.json
13
13
  custom/package.json
14
14
  custom/tsconfig.json
15
15
 
16
- sent 103,527 bytes received 172 bytes 207,398.00 bytes/sec
17
- total size is 102,891 speedup is 0.99
16
+ sent 103,782 bytes received 172 bytes 207,908.00 bytes/sec
17
+ total size is 103,137 speedup is 0.99
@@ -36,7 +36,7 @@
36
36
  {
37
37
  label: t('Cancel'),
38
38
  options: {
39
- class: 'bg-white hover:!bg-gray-100 !text-gray-900 hover:!text-gray-800 dark:!bg-gray-800 dark:!text-gray-100 dark:hover:!bg-gray-700 !border-gray-200'
39
+ class: 'bg-white hover:!bg-gray-100 !text-gray-900 hover:!text-gray-800 dark:!bg-gray-800 dark:!text-gray-100 dark:hover:!bg-gray-700 !border-gray-200 dark:!border-gray-600'
40
40
  },
41
41
  onclick: (dialog) => confirmDialog.tryToHideModal()
42
42
  },
@@ -60,7 +60,7 @@
60
60
  {
61
61
  label: t('Cancel'),
62
62
  options: {
63
- class: 'w-2/5 bg-white hover:!bg-gray-100 !text-gray-900 hover:!text-gray-800 dark:!bg-gray-800 dark:!text-gray-100 dark:hover:!bg-gray-700 !border-gray-200'
63
+ class: 'w-2/5 bg-white hover:!bg-gray-100 !text-gray-900 hover:!text-gray-800 dark:!bg-gray-800 dark:!text-gray-100 dark:hover:!bg-gray-700 !border-gray-200 dark:!border-gray-600'
64
64
  },
65
65
  onclick: (dialog) => confirmDialog.tryToHideModal()
66
66
  },
@@ -81,13 +81,13 @@
81
81
  <div v-if="isGenerationPaused" class="flex flex-col gap-2 mb-2">
82
82
  <div class="flex items-center gap-2">
83
83
  <button
84
- class="h-8 px-3 py-1.5 text-sm rounded-md bg-gradient-to-r from-purple-500 via-purple-600 to-purple-700 text-white"
84
+ class="h-8 px-3 py-1.5 text-sm rounded-md bg-gradient-to-r from-purple-500 via-purple-600 to-purple-700 text-white hover:bg-gradient-to-br focus:ring-4 focus:outline-none focus:ring-purple-300 dark:focus:ring-purple-800 border-none ml-2"
85
85
  @click="resumeGeneration"
86
86
  >
87
87
  {{ t('Resume generation') }}
88
88
  </button>
89
89
  <button
90
- class="h-8 px-3 py-1.5 text-sm rounded-md bg-white hover:bg-gray-100 text-gray-900 border border-gray-200"
90
+ class="h-8 px-3 py-1.5 text-sm rounded-md bg-white hover:bg-gray-100 text-gray-900 border border-gray-200 dark:bg-gray-800 dark:text-gray-100 dark:hover:bg-gray-700 dark:border-gray-600"
91
91
  @click="cancelGeneration"
92
92
  >
93
93
  {{ t('Cancel generation') }}
@@ -36,7 +36,7 @@
36
36
  {
37
37
  label: t('Cancel'),
38
38
  options: {
39
- class: 'bg-white hover:!bg-gray-100 !text-gray-900 hover:!text-gray-800 dark:!bg-gray-800 dark:!text-gray-100 dark:hover:!bg-gray-700 !border-gray-200'
39
+ class: 'bg-white hover:!bg-gray-100 !text-gray-900 hover:!text-gray-800 dark:!bg-gray-800 dark:!text-gray-100 dark:hover:!bg-gray-700 !border-gray-200 dark:!border-gray-600'
40
40
  },
41
41
  onclick: (dialog) => confirmDialog.tryToHideModal()
42
42
  },
@@ -60,7 +60,7 @@
60
60
  {
61
61
  label: t('Cancel'),
62
62
  options: {
63
- class: 'w-2/5 bg-white hover:!bg-gray-100 !text-gray-900 hover:!text-gray-800 dark:!bg-gray-800 dark:!text-gray-100 dark:hover:!bg-gray-700 !border-gray-200'
63
+ class: 'w-2/5 bg-white hover:!bg-gray-100 !text-gray-900 hover:!text-gray-800 dark:!bg-gray-800 dark:!text-gray-100 dark:hover:!bg-gray-700 !border-gray-200 dark:!border-gray-600'
64
64
  },
65
65
  onclick: (dialog) => confirmDialog.tryToHideModal()
66
66
  },
@@ -81,13 +81,13 @@
81
81
  <div v-if="isGenerationPaused" class="flex flex-col gap-2 mb-2">
82
82
  <div class="flex items-center gap-2">
83
83
  <button
84
- class="h-8 px-3 py-1.5 text-sm rounded-md bg-gradient-to-r from-purple-500 via-purple-600 to-purple-700 text-white"
84
+ class="h-8 px-3 py-1.5 text-sm rounded-md bg-gradient-to-r from-purple-500 via-purple-600 to-purple-700 text-white hover:bg-gradient-to-br focus:ring-4 focus:outline-none focus:ring-purple-300 dark:focus:ring-purple-800 border-none ml-2"
85
85
  @click="resumeGeneration"
86
86
  >
87
87
  {{ t('Resume generation') }}
88
88
  </button>
89
89
  <button
90
- class="h-8 px-3 py-1.5 text-sm rounded-md bg-white hover:bg-gray-100 text-gray-900 border border-gray-200"
90
+ class="h-8 px-3 py-1.5 text-sm rounded-md bg-white hover:bg-gray-100 text-gray-900 border border-gray-200 dark:bg-gray-800 dark:text-gray-100 dark:hover:bg-gray-700 dark:border-gray-600"
91
91
  @click="cancelGeneration"
92
92
  >
93
93
  {{ t('Cancel generation') }}
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { AdminForthFilterOperators, AdminForthPlugin, Filters } from "adminforth";
11
- import { suggestIfTypo } from "adminforth";
11
+ import { suggestIfTypo, filtersTools } from "adminforth";
12
12
  import Handlebars from 'handlebars';
13
13
  import { RateLimiter } from "adminforth";
14
14
  import { randomUUID } from "crypto";
@@ -1035,7 +1035,30 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
1035
1035
  server.endpoint({
1036
1036
  method: 'POST',
1037
1037
  path: `/plugin/${this.pluginInstanceId}/get_filtered_ids`,
1038
- handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, adminUser, headers }) {
1038
+ handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, adminUser, headers, query, cookies, requestUrl }) {
1039
+ var _b, _c;
1040
+ const resource = this.resourceConfig;
1041
+ for (const hook of ((_c = (_b = resource.hooks) === null || _b === void 0 ? void 0 : _b.list) === null || _c === void 0 ? void 0 : _c.beforeDatasourceRequest) || []) {
1042
+ const filterTools = filtersTools.get(body);
1043
+ body.filtersTools = filterTools;
1044
+ const resp = yield hook({
1045
+ resource,
1046
+ query: body,
1047
+ adminUser,
1048
+ //@ts-ignore
1049
+ filtersTools: filterTools,
1050
+ extra: {
1051
+ body, query, headers, cookies, requestUrl
1052
+ },
1053
+ adminforth: this.adminforth,
1054
+ });
1055
+ if (!resp || (!resp.ok && !resp.error)) {
1056
+ throw new Error(`Hook must return object with {ok: true} or { error: 'Error' } `);
1057
+ }
1058
+ if (resp.error) {
1059
+ return { error: resp.error };
1060
+ }
1061
+ }
1039
1062
  const filters = body.filters;
1040
1063
  const normalizedFilters = { operator: AdminForthFilterOperators.AND, subFilters: [] };
1041
1064
  if (filters) {
package/index.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import { AdminForthFilterOperators, AdminForthPlugin, Filters } from "adminforth";
2
2
  import type { IAdminForth, IHttpServer, AdminForthComponentDeclaration, AdminForthResource } from "adminforth";
3
- import { suggestIfTypo } from "adminforth";
3
+ import { suggestIfTypo, filtersTools } from "adminforth";
4
4
  import type { PluginOptions } from './types.js';
5
5
  import Handlebars from 'handlebars';
6
6
  import { RateLimiter } from "adminforth";
7
7
  import { randomUUID } from "crypto";
8
8
 
9
+
9
10
  const STUB_MODE = false;
10
11
  const jobs = new Map();
11
12
  export default class BulkAiFlowPlugin extends AdminForthPlugin {
@@ -1068,7 +1069,30 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
1068
1069
  server.endpoint({
1069
1070
  method: 'POST',
1070
1071
  path: `/plugin/${this.pluginInstanceId}/get_filtered_ids`,
1071
- handler: async ({ body, adminUser, headers }) => {
1072
+ handler: async ({ body, adminUser, headers, query, cookies, requestUrl }) => {
1073
+ const resource = this.resourceConfig;
1074
+
1075
+ for (const hook of resource.hooks?.list?.beforeDatasourceRequest || []) {
1076
+ const filterTools = filtersTools.get(body);
1077
+ body.filtersTools = filterTools;
1078
+ const resp = await hook({
1079
+ resource,
1080
+ query: body,
1081
+ adminUser,
1082
+ //@ts-ignore
1083
+ filtersTools: filterTools,
1084
+ extra: {
1085
+ body, query, headers, cookies, requestUrl
1086
+ },
1087
+ adminforth: this.adminforth,
1088
+ });
1089
+ if (!resp || (!resp.ok && !resp.error)) {
1090
+ throw new Error(`Hook must return object with {ok: true} or { error: 'Error' } `);
1091
+ }
1092
+ if (resp.error) {
1093
+ return { error: resp.error };
1094
+ }
1095
+ }
1072
1096
  const filters = body.filters;
1073
1097
 
1074
1098
  const normalizedFilters = { operator: AdminForthFilterOperators.AND, subFilters: [] };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/bulk-ai-flow",
3
- "version": "1.23.0",
3
+ "version": "1.23.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -30,7 +30,7 @@
30
30
  "handlebars": "^4.7.8"
31
31
  },
32
32
  "peerDependencies": {
33
- "adminforth": "next"
33
+ "adminforth": "^2.21.1"
34
34
  },
35
35
  "release": {
36
36
  "plugins": [