Skip to content

Commit 8a49328

Browse files
authored
Add pipe as separator in Write CSV attachment from JSON Array and Write CSV attachment from JSON Object actions (#80)
* Add pipe to list of separators in `Write CSV attachment from JSON Array` and `Write CSV attachment from JSON Object` actions * Bump dependencies
1 parent b4d314c commit 8a49328

File tree

8 files changed

+107
-84
lines changed

8 files changed

+107
-84
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.2.0 (April 23, 2021)
2+
* Add pipe to list of separators in `Write CSV attachment from JSON Array` and `Write CSV attachment from JSON Object` actions
3+
* Bump dependencies
4+
15
## 2.1.7 (March 12, 2021)
26

37
* Add support for reading a file from a remote URL in Read CSV attachment action

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ able to handle file attachments.
9898
### Write CSV attachment from JSON Object
9999

100100
* `Include Header` - this select configures output behavior of the component. If option is `Yes` or no value chosen than header of csv file will be written to attachment, this is default behavior. If value `No` selected than csv header will be omitted from attachment.
101-
* `Separator` - this select configures type of CSV delimiter in an output file. There are next options: `Comma (,)`, `Semicolon (;)`, `Space ( )`, `Tab (\t)`.
101+
* `Separator` - this select configures type of CSV delimiter in an output file. There are next options: `Comma (,)`, `Semicolon (;)`, `Space ( )`, `Tab (\t)`, `Pipe (¦)`.
102102

103103
This action will combine multiple incoming events into a CSV file until there is a gap
104104
of more than 10 seconds between events. Afterwards, the CSV file will be closed
@@ -143,7 +143,7 @@ able to handle file attachments.
143143
### Write CSV attachment from JSON Array
144144

145145
* `Include Header` - this select configures output behavior of the component. If option is `Yes` or no value chosen than header of csv file will be written to attachment, this is default behavior. If value `No` selected than csv header will be omitted from attachment.
146-
* `Separator` - this select configures type of CSV delimiter in an output file. There are next options: `Comma (,)`, `Semicolon (;)`, `Space ( )`, `Tab (\t)`.
146+
* `Separator` - this select configures type of CSV delimiter in an output file. There are next options: `Comma (,)`, `Semicolon (;)`, `Space ( )`, `Tab (\t)`, `Pipe (¦)`.
147147

148148
This action will convert an incoming array into a CSV file by following approach:
149149

component.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@
116116
"comma": "Comma (,)",
117117
"semicolon": "Semicolon (;)",
118118
"space": "Space ( )",
119-
"tab": "Tab (\\t)"
119+
"tab": "Tab (\\t)",
120+
"pipe": "Pipe (\u00A6)"
120121
},
121122
"prompt": "Choose required CSV delimiter"
122123
}
@@ -161,7 +162,8 @@
161162
"comma": "Comma (,)",
162163
"semicolon": "Semicolon (;)",
163164
"space": "Space ( )",
164-
"tab": "Tab (\\t)"
165+
"tab": "Tab (\\t)",
166+
"pipe": "Pipe (\u00A6)"
165167
},
166168
"prompt": "Choose required CSV delimiter"
167169
}

lib/actions/writeFromArray.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ async function ProcessAction(msg, cfg) {
3333
delimiter = '\t';
3434
break;
3535
}
36+
case 'pipe': {
37+
delimiter = '¦';
38+
break;
39+
}
3640
default: {
3741
throw Error(`Unexpected separator type: ${cfg.separator}`);
3842
}

lib/actions/writeFromJson.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ async function init(cfg) {
4242
delimiter = '\t';
4343
break;
4444
}
45+
case 'pipe': {
46+
delimiter = '¦';
47+
break;
48+
}
4549
default: {
4650
throw Error(`Unexpected separator type: ${cfg.separator}`);
4751
}

package-lock.json

Lines changed: 37 additions & 71 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "csv-component",
3-
"version": "2.1.7",
3+
"version": "2.2.0",
44
"description": "CSV Component for elastic.io platform",
55
"main": "index.js",
66
"scripts": {
@@ -27,6 +27,7 @@
2727
},
2828
"homepage": "https://github.com/elasticio/csv-component#readme",
2929
"dependencies": {
30+
"@elastic.io/component-logger": "0.0.1",
3031
"axios": "0.21.1",
3132
"co": "4.6.0",
3233
"csv": "5.3.2",
@@ -36,19 +37,18 @@
3637
"elasticio-sailor-nodejs": "2.6.24",
3738
"lodash": "4.17.20",
3839
"moment": "2.29.1",
39-
"node-uuid": "1.4.3",
40+
"node-uuid": "1.4.8",
4041
"q": "1.5.1",
4142
"stream": "0.0.2",
42-
"@elastic.io/component-logger": "0.0.1",
4343
"underscore": "1.12.0"
4444
},
4545
"devDependencies": {
4646
"chai": "4.2.0",
4747
"chai-as-promised": "7.1.1",
4848
"dotenv": "8.2.0",
4949
"eslint": "7.16.0",
50-
"eslint-config-airbnb-base": "^14.2.1",
51-
"eslint-plugin-import": "^2.22.1",
50+
"eslint-config-airbnb-base": "14.2.1",
51+
"eslint-plugin-import": "2.22.1",
5252
"eslint-plugin-mocha": "8.0.0",
5353
"mocha": "8.2.1",
5454
"nock": "13.0.5",

0 commit comments

Comments
 (0)