@ejfdelgado/ejflab-common 1.6.1 → 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.6.1",
4
+ "version": "1.7.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/ejfdelgado/ejflab-common.git"
@@ -27,6 +27,7 @@ const { CommandPrint } = require('./steps/CommandPrint');
27
27
  const { CommandMongo } = require('./steps/CommandMongo');
28
28
  const { CommandMinio } = require('./steps/CommandMinio');
29
29
  const { CommandPostgres } = require('./steps/CommandPostgres.js');
30
+ const { StepMultiple } = require('./steps/StepMultiple.js');
30
31
 
31
32
  class FlowChartExec {
32
33
  executionPromise = null;
@@ -59,6 +60,7 @@ class FlowChartExec {
59
60
  this.registry["timelineHasMore"] = StepTimeLineHasMore;
60
61
  this.registry["process"] = StepProcess;
61
62
  this.registry["require"] = StepCheckProcessor;
63
+ this.registry["multiple"] = StepMultiple;
62
64
 
63
65
  // Nodes
64
66
  this.registry["inc"] = CommandInc;
@@ -271,13 +273,23 @@ class FlowChartExec {
271
273
  }
272
274
 
273
275
  loadFlowChart(paths) {
274
- this.flowchart = {
275
- shapes: [],
276
- arrows: [],
277
- prefixes: [],
278
- flux: {},
279
- };
280
- 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
+ }
281
293
  const options = {
282
294
  ignoreAttributes: false,
283
295
  };
@@ -0,0 +1,44 @@
1
+ const { StepBasic } = require("./StepBasic");
2
+ const { SimpleObj } = require("../../SimpleObj");
3
+
4
+ class StepMultiple extends StepBasic {
5
+ list = [];
6
+ constructor(context, id, commandName, argsTxt) {
7
+ super(context, id, commandName, argsTxt);
8
+ super.alwaysEvaluateCanContinue = true;
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
+ }
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
29
+ const flowChartTemplateName = this.args[0];
30
+ const extraConfiguration = {
31
+ Print: '${WORKSPACE}/flowcharts/multiple/flow01N.drawio',
32
+ };
33
+ this.completePaths(extraConfiguration, WORKSPACE);
34
+ this.context.complementFlowChart(extraConfiguration);
35
+ }
36
+
37
+ async canContinue() {
38
+ return true;
39
+ }
40
+ }
41
+
42
+ module.exports = {
43
+ StepMultiple
44
+ };