@ejfdelgado/ejflab-common 1.8.3 → 1.8.4

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.3",
4
+ "version": "1.8.4",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/ejfdelgado/ejflab-common.git"
package/src/MyTemplate.js CHANGED
@@ -209,7 +209,7 @@ class MyTemplate extends CsvWithFilters {
209
209
  } while (iteration.times > 0);
210
210
 
211
211
  // Replace values
212
- return this.replaceBareValues(template, data, "\\{", "\\}", "}", false, skipUndefined);
212
+ return this.replaceBareValues(template, data, undefined, undefined, undefined, false, skipUndefined);
213
213
  }
214
214
  replaceBareValues(template, data, open = "\\{", close = "\\}", closeNoScape = "}", useStringify = false, skipUndefined = false) {
215
215
  const myPattern = new RegExp("\\$\\s*" + open + "([^" + closeNoScape + "]+)\\s*" + close, "g");
@@ -28,6 +28,7 @@ const { CommandMongo } = require('./steps/CommandMongo');
28
28
  const { CommandMinio } = require('./steps/CommandMinio');
29
29
  const { CommandPostgres } = require('./steps/CommandPostgres.js');
30
30
  const { StepMultiple } = require('./steps/StepMultiple.js');
31
+ const { StepMultipleDone } = require('./steps/StepMultipleDone.js');
31
32
 
32
33
  class FlowChartExec {
33
34
  executionPromise = null;
@@ -61,6 +62,7 @@ class FlowChartExec {
61
62
  this.registry["process"] = StepProcess;
62
63
  this.registry["require"] = StepCheckProcessor;
63
64
  this.registry["multiple"] = StepMultiple;
65
+ this.registry["multipleDone"] = StepMultipleDone;
64
66
 
65
67
  // Nodes
66
68
  this.registry["inc"] = CommandInc;
@@ -318,6 +320,10 @@ class FlowChartExec {
318
320
  }
319
321
  localFlowChart.shapes.forEach(placeMetadata);
320
322
  localFlowChart.arrows.forEach(placeMetadata);
323
+ const startingPoints = this.getNodesWithText("start", undefined, localFlowChart);
324
+ if (this.actualNodes instanceof Array && startingPoints instanceof Array) {
325
+ this.actualNodes.push(...startingPoints);
326
+ }
321
327
  }
322
328
  this.flowchart.shapes.push(...localFlowChart.shapes);
323
329
  this.flowchart.arrows.push(...localFlowChart.arrows);
@@ -0,0 +1,30 @@
1
+ const { StepBasic } = require("./StepBasic");
2
+ const { SimpleObj } = require("../../SimpleObj");
3
+
4
+ class StepMultipleDone extends StepBasic {
5
+ list = [];
6
+ constructor(context, id, commandName, argsTxt) {
7
+ super(context, id, commandName, argsTxt);
8
+ super.alwaysEvaluateCanContinue = true;
9
+ }
10
+ async execFirst() { }
11
+
12
+ async canContinue() {
13
+ this.list = SimpleObj.getValue(this.context.data, this.args[0], []);
14
+ if (!(this.list instanceof Array)) {
15
+ console.log(`In StepMultipleDone, warning ${this.args[0]} is not a list!`);
16
+ return true;
17
+ }
18
+ for (let i = 0; i < this.list.length; i++) {
19
+ const element = this.list[i];
20
+ if (element.done !== true) {
21
+ return false;
22
+ }
23
+ }
24
+ return true;
25
+ }
26
+ }
27
+
28
+ module.exports = {
29
+ StepMultipleDone
30
+ };