@gregoriusrippenstein/node-red-contrib-introspection 0.6.7 → 0.6.8

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.
@@ -287,5 +287,5 @@
287
287
  </script>
288
288
 
289
289
  <script type="text/html" data-help-name="Seeker">
290
- <p>Ther Seeker seeks in the sink and presents all (max 25) paths that lead to the sink.</p>
290
+ <p>The Seeker seeks in the sink and presents all (max 25) paths that lead to the sink.</p>
291
291
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gregoriusrippenstein/node-red-contrib-introspection",
3
- "version": "0.6.7",
3
+ "version": "0.6.8",
4
4
  "dependencies": {
5
5
  "got": "^13",
6
6
  "uglify-js": "^3.17.4",
@@ -2,7 +2,7 @@
2
2
  (function() {
3
3
  var globalRefToSvgData;
4
4
 
5
- let obfuscateHelpers={getFlowDataFromCurrentWorkspace:e=>{var e=e||RED.workspaces.active(),r=RED.nodes.groups(e),e=(r=(r=r.concat(RED.nodes.junctions(e))).concat(RED.nodes.filterNodes({z:e})),RED.nodes.eachConfig(function(e){e.z===RED.workspaces.active()&&!1===e._def.hasUsers&&r.push(e)}),RED.nodes.workspace(e)||RED.nodes.subflow(e));return r.unshift(e),RED.nodes.createExportableNodeSet(r)},openImportDialog:e=>{RED.clipboard.import();let r=e;setTimeout(()=>{$("#red-ui-clipboard-dialog-import-text").val(JSON.stringify(r)).trigger("paste")},300)}};function obfuscatieCurrentFlow(r){let c=obfuscateHelpers.getFlowDataFromCurrentWorkspace(),l=(r.remove_groups&&(c=c.filter(e=>"group"!=e.type)).forEach(e=>{delete e.g}),{}),o={},p={},u={},i=[],d={},s={};if(c.forEach(e=>{"subflow"==(l[e.id]=e).type&&(s[e.id]=e),"junction"==e.type&&(o[e.id]=e),"link out"==e.type&&(u[e.id]=e),"link in"==e.type&&(p[e.id]=e),"link call"==e.type&&i.push(e.id),"catch"==e.type&&(d[e.id]=(e.wires||[])[0]||[])}),r.remove_junctions&&(Object.keys(o).forEach(t=>{let i=o[t];s[i.z]||c.forEach(r=>{for(let e=0;e<(r.wires||[]).length;e++){var o=r.wires[e].indexOf(t);-1<o&&(r.wires[e].splice(o,1),r.wires[e].push(...i.wires[0]))}})}),c=c.filter(e=>!("junction"==e.type&&!s[e.z]))),r.remove_linkout_nodes||r.remove_linkcall_nodes){let t=[],o=[],n=[],a=(r.remove_linkout_nodes&&!r.copy_linkin_nodes&&Object.keys(u).forEach(i=>{var e=u[i],r=e.links||[];r.reduce((e,r)=>e&&!!p[r],!0)&&"return"!=e.mode&&(t.push(i),r.forEach(t=>{c.forEach(r=>{for(let e=0;e<(r.wires||[]).length;e++){var o=r.wires[e].indexOf(i);-1<o&&(r.wires[e].splice(o,1),r.wires[e].push(...p[t].wires[0]))}})}))}),(i,e)=>{if(!e)return!1;let r=[],s=[],o=[];function n(e){if(o.indexOf(e.id)<0)if(o.push(e.id),r.push(e),"link out"===e.type){if("return"!=e.mode)throw"not handable"}else RED.nodes.getNodeLinks(e).forEach(function(e){n(e.target)})}try{RED.nodes.getNodeLinks(e).forEach(function(e){n(e.target),s.push(e.target.id)});if(Object.keys(d).forEach(e=>{((r,e)=>{try{return e.map(e=>e.id).forEach(e=>{if(r.includes(e))throw"yes"}),!1}catch(e){return!0}})(d[e],r)&&r.push(l[e])}),0==r.length)return!1;let o={};var a=r[0];let t={x:i.x-a.x,y:i.y-a.y};var c=r.map(e=>{var r=structuredClone(l[e.id]);return r||console.log("WARNING: nodeid not found",[e.id,l[e.id]]),r.id=RED.nodes.id(),r.x+=t.x,r.y+=t.y,o[e.id]=r});return c.forEach(e=>{"catch"==e.type&&Array.isArray(e.scope)&&(e.scope=e.scope.map(e=>{var r=o[e];return r&&r.id||e})),e.wires&&(e.wires=e.wires.map(e=>e.map(e=>{var r=o[e];return r&&"link out"==r.type?[...i.wires[0],(r||{}).id||e]:(r||{}).id||e}).flat()))}),{nodes:c.filter(e=>"link out"!=e.type),entryNodes:s.map(e=>o[e])}}catch(e){return console.log(e),!1}});r.remove_linkout_nodes&&r.copy_linkin_nodes&&Object.keys(u).forEach(s=>{let o=u[s];var e=o.links||[];"return"!=o.mode&&(e=e.map(e=>{var r=p[e],r=a(o,r);if(r)return[e,r]})).reduce((e,r)=>e&&!!r,!0)&&(t.push(s),e.forEach(([,i])=>{c.forEach(r=>{for(let e=0;e<(r.wires||[]).length;e++){var o,t=r.wires[e].indexOf(s);-1<t&&(o=i.entryNodes.map(e=>e.id),r.wires[e].splice(t,1),r.wires[e].push(...o),n.push(...i.nodes))}})}))}),r.remove_linkcall_nodes&&i.forEach(i=>{var e=l[i],r=p[e.links[0]];let s=a(e,r);r&&s&&(o.push(e.id),c.forEach(r=>{for(let e=0;e<(r.wires||[]).length;e++){var o,t=r.wires[e].indexOf(i);-1<t&&(o=s.entryNodes.map(e=>e.id),r.wires[e].splice(t,1),r.wires[e].push(...o),n.push(...s.nodes))}}))}),(c=c.filter(e=>t.indexOf(e.id)<0&&o.indexOf(e.id)<0)).push(...n)}if((c=r.remove_debugs?c.filter(e=>"debug"!=e.type):c).forEach(e=>{r.name&&(e.name=e.id),r.info&&(e.info="",delete e.outputLabels,delete e.inputLabels),r.position&&(e.x=150,e.y=150),r.remove_icons&&delete e.icon}),r.javascript){let o={},r=[];c.forEach(e=>{"javascript"!=(o[e.id]=e).format&&"function"!=e.type&&"css"!=e.format&&"json"!=e.format||r.push(e)});var e={parse:{bare_returns:!0,expression:!1},compress:{},mangle:{reserved:["$","export","require"]},output:null,sourceMap:null,nameCache:null,toplevel:!1,warnings:!1},t={compatibility:"*",level:2};$.ajax({url:"ClientCode/"+RED.nodes.id()+"/ugify",type:"POST",contentType:"application/json; charset=utf-8",data:JSON.stringify({nodes:r,jscfg:e,csscfg:t}),success:function(e){e.forEach(e=>{var r=o[e.id];e._error&&console.log("ERROR NODE",e),"function"==r.type?r.func=e.func:"javascript"!=r.format&&"css"!=r.format&&"json"!=r.format||(r.template=e.template)}),obfuscateHelpers.openImportDialog(c)},error:function(e,r,o){RED.notify("ClientCode Communcation Failure: "+n.id+": "+r,{type:"error",timeout:3e3})}})}else obfuscateHelpers.openImportDialog(c)}
5
+ let obfuscateHelpers={getFlowDataFromCurrentWorkspace:e=>{var e=e||RED.workspaces.active(),r=RED.nodes.groups(e),e=(r=(r=r.concat(RED.nodes.junctions(e))).concat(RED.nodes.filterNodes({z:e})),RED.nodes.eachConfig(function(e){e.z===RED.workspaces.active()&&!1===e._def.hasUsers&&r.push(e)}),RED.nodes.workspace(e)||RED.nodes.subflow(e));return r.unshift(e),RED.nodes.createExportableNodeSet(r)},openImportDialog:e=>{RED.clipboard.import();let r=e;setTimeout(()=>{$("#red-ui-clipboard-dialog-import-text").val(JSON.stringify(r)).trigger("paste")},300)}};function obfuscatieCurrentFlow(r){let l=obfuscateHelpers.getFlowDataFromCurrentWorkspace(),u=(r.remove_groups&&(l=l.filter(e=>"group"!=e.type)).forEach(e=>{delete e.g}),{}),t={},p={},c={},o=[],d={},i={};if(l.forEach(e=>{"subflow"==(u[e.id]=e).type&&(i[e.id]=e),"junction"==e.type&&(t[e.id]=e),"link out"==e.type&&(c[e.id]=e),"link in"==e.type&&(p[e.id]=e),"link call"==e.type&&o.push(e.id),"catch"==e.type&&(d[e.id]=(e.wires||[])[0]||[])}),r.remove_junctions&&(Object.keys(t).forEach(s=>{let o=t[s];i[o.z]||l.forEach(r=>{for(let e=0;e<(r.wires||[]).length;e++){var t=r.wires[e].indexOf(s);-1<t&&(r.wires[e].splice(t,1),r.wires[e].push(...o.wires[0]))}})}),l=l.filter(e=>!("junction"==e.type&&!i[e.z]))),r.remove_linkout_nodes||r.remove_linkcall_nodes){let s=[],t=[],i=[],a=(r.remove_linkout_nodes&&!r.copy_linkin_nodes&&Object.keys(c).forEach(o=>{var e=c[o],r=e.links||[];r.reduce((e,r)=>e&&!!p[r],!0)&&"return"!=e.mode&&(s.push(o),r.forEach(s=>{l.forEach(r=>{for(let e=0;e<(r.wires||[]).length;e++){var t=r.wires[e].indexOf(o);-1<t&&(r.wires[e].splice(t,1),r.wires[e].push(...p[s].wires[0]))}})}))}),(o,e)=>{if(!e)return!1;let r=[],n=[],t=[];function i(e){if(t.indexOf(e.id)<0)if(t.push(e.id),r.push(e),"link out"===e.type){if("return"!=e.mode)throw"not handable"}else RED.nodes.getNodeLinks(e).forEach(function(e){i(e.target)})}try{RED.nodes.getNodeLinks(e).forEach(function(e){i(e.target),n.push(e.target.id)});if(Object.keys(d).forEach(e=>{((r,e)=>{try{return e.map(e=>e.id).forEach(e=>{if(r.includes(e))throw"yes"}),!1}catch(e){return!0}})(d[e],r)&&r.push(u[e])}),0==r.length)return!1;let t={};var a=r[0];let s={x:o.x-a.x,y:o.y-a.y};var l=r.map(e=>{var r=structuredClone(u[e.id]);return r||console.log("WARNING: nodeid not found",[e.id,u[e.id]]),r.id=RED.nodes.id(),r.x+=s.x,r.y+=s.y,t[e.id]=r});return l.forEach(e=>{"catch"==e.type&&Array.isArray(e.scope)&&(e.scope=e.scope.map(e=>{var r=t[e];return r&&r.id||e})),e.wires&&(e.wires=e.wires.map(e=>e.map(e=>{var r=t[e];return r&&"link out"==r.type?[...o.wires[0],(r||{}).id||e]:(r||{}).id||e}).flat()))}),{nodes:l.filter(e=>"link out"!=e.type),entryNodes:n.map(e=>t[e])}}catch(e){return console.log(e),!1}});r.remove_linkout_nodes&&r.copy_linkin_nodes&&Object.keys(c).forEach(n=>{let t=c[n];var e=t.links||[];"return"!=t.mode&&(e=e.map(e=>{var r=p[e],r=a(t,r);if(r)return[e,r]})).reduce((e,r)=>e&&!!r,!0)&&(s.push(n),e.forEach(([,o])=>{l.forEach(r=>{for(let e=0;e<(r.wires||[]).length;e++){var t,s=r.wires[e].indexOf(n);-1<s&&(t=o.entryNodes.map(e=>e.id),r.wires[e].splice(s,1),r.wires[e].push(...t),i.push(...o.nodes))}})}))}),r.remove_linkcall_nodes&&o.forEach(o=>{var e=u[o],r=p[e.links[0]];let n=a(e,r);r&&n&&(t.push(e.id),l.forEach(r=>{for(let e=0;e<(r.wires||[]).length;e++){var t,s=r.wires[e].indexOf(o);-1<s&&(t=n.entryNodes.map(e=>e.id),r.wires[e].splice(s,1),r.wires[e].push(...t),i.push(...n.nodes))}}))}),(l=l.filter(e=>s.indexOf(e.id)<0&&t.indexOf(e.id)<0)).push(...i)}if((l=r.remove_debugs?l.filter(e=>"debug"!=e.type&&"comment"!=e.type):l).forEach(e=>{r.name&&(e.name=RED.nodes.id()),r.shrink_node&&(e.l=!1),r.info&&(e.info="",delete e.outputLabels,delete e.inputLabels),r.position&&(e.x=150,e.y=150),r.remove_icons&&delete e.icon}),r.replace_switch&&(l=l.map(r=>{if("switch"!=r.type)return r;var e={id:r.id,name:r.name,type:"function",x:r.x,y:r.y,func:"",outputs:r.outputs,noerr:0,initialize:"",finalize:"",libs:[{var:"process",module:"process"}],wires:r.wires};r.hasOwnProperty("z")&&(e.z=r.z),r.hasOwnProperty("l")&&(e.l=r.l);try{var t=[];if("msg"!=r.propertyType||r.checkAll)throw"unhandled";t.push("let _propValue = RED.util.getMessageProperty(msg, '"+r.property+"')","let _returnValue = []");for(let e=0;e<r.rules.length;e++){var s=r.rules[e];if("nnull"==s.t)t.push("if ( _propValue != null ) { _returnValue.push(msg) ; return _returnValue } else { _returnValue.push(undefined) }");else{if("else"!=s.t)throw"unhandled";t.push("_returnValue.push(msg)","return _returnValue")}}return e.func=t.join(";\n"),e}catch(e){return r}})),r.replace_change&&(l=l.map(r=>{if("change"!=r.type)return r;var e={id:r.id,name:r.name,type:"function",x:r.x,y:r.y,func:"",outputs:1,noerr:0,initialize:"",finalize:"",libs:[{var:"process",module:"process"}],wires:r.wires};r.hasOwnProperty("z")&&(e.z=r.z),r.hasOwnProperty("l")&&(e.l=r.l);try{var t=[];for(let e=0;e<r.rules.length;e++){var s=r.rules[e];if("set"==s.t){if(s.dc)throw"unhandled";if("msg"==s.pt&&"str"==s.tot)t.push("RED.util.setMessageProperty(msg,'"+s.p+"', '"+s.to+"')");else if("msg"==s.pt&&"bool"==s.tot)t.push("RED.util.setMessageProperty(msg,'"+s.p+"', "+s.to+")");else if("msg"==s.pt&&"num"==s.tot)t.push("RED.util.setMessageProperty(msg,'"+s.p+"', Number('"+s.to+"'))");else if("msg"==s.pt&&"json"==s.tot)t.push("RED.util.setMessageProperty(msg,'"+s.p+"', JSON.parse('"+s.to+"'))");else if("msg"==s.pt&&"msg"==s.tot)t.push("try { RED.util.setMessageProperty(msg,'"+s.p+"', RED.util.getMessageProperty(msg, '"+s.to+"')) } catch (ex) {}");else{if("msg"!=s.pt||"env"!=s.tot)throw"unhandlable";t.push("RED.util.setMessageProperty(msg,'"+s.p+"', process.env['"+s.to+"'])")}}else{if("delete"!=s.t||"msg"!=s.pt)throw"unhandlable";t.push("delete msg."+s.p)}}return t.push("return msg"),e.func=t.join(";\n"),e}catch(e){return r}})),r.javascript){let t={},r=[];l.forEach(e=>{"javascript"!=(t[e.id]=e).format&&"function"!=e.type&&"css"!=e.format&&"json"!=e.format||r.push(e)});var e={parse:{bare_returns:!0,expression:!1},compress:{},mangle:{reserved:["$","export","require"]},output:null,sourceMap:null,nameCache:null,toplevel:!1,warnings:!1},s={compatibility:"*",level:2};$.ajax({url:"ClientCode/"+RED.nodes.id()+"/ugify",type:"POST",contentType:"application/json; charset=utf-8",data:JSON.stringify({nodes:r,jscfg:e,csscfg:s}),success:function(e){e.forEach(e=>{var r=t[e.id];e._error&&console.log("ERROR NODE",e),"function"==r.type?r.func=e.func:"javascript"!=r.format&&"css"!=r.format&&"json"!=r.format||(r.template=e.template)}),obfuscateHelpers.openImportDialog(l)},error:function(e,r,t){RED.notify("ClientCode Communcation Failure: "+n.id+": "+r,{type:"error",timeout:3e3})}})}else obfuscateHelpers.openImportDialog(l)}
6
6
 
7
7
  function setupTreelist(){var e=collectOrphans();if(0==e.length){RED.notify("No Orphans Found",{type:"warning",timeout:2e3});try{$("#node-input-orphan-target-container-div").treeList("empty")}catch(e){}}else{try{$("#node-input-orphan-target-container-div").treeList("empty")}catch(e){$("#node-input-orphan-target-container-div").css({width:"100%",height:"calc(100%)"}).treeList({multi:!1}).on("treelistitemmouseover",function(e,t){}).on("treelistitemmouseout",function(e,t){}).on("treelistselect",function(e,t){t.node&&(RED.workspaces.show(t.node.z,!1,!1,!0),RED.view.reveal(t.node.id,!0),RED.view.redraw())}).on("treelistconfirm",function(e,t){var n;t.node&&(n=t.node.id,setTimeout(()=>{var e=RED.nodes.node(n);e&&(RED.view.reveal(e.id),RED.view.select(e.id),RED.editor.edit(e)),n==RED.workspaces.active()&&RED.workspaces.edit()},50))}),$("#node-input-orphan-target-filter").show();var n=$("#node-input-orphan-target-filter").searchBox({style:"compact",delay:300,change:function(){var e,t=$(this).val().trim().toLowerCase();""===t?($("#node-input-orphan-target-container-div").treeList("filter",null),n.searchBox("count","")):(e=$("#node-input-orphan-target-container-div").treeList("filter",function(e){return-1<e.label.toLowerCase().indexOf(t)||-1<e.node.type.toLowerCase().indexOf(t)}),n.searchBox("count",e+" / "+$("#node-input-orphan-target-container-div").treeList("data").length))}})}$("#node-input-orphan-target-container-div").treeList("data",e.sort((e,t)=>e.node.z>t.node.z))}}function collectOrphans(){const t=new Set;var n=[],i=(RED.nodes.eachLink(e=>{t.add(e.source),t.add(e.target)}),RED.nodes.eachNode(e=>{t.has(e)||n.push(e)}),[]),r={};return n.forEach(function(e){var t=RED.nodes.getType(e.type);if(t){var n=t.label,n=("function"==typeof n?n.call(e):n)||"",o=e.type;if(0===o.indexOf("subflow:"))return}t&&n||(n=e.type),r[e.id]={node:e,label:n,sublabel:o,selected:!1,checkbox:!1},i.push(r[e.id])}),i}
8
8
 
@@ -66,6 +66,8 @@
66
66
  name: $('#node-input-obfuscate-name').is(":checked"),
67
67
  info: $('#node-input-obfuscate-info').is(":checked"),
68
68
  position: $('#node-input-obfuscate-position').is(":checked"),
69
+
70
+ shrink_node: $('#node-input-obfuscate-shrink-size').is(":checked"),
69
71
  remove_groups: $('#node-input-obfuscate-remove-groups').is(":checked"),
70
72
  javascript: $('#node-input-obfuscate-javascript').is(":checked"),
71
73
 
@@ -76,6 +78,9 @@
76
78
  remove_linkout_nodes: $('#node-input-obfuscate-remove-linknodes').is(":checked"),
77
79
  copy_linkin_nodes: $('#node-input-obfuscate-copy-linkin-nodes').is(":checked"),
78
80
  remove_linkcall_nodes: $("#node-input-obfuscate-remove-linkcall-nodes").is(":checked"),
81
+
82
+ replace_switch: $('#node-input-obfuscate-replace-switch').is(":checked"),
83
+ replace_change: $('#node-input-obfuscate-replace-change').is(":checked"),
79
84
  })
80
85
  })
