Skip to content

Commit 78c5717

Browse files
committed
adds payload validation
1 parent 521c513 commit 78c5717

File tree

17 files changed

+45
-32
lines changed

17 files changed

+45
-32
lines changed

components/gmail/actions/add-label-to-email/add-label-to-email.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "gmail-add-label-to-email",
55
name: "Add Label to Email",
66
description: "Add label(s) to an email message. [See the docs](https://developers.google.com/gmail/api/reference/rest/v1/users.messages/modify)",
7-
version: "0.0.8",
7+
version: "0.0.9",
88
type: "action",
99
props: {
1010
gmail,

components/gmail/actions/approve-workflow/approve-workflow.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "gmail-approve-workflow",
55
name: "Approve Workflow",
66
description: "Suspend the workflow until approved by email. [See the documentation](https://pipedream.com/docs/code/nodejs/rerun#flowsuspend)",
7-
version: "0.0.4",
7+
version: "0.0.5",
88
type: "action",
99
props: {
1010
gmail,

components/gmail/actions/archive-email/archive-email.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import gmail from "../../gmail.app.mjs";
21
import constants from "../../common/constants.mjs";
2+
import gmail from "../../gmail.app.mjs";
33

44
export default {
55
key: "gmail-archive-email",
66
name: "Archive Email",
77
description: "Archive an email message. [See the documentation](https://developers.google.com/gmail/api/reference/rest/v1/users.messages/modify)",
8-
version: "0.0.2",
8+
version: "0.0.3",
99
type: "action",
1010
props: {
1111
gmail,

components/gmail/actions/create-draft/create-draft.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import gmail from "../../gmail.app.mjs";
21
import { ConfigurationError } from "@pipedream/platform";
32
import utils from "../../common/utils.mjs";
3+
import gmail from "../../gmail.app.mjs";
44

55
export default {
66
key: "gmail-create-draft",
77
name: "Create Draft",
88
description: "Create a draft from your Google Workspace email account. [See the documentation](https://developers.google.com/gmail/api/reference/rest/v1/users.drafts/create)",
9-
version: "0.1.1",
9+
version: "0.1.2",
1010
type: "action",
1111
props: {
1212
gmail,

components/gmail/actions/download-attachment/download-attachment.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import gmail from "../../gmail.app.mjs";
1+
import { ConfigurationError } from "@pipedream/platform";
22
import fs from "fs";
33
import path from "path";
4-
import { ConfigurationError } from "@pipedream/platform";
4+
import gmail from "../../gmail.app.mjs";
55

66
export default {
77
key: "gmail-download-attachment",
88
name: "Download Attachment",
99
description: "Download an attachment by attachmentId to the /tmp directory. [See the documentation](https://developers.google.com/gmail/api/reference/rest/v1/users.messages.attachments/get)",
10-
version: "0.0.6",
10+
version: "0.0.7",
1111
type: "action",
1212
props: {
1313
gmail,

components/gmail/actions/find-email/find-email.mjs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "gmail-find-email",
55
name: "Find Email",
66
description: "Find an email using Google's Search Engine. [See the docs](https://developers.google.com/gmail/api/reference/rest/v1/users.messages/list)",
7-
version: "0.0.11",
7+
version: "0.1.0",
88
type: "action",
99
props: {
1010
gmail,
@@ -14,6 +14,12 @@ export default {
1414
"q",
1515
],
1616
},
17+
withPayload: {
18+
type: "boolean",
19+
label: "With Payload",
20+
description: "Whether or not to return the full content of the email message. If set to `true`, the action will return the full content of the email message, including headers and body. `Setting to true may make the response size larger and slower`.",
21+
default: false,
22+
},
1723
labels: {
1824
propDefinition: [
1925
gmail,
@@ -47,14 +53,21 @@ export default {
4753
maxResults: this.maxResults,
4854
});
4955
const messageIds = messages.map(({ id }) => id);
50-
const messagesToEmit = await this.gmail.getMessages(messageIds);
56+
let messagesToEmit = await this.gmail.getMessages(messageIds);
5157

52-
for await (const message of messagesToEmit) {
53-
for (const part of message.payload?.parts || []) {
54-
if (part.body.data) {
55-
part.body.text = Buffer.from(part.body.data, "base64").toString("utf-8");
58+
if (this.withPayload) {
59+
for await (const message of messagesToEmit) {
60+
for (const part of message.payload?.parts || []) {
61+
if (part.body.data) {
62+
part.body.text = Buffer.from(part.body.data, "base64").toString("utf-8");
63+
}
5664
}
5765
}
66+
} else {
67+
messagesToEmit = messagesToEmit.map((message) => {
68+
delete message.payload;
69+
return message;
70+
});
5871
}
5972

6073
const suffix = messagesToEmit.length === 1

components/gmail/actions/list-labels/list-labels.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "gmail-list-labels",
55
name: "List Labels",
66
description: "List all the existing labels in the connected account. [See the docs](https://developers.google.com/gmail/api/reference/rest/v1/users.labels/list)",
7-
version: "0.0.3",
7+
version: "0.0.4",
88
type: "action",
99
props: {
1010
gmail,

components/gmail/actions/remove-label-from-email/remove-label-from-email.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "gmail-remove-label-from-email",
55
name: "Remove Label from Email",
66
description: "Remove label(s) from an email message. [See the docs](https://developers.google.com/gmail/api/reference/rest/v1/users.messages/modify)",
7-
version: "0.0.5",
7+
version: "0.0.6",
88
type: "action",
99
props: {
1010
gmail,

components/gmail/actions/send-email/send-email.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import gmail from "../../gmail.app.mjs";
21
import { ConfigurationError } from "@pipedream/platform";
32
import utils from "../../common/utils.mjs";
3+
import gmail from "../../gmail.app.mjs";
44

55
export default {
66
key: "gmail-send-email",
77
name: "Send Email",
88
description: "Send an email from your Google Workspace email account. [See the documentation](https://developers.google.com/gmail/api/reference/rest/v1/users.messages/send)",
9-
version: "0.1.9",
9+
version: "0.1.10",
1010
type: "action",
1111
props: {
1212
gmail,

components/gmail/actions/update-org-signature/update-org-signature.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import googleCloud from "../../../google_cloud/google_cloud.app.mjs";
2-
import base from "../update-primary-signature/update-primary-signature.mjs";
32
import gmail from "../../gmail.app.mjs";
3+
import base from "../update-primary-signature/update-primary-signature.mjs";
44

55
export default {
66
...base,
77
key: "gmail-update-org-signature",
88
name: "Update Signature for Email in Organization",
99
description: `Update the signature for a specific email address in an organization.
1010
A Google Cloud service account with delegated domain-wide authority is required for this action. [See the documentation](https://developers.google.com/gmail/api/reference/rest/v1/users.settings.sendAs/update)`,
11-
version: "0.0.6",
11+
version: "0.0.7",
1212
type: "action",
1313
props: {
1414
gmail,

0 commit comments

Comments
 (0)