@pxp-nd/flow 1.1.22 → 1.1.23

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.
@@ -42,6 +42,7 @@ const FlowInstance_1 = __importDefault(require("../entity/FlowInstance"));
42
42
  const common_1 = require("@pxp-nd/common");
43
43
  let NodeInstance = class NodeInstance extends core_1.Controller {
44
44
  async RecursiveInstance(params, manager) {
45
+ console.log("==========node instance en MZM===========");
45
46
  //https://lodash.com/docs/4.17.15#template
46
47
  lodash_1.default.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
47
48
  //todo after this we need to get the json variables and execute the view and conditions configured in the database
@@ -52,6 +53,7 @@ let NodeInstance = class NodeInstance extends core_1.Controller {
52
53
  const resExecuteView = await (0, core_1.__)((0, typeorm_1.getManager)().query(executeView));
53
54
  const resultFromOrigin = resExecuteView[0];
54
55
  console.log("**** resultFromOrigin:", resultFromOrigin);
56
+ //let mergeJson = {};
55
57
  let mergeJson = {};
56
58
  const { actionConfigJson, action: { configJsonTemplate, actionType: { schemaJson }, }, } = node;
57
59
  if (configJsonTemplate !== "" || actionConfigJson !== "") {
@@ -86,6 +88,12 @@ let NodeInstance = class NodeInstance extends core_1.Controller {
86
88
  else {
87
89
  if (node.action.actionType.controller) {
88
90
  const data = "";
91
+ const res = await manager.save(NodeInstance_1.default, nodeInstance);
92
+ const nodeInstanceId = res.nodeInstanceId;
93
+ console.log("el id q tenemos q mandarrrrrr:::", nodeInstanceId);
94
+ if (nodeInstanceId) {
95
+ mergeJson.nodeInstanceId = nodeInstanceId;
96
+ }
89
97
  const config = {
90
98
  method: "post",
91
99
  url: `http://localhost:${process.env.PORT}/api/${node.action.actionType.controller}`,
@@ -97,8 +105,15 @@ let NodeInstance = class NodeInstance extends core_1.Controller {
97
105
  };
98
106
  // @ts-ignore
99
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);
113
+ }
114
+ }
115
+ console.log("la respuesta del Axiossss:", resControllerAxios.data);
100
116
  }
101
- await manager.save(NodeInstance_1.default, nodeInstance);
102
117
  // @ts-ignore
103
118
  const nodeConnectionList = await (0, core_1.__)(NodeConnection_1.default.find({ where: { nodeIdMaster: node.nodeId } }));
104
119
  for (const nodeConnection of nodeConnectionList) {
@@ -8,6 +8,7 @@ export default class NodeInstance extends PxpEntity {
8
8
  runTime: Date;
9
9
  schedule: Date;
10
10
  status: string;
11
+ extraArgs?: Record<string, unknown>;
11
12
  flowInstance: FlowInstance;
12
13
  node: Node;
13
14
  }
@@ -42,6 +42,10 @@ __decorate([
42
42
  (0, typeorm_1.Column)({ name: 'status', type: 'varchar', nullable: false, length: 50 }),
43
43
  __metadata("design:type", String)
44
44
  ], NodeInstance.prototype, "status", void 0);
45
+ __decorate([
46
+ (0, typeorm_1.Column)({ name: 'extra_args', type: 'json', nullable: true }),
47
+ __metadata("design:type", Object)
48
+ ], NodeInstance.prototype, "extraArgs", void 0);
45
49
  __decorate([
46
50
  (0, typeorm_1.ManyToOne)(() => FlowInstance_1.default, flowInstance => flowInstance.nodeInstances),
47
51
  (0, typeorm_1.JoinColumn)({ name: 'flow_instance_id' }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pxp-nd/flow",
3
- "version": "1.1.22",
3
+ "version": "1.1.23",
4
4
  "description": "Workflow module for pxp-nd framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",