mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 19:00:59 +03:00
add new utilties - customfunction, setter/getter, replace code editor
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
|
||||
|
||||
class GetVariable_Utilities implements INode {
|
||||
label: string
|
||||
name: string
|
||||
version: number
|
||||
description: string
|
||||
type: string
|
||||
icon: string
|
||||
category: string
|
||||
baseClasses: string[]
|
||||
inputs: INodeParams[]
|
||||
outputs: INodeOutputsValue[]
|
||||
|
||||
constructor() {
|
||||
this.label = 'Get Variable'
|
||||
this.name = 'getVariable'
|
||||
this.version = 1.0
|
||||
this.type = 'GetVariable'
|
||||
this.icon = 'getvar.svg'
|
||||
this.category = 'Utilities'
|
||||
this.description = `Get variable that was saved using Set Variable node`
|
||||
this.baseClasses = [this.type, 'Utilities']
|
||||
this.inputs = [
|
||||
{
|
||||
label: 'Variable Name',
|
||||
name: 'variableName',
|
||||
type: 'string',
|
||||
placeholder: 'var1'
|
||||
}
|
||||
]
|
||||
this.outputs = [
|
||||
{
|
||||
label: 'Output',
|
||||
name: 'output',
|
||||
baseClasses: ['string', 'number', 'boolean', 'json', 'array']
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
||||
const variableName = nodeData.inputs?.variableName as string
|
||||
const dynamicVars = options.dynamicVariables as Record<string, unknown>
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(dynamicVars, variableName)) {
|
||||
return dynamicVars[variableName]
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { nodeClass: GetVariable_Utilities }
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-book-download" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 20h-6a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h12v5" /><path d="M13 16h-7a2 2 0 0 0 -2 2" /><path d="M15 19l3 3l3 -3" /><path d="M18 22v-9" /></svg>
|
||||
|
After Width: | Height: | Size: 438 B |
Reference in New Issue
Block a user