@pxp-nd/flow 1.0.35 → 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,7 +36,6 @@ 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
41
|
const node = await core_1.__(Node_1.default.find({ where: { actionId: newEvent.actionId, isActive: 1 } }));
|
|
@@ -46,7 +45,7 @@ let Event = class Event {
|
|
|
46
45
|
const executeView = `select * from ${originName} where ${originKey} = ${newEvent.dataId}`;
|
|
47
46
|
const resExecuteView = await typeorm_1.getManager().query(executeView);
|
|
48
47
|
const flow = await core_1.__(Flow_1.default.findOne({ where: { flowId: n.flowId, isActive: 1 } }));
|
|
49
|
-
if (flow.vendorId == resExecuteView[0].vendor_id &&
|
|
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) {
|