@inteli.city/node-red-contrib-exec-collection 1.0.4 → 1.0.5

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/async.gpt.html DELETED
@@ -1,327 +0,0 @@
1
- <!--* header -->
2
- <script type="text/markdown" data-help-name="async.gpt">
3
- ## Overview
4
- Runs system commands on a queue and returns its output.
5
-
6
- ## How to use
7
- The template text on this node works exactly the same as the template node. On the `Command` input it allows you to use the command line. The template text written is a file called `$file`. Below there are some possible commands to run with it (considering these commands are installed on the system):
8
-
9
- * `bash $file`
10
- * `node $file`
11
- * `python3 $file`
12
- * `python3 -u $file` (spawn)
13
- * `Rscript $file`
14
- * `awk -f $file`
15
- * `psql postgresql://user:passwds@host:port/database -f $file`
16
- * `ogr2ogr -f GEOJSON /vsistdout/ PG:"host=host port=portnumber user=user password=password dbname=dbname" -sql "@$file"`
17
- * `ogr2ogr -f GEOJSON /vsistdout/ WFS:"http://wfspage" layername -sql "@$file"`
18
- * `cat $file | ssh -i /path/key user@ip bash -s`
19
- * `cat $file | ssh -i /path/key user@ip node -s`
20
- * `cat $file | ssh -i /path/key user@ip python3 -s`
21
- * `mv $file $file.mjs; node $file.mjs; rm $file.mjs`
22
- * `/usr/bin/time bash $file`
23
- * `valgrind bash $file`
24
-
25
- See more examples [here](https://www.npmjs.com/package/node-red-contrib-async.gpt).
26
- </script>
27
- <!--* node-design -->
28
- <script type="text/html" data-template-name="async.gpt">
29
- <div class="form-row">
30
- <label for="node-input-name">
31
- <i class="fa fa-tag"></i>
32
- <span data-i18n="node-red:common.label.name"></span>
33
- </label>
34
-
35
- <div style="display: inline-block; width: calc(100% - 105px)">
36
- <input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
37
- </div>
38
-
39
- </div>
40
-
41
- <div class="form-row">
42
- <label for="node-input-command">
43
- <i class="fa fa-file"></i>
44
- <span data-i18n="node-red:exec.label.command"></span>
45
- </label>
46
- <input style="display: inline-block; width: calc(100% - 108px);" type="text" id="node-input-command" data-i18n="[placeholder]node-red:exec.label.command">
47
-
48
- </div>
49
-
50
- <div class="form-row" style="position: relative;">
51
- <label>
52
- <i class="fa fa-sign-out"></i>
53
- <span>Queue</span>
54
- </label>
55
- <input style="width:60px" type="number" id="node-input-queue" value="1">
56
-
57
- <div style="position: absolute; right:0;display:inline-block; text-align: right; font-size: 0.8em;">
58
-
59
- <span style="margin-right:10px;font-size:9px;">No Output</span>
60
- <input type="checkbox" id="node-input-outputEmpty" style="display:inline-block; width:auto;margin-right:30px;">
61
-
62
- <!-- <span style="margin-right:10px;font-size:9px;">Vim Mode</span>
63
- <input type="checkbox" id="node-input-vimMode" style="display:inline-block; width:auto;margin-right:30px;">
64
- -->
65
- <!-- <span style="margin-right:10px;font-size:9px;">Debug Mode</span>
66
- <input type="checkbox" id="node-input-debugMode" style="display:inline-block; width:auto;margin-right:30px;">
67
- -->
68
- <span style="margin-right:10px;font-size:9px;">Cmd Template</span>
69
- <!-- <input type="checkbox" id="node-input-addpayCB" style="display:inline-block; width:auto;margin-right:30px;"> -->
70
- <input type="checkbox" id="node-input-cmdTemplate" style="display:inline-block; width:auto;margin-right:30px;">
71
-
72
- <input type="hidden" id="node-input-template" autofocus="autofocus">
73
-
74
- <span style="font-size:9px;" data-i18n="node-red:template.label.format"></span>:
75
- <select id="node-input-format" style="width:110px; font-size: 10px !important; height: 24px; padding:0;">
76
- <option value="handlebars">Mustache</option>
77
- <option value="javascript">Javascript</option>
78
- <option value="python">Python</option>
79
- <option value="sh">Shell</option>
80
- <option value="r">R</option>
81
- <option value="pgsql">PGSQL</option>
82
- <option value="nginx">NGINX</option>
83
- <option value="apache_conf">Apache</option>
84
- <option value="dockerfile">Dockerfile</option>
85
- <option value="terraform">Terraform</option>
86
- <option value="text" data-i18n="node-red:template.label.none"></option>
87
- </select>
88
- <button id="node-template-expand-editor" class="red-ui-button red-ui-button-small"><i class="fa fa-expand"></i></button>
89
- </div>
90
- </div>
91
- <div class="form-row node-text-editor-row">
92
- <div style="height: 250px; min-height:150px;" class="node-text-editor" id="node-input-template-editor" ></div>
93
- </div>
94
-
95
- <div class="form-row" style="margin-bottom:0px;">
96
- <label for="node-input-output"><i class="fa fa-long-arrow-right"></i> <span data-i18n="node-red:template.label.output"></span></label>
97
- <select id="node-input-output" style="width:170px;">
98
- <option value="str">Plain text</option>
99
- <option value="parsedJSON">Parsed JSON</option>
100
- <option value="parsedYAML">Parsed YAML</option>
101
- <option value="parsedXML">Parsed XML</option>
102
- </select>
103
-
104
-
105
- <label style="margin-left: 25px;">
106
- <i class="fa fa-sign-out"></i>
107
- <span>Mode</span>
108
- </label>
109
- <select type="text" id="node-input-useSpawn" style="width:12%;margin-left:-30px;">
110
- <option value="false">exec mode- when the command is complete</option>
111
- <option value="true">spawn mode- while the command is running</option>
112
- </select>
113
-
114
- <label style="margin-left: 25px;" for="node-input-field"><i class="fa fa-ellipsis-h"></i> <span data-i18n="node-red:common.label.property"></span></label>
115
- <input style="margin-left:-20px;width:130px;"type="text" id="node-input-field" placeholder="payload" >
116
- <input style="margin-left:-20px;width:130px;"type="hidden" id="node-input-fieldType">
117
-
118
- <span style="margin-left:20px;font-size:11px;">Split \n</span>
119
- <input type="checkbox" id="node-input-splitLine" style="display:inline-block; width:auto;margin-left:10px;">
120
- </div>
121
-
122
- </script>
123
- <!--* javascript -->
124
- <script type="text/javascript">
125
- //** defining-variables
126
- RED.nodes.registerType('async.gpt',{
127
- //color:"rgb(180, 100, 100)",
128
- color:"rgb(51, 153, 204)",
129
- category: 'function',
130
- defaults: {
131
- name: {value:""},
132
- currentLine: {row:0, column:0},
133
- command: {value:"node $file"},
134
- //append: {value:""},
135
- /* debugMode: {value:false}, */
136
- outputs: {value: 1},
137
- useSpawn: {value:"false"},
138
- field: {value:"payload", validate:RED.validators.typedInput("fieldType")},
139
- fieldType: {value:"msg"},
140
- format: {value:"javascript"},
141
- template: {value:`console.log(\`\n{\n\t"value": "async.gpt",\n\t"purpose":"putting the ideas from the exec, template and queue nodes together"\n}\n\`)`},
142
- output: {value:"str"},
143
- outputEmpty: {value:false},
144
- /* vimMode: {value:false}, */
145
- queue: {value:1},
146
- /* addpayCB: {value:false}, */
147
- cmdTemplate: {value:true},
148
- splitLine: {value:false},
149
- cleanQueue: {value:false}
150
- },
151
- inputs:1,
152
- outputs: 1,
153
- icon: "light.png",
154
- //** function: label
155
- label: function() {
156
- return this.name||this._("async.gpt");;
157
- },
158
- //** function: labelStyle
159
- labelStyle: function() {
160
- return this.name?"node_label_italic":"";
161
- },
162
- //** function: oneditprepare
163
- oneditprepare: function() {
164
- var that = this;
165
-
166
- if (!this.field) {
167
- this.field = 'payload';
168
- $("#node-input-field").val("payload");
169
- }
170
- if (!this.fieldType) {
171
- this.fieldType = 'msg';
172
- }
173
- $("#node-input-field").typedInput({
174
- default: 'msg',
175
- types: ['msg','flow','global'],
176
- typeField: $("#node-input-fieldType")
177
- });
178
-
179
- $("#node-input-field").typedInput({
180
- default: 'msg',
181
- types: ['msg','flow','global'],
182
- typeField: $("#node-input-fieldType")
183
- });
184
-
185
- // if (this.debugMode === "true" || this.debugMode === true) {
186
- // $("#node-input-debugMode").prop("checked",true);
187
- // } else {
188
- // $("#node-input-debugMode").prop("checked",false);
189
- // }
190
- //
191
- if (this.cmdTemplate === "true" || this.cmdTemplate === true) {
192
- $("#node-input-cmdTemplate").prop("checked",true);
193
- } else {
194
- $("#node-input-cmdTemplate").prop("checked",false);
195
- }
196
-
197
- this.editor = RED.editor.createEditor({
198
- id: 'node-input-template-editor',
199
- mode: 'ace/mode/html',
200
- value: $("#node-input-template").val()
201
- });
202
-
203
- RED.library.create({
204
- url:"templates", // where to get the data from
205
- type:"template", // the type of object the library is for
206
- editor:that.editor, // the field name the main text body goes to
207
- fields:['name','format','output'],
208
- ext: "txt"
209
- });
210
- this.editor.focus();
211
-
212
- $("#node-input-format").on("change", function() {
213
- var mod = "ace/mode/"+$("#node-input-format").val();
214
- that.editor.getSession().setMode({
215
- path: mod,
216
- v: Date.now()
217
- });
218
- });
219
-
220
-
221
- //registerController = Vim.getRegisterController()
222
- //RegisterController.pushText(registerController)
223
- /* let firstTime_vimMode = true
224
- * $("#node-input-vimMode").on("change", function() {
225
- * try {
226
- * if ( that.vimMode === "true" || that.vimMode === true ){
227
- * if ( firstTime_vimMode ){
228
- * that.editor.setKeyboardHandler("ace/keyboard/vim")
229
- * } else {
230
- * that.vimMode = false
231
- * that.editor.setKeyboardHandler(null)
232
- * }
233
- * } else {
234
- * if ( firstTime_vimMode ){
235
- * that.editor.setKeyboardHandler(null)
236
- * } else {
237
- * that.vimMode = true
238
- * that.editor.setKeyboardHandler("ace/keyboard/vim")
239
- * }
240
- * }
241
- * } catch (e) {
242
- * console.log("Vim Mode only works with the Ace editor")
243
- * }
244
- setTimeout(function() {
245
- let panel = $(".ace_text-input");
246
- panel.focus();
247
- firstTime_vimMode = false
248
- }, 600);
249
- * });
250
- */
251
- let firstTime_outputEmpty = true
252
- $("#node-input-outputEmpty").on("change", function() {
253
- if ( that.outputEmpty === "true" || that.outputEmpty === true ){
254
- if ( firstTime_outputEmpty ){
255
- that.outputs = 0
256
- } else {
257
- that.outputEmpty = false
258
- that.outputs = 1
259
- }
260
- } else {
261
- if ( firstTime_outputEmpty ){
262
- that.outputs = 1
263
- } else {
264
- that.outputEmpty = true
265
- that.outputs = 0
266
- }
267
- }
268
- setTimeout(function() {
269
- firstTime_outputEmpty = false
270
- }, 600);
271
- });
272
-
273
- if ( this.currentLine === undefined ){ this.currentLine = 1 }
274
- this.editor.resize(true);
275
- this.editor.scrollToLine(this.currentLine.row+1, true, true, function () {});
276
- this.editor.gotoLine(this.currentLine.row+1,this.currentLine.column+1,true);
277
- RED.popover.tooltip($("#node-template-expand-editor"), RED._("node-red:common.label.expand"));
278
- $("#node-template-expand-editor").on("click", function(e) {
279
- e.preventDefault();
280
- var value = that.editor.getValue();
281
- RED.editor.editText({
282
- mode: $("#node-input-format").val(),
283
- value: value,
284
- width: "Infinity",
285
- cursor: that.editor.getCursorPosition(),
286
- complete: function(v,cursor) {
287
- that.editor.setValue(v, -1);
288
- that.editor.gotoLine(cursor.row+1,cursor.column,false);
289
- setTimeout(function() {
290
- that.editor.focus();
291
- try {
292
- that.editor.setKeyboardHandler("ace/keyboard/vim")
293
- } catch (e) {
294
- console.log("Vim Mode only works with the Ace editor")
295
- }
296
- }, 300);
297
- }
298
- })
299
- })
300
- },
301
- //** function: oneditsave
302
- oneditsave: function() {
303
- this.cleanQueue = true
304
- this.currentLine = this.editor.getCursorPosition()
305
- $("#node-input-template").val(this.editor.getValue());
306
- this.editor.destroy();
307
- delete this.editor;
308
- },
309
- //** function: oneditcancel
310
- oneditcancel: function() {
311
- this.editor.destroy();
312
- delete this.editor;
313
- },
314
- //** function: oneditresize
315
- oneditresize: function(size) {
316
- var rows = $("#dialog-form>div:not(.node-text-editor-row)");
317
- var height = $("#dialog-form").height();
318
- for (var i=0; i<rows.length; i++) {
319
- height -= $(rows[i]).outerHeight(true);
320
- }
321
- var editorRow = $("#dialog-form>div.node-text-editor-row");
322
- height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom")));
323
- $(".node-text-editor").css("height",height+"px");
324
- this.editor.resize();
325
- }
326
- });
327
- </script>