@pxp-nd/flow 1.1.23 → 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,17 +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) {
|
|
45
|
-
|
|
47
|
+
var _a;
|
|
48
|
+
console.log("viene al nodeInstance");
|
|
46
49
|
//https://lodash.com/docs/4.17.15#template
|
|
47
50
|
lodash_1.default.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
|
|
48
51
|
//todo after this we need to get the json variables and execute the view and conditions configured in the database
|
|
49
52
|
const { node, flowInstance, eventNode } = params;
|
|
50
|
-
console.log("RecursiveInstance flow-nd---> node:", node);
|
|
51
53
|
try {
|
|
52
54
|
const executeView = `select * from ${flowInstance.originName} where ${flowInstance.originKey} = ${flowInstance.dataId}`;
|
|
53
55
|
const resExecuteView = await (0, core_1.__)((0, typeorm_1.getManager)().query(executeView));
|
|
54
56
|
const resultFromOrigin = resExecuteView[0];
|
|
55
|
-
console.log("**** resultFromOrigin:", resultFromOrigin);
|
|
56
57
|
//let mergeJson = {};
|
|
57
58
|
let mergeJson = {};
|
|
58
59
|
const { actionConfigJson, action: { configJsonTemplate, actionType: { schemaJson }, }, } = node;
|
|
@@ -70,7 +71,6 @@ let NodeInstance = class NodeInstance extends core_1.Controller {
|
|
|
70
71
|
nodeId: node.nodeId
|
|
71
72
|
}
|
|
72
73
|
};
|
|
73
|
-
console.log("--->>>mergeJson::", mergeJson);
|
|
74
74
|
}
|
|
75
75
|
let nodeInstance = new NodeInstance_1.default();
|
|
76
76
|
nodeInstance.flowInstanceId = flowInstance.flowInstanceId;
|
|
@@ -90,19 +90,31 @@ let NodeInstance = class NodeInstance extends core_1.Controller {
|
|
|
90
90
|
const data = "";
|
|
91
91
|
const res = await manager.save(NodeInstance_1.default, nodeInstance);
|
|
92
92
|
const nodeInstanceId = res.nodeInstanceId;
|
|
93
|
-
console.log("el id q tenemos q mandarrrrrr:::", nodeInstanceId);
|
|
94
93
|
if (nodeInstanceId) {
|
|
95
94
|
mergeJson.nodeInstanceId = nodeInstanceId;
|
|
96
95
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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 } }));
|