Skip to content

Commit fce38e0

Browse files
committed
fix import statement
1 parent 0224554 commit fce38e0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

components/gocanvas/actions/create-or-update-reference-data/create-or-update-reference-data.mjs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import gocanvas from "../../gocanvas.app.mjs";
2-
import * as csvParse from "csv-parse";
2+
import { parse } from "csv-parse/sync";
3+
import { ConfigurationError } from "@pipedream/platform";
34

45
export default {
56
key: "gocanvas-create-or-update-reference-data",
@@ -27,11 +28,15 @@ export default {
2728
},
2829
methods: {
2930
csvToXml(data) {
30-
const records = csvParse.parse(data, {
31+
const records = parse(data, {
3132
columns: true,
3233
trim: true,
3334
});
3435

36+
if (!records?.length) {
37+
throw new ConfigurationError("No data items found to create/update. Please enter column names and at least 1 row of data.");
38+
}
39+
3540
// Extract columns
3641
const columns = Object.keys(records[0]);
3742
let result = "<Columns>";

0 commit comments

Comments
 (0)