@nocobase/plugin-workflow-request 0.17.0-alpha.7 → 0.18.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/RequestInstruction.d.ts +7 -2
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +4 -4
- package/dist/server/Plugin.d.ts +0 -2
- package/dist/server/Plugin.js +3 -4
- package/dist/server/RequestInstruction.js +1 -1
- package/package.json +2 -3
- package/src/client/RequestInstruction.tsx +6 -3
- package/src/client/index.ts +1 -2
- package/src/server/Plugin.ts +2 -5
- package/src/server/RequestInstruction.ts +1 -1
|
@@ -173,8 +173,13 @@ export default class extends Instruction {
|
|
|
173
173
|
title: any;
|
|
174
174
|
}, { types, fieldNames }: {
|
|
175
175
|
types: any;
|
|
176
|
-
fieldNames?:
|
|
176
|
+
fieldNames?: {
|
|
177
|
+
readonly label: "label";
|
|
178
|
+
readonly value: "value";
|
|
179
|
+
readonly children: "children";
|
|
180
|
+
};
|
|
177
181
|
}): {
|
|
178
|
-
|
|
182
|
+
value: any;
|
|
183
|
+
label: any;
|
|
179
184
|
};
|
|
180
185
|
}
|
package/dist/client/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(t,o){typeof exports=="object"&&typeof module!="undefined"?o(exports,require("@nocobase/client"),require("@formily/antd-v5"),require("@nocobase/plugin-workflow/client"),require("react-i18next")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","@formily/antd-v5","@nocobase/plugin-workflow/client","react-i18next"],o):(t=typeof globalThis!="undefined"?globalThis:t||self,o(t["@nocobase/plugin-workflow-request"]={},t["@nocobase/client"],t["@formily/antd-v5"],t["@nocobase/plugin-workflow"]))})(this,function(t,o,r,
|
|
1
|
+
(function(t,o){typeof exports=="object"&&typeof module!="undefined"?o(exports,require("@nocobase/client"),require("@formily/antd-v5"),require("@nocobase/plugin-workflow/client"),require("react-i18next")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","@formily/antd-v5","@nocobase/plugin-workflow/client","react-i18next"],o):(t=typeof globalThis!="undefined"?globalThis:t||self,o(t["@nocobase/plugin-workflow-request"]={},t["@nocobase/client"],t["@formily/antd-v5"],t["@nocobase/plugin-workflow"]))})(this,function(t,o,r,s){"use strict";var x=Object.defineProperty;var y=(t,o,r)=>o in t?x(t,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[o]=r;var a=(t,o,r)=>(y(t,typeof o!="symbol"?o+"":o,r),r);var l=(t,o,r)=>new Promise((s,e)=>{var d=n=>{try{p(r.next(n))}catch(i){e(i)}},m=n=>{try{p(r.throw(n))}catch(i){e(i)}},p=n=>n.done?s(n.value):Promise.resolve(n.value).then(d,m);p((r=r.apply(t,o)).next())});const e="workflow-request";class d extends s.Instruction{constructor(){super(...arguments);a(this,"title",`{{t("HTTP request", { ns: "${e}" })}}`);a(this,"type","request");a(this,"group","extended");a(this,"description",`{{t("Send HTTP request to a URL. You can use the variables in the upstream nodes as request headers, parameters and request body.", { ns: "${e}" })}}`);a(this,"fieldset",{method:{type:"string",required:!0,title:`{{t("HTTP method", { ns: "${e}" })}}`,"x-decorator":"FormItem","x-component":"Select","x-component-props":{showSearch:!1,allowClear:!1,className:"auto-width"},enum:[{label:"GET",value:"GET"},{label:"POST",value:"POST"},{label:"PUT",value:"PUT"},{label:"PATCH",value:"PATCH"},{label:"DELETE",value:"DELETE"}],default:"POST"},url:{type:"string",required:!0,title:`{{t("URL", { ns: "${e}" })}}`,"x-decorator":"FormItem","x-decorator-props":{},"x-component":"Input","x-component-props":{placeholder:"https://www.nocobase.com"}},headers:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",title:`{{t("Headers", { ns: "${e}" })}}`,description:`{{t('"Content-Type" only support "application/json", and no need to specify', { ns: "${e}" })}}`,items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{name:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{t("Name")}}'}},value:{type:"string","x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{useTypedConstant:!0}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:`{{t("Add request header", { ns: "${e}" })}}`,"x-component":"ArrayItems.Addition"}}},params:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",title:`{{t("Parameters", { ns: "${e}" })}}`,items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{name:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{t("Name")}}'}},value:{type:"string","x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{useTypedConstant:!0}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:`{{t("Add parameter", { ns: "${e}" })}}`,"x-component":"ArrayItems.Addition"}}},data:{type:"string",title:`{{t("Body", { ns: "${e}" })}}`,"x-decorator":"FormItem","x-decorator-props":{},"x-component":"WorkflowVariableJSON","x-component-props":{changeOnSelect:!0,autoSize:{minRows:10},placeholder:`{{t("Input request data", { ns: "${e}" })}}`},description:`{{t("Only support standard JSON data", { ns: "${e}" })}}`},timeout:{type:"number",title:`{{t("Timeout config", { ns: "${e}" })}}`,"x-decorator":"FormItem","x-decorator-props":{},"x-component":"InputNumber","x-component-props":{addonAfter:`{{t("ms", { ns: "${e}" })}}`,min:1,step:1e3,defaultValue:5e3}},ignoreFail:{type:"boolean",title:`{{t("Ignore failed request and continue workflow", { ns: "${e}" })}}`,"x-decorator":"FormItem","x-component":"Checkbox"}});a(this,"components",{ArrayItems:r.ArrayItems,WorkflowVariableInput:s.WorkflowVariableInput,WorkflowVariableJSON:s.WorkflowVariableJSON})}useVariables({key:i,title:u},{types:f,fieldNames:c=s.defaultFieldNames}){return{[c.value]:i,[c.label]:u}}}class m extends o.Plugin{afterAdd(){return l(this,null,function*(){})}beforeLoad(){return l(this,null,function*(){})}load(){return l(this,null,function*(){this.app.pm.get("workflow").registerInstruction("request",d)})}}t.default=m,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"@formily/antd-v5": "1.1.
|
|
3
|
-
"@nocobase/
|
|
4
|
-
"@nocobase/
|
|
2
|
+
"@formily/antd-v5": "1.1.9",
|
|
3
|
+
"@nocobase/plugin-workflow": "0.18.0-alpha.8",
|
|
4
|
+
"@nocobase/client": "0.18.0-alpha.8",
|
|
5
5
|
"react-i18next": "11.18.6",
|
|
6
|
-
"@nocobase/server": "0.
|
|
6
|
+
"@nocobase/server": "0.18.0-alpha.8",
|
|
7
7
|
"axios": "0.26.1"
|
|
8
8
|
};
|
package/dist/server/Plugin.d.ts
CHANGED
package/dist/server/Plugin.js
CHANGED
|
@@ -31,12 +31,11 @@ __export(Plugin_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(Plugin_exports);
|
|
33
33
|
var import_server = require("@nocobase/server");
|
|
34
|
+
var import_plugin_workflow = __toESM(require("@nocobase/plugin-workflow"));
|
|
34
35
|
var import_RequestInstruction = __toESM(require("./RequestInstruction"));
|
|
35
36
|
class Plugin_default extends import_server.Plugin {
|
|
36
|
-
workflow;
|
|
37
37
|
async load() {
|
|
38
|
-
const workflowPlugin = this.app.getPlugin(
|
|
39
|
-
|
|
40
|
-
workflowPlugin.instructions.register("request", new import_RequestInstruction.default(workflowPlugin));
|
|
38
|
+
const workflowPlugin = this.app.getPlugin(import_plugin_workflow.default);
|
|
39
|
+
workflowPlugin.registerInstruction("request", import_RequestInstruction.default);
|
|
41
40
|
}
|
|
42
41
|
}
|
|
@@ -74,7 +74,7 @@ class RequestInstruction_default extends import_plugin_workflow.Instruction {
|
|
|
74
74
|
});
|
|
75
75
|
}).finally(() => {
|
|
76
76
|
processor.logger.info(`request (#${node.id}) response received, status: ${job.get("status")}`);
|
|
77
|
-
this.
|
|
77
|
+
this.workflow.resume(job);
|
|
78
78
|
});
|
|
79
79
|
processor.logger.info(`request (#${node.id}) sent to "${config.url}", waiting for response...`);
|
|
80
80
|
return processor.exit();
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "工作流:HTTP 请求节点",
|
|
5
5
|
"description": "Send HTTP requests to any HTTP service for data interaction in workflow.",
|
|
6
6
|
"description.zh-CN": "可用于在工作流中向任意 HTTP 服务发送请求,进行数据交互。",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.18.0-alpha.8",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"devDependencies": {
|
|
@@ -16,9 +16,8 @@
|
|
|
16
16
|
"@nocobase/client": "0.x",
|
|
17
17
|
"@nocobase/database": "0.x",
|
|
18
18
|
"@nocobase/plugin-workflow": ">=0.17.0-alpha.3",
|
|
19
|
-
"@nocobase/plugin-workflow-test": ">=0.17.0-alpha.3",
|
|
20
19
|
"@nocobase/server": "0.x",
|
|
21
20
|
"@nocobase/test": "0.x"
|
|
22
21
|
},
|
|
23
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "727d42f6f14e5f863831da3dbf3255ba1165b567"
|
|
24
23
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { ArrayItems } from '@formily/antd-v5';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import {
|
|
4
|
+
Instruction,
|
|
5
|
+
WorkflowVariableInput,
|
|
6
|
+
WorkflowVariableJSON,
|
|
7
|
+
defaultFieldNames,
|
|
8
|
+
} from '@nocobase/plugin-workflow/client';
|
|
6
9
|
|
|
7
10
|
import { NAMESPACE } from '../locale';
|
|
8
11
|
|
package/src/client/index.ts
CHANGED
|
@@ -13,7 +13,6 @@ export default class extends Plugin {
|
|
|
13
13
|
// You can get and modify the app instance here
|
|
14
14
|
async load() {
|
|
15
15
|
const workflow = this.app.pm.get('workflow') as WorkflowPlugin;
|
|
16
|
-
|
|
17
|
-
workflow.instructions.register(requestInstruction.type, requestInstruction);
|
|
16
|
+
workflow.registerInstruction('request', RequestInstruction);
|
|
18
17
|
}
|
|
19
18
|
}
|
package/src/server/Plugin.ts
CHANGED
|
@@ -4,11 +4,8 @@ import WorkflowPlugin from '@nocobase/plugin-workflow';
|
|
|
4
4
|
import RequestInstruction from './RequestInstruction';
|
|
5
5
|
|
|
6
6
|
export default class extends Plugin {
|
|
7
|
-
workflow: WorkflowPlugin;
|
|
8
|
-
|
|
9
7
|
async load() {
|
|
10
|
-
const workflowPlugin = this.app.getPlugin(
|
|
11
|
-
|
|
12
|
-
workflowPlugin.instructions.register('request', new RequestInstruction(workflowPlugin));
|
|
8
|
+
const workflowPlugin = this.app.getPlugin<WorkflowPlugin>(WorkflowPlugin);
|
|
9
|
+
workflowPlugin.registerInstruction('request', RequestInstruction);
|
|
13
10
|
}
|
|
14
11
|
}
|
|
@@ -65,7 +65,7 @@ export default class extends Instruction {
|
|
|
65
65
|
})
|
|
66
66
|
.finally(() => {
|
|
67
67
|
processor.logger.info(`request (#${node.id}) response received, status: ${job.get('status')}`);
|
|
68
|
-
this.
|
|
68
|
+
this.workflow.resume(job);
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
processor.logger.info(`request (#${node.id}) sent to "${config.url}", waiting for response...`);
|