Chore/slice workflow utils (#17730)
This commit is contained in:
21
web/app/components/workflow/utils/variable.ts
Normal file
21
web/app/components/workflow/utils/variable.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import type {
|
||||
ValueSelector,
|
||||
} from '../types'
|
||||
import type {
|
||||
BlockEnum,
|
||||
} from '../types'
|
||||
import { hasErrorHandleNode } from '.'
|
||||
|
||||
export const variableTransformer = (v: ValueSelector | string) => {
|
||||
if (typeof v === 'string')
|
||||
return v.replace(/^{{#|#}}$/g, '').split('.')
|
||||
|
||||
return `{{#${v.join('.')}#}}`
|
||||
}
|
||||
|
||||
export const isExceptionVariable = (variable: string, nodeType?: BlockEnum) => {
|
||||
if ((variable === 'error_message' || variable === 'error_type') && hasErrorHandleNode(nodeType))
|
||||
return true
|
||||
|
||||
return false
|
||||
}
|
Reference in New Issue
Block a user