Skip to content

Part 3 - applying file URL or path improvement #17149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 52 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
1aef040
pnpm
GTFalcao Jun 5, 2025
3d6ce07
Updating _2markdown and mapbox
GTFalcao Jun 5, 2025
54a0c8d
Akeneo and LLMWhisperer apps
GTFalcao Jun 5, 2025
49b328f
pnpm
GTFalcao Jun 5, 2025
d174051
add: askyourpdf
GTFalcao Jun 6, 2025
9e11477
add: fileforge
GTFalcao Jun 6, 2025
8a57ff3
adjusting existing descriptions and platform versions
GTFalcao Jun 6, 2025
9bf8aad
Description updates
GTFalcao Jun 6, 2025
c104045
add: microsoft_onedrive, mistral_ai, onlyoffice_docspace
GTFalcao Jun 6, 2025
5624c24
add: slack
GTFalcao Jun 6, 2025
fe3bb7e
add: stannp, zamzar, zoho_desk
GTFalcao Jun 6, 2025
fed67fa
add box upload-file
GTFalcao Jun 6, 2025
b560b05
add: monday, nyckel
GTFalcao Jun 6, 2025
04ae59a
add: ocrspace
GTFalcao Jun 6, 2025
69bbb92
add: onlinecheckwriter, pandadoc, pdf4me
GTFalcao Jun 7, 2025
094bf97
Onedrive adjustment
GTFalcao Jun 9, 2025
0107ed6
pnpm
GTFalcao Jun 9, 2025
8aa2266
adjusting Slack and Pandadoc
GTFalcao Jun 9, 2025
ed11f6e
updates to include metadata in all formdatas
GTFalcao Jun 9, 2025
1afc1fa
pnpm
GTFalcao Jun 9, 2025
c0438fb
fix
GTFalcao Jun 10, 2025
055a2e4
pnpm
GTFalcao Jun 10, 2025
b6a68ad
CodeRabbit fixes
GTFalcao Jun 10, 2025
9158a07
Fixing box and nyckel
GTFalcao Jun 10, 2025
c34250f
fix mapbox
GTFalcao Jun 10, 2025
e89430f
Merge branch 'master' into 16977-applying-fileurl-paths-improvement
GTFalcao Jun 12, 2025
d8e872a
pdf4me: readding std filename check to action
GTFalcao Jun 12, 2025
30630a8
initial AI update
GTFalcao Jun 13, 2025
bd3923b
add: meistertask, pdffiller, pixelbin
GTFalcao Jun 13, 2025
4448b2a
add: platerecognizer, printautopilot, printify
GTFalcao Jun 13, 2025
9d2183e
add: printnode,ragie
GTFalcao Jun 13, 2025
b7b190b
add: raindrop, ramp, reform
GTFalcao Jun 13, 2025
9053265
pnpm
GTFalcao Jun 13, 2025
371c5d4
AI-generated set
GTFalcao Jun 14, 2025
486ec3f
add: roboflow, salesforce_rest_api
GTFalcao Jun 17, 2025
0033db0
add: scrapfly, fix: several
GTFalcao Jun 17, 2025
729cc67
Merge branch 'master' into 16977-part-3
GTFalcao Jun 17, 2025
f398a11
pnpm
GTFalcao Jun 17, 2025
b85f1c4
add: scoredetect, security_reporter
GTFalcao Jun 17, 2025
ed11cce
pnpm
GTFalcao Jun 17, 2025
d4150b2
add: sendgrid, sftp
GTFalcao Jun 17, 2025
e5adcbc
add: signaturit, signerx
GTFalcao Jun 18, 2025
91bf402
add: signnow, smugmug, sonix
GTFalcao Jun 18, 2025
747949b
add: tinypng, todoist
GTFalcao Jun 18, 2025
8636bd2
add: xero_accounting_api, zerobounce, zip_archive_api
GTFalcao Jun 18, 2025
43a3eed
add: zoho_bugtracker
GTFalcao Jun 18, 2025
a781302
add: zoho_catalyst
GTFalcao Jun 18, 2025
6944ee2
Merge branch 'master' into 16977-part-3
GTFalcao Jun 18, 2025
f03921e
ESLint and fixes
GTFalcao Jun 18, 2025
78c7203
fix: todoist, xero_accounting_api, zip_archive_api
GTFalcao Jun 20, 2025
14881d4
fix: todoist, zoho_bugtracker
GTFalcao Jun 20, 2025
68b0157
zoho_bugtracker adjustments
GTFalcao Jun 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/arpoone/arpoone.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you omit this kind of changes?

