feat(flow): 新增分组执行与异步模式支持
refactor(executors): 将 Rhai 引擎评估逻辑迁移至 script_rhai 模块 docs: 添加 Flow 架构文档与示例 JSON feat(i18n): 新增前端多语言支持 perf(axios): 优化 token 刷新与 401 处理逻辑 style: 统一代码格式化与简化条件判断
This commit is contained in:
336
docs/flow/code_js1.json
Normal file
336
docs/flow/code_js1.json
Normal file
@ -0,0 +1,336 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"id": "start_0",
|
||||
"type": "start",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 180,
|
||||
"y": 189.8
|
||||
}
|
||||
},
|
||||
"data": {
|
||||
"title": "Start",
|
||||
"outputs": {
|
||||
"type": "object",
|
||||
"properties": {},
|
||||
"required": []
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "end_0",
|
||||
"type": "end",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 2940,
|
||||
"y": 189.8
|
||||
}
|
||||
},
|
||||
"data": {
|
||||
"title": "End"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "variable_zOb3P",
|
||||
"type": "variable",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 2020,
|
||||
"y": 179.8
|
||||
}
|
||||
},
|
||||
"data": {
|
||||
"title": "Variable_1",
|
||||
"assign": [
|
||||
{
|
||||
"operator": "declare",
|
||||
"left": "jss",
|
||||
"right": {
|
||||
"type": "constant",
|
||||
"content": "${\"user_n\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
"type": "object",
|
||||
"required": [],
|
||||
"properties": {
|
||||
"jss": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "code_y71Sd",
|
||||
"type": "javascript",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 640,
|
||||
"y": 162.3
|
||||
}
|
||||
},
|
||||
"data": {
|
||||
"title": "JS",
|
||||
"inputsValues": {
|
||||
"input": {
|
||||
"type": "constant",
|
||||
"content": "",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"extra": {
|
||||
"index": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
"script": {
|
||||
"language": "javascript",
|
||||
"content": "ctx.vri=\"usertest\"; ctx[\"user_n\"]=\"user_nuser_n\" for (let i = 0; i < 5; i++) { //console.log(`第 ${i} 次循环`); ctx[i]=\"v\"+i; }"
|
||||
},
|
||||
"outputs": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"key0": {
|
||||
"type": "string"
|
||||
},
|
||||
"key1": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"key2": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"key21": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"inputs": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"input": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "http_0IIt-",
|
||||
"type": "http",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 1598.880308880309,
|
||||
"y": -317.18146718146716
|
||||
}
|
||||
},
|
||||
"data": {
|
||||
"title": "HTTP_1",
|
||||
"api": {
|
||||
"method": "GET",
|
||||
"url": {
|
||||
"type": "template",
|
||||
"content": "https://account.aliyun.com"
|
||||
}
|
||||
},
|
||||
"body": {
|
||||
"bodyType": "JSON"
|
||||
},
|
||||
"outputs": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"body": {
|
||||
"type": "string"
|
||||
},
|
||||
"headers": {
|
||||
"type": "object"
|
||||
},
|
||||
"statusCode": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"timeout": {
|
||||
"timeout": 10000,
|
||||
"retryTimes": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "variable_zy_Ae",
|
||||
"type": "variable",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 2480,
|
||||
"y": 179.8
|
||||
}
|
||||
},
|
||||
"data": {
|
||||
"title": "http响应",
|
||||
"assign": [
|
||||
{
|
||||
"operator": "declare",
|
||||
"left": "http_resp",
|
||||
"right": {
|
||||
"type": "ref",
|
||||
"content": [
|
||||
"http_0IIt-",
|
||||
"headers"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
"type": "object",
|
||||
"required": [],
|
||||
"properties": {
|
||||
"http_resp": {
|
||||
"type": "object",
|
||||
"required": [],
|
||||
"properties": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "code_iyMNK",
|
||||
"type": "script",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 1100,
|
||||
"y": 162.3
|
||||
}
|
||||
},
|
||||
"data": {
|
||||
"title": "rhai",
|
||||
"inputsValues": {
|
||||
"input": {
|
||||
"type": "constant",
|
||||
"content": ""
|
||||
}
|
||||
},
|
||||
"script": {
|
||||
"language": "rhai",
|
||||
"content": "// 修改字段 ctx.addr_name = \"Alice\"; ctx.count = 10; // 添加新字段 ctx.city = \"Beijing\"; // 还可以用下标方式 ctx[\"extra\"] = 123;"
|
||||
},
|
||||
"outputs": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"key0": {
|
||||
"type": "string"
|
||||
},
|
||||
"key1": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"key2": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"key21": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": []
|
||||
},
|
||||
"inputs": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"input": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "db_LMgXg",
|
||||
"type": "db",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 1606.042471042471,
|
||||
"y": 253.8
|
||||
}
|
||||
},
|
||||
"data": {
|
||||
"title": "DB_1",
|
||||
"db": {
|
||||
"sql": {
|
||||
"type": "template",
|
||||
"content": "SELECT t.* FROM udmin.departments t"
|
||||
},
|
||||
"params": [],
|
||||
"outputKey": "db_response",
|
||||
"connection": {
|
||||
"driver": "mysql",
|
||||
"mode": "fields",
|
||||
"database": "udmin",
|
||||
"host": "127.0.0.1",
|
||||
"port": 3306,
|
||||
"username": "root",
|
||||
"password": "123456"
|
||||
},
|
||||
"output": {
|
||||
"mode": "rows"
|
||||
}
|
||||
},
|
||||
"outputs": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"db_response": {
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"sourceNodeID": "start_0",
|
||||
"targetNodeID": "code_y71Sd"
|
||||
},
|
||||
{
|
||||
"sourceNodeID": "variable_zy_Ae",
|
||||
"targetNodeID": "end_0"
|
||||
},
|
||||
{
|
||||
"sourceNodeID": "http_0IIt-",
|
||||
"targetNodeID": "variable_zOb3P"
|
||||
},
|
||||
{
|
||||
"sourceNodeID": "db_LMgXg",
|
||||
"targetNodeID": "variable_zOb3P"
|
||||
},
|
||||
{
|
||||
"sourceNodeID": "variable_zOb3P",
|
||||
"targetNodeID": "variable_zy_Ae"
|
||||
},
|
||||
{
|
||||
"sourceNodeID": "code_y71Sd",
|
||||
"targetNodeID": "code_iyMNK"
|
||||
},
|
||||
{
|
||||
"sourceNodeID": "code_iyMNK",
|
||||
"targetNodeID": "http_0IIt-"
|
||||
},
|
||||
{
|
||||
"sourceNodeID": "code_iyMNK",
|
||||
"targetNodeID": "db_LMgXg"
|
||||
}
|
||||
]
|
||||
}
|
||||
355
docs/flow/code_js1_group.json
Normal file
355
docs/flow/code_js1_group.json
Normal file
@ -0,0 +1,355 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"id": "start_0",
|
||||
"type": "start",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 180,
|
||||
"y": 189.8
|
||||
}
|
||||
},
|
||||
"data": {
|
||||
"title": "Start",
|
||||
"outputs": {
|
||||
"type": "object",
|
||||
"properties": {},
|
||||
"required": []
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "end_0",
|
||||
"type": "end",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 2940,
|
||||
"y": 189.8
|
||||
}
|
||||
},
|
||||
"data": {
|
||||
"title": "End"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "variable_zOb3P",
|
||||
"type": "variable",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 2020,
|
||||
"y": 179.8
|
||||
}
|
||||
},
|
||||
"data": {
|
||||
"title": "Variable_1",
|
||||
"assign": [
|
||||
{
|
||||
"operator": "declare",
|
||||
"left": "jss",
|
||||
"right": {
|
||||
"type": "constant",
|
||||
"content": "${\"user_n\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
"type": "object",
|
||||
"required": [],
|
||||
"properties": {
|
||||
"jss": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "code_y71Sd",
|
||||
"type": "javascript",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 640,
|
||||
"y": 162.3
|
||||
}
|
||||
},
|
||||
"data": {
|
||||
"title": "JS",
|
||||
"inputsValues": {
|
||||
"input": {
|
||||
"type": "constant",
|
||||
"content": "",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"extra": {
|
||||
"index": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
"script": {
|
||||
"language": "javascript",
|
||||
"content": "ctx.vri=\"usertest\"; ctx[\"user_n\"]=\"user_nuser_n\" for (let i = 0; i < 5; i++) { //console.log(`第 ${i} 次循环`); ctx[i]=\"v\"+i; }"
|
||||
},
|
||||
"outputs": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"key0": {
|
||||
"type": "string"
|
||||
},
|
||||
"key1": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"key2": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"key21": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"inputs": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"input": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "variable_zy_Ae",
|
||||
"type": "variable",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 2480,
|
||||
"y": 179.8
|
||||
}
|
||||
},
|
||||
"data": {
|
||||
"title": "http响应",
|
||||
"assign": [
|
||||
{
|
||||
"operator": "declare",
|
||||
"left": "http_resp",
|
||||
"right": {
|
||||
"type": "ref",
|
||||
"content": [
|
||||
"http_0IIt-",
|
||||
"headers"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
"type": "object",
|
||||
"required": [],
|
||||
"properties": {
|
||||
"http_resp": {
|
||||
"type": "object",
|
||||
"required": [],
|
||||
"properties": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "code_iyMNK",
|
||||
"type": "script",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 1100,
|
||||
"y": 162.3
|
||||
}
|
||||
},
|
||||
"data": {
|
||||
"title": "rhai",
|
||||
"inputsValues": {
|
||||
"input": {
|
||||
"type": "constant",
|
||||
"content": ""
|
||||
}
|
||||
},
|
||||
"script": {
|
||||
"language": "rhai",
|
||||
"content": "// 修改字段 ctx.addr_name = \"Alice\"; ctx.count = 10; // 添加新字段 ctx.city = \"Beijing\"; // 还可以用下标方式 ctx[\"extra\"] = 123;"
|
||||
},
|
||||
"outputs": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"key0": {
|
||||
"type": "string"
|
||||
},
|
||||
"key1": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"key2": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"key21": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": []
|
||||
},
|
||||
"inputs": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"input": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "group_o4dbz",
|
||||
"type": "group",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"data": {
|
||||
"color": "Green",
|
||||
"title": "Group_2",
|
||||
"parentID": "root",
|
||||
"blockIDs": [
|
||||
"http_0IIt-",
|
||||
"db_LMgXg"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "http_0IIt-",
|
||||
"type": "http",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 1598.880308880309,
|
||||
"y": -317.18146718146716
|
||||
}
|
||||
},
|
||||
"data": {
|
||||
"title": "HTTP_1",
|
||||
"api": {
|
||||
"method": "GET",
|
||||
"url": {
|
||||
"type": "template",
|
||||
"content": "https://account.aliyun.com"
|
||||
}
|
||||
},
|
||||
"body": {
|
||||
"bodyType": "JSON"
|
||||
},
|
||||
"outputs": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"body": {
|
||||
"type": "string"
|
||||
},
|
||||
"headers": {
|
||||
"type": "object"
|
||||
},
|
||||
"statusCode": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"timeout": {
|
||||
"timeout": 10000,
|
||||
"retryTimes": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "db_LMgXg",
|
||||
"type": "db",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 1598.880308880309,
|
||||
"y": 179.8
|
||||
}
|
||||
},
|
||||
"data": {
|
||||
"title": "DB_1",
|
||||
"db": {
|
||||
"sql": {
|
||||
"type": "template",
|
||||
"content": "SELECT t.* FROM udmin.departments t"
|
||||
},
|
||||
"params": [],
|
||||
"outputKey": "db_response",
|
||||
"connection": {
|
||||
"driver": "mysql",
|
||||
"mode": "fields",
|
||||
"database": "udmin",
|
||||
"host": "127.0.0.1",
|
||||
"port": 3306,
|
||||
"username": "root",
|
||||
"password": "123456"
|
||||
},
|
||||
"output": {
|
||||
"mode": "rows"
|
||||
}
|
||||
},
|
||||
"outputs": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"db_response": {
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"sourceNodeID": "start_0",
|
||||
"targetNodeID": "code_y71Sd"
|
||||
},
|
||||
{
|
||||
"sourceNodeID": "variable_zy_Ae",
|
||||
"targetNodeID": "end_0"
|
||||
},
|
||||
{
|
||||
"sourceNodeID": "http_0IIt-",
|
||||
"targetNodeID": "variable_zOb3P"
|
||||
},
|
||||
{
|
||||
"sourceNodeID": "db_LMgXg",
|
||||
"targetNodeID": "variable_zOb3P"
|
||||
},
|
||||
{
|
||||
"sourceNodeID": "variable_zOb3P",
|
||||
"targetNodeID": "variable_zy_Ae"
|
||||
},
|
||||
{
|
||||
"sourceNodeID": "code_y71Sd",
|
||||
"targetNodeID": "code_iyMNK"
|
||||
},
|
||||
{
|
||||
"sourceNodeID": "code_iyMNK",
|
||||
"targetNodeID": "http_0IIt-"
|
||||
},
|
||||
{
|
||||
"sourceNodeID": "code_iyMNK",
|
||||
"targetNodeID": "db_LMgXg"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user