@ejfdelgado/ejflab-common 1.0.0

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.
Files changed (88) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +2 -0
  3. package/package.json +29 -0
  4. package/src/CollisionsEngine.js +252 -0
  5. package/src/CsvFormatter.js +54 -0
  6. package/src/CsvFormatter.test.js +119 -0
  7. package/src/CsvFormatterFilters.js +79 -0
  8. package/src/CsvParser.js +51 -0
  9. package/src/CsvParser.test.js +41 -0
  10. package/src/CsvWithFilters.js +114 -0
  11. package/src/FaceEncoder.js +64 -0
  12. package/src/FlowChartDiagram.js +503 -0
  13. package/src/IdGen.js +211 -0
  14. package/src/ModuloDatoSeguro.js +142 -0
  15. package/src/ModuloDatoSeguro.test.js +29 -0
  16. package/src/ModuloDatoSeguro.test.mjs +45 -0
  17. package/src/ModuloDatoSeguroBack.mjs +55 -0
  18. package/src/ModuloDatoSeguroFront.js +73 -0
  19. package/src/ModuloSonido.js +83 -0
  20. package/src/ModuloVideos.js +51 -0
  21. package/src/MyColor.js +136 -0
  22. package/src/MyColor.test.js +37 -0
  23. package/src/MyConstants.js +147 -0
  24. package/src/MyCookies.js +34 -0
  25. package/src/MyDates.js +412 -0
  26. package/src/MyDates.test.js +26 -0
  27. package/src/MyDatesBack.mjs +21 -0
  28. package/src/MyDatesFront.js +41 -0
  29. package/src/MyJsPdf.js +52 -0
  30. package/src/MyRoutes.js +29 -0
  31. package/src/MyTemplate.js +272 -0
  32. package/src/MyTemplate.test.js +90 -0
  33. package/src/MyTensorflow.js +248 -0
  34. package/src/MyTensorflow.test.js +19 -0
  35. package/src/MyTensorflowBack.mjs +33 -0
  36. package/src/MyThrottle.js +80 -0
  37. package/src/MyTuples.js +445 -0
  38. package/src/MyTuples.test.js +330 -0
  39. package/src/MyUtilities.js +137 -0
  40. package/src/SimpleObj.js +153 -0
  41. package/src/SimpleObj.test.js +58 -0
  42. package/src/TriangulacionGeometric.js +335 -0
  43. package/src/changePath.js +38 -0
  44. package/src/data/case0.csv +3 -0
  45. package/src/data/case0.json +24 -0
  46. package/src/data/case1.csv +2 -0
  47. package/src/data/case1.json +24 -0
  48. package/src/data/case2.csv +3 -0
  49. package/src/data/case2.json +24 -0
  50. package/src/data/case3.csv +3 -0
  51. package/src/data/case3.json +24 -0
  52. package/src/data/format0.json +0 -0
  53. package/src/data/format0.txt +1 -0
  54. package/src/data/tensordata.csv +10 -0
  55. package/src/data/tensordata.json +37 -0
  56. package/src/data/tensordata.test.csv +10 -0
  57. package/src/data/tensormodel.json +113 -0
  58. package/src/fft.js +224 -0
  59. package/src/flowchart/FlowChartExec.js +763 -0
  60. package/src/flowchart/steps/CommandBasic.js +32 -0
  61. package/src/flowchart/steps/CommandInc.js +19 -0
  62. package/src/flowchart/steps/CommandMilvus.js +47 -0
  63. package/src/flowchart/steps/CommandMinio.js +28 -0
  64. package/src/flowchart/steps/CommandMongo.js +59 -0
  65. package/src/flowchart/steps/CommandPrint.js +12 -0
  66. package/src/flowchart/steps/CommandSet.js +14 -0
  67. package/src/flowchart/steps/CommandTimeline.js +21 -0
  68. package/src/flowchart/steps/CommandTimelineNext.js +28 -0
  69. package/src/flowchart/steps/StepBasic.js +184 -0
  70. package/src/flowchart/steps/StepCheckProcessor.js +26 -0
  71. package/src/flowchart/steps/StepCheckSrc.js +42 -0
  72. package/src/flowchart/steps/StepIsTrue.js +12 -0
  73. package/src/flowchart/steps/StepOneTime.js +21 -0
  74. package/src/flowchart/steps/StepProcess.js +163 -0
  75. package/src/flowchart/steps/StepReadSrc.js +66 -0
  76. package/src/flowchart/steps/StepSleep.js +22 -0
  77. package/src/flowchart/steps/StepTimeLineEnds.js +21 -0
  78. package/src/flowchart/steps/StepTimeLineHasMore.js +16 -0
  79. package/src/gif/index.d.ts +20 -0
  80. package/src/gif/index.mjs +85 -0
  81. package/src/gif/utils/checkTypes.d.ts +2 -0
  82. package/src/gif/utils/checkTypes.mjs +11 -0
  83. package/src/js-colormaps.js +19484 -0
  84. package/src/sortify.js +75 -0
  85. package/src/sqlmodelparser/SqlModelParser.js +22 -0
  86. package/src/test/csv/test_1000_20230429204538700.csv +1001 -0
  87. package/src/test/csv/test_5_20230429204525930.csv +6 -0
  88. package/src/test/svg/test.html +5 -0
