diff --git a/.github/workflows/pull-request-checks.yaml b/.github/workflows/pull-request-checks.yaml index 6a5a4168d12d2..ccb541c6d3dce 100644 --- a/.github/workflows/pull-request-checks.yaml +++ b/.github/workflows/pull-request-checks.yaml @@ -96,6 +96,8 @@ jobs: format: 'csv' # NOTE: These steps are kept in this workflow to avoid re-rerunning the rest of the lint job # in the Components Checks workflow + - name: Build TypeScript Components + run: pnpm build - name: Check component keys run: node scripts/findBadKeys.js ${{ steps.changed_files.outputs.added_modified }} ${{ steps.changed_files.outputs.renamed }} - name: Check component app prop diff --git a/components/aws/actions/s3-stream-file/s3-stream-file.mjs b/components/aws/actions/s3-stream-file/s3-stream-file.mjs deleted file mode 100644 index e705f0c593199..0000000000000 --- a/components/aws/actions/s3-stream-file/s3-stream-file.mjs +++ /dev/null @@ -1,62 +0,0 @@ -import fs from "fs"; -import common from "../../common/common-s3.mjs"; -import { toSingleLineString } from "../../common/utils.mjs"; - -export default { - ...common, - key: "aws-s3-stream-file", - name: "S3 - Stream file to S3 from URL", - description: toSingleLineString(` - Accepts a file URL, and streams the file to the provided S3 bucket/key. - [See the docs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/upload-objects.html) - `), - version: "0.4.4", - type: "action", - props: { - aws: common.props.aws, - region: common.props.region, - bucket: common.props.bucket, - fileUrl: common.props.fileUrl, - filename: common.props.key, - }, - methods: { - ...common.methods, - async getStreamAndContentLength(fileResponse, absoluteFilePath) { - if (fileResponse.headers["content-length"]) { - return { - stream: fileResponse.data, - contentLength: fileResponse.headers["content-length"], - }; - } - const fileName = absoluteFilePath.split("/").pop(); - const tempLocalPath = `/tmp/${fileName}`; - await (new Promise((resolve) => { - const writeStream = fs.createWriteStream(tempLocalPath); - fileResponse.data.pipe(writeStream); - writeStream.on("finish", resolve); - })); - const { size } = fs.statSync(tempLocalPath); - return { - stream: fs.createReadStream(tempLocalPath), - contentLength: size, - }; - }, - }, - async run({ $ }) { - const fileResponse = await this.streamFile(this.fileUrl); - const filePath = this.filename.replace(/^\/+/, ""); - const { - stream, - contentLength, - } = await this.getStreamAndContentLength(fileResponse, filePath); - const response = await this.uploadFile({ - Bucket: this.bucket, - Key: filePath, - Body: stream, - ContentType: fileResponse.headers["content-type"], - ContentLength: contentLength, - }); - $.export("$summary", `Streaming file ${this.filename} to ${this.bucket}`); - return response; - }, -}; diff --git a/components/aws/actions/s3-upload-file/s3-upload-file.mjs b/components/aws/actions/s3-upload-base64-as-file/s3-upload-base64-as-file.mjs similarity index 65% rename from components/aws/actions/s3-upload-file/s3-upload-file.mjs rename to components/aws/actions/s3-upload-base64-as-file/s3-upload-base64-as-file.mjs index 9ae3dbeb57cfc..d80400f6a2776 100644 --- a/components/aws/actions/s3-upload-file/s3-upload-file.mjs +++ b/components/aws/actions/s3-upload-base64-as-file/s3-upload-base64-as-file.mjs @@ -1,15 +1,11 @@ import common from "../../common/common-s3.mjs"; -import { toSingleLineString } from "../../common/utils.mjs"; export default { ...common, - key: "aws-s3-upload-file", - name: "S3 - Upload File - Base64", - description: toSingleLineString(` - Accepts a base64-encoded string and a filename, then uploads as a file to S3. - [See the docs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/upload-objects.html) - `), - version: "0.3.2", + key: "aws-s3-upload-base64-as-file", + name: "S3 - Upload Base64 As File", + description: "Accepts a base64-encoded string and a filename, then uploads as a file to S3. [See the documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/upload-objects.html)", + version: "0.0.1", type: "action", props: { aws: common.props.aws, diff --git a/components/aws/actions/s3-upload-file-url/s3-upload-file-url.mjs b/components/aws/actions/s3-upload-file-url/s3-upload-file-url.mjs deleted file mode 100644 index f0181e439d183..0000000000000 --- a/components/aws/actions/s3-upload-file-url/s3-upload-file-url.mjs +++ /dev/null @@ -1,43 +0,0 @@ -import base from "@pipedream/helper_functions/actions/download-file-to-tmp/download-file-to-tmp.mjs"; -import common from "../../common/common-s3.mjs"; -import fs from "fs"; -import { toSingleLineString } from "../../common/utils.mjs"; - -// override base props label and description -base.props.url = common.props.fileUrl; -base.props.filename = common.props.key; - -export default { - ...common, - key: "aws-s3-upload-file-url", - name: "S3 - Upload File - URL", - description: toSingleLineString(` - Accepts a download link and a filename, downloads it, then uploads to S3. - [See the docs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/upload-objects.html) - `), - version: "0.1.3", - type: "action", - props: { - aws: common.props.aws, - region: common.props.region, - bucket: common.props.bucket, - ...base.props, - }, - async run({ $ }) { - const filedata = await base.run.bind(this)({ - $, - }); - const filename = filedata[0]; - const filepath = filedata[1]; - const file = fs.readFileSync(filepath, { - encoding: "base64", - }); - const response = await this.uploadFile({ - Bucket: this.bucket, - Key: filename, - Body: Buffer.from(file, "base64"), - }); - $.export("$summary", `Uploaded file ${filename} to S3`); - return response; - }, -}; diff --git a/components/aws/actions/s3-upload-file-tmp/s3-upload-file-tmp.mjs b/components/aws/actions/s3-upload-files/s3-upload-files.mjs similarity index 63% rename from components/aws/actions/s3-upload-file-tmp/s3-upload-file-tmp.mjs rename to components/aws/actions/s3-upload-files/s3-upload-files.mjs index 86468bf12f025..831a18777ee73 100644 --- a/components/aws/actions/s3-upload-file-tmp/s3-upload-file-tmp.mjs +++ b/components/aws/actions/s3-upload-files/s3-upload-files.mjs @@ -1,18 +1,17 @@ -import common from "../../common/common-s3.mjs"; -import fs from "fs"; import { join } from "path"; -import { toSingleLineString } from "../../common/utils.mjs"; -import { ConfigurationError } from "@pipedream/platform"; +import fs from "fs"; +import { + getFileStreamAndMetadata, + ConfigurationError, +} from "@pipedream/platform"; +import common from "../../common/common-s3.mjs"; export default { ...common, - key: "aws-s3-upload-file-tmp", - name: "S3 - Upload Files - /tmp", - description: toSingleLineString(` - Accepts a file path or folder path starting from /tmp, then uploads the contents to S3. - [See the docs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/upload-objects.html) - `), - version: "1.0.3", + key: "aws-s3-upload-files", + name: "S3 - Upload Files", + description: "Upload files to S3. Accepts either a file URL, a local file path, or a directory path. [See the documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/upload-objects.html)", + version: "0.0.1", type: "action", props: { aws: common.props.aws, @@ -25,8 +24,8 @@ export default { }, path: { type: "string", - label: "File Or Folder Path", - description: "Path starting from `/tmp`. If it's a directory, all files will be uploaded.", + label: "File Path, Url, Or Folder Path", + description: "Provide either a file URL, a path to a file in the `/tmp` directory (for example, `/tmp/myFile.pdf`), or a directory path to upload all files.", }, customFilename: { type: common.props.key.type, @@ -37,6 +36,17 @@ export default { }, methods: { ...common.methods, + streamToBase64(stream) { + return new Promise((resolve, reject) => { + const chunks = []; + stream.on("data", (chunk) => chunks.push(chunk)); + stream.on("end", () => { + const buffer = Buffer.concat(chunks); + resolve(buffer.toString("base64")); + }); + stream.on("error", reject); + }); + }, getFilesRecursive(dir) { let results = []; const items = fs.readdirSync(dir); @@ -59,16 +69,19 @@ export default { } = this; const files = this.getFilesRecursive(folderPath); const response = await Promise.all(files.map(async (filePath) => { - const fileContent = fs.readFileSync(filePath, { - encoding: "base64", - }); + const { + stream, + metadata, + } = await getFileStreamAndMetadata(filePath); const relativePath = filePath.substring(folderPath.length + 1); const s3Key = join(prefix, relativePath); await uploadFile({ Bucket: bucket, Key: s3Key, - Body: Buffer.from(fileContent, "base64"), + Body: stream, + ContentType: metadata.contentType, + ContentLength: metadata.size, }); return { filePath, @@ -87,15 +100,18 @@ export default { customFilename, } = this; - const file = fs.readFileSync(filePath, { - encoding: "base64", - }); + const { + stream, + metadata, + } = await getFileStreamAndMetadata(filePath); const filename = customFilename || filePath.split("/").pop(); const response = await uploadFile({ Bucket: bucket, Key: join(prefix, filename), - Body: Buffer.from(file, "base64"), + Body: stream, + ContentType: metadata.contentType, + ContentLength: metadata.size, }); $.export("$summary", `Uploaded file ${filename} to S3`); @@ -108,9 +124,17 @@ export default { uploadFolderFiles, path, } = this; + + // If path is a URL, treat it as a single file + if (path.startsWith("http://") || path.startsWith("https://")) { + return await uploadSingleFile($, path); + } + + // For local paths, check if it exists if (!fs.existsSync(path)) { throw new ConfigurationError(`The file or directory path \`${path}\` does not exist. Please verify the path and include the leading /tmp if needed.`); } + const stat = fs.statSync(path); return stat.isDirectory() ? await uploadFolderFiles($, path) diff --git a/components/aws/package.json b/components/aws/package.json index 2c6204beb39a0..c39813b749c11 100644 --- a/components/aws/package.json +++ b/components/aws/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/aws", - "version": "0.7.9", + "version": "1.0.0", "description": "Pipedream Aws Components", "main": "aws.app.mjs", "keywords": [ @@ -29,7 +29,7 @@ "@aws-sdk/s3-request-presigner": "^3.609.0", "@aws-sdk/signature-v4-crt": "^3.731.0", "@pipedream/helper_functions": "^0.3.6", - "@pipedream/platform": "^3.0.3", + "@pipedream/platform": "^3.1.0", "adm-zip": "^0.5.10", "dedent": "^1.5.1", "mailparser": "^3.6.6", diff --git a/components/click2mail2/actions/create-document/create-document.mjs b/components/click2mail2/actions/create-document/create-document.mjs index b2b63195b94fb..4ea09b8bdb2ed 100644 --- a/components/click2mail2/actions/create-document/create-document.mjs +++ b/components/click2mail2/actions/create-document/create-document.mjs @@ -1,26 +1,16 @@ import FormData from "form-data"; -import fs from "fs"; +import { getFileStreamAndMetadata } from "@pipedream/platform"; import click2mail2 from "../../click2mail2.app.mjs"; import { FORMATS } from "../../common/constants.mjs"; export default { key: "click2mail2-create-document", name: "Create Document", - version: "0.0.1", + version: "1.0.0", description: "Creates a new document in your account from an uploaded file or a URL. [See the documentation for file](https://developers.click2mail.com/reference/createdocument_1). [See the documentation for URL](https://developers.click2mail.com/reference/createdocumentfromurl)", type: "action", props: { click2mail2, - uploadType: { - type: "string", - label: "Upload Type", - description: "The type of the upload.", - reloadProps: true, - options: [ - "URL", - "File", - ], - }, documentName: { type: "string", label: "Document Name", @@ -39,49 +29,51 @@ export default { "documentClass", ], }, - }, - async additionalProps() { - const props = {}; - if (this.uploadType === "URL") { - props.url = { - type: "string", - label: "URL", - description: "Document url", - }; - } else { - props.file = { - type: "string", - label: "File", - description: "Path of the file in /tmp folder. 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)", - }; - } - return props; + file: { + type: "string", + label: "File Path Or Url", + description: "Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.pdf`).", + }, }, async run({ $ }) { const { click2mail2, - uploadType, file, ...params } = this; + const isUrl = file.startsWith("http://") || file.startsWith("https://"); let objToSend = {}; - if (uploadType === "File") { + if (!isUrl) { + const { + stream, metadata, + } = await getFileStreamAndMetadata(file); const formData = new FormData(); - formData.append("file", fs.createReadStream(file)); + formData.append("file", stream, { + contentType: metadata.contentType, + knownLength: metadata.size, + filename: metadata.name, + }); objToSend = { data: formData, headers: formData.getHeaders(), }; + } else { + objToSend = { + params: { + ...params, + url: file, + }, + }; } + const response = await click2mail2.create({ $, - path: `${uploadType === "File" + path: `${!isUrl ? "documents" : "documents/url"}`, - params, ...objToSend, }); diff --git a/components/click2mail2/package.json b/components/click2mail2/package.json index e17fd231d3c4c..0f57ec90fff4b 100644 --- a/components/click2mail2/package.json +++ b/components/click2mail2/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/click2mail2", - "version": "0.1.0", + "version": "1.0.0", "description": "Pipedream Click2Mail Components", "main": "click2mail2.app.mjs", "keywords": [ @@ -13,9 +13,8 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^1.5.1", + "@pipedream/platform": "^3.1.0", "form-data": "^4.0.0", "fs": "^0.0.1-security" } } - diff --git a/components/cloudflare_api_key/actions/change-ssl-setting/change-ssl-setting.mjs b/components/cloudflare_api_key/actions/change-ssl-setting/change-ssl-setting.mjs index a41d80471390b..25e7d9b86a94d 100644 --- a/components/cloudflare_api_key/actions/change-ssl-setting/change-ssl-setting.mjs +++ b/components/cloudflare_api_key/actions/change-ssl-setting/change-ssl-setting.mjs @@ -4,7 +4,7 @@ export default { key: "cloudflare_api_key-change-ssl-setting", name: "Change Zone's SSL Setting", description: "Choose the appropriate SSL setting for your zone. [See the docs here](https://api.cloudflare.com/#zone-settings-change-ssl-setting)", - version: "0.0.3", + version: "0.0.4", type: "action", props: { cloudflare, @@ -14,24 +14,21 @@ export default { "zoneIdentifier", ], }, - sslSetting: { - type: "string", - label: "SSL Setting", - description: "Value of the zone SSL setting", - options: [ - "off", - "flexible", - "full", - "strict", - ], + enabled: { + type: "boolean", + label: "Enabled", + description: "Whether to enable or disable Universal SSL", }, }, async run({ $ }) { const zoneId = this.zoneIdentifier; - const sslSetting = this.sslSetting; + const enabled = this.enabled; - const response = await this.cloudflare.changeZoneSslSetting(zoneId, sslSetting); - $.export("$summary", `Successfully updated zone #${zoneId} SSL setting to '${sslSetting}'`); + const response = await this.cloudflare.changeZoneSslSetting({ + zone_id: zoneId, + enabled, + }); + $.export("$summary", `Successfully updated zone #${zoneId} SSL setting to '${enabled}'`); return response; }, diff --git a/components/cloudflare_api_key/actions/change-zone-development-mode/change-zone-development-mode.mjs b/components/cloudflare_api_key/actions/change-zone-development-mode/change-zone-development-mode.mjs index 4368e083e2fe5..e3fed4671e28c 100644 --- a/components/cloudflare_api_key/actions/change-zone-development-mode/change-zone-development-mode.mjs +++ b/components/cloudflare_api_key/actions/change-zone-development-mode/change-zone-development-mode.mjs @@ -5,7 +5,7 @@ export default { key: "cloudflare_api_key-change-zone-development-mode", name: "Change Development Mode", description: "Development Mode temporarily allows you to enter development mode for your websites if you need to make changes to your site. This will bypass Cloudflare's accelerated cache and slow down your site. [See the docs here](https://api.cloudflare.com/#zone-settings-change-development-mode-setting)", - version: "0.0.3", + version: "0.0.4", type: "action", props: { cloudflare, @@ -26,7 +26,11 @@ export default { const zoneId = this.zoneIdentifier; const developmentMode = this.developmentMode; - const response = await this.cloudflare.changeDevelopmentMode(zoneId, developmentMode); + const response = await this.cloudflare.editZoneSetting({ + settingId: "development_mode", + zone_id: zoneId, + value: developmentMode, + }); $.export("$summary", `Turned ${developmentMode} development mode for #${zoneId}`); return response; diff --git a/components/cloudflare_api_key/actions/create-certificate/create-certificate.mjs b/components/cloudflare_api_key/actions/create-certificate/create-certificate.mjs index e958192de8623..cc052afb8c39f 100644 --- a/components/cloudflare_api_key/actions/create-certificate/create-certificate.mjs +++ b/components/cloudflare_api_key/actions/create-certificate/create-certificate.mjs @@ -4,8 +4,8 @@ import constants from "../../common/constants.mjs"; export default { key: "cloudflare_api_key-create-certificate", name: "Create a Certificate", - description: "Creates an Origin CA certificate. [See the docs here](https://api.cloudflare.com/#origin-ca-create-certificate)", - version: "0.0.3", + description: "Creates an Origin CA certificate. [See the documentation](https://developers.cloudflare.com/api/node/resources/origin_ca_certificates/methods/create/)", + version: "0.0.4", type: "action", props: { cloudflare, @@ -34,15 +34,21 @@ export default { }, }, async run({ $ }) { - const certificateData = { - hostnames: this.hostnames, - requested_validity: this.requestedValidity, - request_type: this.requestType, - csr: this.csr, - }; + const { + cloudflare, + hostnames, + requestedValidity, + requestType, + csr, + } = this; - const response = await this.cloudflare.createCertificate(certificateData); - $.export("$summary", `Successfully created certificate with ID ${response.result.id}`); + const response = await cloudflare.createCertificate({ + csr, + hostnames, + request_type: requestType, + requested_validity: requestedValidity, + }); + $.export("$summary", `Successfully created certificate with ID \`${response.result.id}\``); return response; }, diff --git a/components/cloudflare_api_key/actions/create-dns-record/create-dns-record.mjs b/components/cloudflare_api_key/actions/create-dns-record/create-dns-record.mjs index f4a4ff0b0f5bd..517f8e373a7df 100644 --- a/components/cloudflare_api_key/actions/create-dns-record/create-dns-record.mjs +++ b/components/cloudflare_api_key/actions/create-dns-record/create-dns-record.mjs @@ -1,86 +1,69 @@ -// legacy_hash_id: a_K5iLqd -import { axios } from "@pipedream/platform"; +import app from "../../cloudflare_api_key.app.mjs"; export default { key: "cloudflare_api_key-create-dns-record", name: "Create DNS Record", description: "Creates a DNS Record given its zone id", - version: "0.1.2", + version: "1.0.0", type: "action", props: { - cloudflare_api_key: { - type: "app", - app: "cloudflare_api_key", - }, - zone_id: { - type: "string", - description: "The zone ID where the DNS record being created belongs to.", - }, - type: { - type: "string", - description: "DNS record type.", - options: [ - "A", - "AAAA", - "CNAME", - "TXT", - "SRV", - "LOC", - "MX", - "NS", - "SPF", - "CERT", - "DNSKEY", - "NAPTR", - "SMIMEA", - "SSHFP", - "TLSA", - "URI", - "NS", + app, + zoneId: { + propDefinition: [ + app, + "zoneIdentifier", ], }, name: { type: "string", + label: "Name", description: "DNS record name.", }, + type: { + propDefinition: [ + app, + "dnsRecordType", + ], + }, content: { type: "string", + label: "Content", description: "DNS record content.", }, ttl: { type: "integer", + label: "TTL", description: "Time to live for DNS record. Value of 1 is 'automatic'.", }, proxied: { type: "boolean", + label: "Proxied", description: "Whether the record is receiving the performance and security benefits of Cloudflare", optional: true, }, - priority: { - type: "string", - description: "Used with some records like MX and SRV to determine priority. If you do not supply a priority for an MX record, a default value of 0 will be set.", - optional: true, - }, }, async run({ $ }) { + const { + app, + zoneId, + name, + type, + content, + ttl, + proxied, + } = this; - return await axios($, { - method: "post", - url: `https://api.cloudflare.com/client/v4/zones/${this.zone_id}/dns_records`, - headers: { - "X-Auth-Email": `${this.cloudflare_api_key.$auth.Email}`, - "X-Auth-Key": `${this.cloudflare_api_key.$auth.API_Key}`, - "Content-Type": "application/json", - - }, - data: { - type: this.type, - name: this.name, - content: this.content, - ttl: this.ttl, - proxied: this.proxied, - priority: this.priority, - }, + const response = await app.createDnsRecord({ + zone_id: zoneId, + name, + type, + content, + ttl, + proxied, }); + + $.export("$summary", "Successfully created DNS record"); + + return response; }, }; diff --git a/components/cloudflare_api_key/actions/create-ip-access-rule/create-ip-access-rule.mjs b/components/cloudflare_api_key/actions/create-ip-access-rule/create-ip-access-rule.mjs index ceb24bf9f8b08..6bb9ce9c32682 100644 --- a/components/cloudflare_api_key/actions/create-ip-access-rule/create-ip-access-rule.mjs +++ b/components/cloudflare_api_key/actions/create-ip-access-rule/create-ip-access-rule.mjs @@ -4,8 +4,8 @@ import consts from "../../common/constants.mjs"; export default { key: "cloudflare_api_key-create-ip-access-rule", name: "Create IP Access Rule", - description: "Creates a new IP Access Rule for an account. The rule will apply to all zones in the account. [See the docs here](https://api.cloudflare.com/#ip-access-rules-for-an-account-create-an-ip-access-rule)", - version: "0.0.1", + description: "Creates a new IP Access Rule for an account. The rule will apply to all zones in the account. [See the documentation](https://developers.cloudflare.com/api/node/resources/firewall/subresources/access_rules/methods/create/)", + version: "0.0.2", type: "action", props: { cloudflare, @@ -41,18 +41,25 @@ export default { }, }, async run({ $ }) { - const data = { - mode: this.mode, + const { + cloudflare, + accountIdentifier, + mode, + target, + value, + notes, + } = this; + + const { result } = await cloudflare.createIpAccessRule({ + account_id: accountIdentifier, + mode, + notes, configuration: { - target: this.target, - value: this.value, + target, + value, }, - notes: this.notes, - }; - - const { result } = await this.cloudflare.createIpAccessRule($, this.accountIdentifier, data); - - $.export("$summary", `Created IP Access Rule with ID ${result.id}`); + }); + $.export("$summary", `Created IP Access Rule with ID \`${result.id}\``); return result; }, diff --git a/components/cloudflare_api_key/actions/create-key-value-pairs/create-key-value-pairs.mjs b/components/cloudflare_api_key/actions/create-key-value-pairs/create-key-value-pairs.mjs index 263ed69c83533..fe266a397567e 100644 --- a/components/cloudflare_api_key/actions/create-key-value-pairs/create-key-value-pairs.mjs +++ b/components/cloudflare_api_key/actions/create-key-value-pairs/create-key-value-pairs.mjs @@ -3,8 +3,8 @@ import cloudflare from "../../cloudflare_api_key.app.mjs"; export default { key: "cloudflare_api_key-create-key-value-pairs", name: "Create Key/Value Pairs", - description: "Create new Key/Value pairs in a Namespace. [See the docs here](https://api.cloudflare.com/#workers-kv-namespace-write-key-value-pair)", - version: "0.0.2", + description: "Create new Key/Value pairs in a Namespace. [See the documentation](https://developers.cloudflare.com/api/node/resources/kv/subresources/namespaces/methods/bulk_update/)", + version: "0.0.3", type: "action", props: { cloudflare, @@ -41,7 +41,10 @@ export default { value, }); } - const response = await this.cloudflare.createKeyValuePair(this.account, this.namespace, data); + const response = await this.cloudflare.createKeyValuePair({ + namespaceId: this.namespace, + body: data, + }); $.export("$summary", `Successfully created value in namespace with ID ${this.namespace}`); diff --git a/components/cloudflare_api_key/actions/create-namespace/create-namespace.mjs b/components/cloudflare_api_key/actions/create-namespace/create-namespace.mjs index b95ef9ba9ce23..8728e3c28d96d 100644 --- a/components/cloudflare_api_key/actions/create-namespace/create-namespace.mjs +++ b/components/cloudflare_api_key/actions/create-namespace/create-namespace.mjs @@ -3,8 +3,8 @@ import cloudflare from "../../cloudflare_api_key.app.mjs"; export default { key: "cloudflare_api_key-create-namespace", name: "Create Namespace", - description: "Create a new Namespace in an account. [See the docs here](https://api.cloudflare.com/#workers-kv-namespace-create-a-namespace)", - version: "0.0.2", + description: "Create a new Namespace in an account. [See the documentation](https://developers.cloudflare.com/api/node/resources/kv/subresources/namespaces/methods/create/)", + version: "0.0.3", type: "action", props: { cloudflare, @@ -22,11 +22,18 @@ export default { }, }, async run({ $ }) { - const response = await this.cloudflare.createNamespace(this.account, { - title: this.title, + const { + cloudflare, + account, + title, + } = this; + + const response = await cloudflare.createNamespace({ + account_id: account, + title, }); - $.export("$summary", `Successfully created namespace with ID ${response.result.id}`); + $.export("$summary", `Successfully created namespace with ID \`${response.result.id}\``); return response; }, diff --git a/components/cloudflare_api_key/actions/create-zone/create-zone.mjs b/components/cloudflare_api_key/actions/create-zone/create-zone.mjs index 5c60987485ef6..9f345cdf254bc 100644 --- a/components/cloudflare_api_key/actions/create-zone/create-zone.mjs +++ b/components/cloudflare_api_key/actions/create-zone/create-zone.mjs @@ -5,7 +5,7 @@ export default { key: "cloudflare_api_key-create-zone", name: "Create Zone", description: "Create Zone. [See the docs here](https://api.cloudflare.com/#zone-create-zone)", - version: "0.0.3", + version: "0.0.4", type: "action", props: { cloudflare, diff --git a/components/cloudflare_api_key/actions/delete-dns-record/delete-dns-record.mjs b/components/cloudflare_api_key/actions/delete-dns-record/delete-dns-record.mjs index e161635149486..66cb2c4b93df0 100644 --- a/components/cloudflare_api_key/actions/delete-dns-record/delete-dns-record.mjs +++ b/components/cloudflare_api_key/actions/delete-dns-record/delete-dns-record.mjs @@ -4,7 +4,7 @@ export default { key: "cloudflare_api_key-delete-dns-record", name: "Delete DNS Record", description: "Deletes a DNS record of a zone. [See the docs here](https://api.cloudflare.com/#dns-records-for-a-zone-delete-dns-record)", - version: "0.0.3", + version: "0.0.4", type: "action", props: { cloudflare, @@ -26,10 +26,13 @@ export default { }, async run({ $ }) { const zoneId = this.zoneIdentifier; - const dnsRecordID = this.dnsRecordIdentifier; + const dnsRecordId = this.dnsRecordIdentifier; - const response = await this.cloudflare.deleteDnsRecord(zoneId, dnsRecordID); - $.export("$summary", `Successfully deleted DNS record with ID ${dnsRecordID}`); + const response = await this.cloudflare.deleteDnsRecord({ + dnsRecordId, + zone_id: zoneId, + }); + $.export("$summary", `Successfully deleted DNS record with ID \`${dnsRecordId}\``); return response; }, diff --git a/components/cloudflare_api_key/actions/export-dns-records/export-dns-records.mjs b/components/cloudflare_api_key/actions/export-dns-records/export-dns-records.mjs index 270518a465655..3d9c14b0863e8 100644 --- a/components/cloudflare_api_key/actions/export-dns-records/export-dns-records.mjs +++ b/components/cloudflare_api_key/actions/export-dns-records/export-dns-records.mjs @@ -4,7 +4,7 @@ export default { key: "cloudflare_api_key-export-dns-records", name: "Export DNS Records", description: "Export a BIND config of a zone. [See the docs here](https://api.cloudflare.com/#dns-records-for-a-zone-export-dns-records)", - version: "0.0.3", + version: "0.0.4", type: "action", props: { cloudflare, @@ -16,9 +16,9 @@ export default { }, }, async run({ $ }) { - const zoneId = this.zoneIdentifier; - - const response = await this.cloudflare.exportDnsRecords(zoneId); + const response = await this.cloudflare.exportDnsRecords({ + zone_id: this.zoneIdentifier, + }); $.export("$summary", "Successfully exported BIND file"); return response; diff --git a/components/cloudflare_api_key/actions/import-dns-records/import-dns-records.mjs b/components/cloudflare_api_key/actions/import-dns-records/import-dns-records.mjs index 8682874d9bfec..9603f09f86662 100644 --- a/components/cloudflare_api_key/actions/import-dns-records/import-dns-records.mjs +++ b/components/cloudflare_api_key/actions/import-dns-records/import-dns-records.mjs @@ -1,15 +1,11 @@ import cloudflare from "../../cloudflare_api_key.app.mjs"; -import fs from "fs"; -import got from "got@13.0.0"; -import stream from "stream"; -import { promisify } from "util"; -import FormData from "form-data"; +import { getFileStream } from "@pipedream/platform"; export default { key: "cloudflare_api_key-import-dns-records", name: "Import DNS Records", - description: "Import a BIND config into a zone. [See the docs here](https://api.cloudflare.com/#dns-records-for-a-zone-import-dns-records)", - version: "0.0.5", + description: "Import a BIND config into a zone. [See the documentation](https://developers.cloudflare.com/api/resources/dns/subresources/records/methods/import/)", + version: "1.0.0", type: "action", props: { cloudflare, @@ -25,50 +21,27 @@ export default { description: "Whether or not proxiable records should receive the performance and security benefits of Cloudflare", optional: true, }, - fileUrl: { + file: { type: "string", - label: "File URL", - description: "The URL of the BIND config file you want to import. Must specify either File URL or File Path", - optional: true, - }, - filePath: { - type: "string", - label: "File Path", - description: "The path to the file, e.g. /tmp/bind_config.txt. Must specify either File URL or File Path", - optional: true, + label: "File Path Or Url", + description: "Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/bind_config.txt`).", }, }, async run({ $ }) { - const zoneId = this.zoneIdentifier; const { - fileUrl, - filePath, + cloudflare, + zoneIdentifier, + proxied, + file, } = this; - if (!fileUrl && !filePath) { - throw new Error("Must specify either File URL or File Path"); - } - - const form = new FormData(); - if (this.proxied !== undefined) { - form.append("proxied", this.proxied.toString()); - } - - if (filePath) { - const readStream = fs.createReadStream(filePath); - form.append("file", readStream); - } else if (fileUrl) { - const tempFilePath = "/tmp/temp_bind_config.txt"; - const pipeline = promisify(stream.pipeline); - await pipeline( - got.stream(fileUrl), - fs.createWriteStream(tempFilePath), - ); - const readStream = fs.createReadStream(tempFilePath); - form.append("file", readStream); - } + const stream = await getFileStream(file); - const response = await this.cloudflare.importDnsRecords(zoneId, form); + const response = await cloudflare.importDnsRecords({ + zone_id: zoneIdentifier, + file: stream.toString(), + proxied, + }); $.export("$summary", "BIND config file successfully imported"); return response; diff --git a/components/cloudflare_api_key/actions/list-certificates/list-certificates.mjs b/components/cloudflare_api_key/actions/list-certificates/list-certificates.mjs index 39f7575cfcfc3..47ee20a20d1b4 100644 --- a/components/cloudflare_api_key/actions/list-certificates/list-certificates.mjs +++ b/components/cloudflare_api_key/actions/list-certificates/list-certificates.mjs @@ -3,8 +3,8 @@ import cloudflare from "../../cloudflare_api_key.app.mjs"; export default { key: "cloudflare_api_key-list-certificates", name: "List Certificates", - description: "List all existing Origin CA certificates for a given zone. [See the docs here](https://api.cloudflare.com/#origin-ca-list-certificates)", - version: "0.0.3", + description: "List all existing Origin CA certificates for a given zone. [See the documentation](https://developers.cloudflare.com/api/node/resources/origin_ca_certificates/methods/list/)", + version: "0.0.4", type: "action", props: { cloudflare, @@ -16,9 +16,14 @@ export default { }, }, async run({ $ }) { - const zoneId = this.zoneIdentifier; + const { + cloudflare, + zoneIdentifier, + } = this; - const response = await this.cloudflare.getCertificates(zoneId); + const response = await cloudflare.getCertificates({ + zone_id: zoneIdentifier, + }); $.export("$summary", "Certificates successfully retrieved"); return response; diff --git a/components/cloudflare_api_key/actions/list-dns-records/list-dns-records.mjs b/components/cloudflare_api_key/actions/list-dns-records/list-dns-records.mjs index 22f4e1483b123..2f4ecff280b47 100644 --- a/components/cloudflare_api_key/actions/list-dns-records/list-dns-records.mjs +++ b/components/cloudflare_api_key/actions/list-dns-records/list-dns-records.mjs @@ -5,11 +5,11 @@ export default { key: "cloudflare_api_key-list-dns-records", name: "List DNS Records", description: "List, search, sort, and filter a zones' DNS records. [See the docs here](https://api.cloudflare.com/#dns-records-for-a-zone-list-dns-records)", - version: "0.0.3", + version: "1.0.0", type: "action", props: { cloudflare, - zoneIdentifier: { + zoneId: { propDefinition: [ cloudflare, "zoneIdentifier", @@ -36,7 +36,7 @@ export default { ], optional: true, }, - dnsRecordType: { + type: { propDefinition: [ cloudflare, "dnsRecordType", @@ -53,21 +53,27 @@ export default { }, }, async run({ $ }) { - const zoneId = this.zoneIdentifier; - const dnsRecordData = { - match: this.match, - name: this.name, - content: this.content, - type: this.dnsRecordType, - proxied: this.proxied, - }; + const { + cloudflare, + zoneId, + match, + name, + content, + type, + proxied, + } = this; let page = 1; const dnsRecords = []; let tempDnsRecords; do { - tempDnsRecords = await this.cloudflare.listDnsRecords(zoneId, { - ...dnsRecordData, + tempDnsRecords = await cloudflare.listDnsRecords({ + zone_id: zoneId, + match, + name, + content, + type, + proxied, page, }); dnsRecords.push(...tempDnsRecords.result); diff --git a/components/cloudflare_api_key/actions/patch-dns-record/patch-dns-record.mjs b/components/cloudflare_api_key/actions/patch-dns-record/patch-dns-record.mjs index a6f42bc870cbc..c766181cc4966 100644 --- a/components/cloudflare_api_key/actions/patch-dns-record/patch-dns-record.mjs +++ b/components/cloudflare_api_key/actions/patch-dns-record/patch-dns-record.mjs @@ -4,7 +4,7 @@ export default { key: "cloudflare_api_key-patch-dns-record", name: "Patch DNS Record", description: "Patches a DNS record of a zone. [See the docs here](https://api.cloudflare.com/#dns-records-for-a-zone-patch-dns-record)", - version: "0.0.3", + version: "0.0.4", type: "action", props: { cloudflare, @@ -60,17 +60,26 @@ export default { }, }, async run({ $ }) { - const zoneId = this.zoneIdentifier; - const dnsRecordID = this.dnsRecordIdentifier; - const dnsRecordData = { - type: this.dnsRecordType, - name: this.dnsRecordName, - content: this.dnsRecordContent, - ttl: this.dnsRecordTtl, - proxied: this.dnsRecordProxied, - }; + const { + cloudflare, + zoneIdentifier, + dnsRecordIdentifier, + dnsRecordType, + dnsRecordName, + dnsRecordContent, + dnsRecordTtl, + dnsRecordProxied, + } = this; - const response = await this.cloudflare.patchDnsRecord(zoneId, dnsRecordID, dnsRecordData); + const response = await cloudflare.patchDnsRecord({ + zone_id: zoneIdentifier, + dnsRecordId: dnsRecordIdentifier, + type: dnsRecordType, + name: dnsRecordName, + content: dnsRecordContent, + ttl: dnsRecordTtl, + proxied: dnsRecordProxied, + }); $.export("$summary", `Successfully patched DNS record with ID ${response.result.id}`); return response; diff --git a/components/cloudflare_api_key/actions/purge-all-files/purge-all-files.mjs b/components/cloudflare_api_key/actions/purge-all-files/purge-all-files.mjs index b87eee2b92ec2..0c57eef0ae489 100644 --- a/components/cloudflare_api_key/actions/purge-all-files/purge-all-files.mjs +++ b/components/cloudflare_api_key/actions/purge-all-files/purge-all-files.mjs @@ -1,40 +1,33 @@ -// legacy_hash_id: a_nji3N5 -import { axios } from "@pipedream/platform"; +import cloudflare from "../../cloudflare_api_key.app.mjs"; export default { key: "cloudflare_api_key-purge-all-files", name: "Purge All Files", - description: "Remove ALL files from Cloudflare's cache.", - version: "0.2.2", + description: "Remove ALL files from Cloudflare's cache. [See the documentation](https://developers.cloudflare.com/api/node/resources/cache/methods/purge/)", + version: "1.0.0", type: "action", props: { - cloudflare_api_key: { - type: "app", - app: "cloudflare_api_key", - }, - zone_id: { - type: "string", - description: "The zone ID where the DNS record being modified belongs to.", + cloudflare, + zoneId: { + propDefinition: [ + cloudflare, + "zoneIdentifier", + ], }, }, async run({ $ }) { - //See Quickbooks API docs at: https://api.cloudflare.com/#zone-purge-all-files - - if (!this.zone_id) { - throw new Error("Must provide zone_id parameter."); - } + const { + cloudflare, + zoneId, + } = this; - return await axios($, { - method: "post", - url: `https://api.cloudflare.com/client/v4/zones/${this.zone_id}/purge_cache`, - headers: { - "X-Auth-Email": `${this.cloudflare_api_key.$auth.Email}`, - "X-Auth-Key": `${this.cloudflare_api_key.$auth.API_Key}`, - "Content-Type": "application/json", - }, - data: { - purge_everything: true, - }, + const response = await cloudflare.purgeCache({ + zone_id: zoneId, + purge_everything: true, }); + + $.export("$summary", `Purged all files from zone \`${zoneId}\``); + + return response; }, }; diff --git a/components/cloudflare_api_key/actions/purge-files-by-url/purge-files-by-url.mjs b/components/cloudflare_api_key/actions/purge-files-by-url/purge-files-by-url.mjs index 375843d055d54..1677de061fe1e 100644 --- a/components/cloudflare_api_key/actions/purge-files-by-url/purge-files-by-url.mjs +++ b/components/cloudflare_api_key/actions/purge-files-by-url/purge-files-by-url.mjs @@ -1,18 +1,18 @@ -import { axios } from "@pipedream/platform"; -import cloudflare_api_key from "../../cloudflare_api_key.app.mjs"; +import cloudflare from "../../cloudflare_api_key.app.mjs"; export default { key: "cloudflare_api_key-purge-files-by-url", type: "action", - version: "0.0.3", + version: "0.1.0", name: "Purge Files by URL", - description: "Granularly remove one or more files from Cloudflare's cache by specifying URLs. [See docs here](https://developers.cloudflare.com/cache/how-to/purge-cache/#purge-by-single-file-by-url)", + description: "Granularly remove one or more files from Cloudflare's cache by specifying URLs. [See the documentation](https://developers.cloudflare.com/api/node/resources/cache/methods/purge/)", props: { - cloudflare_api_key, + cloudflare, zoneId: { - type: "string", - label: "Zone ID", - description: "The Zone ID where the URL(s) being purged belongs to.", + propDefinition: [ + cloudflare, + "zoneIdentifier", + ], }, purgeUrls: { type: "string[]", @@ -21,17 +21,19 @@ export default { }, }, async run({ $ }) { - return await axios($, { - method: "post", - url: `https://api.cloudflare.com/client/v4/zones/${this.zoneId}/purge_cache`, - headers: { - "X-Auth-Email": `${this.cloudflare_api_key.$auth.Email}`, - "X-Auth-Key": `${this.cloudflare_api_key.$auth.API_Key}`, - "Content-Type": "application/json", - }, - data: { - files: this.purgeUrls, - }, + const { + cloudflare, + zoneId, + purgeUrls, + } = this; + + const response = await cloudflare.purgeCache({ + zone_id: zoneId, + files: purgeUrls, }); + + $.export("$summary", `Purged files from zone \`${zoneId}\``); + + return response; }, }; diff --git a/components/cloudflare_api_key/actions/query-worker-analytics/query-worker-analytics.mjs b/components/cloudflare_api_key/actions/query-worker-analytics/query-worker-analytics.mjs deleted file mode 100644 index 5f8c1d61d34b6..0000000000000 --- a/components/cloudflare_api_key/actions/query-worker-analytics/query-worker-analytics.mjs +++ /dev/null @@ -1,26 +0,0 @@ -import cloudflare from "../../cloudflare_api_key.app.mjs"; - -export default { - key: "cloudflare_api_key-query-worker-analytics", - name: "Query Worker Analytics", - description: "Retrieves Workers KV request metrics for the given account. [See the docs here](https://api.cloudflare.com/#workers-kv-request-analytics-query-request-analytics)", - version: "0.0.2", - type: "action", - props: { - cloudflare, - account: { - propDefinition: [ - cloudflare, - "accountIdentifier", - ], - description: "The account to query", - }, - }, - async run({ $ }) { - const response = await this.cloudflare.getWorkerAnalytics($, this.account); - - $.export("$summary", "Successfully retrieved worker analytics."); - - return response; - }, -}; diff --git a/components/cloudflare_api_key/actions/revoke-certificate/revoke-certificate.mjs b/components/cloudflare_api_key/actions/revoke-certificate/revoke-certificate.mjs index 70ef75355a4e5..0b6250042b574 100644 --- a/components/cloudflare_api_key/actions/revoke-certificate/revoke-certificate.mjs +++ b/components/cloudflare_api_key/actions/revoke-certificate/revoke-certificate.mjs @@ -3,8 +3,8 @@ import cloudflare from "../../cloudflare_api_key.app.mjs"; export default { key: "cloudflare_api_key-revoke-certificate", name: "Revoke Certificate", - description: "Revoke an existing Origin CA certificate by its serial number. [See the docs here](https://api.cloudflare.com/#origin-ca-revoke-certificate)", - version: "0.0.3", + description: "Revoke an existing Origin CA certificate by its serial number. [See the documentation](https://developers.cloudflare.com/api/node/resources/origin_ca_certificates/methods/delete/)", + version: "0.0.4", type: "action", props: { cloudflare, @@ -25,10 +25,13 @@ export default { }, }, async run({ $ }) { - const certificateID = this.certificateIdentifier; + const { + cloudflare, + certificateIdentifier, + } = this; - const response = await this.cloudflare.revokeCertificate(certificateID); - $.export("$summary", `Successfully revoked certificate with ID ${response.result.id}`); + const response = await cloudflare.revokeCertificate(certificateIdentifier); + $.export("$summary", `Successfully revoked certificate with ID \`${response.result.id}\``); return response; }, diff --git a/components/cloudflare_api_key/actions/update-zone-security-level/update-zone-security-level.mjs b/components/cloudflare_api_key/actions/update-zone-security-level/update-zone-security-level.mjs index 867cc8f7fd603..04a2d6c96f0d1 100644 --- a/components/cloudflare_api_key/actions/update-zone-security-level/update-zone-security-level.mjs +++ b/components/cloudflare_api_key/actions/update-zone-security-level/update-zone-security-level.mjs @@ -5,7 +5,7 @@ export default { key: "cloudflare_api_key-update-zone-security-level", name: "Update Zone Security Level", description: "Choose the appropriate security profile for your website, which will automatically adjust each of the security settings. [See the docs here](https://api.cloudflare.com/#zone-settings-change-security-level-setting)", - version: "0.0.3", + version: "0.0.4", type: "action", props: { cloudflare, @@ -26,7 +26,11 @@ export default { const zoneId = this.zoneIdentifier; const securityLevel = this.securityLevel; - const response = await this.cloudflare.updateZoneSecurityLevel(zoneId, securityLevel); + const response = await this.cloudflare.editZoneSetting({ + settingId: "security_level", + zone_id: zoneId, + value: securityLevel, + }); $.export("$summary", `Successfully updated zone #${zoneId} security level to '${securityLevel}'`); return response; diff --git a/components/cloudflare_api_key/cloudflare_api_key.app.mjs b/components/cloudflare_api_key/cloudflare_api_key.app.mjs index d81b00af2ce43..6fc80ff77a6a4 100644 --- a/components/cloudflare_api_key/cloudflare_api_key.app.mjs +++ b/components/cloudflare_api_key/cloudflare_api_key.app.mjs @@ -1,5 +1,5 @@ -import { axios } from "@pipedream/platform"; -import cloudflare from "cloudflare"; +import { ConfigurationError } from "@pipedream/platform"; +import Cloudflare from "cloudflare"; import constants from "./common/constants.mjs"; export default { @@ -10,42 +10,41 @@ export default { type: "string", label: "Account ID", description: "Account which the zone is created in", - async options({ prevContext }) { - const page = prevContext.page || 1; - const accounts = await this.getAccounts({ - page, + async options({ page }) { + const response = await this.getAccounts({ + page: page + 1, }); - return { - options: accounts.result.map((account) => ({ - value: account.id, - label: account.name, - })), - context: { - page: page + 1, - }, - }; + return response.result.map(({ + id: value, + name: label, + }) => ({ + value, + label, + })); }, }, zoneIdentifier: { type: "string", label: "Zone ID", description: "The zone identifier", - async options({ prevContext }) { - const page = prevContext.page || 1; - const zones = await this.getZones({ - page, + async options({ + page, + accountIdentifier, + }) { + const response = await this.getZones({ + page: page + 1, + ["account.id"]: accountIdentifier, }); + console.log("response!!!", JSON.stringify(response, null, 2)); - return { - options: zones.result.map((zone) => ({ - value: zone.id, - label: zone.name, - })), - context: { - page: page + 1, - }, - }; + return response.result.map(({ + id: value, + name: label, + }) => ({ + value, + label, + })); }, }, dnsRecordIdentifier: { @@ -53,23 +52,20 @@ export default { label: "DNS record ID", description: "The DNS record identifier", async options({ - prevContext, - zoneIdentifier, + page, zoneIdentifier, }) { - const page = prevContext.page || 1; - const dnsRecords = await this.listDnsRecords(zoneIdentifier, { - page, + const response = await this.listDnsRecords({ + zone_id: zoneIdentifier, + page: page + 1, }); - return { - options: dnsRecords.result.map((record) => ({ - value: record.id, - label: record.name, - })), - context: { - page: page + 1, - }, - }; + return response.result.map(({ + id: value, + name: label, + }) => ({ + value, + label, + })); }, }, certificateIdentifier: { @@ -77,28 +73,24 @@ export default { label: "Certificate ID", description: "The certificate identifier", async options({ - prevContext, - zoneIdentifier, + page, zoneIdentifier, }) { - const page = prevContext.page || 1; - const certificates = await this.getCertificates(zoneIdentifier, { - page, + const response = await this.getCertificates({ + zone_id: zoneIdentifier, + page: page + 1, }); - return { - options: certificates.result.map((certificate) => certificate.id), - context: { - page: page + 1, - }, - }; + return response.result.map(({ id }) => id); }, }, namespace: { type: "string", label: "Namespace", description: "The namespace identifier", - async options({ accountId }) { - const namespaces = await this.listNamespaces(accountId); + async options({ accountIdentifier }) { + const namespaces = await this.listNamespaces({ + account_id: accountIdentifier, + }); return namespaces.result.map((namespace) => ({ label: namespace.title, value: namespace.id, @@ -133,268 +125,197 @@ export default { }, }, methods: { - _makeRequest($ = this, opts) { - const { - method = "get", - path, - data, - params, - } = opts; - return axios($, { - method, - url: `https://api.cloudflare.com/client/v4${path}`, - data, - params, - headers: { - ...this._getHeaders(), - ...opts.headers, - }, - }); - }, _throwFormattedError(error) { if (!error.response) { - throw new Error(error); + throw new ConfigurationError(error); } const cloudflareResponse = error.response.body; this._throwApiRequestFormattedError(cloudflareResponse); }, _throwApiRequestFormattedError(cloudflareResponse) { if (!cloudflareResponse.errors) { - throw new Error(cloudflareResponse); + throw new ConfigurationError(cloudflareResponse); } const cloudflareError = cloudflareResponse.errors[0]; const errorMessage = cloudflareResponse.errors[0].message; if (cloudflareError.error_chain && cloudflareError.error_chain.length > 0) { - throw new Error(cloudflareError.error_chain[0].message); + throw new ConfigurationError(cloudflareError.error_chain[0].message); } - throw new Error(errorMessage); - }, - _getHeaders() { - return { - "X-Auth-Email": `${this.$auth.Email}`, - "X-Auth-Key": `${this.$auth.API_Key}`, - "Content-Type": "application/json", - }; - }, - _getCloudflareClient() { - const client = cloudflare({ - email: this.$auth.Email, - key: this.$auth.API_Key, + throw new ConfigurationError(errorMessage); + }, + getClient() { + const { + Email: apiEmail, + API_Key: apiKey, + } = this.$auth; + + const client = new Cloudflare({ + apiEmail, + apiKey, + defaultHeaders: { + "Authorization": `Bearer ${apiKey}`, + }, }); return client; }, - async getZones(options) { - const cf = this._getCloudflareClient(); + async getZones(args = {}) { + const client = this.getClient(); try { - const response = await cf.zones.browse(options); - return response; + return await client.zones.list(args); } catch (error) { this._throwFormattedError(error); } }, - async createZone(zoneData) { - const cf = this._getCloudflareClient(); + async createZone(args = {}) { + const client = this.getClient(); try { - const response = await cf.zones.add(zoneData); - return response; + return await client.zones.create(args); } catch (error) { this._throwFormattedError(error); } }, - async changeZoneSslSetting(zoneID, sslSetting) { - const cf = this._getCloudflareClient(); + async changeZoneSslSetting(args = {}) { + const client = this.getClient(); try { - const response = await cf.zoneSettings.edit(zoneID, "ssl", { - value: sslSetting, - }); - return response; + return await client.ssl.universal.settings.edit(args); } catch (error) { this._throwFormattedError(error); } }, - async updateZoneSecurityLevel(zoneID, securityLevel) { - const cf = this._getCloudflareClient(); + async editZoneSetting({ + settingId, ...args + } = {}) { + const client = this.getClient(); try { - const response = await cf.zoneSettings.edit(zoneID, "security_level", { - value: securityLevel, - }); - return response; + return await client.zones.settings.edit(settingId, args); } catch (error) { this._throwFormattedError(error); } }, - async changeDevelopmentMode(zoneID, developmentMode) { - const cf = this._getCloudflareClient(); + async createDnsRecord(args = {}) { + const client = this.getClient(); try { - const response = await cf.zoneSettings.edit(zoneID, "development_mode", { - value: developmentMode, - }); - return response; + return await client.dns.records.create(args); } catch (error) { this._throwFormattedError(error); } }, - async createDnsRecord(zoneID, dnsRecordData) { - const cf = this._getCloudflareClient(); + async listDnsRecords(args = {}) { + const client = this.getClient(); try { - const response = await cf.dnsRecords.add(zoneID, dnsRecordData); - return response; + return await client.dns.records.list(args); } catch (error) { this._throwFormattedError(error); } }, - async listDnsRecords(zoneID, dnsRecordData) { - const cf = this._getCloudflareClient(); + async patchDnsRecord({ + dnsRecordId, ...args + } = {}) { + const client = this.getClient(); try { - const response = await cf.dnsRecords.browse(zoneID, dnsRecordData); - return response; + return await client.dns.records.edit(dnsRecordId, args); } catch (error) { this._throwFormattedError(error); } }, - async patchDnsRecord(zoneID, dnsRecordID, dnsRecordData) { - try { - const response = await this._makeRequest(this, { - method: "PATCH", - path: `/zones/${zoneID}/dns_records/${dnsRecordID}`, - data: dnsRecordData, - }); - return response; - } catch (error) { - this._throwApiRequestFormattedError(error); - } - }, - async deleteDnsRecord(zoneID, dnsRecordID) { - const cf = this._getCloudflareClient(); + async deleteDnsRecord({ + dnsRecordId, ...args + } = {}) { + const client = this.getClient(); try { - const response = await cf.dnsRecords.del(zoneID, dnsRecordID); - return response; + return await client.dns.records.delete(dnsRecordId, args); } catch (error) { this._throwFormattedError(error); } }, - async exportDnsRecords(zoneID) { - const cf = this._getCloudflareClient(); + async exportDnsRecords(args = {}) { + const client = this.getClient(); try { - const response = await cf.dnsRecords.export(zoneID); - return response; + return await client.dns.records.export(args); } catch (error) { this._throwFormattedError(error); } }, - async importDnsRecords(zoneID, importData) { + async importDnsRecords(args = {}) { + const client = this.getClient(); try { - const response = await this._makeRequest(this, { - method: "POST", - path: `/zones/${zoneID}/dns_records/import`, - headers: { - "Content-Type": `multipart/form-data; boundary=${importData._boundary}`, - }, - data: importData, - }); - return response; + return await client.dns.records.import(args); } catch (error) { - this._throwApiRequestFormattedError(error); + this._throwFormattedError(error); } }, - async createCertificate(certificateData) { + async createCertificate(args = {}) { + const client = this.getClient(); try { - const response = await this._makeRequest(this, { - method: "POST", - path: "/certificates", - data: certificateData, - }); - return response; + return await client.originCACertificates.create(args); } catch (error) { - this._throwApiRequestFormattedError(error); + this._throwFormattedError(error); } }, - async getCertificates(zoneID, params) { + async getCertificates(args = {}) { + const client = this.getClient(); try { - const response = await this._makeRequest(this, { - method: "GET", - path: "/certificates", - params: { - zone_id: zoneID, - ...params, - }, - }); - return response; + return await client.originCACertificates.list(args); } catch (error) { - this._throwApiRequestFormattedError(error); + this._throwFormattedError(error); } }, - async revokeCertificate(certificateID) { + async revokeCertificate(certificateId) { + const client = this.getClient(); try { - const response = await this._makeRequest(this, { - method: "DELETE", - path: `/certificates/${certificateID}`, - }); - return response; + return await client.originCACertificates.delete(certificateId); } catch (error) { - this._throwApiRequestFormattedError(error); + this._throwFormattedError(error); } }, - async getAccounts(params) { + async getAccounts(args = {}) { + const client = this.getClient(); try { - const response = await this._makeRequest(this, { - method: "GET", - path: "/accounts/", - params, - }); - return response; + return await client.accounts.list(args); } catch (error) { - this._throwApiRequestFormattedError(error); + this._throwFormattedError(error); } }, - async listNamespaces(accountId) { - const cf = this._getCloudflareClient(); + async listNamespaces(args = {}) { + const client = this.getClient(); try { - const response = await cf.enterpriseZoneWorkersKVNamespaces.browse(accountId); - return response; + return await client.kv.namespaces.list(args); } catch (error) { this._throwFormattedError(error); } }, - async createNamespace(accountId, config) { - const cf = this._getCloudflareClient(); + async createKeyValuePair({ + namespaceId, ...args + } = {}) { + const client = this.getClient(); try { - const response = await cf.enterpriseZoneWorkersKVNamespaces.add(accountId, config); - return response; + return await client.kv.namespaces.bulkUpdate(namespaceId, args); } catch (error) { this._throwFormattedError(error); } }, - async createKeyValuePair(accountId, namespaceId, data) { - const cf = this._getCloudflareClient(); + async createNamespace(args = {}) { + const client = this.getClient(); try { - const response = await cf.enterpriseZoneWorkersKV.addMulti(accountId, namespaceId, data); - return response; + return await client.kv.namespaces.create(args); } catch (error) { this._throwFormattedError(error); } }, - async getWorkerAnalytics($, accountId) { + async createIpAccessRule(args = {}) { + const client = this.getClient(); try { - const response = await this._makeRequest($, { - method: "GET", - path: `/accounts/${accountId}/storage/analytics`, - }); - return response; + return await client.firewall.accessRules.create(args); } catch (error) { - this._throwApiRequestFormattedError(error); + this._throwFormattedError(error); } }, - async createIpAccessRule($, accountId, data) { + async purgeCache(args = {}) { + const client = this.getClient(); try { - const response = await this._makeRequest($, { - method: "POST", - path: `/accounts/${accountId}/firewall/access_rules/rules`, - data, - }); - return response; + return await client.cache.purge(args); } catch (error) { - this._throwApiRequestFormattedError(error); + this._throwFormattedError(error); } }, }, diff --git a/components/cloudflare_api_key/common/constants.mjs b/components/cloudflare_api_key/common/constants.mjs index 72eefc8ca34df..9ada42562ae0c 100644 --- a/components/cloudflare_api_key/common/constants.mjs +++ b/components/cloudflare_api_key/common/constants.mjs @@ -1,30 +1,3 @@ -const ZONE_SECURITY_LEVEL_OPTIONS = [ - { - label: "Off", - value: "off", - }, - { - label: "Essentially Off", - value: "essentially_off", - }, - { - label: "Low", - value: "low", - }, - { - label: "Medium", - value: "medium", - }, - { - label: "High", - value: "high", - }, - { - label: "Under Attack", - value: "under_attack", - }, -]; - const DNS_RECORD_MATCH_OPTIONS = [ { label: "Any", @@ -36,36 +9,28 @@ const DNS_RECORD_MATCH_OPTIONS = [ }, ]; -const DEVELOPMENT_MODE_OPTIONS = [ - { - label: "On", - value: "on", - }, - { - label: "Off", - value: "off", - }, -]; - const DNS_RECORD_TYPE_OPTIONS = [ "A", "AAAA", "CNAME", - "HTTPS", - "TXT", - "SRV", - "LOC", "MX", "NS", + "OPENPGPKEY", + "PTR", + "TXT", + "CAA", "CERT", "DNSKEY", "DS", + "HTTPS", + "LOC", "NAPTR", "SMIMEA", + "SRV", "SSHFP", "SVCB", "TLSA", - "URI read only", + "URI", ]; const ZONE_TYPE_OPTIONS = [ @@ -111,9 +76,7 @@ const IP_ACCESS_RULE_TARGET_OPTIONS = [ ]; export default { - ZONE_SECURITY_LEVEL_OPTIONS, DNS_RECORD_MATCH_OPTIONS, - DEVELOPMENT_MODE_OPTIONS, DNS_RECORD_TYPE_OPTIONS, ZONE_TYPE_OPTIONS, CERTIFICATE_REQUEST_TYPE_OPTIONS, diff --git a/components/cloudflare_api_key/package.json b/components/cloudflare_api_key/package.json index 295689a33c9c2..c026b707870fe 100644 --- a/components/cloudflare_api_key/package.json +++ b/components/cloudflare_api_key/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/cloudflare_api_key", - "version": "0.0.5", + "version": "1.0.0", "description": "Pipedream Cloudflare Components", "main": "cloudflare_api_key.app.mjs", "keywords": [ @@ -13,11 +13,7 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^1.1.1", - "cloudflare": "^2.9.1", - "form-data": "^4.0.0", - "got": "^12.5.1", - "stream": "^0.0.2", - "util": "^0.12.4" + "@pipedream/platform": "^3.1.0", + "cloudflare": "^4.4.1" } } diff --git a/components/cloudmersive/actions/convert-to-pdf/convert-to-pdf.ts b/components/cloudmersive/actions/convert-to-pdf/convert-to-pdf.ts index 3fa7803d98247..888082998e945 100644 --- a/components/cloudmersive/actions/convert-to-pdf/convert-to-pdf.ts +++ b/components/cloudmersive/actions/convert-to-pdf/convert-to-pdf.ts @@ -1,44 +1,59 @@ -import fs from "fs"; import { defineAction } from "@pipedream/types"; -import { ConfigurationError } from "@pipedream/platform"; +import { + ConfigurationError, + getFileStream, +} from "@pipedream/platform"; import cloudmersive from "../../app/cloudmersive.app"; import { DOCS } from "../../common/constants"; import { ConvertToPDFParams } from "../../common/types"; +import { Readable } from "stream"; export default defineAction({ name: "Convert to PDF", - description: `Convert Office Word Documents (docx) to PDF [See docs here](${DOCS.convertToPDF})`, + description: `Convert Office Word Documents (docx) to PDF [See the documentation](${DOCS.convertToPDF})`, key: "cloudmersive-convert-to-pdf", - version: "0.0.1", + version: "1.0.0", type: "action", props: { cloudmersive, - filePath: { + file: { type: "string", - label: "File Path", - description: - `Path to the input .docx file, such as \`/tmp/file.docx\`. [See the docs on working with files](${DOCS.pdFilesTutorial})`, + label: "File Path Or Url", + description: "Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/file.docx`)", + }, + }, + methods: { + streamToBuffer(stream: Readable): Promise { + return new Promise((resolve, reject) => { + const chunks: Buffer[] = []; + stream.on("data", (chunk) => chunks.push(chunk)); + stream.on("end", () => resolve(Buffer.concat(chunks))); + stream.on("error", reject); + }); }, }, async run({ $ }) { - const { filePath } = this; - let file: Buffer; + const { file } = this; + let fileBuffer: Buffer; + try { - file = await fs.promises.readFile(filePath); + const stream = await getFileStream(file); + fileBuffer = await this.streamToBuffer(stream); } catch (err) { throw new ConfigurationError( `**Error when reading file** - check the file path and try again. ${err}`, ); } + const params: ConvertToPDFParams = { $, - file, + file: fileBuffer, }; const response = await this.cloudmersive.convertToPDF(params); - $.export("$summary", `Converted file "${filePath}"`); + $.export("$summary", `Converted file "${file}"`); return response; }, diff --git a/components/cloudmersive/package.json b/components/cloudmersive/package.json index 84dd84c77e62f..a584a9ae2da31 100644 --- a/components/cloudmersive/package.json +++ b/components/cloudmersive/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/cloudmersive", - "version": "0.0.2", + "version": "1.0.0", "description": "Pipedream Cloudmersive Components", "main": "dist/app/cloudmersive.app.mjs", "keywords": [ @@ -16,7 +16,7 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^1.2.1", + "@pipedream/platform": "^3.1.0", "@pipedream/types": "^0.1.4", "form-data": "^4.0.0" } diff --git a/components/convertapi/actions/convert-file/convert-file.mjs b/components/convertapi/actions/convert-file/convert-file.mjs index c04afdf7250a1..aef80dd86a2a5 100644 --- a/components/convertapi/actions/convert-file/convert-file.mjs +++ b/components/convertapi/actions/convert-file/convert-file.mjs @@ -1,22 +1,20 @@ import FormData from "form-data"; -import fs from "fs"; -import { - checkTmp, saveFile, -} from "../../common/utils.mjs"; +import { getFileStreamAndMetadata } from "@pipedream/platform"; +import { saveFile } from "../../common/utils.mjs"; import convertapi from "../../convertapi.app.mjs"; export default { key: "convertapi-convert-file", name: "Convert File", description: "Use this action to convert files to the chosen format. [See the documentation](https://v2.convertapi.com/info/openapi)", - version: "0.0.1", + version: "1.0.0", type: "action", props: { convertapi, file: { type: "string", - label: "File", - description: "The path to the 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)", + label: "File Path Or Url", + description: "Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/file.docx`).", }, formatFrom: { propDefinition: [ @@ -53,9 +51,15 @@ export default { }, async run({ $ }) { try { - const file = fs.createReadStream(checkTmp(this.file)); + const { + stream, metadata, + } = await getFileStreamAndMetadata(this.file); const data = new FormData(); - data.append("File", file); + data.append("File", stream, { + filename: metadata.name, + contentType: metadata.contentType, + knownLength: metadata.size, + }); const { Files } = await this.convertapi.convertFileToFormat({ $, diff --git a/components/convertapi/package.json b/components/convertapi/package.json index 336a1040856e5..9f100a3fc8a3a 100644 --- a/components/convertapi/package.json +++ b/components/convertapi/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/convertapi", - "version": "0.1.0", + "version": "1.0.0", "description": "Pipedream ConvertAPI Components", "main": "convertapi.app.mjs", "keywords": [ @@ -13,7 +13,7 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^3.0.3", + "@pipedream/platform": "^3.1.0", "form-data": "^4.0.2", "fs": "^0.0.1-security" } diff --git a/components/crowdin/actions/add-file/add-file.mjs b/components/crowdin/actions/add-file/add-file.mjs index b5e7703dc6cd0..cbd3fe2bdba31 100644 --- a/components/crowdin/actions/add-file/add-file.mjs +++ b/components/crowdin/actions/add-file/add-file.mjs @@ -1,16 +1,13 @@ -import fs from "fs"; import { TYPE_OPTIONS } from "../../common/constants.mjs"; -import { - checkTmp, - parseObject, -} from "../../common/utils.mjs"; +import { parseObject } from "../../common/utils.mjs"; import crowdin from "../../crowdin.app.mjs"; +import { getFileStreamAndMetadata } from "@pipedream/platform"; export default { key: "crowdin-add-file", name: "Add File to Project", description: "Adds a file into the created project. [See the documentation](https://developer.crowdin.com/api/v2/#tag/source-files/operation/api.projects.files.post)", - version: "0.0.1", + version: "1.0.0", type: "action", props: { crowdin, @@ -22,8 +19,8 @@ export default { }, file: { type: "string", - label: "File", - description: "The path to the file saved to the `/tmp` directory (e.g. `/tmp/example.jpg`) to process. [See the documentation](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory).", + label: "File Path Or Url", + description: "Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/example.jpg`)", }, name: { type: "string", @@ -83,6 +80,16 @@ export default { ], }, }, + methods: { + streamToBuffer(stream) { + return new Promise((resolve, reject) => { + const chunks = []; + stream.on("data", (chunk) => chunks.push(chunk)); + stream.on("end", () => resolve(Buffer.concat(chunks))); + stream.on("error", reject); + }); + }, + }, async run({ $ }) { const { crowdin, @@ -92,7 +99,11 @@ export default { ...data } = this; - const fileBinary = fs.readFileSync(checkTmp(file)); + const { + stream, metadata, + } = await getFileStreamAndMetadata(file); + const fileBinary = await this.streamToBuffer(stream); + const crowdinFilename = file.startsWith("/tmp/") ? file.slice(5) : file; @@ -101,7 +112,7 @@ export default { data: Buffer.from(fileBinary, "binary"), headers: { "Crowdin-API-FileName": encodeURI(crowdinFilename), - "Content-Type": "application/octet-stream", + "Content-Type": metadata.contentType || "application/octet-stream", }, }); diff --git a/components/crowdin/package.json b/components/crowdin/package.json index 2b917337bf538..9153cd716faf4 100644 --- a/components/crowdin/package.json +++ b/components/crowdin/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/crowdin", - "version": "0.1.0", + "version": "1.0.0", "description": "Pipedream Crowdin Components", "main": "crowdin.app.mjs", "keywords": [ @@ -13,7 +13,7 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^3.0.3", + "@pipedream/platform": "^3.1.0", "fs": "^0.0.1-security" } } diff --git a/components/deepgram/actions/transcribe-audio/transcribe-audio.mjs b/components/deepgram/actions/transcribe-audio/transcribe-audio.mjs index 29ab7f9b11199..76a7c8f810100 100644 --- a/components/deepgram/actions/transcribe-audio/transcribe-audio.mjs +++ b/components/deepgram/actions/transcribe-audio/transcribe-audio.mjs @@ -1,26 +1,18 @@ import deepgram from "../../deepgram.app.mjs"; -import { ConfigurationError } from "@pipedream/platform"; -import fs from "fs"; +import { getFileStreamAndMetadata } from "@pipedream/platform"; export default { key: "deepgram-transcribe-audio", name: "Transcribe Audio", description: "Transcribes the specified audio file. [See the documentation](https://developers.deepgram.com/api-reference/transcription/#transcribe-pre-recorded-audio)", - version: "0.0.4", + version: "1.0.0", type: "action", props: { deepgram, - url: { + file: { type: "string", - label: "URL", - description: "URL of audio file to transcribe", - optional: true, - }, - filePath: { - type: "string", - label: "File Path", - description: "The path to the file saved to the `/tmp` directory (e.g. `/tmp/example.mp3`). [See the documentation](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory).", - optional: true, + label: "File Path Or Url", + description: "Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/example.mp3`)", }, tier: { propDefinition: [ @@ -158,7 +150,7 @@ export default { utterances: { type: "boolean", label: "Utterances", - description: "Indicates whether Deepgram will segment speech into meaningful semantic units, which allows the model to interact more naturally and effectively with speakers’ spontaneous speech patterns", + description: "Indicates whether Deepgram will segment speech into meaningful semantic units, which allows the model to interact more naturally and effectively with speakers' spontaneous speech patterns", optional: true, }, uttSplit: { @@ -180,12 +172,18 @@ export default { optional: true, }, }, + methods: { + streamToBuffer(stream) { + return new Promise((resolve, reject) => { + const chunks = []; + stream.on("data", (chunk) => chunks.push(chunk)); + stream.on("end", () => resolve(Buffer.concat(chunks))); + stream.on("error", reject); + }); + }, + }, async run({ $ }) { - if (!this.url && !this.filePath) { - throw new ConfigurationError("Either URL or File Path must be provided."); - } - - let callback = this.callback; + let callback = this.callback; if (this.callbackWithSuspend) { ({ resume_url: callback } = $.flow.suspend()); } @@ -223,17 +221,20 @@ export default { $, }; - if (this.url) { + // Check if the file is a URL + if (this.file.startsWith("http://") || this.file.startsWith("https://")) { config.data = { - url: this.url, + url: this.file, }; - } - if (this.filePath) { - config.data = fs.readFileSync(this.filePath.includes("tmp/") - ? this.filePath - : `/tmp/${this.filePath}`); + } else { + const { + stream, + metadata, + } = await getFileStreamAndMetadata(this.file); + const fileBuffer = await this.streamToBuffer(stream); + config.data = fileBuffer; config.headers = { - "Content-Type": "application/octet-stream", + "Content-Type": metadata.contentType || "application/octet-stream", }; } diff --git a/components/deepgram/package.json b/components/deepgram/package.json index 839212b942eff..4bafb2ea7b51d 100644 --- a/components/deepgram/package.json +++ b/components/deepgram/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/deepgram", - "version": "0.0.7", + "version": "1.0.0", "description": "Pipedream Deepgram Components", "main": "deepgram.app.mjs", "keywords": [ @@ -13,6 +13,6 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^1.5.1" + "@pipedream/platform": "^3.1.0" } } diff --git a/components/deepimage/actions/auto-enhance/auto-enhance.mjs b/components/deepimage/actions/auto-enhance/auto-enhance.mjs index 22f933424d039..e4a1da8d58031 100644 --- a/components/deepimage/actions/auto-enhance/auto-enhance.mjs +++ b/components/deepimage/actions/auto-enhance/auto-enhance.mjs @@ -5,7 +5,7 @@ export default { key: "deepimage-auto-enhance", name: "Auto Enhance Image", description: "Improves the provided image. [See the documentation](https://documentation.deep-image.ai/image-processing/auto-enhance)", - version: "0.0.1", + version: "1.0.0", type: "action", props: { deepimage, @@ -19,7 +19,7 @@ export default { async run({ $ }) { const response = await this.deepimage.makeRequest({ data: { - url: getUrlOrFile(this.image), + url: await getUrlOrFile(this.image), preset: "auto_enhance", }, }); diff --git a/components/deepimage/actions/remove-background/remove-background.mjs b/components/deepimage/actions/remove-background/remove-background.mjs index 4fff3c45ced44..3ef167dc8881e 100644 --- a/components/deepimage/actions/remove-background/remove-background.mjs +++ b/components/deepimage/actions/remove-background/remove-background.mjs @@ -8,7 +8,7 @@ export default { key: "deepimage-remove-background", name: "Remove Background", description: "Removes the background from the provided image using DeepImage. [See the documentation](https://documentation.deep-image.ai/image-processing/background-processing)", - version: "0.0.1", + version: "1.0.0", type: "action", props: { deepimage, @@ -36,7 +36,7 @@ export default { const response = await this.deepimage.makeRequest({ $, data: { - url: getUrlOrFile(this.image), + url: await getUrlOrFile(this.image), background: { remove: "auto", color: this.backgroundColor, diff --git a/components/deepimage/actions/upscale/upscale.mjs b/components/deepimage/actions/upscale/upscale.mjs index 8043b35473bdd..9bc1ae497a4dd 100644 --- a/components/deepimage/actions/upscale/upscale.mjs +++ b/components/deepimage/actions/upscale/upscale.mjs @@ -5,7 +5,7 @@ export default { key: "deepimage-upscale", name: "Upscale Image", description: "Upscales the provided image using Deep Image. [See the documentation](https://documentation.deep-image.ai/image-processing/resize-and-padding)", - version: "0.0.1", + version: "1.0.0", type: "action", props: { deepimage, @@ -31,7 +31,7 @@ export default { const response = await this.deepimage.makeRequest({ $, data: { - url: getUrlOrFile(this.image), + url: await getUrlOrFile(this.image), width: `${this.upscaleMultiplier}%`, height: `${this.upscaleMultiplier}%`, generative_upscale: this.generativeUpscale, diff --git a/components/deepimage/common/utils.mjs b/components/deepimage/common/utils.mjs index bde896bb93a73..98644092ab0b8 100644 --- a/components/deepimage/common/utils.mjs +++ b/components/deepimage/common/utils.mjs @@ -1,4 +1,4 @@ -import fs from "fs"; +import { getFileStream } from "@pipedream/platform"; export const isValidUrl = (urlString) => { var urlPattern = new RegExp("^(https?:\\/\\/)?" + // validate protocol @@ -10,17 +10,22 @@ export const isValidUrl = (urlString) => { return !!urlPattern.test(urlString); }; -export const checkTmp = (filename) => { - if (filename.indexOf("/tmp") === -1) { - return `/tmp/${filename}`; - } - return filename; +export const streamToBase64 = (stream) => { + return new Promise((resolve, reject) => { + const chunks = []; + stream.on("data", (chunk) => chunks.push(chunk)); + stream.on("end", () => { + const buffer = Buffer.concat(chunks); + resolve(buffer.toString("base64")); + }); + stream.on("error", reject); + }); }; -export const getUrlOrFile = (url) => { +export const getUrlOrFile = async (url) => { if (!isValidUrl(url)) { - const data = fs.readFileSync(checkTmp(url)); - const base64Image = Buffer.from(data, "binary").toString("base64"); + const { stream } = await getFileStream(url); + const base64Image = await streamToBase64(stream); return `base64,${base64Image}`; } return url; diff --git a/components/deepimage/deepimage.app.mjs b/components/deepimage/deepimage.app.mjs index 9d68f6fe63f94..1d750c669f39e 100644 --- a/components/deepimage/deepimage.app.mjs +++ b/components/deepimage/deepimage.app.mjs @@ -7,7 +7,7 @@ export default { image: { type: "string", label: "Image", - description: "The URL of the image or the path to the file saved to the `/tmp` directory (e.g. `/tmp/example.jpg`) to process. [See the documentation](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory).", + description: "Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/example.jpg`).", }, }, methods: { diff --git a/components/deepimage/package.json b/components/deepimage/package.json index f22362bab2104..d383c7fb4aaa4 100644 --- a/components/deepimage/package.json +++ b/components/deepimage/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/deepimage", - "version": "0.1.0", + "version": "1.0.0", "description": "Pipedream DeepImage Components", "main": "deepimage.app.mjs", "keywords": [ @@ -13,7 +13,6 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^3.0.3", - "fs": "^0.0.1-security" + "@pipedream/platform": "^3.1.0" } } diff --git a/components/diffchecker/actions/compare-image/compare-image.mjs b/components/diffchecker/actions/compare-image/compare-image.mjs index 6b7ef911f8aec..7e19fb1a68606 100644 --- a/components/diffchecker/actions/compare-image/compare-image.mjs +++ b/components/diffchecker/actions/compare-image/compare-image.mjs @@ -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 diffchecker from "../../diffchecker.app.mjs"; export default { key: "diffchecker-compare-image", name: "Compare Image", description: "Compares two images and returns the result.", - version: "0.0.1", + version: "1.0.0", type: "action", props: { diffchecker, @@ -41,8 +40,8 @@ export default { description += "Provide Data Image URI [Click here for further information](https://en.wikipedia.org/wiki/Data_URI_scheme)."; break; case "form" : - label = "Path"; - description += "Provide the file path `/tmp/file.png`. [See the documentation](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory)."; + label = "(File Path Or Url)"; + description += "Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/example.jpg`)."; break; } @@ -61,16 +60,33 @@ export default { }, async run({ $ }) { let formData = new FormData(); - const leftFilepath = checkTmp(this.leftImage); - const rightFilepath = checkTmp(this.rightImage); const objToSend = { inputType: this.inputType, outputType: "json", }; + + let leftStream; + let rightStream; + switch (this.inputType) { case "form" : - formData.append("left_image", fs.createReadStream(leftFilepath)); - formData.append("right_image", fs.createReadStream(rightFilepath)); + [ + leftStream, + rightStream, + ] = await Promise.all([ + getFileStreamAndMetadata(this.leftImage), + getFileStreamAndMetadata(this.rightImage), + ]); + formData.append("left_image", leftStream.stream, { + contentType: leftStream.metadata.contentType, + knownLength: leftStream.metadata.size, + filename: leftStream.metadata.name, + }); + formData.append("right_image", rightStream.stream, { + contentType: rightStream.metadata.contentType, + knownLength: rightStream.metadata.size, + filename: rightStream.metadata.name, + }); objToSend.data = formData; objToSend.headers = formData.getHeaders(); break; diff --git a/components/diffchecker/actions/compare-pdf/compare-pdf.mjs b/components/diffchecker/actions/compare-pdf/compare-pdf.mjs index b2050f2631875..5ad8ff31b3b3f 100644 --- a/components/diffchecker/actions/compare-pdf/compare-pdf.mjs +++ b/components/diffchecker/actions/compare-pdf/compare-pdf.mjs @@ -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 diffchecker from "../../diffchecker.app.mjs"; export default { key: "diffchecker-compare-pdf", name: "Compare PDFs", description: "Compares two PDFs and returns the result. [See the documentation](https://www.diffchecker.com/public-api/)", - version: "0.0.1", + version: "1.0.0", type: "action", props: { diffchecker, @@ -26,22 +25,35 @@ export default { }, leftPdf: { type: "string", - label: "Left PDF", - description: "Left PDF file you want to compare. Provide the file path `/tmp/file.pdf`. [See the documentation](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory).", + label: "Left PDF (File Path Or Url)", + description: "Left PDF file you want to compare. Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/example.pdf`).", }, rightPdf: { type: "string", - label: "Right PDF", - description: "Right PDF file you want to compare. Provide the file path `/tmp/file.pdf`. [See the documentation](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory).", + label: "Right PDF (File Path Or Url)", + description: "Right PDF file you want to compare. Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/example.pdf`).", }, }, async run({ $ }) { let data = new FormData(); - const leftFilepath = checkTmp(this.leftPdf); - const rightFilepath = checkTmp(this.rightPdf); + const [ + leftStream, + rightStream, + ] = await Promise.all([ + getFileStreamAndMetadata(this.leftPdf), + getFileStreamAndMetadata(this.rightPdf), + ]); - data.append("left_pdf", fs.createReadStream(leftFilepath)); - data.append("right_pdf", fs.createReadStream(rightFilepath)); + data.append("left_pdf", leftStream.stream, { + contentType: leftStream.metadata.contentType, + knownLength: leftStream.metadata.size, + filename: leftStream.metadata.name, + }); + data.append("right_pdf", rightStream.stream, { + contentType: rightStream.metadata.contentType, + knownLength: rightStream.metadata.size, + filename: rightStream.metadata.name, + }); const response = await this.diffchecker.comparePdfs({ data, diff --git a/components/diffchecker/actions/compare-text/compare-text.mjs b/components/diffchecker/actions/compare-text/compare-text.mjs index 60c5c48a8e5fb..0a431cabdee3c 100644 --- a/components/diffchecker/actions/compare-text/compare-text.mjs +++ b/components/diffchecker/actions/compare-text/compare-text.mjs @@ -4,7 +4,7 @@ export default { key: "diffchecker-compare-text", name: "Compare Text", description: "Compares two pieces of text and returns the result. [See the documentation](https://www.diffchecker.com/public-api/)", - version: "0.0.1", + version: "1.0.0", type: "action", props: { diffchecker, diff --git a/components/diffchecker/diffchecker.app.mjs b/components/diffchecker/diffchecker.app.mjs index d5a2f6e898f8e..29837f471dd4f 100644 --- a/components/diffchecker/diffchecker.app.mjs +++ b/components/diffchecker/diffchecker.app.mjs @@ -1,4 +1,4 @@ -import axios from "axios"; +import { axios } from "@pipedream/platform"; export default { type: "app", @@ -41,7 +41,7 @@ export default { }; }, async _makeRequest({ - path, form = false, params, headers, ...args + $ = this, path, form = false, params, headers, ...args }) { const config = { url: this._baseUrl() + path, @@ -55,8 +55,7 @@ export default { config.params = this._getParams(params); } - const { data } = await axios(config); - return data; + return axios($, config); }, async compareText(args = {}) { return this._makeRequest({ diff --git a/components/diffchecker/package.json b/components/diffchecker/package.json index 1f3da2ab7d9c2..2d9677fc10797 100644 --- a/components/diffchecker/package.json +++ b/components/diffchecker/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/diffchecker", - "version": "0.1.0", + "version": "1.0.0", "description": "Pipedream Diffchecker Components", "main": "diffchecker.app.mjs", "keywords": [ @@ -13,7 +13,7 @@ "access": "public" }, "dependencies": { - "axios": "^1.6.1", + "@pipedream/platform": "^3.1.0", "form-data": "^4.0.0", "fs": "^0.0.1-security" } diff --git a/components/digitalocean_spaces/actions/delete-files/delete-files.mjs b/components/digitalocean_spaces/actions/delete-files/delete-files.mjs index 0f43d05bb6433..d25e112da51c8 100644 --- a/components/digitalocean_spaces/actions/delete-files/delete-files.mjs +++ b/components/digitalocean_spaces/actions/delete-files/delete-files.mjs @@ -6,7 +6,7 @@ export default { key: "digitalocean_spaces-delete-files", name: "Delete Files", description: "Delete files in a bucket. [See the docs](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/classes/deleteobjectscommand.html).", - version: "0.0.2", + version: "1.0.0", props: { ...common.props, files: { diff --git a/components/digitalocean_spaces/actions/list-files/list-files.mjs b/components/digitalocean_spaces/actions/list-files/list-files.mjs index a0537ae696d07..7edcf56568238 100644 --- a/components/digitalocean_spaces/actions/list-files/list-files.mjs +++ b/components/digitalocean_spaces/actions/list-files/list-files.mjs @@ -6,7 +6,7 @@ export default { key: "digitalocean_spaces-list-files", name: "List Files", description: "List files in a bucket. [See the docs](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/classes/listobjectsv2command.html).", - version: "0.0.2", + version: "1.0.0", props: { ...common.props, prefix: { diff --git a/components/digitalocean_spaces/actions/upload-file-base64/upload-file-base64.mjs b/components/digitalocean_spaces/actions/upload-file-base64/upload-file-base64.mjs index 826a76c81b70d..d0b28d7744e80 100644 --- a/components/digitalocean_spaces/actions/upload-file-base64/upload-file-base64.mjs +++ b/components/digitalocean_spaces/actions/upload-file-base64/upload-file-base64.mjs @@ -1,5 +1,5 @@ import common from "../../common/common-s3.mjs"; -import base from "@pipedream/aws/actions/s3-upload-file/s3-upload-file.mjs"; +import base from "../../../aws/actions/s3-upload-base64-as-file/s3-upload-base64-as-file.mjs"; export default { ...common, @@ -8,7 +8,7 @@ export default { key: "digitalocean_spaces-upload-file-base64", name: "Upload File Base64", description: "Accepts a base64-encoded string and a filename, then uploads as a file to DigitalOcean Spaces. [See the docs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/upload-objects.html).", - version: "0.0.2", + version: "1.0.0", props: { ...common.props, filename: base.props.filename, diff --git a/components/digitalocean_spaces/actions/upload-file-tmp/upload-file-tmp.mjs b/components/digitalocean_spaces/actions/upload-file-tmp/upload-file-tmp.mjs deleted file mode 100644 index 4510201ca6d8d..0000000000000 --- a/components/digitalocean_spaces/actions/upload-file-tmp/upload-file-tmp.mjs +++ /dev/null @@ -1,57 +0,0 @@ -import fs from "fs"; -import { ConfigurationError } from "@pipedream/platform"; -import base from "@pipedream/aws/actions/s3-upload-file-tmp/s3-upload-file-tmp.mjs"; -import common from "../../common/common-s3.mjs"; - -export default { - ...common, - ...base, - type: "action", - key: "digitalocean_spaces-upload-file-tmp", - name: "Upload File /tmp", - description: "Accepts a file path starting from /tmp, then uploads as a file to DigitalOcean Spaces. [See the docs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/upload-objects.html).", - version: "0.0.2", - props: { - ...common.props, - customFilename: base.props.customFilename, - path: base.props.path, - }, - methods: { - ...base.methods, - async uploadSingleFile($) { - const { - uploadFile, - bucket, - path, - customFilename, - acl, - contentType, - metadata, - } = this; - - if (!path) { - throw new ConfigurationError("File Path is required"); - } - const file = fs.readFileSync(path, { - encoding: "base64", - }); - const filename = customFilename || path.split("/").pop(); - const response = await uploadFile({ - Bucket: bucket, - Key: filename, - Body: Buffer.from(file, "base64"), - ...(acl && { - ACL: acl, - }), - ...(contentType && { - ContentType: contentType, - }), - ...(metadata && { - Metadata: metadata, - }), - }); - $.export("$summary", `Uploaded file ${filename} to S3`); - return response; - }, - }, -}; diff --git a/components/digitalocean_spaces/actions/upload-file-url/upload-file-url.mjs b/components/digitalocean_spaces/actions/upload-file-url/upload-file-url.mjs deleted file mode 100644 index f0eb0a4aaa636..0000000000000 --- a/components/digitalocean_spaces/actions/upload-file-url/upload-file-url.mjs +++ /dev/null @@ -1,55 +0,0 @@ -import fs from "fs"; -import base from "@pipedream/aws/actions/s3-upload-file-url/s3-upload-file-url.mjs"; -import downloadFileToTmp from "@pipedream/helper_functions/actions/download-file-to-tmp/download-file-to-tmp.mjs"; -import common from "../../common/common-s3.mjs"; - -export default { - ...common, - ...base, - type: "action", - key: "digitalocean_spaces-upload-file-url", - name: "Upload File URL", - description: "Accepts a download link and a filename, downloads it, then uploads to DigitalOcean Spaces. [See the docs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/upload-objects.html).", - version: "0.0.2", - props: { - ...common.props, - url: base.props.url, - filename: base.props.filename, - }, - async run({ $ }) { - const { - uploadFile, - bucket, - acl, - contentType, - metadata, - } = this; - - const filedata = await downloadFileToTmp.run.bind(this)({ - $, - }); - - const filename = filedata[0]; - const filepath = filedata[1]; - const file = fs.readFileSync(filepath, { - encoding: "base64", - }); - - const response = await uploadFile({ - Bucket: bucket, - Key: filename, - Body: Buffer.from(file, "base64"), - ...(acl && { - ACL: acl, - }), - ...(contentType && { - ContentType: contentType, - }), - ...(metadata && { - Metadata: metadata, - }), - }); - $.export("$summary", `Uploaded file ${filename} to S3`); - return response; - }, -}; diff --git a/components/digitalocean_spaces/actions/upload-file/upload-file.mjs b/components/digitalocean_spaces/actions/upload-file/upload-file.mjs new file mode 100644 index 0000000000000..6bf268eb5ea3f --- /dev/null +++ b/components/digitalocean_spaces/actions/upload-file/upload-file.mjs @@ -0,0 +1,55 @@ +/* eslint-disable pipedream/props-label, pipedream/props-description */ +import { join } from "path"; +import { getFileStreamAndMetadata } from "@pipedream/platform"; +import base from "../../../aws/actions/s3-upload-files/s3-upload-files.mjs"; +import common from "../../common/common-s3.mjs"; + +export default { + ...common, + ...base, + type: "action", + key: "digitalocean_spaces-upload-file", + name: "Upload File", + description: "Upload a file to DigitalOcean Spaces. Accepts either a file URL or a path to a file in the `/tmp` directory. [See the docs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/upload-objects.html).", + version: "0.0.1", + props: { + ...common.props, + path: { + ...base.props.path, + label: "File Path Or Url", + description: "Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/example.pdf`).", + }, + customFilename: base.props.customFilename, + prefix: { + ...base.props.prefix, + optional: true, + }, + }, + async run({ $ }) { + const { + uploadFile, + bucket, + prefix, + customFilename, + path, + } = this; + + const { + stream, metadata, + } = await getFileStreamAndMetadata(path); + const filename = customFilename || path.split("/").pop(); + + const response = await uploadFile({ + Bucket: bucket, + Key: prefix + ? join(prefix, filename) + : filename, + Body: stream, + ContentType: metadata.contentType, + ContentLength: metadata.size, + }); + + $.export("$summary", `Uploaded file ${filename} to S3`); + return response; + }, +}; diff --git a/components/digitalocean_spaces/common/common-s3.mjs b/components/digitalocean_spaces/common/common-s3.mjs index cdd262d151264..02f29db412771 100644 --- a/components/digitalocean_spaces/common/common-s3.mjs +++ b/components/digitalocean_spaces/common/common-s3.mjs @@ -1,11 +1,11 @@ import app from "../digitalocean_spaces.app.mjs"; -import pipedreamS3 from "@pipedream/aws/common/common-s3.mjs"; +import common from "../../aws/common/common-s3.mjs"; export default { - ...pipedreamS3, + ...common, props: { aws: app, - bucket: pipedreamS3.props.bucket, + bucket: common.props.bucket, acl: { propDefinition: [ app, diff --git a/components/digitalocean_spaces/package.json b/components/digitalocean_spaces/package.json index 26ad550e4c1a7..fd72f2fea0172 100644 --- a/components/digitalocean_spaces/package.json +++ b/components/digitalocean_spaces/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/digitalocean_spaces", - "version": "0.0.4", + "version": "1.0.0", "description": "Pipedream DigitalOcean Spaces Components", "main": "digitalocean_spaces.app.mjs", "keywords": [ @@ -14,9 +14,7 @@ }, "dependencies": { "@aws-sdk/client-s3": "^3.231.0", - "@pipedream/aws": "^0.7.0", - "@pipedream/helper_functions": "^0.3.8", - "@pipedream/platform": "^1.2.1", + "@pipedream/platform": "^3.1.0", "fs": "^0.0.1-security" } } diff --git a/components/digitalocean_spaces/sources/file-deleted/file-deleted.mjs b/components/digitalocean_spaces/sources/file-deleted/file-deleted.mjs index c99c0e0529809..7cecafb3c00ef 100644 --- a/components/digitalocean_spaces/sources/file-deleted/file-deleted.mjs +++ b/components/digitalocean_spaces/sources/file-deleted/file-deleted.mjs @@ -5,7 +5,7 @@ export default { key: "digitalocean_spaces-file-deleted", name: "File Deleted", description: "Emit new event when a file is deleted from a DigitalOcean Spaces bucket", - version: "0.0.2", + version: "1.0.0", type: "source", hooks: { async deploy() { diff --git a/components/digitalocean_spaces/sources/file-uploaded/file-uploaded.mjs b/components/digitalocean_spaces/sources/file-uploaded/file-uploaded.mjs index 73c4a4aa28a1d..fd245e6973e3f 100644 --- a/components/digitalocean_spaces/sources/file-uploaded/file-uploaded.mjs +++ b/components/digitalocean_spaces/sources/file-uploaded/file-uploaded.mjs @@ -5,7 +5,7 @@ export default { key: "digitalocean_spaces-file-uploaded", name: "New File Uploaded", description: "Emit new event when a file is uploaded to a DigitalOcean Spaces bucket", - version: "0.0.2", + version: "1.0.0", type: "source", methods: { ...base.methods, diff --git a/components/discord/actions/send-message-with-file/send-message-with-file.mjs b/components/discord/actions/send-message-with-file/send-message-with-file.mjs index 65f6ce82fac05..e15dc14c9e110 100644 --- a/components/discord/actions/send-message-with-file/send-message-with-file.mjs +++ b/components/discord/actions/send-message-with-file/send-message-with-file.mjs @@ -1,14 +1,12 @@ import common from "../common/common.mjs"; -import { axios } from "@pipedream/platform"; -import fs from "fs"; -import { ConfigurationError } from "@pipedream/platform"; +import { getFileStream } from "@pipedream/platform"; export default { ...common, key: "discord-send-message-with-file", name: "Send Message With File", description: "Post a message with an attached file", - version: "1.1.1", + version: "2.0.0", type: "action", props: { ...common.props, @@ -19,17 +17,10 @@ export default { ], optional: true, }, - fileUrl: { - propDefinition: [ - common.props.discord, - "fileUrl", - ], - }, - filePath: { - propDefinition: [ - common.props.discord, - "filePath", - ], + file: { + type: "string", + label: "File Path Or Url", + description: "Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/example.pdf`)", }, }, async run({ $ }) { @@ -38,29 +29,18 @@ export default { avatarURL, threadID, username, - fileUrl, - filePath, + file, includeSentViaPipedream, suppressNotifications, } = this; - if (!fileUrl && !filePath) { - throw new ConfigurationError("This action requires either File URL or File Path. Please enter one or the other above."); - } - - const file = fileUrl - ? await axios($, { - method: "get", - url: fileUrl, - responseType: "stream", - }) - : fs.createReadStream(filePath); + const { stream } = await getFileStream(file); try { const resp = await this.discord.sendMessage(this.channel, { avatar_url: avatarURL, username, - file, + file: stream, flags: this.getMessageFlags(suppressNotifications), content: includeSentViaPipedream ? this.appendPipedreamText(message ?? "") diff --git a/components/discord/package.json b/components/discord/package.json index 8e8ec3371b708..38a82be71a785 100644 --- a/components/discord/package.json +++ b/components/discord/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/discord", - "version": "1.2.4", + "version": "2.0.0", "description": "Pipedream Discord Components", "main": "discord.app.mjs", "keywords": [ @@ -9,10 +9,10 @@ ], "homepage": "https://pipedream.com/apps/discord", "author": "Pipedream (https://pipedream.com/)", - "dependencies": { - "@pipedream/platform": "^1.4.0" - }, "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.1.0" } } diff --git a/components/discord_bot/actions/add-role/add-role.mjs b/components/discord_bot/actions/add-role/add-role.mjs index db2598dfc26e9..032d51f3a7b56 100644 --- a/components/discord_bot/actions/add-role/add-role.mjs +++ b/components/discord_bot/actions/add-role/add-role.mjs @@ -8,7 +8,7 @@ export default { name: "Add Role", description: "Assign a role to a user. Remember that your bot requires the `MANAGE_ROLES` permission. [See the docs here](https://discord.com/developers/docs/resources/guild#add-guild-member-role)", type: "action", - version: "0.0.12", + version: "1.0.0", props: { ...common.props, userId: { diff --git a/components/discord_bot/actions/change-nickname/change-nickname.mjs b/components/discord_bot/actions/change-nickname/change-nickname.mjs index 39a6786df6bbd..eb7b417818724 100644 --- a/components/discord_bot/actions/change-nickname/change-nickname.mjs +++ b/components/discord_bot/actions/change-nickname/change-nickname.mjs @@ -8,7 +8,7 @@ export default { name: "Change Nickname", description: "Modifies the nickname of the current user in a guild.", type: "action", - version: "0.0.9", + version: "1.0.0", props: { ...common.props, nick: { diff --git a/components/discord_bot/actions/create-channel-invite/create-channel-invite.mjs b/components/discord_bot/actions/create-channel-invite/create-channel-invite.mjs index 854f825ae5e15..6750081945ff1 100644 --- a/components/discord_bot/actions/create-channel-invite/create-channel-invite.mjs +++ b/components/discord_bot/actions/create-channel-invite/create-channel-invite.mjs @@ -7,7 +7,7 @@ export default { name: "Create Channel Invite", description: "Create a new invite for the channel. [See the docs here](https://discord.com/developers/docs/resources/channel#create-channel-invite)", type: "action", - version: "0.0.12", + version: "1.0.0", props: { ...common.props, maxAge: { diff --git a/components/discord_bot/actions/create-guild-channel/create-guild-channel.mjs b/components/discord_bot/actions/create-guild-channel/create-guild-channel.mjs index 2fef98f9065d8..14f93309164ca 100644 --- a/components/discord_bot/actions/create-guild-channel/create-guild-channel.mjs +++ b/components/discord_bot/actions/create-guild-channel/create-guild-channel.mjs @@ -9,7 +9,7 @@ export default { name: "Create Guild Channel", description: "Create a new channel for the guild. [See the docs here](https://discord.com/developers/docs/resources/guild#create-guild-channel)", type: "action", - version: "0.0.14", + version: "1.0.0", props: { ...common.props, name: { diff --git a/components/discord_bot/actions/delete-channel/delete-channel.mjs b/components/discord_bot/actions/delete-channel/delete-channel.mjs index 5a648e3d8b8d3..eb11244cbf8b6 100644 --- a/components/discord_bot/actions/delete-channel/delete-channel.mjs +++ b/components/discord_bot/actions/delete-channel/delete-channel.mjs @@ -6,7 +6,7 @@ export default { name: "Delete Channel", description: "Delete a Channel.", type: "action", - version: "0.0.12", + version: "1.0.0", async run({ $ }) { return this.discord.deleteChannel({ $, diff --git a/components/discord_bot/actions/delete-message/delete-message.mjs b/components/discord_bot/actions/delete-message/delete-message.mjs index 63747def95b98..a6795cc54d564 100644 --- a/components/discord_bot/actions/delete-message/delete-message.mjs +++ b/components/discord_bot/actions/delete-message/delete-message.mjs @@ -8,7 +8,7 @@ export default { name: "Delete message", description: "Delete a message. [See the docs here](https://discord.com/developers/docs/resources/channel#delete-message)", type: "action", - version: "0.0.12", + version: "1.0.0", props: { ...common.props, messageId: { diff --git a/components/discord_bot/actions/find-channel/find-channel.mjs b/components/discord_bot/actions/find-channel/find-channel.mjs index b4b9e65845832..ed31529e7ebfd 100644 --- a/components/discord_bot/actions/find-channel/find-channel.mjs +++ b/components/discord_bot/actions/find-channel/find-channel.mjs @@ -8,7 +8,7 @@ export default { name: "Find Channel", description: "Find an existing channel by name. [See the docs here](https://discord.com/developers/docs/resources/guild#get-guild-channels)", type: "action", - version: "0.0.12", + version: "1.0.0", props: { ...common.props, channelName: { diff --git a/components/discord_bot/actions/find-user/find-user.mjs b/components/discord_bot/actions/find-user/find-user.mjs index 0386ccb6a438f..1309a0cef60b3 100644 --- a/components/discord_bot/actions/find-user/find-user.mjs +++ b/components/discord_bot/actions/find-user/find-user.mjs @@ -6,7 +6,7 @@ export default { name: "Find User", description: "Find an existing user by name. [See the docs here](https://discord.com/developers/docs/resources/guild#search-guild-members)", type: "action", - version: "0.0.13", + version: "1.0.0", props: { ...common.props, query: { diff --git a/components/discord_bot/actions/get-message/get-message.mjs b/components/discord_bot/actions/get-message/get-message.mjs index dd395d6b15025..0869bee705e20 100644 --- a/components/discord_bot/actions/get-message/get-message.mjs +++ b/components/discord_bot/actions/get-message/get-message.mjs @@ -8,7 +8,7 @@ export default { name: "Get message", description: "Return a specific message in a channel. [See the docs here](https://discord.com/developers/docs/resources/channel#get-channel-message)", type: "action", - version: "0.0.12", + version: "1.0.0", props: { ...common.props, messageId: { diff --git a/components/discord_bot/actions/list-channel-invites/list-channel-invites.mjs b/components/discord_bot/actions/list-channel-invites/list-channel-invites.mjs index 49f3f3d9e5edb..016598b99031e 100644 --- a/components/discord_bot/actions/list-channel-invites/list-channel-invites.mjs +++ b/components/discord_bot/actions/list-channel-invites/list-channel-invites.mjs @@ -9,7 +9,7 @@ export default { name: "List Channel Invites", description: "Return a list of invitees for the channel. Only usable for guild channels.", type: "action", - version: "0.0.12", + version: "1.0.0", props: { ...common.props, channelId: { diff --git a/components/discord_bot/actions/list-channel-messages/list-channel-messages.mjs b/components/discord_bot/actions/list-channel-messages/list-channel-messages.mjs index 8f51b7df92889..94e2a0d0e3464 100644 --- a/components/discord_bot/actions/list-channel-messages/list-channel-messages.mjs +++ b/components/discord_bot/actions/list-channel-messages/list-channel-messages.mjs @@ -10,7 +10,7 @@ export default { name: "List Channel Messages", description: "Return the messages for a channel. [See the docs here](https://discord.com/developers/docs/resources/channel#get-channel-messages)", type: "action", - version: "0.0.13", + version: "1.0.0", props: { ...common.props, max: { diff --git a/components/discord_bot/actions/list-channels/list-channels.mjs b/components/discord_bot/actions/list-channels/list-channels.mjs index 33d3082313172..bffa63b1079dc 100644 --- a/components/discord_bot/actions/list-channels/list-channels.mjs +++ b/components/discord_bot/actions/list-channels/list-channels.mjs @@ -6,7 +6,7 @@ export default { name: "List Channels", description: "Return a list of channels. [See the docs here](https://discord.com/developers/docs/resources/guild#get-guild-channels)", type: "action", - version: "0.0.12", + version: "1.0.0", async run({ $ }) { return this.discord.getGuildChannels({ $, diff --git a/components/discord_bot/actions/list-guild-members/list-guild-members.mjs b/components/discord_bot/actions/list-guild-members/list-guild-members.mjs index ec9ca6d4aa3e1..8f38b0503dd67 100644 --- a/components/discord_bot/actions/list-guild-members/list-guild-members.mjs +++ b/components/discord_bot/actions/list-guild-members/list-guild-members.mjs @@ -11,7 +11,7 @@ export default { name: "List Guild Members", description: "Return a list of guild members. [See the docs here](https://discord.com/developers/docs/resources/guild#list-guild-members)", type: "action", - version: "0.0.13", + version: "1.0.0", props: { discord, guildId: { diff --git a/components/discord_bot/actions/list-users-with-emoji-reactions/list-users-with-emoji-reactions.mjs b/components/discord_bot/actions/list-users-with-emoji-reactions/list-users-with-emoji-reactions.mjs index 940dd4dc033a4..a69a03daeaa4a 100644 --- a/components/discord_bot/actions/list-users-with-emoji-reactions/list-users-with-emoji-reactions.mjs +++ b/components/discord_bot/actions/list-users-with-emoji-reactions/list-users-with-emoji-reactions.mjs @@ -11,7 +11,7 @@ export default { name: "List Users that Reacted with Emoji", description: "Return a list of users that reacted with a specified emoji.", type: "action", - version: "0.0.13", + version: "1.0.0", props: { ...common.props, messageId: { diff --git a/components/discord_bot/actions/modify-channel/modify-channel.mjs b/components/discord_bot/actions/modify-channel/modify-channel.mjs index 513a7330dcffd..3561fb8fbdda4 100644 --- a/components/discord_bot/actions/modify-channel/modify-channel.mjs +++ b/components/discord_bot/actions/modify-channel/modify-channel.mjs @@ -18,7 +18,7 @@ export default { name: "Modify Channel", description: "Update a channel's settings. [See the docs here](https://discord.com/developers/docs/resources/channel#modify-channel)", type: "action", - version: "0.0.14", + version: "1.0.0", props: { ...common.props, channelId: { diff --git a/components/discord_bot/actions/modify-guild-member/modify-guild-member.mjs b/components/discord_bot/actions/modify-guild-member/modify-guild-member.mjs index 26beb8b8cc8d1..ef8b41fd2368b 100644 --- a/components/discord_bot/actions/modify-guild-member/modify-guild-member.mjs +++ b/components/discord_bot/actions/modify-guild-member/modify-guild-member.mjs @@ -19,7 +19,7 @@ export default { name: "Modify Guild Member", description: "Update attributes of a guild member. [See the docs here](https://discord.com/developers/docs/resources/guild#modify-guild-member)", type: "action", - version: "0.0.10", + version: "1.0.0", props: { ...common.props, userId: { diff --git a/components/discord_bot/actions/post-reaction-with-emoji/post-reaction-with-emoji.mjs b/components/discord_bot/actions/post-reaction-with-emoji/post-reaction-with-emoji.mjs index 348cf0adc6279..7cb443bece27f 100644 --- a/components/discord_bot/actions/post-reaction-with-emoji/post-reaction-with-emoji.mjs +++ b/components/discord_bot/actions/post-reaction-with-emoji/post-reaction-with-emoji.mjs @@ -8,7 +8,7 @@ export default { name: "Post Reaction with Emoji", description: "Post a reaction for a message with an emoji. [See the docs here](https://discord.com/developers/docs/resources/channel#create-reaction)", type: "action", - version: "0.0.12", + version: "1.0.0", props: { ...common.props, messageId: { diff --git a/components/discord_bot/actions/remove-user-role/remove-user-role.mjs b/components/discord_bot/actions/remove-user-role/remove-user-role.mjs index 3e9fb216e441a..1e94f88fa216c 100644 --- a/components/discord_bot/actions/remove-user-role/remove-user-role.mjs +++ b/components/discord_bot/actions/remove-user-role/remove-user-role.mjs @@ -8,7 +8,7 @@ export default { name: "Remove User Role", description: "Remove a selected role from the specified user. [See the docs here](https://discord.com/developers/docs/resources/guild#remove-guild-member-role)", type: "action", - version: "0.0.12", + version: "1.0.0", props: { ...common.props, userId: { diff --git a/components/discord_bot/actions/rename-channel/rename-channel.mjs b/components/discord_bot/actions/rename-channel/rename-channel.mjs index 784a33f2a2ba3..80d5c99875887 100644 --- a/components/discord_bot/actions/rename-channel/rename-channel.mjs +++ b/components/discord_bot/actions/rename-channel/rename-channel.mjs @@ -8,7 +8,7 @@ export default { name: "Rename Channel", description: "Rename a channel to a specified name you choose", type: "action", - version: "0.0.13", + version: "1.0.0", props: { ...common.props, channelId: { diff --git a/components/discord_bot/actions/send-message-to-forum-post/send-message-to-forum-post.mjs b/components/discord_bot/actions/send-message-to-forum-post/send-message-to-forum-post.mjs index 896f4a51adfcf..dc4fecfe89b25 100644 --- a/components/discord_bot/actions/send-message-to-forum-post/send-message-to-forum-post.mjs +++ b/components/discord_bot/actions/send-message-to-forum-post/send-message-to-forum-post.mjs @@ -5,7 +5,7 @@ export default { key: "discord_bot-send-message-to-forum-post", name: "Send Message to Forum Post", description: "Send a message to a Discord forum. [See the documentation](https://discord.com/developers/docs/resources/channel#create-message)", - version: "0.0.1", + version: "1.0.0", type: "action", props: { discord, diff --git a/components/discord_bot/actions/send-message-with-file/send-message-with-file.mjs b/components/discord_bot/actions/send-message-with-file/send-message-with-file.mjs index 5fc963eb8a121..5439d4d7c2630 100644 --- a/components/discord_bot/actions/send-message-with-file/send-message-with-file.mjs +++ b/components/discord_bot/actions/send-message-with-file/send-message-with-file.mjs @@ -9,15 +9,15 @@ export default { key: "discord_bot-send-message-with-file", name: "Send Message With File", description: "Post a message with an attached file. [See the docs here](https://discord.com/developers/docs/reference#uploading-files)", - version: "0.0.6", + version: "1.0.0", type: "action", props: { discord, ...common.props, - filePath: { + file: { type: "string", - label: "File Path", - description: "The path to the image file saved to the `/tmp` directory (e.g. `/tmp/image.png`). [see docs here](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory).", + label: "File Path Or Url", + description: "Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/example.pdf`)", }, message: { propDefinition: [ @@ -116,7 +116,7 @@ export default { channelId: channelId, threadID: this.threadID, username: this.username, - filePath: this.filePath, + file: this.file, embeds: utils.parseObject(this.embeds), avatarURL: this.avatarURL, content: this.includeSentViaPipedream diff --git a/components/discord_bot/actions/send-message/send-message.mjs b/components/discord_bot/actions/send-message/send-message.mjs index 52b0e5fb7a0fc..b9bae021fb437 100644 --- a/components/discord_bot/actions/send-message/send-message.mjs +++ b/components/discord_bot/actions/send-message/send-message.mjs @@ -9,7 +9,7 @@ export default { key: "discord_bot-send-message", name: "Send message", description: "Send message to a user or a channel. [See the docs here](https://discord.com/developers/docs/resources/user#create-dm) and [here](https://discord.com/developers/docs/resources/channel#create-message)", - version: "0.0.12", + version: "1.0.0", type: "action", props: { discord, diff --git a/components/discord_bot/discord_bot.app.mjs b/components/discord_bot/discord_bot.app.mjs index 4fb78a0d8a2bc..23581db25e1d3 100644 --- a/components/discord_bot/discord_bot.app.mjs +++ b/components/discord_bot/discord_bot.app.mjs @@ -1,8 +1,8 @@ import { axios, ConfigurationError, + getFileStreamAndMetadata, } from "@pipedream/platform"; import FormData from "form-data"; -import fs from "fs"; import utils from "./common/utils.mjs"; export default { @@ -648,10 +648,12 @@ export default { }); }, async sendMessageWithFile({ - $, content, username, threadID, filePath, channelId, embeds, avatarURL, + $, content, username, threadID, file, channelId, embeds, avatarURL, }) { - const file = fs.createReadStream(filePath); - const filename = filePath.split("/").pop(); + const { + stream, + metadata, + } = await getFileStreamAndMetadata(file); const data = new FormData(); data.append("payload_json", JSON.stringify({ content, @@ -662,13 +664,13 @@ export default { attachments: [ { id: 0, - filename, + filename: metadata.name, }, ], })); - data.append("files[0]", file, { + data.append("files[0]", stream, { header: [ - `Content-Disposition: form-data; name="files[0]"; filename="${filename}"`, + `Content-Disposition: form-data; name="files[0]"; filename="${metadata.name}"`, ], }); return await this._makeRequest({ diff --git a/components/discord_bot/package.json b/components/discord_bot/package.json index 4784042ffdc43..ba31eedc0a16c 100644 --- a/components/discord_bot/package.json +++ b/components/discord_bot/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/discord_bot", - "version": "0.6.1", + "version": "1.0.0", "description": "Pipedream Discord_bot Components", "main": "discord_bot.app.mjs", "keywords": [ @@ -10,7 +10,7 @@ "homepage": "https://pipedream.com/apps/discord_bot", "author": "Pipedream (https://pipedream.com/)", "dependencies": { - "@pipedream/platform": "^3.0.3", + "@pipedream/platform": "^3.1.0", "form-data": "^4.0.0", "lodash.maxby": "^4.6.0" }, diff --git a/components/discord_bot/sources/new-forum-thread-message/new-forum-thread-message.mjs b/components/discord_bot/sources/new-forum-thread-message/new-forum-thread-message.mjs index 5466e5abfe46d..0af2d192e054c 100644 --- a/components/discord_bot/sources/new-forum-thread-message/new-forum-thread-message.mjs +++ b/components/discord_bot/sources/new-forum-thread-message/new-forum-thread-message.mjs @@ -10,7 +10,7 @@ export default { name: "New Forum Thread Message", description: "Emit new event for each forum thread message posted. Note that your bot must have the `MESSAGE_CONTENT` privilege intent to see the message content. [See the documentation](https://discord.com/developers/docs/topics/gateway#message-content-intent).", type: "source", - version: "0.0.4", + version: "1.0.0", dedupe: "unique", // Dedupe events based on the Discord message ID props: { ...common.props, diff --git a/components/discord_bot/sources/new-guild-member/new-guild-member.mjs b/components/discord_bot/sources/new-guild-member/new-guild-member.mjs index 5e94fd29b1ec3..7c914c6b4e3b7 100644 --- a/components/discord_bot/sources/new-guild-member/new-guild-member.mjs +++ b/components/discord_bot/sources/new-guild-member/new-guild-member.mjs @@ -8,7 +8,7 @@ export default { description: "Emit new event for every member added to a guild. [See docs here](https://discord.com/developers/docs/resources/guild#list-guild-members)", type: "source", dedupe: "unique", - version: "0.1.4", + version: "1.0.0", props: { ...common.props, db: "$.service.db", diff --git a/components/discord_bot/sources/new-message-in-channel/new-message-in-channel.mjs b/components/discord_bot/sources/new-message-in-channel/new-message-in-channel.mjs index ffa263725d0a9..c321972e5e92d 100644 --- a/components/discord_bot/sources/new-message-in-channel/new-message-in-channel.mjs +++ b/components/discord_bot/sources/new-message-in-channel/new-message-in-channel.mjs @@ -11,7 +11,7 @@ export default { name: "New Message in Channel", description: "Emit new event for each message posted to one or more channels", type: "source", - version: "0.0.18", + version: "1.0.0", dedupe: "unique", // Dedupe events based on the Discord message ID props: { diff --git a/components/discord_bot/sources/new-tag-added-to-thread/new-tag-added-to-thread.mjs b/components/discord_bot/sources/new-tag-added-to-thread/new-tag-added-to-thread.mjs index cb5b8dc58303f..2692c8be96c55 100644 --- a/components/discord_bot/sources/new-tag-added-to-thread/new-tag-added-to-thread.mjs +++ b/components/discord_bot/sources/new-tag-added-to-thread/new-tag-added-to-thread.mjs @@ -8,7 +8,7 @@ export default { name: "New Tag Added to Forum Thread", description: "Emit new event when a new tag is added to a thread", type: "source", - version: "0.0.1", + version: "1.0.0", dedupe: "unique", props: { ...common.props, diff --git a/components/discord_bot/sources/new-thread-message/new-thread-message.mjs b/components/discord_bot/sources/new-thread-message/new-thread-message.mjs index de5ee3bf09763..d903958502287 100644 --- a/components/discord_bot/sources/new-thread-message/new-thread-message.mjs +++ b/components/discord_bot/sources/new-thread-message/new-thread-message.mjs @@ -9,7 +9,7 @@ export default { name: "New Thread Message", description: "Emit new event for each thread message posted.", type: "source", - version: "0.0.5", + version: "1.0.0", dedupe: "unique", // Dedupe events based on the Discord message ID props: { ...common.props, diff --git a/components/docparser/actions/upload-document/upload-document.mjs b/components/docparser/actions/upload-document/upload-document.mjs index a2e89111b8a4f..1fbe6658b6958 100644 --- a/components/docparser/actions/upload-document/upload-document.mjs +++ b/components/docparser/actions/upload-document/upload-document.mjs @@ -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 docparser from "../../docparser.app.mjs"; export default { key: "docparser-upload-document", name: "Upload Document", description: "Uploads a document to docparser that initiates parsing immediately after reception. [See the documentation](https://docparser.com/api/#import-documents)", - version: "0.0.1", + version: "1.0.0", type: "action", props: { docparser, @@ -19,13 +18,22 @@ export default { }, file: { type: "string", - label: "File", - 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)", + label: "File Path Or Url", + description: "Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/example.pdf`)", }, }, async run({ $ }) { + const { + stream, + metadata, + } = await getFileStreamAndMetadata(this.file); + const data = new FormData(); - data.append("file", fs.createReadStream(checkTmp(this.file))); + data.append("file", stream, { + contentType: metadata.contentType, + knownLength: metadata.size, + filename: metadata.name, + }); const response = await this.docparser.uploadDocument({ $, diff --git a/components/docparser/package.json b/components/docparser/package.json index 919aa94281846..5659416f6c5a2 100644 --- a/components/docparser/package.json +++ b/components/docparser/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/docparser", - "version": "0.1.0", + "version": "1.0.0", "description": "Pipedream docparser Components", "main": "docparser.app.mjs", "keywords": [ @@ -13,6 +13,6 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^3.0.3" + "@pipedream/platform": "^3.1.0" } } diff --git a/components/documentpro/actions/new-document/new-document.mjs b/components/documentpro/actions/new-document/new-document.mjs index 349d3fa25c9af..1dd057574c293 100644 --- a/components/documentpro/actions/new-document/new-document.mjs +++ b/components/documentpro/actions/new-document/new-document.mjs @@ -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 documentpro from "../../documentpro.app.mjs"; export default { key: "documentpro-new-document", name: "Upload New Document", description: "Uploads a document to DocumentPro's parser. [See the documentation](https://docs.documentpro.ai/docs/using-api/manage-documents/import-files)", - version: "0.0.1", + version: "1.0.0", type: "action", props: { documentpro, @@ -18,16 +17,23 @@ export default { ], }, document: { - propDefinition: [ - documentpro, - "document", - ], + type: "string", + label: "File Path Or Url", + description: "Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/example.pdf`)", }, }, async run({ $ }) { + const { + stream, + metadata, + } = await getFileStreamAndMetadata(this.document); + const formData = new FormData(); - const file = fs.createReadStream(checkTmp(this.document)); - formData.append("file", file); + formData.append("file", stream, { + contentType: metadata.contentType, + knownLength: metadata.size, + filename: metadata.name, + }); const response = await this.documentpro.uploadDocument({ parserId: this.parserId, diff --git a/components/documentpro/package.json b/components/documentpro/package.json index 134058103819c..487c21e49dba5 100644 --- a/components/documentpro/package.json +++ b/components/documentpro/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/documentpro", - "version": "0.1.0", + "version": "1.0.0", "description": "Pipedream DocumentPro Components", "main": "documentpro.app.mjs", "keywords": [ @@ -13,7 +13,7 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^3.0.0", + "@pipedream/platform": "^3.1.0", "form-data": "^4.0.0" } } diff --git a/components/dreamstudio/actions/modify-image/modify-image.mjs b/components/dreamstudio/actions/modify-image/modify-image.mjs index b8950493d4261..c125c7f2f11f0 100644 --- a/components/dreamstudio/actions/modify-image/modify-image.mjs +++ b/components/dreamstudio/actions/modify-image/modify-image.mjs @@ -1,7 +1,7 @@ import FormData from "form-data"; -import fs from "node:fs"; +import { getFileStreamAndMetadata } from "@pipedream/platform"; import { - getImagePath, parsePrompts, writeImg, + parsePrompts, writeImg, } from "../../common/utils.mjs"; import common from "../common/images.mjs"; @@ -9,7 +9,7 @@ export default { ...common, key: "dreamstudio-modify-image", name: "Modify Image", - version: "0.0.2", + version: "1.0.0", description: "Modify an image based on a text prompt. [See the documentation](https://platform.stability.ai/docs/api-reference#tag/v1generation/operation/imageToImage)", type: "action", props: { @@ -22,8 +22,8 @@ export default { }, initImage: { type: "string", - label: "Init Image", - description: "Image used to initialize the diffusion process, in lieu of random noise. It can be an URL to the image or a path to the image file saved to the `/tmp` directory (e.g. `/tmp/image.png`). [see docs here](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory).", + label: "Init Image Path Or Url", + description: "Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/example.png`)", }, cfgScale: { propDefinition: [ @@ -136,8 +136,15 @@ export default { i++; } - const imagePath = await getImagePath(initImage); - formData.append("init_image", fs.readFileSync(imagePath)); + const { + stream, + metadata, + } = await getFileStreamAndMetadata(initImage); + formData.append("init_image", stream, { + contentType: metadata.contentType, + knownLength: metadata.size, + filename: metadata.name, + }); initImageMode && formData.append("init_image_mode", initImageMode); cfgScale && formData.append("cfg_scale", cfgScale); clipGuidancePreset && formData.append("clip_guidance_preset", clipGuidancePreset); diff --git a/components/dreamstudio/actions/upscale-image/upscale-image.mjs b/components/dreamstudio/actions/upscale-image/upscale-image.mjs index 55e7b07eeb470..79b1317291550 100644 --- a/components/dreamstudio/actions/upscale-image/upscale-image.mjs +++ b/components/dreamstudio/actions/upscale-image/upscale-image.mjs @@ -1,23 +1,21 @@ import FormData from "form-data"; -import fs from "node:fs"; -import { - getImagePath, writeImg, -} from "../../common/utils.mjs"; +import { getFileStreamAndMetadata } from "@pipedream/platform"; +import { writeImg } from "../../common/utils.mjs"; import common from "../common/images.mjs"; export default { ...common, key: "dreamstudio-upscale-image", name: "Upscale Image", - version: "0.0.2", + version: "1.0.0", description: "Create a higher resolution version of an input image. [See the documentation](https://platform.stability.ai/docs/api-reference#tag/v1generation/operation/upscaleImage)", type: "action", props: { ...common.props, image: { type: "string", - label: "Image", - description: "Image used to upscale. It can be an URL to the image or a path to the image file saved to the `/tmp` directory (e.g. `/tmp/image.png`). [see docs here](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory).", + label: "Image Path Or Url", + description: "Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/example.png`)", }, height: { propDefinition: [ @@ -45,8 +43,15 @@ export default { const formData = new FormData(); - const imagePath = await getImagePath(image); - formData.append("image", fs.readFileSync(imagePath)); + const { + stream, + metadata, + } = await getFileStreamAndMetadata(image); + formData.append("image", stream, { + contentType: metadata.contentType, + knownLength: metadata.size, + filename: metadata.name, + }); for (const [ label, value, diff --git a/components/dreamstudio/package.json b/components/dreamstudio/package.json index 69257469e62c3..0d4852051ff33 100644 --- a/components/dreamstudio/package.json +++ b/components/dreamstudio/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/dreamstudio", - "version": "0.1.1", + "version": "1.0.0", "description": "Pipedream DreamStudio (Stable Diffusion) Components", "main": "dreamstudio.app.mjs", "keywords": [ @@ -13,7 +13,7 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^1.5.1", + "@pipedream/platform": "^3.1.0", "form-data": "^4.0.0", "fs": "^0.0.1-security", "got": "^13.0.0", diff --git a/components/dromo/actions/create-headless-import/create-headless-import.mjs b/components/dromo/actions/create-headless-import/create-headless-import.mjs index 23c068781afd2..449b4acaec562 100644 --- a/components/dromo/actions/create-headless-import/create-headless-import.mjs +++ b/components/dromo/actions/create-headless-import/create-headless-import.mjs @@ -1,11 +1,11 @@ import dromo from "../../dromo.app.mjs"; -import fs from "fs"; +import { getFileStreamAndMetadata } from "@pipedream/platform"; export default { key: "dromo-create-headless-import", name: "Create Headless Import", description: "Creates a new headless import. [See the documentation](https://developer.dromo.io/api/#tag/headless/operation/createHeadlessImport)", - version: "0.0.1", + version: "1.0.0", type: "action", props: { dromo, @@ -18,12 +18,13 @@ export default { originalFilename: { type: "string", label: "Original Filename", - description: "The original filename of the imported file", + description: "The original filename of the imported file. If not provided, the name of the uploaded file will be used.", + optional: true, }, - filePath: { + file: { type: "string", - label: "File Path", - description: "The path to the file saved to the `/tmp` directory (e.g. `/tmp/example.csv`). [See the documentation](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory).", + label: "File Path Or Url", + description: "Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/example.csv`)", }, }, methods: { @@ -39,22 +40,34 @@ export default { }, }, async run({ $ }) { - const response = await this.dromo.createHeadlessImport({ + const { + dromo, + schemaId, + originalFilename, + file, + uploadFile, + } = this; + + const { + stream, + metadata, + } = await getFileStreamAndMetadata(file); + + const response = await dromo.createHeadlessImport({ data: { - schema_id: this.schemaId, - original_filename: this.originalFilename, + schema_id: schemaId, + original_filename: originalFilename || metadata.name, }, $, }); const uploadUrl = response.upload; - const fileBuffer = fs.readFileSync(this.filePath); - await this.uploadFile(uploadUrl, fileBuffer); + await uploadFile(uploadUrl, stream); let importItem; const timer = (ms) => new Promise((res) => setTimeout(res, ms)); do { - importItem = await this.dromo.getHeadlessImport({ + importItem = await dromo.getHeadlessImport({ importId: response.id, $, }); diff --git a/components/dromo/package.json b/components/dromo/package.json index 984e49f4e66a2..8e29b46d9ca28 100644 --- a/components/dromo/package.json +++ b/components/dromo/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/dromo", - "version": "0.1.0", + "version": "1.0.0", "description": "Pipedream Dromo Components", "main": "dromo.app.mjs", "keywords": [ @@ -13,6 +13,6 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^1.5.1" + "@pipedream/platform": "^3.1.0" } } diff --git a/components/eden_ai/actions/translate-document/translate-document.mjs b/components/eden_ai/actions/translate-document/translate-document.mjs index dd22a732959fc..3a2fdc20dd943 100644 --- a/components/eden_ai/actions/translate-document/translate-document.mjs +++ b/components/eden_ai/actions/translate-document/translate-document.mjs @@ -1,7 +1,6 @@ import app from "../../eden_ai.app.mjs"; -import { ConfigurationError } from "@pipedream/platform"; import FormData from "form-data"; -import fs from "fs"; +import { getFileStreamAndMetadata } from "@pipedream/platform"; const options = [ "deepl", @@ -12,7 +11,7 @@ export default { key: "eden_ai-translate-document", name: "Translate Document", description: "Translates a document from a local file or URL. [See the documentation](https://docs.edenai.co/reference/translation_document_translation_create)", - version: "0.0.3", + version: "1.0.0", type: "action", props: { app, @@ -53,23 +52,22 @@ export default { }, file: { type: "string", - label: "File Path", - 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).", - optional: true, - }, - fileUrl: { - type: "string", - label: "File URL", - description: "The URL of the file to translate", - optional: true, + label: "File Path Or Url", + description: "Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/example.pdf`)", }, }, async run({ $ }) { const { - providers, fallbackProviders, showOriginalResponse, sourceLanguage, targetLanguage, file, fileUrl, // eslint-disable-line max-len + app, + providers, + fallbackProviders, + showOriginalResponse, + sourceLanguage, + targetLanguage, + file, } = this; - let headers, data = { + const data = { providers: providers.join(), fallback_providers: fallbackProviders?.join(), show_original_response: showOriginalResponse, @@ -77,39 +75,35 @@ export default { target_language: targetLanguage, }; - if (file) { - const formData = new FormData(); - Object.entries(data).forEach(([ - key, - value, - ]) => { - if (value !== undefined) { - formData.append(key, value); - } - }); + const { + stream, + metadata, + } = await getFileStreamAndMetadata(file); + const formData = new FormData(); - const content = fs.createReadStream(file.includes("tmp/") - ? file - : `/tmp/${file}`); - formData.append("file", content); - headers = { - "Content-Type": `multipart/form-data; boundary=${formData._boundary}`, - }; - data = formData; - } else if (fileUrl) { - data.file_url = fileUrl; - headers = { - "Content-Type": "application/json", - }; - } else { - throw new ConfigurationError("You must provide either a file or a file URL"); - } + Object.entries(data).forEach(([ + key, + value, + ]) => { + if (value !== undefined) { + formData.append(key, value); + } + }); + + formData.append("file", stream, { + contentType: metadata.contentType, + knownLength: metadata.size, + filename: metadata.name, + }); - const response = await this.app.translateText({ + const response = await app.translateText({ $, - data, - headers, + data: formData, + headers: { + "Content-Type": `multipart/form-data; boundary=${formData._boundary}`, + }, }); + $.export("$summary", "Document translated successfully"); return response; }, diff --git a/components/eden_ai/package.json b/components/eden_ai/package.json index 6c651fdd3b876..8983147a744ad 100644 --- a/components/eden_ai/package.json +++ b/components/eden_ai/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/eden_ai", - "version": "0.2.0", + "version": "1.0.0", "description": "Pipedream Eden AI Components", "main": "eden_ai.app.mjs", "keywords": [ @@ -13,7 +13,7 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^1.5.1", + "@pipedream/platform": "^3.1.0", "form-data": "^4.0.0" } } diff --git a/components/ezeep_blue/actions/create-print-job/create-print-job.mjs b/components/ezeep_blue/actions/create-print-job/create-print-job.mjs index bcb197cda774a..905a4d5e21fbd 100644 --- a/components/ezeep_blue/actions/create-print-job/create-print-job.mjs +++ b/components/ezeep_blue/actions/create-print-job/create-print-job.mjs @@ -1,15 +1,13 @@ import FormData from "form-data"; -import fs from "fs"; -import { - checkTmp, clearObj, -} from "../../common/utils.mjs"; +import { clearObj } from "../../common/utils.mjs"; +import { getFileStreamAndMetadata } from "@pipedream/platform"; import ezeepBlue from "../../ezeep_blue.app.mjs"; export default { key: "ezeep_blue-create-print-job", name: "Create Print Job", description: "Send a new print job to a specified printer.", - version: "0.0.1", + version: "1.0.0", type: "action", props: { ezeepBlue, @@ -19,12 +17,10 @@ export default { "printerId", ], }, - printType: { - propDefinition: [ - ezeepBlue, - "printType", - ], - reloadProps: true, + file: { + type: "string", + label: "File Path or URL", + description: "Provide either a file URL or a path to a file in the `/tmp` directory.", }, type: { type: "string", @@ -54,6 +50,18 @@ export default { withLabel: true, optional: true, }, + paperLength: { + type: "string", + label: "Paper Length", + description: "If paperid == 256 (custom size): length of paper in tenths of mm.", + optional: true, + }, + paperWidth: { + type: "string", + label: "Paper Width", + description: "If paperid == 256 (custom size): width of paper in tenths of mm.", + optional: true, + }, color: { type: "boolean", label: "Color", @@ -99,46 +107,15 @@ export default { optional: true, }, }, - async additionalProps() { - switch (this.printType) { - case "url" : return { - fileUrl: { - type: "string", - label: "File URL", - description: "The URL of the file to print", - }, - }; - case "upload": return { - file: { - type: "string", - label: "File Path", - 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).", - }, - paperLength: { - type: "string", - label: "Paper Length", - description: "If paperid == 256 (custom size): length of paper in tenths of mm.", - optional: true, - }, - paperWidth: { - type: "string", - label: "Paper Width", - description: "If paperid == 256 (custom size): width of paper in tenths of mm.", - optional: true, - }, - }; - } - }, async run({ $ }) { const { + ezeepBlue, printerId, - fileUrl, file, - printType, + paperLength, + paperWidth, } = this; - let response; - const data = { type: this.type, alias: this.alias, @@ -154,44 +131,37 @@ export default { copies: this.copies, resolution: this.resolution, }, + paperlength: paperLength, + paperwidth: paperWidth, }; - if (printType === "upload") { - // Prepare file upload - const { - sasUri, fileid, - } = await this.ezeepBlue.prepareFileUpload(); + const { + sasUri, fileid, + } = await ezeepBlue.prepareFileUpload(); - // Upload file - const formData = new FormData(); - formData.append("file", fs.createReadStream(checkTmp(file))); + const { stream } = await getFileStreamAndMetadata(file); + const formData = new FormData(); + formData.append("file", stream); - await this.ezeepBlue.uploadFile({ - url: sasUri, - headers: { - "x-ms-blob-type": "BlockBlob", - "x-ms-blob-content-type": "application/octet-stream", - ...formData.getHeaders(), + await ezeepBlue.uploadFile({ + url: sasUri, + headers: { + "x-ms-blob-type": "BlockBlob", + "x-ms-blob-content-type": "application/octet-stream", + ...formData.getHeaders(), + }, + transformRequest: [ + (reqData, headers) => { + delete headers.common["Transfer-Encoding"]; + return JSON.stringify(reqData); }, - transformRequest: [ - (data, headers) => { - delete headers.common["Transfer-Encoding"]; - return JSON.stringify(data); - }, - ], - data: formData, - }); - - data.fileid = fileid; - data.paperlength = this.paperLength; - data.paperwidth = this.paperWidth; + ], + data: formData, + }); - } else if (printType === "url") { - data.fileurl = fileUrl; - } + data.fileid = fileid; - // Print file from URL - response = await this.ezeepBlue.printFile({ + const response = await ezeepBlue.printFile({ data: clearObj(data), }); diff --git a/components/ezeep_blue/package.json b/components/ezeep_blue/package.json index 3b8933f4c006d..24c5671827073 100644 --- a/components/ezeep_blue/package.json +++ b/components/ezeep_blue/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/ezeep_blue", - "version": "0.1.0", + "version": "1.0.0", "description": "Pipedream ezeep Blue Components", "main": "ezeep_blue.app.mjs", "keywords": [ @@ -13,7 +13,7 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^1.5.1", + "@pipedream/platform": "^3.1.0", "form-data": "^4.0.0" } } diff --git a/components/filestack/actions/upload-image/upload-image.mjs b/components/filestack/actions/upload-image/upload-image.mjs index 93fc6f055150a..e535bd6e8a1c8 100644 --- a/components/filestack/actions/upload-image/upload-image.mjs +++ b/components/filestack/actions/upload-image/upload-image.mjs @@ -1,71 +1,38 @@ +import { getFileStreamAndMetadata } from "@pipedream/platform"; import filestack from "../../filestack.app.mjs"; -import fs from "fs"; export default { key: "filestack-upload-image", name: "Upload Image", description: "Upload an image from a file or URL to FileStack. [See the documentation](https://www.filestack.com/docs/uploads/uploading/#upload-file)", - version: "0.0.1", + version: "1.0.0", type: "action", props: { filestack, - fileOrUrl: { - propDefinition: [ - filestack, - "fileOrUrl", - ], - }, - }, - methods: { - getImageMimeType(path) { - const ext = path.split(".").pop(); - switch (ext) { - case "jpg": - return "jpeg"; - case "jpeg": - case "png": - case "gif": - case "bmp": - case "webp": - case "tiff": - return ext; - case "svg": - return "svg+xml"; - default: - return "*"; - } - }, - async getImageData() { - const { fileOrUrl } = this; - const isUrl = fileOrUrl.startsWith("http"); - return isUrl - ? { - data: { - url: fileOrUrl, - }, - headers: { - "Content-Type": "application/x-www-form-urlencoded", - }, - } - : { - data: fs.createReadStream( - fileOrUrl.includes("tmp/") - ? fileOrUrl - : `/tmp/${fileOrUrl}`, - ), - headers: { - "Content-Type": `image/${this.getImageMimeType(fileOrUrl)}`, - }, - }; + file: { + type: "string", + label: "File Path or URL", + description: "Provide a file URL or a path to a file in the `/tmp` directory.", }, }, async run({ $ }) { - const args = await this.getImageData(); + const { + filestack, + file, + } = this; + + const { + stream, + metadata, + } = await getFileStreamAndMetadata(file); - const response = await this.filestack.uploadImage({ + const response = await filestack.uploadImage({ $, - ...args, + data: stream, + headers: { + "Content-Type": metadata.contentType, + }, }); $.export( diff --git a/components/filestack/package.json b/components/filestack/package.json index fbaf5555193cc..67a668eeffd97 100644 --- a/components/filestack/package.json +++ b/components/filestack/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/filestack", - "version": "0.1.0", + "version": "1.0.0", "description": "Pipedream FileStack Components", "main": "filestack.app.mjs", "keywords": [ @@ -13,6 +13,6 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^1.6.0" + "@pipedream/platform": "^3.1.0" } } diff --git a/components/flipando/actions/run-app/run-app.mjs b/components/flipando/actions/run-app/run-app.mjs index 858953193de2a..aaf595368c385 100644 --- a/components/flipando/actions/run-app/run-app.mjs +++ b/components/flipando/actions/run-app/run-app.mjs @@ -1,12 +1,12 @@ import flipando from "../../flipando.app.mjs"; -import fs from "fs"; +import { getFileStreamAndMetadata } from "@pipedream/platform"; import FormData from "form-data"; export default { key: "flipando-run-app", name: "Run App", description: "Executes a chosen app within Flipando. Returns a 'task_id' to be used in fetching the outcome of this action. [See the documentation]([See the documentation](https://flipandoai.notion.site/Flipando-ai-API-Integration-Guide-6b508cfe1a5d4a249d20b926eac3a1d7#36b02715e5f440c9b21952b668e0e70c))", - version: "0.0.1", + version: "1.0.0", type: "action", props: { flipando, @@ -44,10 +44,10 @@ export default { }; } if (hasDocs) { - props.filePath = { + props.file = { type: "string", - label: "File Path", - description: "The path to a document file in the `/tmp` directory. [See the documentation on working with files](https://pipedream.com/docs/code/nodejs/working-with-files/#the-tmp-directory).", + label: "File Path or URL", + description: "Provide a file URL or path to a document file in the `/tmp` directory.", }; props.fileDescription = { type: "string", @@ -62,19 +62,22 @@ export default { flipando, appId, waitForCompletion, - filePath, + file, fileDescription, ...inputs } = this; let data = new FormData(); data.append("inputs_data", JSON.stringify(inputs)); - if (filePath) { + if (file) { + const { + stream, + metadata, + } = await getFileStreamAndMetadata(file); data.append("file_description", fileDescription); - const path = filePath.includes("tmp/") - ? filePath - : `/tmp/${filePath}`; - data.append("file", fs.createReadStream(path)); + data.append("file", stream, { + filename: metadata.name, + }); } let response = await flipando.executeApp({ diff --git a/components/flipando/package.json b/components/flipando/package.json index b6166e9da373c..429551f5237da 100644 --- a/components/flipando/package.json +++ b/components/flipando/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/flipando", - "version": "0.1.0", + "version": "1.0.0", "description": "Pipedream Flipando Components", "main": "flipando.app.mjs", "keywords": [ @@ -13,7 +13,7 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^1.6.5", + "@pipedream/platform": "^3.1.0", "form-data": "^4.0.0" } } diff --git a/components/formstack_documents/actions/create-document/create-document.mjs b/components/formstack_documents/actions/create-document/create-document.mjs index 0bc68b958968a..21d4d807f9557 100644 --- a/components/formstack_documents/actions/create-document/create-document.mjs +++ b/components/formstack_documents/actions/create-document/create-document.mjs @@ -1,12 +1,13 @@ import formstackDocuments from "../../formstack_documents.app.mjs"; -import fs from "fs"; -import { ConfigurationError } from "@pipedream/platform"; +import { + ConfigurationError, getFileStream, +} from "@pipedream/platform"; export default { key: "formstack_documents-create-document", name: "Create Document", description: "Create a new document. [See documentation](https://www.webmerge.me/developers?page=documents)", - version: "0.0.1", + version: "1.0.0", type: "action", props: { formstackDocuments, @@ -56,32 +57,30 @@ export default { optional: true, }; } else { - props.fileUrl = { + props.file = { type: "string", - label: "File URL", - description: "Public URL to the file", - optional: true, - }; - props.filePath = { - type: "string", - label: "File Path", - description: "File path of a file previously downloaded in Pipedream E.g. (`/tmp/my-file.txt`). [Download a file to the `/tmp` directory](https://pipedream.com/docs/code/nodejs/http-requests/#download-a-file-to-the-tmp-directory)", - optional: true, + label: "File Path or URL", + description: "Provide a file URL or a path to a file in the `/tmp` directory.", }; } return props; }, methods: { - formatFilePath(path) { - if (path.includes("/tmp/")) { - return path; - } - return `/tmp/${path}`; + streamToBase64(stream) { + return new Promise((resolve, reject) => { + const chunks = []; + stream.on("data", (chunk) => chunks.push(chunk)); + stream.on("end", () => { + const buffer = Buffer.concat(chunks); + resolve(buffer.toString("base64")); + }); + stream.on("error", reject); + }); }, }, async run({ $ }) { - if (this.type !== "html" && !this.fileUrl && !this.filePath) { - throw new ConfigurationError("Either File URL or File Path must be provided."); + if (this.type !== "html" && !this.file) { + throw new ConfigurationError("The File field is required for the selected document type."); } const data = { @@ -96,13 +95,10 @@ export default { data.size_width = this.width; data.size_height = this.height; } - if (this.fileUrl) { - data.file_url = this.fileUrl; - } - if (this.filePath) { - data.file_contents = fs.readFileSync(this.formatFilePath(this.filePath), { - encoding: "base64", - }); + + if (this.file) { + const stream = await getFileStream(this.file); + data.file_contents = await this.streamToBase64(stream); } const response = await this.formstackDocuments.createDocument({ diff --git a/components/formstack_documents/package.json b/components/formstack_documents/package.json index 0e8cb8cc6c1ca..cf901b6935543 100644 --- a/components/formstack_documents/package.json +++ b/components/formstack_documents/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/formstack_documents", - "version": "0.1.0", + "version": "1.0.0", "description": "Pipedream Formstack Documents Components", "main": "formstack_documents.app.mjs", "keywords": [ @@ -13,6 +13,6 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^1.5.1" + "@pipedream/platform": "^3.1.0" } } diff --git a/components/generated_photos/actions/generate-similar-faces-by-upload/generate-similar-faces-by-upload.mjs b/components/generated_photos/actions/generate-similar-faces-by-upload/generate-similar-faces-by-upload.mjs index 7b7715e3b53b2..b87833f5ea67d 100644 --- a/components/generated_photos/actions/generate-similar-faces-by-upload/generate-similar-faces-by-upload.mjs +++ b/components/generated_photos/actions/generate-similar-faces-by-upload/generate-similar-faces-by-upload.mjs @@ -1,19 +1,19 @@ import generatedPhotos from "../../generated_photos.app.mjs"; import FormData from "form-data"; -import fs from "fs"; +import { getFileStreamAndMetadata } from "@pipedream/platform"; export default { key: "generated_photos-generate-similar-faces-by-upload", name: "Generate Similar Faces to Uploaded Image", description: "Generates faces similar to an uploaded image with the Generated Photos API. [See the documentation](https://generated.photos/account#apikey)", - version: "0.0.1", + version: "1.0.0", type: "action", props: { generatedPhotos, - filePath: { + file: { type: "string", - label: "File Path", - description: "The path to the image file saved to the `/tmp` directory (e.g. `/tmp/image.png`). [See the documentation](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory).", + label: "File Path or URL", + description: "Provide a file URL or a path to a file in the `/tmp` directory.", }, limit: { propDefinition: [ @@ -23,13 +23,20 @@ export default { }, }, async run({ $ }) { - const filePath = this.filePath.startsWith("/tmp/") - ? this.filePath - : `/tmp/${this.filePath}`; + const { + file, + limit, + } = this; + const { + stream, + metadata, + } = await getFileStreamAndMetadata(file); const formData = new FormData(); - formData.append("image_file", fs.createReadStream(filePath)); - formData.append("per_page", this.limit); + formData.append("image_file", stream, { + filename: metadata.name, + }); + formData.append("per_page", limit); const { faces } = await this.generatedPhotos.generateSimilarFaces({ data: formData, diff --git a/components/generated_photos/package.json b/components/generated_photos/package.json index 626807d402e41..1b558aa6d9088 100644 --- a/components/generated_photos/package.json +++ b/components/generated_photos/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/generated_photos", - "version": "0.0.1", + "version": "1.0.0", "description": "Pipedream Generated_photos Components", "main": "generated_photos.app.mjs", "keywords": [ @@ -13,7 +13,7 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^1.5.1", + "@pipedream/platform": "^3.1.0", "form-data": "^4.0.0" } } diff --git a/components/gladia/actions/send-audio-for-transcription/send-audio-for-transcription.mjs b/components/gladia/actions/send-audio-for-transcription/send-audio-for-transcription.mjs index c42f3b3421b49..a34d9a3720104 100644 --- a/components/gladia/actions/send-audio-for-transcription/send-audio-for-transcription.mjs +++ b/components/gladia/actions/send-audio-for-transcription/send-audio-for-transcription.mjs @@ -1,32 +1,22 @@ -import { ConfigurationError } from "@pipedream/platform"; -import FormData from "form-data"; -import fs from "fs"; import { - camelToSnakeCase, checkTmp, -} from "../../common/utils.mjs"; + ConfigurationError, getFileStreamAndMetadata, +} from "@pipedream/platform"; +import FormData from "form-data"; +import { camelToSnakeCase } from "../../common/utils.mjs"; import gladia from "../../gladia.app.mjs"; export default { key: "gladia-send-audio-for-transcription", name: "Send Audio For Transcription", description: "Sends audio to Gladia for transcription and optional translation. [See the documentation](https://docs.gladia.io/reference/pre-recorded)", - version: "0.0.1", + version: "1.0.0", type: "action", props: { gladia, audio: { - propDefinition: [ - gladia, - "audio", - ], - optional: true, - }, - audioUrl: { - propDefinition: [ - gladia, - "audioUrl", - ], - optional: true, + type: "string", + label: "Audio File or URL", + description: "Provide an audio file URL or a path to a file in the `/tmp` directory.", }, toggleNoiseReduction: { propDefinition: [ @@ -84,8 +74,8 @@ export default { return props; }, async run({ $ }) { - if (!this.audio && !this.audioUrl) { - throw new ConfigurationError("You must provite whether **Audio** or **Audio URL**."); + if (!this.audio) { + throw new ConfigurationError("The Audio File or URL field is required."); } const { @@ -98,10 +88,13 @@ export default { } = this; const formData = new FormData(); - if (audio) { - const filePath = checkTmp(audio); - formData.append("audio", fs.createReadStream(filePath)); - } + const { + stream, + metadata, + } = await getFileStreamAndMetadata(audio); + formData.append("audio", stream, { + filename: metadata.name, + }); formData.append("toggle_noise_reduction", `${toggleNoiseReduction}`); formData.append("toggle_diarization", `${toggleDiarization}`); formData.append("toggle_direct_translate", `${toggleDirectTranslate}`); diff --git a/components/gladia/package.json b/components/gladia/package.json index e6374060761da..64e04eef3ce83 100644 --- a/components/gladia/package.json +++ b/components/gladia/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/gladia", - "version": "0.1.0", + "version": "1.0.0", "description": "Pipedream Gladia Components", "main": "gladia.app.mjs", "keywords": [ @@ -13,9 +13,8 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^1.5.1", + "@pipedream/platform": "^3.1.0", "form-data": "^4.0.0", "fs": "^0.0.1-security" } } - diff --git a/components/google_cloud_vision_api/actions/common/base.mjs b/components/google_cloud_vision_api/actions/common/base.mjs index 84f902ba21e04..3589c10a6e532 100644 --- a/components/google_cloud_vision_api/actions/common/base.mjs +++ b/components/google_cloud_vision_api/actions/common/base.mjs @@ -1,7 +1,8 @@ import googleCloudVision from "../../google_cloud_vision_api.app.mjs"; -import { ConfigurationError } from "@pipedream/platform"; -import { axios } from "@pipedream/platform"; -import fs from "fs"; +import { + ConfigurationError, + getFileStream, +} from "@pipedream/platform"; export default { props: { @@ -12,42 +13,33 @@ export default { "projectId", ], }, - fileUrl: { + file: { type: "string", - label: "File URL", - description: "The URL of the file to be processed.", - optional: true, - }, - filePath: { - type: "string", - label: "File Path", - description: "The path to 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).", - optional: true, + label: "File Path or URL", + description: "Provide a file URL or a path to a file in the `/tmp` directory.", }, }, methods: { checkFileProp() { - if (!this.fileUrl && !this.filePath) { - throw new ConfigurationError("One of File URL or File Path must be provided."); + if (!this.file) { + throw new ConfigurationError("The File field is required."); } }, - async getFileContent($) { - const content = this.filePath - ? await this.getFileFromPath() - : await this.getFileFromUrl($); - return Buffer.from(content).toString("base64"); - }, - getFileFromPath() { - const path = this.filePath.includes("tmp/") - ? this.filePath - : `/tmp/${this.filePath}`; - return fs.readFileSync(path); - }, - getFileFromUrl($) { - return axios($, { - url: this.fileUrl, - responseType: "arraybuffer", + streamToBase64(stream) { + return new Promise((resolve, reject) => { + const chunks = []; + stream.on("data", (chunk) => chunks.push(chunk)); + stream.on("end", () => { + const buffer = Buffer.concat(chunks); + resolve(buffer.toString("base64")); + }); + stream.on("error", reject); }); }, + async getFileContent() { + const stream = await getFileStream(this.file); + return this.streamToBase64(stream); + }, }, }; + diff --git a/components/google_cloud_vision_api/actions/detect-labels-in-image/detect-labels-in-image.mjs b/components/google_cloud_vision_api/actions/detect-labels-in-image/detect-labels-in-image.mjs index ef4ca3d131f05..9112133a4f9e8 100644 --- a/components/google_cloud_vision_api/actions/detect-labels-in-image/detect-labels-in-image.mjs +++ b/components/google_cloud_vision_api/actions/detect-labels-in-image/detect-labels-in-image.mjs @@ -5,7 +5,7 @@ export default { name: "Detect Labels in Image", key: "google_cloud_vision_api-detect-labels-in-image", description: "Performs feature detection on a local or remote image file. [See the documentation](https://cloud.google.com/vision/docs/labels).", - version: "0.0.1", + version: "1.0.0", type: "action", props: { ...common.props, @@ -25,7 +25,7 @@ export default { requests: [ { image: { - content: await this.getFileContent($), + content: await this.getFileContent(), }, features: [ { diff --git a/components/google_cloud_vision_api/actions/detect-logos-in-image/detect-logos-in-image.mjs b/components/google_cloud_vision_api/actions/detect-logos-in-image/detect-logos-in-image.mjs index 6e3b968a0964f..d16f65e203372 100644 --- a/components/google_cloud_vision_api/actions/detect-logos-in-image/detect-logos-in-image.mjs +++ b/components/google_cloud_vision_api/actions/detect-logos-in-image/detect-logos-in-image.mjs @@ -5,7 +5,7 @@ export default { name: "Detect Logos in Image", key: "google_cloud_vision_api-detect-logos-in-image", description: "Detects logos within a local or remote image file. [See the documentation](https://cloud.google.com/vision/docs/detecting-logos).", - version: "0.0.1", + version: "1.0.0", type: "action", async run({ $ }) { this.checkFileProp(); @@ -15,7 +15,7 @@ export default { requests: [ { image: { - content: await this.getFileContent($), + content: await this.getFileContent(), }, features: [ { diff --git a/components/google_cloud_vision_api/actions/detect-text-in-image/detect-text-in-image.mjs b/components/google_cloud_vision_api/actions/detect-text-in-image/detect-text-in-image.mjs index 7b569c1ca5bde..b6ff7088afbbb 100644 --- a/components/google_cloud_vision_api/actions/detect-text-in-image/detect-text-in-image.mjs +++ b/components/google_cloud_vision_api/actions/detect-text-in-image/detect-text-in-image.mjs @@ -5,7 +5,7 @@ export default { name: "Detect Text in Image", key: "google_cloud_vision_api-detect-text-in-image", description: "Detects text in a local image or remote image. [See the documentation](https://cloud.google.com/vision/docs/ocr#vision_text_detection_gcs-drest).", - version: "0.0.1", + version: "1.0.0", type: "action", async run({ $ }) { this.checkFileProp(); @@ -15,7 +15,7 @@ export default { requests: [ { image: { - content: await this.getFileContent($), + content: await this.getFileContent(), }, features: [ { diff --git a/components/google_cloud_vision_api/package.json b/components/google_cloud_vision_api/package.json index 820250a272a6c..a445a0a3c2483 100644 --- a/components/google_cloud_vision_api/package.json +++ b/components/google_cloud_vision_api/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/google_cloud_vision_api", - "version": "0.1.0", + "version": "1.0.0", "description": "Pipedream Google Cloud Vision API Components", "main": "google_cloud_vision_api.app.mjs", "keywords": [ @@ -13,6 +13,6 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^1.6.0" + "@pipedream/platform": "^3.1.0" } } diff --git a/components/google_dialogflow/actions/create-context/create-context.mjs b/components/google_dialogflow/actions/create-context/create-context.mjs index 98f4f5351472d..c1426a9069622 100644 --- a/components/google_dialogflow/actions/create-context/create-context.mjs +++ b/components/google_dialogflow/actions/create-context/create-context.mjs @@ -5,7 +5,7 @@ import { v4 } from "uuid"; export default { type: "action", key: "google_dialogflow-create-context", - version: "0.0.1", + version: "1.0.0", name: "Create Context", description: "Creates a context, [See REST docs](https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.sessions.contexts/create) and [client API](https://googleapis.dev/nodejs/dialogflow/latest/google.cloud.dialogflow.v2beta1.Contexts.html#createContext2)", props: { diff --git a/components/google_dialogflow/actions/create-entities/create-entities.mjs b/components/google_dialogflow/actions/create-entities/create-entities.mjs index abcc63e54f7ea..0de4db9536f49 100644 --- a/components/google_dialogflow/actions/create-entities/create-entities.mjs +++ b/components/google_dialogflow/actions/create-entities/create-entities.mjs @@ -4,7 +4,7 @@ import utils from "../../common/utils.mjs"; export default { type: "action", key: "google_dialogflow-create-entities", - version: "0.0.1", + version: "1.0.0", name: "Create Entities", description: "Batch create entities, [See REST docs](https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.entityTypes.entities/batchCreate) and [client API docs](https://googleapis.dev/nodejs/dialogflow/latest/google.cloud.dialogflow.v2beta1.EntityTypes.html#batchCreateEntities2)", props: { diff --git a/components/google_dialogflow/actions/create-entity-type/create-entity-type.mjs b/components/google_dialogflow/actions/create-entity-type/create-entity-type.mjs index 6fb3dbc0c829b..2129d1aef7c0c 100644 --- a/components/google_dialogflow/actions/create-entity-type/create-entity-type.mjs +++ b/components/google_dialogflow/actions/create-entity-type/create-entity-type.mjs @@ -4,7 +4,7 @@ import utils from "../../common/utils.mjs"; export default { type: "action", key: "google_dialogflow-create-entity-type", - version: "0.0.1", + version: "1.0.0", name: "Create Entity Type", description: "Creates an Entity Type, [See REST docs](https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.entityTypes/create) and [client API docs](https://googleapis.dev/nodejs/dialogflow/latest/google.cloud.dialogflow.v2beta1.EntityTypes.html#createEntityType2)", props: { diff --git a/components/google_dialogflow/actions/create-intent/create-intent.mjs b/components/google_dialogflow/actions/create-intent/create-intent.mjs index 3cccd800be381..9541ce66c97f6 100644 --- a/components/google_dialogflow/actions/create-intent/create-intent.mjs +++ b/components/google_dialogflow/actions/create-intent/create-intent.mjs @@ -4,7 +4,7 @@ import utils from "../../common/utils.mjs"; export default { type: "action", key: "google_dialogflow-create-intent", - version: "0.0.1", + version: "1.0.0", name: "Create Intent", description: "Creates an intent, [See REST docs](https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.intents/create) and [client API](https://googleapis.dev/nodejs/dialogflow/latest/google.cloud.dialogflow.v2beta1.Intents.html#createIntent2)", props: { diff --git a/components/google_dialogflow/actions/create-update-agent/create-update-agent.mjs b/components/google_dialogflow/actions/create-update-agent/create-update-agent.mjs index b3c548e1edbc3..ac0d89f54bf6a 100644 --- a/components/google_dialogflow/actions/create-update-agent/create-update-agent.mjs +++ b/components/google_dialogflow/actions/create-update-agent/create-update-agent.mjs @@ -4,7 +4,7 @@ import utils from "../../common/utils.mjs"; export default { type: "action", key: "google_dialogflow-create-update-agent", - version: "0.0.1", + version: "1.0.0", name: "Create or Update Agent", description: "Creates new agent, updates if already created [See REST docs](https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects/setAgent) and [client API](https://googleapis.dev/nodejs/dialogflow/latest/google.cloud.dialogflow.v2.Agents.html#setAgent2)", props: { diff --git a/components/google_dialogflow/actions/delete-agent/delete-agent.mjs b/components/google_dialogflow/actions/delete-agent/delete-agent.mjs index 7787beebbcb9d..c4db0f88bf463 100644 --- a/components/google_dialogflow/actions/delete-agent/delete-agent.mjs +++ b/components/google_dialogflow/actions/delete-agent/delete-agent.mjs @@ -3,7 +3,7 @@ import googleDialogflow from "../../google_dialogflow.app.mjs"; export default { type: "action", key: "google_dialogflow-delete-agent", - version: "0.0.1", + version: "1.0.0", name: "Delete Agent", description: "Deletes an agent, [See REST docs](https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects/deleteAgent) and [client API](https://googleapis.dev/nodejs/dialogflow/latest/google.cloud.dialogflow.v2.Agents.html#deleteAgent2)", props: { diff --git a/components/google_dialogflow/actions/delete-context/delete-context.mjs b/components/google_dialogflow/actions/delete-context/delete-context.mjs index dd713694420a2..8b4059d6b29a1 100644 --- a/components/google_dialogflow/actions/delete-context/delete-context.mjs +++ b/components/google_dialogflow/actions/delete-context/delete-context.mjs @@ -3,7 +3,7 @@ import googleDialogflow from "../../google_dialogflow.app.mjs"; export default { type: "action", key: "google_dialogflow-delete-context", - version: "0.0.1", + version: "1.0.0", name: "Delete Context", description: "Deletes a context [See REST docs](https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.environments.users.sessions.contexts/delete) and [client API](https://googleapis.dev/nodejs/dialogflow/latest/google.cloud.dialogflow.v2beta1.Contexts.html#deleteContext2)", props: { diff --git a/components/google_dialogflow/actions/delete-entities/delete-entities.mjs b/components/google_dialogflow/actions/delete-entities/delete-entities.mjs index ddf7172270d79..28ce573439bdd 100644 --- a/components/google_dialogflow/actions/delete-entities/delete-entities.mjs +++ b/components/google_dialogflow/actions/delete-entities/delete-entities.mjs @@ -3,7 +3,7 @@ import googleDialogflow from "../../google_dialogflow.app.mjs"; export default { type: "action", key: "google_dialogflow-delete-entities", - version: "0.0.1", + version: "1.0.0", name: "Delete Entities", description: "Batch delete entities, [See REST docs](https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.entityTypes.entities/batchDelete) and [client API docs](https://googleapis.dev/nodejs/dialogflow/latest/google.cloud.dialogflow.v2beta1.EntityTypes.html#batchDeleteEntities2)", props: { diff --git a/components/google_dialogflow/actions/delete-entity-type/delete-entity-type.mjs b/components/google_dialogflow/actions/delete-entity-type/delete-entity-type.mjs index 659c126af2ef5..ac7339617857c 100644 --- a/components/google_dialogflow/actions/delete-entity-type/delete-entity-type.mjs +++ b/components/google_dialogflow/actions/delete-entity-type/delete-entity-type.mjs @@ -3,7 +3,7 @@ import googleDialogflow from "../../google_dialogflow.app.mjs"; export default { type: "action", key: "google_dialogflow-delete-entity-type", - version: "0.0.1", + version: "1.0.0", name: "Delete Entity Type", description: "Deletes an entity type, [See REST docs](https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.entityTypes/delete) and [client API docs](https://googleapis.dev/nodejs/dialogflow/latest/google.cloud.dialogflow.v2beta1.EntityTypes.html#deleteEntityType2)", props: { diff --git a/components/google_dialogflow/actions/delete-intent/delete-intent.mjs b/components/google_dialogflow/actions/delete-intent/delete-intent.mjs index a9a6750385539..7d79561173fd7 100644 --- a/components/google_dialogflow/actions/delete-intent/delete-intent.mjs +++ b/components/google_dialogflow/actions/delete-intent/delete-intent.mjs @@ -3,7 +3,7 @@ import googleDialogflow from "../../google_dialogflow.app.mjs"; export default { type: "action", key: "google_dialogflow-delete-intent", - version: "0.0.1", + version: "1.0.0", name: "Delete Intent", description: "Deletes an intent, [See REST docs](https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.intents/delete) and [client API](https://googleapis.dev/nodejs/dialogflow/latest/google.cloud.dialogflow.v2beta1.Intents.html#deleteIntent2)", props: { diff --git a/components/google_dialogflow/actions/detect-intent/detect-intent.mjs b/components/google_dialogflow/actions/detect-intent/detect-intent.mjs index 25fe02fb5a984..f67cf07cb754c 100644 --- a/components/google_dialogflow/actions/detect-intent/detect-intent.mjs +++ b/components/google_dialogflow/actions/detect-intent/detect-intent.mjs @@ -4,7 +4,7 @@ import utils from "../../common/utils.mjs"; export default { type: "action", key: "google_dialogflow-detect-intent", - version: "0.0.2", + version: "1.0.0", name: "Detect Intent", description: "Processes a natural language query and returns structured, actionable data as a result, [See REST docs](https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.sessions/detectIntent) and [client API](https://googleapis.dev/nodejs/dialogflow/latest/google.cloud.dialogflow.v2beta1.Sessions.html#detectIntent2)", props: { @@ -40,9 +40,9 @@ export default { optional: true, }, inputAudioFile: { - label: "Input Audio", - description: "Please provide a file path, e.g. `/tmp/recording.mp3`", - type: "object", + label: "Input Audio File or URL", + description: "Provide a file URL or a path to a file in the `/tmp` directory.", + type: "string", optional: true, }, }, diff --git a/components/google_dialogflow/actions/get-agent/get-agent.mjs b/components/google_dialogflow/actions/get-agent/get-agent.mjs index 0f3c7904eb1e3..f837087b136d1 100644 --- a/components/google_dialogflow/actions/get-agent/get-agent.mjs +++ b/components/google_dialogflow/actions/get-agent/get-agent.mjs @@ -3,7 +3,7 @@ import googleDialogflow from "../../google_dialogflow.app.mjs"; export default { type: "action", key: "google_dialogflow-get-agent", - version: "0.0.1", + version: "1.0.0", name: "Get Agent", description: "Retrieves an agent, [See REST docs](https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects/getAgent) and [client API](https://googleapis.dev/nodejs/dialogflow/latest/google.cloud.dialogflow.v2.Agents.html#getAgent2)", props: { diff --git a/components/google_dialogflow/actions/get-context/get-context.mjs b/components/google_dialogflow/actions/get-context/get-context.mjs index a5a69e19e176a..a38ddbf13f305 100644 --- a/components/google_dialogflow/actions/get-context/get-context.mjs +++ b/components/google_dialogflow/actions/get-context/get-context.mjs @@ -3,7 +3,7 @@ import googleDialogflow from "../../google_dialogflow.app.mjs"; export default { type: "action", key: "google_dialogflow-get-context", - version: "0.0.1", + version: "1.0.0", name: "Get Context", description: "Get a context, [See REST docs](https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.sessions.contexts/get) and [client API](https://googleapis.dev/nodejs/dialogflow/latest/google.cloud.dialogflow.v2beta1.Contexts.html#getContext2)", props: { diff --git a/components/google_dialogflow/actions/get-entity-type/get-entity-type.mjs b/components/google_dialogflow/actions/get-entity-type/get-entity-type.mjs index da8712e4b7343..3d9e50a7c3cc4 100644 --- a/components/google_dialogflow/actions/get-entity-type/get-entity-type.mjs +++ b/components/google_dialogflow/actions/get-entity-type/get-entity-type.mjs @@ -3,7 +3,7 @@ import googleDialogflow from "../../google_dialogflow.app.mjs"; export default { type: "action", key: "google_dialogflow-get-entity-type", - version: "0.0.1", + version: "1.0.0", name: "Get Entity Type", description: "Retrieves an Entity Type, [See REST docs](https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.entityTypes/get) and [client API docs](https://googleapis.dev/nodejs/dialogflow/latest/google.cloud.dialogflow.v2beta1.EntityTypes.html#getEntityType2)", props: { diff --git a/components/google_dialogflow/actions/get-intent/get-intent.mjs b/components/google_dialogflow/actions/get-intent/get-intent.mjs index 930ecad5c5218..54717c0b31e80 100644 --- a/components/google_dialogflow/actions/get-intent/get-intent.mjs +++ b/components/google_dialogflow/actions/get-intent/get-intent.mjs @@ -3,7 +3,7 @@ import googleDialogflow from "../../google_dialogflow.app.mjs"; export default { type: "action", key: "google_dialogflow-get-intent", - version: "0.0.1", + version: "1.0.0", name: "Get Intent", description: "Retrieves an intent [See REST docs](https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.intents/get) and [client API][https://googleapis.dev/nodejs/dialogflow/latest/google.cloud.dialogflow.v2beta1.Intents.html#getIntent2]", props: { diff --git a/components/google_dialogflow/actions/list-contexts/list-contexts.mjs b/components/google_dialogflow/actions/list-contexts/list-contexts.mjs index 41abab455a294..37faadc7e7e8d 100644 --- a/components/google_dialogflow/actions/list-contexts/list-contexts.mjs +++ b/components/google_dialogflow/actions/list-contexts/list-contexts.mjs @@ -3,7 +3,7 @@ import googleDialogflow from "../../google_dialogflow.app.mjs"; export default { type: "action", key: "google_dialogflow-list-contexts", - version: "0.0.1", + version: "1.0.0", name: "List Contexts", description: "Retrieves the list of the contexts with the given session ID, [See REST docs](https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.sessions.contexts/list) and [client API](https://googleapis.dev/nodejs/dialogflow/latest/google.cloud.dialogflow.v2beta1.Contexts.html#listContexts2)", props: { diff --git a/components/google_dialogflow/actions/list-entity-types/list-entity-types.mjs b/components/google_dialogflow/actions/list-entity-types/list-entity-types.mjs index 366841788e6fc..fb51af4dc235d 100644 --- a/components/google_dialogflow/actions/list-entity-types/list-entity-types.mjs +++ b/components/google_dialogflow/actions/list-entity-types/list-entity-types.mjs @@ -3,7 +3,7 @@ import googleDialogflow from "../../google_dialogflow.app.mjs"; export default { type: "action", key: "google_dialogflow-list-entity-types", - version: "0.0.1", + version: "1.0.0", name: "List Entity Types", description: "Retrieves list of entity types, [See REST docs](https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.entityTypes/list) and [client API docs](https://googleapis.dev/nodejs/dialogflow/latest/google.cloud.dialogflow.v2beta1.EntityTypes.html#listEntityTypes2)", props: { diff --git a/components/google_dialogflow/actions/list-intents/list-intents.mjs b/components/google_dialogflow/actions/list-intents/list-intents.mjs index e9f49e543d583..c0fc9ac45b755 100644 --- a/components/google_dialogflow/actions/list-intents/list-intents.mjs +++ b/components/google_dialogflow/actions/list-intents/list-intents.mjs @@ -3,7 +3,7 @@ import googleDialogflow from "../../google_dialogflow.app.mjs"; export default { type: "action", key: "google_dialogflow-list-intents", - version: "0.0.1", + version: "1.0.0", name: "List Intents", description: "Retrieves the list of the intents, [See REST docs](https://cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/projects.agent.intents/list) and [client API](https://googleapis.dev/nodejs/dialogflow/latest/google.cloud.dialogflow.v2beta1.Intents.html#listIntents2)", props: { diff --git a/components/google_dialogflow/actions/update-context/update-context.mjs b/components/google_dialogflow/actions/update-context/update-context.mjs index 8687d9b31182f..802ba9962002e 100644 --- a/components/google_dialogflow/actions/update-context/update-context.mjs +++ b/components/google_dialogflow/actions/update-context/update-context.mjs @@ -3,7 +3,7 @@ import googleDialogflow from "../../google_dialogflow.app.mjs"; export default { type: "action", key: "google_dialogflow-update-context", - version: "0.0.1", + version: "1.0.0", name: "Update Context", description: "Updates a context, [See REST docs](https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.sessions.contexts/patch) and [client API](https://googleapis.dev/nodejs/dialogflow/latest/google.cloud.dialogflow.v2beta1.Contexts.html#updateContext2)", props: { diff --git a/components/google_dialogflow/actions/update-entity-type/update-entity-type.mjs b/components/google_dialogflow/actions/update-entity-type/update-entity-type.mjs index 14767f7ab7880..897a563632499 100644 --- a/components/google_dialogflow/actions/update-entity-type/update-entity-type.mjs +++ b/components/google_dialogflow/actions/update-entity-type/update-entity-type.mjs @@ -4,7 +4,7 @@ import utils from "../../common/utils.mjs"; export default { type: "action", key: "google_dialogflow-update-entity-type", - version: "0.0.1", + version: "1.0.0", name: "Update Entity Type", description: "Updates an Entity Type, [See REST docs](https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.entityTypes/patch) and [client API docs](https://googleapis.dev/nodejs/dialogflow/latest/google.cloud.dialogflow.v2beta1.EntityTypes.html#updateEntityType2)", props: { diff --git a/components/google_dialogflow/google_dialogflow.app.mjs b/components/google_dialogflow/google_dialogflow.app.mjs index 47ec0ded8ba7d..01af5c034de56 100644 --- a/components/google_dialogflow/google_dialogflow.app.mjs +++ b/components/google_dialogflow/google_dialogflow.app.mjs @@ -5,7 +5,7 @@ import { ContextsClient, EntityTypesClient, } from "@google-cloud/dialogflow"; -import fs from "fs"; +import { getFileStream } from "@pipedream/platform"; import constants from "./common/constants.mjs"; export default { @@ -135,6 +135,14 @@ export default { projectId: this._getAuthKeyJson().project_id, }; }, + streamToBuffer(stream) { + return new Promise((resolve, reject) => { + const chunks = []; + stream.on("data", (chunk) => chunks.push(chunk)); + stream.on("end", () => resolve(Buffer.concat(chunks))); + stream.on("error", reject); + }); + }, getAgentsClient() { return new AgentsClient(this._getSDKParams()); }, getIntentClient() { return new IntentsClient(this._getSDKParams()); }, getSessionClient() { return new SessionsClient(this._getSDKParams()); }, @@ -180,9 +188,9 @@ export default { sessionId, ...otherParams } = {}) { - const inputAudio = inputAudioFile ? - fs.readFileSync(inputAudioFile) : - undefined; + const inputAudio = inputAudioFile + ? await this.streamToBuffer(await getFileStream(inputAudioFile)) + : undefined; const sessionPath = this.getSessionClient().projectAgentSessionPath( this._getProjectId(), sessionId, diff --git a/components/google_dialogflow/package.json b/components/google_dialogflow/package.json index e7a5ebccb99c6..7107d7a5f40f6 100644 --- a/components/google_dialogflow/package.json +++ b/components/google_dialogflow/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/google_dialogflow", - "version": "0.0.3", + "version": "1.0.0", "description": "Pipedream Google Dialogflow Components", "main": "google_dialogflow.app.mjs", "keywords": [ @@ -12,7 +12,8 @@ "homepage": "https://pipedream.com/apps/google_dialogflow", "author": "Pipedream (https://pipedream.com/)", "dependencies": { - "@google-cloud/dialogflow": "^5.1.0" + "@google-cloud/dialogflow": "^5.1.0", + "@pipedream/platform": "^3.1.0" }, "publishConfig": { "access": "public" diff --git a/components/google_gemini/actions/generate-content-from-text-and-image/generate-content-from-text-and-image.mjs b/components/google_gemini/actions/generate-content-from-text-and-image/generate-content-from-text-and-image.mjs index dba9c3b4eb04d..513ba7f4698c6 100644 --- a/components/google_gemini/actions/generate-content-from-text-and-image/generate-content-from-text-and-image.mjs +++ b/components/google_gemini/actions/generate-content-from-text-and-image/generate-content-from-text-and-image.mjs @@ -1,6 +1,7 @@ -import fs from "fs"; +import { + ConfigurationError, getFileStreamAndMetadata, +} from "@pipedream/platform"; import mime from "mime"; -import { ConfigurationError } from "@pipedream/platform"; import common from "../common/generate-content.mjs"; import utils from "../../common/utils.mjs"; @@ -9,30 +10,44 @@ export default { key: "google_gemini-generate-content-from-text-and-image", name: "Generate Content from Text and Image", description: "Generates content from both text and image input using the Gemini API. [See the documentation](https://ai.google.dev/tutorials/rest_quickstart#text-and-image_input)", - version: "0.2.1", + version: "1.0.0", type: "action", props: { ...common.props, - mediaPaths: { - propDefinition: [ - common.props.app, - "mediaPaths", - ], + mediaFiles: { + type: "string[]", + label: "Media File Paths or URLs", + description: "A list of file paths from the `/tmp` directory or URLs for the media to process.", }, }, methods: { ...common.methods, - fileToGenerativePart(filePath) { - if (!filePath) { + streamToBase64(stream) { + return new Promise((resolve, reject) => { + const chunks = []; + stream.on("data", (chunk) => chunks.push(chunk)); + stream.on("end", () => { + const buffer = Buffer.concat(chunks); + resolve(buffer.toString("base64")); + }); + stream.on("error", reject); + }); + }, + async fileToGenerativePart(file) { + if (!file) { return; } - const mimeType = mime.getType(filePath); + const { + stream, metadata, + } = await getFileStreamAndMetadata(file); + + const data = await this.streamToBase64(stream); return { inline_data: { - mime_type: mimeType, - data: Buffer.from(fs.readFileSync(filePath)).toString("base64"), + mime_type: metadata.contentType ?? mime.getType(metadata.name), + data, }, }; }, @@ -43,7 +58,7 @@ export default { model, text, history, - mediaPaths, + mediaFiles, safetySettings, responseFormat, responseSchema, @@ -54,19 +69,19 @@ export default { stopSequences, } = this; - if (!Array.isArray(mediaPaths)) { - throw new ConfigurationError("Image/Video paths must be an array."); + if (!Array.isArray(mediaFiles)) { + throw new ConfigurationError("Image/Video files must be an array."); } - if (!mediaPaths.length) { - throw new ConfigurationError("At least one media path must be provided."); + if (!mediaFiles.length) { + throw new ConfigurationError("At least one media file must be provided."); } const contents = [ ...this.formatHistoryToContent(history), { parts: [ - ...mediaPaths.map((path) => this.fileToGenerativePart(path)), + ...(await Promise.all(mediaFiles.map((path) => this.fileToGenerativePart(path)))), { text, }, diff --git a/components/google_gemini/package.json b/components/google_gemini/package.json index f355ecd627404..06b5d8338cfd3 100644 --- a/components/google_gemini/package.json +++ b/components/google_gemini/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/google_gemini", - "version": "0.3.1", + "version": "1.0.0", "description": "Pipedream Google Gemini Components", "main": "google_gemini.app.mjs", "keywords": [ @@ -13,7 +13,7 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^3.0.3", + "@pipedream/platform": "^3.1.0", "mime": "^4.0.7" } } diff --git a/components/google_photos/actions/upload-item/upload-item.mjs b/components/google_photos/actions/upload-item/upload-item.mjs index 202e69619794e..b3669274b5a69 100644 --- a/components/google_photos/actions/upload-item/upload-item.mjs +++ b/components/google_photos/actions/upload-item/upload-item.mjs @@ -1,31 +1,26 @@ import app from "../../google_photos.app.mjs"; -import utils from "../../common/utils.mjs"; -import { ConfigurationError } from "@pipedream/platform"; -import mime from "mime-types"; -import fs from "fs"; +import { + ConfigurationError, getFileStreamAndMetadata, +} from "@pipedream/platform"; export default { key: "google_photos-upload-item", - version: "0.0.1", + version: "1.0.0", type: "action", name: "Upload Item", description: "Uploads an item to Google Photos. [See the documentation](https://developers.google.com/photos/library/guides/upload-media)", props: { app, - media: { + file: { type: "string", - label: "Media Path", - description: "The media content to upload, please provide an image 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)", - }, - filename: { - type: "string", - label: "File Name", - description: "File name attribute.", + label: "File Path or URL", + description: "The media content to upload. Provide a file URL or a path to a file in the `/tmp` directory.", }, description: { type: "string", label: "Description", description: "Description.", + optional: true, }, albumId: { propDefinition: [ @@ -35,20 +30,33 @@ export default { optional: true, }, }, + methods: { + streamToUint8Array(stream) { + return new Promise((resolve, reject) => { + const chunks = []; + stream.on("data", (chunk) => chunks.push(chunk)); + stream.on("end", () => { + const buffer = Buffer.concat(chunks); + resolve(new Uint8Array(buffer)); + }); + stream.on("error", reject); + }); + }, + }, async run ({ $ }) { - const filePath = utils.isValidFile(this.media); - if (!filePath) { - throw new ConfigurationError("`Media Path` must be a valid file path"); + const { + stream, metadata, + } = await getFileStreamAndMetadata(this.file); + if (!metadata.contentType) { + throw new ConfigurationError("Can't determine content type of the file. Please specify it in the source step."); } - const fileData = fs.readFileSync(filePath, { - flag: "r", - }); - const bytes = new Uint8Array(fileData); + + const bytes = await this.streamToUint8Array(stream); const uploadToken = await this.app.uploadBytes({ $, headers: { "Content-type": "application/octet-stream", - "X-Goog-Upload-Content-Type": mime.lookup(filePath), + "X-Goog-Upload-Content-Type": metadata.contentType, "X-Goog-Upload-Protocol": "raw", }, data: bytes, @@ -61,7 +69,7 @@ export default { { description: this.description, simpleMediaItem: { - fileName: this.filename, + fileName: metadata.name, uploadToken, }, }, diff --git a/components/google_photos/package.json b/components/google_photos/package.json index 14924ffeae523..3c2476713b188 100644 --- a/components/google_photos/package.json +++ b/components/google_photos/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/google_photos", - "version": "0.0.1", + "version": "1.0.0", "description": "Pipedream Google Photos Components", "main": "google_photos.app.mjs", "keywords": [ @@ -12,7 +12,7 @@ "homepage": "https://pipedream.com/apps/google-photos", "author": "Pipedream (https://pipedream.com/)", "dependencies": { - "@pipedream/platform": "^1.5.1", + "@pipedream/platform": "^3.1.0", "mime": "^3.0.0" }, "publishConfig": { diff --git a/components/gptzero_detect_ai/actions/scan-file/scan-file.mjs b/components/gptzero_detect_ai/actions/scan-file/scan-file.mjs index c4d5577b1799c..5eb4a10ba726e 100644 --- a/components/gptzero_detect_ai/actions/scan-file/scan-file.mjs +++ b/components/gptzero_detect_ai/actions/scan-file/scan-file.mjs @@ -1,16 +1,15 @@ -import { ConfigurationError } from "@pipedream/platform"; -import FormData from "form-data"; -import fs from "fs"; import { - checkTmp, parseObject, -} from "../../common/utils.mjs"; + ConfigurationError, getFileStreamAndMetadata, +} from "@pipedream/platform"; +import FormData from "form-data"; +import { parseObject } from "../../common/utils.mjs"; import gptzeroDetectAi from "../../gptzero_detect_ai.app.mjs"; export default { key: "gptzero_detect_ai-scan-file", name: "Scan File for AI Detection", description: "This endpoint takes in file(s) input and returns the model's result. [See the documentation](https://gptzero.stoplight.io/docs/gptzero-api/0a8e7efa751a6-ai-detection-on-an-array-of-files)", - version: "0.0.1", + version: "1.0.0", type: "action", props: { gptzeroDetectAi, @@ -23,8 +22,8 @@ export default { }, files: { type: "string[]", - label: "Files", - description: "A list of paths to files in the `/tmp` directory to analyze. Each file's document will be truncated to 50,000 characters. [See the documentation on working with files](https://pipedream.com/docs/code/nodejs/working-with-files/#writing-a-file-to-tmp).", + label: "Files or URLs", + description: "A list of file paths from the `/tmp` directory or URLs to analyze.", }, }, async run({ $ }) { @@ -33,9 +32,13 @@ export default { } const data = new FormData(); - for (const filePath of parseObject(this.files)) { - const file = fs.createReadStream(checkTmp(filePath)); - data.append("files", file); + for (const file of parseObject(this.files)) { + const { + stream, metadata, + } = await getFileStreamAndMetadata(file); + data.append("files", stream, { + filename: metadata.name, + }); } const response = await this.gptzeroDetectAi.detectFiles({ diff --git a/components/gptzero_detect_ai/package.json b/components/gptzero_detect_ai/package.json index 1d3776f2eacde..cf68eab87824a 100644 --- a/components/gptzero_detect_ai/package.json +++ b/components/gptzero_detect_ai/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/gptzero_detect_ai", - "version": "0.1.0", + "version": "1.0.0", "description": "Pipedream GPTZero: Detect AI Components", "main": "gptzero_detect_ai.app.mjs", "keywords": [ @@ -13,8 +13,7 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^3.0.1", + "@pipedream/platform": "^3.1.0", "form-data": "^4.0.0" } } - diff --git a/components/greenhouse/actions/add-attachment-to-candidate/add-attachment-to-candidate.mjs b/components/greenhouse/actions/add-attachment-to-candidate/add-attachment-to-candidate.mjs index 678ebd3c63ff8..0249a617b0229 100644 --- a/components/greenhouse/actions/add-attachment-to-candidate/add-attachment-to-candidate.mjs +++ b/components/greenhouse/actions/add-attachment-to-candidate/add-attachment-to-candidate.mjs @@ -1,14 +1,14 @@ -import { ConfigurationError } from "@pipedream/platform"; -import fs from "fs"; +import { + ConfigurationError, getFileStream, +} from "@pipedream/platform"; import { CONTENT_TYPE_OPTIONS } from "../../common/constants.mjs"; -import { checkTmp } from "../../common/utils.mjs"; import greenhouse from "../../greenhouse.app.mjs"; export default { key: "greenhouse-add-attachment-to-candidate", name: "Add Attachment to Candidate", description: "Adds an attachment to a specific candidate or prospect. [See the documentation](https://developers.greenhouse.io/harvest.html#post-add-attachment)", - version: "0.0.1", + version: "1.0.0", type: "action", props: { greenhouse, @@ -41,39 +41,42 @@ export default { }, file: { type: "string", - label: "File", - description: "The path to the image file saved to the `/tmp` directory (e.g. `/tmp/example.jpg`). [See the documentation](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory). (if you are providing content, you do not need to provide url).", - optional: true, - }, - url: { - type: "string", - label: "URL", - description: "Url of the attachment (if you are providing the url, you do not need to provide the content.) *Please note, shareable links from cloud services such as Google Drive will result in a corrupted file. Please use machine accessbile URLs*.", - optional: true, + label: "File or URL", + description: "Provide a file URL or path to a file in the `/tmp` directory.", }, contentType: { type: "string", label: "Content Type", - description: "The content-type of the document you are sending. When using a URL, this generally isn't needed, as the responding server will deliver a content type. This should be included for encoded content.", + description: "The content-type of the document you are sending. This should be included for encoded content.", optional: true, options: CONTENT_TYPE_OPTIONS, }, }, + methods: { + streamToBase64(stream) { + return new Promise((resolve, reject) => { + const chunks = []; + stream.on("data", (chunk) => chunks.push(chunk)); + stream.on("end", () => { + const buffer = Buffer.concat(chunks); + resolve(buffer.toString("base64")); + }); + stream.on("error", reject); + }); + }, + }, async run({ $ }) { - if ((this.file && this.url) || (!this.file && !this.url)) { - throw new ConfigurationError("You must provide either File or URL"); + if (!this.file) { + throw new ConfigurationError("You must provide a File or URL."); } - let encodedFile; - - if (this.file) { - if (!this.contentType) { - throw new ConfigurationError("You must provide the Content-Type"); - } - const file = fs.readFileSync(checkTmp(this.file)); - encodedFile = Buffer(file).toString("base64"); + if (!this.contentType) { + throw new ConfigurationError("You must provide the Content-Type."); } + const stream = await getFileStream(this.file); + const encodedFile = await this.streamToBase64(stream); + const response = await this.greenhouse.addAttachmentToCandidate({ $, headers: { @@ -84,7 +87,6 @@ export default { filename: this.filename, type: this.type, content: encodedFile, - url: this.url, content_type: this.contentType, }, }); diff --git a/components/greenhouse/package.json b/components/greenhouse/package.json index 6ed0ecb62b214..f5dd6aa6fe6e4 100644 --- a/components/greenhouse/package.json +++ b/components/greenhouse/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/greenhouse", - "version": "0.1.0", + "version": "1.0.0", "description": "Pipedream Greenhouse Components", "main": "greenhouse.app.mjs", "keywords": [ @@ -13,6 +13,6 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^1.6.5" + "@pipedream/platform": "^3.1.0" } } diff --git a/components/hathr_ai/actions/upload-document/upload-document.mjs b/components/hathr_ai/actions/upload-document/upload-document.mjs index 7fb82206f7f47..f024f33d11904 100644 --- a/components/hathr_ai/actions/upload-document/upload-document.mjs +++ b/components/hathr_ai/actions/upload-document/upload-document.mjs @@ -1,47 +1,42 @@ import hathrAi from "../../hathr_ai.app.mjs"; -import { axios } from "@pipedream/platform"; -import { checkTmp } from "../../common/utils.mjs"; -import mime from "mime-types"; -import fs from "fs"; +import { + axios, getFileStreamAndMetadata, +} from "@pipedream/platform"; export default { key: "hathr_ai-upload-document", name: "Upload Document", description: "Uploads a document that can be used in future chat requests. [See the documentation](https://drive.google.com/drive/folders/1jtoSXqzhe-iwf9kfUwTCVQBu4iXVJO2x?usp=sharing)", - version: "0.0.1", + version: "1.0.0", type: "action", props: { hathrAi, - filePath: { + file: { type: "string", - label: "File Path", - 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)", - }, - filename: { - type: "string", - label: "Filename", - description: "The name of the file to be uploaded", + label: "File Path or URL", + description: "The file to upload. Provide a file URL or a path to a file in the `/tmp` directory.", }, }, async run({ $ }) { - const filePath = checkTmp(this.filePath); - const fileBuffer = fs.readFileSync(filePath); - const mimeType = mime.lookup(filePath); + const { + stream, metadata, + } = await getFileStreamAndMetadata(this.file); const { response: { signedUrl } } = await this.hathrAi.getUploadUrl({ $, data: { - filename: this.filename, - type: mimeType, + filename: metadata.name, + type: metadata.contentType, }, }); await axios($, { method: "PUT", url: signedUrl, - data: fileBuffer, + data: stream, headers: { - "Content-Type": mimeType, + "Content-Type": metadata.contentType, + "Content-Length": metadata.size, }, }); diff --git a/components/hathr_ai/package.json b/components/hathr_ai/package.json index 7e398795871d5..695c7ea9bd009 100644 --- a/components/hathr_ai/package.json +++ b/components/hathr_ai/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/hathr_ai", - "version": "0.1.0", + "version": "1.0.0", "description": "Pipedream Hathr AI Components", "main": "hathr_ai.app.mjs", "keywords": [ @@ -13,7 +13,7 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^3.0.3", + "@pipedream/platform": "^3.1.0", "mime-types": "^3.0.1" } } diff --git a/components/hippo_video/actions/send-personalization-request/send-personalization-request.mjs b/components/hippo_video/actions/send-personalization-request/send-personalization-request.mjs index 9dfe67b622905..87d343671a6b3 100644 --- a/components/hippo_video/actions/send-personalization-request/send-personalization-request.mjs +++ b/components/hippo_video/actions/send-personalization-request/send-personalization-request.mjs @@ -1,14 +1,14 @@ -import { ConfigurationError } from "@pipedream/platform"; +import { + ConfigurationError, getFileStreamAndMetadata, +} from "@pipedream/platform"; import FormData from "form-data"; -import fs from "fs"; -import { checkTmp } from "../../common/utils.mjs"; import hippoVideo from "../../hippo_video.app.mjs"; export default { key: "hippo_video-send-personalization-request", name: "Send Personalization Request", description: "Sends a personalization request for a specified video. [See the documentation](https://help.hippovideo.io/support/solutions/articles/19000099793-bulk-video-personalization-and-tracking-api)", - version: "0.0.1", + version: "1.0.0", type: "action", props: { hippoVideo, @@ -20,15 +20,19 @@ export default { }, file: { type: "string", - label: "File", - description: "csv, xls, and xlsx file saved to the [`/tmp` directory](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory). To get file schema, [see documentation](https://help.hippovideo.io/support/solutions/articles/19000099793-bulk-video-personalization-and-tracking-api)", + label: "File Path or URL", + description: "Provide a file URL or a path to a file (csv, xls, or xlsx) in the `/tmp` directory.", }, }, async run({ $ }) { const formData = new FormData(); - const file = fs.createReadStream(checkTmp(this.file)); + const { + stream, metadata, + } = await getFileStreamAndMetadata(this.file); - formData.append("file", file); + formData.append("file", stream, { + filename: metadata.name, + }); formData.append("video_id", this.videoId); const response = await this.hippoVideo.personalizeVideo({ diff --git a/components/hippo_video/package.json b/components/hippo_video/package.json index b1fa650fe4391..8a083ca82ea95 100644 --- a/components/hippo_video/package.json +++ b/components/hippo_video/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/hippo_video", - "version": "0.1.0", + "version": "1.0.0", "description": "Pipedream Hippo Video Components", "main": "hippo_video.app.mjs", "keywords": [ @@ -13,7 +13,7 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^1.6.5", + "@pipedream/platform": "^3.1.0", "form-data": "^4.0.0" } } diff --git a/components/ignisign/actions/create-signature-request/create-signature-request.mjs b/components/ignisign/actions/create-signature-request/create-signature-request.mjs index 10f9f8967dfa6..2102bfbed7184 100644 --- a/components/ignisign/actions/create-signature-request/create-signature-request.mjs +++ b/components/ignisign/actions/create-signature-request/create-signature-request.mjs @@ -1,17 +1,16 @@ -import { ConfigurationError } from "@pipedream/platform"; +import { + ConfigurationError, getFileStreamAndMetadata, +} from "@pipedream/platform"; import FormData from "form-data"; -import fs from "fs"; import { LANGUAGE_OPTIONS } from "../../common/constants.mjs"; -import { - checkTmp, parseObject, -} from "../../common/utils.mjs"; +import { parseObject } from "../../common/utils.mjs"; import ignisign from "../../ignisign.app.mjs"; export default { key: "ignisign-create-signature-request", name: "Create Signature Request", description: "Creates a document signature request through IgniSign. [See the documentation](https://ignisign.io/docs/ignisign-api/init-signature-request)", - version: "0.0.1", + version: "1.0.0", type: "action", props: { ignisign, @@ -41,8 +40,8 @@ export default { }, file: { type: "string", - label: "Document File", - 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)", + label: "Document File Path or URL", + description: "Provide a file URL or a path to a file in the `/tmp` directory.", }, title: { type: "string", @@ -95,15 +94,19 @@ export default { }, }); - const path = checkTmp(this.file); - if (!fs.existsSync(path)) { + try { + const { + stream, metadata, + } = await getFileStreamAndMetadata(this.file); + data.append("file", stream, { + filename: metadata.name, + }); + } catch (error) { await this.ignisign.closeSignatureRequest({ signatureRequestId, }); - throw new ConfigurationError("File does not exist!"); + throw new ConfigurationError(`File handling failed: ${error.message}`); } - const file = fs.createReadStream(path); - data.append("file", file); await this.ignisign.uploadFile({ documentId, diff --git a/components/ignisign/package.json b/components/ignisign/package.json index 1b6342af79b25..d48fa84de13fb 100644 --- a/components/ignisign/package.json +++ b/components/ignisign/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/ignisign", - "version": "0.1.0", + "version": "1.0.0", "description": "Pipedream IgniSign Components", "main": "ignisign.app.mjs", "keywords": [ @@ -13,7 +13,7 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^3.0.3", + "@pipedream/platform": "^3.1.0", "form-data": "^4.0.1", "fs": "^0.0.1-security", "stream": "^0.0.3", diff --git a/components/imagekit_io/actions/upload-image/upload-image.mjs b/components/imagekit_io/actions/upload-image/upload-image.mjs index a3d707ffdc72c..8690dffcf3ee6 100644 --- a/components/imagekit_io/actions/upload-image/upload-image.mjs +++ b/components/imagekit_io/actions/upload-image/upload-image.mjs @@ -7,15 +7,15 @@ import imagekitIo from "../../imagekit_io.app.mjs"; export default { key: "imagekit_io-upload-image", name: "Upload Image", - version: "0.0.2", + version: "1.0.0", description: "Upload a new image to ImageKit.io. [See the documentation](https://docs.imagekit.io/api-reference/upload-file-api/server-side-file-upload)", type: "action", props: { imagekitIo, file: { type: "string", - label: "File", - description: "The file you want to upload. It can be **binnary**, **base64** or **url** or **a file path in the `/tmp` directory.** [See the documentation on working with files](https://pipedream.com/docs/code/nodejs/working-with-files/).", + label: "File Path or URL", + description: "The file to upload. Provide a file URL or a path to a file in the `/tmp` directory. This can be a binary file or a base64-encoded string.", }, fileName: { type: "string", @@ -110,7 +110,7 @@ export default { ...appendData } = this; - const data = getFileFormData(file); + const data = await getFileFormData(file); let newExt = extensions; diff --git a/components/imagekit_io/common/methods.mjs b/components/imagekit_io/common/methods.mjs index 2b45d4ebef5c0..ecb8157567fcf 100644 --- a/components/imagekit_io/common/methods.mjs +++ b/components/imagekit_io/common/methods.mjs @@ -1,13 +1,17 @@ import FormData from "form-data"; -import fs from "fs"; +import { getFileStreamAndMetadata } from "@pipedream/platform"; -export function getFileFormData(file) { - const content = file.startsWith("/tmp") - ? fs.createReadStream(file) - : file; +export async function getFileFormData(file) { + const { + stream, metadata, + } = await getFileStreamAndMetadata(file); const data = new FormData(); - data.append("file", content); + data.append("file", stream, { + filename: metadata.name, + contentType: metadata.contentType, + knownLength: metadata.size, + }); return data; } diff --git a/components/imagekit_io/package.json b/components/imagekit_io/package.json index f59e196fcbceb..103529d9ea009 100644 --- a/components/imagekit_io/package.json +++ b/components/imagekit_io/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/imagekit_io", - "version": "0.1.1", + "version": "1.0.0", "description": "Pipedream ImageKit.io Components", "main": "imagekit_io.app.mjs", "keywords": [ @@ -13,7 +13,7 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^1.5.1", + "@pipedream/platform": "^3.1.0", "form-data": "^4.0.0", "fs": "^0.0.1-security" } diff --git a/components/imgbb/actions/upload-picture/upload-picture.mjs b/components/imgbb/actions/upload-picture/upload-picture.mjs index 8e53208e8a70f..0da17390564a2 100644 --- a/components/imgbb/actions/upload-picture/upload-picture.mjs +++ b/components/imgbb/actions/upload-picture/upload-picture.mjs @@ -1,27 +1,21 @@ import app from "../../imgbb.app.mjs"; -import fs from "fs"; import { stringify } from "qs"; -import { ConfigurationError } from "@pipedream/platform"; +import { + ConfigurationError, getFileStream, +} from "@pipedream/platform"; export default { key: "imgbb-upload-picture", name: "Upload picture", description: "Upload a picture to imgbb. [See the docs here](https://api.imgbb.com/)", - version: "0.2.4", + version: "1.0.0", type: "action", props: { app, - filePath: { + file: { 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/image.png`). Must specify either **File URL** or **File Path**.", - optional: true, - }, - fileUrl: { - type: "string", - label: "File URL", - description: "The URL of the file you want to upload to ImgBB. Must specify either **File URL** or **File Path**.", - optional: true, + label: "File Path or URL", + description: "The file to upload. Provide a file URL or a path to a file in the `/tmp` directory.", }, name: { label: "Name", @@ -30,18 +24,38 @@ export default { optional: true, }, }, + methods: { + streamToBase64(stream) { + return new Promise((resolve, reject) => { + const chunks = []; + stream.on("data", (chunk) => chunks.push(chunk)); + stream.on("end", () => { + const buffer = Buffer.concat(chunks); + resolve(buffer.toString("base64")); + }); + stream.on("error", reject); + }); + }, + }, async run({ $ }) { - if (!this.filePath && !this.fileUrl) { - throw new ConfigurationError("Must specify either File Path or File Url"); + const { + file, name, + } = this; + if (!file) { + throw new ConfigurationError("The `File Path or URL` prop is required."); } - if (this.filePath && !this.fileUrl) { - this.fileData = (await fs.promises.readFile(this.filePath, { - encoding: "base64", - })); + + let image; + if (file.startsWith("http")) { + image = file; + } else { + const stream = await getFileStream(file); + image = await this.streamToBase64(stream); } + const data = { - image: this.fileUrl ?? this.fileData, - name: this.name, + image, + name, }; const res = await this.app.uploadPicture($, stringify(data)); $.export("$summary", "Successfully uploaded picture"); diff --git a/components/imgbb/package.json b/components/imgbb/package.json index b1f87299a33c3..1727dbc964673 100644 --- a/components/imgbb/package.json +++ b/components/imgbb/package.json @@ -1,16 +1,18 @@ { - "name": "@pipedream/imgbb", - "version": "0.0.3", - "description": "Pipedream imgbb Components", - "main": "dist/app/imgbb.app.mjs", - "keywords": [ - "pipedream", - "imgbb" - ], - "files": ["dist"], - "homepage": "https://pipedream.com/apps/imgbb", - "author": "Pipedream (https://pipedream.com/)", - "publishConfig": { - "access": "public" - } + "name": "@pipedream/imgbb", + "version": "1.0.0", + "description": "Pipedream imgbb Components", + "main": "imgbb.app.mjs", + "keywords": [ + "pipedream", + "imgbb" + ], + "homepage": "https://pipedream.com/apps/imgbb", + "author": "Pipedream (https://pipedream.com/)", + "publishConfig": { + "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.1.0" } +} diff --git a/components/jigsawstack/actions/object-detection/object-detection.mjs b/components/jigsawstack/actions/object-detection/object-detection.mjs index dccd2d1bcdbcc..12897988a0645 100644 --- a/components/jigsawstack/actions/object-detection/object-detection.mjs +++ b/components/jigsawstack/actions/object-detection/object-detection.mjs @@ -1,24 +1,23 @@ -import { ConfigurationError } from "@pipedream/platform"; -import fs from "fs"; -import mime from "mime"; import { - checkTmp, - throwError, -} from "../../common/utils.mjs"; + ConfigurationError, + getFileStreamAndMetadata, +} from "@pipedream/platform"; +import mime from "mime"; +import { throwError } from "../../common/utils.mjs"; import jigsawstack from "../../jigsawstack.app.mjs"; export default { key: "jigsawstack-object-detection", name: "Object Detection", description: "Recognize objects within a provided image and retrieve it with great accuracy. [See the documentation](https://docs.jigsawstack.com/api-reference/ai/object-detection)", - version: "0.0.1", + version: "1.0.0", type: "action", props: { jigsawstack, - url: { + file: { type: "string", - label: "Image URL", - description: "The URL of the image to process.", + label: "Image File or URL", + description: "The URL or file path of the image to process.", optional: true, }, fileStoreKey: { @@ -27,35 +26,51 @@ export default { description: "The key used to store the image on Jigsawstack file [Storage](https://docs.jigsawstack.com/api-reference/store/file/add).", optional: true, }, - imageFile: { - type: "string", - label: "Image File", - 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).", - optional: true, + }, + methods: { + streamToBuffer(stream) { + return new Promise((resolve, reject) => { + const chunks = []; + stream.on("data", (chunk) => chunks.push(chunk)); + stream.on("end", () => resolve(Buffer.concat(chunks))); + stream.on("error", reject); + }); }, }, async run({ $ }) { const { jigsawstack, - ...data + file, + fileStoreKey, } = this; - if (Object.keys(data).length > 1) { - throw new ConfigurationError("You must provide only one option, either the **Image URL**, the **Image File**, or the **File Storage Key**."); + const data = {}; + + if (file && fileStoreKey) { + throw new ConfigurationError("You must provide only one option, either the **Image File or URL** or the **File Storage Key**."); + } + if (!file && !fileStoreKey) { + throw new ConfigurationError("You must provide either the **Image File or URL** or the **File Storage Key**."); } - if (data.fileStoreKey) data.file_store_key = data.fileStoreKey; + if (fileStoreKey) data.file_store_key = fileStoreKey; - if (data.imageFile) { - const filePath = checkTmp(data.imageFile); - const file = fs.readFileSync(filePath); - const { key } = await jigsawstack.uploadFile({ - headers: { - "Content-Type": mime.getType(filePath), - }, - data: file, - }); - data.file_store_key = key; + if (file) { + if (file.startsWith("http")) { + data.url = file; + } else { + const { + stream, metadata, + } = await getFileStreamAndMetadata(file); + const buffer = await this.streamToBuffer(stream); + const { key } = await jigsawstack.uploadFile({ + headers: { + "Content-Type": metadata.contentType ?? mime.getType(metadata.name), + }, + data: buffer, + }); + data.file_store_key = key; + } } try { diff --git a/components/jigsawstack/package.json b/components/jigsawstack/package.json index f24bbbce6698c..c78bf367f8b33 100644 --- a/components/jigsawstack/package.json +++ b/components/jigsawstack/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/jigsawstack", - "version": "0.1.0", + "version": "1.0.0", "description": "Pipedream JigsawStack Components", "main": "jigsawstack.app.mjs", "keywords": [ @@ -13,7 +13,7 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^3.0.1", + "@pipedream/platform": "^3.1.0", "form-data": "^4.0.0", "mime": "^4.0.4" } diff --git a/components/jina_reader/actions/convert-to-llm-friendly-input/convert-to-llm-friendly-input.mjs b/components/jina_reader/actions/convert-to-llm-friendly-input/convert-to-llm-friendly-input.mjs index 36077cc48a437..85c20002f45ee 100644 --- a/components/jina_reader/actions/convert-to-llm-friendly-input/convert-to-llm-friendly-input.mjs +++ b/components/jina_reader/actions/convert-to-llm-friendly-input/convert-to-llm-friendly-input.mjs @@ -1,13 +1,13 @@ -import fs from "fs"; -import path from "path"; -import { ConfigurationError } from "@pipedream/platform"; +import { + ConfigurationError, getFileStream, +} from "@pipedream/platform"; import app from "../../jina_reader.app.mjs"; export default { key: "jina_reader-convert-to-llm-friendly-input", name: "Convert URL To LLM-Friendly Input", description: "Converts a provided URL to an LLM-friendly input using Jina Reader. [See the documentation](https://github.com/jina-ai/reader)", - version: "0.0.1", + version: "1.0.0", type: "action", props: { app, @@ -104,33 +104,42 @@ export default { }, pdf: { type: "string", - label: "PDF File Path", - description: "The path to the pdf 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: "PDF File Path or URL", + description: "The path or URL to the pdf file.", optional: true, }, html: { type: "string", - label: "HTML File Path", - description: "The path to the html file saved to the `/tmp` directory (e.g. `/tmp/example.html`). [See the documentation](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory).", + label: "HTML File Path or URL", + description: "The path or URL to the html file.", optional: true, }, }, methods: { - async readFileFromTmp(filePath, encoding) { - if (!filePath) { - return; - } - const resolvedPath = path.resolve(filePath); - if (!resolvedPath.startsWith("/tmp/")) { - throw new ConfigurationError(`${filePath} must be located in the '/tmp/' directory`); - } - return await fs.promises.readFile(resolvedPath, encoding); + streamToBase64(stream) { + return new Promise((resolve, reject) => { + const chunks = []; + stream.on("data", (chunk) => chunks.push(chunk)); + stream.on("end", () => { + const buffer = Buffer.concat(chunks); + resolve(buffer.toString("base64")); + }); + stream.on("error", reject); + }); + }, + streamToUtf8(stream) { + return new Promise((resolve, reject) => { + let data = ""; + stream.setEncoding("utf-8"); + stream.on("data", (chunk) => data += chunk); + stream.on("end", () => resolve(data)); + stream.on("error", reject); + }); }, }, async run({ $ }) { const { app, - readFileFromTmp, url, contentFormat, timeout, @@ -150,7 +159,21 @@ export default { } = this; if (!url && !pdf && !html) { - throw new ConfigurationError("You must provide at least one of **URL**, **PDF File Path**, or **HTML File Path**."); + throw new ConfigurationError("You must provide at least one of **URL**, **PDF File Path or URL**, or **HTML File Path or URL**."); + } + + const data = { + url, + }; + + if (pdf) { + const stream = await getFileStream(pdf); + data.pdf = await this.streamToBase64(stream); + } + + if (html) { + const stream = await getFileStream(html); + data.html = await this.streamToUtf8(stream); } const response = await app.post({ @@ -173,11 +196,7 @@ export default { "X-With-Shadow-Dom": shadowDomContent, "X-Iframe": iframeContent, }, - data: { - url, - pdf: await readFileFromTmp(pdf, "base64"), - html: await readFileFromTmp(html, "utf-8"), - }, + data, }); $.export("$summary", "Converted URL to LLM-friendly input successfully."); diff --git a/components/jina_reader/package.json b/components/jina_reader/package.json index 58d8a26a39e73..4063fc5cc7288 100644 --- a/components/jina_reader/package.json +++ b/components/jina_reader/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/jina_reader", - "version": "0.1.0", + "version": "1.0.0", "description": "Pipedream Jina Reader Components", "main": "jina_reader.app.mjs", "keywords": [ @@ -13,6 +13,6 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "3.0.3" + "@pipedream/platform": "^3.1.0" } } diff --git a/components/jobnimbus/actions/create-attachment/create-attachment.mjs b/components/jobnimbus/actions/create-attachment/create-attachment.mjs index e11ae3b19e281..69a6aab8b5b70 100644 --- a/components/jobnimbus/actions/create-attachment/create-attachment.mjs +++ b/components/jobnimbus/actions/create-attachment/create-attachment.mjs @@ -1,21 +1,22 @@ import app from "../../jobnimbus.app.mjs"; import utils from "../../common/utils.mjs"; import { attachmentTypes } from "../../common/constants.mjs"; -import { ConfigurationError } from "@pipedream/platform"; -import fs from "fs"; +import { + ConfigurationError, getFileStream, +} from "@pipedream/platform"; export default { key: "jobnimbus-create-attachment", - version: "0.0.1", + version: "1.0.0", type: "action", name: "Create Attachment", description: "Creates an attachment. [See the documentation](https://documenter.getpostman.com/view/3919598/S11PpG4x#5f3f485b-91f9-4ed9-912c-99a07987ac6c)", props: { app, - filePath: { + file: { type: "string", - label: "File Path", - description: "The file to upload, please provide a valid 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)", + label: "File Path or URL", + description: "The file to upload. Provide a file URL or a path to a file in the `/tmp` directory.", }, type: { type: "string", @@ -43,22 +44,34 @@ export default { optional: true, }, }, + methods: { + streamToBase64(stream) { + return new Promise((resolve, reject) => { + const chunks = []; + stream.on("data", (chunk) => chunks.push(chunk)); + stream.on("end", () => { + const buffer = Buffer.concat(chunks); + resolve(buffer.toString("base64")); + }); + stream.on("error", reject); + }); + }, + }, async run ({ $ }) { - const filePath = utils.isValidFile(this.filePath); - if (!filePath) { - throw new ConfigurationError("`File Path` must be a valid file path!"); + if (!this.file) { + throw new ConfigurationError("The `File Path or URL` prop is required."); } - const fileData = fs.readFileSync(filePath, { - flag: "r", - encoding: "base64", - }); + + const stream = await getFileStream(this.file); + const fileData = await this.streamToBase64(stream); + const data = { ...utils.extractProps(this, { customerIdFromContacts: "customer", }), data: fileData, }; - delete data["filePath"]; + delete data.file; const resp = await this.app.createAttachment({ $, data, diff --git a/components/jobnimbus/package.json b/components/jobnimbus/package.json index ff48a841364b0..216c4d0656f8a 100644 --- a/components/jobnimbus/package.json +++ b/components/jobnimbus/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/jobnimbus", - "version": "0.1.0", + "version": "1.0.0", "description": "Pipedream Jobnimbus Components", "main": "jobnimbus.app.mjs", "keywords": [ @@ -9,10 +9,10 @@ ], "homepage": "https://pipedream.com/apps/jobnimbus", "author": "Pipedream (https://pipedream.com/)", - "dependencies": { - "@pipedream/platform": "^1.5.1" - }, "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.1.0" } } diff --git a/components/lamini/actions/upload-dataset/upload-dataset.mjs b/components/lamini/actions/upload-dataset/upload-dataset.mjs index 1f0ec7c736333..29f392281b6dd 100644 --- a/components/lamini/actions/upload-dataset/upload-dataset.mjs +++ b/components/lamini/actions/upload-dataset/upload-dataset.mjs @@ -1,5 +1,6 @@ -import fs from "fs"; -import { ConfigurationError } from "@pipedream/platform"; +import { + ConfigurationError, getFileStreamAndMetadata, +} from "@pipedream/platform"; import app from "../../lamini.app.mjs"; import constants from "../../common/constants.mjs"; @@ -7,14 +8,14 @@ export default { key: "lamini-upload-dataset", name: "Upload Dataset", description: "Upload a dataset to Lamini for training.", - version: "0.0.2", + version: "1.0.0", type: "action", props: { app, - fileUrl: { + file: { type: "string", - label: "Dataset File URL", - description: "URL of the file containing your training data. Supported formats include `.jsonl` and `.jsonlines`. Eg. `https://raw.githubusercontent.com/lamini-ai/lamini-examples/refs/heads/main/data/results/spot_check_results.jsonl`.", + label: "Dataset File Path or URL", + description: "URL or path to a file containing your training data. Supported formats include `.jsonl` and `.jsonlines`.", }, inputKey: { type: "string", @@ -48,23 +49,29 @@ export default { path: "/get-upload-base-path", }); }, + streamToUtf8(stream) { + return new Promise((resolve, reject) => { + let data = ""; + stream.setEncoding("utf-8"); + stream.on("data", (chunk) => data += chunk); + stream.on("end", () => resolve(data)); + stream.on("error", reject); + }); + }, }, async run({ $ }) { const { - app, - fileUrl, + file, inputKey, outputKey, isPublic, } = this; const { - fileName, filePath, - } = await app.downloadFileToTmp({ - $, - url: fileUrl, - }); + stream, metadata, + } = await getFileStreamAndMetadata(file); + const fileName = metadata.name; if (!fileName.endsWith(".jsonl") && !fileName.endsWith(".jsonlines")) { throw new ConfigurationError(`Unsupported file format for \`${fileName}\`. Only **.jsonl** and **.jsonlines** files are supported.`); } @@ -73,7 +80,7 @@ export default { let allData = []; - const fileContent = fs.readFileSync(filePath, "utf8"); + const fileContent = await this.streamToUtf8(stream); const lines = fileContent.trim().split("\n"); for (const line of lines) { diff --git a/components/lamini/package.json b/components/lamini/package.json index 812d927d60972..bdf0a1692df90 100644 --- a/components/lamini/package.json +++ b/components/lamini/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/lamini", - "version": "0.1.1", + "version": "1.0.0", "description": "Pipedream Lamini Components", "main": "lamini.app.mjs", "keywords": [ @@ -13,6 +13,6 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^3.0.3" + "@pipedream/platform": "^3.1.0" } } diff --git a/components/linkedin/actions/create-image-post-organization/create-image-post-organization.mjs b/components/linkedin/actions/create-image-post-organization/create-image-post-organization.mjs index d72624404f401..a961cde646691 100644 --- a/components/linkedin/actions/create-image-post-organization/create-image-post-organization.mjs +++ b/components/linkedin/actions/create-image-post-organization/create-image-post-organization.mjs @@ -1,12 +1,12 @@ import linkedin from "../../linkedin.app.mjs"; -import fs from "fs"; +import { getFileStreamAndMetadata } from "@pipedream/platform"; import FormData from "form-data"; export default { key: "linkedin-create-image-post-organization", name: "Create Image Post (Organization)", description: "Create an image post on LinkedIn. [See the docs here](https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/images-api?view=li-lms-2023-09&tabs=http#uploading-an-image)", - version: "0.0.3", + version: "1.0.0", type: "action", props: { linkedin, @@ -16,10 +16,10 @@ export default { "organizationId", ], }, - filePath: { + file: { type: "string", - label: "File Path", - description: "The path to the image file saved to the `/tmp` directory (e.g. `/tmp/image.png`). [See the documentation](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory).", + label: "File Path or URL", + description: "The path or URL to the image file.", }, text: { propDefinition: [ @@ -66,11 +66,15 @@ export default { $, }); - const filePath = this.filePath.startsWith("/tmp/") - ? this.filePath - : `/tmp/${this.filePath}`; + const { + stream, metadata, + } = await getFileStreamAndMetadata(this.file); const formData = new FormData(); - formData.append("file", fs.createReadStream(filePath)); + formData.append("file", stream, { + filename: metadata.name, + contentType: metadata.contentType, + knownLength: metadata.size, + }); await this.uploadImage(uploadUrl, formData); diff --git a/components/linkedin/actions/create-image-post-user/create-image-post-user.mjs b/components/linkedin/actions/create-image-post-user/create-image-post-user.mjs index be1785c4603fd..6ffe8fa264a7c 100644 --- a/components/linkedin/actions/create-image-post-user/create-image-post-user.mjs +++ b/components/linkedin/actions/create-image-post-user/create-image-post-user.mjs @@ -1,19 +1,19 @@ import linkedin from "../../linkedin.app.mjs"; -import fs from "fs"; +import { getFileStreamAndMetadata } from "@pipedream/platform"; import FormData from "form-data"; export default { key: "linkedin-create-image-post-user", name: "Create Image Post (User)", description: "Create an image post on LinkedIn. [See the docs here](https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/images-api?view=li-lms-2023-09&tabs=http#uploading-an-image)", - version: "0.0.3", + version: "1.0.0", type: "action", props: { linkedin, - filePath: { + file: { type: "string", - label: "File Path", - description: "The path to the image file saved to the `/tmp` directory (e.g. `/tmp/image.png`). [See the documentation](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory).", + label: "File Path or URL", + description: "The path or URL of the image file to post.", }, text: { propDefinition: [ @@ -66,11 +66,15 @@ export default { $, }); - const filePath = this.filePath.startsWith("/tmp/") - ? this.filePath - : `/tmp/${this.filePath}`; + const { + stream, metadata, + } = await getFileStreamAndMetadata(this.file); const formData = new FormData(); - formData.append("file", fs.createReadStream(filePath)); + formData.append("file", stream, { + filename: metadata.name, + contentType: metadata.contentType, + knownLength: metadata.size, + }); await this.uploadImage(uploadUrl, formData); diff --git a/components/linkedin/package.json b/components/linkedin/package.json index 1c07baa557c79..da08dff3dc545 100644 --- a/components/linkedin/package.json +++ b/components/linkedin/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/linkedin", - "version": "0.2.0", + "version": "1.0.0", "description": "Pipedream Linkedin Components", "main": "linkedin.app.mjs", "keywords": [ @@ -13,7 +13,7 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^3.0.3", + "@pipedream/platform": "^3.1.0", "axios": "^1.2.3", "form-data": "^4.0.0" } diff --git a/components/lmnt/actions/create-custom-voice/create-custom-voice.mjs b/components/lmnt/actions/create-custom-voice/create-custom-voice.mjs index 19cee7518db4f..edf00d76b4aac 100644 --- a/components/lmnt/actions/create-custom-voice/create-custom-voice.mjs +++ b/components/lmnt/actions/create-custom-voice/create-custom-voice.mjs @@ -1,19 +1,19 @@ import lmnt from "../../lmnt.app.mjs"; -import fs from "fs"; +import { getFileStream } from "@pipedream/platform"; import FormData from "form-data"; export default { key: "lmnt-create-custom-voice", name: "Create Custom Voice", description: "Generates a custom voice from a batch of input audio data. [See the documentation](https://docs.lmnt.com/api-reference/voice/create-voice)", - version: "0.0.1", + version: "1.0.0", type: "action", props: { lmnt, files: { type: "string[]", - label: "Audio Files", - description: "One or more `.wav` or `.mp3` filepaths in the `/tmp` directory. [See the documentation on working with files](https://pipedream.com/docs/code/nodejs/working-with-files/#the-tmp-directory). Max attached files: 20. Max total file size: 250 MB.", + label: "Audio Files Paths or URLs", + description: "One or more `.wav` or `.mp3` file paths or URLs. Max attached files: 20. Max total file size: 250 MB.", }, name: { propDefinition: [ @@ -63,12 +63,10 @@ export default { contentType: "application/json", }); - this.files.forEach?.((file) => { - const content = fs.createReadStream(file.includes("tmp/") - ? file - : `/tmp/${file}`); - data.append("files", content); - }); + for (const file of this.files) { + const stream = await getFileStream(file); + data.append("files", stream); + } const response = await this.lmnt.createVoice({ $, diff --git a/components/lmnt/package.json b/components/lmnt/package.json index 38152562c5494..b91a9484d88d0 100644 --- a/components/lmnt/package.json +++ b/components/lmnt/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/lmnt", - "version": "0.1.0", + "version": "1.0.0", "description": "Pipedream LMNT Components", "main": "lmnt.app.mjs", "keywords": [ @@ -13,7 +13,7 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^1.5.1", + "@pipedream/platform": "^3.1.0", "form-data": "^4.0.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 03b11e3fbbfdd..6b60dc9b93afa 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1205,8 +1205,8 @@ importers: specifier: ^0.3.6 version: 0.3.13 '@pipedream/platform': - specifier: ^3.0.3 - version: 3.0.3 + specifier: ^3.1.0 + version: 3.1.0 adm-zip: specifier: ^0.5.10 version: 0.5.16 @@ -2504,8 +2504,8 @@ importers: components/click2mail2: dependencies: '@pipedream/platform': - specifier: ^1.5.1 - version: 1.6.6 + specifier: ^3.1.0 + version: 3.1.0 form-data: specifier: ^4.0.0 version: 4.0.1 @@ -2634,23 +2634,11 @@ importers: components/cloudflare_api_key: dependencies: '@pipedream/platform': - specifier: ^1.1.1 - version: 1.6.6 + specifier: ^3.1.0 + version: 3.1.0 cloudflare: - specifier: ^2.9.1 - version: 2.9.1 - form-data: - specifier: ^4.0.0 - version: 4.0.1 - got: - specifier: ^12.5.1 - version: 12.6.1 - stream: - specifier: ^0.0.2 - version: 0.0.2 - util: - specifier: ^0.12.4 - version: 0.12.5 + specifier: ^4.4.1 + version: 4.4.1 components/cloudflare_browser_rendering: dependencies: @@ -2671,8 +2659,8 @@ importers: components/cloudmersive: dependencies: '@pipedream/platform': - specifier: ^1.2.1 - version: 1.6.6 + specifier: ^3.1.0 + version: 3.1.0 '@pipedream/types': specifier: ^0.1.4 version: 0.1.6 @@ -3001,8 +2989,8 @@ importers: components/convertapi: dependencies: '@pipedream/platform': - specifier: ^3.0.3 - version: 3.0.3 + specifier: ^3.1.0 + version: 3.1.0 form-data: specifier: ^4.0.2 version: 4.0.2 @@ -3107,8 +3095,8 @@ importers: components/crowdin: dependencies: '@pipedream/platform': - specifier: ^3.0.3 - version: 3.0.3 + specifier: ^3.1.0 + version: 3.1.0 fs: specifier: ^0.0.1-security version: 0.0.1-security @@ -3375,17 +3363,14 @@ importers: components/deepgram: dependencies: '@pipedream/platform': - specifier: ^1.5.1 - version: 1.6.6 + specifier: ^3.1.0 + version: 3.1.0 components/deepimage: dependencies: '@pipedream/platform': - specifier: ^3.0.3 - version: 3.0.3 - fs: - specifier: ^0.0.1-security - version: 0.0.1-security + specifier: ^3.1.0 + version: 3.1.0 components/deepl: {} @@ -3397,8 +3382,7 @@ importers: components/deepsouce: {} - components/deepsource: - specifiers: {} + components/deepsource: {} components/defastra: dependencies: @@ -3535,9 +3519,9 @@ importers: components/diffchecker: dependencies: - axios: - specifier: ^1.6.1 - version: 1.7.7 + '@pipedream/platform': + specifier: ^3.1.0 + version: 3.1.0 form-data: specifier: ^4.0.0 version: 4.0.1 @@ -3566,15 +3550,9 @@ importers: '@aws-sdk/client-s3': specifier: ^3.231.0 version: 3.698.0(aws-crt@1.25.0) - '@pipedream/aws': - specifier: ^0.7.0 - version: 0.7.0(aws-crt@1.25.0)(babel-plugin-macros@3.1.0) - '@pipedream/helper_functions': - specifier: ^0.3.8 - version: 0.3.13 '@pipedream/platform': - specifier: ^1.2.1 - version: 1.6.6 + specifier: ^3.1.0 + version: 3.1.0 fs: specifier: ^0.0.1-security version: 0.0.1-security @@ -3606,14 +3584,14 @@ importers: components/discord: dependencies: '@pipedream/platform': - specifier: ^1.4.0 - version: 1.6.6 + specifier: ^3.1.0 + version: 3.1.0 components/discord_bot: dependencies: '@pipedream/platform': - specifier: ^3.0.3 - version: 3.0.3 + specifier: ^3.1.0 + version: 3.1.0 form-data: specifier: ^4.0.0 version: 4.0.1 @@ -3681,8 +3659,8 @@ importers: components/docparser: dependencies: '@pipedream/platform': - specifier: ^3.0.3 - version: 3.0.3 + specifier: ^3.1.0 + version: 3.1.0 components/docraptor: {} @@ -3729,8 +3707,8 @@ importers: components/documentpro: dependencies: '@pipedream/platform': - specifier: ^3.0.0 - version: 3.0.3 + specifier: ^3.1.0 + version: 3.1.0 form-data: specifier: ^4.0.0 version: 4.0.1 @@ -3859,8 +3837,8 @@ importers: components/dreamstudio: dependencies: '@pipedream/platform': - specifier: ^1.5.1 - version: 1.6.6 + specifier: ^3.1.0 + version: 3.1.0 form-data: specifier: ^4.0.0 version: 4.0.1 @@ -3906,8 +3884,8 @@ importers: components/dromo: dependencies: '@pipedream/platform': - specifier: ^1.5.1 - version: 1.6.6 + specifier: ^3.1.0 + version: 3.1.0 components/dropboard: dependencies: @@ -4097,8 +4075,8 @@ importers: components/eden_ai: dependencies: '@pipedream/platform': - specifier: ^1.5.1 - version: 1.6.6 + specifier: ^3.1.0 + version: 3.1.0 form-data: specifier: ^4.0.0 version: 4.0.1 @@ -4439,8 +4417,8 @@ importers: components/ezeep_blue: dependencies: '@pipedream/platform': - specifier: ^1.5.1 - version: 1.6.6 + specifier: ^3.1.0 + version: 3.1.0 form-data: specifier: ^4.0.0 version: 4.0.1 @@ -4605,8 +4583,8 @@ importers: components/filestack: dependencies: '@pipedream/platform': - specifier: ^1.6.0 - version: 1.6.6 + specifier: ^3.1.0 + version: 3.1.0 components/fillout: dependencies: @@ -4736,8 +4714,8 @@ importers: components/flipando: dependencies: '@pipedream/platform': - specifier: ^1.6.5 - version: 1.6.6 + specifier: ^3.1.0 + version: 3.1.0 form-data: specifier: ^4.0.0 version: 4.0.1 @@ -4896,8 +4874,8 @@ importers: components/formstack_documents: dependencies: '@pipedream/platform': - specifier: ^1.5.1 - version: 1.6.6 + specifier: ^3.1.0 + version: 3.1.0 components/formtitan: dependencies: @@ -5125,8 +5103,8 @@ importers: components/generated_photos: dependencies: '@pipedream/platform': - specifier: ^1.5.1 - version: 1.6.6 + specifier: ^3.1.0 + version: 3.1.0 form-data: specifier: ^4.0.0 version: 4.0.1 @@ -5299,8 +5277,8 @@ importers: components/gladia: dependencies: '@pipedream/platform': - specifier: ^1.5.1 - version: 1.6.6 + specifier: ^3.1.0 + version: 3.1.0 form-data: specifier: ^4.0.0 version: 4.0.1 @@ -5534,8 +5512,8 @@ importers: components/google_cloud_vision_api: dependencies: '@pipedream/platform': - specifier: ^1.6.0 - version: 1.6.6 + specifier: ^3.1.0 + version: 3.1.0 components/google_contacts: dependencies: @@ -5551,6 +5529,9 @@ importers: '@google-cloud/dialogflow': specifier: ^5.1.0 version: 5.9.0 + '@pipedream/platform': + specifier: ^3.1.0 + version: 3.1.0 components/google_directory: {} @@ -5601,8 +5582,8 @@ importers: components/google_gemini: dependencies: '@pipedream/platform': - specifier: ^3.0.3 - version: 3.0.3 + specifier: ^3.1.0 + version: 3.1.0 mime: specifier: ^4.0.7 version: 4.0.7 @@ -5656,8 +5637,8 @@ importers: components/google_photos: dependencies: '@pipedream/platform': - specifier: ^1.5.1 - version: 1.6.6 + specifier: ^3.1.0 + version: 3.1.0 mime: specifier: ^3.0.0 version: 3.0.0 @@ -5829,8 +5810,8 @@ importers: components/gptzero_detect_ai: dependencies: '@pipedream/platform': - specifier: ^3.0.1 - version: 3.0.3 + specifier: ^3.1.0 + version: 3.1.0 form-data: specifier: ^4.0.0 version: 4.0.1 @@ -5864,8 +5845,8 @@ importers: components/greenhouse: dependencies: '@pipedream/platform': - specifier: ^1.6.5 - version: 1.6.6 + specifier: ^3.1.0 + version: 3.1.0 components/greenhouse_job_board_api: {} @@ -6010,8 +5991,8 @@ importers: components/hathr_ai: dependencies: '@pipedream/platform': - specifier: ^3.0.3 - version: 3.0.3 + specifier: ^3.1.0 + version: 3.1.0 mime-types: specifier: ^3.0.1 version: 3.0.1 @@ -6187,8 +6168,8 @@ importers: components/hippo_video: dependencies: '@pipedream/platform': - specifier: ^1.6.5 - version: 1.6.6 + specifier: ^3.1.0 + version: 3.1.0 form-data: specifier: ^4.0.0 version: 4.0.1 @@ -6485,8 +6466,8 @@ importers: components/ignisign: dependencies: '@pipedream/platform': - specifier: ^3.0.3 - version: 3.0.3 + specifier: ^3.1.0 + version: 3.1.0 form-data: specifier: ^4.0.1 version: 4.0.1 @@ -6528,8 +6509,8 @@ importers: components/imagekit_io: dependencies: '@pipedream/platform': - specifier: ^1.5.1 - version: 1.6.6 + specifier: ^3.1.0 + version: 3.1.0 form-data: specifier: ^4.0.0 version: 4.0.1 @@ -6572,7 +6553,11 @@ importers: components/imejis_io: {} - components/imgbb: {} + components/imgbb: + dependencies: + '@pipedream/platform': + specifier: ^3.1.0 + version: 3.1.0 components/imgix: {} @@ -6841,8 +6826,8 @@ importers: components/jigsawstack: dependencies: '@pipedream/platform': - specifier: ^3.0.1 - version: 3.0.3 + specifier: ^3.1.0 + version: 3.1.0 form-data: specifier: ^4.0.0 version: 4.0.1 @@ -6853,8 +6838,8 @@ importers: components/jina_reader: dependencies: '@pipedream/platform': - specifier: 3.0.3 - version: 3.0.3 + specifier: ^3.1.0 + version: 3.1.0 components/jira: dependencies: @@ -6887,8 +6872,8 @@ importers: components/jobnimbus: dependencies: '@pipedream/platform': - specifier: ^1.5.1 - version: 1.6.6 + specifier: ^3.1.0 + version: 3.1.0 components/join: {} @@ -7241,8 +7226,8 @@ importers: components/lamini: dependencies: '@pipedream/platform': - specifier: ^3.0.3 - version: 3.0.3 + specifier: ^3.1.0 + version: 3.1.0 components/landbot: dependencies: @@ -7527,8 +7512,8 @@ importers: components/linkedin: dependencies: '@pipedream/platform': - specifier: ^3.0.3 - version: 3.0.3 + specifier: ^3.1.0 + version: 3.1.0 axios: specifier: ^1.2.3 version: 1.7.7 @@ -7644,8 +7629,8 @@ importers: components/lmnt: dependencies: '@pipedream/platform': - specifier: ^1.5.1 - version: 1.6.6 + specifier: ^3.1.0 + version: 3.1.0 form-data: specifier: ^4.0.0 version: 4.0.1 @@ -11611,8 +11596,7 @@ importers: specifier: ^2.3.0 version: 2.3.0 - components/salesroom: - specifiers: {} + components/salesroom: {} components/salestown: {} @@ -18783,9 +18767,6 @@ packages: '@pdfless/pdfless-js@1.0.510': resolution: {integrity: sha512-RmbzdGQcWy/OSuPF/eaT0wQsi9ELu465/r/8DsgajbHumStHrkzRqsm330g1PgBgQipZMi9ZTTHfP4i/Sbs+pw==} - '@pipedream/aws@0.7.0': - resolution: {integrity: sha512-msYqK4BGcCtdBy7+eyNrraXPIi2ZcDAdI0KAkdT0y45NNf4l5ST3auwAn1azJJvx5lw8yTaGZawvAPSVLuRxUw==} - '@pipedream/brex@0.1.0': resolution: {integrity: sha512-Cq/A6fwVEb9kAGiAtcPlNpL1JJhBevMxOnMhQzUkUxzQTBNedsmvMzW963cNxqG45V4fyOBuHEPoXl3meH4ATg==} @@ -21542,9 +21523,6 @@ packages: asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} - autocreate@1.2.0: - resolution: {integrity: sha512-69hVJ14Nm6rP5b4fd5TQGbBCPxH3M4L+/eDrCePoa3dCyNHWFS/HhE8mY6DG5q6LMscjMcjpSwEsX8G+8jT5ZA==} - autoprefixer@10.4.20: resolution: {integrity: sha512-XY25y5xSv/wEoqzDyXXME4AFfkZI0P23z6Fs3YgymDnKJkCGOnkL0iTxCa85UTqaSgfcqyf3UA6+c7wUvx/16g==} engines: {node: ^10 || ^12 || >=14} @@ -21969,10 +21947,6 @@ packages: caniuse-lite@1.0.30001683: resolution: {integrity: sha512-iqmNnThZ0n70mNwvxpEC2nBJ037ZHZUoBI5Gorh1Mw6IlEAZujEoU1tXA628iZfzm7R9FvFzxbfdgml82a3k8Q==} - capture-stack-trace@1.0.2: - resolution: {integrity: sha512-X/WM2UQs6VMHUtjUDnZTRI+i1crWteJySFzr9UpGoQa4WQffXVTTXuekjl7TjZRlcF2XfjgITT0HxZ9RnxeT0w==} - engines: {node: '>=0.10.0'} - cardinal@0.4.4: resolution: {integrity: sha512-3MxV0o9wOpQcobrcSrRpaSxlYkohCcZu0ytOjJUww/Yo/223q4Ecloo7odT+M0SI5kPgb1JhvSaF4EEuVXOLAQ==} hasBin: true @@ -22168,8 +22142,8 @@ packages: resolution: {integrity: sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==} engines: {node: '>=0.8'} - cloudflare@2.9.1: - resolution: {integrity: sha512-x8yXPPoloy7xQ9GCKnsvQ3U1nwvcLndA2B3nxwSjIWxgLTUJOyakeEDsrqxZO8Dr6FkGdaXwy554fQVMpOabiw==} + cloudflare@4.4.1: + resolution: {integrity: sha512-wrtQ9WMflnfRcmdQZf/XfVVkeucgwzzYeqFDfgbNdADTaexsPwrtt3etzUvPGvVUeEk9kOPfNkl8MSzObxrIsg==} cloudinary@2.5.1: resolution: {integrity: sha512-CNg6uU53Hl4FEVynkTGpt5bQEAQWDHi3H+Sm62FzKf5uQHipSN2v7qVqS8GRVqeb0T1WNV+22+75DOJeRXYeSQ==} @@ -22458,10 +22432,6 @@ packages: crc@3.8.0: resolution: {integrity: sha512-iX3mfgcTMIq3ZKLIsVFAbv7+Mc10kxabAGQb8HvjA1o3T1PIYprbakQ65d3I+2HGHt6nSKkM9PYjgoJO2KcFBQ==} - create-error-class@3.0.2: - resolution: {integrity: sha512-gYTKKexFO3kh200H1Nit76sRwRtOY32vQd3jpAQKpLtZqyNsSQNfI4N7o3eP2wUjV35pTWKRYqFUDBvUha/Pkw==} - engines: {node: '>=0.10.0'} - create-hash@1.2.0: resolution: {integrity: sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==} @@ -23148,9 +23118,6 @@ packages: resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} engines: {node: '>= 0.4'} - duplexer3@0.1.5: - resolution: {integrity: sha512-1A8za6ws41LQgv9HrE/66jyC5yuSjQ3L/KOpFtoBilsAK2iA2wuS5rTt1OCzIvtS2V7nVmedsUU+DGRcjBmOYA==} - duplexer@0.1.2: resolution: {integrity: sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==} @@ -23280,9 +23247,6 @@ packages: es-array-method-boxes-properly@1.0.0: resolution: {integrity: sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==} - es-class@2.1.1: - resolution: {integrity: sha512-loFNtCIGY81XvaHMzsxPocOgwZW71p+d/iES+zDSWeK9D4JaxrR/AoO0sZnWbV39D/ESppKbHrApxMi+Vbl8rg==} - es-define-property@1.0.0: resolution: {integrity: sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==} engines: {node: '>= 0.4'} @@ -24269,10 +24233,6 @@ packages: resolution: {integrity: sha512-zRKcywvrXlXsA0v0i9Io4KDRaAw7+a1ZpjRwl9Wox8PFlVCCHra7E9c4kqXCoCM9nR5tBkaTTZRBoCm60bFqTQ==} engines: {node: '>=8'} - get-stream@3.0.0: - resolution: {integrity: sha512-GlhdIUuVakc8SJ6kK0zAFbiGzRFzNnY4jUuEbV9UROo4Y+0Ny4fjvcZFVTeDA4odpFyOQzaw6hXukJSq/f28sQ==} - engines: {node: '>=4'} - get-stream@4.1.0: resolution: {integrity: sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==} engines: {node: '>=6'} @@ -24504,10 +24464,6 @@ packages: resolution: {integrity: sha512-rnhwfM/PhMNJ1i17k3DuDqgj0cKx3IHxBKVv/WX1uDKqrhi2Gv3l7rhPThR/Cc6uU++dD97W9c8Y0qyw9x0jag==} engines: {node: '>=20'} - got@6.7.1: - resolution: {integrity: sha512-Y/K3EDuiQN9rTZhBvPRWMLXIKdeD1Rj0nzunfoi0Yyn5WBEbzxXKU9Ub2X41oZBagVWOBU3MuDonFMgPWQFnwg==} - engines: {node: '>=4'} - graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} @@ -25183,10 +25139,6 @@ packages: is-property@1.0.2: resolution: {integrity: sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g==} - is-redirect@1.0.0: - resolution: {integrity: sha512-cr/SlUEe5zOGmzvj9bUyC4LVvkNVAXu4GytXLNMr1pny+a65MpQ9IJzFHD5vi7FyJgb4qt27+eS3TuQnqB+RQw==} - engines: {node: '>=0.10.0'} - is-regex@1.1.4: resolution: {integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==} engines: {node: '>= 0.4'} @@ -25195,10 +25147,6 @@ packages: resolution: {integrity: sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==} engines: {node: '>=0.10.0'} - is-retry-allowed@1.2.0: - resolution: {integrity: sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg==} - engines: {node: '>=0.10.0'} - is-set@2.0.3: resolution: {integrity: sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==} engines: {node: '>= 0.4'} @@ -26139,10 +26087,6 @@ packages: resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} hasBin: true - lowercase-keys@1.0.1: - resolution: {integrity: sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==} - engines: {node: '>=0.10.0'} - lowercase-keys@2.0.0: resolution: {integrity: sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==} engines: {node: '>=8'} @@ -27846,10 +27790,6 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} - prepend-http@1.0.4: - resolution: {integrity: sha512-PhmXi5XmoyKw1Un4E+opM2KcsJInDvKyuOumcjjw3waw86ZNjHwVUOOWLc4bCzLdcKNaWBH9e99sbWzDQsVaYg==} - engines: {node: '>=0.10.0'} - prettier-linter-helpers@1.0.0: resolution: {integrity: sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==} engines: {node: '>=6.0.0'} @@ -28794,9 +28734,6 @@ packages: should-format@3.0.3: resolution: {integrity: sha512-hZ58adtulAk0gKtua7QxevgUaXTTXxIi8t41L3zo9AHvjXO1/7sdLECuHeIN2SRtYXpNkmhoUP2pdeWgricQ+Q==} - should-proxy@1.0.4: - resolution: {integrity: sha512-RPQhIndEIVUCjkfkQ6rs6sOR6pkxJWCNdxtfG5pP0RVgUYbK5911kLTF0TNcCC0G3YCGd492rMollFT2aTd9iQ==} - should-type-adaptors@1.1.0: resolution: {integrity: sha512-JA4hdoLnN+kebEp2Vs8eBe9g7uy0zbRo+RMcU0EsNy+R+k049Ki+N5tT5Jagst2g7EAja+euFuoXFCa8vIklfA==} @@ -29462,10 +29399,6 @@ packages: through@2.3.8: resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==} - timed-out@4.0.1: - resolution: {integrity: sha512-G7r3AhovYtr5YKOWQkta8RKAPb+J9IsO4uVmzjl8AZwfhs8UcUwTiD6gcJYSgOtzyjvQKrKYn41syHbUWMkafA==} - engines: {node: '>=0.10.0'} - timer-node@5.0.7: resolution: {integrity: sha512-M1aP6ASmuVD0PSxl5fqjCAGY9WyND3DHZ8RwT5I8o7469XE53Lb5zbPai20Dhj7TProyaapfVj3TaT0P+LoSEA==} @@ -29997,10 +29930,6 @@ packages: resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} engines: {node: '>= 0.8'} - unzip-response@2.0.1: - resolution: {integrity: sha512-N0XH6lqDtFH84JxptQoZYmloF4nzrQqqrAymNj+/gW60AO2AZgOcf4O/nUXJcYfyQkqvMo9lSupBZmmgvuVXlw==} - engines: {node: '>=4'} - update-browserslist-db@1.1.1: resolution: {integrity: sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==} hasBin: true @@ -30023,17 +29952,9 @@ packages: url-join@4.0.1: resolution: {integrity: sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==} - url-parse-lax@1.0.0: - resolution: {integrity: sha512-BVA4lR5PIviy2PMseNd2jbFQ+jwSwQGdJejf5ctd1rEXt0Ypd7yanUK9+lYechVlN5VaTJGsu2U/3MDDu6KgBA==} - engines: {node: '>=0.10.0'} - url-parse@1.5.10: resolution: {integrity: sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==} - url-pattern@1.0.3: - resolution: {integrity: sha512-uQcEj/2puA4aq1R3A2+VNVBgaWYR24FdWjl7VNW83rnWftlhyzOZ/tBjezRiC2UkIzuxC8Top3IekN3vUf1WxA==} - engines: {node: '>=0.12.0'} - url-template@2.0.8: resolution: {integrity: sha512-XdVKMF4SJ0nP/O7XIPB0JwAEuT9lDIYnNsK8yGVe43y0AWoKeJNdv3ZNWh7ksJ6KqQFjOO6ox/VEitLnaVNufw==} @@ -35481,37 +35402,6 @@ snapshots: '@microsoft/kiota-serialization-json': 1.0.0-preview.77 '@microsoft/kiota-serialization-text': 1.0.0-preview.77 - '@pipedream/aws@0.7.0(aws-crt@1.25.0)(babel-plugin-macros@3.1.0)': - dependencies: - '@aws-sdk/client-cloudwatch-logs': 3.698.0(aws-crt@1.25.0) - '@aws-sdk/client-dynamodb': 3.696.0(aws-crt@1.25.0) - '@aws-sdk/client-dynamodb-streams': 3.696.0(aws-crt@1.25.0) - '@aws-sdk/client-ec2': 3.698.0(aws-crt@1.25.0) - '@aws-sdk/client-eventbridge': 3.696.0(aws-crt@1.25.0) - '@aws-sdk/client-iam': 3.696.0(aws-crt@1.25.0) - '@aws-sdk/client-lambda': 3.698.0(aws-crt@1.25.0) - '@aws-sdk/client-rds': 3.697.0(aws-crt@1.25.0) - '@aws-sdk/client-s3': 3.698.0(aws-crt@1.25.0) - '@aws-sdk/client-ses': 3.696.0(aws-crt@1.25.0) - '@aws-sdk/client-sfn': 3.696.0(aws-crt@1.25.0) - '@aws-sdk/client-sns': 3.696.0(aws-crt@1.25.0) - '@aws-sdk/client-sqs': 3.696.0(aws-crt@1.25.0) - '@aws-sdk/client-ssm': 3.698.0(aws-crt@1.25.0) - '@aws-sdk/client-sts': 3.696.0(aws-crt@1.25.0) - '@aws-sdk/s3-request-presigner': 3.698.0 - '@pipedream/helper_functions': 0.3.13 - '@pipedream/platform': 1.6.6 - adm-zip: 0.5.16 - dedent: 1.5.3(babel-plugin-macros@3.1.0) - mailparser: 3.7.1 - mailparser-mit: 1.0.0 - nanoid: 5.0.8 - uuid: 9.0.1 - transitivePeerDependencies: - - aws-crt - - babel-plugin-macros - - debug - '@pipedream/brex@0.1.0': dependencies: '@pipedream/platform': 1.6.6 @@ -38227,7 +38117,6 @@ snapshots: '@types/node@24.0.0': dependencies: undici-types: 7.8.0 - optional: true '@types/normalize-package-data@2.4.4': {} @@ -38334,7 +38223,7 @@ snapshots: '@types/ws@8.5.13': dependencies: - '@types/node': 20.17.30 + '@types/node': 24.0.0 '@types/ws@8.5.3': dependencies: @@ -38918,8 +38807,6 @@ snapshots: asynckit@0.4.0: {} - autocreate@1.2.0: {} - autoprefixer@10.4.20(postcss@8.4.49): dependencies: browserslist: 4.24.2 @@ -39526,8 +39413,6 @@ snapshots: caniuse-lite@1.0.30001683: {} - capture-stack-trace@1.0.2: {} - cardinal@0.4.4: dependencies: ansicolors: 0.2.1 @@ -39726,17 +39611,17 @@ snapshots: clone@1.0.4: {} - cloudflare@2.9.1: + cloudflare@4.4.1: dependencies: - autocreate: 1.2.0 - es-class: 2.1.1 - got: 6.7.1 - https-proxy-agent: 5.0.1 - object-assign: 4.1.1 - should-proxy: 1.0.4 - url-pattern: 1.0.3 + '@types/node': 18.19.111 + '@types/node-fetch': 2.6.12 + abort-controller: 3.0.0 + agentkeepalive: 4.5.0 + form-data-encoder: 1.7.2 + formdata-node: 4.4.1 + node-fetch: 2.7.0 transitivePeerDependencies: - - supports-color + - encoding cloudinary@2.5.1: dependencies: @@ -40047,10 +39932,6 @@ snapshots: dependencies: buffer: 5.7.1 - create-error-class@3.0.2: - dependencies: - capture-stack-trace: 1.0.2 - create-hash@1.2.0: dependencies: cipher-base: 1.0.5 @@ -40814,8 +40695,6 @@ snapshots: es-errors: 1.3.0 gopd: 1.2.0 - duplexer3@0.1.5: {} - duplexer@0.1.2: {} duplexify@3.7.1: @@ -40982,8 +40861,6 @@ snapshots: es-array-method-boxes-properly@1.0.0: {} - es-class@2.1.1: {} - es-define-property@1.0.0: dependencies: get-intrinsic: 1.3.0 @@ -42367,8 +42244,6 @@ snapshots: get-stdin@7.0.0: {} - get-stream@3.0.0: {} - get-stream@4.1.0: dependencies: pump: 3.0.2 @@ -42806,22 +42681,6 @@ snapshots: responselike: 3.0.0 type-fest: 4.27.0 - got@6.7.1: - dependencies: - '@types/keyv': 3.1.4 - '@types/responselike': 1.0.3 - create-error-class: 3.0.2 - duplexer3: 0.1.5 - get-stream: 3.0.0 - is-redirect: 1.0.0 - is-retry-allowed: 1.2.0 - is-stream: 1.1.0 - lowercase-keys: 1.0.1 - safe-buffer: 5.2.1 - timed-out: 4.0.1 - unzip-response: 2.0.1 - url-parse-lax: 1.0.0 - graceful-fs@4.2.11: {} grapheme-splitter@1.0.4: {} @@ -43582,8 +43441,6 @@ snapshots: is-property@1.0.2: {} - is-redirect@1.0.0: {} - is-regex@1.1.4: dependencies: call-bind: 1.0.7 @@ -43593,8 +43450,6 @@ snapshots: dependencies: is-unc-path: 1.0.0 - is-retry-allowed@1.2.0: {} - is-set@2.0.3: {} is-shared-array-buffer@1.0.3: @@ -44898,8 +44753,6 @@ snapshots: dependencies: js-tokens: 4.0.0 - lowercase-keys@1.0.1: {} - lowercase-keys@2.0.0: {} lowercase-keys@3.0.0: {} @@ -47224,8 +47077,6 @@ snapshots: prelude-ls@1.2.1: {} - prepend-http@1.0.4: {} - prettier-linter-helpers@1.0.0: dependencies: fast-diff: 1.3.0 @@ -48395,7 +48246,7 @@ snapshots: resolve@1.22.8: dependencies: - is-core-module: 2.15.1 + is-core-module: 2.16.1 path-parse: 1.0.7 supports-preserve-symlinks-flag: 1.0.0 @@ -48828,8 +48679,6 @@ snapshots: should-type: 1.4.0 should-type-adaptors: 1.1.0 - should-proxy@1.0.4: {} - should-type-adaptors@1.1.0: dependencies: should-type: 1.4.0 @@ -49733,8 +49582,6 @@ snapshots: through@2.3.8: {} - timed-out@4.0.1: {} - timer-node@5.0.7: {} timers-ext@0.1.8: @@ -50200,8 +50047,7 @@ snapshots: undici-types@6.21.0: {} - undici-types@7.8.0: - optional: true + undici-types@7.8.0: {} undici@5.28.4: dependencies: @@ -50361,8 +50207,6 @@ snapshots: unpipe@1.0.0: {} - unzip-response@2.0.1: {} - update-browserslist-db@1.1.1(browserslist@4.24.2): dependencies: browserslist: 4.24.2 @@ -50387,17 +50231,11 @@ snapshots: url-join@4.0.1: {} - url-parse-lax@1.0.0: - dependencies: - prepend-http: 1.0.4 - url-parse@1.5.10: dependencies: querystringify: 2.2.0 requires-port: 1.0.0 - url-pattern@1.0.3: {} - url-template@2.0.8: {} url@0.11.4: