Skip to content

Commit c51a840

Browse files
committed
Merge branch 'master' into issue-16959
2 parents d9fa20e + 31f21c9 commit c51a840

File tree

507 files changed

+14543
-1944
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

507 files changed

+14543
-1944
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ components/**/package-lock.json
2020
/packages/sdk/examples/.next/
2121

2222
**/.claude/settings.local.json
23+
24+
.cursor

components/_2markdown/_2markdown.app.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ export default {
66
propDefinitions: {
77
filePath: {
88
type: "string",
9-
label: "File Path",
10-
description: "The path to an HTML 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)",
9+
label: "File Path or URL",
10+
description: "An HTML file. Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.html`)",
1111
},
1212
},
1313
methods: {

components/_2markdown/actions/html-file-to-markdown/html-file-to-markdown.mjs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import _2markdown from "../../_2markdown.app.mjs";
2-
import fs from "fs";
2+
import { getFileStreamAndMetadata } from "@pipedream/platform";
33
import FormData from "form-data";
44

55
export default {
66
key: "_2markdown-html-file-to-markdown",
77
name: "HTML File to Markdown",
88
description: "Convert an HTML file to Markdown format. [See the documentation](https://2markdown.com/docs#file2md)",
9-
version: "0.0.1",
9+
version: "0.1.0",
1010
type: "action",
1111
props: {
1212
_2markdown,
@@ -20,9 +20,14 @@ export default {
2020
async run({ $ }) {
2121
const form = new FormData();
2222

23-
form.append("document", fs.createReadStream(this.filePath.includes("tmp/")
24-
? this.filePath
25-
: `/tmp/${this.filePath}`));
23+
const {
24+
stream, metadata,
25+
} = await getFileStreamAndMetadata(this.filePath);
26+
form.append("document", stream, {
27+
contentType: metadata.contentType,
28+
knownLength: metadata.size,
29+
filename: metadata.name,
30+
});
2631

2732
const response = await this._2markdown.htmlFileToMarkdown({
2833
$,

components/_2markdown/actions/pdf-to-markdown/pdf-to-markdown.mjs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import _2markdown from "../../_2markdown.app.mjs";
2-
import fs from "fs";
2+
import { getFileStreamAndMetadata } from "@pipedream/platform";
33
import FormData from "form-data";
44

55
export default {
66
key: "_2markdown-pdf-to-markdown",
77
name: "PDF to Markdown",
88
description: "Convert a PDF document to Markdown format. [See the documentation](https://2markdown.com/docs#pdf2md)",
9-
version: "0.0.1",
9+
version: "0.1.0",
1010
type: "action",
1111
props: {
1212
_2markdown,
@@ -15,7 +15,7 @@ export default {
1515
_2markdown,
1616
"filePath",
1717
],
18-
description: "The path to a PDF 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)",
18+
description: "A PDF file. Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.pdf`)",
1919
},
2020
waitForCompletion: {
2121
type: "boolean",
@@ -27,9 +27,14 @@ export default {
2727
async run({ $ }) {
2828
const form = new FormData();
2929

30-
form.append("document", fs.createReadStream(this.filePath.includes("tmp/")
31-
? this.filePath
32-
: `/tmp/${this.filePath}`));
30+
const {
31+
stream, metadata,
32+
} = await getFileStreamAndMetadata(this.filePath);
33+
form.append("document", stream, {
34+
contentType: metadata.contentType,
35+
knownLength: metadata.size,
36+
filename: metadata.name,
37+
});
3338

3439
let response = await this._2markdown.pdfToMarkdown({
3540
$,

components/_2markdown/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/_2markdown",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"description": "Pipedream 2markdown Components",
55
"main": "_2markdown.app.mjs",
66
"keywords": [
@@ -13,7 +13,7 @@
1313
"access": "public"
1414
},
1515
"dependencies": {
16-
"@pipedream/platform": "^3.0.3",
16+
"@pipedream/platform": "^3.1.0",
1717
"form-data": "^4.0.1"
1818
}
1919
}

components/action1/action1.app.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export default {
88
console.log(Object.keys(this.$auth));
99
},
1010
},
11-
};
11+
};

components/airparser/actions/upload-document-parse/upload-document-parse.mjs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import airparser from "../../airparser.app.mjs";
2-
import fs from "fs";
2+
import { getFileStreamAndMetadata } from "@pipedream/platform";
33
import FormData from "form-data";
44

55
export default {
66
key: "airparser-upload-document-parse",
77
name: "Upload Document and Parse",
88
description: "Uploads a document into the inbox for data extraction. [See the documentation](https://help.airparser.com/public-api/public-api)",
9-
version: "0.0.1",
9+
version: "0.1.0",
1010
type: "action",
1111
props: {
1212
airparser,
@@ -18,8 +18,8 @@ export default {
1818
},
1919
filePath: {
2020
type: "string",
21-
label: "File Path",
22-
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).",
21+
label: "File Path or URL",
22+
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`)",
2323
},
2424
metadata: {
2525
type: "object",
@@ -29,11 +29,15 @@ export default {
2929
},
3030
},
3131
async run({ $ }) {
32-
const fileStream = fs.createReadStream(this.filePath.includes("tmp/")
33-
? this.filePath
34-
: `/tmp/${this.filePath}`);
32+
const {
33+
stream, metadata,
34+
} = await getFileStreamAndMetadata(this.filePath);
3535
const data = new FormData();
36-
data.append("file", fileStream);
36+
data.append("file", stream, {
37+
contentType: metadata.contentType,
38+
knownLength: metadata.size,
39+
filename: metadata.name,
40+
});
3741
if (this.metadata) {
3842
data.append("meta", JSON.stringify(this.metadata));
3943
}

components/airparser/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/airparser",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"description": "Pipedream Airparser Components",
55
"main": "airparser.app.mjs",
66
"keywords": [
@@ -13,7 +13,7 @@
1313
"access": "public"
1414
},
1515
"dependencies": {
16-
"@pipedream/platform": "^1.6.0",
16+
"@pipedream/platform": "^3.1.0",
1717
"form-data": "^4.0.0"
1818
}
1919
}

components/akeneo/actions/create-a-new-product-media-file/create-a-new-product-media-file.mjs

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import app from "../../akeneo.app.mjs";
2-
import utils from "../../common/utils.mjs";
3-
import { ConfigurationError } from "@pipedream/platform";
2+
import {
3+
ConfigurationError, getFileStreamAndMetadata,
4+
} from "@pipedream/platform";
45
import FormData from "form-data";
5-
import fs from "fs";
66

77
export default {
88
type: "action",
99
key: "akeneo-create-a-new-product-media-file",
10-
version: "0.0.1",
10+
version: "0.1.0",
1111
name: "Create A New Product Media File",
1212
description: "Allows you to create a new media file and associate it to an attribute value of a given product or product model. [See the docs](https://api.akeneo.com/api-reference.html#post_media_files)",
1313
props: {
@@ -32,18 +32,15 @@ export default {
3232
},
3333
filename: {
3434
type: "string",
35-
label: "File",
36-
description: "The file to be uploaded, please provide a file from `/tmp`. 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)",
35+
label: "File Path or URL",
36+
description: "The file to be uploaded. Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.txt`)",
3737
},
3838
},
3939
async run ({ $ }) {
4040
if (!this.productId && !this.productModelCode) {
4141
throw new ConfigurationError("Either `Product Identifier` or `Product Model Code` should be set!");
4242
}
43-
const path = utils.checkTmp(this.filename);
44-
if (!fs.existsSync(path)) {
45-
throw new ConfigurationError("File does not exist!");
46-
}
43+
4744
const payload = {
4845
attribute: this.mediaFileAttributeCode,
4946
scope: null,
@@ -57,9 +54,15 @@ export default {
5754
payload.code = this.productModelCode;
5855
data.append("product_model", JSON.stringify(payload));
5956
}
60-
const file = fs.readFileSync(path);
61-
const fileParts = path.split("/");
62-
data.append("file", file, fileParts[fileParts.length - 1]);
57+
58+
const {
59+
stream, metadata,
60+
} = await getFileStreamAndMetadata(this.filename);
61+
data.append("file", stream, {
62+
contentType: metadata.contentType,
63+
knownLength: metadata.size,
64+
filename: metadata.name,
65+
});
6366
const contentLength = data.getLengthSync();
6467
await this.app.createProductMediaFile({
6568
$,

components/akeneo/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/akeneo",
3-
"version": "0.0.2",
3+
"version": "0.1.0",
44
"description": "Pipedream Akeneo Components",
55
"main": "akeneo.app.mjs",
66
"keywords": [
@@ -10,7 +10,7 @@
1010
"homepage": "https://pipedream.com/apps/akeneo",
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1212
"dependencies": {
13-
"@pipedream/platform": "^1.3.0",
13+
"@pipedream/platform": "^3.1.0",
1414
"form-data": "^4.0.0"
1515
},
1616
"publishConfig": {

0 commit comments

Comments
 (0)