77 lines
2.4 KiB
TypeScript

export type WorkflowNodeDefinition = {
id: string;
name: string;
category: "Source" | "Transform" | "Inspect" | "Annotate" | "Export" | "Utility";
description: string;
executorType: "python" | "docker" | "http";
inputSchemaSummary: string;
outputSchemaSummary: string;
supportsCodeHook?: boolean;
};
export const WORKFLOW_NODE_DEFINITIONS: WorkflowNodeDefinition[] = [
{
id: "source-asset",
name: "Source Asset",
category: "Source",
description: "Load an uploaded asset or registered storage path.",
executorType: "python",
inputSchemaSummary: "assetRef",
outputSchemaSummary: "assetRef",
},
{
id: "extract-archive",
name: "Extract Archive",
category: "Transform",
description: "Expand a compressed archive into a managed folder artifact.",
executorType: "docker",
inputSchemaSummary: "assetRef",
outputSchemaSummary: "artifactRef",
supportsCodeHook: true,
},
{
id: "rename-folder",
name: "Rename Delivery Folder",
category: "Transform",
description: "Rename the top-level delivery folder to the business naming convention.",
executorType: "python",
inputSchemaSummary: "artifactRef",
outputSchemaSummary: "artifactRef",
supportsCodeHook: true,
},
{
id: "validate-structure",
name: "Validate Structure",
category: "Inspect",
description: "Validate required directories and metadata files.",
executorType: "python",
inputSchemaSummary: "artifactRef",
outputSchemaSummary: "artifactRef + report",
supportsCodeHook: true,
},
{
id: "export-delivery-package",
name: "Export Delivery Package",
category: "Export",
description: "Produce the final delivery package artifact for upload.",
executorType: "http",
inputSchemaSummary: "artifactRef",
outputSchemaSummary: "artifactRef",
},
];
export function renderNodeLibrary(): string {
const sections = ["Source", "Transform", "Inspect", "Annotate", "Export", "Utility"]
.map((category) => {
const nodes = WORKFLOW_NODE_DEFINITIONS.filter(
(item) => item.category === category,
)
.map((item) => `<li data-node-id="${item.id}">${item.name}</li>`)
.join("");
return `<section><h3>${category}</h3><ul>${nodes || "<li>none</li>"}</ul></section>`;
})
.join("");
return `<aside data-view="node-library"><h2>Node Library</h2>${sections}</aside>`;
}