@activepieces/piece-microsoft-outlook 0.3.5 → 0.4.0
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 +7 -13
- package/src/index.js +40 -63
- package/src/index.d.ts +0 -2
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/actions/add-label-to-email.d.ts +0 -5
- package/src/lib/actions/add-label-to-email.d.ts.map +0 -1
- package/src/lib/actions/add-label-to-email.js +0 -48
- package/src/lib/actions/add-label-to-email.js.map +0 -1
- package/src/lib/actions/create-draft-email.d.ts +0 -10
- package/src/lib/actions/create-draft-email.d.ts.map +0 -1
- package/src/lib/actions/create-draft-email.js +0 -112
- package/src/lib/actions/create-draft-email.js.map +0 -1
- package/src/lib/actions/download-email-attachment.d.ts +0 -4
- package/src/lib/actions/download-email-attachment.d.ts.map +0 -1
- package/src/lib/actions/download-email-attachment.js +0 -48
- package/src/lib/actions/download-email-attachment.js.map +0 -1
- package/src/lib/actions/find-email.d.ts +0 -6
- package/src/lib/actions/find-email.d.ts.map +0 -1
- package/src/lib/actions/find-email.js +0 -71
- package/src/lib/actions/find-email.js.map +0 -1
- package/src/lib/actions/forward-email.d.ts +0 -6
- package/src/lib/actions/forward-email.d.ts.map +0 -1
- package/src/lib/actions/forward-email.js +0 -65
- package/src/lib/actions/forward-email.js.map +0 -1
- package/src/lib/actions/move-email-to-folder.d.ts +0 -5
- package/src/lib/actions/move-email-to-folder.d.ts.map +0 -1
- package/src/lib/actions/move-email-to-folder.js +0 -45
- package/src/lib/actions/move-email-to-folder.js.map +0 -1
- package/src/lib/actions/remove-label-from-email.d.ts +0 -5
- package/src/lib/actions/remove-label-from-email.d.ts.map +0 -1
- package/src/lib/actions/remove-label-from-email.js +0 -48
- package/src/lib/actions/remove-label-from-email.js.map +0 -1
- package/src/lib/actions/reply-email.d.ts +0 -10
- package/src/lib/actions/reply-email.d.ts.map +0 -1
- package/src/lib/actions/reply-email.js +0 -172
- package/src/lib/actions/reply-email.js.map +0 -1
- package/src/lib/actions/request-approval-send-email.d.ts +0 -6
- package/src/lib/actions/request-approval-send-email.d.ts.map +0 -1
- package/src/lib/actions/request-approval-send-email.js +0 -108
- package/src/lib/actions/request-approval-send-email.js.map +0 -1
- package/src/lib/actions/send-draft-email.d.ts +0 -4
- package/src/lib/actions/send-draft-email.d.ts.map +0 -1
- package/src/lib/actions/send-draft-email.js +0 -42
- package/src/lib/actions/send-draft-email.js.map +0 -1
- package/src/lib/actions/send-email.d.ts +0 -10
- package/src/lib/actions/send-email.d.ts.map +0 -1
- package/src/lib/actions/send-email.js +0 -115
- package/src/lib/actions/send-email.js.map +0 -1
- package/src/lib/common/auth.d.ts +0 -2
- package/src/lib/common/auth.d.ts.map +0 -1
- package/src/lib/common/auth.js +0 -51
- package/src/lib/common/auth.js.map +0 -1
- package/src/lib/common/microsoft-cloud.d.ts +0 -5
- package/src/lib/common/microsoft-cloud.d.ts.map +0 -1
- package/src/lib/common/microsoft-cloud.js +0 -38
- package/src/lib/common/microsoft-cloud.js.map +0 -1
- package/src/lib/common/props.d.ts +0 -10
- package/src/lib/common/props.d.ts.map +0 -1
- package/src/lib/common/props.js +0 -141
- package/src/lib/common/props.js.map +0 -1
- package/src/lib/triggers/new-attachment.d.ts +0 -19
- package/src/lib/triggers/new-attachment.d.ts.map +0 -1
- package/src/lib/triggers/new-attachment.js +0 -139
- package/src/lib/triggers/new-attachment.js.map +0 -1
- package/src/lib/triggers/new-email-in-folder.d.ts +0 -11
- package/src/lib/triggers/new-email-in-folder.d.ts.map +0 -1
- package/src/lib/triggers/new-email-in-folder.js +0 -99
- package/src/lib/triggers/new-email-in-folder.js.map +0 -1
- package/src/lib/triggers/new-email.d.ts +0 -15
- package/src/lib/triggers/new-email.d.ts.map +0 -1
- package/src/lib/triggers/new-email.js +0 -123
- package/src/lib/triggers/new-email.js.map +0 -1
package/src/index.d.ts
DELETED
package/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,gBAAgB,+JAmC3B,CAAC"}
|
package/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,+DAAwE;AACxE,kEAA+D;AAC/D,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,EAAE,aAAa,CAAC;IACxD,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,CAAC,IAAI,EAAE,EAAE;;gBACjB,MAAM,KAAK,GAAG,MAAC,IAA4B,CAAC,KAAK,0CAAG,OAAO,CAAuB,CAAC;gBACnF,OAAO,IAAA,iCAAe,EAAC,KAAK,CAAC,GAAG,QAAQ,CAAC;YAC1C,CAAC;YACD,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,5 +0,0 @@
|
|
|
1
|
-
export declare const addLabelToEmailAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
2
|
-
messageId: import("@activepieces/pieces-framework").DropdownProperty<string | undefined, false, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>> | import("@activepieces/pieces-framework").DropdownProperty<string | undefined, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
|
|
3
|
-
categories: import("@activepieces/pieces-framework").ArrayProperty<true>;
|
|
4
|
-
}>;
|
|
5
|
-
//# sourceMappingURL=add-label-to-email.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-label-to-email.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/add-label-to-email.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,qBAAqB;;;EAuChC,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addLabelToEmailAction = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const microsoft_cloud_1 = require("../common/microsoft-cloud");
|
|
7
|
-
const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
|
|
8
|
-
const auth_1 = require("../common/auth");
|
|
9
|
-
const props_1 = require("../common/props");
|
|
10
|
-
exports.addLabelToEmailAction = (0, pieces_framework_1.createAction)({
|
|
11
|
-
auth: auth_1.microsoftOutlookAuth,
|
|
12
|
-
name: 'addLabelToEmail',
|
|
13
|
-
displayName: 'Add Label to Email',
|
|
14
|
-
description: 'Adds a category (label) to an email message.',
|
|
15
|
-
props: {
|
|
16
|
-
messageId: (0, props_1.messageIdDropdown)({
|
|
17
|
-
displayName: 'Email',
|
|
18
|
-
description: 'Select the email message to add the label to.',
|
|
19
|
-
required: true,
|
|
20
|
-
}),
|
|
21
|
-
categories: pieces_framework_1.Property.Array({
|
|
22
|
-
displayName: 'Categories',
|
|
23
|
-
description: 'Categories to add to the email.',
|
|
24
|
-
required: true,
|
|
25
|
-
}),
|
|
26
|
-
},
|
|
27
|
-
run(context) {
|
|
28
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
var _a;
|
|
30
|
-
const { messageId, categories } = context.propsValue;
|
|
31
|
-
const cloud = (_a = context.auth.props) === null || _a === void 0 ? void 0 : _a['cloud'];
|
|
32
|
-
const client = microsoft_graph_client_1.Client.initWithMiddleware({
|
|
33
|
-
authProvider: {
|
|
34
|
-
getAccessToken: () => Promise.resolve(context.auth.access_token),
|
|
35
|
-
},
|
|
36
|
-
baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
|
|
37
|
-
});
|
|
38
|
-
const message = yield client.api(`/me/messages/${messageId}`).get();
|
|
39
|
-
const existingCategories = message.categories || [];
|
|
40
|
-
const updatedCategories = [...new Set([...existingCategories, ...categories])];
|
|
41
|
-
const response = yield client.api(`/me/messages/${messageId}`).patch({
|
|
42
|
-
categories: updatedCategories,
|
|
43
|
-
});
|
|
44
|
-
return response;
|
|
45
|
-
});
|
|
46
|
-
},
|
|
47
|
-
});
|
|
48
|
-
//# sourceMappingURL=add-label-to-email.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-label-to-email.js","sourceRoot":"","sources":["../../../../src/lib/actions/add-label-to-email.ts"],"names":[],"mappings":";;;;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,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,gBAAgB,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC;gBACpE,UAAU,EAAE,iBAAiB;aAC7B,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC;QACjB,CAAC;KAAA;CACD,CAAC,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const createDraftEmailAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
2
|
-
recipients: import("@activepieces/pieces-framework").ArrayProperty<true>;
|
|
3
|
-
ccRecipients: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
4
|
-
bccRecipients: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
5
|
-
subject: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
-
bodyFormat: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
7
|
-
body: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
8
|
-
attachments: import("@activepieces/pieces-framework").ArrayProperty<true> | import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
9
|
-
}>;
|
|
10
|
-
//# sourceMappingURL=create-draft-email.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-draft-email.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-draft-email.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,sBAAsB;;;;;;;;EAwGjC,CAAC"}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createDraftEmailAction = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const microsoft_cloud_1 = require("../common/microsoft-cloud");
|
|
7
|
-
const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
|
|
8
|
-
const auth_1 = require("../common/auth");
|
|
9
|
-
exports.createDraftEmailAction = (0, pieces_framework_1.createAction)({
|
|
10
|
-
auth: auth_1.microsoftOutlookAuth,
|
|
11
|
-
name: 'createDraftEmail',
|
|
12
|
-
displayName: 'Create Draft Email',
|
|
13
|
-
description: 'Creates a draft email message.',
|
|
14
|
-
props: {
|
|
15
|
-
recipients: pieces_framework_1.Property.Array({
|
|
16
|
-
displayName: 'To Email(s)',
|
|
17
|
-
required: true,
|
|
18
|
-
}),
|
|
19
|
-
ccRecipients: pieces_framework_1.Property.Array({
|
|
20
|
-
displayName: 'CC Email(s)',
|
|
21
|
-
required: false,
|
|
22
|
-
defaultValue: [],
|
|
23
|
-
}),
|
|
24
|
-
bccRecipients: pieces_framework_1.Property.Array({
|
|
25
|
-
displayName: 'BCC Email(s)',
|
|
26
|
-
required: false,
|
|
27
|
-
defaultValue: [],
|
|
28
|
-
}),
|
|
29
|
-
subject: pieces_framework_1.Property.ShortText({
|
|
30
|
-
displayName: 'Subject',
|
|
31
|
-
required: true,
|
|
32
|
-
}),
|
|
33
|
-
bodyFormat: pieces_framework_1.Property.StaticDropdown({
|
|
34
|
-
displayName: 'Body Format',
|
|
35
|
-
required: true,
|
|
36
|
-
defaultValue: 'text',
|
|
37
|
-
options: {
|
|
38
|
-
disabled: false,
|
|
39
|
-
options: [
|
|
40
|
-
{ label: 'HTML', value: 'html' },
|
|
41
|
-
{ label: 'Text', value: 'text' },
|
|
42
|
-
],
|
|
43
|
-
},
|
|
44
|
-
}),
|
|
45
|
-
body: pieces_framework_1.Property.LongText({
|
|
46
|
-
displayName: 'Body',
|
|
47
|
-
required: true,
|
|
48
|
-
}),
|
|
49
|
-
attachments: pieces_framework_1.Property.Array({
|
|
50
|
-
displayName: 'Attachments',
|
|
51
|
-
required: false,
|
|
52
|
-
defaultValue: [],
|
|
53
|
-
properties: {
|
|
54
|
-
file: pieces_framework_1.Property.File({
|
|
55
|
-
displayName: 'File',
|
|
56
|
-
required: true,
|
|
57
|
-
}),
|
|
58
|
-
fileName: pieces_framework_1.Property.ShortText({
|
|
59
|
-
displayName: 'File Name',
|
|
60
|
-
required: false,
|
|
61
|
-
}),
|
|
62
|
-
},
|
|
63
|
-
}),
|
|
64
|
-
},
|
|
65
|
-
run(context) {
|
|
66
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
var _a;
|
|
68
|
-
const recipients = context.propsValue.recipients;
|
|
69
|
-
const ccRecipients = context.propsValue.ccRecipients;
|
|
70
|
-
const bccRecipients = context.propsValue.bccRecipients;
|
|
71
|
-
const attachments = context.propsValue.attachments;
|
|
72
|
-
const { subject, body, bodyFormat } = context.propsValue;
|
|
73
|
-
const mailPayload = {
|
|
74
|
-
subject,
|
|
75
|
-
body: {
|
|
76
|
-
content: body,
|
|
77
|
-
contentType: bodyFormat,
|
|
78
|
-
},
|
|
79
|
-
toRecipients: recipients.map((mail) => ({
|
|
80
|
-
emailAddress: {
|
|
81
|
-
address: mail,
|
|
82
|
-
},
|
|
83
|
-
})),
|
|
84
|
-
ccRecipients: ccRecipients.map((mail) => ({
|
|
85
|
-
emailAddress: {
|
|
86
|
-
address: mail,
|
|
87
|
-
},
|
|
88
|
-
})),
|
|
89
|
-
bccRecipients: bccRecipients.map((mail) => ({
|
|
90
|
-
emailAddress: {
|
|
91
|
-
address: mail,
|
|
92
|
-
},
|
|
93
|
-
})),
|
|
94
|
-
attachments: attachments.map((attachment) => ({
|
|
95
|
-
'@odata.type': '#microsoft.graph.fileAttachment',
|
|
96
|
-
name: attachment.fileName || attachment.file.filename,
|
|
97
|
-
contentBytes: attachment.file.base64,
|
|
98
|
-
})),
|
|
99
|
-
};
|
|
100
|
-
const cloud = (_a = context.auth.props) === null || _a === void 0 ? void 0 : _a['cloud'];
|
|
101
|
-
const client = microsoft_graph_client_1.Client.initWithMiddleware({
|
|
102
|
-
authProvider: {
|
|
103
|
-
getAccessToken: () => Promise.resolve(context.auth.access_token),
|
|
104
|
-
},
|
|
105
|
-
baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
|
|
106
|
-
});
|
|
107
|
-
const response = yield client.api('/me/messages').post(mailPayload);
|
|
108
|
-
return response;
|
|
109
|
-
});
|
|
110
|
-
},
|
|
111
|
-
});
|
|
112
|
-
//# sourceMappingURL=create-draft-email.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-draft-email.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-draft-email.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAChF,+DAA4D;AAC5D,8EAA2D;AAE3D,yCAAsD;AAEzC,QAAA,sBAAsB,GAAG,IAAA,+BAAY,EAAC;IAClD,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,gCAAgC;IAC7C,KAAK,EAAE;QACN,UAAU,EAAE,2BAAQ,CAAC,KAAK,CAAC;YAC1B,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,YAAY,EAAE,2BAAQ,CAAC,KAAK,CAAC;YAC5B,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,EAAE;SAChB,CAAC;QACF,aAAa,EAAE,2BAAQ,CAAC,KAAK,CAAC;YAC7B,WAAW,EAAE,cAAc;YAC3B,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,EAAE;SAChB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,SAAS;YACtB,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,cAAc,CAAC;YACnC,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,MAAM;YACpB,OAAO,EAAE;gBACR,QAAQ,EAAE,KAAK;gBACf,OAAO,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ACD,CAAC,CAAC;gBACH,YAAY,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;oBACzC,YAAY,EAAE;wBACb,OAAO,EAAE,IAAI;qBACb;iBACD,CAAC,CAAC;gBACH,aAAa,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;oBAC3C,YAAY,EAAE;wBACb,OAAO,EAAE,IAAI;qBACb;iBACD,CAAC,CAAC;gBACH,WAAW,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;oBAC7C,aAAa,EAAE,iCAAiC;oBAChD,IAAI,EAAE,UAAU,CAAC,QAAQ,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ;oBACrD,YAAY,EAAE,UAAU,CAAC,IAAI,CAAC,MAAM;iBACpC,CAAC,CAAC;aACH,CAAC;YAEF,MAAM,KAAK,GAAG,MAAA,OAAO,CAAC,IAAI,CAAC,KAAK,0CAAG,OAAO,CAAuB,CAAC;YAClE,MAAM,MAAM,GAAG,+BAAM,CAAC,kBAAkB,CAAC;gBACxC,YAAY,EAAE;oBACb,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC;iBAChE;gBACD,OAAO,EAAE,IAAA,iCAAe,EAAC,KAAK,CAAC;aAC/B,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAEpE,OAAO,QAAQ,CAAC;QACjB,CAAC;KAAA;CACD,CAAC,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const downloadAttachmentAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
2
|
-
messageId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
}>;
|
|
4
|
-
//# sourceMappingURL=download-email-attachment.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"download-email-attachment.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/download-email-attachment.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,wBAAwB;;EA4CnC,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.downloadAttachmentAction = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const microsoft_cloud_1 = require("../common/microsoft-cloud");
|
|
7
|
-
const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
|
|
8
|
-
const auth_1 = require("../common/auth");
|
|
9
|
-
exports.downloadAttachmentAction = (0, pieces_framework_1.createAction)({
|
|
10
|
-
auth: auth_1.microsoftOutlookAuth,
|
|
11
|
-
name: 'downloadAttachment',
|
|
12
|
-
displayName: 'Download Attachment',
|
|
13
|
-
description: 'Download attachments from a specific email message.',
|
|
14
|
-
props: {
|
|
15
|
-
messageId: pieces_framework_1.Property.ShortText({
|
|
16
|
-
displayName: 'Message ID',
|
|
17
|
-
description: 'The ID of the email message containing the attachment.',
|
|
18
|
-
required: true,
|
|
19
|
-
}),
|
|
20
|
-
},
|
|
21
|
-
run(context) {
|
|
22
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
var _a;
|
|
24
|
-
const { messageId } = context.propsValue;
|
|
25
|
-
const cloud = (_a = context.auth.props) === null || _a === void 0 ? void 0 : _a['cloud'];
|
|
26
|
-
const client = microsoft_graph_client_1.Client.initWithMiddleware({
|
|
27
|
-
authProvider: {
|
|
28
|
-
getAccessToken: () => Promise.resolve(context.auth.access_token),
|
|
29
|
-
},
|
|
30
|
-
baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
|
|
31
|
-
});
|
|
32
|
-
const response = yield client
|
|
33
|
-
.api(`/me/messages/${messageId}/attachments`)
|
|
34
|
-
.get();
|
|
35
|
-
const attachments = [];
|
|
36
|
-
for (const attachment of response.value) {
|
|
37
|
-
if (attachment.name && attachment.contentBytes) {
|
|
38
|
-
attachments.push(Object.assign(Object.assign({}, attachment), { file: yield context.files.write({
|
|
39
|
-
fileName: attachment.name || 'test.png',
|
|
40
|
-
data: Buffer.from(attachment.contentBytes, 'base64'),
|
|
41
|
-
}) }));
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return attachments;
|
|
45
|
-
});
|
|
46
|
-
},
|
|
47
|
-
});
|
|
48
|
-
//# sourceMappingURL=download-email-attachment.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"download-email-attachment.js","sourceRoot":"","sources":["../../../../src/lib/actions/download-email-attachment.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAA4D;AAC5D,8EAA2E;AAE3E,yCAAsD;AAEzC,QAAA,wBAAwB,GAAG,IAAA,+BAAY,EAAC;IACpD,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE,qDAAqD;IAClE,KAAK,EAAE;QACN,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,wDAAwD;YACrE,QAAQ,EAAE,IAAI;SACd,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;;YAChB,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAEzC,MAAM,KAAK,GAAG,MAAA,OAAO,CAAC,IAAI,CAAC,KAAK,0CAAG,OAAO,CAAuB,CAAC;YAClE,MAAM,MAAM,GAAG,+BAAM,CAAC,kBAAkB,CAAC;gBACxC,YAAY,EAAE;oBACb,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC;iBAChE;gBACD,OAAO,EAAE,IAAA,iCAAe,EAAC,KAAK,CAAC;aAC/B,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAmB,MAAM,MAAM;iBAC3C,GAAG,CAAC,gBAAgB,SAAS,cAAc,CAAC;iBAC5C,GAAG,EAAE,CAAC;YAER,MAAM,WAAW,GAAG,EAAE,CAAC;YAEvB,KAAK,MAAM,UAAU,IAAI,QAAQ,CAAC,KAAyB,EAAE,CAAC;gBAC7D,IAAI,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,YAAY,EAAE,CAAC;oBAChD,WAAW,CAAC,IAAI,iCACZ,UAAU,KACb,IAAI,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;4BAC/B,QAAQ,EAAE,UAAU,CAAC,IAAI,IAAI,UAAU;4BACvC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,QAAQ,CAAC;yBACpD,CAAC,IACD,CAAC;gBACJ,CAAC;YACF,CAAC;YAGD,OAAO,WAAW,CAAC;QACpB,CAAC;KAAA;CACD,CAAC,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const findEmailAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
2
|
-
searchQuery: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
folderId: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
|
|
4
|
-
top: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
5
|
-
}>;
|
|
6
|
-
//# sourceMappingURL=find-email.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"find-email.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/find-email.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe;;;;EAmE1B,CAAC"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findEmailAction = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const microsoft_cloud_1 = require("../common/microsoft-cloud");
|
|
7
|
-
const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
|
|
8
|
-
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
|
9
|
-
const auth_1 = require("../common/auth");
|
|
10
|
-
const props_1 = require("../common/props");
|
|
11
|
-
exports.findEmailAction = (0, pieces_framework_1.createAction)({
|
|
12
|
-
auth: auth_1.microsoftOutlookAuth,
|
|
13
|
-
name: 'findEmail',
|
|
14
|
-
displayName: 'Find Email',
|
|
15
|
-
description: 'Searches for emails using full-text search.',
|
|
16
|
-
props: {
|
|
17
|
-
searchQuery: pieces_framework_1.Property.ShortText({
|
|
18
|
-
displayName: 'Search Query',
|
|
19
|
-
description: 'Search terms to find emails (e.g., "from:john@example.com", "subject:urgent", "hasAttachments:true")',
|
|
20
|
-
required: true,
|
|
21
|
-
}),
|
|
22
|
-
folderId: (0, props_1.mailFolderIdDropdown)({
|
|
23
|
-
displayName: 'Folder',
|
|
24
|
-
description: 'Search in a specific folder. Leave empty to search all folders.',
|
|
25
|
-
required: false,
|
|
26
|
-
}),
|
|
27
|
-
top: pieces_framework_1.Property.Number({
|
|
28
|
-
displayName: 'Max Results',
|
|
29
|
-
description: 'Maximum number of results to return (1-1000).',
|
|
30
|
-
required: false,
|
|
31
|
-
defaultValue: 25,
|
|
32
|
-
}),
|
|
33
|
-
},
|
|
34
|
-
run(context) {
|
|
35
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
var _a;
|
|
37
|
-
const { searchQuery, folderId, top } = context.propsValue;
|
|
38
|
-
const cloud = (_a = context.auth.props) === null || _a === void 0 ? void 0 : _a['cloud'];
|
|
39
|
-
const client = microsoft_graph_client_1.Client.initWithMiddleware({
|
|
40
|
-
authProvider: {
|
|
41
|
-
getAccessToken: () => Promise.resolve(context.auth.access_token),
|
|
42
|
-
},
|
|
43
|
-
baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
|
|
44
|
-
});
|
|
45
|
-
const baseUrl = folderId ? `/me/mailFolders/${folderId}/messages` : '/me/messages';
|
|
46
|
-
const searchParam = `$search="${searchQuery}"`;
|
|
47
|
-
const topParam = top ? `$top=${Math.min(Math.max(top, 1), 1000)}` : '$top=25';
|
|
48
|
-
const selectParam = ['id', 'subject', 'from', 'toRecipients', 'receivedDateTime'].join(',');
|
|
49
|
-
const queryParams = [searchParam, topParam, selectParam].filter(Boolean).join('&');
|
|
50
|
-
const url = `${baseUrl}?${queryParams}`;
|
|
51
|
-
const headers = {
|
|
52
|
-
ConsistencyLevel: 'eventual',
|
|
53
|
-
Prefer: 'outlook.body-content-type="text"',
|
|
54
|
-
};
|
|
55
|
-
const response = yield client.api(url).headers(headers).get();
|
|
56
|
-
const messages = response.value;
|
|
57
|
-
const nextPageUrl = response['@odata.nextLink'];
|
|
58
|
-
if (searchQuery) {
|
|
59
|
-
messages.sort((a, b) => (0, dayjs_1.default)(b.receivedDateTime).valueOf() - (0, dayjs_1.default)(a.receivedDateTime).valueOf());
|
|
60
|
-
}
|
|
61
|
-
return {
|
|
62
|
-
found: messages.length > 0,
|
|
63
|
-
result: messages,
|
|
64
|
-
hasMore: !!nextPageUrl,
|
|
65
|
-
nextPageUrl: nextPageUrl,
|
|
66
|
-
totalCount: messages.length,
|
|
67
|
-
};
|
|
68
|
-
});
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
//# sourceMappingURL=find-email.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"find-email.js","sourceRoot":"","sources":["../../../../src/lib/actions/find-email.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAA4D;AAC5D,8EAA2E;AAE3E,0DAA0B;AAC1B,yCAAsD;AACtD,2CAAuD;AAE1C,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,6CAA6C;IAC1D,KAAK,EAAE;QACN,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC/B,WAAW,EAAE,cAAc;YAC3B,WAAW,EACV,sGAAsG;YACvG,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,QAAQ,EAAE,IAAA,4BAAoB,EAAC;YAC9B,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,iEAAiE;YAC9E,QAAQ,EAAE,KAAK;SACf,CAAC;QACF,GAAG,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACpB,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,+CAA+C;YAC5D,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,EAAE;SAChB,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;;YAChB,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAE1D,MAAM,KAAK,GAAG,MAAA,OAAO,CAAC,IAAI,CAAC,KAAK,0CAAG,OAAO,CAAuB,CAAC;YAClE,MAAM,MAAM,GAAG,+BAAM,CAAC,kBAAkB,CAAC;gBACxC,YAAY,EAAE;oBACb,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC;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GAAG,IAAA,eAAK,EAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,OAAO,EAAE,CACnF,CAAC;YACH,CAAC;YAED,OAAO;gBACN,KAAK,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC;gBAC1B,MAAM,EAAE,QAAQ;gBAChB,OAAO,EAAE,CAAC,CAAC,WAAW;gBACtB,WAAW,EAAE,WAAW;gBACxB,UAAU,EAAE,QAAQ,CAAC,MAAM;aAC3B,CAAC;QACH,CAAC;KAAA;CACD,CAAC,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const forwardEmailAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
2
|
-
messageId: import("@activepieces/pieces-framework").DropdownProperty<string | undefined, false, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>> | import("@activepieces/pieces-framework").DropdownProperty<string | undefined, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
|
|
3
|
-
recipients: import("@activepieces/pieces-framework").ArrayProperty<true>;
|
|
4
|
-
comment: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
5
|
-
}>;
|
|
6
|
-
//# sourceMappingURL=forward-email.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"forward-email.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/forward-email.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,kBAAkB;;;;EA6D7B,CAAC"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.forwardEmailAction = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const microsoft_cloud_1 = require("../common/microsoft-cloud");
|
|
7
|
-
const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
|
|
8
|
-
const auth_1 = require("../common/auth");
|
|
9
|
-
const props_1 = require("../common/props");
|
|
10
|
-
exports.forwardEmailAction = (0, pieces_framework_1.createAction)({
|
|
11
|
-
auth: auth_1.microsoftOutlookAuth,
|
|
12
|
-
name: 'forwardEmail',
|
|
13
|
-
displayName: 'Forward Email',
|
|
14
|
-
description: 'Forwards an email message.',
|
|
15
|
-
props: {
|
|
16
|
-
messageId: (0, props_1.messageIdDropdown)({
|
|
17
|
-
displayName: 'Email',
|
|
18
|
-
description: 'Select the email message to forward.',
|
|
19
|
-
required: true,
|
|
20
|
-
}),
|
|
21
|
-
recipients: pieces_framework_1.Property.Array({
|
|
22
|
-
displayName: 'To Email(s)',
|
|
23
|
-
required: true,
|
|
24
|
-
}),
|
|
25
|
-
comment: pieces_framework_1.Property.LongText({
|
|
26
|
-
displayName: 'Comment',
|
|
27
|
-
description: 'Optional comment to include with the forwarded message.',
|
|
28
|
-
required: false,
|
|
29
|
-
}),
|
|
30
|
-
},
|
|
31
|
-
run(context) {
|
|
32
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
var _a;
|
|
34
|
-
const { messageId, comment } = context.propsValue;
|
|
35
|
-
const recipients = context.propsValue.recipients;
|
|
36
|
-
const cloud = (_a = context.auth.props) === null || _a === void 0 ? void 0 : _a['cloud'];
|
|
37
|
-
const client = microsoft_graph_client_1.Client.initWithMiddleware({
|
|
38
|
-
authProvider: {
|
|
39
|
-
getAccessToken: () => Promise.resolve(context.auth.access_token),
|
|
40
|
-
},
|
|
41
|
-
baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
|
|
42
|
-
});
|
|
43
|
-
const message = yield client.api(`/me/messages/${messageId}`).get();
|
|
44
|
-
const messagePayload = {
|
|
45
|
-
toRecipients: recipients.map((mail) => ({
|
|
46
|
-
emailAddress: {
|
|
47
|
-
address: mail,
|
|
48
|
-
},
|
|
49
|
-
})),
|
|
50
|
-
body: {
|
|
51
|
-
contentType: 'html',
|
|
52
|
-
content: (comment !== null && comment !== void 0 ? comment : '') + '<br><br>' + message.body.content,
|
|
53
|
-
},
|
|
54
|
-
attachments: message.attachments,
|
|
55
|
-
};
|
|
56
|
-
const response = yield client
|
|
57
|
-
.api(`/me/messages/${messageId}/forward`)
|
|
58
|
-
.post({
|
|
59
|
-
message: messagePayload,
|
|
60
|
-
});
|
|
61
|
-
return Object.assign({ success: true, message: 'Email forwarded successfully.', messageId: response.id }, response);
|
|
62
|
-
});
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
//# sourceMappingURL=forward-email.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"forward-email.js","sourceRoot":"","sources":["../../../../src/lib/actions/forward-email.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAA4D;AAC5D,8EAA2D;AAE3D,yCAAsD;AACtD,2CAAoD;AAEvC,QAAA,kBAAkB,GAAG,IAAA,+BAAY,EAAC;IAC9C,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,4BAA4B;IACzC,KAAK,EAAE;QACN,SAAS,EAAE,IAAA,yBAAiB,EAAC;YAC5B,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,sCAAsC;YACnD,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,KAAK,CAAC;YAC1B,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,yDAAyD;YACtE,QAAQ,EAAE,KAAK;SACf,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;;YAChB,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,UA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export declare const moveEmailToFolderAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
2
|
-
messageId: import("@activepieces/pieces-framework").DropdownProperty<string | undefined, false, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>> | import("@activepieces/pieces-framework").DropdownProperty<string | undefined, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
|
|
3
|
-
destinationFolderId: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
|
|
4
|
-
}>;
|
|
5
|
-
//# sourceMappingURL=move-email-to-folder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"move-email-to-folder.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/move-email-to-folder.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,uBAAuB;;;EAkClC,CAAC"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.moveEmailToFolderAction = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const microsoft_cloud_1 = require("../common/microsoft-cloud");
|
|
7
|
-
const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
|
|
8
|
-
const auth_1 = require("../common/auth");
|
|
9
|
-
const props_1 = require("../common/props");
|
|
10
|
-
exports.moveEmailToFolderAction = (0, pieces_framework_1.createAction)({
|
|
11
|
-
auth: auth_1.microsoftOutlookAuth,
|
|
12
|
-
name: 'moveEmailToFolder',
|
|
13
|
-
displayName: 'Move Email to Folder',
|
|
14
|
-
description: 'Moves an email message to a specific folder.',
|
|
15
|
-
props: {
|
|
16
|
-
messageId: (0, props_1.messageIdDropdown)({
|
|
17
|
-
displayName: 'Email',
|
|
18
|
-
description: 'Select the email message to move.',
|
|
19
|
-
required: true,
|
|
20
|
-
}),
|
|
21
|
-
destinationFolderId: (0, props_1.mailFolderIdDropdown)({
|
|
22
|
-
displayName: 'Destination Folder',
|
|
23
|
-
description: 'The folder to move the email to.',
|
|
24
|
-
required: true,
|
|
25
|
-
}),
|
|
26
|
-
},
|
|
27
|
-
run(context) {
|
|
28
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
var _a;
|
|
30
|
-
const { messageId, destinationFolderId } = context.propsValue;
|
|
31
|
-
const cloud = (_a = context.auth.props) === null || _a === void 0 ? void 0 : _a['cloud'];
|
|
32
|
-
const client = microsoft_graph_client_1.Client.initWithMiddleware({
|
|
33
|
-
authProvider: {
|
|
34
|
-
getAccessToken: () => Promise.resolve(context.auth.access_token),
|
|
35
|
-
},
|
|
36
|
-
baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
|
|
37
|
-
});
|
|
38
|
-
const response = yield client.api(`/me/messages/${messageId}/move`).post({
|
|
39
|
-
destinationId: destinationFolderId,
|
|
40
|
-
});
|
|
41
|
-
return response;
|
|
42
|
-
});
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
//# sourceMappingURL=move-email-to-folder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"move-email-to-folder.js","sourceRoot":"","sources":["../../../../src/lib/actions/move-email-to-folder.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAA4D;AAC5D,8EAA2D;AAC3D,yCAAsD;AACtD,2CAA0E;AAE7D,QAAA,uBAAuB,GAAG,IAAA,+BAAY,EAAC;IACnD,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,sBAAsB;IACnC,WAAW,EAAE,8CAA8C;IAC3D,KAAK,EAAE;QACN,SAAS,EAAE,IAAA,yBAAiB,EAAC;YAC5B,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,mCAAmC;YAChD,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,mBAAmB,EAAE,IAAA,4BAAoB,EAAC;YACzC,WAAW,EAAE,oBAAoB;YACjC,WAAW,EAAE,kCAAkC;YAC/C,QAAQ,EAAE,IAAI;SACd,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;;YAChB,MAAM,EAAE,SAAS,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAE9D,MAAM,KAAK,GAAG,MAAA,OAAO,CAAC,IAAI,CAAC,KAAK,0CAAG,OAAO,CAAuB,CAAC;YAClE,MAAM,MAAM,GAAG,+BAAM,CAAC,kBAAkB,CAAC;gBACxC,YAAY,EAAE;oBACb,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC;iBAChE;gBACD,OAAO,EAAE,IAAA,iCAAe,EAAC,KAAK,CAAC;aAC/B,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,gBAAgB,SAAS,OAAO,CAAC,CAAC,IAAI,CAAC;gBACxE,aAAa,EAAE,mBAAmB;aAClC,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC;QACjB,CAAC;KAAA;CACD,CAAC,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const removeLabelFromEmailAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
2
|
-
messageId: import("@activepieces/pieces-framework").DropdownProperty<string | undefined, false, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>> | import("@activepieces/pieces-framework").DropdownProperty<string | undefined, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
|
|
3
|
-
categories: import("@activepieces/pieces-framework").ArrayProperty<true>;
|
|
4
|
-
}>;
|
|
5
|
-
//# sourceMappingURL=remove-label-from-email.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remove-label-from-email.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/remove-label-from-email.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,0BAA0B;;;EAyCrC,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removeLabelFromEmailAction = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const microsoft_cloud_1 = require("../common/microsoft-cloud");
|
|
7
|
-
const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
|
|
8
|
-
const auth_1 = require("../common/auth");
|
|
9
|
-
const props_1 = require("../common/props");
|
|
10
|
-
exports.removeLabelFromEmailAction = (0, pieces_framework_1.createAction)({
|
|
11
|
-
auth: auth_1.microsoftOutlookAuth,
|
|
12
|
-
name: 'removeLabelFromEmail',
|
|
13
|
-
displayName: 'Remove Label from Email',
|
|
14
|
-
description: 'Removes a category (label) from an email message.',
|
|
15
|
-
props: {
|
|
16
|
-
messageId: (0, props_1.messageIdDropdown)({
|
|
17
|
-
displayName: 'Email',
|
|
18
|
-
description: 'Select the email message to remove the label from.',
|
|
19
|
-
required: true,
|
|
20
|
-
}),
|
|
21
|
-
categories: pieces_framework_1.Property.Array({
|
|
22
|
-
displayName: 'Categories to Remove',
|
|
23
|
-
description: 'Categories to remove from the email.',
|
|
24
|
-
required: true,
|
|
25
|
-
}),
|
|
26
|
-
},
|
|
27
|
-
run(context) {
|
|
28
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
var _a;
|
|
30
|
-
const { messageId, categories } = context.propsValue;
|
|
31
|
-
const cloud = (_a = context.auth.props) === null || _a === void 0 ? void 0 : _a['cloud'];
|
|
32
|
-
const client = microsoft_graph_client_1.Client.initWithMiddleware({
|
|
33
|
-
authProvider: {
|
|
34
|
-
getAccessToken: () => Promise.resolve(context.auth.access_token),
|
|
35
|
-
},
|
|
36
|
-
baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
|
|
37
|
-
});
|
|
38
|
-
const message = yield client.api(`/me/messages/${messageId}`).get();
|
|
39
|
-
const existingCategories = message.categories || [];
|
|
40
|
-
const updatedCategories = existingCategories.filter((category) => !categories.includes(category));
|
|
41
|
-
const response = yield client.api(`/me/messages/${messageId}`).patch({
|
|
42
|
-
categories: updatedCategories,
|
|
43
|
-
});
|
|
44
|
-
return response;
|
|
45
|
-
});
|
|
46
|
-
},
|
|
47
|
-
});
|
|
48
|
-
//# sourceMappingURL=remove-label-from-email.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remove-label-from-email.js","sourceRoot":"","sources":["../../../../src/lib/actions/remove-label-from-email.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAA4D;AAC5D,8EAA2D;AAC3D,yCAAsD;AACtD,2CAAoD;AAEvC,QAAA,0BAA0B,GAAG,IAAA,+BAAY,EAAC;IACtD,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,yBAAyB;IACtC,WAAW,EAAE,mDAAmD;IAChE,KAAK,EAAE;QACN,SAAS,EAAE,IAAA,yBAAiB,EAAC;YAC5B,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,oDAAoD;YACjE,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,KAAK,CAAC;YAC1B,WAAW,EAAE,sBAAsB;YACnC,WAAW,EAAE,sCAAsC;YACnD,QAAQ,EAAE,IAAI;SACd,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;;YAChB,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAErD,MAAM,KAAK,GAAG,MAAA,OAAO,CAAC,IAAI,CAAC,KAAK,0CAAG,OAAO,CAAuB,CAAC;YAClE,MAAM,MAAM,GAAG,+BAAM,CAAC,kBAAkB,CAAC;gBACxC,YAAY,EAAE;oBACb,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC;iBAChE;gBACD,OAAO,EAAE,IAAA,iCAAe,EAAC,KAAK,CAAC;aAC/B,CAAC,CAAC;YAEH,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,gBAAgB,SAAS,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC;YACpE,MAAM,kBAAkB,GAAG,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;YAEpD,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,MAAM,CAClD,CAAC,QAAgB,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,CACpD,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,gBAAgB,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC;gBACpE,UAAU,EAAE,iBAAiB;aAC7B,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC;QACjB,CAAC;KAAA;CACD,CAAC,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const replyEmailAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
2
|
-
messageId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
|
|
3
|
-
bodyFormat: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
4
|
-
replyBody: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
5
|
-
ccRecipients: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
6
|
-
bccRecipients: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
7
|
-
attachments: import("@activepieces/pieces-framework").ArrayProperty<true> | import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
8
|
-
draft: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
9
|
-
}>;
|
|
10
|
-
//# sourceMappingURL=reply-email.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reply-email.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/reply-email.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB;;;;;;;;EAiK3B,CAAC"}
|