@@ -0,0 +1,32 @@
1
+ const { StepBasic } = require("./StepBasic");
2
+
3
+ class CommandBasic extends StepBasic {
4
+ constructor(context, id, commandName, argsTxt) {
5
+ super(context, id, commandName, argsTxt);
6
+ super.alwaysEvaluateCanContinue = false;
7
+ super.autoDelete = true;
8
+ }
9
+ async canContinue() {
10
+ return true;
11
+ }
12
+ async execLast(options = {}) {
13
+ const lastArg = this.args[this.args.length - 1];
14
+ if (options.isCommand || ["always", "start"].indexOf(lastArg) >= 0) {
15
+ if (lastArg == "always") {
16
+ super.alwaysEvaluateCanContinue = true;
17
+ }
18
+ return await this.computation();
19
+ }
20
+ }
21
+ async arrowAccepted() {
22
+ const lastArg = this.args[this.args.length - 1];
23
+ if (lastArg == "end") {
24
+ return await this.computation();
25
+ }
26
+ }
27
+ async computation() { }
28
+ }
29
+
30
+ module.exports = {
31
+ CommandBasic
32
+ };
@@ -0,0 +1,19 @@
1
+ const { SimpleObj } = require("../../SimpleObj");
2
+ const { CommandBasic } = require("./CommandBasic");
3
+
4
+ class CommandInc extends CommandBasic {
5
+ async computation() {
6
+ const path = this.args[0];
7
+ let ammount = 1;
8
+ if (typeof this.args[1] == "number") {
9
+ ammount = this.args[1];
10
+ }
11
+ let old = SimpleObj.getValue(this.context.data, path, 0);
12
+ old += ammount;
13
+ SimpleObj.recreate(this.context.data, path, old);
14
+ }
15
+ }
16
+
17
+ module.exports = {
18
+ CommandInc
19
+ };
@@ -0,0 +1,47 @@
1
+ const { SimpleObj } = require("../../SimpleObj");
2
+ const { CommandBasic } = require("./CommandBasic");
3
+
4
+ class CommandMilvus extends CommandBasic {
5
+ async dataBaseRecreate(milvusSrv, client, dataBaseName) {
6
+ //await milvusSrv.introspect(client);
7
+ await milvusSrv.useDatabase(client, dataBaseName, true);
8
+ }
9
+ async dataBaseCreate(milvusSrv, client, dataBaseName) {
10
+ //await milvusSrv.introspect(client);
11
+ await milvusSrv.useDatabase(client, dataBaseName, false);
12
+ }
13
+ async collectionCreate(milvusSrv, client, dataBaseName, configuration) {
14
+ await milvusSrv.useDatabase(client, dataBaseName, false);
15
+ await milvusSrv.createCollectionWithSchema(client, configuration);
16
+ }
17
+ async computation() {
18
+ const action = this.args[0];
19
+ const dataBaseName = this.args[1];
20
+
21
+ const milvusSrv = this.context.getSuperContext().getMilvusClient();
22
+ const { client } = milvusSrv.connect();
23
+ if (action == "database.create") {
24
+ await this.dataBaseCreate(milvusSrv, client, dataBaseName);
25
+ } else if (action == "database.recreate") {
26
+ await this.dataBaseRecreate(milvusSrv, client, dataBaseName);
27
+ } else if (action == "collection.create") {
28
+ const collectionConfig = this.args[2];
29
+ const configuration = SimpleObj.getValue(this.context.data, collectionConfig, null);
30
+ if (configuration) {
31
+ await this.collectionCreate(milvusSrv, client, dataBaseName, configuration);
32
+ } else {
33
+ throw new Error(`No MILVUS configuration in ${collectionConfig}`);
34
+ }
35
+ } else if (action == "introspect") {
36
+ await milvusSrv.introspect(client);
37
+ } else if (action == "database.destroy") {
38
+ await milvusSrv.dropDatabase(client, dataBaseName);
39
+ } else if (action == "database.destroy_temp") {
40
+ await milvusSrv.dropDatabaseTemp(client);
41
+ }
42
+ }
43
+ }
44
+
45
+ module.exports = {
46
+ CommandMilvus
47
+ };
@@ -0,0 +1,28 @@
1
+ const { SimpleObj } = require("../../SimpleObj");
2
+ const { CommandBasic } = require("./CommandBasic");
3
+
4
+ class CommandMinio extends CommandBasic {
5
+ async computation() {
6
+ const action = this.args[0];
7
+ const bucketName = this.args[1];
8
+ const minioSrv = this.context.getSuperContext().getMinioClient();
9
+
10
+ if (action == "write") {
11
+ const objectPath = this.args[2];
12
+ const sourcePath = this.args[3];
13
+ const metadata = this.args[4];
14
+ //console.log(`CommandMinio.write bucket ${bucketName} objectPath ${objectPath} from ${sourcePath}`);
15
+ //console.log(metadata);
16
+ const bytes = this.resolveArgument(sourcePath);
17
+ // Armar el payload para minio
18
+ const payload = {
19
+ objectPath, bytes, metadata
20
+ }
21
+ await minioSrv.writeFileLocal(bucketName, [payload]);
22
+ }
23
+ }
24
+ }
25
+
26
+ module.exports = {
27
+ CommandMinio
28
+ };
@@ -0,0 +1,59 @@
1
+ const { SimpleObj } = require("../../SimpleObj");
2
+ const { CommandBasic } = require("./CommandBasic");
3
+
4
+ class CommandMongo extends CommandBasic {
5
+ async computation() {
6
+ const action = this.args[0];
7
+ const dataBaseName = this.args[1];
8
+
9
+ const mongoSrv = this.context.getSuperContext().getMongoClient();
10
+ if (action == "write") {
11
+ const collectionName = this.args[2];
12
+ const path = this.args[3];
13
+ let payload = SimpleObj.getValue(this.context.data, path, null);
14
+ payload = JSON.parse(JSON.stringify(payload));
15
+ await mongoSrv.writeLocal(dataBaseName, collectionName, payload);
16
+ } else if (action == "read") {
17
+ const path = this.args[2];
18
+ const payload = {
19
+ where: this.args[3],
20
+ };
21
+ const response = await mongoSrv.readLocal(dataBaseName, payload);
22
+ if (response.list) {
23
+ SimpleObj.recreate(this.context.data, path, response.list);
24
+ } else {
25
+ console.log(`No list found ${JSON.stringify(response)}`);
26
+ }
27
+ } else if (action == "delete") {
28
+ const payload = {
29
+ where: this.args[2],
30
+ };
31
+ const response = await mongoSrv.deleteLocal(dataBaseName, payload);
32
+ console.log(response);
33
+ } else if (action == "update") {
34
+ const path = this.args[2];
35
+ const payload = {
36
+ where: this.args[3],
37
+ update: SimpleObj.getValue(this.context.data, path, null),
38
+ };
39
+ const response = await mongoSrv.updateLocal(dataBaseName, payload);
40
+ console.log(response);
41
+ } else if (action == "index") {
42
+ const collectionName = this.args[2];
43
+ const path = this.args[3];
44
+ const payload = SimpleObj.getValue(this.context.data, path, null);
45
+ const response = await mongoSrv.indexLocal(dataBaseName, collectionName, payload);
46
+ console.log(response);
47
+ } else if (action == "create") {
48
+ const collectionName = this.args[2];
49
+ const path = this.args[3];
50
+ const payload = SimpleObj.getValue(this.context.data, path, null);
51
+ const response = await mongoSrv.createLocal(dataBaseName, collectionName, payload);
52
+ console.log(response);
53
+ }
54
+ }
55
+ }
56
+
57
+ module.exports = {
58
+ CommandMongo
59
+ };
@@ -0,0 +1,12 @@
1
+
2
+ const { CommandBasic } = require("./CommandBasic");
3
+
4
+ class CommandPrint extends CommandBasic {
5
+ async computation() {
6
+ console.log(this.args.join(" "));
7
+ }
8
+ }
9
+
10
+ module.exports = {
11
+ CommandPrint
12
+ };
@@ -0,0 +1,14 @@
1
+ const { SimpleObj } = require("../../SimpleObj");
2
+ const { CommandBasic } = require("./CommandBasic");
3
+
4
+ class CommandSet extends CommandBasic {
5
+ async computation() {
6
+ const path = this.args[0];
7
+ const val = this.args[1];
8
+ SimpleObj.recreate(this.context.data, path, val);
9
+ }
10
+ }
11
+
12
+ module.exports = {
13
+ CommandSet
14
+ };
@@ -0,0 +1,21 @@
1
+ const { SimpleObj } = require("../../SimpleObj");
2
+ const { CommandBasic } = require("./CommandBasic");
3
+
4
+ class CommandTimeline extends CommandBasic {
5
+ async computation() {
6
+ const timeLineId = this.args[0];
7
+ const start = parseFloat(this.args[1]);
8
+ const end = parseFloat(this.args[2]);
9
+ const period = parseFloat(this.args[3]);
10
+ const timeline = {
11
+ start,
12
+ end,
13
+ period,
14
+ };
15
+ this.context.registerTimeline(timeLineId, timeline);
16
+ }
17
+ }
18
+
19
+ module.exports = {
20
+ CommandTimeline
21
+ };
@@ -0,0 +1,28 @@
1
+ const { CommandBasic } = require("./CommandBasic");
2
+ const { SimpleObj } = require("../../SimpleObj");
3
+
4
+ class CommandTimelineNext extends CommandBasic {
5
+ async computation() {
6
+ const timeLineId = this.args[0];
7
+ const timeline = this.context.getTimeLine(timeLineId);
8
+ if (!timeline) {
9
+ return;
10
+ }
11
+ if ([null, undefined].indexOf(timeline.t) >= 0) {
12
+ timeline.t = timeline.start;
13
+ } else {
14
+ timeline.t = timeline.t + timeline.period;
15
+ if (timeline.t > timeline.end) {
16
+ timeline.t = timeline.end;
17
+ }
18
+ }
19
+ // Compute advance percentage
20
+ const percentage = (timeline.t - timeline.start) / (timeline.end - timeline.start);
21
+ SimpleObj.recreate(this.context.data, "scope.progress", Math.ceil(percentage * 100));
22
+
23
+ }
24
+ }
25
+
26
+ module.exports = {
27
+ CommandTimelineNext
28
+ };
@@ -0,0 +1,184 @@
1
+ const { SimpleObj } = require("../../SimpleObj");
2
+
3
+ class StepBasic {
4
+ maxErrorCount = 3;
5
+ timeOutMillis = 60000;
6
+ //
7
+ firstTime = true;
8
+ fired = false;
9
+ // Si ya evaluó a true no debe volver a invocar canContinue
10
+ alwaysEvaluateCanContinue = true;
11
+ autoDelete = true;
12
+ args = [];
13
+ lastErrorTime = null;
14
+ errorCount = 0;
15
+ nextTry = null;
16
+ commandName;
17
+ argsTxt;
18
+ fireTime;
19
+ constructor(context, id, commandName, argsTxt) {
20
+ this.context = context;
21
+ this.id = id;
22
+ this.commandName = commandName;
23
+ this.argsTxt = argsTxt;
24
+ }
25
+ setTimeout(value) {
26
+ this.timeOutMillis = value * 1000;
27
+ }
28
+ setMaxTries(value) {
29
+ this.maxErrorCount = value;
30
+ }
31
+ async executeAsNode(args) {
32
+ const answer = {
33
+ canContinue: false,
34
+ abort: false,
35
+ };
36
+ if (this.reachMaxErrors()) {
37
+ answer.abort = true;
38
+ const message = `Abort at ${this.argsTxt} after ${this.errorCount} retries.`;
39
+ const room = this.context.getRoom();
40
+ this.context.io.to(room).emit("myerror", { origin: "StepBasic.executeAsNode", message: message });
41
+ return answer;
42
+ }
43
+ if (typeof this.nextTry == "number") {
44
+ const ahora = new Date().getTime();
45
+ if (ahora <= this.nextTry) {
46
+ return answer;
47
+ }
48
+ }
49
+ try {
50
+ this.args = args;
51
+ await this.execFirst();
52
+ await this.execLast({ isCommand: true });
53
+ answer.canContinue = true;
54
+ this.resetErrorState();
55
+ return answer;
56
+ } catch (err) {
57
+ this.handleError(err);
58
+ answer.canContinue = false;
59
+ return answer;
60
+ }
61
+ }
62
+ async executeAsArrow(args) {
63
+ const answer = {
64
+ canContinue: false,
65
+ abort: false,
66
+ };
67
+ if (this.reachMaxErrors()) {
68
+ answer.abort = true;
69
+ const message = `Abort at ${this.argsTxt} after ${this.errorCount} retries.`;
70
+ const room = this.context.getRoom();
71
+ this.context.io.to(room).emit("myerror", { origin: "StepBasic.executeAsArrow", message: message });
72
+ return answer;
73
+ }
74
+ if (typeof this.nextTry == "number") {
75
+ const ahora = new Date().getTime();
76
+ if (ahora <= this.nextTry) {
77
+ return answer;
78
+ }
79
+ }
80
+ try {
81
+ this.args = args;
82
+ if (this.alwaysEvaluateCanContinue == false) {
83
+ if (this.fired) {
84
+ answer.canContinue = true;
85
+ return answer;
86
+ }
87
+ }
88
+ if (this.firstTime) {
89
+ const done = await this.execFirst();
90
+ if (done === false) {
91
+ return answer;
92
+ }
93
+ this.firstTime = false;
94
+ this.fireTime = new Date().getTime();
95
+ }
96
+ answer.canContinue = await this.canContinue();
97
+ if (answer.canContinue) {
98
+ await this.execLast();
99
+ this.fired = true;
100
+ this.resetErrorState();
101
+ } else {
102
+ //Check ellapsed time
103
+ const now = new Date().getTime();
104
+ const duration = now - this.fireTime;
105
+ if (duration > this.timeOutMillis) {
106
+ const message = `Timeout for ${this.argsTxt} after ${duration} milliseconds`;
107
+ // It breaks the timeout threshold
108
+ // Erase the pendig call to ignore eventual arrive of response...
109
+ if (!this.context.canRetry(this.pendingCall, new Error(message))) {
110
+ this.context.stop();
111
+ return;
112
+ } else {
113
+ this.context.clearPendingCall(this.pendingCall);
114
+ }
115
+ }
116
+ }
117
+
118
+ return answer;
119
+ } catch (err) {
120
+ this.handleError(err);
121
+ answer.canContinue = false;
122
+ return answer;
123
+ }
124
+ }
125
+ reachMaxErrors() {
126
+ const reached = this.errorCount >= this.maxErrorCount;
127
+ return reached;
128
+ }
129
+ resetErrorState() {
130
+ this.errorCount = 0;
131
+ this.lastErrorTime = null;
132
+ this.nextTry = null;
133
+ }
134
+ async handleError(error) {
135
+ const { stack } = error;
136
+ this.errorCount++;
137
+ this.lastErrorTime = new Date().getTime();
138
+ const room = this.context.getRoom();
139
+ if (!this.reachMaxErrors()) {
140
+ const delay = 1000 * Math.exp(this.errorCount) / Math.exp(1);
141
+ this.nextTry = delay + this.lastErrorTime;
142
+ const message = `Error at ${this.argsTxt} #${this.errorCount}. Retrying in ${delay.toFixed(0)} ms. ${stack}`;
143
+ this.context.io.to(room).emit("myerror", { origin: "StepBasic", message: message });
144
+ } else {
145
+ const message = `Error at ${this.argsTxt} #${this.errorCount}. ${stack}`;
146
+ this.context.io.to(room).emit("myerror", { origin: "StepBasic", message: message });
147
+ }
148
+ }
149
+ async execFirst() { }
150
+ async canContinue() { return true; }
151
+ async execLast() { }
152
+ async arrowAccepted() { }
153
+ async destroy() { }
154
+
155
+ readInputFrom(isBuffer, sourceId, pathId, completePath) {
156
+ let buffer = null;
157
+ if (isBuffer) {
158
+ // It reads from buffer
159
+ buffer = this.context.readBufferData(sourceId, pathId);
160
+ if (!buffer) {
161
+ console.log(`No buffer in ${sourceId} ${pathId}`);
162
+ return undefined;
163
+ }
164
+ } else {
165
+ // It reads from data model
166
+ buffer = SimpleObj.getValue(this.context.data, completePath, null);
167
+ }
168
+ return buffer;
169
+ }
170
+
171
+ resolveArgument(val) {
172
+ const partsSource = /^(b\.([^.]+)\.([^.]+)|d\.(.+))$/i.exec(val);
173
+ if (partsSource == null) {
174
+ console.log(`${val} doesn't match ^(b\.([^.]+)\.([^.]+)|d\.(.+))$`);
175
+ return undefined;
176
+ }
177
+ const buffer = this.readInputFrom(!partsSource[4], partsSource[2], partsSource[3], partsSource[4]);
178
+ return buffer;
179
+ }
180
+ }
181
+
182
+ module.exports = {
183
+ StepBasic
184
+ }
@@ -0,0 +1,26 @@
1
+ const { StepBasic } = require("./StepBasic");
2
+ const { SimpleObj } = require("../../SimpleObj");
3
+
4
+ class StepCheckProcessor extends StepBasic {
5
+ constructor(context, id, commandName, argsTxt) {
6
+ super(context, id, commandName, argsTxt);
7
+ super.alwaysEvaluateCanContinue = true;
8
+ }
9
+ async execFirst() {
10
+ }
11
+
12
+ async canContinue() {
13
+ for (let i = 0; i < this.args.length; i++) {
14
+ const processorUID = this.args[i];
15
+ const socket = SimpleObj.getValue(this.context.data, `state.processors.${processorUID}.socket`, null);
16
+ if (!socket) {
17
+ return false;
18
+ }
19
+ }
20
+ return true;
21
+ }
22
+ }
23
+
24
+ module.exports = {
25
+ StepCheckProcessor
26
+ };
@@ -0,0 +1,42 @@
1
+ const { StepBasic } = require("./StepBasic");
2
+ const { SimpleObj } = require("../../SimpleObj");
3
+
4
+ class StepCheckSrc extends StepBasic {
5
+ socketId = null;
6
+ configuration = null;
7
+ constructor(context, id, commandName, argsTxt) {
8
+ super(context, id, commandName, argsTxt);
9
+ super.alwaysEvaluateCanContinue = false;
10
+ }
11
+ async execFirst() {
12
+ const sourceUID = this.args[0];
13
+ if (this.context.io) {
14
+ // Leo la ruta del sourceUID
15
+ const configuration = SimpleObj.getValue(this.context.data, `state.sources.${sourceUID}`, null);
16
+ this.socketId = configuration.socket;
17
+ if (this.socketId) {
18
+ this.context.io.to(this.socketId).emit("checkSrc", configuration);
19
+ }
20
+ }
21
+ }
22
+
23
+ async canContinue() {
24
+ const sourceUID = this.args[0];
25
+ if (!this.socketId) {
26
+ return false;
27
+ }
28
+ // Debe validar que todos las configuraciones hayan sido respondidas sin error
29
+ const configuration = SimpleObj.getValue(this.context.data, `state.sources.${sourceUID}`, null);
30
+ for (let key in configuration.data) {
31
+ const oneConf = configuration.data[key];
32
+ if (!oneConf.metadata) {
33
+ return false;
34
+ }
35
+ }
36
+ return true;
37
+ }
38
+ }
39
+
40
+ module.exports = {
41
+ StepCheckSrc
42
+ };
@@ -0,0 +1,12 @@
1
+ const { StepBasic } = require("./StepBasic");
2
+
3
+ class StepIsTrue extends StepBasic {
4
+ async canContinue() {
5
+ const result = this.args[0];
6
+ return result;
7
+ }
8
+ }
9
+
10
+ module.exports = {
11
+ StepIsTrue
12
+ };
@@ -0,0 +1,21 @@
1
+ const { StepBasic } = require("./StepBasic");
2
+
3
+ class StepOneTime extends StepBasic {
4
+ executed = false;
5
+ constructor(context, id, commandName, argsTxt) {
6
+ super(context, id, commandName, argsTxt);
7
+ super.autoDelete = false;
8
+ }
9
+
10
+ async canContinue() {
11
+ return !this.executed;
12
+ }
13
+
14
+ async arrowAccepted() {
15
+ this.executed = true;
16
+ }
17
+ }
18
+
19
+ module.exports = {
20
+ StepOneTime
21
+ };