Skip to content

Commit 53abb56

Browse files
committed
remove dependency on mysql2-promise
1 parent 3be4f02 commit 53abb56

File tree

13 files changed

+119
-76
lines changed

13 files changed

+119
-76
lines changed

components/mysql/actions/create-row/create-row.mjs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import utils from "../common/utils.mjs";
44
export default {
55
key: "mysql-create-row",
66
name: "Create Row",
7-
description: "Adds a new row. [See the docs here](https://dev.mysql.com/doc/refman/8.0/en/insert.html)",
7+
description:
8+
"Adds a new row. [See the docs here](https://dev.mysql.com/doc/refman/8.0/en/insert.html)",
89
type: "action",
9-
version: "2.0.6",
10+
version: "2.0.7",
1011
annotations: {
1112
destructiveHint: false,
1213
openWorldHint: true,
@@ -40,7 +41,10 @@ export default {
4041
values,
4142
});
4243

43-
$.export("$summary", `Successfully added ${result.affectedRows} row(s) to table ${table}`);
44+
$.export(
45+
"$summary",
46+
`Successfully added ${result.affectedRows} row(s) to table ${table}`,
47+
);
4448

4549
return result;
4650
},

components/mysql/actions/delete-row/delete-row.mjs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import mysql from "../../mysql.app.mjs";
33
export default {
44
key: "mysql-delete-row",
55
name: "Delete Row",
6-
description: "Delete an existing row. [See the docs here](https://dev.mysql.com/doc/refman/8.0/en/delete.html)",
6+
description:
7+
"Delete an existing row. [See the docs here](https://dev.mysql.com/doc/refman/8.0/en/delete.html)",
78
type: "action",
8-
version: "2.0.6",
9+
version: "2.0.7",
910
annotations: {
1011
destructiveHint: true,
1112
openWorldHint: true,
@@ -35,23 +36,27 @@ export default {
3536
},
3637
async run({ $ }) {
3738
const {
38-
table,
39-
condition,
40-
values,
39+
table, condition, values,
4140
} = this;
4241

4342
const numberOfQuestionMarks = condition?.match(/\?/g)?.length;
4443

4544
if (!numberOfQuestionMarks) {
46-
throw new Error("No valid condition provided. At least one question mark character ? must be provided.");
45+
throw new Error(
46+
"No valid condition provided. At least one question mark character ? must be provided.",
47+
);
4748
}
4849

4950
if (!Array.isArray(values)) {
50-
throw new Error("No valid values provided. The values property must be an array.");
51+
throw new Error(
52+
"No valid values provided. The values property must be an array.",
53+
);
5154
}
5255

5356
if (values.length !== numberOfQuestionMarks) {
54-
throw new Error("The number of values provided does not match the number of question marks ? in the condition.");
57+
throw new Error(
58+
"The number of values provided does not match the number of question marks ? in the condition.",
59+
);
5560
}
5661

5762
const result = await this.mysql.deleteRows({
@@ -60,7 +65,10 @@ export default {
6065
values,
6166
});
6267

63-
$.export("$summary", `Successfully deleted ${result.affectedRows} row(s) from table ${table}`);
68+
$.export(
69+
"$summary",
70+
`Successfully deleted ${result.affectedRows} row(s) from table ${table}`,
71+
);
6472

6573
return result;
6674
},

components/mysql/actions/execute-query/execute-query.mjs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import mysql from "../../mysql.app.mjs";
33
export default {
44
key: "mysql-execute-query",
55
name: "Execute Query",
6-
description: "Find row(s) via a custom query. [See the docs here](https://dev.mysql.com/doc/refman/8.0/en/select.html)",
6+
description:
7+
"Find row(s) via a custom query. [See the docs here](https://dev.mysql.com/doc/refman/8.0/en/select.html)",
78
type: "action",
8-
version: "2.0.6",
9+
version: "2.0.7",
910
annotations: {
1011
destructiveHint: false,
1112
openWorldHint: true,
@@ -35,23 +36,27 @@ export default {
3536
},
3637
async run({ $ }) {
3738
const {
38-
table,
39-
condition,
40-
values,
39+
table, condition, values,
4140
} = this;
4241

4342
const numberOfQuestionMarks = condition?.match(/\?/g)?.length;
4443

4544
if (!numberOfQuestionMarks) {
46-
throw new Error("No valid condition provided. At least one question mark character ? must be provided.");
45+
throw new Error(
46+
"No valid condition provided. At least one question mark character ? must be provided.",
47+
);
4748
}
4849

4950
if (!Array.isArray(values)) {
50-
throw new Error("No valid values provided. The values property must be an array.");
51+
throw new Error(
52+
"No valid values provided. The values property must be an array.",
53+
);
5154
}
5255

5356
if (values.length !== numberOfQuestionMarks) {
54-
throw new Error("The number of values provided does not match the number of question marks ? in the condition.");
57+
throw new Error(
58+
"The number of values provided does not match the number of question marks ? in the condition.",
59+
);
5560
}
5661

5762
const result = await this.mysql.findRows({
@@ -60,7 +65,10 @@ export default {
6065
values,
6166
});
6267

63-
$.export("$summary", `Successfully found ${result.length} row(s) from table ${table}`);
68+
$.export(
69+
"$summary",
70+
`Successfully found ${result.length} row(s) from table ${table}`,
71+
);
6472

6573
return result;
6674
},

components/mysql/actions/execute-raw-query/execute-raw-query.mjs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import mysql from "../../mysql.app.mjs";
33
export default {
44
key: "mysql-execute-raw-query",
55
name: "Execute SQL Query",
6-
description: "Execute a custom MySQL query. See [our docs](https://pipedream.com/docs/databases/working-with-sql) to learn more about working with SQL in Pipedream.",
6+
description:
7+
"Execute a custom MySQL query. See [our docs](https://pipedream.com/docs/databases/working-with-sql) to learn more about working with SQL in Pipedream.",
78
type: "action",
8-
version: "2.0.2",
9+
version: "2.0.3",
910
annotations: {
1011
destructiveHint: false,
1112
openWorldHint: true,
@@ -25,9 +26,12 @@ export default {
2526
async run({ $ }) {
2627
const args = this.mysql.executeQueryAdapter(this.sql);
2728
const data = await this.mysql.executeQuery(args);
28-
$.export("$summary", `Returned ${data.length} ${data.length === 1
29-
? "row"
30-
: "rows"}`);
29+
$.export(
30+
"$summary",
31+
`Returned ${data.length} ${data.length === 1
32+
? "row"
33+
: "rows"}`,
34+
);
3135
return data;
3236
},
3337
};

components/mysql/actions/execute-stored-procedure/execute-stored-procedure.mjs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import mysql from "../../mysql.app.mjs";
33
export default {
44
key: "mysql-execute-stored-procedure",
55
name: "Execute Stored Procedure",
6-
description: "Execute Stored Procedure. [See the docs here](https://dev.mysql.com/doc/refman/8.0/en/stored-programs-defining.html)",
6+
description:
7+
"Execute Stored Procedure. [See the docs here](https://dev.mysql.com/doc/refman/8.0/en/stored-programs-defining.html)",
78
type: "action",
8-
version: "2.0.6",
9+
version: "2.0.7",
910
annotations: {
1011
destructiveHint: false,
1112
openWorldHint: true,
@@ -28,24 +29,27 @@ export default {
2829
},
2930
async run({ $ }) {
3031
const {
31-
storedProcedure,
32-
values,
32+
storedProcedure, values,
3333
} = this;
3434

3535
const response = await this.mysql.executeStoredProcedure({
3636
storedProcedure,
3737
values,
3838
});
3939

40-
$.export("$summary", `Successfully executed stored procedure ${storedProcedure}`);
40+
$.export(
41+
"$summary",
42+
`Successfully executed stored procedure ${storedProcedure}`,
43+
);
4144

42-
const result =
43-
Array.isArray(response)
44-
? response[0]
45-
: response;
45+
const result = Array.isArray(response)
46+
? response[0]
47+
: response;
4648

47-
return result || {
48-
success: false,
49-
};
49+
return (
50+
result || {
51+
success: false,
52+
}
53+
);
5054
},
5155
};

components/mysql/actions/find-row/find-row.mjs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import mysql from "../../mysql.app.mjs";
33
export default {
44
key: "mysql-find-row",
55
name: "Find Row",
6-
description: "Finds a row in a table via a lookup column. [See the docs here](https://dev.mysql.com/doc/refman/8.0/en/select.html)",
6+
description:
7+
"Finds a row in a table via a lookup column. [See the docs here](https://dev.mysql.com/doc/refman/8.0/en/select.html)",
78
type: "action",
8-
version: "2.0.6",
9+
version: "2.0.7",
910
annotations: {
1011
destructiveHint: false,
1112
openWorldHint: true,
@@ -45,10 +46,7 @@ export default {
4546
},
4647
async run({ $ }) {
4748
const {
48-
table,
49-
column,
50-
operator,
51-
value,
49+
table, column, operator, value,
5250
} = this;
5351

5452
const condition = `${column} ${operator} ?`;
@@ -61,7 +59,10 @@ export default {
6159
],
6260
});
6361

64-
$.export("$summary", `Successfully found ${result.length} row(s) from table ${table}`);
62+
$.export(
63+
"$summary",
64+
`Successfully found ${result.length} row(s) from table ${table}`,
65+
);
6566

6667
return result;
6768
},

components/mysql/actions/update-row/update-row.mjs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import utils from "../common/utils.mjs";
44
export default {
55
key: "mysql-update-row",
66
name: "Update Row",
7-
description: "Updates an existing row. [See the docs here](https://dev.mysql.com/doc/refman/8.0/en/update.html)",
7+
description:
8+
"Updates an existing row. [See the docs here](https://dev.mysql.com/doc/refman/8.0/en/update.html)",
89
type: "action",
9-
version: "2.0.6",
10+
version: "2.0.7",
1011
annotations: {
1112
destructiveHint: true,
1213
openWorldHint: true,
@@ -41,27 +42,30 @@ export default {
4142
methods: utils,
4243
async run({ $ }) {
4344
const {
44-
table,
45-
condition,
46-
conditionValues,
45+
table, condition, conditionValues,
4746
} = this;
4847
const numberOfQuestionMarks = condition.match(/\?/g)?.length;
4948

5049
if (!numberOfQuestionMarks) {
51-
throw new Error("No valid condition provided. At least one question mark character ? must be provided.");
50+
throw new Error(
51+
"No valid condition provided. At least one question mark character ? must be provided.",
52+
);
5253
}
5354

5455
if (!Array.isArray(conditionValues)) {
5556
throw new Error("Condition values is not an array.");
5657
}
5758

5859
if (conditionValues.length !== numberOfQuestionMarks) {
59-
throw new Error("The number of values provided does not match the number of question marks ? in the condition");
60+
throw new Error(
61+
"The number of values provided does not match the number of question marks ? in the condition",
62+
);
6063
}
6164

6265
const {
6366
columns: columnsToUpdate, values: valuesToUpdate,
64-
} = await this.getColumnAndValueArrays(table);
67+
} =
68+
await this.getColumnAndValueArrays(table);
6569

6670
const result = await this.mysql.updateRow({
6771
table,
@@ -71,7 +75,10 @@ export default {
7175
valuesToUpdate,
7276
});
7377

74-
$.export("$summary", `Successfully updated ${result.affectedRows} row(s) in table ${table}`);
78+
$.export(
79+
"$summary",
80+
`Successfully updated ${result.affectedRows} row(s) in table ${table}`,
81+
);
7582

7683
return result;
7784
},

components/mysql/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/mysql",
3-
"version": "2.3.1",
3+
"version": "2.3.2",
44
"description": "Pipedream MySQL Components",
55
"main": "mysql.app.mjs",
66
"keywords": [
@@ -14,7 +14,6 @@
1414
"dependencies": {
1515
"@pipedream/platform": "^2.0.0",
1616
"mysql2": "^3.9.2",
17-
"mysql2-promise": "^0.1.4",
1817
"uuid": "^8.3.2"
1918
}
2019
}

components/mysql/sources/new-column/new-column.mjs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ export default {
44
...common,
55
key: "mysql-new-column",
66
name: "New Column",
7-
description: "Emit new event when you add a new column to a table. [See the docs here](https://dev.mysql.com/doc/refman/8.0/en/show-columns.html)",
7+
description:
8+
"Emit new event when you add a new column to a table. [See the docs here](https://dev.mysql.com/doc/refman/8.0/en/show-columns.html)",
89
type: "source",
9-
version: "2.0.5",
10+
version: "2.0.6",
1011
dedupe: "unique",
1112
props: {
1213
...common.props,
@@ -29,10 +30,9 @@ export default {
2930
});
3031
this.iterateAndEmitEvents(columns);
3132

32-
const newColumnNames =
33-
columns
34-
.map((column) => column.Field)
35-
.filter((c) => !previousColumns.includes(c));
33+
const newColumnNames = columns
34+
.map((column) => column.Field)
35+
.filter((c) => !previousColumns.includes(c));
3636

3737
previousColumns = previousColumns.concat(newColumnNames);
3838
this._setPreviousColumns(previousColumns);

components/mysql/sources/new-or-updated-row/new-or-updated-row.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ export default {
77
...common,
88
key: "mysql-new-or-updated-row",
99
name: "New or Updated Row",
10-
description: "Emit new event when you add or modify a new row in a table. [See the docs here](https://dev.mysql.com/doc/refman/8.0/en/select.html)",
10+
description:
11+
"Emit new event when you add or modify a new row in a table. [See the docs here](https://dev.mysql.com/doc/refman/8.0/en/select.html)",
1112
type: "source",
12-
version: "2.0.5",
13+
version: "2.0.6",
1314
dedupe: "unique",
1415
props: {
1516
...common.props,

0 commit comments

Comments
 (0)