@pxp-nd/flow 1.0.39 → 1.0.40

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.
@@ -277,23 +277,28 @@ let Flow = class Flow extends core_1.Controller {
277
277
  let id = null;
278
278
  let flowId = null;
279
279
  let taskIds = [];
280
- for (const nodeId of nodeRefIds) {
281
- // console.log ('node:',nodes[`${nodeId}`]);
282
- if (nodes[`${nodeId}`]) {
283
- flowId = nodes[`${nodeId}`].flowId;
284
- if (nodeId != 'new') {
285
- id = parseInt(nodeId.split("-")[1]);
286
- taskIds.push(id);
287
- const connectionsToDel = await manager.find(NodeConnection_1.default, {
288
- where: { nodeIdChild: id }
289
- });
290
- if (connectionsToDel) {
291
- //console.log("hay para eliminar---->", connectionsToDel);
292
- const originalNodeCIds = connectionsToDel.map((node) => node.nodeConnectionId);
293
- //console.log("eliminando: ", originalNodeCIds);
294
- let flowNodeC = await typeorm_1.getManager().query(`DELETE
280
+ if (nodeRefIds.length === 0) {
281
+ flowId = params.board.columns['2-column-nodes-configured'].flowId;
282
+ }
283
+ else {
284
+ for (const nodeId of nodeRefIds) {
285
+ // console.log ('node:',nodes[`${nodeId}`]);
286
+ if (nodes[`${nodeId}`]) {
287
+ flowId = nodes[`${nodeId}`].flowId;
288
+ if (nodeId != 'new') {
289
+ id = parseInt(nodeId.split("-")[1]);
290
+ taskIds.push(id);
291
+ const connectionsToDel = await manager.find(NodeConnection_1.default, {
292
+ where: { nodeIdChild: id }
293
+ });
294
+ if (connectionsToDel) {
295
+ //console.log("hay para eliminar---->", connectionsToDel);
296
+ const originalNodeCIds = connectionsToDel.map((node) => node.nodeConnectionId);
297
+ //console.log("eliminando: ", originalNodeCIds);
298
+ let flowNodeC = await typeorm_1.getManager().query(`DELETE
295
299
  from twf_node_connection
296
300
  WHERE node_connection_id = ${originalNodeCIds}`);
301
+ }
297
302
  }
298
303
  }
299
304
  }
@@ -315,32 +320,36 @@ let Flow = class Flow extends core_1.Controller {
315
320
  await manager.query(dNode);
316
321
  }
317
322
  }
318
- for (const nodeId of nodeRefIds) {
319
- if (nodes[`${nodeId}`]) {
320
- if (nodeId === 'new') {
321
- //get information about Action
322
- const newAction = await Action_1.default.findOne({ code: nodes[`${nodeId}`].action.code });
323
- const newNode = manager.create(Node_1.default, {
324
- nodeId: undefined,
325
- flowId: nodes[`${nodeId}`].flowId,
326
- isInit: 'N',
327
- actionId: newAction.actionId
323
+ if (nodeRefIds.length === 0) {
324
+ }
325
+ else {
326
+ for (const nodeId of nodeRefIds) {
327
+ if (nodes[`${nodeId}`]) {
328
+ if (nodeId === 'new') {
329
+ //get information about Action
330
+ const newAction = await Action_1.default.findOne({ code: nodes[`${nodeId}`].action.code });
331
+ const newNode = manager.create(Node_1.default, {
332
+ nodeId: undefined,
333
+ flowId: nodes[`${nodeId}`].flowId,
334
+ isInit: 'N',
335
+ actionId: newAction.actionId
336
+ });
337
+ const saveNode = await manager.save(newNode);
338
+ id = saveNode.nodeId;
339
+ }
340
+ else {
341
+ id = parseInt(nodeId.split("-")[1]);
342
+ }
343
+ //save in node and node_connection
344
+ const newConnection = manager.create(NodeConnection_1.default, {
345
+ nodeConnectionId: undefined,
346
+ nodeIdMaster: masterId,
347
+ nodeIdChild: id,
328
348
  });
329
- const saveNode = await manager.save(newNode);
330
- id = saveNode.nodeId;
349
+ masterId = id;
350
+ const savedNodes = await manager.save(newConnection);
351
+ // }
331
352
  }
332
- else {
333
- id = parseInt(nodeId.split("-")[1]);
334
- }
335
- //save in node and node_connection
336
- const newConnection = manager.create(NodeConnection_1.default, {
337
- nodeConnectionId: undefined,
338
- nodeIdMaster: masterId,
339
- nodeIdChild: id,
340
- });
341
- masterId = id;
342
- const savedNodes = await manager.save(newConnection);
343
- // }
344
353
  }
345
354
  }
346
355
  return { success: true };
@@ -51,7 +51,7 @@ __decorate([
51
51
  __metadata("design:type", Array)
52
52
  ], Flow.prototype, "instances", void 0);
53
53
  __decorate([
54
- typeorm_1.OneToMany(() => Node_1.default, node => node.flow),
54
+ typeorm_1.OneToMany(() => Node_1.default, node => node.flow, { eager: true }),
55
55
  __metadata("design:type", Array)
56
56
  ], Flow.prototype, "nodes", void 0);
57
57
  Flow = __decorate([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pxp-nd/flow",
3
- "version": "1.0.39",
3
+ "version": "1.0.40",
4
4
  "description": "Workflow module for pxp-nd framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",