From 725c9622364b36130d654a706e98599066567aa7 Mon Sep 17 00:00:00 2001 From: Hiroyasu Nishiyama Date: Tue, 3 Nov 2020 14:34:34 +0900 Subject: [PATCH 1/5] add examples for CSV node --- ...fault column name as message sequence.json | 99 +++++++++ ...CSV with default column name as array.json | 99 +++++++++ ...ified column name as message sequence.json | 99 +++++++++ ...name in first row as message sequence.json | 99 +++++++++ ...05 - Convert JavaScript object to CSV.json | 99 +++++++++ ...06 - Convert JavaScript object to CSV.json | 99 +++++++++ ...bjects to CSV with column name header.json | 99 +++++++++ ...Specify column names in input message.json | 99 +++++++++ ...d column name when reset property set.json | 200 ++++++++++++++++++ ... CSV message sequence using join node.json | 150 +++++++++++++ 10 files changed, 1142 insertions(+) create mode 100644 packages/node_modules/@node-red/nodes/examples/parser/csv/01 - Parse CSV with default column name as message sequence.json create mode 100644 packages/node_modules/@node-red/nodes/examples/parser/csv/02 - Parse CSV with default column name as array.json create mode 100644 packages/node_modules/@node-red/nodes/examples/parser/csv/03 - Parse CSV with specified column name as message sequence.json create mode 100644 packages/node_modules/@node-red/nodes/examples/parser/csv/04 - Parse CSV with column name in first row as message sequence.json create mode 100644 packages/node_modules/@node-red/nodes/examples/parser/csv/05 - Convert JavaScript object to CSV.json create mode 100644 packages/node_modules/@node-red/nodes/examples/parser/csv/06 - Convert JavaScript object to CSV.json create mode 100644 packages/node_modules/@node-red/nodes/examples/parser/csv/07 - Convert array of JavaScript objects to CSV with column name header.json create mode 100644 packages/node_modules/@node-red/nodes/examples/parser/csv/08 - Specify column names in input message.json create mode 100644 packages/node_modules/@node-red/nodes/examples/parser/csv/09 - Send column name when reset property set.json create mode 100644 packages/node_modules/@node-red/nodes/examples/parser/csv/10 - Join parsed CSV message sequence using join node.json diff --git a/packages/node_modules/@node-red/nodes/examples/parser/csv/01 - Parse CSV with default column name as message sequence.json b/packages/node_modules/@node-red/nodes/examples/parser/csv/01 - Parse CSV with default column name as message sequence.json new file mode 100644 index 000000000..bcf37bed8 --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/parser/csv/01 - Parse CSV with default column name as message sequence.json @@ -0,0 +1,99 @@ +[ + { + "id": "330f4888.cccb28", + "type": "inject", + "z": "4b63452d.672afc", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 260, + "y": 180, + "wires": [ + [ + "ed11f8d6.5e3c88" + ] + ] + }, + { + "id": "a0288b44.71d488", + "type": "csv", + "z": "4b63452d.672afc", + "name": "", + "sep": ",", + "hdrin": "", + "hdrout": "none", + "multi": "one", + "ret": "\\n", + "temp": "", + "skip": "0", + "strings": true, + "include_empty_strings": "", + "include_null_values": "", + "x": 600, + "y": 180, + "wires": [ + [ + "369cbe42.4af9f2" + ] + ] + }, + { + "id": "ed11f8d6.5e3c88", + "type": "template", + "z": "4b63452d.672afc", + "name": "CSV data", + "field": "payload", + "fieldType": "msg", + "format": "text", + "syntax": "mustache", + "template": "Apple,100,Canada\nOrange,120,USA\nBanana,80,Philippines", + "output": "str", + "x": 430, + "y": 180, + "wires": [ + [ + "a0288b44.71d488" + ] + ] + }, + { + "id": "369cbe42.4af9f2", + "type": "debug", + "z": "4b63452d.672afc", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 780, + "y": 180, + "wires": [] + }, + { + "id": "783cfaa6.52fbe4", + "type": "comment", + "z": "4b63452d.672afc", + "name": "Partse CSV with default column name as messages", + "info": "CSV node can parse input CSV data.\nParsed CSV record can be send as a message sequence.\nEach message payload point to an object with `col`*N* as a key and CSV value as a value.\n", + "x": 330, + "y": 120, + "wires": [] + } +] \ No newline at end of file diff --git a/packages/node_modules/@node-red/nodes/examples/parser/csv/02 - Parse CSV with default column name as array.json b/packages/node_modules/@node-red/nodes/examples/parser/csv/02 - Parse CSV with default column name as array.json new file mode 100644 index 000000000..bfaab885c --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/parser/csv/02 - Parse CSV with default column name as array.json @@ -0,0 +1,99 @@ +[ + { + "id": "98c9d44d.4457b8", + "type": "inject", + "z": "4b63452d.672afc", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 260, + "y": 360, + "wires": [ + [ + "65476517.3d760c" + ] + ] + }, + { + "id": "76df98f7.0dcd08", + "type": "csv", + "z": "4b63452d.672afc", + "name": "", + "sep": ",", + "hdrin": "", + "hdrout": "none", + "multi": "mult", + "ret": "\\n", + "temp": "", + "skip": "0", + "strings": true, + "include_empty_strings": "", + "include_null_values": "", + "x": 600, + "y": 360, + "wires": [ + [ + "557979e0.e6b588" + ] + ] + }, + { + "id": "65476517.3d760c", + "type": "template", + "z": "4b63452d.672afc", + "name": "CSV data", + "field": "payload", + "fieldType": "msg", + "format": "text", + "syntax": "mustache", + "template": "Apple,100,Canada\nOrange,120,USA\nBanana,80,Philippines", + "output": "str", + "x": 430, + "y": 360, + "wires": [ + [ + "76df98f7.0dcd08" + ] + ] + }, + { + "id": "557979e0.e6b588", + "type": "debug", + "z": "4b63452d.672afc", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 780, + "y": 360, + "wires": [] + }, + { + "id": "187f4ab3.4c9ab5", + "type": "comment", + "z": "4b63452d.672afc", + "name": "Partse CSV with default column name as array", + "info": "CSV node can send single message with array of parsed CSV records.\nEach element of the array consists of objects with key-value pair.", + "x": 320, + "y": 300, + "wires": [] + } +] \ No newline at end of file diff --git a/packages/node_modules/@node-red/nodes/examples/parser/csv/03 - Parse CSV with specified column name as message sequence.json b/packages/node_modules/@node-red/nodes/examples/parser/csv/03 - Parse CSV with specified column name as message sequence.json new file mode 100644 index 000000000..abb1fccda --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/parser/csv/03 - Parse CSV with specified column name as message sequence.json @@ -0,0 +1,99 @@ +[ + { + "id": "1216e95b.1b1e87", + "type": "inject", + "z": "4b63452d.672afc", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 260, + "y": 560, + "wires": [ + [ + "e41ffbbc.de2ed8" + ] + ] + }, + { + "id": "286828bc.9233c8", + "type": "csv", + "z": "4b63452d.672afc", + "name": "", + "sep": ",", + "hdrin": "", + "hdrout": "none", + "multi": "one", + "ret": "\\n", + "temp": "kind,price,origin", + "skip": "0", + "strings": true, + "include_empty_strings": "", + "include_null_values": "", + "x": 600, + "y": 560, + "wires": [ + [ + "9d8218c.5550ee8" + ] + ] + }, + { + "id": "e41ffbbc.de2ed8", + "type": "template", + "z": "4b63452d.672afc", + "name": "CSV data", + "field": "payload", + "fieldType": "msg", + "format": "text", + "syntax": "mustache", + "template": "Apple,100,Canada\nOrange,120,USA\nBanana,80,Philippines", + "output": "str", + "x": 430, + "y": 560, + "wires": [ + [ + "286828bc.9233c8" + ] + ] + }, + { + "id": "9d8218c.5550ee8", + "type": "debug", + "z": "4b63452d.672afc", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 780, + "y": 560, + "wires": [] + }, + { + "id": "aaa1ee8f.21e2c", + "type": "comment", + "z": "4b63452d.672afc", + "name": "Partse CSV with specified column name as messages", + "info": "CSV node can specify column name of parsed objects in its settings panel.", + "x": 340, + "y": 500, + "wires": [] + } +] \ No newline at end of file diff --git a/packages/node_modules/@node-red/nodes/examples/parser/csv/04 - Parse CSV with column name in first row as message sequence.json b/packages/node_modules/@node-red/nodes/examples/parser/csv/04 - Parse CSV with column name in first row as message sequence.json new file mode 100644 index 000000000..580849567 --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/parser/csv/04 - Parse CSV with column name in first row as message sequence.json @@ -0,0 +1,99 @@ +[ + { + "id": "24093558.0315aa", + "type": "inject", + "z": "4b63452d.672afc", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 260, + "y": 740, + "wires": [ + [ + "80abaee1.5fa7f" + ] + ] + }, + { + "id": "d4d2ca3f.1d9488", + "type": "csv", + "z": "4b63452d.672afc", + "name": "", + "sep": ",", + "hdrin": true, + "hdrout": "none", + "multi": "one", + "ret": "\\n", + "temp": "", + "skip": "0", + "strings": true, + "include_empty_strings": "", + "include_null_values": "", + "x": 600, + "y": 740, + "wires": [ + [ + "b52791c3.08967" + ] + ] + }, + { + "id": "80abaee1.5fa7f", + "type": "template", + "z": "4b63452d.672afc", + "name": "CSV data", + "field": "payload", + "fieldType": "msg", + "format": "text", + "syntax": "mustache", + "template": "kind,price,origin\nApple,100,Canada\nOrange,120,USA\nBanana,80,Philippines", + "output": "str", + "x": 430, + "y": 740, + "wires": [ + [ + "d4d2ca3f.1d9488" + ] + ] + }, + { + "id": "b52791c3.08967", + "type": "debug", + "z": "4b63452d.672afc", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 780, + "y": 740, + "wires": [] + }, + { + "id": "85091361.85644", + "type": "comment", + "z": "4b63452d.672afc", + "name": "Partse CSV with column name in first row as messages", + "info": "CSV node can use first row of input CSV text as a column name of each record object.\n", + "x": 340, + "y": 680, + "wires": [] + } +] \ No newline at end of file diff --git a/packages/node_modules/@node-red/nodes/examples/parser/csv/05 - Convert JavaScript object to CSV.json b/packages/node_modules/@node-red/nodes/examples/parser/csv/05 - Convert JavaScript object to CSV.json new file mode 100644 index 000000000..a97656085 --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/parser/csv/05 - Convert JavaScript object to CSV.json @@ -0,0 +1,99 @@ +[ + { + "id": "9e93169c.b763a8", + "type": "comment", + "z": "4b63452d.672afc", + "name": "Convert JavaScript object to CSV", + "info": "CSV node can convert a JavaScript object to CSV text.\nEach object contains key-value pair of specified properties.\n", + "x": 270, + "y": 860, + "wires": [] + }, + { + "id": "8ca41fee.3303d", + "type": "inject", + "z": "4b63452d.672afc", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 260, + "y": 920, + "wires": [ + [ + "c466905b.e8c61" + ] + ] + }, + { + "id": "65146d20.d78204", + "type": "csv", + "z": "4b63452d.672afc", + "name": "", + "sep": ",", + "hdrin": false, + "hdrout": "none", + "multi": "one", + "ret": "\\n", + "temp": "kind,price", + "skip": "0", + "strings": true, + "include_empty_strings": "", + "include_null_values": "", + "x": 600, + "y": 920, + "wires": [ + [ + "92e99e67.a37d8" + ] + ] + }, + { + "id": "c466905b.e8c61", + "type": "template", + "z": "4b63452d.672afc", + "name": "JS object", + "field": "payload", + "fieldType": "msg", + "format": "json", + "syntax": "plain", + "template": "{\n \"kind\": \"Apple\",\n \"price\": 100,\n \"origin\": \"Canada\"\n}", + "output": "json", + "x": 430, + "y": 920, + "wires": [ + [ + "65146d20.d78204" + ] + ] + }, + { + "id": "92e99e67.a37d8", + "type": "debug", + "z": "4b63452d.672afc", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 780, + "y": 920, + "wires": [] + } +] \ No newline at end of file diff --git a/packages/node_modules/@node-red/nodes/examples/parser/csv/06 - Convert JavaScript object to CSV.json b/packages/node_modules/@node-red/nodes/examples/parser/csv/06 - Convert JavaScript object to CSV.json new file mode 100644 index 000000000..0266dbe49 --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/parser/csv/06 - Convert JavaScript object to CSV.json @@ -0,0 +1,99 @@ +[ + { + "id": "e89019c5.70ae78", + "type": "comment", + "z": "4b63452d.672afc", + "name": "Convert array of JavaScript objects to CSV", + "info": "CSV node can convert an array of JavaScript objects to multi-line CSV text.", + "x": 300, + "y": 1020, + "wires": [] + }, + { + "id": "bd0d82ed.7b28", + "type": "inject", + "z": "4b63452d.672afc", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 260, + "y": 1080, + "wires": [ + [ + "1d857b8d.3a4014" + ] + ] + }, + { + "id": "66a37667.16ebd8", + "type": "csv", + "z": "4b63452d.672afc", + "name": "", + "sep": ",", + "hdrin": false, + "hdrout": "none", + "multi": "one", + "ret": "\\n", + "temp": "kind,price", + "skip": "0", + "strings": true, + "include_empty_strings": "", + "include_null_values": "", + "x": 600, + "y": 1080, + "wires": [ + [ + "859725fd.dc93d8" + ] + ] + }, + { + "id": "1d857b8d.3a4014", + "type": "template", + "z": "4b63452d.672afc", + "name": "JS object", + "field": "payload", + "fieldType": "msg", + "format": "json", + "syntax": "plain", + "template": "[\n {\n \"kind\": \"Apple\",\n \"price\": 100,\n \"origin\": \"Canada\"\n },\n {\n \"kind\": \"Orange\",\n \"price\": 120,\n \"origin\": \"USA\"\n },\n {\n \"kind\": \"Banana\",\n \"price\": 80,\n \"origin\": \"Philippines\"\n }\n]", + "output": "json", + "x": 430, + "y": 1080, + "wires": [ + [ + "66a37667.16ebd8" + ] + ] + }, + { + "id": "859725fd.dc93d8", + "type": "debug", + "z": "4b63452d.672afc", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 780, + "y": 1080, + "wires": [] + } +] \ No newline at end of file diff --git a/packages/node_modules/@node-red/nodes/examples/parser/csv/07 - Convert array of JavaScript objects to CSV with column name header.json b/packages/node_modules/@node-red/nodes/examples/parser/csv/07 - Convert array of JavaScript objects to CSV with column name header.json new file mode 100644 index 000000000..b1b337a06 --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/parser/csv/07 - Convert array of JavaScript objects to CSV with column name header.json @@ -0,0 +1,99 @@ +[ + { + "id": "2ebdd51e.c5d17a", + "type": "comment", + "z": "4b63452d.672afc", + "name": "Convert array of JavaScript objects to CSV with column name header", + "info": "CSV node can convert an array of JavaScript objects to multi-line CSV text with column name header at first line.", + "x": 390, + "y": 1200, + "wires": [] + }, + { + "id": "2b4d538d.ada07c", + "type": "inject", + "z": "4b63452d.672afc", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 260, + "y": 1260, + "wires": [ + [ + "3e5c9e8.5065b62" + ] + ] + }, + { + "id": "db02c7be.0984e8", + "type": "csv", + "z": "4b63452d.672afc", + "name": "", + "sep": ",", + "hdrin": false, + "hdrout": "all", + "multi": "one", + "ret": "\\n", + "temp": "kind,price", + "skip": "0", + "strings": true, + "include_empty_strings": "", + "include_null_values": "", + "x": 600, + "y": 1260, + "wires": [ + [ + "61f8b772.ddb1f8" + ] + ] + }, + { + "id": "3e5c9e8.5065b62", + "type": "template", + "z": "4b63452d.672afc", + "name": "JS object", + "field": "payload", + "fieldType": "msg", + "format": "json", + "syntax": "plain", + "template": "[\n {\n \"kind\": \"Apple\",\n \"price\": 100,\n \"origin\": \"Canada\"\n },\n {\n \"kind\": \"Orange\",\n \"price\": 120,\n \"origin\": \"USA\"\n },\n {\n \"kind\": \"Banana\",\n \"price\": 80,\n \"origin\": \"Philippines\"\n }\n]", + "output": "json", + "x": 430, + "y": 1260, + "wires": [ + [ + "db02c7be.0984e8" + ] + ] + }, + { + "id": "61f8b772.ddb1f8", + "type": "debug", + "z": "4b63452d.672afc", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 780, + "y": 1260, + "wires": [] + } +] \ No newline at end of file diff --git a/packages/node_modules/@node-red/nodes/examples/parser/csv/08 - Specify column names in input message.json b/packages/node_modules/@node-red/nodes/examples/parser/csv/08 - Specify column names in input message.json new file mode 100644 index 000000000..b1b337a06 --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/parser/csv/08 - Specify column names in input message.json @@ -0,0 +1,99 @@ +[ + { + "id": "2ebdd51e.c5d17a", + "type": "comment", + "z": "4b63452d.672afc", + "name": "Convert array of JavaScript objects to CSV with column name header", + "info": "CSV node can convert an array of JavaScript objects to multi-line CSV text with column name header at first line.", + "x": 390, + "y": 1200, + "wires": [] + }, + { + "id": "2b4d538d.ada07c", + "type": "inject", + "z": "4b63452d.672afc", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 260, + "y": 1260, + "wires": [ + [ + "3e5c9e8.5065b62" + ] + ] + }, + { + "id": "db02c7be.0984e8", + "type": "csv", + "z": "4b63452d.672afc", + "name": "", + "sep": ",", + "hdrin": false, + "hdrout": "all", + "multi": "one", + "ret": "\\n", + "temp": "kind,price", + "skip": "0", + "strings": true, + "include_empty_strings": "", + "include_null_values": "", + "x": 600, + "y": 1260, + "wires": [ + [ + "61f8b772.ddb1f8" + ] + ] + }, + { + "id": "3e5c9e8.5065b62", + "type": "template", + "z": "4b63452d.672afc", + "name": "JS object", + "field": "payload", + "fieldType": "msg", + "format": "json", + "syntax": "plain", + "template": "[\n {\n \"kind\": \"Apple\",\n \"price\": 100,\n \"origin\": \"Canada\"\n },\n {\n \"kind\": \"Orange\",\n \"price\": 120,\n \"origin\": \"USA\"\n },\n {\n \"kind\": \"Banana\",\n \"price\": 80,\n \"origin\": \"Philippines\"\n }\n]", + "output": "json", + "x": 430, + "y": 1260, + "wires": [ + [ + "db02c7be.0984e8" + ] + ] + }, + { + "id": "61f8b772.ddb1f8", + "type": "debug", + "z": "4b63452d.672afc", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 780, + "y": 1260, + "wires": [] + } +] \ No newline at end of file diff --git a/packages/node_modules/@node-red/nodes/examples/parser/csv/09 - Send column name when reset property set.json b/packages/node_modules/@node-red/nodes/examples/parser/csv/09 - Send column name when reset property set.json new file mode 100644 index 000000000..81d9b4730 --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/parser/csv/09 - Send column name when reset property set.json @@ -0,0 +1,200 @@ +[ + { + "id": "1ae28939.9f5fc7", + "type": "comment", + "z": "4b63452d.672afc", + "name": "Send column name when reset property set", + "info": "CSV node can send column names at first or `reset` property exists in input message.", + "x": 310, + "y": 1540, + "wires": [] + }, + { + "id": "c16ad95b.4f9ac8", + "type": "inject", + "z": "4b63452d.672afc", + "name": "Apple", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 250, + "y": 1600, + "wires": [ + [ + "7f7bfc72.aed104" + ] + ] + }, + { + "id": "870620b9.95343", + "type": "csv", + "z": "4b63452d.672afc", + "name": "", + "sep": ",", + "hdrin": false, + "hdrout": "once", + "multi": "one", + "ret": "\\n", + "temp": "kind,price", + "skip": "0", + "strings": true, + "include_empty_strings": "", + "include_null_values": "", + "x": 650, + "y": 1720, + "wires": [ + [ + "d960de42.619c7" + ] + ] + }, + { + "id": "7f7bfc72.aed104", + "type": "template", + "z": "4b63452d.672afc", + "name": "JS object", + "field": "payload", + "fieldType": "msg", + "format": "json", + "syntax": "plain", + "template": "{\n \"kind\": \"Apple\",\n \"price\": 100,\n \"origin\": \"Canada\"\n}", + "output": "json", + "x": 470, + "y": 1600, + "wires": [ + [ + "870620b9.95343" + ] + ] + }, + { + "id": "d960de42.619c7", + "type": "debug", + "z": "4b63452d.672afc", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 830, + "y": 1720, + "wires": [] + }, + { + "id": "6f8296e.f95ca68", + "type": "inject", + "z": "4b63452d.672afc", + "name": "Orange", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 250, + "y": 1660, + "wires": [ + [ + "c37d0dfa.ec1ab" + ] + ] + }, + { + "id": "c37d0dfa.ec1ab", + "type": "template", + "z": "4b63452d.672afc", + "name": "JS object", + "field": "payload", + "fieldType": "msg", + "format": "json", + "syntax": "plain", + "template": "{\n \"kind\": \"Orange\",\n \"price\": 120,\n \"origin\": \"USA\"\n}\n", + "output": "json", + "x": 470, + "y": 1660, + "wires": [ + [ + "870620b9.95343" + ] + ] + }, + { + "id": "35209fe2.16926", + "type": "inject", + "z": "4b63452d.672afc", + "name": "Banana & reset", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + }, + { + "p": "reset", + "v": "", + "vt": "date" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 280, + "y": 1720, + "wires": [ + [ + "afd4e6b3.624a28" + ] + ] + }, + { + "id": "afd4e6b3.624a28", + "type": "template", + "z": "4b63452d.672afc", + "name": "JS object", + "field": "payload", + "fieldType": "msg", + "format": "json", + "syntax": "plain", + "template": "{\n \"kind\": \"Banana\",\n \"price\": 80,\n \"origin\": \"Philippines\"\n}", + "output": "json", + "x": 470, + "y": 1720, + "wires": [ + [ + "870620b9.95343" + ] + ] + } +] \ No newline at end of file diff --git a/packages/node_modules/@node-red/nodes/examples/parser/csv/10 - Join parsed CSV message sequence using join node.json b/packages/node_modules/@node-red/nodes/examples/parser/csv/10 - Join parsed CSV message sequence using join node.json new file mode 100644 index 000000000..87036d8ee --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/parser/csv/10 - Join parsed CSV message sequence using join node.json @@ -0,0 +1,150 @@ +[ + { + "id": "195c168c.44f149", + "type": "inject", + "z": "4b63452d.672afc", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 260, + "y": 1900, + "wires": [ + [ + "b270564c.171908" + ] + ] + }, + { + "id": "8ec8cf9e.103fa", + "type": "csv", + "z": "4b63452d.672afc", + "name": "", + "sep": ",", + "hdrin": true, + "hdrout": "none", + "multi": "one", + "ret": "\\n", + "temp": "", + "skip": "0", + "strings": true, + "include_empty_strings": "", + "include_null_values": "", + "x": 600, + "y": 1900, + "wires": [ + [ + "5c5254a8.bc562c" + ] + ] + }, + { + "id": "b270564c.171908", + "type": "template", + "z": "4b63452d.672afc", + "name": "CSV data", + "field": "payload", + "fieldType": "msg", + "format": "text", + "syntax": "mustache", + "template": "kind,price,origin\nApple,100,Canada\nOrange,120,USA\nBanana,80,Philippines", + "output": "str", + "x": 430, + "y": 1900, + "wires": [ + [ + "8ec8cf9e.103fa" + ] + ] + }, + { + "id": "1c7be442.6a4bdc", + "type": "debug", + "z": "4b63452d.672afc", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 1090, + "y": 1900, + "wires": [] + }, + { + "id": "d3da7cfb.cf596", + "type": "comment", + "z": "4b63452d.672afc", + "name": "Join parsed CSV message sequence using join node", + "info": "Parset CSV message sequence can be joined by join node.", + "x": 330, + "y": 1840, + "wires": [] + }, + { + "id": "a07c9e26.c84fd", + "type": "csv", + "z": "4b63452d.672afc", + "name": "", + "sep": ",", + "hdrin": "", + "hdrout": "none", + "multi": "one", + "ret": "\\n", + "temp": "kind,price", + "skip": "0", + "strings": true, + "include_empty_strings": "", + "include_null_values": "", + "x": 910, + "y": 1900, + "wires": [ + [ + "1c7be442.6a4bdc" + ] + ] + }, + { + "id": "5c5254a8.bc562c", + "type": "join", + "z": "4b63452d.672afc", + "name": "", + "mode": "auto", + "build": "string", + "property": "payload", + "propertyType": "msg", + "key": "topic", + "joiner": "\\n", + "joinerType": "str", + "accumulate": false, + "timeout": "", + "count": "", + "reduceRight": false, + "reduceExp": "", + "reduceInit": "", + "reduceInitType": "", + "reduceFixup": "", + "x": 750, + "y": 1900, + "wires": [ + [ + "a07c9e26.c84fd" + ] + ] + } +] \ No newline at end of file From bc82ca21060eac6b4dbd7dc46b559c7021b765a6 Mon Sep 17 00:00:00 2001 From: Hiroyasu Nishiyama Date: Tue, 3 Nov 2020 17:32:53 +0900 Subject: [PATCH 2/5] add examples for HTML node --- ...array of HTML element by CSS selector.json | 94 ++++++++++++++ ...uence of HTML element by CSS selector.json | 94 ++++++++++++++ ... by CSS selector specified in message.json | 121 +++++++++++++++++ ...uence of HTML element using join node.json | 122 ++++++++++++++++++ 4 files changed, 431 insertions(+) create mode 100644 packages/node_modules/@node-red/nodes/examples/parser/html/01 - Extract array of HTML element by CSS selector.json create mode 100644 packages/node_modules/@node-red/nodes/examples/parser/html/02 - Extract sequence of HTML element by CSS selector.json create mode 100644 packages/node_modules/@node-red/nodes/examples/parser/html/03 - Extract array of HTML element by CSS selector specified in message.json create mode 100644 packages/node_modules/@node-red/nodes/examples/parser/html/04 - Join extracedt sequence of HTML element using join node.json diff --git a/packages/node_modules/@node-red/nodes/examples/parser/html/01 - Extract array of HTML element by CSS selector.json b/packages/node_modules/@node-red/nodes/examples/parser/html/01 - Extract array of HTML element by CSS selector.json new file mode 100644 index 000000000..14ef21214 --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/parser/html/01 - Extract array of HTML element by CSS selector.json @@ -0,0 +1,94 @@ +[ + { + "id": "8c5224a6.201b88", + "type": "inject", + "z": "4b63452d.672afc", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 220, + "y": 180, + "wires": [ + [ + "d6c67e51.0d709" + ] + ] + }, + { + "id": "d6c67e51.0d709", + "type": "template", + "z": "4b63452d.672afc", + "name": "HTML text", + "field": "payload", + "fieldType": "msg", + "format": "handlebars", + "syntax": "plain", + "template": "\n \n List of Fruits\n \n \n \n \n\n", + "output": "str", + "x": 390, + "y": 180, + "wires": [ + [ + "599a1155.61a5c" + ] + ] + }, + { + "id": "b0d5cd89.338df", + "type": "comment", + "z": "4b63452d.672afc", + "name": "Extract array of HTML element by CSS selector", + "info": "HTML node can be used to extract elements in HTML document as an array using CSS selector.", + "x": 280, + "y": 120, + "wires": [] + }, + { + "id": "599a1155.61a5c", + "type": "html", + "z": "4b63452d.672afc", + "name": "", + "property": "payload", + "outproperty": "payload", + "tag": ".Item", + "ret": "html", + "as": "single", + "x": 550, + "y": 180, + "wires": [ + [ + "942b23d1.cce09" + ] + ] + }, + { + "id": "942b23d1.cce09", + "type": "debug", + "z": "4b63452d.672afc", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 710, + "y": 180, + "wires": [] + } +] \ No newline at end of file diff --git a/packages/node_modules/@node-red/nodes/examples/parser/html/02 - Extract sequence of HTML element by CSS selector.json b/packages/node_modules/@node-red/nodes/examples/parser/html/02 - Extract sequence of HTML element by CSS selector.json new file mode 100644 index 000000000..ccd3bc782 --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/parser/html/02 - Extract sequence of HTML element by CSS selector.json @@ -0,0 +1,94 @@ +[ + { + "id": "a44973e8.6319b", + "type": "inject", + "z": "4b63452d.672afc", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 220, + "y": 360, + "wires": [ + [ + "de1b012e.96ec3" + ] + ] + }, + { + "id": "de1b012e.96ec3", + "type": "template", + "z": "4b63452d.672afc", + "name": "HTML text", + "field": "payload", + "fieldType": "msg", + "format": "handlebars", + "syntax": "plain", + "template": "\n \n List of Fruits\n \n \n \n \n\n", + "output": "str", + "x": 390, + "y": 360, + "wires": [ + [ + "cee70712.6f3538" + ] + ] + }, + { + "id": "99e32bc7.c8e508", + "type": "comment", + "z": "4b63452d.672afc", + "name": "Extract sequence of HTML element by CSS selector", + "info": "HTML node can be used to extract elements in HTML document as a messege sequence using CSS selector.", + "x": 290, + "y": 300, + "wires": [] + }, + { + "id": "cee70712.6f3538", + "type": "html", + "z": "4b63452d.672afc", + "name": "", + "property": "payload", + "outproperty": "payload", + "tag": ".Item", + "ret": "html", + "as": "multi", + "x": 550, + "y": 360, + "wires": [ + [ + "17f25482.d4b56b" + ] + ] + }, + { + "id": "17f25482.d4b56b", + "type": "debug", + "z": "4b63452d.672afc", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 710, + "y": 360, + "wires": [] + } +] \ No newline at end of file diff --git a/packages/node_modules/@node-red/nodes/examples/parser/html/03 - Extract array of HTML element by CSS selector specified in message.json b/packages/node_modules/@node-red/nodes/examples/parser/html/03 - Extract array of HTML element by CSS selector specified in message.json new file mode 100644 index 000000000..ad2400ef6 --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/parser/html/03 - Extract array of HTML element by CSS selector specified in message.json @@ -0,0 +1,121 @@ +[ + { + "id": "653ce9aa.b6a1c8", + "type": "inject", + "z": "4b63452d.672afc", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 220, + "y": 560, + "wires": [ + [ + "52a16f7f.447d8" + ] + ] + }, + { + "id": "52a16f7f.447d8", + "type": "template", + "z": "4b63452d.672afc", + "name": "HTML text", + "field": "payload", + "fieldType": "msg", + "format": "handlebars", + "syntax": "plain", + "template": "\n \n List of Fruits\n \n \n \n \n\n", + "output": "str", + "x": 390, + "y": 560, + "wires": [ + [ + "a52319c3.89b008" + ] + ] + }, + { + "id": "8bc35379.31d99", + "type": "comment", + "z": "4b63452d.672afc", + "name": "Extract array of HTML element by CSS selector specified in message", + "info": "CSS selector for HTML node can be specified by `select` property of input message.", + "x": 350, + "y": 500, + "wires": [] + }, + { + "id": "9c49de8a.bad25", + "type": "html", + "z": "4b63452d.672afc", + "name": "", + "property": "payload", + "outproperty": "payload", + "tag": "", + "ret": "html", + "as": "single", + "x": 730, + "y": 560, + "wires": [ + [ + "d4f4b987.278a68" + ] + ] + }, + { + "id": "d4f4b987.278a68", + "type": "debug", + "z": "4b63452d.672afc", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 890, + "y": 560, + "wires": [] + }, + { + "id": "a52319c3.89b008", + "type": "change", + "z": "4b63452d.672afc", + "name": "", + "rules": [ + { + "t": "set", + "p": "select", + "pt": "msg", + "to": ".Item", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 560, + "y": 560, + "wires": [ + [ + "9c49de8a.bad25" + ] + ] + } +] \ No newline at end of file diff --git a/packages/node_modules/@node-red/nodes/examples/parser/html/04 - Join extracedt sequence of HTML element using join node.json b/packages/node_modules/@node-red/nodes/examples/parser/html/04 - Join extracedt sequence of HTML element using join node.json new file mode 100644 index 000000000..919953284 --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/parser/html/04 - Join extracedt sequence of HTML element using join node.json @@ -0,0 +1,122 @@ +[ + { + "id": "66cff4ee.f2761c", + "type": "inject", + "z": "4b63452d.672afc", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 220, + "y": 760, + "wires": [ + [ + "2baaf6bf.0a02ca" + ] + ] + }, + { + "id": "2baaf6bf.0a02ca", + "type": "template", + "z": "4b63452d.672afc", + "name": "HTML text", + "field": "payload", + "fieldType": "msg", + "format": "handlebars", + "syntax": "plain", + "template": "\n \n List of Fruits\n \n \n \n \n\n", + "output": "str", + "x": 390, + "y": 760, + "wires": [ + [ + "bbb22e6b.0fa25" + ] + ] + }, + { + "id": "a57d35d0.8aa538", + "type": "comment", + "z": "4b63452d.672afc", + "name": "Join extracedt sequence of HTML element using join node", + "info": "Message sequence extracted by HTML node can be combined using join node.", + "x": 310, + "y": 700, + "wires": [] + }, + { + "id": "bbb22e6b.0fa25", + "type": "html", + "z": "4b63452d.672afc", + "name": "", + "property": "payload", + "outproperty": "payload", + "tag": ".Item", + "ret": "html", + "as": "multi", + "x": 550, + "y": 760, + "wires": [ + [ + "bd01ca4.966ad38" + ] + ] + }, + { + "id": "4d2616a8.84de88", + "type": "debug", + "z": "4b63452d.672afc", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 850, + "y": 760, + "wires": [] + }, + { + "id": "bd01ca4.966ad38", + "type": "join", + "z": "4b63452d.672afc", + "name": "", + "mode": "custom", + "build": "string", + "property": "payload", + "propertyType": "msg", + "key": "topic", + "joiner": ",", + "joinerType": "str", + "accumulate": false, + "timeout": "", + "count": "", + "reduceRight": false, + "reduceExp": "", + "reduceInit": "", + "reduceInitType": "", + "reduceFixup": "", + "x": 690, + "y": 760, + "wires": [ + [ + "4d2616a8.84de88" + ] + ] + } +] \ No newline at end of file From dac7830bd4b6f9a50a15b1a8fb11d341be5cb8cd Mon Sep 17 00:00:00 2001 From: Hiroyasu Nishiyama Date: Tue, 3 Nov 2020 20:06:18 +0900 Subject: [PATCH 3/5] add example for JSON node --- ...vert JSON string to JavaScript object.json | 92 ++++++++++ ...vert JavaScript object to JSON string.json | 92 ++++++++++ .../json/03 - Validate input JSON string.json | 160 ++++++++++++++++++ 3 files changed, 344 insertions(+) create mode 100644 packages/node_modules/@node-red/nodes/examples/parser/json/01 - Convert JSON string to JavaScript object.json create mode 100644 packages/node_modules/@node-red/nodes/examples/parser/json/02 - Convert JavaScript object to JSON string.json create mode 100644 packages/node_modules/@node-red/nodes/examples/parser/json/03 - Validate input JSON string.json diff --git a/packages/node_modules/@node-red/nodes/examples/parser/json/01 - Convert JSON string to JavaScript object.json b/packages/node_modules/@node-red/nodes/examples/parser/json/01 - Convert JSON string to JavaScript object.json new file mode 100644 index 000000000..c95e71a7d --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/parser/json/01 - Convert JSON string to JavaScript object.json @@ -0,0 +1,92 @@ +[ + { + "id": "9976e95d.2f8398", + "type": "inject", + "z": "4b63452d.672afc", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 240, + "y": 180, + "wires": [ + [ + "d94fc083.49d87" + ] + ] + }, + { + "id": "6684abb1.8eb454", + "type": "comment", + "z": "4b63452d.672afc", + "name": "Convert JSON string to JS object", + "info": "JSON node can convert JSON string to JavaScript object.", + "x": 250, + "y": 120, + "wires": [] + }, + { + "id": "d94fc083.49d87", + "type": "template", + "z": "4b63452d.672afc", + "name": "JSON string", + "field": "payload", + "fieldType": "msg", + "format": "json", + "syntax": "plain", + "template": "{\n \"kind\": \"Apple\",\n \"price\": 100,\n \"origin\": \"Canada\"\n}", + "output": "str", + "x": 410, + "y": 180, + "wires": [ + [ + "1a3dc54a.78598b" + ] + ] + }, + { + "id": "8950a55d.023988", + "type": "debug", + "z": "4b63452d.672afc", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 730, + "y": 180, + "wires": [] + }, + { + "id": "1a3dc54a.78598b", + "type": "json", + "z": "4b63452d.672afc", + "name": "", + "property": "payload", + "action": "", + "pretty": false, + "x": 570, + "y": 180, + "wires": [ + [ + "8950a55d.023988" + ] + ] + } +] \ No newline at end of file diff --git a/packages/node_modules/@node-red/nodes/examples/parser/json/02 - Convert JavaScript object to JSON string.json b/packages/node_modules/@node-red/nodes/examples/parser/json/02 - Convert JavaScript object to JSON string.json new file mode 100644 index 000000000..a10cc75b9 --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/parser/json/02 - Convert JavaScript object to JSON string.json @@ -0,0 +1,92 @@ +[ + { + "id": "cb13761f.56c328", + "type": "inject", + "z": "4b63452d.672afc", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 240, + "y": 380, + "wires": [ + [ + "c607642a.78c3c8" + ] + ] + }, + { + "id": "180b1e22.0074e2", + "type": "comment", + "z": "4b63452d.672afc", + "name": "Convert JS object to JSON string", + "info": "JSON node can convert JavaScript object to JSON string.", + "x": 250, + "y": 320, + "wires": [] + }, + { + "id": "c607642a.78c3c8", + "type": "template", + "z": "4b63452d.672afc", + "name": "JS object", + "field": "payload", + "fieldType": "msg", + "format": "json", + "syntax": "plain", + "template": "{\n \"kind\": \"Apple\",\n \"price\": 100,\n \"origin\": \"Canada\"\n}", + "output": "json", + "x": 400, + "y": 380, + "wires": [ + [ + "bf309844.fa12e8" + ] + ] + }, + { + "id": "5b6b130b.72a14c", + "type": "debug", + "z": "4b63452d.672afc", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 730, + "y": 380, + "wires": [] + }, + { + "id": "bf309844.fa12e8", + "type": "json", + "z": "4b63452d.672afc", + "name": "", + "property": "payload", + "action": "", + "pretty": false, + "x": 570, + "y": 380, + "wires": [ + [ + "5b6b130b.72a14c" + ] + ] + } +] \ No newline at end of file diff --git a/packages/node_modules/@node-red/nodes/examples/parser/json/03 - Validate input JSON string.json b/packages/node_modules/@node-red/nodes/examples/parser/json/03 - Validate input JSON string.json new file mode 100644 index 000000000..6271f00c6 --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/parser/json/03 - Validate input JSON string.json @@ -0,0 +1,160 @@ +[ + { + "id": "2b18621b.e2670e", + "type": "inject", + "z": "4b63452d.672afc", + "name": "OK", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 230, + "y": 580, + "wires": [ + [ + "5986faee.aef954" + ] + ] + }, + { + "id": "59acf99.9a92308", + "type": "comment", + "z": "4b63452d.672afc", + "name": "Validate input JSON string", + "info": "JSON node can validate input JSON string using [JSON schema](https://json-schema.org/) when converting to JavaScript object.", + "x": 230, + "y": 520, + "wires": [] + }, + { + "id": "5986faee.aef954", + "type": "template", + "z": "4b63452d.672afc", + "name": "JSON string", + "field": "payload", + "fieldType": "msg", + "format": "json", + "syntax": "plain", + "template": "{\n \"kind\": \"Apple\",\n \"price\": 100,\n \"origin\": \"Canada\"\n}", + "output": "str", + "x": 410, + "y": 580, + "wires": [ + [ + "f8a67c6d.4f1f1" + ] + ] + }, + { + "id": "ca27c92c.ad7cb8", + "type": "debug", + "z": "4b63452d.672afc", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "payload", + "targetType": "msg", + "statusVal": "", + "statusType": "auto", + "x": 910, + "y": 580, + "wires": [] + }, + { + "id": "2fad9978.ea1916", + "type": "json", + "z": "4b63452d.672afc", + "name": "", + "property": "payload", + "action": "", + "pretty": false, + "x": 750, + "y": 580, + "wires": [ + [ + "ca27c92c.ad7cb8" + ] + ] + }, + { + "id": "f8a67c6d.4f1f1", + "type": "template", + "z": "4b63452d.672afc", + "name": "Schema", + "field": "schema", + "fieldType": "msg", + "format": "json", + "syntax": "plain", + "template": "{\n \"type\": \"object\",\n \"properties\": {\n \"kind\": {\n \"type\": \"string\"\n },\n \"price\": {\n \"type\": \"number\"\n },\n \"origin\": {\n \"type\": \"string\"\n }\n }\n}", + "output": "json", + "x": 590, + "y": 580, + "wires": [ + [ + "2fad9978.ea1916" + ] + ] + }, + { + "id": "8337e847.ac18d8", + "type": "inject", + "z": "4b63452d.672afc", + "name": "NG", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 230, + "y": 660, + "wires": [ + [ + "fa14d8bf.1ac938" + ] + ] + }, + { + "id": "fa14d8bf.1ac938", + "type": "template", + "z": "4b63452d.672afc", + "name": "JSON string", + "field": "payload", + "fieldType": "msg", + "format": "json", + "syntax": "plain", + "template": "{\n \"kind\": \"Apple\",\n \"price\": \"100\",\n \"origin\": \"Canada\"\n}", + "output": "str", + "x": 410, + "y": 660, + "wires": [ + [ + "f8a67c6d.4f1f1" + ] + ] + } +] \ No newline at end of file From ccbd179f23b5e42b631b71855eda10028e848914 Mon Sep 17 00:00:00 2001 From: Hiroyasu Nishiyama Date: Tue, 3 Nov 2020 20:06:27 +0900 Subject: [PATCH 4/5] add example for XML node --- ...01 - Convert JavaScript object to XML.json | 92 ++++++++++++++ ...02 - Convert XML to JavaScript object.json | 92 ++++++++++++++ ...rol conversion using options property.json | 119 ++++++++++++++++++ 3 files changed, 303 insertions(+) create mode 100644 packages/node_modules/@node-red/nodes/examples/parser/xml/01 - Convert JavaScript object to XML.json create mode 100644 packages/node_modules/@node-red/nodes/examples/parser/xml/02 - Convert XML to JavaScript object.json create mode 100644 packages/node_modules/@node-red/nodes/examples/parser/xml/03 - Control conversion using options property.json diff --git a/packages/node_modules/@node-red/nodes/examples/parser/xml/01 - Convert JavaScript object to XML.json b/packages/node_modules/@node-red/nodes/examples/parser/xml/01 - Convert JavaScript object to XML.json new file mode 100644 index 000000000..3a97c8498 --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/parser/xml/01 - Convert JavaScript object to XML.json @@ -0,0 +1,92 @@ +[ + { + "id": "82f1bd0b.43474", + "type": "xml", + "z": "4b63452d.672afc", + "name": "", + "property": "payload", + "attr": "", + "chr": "", + "x": 530, + "y": 180, + "wires": [ + [ + "1cd4ad02.9a5423" + ] + ] + }, + { + "id": "84222b92.d65d18", + "type": "inject", + "z": "4b63452d.672afc", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 200, + "y": 180, + "wires": [ + [ + "cdd1c154.3a655" + ] + ] + }, + { + "id": "7b014430.dfd94c", + "type": "comment", + "z": "4b63452d.672afc", + "name": "Convert JavaScript object to XML", + "info": "XML node can convert JavaScript object to XML string.", + "x": 240, + "y": 120, + "wires": [] + }, + { + "id": "1cd4ad02.9a5423", + "type": "debug", + "z": "4b63452d.672afc", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 690, + "y": 180, + "wires": [] + }, + { + "id": "cdd1c154.3a655", + "type": "template", + "z": "4b63452d.672afc", + "name": "JS object", + "field": "payload", + "fieldType": "msg", + "format": "json", + "syntax": "plain", + "template": "{\n \"kind\": \"Apple\",\n \"price\": 100,\n \"origin\": \"Canada\"\n}", + "output": "json", + "x": 360, + "y": 180, + "wires": [ + [ + "82f1bd0b.43474" + ] + ] + } +] \ No newline at end of file diff --git a/packages/node_modules/@node-red/nodes/examples/parser/xml/02 - Convert XML to JavaScript object.json b/packages/node_modules/@node-red/nodes/examples/parser/xml/02 - Convert XML to JavaScript object.json new file mode 100644 index 000000000..5e46428ef --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/parser/xml/02 - Convert XML to JavaScript object.json @@ -0,0 +1,92 @@ +[ + { + "id": "93e423a9.a407d", + "type": "xml", + "z": "4b63452d.672afc", + "name": "", + "property": "payload", + "attr": "", + "chr": "", + "x": 530, + "y": 360, + "wires": [ + [ + "2d0dde7e.a50082" + ] + ] + }, + { + "id": "ba1dab90.8d1da8", + "type": "inject", + "z": "4b63452d.672afc", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 200, + "y": 360, + "wires": [ + [ + "16617f26.14ced1" + ] + ] + }, + { + "id": "a9f97b00.57d658", + "type": "comment", + "z": "4b63452d.672afc", + "name": "Convert XML to JavaScript object", + "info": "XML node can convert XML string to JavaScript object.", + "x": 240, + "y": 300, + "wires": [] + }, + { + "id": "2d0dde7e.a50082", + "type": "debug", + "z": "4b63452d.672afc", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 690, + "y": 360, + "wires": [] + }, + { + "id": "16617f26.14ced1", + "type": "template", + "z": "4b63452d.672afc", + "name": "XML string", + "field": "payload", + "fieldType": "msg", + "format": "html", + "syntax": "plain", + "template": "\n\n Apple\n 100\n Canada\n", + "output": "str", + "x": 370, + "y": 360, + "wires": [ + [ + "93e423a9.a407d" + ] + ] + } +] \ No newline at end of file diff --git a/packages/node_modules/@node-red/nodes/examples/parser/xml/03 - Control conversion using options property.json b/packages/node_modules/@node-red/nodes/examples/parser/xml/03 - Control conversion using options property.json new file mode 100644 index 000000000..7a3c39f7e --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/parser/xml/03 - Control conversion using options property.json @@ -0,0 +1,119 @@ +[ + { + "id": "581bd648.636628", + "type": "xml", + "z": "4b63452d.672afc", + "name": "", + "property": "payload", + "attr": "", + "chr": "", + "x": 710, + "y": 540, + "wires": [ + [ + "b74237dc.1e5028" + ] + ] + }, + { + "id": "d0899f9b.f1ac6", + "type": "inject", + "z": "4b63452d.672afc", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 200, + "y": 540, + "wires": [ + [ + "f04ffb9a.68edb8" + ] + ] + }, + { + "id": "8a214c05.dc61f", + "type": "comment", + "z": "4b63452d.672afc", + "name": "Control conversion using options property", + "info": "XML node can control conversion by setting `options` property (defined by [xml2js](https://github.com/Leonidas-from-XIV/node-xml2js/blob/master/README.md#options)) in input message.", + "x": 260, + "y": 480, + "wires": [] + }, + { + "id": "b74237dc.1e5028", + "type": "debug", + "z": "4b63452d.672afc", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 870, + "y": 540, + "wires": [] + }, + { + "id": "f04ffb9a.68edb8", + "type": "template", + "z": "4b63452d.672afc", + "name": "XML string", + "field": "payload", + "fieldType": "msg", + "format": "html", + "syntax": "plain", + "template": "\n\n Apple\n 100\n Canada\n", + "output": "str", + "x": 370, + "y": 540, + "wires": [ + [ + "fedf79.5889c088" + ] + ] + }, + { + "id": "fedf79.5889c088", + "type": "change", + "z": "4b63452d.672afc", + "name": "set options", + "rules": [ + { + "t": "set", + "p": "options", + "pt": "msg", + "to": "{\"explicitArray\":false}", + "tot": "json" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 550, + "y": 540, + "wires": [ + [ + "581bd648.636628" + ] + ] + } +] \ No newline at end of file From b8bc62ee11296ae03f0bbd0f8635697f08205094 Mon Sep 17 00:00:00 2001 From: Hiroyasu Nishiyama Date: Tue, 3 Nov 2020 20:54:04 +0900 Subject: [PATCH 5/5] add example for YAML node --- ...1 - Convert JavaScript object to YAML.json | 90 +++++++++++++++++++ ...2 - Convert YAML to JavaScript object.json | 90 +++++++++++++++++++ 2 files changed, 180 insertions(+) create mode 100644 packages/node_modules/@node-red/nodes/examples/parser/yaml/01 - Convert JavaScript object to YAML.json create mode 100644 packages/node_modules/@node-red/nodes/examples/parser/yaml/02 - Convert YAML to JavaScript object.json diff --git a/packages/node_modules/@node-red/nodes/examples/parser/yaml/01 - Convert JavaScript object to YAML.json b/packages/node_modules/@node-red/nodes/examples/parser/yaml/01 - Convert JavaScript object to YAML.json new file mode 100644 index 000000000..d751a8731 --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/parser/yaml/01 - Convert JavaScript object to YAML.json @@ -0,0 +1,90 @@ +[ + { + "id": "84222b92.d65d18", + "type": "inject", + "z": "4b63452d.672afc", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 200, + "y": 180, + "wires": [ + [ + "cdd1c154.3a655" + ] + ] + }, + { + "id": "7b014430.dfd94c", + "type": "comment", + "z": "4b63452d.672afc", + "name": "Convert JavaScript object to YAML", + "info": "YAML node can convert JavaScript object to YAML string.", + "x": 240, + "y": 120, + "wires": [] + }, + { + "id": "1cd4ad02.9a5423", + "type": "debug", + "z": "4b63452d.672afc", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 670, + "y": 180, + "wires": [] + }, + { + "id": "cdd1c154.3a655", + "type": "template", + "z": "4b63452d.672afc", + "name": "JS object", + "field": "payload", + "fieldType": "msg", + "format": "json", + "syntax": "plain", + "template": "{\n \"fruits\" : {\n \"kind\": \"Apple\",\n \"price\": 100,\n \"origin\": \"Canada\"\n }\n}", + "output": "json", + "x": 360, + "y": 180, + "wires": [ + [ + "aaf0100b.16628" + ] + ] + }, + { + "id": "aaf0100b.16628", + "type": "yaml", + "z": "4b63452d.672afc", + "property": "payload", + "name": "", + "x": 510, + "y": 180, + "wires": [ + [ + "1cd4ad02.9a5423" + ] + ] + } +] \ No newline at end of file diff --git a/packages/node_modules/@node-red/nodes/examples/parser/yaml/02 - Convert YAML to JavaScript object.json b/packages/node_modules/@node-red/nodes/examples/parser/yaml/02 - Convert YAML to JavaScript object.json new file mode 100644 index 000000000..d80e0d144 --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/parser/yaml/02 - Convert YAML to JavaScript object.json @@ -0,0 +1,90 @@ +[ + { + "id": "ba1dab90.8d1da8", + "type": "inject", + "z": "4b63452d.672afc", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 200, + "y": 360, + "wires": [ + [ + "16617f26.14ced1" + ] + ] + }, + { + "id": "a9f97b00.57d658", + "type": "comment", + "z": "4b63452d.672afc", + "name": "Convert YAML to JavaScript object", + "info": "YAML node can convert YAML string to JavaScript object.", + "x": 240, + "y": 300, + "wires": [] + }, + { + "id": "2d0dde7e.a50082", + "type": "debug", + "z": "4b63452d.672afc", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 690, + "y": 360, + "wires": [] + }, + { + "id": "16617f26.14ced1", + "type": "template", + "z": "4b63452d.672afc", + "name": "YAML string", + "field": "payload", + "fieldType": "msg", + "format": "yaml", + "syntax": "plain", + "template": "fruits:\n kind: Apple\n price: 100\n origin: Canada", + "output": "str", + "x": 370, + "y": 360, + "wires": [ + [ + "e2e4f862.f9d7d8" + ] + ] + }, + { + "id": "e2e4f862.f9d7d8", + "type": "yaml", + "z": "4b63452d.672afc", + "property": "payload", + "name": "", + "x": 530, + "y": 360, + "wires": [ + [ + "2d0dde7e.a50082" + ] + ] + } +] \ No newline at end of file