@nocobase/plugin-workflow-request 1.0.0-alpha.14 → 1.0.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.
@@ -201,19 +201,19 @@ export default class extends Instruction {
201
201
  WorkflowVariableTextArea: typeof WorkflowVariableTextArea;
202
202
  WorkflowVariableJSON: typeof WorkflowVariableJSON;
203
203
  };
204
- useVariables({ key, title }: {
204
+ useVariables({ key, title, config }: {
205
205
  key: any;
206
206
  title: any;
207
- }, { types, fieldNames }: {
207
+ config: any;
208
+ }, { types }: {
208
209
  types: any;
209
- fieldNames?: {
210
- readonly label: "label";
211
- readonly value: "value";
212
- readonly children: "children";
213
- };
214
210
  }): {
215
211
  value: any;
216
212
  label: any;
213
+ children: {
214
+ value: string;
215
+ label: string;
216
+ }[];
217
217
  };
218
218
  }
219
219
  export {};
@@ -7,14 +7,14 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
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`
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"],e["react-i18next"]))})(this,function(e,t,o,x,c,y,l,i,r,d){"use strict";var V=Object.defineProperty,j=Object.defineProperties;var $=Object.getOwnPropertyDescriptors;var q=Object.getOwnPropertySymbols;var W=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var T=(e,t,o)=>t in e?V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,S=(e,t)=>{for(var o in t||(t={}))W.call(t,o)&&T(e,o,t[o]);if(q)for(var o of q(t))E.call(t,o)&&T(e,o,t[o]);return e},k=(e,t)=>j(e,$(t));var n=(e,t,o)=>(T(e,typeof t!="symbol"?t+"":t,o),o);var u=(e,t,o)=>new Promise((x,c)=>{var y=r=>{try{i(o.next(r))}catch(d){c(d)}},l=r=>{try{i(o.throw(r))}catch(d){c(d)}},i=r=>r.done?x(r.value):Promise.resolve(r.value).then(y,l);i((o=o.apply(e,t)).next())});const a="workflow-request";function f(s,p={}){const{t:m}=N(p);return m(s)}function N(s){return d.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"}}}}}};function g(s){const p=l.useField(),{values:m,setValuesIn:h,clearFormGraph:w}=l.useForm(),{contentType:A}=m,[v,I]=x.useState(F[A]);return l.useFormEffects(()=>{c.onFieldValueChange("contentType",b=>{w(`${p.address}.*`),I(k(S({},F[b.value]),{name:y.uid()})),h("data",null)})}),o.jsx(t.SchemaComponent,{basePath:p.address,schema:v,onlyRenderProperties:!0})}class P extends r.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"}],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:t.css`
11
11
  & > .ant-space-item:first-child,
12
12
  & > .ant-space-item:last-child {
13
13
  flex-shrink: 0;
14
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`
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:t.css`
16
16
  & > .ant-space-item:first-child,
17
17
  & > .ant-space-item:last-child {
18
18
  flex-shrink: 0;
19
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"}})});
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:r.WorkflowVariableTextArea,WorkflowVariableJSON:r.WorkflowVariableJSON})}useVariables({key:m,title:h,config:w},{types:A}){const v=f("Status code"),I=f("Data"),b=f("Response headers");return{[r.defaultFieldNames.value]:m,[r.defaultFieldNames.label]:h,[r.defaultFieldNames.children]:w.onlyData?null:[{[r.defaultFieldNames.value]:"status",[r.defaultFieldNames.label]:v},{[r.defaultFieldNames.value]:"data",[r.defaultFieldNames.label]:I},{[r.defaultFieldNames.value]:"headers",[r.defaultFieldNames.label]:b}]}}}class C extends t.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",P)})}}e.default=C,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.14",
17
- "@nocobase/client": "1.0.0-alpha.14",
16
+ "@nocobase/plugin-workflow": "1.0.0-alpha.16",
17
+ "@nocobase/client": "1.0.0-alpha.16",
18
18
  "react-i18next": "11.18.6",
19
- "@nocobase/server": "1.0.0-alpha.14",
19
+ "@nocobase/server": "1.0.0-alpha.16",
20
20
  "axios": "0.26.1"
21
21
  };
@@ -16,6 +16,7 @@ export type RequestConfig = Pick<AxiosRequestConfig, 'url' | 'method' | 'params'
16
16
  headers: Array<Header>;
17
17
  contentType: string;
18
18
  ignoreFail: boolean;
19
+ onlyData?: boolean;
19
20
  };
