Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

pipeline fixes for naming issues (#5570)

Anthony Stirlingeee17d4d195c
diff --git a/frontend/src/core/components/tools/automate/AutomationCreation.tsx b/frontend/src/core/components/tools/automate/AutomationCreation.tsx
index e71eb73e45..30c839e55f 100644
--- a/frontend/src/core/components/tools/automate/AutomationCreation.tsx
+++ b/frontend/src/core/components/tools/automate/AutomationCreation.tsx
@@ -223,7 +223,7 @@ export default function AutomationCreation({ mode, existingAutomation, onBack, o
createdAt: existingAutomation?.createdAt || new Date().toISOString(),
updatedAt: new Date().toISOString()
};
- downloadFolderScanningConfig(tempAutomation);
+ downloadFolderScanningConfig(tempAutomation, toolRegistry);
}}
disabled={!canSaveAutomation()}
variant="light"
diff --git a/frontend/src/core/components/tools/automate/AutomationSelection.tsx b/frontend/src/core/components/tools/automate/AutomationSelection.tsx
index 73dda01644..b7f600dda6 100644
--- a/frontend/src/core/components/tools/automate/AutomationSelection.tsx
+++ b/frontend/src/core/components/tools/automate/AutomationSelection.tsx
@@ -59,7 +59,7 @@ export default function AutomationSelection({
onClick={() => onRun(automation)}
showMenu={true}
onEdit={() => onEdit(automation)}
- onExport={() => downloadFolderScanningConfig(automation)}
+ onExport={() => downloadFolderScanningConfig(automation, toolRegistry)}
onDelete={() => onDelete(automation)}
toolRegistry={toolRegistry}
/>
diff --git a/frontend/src/core/utils/automationConverter.ts b/frontend/src/core/utils/automationConverter.ts
index 1744f52f34..74b8e0a799 100644
--- a/frontend/src/core/utils/automationConverter.ts
+++ b/frontend/src/core/utils/automationConverter.ts
@@ -3,6 +3,8 @@
*/
import { AutomationConfig } from '@app/types/automation';
+import { ToolRegistry } from '@app/data/toolsTaxonomy';
+import { ToolId } from '@app/types/toolId';
/**
* Pipeline configuration format used by folder scanning
@@ -24,18 +26,54 @@ interface FolderScanningPipeline {
/**
* Converts an AutomationConfig to a folder scanning pipeline configuration
* @param automation The automation configuration to convert
+ * @param toolRegistry The tool registry to map operation types to endpoints
* @returns Folder scanning pipeline configuration
*/
-export function convertToFolderScanningConfig(automation: AutomationConfig): FolderScanningPipeline {
+export function convertToFolderScanningConfig(
+ automation: AutomationConfig,
+ toolRegistry: Partial<ToolRegistry>
+): FolderScanningPipeline {
return {
name: automation.name,
- pipeline: automation.operations.map(op => ({
- operation: op.operation,
- parameters: {
- ...op.parameters,
- fileInput: "automated"
+ pipeline: automation.operations.map(op => {
+ // Map operationType to full API endpoint path
+ const toolId = op.operation as ToolId;
+ const toolEntry = toolRegistry[toolId];
+ const endpointConfig = toolEntry?.operationConfig?.endpoint;
+
+ let endpoint: string | undefined;
+
+ if (typeof endpointConfig === 'string') {
+ endpoint = endpointConfig;
+ } else if (typeof endpointConfig === 'function') {
+ // For dynamic endpoints, call with the saved parameters
+ try {
+ endpoint = endpointConfig(op.parameters);
+ } catch (error) {
+ console.warn(
+ `Failed to resolve dynamic endpoint for operation "${op.operation}". ` +
+ `This may happen if the tool requires specific parameters. ` +
+ `Error: ${error}`
+ );
+ }
}
- })),
+
+ if (!endpoint) {
+ console.warn(
+ `No endpoint found for operation "${op.operation}". ` +
+ `This operation may fail in folder scanning. ` +
+ `Using operation type as fallback.`
+ );
+ }
+
+ return {
+ operation: endpoint || op.operation,
+ parameters: {
+ ...op.parameters,
+ fileInput: "automated"
+ }
+ };
+ }),
_examples: {
outputDir: "{outputFolder}/{folderName}",
outputFileName: "{filename}-{pipelineName}-{date}-{time}"
@@ -48,9 +86,13 @@ export function convertToFolderScanningConfig(automation: AutomationConfig): Fol
/**
* Downloads a folder scanning configuration as a JSON file
* @param automation The automation configuration to export
+ * @param toolRegistry The tool registry to map operation types to endpoints
*/
-export function downloadFolderScanningConfig(automation: AutomationConfig): void {
- const config = convertToFolderScanningConfig(automation);
+export function downloadFolderScanningConfig(
+ automation: AutomationConfig,
+ toolRegistry: Partial<ToolRegistry>
+): void {
+ const config = convertToFolderScanningConfig(automation, toolRegistry);
const json = JSON.stringify(config, null, 2);
const blob = new Blob([json], { type: 'application/json' });
const url = URL.createObjectURL(blob);