* Build an allowlisted copy of node data for export. * Mirrors the field allowlist in agentflow v2's generateExportFlowData * (packages/ui/src/utils/genericHelper.js) and strips: * - credential references * - password / file / folder input values * - runtime-only state (status, error, war
(data: NodeData)
| 12 | * - runtime-only state (status, error, warning, hint, validationErrors) |
| 13 | */ |
| 14 | function pickExportNodeData(data: NodeData): NodeData { |
| 15 | const exported: NodeData = { |
| 16 | id: data.id, |
| 17 | name: data.name, |
| 18 | label: data.label, |
| 19 | version: data.version, |
| 20 | type: data.type, |
| 21 | color: data.color, |
| 22 | hideInput: data.hideInput, |
| 23 | baseClasses: data.baseClasses, |
| 24 | tags: data.tags, |
| 25 | category: data.category, |
| 26 | description: data.description, |
| 27 | inputParams: data.inputParams, |
| 28 | inputAnchors: data.inputAnchors, |
| 29 | outputAnchors: data.outputAnchors, |
| 30 | outputs: data.outputs, |
| 31 | icon: data.icon |
| 32 | } |
| 33 | |
| 34 | // Strip sensitive values from inputs (password, file, folder) |
| 35 | if (data.inputs) { |
| 36 | const inputDefsByName = new Map((data.inputParams || []).map((i) => [i.name, i])) |
| 37 | const cleanedValues: Record<string, unknown> = {} |
| 38 | for (const [key, value] of Object.entries(data.inputs)) { |
| 39 | const inputDef = inputDefsByName.get(key) |
| 40 | if (inputDef && SENSITIVE_INPUT_TYPES.has(inputDef.type)) continue |
| 41 | cleanedValues[key] = value |
| 42 | } |
| 43 | exported.inputs = cleanedValues |
| 44 | } |
| 45 | |
| 46 | return exported |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Generate export-friendly flow data. |
no test coverage detected