import { NodeConnectionTypes, type INodeType } from '../Interface' type HttpData = { outputs: [ { name: 'body' describe: '响应内容' type: 'string' }, { name: 'status_code' describe: '响应状态码' type: 'number' }, { name: 'headers' describe: '响应头列表 JSON' type: 'object' } ] output_can_alter: false variables: [] method: 'post' ssl_verify: false isInIteration: false default_value: [] body: { type: 'json' data: [ { key: '' type: 'text' value: '{"id":"b3a4aabb-a6b8-47f3-8a32-f45930f7d7b8"}' } ] } params: [] title: 'HTTP 请求' type: 'http-request' error_strategy: 'none' retry_config: { max_retries: 3 retry_enabled: false retry_interval: 100 } url: '#{env.api_address}/api/agent/getAgentInfo' authorization: { type: 'none' config: { api_key: '' header: '' type: '' } } timeout_config: { max_write_timeout: 0 max_read_timeout: 0 max_connect_timeout: 0 } heads: [ { name: 'Authorization' value: '' } ] selected: true desc: '' isInLoop: false } export const httpNode: INodeType = { version: ['1'], displayName: 'HTTP 请求', name: 'http-request', description: '通过HTTP请求获取数据', icon: 'lucide:link', iconColor: '#9373ee', inputs: [NodeConnectionTypes.main], outputs: (data: HttpData) => { // todo: 判断异常处理,如果是分支,添加异常出口 return [NodeConnectionTypes.main] }, // 业务数据 schema: { appAgentId: '', parentId: '', position: { x: 20, y: 30 }, width: 280, height: 60, selected: true, nodeType: 'http-request', zIndex: 1, data: { outputs: [ { name: 'body', describe: '响应内容', type: 'string' }, { name: 'status_code', describe: '响应状态码', type: 'number' }, { name: 'headers', describe: '响应头列表 JSON', type: 'object' } ], output_can_alter: false, variables: [], method: 'post', ssl_verify: false, isInIteration: false, default_value: [], body: { type: 'json', data: [ { key: '', type: 'text', value: '{"id":"b3a4aabb-a6b8-47f3-8a32-f45930f7d7b8"}' } ] }, params: [], title: 'HTTP 请求', type: 'http-request', error_strategy: 'none', retry_config: { max_retries: 3, retry_enabled: false, retry_interval: 100 }, url: '#{env.api_address}/api/agent/getAgentInfo', authorization: { type: 'none', config: { api_key: '', header: '', type: '' } }, timeout_config: { max_write_timeout: 0, max_read_timeout: 0, max_connect_timeout: 0 }, heads: [ { name: 'Authorization', value: '' } ], selected: true, desc: '', isInLoop: false } } }