@activepieces/piece-microsoft-outlook 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,9 +1,11 @@
1
1
  {
2
2
  "name": "@activepieces/piece-microsoft-outlook",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "dependencies": {
5
+ "@ai-sdk/mcp": "1.0.1 ",
5
6
  "@microsoft/microsoft-graph-client": "3.0.7",
6
7
  "@microsoft/microsoft-graph-types": "2.40.0",
8
+ "@modelcontextprotocol/sdk": "1.25.2",
7
9
  "@sinclair/typebox": "0.34.11",
8
10
  "ai": "5.0.104",
9
11
  "axios": "1.13.1",
@@ -11,14 +13,15 @@
11
13
  "dayjs": "1.11.9",
12
14
  "deepmerge-ts": "7.1.0",
13
15
  "form-data": "4.0.4",
16
+ "i18next": "23.13.0",
14
17
  "mime-types": "2.1.35",
15
18
  "nanoid": "3.3.8",
16
19
  "semver": "7.6.0",
17
20
  "socket.io-client": "4.8.1",
18
21
  "zod": "4.1.13",
19
- "@activepieces/pieces-common": "0.11.1",
22
+ "@activepieces/pieces-common": "0.11.2",
20
23
  "@activepieces/pieces-framework": "0.23.0",
21
- "@activepieces/shared": "0.30.4",
24
+ "@activepieces/shared": "0.32.0",
22
25
  "tslib": "2.6.2"
23
26
  },
24
27
  "resolutions": {
@@ -85,5 +85,11 @@
85
85
  "Triggers when a new email is received in the inbox.": "Triggers when a new email is received in the inbox.",
86
86
  "Triggers when a new email is delivered into the specified folder.": "Triggers when a new email is delivered into the specified folder.",
87
87
  "Triggers when a new email containing one or more attachments arrives.": "Triggers when a new email containing one or more attachments arrives.",
88
- "Monitor attachments in a specific folder. Leave empty to monitor all folders.": "Monitor attachments in a specific folder. Leave empty to monitor all folders."
88
+ "From (Sender Email)": "From (Sender Email)",
89
+ "To (Recipient Email)": "To (Recipient Email)",
90
+ "Attachment Name Filter": "Attachment Name Filter",
91
+ "Filter emails from a specific sender (optional). Leave empty to for all senders.": "Filter emails from a specific sender (optional). Leave empty to for all senders.",
92
+ "Filter emails to a specific recipient (optional). Leave empty to for all recipients.": "Filter emails to a specific recipient (optional). Leave empty to for all recipients.",
93
+ "Monitor attachments in a specific folder. Leave empty to monitor all folders.": "Monitor attachments in a specific folder. Leave empty to monitor all folders.",
94
+ "Filter attachments by name (contains). Leave empty to include all attachments.": "Filter attachments by name (contains). Leave empty to include all attachments."
89
95
  }
package/src/index.js CHANGED
@@ -19,6 +19,7 @@ const auth_1 = require("./lib/common/auth");
19
19
  const new_attachment_1 = require("./lib/triggers/new-attachment");
20
20
  const new_email_in_folder_1 = require("./lib/triggers/new-email-in-folder");
21
21
  const new_email_1 = require("./lib/triggers/new-email");
22
+ const request_approval_send_email_1 = require("./lib/actions/request-approval-send-email");
22
23
  exports.microsoftOutlook = (0, pieces_framework_1.createPiece)({
23
24
  displayName: 'Microsoft Outlook',
24
25
  auth: auth_1.microsoftOutlookAuth,
@@ -33,6 +34,7 @@ exports.microsoftOutlook = (0, pieces_framework_1.createPiece)({
33
34
  create_draft_email_1.createDraftEmailAction,
34
35
  add_label_to_email_1.addLabelToEmailAction,
35
36
  remove_label_from_email_1.removeLabelFromEmailAction,
37
+ request_approval_send_email_1.requestApprovalInMail,
36
38
  move_email_to_folder_1.moveEmailToFolderAction,
37
39
  send_draft_email_1.sendDraftEmailAction,
38
40
  forward_email_1.forwardEmailAction,
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/microsoft-outlook/src/index.ts"],"names":[],"mappings":";;;;AAAA,+DAAwE;AACxE,qEAAkF;AAClF,iDAAqD;AACrD,yEAAyE;AACzE,yEAA0E;AAC1E,uFAAmF;AACnF,yDAA2D;AAC3D,+DAAiE;AACjE,6EAA6E;AAC7E,mFAAmF;AACnF,2DAA6D;AAC7D,qEAAsE;AACtE,yDAA2D;AAC3D,4CAAyD;AACzD,kEAAqE;AACrE,4EAA6E;AAC7E,wDAA2D;AAE9C,QAAA,gBAAgB,GAAG,IAAA,8BAAW,EAAC;IAC3C,WAAW,EAAE,mBAAmB;IAChC,IAAI,EAAE,2BAAoB;IAC1B,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,2DAA2D;IACpE,UAAU,EAAE,CAAC,sBAAa,CAAC,YAAY,CAAC;IACxC,OAAO,EAAE,CAAC,gBAAgB,EAAE,YAAY,EAAC,aAAa,CAAC;IACvD,OAAO,EAAE;QACR,4BAAe;QACf,oDAAwB;QACxB,8BAAgB;QAChB,2CAAsB;QACtB,0CAAqB;QACrB,oDAA0B;QAC1B,8CAAuB;QACvB,uCAAoB;QACpB,kCAAkB;QAClB,4BAAe;QACf,IAAA,yCAAyB,EAAC;YACzB,IAAI,EAAE,2BAAoB;YAC1B,OAAO,EAAE,GAAG,EAAE,CAAC,mCAAmC;YAClD,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC7B,aAAa,EAAE,UAAW,IAA4B,CAAC,YAAY,EAAE;iBACrE,CAAC,CAAA;cAAA;SACF,CAAC;KACF;IACD,QAAQ,EAAE;QACT,2BAAe;QACf,6CAAuB;QACvB,qCAAoB;KACpB;CACD,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/microsoft-outlook/src/index.ts"],"names":[],"mappings":";;;;AAAA,+DAAwE;AACxE,qEAAkF;AAClF,iDAAqD;AACrD,yEAAyE;AACzE,yEAA0E;AAC1E,uFAAmF;AACnF,yDAA2D;AAC3D,+DAAiE;AACjE,6EAA6E;AAC7E,mFAAmF;AACnF,2DAA6D;AAC7D,qEAAsE;AACtE,yDAA2D;AAC3D,4CAAyD;AACzD,kEAAqE;AACrE,4EAA6E;AAC7E,wDAA2D;AAC3D,2FAAkF;AAErE,QAAA,gBAAgB,GAAG,IAAA,8BAAW,EAAC;IAC3C,WAAW,EAAE,mBAAmB;IAChC,IAAI,EAAE,2BAAoB;IAC1B,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,2DAA2D;IACpE,UAAU,EAAE,CAAC,sBAAa,CAAC,YAAY,CAAC;IACxC,OAAO,EAAE,CAAC,gBAAgB,EAAE,YAAY,EAAC,aAAa,CAAC;IACvD,OAAO,EAAE;QACR,4BAAe;QACf,oDAAwB;QACxB,8BAAgB;QAChB,2CAAsB;QACtB,0CAAqB;QACrB,oDAA0B;QAC1B,mDAAqB;QACrB,8CAAuB;QACvB,uCAAoB;QACpB,kCAAkB;QAClB,4BAAe;QACf,IAAA,yCAAyB,EAAC;YACzB,IAAI,EAAE,2BAAoB;YAC1B,OAAO,EAAE,GAAG,EAAE,CAAC,mCAAmC;YAClD,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC7B,aAAa,EAAE,UAAW,IAA4B,CAAC,YAAY,EAAE;iBACrE,CAAC,CAAA;cAAA;SACF,CAAC;KACF;IACD,QAAQ,EAAE;QACT,2BAAe;QACf,6CAAuB;QACvB,qCAAoB;KACpB;CACD,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const requestApprovalInMail: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ recipients: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ subject: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ body: import("@activepieces/pieces-framework").LongTextProperty<true>;
5
+ }>;
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.requestApprovalInMail = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
7
+ const shared_1 = require("@activepieces/shared");
8
+ const auth_1 = require("../common/auth");
9
+ exports.requestApprovalInMail = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.microsoftOutlookAuth,
11
+ name: 'request_approval_in_mail',
12
+ displayName: 'Request Approval in Email',
13
+ description: 'Send approval request email and then wait until the email is approved or disapproved',
14
+ props: {
15
+ recipients: pieces_framework_1.Property.ShortText({
16
+ displayName: 'To Email Address',
17
+ description: 'The email address of the recipient who will receive the approval request.',
18
+ required: true,
19
+ }),
20
+ subject: pieces_framework_1.Property.ShortText({
21
+ displayName: 'Subject',
22
+ description: 'The subject of the approval request email.',
23
+ required: true,
24
+ }),
25
+ body: pieces_framework_1.Property.LongText({
26
+ displayName: 'Body',
27
+ description: 'The main content of the email. You can include details about the approval request here in the html format or plain text.',
28
+ required: true,
29
+ }),
30
+ },
31
+ run(context) {
32
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
33
+ if (context.executionType === shared_1.ExecutionType.BEGIN) {
34
+ try {
35
+ const token = context.auth.access_token;
36
+ const recipients = context.propsValue.recipients;
37
+ const { subject, body } = context.propsValue;
38
+ (0, shared_1.assertNotNullOrUndefined)(token, 'token');
39
+ (0, shared_1.assertNotNullOrUndefined)(recipients, 'recipients');
40
+ (0, shared_1.assertNotNullOrUndefined)(subject, 'subject');
41
+ (0, shared_1.assertNotNullOrUndefined)(body, 'body');
42
+ const approvalLink = context.generateResumeUrl({
43
+ queryParams: { action: 'approve' },
44
+ });
45
+ const disapprovalLink = context.generateResumeUrl({
46
+ queryParams: { action: 'disapprove' },
47
+ });
48
+ const htmlBody = `
49
+ <div>
50
+ <p>${body}</p>
51
+ <br />
52
+ <p>
53
+ <a href="${approvalLink}" style="display: inline-block; padding: 10px 20px; margin-right: 10px; background-color: #28a745; color: white; text-decoration: none; border-radius: 4px;">Approve</a>
54
+ <a href="${disapprovalLink}" style="display: inline-block; padding: 10px 20px; background-color: #dc3545; color: white; text-decoration: none; border-radius: 4px;">Disapprove</a>
55
+ </p>
56
+ </div>
57
+ `;
58
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
59
+ authProvider: {
60
+ getAccessToken: () => Promise.resolve(context.auth.access_token),
61
+ },
62
+ });
63
+ const mailPayload = {
64
+ subject,
65
+ body: {
66
+ content: htmlBody,
67
+ contentType: 'html',
68
+ },
69
+ toRecipients: [
70
+ {
71
+ emailAddress: {
72
+ address: recipients,
73
+ },
74
+ },
75
+ ],
76
+ };
77
+ const sendResult = yield client.api('/me/sendMail').post({
78
+ message: mailPayload,
79
+ saveToSentItems: true,
80
+ });
81
+ context.run.pause({
82
+ pauseMetadata: {
83
+ type: shared_1.PauseType.WEBHOOK,
84
+ response: {},
85
+ },
86
+ });
87
+ return {
88
+ approved: false, // default approval is false
89
+ };
90
+ }
91
+ catch (error) {
92
+ console.error('[RequestApprovalEmail] Error during BEGIN execution:', error);
93
+ throw error;
94
+ }
95
+ }
96
+ else {
97
+ const action = context.resumePayload.queryParams['action'];
98
+ const approved = action === 'approve';
99
+ return {
100
+ approved,
101
+ };
102
+ }
103
+ });
104
+ },
105
+ });
106
+ //# sourceMappingURL=request-approval-send-email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-approval-send-email.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-outlook/src/lib/actions/request-approval-send-email.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,8EAA2D;AAE3D,iDAI8B;AAC9B,yCAAsD;AAEzC,QAAA,qBAAqB,GAAG,IAAA,+BAAY,EAAC;IAChD,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,0BAA0B;IAChC,WAAW,EAAE,2BAA2B;IACxC,WAAW,EACT,sFAAsF;IACxF,KAAK,EAAE;QACL,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,kBAAkB;YAC/B,WAAW,EACT,2EAA2E;YAC7E,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,4CAA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