fix: workflow http trigger (#1222)

Reviewed-on: daoyoucloud/tachybase#1222
This commit is contained in:
sealday 2024-06-20 20:43:44 +08:00
parent 05cc91c6fc
commit bb9a35753a
51 changed files with 975 additions and 1476 deletions

View File

@ -24,7 +24,7 @@
"@tachybase/sdk": "workspace:*",
"@tachybase/utils": "workspace:*",
"ahooks": "^3.7.2",
"antd": "5.18.1",
"antd": "5.18.3",
"antd-style": "3.4.5",
"axios": "^1.6.2",
"classnames": "^2.3.1",

View File

@ -22,7 +22,7 @@
"@formily/shared": "2.3.1",
"@formily/validator": "2.3.1",
"@uiw/react-codemirror": "^4.22.2",
"antd": "^5.18.1",
"antd": "^5.18.3",
"classnames": "^2.5.1",
"dayjs": "^1.11.11",
"react-sticky-box": "^1.0.2"

View File

@ -355,6 +355,14 @@ export class Gateway extends EventEmitter {
return argv[2] === 'start';
}
get runAt() {
return `http://${this.host}:${this.port}/`;
}
get runAtLoop() {
return `http://127.0.0.1:${this.port}/`;
}
isHelp() {
const argv = process.argv;
return argv[2] === 'help';

View File

@ -7,7 +7,7 @@
"dependencies": {
"@hapi/topo": "^6.0.0",
"@rc-component/mini-decimal": "^1.1.0",
"antd": "5.18.1",
"antd": "5.18.3",
"dayjs": "^1.11.9",
"dedupe": "^3.0.2",
"deepmerge": "^4.2.2",

View File

@ -7,7 +7,7 @@
"@tachybase/schema": "workspace:*",
"@types/lodash": "^4.17.5",
"ahooks": "^3.7.2",
"antd": "5.18.1",
"antd": "5.18.3",
"antd-mobile": "^5.36.1",
"antd-mobile-icons": "^0.3.0",
"lodash": "4.17.21",

View File

@ -17,7 +17,7 @@
"@tachybase/schema": "workspace:*",
"@tachybase/utils": "workspace:*",
"@types/lodash": "4.17.5",
"antd": "5.18.1",
"antd": "5.18.3",
"lodash": "^4.17.21",
"react": "~18.3.1",
"react-i18next": "^14.1.2",

View File

@ -14,7 +14,7 @@
"@tachybase/schema": "workspace:*",
"@types/lodash": "~4.17.5",
"ahooks": "^3.7.2",
"antd": "5.18.1",
"antd": "5.18.3",
"classnames": "^2.3.1",
"copy-to-clipboard": "^3.3.3",
"dayjs": "^1.11.8",

View File

@ -3,7 +3,7 @@
"version": "0.0.31",
"main": "dist/server/index.js",
"devDependencies": {
"antd": "^5.18.1"
"antd": "^5.18.3"
},
"peerDependencies": {
"@tachybase/client": "workspace:*",

View File

@ -12,7 +12,7 @@
"@tachybase/schema": "workspace:*",
"@types/lodash": "4.17.5",
"ahooks": "^3.7.2",
"antd": "5.18.1",
"antd": "5.18.3",
"dayjs": "^1.11.8",
"exceljs": "^4.4.0",
"file-saver": "^2.0.5",

View File

@ -14,7 +14,7 @@
"@tachybase/schema": "workspace:*",
"@types/jsonwebtoken": "^8.5.8",
"ahooks": "^3.7.2",
"antd": "5.18.1",
"antd": "5.18.3",
"async-mutex": "^0.3.2",
"jsonwebtoken": "^8.5.1",
"lodash": "4.17.21",

View File

@ -12,7 +12,7 @@
"@ant-design/icons": "^5.3.7",
"@tachybase/components": "workspace:*",
"@tachybase/schema": "workspace:*",
"antd": "5.18.1",
"antd": "5.18.3",
"lodash": "4.17.21",
"react-i18next": "^14.1.2",
"react-router-dom": "^6.11.2"

View File

@ -10,7 +10,7 @@
"main": "dist/server/index.js",
"devDependencies": {
"@tachybase/schema": "workspace:*",
"antd": "5.18.1",
"antd": "5.18.3",
"react-i18next": "^14.1.2",
"react-router-dom": "^6.11.2"
},

View File

@ -10,7 +10,7 @@
"main": "dist/server/index.js",
"devDependencies": {
"@tachybase/schema": "workspace:*",
"antd": "5.18.1",
"antd": "5.18.3",
"lodash": "4.17.21",
"react-i18next": "^14.1.2"
},

View File

@ -8,7 +8,7 @@
"types": "./dist/server/index.d.ts",
"devDependencies": {
"@ant-design/icons": "~5.3.7",
"antd": "5.18.1",
"antd": "5.18.3",
"react-i18next": "^14.1.2",
"swagger-ui-dist": "^5.3.1"
},

View File

@ -11,7 +11,7 @@
"devDependencies": {
"@tachybase/schema": "workspace:*",
"ahooks": "^3.7.2",
"antd": "5.18.1",
"antd": "5.18.3",
"dayjs": "^1.11.8",
"i18next": "^23.11.5",
"react": "^18.3.1",

View File

@ -10,7 +10,7 @@
"devDependencies": {
"@ant-design/icons": "~5.3.7",
"@tachybase/components": "workspace:*",
"antd": "5.18.1",
"antd": "5.18.3",
"react": "^18.3.1",
"react-i18next": "^14.1.2"
},

View File

@ -11,7 +11,7 @@
"@ant-design/icons": "~5.3.7",
"@tachybase/schema": "workspace:*",
"@types/cron": "^2.0.1",
"antd": "5.18.1",
"antd": "5.18.3",
"cron": "^2.3.1",
"react": "^18.3.1",
"react-i18next": "^14.1.2",

View File

@ -16,7 +16,7 @@
"@types/archiver": "^5.3.1",
"@types/file-saver": "^2.0.7",
"@types/lodash": "4.17.5",
"antd": "5.18.1",
"antd": "5.18.3",
"archiver": "^5.3.1",
"content-disposition": "^0.5.4",
"dayjs": "^1.11.8",

View File

@ -14,7 +14,7 @@
"@ant-design/icons": "~5.3.7",
"@tachybase/components": "workspace:*",
"@tachybase/schema": "workspace:*",
"antd": "5.18.1",
"antd": "5.18.3",
"cron-parser": "4.4.0",
"dayjs": "^1.11.8",
"lodash": "^4.17.21",

View File

@ -10,7 +10,7 @@
"main": "./dist/server/index.js",
"devDependencies": {
"@ant-design/icons": "~5.3.7",
"antd": "5.18.1",
"antd": "5.18.3",
"react-i18next": "^14.1.2",
"react-router-dom": "6.x"
},

View File

@ -6,7 +6,7 @@
"license": "Apache-2.0",
"main": "./dist/server/index.js",
"devDependencies": {
"antd": "5.18.1",
"antd": "5.18.3",
"cronstrue": "^2.11.0",
"koa-send": "^5.0.1",
"koa-static": "^5.0.0"

View File

@ -6,7 +6,7 @@
"@ant-design/icons": "~5.3.7",
"@tachybase/components": "workspace:*",
"@tachybase/schema": "workspace:*",
"antd": "~5.18.1",
"antd": "~5.18.3",
"dayjs": "^1.11.8",
"lodash": "^4.17.21",
"react-i18next": "^14.1.2"

View File

@ -11,7 +11,7 @@
"devDependencies": {
"@tachybase/components": "workspace:*",
"@tachybase/schema": "workspace:*",
"antd": "5.18.1",
"antd": "5.18.3",
"lodash": "~4.17.21",
"react-i18next": "^14.1.2",
"react-router-dom": "6.x"

View File

@ -13,7 +13,7 @@
"@tachybase/components": "workspace:*",
"@tachybase/schema": "workspace:*",
"ahooks": "^3.7.2",
"antd": "5.18.1",
"antd": "5.18.3",
"lodash": "4.17.21",
"react-i18next": "^14.1.2",
"react-router-dom": "^6.11.2",

View File

@ -14,7 +14,7 @@
"@tachybase/components": "workspace:*",
"@tachybase/schema": "workspace:*",
"ahooks": "^3.7.2",
"antd": "5.18.1",
"antd": "5.18.3",
"dayjs": "^1.11.8",
"deepmerge": "^4.2.2",
"koa-compose": "^4.1.0",

View File

@ -3,7 +3,7 @@
"version": "0.21.58",
"main": "dist/server/index.js",
"dependencies": {
"antd": "5.18.1",
"antd": "5.18.3",
"lodash": "^4.17.21",
"mysql2": "^3.9.1",
"pg": "^8.11.3",

View File

@ -11,7 +11,7 @@
"devDependencies": {
"@ant-design/icons": "^5.3.7",
"@tachybase/schema": "workspace:*",
"antd": "^5.18.1",
"antd": "^5.18.3",
"koa-send": "^5.0.1",
"vditor": "^3.10.3"
},

View File

@ -17,7 +17,7 @@
"@tachybase/schema": "workspace:*",
"@types/koa-multer": "^1.0.1",
"@types/multer": "^1.4.5",
"antd": "5.18.1",
"antd": "5.18.3",
"cos-nodejs-sdk-v5": "^2.11.14",
"koa-static": "^5.0.0",
"lodash": "4.17.21",

View File

@ -13,7 +13,7 @@
"@ctrl/tinycolor": "^3.6.0",
"@tachybase/components": "workspace:*",
"@tachybase/schema": "workspace:*",
"antd": "5.18.1",
"antd": "5.18.3",
"lodash": "4.17.21",
"react-i18next": "^14.1.2"
},

View File

@ -20,7 +20,7 @@
"@antv/x6-react-shape": "^2.0.0",
"@tachybase/schema": "workspace:*",
"ahooks": "^3.7.2",
"antd": "5.18.1",
"antd": "5.18.3",
"dagre": "^0.8.5",
"lodash": "4.17.21",
"react": "^18.3.1",

View File

@ -11,7 +11,7 @@
"devDependencies": {
"@ant-design/icons": "~5.3.7",
"@tachybase/schema": "workspace:*",
"antd": "5.18.1",
"antd": "5.18.3",
"react": "^18.3.1",
"react-i18next": "^14.1.2",
"react-iframe": "~1.8.5"

View File

@ -14,7 +14,7 @@
"@tachybase/components": "workspace:*",
"@tachybase/schema": "workspace:*",
"@types/node-xlsx": "^0.15.1",
"antd": "5.18.1",
"antd": "5.18.3",
"file-saver": "^2.0.5",
"lodash": "4.17.21",
"mathjs": "^10.6.0",

View File

@ -12,7 +12,7 @@
"@ant-design/icons": "^5.3.7",
"@tachybase/components": "workspace:*",
"@tachybase/schema": "workspace:*",
"antd": "5.18.1",
"antd": "5.18.3",
"lodash": "4.17.21",
"react-beautiful-dnd": "^13.1.0",
"react-i18next": "^14.1.2"

View File

@ -12,7 +12,7 @@
"@ant-design/icons": "^5.3.7",
"@tachybase/schema": "workspace:*",
"ahooks": "^3.7.2",
"antd": "5.18.1",
"antd": "5.18.3",
"deepmerge": "^4.3.1",
"react-i18next": "^14.1.2"
},

View File

@ -12,7 +12,7 @@
"@ant-design/icons": "^5.3.7",
"@types/tar-fs": "^2.0.2",
"ahooks": "^3.7.2",
"antd": "5.18.1",
"antd": "5.18.3",
"react-i18next": "^14.1.2",
"tar-fs": "^3.0.4"
},

View File

@ -19,7 +19,7 @@
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"ahooks": "^3.7.2",
"antd": "5.18.1",
"antd": "5.18.3",
"lodash": "4.17.21",
"react": "~18.3.1",
"react-dom": "~18.3.1",

View File

@ -12,7 +12,7 @@
"@types/react": "~18.3.3",
"@types/react-dom": "~18.3.0",
"ahooks": "3.x",
"antd": "5.18.1",
"antd": "5.18.3",
"antd-mobile": "^5.36.1",
"antd-mobile-icons": "^0.3.0",
"lodash": "4.17.21",

View File

@ -10,7 +10,7 @@
"main": "./dist/server/index.js",
"devDependencies": {
"@tachybase/schema": "workspace:*",
"antd": "5.18.1",
"antd": "5.18.3",
"async-mutex": "^0.3.2",
"lodash": "4.17.21",
"mysql2": "^2.3.3",

View File

@ -9,7 +9,7 @@
"main": "./dist/server/index.js",
"devDependencies": {
"@tachybase/schema": "workspace:*",
"antd": "5.18.1",
"antd": "5.18.3",
"lodash": "4.17.21",
"react": "~18.3.1",
"react-i18next": "^14.1.2"

View File

@ -13,7 +13,7 @@
"@tachybase/components": "workspace:*",
"@tachybase/schema": "workspace:*",
"ahooks": "^3.7.2",
"antd": "5.18.1",
"antd": "5.18.3",
"nanoid": "3.3.4",
"openid-client": "^5.4.2",
"react": "~18.3.1",

View File

@ -12,7 +12,7 @@
"@ant-design/icons": "~5.3.7",
"@node-saml/node-saml": "^4.0.2",
"@tachybase/schema": "workspace:*",
"antd": "5.18.1",
"antd": "5.18.3",
"react": "~18.3.1",
"react-i18next": "^14.1.2",
"react-router-dom": "^6.11.2"

View File

@ -11,7 +11,7 @@
"devDependencies": {
"@tachybase/components": "workspace:*",
"@tachybase/schema": "workspace:*",
"antd": "5.18.1",
"antd": "5.18.3",
"cron-parser": "4.4.0",
"dayjs": "^1.11.8",
"lodash": "4.17.21",

View File

@ -10,7 +10,7 @@
"main": "./dist/server/index.js",
"devDependencies": {
"@tachybase/schema": "workspace:*",
"antd": "5.18.1",
"antd": "5.18.3",
"react": "~18.3.1",
"react-i18next": "^14.1.2"
},

View File

@ -11,7 +11,7 @@
"devDependencies": {
"@ant-design/icons": "~5.3.7",
"@tachybase/schema": "workspace:*",
"antd": "5.18.1",
"antd": "5.18.3",
"lodash": "4.17.21",
"rc-tree-select": "5.5.5",
"react": "~18.3.1",

View File

@ -13,7 +13,7 @@
"@arvinxu/layout-kit": "^1",
"@ctrl/tinycolor": "^3.6.0",
"@types/lodash": "4.17.5",
"antd": "5.18.1",
"antd": "5.18.3",
"lodash": "4.17.21",
"rc-util": "^5.32.0",
"react": "^18.3.1",

View File

@ -11,7 +11,7 @@
"devDependencies": {
"@tachybase/schema": "workspace:*",
"@types/jsonwebtoken": "^8.5.8",
"antd": "5.18.1",
"antd": "5.18.3",
"jsonwebtoken": "^8.5.1",
"react-i18next": "^14.1.2"
},

View File

@ -14,7 +14,7 @@
"@alicloud/tea-util": "1.4.4",
"@tachybase/components": "workspace:*",
"@tachybase/schema": "workspace:*",
"antd": "5.18.1",
"antd": "5.18.3",
"dayjs": "^1.11.8",
"react": "~18.3.1",
"react-i18next": "^14.1.2",

View File

@ -17,7 +17,7 @@
"@tachybase/plugin-ui-schema-storage": "workspace:*",
"@tachybase/schema": "workspace:*",
"@tachybase/utils": "workspace:*",
"antd": "5.18.1",
"antd": "5.18.3",
"lodash": "^4.17.21",
"react": "~18.3.1",
"react-i18next": "^14.1.2",

View File

@ -18,7 +18,7 @@
"@types/ejs": "^3.1.1",
"@types/file-saver": "^2.0.7",
"@types/lodash": "^4.17.5",
"antd": "5.18.1",
"antd": "5.18.3",
"axios": "^1.6.2",
"cron-parser": "4.4.0",
"file-saver": "^2.0.5",

View File

@ -1,3 +1,5 @@
import { Gateway } from '@tachybase/server';
import axios, { AxiosRequestConfig } from 'axios';
import _ from 'lodash';
@ -51,13 +53,18 @@ async function request(config, context) {
export default class extends Instruction {
async run(node: FlowNodeModel, prevJob, processor: Processor) {
const httpContext = _.get(processor, 'execution.dataValues.context.data.httpContext', {});
const userId = _.get(processor, 'execution.dataValues.context.data.user.id', 1);
const origin = _.get(httpContext, 'request.header.origin', '');
const userId = processor.getScope(node.id).$context.user.id;
// TODO is not work with cluster
const origin = Gateway.getInstance().runAtLoop;
const token = this.workflow.app.authManager.jwt.sign({ userId });
const context = { token, origin };
const config = processor.getParsedValue(node.config, node.id) as RequestConfig;
// delete user token if outer http
if (config.url?.startsWith('http')) {
delete context.token;
delete context.origin;
}
const { workflow } = processor.execution;
const sync = this.workflow.isWorkflowSync(workflow);

File diff suppressed because it is too large Load Diff