Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "microsoft_outlook-add-label-to-email",
name: "Add Label to Email",
description: "Adds a label/category to an email in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/message-update)",
version: "0.0.7",
version: "0.0.8",
type: "action",
props: {
microsoftOutlook,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "microsoft_outlook-approve-workflow",
name: "Approve Workflow",
description: "Suspend the workflow until approved by email. [See the documentation](https://pipedream.com/docs/code/nodejs/rerun#flowsuspend)",
version: "0.0.5",
version: "0.0.6",
type: "action",
props: {
microsoftOutlook,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
export default {
type: "action",
key: "microsoft_outlook-create-contact",
version: "0.0.14",
version: "0.0.15",
name: "Create Contact",
description: "Add a contact to the root Contacts folder, [See the documentation](https://docs.microsoft.com/en-us/graph/api/user-post-contacts)",
props: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import microsoftOutlook from "../../microsoft_outlook.app.mjs";
import { parseObject } from "../../common/utils.mjs";

export default {
type: "action",
key: "microsoft_outlook-create-draft-email",
version: "0.0.14",
version: "0.0.15",
name: "Create Draft Email",
description: "Create a draft email, [See the documentation](https://docs.microsoft.com/en-us/graph/api/user-post-messages)",
props: {
Expand Down Expand Up @@ -62,8 +63,8 @@ export default {
const response = await this.microsoftOutlook.createDraft({
$,
data: {
...this.microsoftOutlook.prepareMessageBody(this),
...this.expand,
...await this.microsoftOutlook.prepareMessageBody(this),
...parseObject(this.expand),
},
});
$.export("$summary", "Email draft has been created.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "microsoft_outlook-download-attachment",
name: "Download Attachment",
description: "Downloads an attachment to the /tmp directory. [See the documentation](https://learn.microsoft.com/en-us/graph/api/attachment-get?view=graph-rest-1.0&tabs=http)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
microsoftOutlook,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
export default {
type: "action",
key: "microsoft_outlook-find-contacts",
version: "0.0.14",
version: "0.0.15",
name: "Find Contacts",
description: "Finds contacts with the given search string. [See the documentation](https://docs.microsoft.com/en-us/graph/api/user-list-contacts)",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "microsoft_outlook-find-email",
name: "Find Email",
description: "Search for an email in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/user-list-messages)",
version: "0.0.5",
version: "0.0.6",
type: "action",
props: {
microsoftOutlook,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
export default {
type: "action",
key: "microsoft_outlook-list-contacts",
version: "0.0.14",
version: "0.0.15",
name: "List Contacts",
description: "Get a contact collection from the default contacts folder, [See the documentation](https://docs.microsoft.com/en-us/graph/api/user-list-contacts)",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "microsoft_outlook-list-folders",
name: "List Folders",
description: "Retrieves a list of all folders in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/user-list-mailfolders)",
version: "0.0.5",
version: "0.0.6",
type: "action",
props: {
microsoftOutlook,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "microsoft_outlook-list-labels",
name: "List Labels",
description: "Get all the labels/categories that have been defined for a user. [See the documentation](https://learn.microsoft.com/en-us/graph/api/outlookuser-list-mastercategories)",
version: "0.0.7",
version: "0.0.8",
type: "action",
props: {
microsoftOutlook,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "microsoft_outlook-move-email-to-folder",
name: "Move Email to Folder",
description: "Moves an email to the specified folder in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/message-move)",
version: "0.0.5",
version: "0.0.6",
type: "action",
props: {
microsoftOutlook,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "microsoft_outlook-remove-label-from-email",
name: "Remove Label from Email",
description: "Removes a label/category from an email in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/message-update)",
version: "0.0.7",
version: "0.0.8",
type: "action",
props: {
microsoftOutlook,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "microsoft_outlook-reply-to-email",
name: "Reply to Email",
description: "Reply to an email in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/message-reply)",
version: "0.0.4",
version: "0.0.5",
type: "action",
props: {
microsoftOutlook,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import microsoftOutlook from "../../microsoft_outlook.app.mjs";
import { parseObject } from "../../common/utils.mjs";

export default {
type: "action",
key: "microsoft_outlook-send-email",
version: "0.0.15",
version: "0.0.16",
name: "Send Email",
description: "Send an email to one or multiple recipients, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-sendmail)",
props: {
Expand Down Expand Up @@ -64,7 +65,7 @@ export default {
data: {
message: {
...await this.microsoftOutlook.prepareMessageBody(this),
...this.expand,
...parseObject(this.expand),
},
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
export default {
type: "action",
key: "microsoft_outlook-update-contact",
version: "0.0.14",
version: "0.0.15",
name: "Update Contact",
description: "Add a contact to the root Contacts folder, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-post-contacts)",
props: {
Expand Down
29 changes: 29 additions & 0 deletions components/microsoft_outlook/common/utils.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
export const parseObject = (obj) => {
if (!obj) {
return {};
}

if (typeof obj === "string") {
try {
return JSON.parse(obj);
} catch {
return obj;
}
}

if (Array.isArray(obj)) {
return obj.map(parseObject);
}

if (typeof obj === "object") {
return Object.fromEntries(Object.entries(obj).map(([
key,
value,
]) => [
key,
parseObject(value),
]));
}

return obj;
};
12 changes: 6 additions & 6 deletions components/microsoft_outlook/microsoft_outlook.app.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {
axios, getFileStream,
axios, getFileStreamAndMetadata,
} from "@pipedream/platform";
import path from "path";
import mime from "mime-types";
const DEFAULT_LIMIT = 50;

export default {
Expand Down Expand Up @@ -297,12 +295,14 @@ export default {

const attachments = [];
for (let i = 0; self.files && i < self.files.length; i++) {
const stream = await getFileStream(self.files[i]);
const {
stream, metadata,
} = await getFileStreamAndMetadata(self.files[i]);
const base64 = await this.streamToBase64(stream);
attachments.push({
"@odata.type": "#microsoft.graph.fileAttachment",
"name": path.basename(self.files[i]),
"contentType": mime.lookup(self.files[i]),
"name": metadata.name,
"contentType": metadata.contentType,
"contentBytes": base64,
});
}
Expand Down
2 changes: 1 addition & 1 deletion components/microsoft_outlook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/microsoft_outlook",
"version": "1.5.1",
"version": "1.5.2",
"description": "Pipedream Microsoft Outlook Components",
"main": "microsoft_outlook.app.mjs",
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "microsoft_outlook-new-attachment-received",
name: "New Attachment Received (Instant)",
description: "Emit new event when a new email containing one or more attachments arrives in a specified Microsoft Outlook folder.",
version: "0.0.2",
version: "0.0.3",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "microsoft_outlook-new-contact",
name: "New Contact Event (Instant)",
description: "Emit new event when a new Contact is created",
version: "0.0.15",
version: "0.0.16",
type: "source",
hooks: {
...common.hooks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "microsoft_outlook-new-email",
name: "New Email Event (Instant)",
description: "Emit new event when an email is received in specified folders.",
version: "0.0.18",
version: "0.0.19",
type: "source",
dedupe: "unique",
methods: {
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading