@nocobase/plugin-workflow-request 1.0.0-alpha.13 → 1.0.0-alpha.14

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.
@@ -69,6 +69,13 @@ export default class extends Instruction {
69
69
  space: {
70
70
  type: string;
71
71
  'x-component': string;
72
+ 'x-component-props': {
73
+ style: {
74
+ flexWrap: string;
75
+ maxWidth: string;
76
+ };
77
+ className: string;
78
+ };
72
79
  properties: {
73
80
  name: {
74
81
  type: string;
@@ -84,6 +91,7 @@ export default class extends Instruction {
84
91
  'x-component': string;
85
92
  'x-component-props': {
86
93
  useTypedConstant: boolean;
94
+ placeholder: string;
87
95
  };
88
96
  };
89
97
  remove: {
@@ -114,6 +122,13 @@ export default class extends Instruction {
114
122
  space: {
115
123
  type: string;
116
124
  'x-component': string;
125
+ 'x-component-props': {
126
+ style: {
127
+ flexWrap: string;
128
+ maxWidth: string;
129
+ };
130
+ className: string;
131
+ };
117
132
  properties: {
118
133
  name: {
119
134
  type: string;
@@ -129,6 +144,7 @@ export default class extends Instruction {
129
144
  'x-component': string;
130
145
  'x-component-props': {
131
146
  useTypedConstant: boolean;
147
+ placeholder: string;
132
148
  };
133
149
  };
134
150
  remove: {
@@ -7,4 +7,14 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
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"]))})(this,function(e,o,t,l,i,u,p,s,n){"use strict";var P=Object.defineProperty,$=Object.defineProperties;var C=Object.getOwnPropertyDescriptors;var T=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable;var f=(e,o,t)=>o in e?P(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,b=(e,o)=>{for(var t in o||(o={}))j.call(o,t)&&f(e,t,o[t]);if(T)for(var t of T(o))V.call(o,t)&&f(e,t,o[t]);return e},h=(e,o)=>$(e,C(o));var a=(e,o,t)=>(f(e,typeof o!="symbol"?o+"":o,t),t);var d=(e,o,t)=>new Promise((l,i)=>{var u=n=>{try{s(t.next(n))}catch(r){i(r)}},p=n=>{try{s(t.throw(n))}catch(r){i(r)}},s=n=>n.done?l(n.value):Promise.resolve(n.value).then(u,p);s((t=t.apply(e,o)).next())});const r="workflow-request",w={"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: "${r}" })}}`}}}},"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: "${r}" })}}`,"x-component":"ArrayItems.Addition"}}}}}};function A(I){const m=p.useField(),{values:x,setValuesIn:y,clearFormGraph:v}=p.useForm(),{contentType:c}=x,[S,k]=l.useState(w[c]);return p.useFormEffects(()=>{i.onFieldValueChange("contentType",g=>{v(`${m.address}.*`),k(h(b({},w[g.value]),{name:u.uid()})),y("data",null)})}),t.jsx(o.SchemaComponent,{basePath:m.address,schema:S,onlyRenderProperties:!0})}class F extends n.Instruction{constructor(){super(...arguments);a(this,"title",`{{t("HTTP request", { ns: "${r}" })}}`);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: "${r}" })}}`);a(this,"fieldset",{method:{type:"string",required:!0,title:`{{t("HTTP method", { ns: "${r}" })}}`,"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: "${r}" })}}`,"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: "${r}" })}}`,"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"}],default:"application/json"},headers:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",title:`{{t("Headers", { ns: "${r}" })}}`,description:`{{t('"Content-Type" will be ignored from headers.', { ns: "${r}" })}}`,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 request header", { ns: "${r}" })}}`,"x-component":"ArrayItems.Addition"}}},params:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",title:`{{t("Parameters", { ns: "${r}" })}}`,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 parameter", { ns: "${r}" })}}`,"x-component":"ArrayItems.Addition"}}},data:{type:"void",title:`{{t("Body", { ns: "${r}" })}}`,"x-decorator":"FormItem","x-decorator-props":{},"x-component":"BodyComponent"},timeout:{type:"number",title:`{{t("Timeout config", { ns: "${r}" })}}`,"x-decorator":"FormItem","x-decorator-props":{},"x-component":"InputNumber","x-component-props":{addonAfter:`{{t("ms", { ns: "${r}" })}}`,min:1,step:1e3,defaultValue:5e3}},ignoreFail:{type:"boolean",title:`{{t("Ignore failed request and continue workflow", { ns: "${r}" })}}`,"x-decorator":"FormItem","x-component":"Checkbox"}});a(this,"components",{ArrayItems:s.ArrayItems,BodyComponent:A,WorkflowVariableTextArea:n.WorkflowVariableTextArea,WorkflowVariableJSON:n.WorkflowVariableJSON})}useVariables({key:x,title:y},{types:v,fieldNames:c=n.defaultFieldNames}){return{[c.value]:x,[c.label]:y}}}class q extends o.Plugin{afterAdd(){return d(this,null,function*(){})}beforeLoad(){return d(this,null,function*(){})}load(){return d(this,null,function*(){this.app.pm.get("workflow").registerInstruction("request",F)})}}e.default=q,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
10
+ (function(e,t){typeof exports=="object"&&typeof module!="undefined"?t(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"],t):(e=typeof globalThis!="undefined"?globalThis:e||self,t(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"]))})(this,function(e,t,o,d,i,u,p,s,n){"use strict";var P=Object.defineProperty,C=Object.defineProperties;var V=Object.getOwnPropertyDescriptors;var v=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable;var f=(e,t,o)=>t in e?P(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,T=(e,t)=>{for(var o in t||(t={}))j.call(t,o)&&f(e,o,t[o]);if(v)for(var o of v(t))$.call(t,o)&&f(e,o,t[o]);return e},b=(e,t)=>C(e,V(t));var a=(e,t,o)=>(f(e,typeof t!="symbol"?t+"":t,o),o);var l=(e,t,o)=>new Promise((d,i)=>{var u=n=>{try{s(o.next(n))}catch(r){i(r)}},p=n=>{try{s(o.throw(n))}catch(r){i(r)}},s=n=>n.done?d(n.value):Promise.resolve(n.value).then(u,p);s((o=o.apply(e,t)).next())});const r="workflow-request",w={"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: "${r}" })}}`}}}},"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: "${r}" })}}`,"x-component":"ArrayItems.Addition"}}}}}};function A(h){const m=p.useField(),{values:x,setValuesIn:y,clearFormGraph:I}=p.useForm(),{contentType:c}=x,[k,S]=d.useState(w[c]);return p.useFormEffects(()=>{i.onFieldValueChange("contentType",g=>{I(`${m.address}.*`),S(b(T({},w[g.value]),{name:u.uid()})),y("data",null)})}),o.jsx(t.SchemaComponent,{basePath:m.address,schema:k,onlyRenderProperties:!0})}class F extends n.Instruction{constructor(){super(...arguments);a(this,"title",`{{t("HTTP request", { ns: "${r}" })}}`);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: "${r}" })}}`);a(this,"fieldset",{method:{type:"string",required:!0,title:`{{t("HTTP method", { ns: "${r}" })}}`,"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: "${r}" })}}`,"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: "${r}" })}}`,"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"}],default:"application/json"},headers:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",title:`{{t("Headers", { ns: "${r}" })}}`,description:`{{t('"Content-Type" will be ignored from headers.', { ns: "${r}" })}}`,items:{type:"object",properties:{space:{type:"void","x-component":"Space","x-component-props":{style:{flexWrap:"nowrap",maxWidth:"100%"},className:t.css`
11
+ & > .ant-space-item:first-child,
12
+ & > .ant-space-item:last-child {
13
+ flex-shrink: 0;
14
+ }
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: "${r}" })}}`,"x-component":"ArrayItems.Addition"}}},params:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",title:`{{t("Parameters", { ns: "${r}" })}}`,items:{type:"object",properties:{space:{type:"void","x-component":"Space","x-component-props":{style:{flexWrap:"nowrap",maxWidth:"100%"},className:t.css`
16
+ & > .ant-space-item:first-child,
17
+ & > .ant-space-item:last-child {
18
+ flex-shrink: 0;
19
+ }
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: "${r}" })}}`,"x-component":"ArrayItems.Addition"}}},data:{type:"void",title:`{{t("Body", { ns: "${r}" })}}`,"x-decorator":"FormItem","x-decorator-props":{},"x-component":"BodyComponent"},timeout:{type:"number",title:`{{t("Timeout config", { ns: "${r}" })}}`,"x-decorator":"FormItem","x-decorator-props":{},"x-component":"InputNumber","x-component-props":{addonAfter:`{{t("ms", { ns: "${r}" })}}`,min:1,step:1e3,defaultValue:5e3}},ignoreFail:{type:"boolean",title:`{{t("Ignore failed request and continue workflow", { ns: "${r}" })}}`,"x-decorator":"FormItem","x-component":"Checkbox"}});a(this,"components",{ArrayItems:s.ArrayItems,BodyComponent:A,WorkflowVariableTextArea:n.WorkflowVariableTextArea,WorkflowVariableJSON:n.WorkflowVariableJSON})}useVariables({key:x,title:y},{types:I,fieldNames:c=n.defaultFieldNames}){return{[c.value]:x,[c.label]:y}}}class q extends t.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",F)})}}e.default=q,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -13,9 +13,9 @@ 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.0.0-alpha.13",
17
- "@nocobase/client": "1.0.0-alpha.13",
16
+ "@nocobase/plugin-workflow": "1.0.0-alpha.14",
17
+ "@nocobase/client": "1.0.0-alpha.14",
18
18
  "react-i18next": "11.18.6",
19
- "@nocobase/server": "1.0.0-alpha.13",
19
+ "@nocobase/server": "1.0.0-alpha.14",
20
20
  "axios": "0.26.1"
21
21
  };
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.0.0-alpha.13",
7
+ "version": "1.0.0-alpha.14",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/workflow-request",
@@ -24,7 +24,7 @@
24
24
  "@nocobase/server": "1.x",
25
25
  "@nocobase/test": "1.x"
26
26
  },
27
- "gitHead": "bd97adef70762a6691b5b58ca6572672a8cdf838",
27
+ "gitHead": "829078819e5b9720a4c2501c340a301315c0d029",
28
28
  "keywords": [
29
29
  "Workflow"
30
30
  ]