Skip to content

Commit a7d0169

Browse files
committed
Add dir props to Zoho CRM components for File Stash sync
Add dir props to the Zoho CRM Download Attachment and Upload Attachment actions to indicate that a stash ID should be passed when running these actions via the Connect API. This allows files written to the ephemeral /tmp directory in one action to be read by another, separately executed action since both can sync /tmp with the same File Stash directory.
1 parent 2de0914 commit a7d0169

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

components/zoho_crm/actions/download-attachment/download-attachment.mjs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "zoho_crm-download-attachment",
66
name: "Download Attachment",
77
description: "Downloads an attachment file from Zoho CRM, saves it in the temporary file system and exports the file path for use in a future step.",
8-
version: "0.2.1",
8+
version: "0.2.2",
99
type: "action",
1010
props: {
1111
zohoCrm,
@@ -34,6 +34,15 @@ export default {
3434
}),
3535
],
3636
},
37+
// This prop indicates that the otherwise ephemeral /tmp directory is automatically synced to a
38+
// remote directory (if configured for the execution context), making files written by this
39+
// action accessible for future executions. Only files located in STASH_DIR or, for legacy
40+
// action support, whose /tmp file paths are explicitly returned by `run` will be synced.
41+
syncDir: {
42+
type: "dir",
43+
accessMode: "write",
44+
sync: true,
45+
},
3746
},
3847
async run({ $ }) {
3948
const file = await this.zohoCrm.downloadAttachment(
@@ -43,7 +52,7 @@ export default {
4352
$,
4453
);
4554

46-
const filePath = "/tmp/" + this.attachmentId;
55+
const filePath = (process.env.STASH_DIR || "/tmp") + "/" + this.attachmentId;
4756
fs.writeFileSync(filePath, file);
4857

4958
$.export("$summary", "Successfully downloaded attachment");

components/zoho_crm/actions/upload-attachment/upload-attachment.mjs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "zoho_crm-upload-attachment",
77
name: "Upload Attachment",
88
description: "Uploads an attachment file to Zoho CRM from a URL or file path. [See the documentation](https://www.zoho.com/crm/developer/docs/api/v3/upload-attachment.html)",
9-
version: "0.1.0",
9+
version: "0.1.1",
1010
type: "action",
1111
props: {
1212
zohoCrm,
@@ -30,6 +30,15 @@ export default {
3030
label: "File Path or URL",
3131
description: "The file to upload. Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.txt`)",
3232
},
33+
// This prop indicates that a remote directory (if configured for the execution context) is
34+
// automatically synced to the /tmp directory before the action runs, making files in that
35+
// directory accessible for use in this action via the file system.
36+
syncDir: {
37+
type: "dir",
38+
accessMode: "read",
39+
sync: true,
40+
optional: true,
41+
},
3342
},
3443
async run({ $ }) {
3544
const data = new FormData();

0 commit comments

Comments
 (0)