@pxp-nd/flow 1.1.24 → 1.1.25

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.
@@ -11,6 +11,8 @@
11
11
  *
12
12
  * Created at : 2021-07-08 12:55:38
13
13
  * Last modified :
14
+ * ISSUE DATE AUTHOR DESCRIPTION
15
+ * 25-Apr-2025 8914754251 Mercedes Zambrana Validate and use node?.action?.controllerFunction
14
16
  */
15
17
  import { EntityManager } from "typeorm";
16
18
  import { Controller } from "@pxp-nd/core";
@@ -12,6 +12,8 @@
12
12
  *
13
13
  * Created at : 2021-07-08 12:55:38
14
14
  * Last modified :
15
+ * ISSUE DATE AUTHOR DESCRIPTION
16
+ * 25-Apr-2025 8914754251 Mercedes Zambrana Validate and use node?.action?.controllerFunction
15
17
  */
16
18
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
17
19
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -42,16 +44,16 @@ const FlowInstance_1 = __importDefault(require("../entity/FlowInstance"));
42
44
  const common_1 = require("@pxp-nd/common");
43
45
  let NodeInstance = class NodeInstance extends core_1.Controller {
44
46
  async RecursiveInstance(params, manager) {
47
+ var _a;
48
+ console.log("viene al nodeInstance");
45
49
  //https://lodash.com/docs/4.17.15#template
46
50
  lodash_1.default.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
47
51
  //todo after this we need to get the json variables and execute the view and conditions configured in the database
48
52
  const { node, flowInstance, eventNode } = params;
49
- console.log("RecursiveInstance flow-nd---> node:", node);
50
53
  try {
51
54
  const executeView = `select * from ${flowInstance.originName} where ${flowInstance.originKey} = ${flowInstance.dataId}`;
52
55
  const resExecuteView = await (0, core_1.__)((0, typeorm_1.getManager)().query(executeView));
53
56
  const resultFromOrigin = resExecuteView[0];
54
- console.log("**** resultFromOrigin:", resultFromOrigin);
55
57
  //let mergeJson = {};
56
58
  let mergeJson = {};
57
59
  const { actionConfigJson, action: { configJsonTemplate, actionType: { schemaJson }, }, } = node;
@@ -69,7 +71,6 @@ let NodeInstance = class NodeInstance extends core_1.Controller {
69
71
  nodeId: node.nodeId
70
72
  }
71
73
  };
72
- console.log("--->>>mergeJson::", mergeJson);
73
74
  }
74
75
  let nodeInstance = new NodeInstance_1.default();
75
76
  nodeInstance.flowInstanceId = flowInstance.flowInstanceId;
@@ -89,20 +90,31 @@ let NodeInstance = class NodeInstance extends core_1.Controller {
89
90
  const data = "";
90
91
  const res = await manager.save(NodeInstance_1.default, nodeInstance);
91
92
  const nodeInstanceId = res.nodeInstanceId;
92
- console.log("el id q tenemos q mandarrrrrr:::", nodeInstanceId);
93
93
  if (nodeInstanceId) {
94
94
  mergeJson.nodeInstanceId = nodeInstanceId;
95
95
  }
96
- console.log("ladata q se manda para el correo::", mergeJson);
97
- const config = {
98
- method: "post",
99
- url: `http://localhost:${process.env.PORT}/api/${node.action.actionType.controller}`,
100
- headers: {
101
- Authorization: "" + process.env.TOKEN_PXP_ND + "",
102
- "Content-Type": "application/json",
103
- },
104
- data: mergeJson,
105
- };
96
+ if (!!((_a = node === null || node === void 0 ? void 0 : node.action) === null || _a === void 0 ? void 0 : _a.controllerFunction)) {
97
+ const config = {
98
+ method: "post",
99
+ url: `http://localhost:${process.env.PORT}/api/${node.action.controllerFunction}`,
100
+ headers: {
101
+ Authorization: "" + process.env.TOKEN_PXP_ND + "",
102
+ "Content-Type": "application/json",
103
+ },
104
+ data: mergeJson,
105
+ };
106
+ }
107
+ else {
108
+ const config = {
109
+ method: "post",
110
+ url: `http://localhost:${process.env.PORT}/api/${node.action.actionType.controller}`,
111
+ headers: {
112
+ Authorization: "" + process.env.TOKEN_PXP_ND + "",
113
+ "Content-Type": "application/json",
114
+ },
115
+ data: mergeJson,
116
+ };
117
+ }
106
118
  // @ts-ignore
107
119
  const resControllerAxios = await (0, core_1.__)((0, axios_1.default)(config));
108
120
  if ('data' in resControllerAxios && resControllerAxios.data) {
@@ -112,7 +124,6 @@ let NodeInstance = class NodeInstance extends core_1.Controller {
112
124
  await manager.save(NodeInstance_1.default, nodeInstance);
113
125
  }
114
126
  }
115
- console.log("la respuesta del Axiossss:", resControllerAxios.data);
116
127
  }
117
128
  // @ts-ignore
118
129
  const nodeConnectionList = await (0, core_1.__)(NodeConnection_1.default.find({ where: { nodeIdMaster: node.nodeId } }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pxp-nd/flow",
3
- "version": "1.1.24",
3
+ "version": "1.1.25",
4
4
  "description": "Workflow module for pxp-nd framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",