@pipedream/microsoft_outlook 0.0.2 → 0.0.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/microsoft_outlook.app.mjs +14 -0
- package/package.json +1 -1
- package/sources/common.mjs +13 -0
- package/sources/new-calendar-event/new-calendar-event.mjs +27 -12
- package/sources/new-contact/new-contact.mjs +27 -12
- package/sources/new-email/new-email.mjs +27 -12
- package/sources/updated-calendar-event/updated-calendar-event.mjs +27 -13
|
@@ -216,6 +216,13 @@ export default {
|
|
|
216
216
|
...args,
|
|
217
217
|
});
|
|
218
218
|
},
|
|
219
|
+
async listCalendarEvents({ ...args } = {}) {
|
|
220
|
+
return await this._makeRequest({
|
|
221
|
+
method: "GET",
|
|
222
|
+
path: "/me/events",
|
|
223
|
+
...args,
|
|
224
|
+
});
|
|
225
|
+
},
|
|
219
226
|
async sendEmail({ ...args } = {}) {
|
|
220
227
|
return await this._makeRequest({
|
|
221
228
|
method: "POST",
|
|
@@ -274,6 +281,13 @@ export default {
|
|
|
274
281
|
...args,
|
|
275
282
|
});
|
|
276
283
|
},
|
|
284
|
+
async listMessages({ ...args } = {}) {
|
|
285
|
+
return await this._makeRequest({
|
|
286
|
+
method: "GET",
|
|
287
|
+
path: "/me/messages",
|
|
288
|
+
...args,
|
|
289
|
+
});
|
|
290
|
+
},
|
|
277
291
|
async getCalendarEvent({
|
|
278
292
|
eventId,
|
|
279
293
|
...args
|
package/package.json
CHANGED
package/sources/common.mjs
CHANGED
|
@@ -24,6 +24,19 @@ export default {
|
|
|
24
24
|
},
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
|
+
hooks: {
|
|
28
|
+
async deploy() {
|
|
29
|
+
const { value: events } = await this.getSampleEvents({
|
|
30
|
+
pageSize: 25,
|
|
31
|
+
});
|
|
32
|
+
if (!events || events.length == 0) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
for (const item of events) {
|
|
36
|
+
this.emitEvent(item);
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
},
|
|
27
40
|
methods: {
|
|
28
41
|
getIntervalEnd() {
|
|
29
42
|
return new Date(Date.now() + getRenewalInterval(true));
|
|
@@ -3,11 +3,12 @@ import common from "../common.mjs";
|
|
|
3
3
|
export default {
|
|
4
4
|
...common,
|
|
5
5
|
key: "microsoft_outlook-new-calendar-event",
|
|
6
|
-
name: "New Calendar Event",
|
|
6
|
+
name: "New Calendar Event (Instant)",
|
|
7
7
|
description: "Emit new event when a new Calendar event is created",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.2",
|
|
9
9
|
type: "source",
|
|
10
10
|
hooks: {
|
|
11
|
+
...common.hooks,
|
|
11
12
|
async activate() {
|
|
12
13
|
await this.activate({
|
|
13
14
|
changeType: "created",
|
|
@@ -18,6 +19,29 @@ export default {
|
|
|
18
19
|
await this.deactivate();
|
|
19
20
|
},
|
|
20
21
|
},
|
|
22
|
+
methods: {
|
|
23
|
+
...common.methods,
|
|
24
|
+
async getSampleEvents({ pageSize }) {
|
|
25
|
+
return this.microsoftOutlook.listCalendarEvents({
|
|
26
|
+
params: {
|
|
27
|
+
$top: pageSize,
|
|
28
|
+
$orderby: "createdDateTime desc",
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
emitEvent(item) {
|
|
33
|
+
this.$emit({
|
|
34
|
+
message: item,
|
|
35
|
+
}, this.generateMeta(item));
|
|
36
|
+
},
|
|
37
|
+
generateMeta(item) {
|
|
38
|
+
return {
|
|
39
|
+
id: item.id,
|
|
40
|
+
summary: `New calendar event (ID:${item.id})`,
|
|
41
|
+
ts: Date.parse(item.createdDateTime),
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
},
|
|
21
45
|
async run(event) {
|
|
22
46
|
await this.run({
|
|
23
47
|
event,
|
|
@@ -25,16 +49,7 @@ export default {
|
|
|
25
49
|
const item = await this.microsoftOutlook.getCalendarEvent({
|
|
26
50
|
eventId: resourceId,
|
|
27
51
|
});
|
|
28
|
-
this
|
|
29
|
-
{
|
|
30
|
-
message: item,
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
id: item.id,
|
|
34
|
-
ts: Date.parse(item.createdDateTime),
|
|
35
|
-
summary: `New calendar event (ID:${item.id})`,
|
|
36
|
-
},
|
|
37
|
-
);
|
|
52
|
+
this.emitEvent(item);
|
|
38
53
|
},
|
|
39
54
|
});
|
|
40
55
|
},
|
|
@@ -3,11 +3,12 @@ import common from "../common.mjs";
|
|
|
3
3
|
export default {
|
|
4
4
|
...common,
|
|
5
5
|
key: "microsoft_outlook-new-contact",
|
|
6
|
-
name: "New Contact Event",
|
|
6
|
+
name: "New Contact Event (Instant)",
|
|
7
7
|
description: "Emit new event when a new Contact is created",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.2",
|
|
9
9
|
type: "source",
|
|
10
10
|
hooks: {
|
|
11
|
+
...common.hooks,
|
|
11
12
|
async activate() {
|
|
12
13
|
await this.activate({
|
|
13
14
|
changeType: "created",
|
|
@@ -18,6 +19,29 @@ export default {
|
|
|
18
19
|
await this.deactivate();
|
|
19
20
|
},
|
|
20
21
|
},
|
|
22
|
+
methods: {
|
|
23
|
+
...common.methods,
|
|
24
|
+
async getSampleEvents({ pageSize }) {
|
|
25
|
+
return this.microsoftOutlook.listContacts({
|
|
26
|
+
params: {
|
|
27
|
+
$top: pageSize,
|
|
28
|
+
$orderby: "createdDateTime desc",
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
emitEvent(item) {
|
|
33
|
+
this.$emit({
|
|
34
|
+
contact: item,
|
|
35
|
+
}, this.generateMeta(item));
|
|
36
|
+
},
|
|
37
|
+
generateMeta(item) {
|
|
38
|
+
return {
|
|
39
|
+
id: item.id,
|
|
40
|
+
summary: `New contact (ID:${item.id})`,
|
|
41
|
+
ts: Date.parse(item.createdDateTime),
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
},
|
|
21
45
|
async run(event) {
|
|
22
46
|
await this.run({
|
|
23
47
|
event,
|
|
@@ -25,16 +49,7 @@ export default {
|
|
|
25
49
|
const item = await this.microsoftOutlook.getContact({
|
|
26
50
|
contactId: resourceId,
|
|
27
51
|
});
|
|
28
|
-
this
|
|
29
|
-
{
|
|
30
|
-
contact: item,
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
id: item.id,
|
|
34
|
-
ts: Date.parse(item.createdDateTime),
|
|
35
|
-
summary: `New contact (ID:${item.id})`,
|
|
36
|
-
},
|
|
37
|
-
);
|
|
52
|
+
this.emitEvent(item);
|
|
38
53
|
},
|
|
39
54
|
});
|
|
40
55
|
},
|
|
@@ -3,11 +3,12 @@ import common from "../common.mjs";
|
|
|
3
3
|
export default {
|
|
4
4
|
...common,
|
|
5
5
|
key: "microsoft_outlook-new-email",
|
|
6
|
-
name: "New Email Event",
|
|
6
|
+
name: "New Email Event (Instant)",
|
|
7
7
|
description: "Emit new event when an email received",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.2",
|
|
9
9
|
type: "source",
|
|
10
10
|
hooks: {
|
|
11
|
+
...common.hooks,
|
|
11
12
|
async activate() {
|
|
12
13
|
await this.activate({
|
|
13
14
|
changeType: "created",
|
|
@@ -18,6 +19,29 @@ export default {
|
|
|
18
19
|
await this.deactivate();
|
|
19
20
|
},
|
|
20
21
|
},
|
|
22
|
+
methods: {
|
|
23
|
+
...common.methods,
|
|
24
|
+
async getSampleEvents({ pageSize }) {
|
|
25
|
+
return this.microsoftOutlook.listMessages({
|
|
26
|
+
params: {
|
|
27
|
+
$top: pageSize,
|
|
28
|
+
$orderby: "createdDateTime desc",
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
emitEvent(item) {
|
|
33
|
+
this.$emit({
|
|
34
|
+
email: item,
|
|
35
|
+
}, this.generateMeta(item));
|
|
36
|
+
},
|
|
37
|
+
generateMeta(item) {
|
|
38
|
+
return {
|
|
39
|
+
id: item.id,
|
|
40
|
+
summary: `New email (ID:${item.id})`,
|
|
41
|
+
ts: Date.parse(item.createdDateTime),
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
},
|
|
21
45
|
async run(event) {
|
|
22
46
|
await this.run({
|
|
23
47
|
event,
|
|
@@ -25,16 +49,7 @@ export default {
|
|
|
25
49
|
const item = await this.microsoftOutlook.getMessage({
|
|
26
50
|
messageId: resourceId,
|
|
27
51
|
});
|
|
28
|
-
this
|
|
29
|
-
{
|
|
30
|
-
email: item,
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
id: item.id,
|
|
34
|
-
ts: Date.parse(item.createdDateTime),
|
|
35
|
-
summary: `New email (ID:${item.id})`,
|
|
36
|
-
},
|
|
37
|
-
);
|
|
52
|
+
this.emitEvent(item);
|
|
38
53
|
},
|
|
39
54
|
});
|
|
40
55
|
},
|
|
@@ -3,12 +3,12 @@ import common from "../common.mjs";
|
|
|
3
3
|
export default {
|
|
4
4
|
...common,
|
|
5
5
|
key: "microsoft_outlook-updated-calendar-event",
|
|
6
|
-
name: "New Calendar Event Update",
|
|
6
|
+
name: "New Calendar Event Update (Instant)",
|
|
7
7
|
description: "Emit new event when a Calendar event is updated",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.2",
|
|
9
9
|
type: "source",
|
|
10
|
-
dedupe: "unique",
|
|
11
10
|
hooks: {
|
|
11
|
+
...common.hooks,
|
|
12
12
|
async activate() {
|
|
13
13
|
await this.activate({
|
|
14
14
|
changeType: "updated",
|
|
@@ -19,6 +19,29 @@ export default {
|
|
|
19
19
|
await this.deactivate();
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
|
+
methods: {
|
|
23
|
+
...common.methods,
|
|
24
|
+
async getSampleEvents({ pageSize }) {
|
|
25
|
+
return this.microsoftOutlook.listCalendarEvents({
|
|
26
|
+
params: {
|
|
27
|
+
$top: pageSize,
|
|
28
|
+
$orderby: "lastModifiedDateTime desc",
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
emitEvent(item) {
|
|
33
|
+
this.$emit({
|
|
34
|
+
message: item,
|
|
35
|
+
}, this.generateMeta(item));
|
|
36
|
+
},
|
|
37
|
+
generateMeta(item) {
|
|
38
|
+
return {
|
|
39
|
+
id: item.id,
|
|
40
|
+
summary: `Calendar event updated (ID:${item.id})`,
|
|
41
|
+
ts: Date.parse(item.createdDateTime),
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
},
|
|
22
45
|
async run(event) {
|
|
23
46
|
await this.run({
|
|
24
47
|
event,
|
|
@@ -26,16 +49,7 @@ export default {
|
|
|
26
49
|
const item = await this.microsoftOutlook.getCalendarEvent({
|
|
27
50
|
eventId: resourceId,
|
|
28
51
|
});
|
|
29
|
-
this
|
|
30
|
-
{
|
|
31
|
-
message: item,
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
id: item.id,
|
|
35
|
-
ts: Date.parse(item.createdDateTime),
|
|
36
|
-
summary: `Calendar event updated (ID:${item.id})`,
|
|
37
|
-
},
|
|
38
|
-
);
|
|
52
|
+
this.emitEvent(item);
|
|
39
53
|
},
|
|
40
54
|
});
|
|
41
55
|
},
|