@gregoriusrippenstein/node-red-contrib-introspection 0.4.5 → 0.5.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.
@@ -0,0 +1,926 @@
1
+ [
2
+ {
3
+ "id": "6862158f3d80a473",
4
+ "type": "group",
5
+ "z": "e02ba6e534f7a0f4",
6
+ "name": "hello world",
7
+ "style": {
8
+ "label": true
9
+ },
10
+ "nodes": [
11
+ "d648fd685e2efd72",
12
+ "3176194cbb4abcf5"
13
+ ],
14
+ "x": 166.2856788635254,
15
+ "y": 49,
16
+ "w": 630,
17
+ "h": 151
18
+ },
19
+ {
20
+ "id": "d648fd685e2efd72",
21
+ "type": "inject",
22
+ "z": "e02ba6e534f7a0f4",
23
+ "g": "6862158f3d80a473",
24
+ "name": "Hello World example",
25
+ "props": [
26
+ {
27
+ "p": "payload"
28
+ }
29
+ ],
30
+ "repeat": "",
31
+ "crontab": "",
32
+ "once": false,
33
+ "onceDelay": 0.1,
34
+ "topic": "",
35
+ "payload": "hello world",
36
+ "payloadType": "str",
37
+ "x": 302.2856788635254,
38
+ "y": 90,
39
+ "wires": [
40
+ [
41
+ "3176194cbb4abcf5"
42
+ ]
43
+ ]
44
+ },
45
+ {
46
+ "id": "3176194cbb4abcf5",
47
+ "type": "ClientCode",
48
+ "z": "e02ba6e534f7a0f4",
49
+ "g": "6862158f3d80a473",
50
+ "name": "open alert window",
51
+ "clientcode": "alert(payload);\n",
52
+ "format": "javascript",
53
+ "x": 680.2856788635254,
54
+ "y": 159,
55
+ "wires": [
56
+ []
57
+ ]
58
+ },
59
+ {
60
+ "id": "e6f43d21f8ccfad6",
61
+ "type": "group",
62
+ "z": "e02ba6e534f7a0f4",
63
+ "name": "create dynamic flow using RSS as input",
64
+ "style": {
65
+ "label": true
66
+ },
67
+ "nodes": [
68
+ "f3bdcd54a0aa8585",
69
+ "c2d4ce3e6e7c2e31",
70
+ "f210b63040eeb212",
71
+ "e7289b9433d25283",
72
+ "3d604af7f2cb8912",
73
+ "77a3c9b5811260e2",
74
+ "9de0d672c6fbccb8",
75
+ "875ef0b0799bb044",
76
+ "5bf2de0885c59307"
77
+ ],
78
+ "x": 166.2856788635254,
79
+ "y": 471,
80
+ "w": 1597.7499046325684,
81
+ "h": 522
82
+ },
83
+ {
84
+ "id": "f3bdcd54a0aa8585",
85
+ "type": "inject",
86
+ "z": "e02ba6e534f7a0f4",
87
+ "g": "e6f43d21f8ccfad6",
88
+ "name": "set RSS url",
89
+ "props": [
90
+ {
91
+ "p": "url",
92
+ "v": "https://flows.flowhub.org/feed.xml",
93
+ "vt": "str"
94
+ }
95
+ ],
96
+ "repeat": "",
97
+ "crontab": "",
98
+ "once": false,
99
+ "onceDelay": 0.1,
100
+ "topic": "",
101
+ "x": 272.2856788635254,
102
+ "y": 512,
103
+ "wires": [
104
+ [
105
+ "c2d4ce3e6e7c2e31"
106
+ ]
107
+ ]
108
+ },
109
+ {
110
+ "id": "c2d4ce3e6e7c2e31",
111
+ "type": "http request",
112
+ "z": "e02ba6e534f7a0f4",
113
+ "g": "e6f43d21f8ccfad6",
114
+ "name": "",
115
+ "method": "GET",
116
+ "ret": "txt",
117
+ "paytoqs": false,
118
+ "url": "",
119
+ "persist": false,
120
+ "insecureHTTPParser": false,
121
+ "authType": "",
122
+ "senderr": false,
123
+ "headers": [],
124
+ "x": 427.2856788635254,
125
+ "y": 595,
126
+ "wires": [
127
+ [
128
+ "f210b63040eeb212"
129
+ ]
130
+ ]
131
+ },
132
+ {
133
+ "id": "f210b63040eeb212",
134
+ "type": "xml",
135
+ "z": "e02ba6e534f7a0f4",
136
+ "g": "e6f43d21f8ccfad6",
137
+ "name": "parse feed.xml",
138
+ "property": "payload",
139
+ "attr": "",
140
+ "chr": "",
141
+ "x": 595.2856788635254,
142
+ "y": 670,
143
+ "wires": [
144
+ [
145
+ "3d604af7f2cb8912"
146
+ ]
147
+ ]
148
+ },
149
+ {
150
+ "id": "e7289b9433d25283",
151
+ "type": "split",
152
+ "z": "e02ba6e534f7a0f4",
153
+ "g": "e6f43d21f8ccfad6",
154
+ "name": "",
155
+ "splt": "\\n",
156
+ "spltType": "str",
157
+ "arraySplt": 1,
158
+ "arraySpltType": "len",
159
+ "stream": false,
160
+ "addname": "",
161
+ "x": 1104.2856788635254,
162
+ "y": 779,
163
+ "wires": [
164
+ [
165
+ "77a3c9b5811260e2"
166
+ ]
167
+ ]
168
+ },
169
+ {
170
+ "id": "3d604af7f2cb8912",
171
+ "type": "change",
172
+ "z": "e02ba6e534f7a0f4",
173
+ "g": "e6f43d21f8ccfad6",
174
+ "name": "set payload and define fake tab Z id",
175
+ "rules": [
176
+ {
177
+ "t": "set",
178
+ "p": "payload",
179
+ "pt": "msg",
180
+ "to": "payload.feed.entry",
181
+ "tot": "msg"
182
+ }
183
+ ],
184
+ "action": "",
185
+ "property": "",
186
+ "from": "",
187
+ "to": "",
188
+ "reg": false,
189
+ "x": 862.2856788635254,
190
+ "y": 730,
191
+ "wires": [
192
+ [
193
+ "e7289b9433d25283"
194
+ ]
195
+ ]
196
+ },
197
+ {
198
+ "id": "77a3c9b5811260e2",
199
+ "type": "function",
200
+ "z": "e02ba6e534f7a0f4",
201
+ "g": "e6f43d21f8ccfad6",
202
+ "name": "convert xml object to flow object",
203
+ "func": "msg.payload = {\n \"id\": msg.payload.id[0].match(/.{16}$/)[0],\n \"type\": \"comment\",\n \"name\": msg.payload.title[0][\"_\"],\n \"info\": msg.payload.id[0],\n \"x\": 801 * Math.random(),\n \"y\": 699 * Math.random(),\n \"wires\": [\n ]\n}\n\nreturn msg;\n",
204
+ "outputs": 1,
205
+ "noerr": 0,
206
+ "initialize": "",
207
+ "finalize": "",
208
+ "libs": [],
209
+ "x": 1131.2856788635254,
210
+ "y": 866,
211
+ "wires": [
212
+ [
213
+ "9de0d672c6fbccb8"
214
+ ]
215
+ ]
216
+ },
217
+ {
218
+ "id": "9de0d672c6fbccb8",
219
+ "type": "join",
220
+ "z": "e02ba6e534f7a0f4",
221
+ "g": "e6f43d21f8ccfad6",
222
+ "name": "",
223
+ "mode": "auto",
224
+ "build": "object",
225
+ "property": "payload",
226
+ "propertyType": "msg",
227
+ "key": "topic",
228
+ "joiner": "\\n",
229
+ "joinerType": "str",
230
+ "accumulate": true,
231
+ "timeout": "",
232
+ "count": "",
233
+ "reduceRight": false,
234
+ "reduceExp": "",
235
+ "reduceInit": "",
236
+ "reduceInitType": "",
237
+ "reduceFixup": "",
238
+ "x": 1128.2856788635254,
239
+ "y": 952,
240
+ "wires": [
241
+ [
242
+ "875ef0b0799bb044"
243
+ ]
244
+ ]
245
+ },
246
+ {
247
+ "id": "875ef0b0799bb044",
248
+ "type": "function",
249
+ "z": "e02ba6e534f7a0f4",
250
+ "g": "e6f43d21f8ccfad6",
251
+ "name": "prepend the subflow to the nodes array",
252
+ "func": "msg.payload = {\n flowContent: msg.payload,\n removeduplicates: true,\n autoimport: false\n}\n\nreturn msg;",
253
+ "outputs": 1,
254
+ "noerr": 0,
255
+ "initialize": "",
256
+ "finalize": "",
257
+ "libs": [],
258
+ "x": 1395.2856788635254,
259
+ "y": 952,
260
+ "wires": [
261
+ [
262
+ "5bf2de0885c59307"
263
+ ]
264
+ ]
265
+ },
266
+ {
267
+ "id": "5bf2de0885c59307",
268
+ "type": "ClientCode",
269
+ "z": "e02ba6e534f7a0f4",
270
+ "g": "e6f43d21f8ccfad6",
271
+ "name": "Open import dialog",
272
+ "clientcode": "function doIt() {\n var content = payload.flowContent;\n\n if (payload.removeduplicates) {\n content = content.filter((elem) => {\n return RED.nodes.node(elem.id) == undefined\n });\n }\n\n if (content.length == 0) {\n RED.notify(\"No new content\", {\n type: \"ok\",\n id: \"TriggerImport\",\n timeout: 2000\n });\n return;\n }\n RED.clipboard.import();\n\n setTimeout(() => {\n $('#red-ui-clipboard-dialog-import-text').val(\n JSON.stringify(content)\n ).trigger(\"paste\");\n\n if (payload.autoimport) {\n setTimeout(() => {\n $('#red-ui-clipboard-dialog-ok').trigger('click');\n }, 435);\n }\n }, 300);\n};\n\ndoIt();\n",
273
+ "format": "javascript",
274
+ "x": 1648.0355834960938,
275
+ "y": 821.2084875106812,
276
+ "wires": [
277
+ []
278
+ ]
279
+ },
280
+ {
281
+ "id": "fdc3fd787c126eb3",
282
+ "type": "group",
283
+ "z": "e02ba6e534f7a0f4",
284
+ "name": "align all connected nodes",
285
+ "style": {
286
+ "label": true
287
+ },
288
+ "nodes": [
289
+ "c482389d05470096",
290
+ "2798c3c8c33abd09",
291
+ "c4df7559e046aac8"
292
+ ],
293
+ "x": 1062.2857666015625,
294
+ "y": 54.71428298950195,
295
+ "w": 699.9999389648438,
296
+ "h": 328.00003147125244
297
+ },
298
+ {
299
+ "id": "c482389d05470096",
300
+ "type": "inject",
301
+ "z": "e02ba6e534f7a0f4",
302
+ "g": "fdc3fd787c126eb3",
303
+ "name": "",
304
+ "props": [
305
+ {
306
+ "p": "payload"
307
+ },
308
+ {
309
+ "p": "topic",
310
+ "vt": "str"
311
+ }
312
+ ],
313
+ "repeat": "",
314
+ "crontab": "",
315
+ "once": false,
316
+ "onceDelay": 0.1,
317
+ "topic": "",
318
+ "payload": "",
319
+ "payloadType": "date",
320
+ "x": 1168.2857666015625,
321
+ "y": 95.71428298950195,
322
+ "wires": [
323
+ [
324
+ "2798c3c8c33abd09"
325
+ ]
326
+ ]
327
+ },
328
+ {
329
+ "id": "2798c3c8c33abd09",
330
+ "type": "ClientCode",
331
+ "z": "e02ba6e534f7a0f4",
332
+ "g": "fdc3fd787c126eb3",
333
+ "name": "Align Nodes",
334
+ "clientcode": "var thisNode = RED.nodes.node(nodeid);\n\nconsole.log( thisNode)\nvar connectedNodes = [thisNode];\n\nRED.nodes.eachNode( (nde) => {\n RED.nodes.getNodeLinks(nde).forEach(function (l) {\n if ( l.target.id == nodeid) {\n connectedNodes.push(nde)\n }\n });\n})\n\nRED.nodes.getNodeLinks(thisNode).forEach(function (l) {\n connectedNodes.push(l.target)\n});\n\nRED.view.select({ nodes: connectedNodes })\nsetTimeout(() => {\n RED.actions.invoke(\"core:align-selection-to-middle\")\n node.send({\n payload: \"done\"\n })\n}, 1000);\n\n",
335
+ "format": "javascript",
336
+ "x": 1400.2857666015625,
337
+ "y": 211.71428298950195,
338
+ "wires": [
339
+ [
340
+ "c4df7559e046aac8"
341
+ ]
342
+ ]
343
+ },
344
+ {
345
+ "id": "c4df7559e046aac8",
346
+ "type": "debug",
347
+ "z": "e02ba6e534f7a0f4",
348
+ "g": "fdc3fd787c126eb3",
349
+ "name": "debug 8",
350
+ "active": true,
351
+ "tosidebar": true,
352
+ "console": false,
353
+ "tostatus": false,
354
+ "complete": "false",
355
+ "statusVal": "",
356
+ "statusType": "auto",
357
+ "x": 1656.2857055664062,
358
+ "y": 341.7143144607544,
359
+ "wires": []
360
+ },
361
+ {
362
+ "id": "576eb2790b07f530",
363
+ "type": "group",
364
+ "z": "e02ba6e534f7a0f4",
365
+ "name": "move node",
366
+ "style": {
367
+ "label": true
368
+ },
369
+ "nodes": [
370
+ "d06cce0db2eb2cf8",
371
+ "516fc0b2023ebe87"
372
+ ],
373
+ "x": 166.2856788635254,
374
+ "y": 274,
375
+ "w": 494,
376
+ "h": 147
377
+ },
378
+ {
379
+ "id": "d06cce0db2eb2cf8",
380
+ "type": "inject",
381
+ "z": "e02ba6e534f7a0f4",
382
+ "g": "576eb2790b07f530",
383
+ "name": "",
384
+ "props": [
385
+ {
386
+ "p": "payload"
387
+ },
388
+ {
389
+ "p": "topic",
390
+ "vt": "str"
391
+ }
392
+ ],
393
+ "repeat": "",
394
+ "crontab": "",
395
+ "once": false,
396
+ "onceDelay": 0.1,
397
+ "topic": "",
398
+ "payload": "",
399
+ "payloadType": "date",
400
+ "x": 272.2856788635254,
401
+ "y": 315,
402
+ "wires": [
403
+ [
404
+ "516fc0b2023ebe87"
405
+ ]
406
+ ]
407
+ },
408
+ {
409
+ "id": "516fc0b2023ebe87",
410
+ "type": "ClientCode",
411
+ "z": "e02ba6e534f7a0f4",
412
+ "g": "576eb2790b07f530",
413
+ "name": "Move node up",
414
+ "clientcode": "var nde = RED.nodes.node(nodeid);\n\nnde.y -= 20;\n\nnde.dirty = true;\n\nRED.view.redraw(true)\n\nnode.send({\n payload: \"done\"\n})",
415
+ "format": "javascript",
416
+ "x": 554.2856788635254,
417
+ "y": 380,
418
+ "wires": [
419
+ []
420
+ ]
421
+ },
422
+ {
423
+ "id": "f3c9039641e8c2e9",
424
+ "type": "group",
425
+ "z": "e02ba6e534f7a0f4",
426
+ "name": "display user agent",
427
+ "style": {
428
+ "label": true
429
+ },
430
+ "nodes": [
431
+ "f264cd20b53c537c",
432
+ "71f605053c3902b8",
433
+ "d41834f0310a9f66",
434
+ "f8dc6845645740ca"
435
+ ],
436
+ "x": 166.2856788635254,
437
+ "y": 1082.0001220703125,
438
+ "w": 810,
439
+ "h": 157
440
+ },
441
+ {
442
+ "id": "f264cd20b53c537c",
443
+ "type": "ClientCode",
444
+ "z": "e02ba6e534f7a0f4",
445
+ "g": "f3c9039641e8c2e9",
446
+ "name": "get userAgent",
447
+ "clientcode": "node.send({\n payload: navigator.userAgent \n});\n",
448
+ "format": "javascript",
449
+ "x": 529.2856788635254,
450
+ "y": 1198.0001220703125,
451
+ "wires": [
452
+ [
453
+ "d41834f0310a9f66",
454
+ "f8dc6845645740ca"
455
+ ]
456
+ ]
457
+ },
458
+ {
459
+ "id": "71f605053c3902b8",
460
+ "type": "inject",
461
+ "z": "e02ba6e534f7a0f4",
462
+ "g": "f3c9039641e8c2e9",
463
+ "name": "",
464
+ "props": [
465
+ {
466
+ "p": "payload"
467
+ },
468
+ {
469
+ "p": "topic",
470
+ "vt": "str"
471
+ }
472
+ ],
473
+ "repeat": "",
474
+ "crontab": "",
475
+ "once": false,
476
+ "onceDelay": 0.1,
477
+ "topic": "",
478
+ "payload": "",
479
+ "payloadType": "date",
480
+ "x": 272.2856788635254,
481
+ "y": 1197.0001220703125,
482
+ "wires": [
483
+ [
484
+ "f264cd20b53c537c"
485
+ ]
486
+ ]
487
+ },
488
+ {
489
+ "id": "d41834f0310a9f66",
490
+ "type": "ClientCode",
491
+ "z": "e02ba6e534f7a0f4",
492
+ "g": "f3c9039641e8c2e9",
493
+ "name": "Open notify popup",
494
+ "clientcode": "RED.notify(\"Your navigator: \" + payload, {\n id: nodeid,\n type: \"ok\",\n timeout: 2000\n})",
495
+ "format": "javascript",
496
+ "x": 860.2856788635254,
497
+ "y": 1195.0001220703125,
498
+ "wires": [
499
+ []
500
+ ]
501
+ },
502
+ {
503
+ "id": "f8dc6845645740ca",
504
+ "type": "debug",
505
+ "z": "e02ba6e534f7a0f4",
506
+ "g": "f3c9039641e8c2e9",
507
+ "name": "debug 18",
508
+ "active": true,
509
+ "tosidebar": true,
510
+ "console": false,
511
+ "tostatus": false,
512
+ "complete": "false",
513
+ "statusVal": "",
514
+ "statusType": "auto",
515
+ "x": 794.2856788635254,
516
+ "y": 1123.0001220703125,
517
+ "wires": []
518
+ },
519
+ {
520
+ "id": "b74369273536bfab",
521
+ "type": "group",
522
+ "z": "e02ba6e534f7a0f4",
523
+ "name": "connect nodes",
524
+ "style": {
525
+ "label": true
526
+ },
527
+ "nodes": [
528
+ "87ecedcda805b9fc",
529
+ "ae105ff2ffd71fea",
530
+ "85926682e41d7e3e",
531
+ "d396d46edc750dd7"
532
+ ],
533
+ "x": 1053.71435546875,
534
+ "y": 1082.0001220703125,
535
+ "w": 710,
536
+ "h": 211
537
+ },
538
+ {
539
+ "id": "87ecedcda805b9fc",
540
+ "type": "inject",
541
+ "z": "e02ba6e534f7a0f4",
542
+ "g": "b74369273536bfab",
543
+ "name": "",
544
+ "props": [
545
+ {
546
+ "p": "payload"
547
+ },
548
+ {
549
+ "p": "topic",
550
+ "vt": "str"
551
+ }
552
+ ],
553
+ "repeat": "",
554
+ "crontab": "",
555
+ "once": false,
556
+ "onceDelay": 0.1,
557
+ "topic": "",
558
+ "payload": "",
559
+ "payloadType": "date",
560
+ "x": 1159.71435546875,
561
+ "y": 1123.0001220703125,
562
+ "wires": [
563
+ [
564
+ "ae105ff2ffd71fea"
565
+ ]
566
+ ]
567
+ },
568
+ {
569
+ "id": "ae105ff2ffd71fea",
570
+ "type": "ClientCode",
571
+ "z": "e02ba6e534f7a0f4",
572
+ "g": "b74369273536bfab",
573
+ "name": "connect nodes",
574
+ "clientcode": "\nvar dgbNode = RED.nodes.node(\"85926682e41d7e3e\");\nvar injNode = RED.nodes.node(\"d396d46edc750dd7\");\nvar thisNode = RED.nodes.node(nodeid);\n\nRED.nodes.addLink({ source: thisNode, sourcePort: 0, target: dgbNode });\nRED.nodes.addLink({ target: thisNode, sourcePort: 0, source: injNode });\n\nRED.view.select([dgbNode, thisNode, injNode]);\n",
575
+ "format": "javascript",
576
+ "x": 1468.71435546875,
577
+ "y": 1124.0001220703125,
578
+ "wires": [
579
+ []
580
+ ]
581
+ },
582
+ {
583
+ "id": "85926682e41d7e3e",
584
+ "type": "debug",
585
+ "z": "e02ba6e534f7a0f4",
586
+ "g": "b74369273536bfab",
587
+ "name": "debug 19",
588
+ "active": true,
589
+ "tosidebar": true,
590
+ "console": false,
591
+ "tostatus": false,
592
+ "complete": "false",
593
+ "statusVal": "",
594
+ "statusType": "auto",
595
+ "x": 1657.71435546875,
596
+ "y": 1252.0001220703125,
597
+ "wires": []
598
+ },
599
+ {
600
+ "id": "d396d46edc750dd7",
601
+ "type": "inject",
602
+ "z": "e02ba6e534f7a0f4",
603
+ "g": "b74369273536bfab",
604
+ "name": "",
605
+ "props": [
606
+ {
607
+ "p": "payload"
608
+ },
609
+ {
610
+ "p": "topic",
611
+ "vt": "str"
612
+ }
613
+ ],
614
+ "repeat": "",
615
+ "crontab": "",
616
+ "once": false,
617
+ "onceDelay": 0.1,
618
+ "topic": "",
619
+ "payload": "",
620
+ "payloadType": "date",
621
+ "x": 1194.71435546875,
622
+ "y": 1247.0001220703125,
623
+ "wires": [
624
+ []
625
+ ]
626
+ },
627
+ {
628
+ "id": "3c1cf76ad7583ad9",
629
+ "type": "group",
630
+ "z": "e02ba6e534f7a0f4",
631
+ "name": "auto layout",
632
+ "style": {
633
+ "label": true
634
+ },
635
+ "nodes": [
636
+ "99f9a8cb95305f73",
637
+ "bfe4ae73c71c351b",
638
+ "c8be32434361dcb9",
639
+ "1e0af30a2001c5e3",
640
+ "11ce6f9d18c3733b",
641
+ "9cdf0f2efddd09bb",
642
+ "f9ae281ee823f254",
643
+ "f1af381c0ddab811",
644
+ "cdccfead01d41984",
645
+ "1059a876dae0d79c"
646
+ ],
647
+ "x": 166.2856788635254,
648
+ "y": 1323.8569560050964,
649
+ "w": 660.857234954834,
650
+ "h": 335.14304399490356
651
+ },
652
+ {
653
+ "id": "99f9a8cb95305f73",
654
+ "type": "inject",
655
+ "z": "e02ba6e534f7a0f4",
656
+ "g": "3c1cf76ad7583ad9",
657
+ "name": "1. select me!",
658
+ "props": [
659
+ {
660
+ "p": "payload"
661
+ },
662
+ {
663
+ "p": "topic",
664
+ "vt": "str"
665
+ }
666
+ ],
667
+ "repeat": "",
668
+ "crontab": "",
669
+ "once": false,
670
+ "onceDelay": 0.1,
671
+ "topic": "",
672
+ "payload": "",
673
+ "payloadType": "date",
674
+ "x": 299.9999485015869,
675
+ "y": 1433.4284377098083,
676
+ "wires": [
677
+ [
678
+ "1e0af30a2001c5e3"
679
+ ]
680
+ ]
681
+ },
682
+ {
683
+ "id": "bfe4ae73c71c351b",
684
+ "type": "ClientCode",
685
+ "z": "e02ba6e534f7a0f4",
686
+ "g": "3c1cf76ad7583ad9",
687
+ "name": "layout selection - https://github.com/node-red/node-red/pull/2267/files",
688
+ "clientcode": "function layoutFlow() {\n\n var selection = RED.view.selection();\n console.log(selection)\n if (!selection.nodes || selection.nodes.length !== 1) {\n RED.notify(\"Select exactly one node\");\n return;\n }\n var ns = RED.nodes.getAllFlowNodes(selection.nodes[0]);\n\n // Find Input node\n\n var nodes = {};\n var minRank = 0;\n var stack = [];\n var candidateInputs = {};\n var candidateOutputs = {};\n ns.forEach(function (n) {\n candidateInputs[n.id] = n;\n candidateOutputs[n.id] = n;\n nodes[n.id] = {\n n: n,\n i: [],\n o: [],\n d: -1, // depth from start\n r: -1, // rank order at that depth\n downstream: 0\n }\n });\n RED.nodes.eachLink(function (link) {\n if (nodes[link.source.id] || nodes[link.target.id]) {\n nodes[link.source.id].o.push(link.target.id);\n nodes[link.target.id].i.push(link.source.id);\n delete candidateInputs[link.target.id]\n delete candidateOutputs[link.source.id]\n }\n })\n\n var inputs = Object.keys(candidateInputs);\n var outputs = Object.keys(candidateOutputs);\n\n console.log(inputs);\n\n if (inputs.length > 1) {\n RED.notify(\"Multiple start points - bailing\")\n return;\n }\n\n if (outputs.length === 0) {\n RED.notify(\"No outputs - is this a big loop? Bailing\");\n return;\n }\n\n function applyDepth(id, d) {\n if (nodes[id].d < d) {\n nodes[id].d = d;\n nodes[id].o.forEach(function (nid) {\n applyDepth(nid, d + 1);\n })\n }\n }\n applyDepth(inputs[0], 0)\n\n function calculateDownstream(id, downstream) {\n nodes[id].downstream += downstream;\n nodes[id].i.forEach(function (nid) {\n calculateDownstream(nid, nodes[id].downstream + 1);\n })\n }\n outputs.forEach(function (id) {\n calculateDownstream(id, 0)\n })\n\n var ranks = {};\n function rankNodes(node) {\n if (node.r === -1) {\n ranks[node.d] = ranks[node.d] || [];\n node.r = ranks[node.d].length;\n ranks[node.d].push(node);\n node.o.sort(function (a, b) {\n return nodes[b].downstream - nodes[a].downstream\n })\n node.o.forEach(function (nid) {\n rankNodes(nodes[nid])\n })\n }\n }\n rankNodes(nodes[inputs[0]]);\n function shuffleRanks(node) {\n var pushed = false;\n if (node.o.length > 1) {\n var outputs = node.o.slice(0);\n outputs.sort(function (a, b) {\n if (nodes[a].d === nodes[b].d) {\n return nodes[a].r - nodes[b].r;\n } else {\n return nodes[b].d - nodes[a].d;\n }\n })\n // outputs.forEach(function(o,i) { console.log(\" \",i,\" + \"+nodes[o].n.type,\" d:\",nodes[o].d,\" r:\",nodes[o].r)});\n var rank = nodes[outputs[0]].r;\n var depth = nodes[outputs[0]].d;\n for (var i = 1; i < outputs.length; i++) {\n // console.log(outputs[i]);\n var n = nodes[outputs[i]];\n if (n.d !== depth && n.r === rank) {\n // need to move n down one.\n var r = n.r;\n ns.forEach(function (_n) {\n var nn = nodes[_n.id];\n if (nn.d >= n.d && nn.d < depth && nn.r >= r) {\n pushed = true;\n nn.r++;\n }\n })\n }\n depth = n.d;\n rank = n.r;\n }\n }\n node.o.forEach(function (n) {\n pushed = pushed || shuffleRanks(nodes[n])\n })\n return pushed;\n }\n var shuffle = function () {\n if (shuffleRanks(nodes[inputs[0]])) {\n shuffle();\n }\n }\n shuffle();\n\n\n var x = nodes[inputs[0]].n.x;\n var y = nodes[inputs[0]].n.y;\n var changedNodes = [];\n ns.forEach(function (n) {\n var d = nodes[n.id].d;\n var r = nodes[n.id].r;\n\n changedNodes.push({\n n: n,\n ox: n.x,\n oy: n.y,\n moved: n.moved\n });\n\n n.x = x + d * 200;\n n.y = y + r * 50;\n n.dirty = true;\n // n.dirtyStatus = true;\n // n.status = {\n // text:\"d\"+d+\" : r\"+r+\" : ds\"+nodes[n.id].downstream\n // }\n });\n\n if (changedNodes.length > 0) {\n RED.history.push({ t: \"move\", nodes: changedNodes, dirty: RED.nodes.dirty() });\n RED.nodes.dirty(true);\n RED.view.redraw(true);\n }\n\n}\n\nlayoutFlow();",
689
+ "format": "javascript",
690
+ "x": 551.1429138183594,
691
+ "y": 1618,
692
+ "wires": [
693
+ []
694
+ ]
695
+ },
696
+ {
697
+ "id": "c8be32434361dcb9",
698
+ "type": "inject",
699
+ "z": "e02ba6e534f7a0f4",
700
+ "g": "3c1cf76ad7583ad9",
701
+ "name": "2. press me",
702
+ "props": [
703
+ {
704
+ "p": "payload"
705
+ }
706
+ ],
707
+ "repeat": "",
708
+ "crontab": "",
709
+ "once": false,
710
+ "onceDelay": 0.1,
711
+ "topic": "",
712
+ "payload": "",
713
+ "payloadType": "date",
714
+ "x": 282.2856788635254,
715
+ "y": 1549.714183330536,
716
+ "wires": [
717
+ [
718
+ "bfe4ae73c71c351b"
719
+ ]
720
+ ]
721
+ },
722
+ {
723
+ "id": "1e0af30a2001c5e3",
724
+ "type": "switch",
725
+ "z": "e02ba6e534f7a0f4",
726
+ "g": "3c1cf76ad7583ad9",
727
+ "name": "",
728
+ "property": "payload",
729
+ "propertyType": "msg",
730
+ "rules": [
731
+ {
732
+ "t": "eq",
733
+ "v": "",
734
+ "vt": "str"
735
+ }
736
+ ],
737
+ "checkall": "true",
738
+ "repair": false,
739
+ "outputs": 1,
740
+ "x": 422.8570747375488,
741
+ "y": 1394.8570265769958,
742
+ "wires": [
743
+ [
744
+ "11ce6f9d18c3733b",
745
+ "9cdf0f2efddd09bb",
746
+ "f1af381c0ddab811"
747
+ ]
748
+ ]
749
+ },
750
+ {
751
+ "id": "11ce6f9d18c3733b",
752
+ "type": "change",
753
+ "z": "e02ba6e534f7a0f4",
754
+ "g": "3c1cf76ad7583ad9",
755
+ "name": "",
756
+ "rules": [
757
+ {
758
+ "t": "set",
759
+ "p": "payload",
760
+ "pt": "msg",
761
+ "to": "",
762
+ "tot": "str"
763
+ }
764
+ ],
765
+ "action": "",
766
+ "property": "",
767
+ "from": "",
768
+ "to": "",
769
+ "reg": false,
770
+ "x": 495.7142562866211,
771
+ "y": 1456.2856335639954,
772
+ "wires": [
773
+ [
774
+ "f9ae281ee823f254",
775
+ "cdccfead01d41984"
776
+ ]
777
+ ]
778
+ },
779
+ {
780
+ "id": "9cdf0f2efddd09bb",
781
+ "type": "debug",
782
+ "z": "e02ba6e534f7a0f4",
783
+ "g": "3c1cf76ad7583ad9",
784
+ "name": "debug 23",
785
+ "active": true,
786
+ "tosidebar": true,
787
+ "console": false,
788
+ "tostatus": false,
789
+ "complete": "false",
790
+ "statusVal": "",
791
+ "statusType": "auto",
792
+ "x": 457.14278411865234,
793
+ "y": 1364.8569560050964,
794
+ "wires": []
795
+ },
796
+ {
797
+ "id": "f9ae281ee823f254",
798
+ "type": "switch",
799
+ "z": "e02ba6e534f7a0f4",
800
+ "g": "3c1cf76ad7583ad9",
801
+ "name": "",
802
+ "property": "payload",
803
+ "propertyType": "msg",
804
+ "rules": [
805
+ {
806
+ "t": "eq",
807
+ "v": "",
808
+ "vt": "str"
809
+ }
810
+ ],
811
+ "checkall": "true",
812
+ "repair": false,
813
+ "outputs": 1,
814
+ "x": 505.71420669555664,
815
+ "y": 1409.142741203308,
816
+ "wires": [
817
+ [
818
+ "1059a876dae0d79c"
819
+ ]
820
+ ]
821
+ },
822
+ {
823
+ "id": "f1af381c0ddab811",
824
+ "type": "link out",
825
+ "z": "e02ba6e534f7a0f4",
826
+ "g": "3c1cf76ad7583ad9",
827
+ "name": "link out 1",
828
+ "mode": "link",
829
+ "links": [],
830
+ "x": 549.9999332427979,
831
+ "y": 1407.7141327857971,
832
+ "wires": []
833
+ },
834
+ {
835
+ "id": "cdccfead01d41984",
836
+ "type": "debug",
837
+ "z": "e02ba6e534f7a0f4",
838
+ "g": "3c1cf76ad7583ad9",
839
+ "name": "debug 24",
840
+ "active": true,
841
+ "tosidebar": true,
842
+ "console": false,
843
+ "tostatus": false,
844
+ "complete": "false",
845
+ "statusVal": "",
846
+ "statusType": "auto",
847
+ "x": 502.8571014404297,
848
+ "y": 1457.7141680717468,
849
+ "wires": []
850
+ },
851
+ {
852
+ "id": "1059a876dae0d79c",
853
+ "type": "template",
854
+ "z": "e02ba6e534f7a0f4",
855
+ "g": "3c1cf76ad7583ad9",
856
+ "name": "",
857
+ "field": "payload",
858
+ "fieldType": "msg",
859
+ "format": "handlebars",
860
+ "syntax": "mustache",
861
+ "template": "This is the payload: {{payload}} !",
862
+ "output": "str",
863
+ "x": 478.5713653564453,
864
+ "y": 1381.9999012947083,
865
+ "wires": [
866
+ []
867
+ ]
868
+ },
869
+ {
870
+ "id": "f6cc34400422b572",
871
+ "type": "group",
872
+ "z": "e02ba6e534f7a0f4",
873
+ "name": "copy to clipboard",
874
+ "style": {
875
+ "label": true
876
+ },
877
+ "nodes": [
878
+ "5c6cd958df67f6a6",
879
+ "786ad93c0ecb9be5"
880
+ ],
881
+ "x": 1193.71435546875,
882
+ "y": 1467,
883
+ "w": 570,
884
+ "h": 192
885
+ },
886
+ {
887
+ "id": "5c6cd958df67f6a6",
888
+ "type": "ClientCode",
889
+ "z": "e02ba6e534f7a0f4",
890
+ "g": "f6cc34400422b572",
891
+ "name": "copy to clipboard",
892
+ "clientcode": "(function(pload) {\n function fallbackCopyTextToClipboard(text, cb) {\n var textArea = document.createElement(\"textarea\");\n textArea.value = text;\n\n // Avoid scrolling to bottom\n textArea.style.top = \"0\";\n textArea.style.left = \"0\";\n textArea.style.position = \"fixed\";\n\n document.body.appendChild(textArea);\n textArea.focus();\n textArea.select();\n\n try {\n var successful = document.execCommand('copy');\n var msg = successful ? 'successful' : 'unsuccessful';\n\n if (successful && cb && typeof cb == \"function\") { cb(); }\n\n console.log('Fallback: Copying text command was ' + msg);\n } catch (err) {\n console.error('Fallback: Oops, unable to copy', err);\n }\n\n document.body.removeChild(textArea);\n }\n\n function copyTextToClipboard(text, cb) {\n if (!navigator.clipboard) {\n fallbackCopyTextToClipboard(text,cb);\n return;\n }\n\n navigator.clipboard.writeText(text).then(\n function () {\n if (cb && typeof cb == \"function\") { cb(); }\n console.log('Async: Copying to clipboard was successful!');\n }, function (err) {\n console.error('Async: Could not copy text: ', err);\n }\n );\n }\n\n function copyToClipboard(msg) {\n copyTextToClipboard(msg.payload, () => {\n alert('Payload copied to clipboard')\n });\n }\n\n copyToClipboard({\n payload: pload\n });\n})(payload);\n\nnode.send({ payload: payload })",
893
+ "format": "javascript",
894
+ "x": 1647.71435546875,
895
+ "y": 1618,
896
+ "wires": [
897
+ []
898
+ ]
899
+ },
900
+ {
901
+ "id": "786ad93c0ecb9be5",
902
+ "type": "inject",
903
+ "z": "e02ba6e534f7a0f4",
904
+ "g": "f6cc34400422b572",
905
+ "name": "copy payload to clipboard",
906
+ "props": [
907
+ {
908
+ "p": "payload"
909
+ }
910
+ ],
911
+ "repeat": "",
912
+ "crontab": "",
913
+ "once": false,
914
+ "onceDelay": 0.1,
915
+ "topic": "",
916
+ "payload": "hello world - copied to clipboard",
917
+ "payloadType": "str",
918
+ "x": 1349.71435546875,
919
+ "y": 1508,
920
+ "wires": [
921
+ [
922
+ "5c6cd958df67f6a6"
923
+ ]
924
+ ]
925
+ }
926
+ ]