@pipedream/salesforce_rest_api 1.5.0 → 1.6.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,6 @@
|
|
|
1
1
|
import common, { getProps } from "../common/base-create-update.mjs";
|
|
2
2
|
import attachment from "../../common/sobjects/attachment.mjs";
|
|
3
|
-
import
|
|
3
|
+
import { getFileStream } from "@pipedream/platform";
|
|
4
4
|
|
|
5
5
|
const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_attachment.htm";
|
|
6
6
|
|
|
@@ -18,7 +18,7 @@ export default {
|
|
|
18
18
|
key: "salesforce_rest_api-create-attachment",
|
|
19
19
|
name: "Create Attachment",
|
|
20
20
|
description: `Creates an Attachment on a parent object. [See the documentation](${docsLink})`,
|
|
21
|
-
version: "0.
|
|
21
|
+
version: "0.5.0",
|
|
22
22
|
type: "action",
|
|
23
23
|
props,
|
|
24
24
|
async run({ $ }) {
|
|
@@ -34,9 +34,17 @@ export default {
|
|
|
34
34
|
} = this;
|
|
35
35
|
/* eslint-enable no-unused-vars */
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
let body;
|
|
38
|
+
if (filePathOrContent.startsWith("http") || filePathOrContent.includes("tmp/")) {
|
|
39
|
+
const stream = await getFileStream(filePathOrContent);
|
|
40
|
+
const chunks = [];
|
|
41
|
+
for await (const chunk of stream) {
|
|
42
|
+
chunks.push(chunk);
|
|
43
|
+
}
|
|
44
|
+
body = Buffer.concat(chunks).toString("base64");
|
|
45
|
+
} else {
|
|
46
|
+
body = filePathOrContent;
|
|
47
|
+
}
|
|
40
48
|
|
|
41
49
|
const response = await salesforce.createRecord("Attachment", {
|
|
42
50
|
$,
|
|
@@ -9,8 +9,8 @@ export default {
|
|
|
9
9
|
},
|
|
10
10
|
filePathOrContent: {
|
|
11
11
|
type: "string",
|
|
12
|
-
label: "File Path or Content",
|
|
13
|
-
description: "The path to a file in the
|
|
12
|
+
label: "File Path, URL or Content",
|
|
13
|
+
description: "The file to attach. Provide either a file URL, a path to a file in the `/tmp` directory (for example, `/tmp/myFile.txt`), or base64-encoded file data.",
|
|
14
14
|
},
|
|
15
15
|
ContentType: {
|
|
16
16
|
type: "string",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/salesforce_rest_api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Pipedream Salesforce (REST API) Components",
|
|
5
5
|
"main": "salesforce_rest_api.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"homepage": "https://pipedream.com/apps/salesforce_rest_api",
|
|
11
11
|
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@pipedream/platform": "^3.
|
|
13
|
+
"@pipedream/platform": "^3.1.0",
|
|
14
14
|
"fast-xml-parser": "^4.3.2",
|
|
15
15
|
"handlebars": "^4.7.7",
|
|
16
16
|
"lodash": "^4.17.21",
|