diff --git a/components/convertapi/.gitignore b/components/convertapi/.gitignore deleted file mode 100644 index ec761ccab7595..0000000000000 --- a/components/convertapi/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.js -*.mjs -dist \ No newline at end of file diff --git a/components/convertapi/actions/convert-base64-encoded-file/convert-base64-encoded-file.mjs b/components/convertapi/actions/convert-base64-encoded-file/convert-base64-encoded-file.mjs new file mode 100644 index 0000000000000..2c4feced9385e --- /dev/null +++ b/components/convertapi/actions/convert-base64-encoded-file/convert-base64-encoded-file.mjs @@ -0,0 +1,79 @@ +import FormData from "form-data"; +import { saveFile } from "../../common/utils.mjs"; +import convertapi from "../../convertapi.app.mjs"; + +export default { + key: "convertapi-convert-base64-encoded-file", + name: "Convert Base64 Encoded File", + description: "This action converts a base64-string-encoded file into the user-specified format. [See the documentation](https://v2.convertapi.com/info/openapi)", + version: "0.0.1", + type: "action", + props: { + convertapi, + base64String: { + propDefinition: [ + convertapi, + "base64String", + ], + }, + filename: { + type: "string", + label: "Filename", + description: "Converted output file name without extension. The extension will be added automatically.", + }, + formatFrom: { + propDefinition: [ + convertapi, + "formatFrom", + ], + reloadProps: true, + }, + }, + async additionalProps() { + const props = {}; + if (this.formatFrom) { + const { paths } = await this.convertapi.getAllowedFormats({ + formatFrom: this.formatFrom, + }); + + const str = `/convert/${this.formatFrom}/to/`; + + const allowedFormats = Object.keys(paths).filter((format) => { + if (format.startsWith(str)) { + return true; + } + }) + .map((format) => format.slice(str.length)); + + props.formatTo = { + type: "string", + label: "Format To", + description: "The format to convert the file to.", + options: allowedFormats, + }; + } + return props; + }, + async run({ $ }) { + const buffer = Buffer.from(this.base64String, "base64"); + const data = new FormData(); + data.append("File", buffer, `${this.filename}.${this.formatFrom}`); + + const { Files } = await this.convertapi.convertFileToFormat({ + $, + data, + maxBodyLength: Infinity, + headers: data.getHeaders(), + formatFrom: this.formatFrom, + formatTo: this.formatTo, + }); + + await saveFile(Files); + const filename = Files[0].FileName; + + $.export("$summary", `Successfully converted base64 encoded file to ${this.formatTo} and saved in /tmp directory as **${filename}**.`); + return { + filepath: `/tmp/${filename}`, + }; + }, +}; diff --git a/components/convertapi/actions/convert-file/convert-file.mjs b/components/convertapi/actions/convert-file/convert-file.mjs new file mode 100644 index 0000000000000..c04afdf7250a1 --- /dev/null +++ b/components/convertapi/actions/convert-file/convert-file.mjs @@ -0,0 +1,80 @@ +import FormData from "form-data"; +import fs from "fs"; +import { + checkTmp, 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", + 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)", + }, + formatFrom: { + propDefinition: [ + convertapi, + "formatFrom", + ], + reloadProps: true, + }, + }, + async additionalProps() { + const props = {}; + if (this.formatFrom) { + const { paths } = await this.convertapi.getAllowedFormats({ + formatFrom: this.formatFrom, + }); + + const str = `/convert/${this.formatFrom}/to/`; + + const allowedFormats = Object.keys(paths).filter((format) => { + if (format.startsWith(str)) { + return true; + } + }) + .map((format) => format.slice(str.length)); + + props.formatTo = { + type: "string", + label: "Format To", + description: "The format to convert the file to.", + options: allowedFormats, + }; + } + return props; + }, + async run({ $ }) { + try { + const file = fs.createReadStream(checkTmp(this.file)); + const data = new FormData(); + data.append("File", file); + + const { Files } = await this.convertapi.convertFileToFormat({ + $, + data, + maxBodyLength: Infinity, + headers: data.getHeaders(), + formatFrom: this.formatFrom, + formatTo: this.formatTo, + }); + + await saveFile(Files); + const filename = Files[0].FileName; + + $.export("$summary", `Successfully converted file to ${this.formatTo} format and saved in /tmp directory as **${filename}**.`); + return { + filepath: `/tmp/${filename}`, + }; + } catch (error) { + throw new Error(`Failed to convert file: ${error.message}`); + } + }, +}; diff --git a/components/convertapi/actions/convert-web-url/convert-web-url.mjs b/components/convertapi/actions/convert-web-url/convert-web-url.mjs new file mode 100644 index 0000000000000..9e2a69a995d23 --- /dev/null +++ b/components/convertapi/actions/convert-web-url/convert-web-url.mjs @@ -0,0 +1,445 @@ +import FormData from "form-data"; +import { + CSS_MEDIA_TYTPE_OPTIONS, + FIXED_ELEMENTS_OPTIONS, + FORMAT_TO_OPTIONS, + PAGE_ORIENTATION_OPTIONS, + PAGE_SIZE_OPTIONS, +} from "../../common/constants.mjs"; +import { saveFile } from "../../common/utils.mjs"; +import convertapi from "../../convertapi.app.mjs"; + +export default { + key: "convertapi-convert-web-url", + name: "Convert Web URL to Specified Format", + description: "Converts a website page to a specified format. [See the documentation](https://v2.convertapi.com/info/openapi)", + version: "0.0.1", + type: "action", + props: { + convertapi, + url: { + type: "string", + label: "URL", + description: "The website URL to be converted to a specified format.", + }, + formatTo: { + type: "string", + label: "Format To", + description: "The format you want to convert the URL to.", + options: FORMAT_TO_OPTIONS, + }, + fileName: { + type: "string", + label: "File Name", + description: "Converted output file name without extension. The extension will be added automatically.", + optional: true, + }, + timeout: { + type: "string", + label: "Timeout", + description: "Conversion timeout in seconds.", + optional: true, + }, + conversionDelay: { + type: "integer", + label: "Conversion Delay", + description: "Delay in seconds before page load and file creation. Sometimes useful to let web page fully load.", + optional: true, + }, + authUsername: { + type: "string", + label: "Auth Username", + description: "HTTP authentication username. Could be used if conversion web page is protected with HTTP authentication.", + optional: true, + }, + authPassword: { + type: "string", + label: "Auth Password", + description: "HTTP authentication password. Could be used if conversion web page is protected with HTTP authentication.", + optional: true, + }, + adBlock: { + type: "boolean", + label: "Ad Block", + description: "Block ads in converting page.", + optional: true, + }, + cookieConsentBlock: { + type: "boolean", + label: "Cookie Consent Block", + description: "Tries to remove EU regulation required cookie warnings from web pages.", + optional: true, + }, + cookies: { + type: "string", + label: "Cookies", + description: "Set additional cookies for the page request. Exaple: cookiename1=cookievalue1; cookiename2=cookievalue2; cookiename3=cookievalue3", + optional: true, + }, + javaScript: { + type: "boolean", + label: "JavaScript", + description: "Allow web pages to run JavaScript.", + optional: true, + }, + waitElement: { + type: "string", + label: "Wait Element", + description: "Element selector string of the DOM element. Converter will wait for this element to appear in DOM before conversion begins.", + optional: true, + }, + userJs: { + type: "string", + label: "User JS", + description: "Execute provided JavaScript before conversion begins.", + optional: true, + }, + userCss: { + type: "string", + label: "User CSS", + description: "Apply additional CSS before conversion begins.", + optional: true, + }, + hideElements: { + type: "string", + label: "Hide Elements", + description: "Element selector string of the DOM elements that need to be hidden during conversion.", + optional: true, + }, + cssMediaType: { + type: "string", + label: "CSS Media Type", + description: "Use CSS media type in conversion process.", + options: CSS_MEDIA_TYTPE_OPTIONS, + optional: true, + default: "screen", + }, + imageWidth: { + type: "integer", + label: "Image Width", + description: "Image width in pixels.", + hidden: true, + optional: true, + }, + imageHeight: { + type: "integer", + label: "Image Height", + description: "Image height in pixels.", + hidden: true, + optional: true, + }, + imageQuality: { + type: "integer", + label: "Image Quality", + description: "Set output image quality.", + default: 75, + hidden: true, + optional: true, + }, + cropElement: { + type: "string", + label: "Crop Element", + description: "Element selector string of the DOM element that should be converted. Element will be cropped from the document.", + hidden: true, + optional: true, + }, + cropX: { + type: "integer", + label: "Crop X", + description: "Screenshot crop X offset.", + hidden: true, + optional: true, + }, + cropY: { + type: "integer", + label: "Crop Y", + description: "Screenshot crop Y offset.", + hidden: true, + optional: true, + }, + cropWidth: { + type: "integer", + label: "Crop Width", + description: "Screenshot crop width.", + hidden: true, + optional: true, + }, + cropHeight: { + type: "integer", + label: "Crop Height", + description: "Screenshot crop height.", + hidden: true, + optional: true, + }, + zoom: { + type: "integer", + label: "Zoom", + description: "Set the default zoom level of webpages.", + hidden: true, + optional: true, + }, + loadLazyContent: { + type: "boolean", + label: "Load Lazy Content", + description: "Load page images that loads only when they are visible.", + hidden: true, + optional: true, + }, + viewportWidth: { + type: "integer", + label: "Viewport Width", + description: "Sets browser viewport width.", + hidden: true, + default: 1366, + optional: true, + }, + viewportHeight: { + type: "integer", + label: "Viewport Height", + description: "Sets browser viewport height.", + hidden: true, + default: 1024, + optional: true, + }, + respectViewport: { + type: "boolean", + label: "Respect Viewport", + description: "If true, the converter will generate PDF as the content looks like in the browser. If is set to false, the converter acts like Chrome print to PDF function.", + hidden: true, + optional: true, + }, + scale: { + type: "integer", + label: "Scale", + description: "Set web page scale value in percentage.", + hidden: true, + default: 100, + optional: true, + }, + pageOrientation: { + type: "string", + label: "Page Orientation", + description: "PDF page orientation", + hidden: true, + options: PAGE_ORIENTATION_OPTIONS, + optional: true, + }, + pageSize: { + type: "string", + label: "Page Size", + description: "PDF Page Size", + hidden: true, + options: PAGE_SIZE_OPTIONS, + optional: true, + }, + pageWidth: { + type: "integer", + label: "Page Width", + description: "Custom page width in millimeters (mm). This option override PageSize option.", + hidden: true, + optional: true, + }, + pageHeight: { + type: "integer", + label: "Page Height", + description: "Custom page height in millimeters (mm). This option override PageSize option.", + hidden: true, + optional: true, + }, + marginTop: { + type: "integer", + label: "Margin Top", + description: "Set the page top margin in millimeters (mm).", + hidden: true, + optional: true, + }, + marginRight: { + type: "integer", + label: "Margin Right", + description: "Set the page right margin in millimeters (mm).", + hidden: true, + optional: true, + }, + marginBottom: { + type: "integer", + label: "Margin Bottom", + description: "Set the page bottom margin in millimeters (mm).", + hidden: true, + optional: true, + }, + marginLeft: { + type: "integer", + label: "Margin Left", + description: "Set the page left margin in millimeters (mm).", + hidden: true, + optional: true, + }, + pageRange: { + type: "string", + label: "Page Range", + description: "Set page range. Example 1-10 or 1,2,5.", + hidden: true, + optional: true, + }, + background: { + type: "boolean", + label: "Background", + description: "Convert web page background.", + hidden: true, + optional: true, + }, + fixedElements: { + type: "string", + label: "Fixed Elements", + description: "Change fixed elements CSS 'position' property to adapt page for conversion", + options: FIXED_ELEMENTS_OPTIONS, + hidden: true, + optional: true, + }, + showElements: { + type: "string", + label: "ShowElements", + description: "Element selector string of the DOM elements that should be visible during conversion. Other elements will be hidden.", + hidden: true, + optional: true, + }, + avoidBreakElements: { + type: "string", + label: "Avoid Break Elements", + description: "CSS selector for the elements that pages should not break.", + hidden: true, + optional: true, + }, + breakBeforeElements: { + type: "string", + label: "Break Before Elements", + description: "CSS selector for the elements that should apply page break before it.", + hidden: true, + optional: true, + }, + breakAfterElements: { + type: "string", + label: "Break After Elements", + description: "CSS selector for the elements that should apply page break after it.", + hidden: true, + optional: true, + }, + compressPDF: { + type: "boolean", + label: "Compress PDF", + description: "It tries to produce smaller output files but requires Adobe Reader 6, released in 2003 or newer, to view created PDF files.", + hidden: true, + optional: true, + }, + }, + async additionalProps(props) { + const isJpg = this.formatTo === "jpg"; + + props.imageWidth.hidden = !isJpg; + props.imageHeight.hidden = !isJpg; + props.type.hidden = !isJpg; + props.cropElement.hidden = !isJpg; + props.cropX.hidden = !isJpg; + props.cropY.hidden = !isJpg; + props.cropWidth.hidden = !isJpg; + props.cropHeight.hidden = !isJpg; + props.zoom.hidden = !isJpg; + + props.loadLazyContent.hidden = isJpg; + props.viewportWidth.hidden = isJpg; + props.viewportHeight.hidden = isJpg; + props.respectViewport.hidden = isJpg; + props.scale.hidden = isJpg; + props.pageOrientation.hidden = isJpg; + props.pageSize.hidden = isJpg; + props.pageWidth.hidden = isJpg; + props.pageHeight.hidden = isJpg; + props.marginTop.hidden = isJpg; + props.marginRight.hidden = isJpg; + props.marginBottom.hidden = isJpg; + props.marginLeft.hidden = isJpg; + props.pageRange.hidden = isJpg; + props.background.hidden = isJpg; + props.fixedElements.hidden = isJpg; + props.showElements.hidden = isJpg; + props.avoidBreakElements.hidden = isJpg; + props.breakBeforeElements.hidden = isJpg; + props.breakAfterElements.hidden = isJpg; + props.compressPDF.hidden = isJpg; + + return {}; + }, + async run({ $ }) { + try { + const data = new FormData(); + + data.append("Url", this.url); + if (this.fileName) data.append("FileName", this.fileName); + if (this.timeout) data.append("Timeout", this.timeout); + if (this.conversionDelay) data.append("ConversionDelay", this.conversionDelay); + if (this.authUsername) data.append("AuthUsername", this.authUsername); + if (this.authPassword) data.append("AuthPassword", this.authPassword); + if (this.adBlock) data.append("AdBlock", `${this.adBlock}`); + if (this.cookieConsentBlock) data.append("CookieConsentBlock", `${this.cookieConsentBlock}`); + if (this.cookies) data.append("Cookies", this.cookies); + if (this.javaScript) data.append("JavaScript", `${this.javaScript}`); + if (this.waitElement) data.append("WaitElement", this.waitElement); + if (this.userJs) data.append("UserJs", this.userJs); + if (this.userCss) data.append("UserCss", this.userCss); + if (this.hideElements) data.append("HideElements", this.hideElements); + if (this.cssMediaType) data.append("CssMediaType", this.cssMediaType); + + if (this.formatTo === "jpg") { + if (this.imageWidth) data.append("ImageWidth", this.imageWidth); + if (this.imageHeight) data.append("ImageHeight", this.imageHeight); + if (this.type) data.append("Type", this.type); + if (this.cropElement) data.append("CropElement", this.cropElement); + if (this.cropX) data.append("CropX", this.cropX); + if (this.cropY) data.append("CropY", this.cropY); + if (this.cropWidth) data.append("CropWidth", this.cropWidth); + if (this.cropHeight) data.append("CropHeight", this.cropHeight); + if (this.zoom) data.append("Zoom", this.zoom); + } else { + if (this.loadLazyContent) data.append("LoadLazyContent", `${this.loadLazyContent}`); + if (this.viewportWidth) data.append("ViewportWidth", this.viewportWidth); + if (this.viewportHeight) data.append("ViewportHeight", this.viewportHeight); + if (this.respectViewport) data.append("RespectViewport", `${this.respectViewport}`); + if (this.scale) data.append("Scale", this.scale); + if (this.pageOrientation) data.append("PageOrientation", this.pageOrientation); + if (this.pageSize) data.append("PageSize", this.pageSize); + if (this.pageWidth) data.append("PageWidth", this.pageWidth); + if (this.pageHeight) data.append("PageHeight", this.pageHeight); + if (this.marginTop) data.append("MarginTop", this.marginTop); + if (this.marginRight) data.append("MarginRight", this.marginRight); + if (this.marginBottom) data.append("MarginBottom", this.marginBottom); + if (this.marginLeft) data.append("MarginLeft", this.marginLeft); + if (this.pageRange) data.append("PageRange", this.pageRange); + if (this.background) data.append("Background", `${this.background}`); + if (this.fixedElements) data.append("FixedElements", this.fixedElements); + if (this.showElements) data.append("ShowElements", this.showElements); + if (this.avoidBreakElements) data.append("AvoidBreakElements", this.avoidBreakElements); + if (this.breakBeforeElements) data.append("BreakBeforeElements", this.breakBeforeElements); + if (this.breakAfterElements) data.append("BreakAfterElements", this.breakAfterElements); + if (this.compressPDF) data.append("CompressPDF", `${this.compressPDF}`); + } + + const { Files } = await this.convertapi.convertWebToFormat({ + $, + formatTo: this.formatTo, + data, + headers: data.getHeaders(), + timeout: this.timeout ? 2000 * Number(this.timeout) : undefined, + }); + + await saveFile(Files); + const filename = Files[0].FileName; + + $.export("$summary", `Successfully converted URL to ${this.formatTo} and saved in /tmp directory as **${filename}**.`); + return { + filepath: `/tmp/${filename}`, + }; + } catch (e) { + throw new Error(e); + } + }, +}; diff --git a/components/convertapi/app/convertapi.app.ts b/components/convertapi/app/convertapi.app.ts deleted file mode 100644 index 7014e74d92b29..0000000000000 --- a/components/convertapi/app/convertapi.app.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { defineApp } from "@pipedream/types"; - -export default defineApp({ - type: "app", - app: "convertapi", - propDefinitions: {}, - methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); - }, - }, -}); \ No newline at end of file diff --git a/components/convertapi/common/constants.mjs b/components/convertapi/common/constants.mjs new file mode 100644 index 0000000000000..8b723233acc97 --- /dev/null +++ b/components/convertapi/common/constants.mjs @@ -0,0 +1,186 @@ +export const FORMAT_OPTIONS = [ + "ai", + "any", + "bmp", + "csv", + "djvu", + "doc", + "docx", + "dot", + "dotx", + "dwf", + "dwfx", + "dwg", + "dwgx", + "dxf", + "email", + "eml", + "eps", + "epub", + "gif", + "heic", + "htm", + "html", + "ico", + "images", + "jpeg", + "jpg", + "key", + "log", + "md", + "mdi", + "mhtml", + "mobi", + "msg", + "numbers", + "odc", + "odf", + "odp", + "ods", + "odt", + "office", + "oxps", + "pages", + "pdf", + "png", + "potx", + "pps", + "ppsx", + "ppt", + "pptx", + "prn", + "ps", + "psd", + "pub", + "rtf", + "svg", + "template", + "tif", + "tiff", + "txt", + "vsd", + "vsdx", + "web", + "webp", + "wpd", + "xls", + "xlsx", + "xlt", + "xltx", + "xml", + "xps", + "zip", +]; + +export const CSS_MEDIA_TYTPE_OPTIONS = [ + "print", + "screen", +]; + +export const PAGE_ORIENTATION_OPTIONS = [ + "portrait", + "landscape", +]; + +export const PAGE_SIZE_OPTIONS = [ + { + label: "A0 (841 x 1189 mm, 8.26 x 11.69 inches)", + value: "a0", + }, + { + label: "A1 (594 x 841 mm, 23.4 x 33.1 inches)", + value: "a1", + }, + { + label: "A2 (420 x 594 mm, 16.5 x 23.4 inches)", + value: "a2", + }, + { + label: "A3 (298 x 420 mm, 11.7 x 16.5 inches)", + value: "a3", + }, + { + label: "A4 (210 x 298 mm, 8.3 x 11.7 inches)", + value: "a4", + }, + { + label: "A5 (148 x 210 mm, 5.8 x 8.3 inches)", + value: "a5", + }, + { + label: "A6 (105 x 148 mm, 4.1 x 5.8 inches)", + value: "a6", + }, + { + label: "A7 (74 x 105 mm, 2.9 x 4.1 inches)", + value: "a7", + }, + { + label: "A8 (52 x 74 mm, 2.0 x 2.9 inches)", + value: "a8", + }, + { + label: "A9 (37 x 52 mm, 1.5 x 2.0 inches)", + value: "a9", + }, + { + label: "B0 (1000 x 1414 mm, 39.4 x 55.7 inches)", + value: "b0", + }, + { + label: "B1 (707 x 1000 mm, 27.8 x 39.4 inches)", + value: "b1", + }, + { + label: "B2 (500 x 707 mm, 19.7 x 27.8 inches)", + value: "b2", + }, + { + label: "B3 (353 x 500 mm, 13.9 x 19.7 inches)", + value: "b3", + }, + { + label: "B4 (250 x 353 mm, 9.8 x 13.9 inches)", + value: "b4", + }, + { + label: "B5 (176 x 250 mm, 6.9 x 9.8 inches)", + value: "b5", + }, + { + label: "Letter (216 x 279 mm, 8.5 x 11 inches)", + value: "letter", + }, + { + label: "Legal (216 x 356 mm, 8.5 x 14 inches)", + value: "legal", + }, + { + label: "Ledger (432 x 279 mm, 17 x 11 inches)", + value: "ledger", + }, +]; + +export const FIXED_ELEMENTS_OPTIONS = [ + { + label: "Leave unchanged", + value: "fixed", + }, + { + label: "Absolute", + value: "absolute", + }, + { + label: "Relative", + value: "relative", + }, + { + label: "Hide", + value: "hide", + }, +]; + +export const FORMAT_TO_OPTIONS = [ + "jpg", + "pdf", +]; diff --git a/components/convertapi/common/utils.mjs b/components/convertapi/common/utils.mjs new file mode 100644 index 0000000000000..9e74d32afe875 --- /dev/null +++ b/components/convertapi/common/utils.mjs @@ -0,0 +1,14 @@ +import fs from "fs"; + +export const checkTmp = (filename) => { + if (!filename.startsWith("/tmp")) { + return `/tmp/${filename}`; + } + return filename; +}; + +export const saveFile = async (Files) => { + const FileInfo = Files[0]; + const tmpFilePath = `/tmp/${FileInfo.FileName}`; + return fs.writeFileSync(tmpFilePath, FileInfo.FileData, "base64"); +}; diff --git a/components/convertapi/convertapi.app.mjs b/components/convertapi/convertapi.app.mjs new file mode 100644 index 0000000000000..06c55dea24d75 --- /dev/null +++ b/components/convertapi/convertapi.app.mjs @@ -0,0 +1,63 @@ +import { axios } from "@pipedream/platform"; +import { FORMAT_OPTIONS } from "./common/constants.mjs"; + +export default { + type: "app", + app: "convertapi", + propDefinitions: { + base64String: { + type: "string", + label: "Base64 String", + description: "The base64 string of the file to convert", + }, + formatFrom: { + type: "string", + label: "Input Format", + description: "The format of the input file.", + options: FORMAT_OPTIONS, + }, + }, + methods: { + _baseUrl() { + return "https://v2.convertapi.com"; + }, + _params(params = {}) { + return { + Secret: `${this.$auth.api_secret}`, + ...params, + }; + }, + _makeRequest({ + $ = this, params, path, ...opts + }) { + return axios($, { + url: this._baseUrl() + path, + params: this._params(params), + ...opts, + }); + }, + getAllowedFormats({ formatFrom }) { + return this._makeRequest({ + path: `/info/openapi/${formatFrom}/to/*`, + }); + }, + convertFileToFormat({ + formatFrom, formatTo, ...opts + }) { + return this._makeRequest({ + method: "POST", + path: `/convert/${formatFrom}/to/${formatTo}`, + ...opts, + }); + }, + convertWebToFormat({ + formatTo, ...opts + }) { + return this._makeRequest({ + method: "POST", + path: `/convert/web/to/${formatTo}`, + ...opts, + }); + }, + }, +}; diff --git a/components/convertapi/package.json b/components/convertapi/package.json index c9abb3b6802ea..336a1040856e5 100644 --- a/components/convertapi/package.json +++ b/components/convertapi/package.json @@ -1,16 +1,20 @@ { "name": "@pipedream/convertapi", - "version": "0.0.2", + "version": "0.1.0", "description": "Pipedream ConvertAPI Components", - "main": "dist/app/convertapi.app.mjs", + "main": "convertapi.app.mjs", "keywords": [ "pipedream", "convertapi" ], - "files": ["dist"], "homepage": "https://pipedream.com/apps/convertapi", "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.0.3", + "form-data": "^4.0.2", + "fs": "^0.0.1-security" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7917c4e2f33a9..117f28e17e33e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2930,7 +2930,17 @@ importers: components/conversion_tools: {} - components/convertapi: {} + components/convertapi: + dependencies: + '@pipedream/platform': + specifier: ^3.0.3 + version: 3.0.3 + form-data: + specifier: ^4.0.2 + version: 4.0.2 + fs: + specifier: ^0.0.1-security + version: 0.0.1-security components/convertkit: dependencies: @@ -33522,7 +33532,7 @@ snapshots: axios: 1.8.4(debug@3.2.7) body-parser: 1.20.3 file-type: 16.5.4 - form-data: 4.0.1 + form-data: 4.0.2 transitivePeerDependencies: - debug - supports-color @@ -34140,7 +34150,7 @@ snapshots: dependencies: '@pipedream/platform': 1.6.6 axios: 1.8.4(debug@3.2.7) - form-data: 4.0.1 + form-data: 4.0.2 transitivePeerDependencies: - debug @@ -36631,7 +36641,7 @@ snapshots: '@types/node-fetch@2.6.12': dependencies: '@types/node': 20.17.6 - form-data: 4.0.1 + form-data: 4.0.2 '@types/node@14.18.63': {} @@ -37404,7 +37414,7 @@ snapshots: axios@0.27.2: dependencies: follow-redirects: 1.15.9(debug@3.2.7) - form-data: 4.0.1 + form-data: 4.0.2 transitivePeerDependencies: - debug @@ -38143,7 +38153,7 @@ snapshots: '@aws-sdk/credential-providers': 3.696.0(@aws-sdk/client-sso-oidc@3.696.0(@aws-sdk/client-sts@3.696.0(aws-crt@1.25.0))(aws-crt@1.25.0))(aws-crt@1.25.0) '@aws-sdk/protocol-http': 3.374.0 '@aws-sdk/signature-v4': 3.374.0 - form-data: 4.0.1 + form-data: 4.0.2 form-data-encoder: 4.0.2 formdata-node: 6.0.3 js-base64: 3.7.2 @@ -42649,7 +42659,7 @@ snapshots: dependencies: axios: 1.8.4(debug@3.2.7) exponential-backoff: 3.1.1 - form-data: 4.0.1 + form-data: 4.0.2 transitivePeerDependencies: - debug