@ejfdelgado/ejflab-common 1.8.4 → 1.8.5

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ejfdelgado/ejflab-common",
3
3
  "type": "commonjs",
4
- "version": "1.8.4",
4
+ "version": "1.8.5",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/ejfdelgado/ejflab-common.git"
@@ -278,12 +278,13 @@ class FlowChartExec {
278
278
  return this.loadFlowChartInternal(paths, true);
279
279
  }
280
280
 
281
- complementFlowChart(paths, indexPath) {
282
- console.log("complementFlowChart...");
283
- return this.loadFlowChartInternal(paths, false, indexPath);
281
+ complementFlowChart(paths, indexPath, parentNode) {
282
+ //console.log(`complementFlowChart indexPath=${indexPath}`);
283
+ return this.loadFlowChartInternal(paths, false, indexPath, parentNode);
284
284
  }
285
285
 
286
- loadFlowChartInternal(paths, initialize, indexPath) {
286
+ loadFlowChartInternal(paths, initialize, indexPath, parentNode = {}) {
287
+ //console.log(`loadFlowChartInternal indexPath=${indexPath}`);
287
288
  if (initialize) {
288
289
  this.flowchart = {
289
290
  shapes: [],
@@ -316,7 +317,12 @@ class FlowChartExec {
316
317
  // Write metadata of node
317
318
  const placeMetadata = (node) => {
318
319
  node.indexPath = indexPath;
320
+ // Read the parent meta
321
+ if (parentNode.meta) {
322
+ SimpleObj.recreate(node, "meta", JSON.parse(JSON.stringify(parentNode.meta)));
323
+ }
319
324
  SimpleObj.recreate(node, `meta.${indexPath}`, index);
325
+ //console.log(node.prefix + ":" + JSON.stringify(node.meta));
320
326
  }
321
327
  localFlowChart.shapes.forEach(placeMetadata);
322
328
  localFlowChart.arrows.forEach(placeMetadata);
@@ -391,7 +397,9 @@ class FlowChartExec {
391
397
  if (node.meta) {
392
398
  // Render skiping meta
393
399
  const skipUndefined = true;
400
+ //console.log(`${rendered} ${JSON.stringify(node.meta)}`);
394
401
  rendered = this.renderer.render(rendered, node.meta, skipUndefined);
402
+ //console.log(`${rendered}`);
395
403
  }
396
404
  rendered = this.renderer.render(rendered, this.data);
397
405
  let value;
@@ -418,7 +426,7 @@ class FlowChartExec {
418
426
  let instance = this.createInstance(commandName, id, txt, args);
419
427
  index++;
420
428
  const response1 = `${commandName}${JSON.stringify(args)}`;
421
- const { canContinue, abort } = await instance.executeAsNode(args, argsTxt);
429
+ const { canContinue, abort } = await instance.executeAsNode(args, argsTxt, node);
422
430
  if (abort) {
423
431
  // Panic and halt all
424
432
  this.mustEnd = true;
@@ -455,7 +463,7 @@ class FlowChartExec {
455
463
  }
456
464
  index++;
457
465
  const response1 = `${commandName}${JSON.stringify(args)}`;
458
- const { canContinue, abort } = await instance.executeAsArrow(args, argsTxt);
466
+ const { canContinue, abort } = await instance.executeAsArrow(args, argsTxt, node);
459
467
  if (abort) {
460
468
  // Panic and halt all
461
469
  this.mustEnd = true;
@@ -66,7 +66,8 @@ class StepBasic {
66
66
  SimpleObj.recreate(this.context.data, `performance.${id}.time`, val.time);
67
67
  }
68
68
  }
69
- async executeAsNode(args, argsTxtIndividual) {
69
+ async executeAsNode(args, argsTxtIndividual, node) {
70
+ this.node = node;
70
71
  this.argsTxtIndividual = argsTxtIndividual;
71
72
  const answer = {
72
73
  canContinue: false,
@@ -100,7 +101,8 @@ class StepBasic {
100
101
  return answer;
101
102
  }
102
103
  }
103
- async executeAsArrow(args, argsTxtIndividual) {
104
+ async executeAsArrow(args, argsTxtIndividual, node) {
105
+ this.node = node;
104
106
  this.argsTxtIndividual = argsTxtIndividual;
105
107
  const answer = {
106
108
  canContinue: false,
@@ -38,13 +38,15 @@ class StepMultiple extends StepBasic {
38
38
  }
39
39
  if (routeMultiple) {
40
40
  const extraConfiguration = {};
41
-
41
+ let prefixName = `${flowChartTemplateName}_`;
42
+ if (typeof this.node.prefix == "string") {
43
+ prefixName = this.node.prefix + "_" + prefixName;
44
+ }
42
45
  for (let i = 0; i < this.list.length; i++) {
43
- extraConfiguration[`${flowChartTemplateName}_${i}`] = routeMultiple;
46
+ extraConfiguration[prefixName + i] = routeMultiple;
44
47
  }
45
48
  this.completePaths(extraConfiguration, WORKSPACE);
46
-
47
- roomData.model.flowchart = this.context.complementFlowChart(extraConfiguration, indexPath);
49
+ roomData.model.flowchart = this.context.complementFlowChart(extraConfiguration, indexPath, this.node);
48
50
  let changes = roomData.builder.trackDifferences(roomData.model, [], null, ["flowchart"]);
49
51
  roomData.model = roomData.builder.affect(changes);
50
52
  superContext.emitToRoom(room, "flowChartModified");