@pxp-nd/flow 1.0.53 → 1.0.54
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.
|
@@ -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
|
@@ -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/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
|