@pxp-nd/flow 1.1.24 → 1.1.26

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,15 @@ 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;
45
48
  //https://lodash.com/docs/4.17.15#template
46
49
  lodash_1.default.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
47
50
  //todo after this we need to get the json variables and execute the view and conditions configured in the database
48
51
  const { node, flowInstance, eventNode } = params;
49
- console.log("RecursiveInstance flow-nd---> node:", node);
50
52
  try {
51
53
  const executeView = `select * from ${flowInstance.originName} where ${flowInstance.originKey} = ${flowInstance.dataId}`;
52
54
  const resExecuteView = await (0, core_1.__)((0, typeorm_1.getManager)().query(executeView));
53
55
  const resultFromOrigin = resExecuteView[0];
54
- console.log("**** resultFromOrigin:", resultFromOrigin);
55
56
  //let mergeJson = {};
56
57
  let mergeJson = {};
57
58
  const { actionConfigJson, action: { configJsonTemplate, actionType: { schemaJson }, }, } = node;
@@ -69,7 +70,6 @@ let NodeInstance = class NodeInstance extends core_1.Controller {
69
70
  nodeId: node.nodeId
70
71
  }
71
72
  };
72
- console.log("--->>>mergeJson::", mergeJson);
73
73
  }
74
74
  let nodeInstance = new NodeInstance_1.default();
75
75
  nodeInstance.flowInstanceId = flowInstance.flowInstanceId;
@@ -89,30 +89,47 @@ let NodeInstance = class NodeInstance extends core_1.Controller {
89
89
  const data = "";
90
90
  const res = await manager.save(NodeInstance_1.default, nodeInstance);
91
91
  const nodeInstanceId = res.nodeInstanceId;
92
- console.log("el id q tenemos q mandarrrrrr:::", nodeInstanceId);
93
92
  if (nodeInstanceId) {
94
93
  mergeJson.nodeInstanceId = nodeInstanceId;
95
94
  }
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
- };
106
- // @ts-ignore
107
- const resControllerAxios = await (0, core_1.__)((0, axios_1.default)(config));
108
- if ('data' in resControllerAxios && resControllerAxios.data) {
109
- const response = resControllerAxios.data;
110
- if ('tokenId' in response && response.tokenId) {
111
- nodeInstance.extraArgs = { tokenId: response.tokenId };
112
- await manager.save(NodeInstance_1.default, nodeInstance);
95
+ if (!!((_a = node === null || node === void 0 ? void 0 : node.action) === null || _a === void 0 ? void 0 : _a.controllerFunction)) {
96
+ const config = {
97
+ method: "post",
98
+ url: `http://localhost:${process.env.PORT}/api/${node.action.controllerFunction}`,
99
+ headers: {
100
+ Authorization: "" + process.env.TOKEN_PXP_ND + "",
101
+ "Content-Type": "application/json",
102
+ },
103
+ data: mergeJson,
104
+ };
105
+ const resControllerAxios = await (0, core_1.__)((0, axios_1.default)(config));
106
+ if ('data' in resControllerAxios && resControllerAxios.data) {
107
+ const response = resControllerAxios.data;
108
+ if ('tokenId' in response && response.tokenId) {
109
+ nodeInstance.extraArgs = { tokenId: response.tokenId };
110
+ await manager.save(NodeInstance_1.default, nodeInstance);
111
+ }
112
+ }
113
+ }
114
+ else {
115
+ const config = {
116
+ method: "post",
117
+ url: `http://localhost:${process.env.PORT}/api/${node.action.actionType.controller}`,
118
+ headers: {
119
+ Authorization: "" + process.env.TOKEN_PXP_ND + "",
120
+ "Content-Type": "application/json",
121
+ },
122
+ data: mergeJson,
123
+ };
124
+ const resControllerAxios = await (0, core_1.__)((0, axios_1.default)(config));
125
+ if ('data' in resControllerAxios && resControllerAxios.data) {
126
+ const response = resControllerAxios.data;
127
+ if ('tokenId' in response && response.tokenId) {
128
+ nodeInstance.extraArgs = { tokenId: response.tokenId };
129
+ await manager.save(NodeInstance_1.default, nodeInstance);
130
+ }
113
131
  }
114
132
  }
115
- console.log("la respuesta del Axiossss:", resControllerAxios.data);
116
133
  }
117
134
  // @ts-ignore
118
135
  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.26",
4
4
  "description": "Workflow module for pxp-nd framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",