@adminforth/bulk-ai-flow 2.0.0 → 2.0.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
@@ -14,5 +14,5 @@ custom/package.json
14
14
  custom/pnpm-lock.yaml
15
15
  custom/tsconfig.json
16
16
 
17
- sent 130,424 bytes received 191 bytes 261,230.00 bytes/sec
18
- total size is 129,711 speedup is 0.99
17
+ sent 130,394 bytes received 191 bytes 261,170.00 bytes/sec
18
+ total size is 129,681 speedup is 0.99
@@ -3,11 +3,10 @@
3
3
  <Dialog
4
4
  ref="dialogRef"
5
5
  :header="$t('Generate image with AI')"
6
- :closable="true"
7
6
  class="w-full lg:w-[1100px]"
8
7
  :beforeCancelFunction="async () => { emit('close'); return true; }"
9
8
  :buttons="dialogButtons"
10
- :click-to-close-outside="false"
9
+ :close-by-click-outside="false"
11
10
  >
12
11
  <div class="flex flex-col gap-4">
13
12
  <Textarea
@@ -131,7 +130,7 @@ const dialogButtons = computed(() => [
131
130
  label: t('Cancel'),
132
131
  options: {
133
132
  class: 'afcl-button',
134
- mode: 'secondary',
133
+ variant: 'secondary',
135
134
  },
136
135
  onclick: () => emit('close'),
137
136
  },
@@ -13,13 +13,12 @@
13
13
  :class="popupMode === 'generation' ? 'lg:w-auto !lg:max-w-[1600px]'
14
14
  : popupMode === 'settings' ? 'lg:w-[1000px] !lg:max-w-[1000px]'
15
15
  : 'lg:w-[500px] !lg:max-w-[500px]'"
16
- :closable="true"
17
16
  :buttons="popupMode === 'generation' ? generationModeButtons : popupMode === 'settings' ? [
18
17
  {
19
18
  label: t('Cancel'),
20
19
  options: {
21
20
  class: 'afcl-button w-1/6',
22
- mode: 'secondary'
21
+ variant: 'secondary'
23
22
  },
24
23
  onclick: () => { popupMode = 'confirmation'; }
25
24
  },
@@ -36,7 +35,7 @@
36
35
  label: t('Cancel'),
37
36
  options: {
38
37
  class: 'afcl-button w-1/2',
39
- mode: 'secondary'
38
+ variant: 'secondary'
40
39
  },
41
40
  onclick: (dialog) => confirmDialog.tryToHideModal()
42
41
  },
@@ -49,7 +48,7 @@
49
48
  onclick: async () => { await runAiActions(); }
50
49
  }
51
50
  ]"
52
- :click-to-close-outside="false"
51
+ :close-by-click-outside="false"
53
52
  >
54
53
  <div
55
54
  class="bulk-vision-table flex flex-col gap-3 w-full"
