Skip to content

Commit 729cc67

Browse files
committed
Merge branch 'master' into 16977-part-3
2 parents 0033db0 + f074e50 commit 729cc67

File tree

294 files changed

+5579
-1201
lines changed

Some content is hidden

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

294 files changed

+5579
-1201
lines changed

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/alttext_ai/actions/generate-alt-text/generate-alt-text.mjs

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,35 @@
11
import alttextAi from "../../alttext_ai.app.mjs";
2-
import fs from "fs";
2+
import {
3+
ConfigurationError, getFileStream,
4+
} from "@pipedream/platform";
35
import { LANGUAGE_OPTIONS } from "../../commons/constants.mjs";
4-
import { ConfigurationError } from "@pipedream/platform";
56

67
export default {
78
key: "alttext_ai-generate-alt-text",
89
name: "Generate Alt Text",
910
description:
1011
"Generates a descriptive alt text for a given image. [See the documentation](https://alttext.ai/apidocs#tag/Images/operation/create-image)",
11-
version: "0.0.1",
12+
version: "0.1.0",
1213
type: "action",
1314
props: {
1415
alttextAi,
16+
fileInfo: {
17+
type: "alert",
18+
alertType: "warning",
19+
content: "Either `Image Data` or `Image File Path or URL` should be provided. If both are provided, `Image Data` will be used.",
20+
},
1521
imageData: {
1622
type: "string",
1723
label: "Image Data",
1824
description:
19-
"The image data in base64 format. Only one of `Image Data`, `Image File Path` or `Image URL` should be specified.",
20-
optional: true,
21-
},
22-
imageUrl: {
23-
type: "string",
24-
label: "Image URL",
25-
description:
26-
"The public URL to an image. Only one of `Image URL`, `Image Data` or `Image File Path` should be specified.",
25+
"The image data in base64 format",
2726
optional: true,
2827
},
2928
imageFilePath: {
3029
type: "string",
31-
label: "Image File Path",
30+
label: "Image File Path or URL",
3231
description:
33-
"The path to an image file in the `/tmp` directory. [See the documentation on working with files](https://pipedream.com/docs/code/nodejs/working-with-files/#the-tmp-directory). Only one of `Image File Path`, `Image URL` or `Image Data` should be specified.",
32+
"The image to process. Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myImage.jpg`)",
3433
optional: true,
3534
},
3635
keywords: {
@@ -64,31 +63,29 @@ export default {
6463
},
6564
},
6665
async run({ $ }) {
67-
if (
68-
(!this.imageData && !this.imageFilePath && !this.imageUrl)
69-
|| (this.imageData && this.imageFilePath)
70-
|| (this.imageData && this.imageUrl)
71-
|| (this.imageFilePath && this.imageUrl)
72-
) {
73-
throw new ConfigurationError("Only one of `Image Data`, `Image File Path` or `Image URL` should be specified.");
66+
const {
67+
imageData, imageFilePath,
68+
} = this;
69+
if (!imageData && !imageFilePath) {
70+
throw new ConfigurationError("Either `Image Data` or `Image File Path or URL` should be specified.");
71+
}
72+
73+
let rawData = imageData;
74+
if (!rawData) {
75+
const stream = await getFileStream(imageFilePath);
76+
const chunks = [];
77+
for await (const chunk of stream) {
78+
chunks.push(chunk);
79+
}
80+
const buffer = Buffer.concat(chunks);
81+
rawData = buffer.toString("base64");
7482
}
7583

7684
const response = await this.alttextAi.generateAltText({
7785
$,
7886
data: {
7987
image: {
80-
url: this.imageUrl,
81-
raw:
82-
this.imageData ??
83-
(this.imageFilePath &&
84-
fs.readFileSync(
85-
this.imageFilePath.includes("tmp/")
86-
? this.imageFilePath
87-
: `/tmp/${this.imageFilePath}`,
88-
{
89-
encoding: "base64",
90-
},
91-
)),
88+
raw: rawData,
9289
},
9390
keywords: this.keywords,
9491
negative_keywords: this.negativeKeywords,

components/alttext_ai/package.json

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

components/apollo_io/actions/search-accounts/search-accounts.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
name: "Search For Accounts",
77
description: "Search for accounts in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#search-for-accounts)",
88
type: "action",
9-
version: "0.0.5",
9+
version: "0.0.6",
1010
props: {
1111
app,
1212
search: {
@@ -40,7 +40,7 @@ export default {
4040
},
4141
},
4242
async run({ $ }) {
43-
const resourcesStream = this.app.getResourcesStream({
43+
const resourcesStream = this.app.getIterations({
4444
resourceFn: this.app.searchAccounts,
4545
resourceFnArgs: {
4646
params: {
@@ -53,7 +53,7 @@ export default {
5353
resourceName: "accounts",
5454
});
5555

56-
const accounts = await utils.streamIterator(resourcesStream);
56+
const accounts = await utils.iterate(resourcesStream);
5757

5858
$.export("$summary", `Successfully fetched ${accounts.length} accounts.`);
5959

components/apollo_io/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/apollo_io",
3-
"version": "0.5.2",
3+
"version": "0.5.3",
44
"description": "Pipedream Apollo.io Components",
55
"main": "apollo_io.app.mjs",
66
"keywords": [

components/arpoone/arpoone.app.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export default {
2+
type: "app",
3+
app: "arpoone",
4+
propDefinitions: {},
5+
methods: {
6+
// this.$auth contains connected account data
7+
authKeys() {
8+
console.log(Object.keys(this.$auth));
9+
},
10+
},
11+
};

components/arpoone/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "@pipedream/arpoone",
3+
"version": "0.0.1",
4+
"description": "Pipedream Arpoone Components",
5+
"main": "arpoone.app.mjs",
6+
"keywords": [
7+
"pipedream",
8+
"arpoone"
9+
],
10+
"homepage": "https://pipedream.com/apps/arpoone",
11+
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
12+
"publishConfig": {
13+
"access": "public"
14+
}
15+
}

components/autodesk/actions/upload-file/upload-file.mjs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import autodesk from "../../autodesk.app.mjs";
2-
import { axios } from "@pipedream/platform";
3-
import fs from "fs";
2+
import {
3+
axios, getFileStreamAndMetadata,
4+
} from "@pipedream/platform";
45

56
export default {
67
key: "autodesk-upload-file",
78
name: "Upload File",
89
description: "Uploads a new file to a specified folder in Autodesk. [See the documentation](https://aps.autodesk.com/en/docs/data/v2/tutorials/upload-file/).",
9-
version: "0.0.1",
10+
version: "0.1.0",
1011
type: "action",
1112
props: {
1213
autodesk,
@@ -42,8 +43,8 @@ export default {
4243
},
4344
filePath: {
4445
type: "string",
45-
label: "File Path",
46-
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)",
46+
label: "File Path or URL",
47+
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`)",
4748
},
4849
type: {
4950
type: "string",
@@ -107,19 +108,17 @@ export default {
107108
const signedUrl = urls[0];
108109

109110
// Upload to signed URL
110-
const filePath = this.filePath.includes("tmp/")
111-
? this.filePath
112-
: `/tmp/${this.filePath}`;
113-
const fileStream = fs.createReadStream(filePath);
114-
const fileSize = fs.statSync(filePath).size;
111+
const {
112+
stream, metadata,
113+
} = await getFileStreamAndMetadata(this.filePath);
115114

116115
await axios($, {
117116
url: signedUrl,
118-
data: fileStream,
117+
data: stream,
119118
method: "PUT",
120119
headers: {
121120
"Content-Type": "application/octet-stream",
122-
"Content-Length": fileSize,
121+
"Content-Length": metadata.size,
123122
},
124123
maxContentLength: Infinity,
125124
maxBodyLength: Infinity,

components/autodesk/package.json

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

0 commit comments

Comments
 (0)