@ejfdelgado/ejflab-common 1.7.0 → 1.7.1

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.7.0",
4
+ "version": "1.7.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/ejfdelgado/ejflab-common.git"
@@ -273,13 +273,23 @@ class FlowChartExec {
273
273
  }
274
274
 
275
275
  loadFlowChart(paths) {
276
- this.flowchart = {
277
- shapes: [],
278
- arrows: [],
279
- prefixes: [],
280
- flux: {},
281
- };
282
- this.nodesById = {};
276
+ return this.loadFlowChartInternal(paths, true);
277
+ }
278
+
279
+ complementFlowChart(paths) {
280
+ return this.loadFlowChartInternal(paths, false);
281
+ }
282
+
283
+ loadFlowChartInternal(paths, initialize) {
284
+ if (initialize) {
285
+ this.flowchart = {
286
+ shapes: [],
287
+ arrows: [],
288
+ prefixes: [],
289
+ flux: {},
290
+ };
291
+ this.nodesById = {};
292
+ }
283
293
  const options = {
284
294
  ignoreAttributes: false,
285
295
  };
@@ -1,4 +1,5 @@
1
1
  const { StepBasic } = require("./StepBasic");
2
+ const { SimpleObj } = require("../../SimpleObj");
2
3
 
3
4
  class StepMultiple extends StepBasic {
4
5
  list = [];
@@ -6,9 +7,31 @@ class StepMultiple extends StepBasic {
6
7
  super(context, id, commandName, argsTxt);
7
8
  super.alwaysEvaluateCanContinue = true;
8
9
  }
10
+ completePaths(objeto, WORKSPACE) {
11
+ if (!objeto) {
12
+ return;
13
+ }
14
+ for (let llave in objeto) {
15
+ let valor = objeto[llave];
16
+ if (typeof valor == "string") {
17
+ valor = valor.replaceAll("${WORKSPACE}", WORKSPACE);
18
+ objeto[llave] = valor;
19
+ }
20
+ }
21
+ }
9
22
  async execFirst() {
23
+ // Reads the list to iterate
24
+ this.list = SimpleObj.getValue(this.context.data, this.args[1], []);
25
+ const WORKSPACE = SimpleObj.getValue(this.context.data, "env.WORKSPACE", "./");
26
+ //console.log(`WORKSPACE=${WORKSPACE}`);
27
+ //console.log(`My list ${JSON.stringify(this.list)}`);
28
+ // Loads the draw.io file
10
29
  const flowChartTemplateName = this.args[0];
11
- this.list = this.args[1];
30
+ const extraConfiguration = {
31
+ Print: '${WORKSPACE}/flowcharts/multiple/flow01N.drawio',
32
+ };
33
+ this.completePaths(extraConfiguration, WORKSPACE);
34
+ this.context.complementFlowChart(extraConfiguration);
12
35
  }
13
36
 
14
37
  async canContinue() {