81
86
 
@@ -146,7 +151,11 @@
146
151
  .w-30 {
147
152
  width: 40% !important;
148
153
  margin-left: 10px;
154
+ }
155
+ .ml-30 {
156
+ margin-left: 30px !important;
149
157
  }
158
+
150
159
  </style>
151
160
 
152
161
  <!-- The html for the right sidebar plugin screen -->
@@ -230,6 +239,15 @@
230
239
  style="display:inline-block; width:15px; vertical-align:baseline;">
231
240
  </div>
232
241
 
242
+ <div class="form-row">
243
+ <label for="node-input-obfuscate-shrink-size" class="w-30">
244
+ <i class="fa fa-angle-down"></i>
245
+ <span>Shrink Node?</span>
246
+ </label>
247
+ <input type="checkbox" checked=checked id="node-input-obfuscate-shrink-size"
248
+ style="display:inline-block; width:15px; vertical-align:baseline;">
249
+ </div>
250
+
233
251
  <div class="form-row">
234
252
  <label for="node-input-obfuscate-javascript" class="w-30">
235
253
  <i class="fa fa-code"></i>
@@ -269,12 +287,34 @@
269
287
  <div class="form-row">
270
288
  <label for="node-input-obfuscate-remove-debugs" class="w-30">
271
289
  <i class="fa fa-bug"></i>
