(nodeData, newNodeId, isAgentflow)
| 116 | } |
| 117 | |
| 118 | export const initNode = (nodeData, newNodeId, isAgentflow) => { |
| 119 | const inputAnchors = [] |
| 120 | const inputParams = [] |
| 121 | const incoming = nodeData.inputs ? nodeData.inputs.length : 0 |
| 122 | |
| 123 | const whitelistTypes = [ |
| 124 | 'asyncOptions', |
| 125 | 'asyncMultiOptions', |
| 126 | 'options', |
| 127 | 'multiOptions', |
| 128 | 'array', |
| 129 | 'datagrid', |
| 130 | 'string', |
| 131 | 'number', |
| 132 | 'boolean', |
| 133 | 'password', |
| 134 | 'json', |
| 135 | 'code', |
| 136 | 'date', |
| 137 | 'file', |
| 138 | 'folder', |
| 139 | 'tabs', |
| 140 | 'conditionFunction', // This is a special type for condition functions |
| 141 | 'timePicker', |
| 142 | 'weekDaysPicker', |
| 143 | 'monthDaysPicker', |
| 144 | 'datePicker' |
| 145 | ] |
| 146 | |
| 147 | // Inputs |
| 148 | for (let i = 0; i < incoming; i += 1) { |
| 149 | const newInput = { |
| 150 | ...nodeData.inputs[i], |
| 151 | id: `${newNodeId}-input-${nodeData.inputs[i].name}-${nodeData.inputs[i].type}` |
| 152 | } |
| 153 | if (whitelistTypes.includes(nodeData.inputs[i].type)) { |
| 154 | inputParams.push(newInput) |
| 155 | } else { |
| 156 | inputAnchors.push(newInput) |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | // Credential |
| 161 | if (nodeData.credential) { |
| 162 | const newInput = { |
| 163 | ...nodeData.credential, |
| 164 | id: `${newNodeId}-input-${nodeData.credential.name}-${nodeData.credential.type}` |
| 165 | } |
| 166 | inputParams.unshift(newInput) |
| 167 | } |
| 168 | |
| 169 | // Outputs |
| 170 | let outputAnchors = initializeOutputAnchors(nodeData, newNodeId, isAgentflow) |
| 171 | |
| 172 | /* Initial |
| 173 | inputs = [ |
| 174 | { |
| 175 | label: 'field_label_1', |
no test coverage detected