@pxp-nd/flow 1.0.57 → 1.0.59

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.
@@ -90,6 +90,7 @@ let Flow = class Flow extends core_1.Controller {
90
90
  Object.assign(newFlow, flowToCopy);
91
91
  newFlow.name = params.name;
92
92
  newFlow.description = params.description;
93
+ newFlow.status = 'off';
93
94
  const insertNewFlow = await (0, core_1.__)(manager.save(Flow_1.default, newFlow));
94
95
  // create the nodes
95
96
  // get the first node "the trigger node"
@@ -152,7 +153,8 @@ let Flow = class Flow extends core_1.Controller {
152
153
  ...flowData,
153
154
  flowId: undefined,
154
155
  nodes: [],
155
- createdAt: undefined
156
+ createdAt: undefined,
157
+ status: 'off'
156
158
  };
157
159
  let flowDataClone;
158
160
  //if we have a vendoId as parameter the origin is a template
@@ -16,5 +16,7 @@ import { EntityManager } from 'typeorm';
16
16
  import { Controller } from '@pxp-nd/core';
17
17
  declare class FlowInstance extends Controller {
18
18
  processPending(params: Record<string, any>, manager: EntityManager): Promise<unknown>;
19
+ eventProcesss(manager: EntityManager): Promise<void>;
20
+ checkConditions(viewData: Record<string, any>, flowId: number, actionId: number): Promise<boolean>;
19
21
  }
20
22
  export default FlowInstance;
@@ -33,6 +33,10 @@ const common_1 = require("@pxp-nd/common");
33
33
  const NodeInstance_1 = __importDefault(require("./NodeInstance"));
34
34
  const NodeInstance_2 = __importDefault(require("../entity/NodeInstance"));
35
35
  const Node_1 = __importDefault(require("../entity/Node"));
36
+ const Event_1 = __importDefault(require("../entity/Event"));
37
+ const Flow_1 = __importDefault(require("../entity/Flow"));
38
+ const Action_1 = __importDefault(require("../entity/Action"));
39
+ const FlowLog_1 = __importDefault(require("../entity/FlowLog"));
36
40
  class FlowInstance extends core_1.Controller {
37
41
  async processPending(params, manager) {
38
42
  const flag = await common_1.GlobalData.findOne({ data: 'wf_processing_pending_flows_flag' });
@@ -44,14 +48,15 @@ class FlowInstance extends core_1.Controller {
44
48
  let flowInstanceIdProcessing = -1;
45
49
  await (0, typeorm_1.getManager)().save(flag);
46
50
  try {
51
+ await this.eventProcesss(manager);
47
52
  const maxFlows = await common_1.GlobalData.findOne({ data: 'wf_max_concurrent_flows_process' });
48
- const flowInstances = await FlowInstance_1.default.find({ take: (maxFlows && maxFlows.value), where: [{ status: 'pending' }], order: { flowInstanceId: "ASC" } });
53
+ const flowInstances = await manager.find(FlowInstance_1.default, { take: (maxFlows && maxFlows.value), where: [{ status: 'pending' }], order: { flowInstanceId: "ASC" } });
49
54
  for (const flowInstance of flowInstances) {
50
55
  flowInstanceIdProcessing = flowInstance.flowInstanceId;
51
56
  const node = await Node_1.default.findOne({ where: { actionId: flowInstance.actionId, flowId: flowInstance.flowId } });
52
57
  const CNodeInstance = new NodeInstance_1.default('flow-nd', NodeInstance_2.default);
53
58
  try {
54
- await CNodeInstance.RecursiveInstance({ node, flowInstance });
59
+ await CNodeInstance.RecursiveInstance({ node, flowInstance }, manager);
55
60
  await manager.update(FlowInstance_1.default, { flowInstanceId: flowInstance.flowInstanceId }, { status: 'processed' });
56
61
  }
57
62
  catch (error) {
@@ -64,6 +69,11 @@ class FlowInstance extends core_1.Controller {
64
69
  catch (error) {
65
70
  flag.value = 'false';
66
71
  await (0, typeorm_1.getManager)().save(flag);
72
+ const log = new FlowLog_1.default();
73
+ log.errorCustomMessage = `Error executing ${flowInstanceIdProcessing} in FlowInstance-> processPending `;
74
+ log.errorMessage = error.message;
75
+ log.stackTrace = error.stack || '';
76
+ (0, typeorm_1.getManager)().save(log);
67
77
  throw new core_1.PxpError(400, 'Error processing flow: ' + flowInstanceIdProcessing);
68
78
  }
69
79
  flag.value = 'false';
@@ -71,6 +81,60 @@ class FlowInstance extends core_1.Controller {
71
81
  }
72
82
  return { success: true };
73
83
  }
84
+ async eventProcesss(manager) {
85
+ const pendingEvents = await Event_1.default.find({ status: 'pending' });
86
+ for (const newEvent of pendingEvents) {
87
+ const node = await (0, core_1.__)(Node_1.default.find({ where: { actionId: newEvent.actionId, isActive: 1 } }));
88
+ newEvent.status = 'processed';
89
+ await (0, typeorm_1.getManager)().save(newEvent);
90
+ try {
91
+ for (const n of node) {
92
+ //get data of view
93
+ const { action: { originName, originKey }, } = n;
94
+ const executeView = `select * from ${originName} where ${originKey} = ${newEvent.dataId}`;
95
+ const resExecuteView = await (0, typeorm_1.getManager)().query(executeView);
96
+ const flow = await (0, core_1.__)(Flow_1.default.findOne({ where: { flowId: n.flowId, isActive: 1, status: 'on' } }));
97
+ if (flow && flow.vendorId == resExecuteView[0].vendor_id &&
98
+ (await this.checkConditions(resExecuteView[0], n.flowId, newEvent.actionId))) {
99
+ //now check all conditions
100
+ let flowInstance = new FlowInstance_1.default();
101
+ flowInstance.flowId = n.flowId;
102
+ flowInstance.dataId = newEvent.dataId;
103
+ flowInstance.originName = originName;
104
+ flowInstance.originKey = originKey;
105
+ flowInstance.actionId = newEvent.actionId;
106
+ flowInstance.status = "pending";
107
+ flowInstance = await manager.save(FlowInstance_1.default, flowInstance);
108
+ }
109
+ }
110
+ }
111
+ catch (error) {
112
+ const log = new FlowLog_1.default();
113
+ log.errorCustomMessage = `Error processing event ${newEvent.eventId} in FlowInstance-> eventProcesss `;
114
+ log.errorMessage = error.message;
115
+ log.stackTrace = error.stack || '';
116
+ (0, typeorm_1.getManager)().save(log);
117
+ }
118
+ }
119
+ }
120
+ async checkConditions(viewData, flowId, actionId) {
121
+ const action = await Action_1.default.findOne(actionId);
122
+ const node = await Node_1.default.findOne({ where: { actionId, flowId, isActive: 1 } });
123
+ let res = true;
124
+ if (node && action.eventConfig && node.actionConfigJson) {
125
+ const eventConfig = JSON.parse(action.eventConfig);
126
+ const actionConfigJson = JSON.parse(node.actionConfigJson);
127
+ if (eventConfig.filters) {
128
+ eventConfig.filters.forEach((filter) => {
129
+ if (actionConfigJson[filter.nodeField] &&
130
+ viewData[filter.originField] != actionConfigJson[filter.nodeField]) {
131
+ res = false;
132
+ }
133
+ });
134
+ }
135
+ }
136
+ return res;
137
+ }
74
138
  }
75
139
  __decorate([
76
140
  (0, core_1.Post)(),
@@ -15,7 +15,7 @@
15
15
  import { EntityManager } from "typeorm";
16
16
  import { Controller } from "@pxp-nd/core";
17
17
  declare class NodeInstance extends Controller {
18
- RecursiveInstance(params: Record<string, any>): Promise<unknown>;
18
+ RecursiveInstance(params: Record<string, any>, manager: EntityManager): Promise<unknown>;
19
19
  ProcessDelay(params: Record<string, any>, manager: EntityManager): Promise<unknown>;
20
20
  }
21
21
  export default NodeInstance;
@@ -32,6 +32,7 @@ const core_1 = require("@pxp-nd/core");
32
32
  const NodeConnection_1 = __importDefault(require("../entity/NodeConnection"));
33
33
  const NodeInstance_1 = __importDefault(require("../entity/NodeInstance"));
34
34
  const Node_1 = __importDefault(require("../entity/Node"));
35
+ const FlowLog_1 = __importDefault(require("../entity/FlowLog"));
35
36
  const axios_1 = __importDefault(require("axios"));
36
37
  const ActionType_1 = __importDefault(require("../entity/ActionType"));
37
38
  const Action_1 = __importDefault(require("../entity/Action"));
@@ -40,70 +41,79 @@ const FlowInstance_1 = __importDefault(require("../entity/FlowInstance"));
40
41
  //TODO replace this flow-nd need tobe independent library
41
42
  const common_1 = require("@pxp-nd/common");
42
43
  let NodeInstance = class NodeInstance extends core_1.Controller {
43
- async RecursiveInstance(params) {
44
+ async RecursiveInstance(params, manager) {
44
45
  //https://lodash.com/docs/4.17.15#template
45
46
  lodash_1.default.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
46
47
  //todo after this we need to get the json variables and execute the view and conditions configured in the database
47
48
  const { node, flowInstance, eventNode } = params;
48
- const executeView = `select * from ${flowInstance.originName} where ${flowInstance.originKey} = ${flowInstance.dataId}`;
49
- const resExecuteView = await (0, core_1.__)((0, typeorm_1.getManager)().query(executeView));
50
- const resultFromOrigin = resExecuteView[0];
51
- let mergeJson = {};
52
- const { actionConfigJson, action: { configJsonTemplate, actionType: { schemaJson }, }, } = node;
53
- if (configJsonTemplate !== "" || actionConfigJson !== "") {
54
- const actionConfigJsonObject = actionConfigJson &&
55
- JSON.parse(lodash_1.default.template(actionConfigJson)(resultFromOrigin));
56
- const configJsonTemplateObject = configJsonTemplate &&
57
- JSON.parse(lodash_1.default.template(configJsonTemplate)(resultFromOrigin));
58
- mergeJson = {
59
- ...(configJsonTemplateObject || {}),
60
- ...(actionConfigJsonObject || {}),
61
- __resultFromOrigin: resultFromOrigin,
62
- };
63
- }
64
- let nodeInstance = new NodeInstance_1.default();
65
- nodeInstance.flowInstanceId = flowInstance.flowInstanceId;
66
- // @ts-ignore
67
- nodeInstance.nodeId = node.nodeId;
68
- nodeInstance.runTime = new Date();
69
- if (node.action.actionType.isDelay === "Y") {
70
- const delay = node.delay;
71
- const typeDelay = node.typeDelay;
72
- nodeInstance.schedule = (0, moment_1.default)().add(delay, typeDelay).toDate();
73
- nodeInstance.status = "WAIT";
74
- await (0, typeorm_1.getManager)().save(NodeInstance_1.default, nodeInstance);
75
- }
76
- else {
77
- if (node.action.actionType.controller) {
78
- const data = "";
79
- const config = {
80
- method: "post",
81
- url: `http://localhost:${process.env.PORT}/api/${node.action.actionType.controller}`,
82
- headers: {
83
- Authorization: "" + process.env.TOKEN_PXP_ND + "",
84
- "Content-Type": "application/json",
85
- },
86
- data: mergeJson,
49
+ try {
50
+ const executeView = `select * from ${flowInstance.originName} where ${flowInstance.originKey} = ${flowInstance.dataId}`;
51
+ const resExecuteView = await (0, core_1.__)((0, typeorm_1.getManager)().query(executeView));
52
+ const resultFromOrigin = resExecuteView[0];
53
+ let mergeJson = {};
54
+ const { actionConfigJson, action: { configJsonTemplate, actionType: { schemaJson }, }, } = node;
55
+ if (configJsonTemplate !== "" || actionConfigJson !== "") {
56
+ const actionConfigJsonObject = actionConfigJson &&
57
+ JSON.parse(lodash_1.default.template(actionConfigJson)(resultFromOrigin));
58
+ const configJsonTemplateObject = configJsonTemplate &&
59
+ JSON.parse(lodash_1.default.template(configJsonTemplate)(resultFromOrigin));
60
+ mergeJson = {
61
+ ...(configJsonTemplateObject || {}),
62
+ ...(actionConfigJsonObject || {}),
63
+ __resultFromOrigin: resultFromOrigin,
87
64
  };
88
- // @ts-ignore
89
- const resControllerAxios = await (0, core_1.__)((0, axios_1.default)(config));
90
65
  }
91
- await (0, typeorm_1.getManager)().save(NodeInstance_1.default, nodeInstance);
66
+ let nodeInstance = new NodeInstance_1.default();
67
+ nodeInstance.flowInstanceId = flowInstance.flowInstanceId;
92
68
  // @ts-ignore
93
- const nodeConnectionList = await (0, core_1.__)(NodeConnection_1.default.find({ where: { nodeIdMaster: node.nodeId } }));
94
- for (const nodeConnection of nodeConnectionList) {
95
- const condition = lodash_1.default.template(nodeConnection.condition)(resultFromOrigin);
96
- const evalCondition = eval(condition);
97
- if (evalCondition) {
98
- const nodeRes = await (0, core_1.__)(Node_1.default.findOne(nodeConnection.nodeIdChild));
99
- await this.RecursiveInstance({
100
- node: nodeRes,
101
- flowInstance,
102
- resultFromOrigin,
103
- });
69
+ nodeInstance.nodeId = node.nodeId;
70
+ nodeInstance.runTime = new Date();
71
+ if (node.action.actionType.isDelay === "Y") {
72
+ const delay = node.delay;
73
+ const typeDelay = node.typeDelay;
74
+ nodeInstance.schedule = (0, moment_1.default)().add(delay, typeDelay).toDate();
75
+ nodeInstance.status = "WAIT";
76
+ await manager.save(NodeInstance_1.default, nodeInstance);
77
+ }
78
+ else {
79
+ if (node.action.actionType.controller) {
80
+ const data = "";
81
+ const config = {
82
+ method: "post",
83
+ url: `http://localhost:${process.env.PORT}/api/${node.action.actionType.controller}`,
84
+ headers: {
85
+ Authorization: "" + process.env.TOKEN_PXP_ND + "",
86
+ "Content-Type": "application/json",
87
+ },
88
+ data: mergeJson,
89
+ };
90
+ // @ts-ignore
91
+ const resControllerAxios = await (0, core_1.__)((0, axios_1.default)(config));
92
+ }
93
+ await manager.save(NodeInstance_1.default, nodeInstance);
94
+ // @ts-ignore
95
+ const nodeConnectionList = await (0, core_1.__)(NodeConnection_1.default.find({ where: { nodeIdMaster: node.nodeId } }));
96
+ for (const nodeConnection of nodeConnectionList) {
97
+ const condition = lodash_1.default.template(nodeConnection.condition)(resultFromOrigin);
98
+ const evalCondition = eval(condition);
99
+ if (evalCondition) {
100
+ const nodeRes = await (0, core_1.__)(Node_1.default.findOne(nodeConnection.nodeIdChild));
101
+ await this.RecursiveInstance({
102
+ node: nodeRes,
103
+ flowInstance,
104
+ resultFromOrigin,
105
+ }, manager);
106
+ }
104
107
  }
105
108
  }
106
109
  }
110
+ catch (error) {
111
+ const log = new FlowLog_1.default();
112
+ log.errorCustomMessage = `Error executing ${flowInstance.flowInstanceId} in NodeInstance-> RecursiveInstance `;
113
+ log.errorMessage = error.message;
114
+ log.stackTrace = error.stack || '';
115
+ (0, typeorm_1.getManager)().save(log);
116
+ }
107
117
  return {};
108
118
  }
109
119
  async ProcessDelay(params, manager) {
@@ -150,7 +160,7 @@ let NodeInstance = class NodeInstance extends core_1.Controller {
150
160
  node: nodeRes,
151
161
  flowInstance,
152
162
  resultFromOrigin,
153
- });
163
+ }, manager);
154
164
  //update status from wait to executed
155
165
  await (0, core_1.__)(manager.update(NodeInstance_1.default, nodeInstance.nodeInstanceId, {
156
166
  status: "EXECUTED",
@@ -5,5 +5,6 @@ export default class Event extends PxpEntity {
5
5
  actionId: number;
6
6
  descJobName: string;
7
7
  dataId: number;
8
+ status: string;
8
9
  action: Action;
9
10
  }
@@ -33,6 +33,10 @@ __decorate([
33
33
  (0, typeorm_1.Column)({ name: 'data_id', type: 'int', nullable: false }),
34
34
  __metadata("design:type", Number)
35
35
  ], Event.prototype, "dataId", void 0);
36
+ __decorate([
37
+ (0, typeorm_1.Column)({ name: 'status', type: 'varchar', length: 30, nullable: false, default: 'pending' }),
38
+ __metadata("design:type", String)
39
+ ], Event.prototype, "status", void 0);
36
40
  __decorate([
37
41
  (0, typeorm_1.ManyToOne)(() => Action_1.default, action => action.nodes),
38
42
  (0, typeorm_1.JoinColumn)({ name: 'action_id' }),
@@ -0,0 +1,7 @@
1
+ import { PxpEntity } from '@pxp-nd/common';
2
+ export default class Action extends PxpEntity {
3
+ flowLogId: number;
4
+ errorCustomMessage: string;
5
+ errorMessage: string;
6
+ stackTrace: string;
7
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const typeorm_1 = require("typeorm");
13
+ const common_1 = require("@pxp-nd/common");
14
+ let Action = class Action extends common_1.PxpEntity {
15
+ };
16
+ __decorate([
17
+ (0, typeorm_1.PrimaryGeneratedColumn)({ name: 'flow_log_id' }),
18
+ __metadata("design:type", Number)
19
+ ], Action.prototype, "flowLogId", void 0);
20
+ __decorate([
21
+ (0, typeorm_1.Column)({ name: 'error_custom_message', type: 'varchar', nullable: false, length: 2000 }),
22
+ __metadata("design:type", String)
23
+ ], Action.prototype, "errorCustomMessage", void 0);
24
+ __decorate([
25
+ (0, typeorm_1.Column)({ name: 'error_message', type: 'varchar', nullable: false, length: 2000 }),
26
+ __metadata("design:type", String)
27
+ ], Action.prototype, "errorMessage", void 0);
28
+ __decorate([
29
+ (0, typeorm_1.Column)({ type: 'text', nullable: false }),
30
+ __metadata("design:type", String)
31
+ ], Action.prototype, "stackTrace", void 0);
32
+ Action = __decorate([
33
+ (0, typeorm_1.Entity)({ name: 'twf_action' })
34
+ ], Action);
35
+ exports.default = Action;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export * from './entity';
2
2
  export * from './controllers';
3
- export * from './subscribers';
package/dist/index.js CHANGED
@@ -16,4 +16,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./entity"), exports);
18
18
  __exportStar(require("./controllers"), exports);
19
- __exportStar(require("./subscribers"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pxp-nd/flow",
3
- "version": "1.0.57",
3
+ "version": "1.0.59",
4
4
  "description": "Workflow module for pxp-nd framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,21 +0,0 @@
1
- /**
2
- * Kplian 2021
3
- *
4
- * MIT
5
- *
6
- * Member Controller
7
- *
8
- * @summary Event Subscriber
9
- * @author Favio Figueroa
10
- * Jaime Rivera
11
- *
12
- * Created at : 2021-07-08 12:55:38
13
- * Last modified :
14
- */
15
- import { EntitySubscriberInterface, InsertEvent } from "typeorm";
16
- import EventModel from "../entity/Event";
17
- export declare class Event implements EntitySubscriberInterface<EventModel> {
18
- listenTo(): typeof EventModel;
19
- afterInsert(event: InsertEvent<EventModel>): Promise<void>;
20
- checkConditions(viewData: Record<string, any>, flowId: number, actionId: number): Promise<boolean>;
21
- }
@@ -1,84 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __importDefault = (this && this.__importDefault) || function (mod) {
9
- return (mod && mod.__esModule) ? mod : { "default": mod };
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Event = void 0;
13
- /**
14
- * Kplian 2021
15
- *
16
- * MIT
17
- *
18
- * Member Controller
19
- *
20
- * @summary Event Subscriber
21
- * @author Favio Figueroa
22
- * Jaime Rivera
23
- *
24
- * Created at : 2021-07-08 12:55:38
25
- * Last modified :
26
- */
27
- const typeorm_1 = require("typeorm");
28
- const Event_1 = __importDefault(require("../entity/Event"));
29
- const Node_1 = __importDefault(require("../entity/Node"));
30
- const Action_1 = __importDefault(require("../entity/Action"));
31
- const Flow_1 = __importDefault(require("../entity/Flow"));
32
- const core_1 = require("@pxp-nd/core");
33
- const FlowInstance_1 = __importDefault(require("../entity/FlowInstance"));
34
- let Event = class Event {
35
- listenTo() {
36
- return Event_1.default;
37
- }
38
- async afterInsert(event) {
39
- //todo investigate replace variables into condition
40
- const newEvent = event.entity;
41
- const node = await (0, core_1.__)(Node_1.default.find({ where: { actionId: newEvent.actionId, isActive: 1 } }));
42
- for (const n of node) {
43
- //get data of view
44
- const { action: { originName, originKey }, } = n;
45
- const executeView = `select * from ${originName} where ${originKey} = ${newEvent.dataId}`;
46
- const resExecuteView = await (0, typeorm_1.getManager)().query(executeView);
47
- const flow = await (0, core_1.__)(Flow_1.default.findOne({ where: { flowId: n.flowId, isActive: 1, status: 'active' } }));
48
- if (flow && flow.vendorId == resExecuteView[0].vendor_id &&
49
- (await this.checkConditions(resExecuteView[0], n.flowId, newEvent.actionId))) {
50
- //now check all conditions
51
- let flowInstance = new FlowInstance_1.default();
52
- flowInstance.flowId = n.flowId;
53
- flowInstance.dataId = newEvent.dataId;
54
- flowInstance.originName = originName;
55
- flowInstance.originKey = originKey;
56
- flowInstance.actionId = newEvent.actionId;
57
- flowInstance.status = "pending";
58
- flowInstance = await event.manager.save(FlowInstance_1.default, flowInstance);
59
- }
60
- }
61
- }
62
- async checkConditions(viewData, flowId, actionId) {
63
- const action = await Action_1.default.findOne(actionId);
64
- const node = await Node_1.default.findOne({ where: { actionId, flowId, isActive: 1 } });
65
- let res = true;
66
- if (node && action.eventConfig && node.actionConfigJson) {
67
- const eventConfig = JSON.parse(action.eventConfig);
68
- const actionConfigJson = JSON.parse(node.actionConfigJson);
69
- if (eventConfig.filters) {
70
- eventConfig.filters.forEach((filter) => {
71
- if (actionConfigJson[filter.nodeField] &&
72
- viewData[filter.originField] != actionConfigJson[filter.nodeField]) {
73
- res = false;
74
- }
75
- });
76
- }
77
- }
78
- return res;
79
- }
80
- };
81
- Event = __decorate([
82
- (0, typeorm_1.EventSubscriber)()
83
- ], Event);
84
- exports.Event = Event;
@@ -1,3 +0,0 @@
1
- import { Event as EventSubscriber } from './Event';
2
- export { EventSubscriber };
3
- export declare const subscribers: (typeof EventSubscriber)[];
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.subscribers = exports.EventSubscriber = void 0;
4
- const Event_1 = require("./Event");
5
- Object.defineProperty(exports, "EventSubscriber", { enumerable: true, get: function () { return Event_1.Event; } });
6
- exports.subscribers = [Event_1.Event];