@nocobase/plugin-workflow-request 1.4.0-alpha.20240906114411 → 1.4.0-alpha.20240910145333
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.
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import { Instruction, WorkflowVariableJSON, WorkflowVariableTextArea } from '@nocobase/plugin-workflow/client';
|
|
10
|
+
import { Instruction, WorkflowVariableJSON, WorkflowVariableRawTextArea, WorkflowVariableTextArea } from '@nocobase/plugin-workflow/client';
|
|
11
11
|
declare function BodyComponent(props: any): React.JSX.Element;
|
|
12
12
|
export default class extends Instruction {
|
|
13
13
|
title: string;
|
|
@@ -198,8 +198,9 @@ export default class extends Instruction {
|
|
|
198
198
|
}>;
|
|
199
199
|
};
|
|
200
200
|
BodyComponent: typeof BodyComponent;
|
|
201
|
-
WorkflowVariableTextArea: typeof WorkflowVariableTextArea;
|
|
202
201
|
WorkflowVariableJSON: typeof WorkflowVariableJSON;
|
|
202
|
+
WorkflowVariableTextArea: typeof WorkflowVariableTextArea;
|
|
203
|
+
WorkflowVariableRawTextArea: typeof WorkflowVariableRawTextArea;
|
|
203
204
|
};
|
|
204
205
|
useVariables({ key, title, config }: {
|
|
205
206
|
key: any;
|
package/dist/client/index.js
CHANGED
|
@@ -7,14 +7,20 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
(function(e,
|
|
10
|
+
(function(e,o){typeof exports=="object"&&typeof module!="undefined"?o(exports,require("@nocobase/client"),require("react/jsx-runtime"),require("react"),require("@formily/core"),require("@formily/shared"),require("@formily/react"),require("@formily/antd-v5"),require("@nocobase/plugin-workflow/client"),require("react-i18next")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","react","@formily/core","@formily/shared","@formily/react","@formily/antd-v5","@nocobase/plugin-workflow/client","react-i18next"],o):(e=typeof globalThis!="undefined"?globalThis:e||self,o(e["@nocobase/plugin-workflow-request"]={},e["@nocobase/client"],e.jsxRuntime,e.react,e["@formily/core"],e["@formily/shared"],e["@formily/react"],e["@formily/antd-v5"],e["@nocobase/plugin-workflow"],e["react-i18next"]))})(this,function(e,o,r,x,c,f,l,i,t,m){"use strict";var P=Object.defineProperty,W=Object.defineProperties;var R=Object.getOwnPropertyDescriptors;var k=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var T=(e,o,r)=>o in e?P(e,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[o]=r,S=(e,o)=>{for(var r in o||(o={}))j.call(o,r)&&T(e,r,o[r]);if(k)for(var r of k(o))E.call(o,r)&&T(e,r,o[r]);return e},q=(e,o)=>W(e,R(o));var n=(e,o,r)=>(T(e,typeof o!="symbol"?o+"":o,r),r);var u=(e,o,r)=>new Promise((x,c)=>{var f=t=>{try{i(r.next(t))}catch(m){c(m)}},l=t=>{try{i(r.throw(t))}catch(m){c(m)}},i=t=>t.done?x(t.value):Promise.resolve(t.value).then(f,l);i((r=r.apply(e,o)).next())});const a="workflow-request";function y(s,p={}){const{t:d}=N(p);return d(s)}function N(s){return m.useTranslation(a,s)}const F={"application/json":{type:"void",properties:{data:{type:"object","x-decorator":"FormItem","x-decorator-props":{},"x-component":"WorkflowVariableJSON","x-component-props":{changeOnSelect:!0,autoSize:{minRows:10},placeholder:`{{t("Input request data", { ns: "${a}" })}}`}}}},"application/x-www-form-urlencoded":{type:"void",properties:{data:{type:"array","x-decorator":"FormItem","x-decorator-props":{},"x-component":"ArrayItems",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":"WorkflowVariableTextArea","x-component-props":{useTypedConstant:!0}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:`{{t("Add key-value pairs", { ns: "${a}" })}}`,"x-component":"ArrayItems.Addition"}}}}},"application/xml":{type:"void",properties:{data:{type:"string","x-decorator":"FormItem","x-component":"WorkflowVariableRawTextArea","x-component-props":{placeholder:'<?xml version="1.0" encoding="UTF-8"?>',autoSize:{minRows:10},className:o.css`
|
|
11
|
+
font-size: 80%;
|
|
12
|
+
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
|
|
13
|
+
`}}}},"text/plain":{type:"void",properties:{data:{type:"string","x-decorator":"FormItem","x-component":"WorkflowVariableRawTextArea","x-component-props":{autoSize:{minRows:10},className:o.css`
|
|
14
|
+
font-size: 80%;
|
|
15
|
+
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
|
|
16
|
+
`}}}}};function g(s){const p=l.useField(),{values:d,setValuesIn:w,clearFormGraph:h}=l.useForm(),{contentType:A}=d,[b,v]=x.useState(F[A]);return l.useFormEffects(()=>{c.onFieldValueChange("contentType",I=>{h(`${p.address}.*`),v(q(S({},F[I.value]),{name:f.uid()})),w("data",null)})}),r.jsx(o.SchemaComponent,{basePath:p.address,schema:b,onlyRenderProperties:!0})}class V extends t.Instruction{constructor(){super(...arguments);n(this,"title",`{{t("HTTP request", { ns: "${a}" })}}`);n(this,"type","request");n(this,"group","extended");n(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: "${a}" })}}`);n(this,"fieldset",{method:{type:"string",required:!0,title:`{{t("HTTP method", { ns: "${a}" })}}`,"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: "${a}" })}}`,"x-decorator":"FormItem","x-decorator-props":{},"x-component":"WorkflowVariableTextArea","x-component-props":{placeholder:"https://www.nocobase.com"}},contentType:{type:"string",title:`{{t("Content-Type", { ns: "${a}" })}}`,"x-decorator":"FormItem","x-component":"Select","x-component-props":{allowClear:!1},enum:[{label:"application/json",value:"application/json"},{label:"application/x-www-form-urlencoded",value:"application/x-www-form-urlencoded"},{label:"application/xml",value:"application/xml"},{label:"text/plain",value:"text/plain"}],default:"application/json"},headers:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",title:`{{t("Headers", { ns: "${a}" })}}`,description:`{{t('"Content-Type" will be ignored from headers.', { ns: "${a}" })}}`,items:{type:"object",properties:{space:{type:"void","x-component":"Space","x-component-props":{style:{flexWrap:"nowrap",maxWidth:"100%"},className:o.css`
|
|
11
17
|
& > .ant-space-item:first-child,
|
|
12
18
|
& > .ant-space-item:last-child {
|
|
13
19
|
flex-shrink: 0;
|
|
14
20
|
}
|
|
15
|
-
`},properties:{name:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{t("Name")}}'}},value:{type:"string","x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{useTypedConstant:!0,placeholder:'{{t("Value")}}'}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:`{{t("Add request header", { ns: "${a}" })}}`,"x-component":"ArrayItems.Addition"}}},params:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",title:`{{t("Parameters", { ns: "${a}" })}}`,items:{type:"object",properties:{space:{type:"void","x-component":"Space","x-component-props":{style:{flexWrap:"nowrap",maxWidth:"100%"},className:
|
|
21
|
+
`},properties:{name:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{t("Name")}}'}},value:{type:"string","x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{useTypedConstant:!0,placeholder:'{{t("Value")}}'}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:`{{t("Add request header", { ns: "${a}" })}}`,"x-component":"ArrayItems.Addition"}}},params:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",title:`{{t("Parameters", { ns: "${a}" })}}`,items:{type:"object",properties:{space:{type:"void","x-component":"Space","x-component-props":{style:{flexWrap:"nowrap",maxWidth:"100%"},className:o.css`
|
|
16
22
|
& > .ant-space-item:first-child,
|
|
17
23
|
& > .ant-space-item:last-child {
|
|
18
24
|
flex-shrink: 0;
|
|
19
25
|
}
|
|
20
|
-
`},properties:{name:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{t("Name")}}'}},value:{type:"string","x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{useTypedConstant:!0,placeholder:'{{t("Value")}}'}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:`{{t("Add parameter", { ns: "${a}" })}}`,"x-component":"ArrayItems.Addition"}}},data:{type:"void",title:`{{t("Body", { ns: "${a}" })}}`,"x-decorator":"FormItem","x-decorator-props":{},"x-component":"BodyComponent"},timeout:{type:"number",title:`{{t("Timeout config", { ns: "${a}" })}}`,"x-decorator":"FormItem","x-decorator-props":{},"x-component":"InputNumber","x-component-props":{addonAfter:`{{t("ms", { ns: "${a}" })}}`,min:1,step:1e3,defaultValue:5e3}},ignoreFail:{type:"boolean",title:`{{t("Ignore failed request and continue workflow", { ns: "${a}" })}}`,"x-decorator":"FormItem","x-component":"Checkbox"}});n(this,"components",{ArrayItems:i.ArrayItems,BodyComponent:g,WorkflowVariableTextArea:
|
|
26
|
+
`},properties:{name:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{t("Name")}}'}},value:{type:"string","x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{useTypedConstant:!0,placeholder:'{{t("Value")}}'}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:`{{t("Add parameter", { ns: "${a}" })}}`,"x-component":"ArrayItems.Addition"}}},data:{type:"void",title:`{{t("Body", { ns: "${a}" })}}`,"x-decorator":"FormItem","x-decorator-props":{},"x-component":"BodyComponent"},timeout:{type:"number",title:`{{t("Timeout config", { ns: "${a}" })}}`,"x-decorator":"FormItem","x-decorator-props":{},"x-component":"InputNumber","x-component-props":{addonAfter:`{{t("ms", { ns: "${a}" })}}`,min:1,step:1e3,defaultValue:5e3}},ignoreFail:{type:"boolean",title:`{{t("Ignore failed request and continue workflow", { ns: "${a}" })}}`,"x-decorator":"FormItem","x-component":"Checkbox"}});n(this,"components",{ArrayItems:i.ArrayItems,BodyComponent:g,WorkflowVariableJSON:t.WorkflowVariableJSON,WorkflowVariableTextArea:t.WorkflowVariableTextArea,WorkflowVariableRawTextArea:t.WorkflowVariableRawTextArea})}useVariables({key:d,title:w,config:h},{types:A}){const b=y("Status code"),v=y("Data"),I=y("Response headers");return{[t.defaultFieldNames.value]:d,[t.defaultFieldNames.label]:w,[t.defaultFieldNames.children]:h.onlyData?null:[{[t.defaultFieldNames.value]:"status",[t.defaultFieldNames.label]:b},{[t.defaultFieldNames.value]:"data",[t.defaultFieldNames.label]:v},{[t.defaultFieldNames.value]:"headers",[t.defaultFieldNames.label]:I}]}}}class C extends o.Plugin{afterAdd(){return u(this,null,function*(){})}beforeLoad(){return u(this,null,function*(){})}load(){return u(this,null,function*(){this.app.pm.get("workflow").registerInstruction("request",V)})}}e.default=C,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -13,10 +13,10 @@ module.exports = {
|
|
|
13
13
|
"@formily/shared": "2.3.0",
|
|
14
14
|
"@formily/react": "2.3.0",
|
|
15
15
|
"@formily/antd-v5": "1.1.9",
|
|
16
|
-
"@nocobase/plugin-workflow": "1.4.0-alpha.
|
|
17
|
-
"@nocobase/client": "1.4.0-alpha.
|
|
16
|
+
"@nocobase/plugin-workflow": "1.4.0-alpha.20240910145333",
|
|
17
|
+
"@nocobase/client": "1.4.0-alpha.20240910145333",
|
|
18
18
|
"react-i18next": "11.18.6",
|
|
19
|
-
"@nocobase/server": "1.4.0-alpha.
|
|
19
|
+
"@nocobase/server": "1.4.0-alpha.20240910145333",
|
|
20
20
|
"axios": "0.26.1",
|
|
21
21
|
"lodash": "4.17.21"
|
|
22
22
|
};
|
|
@@ -66,6 +66,7 @@ async function request(config) {
|
|
|
66
66
|
{}
|
|
67
67
|
);
|
|
68
68
|
headers["Content-Type"] = contentType;
|
|
69
|
+
const transformer = ContentTypeTransformers[contentType];
|
|
69
70
|
return import_axios.default.request({
|
|
70
71
|
url: (0, import_lodash.trim)(url),
|
|
71
72
|
method,
|
|
@@ -73,7 +74,7 @@ async function request(config) {
|
|
|
73
74
|
params,
|
|
74
75
|
timeout,
|
|
75
76
|
...method.toLowerCase() !== "get" && data != null ? {
|
|
76
|
-
data:
|
|
77
|
+
data: transformer ? transformer(data) : data.toString()
|
|
77
78
|
} : {}
|
|
78
79
|
});
|
|
79
80
|
}
|
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": "1.4.0-alpha.
|
|
7
|
+
"version": "1.4.0-alpha.20240910145333",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"homepage": "https://docs.nocobase.com/handbook/workflow-request",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@nocobase/server": "1.x",
|
|
23
23
|
"@nocobase/test": "1.x"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "87807593da799e557718f8e69172244c28c08d98",
|
|
26
26
|
"keywords": [
|
|
27
27
|
"Workflow"
|
|
28
28
|
]
|