Suggested change
};
};

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always hide whitespace changes when reviewing the PR, this was likely done by ESLint when merging with master and think it's easier to merge it since it will keep happening to any future branches until it's merged

Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import meistertask from "../../meistertask.app.mjs";
import FormData from "form-data";
import fs from "fs";
import { ConfigurationError } from "@pipedream/platform";
import { getFileStreamAndMetadata } from "@pipedream/platform";

export default {
key: "meistertask-create-attachment",
name: "Create Attachment",
description: "Create a new attachment. [See the docs](https://developers.meistertask.com/reference/post-attachment)",
version: "0.0.1",
version: "0.1.0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we were changing to major version

Suggested change
version: "0.1.0",
version: "1.0.0",

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only if a prop name is changed or props are added/removed, as that requires user action after updating. If the props are kept the same, users can update and their input will remain functional (if the prop takes a path to /tmp and/or a URL)

type: "action",
props: {
meistertask,
Expand Down Expand Up @@ -40,8 +39,8 @@ export default {
},
filepath: {
type: "string",
label: "File Path",
description: "Path of the file in /tmp folder to add as an attachment. To upload a file to /tmp folder, please follow the [doc here](https://pipedream.com/docs/code/nodejs/working-with-files/#writing-a-file-to-tmp)",
label: "File Path or URL",
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`)",
},
name: {
type: "string",
Expand All @@ -50,14 +49,6 @@ export default {
optional: true,
},
},
methods: {
checkTmp(filename) {
if (filename.indexOf("/tmp") === -1) {
return `/tmp/${filename}`;
}
return filename;
},
},
async run({ $ }) {
const {
taskId,
Expand All @@ -66,16 +57,14 @@ export default {
} = this;

const data = new FormData();
const path = this.checkTmp(filepath);

if (!fs.existsSync(path)) {
throw new ConfigurationError("File does not exist");
}

const file = fs.createReadStream(path);
const stats = fs.statSync(path);
data.append("local", file, {
knownLength: stats.size,
const {
stream, metadata,
} = await getFileStreamAndMetadata(filepath);
data.append("local", stream, {
contentType: metadata.contentType,
knownLength: metadata.size,
filename: metadata.name,
});
if (name) {
data.append("name", name);
Expand All @@ -85,6 +74,7 @@ export default {
};

const response = await this.meistertask.createAttachment({
$,
taskId,
data,
headers,
Expand Down
4 changes: 2 additions & 2 deletions components/meistertask/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/meistertask",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream Meistertask Components",
"main": "meistertask.app.mjs",
"homepage": "https://pipedream.com/apps/meistertask",
Expand All @@ -13,6 +13,6 @@
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^1.4.1"
"@pipedream/platform": "^3.1.0"
}
}
2 changes: 1 addition & 1 deletion components/offorte/offorte.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
15 changes: 10 additions & 5 deletions components/pdffiller/actions/upload-document/upload-document.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import FormData from "form-data";
import fs from "fs";
import { checkTmp } from "../../common/utils.mjs";
import { getFileStreamAndMetadata } from "@pipedream/platform";
import pdffiller from "../../pdffiller.app.mjs";

export default {
key: "pdffiller-upload-document",
name: "Upload Document",
description: "Uploads a chosen file to PDFfiller. [See the documentation](https://docs.pdffiller.com/docs/pdffiller/992d9d79fec32-creates-a-new-document-template-by-uploading-file-from-multipart)",
version: "0.0.2",
version: "0.1.0",
type: "action",
props: {
pdffiller,
Expand All @@ -26,9 +25,15 @@ export default {
},
},
async run({ $ }) {
const fileStream = fs.createReadStream(checkTmp(this.file));
const {
stream, metadata,
} = await getFileStreamAndMetadata(this.file);
const data = new FormData();
data.append("file", fileStream);
data.append("file", stream, {
contentType: metadata.contentType,
knownLength: metadata.size,
filename: metadata.name,
});

if (this.folderId) {
data.append("folder_id", this.folderId);
Expand Down
4 changes: 2 additions & 2 deletions components/pdffiller/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/pdffiller",
"version": "0.1.1",
"version": "0.2.0",
"description": "Pipedream pdfFiller Components",
"main": "pdffiller.app.mjs",
"keywords": [
Expand All @@ -13,7 +13,7 @@
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.0",
"@pipedream/platform": "^3.1.0",
"form-data": "^4.0.0",
"fs": "^0.0.1-security"
}
Expand Down
4 changes: 2 additions & 2 deletions components/pdffiller/pdffiller.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export default {
},
file: {
type: "string",
label: "File",
description: "The path to the file saved to the `/tmp` directory (e.g. `/tmp/example.json`). [See the documentation](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory).",
label: "File Path or URL",
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`)",
},
folderId: {
type: "string",
Expand Down
2 changes: 1 addition & 1 deletion components/pembee/pembee.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
26 changes: 13 additions & 13 deletions components/pixelbin/actions/upload-file/upload-file.mjs
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import fs from "fs";
import FormData from "form-data";
import { ConfigurationError } from "@pipedream/platform";
import { getFileStreamAndMetadata } from "@pipedream/platform";
import app from "../../pixelbin.app.mjs";
import utils from "../../common/utils.mjs";

export default {
key: "pixelbin-upload-file",
name: "Upload File",
description: "Upload a file to Pixelbin. [See the documentation](https://www.pixelbin.io/docs/api-docs/)",
version: "0.0.1",
version: "0.1.0",
type: "action",
props: {
app,
filePath: {
type: "string",
label: "File Path",
description: "Assete file path. The path to the file saved to the `/tmp` directory (e.g. `/tmp/example.pdf`). [See the documentation](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory).",
label: "File Path or URL",
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`)",
},
path: {
propDefinition: [
Expand Down Expand Up @@ -64,9 +63,6 @@ export default {
uploadFile(args = {}) {
return this.app.post({
path: "/upload/direct",
headers: {
"Content-Type": "multipart/form-data",
},
...args,
});
},
Expand All @@ -84,12 +80,15 @@ export default {
filenameOverride,
} = this;

if (!filePath.startsWith("/tmp/")) {
throw new ConfigurationError("File must be located in `/tmp` directory.");
}

const {
stream, metadata: fileMetadata,
} = await getFileStreamAndMetadata(filePath);
const data = new FormData();
data.append("file", fs.createReadStream(filePath));
data.append("file", stream, {
contentType: fileMetadata.contentType,
knownLength: fileMetadata.size,
filename: fileMetadata.name,
});

utils.appendPropsToFormData(data, {
path,
Expand All @@ -104,6 +103,7 @@ export default {
const response = await uploadFile({
$,
data,
headers: data.getHeaders(),
});

$.export("$summary", `Successfully uploaded file with ID \`${response._id}\`.`);
Expand Down
4 changes: 2 additions & 2 deletions components/pixelbin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/pixelbin",
"version": "0.1.0",
"version": "0.2.0",
"description": "Pipedream Pixelbin Components",
"main": "pixelbin.app.mjs",
"keywords": [
Expand All @@ -13,7 +13,7 @@
"access": "public"
},
"dependencies": {
"@pipedream/platform": "3.0.3",
"@pipedream/platform": "^3.1.0",
"form-data": "^4.0.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import fs from "fs";
import { checkTmp } from "../../common/utils.mjs";
import { getFileStream } from "@pipedream/platform";
import platerecognizer from "../../platerecognizer.app.mjs";

export default {
key: "platerecognizer-run-recognition",
name: "Run Recognition",
description: "Triggers a recognition process using the Plate Recognizer SDK.",
version: "0.0.1",
version: "0.1.0",
type: "action",
props: {
platerecognizer,
imageFileOrUrl: {
type: "string",
label: "Image File or URL",
description: "The image file or URL to be recognized.",
label: "Image Path or URL",
description: "The image to be recognized. Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myImage.jpg`)",
},
regions: {
type: "string[]",
Expand Down Expand Up @@ -41,19 +40,18 @@ export default {
},
},
async run({ $ }) {
const fileObj = {};

if (this.imageFileOrUrl.startsWith("http")) {
fileObj.upload_url = this.imageFileOrUrl;
} else {
const file = fs.readFileSync(checkTmp(this.imageFileOrUrl));
fileObj.upload = Buffer(file).toString("base64");
const stream = await getFileStream(this.imageFileOrUrl);
const chunks = [];
for await (const chunk of stream) {
chunks.push(chunk);
}
const buffer = Buffer.concat(chunks);

const response = await this.platerecognizer.runRecognition({
$,
data: {
...fileObj,
upload: buffer.toString("base64"),
regions: this.regions,
camera_id: this.cameraId,
mmc: this.mmc,
Expand Down
4 changes: 2 additions & 2 deletions components/platerecognizer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/platerecognizer",
"version": "0.1.0",
"version": "0.2.0",
"description": "Pipedream Plate Recognizer Components",
"main": "platerecognizer.app.mjs",
"keywords": [
Expand All @@ -13,7 +13,7 @@
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^1.6.5"
"@pipedream/platform": "^3.1.0"
}
}

2 changes: 1 addition & 1 deletion components/postmaster/postmaster.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import printAutopilot from "../../printautopilot.app.mjs";
import fs from "fs";
import { getFileStream } from "@pipedream/platform";

export default {
key: "printautopilot-add-pdf-to-queue",
name: "Add PDF to Print Autopilot Queue",
description: "Uploads a PDF document to the print-autopilot queue. [See the documentation](https://documenter.getpostman.com/view/1334461/TW6wJonb#53f82327-4f23-416d-b2f0-ce17b8037933)",
version: "0.0.1",
version: "0.1.0",
type: "action",
props: {
printAutopilot,
filePath: {
type: "string",
label: "File Path",
description: "The path to the file saved to the [`/tmp` directory](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory) (e.g. `/tmp/myFile.pdf`).",
label: "File Path or URL",
description: "The file to upload. Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.pdf`)",
},
fileName: {
type: "string",
Expand All @@ -27,10 +27,13 @@ export default {
},
},
async run({ $ }) {
const filePath = this.filePath.includes("/tmp")
? this.filePath
: `/tmp/${this.filePath}`;
const fileContent = Buffer.from(fs.readFileSync(filePath)).toString("base64");
const stream = await getFileStream(this.filePath);
const chunks = [];
for await (const chunk of stream) {
chunks.push(chunk);
}
const fileContent = Buffer.concat(chunks).toString("base64");

const response = await this.printAutopilot.addDocumentToQueue({
token: this.token,
data: {
Expand Down
4 changes: 2 additions & 2 deletions components/printautopilot/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/printautopilot",
"version": "0.1.0",
"version": "0.2.0",
"description": "Pipedream PrintAutopilot Components",
"main": "printautopilot.app.mjs",
"keywords": [
Expand All @@ -13,6 +13,6 @@
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^1.5.1"
"@pipedream/platform": "^3.1.0"
}
}
Loading