| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- 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
- }
- }
- }
|