From dfb8d8d901caed9be26bfaa3ff7e47b538a966f6 Mon Sep 17 00:00:00 2001 From: Luan Cazarine Date: Tue, 8 Oct 2024 17:49:32 -0300 Subject: [PATCH 1/4] pdfmonkey init --- .../delete-document/delete-document.mjs | 24 ++++ .../actions/find-document/find-document.mjs | 24 ++++ .../generate-document/generate-document.mjs | 40 +++++++ components/pdfmonkey/pdfmonkey.app.mjs | 103 ++++++++++++++++++ .../new-document-generated.mjs | 88 +++++++++++++++ 5 files changed, 279 insertions(+) create mode 100644 components/pdfmonkey/actions/delete-document/delete-document.mjs create mode 100644 components/pdfmonkey/actions/find-document/find-document.mjs create mode 100644 components/pdfmonkey/actions/generate-document/generate-document.mjs create mode 100644 components/pdfmonkey/pdfmonkey.app.mjs create mode 100644 components/pdfmonkey/sources/new-document-generated/new-document-generated.mjs diff --git a/components/pdfmonkey/actions/delete-document/delete-document.mjs b/components/pdfmonkey/actions/delete-document/delete-document.mjs new file mode 100644 index 0000000000000..440f3c17a2eb0 --- /dev/null +++ b/components/pdfmonkey/actions/delete-document/delete-document.mjs @@ -0,0 +1,24 @@ +import pdfmonkey from "../../pdfmonkey.app.mjs"; +import { axios } from "@pipedream/platform"; + +export default { + key: "pdfmonkey-delete-document", + name: "Delete Document", + description: "Deletes a specific document using its ID. [See the documentation](https://docs.pdfmonkey.io/references/api/documents)", + version: "0.0.{{ts}}", + type: "action", + props: { + pdfmonkey, + documentId: { + propDefinition: [ + pdfmonkey, + "documentId", + ], + }, + }, + async run({ $ }) { + const response = await this.pdfmonkey.deleteDocument(this.documentId); + $.export("$summary", `Deleted document with ID ${this.documentId}`); + return response; + }, +}; diff --git a/components/pdfmonkey/actions/find-document/find-document.mjs b/components/pdfmonkey/actions/find-document/find-document.mjs new file mode 100644 index 0000000000000..37943fd70e737 --- /dev/null +++ b/components/pdfmonkey/actions/find-document/find-document.mjs @@ -0,0 +1,24 @@ +import pdfmonkey from "../../pdfmonkey.app.mjs"; +import { axios } from "@pipedream/platform"; + +export default { + key: "pdfmonkey-find-document", + name: "Find Document", + description: "Find a document within PDFMonkey. [See the documentation](https://docs.pdfmonkey.io/references/api/documents)", + version: "0.0.{{ts}}", + type: "action", + props: { + pdfmonkey, + documentId: { + propDefinition: [ + pdfmonkey, + "documentId", + ], + }, + }, + async run({ $ }) { + const document = await this.pdfmonkey.findDocument(this.documentId); + $.export("$summary", `Successfully found document with ID ${this.documentId}`); + return document; + }, +}; diff --git a/components/pdfmonkey/actions/generate-document/generate-document.mjs b/components/pdfmonkey/actions/generate-document/generate-document.mjs new file mode 100644 index 0000000000000..fba1252904b29 --- /dev/null +++ b/components/pdfmonkey/actions/generate-document/generate-document.mjs @@ -0,0 +1,40 @@ +import pdfmonkey from "../../pdfmonkey.app.mjs"; + +export default { + key: "pdfmonkey-generate-document", + name: "Generate Document", + description: "Generates a new document using a specified template. [See the documentation](https://docs.pdfmonkey.io/references/api/documents)", + version: "0.0.{{ts}}", + type: "action", + props: { + pdfmonkey, + templateId: { + propDefinition: [ + pdfmonkey, + "templateId", + ], + }, + data: { + propDefinition: [ + pdfmonkey, + "data", + ], + }, + metadata: { + propDefinition: [ + pdfmonkey, + "metadata", + ], + }, + }, + async run({ $ }) { + const response = await this.pdfmonkey.createDocument({ + templateId: this.templateId, + data: this.data, + metadata: this.metadata, + }); + + $.export("$summary", `Successfully generated document with ID ${response.document.id}`); + return response; + }, +}; diff --git a/components/pdfmonkey/pdfmonkey.app.mjs b/components/pdfmonkey/pdfmonkey.app.mjs new file mode 100644 index 0000000000000..8d32970718e1f --- /dev/null +++ b/components/pdfmonkey/pdfmonkey.app.mjs @@ -0,0 +1,103 @@ +import { axios } from "@pipedream/platform"; + +export default { + type: "app", + app: "pdfmonkey", + propDefinitions: { + documentId: { + type: "string", + label: "Document ID", + description: "The unique identifier of the document.", + }, + templateId: { + type: "string", + label: "Template ID", + description: "The unique identifier of the document template.", + }, + data: { + type: "object", + label: "Payload", + description: "Data used for the document generation.", + optional: true, + }, + metadata: { + type: "object", + label: "Metadata", + description: "Metadata to attach to the document.", + optional: true, + }, + documentName: { + type: "string", + label: "Document Name", + description: "Optional name for the document.", + optional: true, + }, + additionalMetadata: { + type: "object", + label: "Additional Metadata", + description: "Optional additional metadata for the document.", + optional: true, + }, + }, + methods: { + _baseUrl() { + return "https://api.pdfmonkey.io/api/v1"; + }, + async _makeRequest(opts = {}) { + const { + $ = this, method = "GET", path = "/", headers, ...otherOpts + } = opts; + return axios($, { + ...otherOpts, + method, + url: this._baseUrl() + path, + headers: { + ...headers, + "Authorization": `Bearer ${this.$auth.api_key}`, + "Content-Type": "application/json", + }, + }); + }, + async createDocument({ + templateId, data, metadata, + }) { + return this._makeRequest({ + method: "POST", + path: "/documents", + data: { + document: { + document_template_id: templateId, + status: "pending", + payload: data, + meta: metadata, + }, + }, + }); + }, + async deleteDocument(documentId) { + return this._makeRequest({ + method: "DELETE", + path: `/documents/${documentId}`, + }); + }, + async findDocument(documentId) { + return this._makeRequest({ + method: "GET", + path: `/documents/${documentId}`, + }); + }, + async emitDocumentCompletion({ + documentId, documentName, additionalMetadata, + }) { + const document = await this.findDocument(documentId); + if (document.status === "success") { + this.$emit(document, { + id: document.id, + summary: `Document ${documentName || document.filename} Generation Completed`, + ts: Date.now(), + additionalMetadata, + }); + } + }, + }, +}; diff --git a/components/pdfmonkey/sources/new-document-generated/new-document-generated.mjs b/components/pdfmonkey/sources/new-document-generated/new-document-generated.mjs new file mode 100644 index 0000000000000..37303912d29a7 --- /dev/null +++ b/components/pdfmonkey/sources/new-document-generated/new-document-generated.mjs @@ -0,0 +1,88 @@ +import pdfmonkey from "../../pdfmonkey.app.mjs"; +import { + axios, DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, +} from "@pipedream/platform"; + +export default { + key: "pdfmonkey-new-document-generated", + name: "New Document Generated", + description: "Emit new event when a document's generation is completed. [See the documentation](https://docs.pdfmonkey.io/references/api/documents)", + version: "0.0.{{ts}}", + type: "source", + dedupe: "unique", + props: { + pdfmonkey, + db: "$.service.db", + timer: { + type: "$.interface.timer", + default: { + intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, + }, + }, + documentId: { + propDefinition: [ + pdfmonkey, + "documentId", + ], + }, + documentName: { + propDefinition: [ + pdfmonkey, + "documentName", + ], + optional: true, + }, + additionalMetadata: { + propDefinition: [ + pdfmonkey, + "additionalMetadata", + ], + optional: true, + }, + }, + methods: { + async checkDocumentStatus() { + return await this.pdfmonkey.findDocument(this.documentId); + }, + _getLastTimestamp() { + return this.db.get("lastTimestamp") || 0; + }, + _setLastTimestamp(timestamp) { + this.db.set("lastTimestamp", timestamp); + }, + }, + hooks: { + async deploy() { + const document = await this.checkDocumentStatus(); + if (document.status === "success") { + this.$emit(document, { + id: document.id, + summary: `Document ${this.documentName || document.filename} Generation Completed`, + ts: Date.parse(document.updated_at), + additionalMetadata: this.additionalMetadata, + }); + this._setLastTimestamp(Date.parse(document.updated_at)); + } + }, + async activate() { + // No webhook subscription required + }, + async deactivate() { + // No webhook unsubscription required + }, + }, + async run() { + const lastTimestamp = this._getLastTimestamp(); + const document = await this.checkDocumentStatus(); + + if (Date.parse(document.updated_at) > lastTimestamp && document.status === "success") { + this.$emit(document, { + id: document.id, + summary: `Document ${this.documentName || document.filename} Generation Completed`, + ts: Date.parse(document.updated_at), + additionalMetadata: this.additionalMetadata, + }); + this._setLastTimestamp(Date.parse(document.updated_at)); + } + }, +}; From 625c3bcbdf129b25bcb375ce7fcb2690be503895 Mon Sep 17 00:00:00 2001 From: Luan Cazarine Date: Wed, 9 Oct 2024 11:34:55 -0300 Subject: [PATCH 2/4] [Components] pdfmonkey #13201 Sources - New Document Generated Actions - Generate Document - Delete Document - Find Document --- components/pdfmonkey/.gitignore | 3 - .../delete-document/delete-document.mjs | 8 +- .../actions/find-document/find-document.mjs | 8 +- .../generate-document/generate-document.mjs | 42 +++-- components/pdfmonkey/app/pdfmonkey.app.ts | 13 -- components/pdfmonkey/common/constants.mjs | 10 ++ components/pdfmonkey/package.json | 10 +- components/pdfmonkey/pdfmonkey.app.mjs | 156 +++++++++++------- .../new-document-generated.mjs | 97 +++++------ .../new-document-generated/test-event.mjs | 14 ++ 10 files changed, 199 insertions(+), 162 deletions(-) delete mode 100644 components/pdfmonkey/.gitignore delete mode 100644 components/pdfmonkey/app/pdfmonkey.app.ts create mode 100644 components/pdfmonkey/common/constants.mjs create mode 100644 components/pdfmonkey/sources/new-document-generated/test-event.mjs diff --git a/components/pdfmonkey/.gitignore b/components/pdfmonkey/.gitignore deleted file mode 100644 index ec761ccab7595..0000000000000 --- a/components/pdfmonkey/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.js -*.mjs -dist \ No newline at end of file diff --git a/components/pdfmonkey/actions/delete-document/delete-document.mjs b/components/pdfmonkey/actions/delete-document/delete-document.mjs index 440f3c17a2eb0..413d3b55f2ad1 100644 --- a/components/pdfmonkey/actions/delete-document/delete-document.mjs +++ b/components/pdfmonkey/actions/delete-document/delete-document.mjs @@ -1,11 +1,10 @@ import pdfmonkey from "../../pdfmonkey.app.mjs"; -import { axios } from "@pipedream/platform"; export default { key: "pdfmonkey-delete-document", name: "Delete Document", description: "Deletes a specific document using its ID. [See the documentation](https://docs.pdfmonkey.io/references/api/documents)", - version: "0.0.{{ts}}", + version: "0.0.1", type: "action", props: { pdfmonkey, @@ -17,7 +16,10 @@ export default { }, }, async run({ $ }) { - const response = await this.pdfmonkey.deleteDocument(this.documentId); + const response = await this.pdfmonkey.deleteDocument({ + $, + documentId: this.documentId, + }); $.export("$summary", `Deleted document with ID ${this.documentId}`); return response; }, diff --git a/components/pdfmonkey/actions/find-document/find-document.mjs b/components/pdfmonkey/actions/find-document/find-document.mjs index 37943fd70e737..7034927aaaea2 100644 --- a/components/pdfmonkey/actions/find-document/find-document.mjs +++ b/components/pdfmonkey/actions/find-document/find-document.mjs @@ -1,11 +1,10 @@ import pdfmonkey from "../../pdfmonkey.app.mjs"; -import { axios } from "@pipedream/platform"; export default { key: "pdfmonkey-find-document", name: "Find Document", description: "Find a document within PDFMonkey. [See the documentation](https://docs.pdfmonkey.io/references/api/documents)", - version: "0.0.{{ts}}", + version: "0.0.1", type: "action", props: { pdfmonkey, @@ -17,7 +16,10 @@ export default { }, }, async run({ $ }) { - const document = await this.pdfmonkey.findDocument(this.documentId); + const document = await this.pdfmonkey.getDocument({ + $, + documentId: this.documentId, + }); $.export("$summary", `Successfully found document with ID ${this.documentId}`); return document; }, diff --git a/components/pdfmonkey/actions/generate-document/generate-document.mjs b/components/pdfmonkey/actions/generate-document/generate-document.mjs index fba1252904b29..d4a17729926f6 100644 --- a/components/pdfmonkey/actions/generate-document/generate-document.mjs +++ b/components/pdfmonkey/actions/generate-document/generate-document.mjs @@ -1,10 +1,11 @@ +import { STATUS_OPTIONS } from "../../common/constants.mjs"; import pdfmonkey from "../../pdfmonkey.app.mjs"; export default { key: "pdfmonkey-generate-document", name: "Generate Document", description: "Generates a new document using a specified template. [See the documentation](https://docs.pdfmonkey.io/references/api/documents)", - version: "0.0.{{ts}}", + version: "0.0.1", type: "action", props: { pdfmonkey, @@ -14,24 +15,37 @@ export default { "templateId", ], }, - data: { - propDefinition: [ - pdfmonkey, - "data", - ], + payload: { + type: "object", + label: "Payload", + description: "Data to use for the Document generation.", + optional: true, }, - metadata: { - propDefinition: [ - pdfmonkey, - "metadata", - ], + meta: { + type: "object", + label: "Meta", + description: "Meta-Data to attach to the Document.", + optional: true, + }, + status: { + type: "string", + label: "Status", + description: "The status of the document", + options: STATUS_OPTIONS, + optional: true, }, }, async run({ $ }) { const response = await this.pdfmonkey.createDocument({ - templateId: this.templateId, - data: this.data, - metadata: this.metadata, + $, + data: { + document: { + document_template_id: this.templateId, + payload: this.payload, + meta: this.meta, + status: this.status, + }, + }, }); $.export("$summary", `Successfully generated document with ID ${response.document.id}`); diff --git a/components/pdfmonkey/app/pdfmonkey.app.ts b/components/pdfmonkey/app/pdfmonkey.app.ts deleted file mode 100644 index 013cfeb73cc1a..0000000000000 --- a/components/pdfmonkey/app/pdfmonkey.app.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { defineApp } from "@pipedream/types"; - -export default defineApp({ - type: "app", - app: "pdfmonkey", - propDefinitions: {}, - methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); - }, - }, -}); diff --git a/components/pdfmonkey/common/constants.mjs b/components/pdfmonkey/common/constants.mjs new file mode 100644 index 0000000000000..b8df6991c7e70 --- /dev/null +++ b/components/pdfmonkey/common/constants.mjs @@ -0,0 +1,10 @@ +export const STATUS_OPTIONS = [ + { + label: "Draft (Default)", + value: "draft", + }, + { + label: "Pending (To trigger generation)", + value: "pending", + }, +]; diff --git a/components/pdfmonkey/package.json b/components/pdfmonkey/package.json index a11e79998f246..b447e4ef5188e 100644 --- a/components/pdfmonkey/package.json +++ b/components/pdfmonkey/package.json @@ -1,18 +1,18 @@ { "name": "@pipedream/pdfmonkey", - "version": "0.0.3", + "version": "0.1.0", "description": "Pipedream PDFMonkey Components", - "main": "dist/app/pdfmonkey.app.mjs", + "main": "pdfmonkey.app.mjs", "keywords": [ "pipedream", "pdfmonkey" ], - "files": [ - "dist" - ], "homepage": "https://pipedream.com/apps/pdfmonkey", "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.0.3" } } diff --git a/components/pdfmonkey/pdfmonkey.app.mjs b/components/pdfmonkey/pdfmonkey.app.mjs index 8d32970718e1f..246a1b6229d9d 100644 --- a/components/pdfmonkey/pdfmonkey.app.mjs +++ b/components/pdfmonkey/pdfmonkey.app.mjs @@ -4,100 +4,132 @@ export default { type: "app", app: "pdfmonkey", propDefinitions: { - documentId: { - type: "string", - label: "Document ID", - description: "The unique identifier of the document.", - }, templateId: { type: "string", label: "Template ID", description: "The unique identifier of the document template.", + async options({ page }) { + const { document_template_cards: data } = await this.listTemplates({ + params: { + "page[number]": page, + }, + }); + + return data.map(({ + id: value, identifier: label, + }) => ({ + label, + value, + })); + }, }, - data: { - type: "object", - label: "Payload", - description: "Data used for the document generation.", - optional: true, - }, - metadata: { - type: "object", - label: "Metadata", - description: "Metadata to attach to the document.", - optional: true, - }, - documentName: { + documentId: { type: "string", - label: "Document Name", - description: "Optional name for the document.", - optional: true, - }, - additionalMetadata: { - type: "object", - label: "Additional Metadata", - description: "Optional additional metadata for the document.", - optional: true, + label: "Document ID", + description: "The unique identifier of the document.", + async options({ page }) { + const { document_cards: data } = await this.listDocuments({ + params: { + "page[number]": page, + }, + }); + + return data.map(({ + id: value, filename, + }) => ({ + label: `${value}${filename + ? ` - ${filename}` + : ""}`, + value, + })); + }, }, }, methods: { _baseUrl() { return "https://api.pdfmonkey.io/api/v1"; }, - async _makeRequest(opts = {}) { - const { - $ = this, method = "GET", path = "/", headers, ...otherOpts - } = opts; + _headers() { + return { + "Authorization": `Bearer ${this.$auth.api_key}`, + }; + }, + _makeRequest({ + $ = this, path, ...opts + }) { return axios($, { - ...otherOpts, - method, url: this._baseUrl() + path, - headers: { - ...headers, - "Authorization": `Bearer ${this.$auth.api_key}`, - "Content-Type": "application/json", - }, + headers: this._headers(), + ...opts, }); }, - async createDocument({ - templateId, data, metadata, - }) { + createDocument(opts = {}) { return this._makeRequest({ method: "POST", path: "/documents", - data: { - document: { - document_template_id: templateId, - status: "pending", - payload: data, - meta: metadata, - }, - }, + ...opts, }); }, - async deleteDocument(documentId) { + deleteDocument({ + documentId, ...opts + }) { return this._makeRequest({ method: "DELETE", path: `/documents/${documentId}`, + ...opts, }); }, - async findDocument(documentId) { + getDocument({ + documentId, ...opts + }) { return this._makeRequest({ - method: "GET", path: `/documents/${documentId}`, + ...opts, + }); + }, + listDocuments(opts = {}) { + return this._makeRequest({ + path: "/document_cards", + ...opts, + }); + }, + listTemplates(opts = {}) { + return this._makeRequest({ + path: "/document_template_cards", + ...opts, }); }, - async emitDocumentCompletion({ - documentId, documentName, additionalMetadata, + async *paginate({ + fn, params = {}, maxResults = null, ...opts }) { - const document = await this.findDocument(documentId); - if (document.status === "success") { - this.$emit(document, { - id: document.id, - summary: `Document ${documentName || document.filename} Generation Completed`, - ts: Date.now(), - additionalMetadata, + let hasMore = false; + let count = 0; + let page = 0; + + do { + params["page[number]"] = ++page; + + const { + document_cards: data, + meta: { + current_page, total_pages, + }, + } = await fn({ + params, + ...opts, }); - } + + for (const d of data) { + yield d; + + if (maxResults && ++count === maxResults) { + return count; + } + } + + hasMore = !(current_page == total_pages); + + } while (hasMore); }, }, }; diff --git a/components/pdfmonkey/sources/new-document-generated/new-document-generated.mjs b/components/pdfmonkey/sources/new-document-generated/new-document-generated.mjs index 37303912d29a7..609f808db29b2 100644 --- a/components/pdfmonkey/sources/new-document-generated/new-document-generated.mjs +++ b/components/pdfmonkey/sources/new-document-generated/new-document-generated.mjs @@ -1,13 +1,12 @@ +import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform"; import pdfmonkey from "../../pdfmonkey.app.mjs"; -import { - axios, DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, -} from "@pipedream/platform"; +import sampleEmit from "./test-event.mjs"; export default { key: "pdfmonkey-new-document-generated", name: "New Document Generated", - description: "Emit new event when a document's generation is completed. [See the documentation](https://docs.pdfmonkey.io/references/api/documents)", - version: "0.0.{{ts}}", + description: "Emit new event when a document's generation is completed.", + version: "0.0.1", type: "source", dedupe: "unique", props: { @@ -19,70 +18,50 @@ export default { intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, }, }, - documentId: { - propDefinition: [ - pdfmonkey, - "documentId", - ], - }, - documentName: { - propDefinition: [ - pdfmonkey, - "documentName", - ], - optional: true, - }, - additionalMetadata: { - propDefinition: [ - pdfmonkey, - "additionalMetadata", - ], - optional: true, - }, }, methods: { - async checkDocumentStatus() { - return await this.pdfmonkey.findDocument(this.documentId); + _getLastDate() { + return this.db.get("lastDate") || 0; }, - _getLastTimestamp() { - return this.db.get("lastTimestamp") || 0; + _setLastDate(lastDate) { + this.db.set("lastDate", lastDate); }, - _setLastTimestamp(timestamp) { - this.db.set("lastTimestamp", timestamp); + async emitEvent(maxResults = false) { + const lastDate = this._getLastDate(); + const response = this.pdfmonkey.paginate({ + fn: this.pdfmonkey.listDocuments, + maxResults, + params: { + "q[status]": "success", + "q[updated_since]": lastDate, + }, + }); + + let responseArray = []; + for await (const item of response) { + responseArray.push(item); + } + + if (responseArray.length) { + this._setLastDate(Date.parse(responseArray[0].created_at)); + } + + for (const item of responseArray.reverse()) { + this.$emit(item, { + id: item.id, + summary: `Document ${item.filename || item.id} Generation Completed`, + ts: Date.parse(item.created_at), + }); + } }, }, hooks: { async deploy() { - const document = await this.checkDocumentStatus(); - if (document.status === "success") { - this.$emit(document, { - id: document.id, - summary: `Document ${this.documentName || document.filename} Generation Completed`, - ts: Date.parse(document.updated_at), - additionalMetadata: this.additionalMetadata, - }); - this._setLastTimestamp(Date.parse(document.updated_at)); - } - }, - async activate() { - // No webhook subscription required - }, - async deactivate() { - // No webhook unsubscription required + await this.emitEvent(25); }, }, async run() { - const lastTimestamp = this._getLastTimestamp(); - const document = await this.checkDocumentStatus(); - - if (Date.parse(document.updated_at) > lastTimestamp && document.status === "success") { - this.$emit(document, { - id: document.id, - summary: `Document ${this.documentName || document.filename} Generation Completed`, - ts: Date.parse(document.updated_at), - additionalMetadata: this.additionalMetadata, - }); - this._setLastTimestamp(Date.parse(document.updated_at)); - } + await this.emitEvent(); }, + sampleEmit, }; diff --git a/components/pdfmonkey/sources/new-document-generated/test-event.mjs b/components/pdfmonkey/sources/new-document-generated/test-event.mjs new file mode 100644 index 0000000000000..050ab7bb9b2ef --- /dev/null +++ b/components/pdfmonkey/sources/new-document-generated/test-event.mjs @@ -0,0 +1,14 @@ +export default { + "id": "11475e57-0334-4ad5-8896-9462a2243957", + "app_id": "c2b67b84-4aac-49ea-bed8-69a15d7a65d3", + "created_at": "2022-04-07T11:01:38.201+02:00", + "document_template_id": "96611e9e-ab03-4ac3-8551-1b485210c892", + "document_template_identifier": "My Awesome Template", + "download_url": "https://pdfmonkey.s3.eu-west-1.amazonaws.com/production/backend/document/11475e57-0334-4ad5-8896-9462a2243957/my-test-document.pdf?response-content-disposition=attachment&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ2ZTKW4HMOLK63IQ%2F20220406%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Date=20220407T204150Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-Signature=24e3a8c0801ad8d1efd6aaa22d946ee70f5c8d5b55c586f346a094afa5046c77", + "failure_cause": null, + "filename": "my-test-document.pdf", + "meta": "{ \"_filename\":\"my-test-document.pdf\" }", + "public_share_link": "https://files.pdfmonkey.io/share/5CEA8C37-D130-4C19-9E11-72BE2293C82B/my-test-document.pdf", + "status": "success", + "updated_at": "2022-04-03T11:12:56.023+02:00" +} \ No newline at end of file From 2c6ce2050206258b1b376e4c9e182292734d6411 Mon Sep 17 00:00:00 2001 From: Luan Cazarine Date: Wed, 9 Oct 2024 11:35:32 -0300 Subject: [PATCH 3/4] pnpm update --- pnpm-lock.yaml | 107 +++++++++++++++++++++++++------------------------ 1 file changed, 55 insertions(+), 52 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c88b090ab28d5..85efbfb1b70f7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7121,7 +7121,10 @@ importers: '@pdfless/pdfless-js': 1.0.510 components/pdfmonkey: - specifiers: {} + specifiers: + '@pipedream/platform': ^3.0.3 + dependencies: + '@pipedream/platform': 3.0.3 components/peach: specifiers: @@ -12929,55 +12932,6 @@ packages: - aws-crt dev: false - /@aws-sdk/client-sso-oidc/3.600.0_tdq3komn4zwyd65w7klbptsu34: - resolution: {integrity: sha512-7+I8RWURGfzvChyNQSyj5/tKrqRbzRl7H+BnTOf/4Vsw1nFOi5ROhlhD4X/Y0QCTacxnaoNcIrqnY7uGGvVRzw==} - engines: {node: '>=16.0.0'} - dependencies: - '@aws-crypto/sha256-browser': 5.2.0 - '@aws-crypto/sha256-js': 5.2.0 - '@aws-sdk/client-sts': 3.600.0 - '@aws-sdk/core': 3.598.0 - '@aws-sdk/credential-provider-node': 3.600.0_f7n47caigsrjd2lr2szmwfuee4 - '@aws-sdk/middleware-host-header': 3.598.0 - '@aws-sdk/middleware-logger': 3.598.0 - '@aws-sdk/middleware-recursion-detection': 3.598.0 - '@aws-sdk/middleware-user-agent': 3.598.0 - '@aws-sdk/region-config-resolver': 3.598.0 - '@aws-sdk/types': 3.598.0 - '@aws-sdk/util-endpoints': 3.598.0 - '@aws-sdk/util-user-agent-browser': 3.598.0 - '@aws-sdk/util-user-agent-node': 3.598.0 - '@smithy/config-resolver': 3.0.3 - '@smithy/core': 2.2.3 - '@smithy/fetch-http-handler': 3.2.1 - '@smithy/hash-node': 3.0.2 - '@smithy/invalid-dependency': 3.0.2 - '@smithy/middleware-content-length': 3.0.2 - '@smithy/middleware-endpoint': 3.0.4 - '@smithy/middleware-retry': 3.0.6 - '@smithy/middleware-serde': 3.0.3 - '@smithy/middleware-stack': 3.0.3 - '@smithy/node-config-provider': 3.1.3 - '@smithy/node-http-handler': 3.1.2 - '@smithy/protocol-http': 4.0.3 - '@smithy/smithy-client': 3.1.6 - '@smithy/types': 3.3.0 - '@smithy/url-parser': 3.0.3 - '@smithy/util-base64': 3.0.0 - '@smithy/util-body-length-browser': 3.0.0 - '@smithy/util-body-length-node': 3.0.0 - '@smithy/util-defaults-mode-browser': 3.0.6 - '@smithy/util-defaults-mode-node': 3.0.6 - '@smithy/util-endpoints': 2.0.3 - '@smithy/util-middleware': 3.0.3 - '@smithy/util-retry': 3.0.2 - '@smithy/util-utf8': 3.0.0 - tslib: 2.6.3 - transitivePeerDependencies: - - '@aws-sdk/client-sts' - - aws-crt - dev: false - /@aws-sdk/client-sso/3.423.0: resolution: {integrity: sha512-znIufHkwhCIePgaYciIs3x/+BpzR57CZzbCKHR9+oOvGyufEPPpUT5bFLvbwTgfiVkTjuk6sG/ES3U5Bc+xtrA==} engines: {node: '>=14.0.0'} @@ -13213,7 +13167,7 @@ packages: dependencies: '@aws-crypto/sha256-browser': 5.2.0 '@aws-crypto/sha256-js': 5.2.0 - '@aws-sdk/client-sso-oidc': 3.600.0_tdq3komn4zwyd65w7klbptsu34 + '@aws-sdk/client-sso-oidc': 3.600.0 '@aws-sdk/core': 3.598.0 '@aws-sdk/credential-provider-node': 3.600.0_f7n47caigsrjd2lr2szmwfuee4 '@aws-sdk/middleware-host-header': 3.598.0 @@ -13255,6 +13209,55 @@ packages: - aws-crt dev: false + /@aws-sdk/client-sts/3.600.0_dseaa2p5u2yk67qiepewcq3hkq: + resolution: {integrity: sha512-KQG97B7LvTtTiGmjlrG1LRAY8wUvCQzrmZVV5bjrJ/1oXAU7DITYwVbSJeX9NWg6hDuSk0VE3MFwIXS2SvfLIA==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-crypto/sha256-browser': 5.2.0 + '@aws-crypto/sha256-js': 5.2.0 + '@aws-sdk/client-sso-oidc': 3.600.0 + '@aws-sdk/core': 3.598.0 + '@aws-sdk/credential-provider-node': 3.600.0_f7n47caigsrjd2lr2szmwfuee4 + '@aws-sdk/middleware-host-header': 3.598.0 + '@aws-sdk/middleware-logger': 3.598.0 + '@aws-sdk/middleware-recursion-detection': 3.598.0 + '@aws-sdk/middleware-user-agent': 3.598.0 + '@aws-sdk/region-config-resolver': 3.598.0 + '@aws-sdk/types': 3.598.0 + '@aws-sdk/util-endpoints': 3.598.0 + '@aws-sdk/util-user-agent-browser': 3.598.0 + '@aws-sdk/util-user-agent-node': 3.598.0 + '@smithy/config-resolver': 3.0.3 + '@smithy/core': 2.2.3 + '@smithy/fetch-http-handler': 3.2.1 + '@smithy/hash-node': 3.0.2 + '@smithy/invalid-dependency': 3.0.2 + '@smithy/middleware-content-length': 3.0.2 + '@smithy/middleware-endpoint': 3.0.4 + '@smithy/middleware-retry': 3.0.6 + '@smithy/middleware-serde': 3.0.3 + '@smithy/middleware-stack': 3.0.3 + '@smithy/node-config-provider': 3.1.3 + '@smithy/node-http-handler': 3.1.2 + '@smithy/protocol-http': 4.0.3 + '@smithy/smithy-client': 3.1.6 + '@smithy/types': 3.3.0 + '@smithy/url-parser': 3.0.3 + '@smithy/util-base64': 3.0.0 + '@smithy/util-body-length-browser': 3.0.0 + '@smithy/util-body-length-node': 3.0.0 + '@smithy/util-defaults-mode-browser': 3.0.6 + '@smithy/util-defaults-mode-node': 3.0.6 + '@smithy/util-endpoints': 2.0.3 + '@smithy/util-middleware': 3.0.3 + '@smithy/util-retry': 3.0.2 + '@smithy/util-utf8': 3.0.0 + tslib: 2.6.3 + transitivePeerDependencies: + - '@aws-sdk/client-sso-oidc' + - aws-crt + dev: false + /@aws-sdk/core/3.556.0: resolution: {integrity: sha512-vJaSaHw2kPQlo11j/Rzuz0gk1tEaKdz+2ser0f0qZ5vwFlANjt08m/frU17ctnVKC1s58bxpctO/1P894fHLrA==} engines: {node: '>=14.0.0'} @@ -17581,7 +17584,7 @@ packages: '@aws-sdk/client-sns': 3.423.0 '@aws-sdk/client-sqs': 3.423.0 '@aws-sdk/client-ssm': 3.423.0 - '@aws-sdk/client-sts': 3.600.0 + '@aws-sdk/client-sts': 3.600.0_dseaa2p5u2yk67qiepewcq3hkq '@aws-sdk/s3-request-presigner': 3.609.0 '@pipedream/helper_functions': 0.3.12 '@pipedream/platform': 1.6.6 From 544baf324fe7401a059cb80c967ea99c3fb993ad Mon Sep 17 00:00:00 2001 From: Luan Cazarine Date: Thu, 10 Oct 2024 17:19:24 -0300 Subject: [PATCH 4/4] adjust paginate method --- components/pdfmonkey/pdfmonkey.app.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/pdfmonkey/pdfmonkey.app.mjs b/components/pdfmonkey/pdfmonkey.app.mjs index 246a1b6229d9d..10d52ef699c98 100644 --- a/components/pdfmonkey/pdfmonkey.app.mjs +++ b/components/pdfmonkey/pdfmonkey.app.mjs @@ -127,7 +127,7 @@ export default { } } - hasMore = !(current_page == total_pages); + hasMore = current_page < total_pages; } while (hasMore); },