(sourceOutput: unknown, sourceHandle: string)
| 143 | } |
| 144 | |
| 145 | export function resolveInputValue(sourceOutput: unknown, sourceHandle: string): unknown { |
| 146 | if (sourceOutput === null || sourceOutput === undefined) { |
| 147 | return undefined; |
| 148 | } |
| 149 | |
| 150 | if (sourceHandle === '__self__') { |
| 151 | return sourceOutput; |
| 152 | } |
| 153 | |
| 154 | if (typeof sourceOutput === 'object') { |
| 155 | const record = sourceOutput as Record<string, unknown>; |
| 156 | |
| 157 | // If it's a spilled marker, we return the marker itself along with the sourceHandle |
| 158 | // The activity will then be responsible for fetching the full data |
| 159 | // and extracting the specific handle. |
| 160 | if (isSpilledDataMarker(sourceOutput)) { |
| 161 | return { |
| 162 | ...sourceOutput, |
| 163 | __spilled_handle__: sourceHandle, |
| 164 | }; |
| 165 | } |
| 166 | |
| 167 | if (Object.prototype.hasOwnProperty.call(record, sourceHandle)) { |
| 168 | return record[sourceHandle]; |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | return undefined; |
| 173 | } |
| 174 | |
| 175 | interface ComponentInputMetadata { |
| 176 | id: string; |
no test coverage detected