@adminforth/bulk-ai-flow 1.27.0 → 1.27.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 +1 -1
- package/dist/index.js +19 -62
- package/index.ts +23 -61
- package/package.json +3 -3
package/build.log
CHANGED
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { AdminForthFilterOperators, AdminForthPlugin,
|
|
10
|
+
import { AdminForthFilterOperators, AdminForthPlugin, Filters } from "adminforth";
|
|
11
11
|
import { suggestIfTypo, filtersTools } from "adminforth";
|
|
12
12
|
import Handlebars from 'handlebars';
|
|
13
13
|
import { RateLimiter } from "adminforth";
|
|
@@ -33,7 +33,7 @@ const getImageGenerationPromptsBodySchema = z.object({
|
|
|
33
33
|
}).strict();
|
|
34
34
|
const createJobBodySchema = z.object({
|
|
35
35
|
actionType: z.string().nullish(),
|
|
36
|
-
recordId: z.
|
|
36
|
+
recordId: z.union([z.string(), z.number()]).nullish(),
|
|
37
37
|
customPrompt: z.string().nullish(),
|
|
38
38
|
filterFilledFields: z.boolean().nullish(),
|
|
39
39
|
sessionIds: z.array(z.string()).nullish(),
|
|
@@ -811,38 +811,12 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
811
811
|
return `${this.pluginOptions.actionName}`;
|
|
812
812
|
}
|
|
813
813
|
setupEndpoints(server) {
|
|
814
|
-
server.endpoint({
|
|
815
|
-
method: 'POST',
|
|
816
|
-
path: `/plugin/${this.pluginInstanceId}/get_records`,
|
|
817
|
-
handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, response }) {
|
|
818
|
-
const parsed = parseBody(getRecordsBodySchema, body, response);
|
|
819
|
-
if ('error' in parsed)
|
|
820
|
-
return parsed.error;
|
|
821
|
-
const data = parsed.data;
|
|
822
|
-
if (!Array.isArray(data.record)) {
|
|
823
|
-
return { records: [] };
|
|
824
|
-
}
|
|
825
|
-
let records = [];
|
|
826
|
-
const primaryKeyColumn = this.resourceConfig.columns.find((col) => col.primaryKey);
|
|
827
|
-
records = yield this.adminforth.resource(this.resourceConfig.resourceId).list([Filters.IN(primaryKeyColumn.name, data.record)]);
|
|
828
|
-
for (const [index, record] of records.entries()) {
|
|
829
|
-
records[index]._label = this.resourceConfig.recordLabel(records[index]);
|
|
830
|
-
}
|
|
831
|
-
const order = Object.fromEntries(data.record.map((id, i) => [id, i]));
|
|
832
|
-
const sortedRecords = records.sort((a, b) => order[a.id] - order[b.id]);
|
|
833
|
-
return {
|
|
834
|
-
records: sortedRecords,
|
|
835
|
-
};
|
|
836
|
-
})
|
|
837
|
-
});
|
|
838
814
|
server.endpoint({
|
|
839
815
|
method: 'POST',
|
|
840
816
|
path: `/plugin/${this.pluginInstanceId}/get_old_data`,
|
|
817
|
+
request_schema: getOldDataBodySchema,
|
|
841
818
|
handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, response }) {
|
|
842
|
-
const
|
|
843
|
-
if ('error' in parsed)
|
|
844
|
-
return parsed.error;
|
|
845
|
-
const data = parsed.data;
|
|
819
|
+
const data = body;
|
|
846
820
|
const recordId = data.recordId;
|
|
847
821
|
if (recordId === undefined || recordId === null) {
|
|
848
822
|
return { ok: false, error: "Missing recordId" };
|
|
@@ -860,11 +834,9 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
860
834
|
server.endpoint({
|
|
861
835
|
method: 'POST',
|
|
862
836
|
path: `/plugin/${this.pluginInstanceId}/get_images`,
|
|
837
|
+
request_schema: getImagesBodySchema,
|
|
863
838
|
handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, response }) {
|
|
864
|
-
const
|
|
865
|
-
if ('error' in parsed)
|
|
866
|
-
return parsed.error;
|
|
867
|
-
const data = parsed.data;
|
|
839
|
+
const data = body;
|
|
868
840
|
let images = [];
|
|
869
841
|
if (data.record) {
|
|
870
842
|
for (const record of data.record) {
|
|
@@ -881,11 +853,9 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
881
853
|
server.endpoint({
|
|
882
854
|
method: 'POST',
|
|
883
855
|
path: `/plugin/${this.pluginInstanceId}/update_fields`,
|
|
856
|
+
request_schema: updateFieldsBodySchema,
|
|
884
857
|
handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, adminUser, headers, response }) {
|
|
885
|
-
const
|
|
886
|
-
if ('error' in parsed)
|
|
887
|
-
return parsed.error;
|
|
888
|
-
const data = parsed.data;
|
|
858
|
+
const data = body;
|
|
889
859
|
let isAllowedToSave = { ok: true, error: '' };
|
|
890
860
|
if (this.options.isAllowedToSave) {
|
|
891
861
|
isAllowedToSave = yield this.options.isAllowedToSave({ record: {}, adminUser: adminUser, resource: this.resourceConfig });
|
|
@@ -986,12 +956,10 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
986
956
|
server.endpoint({
|
|
987
957
|
method: 'POST',
|
|
988
958
|
path: `/plugin/${this.pluginInstanceId}/get_image_generation_prompts`,
|
|
959
|
+
request_schema: getImageGenerationPromptsBodySchema,
|
|
989
960
|
handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, headers, response }) {
|
|
990
961
|
var _b;
|
|
991
|
-
const
|
|
992
|
-
if ('error' in parsed)
|
|
993
|
-
return parsed.error;
|
|
994
|
-
const data = parsed.data;
|
|
962
|
+
const data = body;
|
|
995
963
|
const Id = data.recordId || [];
|
|
996
964
|
const customPrompt = data.customPrompt || null;
|
|
997
965
|
const record = yield this.adminforth.resource(this.resourceConfig.resourceId).get([Filters.EQ((_b = this.resourceConfig.columns.find(c => c.primaryKey)) === null || _b === void 0 ? void 0 : _b.name, Id)]);
|
|
@@ -1013,11 +981,9 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
1013
981
|
server.endpoint({
|
|
1014
982
|
method: 'POST',
|
|
1015
983
|
path: `/plugin/${this.pluginInstanceId}/create-job`,
|
|
984
|
+
request_schema: createJobBodySchema,
|
|
1016
985
|
handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, adminUser, headers, response }) {
|
|
1017
|
-
const
|
|
1018
|
-
if ('error' in parsed)
|
|
1019
|
-
return parsed.error;
|
|
1020
|
-
const data = parsed.data;
|
|
986
|
+
const data = body;
|
|
1021
987
|
const { actionType, recordId, customPrompt, filterFilledFields, sessionIds } = data;
|
|
1022
988
|
if (this.options.rateLimits) {
|
|
1023
989
|
if (sessionIds && sessionIds.length > 0) {
|
|
@@ -1076,11 +1042,9 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
1076
1042
|
server.endpoint({
|
|
1077
1043
|
method: 'POST',
|
|
1078
1044
|
path: `/plugin/${this.pluginInstanceId}/get-job-status`,
|
|
1045
|
+
request_schema: jobStatusBodySchema,
|
|
1079
1046
|
handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, adminUser, headers, response }) {
|
|
1080
|
-
const
|
|
1081
|
-
if ('error' in parsed)
|
|
1082
|
-
return parsed.error;
|
|
1083
|
-
const data = parsed.data;
|
|
1047
|
+
const data = body;
|
|
1084
1048
|
const jobId = data.jobId;
|
|
1085
1049
|
if (!jobId) {
|
|
1086
1050
|
response.setStatus(400);
|
|
@@ -1113,12 +1077,10 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
1113
1077
|
server.endpoint({
|
|
1114
1078
|
method: 'POST',
|
|
1115
1079
|
path: `/plugin/${this.pluginInstanceId}/update-rate-limits`,
|
|
1080
|
+
request_schema: updateRateLimitsBodySchema,
|
|
1116
1081
|
handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, adminUser, headers, response }) {
|
|
1117
1082
|
var _b, _c, _d;
|
|
1118
|
-
const
|
|
1119
|
-
if ('error' in parsed)
|
|
1120
|
-
return parsed.error;
|
|
1121
|
-
const data = parsed.data;
|
|
1083
|
+
const data = body;
|
|
1122
1084
|
const actionType = data.actionType;
|
|
1123
1085
|
const sessionId = randomUUID();
|
|
1124
1086
|
this.sessionIds.add(sessionId);
|
|
@@ -1144,12 +1106,10 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
1144
1106
|
server.endpoint({
|
|
1145
1107
|
method: 'POST',
|
|
1146
1108
|
path: `/plugin/${this.pluginInstanceId}/compile_old_image_link`,
|
|
1109
|
+
request_schema: compileOldImageLinkBodySchema,
|
|
1147
1110
|
handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, adminUser, headers, response }) {
|
|
1148
1111
|
var _b, _c;
|
|
1149
|
-
const
|
|
1150
|
-
if ('error' in parsed)
|
|
1151
|
-
return parsed.error;
|
|
1152
|
-
const data = parsed.data;
|
|
1112
|
+
const data = body;
|
|
1153
1113
|
const image = data.image;
|
|
1154
1114
|
const columnName = data.columnName;
|
|
1155
1115
|
if (!image) {
|
|
@@ -1177,12 +1137,9 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
1177
1137
|
server.endpoint({
|
|
1178
1138
|
method: 'POST',
|
|
1179
1139
|
path: `/plugin/${this.pluginInstanceId}/get_filtered_ids`,
|
|
1140
|
+
request_schema: getFilteredIdsBodySchema,
|
|
1180
1141
|
handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, adminUser, headers, query, cookies, requestUrl, response }) {
|
|
1181
1142
|
var _b, _c;
|
|
1182
|
-
const parsed = parseBody(getFilteredIdsBodySchema, body, response);
|
|
1183
|
-
if ('error' in parsed)
|
|
1184
|
-
return parsed.error;
|
|
1185
|
-
const data = parsed.data;
|
|
1186
1143
|
const resource = this.resourceConfig;
|
|
1187
1144
|
for (const hook of ((_c = (_b = resource.hooks) === null || _b === void 0 ? void 0 : _b.list) === null || _c === void 0 ? void 0 : _c.beforeDatasourceRequest) || []) {
|
|
1188
1145
|
const filterTools = filtersTools.get(body);
|
package/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AdminForthFilterOperators, AdminForthPlugin,
|
|
1
|
+
import { AdminForthFilterOperators, AdminForthPlugin, Filters } from "adminforth";
|
|
2
2
|
import type { IAdminForth, IHttpServer, AdminForthComponentDeclaration, AdminForthResource } from "adminforth";
|
|
3
3
|
import { suggestIfTypo, filtersTools } from "adminforth";
|
|
4
4
|
import type { PluginOptions } from './types.js';
|
|
@@ -32,7 +32,7 @@ const getImageGenerationPromptsBodySchema = z.object({
|
|
|
32
32
|
|
|
33
33
|
const createJobBodySchema = z.object({
|
|
34
34
|
actionType: z.string().nullish(),
|
|
35
|
-
recordId: z.
|
|
35
|
+
recordId: z.union([z.string(), z.number()]).nullish(),
|
|
36
36
|
customPrompt: z.string().nullish(),
|
|
37
37
|
filterFilledFields: z.boolean().nullish(),
|
|
38
38
|
sessionIds: z.array(z.string()).nullish(),
|
|
@@ -163,7 +163,7 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
163
163
|
return prompt;
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
private async analyze_image(jobId: string, recordId: string, adminUser: any, headers: Record<string, string | string[] | undefined>, customPrompt? : string, filterFilledFields: boolean = true) {
|
|
166
|
+
private async analyze_image(jobId: string, recordId: string | number, adminUser: any, headers: Record<string, string | string[] | undefined>, customPrompt? : string, filterFilledFields: boolean = true) {
|
|
167
167
|
// TODO: need to do correct check of rate limit
|
|
168
168
|
// if (this.options.rateLimits && this.options.rateLimits.fillFieldsFromImages && await this.checkRateLimit("fillFieldsFromImages" ,this.options.rateLimits.fillFieldsFromImages, headers)) {
|
|
169
169
|
// jobs.set(jobId, { status: 'failed', error: "Rate limit exceeded" });
|
|
@@ -248,7 +248,7 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
248
248
|
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
-
private async analyzeNoImages(jobId: string, recordId: string, adminUser: any, headers: Record<string, string | string[] | undefined>, customPrompt? : string, filterFilledFields: boolean = true) {
|
|
251
|
+
private async analyzeNoImages(jobId: string, recordId: string | number, adminUser: any, headers: Record<string, string | string[] | undefined>, customPrompt? : string, filterFilledFields: boolean = true) {
|
|
252
252
|
// TODO: need to do correct check of rate limit
|
|
253
253
|
// if (this.options.rateLimits && this.options.rateLimits.fillPlainFields && await this.checkRateLimit("fillPlainFields" ,this.options.rateLimits.fillPlainFields, headers)) {
|
|
254
254
|
// jobs.set(jobId, { status: 'failed', error: "Rate limit exceeded" });
|
|
@@ -312,7 +312,7 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
|
|
315
|
-
private async initialImageGenerate(jobId: string, recordId: string, adminUser: any, headers: Record<string, string | string[] | undefined>, customPrompt? : string, filterFilledFields: boolean = true) {
|
|
315
|
+
private async initialImageGenerate(jobId: string, recordId: string | number, adminUser: any, headers: Record<string, string | string[] | undefined>, customPrompt? : string, filterFilledFields: boolean = true) {
|
|
316
316
|
// TODO: need to do correct check of rate limit
|
|
317
317
|
// if (this.options.rateLimits && this.options.rateLimits.generateImages && await this.checkRateLimit("generateImages" ,this.options.rateLimits.generateImages, headers)) {
|
|
318
318
|
// jobs.set(jobId, { status: 'failed', error: "Rate limit exceeded" });
|
|
@@ -424,7 +424,7 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
426
|
|
|
427
|
-
private async regenerateImage(jobId: string, recordId: string, fieldName: string, prompt: string, adminUser: any, headers: Record<string, string | string[] | undefined>) {
|
|
427
|
+
private async regenerateImage(jobId: string, recordId: string | number, fieldName: string, prompt: string, adminUser: any, headers: Record<string, string | string[] | undefined>) {
|
|
428
428
|
const Id = recordId;
|
|
429
429
|
let isError = false;
|
|
430
430
|
// TODO: need to do correct check of rate limit
|
|
@@ -829,41 +829,12 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
829
829
|
}
|
|
830
830
|
|
|
831
831
|
setupEndpoints(server: IHttpServer) {
|
|
832
|
-
server.endpoint({
|
|
833
|
-
method: 'POST',
|
|
834
|
-
path: `/plugin/${this.pluginInstanceId}/get_records`,
|
|
835
|
-
handler: async ({ body, response }) => {
|
|
836
|
-
const parsed = parseBody(getRecordsBodySchema, body, response);
|
|
837
|
-
if ('error' in parsed) return parsed.error;
|
|
838
|
-
const data = parsed.data;
|
|
839
|
-
if (!Array.isArray(data.record)) {
|
|
840
|
-
return { records: [] };
|
|
841
|
-
}
|
|
842
|
-
let records = [];
|
|
843
|
-
const primaryKeyColumn = this.resourceConfig.columns.find((col) => col.primaryKey);
|
|
844
|
-
records = await this.adminforth.resource(this.resourceConfig.resourceId).list([Filters.IN(primaryKeyColumn.name, data.record)]);
|
|
845
|
-
for( const [index, record] of records.entries() ) {
|
|
846
|
-
records[index]._label = this.resourceConfig.recordLabel(records[index]);
|
|
847
|
-
}
|
|
848
|
-
const order = Object.fromEntries(data.record.map((id, i) => [id, i]));
|
|
849
|
-
|
|
850
|
-
const sortedRecords = records.sort(
|
|
851
|
-
(a, b) => order[a.id] - order[b.id]
|
|
852
|
-
);
|
|
853
|
-
return {
|
|
854
|
-
records: sortedRecords,
|
|
855
|
-
};
|
|
856
|
-
}
|
|
857
|
-
});
|
|
858
|
-
|
|
859
|
-
|
|
860
832
|
server.endpoint({
|
|
861
833
|
method: 'POST',
|
|
862
834
|
path: `/plugin/${this.pluginInstanceId}/get_old_data`,
|
|
835
|
+
request_schema: getOldDataBodySchema,
|
|
863
836
|
handler: async ({ body, response }) => {
|
|
864
|
-
const
|
|
865
|
-
if ('error' in parsed) return parsed.error;
|
|
866
|
-
const data = parsed.data;
|
|
837
|
+
const data = body as z.infer<typeof getOldDataBodySchema>;
|
|
867
838
|
const recordId = data.recordId;
|
|
868
839
|
if (recordId === undefined || recordId === null) {
|
|
869
840
|
return { ok: false, error: "Missing recordId" };
|
|
@@ -883,10 +854,9 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
883
854
|
server.endpoint({
|
|
884
855
|
method: 'POST',
|
|
885
856
|
path: `/plugin/${this.pluginInstanceId}/get_images`,
|
|
857
|
+
request_schema: getImagesBodySchema,
|
|
886
858
|
handler: async ({ body, response }) => {
|
|
887
|
-
const
|
|
888
|
-
if ('error' in parsed) return parsed.error;
|
|
889
|
-
const data = parsed.data;
|
|
859
|
+
const data = body as z.infer<typeof getImagesBodySchema>;
|
|
890
860
|
let images = [];
|
|
891
861
|
if(data.record){
|
|
892
862
|
for( const record of data.record ) {
|
|
@@ -905,10 +875,9 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
905
875
|
server.endpoint({
|
|
906
876
|
method: 'POST',
|
|
907
877
|
path: `/plugin/${this.pluginInstanceId}/update_fields`,
|
|
878
|
+
request_schema: updateFieldsBodySchema,
|
|
908
879
|
handler: async ({ body, adminUser, headers, response }) => {
|
|
909
|
-
const
|
|
910
|
-
if ('error' in parsed) return parsed.error;
|
|
911
|
-
const data = parsed.data;
|
|
880
|
+
const data = body as z.infer<typeof updateFieldsBodySchema>;
|
|
912
881
|
let isAllowedToSave: any = { ok: true, error: '' };
|
|
913
882
|
if(this.options.isAllowedToSave) {
|
|
914
883
|
isAllowedToSave = await this.options.isAllowedToSave({ record: {}, adminUser: adminUser, resource: this.resourceConfig });
|
|
@@ -1015,10 +984,9 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
1015
984
|
server.endpoint({
|
|
1016
985
|
method: 'POST',
|
|
1017
986
|
path: `/plugin/${this.pluginInstanceId}/get_image_generation_prompts`,
|
|
987
|
+
request_schema: getImageGenerationPromptsBodySchema,
|
|
1018
988
|
handler: async ({ body, headers, response }) => {
|
|
1019
|
-
const
|
|
1020
|
-
if ('error' in parsed) return parsed.error;
|
|
1021
|
-
const data = parsed.data;
|
|
989
|
+
const data = body as z.infer<typeof getImageGenerationPromptsBodySchema>;
|
|
1022
990
|
const Id = data.recordId || [];
|
|
1023
991
|
const customPrompt = data.customPrompt || null;
|
|
1024
992
|
const record = await this.adminforth.resource(this.resourceConfig.resourceId).get([Filters.EQ(this.resourceConfig.columns.find(c => c.primaryKey)?.name, Id)]);
|
|
@@ -1044,10 +1012,9 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
1044
1012
|
server.endpoint({
|
|
1045
1013
|
method: 'POST',
|
|
1046
1014
|
path: `/plugin/${this.pluginInstanceId}/create-job`,
|
|
1015
|
+
request_schema: createJobBodySchema,
|
|
1047
1016
|
handler: async ({ body, adminUser, headers, response }) => {
|
|
1048
|
-
const
|
|
1049
|
-
if ('error' in parsed) return parsed.error;
|
|
1050
|
-
const data = parsed.data;
|
|
1017
|
+
const data = body as z.infer<typeof createJobBodySchema>;
|
|
1051
1018
|
const { actionType, recordId, customPrompt, filterFilledFields, sessionIds } = data;
|
|
1052
1019
|
if (this.options.rateLimits) {
|
|
1053
1020
|
if (sessionIds && sessionIds.length > 0) {
|
|
@@ -1106,10 +1073,9 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
1106
1073
|
server.endpoint({
|
|
1107
1074
|
method: 'POST',
|
|
1108
1075
|
path: `/plugin/${this.pluginInstanceId}/get-job-status`,
|
|
1076
|
+
request_schema: jobStatusBodySchema,
|
|
1109
1077
|
handler: async ({ body, adminUser, headers, response }) => {
|
|
1110
|
-
const
|
|
1111
|
-
if ('error' in parsed) return parsed.error;
|
|
1112
|
-
const data = parsed.data;
|
|
1078
|
+
const data = body as z.infer<typeof jobStatusBodySchema>;
|
|
1113
1079
|
const jobId = data.jobId;
|
|
1114
1080
|
if (!jobId) {
|
|
1115
1081
|
response.setStatus(400);
|
|
@@ -1147,10 +1113,9 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
1147
1113
|
server.endpoint({
|
|
1148
1114
|
method: 'POST',
|
|
1149
1115
|
path: `/plugin/${this.pluginInstanceId}/update-rate-limits`,
|
|
1116
|
+
request_schema: updateRateLimitsBodySchema,
|
|
1150
1117
|
handler: async ({ body, adminUser, headers, response }) => {
|
|
1151
|
-
const
|
|
1152
|
-
if ('error' in parsed) return parsed.error;
|
|
1153
|
-
const data = parsed.data;
|
|
1118
|
+
const data = body as z.infer<typeof updateRateLimitsBodySchema>;
|
|
1154
1119
|
const actionType = data.actionType;
|
|
1155
1120
|
const sessionId = randomUUID();
|
|
1156
1121
|
this.sessionIds.add(sessionId);
|
|
@@ -1178,10 +1143,9 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
1178
1143
|
server.endpoint({
|
|
1179
1144
|
method: 'POST',
|
|
1180
1145
|
path: `/plugin/${this.pluginInstanceId}/compile_old_image_link`,
|
|
1146
|
+
request_schema: compileOldImageLinkBodySchema,
|
|
1181
1147
|
handler: async ({ body, adminUser, headers, response }) => {
|
|
1182
|
-
const
|
|
1183
|
-
if ('error' in parsed) return parsed.error;
|
|
1184
|
-
const data = parsed.data;
|
|
1148
|
+
const data = body as z.infer<typeof compileOldImageLinkBodySchema>;
|
|
1185
1149
|
const image = data.image;
|
|
1186
1150
|
const columnName = data.columnName;
|
|
1187
1151
|
if (!image) {
|
|
@@ -1211,10 +1175,8 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
1211
1175
|
server.endpoint({
|
|
1212
1176
|
method: 'POST',
|
|
1213
1177
|
path: `/plugin/${this.pluginInstanceId}/get_filtered_ids`,
|
|
1178
|
+
request_schema: getFilteredIdsBodySchema,
|
|
1214
1179
|
handler: async ({ body, adminUser, headers, query, cookies, requestUrl, response }) => {
|
|
1215
|
-
const parsed = parseBody(getFilteredIdsBodySchema, body, response);
|
|
1216
|
-
if ('error' in parsed) return parsed.error;
|
|
1217
|
-
const data = parsed.data;
|
|
1218
1180
|
const resource = this.resourceConfig;
|
|
1219
1181
|
|
|
1220
1182
|
for (const hook of resource.hooks?.list?.beforeDatasourceRequest || []) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adminforth/bulk-ai-flow",
|
|
3
|
-
"version": "1.27.
|
|
3
|
+
"version": "1.27.2",
|
|
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": "^3.
|
|
28
|
+
"adminforth": "^3.8.2",
|
|
29
29
|
"semantic-release": "^24.2.1",
|
|
30
30
|
"semantic-release-slack-bot": "^4.0.2",
|
|
31
31
|
"typescript": "^5.7.3"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"zod": "^4.3.6"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"adminforth": "^3.
|
|
39
|
+
"adminforth": "^3.8.2"
|
|
40
40
|
},
|
|
41
41
|
"release": {
|
|
42
42
|
"plugins": [
|