@pipedream/monday 0.7.0 → 0.8.0

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,6 +1,7 @@
1
1
  import common from "../common/column-values.mjs";
2
- import { axios } from "@pipedream/platform";
3
- import fs from "fs";
2
+ import {
3
+ axios, getFileStreamAndMetadata,
4
+ } from "@pipedream/platform";
4
5
  import FormData from "form-data";
5
6
  import { getColumnOptions } from "../../common/utils.mjs";
6
7
 
@@ -9,7 +10,7 @@ export default {
9
10
  key: "monday-update-column-values",
10
11
  name: "Update Column Values",
11
12
  description: "Update multiple column values of an item. [See the documentation](https://developer.monday.com/api-reference/reference/columns#change-multiple-column-values)",
12
- version: "0.1.0",
13
+ version: "0.2.0",
13
14
  type: "action",
14
15
  props: {
15
16
  ...common.props,
@@ -50,7 +51,7 @@ export default {
50
51
  options: getColumnOptions(columns, id),
51
52
  };
52
53
  if (column.type === "file") {
53
- 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)";
54
+ props[column.id].description += ". Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.txt`)";
54
55
  }
55
56
  }
56
57
  }
@@ -62,13 +63,17 @@ export default {
62
63
  $, itemId, column, filePath,
63
64
  }) {
64
65
  const query = `mutation ($file: File!) { add_file_to_column (file: $file, item_id: ${itemId}, column_id: "${column.id}") { id } }`;
65
- const content = fs.createReadStream(filePath.includes("tmp/")
66
- ? filePath
67
- : `/tmp/${filePath}`);
66
+ const {
67
+ stream, metadata,
68
+ } = await getFileStreamAndMetadata(filePath);
68
69
 
69
70
  const formData = new FormData();
70
71
  formData.append("query", query);
71
- formData.append("variables[file]", content);
72
+ formData.append("variables[file]", stream, {
73
+ contentType: metadata.contentType,
74
+ knownLength: metadata.size,
75
+ filename: metadata.name,
76
+ });
72
77
 
73
78
  return axios($, {
74
79
  method: "POST",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/monday",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Pipedream Monday Components",
5
5
  "main": "monday.app.mjs",
6
6
  "keywords": [
@@ -14,7 +14,7 @@
14
14
  "access": "public"
15
15
  },
16
16
  "dependencies": {
17
- "@pipedream/platform": "^3.0.3",
17
+ "@pipedream/platform": "^3.1.0",
18
18
  "form-data": "^4.0.0",
19
19
  "lodash.flatmap": "^4.5.0",
20
20
  "lodash.map": "^4.6.0",