@pxp-nd/flow 1.0.34 → 1.0.36

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.
@@ -36,17 +36,16 @@ let Event = class Event {
36
36
  return Event_1.default;
37
37
  }
38
38
  async afterInsert(event) {
39
- console.log("entra");
40
39
  //todo investigate replace variables into condition
41
40
  const newEvent = event.entity;
42
- const node = await core_1.__(Node_1.default.find({ where: { actionId: newEvent.actionId } }));
41
+ const node = await core_1.__(Node_1.default.find({ where: { actionId: newEvent.actionId, isActive: 1 } }));
43
42
  for (const n of node) {
44
43
  //get data of view
45
44
  const { action: { originName, originKey }, } = n;
46
45
  const executeView = `select * from ${originName} where ${originKey} = ${newEvent.dataId}`;
47
46
  const resExecuteView = await typeorm_1.getManager().query(executeView);
48
- const flow = await core_1.__(Flow_1.default.findOne({ where: { flowId: n.flowId } }));
49
- if (flow.vendorId == resExecuteView[0].vendor_id &&
47
+ const flow = await core_1.__(Flow_1.default.findOne({ where: { flowId: n.flowId, isActive: 1 } }));
48
+ if (flow && flow.vendorId == resExecuteView[0].vendor_id &&
50
49
  (await this.checkConditions(resExecuteView[0], n.flowId, newEvent.actionId))) {
51
50
  //now check all conditions
52
51
  let flowInstance = new FlowInstance_1.default();
@@ -62,9 +61,9 @@ let Event = class Event {
62
61
  }
63
62
  async checkConditions(viewData, flowId, actionId) {
64
63
  const action = await Action_1.default.findOne(actionId);
65
- const node = await Node_1.default.findOne({ where: { actionId, flowId } });
64
+ const node = await Node_1.default.findOne({ where: { actionId, flowId, isActive: 1 } });
66
65
  let res = true;
67
- if (action.eventConfig && node.actionConfigJson) {
66
+ if (node && action.eventConfig && node.actionConfigJson) {
68
67
  const eventConfig = JSON.parse(action.eventConfig);
69
68
  const actionConfigJson = JSON.parse(node.actionConfigJson);
70
69
  if (eventConfig.filters) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pxp-nd/flow",
3
- "version": "1.0.34",
3
+ "version": "1.0.36",
4
4
  "description": "Workflow module for pxp-nd framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",