@ejfdelgado/ejflab-common 1.10.4 → 1.10.6

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.10.4",
4
+ "version": "1.10.6",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/ejfdelgado/ejflab-common.git"
@@ -13,6 +13,8 @@ const { StepCheckSrc } = require("./steps/StepCheckSrc");
13
13
 
14
14
  const { CommandInc } = require("./steps/CommandInc");
15
15
  const { CommandSet } = require("./steps/CommandSet");
16
+ const { CommandTic } = require("./steps/CommandTic");
17
+ const { CommandToc } = require("./steps/CommandToc");
16
18
  const { StepReadSrc } = require('./steps/StepReadSrc');
17
19
  const { StepTimeLineEnds } = require('./steps/StepTimeLineEnds');
18
20
  const { StepTimeLineHasMore } = require('./steps/StepTimeLineHasMore');
@@ -67,6 +69,8 @@ class FlowChartExec {
67
69
  // Nodes
68
70
  this.registry["inc"] = CommandInc;
69
71
  this.registry["set"] = CommandSet;
72
+ this.registry["tic"] = CommandTic;
73
+ this.registry["toc"] = CommandToc;
70
74
  this.registry["timeline"] = CommandTimeline;
71
75
  this.registry["timelineNext"] = CommandTimelineNext;
72
76
  this.registry["milvus"] = CommandMilvus;
@@ -283,6 +287,26 @@ class FlowChartExec {
283
287
  return response;
284
288
  }
285
289
 
290
+ removeIndexPathNodes(prefix) {
291
+ let count = 0;
292
+ const noPrefix = (node) => {
293
+ // Erase node ids...
294
+ delete this.nodesById[node.id];
295
+ let pased = node.prefix != prefix;
296
+ if (!pased) {
297
+ count++;
298
+ }
299
+ return pased;
300
+ };
301
+ this.flowchart.shapes = this.flowchart.shapes.filter(noPrefix);
302
+ this.flowchart.arrows = this.flowchart.arrows.filter(noPrefix);
303
+ console.log(`Removed ${count} nodes from flowchart with prefix ${prefix}`);
304
+ const foudPrefix = this.flowchart.prefixes.indexOf(prefix);
305
+ if (foudPrefix >= 0) {
306
+ this.flowchart.prefixes.splice(foudPrefix, 1);
307
+ }
308
+ }
309
+
286
310
  loadFlowChart(paths) {
287
311
  return this.loadFlowChartInternal(paths, true);
288
312
  }
@@ -318,6 +342,9 @@ class FlowChartExec {
318
342
  const xmlFlowText = fs.readFileSync(path, 'utf8');
319
343
  const parser = new XMLParser(options);
320
344
  const xmlFlow = parser.parse(xmlFlowText);
345
+ // Previous clear old prefix
346
+ this.removeIndexPathNodes(prefix);
347
+ // Loads new nodes for prefix
321
348
  const localFlowChart = this.processFlowChart(xmlFlow, prefix);
322
349
  this.interpretColor(localFlowChart.shapes);
323
350
  //
@@ -337,11 +364,15 @@ class FlowChartExec {
337
364
  localFlowChart.arrows.forEach(placeMetadata);
338
365
  const startingPoints = this.getNodesWithText("start", undefined, localFlowChart);
339
366
  if (this.actualNodes instanceof Array && startingPoints instanceof Array) {
367
+ console.log(`Adding NEW #${startingPoints.length} starting points to flowchart`);
340
368
  this.actualNodes.push(...startingPoints);
341
369
  }
342
370
  }
343
371
  this.flowchart.shapes.push(...localFlowChart.shapes);
372
+ console.log(`Added ${localFlowChart.shapes.length} shapes with prefix ${prefix}`);
344
373
  this.flowchart.arrows.push(...localFlowChart.arrows);
374
+ console.log(`Added ${localFlowChart.arrows.length} arrows with prefix ${prefix}`);
375
+ console.log(`Added ${localFlowChart.arrows.length + localFlowChart.shapes.length} nodes with prefix ${prefix}`);
345
376
  this.flowchart.prefixes.push(prefix);
346
377
  if (check.flux) {
347
378
  for (let key in check.flux) {
@@ -1,4 +1,3 @@
1
- const { SimpleObj } = require("../../SimpleObj");
2
1
  const { CommandBasic } = require("./CommandBasic");
3
2
 
4
3
  class CommandSet extends CommandBasic {
@@ -0,0 +1,13 @@
1
+ const { CommandBasic } = require("./CommandBasic");
2
+
3
+ class CommandTic extends CommandBasic {
4
+ async computation() {
5
+ const path = this.args[0];
6
+ const val = new Date().getTime();
7
+ this.writeArgument(`${path}.tic`, val);
8
+ }
9
+ }
10
+
11
+ module.exports = {
12
+ CommandTic
13
+ };
@@ -0,0 +1,17 @@
1
+ const { CommandBasic } = require("./CommandBasic");
2
+
3
+ class CommandToc extends CommandBasic {
4
+ async computation() {
5
+ const path = this.args[0];
6
+ const val = new Date().getTime();
7
+ const tic = this.resolveArgument(`${path}.tic`);
8
+ this.writeArgument(`${path}.toc`, val);
9
+ if (typeof tic == "number") {
10
+ this.writeArgument(`${path}.gap`, val - tic);
11
+ }
12
+ }
13
+ }
14
+
15
+ module.exports = {
16
+ CommandToc
17
+ };