@nocobase/plugin-workflow-request 2.1.0-alpha.14 → 2.1.0-alpha.16
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 +8 -0
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +4 -4
- package/dist/locale/en-US.json +2 -1
- package/dist/locale/zh-CN.json +3 -1
- package/dist/node_modules/joi/package.json +1 -1
- package/dist/server/RequestInstruction.d.ts +8 -2
- package/dist/server/RequestInstruction.js +41 -21
- package/package.json +2 -2
|
@@ -185,6 +185,14 @@ export default class extends Instruction {
|
|
|
185
185
|
defaultValue: number;
|
|
186
186
|
};
|
|
187
187
|
};
|
|
188
|
+
onlyData: {
|
|
189
|
+
type: string;
|
|
190
|
+
'x-content': string;
|
|
191
|
+
description: string;
|
|
192
|
+
'x-decorator': string;
|
|
193
|
+
'x-component': string;
|
|
194
|
+
default: boolean;
|
|
195
|
+
};
|
|
188
196
|
ignoreFail: {
|
|
189
197
|
type: string;
|
|
190
198
|
'x-content': string;
|
package/dist/client/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@formily/antd-v5"),require("@formily/core"),require("@formily/shared"),require("react"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/plugin-workflow/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-request",["react-i18next","@formily/antd-v5","@formily/core","@formily/shared","react","@nocobase/client","@formily/react","@ant-design/icons","@nocobase/plugin-workflow/client"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-request"]=t(require("react-i18next"),require("@formily/antd-v5"),require("@formily/core"),require("@formily/shared"),require("react"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/plugin-workflow/client")):e["@nocobase/plugin-workflow-request"]=t(e["react-i18next"],e["@formily/antd-v5"],e["@formily/core"],e["@formily/shared"],e.react,e["@nocobase/client"],e["@formily/react"],e["@ant-design/icons"],e["@nocobase/plugin-workflow/client"])}(self,function(e,t,r,o,n,a,i,c,l){return function(){"use strict";var p={375:function(e){e.exports=c},418:function(e){e.exports=t},452:function(e){e.exports=r},230:function(e){e.exports=i},166:function(e){e.exports=o},342:function(e){e.exports=a},990:function(e){e.exports=l},155:function(e){e.exports=n},953:function(t){t.exports=e}},u={};function s(e){var t=u[e];if(void 0!==t)return t.exports;var r=u[e]={exports:{}};return p[e](r,r.exports,s),r.exports}s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},s.d=function(e,t){for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.g.importScripts&&(f=s.g.location+"");var f,m=s.g.document;if(!f&&m&&(m.currentScript&&"SCRIPT"===m.currentScript.tagName.toUpperCase()&&(f=m.currentScript.src),!f)){var d=m.getElementsByTagName("script");if(d.length)for(var y=d.length-1;y>-1&&(!f||!/^http(s?):/.test(f));)f=d[y--].src}if(!f)throw Error("Automatic publicPath is not supported in this browser");s.p=f.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var b={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-workflow-request/dist/client/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var o=window.location.pathname||"/",n=o.indexOf("/v2/");e=n>=0?o.slice(0,n+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-workflow-request/dist/client/"}s.p=e}(),!function(){s.r(b),s.d(b,{default:function(){return N}});var e=s(342),t=s(155),r=s.n(t),o=s(452),n=s(166),a=s(230),i=s(418),c=s(375),l=s(990),p=s(953),u="workflow-request";function f(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,(t=r,(0,p.useTranslation)(u,t)).t)(e)}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(h=function(){return!!e})()}function w(){var e=v(["\n font-size: 80%;\n font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;\n "]);return w=function(){return e},e}function g(){var e=v(["\n font-size: 80%;\n font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;\n "]);return g=function(){return e},e}function O(){var e=v(["\n & > .ant-space-item:first-child,\n & > .ant-space-item:last-child {\n flex-shrink: 0;\n }\n "]);return O=function(){return e},e}function I(){var e=v(["\n & > .ant-space-item:first-child,\n & > .ant-space-item:last-child {\n flex-shrink: 0;\n }\n "]);return I=function(){return e},e}var T={"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: "'.concat(u,'" })}}')}}}},"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: "'.concat(u,'" })}}'),"x-component":"ArrayItems.Addition"}}}}},"multipart/form-data":{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")}}'}},valueType:{type:"string","x-decorator":"FormItem","x-component":"Select","x-component-props":{allowClear:!1},enum:[{value:"text",label:"Text"},{value:"file",label:"File"}],default:"text"},text:{type:"string","x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{useTypedConstant:!0},"x-reactions":[{dependencies:[".valueType"],fulfill:{state:{visible:'{{ $deps[0]==="text" }}'}}}]},file:{type:"string","x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{variableOptions:{types:[function(e,t){var r,o=t.collectionManager;return!!e.target&&("attachments"===e.target||(null==(r=o.getCollection(e.target))?void 0:r.template)==="file")}]}},"x-reactions":[{dependencies:[".valueType"],fulfill:{state:{visible:'{{ $deps[0]==="file" }}'}}}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:'{{t("Add key-value pairs", { ns: "'.concat(u,'" })}}'),"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:(0,e.css)(w())}}}},"text/plain":{type:"void",properties:{data:{type:"string","x-decorator":"FormItem","x-component":"WorkflowVariableRawTextArea","x-component-props":{autoSize:{minRows:10},className:(0,e.css)(g())}}}}};function j(i){var c,l=(0,a.useField)(),p=(0,a.useForm)(),u=p.values,s=p.setValuesIn,f=p.clearFormGraph,y=u.contentType,b=function(e){if(Array.isArray(e))return e}(c=(0,t.useState)(T[y]))||function(e){var t,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var n=[],a=!0,i=!1;try{for(o=o.call(e);!(a=(t=o.next()).done)&&(n.push(t.value),2!==n.length);a=!0);}catch(e){i=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(i)throw r}}return n}}(c)||function(e){if(e){if("string"==typeof e)return m(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return m(e,2)}}(c)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),x=b[0],v=b[1];return(0,a.useFormEffects)(function(){(0,o.onFieldValueChange)("contentType",function(e){var t,r;f("".concat(l.address,".*")),v((t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){d(e,t,r[t])})}return e}({},T[e.value]),r=r={name:(0,n.uid)()},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}),t)),s("data",null)})}),r().createElement(e.SchemaComponent,{basePath:l.address,schema:x,onlyRenderProperties:!0})}var S=function(t){var o;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function n(){var t,o,a;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return o=n,a=arguments,o=y(o),d(t=function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,h()?Reflect.construct(o,a||[],y(this).constructor):o.apply(this,a)),"title",'{{t("HTTP request", { ns: "'.concat(u,'" })}}')),d(t,"type","request"),d(t,"group","extended"),d(t,"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: "'.concat(u,'" })}}')),d(t,"icon",r().createElement(c.GlobalOutlined,null)),d(t,"fieldset",{method:{type:"string",required:!0,title:'{{t("HTTP method", { ns: "'.concat(u,'" })}}'),"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: "'.concat(u,'" })}}'),"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: "'.concat(u,'" })}}'),"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:"multipart/form-data",value:"multipart/form-data"},{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: "'.concat(u,'" })}}'),description:'{{t(\'"Content-Type" will be ignored from headers.\', { ns: "'.concat(u,'" })}}'),items:{type:"object",properties:{space:{type:"void","x-component":"Space","x-component-props":{style:{flexWrap:"nowrap",maxWidth:"100%"},className:(0,e.css)(O())},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: "'.concat(u,'" })}}'),"x-component":"ArrayItems.Addition"}}},params:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",title:'{{t("Parameters", { ns: "'.concat(u,'" })}}'),items:{type:"object",properties:{space:{type:"void","x-component":"Space","x-component-props":{style:{flexWrap:"nowrap",maxWidth:"100%"},className:(0,e.css)(I())},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: "'.concat(u,'" })}}'),"x-component":"ArrayItems.Addition"}}},data:{type:"void",title:'{{t("Body", { ns: "'.concat(u,'" })}}'),"x-decorator":"FormItem","x-decorator-props":{},"x-component":"BodyComponent"},timeout:{type:"number",title:'{{t("Timeout config", { ns: "'.concat(u,'" })}}'),"x-decorator":"FormItem","x-decorator-props":{},"x-component":"InputNumber","x-component-props":{addonAfter:'{{t("ms", { ns: "'.concat(u,'" })}}'),min:1,step:1e3,defaultValue:5e3}},ignoreFail:{type:"boolean","x-content":'{{t("Ignore failed request and continue workflow", { ns: "'.concat(u,'" })}}'),"x-decorator":"FormItem","x-component":"Checkbox"}}),d(t,"components",{ArrayItems:i.ArrayItems,BodyComponent:j,WorkflowVariableJSON:l.WorkflowVariableJSON,WorkflowVariableTextArea:l.WorkflowVariableTextArea,WorkflowVariableRawTextArea:l.WorkflowVariableRawTextArea,WorkflowVariableInput:l.WorkflowVariableInput}),d(t,"testable",!0),t}return n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),t&&x(n,t),o=[{key:"useVariables",value:function(e,t){var r,o,n,a,i=e.key,c=e.title,p=e.config;t.types;var u=f("Status code"),s=f("Data"),m=f("Response headers");return d(a={},l.defaultFieldNames.value,i),d(a,l.defaultFieldNames.label,c),d(a,l.defaultFieldNames.children,p.onlyData?null:[(d(r={},l.defaultFieldNames.value,"status"),d(r,l.defaultFieldNames.label,u),r),(d(o={},l.defaultFieldNames.value,"data"),d(o,l.defaultFieldNames.label,s),o),(d(n={},l.defaultFieldNames.value,"headers"),d(n,l.defaultFieldNames.label,m),n)]),a}}],function(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(n.prototype,o),n}(l.Instruction);function k(e,t,r,o,n,a,i){try{var c=e[a](i),l=c.value}catch(e){r(e);return}c.done?t(l):Promise.resolve(l).then(o,n)}function A(e){return function(){var t=this,r=arguments;return new Promise(function(o,n){var a=e.apply(t,r);function i(e){k(a,o,n,i,c,"next",e)}function c(e){k(a,o,n,i,c,"throw",e)}i(void 0)})}}function F(e,t,r){return(F=C()?Reflect.construct:function(e,t,r){var o=[null];o.push.apply(o,t);var n=new(Function.bind.apply(e,o));return r&&q(n,r.prototype),n}).apply(null,arguments)}function P(e){return(P=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function q(e,t){return(q=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _(e){var t="function"==typeof Map?new Map:void 0;return(_=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return F(e,arguments,P(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),q(r,e)})(e)}function C(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(C=function(){return!!e})()}function E(e,t){var r,o,n,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(i,"next",{value:l(0)}),c(i,"throw",{value:l(1)}),c(i,"return",{value:l(2)}),"function"==typeof Symbol&&c(i,Symbol.iterator,{value:function(){return this}}),i;function l(c){return function(l){var p=[c,l];if(r)throw TypeError("Generator is already executing.");for(;i&&(i=0,p[0]&&(a=0)),a;)try{if(r=1,o&&(n=2&p[0]?o.return:p[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,p[1])).done)return n;switch(o=0,n&&(p=[2&p[0],n.value]),p[0]){case 0:case 1:n=p;break;case 4:return a.label++,{value:p[1],done:!1};case 5:a.label++,o=p[1],p=[0];continue;case 7:p=a.ops.pop(),a.trys.pop();continue;default:if(!(n=(n=a.trys).length>0&&n[n.length-1])&&(6===p[0]||2===p[0])){a=0;continue}if(3===p[0]&&(!n||p[1]>n[0]&&p[1]<n[3])){a.label=p[1];break}if(6===p[0]&&a.label<n[1]){a.label=n[1],n=p;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(p);break}n[2]&&a.ops.pop(),a.trys.pop();continue}p=t.call(e,a)}catch(e){p=[6,e],o=0}finally{r=n=0}if(5&p[0])throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}}var N=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=P(e),function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,C()?Reflect.construct(e,t||[],P(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&q(r,e),t=[{key:"afterAdd",value:function(){return A(function(){return E(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return A(function(){return E(this,function(e){return[2]})})()}},{key:"load",value:function(){return A(function(){return E(this,function(e){return this.app.pm.get("workflow").registerInstruction("request",S),[2]})}).call(this)}}],function(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(r.prototype,t),r}(_(e.Plugin))}(),b}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@formily/antd-v5"),require("@formily/core"),require("@formily/shared"),require("react"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/plugin-workflow/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-request",["react-i18next","@formily/antd-v5","@formily/core","@formily/shared","react","@nocobase/client","@formily/react","@ant-design/icons","@nocobase/plugin-workflow/client"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-request"]=t(require("react-i18next"),require("@formily/antd-v5"),require("@formily/core"),require("@formily/shared"),require("react"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/plugin-workflow/client")):e["@nocobase/plugin-workflow-request"]=t(e["react-i18next"],e["@formily/antd-v5"],e["@formily/core"],e["@formily/shared"],e.react,e["@nocobase/client"],e["@formily/react"],e["@ant-design/icons"],e["@nocobase/plugin-workflow/client"])}(self,function(e,t,r,o,n,a,i,c,l){return function(){"use strict";var p={375:function(e){e.exports=c},418:function(e){e.exports=t},452:function(e){e.exports=r},230:function(e){e.exports=i},166:function(e){e.exports=o},342:function(e){e.exports=a},990:function(e){e.exports=l},155:function(e){e.exports=n},953:function(t){t.exports=e}},u={};function s(e){var t=u[e];if(void 0!==t)return t.exports;var r=u[e]={exports:{}};return p[e](r,r.exports,s),r.exports}s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},s.d=function(e,t){for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.g.importScripts&&(f=s.g.location+"");var f,m=s.g.document;if(!f&&m&&(m.currentScript&&"SCRIPT"===m.currentScript.tagName.toUpperCase()&&(f=m.currentScript.src),!f)){var d=m.getElementsByTagName("script");if(d.length)for(var y=d.length-1;y>-1&&(!f||!/^http(s?):/.test(f));)f=d[y--].src}if(!f)throw Error("Automatic publicPath is not supported in this browser");s.p=f.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var b={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-workflow-request/dist/client/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var o=window.location.pathname||"/",n=o.indexOf("/v2/");e=n>=0?o.slice(0,n+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-workflow-request/dist/client/"}s.p=e}(),!function(){s.r(b),s.d(b,{default:function(){return N}});var e=s(342),t=s(155),r=s.n(t),o=s(452),n=s(166),a=s(230),i=s(418),c=s(375),l=s(990),p=s(953),u="workflow-request";function f(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,(t=r,(0,p.useTranslation)(u,t)).t)(e)}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(h=function(){return!!e})()}function w(){var e=v(["\n font-size: 80%;\n font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;\n "]);return w=function(){return e},e}function g(){var e=v(["\n font-size: 80%;\n font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;\n "]);return g=function(){return e},e}function O(){var e=v(["\n & > .ant-space-item:first-child,\n & > .ant-space-item:last-child {\n flex-shrink: 0;\n }\n "]);return O=function(){return e},e}function I(){var e=v(["\n & > .ant-space-item:first-child,\n & > .ant-space-item:last-child {\n flex-shrink: 0;\n }\n "]);return I=function(){return e},e}var T={"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: "'.concat(u,'" })}}')}}}},"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: "'.concat(u,'" })}}'),"x-component":"ArrayItems.Addition"}}}}},"multipart/form-data":{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")}}'}},valueType:{type:"string","x-decorator":"FormItem","x-component":"Select","x-component-props":{allowClear:!1},enum:[{value:"text",label:"Text"},{value:"file",label:"File"}],default:"text"},text:{type:"string","x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{useTypedConstant:!0},"x-reactions":[{dependencies:[".valueType"],fulfill:{state:{visible:'{{ $deps[0]==="text" }}'}}}]},file:{type:"string","x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{variableOptions:{types:[function(e,t){var r,o=t.collectionManager;return!!e.target&&("attachments"===e.target||(null==(r=o.getCollection(e.target))?void 0:r.template)==="file")}]}},"x-reactions":[{dependencies:[".valueType"],fulfill:{state:{visible:'{{ $deps[0]==="file" }}'}}}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:'{{t("Add key-value pairs", { ns: "'.concat(u,'" })}}'),"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:(0,e.css)(w())}}}},"text/plain":{type:"void",properties:{data:{type:"string","x-decorator":"FormItem","x-component":"WorkflowVariableRawTextArea","x-component-props":{autoSize:{minRows:10},className:(0,e.css)(g())}}}}};function j(i){var c,l=(0,a.useField)(),p=(0,a.useForm)(),u=p.values,s=p.setValuesIn,f=p.clearFormGraph,y=u.contentType,b=function(e){if(Array.isArray(e))return e}(c=(0,t.useState)(T[y]))||function(e){var t,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var n=[],a=!0,i=!1;try{for(o=o.call(e);!(a=(t=o.next()).done)&&(n.push(t.value),2!==n.length);a=!0);}catch(e){i=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(i)throw r}}return n}}(c)||function(e){if(e){if("string"==typeof e)return m(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return m(e,2)}}(c)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),x=b[0],v=b[1];return(0,a.useFormEffects)(function(){(0,o.onFieldValueChange)("contentType",function(e){var t,r;f("".concat(l.address,".*")),v((t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){d(e,t,r[t])})}return e}({},T[e.value]),r=r={name:(0,n.uid)()},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}),t)),s("data",null)})}),r().createElement(e.SchemaComponent,{basePath:l.address,schema:x,onlyRenderProperties:!0})}var S=function(t){var o;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function n(){var t,o,a;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return o=n,a=arguments,o=y(o),d(t=function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,h()?Reflect.construct(o,a||[],y(this).constructor):o.apply(this,a)),"title",'{{t("HTTP request", { ns: "'.concat(u,'" })}}')),d(t,"type","request"),d(t,"group","extended"),d(t,"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: "'.concat(u,'" })}}')),d(t,"icon",r().createElement(c.GlobalOutlined,null)),d(t,"fieldset",{method:{type:"string",required:!0,title:'{{t("HTTP method", { ns: "'.concat(u,'" })}}'),"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: "'.concat(u,'" })}}'),"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: "'.concat(u,'" })}}'),"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:"multipart/form-data",value:"multipart/form-data"},{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: "'.concat(u,'" })}}'),description:'{{t(\'"Content-Type" will be ignored from headers.\', { ns: "'.concat(u,'" })}}'),items:{type:"object",properties:{space:{type:"void","x-component":"Space","x-component-props":{style:{flexWrap:"nowrap",maxWidth:"100%"},className:(0,e.css)(O())},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: "'.concat(u,'" })}}'),"x-component":"ArrayItems.Addition"}}},params:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",title:'{{t("Parameters", { ns: "'.concat(u,'" })}}'),items:{type:"object",properties:{space:{type:"void","x-component":"Space","x-component-props":{style:{flexWrap:"nowrap",maxWidth:"100%"},className:(0,e.css)(I())},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: "'.concat(u,'" })}}'),"x-component":"ArrayItems.Addition"}}},data:{type:"void",title:'{{t("Body", { ns: "'.concat(u,'" })}}'),"x-decorator":"FormItem","x-decorator-props":{},"x-component":"BodyComponent"},timeout:{type:"number",title:'{{t("Timeout config", { ns: "'.concat(u,'" })}}'),"x-decorator":"FormItem","x-decorator-props":{},"x-component":"InputNumber","x-component-props":{addonAfter:'{{t("ms", { ns: "'.concat(u,'" })}}'),min:1,step:1e3,defaultValue:5e3}},onlyData:{type:"boolean","x-content":'{{t("Only return response data", { ns: "'.concat(u,'" })}}'),description:'{{t("If enabled, only the response data will be saved into result, and the status code and headers will be ignored.", { ns: "'.concat(u,'" })}}'),"x-decorator":"FormItem","x-component":"Checkbox",default:!0},ignoreFail:{type:"boolean","x-content":'{{t("Ignore failed request and continue workflow", { ns: "'.concat(u,'" })}}'),"x-decorator":"FormItem","x-component":"Checkbox"}}),d(t,"components",{ArrayItems:i.ArrayItems,BodyComponent:j,WorkflowVariableJSON:l.WorkflowVariableJSON,WorkflowVariableTextArea:l.WorkflowVariableTextArea,WorkflowVariableRawTextArea:l.WorkflowVariableRawTextArea,WorkflowVariableInput:l.WorkflowVariableInput}),d(t,"testable",!0),t}return n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),t&&x(n,t),o=[{key:"useVariables",value:function(e,t){var r,o,n,a,i=e.key,c=e.title,p=e.config;t.types;var u=f("Status code"),s=f("Data"),m=f("Response headers");return d(a={},l.defaultFieldNames.value,i),d(a,l.defaultFieldNames.label,c),d(a,l.defaultFieldNames.children,p.onlyData?null:[(d(r={},l.defaultFieldNames.value,"status"),d(r,l.defaultFieldNames.label,u),r),(d(o={},l.defaultFieldNames.value,"data"),d(o,l.defaultFieldNames.label,s),o),(d(n={},l.defaultFieldNames.value,"headers"),d(n,l.defaultFieldNames.label,m),n)]),a}}],function(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(n.prototype,o),n}(l.Instruction);function k(e,t,r,o,n,a,i){try{var c=e[a](i),l=c.value}catch(e){r(e);return}c.done?t(l):Promise.resolve(l).then(o,n)}function A(e){return function(){var t=this,r=arguments;return new Promise(function(o,n){var a=e.apply(t,r);function i(e){k(a,o,n,i,c,"next",e)}function c(e){k(a,o,n,i,c,"throw",e)}i(void 0)})}}function F(e,t,r){return(F=C()?Reflect.construct:function(e,t,r){var o=[null];o.push.apply(o,t);var n=new(Function.bind.apply(e,o));return r&&q(n,r.prototype),n}).apply(null,arguments)}function P(e){return(P=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function q(e,t){return(q=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _(e){var t="function"==typeof Map?new Map:void 0;return(_=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return F(e,arguments,P(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),q(r,e)})(e)}function C(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(C=function(){return!!e})()}function E(e,t){var r,o,n,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(i,"next",{value:l(0)}),c(i,"throw",{value:l(1)}),c(i,"return",{value:l(2)}),"function"==typeof Symbol&&c(i,Symbol.iterator,{value:function(){return this}}),i;function l(c){return function(l){var p=[c,l];if(r)throw TypeError("Generator is already executing.");for(;i&&(i=0,p[0]&&(a=0)),a;)try{if(r=1,o&&(n=2&p[0]?o.return:p[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,p[1])).done)return n;switch(o=0,n&&(p=[2&p[0],n.value]),p[0]){case 0:case 1:n=p;break;case 4:return a.label++,{value:p[1],done:!1};case 5:a.label++,o=p[1],p=[0];continue;case 7:p=a.ops.pop(),a.trys.pop();continue;default:if(!(n=(n=a.trys).length>0&&n[n.length-1])&&(6===p[0]||2===p[0])){a=0;continue}if(3===p[0]&&(!n||p[1]>n[0]&&p[1]<n[3])){a.label=p[1];break}if(6===p[0]&&a.label<n[1]){a.label=n[1],n=p;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(p);break}n[2]&&a.ops.pop(),a.trys.pop();continue}p=t.call(e,a)}catch(e){p=[6,e],o=0}finally{r=n=0}if(5&p[0])throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}}var N=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=P(e),function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,C()?Reflect.construct(e,t||[],P(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&q(r,e),t=[{key:"afterAdd",value:function(){return A(function(){return E(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return A(function(){return E(this,function(e){return[2]})})()}},{key:"load",value:function(){return A(function(){return E(this,function(e){return this.app.pm.get("workflow").registerInstruction("request",S),[2]})}).call(this)}}],function(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(r.prototype,t),r}(_(e.Plugin))}(),b}()});
|
package/dist/externalVersion.js
CHANGED
|
@@ -14,11 +14,11 @@ module.exports = {
|
|
|
14
14
|
"@formily/react": "2.3.7",
|
|
15
15
|
"@formily/antd-v5": "1.2.3",
|
|
16
16
|
"@ant-design/icons": "5.6.1",
|
|
17
|
-
"@nocobase/client": "2.1.0-alpha.
|
|
18
|
-
"@nocobase/plugin-workflow": "2.1.0-alpha.
|
|
17
|
+
"@nocobase/client": "2.1.0-alpha.16",
|
|
18
|
+
"@nocobase/plugin-workflow": "2.1.0-alpha.16",
|
|
19
19
|
"react-i18next": "11.18.6",
|
|
20
|
-
"@nocobase/server": "2.1.0-alpha.
|
|
20
|
+
"@nocobase/server": "2.1.0-alpha.16",
|
|
21
21
|
"axios": "1.7.7",
|
|
22
22
|
"lodash": "4.17.21",
|
|
23
|
-
"@nocobase/plugin-file-manager": "2.1.0-alpha.
|
|
23
|
+
"@nocobase/plugin-file-manager": "2.1.0-alpha.16"
|
|
24
24
|
};
|
package/dist/locale/en-US.json
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"Insert": "Insert",
|
|
16
16
|
"Milliseconds": "Milliseconds",
|
|
17
17
|
"Only support standard JSON data": "Only support standard JSON data",
|
|
18
|
+
"Only return response data": "Only return response data",
|
|
18
19
|
"Parameters": "Parameters",
|
|
19
20
|
"Response headers": "Response headers",
|
|
20
21
|
"Send HTTP request to a URL. You can use the variables in the upstream nodes as request headers, parameters and request body.": "Send HTTP request to a URL. You can use the variables in the upstream nodes as request headers, parameters and request body.",
|
|
@@ -24,4 +25,4 @@
|
|
|
24
25
|
"URL": "URL",
|
|
25
26
|
"Use variable": "Use variable",
|
|
26
27
|
"ms": "ms"
|
|
27
|
-
}
|
|
28
|
+
}
|
package/dist/locale/zh-CN.json
CHANGED
|
@@ -10,11 +10,13 @@
|
|
|
10
10
|
"HTTP method": "HTTP 方法",
|
|
11
11
|
"HTTP request": "HTTP 请求",
|
|
12
12
|
"Headers": "请求头",
|
|
13
|
+
"If enabled, only the response data will be saved into result, and the status code and headers will be ignored.": "启用后,只有响应数据会保存为结果,状态码和响应头将被忽略。",
|
|
13
14
|
"Ignore failed request and continue workflow": "忽略失败的请求并继续工作流",
|
|
14
15
|
"Input request data": "输入请求数据",
|
|
15
16
|
"Insert": "插入",
|
|
16
17
|
"Milliseconds": "毫秒",
|
|
17
18
|
"Only support standard JSON data": "仅支持标准 JSON 数据",
|
|
19
|
+
"Only return response data": "仅返回响应数据",
|
|
18
20
|
"Parameters": "参数",
|
|
19
21
|
"Response headers": "响应头",
|
|
20
22
|
"Send HTTP request to a URL. You can use the variables in the upstream nodes as request headers, parameters and request body.": "向指定 URL 发送 HTTP 请求。可以使用上游节点里的变量作为请求头、参数和请求体。",
|
|
@@ -24,4 +26,4 @@
|
|
|
24
26
|
"URL": "地址",
|
|
25
27
|
"Use variable": "使用变量",
|
|
26
28
|
"ms": "ms"
|
|
27
|
-
}
|
|
29
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"joi","description":"Object schema validation","version":"17.13.3","repository":"git://github.com/hapijs/joi","main":"lib/index.js","types":"lib/index.d.ts","browser":"dist/joi-browser.min.js","files":["lib/**/*","dist/*"],"keywords":["schema","validation"],"dependencies":{"@hapi/hoek":"^9.3.0","@hapi/topo":"^5.1.0","@sideway/address":"^4.1.5","@sideway/formula":"^3.0.1","@sideway/pinpoint":"^2.0.0"},"devDependencies":{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/joi-legacy-test":"npm:@hapi/joi@15.x.x","@hapi/lab":"^25.1.3","@types/node":"^14.18.63","typescript":"4.3.x"},"scripts":{"prepublishOnly":"cd browser && npm install && npm run build","test":"lab -t 100 -a @hapi/code -L -Y","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},"license":"BSD-3-Clause","_lastModified":"2026-04-
|
|
1
|
+
{"name":"joi","description":"Object schema validation","version":"17.13.3","repository":"git://github.com/hapijs/joi","main":"lib/index.js","types":"lib/index.d.ts","browser":"dist/joi-browser.min.js","files":["lib/**/*","dist/*"],"keywords":["schema","validation"],"dependencies":{"@hapi/hoek":"^9.3.0","@hapi/topo":"^5.1.0","@sideway/address":"^4.1.5","@sideway/formula":"^3.0.1","@sideway/pinpoint":"^2.0.0"},"devDependencies":{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/joi-legacy-test":"npm:@hapi/joi@15.x.x","@hapi/lab":"^25.1.3","@types/node":"^14.18.63","typescript":"4.3.x"},"scripts":{"prepublishOnly":"cd browser && npm install && npm run build","test":"lab -t 100 -a @hapi/code -L -Y","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},"license":"BSD-3-Clause","_lastModified":"2026-04-14T00:05:37.773Z"}
|
|
@@ -22,12 +22,18 @@ export type RequestInstructionConfig = Pick<AxiosRequestConfig, 'url' | 'method'
|
|
|
22
22
|
export default class extends Instruction {
|
|
23
23
|
configSchema: Joi.ObjectSchema<any>;
|
|
24
24
|
run(node: FlowNodeModel, prevJob: any, processor: Processor): Promise<{
|
|
25
|
-
status: 1
|
|
25
|
+
status: 1;
|
|
26
26
|
result: any;
|
|
27
|
+
} | {
|
|
28
|
+
status: 1 | -1;
|
|
29
|
+
result: Record<string, any>;
|
|
27
30
|
}>;
|
|
28
31
|
resume(node: FlowNodeModel, job: any, processor: Processor): Promise<any>;
|
|
29
32
|
test(config: RequestInstructionConfig): Promise<{
|
|
30
|
-
status: 1
|
|
33
|
+
status: 1;
|
|
31
34
|
result: any;
|
|
35
|
+
} | {
|
|
36
|
+
status: 1 | -1;
|
|
37
|
+
result: Record<string, any>;
|
|
32
38
|
}>;
|
|
33
39
|
}
|
|
@@ -86,14 +86,22 @@ function getContentTypeTransformer(mimeType, app) {
|
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
+
function createInvalidUrlError(cause) {
|
|
90
|
+
if (cause instanceof TypeError && typeof cause.code !== "undefined") {
|
|
91
|
+
return cause;
|
|
92
|
+
}
|
|
93
|
+
const error = new TypeError("Invalid URL");
|
|
94
|
+
error.code = "ERR_INVALID_URL";
|
|
95
|
+
return error;
|
|
96
|
+
}
|
|
89
97
|
function validateUrl(url) {
|
|
90
98
|
try {
|
|
91
99
|
const parsed = new URL(url);
|
|
92
100
|
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
93
|
-
throw
|
|
101
|
+
throw createInvalidUrlError();
|
|
94
102
|
}
|
|
95
|
-
} catch {
|
|
96
|
-
throw
|
|
103
|
+
} catch (error) {
|
|
104
|
+
throw createInvalidUrlError(error);
|
|
97
105
|
}
|
|
98
106
|
}
|
|
99
107
|
async function request(config, app) {
|
|
@@ -130,27 +138,22 @@ function responseSuccess(response, onlyData = false) {
|
|
|
130
138
|
status: response.status,
|
|
131
139
|
statusText: response.statusText,
|
|
132
140
|
headers: response.headers,
|
|
133
|
-
config: response.config,
|
|
134
141
|
data: response.data
|
|
135
142
|
};
|
|
136
143
|
}
|
|
137
144
|
function responseFailure(error) {
|
|
138
|
-
|
|
139
|
-
message: error.message
|
|
140
|
-
stack: error.stack
|
|
145
|
+
const result = {
|
|
146
|
+
message: error instanceof Error ? error.message : String(error)
|
|
141
147
|
};
|
|
142
|
-
if (error.
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
} else if (error.request) {
|
|
152
|
-
result = error.toJSON();
|
|
153
|
-
}
|
|
148
|
+
if (typeof (error == null ? void 0 : error.code) !== "undefined") {
|
|
149
|
+
result["code"] = error.code;
|
|
150
|
+
}
|
|
151
|
+
if ((error == null ? void 0 : error.isAxiosError) && error.response) {
|
|
152
|
+
Object.assign(result, {
|
|
153
|
+
status: error.response.status,
|
|
154
|
+
statusText: error.response.statusText,
|
|
155
|
+
data: error.response.data
|
|
156
|
+
});
|
|
154
157
|
}
|
|
155
158
|
return result;
|
|
156
159
|
}
|
|
@@ -162,6 +165,20 @@ const CONTENT_TYPES = [
|
|
|
162
165
|
"application/xml",
|
|
163
166
|
"text/plain"
|
|
164
167
|
];
|
|
168
|
+
function logFailureDebug(logger, error) {
|
|
169
|
+
if (!(error == null ? void 0 : error.isAxiosError)) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
if (error.response) {
|
|
173
|
+
logger.debug("request failed response details", {
|
|
174
|
+
status: error.response.status,
|
|
175
|
+
statusText: error.response.statusText,
|
|
176
|
+
data: error.response.data
|
|
177
|
+
});
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
logger.debug("request failed error details", responseFailure(error));
|
|
181
|
+
}
|
|
165
182
|
class RequestInstruction_default extends import_plugin_workflow.Instruction {
|
|
166
183
|
configSchema = import_joi.default.object({
|
|
167
184
|
url: import_joi.default.string(),
|
|
@@ -196,9 +213,10 @@ class RequestInstruction_default extends import_plugin_workflow.Instruction {
|
|
|
196
213
|
result: responseSuccess(response, config.onlyData)
|
|
197
214
|
};
|
|
198
215
|
} catch (error) {
|
|
216
|
+
logFailureDebug(this.workflow.app.logger, error);
|
|
199
217
|
return {
|
|
200
218
|
status: config.ignoreFail ? import_plugin_workflow.JOB_STATUS.RESOLVED : import_plugin_workflow.JOB_STATUS.FAILED,
|
|
201
|
-
result: error
|
|
219
|
+
result: responseFailure(error)
|
|
202
220
|
};
|
|
203
221
|
}
|
|
204
222
|
}
|
|
@@ -228,6 +246,7 @@ class RequestInstruction_default extends import_plugin_workflow.Instruction {
|
|
|
228
246
|
} else {
|
|
229
247
|
processor.logger.error(`request (#${node.id}) failed unexpectedly: ${error.message}`);
|
|
230
248
|
}
|
|
249
|
+
logFailureDebug(processor.logger, error);
|
|
231
250
|
jobDone.status = config.ignoreFail ? import_plugin_workflow.JOB_STATUS.RESOLVED : import_plugin_workflow.JOB_STATUS.FAILED;
|
|
232
251
|
jobDone.result = responseFailure(error);
|
|
233
252
|
} finally {
|
|
@@ -253,9 +272,10 @@ class RequestInstruction_default extends import_plugin_workflow.Instruction {
|
|
|
253
272
|
result: responseSuccess(response, config.onlyData)
|
|
254
273
|
};
|
|
255
274
|
} catch (error) {
|
|
275
|
+
logFailureDebug(this.workflow.app.logger, error);
|
|
256
276
|
return {
|
|
257
277
|
status: config.ignoreFail ? import_plugin_workflow.JOB_STATUS.RESOLVED : import_plugin_workflow.JOB_STATUS.FAILED,
|
|
258
|
-
result: error
|
|
278
|
+
result: responseFailure(error)
|
|
259
279
|
};
|
|
260
280
|
}
|
|
261
281
|
}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"description": "Send HTTP requests to any HTTP service for data interaction in workflow.",
|
|
7
7
|
"description.ru-RU": "Отправляет HTTP-запросы к любому HTTP-сервису для взаимодействия с данными в рабочем процессе.",
|
|
8
8
|
"description.zh-CN": "可用于在工作流中向任意 HTTP 服务发送请求,进行数据交互。",
|
|
9
|
-
"version": "2.1.0-alpha.
|
|
9
|
+
"version": "2.1.0-alpha.16",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"main": "./dist/server/index.js",
|
|
12
12
|
"homepage": "https://docs.nocobase.com/handbook/workflow-request",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@nocobase/server": "2.x",
|
|
28
28
|
"@nocobase/test": "2.x"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "14cf3dbdb9f0a9669602de4ad21a9464fa27c105",
|
|
31
31
|
"keywords": [
|
|
32
32
|
"Workflow"
|
|
33
33
|
]
|