@pipedream/monday 0.6.0 → 0.6.2

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.
@@ -1,4 +1,5 @@
1
1
  import monday from "../../monday.app.mjs";
2
+ import { ConfigurationError } from "@pipedream/platform";
2
3
 
3
4
  export default {
4
5
  props: {
@@ -15,6 +16,9 @@ export default {
15
16
  const columns = await this.monday.listColumns({
16
17
  boardId: +boardId,
17
18
  });
19
+ if (!columns) {
20
+ throw new ConfigurationError(`No columns found for board ${boardId}`);
21
+ }
18
22
  return columns.filter(({ id }) => id !== "name");
19
23
  },
20
24
  formatColumnValues(items) {
@@ -6,7 +6,7 @@ export default {
6
6
  name: "Create Board",
7
7
  description: "Creates a new board. [See the documentation](https://api.developer.monday.com/docs/boards#create-a-board)",
8
8
  type: "action",
9
- version: "0.0.6",
9
+ version: "0.0.7",
10
10
  props: {
11
11
  monday,
12
12
  boardName: {
@@ -6,7 +6,7 @@ export default {
6
6
  name: "Create Column",
7
7
  description: "Creates a column. [See the documentation](https://developer.monday.com/api-reference/docs/columns-queries-1)",
8
8
  type: "action",
9
- version: "0.0.6",
9
+ version: "0.0.7",
10
10
  props: {
11
11
  monday,
12
12
  boardId: {
@@ -5,7 +5,7 @@ export default {
5
5
  name: "Create Group",
6
6
  description: "Creates a new group in a specific board. [See the documentation](https://api.developer.monday.com/docs/groups-queries#create-a-group)",
7
7
  type: "action",
8
- version: "0.0.7",
8
+ version: "0.0.8",
9
9
  props: {
10
10
  monday,
11
11
  boardId: {
@@ -8,7 +8,7 @@ export default {
8
8
  name: "Create Item",
9
9
  description: "Creates an item. [See the documentation](https://api.developer.monday.com/docs/items-queries#create-an-item)",
10
10
  type: "action",
11
- version: "0.0.9",
11
+ version: "0.0.10",
12
12
  props: {
13
13
  monday,
14
14
  boardId: {
@@ -8,7 +8,7 @@ export default {
8
8
  name: "Create Subitem",
9
9
  description: "Creates a subitem. [See the documentation](https://developer.monday.com/api-reference/docs/introduction-to-graphql#mondaycom-schema)",
10
10
  type: "action",
11
- version: "0.0.1",
11
+ version: "0.0.2",
12
12
  props: {
13
13
  monday,
14
14
  boardId: {
@@ -6,7 +6,7 @@ export default {
6
6
  name: "Create an Update",
7
7
  description: "Creates a new update. [See the documentation](https://api.developer.monday.com/docs/updates-queries#create-an-update)",
8
8
  type: "action",
9
- version: "0.0.8",
9
+ version: "0.0.9",
10
10
  props: {
11
11
  monday,
12
12
  updateBody: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "monday-get-column-values",
6
6
  name: "Get Column Values",
7
7
  description: "Return values of a specific column or columns for a board item. [See the documentation](https://developer.monday.com/api-reference/docs/column-values-v2)",
8
- version: "0.0.3",
8
+ version: "0.0.5",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "monday-get-items-by-column-value",
6
6
  name: "Get Items By Column Value",
7
7
  description: "Searches a column for items matching a value. [See the documentation](https://developer.monday.com/api-reference/docs/items-page-by-column-values)",
8
- version: "0.0.3",
8
+ version: "0.0.5",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -1,11 +1,14 @@
1
1
  import common from "../common/column-values.mjs";
2
+ import { axios } from "@pipedream/platform";
3
+ import fs from "fs";
4
+ import FormData from "form-data";
2
5
 
3
6
  export default {
4
7
  ...common,
5
8
  key: "monday-update-column-values",
6
9
  name: "Update Column Values",
7
10
  description: "Update multiple column values of an item. [See the documentation](https://developer.monday.com/api-reference/docs/columns#change-multiple-column-values)",
8
- version: "0.0.3",
11
+ version: "0.0.5",
9
12
  type: "action",
10
13
  props: {
11
14
  ...common.props,
@@ -36,15 +39,52 @@ export default {
36
39
  description: `The value for column ${column.title}`,
37
40
  optional: true,
38
41
  };
42
+ if (column.type === "file") {
43
+ props[column.id].description += ". The path to a file in the `/tmp` directory. [See the documentation on working with files](https://pipedream.com/docs/code/nodejs/working-with-files/#writing-a-file-to-tmp).";
44
+ }
39
45
  }
40
46
  }
41
47
  return props;
42
48
  },
49
+ methods: {
50
+ ...common.methods,
51
+ async uploadFile({
52
+ $, itemId, column, filePath,
53
+ }) {
54
+ const query = `mutation ($file: File!) { add_file_to_column (file: $file, item_id: ${itemId}, column_id: "${column.id}") { id } }`;
55
+ const content = fs.createReadStream(filePath.includes("tmp/")
56
+ ? filePath
57
+ : `/tmp/${filePath}`);
58
+
59
+ const formData = new FormData();
60
+ formData.append("query", query);
61
+ formData.append("variables[file]", content);
62
+
63
+ return axios($, {
64
+ method: "POST",
65
+ url: "https://api.monday.com/v2/file",
66
+ headers: {
67
+ "Content-Type": `multipart/form-data; boundary=${formData._boundary}`,
68
+ "Authorization": this.monday.$auth.api_key,
69
+ },
70
+ data: formData,
71
+ });
72
+ },
73
+ },
43
74
  async run({ $ }) {
44
75
  const columns = await this.getColumns(this.boardId);
45
76
  const columnValues = {};
46
77
  for (const column of columns) {
47
78
  if (this[column.id]) {
79
+ if (column.type === "file") {
80
+ await this.uploadFile({
81
+ $,
82
+ itemId: this.itemId,
83
+ column,
84
+ filePath: this[column.id],
85
+ });
86
+ continue;
87
+ }
48
88
  columnValues[column.id] = this[column.id];
49
89
  }
50
90
  }
@@ -5,7 +5,7 @@ export default {
5
5
  name: "Update Item Name",
6
6
  description: "Update an item's name. [See the documentation](https://api.developer.monday.com/docs/item-name)",
7
7
  type: "action",
8
- version: "0.0.8",
8
+ version: "0.0.9",
9
9
  props: {
10
10
  monday,
11
11
  boardId: {
@@ -99,6 +99,7 @@ export default {
99
99
  columns {
100
100
  id
101
101
  title
102
+ type
102
103
  }
103
104
  }
104
105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/monday",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "Pipedream Monday Components",
5
5
  "main": "monday.app.mjs",
6
6
  "keywords": [
@@ -15,6 +15,7 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@pipedream/platform": "^1.6.0",
18
+ "form-data": "^4.0.0",
18
19
  "lodash.flatmap": "^4.5.0",
19
20
  "lodash.map": "^4.6.0",
20
21
  "lodash.uniqby": "^4.7.0",
@@ -6,7 +6,7 @@ export default {
6
6
  name: "New Column Value Updated (Instant)",
7
7
  description: "Emit new event when a column value is updated on a board in Monday. For changes to Name, use the Name Updated Trigger.",
8
8
  type: "source",
9
- version: "0.0.6",
9
+ version: "0.0.7",
10
10
  dedupe: "unique",
11
11
  hooks: {
12
12
  ...common.hooks,
@@ -6,7 +6,7 @@ export default {
6
6
  name: "New Name Updated (Instant)",
7
7
  description: "Emit new event when an item's Name is updated on a board in Monday.",
8
8
  type: "source",
9
- version: "0.0.6",
9
+ version: "0.0.7",
10
10
  dedupe: "unique",
11
11
  hooks: {
12
12
  ...common.hooks,
@@ -6,7 +6,7 @@ export default {
6
6
  name: "New Board",
7
7
  description: "Emit new event when a new board is created in Monday.",
8
8
  type: "source",
9
- version: "0.0.7",
9
+ version: "0.0.8",
10
10
  dedupe: "unique",
11
11
  props: {
12
12
  ...common.props,
@@ -6,7 +6,7 @@ export default {
6
6
  name: "New Item (Instant)",
7
7
  description: "Emit new event when a new item is added to a board in Monday.",
8
8
  type: "source",
9
- version: "0.0.6",
9
+ version: "0.0.7",
10
10
  dedupe: "unique",
11
11
  hooks: {
12
12
  ...common.hooks,
@@ -6,7 +6,7 @@ export default {
6
6
  name: "New Sub-Item (Instant)",
7
7
  description: "Emit new event when a sub-item is created. To create this trigger, you need to have at least one subitem previously created on your board.",
8
8
  type: "source",
9
- version: "0.0.5",
9
+ version: "0.0.6",
10
10
  dedupe: "unique",
11
11
  props: {
12
12
  ...common.props,
@@ -6,7 +6,7 @@ export default {
6
6
  name: "New Sub-Item Update (Instant)",
7
7
  description: "Emit new event when an update is posted in sub-items. To create this trigger, you need to have at least one subitem previously created on your board.",
8
8
  type: "source",
9
- version: "0.0.5",
9
+ version: "0.0.6",
10
10
  dedupe: "unique",
11
11
  props: {
12
12
  ...common.props,
@@ -6,7 +6,7 @@ export default {
6
6
  name: "New User",
7
7
  description: "Emit new event when a new user is created in Monday.",
8
8
  type: "source",
9
- version: "0.0.7",
9
+ version: "0.0.8",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
@@ -6,7 +6,7 @@ export default {
6
6
  name: "New Specific Column Updated (Instant)",
7
7
  description: "Emit new event when a value in the specified column is updated on a board in Monday. For changes to Name, use the Name Updated Trigger.",
8
8
  type: "source",
9
- version: "0.0.6",
9
+ version: "0.0.7",
10
10
  dedupe: "unique",
11
11
  hooks: {
12
12
  ...common.hooks,
@@ -6,7 +6,7 @@ export default {
6
6
  name: "New Sub-Item Column Value Updated (Instant)",
7
7
  description: "Emit new event when any sub-item column changes. To create this trigger, you need to have at least one subitem previously created on your board.",
8
8
  type: "source",
9
- version: "0.0.6",
9
+ version: "0.0.7",
10
10
  dedupe: "unique",
11
11
  props: {
12
12
  ...common.props,
@@ -6,7 +6,7 @@ export default {
6
6
  name: "New Sub-Item Name Updated (Instant)",
7
7
  description: "Emit new event when a sub-item name changes. To create this trigger, you need to have at least one subitem previously created on your board.",
8
8
  type: "source",
9
- version: "0.0.5",
9
+ version: "0.0.6",
10
10
  dedupe: "unique",
11
11
  props: {
12
12
  ...common.props,