@pipedream/microsoft_outlook_calendar 8.5.0 → 8.5.1

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/microsoft_outlook_calendar",
3
- "version": "8.5.0",
3
+ "version": "8.5.1",
4
4
  "description": "Pipedream Microsoft Outlook Calendar Components",
5
5
  "main": "microsoft_outlook_calendar.app.mjs",
6
6
  "keywords": [
@@ -5,7 +5,7 @@ export default {
5
5
  key: "microsoft_outlook_calendar-new-upcoming-event-polling",
6
6
  name: "New Upcoming Calendar Event (Polling)",
7
7
  description: "Emit new event based on a time interval before an upcoming calendar event. [See the documentation](https://docs.microsoft.com/en-us/graph/api/user-list-events)",
8
- version: "0.0.8",
8
+ version: "0.0.9",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
@@ -20,7 +20,7 @@ export default {
20
20
  pollingInfo: {
21
21
  type: "alert",
22
22
  alertType: "info",
23
- content: "Since this source executes based on a timer, event emission may be slightly delayed. For example, if the source runs every 5 minutes, the delay may be up to 5 minutes. You can use the `new-upcoming-event` source for instant event emission.",
23
+ content: "Since this source executes based on a timer, event emission may be slightly delayed. For example, if the source runs every 5 minutes, the delay may be up to 5 minutes.",
24
24
  },
25
25
  minutesBefore: {
26
26
  type: "integer",
@@ -134,4 +134,3 @@ export default {
134
134
  this._setEmittedEvents(emittedEvents);
135
135
  },
136
136
  };
137
-
@@ -1,92 +0,0 @@
1
- import common from "../common/common.mjs";
2
- import taskScheduler from "@pipedream/pipedream/sources/new-scheduled-tasks/new-scheduled-tasks.mjs";
3
-
4
- export default {
5
- ...common,
6
- key: "microsoft_outlook_calendar-new-upcoming-event",
7
- name: "New Upcoming Calendar Event",
8
- description: "Emit new event when a Calendar event is upcoming, this source is using `reminderMinutesBeforeStart` property of the event to determine the time it should emit.",
9
- version: "0.0.12",
10
- type: "source",
11
- props: {
12
- ...common.props,
13
- pipedream: taskScheduler.props.pipedream,
14
- },
15
- hooks: {
16
- ...common.hooks,
17
- async activate() {
18
- await this.activate({
19
- changeType: "updated",
20
- resource: "/me/events",
21
- });
22
- },
23
- async deactivate() {
24
- await this.deactivate();
25
- },
26
- },
27
- methods: {
28
- ...taskScheduler.methods,
29
- ...common.methods,
30
- _hasDeployed() {
31
- const result = this.db.get("hasDeployed");
32
- this.db.set("hasDeployed", true);
33
- return result;
34
- },
35
- subtractMinutes(date, minutes) {
36
- return date.getTime() - minutes * 60000;
37
- },
38
- async getSampleEvents({ pageSize }) {
39
- return this.microsoftOutlook.listCalendarEvents({
40
- params: {
41
- $top: pageSize,
42
- $orderby: "lastModifiedDateTime desc",
43
- },
44
- });
45
- },
46
- emitEvent(item) {
47
- this.$emit({
48
- message: item,
49
- }, this.generateMeta(item));
50
- },
51
- generateMeta(item) {
52
- return {
53
- id: item.id,
54
- summary: `Upcoming event - ${item.subject}`,
55
- ts: +Date.parse(item.createdDateTime),
56
- };
57
- },
58
- },
59
- async run(event) {
60
- if (event.$channel === this.selfChannel()) {
61
- const item = await this.microsoftOutlook.getCalendarEvent({
62
- eventId: event.eventId,
63
- });
64
- // checking if the event was modified after this scheduling
65
- if (item.lastModifiedDateTime === event.lastModifiedControl) {
66
- this.emitEvent(item);
67
- }
68
- return;
69
- }
70
- await this.run({
71
- event,
72
- emitFn: async ({ resourceId } = {}) => {
73
- if (!this._hasDeployed()) {
74
- await this.selfSubscribe();
75
- }
76
- const item = await this.microsoftOutlook.getCalendarEvent({
77
- eventId: resourceId,
78
- });
79
- if (event.$channel !== this.selfChannel()) {
80
- const startTime = new Date(item.start.dateTime || item.start.date);
81
- const reminderMinutesBeforeStart = item.reminderMinutesBeforeStart || 15;
82
- const later = new Date(this.subtractMinutes(startTime, reminderMinutesBeforeStart));
83
- const newEvent = {
84
- lastModifiedControl: item.lastModifiedDateTime,
85
- eventId: resourceId,
86
- };
87
- this.emitScheduleEvent(newEvent, later);
88
- }
89
- },
90
- });
91
- },
92
- };