@@ -463,7 +462,7 @@ const generationModeButtons = computed(() => {
463
462
  label: t('Cancel'),
464
463
  options: {
465
464
  class: 'afcl-button w-1/6',
466
- mode: 'secondary'
465
+ variant: 'secondary'
467
466
  },
468
467
  onclick: async (dialog) => { await dialog.hide(true); }
469
468
  },
@@ -3,11 +3,10 @@
3
3
  <Dialog
4
4
  ref="dialogRef"
5
5
  :header="$t('Generate image with AI')"
6
- :closable="true"
7
6
  class="w-full lg:w-[1100px]"
8
7
  :beforeCancelFunction="async () => { emit('close'); return true; }"
9
8
  :buttons="dialogButtons"
10
- :click-to-close-outside="false"
9
+ :close-by-click-outside="false"
11
10
  >
12
11
  <div class="flex flex-col gap-4">
13
12
  <Textarea
@@ -131,7 +130,7 @@ const dialogButtons = computed(() => [
131
130
  label: t('Cancel'),
132
131
  options: {
133
132
  class: 'afcl-button',
134
- mode: 'secondary',
133
+ variant: 'secondary',
135
134
  },
136
135
  onclick: () => emit('close'),
137
136
  },
@@ -13,13 +13,12 @@
13
13
  :class="popupMode === 'generation' ? 'lg:w-auto !lg:max-w-[1600px]'
14
14
  : popupMode === 'settings' ? 'lg:w-[1000px] !lg:max-w-[1000px]'
15
15
  : 'lg:w-[500px] !lg:max-w-[500px]'"
16
- :closable="true"
17
16
  :buttons="popupMode === 'generation' ? generationModeButtons : popupMode === 'settings' ? [
18
17
  {
19
18
  label: t('Cancel'),
20
19
  options: {
21
20
  class: 'afcl-button w-1/6',
22
- mode: 'secondary'
21
+ variant: 'secondary'
23
22
  },
24
23
  onclick: () => { popupMode = 'confirmation'; }
25
24
  },
@@ -36,7 +35,7 @@
36
35
  label: t('Cancel'),
37
36
  options: {
38
37
  class: 'afcl-button w-1/2',
39
- mode: 'secondary'
38
+ variant: 'secondary'
40
39
  },
41
40
  onclick: (dialog) => confirmDialog.tryToHideModal()
42
41
  },
@@ -49,7 +48,7 @@
49
48
  onclick: async () => { await runAiActions(); }
50
49
  }
51
50
  ]"
52
- :click-to-close-outside="false"
51
+ :close-by-click-outside="false"
53
52
  >
54
53
  <div
55
54
  class="bulk-vision-table flex flex-col gap-3 w-full"
@@ -463,7 +462,7 @@ const generationModeButtons = computed(() => {
463
462
  label: t('Cancel'),
464
463
  options: {
465
464
  class: 'afcl-button w-1/6',
466
- mode: 'secondary'
465
+ variant: 'secondary'
467
466
  },
468
467
  onclick: async (dialog) => { await dialog.hide(true); }
469
468
  },
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, interpretResource, ActionCheckSource, AllowedActionsEnum } from "adminforth";
11
- import { suggestIfTypo, filtersTools } from "adminforth";
11
+ import { suggestIfTypo, filtersTools, rejectApiRawFilters } from "adminforth";
12
12
  import Handlebars from 'handlebars';
13
13
  import { RateLimiter } from "adminforth";
14
14
  import { randomUUID } from "crypto";
@@ -1102,12 +1102,7 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
1102
1102
  if (oldRecord[value]) {
1103
1103
  // put tag to delete old file
1104
1104
  try {
1105
- if (columnPlugin.pluginOptions.storageAdapter.markKeyForDeletion !== undefined) {
1106
- yield columnPlugin.pluginOptions.storageAdapter.markKeyForDeletion(oldRecord[value]);
1107
- }
1108
- else {
1109
- yield columnPlugin.pluginOptions.storageAdapter.markKeyForDeletation(oldRecord[value]);
1110
- }
1105
+ yield columnPlugin.pluginOptions.storageAdapter.markKeyForDeletion(oldRecord[value]);
1111
1106
  }
1112
1107
  catch (e) {
1113
1108
  // file might be e.g. already deleted, so we catch error
@@ -1117,12 +1112,7 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
1117
1112
  if (recordFields[value] && recordFields[value] !== null) {
1118
1113
  // remove tag from new file
1119
1114
  // in this case we let it crash if it fails: this is a new file which just was uploaded.
1120
- if (columnPlugin.pluginOptions.storageAdapter.markKeyForNotDeletion !== undefined) {
1121
- yield columnPlugin.pluginOptions.storageAdapter.markKeyForNotDeletion(recordFields[value]);
1122
- }
1123
- else {
1124
- yield columnPlugin.pluginOptions.storageAdapter.markKeyForNotDeletation(recordFields[value]);
1125
- }
1115
+ yield columnPlugin.pluginOptions.storageAdapter.markKeyForNotDeletion(recordFields[value]);
1126
1116
  }
1127
1117
  }
1128
1118
  }
@@ -1371,6 +1361,10 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
1371
1361
  if (listAllowed !== true) {
1372
1362
  return { ok: false, error: typeof listAllowed === 'string' ? listAllowed : 'You are not allowed to list records in this resource' };
1373
1363
  }
