-
Notifications
You must be signed in to change notification settings - Fork 5.5k
17949 app luminpdf #18023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
17949 app luminpdf #18023
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5d13278
[APP] luminpdf #17949
luancazarine ae14bb5
pnpm update
luancazarine 170e53f
pnpm update
luancazarine 02b1a61
Update file descriptions in send-signature-request to reflect correct…
luancazarine 4a12bc9
Refactor custom email handling in send-signature-request to use neste…
luancazarine 4de0fe6
Update components/lumin_pdf/actions/send-signature-request/send-signa…
luancazarine 4481ef5
Add signers field to send-signature-request for enhanced signature re…
luancazarine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
components/lumin_pdf/actions/cancel-signature-request/cancel-signature-request.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import luminPdf from "../../lumin_pdf.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "lumin_pdf-cancel-signature-request", | ||
| name: "Cancel Signature Request", | ||
| description: "Cancel a signature request. [See the documentation](https://developers.luminpdf.com/api/cancel-signature-request/)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| luminPdf, | ||
| alert: { | ||
|
Check warning on line 11 in components/lumin_pdf/actions/cancel-signature-request/cancel-signature-request.mjs
|
||
| type: "alert", | ||
| alertType: "info", | ||
| content: "This action only works for signature requests that were created via API.", | ||
| }, | ||
| signatureRequestId: { | ||
| propDefinition: [ | ||
| luminPdf, | ||
| "signatureRequestId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.luminPdf.cancelSignatureRequest({ | ||
| $, | ||
| signatureRequestId: this.signatureRequestId, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully cancelled signature request with ID: ${this.signatureRequestId}`); | ||
| return response; | ||
| }, | ||
| }; | ||
27 changes: 27 additions & 0 deletions
27
components/lumin_pdf/actions/download-file-as-file-url/download-file-as-file-url.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import luminPdf from "../../lumin_pdf.app.mjs"; | ||
|
|
||
| export default { | ||
| name: "Download File as File URL", | ||
| version: "0.0.1", | ||
| key: "lumin_pdf-download-file-as-file-url", | ||
| description: "Get a download URL for a file. [See the documentation](https://developers.luminpdf.com/api/download-file-as-file-url/)", | ||
| type: "action", | ||
| props: { | ||
| luminPdf, | ||
| signatureRequestId: { | ||
| propDefinition: [ | ||
| luminPdf, | ||
| "signatureRequestId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.luminPdf.downloadFileAsFileUrl({ | ||
| $, | ||
| signatureRequestId: this.signatureRequestId, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully retrieved download URL for signature request with ID: ${this.signatureRequestId}`); | ||
| return response; | ||
| }, | ||
| }; |
46 changes: 46 additions & 0 deletions
46
components/lumin_pdf/actions/download-file/download-file.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| import fs from "fs"; | ||
| import stream from "stream"; | ||
| import { promisify } from "util"; | ||
| import luminPdf from "../../lumin_pdf.app.mjs"; | ||
|
|
||
| export default { | ||
| name: "Download File", | ||
| version: "0.0.1", | ||
| key: "lumin_pdf-download-file", | ||
| description: "Download a file directly. [See the documentation](https://developers.luminpdf.com/api/download-file/)", | ||
| type: "action", | ||
| props: { | ||
| luminPdf, | ||
| signatureRequestId: { | ||
| propDefinition: [ | ||
| luminPdf, | ||
| "signatureRequestId", | ||
| ], | ||
| }, | ||
| filePath: { | ||
| type: "string", | ||
| label: "File Path", | ||
| description: "The path to the file you'd like to download eg. `/tmp/file.pdf`", | ||
| }, | ||
| syncDir: { | ||
| type: "dir", | ||
| accessMode: "write", | ||
| sync: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.luminPdf.downloadFile({ | ||
| $, | ||
| signatureRequestId: this.signatureRequestId, | ||
| responseType: "stream", | ||
| }); | ||
|
|
||
| const pipeline = promisify(stream.pipeline); | ||
| await pipeline(response, fs.createWriteStream(this.filePath)); | ||
|
|
||
| $.export("$summary", `Successfully downloaded file for signature request with ID: ${this.signatureRequestId}`); | ||
| return { | ||
| filePath: this.filePath, | ||
| }; | ||
| }, | ||
| }; | ||
27 changes: 27 additions & 0 deletions
27
components/lumin_pdf/actions/get-signature-request/get-signature-request.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import luminPdf from "../../lumin_pdf.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "lumin_pdf-get-signature-request", | ||
| name: "Get Signature Request", | ||
| description: "Get details of a specific signature request. [See the documentation](https://developers.luminpdf.com/api/get-signature-request/)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| luminPdf, | ||
| signatureRequestId: { | ||
| propDefinition: [ | ||
| luminPdf, | ||
| "signatureRequestId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.luminPdf.getSignatureRequest({ | ||
| $, | ||
| signatureRequestId: this.signatureRequestId, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully retrieved signature request with ID: ${this.signatureRequestId}`); | ||
| return response; | ||
| }, | ||
| }; |
20 changes: 20 additions & 0 deletions
20
components/lumin_pdf/actions/get-user-information/get-user-information.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import luminPdf from "../../lumin_pdf.app.mjs"; | ||
|
|
||
| export default { | ||
| name: "Get User Information", | ||
| version: "0.0.1", | ||
| key: "lumin_pdf-get-user-information", | ||
| description: "Get information about the current authenticated user. [See the documentation](https://developers.luminpdf.com/api/get-user-information/)", | ||
| type: "action", | ||
| props: { | ||
| luminPdf, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.luminPdf.getUserInformation({ | ||
| $, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully retrieved user information for ${response.user.email || response.user.id}`); | ||
| return response; | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| }; | ||
194 changes: 194 additions & 0 deletions
194
components/lumin_pdf/actions/send-signature-request/send-signature-request.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,194 @@ | ||
| import { | ||
| ConfigurationError, | ||
| getFileStreamAndMetadata, | ||
| } from "@pipedream/platform"; | ||
| import FormData from "form-data"; | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| import { parseObject } from "../../common/utils.mjs"; | ||
| import luminPdf from "../../lumin_pdf.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "lumin_pdf-send-signature-request", | ||
| name: "Send Signature Request", | ||
| description: "Send a signature request to signers. [See the documentation](https://developers.luminpdf.com/api/send-signature-request/)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| luminPdf, | ||
| fileUrl: { | ||
| type: "string", | ||
| label: "File URL", | ||
| description: "The URL of a single file to be downloaded and signed. This field is mutually exclusive with `file`, `files`, and `File URLs`. Only one of these fields should be provided in the request.", | ||
| optional: true, | ||
| }, | ||
| file: { | ||
| type: "string", | ||
| label: "File", | ||
| description: "A single path to a file in the `/tmp` directory (for example, `/tmp/myFile.pdf`) to be sent for signature. This field is mutually exclusive with `File URL`, `Files`, and `File URLs`. Only one of these fields should be provided in the request.", | ||
| optional: true, | ||
| }, | ||
| fileUrls: { | ||
| type: "string[]", | ||
| label: "File URLs", | ||
| description: "An array of URLs of files to be downloaded and signed. This field is mutually exclusive with `File`, `Files`, and `File URL`. Only one of these fields should be provided in the request.", | ||
| optional: true, | ||
| }, | ||
| files: { | ||
| type: "string[]", | ||
| label: "Files", | ||
| description: "An array of path to files in the `/tmp` directory (for example, `/tmp/myFile.pdf`) to be sent for signature. This field is mutually exclusive with `File URL`, `Files`, and `File URLs`. Only one of these fields should be provided in the request.", | ||
| optional: true, | ||
| }, | ||
| signers: { | ||
| type: "string[]", | ||
| label: "Signers", | ||
| description: "A list of objects of signers to add to your Signature Request. Format: `[{'email_address': '[email protected]', 'name': 'John Doe', 'group': 1}, {'email_address': '[email protected]', 'name': 'Jane Doe', 'group': 2}]`. [See the documentation](https://developers.luminpdf.com/api/send-signature-request/) for more information.", | ||
| optional: true, | ||
| }, | ||
| viewers: { | ||
| type: "string[]", | ||
| label: "Viewers", | ||
| description: "A list of objects of viewers to add to your Signature Request. Format: `[{'email_address': '[email protected]', 'name': 'John Doe'}, {'email_address': '[email protected]', 'name': 'Jane Doe'}]`. [See the documentation](https://developers.luminpdf.com/api/send-signature-request/) for more information.", | ||
| optional: true, | ||
| }, | ||
| title: { | ||
| type: "string", | ||
| label: "Title", | ||
| description: "The title you want to give the Signature Request.", | ||
| }, | ||
| expiresAt: { | ||
| type: "string", | ||
| label: "Expires At", | ||
| description: "When the Signature Request will expire. Should be later than today. In ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ).", | ||
| }, | ||
| useTextTags: { | ||
| type: "boolean", | ||
| label: "Use Text Tags", | ||
| description: "Set to `true` to enable Text Tag parsing in your document. Your Text Tags will be converted into UI components for the user to interact with.", | ||
| optional: true, | ||
| }, | ||
| signingType: { | ||
| type: "string", | ||
| label: "Signing Type", | ||
| description: "The signing order for the Signature Request.", | ||
| options: [ | ||
| "SAME_TIME", | ||
| "ORDER", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| senderEmail: { | ||
| type: "string", | ||
| label: "Sender Email", | ||
| description: "The email address of the sender.", | ||
| optional: true, | ||
| }, | ||
| subject: { | ||
| type: "string", | ||
| label: "Subject", | ||
| description: "The subject of the email.", | ||
| optional: true, | ||
| }, | ||
| customEmailTitle: { | ||
| type: "string", | ||
| label: "Custom Email Title", | ||
| description: "The title of the email.", | ||
| optional: true, | ||
| }, | ||
| syncDir: { | ||
| type: "dir", | ||
| accessMode: "read", | ||
| sync: true, | ||
| optional: true, | ||
| }, | ||
| }, | ||
| methods: { | ||
| async appendFile(formData, fieldName, file) { | ||
| const { | ||
| stream, | ||
| metadata, | ||
| } = await getFileStreamAndMetadata(file); | ||
| formData.append(fieldName, stream, { | ||
| contentType: metadata.contentType, | ||
| knownLength: metadata.size, | ||
| filename: metadata.name, | ||
| }); | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const formData = new FormData(); | ||
| const checkFiles = {}; | ||
| if (this.file) checkFiles.file = this.file; | ||
| if (this.files) checkFiles.files = this.files; | ||
| if (this.fileUrl) checkFiles.fileUrl = this.fileUrl; | ||
| if (this.fileUrls) checkFiles.fileUrls = this.fileUrls; | ||
|
|
||
| if (Object.keys(checkFiles).length > 1) { | ||
| throw new ConfigurationError("Only one of `File URL`, `File`, `File URLs`, or `Files` should be provided in the request."); | ||
| } | ||
| if (Object.keys(checkFiles).length === 0) { | ||
| throw new ConfigurationError("At least one of `File URL`, `File`, `File URLs`, or `Files` should be provided in the request."); | ||
| } | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| if (this.file) { | ||
| await this.appendFile(formData, "file", this.file); | ||
| } | ||
| if (this.files) { | ||
| for (const [ | ||
| index, | ||
| file, | ||
| ] of this.files.entries()) { | ||
| await this.appendFile(formData, `files[${index}]`, file); | ||
| } | ||
| } | ||
| if (this.fileUrl) { | ||
| formData.append("file_url", this.fileUrl); | ||
| } | ||
| if (this.fileUrls) { | ||
| for (const [ | ||
| index, | ||
| fileUrl, | ||
| ] of this.fileUrls.entries()) { | ||
| formData.append(`file_urls[${index}]`, fileUrl); | ||
| } | ||
| } | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if (this.signers) { | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| for (const [ | ||
| index, | ||
| signer, | ||
| ] of parseObject(this.signers).entries()) { | ||
| for (const item of Object.keys(signer)) { | ||
| formData.append(`signers[${index}][${item}]`, signer[item]); | ||
| } | ||
| } | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| if (this.viewers) { | ||
| for (const [ | ||
| index, | ||
| viewer, | ||
| ] of parseObject(this.viewers).entries()) { | ||
| for (const item of Object.keys(viewer)) { | ||
| formData.append(`viewers[${index}][${item}]`, viewer[item]); | ||
| } | ||
| } | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| if (this.title) formData.append("title", this.title); | ||
| if (this.expiresAt) formData.append("expires_at", Date.parse(this.expiresAt)); | ||
| if (this.useTextTags) formData.append("use_text_tags", `${this.useTextTags}`); | ||
| if (this.signingType) formData.append("signing_type", this.signingType); | ||
| if (this.senderEmail) formData.append("custom_email[sender_email]", this.senderEmail); | ||
| if (this.senderEmail) formData.append("custom_email[subject_name]", this.subject); | ||
| if (this.senderEmail) formData.append("custom_email[title]", this.customEmailTitle); | ||
|
|
||
| const response = await this.luminPdf.sendSignatureRequest({ | ||
| $, | ||
| headers: formData.getHeaders(), | ||
| data: formData, | ||
| }); | ||
|
|
||
| if (response) { | ||
| $.export("$summary", `Successfully sent signature request ${response.signature_request.signature_request_id}`); | ||
| } | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| return response; | ||
| }, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| export const parseObject = (obj) => { | ||
| if (!obj) return undefined; | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| if (Array.isArray(obj)) { | ||
| return obj.map((item) => { | ||
| if (typeof item === "string") { | ||
| try { | ||
| return JSON.parse(item); | ||
| } catch (e) { | ||
| return item; | ||
| } | ||
| } | ||
| return item; | ||
| }); | ||
| } | ||
| if (typeof obj === "string") { | ||
| try { | ||
| return JSON.parse(obj); | ||
| } catch (e) { | ||
| return obj; | ||
| } | ||
| } | ||
| return obj; | ||
| }; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.