@pxp-nd/flow 1.0.53 → 1.0.55
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.
- package/dist/controllers/Flow.d.ts +6 -0
- package/dist/controllers/Flow.js +27 -1
- package/dist/controllers/Node.js +3 -3
- package/dist/entity/Action.d.ts +1 -0
- package/dist/entity/Action.js +4 -0
- package/dist/entity/Flow.d.ts +2 -0
- package/dist/entity/Flow.js +8 -0
- package/dist/subscribers/Event.js +1 -1
- package/package.json +1 -1
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
* 08-Jul-2021 Jaime Rivera Created
|
|
12
12
|
* 18-Jul-2023 SP28JUL23 Mercedes Zambrana Add deleteFlow, saveFlowName, duplicateFlow
|
|
13
13
|
* 02-Aug-2023 SP11AUG23 Mercedes Zambrana Add validations in deleteFlow and saveFlow
|
|
14
|
+
* 15-Aug-2023 SP25AUG23 Rensi Arteaga Add logic to duplicate flows templates nadd icons
|
|
15
|
+
* 17-Aug-2023 SP25AUG23 Mercedes Zambrana Add insertEventFlow
|
|
16
|
+
* 18-Aug-2023 SP25AUG23 Mercedes Zambrana Add removeFlow
|
|
14
17
|
* ******************************************************************************
|
|
15
18
|
*/
|
|
16
19
|
import { EntityManager } from 'typeorm';
|
|
@@ -28,5 +31,8 @@ declare class Flow extends Controller {
|
|
|
28
31
|
saveFlow(params: Record<string, any>, manager: EntityManager): Promise<unknown>;
|
|
29
32
|
getFlowRender(params: Record<string, any>): Promise<unknown>;
|
|
30
33
|
sortNodesByConnections(nodes: any[], connections: any[]): any[];
|
|
34
|
+
insertEventFlow(params: Record<string, any>, manager: EntityManager): Promise<unknown>;
|
|
35
|
+
removeFlow(params: Record<string, any>, manager: EntityManager): Promise<unknown>;
|
|
36
|
+
changeStatusFlow(params: Record<string, any>, manager: EntityManager): Promise<unknown>;
|
|
31
37
|
}
|
|
32
38
|
export default Flow;
|
package/dist/controllers/Flow.js
CHANGED
|
@@ -439,7 +439,7 @@ let Flow = class Flow extends core_1.Controller {
|
|
|
439
439
|
const newNode = manager.create(Node_1.default, {
|
|
440
440
|
nodeId: undefined,
|
|
441
441
|
flowId: params.flowId,
|
|
442
|
-
isInit: '
|
|
442
|
+
isInit: 'Y',
|
|
443
443
|
actionId: params.actionId
|
|
444
444
|
});
|
|
445
445
|
const saveNode = await manager.save(newNode);
|
|
@@ -481,6 +481,23 @@ let Flow = class Flow extends core_1.Controller {
|
|
|
481
481
|
return { success: false };
|
|
482
482
|
}
|
|
483
483
|
}
|
|
484
|
+
async changeStatusFlow(params, manager) {
|
|
485
|
+
let dataFlow = await (0, core_1.__)(Flow_1.default.findOne(params.flowId));
|
|
486
|
+
if (dataFlow) {
|
|
487
|
+
if (dataFlow.status === 'draft' || dataFlow.status === 'paused') {
|
|
488
|
+
//change to active
|
|
489
|
+
dataFlow.status = 'active';
|
|
490
|
+
}
|
|
491
|
+
else if (dataFlow.status === 'active') {
|
|
492
|
+
dataFlow.status = 'paused';
|
|
493
|
+
}
|
|
494
|
+
const updFlow = await (0, core_1.__)(manager.save(dataFlow));
|
|
495
|
+
return { success: true };
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
498
|
+
return { success: false };
|
|
499
|
+
}
|
|
500
|
+
}
|
|
484
501
|
};
|
|
485
502
|
__decorate([
|
|
486
503
|
(0, core_1.Get)(),
|
|
@@ -563,6 +580,15 @@ __decorate([
|
|
|
563
580
|
__metadata("design:paramtypes", [Object, typeorm_1.EntityManager]),
|
|
564
581
|
__metadata("design:returntype", Promise)
|
|
565
582
|
], Flow.prototype, "removeFlow", null);
|
|
583
|
+
__decorate([
|
|
584
|
+
(0, core_1.Post)(),
|
|
585
|
+
(0, core_1.DbSettings)('Orm'),
|
|
586
|
+
(0, core_1.ReadOnly)(false),
|
|
587
|
+
(0, core_1.Log)(true),
|
|
588
|
+
__metadata("design:type", Function),
|
|
589
|
+
__metadata("design:paramtypes", [Object, typeorm_1.EntityManager]),
|
|
590
|
+
__metadata("design:returntype", Promise)
|
|
591
|
+
], Flow.prototype, "changeStatusFlow", null);
|
|
566
592
|
Flow = __decorate([
|
|
567
593
|
(0, core_1.Model)('flow-nd/Flow')
|
|
568
594
|
], Flow);
|
package/dist/controllers/Node.js
CHANGED
|
@@ -83,23 +83,23 @@ let Node = class Node extends core_1.Controller {
|
|
|
83
83
|
async getParameterizedNode(params, manager) {
|
|
84
84
|
lodash_1.default.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
|
|
85
85
|
const { nodeId, flowId, substitutionsSchemaJson = {} } = params;
|
|
86
|
+
const tNodeData = (0, core_1.__)(Node_1.default.findOne(nodeId));
|
|
87
|
+
const nodeData = await tNodeData;
|
|
86
88
|
const tNodeOrigin = await (0, core_1.__)(Node_1.default.findOne({
|
|
87
89
|
relations: ['action'],
|
|
88
90
|
where: {
|
|
89
|
-
flowId: flowId,
|
|
91
|
+
flowId: nodeData.flowId,
|
|
90
92
|
isInit: 'Y',
|
|
91
93
|
action: {
|
|
92
94
|
originName: (0, typeorm_1.Not)((0, typeorm_1.IsNull)())
|
|
93
95
|
}
|
|
94
96
|
}
|
|
95
97
|
}));
|
|
96
|
-
const tNodeData = (0, core_1.__)(Node_1.default.findOne(nodeId));
|
|
97
98
|
const tFieldMapData = (0, core_1.__)(manager.createQueryBuilder(FieldMap_1.default, 'fm')
|
|
98
99
|
.innerJoin(OriginName_1.default, 'on', 'on.originNameId = fm.originNameId')
|
|
99
100
|
.where("on.name = :n ", { n: tNodeOrigin.action.originName })
|
|
100
101
|
.getMany());
|
|
101
102
|
//const nodeOrigin = await tNodeOrigin; todo
|
|
102
|
-
const nodeData = await tNodeData;
|
|
103
103
|
const fieldMapData = await tFieldMapData;
|
|
104
104
|
/*const [nodeData, fieldMapData] = await Promise.all([
|
|
105
105
|
tNodeData,
|
package/dist/entity/Action.d.ts
CHANGED
package/dist/entity/Action.js
CHANGED
|
@@ -79,6 +79,10 @@ __decorate([
|
|
|
79
79
|
(0, typeorm_1.OneToMany)(() => Node_1.default, eventNode => eventNode.actionEvent),
|
|
80
80
|
__metadata("design:type", Array)
|
|
81
81
|
], Action.prototype, "eventNodes", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 200 }),
|
|
84
|
+
__metadata("design:type", String)
|
|
85
|
+
], Action.prototype, "icon", void 0);
|
|
82
86
|
Action = __decorate([
|
|
83
87
|
(0, typeorm_1.Entity)({ name: 'twf_action' })
|
|
84
88
|
], Action);
|
package/dist/entity/Flow.d.ts
CHANGED
package/dist/entity/Flow.js
CHANGED
|
@@ -54,6 +54,14 @@ __decorate([
|
|
|
54
54
|
(0, typeorm_1.OneToMany)(() => Node_1.default, node => node.flow),
|
|
55
55
|
__metadata("design:type", Array)
|
|
56
56
|
], Flow.prototype, "nodes", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 200 }),
|
|
59
|
+
__metadata("design:type", String)
|
|
60
|
+
], Flow.prototype, "icon", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 30 }),
|
|
63
|
+
__metadata("design:type", String)
|
|
64
|
+
], Flow.prototype, "status", void 0);
|
|
57
65
|
Flow = __decorate([
|
|
58
66
|
(0, typeorm_1.Entity)({ name: 'twf_flow' })
|
|
59
67
|
], Flow);
|
|
@@ -44,7 +44,7 @@ let Event = class Event {
|
|
|
44
44
|
const { action: { originName, originKey }, } = n;
|
|
45
45
|
const executeView = `select * from ${originName} where ${originKey} = ${newEvent.dataId}`;
|
|
46
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 } }));
|
|
47
|
+
const flow = await (0, core_1.__)(Flow_1.default.findOne({ where: { flowId: n.flowId, isActive: 1, status: 'active' } }));
|
|
48
48
|
if (flow && flow.vendorId == resExecuteView[0].vendor_id &&
|
|
49
49
|
(await this.checkConditions(resExecuteView[0], n.flowId, newEvent.actionId))) {
|
|
50
50
|
//now check all conditions
|