@pxp-nd/flow 1.0.41 → 1.0.43
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/Action.js +10 -10
- package/dist/controllers/ActionType.js +1 -1
- package/dist/controllers/Event.js +1 -1
- package/dist/controllers/FieldMap.js +1 -1
- package/dist/controllers/Flow.js +95 -86
- package/dist/controllers/FlowInstance.js +7 -7
- package/dist/controllers/Node.js +28 -28
- package/dist/controllers/NodeInstance.js +21 -21
- package/dist/controllers/OriginName.js +1 -1
- package/dist/entity/Action.js +17 -17
- package/dist/entity/ActionType.js +13 -13
- package/dist/entity/Event.js +7 -7
- package/dist/entity/FieldMap.js +9 -9
- package/dist/entity/Flow.js +10 -10
- package/dist/entity/FlowInstance.js +13 -13
- package/dist/entity/Node.js +20 -20
- package/dist/entity/NodeConnection.js +9 -9
- package/dist/entity/NodeInstance.js +11 -11
- package/dist/entity/OriginName.js +6 -6
- package/dist/index.js +5 -1
- package/dist/subscribers/Event.js +4 -4
- package/package.json +1 -1
|
@@ -33,7 +33,7 @@ const OriginName_1 = __importDefault(require("../entity/OriginName"));
|
|
|
33
33
|
let Action = class Action extends core_1.Controller {
|
|
34
34
|
async getFieldMapByAction(params, manager) {
|
|
35
35
|
const { originName } = params;
|
|
36
|
-
const fieldMapData = await core_1.__(manager.createQueryBuilder(FieldMap_1.default, 'fm')
|
|
36
|
+
const fieldMapData = await (0, core_1.__)(manager.createQueryBuilder(FieldMap_1.default, 'fm')
|
|
37
37
|
.innerJoin(OriginName_1.default, 'on', 'on.originNameId = fm.originNameId')
|
|
38
38
|
.where("on.name = :n ", { n: originName })
|
|
39
39
|
.getMany());
|
|
@@ -59,24 +59,24 @@ let Action = class Action extends core_1.Controller {
|
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
61
|
__decorate([
|
|
62
|
-
core_1.Get(),
|
|
63
|
-
core_1.DbSettings('Orm'),
|
|
64
|
-
core_1.ReadOnly(false),
|
|
65
|
-
core_1.Log(true),
|
|
62
|
+
(0, core_1.Get)(),
|
|
63
|
+
(0, core_1.DbSettings)('Orm'),
|
|
64
|
+
(0, core_1.ReadOnly)(false),
|
|
65
|
+
(0, core_1.Log)(true),
|
|
66
66
|
__metadata("design:type", Function),
|
|
67
67
|
__metadata("design:paramtypes", [Object, typeorm_1.EntityManager]),
|
|
68
68
|
__metadata("design:returntype", Promise)
|
|
69
69
|
], Action.prototype, "getFieldMapByAction", null);
|
|
70
70
|
__decorate([
|
|
71
|
-
core_1.Get(),
|
|
72
|
-
core_1.DbSettings('Orm'),
|
|
73
|
-
core_1.ReadOnly(true),
|
|
74
|
-
core_1.Log(true),
|
|
71
|
+
(0, core_1.Get)(),
|
|
72
|
+
(0, core_1.DbSettings)('Orm'),
|
|
73
|
+
(0, core_1.ReadOnly)(true),
|
|
74
|
+
(0, core_1.Log)(true),
|
|
75
75
|
__metadata("design:type", Function),
|
|
76
76
|
__metadata("design:paramtypes", [Object, typeorm_1.EntityManager]),
|
|
77
77
|
__metadata("design:returntype", Promise)
|
|
78
78
|
], Action.prototype, "getActions", null);
|
|
79
79
|
Action = __decorate([
|
|
80
|
-
core_1.Model('flow-nd/Action')
|
|
80
|
+
(0, core_1.Model)('flow-nd/Action')
|
|
81
81
|
], Action);
|
|
82
82
|
exports.default = Action;
|
|
@@ -23,6 +23,6 @@ const core_1 = require("@pxp-nd/core");
|
|
|
23
23
|
let ActionType = class ActionType extends core_1.Controller {
|
|
24
24
|
};
|
|
25
25
|
ActionType = __decorate([
|
|
26
|
-
core_1.Model('flow-nd/ActionType')
|
|
26
|
+
(0, core_1.Model)('flow-nd/ActionType')
|
|
27
27
|
], ActionType);
|
|
28
28
|
exports.default = ActionType;
|
package/dist/controllers/Flow.js
CHANGED
|
@@ -57,7 +57,7 @@ let Flow = class Flow extends core_1.Controller {
|
|
|
57
57
|
return restNodes;
|
|
58
58
|
}
|
|
59
59
|
async copyNodeConnections(nodeId, newNodeId, newFlowId, manager) {
|
|
60
|
-
const connections = await core_1.__(NodeConnection_1.default.find({ nodeIdMaster: nodeId }));
|
|
60
|
+
const connections = await (0, core_1.__)(NodeConnection_1.default.find({ nodeIdMaster: nodeId }));
|
|
61
61
|
for (let connection of connections) {
|
|
62
62
|
const newNodeConnection = new NodeConnection_1.default();
|
|
63
63
|
const { nodeConnectionId, nodeIdMaster, nodeIdChild, createdAt, modifiedAt, ...nodeConnectionToCopy } = connection;
|
|
@@ -65,7 +65,7 @@ let Flow = class Flow extends core_1.Controller {
|
|
|
65
65
|
const dataNodeChild = await Node_1.default.findOne({ nodeId: connection.nodeIdChild });
|
|
66
66
|
const { nodeId: newNodeIdChild } = await this.copyNode(dataNodeChild, newFlowId, manager);
|
|
67
67
|
Object.assign(newNodeConnection, { ...nodeConnectionToCopy, nodeIdMaster: newNodeId, nodeIdChild: newNodeIdChild });
|
|
68
|
-
const insertNewNodeConnection = await core_1.__(manager.save(NodeConnection_1.default, newNodeConnection));
|
|
68
|
+
const insertNewNodeConnection = await (0, core_1.__)(manager.save(NodeConnection_1.default, newNodeConnection));
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
async copyNode(node, newFlowId, manager) {
|
|
@@ -73,20 +73,20 @@ let Flow = class Flow extends core_1.Controller {
|
|
|
73
73
|
const newNode = new Node_1.default();
|
|
74
74
|
const { nodeId, flowId, createdAt, modifiedAt, actionConfigJson, ...nodeToCopy } = node;
|
|
75
75
|
Object.assign(newNode, { ...nodeToCopy, flowId: newFlowId });
|
|
76
|
-
const insertNewNode = await core_1.__(manager.save(Node_1.default, newNode));
|
|
76
|
+
const insertNewNode = await (0, core_1.__)(manager.save(Node_1.default, newNode));
|
|
77
77
|
// insert connection
|
|
78
78
|
await this.copyNodeConnections(node.nodeId, insertNewNode.nodeId, newFlowId, manager);
|
|
79
79
|
return { nodeId: insertNewNode.nodeId };
|
|
80
80
|
}
|
|
81
81
|
async createFlowFromFlow(params, manager) {
|
|
82
82
|
// we need clone the flow selected
|
|
83
|
-
const dataFlow = await core_1.__(Flow_1.default.findOne(params.flowId));
|
|
83
|
+
const dataFlow = await (0, core_1.__)(Flow_1.default.findOne(params.flowId));
|
|
84
84
|
const { flowId, createdAt, modifiedAt, nodes, ...flowToCopy } = dataFlow;
|
|
85
85
|
const newFlow = new Flow_1.default();
|
|
86
86
|
Object.assign(newFlow, flowToCopy);
|
|
87
87
|
newFlow.name = params.name;
|
|
88
88
|
newFlow.description = params.description;
|
|
89
|
-
const insertNewFlow = await core_1.__(manager.save(Flow_1.default, newFlow));
|
|
89
|
+
const insertNewFlow = await (0, core_1.__)(manager.save(Flow_1.default, newFlow));
|
|
90
90
|
// create the nodes
|
|
91
91
|
// get the first node "the trigger node"
|
|
92
92
|
const dataNode = await Node_1.default.findOne({ where: { flowId: params.flowId }, order: { nodeId: "ASC" } });
|
|
@@ -94,11 +94,11 @@ let Flow = class Flow extends core_1.Controller {
|
|
|
94
94
|
return { flowId: insertNewFlow.flowId };
|
|
95
95
|
}
|
|
96
96
|
async deleteFlow(params, manager) {
|
|
97
|
-
let dataFlow = await core_1.__(Flow_1.default.findOne(params.flowId));
|
|
97
|
+
let dataFlow = await (0, core_1.__)(Flow_1.default.findOne(params.flowId));
|
|
98
98
|
if (dataFlow) {
|
|
99
99
|
dataFlow.isActive = 0;
|
|
100
100
|
dataFlow.enabled = 'N';
|
|
101
|
-
const updFlow = await core_1.__(manager.save(dataFlow));
|
|
101
|
+
const updFlow = await (0, core_1.__)(manager.save(dataFlow));
|
|
102
102
|
if (updFlow) {
|
|
103
103
|
let flowInstance = `UPDATE twf_flow_instance SET
|
|
104
104
|
is_active = 'N' WHERE flow_id = ${updFlow.flowId}`;
|
|
@@ -109,7 +109,7 @@ let Flow = class Flow extends core_1.Controller {
|
|
|
109
109
|
const nodesToInact = await manager.find(Node_1.default, { flowId: updFlow.flowId });
|
|
110
110
|
const originalNodeIds = nodesToInact.map((node) => node.nodeId);
|
|
111
111
|
const connectionsToInact = await manager.find(NodeConnection_1.default, {
|
|
112
|
-
where: { nodeIdChild: typeorm_1.In(originalNodeIds) } // Suponiendo que originalNodeIds contiene los IDs de los nodos originales que deseas duplicar
|
|
112
|
+
where: { nodeIdChild: (0, typeorm_1.In)(originalNodeIds) } // Suponiendo que originalNodeIds contiene los IDs de los nodos originales que deseas duplicar
|
|
113
113
|
});
|
|
114
114
|
const originalNodeCIds = connectionsToInact.map((node) => node.nodeConnectionId);
|
|
115
115
|
let flowNodeC = `UPDATE twf_node_connection SET
|
|
@@ -126,10 +126,10 @@ let Flow = class Flow extends core_1.Controller {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
async saveFlowName(params, manager) {
|
|
129
|
-
let dataFlow = await core_1.__(Flow_1.default.findOne(params.flowId));
|
|
129
|
+
let dataFlow = await (0, core_1.__)(Flow_1.default.findOne(params.flowId));
|
|
130
130
|
if (dataFlow) {
|
|
131
131
|
dataFlow.name = params.name;
|
|
132
|
-
const updFlow = await core_1.__(manager.save(dataFlow));
|
|
132
|
+
const updFlow = await (0, core_1.__)(manager.save(dataFlow));
|
|
133
133
|
return { success: true };
|
|
134
134
|
}
|
|
135
135
|
else {
|
|
@@ -146,7 +146,7 @@ let Flow = class Flow extends core_1.Controller {
|
|
|
146
146
|
createdAt: undefined
|
|
147
147
|
};
|
|
148
148
|
const flowDataClone = await manager.save(Flow_1.default, { ...flowToClone, name: `${flowData.name} Copy` });
|
|
149
|
-
const nodesToDuplicate = await manager.find(Node_1.default, { flowId: flowData === null || flowData === void 0 ? void 0 : flowData.flowId });
|
|
149
|
+
const nodesToDuplicate = await manager.find(Node_1.default, { flowId: flowData === null || flowData === void 0 ? void 0 : flowData.flowId, isActive: true });
|
|
150
150
|
if (nodesToDuplicate) {
|
|
151
151
|
const originalNodeIds = nodesToDuplicate.map((node) => node.nodeId);
|
|
152
152
|
const duplicatedNodes = nodesToDuplicate.map((node) => {
|
|
@@ -157,7 +157,7 @@ let Flow = class Flow extends core_1.Controller {
|
|
|
157
157
|
const savedNodes = await manager.save(duplicatedNodes);
|
|
158
158
|
const newNodeIds = savedNodes.map((node) => node.nodeId);
|
|
159
159
|
const connectionsToDuplicate = await manager.find(NodeConnection_1.default, {
|
|
160
|
-
where: { nodeIdChild: typeorm_1.In(originalNodeIds) }
|
|
160
|
+
where: { nodeIdChild: (0, typeorm_1.In)(originalNodeIds) }
|
|
161
161
|
});
|
|
162
162
|
const duplicatedConnections = newNodeIds.map((nodeId, index) => {
|
|
163
163
|
const duplicatedConnection = manager.create(NodeConnection_1.default, {
|
|
@@ -176,7 +176,7 @@ let Flow = class Flow extends core_1.Controller {
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
async getFlowRender(params) {
|
|
179
|
-
let actions = await typeorm_1.getManager()
|
|
179
|
+
let actions = await (0, typeorm_1.getManager)()
|
|
180
180
|
.createQueryBuilder(Action_1.default, "a")
|
|
181
181
|
.select([
|
|
182
182
|
"a.actionId",
|
|
@@ -188,16 +188,16 @@ let Flow = class Flow extends core_1.Controller {
|
|
|
188
188
|
.innerJoin("a.actionType", "at")
|
|
189
189
|
.where(`a.isActive = 1 and a.hidden = 'N'`)
|
|
190
190
|
.getMany();
|
|
191
|
-
const connections = await typeorm_1.getManager()
|
|
191
|
+
const connections = await (0, typeorm_1.getManager)()
|
|
192
192
|
.createQueryBuilder(NodeConnection_1.default, "nc")
|
|
193
193
|
.select([
|
|
194
194
|
"nc.nodeIdMaster",
|
|
195
195
|
"nc.nodeIdChild",
|
|
196
196
|
])
|
|
197
197
|
.innerJoin("nc.childNode", "cn")
|
|
198
|
-
.where(`cn.flowId = :flowId`, { flowId: params.flowId })
|
|
198
|
+
.where(`cn.isActive = 1 and cn.flowId = :flowId`, { flowId: params.flowId })
|
|
199
199
|
.getMany();
|
|
200
|
-
const nodes = await typeorm_1.getManager()
|
|
200
|
+
const nodes = await (0, typeorm_1.getManager)()
|
|
201
201
|
.createQueryBuilder(Node_1.default, "n")
|
|
202
202
|
.select([
|
|
203
203
|
"n.nodeId",
|
|
@@ -207,7 +207,7 @@ let Flow = class Flow extends core_1.Controller {
|
|
|
207
207
|
"a.description",
|
|
208
208
|
])
|
|
209
209
|
.innerJoin("n.action", "a")
|
|
210
|
-
.where(`n.flowId = :flowId`, { flowId: params.flowId })
|
|
210
|
+
.where(`n.isActive = 1 and n.flowId = :flowId`, { flowId: params.flowId })
|
|
211
211
|
.getMany();
|
|
212
212
|
let sortedNodes = this.sortNodesByConnections(nodes, connections);
|
|
213
213
|
actions.forEach((item) => {
|
|
@@ -284,29 +284,34 @@ let Flow = class Flow extends core_1.Controller {
|
|
|
284
284
|
let id = null;
|
|
285
285
|
let flowId = null;
|
|
286
286
|
let taskIds = [];
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
287
|
+
if (nodeRefIds.length === 0) {
|
|
288
|
+
flowId = params.board.columns['2-column-nodes-configured'].flowId;
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
for (const nodeId of nodeRefIds) {
|
|
292
|
+
// console.log ('node:',nodes[`${nodeId}`]);
|
|
293
|
+
if (nodes[`${nodeId}`]) {
|
|
294
|
+
flowId = nodes[`${nodeId}`].flowId;
|
|
295
|
+
if (nodeId != 'new') {
|
|
296
|
+
id = parseInt(nodeId.split("-")[1]);
|
|
297
|
+
taskIds.push(id);
|
|
298
|
+
const connectionsToDel = await manager.find(NodeConnection_1.default, {
|
|
299
|
+
where: { nodeIdChild: id }
|
|
300
|
+
});
|
|
301
|
+
if (connectionsToDel) {
|
|
302
|
+
//console.log("hay para eliminar---->", connectionsToDel);
|
|
303
|
+
const originalNodeCIds = connectionsToDel.map((node) => node.nodeConnectionId);
|
|
304
|
+
//console.log("eliminando: ", originalNodeCIds);
|
|
305
|
+
let flowNodeC = await (0, typeorm_1.getManager)().query(`DELETE
|
|
302
306
|
from twf_node_connection
|
|
303
307
|
WHERE node_connection_id = ${originalNodeCIds}`);
|
|
308
|
+
}
|
|
304
309
|
}
|
|
305
310
|
}
|
|
306
311
|
}
|
|
307
312
|
}
|
|
308
313
|
//If there are some nodes in node_connections after delete all records sent, to inactive node
|
|
309
|
-
let connectNoDel = await typeorm_1.getManager().query(`SELECT n.node_id
|
|
314
|
+
let connectNoDel = await (0, typeorm_1.getManager)().query(`SELECT n.node_id
|
|
310
315
|
from twf_node_connection nd
|
|
311
316
|
inner join twf_node n on n.node_id = nd.node_id_child
|
|
312
317
|
WHERE n.flow_id= ${flowId}`);
|
|
@@ -322,101 +327,105 @@ let Flow = class Flow extends core_1.Controller {
|
|
|
322
327
|
await manager.query(dNode);
|
|
323
328
|
}
|
|
324
329
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
330
|
+
if (nodeRefIds.length === 0) {
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
for (const nodeId of nodeRefIds) {
|
|
334
|
+
if (nodes[`${nodeId}`]) {
|
|
335
|
+
if (nodeId === 'new') {
|
|
336
|
+
//get information about Action
|
|
337
|
+
const newAction = await Action_1.default.findOne({ code: nodes[`${nodeId}`].action.code });
|
|
338
|
+
const newNode = manager.create(Node_1.default, {
|
|
339
|
+
nodeId: undefined,
|
|
340
|
+
flowId: nodes[`${nodeId}`].flowId,
|
|
341
|
+
isInit: 'N',
|
|
342
|
+
actionId: newAction.actionId
|
|
343
|
+
});
|
|
344
|
+
const saveNode = await manager.save(newNode);
|
|
345
|
+
id = saveNode.nodeId;
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
id = parseInt(nodeId.split("-")[1]);
|
|
349
|
+
}
|
|
350
|
+
//save in node and node_connection
|
|
351
|
+
const newConnection = manager.create(NodeConnection_1.default, {
|
|
352
|
+
nodeConnectionId: undefined,
|
|
353
|
+
nodeIdMaster: masterId,
|
|
354
|
+
nodeIdChild: id,
|
|
335
355
|
});
|
|
336
|
-
|
|
337
|
-
|
|
356
|
+
masterId = id;
|
|
357
|
+
const savedNodes = await manager.save(newConnection);
|
|
358
|
+
// }
|
|
338
359
|
}
|
|
339
|
-
else {
|
|
340
|
-
id = parseInt(nodeId.split("-")[1]);
|
|
341
|
-
}
|
|
342
|
-
//save in node and node_connection
|
|
343
|
-
const newConnection = manager.create(NodeConnection_1.default, {
|
|
344
|
-
nodeConnectionId: undefined,
|
|
345
|
-
nodeIdMaster: masterId,
|
|
346
|
-
nodeIdChild: id,
|
|
347
|
-
});
|
|
348
|
-
masterId = id;
|
|
349
|
-
const savedNodes = await manager.save(newConnection);
|
|
350
|
-
// }
|
|
351
360
|
}
|
|
352
361
|
}
|
|
353
362
|
return { success: true };
|
|
354
363
|
}
|
|
355
364
|
};
|
|
356
365
|
__decorate([
|
|
357
|
-
core_1.Get(),
|
|
358
|
-
core_1.DbSettings('Orm'),
|
|
359
|
-
core_1.ReadOnly(true),
|
|
360
|
-
core_1.Log(true),
|
|
366
|
+
(0, core_1.Get)(),
|
|
367
|
+
(0, core_1.DbSettings)('Orm'),
|
|
368
|
+
(0, core_1.ReadOnly)(true),
|
|
369
|
+
(0, core_1.Log)(true),
|
|
361
370
|
__metadata("design:type", Function),
|
|
362
371
|
__metadata("design:paramtypes", [Object]),
|
|
363
372
|
__metadata("design:returntype", Promise)
|
|
364
373
|
], Flow.prototype, "get", null);
|
|
365
374
|
__decorate([
|
|
366
|
-
core_1.Post(),
|
|
367
|
-
core_1.DbSettings('Orm'),
|
|
368
|
-
core_1.ReadOnly(false),
|
|
369
|
-
core_1.Log(true),
|
|
375
|
+
(0, core_1.Post)(),
|
|
376
|
+
(0, core_1.DbSettings)('Orm'),
|
|
377
|
+
(0, core_1.ReadOnly)(false),
|
|
378
|
+
(0, core_1.Log)(true),
|
|
370
379
|
__metadata("design:type", Function),
|
|
371
380
|
__metadata("design:paramtypes", [Object, typeorm_1.EntityManager]),
|
|
372
381
|
__metadata("design:returntype", Promise)
|
|
373
382
|
], Flow.prototype, "createFlowFromFlow", null);
|
|
374
383
|
__decorate([
|
|
375
|
-
core_1.Post(),
|
|
376
|
-
core_1.DbSettings('Orm'),
|
|
377
|
-
core_1.ReadOnly(false),
|
|
378
|
-
core_1.Log(true),
|
|
384
|
+
(0, core_1.Post)(),
|
|
385
|
+
(0, core_1.DbSettings)('Orm'),
|
|
386
|
+
(0, core_1.ReadOnly)(false),
|
|
387
|
+
(0, core_1.Log)(true),
|
|
379
388
|
__metadata("design:type", Function),
|
|
380
389
|
__metadata("design:paramtypes", [Object, typeorm_1.EntityManager]),
|
|
381
390
|
__metadata("design:returntype", Promise)
|
|
382
391
|
], Flow.prototype, "deleteFlow", null);
|
|
383
392
|
__decorate([
|
|
384
|
-
core_1.Post(),
|
|
385
|
-
core_1.DbSettings('Orm'),
|
|
386
|
-
core_1.ReadOnly(false),
|
|
387
|
-
core_1.Log(true),
|
|
393
|
+
(0, core_1.Post)(),
|
|
394
|
+
(0, core_1.DbSettings)('Orm'),
|
|
395
|
+
(0, core_1.ReadOnly)(false),
|
|
396
|
+
(0, core_1.Log)(true),
|
|
388
397
|
__metadata("design:type", Function),
|
|
389
398
|
__metadata("design:paramtypes", [Object, typeorm_1.EntityManager]),
|
|
390
399
|
__metadata("design:returntype", Promise)
|
|
391
400
|
], Flow.prototype, "saveFlowName", null);
|
|
392
401
|
__decorate([
|
|
393
|
-
core_1.Post(),
|
|
394
|
-
core_1.DbSettings('Orm'),
|
|
395
|
-
core_1.ReadOnly(false),
|
|
396
|
-
core_1.Log(true),
|
|
402
|
+
(0, core_1.Post)(),
|
|
403
|
+
(0, core_1.DbSettings)('Orm'),
|
|
404
|
+
(0, core_1.ReadOnly)(false),
|
|
405
|
+
(0, core_1.Log)(true),
|
|
397
406
|
__metadata("design:type", Function),
|
|
398
407
|
__metadata("design:paramtypes", [Object, typeorm_1.EntityManager]),
|
|
399
408
|
__metadata("design:returntype", Promise)
|
|
400
409
|
], Flow.prototype, "duplicateFlow", null);
|
|
401
410
|
__decorate([
|
|
402
|
-
core_1.Get(),
|
|
403
|
-
core_1.DbSettings('Orm'),
|
|
404
|
-
core_1.ReadOnly(true),
|
|
405
|
-
core_1.Log(true),
|
|
411
|
+
(0, core_1.Get)(),
|
|
412
|
+
(0, core_1.DbSettings)('Orm'),
|
|
413
|
+
(0, core_1.ReadOnly)(true),
|
|
414
|
+
(0, core_1.Log)(true),
|
|
406
415
|
__metadata("design:type", Function),
|
|
407
416
|
__metadata("design:paramtypes", [Object]),
|
|
408
417
|
__metadata("design:returntype", Promise)
|
|
409
418
|
], Flow.prototype, "getFlowRender", null);
|
|
410
419
|
__decorate([
|
|
411
|
-
core_1.Post(),
|
|
412
|
-
core_1.DbSettings('Orm'),
|
|
413
|
-
core_1.ReadOnly(false),
|
|
414
|
-
core_1.Log(true),
|
|
420
|
+
(0, core_1.Post)(),
|
|
421
|
+
(0, core_1.DbSettings)('Orm'),
|
|
422
|
+
(0, core_1.ReadOnly)(false),
|
|
423
|
+
(0, core_1.Log)(true),
|
|
415
424
|
__metadata("design:type", Function),
|
|
416
425
|
__metadata("design:paramtypes", [Object, typeorm_1.EntityManager]),
|
|
417
426
|
__metadata("design:returntype", Promise)
|
|
418
427
|
], Flow.prototype, "saveFlow", null);
|
|
419
428
|
Flow = __decorate([
|
|
420
|
-
core_1.Model('flow-nd/Flow')
|
|
429
|
+
(0, core_1.Model)('flow-nd/Flow')
|
|
421
430
|
], Flow);
|
|
422
431
|
exports.default = Flow;
|
|
@@ -42,7 +42,7 @@ class FlowInstance extends core_1.Controller {
|
|
|
42
42
|
}
|
|
43
43
|
flag.value = 'true';
|
|
44
44
|
let flowInstanceIdProcessing = -1;
|
|
45
|
-
await typeorm_1.getManager().save(flag);
|
|
45
|
+
await (0, typeorm_1.getManager)().save(flag);
|
|
46
46
|
try {
|
|
47
47
|
const maxFlows = await common_1.GlobalData.findOne({ data: 'wf_max_concurrent_flows_process' });
|
|
48
48
|
const flowInstances = await FlowInstance_1.default.find({ take: (maxFlows && maxFlows.value), where: [{ status: 'pending' }], order: { flowInstanceId: "ASC" } });
|
|
@@ -63,20 +63,20 @@ class FlowInstance extends core_1.Controller {
|
|
|
63
63
|
}
|
|
64
64
|
catch (error) {
|
|
65
65
|
flag.value = 'false';
|
|
66
|
-
await typeorm_1.getManager().save(flag);
|
|
66
|
+
await (0, typeorm_1.getManager)().save(flag);
|
|
67
67
|
throw new core_1.PxpError(400, 'Error processing flow: ' + flowInstanceIdProcessing);
|
|
68
68
|
}
|
|
69
69
|
flag.value = 'false';
|
|
70
|
-
await typeorm_1.getManager().save(flag);
|
|
70
|
+
await (0, typeorm_1.getManager)().save(flag);
|
|
71
71
|
}
|
|
72
72
|
return { success: true };
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
__decorate([
|
|
76
|
-
core_1.Post(),
|
|
77
|
-
core_1.DbSettings('Orm'),
|
|
78
|
-
core_1.ReadOnly(false),
|
|
79
|
-
core_1.Log(true),
|
|
76
|
+
(0, core_1.Post)(),
|
|
77
|
+
(0, core_1.DbSettings)('Orm'),
|
|
78
|
+
(0, core_1.ReadOnly)(false),
|
|
79
|
+
(0, core_1.Log)(true),
|
|
80
80
|
__metadata("design:type", Function),
|
|
81
81
|
__metadata("design:paramtypes", [Object, typeorm_1.EntityManager]),
|
|
82
82
|
__metadata("design:returntype", Promise)
|
package/dist/controllers/Node.js
CHANGED
|
@@ -37,7 +37,7 @@ let Node = class Node extends core_1.Controller {
|
|
|
37
37
|
async getNodeData(node, dataId, manager) {
|
|
38
38
|
const { action: { originName, originKey } } = node;
|
|
39
39
|
const executeView = `select * from ${originName} where ${originKey} = ${dataId}`;
|
|
40
|
-
const resExecuteView = await core_1.__(manager.query(executeView));
|
|
40
|
+
const resExecuteView = await (0, core_1.__)(manager.query(executeView));
|
|
41
41
|
return JSON.stringify(resExecuteView[0]);
|
|
42
42
|
}
|
|
43
43
|
async add(params, manager) {
|
|
@@ -70,7 +70,7 @@ let Node = class Node extends core_1.Controller {
|
|
|
70
70
|
Object.entries(params.__metadata).forEach(([nameKey, values]) => {
|
|
71
71
|
actionConfigJson[nameKey] = `{{ ${values.name} }}`;
|
|
72
72
|
});
|
|
73
|
-
const upd = await core_1.__(manager.update(Node_1.default, params.nodeId, {
|
|
73
|
+
const upd = await (0, core_1.__)(manager.update(Node_1.default, params.nodeId, {
|
|
74
74
|
actionConfigJson: JSON.stringify(actionConfigJson),
|
|
75
75
|
}));
|
|
76
76
|
return {
|
|
@@ -83,18 +83,18 @@ 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 tNodeOrigin = await core_1.__(Node_1.default.findOne({
|
|
86
|
+
const tNodeOrigin = await (0, core_1.__)(Node_1.default.findOne({
|
|
87
87
|
relations: ['action'],
|
|
88
88
|
where: {
|
|
89
89
|
flowId: flowId,
|
|
90
90
|
isInit: 'Y',
|
|
91
91
|
action: {
|
|
92
|
-
originName: typeorm_1.Not(typeorm_1.IsNull())
|
|
92
|
+
originName: (0, typeorm_1.Not)((0, typeorm_1.IsNull)())
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
}));
|
|
96
|
-
const tNodeData = core_1.__(Node_1.default.findOne(nodeId));
|
|
97
|
-
const tFieldMapData = core_1.__(manager.createQueryBuilder(FieldMap_1.default, 'fm')
|
|
96
|
+
const tNodeData = (0, core_1.__)(Node_1.default.findOne(nodeId));
|
|
97
|
+
const tFieldMapData = (0, core_1.__)(manager.createQueryBuilder(FieldMap_1.default, 'fm')
|
|
98
98
|
.innerJoin(OriginName_1.default, 'on', 'on.originNameId = fm.originNameId')
|
|
99
99
|
.where("on.name = :n ", { n: tNodeOrigin.action.originName })
|
|
100
100
|
.getMany());
|
|
@@ -160,7 +160,7 @@ let Node = class Node extends core_1.Controller {
|
|
|
160
160
|
}
|
|
161
161
|
};
|
|
162
162
|
// @ts-ignore
|
|
163
|
-
const resControllerAxios = await core_1.__(axios_1.default(config));
|
|
163
|
+
const resControllerAxios = await (0, core_1.__)((0, axios_1.default)(config));
|
|
164
164
|
const desc = resControllerAxios.data.data[descDD];
|
|
165
165
|
return desc;
|
|
166
166
|
}
|
|
@@ -178,7 +178,7 @@ let Node = class Node extends core_1.Controller {
|
|
|
178
178
|
}
|
|
179
179
|
};
|
|
180
180
|
// @ts-ignore
|
|
181
|
-
const resControllerAxios = await core_1.__(axios_1.default(config));
|
|
181
|
+
const resControllerAxios = await (0, core_1.__)((0, axios_1.default)(config));
|
|
182
182
|
const desc = resControllerAxios.data.data[descColumn];
|
|
183
183
|
return desc;
|
|
184
184
|
}
|
|
@@ -186,7 +186,7 @@ let Node = class Node extends core_1.Controller {
|
|
|
186
186
|
};
|
|
187
187
|
for (const [nameKey, value] of Object.entries(mergeValues)) {
|
|
188
188
|
if (schemaJsonObject[nameKey]) {
|
|
189
|
-
const descValue = await core_1.__(findFieldInConfigForComponent(schemaJsonObject[nameKey], value));
|
|
189
|
+
const descValue = await (0, core_1.__)(findFieldInConfigForComponent(schemaJsonObject[nameKey], value));
|
|
190
190
|
schemaJsonObject[nameKey] = {
|
|
191
191
|
...schemaJsonObject[nameKey],
|
|
192
192
|
initialValue: value,
|
|
@@ -217,13 +217,13 @@ let Node = class Node extends core_1.Controller {
|
|
|
217
217
|
async executeActionJson(params, manager) {
|
|
218
218
|
const { nodeId, originName, originKey, fromValues } = params;
|
|
219
219
|
// we need to get the value from merge values with originKey
|
|
220
|
-
const getParameterizedNodeData = await core_1.__(this.getParameterizedNode({ nodeId: nodeId }, manager));
|
|
220
|
+
const getParameterizedNodeData = await (0, core_1.__)(this.getParameterizedNode({ nodeId: nodeId }, manager));
|
|
221
221
|
const { mergeValues } = getParameterizedNodeData;
|
|
222
222
|
const findOriginValue = Object.entries(mergeValues).find(([nameValue]) => fromValues === nameValue);
|
|
223
223
|
const resValueObject = Object.fromEntries([findOriginValue]);
|
|
224
224
|
const originValue = resValueObject[fromValues];
|
|
225
225
|
const executeViewString = `select * from ${originName} where ${originKey} = ${originValue}`;
|
|
226
|
-
const resExecuteView = await typeorm_1.getManager().query(executeViewString);
|
|
226
|
+
const resExecuteView = await (0, typeorm_1.getManager)().query(executeViewString);
|
|
227
227
|
/*const executeView = `select * from ${originName} where ${originKey} = ${newEvent.dataId}`;
|
|
228
228
|
const resExecuteView = await getManager().query(executeView);*/
|
|
229
229
|
return {
|
|
@@ -232,42 +232,42 @@ let Node = class Node extends core_1.Controller {
|
|
|
232
232
|
}
|
|
233
233
|
};
|
|
234
234
|
__decorate([
|
|
235
|
-
core_1.Post(),
|
|
236
|
-
core_1.DbSettings('Orm'),
|
|
237
|
-
core_1.ReadOnly(false),
|
|
238
|
-
core_1.Log(true),
|
|
235
|
+
(0, core_1.Post)(),
|
|
236
|
+
(0, core_1.DbSettings)('Orm'),
|
|
237
|
+
(0, core_1.ReadOnly)(false),
|
|
238
|
+
(0, core_1.Log)(true),
|
|
239
239
|
__metadata("design:type", Function),
|
|
240
240
|
__metadata("design:paramtypes", [Object, typeorm_1.EntityManager]),
|
|
241
241
|
__metadata("design:returntype", Promise)
|
|
242
242
|
], Node.prototype, "add", null);
|
|
243
243
|
__decorate([
|
|
244
|
-
core_1.Post(),
|
|
245
|
-
core_1.DbSettings('Orm'),
|
|
246
|
-
core_1.ReadOnly(false),
|
|
247
|
-
core_1.Log(true),
|
|
244
|
+
(0, core_1.Post)(),
|
|
245
|
+
(0, core_1.DbSettings)('Orm'),
|
|
246
|
+
(0, core_1.ReadOnly)(false),
|
|
247
|
+
(0, core_1.Log)(true),
|
|
248
248
|
__metadata("design:type", Function),
|
|
249
249
|
__metadata("design:paramtypes", [Object, typeorm_1.EntityManager]),
|
|
250
250
|
__metadata("design:returntype", Promise)
|
|
251
251
|
], Node.prototype, "AddActionConfigJson", null);
|
|
252
252
|
__decorate([
|
|
253
|
-
core_1.Post(),
|
|
254
|
-
core_1.DbSettings('Orm'),
|
|
255
|
-
core_1.ReadOnly(false),
|
|
256
|
-
core_1.Log(true),
|
|
253
|
+
(0, core_1.Post)(),
|
|
254
|
+
(0, core_1.DbSettings)('Orm'),
|
|
255
|
+
(0, core_1.ReadOnly)(false),
|
|
256
|
+
(0, core_1.Log)(true),
|
|
257
257
|
__metadata("design:type", Function),
|
|
258
258
|
__metadata("design:paramtypes", [Object, typeorm_1.EntityManager]),
|
|
259
259
|
__metadata("design:returntype", Promise)
|
|
260
260
|
], Node.prototype, "getParameterizedNode", null);
|
|
261
261
|
__decorate([
|
|
262
|
-
core_1.Post(),
|
|
263
|
-
core_1.DbSettings('Orm'),
|
|
264
|
-
core_1.ReadOnly(false),
|
|
265
|
-
core_1.Log(true),
|
|
262
|
+
(0, core_1.Post)(),
|
|
263
|
+
(0, core_1.DbSettings)('Orm'),
|
|
264
|
+
(0, core_1.ReadOnly)(false),
|
|
265
|
+
(0, core_1.Log)(true),
|
|
266
266
|
__metadata("design:type", Function),
|
|
267
267
|
__metadata("design:paramtypes", [Object, typeorm_1.EntityManager]),
|
|
268
268
|
__metadata("design:returntype", Promise)
|
|
269
269
|
], Node.prototype, "executeActionJson", null);
|
|
270
270
|
Node = __decorate([
|
|
271
|
-
core_1.Model('flow-nd/Node')
|
|
271
|
+
(0, core_1.Model)('flow-nd/Node')
|
|
272
272
|
], Node);
|
|
273
273
|
exports.default = Node;
|