20
21
  export default class extends Instruction {
21
22
  run(node: FlowNodeModel, prevJob: any, processor: Processor): Promise<any>;
@@ -54,18 +54,23 @@ const ContentTypeTransformers = {
54
54
  async function request(config) {
55
55
  const { url, method = "POST", contentType = "application/json", data, timeout = 5e3 } = config;
56
56
  const headers = (config.headers ?? []).reduce((result, header) => {
57
- if (header.name.toLowerCase() === "content-type") {
57
+ var _a, _b;
58
+ const name = (_a = header.name) == null ? void 0 : _a.trim();
59
+ if (name.toLowerCase() === "content-type") {
58
60
  return result;
59
61
  }
60
- return Object.assign(result, { [header.name]: header.value });
62
+ return Object.assign(result, { [name]: (_b = header.value) == null ? void 0 : _b.trim() });
61
63
  }, {});
62
64
  const params = (config.params ?? []).reduce(
63
- (result, param) => Object.assign(result, { [param.name]: param.value }),
65
+ (result, param) => {
66
+ var _a;
67
+ return Object.assign(result, { [param.name]: (_a = param.value) == null ? void 0 : _a.trim() });
68
+ },
64
69
  {}
65
70
  );
66
71
  headers["Content-Type"] = contentType;
67
72
  return import_axios.default.request({
68
- url,
73
+ url: url == null ? void 0 : url.trim(),
69
74
  method,
70
75
  headers,
71
76
  params,
@@ -75,6 +80,35 @@ async function request(config) {
75
80
  } : {}
76
81
  });
77
82
  }
83
+ function responseSuccess(response, onlyData = false) {
84
+ return onlyData ? response.data : {
85
+ status: response.status,
86
+ statusText: response.statusText,
87
+ headers: response.headers,
88
+ config: response.config,
89
+ data: response.data
90
+ };
91
+ }
92
+ function responseFailure(error) {
93
+ let result = {
94
+ message: error.message,
95
+ stack: error.stack
96
+ };
97
+ if (error.isAxiosError) {
98
+ if (error.response) {
99
+ Object.assign(result, {
100
+ status: error.response.status,
101
+ statusText: error.response.statusText,
102
+ headers: error.response.headers,
103
+ config: error.response.config,
104
+ data: error.response.data
105
+ });
106
+ } else if (error.request) {
107
+ result = error.toJSON();
108
+ }
109
+ }
110
+ return result;
111
+ }
78
112
  class RequestInstruction_default extends import_plugin_workflow.Instruction {
79
113
  async run(node, prevJob, processor) {
80
114
  const config = processor.getParsedValue(node.config, node.id);
@@ -85,7 +119,7 @@ class RequestInstruction_default extends import_plugin_workflow.Instruction {
85
119
  const response = await request(config);
86
120
  return {
87
121
  status: import_plugin_workflow.JOB_STATUS.RESOLVED,
88
- result: response.data
122
+ result: responseSuccess(response, config.onlyData)
89
123
  };
90
124
  } catch (error) {
91
125
  return {
@@ -101,23 +135,32 @@ class RequestInstruction_default extends import_plugin_workflow.Instruction {
101
135
  upstreamId: (prevJob == null ? void 0 : prevJob.id) ?? null
102
136
  });
103
137
  request(config).then((response) => {
138
+ processor.logger.info(`request (#${node.id}) response success, status: ${response.status}`);
104
139
  job.set({
105
140
  status: import_plugin_workflow.JOB_STATUS.RESOLVED,
106
- result: response.data
141
+ result: responseSuccess(response, config.onlyData)
107
142
  });
108
- processor.logger.info(`request (#${node.id}) response success, status: ${response.status}`);
109
143
  }).catch((error) => {
144
+ if (error.isAxiosError) {
145
+ if (error.response) {
146
+ processor.logger.info(`request (#${node.id}) failed with response, status: ${error.response.status}`);
147
+ } else if (error.request) {
148
+ processor.logger.error(`request (#${node.id}) failed without resposne: ${error.message}`);
149
+ } else {
150
+ processor.logger.error(`request (#${node.id}) initiation failed: ${error.message}`);
151
+ }
152
+ } else {
153
+ processor.logger.error(`request (#${node.id}) failed unexpectedly: ${error.message}`);
154
+ }
110
155
  job.set({
111
156
  status: import_plugin_workflow.JOB_STATUS.FAILED,
112
- result: error.isAxiosError ? error.toJSON() : error.message
157
+ result: responseFailure(error)
113
158
  });
114
- if (error.response) {
115
- processor.logger.info(`request (#${node.id}) response failed, status: ${error.response.status}`);
116
- } else {
117
- processor.logger.error(`request (#${node.id}) response failed: ${error.message}`);
118
- }
119
159
  }).finally(() => {
120
- this.workflow.resume(job);
160
+ processor.logger.debug(`request (#${node.id}) ended, resume workflow...`);
161
+ setImmediate(() => {
162
+ this.workflow.resume(job);
163
+ });
121
164
  });
122
165
  processor.logger.info(`request (#${node.id}) sent to "${config.url}", waiting for response...`);
123
166
  return processor.exit();
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { Migration } from '@nocobase/server';
10
+ export default class extends Migration {
11
+ appVersion: string;
12
+ up(): Promise<void>;
13
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var make_legacy_config_compatible_exports = {};
28
+ __export(make_legacy_config_compatible_exports, {
29
+ default: () => make_legacy_config_compatible_default
30
+ });
31
+ module.exports = __toCommonJS(make_legacy_config_compatible_exports);
32
+ var import_server = require("@nocobase/server");
33
+ class make_legacy_config_compatible_default extends import_server.Migration {
34
+ appVersion = "<1.0.0-alpha.15";
35
+ async up() {
36
+ const { db } = this.context;
37
+ const NodeRepo = db.getRepository("flow_nodes");
38
+ await db.sequelize.transaction(async (transaction) => {
39
+ const nodes = await NodeRepo.find({
40
+ filter: {
41
+ type: "request"
42
+ },
43
+ transaction
44
+ });
45
+ await nodes.reduce(
46
+ (promise, node) => promise.then(() => {
47
+ node.set("config", { ...node.config, onlyData: true });
48
+ node.changed("config", true);
49
+ return node.save({
50
+ silent: true,
51
+ transaction
52
+ });
53
+ }),
54
+ Promise.resolve()
55
+ );
56
+ });
57
+ }
58
+ }
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.14",
7
+ "version": "1.0.0-alpha.16",
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": "829078819e5b9720a4c2501c340a301315c0d029",
27
+ "gitHead": "2a80f1804e0f0972d40e1a201310b192914849d0",
28
28
  "keywords": [
29
29
  "Workflow"
30
30
  ]