fix: iteration file arry type

This commit is contained in:
Joel 2024-09-18 15:02:45 +08:00
parent 403fede432
commit 602d2486bd

View File

@ -402,18 +402,19 @@ const getIterationItemType = ({
beforeNodesOutputVars: NodeOutPutVar[]
}): VarType => {
const outputVarNodeId = valueSelector[0]
const targetVar = beforeNodesOutputVars.find(v => v.nodeId === outputVarNodeId)
const isSystem = isSystemVar(valueSelector)
const targetVar = isSystem ? beforeNodesOutputVars.find(v => v.isStartNode) : beforeNodesOutputVars.find(v => v.nodeId === outputVarNodeId)
if (!targetVar)
return VarType.string
let arrayType: VarType = VarType.string
const isSystem = isSystemVar(valueSelector)
let curr: any = targetVar.vars
if (isSystem)
return curr.find((v: any) => v.variable === (valueSelector).join('.'))?.type;
if (isSystem) {
arrayType = curr.find((v: any) => v.variable === (valueSelector).join('.'))?.type
}
else {
(valueSelector).slice(1).forEach((key, i) => {
const isLast = i === valueSelector.length - 2
curr = curr?.find((v: any) => v.variable === key)
@ -425,6 +426,8 @@ const getIterationItemType = ({
curr = curr.children
}
})
}
switch (arrayType as VarType) {
case VarType.arrayString:
return VarType.string
@ -435,7 +438,7 @@ const getIterationItemType = ({
case VarType.array:
return VarType.any
case VarType.arrayFile:
return VarType.object
return VarType.file
default:
return VarType.string
}