@divyacon/piece-microsoft-outlook 0.1.1 → 0.7.8
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 +9 -27
- package/src/i18n/de.json +298 -0
- package/src/i18n/es.json +298 -0
- package/src/i18n/fr.json +298 -0
- package/src/i18n/ja.json +298 -0
- package/src/i18n/nl.json +298 -0
- package/src/i18n/pt.json +298 -0
- package/src/i18n/ru.json +41 -0
- package/src/i18n/translation.json +298 -0
- package/src/i18n/vi.json +41 -0
- package/src/i18n/zh.json +298 -0
- package/src/index.js +77 -0
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -65
- package/dist/index.js.map +0 -1
- package/dist/lib/actions/add-label-to-email.d.ts +0 -5
- package/dist/lib/actions/add-label-to-email.d.ts.map +0 -1
- package/dist/lib/actions/add-label-to-email.js +0 -44
- package/dist/lib/actions/add-label-to-email.js.map +0 -1
- package/dist/lib/actions/create-draft-email.d.ts +0 -10
- package/dist/lib/actions/create-draft-email.d.ts.map +0 -1
- package/dist/lib/actions/create-draft-email.js +0 -108
- package/dist/lib/actions/create-draft-email.js.map +0 -1
- package/dist/lib/actions/download-email-attachment.d.ts +0 -4
- package/dist/lib/actions/download-email-attachment.d.ts.map +0 -1
- package/dist/lib/actions/download-email-attachment.js +0 -44
- package/dist/lib/actions/download-email-attachment.js.map +0 -1
- package/dist/lib/actions/find-email.d.ts +0 -6
- package/dist/lib/actions/find-email.d.ts.map +0 -1
- package/dist/lib/actions/find-email.js +0 -67
- package/dist/lib/actions/find-email.js.map +0 -1
- package/dist/lib/actions/forward-email.d.ts +0 -6
- package/dist/lib/actions/forward-email.d.ts.map +0 -1
- package/dist/lib/actions/forward-email.js +0 -61
- package/dist/lib/actions/forward-email.js.map +0 -1
- package/dist/lib/actions/move-email-to-folder.d.ts +0 -5
- package/dist/lib/actions/move-email-to-folder.d.ts.map +0 -1
- package/dist/lib/actions/move-email-to-folder.js +0 -41
- package/dist/lib/actions/move-email-to-folder.js.map +0 -1
- package/dist/lib/actions/remove-label-from-email.d.ts +0 -5
- package/dist/lib/actions/remove-label-from-email.d.ts.map +0 -1
- package/dist/lib/actions/remove-label-from-email.js +0 -44
- package/dist/lib/actions/remove-label-from-email.js.map +0 -1
- package/dist/lib/actions/reply-email.d.ts +0 -10
- package/dist/lib/actions/reply-email.d.ts.map +0 -1
- package/dist/lib/actions/reply-email.js +0 -161
- package/dist/lib/actions/reply-email.js.map +0 -1
- package/dist/lib/actions/request-approval-send-email.d.ts +0 -6
- package/dist/lib/actions/request-approval-send-email.d.ts.map +0 -1
- package/dist/lib/actions/request-approval-send-email.js +0 -99
- package/dist/lib/actions/request-approval-send-email.js.map +0 -1
- package/dist/lib/actions/send-draft-email.d.ts +0 -4
- package/dist/lib/actions/send-draft-email.d.ts.map +0 -1
- package/dist/lib/actions/send-draft-email.js +0 -38
- package/dist/lib/actions/send-draft-email.js.map +0 -1
- package/dist/lib/actions/send-email.d.ts +0 -10
- package/dist/lib/actions/send-email.d.ts.map +0 -1
- package/dist/lib/actions/send-email.js +0 -111
- package/dist/lib/actions/send-email.js.map +0 -1
- package/dist/lib/common/auth.d.ts +0 -2
- package/dist/lib/common/auth.d.ts.map +0 -1
- package/dist/lib/common/auth.js +0 -88
- package/dist/lib/common/auth.js.map +0 -1
- package/dist/lib/common/client.d.ts +0 -16
- package/dist/lib/common/client.d.ts.map +0 -1
- package/dist/lib/common/client.js +0 -27
- package/dist/lib/common/client.js.map +0 -1
- package/dist/lib/common/microsoft-cloud.d.ts +0 -6
- package/dist/lib/common/microsoft-cloud.d.ts.map +0 -1
- package/dist/lib/common/microsoft-cloud.js +0 -57
- package/dist/lib/common/microsoft-cloud.js.map +0 -1
- package/dist/lib/common/props.d.ts +0 -10
- package/dist/lib/common/props.d.ts.map +0 -1
- package/dist/lib/common/props.js +0 -124
- package/dist/lib/common/props.js.map +0 -1
- package/dist/lib/triggers/new-attachment.d.ts +0 -19
- package/dist/lib/triggers/new-attachment.d.ts.map +0 -1
- package/dist/lib/triggers/new-attachment.js +0 -129
- package/dist/lib/triggers/new-attachment.js.map +0 -1
- package/dist/lib/triggers/new-email-in-folder.d.ts +0 -11
- package/dist/lib/triggers/new-email-in-folder.d.ts.map +0 -1
- package/dist/lib/triggers/new-email-in-folder.js +0 -96
- package/dist/lib/triggers/new-email-in-folder.js.map +0 -1
- package/dist/lib/triggers/new-email.d.ts +0 -15
- package/dist/lib/triggers/new-email.d.ts.map +0 -1
- package/dist/lib/triggers/new-email.js +0 -120
- package/dist/lib/triggers/new-email.js.map +0 -1
- package/src/index.ts +0 -56
- package/src/lib/actions/add-label-to-email.ts +0 -41
- package/src/lib/actions/create-draft-email.ts +0 -106
- package/src/lib/actions/download-email-attachment.ts +0 -47
- package/src/lib/actions/find-email.ts +0 -72
- package/src/lib/actions/forward-email.ts +0 -64
- package/src/lib/actions/move-email-to-folder.ts +0 -36
- package/src/lib/actions/remove-label-from-email.ts +0 -43
- package/src/lib/actions/reply-email.ts +0 -158
- package/src/lib/actions/request-approval-send-email.ts +0 -105
- package/src/lib/actions/send-draft-email.ts +0 -33
- package/src/lib/actions/send-email.ts +0 -110
- package/src/lib/common/auth.ts +0 -85
- package/src/lib/common/client.ts +0 -26
- package/src/lib/common/microsoft-cloud.ts +0 -56
- package/src/lib/common/props.ts +0 -137
- package/src/lib/triggers/new-attachment.ts +0 -153
- package/src/lib/triggers/new-email-in-folder.ts +0 -95
- package/src/lib/triggers/new-email.ts +0 -126
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const replyEmailAction: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>, {
|
|
2
|
-
messageId: import("@agnocon/pieces-framework").DropdownProperty<string, true, import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>>;
|
|
3
|
-
bodyFormat: import("@agnocon/pieces-framework").StaticDropdownProperty<string, true>;
|
|
4
|
-
replyBody: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
5
|
-
ccRecipients: import("@agnocon/pieces-framework").ArrayProperty<false>;
|
|
6
|
-
bccRecipients: import("@agnocon/pieces-framework").ArrayProperty<false>;
|
|
7
|
-
attachments: import("@agnocon/pieces-framework").ArrayProperty<true> | import("@agnocon/pieces-framework").ArrayProperty<false>;
|
|
8
|
-
draft: import("@agnocon/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":"AAQA,eAAO,MAAM,gBAAgB;;;;;;;;EAuJ3B,CAAC"}
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.replyEmailAction = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
// Vendored from Activepieces packages/pieces/community/microsoft-outlook/src/lib/actions/reply-email.ts (MIT).
|
|
6
|
-
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
-
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
-
const auth_1 = require("../common/auth");
|
|
9
|
-
const client_1 = require("../common/client");
|
|
10
|
-
exports.replyEmailAction = (0, pieces_framework_1.createAction)({
|
|
11
|
-
auth: auth_1.microsoftOutlookAuth,
|
|
12
|
-
name: 'reply-email',
|
|
13
|
-
displayName: 'Reply to Email',
|
|
14
|
-
description: 'Reply to an outlook email.',
|
|
15
|
-
audience: 'both',
|
|
16
|
-
aiMetadata: { description: 'Replies to an existing Outlook message (identified by message ID), supporting added CC/BCC recipients and attachments. Set the Create Draft flag to stage the reply without sending; otherwise it is sent immediately. Not idempotent when sending: each call creates and dispatches a new reply.', idempotent: false },
|
|
17
|
-
props: {
|
|
18
|
-
messageId: pieces_framework_1.Property.Dropdown({
|
|
19
|
-
auth: auth_1.microsoftOutlookAuth,
|
|
20
|
-
displayName: 'Email',
|
|
21
|
-
description: 'Select the email message to reply to.',
|
|
22
|
-
required: true,
|
|
23
|
-
refreshers: [],
|
|
24
|
-
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
25
|
-
if (!auth) {
|
|
26
|
-
return {
|
|
27
|
-
disabled: true,
|
|
28
|
-
options: [],
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
const client = client_1.outlookCommon.createClient(auth);
|
|
32
|
-
try {
|
|
33
|
-
const response = yield client
|
|
34
|
-
.api(`${client_1.outlookCommon.mailboxPrefix(auth)}/messages?$top=50&$select=id,subject,from,receivedDateTime`)
|
|
35
|
-
.orderby('receivedDateTime desc')
|
|
36
|
-
.get();
|
|
37
|
-
const messages = response.value;
|
|
38
|
-
return {
|
|
39
|
-
disabled: false,
|
|
40
|
-
options: messages.map((message) => {
|
|
41
|
-
var _a, _b, _c, _d;
|
|
42
|
-
return ({
|
|
43
|
-
label: `${message.subject || 'No Subject'} - ${((_b = (_a = message.from) === null || _a === void 0 ? void 0 : _a.emailAddress) === null || _b === void 0 ? void 0 : _b.name) || ((_d = (_c = message.from) === null || _c === void 0 ? void 0 : _c.emailAddress) === null || _d === void 0 ? void 0 : _d.address) || 'Unknown Sender'}`,
|
|
44
|
-
value: message.id || '',
|
|
45
|
-
});
|
|
46
|
-
}),
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
return {
|
|
51
|
-
disabled: true,
|
|
52
|
-
options: [],
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
}),
|
|
56
|
-
}),
|
|
57
|
-
bodyFormat: pieces_framework_1.Property.StaticDropdown({
|
|
58
|
-
displayName: 'Body Format',
|
|
59
|
-
required: true,
|
|
60
|
-
defaultValue: 'text',
|
|
61
|
-
options: {
|
|
62
|
-
disabled: false,
|
|
63
|
-
options: [
|
|
64
|
-
{ label: 'HTML', value: 'html' },
|
|
65
|
-
{ label: 'Text', value: 'text' },
|
|
66
|
-
],
|
|
67
|
-
},
|
|
68
|
-
}),
|
|
69
|
-
replyBody: pieces_framework_1.Property.LongText({
|
|
70
|
-
displayName: 'Reply Body',
|
|
71
|
-
required: true,
|
|
72
|
-
}),
|
|
73
|
-
ccRecipients: pieces_framework_1.Property.Array({
|
|
74
|
-
displayName: 'CC Recipients',
|
|
75
|
-
required: false,
|
|
76
|
-
}),
|
|
77
|
-
bccRecipients: pieces_framework_1.Property.Array({
|
|
78
|
-
displayName: 'BCC Recipients',
|
|
79
|
-
required: false,
|
|
80
|
-
}),
|
|
81
|
-
attachments: pieces_framework_1.Property.Array({
|
|
82
|
-
displayName: 'Attachments',
|
|
83
|
-
required: false,
|
|
84
|
-
defaultValue: [],
|
|
85
|
-
properties: {
|
|
86
|
-
file: pieces_framework_1.Property.File({
|
|
87
|
-
displayName: 'File',
|
|
88
|
-
required: true,
|
|
89
|
-
}),
|
|
90
|
-
fileName: pieces_framework_1.Property.ShortText({
|
|
91
|
-
displayName: 'File Name',
|
|
92
|
-
required: false,
|
|
93
|
-
}),
|
|
94
|
-
},
|
|
95
|
-
}),
|
|
96
|
-
draft: pieces_framework_1.Property.Checkbox({
|
|
97
|
-
displayName: 'Create Draft',
|
|
98
|
-
description: 'If enabled, creates draft without sending.',
|
|
99
|
-
required: true,
|
|
100
|
-
defaultValue: false,
|
|
101
|
-
}),
|
|
102
|
-
},
|
|
103
|
-
run(context) {
|
|
104
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
105
|
-
const { replyBody, bodyFormat, messageId, draft } = context.propsValue;
|
|
106
|
-
const ccRecipients = context.propsValue.ccRecipients;
|
|
107
|
-
const bccRecipients = context.propsValue.bccRecipients;
|
|
108
|
-
const attachments = context.propsValue.attachments;
|
|
109
|
-
const mailPayload = {
|
|
110
|
-
body: {
|
|
111
|
-
content: replyBody,
|
|
112
|
-
contentType: bodyFormat,
|
|
113
|
-
},
|
|
114
|
-
ccRecipients: ccRecipients.map((mail) => ({
|
|
115
|
-
emailAddress: {
|
|
116
|
-
address: mail,
|
|
117
|
-
},
|
|
118
|
-
})),
|
|
119
|
-
bccRecipients: bccRecipients.map((mail) => ({
|
|
120
|
-
emailAddress: {
|
|
121
|
-
address: mail,
|
|
122
|
-
},
|
|
123
|
-
})),
|
|
124
|
-
attachments: attachments.map((attachment) => ({
|
|
125
|
-
'@odata.type': '#microsoft.graph.fileAttachment',
|
|
126
|
-
name: attachment.fileName || attachment.file.filename,
|
|
127
|
-
contentBytes: attachment.file.base64,
|
|
128
|
-
})),
|
|
129
|
-
};
|
|
130
|
-
const client = client_1.outlookCommon.createClient(context.auth);
|
|
131
|
-
try {
|
|
132
|
-
const response = yield client
|
|
133
|
-
.api(`${client_1.outlookCommon.mailboxPrefix(context.auth)}/messages/${messageId}/createReply`)
|
|
134
|
-
.post({
|
|
135
|
-
message: mailPayload,
|
|
136
|
-
});
|
|
137
|
-
const draftId = response.id;
|
|
138
|
-
if (!draft) {
|
|
139
|
-
yield client.api(`${client_1.outlookCommon.mailboxPrefix(context.auth)}/messages/${draftId}/send`).post({});
|
|
140
|
-
return {
|
|
141
|
-
success: true,
|
|
142
|
-
message: 'Reply sent successfully.',
|
|
143
|
-
draftId: draftId,
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
return {
|
|
147
|
-
success: true,
|
|
148
|
-
message: 'Draft created successfully.',
|
|
149
|
-
draftId: draftId,
|
|
150
|
-
draftLink: `https://outlook.office.com/mail/drafts/id/${draftId}`,
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
catch (error) {
|
|
154
|
-
console.error('Reply Email Error:', error);
|
|
155
|
-
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
156
|
-
throw new Error(errorMessage);
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
},
|
|
160
|
-
});
|
|
161
|
-
//# sourceMappingURL=reply-email.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reply-email.js","sourceRoot":"","sources":["../../../src/lib/actions/reply-email.ts"],"names":[],"mappings":";;;;AAAA,+GAA+G;AAC/G,qEAAqE;AACrE,gEAAgG;AAChG,yCAAsD;AACtD,6CAAiD;AAIpC,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,4BAA4B;IACzC,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,mSAAmS,EAAE,UAAU,EAAE,KAAK,EAAE;IACnV,KAAK,EAAE;QACL,SAAS,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC3B,IAAI,EAAE,2BAAoB;YAC1B,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,uCAAuC;YACpD,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,EAAE;YACd,OAAO,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;gBACtB,IAAI,CAAC,IAAI,EAAE,CAAC;oBACV,OAAO;wBACL,QAAQ,EAAE,IAAI;wBACd,OAAO,EAAE,EAAE;qBACZ,CAAC;gBACJ,CAAC;gBAED,MAAM,MAAM,GAAG,sBAAa,CAAC,YAAY,CAAC,IAA2B,CAAC,CAAC;gBAEvE,IAAI,CAAC;oBACH,MAAM,QAAQ,GAAmB,MAAM,MAAM;yBAC1C,GAAG,CAAC,GAAG,sBAAa,CAAC,aAAa,CAAC,IAA2B,CAAC,4DAA4D,CAAC;yBAC5H,OAAO,CAAC,uBAAuB,CAAC;yBAChC,GAAG,EAAE,CAAC;oBAET,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAkB,CAAC;oBAE7C,OAAO;wBACL,QAAQ,EAAE,KAAK;wB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,CAAC;gBAC3D,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const requestApprovalInMail: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>, {
|
|
2
|
-
recipients: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
subject: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
-
body: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
5
|
-
}>;
|
|
6
|
-
//# sourceMappingURL=request-approval-send-email.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request-approval-send-email.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/request-approval-send-email.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,qBAAqB;;;;EAiGhC,CAAC"}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.requestApprovalInMail = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
// Vendored from Activepieces packages/pieces/community/microsoft-outlook/src/lib/actions/request-approval-send-email.ts (MIT).
|
|
6
|
-
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
-
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
-
const pieces_framework_2 = require("@agnocon/pieces-framework");
|
|
9
|
-
const pieces_framework_3 = require("@agnocon/pieces-framework");
|
|
10
|
-
const auth_1 = require("../common/auth");
|
|
11
|
-
const client_1 = require("../common/client");
|
|
12
|
-
exports.requestApprovalInMail = (0, pieces_framework_1.createAction)({
|
|
13
|
-
auth: auth_1.microsoftOutlookAuth,
|
|
14
|
-
name: 'request_approval_in_mail',
|
|
15
|
-
displayName: 'Request Approval in Email',
|
|
16
|
-
description: 'Send approval request email and then wait until the email is approved or disapproved',
|
|
17
|
-
audience: 'both',
|
|
18
|
-
aiMetadata: { description: 'Sends an email with a single link to a confirmation page where the recipient chooses Approve or Disapprove, then pauses the flow until they respond, resuming with the decision. Use this as a human-in-the-loop approval gate before proceeding. Not idempotent: each call sends a new email and creates a new pending waitpoint.', idempotent: false },
|
|
19
|
-
props: {
|
|
20
|
-
recipients: pieces_framework_1.Property.ShortText({
|
|
21
|
-
displayName: 'To Email Address',
|
|
22
|
-
description: 'The email address of the recipient who will receive the approval request.',
|
|
23
|
-
required: true,
|
|
24
|
-
}),
|
|
25
|
-
subject: pieces_framework_1.Property.ShortText({
|
|
26
|
-
displayName: 'Subject',
|
|
27
|
-
description: 'The subject of the approval request email.',
|
|
28
|
-
required: true,
|
|
29
|
-
}),
|
|
30
|
-
body: pieces_framework_1.Property.LongText({
|
|
31
|
-
displayName: 'Body',
|
|
32
|
-
description: 'The main content of the email. You can include details about the approval request here in the html format or plain text.',
|
|
33
|
-
required: true,
|
|
34
|
-
}),
|
|
35
|
-
},
|
|
36
|
-
run(context) {
|
|
37
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
if (context.executionType === pieces_framework_3.ExecutionType.BEGIN) {
|
|
39
|
-
try {
|
|
40
|
-
const token = context.auth.access_token;
|
|
41
|
-
const recipients = context.propsValue.recipients;
|
|
42
|
-
const { subject, body } = context.propsValue;
|
|
43
|
-
(0, pieces_framework_2.assertNotNullOrUndefined)(token, 'token');
|
|
44
|
-
(0, pieces_framework_2.assertNotNullOrUndefined)(recipients, 'recipients');
|
|
45
|
-
(0, pieces_framework_2.assertNotNullOrUndefined)(subject, 'subject');
|
|
46
|
-
(0, pieces_framework_2.assertNotNullOrUndefined)(body, 'body');
|
|
47
|
-
const waitpoint = yield context.run.createWaitpoint({
|
|
48
|
-
type: 'WEBHOOK',
|
|
49
|
-
});
|
|
50
|
-
const confirmationLink = `${waitpoint.resumeUrl}/confirm`;
|
|
51
|
-
const htmlBody = `
|
|
52
|
-
<div>
|
|
53
|
-
<p>${body}</p>
|
|
54
|
-
<br />
|
|
55
|
-
<p>
|
|
56
|
-
<a href="${confirmationLink}" style="display: inline-block; padding: 10px 20px; background-color: #6e41e2; color: white; text-decoration: none; border-radius: 4px;">Review & Respond</a>
|
|
57
|
-
</p>
|
|
58
|
-
</div>
|
|
59
|
-
`;
|
|
60
|
-
const client = client_1.outlookCommon.createClient(context.auth);
|
|
61
|
-
const mailPayload = {
|
|
62
|
-
subject,
|
|
63
|
-
body: {
|
|
64
|
-
content: htmlBody,
|
|
65
|
-
contentType: 'html',
|
|
66
|
-
},
|
|
67
|
-
toRecipients: [
|
|
68
|
-
{
|
|
69
|
-
emailAddress: {
|
|
70
|
-
address: recipients,
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
],
|
|
74
|
-
};
|
|
75
|
-
const sendResult = yield client.api(`${client_1.outlookCommon.mailboxPrefix(context.auth)}/sendMail`).post({
|
|
76
|
-
message: mailPayload,
|
|
77
|
-
saveToSentItems: true,
|
|
78
|
-
});
|
|
79
|
-
context.run.waitForWaitpoint(waitpoint.id);
|
|
80
|
-
return {
|
|
81
|
-
approved: false, // default approval is false
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
catch (error) {
|
|
85
|
-
console.error('[RequestApprovalEmail] Error during BEGIN execution:', error);
|
|
86
|
-
throw error;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
const action = context.resumePayload.queryParams['action'];
|
|
91
|
-
const approved = action === 'approve';
|
|
92
|
-
return {
|
|
93
|
-
approved,
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
},
|
|
98
|
-
});
|
|
99
|
-
//# sourceMappingURL=request-approval-send-email.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request-approval-send-email.js","sourceRoot":"","sources":["../../../src/lib/actions/request-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AW,CAAC,QAAQ,CAAC,CAAC;gBAC3D,MAAM,QAAQ,GAAG,MAAM,KAAK,SAAS,CAAC;gBAEtC,OAAO;oBACL,QAAQ;iBACT,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const sendDraftEmailAction: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>, {
|
|
2
|
-
messageId: import("@agnocon/pieces-framework").DropdownProperty<string | undefined, false, import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>> | import("@agnocon/pieces-framework").DropdownProperty<string | undefined, true, import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>>;
|
|
3
|
-
}>;
|
|
4
|
-
//# sourceMappingURL=send-draft-email.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"send-draft-email.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/send-draft-email.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,oBAAoB;;EA2B/B,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sendDraftEmailAction = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
// Vendored from Activepieces packages/pieces/community/microsoft-outlook/src/lib/actions/send-draft-email.ts (MIT).
|
|
6
|
-
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
-
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
-
const auth_1 = require("../common/auth");
|
|
9
|
-
const client_1 = require("../common/client");
|
|
10
|
-
const props_1 = require("../common/props");
|
|
11
|
-
exports.sendDraftEmailAction = (0, pieces_framework_1.createAction)({
|
|
12
|
-
auth: auth_1.microsoftOutlookAuth,
|
|
13
|
-
name: 'sendDraftEmail',
|
|
14
|
-
displayName: 'Send Draft Email',
|
|
15
|
-
description: 'Sends a draft email message.',
|
|
16
|
-
audience: 'both',
|
|
17
|
-
aiMetadata: { description: 'Sends an existing draft email (identified by draft message ID) from the Outlook mailbox. Use this to dispatch a draft previously staged by Create Draft Email or a draft reply. Not idempotent: once sent the draft no longer exists, so re-running with the same ID will fail.', idempotent: false },
|
|
18
|
-
props: {
|
|
19
|
-
messageId: (0, props_1.draftMessageIdDropdown)({
|
|
20
|
-
displayName: 'Draft Email',
|
|
21
|
-
description: 'Select the draft email message to send.',
|
|
22
|
-
required: true,
|
|
23
|
-
}),
|
|
24
|
-
},
|
|
25
|
-
run(context) {
|
|
26
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
const { messageId } = context.propsValue;
|
|
28
|
-
const client = client_1.outlookCommon.createClient(context.auth);
|
|
29
|
-
yield client.api(`${client_1.outlookCommon.mailboxPrefix(context.auth)}/messages/${messageId}/send`).post({});
|
|
30
|
-
return {
|
|
31
|
-
success: true,
|
|
32
|
-
message: 'Draft sent successfully.',
|
|
33
|
-
messageId: messageId,
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
//# sourceMappingURL=send-draft-email.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"send-draft-email.js","sourceRoot":"","sources":["../../../src/lib/actions/send-draft-email.ts"],"names":[],"mappings":";;;;AAAA,oHAAoH;AACpH,qEAAqE;AACrE,gEAAyD;AACzD,yCAAsD;AACtD,6CAAiD;AACjD,2CAAyD;AAE5C,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAChD,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,8BAA8B;IAC3C,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,iRAAiR,EAAE,UAAU,EAAE,KAAK,EAAE;IACjU,KAAK,EAAE;QACN,SAAS,EAAE,IAAA,8BAAsB,EAAC;YACjC,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,yCAAyC;YACtD,QAAQ,EAAE,IAAI;SACd,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;YAChB,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAEzC,MAAM,MAAM,GAAG,sBAAa,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAExD,MAAM,MAAM,CAAC,GAAG,CAAC,GAAG,sBAAa,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,SAAS,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAErG,OAAO;gBACN,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,0BAA0B;gBACnC,SAAS,EAAE,SAAS;aACpB,CAAC;QACH,CAAC;KAAA;CACD,CAAC,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const sendEmailAction: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>, {
|
|
2
|
-
recipients: import("@agnocon/pieces-framework").ArrayProperty<true>;
|
|
3
|
-
ccRecipients: import("@agnocon/pieces-framework").ArrayProperty<false>;
|
|
4
|
-
bccRecipients: import("@agnocon/pieces-framework").ArrayProperty<false>;
|
|
5
|
-
subject: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
6
|
-
bodyFormat: import("@agnocon/pieces-framework").StaticDropdownProperty<string, true>;
|
|
7
|
-
body: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
8
|
-
attachments: import("@agnocon/pieces-framework").ArrayProperty<true> | import("@agnocon/pieces-framework").ArrayProperty<false>;
|
|
9
|
-
}>;
|
|
10
|
-
//# sourceMappingURL=send-email.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"send-email.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/send-email.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe;;;;;;;;EAuG1B,CAAC"}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sendEmailAction = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
// Vendored from Activepieces packages/pieces/community/microsoft-outlook/src/lib/actions/send-email.ts (MIT).
|
|
6
|
-
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
-
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
-
const auth_1 = require("../common/auth");
|
|
9
|
-
const client_1 = require("../common/client");
|
|
10
|
-
exports.sendEmailAction = (0, pieces_framework_1.createAction)({
|
|
11
|
-
auth: auth_1.microsoftOutlookAuth,
|
|
12
|
-
name: 'send-email',
|
|
13
|
-
displayName: 'Send Email',
|
|
14
|
-
description: 'Sends an email using Microsoft Outlook.',
|
|
15
|
-
audience: 'both',
|
|
16
|
-
aiMetadata: { description: 'Composes and sends a new email from the authenticated Outlook mailbox to the given recipients, with optional CC/BCC and file attachments. Use this to send a fresh message (not a reply or forward). Not idempotent: each call dispatches a new email and saves a copy to Sent Items.', idempotent: false },
|
|
17
|
-
props: {
|
|
18
|
-
recipients: pieces_framework_1.Property.Array({
|
|
19
|
-
displayName: 'To Email(s)',
|
|
20
|
-
required: true,
|
|
21
|
-
}),
|
|
22
|
-
ccRecipients: pieces_framework_1.Property.Array({
|
|
23
|
-
displayName: 'CC Email(s)',
|
|
24
|
-
required: false,
|
|
25
|
-
defaultValue: [],
|
|
26
|
-
}),
|
|
27
|
-
bccRecipients: pieces_framework_1.Property.Array({
|
|
28
|
-
displayName: 'BCC Email(s)',
|
|
29
|
-
required: false,
|
|
30
|
-
defaultValue: [],
|
|
31
|
-
}),
|
|
32
|
-
subject: pieces_framework_1.Property.ShortText({
|
|
33
|
-
displayName: 'Subject',
|
|
34
|
-
required: true,
|
|
35
|
-
}),
|
|
36
|
-
bodyFormat: pieces_framework_1.Property.StaticDropdown({
|
|
37
|
-
displayName: 'Body Format',
|
|
38
|
-
required: true,
|
|
39
|
-
defaultValue: 'text',
|
|
40
|
-
options: {
|
|
41
|
-
disabled: false,
|
|
42
|
-
options: [
|
|
43
|
-
{ label: 'HTML', value: 'html' },
|
|
44
|
-
{ label: 'Text', value: 'text' },
|
|
45
|
-
],
|
|
46
|
-
},
|
|
47
|
-
}),
|
|
48
|
-
body: pieces_framework_1.Property.LongText({
|
|
49
|
-
displayName: 'Body',
|
|
50
|
-
required: true,
|
|
51
|
-
}),
|
|
52
|
-
attachments: pieces_framework_1.Property.Array({
|
|
53
|
-
displayName: 'Attachments',
|
|
54
|
-
required: false,
|
|
55
|
-
defaultValue: [],
|
|
56
|
-
properties: {
|
|
57
|
-
file: pieces_framework_1.Property.File({
|
|
58
|
-
displayName: 'File',
|
|
59
|
-
required: true,
|
|
60
|
-
}),
|
|
61
|
-
fileName: pieces_framework_1.Property.ShortText({
|
|
62
|
-
displayName: 'File Name',
|
|
63
|
-
required: false,
|
|
64
|
-
}),
|
|
65
|
-
},
|
|
66
|
-
}),
|
|
67
|
-
},
|
|
68
|
-
run(context) {
|
|
69
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
const recipients = context.propsValue.recipients;
|
|
71
|
-
const ccRecipients = context.propsValue.ccRecipients;
|
|
72
|
-
const bccRecipients = context.propsValue.bccRecipients;
|
|
73
|
-
const attachments = context.propsValue.attachments;
|
|
74
|
-
const { subject, body, bodyFormat } = context.propsValue;
|
|
75
|
-
const mailPayload = {
|
|
76
|
-
subject,
|
|
77
|
-
body: {
|
|
78
|
-
content: body,
|
|
79
|
-
contentType: bodyFormat,
|
|
80
|
-
},
|
|
81
|
-
toRecipients: recipients.map((mail) => ({
|
|
82
|
-
emailAddress: {
|
|
83
|
-
address: mail,
|
|
84
|
-
},
|
|
85
|
-
})),
|
|
86
|
-
ccRecipients: ccRecipients.map((mail) => ({
|
|
87
|
-
emailAddress: {
|
|
88
|
-
address: mail,
|
|
89
|
-
},
|
|
90
|
-
})),
|
|
91
|
-
bccRecipients: bccRecipients.map((mail) => ({
|
|
92
|
-
emailAddress: {
|
|
93
|
-
address: mail,
|
|
94
|
-
},
|
|
95
|
-
})),
|
|
96
|
-
attachments: attachments.map((attachment) => ({
|
|
97
|
-
'@odata.type': '#microsoft.graph.fileAttachment',
|
|
98
|
-
name: attachment.fileName || attachment.file.filename,
|
|
99
|
-
contentBytes: attachment.file.base64,
|
|
100
|
-
})),
|
|
101
|
-
};
|
|
102
|
-
const client = client_1.outlookCommon.createClient(context.auth);
|
|
103
|
-
const response = yield client.api(`${client_1.outlookCommon.mailboxPrefix(context.auth)}/sendMail`).post({
|
|
104
|
-
message: mailPayload,
|
|
105
|
-
saveToSentItems: 'true',
|
|
106
|
-
});
|
|
107
|
-
return response;
|
|
108
|
-
});
|
|
109
|
-
},
|
|
110
|
-
});
|
|
111
|
-
//# sourceMappingURL=send-email.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"send-email.js","sourceRoot":"","sources":["../../../src/lib/actions/send-email.ts"],"names":[],"mappings":";;;;AAAA,8GAA8G;AAC9G,qEAAqE;AACrE,gEAA2E;AAG3E,yCAAsD;AACtD,6CAAiD;AAEpC,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,yCAAyC;IACtD,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,uRAAuR,EAAE,UAAU,EAAE,KAAK,EAAE;IACvU,KAAK,EAAE;QACN,UAAU,EAAE,2BAAQ,CAAC,KAAK,CAAC;Y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I,CAAC,CAAC;YAExD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,GAAG,sBAAa,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC;gBAC/F,OAAO,EAAE,WAAW;gBACpB,eAAe,EAAE,MAAM;aACvB,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC;QACjB,CAAC;KAAA;CACD,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/common/auth.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,oBAAoB,qGAqC/B,CAAC"}
|
package/dist/lib/common/auth.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.microsoftOutlookAuth = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
// Vendored from Activepieces packages/pieces/community/microsoft-outlook/src/lib/common/auth.ts (MIT).
|
|
6
|
-
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
-
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
-
const microsoft_cloud_1 = require("./microsoft-cloud");
|
|
9
|
-
const client_1 = require("./client");
|
|
10
|
-
const authDesc = `
|
|
11
|
-
This connection supports two access modes. Pick the matching **Grant Type** and **Access Mode** below.
|
|
12
|
-
|
|
13
|
-
**Delegated (Authorization Code)** — acts as the signed-in user. Keep **Access Mode** on the Delegated option, leave **Mailbox** blank, and keep **Tenant ID** as \`common\`. If you use your own Azure app, follow the [Azure app creation guide](https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app#register-an-application), set the **Redirect URI** to {{redirectUrl}} and add these **Microsoft Graph (Delegated) permissions**:
|
|
14
|
-
- User.Read
|
|
15
|
-
- Mail.ReadWrite
|
|
16
|
-
- Mail.Send
|
|
17
|
-
- Calendars.Read
|
|
18
|
-
- offline_access
|
|
19
|
-
|
|
20
|
-
**App-only (Client Credentials)** — acts as the application, with no signed-in user. Choose the **Server-to-Server (Client Credentials)** authentication method when creating the connection. Then set **Access Mode** to the App-only option for your cloud, set **Tenant ID** to your Directory (tenant) ID, and set **Mailbox** to the target user's email/UPN or object ID. You must register your own Azure app (the shared app cannot grant app-only access to your tenant). Add these **Microsoft Graph (Application) permissions** and **grant admin consent**:
|
|
21
|
-
- Mail.ReadWrite
|
|
22
|
-
- Mail.Send
|
|
23
|
-
|
|
24
|
-
For app-only, Microsoft grants tenant-wide mailbox access by default — scope it to specific mailboxes with an [ApplicationAccessPolicy](https://learn.microsoft.com/en-us/graph/auth-limit-mailbox-access).
|
|
25
|
-
`;
|
|
26
|
-
exports.microsoftOutlookAuth = pieces_framework_1.PieceAuth.OAuth2({
|
|
27
|
-
description: authDesc,
|
|
28
|
-
grantType: 'both_client_credentials_and_authorization_code',
|
|
29
|
-
props: {
|
|
30
|
-
cloud: microsoft_cloud_1.microsoftCloudProperty,
|
|
31
|
-
accessMode: microsoft_cloud_1.microsoftScopeProperty,
|
|
32
|
-
tenant: pieces_framework_1.Property.ShortText({
|
|
33
|
-
displayName: 'Tenant ID',
|
|
34
|
-
description: 'Use "common" for the default delegated multi-tenant flow. For app-only (Client Credentials), set this to your Directory (tenant) ID.',
|
|
35
|
-
required: true,
|
|
36
|
-
defaultValue: 'common',
|
|
37
|
-
}),
|
|
38
|
-
mailbox: pieces_framework_1.Property.ShortText({
|
|
39
|
-
displayName: 'Mailbox (App-only)',
|
|
40
|
-
description: 'Email/UPN or user object ID of the mailbox to act on. Required for app-only (Client Credentials). Leave blank for delegated access (acts as the signed-in user).',
|
|
41
|
-
required: false,
|
|
42
|
-
}),
|
|
43
|
-
},
|
|
44
|
-
authUrl: 'https://{cloud}/{tenant}/oauth2/v2.0/authorize',
|
|
45
|
-
tokenUrl: 'https://{cloud}/{tenant}/oauth2/v2.0/token',
|
|
46
|
-
required: true,
|
|
47
|
-
scope: ['{accessMode}'],
|
|
48
|
-
prompt: 'omit',
|
|
49
|
-
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
50
|
-
try {
|
|
51
|
-
const authValue = auth;
|
|
52
|
-
const client = client_1.outlookCommon.createClient(authValue);
|
|
53
|
-
yield client
|
|
54
|
-
.api(`${client_1.outlookCommon.mailboxPrefix(authValue)}/mailFolders/inbox`)
|
|
55
|
-
.get();
|
|
56
|
-
return { valid: true };
|
|
57
|
-
}
|
|
58
|
-
catch (error) {
|
|
59
|
-
return { valid: false, error: describeGraphError(error) };
|
|
60
|
-
}
|
|
61
|
-
}),
|
|
62
|
-
});
|
|
63
|
-
function describeGraphError(error) {
|
|
64
|
-
if (typeof error === 'object' && error !== null) {
|
|
65
|
-
const parts = [];
|
|
66
|
-
if ('statusCode' in error && error.statusCode) {
|
|
67
|
-
parts.push(`HTTP ${String(error.statusCode)}`);
|
|
68
|
-
}
|
|
69
|
-
if ('code' in error && error.code) {
|
|
70
|
-
parts.push(String(error.code));
|
|
71
|
-
}
|
|
72
|
-
if ('message' in error && error.message) {
|
|
73
|
-
parts.push(String(error.message));
|
|
74
|
-
}
|
|
75
|
-
if ('body' in error && error.body) {
|
|
76
|
-
const body = error.body;
|
|
77
|
-
parts.push(typeof body === 'string' ? body.slice(0, 800) : JSON.stringify(body).slice(0, 800));
|
|
78
|
-
}
|
|
79
|
-
if (parts.length > 0) {
|
|
80
|
-
return parts.join(' | ');
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (error instanceof Error && error.message) {
|
|
84
|
-
return error.message;
|
|
85
|
-
}
|
|
86
|
-
return 'Unknown error while validating the connection.';
|
|
87
|
-
}
|
|
88
|
-
//# sourceMappingURL=auth.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAA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CAAC;IACvB,CAAC;IACD,OAAO,gDAAgD,CAAC;AAC1D,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { OAuth2PropertyValue } from '@agnocon/pieces-framework';
|
|
2
|
-
import { Client } from '@microsoft/microsoft-graph-client';
|
|
3
|
-
declare function createClient(auth: OAuth2PropertyValue): Client;
|
|
4
|
-
/**
|
|
5
|
-
* Delegated connections act as the signed-in user (`/me`). App-only
|
|
6
|
-
* (client-credentials) tokens have no user context, so they must address a
|
|
7
|
-
* specific mailbox via `/users/{id}`. Presence of the `mailbox` prop is what
|
|
8
|
-
* distinguishes the two, since the piece cannot read the connection's grant type.
|
|
9
|
-
*/
|
|
10
|
-
declare function mailboxPrefix(auth: OAuth2PropertyValue): string;
|
|
11
|
-
export declare const outlookCommon: {
|
|
12
|
-
createClient: typeof createClient;
|
|
13
|
-
mailboxPrefix: typeof mailboxPrefix;
|
|
14
|
-
};
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/lib/common/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAG3D,iBAAS,YAAY,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,CAQvD;AAED;;;;;GAKG;AACH,iBAAS,aAAa,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,CAGxD;AAED,eAAO,MAAM,aAAa;;;CAAkC,CAAC"}
|