1364
+ const rawFilterError = rejectApiRawFilters(body.filters);
1365
+ if (rawFilterError) {
1366
+ return rawFilterError;
1367
+ }
1374
1368
  for (const hook of ((_c = (_b = resource.hooks) === null || _b === void 0 ? void 0 : _b.list) === null || _c === void 0 ? void 0 : _c.beforeDatasourceRequest) || []) {
1375
1369
  const filterTools = filtersTools.get(body);
1376
1370
  body.filtersTools = filterTools;
package/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AdminForthFilterOperators, AdminForthPlugin, Filters, interpretResource, ActionCheckSource, AllowedActionsEnum } from "adminforth";
2
2
  import type { IAdminForth, IHttpServer, AdminForthComponentDeclaration, AdminForthResource, AdminUser } from "adminforth";
3
- import { suggestIfTypo, filtersTools } from "adminforth";
3
+ import { suggestIfTypo, filtersTools, rejectApiRawFilters } from "adminforth";
4
4
  import type { PluginOptions } from './types.js';
5
5
  import Handlebars from 'handlebars';
6
6
  import { RateLimiter } from "adminforth";
@@ -1163,11 +1163,7 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
1163
1163
  if (oldRecord[value]) {
1164
1164
  // put tag to delete old file
1165
1165
  try {
1166
- if (columnPlugin.pluginOptions.storageAdapter.markKeyForDeletion !== undefined) {
1167
- await columnPlugin.pluginOptions.storageAdapter.markKeyForDeletion(oldRecord[value]);
1168
- } else {
1169
- await columnPlugin.pluginOptions.storageAdapter.markKeyForDeletation(oldRecord[value]);
1170
- }
1166
+ await columnPlugin.pluginOptions.storageAdapter.markKeyForDeletion(oldRecord[value]);
1171
1167
  } catch (e) {
1172
1168
  // file might be e.g. already deleted, so we catch error
1173
1169
  console.error(`Error setting tag to true for object ${oldRecord[value]}. File will not be auto-cleaned up`);
@@ -1176,11 +1172,7 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
1176
1172
  if (recordFields[value] && recordFields[value] !== null) {
1177
1173
  // remove tag from new file
1178
1174
  // in this case we let it crash if it fails: this is a new file which just was uploaded.
1179
- if (columnPlugin.pluginOptions.storageAdapter.markKeyForNotDeletion !== undefined) {
1180
- await columnPlugin.pluginOptions.storageAdapter.markKeyForNotDeletion(recordFields[value]);
1181
- } else {
1182
- await columnPlugin.pluginOptions.storageAdapter.markKeyForNotDeletation(recordFields[value]);
1183
- }
1175
+ await columnPlugin.pluginOptions.storageAdapter.markKeyForNotDeletion(recordFields[value]);
1184
1176
  }
1185
1177
  }
1186
1178
  }
@@ -1453,6 +1445,10 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
1453
1445
  if (listAllowed !== true) {
1454
1446
  return { ok: false, error: typeof listAllowed === 'string' ? listAllowed : 'You are not allowed to list records in this resource' };
1455
1447
  }
1448
+ const rawFilterError = rejectApiRawFilters(body.filters);
1449
+ if (rawFilterError) {
1450
+ return rawFilterError;
1451
+ }
1456
1452
 
1457
1453
  for (const hook of resource.hooks?.list?.beforeDatasourceRequest || []) {
1458
1454
  const filterTools = filtersTools.get(body);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/bulk-ai-flow",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -29,7 +29,7 @@
29
29
  "description": "Bulk AI workflow plugin for AdminForth for batch field generation and image processing",
30
30
  "devDependencies": {
31
31
  "@types/node": "latest",
32
- "adminforth": "^3.8.2",
32
+ "adminforth": "^4.7.3",
33
33
  "semantic-release": "^24.2.1",
34
34
  "semantic-release-slack-bot": "^4.0.2",
35
35
  "typescript": "^5.7.3"