272
- <span>Remove debugs?</span>
290
+ <span>Remove comment & debugs?</span>
273
291
  </label>
274
292
  <input type="checkbox" checked=checked id="node-input-obfuscate-remove-debugs"
275
293
  style="display:inline-block; width:15px; vertical-align:baseline;">
276
294
  </div>
277
295
 
296
+ <div class="form-row">
297
+ <label class='w-30'>
298
+ <span>Replace Nodes:</span>
299
+ </label>
300
+ </div>
301
+
302
+ <div class="form-row">
303
+ <label for="node-input-obfuscate-replace-switch" class="ml-30">
304
+ <span>Switch</span>
305
+ </label>
306
+ <input type="checkbox" checked=checked id="node-input-obfuscate-replace-switch"
307
+ style="display:inline-block; width:15px; vertical-align:baseline;">
308
+ </div>
309
+
310
+ <div class="form-row">
311
+ <label for="node-input-obfuscate-replace-change" class="ml-30">
312
+ <span>Change</span>
313
+ </label>
314
+ <input type="checkbox" checked=checked id="node-input-obfuscate-replace-change"
315
+ style="display:inline-block; width:15px; vertical-align:baseline;">
316
+ </div>
317
+
278
318
  <div class="form-row">
279
319
  <label for="node-input-obfuscate-remove-junctions" class="w-30">
280
320
  <i class="fa fa-sitemap"></i>
@@ -291,8 +331,10 @@
291
331
  </label>
292
332
  <input type="checkbox" checked=checked id="node-input-obfuscate-remove-linknodes"
293
333
  style="display:inline-block; width:15px; vertical-align:baseline;">
334
+ </div>
294
335
 
295
- <label for="node-input-obfuscate-copy-linkin-nodes" class="w-30">
336
+ <div class="form-row">
337
+ <label for="node-input-obfuscate-copy-linkin-nodes" class="ml-30">
296
338
  <span>Copy Link-In Nodes?</span>
297
339
  </label>
298
340
  <input type="checkbox" checked=checked id="node-input-obfuscate-copy-linkin-nodes"